From: support Date: Mon, 16 Jan 2023 08:22:05 +0000 (+0000) Subject: Built motion from commit 377f727e.|2.6.28 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22%7B%7Blicense.mail?a=commitdiff_plain;h=9601222b5da05be413a3669c4fc0734a0f3d2c5d;p=motion2.git Built motion from commit 377f727e.|2.6.28 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c452c35..5029ffb 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-12T15:59:12.322Z", + "time": "2023-01-16T08:13:10.720Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c450808..2d5e20e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-12T15:59:12.322Z", + "time": "2023-01-16T08:13:10.720Z", "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 97fc0e8..6638d1f 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 _0x2aa0=['sequelize','exports','getDataValue','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x512ce0,_0xf5e83f){var _0x7118b0=function(_0x26010){while(--_0x26010){_0x512ce0['push'](_0x512ce0['shift']());}};_0x7118b0(++_0xf5e83f);}(_0x2aa0,0x6c));var _0x02aa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2aa0[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x02aa('0x0'));module[_0x02aa('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x13e896){return this[_0x02aa('0x2')]('action');}},'action':{'type':Sequelize[_0x02aa('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x02aa('0x4'),_0x02aa('0x5'),_0x02aa('0x6'),_0x02aa('0x7'),_0x02aa('0x8'),_0x02aa('0x9'),_0x02aa('0xa')]],'msg':_0x02aa('0xb')}},'comment':_0x02aa('0xb')},'data1':{'type':Sequelize[_0x02aa('0x3')](0x1000),'comment':_0x02aa('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x02aa('0xd')},'data3':{'type':Sequelize[_0x02aa('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[_0x02aa('0x3')](0x1000),'comments':_0x02aa('0xe')},'data5':{'type':Sequelize[_0x02aa('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x02aa('0xf')},'data7':{'type':Sequelize[_0x02aa('0x10')],'comments':_0x02aa('0x11')}}; \ No newline at end of file +var _0x5080=['STRING','contactManager','motionbar','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','action'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5080,0x66));var _0x0508=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5080[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x0508('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3cbf9e){return this['getDataValue'](_0x0508('0x1'));}},'action':{'type':Sequelize[_0x0508('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0508('0x3'),'integration',_0x0508('0x4'),'jscripty','urlForward','browser','bot','script']],'msg':_0x0508('0x5')}},'comment':_0x0508('0x5')},'data1':{'type':Sequelize[_0x0508('0x2')](0x1000),'comment':_0x0508('0x6')},'data2':{'type':Sequelize[_0x0508('0x2')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x0508('0x7')},'data4':{'type':Sequelize[_0x0508('0x2')](0x1000),'comments':_0x0508('0x8')},'data5':{'type':Sequelize[_0x0508('0x2')](0x1000),'comments':_0x0508('0x9')},'data6':{'type':Sequelize[_0x0508('0x2')],'comments':_0x0508('0xa')},'data7':{'type':Sequelize[_0x0508('0xb')],'comments':_0x0508('0xc')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 786fb18..ac22e37 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 _0xda6d=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','body','Action','catch','find','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa87db6,_0x7fb711){var _0x48ae12=function(_0x5aae8d){while(--_0x5aae8d){_0xa87db6['push'](_0xa87db6['shift']());}};_0x48ae12(++_0x7fb711);}(_0xda6d,0xea));var _0xdda6=function(_0x32a9c4,_0x2d26b5){_0x32a9c4=_0x32a9c4-0x0;var _0x1e5d01=_0xda6d[_0x32a9c4];return _0x1e5d01;};'use strict';var emlformat=require(_0xdda6('0x0'));var rimraf=require(_0xdda6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdda6('0x2'));var rp=require(_0xdda6('0x3'));var moment=require('moment');var BPromise=require(_0xdda6('0x4'));var Mustache=require(_0xdda6('0x5'));var util=require('util');var path=require(_0xdda6('0x6'));var sox=require('sox');var csv=require(_0xdda6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdda6('0x8'));var squel=require('squel');var crypto=require(_0xdda6('0x9'));var jsforce=require(_0xdda6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdda6('0x7'));var querystring=require(_0xdda6('0xb'));var Papa=require(_0xdda6('0xc'));var Redis=require(_0xdda6('0xd'));var authService=require(_0xdda6('0xe'));var qs=require(_0xdda6('0xf'));var as=require(_0xdda6('0x10'));var hardwareService=require(_0xdda6('0x11'));var logger=require(_0xdda6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xdda6('0x13'));var licenseUtil=require(_0xdda6('0x14'));var db=require(_0xdda6('0x15'))['db'];function respondWithStatusCode(_0x33de47,_0x17ef47){_0x17ef47=_0x17ef47||0xcc;return function(_0x26aba7){if(_0x26aba7){return _0x33de47[_0xdda6('0x16')](_0x17ef47);}return _0x33de47[_0xdda6('0x17')](_0x17ef47)[_0xdda6('0x18')]();};}function respondWithResult(_0x4d2f94,_0x50a45e){_0x50a45e=_0x50a45e||0xc8;return function(_0x5d11ed){if(_0x5d11ed){return _0x4d2f94[_0xdda6('0x17')](_0x50a45e)[_0xdda6('0x19')](_0x5d11ed);}};}function respondWithFilteredResult(_0x228a24,_0x20d3a7){return function(_0x4e654e){if(_0x4e654e){var _0x139f4d=typeof _0x20d3a7[_0xdda6('0x1a')]==='undefined'&&typeof _0x20d3a7[_0xdda6('0x1b')]==='undefined';var _0x4f1b99=_0x4e654e[_0xdda6('0x1c')];var _0x1fcd3a=_0x139f4d?0x0:_0x20d3a7['offset'];var _0xd955=_0x139f4d?_0x4e654e[_0xdda6('0x1c')]:_0x20d3a7[_0xdda6('0x1a')]+_0x20d3a7[_0xdda6('0x1b')];var _0x385c82;if(_0xd955>=_0x4f1b99){_0xd955=_0x4f1b99;_0x385c82=0xc8;}else{_0x385c82=0xce;}_0x228a24[_0xdda6('0x17')](_0x385c82);return _0x228a24['set'](_0xdda6('0x1d'),_0x1fcd3a+'-'+_0xd955+'/'+_0x4f1b99)[_0xdda6('0x19')](_0x4e654e);}return null;};}function patchUpdates(_0x1f5239){return function(_0x208b0f){try{jsonpatch[_0xdda6('0x1e')](_0x208b0f,_0x1f5239,!![]);}catch(_0x5d9c84){return BPromise[_0xdda6('0x1f')](_0x5d9c84);}return _0x208b0f[_0xdda6('0x20')]();};}function saveUpdates(_0x3275a5,_0x5957b3){return function(_0x2bfaf4){if(_0x2bfaf4){return _0x2bfaf4[_0xdda6('0x21')](_0x3275a5)[_0xdda6('0x22')](function(_0x147713){return _0x147713;});}return null;};}function removeEntity(_0x98139,_0x3cd2ed){return function(_0x1a108c){if(_0x1a108c){return _0x1a108c[_0xdda6('0x23')]()[_0xdda6('0x22')](function(){_0x98139[_0xdda6('0x17')](0xcc)[_0xdda6('0x18')]();});}};}function handleEntityNotFound(_0x4ba5d1,_0x486a57){return function(_0x1e40fc){if(!_0x1e40fc){_0x4ba5d1['sendStatus'](0x194);}return _0x1e40fc;};}function handleError(_0x490334,_0x500e55){_0x500e55=_0x500e55||0x1f4;return function(_0x41ff31){logger['error'](_0x41ff31['stack']);if(_0x41ff31[_0xdda6('0x24')]){delete _0x41ff31[_0xdda6('0x24')];}_0x490334[_0xdda6('0x17')](_0x500e55)['send'](_0x41ff31);};}exports[_0xdda6('0x21')]=function(_0x143a0a,_0x4e54d2){if(_0x143a0a[_0xdda6('0x25')]['id']){delete _0x143a0a[_0xdda6('0x25')]['id'];}return db[_0xdda6('0x26')]['find']({'where':{'id':_0x143a0a['params']['id']}})[_0xdda6('0x22')](handleEntityNotFound(_0x4e54d2,null))['then'](saveUpdates(_0x143a0a[_0xdda6('0x25')],null))['then'](respondWithResult(_0x4e54d2,null))[_0xdda6('0x27')](handleError(_0x4e54d2,null));};exports[_0xdda6('0x23')]=function(_0x17db3e,_0x1cc766){return db[_0xdda6('0x26')][_0xdda6('0x28')]({'where':{'id':_0x17db3e[_0xdda6('0x29')]['id']}})[_0xdda6('0x22')](handleEntityNotFound(_0x1cc766,null))[_0xdda6('0x22')](removeEntity(_0x1cc766,null))[_0xdda6('0x27')](handleError(_0x1cc766,null));}; \ No newline at end of file +var _0xdd23=['limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0xdd23,0x1a3));var _0x3dd2=function(_0x86cd26,_0x18d0d3){_0x86cd26=_0x86cd26-0x0;var _0x4a3bc2=_0xdd23[_0x86cd26];return _0x4a3bc2;};'use strict';var emlformat=require(_0x3dd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dd2('0x1'));var jsonpatch=require(_0x3dd2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3dd2('0x3'));var Mustache=require(_0x3dd2('0x4'));var util=require('util');var path=require(_0x3dd2('0x5'));var sox=require(_0x3dd2('0x6'));var csv=require(_0x3dd2('0x7'));var ejs=require(_0x3dd2('0x8'));var fs=require('fs');var fs_extra=require(_0x3dd2('0x9'));var _=require(_0x3dd2('0xa'));var squel=require(_0x3dd2('0xb'));var crypto=require(_0x3dd2('0xc'));var jsforce=require(_0x3dd2('0xd'));var deskjs=require(_0x3dd2('0xe'));var toCsv=require(_0x3dd2('0x7'));var querystring=require('querystring');var Papa=require(_0x3dd2('0xf'));var Redis=require(_0x3dd2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dd2('0x11'));var as=require(_0x3dd2('0x12'));var hardwareService=require(_0x3dd2('0x13'));var logger=require(_0x3dd2('0x14'))(_0x3dd2('0x15'));var utils=require(_0x3dd2('0x16'));var config=require(_0x3dd2('0x17'));var licenseUtil=require(_0x3dd2('0x18'));var db=require(_0x3dd2('0x19'))['db'];function respondWithStatusCode(_0x1108e7,_0x427d0a){_0x427d0a=_0x427d0a||0xcc;return function(_0x56771c){if(_0x56771c){return _0x1108e7[_0x3dd2('0x1a')](_0x427d0a);}return _0x1108e7['status'](_0x427d0a)[_0x3dd2('0x1b')]();};}function respondWithResult(_0x44003f,_0x122768){_0x122768=_0x122768||0xc8;return function(_0x2b17a9){if(_0x2b17a9){return _0x44003f[_0x3dd2('0x1c')](_0x122768)[_0x3dd2('0x1d')](_0x2b17a9);}};}function respondWithFilteredResult(_0x18cbc7,_0x46ce9e){return function(_0x5f494f){if(_0x5f494f){var _0x55df26=typeof _0x46ce9e[_0x3dd2('0x1e')]==='undefined'&&typeof _0x46ce9e[_0x3dd2('0x1f')]===_0x3dd2('0x20');var _0x2fac76=_0x5f494f[_0x3dd2('0x21')];var _0x3bd38c=_0x55df26?0x0:_0x46ce9e[_0x3dd2('0x1e')];var _0x3bb4f1=_0x55df26?_0x5f494f[_0x3dd2('0x21')]:_0x46ce9e[_0x3dd2('0x1e')]+_0x46ce9e[_0x3dd2('0x1f')];var _0x16cf9c;if(_0x3bb4f1>=_0x2fac76){_0x3bb4f1=_0x2fac76;_0x16cf9c=0xc8;}else{_0x16cf9c=0xce;}_0x18cbc7[_0x3dd2('0x1c')](_0x16cf9c);return _0x18cbc7[_0x3dd2('0x22')](_0x3dd2('0x23'),_0x3bd38c+'-'+_0x3bb4f1+'/'+_0x2fac76)['json'](_0x5f494f);}return null;};}function patchUpdates(_0x669958){return function(_0x46ba93){try{jsonpatch[_0x3dd2('0x24')](_0x46ba93,_0x669958,!![]);}catch(_0x4534b3){return BPromise[_0x3dd2('0x25')](_0x4534b3);}return _0x46ba93[_0x3dd2('0x26')]();};}function saveUpdates(_0x3a18a7,_0x3154e2){return function(_0x9048f8){if(_0x9048f8){return _0x9048f8[_0x3dd2('0x27')](_0x3a18a7)[_0x3dd2('0x28')](function(_0x47ac41){return _0x47ac41;});}return null;};}function removeEntity(_0x8af6c,_0x289ffe){return function(_0x3d160a){if(_0x3d160a){return _0x3d160a[_0x3dd2('0x29')]()[_0x3dd2('0x28')](function(){_0x8af6c[_0x3dd2('0x1c')](0xcc)[_0x3dd2('0x1b')]();});}};}function handleEntityNotFound(_0x20abf5,_0x4aad56){return function(_0x20137b){if(!_0x20137b){_0x20abf5['sendStatus'](0x194);}return _0x20137b;};}function handleError(_0x4e6893,_0x65f85f){_0x65f85f=_0x65f85f||0x1f4;return function(_0x220e57){logger[_0x3dd2('0x2a')](_0x220e57['stack']);if(_0x220e57[_0x3dd2('0x2b')]){delete _0x220e57[_0x3dd2('0x2b')];}_0x4e6893[_0x3dd2('0x1c')](_0x65f85f)[_0x3dd2('0x2c')](_0x220e57);};}exports[_0x3dd2('0x27')]=function(_0x243171,_0x3738cf){if(_0x243171[_0x3dd2('0x2d')]['id']){delete _0x243171['body']['id'];}return db[_0x3dd2('0x2e')]['find']({'where':{'id':_0x243171[_0x3dd2('0x2f')]['id']}})[_0x3dd2('0x28')](handleEntityNotFound(_0x3738cf,null))[_0x3dd2('0x28')](saveUpdates(_0x243171[_0x3dd2('0x2d')],null))['then'](respondWithResult(_0x3738cf,null))[_0x3dd2('0x30')](handleError(_0x3738cf,null));};exports[_0x3dd2('0x29')]=function(_0x4d49b7,_0x1f95c5){return db[_0x3dd2('0x2e')][_0x3dd2('0x31')]({'where':{'id':_0x4d49b7[_0x3dd2('0x2f')]['id']}})[_0x3dd2('0x28')](handleEntityNotFound(_0x1f95c5,null))['then'](removeEntity(_0x1f95c5,null))[_0x3dd2('0x30')](handleError(_0x1f95c5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5e99ef2..0ba1011 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 _0xa9e2=['../../config/logger','request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','util'];(function(_0x5dbf67,_0x3d51f2){var _0x18b74d=function(_0x5052dc){while(--_0x5052dc){_0x5dbf67['push'](_0x5dbf67['shift']());}};_0x18b74d(++_0x3d51f2);}(_0xa9e2,0x1e5));var _0x2a9e=function(_0x5b747f,_0x6cdd35){_0x5b747f=_0x5b747f-0x0;var _0x1c42f4=_0xa9e2[_0x5b747f];return _0x1c42f4;};'use strict';var _=require('lodash');var util=require(_0x2a9e('0x0'));var logger=require(_0x2a9e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a9e('0x3'));var config=require(_0x2a9e('0x4'));var attributes=require(_0x2a9e('0x5'));module[_0x2a9e('0x6')]=function(_0x1129e8,_0x260776){return _0x1129e8['define'](_0x2a9e('0x7'),attributes,{'tableName':_0x2a9e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf725=['define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x32b92b,_0xbb85f1){var _0x38ef8e=function(_0xc12e91){while(--_0xc12e91){_0x32b92b['push'](_0x32b92b['shift']());}};_0x38ef8e(++_0xbb85f1);}(_0xf725,0xd0));var _0x5f72=function(_0x13ffec,_0x4a3add){_0x13ffec=_0x13ffec-0x0;var _0x43a76d=_0xf725[_0x13ffec];return _0x43a76d;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var logger=require(_0x5f72('0x2'))(_0x5f72('0x3'));var moment=require('moment');var BPromise=require(_0x5f72('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f72('0x5'));var rimraf=require(_0x5f72('0x6'));var config=require(_0x5f72('0x7'));var attributes=require('./action.attributes');module['exports']=function(_0x44c2af,_0x4505a0){return _0x44c2af[_0x5f72('0x8')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3d32867..9361879 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1b197e,_0x5e7c1b){var _0x21960b=function(_0x4de1d1){while(--_0x4de1d1){_0x1b197e['push'](_0x1b197e['shift']());}};_0x21960b(++_0x5e7c1b);}(_0xabce,0x103));var _0xeabc=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xabce[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x8b96c,_0x544b92){var _0x5153ae=function(_0x3af82e){while(--_0x3af82e){_0x8b96c['push'](_0x8b96c['shift']());}};_0x5153ae(++_0x544b92);}(_0xe14b,0x93));var _0xbe14=function(_0x1b69a4,_0x3e9f5f){_0x1b69a4=_0x1b69a4-0x0;var _0x4ab6a6=_0xe14b[_0x1b69a4];return _0x4ab6a6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8eb2d13..d680943 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 _0x8877=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','/:id','destroy','exports'];(function(_0x57c16e,_0x5d275e){var _0x3b3a65=function(_0x2792cd){while(--_0x2792cd){_0x57c16e['push'](_0x57c16e['shift']());}};_0x3b3a65(++_0x5d275e);}(_0x8877,0x1b0));var _0x7887=function(_0x175bc6,_0xd90ea1){_0x175bc6=_0x175bc6-0x0;var _0x47cfc8=_0x8877[_0x175bc6];return _0x47cfc8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7887('0x0'));var router=express[_0x7887('0x1')]();var fs_extra=require(_0x7887('0x2'));var auth=require(_0x7887('0x3'));var interaction=require(_0x7887('0x4'));var config=require(_0x7887('0x5'));var controller=require(_0x7887('0x6'));router[_0x7887('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7887('0x8')]);router['delete'](_0x7887('0x9'),auth['isAuthenticated'](),controller[_0x7887('0xa')]);module[_0x7887('0xb')]=router; \ No newline at end of file +var _0x9f90=['Router','fs-extra','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','path','connect-timeout','express'];(function(_0x5cebe6,_0x301bea){var _0x1bd6b1=function(_0x5749c0){while(--_0x5749c0){_0x5cebe6['push'](_0x5cebe6['shift']());}};_0x1bd6b1(++_0x301bea);}(_0x9f90,0x169));var _0x09f9=function(_0x353c61,_0x199b59){_0x353c61=_0x353c61-0x0;var _0x11e4df=_0x9f90[_0x353c61];return _0x11e4df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x09f9('0x0'));var timeout=require(_0x09f9('0x1'));var express=require(_0x09f9('0x2'));var router=express[_0x09f9('0x3')]();var fs_extra=require(_0x09f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09f9('0x5'));var controller=require(_0x09f9('0x6'));router[_0x09f9('0x7')]('/:id',auth[_0x09f9('0x8')](),controller[_0x09f9('0x9')]);router[_0x09f9('0xa')](_0x09f9('0xb'),auth[_0x09f9('0x8')](),controller[_0x09f9('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ea2903c..44df399 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x26bc42,_0xe6bb38){var _0xeef8e7=function(_0x3b545a){while(--_0x3b545a){_0x26bc42['push'](_0x26bc42['shift']());}};_0xeef8e7(++_0xe6bb38);}(_0x7c09,0x102));var _0x97c0=function(_0x5af84e,_0x1e4149){_0x5af84e=_0x5af84e-0x0;var _0x3a4389=_0x7c09[_0x5af84e];return _0x3a4389;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x3ca879,_0x2e88ee){var _0x1f0bae=function(_0x114b52){while(--_0x114b52){_0x3ca879['push'](_0x3ca879['shift']());}};_0x1f0bae(++_0x2e88ee);}(_0x6aa7,0x178));var _0x76aa=function(_0x369635,_0x589b89){_0x369635=_0x369635-0x0;var _0x46dbfe=_0x6aa7[_0x369635];return _0x46dbfe;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b66e74b..afec4c3 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 _0xd89e=['QueryTypes','join','right_join','SUM(%s)','COUNT(%s)','IS\x20NOT\x20NULL','operator','Sequelize','from','DESC','web','fullPath','output','csv','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','toString','../../files/reports','savename','countTable','SELECT','run','runReport','Limited\x20Query:','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','include','AnalyticCustomReport','findAll','rows','show','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','sequelize'];(function(_0x1f2b1f,_0x55f153){var _0x1779e3=function(_0x5967be){while(--_0x5967be){_0x1f2b1f['push'](_0x1f2b1f['shift']());}};_0x1779e3(++_0x55f153);}(_0xd89e,0x16b));var _0xed89=function(_0x5bdd6d,_0x10b58e){_0x5bdd6d=_0x5bdd6d-0x0;var _0x293bcc=_0xd89e[_0x5bdd6d];return _0x293bcc;};'use strict';var emlformat=require(_0xed89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed89('0x1'));var rp=require(_0xed89('0x2'));var moment=require(_0xed89('0x3'));var BPromise=require(_0xed89('0x4'));var Mustache=require(_0xed89('0x5'));var util=require(_0xed89('0x6'));var path=require(_0xed89('0x7'));var sox=require(_0xed89('0x8'));var csv=require(_0xed89('0x9'));var ejs=require(_0xed89('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed89('0xb'));var squel=require(_0xed89('0xc'));var crypto=require(_0xed89('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed89('0xe'));var Papa=require(_0xed89('0xf'));var Redis=require(_0xed89('0x10'));var authService=require(_0xed89('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed89('0x12'));var hardwareService=require(_0xed89('0x13'));var logger=require(_0xed89('0x14'))(_0xed89('0x15'));var utils=require(_0xed89('0x16'));var config=require(_0xed89('0x17'));var licenseUtil=require(_0xed89('0x18'));var db=require(_0xed89('0x19'))['db'];var dbH=require(_0xed89('0x19'))[_0xed89('0x1a')];function respondWithStatusCode(_0x13d369,_0x46b197){_0x46b197=_0x46b197||0xcc;return function(_0xb10a14){if(_0xb10a14){return _0x13d369[_0xed89('0x1b')](_0x46b197);}return _0x13d369[_0xed89('0x1c')](_0x46b197)['end']();};}function respondWithResult(_0x182dbd,_0x229d6a){_0x229d6a=_0x229d6a||0xc8;return function(_0x5401cb){if(_0x5401cb){return _0x182dbd['status'](_0x229d6a)['json'](_0x5401cb);}};}function respondWithFilteredResult(_0x2545ca,_0x329e6a){return function(_0x35d724){if(_0x35d724){var _0x288531=typeof _0x329e6a['offset']===_0xed89('0x1d')&&typeof _0x329e6a[_0xed89('0x1e')]===_0xed89('0x1d');var _0xb5b127=_0x35d724['count'];var _0x6d9ce2=_0x288531?0x0:_0x329e6a['offset'];var _0x1d89a2=_0x288531?_0x35d724[_0xed89('0x1f')]:_0x329e6a['offset']+_0x329e6a[_0xed89('0x1e')];var _0x5ec113;if(_0x1d89a2>=_0xb5b127){_0x1d89a2=_0xb5b127;_0x5ec113=0xc8;}else{_0x5ec113=0xce;}_0x2545ca[_0xed89('0x1c')](_0x5ec113);return _0x2545ca['set'](_0xed89('0x20'),_0x6d9ce2+'-'+_0x1d89a2+'/'+_0xb5b127)[_0xed89('0x21')](_0x35d724);}return null;};}function patchUpdates(_0x2baf03){return function(_0x51960a){try{jsonpatch['apply'](_0x51960a,_0x2baf03,!![]);}catch(_0x234b2b){return BPromise[_0xed89('0x22')](_0x234b2b);}return _0x51960a[_0xed89('0x23')]();};}function saveUpdates(_0x436235,_0x4ddf30){return function(_0x3de755){if(_0x3de755){return _0x3de755[_0xed89('0x24')](_0x436235)[_0xed89('0x25')](function(_0x8b8c78){return _0x8b8c78;});}return null;};}function removeEntity(_0x490d54,_0x1db0b6){return function(_0x5a810a){if(_0x5a810a){return _0x5a810a[_0xed89('0x26')]()['then'](function(){var _0x228d8f=_0x5a810a[_0xed89('0x27')]({'plain':!![]});var _0x8209c8=_0xed89('0x28');return db[_0xed89('0x29')][_0xed89('0x26')]({'where':{'type':_0x8209c8,'resourceId':_0x228d8f['id']}})[_0xed89('0x25')](function(){return _0x5a810a;});})[_0xed89('0x25')](function(){_0x490d54[_0xed89('0x1c')](0xcc)[_0xed89('0x2a')]();});}};}function handleEntityNotFound(_0xab9e8c,_0x2fea04){return function(_0x3dfff9){if(!_0x3dfff9){_0xab9e8c['sendStatus'](0x194);}return _0x3dfff9;};}function handleError(_0x31f087,_0x1c17f5){_0x1c17f5=_0x1c17f5||0x1f4;return function(_0x282854){logger[_0xed89('0x2b')](_0x282854[_0xed89('0x2c')]);if(_0x282854[_0xed89('0x2d')]){delete _0x282854[_0xed89('0x2d')];}_0x31f087[_0xed89('0x1c')](_0x1c17f5)[_0xed89('0x2e')](_0x282854);};}exports[_0xed89('0x2f')]=function(_0x4b1612,_0x4943d7){var _0x27ba66={},_0x3fded5={},_0x4e8145={'count':0x0,'rows':[]};var _0x5c3afc=_[_0xed89('0x30')](db['AnalyticCustomReport'][_0xed89('0x31')],function(_0x2ad17e){return{'name':_0x2ad17e[_0xed89('0x32')],'type':_0x2ad17e[_0xed89('0x33')]['key']};});_0x3fded5[_0xed89('0x34')]=_[_0xed89('0x30')](_0x5c3afc,_0xed89('0x2d'));_0x3fded5[_0xed89('0x35')]=_[_0xed89('0x36')](_0x4b1612[_0xed89('0x35')]);_0x3fded5[_0xed89('0x37')]=_[_0xed89('0x38')](_0x3fded5['model'],_0x3fded5[_0xed89('0x35')]);_0x27ba66['attributes']=_[_0xed89('0x38')](_0x3fded5[_0xed89('0x34')],qs[_0xed89('0x39')](_0x4b1612[_0xed89('0x35')]['fields']));_0x27ba66[_0xed89('0x3a')]=_0x27ba66[_0xed89('0x3a')]['length']?_0x27ba66[_0xed89('0x3a')]:_0x3fded5[_0xed89('0x34')];if(!_0x4b1612[_0xed89('0x35')][_0xed89('0x3b')](_0xed89('0x3c'))){_0x27ba66[_0xed89('0x1e')]=qs[_0xed89('0x1e')](_0x4b1612[_0xed89('0x35')][_0xed89('0x1e')]);_0x27ba66[_0xed89('0x3d')]=qs['offset'](_0x4b1612['query'][_0xed89('0x3d')]);}_0x27ba66[_0xed89('0x3e')]=qs['sort'](_0x4b1612[_0xed89('0x35')][_0xed89('0x3f')]);_0x27ba66[_0xed89('0x40')]=qs[_0xed89('0x37')](_[_0xed89('0x41')](_0x4b1612[_0xed89('0x35')],_0x3fded5['filters']),_0x5c3afc);if(_0x4b1612[_0xed89('0x35')]['filter']){_0x27ba66[_0xed89('0x40')]=_['merge'](_0x27ba66[_0xed89('0x40')],{'$or':_[_0xed89('0x30')](_0x5c3afc,function(_0x483a8f){if(_0x483a8f[_0xed89('0x33')]!==_0xed89('0x42')){var _0x1c43f4={};_0x1c43f4[_0x483a8f[_0xed89('0x2d')]]={'$like':'%'+_0x4b1612[_0xed89('0x35')][_0xed89('0x43')]+'%'};return _0x1c43f4;}})});}_0x27ba66=_[_0xed89('0x44')]({},_0x27ba66,_0x4b1612['options']);var _0x1a2174={'where':_0x27ba66[_0xed89('0x40')]};return db['AnalyticCustomReport'][_0xed89('0x1f')](_0x1a2174)[_0xed89('0x25')](function(_0x4456ab){_0x4e8145['count']=_0x4456ab;if(_0x4b1612[_0xed89('0x35')]['includeAll']){_0x27ba66[_0xed89('0x45')]=[{'all':!![]}];}return db[_0xed89('0x46')][_0xed89('0x47')](_0x27ba66);})[_0xed89('0x25')](function(_0xbd449c){_0x4e8145[_0xed89('0x48')]=_0xbd449c;return _0x4e8145;})[_0xed89('0x25')](respondWithFilteredResult(_0x4943d7,_0x27ba66))['catch'](handleError(_0x4943d7,null));};exports[_0xed89('0x49')]=function(_0x270f56,_0x205ed9){var _0x3113e8={'raw':![],'where':{'id':_0x270f56['params']['id']}},_0x464bef={};_0x464bef['model']=_[_0xed89('0x36')](db['AnalyticCustomReport']['rawAttributes']);_0x464bef[_0xed89('0x35')]=_[_0xed89('0x36')](_0x270f56[_0xed89('0x35')]);_0x464bef['filters']=_['intersection'](_0x464bef[_0xed89('0x34')],_0x464bef[_0xed89('0x35')]);_0x3113e8['attributes']=_[_0xed89('0x38')](_0x464bef[_0xed89('0x34')],qs[_0xed89('0x39')](_0x270f56['query'][_0xed89('0x39')]));_0x3113e8[_0xed89('0x3a')]=_0x3113e8[_0xed89('0x3a')][_0xed89('0x4a')]?_0x3113e8[_0xed89('0x3a')]:_0x464bef[_0xed89('0x34')];if(_0x270f56[_0xed89('0x35')][_0xed89('0x4b')]){_0x3113e8[_0xed89('0x45')]=[{'all':!![]}];}_0x3113e8=_['merge']({},_0x3113e8,_0x270f56['options']);return db['AnalyticCustomReport'][_0xed89('0x4c')](_0x3113e8)['then'](handleEntityNotFound(_0x205ed9,null))['then'](respondWithResult(_0x205ed9,null))[_0xed89('0x4d')](handleError(_0x205ed9,null));};exports[_0xed89('0x4e')]=function(_0x5e8c49,_0x2b510f){return db[_0xed89('0x46')][_0xed89('0x4e')](_0x5e8c49[_0xed89('0x4f')],{})['then'](function(_0x448689){var _0xb62c0=_0x5e8c49['user'][_0xed89('0x27')]({'plain':!![]});if(!_0xb62c0)throw new Error(_0xed89('0x50'));if(_0xb62c0['role']===_0xed89('0x51')){var _0xbca6fc=_0x448689[_0xed89('0x27')]({'plain':!![]});var _0x5a1562='Reports';return db[_0xed89('0x52')][_0xed89('0x4c')]({'where':{'name':_0x5a1562,'userProfileId':_0xb62c0[_0xed89('0x53')]},'raw':!![]})['then'](function(_0x3029c1){if(_0x3029c1&&_0x3029c1['autoAssociation']===0x0){return db[_0xed89('0x29')][_0xed89('0x4e')]({'name':_0xbca6fc[_0xed89('0x2d')],'resourceId':_0xbca6fc['id'],'type':'CustomReports','sectionId':_0x3029c1['id']},{})[_0xed89('0x25')](function(){return _0x448689;});}else{return _0x448689;}})['catch'](function(_0x4f638d){logger[_0xed89('0x2b')](_0xed89('0x54'),_0x4f638d);throw _0x4f638d;});}return _0x448689;})[_0xed89('0x25')](respondWithResult(_0x2b510f,0xc9))[_0xed89('0x4d')](handleError(_0x2b510f,null));};exports[_0xed89('0x24')]=function(_0x49a952,_0xc87397){if(_0x49a952[_0xed89('0x4f')]['id']){delete _0x49a952[_0xed89('0x4f')]['id'];}return db[_0xed89('0x46')][_0xed89('0x4c')]({'where':{'id':_0x49a952[_0xed89('0x55')]['id']}})['then'](handleEntityNotFound(_0xc87397,null))['then'](saveUpdates(_0x49a952[_0xed89('0x4f')],null))[_0xed89('0x25')](respondWithResult(_0xc87397,null))['catch'](handleError(_0xc87397,null));};exports['destroy']=function(_0x50e204,_0x224dae){return db[_0xed89('0x46')][_0xed89('0x4c')]({'where':{'id':_0x50e204[_0xed89('0x55')]['id']}})[_0xed89('0x25')](handleEntityNotFound(_0x224dae,null))[_0xed89('0x25')](removeEntity(_0x224dae,null))[_0xed89('0x4d')](handleError(_0x224dae,null));};exports[_0xed89('0x56')]=function(_0x200d3a,_0x5d90b8){var _0x291804=0xa;var _0x2dd728=['join',_0xed89('0x57'),'right_join',_0xed89('0x58')];var _0x2b15cc={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xed89('0x59'),'MAX':_0xed89('0x5a'),'MIN':_0xed89('0x5b'),'AVG':_0xed89('0x5c'),'GROUP_CONCAT':_0xed89('0x5d'),'GROUP_CONCAT ASC':_0xed89('0x5e'),'GROUP_CONCAT DESC':_0xed89('0x5f')};var _0x309a91={'SEC_TO_TIME':_0xed89('0x60'),'DATE':_0xed89('0x61'),'HOUR':_0xed89('0x62'),'ROUND':_0xed89('0x63'),'UNIX_TIMESTAMP':_0xed89('0x64')};var _0x132727=function(_0x3f0e5f){return!_[_0xed89('0x65')]([_0xed89('0x66'),'IS\x20NOT\x20NULL',_0xed89('0x67'),_0xed89('0x68')],_0x3f0e5f);};var _0x41de04=function(_0x56c5ec){if(!_0x56c5ec||!_0x56c5ec[_0xed89('0x69')][_0xed89('0x4a')]){return'';}for(var _0x2cd0a3='(',_0x25ce08=0x0;_0x25ce08<_0x56c5ec[_0xed89('0x69')][_0xed89('0x4a')];_0x25ce08+=0x1){_0x25ce08>0x0&&(_0x2cd0a3+='\x20'+_0x56c5ec['operator']+'\x20');_0x2cd0a3+=_0x56c5ec['rules'][_0x25ce08][_0xed89('0x6a')]?_0x41de04(_0x56c5ec[_0xed89('0x69')][_0x25ce08]['group']):_0x56c5ec['rules'][_0x25ce08][_0xed89('0x6b')]+'\x20'+_0x56c5ec[_0xed89('0x69')][_0x25ce08][_0xed89('0x6c')]+(_0x132727(_0x56c5ec['rules'][_0x25ce08]['condition'])?'\x20'+_0x56c5ec[_0xed89('0x69')][_0x25ce08][_0xed89('0x6d')]:'');}return _0x2cd0a3+')';};var _0x38e463={'where':{'id':_0x200d3a['params']['id']}},_0x2833f3,_0x50016e,_0x4589e8,_0x38b431,_0x1d1f8f;_0x38e463=_[_0xed89('0x44')]({},_0x38e463,_0x200d3a[_0xed89('0x6e')]);return db[_0xed89('0x46')][_0xed89('0x4c')](_0x38e463)['then'](function(_0x37d68c){if(_0x37d68c){_0x2833f3=_0x37d68c;return _0x37d68c[_0xed89('0x6f')]();}return null;})['then'](function(_0x2e9a03){if(_0x2e9a03){if(!_0x2e9a03[_0xed89('0x4a')]){throw new db['Sequelize'][(_0xed89('0x70'))](_0xed89('0x71'),0x193);}_0x50016e=_0x2e9a03;return db[_0xed89('0x72')][_0xed89('0x47')]({'raw':!![]});}return null;})[_0xed89('0x25')](function(_0x54b4e3){if(_0x54b4e3){_0x4589e8=_[_0xed89('0x73')](_0x54b4e3,'id');var _0x5ed3ae;var _0x776e23=squel[_0xed89('0x74')]();_0x776e23['from'](_0x2833f3[_0xed89('0x75')]);for(var _0x195df=0x0;_0x195df<_0x50016e['length'];_0x195df+=0x1){_0x5ed3ae=_0x50016e[_0x195df][_0xed89('0x76')]?_0x4589e8[_0x50016e[_0x195df][_0xed89('0x76')]][_0xed89('0x77')]:_0x50016e[_0x195df][_0xed89('0x6b')];_0x5ed3ae=_0x50016e[_0x195df][_0xed89('0x78')]?_[_0xed89('0x79')](_0x2b15cc[_0x50016e[_0x195df][_0xed89('0x78')]],'%s',_0x5ed3ae):_0x5ed3ae;_0x5ed3ae=_0x50016e[_0x195df][_0xed89('0x7a')]?_[_0xed89('0x79')](_0x309a91[_0x50016e[_0x195df][_0xed89('0x7a')]],'%s',_0x5ed3ae):_0x5ed3ae;if(_0x50016e[_0x195df]['groupBy']){_0x776e23[_0xed89('0x6a')](_0x5ed3ae);}_0x50016e[_0x195df][_0xed89('0x7b')]&&_0x776e23[_0xed89('0x3e')](_0x5ed3ae,_0x50016e[_0x195df][_0xed89('0x7b')]==='DESC'?![]:!![]);_0x776e23[_0xed89('0x6b')](_0x5ed3ae,_0x50016e[_0x195df][_0xed89('0x7c')]||_0x5ed3ae);}if(_0x2833f3[_0xed89('0x7d')]){_0x2833f3[_0xed89('0x7d')]=JSON['parse'](_0x2833f3['joins']);for(var _0x4ef6bd=0x0;_0x4ef6bd<_0x2833f3[_0xed89('0x7d')][_0xed89('0x4a')];_0x4ef6bd+=0x1){if(_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x33')]&&_[_0xed89('0x65')](_0x2dd728,_0x2833f3['joins'][_0x4ef6bd][_0xed89('0x33')])&&_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x7e')]&&_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x7f')]&&_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x80')]){_0x776e23[_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x33')]](_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x7f')],null,util[_0xed89('0x7a')](_0xed89('0x81'),_0x2833f3['table'],_0x2833f3[_0xed89('0x7d')][_0x4ef6bd][_0xed89('0x7e')],_0x2833f3['joins'][_0x4ef6bd][_0xed89('0x7f')],_0x2833f3[_0xed89('0x7d')][_0x4ef6bd]['foreignKey']));}}}if(_0x2833f3['conditions']){_0x2833f3[_0xed89('0x82')]=JSON[_0xed89('0x83')](_0x2833f3[_0xed89('0x82')]);_0x776e23[_0xed89('0x40')](_0x41de04(_0x2833f3['conditions'][_0xed89('0x6a')]));}_0x1d1f8f=_0x776e23[_0xed89('0x84')]();_0x776e23[_0xed89('0x1e')](_0x291804);_0x776e23['offset'](0x0);logger[_0xed89('0x85')]('Limited\x20Query:',_0x776e23['toString']());return dbH[_0xed89('0x86')][_0xed89('0x35')](_0x776e23['toString'](),{'type':dbH[_0xed89('0x86')][_0xed89('0x87')]['SELECT']});}})[_0xed89('0x25')](respondWithResult(_0x5d90b8,null))[_0xed89('0x4d')](handleError(_0x5d90b8,null));};function runReport(_0x475bd3,_0x45cc83,_0x28b048){var _0x1662c1=_0x45cc83[_0xed89('0x2d')];var _0x32361a=0xa;var _0x3d387d=[_0xed89('0x88'),_0xed89('0x57'),_0xed89('0x89'),_0xed89('0x58')];var _0xfdc145={'SUM':_0xed89('0x8a'),'COUNT':_0xed89('0x8b'),'COUNT DISTINCT':_0xed89('0x59'),'MAX':_0xed89('0x5a'),'MIN':'MIN(%s)','AVG':_0xed89('0x5c'),'GROUP_CONCAT':_0xed89('0x5d'),'GROUP_CONCAT ASC':_0xed89('0x5e'),'GROUP_CONCAT DESC':_0xed89('0x5f')};var _0x37a694={'SEC_TO_TIME':_0xed89('0x60'),'DATE':_0xed89('0x61'),'HOUR':_0xed89('0x62'),'ROUND':_0xed89('0x63'),'UNIX_TIMESTAMP':_0xed89('0x64')};var _0x1b067e=function(_0x3b3dea){return!_[_0xed89('0x65')]([_0xed89('0x66'),_0xed89('0x8c'),'IS\x20EMPTY',_0xed89('0x68')],_0x3b3dea);};var _0x142c72=function(_0x2001a5){if(!_0x2001a5||!_0x2001a5['rules'][_0xed89('0x4a')]){return'';}for(var _0xb4d706='(',_0x29b250=0x0;_0x29b250<_0x2001a5[_0xed89('0x69')]['length'];_0x29b250+=0x1){_0x29b250>0x0&&(_0xb4d706+='\x20'+_0x2001a5[_0xed89('0x8d')]+'\x20');_0xb4d706+=_0x2001a5[_0xed89('0x69')][_0x29b250][_0xed89('0x6a')]?_0x142c72(_0x2001a5[_0xed89('0x69')][_0x29b250]['group']):_0x2001a5[_0xed89('0x69')][_0x29b250][_0xed89('0x6b')]+'\x20'+_0x2001a5[_0xed89('0x69')][_0x29b250][_0xed89('0x6c')]+(_0x1b067e(_0x2001a5[_0xed89('0x69')][_0x29b250][_0xed89('0x6c')])?'\x20'+_0x2001a5[_0xed89('0x69')][_0x29b250][_0xed89('0x6d')]:'');}return _0xb4d706+')';};var _0x57a6bd={'where':{'id':_0x475bd3['id']}},_0x2bc5ff,_0x14b16d,_0x1d3357,_0x2ab35d,_0x57c417;_0x57a6bd=_['merge']({},_0x57a6bd,_0x28b048);return db[_0xed89('0x46')]['find'](_0x57a6bd)[_0xed89('0x25')](function(_0x5b6b60){if(_0x5b6b60){_0x2bc5ff=_0x5b6b60;return _0x5b6b60['getFields']();}return null;})[_0xed89('0x25')](function(_0x5c7ab4){if(_0x5c7ab4){if(!_0x5c7ab4[_0xed89('0x4a')]){throw new db[(_0xed89('0x8e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x14b16d=_0x5c7ab4;return db[_0xed89('0x72')][_0xed89('0x47')]({'raw':!![]});}return null;})[_0xed89('0x25')](function(_0x16a956){if(_0x16a956){_0x1d3357=_[_0xed89('0x73')](_0x16a956,'id');var _0x148c49;var _0x5b6b0a=squel['select']();_0x5b6b0a[_0xed89('0x8f')](_0x2bc5ff[_0xed89('0x75')]);for(var _0x8ae587=0x0;_0x8ae587<_0x14b16d['length'];_0x8ae587+=0x1){_0x148c49=_0x14b16d[_0x8ae587][_0xed89('0x76')]?_0x1d3357[_0x14b16d[_0x8ae587][_0xed89('0x76')]][_0xed89('0x77')]:_0x14b16d[_0x8ae587][_0xed89('0x6b')];_0x148c49=_0x14b16d[_0x8ae587]['function']?_[_0xed89('0x79')](_0xfdc145[_0x14b16d[_0x8ae587][_0xed89('0x78')]],'%s',_0x148c49):_0x148c49;_0x148c49=_0x14b16d[_0x8ae587][_0xed89('0x7a')]?_[_0xed89('0x79')](_0x37a694[_0x14b16d[_0x8ae587][_0xed89('0x7a')]],'%s',_0x148c49):_0x148c49;if(_0x14b16d[_0x8ae587]['groupBy']){_0x5b6b0a[_0xed89('0x6a')](_0x148c49);}_0x14b16d[_0x8ae587][_0xed89('0x7b')]&&_0x5b6b0a[_0xed89('0x3e')](_0x148c49,_0x14b16d[_0x8ae587][_0xed89('0x7b')]===_0xed89('0x90')?![]:!![]);_0x5b6b0a[_0xed89('0x6b')](_0x148c49,_0x14b16d[_0x8ae587]['alias']||_0x148c49);}if(_0x2bc5ff[_0xed89('0x7d')]){_0x2bc5ff[_0xed89('0x7d')]=JSON['parse'](_0x2bc5ff['joins']);for(var _0x4ba22b=0x0;_0x4ba22b<_0x2bc5ff[_0xed89('0x7d')][_0xed89('0x4a')];_0x4ba22b+=0x1){if(_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b][_0xed89('0x33')]&&_[_0xed89('0x65')](_0x3d387d,_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b][_0xed89('0x33')])&&_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b]['parentKey']&&_0x2bc5ff['joins'][_0x4ba22b]['foreignTable']&&_0x2bc5ff['joins'][_0x4ba22b][_0xed89('0x80')]){_0x5b6b0a[_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b][_0xed89('0x33')]](_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b][_0xed89('0x7f')],null,util['format'](_0xed89('0x81'),_0x2bc5ff[_0xed89('0x75')],_0x2bc5ff['joins'][_0x4ba22b][_0xed89('0x7e')],_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b]['foreignTable'],_0x2bc5ff[_0xed89('0x7d')][_0x4ba22b][_0xed89('0x80')]));}}}if(_0x2bc5ff[_0xed89('0x82')]){_0x2bc5ff[_0xed89('0x82')]=JSON[_0xed89('0x83')](_0x2bc5ff['conditions']);_0x5b6b0a[_0xed89('0x40')](_0x142c72(_0x2bc5ff[_0xed89('0x82')][_0xed89('0x6a')]));}_0x57c417=_0x5b6b0a[_0xed89('0x84')]();_0x5b6b0a[_0xed89('0x1e')](_0x32361a);_0x5b6b0a[_0xed89('0x3d')](0x0);return;}})[_0xed89('0x25')](function(){if(_0x45cc83['output']===_0xed89('0x91')){return null;}var _0x5f3a35=_[_0xed89('0x44')](_0x45cc83,{'name':_0x45cc83[_0xed89('0x92')]||_0x45cc83[_0xed89('0x2d')]||_0x2bc5ff['name'],'basename':_0x1662c1,'savename':util[_0xed89('0x7a')]('%s-%s.%s',_0x45cc83['name']||_0x2bc5ff[_0xed89('0x2d')],require('randomstring')['generate'](0x4),_0x45cc83[_0xed89('0x93')]||_0xed89('0x94')),'reportId':_0x2bc5ff['id'],'reportType':'custom'});return db[_0xed89('0x95')]['create'](_0x5f3a35,{'raw':!![]});})[_0xed89('0x25')](function(_0x4e3da8){if(_0x2bc5ff[_0xed89('0x75')]===_0xed89('0x96')){_0x57c417[_0xed89('0x40')](_0x2bc5ff[_0xed89('0x75')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x45cc83['startDate'],_0x45cc83[_0xed89('0x97')]);}else{_0x57c417[_0xed89('0x40')](_0x2bc5ff[_0xed89('0x75')]+_0xed89('0x98'),_0x45cc83[_0xed89('0x99')],_0x45cc83['endDate']);}if(_0x4e3da8){logger[_0xed89('0x9a')]('Run\x20Query:',_0x57c417['toString']());require(_0xed89('0x9b'))[_0xed89('0x9c')](path[_0xed89('0x88')](__dirname,_0xed89('0x9d'),_0x4e3da8['output']),[_0x4e3da8['id'],_0x57c417[_0xed89('0x9e')](),path[_0xed89('0x88')](__dirname,_0xed89('0x9f'),_0x4e3da8[_0xed89('0xa0')]),_0x1662c1]);return _0x4e3da8;}else{var _0x1c1a62=squel['select']();_0x1c1a62['from']('('+_0x57c417[_0xed89('0x9e')]()+')',_0xed89('0xa1'));_0x1c1a62[_0xed89('0x6b')]('COUNT(*)','count');_0x57c417['limit'](_0x45cc83[_0xed89('0x1e')]||_0x32361a);_0x57c417[_0xed89('0x3d')](_0x45cc83[_0xed89('0x3d')]||0x0);return dbH[_0xed89('0x86')]['query'](_0x1c1a62[_0xed89('0x9e')](),{'type':dbH[_0xed89('0x86')][_0xed89('0x87')]['SELECT']})['then'](function(_0x3be272){if(!_0x3be272[_0xed89('0x4a')]){_0x2ab35d=0x0;}else{_0x2ab35d=_0x3be272[0x0][_0xed89('0x1f')]||0x0;}return dbH[_0xed89('0x86')][_0xed89('0x35')](_0x57c417[_0xed89('0x9e')](),{'type':dbH[_0xed89('0x86')][_0xed89('0x87')][_0xed89('0xa2')]});})[_0xed89('0x25')](function(_0x52c1fe){return{'rows':_0x52c1fe||[],'count':_0x2ab35d};});}});}exports[_0xed89('0xa3')]=function(_0x49c746,_0x2217a5){return runReport(_0x49c746[_0xed89('0x55')],_0x49c746['query'],_0x49c746[_0xed89('0x6e')])[_0xed89('0x25')](respondWithResult(_0x2217a5,null))['catch'](handleError(_0x2217a5,null));};exports[_0xed89('0xa4')]=runReport;exports[_0xed89('0x35')]=function(_0x6a53d8,_0x2a1661){var _0x352967=0xa;var _0x453663=[_0xed89('0x88'),_0xed89('0x57'),_0xed89('0x89'),_0xed89('0x58')];var _0x1cdf80={'SUM':'SUM(%s)','COUNT':_0xed89('0x8b'),'COUNT DISTINCT':_0xed89('0x59'),'MAX':_0xed89('0x5a'),'MIN':_0xed89('0x5b'),'AVG':_0xed89('0x5c'),'GROUP_CONCAT':_0xed89('0x5d'),'GROUP_CONCAT ASC':_0xed89('0x5e'),'GROUP_CONCAT DESC':_0xed89('0x5f')};var _0x165052={'SEC_TO_TIME':_0xed89('0x60'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xed89('0x63'),'UNIX_TIMESTAMP':_0xed89('0x64')};var _0xbc2c24=function(_0x127f12){return!_[_0xed89('0x65')]([_0xed89('0x66'),_0xed89('0x8c'),_0xed89('0x67'),_0xed89('0x68')],_0x127f12);};var _0x10e57b=function(_0x4bcec6){if(!_0x4bcec6||!_0x4bcec6[_0xed89('0x69')][_0xed89('0x4a')]){return'';}for(var _0x2aad1e='(',_0x262bbf=0x0;_0x262bbf<_0x4bcec6[_0xed89('0x69')][_0xed89('0x4a')];_0x262bbf+=0x1){_0x262bbf>0x0&&(_0x2aad1e+='\x20'+_0x4bcec6[_0xed89('0x8d')]+'\x20');_0x2aad1e+=_0x4bcec6[_0xed89('0x69')][_0x262bbf][_0xed89('0x6a')]?_0x10e57b(_0x4bcec6[_0xed89('0x69')][_0x262bbf][_0xed89('0x6a')]):_0x4bcec6[_0xed89('0x69')][_0x262bbf][_0xed89('0x6b')]+'\x20'+_0x4bcec6['rules'][_0x262bbf][_0xed89('0x6c')]+(_0xbc2c24(_0x4bcec6[_0xed89('0x69')][_0x262bbf][_0xed89('0x6c')])?'\x20'+_0x4bcec6[_0xed89('0x69')][_0x262bbf][_0xed89('0x6d')]:'');}return _0x2aad1e+')';};var _0x5d23ae={'where':{'id':_0x6a53d8[_0xed89('0x55')]['id']}},_0x247d1d,_0x603808,_0x4ee152,_0x1dd5c0,_0x387454;_0x5d23ae=_[_0xed89('0x44')]({},_0x5d23ae,_0x6a53d8[_0xed89('0x6e')]);return db['AnalyticCustomReport'][_0xed89('0x4c')](_0x5d23ae)['then'](function(_0xe82d60){if(_0xe82d60){_0x247d1d=_0xe82d60;return _0xe82d60['getFields']();}return null;})[_0xed89('0x25')](function(_0x29aa7f){if(_0x29aa7f){if(!_0x29aa7f[_0xed89('0x4a')]){throw new db[(_0xed89('0x8e'))][(_0xed89('0x70'))](_0xed89('0x71'),0x193);}_0x603808=_0x29aa7f;return db[_0xed89('0x72')][_0xed89('0x47')]({'raw':!![]});}return null;})[_0xed89('0x25')](function(_0x25423e){if(_0x25423e){_0x4ee152=_['keyBy'](_0x25423e,'id');var _0x14b907;var _0x9b5b3b=squel[_0xed89('0x74')]();_0x9b5b3b[_0xed89('0x8f')](_0x247d1d[_0xed89('0x75')]);for(var _0x3accc0=0x0;_0x3accc0<_0x603808[_0xed89('0x4a')];_0x3accc0+=0x1){_0x14b907=_0x603808[_0x3accc0][_0xed89('0x76')]?_0x4ee152[_0x603808[_0x3accc0][_0xed89('0x76')]][_0xed89('0x77')]:_0x603808[_0x3accc0]['field'];_0x14b907=_0x603808[_0x3accc0][_0xed89('0x78')]?_[_0xed89('0x79')](_0x1cdf80[_0x603808[_0x3accc0][_0xed89('0x78')]],'%s',_0x14b907):_0x14b907;_0x14b907=_0x603808[_0x3accc0][_0xed89('0x7a')]?_['replace'](_0x165052[_0x603808[_0x3accc0][_0xed89('0x7a')]],'%s',_0x14b907):_0x14b907;if(_0x603808[_0x3accc0]['groupBy']){_0x9b5b3b[_0xed89('0x6a')](_0x14b907);}_0x603808[_0x3accc0][_0xed89('0x7b')]&&_0x9b5b3b[_0xed89('0x3e')](_0x14b907,_0x603808[_0x3accc0]['orderBy']===_0xed89('0x90')?![]:!![]);_0x9b5b3b['field'](_0x14b907,_0x603808[_0x3accc0]['alias']||_0x14b907);}if(_0x247d1d[_0xed89('0x7d')]){_0x247d1d[_0xed89('0x7d')]=JSON[_0xed89('0x83')](_0x247d1d[_0xed89('0x7d')]);for(var _0xd48bd1=0x0;_0xd48bd1<_0x247d1d[_0xed89('0x7d')][_0xed89('0x4a')];_0xd48bd1+=0x1){if(_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x33')]&&_['includes'](_0x453663,_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x33')])&&_0x247d1d[_0xed89('0x7d')][_0xd48bd1]['parentKey']&&_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x7f')]&&_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x80')]){_0x9b5b3b[_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x33')]](_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x7f')],null,util[_0xed89('0x7a')](_0xed89('0x81'),_0x247d1d['table'],_0x247d1d['joins'][_0xd48bd1][_0xed89('0x7e')],_0x247d1d[_0xed89('0x7d')][_0xd48bd1][_0xed89('0x7f')],_0x247d1d[_0xed89('0x7d')][_0xd48bd1]['foreignKey']));}}}if(_0x247d1d[_0xed89('0x82')]){_0x247d1d[_0xed89('0x82')]=JSON[_0xed89('0x83')](_0x247d1d['conditions']);_0x9b5b3b[_0xed89('0x40')](_0x10e57b(_0x247d1d[_0xed89('0x82')]['group']));}_0x387454=_0x9b5b3b[_0xed89('0x84')]();_0x9b5b3b['limit'](_0x352967);_0x9b5b3b[_0xed89('0x3d')](0x0);logger['debug'](_0xed89('0xa5'),_0x9b5b3b[_0xed89('0x9e')]());return dbH[_0xed89('0x86')][_0xed89('0x35')](_0x9b5b3b[_0xed89('0x9e')](),{'type':dbH[_0xed89('0x86')][_0xed89('0x87')]['SELECT']});}})[_0xed89('0x25')](function(){return{'sql':_0x387454['toString']()};})[_0xed89('0x25')](respondWithResult(_0x2a1661,null))[_0xed89('0x4d')](handleError(_0x2a1661,null));}; \ No newline at end of file +var _0xcb21=['body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','toString','sequelize','SELECT','cross_join','SEC_TO_TIME(%s)','IS\x20NULL','value','Please\x20insert\x20at\x20least\x20one\x20field','from','table','metric','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','endDate','info','fork','savename','countTable','COUNT(*)','QueryTypes','run','runReport','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create'];(function(_0x52e840,_0xbecfc2){var _0x576f52=function(_0x386c08){while(--_0x386c08){_0x52e840['push'](_0x52e840['shift']());}};_0x576f52(++_0xbecfc2);}(_0xcb21,0x1b0));var _0x1cb2=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0xcb21[_0x30df37];return _0x41ab55;};'use strict';var emlformat=require(_0x1cb2('0x0'));var rimraf=require(_0x1cb2('0x1'));var zipdir=require(_0x1cb2('0x2'));var jsonpatch=require(_0x1cb2('0x3'));var rp=require(_0x1cb2('0x4'));var moment=require(_0x1cb2('0x5'));var BPromise=require(_0x1cb2('0x6'));var Mustache=require(_0x1cb2('0x7'));var util=require(_0x1cb2('0x8'));var path=require(_0x1cb2('0x9'));var sox=require(_0x1cb2('0xa'));var csv=require(_0x1cb2('0xb'));var ejs=require(_0x1cb2('0xc'));var fs=require('fs');var fs_extra=require(_0x1cb2('0xd'));var _=require(_0x1cb2('0xe'));var squel=require(_0x1cb2('0xf'));var crypto=require(_0x1cb2('0x10'));var jsforce=require(_0x1cb2('0x11'));var deskjs=require(_0x1cb2('0x12'));var toCsv=require('to-csv');var querystring=require(_0x1cb2('0x13'));var Papa=require(_0x1cb2('0x14'));var Redis=require(_0x1cb2('0x15'));var authService=require(_0x1cb2('0x16'));var qs=require(_0x1cb2('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1cb2('0x19'));var db=require(_0x1cb2('0x1a'))['db'];var dbH=require(_0x1cb2('0x1a'))[_0x1cb2('0x1b')];function respondWithStatusCode(_0x446e87,_0x31a318){_0x31a318=_0x31a318||0xcc;return function(_0x1819ff){if(_0x1819ff){return _0x446e87['sendStatus'](_0x31a318);}return _0x446e87['status'](_0x31a318)[_0x1cb2('0x1c')]();};}function respondWithResult(_0x1b20b7,_0x13d6ca){_0x13d6ca=_0x13d6ca||0xc8;return function(_0x88ba0){if(_0x88ba0){return _0x1b20b7[_0x1cb2('0x1d')](_0x13d6ca)[_0x1cb2('0x1e')](_0x88ba0);}};}function respondWithFilteredResult(_0xf7c5f1,_0x290372){return function(_0x244c9d){if(_0x244c9d){var _0xf66e5d=typeof _0x290372[_0x1cb2('0x1f')]===_0x1cb2('0x20')&&typeof _0x290372[_0x1cb2('0x21')]===_0x1cb2('0x20');var _0x1d66b0=_0x244c9d['count'];var _0x4ddce9=_0xf66e5d?0x0:_0x290372[_0x1cb2('0x1f')];var _0x20c84e=_0xf66e5d?_0x244c9d[_0x1cb2('0x22')]:_0x290372[_0x1cb2('0x1f')]+_0x290372[_0x1cb2('0x21')];var _0x1ee690;if(_0x20c84e>=_0x1d66b0){_0x20c84e=_0x1d66b0;_0x1ee690=0xc8;}else{_0x1ee690=0xce;}_0xf7c5f1['status'](_0x1ee690);return _0xf7c5f1[_0x1cb2('0x23')](_0x1cb2('0x24'),_0x4ddce9+'-'+_0x20c84e+'/'+_0x1d66b0)['json'](_0x244c9d);}return null;};}function patchUpdates(_0x465393){return function(_0x3ae1b1){try{jsonpatch[_0x1cb2('0x25')](_0x3ae1b1,_0x465393,!![]);}catch(_0x66510b){return BPromise[_0x1cb2('0x26')](_0x66510b);}return _0x3ae1b1[_0x1cb2('0x27')]();};}function saveUpdates(_0x56971f,_0x163e6e){return function(_0x108a90){if(_0x108a90){return _0x108a90[_0x1cb2('0x28')](_0x56971f)[_0x1cb2('0x29')](function(_0x3c7088){return _0x3c7088;});}return null;};}function removeEntity(_0x30f449,_0x3c66d9){return function(_0xf79fb){if(_0xf79fb){return _0xf79fb[_0x1cb2('0x2a')]()[_0x1cb2('0x29')](function(){var _0x3b3d04=_0xf79fb['get']({'plain':!![]});var _0x843f0b=_0x1cb2('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x843f0b,'resourceId':_0x3b3d04['id']}})['then'](function(){return _0xf79fb;});})[_0x1cb2('0x29')](function(){_0x30f449[_0x1cb2('0x1d')](0xcc)[_0x1cb2('0x1c')]();});}};}function handleEntityNotFound(_0x95ad0a,_0xcbfe37){return function(_0x7c28d9){if(!_0x7c28d9){_0x95ad0a[_0x1cb2('0x2c')](0x194);}return _0x7c28d9;};}function handleError(_0x521b9c,_0x4236db){_0x4236db=_0x4236db||0x1f4;return function(_0x207d6d){logger[_0x1cb2('0x2d')](_0x207d6d[_0x1cb2('0x2e')]);if(_0x207d6d[_0x1cb2('0x2f')]){delete _0x207d6d[_0x1cb2('0x2f')];}_0x521b9c['status'](_0x4236db)[_0x1cb2('0x30')](_0x207d6d);};}exports[_0x1cb2('0x31')]=function(_0x3161c4,_0xe64f6b){var _0x82d651={},_0x12375b={},_0x1986a1={'count':0x0,'rows':[]};var _0x3d2736=_[_0x1cb2('0x32')](db[_0x1cb2('0x33')]['rawAttributes'],function(_0x2eace9){return{'name':_0x2eace9['fieldName'],'type':_0x2eace9[_0x1cb2('0x34')]['key']};});_0x12375b[_0x1cb2('0x35')]=_[_0x1cb2('0x32')](_0x3d2736,_0x1cb2('0x2f'));_0x12375b[_0x1cb2('0x36')]=_[_0x1cb2('0x37')](_0x3161c4[_0x1cb2('0x36')]);_0x12375b[_0x1cb2('0x38')]=_[_0x1cb2('0x39')](_0x12375b[_0x1cb2('0x35')],_0x12375b[_0x1cb2('0x36')]);_0x82d651[_0x1cb2('0x3a')]=_[_0x1cb2('0x39')](_0x12375b[_0x1cb2('0x35')],qs[_0x1cb2('0x3b')](_0x3161c4[_0x1cb2('0x36')]['fields']));_0x82d651[_0x1cb2('0x3a')]=_0x82d651['attributes']['length']?_0x82d651[_0x1cb2('0x3a')]:_0x12375b[_0x1cb2('0x35')];if(!_0x3161c4['query'][_0x1cb2('0x3c')](_0x1cb2('0x3d'))){_0x82d651[_0x1cb2('0x21')]=qs[_0x1cb2('0x21')](_0x3161c4[_0x1cb2('0x36')][_0x1cb2('0x21')]);_0x82d651[_0x1cb2('0x1f')]=qs['offset'](_0x3161c4[_0x1cb2('0x36')][_0x1cb2('0x1f')]);}_0x82d651[_0x1cb2('0x3e')]=qs[_0x1cb2('0x3f')](_0x3161c4['query']['sort']);_0x82d651['where']=qs[_0x1cb2('0x38')](_[_0x1cb2('0x40')](_0x3161c4['query'],_0x12375b[_0x1cb2('0x38')]),_0x3d2736);if(_0x3161c4[_0x1cb2('0x36')][_0x1cb2('0x41')]){_0x82d651[_0x1cb2('0x42')]=_[_0x1cb2('0x43')](_0x82d651[_0x1cb2('0x42')],{'$or':_[_0x1cb2('0x32')](_0x3d2736,function(_0x52a2b5){if(_0x52a2b5['type']!==_0x1cb2('0x44')){var _0x53a1a5={};_0x53a1a5[_0x52a2b5[_0x1cb2('0x2f')]]={'$like':'%'+_0x3161c4['query'][_0x1cb2('0x41')]+'%'};return _0x53a1a5;}})});}_0x82d651=_[_0x1cb2('0x43')]({},_0x82d651,_0x3161c4[_0x1cb2('0x45')]);var _0x4d469c={'where':_0x82d651[_0x1cb2('0x42')]};return db[_0x1cb2('0x33')][_0x1cb2('0x22')](_0x4d469c)[_0x1cb2('0x29')](function(_0x4cdf80){_0x1986a1[_0x1cb2('0x22')]=_0x4cdf80;if(_0x3161c4[_0x1cb2('0x36')][_0x1cb2('0x46')]){_0x82d651[_0x1cb2('0x47')]=[{'all':!![]}];}return db[_0x1cb2('0x33')][_0x1cb2('0x48')](_0x82d651);})[_0x1cb2('0x29')](function(_0x30b094){_0x1986a1[_0x1cb2('0x49')]=_0x30b094;return _0x1986a1;})[_0x1cb2('0x29')](respondWithFilteredResult(_0xe64f6b,_0x82d651))[_0x1cb2('0x4a')](handleError(_0xe64f6b,null));};exports[_0x1cb2('0x4b')]=function(_0x51b8e7,_0xc6c56b){var _0x1eb5dc={'raw':![],'where':{'id':_0x51b8e7[_0x1cb2('0x4c')]['id']}},_0x313e37={};_0x313e37[_0x1cb2('0x35')]=_[_0x1cb2('0x37')](db[_0x1cb2('0x33')][_0x1cb2('0x4d')]);_0x313e37['query']=_['keys'](_0x51b8e7['query']);_0x313e37[_0x1cb2('0x38')]=_['intersection'](_0x313e37[_0x1cb2('0x35')],_0x313e37[_0x1cb2('0x36')]);_0x1eb5dc['attributes']=_[_0x1cb2('0x39')](_0x313e37['model'],qs[_0x1cb2('0x3b')](_0x51b8e7[_0x1cb2('0x36')]['fields']));_0x1eb5dc[_0x1cb2('0x3a')]=_0x1eb5dc[_0x1cb2('0x3a')][_0x1cb2('0x4e')]?_0x1eb5dc['attributes']:_0x313e37[_0x1cb2('0x35')];if(_0x51b8e7[_0x1cb2('0x36')][_0x1cb2('0x46')]){_0x1eb5dc[_0x1cb2('0x47')]=[{'all':!![]}];}_0x1eb5dc=_[_0x1cb2('0x43')]({},_0x1eb5dc,_0x51b8e7['options']);return db[_0x1cb2('0x33')][_0x1cb2('0x4f')](_0x1eb5dc)[_0x1cb2('0x29')](handleEntityNotFound(_0xc6c56b,null))[_0x1cb2('0x29')](respondWithResult(_0xc6c56b,null))[_0x1cb2('0x4a')](handleError(_0xc6c56b,null));};exports[_0x1cb2('0x50')]=function(_0x5a4c50,_0x4b76bb){return db[_0x1cb2('0x33')][_0x1cb2('0x50')](_0x5a4c50[_0x1cb2('0x51')],{})[_0x1cb2('0x29')](function(_0x24a968){var _0x56cec3=_0x5a4c50[_0x1cb2('0x52')][_0x1cb2('0x53')]({'plain':!![]});if(!_0x56cec3)throw new Error(_0x1cb2('0x54'));if(_0x56cec3[_0x1cb2('0x55')]===_0x1cb2('0x52')){var _0x42cd82=_0x24a968[_0x1cb2('0x53')]({'plain':!![]});var _0x3ac894=_0x1cb2('0x56');return db[_0x1cb2('0x57')]['find']({'where':{'name':_0x3ac894,'userProfileId':_0x56cec3[_0x1cb2('0x58')]},'raw':!![]})[_0x1cb2('0x29')](function(_0x827e90){if(_0x827e90&&_0x827e90[_0x1cb2('0x59')]===0x0){return db[_0x1cb2('0x5a')][_0x1cb2('0x50')]({'name':_0x42cd82[_0x1cb2('0x2f')],'resourceId':_0x42cd82['id'],'type':_0x1cb2('0x2b'),'sectionId':_0x827e90['id']},{})[_0x1cb2('0x29')](function(){return _0x24a968;});}else{return _0x24a968;}})[_0x1cb2('0x4a')](function(_0x490a8f){logger[_0x1cb2('0x2d')](_0x1cb2('0x5b'),_0x490a8f);throw _0x490a8f;});}return _0x24a968;})['then'](respondWithResult(_0x4b76bb,0xc9))['catch'](handleError(_0x4b76bb,null));};exports[_0x1cb2('0x28')]=function(_0x1b34b4,_0x114ae9){if(_0x1b34b4[_0x1cb2('0x51')]['id']){delete _0x1b34b4['body']['id'];}return db['AnalyticCustomReport'][_0x1cb2('0x4f')]({'where':{'id':_0x1b34b4[_0x1cb2('0x4c')]['id']}})[_0x1cb2('0x29')](handleEntityNotFound(_0x114ae9,null))[_0x1cb2('0x29')](saveUpdates(_0x1b34b4['body'],null))['then'](respondWithResult(_0x114ae9,null))['catch'](handleError(_0x114ae9,null));};exports[_0x1cb2('0x2a')]=function(_0x33298c,_0x3f66af){return db[_0x1cb2('0x33')][_0x1cb2('0x4f')]({'where':{'id':_0x33298c['params']['id']}})[_0x1cb2('0x29')](handleEntityNotFound(_0x3f66af,null))[_0x1cb2('0x29')](removeEntity(_0x3f66af,null))['catch'](handleError(_0x3f66af,null));};exports['preview']=function(_0x8aa673,_0x3a5c3c){var _0x486baa=0xa;var _0x328b53=[_0x1cb2('0x5c'),_0x1cb2('0x5d'),_0x1cb2('0x5e'),'cross_join'];var _0x2eae5c={'SUM':_0x1cb2('0x5f'),'COUNT':_0x1cb2('0x60'),'COUNT DISTINCT':_0x1cb2('0x61'),'MAX':_0x1cb2('0x62'),'MIN':_0x1cb2('0x63'),'AVG':_0x1cb2('0x64'),'GROUP_CONCAT':_0x1cb2('0x65'),'GROUP_CONCAT ASC':_0x1cb2('0x66'),'GROUP_CONCAT DESC':_0x1cb2('0x67')};var _0x33ff8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1cb2('0x68'),'HOUR':_0x1cb2('0x69'),'ROUND':_0x1cb2('0x6a'),'UNIX_TIMESTAMP':_0x1cb2('0x6b')};var _0x2675f5=function(_0xb83cce){return!_[_0x1cb2('0x6c')](['IS\x20NULL',_0x1cb2('0x6d'),_0x1cb2('0x6e'),_0x1cb2('0x6f')],_0xb83cce);};var _0x25f0c9=function(_0x3b6a22){if(!_0x3b6a22||!_0x3b6a22[_0x1cb2('0x70')][_0x1cb2('0x4e')]){return'';}for(var _0x30f73c='(',_0x48878b=0x0;_0x48878b<_0x3b6a22[_0x1cb2('0x70')][_0x1cb2('0x4e')];_0x48878b+=0x1){_0x48878b>0x0&&(_0x30f73c+='\x20'+_0x3b6a22[_0x1cb2('0x71')]+'\x20');_0x30f73c+=_0x3b6a22['rules'][_0x48878b][_0x1cb2('0x72')]?_0x25f0c9(_0x3b6a22[_0x1cb2('0x70')][_0x48878b]['group']):_0x3b6a22[_0x1cb2('0x70')][_0x48878b][_0x1cb2('0x73')]+'\x20'+_0x3b6a22[_0x1cb2('0x70')][_0x48878b][_0x1cb2('0x74')]+(_0x2675f5(_0x3b6a22[_0x1cb2('0x70')][_0x48878b][_0x1cb2('0x74')])?'\x20'+_0x3b6a22[_0x1cb2('0x70')][_0x48878b]['value']:'');}return _0x30f73c+')';};var _0x507878={'where':{'id':_0x8aa673[_0x1cb2('0x4c')]['id']}},_0x42ee61,_0xabd6c1,_0x14d93b,_0x55d6a0,_0x397da3;_0x507878=_[_0x1cb2('0x43')]({},_0x507878,_0x8aa673['options']);return db[_0x1cb2('0x33')][_0x1cb2('0x4f')](_0x507878)[_0x1cb2('0x29')](function(_0x6b6dd6){if(_0x6b6dd6){_0x42ee61=_0x6b6dd6;return _0x6b6dd6[_0x1cb2('0x75')]();}return null;})[_0x1cb2('0x29')](function(_0x589e1e){if(_0x589e1e){if(!_0x589e1e[_0x1cb2('0x4e')]){throw new db[(_0x1cb2('0x76'))][(_0x1cb2('0x77'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xabd6c1=_0x589e1e;return db[_0x1cb2('0x78')][_0x1cb2('0x48')]({'raw':!![]});}return null;})[_0x1cb2('0x29')](function(_0x35f569){if(_0x35f569){_0x14d93b=_[_0x1cb2('0x79')](_0x35f569,'id');var _0x189992;var _0x245004=squel[_0x1cb2('0x7a')]();_0x245004['from'](_0x42ee61['table']);for(var _0x49da9b=0x0;_0x49da9b<_0xabd6c1[_0x1cb2('0x4e')];_0x49da9b+=0x1){_0x189992=_0xabd6c1[_0x49da9b][_0x1cb2('0x7b')]?_0x14d93b[_0xabd6c1[_0x49da9b][_0x1cb2('0x7b')]]['metric']:_0xabd6c1[_0x49da9b]['field'];_0x189992=_0xabd6c1[_0x49da9b]['function']?_['replace'](_0x2eae5c[_0xabd6c1[_0x49da9b][_0x1cb2('0x7c')]],'%s',_0x189992):_0x189992;_0x189992=_0xabd6c1[_0x49da9b][_0x1cb2('0x7d')]?_[_0x1cb2('0x7e')](_0x33ff8b[_0xabd6c1[_0x49da9b][_0x1cb2('0x7d')]],'%s',_0x189992):_0x189992;if(_0xabd6c1[_0x49da9b][_0x1cb2('0x7f')]){_0x245004['group'](_0x189992);}_0xabd6c1[_0x49da9b][_0x1cb2('0x80')]&&_0x245004[_0x1cb2('0x3e')](_0x189992,_0xabd6c1[_0x49da9b][_0x1cb2('0x80')]===_0x1cb2('0x81')?![]:!![]);_0x245004[_0x1cb2('0x73')](_0x189992,_0xabd6c1[_0x49da9b][_0x1cb2('0x82')]||_0x189992);}if(_0x42ee61[_0x1cb2('0x83')]){_0x42ee61[_0x1cb2('0x83')]=JSON[_0x1cb2('0x84')](_0x42ee61[_0x1cb2('0x83')]);for(var _0x2bfb06=0x0;_0x2bfb06<_0x42ee61[_0x1cb2('0x83')][_0x1cb2('0x4e')];_0x2bfb06+=0x1){if(_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['type']&&_[_0x1cb2('0x6c')](_0x328b53,_0x42ee61[_0x1cb2('0x83')][_0x2bfb06][_0x1cb2('0x34')])&&_0x42ee61[_0x1cb2('0x83')][_0x2bfb06][_0x1cb2('0x85')]&&_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['foreignTable']&&_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['foreignKey']){_0x245004[_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['type']](_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['foreignTable'],null,util[_0x1cb2('0x7d')](_0x1cb2('0x86'),_0x42ee61['table'],_0x42ee61['joins'][_0x2bfb06][_0x1cb2('0x85')],_0x42ee61[_0x1cb2('0x83')][_0x2bfb06][_0x1cb2('0x87')],_0x42ee61[_0x1cb2('0x83')][_0x2bfb06]['foreignKey']));}}}if(_0x42ee61[_0x1cb2('0x88')]){_0x42ee61[_0x1cb2('0x88')]=JSON['parse'](_0x42ee61['conditions']);_0x245004[_0x1cb2('0x42')](_0x25f0c9(_0x42ee61['conditions'][_0x1cb2('0x72')]));}_0x397da3=_0x245004[_0x1cb2('0x89')]();_0x245004['limit'](_0x486baa);_0x245004[_0x1cb2('0x1f')](0x0);logger[_0x1cb2('0x8a')]('Limited\x20Query:',_0x245004[_0x1cb2('0x8b')]());return dbH[_0x1cb2('0x8c')][_0x1cb2('0x36')](_0x245004[_0x1cb2('0x8b')](),{'type':dbH[_0x1cb2('0x8c')]['QueryTypes'][_0x1cb2('0x8d')]});}})[_0x1cb2('0x29')](respondWithResult(_0x3a5c3c,null))[_0x1cb2('0x4a')](handleError(_0x3a5c3c,null));};function runReport(_0x1e0672,_0x588ae9,_0x4c8999){var _0x346991=_0x588ae9['name'];var _0x592140=0xa;var _0x30cca5=[_0x1cb2('0x5c'),_0x1cb2('0x5d'),_0x1cb2('0x5e'),_0x1cb2('0x8e')];var _0x160abf={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1cb2('0x61'),'MAX':_0x1cb2('0x62'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x1cb2('0x65'),'GROUP_CONCAT ASC':_0x1cb2('0x66'),'GROUP_CONCAT DESC':_0x1cb2('0x67')};var _0x1a9dad={'SEC_TO_TIME':_0x1cb2('0x8f'),'DATE':_0x1cb2('0x68'),'HOUR':_0x1cb2('0x69'),'ROUND':_0x1cb2('0x6a'),'UNIX_TIMESTAMP':_0x1cb2('0x6b')};var _0x223794=function(_0x2307b5){return!_[_0x1cb2('0x6c')]([_0x1cb2('0x90'),_0x1cb2('0x6d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2307b5);};var _0x333cd7=function(_0xe1cb62){if(!_0xe1cb62||!_0xe1cb62[_0x1cb2('0x70')]['length']){return'';}for(var _0x59ac88='(',_0x195907=0x0;_0x195907<_0xe1cb62[_0x1cb2('0x70')][_0x1cb2('0x4e')];_0x195907+=0x1){_0x195907>0x0&&(_0x59ac88+='\x20'+_0xe1cb62['operator']+'\x20');_0x59ac88+=_0xe1cb62['rules'][_0x195907][_0x1cb2('0x72')]?_0x333cd7(_0xe1cb62['rules'][_0x195907][_0x1cb2('0x72')]):_0xe1cb62[_0x1cb2('0x70')][_0x195907][_0x1cb2('0x73')]+'\x20'+_0xe1cb62[_0x1cb2('0x70')][_0x195907]['condition']+(_0x223794(_0xe1cb62[_0x1cb2('0x70')][_0x195907]['condition'])?'\x20'+_0xe1cb62[_0x1cb2('0x70')][_0x195907][_0x1cb2('0x91')]:'');}return _0x59ac88+')';};var _0x1ddd3c={'where':{'id':_0x1e0672['id']}},_0x1b8f1f,_0x555b5b,_0xe91b88,_0x3c5047,_0x44c8a1;_0x1ddd3c=_[_0x1cb2('0x43')]({},_0x1ddd3c,_0x4c8999);return db[_0x1cb2('0x33')][_0x1cb2('0x4f')](_0x1ddd3c)['then'](function(_0x2d10f2){if(_0x2d10f2){_0x1b8f1f=_0x2d10f2;return _0x2d10f2[_0x1cb2('0x75')]();}return null;})[_0x1cb2('0x29')](function(_0x5eb8fe){if(_0x5eb8fe){if(!_0x5eb8fe[_0x1cb2('0x4e')]){throw new db[(_0x1cb2('0x76'))][(_0x1cb2('0x77'))](_0x1cb2('0x92'),0x193);}_0x555b5b=_0x5eb8fe;return db[_0x1cb2('0x78')]['findAll']({'raw':!![]});}return null;})[_0x1cb2('0x29')](function(_0x25de85){if(_0x25de85){_0xe91b88=_['keyBy'](_0x25de85,'id');var _0x47265a;var _0x31ae09=squel[_0x1cb2('0x7a')]();_0x31ae09[_0x1cb2('0x93')](_0x1b8f1f[_0x1cb2('0x94')]);for(var _0x3cda83=0x0;_0x3cda83<_0x555b5b['length'];_0x3cda83+=0x1){_0x47265a=_0x555b5b[_0x3cda83][_0x1cb2('0x7b')]?_0xe91b88[_0x555b5b[_0x3cda83]['MetricId']][_0x1cb2('0x95')]:_0x555b5b[_0x3cda83][_0x1cb2('0x73')];_0x47265a=_0x555b5b[_0x3cda83][_0x1cb2('0x7c')]?_['replace'](_0x160abf[_0x555b5b[_0x3cda83][_0x1cb2('0x7c')]],'%s',_0x47265a):_0x47265a;_0x47265a=_0x555b5b[_0x3cda83]['format']?_[_0x1cb2('0x7e')](_0x1a9dad[_0x555b5b[_0x3cda83][_0x1cb2('0x7d')]],'%s',_0x47265a):_0x47265a;if(_0x555b5b[_0x3cda83][_0x1cb2('0x7f')]){_0x31ae09['group'](_0x47265a);}_0x555b5b[_0x3cda83][_0x1cb2('0x80')]&&_0x31ae09[_0x1cb2('0x3e')](_0x47265a,_0x555b5b[_0x3cda83]['orderBy']===_0x1cb2('0x81')?![]:!![]);_0x31ae09['field'](_0x47265a,_0x555b5b[_0x3cda83]['alias']||_0x47265a);}if(_0x1b8f1f['joins']){_0x1b8f1f[_0x1cb2('0x83')]=JSON[_0x1cb2('0x84')](_0x1b8f1f[_0x1cb2('0x83')]);for(var _0x4a8198=0x0;_0x4a8198<_0x1b8f1f[_0x1cb2('0x83')][_0x1cb2('0x4e')];_0x4a8198+=0x1){if(_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x34')]&&_[_0x1cb2('0x6c')](_0x30cca5,_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x34')])&&_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x85')]&&_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x87')]&&_0x1b8f1f['joins'][_0x4a8198][_0x1cb2('0x96')]){_0x31ae09[_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198]['type']](_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x87')],null,util[_0x1cb2('0x7d')](_0x1cb2('0x86'),_0x1b8f1f[_0x1cb2('0x94')],_0x1b8f1f['joins'][_0x4a8198][_0x1cb2('0x85')],_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198]['foreignTable'],_0x1b8f1f[_0x1cb2('0x83')][_0x4a8198][_0x1cb2('0x96')]));}}}if(_0x1b8f1f[_0x1cb2('0x88')]){_0x1b8f1f['conditions']=JSON[_0x1cb2('0x84')](_0x1b8f1f['conditions']);_0x31ae09[_0x1cb2('0x42')](_0x333cd7(_0x1b8f1f[_0x1cb2('0x88')][_0x1cb2('0x72')]));}_0x44c8a1=_0x31ae09[_0x1cb2('0x89')]();_0x31ae09[_0x1cb2('0x21')](_0x592140);_0x31ae09[_0x1cb2('0x1f')](0x0);return;}})[_0x1cb2('0x29')](function(){if(_0x588ae9[_0x1cb2('0x97')]===_0x1cb2('0x98')){return null;}var _0x4af868=_[_0x1cb2('0x43')](_0x588ae9,{'name':_0x588ae9[_0x1cb2('0x99')]||_0x588ae9[_0x1cb2('0x2f')]||_0x1b8f1f[_0x1cb2('0x2f')],'basename':_0x346991,'savename':util[_0x1cb2('0x7d')](_0x1cb2('0x9a'),_0x588ae9[_0x1cb2('0x2f')]||_0x1b8f1f['name'],require(_0x1cb2('0x9b'))[_0x1cb2('0x9c')](0x4),_0x588ae9['output']||_0x1cb2('0x9d')),'reportId':_0x1b8f1f['id'],'reportType':_0x1cb2('0x9e')});return db[_0x1cb2('0x9f')][_0x1cb2('0x50')](_0x4af868,{'raw':!![]});})[_0x1cb2('0x29')](function(_0xe073bf){if(_0x1b8f1f[_0x1cb2('0x94')]==='cdr'){_0x44c8a1[_0x1cb2('0x42')](_0x1b8f1f[_0x1cb2('0x94')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x588ae9[_0x1cb2('0xa0')],_0x588ae9[_0x1cb2('0xa1')]);}else{_0x44c8a1[_0x1cb2('0x42')](_0x1b8f1f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x588ae9['startDate'],_0x588ae9[_0x1cb2('0xa1')]);}if(_0xe073bf){logger[_0x1cb2('0xa2')]('Run\x20Query:',_0x44c8a1[_0x1cb2('0x8b')]());require('child_process')[_0x1cb2('0xa3')](path['join'](__dirname,'../../components/export/',_0xe073bf[_0x1cb2('0x97')]),[_0xe073bf['id'],_0x44c8a1[_0x1cb2('0x8b')](),path[_0x1cb2('0x5c')](__dirname,'../../files/reports',_0xe073bf[_0x1cb2('0xa4')]),_0x346991]);return _0xe073bf;}else{var _0x160a1b=squel['select']();_0x160a1b[_0x1cb2('0x93')]('('+_0x44c8a1[_0x1cb2('0x8b')]()+')',_0x1cb2('0xa5'));_0x160a1b[_0x1cb2('0x73')](_0x1cb2('0xa6'),'count');_0x44c8a1[_0x1cb2('0x21')](_0x588ae9['limit']||_0x592140);_0x44c8a1['offset'](_0x588ae9[_0x1cb2('0x1f')]||0x0);return dbH['sequelize']['query'](_0x160a1b[_0x1cb2('0x8b')](),{'type':dbH[_0x1cb2('0x8c')][_0x1cb2('0xa7')]['SELECT']})[_0x1cb2('0x29')](function(_0x323df3){if(!_0x323df3[_0x1cb2('0x4e')]){_0x3c5047=0x0;}else{_0x3c5047=_0x323df3[0x0][_0x1cb2('0x22')]||0x0;}return dbH['sequelize']['query'](_0x44c8a1[_0x1cb2('0x8b')](),{'type':dbH[_0x1cb2('0x8c')][_0x1cb2('0xa7')][_0x1cb2('0x8d')]});})[_0x1cb2('0x29')](function(_0x4406ed){return{'rows':_0x4406ed||[],'count':_0x3c5047};});}});}exports[_0x1cb2('0xa8')]=function(_0xfdbd07,_0x39ed47){return runReport(_0xfdbd07[_0x1cb2('0x4c')],_0xfdbd07[_0x1cb2('0x36')],_0xfdbd07['options'])[_0x1cb2('0x29')](respondWithResult(_0x39ed47,null))[_0x1cb2('0x4a')](handleError(_0x39ed47,null));};exports[_0x1cb2('0xa9')]=runReport;exports[_0x1cb2('0x36')]=function(_0x43bae8,_0x40b4a9){var _0x5337a5=0xa;var _0x55803a=[_0x1cb2('0x5c'),'left_join',_0x1cb2('0x5e'),'cross_join'];var _0x5ca5d2={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1cb2('0x61'),'MAX':_0x1cb2('0x62'),'MIN':_0x1cb2('0x63'),'AVG':_0x1cb2('0x64'),'GROUP_CONCAT':_0x1cb2('0x65'),'GROUP_CONCAT ASC':_0x1cb2('0x66'),'GROUP_CONCAT DESC':_0x1cb2('0x67')};var _0x107fcc={'SEC_TO_TIME':_0x1cb2('0x8f'),'DATE':'DATE(%s)','HOUR':_0x1cb2('0x69'),'ROUND':_0x1cb2('0x6a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6479fb=function(_0x1c725d){return!_[_0x1cb2('0x6c')]([_0x1cb2('0x90'),_0x1cb2('0x6d'),_0x1cb2('0x6e'),_0x1cb2('0x6f')],_0x1c725d);};var _0x2e64c3=function(_0x197e90){if(!_0x197e90||!_0x197e90[_0x1cb2('0x70')][_0x1cb2('0x4e')]){return'';}for(var _0x5380b9='(',_0x473139=0x0;_0x473139<_0x197e90[_0x1cb2('0x70')][_0x1cb2('0x4e')];_0x473139+=0x1){_0x473139>0x0&&(_0x5380b9+='\x20'+_0x197e90[_0x1cb2('0x71')]+'\x20');_0x5380b9+=_0x197e90[_0x1cb2('0x70')][_0x473139]['group']?_0x2e64c3(_0x197e90[_0x1cb2('0x70')][_0x473139][_0x1cb2('0x72')]):_0x197e90[_0x1cb2('0x70')][_0x473139][_0x1cb2('0x73')]+'\x20'+_0x197e90[_0x1cb2('0x70')][_0x473139][_0x1cb2('0x74')]+(_0x6479fb(_0x197e90[_0x1cb2('0x70')][_0x473139][_0x1cb2('0x74')])?'\x20'+_0x197e90[_0x1cb2('0x70')][_0x473139][_0x1cb2('0x91')]:'');}return _0x5380b9+')';};var _0x1ec9ea={'where':{'id':_0x43bae8[_0x1cb2('0x4c')]['id']}},_0x1c2f7b,_0x3fc4c4,_0x28edbb,_0x1794e4,_0x2f052d;_0x1ec9ea=_['merge']({},_0x1ec9ea,_0x43bae8[_0x1cb2('0x45')]);return db[_0x1cb2('0x33')]['find'](_0x1ec9ea)[_0x1cb2('0x29')](function(_0xabda8e){if(_0xabda8e){_0x1c2f7b=_0xabda8e;return _0xabda8e[_0x1cb2('0x75')]();}return null;})[_0x1cb2('0x29')](function(_0x4a8880){if(_0x4a8880){if(!_0x4a8880[_0x1cb2('0x4e')]){throw new db[(_0x1cb2('0x76'))][(_0x1cb2('0x77'))](_0x1cb2('0x92'),0x193);}_0x3fc4c4=_0x4a8880;return db[_0x1cb2('0x78')][_0x1cb2('0x48')]({'raw':!![]});}return null;})[_0x1cb2('0x29')](function(_0xee49be){if(_0xee49be){_0x28edbb=_[_0x1cb2('0x79')](_0xee49be,'id');var _0x5bf439;var _0x171317=squel[_0x1cb2('0x7a')]();_0x171317[_0x1cb2('0x93')](_0x1c2f7b['table']);for(var _0x577e68=0x0;_0x577e68<_0x3fc4c4['length'];_0x577e68+=0x1){_0x5bf439=_0x3fc4c4[_0x577e68]['MetricId']?_0x28edbb[_0x3fc4c4[_0x577e68][_0x1cb2('0x7b')]][_0x1cb2('0x95')]:_0x3fc4c4[_0x577e68]['field'];_0x5bf439=_0x3fc4c4[_0x577e68][_0x1cb2('0x7c')]?_['replace'](_0x5ca5d2[_0x3fc4c4[_0x577e68][_0x1cb2('0x7c')]],'%s',_0x5bf439):_0x5bf439;_0x5bf439=_0x3fc4c4[_0x577e68][_0x1cb2('0x7d')]?_[_0x1cb2('0x7e')](_0x107fcc[_0x3fc4c4[_0x577e68][_0x1cb2('0x7d')]],'%s',_0x5bf439):_0x5bf439;if(_0x3fc4c4[_0x577e68][_0x1cb2('0x7f')]){_0x171317[_0x1cb2('0x72')](_0x5bf439);}_0x3fc4c4[_0x577e68][_0x1cb2('0x80')]&&_0x171317[_0x1cb2('0x3e')](_0x5bf439,_0x3fc4c4[_0x577e68][_0x1cb2('0x80')]===_0x1cb2('0x81')?![]:!![]);_0x171317[_0x1cb2('0x73')](_0x5bf439,_0x3fc4c4[_0x577e68]['alias']||_0x5bf439);}if(_0x1c2f7b[_0x1cb2('0x83')]){_0x1c2f7b[_0x1cb2('0x83')]=JSON[_0x1cb2('0x84')](_0x1c2f7b[_0x1cb2('0x83')]);for(var _0x5ca1cd=0x0;_0x5ca1cd<_0x1c2f7b[_0x1cb2('0x83')][_0x1cb2('0x4e')];_0x5ca1cd+=0x1){if(_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x34')]&&_[_0x1cb2('0x6c')](_0x55803a,_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd]['type'])&&_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd]['parentKey']&&_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x87')]&&_0x1c2f7b['joins'][_0x5ca1cd][_0x1cb2('0x96')]){_0x171317[_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x34')]](_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x87')],null,util[_0x1cb2('0x7d')](_0x1cb2('0x86'),_0x1c2f7b[_0x1cb2('0x94')],_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x85')],_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd][_0x1cb2('0x87')],_0x1c2f7b[_0x1cb2('0x83')][_0x5ca1cd]['foreignKey']));}}}if(_0x1c2f7b[_0x1cb2('0x88')]){_0x1c2f7b[_0x1cb2('0x88')]=JSON[_0x1cb2('0x84')](_0x1c2f7b[_0x1cb2('0x88')]);_0x171317[_0x1cb2('0x42')](_0x2e64c3(_0x1c2f7b[_0x1cb2('0x88')]['group']));}_0x2f052d=_0x171317[_0x1cb2('0x89')]();_0x171317[_0x1cb2('0x21')](_0x5337a5);_0x171317[_0x1cb2('0x1f')](0x0);logger[_0x1cb2('0x8a')](_0x1cb2('0xaa'),_0x171317[_0x1cb2('0x8b')]());return dbH[_0x1cb2('0x8c')][_0x1cb2('0x36')](_0x171317['toString'](),{'type':dbH[_0x1cb2('0x8c')][_0x1cb2('0xa7')][_0x1cb2('0x8d')]});}})[_0x1cb2('0x29')](function(){return{'sql':_0x2f052d[_0x1cb2('0x8b')]()};})[_0x1cb2('0x29')](respondWithResult(_0x40b4a9,null))[_0x1cb2('0x4a')](handleError(_0x40b4a9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 829b017..f560b43 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 _0x74fa=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74fa,0x6e));var _0xa74f=function(_0x3eef73,_0x4d3bfe){_0x3eef73=_0x3eef73-0x0;var _0x1ecb66=_0x74fa[_0x3eef73];return _0x1ecb66;};'use strict';var _=require(_0xa74f('0x0'));var util=require(_0xa74f('0x1'));var logger=require(_0xa74f('0x2'))(_0xa74f('0x3'));var moment=require(_0xa74f('0x4'));var BPromise=require(_0xa74f('0x5'));var rp=require(_0xa74f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa74f('0x7'));var config=require(_0xa74f('0x8'));var attributes=require(_0xa74f('0x9'));module[_0xa74f('0xa')]=function(_0xba83d,_0x4b1057){return _0xba83d[_0xa74f('0xb')](_0xa74f('0xc'),attributes,{'tableName':_0xa74f('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd66=['define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticCustomReport.attributes','exports'];(function(_0x56ef59,_0x2d1bc9){var _0x2432a6=function(_0x44430f){while(--_0x44430f){_0x56ef59['push'](_0x56ef59['shift']());}};_0x2432a6(++_0x2d1bc9);}(_0xbd66,0x7b));var _0x6bd6=function(_0x1388fd,_0x93bc28){_0x1388fd=_0x1388fd-0x0;var _0x368ce5=_0xbd66[_0x1388fd];return _0x368ce5;};'use strict';var _=require(_0x6bd6('0x0'));var util=require(_0x6bd6('0x1'));var logger=require(_0x6bd6('0x2'))(_0x6bd6('0x3'));var moment=require(_0x6bd6('0x4'));var BPromise=require(_0x6bd6('0x5'));var rp=require(_0x6bd6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6bd6('0x7'));module[_0x6bd6('0x8')]=function(_0x3133e2,_0xabfe3f){return _0x3133e2[_0x6bd6('0x9')](_0x6bd6('0xa'),attributes,{'tableName':'analytics_custom_reports','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 780af3b..b0204fc 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 _0x6fcf=['../../config/logger','../../config/environment','jayson/promise','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4edde7,_0x146074){var _0x12d013=function(_0x5d3561){while(--_0x5d3561){_0x4edde7['push'](_0x4edde7['shift']());}};_0x12d013(++_0x146074);}(_0x6fcf,0x11a));var _0xf6fc=function(_0x1f2104,_0x3d1a56){_0x1f2104=_0x1f2104-0x0;var _0x590031=_0x6fcf[_0x1f2104];return _0x590031;};'use strict';var _=require(_0xf6fc('0x0'));var util=require(_0xf6fc('0x1'));var moment=require(_0xf6fc('0x2'));var BPromise=require('bluebird');var rs=require(_0xf6fc('0x3'));var fs=require('fs');var Redis=require(_0xf6fc('0x4'));var db=require(_0xf6fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6fc('0x6'))('rpc');var config=require(_0xf6fc('0x7'));var jayson=require(_0xf6fc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5813db,_0x5ace55,_0x548e60){return new BPromise(function(_0x1a569c,_0x47e6eb){return client['request'](_0x5813db,_0x548e60)['then'](function(_0xe6a5a){logger[_0xf6fc('0x9')](_0xf6fc('0xa'),_0x5ace55,_0xf6fc('0xb'));logger[_0xf6fc('0xc')](_0xf6fc('0xd'),_0x5ace55,_0xf6fc('0xb'),JSON['stringify'](_0xe6a5a));if(_0xe6a5a[_0xf6fc('0xe')]){if(_0xe6a5a[_0xf6fc('0xe')]['code']===0x1f4){logger[_0xf6fc('0xe')](_0xf6fc('0xa'),_0x5ace55,_0xe6a5a[_0xf6fc('0xe')]['message']);return _0x47e6eb(_0xe6a5a[_0xf6fc('0xe')][_0xf6fc('0xf')]);}logger['error'](_0xf6fc('0xa'),_0x5ace55,_0xe6a5a[_0xf6fc('0xe')][_0xf6fc('0xf')]);return _0x1a569c(_0xe6a5a[_0xf6fc('0xe')][_0xf6fc('0xf')]);}else{logger['info'](_0xf6fc('0xa'),_0x5ace55,_0xf6fc('0xb'));_0x1a569c(_0xe6a5a[_0xf6fc('0x10')][_0xf6fc('0xf')]);}})[_0xf6fc('0x11')](function(_0x736d92){logger[_0xf6fc('0xe')](_0xf6fc('0xa'),_0x5ace55,_0x736d92);_0x47e6eb(_0x736d92);});});} \ No newline at end of file +var _0x60f4=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x4dff23,_0x2edcba){var _0x47c6ca=function(_0x5db532){while(--_0x5db532){_0x4dff23['push'](_0x4dff23['shift']());}};_0x47c6ca(++_0x2edcba);}(_0x60f4,0xbc));var _0x460f=function(_0x5bebbe,_0x4340f6){_0x5bebbe=_0x5bebbe-0x0;var _0x16e5bf=_0x60f4[_0x5bebbe];return _0x16e5bf;};'use strict';var _=require(_0x460f('0x0'));var util=require('util');var moment=require(_0x460f('0x1'));var BPromise=require(_0x460f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x460f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x460f('0x4'));var logger=require(_0x460f('0x5'))(_0x460f('0x6'));var config=require(_0x460f('0x7'));var jayson=require(_0x460f('0x8'));var client=jayson[_0x460f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383f12,_0x21346d,_0x28054c){return new BPromise(function(_0x2049cd,_0x5186f5){return client[_0x460f('0xa')](_0x383f12,_0x28054c)[_0x460f('0xb')](function(_0x3585c8){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,'request\x20sent');logger['debug'](_0x460f('0xc'),_0x21346d,_0x460f('0xd'),JSON['stringify'](_0x3585c8));if(_0x3585c8['error']){if(_0x3585c8[_0x460f('0xe')][_0x460f('0xf')]===0x1f4){logger[_0x460f('0xe')](_0x460f('0x10'),_0x21346d,_0x3585c8[_0x460f('0xe')][_0x460f('0x11')]);return _0x5186f5(_0x3585c8['error'][_0x460f('0x11')]);}logger[_0x460f('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x3585c8[_0x460f('0xe')][_0x460f('0x11')]);return _0x2049cd(_0x3585c8['error'][_0x460f('0x11')]);}else{logger[_0x460f('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x460f('0xd'));_0x2049cd(_0x3585c8[_0x460f('0x13')]['message']);}})[_0x460f('0x14')](function(_0x4fa734){logger[_0x460f('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x21346d,_0x4fa734);_0x5186f5(_0x4fa734);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index dc9d9d8..70d09df 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 _0x68f0=['/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show'];(function(_0x431baf,_0x22f29d){var _0x20f54e=function(_0x147a49){while(--_0x147a49){_0x431baf['push'](_0x431baf['shift']());}};_0x20f54e(++_0x22f29d);}(_0x68f0,0xb3));var _0x068f=function(_0x36bf1b,_0x1b8bc9){_0x36bf1b=_0x36bf1b-0x0;var _0x49c980=_0x68f0[_0x36bf1b];return _0x49c980;};'use strict';var multer=require(_0x068f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x068f('0x1'));var express=require(_0x068f('0x2'));var router=express['Router']();var fs_extra=require(_0x068f('0x3'));var auth=require(_0x068f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x068f('0x5')]('/',auth['isAuthenticated'](),controller[_0x068f('0x6')]);router[_0x068f('0x5')](_0x068f('0x7'),auth[_0x068f('0x8')](),controller[_0x068f('0x9')]);router[_0x068f('0x5')](_0x068f('0xa'),auth['isAuthenticated'](),controller[_0x068f('0xb')]);router['get'](_0x068f('0xc'),auth[_0x068f('0x8')](),controller[_0x068f('0xd')]);router[_0x068f('0x5')](_0x068f('0xe'),auth[_0x068f('0x8')](),controller[_0x068f('0xf')]);router['post']('/',auth[_0x068f('0x8')](),controller[_0x068f('0x10')]);router[_0x068f('0x11')](_0x068f('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x068f('0x12')](_0x068f('0x7'),auth['isAuthenticated'](),controller[_0x068f('0x13')]);module[_0x068f('0x14')]=router; \ No newline at end of file +var _0x814a=['get','/:id/preview','preview','run','query','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x814a,0x1ed));var _0xa814=function(_0xccbc60,_0x561e97){_0xccbc60=_0xccbc60-0x0;var _0x49ddbd=_0x814a[_0xccbc60];return _0x49ddbd;};'use strict';var multer=require(_0xa814('0x0'));var util=require(_0xa814('0x1'));var path=require(_0xa814('0x2'));var timeout=require(_0xa814('0x3'));var express=require(_0xa814('0x4'));var router=express[_0xa814('0x5')]();var fs_extra=require(_0xa814('0x6'));var auth=require(_0xa814('0x7'));var interaction=require(_0xa814('0x8'));var config=require(_0xa814('0x9'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xa814('0xa')](),controller['index']);router['get'](_0xa814('0xb'),auth[_0xa814('0xa')](),controller[_0xa814('0xc')]);router[_0xa814('0xd')](_0xa814('0xe'),auth[_0xa814('0xa')](),controller[_0xa814('0xf')]);router[_0xa814('0xd')]('/:id/run',auth[_0xa814('0xa')](),controller[_0xa814('0x10')]);router[_0xa814('0xd')]('/:id/query',auth[_0xa814('0xa')](),controller[_0xa814('0x11')]);router['post']('/',auth[_0xa814('0xa')](),controller[_0xa814('0x12')]);router[_0xa814('0x13')](_0xa814('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa814('0xb'),auth[_0xa814('0xa')](),controller[_0xa814('0x14')]);module[_0xa814('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index d9203ab..69d2a71 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 _0x425d=['sequelize','STRING','TEXT'];(function(_0x1e60bc,_0x45c6c7){var _0x482300=function(_0xf489e9){while(--_0xf489e9){_0x1e60bc['push'](_0x1e60bc['shift']());}};_0x482300(++_0x45c6c7);}(_0x425d,0x1e0));var _0xd425=function(_0x4caf0d,_0x580ea2){_0x4caf0d=_0x4caf0d-0x0;var _0x473297=_0x425d[_0x4caf0d];return _0x473297;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x554047,_0x46ec41){var _0x5d11e4=function(_0x5a026e){while(--_0x5a026e){_0x554047['push'](_0x554047['shift']());}};_0x5d11e4(++_0x46ec41);}(_0xac9d,0x14d));var _0xdac9=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0xac9d[_0x5eff86];return _0x4b3010;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b68b297..e44d511 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xabce[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x546a5c,_0x11e75f){var _0x4dcd36=function(_0x1bead0){while(--_0x1bead0){_0x546a5c['push'](_0x546a5c['shift']());}};_0x4dcd36(++_0x11e75f);}(_0xf494,0x1c6));var _0x4f49=function(_0x33524c,_0x5a3306){_0x33524c=_0x33524c-0x0;var _0x5e2191=_0xf494[_0x33524c];return _0x5e2191;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5ab5d0a..52ce705 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 _0x63c4=['api','moment','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','util','../../config/logger'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x63c4,0x1d4));var _0x463c=function(_0x3a9771,_0x13158c){_0x3a9771=_0x3a9771-0x0;var _0xc5c48c=_0x63c4[_0x3a9771];return _0xc5c48c;};'use strict';var _=require('lodash');var util=require(_0x463c('0x0'));var logger=require(_0x463c('0x1'))(_0x463c('0x2'));var moment=require(_0x463c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x463c('0x4'));var rimraf=require(_0x463c('0x5'));var config=require(_0x463c('0x6'));var attributes=require(_0x463c('0x7'));module[_0x463c('0x8')]=function(_0x2b63ef,_0x87c0c0){return _0x2b63ef[_0x463c('0x9')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x707f=['bluebird','request-promise','path','lodash','api','moment'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x707f,0x13b));var _0xf707=function(_0x3a2aac,_0x52f5f5){_0x3a2aac=_0x3a2aac-0x0;var _0x82cf5a=_0x707f[_0x3a2aac];return _0x82cf5a;};'use strict';var _=require(_0xf707('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf707('0x1'));var moment=require(_0xf707('0x2'));var BPromise=require(_0xf707('0x3'));var rp=require(_0xf707('0x4'));var fs=require('fs');var path=require(_0xf707('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0xbbea1e,_0x5e7126){return _0xbbea1e['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a85e71c..578b687 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 _0x255d=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x2c46a3,_0x451b1e){var _0x1873ad=function(_0x223790){while(--_0x223790){_0x2c46a3['push'](_0x2c46a3['shift']());}};_0x1873ad(++_0x451b1e);}(_0x255d,0x1b2));var _0xd255=function(_0x43d3f7,_0x4d09e3){_0x43d3f7=_0x43d3f7-0x0;var _0x30b013=_0x255d[_0x43d3f7];return _0x30b013;};'use strict';var _=require(_0xd255('0x0'));var util=require(_0xd255('0x1'));var moment=require(_0xd255('0x2'));var BPromise=require(_0xd255('0x3'));var rs=require(_0xd255('0x4'));var fs=require('fs');var Redis=require(_0xd255('0x5'));var db=require(_0xd255('0x6'))['db'];var utils=require(_0xd255('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd255('0x8'));var jayson=require(_0xd255('0x9'));var client=jayson[_0xd255('0xa')][_0xd255('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170fca,_0x597425,_0x445dca){return new BPromise(function(_0x2b066a,_0x1b51c5){return client[_0xd255('0xc')](_0x170fca,_0x445dca)[_0xd255('0xd')](function(_0x368c26){logger[_0xd255('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x597425,'request\x20sent');logger['debug'](_0xd255('0xf'),_0x597425,'request\x20sent',JSON[_0xd255('0x10')](_0x368c26));if(_0x368c26[_0xd255('0x11')]){if(_0x368c26[_0xd255('0x11')][_0xd255('0x12')]===0x1f4){logger[_0xd255('0x11')](_0xd255('0x13'),_0x597425,_0x368c26['error'][_0xd255('0x14')]);return _0x1b51c5(_0x368c26[_0xd255('0x11')]['message']);}logger[_0xd255('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x597425,_0x368c26[_0xd255('0x11')][_0xd255('0x14')]);return _0x2b066a(_0x368c26[_0xd255('0x11')][_0xd255('0x14')]);}else{logger[_0xd255('0xe')](_0xd255('0x13'),_0x597425,_0xd255('0x15'));_0x2b066a(_0x368c26[_0xd255('0x16')]['message']);}})[_0xd255('0x17')](function(_0x35b69d){logger[_0xd255('0x11')](_0xd255('0x13'),_0x597425,_0x35b69d);_0x1b51c5(_0x35b69d);});});} \ No newline at end of file +var _0xe424=['result','catch','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x490448,_0x441693){var _0x489915=function(_0x1d432c){while(--_0x1d432c){_0x490448['push'](_0x490448['shift']());}};_0x489915(++_0x441693);}(_0xe424,0x1a6));var _0x4e42=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xe424[_0x99868f];return _0x27a71b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e42('0x0'));var BPromise=require(_0x4e42('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e42('0x2'));var logger=require(_0x4e42('0x3'))(_0x4e42('0x4'));var config=require('../../config/environment');var jayson=require(_0x4e42('0x5'));var client=jayson[_0x4e42('0x6')][_0x4e42('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29c273,_0x19ca01,_0x13e35a){return new BPromise(function(_0x28ef07,_0x2fdf15){return client[_0x4e42('0x8')](_0x29c273,_0x13e35a)[_0x4e42('0x9')](function(_0x3ff9c0){logger['info'](_0x4e42('0xa'),_0x19ca01,_0x4e42('0xb'));logger['debug'](_0x4e42('0xc'),_0x19ca01,_0x4e42('0xb'),JSON[_0x4e42('0xd')](_0x3ff9c0));if(_0x3ff9c0[_0x4e42('0xe')]){if(_0x3ff9c0[_0x4e42('0xe')][_0x4e42('0xf')]===0x1f4){logger[_0x4e42('0xe')](_0x4e42('0xa'),_0x19ca01,_0x3ff9c0[_0x4e42('0xe')][_0x4e42('0x10')]);return _0x2fdf15(_0x3ff9c0[_0x4e42('0xe')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x19ca01,_0x3ff9c0[_0x4e42('0xe')]['message']);return _0x28ef07(_0x3ff9c0[_0x4e42('0xe')]['message']);}else{logger[_0x4e42('0x11')](_0x4e42('0xa'),_0x19ca01,'request\x20sent');_0x28ef07(_0x3ff9c0[_0x4e42('0x12')][_0x4e42('0x10')]);}})[_0x4e42('0x13')](function(_0x2e8d94){logger['error'](_0x4e42('0xa'),_0x19ca01,_0x2e8d94);_0x2fdf15(_0x2e8d94);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 278a2e1..997d90c 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 _0x4aaa=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','create','put','update','delete','util','path','connect-timeout'];(function(_0x23ee4e,_0x3ace53){var _0x4df269=function(_0x1701c9){while(--_0x1701c9){_0x23ee4e['push'](_0x23ee4e['shift']());}};_0x4df269(++_0x3ace53);}(_0x4aaa,0x7b));var _0xa4aa=function(_0x4d367f,_0x369a96){_0x4d367f=_0x4d367f-0x0;var _0x33e085=_0x4aaa[_0x4d367f];return _0x33e085;};'use strict';var multer=require('multer');var util=require(_0xa4aa('0x0'));var path=require(_0xa4aa('0x1'));var timeout=require(_0xa4aa('0x2'));var express=require(_0xa4aa('0x3'));var router=express[_0xa4aa('0x4')]();var fs_extra=require(_0xa4aa('0x5'));var auth=require(_0xa4aa('0x6'));var interaction=require(_0xa4aa('0x7'));var config=require(_0xa4aa('0x8'));var controller=require(_0xa4aa('0x9'));router[_0xa4aa('0xa')]('/',auth[_0xa4aa('0xb')](),controller[_0xa4aa('0xc')]);router[_0xa4aa('0xa')](_0xa4aa('0xd'),auth[_0xa4aa('0xb')](),controller['show']);router[_0xa4aa('0xa')]('/:id/preview',auth[_0xa4aa('0xb')](),controller[_0xa4aa('0xe')]);router['get'](_0xa4aa('0xf'),auth[_0xa4aa('0xb')](),controller[_0xa4aa('0x10')]);router['get']('/:id/query',auth[_0xa4aa('0xb')](),controller['query']);router['post']('/',auth[_0xa4aa('0xb')](),controller[_0xa4aa('0x11')]);router[_0xa4aa('0x12')](_0xa4aa('0xd'),auth['isAuthenticated'](),controller[_0xa4aa('0x13')]);router[_0xa4aa('0x14')](_0xa4aa('0xd'),auth[_0xa4aa('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x254b=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','/:id/query','create','/:id','update','destroy','exports','multer'];(function(_0x351527,_0x11badf){var _0x2559db=function(_0x2fb56c){while(--_0x2fb56c){_0x351527['push'](_0x351527['shift']());}};_0x2559db(++_0x11badf);}(_0x254b,0x110));var _0xb254=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x254b[_0x258b93];return _0x35484b;};'use strict';var multer=require(_0xb254('0x0'));var util=require(_0xb254('0x1'));var path=require(_0xb254('0x2'));var timeout=require(_0xb254('0x3'));var express=require(_0xb254('0x4'));var router=express['Router']();var fs_extra=require(_0xb254('0x5'));var auth=require(_0xb254('0x6'));var interaction=require(_0xb254('0x7'));var config=require(_0xb254('0x8'));var controller=require(_0xb254('0x9'));router['get']('/',auth[_0xb254('0xa')](),controller['index']);router[_0xb254('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb254('0xc')]);router[_0xb254('0xb')](_0xb254('0xd'),auth[_0xb254('0xa')](),controller['preview']);router['get'](_0xb254('0xe'),auth['isAuthenticated'](),controller['run']);router[_0xb254('0xb')](_0xb254('0xf'),auth[_0xb254('0xa')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0xb254('0x10')]);router['put'](_0xb254('0x11'),auth[_0xb254('0xa')](),controller[_0xb254('0x12')]);router['delete'](_0xb254('0x11'),auth['isAuthenticated'](),controller[_0xb254('0x13')]);module[_0xb254('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7e5fbe1..448d0c1 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 _0x46a9=['csv','pdf','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x46a9,0x19d));var _0x946a=function(_0x568d1a,_0x4cfc6a){_0x568d1a=_0x568d1a-0x0;var _0x505881=_0x46a9[_0x568d1a];return _0x505881;};'use strict';var Sequelize=require(_0x946a('0x0'));var moment=require(_0x946a('0x1'));module[_0x946a('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x946a('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x946a('0x4')](_0x946a('0x5'),_0x946a('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x946a('0x5')},'savename':{'type':Sequelize[_0x946a('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x946a('0x7')]},'endDate':{'type':Sequelize[_0x946a('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x946a('0x8')},'type':{'type':Sequelize['ENUM'](_0x946a('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x946a('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x946a('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x933a=['csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x933a,0xa4));var _0xa933=function(_0x9878cf,_0x146bfa){_0x9878cf=_0x9878cf-0x0;var _0x2b76d7=_0x933a[_0x9878cf];return _0x2b76d7;};'use strict';var Sequelize=require(_0xa933('0x0'));var moment=require(_0xa933('0x1'));module[_0xa933('0x2')]={'name':{'type':Sequelize[_0xa933('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xa933('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa933('0x4')](_0xa933('0x5'),_0xa933('0x6'),_0xa933('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa933('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa933('0x8')]},'endDate':{'type':Sequelize[_0xa933('0x8')]},'status':{'type':Sequelize[_0xa933('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xa933('0x4')](_0xa933('0x9'),_0xa933('0xa')),'allowNull':![],'defaultValue':_0xa933('0x9')},'reportId':{'type':Sequelize[_0xa933('0xb')](0xb)[_0xa933('0xc')]},'reportType':{'type':Sequelize[_0xa933('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 44d6cd4..c3b967c 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 _0x6d96=['then','get','ExtractedReports','UserProfileResource','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','params','basename','savename','output','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','destroy'];(function(_0x29e079,_0x3e1be0){var _0x4fdaca=function(_0x546360){while(--_0x546360){_0x29e079['push'](_0x29e079['shift']());}};_0x4fdaca(++_0x3e1be0);}(_0x6d96,0xeb));var _0x66d9=function(_0x4c38b2,_0x226268){_0x4c38b2=_0x4c38b2-0x0;var _0x598ad5=_0x6d96[_0x4c38b2];return _0x598ad5;};'use strict';var emlformat=require(_0x66d9('0x0'));var rimraf=require(_0x66d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66d9('0x2'));var rp=require(_0x66d9('0x3'));var moment=require('moment');var BPromise=require(_0x66d9('0x4'));var Mustache=require(_0x66d9('0x5'));var util=require('util');var path=require(_0x66d9('0x6'));var sox=require('sox');var csv=require(_0x66d9('0x7'));var ejs=require(_0x66d9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66d9('0x9'));var squel=require(_0x66d9('0xa'));var crypto=require(_0x66d9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66d9('0x7'));var querystring=require(_0x66d9('0xc'));var Papa=require(_0x66d9('0xd'));var Redis=require(_0x66d9('0xe'));var authService=require(_0x66d9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66d9('0x10'));var logger=require(_0x66d9('0x11'))(_0x66d9('0x12'));var utils=require(_0x66d9('0x13'));var config=require(_0x66d9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x66d9('0x15'))['db'];function respondWithStatusCode(_0x291fdc,_0x38dc84){_0x38dc84=_0x38dc84||0xcc;return function(_0x5ac72b){if(_0x5ac72b){return _0x291fdc[_0x66d9('0x16')](_0x38dc84);}return _0x291fdc['status'](_0x38dc84)[_0x66d9('0x17')]();};}function respondWithResult(_0x44c24a,_0x278109){_0x278109=_0x278109||0xc8;return function(_0x54b6bd){if(_0x54b6bd){return _0x44c24a[_0x66d9('0x18')](_0x278109)[_0x66d9('0x19')](_0x54b6bd);}};}function respondWithFilteredResult(_0x4d12d7,_0x28c8cd){return function(_0x137da4){if(_0x137da4){var _0x5ceb0a=typeof _0x28c8cd['offset']==='undefined'&&typeof _0x28c8cd[_0x66d9('0x1a')]==='undefined';var _0x160d17=_0x137da4[_0x66d9('0x1b')];var _0x1c7922=_0x5ceb0a?0x0:_0x28c8cd['offset'];var _0x401768=_0x5ceb0a?_0x137da4[_0x66d9('0x1b')]:_0x28c8cd[_0x66d9('0x1c')]+_0x28c8cd[_0x66d9('0x1a')];var _0x218696;if(_0x401768>=_0x160d17){_0x401768=_0x160d17;_0x218696=0xc8;}else{_0x218696=0xce;}_0x4d12d7[_0x66d9('0x18')](_0x218696);return _0x4d12d7[_0x66d9('0x1d')](_0x66d9('0x1e'),_0x1c7922+'-'+_0x401768+'/'+_0x160d17)[_0x66d9('0x19')](_0x137da4);}return null;};}function patchUpdates(_0x17c995){return function(_0x2651e6){try{jsonpatch[_0x66d9('0x1f')](_0x2651e6,_0x17c995,!![]);}catch(_0x239599){return BPromise['reject'](_0x239599);}return _0x2651e6[_0x66d9('0x20')]();};}function saveUpdates(_0x314cf8,_0x4f4157){return function(_0x519a03){if(_0x519a03){return _0x519a03[_0x66d9('0x21')](_0x314cf8)['then'](function(_0x304bf0){return _0x304bf0;});}return null;};}function removeEntity(_0x182625,_0x737f2d){return function(_0x34a706){if(_0x34a706){return _0x34a706[_0x66d9('0x22')]()[_0x66d9('0x23')](function(){var _0x33263e=_0x34a706[_0x66d9('0x24')]({'plain':!![]});var _0x55c096=_0x66d9('0x25');return db[_0x66d9('0x26')][_0x66d9('0x22')]({'where':{'type':_0x55c096,'resourceId':_0x33263e['id']}})[_0x66d9('0x23')](function(){return _0x34a706;});})[_0x66d9('0x23')](function(){_0x182625['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f6a1,_0x23a11f){return function(_0x470e68){if(!_0x470e68){_0x42f6a1[_0x66d9('0x16')](0x194);}return _0x470e68;};}function handleError(_0x26e01c,_0x26c5ac){_0x26c5ac=_0x26c5ac||0x1f4;return function(_0x5077c4){logger['error'](_0x5077c4[_0x66d9('0x27')]);if(_0x5077c4[_0x66d9('0x28')]){delete _0x5077c4[_0x66d9('0x28')];}_0x26e01c['status'](_0x26c5ac)[_0x66d9('0x29')](_0x5077c4);};}exports['index']=function(_0x31ce1a,_0x5611cf){var _0x715709={},_0x1a4787={},_0x277c81={'count':0x0,'rows':[]};var _0x2e7710=_[_0x66d9('0x2a')](db['AnalyticExtractedReport'][_0x66d9('0x2b')],function(_0x4d6f41){return{'name':_0x4d6f41['fieldName'],'type':_0x4d6f41[_0x66d9('0x2c')][_0x66d9('0x2d')]};});_0x1a4787[_0x66d9('0x2e')]=_['map'](_0x2e7710,_0x66d9('0x28'));_0x1a4787[_0x66d9('0x2f')]=_['keys'](_0x31ce1a[_0x66d9('0x2f')]);_0x1a4787[_0x66d9('0x30')]=_[_0x66d9('0x31')](_0x1a4787[_0x66d9('0x2e')],_0x1a4787[_0x66d9('0x2f')]);_0x715709[_0x66d9('0x32')]=_[_0x66d9('0x31')](_0x1a4787[_0x66d9('0x2e')],qs[_0x66d9('0x33')](_0x31ce1a[_0x66d9('0x2f')]['fields']));_0x715709[_0x66d9('0x32')]=_0x715709['attributes'][_0x66d9('0x34')]?_0x715709[_0x66d9('0x32')]:_0x1a4787[_0x66d9('0x2e')];if(!_0x31ce1a[_0x66d9('0x2f')][_0x66d9('0x35')](_0x66d9('0x36'))){_0x715709[_0x66d9('0x1a')]=qs[_0x66d9('0x1a')](_0x31ce1a[_0x66d9('0x2f')][_0x66d9('0x1a')]);_0x715709['offset']=qs[_0x66d9('0x1c')](_0x31ce1a[_0x66d9('0x2f')]['offset']);}_0x715709['order']=qs[_0x66d9('0x37')](_0x31ce1a['query']['sort']);_0x715709[_0x66d9('0x38')]=qs[_0x66d9('0x30')](_[_0x66d9('0x39')](_0x31ce1a[_0x66d9('0x2f')],_0x1a4787['filters']),_0x2e7710);if(_0x31ce1a[_0x66d9('0x2f')][_0x66d9('0x3a')]){_0x715709[_0x66d9('0x38')]=_[_0x66d9('0x3b')](_0x715709[_0x66d9('0x38')],{'$or':_[_0x66d9('0x2a')](_0x2e7710,function(_0x58d481){if(_0x58d481['type']!==_0x66d9('0x3c')){var _0x216f20={};_0x216f20[_0x58d481[_0x66d9('0x28')]]={'$like':'%'+_0x31ce1a['query'][_0x66d9('0x3a')]+'%'};return _0x216f20;}})});}_0x715709=_[_0x66d9('0x3b')]({},_0x715709,_0x31ce1a[_0x66d9('0x3d')]);var _0x16ce14={'where':_0x715709[_0x66d9('0x38')]};return db[_0x66d9('0x3e')][_0x66d9('0x1b')](_0x16ce14)[_0x66d9('0x23')](function(_0x53ffc7){_0x277c81[_0x66d9('0x1b')]=_0x53ffc7;if(_0x31ce1a[_0x66d9('0x2f')][_0x66d9('0x3f')]){_0x715709[_0x66d9('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x715709);})[_0x66d9('0x23')](function(_0xf4e2e6){_0x277c81['rows']=_0xf4e2e6;return _0x277c81;})[_0x66d9('0x23')](respondWithFilteredResult(_0x5611cf,_0x715709))[_0x66d9('0x41')](handleError(_0x5611cf,null));};exports[_0x66d9('0x42')]=function(_0x546e44,_0x1da7b6){var _0x5b6dbd={'raw':!![],'where':{'id':_0x546e44['params']['id']}},_0x49fe80={};_0x49fe80[_0x66d9('0x2e')]=_[_0x66d9('0x43')](db[_0x66d9('0x3e')][_0x66d9('0x2b')]);_0x49fe80['query']=_['keys'](_0x546e44[_0x66d9('0x2f')]);_0x49fe80[_0x66d9('0x30')]=_[_0x66d9('0x31')](_0x49fe80[_0x66d9('0x2e')],_0x49fe80[_0x66d9('0x2f')]);_0x5b6dbd['attributes']=_[_0x66d9('0x31')](_0x49fe80[_0x66d9('0x2e')],qs['fields'](_0x546e44[_0x66d9('0x2f')]['fields']));_0x5b6dbd[_0x66d9('0x32')]=_0x5b6dbd[_0x66d9('0x32')][_0x66d9('0x34')]?_0x5b6dbd['attributes']:_0x49fe80[_0x66d9('0x2e')];if(_0x546e44[_0x66d9('0x2f')][_0x66d9('0x3f')]){_0x5b6dbd['include']=[{'all':!![]}];}_0x5b6dbd=_['merge']({},_0x5b6dbd,_0x546e44['options']);return db['AnalyticExtractedReport'][_0x66d9('0x44')](_0x5b6dbd)[_0x66d9('0x23')](handleEntityNotFound(_0x1da7b6,null))['then'](respondWithResult(_0x1da7b6,null))[_0x66d9('0x41')](handleError(_0x1da7b6,null));};exports[_0x66d9('0x45')]=function(_0x12a3f9,_0x3b93f7){return db['AnalyticExtractedReport']['create'](_0x12a3f9[_0x66d9('0x46')],{})[_0x66d9('0x23')](function(_0x26f8c6){var _0x4be03e=_0x12a3f9[_0x66d9('0x47')][_0x66d9('0x24')]({'plain':!![]});if(!_0x4be03e)throw new Error(_0x66d9('0x48'));if(_0x4be03e[_0x66d9('0x49')]===_0x66d9('0x47')){var _0x25ae47=_0x26f8c6[_0x66d9('0x24')]({'plain':!![]});var _0x4fa068='ExtractedReports';return db['UserProfileSection'][_0x66d9('0x44')]({'where':{'name':_0x4fa068,'userProfileId':_0x4be03e[_0x66d9('0x4a')]},'raw':!![]})[_0x66d9('0x23')](function(_0x153c04){if(_0x153c04&&_0x153c04['autoAssociation']===0x0){return db[_0x66d9('0x26')][_0x66d9('0x45')]({'name':_0x25ae47[_0x66d9('0x28')],'resourceId':_0x25ae47['id'],'type':_0x153c04[_0x66d9('0x28')],'sectionId':_0x153c04['id']},{})[_0x66d9('0x23')](function(){return _0x26f8c6;});}else{return _0x26f8c6;}})['catch'](function(_0x3d5c9f){logger[_0x66d9('0x4b')](_0x66d9('0x4c'),_0x3d5c9f);throw _0x3d5c9f;});}return _0x26f8c6;})[_0x66d9('0x23')](respondWithResult(_0x3b93f7,0xc9))[_0x66d9('0x41')](handleError(_0x3b93f7,null));};exports[_0x66d9('0x21')]=function(_0x9bf4e3,_0x16cc5d){if(_0x9bf4e3[_0x66d9('0x46')]['id']){delete _0x9bf4e3[_0x66d9('0x46')]['id'];}return db['AnalyticExtractedReport'][_0x66d9('0x44')]({'where':{'id':_0x9bf4e3['params']['id']}})[_0x66d9('0x23')](handleEntityNotFound(_0x16cc5d,null))[_0x66d9('0x23')](saveUpdates(_0x9bf4e3[_0x66d9('0x46')],null))[_0x66d9('0x23')](respondWithResult(_0x16cc5d,null))[_0x66d9('0x41')](handleError(_0x16cc5d,null));};exports[_0x66d9('0x22')]=function(_0x427e64,_0x3477dd){return db[_0x66d9('0x3e')][_0x66d9('0x44')]({'where':{'id':_0x427e64['params']['id']}})[_0x66d9('0x23')](handleEntityNotFound(_0x3477dd,null))['then'](removeEntity(_0x3477dd,null))['catch'](handleError(_0x3477dd,null));};exports[_0x66d9('0x4d')]=function(_0x1b0481,_0x33a16c,_0x520ad2){return db[_0x66d9('0x3e')][_0x66d9('0x44')]({'where':{'id':_0x1b0481[_0x66d9('0x4e')]['id']},'attributes':[_0x66d9('0x28'),_0x66d9('0x4f'),_0x66d9('0x50'),_0x66d9('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x33a16c,null))[_0x66d9('0x23')](function(_0x1bb8f3){if(_0x1bb8f3){if(!fs['existsSync'](path[_0x66d9('0x52')](config[_0x66d9('0x53')],_0x66d9('0x54'),_0x1bb8f3[_0x66d9('0x50')]))){throw new db[(_0x66d9('0x55'))]['ValidationError'](_0x66d9('0x56'));}if(_0x1b0481[_0x66d9('0x2f')][_0x66d9('0x57')]){return _0x33a16c[_0x66d9('0x16')](0xc8);}return _0x33a16c[_0x66d9('0x4d')](path[_0x66d9('0x52')](config['root'],_0x66d9('0x54'),_0x1bb8f3['savename']),util[_0x66d9('0x58')]('%s.%s',_0x1bb8f3['basename']||_0x1bb8f3[_0x66d9('0x28')],_0x1bb8f3[_0x66d9('0x51')][_0x66d9('0x59')]()));}})[_0x66d9('0x41')](handleError(_0x33a16c,null));}; \ No newline at end of file +var _0xac9a=['existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','output','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','AnalyticExtractedReport','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','download','basename','savename'];(function(_0x44f0e9,_0x3cf7cc){var _0x4772f4=function(_0x155661){while(--_0x155661){_0x44f0e9['push'](_0x44f0e9['shift']());}};_0x4772f4(++_0x3cf7cc);}(_0xac9a,0x6a));var _0xaac9=function(_0x23704b,_0x78d88){_0x23704b=_0x23704b-0x0;var _0xe107a=_0xac9a[_0x23704b];return _0xe107a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaac9('0x0'));var jsonpatch=require(_0xaac9('0x1'));var rp=require(_0xaac9('0x2'));var moment=require(_0xaac9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaac9('0x4'));var util=require(_0xaac9('0x5'));var path=require(_0xaac9('0x6'));var sox=require(_0xaac9('0x7'));var csv=require(_0xaac9('0x8'));var ejs=require(_0xaac9('0x9'));var fs=require('fs');var fs_extra=require(_0xaac9('0xa'));var _=require(_0xaac9('0xb'));var squel=require(_0xaac9('0xc'));var crypto=require(_0xaac9('0xd'));var jsforce=require(_0xaac9('0xe'));var deskjs=require(_0xaac9('0xf'));var toCsv=require(_0xaac9('0x8'));var querystring=require(_0xaac9('0x10'));var Papa=require(_0xaac9('0x11'));var Redis=require(_0xaac9('0x12'));var authService=require(_0xaac9('0x13'));var qs=require(_0xaac9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaac9('0x15'));var logger=require(_0xaac9('0x16'))(_0xaac9('0x17'));var utils=require(_0xaac9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaac9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5922df,_0x3a4f0a){_0x3a4f0a=_0x3a4f0a||0xcc;return function(_0x7d607f){if(_0x7d607f){return _0x5922df[_0xaac9('0x1a')](_0x3a4f0a);}return _0x5922df[_0xaac9('0x1b')](_0x3a4f0a)[_0xaac9('0x1c')]();};}function respondWithResult(_0x87af39,_0x291450){_0x291450=_0x291450||0xc8;return function(_0x13fed3){if(_0x13fed3){return _0x87af39[_0xaac9('0x1b')](_0x291450)[_0xaac9('0x1d')](_0x13fed3);}};}function respondWithFilteredResult(_0x287be7,_0x2d4633){return function(_0x63abfd){if(_0x63abfd){var _0x531bff=typeof _0x2d4633[_0xaac9('0x1e')]===_0xaac9('0x1f')&&typeof _0x2d4633[_0xaac9('0x20')]===_0xaac9('0x1f');var _0x42836f=_0x63abfd[_0xaac9('0x21')];var _0x466831=_0x531bff?0x0:_0x2d4633[_0xaac9('0x1e')];var _0x4ff954=_0x531bff?_0x63abfd['count']:_0x2d4633[_0xaac9('0x1e')]+_0x2d4633[_0xaac9('0x20')];var _0x50100e;if(_0x4ff954>=_0x42836f){_0x4ff954=_0x42836f;_0x50100e=0xc8;}else{_0x50100e=0xce;}_0x287be7[_0xaac9('0x1b')](_0x50100e);return _0x287be7[_0xaac9('0x22')](_0xaac9('0x23'),_0x466831+'-'+_0x4ff954+'/'+_0x42836f)[_0xaac9('0x1d')](_0x63abfd);}return null;};}function patchUpdates(_0x3286b4){return function(_0xcbf33a){try{jsonpatch[_0xaac9('0x24')](_0xcbf33a,_0x3286b4,!![]);}catch(_0x3e232e){return BPromise[_0xaac9('0x25')](_0x3e232e);}return _0xcbf33a[_0xaac9('0x26')]();};}function saveUpdates(_0x44913a,_0x3a09a2){return function(_0x56249c){if(_0x56249c){return _0x56249c[_0xaac9('0x27')](_0x44913a)[_0xaac9('0x28')](function(_0x4e9bf2){return _0x4e9bf2;});}return null;};}function removeEntity(_0xc647ba,_0x341486){return function(_0x10b1a8){if(_0x10b1a8){return _0x10b1a8['destroy']()[_0xaac9('0x28')](function(){var _0x14a49e=_0x10b1a8[_0xaac9('0x29')]({'plain':!![]});var _0x2428c='ExtractedReports';return db[_0xaac9('0x2a')][_0xaac9('0x2b')]({'where':{'type':_0x2428c,'resourceId':_0x14a49e['id']}})[_0xaac9('0x28')](function(){return _0x10b1a8;});})['then'](function(){_0xc647ba[_0xaac9('0x1b')](0xcc)[_0xaac9('0x1c')]();});}};}function handleEntityNotFound(_0x1f5b29,_0x510dbb){return function(_0x2333d1){if(!_0x2333d1){_0x1f5b29[_0xaac9('0x1a')](0x194);}return _0x2333d1;};}function handleError(_0x49d95c,_0x5e0c0a){_0x5e0c0a=_0x5e0c0a||0x1f4;return function(_0x2d725f){logger[_0xaac9('0x2c')](_0x2d725f[_0xaac9('0x2d')]);if(_0x2d725f[_0xaac9('0x2e')]){delete _0x2d725f['name'];}_0x49d95c[_0xaac9('0x1b')](_0x5e0c0a)[_0xaac9('0x2f')](_0x2d725f);};}exports['index']=function(_0x475db7,_0x49e0ef){var _0x35a4cd={},_0x5c1dfd={},_0x32995f={'count':0x0,'rows':[]};var _0x9902b7=_[_0xaac9('0x30')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x5798f3){return{'name':_0x5798f3['fieldName'],'type':_0x5798f3[_0xaac9('0x31')][_0xaac9('0x32')]};});_0x5c1dfd[_0xaac9('0x33')]=_['map'](_0x9902b7,'name');_0x5c1dfd[_0xaac9('0x34')]=_['keys'](_0x475db7[_0xaac9('0x34')]);_0x5c1dfd[_0xaac9('0x35')]=_[_0xaac9('0x36')](_0x5c1dfd[_0xaac9('0x33')],_0x5c1dfd[_0xaac9('0x34')]);_0x35a4cd[_0xaac9('0x37')]=_[_0xaac9('0x36')](_0x5c1dfd[_0xaac9('0x33')],qs['fields'](_0x475db7[_0xaac9('0x34')][_0xaac9('0x38')]));_0x35a4cd[_0xaac9('0x37')]=_0x35a4cd[_0xaac9('0x37')][_0xaac9('0x39')]?_0x35a4cd['attributes']:_0x5c1dfd[_0xaac9('0x33')];if(!_0x475db7[_0xaac9('0x34')][_0xaac9('0x3a')](_0xaac9('0x3b'))){_0x35a4cd[_0xaac9('0x20')]=qs[_0xaac9('0x20')](_0x475db7[_0xaac9('0x34')][_0xaac9('0x20')]);_0x35a4cd[_0xaac9('0x1e')]=qs[_0xaac9('0x1e')](_0x475db7['query']['offset']);}_0x35a4cd['order']=qs[_0xaac9('0x3c')](_0x475db7[_0xaac9('0x34')][_0xaac9('0x3c')]);_0x35a4cd[_0xaac9('0x3d')]=qs[_0xaac9('0x35')](_[_0xaac9('0x3e')](_0x475db7['query'],_0x5c1dfd[_0xaac9('0x35')]),_0x9902b7);if(_0x475db7['query'][_0xaac9('0x3f')]){_0x35a4cd[_0xaac9('0x3d')]=_[_0xaac9('0x40')](_0x35a4cd[_0xaac9('0x3d')],{'$or':_[_0xaac9('0x30')](_0x9902b7,function(_0x3694d7){if(_0x3694d7[_0xaac9('0x31')]!==_0xaac9('0x41')){var _0xedf049={};_0xedf049[_0x3694d7[_0xaac9('0x2e')]]={'$like':'%'+_0x475db7['query'][_0xaac9('0x3f')]+'%'};return _0xedf049;}})});}_0x35a4cd=_['merge']({},_0x35a4cd,_0x475db7['options']);var _0x3dd056={'where':_0x35a4cd[_0xaac9('0x3d')]};return db['AnalyticExtractedReport']['count'](_0x3dd056)['then'](function(_0x2ea24c){_0x32995f[_0xaac9('0x21')]=_0x2ea24c;if(_0x475db7[_0xaac9('0x34')]['includeAll']){_0x35a4cd[_0xaac9('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xaac9('0x43')](_0x35a4cd);})[_0xaac9('0x28')](function(_0x20d75d){_0x32995f[_0xaac9('0x44')]=_0x20d75d;return _0x32995f;})[_0xaac9('0x28')](respondWithFilteredResult(_0x49e0ef,_0x35a4cd))[_0xaac9('0x45')](handleError(_0x49e0ef,null));};exports[_0xaac9('0x46')]=function(_0x5ab3af,_0x226bc2){var _0x370ee3={'raw':!![],'where':{'id':_0x5ab3af[_0xaac9('0x47')]['id']}},_0x3fe401={};_0x3fe401[_0xaac9('0x33')]=_[_0xaac9('0x48')](db[_0xaac9('0x49')]['rawAttributes']);_0x3fe401[_0xaac9('0x34')]=_[_0xaac9('0x48')](_0x5ab3af[_0xaac9('0x34')]);_0x3fe401[_0xaac9('0x35')]=_[_0xaac9('0x36')](_0x3fe401[_0xaac9('0x33')],_0x3fe401[_0xaac9('0x34')]);_0x370ee3['attributes']=_[_0xaac9('0x36')](_0x3fe401[_0xaac9('0x33')],qs[_0xaac9('0x38')](_0x5ab3af[_0xaac9('0x34')][_0xaac9('0x38')]));_0x370ee3['attributes']=_0x370ee3[_0xaac9('0x37')][_0xaac9('0x39')]?_0x370ee3[_0xaac9('0x37')]:_0x3fe401[_0xaac9('0x33')];if(_0x5ab3af['query'][_0xaac9('0x4a')]){_0x370ee3[_0xaac9('0x42')]=[{'all':!![]}];}_0x370ee3=_[_0xaac9('0x40')]({},_0x370ee3,_0x5ab3af['options']);return db['AnalyticExtractedReport'][_0xaac9('0x4b')](_0x370ee3)[_0xaac9('0x28')](handleEntityNotFound(_0x226bc2,null))[_0xaac9('0x28')](respondWithResult(_0x226bc2,null))[_0xaac9('0x45')](handleError(_0x226bc2,null));};exports[_0xaac9('0x4c')]=function(_0x4dd04c,_0x3b69d0){return db[_0xaac9('0x49')][_0xaac9('0x4c')](_0x4dd04c[_0xaac9('0x4d')],{})[_0xaac9('0x28')](function(_0x3a7022){var _0xed54b9=_0x4dd04c[_0xaac9('0x4e')][_0xaac9('0x29')]({'plain':!![]});if(!_0xed54b9)throw new Error(_0xaac9('0x4f'));if(_0xed54b9[_0xaac9('0x50')]===_0xaac9('0x4e')){var _0x1ff258=_0x3a7022['get']({'plain':!![]});var _0x1a2461=_0xaac9('0x51');return db[_0xaac9('0x52')][_0xaac9('0x4b')]({'where':{'name':_0x1a2461,'userProfileId':_0xed54b9[_0xaac9('0x53')]},'raw':!![]})['then'](function(_0x1f0e07){if(_0x1f0e07&&_0x1f0e07[_0xaac9('0x54')]===0x0){return db[_0xaac9('0x2a')]['create']({'name':_0x1ff258[_0xaac9('0x2e')],'resourceId':_0x1ff258['id'],'type':_0x1f0e07['name'],'sectionId':_0x1f0e07['id']},{})[_0xaac9('0x28')](function(){return _0x3a7022;});}else{return _0x3a7022;}})[_0xaac9('0x45')](function(_0x3dd78c){logger[_0xaac9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd78c);throw _0x3dd78c;});}return _0x3a7022;})[_0xaac9('0x28')](respondWithResult(_0x3b69d0,0xc9))[_0xaac9('0x45')](handleError(_0x3b69d0,null));};exports['update']=function(_0xbd6bd4,_0x516b61){if(_0xbd6bd4[_0xaac9('0x4d')]['id']){delete _0xbd6bd4[_0xaac9('0x4d')]['id'];}return db[_0xaac9('0x49')][_0xaac9('0x4b')]({'where':{'id':_0xbd6bd4[_0xaac9('0x47')]['id']}})['then'](handleEntityNotFound(_0x516b61,null))['then'](saveUpdates(_0xbd6bd4[_0xaac9('0x4d')],null))['then'](respondWithResult(_0x516b61,null))[_0xaac9('0x45')](handleError(_0x516b61,null));};exports[_0xaac9('0x2b')]=function(_0x38abad,_0x3e4594){return db[_0xaac9('0x49')][_0xaac9('0x4b')]({'where':{'id':_0x38abad[_0xaac9('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e4594,null))[_0xaac9('0x28')](removeEntity(_0x3e4594,null))['catch'](handleError(_0x3e4594,null));};exports[_0xaac9('0x55')]=function(_0x1a07a0,_0x40a4be,_0x34cecd){return db['AnalyticExtractedReport'][_0xaac9('0x4b')]({'where':{'id':_0x1a07a0['params']['id']},'attributes':[_0xaac9('0x2e'),_0xaac9('0x56'),_0xaac9('0x57'),'output'],'raw':!![]})[_0xaac9('0x28')](handleEntityNotFound(_0x40a4be,null))[_0xaac9('0x28')](function(_0x4860f4){if(_0x4860f4){if(!fs[_0xaac9('0x58')](path[_0xaac9('0x59')](config[_0xaac9('0x5a')],'server/files/reports',_0x4860f4[_0xaac9('0x57')]))){throw new db['Sequelize'][(_0xaac9('0x5b'))](_0xaac9('0x5c'));}if(_0x1a07a0[_0xaac9('0x34')]['exists']){return _0x40a4be['sendStatus'](0xc8);}return _0x40a4be[_0xaac9('0x55')](path[_0xaac9('0x59')](config[_0xaac9('0x5a')],_0xaac9('0x5d'),_0x4860f4[_0xaac9('0x57')]),util[_0xaac9('0x5e')](_0xaac9('0x5f'),_0x4860f4['basename']||_0x4860f4[_0xaac9('0x2e')],_0x4860f4[_0xaac9('0x60')]['toLowerCase']()));}})[_0xaac9('0x45')](handleError(_0x40a4be,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e2cd354..8f35328 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 _0x99e8=['analytics_extracted_reports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x99e8,0x12d));var _0x899e=function(_0x1133b7,_0x4ef9fe){_0x1133b7=_0x1133b7-0x0;var _0x113492=_0x99e8[_0x1133b7];return _0x113492;};'use strict';var _=require(_0x899e('0x0'));var util=require(_0x899e('0x1'));var logger=require('../../config/logger')(_0x899e('0x2'));var moment=require(_0x899e('0x3'));var BPromise=require('bluebird');var rp=require(_0x899e('0x4'));var fs=require('fs');var path=require(_0x899e('0x5'));var rimraf=require(_0x899e('0x6'));var config=require(_0x899e('0x7'));var attributes=require(_0x899e('0x8'));module['exports']=function(_0x4b0b6a,_0x30f585){return _0x4b0b6a[_0x899e('0x9')](_0x899e('0xa'),attributes,{'tableName':_0x899e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a0=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x1a8d8c,_0x44611d){var _0x23273e=function(_0x1fa0ef){while(--_0x1fa0ef){_0x1a8d8c['push'](_0x1a8d8c['shift']());}};_0x23273e(++_0x44611d);}(_0x17a0,0x15e));var _0x017a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x017a('0x0'))(_0x017a('0x1'));var moment=require(_0x017a('0x2'));var BPromise=require('bluebird');var rp=require(_0x017a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x017a('0x4'));var config=require(_0x017a('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0x017a('0x6')]=function(_0x5e63af,_0x165f64){return _0x5e63af[_0x017a('0x7')](_0x017a('0x8'),attributes,{'tableName':_0x017a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 655bac0..474988e 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 _0xae77=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xae77,0x15d));var _0x7ae7=function(_0x57f8fe,_0x212583){_0x57f8fe=_0x57f8fe-0x0;var _0x109371=_0xae77[_0x57f8fe];return _0x109371;};'use strict';var _=require('lodash');var util=require(_0x7ae7('0x0'));var moment=require(_0x7ae7('0x1'));var BPromise=require(_0x7ae7('0x2'));var rs=require(_0x7ae7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ae7('0x4'))['db'];var utils=require(_0x7ae7('0x5'));var logger=require(_0x7ae7('0x6'))(_0x7ae7('0x7'));var config=require(_0x7ae7('0x8'));var jayson=require(_0x7ae7('0x9'));var client=jayson[_0x7ae7('0xa')][_0x7ae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40c637,_0x5e199e,_0x32703d){return new BPromise(function(_0x567fe,_0x3ba56a){return client['request'](_0x40c637,_0x32703d)[_0x7ae7('0xc')](function(_0x2b5282){logger['info'](_0x7ae7('0xd'),_0x5e199e,_0x7ae7('0xe'));logger[_0x7ae7('0xf')](_0x7ae7('0x10'),_0x5e199e,_0x7ae7('0xe'),JSON['stringify'](_0x2b5282));if(_0x2b5282[_0x7ae7('0x11')]){if(_0x2b5282[_0x7ae7('0x11')][_0x7ae7('0x12')]===0x1f4){logger[_0x7ae7('0x11')](_0x7ae7('0xd'),_0x5e199e,_0x2b5282['error'][_0x7ae7('0x13')]);return _0x3ba56a(_0x2b5282[_0x7ae7('0x11')]['message']);}logger[_0x7ae7('0x11')](_0x7ae7('0xd'),_0x5e199e,_0x2b5282[_0x7ae7('0x11')]['message']);return _0x567fe(_0x2b5282['error'][_0x7ae7('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5e199e,_0x7ae7('0xe'));_0x567fe(_0x2b5282[_0x7ae7('0x14')][_0x7ae7('0x13')]);}})[_0x7ae7('0x15')](function(_0x35f887){logger[_0x7ae7('0x11')](_0x7ae7('0xd'),_0x5e199e,_0x35f887);_0x3ba56a(_0x35f887);});});} \ No newline at end of file +var _0x9bca=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0x9bca,0x8c));var _0xa9bc=function(_0x1fb21d,_0x2aa281){_0x1fb21d=_0x1fb21d-0x0;var _0x3109d8=_0x9bca[_0x1fb21d];return _0x3109d8;};'use strict';var _=require(_0xa9bc('0x0'));var util=require(_0xa9bc('0x1'));var moment=require(_0xa9bc('0x2'));var BPromise=require(_0xa9bc('0x3'));var rs=require(_0xa9bc('0x4'));var fs=require('fs');var Redis=require(_0xa9bc('0x5'));var db=require(_0xa9bc('0x6'))['db'];var utils=require(_0xa9bc('0x7'));var logger=require(_0xa9bc('0x8'))(_0xa9bc('0x9'));var config=require(_0xa9bc('0xa'));var jayson=require(_0xa9bc('0xb'));var client=jayson[_0xa9bc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40bf7a,_0x365479,_0x4790ce){return new BPromise(function(_0x2e2eef,_0x59a8fc){return client[_0xa9bc('0xd')](_0x40bf7a,_0x4790ce)[_0xa9bc('0xe')](function(_0x3becec){logger['info'](_0xa9bc('0xf'),_0x365479,'request\x20sent');logger['debug'](_0xa9bc('0x10'),_0x365479,_0xa9bc('0x11'),JSON[_0xa9bc('0x12')](_0x3becec));if(_0x3becec[_0xa9bc('0x13')]){if(_0x3becec[_0xa9bc('0x13')][_0xa9bc('0x14')]===0x1f4){logger[_0xa9bc('0x13')](_0xa9bc('0xf'),_0x365479,_0x3becec['error'][_0xa9bc('0x15')]);return _0x59a8fc(_0x3becec[_0xa9bc('0x13')][_0xa9bc('0x15')]);}logger['error'](_0xa9bc('0xf'),_0x365479,_0x3becec[_0xa9bc('0x13')]['message']);return _0x2e2eef(_0x3becec['error'][_0xa9bc('0x15')]);}else{logger[_0xa9bc('0x16')](_0xa9bc('0xf'),_0x365479,_0xa9bc('0x11'));_0x2e2eef(_0x3becec[_0xa9bc('0x17')][_0xa9bc('0x15')]);}})['catch'](function(_0x33080a){logger[_0xa9bc('0x13')](_0xa9bc('0xf'),_0x365479,_0x33080a);_0x59a8fc(_0x33080a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e944d73..60a95f5 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 _0xe14e=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/download','download','post','create','put','/:id','update','delete','destroy'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0xe14e,0x141));var _0xee14=function(_0x3f2022,_0x18767d){_0x3f2022=_0x3f2022-0x0;var _0x3c3fff=_0xe14e[_0x3f2022];return _0x3c3fff;};'use strict';var multer=require(_0xee14('0x0'));var util=require(_0xee14('0x1'));var path=require(_0xee14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee14('0x3')]();var fs_extra=require(_0xee14('0x4'));var auth=require(_0xee14('0x5'));var interaction=require(_0xee14('0x6'));var config=require(_0xee14('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xee14('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee14('0x8')]('/:id',auth[_0xee14('0x9')](),controller['show']);router['get'](_0xee14('0xa'),auth[_0xee14('0x9')](),controller[_0xee14('0xb')]);router[_0xee14('0xc')]('/',auth[_0xee14('0x9')](),controller[_0xee14('0xd')]);router[_0xee14('0xe')](_0xee14('0xf'),auth['isAuthenticated'](),controller[_0xee14('0x10')]);router[_0xee14('0x11')](_0xee14('0xf'),auth['isAuthenticated'](),controller[_0xee14('0x12')]);module[_0xee14('0x13')]=router; \ No newline at end of file +var _0x21bb=['./analyticExtractedReport.controller','isAuthenticated','index','get','/:id/download','put','/:id','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x7a1241,_0x2f8883){var _0x37497b=function(_0x31ca8c){while(--_0x31ca8c){_0x7a1241['push'](_0x7a1241['shift']());}};_0x37497b(++_0x2f8883);}(_0x21bb,0x149));var _0xb21b=function(_0x3d66d8,_0x159bb7){_0x3d66d8=_0x3d66d8-0x0;var _0x5387d3=_0x21bb[_0x3d66d8];return _0x5387d3;};'use strict';var multer=require(_0xb21b('0x0'));var util=require(_0xb21b('0x1'));var path=require('path');var timeout=require(_0xb21b('0x2'));var express=require('express');var router=express[_0xb21b('0x3')]();var fs_extra=require(_0xb21b('0x4'));var auth=require(_0xb21b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb21b('0x6'));var controller=require(_0xb21b('0x7'));router['get']('/',auth[_0xb21b('0x8')](),controller[_0xb21b('0x9')]);router[_0xb21b('0xa')]('/:id',auth[_0xb21b('0x8')](),controller['show']);router[_0xb21b('0xa')](_0xb21b('0xb'),auth[_0xb21b('0x8')](),controller['download']);router['post']('/',auth[_0xb21b('0x8')](),controller['create']);router[_0xb21b('0xc')](_0xb21b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb21b('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb21b('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 441f47f..745a174 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 _0x76e6=['STRING','BOOLEAN','exports','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x76e6,0x1c2));var _0x676e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x76e6[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x676e('0x0')]={'field':{'type':Sequelize[_0x676e('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x676e('0x2')]},'groupBy':{'type':Sequelize[_0x676e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x676e('0x2')]},'custom':{'type':Sequelize[_0x676e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb6ec=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb6ec,0x82));var _0xcb6e=function(_0x2641c8,_0x1ef9f7){_0x2641c8=_0x2641c8-0x0;var _0x3185b2=_0xb6ec[_0x2641c8];return _0x3185b2;};'use strict';var Sequelize=require(_0xcb6e('0x0'));module[_0xcb6e('0x1')]={'field':{'type':Sequelize[_0xcb6e('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xcb6e('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xcb6e('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xcb6e('0x3')]},'custom':{'type':Sequelize[_0xcb6e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ed9cec4..6985e59 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 _0xcee5=['update','then','end','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x3e0e55,_0x1b446c){var _0x669d7e=function(_0x3ef41b){while(--_0x3ef41b){_0x3e0e55['push'](_0x3e0e55['shift']());}};_0x669d7e(++_0x1b446c);}(_0xcee5,0xcf));var _0x5cee=function(_0x2f9f53,_0x5b7f6d){_0x2f9f53=_0x2f9f53-0x0;var _0x503da8=_0xcee5[_0x2f9f53];return _0x503da8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cee('0x0'));var zipdir=require(_0x5cee('0x1'));var jsonpatch=require(_0x5cee('0x2'));var rp=require(_0x5cee('0x3'));var moment=require('moment');var BPromise=require(_0x5cee('0x4'));var Mustache=require('mustache');var util=require(_0x5cee('0x5'));var path=require('path');var sox=require(_0x5cee('0x6'));var csv=require(_0x5cee('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cee('0x8'));var squel=require(_0x5cee('0x9'));var crypto=require(_0x5cee('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5cee('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5cee('0xc'));var Papa=require(_0x5cee('0xd'));var Redis=require(_0x5cee('0xe'));var authService=require(_0x5cee('0xf'));var qs=require(_0x5cee('0x10'));var as=require(_0x5cee('0x11'));var hardwareService=require(_0x5cee('0x12'));var logger=require(_0x5cee('0x13'))(_0x5cee('0x14'));var utils=require('../../config/utils');var config=require(_0x5cee('0x15'));var licenseUtil=require(_0x5cee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22e0f9,_0x21aec2){_0x21aec2=_0x21aec2||0xcc;return function(_0x75bf17){if(_0x75bf17){return _0x22e0f9[_0x5cee('0x17')](_0x21aec2);}return _0x22e0f9[_0x5cee('0x18')](_0x21aec2)['end']();};}function respondWithResult(_0x37375e,_0x53d6e2){_0x53d6e2=_0x53d6e2||0xc8;return function(_0x933452){if(_0x933452){return _0x37375e[_0x5cee('0x18')](_0x53d6e2)[_0x5cee('0x19')](_0x933452);}};}function respondWithFilteredResult(_0x3b86f4,_0x326f49){return function(_0x306d74){if(_0x306d74){var _0x41242a=typeof _0x326f49[_0x5cee('0x1a')]===_0x5cee('0x1b')&&typeof _0x326f49[_0x5cee('0x1c')]===_0x5cee('0x1b');var _0x23cfe6=_0x306d74[_0x5cee('0x1d')];var _0x799568=_0x41242a?0x0:_0x326f49[_0x5cee('0x1a')];var _0x1c4f0c=_0x41242a?_0x306d74['count']:_0x326f49[_0x5cee('0x1a')]+_0x326f49[_0x5cee('0x1c')];var _0x1900ed;if(_0x1c4f0c>=_0x23cfe6){_0x1c4f0c=_0x23cfe6;_0x1900ed=0xc8;}else{_0x1900ed=0xce;}_0x3b86f4[_0x5cee('0x18')](_0x1900ed);return _0x3b86f4[_0x5cee('0x1e')](_0x5cee('0x1f'),_0x799568+'-'+_0x1c4f0c+'/'+_0x23cfe6)['json'](_0x306d74);}return null;};}function patchUpdates(_0x438de7){return function(_0x8047b8){try{jsonpatch['apply'](_0x8047b8,_0x438de7,!![]);}catch(_0xfac1df){return BPromise['reject'](_0xfac1df);}return _0x8047b8[_0x5cee('0x20')]();};}function saveUpdates(_0xa52b5f,_0x38ffca){return function(_0x4abb69){if(_0x4abb69){return _0x4abb69[_0x5cee('0x21')](_0xa52b5f)[_0x5cee('0x22')](function(_0x2b88f8){return _0x2b88f8;});}return null;};}function removeEntity(_0x2a3beb,_0x231e37){return function(_0x14df3e){if(_0x14df3e){return _0x14df3e['destroy']()[_0x5cee('0x22')](function(){_0x2a3beb[_0x5cee('0x18')](0xcc)[_0x5cee('0x23')]();});}};}function handleEntityNotFound(_0x2f8933,_0x263cb6){return function(_0x21f4c8){if(!_0x21f4c8){_0x2f8933[_0x5cee('0x17')](0x194);}return _0x21f4c8;};}function handleError(_0x417dac,_0x47e60e){_0x47e60e=_0x47e60e||0x1f4;return function(_0x1dedab){logger[_0x5cee('0x24')](_0x1dedab['stack']);if(_0x1dedab[_0x5cee('0x25')]){delete _0x1dedab[_0x5cee('0x25')];}_0x417dac[_0x5cee('0x18')](_0x47e60e)[_0x5cee('0x26')](_0x1dedab);};}exports[_0x5cee('0x27')]=function(_0x5edd57,_0x1eec2d){var _0x58a66f={},_0x49c32a={},_0xec6008={'count':0x0,'rows':[]};var _0x1ca015=_[_0x5cee('0x28')](db[_0x5cee('0x29')][_0x5cee('0x2a')],function(_0x3101e6){return{'name':_0x3101e6[_0x5cee('0x2b')],'type':_0x3101e6['type'][_0x5cee('0x2c')]};});_0x49c32a[_0x5cee('0x2d')]=_['map'](_0x1ca015,_0x5cee('0x25'));_0x49c32a[_0x5cee('0x2e')]=_[_0x5cee('0x2f')](_0x5edd57['query']);_0x49c32a['filters']=_[_0x5cee('0x30')](_0x49c32a['model'],_0x49c32a['query']);_0x58a66f[_0x5cee('0x31')]=_[_0x5cee('0x30')](_0x49c32a[_0x5cee('0x2d')],qs[_0x5cee('0x32')](_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x32')]));_0x58a66f['attributes']=_0x58a66f[_0x5cee('0x31')]['length']?_0x58a66f[_0x5cee('0x31')]:_0x49c32a[_0x5cee('0x2d')];if(!_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x33')](_0x5cee('0x34'))){_0x58a66f[_0x5cee('0x1c')]=qs[_0x5cee('0x1c')](_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x1c')]);_0x58a66f['offset']=qs['offset'](_0x5edd57['query'][_0x5cee('0x1a')]);}_0x58a66f[_0x5cee('0x35')]=qs['sort'](_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x36')]);_0x58a66f[_0x5cee('0x37')]=qs[_0x5cee('0x38')](_[_0x5cee('0x39')](_0x5edd57[_0x5cee('0x2e')],_0x49c32a[_0x5cee('0x38')]),_0x1ca015);if(_0x5edd57[_0x5cee('0x2e')]['filter']){_0x58a66f[_0x5cee('0x37')]=_[_0x5cee('0x3a')](_0x58a66f[_0x5cee('0x37')],{'$or':_[_0x5cee('0x28')](_0x1ca015,function(_0x16bc5f){if(_0x16bc5f[_0x5cee('0x3b')]!==_0x5cee('0x3c')){var _0x4ff3c9={};_0x4ff3c9[_0x16bc5f[_0x5cee('0x25')]]={'$like':'%'+_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x3d')]+'%'};return _0x4ff3c9;}})});}_0x58a66f=_[_0x5cee('0x3a')]({},_0x58a66f,_0x5edd57['options']);var _0x322f1f={'where':_0x58a66f[_0x5cee('0x37')]};return db[_0x5cee('0x29')][_0x5cee('0x1d')](_0x322f1f)[_0x5cee('0x22')](function(_0x15d1d3){_0xec6008[_0x5cee('0x1d')]=_0x15d1d3;if(_0x5edd57[_0x5cee('0x2e')][_0x5cee('0x3e')]){_0x58a66f[_0x5cee('0x3f')]=[{'all':!![]}];}return db[_0x5cee('0x29')][_0x5cee('0x40')](_0x58a66f);})[_0x5cee('0x22')](function(_0x536618){_0xec6008['rows']=_0x536618;return _0xec6008;})[_0x5cee('0x22')](respondWithFilteredResult(_0x1eec2d,_0x58a66f))[_0x5cee('0x41')](handleError(_0x1eec2d,null));};exports[_0x5cee('0x42')]=function(_0x3fbd10,_0x8b1586){var _0x14701c={'raw':![],'where':{'id':_0x3fbd10[_0x5cee('0x43')]['id']}},_0xeff086={};_0xeff086[_0x5cee('0x2d')]=_[_0x5cee('0x2f')](db[_0x5cee('0x29')][_0x5cee('0x2a')]);_0xeff086[_0x5cee('0x2e')]=_[_0x5cee('0x2f')](_0x3fbd10['query']);_0xeff086[_0x5cee('0x38')]=_[_0x5cee('0x30')](_0xeff086[_0x5cee('0x2d')],_0xeff086[_0x5cee('0x2e')]);_0x14701c[_0x5cee('0x31')]=_['intersection'](_0xeff086[_0x5cee('0x2d')],qs[_0x5cee('0x32')](_0x3fbd10[_0x5cee('0x2e')][_0x5cee('0x32')]));_0x14701c[_0x5cee('0x31')]=_0x14701c['attributes']['length']?_0x14701c[_0x5cee('0x31')]:_0xeff086[_0x5cee('0x2d')];if(_0x3fbd10[_0x5cee('0x2e')][_0x5cee('0x3e')]){_0x14701c[_0x5cee('0x3f')]=[{'all':!![]}];}_0x14701c=_[_0x5cee('0x3a')]({},_0x14701c,_0x3fbd10[_0x5cee('0x44')]);return db[_0x5cee('0x29')][_0x5cee('0x45')](_0x14701c)[_0x5cee('0x22')](handleEntityNotFound(_0x8b1586,null))[_0x5cee('0x22')](respondWithResult(_0x8b1586,null))['catch'](handleError(_0x8b1586,null));};exports['create']=function(_0x115461,_0x3d55ed){return db[_0x5cee('0x29')]['create'](_0x115461[_0x5cee('0x46')],{})[_0x5cee('0x22')](respondWithResult(_0x3d55ed,0xc9))[_0x5cee('0x41')](handleError(_0x3d55ed,null));};exports[_0x5cee('0x47')]=function(_0xd564b2,_0x52158f){return db[_0x5cee('0x29')]['bulkCreate'](_0xd564b2[_0x5cee('0x46')],{'raw':![],'individualHooks':!![]})[_0x5cee('0x22')](respondWithResult(_0x52158f,0xc9))['catch'](handleError(_0x52158f,null));};exports[_0x5cee('0x21')]=function(_0x3fd9cb,_0x18408b){if(_0x3fd9cb['body']['id']){delete _0x3fd9cb['body']['id'];}return db[_0x5cee('0x29')][_0x5cee('0x45')]({'where':{'id':_0x3fd9cb[_0x5cee('0x43')]['id']}})[_0x5cee('0x22')](handleEntityNotFound(_0x18408b,null))[_0x5cee('0x22')](saveUpdates(_0x3fd9cb['body'],null))[_0x5cee('0x22')](respondWithResult(_0x18408b,null))[_0x5cee('0x41')](handleError(_0x18408b,null));};exports[_0x5cee('0x48')]=function(_0x104fdc,_0x436ff9){return db[_0x5cee('0x29')][_0x5cee('0x45')]({'where':{'id':_0x104fdc[_0x5cee('0x43')]['id']}})[_0x5cee('0x22')](handleEntityNotFound(_0x436ff9,null))[_0x5cee('0x22')](removeEntity(_0x436ff9,null))[_0x5cee('0x41')](handleError(_0x436ff9,null));};exports[_0x5cee('0x49')]=function(_0x1560ab,_0x82dbbe){return db[_0x5cee('0x29')]['destroy']({'where':{'id':_0x1560ab[_0x5cee('0x2e')][_0x5cee('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x5cee('0x22')](respondWithResult(_0x82dbbe,0xcc))[_0x5cee('0x41')](handleError(_0x82dbbe,null));};exports[_0x5cee('0x4b')]=function(_0x56a798,_0x500bda,_0x48b484){return db[_0x5cee('0x4c')][_0x5cee('0x4d')]({'where':{'id':_0x56a798[_0x5cee('0x43')]['id']}})[_0x5cee('0x22')](handleEntityNotFound(_0x500bda,null))['then'](function(_0x415f35){if(_0x415f35){return db['sequelize'][_0x5cee('0x4e')](function(_0x4529fc){return db[_0x5cee('0x29')][_0x5cee('0x48')]({'where':{'CustomReportId':_0x56a798[_0x5cee('0x43')]['id']},'transaction':_0x4529fc})[_0x5cee('0x22')](function(_0x2386a5){var _0x4c0c86=_[_0x5cee('0x28')](_0x56a798[_0x5cee('0x46')],function(_0xdd11de){delete _0xdd11de['id'];_0xdd11de[_0x5cee('0x4f')]=_0x56a798['params']['id'];return _0xdd11de;});return db[_0x5cee('0x29')]['bulkCreate'](_0x4c0c86,{'transaction':_0x4529fc});});})[_0x5cee('0x22')](function(){return db[_0x5cee('0x29')][_0x5cee('0x40')]({'where':{'CustomReportId':_0x56a798[_0x5cee('0x43')]['id']}});});}})[_0x5cee('0x22')](respondWithResult(_0x500bda,null))[_0x5cee('0x41')](handleError(_0x500bda,null));}; \ No newline at end of file +var _0x0636=['key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','type','VIRTUAL','filter','options','AnalyticFieldReport','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0636,0x1d6));var _0x6063=function(_0x3527a6,_0x40035b){_0x3527a6=_0x3527a6-0x0;var _0x2d9cba=_0x0636[_0x3527a6];return _0x2d9cba;};'use strict';var emlformat=require(_0x6063('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6063('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6063('0x2'));var moment=require(_0x6063('0x3'));var BPromise=require(_0x6063('0x4'));var Mustache=require(_0x6063('0x5'));var util=require(_0x6063('0x6'));var path=require(_0x6063('0x7'));var sox=require(_0x6063('0x8'));var csv=require('to-csv');var ejs=require(_0x6063('0x9'));var fs=require('fs');var fs_extra=require(_0x6063('0xa'));var _=require(_0x6063('0xb'));var squel=require(_0x6063('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6063('0xd'));var querystring=require(_0x6063('0xe'));var Papa=require(_0x6063('0xf'));var Redis=require(_0x6063('0x10'));var authService=require(_0x6063('0x11'));var qs=require(_0x6063('0x12'));var as=require(_0x6063('0x13'));var hardwareService=require(_0x6063('0x14'));var logger=require(_0x6063('0x15'))(_0x6063('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6063('0x17'));var db=require(_0x6063('0x18'))['db'];function respondWithStatusCode(_0x390de3,_0x89f275){_0x89f275=_0x89f275||0xcc;return function(_0x2abe3c){if(_0x2abe3c){return _0x390de3[_0x6063('0x19')](_0x89f275);}return _0x390de3[_0x6063('0x1a')](_0x89f275)[_0x6063('0x1b')]();};}function respondWithResult(_0x10a748,_0xf667f7){_0xf667f7=_0xf667f7||0xc8;return function(_0x5c15f4){if(_0x5c15f4){return _0x10a748[_0x6063('0x1a')](_0xf667f7)[_0x6063('0x1c')](_0x5c15f4);}};}function respondWithFilteredResult(_0x8e7a18,_0x2affd7){return function(_0x2aab63){if(_0x2aab63){var _0x48c2d4=typeof _0x2affd7['offset']===_0x6063('0x1d')&&typeof _0x2affd7[_0x6063('0x1e')]===_0x6063('0x1d');var _0x590de3=_0x2aab63[_0x6063('0x1f')];var _0x170c97=_0x48c2d4?0x0:_0x2affd7['offset'];var _0x50028a=_0x48c2d4?_0x2aab63['count']:_0x2affd7[_0x6063('0x20')]+_0x2affd7[_0x6063('0x1e')];var _0x43a1e8;if(_0x50028a>=_0x590de3){_0x50028a=_0x590de3;_0x43a1e8=0xc8;}else{_0x43a1e8=0xce;}_0x8e7a18[_0x6063('0x1a')](_0x43a1e8);return _0x8e7a18[_0x6063('0x21')](_0x6063('0x22'),_0x170c97+'-'+_0x50028a+'/'+_0x590de3)[_0x6063('0x1c')](_0x2aab63);}return null;};}function patchUpdates(_0x34a56f){return function(_0x3190ef){try{jsonpatch[_0x6063('0x23')](_0x3190ef,_0x34a56f,!![]);}catch(_0x4edf5d){return BPromise[_0x6063('0x24')](_0x4edf5d);}return _0x3190ef[_0x6063('0x25')]();};}function saveUpdates(_0x2c6abf,_0x322afe){return function(_0x528431){if(_0x528431){return _0x528431[_0x6063('0x26')](_0x2c6abf)['then'](function(_0x20a131){return _0x20a131;});}return null;};}function removeEntity(_0x5924f1,_0x2b3339){return function(_0x3c0448){if(_0x3c0448){return _0x3c0448[_0x6063('0x27')]()[_0x6063('0x28')](function(){_0x5924f1[_0x6063('0x1a')](0xcc)[_0x6063('0x1b')]();});}};}function handleEntityNotFound(_0x3090cc,_0x2d23ff){return function(_0x243b0d){if(!_0x243b0d){_0x3090cc[_0x6063('0x19')](0x194);}return _0x243b0d;};}function handleError(_0x41af3a,_0x562a75){_0x562a75=_0x562a75||0x1f4;return function(_0x49d710){logger[_0x6063('0x29')](_0x49d710[_0x6063('0x2a')]);if(_0x49d710[_0x6063('0x2b')]){delete _0x49d710[_0x6063('0x2b')];}_0x41af3a[_0x6063('0x1a')](_0x562a75)[_0x6063('0x2c')](_0x49d710);};}exports[_0x6063('0x2d')]=function(_0x5c7c1f,_0x5089cb){var _0x67e1ba={},_0x5a8122={},_0x50f439={'count':0x0,'rows':[]};var _0x12b521=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x18f5c1){return{'name':_0x18f5c1['fieldName'],'type':_0x18f5c1['type'][_0x6063('0x2e')]};});_0x5a8122[_0x6063('0x2f')]=_[_0x6063('0x30')](_0x12b521,_0x6063('0x2b'));_0x5a8122[_0x6063('0x31')]=_[_0x6063('0x32')](_0x5c7c1f[_0x6063('0x31')]);_0x5a8122['filters']=_['intersection'](_0x5a8122[_0x6063('0x2f')],_0x5a8122[_0x6063('0x31')]);_0x67e1ba[_0x6063('0x33')]=_[_0x6063('0x34')](_0x5a8122[_0x6063('0x2f')],qs['fields'](_0x5c7c1f['query'][_0x6063('0x35')]));_0x67e1ba[_0x6063('0x33')]=_0x67e1ba[_0x6063('0x33')][_0x6063('0x36')]?_0x67e1ba[_0x6063('0x33')]:_0x5a8122[_0x6063('0x2f')];if(!_0x5c7c1f['query'][_0x6063('0x37')](_0x6063('0x38'))){_0x67e1ba[_0x6063('0x1e')]=qs[_0x6063('0x1e')](_0x5c7c1f['query']['limit']);_0x67e1ba[_0x6063('0x20')]=qs[_0x6063('0x20')](_0x5c7c1f[_0x6063('0x31')][_0x6063('0x20')]);}_0x67e1ba[_0x6063('0x39')]=qs[_0x6063('0x3a')](_0x5c7c1f[_0x6063('0x31')]['sort']);_0x67e1ba['where']=qs['filters'](_[_0x6063('0x3b')](_0x5c7c1f[_0x6063('0x31')],_0x5a8122[_0x6063('0x3c')]),_0x12b521);if(_0x5c7c1f[_0x6063('0x31')]['filter']){_0x67e1ba['where']=_[_0x6063('0x3d')](_0x67e1ba[_0x6063('0x3e')],{'$or':_[_0x6063('0x30')](_0x12b521,function(_0x5b45bb){if(_0x5b45bb[_0x6063('0x3f')]!==_0x6063('0x40')){var _0x4b854a={};_0x4b854a[_0x5b45bb[_0x6063('0x2b')]]={'$like':'%'+_0x5c7c1f['query'][_0x6063('0x41')]+'%'};return _0x4b854a;}})});}_0x67e1ba=_[_0x6063('0x3d')]({},_0x67e1ba,_0x5c7c1f[_0x6063('0x42')]);var _0x47e8a6={'where':_0x67e1ba[_0x6063('0x3e')]};return db[_0x6063('0x43')][_0x6063('0x1f')](_0x47e8a6)[_0x6063('0x28')](function(_0x528cc0){_0x50f439['count']=_0x528cc0;if(_0x5c7c1f['query']['includeAll']){_0x67e1ba[_0x6063('0x44')]=[{'all':!![]}];}return db[_0x6063('0x43')][_0x6063('0x45')](_0x67e1ba);})['then'](function(_0x4f423e){_0x50f439[_0x6063('0x46')]=_0x4f423e;return _0x50f439;})[_0x6063('0x28')](respondWithFilteredResult(_0x5089cb,_0x67e1ba))[_0x6063('0x47')](handleError(_0x5089cb,null));};exports['show']=function(_0xf0a7e,_0x5d7e87){var _0x514a09={'raw':![],'where':{'id':_0xf0a7e[_0x6063('0x48')]['id']}},_0x13dc89={};_0x13dc89[_0x6063('0x2f')]=_[_0x6063('0x32')](db['AnalyticFieldReport'][_0x6063('0x49')]);_0x13dc89[_0x6063('0x31')]=_[_0x6063('0x32')](_0xf0a7e[_0x6063('0x31')]);_0x13dc89[_0x6063('0x3c')]=_[_0x6063('0x34')](_0x13dc89[_0x6063('0x2f')],_0x13dc89['query']);_0x514a09[_0x6063('0x33')]=_[_0x6063('0x34')](_0x13dc89['model'],qs['fields'](_0xf0a7e[_0x6063('0x31')][_0x6063('0x35')]));_0x514a09[_0x6063('0x33')]=_0x514a09[_0x6063('0x33')]['length']?_0x514a09[_0x6063('0x33')]:_0x13dc89[_0x6063('0x2f')];if(_0xf0a7e[_0x6063('0x31')][_0x6063('0x4a')]){_0x514a09[_0x6063('0x44')]=[{'all':!![]}];}_0x514a09=_['merge']({},_0x514a09,_0xf0a7e[_0x6063('0x42')]);return db['AnalyticFieldReport'][_0x6063('0x4b')](_0x514a09)[_0x6063('0x28')](handleEntityNotFound(_0x5d7e87,null))[_0x6063('0x28')](respondWithResult(_0x5d7e87,null))[_0x6063('0x47')](handleError(_0x5d7e87,null));};exports['create']=function(_0x2ab3e1,_0x19cd29){return db['AnalyticFieldReport'][_0x6063('0x4c')](_0x2ab3e1[_0x6063('0x4d')],{})[_0x6063('0x28')](respondWithResult(_0x19cd29,0xc9))[_0x6063('0x47')](handleError(_0x19cd29,null));};exports[_0x6063('0x4e')]=function(_0x1baf55,_0x57b987){return db[_0x6063('0x43')]['bulkCreate'](_0x1baf55[_0x6063('0x4d')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x57b987,0xc9))[_0x6063('0x47')](handleError(_0x57b987,null));};exports[_0x6063('0x26')]=function(_0x2bb7a3,_0x5dff30){if(_0x2bb7a3['body']['id']){delete _0x2bb7a3[_0x6063('0x4d')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x2bb7a3[_0x6063('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dff30,null))[_0x6063('0x28')](saveUpdates(_0x2bb7a3[_0x6063('0x4d')],null))[_0x6063('0x28')](respondWithResult(_0x5dff30,null))[_0x6063('0x47')](handleError(_0x5dff30,null));};exports['destroy']=function(_0xb1285d,_0x346960){return db[_0x6063('0x43')]['find']({'where':{'id':_0xb1285d[_0x6063('0x48')]['id']}})[_0x6063('0x28')](handleEntityNotFound(_0x346960,null))[_0x6063('0x28')](removeEntity(_0x346960,null))['catch'](handleError(_0x346960,null));};exports[_0x6063('0x4f')]=function(_0x1ca33a,_0x55b686){return db['AnalyticFieldReport'][_0x6063('0x27')]({'where':{'id':_0x1ca33a[_0x6063('0x31')][_0x6063('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x6063('0x28')](respondWithResult(_0x55b686,0xcc))[_0x6063('0x47')](handleError(_0x55b686,null));};exports[_0x6063('0x51')]=function(_0x3ffc3a,_0xa5b0df,_0x373a99){return db['AnalyticCustomReport'][_0x6063('0x52')]({'where':{'id':_0x3ffc3a['params']['id']}})[_0x6063('0x28')](handleEntityNotFound(_0xa5b0df,null))[_0x6063('0x28')](function(_0x17584d){if(_0x17584d){return db[_0x6063('0x53')][_0x6063('0x54')](function(_0x3636d5){return db['AnalyticFieldReport'][_0x6063('0x27')]({'where':{'CustomReportId':_0x3ffc3a[_0x6063('0x48')]['id']},'transaction':_0x3636d5})[_0x6063('0x28')](function(_0x2bdd63){var _0x273594=_['map'](_0x3ffc3a['body'],function(_0x5d0f1d){delete _0x5d0f1d['id'];_0x5d0f1d[_0x6063('0x55')]=_0x3ffc3a[_0x6063('0x48')]['id'];return _0x5d0f1d;});return db[_0x6063('0x43')][_0x6063('0x4e')](_0x273594,{'transaction':_0x3636d5});});})[_0x6063('0x28')](function(){return db[_0x6063('0x43')][_0x6063('0x45')]({'where':{'CustomReportId':_0x3ffc3a[_0x6063('0x48')]['id']}});});}})[_0x6063('0x28')](respondWithResult(_0xa5b0df,null))[_0x6063('0x47')](handleError(_0xa5b0df,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ed57519..baa617a 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 _0x7212=['util','../../config/logger','moment','path','rimraf','exports','define','lodash'];(function(_0x4058c7,_0x3c6726){var _0x4cfb88=function(_0xb50c3c){while(--_0xb50c3c){_0x4058c7['push'](_0x4058c7['shift']());}};_0x4cfb88(++_0x3c6726);}(_0x7212,0x87));var _0x2721=function(_0x4a2416,_0x2dbf30){_0x4a2416=_0x4a2416-0x0;var _0x3d4820=_0x7212[_0x4a2416];return _0x3d4820;};'use strict';var _=require(_0x2721('0x0'));var util=require(_0x2721('0x1'));var logger=require(_0x2721('0x2'))('api');var moment=require(_0x2721('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2721('0x4'));var rimraf=require(_0x2721('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x2721('0x6')]=function(_0x58155e,_0x38a96c){return _0x58155e[_0x2721('0x7')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b4c=['moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','util','../../config/logger','api'];(function(_0x36440d,_0x59e989){var _0x360ee5=function(_0x4c1937){while(--_0x4c1937){_0x36440d['push'](_0x36440d['shift']());}};_0x360ee5(++_0x59e989);}(_0x4b4c,0x18d));var _0xc4b4=function(_0x12d2cc,_0x451088){_0x12d2cc=_0x12d2cc-0x0;var _0x352181=_0x4b4c[_0x12d2cc];return _0x352181;};'use strict';var _=require('lodash');var util=require(_0xc4b4('0x0'));var logger=require(_0xc4b4('0x1'))(_0xc4b4('0x2'));var moment=require(_0xc4b4('0x3'));var BPromise=require(_0xc4b4('0x4'));var rp=require(_0xc4b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4b4('0x6'));module[_0xc4b4('0x7')]=function(_0x5cf001,_0x49c948){return _0x5cf001[_0xc4b4('0x8')](_0xc4b4('0x9'),attributes,{'tableName':'analytics_report_fields','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 e67e6e7..d9e4eb1 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 _0xff6d=['catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result'];(function(_0x3e2480,_0x2eed70){var _0x652c0=function(_0xaae5d2){while(--_0xaae5d2){_0x3e2480['push'](_0x3e2480['shift']());}};_0x652c0(++_0x2eed70);}(_0xff6d,0xd3));var _0xdff6=function(_0xb74d09,_0x488e48){_0xb74d09=_0xb74d09-0x0;var _0x1d0344=_0xff6d[_0xb74d09];return _0x1d0344;};'use strict';var _=require(_0xdff6('0x0'));var util=require('util');var moment=require(_0xdff6('0x1'));var BPromise=require(_0xdff6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdff6('0x4'));var logger=require(_0xdff6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdff6('0x6'));var client=jayson[_0xdff6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a719,_0x429d71,_0x573346){return new BPromise(function(_0x3444c9,_0x4ed46c){return client[_0xdff6('0x8')](_0x31a719,_0x573346)[_0xdff6('0x9')](function(_0x4fd4a3){logger[_0xdff6('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x429d71,'request\x20sent');logger[_0xdff6('0xb')](_0xdff6('0xc'),_0x429d71,_0xdff6('0xd'),JSON[_0xdff6('0xe')](_0x4fd4a3));if(_0x4fd4a3[_0xdff6('0xf')]){if(_0x4fd4a3[_0xdff6('0xf')][_0xdff6('0x10')]===0x1f4){logger['error'](_0xdff6('0x11'),_0x429d71,_0x4fd4a3['error'][_0xdff6('0x12')]);return _0x4ed46c(_0x4fd4a3[_0xdff6('0xf')][_0xdff6('0x12')]);}logger[_0xdff6('0xf')](_0xdff6('0x11'),_0x429d71,_0x4fd4a3[_0xdff6('0xf')][_0xdff6('0x12')]);return _0x3444c9(_0x4fd4a3[_0xdff6('0xf')][_0xdff6('0x12')]);}else{logger[_0xdff6('0xa')](_0xdff6('0x11'),_0x429d71,_0xdff6('0xd'));_0x3444c9(_0x4fd4a3[_0xdff6('0x13')]['message']);}})[_0xdff6('0x14')](function(_0x37ef01){logger[_0xdff6('0xf')](_0xdff6('0x11'),_0x429d71,_0x37ef01);_0x4ed46c(_0x37ef01);});});} \ No newline at end of file +var _0xa71c=['stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa71c,0x169));var _0xca71=function(_0x5d8e04,_0x2448f9){_0x5d8e04=_0x5d8e04-0x0;var _0x3063e1=_0xa71c[_0x5d8e04];return _0x3063e1;};'use strict';var _=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var moment=require(_0xca71('0x2'));var BPromise=require(_0xca71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca71('0x4'));var db=require(_0xca71('0x5'))['db'];var utils=require(_0xca71('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xca71('0x7'));var jayson=require(_0xca71('0x8'));var client=jayson[_0xca71('0x9')][_0xca71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132c2b,_0x40e69a,_0x312b15){return new BPromise(function(_0x31c4ab,_0x456be5){return client[_0xca71('0xb')](_0x132c2b,_0x312b15)[_0xca71('0xc')](function(_0x56f437){logger[_0xca71('0xd')](_0xca71('0xe'),_0x40e69a,_0xca71('0xf'));logger[_0xca71('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x40e69a,_0xca71('0xf'),JSON[_0xca71('0x11')](_0x56f437));if(_0x56f437[_0xca71('0x12')]){if(_0x56f437[_0xca71('0x12')]['code']===0x1f4){logger[_0xca71('0x12')](_0xca71('0xe'),_0x40e69a,_0x56f437[_0xca71('0x12')][_0xca71('0x13')]);return _0x456be5(_0x56f437[_0xca71('0x12')][_0xca71('0x13')]);}logger['error'](_0xca71('0xe'),_0x40e69a,_0x56f437[_0xca71('0x12')]['message']);return _0x31c4ab(_0x56f437[_0xca71('0x12')][_0xca71('0x13')]);}else{logger[_0xca71('0xd')](_0xca71('0xe'),_0x40e69a,_0xca71('0xf'));_0x31c4ab(_0x56f437['result'][_0xca71('0x13')]);}})[_0xca71('0x14')](function(_0x2284b8){logger[_0xca71('0x12')](_0xca71('0xe'),_0x40e69a,_0x2284b8);_0x456be5(_0x2284b8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 33b10e6..4daa17e 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(_0x4b6925,_0x23c3e0){var _0x32fa12=function(_0x675a7b){while(--_0x675a7b){_0x4b6925['push'](_0x4b6925['shift']());}};_0x32fa12(++_0x23c3e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x5536ac,_0x16aedb){var _0x426b74=function(_0x43aba3){while(--_0x43aba3){_0x5536ac['push'](_0x5536ac['shift']());}};_0x426b74(++_0x16aedb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 c55ccb2..26ac913 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 _0x720c=['sequelize','STRING','name','TEXT'];(function(_0x5c4b34,_0x366e7d){var _0x1b4655=function(_0x48a2c1){while(--_0x48a2c1){_0x5c4b34['push'](_0x5c4b34['shift']());}};_0x1b4655(++_0x366e7d);}(_0x720c,0x154));var _0xc720=function(_0x4e7413,_0x5dffb1){_0x4e7413=_0x4e7413-0x0;var _0x11b6de=_0x720c[_0x4e7413];return _0x11b6de;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'name':{'type':Sequelize[_0xc720('0x1')],'allowNull':![],'unique':_0xc720('0x2')},'table':{'type':Sequelize[_0xc720('0x1')]},'metric':{'type':Sequelize[_0xc720('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf82=['sequelize','STRING','TEXT'];(function(_0x5b09e6,_0x3f5a94){var _0x3f5910=function(_0x13bfa0){while(--_0x13bfa0){_0x5b09e6['push'](_0x5b09e6['shift']());}};_0x3f5910(++_0x3f5a94);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x236ff9,_0x53c91a){_0x236ff9=_0x236ff9-0x0;var _0x10be41=_0xbf82[_0x236ff9];return _0x10be41;};'use strict';var Sequelize=require(_0x2bf8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2bf8('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x2bf8('0x1')]},'metric':{'type':Sequelize[_0x2bf8('0x2')]},'description':{'type':Sequelize[_0x2bf8('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7b0428f..765a737 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x23cdc6,_0x4c79d2){var _0x4c8de0=function(_0x3f787f){while(--_0x3f787f){_0x23cdc6['push'](_0x23cdc6['shift']());}};_0x4c8de0(++_0x4c79d2);}(_0x9a19,0x114));var _0x99a1=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x9a19[_0x15876a];return _0xbd900f;};'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'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x137624,_0xe9ae3f){_0x137624=_0x137624-0x0;var _0x21ba76=_0x1cb9[_0x137624];return _0x21ba76;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4b91fa2..aefe6c8 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 _0x872a=['exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x872a,0x100));var _0xa872=function(_0x1ffa5b,_0x498e6b){_0x1ffa5b=_0x1ffa5b-0x0;var _0x599db1=_0x872a[_0x1ffa5b];return _0x599db1;};'use strict';var _=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var logger=require(_0xa872('0x2'))(_0xa872('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa872('0x4'));var rimraf=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var attributes=require(_0xa872('0x7'));module[_0xa872('0x8')]=function(_0x1c8d2f,_0x3e3cd4){return _0x1c8d2f['define'](_0xa872('0x9'),attributes,{'tableName':_0xa872('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf98=['moment','bluebird','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api'];(function(_0x48b6c6,_0xba4073){var _0x1bcc9a=function(_0x581c84){while(--_0x581c84){_0x48b6c6['push'](_0x48b6c6['shift']());}};_0x1bcc9a(++_0xba4073);}(_0xcf98,0x8d));var _0x8cf9=function(_0x7dc4a6,_0x5950fc){_0x7dc4a6=_0x7dc4a6-0x0;var _0x88a385=_0xcf98[_0x7dc4a6];return _0x88a385;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var logger=require(_0x8cf9('0x1'))(_0x8cf9('0x2'));var moment=require(_0x8cf9('0x3'));var BPromise=require(_0x8cf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var attributes=require(_0x8cf9('0x7'));module[_0x8cf9('0x8')]=function(_0x784c17,_0x3a5463){return _0x784c17[_0x8cf9('0x9')](_0x8cf9('0xa'),attributes,{'tableName':_0x8cf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 3598af9..39e030a 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 _0x0c5e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1085db,_0x41e087){var _0x392a60=function(_0xc7f75d){while(--_0xc7f75d){_0x1085db['push'](_0x1085db['shift']());}};_0x392a60(++_0x41e087);}(_0x0c5e,0x1d0));var _0xe0c5=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x0c5e[_0x543429];return _0x112a46;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe0c5('0x0'));var rs=require(_0xe0c5('0x1'));var fs=require('fs');var Redis=require(_0xe0c5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0c5('0x3'));var logger=require(_0xe0c5('0x4'))(_0xe0c5('0x5'));var config=require(_0xe0c5('0x6'));var jayson=require(_0xe0c5('0x7'));var client=jayson[_0xe0c5('0x8')][_0xe0c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fcd01,_0x8bd3c6,_0xd16573){return new BPromise(function(_0x4116cd,_0x3132cd){return client['request'](_0x1fcd01,_0xd16573)['then'](function(_0x2270cb){logger['info'](_0xe0c5('0xa'),_0x8bd3c6,'request\x20sent');logger['debug'](_0xe0c5('0xb'),_0x8bd3c6,'request\x20sent',JSON['stringify'](_0x2270cb));if(_0x2270cb[_0xe0c5('0xc')]){if(_0x2270cb[_0xe0c5('0xc')][_0xe0c5('0xd')]===0x1f4){logger['error'](_0xe0c5('0xa'),_0x8bd3c6,_0x2270cb[_0xe0c5('0xc')][_0xe0c5('0xe')]);return _0x3132cd(_0x2270cb[_0xe0c5('0xc')]['message']);}logger[_0xe0c5('0xc')](_0xe0c5('0xa'),_0x8bd3c6,_0x2270cb[_0xe0c5('0xc')]['message']);return _0x4116cd(_0x2270cb[_0xe0c5('0xc')][_0xe0c5('0xe')]);}else{logger['info'](_0xe0c5('0xa'),_0x8bd3c6,_0xe0c5('0xf'));_0x4116cd(_0x2270cb[_0xe0c5('0x10')]['message']);}})[_0xe0c5('0x11')](function(_0x1d69de){logger[_0xe0c5('0xc')](_0xe0c5('0xa'),_0x8bd3c6,_0x1d69de);_0x3132cd(_0x1d69de);});});} \ No newline at end of file +var _0xc541=['then','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x23dbb6,_0x25c89b){var _0x56ce38=function(_0x40e0df){while(--_0x40e0df){_0x23dbb6['push'](_0x23dbb6['shift']());}};_0x56ce38(++_0x25c89b);}(_0xc541,0x194));var _0x1c54=function(_0x493c8c,_0x470567){_0x493c8c=_0x493c8c-0x0;var _0x17344b=_0xc541[_0x493c8c];return _0x17344b;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c54('0x2'));var fs=require('fs');var Redis=require(_0x1c54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c54('0x4'));var logger=require(_0x1c54('0x5'))(_0x1c54('0x6'));var config=require(_0x1c54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c54('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a40b9,_0x34469e,_0x58af43){return new BPromise(function(_0x68e94d,_0x12db48){return client[_0x1c54('0x9')](_0x3a40b9,_0x58af43)[_0x1c54('0xa')](function(_0x156648){logger['info'](_0x1c54('0xb'),_0x34469e,'request\x20sent');logger['debug'](_0x1c54('0xc'),_0x34469e,_0x1c54('0xd'),JSON['stringify'](_0x156648));if(_0x156648['error']){if(_0x156648[_0x1c54('0xe')][_0x1c54('0xf')]===0x1f4){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x34469e,_0x156648[_0x1c54('0xe')]['message']);return _0x12db48(_0x156648[_0x1c54('0xe')]['message']);}logger[_0x1c54('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x34469e,_0x156648[_0x1c54('0xe')][_0x1c54('0x10')]);return _0x68e94d(_0x156648[_0x1c54('0xe')][_0x1c54('0x10')]);}else{logger['info'](_0x1c54('0xb'),_0x34469e,_0x1c54('0xd'));_0x68e94d(_0x156648[_0x1c54('0x11')][_0x1c54('0x10')]);}})['catch'](function(_0x31e303){logger[_0x1c54('0xe')](_0x1c54('0xb'),_0x34469e,_0x31e303);_0x12db48(_0x31e303);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2d6f6bd..090d1eb 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 _0x6c32=['post','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x181a1a,_0x5584e7){var _0x363a0e=function(_0x38e51f){while(--_0x38e51f){_0x181a1a['push'](_0x181a1a['shift']());}};_0x363a0e(++_0x5584e7);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x26c3('0x0'));var util=require('util');var path=require(_0x26c3('0x1'));var timeout=require('connect-timeout');var express=require(_0x26c3('0x2'));var router=express['Router']();var fs_extra=require(_0x26c3('0x3'));var auth=require(_0x26c3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x26c3('0x5'));router[_0x26c3('0x6')]('/',auth[_0x26c3('0x7')](),controller[_0x26c3('0x8')]);router[_0x26c3('0x6')](_0x26c3('0x9'),auth[_0x26c3('0x7')](),controller[_0x26c3('0xa')]);router[_0x26c3('0xb')]('/',auth[_0x26c3('0x7')](),controller['create']);router['put'](_0x26c3('0x9'),auth['isAuthenticated'](),controller[_0x26c3('0xc')]);router[_0x26c3('0xd')]('/:id',auth[_0x26c3('0x7')](),controller[_0x26c3('0xe')]);module[_0x26c3('0xf')]=router; \ No newline at end of file +var _0x88b0=['../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','update','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x401f2e,_0x119d0d){var _0x4ef876=function(_0x5bb365){while(--_0x5bb365){_0x401f2e['push'](_0x401f2e['shift']());}};_0x4ef876(++_0x119d0d);}(_0x88b0,0x1cb));var _0x088b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x88b0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x088b('0x0'));var util=require(_0x088b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x088b('0x2'));var router=express[_0x088b('0x3')]();var fs_extra=require(_0x088b('0x4'));var auth=require(_0x088b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x088b('0x6'));var controller=require(_0x088b('0x7'));router[_0x088b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x088b('0x8')](_0x088b('0x9'),auth[_0x088b('0xa')](),controller[_0x088b('0xb')]);router[_0x088b('0xc')]('/',auth[_0x088b('0xa')](),controller[_0x088b('0xd')]);router['put'](_0x088b('0x9'),auth['isAuthenticated'](),controller[_0x088b('0xe')]);router['delete'](_0x088b('0x9'),auth[_0x088b('0xa')](),controller['destroy']);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 c2b5933..28b92ef 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 _0xe0dc=['sequelize','exports','TEXT'];(function(_0x15f54f,_0x114b4b){var _0xbb990c=function(_0x1ef0b0){while(--_0x1ef0b0){_0x15f54f['push'](_0x15f54f['shift']());}};_0xbb990c(++_0x114b4b);}(_0xe0dc,0x1e9));var _0xce0d=function(_0x414cbe,_0x16a463){_0x414cbe=_0x414cbe-0x0;var _0x2793fe=_0xe0dc[_0x414cbe];return _0x2793fe;};'use strict';var Sequelize=require(_0xce0d('0x0'));module[_0xce0d('0x1')]={'tree':{'type':Sequelize[_0xce0d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2418=['TEXT','sequelize'];(function(_0x27572c,_0x4a80bf){var _0x8081d7=function(_0xe04f9c){while(--_0xe04f9c){_0x27572c['push'](_0x27572c['shift']());}};_0x8081d7(++_0x4a80bf);}(_0x2418,0x85));var _0x8241=function(_0x35c532,_0x1c530a){_0x35c532=_0x35c532-0x0;var _0x1f4744=_0x2418[_0x35c532];return _0x1f4744;};'use strict';var Sequelize=require(_0x8241('0x0'));module['exports']={'tree':{'type':Sequelize[_0x8241('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 c63807b..dba9093 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 _0x66d8=['../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','include','findAll','show','params','intersection','length','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x478739,_0x3bf556){var _0xe4260e=function(_0xef5c3f){while(--_0xef5c3f){_0x478739['push'](_0x478739['shift']());}};_0xe4260e(++_0x3bf556);}(_0x66d8,0x10b));var _0x866d=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0x66d8[_0x2aaa60];return _0x2e3fa5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x866d('0x0'));var zipdir=require(_0x866d('0x1'));var jsonpatch=require(_0x866d('0x2'));var rp=require(_0x866d('0x3'));var moment=require(_0x866d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x866d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x866d('0x6'));var csv=require(_0x866d('0x7'));var ejs=require(_0x866d('0x8'));var fs=require('fs');var fs_extra=require(_0x866d('0x9'));var _=require(_0x866d('0xa'));var squel=require(_0x866d('0xb'));var crypto=require('crypto');var jsforce=require(_0x866d('0xc'));var deskjs=require(_0x866d('0xd'));var toCsv=require(_0x866d('0x7'));var querystring=require(_0x866d('0xe'));var Papa=require('papaparse');var Redis=require(_0x866d('0xf'));var authService=require(_0x866d('0x10'));var qs=require(_0x866d('0x11'));var as=require(_0x866d('0x12'));var hardwareService=require(_0x866d('0x13'));var logger=require(_0x866d('0x14'))('api');var utils=require(_0x866d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x866d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ae82,_0xd59f39){_0xd59f39=_0xd59f39||0xcc;return function(_0x4151c4){if(_0x4151c4){return _0x49ae82['sendStatus'](_0xd59f39);}return _0x49ae82[_0x866d('0x17')](_0xd59f39)[_0x866d('0x18')]();};}function respondWithResult(_0x5101f5,_0x3e5e96){_0x3e5e96=_0x3e5e96||0xc8;return function(_0x229001){if(_0x229001){return _0x5101f5[_0x866d('0x17')](_0x3e5e96)[_0x866d('0x19')](_0x229001);}};}function respondWithFilteredResult(_0x8674d0,_0x586c42){return function(_0x596d22){if(_0x596d22){var _0x35f4d7=typeof _0x586c42[_0x866d('0x1a')]==='undefined'&&typeof _0x586c42['limit']===_0x866d('0x1b');var _0x22595e=_0x596d22['count'];var _0x4080b8=_0x35f4d7?0x0:_0x586c42['offset'];var _0x2cdc97=_0x35f4d7?_0x596d22[_0x866d('0x1c')]:_0x586c42[_0x866d('0x1a')]+_0x586c42['limit'];var _0x51bd11;if(_0x2cdc97>=_0x22595e){_0x2cdc97=_0x22595e;_0x51bd11=0xc8;}else{_0x51bd11=0xce;}_0x8674d0[_0x866d('0x17')](_0x51bd11);return _0x8674d0[_0x866d('0x1d')](_0x866d('0x1e'),_0x4080b8+'-'+_0x2cdc97+'/'+_0x22595e)[_0x866d('0x19')](_0x596d22);}return null;};}function patchUpdates(_0x3a06ab){return function(_0x20edf2){try{jsonpatch['apply'](_0x20edf2,_0x3a06ab,!![]);}catch(_0x4f3909){return BPromise['reject'](_0x4f3909);}return _0x20edf2[_0x866d('0x1f')]();};}function saveUpdates(_0x3ded6a,_0x42a204){return function(_0x5b8f91){if(_0x5b8f91){return _0x5b8f91[_0x866d('0x20')](_0x3ded6a)['then'](function(_0xf25097){return _0xf25097;});}return null;};}function removeEntity(_0x1d7928,_0x54e4f5){return function(_0x28c44a){if(_0x28c44a){return _0x28c44a[_0x866d('0x21')]()[_0x866d('0x22')](function(){_0x1d7928[_0x866d('0x17')](0xcc)[_0x866d('0x18')]();});}};}function handleEntityNotFound(_0x14e40a,_0x38a7d7){return function(_0x33e69c){if(!_0x33e69c){_0x14e40a[_0x866d('0x23')](0x194);}return _0x33e69c;};}function handleError(_0x1d59dd,_0x1da91a){_0x1da91a=_0x1da91a||0x1f4;return function(_0x4a4b7e){logger[_0x866d('0x24')](_0x4a4b7e[_0x866d('0x25')]);if(_0x4a4b7e[_0x866d('0x26')]){delete _0x4a4b7e[_0x866d('0x26')];}_0x1d59dd['status'](_0x1da91a)[_0x866d('0x27')](_0x4a4b7e);};}exports['index']=function(_0x528fc4,_0x32186b){var _0x19d9de={},_0x20ec55={},_0x2ccfda={'count':0x0,'rows':[]};var _0x305d32=_[_0x866d('0x28')](db['AnalyticTreeReport'][_0x866d('0x29')],function(_0x2a1f31){return{'name':_0x2a1f31[_0x866d('0x2a')],'type':_0x2a1f31[_0x866d('0x2b')][_0x866d('0x2c')]};});_0x20ec55[_0x866d('0x2d')]=_[_0x866d('0x28')](_0x305d32,_0x866d('0x26'));_0x20ec55[_0x866d('0x2e')]=_[_0x866d('0x2f')](_0x528fc4[_0x866d('0x2e')]);_0x20ec55['filters']=_['intersection'](_0x20ec55['model'],_0x20ec55[_0x866d('0x2e')]);_0x19d9de[_0x866d('0x30')]=_['intersection'](_0x20ec55[_0x866d('0x2d')],qs['fields'](_0x528fc4[_0x866d('0x2e')][_0x866d('0x31')]));_0x19d9de[_0x866d('0x30')]=_0x19d9de['attributes']['length']?_0x19d9de[_0x866d('0x30')]:_0x20ec55['model'];if(!_0x528fc4[_0x866d('0x2e')]['hasOwnProperty'](_0x866d('0x32'))){_0x19d9de['limit']=qs[_0x866d('0x33')](_0x528fc4[_0x866d('0x2e')][_0x866d('0x33')]);_0x19d9de[_0x866d('0x1a')]=qs[_0x866d('0x1a')](_0x528fc4[_0x866d('0x2e')][_0x866d('0x1a')]);}_0x19d9de['order']=qs[_0x866d('0x34')](_0x528fc4[_0x866d('0x2e')]['sort']);_0x19d9de[_0x866d('0x35')]=qs[_0x866d('0x36')](_[_0x866d('0x37')](_0x528fc4[_0x866d('0x2e')],_0x20ec55[_0x866d('0x36')]),_0x305d32);if(_0x528fc4['query'][_0x866d('0x38')]){_0x19d9de['where']=_['merge'](_0x19d9de[_0x866d('0x35')],{'$or':_[_0x866d('0x28')](_0x305d32,function(_0x3d9e15){if(_0x3d9e15[_0x866d('0x2b')]!==_0x866d('0x39')){var _0x1cc6dd={};_0x1cc6dd[_0x3d9e15[_0x866d('0x26')]]={'$like':'%'+_0x528fc4[_0x866d('0x2e')][_0x866d('0x38')]+'%'};return _0x1cc6dd;}})});}_0x19d9de=_[_0x866d('0x3a')]({},_0x19d9de,_0x528fc4[_0x866d('0x3b')]);var _0x2f2fca={'where':_0x19d9de[_0x866d('0x35')]};return db[_0x866d('0x3c')][_0x866d('0x1c')](_0x2f2fca)['then'](function(_0xde3033){_0x2ccfda['count']=_0xde3033;if(_0x528fc4['query'][_0x866d('0x3d')]){_0x19d9de[_0x866d('0x3e')]=[{'all':!![]}];}return db[_0x866d('0x3c')][_0x866d('0x3f')](_0x19d9de);})[_0x866d('0x22')](function(_0x590fdb){_0x2ccfda['rows']=_0x590fdb;return _0x2ccfda;})[_0x866d('0x22')](respondWithFilteredResult(_0x32186b,_0x19d9de))['catch'](handleError(_0x32186b,null));};exports[_0x866d('0x40')]=function(_0x104bb4,_0x15ba93){var _0x43db7b={'raw':!![],'where':{'id':_0x104bb4[_0x866d('0x41')]['id']}},_0x10ed79={};_0x10ed79[_0x866d('0x2d')]=_[_0x866d('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x10ed79[_0x866d('0x2e')]=_[_0x866d('0x2f')](_0x104bb4[_0x866d('0x2e')]);_0x10ed79[_0x866d('0x36')]=_[_0x866d('0x42')](_0x10ed79['model'],_0x10ed79[_0x866d('0x2e')]);_0x43db7b[_0x866d('0x30')]=_[_0x866d('0x42')](_0x10ed79[_0x866d('0x2d')],qs['fields'](_0x104bb4[_0x866d('0x2e')][_0x866d('0x31')]));_0x43db7b[_0x866d('0x30')]=_0x43db7b['attributes'][_0x866d('0x43')]?_0x43db7b[_0x866d('0x30')]:_0x10ed79[_0x866d('0x2d')];if(_0x104bb4['query'][_0x866d('0x3d')]){_0x43db7b[_0x866d('0x3e')]=[{'all':!![]}];}_0x43db7b=_['merge']({},_0x43db7b,_0x104bb4['options']);return db[_0x866d('0x3c')][_0x866d('0x44')](_0x43db7b)[_0x866d('0x22')](handleEntityNotFound(_0x15ba93,null))[_0x866d('0x22')](respondWithResult(_0x15ba93,null))[_0x866d('0x45')](handleError(_0x15ba93,null));};exports[_0x866d('0x46')]=function(_0x5e5be4,_0x1eedf7){return db['AnalyticTreeReport']['create'](_0x5e5be4[_0x866d('0x47')],{})['then'](respondWithResult(_0x1eedf7,0xc9))[_0x866d('0x45')](handleError(_0x1eedf7,null));};exports[_0x866d('0x20')]=function(_0x6bcc3f,_0x390e01){if(_0x6bcc3f[_0x866d('0x47')]['id']){delete _0x6bcc3f[_0x866d('0x47')]['id'];}return db[_0x866d('0x3c')]['find']({'where':{'id':_0x6bcc3f[_0x866d('0x41')]['id']}})[_0x866d('0x22')](handleEntityNotFound(_0x390e01,null))[_0x866d('0x22')](saveUpdates(_0x6bcc3f['body'],null))[_0x866d('0x22')](respondWithResult(_0x390e01,null))[_0x866d('0x45')](handleError(_0x390e01,null));};exports['destroy']=function(_0x472890,_0x191ae0){return db[_0x866d('0x3c')][_0x866d('0x44')]({'where':{'id':_0x472890['params']['id']}})[_0x866d('0x22')](handleEntityNotFound(_0x191ae0,null))['then'](removeEntity(_0x191ae0,null))['catch'](handleError(_0x191ae0,null));}; \ No newline at end of file +var _0x9fff=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','AnalyticTreeReport','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x548733,_0x33a111){var _0x368ad4=function(_0x394779){while(--_0x394779){_0x548733['push'](_0x548733['shift']());}};_0x368ad4(++_0x33a111);}(_0x9fff,0x1c5));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf9ff('0x0'));var zipdir=require(_0xf9ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9ff('0x2'));var moment=require(_0xf9ff('0x3'));var BPromise=require(_0xf9ff('0x4'));var Mustache=require(_0xf9ff('0x5'));var util=require(_0xf9ff('0x6'));var path=require(_0xf9ff('0x7'));var sox=require(_0xf9ff('0x8'));var csv=require(_0xf9ff('0x9'));var ejs=require(_0xf9ff('0xa'));var fs=require('fs');var fs_extra=require(_0xf9ff('0xb'));var _=require(_0xf9ff('0xc'));var squel=require(_0xf9ff('0xd'));var crypto=require(_0xf9ff('0xe'));var jsforce=require(_0xf9ff('0xf'));var deskjs=require(_0xf9ff('0x10'));var toCsv=require(_0xf9ff('0x9'));var querystring=require(_0xf9ff('0x11'));var Papa=require(_0xf9ff('0x12'));var Redis=require('ioredis');var authService=require(_0xf9ff('0x13'));var qs=require(_0xf9ff('0x14'));var as=require(_0xf9ff('0x15'));var hardwareService=require(_0xf9ff('0x16'));var logger=require(_0xf9ff('0x17'))('api');var utils=require(_0xf9ff('0x18'));var config=require(_0xf9ff('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x150f1f,_0x441fef){_0x441fef=_0x441fef||0xcc;return function(_0x47a6ce){if(_0x47a6ce){return _0x150f1f[_0xf9ff('0x1a')](_0x441fef);}return _0x150f1f[_0xf9ff('0x1b')](_0x441fef)[_0xf9ff('0x1c')]();};}function respondWithResult(_0x36cb91,_0xd66a73){_0xd66a73=_0xd66a73||0xc8;return function(_0x2ca3f7){if(_0x2ca3f7){return _0x36cb91[_0xf9ff('0x1b')](_0xd66a73)[_0xf9ff('0x1d')](_0x2ca3f7);}};}function respondWithFilteredResult(_0x7c54bd,_0x37f8b7){return function(_0x501196){if(_0x501196){var _0x523f27=typeof _0x37f8b7['offset']===_0xf9ff('0x1e')&&typeof _0x37f8b7[_0xf9ff('0x1f')]===_0xf9ff('0x1e');var _0x50dbc2=_0x501196['count'];var _0x3f01c0=_0x523f27?0x0:_0x37f8b7[_0xf9ff('0x20')];var _0x1dc08e=_0x523f27?_0x501196[_0xf9ff('0x21')]:_0x37f8b7[_0xf9ff('0x20')]+_0x37f8b7[_0xf9ff('0x1f')];var _0x674baf;if(_0x1dc08e>=_0x50dbc2){_0x1dc08e=_0x50dbc2;_0x674baf=0xc8;}else{_0x674baf=0xce;}_0x7c54bd[_0xf9ff('0x1b')](_0x674baf);return _0x7c54bd[_0xf9ff('0x22')](_0xf9ff('0x23'),_0x3f01c0+'-'+_0x1dc08e+'/'+_0x50dbc2)[_0xf9ff('0x1d')](_0x501196);}return null;};}function patchUpdates(_0x3d8665){return function(_0x76e424){try{jsonpatch[_0xf9ff('0x24')](_0x76e424,_0x3d8665,!![]);}catch(_0x2d9de8){return BPromise[_0xf9ff('0x25')](_0x2d9de8);}return _0x76e424[_0xf9ff('0x26')]();};}function saveUpdates(_0xfeaced,_0x1b3c07){return function(_0x5bc9ad){if(_0x5bc9ad){return _0x5bc9ad['update'](_0xfeaced)[_0xf9ff('0x27')](function(_0x3207db){return _0x3207db;});}return null;};}function removeEntity(_0x182039,_0x132256){return function(_0xf5a3e9){if(_0xf5a3e9){return _0xf5a3e9[_0xf9ff('0x28')]()[_0xf9ff('0x27')](function(){_0x182039[_0xf9ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdd78,_0x1df769){return function(_0x531c3d){if(!_0x531c3d){_0x4fdd78[_0xf9ff('0x1a')](0x194);}return _0x531c3d;};}function handleError(_0x4b7c94,_0x4f81b5){_0x4f81b5=_0x4f81b5||0x1f4;return function(_0x307c89){logger[_0xf9ff('0x29')](_0x307c89[_0xf9ff('0x2a')]);if(_0x307c89[_0xf9ff('0x2b')]){delete _0x307c89['name'];}_0x4b7c94['status'](_0x4f81b5)['send'](_0x307c89);};}exports['index']=function(_0x333646,_0x39e4e9){var _0x1382e5={},_0x2abdcd={},_0xfe4f14={'count':0x0,'rows':[]};var _0x1aac3b=_[_0xf9ff('0x2c')](db[_0xf9ff('0x2d')][_0xf9ff('0x2e')],function(_0x25f3ca){return{'name':_0x25f3ca['fieldName'],'type':_0x25f3ca['type'][_0xf9ff('0x2f')]};});_0x2abdcd[_0xf9ff('0x30')]=_[_0xf9ff('0x2c')](_0x1aac3b,_0xf9ff('0x2b'));_0x2abdcd['query']=_[_0xf9ff('0x31')](_0x333646[_0xf9ff('0x32')]);_0x2abdcd['filters']=_[_0xf9ff('0x33')](_0x2abdcd['model'],_0x2abdcd[_0xf9ff('0x32')]);_0x1382e5['attributes']=_[_0xf9ff('0x33')](_0x2abdcd[_0xf9ff('0x30')],qs['fields'](_0x333646[_0xf9ff('0x32')][_0xf9ff('0x34')]));_0x1382e5[_0xf9ff('0x35')]=_0x1382e5[_0xf9ff('0x35')][_0xf9ff('0x36')]?_0x1382e5[_0xf9ff('0x35')]:_0x2abdcd[_0xf9ff('0x30')];if(!_0x333646[_0xf9ff('0x32')][_0xf9ff('0x37')](_0xf9ff('0x38'))){_0x1382e5[_0xf9ff('0x1f')]=qs['limit'](_0x333646[_0xf9ff('0x32')][_0xf9ff('0x1f')]);_0x1382e5[_0xf9ff('0x20')]=qs[_0xf9ff('0x20')](_0x333646['query'][_0xf9ff('0x20')]);}_0x1382e5[_0xf9ff('0x39')]=qs[_0xf9ff('0x3a')](_0x333646[_0xf9ff('0x32')]['sort']);_0x1382e5[_0xf9ff('0x3b')]=qs['filters'](_[_0xf9ff('0x3c')](_0x333646[_0xf9ff('0x32')],_0x2abdcd['filters']),_0x1aac3b);if(_0x333646[_0xf9ff('0x32')][_0xf9ff('0x3d')]){_0x1382e5[_0xf9ff('0x3b')]=_[_0xf9ff('0x3e')](_0x1382e5['where'],{'$or':_[_0xf9ff('0x2c')](_0x1aac3b,function(_0x1ca68d){if(_0x1ca68d[_0xf9ff('0x3f')]!==_0xf9ff('0x40')){var _0x42b183={};_0x42b183[_0x1ca68d['name']]={'$like':'%'+_0x333646[_0xf9ff('0x32')][_0xf9ff('0x3d')]+'%'};return _0x42b183;}})});}_0x1382e5=_[_0xf9ff('0x3e')]({},_0x1382e5,_0x333646[_0xf9ff('0x41')]);var _0x4a5188={'where':_0x1382e5[_0xf9ff('0x3b')]};return db['AnalyticTreeReport'][_0xf9ff('0x21')](_0x4a5188)['then'](function(_0x2b8aa8){_0xfe4f14['count']=_0x2b8aa8;if(_0x333646[_0xf9ff('0x32')]['includeAll']){_0x1382e5[_0xf9ff('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xf9ff('0x43')](_0x1382e5);})[_0xf9ff('0x27')](function(_0xaa8851){_0xfe4f14[_0xf9ff('0x44')]=_0xaa8851;return _0xfe4f14;})[_0xf9ff('0x27')](respondWithFilteredResult(_0x39e4e9,_0x1382e5))[_0xf9ff('0x45')](handleError(_0x39e4e9,null));};exports[_0xf9ff('0x46')]=function(_0x3d91f8,_0x45314a){var _0x11eab5={'raw':!![],'where':{'id':_0x3d91f8[_0xf9ff('0x47')]['id']}},_0x3655ca={};_0x3655ca[_0xf9ff('0x30')]=_[_0xf9ff('0x31')](db[_0xf9ff('0x2d')][_0xf9ff('0x2e')]);_0x3655ca[_0xf9ff('0x32')]=_[_0xf9ff('0x31')](_0x3d91f8[_0xf9ff('0x32')]);_0x3655ca['filters']=_[_0xf9ff('0x33')](_0x3655ca[_0xf9ff('0x30')],_0x3655ca[_0xf9ff('0x32')]);_0x11eab5[_0xf9ff('0x35')]=_[_0xf9ff('0x33')](_0x3655ca[_0xf9ff('0x30')],qs['fields'](_0x3d91f8['query'][_0xf9ff('0x34')]));_0x11eab5[_0xf9ff('0x35')]=_0x11eab5[_0xf9ff('0x35')]['length']?_0x11eab5['attributes']:_0x3655ca['model'];if(_0x3d91f8[_0xf9ff('0x32')][_0xf9ff('0x48')]){_0x11eab5[_0xf9ff('0x42')]=[{'all':!![]}];}_0x11eab5=_[_0xf9ff('0x3e')]({},_0x11eab5,_0x3d91f8['options']);return db[_0xf9ff('0x2d')][_0xf9ff('0x49')](_0x11eab5)[_0xf9ff('0x27')](handleEntityNotFound(_0x45314a,null))[_0xf9ff('0x27')](respondWithResult(_0x45314a,null))[_0xf9ff('0x45')](handleError(_0x45314a,null));};exports['create']=function(_0x2b174d,_0x327fec){return db['AnalyticTreeReport'][_0xf9ff('0x4a')](_0x2b174d[_0xf9ff('0x4b')],{})[_0xf9ff('0x27')](respondWithResult(_0x327fec,0xc9))['catch'](handleError(_0x327fec,null));};exports[_0xf9ff('0x4c')]=function(_0x481a1a,_0x1d597a){if(_0x481a1a['body']['id']){delete _0x481a1a[_0xf9ff('0x4b')]['id'];}return db['AnalyticTreeReport'][_0xf9ff('0x49')]({'where':{'id':_0x481a1a[_0xf9ff('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d597a,null))[_0xf9ff('0x27')](saveUpdates(_0x481a1a[_0xf9ff('0x4b')],null))[_0xf9ff('0x27')](respondWithResult(_0x1d597a,null))[_0xf9ff('0x45')](handleError(_0x1d597a,null));};exports[_0xf9ff('0x28')]=function(_0x3b3023,_0x13284e){return db[_0xf9ff('0x2d')][_0xf9ff('0x49')]({'where':{'id':_0x3b3023[_0xf9ff('0x47')]['id']}})[_0xf9ff('0x27')](handleEntityNotFound(_0x13284e,null))[_0xf9ff('0x27')](removeEntity(_0x13284e,null))[_0xf9ff('0x45')](handleError(_0x13284e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index eb1480c..c3ea4ef 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 _0x6ef5=['define','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x33b00c,_0x147745){var _0x5697dc=function(_0x45abc0){while(--_0x45abc0){_0x33b00c['push'](_0x33b00c['shift']());}};_0x5697dc(++_0x147745);}(_0x6ef5,0x91));var _0x56ef=function(_0x518af1,_0x1c142f){_0x518af1=_0x518af1-0x0;var _0x22d145=_0x6ef5[_0x518af1];return _0x22d145;};'use strict';var _=require(_0x56ef('0x0'));var util=require('util');var logger=require(_0x56ef('0x1'))(_0x56ef('0x2'));var moment=require(_0x56ef('0x3'));var BPromise=require(_0x56ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ef('0x5'));var rimraf=require(_0x56ef('0x6'));var config=require(_0x56ef('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x56ef('0x8')]=function(_0x49ab0d,_0x54adab){return _0x49ab0d[_0x56ef('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x56ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3176=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x2b6d5a,_0x3ed4b3){var _0x29c159=function(_0x3b66e5){while(--_0x3b66e5){_0x2b6d5a['push'](_0x2b6d5a['shift']());}};_0x29c159(++_0x3ed4b3);}(_0x3176,0x1e4));var _0x6317=function(_0x4d34ec,_0x291b62){_0x4d34ec=_0x4d34ec-0x0;var _0x1b0bab=_0x3176[_0x4d34ec];return _0x1b0bab;};'use strict';var _=require(_0x6317('0x0'));var util=require('util');var logger=require(_0x6317('0x1'))('api');var moment=require(_0x6317('0x2'));var BPromise=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var fs=require('fs');var path=require(_0x6317('0x5'));var rimraf=require(_0x6317('0x6'));var config=require(_0x6317('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x6317('0x8')]=function(_0x477ae6,_0x3d838a){return _0x477ae6[_0x6317('0x9')](_0x6317('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 161a37a..ddaf012 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3462eb,_0x7747e7){var _0x4bbe7f=function(_0x74f0ca){while(--_0x74f0ca){_0x3462eb['push'](_0x3462eb['shift']());}};_0x4bbe7f(++_0x7747e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1876f1,_0x5a44e1){_0x1876f1=_0x1876f1-0x0;var _0x499e13=_0x5f2f[_0x1876f1];return _0x499e13;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e76c7,_0x33e0fe){_0x5e76c7=_0x5e76c7-0x0;var _0x497fb3=_0x2ef3[_0x5e76c7];return _0x497fb3;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 779b2f4..bbc29f2 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 _0x8303=['./analyticTreeReport.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d0b2e,_0x1a6a14){var _0x58e36c=function(_0x13187c){while(--_0x13187c){_0x1d0b2e['push'](_0x1d0b2e['shift']());}};_0x58e36c(++_0x1a6a14);}(_0x8303,0xb3));var _0x3830=function(_0x4f9ff3,_0x108236){_0x4f9ff3=_0x4f9ff3-0x0;var _0x1a6c55=_0x8303[_0x4f9ff3];return _0x1a6c55;};'use strict';var multer=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var path=require(_0x3830('0x2'));var timeout=require(_0x3830('0x3'));var express=require(_0x3830('0x4'));var router=express[_0x3830('0x5')]();var fs_extra=require(_0x3830('0x6'));var auth=require(_0x3830('0x7'));var interaction=require(_0x3830('0x8'));var config=require(_0x3830('0x9'));var controller=require(_0x3830('0xa'));router[_0x3830('0xb')]('/',auth[_0x3830('0xc')](),controller[_0x3830('0xd')]);router[_0x3830('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3830('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3830('0xf')](_0x3830('0x10'),auth[_0x3830('0xc')](),controller[_0x3830('0x11')]);router[_0x3830('0x12')](_0x3830('0x10'),auth[_0x3830('0xc')](),controller[_0x3830('0x13')]);module[_0x3830('0x14')]=router; \ No newline at end of file +var _0x699f=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b75d8,_0x3f9e87){var _0x2165c5=function(_0x49bcd7){while(--_0x49bcd7){_0x1b75d8['push'](_0x1b75d8['shift']());}};_0x2165c5(++_0x3f9e87);}(_0x699f,0x1b1));var _0xf699=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x699f[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xf699('0x0'));var util=require('util');var path=require(_0xf699('0x1'));var timeout=require('connect-timeout');var express=require(_0xf699('0x2'));var router=express[_0xf699('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf699('0x4'));var interaction=require(_0xf699('0x5'));var config=require(_0xf699('0x6'));var controller=require(_0xf699('0x7'));router[_0xf699('0x8')]('/',auth[_0xf699('0x9')](),controller[_0xf699('0xa')]);router['get'](_0xf699('0xb'),auth[_0xf699('0x9')](),controller[_0xf699('0xc')]);router[_0xf699('0xd')]('/',auth[_0xf699('0x9')](),controller[_0xf699('0xe')]);router[_0xf699('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf699('0x10')]);router[_0xf699('0x11')](_0xf699('0xb'),auth[_0xf699('0x9')](),controller[_0xf699('0x12')]);module[_0xf699('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5da17e2..0aff3f0 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 _0x833b=['STRING','exports'];(function(_0x2a3925,_0x4dceff){var _0x47f797=function(_0x2e2185){while(--_0x2e2185){_0x2a3925['push'](_0x2a3925['shift']());}};_0x47f797(++_0x4dceff);}(_0x833b,0x131));var _0xb833=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x833b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require('sequelize');module[_0xb833('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xb833('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x684d=['exports','STRING'];(function(_0x2bbf4e,_0x21ddbc){var _0x39d499=function(_0x3184f9){while(--_0x3184f9){_0x2bbf4e['push'](_0x2bbf4e['shift']());}};_0x39d499(++_0x21ddbc);}(_0x684d,0x174));var _0xd684=function(_0x59e579,_0x214c5a){_0x59e579=_0x59e579-0x0;var _0x315dfd=_0x684d[_0x59e579];return _0x315dfd;};'use strict';var Sequelize=require('sequelize');module[_0xd684('0x0')]={'name':{'type':Sequelize[_0xd684('0x1')]},'basename':{'type':Sequelize[_0xd684('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0b2c28e..cfc2aa4 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 _0x37bd=['fs-extra','lodash','squel','crypto','jsforce','desk.js','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','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','Attachment','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','params','find','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','mimetype','download','findOne','root','server/files/attachments/','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x8583e,_0x1f965c){var _0x1ba58a=function(_0x3a1d5e){while(--_0x3a1d5e){_0x8583e['push'](_0x8583e['shift']());}};_0x1ba58a(++_0x1f965c);}(_0x37bd,0x15a));var _0xd37b=function(_0x42764a,_0x546e27){_0x42764a=_0x42764a-0x0;var _0x3fdee0=_0x37bd[_0x42764a];return _0x3fdee0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd37b('0x0'));var zipdir=require(_0xd37b('0x1'));var jsonpatch=require(_0xd37b('0x2'));var rp=require(_0xd37b('0x3'));var moment=require(_0xd37b('0x4'));var BPromise=require(_0xd37b('0x5'));var Mustache=require(_0xd37b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd37b('0x7'));var csv=require(_0xd37b('0x8'));var ejs=require(_0xd37b('0x9'));var fs=require('fs');var fs_extra=require(_0xd37b('0xa'));var _=require(_0xd37b('0xb'));var squel=require(_0xd37b('0xc'));var crypto=require(_0xd37b('0xd'));var jsforce=require(_0xd37b('0xe'));var deskjs=require(_0xd37b('0xf'));var toCsv=require(_0xd37b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd37b('0x10'));var authService=require(_0xd37b('0x11'));var qs=require(_0xd37b('0x12'));var as=require(_0xd37b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd37b('0x14'))(_0xd37b('0x15'));var utils=require(_0xd37b('0x16'));var config=require(_0xd37b('0x17'));var licenseUtil=require(_0xd37b('0x18'));var db=require(_0xd37b('0x19'))['db'];function respondWithStatusCode(_0x21b839,_0x5e95de){_0x5e95de=_0x5e95de||0xcc;return function(_0x23e83d){if(_0x23e83d){return _0x21b839[_0xd37b('0x1a')](_0x5e95de);}return _0x21b839[_0xd37b('0x1b')](_0x5e95de)[_0xd37b('0x1c')]();};}function respondWithResult(_0x192ecf,_0x3f7315){_0x3f7315=_0x3f7315||0xc8;return function(_0x210f25){if(_0x210f25){return _0x192ecf[_0xd37b('0x1b')](_0x3f7315)[_0xd37b('0x1d')](_0x210f25);}};}function respondWithFilteredResult(_0x2b1ae0,_0x3e0917){return function(_0x572152){if(_0x572152){var _0x14c455=typeof _0x3e0917[_0xd37b('0x1e')]===_0xd37b('0x1f')&&typeof _0x3e0917[_0xd37b('0x20')]===_0xd37b('0x1f');var _0x5e44a8=_0x572152[_0xd37b('0x21')];var _0x34aec1=_0x14c455?0x0:_0x3e0917[_0xd37b('0x1e')];var _0x267d3d=_0x14c455?_0x572152[_0xd37b('0x21')]:_0x3e0917[_0xd37b('0x1e')]+_0x3e0917['limit'];var _0x580e22;if(_0x267d3d>=_0x5e44a8){_0x267d3d=_0x5e44a8;_0x580e22=0xc8;}else{_0x580e22=0xce;}_0x2b1ae0['status'](_0x580e22);return _0x2b1ae0[_0xd37b('0x22')](_0xd37b('0x23'),_0x34aec1+'-'+_0x267d3d+'/'+_0x5e44a8)[_0xd37b('0x1d')](_0x572152);}return null;};}function patchUpdates(_0x2e3469){return function(_0x3ecb12){try{jsonpatch[_0xd37b('0x24')](_0x3ecb12,_0x2e3469,!![]);}catch(_0x24d1de){return BPromise['reject'](_0x24d1de);}return _0x3ecb12['save']();};}function saveUpdates(_0x44b779,_0x39f606){return function(_0x18b681){if(_0x18b681){return _0x18b681[_0xd37b('0x25')](_0x44b779)['then'](function(_0x2d74d1){return _0x2d74d1;});}return null;};}function removeEntity(_0x29fe1e,_0x450a90){return function(_0x2d2894){if(_0x2d2894){return _0x2d2894['destroy']()[_0xd37b('0x26')](function(){_0x29fe1e[_0xd37b('0x1b')](0xcc)[_0xd37b('0x1c')]();});}};}function handleEntityNotFound(_0x41b779,_0x2c6d9b){return function(_0x10ab6a){if(!_0x10ab6a){_0x41b779[_0xd37b('0x1a')](0x194);}return _0x10ab6a;};}function handleError(_0x267545,_0x12d8b1){_0x12d8b1=_0x12d8b1||0x1f4;return function(_0x318256){logger[_0xd37b('0x27')](_0x318256[_0xd37b('0x28')]);if(_0x318256[_0xd37b('0x29')]){delete _0x318256[_0xd37b('0x29')];}_0x267545[_0xd37b('0x1b')](_0x12d8b1)['send'](_0x318256);};}exports[_0xd37b('0x2a')]=function(_0x30ae8d,_0x57a608){var _0xe1ebb1={},_0x280b4e={},_0x5390cf={'count':0x0,'rows':[]};var _0x2a36e9=_['map'](db[_0xd37b('0x2b')][_0xd37b('0x2c')],function(_0x1eef0a){return{'name':_0x1eef0a[_0xd37b('0x2d')],'type':_0x1eef0a['type'][_0xd37b('0x2e')]};});_0x280b4e['model']=_['map'](_0x2a36e9,_0xd37b('0x29'));_0x280b4e['query']=_['keys'](_0x30ae8d[_0xd37b('0x2f')]);_0x280b4e[_0xd37b('0x30')]=_[_0xd37b('0x31')](_0x280b4e[_0xd37b('0x32')],_0x280b4e['query']);_0xe1ebb1[_0xd37b('0x33')]=_[_0xd37b('0x31')](_0x280b4e[_0xd37b('0x32')],qs[_0xd37b('0x34')](_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x34')]));_0xe1ebb1[_0xd37b('0x33')]=_0xe1ebb1['attributes'][_0xd37b('0x35')]?_0xe1ebb1[_0xd37b('0x33')]:_0x280b4e['model'];if(!_0x30ae8d[_0xd37b('0x2f')]['hasOwnProperty'](_0xd37b('0x36'))){_0xe1ebb1[_0xd37b('0x20')]=qs[_0xd37b('0x20')](_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x20')]);_0xe1ebb1[_0xd37b('0x1e')]=qs['offset'](_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x1e')]);}_0xe1ebb1[_0xd37b('0x37')]=qs[_0xd37b('0x38')](_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x38')]);_0xe1ebb1[_0xd37b('0x39')]=qs[_0xd37b('0x30')](_[_0xd37b('0x3a')](_0x30ae8d[_0xd37b('0x2f')],_0x280b4e['filters']),_0x2a36e9);if(_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x3b')]){_0xe1ebb1['where']=_['merge'](_0xe1ebb1[_0xd37b('0x39')],{'$or':_[_0xd37b('0x3c')](_0x2a36e9,function(_0x2e4e7d){if(_0x2e4e7d[_0xd37b('0x3d')]!==_0xd37b('0x3e')){var _0x890145={};_0x890145[_0x2e4e7d[_0xd37b('0x29')]]={'$like':'%'+_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x3b')]+'%'};return _0x890145;}})});}_0xe1ebb1=_[_0xd37b('0x3f')]({},_0xe1ebb1,_0x30ae8d[_0xd37b('0x40')]);var _0x4baea7={'where':_0xe1ebb1[_0xd37b('0x39')]};return db['Attachment']['count'](_0x4baea7)[_0xd37b('0x26')](function(_0x140cf7){_0x5390cf[_0xd37b('0x21')]=_0x140cf7;if(_0x30ae8d[_0xd37b('0x2f')][_0xd37b('0x41')]){_0xe1ebb1[_0xd37b('0x42')]=[{'all':!![]}];}return db[_0xd37b('0x2b')][_0xd37b('0x43')](_0xe1ebb1);})[_0xd37b('0x26')](function(_0x3ae61d){_0x5390cf['rows']=_0x3ae61d;return _0x5390cf;})['then'](respondWithFilteredResult(_0x57a608,_0xe1ebb1))[_0xd37b('0x44')](handleError(_0x57a608,null));};exports[_0xd37b('0x45')]=function(_0x5eff0a,_0xe03fc0){var _0x17497b={'raw':!![],'where':{'id':_0x5eff0a['params']['id']}},_0x53258c={};_0x53258c[_0xd37b('0x32')]=_[_0xd37b('0x46')](db[_0xd37b('0x2b')][_0xd37b('0x2c')]);_0x53258c[_0xd37b('0x2f')]=_[_0xd37b('0x46')](_0x5eff0a[_0xd37b('0x2f')]);_0x53258c['filters']=_['intersection'](_0x53258c['model'],_0x53258c[_0xd37b('0x2f')]);_0x17497b[_0xd37b('0x33')]=_[_0xd37b('0x31')](_0x53258c['model'],qs[_0xd37b('0x34')](_0x5eff0a[_0xd37b('0x2f')][_0xd37b('0x34')]));_0x17497b[_0xd37b('0x33')]=_0x17497b[_0xd37b('0x33')][_0xd37b('0x35')]?_0x17497b[_0xd37b('0x33')]:_0x53258c['model'];if(_0x5eff0a[_0xd37b('0x2f')]['includeAll']){_0x17497b['include']=[{'all':!![]}];}_0x17497b=_[_0xd37b('0x3f')]({},_0x17497b,_0x5eff0a['options']);return db['Attachment']['find'](_0x17497b)['then'](handleEntityNotFound(_0xe03fc0,null))[_0xd37b('0x26')](respondWithResult(_0xe03fc0,null))[_0xd37b('0x44')](handleError(_0xe03fc0,null));};exports['clone']=function(_0x371529,_0xdb298f){var _0x53f4fd={'where':{'id':_0x371529[_0xd37b('0x47')]['id']}},_0x2ee369={};_0x2ee369[_0xd37b('0x32')]=_['keys'](db[_0xd37b('0x2b')][_0xd37b('0x2c')]);_0x53f4fd[_0xd37b('0x33')]=_['intersection'](_0x2ee369[_0xd37b('0x32')],qs[_0xd37b('0x34')](_0x371529[_0xd37b('0x2f')][_0xd37b('0x34')]));_0x53f4fd[_0xd37b('0x33')]=_0x53f4fd['attributes'][_0xd37b('0x35')]?_0x53f4fd['attributes']:_0x2ee369[_0xd37b('0x32')];if(_0x371529[_0xd37b('0x2f')][_0xd37b('0x41')]){_0x53f4fd[_0xd37b('0x42')]=[{'all':!![]}];}_0x53f4fd=_[_0xd37b('0x3f')]({},_0x53f4fd,_0x371529['options']);return db[_0xd37b('0x2b')][_0xd37b('0x48')](_0x53f4fd)[_0xd37b('0x26')](handleEntityNotFound(_0xdb298f,null))[_0xd37b('0x26')](function(_0x56a855){if(_0x56a855){var _0x442267=_0x56a855[_0xd37b('0x49')]({'plain':!![]});_0x442267=qs[_0xd37b('0x4a')](_0x442267,['id',_0xd37b('0x4b'),_0xd37b('0x4c')]);_0x371529[_0xd37b('0x4d')]=_[_0xd37b('0x4a')](_0x371529['body'],['id',_0xd37b('0x4b'),'updatedAt']);return db[_0xd37b('0x2b')][_0xd37b('0x4e')](_[_0xd37b('0x3f')](_0x442267,_0x371529[_0xd37b('0x4d')]),{'include':_0x371529['query'][_0xd37b('0x41')]?[{'all':!![]}]:undefined});}})[_0xd37b('0x26')](respondWithResult(_0xdb298f,0xc9))[_0xd37b('0x44')](handleError(_0xdb298f,null));};exports[_0xd37b('0x25')]=function(_0x452754,_0x39a042){if(_0x452754[_0xd37b('0x4d')]['id']){delete _0x452754[_0xd37b('0x4d')]['id'];}return db[_0xd37b('0x2b')][_0xd37b('0x48')]({'where':{'id':_0x452754[_0xd37b('0x47')]['id']}})[_0xd37b('0x26')](handleEntityNotFound(_0x39a042,null))[_0xd37b('0x26')](saveUpdates(_0x452754[_0xd37b('0x4d')],null))[_0xd37b('0x26')](respondWithResult(_0x39a042,null))[_0xd37b('0x44')](handleError(_0x39a042,null));};exports[_0xd37b('0x4f')]=function(_0x4b390c,_0x49e50a){return db['Attachment'][_0xd37b('0x48')]({'where':{'id':_0x4b390c['params']['id']}})['then'](handleEntityNotFound(_0x49e50a,null))[_0xd37b('0x26')](removeEntity(_0x49e50a,null))[_0xd37b('0x44')](handleError(_0x49e50a,null));};exports['create']=function(_0x3ade60,_0x41534d,_0x15c8ef){_0x3ade60[_0xd37b('0x4d')][_0xd37b('0x29')]=_0x3ade60[_0xd37b('0x50')][_0xd37b('0x51')];_0x3ade60[_0xd37b('0x4d')][_0xd37b('0x52')]=_0x3ade60[_0xd37b('0x50')]['filename'];_0x3ade60['body'][_0xd37b('0x3d')]=_0x3ade60[_0xd37b('0x50')][_0xd37b('0x53')];return db['Attachment']['create'](_0x3ade60[_0xd37b('0x4d')])[_0xd37b('0x26')](respondWithResult(_0x41534d,0xc9))[_0xd37b('0x44')](handleError(_0x41534d,null));};exports[_0xd37b('0x54')]=function(_0x40b6bb,_0xe0348f,_0x54d2db){return db[_0xd37b('0x2b')][_0xd37b('0x55')]({'where':{'id':_0x40b6bb[_0xd37b('0x47')]['id']},'raw':!![]})[_0xd37b('0x26')](handleEntityNotFound(_0xe0348f,null))['then'](function(_0x3998ce){if(_0x3998ce){var _0x577dd6=_0x3998ce['ChatOfflineMessageId']!==null;var _0x242d90=path['join'](config[_0xd37b('0x56')],_0xd37b('0x57'));if(_0x577dd6){_0x242d90=path[_0xd37b('0x58')](_0x242d90,'offline-chat/');}var _0x4f3a4f=path[_0xd37b('0x58')](_0x242d90,_0x3998ce[_0xd37b('0x52')]);return _0xe0348f[_0xd37b('0x54')](_0x4f3a4f);}})['catch'](handleError(_0xe0348f,null));}; \ No newline at end of file +var _0xec58=['where','pick','filter','VIRTUAL','findAll','rows','catch','include','merge','options','find','includeAll','get','omit','createdAt','updatedAt','body','create','params','file','originalname','mimetype','download','findOne','join','root','offline-chat/','basename','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xec58,0x6f));var _0x8ec5=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0xec58[_0x59b9d3];return _0x171163;};'use strict';var emlformat=require(_0x8ec5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ec5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ec5('0x2'));var BPromise=require(_0x8ec5('0x3'));var Mustache=require(_0x8ec5('0x4'));var util=require(_0x8ec5('0x5'));var path=require(_0x8ec5('0x6'));var sox=require(_0x8ec5('0x7'));var csv=require(_0x8ec5('0x8'));var ejs=require(_0x8ec5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8ec5('0xa'));var crypto=require(_0x8ec5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8ec5('0xc'));var toCsv=require(_0x8ec5('0x8'));var querystring=require(_0x8ec5('0xd'));var Papa=require('papaparse');var Redis=require(_0x8ec5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8ec5('0xf'));var as=require(_0x8ec5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8ec5('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ec5('0x12'))['db'];function respondWithStatusCode(_0x49d7d7,_0x1656b2){_0x1656b2=_0x1656b2||0xcc;return function(_0x148c16){if(_0x148c16){return _0x49d7d7[_0x8ec5('0x13')](_0x1656b2);}return _0x49d7d7[_0x8ec5('0x14')](_0x1656b2)[_0x8ec5('0x15')]();};}function respondWithResult(_0x225eec,_0x11449c){_0x11449c=_0x11449c||0xc8;return function(_0x2e0507){if(_0x2e0507){return _0x225eec[_0x8ec5('0x14')](_0x11449c)[_0x8ec5('0x16')](_0x2e0507);}};}function respondWithFilteredResult(_0x398d38,_0x2ceb4f){return function(_0x111623){if(_0x111623){var _0x510026=typeof _0x2ceb4f['offset']===_0x8ec5('0x17')&&typeof _0x2ceb4f[_0x8ec5('0x18')]===_0x8ec5('0x17');var _0x29fdd2=_0x111623[_0x8ec5('0x19')];var _0x3a73fa=_0x510026?0x0:_0x2ceb4f['offset'];var _0x50c2fe=_0x510026?_0x111623[_0x8ec5('0x19')]:_0x2ceb4f[_0x8ec5('0x1a')]+_0x2ceb4f[_0x8ec5('0x18')];var _0x592338;if(_0x50c2fe>=_0x29fdd2){_0x50c2fe=_0x29fdd2;_0x592338=0xc8;}else{_0x592338=0xce;}_0x398d38[_0x8ec5('0x14')](_0x592338);return _0x398d38[_0x8ec5('0x1b')](_0x8ec5('0x1c'),_0x3a73fa+'-'+_0x50c2fe+'/'+_0x29fdd2)[_0x8ec5('0x16')](_0x111623);}return null;};}function patchUpdates(_0x554089){return function(_0x42e916){try{jsonpatch[_0x8ec5('0x1d')](_0x42e916,_0x554089,!![]);}catch(_0x388e11){return BPromise['reject'](_0x388e11);}return _0x42e916[_0x8ec5('0x1e')]();};}function saveUpdates(_0x8ad7dd,_0x5dc927){return function(_0x1133f3){if(_0x1133f3){return _0x1133f3[_0x8ec5('0x1f')](_0x8ad7dd)['then'](function(_0x37e746){return _0x37e746;});}return null;};}function removeEntity(_0x5526ae,_0x4494f6){return function(_0x3c3f94){if(_0x3c3f94){return _0x3c3f94[_0x8ec5('0x20')]()[_0x8ec5('0x21')](function(){_0x5526ae[_0x8ec5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319fe5,_0xcc182a){return function(_0x695619){if(!_0x695619){_0x319fe5['sendStatus'](0x194);}return _0x695619;};}function handleError(_0x469f05,_0x2de84c){_0x2de84c=_0x2de84c||0x1f4;return function(_0x31c709){logger[_0x8ec5('0x22')](_0x31c709['stack']);if(_0x31c709[_0x8ec5('0x23')]){delete _0x31c709[_0x8ec5('0x23')];}_0x469f05[_0x8ec5('0x14')](_0x2de84c)['send'](_0x31c709);};}exports[_0x8ec5('0x24')]=function(_0x471624,_0x5c799f){var _0x334f31={},_0x476804={},_0x5545dc={'count':0x0,'rows':[]};var _0x35a84f=_[_0x8ec5('0x25')](db[_0x8ec5('0x26')][_0x8ec5('0x27')],function(_0x145003){return{'name':_0x145003[_0x8ec5('0x28')],'type':_0x145003[_0x8ec5('0x29')][_0x8ec5('0x2a')]};});_0x476804['model']=_[_0x8ec5('0x25')](_0x35a84f,_0x8ec5('0x23'));_0x476804[_0x8ec5('0x2b')]=_[_0x8ec5('0x2c')](_0x471624['query']);_0x476804[_0x8ec5('0x2d')]=_['intersection'](_0x476804[_0x8ec5('0x2e')],_0x476804[_0x8ec5('0x2b')]);_0x334f31[_0x8ec5('0x2f')]=_[_0x8ec5('0x30')](_0x476804[_0x8ec5('0x2e')],qs[_0x8ec5('0x31')](_0x471624[_0x8ec5('0x2b')][_0x8ec5('0x31')]));_0x334f31[_0x8ec5('0x2f')]=_0x334f31[_0x8ec5('0x2f')][_0x8ec5('0x32')]?_0x334f31[_0x8ec5('0x2f')]:_0x476804['model'];if(!_0x471624[_0x8ec5('0x2b')][_0x8ec5('0x33')](_0x8ec5('0x34'))){_0x334f31[_0x8ec5('0x18')]=qs[_0x8ec5('0x18')](_0x471624[_0x8ec5('0x2b')][_0x8ec5('0x18')]);_0x334f31[_0x8ec5('0x1a')]=qs[_0x8ec5('0x1a')](_0x471624[_0x8ec5('0x2b')]['offset']);}_0x334f31[_0x8ec5('0x35')]=qs['sort'](_0x471624[_0x8ec5('0x2b')][_0x8ec5('0x36')]);_0x334f31[_0x8ec5('0x37')]=qs[_0x8ec5('0x2d')](_[_0x8ec5('0x38')](_0x471624[_0x8ec5('0x2b')],_0x476804[_0x8ec5('0x2d')]),_0x35a84f);if(_0x471624['query'][_0x8ec5('0x39')]){_0x334f31[_0x8ec5('0x37')]=_['merge'](_0x334f31[_0x8ec5('0x37')],{'$or':_[_0x8ec5('0x25')](_0x35a84f,function(_0x4d8dd9){if(_0x4d8dd9[_0x8ec5('0x29')]!==_0x8ec5('0x3a')){var _0x22375c={};_0x22375c[_0x4d8dd9[_0x8ec5('0x23')]]={'$like':'%'+_0x471624['query']['filter']+'%'};return _0x22375c;}})});}_0x334f31=_['merge']({},_0x334f31,_0x471624['options']);var _0x3a3484={'where':_0x334f31[_0x8ec5('0x37')]};return db[_0x8ec5('0x26')][_0x8ec5('0x19')](_0x3a3484)[_0x8ec5('0x21')](function(_0x2af444){_0x5545dc['count']=_0x2af444;if(_0x471624[_0x8ec5('0x2b')]['includeAll']){_0x334f31['include']=[{'all':!![]}];}return db['Attachment'][_0x8ec5('0x3b')](_0x334f31);})[_0x8ec5('0x21')](function(_0xffe4f5){_0x5545dc[_0x8ec5('0x3c')]=_0xffe4f5;return _0x5545dc;})[_0x8ec5('0x21')](respondWithFilteredResult(_0x5c799f,_0x334f31))[_0x8ec5('0x3d')](handleError(_0x5c799f,null));};exports['show']=function(_0x5bd822,_0x4fd812){var _0x6a3b4={'raw':!![],'where':{'id':_0x5bd822['params']['id']}},_0x55764d={};_0x55764d[_0x8ec5('0x2e')]=_['keys'](db[_0x8ec5('0x26')][_0x8ec5('0x27')]);_0x55764d[_0x8ec5('0x2b')]=_[_0x8ec5('0x2c')](_0x5bd822[_0x8ec5('0x2b')]);_0x55764d['filters']=_['intersection'](_0x55764d[_0x8ec5('0x2e')],_0x55764d[_0x8ec5('0x2b')]);_0x6a3b4[_0x8ec5('0x2f')]=_[_0x8ec5('0x30')](_0x55764d[_0x8ec5('0x2e')],qs[_0x8ec5('0x31')](_0x5bd822[_0x8ec5('0x2b')][_0x8ec5('0x31')]));_0x6a3b4['attributes']=_0x6a3b4[_0x8ec5('0x2f')][_0x8ec5('0x32')]?_0x6a3b4[_0x8ec5('0x2f')]:_0x55764d[_0x8ec5('0x2e')];if(_0x5bd822[_0x8ec5('0x2b')]['includeAll']){_0x6a3b4[_0x8ec5('0x3e')]=[{'all':!![]}];}_0x6a3b4=_[_0x8ec5('0x3f')]({},_0x6a3b4,_0x5bd822[_0x8ec5('0x40')]);return db[_0x8ec5('0x26')][_0x8ec5('0x41')](_0x6a3b4)[_0x8ec5('0x21')](handleEntityNotFound(_0x4fd812,null))['then'](respondWithResult(_0x4fd812,null))['catch'](handleError(_0x4fd812,null));};exports['clone']=function(_0x29b9a7,_0xbe9c86){var _0xff074f={'where':{'id':_0x29b9a7['params']['id']}},_0x352df5={};_0x352df5['model']=_[_0x8ec5('0x2c')](db['Attachment'][_0x8ec5('0x27')]);_0xff074f[_0x8ec5('0x2f')]=_[_0x8ec5('0x30')](_0x352df5[_0x8ec5('0x2e')],qs['fields'](_0x29b9a7[_0x8ec5('0x2b')][_0x8ec5('0x31')]));_0xff074f['attributes']=_0xff074f[_0x8ec5('0x2f')][_0x8ec5('0x32')]?_0xff074f[_0x8ec5('0x2f')]:_0x352df5['model'];if(_0x29b9a7['query'][_0x8ec5('0x42')]){_0xff074f['include']=[{'all':!![]}];}_0xff074f=_[_0x8ec5('0x3f')]({},_0xff074f,_0x29b9a7[_0x8ec5('0x40')]);return db[_0x8ec5('0x26')]['find'](_0xff074f)['then'](handleEntityNotFound(_0xbe9c86,null))[_0x8ec5('0x21')](function(_0x4940ce){if(_0x4940ce){var _0x186ce2=_0x4940ce[_0x8ec5('0x43')]({'plain':!![]});_0x186ce2=qs[_0x8ec5('0x44')](_0x186ce2,['id',_0x8ec5('0x45'),_0x8ec5('0x46')]);_0x29b9a7['body']=_[_0x8ec5('0x44')](_0x29b9a7[_0x8ec5('0x47')],['id',_0x8ec5('0x45'),_0x8ec5('0x46')]);return db[_0x8ec5('0x26')][_0x8ec5('0x48')](_['merge'](_0x186ce2,_0x29b9a7[_0x8ec5('0x47')]),{'include':_0x29b9a7[_0x8ec5('0x2b')][_0x8ec5('0x42')]?[{'all':!![]}]:undefined});}})[_0x8ec5('0x21')](respondWithResult(_0xbe9c86,0xc9))[_0x8ec5('0x3d')](handleError(_0xbe9c86,null));};exports[_0x8ec5('0x1f')]=function(_0x1e9617,_0x804c73){if(_0x1e9617[_0x8ec5('0x47')]['id']){delete _0x1e9617[_0x8ec5('0x47')]['id'];}return db[_0x8ec5('0x26')][_0x8ec5('0x41')]({'where':{'id':_0x1e9617[_0x8ec5('0x49')]['id']}})[_0x8ec5('0x21')](handleEntityNotFound(_0x804c73,null))[_0x8ec5('0x21')](saveUpdates(_0x1e9617[_0x8ec5('0x47')],null))[_0x8ec5('0x21')](respondWithResult(_0x804c73,null))['catch'](handleError(_0x804c73,null));};exports['destroy']=function(_0x34b0c1,_0x464f46){return db[_0x8ec5('0x26')][_0x8ec5('0x41')]({'where':{'id':_0x34b0c1[_0x8ec5('0x49')]['id']}})['then'](handleEntityNotFound(_0x464f46,null))[_0x8ec5('0x21')](removeEntity(_0x464f46,null))[_0x8ec5('0x3d')](handleError(_0x464f46,null));};exports[_0x8ec5('0x48')]=function(_0x403d92,_0x4b4324,_0x5cea8a){_0x403d92[_0x8ec5('0x47')][_0x8ec5('0x23')]=_0x403d92[_0x8ec5('0x4a')][_0x8ec5('0x4b')];_0x403d92[_0x8ec5('0x47')]['basename']=_0x403d92[_0x8ec5('0x4a')]['filename'];_0x403d92[_0x8ec5('0x47')][_0x8ec5('0x29')]=_0x403d92[_0x8ec5('0x4a')][_0x8ec5('0x4c')];return db[_0x8ec5('0x26')]['create'](_0x403d92[_0x8ec5('0x47')])[_0x8ec5('0x21')](respondWithResult(_0x4b4324,0xc9))[_0x8ec5('0x3d')](handleError(_0x4b4324,null));};exports[_0x8ec5('0x4d')]=function(_0x761384,_0x56c28f,_0xa48844){return db['Attachment'][_0x8ec5('0x4e')]({'where':{'id':_0x761384[_0x8ec5('0x49')]['id']},'raw':!![]})[_0x8ec5('0x21')](handleEntityNotFound(_0x56c28f,null))[_0x8ec5('0x21')](function(_0xec39ef){if(_0xec39ef){var _0x8557f5=_0xec39ef['ChatOfflineMessageId']!==null;var _0x5af917=path[_0x8ec5('0x4f')](config[_0x8ec5('0x50')],'server/files/attachments/');if(_0x8557f5){_0x5af917=path['join'](_0x5af917,_0x8ec5('0x51'));}var _0x2e74b3=path[_0x8ec5('0x4f')](_0x5af917,_0xec39ef[_0x8ec5('0x52')]);return _0x56c28f['download'](_0x2e74b3);}})[_0x8ec5('0x3d')](handleError(_0x56c28f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4c93e00..1be117e 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 _0xf765=['exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x14ae2f,_0x2dd861){var _0x2c2542=function(_0x238369){while(--_0x238369){_0x14ae2f['push'](_0x14ae2f['shift']());}};_0x2c2542(++_0x2dd861);}(_0xf765,0x1ee));var _0x5f76=function(_0x2beada,_0x4c816b){_0x2beada=_0x2beada-0x0;var _0x51a1aa=_0xf765[_0x2beada];return _0x51a1aa;};'use strict';var _=require(_0x5f76('0x0'));var util=require(_0x5f76('0x1'));var logger=require(_0x5f76('0x2'))(_0x5f76('0x3'));var moment=require(_0x5f76('0x4'));var BPromise=require(_0x5f76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f76('0x6'));var rimraf=require(_0x5f76('0x7'));var config=require(_0x5f76('0x8'));var attributes=require(_0x5f76('0x9'));module[_0x5f76('0xa')]=function(_0x5cccdb,_0x4a6475){return _0x5cccdb[_0x5f76('0xb')](_0x5f76('0xc'),attributes,{'tableName':_0x5f76('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b8=['bluebird','request-promise','rimraf','../../config/environment','define','Attachment','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5b8,0x96));var _0x8e5b=function(_0x583a12,_0x512ca4){_0x583a12=_0x583a12-0x0;var _0x2b5a72=_0xe5b8[_0x583a12];return _0x2b5a72;};'use strict';var _=require(_0x8e5b('0x0'));var util=require('util');var logger=require(_0x8e5b('0x1'))(_0x8e5b('0x2'));var moment=require('moment');var BPromise=require(_0x8e5b('0x3'));var rp=require(_0x8e5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e5b('0x5'));var config=require(_0x8e5b('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x4c62e4,_0x3c5879){return _0x4c62e4[_0x8e5b('0x7')](_0x8e5b('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c94f929..97bbd53 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 _0x0eaa=['rpc','../../config/environment','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x7e5ad7,_0x2da255){var _0x1e4e12=function(_0x563ed4){while(--_0x563ed4){_0x7e5ad7['push'](_0x7e5ad7['shift']());}};_0x1e4e12(++_0x2da255);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x3288a2,_0x4ac4be){_0x3288a2=_0x3288a2-0x0;var _0x319f4a=_0x0eaa[_0x3288a2];return _0x319f4a;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('Attachment,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});}exports[_0xa0ea('0x15')]=function(_0x405f7f){var _0x581f59=this;return new Promise(function(_0x4ca082,_0xe116e2){return db[_0xa0ea('0x16')][_0xa0ea('0x17')](_0x405f7f[_0xa0ea('0x18')],{'raw':_0x405f7f[_0xa0ea('0x19')]?_0x405f7f[_0xa0ea('0x19')][_0xa0ea('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x916f1){logger[_0xa0ea('0xb')](_0xa0ea('0x15'),_0x405f7f);logger['debug'](_0xa0ea('0x15'),_0x405f7f,JSON[_0xa0ea('0xf')](_0x916f1));_0x4ca082(_0x916f1);})[_0xa0ea('0x14')](function(_0x12cda2){logger[_0xa0ea('0x10')](_0xa0ea('0x15'),_0x12cda2['message'],_0x405f7f);_0xe116e2(_0x581f59[_0xa0ea('0x10')](0x1f4,_0x12cda2['message']));});});}; \ No newline at end of file +var _0x851e=['request\x20sent','error','code','message','result','catch','CreateAttachment','create','body','options','raw','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x737e04,_0x74d4e2){var _0x536eb6=function(_0x2ac74a){while(--_0x2ac74a){_0x737e04['push'](_0x737e04['shift']());}};_0x536eb6(++_0x74d4e2);}(_0x851e,0x1e8));var _0xe851=function(_0xf1081a,_0xfe4f04){_0xf1081a=_0xf1081a-0x0;var _0x311841=_0x851e[_0xf1081a];return _0x311841;};'use strict';var _=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var moment=require(_0xe851('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe851('0x3'));var db=require(_0xe851('0x4'))['db'];var utils=require(_0xe851('0x5'));var logger=require(_0xe851('0x6'))(_0xe851('0x7'));var config=require('../../config/environment');var jayson=require(_0xe851('0x8'));var client=jayson[_0xe851('0x9')][_0xe851('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ac0b,_0x1a2b24,_0x4e1c59){return new BPromise(function(_0x38a43b,_0x5b1046){return client['request'](_0x37ac0b,_0x4e1c59)[_0xe851('0xb')](function(_0x438dc0){logger[_0xe851('0xc')](_0xe851('0xd'),_0x1a2b24,'request\x20sent');logger[_0xe851('0xe')](_0xe851('0xf'),_0x1a2b24,_0xe851('0x10'),JSON['stringify'](_0x438dc0));if(_0x438dc0[_0xe851('0x11')]){if(_0x438dc0['error'][_0xe851('0x12')]===0x1f4){logger[_0xe851('0x11')]('Attachment,\x20%s,\x20%s',_0x1a2b24,_0x438dc0[_0xe851('0x11')]['message']);return _0x5b1046(_0x438dc0[_0xe851('0x11')]['message']);}logger[_0xe851('0x11')](_0xe851('0xd'),_0x1a2b24,_0x438dc0['error'][_0xe851('0x13')]);return _0x38a43b(_0x438dc0[_0xe851('0x11')][_0xe851('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x1a2b24,_0xe851('0x10'));_0x38a43b(_0x438dc0[_0xe851('0x14')][_0xe851('0x13')]);}})[_0xe851('0x15')](function(_0x334adb){logger[_0xe851('0x11')]('Attachment,\x20%s,\x20%s',_0x1a2b24,_0x334adb);_0x5b1046(_0x334adb);});});}exports[_0xe851('0x16')]=function(_0x48a1b3){var _0x2d4cf5=this;return new Promise(function(_0x55dd83,_0x442f57){return db['Attachment'][_0xe851('0x17')](_0x48a1b3[_0xe851('0x18')],{'raw':_0x48a1b3[_0xe851('0x19')]?_0x48a1b3[_0xe851('0x19')][_0xe851('0x1a')]===undefined?!![]:![]:!![]})[_0xe851('0xb')](function(_0x37ab53){logger[_0xe851('0xc')]('CreateAttachment',_0x48a1b3);logger[_0xe851('0xe')]('CreateAttachment',_0x48a1b3,JSON[_0xe851('0x1b')](_0x37ab53));_0x55dd83(_0x37ab53);})['catch'](function(_0x3eb7f9){logger[_0xe851('0x11')]('CreateAttachment',_0x3eb7f9['message'],_0x48a1b3);_0x442f57(_0x2d4cf5[_0xe851('0x11')](0x1f4,_0x3eb7f9[_0xe851('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 2cf099f..2e47e01 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x1f5f6e,_0x1ef787){_0x1f5f6e=_0x1f5f6e-0x0;var _0x31210d=_0xdb28[_0x1f5f6e];return _0x31210d;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x55d487,_0x937a3b){var _0x1d15d7=function(_0x3a818f){while(--_0x3a818f){_0x55d487['push'](_0x55d487['shift']());}};_0x1d15d7(++_0x937a3b);}(_0xadb5,0xad));var _0x5adb=function(_0xa6c2b1,_0x1cad89){_0xa6c2b1=_0xa6c2b1-0x0;var _0x4e738b=_0xadb5[_0xa6c2b1];return _0x4e738b;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index fd78fc4..a555cda 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 _0x3bcf=['activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','online','admin','agent','domain','blockedAt','getLicense','catch','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment'];(function(_0x1d6824,_0x68b57a){var _0x159815=function(_0x1f7d15){while(--_0x1f7d15){_0x1d6824['push'](_0x1d6824['shift']());}};_0x159815(++_0x68b57a);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x3c19f4,_0x17a81f){_0x3c19f4=_0x3c19f4-0x0;var _0x1d3f26=_0x3bcf[_0x3c19f4];return _0x1d3f26;};'use strict';var passport=require(_0xf3bc('0x0'));var LocalStrategy=require(_0xf3bc('0x1'))[_0xf3bc('0x2')];var moment=require(_0xf3bc('0x3'));var ActiveDirectory=require(_0xf3bc('0x4'));var BPromise=require(_0xf3bc('0x5'));var util=require('util');var db=require(_0xf3bc('0x6'))['db'];var authService=require(_0xf3bc('0x7'));var utils=require(_0xf3bc('0x8'));var config=require(_0xf3bc('0x9'));var logger=require('../../config/logger')(_0xf3bc('0xa'));function isActiveDirectoryConfigured(_0x3456d0){var _0x37bae7=![];if(typeof _0x3456d0[_0xf3bc('0xb')]!==_0xf3bc('0xc')){_0x37bae7=_0x3456d0[_0xf3bc('0xb')]['baseDN']&&_0x3456d0[_0xf3bc('0xb')][_0xf3bc('0xd')]&&_0x3456d0[_0xf3bc('0xb')]['domain'];}return _0x37bae7;}function adAuthenticate(_0x2849f6,_0x180001,_0x33235d){return new BPromise(function(_0x4d74ec,_0x41b436){try{var _0x2a9c12=new ActiveDirectory(_0x2849f6);_0x2a9c12[_0xf3bc('0xe')](_0x180001,_0x33235d,function(_0x2c063f,_0x2916d5){if(_0x2c063f){logger[_0xf3bc('0xf')](_0xf3bc('0x10'),_0x180001,util['inspect'](_0x2c063f,{'showHidden':![],'depth':null}));_0x41b436(_0xf3bc('0x11'));}else if(!_0x2916d5){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x180001);_0x41b436(_0xf3bc('0x11'));}else{_0x4d74ec(_0x2916d5);}});}catch(_0x198604){_0x41b436(_0x198604);}});}function ActiveDirectoryAuthenticate(_0x4cb138,_0x424063,_0x33b2ac,_0x378eed){var _0x4cb6a0,_0x2cc991;if(!isActiveDirectoryConfigured(config)){logger[_0xf3bc('0xf')](_0xf3bc('0x12'),_0x424063);return _0x378eed(null,![],{'message':_0xf3bc('0x11')});}return db[_0xf3bc('0x13')][_0xf3bc('0x14')]({'where':{'id':0x1},'attributes':[_0xf3bc('0x15'),_0xf3bc('0x16')],'raw':!![]})[_0xf3bc('0x17')](function(_0x54e1f0){_0x4cb6a0=_0x54e1f0;if(!_0x4cb6a0[_0xf3bc('0x15')]){logger[_0xf3bc('0xf')](_0xf3bc('0x18'),_0x424063);throw new Error(_0xf3bc('0x11'));}return _0x4cb138[_0xf3bc('0x14')]({'attributes':['id',_0xf3bc('0x19'),'password',_0xf3bc('0x1a'),_0xf3bc('0x1b'),_0xf3bc('0x1c'),_0xf3bc('0x1d'),'blockedAt',_0xf3bc('0x1e')],'where':{'name':_0x424063,'role':{'$or':[_0xf3bc('0x1f'),'user',_0xf3bc('0x20')]},'adSsoEnabled':!![]}});})[_0xf3bc('0x17')](function(_0x30e210){if(!_0x30e210||_0x30e210&&_0x30e210['name']!==_0x424063){throw new Error(_0xf3bc('0x11'));}_0x2cc991=_0x30e210;var _0x1ab9c5=_0x2cc991['name']+'@'+config['activedirectory'][_0xf3bc('0x21')];return adAuthenticate(config[_0xf3bc('0xb')],_0x1ab9c5,_0x33b2ac);})[_0xf3bc('0x17')](function(_0x42ad8e){if(_0x2cc991['disabled']){throw new Error(_0xf3bc('0x11'));}if(_0x4cb6a0[_0xf3bc('0x16')]>0x0){if(_0x2cc991[_0xf3bc('0x1d')]){if(moment(_0x2cc991[_0xf3bc('0x22')])['add'](_0x4cb6a0[_0xf3bc('0x16')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x2cc991,0x0,![],null)[_0xf3bc('0x17')](function(){return utils['getLicense'](_0x2cc991);})[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}else{return utils[_0xf3bc('0x23')](_0x2cc991)[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}}else{return utils['getLicense'](_0x2cc991)[_0xf3bc('0x17')](function(){return _0x378eed(null,_0x2cc991);});}})[_0xf3bc('0x24')](function(_0x15559f){return _0x378eed(null,![],_0x15559f);});}function handleError(_0x2f3916,_0x4cf46d,_0x333f87){return _0x2f3916['status'](_0x4cf46d||0x1f4)[_0xf3bc('0x25')]({'message':_0x333f87?_0x333f87[_0xf3bc('0x26')]||_0x333f87:''});}exports['login']=function(_0x4f6476,_0x1e0007,_0x5ca363){passport['authenticate']('ad-login',function(_0x5220e3,_0x558f82,_0x3f3d5a){var _0x2e31a4=_0x5220e3||_0x3f3d5a;if(_0x2e31a4){return handleError(_0x1e0007,0x191,_0x2e31a4);}if(!_0x558f82){return handleError(_0x1e0007,0x194,{'message':_0xf3bc('0x27')});}else{var _0x288f18={'payload':{'id':_0x558f82['id'],'role':_0x558f82[_0xf3bc('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xf3bc('0x28')](_0x288f18)[_0xf3bc('0x17')](function(_0x6c1033){_0x1e0007[_0xf3bc('0x29')]({'id':_0x558f82['id'],'token':_0x6c1033,'statusCall':'','isAlreadyLogged':_0x558f82['online']});});}})(_0x4f6476,_0x1e0007,_0x5ca363);};passport[_0xf3bc('0x2a')](_0xf3bc('0x2b'),new LocalStrategy({'usernameField':_0xf3bc('0x19'),'passwordField':'password'},function(_0x1a7738,_0x572a9b,_0x1811a4){return ActiveDirectoryAuthenticate(db[_0xf3bc('0x2c')],_0x1a7738,_0x572a9b,_0x1811a4);})); \ No newline at end of file +var _0x42fd=['name','salt','role','disabled','blocked','blockedAt','online','admin','agent','add','minutes','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x42fd,0x197));var _0xd42f=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x42fd[_0x543084];return _0x306a57;};'use strict';var passport=require(_0xd42f('0x0'));var LocalStrategy=require('passport-local')[_0xd42f('0x1')];var moment=require(_0xd42f('0x2'));var ActiveDirectory=require(_0xd42f('0x3'));var BPromise=require(_0xd42f('0x4'));var util=require('util');var db=require(_0xd42f('0x5'))['db'];var authService=require(_0xd42f('0x6'));var utils=require('../../config/utils');var config=require(_0xd42f('0x7'));var logger=require(_0xd42f('0x8'))(_0xd42f('0x9'));function isActiveDirectoryConfigured(_0x3b9822){var _0x4333c7=![];if(typeof _0x3b9822[_0xd42f('0xa')]!==_0xd42f('0xb')){_0x4333c7=_0x3b9822[_0xd42f('0xa')][_0xd42f('0xc')]&&_0x3b9822[_0xd42f('0xa')][_0xd42f('0xd')]&&_0x3b9822[_0xd42f('0xa')][_0xd42f('0xe')];}return _0x4333c7;}function adAuthenticate(_0x453fe1,_0x641831,_0x43f042){return new BPromise(function(_0x46bb41,_0x1f6297){try{var _0x9bb3d4=new ActiveDirectory(_0x453fe1);_0x9bb3d4['authenticate'](_0x641831,_0x43f042,function(_0x27e293,_0x547785){if(_0x27e293){logger[_0xd42f('0xf')](_0xd42f('0x10'),_0x641831,util[_0xd42f('0x11')](_0x27e293,{'showHidden':![],'depth':null}));_0x1f6297('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x547785){logger[_0xd42f('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x641831);_0x1f6297('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x46bb41(_0x547785);}});}catch(_0x24f600){_0x1f6297(_0x24f600);}});}function ActiveDirectoryAuthenticate(_0x4b4e20,_0x26c713,_0x53c0ac,_0x4fd1fa){var _0x4698b7,_0x1ad454;if(!isActiveDirectoryConfigured(config)){logger[_0xd42f('0xf')](_0xd42f('0x12'),_0x26c713);return _0x4fd1fa(null,![],{'message':_0xd42f('0x13')});}return db[_0xd42f('0x14')][_0xd42f('0x15')]({'where':{'id':0x1},'attributes':[_0xd42f('0x16'),_0xd42f('0x17')],'raw':!![]})[_0xd42f('0x18')](function(_0x4f8e82){_0x4698b7=_0x4f8e82;if(!_0x4698b7[_0xd42f('0x16')]){logger[_0xd42f('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x26c713);throw new Error(_0xd42f('0x13'));}return _0x4b4e20[_0xd42f('0x15')]({'attributes':['id',_0xd42f('0x19'),'password',_0xd42f('0x1a'),_0xd42f('0x1b'),_0xd42f('0x1c'),_0xd42f('0x1d'),_0xd42f('0x1e'),_0xd42f('0x1f')],'where':{'name':_0x26c713,'role':{'$or':[_0xd42f('0x20'),'user',_0xd42f('0x21')]},'adSsoEnabled':!![]}});})[_0xd42f('0x18')](function(_0x40c42e){if(!_0x40c42e||_0x40c42e&&_0x40c42e[_0xd42f('0x19')]!==_0x26c713){throw new Error(_0xd42f('0x13'));}_0x1ad454=_0x40c42e;var _0x4f6cbd=_0x1ad454[_0xd42f('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xd42f('0xa')],_0x4f6cbd,_0x53c0ac);})['then'](function(_0x301ff4){if(_0x1ad454['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4698b7[_0xd42f('0x17')]>0x0){if(_0x1ad454['blocked']){if(moment(_0x1ad454[_0xd42f('0x1e')])[_0xd42f('0x22')](_0x4698b7[_0xd42f('0x17')],_0xd42f('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x1ad454,0x0,![],null)[_0xd42f('0x18')](function(){return utils[_0xd42f('0x24')](_0x1ad454);})[_0xd42f('0x18')](function(){return _0x4fd1fa(null,_0x1ad454);});}else{return utils[_0xd42f('0x24')](_0x1ad454)[_0xd42f('0x18')](function(){return _0x4fd1fa(null,_0x1ad454);});}}else{return utils[_0xd42f('0x24')](_0x1ad454)[_0xd42f('0x18')](function(){return _0x4fd1fa(null,_0x1ad454);});}})[_0xd42f('0x25')](function(_0xdac5bd){return _0x4fd1fa(null,![],_0xdac5bd);});}function handleError(_0x573ae7,_0x283e2b,_0x51ea54){return _0x573ae7['status'](_0x283e2b||0x1f4)[_0xd42f('0x26')]({'message':_0x51ea54?_0x51ea54[_0xd42f('0x27')]||_0x51ea54:''});}exports[_0xd42f('0x28')]=function(_0x4ed87b,_0x4cb8ec,_0x271856){passport['authenticate'](_0xd42f('0x29'),function(_0x589870,_0x17c05e,_0x2611e1){var _0x40a242=_0x589870||_0x2611e1;if(_0x40a242){return handleError(_0x4cb8ec,0x191,_0x40a242);}if(!_0x17c05e){return handleError(_0x4cb8ec,0x194,{'message':_0xd42f('0x2a')});}else{var _0x223310={'payload':{'id':_0x17c05e['id'],'role':_0x17c05e[_0xd42f('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xd42f('0x2b')](_0x223310)['then'](function(_0x2e086c){_0x4cb8ec[_0xd42f('0x2c')]({'id':_0x17c05e['id'],'token':_0x2e086c,'statusCall':'','isAlreadyLogged':_0x17c05e[_0xd42f('0x1f')]});});}})(_0x4ed87b,_0x4cb8ec,_0x271856);};passport[_0xd42f('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xd42f('0x19'),'passwordField':_0xd42f('0x2e')},function(_0xd6499e,_0x475e7e,_0x51109d){return ActiveDirectoryAuthenticate(db[_0xd42f('0x2f')],_0xd6499e,_0x475e7e,_0x51109d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f0435a9..e4f8156 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 _0x09ce=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x487788,_0x428e9f){var _0x2829ef=function(_0x4ff9dd){while(--_0x4ff9dd){_0x487788['push'](_0x487788['shift']());}};_0x2829ef(++_0x428e9f);}(_0x09ce,0x6c));var _0xe09c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x09ce[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0xe09c('0x0'));var router=express[_0xe09c('0x1')]();var controller=require(_0xe09c('0x2'));router[_0xe09c('0x3')]('/',controller[_0xe09c('0x4')]);module[_0xe09c('0x5')]=router; \ No newline at end of file +var _0x9f26=['express','Router','./authActiveDirectory.controller','login','exports'];(function(_0xaa9d74,_0x5b420d){var _0x3ed693=function(_0x1fe8be){while(--_0x1fe8be){_0xaa9d74['push'](_0xaa9d74['shift']());}};_0x3ed693(++_0x5b420d);}(_0x9f26,0x195));var _0x69f2=function(_0x9d6d79,_0x20bf24){_0x9d6d79=_0x9d6d79-0x0;var _0x2107d9=_0x9f26[_0x9d6d79];return _0x2107d9;};'use strict';var express=require(_0x69f2('0x0'));var router=express[_0x69f2('0x1')]();var controller=require(_0x69f2('0x2'));router['post']('/',controller[_0x69f2('0x3')]);module[_0x69f2('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5e7d55b..ffcf226 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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7a54,0x106));var _0x47a5=function(_0xd01a9a,_0x61feea){_0xd01a9a=_0xd01a9a-0x0;var _0x58f15b=_0x7a54[_0xd01a9a];return _0x58f15b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x573910,_0x2e071c){var _0xd0896e=function(_0x202c5a){while(--_0x202c5a){_0x573910['push'](_0x573910['shift']());}};_0xd0896e(++_0x2e071c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6ce2956..94c7d2e 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 _0xcf98=['exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','callback','isMiddleware','login','setTokenCookie'];(function(_0x5c8e2c,_0x17ccfc){var _0x4301c3=function(_0x2a3a3a){while(--_0x2a3a3a){_0x5c8e2c['push'](_0x5c8e2c['shift']());}};_0x4301c3(++_0x17ccfc);}(_0xcf98,0xf3));var _0x8cf9=function(_0x5699e8,_0x4489f0){_0x5699e8=_0x5699e8-0x0;var _0x5722aa=_0xcf98[_0x5699e8];return _0x5722aa;};'use strict';var express=require(_0x8cf9('0x0'));var passport=require('passport');var router=express[_0x8cf9('0x1')]();var controller=require(_0x8cf9('0x2'));var userController=require(_0x8cf9('0x3'));var authService=require(_0x8cf9('0x4'));router['get']('/',controller['login']);router[_0x8cf9('0x5')]('/callback',controller[_0x8cf9('0x6')],authService[_0x8cf9('0x7')],userController[_0x8cf9('0x8')],authService[_0x8cf9('0x9')]);module[_0x8cf9('0xa')]=router; \ No newline at end of file +var _0x6305=['login','/callback','callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6305,0xad));var _0x5630=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6305[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x5630('0x0'));var passport=require(_0x5630('0x1'));var router=express[_0x5630('0x2')]();var controller=require(_0x5630('0x3'));var userController=require(_0x5630('0x4'));var authService=require(_0x5630('0x5'));router[_0x5630('0x6')]('/',controller[_0x5630('0x7')]);router[_0x5630('0x6')](_0x5630('0x8'),controller[_0x5630('0x9')],authService['isMiddleware'],userController[_0x5630('0x7')],authService[_0x5630('0xa')]);module[_0x5630('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 74e577c..41a1560 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 _0x5fdb=['MailAccount','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','error','status','send','local-login','role','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','use','util','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','then','findOne','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','minutes','clearBlockUser','getLicense','catch'];(function(_0x52b8aa,_0x2cce69){var _0x5b9832=function(_0x50f585){while(--_0x50f585){_0x52b8aa['push'](_0x52b8aa['shift']());}};_0x5b9832(++_0x2cce69);}(_0x5fdb,0x1b0));var _0xb5fd=function(_0x199721,_0x7ccb0c){_0x199721=_0x199721-0x0;var _0x3fc405=_0x5fdb[_0x199721];return _0x3fc405;};'use strict';var util=require(_0xb5fd('0x0'));var passport=require('passport');var LocalStrategy=require(_0xb5fd('0x1'))[_0xb5fd('0x2')];var jayson=require('jayson/promise');var _=require(_0xb5fd('0x3'));var rs=require(_0xb5fd('0x4'));var moment=require(_0xb5fd('0x5'));var db=require(_0xb5fd('0x6'))['db'];var authService=require(_0xb5fd('0x7'));var utils=require(_0xb5fd('0x8'));var client=jayson['client'][_0xb5fd('0x9')]({'port':0x232b});function localAuthenticate(_0x5b41c2,_0x3ac7f6,_0x13130a,_0x467f67){var _0x4107e1,_0x57bc04;return db[_0xb5fd('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb5fd('0xb')](function(_0x529cfd){_0x4107e1=_0x529cfd;return _0x5b41c2[_0xb5fd('0xc')]({'attributes':['id',_0xb5fd('0xd'),_0xb5fd('0xe'),_0xb5fd('0xf'),'role',_0xb5fd('0x10'),_0xb5fd('0x11'),_0xb5fd('0x12'),_0xb5fd('0x13')],'where':{'name':_0x3ac7f6,'role':{'$or':[_0xb5fd('0x14'),_0xb5fd('0x15'),'agent']}}});})[_0xb5fd('0xb')](function(_0x37b89a){if(!_0x37b89a||_0x37b89a&&_0x37b89a['name']!==_0x3ac7f6){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x57bc04=_0x37b89a;return _0x57bc04;}})[_0xb5fd('0xb')](function(){_0x57bc04[_0xb5fd('0x16')](_0x13130a,function(_0x3b2b00,_0x5e8e25){var _0x34d24f=_0x57bc04[_0xb5fd('0x13')]+0x1;if(_0x3b2b00){return _0x467f67(_0x3b2b00);}else if(!_0x5e8e25){if(_0x57bc04[_0xb5fd('0x10')]){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}else if(_0x4107e1[_0xb5fd('0x18')]>0x0){if(_0x57bc04['blocked']){if(_0x4107e1[_0xb5fd('0x19')]>0x0){if(moment(_0x57bc04['blockedAt'])['add'](_0x4107e1[_0xb5fd('0x19')],_0xb5fd('0x1a'))>moment()){return _0x467f67(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb5fd('0x1b')](_0x57bc04,_0x34d24f,![],null)[_0xb5fd('0xb')](function(){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});});}}else{return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}}else{if(_0x34d24f>=_0x4107e1['allowedLoginAttempts']){return utils[_0xb5fd('0x1b')](_0x57bc04,0x0,!![],moment())[_0xb5fd('0xb')](function(){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});});}else{return utils[_0xb5fd('0x1b')](_0x57bc04,_0x34d24f,![],null)[_0xb5fd('0xb')](function(){return _0x467f67(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x467f67(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x57bc04[_0xb5fd('0x10')]){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}else if(_0x4107e1[_0xb5fd('0x18')]>0x0){if(_0x57bc04[_0xb5fd('0x11')]){if(_0x4107e1[_0xb5fd('0x19')]>0x0){if(moment(_0x57bc04[_0xb5fd('0x12')])['add'](_0x4107e1[_0xb5fd('0x19')],_0xb5fd('0x1a'))>moment()){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}else{return utils['clearBlockUser'](_0x57bc04,0x0,![],null)[_0xb5fd('0xb')](function(){return utils[_0xb5fd('0x1c')](_0x57bc04);})[_0xb5fd('0xb')](function(){return _0x467f67(null,_0x57bc04);});}}else{return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}}else{return utils['clearBlockUser'](_0x57bc04,0x0,![],null)[_0xb5fd('0xb')](function(){return utils['getLicense'](_0x57bc04);})['then'](function(){return _0x467f67(null,_0x57bc04);})['catch'](function(_0x597aac){return _0x467f67(null,![],_0x597aac);});}}else{if(_0x57bc04['blocked']){return _0x467f67(null,![],{'message':_0xb5fd('0x17')});}else{return utils[_0xb5fd('0x1c')](_0x57bc04)[_0xb5fd('0xb')](function(){return _0x467f67(null,_0x57bc04);});}}}});})[_0xb5fd('0x1d')](function(_0x5774fb){return _0x467f67(null,![],_0x5774fb);});}function sendServiceMail(_0x7d13aa){return db[_0xb5fd('0x1e')]['find']({'where':{'service':!![]},'attributes':['id',_0xb5fd('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xb5fd('0x1f'),'include':[{'model':db[_0xb5fd('0x20')],'as':_0xb5fd('0x20')}]}]})[_0xb5fd('0xb')](function(_0x23233a){if(!_0x23233a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x43d271=_0x23233a[_0xb5fd('0x21')]();var _0x7075dd={'account':_0x43d271,'message':_[_0xb5fd('0x22')]({'from':util[_0xb5fd('0x23')](_0xb5fd('0x24'),_0x23233a[_0xb5fd('0xd')],_0x23233a[_0xb5fd('0x25')]||_0x23233a[_0xb5fd('0x1f')]['user'])},_0x7d13aa)};return client[_0xb5fd('0x26')]('SendMail',_0x7075dd);})[_0xb5fd('0xb')](function(_0x56865a){if(_0x56865a['error']){throw new Error(util[_0xb5fd('0x23')](_0xb5fd('0x27'),_0x56865a['error']['message']||JSON[_0xb5fd('0x28')](_0x56865a[_0xb5fd('0x29')])));}return!![];});}function handleError(_0x2f2af5,_0x2f888c,_0x99889d){return _0x2f2af5[_0xb5fd('0x2a')](_0x2f888c||0x1f4)[_0xb5fd('0x2b')]({'message':_0x99889d?_0x99889d['message']||_0x99889d:''});}exports['login']=function(_0x513e16,_0x190cf8,_0x16c1de){passport[_0xb5fd('0x16')](_0xb5fd('0x2c'),function(_0x3f075c,_0x464a2a,_0x1acd9c){var _0x81a5a6=_0x3f075c||_0x1acd9c;if(_0x81a5a6){return handleError(_0x190cf8,0x191,_0x81a5a6);}if(!_0x464a2a){return handleError(_0x190cf8,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1667c7={'payload':{'id':_0x464a2a['id'],'role':_0x464a2a[_0xb5fd('0x2d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1667c7)['then'](function(_0xcaa002){_0x190cf8[_0xb5fd('0x2e')]({'id':_0x464a2a['id'],'token':_0xcaa002,'statusCall':'','isAlreadyLogged':_0x464a2a[_0xb5fd('0x2f')]});});}})(_0x513e16,_0x190cf8,_0x16c1de);};exports['forgot']=function(_0x5c6ad9,_0x2b9b18){if(!_0x5c6ad9[_0xb5fd('0x30')][_0xb5fd('0x25')]){return handleError(_0x2b9b18,0x1f4,{'message':_0xb5fd('0x31')});}var _0x153b90=rs['generate']();_0x5c6ad9[_0xb5fd('0x30')]['email']=_0x5c6ad9['body'][_0xb5fd('0x25')][_0xb5fd('0x32')]()[_0xb5fd('0x33')]();var _0x43aff0;return db[_0xb5fd('0xa')][_0xb5fd('0xc')]({'where':{'id':0x1},'attributes':[_0xb5fd('0x18'),_0xb5fd('0x19')],'raw':!![]})[_0xb5fd('0xb')](function(_0x1a2648){_0x43aff0=_0x1a2648;return db[_0xb5fd('0x34')][_0xb5fd('0x35')]({'where':{'email':_0x5c6ad9[_0xb5fd('0x30')][_0xb5fd('0x25')]}});})[_0xb5fd('0xb')](function(_0x9a9dc2){if(!_0x9a9dc2){throw new Error(_0xb5fd('0x36'));}if(_0x9a9dc2[_0xb5fd('0x10')]){throw new Error(_0xb5fd('0x37'));}if(_0x9a9dc2[_0xb5fd('0x11')]){if(moment(_0x9a9dc2[_0xb5fd('0x12')])['add'](_0x43aff0[_0xb5fd('0x19')],_0xb5fd('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x9a9dc2[_0xb5fd('0x11')]=![];_0x9a9dc2['blockedAt']=null;}}_0x9a9dc2['resetPasswordToken']=_0x153b90;_0x9a9dc2[_0xb5fd('0x38')]=Date['now']()+0x36ee80;return _0x9a9dc2[_0xb5fd('0x39')]();})[_0xb5fd('0xb')](function(){return sendServiceMail({'to':_0x5c6ad9[_0xb5fd('0x30')][_0xb5fd('0x25')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xb5fd('0x3a')+_0xb5fd('0x3b')+_0xb5fd('0x3c')+_0x5c6ad9['headers']['host']+_0xb5fd('0x3d')+_0x153b90+'\x0a\x0a'+_0xb5fd('0x3e')});})[_0xb5fd('0xb')](function(){_0x2b9b18[_0xb5fd('0x2a')](0xc8)[_0xb5fd('0x2b')]({'message':_0xb5fd('0x3f')});})[_0xb5fd('0x1d')](function(_0x4a7372){return handleError(_0x2b9b18,0x1f4,_0x4a7372);});};exports[_0xb5fd('0x40')]=function(_0x531098,_0x4bc382){return db['User'][_0xb5fd('0x35')]({'where':{'resetPasswordToken':_0x531098[_0xb5fd('0x41')][_0xb5fd('0x42')],'resetPasswordExpires':{'$gt':Date[_0xb5fd('0x43')]()}}})['then'](function(_0xcaf415){if(!_0xcaf415){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0xb5fd('0x44'),'enforcePasswordHistory',_0xb5fd('0x45')]})[_0xb5fd('0xb')](function(_0x54c125){if(_0x54c125[_0xb5fd('0x44')])authService[_0xb5fd('0x46')](_0x531098['body']['password']);if(!_0x54c125[_0xb5fd('0x47')]||!_0xcaf415['previousPasswords'])return _0xcaf415;authService[_0xb5fd('0x48')](_0x531098[_0xb5fd('0x30')]['password'],_0xcaf415[_0xb5fd('0x49')],_0x54c125[_0xb5fd('0x45')]);return _0xcaf415;})[_0xb5fd('0xb')](function(){_0xcaf415[_0xb5fd('0xe')]=_0x531098[_0xb5fd('0x30')][_0xb5fd('0xe')];_0xcaf415[_0xb5fd('0x4a')]=null;_0xcaf415[_0xb5fd('0x38')]=null;return _0xcaf415[_0xb5fd('0x39')]();});})[_0xb5fd('0xb')](function(){_0x4bc382[_0xb5fd('0x2a')](0xc8)[_0xb5fd('0x2b')]({'message':_0xb5fd('0x4b')});})['catch'](function(_0x4a40c1){return handleError(_0x4bc382,0x1f4,_0x4a40c1);});};passport[_0xb5fd('0x4c')](_0xb5fd('0x2c'),new LocalStrategy({'usernameField':_0xb5fd('0xd'),'passwordField':_0xb5fd('0xe')},function(_0x2c2784,_0xe66106,_0x26b08e){return localAuthenticate(db['User'],_0x2c2784,_0xe66106,_0x26b08e);})); \ No newline at end of file +var _0x89b9=['MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','user','request','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','client','http','findOne','blockDuration','then','password','salt','role','disabled','blocked','loginAttempts','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','blockedAt','getLicense','clearBlockUser','catch','MailAccount','find','email'];(function(_0x2353ea,_0x2dc0a1){var _0x460f3b=function(_0x500f74){while(--_0x500f74){_0x2353ea['push'](_0x2353ea['shift']());}};_0x460f3b(++_0x2dc0a1);}(_0x89b9,0x18a));var _0x989b=function(_0x4e4455,_0x10572a){_0x4e4455=_0x4e4455-0x0;var _0x53624a=_0x89b9[_0x4e4455];return _0x53624a;};'use strict';var util=require(_0x989b('0x0'));var passport=require(_0x989b('0x1'));var LocalStrategy=require(_0x989b('0x2'))[_0x989b('0x3')];var jayson=require(_0x989b('0x4'));var _=require(_0x989b('0x5'));var rs=require(_0x989b('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x989b('0x7'));var utils=require('../../config/utils');var client=jayson[_0x989b('0x8')][_0x989b('0x9')]({'port':0x232b});function localAuthenticate(_0x5b7989,_0x228d89,_0x2625a9,_0x393c54){var _0x12b398,_0x53cf77;return db['Setting'][_0x989b('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x989b('0xb')],'raw':!![]})[_0x989b('0xc')](function(_0x334166){_0x12b398=_0x334166;return _0x5b7989[_0x989b('0xa')]({'attributes':['id','name',_0x989b('0xd'),_0x989b('0xe'),_0x989b('0xf'),_0x989b('0x10'),_0x989b('0x11'),'blockedAt',_0x989b('0x12')],'where':{'name':_0x228d89,'role':{'$or':['admin','user','agent']}}});})[_0x989b('0xc')](function(_0x3f4ca9){if(!_0x3f4ca9||_0x3f4ca9&&_0x3f4ca9[_0x989b('0x13')]!==_0x228d89){throw new Error(_0x989b('0x14'));}else{_0x53cf77=_0x3f4ca9;return _0x53cf77;}})[_0x989b('0xc')](function(){_0x53cf77[_0x989b('0x15')](_0x2625a9,function(_0x541f3d,_0x1d7401){var _0x123130=_0x53cf77[_0x989b('0x12')]+0x1;if(_0x541f3d){return _0x393c54(_0x541f3d);}else if(!_0x1d7401){if(_0x53cf77['disabled']){return _0x393c54(null,![],{'message':_0x989b('0x14')});}else if(_0x12b398[_0x989b('0x16')]>0x0){if(_0x53cf77[_0x989b('0x11')]){if(_0x12b398[_0x989b('0xb')]>0x0){if(moment(_0x53cf77['blockedAt'])[_0x989b('0x17')](_0x12b398[_0x989b('0xb')],'minutes')>moment()){return _0x393c54(null,![],{'message':_0x989b('0x14')});}else{return utils['clearBlockUser'](_0x53cf77,_0x123130,![],null)[_0x989b('0xc')](function(){return _0x393c54(null,![],{'message':_0x989b('0x14')});});}}else{return _0x393c54(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x123130>=_0x12b398[_0x989b('0x16')]){return utils['clearBlockUser'](_0x53cf77,0x0,!![],moment())[_0x989b('0xc')](function(){return _0x393c54(null,![],{'message':_0x989b('0x14')});});}else{return utils['clearBlockUser'](_0x53cf77,_0x123130,![],null)[_0x989b('0xc')](function(){return _0x393c54(null,![],{'message':_0x989b('0x14')});});}}}else{return _0x393c54(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x53cf77[_0x989b('0x10')]){return _0x393c54(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x12b398['allowedLoginAttempts']>0x0){if(_0x53cf77[_0x989b('0x11')]){if(_0x12b398['blockDuration']>0x0){if(moment(_0x53cf77[_0x989b('0x18')])[_0x989b('0x17')](_0x12b398[_0x989b('0xb')],'minutes')>moment()){return _0x393c54(null,![],{'message':_0x989b('0x14')});}else{return utils['clearBlockUser'](_0x53cf77,0x0,![],null)[_0x989b('0xc')](function(){return utils[_0x989b('0x19')](_0x53cf77);})[_0x989b('0xc')](function(){return _0x393c54(null,_0x53cf77);});}}else{return _0x393c54(null,![],{'message':_0x989b('0x14')});}}else{return utils[_0x989b('0x1a')](_0x53cf77,0x0,![],null)[_0x989b('0xc')](function(){return utils[_0x989b('0x19')](_0x53cf77);})[_0x989b('0xc')](function(){return _0x393c54(null,_0x53cf77);})[_0x989b('0x1b')](function(_0x5fbe8c){return _0x393c54(null,![],_0x5fbe8c);});}}else{if(_0x53cf77[_0x989b('0x11')]){return _0x393c54(null,![],{'message':_0x989b('0x14')});}else{return utils['getLicense'](_0x53cf77)[_0x989b('0xc')](function(){return _0x393c54(null,_0x53cf77);});}}}});})[_0x989b('0x1b')](function(_0xb4d29e){return _0x393c54(null,![],_0xb4d29e);});}function sendServiceMail(_0x308dbd){return db[_0x989b('0x1c')][_0x989b('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x989b('0x13'),_0x989b('0x1e')],'include':[{'model':db[_0x989b('0x1f')],'as':_0x989b('0x20'),'include':[{'model':db[_0x989b('0x21')],'as':_0x989b('0x21')}]}]})[_0x989b('0xc')](function(_0xab66f){if(!_0xab66f){throw new Error(_0x989b('0x22'));}var _0x34e57c=_0xab66f['getSmtpOptions']();var _0x2e3708={'account':_0x34e57c,'message':_[_0x989b('0x23')]({'from':util['format'](_0x989b('0x24'),_0xab66f[_0x989b('0x13')],_0xab66f[_0x989b('0x1e')]||_0xab66f['Smtp'][_0x989b('0x25')])},_0x308dbd)};return client[_0x989b('0x26')]('SendMail',_0x2e3708);})['then'](function(_0x59377f){if(_0x59377f['error']){throw new Error(util[_0x989b('0x27')](_0x989b('0x28'),_0x59377f[_0x989b('0x29')]['message']||JSON[_0x989b('0x2a')](_0x59377f[_0x989b('0x29')])));}return!![];});}function handleError(_0x1ac790,_0x5d6676,_0x1d2d7d){return _0x1ac790[_0x989b('0x2b')](_0x5d6676||0x1f4)[_0x989b('0x2c')]({'message':_0x1d2d7d?_0x1d2d7d[_0x989b('0x2d')]||_0x1d2d7d:''});}exports[_0x989b('0x2e')]=function(_0x3f8125,_0x1c83a3,_0x5f14fd){passport[_0x989b('0x15')](_0x989b('0x2f'),function(_0x28ae8b,_0x136bc5,_0x27e42f){var _0x50182b=_0x28ae8b||_0x27e42f;if(_0x50182b){return handleError(_0x1c83a3,0x191,_0x50182b);}if(!_0x136bc5){return handleError(_0x1c83a3,0x194,{'message':_0x989b('0x30')});}else{var _0x6d61e3={'payload':{'id':_0x136bc5['id'],'role':_0x136bc5['role']},'options':{'expiresIn':0x15180}};return authService[_0x989b('0x31')](_0x6d61e3)[_0x989b('0xc')](function(_0x5f4d42){_0x1c83a3[_0x989b('0x32')]({'id':_0x136bc5['id'],'token':_0x5f4d42,'statusCall':'','isAlreadyLogged':_0x136bc5[_0x989b('0x33')]});});}})(_0x3f8125,_0x1c83a3,_0x5f14fd);};exports[_0x989b('0x34')]=function(_0x50a521,_0x3c6493){if(!_0x50a521[_0x989b('0x35')][_0x989b('0x1e')]){return handleError(_0x3c6493,0x1f4,{'message':_0x989b('0x36')});}var _0x114e82=rs[_0x989b('0x37')]();_0x50a521['body'][_0x989b('0x1e')]=_0x50a521[_0x989b('0x35')][_0x989b('0x1e')][_0x989b('0x38')]()[_0x989b('0x39')]();var _0x1d3ba6;return db['Setting'][_0x989b('0xa')]({'where':{'id':0x1},'attributes':[_0x989b('0x16'),_0x989b('0xb')],'raw':!![]})[_0x989b('0xc')](function(_0x15703f){_0x1d3ba6=_0x15703f;return db['User'][_0x989b('0x1d')]({'where':{'email':_0x50a521[_0x989b('0x35')][_0x989b('0x1e')]}});})['then'](function(_0x50dd60){if(!_0x50dd60){throw new Error(_0x989b('0x3a'));}if(_0x50dd60[_0x989b('0x10')]){throw new Error(_0x989b('0x3b'));}if(_0x50dd60[_0x989b('0x11')]){if(moment(_0x50dd60['blockedAt'])[_0x989b('0x17')](_0x1d3ba6['blockDuration'],'minutes')>moment()){throw new Error(_0x989b('0x3c'));}else{_0x50dd60[_0x989b('0x11')]=![];_0x50dd60['blockedAt']=null;}}_0x50dd60['resetPasswordToken']=_0x114e82;_0x50dd60['resetPasswordExpires']=Date[_0x989b('0x3d')]()+0x36ee80;return _0x50dd60[_0x989b('0x3e')]();})[_0x989b('0xc')](function(){return sendServiceMail({'to':_0x50a521['body'][_0x989b('0x1e')],'subject':_0x989b('0x3f'),'text':_0x989b('0x40')+_0x989b('0x41')+'https://'+_0x50a521[_0x989b('0x42')][_0x989b('0x43')]+_0x989b('0x44')+_0x114e82+'\x0a\x0a'+_0x989b('0x45')});})[_0x989b('0xc')](function(){_0x3c6493[_0x989b('0x2b')](0xc8)[_0x989b('0x2c')]({'message':_0x989b('0x46')});})[_0x989b('0x1b')](function(_0x2a0a54){return handleError(_0x3c6493,0x1f4,_0x2a0a54);});};exports[_0x989b('0x47')]=function(_0x1cf54e,_0x58a03c){return db[_0x989b('0x48')][_0x989b('0x1d')]({'where':{'resetPasswordToken':_0x1cf54e[_0x989b('0x49')][_0x989b('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x989b('0xc')](function(_0x1ed31a){if(!_0x1ed31a){throw new Error(_0x989b('0x4b'));}return db['Setting'][_0x989b('0xa')]({'attributes':['id',_0x989b('0x4c'),_0x989b('0x4d'),'passwordHistoryLimit']})['then'](function(_0x3e22cb){if(_0x3e22cb[_0x989b('0x4c')])authService[_0x989b('0x4e')](_0x1cf54e[_0x989b('0x35')][_0x989b('0xd')]);if(!_0x3e22cb['enforcePasswordHistory']||!_0x1ed31a[_0x989b('0x4f')])return _0x1ed31a;authService['validatePasswordHistory'](_0x1cf54e[_0x989b('0x35')]['password'],_0x1ed31a['previousPasswords'],_0x3e22cb[_0x989b('0x50')]);return _0x1ed31a;})[_0x989b('0xc')](function(){_0x1ed31a['password']=_0x1cf54e[_0x989b('0x35')]['password'];_0x1ed31a[_0x989b('0x51')]=null;_0x1ed31a[_0x989b('0x52')]=null;return _0x1ed31a['save']();});})[_0x989b('0xc')](function(){_0x58a03c[_0x989b('0x2b')](0xc8)['send']({'message':_0x989b('0x53')});})[_0x989b('0x1b')](function(_0x29ddf6){return handleError(_0x58a03c,0x1f4,_0x29ddf6);});};passport[_0x989b('0x54')](_0x989b('0x2f'),new LocalStrategy({'usernameField':_0x989b('0x13'),'passwordField':_0x989b('0xd')},function(_0x1c9921,_0x9bbc3a,_0x140d9b){return localAuthenticate(db[_0x989b('0x48')],_0x1c9921,_0x9bbc3a,_0x140d9b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c1ee476..ccce424 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 _0x3790=['reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x46b764,_0x57765b){var _0x286081=function(_0x194b77){while(--_0x194b77){_0x46b764['push'](_0x46b764['shift']());}};_0x286081(++_0x57765b);}(_0x3790,0x1ba));var _0x0379=function(_0x30c550,_0x20a759){_0x30c550=_0x30c550-0x0;var _0x49d16f=_0x3790[_0x30c550];return _0x49d16f;};'use strict';var express=require(_0x0379('0x0'));var router=express[_0x0379('0x1')]();var controller=require(_0x0379('0x2'));router[_0x0379('0x3')]('/',controller[_0x0379('0x4')]);router[_0x0379('0x3')](_0x0379('0x5'),controller[_0x0379('0x6')]);router[_0x0379('0x3')](_0x0379('0x7'),controller[_0x0379('0x8')]);module[_0x0379('0x9')]=router; \ No newline at end of file +var _0x00bf=['exports','express','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x00bf,0x149));var _0xf00b=function(_0x6317aa,_0x2df3de){_0x6317aa=_0x6317aa-0x0;var _0x48425b=_0x00bf[_0x6317aa];return _0x48425b;};'use strict';var express=require(_0xf00b('0x0'));var router=express['Router']();var controller=require(_0xf00b('0x1'));router[_0xf00b('0x2')]('/',controller[_0xf00b('0x3')]);router[_0xf00b('0x2')](_0xf00b('0x4'),controller['forgot']);router[_0xf00b('0x2')](_0xf00b('0x5'),controller[_0xf00b('0x6')]);module[_0xf00b('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 59ee4fd..f405ff6 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 _0xc6f0=['STRING','INTEGER'];(function(_0x123df5,_0x5a535b){var _0x115fc5=function(_0x44e410){while(--_0x44e410){_0x123df5['push'](_0x123df5['shift']());}};_0x115fc5(++_0x5a535b);}(_0xc6f0,0xea));var _0x0c6f=function(_0xb1790f,_0x5f51a4){_0xb1790f=_0xb1790f-0x0;var _0x50c602=_0xc6f0[_0xb1790f];return _0x50c602;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c6f('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c6f('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0c6f('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1d27=['INTEGER','sequelize','exports','STRING'];(function(_0x371774,_0x550125){var _0x14a616=function(_0x2f7d11){while(--_0x2f7d11){_0x371774['push'](_0x371774['shift']());}};_0x14a616(++_0x550125);}(_0x1d27,0x191));var _0x71d2=function(_0x3a5272,_0x5af0b4){_0x3a5272=_0x3a5272-0x0;var _0x5460d7=_0x1d27[_0x3a5272];return _0x5460d7;};'use strict';var Sequelize=require(_0x71d2('0x0'));module[_0x71d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x71d2('0x2')]},'description':{'type':Sequelize[_0x71d2('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x71d2('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 c38eee1..ae8637d 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 _0xec2c=['zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','show','options','find','catch','create','body','params','Condition','addConditions','ids','omit','getConditions','findOne','order','pick','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf'];(function(_0x3a0e72,_0x5520fd){var _0x2caf78=function(_0x16fa6a){while(--_0x16fa6a){_0x3a0e72['push'](_0x3a0e72['shift']());}};_0x2caf78(++_0x5520fd);}(_0xec2c,0x1a7));var _0xcec2=function(_0x2f31d0,_0x4fce9a){_0x2f31d0=_0x2f31d0-0x0;var _0x1d0256=_0xec2c[_0x2f31d0];return _0x1d0256;};'use strict';var emlformat=require(_0xcec2('0x0'));var rimraf=require(_0xcec2('0x1'));var zipdir=require(_0xcec2('0x2'));var jsonpatch=require(_0xcec2('0x3'));var rp=require('request-promise');var moment=require(_0xcec2('0x4'));var BPromise=require(_0xcec2('0x5'));var Mustache=require(_0xcec2('0x6'));var util=require('util');var path=require(_0xcec2('0x7'));var sox=require(_0xcec2('0x8'));var csv=require(_0xcec2('0x9'));var ejs=require(_0xcec2('0xa'));var fs=require('fs');var fs_extra=require(_0xcec2('0xb'));var _=require(_0xcec2('0xc'));var squel=require(_0xcec2('0xd'));var crypto=require(_0xcec2('0xe'));var jsforce=require(_0xcec2('0xf'));var deskjs=require(_0xcec2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcec2('0x11'));var Papa=require(_0xcec2('0x12'));var Redis=require(_0xcec2('0x13'));var authService=require(_0xcec2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcec2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcec2('0x16'));var config=require(_0xcec2('0x17'));var licenseUtil=require(_0xcec2('0x18'));var db=require(_0xcec2('0x19'))['db'];function respondWithStatusCode(_0x33da0e,_0x47add5){_0x47add5=_0x47add5||0xcc;return function(_0x134fa6){if(_0x134fa6){return _0x33da0e[_0xcec2('0x1a')](_0x47add5);}return _0x33da0e[_0xcec2('0x1b')](_0x47add5)[_0xcec2('0x1c')]();};}function respondWithResult(_0x453822,_0x12b66f){_0x12b66f=_0x12b66f||0xc8;return function(_0x383e90){if(_0x383e90){return _0x453822[_0xcec2('0x1b')](_0x12b66f)['json'](_0x383e90);}};}function respondWithFilteredResult(_0x25f578,_0x290ad4){return function(_0x282169){if(_0x282169){var _0x4875ca=typeof _0x290ad4[_0xcec2('0x1d')]==='undefined'&&typeof _0x290ad4[_0xcec2('0x1e')]==='undefined';var _0x43daf0=_0x282169['count'];var _0x10c34e=_0x4875ca?0x0:_0x290ad4[_0xcec2('0x1d')];var _0x6218cd=_0x4875ca?_0x282169[_0xcec2('0x1f')]:_0x290ad4[_0xcec2('0x1d')]+_0x290ad4[_0xcec2('0x1e')];var _0x2367bd;if(_0x6218cd>=_0x43daf0){_0x6218cd=_0x43daf0;_0x2367bd=0xc8;}else{_0x2367bd=0xce;}_0x25f578[_0xcec2('0x1b')](_0x2367bd);return _0x25f578[_0xcec2('0x20')](_0xcec2('0x21'),_0x10c34e+'-'+_0x6218cd+'/'+_0x43daf0)[_0xcec2('0x22')](_0x282169);}return null;};}function patchUpdates(_0x9421f){return function(_0x4bb080){try{jsonpatch[_0xcec2('0x23')](_0x4bb080,_0x9421f,!![]);}catch(_0x2252c4){return BPromise[_0xcec2('0x24')](_0x2252c4);}return _0x4bb080['save']();};}function saveUpdates(_0x57acfc,_0x434d43){return function(_0x2050c9){if(_0x2050c9){return _0x2050c9[_0xcec2('0x25')](_0x57acfc)[_0xcec2('0x26')](function(_0xcf14dc){return _0xcf14dc;});}return null;};}function removeEntity(_0x49cc7d,_0x23c221){return function(_0x33136c){if(_0x33136c){return _0x33136c[_0xcec2('0x27')]()[_0xcec2('0x26')](function(){_0x49cc7d[_0xcec2('0x1b')](0xcc)[_0xcec2('0x1c')]();});}};}function handleEntityNotFound(_0x15e79f,_0x2f0fc7){return function(_0xe933dd){if(!_0xe933dd){_0x15e79f[_0xcec2('0x1a')](0x194);}return _0xe933dd;};}function handleError(_0x404b04,_0x2c7a5d){_0x2c7a5d=_0x2c7a5d||0x1f4;return function(_0x37845c){logger['error'](_0x37845c[_0xcec2('0x28')]);if(_0x37845c['name']){delete _0x37845c[_0xcec2('0x29')];}_0x404b04[_0xcec2('0x1b')](_0x2c7a5d)[_0xcec2('0x2a')](_0x37845c);};}exports[_0xcec2('0x2b')]=function(_0x4bf80f,_0x276b83){var _0x167f1c={},_0x454bcd={},_0x244f59={'count':0x0,'rows':[]};var _0x2b1f50=_[_0xcec2('0x2c')](db[_0xcec2('0x2d')][_0xcec2('0x2e')],function(_0x38ff7b){return{'name':_0x38ff7b[_0xcec2('0x2f')],'type':_0x38ff7b[_0xcec2('0x30')]['key']};});_0x454bcd[_0xcec2('0x31')]=_[_0xcec2('0x2c')](_0x2b1f50,_0xcec2('0x29'));_0x454bcd['query']=_[_0xcec2('0x32')](_0x4bf80f[_0xcec2('0x33')]);_0x454bcd[_0xcec2('0x34')]=_[_0xcec2('0x35')](_0x454bcd[_0xcec2('0x31')],_0x454bcd['query']);_0x167f1c['attributes']=_[_0xcec2('0x35')](_0x454bcd[_0xcec2('0x31')],qs[_0xcec2('0x36')](_0x4bf80f[_0xcec2('0x33')][_0xcec2('0x36')]));_0x167f1c['attributes']=_0x167f1c[_0xcec2('0x37')][_0xcec2('0x38')]?_0x167f1c[_0xcec2('0x37')]:_0x454bcd[_0xcec2('0x31')];if(!_0x4bf80f[_0xcec2('0x33')]['hasOwnProperty'](_0xcec2('0x39'))){_0x167f1c['limit']=qs['limit'](_0x4bf80f[_0xcec2('0x33')]['limit']);_0x167f1c[_0xcec2('0x1d')]=qs[_0xcec2('0x1d')](_0x4bf80f[_0xcec2('0x33')][_0xcec2('0x1d')]);}_0x167f1c['order']=qs[_0xcec2('0x3a')](_0x4bf80f['query'][_0xcec2('0x3a')]);_0x167f1c['where']=qs[_0xcec2('0x34')](_['pick'](_0x4bf80f['query'],_0x454bcd[_0xcec2('0x34')]),_0x2b1f50);if(_0x4bf80f['query']['filter']){_0x167f1c[_0xcec2('0x3b')]=_[_0xcec2('0x3c')](_0x167f1c[_0xcec2('0x3b')],{'$or':_[_0xcec2('0x2c')](_0x2b1f50,function(_0xa112d2){if(_0xa112d2['type']!==_0xcec2('0x3d')){var _0x3608d3={};_0x3608d3[_0xa112d2['name']]={'$like':'%'+_0x4bf80f['query'][_0xcec2('0x3e')]+'%'};return _0x3608d3;}})});}_0x167f1c=_['merge']({},_0x167f1c,_0x4bf80f['options']);var _0x281c03={'where':_0x167f1c['where']};return db[_0xcec2('0x2d')][_0xcec2('0x1f')](_0x281c03)[_0xcec2('0x26')](function(_0x7f2480){_0x244f59[_0xcec2('0x1f')]=_0x7f2480;if(_0x4bf80f[_0xcec2('0x33')][_0xcec2('0x3f')]){_0x167f1c[_0xcec2('0x40')]=[{'all':!![]}];}return db[_0xcec2('0x2d')]['findAll'](_0x167f1c);})[_0xcec2('0x26')](function(_0x379729){_0x244f59[_0xcec2('0x41')]=_0x379729;return _0x244f59;})[_0xcec2('0x26')](respondWithFilteredResult(_0x276b83,_0x167f1c))['catch'](handleError(_0x276b83,null));};exports[_0xcec2('0x42')]=function(_0x2fe87c,_0x291b2f){var _0x1adb7a={'raw':![],'where':{'id':_0x2fe87c['params']['id']}},_0x552c22={};_0x552c22[_0xcec2('0x31')]=_[_0xcec2('0x32')](db['Automation'][_0xcec2('0x2e')]);_0x552c22[_0xcec2('0x33')]=_[_0xcec2('0x32')](_0x2fe87c['query']);_0x552c22[_0xcec2('0x34')]=_[_0xcec2('0x35')](_0x552c22[_0xcec2('0x31')],_0x552c22['query']);_0x1adb7a[_0xcec2('0x37')]=_[_0xcec2('0x35')](_0x552c22[_0xcec2('0x31')],qs[_0xcec2('0x36')](_0x2fe87c[_0xcec2('0x33')]['fields']));_0x1adb7a[_0xcec2('0x37')]=_0x1adb7a['attributes'][_0xcec2('0x38')]?_0x1adb7a['attributes']:_0x552c22[_0xcec2('0x31')];if(_0x2fe87c[_0xcec2('0x33')][_0xcec2('0x3f')]){_0x1adb7a[_0xcec2('0x40')]=[{'all':!![]}];}_0x1adb7a=_[_0xcec2('0x3c')]({},_0x1adb7a,_0x2fe87c[_0xcec2('0x43')]);return db['Automation'][_0xcec2('0x44')](_0x1adb7a)['then'](handleEntityNotFound(_0x291b2f,null))[_0xcec2('0x26')](respondWithResult(_0x291b2f,null))[_0xcec2('0x45')](handleError(_0x291b2f,null));};exports[_0xcec2('0x46')]=function(_0x1d6f57,_0x5770f6){return db['Automation'][_0xcec2('0x46')](_0x1d6f57[_0xcec2('0x47')],{})[_0xcec2('0x26')](respondWithResult(_0x5770f6,0xc9))[_0xcec2('0x45')](handleError(_0x5770f6,null));};exports[_0xcec2('0x25')]=function(_0x59ca0a,_0x4c97d6){if(_0x59ca0a[_0xcec2('0x47')]['id']){delete _0x59ca0a[_0xcec2('0x47')]['id'];}return db['Automation']['find']({'where':{'id':_0x59ca0a[_0xcec2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c97d6,null))['then'](saveUpdates(_0x59ca0a['body'],null))['then'](respondWithResult(_0x4c97d6,null))['catch'](handleError(_0x4c97d6,null));};exports[_0xcec2('0x27')]=function(_0x344ff4,_0x325c7f){return db[_0xcec2('0x2d')][_0xcec2('0x44')]({'where':{'id':_0x344ff4[_0xcec2('0x48')]['id']}})[_0xcec2('0x26')](handleEntityNotFound(_0x325c7f,null))[_0xcec2('0x26')](removeEntity(_0x325c7f,null))['catch'](handleError(_0x325c7f,null));};exports['addConditions']=function(_0x3686a0,_0x247ac7,_0x20fba8){return db[_0xcec2('0x49')][_0xcec2('0x44')]({'where':{'id':_0x3686a0[_0xcec2('0x48')]['id']}})['then'](handleEntityNotFound(_0x247ac7,null))[_0xcec2('0x26')](function(_0x2d4a92){if(_0x2d4a92){return _0x2d4a92[_0xcec2('0x4a')](_0x3686a0[_0xcec2('0x47')][_0xcec2('0x4b')],_[_0xcec2('0x4c')](_0x3686a0[_0xcec2('0x47')],[_0xcec2('0x4b'),'id'])||{});}})[_0xcec2('0x26')](respondWithResult(_0x247ac7,null))[_0xcec2('0x45')](handleError(_0x247ac7,null));};exports[_0xcec2('0x4d')]=function(_0xd1507d,_0x9dd1e8,_0x3b8a27){var _0x4d6f64={};var _0x849c6f={};var _0x3aa694;var _0x5bc9a3;return db[_0xcec2('0x2d')][_0xcec2('0x4e')]({'where':{'id':_0xd1507d['params']['id']}})[_0xcec2('0x26')](handleEntityNotFound(_0x9dd1e8,null))[_0xcec2('0x26')](function(_0x11e555){if(_0x11e555){_0x3aa694=_0x11e555;_0x849c6f[_0xcec2('0x31')]=_[_0xcec2('0x32')](db[_0xcec2('0x49')][_0xcec2('0x2e')]);_0x849c6f[_0xcec2('0x33')]=_[_0xcec2('0x32')](_0xd1507d[_0xcec2('0x33')]);_0x849c6f[_0xcec2('0x34')]=_[_0xcec2('0x35')](_0x849c6f[_0xcec2('0x31')],_0x849c6f[_0xcec2('0x33')]);_0x4d6f64[_0xcec2('0x37')]=_['intersection'](_0x849c6f[_0xcec2('0x31')],qs[_0xcec2('0x36')](_0xd1507d[_0xcec2('0x33')][_0xcec2('0x36')]));_0x4d6f64['attributes']=_0x4d6f64[_0xcec2('0x37')][_0xcec2('0x38')]?_0x4d6f64[_0xcec2('0x37')]:_0x849c6f['model'];_0x4d6f64[_0xcec2('0x4f')]=qs[_0xcec2('0x3a')](_0xd1507d[_0xcec2('0x33')][_0xcec2('0x3a')]);_0x4d6f64[_0xcec2('0x3b')]=qs['filters'](_[_0xcec2('0x50')](_0xd1507d[_0xcec2('0x33')],_0x849c6f[_0xcec2('0x34')]));if(_0xd1507d[_0xcec2('0x33')]['filter']){_0x4d6f64['where']=_['merge'](_0x4d6f64[_0xcec2('0x3b')],{'$or':_['map'](_0x4d6f64[_0xcec2('0x37')],function(_0x2282a7){var _0x4bd7d7={};_0x4bd7d7[_0x2282a7]={'$like':'%'+_0xd1507d[_0xcec2('0x33')]['filter']+'%'};return _0x4bd7d7;})});}_0x4d6f64=_['merge']({},_0x4d6f64,_0xd1507d[_0xcec2('0x43')]);return _0x3aa694[_0xcec2('0x4d')](_0x4d6f64);}})[_0xcec2('0x26')](function(_0x2a43c2){if(_0x2a43c2){_0x5bc9a3=_0x2a43c2[_0xcec2('0x38')];if(!_0xd1507d[_0xcec2('0x33')][_0xcec2('0x51')](_0xcec2('0x39'))){_0x4d6f64[_0xcec2('0x1e')]=qs['limit'](_0xd1507d[_0xcec2('0x33')][_0xcec2('0x1e')]);_0x4d6f64[_0xcec2('0x1d')]=qs[_0xcec2('0x1d')](_0xd1507d['query'][_0xcec2('0x1d')]);}return _0x3aa694[_0xcec2('0x4d')](_0x4d6f64);}})[_0xcec2('0x26')](function(_0x731efa){if(_0x731efa){return _0x731efa?{'count':_0x5bc9a3,'rows':_0x731efa}:null;}})['then'](respondWithResult(_0x9dd1e8,null))[_0xcec2('0x45')](handleError(_0x9dd1e8,null));};exports[_0xcec2('0x52')]=function(_0x1a2505,_0x41a239,_0x1561a8){return db[_0xcec2('0x53')][_0xcec2('0x44')]({'where':{'id':_0x1a2505[_0xcec2('0x48')]['id']}})[_0xcec2('0x26')](handleEntityNotFound(_0x41a239,null))[_0xcec2('0x26')](function(_0x234763){if(_0x234763){return _0x234763[_0xcec2('0x52')](_0x1a2505[_0xcec2('0x47')][_0xcec2('0x4b')],_[_0xcec2('0x4c')](_0x1a2505[_0xcec2('0x47')],[_0xcec2('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x41a239,null))[_0xcec2('0x45')](handleError(_0x41a239,null));};exports[_0xcec2('0x54')]=function(_0x15265e,_0x4351f5,_0x5b3eda){var _0x1b9508={};var _0x28ff52={};var _0xa209b2;var _0xdb4283;return db[_0xcec2('0x2d')][_0xcec2('0x4e')]({'where':{'id':_0x15265e[_0xcec2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4351f5,null))['then'](function(_0x420203){if(_0x420203){_0xa209b2=_0x420203;_0x28ff52[_0xcec2('0x31')]=_['keys'](db[_0xcec2('0x53')]['rawAttributes']);_0x28ff52['query']=_[_0xcec2('0x32')](_0x15265e[_0xcec2('0x33')]);_0x28ff52['filters']=_[_0xcec2('0x35')](_0x28ff52[_0xcec2('0x31')],_0x28ff52[_0xcec2('0x33')]);_0x1b9508['attributes']=_['intersection'](_0x28ff52['model'],qs[_0xcec2('0x36')](_0x15265e[_0xcec2('0x33')]['fields']));_0x1b9508[_0xcec2('0x37')]=_0x1b9508[_0xcec2('0x37')]['length']?_0x1b9508[_0xcec2('0x37')]:_0x28ff52['model'];_0x1b9508['order']=qs[_0xcec2('0x3a')](_0x15265e[_0xcec2('0x33')][_0xcec2('0x3a')]);_0x1b9508['where']=qs['filters'](_[_0xcec2('0x50')](_0x15265e[_0xcec2('0x33')],_0x28ff52[_0xcec2('0x34')]));if(_0x15265e[_0xcec2('0x33')]['filter']){_0x1b9508['where']=_[_0xcec2('0x3c')](_0x1b9508[_0xcec2('0x3b')],{'$or':_['map'](_0x1b9508[_0xcec2('0x37')],function(_0x22f49e){var _0x39be58={};_0x39be58[_0x22f49e]={'$like':'%'+_0x15265e[_0xcec2('0x33')][_0xcec2('0x3e')]+'%'};return _0x39be58;})});}_0x1b9508=_[_0xcec2('0x3c')]({},_0x1b9508,_0x15265e[_0xcec2('0x43')]);return _0xa209b2[_0xcec2('0x54')](_0x1b9508);}})[_0xcec2('0x26')](function(_0x3bcab3){if(_0x3bcab3){_0xdb4283=_0x3bcab3['length'];if(!_0x15265e[_0xcec2('0x33')]['hasOwnProperty'](_0xcec2('0x39'))){_0x1b9508['limit']=qs[_0xcec2('0x1e')](_0x15265e['query'][_0xcec2('0x1e')]);_0x1b9508['offset']=qs[_0xcec2('0x1d')](_0x15265e[_0xcec2('0x33')][_0xcec2('0x1d')]);}return _0xa209b2[_0xcec2('0x54')](_0x1b9508);}})[_0xcec2('0x26')](function(_0x3045ca){if(_0x3045ca){return _0x3045ca?{'count':_0xdb4283,'rows':_0x3045ca}:null;}})[_0xcec2('0x26')](respondWithResult(_0x4351f5,null))[_0xcec2('0x45')](handleError(_0x4351f5,null));}; \ No newline at end of file +var _0x95db=['getConditions','findOne','rawAttributes','addActions','Action','omit','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','name','send','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Automation','include','findAll','rows','catch','show','params','keys','find','body','addConditions','ids'];(function(_0x115642,_0x5341b3){var _0x516589=function(_0x3faf34){while(--_0x3faf34){_0x115642['push'](_0x115642['shift']());}};_0x516589(++_0x5341b3);}(_0x95db,0x18d));var _0xb95d=function(_0x12f7ed,_0x369dfb){_0x12f7ed=_0x12f7ed-0x0;var _0x45aec9=_0x95db[_0x12f7ed];return _0x45aec9;};'use strict';var emlformat=require(_0xb95d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb95d('0x1'));var jsonpatch=require(_0xb95d('0x2'));var rp=require(_0xb95d('0x3'));var moment=require(_0xb95d('0x4'));var BPromise=require(_0xb95d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb95d('0x6'));var sox=require(_0xb95d('0x7'));var csv=require(_0xb95d('0x8'));var ejs=require(_0xb95d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb95d('0xa'));var crypto=require(_0xb95d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb95d('0xc'));var toCsv=require(_0xb95d('0x8'));var querystring=require('querystring');var Papa=require(_0xb95d('0xd'));var Redis=require(_0xb95d('0xe'));var authService=require(_0xb95d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb95d('0x10'));var logger=require(_0xb95d('0x11'))(_0xb95d('0x12'));var utils=require(_0xb95d('0x13'));var config=require(_0xb95d('0x14'));var licenseUtil=require(_0xb95d('0x15'));var db=require(_0xb95d('0x16'))['db'];function respondWithStatusCode(_0x20e8db,_0x4939a6){_0x4939a6=_0x4939a6||0xcc;return function(_0x475d9d){if(_0x475d9d){return _0x20e8db[_0xb95d('0x17')](_0x4939a6);}return _0x20e8db[_0xb95d('0x18')](_0x4939a6)[_0xb95d('0x19')]();};}function respondWithResult(_0x3942c0,_0x32594b){_0x32594b=_0x32594b||0xc8;return function(_0x4f186e){if(_0x4f186e){return _0x3942c0[_0xb95d('0x18')](_0x32594b)[_0xb95d('0x1a')](_0x4f186e);}};}function respondWithFilteredResult(_0x4acb3f,_0x3d2d32){return function(_0x5d8e85){if(_0x5d8e85){var _0x334f73=typeof _0x3d2d32[_0xb95d('0x1b')]===_0xb95d('0x1c')&&typeof _0x3d2d32[_0xb95d('0x1d')]==='undefined';var _0x16c212=_0x5d8e85[_0xb95d('0x1e')];var _0x496e70=_0x334f73?0x0:_0x3d2d32[_0xb95d('0x1b')];var _0x5f311a=_0x334f73?_0x5d8e85[_0xb95d('0x1e')]:_0x3d2d32[_0xb95d('0x1b')]+_0x3d2d32[_0xb95d('0x1d')];var _0x260660;if(_0x5f311a>=_0x16c212){_0x5f311a=_0x16c212;_0x260660=0xc8;}else{_0x260660=0xce;}_0x4acb3f[_0xb95d('0x18')](_0x260660);return _0x4acb3f['set'](_0xb95d('0x1f'),_0x496e70+'-'+_0x5f311a+'/'+_0x16c212)[_0xb95d('0x1a')](_0x5d8e85);}return null;};}function patchUpdates(_0x1f2f9d){return function(_0x3d7cc6){try{jsonpatch[_0xb95d('0x20')](_0x3d7cc6,_0x1f2f9d,!![]);}catch(_0x46fc8c){return BPromise[_0xb95d('0x21')](_0x46fc8c);}return _0x3d7cc6['save']();};}function saveUpdates(_0x2a20d1,_0x14aa5e){return function(_0x157cbd){if(_0x157cbd){return _0x157cbd[_0xb95d('0x22')](_0x2a20d1)['then'](function(_0x3c08d9){return _0x3c08d9;});}return null;};}function removeEntity(_0x3f4b78,_0x2fbbbc){return function(_0x2e7c9e){if(_0x2e7c9e){return _0x2e7c9e[_0xb95d('0x23')]()[_0xb95d('0x24')](function(){_0x3f4b78[_0xb95d('0x18')](0xcc)[_0xb95d('0x19')]();});}};}function handleEntityNotFound(_0x15f27b,_0x4f1d6c){return function(_0x30904c){if(!_0x30904c){_0x15f27b['sendStatus'](0x194);}return _0x30904c;};}function handleError(_0x4c7403,_0x319c3b){_0x319c3b=_0x319c3b||0x1f4;return function(_0x98d136){logger['error'](_0x98d136['stack']);if(_0x98d136['name']){delete _0x98d136[_0xb95d('0x25')];}_0x4c7403[_0xb95d('0x18')](_0x319c3b)[_0xb95d('0x26')](_0x98d136);};}exports['index']=function(_0x286b06,_0x3108b1){var _0x193f84={},_0x459a45={},_0x53197f={'count':0x0,'rows':[]};var _0x30a8e5=_['map'](db['Automation']['rawAttributes'],function(_0xa9cde1){return{'name':_0xa9cde1['fieldName'],'type':_0xa9cde1[_0xb95d('0x27')][_0xb95d('0x28')]};});_0x459a45[_0xb95d('0x29')]=_[_0xb95d('0x2a')](_0x30a8e5,_0xb95d('0x25'));_0x459a45[_0xb95d('0x2b')]=_['keys'](_0x286b06[_0xb95d('0x2b')]);_0x459a45['filters']=_[_0xb95d('0x2c')](_0x459a45['model'],_0x459a45[_0xb95d('0x2b')]);_0x193f84['attributes']=_[_0xb95d('0x2c')](_0x459a45[_0xb95d('0x29')],qs[_0xb95d('0x2d')](_0x286b06['query']['fields']));_0x193f84[_0xb95d('0x2e')]=_0x193f84['attributes'][_0xb95d('0x2f')]?_0x193f84['attributes']:_0x459a45['model'];if(!_0x286b06[_0xb95d('0x2b')][_0xb95d('0x30')](_0xb95d('0x31'))){_0x193f84['limit']=qs[_0xb95d('0x1d')](_0x286b06[_0xb95d('0x2b')][_0xb95d('0x1d')]);_0x193f84[_0xb95d('0x1b')]=qs[_0xb95d('0x1b')](_0x286b06[_0xb95d('0x2b')][_0xb95d('0x1b')]);}_0x193f84[_0xb95d('0x32')]=qs['sort'](_0x286b06[_0xb95d('0x2b')][_0xb95d('0x33')]);_0x193f84[_0xb95d('0x34')]=qs[_0xb95d('0x35')](_[_0xb95d('0x36')](_0x286b06[_0xb95d('0x2b')],_0x459a45[_0xb95d('0x35')]),_0x30a8e5);if(_0x286b06['query'][_0xb95d('0x37')]){_0x193f84['where']=_[_0xb95d('0x38')](_0x193f84[_0xb95d('0x34')],{'$or':_[_0xb95d('0x2a')](_0x30a8e5,function(_0xf57a0){if(_0xf57a0[_0xb95d('0x27')]!==_0xb95d('0x39')){var _0x2c071e={};_0x2c071e[_0xf57a0['name']]={'$like':'%'+_0x286b06[_0xb95d('0x2b')][_0xb95d('0x37')]+'%'};return _0x2c071e;}})});}_0x193f84=_[_0xb95d('0x38')]({},_0x193f84,_0x286b06[_0xb95d('0x3a')]);var _0x370e7e={'where':_0x193f84['where']};return db[_0xb95d('0x3b')]['count'](_0x370e7e)['then'](function(_0x47de51){_0x53197f[_0xb95d('0x1e')]=_0x47de51;if(_0x286b06[_0xb95d('0x2b')]['includeAll']){_0x193f84[_0xb95d('0x3c')]=[{'all':!![]}];}return db['Automation'][_0xb95d('0x3d')](_0x193f84);})[_0xb95d('0x24')](function(_0x26e54a){_0x53197f[_0xb95d('0x3e')]=_0x26e54a;return _0x53197f;})['then'](respondWithFilteredResult(_0x3108b1,_0x193f84))[_0xb95d('0x3f')](handleError(_0x3108b1,null));};exports[_0xb95d('0x40')]=function(_0x218228,_0x327396){var _0x2bf315={'raw':![],'where':{'id':_0x218228[_0xb95d('0x41')]['id']}},_0x308509={};_0x308509[_0xb95d('0x29')]=_[_0xb95d('0x42')](db[_0xb95d('0x3b')]['rawAttributes']);_0x308509['query']=_[_0xb95d('0x42')](_0x218228['query']);_0x308509[_0xb95d('0x35')]=_[_0xb95d('0x2c')](_0x308509[_0xb95d('0x29')],_0x308509['query']);_0x2bf315[_0xb95d('0x2e')]=_[_0xb95d('0x2c')](_0x308509['model'],qs[_0xb95d('0x2d')](_0x218228[_0xb95d('0x2b')][_0xb95d('0x2d')]));_0x2bf315['attributes']=_0x2bf315[_0xb95d('0x2e')][_0xb95d('0x2f')]?_0x2bf315['attributes']:_0x308509[_0xb95d('0x29')];if(_0x218228[_0xb95d('0x2b')]['includeAll']){_0x2bf315[_0xb95d('0x3c')]=[{'all':!![]}];}_0x2bf315=_[_0xb95d('0x38')]({},_0x2bf315,_0x218228[_0xb95d('0x3a')]);return db[_0xb95d('0x3b')][_0xb95d('0x43')](_0x2bf315)[_0xb95d('0x24')](handleEntityNotFound(_0x327396,null))['then'](respondWithResult(_0x327396,null))['catch'](handleError(_0x327396,null));};exports['create']=function(_0x5ef2c3,_0x1b4d1c){return db[_0xb95d('0x3b')]['create'](_0x5ef2c3[_0xb95d('0x44')],{})[_0xb95d('0x24')](respondWithResult(_0x1b4d1c,0xc9))[_0xb95d('0x3f')](handleError(_0x1b4d1c,null));};exports[_0xb95d('0x22')]=function(_0x2a50bc,_0x1f98b6){if(_0x2a50bc[_0xb95d('0x44')]['id']){delete _0x2a50bc['body']['id'];}return db[_0xb95d('0x3b')][_0xb95d('0x43')]({'where':{'id':_0x2a50bc[_0xb95d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f98b6,null))[_0xb95d('0x24')](saveUpdates(_0x2a50bc[_0xb95d('0x44')],null))[_0xb95d('0x24')](respondWithResult(_0x1f98b6,null))[_0xb95d('0x3f')](handleError(_0x1f98b6,null));};exports[_0xb95d('0x23')]=function(_0x31340e,_0x1dad36){return db[_0xb95d('0x3b')]['find']({'where':{'id':_0x31340e['params']['id']}})[_0xb95d('0x24')](handleEntityNotFound(_0x1dad36,null))['then'](removeEntity(_0x1dad36,null))[_0xb95d('0x3f')](handleError(_0x1dad36,null));};exports[_0xb95d('0x45')]=function(_0x28f62d,_0x441e98,_0x2a8ed4){return db['Condition']['find']({'where':{'id':_0x28f62d[_0xb95d('0x41')]['id']}})[_0xb95d('0x24')](handleEntityNotFound(_0x441e98,null))['then'](function(_0xb142a9){if(_0xb142a9){return _0xb142a9[_0xb95d('0x45')](_0x28f62d['body'][_0xb95d('0x46')],_['omit'](_0x28f62d[_0xb95d('0x44')],[_0xb95d('0x46'),'id'])||{});}})[_0xb95d('0x24')](respondWithResult(_0x441e98,null))['catch'](handleError(_0x441e98,null));};exports[_0xb95d('0x47')]=function(_0x949b,_0x5df39c,_0x438cfa){var _0x474b79={};var _0x151ba8={};var _0x4be7cb;var _0x19aa7f;return db[_0xb95d('0x3b')][_0xb95d('0x48')]({'where':{'id':_0x949b['params']['id']}})['then'](handleEntityNotFound(_0x5df39c,null))[_0xb95d('0x24')](function(_0x59389d){if(_0x59389d){_0x4be7cb=_0x59389d;_0x151ba8[_0xb95d('0x29')]=_[_0xb95d('0x42')](db['Condition'][_0xb95d('0x49')]);_0x151ba8[_0xb95d('0x2b')]=_['keys'](_0x949b[_0xb95d('0x2b')]);_0x151ba8['filters']=_[_0xb95d('0x2c')](_0x151ba8['model'],_0x151ba8[_0xb95d('0x2b')]);_0x474b79[_0xb95d('0x2e')]=_['intersection'](_0x151ba8[_0xb95d('0x29')],qs[_0xb95d('0x2d')](_0x949b[_0xb95d('0x2b')]['fields']));_0x474b79[_0xb95d('0x2e')]=_0x474b79['attributes'][_0xb95d('0x2f')]?_0x474b79[_0xb95d('0x2e')]:_0x151ba8[_0xb95d('0x29')];_0x474b79[_0xb95d('0x32')]=qs['sort'](_0x949b[_0xb95d('0x2b')][_0xb95d('0x33')]);_0x474b79[_0xb95d('0x34')]=qs['filters'](_[_0xb95d('0x36')](_0x949b['query'],_0x151ba8['filters']));if(_0x949b[_0xb95d('0x2b')]['filter']){_0x474b79['where']=_[_0xb95d('0x38')](_0x474b79[_0xb95d('0x34')],{'$or':_['map'](_0x474b79[_0xb95d('0x2e')],function(_0x4dee89){var _0x33c202={};_0x33c202[_0x4dee89]={'$like':'%'+_0x949b[_0xb95d('0x2b')][_0xb95d('0x37')]+'%'};return _0x33c202;})});}_0x474b79=_[_0xb95d('0x38')]({},_0x474b79,_0x949b['options']);return _0x4be7cb[_0xb95d('0x47')](_0x474b79);}})[_0xb95d('0x24')](function(_0x3ae70d){if(_0x3ae70d){_0x19aa7f=_0x3ae70d[_0xb95d('0x2f')];if(!_0x949b[_0xb95d('0x2b')]['hasOwnProperty']('nolimit')){_0x474b79['limit']=qs[_0xb95d('0x1d')](_0x949b[_0xb95d('0x2b')][_0xb95d('0x1d')]);_0x474b79[_0xb95d('0x1b')]=qs[_0xb95d('0x1b')](_0x949b['query'][_0xb95d('0x1b')]);}return _0x4be7cb[_0xb95d('0x47')](_0x474b79);}})['then'](function(_0x225855){if(_0x225855){return _0x225855?{'count':_0x19aa7f,'rows':_0x225855}:null;}})[_0xb95d('0x24')](respondWithResult(_0x5df39c,null))[_0xb95d('0x3f')](handleError(_0x5df39c,null));};exports[_0xb95d('0x4a')]=function(_0x1f6a91,_0x28e5b2,_0x17cf6f){return db[_0xb95d('0x4b')][_0xb95d('0x43')]({'where':{'id':_0x1f6a91[_0xb95d('0x41')]['id']}})[_0xb95d('0x24')](handleEntityNotFound(_0x28e5b2,null))[_0xb95d('0x24')](function(_0x39512a){if(_0x39512a){return _0x39512a['addActions'](_0x1f6a91[_0xb95d('0x44')][_0xb95d('0x46')],_[_0xb95d('0x4c')](_0x1f6a91[_0xb95d('0x44')],[_0xb95d('0x46'),'id'])||{});}})[_0xb95d('0x24')](respondWithResult(_0x28e5b2,null))[_0xb95d('0x3f')](handleError(_0x28e5b2,null));};exports[_0xb95d('0x4d')]=function(_0x3b9915,_0x3f3f36,_0x25005e){var _0x15b554={};var _0x5b156c={};var _0x2aacce;var _0x48addf;return db['Automation'][_0xb95d('0x48')]({'where':{'id':_0x3b9915[_0xb95d('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f3f36,null))[_0xb95d('0x24')](function(_0x4d13bf){if(_0x4d13bf){_0x2aacce=_0x4d13bf;_0x5b156c['model']=_[_0xb95d('0x42')](db[_0xb95d('0x4b')][_0xb95d('0x49')]);_0x5b156c[_0xb95d('0x2b')]=_[_0xb95d('0x42')](_0x3b9915[_0xb95d('0x2b')]);_0x5b156c['filters']=_[_0xb95d('0x2c')](_0x5b156c[_0xb95d('0x29')],_0x5b156c['query']);_0x15b554['attributes']=_[_0xb95d('0x2c')](_0x5b156c[_0xb95d('0x29')],qs[_0xb95d('0x2d')](_0x3b9915[_0xb95d('0x2b')][_0xb95d('0x2d')]));_0x15b554[_0xb95d('0x2e')]=_0x15b554['attributes']['length']?_0x15b554[_0xb95d('0x2e')]:_0x5b156c[_0xb95d('0x29')];_0x15b554[_0xb95d('0x32')]=qs[_0xb95d('0x33')](_0x3b9915['query'][_0xb95d('0x33')]);_0x15b554[_0xb95d('0x34')]=qs[_0xb95d('0x35')](_[_0xb95d('0x36')](_0x3b9915['query'],_0x5b156c[_0xb95d('0x35')]));if(_0x3b9915[_0xb95d('0x2b')][_0xb95d('0x37')]){_0x15b554['where']=_['merge'](_0x15b554[_0xb95d('0x34')],{'$or':_[_0xb95d('0x2a')](_0x15b554[_0xb95d('0x2e')],function(_0x4ff170){var _0x503ea1={};_0x503ea1[_0x4ff170]={'$like':'%'+_0x3b9915['query']['filter']+'%'};return _0x503ea1;})});}_0x15b554=_['merge']({},_0x15b554,_0x3b9915[_0xb95d('0x3a')]);return _0x2aacce[_0xb95d('0x4d')](_0x15b554);}})[_0xb95d('0x24')](function(_0x5bf461){if(_0x5bf461){_0x48addf=_0x5bf461[_0xb95d('0x2f')];if(!_0x3b9915[_0xb95d('0x2b')][_0xb95d('0x30')](_0xb95d('0x31'))){_0x15b554[_0xb95d('0x1d')]=qs['limit'](_0x3b9915['query'][_0xb95d('0x1d')]);_0x15b554[_0xb95d('0x1b')]=qs[_0xb95d('0x1b')](_0x3b9915[_0xb95d('0x2b')][_0xb95d('0x1b')]);}return _0x2aacce['getActions'](_0x15b554);}})[_0xb95d('0x24')](function(_0x21f4de){if(_0x21f4de){return _0x21f4de?{'count':_0x48addf,'rows':_0x21f4de}:null;}})[_0xb95d('0x24')](respondWithResult(_0x3f3f36,null))[_0xb95d('0x3f')](handleError(_0x3f3f36,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b90b22f..ea98890 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 _0x7417=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x25ded3,_0x21f38f){var _0x20efad=function(_0x5c9ed0){while(--_0x5c9ed0){_0x25ded3['push'](_0x25ded3['shift']());}};_0x20efad(++_0x21f38f);}(_0x7417,0xb5));var _0x7741=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7417[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x7741('0x0'));var util=require('util');var logger=require(_0x7741('0x1'))(_0x7741('0x2'));var moment=require(_0x7741('0x3'));var BPromise=require(_0x7741('0x4'));var rp=require(_0x7741('0x5'));var fs=require('fs');var path=require(_0x7741('0x6'));var rimraf=require(_0x7741('0x7'));var config=require(_0x7741('0x8'));var attributes=require(_0x7741('0x9'));module['exports']=function(_0x6905f7,_0x5be39e){return _0x6905f7[_0x7741('0xa')](_0x7741('0xb'),attributes,{'tableName':_0x7741('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd778=['api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger'];(function(_0x5984c1,_0x505a51){var _0x3d1522=function(_0x6d5439){while(--_0x6d5439){_0x5984c1['push'](_0x5984c1['shift']());}};_0x3d1522(++_0x505a51);}(_0xd778,0xf5));var _0x8d77=function(_0x482a85,_0x2cb8ca){_0x482a85=_0x482a85-0x0;var _0x5ececb=_0xd778[_0x482a85];return _0x5ececb;};'use strict';var _=require('lodash');var util=require(_0x8d77('0x0'));var logger=require(_0x8d77('0x1'))(_0x8d77('0x2'));var moment=require('moment');var BPromise=require(_0x8d77('0x3'));var rp=require(_0x8d77('0x4'));var fs=require('fs');var path=require(_0x8d77('0x5'));var rimraf=require(_0x8d77('0x6'));var config=require(_0x8d77('0x7'));var attributes=require(_0x8d77('0x8'));module[_0x8d77('0x9')]=function(_0x4016e5,_0x6969b8){return _0x4016e5[_0x8d77('0xa')](_0x8d77('0xb'),attributes,{'tableName':_0x8d77('0xc'),'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 5f2f375..8ec865b 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 _0xe797=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xe797,0x12a));var _0x7e79=function(_0x2c96a5,_0x2fbbb0){_0x2c96a5=_0x2c96a5-0x0;var _0x410169=_0xe797[_0x2c96a5];return _0x410169;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require(_0x7e79('0x2'));var BPromise=require(_0x7e79('0x3'));var rs=require(_0x7e79('0x4'));var fs=require('fs');var Redis=require(_0x7e79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e79('0x6'));var logger=require(_0x7e79('0x7'))('rpc');var config=require(_0x7e79('0x8'));var jayson=require(_0x7e79('0x9'));var client=jayson[_0x7e79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdfa1,_0x9dd35a,_0x358bd6){return new BPromise(function(_0x484e66,_0x54aab5){return client[_0x7e79('0xb')](_0x4fdfa1,_0x358bd6)[_0x7e79('0xc')](function(_0x134e89){logger['info'](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));logger[_0x7e79('0xf')](_0x7e79('0x10'),_0x9dd35a,_0x7e79('0xe'),JSON[_0x7e79('0x11')](_0x134e89));if(_0x134e89[_0x7e79('0x12')]){if(_0x134e89[_0x7e79('0x12')][_0x7e79('0x13')]===0x1f4){logger['error'](_0x7e79('0xd'),_0x9dd35a,_0x134e89['error'][_0x7e79('0x14')]);return _0x54aab5(_0x134e89['error'][_0x7e79('0x14')]);}logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x134e89[_0x7e79('0x12')]['message']);return _0x484e66(_0x134e89[_0x7e79('0x12')][_0x7e79('0x14')]);}else{logger[_0x7e79('0x15')](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));_0x484e66(_0x134e89[_0x7e79('0x16')][_0x7e79('0x14')]);}})['catch'](function(_0x2ec0c7){logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x2ec0c7);_0x54aab5(_0x2ec0c7);});});} \ No newline at end of file +var _0xc692=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0xc692,0x15f));var _0x2c69=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc692[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var moment=require(_0x2c69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c69('0x3'));var db=require(_0x2c69('0x4'))['db'];var utils=require(_0x2c69('0x5'));var logger=require(_0x2c69('0x6'))(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var jayson=require(_0x2c69('0x9'));var client=jayson['client'][_0x2c69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4da70c,_0x5c1260,_0x31688a){return new BPromise(function(_0x7a913a,_0xfc5ebb){return client[_0x2c69('0xb')](_0x4da70c,_0x31688a)[_0x2c69('0xc')](function(_0x131313){logger['info'](_0x2c69('0xd'),_0x5c1260,'request\x20sent');logger[_0x2c69('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x5c1260,_0x2c69('0xf'),JSON[_0x2c69('0x10')](_0x131313));if(_0x131313[_0x2c69('0x11')]){if(_0x131313[_0x2c69('0x11')][_0x2c69('0x12')]===0x1f4){logger[_0x2c69('0x11')]('Automation,\x20%s,\x20%s',_0x5c1260,_0x131313[_0x2c69('0x11')]['message']);return _0xfc5ebb(_0x131313[_0x2c69('0x11')][_0x2c69('0x13')]);}logger[_0x2c69('0x11')](_0x2c69('0xd'),_0x5c1260,_0x131313[_0x2c69('0x11')][_0x2c69('0x13')]);return _0x7a913a(_0x131313['error'][_0x2c69('0x13')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5c1260,_0x2c69('0xf'));_0x7a913a(_0x131313['result'][_0x2c69('0x13')]);}})[_0x2c69('0x14')](function(_0x59e48a){logger['error'](_0x2c69('0xd'),_0x5c1260,_0x59e48a);_0xfc5ebb(_0x59e48a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 06a9c6c..2c4342e 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 _0xc678=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/conditions','getActions','post','create','/:id','update','destroy','exports','path'];(function(_0x2d39e1,_0xcdb7d0){var _0x4bcfc6=function(_0x46a1bf){while(--_0x46a1bf){_0x2d39e1['push'](_0x2d39e1['shift']());}};_0x4bcfc6(++_0xcdb7d0);}(_0xc678,0x1b4));var _0x8c67=function(_0x4be6d5,_0x299b85){_0x4be6d5=_0x4be6d5-0x0;var _0x56485d=_0xc678[_0x4be6d5];return _0x56485d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c67('0x0'));var timeout=require(_0x8c67('0x1'));var express=require(_0x8c67('0x2'));var router=express['Router']();var fs_extra=require(_0x8c67('0x3'));var auth=require(_0x8c67('0x4'));var interaction=require(_0x8c67('0x5'));var config=require(_0x8c67('0x6'));var controller=require('./automation.controller');router[_0x8c67('0x7')]('/',auth['isAuthenticated'](),controller[_0x8c67('0x8')]);router[_0x8c67('0x7')]('/:id',auth[_0x8c67('0x9')](),controller[_0x8c67('0xa')]);router[_0x8c67('0x7')](_0x8c67('0xb'),auth[_0x8c67('0x9')](),controller['getConditions']);router[_0x8c67('0x7')]('/:id/actions',auth[_0x8c67('0x9')](),controller[_0x8c67('0xc')]);router[_0x8c67('0xd')]('/',auth['isAuthenticated'](),controller[_0x8c67('0xe')]);router[_0x8c67('0xd')](_0x8c67('0xb'),auth[_0x8c67('0x9')](),controller['addConditions']);router[_0x8c67('0xd')]('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router['put'](_0x8c67('0xf'),auth['isAuthenticated'](),controller[_0x8c67('0x10')]);router['delete'](_0x8c67('0xf'),auth[_0x8c67('0x9')](),controller[_0x8c67('0x11')]);module[_0x8c67('0x12')]=router; \ No newline at end of file +var _0x032a=['put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions','post','addActions'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x032a,0xf0));var _0xa032=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x032a[_0x36fbef];return _0x45e270;};'use strict';var multer=require('multer');var util=require(_0xa032('0x0'));var path=require('path');var timeout=require(_0xa032('0x1'));var express=require(_0xa032('0x2'));var router=express[_0xa032('0x3')]();var fs_extra=require(_0xa032('0x4'));var auth=require(_0xa032('0x5'));var interaction=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var controller=require(_0xa032('0x8'));router[_0xa032('0x9')]('/',auth[_0xa032('0xa')](),controller[_0xa032('0xb')]);router[_0xa032('0x9')]('/:id',auth[_0xa032('0xa')](),controller['show']);router['get'](_0xa032('0xc'),auth['isAuthenticated'](),controller[_0xa032('0xd')]);router[_0xa032('0x9')](_0xa032('0xe'),auth[_0xa032('0xa')](),controller[_0xa032('0xf')]);router['post']('/',auth[_0xa032('0xa')](),controller[_0xa032('0x10')]);router['post'](_0xa032('0xc'),auth[_0xa032('0xa')](),controller[_0xa032('0x11')]);router[_0xa032('0x12')](_0xa032('0xe'),auth['isAuthenticated'](),controller[_0xa032('0x13')]);router[_0xa032('0x14')](_0xa032('0x15'),auth[_0xa032('0xa')](),controller[_0xa032('0x16')]);router[_0xa032('0x17')](_0xa032('0x15'),auth[_0xa032('0xa')](),controller[_0xa032('0x18')]);module[_0xa032('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 49c8ea7..409c4c6 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 _0x8997=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\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)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x22f9a3,_0x57a0ae){var _0x4a602d=function(_0x61a010){while(--_0x61a010){_0x22f9a3['push'](_0x22f9a3['shift']());}};_0x4a602d(++_0x57a0ae);}(_0x8997,0x18e));var _0x7899=function(_0x28fec5,_0xad468b){_0x28fec5=_0x28fec5-0x0;var _0xfa47dc=_0x8997[_0x28fec5];return _0xfa47dc;};'use strict';var Sequelize=require(_0x7899('0x0'));module[_0x7899('0x1')]={'name':{'type':Sequelize[_0x7899('0x2')],'unique':_0x7899('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7899('0x4')](_0x7899('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x7899('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7899('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x7899('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7899('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7899('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7899('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7899('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7899('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7899('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7899('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7899('0x7')],'defaultValue':0x3,'comment':_0x7899('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7899('0xf')},'dialTimezone':{'type':Sequelize[_0x7899('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7899('0x2')],'defaultValue':_0x7899('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x7899('0x4')](_0x7899('0x11'),_0x7899('0x12'),_0x7899('0x13')),'defaultValue':_0x7899('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7899('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7899('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7899('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7899('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7899('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7899('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7899('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7899('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7899('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7899('0x9')](0x9)[_0x7899('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7899('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7899('0x4')](_0x7899('0x1c'),_0x7899('0x1d')),'defaultValue':_0x7899('0x1c')},'dialPrefix':{'type':Sequelize[_0x7899('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7899('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7899('0x1e')},'dialCutDigit':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7899('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7899('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7899('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7899('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7899('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7899('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7899('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7899('0x9')](0x3)[_0x7899('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7899('0x9')](0x5)[_0x7899('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xe77c=['Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN'];(function(_0xa3642c,_0x14b58d){var _0xb76ecd=function(_0x53d689){while(--_0x53d689){_0xa3642c['push'](_0xa3642c['shift']());}};_0xb76ecd(++_0x14b58d);}(_0xe77c,0x176));var _0xce77=function(_0x10319c,_0x511e1d){_0x10319c=_0x10319c-0x0;var _0x4a808b=_0xe77c[_0x10319c];return _0x4a808b;};'use strict';var Sequelize=require(_0xce77('0x0'));module[_0xce77('0x1')]={'name':{'type':Sequelize[_0xce77('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xce77('0x3')](_0xce77('0x4')),'allowNull':![],'defaultValue':_0xce77('0x4')},'description':{'type':Sequelize[_0xce77('0x2')]},'active':{'type':Sequelize[_0xce77('0x5')],'defaultValue':0x0,'comment':_0xce77('0x6')},'limitCalls':{'type':Sequelize[_0xce77('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xce77('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xce77('0x7')](0x3)[_0xce77('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xce77('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xce77('0xd')},'dialTimezone':{'type':Sequelize[_0xce77('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xce77('0x2')],'defaultValue':_0xce77('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xce77('0x3')](_0xce77('0xf'),'never',_0xce77('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xce77('0x5')],'defaultValue':0x0,'comment':_0xce77('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xce77('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xce77('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xce77('0x7')](0x9)[_0xce77('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xce77('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xce77('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xce77('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xce77('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xce77('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xce77('0x7')](0x9)[_0xce77('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xce77('0x7')](0x9)[_0xce77('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xce77('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xce77('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xce77('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xce77('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xce77('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xce77('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xce77('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xce77('0x1a'),_0xce77('0x1b')),'defaultValue':_0xce77('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xce77('0x1c')},'dialCutDigit':{'type':Sequelize[_0xce77('0x7')](0x3)[_0xce77('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xce77('0x7')](0x3)[_0xce77('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xce77('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce77('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xce77('0x7')](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xce77('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce77('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xce77('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce77('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 73cc0e8..a3d546f 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 _0x13f6=['ListId\x20=\x20?','cm_hopper_additional_phones','h.id','ci.item','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','error','send','index','map','Campaign','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','omit','createdAt','updatedAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','pick','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','cm_contacts','deletedAt\x20IS\x20NULL'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x13f6,0x124));var _0x613f=function(_0x4c17fb,_0x1d38be){_0x4c17fb=_0x4c17fb-0x0;var _0x4ac2af=_0x13f6[_0x4c17fb];return _0x4ac2af;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['clone']=function(_0x387913,_0x52c2a6){var _0x13e3a4={'where':{'id':_0x387913[_0x613f('0x42')]['id']}},_0x59d6bb={};_0x59d6bb[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x13e3a4[_0x613f('0x34')]=_[_0x613f('0x32')](_0x59d6bb['model'],qs[_0x613f('0x35')](_0x387913['query'][_0x613f('0x35')]));_0x13e3a4[_0x613f('0x34')]=_0x13e3a4[_0x613f('0x34')][_0x613f('0x43')]?_0x13e3a4[_0x613f('0x34')]:_0x59d6bb[_0x613f('0x2e')];if(_0x387913[_0x613f('0x33')][_0x613f('0x3d')]){_0x13e3a4[_0x613f('0x44')]=[{'all':!![]}];}_0x13e3a4=_[_0x613f('0x3b')]({},_0x13e3a4,_0x387913[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x13e3a4)['then'](handleEntityNotFound(_0x52c2a6,null))['then'](function(_0x687e56){if(_0x687e56){var _0x4b6eb3=_0x687e56[_0x613f('0x49')]({'plain':!![]});_0x4b6eb3=qs[_0x613f('0x4d')](_0x4b6eb3,['id',_0x613f('0x4e'),_0x613f('0x4f')]);_0x387913[_0x613f('0x47')]=_[_0x613f('0x4d')](_0x387913[_0x613f('0x47')],['id',_0x613f('0x4e'),_0x613f('0x4f')]);return db[_0x613f('0x2a')][_0x613f('0x46')](_['merge'](_0x4b6eb3,_0x387913[_0x613f('0x47')]),{'include':_0x387913[_0x613f('0x33')][_0x613f('0x3d')]?[{'all':!![]}]:undefined})[_0x613f('0x23')](function(_0x5a3ea1){var _0xacca40=_0x387913[_0x613f('0x48')]['get']({'plain':!![]});if(!_0xacca40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xacca40[_0x613f('0x50')]==='user'){var _0x50ad7d=_0x5a3ea1['get']({'plain':!![]});var _0x1a1ef2='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x1a1ef2,'userProfileId':_0xacca40[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x5bf4ce){if(_0x5bf4ce&&_0x5bf4ce[_0x613f('0x51')]===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x50ad7d[_0x613f('0x2f')],'resourceId':_0x50ad7d['id'],'type':_0x5bf4ce['name'],'sectionId':_0x5bf4ce['id']},{})[_0x613f('0x23')](function(){return _0x5a3ea1;});}else{return _0x5a3ea1;}})[_0x613f('0x40')](function(_0x5d0ab7){logger[_0x613f('0x26')](_0x613f('0x52'),_0x5d0ab7);throw _0x5d0ab7;});}return _0x5a3ea1;});}})[_0x613f('0x23')](respondWithResult(_0x52c2a6,0xc9))[_0x613f('0x40')](handleError(_0x52c2a6,null));};exports[_0x613f('0x22')]=function(_0xdf8993,_0xbead7c){if(_0xdf8993[_0x613f('0x47')]['id']){delete _0xdf8993[_0x613f('0x47')]['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0xdf8993[_0x613f('0x42')]['id']}})['then'](handleEntityNotFound(_0xbead7c,null))[_0x613f('0x23')](saveUpdates(_0xdf8993[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0xbead7c,null))[_0x613f('0x40')](handleError(_0xbead7c,null));};exports[_0x613f('0x24')]=function(_0x2d9b65,_0x4e2002){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x2d9b65[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x4e2002,null))[_0x613f('0x23')](removeEntity(_0x4e2002,null))[_0x613f('0x40')](handleError(_0x4e2002,null));};exports['getHoppers']=function(_0x4efc80,_0x42282a,_0x25a550){var _0x7706c7={'raw':!![],'where':{}};var _0xddcd6={};var _0x4f28c7={'count':0x0,'rows':[]};return db[_0x613f('0x2a')][_0x613f('0x53')]({'where':{'id':_0x4efc80[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x42282a,null))['then'](function(_0x282a9f){if(_0x282a9f){_0xddcd6[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x54')][_0x613f('0x2b')]);_0xddcd6[_0x613f('0x33')]=_[_0x613f('0x30')](_0x4efc80[_0x613f('0x33')]);_0xddcd6['filters']=_[_0x613f('0x32')](_0xddcd6[_0x613f('0x2e')],_0xddcd6[_0x613f('0x33')]);_0x7706c7[_0x613f('0x34')]=_[_0x613f('0x32')](_0xddcd6[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x4efc80[_0x613f('0x33')][_0x613f('0x35')]));_0x7706c7[_0x613f('0x34')]=_0x7706c7['attributes'][_0x613f('0x43')]?_0x7706c7[_0x613f('0x34')]:_0xddcd6[_0x613f('0x2e')];if(!_0x4efc80[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x7706c7[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x4efc80[_0x613f('0x33')][_0x613f('0x1a')]);_0x7706c7[_0x613f('0x1d')]=qs['offset'](_0x4efc80[_0x613f('0x33')][_0x613f('0x1d')]);}_0x7706c7[_0x613f('0x55')]=qs[_0x613f('0x38')](_0x4efc80[_0x613f('0x33')][_0x613f('0x38')]);_0x7706c7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x56')](_0x4efc80[_0x613f('0x33')],_0xddcd6[_0x613f('0x31')]));_0x7706c7[_0x613f('0x39')]['CampaignId']=_0x282a9f['id'];if(_0x4efc80[_0x613f('0x33')][_0x613f('0x3a')]){_0x7706c7['where']=_[_0x613f('0x3b')](_0x7706c7['where'],{'$or':_[_0x613f('0x29')](_0x7706c7['attributes'],function(_0x49cb13){var _0x2587ad={};_0x2587ad[_0x49cb13]={'$like':'%'+_0x4efc80[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x2587ad;})});}_0x7706c7=_[_0x613f('0x3b')]({},_0x7706c7,_0x4efc80[_0x613f('0x3c')]);return db[_0x613f('0x54')][_0x613f('0x1c')]({'where':_0x7706c7['where']})[_0x613f('0x23')](function(_0x45cf0a){_0x4f28c7[_0x613f('0x1c')]=_0x45cf0a;if(_0x4efc80[_0x613f('0x33')][_0x613f('0x3d')]){_0x7706c7['include']=[{'all':!![]}];}return db[_0x613f('0x54')][_0x613f('0x3e')](_0x7706c7);})['then'](function(_0x188be6){_0x4f28c7[_0x613f('0x3f')]=_0x188be6;return _0x4f28c7;});}})[_0x613f('0x23')](respondWithFilteredResult(_0x42282a,_0x7706c7))['catch'](handleError(_0x42282a,null));};exports['getHopperHistories']=function(_0x5605c9,_0x39ae92,_0x34a375){var _0x574ec4={'raw':!![],'where':{}};var _0x23e150={};var _0x13ae55={'count':0x0,'rows':[]};return db[_0x613f('0x2a')]['findOne']({'where':{'id':_0x5605c9[_0x613f('0x42')]['id']}})['then'](handleEntityNotFound(_0x39ae92,null))[_0x613f('0x23')](function(_0x537763){if(_0x537763){_0x23e150['model']=_[_0x613f('0x30')](db[_0x613f('0x57')][_0x613f('0x2b')]);_0x23e150[_0x613f('0x33')]=_[_0x613f('0x30')](_0x5605c9[_0x613f('0x33')]);_0x23e150[_0x613f('0x31')]=_[_0x613f('0x32')](_0x23e150[_0x613f('0x2e')],_0x23e150[_0x613f('0x33')]);_0x574ec4[_0x613f('0x34')]=_['intersection'](_0x23e150[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x5605c9[_0x613f('0x33')][_0x613f('0x35')]));_0x574ec4[_0x613f('0x34')]=_0x574ec4[_0x613f('0x34')][_0x613f('0x43')]?_0x574ec4['attributes']:_0x23e150[_0x613f('0x2e')];if(!_0x5605c9[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x574ec4['limit']=qs[_0x613f('0x1a')](_0x5605c9[_0x613f('0x33')][_0x613f('0x1a')]);_0x574ec4[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x5605c9[_0x613f('0x33')]['offset']);}_0x574ec4[_0x613f('0x55')]=qs[_0x613f('0x38')](_0x5605c9['query'][_0x613f('0x38')]);_0x574ec4[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x56')](_0x5605c9[_0x613f('0x33')],_0x23e150['filters']));_0x574ec4[_0x613f('0x39')][_0x613f('0x58')]=_0x537763['id'];if(_0x5605c9[_0x613f('0x33')][_0x613f('0x3a')]){_0x574ec4[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x574ec4['where'],{'$or':_['map'](_0x574ec4[_0x613f('0x34')],function(_0x491818){var _0x2e7533={};_0x2e7533[_0x491818]={'$like':'%'+_0x5605c9['query'][_0x613f('0x3a')]+'%'};return _0x2e7533;})});}_0x574ec4=_[_0x613f('0x3b')]({},_0x574ec4,_0x5605c9[_0x613f('0x3c')]);return db[_0x613f('0x57')]['count']({'where':_0x574ec4[_0x613f('0x39')]})[_0x613f('0x23')](function(_0x4e69a2){_0x13ae55['count']=_0x4e69a2;if(_0x5605c9['query'][_0x613f('0x3d')]){_0x574ec4['include']=[{'all':!![]}];}return db[_0x613f('0x57')][_0x613f('0x3e')](_0x574ec4);})[_0x613f('0x23')](function(_0x424c12){_0x13ae55['rows']=_0x424c12;return _0x13ae55;});}})[_0x613f('0x23')](respondWithFilteredResult(_0x39ae92,_0x574ec4))[_0x613f('0x40')](handleError(_0x39ae92,null));};exports[_0x613f('0x59')]=function(_0x31762e,_0x22557a,_0x27646c){var _0x293a53={'raw':!![],'where':{}};var _0x5159ab={};var _0x286977={'count':0x0,'rows':[]};return db[_0x613f('0x2a')][_0x613f('0x53')]({'where':{'id':_0x31762e['params']['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x22557a,null))[_0x613f('0x23')](function(_0x7fada0){if(_0x7fada0){_0x5159ab['model']=_[_0x613f('0x30')](db[_0x613f('0x5a')][_0x613f('0x2b')]);_0x5159ab[_0x613f('0x33')]=_[_0x613f('0x30')](_0x31762e[_0x613f('0x33')]);_0x5159ab[_0x613f('0x31')]=_[_0x613f('0x32')](_0x5159ab['model'],_0x5159ab['query']);_0x293a53[_0x613f('0x34')]=_[_0x613f('0x32')](_0x5159ab[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x31762e[_0x613f('0x33')]['fields']));_0x293a53[_0x613f('0x34')]=_0x293a53['attributes'][_0x613f('0x43')]?_0x293a53[_0x613f('0x34')]:_0x5159ab[_0x613f('0x2e')];if(!_0x31762e[_0x613f('0x33')]['hasOwnProperty'](_0x613f('0x37'))){_0x293a53[_0x613f('0x1a')]=qs['limit'](_0x31762e[_0x613f('0x33')]['limit']);_0x293a53[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x31762e[_0x613f('0x33')][_0x613f('0x1d')]);}_0x293a53[_0x613f('0x55')]=qs['sort'](_0x31762e[_0x613f('0x33')][_0x613f('0x38')]);_0x293a53['where']=qs[_0x613f('0x31')](_['pick'](_0x31762e[_0x613f('0x33')],_0x5159ab[_0x613f('0x31')]));_0x293a53[_0x613f('0x39')][_0x613f('0x58')]=_0x7fada0['id'];if(_0x31762e[_0x613f('0x33')][_0x613f('0x3a')]){_0x293a53[_0x613f('0x39')]=_['merge'](_0x293a53[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x293a53[_0x613f('0x34')],function(_0x78c992){var _0x2aa59b={};_0x2aa59b[_0x78c992]={'$like':'%'+_0x31762e[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x2aa59b;})});}_0x293a53=_[_0x613f('0x3b')]({},_0x293a53,_0x31762e[_0x613f('0x3c')]);return db[_0x613f('0x5a')]['count']({'where':_0x293a53[_0x613f('0x39')]})[_0x613f('0x23')](function(_0x550975){_0x286977[_0x613f('0x1c')]=_0x550975;if(_0x31762e[_0x613f('0x33')]['includeAll']){_0x293a53[_0x613f('0x44')]=[{'all':!![]}];}return db[_0x613f('0x5a')][_0x613f('0x3e')](_0x293a53);})[_0x613f('0x23')](function(_0x26883c){_0x286977[_0x613f('0x3f')]=_0x26883c;return _0x286977;});}})[_0x613f('0x23')](respondWithFilteredResult(_0x22557a,_0x293a53))[_0x613f('0x40')](handleError(_0x22557a,null));};exports[_0x613f('0x5b')]=function(_0x1f21be,_0x23799d,_0x149325){var _0x2c7de2={'raw':!![],'where':{}};var _0x2112be={};var _0x6110c0={'count':0x0,'rows':[]};return db[_0x613f('0x2a')][_0x613f('0x53')]({'where':{'id':_0x1f21be[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x23799d,null))[_0x613f('0x23')](function(_0x571704){if(_0x571704){_0x2112be[_0x613f('0x2e')]=_['keys'](db[_0x613f('0x5c')][_0x613f('0x2b')]);_0x2112be['query']=_[_0x613f('0x30')](_0x1f21be[_0x613f('0x33')]);_0x2112be[_0x613f('0x31')]=_[_0x613f('0x32')](_0x2112be[_0x613f('0x2e')],_0x2112be[_0x613f('0x33')]);_0x2c7de2['attributes']=_[_0x613f('0x32')](_0x2112be[_0x613f('0x2e')],qs['fields'](_0x1f21be[_0x613f('0x33')][_0x613f('0x35')]));_0x2c7de2[_0x613f('0x34')]=_0x2c7de2[_0x613f('0x34')][_0x613f('0x43')]?_0x2c7de2[_0x613f('0x34')]:_0x2112be['model'];if(!_0x1f21be[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x2c7de2[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x1f21be[_0x613f('0x33')][_0x613f('0x1a')]);_0x2c7de2[_0x613f('0x1d')]=qs['offset'](_0x1f21be[_0x613f('0x33')]['offset']);}_0x2c7de2['order']=qs[_0x613f('0x38')](_0x1f21be[_0x613f('0x33')]['sort']);_0x2c7de2[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x56')](_0x1f21be[_0x613f('0x33')],_0x2112be[_0x613f('0x31')]));_0x2c7de2[_0x613f('0x39')][_0x613f('0x58')]=_0x571704['id'];if(_0x1f21be[_0x613f('0x33')][_0x613f('0x3a')]){_0x2c7de2['where']=_[_0x613f('0x3b')](_0x2c7de2['where'],{'$or':_[_0x613f('0x29')](_0x2c7de2[_0x613f('0x34')],function(_0x581319){var _0xd7c7e0={};_0xd7c7e0[_0x581319]={'$like':'%'+_0x1f21be['query'][_0x613f('0x3a')]+'%'};return _0xd7c7e0;})});}_0x2c7de2=_[_0x613f('0x3b')]({},_0x2c7de2,_0x1f21be[_0x613f('0x3c')]);return db['CmHopperBlack'][_0x613f('0x1c')]({'where':_0x2c7de2[_0x613f('0x39')]})[_0x613f('0x23')](function(_0x22cadd){_0x6110c0[_0x613f('0x1c')]=_0x22cadd;if(_0x1f21be[_0x613f('0x33')][_0x613f('0x3d')]){_0x2c7de2[_0x613f('0x44')]=[{'all':!![]}];}return db[_0x613f('0x5c')]['findAll'](_0x2c7de2);})[_0x613f('0x23')](function(_0x32c451){_0x6110c0[_0x613f('0x3f')]=_0x32c451;return _0x6110c0;});}})['then'](respondWithFilteredResult(_0x23799d,_0x2c7de2))[_0x613f('0x40')](handleError(_0x23799d,null));};exports[_0x613f('0x5d')]=function(_0xcc5140,_0x406937,_0x47014c){var _0x3a2df6={};var _0x36dc8f={};var _0x335135;var _0x58a5a5;return db[_0x613f('0x2a')][_0x613f('0x53')]({'where':{'id':_0xcc5140[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x406937,null))[_0x613f('0x23')](function(_0x339e10){if(_0x339e10){_0x335135=_0x339e10;_0x36dc8f[_0x613f('0x2e')]=_[_0x613f('0x30')](db['CmList']['rawAttributes']);_0x36dc8f[_0x613f('0x33')]=_[_0x613f('0x30')](_0xcc5140[_0x613f('0x33')]);_0x36dc8f['filters']=_[_0x613f('0x32')](_0x36dc8f[_0x613f('0x2e')],_0x36dc8f[_0x613f('0x33')]);_0x3a2df6['attributes']=_[_0x613f('0x32')](_0x36dc8f['model'],qs['fields'](_0xcc5140[_0x613f('0x33')][_0x613f('0x35')]));_0x3a2df6['attributes']=_0x3a2df6[_0x613f('0x34')][_0x613f('0x43')]?_0x3a2df6['attributes']:_0x36dc8f[_0x613f('0x2e')];_0x3a2df6[_0x613f('0x55')]=qs[_0x613f('0x38')](_0xcc5140[_0x613f('0x33')][_0x613f('0x38')]);_0x3a2df6['where']=qs['filters'](_[_0x613f('0x56')](_0xcc5140['query'],_0x36dc8f[_0x613f('0x31')]));if(_0xcc5140['query'][_0x613f('0x3a')]){_0x3a2df6['where']=_[_0x613f('0x3b')](_0x3a2df6['where'],{'$or':_['map'](_0x3a2df6[_0x613f('0x34')],function(_0x453f04){var _0x47c19c={};_0x47c19c[_0x453f04]={'$like':'%'+_0xcc5140[_0x613f('0x33')]['filter']+'%'};return _0x47c19c;})});}_0x3a2df6=_['merge']({},_0x3a2df6,_0xcc5140['options']);return _0x335135[_0x613f('0x5d')](_0x3a2df6);}})[_0x613f('0x23')](function(_0x3c3527){if(_0x3c3527){_0x58a5a5=_0x3c3527['length'];if(!_0xcc5140[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x3a2df6['limit']=qs[_0x613f('0x1a')](_0xcc5140[_0x613f('0x33')][_0x613f('0x1a')]);_0x3a2df6[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0xcc5140[_0x613f('0x33')][_0x613f('0x1d')]);}return _0x335135['getLists'](_0x3a2df6);}})[_0x613f('0x23')](function(_0xfa404f){if(_0xfa404f){return _0xfa404f?{'count':_0x58a5a5,'rows':_0xfa404f}:null;}})[_0x613f('0x23')](respondWithResult(_0x406937,null))['catch'](handleError(_0x406937,null));};exports[_0x613f('0x5e')]=function(_0x380e1a,_0xcc214f,_0x52de26){var _0x1021f0,_0x15564e;var _0x3b5efa=[];var _0x5e5997=moment()[_0x613f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x380e1a[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0xcc214f,null))[_0x613f('0x23')](function(_0xeb81e){if(_0xeb81e){_0x15564e=_0xeb81e;return _0xeb81e[_0x613f('0x5e')](_0x380e1a['body']['ids'],_['omit'](_0x380e1a[_0x613f('0x47')],[_0x613f('0x60'),'id'])||{});}return null;})[_0x613f('0x61')](function(_0x8611b){var _0x4d35e5;var _0x4b8e0b;_0x1021f0=_0x8611b||[];var _0x39e193=[];if(_0x8611b){for(var _0x3bbab0=0x0;_0x3bbab0<_0x8611b[_0x613f('0x43')];_0x3bbab0+=0x1){var _0x2b66fb=_0x8611b[_0x3bbab0][_0x613f('0x49')]({'plain':!![]});_0x15564e['dialCheckDuplicateType']=_0x380e1a['body'][_0x613f('0x62')]?_0x380e1a[_0x613f('0x47')][_0x613f('0x62')]:_0x15564e[_0x613f('0x62')];switch(_0x15564e[_0x613f('0x62')]){case'always':_0x4d35e5=squel[_0x613f('0x63')]()[_0x613f('0x64')](_0x613f('0x65'))[_0x613f('0x66')]([_0x613f('0x67'),_0x613f('0x68'),_0x613f('0x69'),_0x613f('0x6a'),_0x613f('0x58'),_0x613f('0x4e'),_0x613f('0x4f')],squel[_0x613f('0x6b')]()[_0x613f('0x6c')]('phone',_0x613f('0x67'))[_0x613f('0x6c')](_0x613f('0x6d'),_0x613f('0x68'))['field']('id',_0x613f('0x69'))[_0x613f('0x6c')](_0x2b66fb['CmListId'][_0x613f('0x6e')](),'ListId')[_0x613f('0x6c')](_0x380e1a[_0x613f('0x42')]['id']['toString'](),'CampaignId')[_0x613f('0x6c')]('\x27'+_0x5e5997+'\x27','createdAt')['field']('\x27'+_0x5e5997+'\x27',_0x613f('0x4f'))[_0x613f('0x6f')]('cm_contacts')[_0x613f('0x39')]('deletedAt\x20IS\x20NULL')[_0x613f('0x39')]('ListId\x20=\x20?',_0x2b66fb[_0x613f('0x70')][_0x613f('0x6e')]())[_0x613f('0x39')](_0x613f('0x71'))['where'](_0x613f('0x72'),squel[_0x613f('0x6b')]()[_0x613f('0x6c')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x613f('0x39')]('CampaignId\x20=\x20?',_0x380e1a[_0x613f('0x42')]['id']['toString']()))[_0x613f('0x39')](_0x613f('0x72'),squel[_0x613f('0x6b')]()[_0x613f('0x6c')](_0x613f('0x73'))[_0x613f('0x6f')]('cm_hopper')[_0x613f('0x39')](_0x613f('0x74'),_0x380e1a[_0x613f('0x42')]['id']['toString']())))[_0x613f('0x6e')]();break;case'onlyIfOpen':_0x4d35e5=squel[_0x613f('0x63')]()[_0x613f('0x64')](_0x613f('0x65'))['fromQuery']([_0x613f('0x67'),'scheduledAt',_0x613f('0x69'),'ListId',_0x613f('0x58'),_0x613f('0x4e'),_0x613f('0x4f')],squel[_0x613f('0x6b')]()['field'](_0x613f('0x67'),'phone')[_0x613f('0x6c')](_0x613f('0x6d'),_0x613f('0x68'))['field']('id',_0x613f('0x69'))[_0x613f('0x6c')](_0x2b66fb[_0x613f('0x70')][_0x613f('0x6e')](),_0x613f('0x6a'))[_0x613f('0x6c')](_0x380e1a[_0x613f('0x42')]['id'][_0x613f('0x6e')](),_0x613f('0x58'))[_0x613f('0x6c')]('\x27'+_0x5e5997+'\x27','createdAt')['field']('\x27'+_0x5e5997+'\x27',_0x613f('0x4f'))[_0x613f('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x613f('0x39')]('ListId\x20=\x20?',_0x2b66fb['CmListId'][_0x613f('0x6e')]())[_0x613f('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x613f('0x39')](_0x613f('0x72'),squel[_0x613f('0x6b')]()['field'](_0x613f('0x73'))[_0x613f('0x6f')](_0x613f('0x65'))['where']('CampaignId\x20=\x20?',_0x380e1a[_0x613f('0x42')]['id'][_0x613f('0x6e')]())))[_0x613f('0x6e')]();break;default:_0x4d35e5=squel[_0x613f('0x63')]()[_0x613f('0x64')]('cm_hopper')[_0x613f('0x66')]([_0x613f('0x67'),_0x613f('0x68'),_0x613f('0x69'),_0x613f('0x6a'),_0x613f('0x58'),_0x613f('0x4e'),_0x613f('0x4f')],squel[_0x613f('0x6b')]()[_0x613f('0x6c')](_0x613f('0x67'),_0x613f('0x67'))[_0x613f('0x6c')](_0x613f('0x6d'),'scheduledAt')['field']('id',_0x613f('0x69'))[_0x613f('0x6c')](_0x2b66fb[_0x613f('0x70')][_0x613f('0x6e')](),_0x613f('0x6a'))['field'](_0x380e1a['params']['id'][_0x613f('0x6e')](),_0x613f('0x58'))[_0x613f('0x6c')]('\x27'+_0x5e5997+'\x27',_0x613f('0x4e'))['field']('\x27'+_0x5e5997+'\x27',_0x613f('0x4f'))[_0x613f('0x6f')](_0x613f('0x75'))['where'](_0x613f('0x76'))[_0x613f('0x39')](_0x613f('0x77'),_0x2b66fb['CmListId'][_0x613f('0x6e')]())[_0x613f('0x39')](_0x613f('0x71')))[_0x613f('0x6e')]();}_0x4b8e0b=squel['insert']()[_0x613f('0x64')](_0x613f('0x78'))[_0x613f('0x66')](['cmHopperId',_0x613f('0x68'),_0x613f('0x67'),'OrderBy',_0x613f('0x4e'),_0x613f('0x4f')],squel[_0x613f('0x6b')]()['field'](_0x613f('0x79'),'id')['field'](_0x613f('0x6d'),_0x613f('0x68'))['field'](_0x613f('0x7a'),_0x613f('0x67'))[_0x613f('0x6c')]('ci.OrderBY',_0x613f('0x7b'))[_0x613f('0x6c')]('\x27'+_0x5e5997+'\x27','createdAt')[_0x613f('0x6c')]('\x27'+_0x5e5997+'\x27',_0x613f('0x4f'))[_0x613f('0x6f')](_0x613f('0x7c'),'ci')['join']('cm_hopper','h',_0x613f('0x7d'))[_0x613f('0x39')](_0x613f('0x7e'),_0x2b66fb['CmListId'][_0x613f('0x6e')]())['where']('h.CampaignId=?',_0x380e1a['params']['id']['toString']())[_0x613f('0x39')](_0x613f('0x7f'),_0x5e5997))[_0x613f('0x6e')]();_0x39e193[_0x613f('0x80')](db[_0x613f('0x81')][_0x613f('0x33')](_0x4d35e5));_0x3b5efa[_0x613f('0x80')](db['sequelize']['query'](_0x4b8e0b));}return BPromise['all'](_0x39e193);}})['then'](function(){return BPromise[_0x613f('0x82')](_0x3b5efa);})['then'](function(){return _0x1021f0;})[_0x613f('0x23')](respondWithResult(_0xcc214f,null))[_0x613f('0x40')](handleError(_0xcc214f,null));};exports[_0x613f('0x83')]=function(_0x189a4a,_0x86a29,_0x520640){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x189a4a[_0x613f('0x42')]['id']}})['then'](handleEntityNotFound(_0x86a29,null))[_0x613f('0x23')](function(_0x1be64a){if(_0x1be64a){return _0x1be64a[_0x613f('0x83')](_0x189a4a[_0x613f('0x33')][_0x613f('0x60')]);}})[_0x613f('0x23')](function(_0x276db6){if(_0x276db6){return db[_0x613f('0x54')][_0x613f('0x24')]({'where':{'ListId':_0x189a4a['query']['ids'],'CampaignId':_0x189a4a[_0x613f('0x42')]['id']}})[_0x613f('0x23')](function(){return _0x276db6;});}})[_0x613f('0x23')](respondWithStatusCode(_0x86a29,null))[_0x613f('0x40')](handleError(_0x86a29,null));};exports['getBlackLists']=function(_0x85548f,_0x19fcc8,_0x234a6f){var _0x5b0b54={};var _0x38ebf5={};var _0x70f2a8;var _0x53e764;return db[_0x613f('0x2a')][_0x613f('0x53')]({'where':{'id':_0x85548f[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x19fcc8,null))[_0x613f('0x23')](function(_0x5e1d67){if(_0x5e1d67){_0x70f2a8=_0x5e1d67;_0x38ebf5['model']=_['keys'](db['CmList'][_0x613f('0x2b')]);_0x38ebf5[_0x613f('0x33')]=_[_0x613f('0x30')](_0x85548f[_0x613f('0x33')]);_0x38ebf5[_0x613f('0x31')]=_[_0x613f('0x32')](_0x38ebf5[_0x613f('0x2e')],_0x38ebf5[_0x613f('0x33')]);_0x5b0b54[_0x613f('0x34')]=_['intersection'](_0x38ebf5[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x85548f[_0x613f('0x33')][_0x613f('0x35')]));_0x5b0b54[_0x613f('0x34')]=_0x5b0b54[_0x613f('0x34')]['length']?_0x5b0b54[_0x613f('0x34')]:_0x38ebf5['model'];_0x5b0b54[_0x613f('0x55')]=qs['sort'](_0x85548f[_0x613f('0x33')][_0x613f('0x38')]);_0x5b0b54[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x56')](_0x85548f[_0x613f('0x33')],_0x38ebf5['filters']));if(_0x85548f['query'][_0x613f('0x3a')]){_0x5b0b54[_0x613f('0x39')]=_['merge'](_0x5b0b54[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x5b0b54[_0x613f('0x34')],function(_0x5672e2){var _0x35c71e={};_0x35c71e[_0x5672e2]={'$like':'%'+_0x85548f['query'][_0x613f('0x3a')]+'%'};return _0x35c71e;})});}_0x5b0b54=_[_0x613f('0x3b')]({},_0x5b0b54,_0x85548f[_0x613f('0x3c')]);return _0x70f2a8[_0x613f('0x84')](_0x5b0b54);}})['then'](function(_0x91e255){if(_0x91e255){_0x53e764=_0x91e255[_0x613f('0x43')];if(!_0x85548f[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x5b0b54[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x85548f[_0x613f('0x33')][_0x613f('0x1a')]);_0x5b0b54['offset']=qs[_0x613f('0x1d')](_0x85548f[_0x613f('0x33')]['offset']);}return _0x70f2a8[_0x613f('0x84')](_0x5b0b54);}})[_0x613f('0x23')](function(_0x1c3e22){if(_0x1c3e22){return _0x1c3e22?{'count':_0x53e764,'rows':_0x1c3e22}:null;}})[_0x613f('0x23')](respondWithResult(_0x19fcc8,null))[_0x613f('0x40')](handleError(_0x19fcc8,null));};exports[_0x613f('0x85')]=function(_0x265c10,_0x4fb9ae,_0x4db928){var _0x133533,_0x4acd62;var _0x323fb1=[];var _0x2f18e7=moment()[_0x613f('0x5f')](_0x613f('0x86'));return db['Campaign'][_0x613f('0x45')]({'where':{'id':_0x265c10[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x4fb9ae,null))[_0x613f('0x23')](function(_0x1fac19){if(_0x1fac19){_0x4acd62=_0x1fac19;return _0x1fac19[_0x613f('0x85')](_0x265c10[_0x613f('0x47')][_0x613f('0x60')],_[_0x613f('0x4d')](_0x265c10[_0x613f('0x47')],[_0x613f('0x60'),'id'])||{});}return null;})[_0x613f('0x61')](function(_0x8ec949){var _0x4269de;var _0x4835f3;_0x133533=_0x8ec949||[];var _0x22fed1=[];if(_0x8ec949){for(var _0x19ec12=0x0;_0x19ec12<_0x8ec949['length'];_0x19ec12+=0x1){var _0x583652=_0x8ec949[_0x19ec12]['get']({'plain':!![]});_0x4269de=squel[_0x613f('0x63')]()[_0x613f('0x64')](_0x613f('0x87'))[_0x613f('0x66')]([_0x613f('0x67'),_0x613f('0x69'),_0x613f('0x6a'),_0x613f('0x58'),'createdAt',_0x613f('0x4f')],squel['select']()[_0x613f('0x6c')]('phone',_0x613f('0x67'))['field']('id',_0x613f('0x69'))['field'](_0x583652['CmListId'][_0x613f('0x6e')](),'ListId')['field'](_0x265c10[_0x613f('0x42')]['id'][_0x613f('0x6e')](),_0x613f('0x58'))[_0x613f('0x6c')](_0x613f('0x6d'),_0x613f('0x4e'))[_0x613f('0x6c')](_0x613f('0x6d'),'updatedAt')[_0x613f('0x6f')](_0x613f('0x75'))[_0x613f('0x39')](_0x613f('0x76'))[_0x613f('0x39')](_0x613f('0x77'),_0x583652[_0x613f('0x70')][_0x613f('0x6e')]())[_0x613f('0x39')](_0x613f('0x71')))[_0x613f('0x6e')]();_0x22fed1[_0x613f('0x80')](db[_0x613f('0x81')]['query'](_0x4269de));}return BPromise[_0x613f('0x82')](_0x22fed1);}})[_0x613f('0x23')](function(){return _0x133533;})[_0x613f('0x23')](respondWithResult(_0x4fb9ae,null))[_0x613f('0x40')](handleError(_0x4fb9ae,null));};exports[_0x613f('0x88')]=function(_0xcbf137,_0x10db85,_0x57781c){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0xcbf137[_0x613f('0x42')]['id']}})['then'](handleEntityNotFound(_0x10db85,null))[_0x613f('0x23')](function(_0x10066e){if(_0x10066e){return _0x10066e['removeBlackLists'](_0xcbf137[_0x613f('0x33')]['ids']);}})[_0x613f('0x23')](function(_0x30f3a3){if(_0x30f3a3){return db['CmHopperBlack'][_0x613f('0x24')]({'where':{'ListId':_0xcbf137[_0x613f('0x33')][_0x613f('0x60')],'CampaignId':_0xcbf137['params']['id']}})[_0x613f('0x23')](function(){return _0x30f3a3;});}})[_0x613f('0x23')](respondWithStatusCode(_0x10db85,null))[_0x613f('0x40')](handleError(_0x10db85,null));}; \ No newline at end of file +var _0x1ebd=['type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','CampaignId','rows','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','cm_hopper','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','from','CampaignId\x20=\x20?','onlyIfOpen','into','fromQuery','cm_hopper_additional_phones','OrderBy','h.id','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','IvrCampaigns','destroy','error','stack','name','index','map','Campaign','fieldName'];(function(_0x1dd4ff,_0x2a5d93){var _0x2cc8bc=function(_0x16bc43){while(--_0x16bc43){_0x1dd4ff['push'](_0x1dd4ff['shift']());}};_0x2cc8bc(++_0x2a5d93);}(_0x1ebd,0x64));var _0xd1eb=function(_0x2e49dc,_0x209c82){_0x2e49dc=_0x2e49dc-0x0;var _0x4cdb8d=_0x1ebd[_0x2e49dc];return _0x4cdb8d;};'use strict';var emlformat=require(_0xd1eb('0x0'));var rimraf=require(_0xd1eb('0x1'));var zipdir=require(_0xd1eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1eb('0x3'));var moment=require(_0xd1eb('0x4'));var BPromise=require(_0xd1eb('0x5'));var Mustache=require(_0xd1eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd1eb('0x7'));var csv=require(_0xd1eb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1eb('0x9'));var _=require(_0xd1eb('0xa'));var squel=require(_0xd1eb('0xb'));var crypto=require('crypto');var jsforce=require(_0xd1eb('0xc'));var deskjs=require(_0xd1eb('0xd'));var toCsv=require(_0xd1eb('0x8'));var querystring=require(_0xd1eb('0xe'));var Papa=require(_0xd1eb('0xf'));var Redis=require(_0xd1eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd1eb('0x11'));var as=require(_0xd1eb('0x12'));var hardwareService=require(_0xd1eb('0x13'));var logger=require('../../config/logger')(_0xd1eb('0x14'));var utils=require('../../config/utils');var config=require(_0xd1eb('0x15'));var licenseUtil=require(_0xd1eb('0x16'));var db=require(_0xd1eb('0x17'))['db'];function respondWithStatusCode(_0x405d1c,_0x32f0e1){_0x32f0e1=_0x32f0e1||0xcc;return function(_0x4d49fd){if(_0x4d49fd){return _0x405d1c[_0xd1eb('0x18')](_0x32f0e1);}return _0x405d1c[_0xd1eb('0x19')](_0x32f0e1)[_0xd1eb('0x1a')]();};}function respondWithResult(_0x120cdc,_0x1ac31b){_0x1ac31b=_0x1ac31b||0xc8;return function(_0x191a43){if(_0x191a43){return _0x120cdc[_0xd1eb('0x19')](_0x1ac31b)[_0xd1eb('0x1b')](_0x191a43);}};}function respondWithFilteredResult(_0x5be2ee,_0x329e6e){return function(_0x25efd4){if(_0x25efd4){var _0x32d13d=typeof _0x329e6e[_0xd1eb('0x1c')]===_0xd1eb('0x1d')&&typeof _0x329e6e[_0xd1eb('0x1e')]===_0xd1eb('0x1d');var _0x1807c5=_0x25efd4[_0xd1eb('0x1f')];var _0x1e8ad3=_0x32d13d?0x0:_0x329e6e[_0xd1eb('0x1c')];var _0x1db7e9=_0x32d13d?_0x25efd4[_0xd1eb('0x1f')]:_0x329e6e[_0xd1eb('0x1c')]+_0x329e6e[_0xd1eb('0x1e')];var _0x617a21;if(_0x1db7e9>=_0x1807c5){_0x1db7e9=_0x1807c5;_0x617a21=0xc8;}else{_0x617a21=0xce;}_0x5be2ee[_0xd1eb('0x19')](_0x617a21);return _0x5be2ee[_0xd1eb('0x20')](_0xd1eb('0x21'),_0x1e8ad3+'-'+_0x1db7e9+'/'+_0x1807c5)[_0xd1eb('0x1b')](_0x25efd4);}return null;};}function patchUpdates(_0xb3aee){return function(_0x5c5696){try{jsonpatch[_0xd1eb('0x22')](_0x5c5696,_0xb3aee,!![]);}catch(_0x3a2dfc){return BPromise['reject'](_0x3a2dfc);}return _0x5c5696[_0xd1eb('0x23')]();};}function saveUpdates(_0x6ed428,_0x788d90){return function(_0x5d0ac0){if(_0x5d0ac0){return _0x5d0ac0[_0xd1eb('0x24')](_0x6ed428)[_0xd1eb('0x25')](function(_0x39663c){return _0x39663c;});}return null;};}function removeEntity(_0xb3b675,_0x815a30){return function(_0x2916f4){if(_0x2916f4){return _0x2916f4['destroy']()[_0xd1eb('0x25')](function(){var _0x181cf9=_0x2916f4[_0xd1eb('0x26')]({'plain':!![]});var _0x2977a7=_0xd1eb('0x27');return db['UserProfileResource'][_0xd1eb('0x28')]({'where':{'type':_0x2977a7,'resourceId':_0x181cf9['id']}})[_0xd1eb('0x25')](function(){return _0x2916f4;});})[_0xd1eb('0x25')](function(){_0xb3b675[_0xd1eb('0x19')](0xcc)[_0xd1eb('0x1a')]();});}};}function handleEntityNotFound(_0x3a5155,_0x22df13){return function(_0x17dd4d){if(!_0x17dd4d){_0x3a5155[_0xd1eb('0x18')](0x194);}return _0x17dd4d;};}function handleError(_0x18d5c5,_0x522ca3){_0x522ca3=_0x522ca3||0x1f4;return function(_0x58f146){logger[_0xd1eb('0x29')](_0x58f146[_0xd1eb('0x2a')]);if(_0x58f146[_0xd1eb('0x2b')]){delete _0x58f146[_0xd1eb('0x2b')];}_0x18d5c5['status'](_0x522ca3)['send'](_0x58f146);};}exports[_0xd1eb('0x2c')]=function(_0x230c33,_0x529e23){var _0x2dd6b1={},_0x21b216={},_0x35129d={'count':0x0,'rows':[]};var _0x26c277=_[_0xd1eb('0x2d')](db[_0xd1eb('0x2e')]['rawAttributes'],function(_0x11e2cb){return{'name':_0x11e2cb[_0xd1eb('0x2f')],'type':_0x11e2cb[_0xd1eb('0x30')][_0xd1eb('0x31')]};});_0x21b216['model']=_[_0xd1eb('0x2d')](_0x26c277,_0xd1eb('0x2b'));_0x21b216['query']=_['keys'](_0x230c33[_0xd1eb('0x32')]);_0x21b216['filters']=_[_0xd1eb('0x33')](_0x21b216[_0xd1eb('0x34')],_0x21b216[_0xd1eb('0x32')]);_0x2dd6b1[_0xd1eb('0x35')]=_[_0xd1eb('0x33')](_0x21b216[_0xd1eb('0x34')],qs[_0xd1eb('0x36')](_0x230c33['query'][_0xd1eb('0x36')]));_0x2dd6b1['attributes']=_0x2dd6b1[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x2dd6b1[_0xd1eb('0x35')]:_0x21b216[_0xd1eb('0x34')];if(!_0x230c33['query'][_0xd1eb('0x38')](_0xd1eb('0x39'))){_0x2dd6b1[_0xd1eb('0x1e')]=qs[_0xd1eb('0x1e')](_0x230c33[_0xd1eb('0x32')][_0xd1eb('0x1e')]);_0x2dd6b1[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x230c33['query'][_0xd1eb('0x1c')]);}_0x2dd6b1[_0xd1eb('0x3a')]=qs[_0xd1eb('0x3b')](_0x230c33[_0xd1eb('0x32')][_0xd1eb('0x3b')]);_0x2dd6b1[_0xd1eb('0x3c')]=qs[_0xd1eb('0x3d')](_['pick'](_0x230c33[_0xd1eb('0x32')],_0x21b216[_0xd1eb('0x3d')]),_0x26c277);if(_0x230c33[_0xd1eb('0x32')][_0xd1eb('0x3e')]){_0x2dd6b1['where']=_[_0xd1eb('0x3f')](_0x2dd6b1[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x26c277,function(_0x113be9){if(_0x113be9[_0xd1eb('0x30')]!==_0xd1eb('0x40')){var _0x3b4b15={};_0x3b4b15[_0x113be9[_0xd1eb('0x2b')]]={'$like':'%'+_0x230c33[_0xd1eb('0x32')][_0xd1eb('0x3e')]+'%'};return _0x3b4b15;}})});}_0x2dd6b1=_[_0xd1eb('0x3f')]({},_0x2dd6b1,_0x230c33[_0xd1eb('0x41')]);var _0x21b177={'where':_0x2dd6b1[_0xd1eb('0x3c')]};return db['Campaign'][_0xd1eb('0x1f')](_0x21b177)['then'](function(_0x223c71){_0x35129d[_0xd1eb('0x1f')]=_0x223c71;if(_0x230c33[_0xd1eb('0x32')][_0xd1eb('0x42')]){_0x2dd6b1[_0xd1eb('0x43')]=[{'all':!![]}];}return db['Campaign'][_0xd1eb('0x44')](_0x2dd6b1);})[_0xd1eb('0x25')](function(_0x56e406){_0x35129d['rows']=_0x56e406;return _0x35129d;})[_0xd1eb('0x25')](respondWithFilteredResult(_0x529e23,_0x2dd6b1))[_0xd1eb('0x45')](handleError(_0x529e23,null));};exports[_0xd1eb('0x46')]=function(_0x8a1a72,_0x380cc5){var _0x5f58a9={'raw':![],'where':{'id':_0x8a1a72[_0xd1eb('0x47')]['id']}},_0x366a3d={};_0x366a3d[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db['Campaign'][_0xd1eb('0x49')]);_0x366a3d[_0xd1eb('0x32')]=_['keys'](_0x8a1a72['query']);_0x366a3d[_0xd1eb('0x3d')]=_[_0xd1eb('0x33')](_0x366a3d['model'],_0x366a3d[_0xd1eb('0x32')]);_0x5f58a9[_0xd1eb('0x35')]=_[_0xd1eb('0x33')](_0x366a3d[_0xd1eb('0x34')],qs[_0xd1eb('0x36')](_0x8a1a72[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x5f58a9[_0xd1eb('0x35')]=_0x5f58a9[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x5f58a9[_0xd1eb('0x35')]:_0x366a3d[_0xd1eb('0x34')];if(_0x8a1a72[_0xd1eb('0x32')]['includeAll']){_0x5f58a9[_0xd1eb('0x43')]=[{'all':!![]}];}_0x5f58a9=_['merge']({},_0x5f58a9,_0x8a1a72[_0xd1eb('0x41')]);return db[_0xd1eb('0x2e')][_0xd1eb('0x4a')](_0x5f58a9)[_0xd1eb('0x25')](handleEntityNotFound(_0x380cc5,null))[_0xd1eb('0x25')](respondWithResult(_0x380cc5,null))[_0xd1eb('0x45')](handleError(_0x380cc5,null));};exports[_0xd1eb('0x4b')]=function(_0x507c6f,_0x1de36f){return db[_0xd1eb('0x2e')][_0xd1eb('0x4b')](_0x507c6f[_0xd1eb('0x4c')],{})[_0xd1eb('0x25')](function(_0x438422){var _0x2142a7=_0x507c6f[_0xd1eb('0x4d')][_0xd1eb('0x26')]({'plain':!![]});if(!_0x2142a7)throw new Error(_0xd1eb('0x4e'));if(_0x2142a7[_0xd1eb('0x4f')]==='user'){var _0x1b2c43=_0x438422[_0xd1eb('0x26')]({'plain':!![]});var _0x46c603=_0xd1eb('0x27');return db[_0xd1eb('0x50')][_0xd1eb('0x4a')]({'where':{'name':_0x46c603,'userProfileId':_0x2142a7[_0xd1eb('0x51')]},'raw':!![]})[_0xd1eb('0x25')](function(_0x34e38b){if(_0x34e38b&&_0x34e38b[_0xd1eb('0x52')]===0x0){return db['UserProfileResource'][_0xd1eb('0x4b')]({'name':_0x1b2c43[_0xd1eb('0x2b')],'resourceId':_0x1b2c43['id'],'type':_0x34e38b[_0xd1eb('0x2b')],'sectionId':_0x34e38b['id']},{})[_0xd1eb('0x25')](function(){return _0x438422;});}else{return _0x438422;}})[_0xd1eb('0x45')](function(_0x10be51){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10be51);throw _0x10be51;});}return _0x438422;})[_0xd1eb('0x25')](respondWithResult(_0x1de36f,0xc9))['catch'](handleError(_0x1de36f,null));};exports[_0xd1eb('0x53')]=function(_0x49ba7b,_0x2396c4){var _0x1501c8={'where':{'id':_0x49ba7b[_0xd1eb('0x47')]['id']}},_0x234bf6={};_0x234bf6[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db[_0xd1eb('0x2e')]['rawAttributes']);_0x1501c8[_0xd1eb('0x35')]=_[_0xd1eb('0x33')](_0x234bf6['model'],qs[_0xd1eb('0x36')](_0x49ba7b[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x1501c8['attributes']=_0x1501c8[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x1501c8[_0xd1eb('0x35')]:_0x234bf6[_0xd1eb('0x34')];if(_0x49ba7b[_0xd1eb('0x32')][_0xd1eb('0x42')]){_0x1501c8[_0xd1eb('0x43')]=[{'all':!![]}];}_0x1501c8=_['merge']({},_0x1501c8,_0x49ba7b[_0xd1eb('0x41')]);return db[_0xd1eb('0x2e')]['find'](_0x1501c8)[_0xd1eb('0x25')](handleEntityNotFound(_0x2396c4,null))[_0xd1eb('0x25')](function(_0x377d70){if(_0x377d70){var _0x561712=_0x377d70[_0xd1eb('0x26')]({'plain':!![]});_0x561712=qs[_0xd1eb('0x54')](_0x561712,['id','createdAt',_0xd1eb('0x55')]);_0x49ba7b['body']=_[_0xd1eb('0x54')](_0x49ba7b['body'],['id',_0xd1eb('0x56'),_0xd1eb('0x55')]);return db[_0xd1eb('0x2e')][_0xd1eb('0x4b')](_[_0xd1eb('0x3f')](_0x561712,_0x49ba7b[_0xd1eb('0x4c')]),{'include':_0x49ba7b['query'][_0xd1eb('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x9f04c7){var _0x4bacf7=_0x49ba7b[_0xd1eb('0x4d')][_0xd1eb('0x26')]({'plain':!![]});if(!_0x4bacf7)throw new Error(_0xd1eb('0x4e'));if(_0x4bacf7[_0xd1eb('0x4f')]===_0xd1eb('0x4d')){var _0xb63b59=_0x9f04c7[_0xd1eb('0x26')]({'plain':!![]});var _0x3f5e68=_0xd1eb('0x27');return db[_0xd1eb('0x50')]['find']({'where':{'name':_0x3f5e68,'userProfileId':_0x4bacf7[_0xd1eb('0x51')]},'raw':!![]})['then'](function(_0x587769){if(_0x587769&&_0x587769[_0xd1eb('0x52')]===0x0){return db['UserProfileResource'][_0xd1eb('0x4b')]({'name':_0xb63b59[_0xd1eb('0x2b')],'resourceId':_0xb63b59['id'],'type':_0x587769[_0xd1eb('0x2b')],'sectionId':_0x587769['id']},{})[_0xd1eb('0x25')](function(){return _0x9f04c7;});}else{return _0x9f04c7;}})[_0xd1eb('0x45')](function(_0x19a562){logger['error'](_0xd1eb('0x57'),_0x19a562);throw _0x19a562;});}return _0x9f04c7;});}})[_0xd1eb('0x25')](respondWithResult(_0x2396c4,0xc9))[_0xd1eb('0x45')](handleError(_0x2396c4,null));};exports[_0xd1eb('0x24')]=function(_0x594e41,_0x2cd2bc){if(_0x594e41[_0xd1eb('0x4c')]['id']){delete _0x594e41['body']['id'];}return db[_0xd1eb('0x2e')]['find']({'where':{'id':_0x594e41[_0xd1eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cd2bc,null))[_0xd1eb('0x25')](saveUpdates(_0x594e41[_0xd1eb('0x4c')],null))['then'](respondWithResult(_0x2cd2bc,null))[_0xd1eb('0x45')](handleError(_0x2cd2bc,null));};exports[_0xd1eb('0x28')]=function(_0xa40a12,_0x22152c){return db[_0xd1eb('0x2e')][_0xd1eb('0x4a')]({'where':{'id':_0xa40a12['params']['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x22152c,null))['then'](removeEntity(_0x22152c,null))[_0xd1eb('0x45')](handleError(_0x22152c,null));};exports[_0xd1eb('0x58')]=function(_0x4472fb,_0xbfc142,_0x279cb7){var _0x198a1f={'raw':!![],'where':{}};var _0x8ecdcc={};var _0x55d53f={'count':0x0,'rows':[]};return db[_0xd1eb('0x2e')][_0xd1eb('0x59')]({'where':{'id':_0x4472fb['params']['id']}})['then'](handleEntityNotFound(_0xbfc142,null))['then'](function(_0xab003a){if(_0xab003a){_0x8ecdcc[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db[_0xd1eb('0x5a')]['rawAttributes']);_0x8ecdcc[_0xd1eb('0x32')]=_[_0xd1eb('0x48')](_0x4472fb['query']);_0x8ecdcc['filters']=_[_0xd1eb('0x33')](_0x8ecdcc['model'],_0x8ecdcc['query']);_0x198a1f['attributes']=_[_0xd1eb('0x33')](_0x8ecdcc[_0xd1eb('0x34')],qs['fields'](_0x4472fb[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x198a1f[_0xd1eb('0x35')]=_0x198a1f['attributes']['length']?_0x198a1f[_0xd1eb('0x35')]:_0x8ecdcc['model'];if(!_0x4472fb['query']['hasOwnProperty']('nolimit')){_0x198a1f[_0xd1eb('0x1e')]=qs['limit'](_0x4472fb[_0xd1eb('0x32')]['limit']);_0x198a1f[_0xd1eb('0x1c')]=qs['offset'](_0x4472fb[_0xd1eb('0x32')][_0xd1eb('0x1c')]);}_0x198a1f[_0xd1eb('0x3a')]=qs['sort'](_0x4472fb[_0xd1eb('0x32')]['sort']);_0x198a1f[_0xd1eb('0x3c')]=qs[_0xd1eb('0x3d')](_['pick'](_0x4472fb['query'],_0x8ecdcc[_0xd1eb('0x3d')]));_0x198a1f[_0xd1eb('0x3c')][_0xd1eb('0x5b')]=_0xab003a['id'];if(_0x4472fb[_0xd1eb('0x32')][_0xd1eb('0x3e')]){_0x198a1f['where']=_[_0xd1eb('0x3f')](_0x198a1f[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x198a1f[_0xd1eb('0x35')],function(_0x4ac17c){var _0x385a75={};_0x385a75[_0x4ac17c]={'$like':'%'+_0x4472fb[_0xd1eb('0x32')][_0xd1eb('0x3e')]+'%'};return _0x385a75;})});}_0x198a1f=_['merge']({},_0x198a1f,_0x4472fb[_0xd1eb('0x41')]);return db[_0xd1eb('0x5a')][_0xd1eb('0x1f')]({'where':_0x198a1f[_0xd1eb('0x3c')]})['then'](function(_0x3b0fbb){_0x55d53f[_0xd1eb('0x1f')]=_0x3b0fbb;if(_0x4472fb['query'][_0xd1eb('0x42')]){_0x198a1f[_0xd1eb('0x43')]=[{'all':!![]}];}return db[_0xd1eb('0x5a')][_0xd1eb('0x44')](_0x198a1f);})[_0xd1eb('0x25')](function(_0x1c8c2b){_0x55d53f[_0xd1eb('0x5c')]=_0x1c8c2b;return _0x55d53f;});}})[_0xd1eb('0x25')](respondWithFilteredResult(_0xbfc142,_0x198a1f))[_0xd1eb('0x45')](handleError(_0xbfc142,null));};exports[_0xd1eb('0x5d')]=function(_0x33f7a4,_0x341389,_0x284ef3){var _0x3546b4={'raw':!![],'where':{}};var _0x506991={};var _0x40e43a={'count':0x0,'rows':[]};return db[_0xd1eb('0x2e')][_0xd1eb('0x59')]({'where':{'id':_0x33f7a4[_0xd1eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x341389,null))[_0xd1eb('0x25')](function(_0x1e8ed4){if(_0x1e8ed4){_0x506991[_0xd1eb('0x34')]=_['keys'](db[_0xd1eb('0x5e')][_0xd1eb('0x49')]);_0x506991[_0xd1eb('0x32')]=_[_0xd1eb('0x48')](_0x33f7a4['query']);_0x506991[_0xd1eb('0x3d')]=_[_0xd1eb('0x33')](_0x506991[_0xd1eb('0x34')],_0x506991[_0xd1eb('0x32')]);_0x3546b4[_0xd1eb('0x35')]=_[_0xd1eb('0x33')](_0x506991['model'],qs[_0xd1eb('0x36')](_0x33f7a4[_0xd1eb('0x32')]['fields']));_0x3546b4[_0xd1eb('0x35')]=_0x3546b4[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x3546b4[_0xd1eb('0x35')]:_0x506991['model'];if(!_0x33f7a4[_0xd1eb('0x32')][_0xd1eb('0x38')](_0xd1eb('0x39'))){_0x3546b4[_0xd1eb('0x1e')]=qs[_0xd1eb('0x1e')](_0x33f7a4['query']['limit']);_0x3546b4[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x33f7a4['query']['offset']);}_0x3546b4[_0xd1eb('0x3a')]=qs['sort'](_0x33f7a4[_0xd1eb('0x32')][_0xd1eb('0x3b')]);_0x3546b4[_0xd1eb('0x3c')]=qs['filters'](_[_0xd1eb('0x5f')](_0x33f7a4[_0xd1eb('0x32')],_0x506991[_0xd1eb('0x3d')]));_0x3546b4[_0xd1eb('0x3c')][_0xd1eb('0x5b')]=_0x1e8ed4['id'];if(_0x33f7a4[_0xd1eb('0x32')][_0xd1eb('0x3e')]){_0x3546b4[_0xd1eb('0x3c')]=_[_0xd1eb('0x3f')](_0x3546b4[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x3546b4['attributes'],function(_0xe229fc){var _0x5b2859={};_0x5b2859[_0xe229fc]={'$like':'%'+_0x33f7a4[_0xd1eb('0x32')][_0xd1eb('0x3e')]+'%'};return _0x5b2859;})});}_0x3546b4=_['merge']({},_0x3546b4,_0x33f7a4['options']);return db[_0xd1eb('0x5e')][_0xd1eb('0x1f')]({'where':_0x3546b4[_0xd1eb('0x3c')]})['then'](function(_0x5e9149){_0x40e43a['count']=_0x5e9149;if(_0x33f7a4[_0xd1eb('0x32')][_0xd1eb('0x42')]){_0x3546b4[_0xd1eb('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd1eb('0x44')](_0x3546b4);})[_0xd1eb('0x25')](function(_0x41e29b){_0x40e43a[_0xd1eb('0x5c')]=_0x41e29b;return _0x40e43a;});}})['then'](respondWithFilteredResult(_0x341389,_0x3546b4))[_0xd1eb('0x45')](handleError(_0x341389,null));};exports[_0xd1eb('0x60')]=function(_0x22bca1,_0x3eec4a,_0x40db01){var _0x1dc0cf={'raw':!![],'where':{}};var _0x156b3e={};var _0x3db240={'count':0x0,'rows':[]};return db[_0xd1eb('0x2e')]['findOne']({'where':{'id':_0x22bca1[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x3eec4a,null))[_0xd1eb('0x25')](function(_0x1524d8){if(_0x1524d8){_0x156b3e[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db[_0xd1eb('0x61')]['rawAttributes']);_0x156b3e[_0xd1eb('0x32')]=_[_0xd1eb('0x48')](_0x22bca1[_0xd1eb('0x32')]);_0x156b3e['filters']=_[_0xd1eb('0x33')](_0x156b3e[_0xd1eb('0x34')],_0x156b3e[_0xd1eb('0x32')]);_0x1dc0cf[_0xd1eb('0x35')]=_['intersection'](_0x156b3e[_0xd1eb('0x34')],qs[_0xd1eb('0x36')](_0x22bca1[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x1dc0cf[_0xd1eb('0x35')]=_0x1dc0cf[_0xd1eb('0x35')]['length']?_0x1dc0cf[_0xd1eb('0x35')]:_0x156b3e['model'];if(!_0x22bca1['query'][_0xd1eb('0x38')](_0xd1eb('0x39'))){_0x1dc0cf['limit']=qs[_0xd1eb('0x1e')](_0x22bca1['query'][_0xd1eb('0x1e')]);_0x1dc0cf[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x22bca1['query'][_0xd1eb('0x1c')]);}_0x1dc0cf[_0xd1eb('0x3a')]=qs[_0xd1eb('0x3b')](_0x22bca1[_0xd1eb('0x32')][_0xd1eb('0x3b')]);_0x1dc0cf['where']=qs['filters'](_[_0xd1eb('0x5f')](_0x22bca1[_0xd1eb('0x32')],_0x156b3e[_0xd1eb('0x3d')]));_0x1dc0cf[_0xd1eb('0x3c')][_0xd1eb('0x5b')]=_0x1524d8['id'];if(_0x22bca1[_0xd1eb('0x32')][_0xd1eb('0x3e')]){_0x1dc0cf['where']=_[_0xd1eb('0x3f')](_0x1dc0cf[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x1dc0cf[_0xd1eb('0x35')],function(_0x11af28){var _0x5e4d6e={};_0x5e4d6e[_0x11af28]={'$like':'%'+_0x22bca1[_0xd1eb('0x32')][_0xd1eb('0x3e')]+'%'};return _0x5e4d6e;})});}_0x1dc0cf=_[_0xd1eb('0x3f')]({},_0x1dc0cf,_0x22bca1['options']);return db['CmHopperFinal'][_0xd1eb('0x1f')]({'where':_0x1dc0cf[_0xd1eb('0x3c')]})[_0xd1eb('0x25')](function(_0x16277f){_0x3db240[_0xd1eb('0x1f')]=_0x16277f;if(_0x22bca1[_0xd1eb('0x32')]['includeAll']){_0x1dc0cf[_0xd1eb('0x43')]=[{'all':!![]}];}return db[_0xd1eb('0x61')][_0xd1eb('0x44')](_0x1dc0cf);})['then'](function(_0x28540d){_0x3db240[_0xd1eb('0x5c')]=_0x28540d;return _0x3db240;});}})[_0xd1eb('0x25')](respondWithFilteredResult(_0x3eec4a,_0x1dc0cf))[_0xd1eb('0x45')](handleError(_0x3eec4a,null));};exports['getHopperBlacks']=function(_0x55487e,_0x12bc70,_0x33abdf){var _0x22dcaa={'raw':!![],'where':{}};var _0x1bd30e={};var _0x2b14d5={'count':0x0,'rows':[]};return db[_0xd1eb('0x2e')][_0xd1eb('0x59')]({'where':{'id':_0x55487e[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x12bc70,null))[_0xd1eb('0x25')](function(_0x1fb55b){if(_0x1fb55b){_0x1bd30e[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db[_0xd1eb('0x62')][_0xd1eb('0x49')]);_0x1bd30e['query']=_[_0xd1eb('0x48')](_0x55487e['query']);_0x1bd30e[_0xd1eb('0x3d')]=_[_0xd1eb('0x33')](_0x1bd30e[_0xd1eb('0x34')],_0x1bd30e[_0xd1eb('0x32')]);_0x22dcaa[_0xd1eb('0x35')]=_[_0xd1eb('0x33')](_0x1bd30e[_0xd1eb('0x34')],qs[_0xd1eb('0x36')](_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x22dcaa[_0xd1eb('0x35')]=_0x22dcaa[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x22dcaa[_0xd1eb('0x35')]:_0x1bd30e[_0xd1eb('0x34')];if(!_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x38')](_0xd1eb('0x39'))){_0x22dcaa[_0xd1eb('0x1e')]=qs[_0xd1eb('0x1e')](_0x55487e['query'][_0xd1eb('0x1e')]);_0x22dcaa[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x1c')]);}_0x22dcaa[_0xd1eb('0x3a')]=qs[_0xd1eb('0x3b')](_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x3b')]);_0x22dcaa[_0xd1eb('0x3c')]=qs[_0xd1eb('0x3d')](_['pick'](_0x55487e[_0xd1eb('0x32')],_0x1bd30e[_0xd1eb('0x3d')]));_0x22dcaa[_0xd1eb('0x3c')][_0xd1eb('0x5b')]=_0x1fb55b['id'];if(_0x55487e['query'][_0xd1eb('0x3e')]){_0x22dcaa[_0xd1eb('0x3c')]=_['merge'](_0x22dcaa[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x22dcaa[_0xd1eb('0x35')],function(_0x44d4a4){var _0x13f8bd={};_0x13f8bd[_0x44d4a4]={'$like':'%'+_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x3e')]+'%'};return _0x13f8bd;})});}_0x22dcaa=_[_0xd1eb('0x3f')]({},_0x22dcaa,_0x55487e[_0xd1eb('0x41')]);return db[_0xd1eb('0x62')]['count']({'where':_0x22dcaa['where']})[_0xd1eb('0x25')](function(_0x8c4a70){_0x2b14d5['count']=_0x8c4a70;if(_0x55487e[_0xd1eb('0x32')][_0xd1eb('0x42')]){_0x22dcaa[_0xd1eb('0x43')]=[{'all':!![]}];}return db[_0xd1eb('0x62')][_0xd1eb('0x44')](_0x22dcaa);})[_0xd1eb('0x25')](function(_0x423b19){_0x2b14d5[_0xd1eb('0x5c')]=_0x423b19;return _0x2b14d5;});}})[_0xd1eb('0x25')](respondWithFilteredResult(_0x12bc70,_0x22dcaa))[_0xd1eb('0x45')](handleError(_0x12bc70,null));};exports[_0xd1eb('0x63')]=function(_0x2bc161,_0x9620a5,_0x39c53b){var _0x323015={};var _0x149065={};var _0x5412fb;var _0x3c5c98;return db[_0xd1eb('0x2e')]['findOne']({'where':{'id':_0x2bc161[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x9620a5,null))['then'](function(_0x4e2e6f){if(_0x4e2e6f){_0x5412fb=_0x4e2e6f;_0x149065[_0xd1eb('0x34')]=_['keys'](db[_0xd1eb('0x64')][_0xd1eb('0x49')]);_0x149065[_0xd1eb('0x32')]=_[_0xd1eb('0x48')](_0x2bc161[_0xd1eb('0x32')]);_0x149065[_0xd1eb('0x3d')]=_[_0xd1eb('0x33')](_0x149065[_0xd1eb('0x34')],_0x149065[_0xd1eb('0x32')]);_0x323015['attributes']=_['intersection'](_0x149065[_0xd1eb('0x34')],qs[_0xd1eb('0x36')](_0x2bc161[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x323015[_0xd1eb('0x35')]=_0x323015[_0xd1eb('0x35')]['length']?_0x323015['attributes']:_0x149065[_0xd1eb('0x34')];_0x323015[_0xd1eb('0x3a')]=qs[_0xd1eb('0x3b')](_0x2bc161['query'][_0xd1eb('0x3b')]);_0x323015['where']=qs[_0xd1eb('0x3d')](_[_0xd1eb('0x5f')](_0x2bc161['query'],_0x149065['filters']));if(_0x2bc161[_0xd1eb('0x32')][_0xd1eb('0x3e')]){_0x323015[_0xd1eb('0x3c')]=_['merge'](_0x323015[_0xd1eb('0x3c')],{'$or':_[_0xd1eb('0x2d')](_0x323015[_0xd1eb('0x35')],function(_0x2076bd){var _0x451873={};_0x451873[_0x2076bd]={'$like':'%'+_0x2bc161['query']['filter']+'%'};return _0x451873;})});}_0x323015=_[_0xd1eb('0x3f')]({},_0x323015,_0x2bc161['options']);return _0x5412fb[_0xd1eb('0x63')](_0x323015);}})[_0xd1eb('0x25')](function(_0x7fc5){if(_0x7fc5){_0x3c5c98=_0x7fc5[_0xd1eb('0x37')];if(!_0x2bc161['query'][_0xd1eb('0x38')]('nolimit')){_0x323015['limit']=qs[_0xd1eb('0x1e')](_0x2bc161[_0xd1eb('0x32')][_0xd1eb('0x1e')]);_0x323015[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x2bc161[_0xd1eb('0x32')][_0xd1eb('0x1c')]);}return _0x5412fb[_0xd1eb('0x63')](_0x323015);}})[_0xd1eb('0x25')](function(_0x509bc2){if(_0x509bc2){return _0x509bc2?{'count':_0x3c5c98,'rows':_0x509bc2}:null;}})[_0xd1eb('0x25')](respondWithResult(_0x9620a5,null))[_0xd1eb('0x45')](handleError(_0x9620a5,null));};exports[_0xd1eb('0x65')]=function(_0x44c8da,_0x30e4d5,_0x54f53e){var _0x2c58c6,_0x1481a2;var _0xc3598d=[];var _0x30c8cb=moment()[_0xd1eb('0x66')](_0xd1eb('0x67'));return db[_0xd1eb('0x2e')][_0xd1eb('0x4a')]({'where':{'id':_0x44c8da[_0xd1eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x30e4d5,null))[_0xd1eb('0x25')](function(_0x5db098){if(_0x5db098){_0x1481a2=_0x5db098;return _0x5db098[_0xd1eb('0x65')](_0x44c8da[_0xd1eb('0x4c')][_0xd1eb('0x68')],_[_0xd1eb('0x54')](_0x44c8da['body'],[_0xd1eb('0x68'),'id'])||{});}return null;})[_0xd1eb('0x69')](function(_0x3e8a2b){var _0x413fce;var _0x426695;_0x2c58c6=_0x3e8a2b||[];var _0x2aafee=[];if(_0x3e8a2b){for(var _0x29f65b=0x0;_0x29f65b<_0x3e8a2b[_0xd1eb('0x37')];_0x29f65b+=0x1){var _0x5efbae=_0x3e8a2b[_0x29f65b][_0xd1eb('0x26')]({'plain':!![]});_0x1481a2['dialCheckDuplicateType']=_0x44c8da[_0xd1eb('0x4c')][_0xd1eb('0x6a')]?_0x44c8da[_0xd1eb('0x4c')]['dialCheckDuplicateType']:_0x1481a2['dialCheckDuplicateType'];switch(_0x1481a2[_0xd1eb('0x6a')]){case'always':_0x413fce=squel[_0xd1eb('0x6b')]()['into'](_0xd1eb('0x6c'))['fromQuery']([_0xd1eb('0x6d'),_0xd1eb('0x6e'),'ContactId',_0xd1eb('0x6f'),_0xd1eb('0x5b'),_0xd1eb('0x56'),_0xd1eb('0x55')],squel[_0xd1eb('0x70')]()[_0xd1eb('0x71')](_0xd1eb('0x6d'),_0xd1eb('0x6d'))[_0xd1eb('0x71')](_0xd1eb('0x72'),_0xd1eb('0x6e'))[_0xd1eb('0x71')]('id',_0xd1eb('0x73'))['field'](_0x5efbae[_0xd1eb('0x74')][_0xd1eb('0x75')](),_0xd1eb('0x6f'))[_0xd1eb('0x71')](_0x44c8da[_0xd1eb('0x47')]['id'][_0xd1eb('0x75')](),_0xd1eb('0x5b'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x56'))['field']('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x55'))['from'](_0xd1eb('0x76'))[_0xd1eb('0x3c')](_0xd1eb('0x77'))['where'](_0xd1eb('0x78'),_0x5efbae[_0xd1eb('0x74')]['toString']())[_0xd1eb('0x3c')](_0xd1eb('0x79'))[_0xd1eb('0x3c')](_0xd1eb('0x7a'),squel[_0xd1eb('0x70')]()[_0xd1eb('0x71')](_0xd1eb('0x7b'))['from'](_0xd1eb('0x7c'))[_0xd1eb('0x3c')]('CampaignId\x20=\x20?',_0x44c8da[_0xd1eb('0x47')]['id']['toString']()))[_0xd1eb('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd1eb('0x70')]()[_0xd1eb('0x71')](_0xd1eb('0x7d'))[_0xd1eb('0x7e')]('cm_hopper')['where'](_0xd1eb('0x7f'),_0x44c8da[_0xd1eb('0x47')]['id']['toString']())))[_0xd1eb('0x75')]();break;case _0xd1eb('0x80'):_0x413fce=squel['insert']()[_0xd1eb('0x81')](_0xd1eb('0x6c'))['fromQuery']([_0xd1eb('0x6d'),_0xd1eb('0x6e'),_0xd1eb('0x73'),'ListId',_0xd1eb('0x5b'),'createdAt','updatedAt'],squel['select']()[_0xd1eb('0x71')](_0xd1eb('0x6d'),_0xd1eb('0x6d'))[_0xd1eb('0x71')](_0xd1eb('0x72'),_0xd1eb('0x6e'))[_0xd1eb('0x71')]('id','ContactId')['field'](_0x5efbae['CmListId'][_0xd1eb('0x75')](),_0xd1eb('0x6f'))[_0xd1eb('0x71')](_0x44c8da['params']['id'][_0xd1eb('0x75')](),_0xd1eb('0x5b'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x56'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x55'))['from'](_0xd1eb('0x76'))[_0xd1eb('0x3c')](_0xd1eb('0x77'))[_0xd1eb('0x3c')]('ListId\x20=\x20?',_0x5efbae[_0xd1eb('0x74')][_0xd1eb('0x75')]())[_0xd1eb('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xd1eb('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd1eb('0x70')]()[_0xd1eb('0x71')](_0xd1eb('0x7d'))[_0xd1eb('0x7e')](_0xd1eb('0x6c'))['where'](_0xd1eb('0x7f'),_0x44c8da[_0xd1eb('0x47')]['id'][_0xd1eb('0x75')]())))[_0xd1eb('0x75')]();break;default:_0x413fce=squel[_0xd1eb('0x6b')]()[_0xd1eb('0x81')](_0xd1eb('0x6c'))[_0xd1eb('0x82')](['phone','scheduledAt',_0xd1eb('0x73'),_0xd1eb('0x6f'),_0xd1eb('0x5b'),_0xd1eb('0x56'),_0xd1eb('0x55')],squel['select']()[_0xd1eb('0x71')](_0xd1eb('0x6d'),_0xd1eb('0x6d'))[_0xd1eb('0x71')](_0xd1eb('0x72'),_0xd1eb('0x6e'))[_0xd1eb('0x71')]('id','ContactId')[_0xd1eb('0x71')](_0x5efbae[_0xd1eb('0x74')][_0xd1eb('0x75')](),_0xd1eb('0x6f'))['field'](_0x44c8da[_0xd1eb('0x47')]['id'][_0xd1eb('0x75')](),_0xd1eb('0x5b'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x56'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27','updatedAt')[_0xd1eb('0x7e')](_0xd1eb('0x76'))[_0xd1eb('0x3c')](_0xd1eb('0x77'))[_0xd1eb('0x3c')](_0xd1eb('0x78'),_0x5efbae[_0xd1eb('0x74')]['toString']())['where'](_0xd1eb('0x79')))[_0xd1eb('0x75')]();}_0x426695=squel[_0xd1eb('0x6b')]()['into'](_0xd1eb('0x83'))[_0xd1eb('0x82')](['cmHopperId','scheduledAt',_0xd1eb('0x6d'),_0xd1eb('0x84'),_0xd1eb('0x56'),_0xd1eb('0x55')],squel['select']()['field'](_0xd1eb('0x85'),'id')['field'](_0xd1eb('0x72'),_0xd1eb('0x6e'))[_0xd1eb('0x71')]('ci.item',_0xd1eb('0x6d'))[_0xd1eb('0x71')]('ci.OrderBY',_0xd1eb('0x84'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27',_0xd1eb('0x56'))[_0xd1eb('0x71')]('\x27'+_0x30c8cb+'\x27','updatedAt')[_0xd1eb('0x7e')](_0xd1eb('0x86'),'ci')[_0xd1eb('0x87')](_0xd1eb('0x6c'),'h',_0xd1eb('0x88'))[_0xd1eb('0x3c')](_0xd1eb('0x89'),_0x5efbae[_0xd1eb('0x74')][_0xd1eb('0x75')]())[_0xd1eb('0x3c')](_0xd1eb('0x8a'),_0x44c8da['params']['id'][_0xd1eb('0x75')]())[_0xd1eb('0x3c')](_0xd1eb('0x8b'),_0x30c8cb))[_0xd1eb('0x75')]();_0x2aafee[_0xd1eb('0x8c')](db[_0xd1eb('0x8d')]['query'](_0x413fce));_0xc3598d[_0xd1eb('0x8c')](db[_0xd1eb('0x8d')][_0xd1eb('0x32')](_0x426695));}return BPromise[_0xd1eb('0x8e')](_0x2aafee);}})['then'](function(){return BPromise['all'](_0xc3598d);})['then'](function(){return _0x2c58c6;})['then'](respondWithResult(_0x30e4d5,null))['catch'](handleError(_0x30e4d5,null));};exports[_0xd1eb('0x8f')]=function(_0x19c42f,_0xc49594,_0x481563){return db['Campaign'][_0xd1eb('0x4a')]({'where':{'id':_0x19c42f[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0xc49594,null))[_0xd1eb('0x25')](function(_0xada94f){if(_0xada94f){return _0xada94f[_0xd1eb('0x8f')](_0x19c42f[_0xd1eb('0x32')][_0xd1eb('0x68')]);}})['then'](function(_0x47a505){if(_0x47a505){return db[_0xd1eb('0x5a')][_0xd1eb('0x28')]({'where':{'ListId':_0x19c42f[_0xd1eb('0x32')]['ids'],'CampaignId':_0x19c42f['params']['id']}})[_0xd1eb('0x25')](function(){return _0x47a505;});}})[_0xd1eb('0x25')](respondWithStatusCode(_0xc49594,null))[_0xd1eb('0x45')](handleError(_0xc49594,null));};exports[_0xd1eb('0x90')]=function(_0x17b337,_0x15b87e,_0x209d69){var _0x6beee7={};var _0x2d0659={};var _0x19bab0;var _0x1a0bb5;return db[_0xd1eb('0x2e')][_0xd1eb('0x59')]({'where':{'id':_0x17b337[_0xd1eb('0x47')]['id']}})['then'](handleEntityNotFound(_0x15b87e,null))[_0xd1eb('0x25')](function(_0x21387f){if(_0x21387f){_0x19bab0=_0x21387f;_0x2d0659[_0xd1eb('0x34')]=_[_0xd1eb('0x48')](db[_0xd1eb('0x64')][_0xd1eb('0x49')]);_0x2d0659[_0xd1eb('0x32')]=_[_0xd1eb('0x48')](_0x17b337['query']);_0x2d0659['filters']=_[_0xd1eb('0x33')](_0x2d0659[_0xd1eb('0x34')],_0x2d0659['query']);_0x6beee7[_0xd1eb('0x35')]=_['intersection'](_0x2d0659['model'],qs[_0xd1eb('0x36')](_0x17b337[_0xd1eb('0x32')][_0xd1eb('0x36')]));_0x6beee7['attributes']=_0x6beee7[_0xd1eb('0x35')][_0xd1eb('0x37')]?_0x6beee7[_0xd1eb('0x35')]:_0x2d0659['model'];_0x6beee7[_0xd1eb('0x3a')]=qs[_0xd1eb('0x3b')](_0x17b337[_0xd1eb('0x32')][_0xd1eb('0x3b')]);_0x6beee7[_0xd1eb('0x3c')]=qs[_0xd1eb('0x3d')](_[_0xd1eb('0x5f')](_0x17b337[_0xd1eb('0x32')],_0x2d0659['filters']));if(_0x17b337[_0xd1eb('0x32')]['filter']){_0x6beee7[_0xd1eb('0x3c')]=_[_0xd1eb('0x3f')](_0x6beee7[_0xd1eb('0x3c')],{'$or':_['map'](_0x6beee7[_0xd1eb('0x35')],function(_0x1d4fce){var _0x362f5d={};_0x362f5d[_0x1d4fce]={'$like':'%'+_0x17b337[_0xd1eb('0x32')]['filter']+'%'};return _0x362f5d;})});}_0x6beee7=_[_0xd1eb('0x3f')]({},_0x6beee7,_0x17b337['options']);return _0x19bab0[_0xd1eb('0x90')](_0x6beee7);}})[_0xd1eb('0x25')](function(_0x2c00b9){if(_0x2c00b9){_0x1a0bb5=_0x2c00b9[_0xd1eb('0x37')];if(!_0x17b337[_0xd1eb('0x32')][_0xd1eb('0x38')]('nolimit')){_0x6beee7['limit']=qs[_0xd1eb('0x1e')](_0x17b337[_0xd1eb('0x32')][_0xd1eb('0x1e')]);_0x6beee7[_0xd1eb('0x1c')]=qs[_0xd1eb('0x1c')](_0x17b337[_0xd1eb('0x32')][_0xd1eb('0x1c')]);}return _0x19bab0['getBlackLists'](_0x6beee7);}})[_0xd1eb('0x25')](function(_0x1f394e){if(_0x1f394e){return _0x1f394e?{'count':_0x1a0bb5,'rows':_0x1f394e}:null;}})['then'](respondWithResult(_0x15b87e,null))[_0xd1eb('0x45')](handleError(_0x15b87e,null));};exports[_0xd1eb('0x91')]=function(_0xed45a9,_0x14d7da,_0x13cf86){var _0x51d237,_0xf69938;var _0xd2bd56=[];var _0x3281a9=moment()['format'](_0xd1eb('0x67'));return db[_0xd1eb('0x2e')][_0xd1eb('0x4a')]({'where':{'id':_0xed45a9[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x14d7da,null))['then'](function(_0x137e1a){if(_0x137e1a){_0xf69938=_0x137e1a;return _0x137e1a[_0xd1eb('0x91')](_0xed45a9[_0xd1eb('0x4c')][_0xd1eb('0x68')],_['omit'](_0xed45a9[_0xd1eb('0x4c')],[_0xd1eb('0x68'),'id'])||{});}return null;})[_0xd1eb('0x69')](function(_0x2a8033){var _0x518415;var _0x259c8e;_0x51d237=_0x2a8033||[];var _0x571582=[];if(_0x2a8033){for(var _0x46e9da=0x0;_0x46e9da<_0x2a8033[_0xd1eb('0x37')];_0x46e9da+=0x1){var _0xa79408=_0x2a8033[_0x46e9da]['get']({'plain':!![]});_0x518415=squel[_0xd1eb('0x6b')]()[_0xd1eb('0x81')](_0xd1eb('0x92'))['fromQuery']([_0xd1eb('0x6d'),_0xd1eb('0x73'),_0xd1eb('0x6f'),_0xd1eb('0x5b'),'createdAt',_0xd1eb('0x55')],squel[_0xd1eb('0x70')]()['field']('phone','phone')['field']('id',_0xd1eb('0x73'))['field'](_0xa79408[_0xd1eb('0x74')]['toString'](),_0xd1eb('0x6f'))[_0xd1eb('0x71')](_0xed45a9[_0xd1eb('0x47')]['id']['toString'](),'CampaignId')[_0xd1eb('0x71')](_0xd1eb('0x72'),_0xd1eb('0x56'))[_0xd1eb('0x71')](_0xd1eb('0x72'),_0xd1eb('0x55'))[_0xd1eb('0x7e')]('cm_contacts')[_0xd1eb('0x3c')](_0xd1eb('0x77'))['where'](_0xd1eb('0x78'),_0xa79408[_0xd1eb('0x74')][_0xd1eb('0x75')]())[_0xd1eb('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xd1eb('0x75')]();_0x571582[_0xd1eb('0x8c')](db[_0xd1eb('0x8d')][_0xd1eb('0x32')](_0x518415));}return BPromise[_0xd1eb('0x8e')](_0x571582);}})[_0xd1eb('0x25')](function(){return _0x51d237;})['then'](respondWithResult(_0x14d7da,null))[_0xd1eb('0x45')](handleError(_0x14d7da,null));};exports[_0xd1eb('0x93')]=function(_0x19df6e,_0x424f38,_0x45d720){return db[_0xd1eb('0x2e')][_0xd1eb('0x4a')]({'where':{'id':_0x19df6e[_0xd1eb('0x47')]['id']}})[_0xd1eb('0x25')](handleEntityNotFound(_0x424f38,null))[_0xd1eb('0x25')](function(_0x47dedd){if(_0x47dedd){return _0x47dedd['removeBlackLists'](_0x19df6e['query']['ids']);}})['then'](function(_0x103822){if(_0x103822){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x19df6e[_0xd1eb('0x32')][_0xd1eb('0x68')],'CampaignId':_0x19df6e['params']['id']}})['then'](function(){return _0x103822;});}})[_0xd1eb('0x25')](respondWithStatusCode(_0x424f38,null))[_0xd1eb('0x45')](handleError(_0x424f38,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 46eca9c..8a8baf3 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4b3d10,_0x3da823){var _0x3f62cc=function(_0x366e9a){while(--_0x366e9a){_0x4b3d10['push'](_0x4b3d10['shift']());}};_0x3f62cc(++_0x3da823);}(_0x7a54,0x106));var _0x47a5=function(_0x170460,_0x5dc758){_0x170460=_0x170460-0x0;var _0x967890=_0x7a54[_0x170460];return _0x967890;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5effdb4..1e0c373 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 _0x7b6b=['jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCampaign','Campaign','options','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x7b6b,0xac));var _0xb7b6=function(_0x2cb530,_0x435826){_0x2cb530=_0x2cb530-0x0;var _0x4930f1=_0x7b6b[_0x2cb530];return _0x4930f1;};'use strict';var _=require(_0xb7b6('0x0'));var util=require('util');var moment=require(_0xb7b6('0x1'));var BPromise=require(_0xb7b6('0x2'));var rs=require(_0xb7b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7b6('0x5'))(_0xb7b6('0x6'));var config=require(_0xb7b6('0x7'));var jayson=require(_0xb7b6('0x8'));var client=jayson[_0xb7b6('0x9')][_0xb7b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e81f,_0x318dfb,_0x36cd51){return new BPromise(function(_0x31809b,_0xb5b26f){return client[_0xb7b6('0xb')](_0x19e81f,_0x36cd51)[_0xb7b6('0xc')](function(_0x313aa8){logger[_0xb7b6('0xd')](_0xb7b6('0xe'),_0x318dfb,_0xb7b6('0xf'));logger[_0xb7b6('0x10')](_0xb7b6('0x11'),_0x318dfb,_0xb7b6('0xf'),JSON['stringify'](_0x313aa8));if(_0x313aa8[_0xb7b6('0x12')]){if(_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x13')]===0x1f4){logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x14')]);return _0xb5b26f(_0x313aa8[_0xb7b6('0x12')][_0xb7b6('0x14')]);}logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0x313aa8[_0xb7b6('0x12')]['message']);return _0x31809b(_0x313aa8['error'][_0xb7b6('0x14')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x318dfb,_0xb7b6('0xf'));_0x31809b(_0x313aa8['result'][_0xb7b6('0x14')]);}})[_0xb7b6('0x15')](function(_0xa99f35){logger[_0xb7b6('0x12')](_0xb7b6('0xe'),_0x318dfb,_0xa99f35);_0xb5b26f(_0xa99f35);});});}exports[_0xb7b6('0x16')]=function(_0x3dc0f8){var _0x7bb633=this;return new Promise(function(_0x5667d9,_0x314049){return db[_0xb7b6('0x17')]['findAll']({'raw':_0x3dc0f8[_0xb7b6('0x18')]?_0x3dc0f8[_0xb7b6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc0f8[_0xb7b6('0x18')]?_0x3dc0f8[_0xb7b6('0x18')]['where']||null:null,'attributes':_0x3dc0f8['options']?_0x3dc0f8[_0xb7b6('0x18')]['attributes']||null:null,'limit':_0x3dc0f8[_0xb7b6('0x18')]?_0x3dc0f8[_0xb7b6('0x18')][_0xb7b6('0x19')]||null:null,'include':_0x3dc0f8[_0xb7b6('0x18')]?_0x3dc0f8[_0xb7b6('0x18')][_0xb7b6('0x1a')]?_[_0xb7b6('0x1b')](_0x3dc0f8[_0xb7b6('0x18')][_0xb7b6('0x1a')],function(_0x2173c5){return{'model':db[_0x2173c5[_0xb7b6('0x1c')]],'as':_0x2173c5['as'],'attributes':_0x2173c5[_0xb7b6('0x1d')],'include':_0x2173c5[_0xb7b6('0x1a')]?_['map'](_0x2173c5[_0xb7b6('0x1a')],function(_0x551e06){return{'model':db[_0x551e06[_0xb7b6('0x1c')]],'as':_0x551e06['as'],'attributes':_0x551e06['attributes'],'include':_0x551e06['include']?_['map'](_0x551e06[_0xb7b6('0x1a')],function(_0x48ace6){return{'model':db[_0x48ace6['model']],'as':_0x48ace6['as'],'attributes':_0x48ace6[_0xb7b6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7b6('0xc')](function(_0x4276bd){logger[_0xb7b6('0xd')](_0xb7b6('0x16'),_0x3dc0f8);logger[_0xb7b6('0x10')](_0xb7b6('0x16'),_0x3dc0f8,JSON['stringify'](_0x4276bd));_0x5667d9(_0x4276bd);})['catch'](function(_0x3017f5){logger[_0xb7b6('0x12')](_0xb7b6('0x16'),_0x3017f5[_0xb7b6('0x14')],_0x3dc0f8);_0x314049(_0x7bb633[_0xb7b6('0x12')](0x1f4,_0x3017f5['message']));});});}; \ No newline at end of file +var _0xde9d=['info','catch','GetCampaign','Campaign','findAll','options','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x2d8559,_0x723228){var _0x5b2e8b=function(_0x5da1e8){while(--_0x5da1e8){_0x2d8559['push'](_0x2d8559['shift']());}};_0x5b2e8b(++_0x723228);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var moment=require(_0xdde9('0x2'));var BPromise=require(_0xdde9('0x3'));var rs=require(_0xdde9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde9('0x5'))['db'];var utils=require(_0xdde9('0x6'));var logger=require(_0xdde9('0x7'))('rpc');var config=require(_0xdde9('0x8'));var jayson=require(_0xdde9('0x9'));var client=jayson[_0xdde9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289ccb,_0x1431f0,_0x229168){return new BPromise(function(_0x3be8c1,_0x35268e){return client['request'](_0x289ccb,_0x229168)[_0xdde9('0xb')](function(_0x4fe44d){logger['info'](_0xdde9('0xc'),_0x1431f0,_0xdde9('0xd'));logger[_0xdde9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1431f0,_0xdde9('0xd'),JSON['stringify'](_0x4fe44d));if(_0x4fe44d['error']){if(_0x4fe44d[_0xdde9('0xf')][_0xdde9('0x10')]===0x1f4){logger[_0xdde9('0xf')]('Campaign,\x20%s,\x20%s',_0x1431f0,_0x4fe44d['error'][_0xdde9('0x11')]);return _0x35268e(_0x4fe44d[_0xdde9('0xf')]['message']);}logger['error'](_0xdde9('0xc'),_0x1431f0,_0x4fe44d[_0xdde9('0xf')]['message']);return _0x3be8c1(_0x4fe44d[_0xdde9('0xf')][_0xdde9('0x11')]);}else{logger[_0xdde9('0x12')]('Campaign,\x20%s,\x20%s',_0x1431f0,_0xdde9('0xd'));_0x3be8c1(_0x4fe44d['result']['message']);}})[_0xdde9('0x13')](function(_0x5c319d){logger['error']('Campaign,\x20%s,\x20%s',_0x1431f0,_0x5c319d);_0x35268e(_0x5c319d);});});}exports[_0xdde9('0x14')]=function(_0x2e0ed9){var _0x34259e=this;return new Promise(function(_0x2e4b89,_0x23dc91){return db[_0xdde9('0x15')][_0xdde9('0x16')]({'raw':_0x2e0ed9[_0xdde9('0x17')]?_0x2e0ed9[_0xdde9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e0ed9['options']?_0x2e0ed9[_0xdde9('0x17')][_0xdde9('0x18')]||null:null,'attributes':_0x2e0ed9[_0xdde9('0x17')]?_0x2e0ed9[_0xdde9('0x17')][_0xdde9('0x19')]||null:null,'limit':_0x2e0ed9[_0xdde9('0x17')]?_0x2e0ed9[_0xdde9('0x17')]['limit']||null:null,'include':_0x2e0ed9[_0xdde9('0x17')]?_0x2e0ed9[_0xdde9('0x17')][_0xdde9('0x1a')]?_['map'](_0x2e0ed9['options'][_0xdde9('0x1a')],function(_0x22a8af){return{'model':db[_0x22a8af[_0xdde9('0x1b')]],'as':_0x22a8af['as'],'attributes':_0x22a8af['attributes'],'include':_0x22a8af[_0xdde9('0x1a')]?_[_0xdde9('0x1c')](_0x22a8af[_0xdde9('0x1a')],function(_0xfe0286){return{'model':db[_0xfe0286['model']],'as':_0xfe0286['as'],'attributes':_0xfe0286['attributes'],'include':_0xfe0286['include']?_[_0xdde9('0x1c')](_0xfe0286['include'],function(_0x2c10c1){return{'model':db[_0x2c10c1[_0xdde9('0x1b')]],'as':_0x2c10c1['as'],'attributes':_0x2c10c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f549){logger[_0xdde9('0x12')](_0xdde9('0x14'),_0x2e0ed9);logger['debug'](_0xdde9('0x14'),_0x2e0ed9,JSON[_0xdde9('0x1d')](_0x2f549));_0x2e4b89(_0x2f549);})[_0xdde9('0x13')](function(_0x42f3bd){logger[_0xdde9('0xf')](_0xdde9('0x14'),_0x42f3bd[_0xdde9('0x11')],_0x2e0ed9);_0x23dc91(_0x34259e[_0xdde9('0xf')](0x1f4,_0x42f3bd[_0xdde9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8861636..175df61 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 _0xa5c5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','create','clone','addLists','post','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express'];(function(_0x1260a6,_0x1ee131){var _0x197933=function(_0x1ddf0f){while(--_0x1ddf0f){_0x1260a6['push'](_0x1260a6['shift']());}};_0x197933(++_0x1ee131);}(_0xa5c5,0x64));var _0x5a5c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa5c5[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x5a5c('0x0'));var util=require(_0x5a5c('0x1'));var path=require(_0x5a5c('0x2'));var timeout=require(_0x5a5c('0x3'));var express=require(_0x5a5c('0x4'));var router=express[_0x5a5c('0x5')]();var fs_extra=require(_0x5a5c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5a5c('0x7'));var config=require(_0x5a5c('0x8'));var controller=require(_0x5a5c('0x9'));router[_0x5a5c('0xa')]('/',auth[_0x5a5c('0xb')](),controller[_0x5a5c('0xc')]);router[_0x5a5c('0xa')](_0x5a5c('0xd'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0xe')]);router['get'](_0x5a5c('0xf'),auth[_0x5a5c('0xb')](),controller['getHoppers']);router[_0x5a5c('0xa')](_0x5a5c('0x10'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x11')]);router[_0x5a5c('0xa')](_0x5a5c('0x12'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x5a5c('0xa')](_0x5a5c('0x13'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x14')]);router[_0x5a5c('0xa')](_0x5a5c('0x15'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x5a5c('0x16'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x17')]);router['post']('/',auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x18')]);router['post']('/:id/clone',auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x19')]);router['post'](_0x5a5c('0x15'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x1a')]);router[_0x5a5c('0x1b')](_0x5a5c('0x16'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x1c')]);router[_0x5a5c('0x1d')](_0x5a5c('0xd'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x1e')]);router[_0x5a5c('0x1f')](_0x5a5c('0xd'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x20')]);router[_0x5a5c('0x1f')](_0x5a5c('0x15'),auth[_0x5a5c('0xb')](),controller[_0x5a5c('0x21')]);router['delete'](_0x5a5c('0x16'),auth[_0x5a5c('0xb')](),controller['removeBlackLists']);module[_0x5a5c('0x22')]=router; \ No newline at end of file +var _0x5210=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x53f9c1,_0x339193){var _0x5d0acc=function(_0x982cd7){while(--_0x982cd7){_0x53f9c1['push'](_0x53f9c1['shift']());}};_0x5d0acc(++_0x339193);}(_0x5210,0x164));var _0x0521=function(_0x30ee1e,_0x541502){_0x30ee1e=_0x30ee1e-0x0;var _0x214ac7=_0x5210[_0x30ee1e];return _0x214ac7;};'use strict';var multer=require(_0x0521('0x0'));var util=require(_0x0521('0x1'));var path=require(_0x0521('0x2'));var timeout=require(_0x0521('0x3'));var express=require('express');var router=express[_0x0521('0x4')]();var fs_extra=require(_0x0521('0x5'));var auth=require(_0x0521('0x6'));var interaction=require(_0x0521('0x7'));var config=require('../../config/environment');var controller=require(_0x0521('0x8'));router['get']('/',auth[_0x0521('0x9')](),controller[_0x0521('0xa')]);router[_0x0521('0xb')](_0x0521('0xc'),auth[_0x0521('0x9')](),controller['show']);router['get'](_0x0521('0xd'),auth['isAuthenticated'](),controller[_0x0521('0xe')]);router[_0x0521('0xb')](_0x0521('0xf'),auth[_0x0521('0x9')](),controller[_0x0521('0x10')]);router['get'](_0x0521('0x11'),auth['isAuthenticated'](),controller[_0x0521('0x12')]);router['get'](_0x0521('0x13'),auth[_0x0521('0x9')](),controller[_0x0521('0x14')]);router[_0x0521('0xb')](_0x0521('0x15'),auth['isAuthenticated'](),controller[_0x0521('0x16')]);router[_0x0521('0xb')](_0x0521('0x17'),auth[_0x0521('0x9')](),controller['getBlackLists']);router[_0x0521('0x18')]('/',auth[_0x0521('0x9')](),controller['create']);router[_0x0521('0x18')](_0x0521('0x19'),auth[_0x0521('0x9')](),controller[_0x0521('0x1a')]);router[_0x0521('0x18')](_0x0521('0x15'),auth[_0x0521('0x9')](),controller['addLists']);router[_0x0521('0x18')]('/:id/blacklists',auth[_0x0521('0x9')](),controller['addBlackLists']);router['put']('/:id',auth[_0x0521('0x9')](),controller['update']);router[_0x0521('0x1b')](_0x0521('0xc'),auth[_0x0521('0x9')](),controller[_0x0521('0x1c')]);router['delete'](_0x0521('0x15'),auth[_0x0521('0x9')](),controller[_0x0521('0x1d')]);router[_0x0521('0x1b')](_0x0521('0x17'),auth[_0x0521('0x9')](),controller[_0x0521('0x1e')]);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 343939c..a517732 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 _0x9e30=['TEXT','medium','VIRTUAL','getDataValue','key','exports','STRING'];(function(_0xfebf65,_0x2101b7){var _0x14e254=function(_0x568cf3){while(--_0x568cf3){_0xfebf65['push'](_0xfebf65['shift']());}};_0x14e254(++_0x2101b7);}(_0x9e30,0x1b7));var _0x09e3=function(_0x4668a6,_0x4e8a1f){_0x4668a6=_0x4668a6-0x0;var _0x23215d=_0x9e30[_0x4668a6];return _0x23215d;};'use strict';var Sequelize=require('sequelize');module[_0x09e3('0x0')]={'key':{'type':Sequelize[_0x09e3('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x09e3('0x2')],'length':_0x09e3('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x09e3('0x4')],'get':function(){return this[_0x09e3('0x5')](_0x09e3('0x6'));}}}; \ No newline at end of file +var _0x80ea=['getDataValue','sequelize','STRING','medium','VIRTUAL'];(function(_0x3e76ca,_0xc4bd4e){var _0x4dd6dd=function(_0x2ec7a5){while(--_0x2ec7a5){_0x3e76ca['push'](_0x3e76ca['shift']());}};_0x4dd6dd(++_0xc4bd4e);}(_0x80ea,0x1c3));var _0xa80e=function(_0x297b3b,_0x44d0e1){_0x297b3b=_0x297b3b-0x0;var _0x59c00f=_0x80ea[_0x297b3b];return _0x59c00f;};'use strict';var Sequelize=require(_0xa80e('0x0'));module['exports']={'key':{'type':Sequelize[_0xa80e('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xa80e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa80e('0x1')]},'name':{'type':Sequelize[_0xa80e('0x3')],'get':function(){return this[_0xa80e('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index dfca12a..8973af7 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 _0x4994=['The\x20inserted\x20key\x20already\x20exists.','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','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','CannedAnswer','findAll','rows','catch','show','params','includeAll','merge','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError'];(function(_0x41b7bd,_0x2ece4c){var _0x4abfc0=function(_0x26368d){while(--_0x26368d){_0x41b7bd['push'](_0x41b7bd['shift']());}};_0x4abfc0(++_0x2ece4c);}(_0x4994,0x117));var _0x4499=function(_0x384392,_0x46ded5){_0x384392=_0x384392-0x0;var _0x148f47=_0x4994[_0x384392];return _0x148f47;};'use strict';var emlformat=require(_0x4499('0x0'));var rimraf=require(_0x4499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4499('0x2'));var rp=require(_0x4499('0x3'));var moment=require(_0x4499('0x4'));var BPromise=require(_0x4499('0x5'));var Mustache=require(_0x4499('0x6'));var util=require(_0x4499('0x7'));var path=require(_0x4499('0x8'));var sox=require('sox');var csv=require(_0x4499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4499('0xa'));var crypto=require(_0x4499('0xb'));var jsforce=require(_0x4499('0xc'));var deskjs=require(_0x4499('0xd'));var toCsv=require(_0x4499('0x9'));var querystring=require(_0x4499('0xe'));var Papa=require(_0x4499('0xf'));var Redis=require('ioredis');var authService=require(_0x4499('0x10'));var qs=require(_0x4499('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4499('0x12'));var logger=require(_0x4499('0x13'))('api');var utils=require(_0x4499('0x14'));var config=require(_0x4499('0x15'));var licenseUtil=require(_0x4499('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db1b2,_0x5b04ed){_0x5b04ed=_0x5b04ed||0xcc;return function(_0x53a3c8){if(_0x53a3c8){return _0x4db1b2[_0x4499('0x17')](_0x5b04ed);}return _0x4db1b2['status'](_0x5b04ed)[_0x4499('0x18')]();};}function respondWithResult(_0x5eef37,_0xeb3e99){_0xeb3e99=_0xeb3e99||0xc8;return function(_0x9298ef){if(_0x9298ef){return _0x5eef37[_0x4499('0x19')](_0xeb3e99)[_0x4499('0x1a')](_0x9298ef);}};}function respondWithFilteredResult(_0x5dc9bb,_0x1b5780){return function(_0x2cb249){if(_0x2cb249){var _0x1e0776=typeof _0x1b5780['offset']===_0x4499('0x1b')&&typeof _0x1b5780[_0x4499('0x1c')]===_0x4499('0x1b');var _0x11893c=_0x2cb249['count'];var _0x313d62=_0x1e0776?0x0:_0x1b5780['offset'];var _0x2fb115=_0x1e0776?_0x2cb249[_0x4499('0x1d')]:_0x1b5780[_0x4499('0x1e')]+_0x1b5780['limit'];var _0x1a1fd6;if(_0x2fb115>=_0x11893c){_0x2fb115=_0x11893c;_0x1a1fd6=0xc8;}else{_0x1a1fd6=0xce;}_0x5dc9bb['status'](_0x1a1fd6);return _0x5dc9bb[_0x4499('0x1f')](_0x4499('0x20'),_0x313d62+'-'+_0x2fb115+'/'+_0x11893c)[_0x4499('0x1a')](_0x2cb249);}return null;};}function patchUpdates(_0x51f1f8){return function(_0x2e23b7){try{jsonpatch[_0x4499('0x21')](_0x2e23b7,_0x51f1f8,!![]);}catch(_0x5a13e6){return BPromise[_0x4499('0x22')](_0x5a13e6);}return _0x2e23b7['save']();};}function saveUpdates(_0x2a3bde,_0x207abf){return function(_0x4b9979){if(_0x4b9979){return _0x4b9979['update'](_0x2a3bde)[_0x4499('0x23')](function(_0x265b3f){return _0x265b3f;});}return null;};}function removeEntity(_0x480664,_0x344f96){return function(_0x376862){if(_0x376862){return _0x376862[_0x4499('0x24')]()[_0x4499('0x23')](function(){var _0x527fcf=_0x376862[_0x4499('0x25')]({'plain':!![]});var _0xd161d2=_0x4499('0x26');return db['UserProfileResource'][_0x4499('0x24')]({'where':{'type':_0xd161d2,'resourceId':_0x527fcf['id']}})[_0x4499('0x23')](function(){return _0x376862;});})[_0x4499('0x23')](function(){_0x480664[_0x4499('0x19')](0xcc)[_0x4499('0x18')]();});}};}function handleEntityNotFound(_0x49137a,_0x3ac8d9){return function(_0x4e5aeb){if(!_0x4e5aeb){_0x49137a['sendStatus'](0x194);}return _0x4e5aeb;};}function handleError(_0x93dc8,_0x2759db){_0x2759db=_0x2759db||0x1f4;return function(_0xeaa6b7){logger[_0x4499('0x27')](_0xeaa6b7[_0x4499('0x28')]);if(_0xeaa6b7['name']){delete _0xeaa6b7[_0x4499('0x29')];}_0x93dc8[_0x4499('0x19')](_0x2759db)[_0x4499('0x2a')](_0xeaa6b7);};}exports[_0x4499('0x2b')]=function(_0x3fb9a3,_0x1bda41){var _0x27ce9c={},_0x155d94={},_0x5f2d13={'count':0x0,'rows':[]};var _0x1a1cf5=_[_0x4499('0x2c')](db['CannedAnswer'][_0x4499('0x2d')],function(_0x47bbfe){return{'name':_0x47bbfe[_0x4499('0x2e')],'type':_0x47bbfe[_0x4499('0x2f')][_0x4499('0x30')]};});_0x155d94[_0x4499('0x31')]=_[_0x4499('0x2c')](_0x1a1cf5,_0x4499('0x29'));_0x155d94[_0x4499('0x32')]=_[_0x4499('0x33')](_0x3fb9a3['query']);_0x155d94[_0x4499('0x34')]=_[_0x4499('0x35')](_0x155d94[_0x4499('0x31')],_0x155d94[_0x4499('0x32')]);_0x27ce9c['attributes']=_[_0x4499('0x35')](_0x155d94[_0x4499('0x31')],qs[_0x4499('0x36')](_0x3fb9a3[_0x4499('0x32')][_0x4499('0x36')]));_0x27ce9c[_0x4499('0x37')]=_0x27ce9c[_0x4499('0x37')][_0x4499('0x38')]?_0x27ce9c[_0x4499('0x37')]:_0x155d94[_0x4499('0x31')];if(!_0x3fb9a3[_0x4499('0x32')][_0x4499('0x39')](_0x4499('0x3a'))){_0x27ce9c[_0x4499('0x1c')]=qs[_0x4499('0x1c')](_0x3fb9a3['query'][_0x4499('0x1c')]);_0x27ce9c[_0x4499('0x1e')]=qs[_0x4499('0x1e')](_0x3fb9a3[_0x4499('0x32')][_0x4499('0x1e')]);}_0x27ce9c[_0x4499('0x3b')]=qs[_0x4499('0x3c')](_0x3fb9a3[_0x4499('0x32')][_0x4499('0x3c')]);_0x27ce9c[_0x4499('0x3d')]=qs[_0x4499('0x34')](_['pick'](_0x3fb9a3[_0x4499('0x32')],_0x155d94[_0x4499('0x34')]),_0x1a1cf5);if(_0x3fb9a3[_0x4499('0x32')]['filter']){_0x27ce9c[_0x4499('0x3d')]=_['merge'](_0x27ce9c[_0x4499('0x3d')],{'$or':[{'key':{'$like':'%'+_0x3fb9a3[_0x4499('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x3fb9a3[_0x4499('0x32')][_0x4499('0x3e')]+'%'}}]});}_0x27ce9c=_['merge']({},_0x27ce9c,_0x3fb9a3[_0x4499('0x3f')]);var _0x273ce6={'where':_0x27ce9c[_0x4499('0x3d')]};return db[_0x4499('0x40')][_0x4499('0x1d')](_0x273ce6)[_0x4499('0x23')](function(_0x33034f){_0x5f2d13[_0x4499('0x1d')]=_0x33034f;if(_0x3fb9a3[_0x4499('0x32')]['includeAll']){_0x27ce9c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x4499('0x41')](_0x27ce9c);})[_0x4499('0x23')](function(_0x3fd6fb){_0x5f2d13[_0x4499('0x42')]=_0x3fd6fb;return _0x5f2d13;})[_0x4499('0x23')](respondWithFilteredResult(_0x1bda41,_0x27ce9c))[_0x4499('0x43')](handleError(_0x1bda41,null));};exports[_0x4499('0x44')]=function(_0x4ae052,_0x18c26f){var _0x4faf3b={'raw':!![],'where':{'id':_0x4ae052[_0x4499('0x45')]['id']}},_0x5928d3={};_0x5928d3[_0x4499('0x31')]=_[_0x4499('0x33')](db[_0x4499('0x40')][_0x4499('0x2d')]);_0x5928d3[_0x4499('0x32')]=_[_0x4499('0x33')](_0x4ae052[_0x4499('0x32')]);_0x5928d3['filters']=_['intersection'](_0x5928d3[_0x4499('0x31')],_0x5928d3[_0x4499('0x32')]);_0x4faf3b[_0x4499('0x37')]=_[_0x4499('0x35')](_0x5928d3[_0x4499('0x31')],qs['fields'](_0x4ae052['query']['fields']));_0x4faf3b[_0x4499('0x37')]=_0x4faf3b[_0x4499('0x37')][_0x4499('0x38')]?_0x4faf3b[_0x4499('0x37')]:_0x5928d3[_0x4499('0x31')];if(_0x4ae052[_0x4499('0x32')][_0x4499('0x46')]){_0x4faf3b['include']=[{'all':!![]}];}_0x4faf3b=_[_0x4499('0x47')]({},_0x4faf3b,_0x4ae052[_0x4499('0x3f')]);return db[_0x4499('0x40')][_0x4499('0x48')](_0x4faf3b)[_0x4499('0x23')](handleEntityNotFound(_0x18c26f,null))[_0x4499('0x23')](respondWithResult(_0x18c26f,null))[_0x4499('0x43')](handleError(_0x18c26f,null));};exports[_0x4499('0x49')]=function(_0x3eb3ab,_0x5b4cdd){if(_0x3eb3ab['body']['id']){delete _0x3eb3ab['body']['id'];}return db[_0x4499('0x40')][_0x4499('0x48')]({'where':{'id':_0x3eb3ab['params']['id']}})[_0x4499('0x23')](handleEntityNotFound(_0x5b4cdd,null))[_0x4499('0x23')](saveUpdates(_0x3eb3ab[_0x4499('0x4a')],null))[_0x4499('0x23')](respondWithResult(_0x5b4cdd,null))['catch'](handleError(_0x5b4cdd,null));};exports[_0x4499('0x24')]=function(_0x4a23b1,_0x200c1b){return db[_0x4499('0x40')][_0x4499('0x48')]({'where':{'id':_0x4a23b1[_0x4499('0x45')]['id']}})[_0x4499('0x23')](handleEntityNotFound(_0x200c1b,null))[_0x4499('0x23')](removeEntity(_0x200c1b,null))[_0x4499('0x43')](handleError(_0x200c1b,null));};exports[_0x4499('0x4b')]=function(_0x38444c,_0x462ea9){var _0x28af17={'key':_0x38444c[_0x4499('0x4a')][_0x4499('0x30')]};if(_0x38444c[_0x4499('0x4a')]['MailAccountId']){_0x28af17[_0x4499('0x4c')]=_0x38444c[_0x4499('0x4a')][_0x4499('0x4c')];}else if(_0x38444c[_0x4499('0x4a')]['SmsAccountId']){_0x28af17[_0x4499('0x4d')]=_0x38444c[_0x4499('0x4a')][_0x4499('0x4d')];}else if(_0x38444c['body'][_0x4499('0x4e')]){_0x28af17[_0x4499('0x4e')]=_0x38444c[_0x4499('0x4a')][_0x4499('0x4e')];}else if(_0x38444c[_0x4499('0x4a')][_0x4499('0x4f')]){_0x28af17[_0x4499('0x4f')]=_0x38444c[_0x4499('0x4a')][_0x4499('0x4f')];}return db[_0x4499('0x40')]['find']({'where':_0x28af17})[_0x4499('0x23')](function(_0x120aeb){if(_0x120aeb){throw new db['Sequelize'][(_0x4499('0x50'))](_0x4499('0x51'));}return db[_0x4499('0x40')][_0x4499('0x4b')](_0x38444c[_0x4499('0x4a')]);})[_0x4499('0x23')](function(_0x99466b){var _0xbf84ad=_0x38444c[_0x4499('0x52')][_0x4499('0x25')]({'plain':!![]});if(!_0xbf84ad)throw new Error(_0x4499('0x53'));if(_0xbf84ad[_0x4499('0x54')]==='user'){var _0x250bfd=_0x99466b[_0x4499('0x25')]({'plain':!![]});return db[_0x4499('0x55')][_0x4499('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0xbf84ad[_0x4499('0x56')]},'raw':!![]})[_0x4499('0x23')](function(_0x43c697){if(_0x43c697&&_0x43c697[_0x4499('0x57')]===0x0){return db[_0x4499('0x58')][_0x4499('0x4b')]({'name':_0x250bfd[_0x4499('0x29')],'resourceId':_0x250bfd['id'],'type':_0x43c697[_0x4499('0x29')],'sectionId':_0x43c697['id']},{})['then'](function(){return _0x99466b;});}else{return _0x99466b;}})[_0x4499('0x43')](function(_0xb2395e){logger[_0x4499('0x27')](_0x4499('0x59'),_0xb2395e);throw _0xb2395e;});}return _0x99466b;})[_0x4499('0x23')](respondWithResult(_0x462ea9,0xc9))[_0x4499('0x43')](handleError(_0x462ea9,null));}; \ No newline at end of file +var _0x0990=['crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','CannedAnswers','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','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','to-csv','ejs','fs-extra','lodash'];(function(_0x2a8bd2,_0x3bf66d){var _0x4a9ed1=function(_0x34f283){while(--_0x34f283){_0x2a8bd2['push'](_0x2a8bd2['shift']());}};_0x4a9ed1(++_0x3bf66d);}(_0x0990,0x157));var _0x0099=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x0990[_0x1e2321];return _0x1d346d;};'use strict';var emlformat=require(_0x0099('0x0'));var rimraf=require(_0x0099('0x1'));var zipdir=require(_0x0099('0x2'));var jsonpatch=require(_0x0099('0x3'));var rp=require(_0x0099('0x4'));var moment=require(_0x0099('0x5'));var BPromise=require(_0x0099('0x6'));var Mustache=require(_0x0099('0x7'));var util=require(_0x0099('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0099('0x9'));var ejs=require(_0x0099('0xa'));var fs=require('fs');var fs_extra=require(_0x0099('0xb'));var _=require(_0x0099('0xc'));var squel=require('squel');var crypto=require(_0x0099('0xd'));var jsforce=require(_0x0099('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0099('0xf'));var Redis=require(_0x0099('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0099('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0099('0x12'))(_0x0099('0x13'));var utils=require(_0x0099('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0099('0x15'));var db=require(_0x0099('0x16'))['db'];function respondWithStatusCode(_0x52c780,_0x3f0c80){_0x3f0c80=_0x3f0c80||0xcc;return function(_0xbb2589){if(_0xbb2589){return _0x52c780[_0x0099('0x17')](_0x3f0c80);}return _0x52c780[_0x0099('0x18')](_0x3f0c80)[_0x0099('0x19')]();};}function respondWithResult(_0x33ec83,_0xfd24a7){_0xfd24a7=_0xfd24a7||0xc8;return function(_0x6ad7c9){if(_0x6ad7c9){return _0x33ec83[_0x0099('0x18')](_0xfd24a7)[_0x0099('0x1a')](_0x6ad7c9);}};}function respondWithFilteredResult(_0x54d419,_0x50a1bb){return function(_0x4eb71e){if(_0x4eb71e){var _0x3dc425=typeof _0x50a1bb[_0x0099('0x1b')]===_0x0099('0x1c')&&typeof _0x50a1bb[_0x0099('0x1d')]===_0x0099('0x1c');var _0x5340f5=_0x4eb71e[_0x0099('0x1e')];var _0x459b92=_0x3dc425?0x0:_0x50a1bb[_0x0099('0x1b')];var _0x171e99=_0x3dc425?_0x4eb71e[_0x0099('0x1e')]:_0x50a1bb['offset']+_0x50a1bb[_0x0099('0x1d')];var _0x55a974;if(_0x171e99>=_0x5340f5){_0x171e99=_0x5340f5;_0x55a974=0xc8;}else{_0x55a974=0xce;}_0x54d419[_0x0099('0x18')](_0x55a974);return _0x54d419[_0x0099('0x1f')](_0x0099('0x20'),_0x459b92+'-'+_0x171e99+'/'+_0x5340f5)[_0x0099('0x1a')](_0x4eb71e);}return null;};}function patchUpdates(_0x4a68e7){return function(_0x3b3eca){try{jsonpatch[_0x0099('0x21')](_0x3b3eca,_0x4a68e7,!![]);}catch(_0x5003a5){return BPromise[_0x0099('0x22')](_0x5003a5);}return _0x3b3eca['save']();};}function saveUpdates(_0x8646d4,_0x1e227b){return function(_0x415240){if(_0x415240){return _0x415240['update'](_0x8646d4)[_0x0099('0x23')](function(_0x91be35){return _0x91be35;});}return null;};}function removeEntity(_0x1cca2e,_0x7e0f75){return function(_0x5d14e6){if(_0x5d14e6){return _0x5d14e6['destroy']()[_0x0099('0x23')](function(){var _0x1ad098=_0x5d14e6[_0x0099('0x24')]({'plain':!![]});var _0x302ea9=_0x0099('0x25');return db['UserProfileResource'][_0x0099('0x26')]({'where':{'type':_0x302ea9,'resourceId':_0x1ad098['id']}})[_0x0099('0x23')](function(){return _0x5d14e6;});})['then'](function(){_0x1cca2e['status'](0xcc)[_0x0099('0x19')]();});}};}function handleEntityNotFound(_0x41ef88,_0x37ec45){return function(_0x2a36b8){if(!_0x2a36b8){_0x41ef88[_0x0099('0x17')](0x194);}return _0x2a36b8;};}function handleError(_0x4562ca,_0x329164){_0x329164=_0x329164||0x1f4;return function(_0x420066){logger[_0x0099('0x27')](_0x420066[_0x0099('0x28')]);if(_0x420066[_0x0099('0x29')]){delete _0x420066[_0x0099('0x29')];}_0x4562ca[_0x0099('0x18')](_0x329164)[_0x0099('0x2a')](_0x420066);};}exports[_0x0099('0x2b')]=function(_0xd23f51,_0x57f7d0){var _0x3dd04c={},_0x2a2f80={},_0x2534ba={'count':0x0,'rows':[]};var _0x4855bb=_[_0x0099('0x2c')](db['CannedAnswer'][_0x0099('0x2d')],function(_0x17f28a){return{'name':_0x17f28a[_0x0099('0x2e')],'type':_0x17f28a['type'][_0x0099('0x2f')]};});_0x2a2f80[_0x0099('0x30')]=_[_0x0099('0x2c')](_0x4855bb,'name');_0x2a2f80['query']=_[_0x0099('0x31')](_0xd23f51['query']);_0x2a2f80['filters']=_[_0x0099('0x32')](_0x2a2f80[_0x0099('0x30')],_0x2a2f80['query']);_0x3dd04c['attributes']=_[_0x0099('0x32')](_0x2a2f80[_0x0099('0x30')],qs[_0x0099('0x33')](_0xd23f51[_0x0099('0x34')]['fields']));_0x3dd04c[_0x0099('0x35')]=_0x3dd04c[_0x0099('0x35')][_0x0099('0x36')]?_0x3dd04c[_0x0099('0x35')]:_0x2a2f80[_0x0099('0x30')];if(!_0xd23f51['query'][_0x0099('0x37')](_0x0099('0x38'))){_0x3dd04c['limit']=qs['limit'](_0xd23f51[_0x0099('0x34')][_0x0099('0x1d')]);_0x3dd04c[_0x0099('0x1b')]=qs['offset'](_0xd23f51[_0x0099('0x34')][_0x0099('0x1b')]);}_0x3dd04c['order']=qs['sort'](_0xd23f51['query'][_0x0099('0x39')]);_0x3dd04c['where']=qs[_0x0099('0x3a')](_[_0x0099('0x3b')](_0xd23f51[_0x0099('0x34')],_0x2a2f80['filters']),_0x4855bb);if(_0xd23f51['query'][_0x0099('0x3c')]){_0x3dd04c[_0x0099('0x3d')]=_[_0x0099('0x3e')](_0x3dd04c[_0x0099('0x3d')],{'$or':[{'key':{'$like':'%'+_0xd23f51[_0x0099('0x34')][_0x0099('0x3c')]+'%'}},{'value':{'$like':'%'+_0xd23f51[_0x0099('0x34')][_0x0099('0x3c')]+'%'}}]});}_0x3dd04c=_[_0x0099('0x3e')]({},_0x3dd04c,_0xd23f51[_0x0099('0x3f')]);var _0x476721={'where':_0x3dd04c[_0x0099('0x3d')]};return db[_0x0099('0x40')]['count'](_0x476721)[_0x0099('0x23')](function(_0x7b90c9){_0x2534ba[_0x0099('0x1e')]=_0x7b90c9;if(_0xd23f51['query'][_0x0099('0x41')]){_0x3dd04c[_0x0099('0x42')]=[{'all':!![]}];}return db[_0x0099('0x40')][_0x0099('0x43')](_0x3dd04c);})[_0x0099('0x23')](function(_0x1f3667){_0x2534ba[_0x0099('0x44')]=_0x1f3667;return _0x2534ba;})[_0x0099('0x23')](respondWithFilteredResult(_0x57f7d0,_0x3dd04c))[_0x0099('0x45')](handleError(_0x57f7d0,null));};exports[_0x0099('0x46')]=function(_0x472a17,_0x3ebf82){var _0x133036={'raw':!![],'where':{'id':_0x472a17['params']['id']}},_0x5f1aa4={};_0x5f1aa4[_0x0099('0x30')]=_[_0x0099('0x31')](db['CannedAnswer']['rawAttributes']);_0x5f1aa4[_0x0099('0x34')]=_[_0x0099('0x31')](_0x472a17[_0x0099('0x34')]);_0x5f1aa4['filters']=_[_0x0099('0x32')](_0x5f1aa4[_0x0099('0x30')],_0x5f1aa4[_0x0099('0x34')]);_0x133036[_0x0099('0x35')]=_[_0x0099('0x32')](_0x5f1aa4[_0x0099('0x30')],qs[_0x0099('0x33')](_0x472a17[_0x0099('0x34')]['fields']));_0x133036[_0x0099('0x35')]=_0x133036[_0x0099('0x35')][_0x0099('0x36')]?_0x133036[_0x0099('0x35')]:_0x5f1aa4[_0x0099('0x30')];if(_0x472a17[_0x0099('0x34')][_0x0099('0x41')]){_0x133036[_0x0099('0x42')]=[{'all':!![]}];}_0x133036=_[_0x0099('0x3e')]({},_0x133036,_0x472a17[_0x0099('0x3f')]);return db[_0x0099('0x40')][_0x0099('0x47')](_0x133036)[_0x0099('0x23')](handleEntityNotFound(_0x3ebf82,null))[_0x0099('0x23')](respondWithResult(_0x3ebf82,null))[_0x0099('0x45')](handleError(_0x3ebf82,null));};exports['update']=function(_0x59ac38,_0x20f6ba){if(_0x59ac38[_0x0099('0x48')]['id']){delete _0x59ac38['body']['id'];}return db[_0x0099('0x40')][_0x0099('0x47')]({'where':{'id':_0x59ac38[_0x0099('0x49')]['id']}})['then'](handleEntityNotFound(_0x20f6ba,null))['then'](saveUpdates(_0x59ac38['body'],null))[_0x0099('0x23')](respondWithResult(_0x20f6ba,null))[_0x0099('0x45')](handleError(_0x20f6ba,null));};exports[_0x0099('0x26')]=function(_0x2403b,_0x51e3bb){return db[_0x0099('0x40')][_0x0099('0x47')]({'where':{'id':_0x2403b[_0x0099('0x49')]['id']}})[_0x0099('0x23')](handleEntityNotFound(_0x51e3bb,null))['then'](removeEntity(_0x51e3bb,null))[_0x0099('0x45')](handleError(_0x51e3bb,null));};exports[_0x0099('0x4a')]=function(_0x62d7f0,_0x3a6d9f){var _0x4fd50b={'key':_0x62d7f0['body']['key']};if(_0x62d7f0[_0x0099('0x48')][_0x0099('0x4b')]){_0x4fd50b[_0x0099('0x4b')]=_0x62d7f0[_0x0099('0x48')][_0x0099('0x4b')];}else if(_0x62d7f0['body'][_0x0099('0x4c')]){_0x4fd50b[_0x0099('0x4c')]=_0x62d7f0[_0x0099('0x48')]['SmsAccountId'];}else if(_0x62d7f0[_0x0099('0x48')][_0x0099('0x4d')]){_0x4fd50b[_0x0099('0x4d')]=_0x62d7f0[_0x0099('0x48')]['OpenchannelAccountId'];}else if(_0x62d7f0[_0x0099('0x48')][_0x0099('0x4e')]){_0x4fd50b['ChatWebsiteId']=_0x62d7f0[_0x0099('0x48')][_0x0099('0x4e')];}return db[_0x0099('0x40')][_0x0099('0x47')]({'where':_0x4fd50b})['then'](function(_0x2bdbd8){if(_0x2bdbd8){throw new db['Sequelize'][(_0x0099('0x4f'))](_0x0099('0x50'));}return db[_0x0099('0x40')][_0x0099('0x4a')](_0x62d7f0[_0x0099('0x48')]);})[_0x0099('0x23')](function(_0x1658fb){var _0x46841c=_0x62d7f0[_0x0099('0x51')][_0x0099('0x24')]({'plain':!![]});if(!_0x46841c)throw new Error(_0x0099('0x52'));if(_0x46841c[_0x0099('0x53')]===_0x0099('0x51')){var _0x345557=_0x1658fb[_0x0099('0x24')]({'plain':!![]});return db[_0x0099('0x54')][_0x0099('0x47')]({'where':{'name':_0x0099('0x25'),'userProfileId':_0x46841c[_0x0099('0x55')]},'raw':!![]})[_0x0099('0x23')](function(_0x289c8d){if(_0x289c8d&&_0x289c8d[_0x0099('0x56')]===0x0){return db[_0x0099('0x57')][_0x0099('0x4a')]({'name':_0x345557[_0x0099('0x29')],'resourceId':_0x345557['id'],'type':_0x289c8d['name'],'sectionId':_0x289c8d['id']},{})[_0x0099('0x23')](function(){return _0x1658fb;});}else{return _0x1658fb;}})[_0x0099('0x45')](function(_0x14da05){logger[_0x0099('0x27')](_0x0099('0x58'),_0x14da05);throw _0x14da05;});}return _0x1658fb;})[_0x0099('0x23')](respondWithResult(_0x3a6d9f,0xc9))[_0x0099('0x45')](handleError(_0x3a6d9f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c7f1ae4..a9c91d8 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 _0x3cab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','utf8mb4_unicode_ci'];(function(_0x2d1290,_0xc13145){var _0x861ae2=function(_0x1abac0){while(--_0x1abac0){_0x2d1290['push'](_0x2d1290['shift']());}};_0x861ae2(++_0xc13145);}(_0x3cab,0x1bc));var _0xb3ca=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x3cab[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xb3ca('0x0'));var util=require(_0xb3ca('0x1'));var logger=require(_0xb3ca('0x2'))(_0xb3ca('0x3'));var moment=require(_0xb3ca('0x4'));var BPromise=require(_0xb3ca('0x5'));var rp=require(_0xb3ca('0x6'));var fs=require('fs');var path=require(_0xb3ca('0x7'));var rimraf=require('rimraf');var config=require(_0xb3ca('0x8'));var attributes=require(_0xb3ca('0x9'));module[_0xb3ca('0xa')]=function(_0x462312,_0x327f7f){return _0x462312['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb3ca('0xb')});}; \ No newline at end of file +var _0x657e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x657e,0x94));var _0xe657=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x657e[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xe657('0x0'));var util=require('util');var logger=require(_0xe657('0x1'))(_0xe657('0x2'));var moment=require(_0xe657('0x3'));var BPromise=require(_0xe657('0x4'));var rp=require(_0xe657('0x5'));var fs=require('fs');var path=require(_0xe657('0x6'));var rimraf=require(_0xe657('0x7'));var config=require(_0xe657('0x8'));var attributes=require(_0xe657('0x9'));module[_0xe657('0xa')]=function(_0x5655ea,_0x37fd03){return _0x5655ea[_0xe657('0xb')]('CannedAnswer',attributes,{'tableName':_0xe657('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe657('0xd'),'collate':_0xe657('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 6f0cf8e..30e722b 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(_0x16c4a5,_0x4ce71c){var _0x454081=function(_0x640fc){while(--_0x640fc){_0x16c4a5['push'](_0x16c4a5['shift']());}};_0x454081(++_0x4ce71c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x102235,_0x20cab8){var _0x3a9b46=function(_0xc2c5d1){while(--_0xc2c5d1){_0x102235['push'](_0x102235['shift']());}};_0x3a9b46(++_0x20cab8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 537ea29..cbc646a 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 _0x5cfa=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x299c5d,_0x205212){var _0x1985fe=function(_0x286592){while(--_0x286592){_0x299c5d['push'](_0x299c5d['shift']());}};_0x1985fe(++_0x205212);}(_0x5cfa,0x1d5));var _0xa5cf=function(_0x43bcaf,_0x1f439b){_0x43bcaf=_0x43bcaf-0x0;var _0x5e8ba2=_0x5cfa[_0x43bcaf];return _0x5e8ba2;};'use strict';var multer=require('multer');var util=require(_0xa5cf('0x0'));var path=require(_0xa5cf('0x1'));var timeout=require(_0xa5cf('0x2'));var express=require(_0xa5cf('0x3'));var router=express['Router']();var fs_extra=require(_0xa5cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa5cf('0x5'));var config=require(_0xa5cf('0x6'));var controller=require(_0xa5cf('0x7'));router['get']('/',auth[_0xa5cf('0x8')](),controller[_0xa5cf('0x9')]);router['get'](_0xa5cf('0xa'),auth[_0xa5cf('0x8')](),controller[_0xa5cf('0xb')]);router[_0xa5cf('0xc')]('/',auth[_0xa5cf('0x8')](),controller[_0xa5cf('0xd')]);router[_0xa5cf('0xe')](_0xa5cf('0xa'),auth[_0xa5cf('0x8')](),controller[_0xa5cf('0xf')]);router[_0xa5cf('0x10')](_0xa5cf('0xa'),auth[_0xa5cf('0x8')](),controller['destroy']);module[_0xa5cf('0x11')]=router; \ No newline at end of file +var _0xc621=['isAuthenticated','show','post','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id'];(function(_0x3e63b9,_0x433fca){var _0x1c9227=function(_0x46629e){while(--_0x46629e){_0x3e63b9['push'](_0x3e63b9['shift']());}};_0x1c9227(++_0x433fca);}(_0xc621,0x1f4));var _0x1c62=function(_0x53cd54,_0x43a6d7){_0x53cd54=_0x53cd54-0x0;var _0x3389a7=_0xc621[_0x53cd54];return _0x3389a7;};'use strict';var multer=require('multer');var util=require(_0x1c62('0x0'));var path=require('path');var timeout=require(_0x1c62('0x1'));var express=require(_0x1c62('0x2'));var router=express[_0x1c62('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c62('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c62('0x5'));var controller=require(_0x1c62('0x6'));router[_0x1c62('0x7')]('/',auth['isAuthenticated'](),controller[_0x1c62('0x8')]);router[_0x1c62('0x7')](_0x1c62('0x9'),auth[_0x1c62('0xa')](),controller[_0x1c62('0xb')]);router[_0x1c62('0xc')]('/',auth['isAuthenticated'](),controller[_0x1c62('0xd')]);router['put'](_0x1c62('0x9'),auth['isAuthenticated'](),controller[_0x1c62('0xe')]);router['delete'](_0x1c62('0x9'),auth[_0x1c62('0xa')](),controller[_0x1c62('0xf')]);module[_0x1c62('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f769ef1..542c18c 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 _0xe1bf=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x1e3fb3,_0x156869){var _0x4db740=function(_0x4b5303){while(--_0x4b5303){_0x1e3fb3['push'](_0x1e3fb3['shift']());}};_0x4db740(++_0x156869);}(_0xe1bf,0x67));var _0xfe1b=function(_0x32ae13,_0x8c267a){_0x32ae13=_0x32ae13-0x0;var _0x4b78d8=_0xe1bf[_0x32ae13];return _0x4b78d8;};'use strict';var Sequelize=require('sequelize');module[_0xfe1b('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xfe1b('0x1')},'clid':{'type':Sequelize[_0xfe1b('0x2')]},'src':{'type':Sequelize[_0xfe1b('0x2')]},'dst':{'type':Sequelize[_0xfe1b('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfe1b('0x2')]},'dstchannel':{'type':Sequelize[_0xfe1b('0x2')]},'lastapp':{'type':Sequelize[_0xfe1b('0x2')]},'lastdata':{'type':Sequelize[_0xfe1b('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfe1b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfe1b('0x2')]},'amaflags':{'type':Sequelize[_0xfe1b('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xfe1b('0x2')]},'uniqueid':{'type':Sequelize[_0xfe1b('0x2')]},'linkedid':{'type':Sequelize[_0xfe1b('0x2')]},'sequence':{'type':Sequelize[_0xfe1b('0x2')]},'peeraccount':{'type':Sequelize[_0xfe1b('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xfe1b('0x2')]}}; \ No newline at end of file +var _0xa68c=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xa68c,0x187));var _0xca68=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa68c[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xca68('0x0'));module[_0xca68('0x1')]={'calldate':{'type':Sequelize[_0xca68('0x2')],'allowNull':![],'defaultValue':_0xca68('0x3')},'clid':{'type':Sequelize[_0xca68('0x4')]},'src':{'type':Sequelize[_0xca68('0x4')]},'dst':{'type':Sequelize[_0xca68('0x4')]},'dcontext':{'type':Sequelize[_0xca68('0x4')]},'channel':{'type':Sequelize[_0xca68('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xca68('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xca68('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xca68('0x4')]},'amaflags':{'type':Sequelize[_0xca68('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xca68('0x4')]},'userfield':{'type':Sequelize[_0xca68('0x4')]},'uniqueid':{'type':Sequelize[_0xca68('0x4')]},'linkedid':{'type':Sequelize[_0xca68('0x4')]},'sequence':{'type':Sequelize[_0xca68('0x4')]},'peeraccount':{'type':Sequelize[_0xca68('0x4')]},'type':{'type':Sequelize[_0xca68('0x4')]},'tag':{'type':Sequelize[_0xca68('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 98425b3..eb1c73b 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 _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Cdr'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5292,0xf7));var _0x2529=function(_0x114b54,_0x3ed9bb){_0x114b54=_0x114b54-0x0;var _0x21c37f=_0x5292[_0x114b54];return _0x21c37f;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['Cdr'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file +var _0x6aa7=['includeAll','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x6aa7,0x178));var _0x76aa=function(_0x2735f8,_0x1246dd){_0x2735f8=_0x2735f8-0x0;var _0x4935c9=_0x6aa7[_0x2735f8];return _0x4935c9;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b'));_0x365ff8[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x3fcb7f[_0x76aa('0x33')]);_0x365ff8[_0x76aa('0x35')]=_['intersection'](_0x365ff8[_0x76aa('0x32')],_0x365ff8[_0x76aa('0x33')]);_0x994550['attributes']=_[_0x76aa('0x36')](_0x365ff8['model'],qs[_0x76aa('0x37')](_0x3fcb7f['query'][_0x76aa('0x37')]));_0x994550['attributes']=_0x994550['attributes'][_0x76aa('0x38')]?_0x994550[_0x76aa('0x39')]:_0x365ff8[_0x76aa('0x32')];if(!_0x3fcb7f[_0x76aa('0x33')]['hasOwnProperty']('nolimit')){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x1f')]);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f[_0x76aa('0x33')]['offset']);}_0x994550['order']=qs[_0x76aa('0x3a')](_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x994550[_0x76aa('0x3b')]=qs['filters'](_[_0x76aa('0x3c')](_0x3fcb7f[_0x76aa('0x33')],_0x365ff8[_0x76aa('0x35')]),_0x1e90b9);if(_0x3fcb7f['query'][_0x76aa('0x3d')]){_0x994550[_0x76aa('0x3b')]=_[_0x76aa('0x3e')](_0x994550[_0x76aa('0x3b')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x982e62){if(_0x982e62[_0x76aa('0x31')]!==_0x76aa('0x3f')){var _0x283179={};_0x283179[_0x982e62['name']]={'$like':'%'+_0x3fcb7f[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x283179;}})});}_0x994550=_[_0x76aa('0x3e')]({},_0x994550,_0x3fcb7f[_0x76aa('0x40')]);var _0x64612e={'where':_0x994550[_0x76aa('0x3b')]};return db['Cdr']['count'](_0x64612e)[_0x76aa('0x27')](function(_0x262906){_0x2dec94[_0x76aa('0x1d')]=_0x262906;if(_0x3fcb7f[_0x76aa('0x33')]['includeAll']){_0x994550[_0x76aa('0x41')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x42')](_0x994550);})[_0x76aa('0x27')](function(_0x1138b5){_0x2dec94['rows']=_0x1138b5;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports[_0x76aa('0x43')]=function(_0x54b8fd,_0x496304){var _0x4f7f3a={'raw':!![],'where':{'id':_0x54b8fd['params']['id']}},_0x144f0a={};_0x144f0a['model']=_['keys'](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x144f0a[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x54b8fd[_0x76aa('0x33')]);_0x144f0a['filters']=_[_0x76aa('0x36')](_0x144f0a[_0x76aa('0x32')],_0x144f0a[_0x76aa('0x33')]);_0x4f7f3a[_0x76aa('0x39')]=_[_0x76aa('0x36')](_0x144f0a['model'],qs[_0x76aa('0x37')](_0x54b8fd[_0x76aa('0x33')]['fields']));_0x4f7f3a[_0x76aa('0x39')]=_0x4f7f3a['attributes'][_0x76aa('0x38')]?_0x4f7f3a[_0x76aa('0x39')]:_0x144f0a[_0x76aa('0x32')];if(_0x54b8fd[_0x76aa('0x33')][_0x76aa('0x44')]){_0x4f7f3a[_0x76aa('0x41')]=[{'all':!![]}];}_0x4f7f3a=_[_0x76aa('0x3e')]({},_0x4f7f3a,_0x54b8fd[_0x76aa('0x40')]);return db[_0x76aa('0x2e')][_0x76aa('0x45')](_0x4f7f3a)['then'](handleEntityNotFound(_0x496304,null))[_0x76aa('0x27')](respondWithResult(_0x496304,null))['catch'](handleError(_0x496304,null));};exports[_0x76aa('0x46')]=function(_0x3d3332,_0x5e95f5){return db[_0x76aa('0x2e')]['create'](_0x3d3332['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5e95f5,0xc9))['catch'](handleError(_0x5e95f5,null));};exports[_0x76aa('0x26')]=function(_0x302a0c,_0x4315b3){if(_0x302a0c[_0x76aa('0x47')]['id']){delete _0x302a0c[_0x76aa('0x47')]['id'];}return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x302a0c['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x27')](saveUpdates(_0x302a0c[_0x76aa('0x47')],null))[_0x76aa('0x27')](respondWithResult(_0x4315b3,null))[_0x76aa('0x48')](handleError(_0x4315b3,null));};exports[_0x76aa('0x28')]=function(_0x4c52d5,_0x95b7c5){return db[_0x76aa('0x2e')][_0x76aa('0x45')]({'where':{'id':_0x4c52d5['params']['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x95b7c5,null))['then'](removeEntity(_0x95b7c5,null))[_0x76aa('0x48')](handleError(_0x95b7c5,null));};exports['describe']=function(_0x339b0d,_0x4449c1){return db[_0x76aa('0x2e')][_0x76aa('0x49')]()[_0x76aa('0x27')](respondWithResult(_0x4449c1,null))[_0x76aa('0x48')](handleError(_0x4449c1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5a96f42..95ba111 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3eb755,_0x135c92){var _0x547f03=function(_0x552cf3){while(--_0x552cf3){_0x3eb755['push'](_0x3eb755['shift']());}};_0x547f03(++_0x135c92);}(_0x7a54,0x106));var _0x47a5=function(_0x4933d0,_0x23817d){_0x4933d0=_0x4933d0-0x0;var _0x47c52e=_0x7a54[_0x4933d0];return _0x47c52e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3c4f09,_0x3e6f72){var _0x162dba=function(_0x4e9545){while(--_0x4e9545){_0x3c4f09['push'](_0x3c4f09['shift']());}};_0x162dba(++_0x3e6f72);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index b926559..5adbb2a 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 _0x68e4=['stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xde0a73,_0x4aef8c){var _0x167c5b=function(_0x17e55b){while(--_0x17e55b){_0xde0a73['push'](_0xde0a73['shift']());}};_0x167c5b(++_0x4aef8c);}(_0x68e4,0x16d));var _0x468e=function(_0x33a414,_0x3df1ae){_0x33a414=_0x33a414-0x0;var _0x547b48=_0x68e4[_0x33a414];return _0x547b48;};'use strict';var _=require(_0x468e('0x0'));var util=require('util');var moment=require(_0x468e('0x1'));var BPromise=require(_0x468e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x468e('0x3'))['db'];var utils=require(_0x468e('0x4'));var logger=require('../../config/logger')(_0x468e('0x5'));var config=require(_0x468e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x468e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eb598,_0x588e2c,_0x35ffc5){return new BPromise(function(_0x5a6470,_0x1a93cd){return client[_0x468e('0x8')](_0x5eb598,_0x35ffc5)[_0x468e('0x9')](function(_0x42d1f5){logger[_0x468e('0xa')](_0x468e('0xb'),_0x588e2c,'request\x20sent');logger[_0x468e('0xc')](_0x468e('0xd'),_0x588e2c,_0x468e('0xe'),JSON[_0x468e('0xf')](_0x42d1f5));if(_0x42d1f5['error']){if(_0x42d1f5[_0x468e('0x10')]['code']===0x1f4){logger[_0x468e('0x10')](_0x468e('0xb'),_0x588e2c,_0x42d1f5[_0x468e('0x10')][_0x468e('0x11')]);return _0x1a93cd(_0x42d1f5[_0x468e('0x10')][_0x468e('0x11')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x588e2c,_0x42d1f5['error']['message']);return _0x5a6470(_0x42d1f5['error'][_0x468e('0x11')]);}else{logger[_0x468e('0xa')](_0x468e('0xb'),_0x588e2c,'request\x20sent');_0x5a6470(_0x42d1f5[_0x468e('0x12')]['message']);}})[_0x468e('0x13')](function(_0x2ebf88){logger['error'](_0x468e('0xb'),_0x588e2c,_0x2ebf88);_0x1a93cd(_0x2ebf88);});});} \ No newline at end of file +var _0x6227=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','bluebird'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x6227,0x1ca));var _0x7622=function(_0xe197b8,_0x4aa81d){_0xe197b8=_0xe197b8-0x0;var _0x463be6=_0x6227[_0xe197b8];return _0x463be6;};'use strict';var _=require(_0x7622('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7622('0x1'));var rs=require(_0x7622('0x2'));var fs=require('fs');var Redis=require(_0x7622('0x3'));var db=require(_0x7622('0x4'))['db'];var utils=require(_0x7622('0x5'));var logger=require(_0x7622('0x6'))(_0x7622('0x7'));var config=require(_0x7622('0x8'));var jayson=require(_0x7622('0x9'));var client=jayson[_0x7622('0xa')][_0x7622('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4be9d7,_0x388538,_0x224da0){return new BPromise(function(_0xec439,_0xdb5d8){return client[_0x7622('0xc')](_0x4be9d7,_0x224da0)[_0x7622('0xd')](function(_0xf9c6b5){logger[_0x7622('0xe')](_0x7622('0xf'),_0x388538,_0x7622('0x10'));logger['debug'](_0x7622('0x11'),_0x388538,_0x7622('0x10'),JSON['stringify'](_0xf9c6b5));if(_0xf9c6b5['error']){if(_0xf9c6b5['error'][_0x7622('0x12')]===0x1f4){logger[_0x7622('0x13')]('Cdr,\x20%s,\x20%s',_0x388538,_0xf9c6b5[_0x7622('0x13')][_0x7622('0x14')]);return _0xdb5d8(_0xf9c6b5['error'][_0x7622('0x14')]);}logger[_0x7622('0x13')]('Cdr,\x20%s,\x20%s',_0x388538,_0xf9c6b5[_0x7622('0x13')][_0x7622('0x14')]);return _0xec439(_0xf9c6b5['error'][_0x7622('0x14')]);}else{logger['info'](_0x7622('0xf'),_0x388538,'request\x20sent');_0xec439(_0xf9c6b5[_0x7622('0x15')]['message']);}})[_0x7622('0x16')](function(_0x4032b7){logger['error'](_0x7622('0xf'),_0x388538,_0x4032b7);_0xdb5d8(_0x4032b7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c4443ff..03696e8 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2e0cfd,_0x505a26){var _0x387a04=function(_0x295f8b){while(--_0x295f8b){_0x2e0cfd['push'](_0x2e0cfd['shift']());}};_0x387a04(++_0x505a26);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d07e1,_0x418799){_0x5d07e1=_0x5d07e1-0x0;var _0x21617f=_0xb10b[_0x5d07e1];return _0x21617f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x1b959e,_0x5b2d5f){var _0xa5ecea=function(_0x447b07){while(--_0x447b07){_0x1b959e['push'](_0x1b959e['shift']());}};_0xa5ecea(++_0x5b2d5f);}(_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 6296463..165f8c7 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 _0x66b9=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x66b9,0xe5));var _0x966b=function(_0x2b115d,_0x47fd38){_0x2b115d=_0x2b115d-0x0;var _0x38d65a=_0x66b9[_0x2b115d];return _0x38d65a;};'use strict';var Sequelize=require(_0x966b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x966b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x966b('0x2')],'allowNull':![],'defaultValue':_0x966b('0x3')},'appdata':{'type':Sequelize[_0x966b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x966b('0x5')}}; \ No newline at end of file +var _0x68cc=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x5b1996,_0x56c9f6){var _0x1c9778=function(_0x31f311){while(--_0x31f311){_0x5b1996['push'](_0x5b1996['shift']());}};_0x1c9778(++_0x56c9f6);}(_0x68cc,0x159));var _0xc68c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x68cc[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0xc68c('0x0')]={'priority':{'type':Sequelize[_0xc68c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc68c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc68c('0x3')]()},'description':{'type':Sequelize[_0xc68c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc68c('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c4d9856..17137cd 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 _0x4345=['rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','error','stack','name','show','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','find','then','catch','body','params','eml-format'];(function(_0x143339,_0x17ee42){var _0x3165ea=function(_0x26ccd7){while(--_0x26ccd7){_0x143339['push'](_0x143339['shift']());}};_0x3165ea(++_0x17ee42);}(_0x4345,0x77));var _0x5434=function(_0x2ddf82,_0x3892a8){_0x2ddf82=_0x2ddf82-0x0;var _0x2d2f1c=_0x4345[_0x2ddf82];return _0x2d2f1c;};'use strict';var emlformat=require(_0x5434('0x0'));var rimraf=require(_0x5434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5434('0x2'));var rp=require(_0x5434('0x3'));var moment=require(_0x5434('0x4'));var BPromise=require(_0x5434('0x5'));var Mustache=require('mustache');var util=require(_0x5434('0x6'));var path=require('path');var sox=require(_0x5434('0x7'));var csv=require(_0x5434('0x8'));var ejs=require(_0x5434('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5434('0xa'));var squel=require('squel');var crypto=require(_0x5434('0xb'));var jsforce=require(_0x5434('0xc'));var deskjs=require(_0x5434('0xd'));var toCsv=require(_0x5434('0x8'));var querystring=require(_0x5434('0xe'));var Papa=require(_0x5434('0xf'));var Redis=require(_0x5434('0x10'));var authService=require(_0x5434('0x11'));var qs=require(_0x5434('0x12'));var as=require(_0x5434('0x13'));var hardwareService=require(_0x5434('0x14'));var logger=require(_0x5434('0x15'))(_0x5434('0x16'));var utils=require(_0x5434('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5434('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a2d9,_0xf27177){_0xf27177=_0xf27177||0xcc;return function(_0x13a13f){if(_0x13a13f){return _0x36a2d9[_0x5434('0x19')](_0xf27177);}return _0x36a2d9['status'](_0xf27177)[_0x5434('0x1a')]();};}function respondWithResult(_0x223766,_0x5aa606){_0x5aa606=_0x5aa606||0xc8;return function(_0x44ea26){if(_0x44ea26){return _0x223766[_0x5434('0x1b')](_0x5aa606)[_0x5434('0x1c')](_0x44ea26);}};}function respondWithFilteredResult(_0x1a7a2c,_0x48be48){return function(_0x2b88c4){if(_0x2b88c4){var _0x437664=typeof _0x48be48['offset']===_0x5434('0x1d')&&typeof _0x48be48['limit']===_0x5434('0x1d');var _0x42a118=_0x2b88c4[_0x5434('0x1e')];var _0x148b3c=_0x437664?0x0:_0x48be48[_0x5434('0x1f')];var _0x2d60be=_0x437664?_0x2b88c4[_0x5434('0x1e')]:_0x48be48['offset']+_0x48be48[_0x5434('0x20')];var _0x5a4570;if(_0x2d60be>=_0x42a118){_0x2d60be=_0x42a118;_0x5a4570=0xc8;}else{_0x5a4570=0xce;}_0x1a7a2c[_0x5434('0x1b')](_0x5a4570);return _0x1a7a2c['set'](_0x5434('0x21'),_0x148b3c+'-'+_0x2d60be+'/'+_0x42a118)[_0x5434('0x1c')](_0x2b88c4);}return null;};}function patchUpdates(_0x240787){return function(_0x4d34d6){try{jsonpatch[_0x5434('0x22')](_0x4d34d6,_0x240787,!![]);}catch(_0x2513e9){return BPromise[_0x5434('0x23')](_0x2513e9);}return _0x4d34d6[_0x5434('0x24')]();};}function saveUpdates(_0x1da16d,_0x5c43ef){return function(_0x5e92d0){if(_0x5e92d0){return _0x5e92d0[_0x5434('0x25')](_0x1da16d)['then'](function(_0x4524f9){return _0x4524f9;});}return null;};}function removeEntity(_0x85a5a1,_0x464093){return function(_0xd83da2){if(_0xd83da2){return _0xd83da2['destroy']()['then'](function(){_0x85a5a1[_0x5434('0x1b')](0xcc)[_0x5434('0x1a')]();});}};}function handleEntityNotFound(_0x27ea93,_0x417dc1){return function(_0x2c8fb1){if(!_0x2c8fb1){_0x27ea93[_0x5434('0x19')](0x194);}return _0x2c8fb1;};}function handleError(_0xaa9184,_0xa0f1b2){_0xa0f1b2=_0xa0f1b2||0x1f4;return function(_0x1b827f){logger[_0x5434('0x26')](_0x1b827f[_0x5434('0x27')]);if(_0x1b827f[_0x5434('0x28')]){delete _0x1b827f['name'];}_0xaa9184['status'](_0xa0f1b2)['send'](_0x1b827f);};}exports[_0x5434('0x29')]=function(_0x124371,_0x4189f9){var _0x1330ff={'raw':!![],'where':{'id':_0x124371['params']['id']}},_0x4598bd={};_0x4598bd[_0x5434('0x2a')]=_[_0x5434('0x2b')](db['ChatApplication'][_0x5434('0x2c')]);_0x4598bd[_0x5434('0x2d')]=_['keys'](_0x124371['query']);_0x4598bd['filters']=_[_0x5434('0x2e')](_0x4598bd[_0x5434('0x2a')],_0x4598bd[_0x5434('0x2d')]);_0x1330ff[_0x5434('0x2f')]=_[_0x5434('0x2e')](_0x4598bd[_0x5434('0x2a')],qs['fields'](_0x124371[_0x5434('0x2d')][_0x5434('0x30')]));_0x1330ff[_0x5434('0x2f')]=_0x1330ff[_0x5434('0x2f')][_0x5434('0x31')]?_0x1330ff[_0x5434('0x2f')]:_0x4598bd[_0x5434('0x2a')];if(_0x124371['query'][_0x5434('0x32')]){_0x1330ff[_0x5434('0x33')]=[{'all':!![]}];}_0x1330ff=_[_0x5434('0x34')]({},_0x1330ff,_0x124371[_0x5434('0x35')]);return db[_0x5434('0x36')][_0x5434('0x37')](_0x1330ff)['then'](handleEntityNotFound(_0x4189f9,null))[_0x5434('0x38')](respondWithResult(_0x4189f9,null))[_0x5434('0x39')](handleError(_0x4189f9,null));};exports[_0x5434('0x25')]=function(_0x168db5,_0x24f907){if(_0x168db5[_0x5434('0x3a')]['id']){delete _0x168db5[_0x5434('0x3a')]['id'];}return db[_0x5434('0x36')][_0x5434('0x37')]({'where':{'id':_0x168db5[_0x5434('0x3b')]['id']}})['then'](handleEntityNotFound(_0x24f907,null))[_0x5434('0x38')](saveUpdates(_0x168db5[_0x5434('0x3a')],null))[_0x5434('0x38')](respondWithResult(_0x24f907,null))[_0x5434('0x39')](handleError(_0x24f907,null));};exports['destroy']=function(_0x243163,_0x1fe399){return db['ChatApplication']['find']({'where':{'id':_0x243163[_0x5434('0x3b')]['id']}})[_0x5434('0x38')](handleEntityNotFound(_0x1fe399,null))['then'](removeEntity(_0x1fe399,null))[_0x5434('0x39')](handleError(_0x1fe399,null));}; \ No newline at end of file +var _0xfa68=['intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','show','params','ChatApplication','rawAttributes','query','keys','filters'];(function(_0x5d16fb,_0x4fcc7a){var _0x8b5e9d=function(_0x224374){while(--_0x224374){_0x5d16fb['push'](_0x5d16fb['shift']());}};_0x8b5e9d(++_0x4fcc7a);}(_0xfa68,0x86));var _0x8fa6=function(_0x32ddeb,_0x1827d1){_0x32ddeb=_0x32ddeb-0x0;var _0x4132dd=_0xfa68[_0x32ddeb];return _0x4132dd;};'use strict';var emlformat=require(_0x8fa6('0x0'));var rimraf=require(_0x8fa6('0x1'));var zipdir=require(_0x8fa6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fa6('0x3'));var moment=require(_0x8fa6('0x4'));var BPromise=require(_0x8fa6('0x5'));var Mustache=require('mustache');var util=require(_0x8fa6('0x6'));var path=require(_0x8fa6('0x7'));var sox=require(_0x8fa6('0x8'));var csv=require(_0x8fa6('0x9'));var ejs=require(_0x8fa6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fa6('0xb'));var squel=require(_0x8fa6('0xc'));var crypto=require('crypto');var jsforce=require(_0x8fa6('0xd'));var deskjs=require(_0x8fa6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8fa6('0xf'));var Redis=require(_0x8fa6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8fa6('0x11'));var as=require(_0x8fa6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fa6('0x13'));var utils=require(_0x8fa6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8fa6('0x15'));var db=require(_0x8fa6('0x16'))['db'];function respondWithStatusCode(_0x59b7f9,_0x1ed90e){_0x1ed90e=_0x1ed90e||0xcc;return function(_0x1c621f){if(_0x1c621f){return _0x59b7f9['sendStatus'](_0x1ed90e);}return _0x59b7f9[_0x8fa6('0x17')](_0x1ed90e)[_0x8fa6('0x18')]();};}function respondWithResult(_0x22d83f,_0x86f607){_0x86f607=_0x86f607||0xc8;return function(_0xd2cce0){if(_0xd2cce0){return _0x22d83f['status'](_0x86f607)['json'](_0xd2cce0);}};}function respondWithFilteredResult(_0x3426a7,_0x5eff0e){return function(_0x1425a7){if(_0x1425a7){var _0x22bb50=typeof _0x5eff0e[_0x8fa6('0x19')]==='undefined'&&typeof _0x5eff0e[_0x8fa6('0x1a')]===_0x8fa6('0x1b');var _0x300f68=_0x1425a7['count'];var _0x329f97=_0x22bb50?0x0:_0x5eff0e[_0x8fa6('0x19')];var _0x8de44e=_0x22bb50?_0x1425a7[_0x8fa6('0x1c')]:_0x5eff0e['offset']+_0x5eff0e[_0x8fa6('0x1a')];var _0x516d42;if(_0x8de44e>=_0x300f68){_0x8de44e=_0x300f68;_0x516d42=0xc8;}else{_0x516d42=0xce;}_0x3426a7[_0x8fa6('0x17')](_0x516d42);return _0x3426a7[_0x8fa6('0x1d')](_0x8fa6('0x1e'),_0x329f97+'-'+_0x8de44e+'/'+_0x300f68)[_0x8fa6('0x1f')](_0x1425a7);}return null;};}function patchUpdates(_0x50e633){return function(_0x3072f7){try{jsonpatch[_0x8fa6('0x20')](_0x3072f7,_0x50e633,!![]);}catch(_0x5b6acb){return BPromise[_0x8fa6('0x21')](_0x5b6acb);}return _0x3072f7[_0x8fa6('0x22')]();};}function saveUpdates(_0x29d361,_0x50f8d2){return function(_0x149ace){if(_0x149ace){return _0x149ace[_0x8fa6('0x23')](_0x29d361)[_0x8fa6('0x24')](function(_0x49225a){return _0x49225a;});}return null;};}function removeEntity(_0x59f0b6,_0x588001){return function(_0x283805){if(_0x283805){return _0x283805[_0x8fa6('0x25')]()['then'](function(){_0x59f0b6['status'](0xcc)[_0x8fa6('0x18')]();});}};}function handleEntityNotFound(_0x3f86d8,_0x5775b7){return function(_0x57db95){if(!_0x57db95){_0x3f86d8[_0x8fa6('0x26')](0x194);}return _0x57db95;};}function handleError(_0x1914bc,_0x424546){_0x424546=_0x424546||0x1f4;return function(_0x4efd81){logger[_0x8fa6('0x27')](_0x4efd81[_0x8fa6('0x28')]);if(_0x4efd81['name']){delete _0x4efd81[_0x8fa6('0x29')];}_0x1914bc[_0x8fa6('0x17')](_0x424546)['send'](_0x4efd81);};}exports[_0x8fa6('0x2a')]=function(_0x39cf7c,_0x4cdbdb){var _0x5e1a88={'raw':!![],'where':{'id':_0x39cf7c[_0x8fa6('0x2b')]['id']}},_0x23fdc9={};_0x23fdc9['model']=_['keys'](db[_0x8fa6('0x2c')][_0x8fa6('0x2d')]);_0x23fdc9[_0x8fa6('0x2e')]=_[_0x8fa6('0x2f')](_0x39cf7c[_0x8fa6('0x2e')]);_0x23fdc9[_0x8fa6('0x30')]=_[_0x8fa6('0x31')](_0x23fdc9[_0x8fa6('0x32')],_0x23fdc9['query']);_0x5e1a88['attributes']=_[_0x8fa6('0x31')](_0x23fdc9['model'],qs[_0x8fa6('0x33')](_0x39cf7c[_0x8fa6('0x2e')][_0x8fa6('0x33')]));_0x5e1a88['attributes']=_0x5e1a88[_0x8fa6('0x34')][_0x8fa6('0x35')]?_0x5e1a88['attributes']:_0x23fdc9[_0x8fa6('0x32')];if(_0x39cf7c[_0x8fa6('0x2e')][_0x8fa6('0x36')]){_0x5e1a88[_0x8fa6('0x37')]=[{'all':!![]}];}_0x5e1a88=_[_0x8fa6('0x38')]({},_0x5e1a88,_0x39cf7c[_0x8fa6('0x39')]);return db[_0x8fa6('0x2c')][_0x8fa6('0x3a')](_0x5e1a88)[_0x8fa6('0x24')](handleEntityNotFound(_0x4cdbdb,null))[_0x8fa6('0x24')](respondWithResult(_0x4cdbdb,null))[_0x8fa6('0x3b')](handleError(_0x4cdbdb,null));};exports[_0x8fa6('0x23')]=function(_0x4f86ae,_0x309d0c){if(_0x4f86ae[_0x8fa6('0x3c')]['id']){delete _0x4f86ae[_0x8fa6('0x3c')]['id'];}return db[_0x8fa6('0x2c')][_0x8fa6('0x3a')]({'where':{'id':_0x4f86ae[_0x8fa6('0x2b')]['id']}})[_0x8fa6('0x24')](handleEntityNotFound(_0x309d0c,null))['then'](saveUpdates(_0x4f86ae['body'],null))[_0x8fa6('0x24')](respondWithResult(_0x309d0c,null))['catch'](handleError(_0x309d0c,null));};exports['destroy']=function(_0x5b2d34,_0x5087d3){return db['ChatApplication']['find']({'where':{'id':_0x5b2d34[_0x8fa6('0x2b')]['id']}})[_0x8fa6('0x24')](handleEntityNotFound(_0x5087d3,null))[_0x8fa6('0x24')](removeEntity(_0x5087d3,null))['catch'](handleError(_0x5087d3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 65c2863..dfccf2d 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 _0xa3d1=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3af54a,_0x2f617d){var _0x220130=function(_0x527465){while(--_0x527465){_0x3af54a['push'](_0x3af54a['shift']());}};_0x220130(++_0x2f617d);}(_0xa3d1,0x126));var _0x1a3d=function(_0x3a12f5,_0x612f29){_0x3a12f5=_0x3a12f5-0x0;var _0x42e50d=_0xa3d1[_0x3a12f5];return _0x42e50d;};'use strict';var _=require(_0x1a3d('0x0'));var util=require(_0x1a3d('0x1'));var logger=require(_0x1a3d('0x2'))('api');var moment=require(_0x1a3d('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a3d('0x4'));var fs=require('fs');var path=require(_0x1a3d('0x5'));var rimraf=require(_0x1a3d('0x6'));var config=require(_0x1a3d('0x7'));var attributes=require(_0x1a3d('0x8'));module[_0x1a3d('0x9')]=function(_0x3a4a57,_0x144a93){return _0x3a4a57['define'](_0x1a3d('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a3d('0xb'),'collate':_0x1a3d('0xc')});}; \ No newline at end of file +var _0x1799=['moment','bluebird','request-promise','rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x7490e3,_0x31bcce){var _0x1089f6=function(_0x715d6c){while(--_0x715d6c){_0x7490e3['push'](_0x7490e3['shift']());}};_0x1089f6(++_0x31bcce);}(_0x1799,0x19d));var _0x9179=function(_0x4dd9fb,_0x25227d){_0x4dd9fb=_0x4dd9fb-0x0;var _0xdbc6fc=_0x1799[_0x4dd9fb];return _0xdbc6fc;};'use strict';var _=require(_0x9179('0x0'));var util=require('util');var logger=require(_0x9179('0x1'))(_0x9179('0x2'));var moment=require(_0x9179('0x3'));var BPromise=require(_0x9179('0x4'));var rp=require(_0x9179('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9179('0x6'));var config=require('../../config/environment');var attributes=require(_0x9179('0x7'));module[_0x9179('0x8')]=function(_0x551e91,_0x141ccb){return _0x551e91[_0x9179('0x9')](_0x9179('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9179('0xb'),'collate':_0x9179('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 46d405d..ec525a3 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 _0xcc1d=['request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','rpc','../../config/environment','http','request','then','ChatApplication,\x20%s,\x20%s'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xcc1d,0xba));var _0xdcc1=function(_0x18738e,_0x1e6900){_0x18738e=_0x18738e-0x0;var _0x5809b7=_0xcc1d[_0x18738e];return _0x5809b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdcc1('0x0'));var BPromise=require(_0xdcc1('0x1'));var rs=require(_0xdcc1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcc1('0x3'));var config=require(_0xdcc1('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdcc1('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x298f3e,_0x9f0bd0,_0x3af621){return new BPromise(function(_0x2ddbe1,_0x980b6c){return client[_0xdcc1('0x6')](_0x298f3e,_0x3af621)[_0xdcc1('0x7')](function(_0x3cb63a){logger['info'](_0xdcc1('0x8'),_0x9f0bd0,_0xdcc1('0x9'));logger['debug'](_0xdcc1('0xa'),_0x9f0bd0,'request\x20sent',JSON['stringify'](_0x3cb63a));if(_0x3cb63a[_0xdcc1('0xb')]){if(_0x3cb63a[_0xdcc1('0xb')][_0xdcc1('0xc')]===0x1f4){logger[_0xdcc1('0xb')](_0xdcc1('0x8'),_0x9f0bd0,_0x3cb63a[_0xdcc1('0xb')][_0xdcc1('0xd')]);return _0x980b6c(_0x3cb63a['error'][_0xdcc1('0xd')]);}logger[_0xdcc1('0xb')](_0xdcc1('0x8'),_0x9f0bd0,_0x3cb63a[_0xdcc1('0xb')]['message']);return _0x2ddbe1(_0x3cb63a[_0xdcc1('0xb')]['message']);}else{logger['info'](_0xdcc1('0x8'),_0x9f0bd0,_0xdcc1('0x9'));_0x2ddbe1(_0x3cb63a['result']['message']);}})[_0xdcc1('0xe')](function(_0x1f8b76){logger['error']('ChatApplication,\x20%s,\x20%s',_0x9f0bd0,_0x1f8b76);_0x980b6c(_0x1f8b76);});});} \ No newline at end of file +var _0x3707=['../../config/environment','client','http','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x3707,0x146));var _0x7370=function(_0xba53fe,_0x33a4ad){_0xba53fe=_0xba53fe-0x0;var _0x4c3a9f=_0x3707[_0xba53fe];return _0x4c3a9f;};'use strict';var _=require(_0x7370('0x0'));var util=require(_0x7370('0x1'));var moment=require(_0x7370('0x2'));var BPromise=require(_0x7370('0x3'));var rs=require(_0x7370('0x4'));var fs=require('fs');var Redis=require(_0x7370('0x5'));var db=require(_0x7370('0x6'))['db'];var utils=require(_0x7370('0x7'));var logger=require(_0x7370('0x8'))(_0x7370('0x9'));var config=require(_0x7370('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7370('0xb')][_0x7370('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b359a,_0x251a11,_0x6709e6){return new BPromise(function(_0x2275f1,_0x1c3ccf){return client['request'](_0x1b359a,_0x6709e6)[_0x7370('0xd')](function(_0x3195fe){logger[_0x7370('0xe')]('ChatApplication,\x20%s,\x20%s',_0x251a11,_0x7370('0xf'));logger['debug'](_0x7370('0x10'),_0x251a11,_0x7370('0xf'),JSON[_0x7370('0x11')](_0x3195fe));if(_0x3195fe[_0x7370('0x12')]){if(_0x3195fe['error'][_0x7370('0x13')]===0x1f4){logger[_0x7370('0x12')](_0x7370('0x14'),_0x251a11,_0x3195fe[_0x7370('0x12')][_0x7370('0x15')]);return _0x1c3ccf(_0x3195fe[_0x7370('0x12')]['message']);}logger[_0x7370('0x12')](_0x7370('0x14'),_0x251a11,_0x3195fe['error'][_0x7370('0x15')]);return _0x2275f1(_0x3195fe[_0x7370('0x12')][_0x7370('0x15')]);}else{logger[_0x7370('0xe')](_0x7370('0x14'),_0x251a11,_0x7370('0xf'));_0x2275f1(_0x3195fe[_0x7370('0x16')][_0x7370('0x15')]);}})[_0x7370('0x17')](function(_0x25d575){logger[_0x7370('0x12')]('ChatApplication,\x20%s,\x20%s',_0x251a11,_0x25d575);_0x1c3ccf(_0x25d575);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 712f665..d4cbe95 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 _0x0612=['../../components/interaction/service','./chatApplication.controller','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x0612,0x162));var _0x2061=function(_0x1f4c4a,_0x1de401){_0x1f4c4a=_0x1f4c4a-0x0;var _0x4ca1ef=_0x0612[_0x1f4c4a];return _0x4ca1ef;};'use strict';var multer=require(_0x2061('0x0'));var util=require(_0x2061('0x1'));var path=require('path');var timeout=require(_0x2061('0x2'));var express=require('express');var router=express[_0x2061('0x3')]();var fs_extra=require(_0x2061('0x4'));var auth=require(_0x2061('0x5'));var interaction=require(_0x2061('0x6'));var config=require('../../config/environment');var controller=require(_0x2061('0x7'));router['get'](_0x2061('0x8'),auth['isAuthenticated'](),controller[_0x2061('0x9')]);router[_0x2061('0xa')](_0x2061('0x8'),auth[_0x2061('0xb')](),controller[_0x2061('0xc')]);router['delete'](_0x2061('0x8'),auth[_0x2061('0xb')](),controller[_0x2061('0xd')]);module[_0x2061('0xe')]=router; \ No newline at end of file +var _0x4301=['show','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated'];(function(_0x4b1d33,_0x122640){var _0x53d6e9=function(_0x385ac0){while(--_0x385ac0){_0x4b1d33['push'](_0x4b1d33['shift']());}};_0x53d6e9(++_0x122640);}(_0x4301,0x1d6));var _0x1430=function(_0x3b40c6,_0x168b08){_0x3b40c6=_0x3b40c6-0x0;var _0x5b324c=_0x4301[_0x3b40c6];return _0x5b324c;};'use strict';var multer=require(_0x1430('0x0'));var util=require(_0x1430('0x1'));var path=require(_0x1430('0x2'));var timeout=require('connect-timeout');var express=require(_0x1430('0x3'));var router=express[_0x1430('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1430('0x5'));var interaction=require(_0x1430('0x6'));var config=require('../../config/environment');var controller=require(_0x1430('0x7'));router['get'](_0x1430('0x8'),auth[_0x1430('0x9')](),controller[_0x1430('0xa')]);router[_0x1430('0xb')](_0x1430('0x8'),auth[_0x1430('0x9')](),controller['update']);router[_0x1430('0xc')]('/:id',auth[_0x1430('0x9')](),controller[_0x1430('0xd')]);module[_0x1430('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3e8c0df..1193372 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 _0x89a1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1189aa,_0x19c03a){var _0x95a2ab=function(_0x115330){while(--_0x115330){_0x1189aa['push'](_0x1189aa['shift']());}};_0x95a2ab(++_0x19c03a);}(_0x89a1,0x1db));var _0x189a=function(_0x512652,_0x5ab9f4){_0x512652=_0x512652-0x0;var _0x6ab93a=_0x89a1[_0x512652];return _0x6ab93a;};'use strict';var Sequelize=require(_0x189a('0x0'));module[_0x189a('0x1')]={'name':{'type':Sequelize[_0x189a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x189a('0x2')]},'write':{'type':Sequelize[_0x189a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1bec=['STRING','BOOLEAN'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x1bec,0x168));var _0xc1be=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x1bec[_0x12fcbd];return _0x28ec2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc1be('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc1be('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cb1acea..1479c8d 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 _0x91df=['query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','length','nolimit','removeMembers','ChatGroupId','getMessages','keys','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','destroy','name','send','map','rawAttributes','fieldName','key','model'];(function(_0x5dda62,_0x493273){var _0x311c30=function(_0x3a718e){while(--_0x3a718e){_0x5dda62['push'](_0x5dda62['shift']());}};_0x311c30(++_0x493273);}(_0x91df,0xe7));var _0xf91d=function(_0x14f3e5,_0x493260){_0x14f3e5=_0x14f3e5-0x0;var _0x44b556=_0x91df[_0x14f3e5];return _0x44b556;};'use strict';var emlformat=require(_0xf91d('0x0'));var rimraf=require(_0xf91d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf91d('0x2'));var rp=require(_0xf91d('0x3'));var moment=require(_0xf91d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf91d('0x5'));var util=require(_0xf91d('0x6'));var path=require(_0xf91d('0x7'));var sox=require(_0xf91d('0x8'));var csv=require(_0xf91d('0x9'));var ejs=require(_0xf91d('0xa'));var fs=require('fs');var fs_extra=require(_0xf91d('0xb'));var _=require(_0xf91d('0xc'));var squel=require(_0xf91d('0xd'));var crypto=require(_0xf91d('0xe'));var jsforce=require(_0xf91d('0xf'));var deskjs=require(_0xf91d('0x10'));var toCsv=require(_0xf91d('0x9'));var querystring=require(_0xf91d('0x11'));var Papa=require(_0xf91d('0x12'));var Redis=require('ioredis');var authService=require(_0xf91d('0x13'));var qs=require(_0xf91d('0x14'));var as=require(_0xf91d('0x15'));var hardwareService=require(_0xf91d('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf91d('0x17'));var licenseUtil=require(_0xf91d('0x18'));var db=require('../../mysqldb')['db'];config[_0xf91d('0x19')]=_['defaults'](config[_0xf91d('0x19')],{'host':_0xf91d('0x1a'),'port':0x18eb});var socket=require(_0xf91d('0x1b'))(new Redis(config[_0xf91d('0x19')]));require(_0xf91d('0x1c'))['register'](socket);function respondWithStatusCode(_0x15dc95,_0x5cf7ba){_0x5cf7ba=_0x5cf7ba||0xcc;return function(_0x24de90){if(_0x24de90){return _0x15dc95[_0xf91d('0x1d')](_0x5cf7ba);}return _0x15dc95[_0xf91d('0x1e')](_0x5cf7ba)[_0xf91d('0x1f')]();};}function respondWithResult(_0x176931,_0x1196e1){_0x1196e1=_0x1196e1||0xc8;return function(_0x5ed682){if(_0x5ed682){return _0x176931['status'](_0x1196e1)[_0xf91d('0x20')](_0x5ed682);}};}function respondWithFilteredResult(_0x15cae9,_0x4f273e){return function(_0x170bac){if(_0x170bac){var _0x46ae7d=typeof _0x4f273e[_0xf91d('0x21')]==='undefined'&&typeof _0x4f273e[_0xf91d('0x22')]===_0xf91d('0x23');var _0x1c6d81=_0x170bac['count'];var _0x4e358c=_0x46ae7d?0x0:_0x4f273e[_0xf91d('0x21')];var _0x227c67=_0x46ae7d?_0x170bac[_0xf91d('0x24')]:_0x4f273e[_0xf91d('0x21')]+_0x4f273e[_0xf91d('0x22')];var _0x201ec9;if(_0x227c67>=_0x1c6d81){_0x227c67=_0x1c6d81;_0x201ec9=0xc8;}else{_0x201ec9=0xce;}_0x15cae9[_0xf91d('0x1e')](_0x201ec9);return _0x15cae9[_0xf91d('0x25')]('Content-Range',_0x4e358c+'-'+_0x227c67+'/'+_0x1c6d81)[_0xf91d('0x20')](_0x170bac);}return null;};}function patchUpdates(_0x41e934){return function(_0x13db5){try{jsonpatch['apply'](_0x13db5,_0x41e934,!![]);}catch(_0x2212c4){return BPromise['reject'](_0x2212c4);}return _0x13db5['save']();};}function saveUpdates(_0x2ca9a7,_0x4291e3){return function(_0x75dc7e){if(_0x75dc7e){return _0x75dc7e[_0xf91d('0x26')](_0x2ca9a7)[_0xf91d('0x27')](function(_0x58394c){return _0x58394c;});}return null;};}function removeEntity(_0x1bbde2,_0x671ed6){return function(_0x99e8ae){if(_0x99e8ae){return _0x99e8ae[_0xf91d('0x28')]()[_0xf91d('0x27')](function(){_0x1bbde2['status'](0xcc)[_0xf91d('0x1f')]();});}};}function handleEntityNotFound(_0x21225f,_0x48f49a){return function(_0x4d5ed5){if(!_0x4d5ed5){_0x21225f[_0xf91d('0x1d')](0x194);}return _0x4d5ed5;};}function handleError(_0x124af7,_0x1e8dda){_0x1e8dda=_0x1e8dda||0x1f4;return function(_0x562c89){logger['error'](_0x562c89['stack']);if(_0x562c89['name']){delete _0x562c89[_0xf91d('0x29')];}_0x124af7[_0xf91d('0x1e')](_0x1e8dda)[_0xf91d('0x2a')](_0x562c89);};}exports['index']=function(_0x302fe6,_0x50f7bb){var _0x1a3f57={},_0x185629={},_0x4f278e={'count':0x0,'rows':[]};var _0x23afe6=_[_0xf91d('0x2b')](db['ChatGroup'][_0xf91d('0x2c')],function(_0x245556){return{'name':_0x245556[_0xf91d('0x2d')],'type':_0x245556['type'][_0xf91d('0x2e')]};});_0x185629[_0xf91d('0x2f')]=_[_0xf91d('0x2b')](_0x23afe6,_0xf91d('0x29'));_0x185629[_0xf91d('0x30')]=_['keys'](_0x302fe6[_0xf91d('0x30')]);_0x185629[_0xf91d('0x31')]=_[_0xf91d('0x32')](_0x185629[_0xf91d('0x2f')],_0x185629[_0xf91d('0x30')]);_0x1a3f57['attributes']=_[_0xf91d('0x32')](_0x185629['model'],qs['fields'](_0x302fe6[_0xf91d('0x30')]['fields']));_0x1a3f57[_0xf91d('0x33')]=_0x1a3f57['attributes']['length']?_0x1a3f57[_0xf91d('0x33')]:_0x185629[_0xf91d('0x2f')];if(!_0x302fe6['query'][_0xf91d('0x34')]('nolimit')){_0x1a3f57['limit']=qs[_0xf91d('0x22')](_0x302fe6[_0xf91d('0x30')][_0xf91d('0x22')]);_0x1a3f57[_0xf91d('0x21')]=qs[_0xf91d('0x21')](_0x302fe6[_0xf91d('0x30')][_0xf91d('0x21')]);}_0x1a3f57[_0xf91d('0x35')]=qs[_0xf91d('0x36')](_0x302fe6[_0xf91d('0x30')][_0xf91d('0x36')]);_0x1a3f57[_0xf91d('0x37')]=qs['filters'](_[_0xf91d('0x38')](_0x302fe6[_0xf91d('0x30')],_0x185629[_0xf91d('0x31')]),_0x23afe6);if(_0x302fe6[_0xf91d('0x30')][_0xf91d('0x39')]){_0x1a3f57[_0xf91d('0x37')]=_[_0xf91d('0x3a')](_0x1a3f57[_0xf91d('0x37')],{'$or':_['map'](_0x23afe6,function(_0x4343a5){if(_0x4343a5[_0xf91d('0x3b')]!==_0xf91d('0x3c')){var _0x4a92e2={};_0x4a92e2[_0x4343a5['name']]={'$like':'%'+_0x302fe6[_0xf91d('0x30')][_0xf91d('0x39')]+'%'};return _0x4a92e2;}})});}_0x1a3f57=_['merge']({},_0x1a3f57,_0x302fe6[_0xf91d('0x3d')]);var _0x4a0173={'where':_0x1a3f57['where']};return db[_0xf91d('0x3e')][_0xf91d('0x24')](_0x4a0173)[_0xf91d('0x27')](function(_0x212df3){_0x4f278e[_0xf91d('0x24')]=_0x212df3;if(_0x302fe6[_0xf91d('0x30')][_0xf91d('0x3f')]){_0x1a3f57[_0xf91d('0x40')]=[{'all':!![]}];}return db[_0xf91d('0x3e')][_0xf91d('0x41')](_0x1a3f57);})['then'](function(_0x5b5eeb){_0x4f278e[_0xf91d('0x42')]=_0x5b5eeb;return _0x4f278e;})[_0xf91d('0x27')](respondWithFilteredResult(_0x50f7bb,_0x1a3f57))[_0xf91d('0x43')](handleError(_0x50f7bb,null));};exports[_0xf91d('0x44')]=function(_0x2de8fb,_0x40384d){var _0x471ade={'raw':!![],'where':{'id':_0x2de8fb[_0xf91d('0x45')]['id']}},_0x2dc947={};_0x2dc947[_0xf91d('0x2f')]=_['keys'](db['ChatGroup'][_0xf91d('0x2c')]);_0x2dc947[_0xf91d('0x30')]=_['keys'](_0x2de8fb['query']);_0x2dc947['filters']=_['intersection'](_0x2dc947[_0xf91d('0x2f')],_0x2dc947['query']);_0x471ade[_0xf91d('0x33')]=_[_0xf91d('0x32')](_0x2dc947['model'],qs[_0xf91d('0x46')](_0x2de8fb[_0xf91d('0x30')]['fields']));_0x471ade[_0xf91d('0x33')]=_0x471ade[_0xf91d('0x33')]['length']?_0x471ade['attributes']:_0x2dc947['model'];if(_0x2de8fb[_0xf91d('0x30')]['includeAll']){_0x471ade['include']=[{'all':!![]}];}_0x471ade=_[_0xf91d('0x3a')]({},_0x471ade,_0x2de8fb[_0xf91d('0x3d')]);return db[_0xf91d('0x3e')][_0xf91d('0x47')](_0x471ade)[_0xf91d('0x27')](handleEntityNotFound(_0x40384d,null))[_0xf91d('0x27')](respondWithResult(_0x40384d,null))[_0xf91d('0x43')](handleError(_0x40384d,null));};exports['create']=function(_0x1161a4,_0x14f3ee){return db[_0xf91d('0x3e')][_0xf91d('0x48')](_0x1161a4['body'],{})[_0xf91d('0x27')](respondWithResult(_0x14f3ee,0xc9))['catch'](handleError(_0x14f3ee,null));};exports[_0xf91d('0x26')]=function(_0xdd8dfa,_0x1e930f){if(_0xdd8dfa[_0xf91d('0x49')]['id']){delete _0xdd8dfa['body']['id'];}return db[_0xf91d('0x3e')]['find']({'where':{'id':_0xdd8dfa['params']['id']}})[_0xf91d('0x27')](handleEntityNotFound(_0x1e930f,null))[_0xf91d('0x27')](saveUpdates(_0xdd8dfa[_0xf91d('0x49')],null))[_0xf91d('0x27')](respondWithResult(_0x1e930f,null))[_0xf91d('0x43')](handleError(_0x1e930f,null));};exports['destroy']=function(_0x1ebb1c,_0x2fc0cf){return db[_0xf91d('0x3e')][_0xf91d('0x47')]({'where':{'id':_0x1ebb1c[_0xf91d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fc0cf,null))[_0xf91d('0x27')](removeEntity(_0x2fc0cf,null))[_0xf91d('0x43')](handleError(_0x2fc0cf,null));};exports[_0xf91d('0x4a')]=function(_0x5a7bb3,_0x340524){return db[_0xf91d('0x3e')][_0xf91d('0x4a')]()['then'](respondWithResult(_0x340524,null))[_0xf91d('0x43')](handleError(_0x340524,null));};exports[_0xf91d('0x4b')]=function(_0x4b1372,_0x174c5b,_0x2c8075){return db[_0xf91d('0x4c')][_0xf91d('0x24')]({'where':{'ChatGroupId':_0x4b1372[_0xf91d('0x45')]['id'],'ToId':_0x4b1372[_0xf91d('0x4d')]['id'],'read':![]}})[_0xf91d('0x27')](function(_0x1abcc7){return{'id':_['toInteger'](_0x4b1372[_0xf91d('0x45')]['id']),'count':_0x1abcc7};})[_0xf91d('0x27')](respondWithResult(_0x174c5b,null))['catch'](handleError(_0x174c5b,null));};exports[_0xf91d('0x4e')]=function(_0x43c27e,_0x48b1dd,_0x354a23){return db[_0xf91d('0x3e')][_0xf91d('0x47')]({'where':{'id':_0x43c27e['params']['id']}})[_0xf91d('0x27')](handleEntityNotFound(_0x48b1dd,null))[_0xf91d('0x27')](function(_0xcf18bd){if(_0xcf18bd){return _0xcf18bd[_0xf91d('0x4e')](_0x43c27e[_0xf91d('0x49')][_0xf91d('0x4f')],_[_0xf91d('0x50')](_0x43c27e['body'],[_0xf91d('0x4f'),'id'])||{});}})[_0xf91d('0x27')](respondWithResult(_0x48b1dd,null))['catch'](handleError(_0x48b1dd,null));};exports[_0xf91d('0x51')]=function(_0x211160,_0x578630,_0x362348){var _0x2ef4b9={};var _0x457394={};var _0x3c0058;var _0x40d9b4;return db[_0xf91d('0x3e')][_0xf91d('0x52')]({'where':{'id':_0x211160['params']['id']}})[_0xf91d('0x27')](handleEntityNotFound(_0x578630,null))[_0xf91d('0x27')](function(_0x27d4fc){if(_0x27d4fc){_0x3c0058=_0x27d4fc;_0x457394['model']=_['keys'](db[_0xf91d('0x53')][_0xf91d('0x2c')]);_0x457394[_0xf91d('0x30')]=_['keys'](_0x211160[_0xf91d('0x30')]);_0x457394[_0xf91d('0x31')]=_[_0xf91d('0x32')](_0x457394[_0xf91d('0x2f')],_0x457394[_0xf91d('0x30')]);_0x2ef4b9['attributes']=_[_0xf91d('0x32')](_0x457394['model'],qs[_0xf91d('0x46')](_0x211160[_0xf91d('0x30')][_0xf91d('0x46')]));_0x2ef4b9[_0xf91d('0x33')]=_0x2ef4b9[_0xf91d('0x33')]['length']?_0x2ef4b9['attributes']:_0x457394[_0xf91d('0x2f')];_0x2ef4b9['order']=qs[_0xf91d('0x36')](_0x211160[_0xf91d('0x30')]['sort']);_0x2ef4b9['where']=qs['filters'](_[_0xf91d('0x38')](_0x211160[_0xf91d('0x30')],_0x457394['filters']));if(_0x211160[_0xf91d('0x30')][_0xf91d('0x39')]){_0x2ef4b9[_0xf91d('0x37')]=_[_0xf91d('0x3a')](_0x2ef4b9['where'],{'$or':_[_0xf91d('0x2b')](_0x2ef4b9[_0xf91d('0x33')],function(_0x298749){var _0x4148bf={};_0x4148bf[_0x298749]={'$like':'%'+_0x211160[_0xf91d('0x30')][_0xf91d('0x39')]+'%'};return _0x4148bf;})});}_0x2ef4b9=_[_0xf91d('0x3a')]({},_0x2ef4b9,_0x211160[_0xf91d('0x3d')]);return _0x3c0058['getMembers'](_0x2ef4b9);}})[_0xf91d('0x27')](function(_0x3038ae){if(_0x3038ae){_0x40d9b4=_0x3038ae[_0xf91d('0x54')];if(!_0x211160['query'][_0xf91d('0x34')](_0xf91d('0x55'))){_0x2ef4b9['limit']=qs[_0xf91d('0x22')](_0x211160[_0xf91d('0x30')][_0xf91d('0x22')]);_0x2ef4b9[_0xf91d('0x21')]=qs[_0xf91d('0x21')](_0x211160[_0xf91d('0x30')][_0xf91d('0x21')]);}return _0x3c0058[_0xf91d('0x51')](_0x2ef4b9);}})[_0xf91d('0x27')](function(_0x41540c){if(_0x41540c){return _0x41540c?{'count':_0x40d9b4,'rows':_0x41540c}:null;}})['then'](respondWithResult(_0x578630,null))[_0xf91d('0x43')](handleError(_0x578630,null));};exports[_0xf91d('0x56')]=function(_0x5ed247,_0x363971,_0x3bb1b1){return db[_0xf91d('0x3e')][_0xf91d('0x47')]({'where':{'id':_0x5ed247[_0xf91d('0x45')]['id']}})['then'](handleEntityNotFound(_0x363971,null))[_0xf91d('0x27')](function(_0x383592){if(_0x383592){return _0x383592[_0xf91d('0x56')](_0x5ed247['query']['ids']);}})[_0xf91d('0x27')](respondWithStatusCode(_0x363971,null))[_0xf91d('0x43')](handleError(_0x363971,null));};exports['addMessage']=function(_0x31696b,_0x503fbe,_0x38a92b){if(_0x31696b[_0xf91d('0x49')]['id']){delete _0x31696b[_0xf91d('0x49')]['id'];}return db[_0xf91d('0x3e')][_0xf91d('0x47')]({'where':{'id':_0x31696b[_0xf91d('0x45')]['id']}})[_0xf91d('0x27')](handleEntityNotFound(_0x503fbe,null))['then'](function(_0x105f64){if(_0x105f64){_0x31696b[_0xf91d('0x49')][_0xf91d('0x57')]=_0x105f64['id'];return db[_0xf91d('0x4c')][_0xf91d('0x48')](_0x31696b[_0xf91d('0x49')]);}})[_0xf91d('0x27')](respondWithResult(_0x503fbe,null))['catch'](handleError(_0x503fbe,null));};exports[_0xf91d('0x58')]=function(_0x3f3c34,_0x490e9e,_0x3c2856){var _0x2f17d4={};var _0x4c7c13={};var _0x3f1230;var _0x84ce79;return db[_0xf91d('0x3e')][_0xf91d('0x52')]({'where':{'id':_0x3f3c34['params']['id']}})[_0xf91d('0x27')](handleEntityNotFound(_0x490e9e,null))['then'](function(_0x4f0452){if(_0x4f0452){_0x3f1230=_0x4f0452;_0x4c7c13[_0xf91d('0x2f')]=_[_0xf91d('0x59')](db[_0xf91d('0x4c')]['rawAttributes']);_0x4c7c13[_0xf91d('0x30')]=_[_0xf91d('0x59')](_0x3f3c34['query']);_0x4c7c13[_0xf91d('0x31')]=_[_0xf91d('0x32')](_0x4c7c13['model'],_0x4c7c13[_0xf91d('0x30')]);_0x2f17d4[_0xf91d('0x33')]=_[_0xf91d('0x32')](_0x4c7c13[_0xf91d('0x2f')],qs['fields'](_0x3f3c34[_0xf91d('0x30')]['fields']));_0x2f17d4[_0xf91d('0x33')]=_0x2f17d4[_0xf91d('0x33')][_0xf91d('0x54')]?_0x2f17d4[_0xf91d('0x33')]:_0x4c7c13['model'];_0x2f17d4[_0xf91d('0x35')]=qs[_0xf91d('0x36')](_0x3f3c34[_0xf91d('0x30')]['sort']);_0x2f17d4[_0xf91d('0x37')]=qs['filters'](_['pick'](_0x3f3c34[_0xf91d('0x30')],_0x4c7c13['filters']));if(_0x3f3c34[_0xf91d('0x30')][_0xf91d('0x39')]){_0x2f17d4[_0xf91d('0x37')]=_[_0xf91d('0x3a')](_0x2f17d4[_0xf91d('0x37')],{'$or':_[_0xf91d('0x2b')](_0x2f17d4[_0xf91d('0x33')],function(_0x2a876d){var _0x1d2955={};_0x1d2955[_0x2a876d]={'$like':'%'+_0x3f3c34[_0xf91d('0x30')]['filter']+'%'};return _0x1d2955;})});}if(_0x3f3c34[_0xf91d('0x30')][_0xf91d('0x5a')]){var _0x2f37b0=_0x3f3c34[_0xf91d('0x30')][_0xf91d('0x5a')]['split'](',');var _0xfa11c0={};_0xfa11c0[_0x2f37b0[0x0]]={'$gte':moment(_0x2f37b0[0x1])[_0xf91d('0x5b')](_0xf91d('0x5c'))};_0x2f17d4['where']=_['merge'](_0x2f17d4[_0xf91d('0x37')],_0xfa11c0);}_0x2f17d4=_[_0xf91d('0x3a')]({},_0x2f17d4,_0x3f3c34[_0xf91d('0x3d')]);return _0x3f1230['getMessages'](_0x2f17d4);}})[_0xf91d('0x27')](function(_0x542a81){if(_0x542a81){_0x84ce79=_0x542a81[_0xf91d('0x54')];if(!_0x3f3c34['query']['hasOwnProperty'](_0xf91d('0x55'))){_0x2f17d4['limit']=qs['limit'](_0x3f3c34[_0xf91d('0x30')][_0xf91d('0x22')]);_0x2f17d4[_0xf91d('0x21')]=qs[_0xf91d('0x21')](_0x3f3c34[_0xf91d('0x30')][_0xf91d('0x21')]);}return _0x3f1230['getMessages'](_0x2f17d4);}})[_0xf91d('0x27')](function(_0x57d3a9){if(_0x57d3a9){return _0x57d3a9?{'count':_0x84ce79,'rows':_0x57d3a9}:null;}})[_0xf91d('0x27')](respondWithResult(_0x490e9e,null))[_0xf91d('0x43')](handleError(_0x490e9e,null));}; \ No newline at end of file +var _0x9165=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','intersection','create','body','find','params','describe','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','limit','count','offset'];(function(_0x4a8497,_0x270b55){var _0x10dd17=function(_0x2cf3d3){while(--_0x2cf3d3){_0x4a8497['push'](_0x4a8497['shift']());}};_0x10dd17(++_0x270b55);}(_0x9165,0x101));var _0x5916=function(_0x2754a8,_0x25feb3){_0x2754a8=_0x2754a8-0x0;var _0x557255=_0x9165[_0x2754a8];return _0x557255;};'use strict';var emlformat=require(_0x5916('0x0'));var rimraf=require(_0x5916('0x1'));var zipdir=require(_0x5916('0x2'));var jsonpatch=require(_0x5916('0x3'));var rp=require(_0x5916('0x4'));var moment=require(_0x5916('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5916('0x6'));var util=require(_0x5916('0x7'));var path=require(_0x5916('0x8'));var sox=require(_0x5916('0x9'));var csv=require(_0x5916('0xa'));var ejs=require(_0x5916('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5916('0xc'));var crypto=require(_0x5916('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5916('0xe'));var Papa=require(_0x5916('0xf'));var Redis=require(_0x5916('0x10'));var authService=require(_0x5916('0x11'));var qs=require(_0x5916('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5916('0x13'));var logger=require(_0x5916('0x14'))(_0x5916('0x15'));var utils=require(_0x5916('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5916('0x17'));var db=require(_0x5916('0x18'))['db'];config[_0x5916('0x19')]=_[_0x5916('0x1a')](config[_0x5916('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5916('0x1b'))(new Redis(config[_0x5916('0x19')]));require(_0x5916('0x1c'))[_0x5916('0x1d')](socket);function respondWithStatusCode(_0x7edf59,_0x22369d){_0x22369d=_0x22369d||0xcc;return function(_0xf0b7a6){if(_0xf0b7a6){return _0x7edf59[_0x5916('0x1e')](_0x22369d);}return _0x7edf59['status'](_0x22369d)[_0x5916('0x1f')]();};}function respondWithResult(_0x39d03b,_0x5218fe){_0x5218fe=_0x5218fe||0xc8;return function(_0x21a044){if(_0x21a044){return _0x39d03b[_0x5916('0x20')](_0x5218fe)[_0x5916('0x21')](_0x21a044);}};}function respondWithFilteredResult(_0x5626cb,_0xb5592e){return function(_0x54fe60){if(_0x54fe60){var _0x5ce1f1=typeof _0xb5592e['offset']==='undefined'&&typeof _0xb5592e[_0x5916('0x22')]==='undefined';var _0x3eca92=_0x54fe60[_0x5916('0x23')];var _0x1292cd=_0x5ce1f1?0x0:_0xb5592e[_0x5916('0x24')];var _0x161b80=_0x5ce1f1?_0x54fe60['count']:_0xb5592e[_0x5916('0x24')]+_0xb5592e['limit'];var _0x3f0db3;if(_0x161b80>=_0x3eca92){_0x161b80=_0x3eca92;_0x3f0db3=0xc8;}else{_0x3f0db3=0xce;}_0x5626cb[_0x5916('0x20')](_0x3f0db3);return _0x5626cb[_0x5916('0x25')](_0x5916('0x26'),_0x1292cd+'-'+_0x161b80+'/'+_0x3eca92)[_0x5916('0x21')](_0x54fe60);}return null;};}function patchUpdates(_0x24b4b7){return function(_0x137a88){try{jsonpatch[_0x5916('0x27')](_0x137a88,_0x24b4b7,!![]);}catch(_0x5753d1){return BPromise['reject'](_0x5753d1);}return _0x137a88[_0x5916('0x28')]();};}function saveUpdates(_0x5c37d3,_0x52b694){return function(_0x50a015){if(_0x50a015){return _0x50a015[_0x5916('0x29')](_0x5c37d3)[_0x5916('0x2a')](function(_0x4340dc){return _0x4340dc;});}return null;};}function removeEntity(_0x3ad50a,_0x2d77be){return function(_0x513119){if(_0x513119){return _0x513119[_0x5916('0x2b')]()[_0x5916('0x2a')](function(){_0x3ad50a[_0x5916('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb03e,_0x5db931){return function(_0x593bf0){if(!_0x593bf0){_0x4eb03e[_0x5916('0x1e')](0x194);}return _0x593bf0;};}function handleError(_0x18815a,_0x4dadfe){_0x4dadfe=_0x4dadfe||0x1f4;return function(_0xe96e02){logger[_0x5916('0x2c')](_0xe96e02[_0x5916('0x2d')]);if(_0xe96e02[_0x5916('0x2e')]){delete _0xe96e02[_0x5916('0x2e')];}_0x18815a[_0x5916('0x20')](_0x4dadfe)[_0x5916('0x2f')](_0xe96e02);};}exports[_0x5916('0x30')]=function(_0x2f60f7,_0x133cb5){var _0x570f77={},_0x32e12e={},_0x179ca5={'count':0x0,'rows':[]};var _0x118f8c=_[_0x5916('0x31')](db[_0x5916('0x32')]['rawAttributes'],function(_0x2f84b9){return{'name':_0x2f84b9[_0x5916('0x33')],'type':_0x2f84b9[_0x5916('0x34')][_0x5916('0x35')]};});_0x32e12e['model']=_[_0x5916('0x31')](_0x118f8c,_0x5916('0x2e'));_0x32e12e[_0x5916('0x36')]=_[_0x5916('0x37')](_0x2f60f7[_0x5916('0x36')]);_0x32e12e[_0x5916('0x38')]=_['intersection'](_0x32e12e[_0x5916('0x39')],_0x32e12e['query']);_0x570f77[_0x5916('0x3a')]=_['intersection'](_0x32e12e[_0x5916('0x39')],qs['fields'](_0x2f60f7['query'][_0x5916('0x3b')]));_0x570f77[_0x5916('0x3a')]=_0x570f77[_0x5916('0x3a')][_0x5916('0x3c')]?_0x570f77['attributes']:_0x32e12e[_0x5916('0x39')];if(!_0x2f60f7[_0x5916('0x36')][_0x5916('0x3d')](_0x5916('0x3e'))){_0x570f77['limit']=qs[_0x5916('0x22')](_0x2f60f7[_0x5916('0x36')][_0x5916('0x22')]);_0x570f77[_0x5916('0x24')]=qs[_0x5916('0x24')](_0x2f60f7[_0x5916('0x36')][_0x5916('0x24')]);}_0x570f77[_0x5916('0x3f')]=qs[_0x5916('0x40')](_0x2f60f7[_0x5916('0x36')][_0x5916('0x40')]);_0x570f77['where']=qs[_0x5916('0x38')](_[_0x5916('0x41')](_0x2f60f7[_0x5916('0x36')],_0x32e12e[_0x5916('0x38')]),_0x118f8c);if(_0x2f60f7[_0x5916('0x36')][_0x5916('0x42')]){_0x570f77[_0x5916('0x43')]=_[_0x5916('0x44')](_0x570f77[_0x5916('0x43')],{'$or':_[_0x5916('0x31')](_0x118f8c,function(_0x1e6a10){if(_0x1e6a10['type']!==_0x5916('0x45')){var _0x58a422={};_0x58a422[_0x1e6a10['name']]={'$like':'%'+_0x2f60f7[_0x5916('0x36')]['filter']+'%'};return _0x58a422;}})});}_0x570f77=_['merge']({},_0x570f77,_0x2f60f7[_0x5916('0x46')]);var _0x30560d={'where':_0x570f77[_0x5916('0x43')]};return db['ChatGroup'][_0x5916('0x23')](_0x30560d)[_0x5916('0x2a')](function(_0x49cd82){_0x179ca5[_0x5916('0x23')]=_0x49cd82;if(_0x2f60f7['query'][_0x5916('0x47')]){_0x570f77[_0x5916('0x48')]=[{'all':!![]}];}return db[_0x5916('0x32')]['findAll'](_0x570f77);})[_0x5916('0x2a')](function(_0x4b55c3){_0x179ca5[_0x5916('0x49')]=_0x4b55c3;return _0x179ca5;})['then'](respondWithFilteredResult(_0x133cb5,_0x570f77))[_0x5916('0x4a')](handleError(_0x133cb5,null));};exports[_0x5916('0x4b')]=function(_0xd7d04d,_0x414f99){var _0x4024ed={'raw':!![],'where':{'id':_0xd7d04d['params']['id']}},_0x4077cb={};_0x4077cb[_0x5916('0x39')]=_[_0x5916('0x37')](db[_0x5916('0x32')][_0x5916('0x4c')]);_0x4077cb[_0x5916('0x36')]=_[_0x5916('0x37')](_0xd7d04d[_0x5916('0x36')]);_0x4077cb['filters']=_[_0x5916('0x4d')](_0x4077cb[_0x5916('0x39')],_0x4077cb[_0x5916('0x36')]);_0x4024ed[_0x5916('0x3a')]=_[_0x5916('0x4d')](_0x4077cb[_0x5916('0x39')],qs['fields'](_0xd7d04d['query'][_0x5916('0x3b')]));_0x4024ed[_0x5916('0x3a')]=_0x4024ed['attributes'][_0x5916('0x3c')]?_0x4024ed[_0x5916('0x3a')]:_0x4077cb[_0x5916('0x39')];if(_0xd7d04d[_0x5916('0x36')]['includeAll']){_0x4024ed['include']=[{'all':!![]}];}_0x4024ed=_[_0x5916('0x44')]({},_0x4024ed,_0xd7d04d[_0x5916('0x46')]);return db[_0x5916('0x32')]['find'](_0x4024ed)[_0x5916('0x2a')](handleEntityNotFound(_0x414f99,null))[_0x5916('0x2a')](respondWithResult(_0x414f99,null))['catch'](handleError(_0x414f99,null));};exports[_0x5916('0x4e')]=function(_0x1a8f4e,_0x2e78d2){return db[_0x5916('0x32')][_0x5916('0x4e')](_0x1a8f4e[_0x5916('0x4f')],{})[_0x5916('0x2a')](respondWithResult(_0x2e78d2,0xc9))[_0x5916('0x4a')](handleError(_0x2e78d2,null));};exports[_0x5916('0x29')]=function(_0x5b1221,_0x28f2c9){if(_0x5b1221[_0x5916('0x4f')]['id']){delete _0x5b1221['body']['id'];}return db[_0x5916('0x32')]['find']({'where':{'id':_0x5b1221['params']['id']}})['then'](handleEntityNotFound(_0x28f2c9,null))[_0x5916('0x2a')](saveUpdates(_0x5b1221[_0x5916('0x4f')],null))[_0x5916('0x2a')](respondWithResult(_0x28f2c9,null))['catch'](handleError(_0x28f2c9,null));};exports[_0x5916('0x2b')]=function(_0x2ceac7,_0x8cf131){return db[_0x5916('0x32')][_0x5916('0x50')]({'where':{'id':_0x2ceac7[_0x5916('0x51')]['id']}})[_0x5916('0x2a')](handleEntityNotFound(_0x8cf131,null))[_0x5916('0x2a')](removeEntity(_0x8cf131,null))[_0x5916('0x4a')](handleError(_0x8cf131,null));};exports['describe']=function(_0x54eafd,_0xc54a24){return db[_0x5916('0x32')][_0x5916('0x52')]()[_0x5916('0x2a')](respondWithResult(_0xc54a24,null))[_0x5916('0x4a')](handleError(_0xc54a24,null));};exports['getUnread']=function(_0x2633ba,_0x2cd691,_0xc45c9b){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x2633ba[_0x5916('0x51')]['id'],'ToId':_0x2633ba['user']['id'],'read':![]}})['then'](function(_0x5ebf81){return{'id':_[_0x5916('0x53')](_0x2633ba[_0x5916('0x51')]['id']),'count':_0x5ebf81};})[_0x5916('0x2a')](respondWithResult(_0x2cd691,null))[_0x5916('0x4a')](handleError(_0x2cd691,null));};exports[_0x5916('0x54')]=function(_0x507bbb,_0x3d90a5,_0x3de8c7){return db['ChatGroup'][_0x5916('0x50')]({'where':{'id':_0x507bbb['params']['id']}})[_0x5916('0x2a')](handleEntityNotFound(_0x3d90a5,null))[_0x5916('0x2a')](function(_0x380e2e){if(_0x380e2e){return _0x380e2e[_0x5916('0x54')](_0x507bbb[_0x5916('0x4f')][_0x5916('0x55')],_[_0x5916('0x56')](_0x507bbb['body'],['ids','id'])||{});}})[_0x5916('0x2a')](respondWithResult(_0x3d90a5,null))['catch'](handleError(_0x3d90a5,null));};exports[_0x5916('0x57')]=function(_0xbb63ec,_0x2ed0fa,_0x400ba3){var _0x18f2ad={};var _0x1cd67e={};var _0x19b767;var _0x2a9012;return db[_0x5916('0x32')][_0x5916('0x58')]({'where':{'id':_0xbb63ec[_0x5916('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ed0fa,null))[_0x5916('0x2a')](function(_0x355fcb){if(_0x355fcb){_0x19b767=_0x355fcb;_0x1cd67e[_0x5916('0x39')]=_[_0x5916('0x37')](db['User']['rawAttributes']);_0x1cd67e[_0x5916('0x36')]=_[_0x5916('0x37')](_0xbb63ec[_0x5916('0x36')]);_0x1cd67e[_0x5916('0x38')]=_[_0x5916('0x4d')](_0x1cd67e[_0x5916('0x39')],_0x1cd67e['query']);_0x18f2ad[_0x5916('0x3a')]=_[_0x5916('0x4d')](_0x1cd67e[_0x5916('0x39')],qs[_0x5916('0x3b')](_0xbb63ec[_0x5916('0x36')][_0x5916('0x3b')]));_0x18f2ad[_0x5916('0x3a')]=_0x18f2ad[_0x5916('0x3a')]['length']?_0x18f2ad[_0x5916('0x3a')]:_0x1cd67e[_0x5916('0x39')];_0x18f2ad[_0x5916('0x3f')]=qs[_0x5916('0x40')](_0xbb63ec[_0x5916('0x36')][_0x5916('0x40')]);_0x18f2ad[_0x5916('0x43')]=qs[_0x5916('0x38')](_[_0x5916('0x41')](_0xbb63ec[_0x5916('0x36')],_0x1cd67e['filters']));if(_0xbb63ec[_0x5916('0x36')][_0x5916('0x42')]){_0x18f2ad['where']=_[_0x5916('0x44')](_0x18f2ad[_0x5916('0x43')],{'$or':_['map'](_0x18f2ad[_0x5916('0x3a')],function(_0x2e860e){var _0x21a92a={};_0x21a92a[_0x2e860e]={'$like':'%'+_0xbb63ec[_0x5916('0x36')][_0x5916('0x42')]+'%'};return _0x21a92a;})});}_0x18f2ad=_['merge']({},_0x18f2ad,_0xbb63ec['options']);return _0x19b767[_0x5916('0x57')](_0x18f2ad);}})[_0x5916('0x2a')](function(_0x6b49d4){if(_0x6b49d4){_0x2a9012=_0x6b49d4[_0x5916('0x3c')];if(!_0xbb63ec[_0x5916('0x36')][_0x5916('0x3d')](_0x5916('0x3e'))){_0x18f2ad[_0x5916('0x22')]=qs[_0x5916('0x22')](_0xbb63ec[_0x5916('0x36')][_0x5916('0x22')]);_0x18f2ad[_0x5916('0x24')]=qs['offset'](_0xbb63ec[_0x5916('0x36')][_0x5916('0x24')]);}return _0x19b767[_0x5916('0x57')](_0x18f2ad);}})['then'](function(_0x41c7f5){if(_0x41c7f5){return _0x41c7f5?{'count':_0x2a9012,'rows':_0x41c7f5}:null;}})[_0x5916('0x2a')](respondWithResult(_0x2ed0fa,null))[_0x5916('0x4a')](handleError(_0x2ed0fa,null));};exports[_0x5916('0x59')]=function(_0x2a1db0,_0x4a8066,_0x1d72b7){return db[_0x5916('0x32')][_0x5916('0x50')]({'where':{'id':_0x2a1db0[_0x5916('0x51')]['id']}})[_0x5916('0x2a')](handleEntityNotFound(_0x4a8066,null))['then'](function(_0x4ba73b){if(_0x4ba73b){return _0x4ba73b[_0x5916('0x59')](_0x2a1db0[_0x5916('0x36')][_0x5916('0x55')]);}})[_0x5916('0x2a')](respondWithStatusCode(_0x4a8066,null))[_0x5916('0x4a')](handleError(_0x4a8066,null));};exports[_0x5916('0x5a')]=function(_0x998276,_0x1da475,_0x56034c){if(_0x998276[_0x5916('0x4f')]['id']){delete _0x998276[_0x5916('0x4f')]['id'];}return db[_0x5916('0x32')][_0x5916('0x50')]({'where':{'id':_0x998276[_0x5916('0x51')]['id']}})['then'](handleEntityNotFound(_0x1da475,null))[_0x5916('0x2a')](function(_0x3601a4){if(_0x3601a4){_0x998276[_0x5916('0x4f')][_0x5916('0x5b')]=_0x3601a4['id'];return db[_0x5916('0x5c')][_0x5916('0x4e')](_0x998276['body']);}})[_0x5916('0x2a')](respondWithResult(_0x1da475,null))[_0x5916('0x4a')](handleError(_0x1da475,null));};exports[_0x5916('0x5d')]=function(_0x1895be,_0x1236ae,_0x1dd4eb){var _0x5ef100={};var _0x6eb459={};var _0x16d1be;var _0x5f50b0;return db[_0x5916('0x32')]['findOne']({'where':{'id':_0x1895be[_0x5916('0x51')]['id']}})['then'](handleEntityNotFound(_0x1236ae,null))[_0x5916('0x2a')](function(_0x3bee4b){if(_0x3bee4b){_0x16d1be=_0x3bee4b;_0x6eb459[_0x5916('0x39')]=_[_0x5916('0x37')](db['ChatInternalMessage'][_0x5916('0x4c')]);_0x6eb459[_0x5916('0x36')]=_[_0x5916('0x37')](_0x1895be[_0x5916('0x36')]);_0x6eb459[_0x5916('0x38')]=_[_0x5916('0x4d')](_0x6eb459[_0x5916('0x39')],_0x6eb459[_0x5916('0x36')]);_0x5ef100[_0x5916('0x3a')]=_['intersection'](_0x6eb459['model'],qs[_0x5916('0x3b')](_0x1895be[_0x5916('0x36')][_0x5916('0x3b')]));_0x5ef100[_0x5916('0x3a')]=_0x5ef100[_0x5916('0x3a')][_0x5916('0x3c')]?_0x5ef100[_0x5916('0x3a')]:_0x6eb459['model'];_0x5ef100['order']=qs['sort'](_0x1895be['query'][_0x5916('0x40')]);_0x5ef100[_0x5916('0x43')]=qs[_0x5916('0x38')](_[_0x5916('0x41')](_0x1895be['query'],_0x6eb459[_0x5916('0x38')]));if(_0x1895be[_0x5916('0x36')][_0x5916('0x42')]){_0x5ef100[_0x5916('0x43')]=_[_0x5916('0x44')](_0x5ef100[_0x5916('0x43')],{'$or':_[_0x5916('0x31')](_0x5ef100['attributes'],function(_0x2f41d2){var _0xea379d={};_0xea379d[_0x2f41d2]={'$like':'%'+_0x1895be['query'][_0x5916('0x42')]+'%'};return _0xea379d;})});}if(_0x1895be[_0x5916('0x36')][_0x5916('0x5e')]){var _0x480027=_0x1895be[_0x5916('0x36')][_0x5916('0x5e')][_0x5916('0x5f')](',');var _0x5a86c2={};_0x5a86c2[_0x480027[0x0]]={'$gte':moment(_0x480027[0x1])[_0x5916('0x60')](_0x5916('0x61'))};_0x5ef100['where']=_[_0x5916('0x44')](_0x5ef100[_0x5916('0x43')],_0x5a86c2);}_0x5ef100=_[_0x5916('0x44')]({},_0x5ef100,_0x1895be[_0x5916('0x46')]);return _0x16d1be[_0x5916('0x5d')](_0x5ef100);}})[_0x5916('0x2a')](function(_0x2fe1cf){if(_0x2fe1cf){_0x5f50b0=_0x2fe1cf[_0x5916('0x3c')];if(!_0x1895be[_0x5916('0x36')]['hasOwnProperty'](_0x5916('0x3e'))){_0x5ef100['limit']=qs[_0x5916('0x22')](_0x1895be[_0x5916('0x36')][_0x5916('0x22')]);_0x5ef100[_0x5916('0x24')]=qs[_0x5916('0x24')](_0x1895be[_0x5916('0x36')]['offset']);}return _0x16d1be[_0x5916('0x5d')](_0x5ef100);}})['then'](function(_0x31d6dc){if(_0x31d6dc){return _0x31d6dc?{'count':_0x5f50b0,'rows':_0x31d6dc}:null;}})[_0x5916('0x2a')](respondWithResult(_0x1236ae,null))[_0x5916('0x4a')](handleError(_0x1236ae,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 904175e..aa66553 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 _0x3f1f=['events','../../mysqldb','ChatGroup','emit','hasOwnProperty'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x3f1f,0x109));var _0xf3f1=function(_0x3fafac,_0x339db3){_0x3fafac=_0x3fafac-0x0;var _0xde16a3=_0x3f1f[_0x3fafac];return _0xde16a3;};'use strict';var EventEmitter=require(_0xf3f1('0x0'));var ChatGroup=require(_0xf3f1('0x1'))['db'][_0xf3f1('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x53dc9c){return function(_0x37beab,_0x19aacf,_0x57219e){ChatGroupEvents[_0xf3f1('0x3')](_0x53dc9c+':'+_0x37beab['id'],_0x37beab);ChatGroupEvents['emit'](_0x53dc9c,_0x37beab);_0x57219e(null);};}for(var e in events){if(events[_0xf3f1('0x4')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xcf40=['../../mysqldb','ChatGroup','save','update','remove','emit','hook','exports'];(function(_0x3c5dcf,_0x28f7d7){var _0x4cc66f=function(_0x287d44){while(--_0x287d44){_0x3c5dcf['push'](_0x3c5dcf['shift']());}};_0x4cc66f(++_0x28f7d7);}(_0xcf40,0x1d0));var _0x0cf4=function(_0x1124b9,_0x3fea8c){_0x1124b9=_0x1124b9-0x0;var _0x432971=_0xcf40[_0x1124b9];return _0x432971;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x0cf4('0x0'))['db'][_0x0cf4('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0cf4('0x2'),'afterUpdate':_0x0cf4('0x3'),'afterDestroy':_0x0cf4('0x4')};function emitEvent(_0x5eedc5){return function(_0x5d8181,_0x25f67c,_0x3b92b0){ChatGroupEvents[_0x0cf4('0x5')](_0x5eedc5+':'+_0x5d8181['id'],_0x5d8181);ChatGroupEvents[_0x0cf4('0x5')](_0x5eedc5,_0x5d8181);_0x3b92b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x0cf4('0x6')](e,emitEvent(event));}}module[_0x0cf4('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 51f3e01..74899da 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 _0x5340=['chat_groups','lodash','util','../../config/logger','api','moment','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x55dc9d,_0x5d9546){var _0x9111eb=function(_0x4d2887){while(--_0x4d2887){_0x55dc9d['push'](_0x55dc9d['shift']());}};_0x9111eb(++_0x5d9546);}(_0x5340,0x181));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0534('0x0'));var util=require(_0x0534('0x1'));var logger=require(_0x0534('0x2'))(_0x0534('0x3'));var moment=require(_0x0534('0x4'));var BPromise=require('bluebird');var rp=require(_0x0534('0x5'));var fs=require('fs');var path=require(_0x0534('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0534('0x7'));module[_0x0534('0x8')]=function(_0x419007,_0xf96404){return _0x419007[_0x0534('0x9')](_0x0534('0xa'),attributes,{'tableName':_0x0534('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8592=['../../config/environment','./chatGroup.attributes','exports','chat_groups','util','api','moment','request-promise','path','rimraf'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x8592,0x1ee));var _0x2859=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x8592[_0x44946b];return _0x249bc4;};'use strict';var _=require('lodash');var util=require(_0x2859('0x0'));var logger=require('../../config/logger')(_0x2859('0x1'));var moment=require(_0x2859('0x2'));var BPromise=require('bluebird');var rp=require(_0x2859('0x3'));var fs=require('fs');var path=require(_0x2859('0x4'));var rimraf=require(_0x2859('0x5'));var config=require(_0x2859('0x6'));var attributes=require(_0x2859('0x7'));module[_0x2859('0x8')]=function(_0x12dff4,_0x212ef2){return _0x12dff4['define']('ChatGroup',attributes,{'tableName':_0x2859('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 37043dc..ebe36e9 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 _0xc8f3=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment'];(function(_0x5090d4,_0x1950a7){var _0x56c310=function(_0x3d3d5c){while(--_0x3d3d5c){_0x5090d4['push'](_0x5090d4['shift']());}};_0x56c310(++_0x1950a7);}(_0xc8f3,0x1d3));var _0x3c8f=function(_0x35fdff,_0x58bf32){_0x35fdff=_0x35fdff-0x0;var _0x44b12a=_0xc8f3[_0x35fdff];return _0x44b12a;};'use strict';var _=require(_0x3c8f('0x0'));var util=require(_0x3c8f('0x1'));var moment=require(_0x3c8f('0x2'));var BPromise=require(_0x3c8f('0x3'));var rs=require(_0x3c8f('0x4'));var fs=require('fs');var Redis=require(_0x3c8f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c8f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3c8f('0x7'));var jayson=require(_0x3c8f('0x8'));var client=jayson[_0x3c8f('0x9')][_0x3c8f('0xa')]({'port':0x232a});config[_0x3c8f('0xb')]=_['defaults'](config[_0x3c8f('0xb')],{'host':_0x3c8f('0xc'),'port':0x18eb});var socket=require(_0x3c8f('0xd'))(new Redis(config[_0x3c8f('0xb')]));require(_0x3c8f('0xe'))[_0x3c8f('0xf')](socket);function respondWithRpcPromise(_0x419518,_0x1ce5c4,_0x3e9156){return new BPromise(function(_0x572141,_0x28fccc){return client[_0x3c8f('0x10')](_0x419518,_0x3e9156)['then'](function(_0x2f31f9){logger[_0x3c8f('0x11')](_0x3c8f('0x12'),_0x1ce5c4,'request\x20sent');logger[_0x3c8f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1ce5c4,_0x3c8f('0x14'),JSON['stringify'](_0x2f31f9));if(_0x2f31f9[_0x3c8f('0x15')]){if(_0x2f31f9['error'][_0x3c8f('0x16')]===0x1f4){logger[_0x3c8f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1ce5c4,_0x2f31f9[_0x3c8f('0x15')]['message']);return _0x28fccc(_0x2f31f9[_0x3c8f('0x15')][_0x3c8f('0x17')]);}logger[_0x3c8f('0x15')](_0x3c8f('0x12'),_0x1ce5c4,_0x2f31f9[_0x3c8f('0x15')][_0x3c8f('0x17')]);return _0x572141(_0x2f31f9[_0x3c8f('0x15')][_0x3c8f('0x17')]);}else{logger[_0x3c8f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1ce5c4,_0x3c8f('0x14'));_0x572141(_0x2f31f9[_0x3c8f('0x18')][_0x3c8f('0x17')]);}})['catch'](function(_0x5ee69e){logger['error'](_0x3c8f('0x12'),_0x1ce5c4,_0x5ee69e);_0x28fccc(_0x5ee69e);});});} \ No newline at end of file +var _0x16d8=['ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info'];(function(_0x5def72,_0x1f07f7){var _0x196862=function(_0x51355d){while(--_0x51355d){_0x5def72['push'](_0x5def72['shift']());}};_0x196862(++_0x1f07f7);}(_0x16d8,0xa3));var _0x816d=function(_0x2a0b3b,_0x4ff710){_0x2a0b3b=_0x2a0b3b-0x0;var _0x559cc2=_0x16d8[_0x2a0b3b];return _0x559cc2;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var moment=require(_0x816d('0x1'));var BPromise=require(_0x816d('0x2'));var rs=require(_0x816d('0x3'));var fs=require('fs');var Redis=require(_0x816d('0x4'));var db=require(_0x816d('0x5'))['db'];var utils=require(_0x816d('0x6'));var logger=require(_0x816d('0x7'))(_0x816d('0x8'));var config=require('../../config/environment');var jayson=require(_0x816d('0x9'));var client=jayson['client'][_0x816d('0xa')]({'port':0x232a});config[_0x816d('0xb')]=_[_0x816d('0xc')](config[_0x816d('0xb')],{'host':_0x816d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x816d('0xb')]));require(_0x816d('0xe'))[_0x816d('0xf')](socket);function respondWithRpcPromise(_0x4f247f,_0x541e15,_0x48cb37){return new BPromise(function(_0x1c0bda,_0xe823d4){return client[_0x816d('0x10')](_0x4f247f,_0x48cb37)[_0x816d('0x11')](function(_0x5255a0){logger[_0x816d('0x12')](_0x816d('0x13'),_0x541e15,_0x816d('0x14'));logger['debug'](_0x816d('0x15'),_0x541e15,_0x816d('0x14'),JSON['stringify'](_0x5255a0));if(_0x5255a0[_0x816d('0x16')]){if(_0x5255a0[_0x816d('0x16')]['code']===0x1f4){logger[_0x816d('0x16')](_0x816d('0x13'),_0x541e15,_0x5255a0['error'][_0x816d('0x17')]);return _0xe823d4(_0x5255a0[_0x816d('0x16')][_0x816d('0x17')]);}logger[_0x816d('0x16')](_0x816d('0x13'),_0x541e15,_0x5255a0[_0x816d('0x16')][_0x816d('0x17')]);return _0x1c0bda(_0x5255a0[_0x816d('0x16')][_0x816d('0x17')]);}else{logger['info'](_0x816d('0x13'),_0x541e15,_0x816d('0x14'));_0x1c0bda(_0x5255a0[_0x816d('0x18')]['message']);}})[_0x816d('0x19')](function(_0x389c62){logger[_0x816d('0x16')](_0x816d('0x13'),_0x541e15,_0x389c62);_0xe823d4(_0x389c62);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1c82f99..7c21263 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 _0x5460=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5460,0x72));var _0x0546=function(_0x18b7e8,_0x58058c){_0x18b7e8=_0x18b7e8-0x0;var _0x4a8bc0=_0x5460[_0x18b7e8];return _0x4a8bc0;};'use strict';var ChatGroupEvents=require(_0x0546('0x0'));var events=[_0x0546('0x1'),_0x0546('0x2'),_0x0546('0x3')];function createListener(_0x31c47b,_0x35930d){return function(_0x4ba037){_0x35930d[_0x0546('0x4')](_0x31c47b,_0x4ba037);};}function removeListener(_0x260107,_0x2b1e2a){return function(){ChatGroupEvents[_0x0546('0x5')](_0x260107,_0x2b1e2a);};}exports[_0x0546('0x6')]=function(_0x3b0638){for(var _0x56a284=0x0,_0x2a8f2a=events[_0x0546('0x7')];_0x56a284<_0x2a8f2a;_0x56a284++){var _0x171ae2=events[_0x56a284];var _0x292380=createListener(_0x0546('0x8')+_0x171ae2,_0x3b0638);ChatGroupEvents['on'](_0x171ae2,_0x292380);}}; \ No newline at end of file +var _0x2c21=['./chatGroup.events','save','remove','update','emit','register','chatGroup:'];(function(_0x412626,_0x1ab9b0){var _0x2e8e57=function(_0xef39da){while(--_0xef39da){_0x412626['push'](_0x412626['shift']());}};_0x2e8e57(++_0x1ab9b0);}(_0x2c21,0x15e));var _0x12c2=function(_0xee209,_0x4858f4){_0xee209=_0xee209-0x0;var _0x48cd8c=_0x2c21[_0xee209];return _0x48cd8c;};'use strict';var ChatGroupEvents=require(_0x12c2('0x0'));var events=[_0x12c2('0x1'),_0x12c2('0x2'),_0x12c2('0x3')];function createListener(_0x19c693,_0x4f095f){return function(_0x3855c8){_0x4f095f[_0x12c2('0x4')](_0x19c693,_0x3855c8);};}function removeListener(_0x22430e,_0x32b607){return function(){ChatGroupEvents['removeListener'](_0x22430e,_0x32b607);};}exports[_0x12c2('0x5')]=function(_0x327f6e){for(var _0x1d5ebe=0x0,_0x4cb950=events['length'];_0x1d5ebe<_0x4cb950;_0x1d5ebe++){var _0x15735d=events[_0x1d5ebe];var _0x5d894c=createListener(_0x12c2('0x6')+_0x15735d,_0x327f6e);ChatGroupEvents['on'](_0x15735d,_0x5d894c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 66534e6..a291efc 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 _0x9c3f=['addMessage','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create'];(function(_0x48cf29,_0x2a36f3){var _0x4e81ff=function(_0x4f5513){while(--_0x4f5513){_0x48cf29['push'](_0x48cf29['shift']());}};_0x4e81ff(++_0x2a36f3);}(_0x9c3f,0x19c));var _0xf9c3=function(_0x1991fe,_0x2f3b62){_0x1991fe=_0x1991fe-0x0;var _0x1f6b32=_0x9c3f[_0x1991fe];return _0x1f6b32;};'use strict';var multer=require(_0xf9c3('0x0'));var util=require(_0xf9c3('0x1'));var path=require(_0xf9c3('0x2'));var timeout=require(_0xf9c3('0x3'));var express=require(_0xf9c3('0x4'));var router=express[_0xf9c3('0x5')]();var fs_extra=require(_0xf9c3('0x6'));var auth=require(_0xf9c3('0x7'));var interaction=require(_0xf9c3('0x8'));var config=require(_0xf9c3('0x9'));var controller=require('./chatGroup.controller');router[_0xf9c3('0xa')]('/',auth['isAuthenticated'](),controller[_0xf9c3('0xb')]);router['get'](_0xf9c3('0xc'),auth[_0xf9c3('0xd')](),controller['describe']);router[_0xf9c3('0xa')](_0xf9c3('0xe'),auth[_0xf9c3('0xd')](),controller[_0xf9c3('0xf')]);router[_0xf9c3('0xa')](_0xf9c3('0x10'),auth['isAuthenticated'](),controller[_0xf9c3('0x11')]);router[_0xf9c3('0xa')](_0xf9c3('0x12'),auth[_0xf9c3('0xd')](),controller['getMembers']);router['get'](_0xf9c3('0x13'),auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x14')]);router[_0xf9c3('0x15')]('/',auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x16')]);router['post'](_0xf9c3('0x12'),auth[_0xf9c3('0xd')](),controller['addMembers']);router[_0xf9c3('0x15')]('/:id/messages',auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x17')]);router[_0xf9c3('0x18')](_0xf9c3('0xe'),auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x19')]);router[_0xf9c3('0x1a')](_0xf9c3('0xe'),auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x1b')]);router[_0xf9c3('0x1a')](_0xf9c3('0x12'),auth[_0xf9c3('0xd')](),controller[_0xf9c3('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5089=['put','update','destroy','removeMembers','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','getMembers','getMessages','create','post','/:id/members','addMembers'];(function(_0x3432b3,_0xbd5bc9){var _0x103ae4=function(_0x3305e0){while(--_0x3305e0){_0x3432b3['push'](_0x3432b3['shift']());}};_0x103ae4(++_0xbd5bc9);}(_0x5089,0xdd));var _0x9508=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0x5089[_0x25280c];return _0x3a58c3;};'use strict';var multer=require(_0x9508('0x0'));var util=require('util');var path=require(_0x9508('0x1'));var timeout=require(_0x9508('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9508('0x3'));var config=require(_0x9508('0x4'));var controller=require(_0x9508('0x5'));router[_0x9508('0x6')]('/',auth[_0x9508('0x7')](),controller[_0x9508('0x8')]);router[_0x9508('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9508('0x9'),auth['isAuthenticated'](),controller[_0x9508('0xa')]);router['get'](_0x9508('0xb'),auth[_0x9508('0x7')](),controller[_0x9508('0xc')]);router[_0x9508('0x6')]('/:id/members',auth[_0x9508('0x7')](),controller[_0x9508('0xd')]);router[_0x9508('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9508('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9508('0xf')]);router[_0x9508('0x10')](_0x9508('0x11'),auth[_0x9508('0x7')](),controller[_0x9508('0x12')]);router[_0x9508('0x10')]('/:id/messages',auth[_0x9508('0x7')](),controller['addMessage']);router[_0x9508('0x13')]('/:id',auth[_0x9508('0x7')](),controller[_0x9508('0x14')]);router['delete'](_0x9508('0x9'),auth[_0x9508('0x7')](),controller[_0x9508('0x15')]);router['delete'](_0x9508('0x11'),auth[_0x9508('0x7')](),controller[_0x9508('0x16')]);module[_0x9508('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2218d46..9ece6db 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 _0x6a89=['TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x374226,_0x56ec5c){var _0xb2e1e8=function(_0x3a4412){while(--_0x3a4412){_0x374226['push'](_0x374226['shift']());}};_0xb2e1e8(++_0x56ec5c);}(_0x6a89,0x125));var _0x96a8=function(_0x5cc11e,_0x580887){_0x5cc11e=_0x5cc11e-0x0;var _0x4488a7=_0x6a89[_0x5cc11e];return _0x4488a7;};'use strict';var Sequelize=require(_0x96a8('0x0'));module[_0x96a8('0x1')]={'closed':{'type':Sequelize[_0x96a8('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x96a8('0x3')]},'ratingType':{'type':Sequelize[_0x96a8('0x4')](_0x96a8('0x5'),_0x96a8('0x6')),'defaultValue':_0x96a8('0x5')},'ratingMessage':{'type':Sequelize[_0x96a8('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x96a8('0x8')]},'disposition':{'type':Sequelize[_0x96a8('0x9')]},'secondDisposition':{'type':Sequelize[_0x96a8('0x9')]},'thirdDisposition':{'type':Sequelize[_0x96a8('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x96a8('0x9')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x96a8('0x9')]},'deviceModel':{'type':Sequelize[_0x96a8('0x9')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x96a8('0x9')]},'referer':{'type':Sequelize[_0x96a8('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x96a8('0x7')](_0x96a8('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x96a8('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x96a8('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x96a8('0x9')]},'customerPort':{'type':Sequelize[_0x96a8('0x9')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x96a8('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96a8('0x3')]}}; \ No newline at end of file +var _0x2c28=['DATE','ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2c28,0xde));var _0x82c2=function(_0x425973,_0x188500){_0x425973=_0x425973-0x0;var _0xe00d92=_0x2c28[_0x425973];return _0xe00d92;};'use strict';var Sequelize=require(_0x82c2('0x0'));module[_0x82c2('0x1')]={'closed':{'type':Sequelize[_0x82c2('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x82c2('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x82c2('0x4'),_0x82c2('0x5')),'defaultValue':_0x82c2('0x4')},'ratingMessage':{'type':Sequelize[_0x82c2('0x6')]},'pathTranscript':{'type':Sequelize[_0x82c2('0x6')]},'mailTranscript':{'type':Sequelize[_0x82c2('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x82c2('0x8')]},'disposition':{'type':Sequelize[_0x82c2('0x7')]},'secondDisposition':{'type':Sequelize[_0x82c2('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x82c2('0x7')]},'browserName':{'type':Sequelize[_0x82c2('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x82c2('0x7')]},'osVersion':{'type':Sequelize[_0x82c2('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x82c2('0x7')]},'deviceType':{'type':Sequelize[_0x82c2('0x7')]},'referer':{'type':Sequelize[_0x82c2('0x6')]},'customerIp':{'type':Sequelize[_0x82c2('0x7')]},'formData':{'type':Sequelize[_0x82c2('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x82c2('0x8')]},'lastMsgAt':{'type':Sequelize[_0x82c2('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x82c2('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x82c2('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x82c2('0x2')],'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 bb41fd8..af62757 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 _0xa6e3=['./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','destroy','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','findAll','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','find','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','file','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','pathTranscript','Messages','User','ChatWebsiteId','%s%d','agentAlias','Visitor','ContactId','website_alias','System','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','sort','pick','where','ChatInteractionId','filter','$gte','split','options','hasOwnProperty','nolimit','secret','includeAgent','rows','addTags','setTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','push','firstName','lastName','direction','read','Account','Owner','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','N.A.','tail','basename','createReadStream','pipe','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x3e5c2b,_0x1bf391){var _0x460f3c=function(_0x344d0a){while(--_0x344d0a){_0x3e5c2b['push'](_0x3e5c2b['shift']());}};_0x460f3c(++_0x1bf391);}(_0xa6e3,0x180));var _0x3a6e=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0xa6e3[_0x58e8eb];return _0x168540;};'use strict';var rimraf=require(_0x3a6e('0x0'));var zipdir=require(_0x3a6e('0x1'));var rp=require(_0x3a6e('0x2'));var moment=require(_0x3a6e('0x3'));var BPromise=require(_0x3a6e('0x4'));var Mustache=require(_0x3a6e('0x5'));var util=require(_0x3a6e('0x6'));var path=require('path');var ejs=require(_0x3a6e('0x7'));var fs=require('fs');var _=require(_0x3a6e('0x8'));var Redis=require(_0x3a6e('0x9'));var interaction=require(_0x3a6e('0xa'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x3a6e('0xb'))('api');var config=require(_0x3a6e('0xc'));var db=require(_0x3a6e('0xd'))['db'];config['redis']=_[_0x3a6e('0xe')](config[_0x3a6e('0xf')],{'host':_0x3a6e('0x10'),'port':0x18eb});var socket=require(_0x3a6e('0x11'))(new Redis(config[_0x3a6e('0xf')]));require(_0x3a6e('0x12'))[_0x3a6e('0x13')](socket);var jayson=require(_0x3a6e('0x14'));var client=jayson[_0x3a6e('0x15')][_0x3a6e('0x16')]({'port':0x232b});var client9004=jayson['client'][_0x3a6e('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x204ab7,_0x1fb3ca,_0x397c36,_0x22f25f){return new BPromise(function(_0x2a71c2,_0x3ce009){var _0x1d57ef=_0x22f25f||client;return _0x1d57ef[_0x3a6e('0x17')](_0x204ab7,_0x397c36)[_0x3a6e('0x18')](function(_0x2db7f8){logger['info'](_0x3a6e('0x19'),_0x1fb3ca,'request\x20sent');logger[_0x3a6e('0x1a')](_0x3a6e('0x1b'),_0x1fb3ca,_0x3a6e('0x1c'),JSON[_0x3a6e('0x1d')](_0x2db7f8));if(_0x2db7f8[_0x3a6e('0x1e')]){if(_0x2db7f8[_0x3a6e('0x1e')][_0x3a6e('0x1f')]===0x1f4){logger[_0x3a6e('0x1e')](_0x3a6e('0x19'),_0x1fb3ca,_0x2db7f8[_0x3a6e('0x1e')][_0x3a6e('0x20')]);return _0x3ce009(_0x2db7f8[_0x3a6e('0x1e')][_0x3a6e('0x20')]);}logger[_0x3a6e('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x1fb3ca,_0x2db7f8[_0x3a6e('0x1e')][_0x3a6e('0x20')]);return _0x2a71c2(_0x2db7f8[_0x3a6e('0x1e')][_0x3a6e('0x20')]);}else{logger[_0x3a6e('0x21')](_0x3a6e('0x19'),_0x1fb3ca,_0x3a6e('0x1c'));_0x2a71c2(_0x2db7f8[_0x3a6e('0x22')][_0x3a6e('0x20')]);}})['catch'](function(_0x5526ad){logger[_0x3a6e('0x1e')](_0x3a6e('0x19'),_0x1fb3ca,_0x5526ad);_0x3ce009(_0x5526ad);});});}function respondWithStatusCode(_0xab20ae,_0x1681fc){_0x1681fc=_0x1681fc||0xcc;return function(_0x1d0f57){if(_0x1d0f57){return _0xab20ae[_0x3a6e('0x23')](_0x1681fc);}return _0xab20ae[_0x3a6e('0x24')](_0x1681fc)[_0x3a6e('0x25')]();};}function respondWithResult(_0x3e2b60,_0x4ee871){_0x4ee871=_0x4ee871||0xc8;return function(_0x5edfd5){if(_0x5edfd5){return _0x3e2b60[_0x3a6e('0x24')](_0x4ee871)[_0x3a6e('0x26')](_0x5edfd5);}};}function respondWithFilteredResult(_0x5f2e29,_0x52338a){return function(_0x379776){if(_0x379776){var _0x24653a=typeof _0x52338a[_0x3a6e('0x27')]==='undefined'&&typeof _0x52338a[_0x3a6e('0x28')]===_0x3a6e('0x29');var _0x32eef7=_0x379776['count'];var _0x3ada30=_0x24653a?0x0:_0x52338a[_0x3a6e('0x27')];var _0x47543b=_0x24653a?_0x379776[_0x3a6e('0x2a')]:_0x52338a['offset']+_0x52338a['limit'];var _0x39943d;if(_0x47543b>=_0x32eef7){_0x47543b=_0x32eef7;_0x39943d=0xc8;}else{_0x39943d=0xce;}_0x5f2e29[_0x3a6e('0x24')](_0x39943d);return _0x5f2e29['set'](_0x3a6e('0x2b'),_0x3ada30+'-'+_0x47543b+'/'+_0x32eef7)[_0x3a6e('0x26')](_0x379776);}return null;};}function saveUpdates(_0x2a3dc1){return function(_0x124556){if(_0x124556){return _0x124556[_0x3a6e('0x2c')](_0x2a3dc1)[_0x3a6e('0x18')](function(_0x1b78ff){return _0x1b78ff;});}return null;};}function removeEntity(_0x4323ea){return function(_0x5228de){if(_0x5228de){return _0x5228de[_0x3a6e('0x2d')]()['then'](function(){_0x4323ea[_0x3a6e('0x24')](0xcc)[_0x3a6e('0x25')]();});}};}function handleEntityNotFound(_0x598e17){return function(_0x4ef2c2){if(!_0x4ef2c2){_0x598e17[_0x3a6e('0x23')](0x194);}return _0x4ef2c2;};}function handleError(_0xf28a69,_0x3082b2){_0x3082b2=_0x3082b2||0x1f4;return function(_0x657a9a){logger[_0x3a6e('0x1e')](_0x657a9a['stack']);if(_0x657a9a[_0x3a6e('0x2e')]){delete _0x657a9a['name'];}_0xf28a69[_0x3a6e('0x24')](_0x3082b2)[_0x3a6e('0x2f')](_0x657a9a);};}function getMustacheRender(_0x2680ea,_0x1d7e13){return Mustache[_0x3a6e('0x30')](_0x2680ea,_[_0x3a6e('0x31')](_0x1d7e13[_0x3a6e('0x32')],{'contact':_0x1d7e13['contact'],'message':_0x1d7e13[_0x3a6e('0x20')],'agent':_0x1d7e13[_0x3a6e('0x33')],'interaction':_0x1d7e13[_0x3a6e('0x34')],'account':_0x1d7e13[_0x3a6e('0x35')]}))||'';}exports[_0x3a6e('0x36')]=function(_0x4f74c5,_0x52b5e0){var _0x2cb3fb={};var _0x2be13b=_[_0x3a6e('0x37')](db[_0x3a6e('0x38')][_0x3a6e('0x39')],function(_0x289803){return{'name':_0x289803['fieldName'],'type':_0x289803[_0x3a6e('0x3a')][_0x3a6e('0x3b')]};});_0x2cb3fb=qs['getOptions'](_0x2be13b,_0x4f74c5);return interaction[_0x3a6e('0x3c')]('chat',_0x4f74c5[_0x3a6e('0x3d')],_0x4f74c5[_0x3a6e('0x3e')],_0x2cb3fb,_0x2be13b)[_0x3a6e('0x18')](respondWithFilteredResult(_0x52b5e0,_0x2cb3fb))[_0x3a6e('0x3f')](handleError(_0x52b5e0,null));};exports[_0x3a6e('0x40')]=function(_0x1fae97,_0x4306ac){var _0x2b7090={'raw':![],'where':{'id':_0x1fae97[_0x3a6e('0x41')]['id']}},_0x512f10={};_0x512f10[_0x3a6e('0x42')]=_['keys'](db[_0x3a6e('0x38')]['rawAttributes']);_0x512f10[_0x3a6e('0x3d')]=_[_0x3a6e('0x43')](_0x1fae97[_0x3a6e('0x3d')]);_0x512f10[_0x3a6e('0x44')]=_['intersection'](_0x512f10['model'],_0x512f10[_0x3a6e('0x3d')]);_0x2b7090['attributes']=_[_0x3a6e('0x45')](_0x512f10[_0x3a6e('0x42')],qs[_0x3a6e('0x46')](_0x1fae97[_0x3a6e('0x3d')]['fields']));_0x2b7090[_0x3a6e('0x47')]=_0x2b7090[_0x3a6e('0x47')][_0x3a6e('0x48')]?_0x2b7090[_0x3a6e('0x47')]:_0x512f10[_0x3a6e('0x42')];if(_0x1fae97[_0x3a6e('0x3d')][_0x3a6e('0x49')]){_0x2b7090[_0x3a6e('0x4a')]=[{'all':!![]}];}_0x2b7090=_[_0x3a6e('0x31')]({},_0x2b7090,_0x1fae97['options']);return db[_0x3a6e('0x38')][_0x3a6e('0x4b')](_0x2b7090)[_0x3a6e('0x18')](handleEntityNotFound(_0x4306ac,null))[_0x3a6e('0x18')](respondWithResult(_0x4306ac,null))[_0x3a6e('0x3f')](handleError(_0x4306ac,null));};exports[_0x3a6e('0x4c')]=function(_0x1529ec,_0x257a96){return db[_0x3a6e('0x38')][_0x3a6e('0x4c')](_0x1529ec['body'],{})[_0x3a6e('0x18')](respondWithResult(_0x257a96,0xc9))[_0x3a6e('0x3f')](handleError(_0x257a96,null));};exports[_0x3a6e('0x2c')]=function(_0x420a02,_0xc44381){if(_0x420a02[_0x3a6e('0x32')]['id']){delete _0x420a02[_0x3a6e('0x32')]['id'];}return db['ChatInteraction'][_0x3a6e('0x4b')]({'where':{'id':_0x420a02[_0x3a6e('0x41')]['id']}})[_0x3a6e('0x18')](handleEntityNotFound(_0xc44381,null))['then'](saveUpdates(_0x420a02['body'],null))[_0x3a6e('0x18')](respondWithResult(_0xc44381,null))[_0x3a6e('0x3f')](handleError(_0xc44381,null));};exports['destroy']=function(_0x508488,_0x578b95){return db[_0x3a6e('0x38')][_0x3a6e('0x4b')]({'where':{'id':_0x508488[_0x3a6e('0x41')]['id']}})[_0x3a6e('0x18')](handleEntityNotFound(_0x578b95,null))[_0x3a6e('0x18')](removeEntity(_0x578b95,null))[_0x3a6e('0x3f')](handleError(_0x578b95,null));};exports['describe']=function(_0x3623cb,_0x417786){return db['ChatInteraction'][_0x3a6e('0x4d')]()['then'](respondWithResult(_0x417786,null))[_0x3a6e('0x3f')](handleError(_0x417786,null));};exports['createVidaooSession']=function(_0x402124,_0x13c206){var _0x17109d=_0x402124[_0x3a6e('0x41')]['id'];var _0x27990a;var _0x4d3a74;var _0x292f68;return db['ChatInteraction']['findOne']({'where':{'id':_0x17109d}})[_0x3a6e('0x18')](function(_0x4e8e3c){_0x27990a=_0x4e8e3c;return db[_0x3a6e('0x4e')][_0x3a6e('0x4f')]({'where':{'id':_0x4e8e3c['ChatWebsiteId']},'attributes':['id',_0x3a6e('0x50'),_0x3a6e('0x51'),_0x3a6e('0x52'),_0x3a6e('0x53'),_0x3a6e('0x54')],'raw':!![]});})[_0x3a6e('0x18')](function(_0x1ae02c){if(_0x1ae02c&&_0x1ae02c[_0x3a6e('0x50')]&&_0x1ae02c[_0x3a6e('0x51')]){_0x4d3a74=_0x1ae02c;var _0x1812c8={'interaction':{'id':_0x17109d},'agent':{'id':_0x402124[_0x3a6e('0x3e')]['id'],'name':_0x402124[_0x3a6e('0x3e')][_0x3a6e('0x2e')],'fullname':_0x402124[_0x3a6e('0x3e')]['fullname'],'email':_0x402124[_0x3a6e('0x3e')]['email']},'contact':_0x402124[_0x3a6e('0x32')]['contact'],'account':_0x402124[_0x3a6e('0x32')][_0x3a6e('0x35')]};var _0x4fea08={'rejectUnauthorized':![],'method':'POST','url':_0x3a6e('0x55'),'headers':{'X-APIKEY':_0x1ae02c[_0x3a6e('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x402124[_0x3a6e('0x3e')][_0x3a6e('0x56')]],'buttons':null,'topic':_0x4d3a74[_0x3a6e('0x52')],'note':_[_0x3a6e('0x57')](_0x4d3a74[_0x3a6e('0x53')])?null:getMustacheRender(_0x4d3a74[_0x3a6e('0x53')],_0x1812c8),'metadata':null},'redirect':_0x3a6e('0x58'),'json':!![]};try{if(!_[_0x3a6e('0x57')](_0x4d3a74[_0x3a6e('0x54')])){var _0x2f4ad1=getMustacheRender(_0x4d3a74[_0x3a6e('0x54')],_0x1812c8);var _0x5acb0c=JSON[_0x3a6e('0x59')](_0x2f4ad1);_0x4fea08[_0x3a6e('0x32')]['metadata']=_0x5acb0c;}}catch(_0x56a64a){throw new db['Sequelize']['ValidationError'](_0x3a6e('0x5a'));}return rp(_0x4fea08);}else{throw new db[(_0x3a6e('0x5b'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x3a6e('0x18')](function(_0x49e77d){_0x292f68=_0x49e77d;if(_0x292f68['id']){var _0x509baf={'body':_0x292f68[_0x3a6e('0x5c')],'ChatWebsiteId':_0x4d3a74['id'],'ChatInteractionId':_0x27990a['id'],'direction':_0x3a6e('0x5d'),'UserId':_0x402124[_0x3a6e('0x3e')]['id']};return db[_0x3a6e('0x5e')]['create'](_0x509baf,{});}else{throw new db[(_0x3a6e('0x5b'))][(_0x3a6e('0x5f'))](_0x3a6e('0x60'));}})[_0x3a6e('0x18')](function(){return _0x27990a[_0x3a6e('0x61')]({'vidaooSessionId':_0x292f68['id']});})['then'](respondWithResult(_0x13c206,null))['catch'](handleError(_0x13c206,null));};exports[_0x3a6e('0x62')]=function(_0x571f1a,_0x25d86a){if(_0x571f1a['body']['id']){delete _0x571f1a[_0x3a6e('0x32')]['id'];}return db['ChatInteraction'][_0x3a6e('0x4b')]({'where':{'id':_0x571f1a[_0x3a6e('0x41')]['id']},'include':[{'model':db[_0x3a6e('0x63')],'as':_0x3a6e('0x64')}]})[_0x3a6e('0x18')](handleEntityNotFound(_0x25d86a,null))[_0x3a6e('0x18')](saveUpdates(_0x571f1a[_0x3a6e('0x32')],null))[_0x3a6e('0x18')](respondWithResult(_0x25d86a,null))['catch'](handleError(_0x25d86a,null));};exports[_0x3a6e('0x65')]=function(_0x3d2150,_0x44722f){if(_0x3d2150[_0x3a6e('0x32')]['id']){delete _0x3d2150[_0x3a6e('0x32')]['id'];}return db['ChatInteraction'][_0x3a6e('0x4b')]({'where':{'id':_0x3d2150[_0x3a6e('0x41')]['id']}})['then'](function(_0x21e0c8){if(!_0x21e0c8){logger[_0x3a6e('0x1e')](_0x3a6e('0x66'),'abandon',0x194,_0x3a6e('0x67'));_0x44722f['sendStatus'](0x194);}else{if(_0x21e0c8[_0x3a6e('0x68')]){throw new db[(_0x3a6e('0x5b'))][(_0x3a6e('0x5f'))](_0x3a6e('0x69'));}}return _0x21e0c8;})['then'](function(_0x4a6d3b){if(_0x4a6d3b){return _0x4a6d3b['update']({'closed':_0x3d2150[_0x3a6e('0x32')][_0x3a6e('0x6a')],'disposition':_0x3d2150['body'][_0x3a6e('0x6b')]})['then'](function(_0x57faad){return _0x57faad;});}})['then'](function(){return respondWithRpcPromise(_0x3a6e('0x6c'),_0x3a6e('0x65'),_0x3d2150[_0x3a6e('0x32')],client9004);})[_0x3a6e('0x18')](respondWithResult(_0x44722f,null))['catch'](handleError(_0x44722f,null));};exports['attachmentUpload']=function(_0x383f7b,_0x39e019){_0x383f7b[_0x3a6e('0x32')][_0x3a6e('0x2e')]=_0x383f7b['file'][_0x3a6e('0x6d')];_0x383f7b[_0x3a6e('0x32')]['basename']=_0x383f7b[_0x3a6e('0x6e')]['filename'];_0x383f7b[_0x3a6e('0x32')][_0x3a6e('0x3a')]=_0x383f7b[_0x3a6e('0x6e')][_0x3a6e('0x6f')];return db[_0x3a6e('0x70')][_0x3a6e('0x4c')](_0x383f7b[_0x3a6e('0x32')])[_0x3a6e('0x18')](respondWithResult(_0x39e019,0xc9))['catch'](handleError(_0x39e019,null));};exports[_0x3a6e('0x71')]=function(_0x4fefec,_0x5d44fa){return db[_0x3a6e('0x38')][_0x3a6e('0x4f')]({'where':{'id':_0x4fefec['params']['id']},'raw':!![]})[_0x3a6e('0x18')](handleEntityNotFound(_0x5d44fa,null))[_0x3a6e('0x18')](function(_0x4331ca){if(_0x4331ca){if(_0x4331ca[_0x3a6e('0x6a')]){return _0x5d44fa[_0x3a6e('0x24')](0x193)[_0x3a6e('0x26')]({'status':0x193,'message':_0x3a6e('0x72')});}return db['Attachment'][_0x3a6e('0x4f')]({'where':{'id':_0x4fefec['query']['attachId']},'raw':!![]})[_0x3a6e('0x18')](handleEntityNotFound(_0x5d44fa,null));}})[_0x3a6e('0x18')](function(_0x547d07){if(_0x547d07){var _0x36065c=_0x547d07[_0x3a6e('0x73')]!==null;var _0x5ae17b=path['join'](config[_0x3a6e('0x74')],_0x3a6e('0x75'));if(_0x36065c){_0x5ae17b=path[_0x3a6e('0x76')](_0x5ae17b,_0x3a6e('0x77'));}var _0x25ded0=path[_0x3a6e('0x76')](_0x5ae17b,_0x547d07['basename']);return _0x5d44fa[_0x3a6e('0x78')](_0x25ded0);}})['catch'](handleError(_0x5d44fa,null));};exports[_0x3a6e('0x79')]=function(_0x3b169f,_0x3b2888){var _0x28f8cf=null;var _0x59ee6a=null;var _0x3db094=null;if(_0x3b169f[_0x3a6e('0x32')]['id']){delete _0x3b169f[_0x3a6e('0x32')]['id'];}if(_0x3b169f[_0x3a6e('0x32')][_0x3a6e('0x7a')]){_0x3db094=path[_0x3a6e('0x76')](config['root'],_0x3a6e('0x7b'),util[_0x3a6e('0x7c')]('transcript-%s.txt',Date['now']()));_0x3b169f['body'][_0x3a6e('0x7d')]=_0x3db094;}return db[_0x3a6e('0x38')][_0x3a6e('0x4b')]({'where':{'id':_0x3b169f[_0x3a6e('0x41')]['id']},'include':[{'model':db[_0x3a6e('0x5e')],'as':_0x3a6e('0x7e'),'include':[{'model':db[_0x3a6e('0x7f')],'as':'User'}]}]})[_0x3a6e('0x18')](handleEntityNotFound(_0x3b2888,null))[_0x3a6e('0x18')](saveUpdates(_0x3b169f[_0x3a6e('0x32')],null))[_0x3a6e('0x18')](function(_0x3b043c){if(_0x3b043c){_0x28f8cf=_0x3b043c;return db['ChatWebsite']['find']({'where':{'id':_0x28f8cf[_0x3a6e('0x80')]}});}})[_0x3a6e('0x18')](function(_0x5478c0){if(_0x5478c0){_0x59ee6a=_0x5478c0;return db[_0x3a6e('0x63')][_0x3a6e('0x4b')]({'where':{'id':_0x28f8cf['ContactId']}});}})[_0x3a6e('0x18')](function(_0x19676b){if(_0x19676b){if(_0x3db094){var _0x5aed5a=null;for(var _0x2c547c=0x1;_0x2c547c<_0x28f8cf[_0x3a6e('0x7e')][_0x3a6e('0x48')];++_0x2c547c){_0x5aed5a=_0x28f8cf[_0x3a6e('0x7e')][_0x2c547c];var _0x4295d7=_0x5aed5a[_0x3a6e('0x68')]?util[_0x3a6e('0x7c')](_0x3a6e('0x81'),_0x59ee6a[_0x3a6e('0x82')],_0x5aed5a[_0x3a6e('0x68')]):'System';var _0x392f19=_0x3b169f[_0x3a6e('0x32')]['customer']||util[_0x3a6e('0x7c')](_0x3a6e('0x81'),_0x3a6e('0x83'),_0x5aed5a[_0x3a6e('0x84')]);switch(_0x59ee6a['agentIdentifier']){case _0x3a6e('0x85'):_0x4295d7=_0x5aed5a[_0x3a6e('0x68')]?util[_0x3a6e('0x7c')](_0x3a6e('0x81'),_0x59ee6a[_0x3a6e('0x82')],_0x5aed5a[_0x3a6e('0x68')]):_0x3a6e('0x86');break;case _0x3a6e('0x87'):_0x4295d7=_0x5aed5a[_0x3a6e('0x68')]?_0x5aed5a[_0x3a6e('0x7f')][_0x3a6e('0x88')]||_0x5aed5a['User'][_0x3a6e('0x89')]:'System';break;case _0x3a6e('0x8a'):_0x4295d7=_0x5aed5a[_0x3a6e('0x68')]?_0x5aed5a[_0x3a6e('0x7f')][_0x3a6e('0x89')]:_0x3a6e('0x86');break;default:_0x4295d7=_0x5aed5a['UserId']?util[_0x3a6e('0x7c')]('%s%d',_0x59ee6a[_0x3a6e('0x82')],_0x5aed5a['UserId']):_0x3a6e('0x86');}var _0x555f0d=util[_0x3a6e('0x7c')](_0x3a6e('0x8b'),moment(_0x5aed5a[_0x3a6e('0x8c')])[_0x3a6e('0x7c')](_0x3a6e('0x8d')),_0x5aed5a['direction']==='in'?_0x392f19:_0x4295d7,_0x5aed5a['body']);if(!_0x5aed5a['secret']){fs['appendFileSync'](_0x3db094,_0x555f0d);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3a6e('0x8e')],'as':_0x3a6e('0x8f'),'raw':!![],'include':[{'model':db[_0x3a6e('0x90')],'as':_0x3a6e('0x90'),'raw':!![]}]}]});}}})[_0x3a6e('0x18')](function(_0x252b97){if(!_0x252b97||!_0x252b97[_0x3a6e('0x8f')]||!_0x3b169f[_0x3a6e('0x32')])return _0x28f8cf;var _0x27957a=_0x252b97[_0x3a6e('0x91')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x27957a,'message':{'from':util[_0x3a6e('0x7c')](_0x3a6e('0x92'),_0x252b97[_0x3a6e('0x2e')],_0x252b97[_0x3a6e('0x56')]||_0x252b97[_0x3a6e('0x8f')][_0x3a6e('0x3e')]),'to':_0x3b169f['body'][_0x3a6e('0x7a')],'subject':'Mail\x20Transcript','text':util['format'](_0x3a6e('0x93'),_0x3b169f[_0x3a6e('0x32')]['mailTranscript']),'attachments':[{'path':_0x3db094}]}})[_0x3a6e('0x18')](function(){return _0x28f8cf;})[_0x3a6e('0x3f')](function(_0x13d46d){logger[_0x3a6e('0x1e')](_0x13d46d);});})['then'](respondWithStatusCode(_0x3b2888,0xc8))['catch'](handleError(_0x3b2888,null));};exports[_0x3a6e('0x94')]=function(_0x23f555,_0xe214b4){return db[_0x3a6e('0x5e')][_0x3a6e('0x4b')]({'where':{'id':_0x23f555[_0x3a6e('0x41')]['id']}})[_0x3a6e('0x18')](handleEntityNotFound(_0xe214b4,null))[_0x3a6e('0x18')](function(_0x2b2112){if(_0x2b2112){return _0x2b2112['addMessage'](_0x23f555['body'][_0x3a6e('0x95')],_['omit'](_0x23f555[_0x3a6e('0x32')],['ids','id'])||{});}})[_0x3a6e('0x18')](respondWithResult(_0xe214b4,null))['catch'](handleError(_0xe214b4,null));};exports[_0x3a6e('0x96')]=function(_0x252c8a,_0x40ef33){var _0x7605fc={'raw':![],'where':{}};var _0x363409={};var _0x2f5591={'count':0x0,'rows':[]};return db[_0x3a6e('0x38')][_0x3a6e('0x4f')]({'where':{'id':_0x252c8a['params']['id']}})['then'](handleEntityNotFound(_0x40ef33,null))[_0x3a6e('0x18')](function(_0x2d5cdf){if(_0x2d5cdf){_0x363409['model']=_['keys'](db[_0x3a6e('0x5e')][_0x3a6e('0x39')]);_0x363409[_0x3a6e('0x3d')]=_['keys'](_0x252c8a[_0x3a6e('0x3d')]);_0x363409[_0x3a6e('0x44')]=_['intersection'](_0x363409['model'],_0x363409[_0x3a6e('0x3d')]);_0x7605fc[_0x3a6e('0x47')]=_[_0x3a6e('0x45')](_0x363409[_0x3a6e('0x42')],qs[_0x3a6e('0x46')](_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x46')]));_0x7605fc[_0x3a6e('0x47')]=_0x7605fc['attributes'][_0x3a6e('0x48')]?_0x7605fc[_0x3a6e('0x47')]:_0x363409[_0x3a6e('0x42')];if(!_0x252c8a[_0x3a6e('0x3d')]['hasOwnProperty']('nolimit')){_0x7605fc[_0x3a6e('0x28')]=qs[_0x3a6e('0x28')](_0x252c8a[_0x3a6e('0x3d')]['limit']);_0x7605fc[_0x3a6e('0x27')]=qs[_0x3a6e('0x27')](_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x27')]);}_0x7605fc['order']=qs[_0x3a6e('0x97')](_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x97')]);_0x7605fc['where']=qs['filters'](_[_0x3a6e('0x98')](_0x252c8a['query'],_0x363409[_0x3a6e('0x44')]));_0x7605fc[_0x3a6e('0x99')][_0x3a6e('0x9a')]=_0x2d5cdf['id'];if(_0x252c8a['query'][_0x3a6e('0x9b')]){_0x7605fc[_0x3a6e('0x99')]=_[_0x3a6e('0x31')](_0x7605fc['where'],{'$or':_[_0x3a6e('0x37')](_0x7605fc['attributes'],function(_0x413bb9){var _0x4c8e4a={};_0x4c8e4a[_0x413bb9]={'$like':'%'+_0x252c8a['query'][_0x3a6e('0x9b')]+'%'};return _0x4c8e4a;})});}if(_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x9c')]){var _0x186bf4=_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x9c')][_0x3a6e('0x9d')](',');var _0x18d87a={};_0x18d87a[_0x186bf4[0x0]]={'$gte':moment(_0x186bf4[0x1])[_0x3a6e('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7605fc[_0x3a6e('0x99')]=_['merge'](_0x7605fc['where'],_0x18d87a);}_0x7605fc=_[_0x3a6e('0x31')]({},_0x7605fc,_0x252c8a[_0x3a6e('0x9e')]);return db[_0x3a6e('0x5e')][_0x3a6e('0x2a')]({'where':_0x7605fc[_0x3a6e('0x99')]})[_0x3a6e('0x18')](function(_0x40fc4b){_0x2f5591[_0x3a6e('0x2a')]=_0x40fc4b;if(_0x252c8a[_0x3a6e('0x3d')][_0x3a6e('0x49')]){_0x7605fc['include']=[{'all':!![]}];}return db[_0x3a6e('0x5e')][_0x3a6e('0x3c')](_0x7605fc);})['then'](function(_0x4b092a){_0x2f5591['rows']=_0x4b092a;return _0x2f5591;});}})[_0x3a6e('0x18')](respondWithFilteredResult(_0x40ef33,_0x7605fc))[_0x3a6e('0x3f')](handleError(_0x40ef33,null));};exports['getMyMessages']=function(_0x44dbe3,_0x256487){var _0x4c1b30={'where':{}},_0x226988={},_0x462caf={'count':0x0,'rows':[]};return db[_0x3a6e('0x38')][_0x3a6e('0x4f')]({'where':{'id':_0x44dbe3['params']['id']}})[_0x3a6e('0x18')](handleEntityNotFound(_0x256487,null))[_0x3a6e('0x18')](function(_0x19f1ee){if(_0x19f1ee){_0x226988['model']=_[_0x3a6e('0x43')](db['ChatMessage']['rawAttributes']);_0x226988[_0x3a6e('0x3d')]=_['keys'](_0x44dbe3[_0x3a6e('0x3d')]);_0x226988[_0x3a6e('0x44')]=_[_0x3a6e('0x45')](_0x226988[_0x3a6e('0x42')],_0x226988[_0x3a6e('0x3d')]);_0x4c1b30[_0x3a6e('0x47')]=_[_0x3a6e('0x45')](_0x226988[_0x3a6e('0x42')],qs[_0x3a6e('0x46')](_0x44dbe3[_0x3a6e('0x3d')][_0x3a6e('0x46')]));_0x4c1b30['attributes']=_0x4c1b30[_0x3a6e('0x47')]['length']?_0x4c1b30[_0x3a6e('0x47')]:_0x226988['model'];if(!_0x44dbe3['query'][_0x3a6e('0x9f')](_0x3a6e('0xa0'))){_0x4c1b30[_0x3a6e('0x28')]=qs['limit'](_0x44dbe3['query']['limit']);_0x4c1b30[_0x3a6e('0x27')]=qs['offset'](_0x44dbe3[_0x3a6e('0x3d')][_0x3a6e('0x27')]);}_0x4c1b30['order']=qs[_0x3a6e('0x97')](_0x44dbe3[_0x3a6e('0x3d')][_0x3a6e('0x97')]);_0x4c1b30[_0x3a6e('0x99')]=qs[_0x3a6e('0x44')](_[_0x3a6e('0x98')](_0x44dbe3['query'],_0x226988[_0x3a6e('0x44')]));_0x4c1b30['where'][_0x3a6e('0x9a')]=_0x19f1ee['id'];if(_0x44dbe3[_0x3a6e('0x3d')][_0x3a6e('0x9b')]){_0x4c1b30[_0x3a6e('0x99')]=_[_0x3a6e('0x31')](_0x4c1b30[_0x3a6e('0x99')],{'$or':_[_0x3a6e('0x37')](_0x4c1b30[_0x3a6e('0x47')],function(_0x17d6e0){var _0x413375={};_0x413375[_0x17d6e0]={'$like':'%'+_0x44dbe3['query']['filter']+'%'};return _0x413375;})});}_0x4c1b30['where'][_0x3a6e('0xa1')]=![];if(_0x44dbe3[_0x3a6e('0x3d')]['id']){_0x4c1b30[_0x3a6e('0x99')]['id']={'$gt':_0x44dbe3['query']['id']};}_0x4c1b30=_[_0x3a6e('0x31')]({},_0x4c1b30,_0x44dbe3[_0x3a6e('0x9e')]);return db[_0x3a6e('0x5e')]['count']({'where':_0x4c1b30[_0x3a6e('0x99')]})['then'](function(_0x3bb1b2){_0x462caf[_0x3a6e('0x2a')]=_0x3bb1b2;_0x4c1b30[_0x3a6e('0x4a')]=[];if(_0x44dbe3[_0x3a6e('0x3d')][_0x3a6e('0xa2')]){_0x4c1b30[_0x3a6e('0x4a')]['push']({'model':db[_0x3a6e('0x7f')],'as':'User','attributes':['id',_0x3a6e('0x89'),_0x3a6e('0x88')]});}if(_0x44dbe3[_0x3a6e('0x3d')]['includeAll']){_0x4c1b30[_0x3a6e('0x4a')]=[{'all':!![]}];}return db[_0x3a6e('0x5e')]['findAll'](_0x4c1b30);})['then'](function(_0x1e0cd8){_0x462caf[_0x3a6e('0xa3')]=_0x1e0cd8;return _0x462caf;});}})[_0x3a6e('0x18')](respondWithFilteredResult(_0x256487,_0x4c1b30))[_0x3a6e('0x3f')](handleError(_0x256487,null));};exports[_0x3a6e('0xa4')]=function(_0x1c7977,_0x1978f9){return db[_0x3a6e('0x38')][_0x3a6e('0x4b')]({'where':{'id':_0x1c7977[_0x3a6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1978f9,null))['then'](function(_0x4f48c3){if(_0x4f48c3){return _0x4f48c3[_0x3a6e('0xa5')](_0x1c7977[_0x3a6e('0x32')]['ids'],_[_0x3a6e('0xa6')](_0x1c7977['body'],[_0x3a6e('0x95'),'id'])||{})[_0x3a6e('0xa7')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3a6e('0x2e'),_0x3a6e('0xa8')],'where':{'id':_0x1c7977[_0x3a6e('0x32')][_0x3a6e('0x95')]}});})[_0x3a6e('0x18')](function(_0xf9c8ab){socket[_0x3a6e('0xa9')](_0x3a6e('0xaa'),{'id':Number(_0x1c7977['params']['id']),'tags':_0xf9c8ab||[]});return{'id':Number(_0x1c7977[_0x3a6e('0x41')]['id']),'tags':_0xf9c8ab||[]};});}})['then'](respondWithResult(_0x1978f9,null))[_0x3a6e('0x3f')](handleError(_0x1978f9,null));};exports['removeTags']=function(_0x2cae05,_0x580ca3){return db[_0x3a6e('0x38')][_0x3a6e('0x4b')]({'where':{'id':_0x2cae05[_0x3a6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x580ca3,null))[_0x3a6e('0x18')](function(_0x3b12fd){if(_0x3b12fd){return _0x3b12fd[_0x3a6e('0xab')](_0x2cae05[_0x3a6e('0x3d')][_0x3a6e('0x95')]);}})['then'](respondWithStatusCode(_0x580ca3,null))[_0x3a6e('0x3f')](handleError(_0x580ca3,null));};exports[_0x3a6e('0x78')]=function(_0x3ea852,_0x115822){var _0x1124d7=moment()[_0x3a6e('0xac')]()[_0x3a6e('0xad')]();var _0x247c7b=path[_0x3a6e('0x76')](config[_0x3a6e('0x74')],_0x3a6e('0xae'),_0x3a6e('0xaf'),_0x3a6e('0xb0'));var _0x56efb2=path[_0x3a6e('0x76')](config[_0x3a6e('0x74')],_0x3a6e('0xae'),_0x3a6e('0xaf'),_0x3a6e('0xb1'));var _0x30cefc=path[_0x3a6e('0x76')](_0x247c7b,_0x1124d7);var _0x29da7b=util[_0x3a6e('0x7c')]('transcript-%d-%s.zip',_0x3ea852['params']['id'],_0x1124d7);var _0x4f9b40=path[_0x3a6e('0x76')](_0x247c7b,_0x29da7b);var _0xd4f9ee=[];_0xd4f9ee[_0x3a6e('0xb2')]({'model':db[_0x3a6e('0x7f')],'as':_0x3a6e('0x7f'),'attributes':['id',_0x3a6e('0x89')],'raw':!![]});_0xd4f9ee[_0x3a6e('0xb2')]({'model':db[_0x3a6e('0x63')],'as':_0x3a6e('0x64'),'attributes':['id',_0x3a6e('0xb3'),_0x3a6e('0xb4')],'raw':!![]});if(_0x3ea852[_0x3a6e('0x3d')][_0x3a6e('0xb1')]){_0xd4f9ee[_0x3a6e('0xb2')]({'model':db[_0x3a6e('0x70')],'as':_0x3a6e('0x70'),'raw':!![]});}var _0xfc4f00=[{'model':db[_0x3a6e('0x5e')],'as':'Messages','attributes':['id',_0x3a6e('0x32'),_0x3a6e('0x8c'),_0x3a6e('0xb5'),_0x3a6e('0xa1'),_0x3a6e('0xb6')],'include':_0xd4f9ee}];_0xfc4f00[_0x3a6e('0xb2')]({'model':db[_0x3a6e('0x4e')],'as':_0x3a6e('0xb7'),'attributes':['id',_0x3a6e('0x2e')]});_0xfc4f00[_0x3a6e('0xb2')]({'model':db[_0x3a6e('0x7f')],'as':_0x3a6e('0xb8'),'attributes':['id',_0x3a6e('0x89')]});return db[_0x3a6e('0x38')][_0x3a6e('0x4b')]({'where':{'id':_0x3ea852['params']['id']},'include':_0xfc4f00})[_0x3a6e('0x18')](handleEntityNotFound(_0x115822,null))['then'](function(_0x3f0e72){if(_0x3f0e72){var _0x3ea3cc=_0x3f0e72['get']({'plain':!![]});fs[_0x3a6e('0xb9')](_0x30cefc);var _0x42d244={'channel':_0x3a6e('0xba'),'account':_0x3ea3cc[_0x3a6e('0xb7')][_0x3a6e('0x2e')],'agent':_0x3ea3cc['Owner']?_0x3ea3cc[_0x3a6e('0xb8')][_0x3a6e('0x89')]:'N.A.','createdAt':moment(_0x3ea3cc['createdAt'])[_0x3a6e('0x7c')](_0x3a6e('0xbb'))[_0x3a6e('0xad')](),'closedAt':_0x3ea3cc[_0x3a6e('0x6a')]?moment(_0x3ea3cc['closedAt'])[_0x3a6e('0x7c')](_0x3a6e('0xbb'))[_0x3a6e('0xad')]():'','disposition':_0x3ea3cc[_0x3a6e('0x6b')],'chatInfo':{'browser':_0x3ea3cc[_0x3a6e('0xbc')],'os':_0x3ea3cc[_0x3a6e('0xbd')],'referer':_0x3ea3cc[_0x3a6e('0xbe')],'customerIp':_0x3ea3cc['customerIp'],'customerPort':_0x3ea3cc['customerPort']?_0x3ea3cc['customerPort']:_0x3a6e('0xbf')},'messages':_(_0x3ea3cc[_0x3a6e('0x7e')])[_0x3a6e('0xc0')]()[_0x3a6e('0x9b')]({'secret':![]})[_0x3a6e('0x37')](function(_0x5d33a3){if(_0x5d33a3[_0x3a6e('0x70')]){var _0x1ea433=path[_0x3a6e('0x76')](_0x56efb2,_0x5d33a3['Attachment'][_0x3a6e('0xc1')]);if(fs['existsSync'](_0x1ea433)){fs[_0x3a6e('0xc2')](_0x1ea433)[_0x3a6e('0xc3')](fs['createWriteStream'](path[_0x3a6e('0x76')](_0x30cefc,_0x5d33a3[_0x3a6e('0x70')][_0x3a6e('0xc1')])));}}return{'date':moment(_0x5d33a3[_0x3a6e('0x8c')])[_0x3a6e('0x7c')](_0x3a6e('0xbb'))[_0x3a6e('0xad')](),'sender':_0x5d33a3[_0x3a6e('0xb5')]==='out'?_0x5d33a3[_0x3a6e('0x7f')]?_0x5d33a3[_0x3a6e('0x7f')][_0x3a6e('0x89')]:'System':_0x5d33a3[_0x3a6e('0x64')][_0x3a6e('0xb3')]+(_0x5d33a3[_0x3a6e('0x64')]['lastName']?'\x20'+_0x5d33a3['Contact'][_0x3a6e('0xb4')]:''),'body':_0x5d33a3[_0x3a6e('0x70')]?_0x5d33a3[_0x3a6e('0x70')][_0x3a6e('0xc1')]:_0x5d33a3[_0x3a6e('0x32')],'direction':_0x5d33a3[_0x3a6e('0xb5')]===_0x3a6e('0x5d')?'A':'C','secret':_0x5d33a3['secret'],'read':_0x5d33a3['read'],'attachment':_0x5d33a3[_0x3a6e('0x70')]};})['value']()};return ejs['renderFile'](path[_0x3a6e('0x76')](config[_0x3a6e('0x74')],'server','views',_0x3a6e('0xc4')),{'interaction':_0x42d244})['then'](function(_0x311759){var _0x5cb74d=path[_0x3a6e('0x76')](_0x30cefc,_0x3a6e('0xc5')+_0x3ea3cc['id']+'-'+_0x1124d7+_0x3a6e('0xc6'));var _0x1c5c33={'path':_0x5cb74d,'channel':'Chat','interactionId':_0x3ea3cc['id']};return pdf[_0x3a6e('0xc7')](_0x311759,_0x1c5c33);})['then'](function(){return new Promise(function(_0x30e9e4,_0x40dfa6){zipdir(_0x30cefc,{'saveTo':_0x4f9b40},function(_0xd5ae38,_0x11cc7c){if(_0xd5ae38)return _0x40dfa6(_0xd5ae38);return _0x30e9e4(_0x11cc7c);});})[_0x3a6e('0x18')](function(){return new BPromise(function(_0x20d592,_0x366d68){rimraf(_0x30cefc,function(_0x65be1c){if(_0x65be1c)_0x366d68(_0x65be1c);return _0x20d592();});});})[_0x3a6e('0x18')](function(){return _0x115822[_0x3a6e('0x78')](_0x4f9b40,_0x29da7b,function(_0x51ac86){if(_0x51ac86){logger[_0x3a6e('0x1e')]('err',_0x51ac86);}else{fs[_0x3a6e('0xc8')](_0x4f9b40);}});});});}else{return _0x115822['sendStatus'](0xc8);}})[_0x3a6e('0x3f')](handleError(_0x115822,null));}; \ No newline at end of file +var _0xf1c3=['customerPort','N.A.','tail','existsSync','createReadStream','pipe','out','lastName','value','renderFile','views','createPdfFromHTML','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','user','show','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','originalname','basename','filename','file','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','User','Messages','format','%s%d','agentAlias','customer','agentIdentifier','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','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','ChatMessage','ids','getMessages','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','order','push','addTags','setTags','omit','emit','chatInteractionTags:save','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','read','Owner','get','mkdirSync','Chat','Account','browserName','osName','referer'];(function(_0x4c0370,_0x6087f5){var _0x542c7b=function(_0xde49a1){while(--_0xde49a1){_0x4c0370['push'](_0x4c0370['shift']());}};_0x542c7b(++_0x6087f5);}(_0xf1c3,0x1a3));var _0x3f1c=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xf1c3[_0x1f7839];return _0x36b42e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3f1c('0x0'));var rp=require(_0x3f1c('0x1'));var moment=require(_0x3f1c('0x2'));var BPromise=require(_0x3f1c('0x3'));var Mustache=require(_0x3f1c('0x4'));var util=require(_0x3f1c('0x5'));var path=require(_0x3f1c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x3f1c('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3f1c('0x8'));var pdf=require(_0x3f1c('0x9'));var logger=require(_0x3f1c('0xa'))(_0x3f1c('0xb'));var config=require('../../config/environment');var db=require(_0x3f1c('0xc'))['db'];config[_0x3f1c('0xd')]=_[_0x3f1c('0xe')](config[_0x3f1c('0xd')],{'host':_0x3f1c('0xf'),'port':0x18eb});var socket=require(_0x3f1c('0x10'))(new Redis(config[_0x3f1c('0xd')]));require(_0x3f1c('0x11'))[_0x3f1c('0x12')](socket);var jayson=require(_0x3f1c('0x13'));var client=jayson['client'][_0x3f1c('0x14')]({'port':0x232b});var client9004=jayson[_0x3f1c('0x15')][_0x3f1c('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x21cc42,_0x38caea,_0x4afbbf,_0x44c057){return new BPromise(function(_0x5ce115,_0x542483){var _0x38a23c=_0x44c057||client;return _0x38a23c[_0x3f1c('0x16')](_0x21cc42,_0x4afbbf)[_0x3f1c('0x17')](function(_0x1ee87f){logger[_0x3f1c('0x18')](_0x3f1c('0x19'),_0x38caea,'request\x20sent');logger[_0x3f1c('0x1a')](_0x3f1c('0x1b'),_0x38caea,_0x3f1c('0x1c'),JSON[_0x3f1c('0x1d')](_0x1ee87f));if(_0x1ee87f['error']){if(_0x1ee87f['error'][_0x3f1c('0x1e')]===0x1f4){logger[_0x3f1c('0x1f')](_0x3f1c('0x19'),_0x38caea,_0x1ee87f[_0x3f1c('0x1f')]['message']);return _0x542483(_0x1ee87f[_0x3f1c('0x1f')][_0x3f1c('0x20')]);}logger[_0x3f1c('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x38caea,_0x1ee87f[_0x3f1c('0x1f')][_0x3f1c('0x20')]);return _0x5ce115(_0x1ee87f[_0x3f1c('0x1f')][_0x3f1c('0x20')]);}else{logger[_0x3f1c('0x18')](_0x3f1c('0x19'),_0x38caea,_0x3f1c('0x1c'));_0x5ce115(_0x1ee87f[_0x3f1c('0x21')]['message']);}})[_0x3f1c('0x22')](function(_0x237901){logger['error'](_0x3f1c('0x19'),_0x38caea,_0x237901);_0x542483(_0x237901);});});}function respondWithStatusCode(_0x5b24f6,_0x45d71a){_0x45d71a=_0x45d71a||0xcc;return function(_0x17094b){if(_0x17094b){return _0x5b24f6[_0x3f1c('0x23')](_0x45d71a);}return _0x5b24f6[_0x3f1c('0x24')](_0x45d71a)[_0x3f1c('0x25')]();};}function respondWithResult(_0x5b7118,_0x116c05){_0x116c05=_0x116c05||0xc8;return function(_0x167276){if(_0x167276){return _0x5b7118[_0x3f1c('0x24')](_0x116c05)[_0x3f1c('0x26')](_0x167276);}};}function respondWithFilteredResult(_0x3b10d3,_0x407f0f){return function(_0x13ceb7){if(_0x13ceb7){var _0x4bc735=typeof _0x407f0f[_0x3f1c('0x27')]==='undefined'&&typeof _0x407f0f[_0x3f1c('0x28')]==='undefined';var _0x5379f1=_0x13ceb7[_0x3f1c('0x29')];var _0x2130b1=_0x4bc735?0x0:_0x407f0f[_0x3f1c('0x27')];var _0x3af805=_0x4bc735?_0x13ceb7[_0x3f1c('0x29')]:_0x407f0f[_0x3f1c('0x27')]+_0x407f0f['limit'];var _0x5bb16f;if(_0x3af805>=_0x5379f1){_0x3af805=_0x5379f1;_0x5bb16f=0xc8;}else{_0x5bb16f=0xce;}_0x3b10d3[_0x3f1c('0x24')](_0x5bb16f);return _0x3b10d3['set'](_0x3f1c('0x2a'),_0x2130b1+'-'+_0x3af805+'/'+_0x5379f1)[_0x3f1c('0x26')](_0x13ceb7);}return null;};}function saveUpdates(_0x5546f0){return function(_0x23b53d){if(_0x23b53d){return _0x23b53d[_0x3f1c('0x2b')](_0x5546f0)[_0x3f1c('0x17')](function(_0x345ed6){return _0x345ed6;});}return null;};}function removeEntity(_0x105979){return function(_0xc971ed){if(_0xc971ed){return _0xc971ed[_0x3f1c('0x2c')]()['then'](function(){_0x105979[_0x3f1c('0x24')](0xcc)[_0x3f1c('0x25')]();});}};}function handleEntityNotFound(_0x14b733){return function(_0x472766){if(!_0x472766){_0x14b733[_0x3f1c('0x23')](0x194);}return _0x472766;};}function handleError(_0x42ad59,_0x1302e5){_0x1302e5=_0x1302e5||0x1f4;return function(_0x1caa56){logger[_0x3f1c('0x1f')](_0x1caa56[_0x3f1c('0x2d')]);if(_0x1caa56[_0x3f1c('0x2e')]){delete _0x1caa56[_0x3f1c('0x2e')];}_0x42ad59['status'](_0x1302e5)[_0x3f1c('0x2f')](_0x1caa56);};}function getMustacheRender(_0x1dce1f,_0x2f3b6b){return Mustache[_0x3f1c('0x30')](_0x1dce1f,_[_0x3f1c('0x31')](_0x2f3b6b[_0x3f1c('0x32')],{'contact':_0x2f3b6b[_0x3f1c('0x33')],'message':_0x2f3b6b[_0x3f1c('0x20')],'agent':_0x2f3b6b[_0x3f1c('0x34')],'interaction':_0x2f3b6b['interaction'],'account':_0x2f3b6b[_0x3f1c('0x35')]}))||'';}exports[_0x3f1c('0x36')]=function(_0x3f3ca1,_0x1cad5b){var _0x130fbe={};var _0x4d3f3c=_[_0x3f1c('0x37')](db[_0x3f1c('0x38')]['rawAttributes'],function(_0x5e62e7){return{'name':_0x5e62e7[_0x3f1c('0x39')],'type':_0x5e62e7[_0x3f1c('0x3a')][_0x3f1c('0x3b')]};});_0x130fbe=qs[_0x3f1c('0x3c')](_0x4d3f3c,_0x3f3ca1);return interaction[_0x3f1c('0x3d')](_0x3f1c('0x3e'),_0x3f3ca1['query'],_0x3f3ca1[_0x3f1c('0x3f')],_0x130fbe,_0x4d3f3c)[_0x3f1c('0x17')](respondWithFilteredResult(_0x1cad5b,_0x130fbe))['catch'](handleError(_0x1cad5b,null));};exports[_0x3f1c('0x40')]=function(_0x5242ce,_0x3ae0ad){var _0x2d544d={'raw':![],'where':{'id':_0x5242ce['params']['id']}},_0x3b2b90={};_0x3b2b90['model']=_['keys'](db[_0x3f1c('0x38')][_0x3f1c('0x41')]);_0x3b2b90[_0x3f1c('0x42')]=_[_0x3f1c('0x43')](_0x5242ce[_0x3f1c('0x42')]);_0x3b2b90[_0x3f1c('0x44')]=_[_0x3f1c('0x45')](_0x3b2b90['model'],_0x3b2b90['query']);_0x2d544d['attributes']=_[_0x3f1c('0x45')](_0x3b2b90[_0x3f1c('0x46')],qs[_0x3f1c('0x47')](_0x5242ce[_0x3f1c('0x42')][_0x3f1c('0x47')]));_0x2d544d[_0x3f1c('0x48')]=_0x2d544d[_0x3f1c('0x48')][_0x3f1c('0x49')]?_0x2d544d['attributes']:_0x3b2b90[_0x3f1c('0x46')];if(_0x5242ce[_0x3f1c('0x42')][_0x3f1c('0x4a')]){_0x2d544d['include']=[{'all':!![]}];}_0x2d544d=_['merge']({},_0x2d544d,_0x5242ce['options']);return db[_0x3f1c('0x38')][_0x3f1c('0x4b')](_0x2d544d)[_0x3f1c('0x17')](handleEntityNotFound(_0x3ae0ad,null))[_0x3f1c('0x17')](respondWithResult(_0x3ae0ad,null))[_0x3f1c('0x22')](handleError(_0x3ae0ad,null));};exports[_0x3f1c('0x4c')]=function(_0x36e83b,_0xfe59c7){return db['ChatInteraction']['create'](_0x36e83b[_0x3f1c('0x32')],{})[_0x3f1c('0x17')](respondWithResult(_0xfe59c7,0xc9))[_0x3f1c('0x22')](handleError(_0xfe59c7,null));};exports[_0x3f1c('0x2b')]=function(_0x39421b,_0x54e419){if(_0x39421b[_0x3f1c('0x32')]['id']){delete _0x39421b[_0x3f1c('0x32')]['id'];}return db[_0x3f1c('0x38')]['find']({'where':{'id':_0x39421b[_0x3f1c('0x4d')]['id']}})[_0x3f1c('0x17')](handleEntityNotFound(_0x54e419,null))[_0x3f1c('0x17')](saveUpdates(_0x39421b[_0x3f1c('0x32')],null))[_0x3f1c('0x17')](respondWithResult(_0x54e419,null))[_0x3f1c('0x22')](handleError(_0x54e419,null));};exports[_0x3f1c('0x2c')]=function(_0x5bf757,_0x463f90){return db[_0x3f1c('0x38')][_0x3f1c('0x4b')]({'where':{'id':_0x5bf757[_0x3f1c('0x4d')]['id']}})[_0x3f1c('0x17')](handleEntityNotFound(_0x463f90,null))['then'](removeEntity(_0x463f90,null))[_0x3f1c('0x22')](handleError(_0x463f90,null));};exports[_0x3f1c('0x4e')]=function(_0x129d9d,_0xa8f960){return db[_0x3f1c('0x38')][_0x3f1c('0x4e')]()[_0x3f1c('0x17')](respondWithResult(_0xa8f960,null))['catch'](handleError(_0xa8f960,null));};exports[_0x3f1c('0x4f')]=function(_0x374f58,_0x2c507f){var _0x3769aa=_0x374f58['params']['id'];var _0x26713e;var _0x477a23;var _0xd3307d;return db[_0x3f1c('0x38')][_0x3f1c('0x50')]({'where':{'id':_0x3769aa}})[_0x3f1c('0x17')](function(_0x2ba3bd){_0x26713e=_0x2ba3bd;return db[_0x3f1c('0x51')][_0x3f1c('0x50')]({'where':{'id':_0x2ba3bd[_0x3f1c('0x52')]},'attributes':['id',_0x3f1c('0x53'),_0x3f1c('0x54'),'vidaooTopic',_0x3f1c('0x55'),_0x3f1c('0x56')],'raw':!![]});})[_0x3f1c('0x17')](function(_0x89aaa){if(_0x89aaa&&_0x89aaa['vidaooApiKey']&&_0x89aaa[_0x3f1c('0x54')]){_0x477a23=_0x89aaa;var _0x1d0d81={'interaction':{'id':_0x3769aa},'agent':{'id':_0x374f58[_0x3f1c('0x3f')]['id'],'name':_0x374f58['user'][_0x3f1c('0x2e')],'fullname':_0x374f58[_0x3f1c('0x3f')][_0x3f1c('0x57')],'email':_0x374f58[_0x3f1c('0x3f')][_0x3f1c('0x58')]},'contact':_0x374f58['body'][_0x3f1c('0x33')],'account':_0x374f58[_0x3f1c('0x32')][_0x3f1c('0x35')]};var _0x2caf90={'rejectUnauthorized':![],'method':_0x3f1c('0x59'),'url':_0x3f1c('0x5a'),'headers':{'X-APIKEY':_0x89aaa[_0x3f1c('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x374f58[_0x3f1c('0x3f')][_0x3f1c('0x58')]],'buttons':null,'topic':_0x477a23[_0x3f1c('0x5b')],'note':_[_0x3f1c('0x5c')](_0x477a23[_0x3f1c('0x55')])?null:getMustacheRender(_0x477a23[_0x3f1c('0x55')],_0x1d0d81),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x3f1c('0x5c')](_0x477a23['vidaooMetadata'])){var _0x44b869=getMustacheRender(_0x477a23[_0x3f1c('0x56')],_0x1d0d81);var _0x380e6b=JSON[_0x3f1c('0x5d')](_0x44b869);_0x2caf90[_0x3f1c('0x32')]['metadata']=_0x380e6b;}}catch(_0x309196){throw new db[(_0x3f1c('0x5e'))][(_0x3f1c('0x5f'))](_0x3f1c('0x60'));}return rp(_0x2caf90);}else{throw new db[(_0x3f1c('0x5e'))][(_0x3f1c('0x5f'))](_0x3f1c('0x61'));}})['then'](function(_0x17c36e){_0xd3307d=_0x17c36e;if(_0xd3307d['id']){var _0x10b12a={'body':_0xd3307d[_0x3f1c('0x62')],'ChatWebsiteId':_0x477a23['id'],'ChatInteractionId':_0x26713e['id'],'direction':'out','UserId':_0x374f58['user']['id']};return db['ChatMessage'][_0x3f1c('0x4c')](_0x10b12a,{});}else{throw new db[(_0x3f1c('0x5e'))][(_0x3f1c('0x5f'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x3f1c('0x17')](function(){return _0x26713e[_0x3f1c('0x63')]({'vidaooSessionId':_0xd3307d['id']});})[_0x3f1c('0x17')](respondWithResult(_0x2c507f,null))[_0x3f1c('0x22')](handleError(_0x2c507f,null));};exports[_0x3f1c('0x64')]=function(_0x3d4189,_0x3a022b){if(_0x3d4189['body']['id']){delete _0x3d4189[_0x3f1c('0x32')]['id'];}return db[_0x3f1c('0x38')][_0x3f1c('0x4b')]({'where':{'id':_0x3d4189['params']['id']},'include':[{'model':db[_0x3f1c('0x65')],'as':'Contact'}]})[_0x3f1c('0x17')](handleEntityNotFound(_0x3a022b,null))[_0x3f1c('0x17')](saveUpdates(_0x3d4189[_0x3f1c('0x32')],null))[_0x3f1c('0x17')](respondWithResult(_0x3a022b,null))['catch'](handleError(_0x3a022b,null));};exports['abandon']=function(_0x37f5ea,_0x2dc26e){if(_0x37f5ea[_0x3f1c('0x32')]['id']){delete _0x37f5ea['body']['id'];}return db[_0x3f1c('0x38')][_0x3f1c('0x4b')]({'where':{'id':_0x37f5ea[_0x3f1c('0x4d')]['id']}})[_0x3f1c('0x17')](function(_0x114c8a){if(!_0x114c8a){logger[_0x3f1c('0x1f')](_0x3f1c('0x66'),'abandon',0x194,_0x3f1c('0x67'));_0x2dc26e[_0x3f1c('0x23')](0x194);}else{if(_0x114c8a[_0x3f1c('0x68')]){throw new db[(_0x3f1c('0x5e'))]['ValidationError'](_0x3f1c('0x69'));}}return _0x114c8a;})[_0x3f1c('0x17')](function(_0x3a9e61){if(_0x3a9e61){return _0x3a9e61['update']({'closed':_0x37f5ea[_0x3f1c('0x32')][_0x3f1c('0x6a')],'disposition':_0x37f5ea[_0x3f1c('0x32')]['disposition']})[_0x3f1c('0x17')](function(_0x279812){return _0x279812;});}})[_0x3f1c('0x17')](function(){return respondWithRpcPromise(_0x3f1c('0x6b'),_0x3f1c('0x6c'),_0x37f5ea[_0x3f1c('0x32')],client9004);})['then'](respondWithResult(_0x2dc26e,null))['catch'](handleError(_0x2dc26e,null));};exports['attachmentUpload']=function(_0x33f65e,_0x2439fd){_0x33f65e[_0x3f1c('0x32')][_0x3f1c('0x2e')]=_0x33f65e['file'][_0x3f1c('0x6d')];_0x33f65e[_0x3f1c('0x32')][_0x3f1c('0x6e')]=_0x33f65e['file'][_0x3f1c('0x6f')];_0x33f65e[_0x3f1c('0x32')]['type']=_0x33f65e[_0x3f1c('0x70')][_0x3f1c('0x71')];return db[_0x3f1c('0x72')]['create'](_0x33f65e[_0x3f1c('0x32')])['then'](respondWithResult(_0x2439fd,0xc9))['catch'](handleError(_0x2439fd,null));};exports['attachmentDownload']=function(_0x4aea40,_0x31634c){return db[_0x3f1c('0x38')][_0x3f1c('0x50')]({'where':{'id':_0x4aea40[_0x3f1c('0x4d')]['id']},'raw':!![]})[_0x3f1c('0x17')](handleEntityNotFound(_0x31634c,null))[_0x3f1c('0x17')](function(_0x2a1cd0){if(_0x2a1cd0){if(_0x2a1cd0['closed']){return _0x31634c[_0x3f1c('0x24')](0x193)[_0x3f1c('0x26')]({'status':0x193,'message':_0x3f1c('0x73')});}return db['Attachment'][_0x3f1c('0x50')]({'where':{'id':_0x4aea40[_0x3f1c('0x42')][_0x3f1c('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x31634c,null));}})[_0x3f1c('0x17')](function(_0x3761ac){if(_0x3761ac){var _0x51a257=_0x3761ac[_0x3f1c('0x75')]!==null;var _0x2620de=path[_0x3f1c('0x76')](config[_0x3f1c('0x77')],_0x3f1c('0x78'));if(_0x51a257){_0x2620de=path[_0x3f1c('0x76')](_0x2620de,_0x3f1c('0x79'));}var _0x4b9f53=path['join'](_0x2620de,_0x3761ac[_0x3f1c('0x6e')]);return _0x31634c['download'](_0x4b9f53);}})[_0x3f1c('0x22')](handleError(_0x31634c,null));};exports[_0x3f1c('0x7a')]=function(_0x4f5ba4,_0xc32590){var _0x22692b=null;var _0x152e3e=null;var _0x54b8c0=null;if(_0x4f5ba4[_0x3f1c('0x32')]['id']){delete _0x4f5ba4[_0x3f1c('0x32')]['id'];}if(_0x4f5ba4[_0x3f1c('0x32')][_0x3f1c('0x7b')]){_0x54b8c0=path['join'](config[_0x3f1c('0x77')],_0x3f1c('0x7c'),util['format']('transcript-%s.txt',Date[_0x3f1c('0x7d')]()));_0x4f5ba4[_0x3f1c('0x32')][_0x3f1c('0x7e')]=_0x54b8c0;}return db['ChatInteraction'][_0x3f1c('0x4b')]({'where':{'id':_0x4f5ba4['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x3f1c('0x7f')],'as':'User'}]}]})[_0x3f1c('0x17')](handleEntityNotFound(_0xc32590,null))[_0x3f1c('0x17')](saveUpdates(_0x4f5ba4[_0x3f1c('0x32')],null))[_0x3f1c('0x17')](function(_0x448b79){if(_0x448b79){_0x22692b=_0x448b79;return db[_0x3f1c('0x51')][_0x3f1c('0x4b')]({'where':{'id':_0x22692b[_0x3f1c('0x52')]}});}})[_0x3f1c('0x17')](function(_0x3a12d6){if(_0x3a12d6){_0x152e3e=_0x3a12d6;return db[_0x3f1c('0x65')][_0x3f1c('0x4b')]({'where':{'id':_0x22692b['ContactId']}});}})['then'](function(_0x11ed7f){if(_0x11ed7f){if(_0x54b8c0){var _0x2fe381=null;for(var _0xef68b3=0x1;_0xef68b3<_0x22692b[_0x3f1c('0x80')][_0x3f1c('0x49')];++_0xef68b3){_0x2fe381=_0x22692b[_0x3f1c('0x80')][_0xef68b3];var _0x1b4c38=_0x2fe381['UserId']?util[_0x3f1c('0x81')](_0x3f1c('0x82'),_0x152e3e[_0x3f1c('0x83')],_0x2fe381[_0x3f1c('0x68')]):'System';var _0x1110d6=_0x4f5ba4[_0x3f1c('0x32')][_0x3f1c('0x84')]||util[_0x3f1c('0x81')]('%s%d','Visitor',_0x2fe381['ContactId']);switch(_0x152e3e[_0x3f1c('0x85')]){case'website_alias':_0x1b4c38=_0x2fe381[_0x3f1c('0x68')]?util[_0x3f1c('0x81')](_0x3f1c('0x82'),_0x152e3e['agentAlias'],_0x2fe381['UserId']):_0x3f1c('0x86');break;case'agent_alias':_0x1b4c38=_0x2fe381[_0x3f1c('0x68')]?_0x2fe381[_0x3f1c('0x7f')][_0x3f1c('0x87')]||_0x2fe381[_0x3f1c('0x7f')]['fullname']:_0x3f1c('0x86');break;case _0x3f1c('0x88'):_0x1b4c38=_0x2fe381[_0x3f1c('0x68')]?_0x2fe381[_0x3f1c('0x7f')][_0x3f1c('0x57')]:_0x3f1c('0x86');break;default:_0x1b4c38=_0x2fe381[_0x3f1c('0x68')]?util[_0x3f1c('0x81')](_0x3f1c('0x82'),_0x152e3e['agentAlias'],_0x2fe381[_0x3f1c('0x68')]):_0x3f1c('0x86');}var _0x5f48ba=util[_0x3f1c('0x81')](_0x3f1c('0x89'),moment(_0x2fe381[_0x3f1c('0x8a')])['format'](_0x3f1c('0x8b')),_0x2fe381[_0x3f1c('0x8c')]==='in'?_0x1110d6:_0x1b4c38,_0x2fe381[_0x3f1c('0x32')]);if(!_0x2fe381[_0x3f1c('0x8d')]){fs['appendFileSync'](_0x54b8c0,_0x5f48ba);}}return db['MailAccount'][_0x3f1c('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x3f1c('0x8e')],'as':_0x3f1c('0x8f'),'raw':!![],'include':[{'model':db[_0x3f1c('0x90')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x3f1c('0x17')](function(_0x2dfdcb){if(!_0x2dfdcb||!_0x2dfdcb[_0x3f1c('0x8f')]||!_0x4f5ba4[_0x3f1c('0x32')])return _0x22692b;var _0x3495d7=_0x2dfdcb['getSmtpOptions']();return respondWithRpcPromise(_0x3f1c('0x91'),'sendMail',{'account':_0x3495d7,'message':{'from':util[_0x3f1c('0x81')](_0x3f1c('0x92'),_0x2dfdcb[_0x3f1c('0x2e')],_0x2dfdcb[_0x3f1c('0x58')]||_0x2dfdcb[_0x3f1c('0x8f')][_0x3f1c('0x3f')]),'to':_0x4f5ba4['body'][_0x3f1c('0x7b')],'subject':_0x3f1c('0x93'),'text':util['format'](_0x3f1c('0x94'),_0x4f5ba4[_0x3f1c('0x32')]['mailTranscript']),'attachments':[{'path':_0x54b8c0}]}})[_0x3f1c('0x17')](function(){return _0x22692b;})['catch'](function(_0x5c17f3){logger[_0x3f1c('0x1f')](_0x5c17f3);});})[_0x3f1c('0x17')](respondWithStatusCode(_0xc32590,0xc8))[_0x3f1c('0x22')](handleError(_0xc32590,null));};exports[_0x3f1c('0x95')]=function(_0x235431,_0x195067){return db[_0x3f1c('0x96')][_0x3f1c('0x4b')]({'where':{'id':_0x235431[_0x3f1c('0x4d')]['id']}})[_0x3f1c('0x17')](handleEntityNotFound(_0x195067,null))[_0x3f1c('0x17')](function(_0xe57f01){if(_0xe57f01){return _0xe57f01[_0x3f1c('0x95')](_0x235431[_0x3f1c('0x32')][_0x3f1c('0x97')],_['omit'](_0x235431[_0x3f1c('0x32')],[_0x3f1c('0x97'),'id'])||{});}})[_0x3f1c('0x17')](respondWithResult(_0x195067,null))[_0x3f1c('0x22')](handleError(_0x195067,null));};exports[_0x3f1c('0x98')]=function(_0x4b46ec,_0x34e60f){var _0x471fb8={'raw':![],'where':{}};var _0x5eb544={};var _0x24a955={'count':0x0,'rows':[]};return db[_0x3f1c('0x38')][_0x3f1c('0x50')]({'where':{'id':_0x4b46ec[_0x3f1c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34e60f,null))[_0x3f1c('0x17')](function(_0x12caa0){if(_0x12caa0){_0x5eb544[_0x3f1c('0x46')]=_[_0x3f1c('0x43')](db[_0x3f1c('0x96')][_0x3f1c('0x41')]);_0x5eb544[_0x3f1c('0x42')]=_[_0x3f1c('0x43')](_0x4b46ec[_0x3f1c('0x42')]);_0x5eb544[_0x3f1c('0x44')]=_[_0x3f1c('0x45')](_0x5eb544[_0x3f1c('0x46')],_0x5eb544[_0x3f1c('0x42')]);_0x471fb8[_0x3f1c('0x48')]=_[_0x3f1c('0x45')](_0x5eb544[_0x3f1c('0x46')],qs[_0x3f1c('0x47')](_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x47')]));_0x471fb8[_0x3f1c('0x48')]=_0x471fb8[_0x3f1c('0x48')]['length']?_0x471fb8[_0x3f1c('0x48')]:_0x5eb544[_0x3f1c('0x46')];if(!_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x99')](_0x3f1c('0x9a'))){_0x471fb8[_0x3f1c('0x28')]=qs[_0x3f1c('0x28')](_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x28')]);_0x471fb8[_0x3f1c('0x27')]=qs[_0x3f1c('0x27')](_0x4b46ec['query'][_0x3f1c('0x27')]);}_0x471fb8['order']=qs['sort'](_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x9b')]);_0x471fb8[_0x3f1c('0x9c')]=qs[_0x3f1c('0x44')](_[_0x3f1c('0x9d')](_0x4b46ec[_0x3f1c('0x42')],_0x5eb544[_0x3f1c('0x44')]));_0x471fb8[_0x3f1c('0x9c')][_0x3f1c('0x9e')]=_0x12caa0['id'];if(_0x4b46ec['query']['filter']){_0x471fb8[_0x3f1c('0x9c')]=_[_0x3f1c('0x31')](_0x471fb8['where'],{'$or':_[_0x3f1c('0x37')](_0x471fb8[_0x3f1c('0x48')],function(_0x245d89){var _0x44d0f5={};_0x44d0f5[_0x245d89]={'$like':'%'+_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x9f')]+'%'};return _0x44d0f5;})});}if(_0x4b46ec[_0x3f1c('0x42')]['$gte']){var _0x157c1f=_0x4b46ec['query']['$gte'][_0x3f1c('0xa0')](',');var _0xa670ca={};_0xa670ca[_0x157c1f[0x0]]={'$gte':moment(_0x157c1f[0x1])[_0x3f1c('0x81')](_0x3f1c('0xa1'))};_0x471fb8['where']=_[_0x3f1c('0x31')](_0x471fb8[_0x3f1c('0x9c')],_0xa670ca);}_0x471fb8=_[_0x3f1c('0x31')]({},_0x471fb8,_0x4b46ec[_0x3f1c('0xa2')]);return db[_0x3f1c('0x96')]['count']({'where':_0x471fb8[_0x3f1c('0x9c')]})[_0x3f1c('0x17')](function(_0x524c37){_0x24a955[_0x3f1c('0x29')]=_0x524c37;if(_0x4b46ec[_0x3f1c('0x42')][_0x3f1c('0x4a')]){_0x471fb8[_0x3f1c('0xa3')]=[{'all':!![]}];}return db[_0x3f1c('0x96')]['findAll'](_0x471fb8);})[_0x3f1c('0x17')](function(_0x167208){_0x24a955[_0x3f1c('0xa4')]=_0x167208;return _0x24a955;});}})[_0x3f1c('0x17')](respondWithFilteredResult(_0x34e60f,_0x471fb8))[_0x3f1c('0x22')](handleError(_0x34e60f,null));};exports['getMyMessages']=function(_0x11eccf,_0x38f748){var _0x1fe064={'where':{}},_0x11b55a={},_0x293f14={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x11eccf['params']['id']}})[_0x3f1c('0x17')](handleEntityNotFound(_0x38f748,null))[_0x3f1c('0x17')](function(_0x11419e){if(_0x11419e){_0x11b55a[_0x3f1c('0x46')]=_[_0x3f1c('0x43')](db['ChatMessage'][_0x3f1c('0x41')]);_0x11b55a['query']=_[_0x3f1c('0x43')](_0x11eccf[_0x3f1c('0x42')]);_0x11b55a[_0x3f1c('0x44')]=_['intersection'](_0x11b55a[_0x3f1c('0x46')],_0x11b55a[_0x3f1c('0x42')]);_0x1fe064['attributes']=_[_0x3f1c('0x45')](_0x11b55a[_0x3f1c('0x46')],qs[_0x3f1c('0x47')](_0x11eccf[_0x3f1c('0x42')][_0x3f1c('0x47')]));_0x1fe064[_0x3f1c('0x48')]=_0x1fe064['attributes'][_0x3f1c('0x49')]?_0x1fe064[_0x3f1c('0x48')]:_0x11b55a['model'];if(!_0x11eccf[_0x3f1c('0x42')]['hasOwnProperty'](_0x3f1c('0x9a'))){_0x1fe064[_0x3f1c('0x28')]=qs[_0x3f1c('0x28')](_0x11eccf[_0x3f1c('0x42')]['limit']);_0x1fe064[_0x3f1c('0x27')]=qs['offset'](_0x11eccf[_0x3f1c('0x42')][_0x3f1c('0x27')]);}_0x1fe064[_0x3f1c('0xa5')]=qs[_0x3f1c('0x9b')](_0x11eccf['query'][_0x3f1c('0x9b')]);_0x1fe064[_0x3f1c('0x9c')]=qs[_0x3f1c('0x44')](_[_0x3f1c('0x9d')](_0x11eccf[_0x3f1c('0x42')],_0x11b55a[_0x3f1c('0x44')]));_0x1fe064[_0x3f1c('0x9c')][_0x3f1c('0x9e')]=_0x11419e['id'];if(_0x11eccf[_0x3f1c('0x42')][_0x3f1c('0x9f')]){_0x1fe064['where']=_['merge'](_0x1fe064[_0x3f1c('0x9c')],{'$or':_[_0x3f1c('0x37')](_0x1fe064[_0x3f1c('0x48')],function(_0x1a9f53){var _0x41c7a5={};_0x41c7a5[_0x1a9f53]={'$like':'%'+_0x11eccf[_0x3f1c('0x42')][_0x3f1c('0x9f')]+'%'};return _0x41c7a5;})});}_0x1fe064['where'][_0x3f1c('0x8d')]=![];if(_0x11eccf[_0x3f1c('0x42')]['id']){_0x1fe064['where']['id']={'$gt':_0x11eccf['query']['id']};}_0x1fe064=_['merge']({},_0x1fe064,_0x11eccf[_0x3f1c('0xa2')]);return db[_0x3f1c('0x96')]['count']({'where':_0x1fe064[_0x3f1c('0x9c')]})[_0x3f1c('0x17')](function(_0x58eacc){_0x293f14[_0x3f1c('0x29')]=_0x58eacc;_0x1fe064[_0x3f1c('0xa3')]=[];if(_0x11eccf[_0x3f1c('0x42')]['includeAgent']){_0x1fe064[_0x3f1c('0xa3')][_0x3f1c('0xa6')]({'model':db[_0x3f1c('0x7f')],'as':'User','attributes':['id','fullname',_0x3f1c('0x87')]});}if(_0x11eccf[_0x3f1c('0x42')][_0x3f1c('0x4a')]){_0x1fe064[_0x3f1c('0xa3')]=[{'all':!![]}];}return db[_0x3f1c('0x96')][_0x3f1c('0x3d')](_0x1fe064);})[_0x3f1c('0x17')](function(_0x23c416){_0x293f14['rows']=_0x23c416;return _0x293f14;});}})[_0x3f1c('0x17')](respondWithFilteredResult(_0x38f748,_0x1fe064))[_0x3f1c('0x22')](handleError(_0x38f748,null));};exports[_0x3f1c('0xa7')]=function(_0x165ee,_0x359678){return db[_0x3f1c('0x38')][_0x3f1c('0x4b')]({'where':{'id':_0x165ee[_0x3f1c('0x4d')]['id']}})[_0x3f1c('0x17')](handleEntityNotFound(_0x359678,null))[_0x3f1c('0x17')](function(_0x449867){if(_0x449867){return _0x449867[_0x3f1c('0xa8')](_0x165ee[_0x3f1c('0x32')]['ids'],_[_0x3f1c('0xa9')](_0x165ee['body'],[_0x3f1c('0x97'),'id'])||{})['spread'](function(){return db['Tag'][_0x3f1c('0x3d')]({'attributes':['id',_0x3f1c('0x2e'),'color'],'where':{'id':_0x165ee['body'][_0x3f1c('0x97')]}});})['then'](function(_0x4292e6){socket[_0x3f1c('0xaa')](_0x3f1c('0xab'),{'id':Number(_0x165ee[_0x3f1c('0x4d')]['id']),'tags':_0x4292e6||[]});return{'id':Number(_0x165ee['params']['id']),'tags':_0x4292e6||[]};});}})[_0x3f1c('0x17')](respondWithResult(_0x359678,null))[_0x3f1c('0x22')](handleError(_0x359678,null));};exports['removeTags']=function(_0x369af9,_0x1f9343){return db['ChatInteraction']['find']({'where':{'id':_0x369af9['params']['id']}})['then'](handleEntityNotFound(_0x1f9343,null))[_0x3f1c('0x17')](function(_0x3a2d90){if(_0x3a2d90){return _0x3a2d90['removeTags'](_0x369af9[_0x3f1c('0x42')][_0x3f1c('0x97')]);}})[_0x3f1c('0x17')](respondWithStatusCode(_0x1f9343,null))[_0x3f1c('0x22')](handleError(_0x1f9343,null));};exports['download']=function(_0x9a2435,_0x28aba1){var _0x5aff73=moment()[_0x3f1c('0xac')]()[_0x3f1c('0xad')]();var _0x5bbdbc=path['join'](config[_0x3f1c('0x77')],_0x3f1c('0xae'),_0x3f1c('0xaf'),_0x3f1c('0xb0'));var _0x540b70=path['join'](config[_0x3f1c('0x77')],_0x3f1c('0xae'),'files',_0x3f1c('0xb1'));var _0x451a1d=path[_0x3f1c('0x76')](_0x5bbdbc,_0x5aff73);var _0x2be48a=util[_0x3f1c('0x81')](_0x3f1c('0xb2'),_0x9a2435[_0x3f1c('0x4d')]['id'],_0x5aff73);var _0xd4f09=path['join'](_0x5bbdbc,_0x2be48a);var _0x23ef09=[];_0x23ef09[_0x3f1c('0xa6')]({'model':db[_0x3f1c('0x7f')],'as':_0x3f1c('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x23ef09[_0x3f1c('0xa6')]({'model':db[_0x3f1c('0x65')],'as':_0x3f1c('0xb3'),'attributes':['id',_0x3f1c('0xb4'),'lastName'],'raw':!![]});if(_0x9a2435['query'][_0x3f1c('0xb1')]){_0x23ef09[_0x3f1c('0xa6')]({'model':db[_0x3f1c('0x72')],'as':'Attachment','raw':!![]});}var _0x3c1067=[{'model':db[_0x3f1c('0x96')],'as':'Messages','attributes':['id',_0x3f1c('0x32'),_0x3f1c('0x8a'),_0x3f1c('0x8c'),_0x3f1c('0x8d'),_0x3f1c('0xb5')],'include':_0x23ef09}];_0x3c1067[_0x3f1c('0xa6')]({'model':db[_0x3f1c('0x51')],'as':'Account','attributes':['id',_0x3f1c('0x2e')]});_0x3c1067[_0x3f1c('0xa6')]({'model':db['User'],'as':_0x3f1c('0xb6'),'attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x9a2435['params']['id']},'include':_0x3c1067})[_0x3f1c('0x17')](handleEntityNotFound(_0x28aba1,null))[_0x3f1c('0x17')](function(_0x210d34){if(_0x210d34){var _0x5d0860=_0x210d34[_0x3f1c('0xb7')]({'plain':!![]});fs[_0x3f1c('0xb8')](_0x451a1d);var _0x4d62ca={'channel':_0x3f1c('0xb9'),'account':_0x5d0860[_0x3f1c('0xba')][_0x3f1c('0x2e')],'agent':_0x5d0860[_0x3f1c('0xb6')]?_0x5d0860[_0x3f1c('0xb6')]['fullname']:'N.A.','createdAt':moment(_0x5d0860['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3f1c('0xad')](),'closedAt':_0x5d0860[_0x3f1c('0x6a')]?moment(_0x5d0860['closedAt'])[_0x3f1c('0x81')](_0x3f1c('0xa1'))[_0x3f1c('0xad')]():'','disposition':_0x5d0860['disposition'],'chatInfo':{'browser':_0x5d0860[_0x3f1c('0xbb')],'os':_0x5d0860[_0x3f1c('0xbc')],'referer':_0x5d0860[_0x3f1c('0xbd')],'customerIp':_0x5d0860['customerIp'],'customerPort':_0x5d0860['customerPort']?_0x5d0860[_0x3f1c('0xbe')]:_0x3f1c('0xbf')},'messages':_(_0x5d0860[_0x3f1c('0x80')])[_0x3f1c('0xc0')]()['filter']({'secret':![]})[_0x3f1c('0x37')](function(_0x2ed6da){if(_0x2ed6da[_0x3f1c('0x72')]){var _0x11690d=path[_0x3f1c('0x76')](_0x540b70,_0x2ed6da['Attachment'][_0x3f1c('0x6e')]);if(fs[_0x3f1c('0xc1')](_0x11690d)){fs[_0x3f1c('0xc2')](_0x11690d)[_0x3f1c('0xc3')](fs['createWriteStream'](path[_0x3f1c('0x76')](_0x451a1d,_0x2ed6da[_0x3f1c('0x72')][_0x3f1c('0x6e')])));}}return{'date':moment(_0x2ed6da[_0x3f1c('0x8a')])[_0x3f1c('0x81')](_0x3f1c('0xa1'))[_0x3f1c('0xad')](),'sender':_0x2ed6da['direction']===_0x3f1c('0xc4')?_0x2ed6da[_0x3f1c('0x7f')]?_0x2ed6da['User'][_0x3f1c('0x57')]:_0x3f1c('0x86'):_0x2ed6da[_0x3f1c('0xb3')]['firstName']+(_0x2ed6da[_0x3f1c('0xb3')][_0x3f1c('0xc5')]?'\x20'+_0x2ed6da['Contact']['lastName']:''),'body':_0x2ed6da[_0x3f1c('0x72')]?_0x2ed6da[_0x3f1c('0x72')]['basename']:_0x2ed6da[_0x3f1c('0x32')],'direction':_0x2ed6da[_0x3f1c('0x8c')]===_0x3f1c('0xc4')?'A':'C','secret':_0x2ed6da[_0x3f1c('0x8d')],'read':_0x2ed6da['read'],'attachment':_0x2ed6da[_0x3f1c('0x72')]};})[_0x3f1c('0xc6')]()};return ejs[_0x3f1c('0xc7')](path[_0x3f1c('0x76')](config[_0x3f1c('0x77')],_0x3f1c('0xae'),_0x3f1c('0xc8'),'downloadInteraction.ejs'),{'interaction':_0x4d62ca})['then'](function(_0x122478){var _0x482fd1=path['join'](_0x451a1d,'transcript-'+_0x5d0860['id']+'-'+_0x5aff73+'.pdf');var _0x28cc4b={'path':_0x482fd1,'channel':_0x3f1c('0xb9'),'interactionId':_0x5d0860['id']};return pdf[_0x3f1c('0xc9')](_0x122478,_0x28cc4b);})[_0x3f1c('0x17')](function(){return new Promise(function(_0x2aca8f,_0x25ec07){zipdir(_0x451a1d,{'saveTo':_0xd4f09},function(_0x536794,_0x343eb1){if(_0x536794)return _0x25ec07(_0x536794);return _0x2aca8f(_0x343eb1);});})['then'](function(){return new BPromise(function(_0x397a01,_0x3512dc){rimraf(_0x451a1d,function(_0x3bb6d7){if(_0x3bb6d7)_0x3512dc(_0x3bb6d7);return _0x397a01();});});})[_0x3f1c('0x17')](function(){return _0x28aba1['download'](_0xd4f09,_0x2be48a,function(_0x4f3d32){if(_0x4f3d32){logger[_0x3f1c('0x1f')]('err',_0x4f3d32);}else{fs[_0x3f1c('0xca')](_0xd4f09);}});});});}else{return _0x28aba1[_0x3f1c('0x23')](0xc8);}})['catch'](handleError(_0x28aba1,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5198f6c..7bec598 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 _0x6335=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6335,0x18f));var _0x5633=function(_0x178995,_0x3ffcb3){_0x178995=_0x178995-0x0;var _0x5ecec3=_0x6335[_0x178995];return _0x5ecec3;};'use strict';var EventEmitter=require(_0x5633('0x0'));var ChatInteraction=require(_0x5633('0x1'))['db'][_0x5633('0x2')];var ChatMessage=require(_0x5633('0x1'))['db'][_0x5633('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5633('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5633('0x5'),'afterDestroy':_0x5633('0x6')};function emitEvent(_0x43089d){return function(_0x56b5f5,_0x4c2647,_0x4de5ee){_0x56b5f5[_0x5633('0x7')]({'attributes':['id'],'raw':!![]})[_0x5633('0x8')](function(_0x5d0b34){_0x56b5f5[_0x5633('0x9')](_0x5633('0xa'),_0x5d0b34[_0x5633('0xb')](function(_0xdaa62f){return{'id':_0xdaa62f['id']};}));return ChatMessage[_0x5633('0xc')]({'where':{'ChatInteractionId':_0x56b5f5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d924e){_0x56b5f5['setDataValue'](_0x5633('0xd'),_0x4d924e[_0x5633('0xe')]);ChatInteractionEvents[_0x5633('0xf')](_0x43089d+':'+_0x56b5f5['id'],_0x56b5f5);ChatInteractionEvents[_0x5633('0xf')](_0x43089d,_0x56b5f5);_0x4de5ee(null);})[_0x5633('0x10')](_0x4de5ee(null));};}for(var e in events){if(events[_0x5633('0x11')](e)){var event=events[e];ChatInteraction[_0x5633('0x12')](e,emitEvent(event));}}module[_0x5633('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0xb0d3=['save','update','remove','getUsers','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x104377,_0x54b94c){var _0x1fac22=function(_0xfd1f7f){while(--_0xfd1f7f){_0x104377['push'](_0x104377['shift']());}};_0x1fac22(++_0x54b94c);}(_0xb0d3,0xdf));var _0x3b0d=function(_0x406ae7,_0x12181b){_0x406ae7=_0x406ae7-0x0;var _0x5a5b9d=_0xb0d3[_0x406ae7];return _0x5a5b9d;};'use strict';var EventEmitter=require(_0x3b0d('0x0'));var ChatInteraction=require(_0x3b0d('0x1'))['db'][_0x3b0d('0x2')];var ChatMessage=require(_0x3b0d('0x1'))['db'][_0x3b0d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3b0d('0x4')](0x0);var events={'afterCreate':_0x3b0d('0x5'),'afterUpdate':_0x3b0d('0x6'),'afterDestroy':_0x3b0d('0x7')};function emitEvent(_0x1e8402){return function(_0x35e128,_0x36bcc8,_0x5906c3){_0x35e128[_0x3b0d('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43f48b){_0x35e128[_0x3b0d('0x9')](_0x3b0d('0xa'),_0x43f48b[_0x3b0d('0xb')](function(_0x504208){return{'id':_0x504208['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x35e128['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3b0d('0xc')](function(_0x358b99){_0x35e128['setDataValue']('unreadMessages',_0x358b99[_0x3b0d('0xd')]);ChatInteractionEvents[_0x3b0d('0xe')](_0x1e8402+':'+_0x35e128['id'],_0x35e128);ChatInteractionEvents[_0x3b0d('0xe')](_0x1e8402,_0x35e128);_0x5906c3(null);})[_0x3b0d('0xf')](_0x5906c3(null));};}for(var e in events){if(events[_0x3b0d('0x10')](e)){var event=events[e];ChatInteraction[_0x3b0d('0x11')](e,emitEvent(event));}}module[_0x3b0d('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index bf34371..d2c8e47 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 _0x8ee5=['path','rimraf','./chatInteraction.attributes','define','ChatInteraction','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x417643,_0x48b479){var _0x1caddc=function(_0x4f4bed){while(--_0x4f4bed){_0x417643['push'](_0x417643['shift']());}};_0x1caddc(++_0x48b479);}(_0x8ee5,0x11a));var _0x58ee=function(_0x59701d,_0xe1b1ad){_0x59701d=_0x59701d-0x0;var _0x1265c0=_0x8ee5[_0x59701d];return _0x1265c0;};'use strict';var _=require(_0x58ee('0x0'));var util=require(_0x58ee('0x1'));var logger=require(_0x58ee('0x2'))(_0x58ee('0x3'));var moment=require(_0x58ee('0x4'));var BPromise=require(_0x58ee('0x5'));var rp=require(_0x58ee('0x6'));var fs=require('fs');var path=require(_0x58ee('0x7'));var rimraf=require(_0x58ee('0x8'));var config=require('../../config/environment');var attributes=require(_0x58ee('0x9'));module['exports']=function(_0x3f9c79,_0x4cd4a7){return _0x3f9c79[_0x58ee('0xa')](_0x58ee('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1619fc,_0x5c5d97,_0x4a69ca){if(_0x1619fc[_0x58ee('0xc')](_0x58ee('0xd'))){_0x1619fc[_0x58ee('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4a69ca(null,_0x1619fc);}},'charset':_0x58ee('0xf'),'collate':_0x58ee('0x10')});}; \ No newline at end of file +var _0x44c1=['rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x188078,_0x4b1305){var _0x50c445=function(_0x4176a9){while(--_0x4176a9){_0x188078['push'](_0x188078['shift']());}};_0x50c445(++_0x4b1305);}(_0x44c1,0x1ba));var _0x144c=function(_0x32e54a,_0x59fc0d){_0x32e54a=_0x32e54a-0x0;var _0x109af4=_0x44c1[_0x32e54a];return _0x109af4;};'use strict';var _=require(_0x144c('0x0'));var util=require(_0x144c('0x1'));var logger=require(_0x144c('0x2'))('api');var moment=require(_0x144c('0x3'));var BPromise=require(_0x144c('0x4'));var rp=require(_0x144c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x144c('0x6'));var config=require('../../config/environment');var attributes=require(_0x144c('0x7'));module[_0x144c('0x8')]=function(_0x36751d,_0xab5c7d){return _0x36751d[_0x144c('0x9')](_0x144c('0xa'),attributes,{'tableName':_0x144c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57e24d,_0x82ee7f,_0x39d245){if(_0x57e24d['changed']('closed')){_0x57e24d[_0x144c('0xc')]=moment()[_0x144c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x39d245(null,_0x57e24d);}},'charset':_0x144c('0xe'),'collate':_0x144c('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9567300..b457578 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 _0x63c1=['redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','UpdateChatInteraction','ChatInteraction','update','options','raw','where','stringify','catch','AddTagsToChatInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x21098f,_0x3e5fd1){var _0x2cf331=function(_0x485ce8){while(--_0x485ce8){_0x21098f['push'](_0x21098f['shift']());}};_0x2cf331(++_0x3e5fd1);}(_0x63c1,0x187));var _0x163c=function(_0x14977a,_0x38700a){_0x14977a=_0x14977a-0x0;var _0x59902d=_0x63c1[_0x14977a];return _0x59902d;};'use strict';var _=require(_0x163c('0x0'));var util=require('util');var moment=require(_0x163c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x163c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x163c('0x3'));var logger=require('../../config/logger')(_0x163c('0x4'));var config=require(_0x163c('0x5'));var jayson=require(_0x163c('0x6'));var client=jayson['client'][_0x163c('0x7')]({'port':0x232a});config['redis']=_[_0x163c('0x8')](config[_0x163c('0x9')],{'host':_0x163c('0xa'),'port':0x18eb});var socket=require(_0x163c('0xb'))(new Redis(config[_0x163c('0x9')]));require(_0x163c('0xc'))[_0x163c('0xd')](socket);function respondWithRpcPromise(_0x3bdfe1,_0x5dec2a,_0x4bc7cd){return new BPromise(function(_0x242c20,_0x258d6c){return client[_0x163c('0xe')](_0x3bdfe1,_0x4bc7cd)[_0x163c('0xf')](function(_0x5a70db){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5dec2a,_0x163c('0x10'));logger[_0x163c('0x11')](_0x163c('0x12'),_0x5dec2a,_0x163c('0x10'),JSON['stringify'](_0x5a70db));if(_0x5a70db[_0x163c('0x13')]){if(_0x5a70db['error'][_0x163c('0x14')]===0x1f4){logger['error'](_0x163c('0x15'),_0x5dec2a,_0x5a70db[_0x163c('0x13')][_0x163c('0x16')]);return _0x258d6c(_0x5a70db['error'][_0x163c('0x16')]);}logger[_0x163c('0x13')](_0x163c('0x15'),_0x5dec2a,_0x5a70db[_0x163c('0x13')][_0x163c('0x16')]);return _0x242c20(_0x5a70db[_0x163c('0x13')]['message']);}else{logger[_0x163c('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x5dec2a,'request\x20sent');_0x242c20(_0x5a70db[_0x163c('0x18')]['message']);}})['catch'](function(_0x4f4068){logger[_0x163c('0x13')](_0x163c('0x15'),_0x5dec2a,_0x4f4068);_0x258d6c(_0x4f4068);});});}exports[_0x163c('0x19')]=function(_0x4f7a81){var _0x47cb53=this;return new Promise(function(_0x94f970,_0x48ec8f){return db[_0x163c('0x1a')][_0x163c('0x1b')](_0x4f7a81['body'],{'raw':_0x4f7a81[_0x163c('0x1c')]?_0x4f7a81[_0x163c('0x1c')][_0x163c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7a81[_0x163c('0x1c')]?_0x4f7a81[_0x163c('0x1c')][_0x163c('0x1e')]||null:null,'attributes':_0x4f7a81['options']?_0x4f7a81['options']['attributes']||null:null,'limit':_0x4f7a81[_0x163c('0x1c')]?_0x4f7a81[_0x163c('0x1c')]['limit']||null:null})[_0x163c('0xf')](function(_0x5b7cfc){logger[_0x163c('0x17')]('UpdateChatInteraction',_0x4f7a81);logger[_0x163c('0x11')](_0x163c('0x19'),_0x4f7a81,JSON[_0x163c('0x1f')](_0x5b7cfc));_0x94f970(_0x5b7cfc);})[_0x163c('0x20')](function(_0x4c5ab0){logger[_0x163c('0x13')](_0x163c('0x19'),_0x4c5ab0[_0x163c('0x16')],_0x4f7a81);_0x48ec8f(_0x47cb53[_0x163c('0x13')](0x1f4,_0x4c5ab0[_0x163c('0x16')]));});});};exports[_0x163c('0x21')]=function(_0x59a552){return new Promise(function(_0x85de7f,_0xf48ae4){return db[_0x163c('0x1a')][_0x163c('0x22')]({'where':_0x59a552[_0x163c('0x1c')]?_0x59a552[_0x163c('0x1c')]['where']||null:null})[_0x163c('0xf')](function(_0x3c8d3e){if(_0x3c8d3e){return _0x3c8d3e[_0x163c('0x23')](_0x59a552[_0x163c('0x24')][_0x163c('0x25')],_['omit'](_0x59a552[_0x163c('0x24')],[_0x163c('0x25'),'id'])||{});}})[_0x163c('0x26')](function(_0x3a0130){logger[_0x163c('0x17')](_0x163c('0x27'),_0x59a552);logger[_0x163c('0x11')](_0x163c('0x27'),_0x59a552,JSON['stringify'](_0x3a0130));_0x85de7f(_0x3a0130);})[_0x163c('0x20')](function(_0x34d644){logger[_0x163c('0x13')]('AddTags',_0x34d644[_0x163c('0x16')],_0x59a552);_0xf48ae4(_this[_0x163c('0x13')](0x1f4,_0x34d644[_0x163c('0x16')]));});});}; \ No newline at end of file +var _0x470a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','UpdateChatInteraction','options','raw','where','debug','AddTagsToChatInteraction','find','addTags','body','omit','ids','spread','AddTags'];(function(_0xb87a64,_0x1e0b2f){var _0x19c6ad=function(_0xfcf35b){while(--_0xfcf35b){_0xb87a64['push'](_0xb87a64['shift']());}};_0x19c6ad(++_0x1e0b2f);}(_0x470a,0xc8));var _0xa470=function(_0xb2be34,_0x4c45c1){_0xb2be34=_0xb2be34-0x0;var _0x39cdc4=_0x470a[_0xb2be34];return _0x39cdc4;};'use strict';var _=require(_0xa470('0x0'));var util=require(_0xa470('0x1'));var moment=require(_0xa470('0x2'));var BPromise=require(_0xa470('0x3'));var rs=require(_0xa470('0x4'));var fs=require('fs');var Redis=require(_0xa470('0x5'));var db=require(_0xa470('0x6'))['db'];var utils=require(_0xa470('0x7'));var logger=require('../../config/logger')(_0xa470('0x8'));var config=require(_0xa470('0x9'));var jayson=require(_0xa470('0xa'));var client=jayson[_0xa470('0xb')][_0xa470('0xc')]({'port':0x232a});config[_0xa470('0xd')]=_[_0xa470('0xe')](config['redis'],{'host':_0xa470('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa470('0x10'))['register'](socket);function respondWithRpcPromise(_0x195427,_0x371ec3,_0x28d351){return new BPromise(function(_0x3d141f,_0x2b1352){return client[_0xa470('0x11')](_0x195427,_0x28d351)[_0xa470('0x12')](function(_0x10a7d1){logger['info'](_0xa470('0x13'),_0x371ec3,'request\x20sent');logger['debug'](_0xa470('0x14'),_0x371ec3,_0xa470('0x15'),JSON[_0xa470('0x16')](_0x10a7d1));if(_0x10a7d1['error']){if(_0x10a7d1[_0xa470('0x17')]['code']===0x1f4){logger[_0xa470('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x371ec3,_0x10a7d1['error'][_0xa470('0x18')]);return _0x2b1352(_0x10a7d1[_0xa470('0x17')]['message']);}logger[_0xa470('0x17')](_0xa470('0x13'),_0x371ec3,_0x10a7d1[_0xa470('0x17')][_0xa470('0x18')]);return _0x3d141f(_0x10a7d1[_0xa470('0x17')][_0xa470('0x18')]);}else{logger[_0xa470('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x371ec3,_0xa470('0x15'));_0x3d141f(_0x10a7d1[_0xa470('0x1a')][_0xa470('0x18')]);}})['catch'](function(_0x44485f){logger[_0xa470('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x371ec3,_0x44485f);_0x2b1352(_0x44485f);});});}exports[_0xa470('0x1b')]=function(_0x17d76e){var _0x44a72=this;return new Promise(function(_0x6c2f3e,_0x5ae4c5){return db['ChatInteraction']['update'](_0x17d76e['body'],{'raw':_0x17d76e[_0xa470('0x1c')]?_0x17d76e[_0xa470('0x1c')][_0xa470('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17d76e[_0xa470('0x1c')]?_0x17d76e[_0xa470('0x1c')][_0xa470('0x1e')]||null:null,'attributes':_0x17d76e[_0xa470('0x1c')]?_0x17d76e[_0xa470('0x1c')]['attributes']||null:null,'limit':_0x17d76e[_0xa470('0x1c')]?_0x17d76e['options']['limit']||null:null})[_0xa470('0x12')](function(_0x17b9cb){logger[_0xa470('0x19')](_0xa470('0x1b'),_0x17d76e);logger[_0xa470('0x1f')](_0xa470('0x1b'),_0x17d76e,JSON[_0xa470('0x16')](_0x17b9cb));_0x6c2f3e(_0x17b9cb);})['catch'](function(_0x2ba002){logger[_0xa470('0x17')]('UpdateChatInteraction',_0x2ba002['message'],_0x17d76e);_0x5ae4c5(_0x44a72[_0xa470('0x17')](0x1f4,_0x2ba002[_0xa470('0x18')]));});});};exports[_0xa470('0x20')]=function(_0x37c954){return new Promise(function(_0x532af1,_0x5e01c8){return db['ChatInteraction'][_0xa470('0x21')]({'where':_0x37c954[_0xa470('0x1c')]?_0x37c954[_0xa470('0x1c')][_0xa470('0x1e')]||null:null})[_0xa470('0x12')](function(_0x554b0b){if(_0x554b0b){return _0x554b0b[_0xa470('0x22')](_0x37c954[_0xa470('0x23')]['ids'],_[_0xa470('0x24')](_0x37c954['body'],[_0xa470('0x25'),'id'])||{});}})[_0xa470('0x26')](function(_0x165e77){logger[_0xa470('0x19')](_0xa470('0x27'),_0x37c954);logger[_0xa470('0x1f')](_0xa470('0x27'),_0x37c954,JSON[_0xa470('0x16')](_0x165e77));_0x532af1(_0x165e77);})['catch'](function(_0x226e96){logger[_0xa470('0x17')]('AddTags',_0x226e96[_0xa470('0x18')],_0x37c954);_0x5e01c8(_this['error'](0x1f4,_0x226e96[_0xa470('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b9d7c2f..64da387 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 _0x6ed3=['save','update','register','./chatInteraction.events'];(function(_0x6fa261,_0x596489){var _0x2938d3=function(_0x51fd60){while(--_0x51fd60){_0x6fa261['push'](_0x6fa261['shift']());}};_0x2938d3(++_0x596489);}(_0x6ed3,0xbb));var _0x36ed=function(_0x2bfa88,_0xc64230){_0x2bfa88=_0x2bfa88-0x0;var _0x2e7039=_0x6ed3[_0x2bfa88];return _0x2e7039;};'use strict';var ChatInteractionEvents=require(_0x36ed('0x0'));var events=[_0x36ed('0x1'),'remove',_0x36ed('0x2')];function createListener(_0x3341a6,_0x11367){return function(_0x4d8531){_0x11367['emit'](_0x3341a6,_0x4d8531);};}function removeListener(_0x18ae74,_0x12ec5a){return function(){ChatInteractionEvents['removeListener'](_0x18ae74,_0x12ec5a);};}exports[_0x36ed('0x3')]=function(_0x13d7f2){for(var _0x1171b9=0x0,_0x3096d5=events['length'];_0x1171b9<_0x3096d5;_0x1171b9++){var _0x50b9a9=events[_0x1171b9];var _0x57748b=createListener('chatInteraction:'+_0x50b9a9,_0x13d7f2);ChatInteractionEvents['on'](_0x50b9a9,_0x57748b);}}; \ No newline at end of file +var _0x9e96=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0xa7a145,_0x15a2a8){var _0x3d6ad9=function(_0xdcae9d){while(--_0xdcae9d){_0xa7a145['push'](_0xa7a145['shift']());}};_0x3d6ad9(++_0x15a2a8);}(_0x9e96,0xde));var _0x69e9=function(_0x487ac0,_0x56a6c2){_0x487ac0=_0x487ac0-0x0;var _0x289f8c=_0x9e96[_0x487ac0];return _0x289f8c;};'use strict';var ChatInteractionEvents=require(_0x69e9('0x0'));var events=[_0x69e9('0x1'),'remove',_0x69e9('0x2')];function createListener(_0x5145b6,_0x57a079){return function(_0x4fb6b3){_0x57a079[_0x69e9('0x3')](_0x5145b6,_0x4fb6b3);};}function removeListener(_0x4f145c,_0xc5737f){return function(){ChatInteractionEvents[_0x69e9('0x4')](_0x4f145c,_0xc5737f);};}exports[_0x69e9('0x5')]=function(_0x6bcd6c){for(var _0x18dd2b=0x0,_0xc555e6=events[_0x69e9('0x6')];_0x18dd2b<_0xc555e6;_0x18dd2b++){var _0x2c0c44=events[_0x18dd2b];var _0x2c45b2=createListener(_0x69e9('0x7')+_0x2c0c44,_0x6bcd6c);ChatInteractionEvents['on'](_0x2c0c44,_0x2c45b2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 56d9c3b..c6d4218 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 _0x5e38=['/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','destroy','removeTags','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5e38,0x172));var _0x85e3=function(_0x51d32d,_0x4a87fa){_0x51d32d=_0x51d32d-0x0;var _0x5d422b=_0x5e38[_0x51d32d];return _0x5d422b;};'use strict';var multer=require(_0x85e3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85e3('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x85e3('0x2'));var interaction=require(_0x85e3('0x3'));var config=require(_0x85e3('0x4'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x85e3('0x5')](),controller['index']);router[_0x85e3('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x85e3('0x7')]);router['get'](_0x85e3('0x8'),auth[_0x85e3('0x9')](),controller[_0x85e3('0xa')]);router[_0x85e3('0x6')](_0x85e3('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x85e3('0xc')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x85e3('0xd')]);router['get'](_0x85e3('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x85e3('0xf')]);router['get']('/:id/download',auth[_0x85e3('0x5')](),controller[_0x85e3('0x10')]);router[_0x85e3('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x85e3('0x11')](_0x85e3('0x12'),auth[_0x85e3('0x5')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x85e3('0x13')]({'destination':function(_0xd3399e,_0x2d8054,_0x5928fc){_0x5928fc(null,path[_0x85e3('0x14')](config[_0x85e3('0x15')],_0x85e3('0x16')));},'filename':function(_0x36f9a0,_0x5ce865,_0x5593c9){_0x5593c9(null,util[_0x85e3('0x17')](_0x85e3('0x18'),Date['now'](),_0x5ce865[_0x85e3('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x85e3('0x11')](_0x85e3('0x1a'),upload[_0x85e3('0x1b')](_0x85e3('0x1c')),controller[_0x85e3('0x1d')]);router['post'](_0x85e3('0x1e'),auth[_0x85e3('0x9')](),controller[_0x85e3('0x1f')]);router['post'](_0x85e3('0x20'),auth[_0x85e3('0x5')](),interaction[_0x85e3('0x21')](_0x85e3('0x22'),_0x85e3('0x23')),controller[_0x85e3('0x24')]);router['put'](_0x85e3('0x8'),auth[_0x85e3('0x5')](),interaction[_0x85e3('0x21')]('chat',_0x85e3('0x25')),controller['update']);router[_0x85e3('0x26')](_0x85e3('0x27'),controller[_0x85e3('0x28')]);router[_0x85e3('0x26')](_0x85e3('0x29'),auth[_0x85e3('0x9')](),controller[_0x85e3('0x2a')]);router['put'](_0x85e3('0x2b'),controller['close']);router[_0x85e3('0x2c')](_0x85e3('0x8'),auth[_0x85e3('0x5')](),interaction[_0x85e3('0x21')](_0x85e3('0x22'),'chatinteraction:destroy'),controller[_0x85e3('0x2d')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x85e3('0x2e')]);module[_0x85e3('0x2f')]=router; \ No newline at end of file +var _0x3c19=['root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','customUpdate','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','removeTags','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','join'];(function(_0x56fad5,_0x1fdfcb){var _0x11d3aa=function(_0x196075){while(--_0x196075){_0x56fad5['push'](_0x56fad5['shift']());}};_0x11d3aa(++_0x1fdfcb);}(_0x3c19,0xb6));var _0x93c1=function(_0x50693f,_0x2aa27){_0x50693f=_0x50693f-0x0;var _0x1e4034=_0x3c19[_0x50693f];return _0x1e4034;};'use strict';var multer=require(_0x93c1('0x0'));var util=require(_0x93c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x93c1('0x2')]();var fs_extra=require(_0x93c1('0x3'));var auth=require(_0x93c1('0x4'));var interaction=require(_0x93c1('0x5'));var config=require(_0x93c1('0x6'));var controller=require(_0x93c1('0x7'));router['get']('/',auth[_0x93c1('0x8')](),controller[_0x93c1('0x9')]);router['get'](_0x93c1('0xa'),auth[_0x93c1('0x8')](),controller[_0x93c1('0xb')]);router[_0x93c1('0xc')]('/:id',auth[_0x93c1('0xd')](),controller[_0x93c1('0xe')]);router['get'](_0x93c1('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x93c1('0x10')]);router[_0x93c1('0xc')](_0x93c1('0x11'),auth[_0x93c1('0x8')](),controller['getMessages']);router[_0x93c1('0xc')](_0x93c1('0x12'),auth[_0x93c1('0xd')](),controller[_0x93c1('0x13')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x93c1('0x14')]);router[_0x93c1('0x15')]('/',auth[_0x93c1('0x8')](),controller[_0x93c1('0x16')]);router[_0x93c1('0x15')](_0x93c1('0x17'),auth[_0x93c1('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x93c1('0x18')]({'destination':function(_0x1eb015,_0x5e2726,_0x29c5ba){_0x29c5ba(null,path[_0x93c1('0x19')](config[_0x93c1('0x1a')],_0x93c1('0x1b')));},'filename':function(_0x40c9fe,_0xcd1e93,_0x21c7e9){_0x21c7e9(null,util[_0x93c1('0x1c')](_0x93c1('0x1d'),Date[_0x93c1('0x1e')](),_0xcd1e93[_0x93c1('0x1f')][_0x93c1('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x93c1('0x15')](_0x93c1('0x21'),upload[_0x93c1('0x22')]('file'),controller['attachmentUpload']);router[_0x93c1('0x15')](_0x93c1('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x93c1('0x23')]);router[_0x93c1('0x15')](_0x93c1('0x24'),auth[_0x93c1('0x8')](),interaction['tracked'](_0x93c1('0x25'),_0x93c1('0x26')),controller[_0x93c1('0x27')]);router[_0x93c1('0x28')]('/:id',auth[_0x93c1('0x8')](),interaction[_0x93c1('0x29')](_0x93c1('0x25'),_0x93c1('0x2a')),controller['update']);router[_0x93c1('0x28')]('/:id/custom_update',controller[_0x93c1('0x2b')]);router[_0x93c1('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x93c1('0x2c')]);router['put'](_0x93c1('0x2d'),controller[_0x93c1('0x2e')]);router[_0x93c1('0x2f')](_0x93c1('0x30'),auth[_0x93c1('0x8')](),interaction['tracked'](_0x93c1('0x25'),_0x93c1('0x31')),controller['destroy']);router[_0x93c1('0x2f')](_0x93c1('0x24'),auth[_0x93c1('0x8')](),controller[_0x93c1('0x32')]);module[_0x93c1('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 2b75f10..4d7eb75 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 _0x7b54=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x56f8de,_0x1bee78){var _0x5df982=function(_0x547402){while(--_0x547402){_0x56f8de['push'](_0x56f8de['shift']());}};_0x5df982(++_0x1bee78);}(_0x7b54,0xa8));var _0x47b5=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x7b54[_0x6a0266];return _0x309e00;};'use strict';var Sequelize=require(_0x47b5('0x0'));module[_0x47b5('0x1')]={'body':{'type':Sequelize[_0x47b5('0x2')](_0x47b5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x47b5('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47b5('0x5')]}}; \ No newline at end of file +var _0xdbae=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x3d7480,_0x44170b){var _0x1d435d=function(_0x4745ae){while(--_0x4745ae){_0x3d7480['push'](_0x3d7480['shift']());}};_0x1d435d(++_0x44170b);}(_0xdbae,0x13d));var _0xedba=function(_0x1c35e9,_0x20ccb3){_0x1c35e9=_0x1c35e9-0x0;var _0x11831d=_0xdbae[_0x1c35e9];return _0x11831d;};'use strict';var Sequelize=require(_0xedba('0x0'));module[_0xedba('0x1')]={'body':{'type':Sequelize[_0xedba('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xedba('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a82bfb8..55a6987 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 _0x197d=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','describe','get','lastMessageAt','createdAt','lastMessage','format','User','agent','admin','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','push','messages','FromId','ToId','all','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','limit','count','set','apply','save','update','then','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x589da7,_0x165fac){var _0x809a94=function(_0x109c24){while(--_0x109c24){_0x589da7['push'](_0x589da7['shift']());}};_0x809a94(++_0x165fac);}(_0x197d,0x107));var _0xd197=function(_0x30a550,_0x1e4a6e){_0x30a550=_0x30a550-0x0;var _0x494912=_0x197d[_0x30a550];return _0x494912;};'use strict';var emlformat=require(_0xd197('0x0'));var rimraf=require(_0xd197('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd197('0x2'));var rp=require('request-promise');var moment=require(_0xd197('0x3'));var BPromise=require(_0xd197('0x4'));var Mustache=require('mustache');var util=require(_0xd197('0x5'));var path=require(_0xd197('0x6'));var sox=require(_0xd197('0x7'));var csv=require(_0xd197('0x8'));var ejs=require(_0xd197('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd197('0xa'));var crypto=require(_0xd197('0xb'));var jsforce=require(_0xd197('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd197('0x8'));var querystring=require('querystring');var Papa=require(_0xd197('0xd'));var Redis=require(_0xd197('0xe'));var authService=require(_0xd197('0xf'));var qs=require(_0xd197('0x10'));var as=require(_0xd197('0x11'));var hardwareService=require(_0xd197('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd197('0x13'));var config=require(_0xd197('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd197('0x15'))['db'];config[_0xd197('0x16')]=_[_0xd197('0x17')](config[_0xd197('0x16')],{'host':_0xd197('0x18'),'port':0x18eb});var socket=require(_0xd197('0x19'))(new Redis(config[_0xd197('0x16')]));require(_0xd197('0x1a'))[_0xd197('0x1b')](socket);function respondWithStatusCode(_0x29892f,_0x43216b){_0x43216b=_0x43216b||0xcc;return function(_0x22568a){if(_0x22568a){return _0x29892f[_0xd197('0x1c')](_0x43216b);}return _0x29892f['status'](_0x43216b)[_0xd197('0x1d')]();};}function respondWithResult(_0x25f83b,_0x65d231){_0x65d231=_0x65d231||0xc8;return function(_0x90a76f){if(_0x90a76f){return _0x25f83b[_0xd197('0x1e')](_0x65d231)[_0xd197('0x1f')](_0x90a76f);}};}function respondWithFilteredResult(_0x26a1a1,_0x318c26){return function(_0x3698d3){if(_0x3698d3){var _0x2a9541=typeof _0x318c26[_0xd197('0x20')]==='undefined'&&typeof _0x318c26[_0xd197('0x21')]==='undefined';var _0x2d8e81=_0x3698d3['count'];var _0x22ac55=_0x2a9541?0x0:_0x318c26[_0xd197('0x20')];var _0x590261=_0x2a9541?_0x3698d3[_0xd197('0x22')]:_0x318c26[_0xd197('0x20')]+_0x318c26['limit'];var _0x5f5329;if(_0x590261>=_0x2d8e81){_0x590261=_0x2d8e81;_0x5f5329=0xc8;}else{_0x5f5329=0xce;}_0x26a1a1['status'](_0x5f5329);return _0x26a1a1[_0xd197('0x23')]('Content-Range',_0x22ac55+'-'+_0x590261+'/'+_0x2d8e81)[_0xd197('0x1f')](_0x3698d3);}return null;};}function patchUpdates(_0x275871){return function(_0x40c563){try{jsonpatch[_0xd197('0x24')](_0x40c563,_0x275871,!![]);}catch(_0x39d270){return BPromise['reject'](_0x39d270);}return _0x40c563[_0xd197('0x25')]();};}function saveUpdates(_0x4fb6f4,_0x3d66ce){return function(_0x1ac68b){if(_0x1ac68b){return _0x1ac68b[_0xd197('0x26')](_0x4fb6f4)[_0xd197('0x27')](function(_0xeba565){return _0xeba565;});}return null;};}function removeEntity(_0x264f70,_0x34ece9){return function(_0x1bcb9e){if(_0x1bcb9e){return _0x1bcb9e['destroy']()[_0xd197('0x27')](function(){_0x264f70[_0xd197('0x1e')](0xcc)[_0xd197('0x1d')]();});}};}function handleEntityNotFound(_0x14bef8,_0x569eb3){return function(_0x5beba8){if(!_0x5beba8){_0x14bef8['sendStatus'](0x194);}return _0x5beba8;};}function handleError(_0x36f0ba,_0x1c84a0){_0x1c84a0=_0x1c84a0||0x1f4;return function(_0x155bf0){logger[_0xd197('0x28')](_0x155bf0[_0xd197('0x29')]);if(_0x155bf0[_0xd197('0x2a')]){delete _0x155bf0['name'];}_0x36f0ba[_0xd197('0x1e')](_0x1c84a0)['send'](_0x155bf0);};}exports[_0xd197('0x2b')]=function(_0x52059e,_0x1a25b3){var _0x57884e={},_0x30aebd={},_0x430f13={'count':0x0,'rows':[]};var _0x1d5bb5=_[_0xd197('0x2c')](db['ChatInternalMessage'][_0xd197('0x2d')],function(_0x50bea6){return{'name':_0x50bea6['fieldName'],'type':_0x50bea6['type'][_0xd197('0x2e')]};});_0x30aebd[_0xd197('0x2f')]=_[_0xd197('0x2c')](_0x1d5bb5,_0xd197('0x2a'));_0x30aebd[_0xd197('0x30')]=_[_0xd197('0x31')](_0x52059e[_0xd197('0x30')]);_0x30aebd[_0xd197('0x32')]=_['intersection'](_0x30aebd[_0xd197('0x2f')],_0x30aebd['query']);_0x57884e[_0xd197('0x33')]=_[_0xd197('0x34')](_0x30aebd[_0xd197('0x2f')],qs[_0xd197('0x35')](_0x52059e[_0xd197('0x30')][_0xd197('0x35')]));_0x57884e[_0xd197('0x33')]=_0x57884e[_0xd197('0x33')][_0xd197('0x36')]?_0x57884e[_0xd197('0x33')]:_0x30aebd['model'];if(!_0x52059e[_0xd197('0x30')][_0xd197('0x37')](_0xd197('0x38'))){_0x57884e[_0xd197('0x21')]=qs[_0xd197('0x21')](_0x52059e[_0xd197('0x30')][_0xd197('0x21')]);_0x57884e[_0xd197('0x20')]=qs[_0xd197('0x20')](_0x52059e[_0xd197('0x30')][_0xd197('0x20')]);}_0x57884e[_0xd197('0x39')]=qs[_0xd197('0x3a')](_0x52059e['query']['sort']);_0x57884e[_0xd197('0x3b')]=qs[_0xd197('0x32')](_['pick'](_0x52059e[_0xd197('0x30')],_0x30aebd['filters']),_0x1d5bb5);if(_0x52059e[_0xd197('0x30')][_0xd197('0x3c')]){_0x57884e[_0xd197('0x3b')]=_[_0xd197('0x3d')](_0x57884e[_0xd197('0x3b')],{'$or':_['map'](_0x1d5bb5,function(_0x2ede94){if(_0x2ede94['type']!==_0xd197('0x3e')){var _0x1d0d15={};_0x1d0d15[_0x2ede94[_0xd197('0x2a')]]={'$like':'%'+_0x52059e[_0xd197('0x30')][_0xd197('0x3c')]+'%'};return _0x1d0d15;}})});}_0x57884e=_['merge']({},_0x57884e,_0x52059e['options']);var _0x3789f5={'where':_0x57884e['where']};return db[_0xd197('0x3f')][_0xd197('0x22')](_0x3789f5)[_0xd197('0x27')](function(_0x377486){_0x430f13[_0xd197('0x22')]=_0x377486;if(_0x52059e[_0xd197('0x30')][_0xd197('0x40')]){_0x57884e[_0xd197('0x41')]=[{'all':!![]}];}return db[_0xd197('0x3f')][_0xd197('0x42')](_0x57884e);})['then'](function(_0x112479){_0x430f13[_0xd197('0x43')]=_0x112479;return _0x430f13;})[_0xd197('0x27')](respondWithFilteredResult(_0x1a25b3,_0x57884e))[_0xd197('0x44')](handleError(_0x1a25b3,null));};exports[_0xd197('0x45')]=function(_0x5a7d05,_0xd5cdf7){var _0x3b2cc4={'raw':!![],'where':{'id':_0x5a7d05['params']['id']}},_0x12ea6c={};_0x12ea6c[_0xd197('0x2f')]=_['keys'](db[_0xd197('0x3f')][_0xd197('0x2d')]);_0x12ea6c[_0xd197('0x30')]=_[_0xd197('0x31')](_0x5a7d05[_0xd197('0x30')]);_0x12ea6c[_0xd197('0x32')]=_[_0xd197('0x34')](_0x12ea6c[_0xd197('0x2f')],_0x12ea6c[_0xd197('0x30')]);_0x3b2cc4['attributes']=_[_0xd197('0x34')](_0x12ea6c[_0xd197('0x2f')],qs[_0xd197('0x35')](_0x5a7d05[_0xd197('0x30')]['fields']));_0x3b2cc4[_0xd197('0x33')]=_0x3b2cc4['attributes'][_0xd197('0x36')]?_0x3b2cc4['attributes']:_0x12ea6c['model'];if(_0x5a7d05[_0xd197('0x30')][_0xd197('0x40')]){_0x3b2cc4[_0xd197('0x41')]=[{'all':!![]}];}_0x3b2cc4=_['merge']({},_0x3b2cc4,_0x5a7d05[_0xd197('0x46')]);return db['ChatInternalMessage'][_0xd197('0x47')](_0x3b2cc4)[_0xd197('0x27')](handleEntityNotFound(_0xd5cdf7,null))[_0xd197('0x27')](respondWithResult(_0xd5cdf7,null))[_0xd197('0x44')](handleError(_0xd5cdf7,null));};exports[_0xd197('0x48')]=function(_0x167df3,_0x2c6d83){return db[_0xd197('0x3f')][_0xd197('0x48')](_0x167df3[_0xd197('0x49')],{})['then'](respondWithResult(_0x2c6d83,0xc9))[_0xd197('0x44')](handleError(_0x2c6d83,null));};exports[_0xd197('0x26')]=function(_0x585520,_0x26e850){if(_0x585520[_0xd197('0x49')]['id']){delete _0x585520[_0xd197('0x49')]['id'];}return db['ChatInternalMessage'][_0xd197('0x47')]({'where':{'id':_0x585520[_0xd197('0x4a')]['id']}})[_0xd197('0x27')](handleEntityNotFound(_0x26e850,null))[_0xd197('0x27')](saveUpdates(_0x585520['body'],null))[_0xd197('0x27')](respondWithResult(_0x26e850,null))[_0xd197('0x44')](handleError(_0x26e850,null));};exports[_0xd197('0x4b')]=function(_0x4c340c,_0x242e5d){return db[_0xd197('0x3f')][_0xd197('0x47')]({'where':{'id':_0x4c340c['params']['id']}})[_0xd197('0x27')](handleEntityNotFound(_0x242e5d,null))[_0xd197('0x27')](removeEntity(_0x242e5d,null))[_0xd197('0x44')](handleError(_0x242e5d,null));};exports[_0xd197('0x4c')]=function(_0x496a2a,_0x575879){return db[_0xd197('0x3f')][_0xd197('0x4c')]()[_0xd197('0x27')](respondWithResult(_0x575879,null))['catch'](handleError(_0x575879,null));};function wrapUser(_0x21c710){return function(_0x5ef1a0){var _0x51c8ad=_0x21c710[_0xd197('0x4d')]({'plain':!![]});_0x51c8ad['messages']=[];if(_0x5ef1a0){_0x51c8ad[_0xd197('0x4e')]=_0x5ef1a0[_0xd197('0x4f')];_0x51c8ad[_0xd197('0x50')]=_0x5ef1a0;}else{_0x51c8ad[_0xd197('0x4e')]=moment(0x0)[_0xd197('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x51c8ad[_0xd197('0x50')]={};}return _0x51c8ad;};}exports['getUsers']=function(_0x90f26e,_0x5161d3,_0x18f67b){var _0x1e4b69=[];return db[_0xd197('0x52')]['findAll']({'where':{'role':[_0xd197('0x53'),_0xd197('0x54'),'user']},'attributes':['id',_0xd197('0x55'),_0xd197('0x2a'),_0xd197('0x56'),_0xd197('0x57'),_0xd197('0x58'),'online',_0xd197('0x59'),_0xd197('0x5a'),_0xd197('0x5b')],'order':qs[_0xd197('0x3a')](_0xd197('0x5c')),'include':[{'model':db[_0xd197('0x5d')],'as':_0xd197('0x5e'),'attributes':['id',_0xd197('0x2a'),_0xd197('0x5f')],'through':{'attributes':[]}}]})[_0xd197('0x27')](function(_0x30222e){if(_0x30222e){var _0x231149=_0x90f26e[_0xd197('0x60')][_0xd197('0x4d')]({'plain':!![]});if(!_0x231149)throw new Error(_0xd197('0x61'));if(_0x231149['role']==='user'){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x231149[_0xd197('0x62')]},'raw':!![]})[_0xd197('0x27')](function(_0x563b9a){if(_0x563b9a){if(_0x563b9a[_0xd197('0x63')]===0x0){return db[_0xd197('0x64')][_0xd197('0x42')]({'where':{'sectionId':_0x563b9a['id']},'raw':!![]})[_0xd197('0x27')](function(_0x5f44c6){var _0x3e6fce=[];if(_['isEmpty'](_0x5f44c6)){_0x3e6fce=_[_0xd197('0x3c')](_0x30222e,function(_0x184efe){if(_0x184efe[_0xd197('0x56')]!=='agent'){return _0x184efe;}});return _0x3e6fce;}else{for(var _0x26a3c8=0x0;_0x26a3c8<_0x30222e['length'];_0x26a3c8++){var _0x2a951c=_0x30222e[_0x26a3c8];if(_0x2a951c[_0xd197('0x56')]===_0xd197('0x53')){var _0x384d34=_[_0xd197('0x47')](_0x5f44c6,function(_0x1e66ca){return _0x1e66ca['resourceId']===_0x2a951c['id'];});if(_0x384d34)_0x3e6fce[_0xd197('0x65')](_0x2a951c);}else{_0x3e6fce[_0xd197('0x65')](_0x2a951c);}}return _0x3e6fce;}});}else{return _0x30222e;}}else{var _0x603753=_[_0xd197('0x3c')](_0x30222e,function(_0x40c723){if(_0x40c723['role']!==_0xd197('0x53')){return _0x40c723;}});return _0x603753;}});}else{return _0x30222e;}}})[_0xd197('0x27')](function(_0x1d9b9f){var _0x21e87d=[];if(_0x1d9b9f){_0x1e4b69=_0x1d9b9f;for(var _0x4a4b8a=0x0;_0x4a4b8a<_0x1d9b9f[_0xd197('0x36')];_0x4a4b8a+=0x1){_0x1e4b69[_0x4a4b8a][_0xd197('0x66')]=[];_0x21e87d[_0xd197('0x65')](db[_0xd197('0x3f')]['find']({'where':{'FromId':[_0x90f26e[_0xd197('0x60')]['id'],_0x1d9b9f[_0x4a4b8a]['id']],'ToId':[_0x90f26e[_0xd197('0x60')]['id'],_0x1d9b9f[_0x4a4b8a]['id']],'ChatGroupId':null},'attributes':['id',_0xd197('0x4f'),_0xd197('0x67'),_0xd197('0x68'),'read',_0xd197('0x49')],'order':qs[_0xd197('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd197('0x27')](wrapUser(_0x1d9b9f[_0x4a4b8a])));}return BPromise[_0xd197('0x69')](_0x21e87d);}return[];})[_0xd197('0x27')](function(_0x2230d4){return{'rows':_0x2230d4,'count':_0x2230d4['length']};})[_0xd197('0x27')](respondWithResult(_0x5161d3,null))[_0xd197('0x44')](handleError(_0x5161d3,null));}; \ No newline at end of file +var _0xed0e=['lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','-createdAt','all','length','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','filters','intersection','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','role','userpic'];(function(_0x3527b3,_0x3ccdca){var _0x195ee9=function(_0x20ca18){while(--_0x20ca18){_0x3527b3['push'](_0x3527b3['shift']());}};_0x195ee9(++_0x3ccdca);}(_0xed0e,0x1d4));var _0xeed0=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xed0e[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0xeed0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeed0('0x1'));var jsonpatch=require(_0xeed0('0x2'));var rp=require(_0xeed0('0x3'));var moment=require('moment');var BPromise=require(_0xeed0('0x4'));var Mustache=require(_0xeed0('0x5'));var util=require('util');var path=require(_0xeed0('0x6'));var sox=require(_0xeed0('0x7'));var csv=require(_0xeed0('0x8'));var ejs=require(_0xeed0('0x9'));var fs=require('fs');var fs_extra=require(_0xeed0('0xa'));var _=require(_0xeed0('0xb'));var squel=require(_0xeed0('0xc'));var crypto=require(_0xeed0('0xd'));var jsforce=require(_0xeed0('0xe'));var deskjs=require(_0xeed0('0xf'));var toCsv=require(_0xeed0('0x8'));var querystring=require(_0xeed0('0x10'));var Papa=require(_0xeed0('0x11'));var Redis=require(_0xeed0('0x12'));var authService=require(_0xeed0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeed0('0x14'));var hardwareService=require(_0xeed0('0x15'));var logger=require(_0xeed0('0x16'))(_0xeed0('0x17'));var utils=require(_0xeed0('0x18'));var config=require(_0xeed0('0x19'));var licenseUtil=require(_0xeed0('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xeed0('0x1b'),'port':0x18eb});var socket=require(_0xeed0('0x1c'))(new Redis(config['redis']));require(_0xeed0('0x1d'))[_0xeed0('0x1e')](socket);function respondWithStatusCode(_0x5b02ce,_0x2337a6){_0x2337a6=_0x2337a6||0xcc;return function(_0x394679){if(_0x394679){return _0x5b02ce[_0xeed0('0x1f')](_0x2337a6);}return _0x5b02ce[_0xeed0('0x20')](_0x2337a6)['end']();};}function respondWithResult(_0x1545fc,_0x170a57){_0x170a57=_0x170a57||0xc8;return function(_0x59612e){if(_0x59612e){return _0x1545fc[_0xeed0('0x20')](_0x170a57)[_0xeed0('0x21')](_0x59612e);}};}function respondWithFilteredResult(_0xcbf65e,_0x303f2f){return function(_0x3c1cd6){if(_0x3c1cd6){var _0x2894f9=typeof _0x303f2f[_0xeed0('0x22')]==='undefined'&&typeof _0x303f2f['limit']===_0xeed0('0x23');var _0x31b8e0=_0x3c1cd6[_0xeed0('0x24')];var _0x450c3d=_0x2894f9?0x0:_0x303f2f[_0xeed0('0x22')];var _0x19c0b4=_0x2894f9?_0x3c1cd6[_0xeed0('0x24')]:_0x303f2f[_0xeed0('0x22')]+_0x303f2f[_0xeed0('0x25')];var _0x23e376;if(_0x19c0b4>=_0x31b8e0){_0x19c0b4=_0x31b8e0;_0x23e376=0xc8;}else{_0x23e376=0xce;}_0xcbf65e['status'](_0x23e376);return _0xcbf65e[_0xeed0('0x26')](_0xeed0('0x27'),_0x450c3d+'-'+_0x19c0b4+'/'+_0x31b8e0)[_0xeed0('0x21')](_0x3c1cd6);}return null;};}function patchUpdates(_0x2154ee){return function(_0x3aa002){try{jsonpatch[_0xeed0('0x28')](_0x3aa002,_0x2154ee,!![]);}catch(_0x1ee0bb){return BPromise['reject'](_0x1ee0bb);}return _0x3aa002[_0xeed0('0x29')]();};}function saveUpdates(_0xb9f386,_0xb18dca){return function(_0x460398){if(_0x460398){return _0x460398[_0xeed0('0x2a')](_0xb9f386)[_0xeed0('0x2b')](function(_0x56eab5){return _0x56eab5;});}return null;};}function removeEntity(_0x560c5d,_0x327a66){return function(_0x5dc30d){if(_0x5dc30d){return _0x5dc30d[_0xeed0('0x2c')]()['then'](function(){_0x560c5d[_0xeed0('0x20')](0xcc)[_0xeed0('0x2d')]();});}};}function handleEntityNotFound(_0x486b39,_0x2082ec){return function(_0x53c9ff){if(!_0x53c9ff){_0x486b39[_0xeed0('0x1f')](0x194);}return _0x53c9ff;};}function handleError(_0x5d5ce9,_0x491ba2){_0x491ba2=_0x491ba2||0x1f4;return function(_0x4efef6){logger[_0xeed0('0x2e')](_0x4efef6[_0xeed0('0x2f')]);if(_0x4efef6['name']){delete _0x4efef6[_0xeed0('0x30')];}_0x5d5ce9['status'](_0x491ba2)[_0xeed0('0x31')](_0x4efef6);};}exports[_0xeed0('0x32')]=function(_0x483713,_0x33aade){var _0x2ecd4d={},_0x503db4={},_0x1dbe9a={'count':0x0,'rows':[]};var _0xc8982c=_['map'](db[_0xeed0('0x33')][_0xeed0('0x34')],function(_0xd450c3){return{'name':_0xd450c3[_0xeed0('0x35')],'type':_0xd450c3['type'][_0xeed0('0x36')]};});_0x503db4[_0xeed0('0x37')]=_[_0xeed0('0x38')](_0xc8982c,_0xeed0('0x30'));_0x503db4['query']=_['keys'](_0x483713['query']);_0x503db4[_0xeed0('0x39')]=_[_0xeed0('0x3a')](_0x503db4['model'],_0x503db4['query']);_0x2ecd4d[_0xeed0('0x3b')]=_[_0xeed0('0x3a')](_0x503db4[_0xeed0('0x37')],qs['fields'](_0x483713[_0xeed0('0x3c')][_0xeed0('0x3d')]));_0x2ecd4d[_0xeed0('0x3b')]=_0x2ecd4d[_0xeed0('0x3b')]['length']?_0x2ecd4d[_0xeed0('0x3b')]:_0x503db4[_0xeed0('0x37')];if(!_0x483713[_0xeed0('0x3c')][_0xeed0('0x3e')](_0xeed0('0x3f'))){_0x2ecd4d[_0xeed0('0x25')]=qs[_0xeed0('0x25')](_0x483713[_0xeed0('0x3c')][_0xeed0('0x25')]);_0x2ecd4d[_0xeed0('0x22')]=qs[_0xeed0('0x22')](_0x483713['query']['offset']);}_0x2ecd4d[_0xeed0('0x40')]=qs[_0xeed0('0x41')](_0x483713[_0xeed0('0x3c')]['sort']);_0x2ecd4d[_0xeed0('0x42')]=qs['filters'](_[_0xeed0('0x43')](_0x483713[_0xeed0('0x3c')],_0x503db4[_0xeed0('0x39')]),_0xc8982c);if(_0x483713[_0xeed0('0x3c')]['filter']){_0x2ecd4d['where']=_[_0xeed0('0x44')](_0x2ecd4d[_0xeed0('0x42')],{'$or':_['map'](_0xc8982c,function(_0x272d7e){if(_0x272d7e[_0xeed0('0x45')]!==_0xeed0('0x46')){var _0x227433={};_0x227433[_0x272d7e[_0xeed0('0x30')]]={'$like':'%'+_0x483713[_0xeed0('0x3c')][_0xeed0('0x47')]+'%'};return _0x227433;}})});}_0x2ecd4d=_[_0xeed0('0x44')]({},_0x2ecd4d,_0x483713[_0xeed0('0x48')]);var _0x2f1393={'where':_0x2ecd4d[_0xeed0('0x42')]};return db[_0xeed0('0x33')][_0xeed0('0x24')](_0x2f1393)[_0xeed0('0x2b')](function(_0x400fbb){_0x1dbe9a['count']=_0x400fbb;if(_0x483713[_0xeed0('0x3c')][_0xeed0('0x49')]){_0x2ecd4d[_0xeed0('0x4a')]=[{'all':!![]}];}return db[_0xeed0('0x33')][_0xeed0('0x4b')](_0x2ecd4d);})[_0xeed0('0x2b')](function(_0xb59485){_0x1dbe9a['rows']=_0xb59485;return _0x1dbe9a;})[_0xeed0('0x2b')](respondWithFilteredResult(_0x33aade,_0x2ecd4d))[_0xeed0('0x4c')](handleError(_0x33aade,null));};exports[_0xeed0('0x4d')]=function(_0x4bd65d,_0x94cb0){var _0x470ca4={'raw':!![],'where':{'id':_0x4bd65d[_0xeed0('0x4e')]['id']}},_0x5b98dd={};_0x5b98dd[_0xeed0('0x37')]=_[_0xeed0('0x4f')](db[_0xeed0('0x33')]['rawAttributes']);_0x5b98dd[_0xeed0('0x3c')]=_[_0xeed0('0x4f')](_0x4bd65d['query']);_0x5b98dd['filters']=_[_0xeed0('0x3a')](_0x5b98dd[_0xeed0('0x37')],_0x5b98dd[_0xeed0('0x3c')]);_0x470ca4['attributes']=_['intersection'](_0x5b98dd[_0xeed0('0x37')],qs[_0xeed0('0x3d')](_0x4bd65d[_0xeed0('0x3c')]['fields']));_0x470ca4['attributes']=_0x470ca4[_0xeed0('0x3b')]['length']?_0x470ca4[_0xeed0('0x3b')]:_0x5b98dd[_0xeed0('0x37')];if(_0x4bd65d['query'][_0xeed0('0x49')]){_0x470ca4[_0xeed0('0x4a')]=[{'all':!![]}];}_0x470ca4=_[_0xeed0('0x44')]({},_0x470ca4,_0x4bd65d[_0xeed0('0x48')]);return db[_0xeed0('0x33')]['find'](_0x470ca4)[_0xeed0('0x2b')](handleEntityNotFound(_0x94cb0,null))[_0xeed0('0x2b')](respondWithResult(_0x94cb0,null))[_0xeed0('0x4c')](handleError(_0x94cb0,null));};exports['create']=function(_0x10c1d4,_0x174c3d){return db[_0xeed0('0x33')]['create'](_0x10c1d4[_0xeed0('0x50')],{})[_0xeed0('0x2b')](respondWithResult(_0x174c3d,0xc9))[_0xeed0('0x4c')](handleError(_0x174c3d,null));};exports['update']=function(_0x1491c6,_0x44b212){if(_0x1491c6[_0xeed0('0x50')]['id']){delete _0x1491c6[_0xeed0('0x50')]['id'];}return db[_0xeed0('0x33')][_0xeed0('0x51')]({'where':{'id':_0x1491c6[_0xeed0('0x4e')]['id']}})[_0xeed0('0x2b')](handleEntityNotFound(_0x44b212,null))['then'](saveUpdates(_0x1491c6[_0xeed0('0x50')],null))[_0xeed0('0x2b')](respondWithResult(_0x44b212,null))['catch'](handleError(_0x44b212,null));};exports[_0xeed0('0x2c')]=function(_0x27a5fc,_0xdc3c51){return db[_0xeed0('0x33')][_0xeed0('0x51')]({'where':{'id':_0x27a5fc[_0xeed0('0x4e')]['id']}})[_0xeed0('0x2b')](handleEntityNotFound(_0xdc3c51,null))['then'](removeEntity(_0xdc3c51,null))[_0xeed0('0x4c')](handleError(_0xdc3c51,null));};exports['describe']=function(_0x547116,_0x358e19){return db['ChatInternalMessage'][_0xeed0('0x52')]()[_0xeed0('0x2b')](respondWithResult(_0x358e19,null))[_0xeed0('0x4c')](handleError(_0x358e19,null));};function wrapUser(_0x47a17e){return function(_0x4148d9){var _0x2e8725=_0x47a17e[_0xeed0('0x53')]({'plain':!![]});_0x2e8725[_0xeed0('0x54')]=[];if(_0x4148d9){_0x2e8725[_0xeed0('0x55')]=_0x4148d9[_0xeed0('0x56')];_0x2e8725[_0xeed0('0x57')]=_0x4148d9;}else{_0x2e8725[_0xeed0('0x55')]=moment(0x0)['format'](_0xeed0('0x58'));_0x2e8725['lastMessage']={};}return _0x2e8725;};}exports[_0xeed0('0x59')]=function(_0x1636ae,_0x3bc278,_0x37c67b){var _0x2a2a3c=[];return db['User']['findAll']({'where':{'role':['agent','admin','user']},'attributes':['id','fullname',_0xeed0('0x30'),_0xeed0('0x5a'),_0xeed0('0x5b'),'internal','online',_0xeed0('0x5c'),_0xeed0('0x5d'),_0xeed0('0x5e')],'order':qs['sort'](_0xeed0('0x5f')),'include':[{'model':db[_0xeed0('0x60')],'as':_0xeed0('0x61'),'attributes':['id',_0xeed0('0x30'),_0xeed0('0x45')],'through':{'attributes':[]}}]})[_0xeed0('0x2b')](function(_0x514fff){if(_0x514fff){var _0x418220=_0x1636ae[_0xeed0('0x62')][_0xeed0('0x53')]({'plain':!![]});if(!_0x418220)throw new Error(_0xeed0('0x63'));if(_0x418220[_0xeed0('0x5a')]===_0xeed0('0x62')){return db['UserProfileSection'][_0xeed0('0x51')]({'where':{'name':_0xeed0('0x64'),'userProfileId':_0x418220[_0xeed0('0x65')]},'raw':!![]})[_0xeed0('0x2b')](function(_0x5d4071){if(_0x5d4071){if(_0x5d4071['autoAssociation']===0x0){return db[_0xeed0('0x66')][_0xeed0('0x4b')]({'where':{'sectionId':_0x5d4071['id']},'raw':!![]})['then'](function(_0x170be8){var _0x2491e9=[];if(_[_0xeed0('0x67')](_0x170be8)){_0x2491e9=_[_0xeed0('0x47')](_0x514fff,function(_0x526609){if(_0x526609[_0xeed0('0x5a')]!==_0xeed0('0x68')){return _0x526609;}});return _0x2491e9;}else{for(var _0x50c6d4=0x0;_0x50c6d4<_0x514fff['length'];_0x50c6d4++){var _0x23f252=_0x514fff[_0x50c6d4];if(_0x23f252[_0xeed0('0x5a')]==='agent'){var _0x369ae9=_[_0xeed0('0x51')](_0x170be8,function(_0x429e5b){return _0x429e5b[_0xeed0('0x69')]===_0x23f252['id'];});if(_0x369ae9)_0x2491e9['push'](_0x23f252);}else{_0x2491e9[_0xeed0('0x6a')](_0x23f252);}}return _0x2491e9;}});}else{return _0x514fff;}}else{var _0x67e2e4=_[_0xeed0('0x47')](_0x514fff,function(_0x546280){if(_0x546280[_0xeed0('0x5a')]!=='agent'){return _0x546280;}});return _0x67e2e4;}});}else{return _0x514fff;}}})[_0xeed0('0x2b')](function(_0x49ed62){var _0x6c5839=[];if(_0x49ed62){_0x2a2a3c=_0x49ed62;for(var _0x51b8cd=0x0;_0x51b8cd<_0x49ed62['length'];_0x51b8cd+=0x1){_0x2a2a3c[_0x51b8cd][_0xeed0('0x54')]=[];_0x6c5839[_0xeed0('0x6a')](db[_0xeed0('0x33')][_0xeed0('0x51')]({'where':{'FromId':[_0x1636ae[_0xeed0('0x62')]['id'],_0x49ed62[_0x51b8cd]['id']],'ToId':[_0x1636ae[_0xeed0('0x62')]['id'],_0x49ed62[_0x51b8cd]['id']],'ChatGroupId':null},'attributes':['id',_0xeed0('0x56'),_0xeed0('0x6b'),_0xeed0('0x6c'),'read','body'],'order':qs[_0xeed0('0x41')](_0xeed0('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x49ed62[_0x51b8cd])));}return BPromise[_0xeed0('0x6e')](_0x6c5839);}return[];})[_0xeed0('0x2b')](function(_0x3e9f7b){return{'rows':_0x3e9f7b,'count':_0x3e9f7b[_0xeed0('0x6f')]};})[_0xeed0('0x2b')](respondWithResult(_0x3bc278,null))[_0xeed0('0x4c')](handleError(_0x3bc278,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0d5fa4c..af3323a 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 _0x2174=['events','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2174,0x142));var _0x4217=function(_0x266d0f,_0x16a276){_0x266d0f=_0x266d0f-0x0;var _0x23d450=_0x2174[_0x266d0f];return _0x23d450;};'use strict';var EventEmitter=require(_0x4217('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4217('0x1')](0x0);var events={'afterCreate':_0x4217('0x2'),'afterUpdate':'update','afterDestroy':_0x4217('0x3')};function emitEvent(_0x1ae667){return function(_0x3a09e,_0x435b31,_0x175ca8){ChatInternalMessageEvents['emit'](_0x1ae667+':'+_0x3a09e['id'],_0x3a09e);ChatInternalMessageEvents[_0x4217('0x4')](_0x1ae667,_0x3a09e);_0x175ca8(null);};}for(var e in events){if(events[_0x4217('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x4217('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x9ced=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x38100a,_0x17327c){var _0x59f59e=function(_0x3ab840){while(--_0x3ab840){_0x38100a['push'](_0x38100a['shift']());}};_0x59f59e(++_0x17327c);}(_0x9ced,0x18d));var _0xd9ce=function(_0x581feb,_0x475a85){_0x581feb=_0x581feb-0x0;var _0x29fe1a=_0x9ced[_0x581feb];return _0x29fe1a;};'use strict';var EventEmitter=require(_0xd9ce('0x0'));var ChatInternalMessage=require(_0xd9ce('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd9ce('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd9ce('0x3'),'afterDestroy':_0xd9ce('0x4')};function emitEvent(_0x4ee2bd){return function(_0x469d88,_0x31b99c,_0x2614d7){ChatInternalMessageEvents['emit'](_0x4ee2bd+':'+_0x469d88['id'],_0x469d88);ChatInternalMessageEvents['emit'](_0x4ee2bd,_0x469d88);_0x2614d7(null);};}for(var e in events){if(events[_0xd9ce('0x5')](e)){var event=events[e];ChatInternalMessage[_0xd9ce('0x6')](e,emitEvent(event));}}module[_0xd9ce('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index deaabb1..d25ecdf 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 _0x07d2=['ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','request-promise','rimraf','exports'];(function(_0x57060b,_0xc6ecc){var _0x101612=function(_0x3f2df3){while(--_0x3f2df3){_0x57060b['push'](_0x57060b['shift']());}};_0x101612(++_0xc6ecc);}(_0x07d2,0xb7));var _0x207d=function(_0x5dc0b0,_0x3bb51b){_0x5dc0b0=_0x5dc0b0-0x0;var _0x4af860=_0x07d2[_0x5dc0b0];return _0x4af860;};'use strict';var _=require(_0x207d('0x0'));var util=require(_0x207d('0x1'));var logger=require(_0x207d('0x2'))(_0x207d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x207d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x207d('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x207d('0x6')]=function(_0x2b100c,_0x4a3654){return _0x2b100c['define'](_0x207d('0x7'),attributes,{'tableName':_0x207d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x207d('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x97cb=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x5c1de9,_0x16b37a){var _0x452529=function(_0x42a23b){while(--_0x42a23b){_0x5c1de9['push'](_0x5c1de9['shift']());}};_0x452529(++_0x16b37a);}(_0x97cb,0xda));var _0xb97c=function(_0x5674d4,_0x382e06){_0x5674d4=_0x5674d4-0x0;var _0x5c99b8=_0x97cb[_0x5674d4];return _0x5c99b8;};'use strict';var _=require('lodash');var util=require(_0xb97c('0x0'));var logger=require(_0xb97c('0x1'))('api');var moment=require(_0xb97c('0x2'));var BPromise=require('bluebird');var rp=require(_0xb97c('0x3'));var fs=require('fs');var path=require(_0xb97c('0x4'));var rimraf=require('rimraf');var config=require(_0xb97c('0x5'));var attributes=require(_0xb97c('0x6'));module['exports']=function(_0x413e9d,_0x35b08b){return _0x413e9d[_0xb97c('0x7')](_0xb97c('0x8'),attributes,{'tableName':_0xb97c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb97c('0xa'),'collate':_0xb97c('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e2b144e..60cdc53 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 _0x7005=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','util','moment'];(function(_0x103206,_0x1fae01){var _0x2e2f53=function(_0x34f7ca){while(--_0x34f7ca){_0x103206['push'](_0x103206['shift']());}};_0x2e2f53(++_0x1fae01);}(_0x7005,0x148));var _0x5700=function(_0x5d8251,_0x633d3){_0x5d8251=_0x5d8251-0x0;var _0x1bff1e=_0x7005[_0x5d8251];return _0x1bff1e;};'use strict';var _=require('lodash');var util=require(_0x5700('0x0'));var moment=require(_0x5700('0x1'));var BPromise=require(_0x5700('0x2'));var rs=require(_0x5700('0x3'));var fs=require('fs');var Redis=require(_0x5700('0x4'));var db=require(_0x5700('0x5'))['db'];var utils=require(_0x5700('0x6'));var logger=require(_0x5700('0x7'))(_0x5700('0x8'));var config=require(_0x5700('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5700('0xa')][_0x5700('0xb')]({'port':0x232a});config[_0x5700('0xc')]=_[_0x5700('0xd')](config[_0x5700('0xc')],{'host':_0x5700('0xe'),'port':0x18eb});var socket=require(_0x5700('0xf'))(new Redis(config[_0x5700('0xc')]));require(_0x5700('0x10'))[_0x5700('0x11')](socket);function respondWithRpcPromise(_0x220c7b,_0x2b1ea4,_0x174106){return new BPromise(function(_0x2924e9,_0x2f09a0){return client[_0x5700('0x12')](_0x220c7b,_0x174106)[_0x5700('0x13')](function(_0x5653b4){logger[_0x5700('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x2b1ea4,_0x5700('0x15'));logger[_0x5700('0x16')](_0x5700('0x17'),_0x2b1ea4,'request\x20sent',JSON[_0x5700('0x18')](_0x5653b4));if(_0x5653b4['error']){if(_0x5653b4[_0x5700('0x19')][_0x5700('0x1a')]===0x1f4){logger['error'](_0x5700('0x1b'),_0x2b1ea4,_0x5653b4['error'][_0x5700('0x1c')]);return _0x2f09a0(_0x5653b4[_0x5700('0x19')][_0x5700('0x1c')]);}logger[_0x5700('0x19')](_0x5700('0x1b'),_0x2b1ea4,_0x5653b4[_0x5700('0x19')][_0x5700('0x1c')]);return _0x2924e9(_0x5653b4['error'][_0x5700('0x1c')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x2b1ea4,_0x5700('0x15'));_0x2924e9(_0x5653b4[_0x5700('0x1d')][_0x5700('0x1c')]);}})['catch'](function(_0x3f6b1d){logger[_0x5700('0x19')](_0x5700('0x1b'),_0x2b1ea4,_0x3f6b1d);_0x2f09a0(_0x3f6b1d);});});} \ No newline at end of file +var _0xd1bd=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x352bbd,_0x203817){var _0x5d9978=function(_0x4d4a8f){while(--_0x4d4a8f){_0x352bbd['push'](_0x352bbd['shift']());}};_0x5d9978(++_0x203817);}(_0xd1bd,0x8a));var _0xdd1b=function(_0x47b4d6,_0x13b0b3){_0x47b4d6=_0x47b4d6-0x0;var _0x317a04=_0xd1bd[_0x47b4d6];return _0x317a04;};'use strict';var _=require(_0xdd1b('0x0'));var util=require('util');var moment=require(_0xdd1b('0x1'));var BPromise=require(_0xdd1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd1b('0x3'));var db=require(_0xdd1b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd1b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd1b('0x6'));var client=jayson['client'][_0xdd1b('0x7')]({'port':0x232a});config[_0xdd1b('0x8')]=_[_0xdd1b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdd1b('0xa'))(new Redis(config[_0xdd1b('0x8')]));require('./chatInternalMessage.socket')[_0xdd1b('0xb')](socket);function respondWithRpcPromise(_0x4a1cdf,_0x1e35e6,_0xdc7ee4){return new BPromise(function(_0x1f82bd,_0x4dee13){return client[_0xdd1b('0xc')](_0x4a1cdf,_0xdc7ee4)[_0xdd1b('0xd')](function(_0x28f5ed){logger[_0xdd1b('0xe')](_0xdd1b('0xf'),_0x1e35e6,'request\x20sent');logger['debug'](_0xdd1b('0x10'),_0x1e35e6,_0xdd1b('0x11'),JSON[_0xdd1b('0x12')](_0x28f5ed));if(_0x28f5ed[_0xdd1b('0x13')]){if(_0x28f5ed[_0xdd1b('0x13')]['code']===0x1f4){logger[_0xdd1b('0x13')](_0xdd1b('0xf'),_0x1e35e6,_0x28f5ed['error']['message']);return _0x4dee13(_0x28f5ed[_0xdd1b('0x13')][_0xdd1b('0x14')]);}logger[_0xdd1b('0x13')](_0xdd1b('0xf'),_0x1e35e6,_0x28f5ed['error']['message']);return _0x1f82bd(_0x28f5ed[_0xdd1b('0x13')][_0xdd1b('0x14')]);}else{logger[_0xdd1b('0xe')](_0xdd1b('0xf'),_0x1e35e6,_0xdd1b('0x11'));_0x1f82bd(_0x28f5ed[_0xdd1b('0x15')][_0xdd1b('0x14')]);}})['catch'](function(_0x21429b){logger[_0xdd1b('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1e35e6,_0x21429b);_0x4dee13(_0x21429b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1cd5da3..6cc59e9 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 _0x0435=['save','remove','update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x339e28,_0x341e2c){var _0x1605dd=function(_0x3c6006){while(--_0x3c6006){_0x339e28['push'](_0x339e28['shift']());}};_0x1605dd(++_0x341e2c);}(_0x0435,0x6f));var _0x5043=function(_0x34ad46,_0x6fbd0c){_0x34ad46=_0x34ad46-0x0;var _0xbdd4ea=_0x0435[_0x34ad46];return _0xbdd4ea;};'use strict';var ChatInternalMessageEvents=require(_0x5043('0x0'));var events=[_0x5043('0x1'),_0x5043('0x2'),_0x5043('0x3')];function createListener(_0x4b54e4,_0xa68eed){return function(_0xfa3dbb){_0xa68eed[_0x5043('0x4')](_0x4b54e4,_0xfa3dbb);};}function removeListener(_0x2791b3,_0x313b2f){return function(){ChatInternalMessageEvents[_0x5043('0x5')](_0x2791b3,_0x313b2f);};}exports[_0x5043('0x6')]=function(_0xeaa8b0){for(var _0x397547=0x0,_0x2a9a4a=events['length'];_0x397547<_0x2a9a4a;_0x397547++){var _0x23ae7d=events[_0x397547];var _0x26dc89=createListener(_0x5043('0x7')+_0x23ae7d,_0xeaa8b0);ChatInternalMessageEvents['on'](_0x23ae7d,_0x26dc89);}}; \ No newline at end of file +var _0x026d=['emit','removeListener','register','chatInternalMessage:','update'];(function(_0x443be7,_0x20c06c){var _0x3e70aa=function(_0x21337c){while(--_0x21337c){_0x443be7['push'](_0x443be7['shift']());}};_0x3e70aa(++_0x20c06c);}(_0x026d,0x77));var _0xd026=function(_0x28e2a5,_0xbd8f7b){_0x28e2a5=_0x28e2a5-0x0;var _0x2d9673=_0x026d[_0x28e2a5];return _0x2d9673;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove',_0xd026('0x0')];function createListener(_0x330891,_0x20f3bc){return function(_0x41b320){_0x20f3bc[_0xd026('0x1')](_0x330891,_0x41b320);};}function removeListener(_0x265bdf,_0xe4ae74){return function(){ChatInternalMessageEvents[_0xd026('0x2')](_0x265bdf,_0xe4ae74);};}exports[_0xd026('0x3')]=function(_0x1b34c2){for(var _0x39bea7=0x0,_0x3611b2=events['length'];_0x39bea7<_0x3611b2;_0x39bea7++){var _0x347d04=events[_0x39bea7];var _0x24534d=createListener(_0xd026('0x4')+_0x347d04,_0x1b34c2);ChatInternalMessageEvents['on'](_0x347d04,_0x24534d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d54e3fd..6d45d3e 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 _0x405f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/users','getUsers','/:id','post','create','put','delete'];(function(_0xa4cfa2,_0x4fb42d){var _0x4c2f6c=function(_0x5515bf){while(--_0x5515bf){_0xa4cfa2['push'](_0xa4cfa2['shift']());}};_0x4c2f6c(++_0x4fb42d);}(_0x405f,0x127));var _0xf405=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x405f[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0xf405('0x0'));var path=require(_0xf405('0x1'));var timeout=require(_0xf405('0x2'));var express=require(_0xf405('0x3'));var router=express[_0xf405('0x4')]();var fs_extra=require(_0xf405('0x5'));var auth=require(_0xf405('0x6'));var interaction=require(_0xf405('0x7'));var config=require(_0xf405('0x8'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0xf405('0x9')](),controller[_0xf405('0xa')]);router[_0xf405('0xb')](_0xf405('0xc'),auth[_0xf405('0x9')](),controller['describe']);router[_0xf405('0xb')](_0xf405('0xd'),auth[_0xf405('0x9')](),controller[_0xf405('0xe')]);router[_0xf405('0xb')](_0xf405('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf405('0x10')]('/',auth[_0xf405('0x9')](),controller[_0xf405('0x11')]);router[_0xf405('0x12')](_0xf405('0xf'),controller['update']);router[_0xf405('0x13')](_0xf405('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf405('0x14')]=router; \ No newline at end of file +var _0xefeb=['destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','getUsers','/:id','show','create','put','update','delete'];(function(_0x508221,_0x23eab4){var _0x1d3280=function(_0xa86b35){while(--_0xa86b35){_0x508221['push'](_0x508221['shift']());}};_0x1d3280(++_0x23eab4);}(_0xefeb,0x110));var _0xbefe=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xefeb[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xbefe('0x0'));var path=require(_0xbefe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbefe('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbefe('0x3'));var interaction=require(_0xbefe('0x4'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0xbefe('0x5')](),controller['index']);router[_0xbefe('0x6')](_0xbefe('0x7'),auth[_0xbefe('0x5')](),controller[_0xbefe('0x8')]);router['get']('/users',auth['isAuthenticated'](),controller[_0xbefe('0x9')]);router[_0xbefe('0x6')](_0xbefe('0xa'),auth[_0xbefe('0x5')](),controller[_0xbefe('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbefe('0xc')]);router[_0xbefe('0xd')](_0xbefe('0xa'),controller[_0xbefe('0xe')]);router[_0xbefe('0xf')]('/:id',auth[_0xbefe('0x5')](),controller[_0xbefe('0x10')]);module[_0xbefe('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1662cd9..cc4534b 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 _0x3870=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x4bc2ba,_0x537506){var _0xae9c9b=function(_0x1e5bdd){while(--_0x1e5bdd){_0x4bc2ba['push'](_0x4bc2ba['shift']());}};_0xae9c9b(++_0x537506);}(_0x3870,0x146));var _0x0387=function(_0x260114,_0x25294d){_0x260114=_0x260114-0x0;var _0x19da40=_0x3870[_0x260114];return _0x19da40;};'use strict';var Sequelize=require(_0x0387('0x0'));module[_0x0387('0x1')]={'body':{'type':Sequelize[_0x0387('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0387('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0387('0x4')]('in',_0x0387('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0387('0x6')]},'providerName':{'type':Sequelize[_0x0387('0x7')]},'providerResponse':{'type':Sequelize[_0x0387('0x2')]}}; \ No newline at end of file +var _0xae2b=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x56ec55,_0x4d36e1){var _0x4f8112=function(_0x129fde){while(--_0x129fde){_0x56ec55['push'](_0x56ec55['shift']());}};_0x4f8112(++_0x4d36e1);}(_0xae2b,0xb3));var _0xbae2=function(_0x3d686f,_0x4c898e){_0x3d686f=_0x3d686f-0x0;var _0x1b4b85=_0xae2b[_0x3d686f];return _0x1b4b85;};'use strict';var Sequelize=require(_0xbae2('0x0'));module[_0xbae2('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbae2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbae2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbae2('0x4')]('in',_0xbae2('0x5')),'defaultValue':_0xbae2('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xbae2('0x6')]},'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 9406d42..882c985 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 _0x0c6e=['../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','ChatMessage','includeAll','include','rows','find','create','body','params','describe','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','format','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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'];(function(_0x5c62bb,_0x4bbd42){var _0x5e9ac1=function(_0x32bf15){while(--_0x32bf15){_0x5c62bb['push'](_0x5c62bb['shift']());}};_0x5e9ac1(++_0x4bbd42);}(_0x0c6e,0x6f));var _0xe0c6=function(_0x421bc6,_0x4f57c3){_0x421bc6=_0x421bc6-0x0;var _0x178c24=_0x0c6e[_0x421bc6];return _0x178c24;};'use strict';var emlformat=require(_0xe0c6('0x0'));var rimraf=require(_0xe0c6('0x1'));var zipdir=require(_0xe0c6('0x2'));var jsonpatch=require(_0xe0c6('0x3'));var rp=require('request-promise');var moment=require(_0xe0c6('0x4'));var BPromise=require(_0xe0c6('0x5'));var Mustache=require('mustache');var util=require(_0xe0c6('0x6'));var path=require(_0xe0c6('0x7'));var sox=require('sox');var csv=require(_0xe0c6('0x8'));var ejs=require(_0xe0c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe0c6('0xa'));var _=require(_0xe0c6('0xb'));var squel=require(_0xe0c6('0xc'));var crypto=require(_0xe0c6('0xd'));var jsforce=require(_0xe0c6('0xe'));var deskjs=require(_0xe0c6('0xf'));var toCsv=require(_0xe0c6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0c6('0x10'));var authService=require(_0xe0c6('0x11'));var qs=require(_0xe0c6('0x12'));var as=require(_0xe0c6('0x13'));var hardwareService=require(_0xe0c6('0x14'));var logger=require(_0xe0c6('0x15'))(_0xe0c6('0x16'));var utils=require(_0xe0c6('0x17'));var config=require(_0xe0c6('0x18'));var licenseUtil=require(_0xe0c6('0x19'));var db=require(_0xe0c6('0x1a'))['db'];config['redis']=_['defaults'](config[_0xe0c6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0c6('0x1c'))(new Redis(config[_0xe0c6('0x1b')]));require('./chatMessage.socket')[_0xe0c6('0x1d')](socket);var jayson=require(_0xe0c6('0x1e'));var client=jayson[_0xe0c6('0x1f')][_0xe0c6('0x20')]({'port':0x232c});var client9002=jayson[_0xe0c6('0x1f')][_0xe0c6('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xe5bd93,_0x1efa94,_0x5babb2,_0x325239){return new BPromise(function(_0x26a5c3,_0x3684de){var _0x39e221=_0x325239||client;return _0x39e221[_0xe0c6('0x21')](_0xe5bd93,_0x5babb2)[_0xe0c6('0x22')](function(_0x541995){logger[_0xe0c6('0x23')]('ChatMessage,\x20%s,\x20%s',_0x1efa94,_0xe0c6('0x24'));logger[_0xe0c6('0x25')](_0xe0c6('0x26'),_0x1efa94,_0xe0c6('0x24'),JSON['stringify'](_0x541995));if(_0x541995[_0xe0c6('0x27')]){if(_0x541995[_0xe0c6('0x27')][_0xe0c6('0x28')]===0x1f4){logger[_0xe0c6('0x27')](_0xe0c6('0x29'),_0x1efa94,_0x541995[_0xe0c6('0x27')][_0xe0c6('0x2a')]);return _0x3684de(_0x541995['error'][_0xe0c6('0x2a')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x1efa94,_0x541995['error'][_0xe0c6('0x2a')]);return _0x26a5c3(_0x541995[_0xe0c6('0x27')][_0xe0c6('0x2a')]);}else{logger[_0xe0c6('0x23')](_0xe0c6('0x29'),_0x1efa94,_0xe0c6('0x24'));_0x26a5c3(_0x541995[_0xe0c6('0x2b')][_0xe0c6('0x2a')]);}})[_0xe0c6('0x2c')](function(_0x5939fe){logger[_0xe0c6('0x27')](_0xe0c6('0x29'),_0x1efa94,_0x5939fe);_0x3684de(_0x5939fe);});});}function respondWithStatusCode(_0x98adf0,_0xc206b){_0xc206b=_0xc206b||0xcc;return function(_0x409a38){if(_0x409a38){return _0x98adf0[_0xe0c6('0x2d')](_0xc206b);}return _0x98adf0[_0xe0c6('0x2e')](_0xc206b)[_0xe0c6('0x2f')]();};}function respondWithResult(_0x140c9d,_0x45ad48){_0x45ad48=_0x45ad48||0xc8;return function(_0x3dc01f){if(_0x3dc01f){return _0x140c9d[_0xe0c6('0x2e')](_0x45ad48)['json'](_0x3dc01f);}};}function respondWithFilteredResult(_0x5005d1,_0x56bfd5){return function(_0xe2f549){if(_0xe2f549){var _0x2ad4f6=typeof _0x56bfd5[_0xe0c6('0x30')]===_0xe0c6('0x31')&&typeof _0x56bfd5[_0xe0c6('0x32')]===_0xe0c6('0x31');var _0x89a764=_0xe2f549[_0xe0c6('0x33')];var _0x426b1d=_0x2ad4f6?0x0:_0x56bfd5[_0xe0c6('0x30')];var _0x507cbe=_0x2ad4f6?_0xe2f549[_0xe0c6('0x33')]:_0x56bfd5[_0xe0c6('0x30')]+_0x56bfd5[_0xe0c6('0x32')];var _0xa6592d;if(_0x507cbe>=_0x89a764){_0x507cbe=_0x89a764;_0xa6592d=0xc8;}else{_0xa6592d=0xce;}_0x5005d1[_0xe0c6('0x2e')](_0xa6592d);return _0x5005d1[_0xe0c6('0x34')](_0xe0c6('0x35'),_0x426b1d+'-'+_0x507cbe+'/'+_0x89a764)[_0xe0c6('0x36')](_0xe2f549);}return null;};}function patchUpdates(_0x503c4d){return function(_0x37d409){try{jsonpatch[_0xe0c6('0x37')](_0x37d409,_0x503c4d,!![]);}catch(_0x34fb4a){return BPromise[_0xe0c6('0x38')](_0x34fb4a);}return _0x37d409[_0xe0c6('0x39')]();};}function saveUpdates(_0x663c81,_0x2bac13){return function(_0x4930e2){if(_0x4930e2){return _0x4930e2[_0xe0c6('0x3a')](_0x663c81)['then'](function(_0x1bd821){return _0x1bd821;});}return null;};}function removeEntity(_0x2db537,_0x5ca01a){return function(_0x5d240f){if(_0x5d240f){return _0x5d240f[_0xe0c6('0x3b')]()[_0xe0c6('0x22')](function(){_0x2db537[_0xe0c6('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255d54,_0x4c6969){return function(_0x4d492e){if(!_0x4d492e){_0x255d54['sendStatus'](0x194);}return _0x4d492e;};}function handleError(_0x4311ec,_0x43e36a){_0x43e36a=_0x43e36a||0x1f4;return function(_0xc91c32){logger[_0xe0c6('0x27')](_0xc91c32[_0xe0c6('0x3c')]);if(_0xc91c32['name']){delete _0xc91c32[_0xe0c6('0x3d')];}_0x4311ec[_0xe0c6('0x2e')](_0x43e36a)[_0xe0c6('0x3e')](_0xc91c32);};}exports[_0xe0c6('0x3f')]=function(_0x149738,_0x5569b8){var _0x8972de={},_0x244c33={},_0x574ac8={'count':0x0,'rows':[]};var _0x169797=_[_0xe0c6('0x40')](db['ChatMessage'][_0xe0c6('0x41')],function(_0x16b84a){return{'name':_0x16b84a[_0xe0c6('0x42')],'type':_0x16b84a['type']['key']};});_0x244c33[_0xe0c6('0x43')]=_['map'](_0x169797,'name');_0x244c33[_0xe0c6('0x44')]=_[_0xe0c6('0x45')](_0x149738[_0xe0c6('0x44')]);_0x244c33[_0xe0c6('0x46')]=_['intersection'](_0x244c33[_0xe0c6('0x43')],_0x244c33[_0xe0c6('0x44')]);_0x8972de[_0xe0c6('0x47')]=_[_0xe0c6('0x48')](_0x244c33[_0xe0c6('0x43')],qs[_0xe0c6('0x49')](_0x149738[_0xe0c6('0x44')]['fields']));_0x8972de['attributes']=_0x8972de['attributes'][_0xe0c6('0x4a')]?_0x8972de['attributes']:_0x244c33[_0xe0c6('0x43')];if(!_0x149738[_0xe0c6('0x44')][_0xe0c6('0x4b')]('nolimit')){_0x8972de[_0xe0c6('0x32')]=qs[_0xe0c6('0x32')](_0x149738[_0xe0c6('0x44')][_0xe0c6('0x32')]);_0x8972de['offset']=qs[_0xe0c6('0x30')](_0x149738[_0xe0c6('0x44')][_0xe0c6('0x30')]);}_0x8972de[_0xe0c6('0x4c')]=qs[_0xe0c6('0x4d')](_0x149738['query'][_0xe0c6('0x4d')]);_0x8972de[_0xe0c6('0x4e')]=qs[_0xe0c6('0x46')](_['pick'](_0x149738[_0xe0c6('0x44')],_0x244c33[_0xe0c6('0x46')]),_0x169797);if(_0x149738[_0xe0c6('0x44')][_0xe0c6('0x4f')]){_0x8972de['where']=_['merge'](_0x8972de[_0xe0c6('0x4e')],{'$or':_[_0xe0c6('0x40')](_0x169797,function(_0x4eb6b1){if(_0x4eb6b1['type']!==_0xe0c6('0x50')){var _0x3715e7={};_0x3715e7[_0x4eb6b1[_0xe0c6('0x3d')]]={'$like':'%'+_0x149738[_0xe0c6('0x44')][_0xe0c6('0x4f')]+'%'};return _0x3715e7;}})});}_0x8972de=_[_0xe0c6('0x51')]({},_0x8972de,_0x149738[_0xe0c6('0x52')]);var _0x31071b={'where':_0x8972de[_0xe0c6('0x4e')]};return db[_0xe0c6('0x53')][_0xe0c6('0x33')](_0x31071b)[_0xe0c6('0x22')](function(_0x319aa2){_0x574ac8[_0xe0c6('0x33')]=_0x319aa2;if(_0x149738[_0xe0c6('0x44')][_0xe0c6('0x54')]){_0x8972de[_0xe0c6('0x55')]=[{'all':!![]}];}return db[_0xe0c6('0x53')]['findAll'](_0x8972de);})[_0xe0c6('0x22')](function(_0x25f1e3){_0x574ac8[_0xe0c6('0x56')]=_0x25f1e3;return _0x574ac8;})[_0xe0c6('0x22')](respondWithFilteredResult(_0x5569b8,_0x8972de))['catch'](handleError(_0x5569b8,null));};exports['show']=function(_0x3b2e7b,_0xcc16d5){var _0x2b7e4c={'raw':!![],'where':{'id':_0x3b2e7b['params']['id']}},_0x42bf6f={};_0x42bf6f[_0xe0c6('0x43')]=_['keys'](db[_0xe0c6('0x53')]['rawAttributes']);_0x42bf6f[_0xe0c6('0x44')]=_[_0xe0c6('0x45')](_0x3b2e7b[_0xe0c6('0x44')]);_0x42bf6f[_0xe0c6('0x46')]=_[_0xe0c6('0x48')](_0x42bf6f[_0xe0c6('0x43')],_0x42bf6f[_0xe0c6('0x44')]);_0x2b7e4c[_0xe0c6('0x47')]=_[_0xe0c6('0x48')](_0x42bf6f[_0xe0c6('0x43')],qs['fields'](_0x3b2e7b[_0xe0c6('0x44')]['fields']));_0x2b7e4c[_0xe0c6('0x47')]=_0x2b7e4c[_0xe0c6('0x47')][_0xe0c6('0x4a')]?_0x2b7e4c[_0xe0c6('0x47')]:_0x42bf6f[_0xe0c6('0x43')];if(_0x3b2e7b[_0xe0c6('0x44')][_0xe0c6('0x54')]){_0x2b7e4c[_0xe0c6('0x55')]=[{'all':!![]}];}_0x2b7e4c=_[_0xe0c6('0x51')]({},_0x2b7e4c,_0x3b2e7b[_0xe0c6('0x52')]);return db[_0xe0c6('0x53')][_0xe0c6('0x57')](_0x2b7e4c)[_0xe0c6('0x22')](handleEntityNotFound(_0xcc16d5,null))[_0xe0c6('0x22')](respondWithResult(_0xcc16d5,null))[_0xe0c6('0x2c')](handleError(_0xcc16d5,null));};exports[_0xe0c6('0x58')]=function(_0x12cbf4,_0x517430){return db['ChatMessage'][_0xe0c6('0x58')](_0x12cbf4[_0xe0c6('0x59')],{})[_0xe0c6('0x22')](respondWithResult(_0x517430,0xc9))[_0xe0c6('0x2c')](handleError(_0x517430,null));};exports[_0xe0c6('0x3a')]=function(_0x2e2544,_0x1055fd){if(_0x2e2544[_0xe0c6('0x59')]['id']){delete _0x2e2544[_0xe0c6('0x59')]['id'];}return db['ChatMessage'][_0xe0c6('0x57')]({'where':{'id':_0x2e2544[_0xe0c6('0x5a')]['id']}})[_0xe0c6('0x22')](handleEntityNotFound(_0x1055fd,null))[_0xe0c6('0x22')](saveUpdates(_0x2e2544[_0xe0c6('0x59')],null))[_0xe0c6('0x22')](respondWithResult(_0x1055fd,null))['catch'](handleError(_0x1055fd,null));};exports[_0xe0c6('0x3b')]=function(_0x279c4b,_0x4c7b25){return db[_0xe0c6('0x53')][_0xe0c6('0x57')]({'where':{'id':_0x279c4b[_0xe0c6('0x5a')]['id']}})[_0xe0c6('0x22')](handleEntityNotFound(_0x4c7b25,null))[_0xe0c6('0x22')](removeEntity(_0x4c7b25,null))[_0xe0c6('0x2c')](handleError(_0x4c7b25,null));};exports[_0xe0c6('0x5b')]=function(_0x3174b5,_0x41e5ea){return db[_0xe0c6('0x53')][_0xe0c6('0x5b')]()['then'](respondWithResult(_0x41e5ea,null))[_0xe0c6('0x2c')](handleError(_0x41e5ea,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xe0c6('0x5c')]=function(_0x3ec58b,_0x172c37,_0x5155c3){var _0x194893={'agent':{},'channel':_0xe0c6('0x5d')};if(_0x3ec58b['body']['id']){delete _0x3ec58b['body']['id'];}_0x3ec58b[_0xe0c6('0x59')][_0xe0c6('0x5e')]=!![];_0x3ec58b['body'][_0xe0c6('0x5f')]=moment()['format'](_0xe0c6('0x60'));_0x3ec58b[_0xe0c6('0x59')]['UserId']=_0x3ec58b['body'][_0xe0c6('0x61')]||_0x3ec58b[_0xe0c6('0x62')]['id'];_0x194893[_0xe0c6('0x63')]['id']=_0x3ec58b[_0xe0c6('0x59')][_0xe0c6('0x61')];return db[_0xe0c6('0x53')][_0xe0c6('0x57')]({'where':{'id':_0x3ec58b[_0xe0c6('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x172c37,null))[_0xe0c6('0x22')](saveUpdates(_0x3ec58b[_0xe0c6('0x59')],null))['then'](function(_0x144257){if(_0x144257){_0x194893[_0xe0c6('0x2a')]=_0x144257[_0xe0c6('0x64')]({'plain':!![]});return db[_0xe0c6('0x65')][_0xe0c6('0x57')]({'where':{'id':_0x144257[_0xe0c6('0x66')]}});}return null;})[_0xe0c6('0x22')](handleEntityNotFound(_0x172c37,null))['then'](function(_0x481d50){if(_0x481d50){return _0x481d50['update']({'UserId':_0x3ec58b['body']['UserId'],'read1stAt':_['isNil'](_0x481d50[_0xe0c6('0x67')])?moment()[_0xe0c6('0x68')](_0xe0c6('0x60')):undefined});}return null;})[_0xe0c6('0x22')](function(_0x12bbb8){if(_0x12bbb8){_0x194893[_0xe0c6('0x69')]=_0x12bbb8['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ec58b[_0xe0c6('0x62')]['id'],_0x3ec58b['user'][_0xe0c6('0x3d')],_0x3ec58b[_0xe0c6('0x62')][_0xe0c6('0x6a')],_0x194893[_0xe0c6('0x69')]['id'],_0x3ec58b[_0xe0c6('0x59')]?JSON[_0xe0c6('0x6b')](_0x3ec58b[_0xe0c6('0x59')]):_0xe0c6('0x6c'));return respondWithRpcPromise(_0xe0c6('0x6d'),_0xe0c6('0x6e'),_0x194893);}return null;})[_0xe0c6('0x22')](function(_0x479432){var _0x1a1d5e=_0xe0c6('0x6f')+_0x479432['message'][_0xe0c6('0x70')];return db['sequelize'][_0xe0c6('0x44')](_0x1a1d5e,{'type':db[_0xe0c6('0x71')][_0xe0c6('0x72')][_0xe0c6('0x73')],'raw':!![]})[_0xe0c6('0x22')](function(_0x13dd9a){return _0x13dd9a;});})[_0xe0c6('0x22')](function(_0x5a5d4c){if(_0x5a5d4c){_0x194893[_0xe0c6('0x2a')][_0xe0c6('0x74')]=_0x5a5d4c[0x0];if(!_0x3ec58b[_0xe0c6('0x59')][_0xe0c6('0x61')])return;return db[_0xe0c6('0x75')][_0xe0c6('0x57')]({'where':{'id':_0x3ec58b['body'][_0xe0c6('0x61')],'role':_0xe0c6('0x63')},'attributes':['id',_0xe0c6('0x3d'),_0xe0c6('0x76'),_0xe0c6('0x77'),_0xe0c6('0x78')],'raw':!![]});}return null;})['then'](function(_0xa26b9e){if(!_0xa26b9e)return null;_0x194893['message'][_0xe0c6('0x63')]=_0xa26b9e;return _0x194893;})['then'](function(_0x13c328){if(_0x13c328){if(_0x3ec58b[_0xe0c6('0x59')]['manual']){_0x194893['message'][_0xe0c6('0x79')]=util[_0xe0c6('0x68')](_0xe0c6('0x7a'),_0x3ec58b[_0xe0c6('0x62')][_0xe0c6('0x3d')]);_0x194893[_0xe0c6('0x2a')][_0xe0c6('0x7b')]=_0x194893[_0xe0c6('0x7b')];_0x194893[_0xe0c6('0x2a')][_0xe0c6('0x7c')]=_0x194893[_0xe0c6('0x7b')];_0x194893['message'][_0xe0c6('0x7d')]='accept';return respondWithRpcPromise(_0xe0c6('0x7e'),'EventManager',{'event':_0xe0c6('0x7f'),'message':_['merge'](_0x194893[_0xe0c6('0x2a')],JSON[_0xe0c6('0x80')](_0x194893[_0xe0c6('0x69')][_0xe0c6('0x81')]))},client9002)[_0xe0c6('0x22')](function(){return _0x194893;});}return _0x194893;}return null;})['then'](respondWithResult(_0x172c37,null))[_0xe0c6('0x2c')](handleError(_0x172c37,null));};var interaction_log=require(_0xe0c6('0x15'))(_0xe0c6('0x82'));exports[_0xe0c6('0x38')]=function(_0x5dbeaa,_0x47889f,_0x36b433){var _0x456c2f={'agent':{},'channel':'chat'};if(_0x5dbeaa['body']['id']){delete _0x5dbeaa['body']['id'];}_0x5dbeaa['body'][_0xe0c6('0x61')]=_0x5dbeaa[_0xe0c6('0x59')][_0xe0c6('0x61')]||_0x5dbeaa[_0xe0c6('0x62')]['id'];_0x456c2f[_0xe0c6('0x63')]['id']=_0x5dbeaa[_0xe0c6('0x59')][_0xe0c6('0x61')];return db[_0xe0c6('0x53')][_0xe0c6('0x57')]({'where':{'id':_0x5dbeaa[_0xe0c6('0x5a')]['id'],'UserId':null}})[_0xe0c6('0x22')](handleEntityNotFound(_0x47889f,null))[_0xe0c6('0x22')](function(_0x3dff5a){if(_0x3dff5a){_0x456c2f[_0xe0c6('0x2a')]=_0x3dff5a[_0xe0c6('0x64')]({'plain':!![]});return db[_0xe0c6('0x65')]['find']({'where':{'id':_0x3dff5a[_0xe0c6('0x66')]}});}return null;})[_0xe0c6('0x22')](handleEntityNotFound(_0x47889f,null))['then'](function(_0x241315){if(_0x241315){_0x456c2f[_0xe0c6('0x69')]=_0x241315[_0xe0c6('0x64')]({'plain':!![]});interaction_log[_0xe0c6('0x23')](_0xe0c6('0x83'),_0x5dbeaa[_0xe0c6('0x62')]['id'],_0x5dbeaa['user'][_0xe0c6('0x3d')],_0x5dbeaa[_0xe0c6('0x62')][_0xe0c6('0x6a')],_0x456c2f[_0xe0c6('0x69')]['id'],_0x5dbeaa[_0xe0c6('0x59')]?JSON[_0xe0c6('0x6b')](_0x5dbeaa[_0xe0c6('0x59')]):_0xe0c6('0x6c'));return respondWithRpcPromise(_0xe0c6('0x84'),_0xe0c6('0x85'),_0x456c2f);}return null;})[_0xe0c6('0x22')](function(_0x27078f){var _0x5e2452=_0xe0c6('0x6f')+_0x27078f[_0xe0c6('0x2a')][_0xe0c6('0x70')];return db[_0xe0c6('0x86')][_0xe0c6('0x44')](_0x5e2452,{'type':db[_0xe0c6('0x71')][_0xe0c6('0x72')][_0xe0c6('0x73')],'raw':!![]})[_0xe0c6('0x22')](function(_0xa9a61e){return _0xa9a61e;});})[_0xe0c6('0x22')](function(_0x1616f7){if(_0x1616f7){_0x456c2f[_0xe0c6('0x2a')][_0xe0c6('0x74')]=_0x1616f7[0x0];if(!_0x5dbeaa[_0xe0c6('0x59')]['UserId'])return;return db['User'][_0xe0c6('0x57')]({'where':{'id':_0x5dbeaa[_0xe0c6('0x59')][_0xe0c6('0x61')],'role':'agent'},'attributes':['id','name',_0xe0c6('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xe0c6('0x22')](function(_0x5dbeb7){if(!_0x5dbeb7)return null;_0x456c2f[_0xe0c6('0x2a')][_0xe0c6('0x63')]=_0x5dbeb7;return _0x456c2f;})[_0xe0c6('0x22')](function(_0x45621d){if(_0x45621d){_0x45621d['message']['interface']=util[_0xe0c6('0x68')](_0xe0c6('0x7a'),_0x5dbeaa[_0xe0c6('0x62')]['name']);_0x45621d['message'][_0xe0c6('0x7b')]=_0x456c2f[_0xe0c6('0x7b')];_0x45621d['message']['motionChannel']=_0x456c2f[_0xe0c6('0x7b')];_0x45621d['message']['event']=_0xe0c6('0x38');respondWithRpcPromise(_0xe0c6('0x7e'),_0xe0c6('0x7e'),{'event':_0xe0c6('0x87'),'message':_[_0xe0c6('0x51')](_0x456c2f[_0xe0c6('0x2a')],JSON['parse'](_0x456c2f[_0xe0c6('0x69')]['formData']))},client9002);return _0x456c2f;}return null;})[_0xe0c6('0x22')](respondWithResult(_0x47889f,null))['catch'](handleError(_0x47889f,null));}; \ No newline at end of file +var _0x0bbe=['key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','include','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','ChatInteractionId','isNil','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','agent','manual','interface','channel','motionChannel','EventManager','acceptmessage','parse','formData','../../config/logger','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','internal','SIP/%s','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0bbe,0x1f1));var _0xe0bb=function(_0x5ab6dc,_0xd27510){_0x5ab6dc=_0x5ab6dc-0x0;var _0x45a758=_0x0bbe[_0x5ab6dc];return _0x45a758;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0bb('0x0'));var zipdir=require(_0xe0bb('0x1'));var jsonpatch=require(_0xe0bb('0x2'));var rp=require(_0xe0bb('0x3'));var moment=require(_0xe0bb('0x4'));var BPromise=require(_0xe0bb('0x5'));var Mustache=require(_0xe0bb('0x6'));var util=require(_0xe0bb('0x7'));var path=require(_0xe0bb('0x8'));var sox=require(_0xe0bb('0x9'));var csv=require(_0xe0bb('0xa'));var ejs=require(_0xe0bb('0xb'));var fs=require('fs');var fs_extra=require(_0xe0bb('0xc'));var _=require('lodash');var squel=require(_0xe0bb('0xd'));var crypto=require(_0xe0bb('0xe'));var jsforce=require(_0xe0bb('0xf'));var deskjs=require(_0xe0bb('0x10'));var toCsv=require(_0xe0bb('0xa'));var querystring=require('querystring');var Papa=require(_0xe0bb('0x11'));var Redis=require(_0xe0bb('0x12'));var authService=require(_0xe0bb('0x13'));var qs=require(_0xe0bb('0x14'));var as=require(_0xe0bb('0x15'));var hardwareService=require(_0xe0bb('0x16'));var logger=require('../../config/logger')(_0xe0bb('0x17'));var utils=require(_0xe0bb('0x18'));var config=require(_0xe0bb('0x19'));var licenseUtil=require(_0xe0bb('0x1a'));var db=require(_0xe0bb('0x1b'))['db'];config[_0xe0bb('0x1c')]=_[_0xe0bb('0x1d')](config[_0xe0bb('0x1c')],{'host':_0xe0bb('0x1e'),'port':0x18eb});var socket=require(_0xe0bb('0x1f'))(new Redis(config['redis']));require(_0xe0bb('0x20'))[_0xe0bb('0x21')](socket);var jayson=require(_0xe0bb('0x22'));var client=jayson[_0xe0bb('0x23')][_0xe0bb('0x24')]({'port':0x232c});var client9002=jayson['client'][_0xe0bb('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x1f9bd0,_0x18d5bd,_0x1da17a,_0x101ec3){return new BPromise(function(_0xdc10ec,_0x397975){var _0x5f3f45=_0x101ec3||client;return _0x5f3f45['request'](_0x1f9bd0,_0x1da17a)['then'](function(_0x271846){logger[_0xe0bb('0x25')](_0xe0bb('0x26'),_0x18d5bd,_0xe0bb('0x27'));logger[_0xe0bb('0x28')](_0xe0bb('0x29'),_0x18d5bd,'request\x20sent',JSON[_0xe0bb('0x2a')](_0x271846));if(_0x271846['error']){if(_0x271846['error'][_0xe0bb('0x2b')]===0x1f4){logger[_0xe0bb('0x2c')]('ChatMessage,\x20%s,\x20%s',_0x18d5bd,_0x271846[_0xe0bb('0x2c')][_0xe0bb('0x2d')]);return _0x397975(_0x271846[_0xe0bb('0x2c')][_0xe0bb('0x2d')]);}logger[_0xe0bb('0x2c')](_0xe0bb('0x26'),_0x18d5bd,_0x271846[_0xe0bb('0x2c')][_0xe0bb('0x2d')]);return _0xdc10ec(_0x271846[_0xe0bb('0x2c')][_0xe0bb('0x2d')]);}else{logger[_0xe0bb('0x25')](_0xe0bb('0x26'),_0x18d5bd,'request\x20sent');_0xdc10ec(_0x271846[_0xe0bb('0x2e')]['message']);}})[_0xe0bb('0x2f')](function(_0x6168a1){logger[_0xe0bb('0x2c')](_0xe0bb('0x26'),_0x18d5bd,_0x6168a1);_0x397975(_0x6168a1);});});}function respondWithStatusCode(_0x513e6a,_0x45cbaa){_0x45cbaa=_0x45cbaa||0xcc;return function(_0xc0010c){if(_0xc0010c){return _0x513e6a[_0xe0bb('0x30')](_0x45cbaa);}return _0x513e6a[_0xe0bb('0x31')](_0x45cbaa)[_0xe0bb('0x32')]();};}function respondWithResult(_0x25d6c0,_0x5aa000){_0x5aa000=_0x5aa000||0xc8;return function(_0x49bca3){if(_0x49bca3){return _0x25d6c0[_0xe0bb('0x31')](_0x5aa000)['json'](_0x49bca3);}};}function respondWithFilteredResult(_0xa380a6,_0xeabb0){return function(_0x4eb179){if(_0x4eb179){var _0x4a45ba=typeof _0xeabb0[_0xe0bb('0x33')]===_0xe0bb('0x34')&&typeof _0xeabb0[_0xe0bb('0x35')]===_0xe0bb('0x34');var _0x36c160=_0x4eb179[_0xe0bb('0x36')];var _0x52c60c=_0x4a45ba?0x0:_0xeabb0[_0xe0bb('0x33')];var _0x3ba52e=_0x4a45ba?_0x4eb179[_0xe0bb('0x36')]:_0xeabb0[_0xe0bb('0x33')]+_0xeabb0[_0xe0bb('0x35')];var _0x715445;if(_0x3ba52e>=_0x36c160){_0x3ba52e=_0x36c160;_0x715445=0xc8;}else{_0x715445=0xce;}_0xa380a6[_0xe0bb('0x31')](_0x715445);return _0xa380a6['set'](_0xe0bb('0x37'),_0x52c60c+'-'+_0x3ba52e+'/'+_0x36c160)[_0xe0bb('0x38')](_0x4eb179);}return null;};}function patchUpdates(_0x514cd6){return function(_0x3adad5){try{jsonpatch[_0xe0bb('0x39')](_0x3adad5,_0x514cd6,!![]);}catch(_0x21c7a9){return BPromise[_0xe0bb('0x3a')](_0x21c7a9);}return _0x3adad5[_0xe0bb('0x3b')]();};}function saveUpdates(_0x172ebf,_0x53e614){return function(_0x271222){if(_0x271222){return _0x271222[_0xe0bb('0x3c')](_0x172ebf)[_0xe0bb('0x3d')](function(_0x4afb73){return _0x4afb73;});}return null;};}function removeEntity(_0x61da34,_0x364e34){return function(_0x3b7c6f){if(_0x3b7c6f){return _0x3b7c6f[_0xe0bb('0x3e')]()[_0xe0bb('0x3d')](function(){_0x61da34[_0xe0bb('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5717de,_0x536fc1){return function(_0x4f8f35){if(!_0x4f8f35){_0x5717de['sendStatus'](0x194);}return _0x4f8f35;};}function handleError(_0xf9e38,_0x1a7cd3){_0x1a7cd3=_0x1a7cd3||0x1f4;return function(_0x107ac0){logger[_0xe0bb('0x2c')](_0x107ac0[_0xe0bb('0x3f')]);if(_0x107ac0[_0xe0bb('0x40')]){delete _0x107ac0[_0xe0bb('0x40')];}_0xf9e38[_0xe0bb('0x31')](_0x1a7cd3)['send'](_0x107ac0);};}exports[_0xe0bb('0x41')]=function(_0x500256,_0xb72cc1){var _0x283652={},_0x22ced3={},_0x18f71d={'count':0x0,'rows':[]};var _0xe236d7=_[_0xe0bb('0x42')](db[_0xe0bb('0x43')][_0xe0bb('0x44')],function(_0x170a1a){return{'name':_0x170a1a[_0xe0bb('0x45')],'type':_0x170a1a[_0xe0bb('0x46')][_0xe0bb('0x47')]};});_0x22ced3['model']=_[_0xe0bb('0x42')](_0xe236d7,_0xe0bb('0x40'));_0x22ced3[_0xe0bb('0x48')]=_[_0xe0bb('0x49')](_0x500256[_0xe0bb('0x48')]);_0x22ced3[_0xe0bb('0x4a')]=_[_0xe0bb('0x4b')](_0x22ced3[_0xe0bb('0x4c')],_0x22ced3[_0xe0bb('0x48')]);_0x283652['attributes']=_['intersection'](_0x22ced3[_0xe0bb('0x4c')],qs[_0xe0bb('0x4d')](_0x500256[_0xe0bb('0x48')]['fields']));_0x283652[_0xe0bb('0x4e')]=_0x283652[_0xe0bb('0x4e')][_0xe0bb('0x4f')]?_0x283652['attributes']:_0x22ced3[_0xe0bb('0x4c')];if(!_0x500256[_0xe0bb('0x48')]['hasOwnProperty'](_0xe0bb('0x50'))){_0x283652['limit']=qs[_0xe0bb('0x35')](_0x500256[_0xe0bb('0x48')][_0xe0bb('0x35')]);_0x283652['offset']=qs[_0xe0bb('0x33')](_0x500256[_0xe0bb('0x48')][_0xe0bb('0x33')]);}_0x283652[_0xe0bb('0x51')]=qs[_0xe0bb('0x52')](_0x500256[_0xe0bb('0x48')][_0xe0bb('0x52')]);_0x283652['where']=qs[_0xe0bb('0x4a')](_[_0xe0bb('0x53')](_0x500256[_0xe0bb('0x48')],_0x22ced3['filters']),_0xe236d7);if(_0x500256[_0xe0bb('0x48')][_0xe0bb('0x54')]){_0x283652['where']=_[_0xe0bb('0x55')](_0x283652[_0xe0bb('0x56')],{'$or':_[_0xe0bb('0x42')](_0xe236d7,function(_0x1afb6f){if(_0x1afb6f[_0xe0bb('0x46')]!==_0xe0bb('0x57')){var _0x46f1ed={};_0x46f1ed[_0x1afb6f[_0xe0bb('0x40')]]={'$like':'%'+_0x500256[_0xe0bb('0x48')]['filter']+'%'};return _0x46f1ed;}})});}_0x283652=_[_0xe0bb('0x55')]({},_0x283652,_0x500256[_0xe0bb('0x58')]);var _0x5089e3={'where':_0x283652[_0xe0bb('0x56')]};return db[_0xe0bb('0x43')][_0xe0bb('0x36')](_0x5089e3)[_0xe0bb('0x3d')](function(_0x23f614){_0x18f71d[_0xe0bb('0x36')]=_0x23f614;if(_0x500256[_0xe0bb('0x48')][_0xe0bb('0x59')]){_0x283652['include']=[{'all':!![]}];}return db[_0xe0bb('0x43')][_0xe0bb('0x5a')](_0x283652);})[_0xe0bb('0x3d')](function(_0x2974a5){_0x18f71d['rows']=_0x2974a5;return _0x18f71d;})[_0xe0bb('0x3d')](respondWithFilteredResult(_0xb72cc1,_0x283652))[_0xe0bb('0x2f')](handleError(_0xb72cc1,null));};exports[_0xe0bb('0x5b')]=function(_0xcefd19,_0x58c1ec){var _0x15c6d2={'raw':!![],'where':{'id':_0xcefd19[_0xe0bb('0x5c')]['id']}},_0x554962={};_0x554962[_0xe0bb('0x4c')]=_[_0xe0bb('0x49')](db[_0xe0bb('0x43')][_0xe0bb('0x44')]);_0x554962[_0xe0bb('0x48')]=_[_0xe0bb('0x49')](_0xcefd19[_0xe0bb('0x48')]);_0x554962[_0xe0bb('0x4a')]=_[_0xe0bb('0x4b')](_0x554962[_0xe0bb('0x4c')],_0x554962[_0xe0bb('0x48')]);_0x15c6d2[_0xe0bb('0x4e')]=_['intersection'](_0x554962['model'],qs[_0xe0bb('0x4d')](_0xcefd19[_0xe0bb('0x48')][_0xe0bb('0x4d')]));_0x15c6d2[_0xe0bb('0x4e')]=_0x15c6d2['attributes'][_0xe0bb('0x4f')]?_0x15c6d2['attributes']:_0x554962['model'];if(_0xcefd19['query']['includeAll']){_0x15c6d2[_0xe0bb('0x5d')]=[{'all':!![]}];}_0x15c6d2=_[_0xe0bb('0x55')]({},_0x15c6d2,_0xcefd19[_0xe0bb('0x58')]);return db[_0xe0bb('0x43')]['find'](_0x15c6d2)['then'](handleEntityNotFound(_0x58c1ec,null))['then'](respondWithResult(_0x58c1ec,null))[_0xe0bb('0x2f')](handleError(_0x58c1ec,null));};exports[_0xe0bb('0x5e')]=function(_0x3a0eb4,_0x338e80){return db['ChatMessage'][_0xe0bb('0x5e')](_0x3a0eb4[_0xe0bb('0x5f')],{})[_0xe0bb('0x3d')](respondWithResult(_0x338e80,0xc9))[_0xe0bb('0x2f')](handleError(_0x338e80,null));};exports[_0xe0bb('0x3c')]=function(_0x4b6dbe,_0x22d4e){if(_0x4b6dbe[_0xe0bb('0x5f')]['id']){delete _0x4b6dbe['body']['id'];}return db[_0xe0bb('0x43')]['find']({'where':{'id':_0x4b6dbe[_0xe0bb('0x5c')]['id']}})[_0xe0bb('0x3d')](handleEntityNotFound(_0x22d4e,null))[_0xe0bb('0x3d')](saveUpdates(_0x4b6dbe['body'],null))['then'](respondWithResult(_0x22d4e,null))['catch'](handleError(_0x22d4e,null));};exports[_0xe0bb('0x3e')]=function(_0x5bead5,_0x429a14){return db[_0xe0bb('0x43')]['find']({'where':{'id':_0x5bead5[_0xe0bb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x429a14,null))[_0xe0bb('0x3d')](removeEntity(_0x429a14,null))[_0xe0bb('0x2f')](handleError(_0x429a14,null));};exports[_0xe0bb('0x60')]=function(_0x2c9930,_0x2aa4e3){return db[_0xe0bb('0x43')][_0xe0bb('0x60')]()[_0xe0bb('0x3d')](respondWithResult(_0x2aa4e3,null))['catch'](handleError(_0x2aa4e3,null));};var interaction_log=require('../../config/logger')(_0xe0bb('0x61'));exports[_0xe0bb('0x62')]=function(_0xf6c3fd,_0x3103ea,_0x10d3ef){var _0x751db5={'agent':{},'channel':_0xe0bb('0x63')};if(_0xf6c3fd['body']['id']){delete _0xf6c3fd[_0xe0bb('0x5f')]['id'];}_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x64')]=!![];_0xf6c3fd['body']['readAt']=moment()[_0xe0bb('0x65')](_0xe0bb('0x66'));_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x67')]=_0xf6c3fd[_0xe0bb('0x5f')]['UserId']||_0xf6c3fd[_0xe0bb('0x68')]['id'];_0x751db5['agent']['id']=_0xf6c3fd[_0xe0bb('0x5f')]['UserId'];return db[_0xe0bb('0x43')][_0xe0bb('0x69')]({'where':{'id':_0xf6c3fd['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3103ea,null))['then'](saveUpdates(_0xf6c3fd[_0xe0bb('0x5f')],null))['then'](function(_0x37566a){if(_0x37566a){_0x751db5[_0xe0bb('0x2d')]=_0x37566a[_0xe0bb('0x6a')]({'plain':!![]});return db['ChatInteraction'][_0xe0bb('0x69')]({'where':{'id':_0x37566a[_0xe0bb('0x6b')]}});}return null;})[_0xe0bb('0x3d')](handleEntityNotFound(_0x3103ea,null))[_0xe0bb('0x3d')](function(_0x3c904b){if(_0x3c904b){return _0x3c904b[_0xe0bb('0x3c')]({'UserId':_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x67')],'read1stAt':_[_0xe0bb('0x6c')](_0x3c904b['read1stAt'])?moment()['format'](_0xe0bb('0x66')):undefined});}return null;})[_0xe0bb('0x3d')](function(_0x4396d4){if(_0x4396d4){_0x751db5['interaction']=_0x4396d4[_0xe0bb('0x6a')]({'plain':!![]});interaction_log[_0xe0bb('0x25')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf6c3fd[_0xe0bb('0x68')]['id'],_0xf6c3fd[_0xe0bb('0x68')][_0xe0bb('0x40')],_0xf6c3fd['user'][_0xe0bb('0x6d')],_0x751db5[_0xe0bb('0x6e')]['id'],_0xf6c3fd[_0xe0bb('0x5f')]?JSON[_0xe0bb('0x2a')](_0xf6c3fd['body']):_0xe0bb('0x6f'));return respondWithRpcPromise(_0xe0bb('0x70'),_0xe0bb('0x71'),_0x751db5);}return null;})['then'](function(_0x486b22){var _0x5590c0=_0xe0bb('0x72')+_0x486b22[_0xe0bb('0x2d')]['ContactId'];return db[_0xe0bb('0x73')][_0xe0bb('0x48')](_0x5590c0,{'type':db[_0xe0bb('0x74')][_0xe0bb('0x75')]['SELECT'],'raw':!![]})[_0xe0bb('0x3d')](function(_0xcf44f1){return _0xcf44f1;});})['then'](function(_0x2c6b7b){if(_0x2c6b7b){_0x751db5['message'][_0xe0bb('0x76')]=_0x2c6b7b[0x0];if(!_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x67')])return;return db[_0xe0bb('0x77')][_0xe0bb('0x69')]({'where':{'id':_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x67')],'role':'agent'},'attributes':['id',_0xe0bb('0x40'),_0xe0bb('0x78'),_0xe0bb('0x79'),'internal'],'raw':!![]});}return null;})[_0xe0bb('0x3d')](function(_0x8dd77c){if(!_0x8dd77c)return null;_0x751db5[_0xe0bb('0x2d')][_0xe0bb('0x7a')]=_0x8dd77c;return _0x751db5;})['then'](function(_0x27fb97){if(_0x27fb97){if(_0xf6c3fd[_0xe0bb('0x5f')][_0xe0bb('0x7b')]){_0x751db5[_0xe0bb('0x2d')][_0xe0bb('0x7c')]=util[_0xe0bb('0x65')]('SIP/%s',_0xf6c3fd[_0xe0bb('0x68')][_0xe0bb('0x40')]);_0x751db5[_0xe0bb('0x2d')][_0xe0bb('0x7d')]=_0x751db5[_0xe0bb('0x7d')];_0x751db5[_0xe0bb('0x2d')][_0xe0bb('0x7e')]=_0x751db5['channel'];_0x751db5[_0xe0bb('0x2d')]['event']=_0xe0bb('0x62');return respondWithRpcPromise(_0xe0bb('0x7f'),'EventManager',{'event':_0xe0bb('0x80'),'message':_['merge'](_0x751db5[_0xe0bb('0x2d')],JSON[_0xe0bb('0x81')](_0x751db5[_0xe0bb('0x6e')][_0xe0bb('0x82')]))},client9002)[_0xe0bb('0x3d')](function(){return _0x751db5;});}return _0x751db5;}return null;})[_0xe0bb('0x3d')](respondWithResult(_0x3103ea,null))[_0xe0bb('0x2f')](handleError(_0x3103ea,null));};var interaction_log=require(_0xe0bb('0x83'))('chat-interactions');exports[_0xe0bb('0x3a')]=function(_0x591a64,_0x13d118,_0x4f0467){var _0x139488={'agent':{},'channel':'chat'};if(_0x591a64[_0xe0bb('0x5f')]['id']){delete _0x591a64[_0xe0bb('0x5f')]['id'];}_0x591a64[_0xe0bb('0x5f')][_0xe0bb('0x67')]=_0x591a64[_0xe0bb('0x5f')]['UserId']||_0x591a64[_0xe0bb('0x68')]['id'];_0x139488[_0xe0bb('0x7a')]['id']=_0x591a64['body'][_0xe0bb('0x67')];return db[_0xe0bb('0x43')][_0xe0bb('0x69')]({'where':{'id':_0x591a64[_0xe0bb('0x5c')]['id'],'UserId':null}})[_0xe0bb('0x3d')](handleEntityNotFound(_0x13d118,null))['then'](function(_0x103ef8){if(_0x103ef8){_0x139488['message']=_0x103ef8['get']({'plain':!![]});return db[_0xe0bb('0x84')][_0xe0bb('0x69')]({'where':{'id':_0x103ef8['ChatInteractionId']}});}return null;})[_0xe0bb('0x3d')](handleEntityNotFound(_0x13d118,null))['then'](function(_0x31ed31){if(_0x31ed31){_0x139488[_0xe0bb('0x6e')]=_0x31ed31[_0xe0bb('0x6a')]({'plain':!![]});interaction_log[_0xe0bb('0x25')](_0xe0bb('0x85'),_0x591a64[_0xe0bb('0x68')]['id'],_0x591a64[_0xe0bb('0x68')][_0xe0bb('0x40')],_0x591a64['user'][_0xe0bb('0x6d')],_0x139488[_0xe0bb('0x6e')]['id'],_0x591a64[_0xe0bb('0x5f')]?JSON[_0xe0bb('0x2a')](_0x591a64[_0xe0bb('0x5f')]):_0xe0bb('0x6f'));return respondWithRpcPromise(_0xe0bb('0x86'),_0xe0bb('0x87'),_0x139488);}return null;})[_0xe0bb('0x3d')](function(_0x2fff17){var _0x137100='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2fff17['message'][_0xe0bb('0x88')];return db['sequelize'][_0xe0bb('0x48')](_0x137100,{'type':db[_0xe0bb('0x74')][_0xe0bb('0x75')][_0xe0bb('0x89')],'raw':!![]})['then'](function(_0x6acf12){return _0x6acf12;});})[_0xe0bb('0x3d')](function(_0x48c607){if(_0x48c607){_0x139488['message']['contact']=_0x48c607[0x0];if(!_0x591a64[_0xe0bb('0x5f')][_0xe0bb('0x67')])return;return db[_0xe0bb('0x77')][_0xe0bb('0x69')]({'where':{'id':_0x591a64[_0xe0bb('0x5f')][_0xe0bb('0x67')],'role':'agent'},'attributes':['id',_0xe0bb('0x40'),_0xe0bb('0x78'),_0xe0bb('0x79'),_0xe0bb('0x8a')],'raw':!![]});}return null;})[_0xe0bb('0x3d')](function(_0x4b5bc6){if(!_0x4b5bc6)return null;_0x139488[_0xe0bb('0x2d')][_0xe0bb('0x7a')]=_0x4b5bc6;return _0x139488;})[_0xe0bb('0x3d')](function(_0x366591){if(_0x366591){_0x366591[_0xe0bb('0x2d')][_0xe0bb('0x7c')]=util[_0xe0bb('0x65')](_0xe0bb('0x8b'),_0x591a64[_0xe0bb('0x68')]['name']);_0x366591[_0xe0bb('0x2d')][_0xe0bb('0x7d')]=_0x139488['channel'];_0x366591[_0xe0bb('0x2d')][_0xe0bb('0x7e')]=_0x139488[_0xe0bb('0x7d')];_0x366591[_0xe0bb('0x2d')][_0xe0bb('0x8c')]='reject';respondWithRpcPromise(_0xe0bb('0x7f'),_0xe0bb('0x7f'),{'event':_0xe0bb('0x8d'),'message':_[_0xe0bb('0x55')](_0x139488['message'],JSON['parse'](_0x139488[_0xe0bb('0x6e')][_0xe0bb('0x82')]))},client9002);return _0x139488;}return null;})[_0xe0bb('0x3d')](respondWithResult(_0x13d118,null))[_0xe0bb('0x2f')](handleError(_0x13d118,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 489a807..38d8b39 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 _0xd9c0=['../../mysqldb','ChatMessage','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x3340f9,_0x865171){var _0x1e0f47=function(_0x29221a){while(--_0x29221a){_0x3340f9['push'](_0x3340f9['shift']());}};_0x1e0f47(++_0x865171);}(_0xd9c0,0xa1));var _0x0d9c=function(_0x3c8cb9,_0x250f2d){_0x3c8cb9=_0x3c8cb9-0x0;var _0x38ce3d=_0xd9c0[_0x3c8cb9];return _0x38ce3d;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0d9c('0x0'))['db'][_0x0d9c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0d9c('0x2')](0x0);var events={'afterCreate':_0x0d9c('0x3'),'afterUpdate':_0x0d9c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ca37f){return function(_0x524305,_0x2e7381,_0x2d465c){ChatMessageEvents['emit'](_0x4ca37f+':'+_0x524305['id'],_0x524305);ChatMessageEvents['emit'](_0x4ca37f,_0x524305);_0x2d465c(null);};}for(var e in events){if(events[_0x0d9c('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x0d9c('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x1bcc=['remove','emit','hook','exports','../../mysqldb','save'];(function(_0x4390b0,_0x163905){var _0x1160fa=function(_0x28a17a){while(--_0x28a17a){_0x4390b0['push'](_0x4390b0['shift']());}};_0x1160fa(++_0x163905);}(_0x1bcc,0xee));var _0xc1bc=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x1bcc[_0x5dfc2a];return _0x3f1a71;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc1bc('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc1bc('0x1'),'afterUpdate':'update','afterDestroy':_0xc1bc('0x2')};function emitEvent(_0x42c6b7){return function(_0xaabeba,_0x2e2bff,_0x40cbc9){ChatMessageEvents[_0xc1bc('0x3')](_0x42c6b7+':'+_0xaabeba['id'],_0xaabeba);ChatMessageEvents[_0xc1bc('0x3')](_0x42c6b7,_0xaabeba);_0x40cbc9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc1bc('0x4')](e,emitEvent(event));}}module[_0xc1bc('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 821208d..b6bffd8 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 _0xf963=['api','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x29442f,_0x40121f){var _0x32d130=function(_0x32bed6){while(--_0x32bed6){_0x29442f['push'](_0x29442f['shift']());}};_0x32d130(++_0x40121f);}(_0xf963,0x11f));var _0x3f96=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf963[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3f96('0x0'));var util=require(_0x3f96('0x1'));var logger=require(_0x3f96('0x2'))(_0x3f96('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f96('0x4'));var fs=require('fs');var path=require(_0x3f96('0x5'));var rimraf=require(_0x3f96('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f96('0x7'));module['exports']=function(_0x5dbaa0,_0x505ca5){return _0x5dbaa0[_0x3f96('0x8')](_0x3f96('0x9'),attributes,{'tableName':_0x3f96('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3f96('0xb')],'type':_0x3f96('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x78f002,_0x479674,_0x45648a){var _0x2bbbfb=_0x5dbaa0[_0x3f96('0xd')];var _0x1fceea=_0x78f002[_0x3f96('0xe')]({'plain':!![]});if(_0x1fceea[_0x3f96('0xf')][_0x3f96('0x10')]()==='in'||_0x1fceea[_0x3f96('0xf')]['toLowerCase']()===_0x3f96('0x11')&&!_0x1fceea[_0x3f96('0x12')]&&!_[_0x3f96('0x13')](_0x1fceea['UserId'])){_0x2bbbfb[_0x3f96('0x14')][_0x3f96('0x15')]({'where':{'id':_0x1fceea[_0x3f96('0x16')]}})['then'](function(_0x3b06af){if(_0x3b06af){_0x3b06af[_0x3f96('0x17')]({'lastMsgAt':_0x1fceea[_0x3f96('0x18')],'lastMsgDirection':_0x1fceea[_0x3f96('0xf')][_0x3f96('0x10')]()});}})[_0x3f96('0x19')](function(_0x5066c2){console[_0x3f96('0x1a')](_0x5066c2);});}_0x45648a();}},'charset':_0x3f96('0x1b'),'collate':_0x3f96('0x1c')});}; \ No newline at end of file +var _0xc5b5=['UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','models','direction','toLowerCase','isNil'];(function(_0x507a40,_0x1f53dd){var _0x4cd691=function(_0x249845){while(--_0x249845){_0x507a40['push'](_0x507a40['shift']());}};_0x4cd691(++_0x1f53dd);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x9fce47,_0x38c3e6){_0x9fce47=_0x9fce47-0x0;var _0x29e671=_0xc5b5[_0x9fce47];return _0x29e671;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c5b('0x0'))(_0x5c5b('0x1'));var moment=require('moment');var BPromise=require(_0x5c5b('0x2'));var rp=require(_0x5c5b('0x3'));var fs=require('fs');var path=require(_0x5c5b('0x4'));var rimraf=require(_0x5c5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c5b('0x6'));module[_0x5c5b('0x7')]=function(_0x27509d,_0x6cb181){return _0x27509d[_0x5c5b('0x8')](_0x5c5b('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x5c5b('0xa'),'fields':[_0x5c5b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d7fb9,_0x484709,_0x1821ac){var _0x1aef24=_0x27509d[_0x5c5b('0xc')];var _0x484f47=_0x2d7fb9['get']({'plain':!![]});if(_0x484f47[_0x5c5b('0xd')][_0x5c5b('0xe')]()==='in'||_0x484f47[_0x5c5b('0xd')]['toLowerCase']()==='out'&&!_0x484f47['secret']&&!_[_0x5c5b('0xf')](_0x484f47[_0x5c5b('0x10')])){_0x1aef24[_0x5c5b('0x11')][_0x5c5b('0x12')]({'where':{'id':_0x484f47[_0x5c5b('0x13')]}})['then'](function(_0x38f9a0){if(_0x38f9a0){_0x38f9a0[_0x5c5b('0x14')]({'lastMsgAt':_0x484f47[_0x5c5b('0x15')],'lastMsgDirection':_0x484f47[_0x5c5b('0xd')][_0x5c5b('0xe')]()});}})[_0x5c5b('0x16')](function(_0x3d15bd){console[_0x5c5b('0x17')](_0x3d15bd);});}_0x1821ac();}},'charset':_0x5c5b('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 44c5a68..cb80247 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 _0x1f7e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','raw','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f7e,0xc6));var _0xe1f7=function(_0x415031,_0x32f470){_0x415031=_0x415031-0x0;var _0x22ee53=_0x1f7e[_0x415031];return _0x22ee53;};'use strict';var _=require(_0xe1f7('0x0'));var util=require(_0xe1f7('0x1'));var moment=require(_0xe1f7('0x2'));var BPromise=require(_0xe1f7('0x3'));var rs=require(_0xe1f7('0x4'));var fs=require('fs');var Redis=require(_0xe1f7('0x5'));var db=require(_0xe1f7('0x6'))['db'];var utils=require(_0xe1f7('0x7'));var logger=require(_0xe1f7('0x8'))(_0xe1f7('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe1f7('0xa')][_0xe1f7('0xb')]({'port':0x232a});config[_0xe1f7('0xc')]=_['defaults'](config[_0xe1f7('0xc')],{'host':_0xe1f7('0xd'),'port':0x18eb});var socket=require(_0xe1f7('0xe'))(new Redis(config[_0xe1f7('0xc')]));require(_0xe1f7('0xf'))[_0xe1f7('0x10')](socket);function respondWithRpcPromise(_0x2a425c,_0x5b09a0,_0x367826){return new BPromise(function(_0xac9c2b,_0x178abe){return client['request'](_0x2a425c,_0x367826)[_0xe1f7('0x11')](function(_0x208488){logger[_0xe1f7('0x12')]('ChatMessage,\x20%s,\x20%s',_0x5b09a0,_0xe1f7('0x13'));logger['debug'](_0xe1f7('0x14'),_0x5b09a0,'request\x20sent',JSON['stringify'](_0x208488));if(_0x208488[_0xe1f7('0x15')]){if(_0x208488[_0xe1f7('0x15')][_0xe1f7('0x16')]===0x1f4){logger[_0xe1f7('0x15')](_0xe1f7('0x17'),_0x5b09a0,_0x208488[_0xe1f7('0x15')]['message']);return _0x178abe(_0x208488[_0xe1f7('0x15')][_0xe1f7('0x18')]);}logger[_0xe1f7('0x15')](_0xe1f7('0x17'),_0x5b09a0,_0x208488['error'][_0xe1f7('0x18')]);return _0xac9c2b(_0x208488[_0xe1f7('0x15')][_0xe1f7('0x18')]);}else{logger['info'](_0xe1f7('0x17'),_0x5b09a0,_0xe1f7('0x13'));_0xac9c2b(_0x208488[_0xe1f7('0x19')][_0xe1f7('0x18')]);}})[_0xe1f7('0x1a')](function(_0x1ff8c0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5b09a0,_0x1ff8c0);_0x178abe(_0x1ff8c0);});});}exports[_0xe1f7('0x1b')]=function(_0x53557f){var _0x662464=this;return new Promise(function(_0x6e7d97,_0x154008){return db['ChatMessage'][_0xe1f7('0x1c')](_0x53557f[_0xe1f7('0x1d')],{'raw':_0x53557f['options']?_0x53557f[_0xe1f7('0x1e')][_0xe1f7('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xc2f8b5){logger['info'](_0xe1f7('0x1b'),_0x53557f);logger[_0xe1f7('0x20')]('CreateChatMessage',_0x53557f,JSON['stringify'](_0xc2f8b5));_0x6e7d97(_0xc2f8b5);})['catch'](function(_0x601a45){logger[_0xe1f7('0x15')](_0xe1f7('0x1b'),_0x601a45[_0xe1f7('0x18')],_0x53557f);_0x154008(_0x662464[_0xe1f7('0x15')](0x1f4,_0x601a45[_0xe1f7('0x18')]));});});}; \ No newline at end of file +var _0x9555=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x9555,0x149));var _0x5955=function(_0x24aa51,_0x3c7484){_0x24aa51=_0x24aa51-0x0;var _0x1e386a=_0x9555[_0x24aa51];return _0x1e386a;};'use strict';var _=require(_0x5955('0x0'));var util=require(_0x5955('0x1'));var moment=require(_0x5955('0x2'));var BPromise=require('bluebird');var rs=require(_0x5955('0x3'));var fs=require('fs');var Redis=require(_0x5955('0x4'));var db=require(_0x5955('0x5'))['db'];var utils=require(_0x5955('0x6'));var logger=require('../../config/logger')(_0x5955('0x7'));var config=require(_0x5955('0x8'));var jayson=require(_0x5955('0x9'));var client=jayson[_0x5955('0xa')][_0x5955('0xb')]({'port':0x232a});config['redis']=_[_0x5955('0xc')](config['redis'],{'host':_0x5955('0xd'),'port':0x18eb});var socket=require(_0x5955('0xe'))(new Redis(config[_0x5955('0xf')]));require(_0x5955('0x10'))['register'](socket);function respondWithRpcPromise(_0x14d29f,_0x3e0790,_0x37c0d5){return new BPromise(function(_0x3b206a,_0x355414){return client[_0x5955('0x11')](_0x14d29f,_0x37c0d5)[_0x5955('0x12')](function(_0x5d1549){logger[_0x5955('0x13')](_0x5955('0x14'),_0x3e0790,'request\x20sent');logger[_0x5955('0x15')](_0x5955('0x16'),_0x3e0790,_0x5955('0x17'),JSON['stringify'](_0x5d1549));if(_0x5d1549[_0x5955('0x18')]){if(_0x5d1549[_0x5955('0x18')][_0x5955('0x19')]===0x1f4){logger[_0x5955('0x18')](_0x5955('0x14'),_0x3e0790,_0x5d1549['error'][_0x5955('0x1a')]);return _0x355414(_0x5d1549[_0x5955('0x18')][_0x5955('0x1a')]);}logger[_0x5955('0x18')](_0x5955('0x14'),_0x3e0790,_0x5d1549[_0x5955('0x18')][_0x5955('0x1a')]);return _0x3b206a(_0x5d1549[_0x5955('0x18')][_0x5955('0x1a')]);}else{logger[_0x5955('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3e0790,'request\x20sent');_0x3b206a(_0x5d1549['result']['message']);}})[_0x5955('0x1b')](function(_0x1d5b6f){logger[_0x5955('0x18')](_0x5955('0x14'),_0x3e0790,_0x1d5b6f);_0x355414(_0x1d5b6f);});});}exports[_0x5955('0x1c')]=function(_0x17940b){var _0x3c74ca=this;return new Promise(function(_0x398e8f,_0x170309){return db[_0x5955('0x1d')][_0x5955('0x1e')](_0x17940b['body'],{'raw':_0x17940b[_0x5955('0x1f')]?_0x17940b[_0x5955('0x1f')][_0x5955('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x54ad28){logger[_0x5955('0x13')](_0x5955('0x1c'),_0x17940b);logger['debug']('CreateChatMessage',_0x17940b,JSON['stringify'](_0x54ad28));_0x398e8f(_0x54ad28);})[_0x5955('0x1b')](function(_0x39db7b){logger[_0x5955('0x18')]('CreateChatMessage',_0x39db7b[_0x5955('0x1a')],_0x17940b);_0x170309(_0x3c74ca[_0x5955('0x18')](0x1f4,_0x39db7b[_0x5955('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d320a6f..dcbf9e2 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 _0x2eb2=['chatMessage:','save','remove','update','register','length'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2eb2[_0x4e9628];return _0x27bc8c;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2')];function createListener(_0x1a002b,_0x1dd079){return function(_0xaf32cf){_0x1dd079['emit'](_0x1a002b,_0xaf32cf);};}function removeListener(_0x27732f,_0x4efe67){return function(){ChatMessageEvents['removeListener'](_0x27732f,_0x4efe67);};}exports[_0x22eb('0x3')]=function(_0x10e116){for(var _0x35dd5b=0x0,_0x2a9850=events[_0x22eb('0x4')];_0x35dd5b<_0x2a9850;_0x35dd5b++){var _0x396806=events[_0x35dd5b];var _0x33ddef=createListener(_0x22eb('0x5')+_0x396806,_0x10e116);ChatMessageEvents['on'](_0x396806,_0x33ddef);}}; \ No newline at end of file +var _0x078c=['register','length','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x078c,0x19f));var _0xc078=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x078c[_0x53e3de];return _0x7b905b;};'use strict';var ChatMessageEvents=require(_0xc078('0x0'));var events=['save',_0xc078('0x1'),_0xc078('0x2')];function createListener(_0x503bd4,_0x82572){return function(_0x107624){_0x82572[_0xc078('0x3')](_0x503bd4,_0x107624);};}function removeListener(_0x217004,_0x56bf2e){return function(){ChatMessageEvents[_0xc078('0x4')](_0x217004,_0x56bf2e);};}exports[_0xc078('0x5')]=function(_0x394068){for(var _0x24b241=0x0,_0x40e428=events[_0xc078('0x6')];_0x24b241<_0x40e428;_0x24b241++){var _0x22661e=events[_0x24b241];var _0x4030b1=createListener('chatMessage:'+_0x22661e,_0x394068);ChatMessageEvents['on'](_0x22661e,_0x4030b1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 216da51..34b7364 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 _0xf8cc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','multer','util','connect-timeout','Router','fs-extra'];(function(_0x7cb97a,_0x363af9){var _0x1bb58e=function(_0x699dea){while(--_0x699dea){_0x7cb97a['push'](_0x7cb97a['shift']());}};_0x1bb58e(++_0x363af9);}(_0xf8cc,0x1ef));var _0xcf8c=function(_0x20c64e,_0xc3e08e){_0x20c64e=_0x20c64e-0x0;var _0x1fc06e=_0xf8cc[_0x20c64e];return _0x1fc06e;};'use strict';var multer=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var path=require('path');var timeout=require(_0xcf8c('0x2'));var express=require('express');var router=express[_0xcf8c('0x3')]();var fs_extra=require(_0xcf8c('0x4'));var auth=require(_0xcf8c('0x5'));var interaction=require(_0xcf8c('0x6'));var config=require(_0xcf8c('0x7'));var controller=require(_0xcf8c('0x8'));router['get']('/',auth[_0xcf8c('0x9')](),controller['index']);router['get'](_0xcf8c('0xa'),auth[_0xcf8c('0x9')](),controller[_0xcf8c('0xb')]);router[_0xcf8c('0xc')](_0xcf8c('0xd'),auth['isAuthenticated'](),controller[_0xcf8c('0xe')]);router[_0xcf8c('0xf')]('/',auth[_0xcf8c('0x9')](),interaction[_0xcf8c('0x10')]('chat',_0xcf8c('0x11')),controller[_0xcf8c('0x12')]);router[_0xcf8c('0x13')](_0xcf8c('0xd'),controller[_0xcf8c('0x14')]);router[_0xcf8c('0x13')](_0xcf8c('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xcf8c('0x13')]('/:id/reject',auth[_0xcf8c('0x9')](),controller[_0xcf8c('0x16')]);router[_0xcf8c('0x17')](_0xcf8c('0xd'),auth[_0xcf8c('0x9')](),controller[_0xcf8c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x93c6=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','chat','chatmessage:create','create','put','/:id','accept'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x93c6,0x11c));var _0x693c=function(_0x7a7289,_0x573b84){_0x7a7289=_0x7a7289-0x0;var _0x4c8376=_0x93c6[_0x7a7289];return _0x4c8376;};'use strict';var multer=require(_0x693c('0x0'));var util=require(_0x693c('0x1'));var path=require(_0x693c('0x2'));var timeout=require(_0x693c('0x3'));var express=require(_0x693c('0x4'));var router=express[_0x693c('0x5')]();var fs_extra=require(_0x693c('0x6'));var auth=require(_0x693c('0x7'));var interaction=require(_0x693c('0x8'));var config=require(_0x693c('0x9'));var controller=require(_0x693c('0xa'));router[_0x693c('0xb')]('/',auth[_0x693c('0xc')](),controller[_0x693c('0xd')]);router['get'](_0x693c('0xe'),auth[_0x693c('0xc')](),controller[_0x693c('0xf')]);router[_0x693c('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x693c('0x10')]('/',auth[_0x693c('0xc')](),interaction[_0x693c('0x11')](_0x693c('0x12'),_0x693c('0x13')),controller[_0x693c('0x14')]);router[_0x693c('0x15')](_0x693c('0x16'),controller['update']);router[_0x693c('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x693c('0x17')]);router[_0x693c('0x15')](_0x693c('0x18'),auth[_0x693c('0xc')](),controller['reject']);router[_0x693c('0x19')](_0x693c('0x16'),auth['isAuthenticated'](),controller[_0x693c('0x1a')]);module[_0x693c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1f44914..0438049 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x0b0e[_0x46111d];return _0xe82586;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x2ea52e,_0x5ae95a){var _0x1e8fca=function(_0x38da07){while(--_0x38da07){_0x2ea52e['push'](_0x2ea52e['shift']());}};_0x1e8fca(++_0x5ae95a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46c532,_0x5367d3){_0x46c532=_0x46c532-0x0;var _0x41bde0=_0x5f2f[_0x46c532];return _0x41bde0;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('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 261f7ff..10bca63 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x7a54,0x106));var _0x47a5=function(_0x6c36f6,_0x5b76b2){_0x6c36f6=_0x6c36f6-0x0;var _0x2d41b2=_0x7a54[_0x6c36f6];return _0x2d41b2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x7a54,0x106));var _0x47a5=function(_0x4b399f,_0xc577b4){_0x4b399f=_0x4b399f-0x0;var _0xbfed8c=_0x7a54[_0x4b399f];return _0xbfed8c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 8008d5c..dc2296e 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 _0x0a08=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage'];(function(_0x2703cf,_0x526b31){var _0x28f18a=function(_0x10e33b){while(--_0x10e33b){_0x2703cf['push'](_0x2703cf['shift']());}};_0x28f18a(++_0x526b31);}(_0x0a08,0x153));var _0x80a0=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x0a08[_0x37c22c];return _0x119d79;};'use strict';var EventEmitter=require(_0x80a0('0x0'));var ChatOfflineMessage=require(_0x80a0('0x1'))['db'][_0x80a0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x80a0('0x3')](0x0);var events={'afterCreate':_0x80a0('0x4'),'afterUpdate':_0x80a0('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd5656d){return function(_0x5b7b12,_0x439409,_0x176232){ChatOfflineMessageEvents[_0x80a0('0x6')](_0xd5656d+':'+_0x5b7b12['id'],_0x5b7b12);ChatOfflineMessageEvents[_0x80a0('0x6')](_0xd5656d,_0x5b7b12);_0x176232(null);};}for(var e in events){if(events[_0x80a0('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x80a0('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc331=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xc331,0x18b));var _0x1c33=function(_0x1922b1,_0x17ee71){_0x1922b1=_0x1922b1-0x0;var _0x52205d=_0xc331[_0x1922b1];return _0x52205d;};'use strict';var EventEmitter=require(_0x1c33('0x0'));var ChatOfflineMessage=require(_0x1c33('0x1'))['db'][_0x1c33('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1c33('0x3')](0x0);var events={'afterCreate':_0x1c33('0x4'),'afterUpdate':_0x1c33('0x5'),'afterDestroy':_0x1c33('0x6')};function emitEvent(_0x2862f3){return function(_0xd1b000,_0x1acca1,_0x21fe88){ChatOfflineMessageEvents[_0x1c33('0x7')](_0x2862f3+':'+_0xd1b000['id'],_0xd1b000);ChatOfflineMessageEvents[_0x1c33('0x7')](_0x2862f3,_0xd1b000);_0x21fe88(null);};}for(var e in events){if(events[_0x1c33('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x1c33('0x9')](e,emitEvent(event));}}module[_0x1c33('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 15a8dea..db2d419 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 _0x7082=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3f7101,_0x536e58){var _0x7be955=function(_0x5f07c2){while(--_0x5f07c2){_0x3f7101['push'](_0x3f7101['shift']());}};_0x7be955(++_0x536e58);}(_0x7082,0xf5));var _0x2708=function(_0x4e47f7,_0x205e52){_0x4e47f7=_0x4e47f7-0x0;var _0x24b111=_0x7082[_0x4e47f7];return _0x24b111;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x1bfd72){return _0x1bfd72[_0x2708('0x0')](_0x2708('0x1'),attributes,{'tableName':_0x2708('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2708('0x3'),'collate':_0x2708('0x4')});}; \ No newline at end of file +var _0xefbf=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x5103fc,_0x39394d){var _0x5146ab=function(_0xe42041){while(--_0xe42041){_0x5103fc['push'](_0x5103fc['shift']());}};_0x5146ab(++_0x39394d);}(_0xefbf,0x1b7));var _0xfefb=function(_0x5da20a,_0x3b8cd1){_0x5da20a=_0x5da20a-0x0;var _0x20522f=_0xefbf[_0x5da20a];return _0x20522f;};'use strict';var attributes=require(_0xfefb('0x0'));module[_0xfefb('0x1')]=function(_0x5737e8){return _0x5737e8[_0xfefb('0x2')](_0xfefb('0x3'),attributes,{'tableName':_0xfefb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfefb('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2055c45..daa153a 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 _0x7513=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7513,0x101));var _0x3751=function(_0x44af93,_0x45fa15){_0x44af93=_0x44af93-0x0;var _0x22eef3=_0x7513[_0x44af93];return _0x22eef3;};'use strict';var _=require(_0x3751('0x0'));var util=require(_0x3751('0x1'));var moment=require(_0x3751('0x2'));var BPromise=require(_0x3751('0x3'));var rs=require(_0x3751('0x4'));var fs=require('fs');var Redis=require(_0x3751('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3751('0x6'));var logger=require('../../config/logger')(_0x3751('0x7'));var config=require('../../config/environment');var jayson=require(_0x3751('0x8'));var client=jayson[_0x3751('0x9')][_0x3751('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52b3fe,_0x584340,_0x13073a){return new BPromise(function(_0x58795d,_0x2ae940){return client[_0x3751('0xb')](_0x52b3fe,_0x13073a)['then'](function(_0x2dc662){logger['info'](_0x3751('0xc'),_0x584340,_0x3751('0xd'));logger[_0x3751('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x584340,_0x3751('0xd'),JSON['stringify'](_0x2dc662));if(_0x2dc662[_0x3751('0xf')]){if(_0x2dc662[_0x3751('0xf')]['code']===0x1f4){logger[_0x3751('0xf')](_0x3751('0xc'),_0x584340,_0x2dc662[_0x3751('0xf')][_0x3751('0x10')]);return _0x2ae940(_0x2dc662[_0x3751('0xf')]['message']);}logger[_0x3751('0xf')](_0x3751('0xc'),_0x584340,_0x2dc662[_0x3751('0xf')][_0x3751('0x10')]);return _0x58795d(_0x2dc662[_0x3751('0xf')][_0x3751('0x10')]);}else{logger[_0x3751('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x584340,_0x3751('0xd'));_0x58795d(_0x2dc662[_0x3751('0x12')][_0x3751('0x10')]);}})[_0x3751('0x13')](function(_0xe36b89){logger['error'](_0x3751('0xc'),_0x584340,_0xe36b89);_0x2ae940(_0xe36b89);});});} \ No newline at end of file +var _0xcc39=['bluebird','randomstring','../../config/utils','../../config/logger','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc39,0x141));var _0x9cc3=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xcc39[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0x9cc3('0x0'));var util=require(_0x9cc3('0x1'));var moment=require('moment');var BPromise=require(_0x9cc3('0x2'));var rs=require(_0x9cc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9cc3('0x4'));var logger=require(_0x9cc3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9cc3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xea3593,_0x4ee015,_0x6a4b0d){return new BPromise(function(_0x1f41ad,_0x4fa3b5){return client[_0x9cc3('0x7')](_0xea3593,_0x6a4b0d)[_0x9cc3('0x8')](function(_0xf2eea2){logger[_0x9cc3('0x9')](_0x9cc3('0xa'),_0x4ee015,_0x9cc3('0xb'));logger[_0x9cc3('0xc')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4ee015,_0x9cc3('0xb'),JSON[_0x9cc3('0xd')](_0xf2eea2));if(_0xf2eea2[_0x9cc3('0xe')]){if(_0xf2eea2[_0x9cc3('0xe')][_0x9cc3('0xf')]===0x1f4){logger[_0x9cc3('0xe')](_0x9cc3('0xa'),_0x4ee015,_0xf2eea2[_0x9cc3('0xe')]['message']);return _0x4fa3b5(_0xf2eea2[_0x9cc3('0xe')][_0x9cc3('0x10')]);}logger[_0x9cc3('0xe')](_0x9cc3('0xa'),_0x4ee015,_0xf2eea2['error'][_0x9cc3('0x10')]);return _0x1f41ad(_0xf2eea2[_0x9cc3('0xe')][_0x9cc3('0x10')]);}else{logger[_0x9cc3('0x9')](_0x9cc3('0xa'),_0x4ee015,_0x9cc3('0xb'));_0x1f41ad(_0xf2eea2[_0x9cc3('0x11')]['message']);}})[_0x9cc3('0x12')](function(_0x1db9d0){logger[_0x9cc3('0xe')](_0x9cc3('0xa'),_0x4ee015,_0x1db9d0);_0x4fa3b5(_0x1db9d0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bfe456f..2dbfbbb 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 _0x2525=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x1302e6,_0x41dcb9){var _0x17a8b9=function(_0x283ecf){while(--_0x283ecf){_0x1302e6['push'](_0x1302e6['shift']());}};_0x17a8b9(++_0x41dcb9);}(_0x2525,0x162));var _0x5252=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x2525[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0x5252('0x0'));var util=require('util');var path=require(_0x5252('0x1'));var timeout=require('connect-timeout');var express=require(_0x5252('0x2'));var router=express[_0x5252('0x3')]();var fs_extra=require(_0x5252('0x4'));var auth=require(_0x5252('0x5'));var interaction=require(_0x5252('0x6'));var config=require(_0x5252('0x7'));var controller=require(_0x5252('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5252('0x9')]);router[_0x5252('0xa')](_0x5252('0xb'),auth[_0x5252('0xc')](),controller[_0x5252('0xd')]);router['get'](_0x5252('0xe'),auth['isAuthenticated'](),controller[_0x5252('0xf')]);router[_0x5252('0x10')]('/',auth[_0x5252('0xc')](),controller[_0x5252('0x11')]);router[_0x5252('0x12')]('/:id',auth[_0x5252('0xc')](),controller[_0x5252('0x13')]);router[_0x5252('0x14')](_0x5252('0xe'),auth[_0x5252('0xc')](),controller[_0x5252('0x15')]);module[_0x5252('0x16')]=router; \ No newline at end of file +var _0xc0d9=['create','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xc0d9,0x144));var _0x9c0d=function(_0x29f70c,_0x182b9e){_0x29f70c=_0x29f70c-0x0;var _0x2d59fe=_0xc0d9[_0x29f70c];return _0x2d59fe;};'use strict';var multer=require('multer');var util=require(_0x9c0d('0x0'));var path=require(_0x9c0d('0x1'));var timeout=require(_0x9c0d('0x2'));var express=require('express');var router=express[_0x9c0d('0x3')]();var fs_extra=require(_0x9c0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9c0d('0x5'));var config=require(_0x9c0d('0x6'));var controller=require(_0x9c0d('0x7'));router[_0x9c0d('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c0d('0x9')]);router['get'](_0x9c0d('0xa'),auth[_0x9c0d('0xb')](),controller[_0x9c0d('0xc')]);router['get'](_0x9c0d('0xd'),auth[_0x9c0d('0xb')](),controller[_0x9c0d('0xe')]);router[_0x9c0d('0xf')]('/',auth[_0x9c0d('0xb')](),controller[_0x9c0d('0x10')]);router[_0x9c0d('0x11')](_0x9c0d('0xd'),auth[_0x9c0d('0xb')](),controller[_0x9c0d('0x12')]);router[_0x9c0d('0x13')](_0x9c0d('0xd'),auth[_0x9c0d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 398c3a1..84eb327 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 _0xaaff=['INTEGER','exports','STRING','mouseOver','timeout'];(function(_0x382642,_0x2a2aea){var _0x5f33ed=function(_0x36d4e4){while(--_0x36d4e4){_0x382642['push'](_0x382642['shift']());}};_0x5f33ed(++_0x2a2aea);}(_0xaaff,0x100));var _0xfaaf=function(_0x405022,_0x2377a8){_0x405022=_0x405022-0x0;var _0x3b29e7=_0xaaff[_0x405022];return _0x3b29e7;};'use strict';var Sequelize=require('sequelize');module[_0xfaaf('0x0')]={'name':{'type':Sequelize[_0xfaaf('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfaaf('0x2'),_0xfaaf('0x3')),'defaultValue':_0xfaaf('0x2')},'selector':{'type':Sequelize[_0xfaaf('0x1')]},'timeout':{'type':Sequelize[_0xfaaf('0x4')]}}; \ No newline at end of file +var _0x9507=['INTEGER','STRING','ENUM','mouseOver','timeout'];(function(_0x52e8a1,_0x48142a){var _0x5ad197=function(_0x2cc205){while(--_0x2cc205){_0x52e8a1['push'](_0x52e8a1['shift']());}};_0x5ad197(++_0x48142a);}(_0x9507,0x164));var _0x7950=function(_0x36081a,_0x4ced2e){_0x36081a=_0x36081a-0x0;var _0x5c4be4=_0x9507[_0x36081a];return _0x5c4be4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7950('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x7950('0x1')](_0x7950('0x2'),_0x7950('0x3')),'defaultValue':_0x7950('0x2')},'selector':{'type':Sequelize[_0x7950('0x0')]},'timeout':{'type':Sequelize[_0x7950('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index df55f0f..dcc0628 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 _0xdd0c=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','include','merge','find','then','create','body','catch','rimraf','zip-dir','fast-json-patch'];(function(_0x2bb882,_0x1db026){var _0x3b190a=function(_0x390bd3){while(--_0x390bd3){_0x2bb882['push'](_0x2bb882['shift']());}};_0x3b190a(++_0x1db026);}(_0xdd0c,0x165));var _0xcdd0=function(_0x5b16ea,_0x1dc0d6){_0x5b16ea=_0x5b16ea-0x0;var _0x13b4f0=_0xdd0c[_0x5b16ea];return _0x13b4f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={'raw':!![],'where':{'id':_0x4074e0[_0xcdd0('0x2a')]['id']}},_0xd6d64f={};_0xd6d64f['model']=_[_0xcdd0('0x2b')](db[_0xcdd0('0x2c')][_0xcdd0('0x2d')]);_0xd6d64f[_0xcdd0('0x2e')]=_[_0xcdd0('0x2b')](_0x4074e0['query']);_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],_0xd6d64f['query']);_0x28084c['attributes']=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],qs[_0xcdd0('0x32')](_0x4074e0['query'][_0xcdd0('0x32')]));_0x28084c[_0xcdd0('0x33')]=_0x28084c['attributes'][_0xcdd0('0x34')]?_0x28084c[_0xcdd0('0x33')]:_0xd6d64f[_0xcdd0('0x31')];if(_0x4074e0[_0xcdd0('0x2e')]['includeAll']){_0x28084c[_0xcdd0('0x35')]=[{'all':!![]}];}_0x28084c=_[_0xcdd0('0x36')]({},_0x28084c,_0x4074e0['options']);return db[_0xcdd0('0x2c')][_0xcdd0('0x37')](_0x28084c)[_0xcdd0('0x38')](handleEntityNotFound(_0x49cfe0,null))[_0xcdd0('0x38')](respondWithResult(_0x49cfe0,null))['catch'](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x39')]=function(_0x358139,_0x95d87f){return db[_0xcdd0('0x2c')][_0xcdd0('0x39')](_0x358139['body'],{})[_0xcdd0('0x38')](respondWithResult(_0x95d87f,0xc9))['catch'](handleError(_0x95d87f,null));};exports['update']=function(_0x4fd705,_0x407725){if(_0x4fd705[_0xcdd0('0x3a')]['id']){delete _0x4fd705[_0xcdd0('0x3a')]['id'];}return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4fd705[_0xcdd0('0x2a')]['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x407725,null))['then'](saveUpdates(_0x4fd705[_0xcdd0('0x3a')],null))[_0xcdd0('0x38')](respondWithResult(_0x407725,null))[_0xcdd0('0x3b')](handleError(_0x407725,null));};exports[_0xcdd0('0x24')]=function(_0x4e6d31,_0x4934a5){return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4e6d31['params']['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x4934a5,null))[_0xcdd0('0x38')](removeEntity(_0x4934a5,null))['catch'](handleError(_0x4934a5,null));}; \ No newline at end of file +var _0x4ab0=['undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','catch','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','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','status','end','offset'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4ab0,0xd5));var _0x04ab=function(_0x25b8bd,_0x131a76){_0x25b8bd=_0x25b8bd-0x0;var _0xbcb5ec=_0x4ab0[_0x25b8bd];return _0xbcb5ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['show']=function(_0x404eae,_0x30db64){var _0x2e069d={'raw':!![],'where':{'id':_0x404eae[_0x04ab('0x29')]['id']}},_0x3c25fb={};_0x3c25fb['model']=_['keys'](db[_0x04ab('0x2a')][_0x04ab('0x2b')]);_0x3c25fb[_0x04ab('0x2c')]=_[_0x04ab('0x2d')](_0x404eae[_0x04ab('0x2c')]);_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x2c')]);_0x2e069d[_0x04ab('0x31')]=_[_0x04ab('0x2f')](_0x3c25fb[_0x04ab('0x30')],qs[_0x04ab('0x32')](_0x404eae['query'][_0x04ab('0x32')]));_0x2e069d[_0x04ab('0x31')]=_0x2e069d['attributes'][_0x04ab('0x33')]?_0x2e069d[_0x04ab('0x31')]:_0x3c25fb['model'];if(_0x404eae[_0x04ab('0x2c')][_0x04ab('0x34')]){_0x2e069d['include']=[{'all':!![]}];}_0x2e069d=_[_0x04ab('0x35')]({},_0x2e069d,_0x404eae[_0x04ab('0x36')]);return db[_0x04ab('0x2a')][_0x04ab('0x37')](_0x2e069d)[_0x04ab('0x23')](handleEntityNotFound(_0x30db64,null))[_0x04ab('0x23')](respondWithResult(_0x30db64,null))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x38')]=function(_0x3f4d83,_0x2ad8ee){return db['ChatProactiveAction'][_0x04ab('0x38')](_0x3f4d83['body'],{})['then'](respondWithResult(_0x2ad8ee,0xc9))[_0x04ab('0x39')](handleError(_0x2ad8ee,null));};exports[_0x04ab('0x3a')]=function(_0x5569ba,_0x40995c){if(_0x5569ba['body']['id']){delete _0x5569ba[_0x04ab('0x3b')]['id'];}return db[_0x04ab('0x2a')][_0x04ab('0x37')]({'where':{'id':_0x5569ba[_0x04ab('0x29')]['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x40995c,null))[_0x04ab('0x23')](saveUpdates(_0x5569ba[_0x04ab('0x3b')],null))[_0x04ab('0x23')](respondWithResult(_0x40995c,null))[_0x04ab('0x39')](handleError(_0x40995c,null));};exports[_0x04ab('0x22')]=function(_0x2b79f8,_0x3f145){return db['ChatProactiveAction'][_0x04ab('0x37')]({'where':{'id':_0x2b79f8[_0x04ab('0x29')]['id']}})['then'](handleEntityNotFound(_0x3f145,null))['then'](removeEntity(_0x3f145,null))[_0x04ab('0x39')](handleError(_0x3f145,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e14a680..23d3c0e 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 _0xfb3c=['ChatProactiveAction','chat_proactive_actions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x348cac,_0x2758d2){var _0x5b139a=function(_0x4ef0e1){while(--_0x4ef0e1){_0x348cac['push'](_0x348cac['shift']());}};_0x5b139a(++_0x2758d2);}(_0xfb3c,0x1c9));var _0xcfb3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfb3c[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xcfb3('0x0'));var util=require(_0xcfb3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcfb3('0x2'));var BPromise=require(_0xcfb3('0x3'));var rp=require(_0xcfb3('0x4'));var fs=require('fs');var path=require(_0xcfb3('0x5'));var rimraf=require(_0xcfb3('0x6'));var config=require(_0xcfb3('0x7'));var attributes=require(_0xcfb3('0x8'));module[_0xcfb3('0x9')]=function(_0x174208,_0x893b3){return _0x174208[_0xcfb3('0xa')](_0xcfb3('0xb'),attributes,{'tableName':_0xcfb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4fc=['ChatProactiveAction','chat_proactive_actions','lodash','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0xb4fc,0x174));var _0xcb4f=function(_0x224e02,_0x2d008f){_0x224e02=_0x224e02-0x0;var _0x35fae8=_0xb4fc[_0x224e02];return _0x35fae8;};'use strict';var _=require(_0xcb4f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcb4f('0x1'));var rp=require(_0xcb4f('0x2'));var fs=require('fs');var path=require(_0xcb4f('0x3'));var rimraf=require('rimraf');var config=require(_0xcb4f('0x4'));var attributes=require(_0xcb4f('0x5'));module[_0xcb4f('0x6')]=function(_0x3b89fa,_0x286b89){return _0x3b89fa[_0xcb4f('0x7')](_0xcb4f('0x8'),attributes,{'tableName':_0xcb4f('0x9'),'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 86a3145..239b0b7 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 _0xe193=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x154dd2,_0x2b9849){var _0x3ec877=function(_0x40db1c){while(--_0x40db1c){_0x154dd2['push'](_0x154dd2['shift']());}};_0x3ec877(++_0x2b9849);}(_0xe193,0x1e5));var _0x3e19=function(_0x5ad5c6,_0x3ae098){_0x5ad5c6=_0x5ad5c6-0x0;var _0xda0deb=_0xe193[_0x5ad5c6];return _0xda0deb;};'use strict';var _=require(_0x3e19('0x0'));var util=require(_0x3e19('0x1'));var moment=require(_0x3e19('0x2'));var BPromise=require(_0x3e19('0x3'));var rs=require(_0x3e19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e19('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e19('0x6'));var config=require(_0x3e19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e19('0x8')][_0x3e19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9684e9,_0x1eb784,_0x2a2cc1){return new BPromise(function(_0x4f24c4,_0x59736f){return client[_0x3e19('0xa')](_0x9684e9,_0x2a2cc1)[_0x3e19('0xb')](function(_0xec5324){logger[_0x3e19('0xc')](_0x3e19('0xd'),_0x1eb784,'request\x20sent');logger[_0x3e19('0xe')](_0x3e19('0xf'),_0x1eb784,'request\x20sent',JSON[_0x3e19('0x10')](_0xec5324));if(_0xec5324[_0x3e19('0x11')]){if(_0xec5324['error'][_0x3e19('0x12')]===0x1f4){logger[_0x3e19('0x11')](_0x3e19('0xd'),_0x1eb784,_0xec5324[_0x3e19('0x11')][_0x3e19('0x13')]);return _0x59736f(_0xec5324[_0x3e19('0x11')][_0x3e19('0x13')]);}logger[_0x3e19('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x1eb784,_0xec5324['error'][_0x3e19('0x13')]);return _0x4f24c4(_0xec5324['error'][_0x3e19('0x13')]);}else{logger[_0x3e19('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x1eb784,_0x3e19('0x14'));_0x4f24c4(_0xec5324['result'][_0x3e19('0x13')]);}})[_0x3e19('0x15')](function(_0x31da5e){logger[_0x3e19('0x11')](_0x3e19('0xd'),_0x1eb784,_0x31da5e);_0x59736f(_0x31da5e);});});} \ No newline at end of file +var _0x67a8=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x67a8,0xa5));var _0x867a=function(_0x452954,_0xe7b363){_0x452954=_0x452954-0x0;var _0x469f03=_0x67a8[_0x452954];return _0x469f03;};'use strict';var _=require('lodash');var util=require(_0x867a('0x0'));var moment=require(_0x867a('0x1'));var BPromise=require(_0x867a('0x2'));var rs=require(_0x867a('0x3'));var fs=require('fs');var Redis=require(_0x867a('0x4'));var db=require(_0x867a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x867a('0x6'))(_0x867a('0x7'));var config=require(_0x867a('0x8'));var jayson=require(_0x867a('0x9'));var client=jayson['client'][_0x867a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275ed3,_0x1d4658,_0x45effd){return new BPromise(function(_0x4ee535,_0x36edb0){return client['request'](_0x275ed3,_0x45effd)['then'](function(_0x39b724){logger[_0x867a('0xb')](_0x867a('0xc'),_0x1d4658,'request\x20sent');logger['debug'](_0x867a('0xd'),_0x1d4658,_0x867a('0xe'),JSON['stringify'](_0x39b724));if(_0x39b724[_0x867a('0xf')]){if(_0x39b724[_0x867a('0xf')][_0x867a('0x10')]===0x1f4){logger[_0x867a('0xf')](_0x867a('0xc'),_0x1d4658,_0x39b724[_0x867a('0xf')][_0x867a('0x11')]);return _0x36edb0(_0x39b724[_0x867a('0xf')][_0x867a('0x11')]);}logger[_0x867a('0xf')](_0x867a('0xc'),_0x1d4658,_0x39b724['error'][_0x867a('0x11')]);return _0x4ee535(_0x39b724['error'][_0x867a('0x11')]);}else{logger[_0x867a('0xb')](_0x867a('0xc'),_0x1d4658,'request\x20sent');_0x4ee535(_0x39b724[_0x867a('0x12')][_0x867a('0x11')]);}})[_0x867a('0x13')](function(_0xbb3aa8){logger[_0x867a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1d4658,_0xbb3aa8);_0x36edb0(_0xbb3aa8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3660300..52bd714 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 _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','destroy','exports','multer','util','path'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb138,0x1dd));var _0x8b13=function(_0x2083d3,_0x2983bc){_0x2083d3=_0x2083d3-0x0;var _0x5b5591=_0xb138[_0x2083d3];return _0x5b5591;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['show']);router[_0x8b13('0xc')]('/',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['put'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['update']);router['delete'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);module[_0x8b13('0xf')]=router; \ No newline at end of file +var _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x4489e8,_0x10e7d6){var _0x2faf09=function(_0x80fd93){while(--_0x80fd93){_0x4489e8['push'](_0x4489e8['shift']());}};_0x2faf09(++_0x10e7d6);}(_0x53ec,0x192));var _0xc53e=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x53ec[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a2de393..c6619b4 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 _0x8e6e=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8e6e,0x10b));var _0xe8e6=function(_0x58a058,_0x5965eb){_0x58a058=_0x58a058-0x0;var _0x347664=_0x8e6e[_0x58a058];return _0x347664;};'use strict';var Sequelize=require(_0xe8e6('0x0'));module[_0xe8e6('0x1')]={'name':{'type':Sequelize[_0xe8e6('0x2')],'unique':_0xe8e6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8e6('0x4')](_0xe8e6('0x5'),_0xe8e6('0x6'),_0xe8e6('0x7'))}}; \ No newline at end of file +var _0x309a=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x309a,0x153));var _0xa309=function(_0x222a99,_0x263f92){_0x222a99=_0x222a99-0x0;var _0x26d4db=_0x309a[_0x222a99];return _0x26d4db;};'use strict';var Sequelize=require(_0xa309('0x0'));module['exports']={'name':{'type':Sequelize[_0xa309('0x1')],'unique':_0xa309('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa309('0x1')]},'timeout':{'type':Sequelize[_0xa309('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa309('0x4')](_0xa309('0x5'),_0xa309('0x6'),_0xa309('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1aa52df..1e3c4f2 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 _0x5906=['status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','ChatQueues','error','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','getOptions','include','query','rows','catch','params','keys','filters','model','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','intersection','nolimit','order','sort','where','pick','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:remove','getAgents','hasOwnProperty','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus'];(function(_0x5e8897,_0x299e79){var _0x271b50=function(_0x74267a){while(--_0x74267a){_0x5e8897['push'](_0x5e8897['shift']());}};_0x271b50(++_0x299e79);}(_0x5906,0x162));var _0x6590=function(_0x3fed18,_0x5cd50d){_0x3fed18=_0x3fed18-0x0;var _0x1b9e1d=_0x5906[_0x3fed18];return _0x1b9e1d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x6590('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x6590('0x1'))(_0x6590('0x2'));var config=require(_0x6590('0x3'));var db=require(_0x6590('0x4'))['db'];config[_0x6590('0x5')]=_[_0x6590('0x6')](config[_0x6590('0x5')],{'host':_0x6590('0x7'),'port':0x18eb});var socket=require(_0x6590('0x8'))(new Redis(config[_0x6590('0x5')]));require(_0x6590('0x9'))[_0x6590('0xa')](socket);function respondWithStatusCode(_0x385817,_0x3392cb){_0x3392cb=_0x3392cb||0xcc;return function(_0x17abd6){if(_0x17abd6){return _0x385817[_0x6590('0xb')](_0x3392cb);}return _0x385817[_0x6590('0xc')](_0x3392cb)[_0x6590('0xd')]();};}function respondWithResult(_0x241224,_0x44f300){_0x44f300=_0x44f300||0xc8;return function(_0x5ac623){if(_0x5ac623){return _0x241224[_0x6590('0xc')](_0x44f300)[_0x6590('0xe')](_0x5ac623);}};}function respondWithFilteredResult(_0x1d30e4,_0x3dd8cf){return function(_0x1fd720){if(_0x1fd720){var _0x3df1be=typeof _0x3dd8cf['offset']===_0x6590('0xf')&&typeof _0x3dd8cf['limit']===_0x6590('0xf');var _0x282776=_0x1fd720[_0x6590('0x10')];var _0x5739e3=_0x3df1be?0x0:_0x3dd8cf[_0x6590('0x11')];var _0x3da431=_0x3df1be?_0x1fd720['count']:_0x3dd8cf[_0x6590('0x11')]+_0x3dd8cf[_0x6590('0x12')];var _0x4317c3;if(_0x3da431>=_0x282776){_0x3da431=_0x282776;_0x4317c3=0xc8;}else{_0x4317c3=0xce;}_0x1d30e4[_0x6590('0xc')](_0x4317c3);return _0x1d30e4['set'](_0x6590('0x13'),_0x5739e3+'-'+_0x3da431+'/'+_0x282776)[_0x6590('0xe')](_0x1fd720);}return null;};}function saveUpdates(_0x314110){return function(_0x44f760){if(_0x44f760){return _0x44f760[_0x6590('0x14')](_0x314110)[_0x6590('0x15')](function(_0x34cc9b){return _0x34cc9b;});}return null;};}function removeEntity(_0x38ff2e){return function(_0x2483db){if(_0x2483db){return _0x2483db[_0x6590('0x16')]()['then'](function(){var _0x4ac289=_0x2483db[_0x6590('0x17')]({'plain':!![]});var _0x484804=_0x6590('0x18');return db['UserProfileResource'][_0x6590('0x16')]({'where':{'type':_0x484804,'resourceId':_0x4ac289['id']}})[_0x6590('0x15')](function(){return _0x2483db;});})[_0x6590('0x15')](function(){_0x38ff2e[_0x6590('0xc')](0xcc)[_0x6590('0xd')]();});}};}function handleEntityNotFound(_0x4669da){return function(_0x5a7191){if(!_0x5a7191){_0x4669da[_0x6590('0xb')](0x194);}return _0x5a7191;};}function handleError(_0x2e2c2c,_0x154b1d){_0x154b1d=_0x154b1d||0x1f4;return function(_0x273c76){logger[_0x6590('0x19')](_0x273c76[_0x6590('0x1a')]);if(_0x273c76['name']){delete _0x273c76['name'];}_0x2e2c2c[_0x6590('0xc')](_0x154b1d)[_0x6590('0x1b')](_0x273c76);};}exports[_0x6590('0x1c')]=function(_0x5e359d,_0x5c1b81){var _0x5c8218={};var _0x4346ab={'count':0x0,'rows':[]};var _0x50b437=_[_0x6590('0x1d')](db[_0x6590('0x1e')][_0x6590('0x1f')],function(_0x44198b){return{'name':_0x44198b[_0x6590('0x20')],'type':_0x44198b[_0x6590('0x21')]['key']};});_0x5c8218=qs[_0x6590('0x22')](_0x50b437,_0x5e359d);var _0x841688={'where':_0x5c8218['where']};return db[_0x6590('0x1e')][_0x6590('0x10')](_0x841688)[_0x6590('0x15')](function(_0x65b5b7){_0x4346ab[_0x6590('0x10')]=_0x65b5b7;_0x5c8218[_0x6590('0x23')]=qs['include'](_0x5e359d[_0x6590('0x24')]);return db['ChatQueue']['findAll'](_0x5c8218);})[_0x6590('0x15')](function(_0x1550ae){_0x4346ab[_0x6590('0x25')]=_0x1550ae;return _0x4346ab;})['then'](respondWithFilteredResult(_0x5c1b81,_0x5c8218))[_0x6590('0x26')](handleError(_0x5c1b81,null));};exports['show']=function(_0x251bb8,_0x24f1cd){var _0x7d1b0f={'raw':!![],'where':{'id':_0x251bb8[_0x6590('0x27')]['id']}},_0x1fd4b7={};_0x1fd4b7['model']=_[_0x6590('0x28')](db['ChatQueue']['rawAttributes']);_0x1fd4b7[_0x6590('0x24')]=_['keys'](_0x251bb8[_0x6590('0x24')]);_0x1fd4b7[_0x6590('0x29')]=_['intersection'](_0x1fd4b7[_0x6590('0x2a')],_0x1fd4b7[_0x6590('0x24')]);_0x7d1b0f[_0x6590('0x2b')]=_['intersection'](_0x1fd4b7['model'],qs[_0x6590('0x2c')](_0x251bb8['query'][_0x6590('0x2c')]));_0x7d1b0f['attributes']=_0x7d1b0f[_0x6590('0x2b')][_0x6590('0x2d')]?_0x7d1b0f[_0x6590('0x2b')]:_0x1fd4b7[_0x6590('0x2a')];if(_0x251bb8['query']['includeAll']){_0x7d1b0f[_0x6590('0x23')]=[{'all':!![]}];}_0x7d1b0f=_[_0x6590('0x2e')]({},_0x7d1b0f,_0x251bb8[_0x6590('0x2f')]);return db[_0x6590('0x1e')][_0x6590('0x30')](_0x7d1b0f)[_0x6590('0x15')](handleEntityNotFound(_0x24f1cd,null))['then'](respondWithResult(_0x24f1cd,null))[_0x6590('0x26')](handleError(_0x24f1cd,null));};exports[_0x6590('0x31')]=function(_0x3848fc,_0x49c7f8){return db['ChatQueue']['create'](_0x3848fc[_0x6590('0x32')],{})[_0x6590('0x15')](function(_0x1cbe39){var _0x4e8b06=_0x3848fc[_0x6590('0x33')][_0x6590('0x17')]({'plain':!![]});if(!_0x4e8b06)throw new Error(_0x6590('0x34'));if(_0x4e8b06[_0x6590('0x35')]===_0x6590('0x33')){var _0x2956b5=_0x1cbe39['get']({'plain':!![]});var _0x16b0ec=_0x6590('0x18');return db[_0x6590('0x36')][_0x6590('0x30')]({'where':{'name':_0x16b0ec,'userProfileId':_0x4e8b06[_0x6590('0x37')]},'raw':!![]})[_0x6590('0x15')](function(_0xef5cea){if(_0xef5cea&&_0xef5cea[_0x6590('0x38')]===0x0){return db[_0x6590('0x39')]['create']({'name':_0x2956b5[_0x6590('0x3a')],'resourceId':_0x2956b5['id'],'type':_0xef5cea[_0x6590('0x3a')],'sectionId':_0xef5cea['id']},{})[_0x6590('0x15')](function(){return _0x1cbe39;});}else{return _0x1cbe39;}})[_0x6590('0x26')](function(_0x237b33){logger['error'](_0x6590('0x3b'),_0x237b33);throw _0x237b33;});}return _0x1cbe39;})['then'](respondWithResult(_0x49c7f8,0xc9))[_0x6590('0x26')](handleError(_0x49c7f8,null));};exports[_0x6590('0x14')]=function(_0xb55e3a,_0x42ebeb){if(_0xb55e3a[_0x6590('0x32')]['id']){delete _0xb55e3a[_0x6590('0x32')]['id'];}return db[_0x6590('0x1e')][_0x6590('0x30')]({'where':{'id':_0xb55e3a[_0x6590('0x27')]['id']}})[_0x6590('0x15')](handleEntityNotFound(_0x42ebeb,null))[_0x6590('0x15')](saveUpdates(_0xb55e3a['body'],null))[_0x6590('0x15')](respondWithResult(_0x42ebeb,null))[_0x6590('0x26')](handleError(_0x42ebeb,null));};exports[_0x6590('0x16')]=function(_0x946426,_0x4164fb){return db[_0x6590('0x1e')][_0x6590('0x30')]({'where':{'id':_0x946426[_0x6590('0x27')]['id']}})['then'](handleEntityNotFound(_0x4164fb,null))[_0x6590('0x15')](removeEntity(_0x4164fb,null))['catch'](handleError(_0x4164fb,null));};exports[_0x6590('0x3c')]=function(_0x3dcc64,_0x5d2bf9){return db[_0x6590('0x1e')][_0x6590('0x3c')]()[_0x6590('0x15')](respondWithResult(_0x5d2bf9,null))['catch'](handleError(_0x5d2bf9,null));};exports['getMembers']=function(_0x172ea4,_0x120e0f){var _0x5daa0a={'raw':!![],'where':{}},_0x1a1b99={},_0x3889db;return db[_0x6590('0x1e')][_0x6590('0x3d')]({'where':{'id':_0x172ea4[_0x6590('0x27')]['id']}})[_0x6590('0x15')](handleEntityNotFound(_0x120e0f,null))[_0x6590('0x15')](function(_0x439fd1){if(_0x439fd1){_0x3889db=_0x439fd1[_0x6590('0x17')]({'plain':!![]});_0x1a1b99[_0x6590('0x2a')]=_[_0x6590('0x28')](db[_0x6590('0x3e')]['rawAttributes']);_0x1a1b99[_0x6590('0x24')]=_[_0x6590('0x28')](_0x172ea4[_0x6590('0x24')]);_0x1a1b99['filters']=_[_0x6590('0x3f')](_0x1a1b99[_0x6590('0x2a')],_0x1a1b99['query']);_0x5daa0a[_0x6590('0x2b')]=_[_0x6590('0x3f')](_0x1a1b99[_0x6590('0x2a')],qs[_0x6590('0x2c')](_0x172ea4[_0x6590('0x24')][_0x6590('0x2c')]));_0x5daa0a[_0x6590('0x2b')]=_0x5daa0a[_0x6590('0x2b')][_0x6590('0x2d')]?_0x5daa0a['attributes']:_0x1a1b99[_0x6590('0x2a')];if(!_0x172ea4[_0x6590('0x24')]['hasOwnProperty'](_0x6590('0x40'))){_0x5daa0a['limit']=qs['limit'](_0x172ea4['query'][_0x6590('0x12')]);_0x5daa0a[_0x6590('0x11')]=qs[_0x6590('0x11')](_0x172ea4[_0x6590('0x24')][_0x6590('0x11')]);}_0x5daa0a[_0x6590('0x41')]=qs[_0x6590('0x42')](_0x172ea4['query'][_0x6590('0x42')]);_0x5daa0a[_0x6590('0x43')]=qs[_0x6590('0x29')](_[_0x6590('0x44')](_0x172ea4[_0x6590('0x24')],_0x1a1b99[_0x6590('0x29')]));_0x5daa0a[_0x6590('0x43')][_0x6590('0x45')]=_0x439fd1['id'];if(_0x172ea4[_0x6590('0x24')][_0x6590('0x46')]){_0x5daa0a[_0x6590('0x43')]=_[_0x6590('0x2e')](_0x5daa0a['where'],{'$or':_[_0x6590('0x1d')](_0x5daa0a[_0x6590('0x2b')],function(_0x4391eb){var _0x10703f={};_0x10703f[_0x4391eb]={'$like':'%'+_0x172ea4[_0x6590('0x24')][_0x6590('0x46')]+'%'};return _0x10703f;})});}_0x5daa0a=_[_0x6590('0x2e')]({},_0x5daa0a,_0x172ea4[_0x6590('0x2f')]);return db[_0x6590('0x3e')]['findAll'](_0x5daa0a);}})[_0x6590('0x15')](function(_0x2d4183){if(_0x2d4183){return db[_0x6590('0x47')][_0x6590('0x48')]({'where':{'id':_[_0x6590('0x1d')](_0x2d4183,'UserId'),'role':_0x6590('0x49')},'attributes':['id','name',_0x6590('0x4a'),_0x6590('0x4b'),_0x6590('0x4c')]});}})[_0x6590('0x15')](function(_0x332ffd){if(_0x332ffd){return{'count':_0x332ffd[_0x6590('0x10')],'rows':_[_0x6590('0x1d')](_0x332ffd['rows'],function(_0x3cc85e){return{'membername':_0x3cc85e['name'],'UserId':_0x3cc85e['id'],'queue_name':_0x3889db[_0x6590('0x3a')],'ChatQueueId':_0x3889db['id'],'interface':util[_0x6590('0x4d')](_0x6590('0x4e'),'SIP',_0x3cc85e[_0x6590('0x3a')]),'penalty':0x0,'paused':_0x3cc85e['chatPause'],'createdAt':_0x3cc85e[_0x6590('0x4c')],'updatedAt':_0x3cc85e[_0x6590('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6590('0x15')](respondWithFilteredResult(_0x120e0f,_0x5daa0a))[_0x6590('0x26')](handleError(_0x120e0f,null));};exports[_0x6590('0x4f')]=function(_0x4b9a47,_0x31c2dc){var _0x54768a={};var _0x19c5f8={};var _0x22ef9a;var _0x3500c9;return db[_0x6590('0x1e')][_0x6590('0x3d')]({'where':{'id':_0x4b9a47[_0x6590('0x27')]['id']}})['then'](handleEntityNotFound(_0x31c2dc,null))[_0x6590('0x15')](function(_0x336931){if(_0x336931){_0x22ef9a=_0x336931;_0x19c5f8[_0x6590('0x2a')]=_['keys'](db[_0x6590('0x50')][_0x6590('0x1f')]);_0x19c5f8[_0x6590('0x24')]=_[_0x6590('0x28')](_0x4b9a47[_0x6590('0x24')]);_0x19c5f8['filters']=_[_0x6590('0x3f')](_0x19c5f8[_0x6590('0x2a')],_0x19c5f8[_0x6590('0x24')]);_0x54768a['attributes']=_['intersection'](_0x19c5f8['model'],qs[_0x6590('0x2c')](_0x4b9a47[_0x6590('0x24')][_0x6590('0x2c')]));_0x54768a[_0x6590('0x2b')]=_0x54768a[_0x6590('0x2b')][_0x6590('0x2d')]?_0x54768a[_0x6590('0x2b')]:_0x19c5f8['model'];_0x54768a[_0x6590('0x41')]=qs[_0x6590('0x42')](_0x4b9a47[_0x6590('0x24')]['sort']);_0x54768a[_0x6590('0x43')]=qs[_0x6590('0x29')](_[_0x6590('0x44')](_0x4b9a47[_0x6590('0x24')],_0x19c5f8['filters']));if(_0x4b9a47[_0x6590('0x24')][_0x6590('0x46')]){_0x54768a['where']=_['merge'](_0x54768a[_0x6590('0x43')],{'$or':_[_0x6590('0x1d')](_0x54768a['attributes'],function(_0x7c38cb){var _0x2d18cb={};_0x2d18cb[_0x7c38cb]={'$like':'%'+_0x4b9a47[_0x6590('0x24')][_0x6590('0x46')]+'%'};return _0x2d18cb;})});}_0x54768a=_[_0x6590('0x2e')]({},_0x54768a,_0x4b9a47[_0x6590('0x2f')]);return _0x22ef9a[_0x6590('0x4f')](_0x54768a);}})[_0x6590('0x15')](function(_0x57d7e3){if(_0x57d7e3){_0x3500c9=_0x57d7e3[_0x6590('0x2d')];if(!_0x4b9a47[_0x6590('0x24')]['hasOwnProperty']('nolimit')){_0x54768a[_0x6590('0x12')]=qs[_0x6590('0x12')](_0x4b9a47[_0x6590('0x24')][_0x6590('0x12')]);_0x54768a[_0x6590('0x11')]=qs[_0x6590('0x11')](_0x4b9a47[_0x6590('0x24')][_0x6590('0x11')]);}return _0x22ef9a[_0x6590('0x4f')](_0x54768a);}})[_0x6590('0x15')](function(_0x54fbb6){if(_0x54fbb6){return _0x54fbb6?{'count':_0x3500c9,'rows':_0x54fbb6}:null;}})[_0x6590('0x15')](respondWithResult(_0x31c2dc,null))['catch'](handleError(_0x31c2dc,null));};exports[_0x6590('0x51')]=function(_0x4e0ece,_0x1019fe){var _0x53faa9=_0x4e0ece[_0x6590('0x32')][_0x6590('0x52')];return db[_0x6590('0x50')][_0x6590('0x53')]({'where':{'id':_0x53faa9},'attributes':['id'],'include':[{'model':db[_0x6590('0x47')],'as':_0x6590('0x54'),'attributes':['id',_0x6590('0x3a'),_0x6590('0x55'),_0x6590('0x56'),_0x6590('0x57')],'raw':!![]}]})['then'](function(_0x1cda91){if(_0x1cda91){var _0x5333f0=_['flatMap'](_0x1cda91,function(_0x7bde74){var _0x198654=_0x7bde74[_0x6590('0x17')]({'plain':!![]});return _0x198654[_0x6590('0x54')];});return db[_0x6590('0x1e')][_0x6590('0x30')]({'where':{'id':_0x4e0ece[_0x6590('0x27')]['id']}})['then'](function(_0xf6d823){return db[_0x6590('0x58')][_0x6590('0x59')](function(_0x393550){return _0xf6d823[_0x6590('0x51')](_0x53faa9,{'transaction':_0x393550})[_0x6590('0x15')](function(){return BPromise[_0x6590('0x5a')](_0x5333f0,function(_0x2a8e9a){return db[_0x6590('0x3e')][_0x6590('0x5b')]({'where':{'UserId':_0x2a8e9a['id'],'ChatQueueId':_0x4e0ece[_0x6590('0x27')]['id']},'transaction':_0x393550});});})[_0x6590('0x15')](function(){_0x5333f0[_0x6590('0x5c')](function(_0x119fe6){socket[_0x6590('0x5d')](_0x6590('0x5e'),{'UserId':_0x119fe6['id'],'ChatQueueId':_0xf6d823['id']});});});});});}})[_0x6590('0x15')](respondWithStatusCode(_0x1019fe,null))[_0x6590('0x26')](handleError(_0x1019fe,null));};exports[_0x6590('0x5f')]=function(_0x5cec8e,_0x3b9b5f){return db['Team'][_0x6590('0x53')]({'where':{'id':_0x5cec8e[_0x6590('0x24')][_0x6590('0x52')]},'attributes':['id'],'include':[{'model':db[_0x6590('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6590('0x15')](handleEntityNotFound(_0x3b9b5f,null))['then'](function(_0x23b801){var _0x31296b=_[_0x6590('0x1d')](_0x23b801,'id');var _0x161306=[];var _0x38989f=[];var _0x1a6ca0=squel[_0x6590('0x60')]();_0x1a6ca0[_0x6590('0x61')](_0x6590('0x62'))['from'](_0x6590('0x63'),'tq')[_0x6590('0x64')](_0x6590('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6590('0x66'),_0x5cec8e[_0x6590('0x27')]['id']);for(var _0x3cb3a6=0x0;_0x3cb3a6<_0x23b801[_0x6590('0x2d')];_0x3cb3a6+=0x1){let _0x561129=_0x23b801[_0x3cb3a6];for(var _0x1e41b=0x0;_0x1e41b<_0x561129['Agents'][_0x6590('0x2d')];_0x1e41b+=0x1){let _0x2837d6=_0x561129['Agents'][_0x1e41b];var _0x40545d=_0x1a6ca0[_0x6590('0x67')]();_0x40545d[_0x6590('0x43')](_0x6590('0x68'),_0x2837d6['id']);_0x38989f[_0x6590('0x69')](db[_0x6590('0x58')]['query'](_0x40545d[_0x6590('0x6a')](),{'type':db['sequelize'][_0x6590('0x6b')][_0x6590('0x6c')]})[_0x6590('0x15')](function(_0x41cda1){if(_0x41cda1[_0x6590('0x2d')]===0x1){return _0x2837d6['id'];}else{var _0x3a2285=_[_0x6590('0x6d')](_[_0x6590('0x1d')](_0x41cda1,_0x6590('0x6e')),function(_0x576da7){return _[_0x6590('0x6f')](_0x31296b,_0x576da7);});if(_0x3a2285){return _0x2837d6['id'];}}}));}}return BPromise['all'](_0x38989f)['then'](function(_0x491037){_0x161306=_(_0x161306)['union'](_0x491037)[_0x6590('0x70')]()[_0x6590('0x71')]();return db[_0x6590('0x1e')][_0x6590('0x30')]({'where':{'id':_0x5cec8e[_0x6590('0x27')]['id']}})[_0x6590('0x15')](function(_0x3b8421){return db['sequelize'][_0x6590('0x59')](function(_0x19ead3){return _0x3b8421['removeTeams'](_0x5cec8e['query']['ids'],{'transaction':_0x19ead3})[_0x6590('0x15')](function(){if(!_[_0x6590('0x72')](_0x161306)){return _0x3b8421[_0x6590('0x73')](_0x161306,{'transaction':_0x19ead3});}})[_0x6590('0x15')](function(){_0x161306[_0x6590('0x5c')](function(_0x846eab){socket[_0x6590('0x5d')]('userChatQueue:remove',{'UserId':_0x846eab,'ChatQueueId':_0x3b8421['id']});});});});});});})[_0x6590('0x15')](respondWithStatusCode(_0x3b9b5f,null))[_0x6590('0x26')](handleError(_0x3b9b5f,null));};exports[_0x6590('0x74')]=function(_0x139b6a,_0x30c4dd){return db[_0x6590('0x1e')]['find']({'where':{'id':_0x139b6a[_0x6590('0x27')]['id']}})[_0x6590('0x15')](handleEntityNotFound(_0x30c4dd,null))[_0x6590('0x15')](function(_0x473393){if(_0x473393){return _0x473393[_0x6590('0x74')](_0x139b6a['body'][_0x6590('0x52')],_[_0x6590('0x75')](_0x139b6a[_0x6590('0x32')],['ids','id'])||{})[_0x6590('0x76')](function(_0x560e54){for(var _0x2013c7=0x0;_0x2013c7<_0x139b6a[_0x6590('0x32')][_0x6590('0x52')][_0x6590('0x2d')];_0x2013c7+=0x1){socket['emit'](_0x6590('0x5e'),{'UserId':Number(_0x139b6a[_0x6590('0x32')][_0x6590('0x52')][_0x2013c7]),'ChatQueueId':Number(_0x139b6a[_0x6590('0x27')]['id'])});}return _0x560e54;});}})[_0x6590('0x15')](respondWithResult(_0x30c4dd,null))['catch'](handleError(_0x30c4dd,null));};exports[_0x6590('0x73')]=function(_0x3c3e68,_0x2574ec){return db[_0x6590('0x1e')][_0x6590('0x30')]({'where':{'id':_0x3c3e68[_0x6590('0x27')]['id']}})[_0x6590('0x15')](handleEntityNotFound(_0x2574ec,null))[_0x6590('0x15')](function(_0x1f9947){if(_0x1f9947){return _0x1f9947[_0x6590('0x73')](_0x3c3e68[_0x6590('0x24')][_0x6590('0x52')])['then'](function(){if(_['isArray'](_0x3c3e68[_0x6590('0x24')]['ids'])){for(var _0x5dd064=0x0;_0x5dd064<_0x3c3e68[_0x6590('0x24')][_0x6590('0x52')][_0x6590('0x2d')];_0x5dd064+=0x1){socket[_0x6590('0x5d')](_0x6590('0x77'),{'UserId':Number(_0x3c3e68['query'][_0x6590('0x52')][_0x5dd064]),'ChatQueueId':Number(_0x3c3e68[_0x6590('0x27')]['id'])});}}else{socket[_0x6590('0x5d')](_0x6590('0x77'),{'UserId':Number(_0x3c3e68[_0x6590('0x24')][_0x6590('0x52')]),'ChatQueueId':Number(_0x3c3e68['params']['id'])});}});}})[_0x6590('0x15')](respondWithStatusCode(_0x2574ec,null))[_0x6590('0x26')](handleError(_0x2574ec,null));};exports[_0x6590('0x78')]=function(_0x449931,_0x3b8839){var _0x47562f={};var _0x18b747={};var _0x4cb5ef;var _0x3eb36c;return db[_0x6590('0x1e')]['findOne']({'where':{'id':_0x449931['params']['id']}})[_0x6590('0x15')](handleEntityNotFound(_0x3b8839,null))['then'](function(_0x3a731f){if(_0x3a731f){_0x4cb5ef=_0x3a731f;_0x18b747['model']=_[_0x6590('0x28')](db[_0x6590('0x47')][_0x6590('0x1f')]);_0x18b747[_0x6590('0x24')]=_[_0x6590('0x28')](_0x449931['query']);_0x18b747['filters']=_['intersection'](_0x18b747[_0x6590('0x2a')],_0x18b747[_0x6590('0x24')]);_0x47562f[_0x6590('0x2b')]=_['intersection'](_0x18b747[_0x6590('0x2a')],qs[_0x6590('0x2c')](_0x449931['query']['fields']));_0x47562f['attributes']=_0x47562f[_0x6590('0x2b')]['length']?_0x47562f[_0x6590('0x2b')]:_0x18b747['model'];_0x47562f[_0x6590('0x41')]=qs[_0x6590('0x42')](_0x449931[_0x6590('0x24')][_0x6590('0x42')]);_0x47562f[_0x6590('0x43')]=qs['filters'](_['pick'](_0x449931[_0x6590('0x24')],_0x18b747[_0x6590('0x29')]));if(_0x449931[_0x6590('0x24')][_0x6590('0x46')]){_0x47562f[_0x6590('0x43')]=_[_0x6590('0x2e')](_0x47562f[_0x6590('0x43')],{'$or':_[_0x6590('0x1d')](_0x47562f['attributes'],function(_0x368de2){var _0x1e2125={};_0x1e2125[_0x368de2]={'$like':'%'+_0x449931[_0x6590('0x24')][_0x6590('0x46')]+'%'};return _0x1e2125;})});}_0x47562f=_[_0x6590('0x2e')]({},_0x47562f,_0x449931[_0x6590('0x2f')]);return _0x4cb5ef[_0x6590('0x78')](_0x47562f);}})[_0x6590('0x15')](function(_0x1d5e0c){if(_0x1d5e0c){_0x3eb36c=_0x1d5e0c[_0x6590('0x2d')];if(!_0x449931[_0x6590('0x24')][_0x6590('0x79')](_0x6590('0x40'))){_0x47562f[_0x6590('0x12')]=qs[_0x6590('0x12')](_0x449931['query'][_0x6590('0x12')]);_0x47562f[_0x6590('0x11')]=qs[_0x6590('0x11')](_0x449931[_0x6590('0x24')]['offset']);}return _0x4cb5ef[_0x6590('0x78')](_0x47562f);}})[_0x6590('0x15')](function(_0x57d6ca){if(_0x57d6ca){return _0x57d6ca?{'count':_0x3eb36c,'rows':_0x57d6ca}:null;}})[_0x6590('0x15')](respondWithResult(_0x3b8839,null))[_0x6590('0x26')](handleError(_0x3b8839,null));}; \ No newline at end of file +var _0xbfd4=['tq.TeamId','join','user_has_teams','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','pick','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','destroy','ChatQueues','UserProfileResource','then','error','name','index','map','ChatQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','filters','model','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','filter','UserChatQueue','User','createdAt','format','%s/%s','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams'];(function(_0x4c39ee,_0x268d07){var _0x2600db=function(_0xfd4bc6){while(--_0xfd4bc6){_0x4c39ee['push'](_0x4c39ee['shift']());}};_0x2600db(++_0x268d07);}(_0xbfd4,0xec));var _0x4bfd=function(_0x28fdcd,_0x1cddc7){_0x28fdcd=_0x28fdcd-0x0;var _0x3fed9c=_0xbfd4[_0x28fdcd];return _0x3fed9c;};'use strict';var BPromise=require('bluebird');var util=require(_0x4bfd('0x0'));var _=require('lodash');var squel=require(_0x4bfd('0x1'));var Redis=require(_0x4bfd('0x2'));var qs=require(_0x4bfd('0x3'));var logger=require(_0x4bfd('0x4'))(_0x4bfd('0x5'));var config=require(_0x4bfd('0x6'));var db=require('../../mysqldb')['db'];config[_0x4bfd('0x7')]=_[_0x4bfd('0x8')](config[_0x4bfd('0x7')],{'host':_0x4bfd('0x9'),'port':0x18eb});var socket=require(_0x4bfd('0xa'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0xb3aa4f,_0x3c7129){_0x3c7129=_0x3c7129||0xcc;return function(_0x5bdad6){if(_0x5bdad6){return _0xb3aa4f[_0x4bfd('0xb')](_0x3c7129);}return _0xb3aa4f['status'](_0x3c7129)[_0x4bfd('0xc')]();};}function respondWithResult(_0x488576,_0x2d5640){_0x2d5640=_0x2d5640||0xc8;return function(_0x4e4bf3){if(_0x4e4bf3){return _0x488576['status'](_0x2d5640)[_0x4bfd('0xd')](_0x4e4bf3);}};}function respondWithFilteredResult(_0x5cc76,_0x12ab9b){return function(_0x36c3c1){if(_0x36c3c1){var _0x444db1=typeof _0x12ab9b[_0x4bfd('0xe')]===_0x4bfd('0xf')&&typeof _0x12ab9b['limit']===_0x4bfd('0xf');var _0x3873cd=_0x36c3c1[_0x4bfd('0x10')];var _0x332de0=_0x444db1?0x0:_0x12ab9b['offset'];var _0x3ac87c=_0x444db1?_0x36c3c1[_0x4bfd('0x10')]:_0x12ab9b[_0x4bfd('0xe')]+_0x12ab9b[_0x4bfd('0x11')];var _0x1b820d;if(_0x3ac87c>=_0x3873cd){_0x3ac87c=_0x3873cd;_0x1b820d=0xc8;}else{_0x1b820d=0xce;}_0x5cc76[_0x4bfd('0x12')](_0x1b820d);return _0x5cc76[_0x4bfd('0x13')](_0x4bfd('0x14'),_0x332de0+'-'+_0x3ac87c+'/'+_0x3873cd)['json'](_0x36c3c1);}return null;};}function saveUpdates(_0x1f6866){return function(_0x523657){if(_0x523657){return _0x523657['update'](_0x1f6866)['then'](function(_0xc574e1){return _0xc574e1;});}return null;};}function removeEntity(_0x4a72ae){return function(_0x1ed56c){if(_0x1ed56c){return _0x1ed56c[_0x4bfd('0x15')]()['then'](function(){var _0xe2dc20=_0x1ed56c['get']({'plain':!![]});var _0x43532e=_0x4bfd('0x16');return db[_0x4bfd('0x17')][_0x4bfd('0x15')]({'where':{'type':_0x43532e,'resourceId':_0xe2dc20['id']}})[_0x4bfd('0x18')](function(){return _0x1ed56c;});})[_0x4bfd('0x18')](function(){_0x4a72ae[_0x4bfd('0x12')](0xcc)[_0x4bfd('0xc')]();});}};}function handleEntityNotFound(_0xa29bbb){return function(_0x4f7555){if(!_0x4f7555){_0xa29bbb[_0x4bfd('0xb')](0x194);}return _0x4f7555;};}function handleError(_0x4d0693,_0x9a04d3){_0x9a04d3=_0x9a04d3||0x1f4;return function(_0x34118f){logger[_0x4bfd('0x19')](_0x34118f['stack']);if(_0x34118f['name']){delete _0x34118f[_0x4bfd('0x1a')];}_0x4d0693[_0x4bfd('0x12')](_0x9a04d3)['send'](_0x34118f);};}exports[_0x4bfd('0x1b')]=function(_0xdf4aae,_0x2b7836){var _0x46b834={};var _0x1d541c={'count':0x0,'rows':[]};var _0x4cb038=_[_0x4bfd('0x1c')](db[_0x4bfd('0x1d')][_0x4bfd('0x1e')],function(_0x1714ab){return{'name':_0x1714ab[_0x4bfd('0x1f')],'type':_0x1714ab['type'][_0x4bfd('0x20')]};});_0x46b834=qs['getOptions'](_0x4cb038,_0xdf4aae);var _0x821140={'where':_0x46b834[_0x4bfd('0x21')]};return db[_0x4bfd('0x1d')][_0x4bfd('0x10')](_0x821140)['then'](function(_0x58eb15){_0x1d541c[_0x4bfd('0x10')]=_0x58eb15;_0x46b834[_0x4bfd('0x22')]=qs[_0x4bfd('0x22')](_0xdf4aae[_0x4bfd('0x23')]);return db[_0x4bfd('0x1d')][_0x4bfd('0x24')](_0x46b834);})['then'](function(_0x2c52b8){_0x1d541c[_0x4bfd('0x25')]=_0x2c52b8;return _0x1d541c;})[_0x4bfd('0x18')](respondWithFilteredResult(_0x2b7836,_0x46b834))[_0x4bfd('0x26')](handleError(_0x2b7836,null));};exports[_0x4bfd('0x27')]=function(_0x4bbfb2,_0x54af35){var _0x5d2895={'raw':!![],'where':{'id':_0x4bbfb2[_0x4bfd('0x28')]['id']}},_0xfbfe52={};_0xfbfe52['model']=_[_0x4bfd('0x29')](db[_0x4bfd('0x1d')][_0x4bfd('0x1e')]);_0xfbfe52[_0x4bfd('0x23')]=_[_0x4bfd('0x29')](_0x4bbfb2[_0x4bfd('0x23')]);_0xfbfe52[_0x4bfd('0x2a')]=_['intersection'](_0xfbfe52[_0x4bfd('0x2b')],_0xfbfe52[_0x4bfd('0x23')]);_0x5d2895[_0x4bfd('0x2c')]=_[_0x4bfd('0x2d')](_0xfbfe52[_0x4bfd('0x2b')],qs[_0x4bfd('0x2e')](_0x4bbfb2[_0x4bfd('0x23')]['fields']));_0x5d2895[_0x4bfd('0x2c')]=_0x5d2895[_0x4bfd('0x2c')][_0x4bfd('0x2f')]?_0x5d2895[_0x4bfd('0x2c')]:_0xfbfe52[_0x4bfd('0x2b')];if(_0x4bbfb2[_0x4bfd('0x23')][_0x4bfd('0x30')]){_0x5d2895[_0x4bfd('0x22')]=[{'all':!![]}];}_0x5d2895=_[_0x4bfd('0x31')]({},_0x5d2895,_0x4bbfb2[_0x4bfd('0x32')]);return db[_0x4bfd('0x1d')][_0x4bfd('0x33')](_0x5d2895)['then'](handleEntityNotFound(_0x54af35,null))[_0x4bfd('0x18')](respondWithResult(_0x54af35,null))[_0x4bfd('0x26')](handleError(_0x54af35,null));};exports[_0x4bfd('0x34')]=function(_0x16c364,_0x3e9866){return db[_0x4bfd('0x1d')][_0x4bfd('0x34')](_0x16c364[_0x4bfd('0x35')],{})[_0x4bfd('0x18')](function(_0xd7669d){var _0x3ea1c5=_0x16c364[_0x4bfd('0x36')][_0x4bfd('0x37')]({'plain':!![]});if(!_0x3ea1c5)throw new Error(_0x4bfd('0x38'));if(_0x3ea1c5[_0x4bfd('0x39')]===_0x4bfd('0x36')){var _0x2507c0=_0xd7669d[_0x4bfd('0x37')]({'plain':!![]});var _0x1965aa=_0x4bfd('0x16');return db[_0x4bfd('0x3a')]['find']({'where':{'name':_0x1965aa,'userProfileId':_0x3ea1c5['userProfileId']},'raw':!![]})['then'](function(_0x508efa){if(_0x508efa&&_0x508efa[_0x4bfd('0x3b')]===0x0){return db[_0x4bfd('0x17')][_0x4bfd('0x34')]({'name':_0x2507c0[_0x4bfd('0x1a')],'resourceId':_0x2507c0['id'],'type':_0x508efa[_0x4bfd('0x1a')],'sectionId':_0x508efa['id']},{})[_0x4bfd('0x18')](function(){return _0xd7669d;});}else{return _0xd7669d;}})[_0x4bfd('0x26')](function(_0x3f2d70){logger[_0x4bfd('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f2d70);throw _0x3f2d70;});}return _0xd7669d;})[_0x4bfd('0x18')](respondWithResult(_0x3e9866,0xc9))[_0x4bfd('0x26')](handleError(_0x3e9866,null));};exports[_0x4bfd('0x3c')]=function(_0x541f05,_0x1abd14){if(_0x541f05[_0x4bfd('0x35')]['id']){delete _0x541f05['body']['id'];}return db[_0x4bfd('0x1d')]['find']({'where':{'id':_0x541f05[_0x4bfd('0x28')]['id']}})[_0x4bfd('0x18')](handleEntityNotFound(_0x1abd14,null))[_0x4bfd('0x18')](saveUpdates(_0x541f05['body'],null))[_0x4bfd('0x18')](respondWithResult(_0x1abd14,null))[_0x4bfd('0x26')](handleError(_0x1abd14,null));};exports[_0x4bfd('0x15')]=function(_0x11d4ab,_0x31718a){return db[_0x4bfd('0x1d')][_0x4bfd('0x33')]({'where':{'id':_0x11d4ab[_0x4bfd('0x28')]['id']}})[_0x4bfd('0x18')](handleEntityNotFound(_0x31718a,null))['then'](removeEntity(_0x31718a,null))[_0x4bfd('0x26')](handleError(_0x31718a,null));};exports[_0x4bfd('0x3d')]=function(_0x7307c5,_0x36c15f){return db[_0x4bfd('0x1d')][_0x4bfd('0x3d')]()[_0x4bfd('0x18')](respondWithResult(_0x36c15f,null))[_0x4bfd('0x26')](handleError(_0x36c15f,null));};exports[_0x4bfd('0x3e')]=function(_0x38abe9,_0x3df5c8){var _0x51cc76={'raw':!![],'where':{}},_0x4c3903={},_0x2dc39a;return db['ChatQueue'][_0x4bfd('0x3f')]({'where':{'id':_0x38abe9[_0x4bfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x3df5c8,null))['then'](function(_0x2f091c){if(_0x2f091c){_0x2dc39a=_0x2f091c['get']({'plain':!![]});_0x4c3903[_0x4bfd('0x2b')]=_[_0x4bfd('0x29')](db['UserChatQueue'][_0x4bfd('0x1e')]);_0x4c3903[_0x4bfd('0x23')]=_[_0x4bfd('0x29')](_0x38abe9[_0x4bfd('0x23')]);_0x4c3903['filters']=_[_0x4bfd('0x2d')](_0x4c3903[_0x4bfd('0x2b')],_0x4c3903[_0x4bfd('0x23')]);_0x51cc76[_0x4bfd('0x2c')]=_[_0x4bfd('0x2d')](_0x4c3903[_0x4bfd('0x2b')],qs[_0x4bfd('0x2e')](_0x38abe9[_0x4bfd('0x23')][_0x4bfd('0x2e')]));_0x51cc76[_0x4bfd('0x2c')]=_0x51cc76['attributes'][_0x4bfd('0x2f')]?_0x51cc76[_0x4bfd('0x2c')]:_0x4c3903[_0x4bfd('0x2b')];if(!_0x38abe9[_0x4bfd('0x23')][_0x4bfd('0x40')](_0x4bfd('0x41'))){_0x51cc76[_0x4bfd('0x11')]=qs['limit'](_0x38abe9[_0x4bfd('0x23')]['limit']);_0x51cc76[_0x4bfd('0xe')]=qs[_0x4bfd('0xe')](_0x38abe9[_0x4bfd('0x23')]['offset']);}_0x51cc76['order']=qs[_0x4bfd('0x42')](_0x38abe9[_0x4bfd('0x23')][_0x4bfd('0x42')]);_0x51cc76[_0x4bfd('0x21')]=qs[_0x4bfd('0x2a')](_['pick'](_0x38abe9['query'],_0x4c3903[_0x4bfd('0x2a')]));_0x51cc76[_0x4bfd('0x21')]['ChatQueueId']=_0x2f091c['id'];if(_0x38abe9[_0x4bfd('0x23')][_0x4bfd('0x43')]){_0x51cc76[_0x4bfd('0x21')]=_[_0x4bfd('0x31')](_0x51cc76['where'],{'$or':_[_0x4bfd('0x1c')](_0x51cc76['attributes'],function(_0x5b946b){var _0xc4ff11={};_0xc4ff11[_0x5b946b]={'$like':'%'+_0x38abe9['query'][_0x4bfd('0x43')]+'%'};return _0xc4ff11;})});}_0x51cc76=_[_0x4bfd('0x31')]({},_0x51cc76,_0x38abe9[_0x4bfd('0x32')]);return db[_0x4bfd('0x44')]['findAll'](_0x51cc76);}})['then'](function(_0x115807){if(_0x115807){return db[_0x4bfd('0x45')]['findAndCountAll']({'where':{'id':_[_0x4bfd('0x1c')](_0x115807,'UserId'),'role':'agent'},'attributes':['id',_0x4bfd('0x1a'),'chatPause','updatedAt',_0x4bfd('0x46')]});}})[_0x4bfd('0x18')](function(_0x1c1453){if(_0x1c1453){return{'count':_0x1c1453[_0x4bfd('0x10')],'rows':_[_0x4bfd('0x1c')](_0x1c1453[_0x4bfd('0x25')],function(_0x3dedd4){return{'membername':_0x3dedd4[_0x4bfd('0x1a')],'UserId':_0x3dedd4['id'],'queue_name':_0x2dc39a[_0x4bfd('0x1a')],'ChatQueueId':_0x2dc39a['id'],'interface':util[_0x4bfd('0x47')](_0x4bfd('0x48'),'SIP',_0x3dedd4[_0x4bfd('0x1a')]),'penalty':0x0,'paused':_0x3dedd4['chatPause'],'createdAt':_0x3dedd4[_0x4bfd('0x46')],'updatedAt':_0x3dedd4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3df5c8,_0x51cc76))[_0x4bfd('0x26')](handleError(_0x3df5c8,null));};exports[_0x4bfd('0x49')]=function(_0x5e47c4,_0x5076f3){var _0xe606ca={};var _0x1be619={};var _0xb34d00;var _0x2ce858;return db[_0x4bfd('0x1d')][_0x4bfd('0x3f')]({'where':{'id':_0x5e47c4[_0x4bfd('0x28')]['id']}})['then'](handleEntityNotFound(_0x5076f3,null))[_0x4bfd('0x18')](function(_0x379d3c){if(_0x379d3c){_0xb34d00=_0x379d3c;_0x1be619[_0x4bfd('0x2b')]=_[_0x4bfd('0x29')](db[_0x4bfd('0x4a')][_0x4bfd('0x1e')]);_0x1be619[_0x4bfd('0x23')]=_[_0x4bfd('0x29')](_0x5e47c4[_0x4bfd('0x23')]);_0x1be619['filters']=_[_0x4bfd('0x2d')](_0x1be619[_0x4bfd('0x2b')],_0x1be619[_0x4bfd('0x23')]);_0xe606ca['attributes']=_['intersection'](_0x1be619[_0x4bfd('0x2b')],qs[_0x4bfd('0x2e')](_0x5e47c4[_0x4bfd('0x23')]['fields']));_0xe606ca[_0x4bfd('0x2c')]=_0xe606ca[_0x4bfd('0x2c')]['length']?_0xe606ca[_0x4bfd('0x2c')]:_0x1be619['model'];_0xe606ca[_0x4bfd('0x4b')]=qs[_0x4bfd('0x42')](_0x5e47c4[_0x4bfd('0x23')]['sort']);_0xe606ca[_0x4bfd('0x21')]=qs[_0x4bfd('0x2a')](_['pick'](_0x5e47c4[_0x4bfd('0x23')],_0x1be619[_0x4bfd('0x2a')]));if(_0x5e47c4[_0x4bfd('0x23')][_0x4bfd('0x43')]){_0xe606ca[_0x4bfd('0x21')]=_[_0x4bfd('0x31')](_0xe606ca[_0x4bfd('0x21')],{'$or':_[_0x4bfd('0x1c')](_0xe606ca[_0x4bfd('0x2c')],function(_0x5a27d7){var _0x5b64a4={};_0x5b64a4[_0x5a27d7]={'$like':'%'+_0x5e47c4[_0x4bfd('0x23')]['filter']+'%'};return _0x5b64a4;})});}_0xe606ca=_['merge']({},_0xe606ca,_0x5e47c4['options']);return _0xb34d00[_0x4bfd('0x49')](_0xe606ca);}})[_0x4bfd('0x18')](function(_0x4e1869){if(_0x4e1869){_0x2ce858=_0x4e1869[_0x4bfd('0x2f')];if(!_0x5e47c4[_0x4bfd('0x23')]['hasOwnProperty'](_0x4bfd('0x41'))){_0xe606ca[_0x4bfd('0x11')]=qs['limit'](_0x5e47c4[_0x4bfd('0x23')][_0x4bfd('0x11')]);_0xe606ca[_0x4bfd('0xe')]=qs[_0x4bfd('0xe')](_0x5e47c4[_0x4bfd('0x23')][_0x4bfd('0xe')]);}return _0xb34d00[_0x4bfd('0x49')](_0xe606ca);}})['then'](function(_0x30cc73){if(_0x30cc73){return _0x30cc73?{'count':_0x2ce858,'rows':_0x30cc73}:null;}})[_0x4bfd('0x18')](respondWithResult(_0x5076f3,null))['catch'](handleError(_0x5076f3,null));};exports[_0x4bfd('0x4c')]=function(_0x1c842b,_0x199439){var _0x155bb9=_0x1c842b['body'][_0x4bfd('0x4d')];return db[_0x4bfd('0x4a')][_0x4bfd('0x24')]({'where':{'id':_0x155bb9},'attributes':['id'],'include':[{'model':db[_0x4bfd('0x45')],'as':_0x4bfd('0x4e'),'attributes':['id',_0x4bfd('0x1a'),_0x4bfd('0x4f'),_0x4bfd('0x50'),_0x4bfd('0x51')],'raw':!![]}]})['then'](function(_0x576319){if(_0x576319){var _0x37328d=_[_0x4bfd('0x52')](_0x576319,function(_0x48826c){var _0x46aad1=_0x48826c[_0x4bfd('0x37')]({'plain':!![]});return _0x46aad1[_0x4bfd('0x4e')];});return db['ChatQueue'][_0x4bfd('0x33')]({'where':{'id':_0x1c842b['params']['id']}})[_0x4bfd('0x18')](function(_0x2dbc34){return db['sequelize'][_0x4bfd('0x53')](function(_0x37ee96){return _0x2dbc34[_0x4bfd('0x4c')](_0x155bb9,{'transaction':_0x37ee96})[_0x4bfd('0x18')](function(){return BPromise[_0x4bfd('0x54')](_0x37328d,function(_0x1ebfac){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x1ebfac['id'],'ChatQueueId':_0x1c842b['params']['id']},'transaction':_0x37ee96});});})[_0x4bfd('0x18')](function(){_0x37328d[_0x4bfd('0x55')](function(_0xccdda2){socket[_0x4bfd('0x56')]('userChatQueue:save',{'UserId':_0xccdda2['id'],'ChatQueueId':_0x2dbc34['id']});});});});});}})[_0x4bfd('0x18')](respondWithStatusCode(_0x199439,null))[_0x4bfd('0x26')](handleError(_0x199439,null));};exports[_0x4bfd('0x57')]=function(_0x4f28ce,_0x5311a4){return db['Team'][_0x4bfd('0x24')]({'where':{'id':_0x4f28ce['query'][_0x4bfd('0x4d')]},'attributes':['id'],'include':[{'model':db[_0x4bfd('0x45')],'as':_0x4bfd('0x4e'),'attributes':['id'],'raw':!![]}]})[_0x4bfd('0x18')](handleEntityNotFound(_0x5311a4,null))['then'](function(_0x1bc21f){var _0x30cdb8=_[_0x4bfd('0x1c')](_0x1bc21f,'id');var _0x539705=[];var _0x17367e=[];var _0x4ce00d=squel['select']();_0x4ce00d['field'](_0x4bfd('0x58'))['from']('team_has_chat_queues','tq')[_0x4bfd('0x59')](_0x4bfd('0x5a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x4f28ce[_0x4bfd('0x28')]['id']);for(var _0x77588d=0x0;_0x77588d<_0x1bc21f[_0x4bfd('0x2f')];_0x77588d+=0x1){let _0xf2217a=_0x1bc21f[_0x77588d];for(var _0x2e392f=0x0;_0x2e392f<_0xf2217a[_0x4bfd('0x4e')][_0x4bfd('0x2f')];_0x2e392f+=0x1){let _0x184ba5=_0xf2217a[_0x4bfd('0x4e')][_0x2e392f];var _0x1f9d57=_0x4ce00d['clone']();_0x1f9d57[_0x4bfd('0x21')]('ut.UserId\x20=\x20?',_0x184ba5['id']);_0x17367e[_0x4bfd('0x5b')](db[_0x4bfd('0x5c')][_0x4bfd('0x23')](_0x1f9d57[_0x4bfd('0x5d')](),{'type':db['sequelize'][_0x4bfd('0x5e')][_0x4bfd('0x5f')]})[_0x4bfd('0x18')](function(_0x4bf02a){if(_0x4bf02a['length']===0x1){return _0x184ba5['id'];}else{var _0x55612c=_[_0x4bfd('0x60')](_[_0x4bfd('0x1c')](_0x4bf02a,_0x4bfd('0x61')),function(_0x4e2774){return _[_0x4bfd('0x62')](_0x30cdb8,_0x4e2774);});if(_0x55612c){return _0x184ba5['id'];}}}));}}return BPromise[_0x4bfd('0x63')](_0x17367e)['then'](function(_0x48b9e6){_0x539705=_(_0x539705)[_0x4bfd('0x64')](_0x48b9e6)[_0x4bfd('0x65')]()['value']();return db[_0x4bfd('0x1d')][_0x4bfd('0x33')]({'where':{'id':_0x4f28ce[_0x4bfd('0x28')]['id']}})['then'](function(_0x4cc561){return db[_0x4bfd('0x5c')][_0x4bfd('0x53')](function(_0x13c01b){return _0x4cc561[_0x4bfd('0x57')](_0x4f28ce['query'][_0x4bfd('0x4d')],{'transaction':_0x13c01b})['then'](function(){if(!_[_0x4bfd('0x66')](_0x539705)){return _0x4cc561[_0x4bfd('0x67')](_0x539705,{'transaction':_0x13c01b});}})['then'](function(){_0x539705[_0x4bfd('0x55')](function(_0x568cdc){socket[_0x4bfd('0x56')](_0x4bfd('0x68'),{'UserId':_0x568cdc,'ChatQueueId':_0x4cc561['id']});});});});});});})[_0x4bfd('0x18')](respondWithStatusCode(_0x5311a4,null))[_0x4bfd('0x26')](handleError(_0x5311a4,null));};exports[_0x4bfd('0x69')]=function(_0x371378,_0x4017b5){return db['ChatQueue']['find']({'where':{'id':_0x371378[_0x4bfd('0x28')]['id']}})[_0x4bfd('0x18')](handleEntityNotFound(_0x4017b5,null))[_0x4bfd('0x18')](function(_0x2fb587){if(_0x2fb587){return _0x2fb587[_0x4bfd('0x69')](_0x371378[_0x4bfd('0x35')][_0x4bfd('0x4d')],_['omit'](_0x371378['body'],[_0x4bfd('0x4d'),'id'])||{})['spread'](function(_0x30ed73){for(var _0x1ebe21=0x0;_0x1ebe21<_0x371378['body'][_0x4bfd('0x4d')]['length'];_0x1ebe21+=0x1){socket[_0x4bfd('0x56')]('userChatQueue:save',{'UserId':Number(_0x371378['body'][_0x4bfd('0x4d')][_0x1ebe21]),'ChatQueueId':Number(_0x371378['params']['id'])});}return _0x30ed73;});}})[_0x4bfd('0x18')](respondWithResult(_0x4017b5,null))['catch'](handleError(_0x4017b5,null));};exports[_0x4bfd('0x67')]=function(_0x4505e7,_0x581461){return db['ChatQueue'][_0x4bfd('0x33')]({'where':{'id':_0x4505e7[_0x4bfd('0x28')]['id']}})[_0x4bfd('0x18')](handleEntityNotFound(_0x581461,null))[_0x4bfd('0x18')](function(_0x2a2e56){if(_0x2a2e56){return _0x2a2e56['removeAgents'](_0x4505e7[_0x4bfd('0x23')][_0x4bfd('0x4d')])[_0x4bfd('0x18')](function(){if(_['isArray'](_0x4505e7[_0x4bfd('0x23')][_0x4bfd('0x4d')])){for(var _0x3058d7=0x0;_0x3058d7<_0x4505e7['query'][_0x4bfd('0x4d')][_0x4bfd('0x2f')];_0x3058d7+=0x1){socket['emit'](_0x4bfd('0x68'),{'UserId':Number(_0x4505e7[_0x4bfd('0x23')][_0x4bfd('0x4d')][_0x3058d7]),'ChatQueueId':Number(_0x4505e7['params']['id'])});}}else{socket[_0x4bfd('0x56')](_0x4bfd('0x68'),{'UserId':Number(_0x4505e7[_0x4bfd('0x23')][_0x4bfd('0x4d')]),'ChatQueueId':Number(_0x4505e7[_0x4bfd('0x28')]['id'])});}});}})[_0x4bfd('0x18')](respondWithStatusCode(_0x581461,null))[_0x4bfd('0x26')](handleError(_0x581461,null));};exports['getAgents']=function(_0x17273c,_0x448a31){var _0x3aca93={};var _0x11c7ee={};var _0x105e68;var _0x1139bb;return db[_0x4bfd('0x1d')][_0x4bfd('0x3f')]({'where':{'id':_0x17273c[_0x4bfd('0x28')]['id']}})[_0x4bfd('0x18')](handleEntityNotFound(_0x448a31,null))['then'](function(_0x27da1d){if(_0x27da1d){_0x105e68=_0x27da1d;_0x11c7ee[_0x4bfd('0x2b')]=_['keys'](db[_0x4bfd('0x45')][_0x4bfd('0x1e')]);_0x11c7ee[_0x4bfd('0x23')]=_['keys'](_0x17273c[_0x4bfd('0x23')]);_0x11c7ee[_0x4bfd('0x2a')]=_[_0x4bfd('0x2d')](_0x11c7ee[_0x4bfd('0x2b')],_0x11c7ee[_0x4bfd('0x23')]);_0x3aca93['attributes']=_['intersection'](_0x11c7ee[_0x4bfd('0x2b')],qs[_0x4bfd('0x2e')](_0x17273c[_0x4bfd('0x23')][_0x4bfd('0x2e')]));_0x3aca93[_0x4bfd('0x2c')]=_0x3aca93[_0x4bfd('0x2c')][_0x4bfd('0x2f')]?_0x3aca93[_0x4bfd('0x2c')]:_0x11c7ee['model'];_0x3aca93['order']=qs['sort'](_0x17273c['query']['sort']);_0x3aca93['where']=qs[_0x4bfd('0x2a')](_[_0x4bfd('0x6a')](_0x17273c[_0x4bfd('0x23')],_0x11c7ee[_0x4bfd('0x2a')]));if(_0x17273c['query']['filter']){_0x3aca93['where']=_[_0x4bfd('0x31')](_0x3aca93[_0x4bfd('0x21')],{'$or':_[_0x4bfd('0x1c')](_0x3aca93['attributes'],function(_0x3f46f0){var _0x40a3d3={};_0x40a3d3[_0x3f46f0]={'$like':'%'+_0x17273c[_0x4bfd('0x23')][_0x4bfd('0x43')]+'%'};return _0x40a3d3;})});}_0x3aca93=_[_0x4bfd('0x31')]({},_0x3aca93,_0x17273c['options']);return _0x105e68[_0x4bfd('0x6b')](_0x3aca93);}})[_0x4bfd('0x18')](function(_0x209b4c){if(_0x209b4c){_0x1139bb=_0x209b4c[_0x4bfd('0x2f')];if(!_0x17273c[_0x4bfd('0x23')][_0x4bfd('0x40')](_0x4bfd('0x41'))){_0x3aca93[_0x4bfd('0x11')]=qs[_0x4bfd('0x11')](_0x17273c[_0x4bfd('0x23')][_0x4bfd('0x11')]);_0x3aca93[_0x4bfd('0xe')]=qs[_0x4bfd('0xe')](_0x17273c[_0x4bfd('0x23')][_0x4bfd('0xe')]);}return _0x105e68[_0x4bfd('0x6b')](_0x3aca93);}})[_0x4bfd('0x18')](function(_0x26c779){if(_0x26c779){return _0x26c779?{'count':_0x1139bb,'rows':_0x26c779}:null;}})[_0x4bfd('0x18')](respondWithResult(_0x448a31,null))[_0x4bfd('0x26')](handleError(_0x448a31,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 59ccc50..55431c0 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 _0xc2a5=['hook','exports','events','ChatQueue','setMaxListeners','emit'];(function(_0x470d01,_0x7729a5){var _0x10be53=function(_0x177e3f){while(--_0x177e3f){_0x470d01['push'](_0x470d01['shift']());}};_0x10be53(++_0x7729a5);}(_0xc2a5,0x1d6));var _0x5c2a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc2a5[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x5c2a('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x5c2a('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5c2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x40570d){return function(_0x44e218,_0x19ddda,_0x25c6c8){ChatQueueEvents[_0x5c2a('0x3')](_0x40570d+':'+_0x44e218['id'],_0x44e218);ChatQueueEvents[_0x5c2a('0x3')](_0x40570d,_0x44e218);_0x25c6c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x5c2a('0x4')](e,emitEvent(event));}}module[_0x5c2a('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0x4793=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x4793,0xb3));var _0x3479=function(_0x43c9bc,_0x149fa6){_0x43c9bc=_0x43c9bc-0x0;var _0x537839=_0x4793[_0x43c9bc];return _0x537839;};'use strict';var EventEmitter=require(_0x3479('0x0'));var ChatQueue=require(_0x3479('0x1'))['db'][_0x3479('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3479('0x3')](0x0);var events={'afterCreate':_0x3479('0x4'),'afterUpdate':_0x3479('0x5'),'afterDestroy':_0x3479('0x6')};function emitEvent(_0x10f885){return function(_0x3de0a7,_0x24537d,_0x3c62fe){ChatQueueEvents[_0x3479('0x7')](_0x10f885+':'+_0x3de0a7['id'],_0x3de0a7);ChatQueueEvents[_0x3479('0x7')](_0x10f885,_0x3de0a7);_0x3c62fe(null);};}for(var e in events){if(events[_0x3479('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 23161a9..bfc0c5f 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 _0x6e91=['request-promise','../../config/environment','exports','define','chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5db6fd,_0x265729){var _0x218d95=function(_0x29bff1){while(--_0x29bff1){_0x5db6fd['push'](_0x5db6fd['shift']());}};_0x218d95(++_0x265729);}(_0x6e91,0x73));var _0x16e9=function(_0x3fd6cb,_0xbc9b0c){_0x3fd6cb=_0x3fd6cb-0x0;var _0x20c189=_0x6e91[_0x3fd6cb];return _0x20c189;};'use strict';var _=require(_0x16e9('0x0'));var util=require(_0x16e9('0x1'));var logger=require(_0x16e9('0x2'))(_0x16e9('0x3'));var moment=require(_0x16e9('0x4'));var BPromise=require(_0x16e9('0x5'));var rp=require(_0x16e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x16e9('0x7'));var attributes=require('./chatQueue.attributes');module[_0x16e9('0x8')]=function(_0x4ecde4,_0x6a63f1){return _0x4ecde4[_0x16e9('0x9')]('ChatQueue',attributes,{'tableName':_0x16e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee21=['api','bluebird','path','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xee21,0xd0));var _0x1ee2=function(_0x178fd8,_0x29024b){_0x178fd8=_0x178fd8-0x0;var _0x4c41eb=_0xee21[_0x178fd8];return _0x4c41eb;};'use strict';var _=require(_0x1ee2('0x0'));var util=require(_0x1ee2('0x1'));var logger=require('../../config/logger')(_0x1ee2('0x2'));var moment=require('moment');var BPromise=require(_0x1ee2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ee2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ee2('0x5'));module[_0x1ee2('0x6')]=function(_0x3af379,_0x396160){return _0x3af379[_0x1ee2('0x7')](_0x1ee2('0x8'),attributes,{'tableName':_0x1ee2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index bc2a979..a6eaf3c 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 _0x9c1d=['result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','model','map','debug','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x5a24fa,_0x18621c){_0x5a24fa=_0x5a24fa-0x0;var _0x267651=_0x9c1d[_0x5a24fa];return _0x267651;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var moment=require(_0xd9c1('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9c1('0x3'));var fs=require('fs');var Redis=require(_0xd9c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9c1('0x5'));var logger=require(_0xd9c1('0x6'))('rpc');var config=require(_0xd9c1('0x7'));var jayson=require(_0xd9c1('0x8'));var client=jayson[_0xd9c1('0x9')][_0xd9c1('0xa')]({'port':0x232a});config[_0xd9c1('0xb')]=_[_0xd9c1('0xc')](config[_0xd9c1('0xb')],{'host':_0xd9c1('0xd'),'port':0x18eb});var socket=require(_0xd9c1('0xe'))(new Redis(config['redis']));require(_0xd9c1('0xf'))[_0xd9c1('0x10')](socket);function respondWithRpcPromise(_0x1b0050,_0x19bc13,_0x2f75da){return new BPromise(function(_0x9592c8,_0x3c57e7){return client['request'](_0x1b0050,_0x2f75da)[_0xd9c1('0x11')](function(_0x27336b){logger[_0xd9c1('0x12')]('ChatQueue,\x20%s,\x20%s',_0x19bc13,_0xd9c1('0x13'));logger['debug'](_0xd9c1('0x14'),_0x19bc13,_0xd9c1('0x13'),JSON[_0xd9c1('0x15')](_0x27336b));if(_0x27336b[_0xd9c1('0x16')]){if(_0x27336b[_0xd9c1('0x16')][_0xd9c1('0x17')]===0x1f4){logger[_0xd9c1('0x16')](_0xd9c1('0x18'),_0x19bc13,_0x27336b[_0xd9c1('0x16')][_0xd9c1('0x19')]);return _0x3c57e7(_0x27336b[_0xd9c1('0x16')][_0xd9c1('0x19')]);}logger[_0xd9c1('0x16')](_0xd9c1('0x18'),_0x19bc13,_0x27336b[_0xd9c1('0x16')]['message']);return _0x9592c8(_0x27336b['error'][_0xd9c1('0x19')]);}else{logger[_0xd9c1('0x12')](_0xd9c1('0x18'),_0x19bc13,_0xd9c1('0x13'));_0x9592c8(_0x27336b[_0xd9c1('0x1a')][_0xd9c1('0x19')]);}})[_0xd9c1('0x1b')](function(_0x332f19){logger[_0xd9c1('0x16')]('ChatQueue,\x20%s,\x20%s',_0x19bc13,_0x332f19);_0x3c57e7(_0x332f19);});});}exports[_0xd9c1('0x1c')]=function(_0x11611d){var _0x37701d=this;return new Promise(function(_0x2aea78,_0x4643ad){return db[_0xd9c1('0x1d')]['findAll']({'raw':_0x11611d[_0xd9c1('0x1e')]?_0x11611d[_0xd9c1('0x1e')][_0xd9c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x11611d['options']?_0x11611d['options'][_0xd9c1('0x20')]||null:null,'attributes':_0x11611d[_0xd9c1('0x1e')]?_0x11611d[_0xd9c1('0x1e')][_0xd9c1('0x21')]||null:null,'limit':_0x11611d[_0xd9c1('0x1e')]?_0x11611d[_0xd9c1('0x1e')][_0xd9c1('0x22')]||null:null,'include':_0x11611d['options']?_0x11611d[_0xd9c1('0x1e')][_0xd9c1('0x23')]?_['map'](_0x11611d['options'][_0xd9c1('0x23')],function(_0x45b15d){return{'model':db[_0x45b15d[_0xd9c1('0x24')]],'as':_0x45b15d['as'],'attributes':_0x45b15d['attributes'],'include':_0x45b15d[_0xd9c1('0x23')]?_[_0xd9c1('0x25')](_0x45b15d['include'],function(_0x4dcc10){return{'model':db[_0x4dcc10[_0xd9c1('0x24')]],'as':_0x4dcc10['as'],'attributes':_0x4dcc10[_0xd9c1('0x21')],'include':_0x4dcc10[_0xd9c1('0x23')]?_[_0xd9c1('0x25')](_0x4dcc10[_0xd9c1('0x23')],function(_0x7373cb){return{'model':db[_0x7373cb[_0xd9c1('0x24')]],'as':_0x7373cb['as'],'attributes':_0x7373cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9c1('0x11')](function(_0x223b88){logger[_0xd9c1('0x12')](_0xd9c1('0x1c'),_0x11611d);logger[_0xd9c1('0x26')](_0xd9c1('0x1c'),_0x11611d,JSON[_0xd9c1('0x15')](_0x223b88));_0x2aea78(_0x223b88);})[_0xd9c1('0x1b')](function(_0x5a1a5c){logger['error']('GetChatQueue',_0x5a1a5c[_0xd9c1('0x19')],_0x11611d);_0x4643ad(_0x37701d['error'](0x1f4,_0x5a1a5c[_0xd9c1('0x19')]));});});};exports[_0xd9c1('0x27')]=function(_0x587ac9){var _0x337761=this;return new Promise(function(_0x3e128b,_0x108422){return db[_0xd9c1('0x1d')][_0xd9c1('0x28')]({'raw':_0x587ac9[_0xd9c1('0x1e')]?_0x587ac9[_0xd9c1('0x1e')][_0xd9c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x587ac9[_0xd9c1('0x1e')]?_0x587ac9[_0xd9c1('0x1e')][_0xd9c1('0x20')]||null:null,'attributes':_0x587ac9[_0xd9c1('0x1e')]?_0x587ac9['options']['attributes']||null:null,'include':_0x587ac9[_0xd9c1('0x1e')]?_0x587ac9[_0xd9c1('0x1e')][_0xd9c1('0x23')]?_['map'](_0x587ac9[_0xd9c1('0x1e')][_0xd9c1('0x23')],function(_0x5905be){return{'model':db[_0x5905be[_0xd9c1('0x24')]],'as':_0x5905be['as'],'attributes':_0x5905be[_0xd9c1('0x21')],'include':_0x5905be['include']?_['map'](_0x5905be[_0xd9c1('0x23')],function(_0xbdfa7){return{'model':db[_0xbdfa7[_0xd9c1('0x24')]],'as':_0xbdfa7['as'],'attributes':_0xbdfa7[_0xd9c1('0x21')],'include':_0xbdfa7[_0xd9c1('0x23')]?_[_0xd9c1('0x25')](_0xbdfa7['include'],function(_0x2cd0eb){return{'model':db[_0x2cd0eb[_0xd9c1('0x24')]],'as':_0x2cd0eb['as'],'attributes':_0x2cd0eb[_0xd9c1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe0d4a5){logger[_0xd9c1('0x12')](_0xd9c1('0x27'),_0x587ac9);logger[_0xd9c1('0x26')](_0xd9c1('0x27'),_0x587ac9,JSON[_0xd9c1('0x15')](_0xe0d4a5));_0x3e128b(_0xe0d4a5);})[_0xd9c1('0x1b')](function(_0x2fa7c4){logger[_0xd9c1('0x16')](_0xd9c1('0x27'),_0x2fa7c4['message'],_0x587ac9);_0x108422(_0x337761[_0xd9c1('0x16')](0x1f4,_0x2fa7c4[_0xd9c1('0x19')]));});});}; \ No newline at end of file +var _0x4eb5=['client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','ChatQueue','findAll','options','where','attributes','limit','include','model','map','GetChatQueue','stringify','ShowChatQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2ee1fc,_0x20e3c3){var _0xe7dd97=function(_0x4796e1){while(--_0x4796e1){_0x2ee1fc['push'](_0x2ee1fc['shift']());}};_0xe7dd97(++_0x20e3c3);}(_0x4eb5,0x19a));var _0x54eb=function(_0x550699,_0x57a71f){_0x550699=_0x550699-0x0;var _0x1fdd21=_0x4eb5[_0x550699];return _0x1fdd21;};'use strict';var _=require(_0x54eb('0x0'));var util=require(_0x54eb('0x1'));var moment=require('moment');var BPromise=require(_0x54eb('0x2'));var rs=require(_0x54eb('0x3'));var fs=require('fs');var Redis=require(_0x54eb('0x4'));var db=require(_0x54eb('0x5'))['db'];var utils=require(_0x54eb('0x6'));var logger=require(_0x54eb('0x7'))(_0x54eb('0x8'));var config=require('../../config/environment');var jayson=require(_0x54eb('0x9'));var client=jayson[_0x54eb('0xa')][_0x54eb('0xb')]({'port':0x232a});config[_0x54eb('0xc')]=_[_0x54eb('0xd')](config[_0x54eb('0xc')],{'host':_0x54eb('0xe'),'port':0x18eb});var socket=require(_0x54eb('0xf'))(new Redis(config[_0x54eb('0xc')]));require(_0x54eb('0x10'))[_0x54eb('0x11')](socket);function respondWithRpcPromise(_0x1e9096,_0x740549,_0x52032c){return new BPromise(function(_0xc81060,_0x3c7c86){return client[_0x54eb('0x12')](_0x1e9096,_0x52032c)[_0x54eb('0x13')](function(_0x57f672){logger[_0x54eb('0x14')](_0x54eb('0x15'),_0x740549,_0x54eb('0x16'));logger[_0x54eb('0x17')](_0x54eb('0x18'),_0x740549,_0x54eb('0x16'),JSON['stringify'](_0x57f672));if(_0x57f672[_0x54eb('0x19')]){if(_0x57f672[_0x54eb('0x19')][_0x54eb('0x1a')]===0x1f4){logger[_0x54eb('0x19')](_0x54eb('0x15'),_0x740549,_0x57f672['error'][_0x54eb('0x1b')]);return _0x3c7c86(_0x57f672[_0x54eb('0x19')]['message']);}logger['error'](_0x54eb('0x15'),_0x740549,_0x57f672[_0x54eb('0x19')]['message']);return _0xc81060(_0x57f672[_0x54eb('0x19')]['message']);}else{logger[_0x54eb('0x14')](_0x54eb('0x15'),_0x740549,_0x54eb('0x16'));_0xc81060(_0x57f672['result'][_0x54eb('0x1b')]);}})[_0x54eb('0x1c')](function(_0x2a0d40){logger[_0x54eb('0x19')]('ChatQueue,\x20%s,\x20%s',_0x740549,_0x2a0d40);_0x3c7c86(_0x2a0d40);});});}exports['GetChatQueue']=function(_0x37f685){var _0x5b07c0=this;return new Promise(function(_0x49a7bf,_0x484b91){return db[_0x54eb('0x1d')][_0x54eb('0x1e')]({'raw':_0x37f685[_0x54eb('0x1f')]?_0x37f685['options']['raw']===undefined?!![]:![]:!![],'where':_0x37f685['options']?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x20')]||null:null,'attributes':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x21')]||null:null,'limit':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x22')]||null:null,'include':_0x37f685[_0x54eb('0x1f')]?_0x37f685[_0x54eb('0x1f')][_0x54eb('0x23')]?_['map'](_0x37f685[_0x54eb('0x1f')]['include'],function(_0x319252){return{'model':db[_0x319252[_0x54eb('0x24')]],'as':_0x319252['as'],'attributes':_0x319252[_0x54eb('0x21')],'include':_0x319252[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x319252['include'],function(_0x5c0955){return{'model':db[_0x5c0955[_0x54eb('0x24')]],'as':_0x5c0955['as'],'attributes':_0x5c0955[_0x54eb('0x21')],'include':_0x5c0955[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x5c0955[_0x54eb('0x23')],function(_0x1e934d){return{'model':db[_0x1e934d['model']],'as':_0x1e934d['as'],'attributes':_0x1e934d[_0x54eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x54eb('0x13')](function(_0x39fd1e){logger[_0x54eb('0x14')](_0x54eb('0x26'),_0x37f685);logger[_0x54eb('0x17')](_0x54eb('0x26'),_0x37f685,JSON[_0x54eb('0x27')](_0x39fd1e));_0x49a7bf(_0x39fd1e);})['catch'](function(_0xf041e8){logger[_0x54eb('0x19')](_0x54eb('0x26'),_0xf041e8[_0x54eb('0x1b')],_0x37f685);_0x484b91(_0x5b07c0['error'](0x1f4,_0xf041e8[_0x54eb('0x1b')]));});});};exports[_0x54eb('0x28')]=function(_0x35256d){var _0x5f5a67=this;return new Promise(function(_0x498586,_0x1032b9){return db[_0x54eb('0x1d')]['find']({'raw':_0x35256d['options']?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x29')]===undefined?!![]:![]:!![],'where':_0x35256d['options']?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x20')]||null:null,'attributes':_0x35256d[_0x54eb('0x1f')]?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x21')]||null:null,'include':_0x35256d[_0x54eb('0x1f')]?_0x35256d[_0x54eb('0x1f')][_0x54eb('0x23')]?_['map'](_0x35256d[_0x54eb('0x1f')]['include'],function(_0x591c24){return{'model':db[_0x591c24['model']],'as':_0x591c24['as'],'attributes':_0x591c24[_0x54eb('0x21')],'include':_0x591c24[_0x54eb('0x23')]?_['map'](_0x591c24[_0x54eb('0x23')],function(_0x19b9f6){return{'model':db[_0x19b9f6[_0x54eb('0x24')]],'as':_0x19b9f6['as'],'attributes':_0x19b9f6[_0x54eb('0x21')],'include':_0x19b9f6[_0x54eb('0x23')]?_[_0x54eb('0x25')](_0x19b9f6['include'],function(_0x210430){return{'model':db[_0x210430[_0x54eb('0x24')]],'as':_0x210430['as'],'attributes':_0x210430[_0x54eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x54eb('0x13')](function(_0x446530){logger[_0x54eb('0x14')]('ShowChatQueue',_0x35256d);logger[_0x54eb('0x17')]('ShowChatQueue',_0x35256d,JSON[_0x54eb('0x27')](_0x446530));_0x498586(_0x446530);})['catch'](function(_0x1ef17f){logger['error'](_0x54eb('0x28'),_0x1ef17f[_0x54eb('0x1b')],_0x35256d);_0x1032b9(_0x5f5a67[_0x54eb('0x19')](0x1f4,_0x1ef17f[_0x54eb('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6d35a7b..2e31175 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 _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x4d3b77,_0x3c789c){var _0x1a716a=function(_0x10707c){while(--_0x10707c){_0x4d3b77['push'](_0x4d3b77['shift']());}};_0x1a716a(++_0x3c789c);}(_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 +var _0xc874=['emit','removeListener','register','length','./chatQueue.events','remove','update'];(function(_0x30cfed,_0x5d7c31){var _0x2e3164=function(_0x48a990){while(--_0x48a990){_0x30cfed['push'](_0x30cfed['shift']());}};_0x2e3164(++_0x5d7c31);}(_0xc874,0x154));var _0x4c87=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xc874[_0x5093e9];return _0x4c9a22;};'use strict';var ChatQueueEvents=require(_0x4c87('0x0'));var events=['save',_0x4c87('0x1'),_0x4c87('0x2')];function createListener(_0x505440,_0x5e6d61){return function(_0xfc1b9f){_0x5e6d61[_0x4c87('0x3')](_0x505440,_0xfc1b9f);};}function removeListener(_0x1c3dbc,_0x575a7c){return function(){ChatQueueEvents[_0x4c87('0x4')](_0x1c3dbc,_0x575a7c);};}exports[_0x4c87('0x5')]=function(_0x5d63ae){for(var _0x46e0f5=0x0,_0x3dafe0=events[_0x4c87('0x6')];_0x46e0f5<_0x3dafe0;_0x46e0f5++){var _0xdc4a29=events[_0x46e0f5];var _0x116649=createListener('chatQueue:'+_0xdc4a29,_0x5d63ae);ChatQueueEvents['on'](_0xdc4a29,_0x116649);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7d9cbb3..57546bd 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x5fc3[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x5fc3[_0x4843f9];return _0x193c6a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 6a5f941..f4b64a9 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 _0x2791=['STRING','DATE','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2791,0x66));var _0x1279=function(_0x2df819,_0x366130){_0x2df819=_0x2df819-0x0;var _0x29be16=_0x2791[_0x2df819];return _0x29be16;};'use strict';var moment=require(_0x1279('0x0'));var Sequelize=require(_0x1279('0x1'));module[_0x1279('0x2')]={'uniqueid':{'type':Sequelize[_0x1279('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1279('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1279('0x4')]},'acceptAt':{'type':Sequelize[_0x1279('0x4')]},'exitAt':{'type':Sequelize[_0x1279('0x4')]},'reason':{'type':Sequelize[_0x1279('0x3')]}}; \ No newline at end of file +var _0x1065=['sequelize','STRING','DATE','moment'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0x1065,0x1b7));var _0x5106=function(_0x244c79,_0x4adc9f){_0x244c79=_0x244c79-0x0;var _0x5af6e3=_0x1065[_0x244c79];return _0x5af6e3;};'use strict';var moment=require(_0x5106('0x0'));var Sequelize=require(_0x5106('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5106('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5106('0x3')]},'acceptAt':{'type':Sequelize[_0x5106('0x3')]},'exitAt':{'type':Sequelize[_0x5106('0x3')]},'reason':{'type':Sequelize[_0x5106('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f36abdd..8238829 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 _0xfd20=['map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','options','create','body','find','destroy','describe','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','then','end','error','stack','name','send'];(function(_0x2b272b,_0x1af4e3){var _0x2b23ef=function(_0x89a945){while(--_0x89a945){_0x2b272b['push'](_0x2b272b['shift']());}};_0x2b23ef(++_0x1af4e3);}(_0xfd20,0x66));var _0x0fd2=function(_0x332924,_0x240c1c){_0x332924=_0x332924-0x0;var _0x4440e9=_0xfd20[_0x332924];return _0x4440e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fd2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fd2('0x1'));var moment=require(_0x0fd2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0fd2('0x3'));var util=require('util');var path=require(_0x0fd2('0x4'));var sox=require(_0x0fd2('0x5'));var csv=require(_0x0fd2('0x6'));var ejs=require(_0x0fd2('0x7'));var fs=require('fs');var fs_extra=require(_0x0fd2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0fd2('0x9'));var jsforce=require(_0x0fd2('0xa'));var deskjs=require(_0x0fd2('0xb'));var toCsv=require(_0x0fd2('0x6'));var querystring=require(_0x0fd2('0xc'));var Papa=require(_0x0fd2('0xd'));var Redis=require(_0x0fd2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0fd2('0xf'));var as=require(_0x0fd2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fd2('0x11'))('api');var utils=require(_0x0fd2('0x12'));var config=require(_0x0fd2('0x13'));var licenseUtil=require(_0x0fd2('0x14'));var db=require(_0x0fd2('0x15'))['db'];function respondWithStatusCode(_0xdf592d,_0x3504cf){_0x3504cf=_0x3504cf||0xcc;return function(_0x1f7a6e){if(_0x1f7a6e){return _0xdf592d[_0x0fd2('0x16')](_0x3504cf);}return _0xdf592d['status'](_0x3504cf)['end']();};}function respondWithResult(_0x1a9acb,_0x99de24){_0x99de24=_0x99de24||0xc8;return function(_0x21dcc5){if(_0x21dcc5){return _0x1a9acb[_0x0fd2('0x17')](_0x99de24)['json'](_0x21dcc5);}};}function respondWithFilteredResult(_0x280253,_0x4f074a){return function(_0x50b723){if(_0x50b723){var _0x2b6254=typeof _0x4f074a['offset']===_0x0fd2('0x18')&&typeof _0x4f074a['limit']===_0x0fd2('0x18');var _0x4cd2bf=_0x50b723[_0x0fd2('0x19')];var _0x15c9de=_0x2b6254?0x0:_0x4f074a['offset'];var _0x2b25d2=_0x2b6254?_0x50b723['count']:_0x4f074a[_0x0fd2('0x1a')]+_0x4f074a[_0x0fd2('0x1b')];var _0x3fb07e;if(_0x2b25d2>=_0x4cd2bf){_0x2b25d2=_0x4cd2bf;_0x3fb07e=0xc8;}else{_0x3fb07e=0xce;}_0x280253[_0x0fd2('0x17')](_0x3fb07e);return _0x280253[_0x0fd2('0x1c')](_0x0fd2('0x1d'),_0x15c9de+'-'+_0x2b25d2+'/'+_0x4cd2bf)[_0x0fd2('0x1e')](_0x50b723);}return null;};}function patchUpdates(_0x1a72ca){return function(_0x1b848d){try{jsonpatch[_0x0fd2('0x1f')](_0x1b848d,_0x1a72ca,!![]);}catch(_0x5c50ad){return BPromise['reject'](_0x5c50ad);}return _0x1b848d['save']();};}function saveUpdates(_0x4156d2,_0x36072a){return function(_0x53ab17){if(_0x53ab17){return _0x53ab17['update'](_0x4156d2)[_0x0fd2('0x20')](function(_0x25563c){return _0x25563c;});}return null;};}function removeEntity(_0x6be8d8,_0x29398f){return function(_0x25cdd2){if(_0x25cdd2){return _0x25cdd2['destroy']()[_0x0fd2('0x20')](function(){_0x6be8d8[_0x0fd2('0x17')](0xcc)[_0x0fd2('0x21')]();});}};}function handleEntityNotFound(_0x54cce1,_0x4c77a8){return function(_0x11bb10){if(!_0x11bb10){_0x54cce1[_0x0fd2('0x16')](0x194);}return _0x11bb10;};}function handleError(_0x4d0924,_0x400133){_0x400133=_0x400133||0x1f4;return function(_0x429fef){logger[_0x0fd2('0x22')](_0x429fef[_0x0fd2('0x23')]);if(_0x429fef[_0x0fd2('0x24')]){delete _0x429fef[_0x0fd2('0x24')];}_0x4d0924[_0x0fd2('0x17')](_0x400133)[_0x0fd2('0x25')](_0x429fef);};}exports['index']=function(_0x37d519,_0x434018){var _0x235c90={},_0x1ca259={},_0x33cf1a={'count':0x0,'rows':[]};var _0x564419=_[_0x0fd2('0x26')](db[_0x0fd2('0x27')][_0x0fd2('0x28')],function(_0x1a7a98){return{'name':_0x1a7a98[_0x0fd2('0x29')],'type':_0x1a7a98[_0x0fd2('0x2a')][_0x0fd2('0x2b')]};});_0x1ca259[_0x0fd2('0x2c')]=_['map'](_0x564419,_0x0fd2('0x24'));_0x1ca259['query']=_['keys'](_0x37d519[_0x0fd2('0x2d')]);_0x1ca259['filters']=_[_0x0fd2('0x2e')](_0x1ca259['model'],_0x1ca259[_0x0fd2('0x2d')]);_0x235c90['attributes']=_['intersection'](_0x1ca259[_0x0fd2('0x2c')],qs[_0x0fd2('0x2f')](_0x37d519[_0x0fd2('0x2d')]['fields']));_0x235c90['attributes']=_0x235c90[_0x0fd2('0x30')]['length']?_0x235c90[_0x0fd2('0x30')]:_0x1ca259[_0x0fd2('0x2c')];if(!_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x31')](_0x0fd2('0x32'))){_0x235c90[_0x0fd2('0x1b')]=qs[_0x0fd2('0x1b')](_0x37d519['query'][_0x0fd2('0x1b')]);_0x235c90[_0x0fd2('0x1a')]=qs['offset'](_0x37d519['query'][_0x0fd2('0x1a')]);}_0x235c90['order']=qs['sort'](_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x33')]);_0x235c90[_0x0fd2('0x34')]=qs[_0x0fd2('0x35')](_[_0x0fd2('0x36')](_0x37d519[_0x0fd2('0x2d')],_0x1ca259[_0x0fd2('0x35')]),_0x564419);if(_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x37')]){_0x235c90[_0x0fd2('0x34')]=_[_0x0fd2('0x38')](_0x235c90[_0x0fd2('0x34')],{'$or':_[_0x0fd2('0x26')](_0x564419,function(_0x3a3986){if(_0x3a3986[_0x0fd2('0x2a')]!==_0x0fd2('0x39')){var _0x50643e={};_0x50643e[_0x3a3986[_0x0fd2('0x24')]]={'$like':'%'+_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x37')]+'%'};return _0x50643e;}})});}_0x235c90=_[_0x0fd2('0x38')]({},_0x235c90,_0x37d519['options']);var _0x286543={'where':_0x235c90['where']};return db[_0x0fd2('0x27')][_0x0fd2('0x19')](_0x286543)['then'](function(_0x43e585){_0x33cf1a[_0x0fd2('0x19')]=_0x43e585;if(_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x3a')]){_0x235c90[_0x0fd2('0x3b')]=[{'all':!![]}];}return db[_0x0fd2('0x27')]['findAll'](_0x235c90);})[_0x0fd2('0x20')](function(_0x409321){_0x33cf1a[_0x0fd2('0x3c')]=_0x409321;return _0x33cf1a;})[_0x0fd2('0x20')](respondWithFilteredResult(_0x434018,_0x235c90))[_0x0fd2('0x3d')](handleError(_0x434018,null));};exports['show']=function(_0x258569,_0x2e804d){var _0x554476={'raw':!![],'where':{'id':_0x258569[_0x0fd2('0x3e')]['id']}},_0x252fb1={};_0x252fb1[_0x0fd2('0x2c')]=_[_0x0fd2('0x3f')](db[_0x0fd2('0x27')][_0x0fd2('0x28')]);_0x252fb1[_0x0fd2('0x2d')]=_[_0x0fd2('0x3f')](_0x258569['query']);_0x252fb1['filters']=_[_0x0fd2('0x2e')](_0x252fb1[_0x0fd2('0x2c')],_0x252fb1['query']);_0x554476[_0x0fd2('0x30')]=_['intersection'](_0x252fb1[_0x0fd2('0x2c')],qs[_0x0fd2('0x2f')](_0x258569[_0x0fd2('0x2d')][_0x0fd2('0x2f')]));_0x554476[_0x0fd2('0x30')]=_0x554476[_0x0fd2('0x30')]['length']?_0x554476['attributes']:_0x252fb1[_0x0fd2('0x2c')];if(_0x258569['query'][_0x0fd2('0x3a')]){_0x554476[_0x0fd2('0x3b')]=[{'all':!![]}];}_0x554476=_[_0x0fd2('0x38')]({},_0x554476,_0x258569[_0x0fd2('0x40')]);return db[_0x0fd2('0x27')]['find'](_0x554476)[_0x0fd2('0x20')](handleEntityNotFound(_0x2e804d,null))['then'](respondWithResult(_0x2e804d,null))[_0x0fd2('0x3d')](handleError(_0x2e804d,null));};exports[_0x0fd2('0x41')]=function(_0x5352cc,_0x337daa){return db['ChatQueueReport']['create'](_0x5352cc[_0x0fd2('0x42')],{})[_0x0fd2('0x20')](respondWithResult(_0x337daa,0xc9))[_0x0fd2('0x3d')](handleError(_0x337daa,null));};exports['update']=function(_0x30ac02,_0x119e21){if(_0x30ac02[_0x0fd2('0x42')]['id']){delete _0x30ac02[_0x0fd2('0x42')]['id'];}return db['ChatQueueReport'][_0x0fd2('0x43')]({'where':{'id':_0x30ac02[_0x0fd2('0x3e')]['id']}})[_0x0fd2('0x20')](handleEntityNotFound(_0x119e21,null))[_0x0fd2('0x20')](saveUpdates(_0x30ac02[_0x0fd2('0x42')],null))[_0x0fd2('0x20')](respondWithResult(_0x119e21,null))[_0x0fd2('0x3d')](handleError(_0x119e21,null));};exports[_0x0fd2('0x44')]=function(_0x2377bd,_0x4322b4){return db[_0x0fd2('0x27')]['find']({'where':{'id':_0x2377bd[_0x0fd2('0x3e')]['id']}})[_0x0fd2('0x20')](handleEntityNotFound(_0x4322b4,null))['then'](removeEntity(_0x4322b4,null))[_0x0fd2('0x3d')](handleError(_0x4322b4,null));};exports['describe']=function(_0x19650c,_0x5193b7){return db[_0x0fd2('0x27')][_0x0fd2('0x45')]()[_0x0fd2('0x20')](respondWithResult(_0x5193b7,null))['catch'](handleError(_0x5193b7,null));}; \ No newline at end of file +var _0x0ef4=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','Content-Range','json','apply','save','update','then','destroy','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','ChatQueueReport','count','includeAll','include','findAll','catch','show','params','length','merge','options','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x472caf,_0x42c3d5){var _0x16cd58=function(_0x42d6fc){while(--_0x42d6fc){_0x472caf['push'](_0x472caf['shift']());}};_0x16cd58(++_0x42c3d5);}(_0x0ef4,0xc7));var _0x40ef=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x0ef4[_0x26b5ff];return _0x58603e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ef('0x0'));var zipdir=require(_0x40ef('0x1'));var jsonpatch=require(_0x40ef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ef('0x3'));var Mustache=require(_0x40ef('0x4'));var util=require(_0x40ef('0x5'));var path=require('path');var sox=require(_0x40ef('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40ef('0x7'));var _=require(_0x40ef('0x8'));var squel=require(_0x40ef('0x9'));var crypto=require(_0x40ef('0xa'));var jsforce=require(_0x40ef('0xb'));var deskjs=require(_0x40ef('0xc'));var toCsv=require(_0x40ef('0xd'));var querystring=require(_0x40ef('0xe'));var Papa=require(_0x40ef('0xf'));var Redis=require('ioredis');var authService=require(_0x40ef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x40ef('0x11'));var hardwareService=require(_0x40ef('0x12'));var logger=require(_0x40ef('0x13'))(_0x40ef('0x14'));var utils=require('../../config/utils');var config=require(_0x40ef('0x15'));var licenseUtil=require(_0x40ef('0x16'));var db=require(_0x40ef('0x17'))['db'];function respondWithStatusCode(_0x3d44c7,_0x1c4ed4){_0x1c4ed4=_0x1c4ed4||0xcc;return function(_0x136ccd){if(_0x136ccd){return _0x3d44c7[_0x40ef('0x18')](_0x1c4ed4);}return _0x3d44c7[_0x40ef('0x19')](_0x1c4ed4)[_0x40ef('0x1a')]();};}function respondWithResult(_0x3d5a16,_0xaf0020){_0xaf0020=_0xaf0020||0xc8;return function(_0x256142){if(_0x256142){return _0x3d5a16['status'](_0xaf0020)['json'](_0x256142);}};}function respondWithFilteredResult(_0x1ab3ba,_0x5010b3){return function(_0x39d022){if(_0x39d022){var _0xdb24fd=typeof _0x5010b3['offset']===_0x40ef('0x1b')&&typeof _0x5010b3[_0x40ef('0x1c')]==='undefined';var _0x3ddcf0=_0x39d022['count'];var _0x3a3ba2=_0xdb24fd?0x0:_0x5010b3[_0x40ef('0x1d')];var _0x3573bd=_0xdb24fd?_0x39d022['count']:_0x5010b3['offset']+_0x5010b3[_0x40ef('0x1c')];var _0x54c35d;if(_0x3573bd>=_0x3ddcf0){_0x3573bd=_0x3ddcf0;_0x54c35d=0xc8;}else{_0x54c35d=0xce;}_0x1ab3ba[_0x40ef('0x19')](_0x54c35d);return _0x1ab3ba['set'](_0x40ef('0x1e'),_0x3a3ba2+'-'+_0x3573bd+'/'+_0x3ddcf0)[_0x40ef('0x1f')](_0x39d022);}return null;};}function patchUpdates(_0x514263){return function(_0x2f6fd5){try{jsonpatch[_0x40ef('0x20')](_0x2f6fd5,_0x514263,!![]);}catch(_0xa60df3){return BPromise['reject'](_0xa60df3);}return _0x2f6fd5[_0x40ef('0x21')]();};}function saveUpdates(_0x4cef12,_0x3fb29c){return function(_0x5d2d53){if(_0x5d2d53){return _0x5d2d53[_0x40ef('0x22')](_0x4cef12)[_0x40ef('0x23')](function(_0x33ffdf){return _0x33ffdf;});}return null;};}function removeEntity(_0x362c81,_0x98d8ef){return function(_0x3d5266){if(_0x3d5266){return _0x3d5266[_0x40ef('0x24')]()[_0x40ef('0x23')](function(){_0x362c81[_0x40ef('0x19')](0xcc)[_0x40ef('0x1a')]();});}};}function handleEntityNotFound(_0x1df9e1,_0x435ce2){return function(_0x14f620){if(!_0x14f620){_0x1df9e1[_0x40ef('0x18')](0x194);}return _0x14f620;};}function handleError(_0x48cfb0,_0x3539bc){_0x3539bc=_0x3539bc||0x1f4;return function(_0x336c03){logger['error'](_0x336c03['stack']);if(_0x336c03[_0x40ef('0x25')]){delete _0x336c03[_0x40ef('0x25')];}_0x48cfb0['status'](_0x3539bc)['send'](_0x336c03);};}exports['index']=function(_0x7a3c7c,_0x570145){var _0x5c87c9={},_0xa1846c={},_0xd4338d={'count':0x0,'rows':[]};var _0x5b541d=_[_0x40ef('0x26')](db['ChatQueueReport'][_0x40ef('0x27')],function(_0x13552e){return{'name':_0x13552e[_0x40ef('0x28')],'type':_0x13552e[_0x40ef('0x29')][_0x40ef('0x2a')]};});_0xa1846c[_0x40ef('0x2b')]=_[_0x40ef('0x26')](_0x5b541d,_0x40ef('0x25'));_0xa1846c[_0x40ef('0x2c')]=_[_0x40ef('0x2d')](_0x7a3c7c['query']);_0xa1846c['filters']=_[_0x40ef('0x2e')](_0xa1846c[_0x40ef('0x2b')],_0xa1846c['query']);_0x5c87c9['attributes']=_['intersection'](_0xa1846c[_0x40ef('0x2b')],qs['fields'](_0x7a3c7c['query'][_0x40ef('0x2f')]));_0x5c87c9[_0x40ef('0x30')]=_0x5c87c9[_0x40ef('0x30')]['length']?_0x5c87c9[_0x40ef('0x30')]:_0xa1846c[_0x40ef('0x2b')];if(!_0x7a3c7c[_0x40ef('0x2c')][_0x40ef('0x31')]('nolimit')){_0x5c87c9['limit']=qs[_0x40ef('0x1c')](_0x7a3c7c['query']['limit']);_0x5c87c9[_0x40ef('0x1d')]=qs[_0x40ef('0x1d')](_0x7a3c7c['query'][_0x40ef('0x1d')]);}_0x5c87c9['order']=qs[_0x40ef('0x32')](_0x7a3c7c['query'][_0x40ef('0x32')]);_0x5c87c9[_0x40ef('0x33')]=qs[_0x40ef('0x34')](_[_0x40ef('0x35')](_0x7a3c7c['query'],_0xa1846c[_0x40ef('0x34')]),_0x5b541d);if(_0x7a3c7c['query'][_0x40ef('0x36')]){_0x5c87c9['where']=_['merge'](_0x5c87c9[_0x40ef('0x33')],{'$or':_[_0x40ef('0x26')](_0x5b541d,function(_0x159a28){if(_0x159a28['type']!==_0x40ef('0x37')){var _0x54345f={};_0x54345f[_0x159a28[_0x40ef('0x25')]]={'$like':'%'+_0x7a3c7c[_0x40ef('0x2c')]['filter']+'%'};return _0x54345f;}})});}_0x5c87c9=_['merge']({},_0x5c87c9,_0x7a3c7c['options']);var _0x1b68d3={'where':_0x5c87c9[_0x40ef('0x33')]};return db[_0x40ef('0x38')][_0x40ef('0x39')](_0x1b68d3)[_0x40ef('0x23')](function(_0x221006){_0xd4338d[_0x40ef('0x39')]=_0x221006;if(_0x7a3c7c[_0x40ef('0x2c')][_0x40ef('0x3a')]){_0x5c87c9[_0x40ef('0x3b')]=[{'all':!![]}];}return db[_0x40ef('0x38')][_0x40ef('0x3c')](_0x5c87c9);})[_0x40ef('0x23')](function(_0x5bf9f3){_0xd4338d['rows']=_0x5bf9f3;return _0xd4338d;})[_0x40ef('0x23')](respondWithFilteredResult(_0x570145,_0x5c87c9))[_0x40ef('0x3d')](handleError(_0x570145,null));};exports[_0x40ef('0x3e')]=function(_0x32e749,_0x2e7971){var _0x5583d3={'raw':!![],'where':{'id':_0x32e749[_0x40ef('0x3f')]['id']}},_0xd75ebe={};_0xd75ebe[_0x40ef('0x2b')]=_[_0x40ef('0x2d')](db[_0x40ef('0x38')]['rawAttributes']);_0xd75ebe[_0x40ef('0x2c')]=_[_0x40ef('0x2d')](_0x32e749[_0x40ef('0x2c')]);_0xd75ebe[_0x40ef('0x34')]=_[_0x40ef('0x2e')](_0xd75ebe[_0x40ef('0x2b')],_0xd75ebe[_0x40ef('0x2c')]);_0x5583d3[_0x40ef('0x30')]=_['intersection'](_0xd75ebe[_0x40ef('0x2b')],qs[_0x40ef('0x2f')](_0x32e749[_0x40ef('0x2c')]['fields']));_0x5583d3[_0x40ef('0x30')]=_0x5583d3[_0x40ef('0x30')][_0x40ef('0x40')]?_0x5583d3['attributes']:_0xd75ebe[_0x40ef('0x2b')];if(_0x32e749[_0x40ef('0x2c')]['includeAll']){_0x5583d3[_0x40ef('0x3b')]=[{'all':!![]}];}_0x5583d3=_[_0x40ef('0x41')]({},_0x5583d3,_0x32e749[_0x40ef('0x42')]);return db[_0x40ef('0x38')]['find'](_0x5583d3)[_0x40ef('0x23')](handleEntityNotFound(_0x2e7971,null))['then'](respondWithResult(_0x2e7971,null))[_0x40ef('0x3d')](handleError(_0x2e7971,null));};exports[_0x40ef('0x43')]=function(_0x1ccc24,_0x407f23){return db[_0x40ef('0x38')]['create'](_0x1ccc24[_0x40ef('0x44')],{})[_0x40ef('0x23')](respondWithResult(_0x407f23,0xc9))[_0x40ef('0x3d')](handleError(_0x407f23,null));};exports['update']=function(_0x10e2a7,_0x1e5190){if(_0x10e2a7[_0x40ef('0x44')]['id']){delete _0x10e2a7[_0x40ef('0x44')]['id'];}return db[_0x40ef('0x38')]['find']({'where':{'id':_0x10e2a7[_0x40ef('0x3f')]['id']}})[_0x40ef('0x23')](handleEntityNotFound(_0x1e5190,null))[_0x40ef('0x23')](saveUpdates(_0x10e2a7[_0x40ef('0x44')],null))[_0x40ef('0x23')](respondWithResult(_0x1e5190,null))[_0x40ef('0x3d')](handleError(_0x1e5190,null));};exports[_0x40ef('0x24')]=function(_0x4a5446,_0xc5306a){return db[_0x40ef('0x38')]['find']({'where':{'id':_0x4a5446[_0x40ef('0x3f')]['id']}})[_0x40ef('0x23')](handleEntityNotFound(_0xc5306a,null))[_0x40ef('0x23')](removeEntity(_0xc5306a,null))[_0x40ef('0x3d')](handleError(_0xc5306a,null));};exports['describe']=function(_0x232c44,_0x844a9c){return db['ChatQueueReport'][_0x40ef('0x45')]()['then'](respondWithResult(_0x844a9c,null))[_0x40ef('0x3d')](handleError(_0x844a9c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 4d8e2ca..c2e73b0 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2b3e7e,_0x37c887){var _0x1e24b2=function(_0x5a761f){while(--_0x5a761f){_0x2b3e7e['push'](_0x2b3e7e['shift']());}};_0x1e24b2(++_0x37c887);}(_0xe706,0xa3));var _0x6e70=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0xe706[_0x48f038];return _0x2edc62;};'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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x156854,_0x5b81b2){var _0x10b704=function(_0x4bf2cb){while(--_0x4bf2cb){_0x156854['push'](_0x156854['shift']());}};_0x10b704(++_0x5b81b2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 3c19339..441a0e2 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 _0x477c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','catch','where','limit','UpdateChatQueueReport','lodash','bluebird'];(function(_0x49ad15,_0x3fa5a3){var _0x4326bc=function(_0x4533ae){while(--_0x4533ae){_0x49ad15['push'](_0x49ad15['shift']());}};_0x4326bc(++_0x3fa5a3);}(_0x477c,0xe6));var _0xc477=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x477c[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xc477('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc477('0x1'));var rs=require(_0xc477('0x2'));var fs=require('fs');var Redis=require(_0xc477('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc477('0x4'));var logger=require(_0xc477('0x5'))(_0xc477('0x6'));var config=require(_0xc477('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc477('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54247b,_0x4a6afa,_0x32abb6){return new BPromise(function(_0x1203bc,_0x259fe9){return client[_0xc477('0x9')](_0x54247b,_0x32abb6)['then'](function(_0x2fbfb3){logger[_0xc477('0xa')](_0xc477('0xb'),_0x4a6afa,_0xc477('0xc'));logger[_0xc477('0xd')](_0xc477('0xe'),_0x4a6afa,_0xc477('0xc'),JSON[_0xc477('0xf')](_0x2fbfb3));if(_0x2fbfb3[_0xc477('0x10')]){if(_0x2fbfb3[_0xc477('0x10')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4a6afa,_0x2fbfb3[_0xc477('0x10')][_0xc477('0x11')]);return _0x259fe9(_0x2fbfb3[_0xc477('0x10')]['message']);}logger['error'](_0xc477('0xb'),_0x4a6afa,_0x2fbfb3['error'][_0xc477('0x11')]);return _0x1203bc(_0x2fbfb3['error'][_0xc477('0x11')]);}else{logger[_0xc477('0xa')](_0xc477('0xb'),_0x4a6afa,_0xc477('0xc'));_0x1203bc(_0x2fbfb3[_0xc477('0x12')]['message']);}})['catch'](function(_0x4f85fa){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4a6afa,_0x4f85fa);_0x259fe9(_0x4f85fa);});});}exports[_0xc477('0x13')]=function(_0x47f45d){var _0x598f6b=this;return new Promise(function(_0x329c76,_0x18fa31){return db[_0xc477('0x14')][_0xc477('0x15')](_0x47f45d[_0xc477('0x16')],{'raw':_0x47f45d[_0xc477('0x17')]?_0x47f45d[_0xc477('0x17')][_0xc477('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x13fb99){logger[_0xc477('0xa')](_0xc477('0x13'),_0x47f45d);logger[_0xc477('0xd')](_0xc477('0x13'),_0x47f45d,JSON[_0xc477('0xf')](_0x13fb99));_0x329c76(_0x13fb99);})[_0xc477('0x19')](function(_0x2e88ce){logger[_0xc477('0x10')]('CreateChatQueueReport',_0x2e88ce['message'],_0x47f45d);_0x18fa31(_0x598f6b[_0xc477('0x10')](0x1f4,_0x2e88ce[_0xc477('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x27484b){var _0x24be99=this;return new Promise(function(_0x4b73ba,_0x36da45){return db[_0xc477('0x14')]['update'](_0x27484b[_0xc477('0x16')],{'raw':_0x27484b['options']?_0x27484b[_0xc477('0x17')][_0xc477('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27484b['options']?_0x27484b[_0xc477('0x17')][_0xc477('0x1a')]||null:null,'attributes':_0x27484b[_0xc477('0x17')]?_0x27484b[_0xc477('0x17')]['attributes']||null:null,'limit':_0x27484b['options']?_0x27484b[_0xc477('0x17')][_0xc477('0x1b')]||null:null})['then'](function(_0x28870d){logger[_0xc477('0xa')](_0xc477('0x1c'),_0x27484b);logger[_0xc477('0xd')]('UpdateChatQueueReport',_0x27484b,JSON[_0xc477('0xf')](_0x28870d));_0x4b73ba(_0x28870d);})['catch'](function(_0x330d25){logger['error']('UpdateChatQueueReport',_0x330d25['message'],_0x27484b);_0x36da45(_0x24be99[_0xc477('0x10')](0x1f4,_0x330d25[_0xc477('0x11')]));});});}; \ No newline at end of file +var _0xf1e4=['../../config/environment','jayson/promise','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','raw','debug','CreateChatQueueReport','update','attributes','limit','UpdateChatQueueReport','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1c6b44,_0x108f43){var _0x3dbbb1=function(_0x3b706d){while(--_0x3b706d){_0x1c6b44['push'](_0x1c6b44['shift']());}};_0x3dbbb1(++_0x108f43);}(_0xf1e4,0xb8));var _0x4f1e=function(_0x326c26,_0x9e132a){_0x326c26=_0x326c26-0x0;var _0x4b1467=_0xf1e4[_0x326c26];return _0x4b1467;};'use strict';var _=require(_0x4f1e('0x0'));var util=require(_0x4f1e('0x1'));var moment=require('moment');var BPromise=require(_0x4f1e('0x2'));var rs=require(_0x4f1e('0x3'));var fs=require('fs');var Redis=require(_0x4f1e('0x4'));var db=require(_0x4f1e('0x5'))['db'];var utils=require(_0x4f1e('0x6'));var logger=require('../../config/logger')(_0x4f1e('0x7'));var config=require(_0x4f1e('0x8'));var jayson=require(_0x4f1e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28e051,_0xc6f8e4,_0x1a2cfc){return new BPromise(function(_0x1bb0fb,_0x391a6f){return client['request'](_0x28e051,_0x1a2cfc)[_0x4f1e('0xa')](function(_0x14f49c){logger[_0x4f1e('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0xc6f8e4,'request\x20sent');logger['debug'](_0x4f1e('0xc'),_0xc6f8e4,_0x4f1e('0xd'),JSON['stringify'](_0x14f49c));if(_0x14f49c['error']){if(_0x14f49c['error'][_0x4f1e('0xe')]===0x1f4){logger[_0x4f1e('0xf')](_0x4f1e('0x10'),_0xc6f8e4,_0x14f49c[_0x4f1e('0xf')]['message']);return _0x391a6f(_0x14f49c[_0x4f1e('0xf')][_0x4f1e('0x11')]);}logger['error'](_0x4f1e('0x10'),_0xc6f8e4,_0x14f49c[_0x4f1e('0xf')]['message']);return _0x1bb0fb(_0x14f49c[_0x4f1e('0xf')][_0x4f1e('0x11')]);}else{logger['info'](_0x4f1e('0x10'),_0xc6f8e4,_0x4f1e('0xd'));_0x1bb0fb(_0x14f49c[_0x4f1e('0x12')][_0x4f1e('0x11')]);}})[_0x4f1e('0x13')](function(_0x5f0f73){logger[_0x4f1e('0xf')](_0x4f1e('0x10'),_0xc6f8e4,_0x5f0f73);_0x391a6f(_0x5f0f73);});});}exports['CreateChatQueueReport']=function(_0x1b172e){var _0xa94b7f=this;return new Promise(function(_0x494454,_0x70c908){return db[_0x4f1e('0x14')][_0x4f1e('0x15')](_0x1b172e[_0x4f1e('0x16')],{'raw':_0x1b172e[_0x4f1e('0x17')]?_0x1b172e[_0x4f1e('0x17')][_0x4f1e('0x18')]===undefined?!![]:![]:!![]})[_0x4f1e('0xa')](function(_0x5be2b9){logger[_0x4f1e('0xb')]('CreateChatQueueReport',_0x1b172e);logger[_0x4f1e('0x19')]('CreateChatQueueReport',_0x1b172e,JSON['stringify'](_0x5be2b9));_0x494454(_0x5be2b9);})[_0x4f1e('0x13')](function(_0xdc0eaa){logger[_0x4f1e('0xf')](_0x4f1e('0x1a'),_0xdc0eaa[_0x4f1e('0x11')],_0x1b172e);_0x70c908(_0xa94b7f[_0x4f1e('0xf')](0x1f4,_0xdc0eaa[_0x4f1e('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0xb0757c){var _0x3e0d90=this;return new Promise(function(_0x382222,_0x30a26c){return db[_0x4f1e('0x14')][_0x4f1e('0x1b')](_0xb0757c['body'],{'raw':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c['options'][_0x4f1e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')]['where']||null:null,'attributes':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')][_0x4f1e('0x1c')]||null:null,'limit':_0xb0757c[_0x4f1e('0x17')]?_0xb0757c[_0x4f1e('0x17')][_0x4f1e('0x1d')]||null:null})[_0x4f1e('0xa')](function(_0x510f78){logger[_0x4f1e('0xb')]('UpdateChatQueueReport',_0xb0757c);logger['debug'](_0x4f1e('0x1e'),_0xb0757c,JSON[_0x4f1e('0x1f')](_0x510f78));_0x382222(_0x510f78);})[_0x4f1e('0x13')](function(_0x40ef9e){logger[_0x4f1e('0xf')](_0x4f1e('0x1e'),_0x40ef9e[_0x4f1e('0x11')],_0xb0757c);_0x30a26c(_0x3e0d90[_0x4f1e('0xf')](0x1f4,_0x40ef9e[_0x4f1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 64e4d87..68aca14 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 _0x2e9d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x2e9d,0x18a));var _0xd2e9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2e9d[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0xd2e9('0x0'));var util=require(_0xd2e9('0x1'));var path=require('path');var timeout=require(_0xd2e9('0x2'));var express=require(_0xd2e9('0x3'));var router=express['Router']();var fs_extra=require(_0xd2e9('0x4'));var auth=require(_0xd2e9('0x5'));var interaction=require(_0xd2e9('0x6'));var config=require(_0xd2e9('0x7'));var controller=require('./chatQueueReport.controller');router[_0xd2e9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd2e9('0x8')](_0xd2e9('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd2e9('0x8')](_0xd2e9('0xa'),auth[_0xd2e9('0xb')](),controller[_0xd2e9('0xc')]);router[_0xd2e9('0xd')]('/',auth['isAuthenticated'](),controller[_0xd2e9('0xe')]);router['put'](_0xd2e9('0xa'),auth[_0xd2e9('0xb')](),controller[_0xd2e9('0xf')]);router[_0xd2e9('0x10')](_0xd2e9('0xa'),auth[_0xd2e9('0xb')](),controller[_0xd2e9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x58b2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x58b2,0x64));var _0x258b=function(_0x8bca3f,_0x158cf8){_0x8bca3f=_0x8bca3f-0x0;var _0x448ab5=_0x58b2[_0x8bca3f];return _0x448ab5;};'use strict';var multer=require(_0x258b('0x0'));var util=require(_0x258b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x258b('0x2'));var router=express[_0x258b('0x3')]();var fs_extra=require(_0x258b('0x4'));var auth=require(_0x258b('0x5'));var interaction=require(_0x258b('0x6'));var config=require(_0x258b('0x7'));var controller=require(_0x258b('0x8'));router['get']('/',auth[_0x258b('0x9')](),controller[_0x258b('0xa')]);router[_0x258b('0xb')](_0x258b('0xc'),auth['isAuthenticated'](),controller[_0x258b('0xd')]);router[_0x258b('0xb')](_0x258b('0xe'),auth[_0x258b('0x9')](),controller['show']);router[_0x258b('0xf')]('/',auth[_0x258b('0x9')](),controller[_0x258b('0x10')]);router[_0x258b('0x11')]('/:id',auth[_0x258b('0x9')](),controller[_0x258b('0x12')]);router['delete'](_0x258b('0xe'),auth[_0x258b('0x9')](),controller[_0x258b('0x13')]);module[_0x258b('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 06b5655..8c59bef 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(_0x3da144,_0x578cbd){var _0x13fdc7=function(_0x2d2919){while(--_0x2d2919){_0x3da144['push'](_0x3da144['shift']());}};_0x13fdc7(++_0x578cbd);}(_0x54ef,0x112));var _0xf54e=function(_0x33f3a0,_0x2f0f49){_0x33f3a0=_0x33f3a0-0x0;var _0xd33834=_0x54ef[_0x33f3a0];return _0xd33834;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x39d90f,_0xee44f){var _0x4d5c2c=function(_0x28d282){while(--_0x28d282){_0x39d90f['push'](_0x39d90f['shift']());}};_0x4d5c2c(++_0xee44f);}(_0x008c,0x188));var _0xc008=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x008c[_0x2f6541];return _0x4d76d8;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ddfffe4..132389c 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 _0x3b38=['findAll','rows','catch','params','keys','includeAll','find','create','body','describe','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include'];(function(_0x2f19d1,_0x2867df){var _0x9fd241=function(_0x181c13){while(--_0x181c13){_0x2f19d1['push'](_0x2f19d1['shift']());}};_0x9fd241(++_0x2867df);}(_0x3b38,0xa2));var _0x83b3=function(_0x19f6ac,_0x508c58){_0x19f6ac=_0x19f6ac-0x0;var _0xcac7da=_0x3b38[_0x19f6ac];return _0xcac7da;};'use strict';var emlformat=require(_0x83b3('0x0'));var rimraf=require(_0x83b3('0x1'));var zipdir=require(_0x83b3('0x2'));var jsonpatch=require(_0x83b3('0x3'));var rp=require(_0x83b3('0x4'));var moment=require(_0x83b3('0x5'));var BPromise=require(_0x83b3('0x6'));var Mustache=require(_0x83b3('0x7'));var util=require('util');var path=require(_0x83b3('0x8'));var sox=require(_0x83b3('0x9'));var csv=require(_0x83b3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83b3('0xb'));var _=require(_0x83b3('0xc'));var squel=require(_0x83b3('0xd'));var crypto=require(_0x83b3('0xe'));var jsforce=require(_0x83b3('0xf'));var deskjs=require(_0x83b3('0x10'));var toCsv=require(_0x83b3('0xa'));var querystring=require(_0x83b3('0x11'));var Papa=require(_0x83b3('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83b3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83b3('0x14'))(_0x83b3('0x15'));var utils=require(_0x83b3('0x16'));var config=require(_0x83b3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x83b3('0x18'))['db'];function respondWithStatusCode(_0x81abb,_0xf54d4e){_0xf54d4e=_0xf54d4e||0xcc;return function(_0x39a8d2){if(_0x39a8d2){return _0x81abb[_0x83b3('0x19')](_0xf54d4e);}return _0x81abb[_0x83b3('0x1a')](_0xf54d4e)[_0x83b3('0x1b')]();};}function respondWithResult(_0x48453c,_0x332059){_0x332059=_0x332059||0xc8;return function(_0x29f9ad){if(_0x29f9ad){return _0x48453c[_0x83b3('0x1a')](_0x332059)[_0x83b3('0x1c')](_0x29f9ad);}};}function respondWithFilteredResult(_0x3ea6a7,_0x14918e){return function(_0x4cc6ba){if(_0x4cc6ba){var _0x4b90ff=typeof _0x14918e['offset']===_0x83b3('0x1d')&&typeof _0x14918e[_0x83b3('0x1e')]==='undefined';var _0x436bfc=_0x4cc6ba['count'];var _0x51ebba=_0x4b90ff?0x0:_0x14918e[_0x83b3('0x1f')];var _0xf0fbee=_0x4b90ff?_0x4cc6ba[_0x83b3('0x20')]:_0x14918e[_0x83b3('0x1f')]+_0x14918e[_0x83b3('0x1e')];var _0x5aa7c8;if(_0xf0fbee>=_0x436bfc){_0xf0fbee=_0x436bfc;_0x5aa7c8=0xc8;}else{_0x5aa7c8=0xce;}_0x3ea6a7[_0x83b3('0x1a')](_0x5aa7c8);return _0x3ea6a7[_0x83b3('0x21')](_0x83b3('0x22'),_0x51ebba+'-'+_0xf0fbee+'/'+_0x436bfc)[_0x83b3('0x1c')](_0x4cc6ba);}return null;};}function patchUpdates(_0x5e3d53){return function(_0x7bd0e1){try{jsonpatch[_0x83b3('0x23')](_0x7bd0e1,_0x5e3d53,!![]);}catch(_0x32a442){return BPromise['reject'](_0x32a442);}return _0x7bd0e1[_0x83b3('0x24')]();};}function saveUpdates(_0x5cbcd6,_0x419852){return function(_0xf7c76){if(_0xf7c76){return _0xf7c76[_0x83b3('0x25')](_0x5cbcd6)[_0x83b3('0x26')](function(_0x402373){return _0x402373;});}return null;};}function removeEntity(_0x414af3,_0x17310a){return function(_0x28dd42){if(_0x28dd42){return _0x28dd42[_0x83b3('0x27')]()['then'](function(){_0x414af3[_0x83b3('0x1a')](0xcc)[_0x83b3('0x1b')]();});}};}function handleEntityNotFound(_0x45230b,_0x258d37){return function(_0x38a2b4){if(!_0x38a2b4){_0x45230b[_0x83b3('0x19')](0x194);}return _0x38a2b4;};}function handleError(_0x315e40,_0x3aba73){_0x3aba73=_0x3aba73||0x1f4;return function(_0x522f61){logger[_0x83b3('0x28')](_0x522f61[_0x83b3('0x29')]);if(_0x522f61[_0x83b3('0x2a')]){delete _0x522f61[_0x83b3('0x2a')];}_0x315e40[_0x83b3('0x1a')](_0x3aba73)['send'](_0x522f61);};}exports[_0x83b3('0x2b')]=function(_0x56fab6,_0x542531){var _0xa7f2b8={},_0x107ee7={},_0x4762ed={'count':0x0,'rows':[]};var _0x57dad7=_[_0x83b3('0x2c')](db[_0x83b3('0x2d')][_0x83b3('0x2e')],function(_0x49f306){return{'name':_0x49f306[_0x83b3('0x2f')],'type':_0x49f306[_0x83b3('0x30')][_0x83b3('0x31')]};});_0x107ee7[_0x83b3('0x32')]=_[_0x83b3('0x2c')](_0x57dad7,'name');_0x107ee7[_0x83b3('0x33')]=_['keys'](_0x56fab6['query']);_0x107ee7[_0x83b3('0x34')]=_[_0x83b3('0x35')](_0x107ee7[_0x83b3('0x32')],_0x107ee7[_0x83b3('0x33')]);_0xa7f2b8[_0x83b3('0x36')]=_[_0x83b3('0x35')](_0x107ee7[_0x83b3('0x32')],qs[_0x83b3('0x37')](_0x56fab6[_0x83b3('0x33')][_0x83b3('0x37')]));_0xa7f2b8['attributes']=_0xa7f2b8[_0x83b3('0x36')][_0x83b3('0x38')]?_0xa7f2b8[_0x83b3('0x36')]:_0x107ee7[_0x83b3('0x32')];if(!_0x56fab6[_0x83b3('0x33')][_0x83b3('0x39')](_0x83b3('0x3a'))){_0xa7f2b8[_0x83b3('0x1e')]=qs[_0x83b3('0x1e')](_0x56fab6[_0x83b3('0x33')][_0x83b3('0x1e')]);_0xa7f2b8['offset']=qs[_0x83b3('0x1f')](_0x56fab6[_0x83b3('0x33')][_0x83b3('0x1f')]);}_0xa7f2b8['order']=qs[_0x83b3('0x3b')](_0x56fab6['query'][_0x83b3('0x3b')]);_0xa7f2b8[_0x83b3('0x3c')]=qs[_0x83b3('0x34')](_['pick'](_0x56fab6['query'],_0x107ee7[_0x83b3('0x34')]),_0x57dad7);if(_0x56fab6[_0x83b3('0x33')][_0x83b3('0x3d')]){_0xa7f2b8['where']=_[_0x83b3('0x3e')](_0xa7f2b8[_0x83b3('0x3c')],{'$or':_['map'](_0x57dad7,function(_0x58b1b5){if(_0x58b1b5['type']!==_0x83b3('0x3f')){var _0x34b44d={};_0x34b44d[_0x58b1b5[_0x83b3('0x2a')]]={'$like':'%'+_0x56fab6['query']['filter']+'%'};return _0x34b44d;}})});}_0xa7f2b8=_[_0x83b3('0x3e')]({},_0xa7f2b8,_0x56fab6[_0x83b3('0x40')]);var _0x30461e={'where':_0xa7f2b8[_0x83b3('0x3c')]};return db[_0x83b3('0x2d')][_0x83b3('0x20')](_0x30461e)[_0x83b3('0x26')](function(_0x2bb4db){_0x4762ed[_0x83b3('0x20')]=_0x2bb4db;if(_0x56fab6[_0x83b3('0x33')]['includeAll']){_0xa7f2b8[_0x83b3('0x41')]=[{'all':!![]}];}return db[_0x83b3('0x2d')][_0x83b3('0x42')](_0xa7f2b8);})['then'](function(_0x4df9c6){_0x4762ed[_0x83b3('0x43')]=_0x4df9c6;return _0x4762ed;})['then'](respondWithFilteredResult(_0x542531,_0xa7f2b8))[_0x83b3('0x44')](handleError(_0x542531,null));};exports['show']=function(_0x5a28dc,_0x4138bb){var _0x4a297b={'raw':!![],'where':{'id':_0x5a28dc[_0x83b3('0x45')]['id']}},_0x121893={};_0x121893['model']=_[_0x83b3('0x46')](db[_0x83b3('0x2d')][_0x83b3('0x2e')]);_0x121893[_0x83b3('0x33')]=_[_0x83b3('0x46')](_0x5a28dc['query']);_0x121893[_0x83b3('0x34')]=_[_0x83b3('0x35')](_0x121893[_0x83b3('0x32')],_0x121893[_0x83b3('0x33')]);_0x4a297b['attributes']=_[_0x83b3('0x35')](_0x121893[_0x83b3('0x32')],qs[_0x83b3('0x37')](_0x5a28dc[_0x83b3('0x33')][_0x83b3('0x37')]));_0x4a297b[_0x83b3('0x36')]=_0x4a297b['attributes'][_0x83b3('0x38')]?_0x4a297b[_0x83b3('0x36')]:_0x121893['model'];if(_0x5a28dc[_0x83b3('0x33')][_0x83b3('0x47')]){_0x4a297b['include']=[{'all':!![]}];}_0x4a297b=_[_0x83b3('0x3e')]({},_0x4a297b,_0x5a28dc['options']);return db[_0x83b3('0x2d')][_0x83b3('0x48')](_0x4a297b)[_0x83b3('0x26')](handleEntityNotFound(_0x4138bb,null))['then'](respondWithResult(_0x4138bb,null))[_0x83b3('0x44')](handleError(_0x4138bb,null));};exports[_0x83b3('0x49')]=function(_0xbe121f,_0x138b55){return db[_0x83b3('0x2d')][_0x83b3('0x49')](_0xbe121f[_0x83b3('0x4a')],{})[_0x83b3('0x26')](respondWithResult(_0x138b55,0xc9))[_0x83b3('0x44')](handleError(_0x138b55,null));};exports[_0x83b3('0x25')]=function(_0x6c11bd,_0x7cf904){if(_0x6c11bd['body']['id']){delete _0x6c11bd['body']['id'];}return db[_0x83b3('0x2d')][_0x83b3('0x48')]({'where':{'id':_0x6c11bd[_0x83b3('0x45')]['id']}})[_0x83b3('0x26')](handleEntityNotFound(_0x7cf904,null))[_0x83b3('0x26')](saveUpdates(_0x6c11bd[_0x83b3('0x4a')],null))['then'](respondWithResult(_0x7cf904,null))[_0x83b3('0x44')](handleError(_0x7cf904,null));};exports[_0x83b3('0x27')]=function(_0x253938,_0x10e2f5){return db[_0x83b3('0x2d')][_0x83b3('0x48')]({'where':{'id':_0x253938[_0x83b3('0x45')]['id']}})[_0x83b3('0x26')](handleEntityNotFound(_0x10e2f5,null))[_0x83b3('0x26')](removeEntity(_0x10e2f5,null))[_0x83b3('0x44')](handleError(_0x10e2f5,null));};exports['describe']=function(_0x270dc2,_0x83adf9){return db[_0x83b3('0x2d')][_0x83b3('0x4b')]()[_0x83b3('0x26')](respondWithResult(_0x83adf9,null))['catch'](handleError(_0x83adf9,null));}; \ No newline at end of file +var _0x5fb4=['catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5975c5,_0x9c4e02){var _0x45557b=function(_0x5e01a1){while(--_0x5e01a1){_0x5975c5['push'](_0x5975c5['shift']());}};_0x45557b(++_0x9c4e02);}(_0x5fb4,0x183));var _0x45fb=function(_0x25a80f,_0x58a4d5){_0x25a80f=_0x25a80f-0x0;var _0x53af61=_0x5fb4[_0x25a80f];return _0x53af61;};'use strict';var emlformat=require(_0x45fb('0x0'));var rimraf=require(_0x45fb('0x1'));var zipdir=require(_0x45fb('0x2'));var jsonpatch=require(_0x45fb('0x3'));var rp=require(_0x45fb('0x4'));var moment=require(_0x45fb('0x5'));var BPromise=require(_0x45fb('0x6'));var Mustache=require(_0x45fb('0x7'));var util=require(_0x45fb('0x8'));var path=require(_0x45fb('0x9'));var sox=require('sox');var csv=require(_0x45fb('0xa'));var ejs=require(_0x45fb('0xb'));var fs=require('fs');var fs_extra=require(_0x45fb('0xc'));var _=require(_0x45fb('0xd'));var squel=require(_0x45fb('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45fb('0xf'));var toCsv=require(_0x45fb('0xa'));var querystring=require(_0x45fb('0x10'));var Papa=require('papaparse');var Redis=require(_0x45fb('0x11'));var authService=require(_0x45fb('0x12'));var qs=require(_0x45fb('0x13'));var as=require(_0x45fb('0x14'));var hardwareService=require(_0x45fb('0x15'));var logger=require(_0x45fb('0x16'))(_0x45fb('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x45fb('0x18'));var db=require(_0x45fb('0x19'))['db'];function respondWithStatusCode(_0x44755e,_0xf8efc9){_0xf8efc9=_0xf8efc9||0xcc;return function(_0x4bb0d6){if(_0x4bb0d6){return _0x44755e[_0x45fb('0x1a')](_0xf8efc9);}return _0x44755e[_0x45fb('0x1b')](_0xf8efc9)[_0x45fb('0x1c')]();};}function respondWithResult(_0x4f37e3,_0x1c84bc){_0x1c84bc=_0x1c84bc||0xc8;return function(_0x8f7339){if(_0x8f7339){return _0x4f37e3['status'](_0x1c84bc)[_0x45fb('0x1d')](_0x8f7339);}};}function respondWithFilteredResult(_0x5796f9,_0x29b5e7){return function(_0x2b8ad5){if(_0x2b8ad5){var _0x2a38b8=typeof _0x29b5e7[_0x45fb('0x1e')]===_0x45fb('0x1f')&&typeof _0x29b5e7[_0x45fb('0x20')]===_0x45fb('0x1f');var _0x11ed6f=_0x2b8ad5[_0x45fb('0x21')];var _0x369116=_0x2a38b8?0x0:_0x29b5e7[_0x45fb('0x1e')];var _0x36070a=_0x2a38b8?_0x2b8ad5[_0x45fb('0x21')]:_0x29b5e7[_0x45fb('0x1e')]+_0x29b5e7[_0x45fb('0x20')];var _0x3d2520;if(_0x36070a>=_0x11ed6f){_0x36070a=_0x11ed6f;_0x3d2520=0xc8;}else{_0x3d2520=0xce;}_0x5796f9['status'](_0x3d2520);return _0x5796f9[_0x45fb('0x22')]('Content-Range',_0x369116+'-'+_0x36070a+'/'+_0x11ed6f)[_0x45fb('0x1d')](_0x2b8ad5);}return null;};}function patchUpdates(_0x2e73ea){return function(_0x34c17c){try{jsonpatch[_0x45fb('0x23')](_0x34c17c,_0x2e73ea,!![]);}catch(_0x3380f3){return BPromise[_0x45fb('0x24')](_0x3380f3);}return _0x34c17c[_0x45fb('0x25')]();};}function saveUpdates(_0x2b5079,_0x1ea590){return function(_0x6693c5){if(_0x6693c5){return _0x6693c5[_0x45fb('0x26')](_0x2b5079)[_0x45fb('0x27')](function(_0x25bf52){return _0x25bf52;});}return null;};}function removeEntity(_0xaee46,_0x390af9){return function(_0x4f6ce9){if(_0x4f6ce9){return _0x4f6ce9[_0x45fb('0x28')]()['then'](function(){_0xaee46[_0x45fb('0x1b')](0xcc)[_0x45fb('0x1c')]();});}};}function handleEntityNotFound(_0x5ddcbc,_0x31c85b){return function(_0x503230){if(!_0x503230){_0x5ddcbc['sendStatus'](0x194);}return _0x503230;};}function handleError(_0x38bc09,_0x5f588e){_0x5f588e=_0x5f588e||0x1f4;return function(_0x181e59){logger['error'](_0x181e59[_0x45fb('0x29')]);if(_0x181e59[_0x45fb('0x2a')]){delete _0x181e59[_0x45fb('0x2a')];}_0x38bc09['status'](_0x5f588e)[_0x45fb('0x2b')](_0x181e59);};}exports[_0x45fb('0x2c')]=function(_0x583a3b,_0x53a219){var _0x32665e={},_0x25bcf7={},_0x55ea63={'count':0x0,'rows':[]};var _0x233ce0=_[_0x45fb('0x2d')](db[_0x45fb('0x2e')][_0x45fb('0x2f')],function(_0x4f87f8){return{'name':_0x4f87f8['fieldName'],'type':_0x4f87f8[_0x45fb('0x30')]['key']};});_0x25bcf7[_0x45fb('0x31')]=_['map'](_0x233ce0,_0x45fb('0x2a'));_0x25bcf7[_0x45fb('0x32')]=_[_0x45fb('0x33')](_0x583a3b[_0x45fb('0x32')]);_0x25bcf7[_0x45fb('0x34')]=_[_0x45fb('0x35')](_0x25bcf7[_0x45fb('0x31')],_0x25bcf7['query']);_0x32665e[_0x45fb('0x36')]=_[_0x45fb('0x35')](_0x25bcf7[_0x45fb('0x31')],qs[_0x45fb('0x37')](_0x583a3b['query'][_0x45fb('0x37')]));_0x32665e[_0x45fb('0x36')]=_0x32665e['attributes'][_0x45fb('0x38')]?_0x32665e['attributes']:_0x25bcf7['model'];if(!_0x583a3b[_0x45fb('0x32')][_0x45fb('0x39')]('nolimit')){_0x32665e[_0x45fb('0x20')]=qs[_0x45fb('0x20')](_0x583a3b[_0x45fb('0x32')]['limit']);_0x32665e[_0x45fb('0x1e')]=qs[_0x45fb('0x1e')](_0x583a3b[_0x45fb('0x32')][_0x45fb('0x1e')]);}_0x32665e[_0x45fb('0x3a')]=qs[_0x45fb('0x3b')](_0x583a3b[_0x45fb('0x32')][_0x45fb('0x3b')]);_0x32665e['where']=qs['filters'](_[_0x45fb('0x3c')](_0x583a3b['query'],_0x25bcf7[_0x45fb('0x34')]),_0x233ce0);if(_0x583a3b[_0x45fb('0x32')][_0x45fb('0x3d')]){_0x32665e[_0x45fb('0x3e')]=_[_0x45fb('0x3f')](_0x32665e[_0x45fb('0x3e')],{'$or':_[_0x45fb('0x2d')](_0x233ce0,function(_0xcd3b98){if(_0xcd3b98[_0x45fb('0x30')]!==_0x45fb('0x40')){var _0x7acf10={};_0x7acf10[_0xcd3b98[_0x45fb('0x2a')]]={'$like':'%'+_0x583a3b[_0x45fb('0x32')][_0x45fb('0x3d')]+'%'};return _0x7acf10;}})});}_0x32665e=_[_0x45fb('0x3f')]({},_0x32665e,_0x583a3b[_0x45fb('0x41')]);var _0x3fbed2={'where':_0x32665e['where']};return db[_0x45fb('0x2e')][_0x45fb('0x21')](_0x3fbed2)[_0x45fb('0x27')](function(_0x3f7c3f){_0x55ea63[_0x45fb('0x21')]=_0x3f7c3f;if(_0x583a3b[_0x45fb('0x32')][_0x45fb('0x42')]){_0x32665e['include']=[{'all':!![]}];}return db[_0x45fb('0x2e')][_0x45fb('0x43')](_0x32665e);})[_0x45fb('0x27')](function(_0x5e337c){_0x55ea63[_0x45fb('0x44')]=_0x5e337c;return _0x55ea63;})[_0x45fb('0x27')](respondWithFilteredResult(_0x53a219,_0x32665e))[_0x45fb('0x45')](handleError(_0x53a219,null));};exports[_0x45fb('0x46')]=function(_0x14e5fd,_0xee1542){var _0xf07894={'raw':!![],'where':{'id':_0x14e5fd[_0x45fb('0x47')]['id']}},_0x526a5={};_0x526a5['model']=_[_0x45fb('0x33')](db[_0x45fb('0x2e')][_0x45fb('0x2f')]);_0x526a5['query']=_[_0x45fb('0x33')](_0x14e5fd[_0x45fb('0x32')]);_0x526a5[_0x45fb('0x34')]=_[_0x45fb('0x35')](_0x526a5[_0x45fb('0x31')],_0x526a5[_0x45fb('0x32')]);_0xf07894[_0x45fb('0x36')]=_[_0x45fb('0x35')](_0x526a5[_0x45fb('0x31')],qs[_0x45fb('0x37')](_0x14e5fd[_0x45fb('0x32')]['fields']));_0xf07894[_0x45fb('0x36')]=_0xf07894[_0x45fb('0x36')][_0x45fb('0x38')]?_0xf07894[_0x45fb('0x36')]:_0x526a5[_0x45fb('0x31')];if(_0x14e5fd[_0x45fb('0x32')][_0x45fb('0x42')]){_0xf07894['include']=[{'all':!![]}];}_0xf07894=_[_0x45fb('0x3f')]({},_0xf07894,_0x14e5fd[_0x45fb('0x41')]);return db[_0x45fb('0x2e')][_0x45fb('0x48')](_0xf07894)[_0x45fb('0x27')](handleEntityNotFound(_0xee1542,null))[_0x45fb('0x27')](respondWithResult(_0xee1542,null))[_0x45fb('0x45')](handleError(_0xee1542,null));};exports['create']=function(_0x52af13,_0x591512){return db[_0x45fb('0x2e')][_0x45fb('0x49')](_0x52af13['body'],{})[_0x45fb('0x27')](respondWithResult(_0x591512,0xc9))[_0x45fb('0x45')](handleError(_0x591512,null));};exports['update']=function(_0x2e827c,_0x27cace){if(_0x2e827c[_0x45fb('0x4a')]['id']){delete _0x2e827c['body']['id'];}return db['ChatTransferReport'][_0x45fb('0x48')]({'where':{'id':_0x2e827c['params']['id']}})['then'](handleEntityNotFound(_0x27cace,null))[_0x45fb('0x27')](saveUpdates(_0x2e827c[_0x45fb('0x4a')],null))[_0x45fb('0x27')](respondWithResult(_0x27cace,null))[_0x45fb('0x45')](handleError(_0x27cace,null));};exports['destroy']=function(_0x59d158,_0x4a83dc){return db['ChatTransferReport']['find']({'where':{'id':_0x59d158['params']['id']}})[_0x45fb('0x27')](handleEntityNotFound(_0x4a83dc,null))[_0x45fb('0x27')](removeEntity(_0x4a83dc,null))[_0x45fb('0x45')](handleError(_0x4a83dc,null));};exports[_0x45fb('0x4b')]=function(_0x36dafd,_0x3b6120){return db[_0x45fb('0x2e')][_0x45fb('0x4b')]()['then'](respondWithResult(_0x3b6120,null))[_0x45fb('0x45')](handleError(_0x3b6120,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index fd588c3..a015024 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 _0xc447=['../../config/environment','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5cbd8b,_0x2e7a74){var _0xd53d8f=function(_0x2e0eeb){while(--_0x2e0eeb){_0x5cbd8b['push'](_0x5cbd8b['shift']());}};_0xd53d8f(++_0x2e7a74);}(_0xc447,0xa4));var _0x7c44=function(_0x573f8b,_0x34a870){_0x573f8b=_0x573f8b-0x0;var _0x28dd4a=_0xc447[_0x573f8b];return _0x28dd4a;};'use strict';var _=require(_0x7c44('0x0'));var util=require(_0x7c44('0x1'));var logger=require(_0x7c44('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7c44('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c44('0x4'));var rimraf=require(_0x7c44('0x5'));var config=require(_0x7c44('0x6'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x31f922,_0x281fd3){return _0x31f922[_0x7c44('0x7')]('ChatTransferReport',attributes,{'tableName':_0x7c44('0x8'),'paranoid':![],'indexes':[{'name':_0x7c44('0x9'),'fields':[_0x7c44('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6413=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','rimraf','./chatTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6413,0x16e));var _0x3641=function(_0x557d8a,_0x31e3c9){_0x557d8a=_0x557d8a-0x0;var _0x45aedc=_0x6413[_0x557d8a];return _0x45aedc;};'use strict';var _=require(_0x3641('0x0'));var util=require(_0x3641('0x1'));var logger=require('../../config/logger')(_0x3641('0x2'));var moment=require(_0x3641('0x3'));var BPromise=require(_0x3641('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3641('0x5'));var config=require('../../config/environment');var attributes=require(_0x3641('0x6'));module[_0x3641('0x7')]=function(_0x34c1a5,_0xa16735){return _0x34c1a5['define'](_0x3641('0x8'),attributes,{'tableName':_0x3641('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3641('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9c45700..0be5dcd 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 _0xe14f=['../../config/environment','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_0xe14f,0x1db));var _0xfe14=function(_0x22cabc,_0x39776d){_0x22cabc=_0x22cabc-0x0;var _0x28a8dc=_0xe14f[_0x22cabc];return _0x28a8dc;};'use strict';var _=require(_0xfe14('0x0'));var util=require(_0xfe14('0x1'));var moment=require(_0xfe14('0x2'));var BPromise=require(_0xfe14('0x3'));var rs=require(_0xfe14('0x4'));var fs=require('fs');var Redis=require(_0xfe14('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe14('0x6'))(_0xfe14('0x7'));var config=require(_0xfe14('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe14('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45141c,_0x56408b,_0x3a0409){return new BPromise(function(_0x38e52b,_0x3e68c0){return client[_0xfe14('0xa')](_0x45141c,_0x3a0409)['then'](function(_0x5a3c48){logger[_0xfe14('0xb')](_0xfe14('0xc'),_0x56408b,_0xfe14('0xd'));logger[_0xfe14('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x56408b,_0xfe14('0xd'),JSON[_0xfe14('0xf')](_0x5a3c48));if(_0x5a3c48[_0xfe14('0x10')]){if(_0x5a3c48[_0xfe14('0x10')][_0xfe14('0x11')]===0x1f4){logger['error'](_0xfe14('0xc'),_0x56408b,_0x5a3c48['error'][_0xfe14('0x12')]);return _0x3e68c0(_0x5a3c48[_0xfe14('0x10')][_0xfe14('0x12')]);}logger[_0xfe14('0x10')](_0xfe14('0xc'),_0x56408b,_0x5a3c48[_0xfe14('0x10')][_0xfe14('0x12')]);return _0x38e52b(_0x5a3c48[_0xfe14('0x10')][_0xfe14('0x12')]);}else{logger['info'](_0xfe14('0xc'),_0x56408b,_0xfe14('0xd'));_0x38e52b(_0x5a3c48[_0xfe14('0x13')][_0xfe14('0x12')]);}})[_0xfe14('0x14')](function(_0x41c9ab){logger['error'](_0xfe14('0xc'),_0x56408b,_0x41c9ab);_0x3e68c0(_0x41c9ab);});});} \ No newline at end of file +var _0x273c=['info','result','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f8574,_0x296b37){var _0x1bda79=function(_0x578bec){while(--_0x578bec){_0x1f8574['push'](_0x1f8574['shift']());}};_0x1bda79(++_0x296b37);}(_0x273c,0x13d));var _0xc273=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0x273c[_0xcd26a9];return _0x3afcbc;};'use strict';var _=require('lodash');var util=require(_0xc273('0x0'));var moment=require(_0xc273('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc273('0x2'))['db'];var utils=require(_0xc273('0x3'));var logger=require(_0xc273('0x4'))(_0xc273('0x5'));var config=require(_0xc273('0x6'));var jayson=require(_0xc273('0x7'));var client=jayson[_0xc273('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f978d,_0x364bfb,_0x24cc51){return new BPromise(function(_0xed9497,_0x4405e0){return client[_0xc273('0x9')](_0x2f978d,_0x24cc51)[_0xc273('0xa')](function(_0x29a6e4){logger['info'](_0xc273('0xb'),_0x364bfb,_0xc273('0xc'));logger[_0xc273('0xd')](_0xc273('0xe'),_0x364bfb,'request\x20sent',JSON[_0xc273('0xf')](_0x29a6e4));if(_0x29a6e4[_0xc273('0x10')]){if(_0x29a6e4['error'][_0xc273('0x11')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x364bfb,_0x29a6e4[_0xc273('0x10')][_0xc273('0x12')]);return _0x4405e0(_0x29a6e4[_0xc273('0x10')][_0xc273('0x12')]);}logger['error'](_0xc273('0xb'),_0x364bfb,_0x29a6e4[_0xc273('0x10')][_0xc273('0x12')]);return _0xed9497(_0x29a6e4[_0xc273('0x10')][_0xc273('0x12')]);}else{logger[_0xc273('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x364bfb,_0xc273('0xc'));_0xed9497(_0x29a6e4[_0xc273('0x14')][_0xc273('0x12')]);}})['catch'](function(_0x1e2774){logger['error'](_0xc273('0xb'),_0x364bfb,_0x1e2774);_0x4405e0(_0x1e2774);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3e608ad..9e38e7c 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 _0xcbaf=['index','/describe','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x507892,_0x54710d){var _0x2fed57=function(_0x2ed4f0){while(--_0x2ed4f0){_0x507892['push'](_0x507892['shift']());}};_0x2fed57(++_0x54710d);}(_0xcbaf,0x171));var _0xfcba=function(_0x1cab98,_0x1bd8a6){_0x1cab98=_0x1cab98-0x0;var _0x3bef4b=_0xcbaf[_0x1cab98];return _0x3bef4b;};'use strict';var multer=require('multer');var util=require(_0xfcba('0x0'));var path=require(_0xfcba('0x1'));var timeout=require(_0xfcba('0x2'));var express=require(_0xfcba('0x3'));var router=express[_0xfcba('0x4')]();var fs_extra=require(_0xfcba('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfcba('0x6'));var controller=require('./chatTransferReport.controller');router[_0xfcba('0x7')]('/',auth[_0xfcba('0x8')](),controller[_0xfcba('0x9')]);router[_0xfcba('0x7')](_0xfcba('0xa'),auth['isAuthenticated'](),controller[_0xfcba('0xb')]);router[_0xfcba('0x7')]('/:id',auth[_0xfcba('0x8')](),controller['show']);router['post']('/',auth[_0xfcba('0x8')](),controller[_0xfcba('0xc')]);router[_0xfcba('0xd')](_0xfcba('0xe'),auth[_0xfcba('0x8')](),controller[_0xfcba('0xf')]);router[_0xfcba('0x10')]('/:id',auth[_0xfcba('0x8')](),controller['destroy']);module[_0xfcba('0x11')]=router; \ No newline at end of file +var _0x236f=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x236f,0xa5));var _0xf236=function(_0x39a30d,_0x4a6423){_0x39a30d=_0x39a30d-0x0;var _0x195697=_0x236f[_0x39a30d];return _0x195697;};'use strict';var multer=require(_0xf236('0x0'));var util=require(_0xf236('0x1'));var path=require(_0xf236('0x2'));var timeout=require(_0xf236('0x3'));var express=require(_0xf236('0x4'));var router=express[_0xf236('0x5')]();var fs_extra=require(_0xf236('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf236('0x7'));var controller=require('./chatTransferReport.controller');router[_0xf236('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf236('0x8')](_0xf236('0x9'),auth[_0xf236('0xa')](),controller[_0xf236('0xb')]);router[_0xf236('0x8')]('/:id',auth[_0xf236('0xa')](),controller[_0xf236('0xc')]);router[_0xf236('0xd')]('/',auth[_0xf236('0xa')](),controller[_0xf236('0xe')]);router[_0xf236('0xf')](_0xf236('0x10'),auth[_0xf236('0xa')](),controller['update']);router[_0xf236('0x11')](_0xf236('0x10'),auth['isAuthenticated'](),controller[_0xf236('0x12')]);module[_0xf236('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 970cb48..e2e86d4 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 _0x00b4=['Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','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','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Feedback','thumb','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x00b4,0x76));var _0x400b=function(_0x28db96,_0x1bdda9){_0x28db96=_0x28db96-0x0;var _0x51acc6=_0x00b4[_0x28db96];return _0x51acc6;};'use strict';var Sequelize=require(_0x400b('0x0'));var rs=require('randomstring');module[_0x400b('0x1')]={'name':{'type':Sequelize[_0x400b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'unique':_0x400b('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x4')},'mapKeyOffline':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x4')},'key':{'type':Sequelize[_0x400b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x400b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'defaultValue':_0x400b('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'defaultValue':_0x400b('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x400b('0x2')]},'animation':{'type':Sequelize[_0x400b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x400b('0x9')]('rounded','squared'),'defaultValue':_0x400b('0xa')},'header_online':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0xb')},'offline_chat_button':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0xd')},'download_transcript':{'type':Sequelize[_0x400b('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x400b('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x13')},'ratingType':{'type':Sequelize[_0x400b('0x9')]('star',_0x400b('0x14')),'defaultValue':_0x400b('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x400b('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x400b('0x16')],'defaultValue':function(){return JSON[_0x400b('0x17')]({'items':[{'type':_0x400b('0x18'),'variable':null,'config':{'placeholder':_0x400b('0x19'),'type':_0x400b('0x1a'),'required':!![]},'props':{'title':_0x400b('0x19'),'helpText':''}},{'type':_0x400b('0x18'),'props':{'title':_0x400b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x400b('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x400b('0x1b')](_0x400b('0x1c'))?JSON[_0x400b('0x1d')](this['getDataValue'](_0x400b('0x1c'))):{};},'set':function(_0x395325){return this[_0x400b('0x1e')]('onlineForm',JSON['stringify'](_0x395325));}},'offlineForm':{'type':Sequelize[_0x400b('0x16')],'defaultValue':function(){return JSON[_0x400b('0x17')]({'items':[{'type':_0x400b('0x18'),'props':{'title':_0x400b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x400b('0x4'),'type':_0x400b('0x4')},'variable':null},{'type':_0x400b('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x400b('0x20'),'helpText':_0x400b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x400b('0x1b')](_0x400b('0x22'))?JSON['parse'](this[_0x400b('0x1b')](_0x400b('0x22'))):{};},'set':function(_0x43963e){return this[_0x400b('0x1e')](_0x400b('0x22'),JSON[_0x400b('0x17')](_0x43963e));}},'token':{'type':Sequelize[_0x400b('0x2')],'defaultValue':function(){return rs[_0x400b('0x23')]();}},'autoclose':{'type':Sequelize[_0x400b('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x400b('0x2')]},'forwardOffline':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x400b('0x2')]},'waitingTitle':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x24')},'waitingMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x400b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x27')},'sendUnmanaged':{'type':Sequelize[_0x400b('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x400b('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x400b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x400b('0x16')],'defaultValue':function(){return _0x400b('0x28');}},'notificationSound':{'type':Sequelize[_0x400b('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x400b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x2a')},'verticalAlignment':{'type':Sequelize[_0x400b('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x2b')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x400b('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x400b('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x400b('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'defaultValue':_0x400b('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x400b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x400b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x400b('0x2')],'defaultValue':_0x400b('0x2e')},'systemAvatar':{'type':Sequelize[_0x400b('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x400b('0xe')],'comment':_0x400b('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x400b('0x8')],'defaultValue':![],'comment':_0x400b('0x30'),'set':function(_0x43df8a){if(!_0x43df8a)this['setDataValue'](_0x400b('0x31'),null);this['setDataValue'](_0x400b('0x32'),_0x43df8a);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x400b('0x2')]},'vidaooTopic':{'type':Sequelize[_0x400b('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x400b('0x2')],'defaultValue':function(){return _0x400b('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x400b('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f29=['BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input','name','text','onlineForm','getDataValue','stringify','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','email','Agent','#ffffff','INTEGER'];(function(_0x56f9eb,_0x2dd069){var _0x376d41=function(_0xd29db6){while(--_0xd29db6){_0x56f9eb['push'](_0x56f9eb['shift']());}};_0x376d41(++_0x2dd069);}(_0x6f29,0x1f2));var _0x96f2=function(_0x44bcb6,_0x16e9a3){_0x44bcb6=_0x44bcb6-0x0;var _0x49ac0f=_0x6f29[_0x44bcb6];return _0x49ac0f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x96f2('0x0'));module[_0x96f2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x96f2('0x2')},'description':{'type':Sequelize[_0x96f2('0x3')]},'mapKey':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0x4')},'key':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x5')},'customerAlias':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![],'defaultValue':_0x96f2('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![],'defaultValue':_0x96f2('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x96f2('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x96f2('0x3')]},'animation':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x96f2('0x9'),_0x96f2('0xa')),'defaultValue':_0x96f2('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0xb')},'start_chat_button':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0xc')},'offline_chat_button':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0xd')},'header_offline':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0xe')},'download_transcript':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x96f2('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x96f2('0xf')]},'closingQuestion':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0x11')},'noteTitle':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0x12')},'closingMessage':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0xd')},'skipMessageButton':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x14')},'conditionAgreement':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0x15')},'ratingType':{'type':Sequelize[_0x96f2('0x16')](_0x96f2('0x17'),_0x96f2('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x96f2('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x96f2('0x19'),'variable':null,'config':{'placeholder':_0x96f2('0x1a'),'type':_0x96f2('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x96f2('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x96f2('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x96f2('0x1c'))?JSON['parse'](this[_0x96f2('0x1d')]('onlineForm')):{};},'set':function(_0x59598d){return this['setDataValue'](_0x96f2('0x1c'),JSON[_0x96f2('0x1e')](_0x59598d));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x96f2('0x1e')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x96f2('0x4'),'type':_0x96f2('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x96f2('0x1d')](_0x96f2('0x1f'))?JSON['parse'](this['getDataValue'](_0x96f2('0x1f'))):{};},'set':function(_0x52601c){return this['setDataValue'](_0x96f2('0x1f'),JSON[_0x96f2('0x1e')](_0x52601c));}},'token':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':function(){return rs[_0x96f2('0x20')]();}},'autoclose':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x96f2('0x3')]},'forwardOffline':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x21')},'waitingMessage':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x22')},'offlineMessageBody':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x96f2('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x24')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x96f2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x96f2('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':_0x96f2('0x25')},'messagesAlignment':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x96f2('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x96f2('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![],'defaultValue':_0x96f2('0x26'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x96f2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x96f2('0x27')},'systemAvatar':{'type':Sequelize[_0x96f2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x96f2('0x7')],'comment':_0x96f2('0x28')},'mandatoryDisposition':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![],'comment':_0x96f2('0x29'),'set':function(_0x275e5f){if(!_0x275e5f)this['setDataValue'](_0x96f2('0x2a'),null);this['setDataValue'](_0x96f2('0x2b'),_0x275e5f);}},'vidaooEscalation':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x96f2('0x3')]},'vidaooTopic':{'type':Sequelize[_0x96f2('0x3')],'allowNull':![],'defaultValue':_0x96f2('0x2c')},'vidaooNote':{'type':Sequelize[_0x96f2('0x3')],'defaultValue':function(){return _0x96f2('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x96f2('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x96f2('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x96f2('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7d6be0e..b67a9f2 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 _0x2d99=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','setUA','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','model','device','vendor','%s\x20%s\x20%s','type','mandatoryDispositionPause','ChatWebsite','rawAttributes','key','map','query','keys','filters','intersection','attributes','fields','length','sort','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','params','create','testWildcardValidity','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','order','pick','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','systemAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','mapKey','isEmpty','CmContact','createdAt','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','Applications','priority','list','contact','headers','threadId','closed','ChatInteraction','customerIp','Writing\x20on\x20closed\x20interaction','ContactId','interaction','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','ChatQueue','queueId','waitForTheAssignedQueue','Start','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','fromString','mimetype','server','files','attachments','sequelize','transaction','Attachment','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','originalname','subjectOffline','mapValues','lastName','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','testWebsiteWithWildcard','remote','remoteAddress','replace','textColor','textButtonColor','color_button','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x2d99,0x11b));var _0x92d9=function(_0x2d08c6,_0x3347ee){_0x2d08c6=_0x2d08c6-0x0;var _0x47f4ed=_0x2d99[_0x2d08c6];return _0x47f4ed;};'use strict';var Mustache=require(_0x92d9('0x0'));var util=require(_0x92d9('0x1'));var path=require(_0x92d9('0x2'));var ejs=require(_0x92d9('0x3'));var fs=require('fs');var fs_extra=require(_0x92d9('0x4'));var _=require('lodash');var querystring=require(_0x92d9('0x5'));var htmlToText=require(_0x92d9('0x6'));var Redis=require(_0x92d9('0x7'));var jayson=require(_0x92d9('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x92d9('0x9'))(_0x92d9('0xa'));var config=require('../../config/environment');var APIBadRequestError=require(_0x92d9('0xb'))[_0x92d9('0xc')];var APINotFoundError=require(_0x92d9('0xb'))[_0x92d9('0xd')];var APIOutOfIntervalError=require(_0x92d9('0xb'))[_0x92d9('0xe')];var APIHandleError=require(_0x92d9('0xb'))['handleError'];var APIConflictError=require(_0x92d9('0xb'))[_0x92d9('0xf')];var wildcardUtils=require(_0x92d9('0x10'));var URL=require(_0x92d9('0x11'))[_0x92d9('0x12')];var db=require(_0x92d9('0x13'))['db'];config[_0x92d9('0x14')]=_[_0x92d9('0x15')](config[_0x92d9('0x14')],{'host':_0x92d9('0x16'),'port':0x18eb});var socket=require(_0x92d9('0x17'))(new Redis(config[_0x92d9('0x14')]));require(_0x92d9('0x18'))['register'](socket);var client=jayson[_0x92d9('0x19')][_0x92d9('0x1a')]({'port':0x232c});var client9002=jayson[_0x92d9('0x19')][_0x92d9('0x1a')]({'port':0x232a});var client9003=jayson[_0x92d9('0x19')]['http']({'port':0x232b});var client9001=jayson[_0x92d9('0x19')][_0x92d9('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x1e4b47,_0xa0ebf5,_0x598a9a,_0x58dca1){return new Promise(function(_0x348d3c,_0x33d856){var _0x3b33cc=_0x58dca1||client;return _0x3b33cc[_0x92d9('0x1b')](_0x1e4b47,_0x598a9a)[_0x92d9('0x1c')](function(_0xd83e4c){logger['info'](_0x92d9('0x1d'),_0xa0ebf5,_0x92d9('0x1e'));logger['debug'](_0x92d9('0x1f'),_0xa0ebf5,_0x92d9('0x1e'),JSON[_0x92d9('0x20')](_0xd83e4c));if(_0xd83e4c['error']){if(_0xd83e4c['error'][_0x92d9('0x21')]===0x1f4){logger['error'](_0x92d9('0x1d'),_0xa0ebf5,_0xd83e4c['error'][_0x92d9('0x22')]);return _0x33d856(_0xd83e4c['error']['message']);}logger[_0x92d9('0x23')](_0x92d9('0x1d'),_0xa0ebf5,_0xd83e4c[_0x92d9('0x23')][_0x92d9('0x22')]);return _0x348d3c(_0xd83e4c[_0x92d9('0x23')][_0x92d9('0x22')]);}else{logger[_0x92d9('0x24')](_0x92d9('0x1d'),_0xa0ebf5,_0x92d9('0x1e'));_0x348d3c(_0xd83e4c[_0x92d9('0x25')][_0x92d9('0x22')]);}})[_0x92d9('0x26')](function(_0x478f9f){logger[_0x92d9('0x23')]('ChatWebsite,\x20%s,\x20%s',_0xa0ebf5,_0x478f9f);_0x33d856(_0x478f9f);});});}function respondWithStatusCode(_0x3b3bea,_0x19eff1){_0x19eff1=_0x19eff1||0xcc;return function(_0x363266){if(_0x363266){return _0x3b3bea[_0x92d9('0x27')](_0x19eff1);}return _0x3b3bea[_0x92d9('0x28')](_0x19eff1)[_0x92d9('0x29')]();};}function respondWithResult(_0x29e211,_0xd1d160){_0xd1d160=_0xd1d160||0xc8;return function(_0x17fb89){if(_0x17fb89){return _0x29e211['status'](_0xd1d160)[_0x92d9('0x2a')](_0x17fb89);}};}function respondWithFilteredResult(_0x524db5,_0x54f4f2){return function(_0x365536){if(_0x365536){var _0x546b85=typeof _0x54f4f2[_0x92d9('0x2b')]===_0x92d9('0x2c')&&typeof _0x54f4f2['limit']===_0x92d9('0x2c');var _0x367b90=_0x365536['count'];var _0x3e4fba=_0x546b85?0x0:_0x54f4f2[_0x92d9('0x2b')];var _0x1626c4=_0x546b85?_0x365536['count']:_0x54f4f2[_0x92d9('0x2b')]+_0x54f4f2[_0x92d9('0x2d')];var _0x41f288;if(_0x1626c4>=_0x367b90){_0x1626c4=_0x367b90;_0x41f288=0xc8;}else{_0x41f288=0xce;}_0x524db5[_0x92d9('0x28')](_0x41f288);return _0x524db5[_0x92d9('0x2e')](_0x92d9('0x2f'),_0x3e4fba+'-'+_0x1626c4+'/'+_0x367b90)[_0x92d9('0x2a')](_0x365536);}return null;};}function saveUpdates(_0x22ba32){return function(_0x3cbcc0){if(_0x3cbcc0){return _0x3cbcc0[_0x92d9('0x30')](_0x22ba32)['then'](function(_0x218168){return _0x218168;});}return null;};}function removeEntity(_0x16f2a0){return function(_0x44a777){if(_0x44a777){return _0x44a777[_0x92d9('0x31')]()[_0x92d9('0x1c')](function(){var _0x365afb=_0x44a777[_0x92d9('0x32')]({'plain':!![]});var _0x541631=_0x92d9('0x33');return db[_0x92d9('0x34')][_0x92d9('0x31')]({'where':{'type':_0x541631,'resourceId':_0x365afb['id']}})[_0x92d9('0x1c')](function(){return _0x44a777;});})['then'](function(){_0x16f2a0[_0x92d9('0x28')](0xcc)[_0x92d9('0x29')]();});}};}function handleEntityNotFound(_0x2f5ad5){return function(_0x38afaf){if(!_0x38afaf){_0x2f5ad5[_0x92d9('0x27')](0x194);}return _0x38afaf;};}function handleError(_0x372d0f,_0x38f62d){_0x38f62d=_0x38f62d||0x1f4;return function(_0x49e935){logger[_0x92d9('0x23')](_0x49e935[_0x92d9('0x35')]);if(_0x49e935['name']){delete _0x49e935[_0x92d9('0x36')];}_0x372d0f[_0x92d9('0x28')](_0x38f62d)[_0x92d9('0x37')](_0x49e935);};}function createInteractionObject(_0x3937ca,_0x24096d,_0x5d7ebf,_0x50ae13){var _0x3f4443=require(_0x92d9('0x38'));var _0xd3429c=new _0x3f4443();var _0x3acbe3=_0xd3429c[_0x92d9('0x39')](_0x5d7ebf['user-agent'])['getResult']();var _0x20f575=_0x24096d['customerIp'];if(_0x5d7ebf[_0x92d9('0x3a')]){_0x20f575=_0x5d7ebf['cf-connecting-ip'];}else if(_0x5d7ebf[_0x92d9('0x3b')]){_0x20f575=_[_0x92d9('0x3c')](_0x5d7ebf[_0x92d9('0x3b')][_0x92d9('0x3d')](','));}return{'ContactId':_0x50ae13['id'],'ChatWebsiteId':_0x3937ca,'from':(_0x50ae13[_0x92d9('0x3e')]||'')+'\x20'+(_0x50ae13['lastName']||''),'customerIp':_0x20f575,'customerPort':_0x5d7ebf['x-real-port']?_0x5d7ebf[_0x92d9('0x3f')]:null,'referer':_0x24096d[_0x92d9('0x40')],'browserName':_0x3acbe3['browser'][_0x92d9('0x36')]&&_0x3acbe3[_0x92d9('0x41')][_0x92d9('0x42')]?util[_0x92d9('0x43')](_0x92d9('0x44'),_0x3acbe3['browser']['name'],_0x3acbe3[_0x92d9('0x41')][_0x92d9('0x42')]):'unknown','browserVersion':_0x3acbe3['browser'][_0x92d9('0x42')]||'unknown','osName':util[_0x92d9('0x43')](_0x92d9('0x44'),_0x3acbe3['os'][_0x92d9('0x36')],_0x3acbe3['os'][_0x92d9('0x42')]),'osVersion':_0x3acbe3['os'][_0x92d9('0x42')],'deviceModel':_0x3acbe3['device'][_0x92d9('0x45')]&&_0x3acbe3[_0x92d9('0x46')][_0x92d9('0x47')]?util[_0x92d9('0x43')](_0x92d9('0x48'),_0x3acbe3[_0x92d9('0x46')][_0x92d9('0x45')],_0x3acbe3[_0x92d9('0x46')][_0x92d9('0x47')],_0x3acbe3['device']['type']):null,'deviceVendor':_0x3acbe3[_0x92d9('0x46')]['vendor'],'deviceType':_0x3acbe3[_0x92d9('0x46')][_0x92d9('0x49')],'formData':JSON[_0x92d9('0x20')](_0x24096d)};}exports['index']=function(_0x2fe93f,_0x2ccae3){var _0x499dd0={'include':[{'model':db['Pause'],'as':_0x92d9('0x4a')}]},_0x468473={},_0x58eab7={'count':0x0,'rows':[]};var _0x106fed=_['map'](db[_0x92d9('0x4b')][_0x92d9('0x4c')],function(_0x40e019){return{'name':_0x40e019['fieldName'],'type':_0x40e019[_0x92d9('0x49')][_0x92d9('0x4d')]};});_0x468473[_0x92d9('0x45')]=_[_0x92d9('0x4e')](_0x106fed,_0x92d9('0x36'));_0x468473[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0x2fe93f[_0x92d9('0x4f')]);_0x468473[_0x92d9('0x51')]=_[_0x92d9('0x52')](_0x468473['model'],_0x468473[_0x92d9('0x4f')]);_0x499dd0[_0x92d9('0x53')]=_['intersection'](_0x468473['model'],qs['fields'](_0x2fe93f[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x499dd0['attributes']=_0x499dd0[_0x92d9('0x53')][_0x92d9('0x55')]?_0x499dd0['attributes']:_0x468473[_0x92d9('0x45')];if(!_0x2fe93f[_0x92d9('0x4f')]['hasOwnProperty']('nolimit')){_0x499dd0['limit']=qs[_0x92d9('0x2d')](_0x2fe93f['query'][_0x92d9('0x2d')]);_0x499dd0[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0x2fe93f['query'][_0x92d9('0x2b')]);}_0x499dd0['order']=qs[_0x92d9('0x56')](_0x2fe93f[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x499dd0[_0x92d9('0x57')]=qs['filters'](_['pick'](_0x2fe93f[_0x92d9('0x4f')],_0x468473[_0x92d9('0x51')]),_0x106fed);if(_0x2fe93f[_0x92d9('0x4f')]['filter']){_0x499dd0[_0x92d9('0x57')]=_['merge'](_0x499dd0[_0x92d9('0x57')],{'$or':_[_0x92d9('0x4e')](_0x106fed,function(_0x569449){if(_0x569449[_0x92d9('0x49')]!==_0x92d9('0x58')){var _0x22f675={};_0x22f675[_0x569449['name']]={'$like':'%'+_0x2fe93f['query'][_0x92d9('0x59')]+'%'};return _0x22f675;}})});}_0x499dd0=_[_0x92d9('0x5a')]({},_0x499dd0,_0x2fe93f[_0x92d9('0x5b')]);var _0x552588={'where':_0x499dd0['where']};return db[_0x92d9('0x4b')]['count'](_0x552588)[_0x92d9('0x1c')](function(_0x558775){_0x58eab7[_0x92d9('0x5c')]=_0x558775;if(_0x2fe93f[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x499dd0[_0x92d9('0x5e')]=[{'all':!![]}];}return db[_0x92d9('0x4b')][_0x92d9('0x5f')](_0x499dd0);})['then'](function(_0x549f38){_0x58eab7[_0x92d9('0x60')]=_0x549f38;return _0x58eab7;})[_0x92d9('0x1c')](respondWithFilteredResult(_0x2ccae3,_0x499dd0))[_0x92d9('0x26')](handleError(_0x2ccae3,null));};exports[_0x92d9('0x61')]=function(_0x4d6e10,_0x439acc){var _0x43e62d={'raw':![],'where':{'id':_0x4d6e10[_0x92d9('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x44bc2b={};_0x44bc2b[_0x92d9('0x45')]=_['keys'](db['ChatWebsite'][_0x92d9('0x4c')]);_0x44bc2b[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0x4d6e10[_0x92d9('0x4f')]);_0x44bc2b[_0x92d9('0x51')]=_['intersection'](_0x44bc2b[_0x92d9('0x45')],_0x44bc2b['query']);_0x43e62d['attributes']=_[_0x92d9('0x52')](_0x44bc2b[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0x4d6e10['query'][_0x92d9('0x54')]));_0x43e62d[_0x92d9('0x53')]=_0x43e62d['attributes'][_0x92d9('0x55')]?_0x43e62d['attributes']:_0x44bc2b['model'];if(_0x4d6e10[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x43e62d[_0x92d9('0x5e')]=[{'all':!![]}];}_0x43e62d=_[_0x92d9('0x5a')]({},_0x43e62d,_0x4d6e10[_0x92d9('0x5b')]);return db[_0x92d9('0x4b')]['find'](_0x43e62d)[_0x92d9('0x1c')](handleEntityNotFound(_0x439acc,null))[_0x92d9('0x1c')](respondWithResult(_0x439acc,null))[_0x92d9('0x26')](handleError(_0x439acc,null));};exports[_0x92d9('0x63')]=function(_0xabc1ef,_0x596d48){if(!wildcardUtils[_0x92d9('0x64')](_0xabc1ef[_0x92d9('0x65')][_0x92d9('0x66')])){return handleError(_0x596d48,null)(new APIBadRequestError('\x22'+_0xabc1ef['body'][_0x92d9('0x66')]+_0x92d9('0x67')));}return db[_0x92d9('0x4b')][_0x92d9('0x63')](_0xabc1ef['body'],{})[_0x92d9('0x1c')](function(_0x351acb){var _0x48861d=_0xabc1ef[_0x92d9('0x68')][_0x92d9('0x32')]({'plain':!![]});if(!_0x48861d)throw new Error(_0x92d9('0x69'));if(_0x48861d[_0x92d9('0x6a')]===_0x92d9('0x68')){var _0x445de4=_0x351acb[_0x92d9('0x32')]({'plain':!![]});var _0x276439=_0x92d9('0x33');return db[_0x92d9('0x6b')]['find']({'where':{'name':_0x276439,'userProfileId':_0x48861d[_0x92d9('0x6c')]},'raw':!![]})[_0x92d9('0x1c')](function(_0x134f9e){if(_0x134f9e&&_0x134f9e['autoAssociation']===0x0){return db[_0x92d9('0x34')]['create']({'name':_0x445de4[_0x92d9('0x36')],'resourceId':_0x445de4['id'],'type':_0x134f9e[_0x92d9('0x36')],'sectionId':_0x134f9e['id']},{})['then'](function(){return _0x351acb;});}else{return _0x351acb;}})[_0x92d9('0x26')](function(_0x15f25b){logger['error'](_0x92d9('0x6d'),_0x15f25b);throw _0x15f25b;});}return _0x351acb;})[_0x92d9('0x1c')](respondWithResult(_0x596d48,0xc9))['catch'](handleError(_0x596d48,null));};exports[_0x92d9('0x30')]=function(_0x222812,_0x4b2047){if(!wildcardUtils[_0x92d9('0x64')](_0x222812[_0x92d9('0x65')]['address'])){return handleError(_0x4b2047,null)(new APIBadRequestError('\x22'+_0x222812['body'][_0x92d9('0x66')]+_0x92d9('0x67')));}if(_0x222812['body']['id']){delete _0x222812['body']['id'];}return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x222812[_0x92d9('0x62')]['id']},'include':[{'model':db[_0x92d9('0x6f')],'as':_0x92d9('0x4a')}]})[_0x92d9('0x1c')](handleEntityNotFound(_0x4b2047,null))[_0x92d9('0x1c')](saveUpdates(_0x222812[_0x92d9('0x65')],null))['then'](respondWithResult(_0x4b2047,null))[_0x92d9('0x26')](handleError(_0x4b2047,null));};exports[_0x92d9('0x31')]=function(_0x50c9d6,_0x4c23bb){return db[_0x92d9('0x4b')]['find']({'where':{'id':_0x50c9d6['params']['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x4c23bb,null))[_0x92d9('0x1c')](removeEntity(_0x4c23bb,null))[_0x92d9('0x26')](handleError(_0x4c23bb,null));};exports[_0x92d9('0x70')]=function(_0x22ddaa,_0xf2c9e3){return db[_0x92d9('0x4b')][_0x92d9('0x70')]()['then'](respondWithResult(_0xf2c9e3,null))['catch'](handleError(_0xf2c9e3,null));};exports[_0x92d9('0x71')]=function(_0x1dd740,_0x48b1b1){if(_0x1dd740['body']['id']){delete _0x1dd740[_0x92d9('0x65')]['id'];}return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x1dd740[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x48b1b1,null))[_0x92d9('0x1c')](function(_0x11dad1){if(_0x11dad1){_0x1dd740[_0x92d9('0x65')][_0x92d9('0x72')]=_0x11dad1['id'];return db[_0x92d9('0x73')][_0x92d9('0x63')](_0x1dd740[_0x92d9('0x65')]);}})[_0x92d9('0x1c')](respondWithResult(_0x48b1b1,null))[_0x92d9('0x26')](handleError(_0x48b1b1,null));};exports[_0x92d9('0x74')]=function(_0x44b69a,_0x3982d6){var _0x2bd543={'raw':![],'where':{}};var _0x5efd61={};var _0xdc58ef={'count':0x0,'rows':[]};return db[_0x92d9('0x4b')][_0x92d9('0x75')]({'where':{'id':_0x44b69a['params']['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x3982d6,null))[_0x92d9('0x1c')](function(_0x142861){if(_0x142861){_0x5efd61[_0x92d9('0x45')]=_[_0x92d9('0x50')](db[_0x92d9('0x73')][_0x92d9('0x4c')]);_0x5efd61['query']=_[_0x92d9('0x50')](_0x44b69a[_0x92d9('0x4f')]);_0x5efd61[_0x92d9('0x51')]=_['intersection'](_0x5efd61[_0x92d9('0x45')],_0x5efd61['query']);_0x2bd543[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x5efd61[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0x44b69a['query'][_0x92d9('0x54')]));_0x2bd543[_0x92d9('0x53')]=_0x2bd543[_0x92d9('0x53')][_0x92d9('0x55')]?_0x2bd543['attributes']:_0x5efd61['model'];if(!_0x44b69a[_0x92d9('0x4f')][_0x92d9('0x76')](_0x92d9('0x77'))){_0x2bd543['limit']=qs[_0x92d9('0x2d')](_0x44b69a[_0x92d9('0x4f')][_0x92d9('0x2d')]);_0x2bd543[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0x44b69a[_0x92d9('0x4f')][_0x92d9('0x2b')]);}_0x2bd543['order']=qs['sort'](_0x44b69a[_0x92d9('0x4f')]['sort']);_0x2bd543['where']=qs[_0x92d9('0x51')](_['pick'](_0x44b69a[_0x92d9('0x4f')],_0x5efd61[_0x92d9('0x51')]));_0x2bd543['where'][_0x92d9('0x72')]=_0x142861['id'];if(_0x44b69a['query'][_0x92d9('0x59')]){_0x2bd543['where']=_[_0x92d9('0x5a')](_0x2bd543['where'],{'$or':_[_0x92d9('0x4e')](_0x2bd543['attributes'],function(_0x192cbb){var _0x1470ba={};_0x1470ba[_0x192cbb]={'$like':'%'+_0x44b69a['query']['filter']+'%'};return _0x1470ba;})});}_0x2bd543=_[_0x92d9('0x5a')]({},_0x2bd543,_0x44b69a[_0x92d9('0x5b')]);return db[_0x92d9('0x73')]['count']({'where':_0x2bd543[_0x92d9('0x57')]})[_0x92d9('0x1c')](function(_0x5248c5){_0xdc58ef[_0x92d9('0x5c')]=_0x5248c5;if(_0x44b69a[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x2bd543['include']=[{'all':!![]}];}return db[_0x92d9('0x73')]['findAll'](_0x2bd543);})['then'](function(_0x5eaf47){_0xdc58ef[_0x92d9('0x60')]=_0x5eaf47;return _0xdc58ef;});}})[_0x92d9('0x1c')](respondWithFilteredResult(_0x3982d6,_0x2bd543))['catch'](handleError(_0x3982d6,null));};exports[_0x92d9('0x78')]=function(_0x22b173,_0x21a274){return db[_0x92d9('0x4b')]['find']({'where':{'id':_0x22b173[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x21a274,null))['then'](function(_0x5135a9){if(_0x5135a9){return _0x5135a9[_0x92d9('0x78')](_0x22b173[_0x92d9('0x4f')][_0x92d9('0x79')]);}})[_0x92d9('0x1c')](respondWithStatusCode(_0x21a274,null))['catch'](handleError(_0x21a274,null));};exports[_0x92d9('0x7a')]=function(_0x10a2e5,_0x57c17e){if(_0x10a2e5[_0x92d9('0x65')]['id']){delete _0x10a2e5[_0x92d9('0x65')]['id'];}return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x10a2e5[_0x92d9('0x62')]['id']}})['then'](handleEntityNotFound(_0x57c17e,null))[_0x92d9('0x1c')](function(_0x13c854){if(_0x13c854){_0x10a2e5[_0x92d9('0x65')][_0x92d9('0x72')]=_0x13c854['id'];return db[_0x92d9('0x7b')]['create'](_0x10a2e5[_0x92d9('0x65')]);}})[_0x92d9('0x1c')](respondWithResult(_0x57c17e,null))[_0x92d9('0x26')](handleError(_0x57c17e,null));};exports['getAnswers']=function(_0xd74615,_0x2b52b7){var _0x11d419={'raw':![],'where':{}};var _0x39a038={};var _0xdd8102={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x92d9('0x75')]({'where':{'id':_0xd74615[_0x92d9('0x62')]['id']}})['then'](handleEntityNotFound(_0x2b52b7,null))[_0x92d9('0x1c')](function(_0x5ef5a6){if(_0x5ef5a6){_0x39a038['model']=_['keys'](db['CannedAnswer'][_0x92d9('0x4c')]);_0x39a038[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0xd74615[_0x92d9('0x4f')]);_0x39a038[_0x92d9('0x51')]=_['intersection'](_0x39a038['model'],_0x39a038[_0x92d9('0x4f')]);_0x11d419[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x39a038[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0xd74615[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x11d419[_0x92d9('0x53')]=_0x11d419['attributes'][_0x92d9('0x55')]?_0x11d419[_0x92d9('0x53')]:_0x39a038['model'];if(!_0xd74615['query'][_0x92d9('0x76')](_0x92d9('0x77'))){_0x11d419[_0x92d9('0x2d')]=qs[_0x92d9('0x2d')](_0xd74615[_0x92d9('0x4f')][_0x92d9('0x2d')]);_0x11d419[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0xd74615[_0x92d9('0x4f')][_0x92d9('0x2b')]);}_0x11d419[_0x92d9('0x7c')]=qs['sort'](_0xd74615[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x11d419[_0x92d9('0x57')]=qs[_0x92d9('0x51')](_[_0x92d9('0x7d')](_0xd74615['query'],_0x39a038[_0x92d9('0x51')]));_0x11d419['where'][_0x92d9('0x72')]=_0x5ef5a6['id'];if(_0xd74615['query'][_0x92d9('0x59')]){_0x11d419[_0x92d9('0x57')]=_[_0x92d9('0x5a')](_0x11d419[_0x92d9('0x57')],{'$or':_['map'](_0x11d419[_0x92d9('0x53')],function(_0x17ad79){var _0xd00490={};_0xd00490[_0x17ad79]={'$like':'%'+_0xd74615[_0x92d9('0x4f')][_0x92d9('0x59')]+'%'};return _0xd00490;})});}_0x11d419=_[_0x92d9('0x5a')]({},_0x11d419,_0xd74615[_0x92d9('0x5b')]);return db[_0x92d9('0x7b')]['count']({'where':_0x11d419[_0x92d9('0x57')]})[_0x92d9('0x1c')](function(_0x360c91){_0xdd8102['count']=_0x360c91;if(_0xd74615[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x11d419[_0x92d9('0x5e')]=[{'all':!![]}];}return db[_0x92d9('0x7b')][_0x92d9('0x5f')](_0x11d419);})['then'](function(_0x14d27f){_0xdd8102['rows']=_0x14d27f;return _0xdd8102;});}})[_0x92d9('0x1c')](respondWithFilteredResult(_0x2b52b7,_0x11d419))['catch'](handleError(_0x2b52b7,null));};exports[_0x92d9('0x7e')]=function(_0x843e58,_0x2b2479){return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x843e58[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x2b2479,null))['then'](function(_0x2db909){if(_0x2db909){return _0x2db909[_0x92d9('0x7e')](_0x843e58[_0x92d9('0x4f')]['ids']);}})['then'](respondWithStatusCode(_0x2b2479,null))[_0x92d9('0x26')](handleError(_0x2b2479,null));};exports[_0x92d9('0x7f')]=function(_0x2aaa3f,_0x787fa3){_0x2aaa3f[_0x92d9('0x65')][_0x92d9('0x80')]=_0x2aaa3f[_0x92d9('0x81')][_0x92d9('0x82')];return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x2aaa3f[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x787fa3,null))[_0x92d9('0x1c')](saveUpdates(_0x2aaa3f[_0x92d9('0x65')],null))[_0x92d9('0x1c')](respondWithResult(_0x787fa3,null))[_0x92d9('0x26')](handleError(_0x787fa3,null));};exports['addAvatar']=function(_0x35f5b0,_0x612466){_0x35f5b0['body']['agentAvatar']=_0x35f5b0['file']['filename'];return db[_0x92d9('0x4b')]['find']({'where':{'id':_0x35f5b0[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x612466,null))[_0x92d9('0x1c')](saveUpdates(_0x35f5b0[_0x92d9('0x65')],null))[_0x92d9('0x1c')](respondWithResult(_0x612466,null))[_0x92d9('0x26')](handleError(_0x612466,null));};exports[_0x92d9('0x83')]=function(_0x1c027e,_0x39483e){_0x1c027e['body'][_0x92d9('0x84')]=_0x1c027e[_0x92d9('0x81')][_0x92d9('0x82')];return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x1c027e[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x39483e,null))[_0x92d9('0x1c')](saveUpdates(_0x1c027e[_0x92d9('0x65')],null))['then'](respondWithResult(_0x39483e,null))['catch'](handleError(_0x39483e,null));};exports['addSystemAvatar']=function(_0x30c062,_0x58c536){_0x30c062[_0x92d9('0x65')]['systemAvatar']=_0x30c062['file']['filename'];return db[_0x92d9('0x4b')][_0x92d9('0x6e')]({'where':{'id':_0x30c062[_0x92d9('0x62')]['id']}})['then'](handleEntityNotFound(_0x58c536,null))[_0x92d9('0x1c')](saveUpdates(_0x30c062[_0x92d9('0x65')],null))['then'](respondWithResult(_0x58c536,null))['catch'](handleError(_0x58c536,null));};exports['getLogo']=function(_0x1f9273,_0x2cce24){var _0x4a1b05=path['join'](config[_0x92d9('0x85')],_0x92d9('0x86'));var _0x4724fa={'where':{'id':_0x1f9273[_0x92d9('0x62')]['id']},'attributes':['id',_0x92d9('0x80')],'raw':!![]};var _0x426886=![];return require(_0x92d9('0x87'))['getLicense']()[_0x92d9('0x1c')](function(_0x4653df){if(_0x4653df){_0x426886=_0x4653df[_0x92d9('0x88')];}})[_0x92d9('0x1c')](function(){return db[_0x92d9('0x4b')][_0x92d9('0x6e')](_0x4724fa);})[_0x92d9('0x1c')](handleEntityNotFound(_0x2cce24,null))[_0x92d9('0x1c')](function(_0x348cb4){if(_0x348cb4){if(!_[_0x92d9('0x89')](_0x348cb4[_0x92d9('0x80')])){if(fs['existsSync'](path['join'](config[_0x92d9('0x85')],_0x92d9('0x8a'),_0x348cb4[_0x92d9('0x80')]))&&_0x426886){_0x4a1b05=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server/files/images/logos/',_0x348cb4[_0x92d9('0x80')]);}}return _0x2cce24[_0x92d9('0x8c')](_0x4a1b05);}})[_0x92d9('0x26')](handleError(_0x2cce24,null));};exports[_0x92d9('0x8d')]=function(_0x454c17,_0x2aac60){var _0x1d198e=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],_0x92d9('0x8e'));var _0xfbb9ee={'where':{'id':_0x454c17[_0x92d9('0x62')]['id']},'attributes':['id',_0x92d9('0x8f')],'raw':!![]};return db[_0x92d9('0x4b')]['find'](_0xfbb9ee)[_0x92d9('0x1c')](handleEntityNotFound(_0x2aac60,null))['then'](function(_0x1e0df5){if(_0x1e0df5){if(!_[_0x92d9('0x89')](_0x1e0df5[_0x92d9('0x8f')])){if(fs[_0x92d9('0x90')](path[_0x92d9('0x8b')](config[_0x92d9('0x85')],_0x92d9('0x91'),_0x1e0df5[_0x92d9('0x8f')]))){_0x1d198e=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],_0x92d9('0x91'),_0x1e0df5['agentAvatar']);}}return _0x2aac60[_0x92d9('0x8c')](_0x1d198e);}})[_0x92d9('0x26')](handleError(_0x2aac60,null));};exports['getCustomerAvatar']=function(_0x2c028d,_0x3bfa58){var _0x452b1f=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server/files/images/avatars/customer_avatar.png');var _0x46fd3e={'where':{'id':_0x2c028d[_0x92d9('0x62')]['id']},'attributes':['id',_0x92d9('0x84'),_0x92d9('0x92')],'raw':!![]};return db[_0x92d9('0x4b')]['find'](_0x46fd3e)['then'](handleEntityNotFound(_0x3bfa58,null))[_0x92d9('0x1c')](function(_0x2fec38){if(_0x2fec38){if(!_[_0x92d9('0x89')](_0x2fec38[_0x92d9('0x84')])){if(fs[_0x92d9('0x90')](path[_0x92d9('0x8b')](config['root'],_0x92d9('0x91'),_0x2fec38['customerAvatar']))&&_0x2fec38[_0x92d9('0x92')]){_0x452b1f=path[_0x92d9('0x8b')](config['root'],_0x92d9('0x91'),_0x2fec38[_0x92d9('0x84')]);}}return _0x3bfa58[_0x92d9('0x8c')](_0x452b1f);}})[_0x92d9('0x26')](handleError(_0x3bfa58,null));};exports[_0x92d9('0x93')]=function(_0x42785e,_0xa51505){var _0x443faa=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server/files/images/avatars/system_avatar.png');var _0x2b0b45={'where':{'id':_0x42785e[_0x92d9('0x62')]['id']},'attributes':['id',_0x92d9('0x94')],'raw':!![]};return db[_0x92d9('0x4b')][_0x92d9('0x6e')](_0x2b0b45)[_0x92d9('0x1c')](handleEntityNotFound(_0xa51505,null))[_0x92d9('0x1c')](function(_0x5dd80c){if(_0x5dd80c){if(!_[_0x92d9('0x89')](_0x5dd80c[_0x92d9('0x94')])){if(fs[_0x92d9('0x90')](path[_0x92d9('0x8b')](config[_0x92d9('0x85')],_0x92d9('0x91'),_0x5dd80c[_0x92d9('0x94')]))){_0x443faa=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server/files/images/avatars/',_0x5dd80c[_0x92d9('0x94')]);}}return _0xa51505['download'](_0x443faa);}})[_0x92d9('0x26')](handleError(_0xa51505,null));};function checkWebsiteInterval(_0x4df746){var _0x4893af=_0x4df746[_0x92d9('0x95')];if(!_0x4893af){return Promise[_0x92d9('0x96')](_0x4df746);}var _0x11f33c=_0x4df746[_0x92d9('0x97')]||undefined;return _0x4893af[_0x92d9('0x98')](_0x11f33c)[_0x92d9('0x1c')](function(_0x4add15){if(!_0x4add15){throw new APIOutOfIntervalError();}return _0x4df746;});}exports[_0x92d9('0x99')]=function(_0x1b328a,_0x35ea79){var _0x1d6bb5={'body':_0x1b328a[_0x92d9('0x65')],'channel':_0x92d9('0x9a')};var _0x2035ef=[];var _0x2d4856=[];var _0x14849f={};var _0x527567=![];if(_0x1b328a[_0x92d9('0x65')]['id']){delete _0x1b328a[_0x92d9('0x65')]['id'];}if(_[_0x92d9('0x89')](_0x1b328a[_0x92d9('0x65')][_0x92d9('0x9b')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_['isNil'](_0x1b328a[_0x92d9('0x65')][_0x92d9('0x9c')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x92d9('0x9d')](_0x1b328a['body'][_0x92d9('0x65')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0xe51afa=_0x1b328a[_0x92d9('0x65')]['customerIp']&&_0x1b328a[_0x92d9('0x65')]['referer'];return db[_0x92d9('0x9e')][_0x92d9('0x70')]()[_0x92d9('0x1c')](function(_0x5ef99c){if(!_0x5ef99c){throw new Error('No\x20available\x20attributes');}_0x2035ef=Object[_0x92d9('0x50')](_0x5ef99c)[_0x92d9('0x59')](function(_0x16e0af){return![_0x92d9('0x9f'),'updatedAt']['includes'](_0x16e0af);});_0x2d4856=Object[_0x92d9('0x50')](_0x5ef99c)['filter'](function(_0xdf392a){return!['createdAt',_0x92d9('0xa0'),_0x92d9('0xa1'),_0x92d9('0xa2')][_0x92d9('0xa3')](_0xdf392a);});if(!_[_0x92d9('0xa3')](_0x2d4856,_0x1b328a[_0x92d9('0x65')][_0x92d9('0x9c')])){throw new APIBadRequestError(_0x92d9('0xa4')+_0x2d4856['join'](',\x20'));}_0x14849f[_0x1b328a[_0x92d9('0x65')]['mapKey']]=_0x1b328a[_0x92d9('0x65')]['from'];})[_0x92d9('0x1c')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1b328a[_0x92d9('0x62')]['id']},'include':[{'model':db[_0x92d9('0xa5')],'as':_0x92d9('0xa6'),'include':[{'model':db[_0x92d9('0x9e')],'as':_0x92d9('0xa7'),'where':_0x14849f,'limit':0x1,'order':[[_0x92d9('0xa0'),_0x92d9('0xa8')]]}]},{'model':db[_0x92d9('0xa9')],'as':'Applications'},{'model':db[_0x92d9('0x95')],'as':_0x92d9('0x95'),'include':[{'model':db['Interval'],'as':_0x92d9('0xaa'),'attributes':['id',_0x92d9('0xab')],'raw':!![]}]}]});})[_0x92d9('0x1c')](function(_0x355353){if(!_0x355353){throw new APINotFoundError(util[_0x92d9('0x43')](_0x92d9('0xac'),_0x1b328a[_0x92d9('0x62')]['id']));}if(_0xe51afa){return checkWebsiteInterval(_0x355353);}return _0x355353;})['then'](function(_0x3205c1){_0x1d6bb5[_0x92d9('0xad')]=_0x3205c1;_0x1d6bb5['applications']=_['orderBy'](_0x3205c1[_0x92d9('0xae')],[_0x92d9('0xaf')],['asc']);if(_0x1d6bb5[_0x92d9('0xad')][_0x92d9('0xae')]){delete _0x1d6bb5[_0x92d9('0xad')]['Applications'];}_0x1d6bb5['list']=_0x3205c1['List']||{'id':_0x3205c1['ListId']};if(_0x1d6bb5[_0x92d9('0xb0')]&&_0x1d6bb5['list']['Contacts'][_0x92d9('0x55')]){return _0x1d6bb5[_0x92d9('0xb0')]['Contacts'][0x0];}var _0x3b1ac2=_[_0x92d9('0x15')](_0x1b328a[_0x92d9('0x65')],{'firstName':_0x1b328a[_0x92d9('0x65')][_0x92d9('0x9b')],'ListId':_0x3205c1[_0x92d9('0xa2')]});_0x3b1ac2[_0x1b328a[_0x92d9('0x65')]['mapKey']]=_0x1b328a[_0x92d9('0x65')][_0x92d9('0x9b')];return db[_0x92d9('0x9e')][_0x92d9('0x63')](_0x3b1ac2,{'fields':_0x2035ef,'raw':!![]});})[_0x92d9('0x1c')](function(_0x318f60){_0x1d6bb5[_0x92d9('0xb1')]=_0x318f60;var _0x56b564=createInteractionObject(_0x1b328a[_0x92d9('0x62')]['id'],_0x1b328a[_0x92d9('0x65')],_0x1b328a[_0x92d9('0xb2')],_0x318f60);var _0x24123a={'ChatWebsiteId':_0x1b328a[_0x92d9('0x62')]['id']};if(_0x1b328a[_0x92d9('0x65')][_0x92d9('0xb3')]){_0x24123a['threadId']=_0x1b328a[_0x92d9('0x65')]['threadId'];_0x24123a[_0x92d9('0xb4')]=![];return db[_0x92d9('0xb5')][_0x92d9('0x6e')]({'where':_0x24123a})['then'](function(_0x170687){var _0x57c135=_0x1b328a['body'][_0x92d9('0xb6')]&&_0x1b328a[_0x92d9('0x65')]['referer'];if(_0x170687){_0x527567=!![];return _0x170687;}else if(!_0x57c135&&_0x170687&&_0x170687[_0x92d9('0xb4')]){throw new APIConflictError(_0x92d9('0xb7'));}_0x56b564[_0x92d9('0xb3')]=_0x1b328a[_0x92d9('0x65')][_0x92d9('0xb3')];_0x56b564['externalUrl']=_0x1b328a[_0x92d9('0x65')]['externalUrl'];return db[_0x92d9('0xb5')]['create'](_0x56b564);});}_0x24123a[_0x92d9('0xb8')]=_0x318f60['id'];if(_0x1b328a['body']['interaction']&&_0x1b328a['body'][_0x92d9('0xb9')]['id']){_0x24123a['id']=_0x1b328a[_0x92d9('0x65')]['interaction']['id'];return db['ChatInteraction'][_0x92d9('0x6e')]({'where':_0x24123a})[_0x92d9('0x1c')](function(_0x87727c){var _0x4dfb82=_0x1b328a[_0x92d9('0x65')][_0x92d9('0xb6')]&&_0x1b328a[_0x92d9('0x65')][_0x92d9('0x40')];if(!_0x4dfb82&&_0x87727c&&_0x87727c[_0x92d9('0xb4')]){throw new APIConflictError(_0x92d9('0xb7'));}else if(_0x87727c){_0x527567=!![];return _0x87727c;}else{return db[_0x92d9('0xb5')][_0x92d9('0x63')](_0x56b564);}});}return db[_0x92d9('0xb5')][_0x92d9('0x63')](_0x56b564);})['then'](function(_0x511482){if(!_0x527567){return _0x511482;}var _0x35d23d={'from':(_0x1d6bb5[_0x92d9('0xb1')][_0x92d9('0x3e')]||'')+'\x20'+(_0x1d6bb5[_0x92d9('0xb1')]['lastName']||'')};if(_0x1b328a['body'][_0x92d9('0xb3')]&&_0x1b328a[_0x92d9('0x65')]['messageId']&&_0x1b328a[_0x92d9('0x65')][_0x92d9('0xb3')]!=_0x1b328a[_0x92d9('0x65')][_0x92d9('0xba')]){_0x35d23d[_0x92d9('0xb3')]=_0x1b328a[_0x92d9('0x65')]['messageId'];}return _0x511482[_0x92d9('0x30')](_0x35d23d);})['then'](function(_0x947df7){_0x1d6bb5['interaction']=_0x947df7['get']({'plain':!![]});_0x1d6bb5['interaction']['created']=!_0x527567;if(_0x1d6bb5[_0x92d9('0xb9')][_0x92d9('0xbb')]){if(_0x1d6bb5[_0x92d9('0xad')][_0x92d9('0xbc')]){_0x1d6bb5[_0x92d9('0xbd')][_0x92d9('0xbe')]({'id':0x0,'priority':_0x1d6bb5[_0x92d9('0xbd')][_0x92d9('0x55')]+0x1,'app':_0x92d9('0xbf'),'appdata':_0x92d9('0xc0'),'interval':_0x92d9('0xc1')});}}return db[_0x92d9('0xc2')][_0x92d9('0x63')]({'body':_0x1b328a[_0x92d9('0x65')][_0x92d9('0x65')],'ChatWebsiteId':_0x1b328a[_0x92d9('0x62')]['id'],'ChatInteractionId':_0x947df7['id'],'direction':'in','ContactId':_0x1d6bb5[_0x92d9('0xb1')]['id'],'AttachmentId':_0x1b328a[_0x92d9('0x65')][_0x92d9('0xc3')]});})[_0x92d9('0x1c')](function(_0x3ed67f){_0x1d6bb5['message']=_0x3ed67f;if(!_0x1d6bb5[_0x92d9('0xb9')][_0x92d9('0xc4')]){return;}return db[_0x92d9('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x1d6bb5[_0x92d9('0xb9')][_0x92d9('0xc4')]}});})[_0x92d9('0x1c')](function(_0x335337){if(_0x335337){_0x1d6bb5[_0x92d9('0xbd')][_0x92d9('0xc6')]({'id':0x0,'priority':0x0,'app':_0x92d9('0xc7'),'appdata':_0x335337['name']+','+(_0x1d6bb5[_0x92d9('0xad')]['waitForTheAssignedAgent']||0xa),'interval':_0x92d9('0xc1')});_0x1d6bb5[_0x92d9('0xc8')]=!![];}if(!_0x1d6bb5[_0x92d9('0xb9')]['queueId']){return;}return db[_0x92d9('0xc9')]['find']({'attributes':['id',_0x92d9('0x36')],'where':{'id':_0x1d6bb5[_0x92d9('0xb9')][_0x92d9('0xca')]}});})[_0x92d9('0x1c')](function(_0x252879){if(_0x252879){_0x1d6bb5[_0x92d9('0xbd')][_0x92d9('0xc6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x252879[_0x92d9('0x36')]+','+(_0x1d6bb5['account'][_0x92d9('0xcb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x92d9('0xcc'),'startRouting',_0x1d6bb5);})[_0x92d9('0x1c')](function(_0x924cbc){respondWithRpcPromise(_0x92d9('0xcd'),_0x92d9('0xcd'),{'event':_0x92d9('0x99'),'message':_0x924cbc},client9002);return _0x924cbc;})['then'](respondWithResult(_0x35ea79,null))['catch'](APIHandleError(_0x35ea79));};exports[_0x92d9('0xce')]=function(_0x3d616c,_0x1bcd73){var _0xcd2ce9,_0x523fa0,_0x10cb0b;var _0x311576=[];var _0x4793da={};var _0x176479=_0x3d616c['files']||[];var _0xa9e0b0=[];var _0xb1d5ea;return db[_0x92d9('0x9e')][_0x92d9('0x70')]()[_0x92d9('0x1c')](function(_0x5a3368){if(!_0x5a3368){throw new db[(_0x92d9('0xcf'))][(_0x92d9('0xd0'))](_0x92d9('0xd1'));}_0x311576=_['difference'](_['keys'](_0x5a3368),['createdAt',_0x92d9('0xa0'),_0x92d9('0xa1'),_0x92d9('0xa2')]);if(_0x3d616c[_0x92d9('0x65')]['id']){delete _0x3d616c['body']['id'];}if(_[_0x92d9('0x89')](_0x3d616c[_0x92d9('0x65')][_0x92d9('0x9b')])){throw _0x1bcd73[_0x92d9('0x28')](0x1f4)['send'](new db[(_0x92d9('0xcf'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x92d9('0x89')](_0x3d616c['body'][_0x92d9('0x65')])||_0x3d616c[_0x92d9('0x65')][_0x92d9('0x65')]===''){throw _0x1bcd73[_0x92d9('0x28')](0x1f4)['send'](new db[(_0x92d9('0xcf'))][(_0x92d9('0xd0'))](_0x92d9('0xd2')));}if(_[_0x92d9('0x89')](_0x3d616c[_0x92d9('0x65')]['mapKeyOffline'])){throw _0x1bcd73[_0x92d9('0x28')](0x1f4)[_0x92d9('0x37')](new db[(_0x92d9('0xcf'))][(_0x92d9('0xd0'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x311576));}if(!_[_0x92d9('0xa3')](_0x311576,_0x3d616c[_0x92d9('0x65')][_0x92d9('0xd3')])){throw _0x1bcd73['status'](0x1f4)[_0x92d9('0x37')](new db[(_0x92d9('0xcf'))][(_0x92d9('0xd0'))](_0x92d9('0xd4')+_0x311576));}_0x4793da[_0x3d616c[_0x92d9('0x65')][_0x92d9('0xd3')]]=_0x3d616c[_0x92d9('0x65')][_0x92d9('0x9b')];})['then'](function(){return db['ChatWebsite'][_0x92d9('0x6e')]({'where':{'id':_0x3d616c[_0x92d9('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x92d9('0xa6')},{'model':db[_0x92d9('0xd5')],'as':_0x92d9('0xd5')}]});})[_0x92d9('0x1c')](handleEntityNotFound(_0x1bcd73,null))[_0x92d9('0x1c')](function(_0x2b5c3e){if(_0x2b5c3e&&_0x2b5c3e[_0x92d9('0xa6')]){_0x523fa0=_0x2b5c3e;var _0x29caea=_[_0x92d9('0x15')](_0x3d616c[_0x92d9('0x65')],{'firstName':_0x3d616c[_0x92d9('0x65')][_0x92d9('0x9b')],'phone':_0x3d616c[_0x92d9('0x65')][_0x92d9('0x9b')],'ListId':_0x2b5c3e[_0x92d9('0xa2')]});_0x29caea[_0x3d616c[_0x92d9('0x65')]['mapKeyOffline']]=_0x3d616c['body'][_0x92d9('0x9b')];return db['CmContact'][_0x92d9('0xd6')]({'where':_0x4793da,'defaults':_0x29caea});}})[_0x92d9('0xd7')](function(_0x1c202a){if(_0x1c202a){_0x10cb0b=_0x1c202a;var _0x4fa159=fs[_0x92d9('0xd8')](path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server/files/templates/chatOfflineMessage.ejs'),_0x92d9('0xd9'));var _0x1c554a=ejs[_0x92d9('0xda')](_0x4fa159,{'body':_[_0x92d9('0xdb')](_0x3d616c['body'][_0x92d9('0x65')]),'bodyTitle':_0x523fa0[_0x92d9('0xdc')]});return db['ChatOfflineMessage'][_0x92d9('0x63')]({'body':_0x1c554a,'plainBody':htmlToText[_0x92d9('0xdd')](_0x1c554a),'ContactId':_0x1c202a['id'],'ChatWebsiteId':_0x523fa0['id']});}})[_0x92d9('0x1c')](function(_0x13a765){_0xb1d5ea=_0x13a765;if(_0x176479[_0x92d9('0x55')]){var _0x477128=_0x176479[_0x92d9('0x4e')](function(_0x5de1a1){return{'name':_0x5de1a1['originalname'],'basename':_0x5de1a1['filename'],'type':_0x5de1a1[_0x92d9('0xde')],'ChatOfflineMessageId':_0x13a765['id']};});_0xa9e0b0=_0x477128[_0x92d9('0x4e')](_0x4ad04f=>{var _0x56f8d6={'filename':_0x4ad04f[_0x92d9('0x36')],'path':path[_0x92d9('0x8b')](config[_0x92d9('0x85')],_0x92d9('0xdf'),_0x92d9('0xe0'),_0x92d9('0xe1'),'offline-chat',_0x4ad04f['basename'])};return _0x56f8d6;});if(!_0x523fa0['openNewInteraction']){return db[_0x92d9('0xe2')][_0x92d9('0xe3')](function(_0x3540a9){return db[_0x92d9('0xe4')]['bulkCreate'](_0x477128,{'transaction':_0x3540a9});});}}})[_0x92d9('0x1c')](function(){if(_0xb1d5ea){_0xcd2ce9=_0xb1d5ea;return db[_0x92d9('0xd5')][_0x92d9('0x75')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x92d9('0xe5'),'raw':!![],'include':[{'model':db[_0x92d9('0xe6')],'as':_0x92d9('0xe6'),'raw':!![]}]}]});}})[_0x92d9('0x1c')](function(_0x4ce013){if(_0x4ce013&&_0x4ce013[_0x92d9('0xe5')]&&_0x523fa0[_0x92d9('0xe7')]&&_0x523fa0[_0x92d9('0xe8')]){var _0x51f2b2=_0x4ce013[_0x92d9('0xe9')]();return respondWithRpcPromise(_0x92d9('0xea'),'sendMail',{'account':_0x51f2b2,'message':{'from':util[_0x92d9('0x43')](_0x92d9('0xeb'),_0x4ce013[_0x92d9('0x36')],_0x4ce013['email']||_0x4ce013['Smtp'][_0x92d9('0x68')]),'to':_0x523fa0['forwardOfflineAddress'],'subject':_0x523fa0[_0x92d9('0xec')],'html':_0xcd2ce9[_0x92d9('0x65')],'attachments':_0xa9e0b0}},client9003)['then'](function(){return _0xcd2ce9;})['catch'](function(_0x3db0a6){logger[_0x92d9('0x23')](_0x3db0a6);});}})[_0x92d9('0x1c')](function(){if(_0x523fa0&&_0x523fa0[_0x92d9('0xed')]&&_0x523fa0[_0x92d9('0xee')]){var _0x1b70be=[];if(_0x176479['length']){_0x1b70be=_0x176479[_0x92d9('0x4e')](function(_0x21c813){return{'name':_0x21c813[_0x92d9('0xef')],'basename':_0x21c813[_0x92d9('0x82')],'type':_0x21c813[_0x92d9('0xde')],'ChatOfflineMessageId':_0xb1d5ea['id']};});}var _0x362b97;if(!_[_0x92d9('0x89')](_0x523fa0[_0x92d9('0xf0')])){var _0x327b44=_[_0x92d9('0x4e')](_0x3d616c[_0x92d9('0x65')],function(_0x26754e){return _0x26754e;});var _0x3d2b5d=_['toPairsIn'](_0x327b44)[0x0];var _0x3d0201=_[_0x92d9('0xf1')](_0x3d2b5d,function(_0xf1d504){return _0xf1d504;});_0x362b97=_0x3d0201[0x1][_0x523fa0[_0x92d9('0xf0')]];}var _0x3a8405={'from':_0x10cb0b['email'],'firstName':_0x10cb0b[_0x92d9('0x3e')],'lastName':_0x10cb0b[_0x92d9('0xf2')],'mapKey':'email','message':{'from':_0x10cb0b[_0x92d9('0xf3')],'to':_0x523fa0[_0x92d9('0xd5')][_0x92d9('0xf3')],'cc':'','subject':_[_0x92d9('0x89')](_0x362b97)?_0x523fa0['offlineMessageSubject']:_0x362b97,'messageId':'','sentAt':new Date(),'attach':_0x1b70be['length'],'attachments':_0x1b70be,'originChannel':'Chat','ChatWebsiteId':_0x523fa0['id'],'ChatOfflineMessageId':_0xcd2ce9['id'],'originTo':_0x523fa0[_0x92d9('0xd5')]['email']},'body':_0xcd2ce9[_0x92d9('0x65')]};var _0x359974={'account':{'id':_0x523fa0[_0x92d9('0xee')]},'body':_0x3a8405,'log':_0x92d9('0xf4')};return respondWithRpcPromise(_0x92d9('0xf4'),_0x92d9('0xf5'),_0x359974,client9001)[_0x92d9('0x1c')](function(){return _0xcd2ce9;})[_0x92d9('0x26')](function(_0xb7c57e){logger[_0x92d9('0x23')](_0xb7c57e);});}return;})[_0x92d9('0x1c')](function(){if(_0xcd2ce9){return _0xcd2ce9;}})[_0x92d9('0x1c')](respondWithResult(_0x1bcd73,null))['catch'](function(){for(var _0x1627a5 of _0x176479){var _0x3f2480=path[_0x92d9('0x8b')](config[_0x92d9('0x85')],'server','files',_0x92d9('0xe1'),'offline-chat',_0x1627a5[_0x92d9('0x82')]);fs_extra[_0x92d9('0xf6')](_0x3f2480)[_0x92d9('0x26')](function(_0x78cf01){logger[_0x92d9('0x23')](_0x92d9('0xf7'),_0x3f2480,_0x78cf01);});}});};exports['addInteraction']=function(_0x2a1afa,_0x5b08e5){return db['ChatInteraction'][_0x92d9('0x6e')]({'where':{'id':_0x2a1afa[_0x92d9('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b08e5,null))['then'](function(_0x8a642d){if(_0x8a642d){return _0x8a642d[_0x92d9('0xf8')](_0x2a1afa[_0x92d9('0x65')]['ids'],_[_0x92d9('0xf9')](_0x2a1afa[_0x92d9('0x65')],['ids','id'])||{});}})[_0x92d9('0x1c')](respondWithResult(_0x5b08e5,null))[_0x92d9('0x26')](handleError(_0x5b08e5,null));};exports[_0x92d9('0xfa')]=function(_0x3cb0df,_0x26fb8c){var _0x4fe48d={'raw':![],'where':{}};var _0x36b0df={};var _0x394866={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3cb0df[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x26fb8c,null))[_0x92d9('0x1c')](function(_0xe3e064){if(_0xe3e064){_0x36b0df[_0x92d9('0x45')]=_[_0x92d9('0x50')](db['ChatInteraction'][_0x92d9('0x4c')]);_0x36b0df[_0x92d9('0x4f')]=_['keys'](_0x3cb0df['query']);_0x36b0df[_0x92d9('0x51')]=_[_0x92d9('0x52')](_0x36b0df[_0x92d9('0x45')],_0x36b0df[_0x92d9('0x4f')]);_0x4fe48d[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x36b0df['model'],qs[_0x92d9('0x54')](_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x4fe48d[_0x92d9('0x53')]=_0x4fe48d[_0x92d9('0x53')][_0x92d9('0x55')]?_0x4fe48d[_0x92d9('0x53')]:_0x36b0df['model'];if(!_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x76')](_0x92d9('0x77'))){_0x4fe48d[_0x92d9('0x2d')]=qs[_0x92d9('0x2d')](_0x3cb0df['query']['limit']);_0x4fe48d[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x2b')]);}_0x4fe48d[_0x92d9('0x7c')]=qs[_0x92d9('0x56')](_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x4fe48d[_0x92d9('0x57')]=qs['filters'](_[_0x92d9('0x7d')](_0x3cb0df['query'],_0x36b0df[_0x92d9('0x51')]));_0x4fe48d[_0x92d9('0x57')][_0x92d9('0x72')]=_0xe3e064['id'];if(_0x3cb0df['query']['filter']){_0x4fe48d[_0x92d9('0x57')]=_['merge'](_0x4fe48d[_0x92d9('0x57')],{'$or':_[_0x92d9('0x4e')](_0x4fe48d[_0x92d9('0x53')],function(_0x5d4d63){var _0x4caca1={};_0x4caca1[_0x5d4d63]={'$like':'%'+_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x59')]+'%'};return _0x4caca1;})});}_0x4fe48d=_[_0x92d9('0x5a')]({},_0x4fe48d,_0x3cb0df[_0x92d9('0x5b')]);return db[_0x92d9('0xb5')]['count']({'where':_0x4fe48d[_0x92d9('0x57')]})[_0x92d9('0x1c')](function(_0x4b9d57){_0x394866[_0x92d9('0x5c')]=_0x4b9d57;if(_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x4fe48d[_0x92d9('0x5e')]=[{'model':db[_0x92d9('0x9e')],'as':_0x92d9('0xfb'),'required':![]},{'model':db[_0x92d9('0xc5')],'as':_0x92d9('0xfc'),'attributes':[_0x92d9('0x36'),_0x92d9('0xfd'),_0x92d9('0xfe')],'required':![]},{'model':db[_0x92d9('0xff')],'as':_0x92d9('0x100'),'attributes':['id','name',_0x92d9('0x101')],'where':_0x3cb0df[_0x92d9('0x4f')]['tag']?{'id':_0x3cb0df[_0x92d9('0x4f')]['tag']}:undefined,'required':_0x3cb0df[_0x92d9('0x4f')][_0x92d9('0x102')]?!![]:![]}];}return db[_0x92d9('0xb5')][_0x92d9('0x5f')](_0x4fe48d);})[_0x92d9('0x1c')](function(_0x528244){_0x394866['rows']=_0x528244;return _0x394866;});}})[_0x92d9('0x1c')](respondWithFilteredResult(_0x26fb8c,_0x4fe48d))[_0x92d9('0x26')](handleError(_0x26fb8c,null));};exports[_0x92d9('0x103')]=function(_0xd67e72,_0x201676){var _0x419a7a=0x0;var _0x29fcbf=0x0;var _0x241805=![];var _0x2a7197;var _0xe2e6bb;return db[_0x92d9('0x4b')]['find']({'where':{'id':_0xd67e72[_0x92d9('0x62')]['id']},'include':[{'model':db[_0x92d9('0x95')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x92d9('0xab')]}]}]})[_0x92d9('0x1c')](handleEntityNotFound(_0x201676,null))['then'](function(_0x2cffba){if(_0x2cffba){_0x2a7197=_0x2cffba;return _0x2cffba[_0x92d9('0x104')]({'raw':!![]});}})['then'](function(_0x45c66c){if(_0x2a7197){if(_0x45c66c){_0xe2e6bb=_0x45c66c;}}return require('../../config/license/util')[_0x92d9('0x105')]();})['then'](function(_0x431515){if(_0x431515){_0x29fcbf=_0x431515[_0x92d9('0x106')];_0x241805=_0x431515[_0x92d9('0x88')];}})[_0x92d9('0x1c')](function(){return db[_0x92d9('0xb5')]['count']({'where':{'closed':![]}});})[_0x92d9('0x1c')](function(_0x88e397){_0x419a7a=_0x88e397;if(_0x29fcbf&&_0x88e397>_0x29fcbf){return db[_0x92d9('0x107')][_0x92d9('0x75')]({'where':{'id':0x1}})[_0x92d9('0x1c')](function(_0xefac7b){if(_0xefac7b){_0xefac7b[_0x92d9('0x108')](_0x92d9('0x109'));}});}})[_0x92d9('0x1c')](function(){var _0x3d2393=_0x2a7197[_0x92d9('0x95')];var _0x18d143=_0x2a7197[_0x92d9('0x97')]||undefined;return _0x3d2393?_0x3d2393[_0x92d9('0x98')](_0x18d143):!![];})[_0x92d9('0x1c')](function(_0x29ac61){var _0x4e408c=fs[_0x92d9('0xd8')](path[_0x92d9('0x8b')](config['root'],_0x92d9('0x10a')),_0x92d9('0xd9'));var _0x29b19b=_0x92d9('0x10b');var _0x29fb68=![];try{const _0x4591d8=new URL(_0x2a7197['address']);_0x2a7197[_0x92d9('0x66')]=_0x4591d8['origin'];}catch(_0x7c1ed8){}var _0x4ff9d5;if(_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')]){_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')]=_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')]['replace'](/\/$/,'');_0x4ff9d5=wildcardUtils[_0x92d9('0x10c')](_0x2a7197[_0x92d9('0x66')],_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')]);}else{_0xd67e72['headers'][_0x92d9('0x40')]=_0x2a7197[_0x92d9('0x66')];_0x4ff9d5=!![];}var _0x5f331c={'chatVersion':_0x29b19b,'chatWebsiteAddressOrigin':_0x4ff9d5?_0xd67e72['headers'][_0x92d9('0x40')]:_0x2a7197['address'],'remote':_0x2a7197[_0x92d9('0x10d')],'query':querystring[_0x92d9('0x20')](_[_0x92d9('0x5a')](_0x2a7197[_0x92d9('0x32')]({'plain':!![]}),{'customerIp':_0xd67e72[_0x92d9('0xb2')]['x-forwarded-for']||_0xd67e72['headers']['x-real-ip']||_0xd67e72['connection'][_0x92d9('0x10e')]||_0xd67e72['ip'],'referer':_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')],'openedInteractions':_0x419a7a,'maxInteractions':_0x29fcbf,'virtual':_0x241805[_0x92d9('0x106')],'online':_0x29ac61,'custom':_0x241805,'address':_0x4ff9d5?_0xd67e72[_0x92d9('0xb2')][_0x92d9('0x40')]:null}))[_0x92d9('0x10f')](/'/g,'\x5c\x27')};_0x201676[_0x92d9('0x37')](ejs[_0x92d9('0xda')](Mustache[_0x92d9('0xda')](_0x4e408c,_0x5f331c),{'proactiveActions':_0xe2e6bb,'alignment':_0x2a7197['alignment'],'verticalAlignment':_0x2a7197['verticalAlignment'],'div_color':_0x2a7197[_0x92d9('0x101')],'labelText':_0x2a7197['labelText'],'text_color':_0x2a7197[_0x92d9('0x110')],'text_button_color':_0x2a7197[_0x92d9('0x111')],'button_color':_0x2a7197[_0x92d9('0x112')],'background_color':_0x2a7197['backgroundColor'],'hideWhenOffline':_0x2a7197['hideWhenOffline'],'intervalId':_0x2a7197['IntervalId'],'isDevelopment':_0x29fb68,'chatVersion':_0x29b19b}));})[_0x92d9('0x26')](handleError(_0x201676,null));};exports[_0x92d9('0x113')]=function(_0x1be47d,_0xd0dc15){var _0x22338a=_0x1be47d['params']['id'];var _0x3a936a=_0x1be47d[_0x92d9('0x65')];var _0x15c7fd=0xc8;var _0x171bea=null;return db[_0x92d9('0xe2')][_0x92d9('0xe3')]({'isolationLevel':db[_0x92d9('0xe2')][_0x92d9('0x114')][_0x92d9('0x115')][_0x92d9('0x116')]},function(_0x40f51c){return db['ChatWebsite']['findOne']({'where':{'id':_0x22338a},'transaction':_0x40f51c})[_0x92d9('0x1c')](function(_0x46b609){if(_0x46b609){return db[_0x92d9('0xa9')][_0x92d9('0x31')]({'where':{'ChatWebsiteId':_0x22338a},'transaction':_0x40f51c})['then'](function(){var _0x498b2c=_['map'](_0x3a936a,function(_0x2cdb75){_0x2cdb75[_0x92d9('0x72')]=_0x22338a;return _0x2cdb75;});return db[_0x92d9('0xa9')][_0x92d9('0x117')](_0x498b2c,{'transaction':_0x40f51c});});}else{_0x15c7fd=0x194;_0x171bea=[];}});})['then'](function(){if(_0x15c7fd!==0x194){return db[_0x92d9('0xa9')][_0x92d9('0x118')]({'where':{'ChatWebsiteId':_0x22338a},'order':_0x92d9('0xaf')})[_0x92d9('0x1c')](function(_0x487380){_0x171bea=_0x487380;});}})['catch'](function(_0x204bfa){_0x15c7fd=0x1f4;logger[_0x92d9('0x23')](_0x204bfa['stack']);if(_0x204bfa['name']){delete _0x204bfa[_0x92d9('0x36')];}_0x171bea=_0x204bfa;})[_0x92d9('0x119')](function(){if(_0x171bea===null){_0xd0dc15['sendStatus'](_0x15c7fd);}else{if(_0x15c7fd===0x1f4){_0xd0dc15[_0x92d9('0x28')](_0x15c7fd)[_0x92d9('0x37')](_0x171bea);}else{_0xd0dc15[_0x92d9('0x28')](_0x15c7fd)[_0x92d9('0x2a')](_0x171bea);}}});};exports[_0x92d9('0x11a')]=function(_0x36ab1a,_0x420668){var _0x4adae5={};var _0x34abe8={};var _0x142264;var _0x59c646;return db['ChatWebsite']['findOne']({'where':{'id':_0x36ab1a[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x420668,null))[_0x92d9('0x1c')](function(_0x4dd168){if(_0x4dd168){_0x142264=_0x4dd168;_0x34abe8['model']=_['keys'](db[_0x92d9('0xa9')]['rawAttributes']);_0x34abe8[_0x92d9('0x4f')]=_['keys'](_0x36ab1a[_0x92d9('0x4f')]);_0x34abe8[_0x92d9('0x51')]=_['intersection'](_0x34abe8['model'],_0x34abe8['query']);_0x4adae5[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x34abe8[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0x36ab1a[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x4adae5[_0x92d9('0x53')]=_0x4adae5['attributes'][_0x92d9('0x55')]?_0x4adae5[_0x92d9('0x53')]:_0x34abe8[_0x92d9('0x45')];_0x4adae5[_0x92d9('0x7c')]=qs['sort'](_0x36ab1a[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x4adae5[_0x92d9('0x57')]=qs['filters'](_[_0x92d9('0x7d')](_0x36ab1a[_0x92d9('0x4f')],_0x34abe8[_0x92d9('0x51')]));if(_0x36ab1a['query'][_0x92d9('0x59')]){_0x4adae5['where']=_[_0x92d9('0x5a')](_0x4adae5[_0x92d9('0x57')],{'$or':_['map'](_0x4adae5[_0x92d9('0x53')],function(_0x3953a4){var _0x364cf6={};_0x364cf6[_0x3953a4]={'$like':'%'+_0x36ab1a[_0x92d9('0x4f')][_0x92d9('0x59')]+'%'};return _0x364cf6;})});}_0x4adae5=_['merge']({},_0x4adae5,_0x36ab1a[_0x92d9('0x5b')]);return _0x142264[_0x92d9('0x11a')](_0x4adae5);}})['then'](function(_0x119632){if(_0x119632){_0x59c646=_0x119632[_0x92d9('0x55')];if(!_0x36ab1a[_0x92d9('0x4f')][_0x92d9('0x76')]('nolimit')){_0x4adae5[_0x92d9('0x2d')]=qs[_0x92d9('0x2d')](_0x36ab1a['query']['limit']);_0x4adae5[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0x36ab1a[_0x92d9('0x4f')][_0x92d9('0x2b')]);}return _0x142264['getApplications'](_0x4adae5);}})[_0x92d9('0x1c')](function(_0x59fd97){if(_0x59fd97){return _0x59fd97?{'count':_0x59c646,'rows':_0x59fd97}:null;}})[_0x92d9('0x1c')](respondWithResult(_0x420668,null))[_0x92d9('0x26')](handleError(_0x420668,null));};exports[_0x92d9('0x11b')]=function(_0x1258e7,_0x4651b3){return db[_0x92d9('0x11c')][_0x92d9('0x6e')]({'where':{'id':_0x1258e7[_0x92d9('0x62')]['id']}})['then'](handleEntityNotFound(_0x4651b3,null))['then'](function(_0x1183b6){if(_0x1183b6){return _0x1183b6[_0x92d9('0x11b')](_0x1258e7[_0x92d9('0x65')][_0x92d9('0x79')],_[_0x92d9('0xf9')](_0x1258e7[_0x92d9('0x65')],[_0x92d9('0x79'),'id'])||{});}})[_0x92d9('0x1c')](respondWithResult(_0x4651b3,null))[_0x92d9('0x26')](handleError(_0x4651b3,null));};exports['getProactiveActions']=function(_0x4d1dfa,_0xd083da){var _0x5d803e={};var _0x868b6c={};var _0x57f091;var _0x20b30f;return db[_0x92d9('0x4b')]['findOne']({'where':{'id':_0x4d1dfa['params']['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0xd083da,null))[_0x92d9('0x1c')](function(_0x2a8449){if(_0x2a8449){_0x57f091=_0x2a8449;_0x868b6c[_0x92d9('0x45')]=_[_0x92d9('0x50')](db[_0x92d9('0x11d')][_0x92d9('0x4c')]);_0x868b6c[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0x4d1dfa[_0x92d9('0x4f')]);_0x868b6c['filters']=_[_0x92d9('0x52')](_0x868b6c['model'],_0x868b6c[_0x92d9('0x4f')]);_0x5d803e[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x868b6c[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x5d803e[_0x92d9('0x53')]=_0x5d803e[_0x92d9('0x53')]['length']?_0x5d803e[_0x92d9('0x53')]:_0x868b6c['model'];_0x5d803e[_0x92d9('0x7c')]=qs['sort'](_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x5d803e['where']=qs[_0x92d9('0x51')](_[_0x92d9('0x7d')](_0x4d1dfa[_0x92d9('0x4f')],_0x868b6c['filters']));if(_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x59')]){_0x5d803e['where']=_[_0x92d9('0x5a')](_0x5d803e['where'],{'$or':_[_0x92d9('0x4e')](_0x5d803e[_0x92d9('0x53')],function(_0x30d4a0){var _0x57f908={};_0x57f908[_0x30d4a0]={'$like':'%'+_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x59')]+'%'};return _0x57f908;})});}_0x5d803e=_[_0x92d9('0x5a')]({},_0x5d803e,_0x4d1dfa[_0x92d9('0x5b')]);return _0x57f091[_0x92d9('0x104')](_0x5d803e);}})['then'](function(_0x5f54ae){if(_0x5f54ae){_0x20b30f=_0x5f54ae[_0x92d9('0x55')];if(!_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x76')](_0x92d9('0x77'))){_0x5d803e[_0x92d9('0x2d')]=qs[_0x92d9('0x2d')](_0x4d1dfa[_0x92d9('0x4f')]['limit']);_0x5d803e['offset']=qs[_0x92d9('0x2b')](_0x4d1dfa[_0x92d9('0x4f')][_0x92d9('0x2b')]);}return _0x57f091[_0x92d9('0x104')](_0x5d803e);}})[_0x92d9('0x1c')](function(_0x4749fc){if(_0x4749fc){return _0x4749fc?{'count':_0x20b30f,'rows':_0x4749fc}:null;}})['then'](respondWithResult(_0xd083da,null))[_0x92d9('0x26')](handleError(_0xd083da,null));};exports[_0x92d9('0x11e')]=function(_0x509cbf,_0xf01061){var _0x1c0215=_0x509cbf[_0x92d9('0x4f')][_0x92d9('0x11f')]===_0x92d9('0x120')?_0x92d9('0x121'):_0x92d9('0x122');return db['ChatWebsite'][_0x92d9('0x6e')]({'attributes':['id',_0x1c0215],'where':{'id':_0x509cbf[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0xf01061,null))['then'](function(_0x12df27){if(_0x12df27){var _0x438b21=_0x12df27[_0x1c0215];var _0x532e56=_0x438b21&&_0x438b21[_0x92d9('0x123')]?_0x438b21['items']:[];_0xf01061[_0x92d9('0x37')]({'fromKey':_[_0x92d9('0x89')](_0x438b21['fromKey'])?undefined:_0x438b21[_0x92d9('0x124')],'count':_0x532e56[_0x92d9('0x55')],'rows':_0x532e56});}})[_0x92d9('0x26')](handleError(_0xf01061,null));};exports[_0x92d9('0x125')]=function(_0x3530a7,_0x3bb83b){var _0x292e7c={'raw':![],'where':{}};var _0x4b0c3e={};var _0x2cf33e={'count':0x0,'rows':[]};return db[_0x92d9('0x4b')][_0x92d9('0x75')]({'where':{'id':_0x3530a7[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x3bb83b,null))[_0x92d9('0x1c')](function(_0x242943){if(_0x242943){_0x4b0c3e[_0x92d9('0x45')]=_[_0x92d9('0x50')](db[_0x92d9('0x126')][_0x92d9('0x4c')]);_0x4b0c3e[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0x3530a7[_0x92d9('0x4f')]);_0x4b0c3e[_0x92d9('0x51')]=_[_0x92d9('0x52')](_0x4b0c3e[_0x92d9('0x45')],_0x4b0c3e['query']);_0x292e7c[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x4b0c3e[_0x92d9('0x45')],qs[_0x92d9('0x54')](_0x3530a7['query'][_0x92d9('0x54')]));_0x292e7c['attributes']=_0x292e7c[_0x92d9('0x53')][_0x92d9('0x55')]?_0x292e7c[_0x92d9('0x53')]:_0x4b0c3e[_0x92d9('0x45')];if(!_0x3530a7[_0x92d9('0x4f')]['hasOwnProperty'](_0x92d9('0x77'))){_0x292e7c[_0x92d9('0x2d')]=qs[_0x92d9('0x2d')](_0x3530a7['query']['limit']);_0x292e7c[_0x92d9('0x2b')]=qs['offset'](_0x3530a7[_0x92d9('0x4f')][_0x92d9('0x2b')]);}_0x292e7c['order']=qs['sort'](_0x3530a7['query'][_0x92d9('0x56')]);_0x292e7c[_0x92d9('0x57')]=qs[_0x92d9('0x51')](_[_0x92d9('0x7d')](_0x3530a7[_0x92d9('0x4f')],_0x4b0c3e['filters']));_0x292e7c[_0x92d9('0x57')][_0x92d9('0x72')]=_0x242943['id'];if(_0x3530a7[_0x92d9('0x4f')][_0x92d9('0x59')]){_0x292e7c[_0x92d9('0x57')]=_[_0x92d9('0x5a')](_0x292e7c[_0x92d9('0x57')],{'$or':_['map'](_0x292e7c[_0x92d9('0x53')],function(_0x4365f6){var _0x2d07e9={};_0x2d07e9[_0x4365f6]={'$like':'%'+_0x3530a7[_0x92d9('0x4f')]['filter']+'%'};return _0x2d07e9;})});}_0x292e7c=_[_0x92d9('0x5a')]({},_0x292e7c,_0x3530a7[_0x92d9('0x5b')]);return db[_0x92d9('0x126')][_0x92d9('0x5c')]({'where':_0x292e7c[_0x92d9('0x57')]})['then'](function(_0x29d9f8){_0x2cf33e['count']=_0x29d9f8;if(_0x3530a7[_0x92d9('0x4f')][_0x92d9('0x5d')]){_0x292e7c[_0x92d9('0x5e')]=[{'all':!![]}];}else{_0x292e7c[_0x92d9('0x5e')]=[{'model':db[_0x92d9('0x9e')],'as':_0x92d9('0xfb'),'required':![]},{'model':db[_0x92d9('0xe4')],'as':_0x92d9('0x127'),'required':![]}];}return db[_0x92d9('0x126')]['findAll'](_0x292e7c);})['then'](function(_0x10caaf){_0x2cf33e['rows']=_0x10caaf;return _0x2cf33e;});}})[_0x92d9('0x1c')](respondWithFilteredResult(_0x3bb83b,_0x292e7c))[_0x92d9('0x26')](handleError(_0x3bb83b,null));};exports[_0x92d9('0x128')]=function(_0x1b0cfc,_0x50e9e9){return db['ChatWebsite'][_0x92d9('0x6e')]({'where':{'id':_0x1b0cfc[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x50e9e9,null))[_0x92d9('0x1c')](function(_0x2832af){if(_0x2832af){return _0x2832af['addAgents'](_0x1b0cfc['body']['ids'],_['omit'](_0x1b0cfc[_0x92d9('0x65')],[_0x92d9('0x79'),'id'])||{})['spread'](function(_0x3addb5){for(var _0x3ef666=0x0;_0x3ef666<_0x1b0cfc[_0x92d9('0x65')][_0x92d9('0x79')][_0x92d9('0x55')];_0x3ef666+=0x1){socket[_0x92d9('0x129')]('userChatWebsite:save',{'UserId':Number(_0x1b0cfc[_0x92d9('0x65')]['ids'][_0x3ef666]),'ChatWebsiteId':Number(_0x1b0cfc[_0x92d9('0x62')]['id'])});}return _0x3addb5;});}})[_0x92d9('0x1c')](respondWithResult(_0x50e9e9,null))['catch'](handleError(_0x50e9e9,null));};exports[_0x92d9('0x12a')]=function(_0x307f0f,_0x241220){return db[_0x92d9('0x4b')]['find']({'where':{'id':_0x307f0f[_0x92d9('0x62')]['id']}})[_0x92d9('0x1c')](handleEntityNotFound(_0x241220,null))[_0x92d9('0x1c')](function(_0x445954){if(_0x445954){return _0x445954[_0x92d9('0x12a')](_0x307f0f[_0x92d9('0x4f')]['ids'])[_0x92d9('0x1c')](function(){if(_[_0x92d9('0x12b')](_0x307f0f[_0x92d9('0x4f')][_0x92d9('0x79')])){for(var _0x277733=0x0;_0x277733<_0x307f0f[_0x92d9('0x4f')]['ids']['length'];_0x277733+=0x1){socket[_0x92d9('0x129')](_0x92d9('0x12c'),{'UserId':Number(_0x307f0f[_0x92d9('0x4f')][_0x92d9('0x79')][_0x277733]),'ChatWebsiteId':Number(_0x307f0f[_0x92d9('0x62')]['id'])});}}else{socket[_0x92d9('0x129')](_0x92d9('0x12c'),{'UserId':Number(_0x307f0f[_0x92d9('0x4f')][_0x92d9('0x79')]),'ChatWebsiteId':Number(_0x307f0f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x241220,null))['catch'](handleError(_0x241220,null));};exports['getAgents']=function(_0x3cfdf0,_0x172f64){var _0x5880eb={};var _0x2e08dd={};var _0xd437e1;var _0x2a0dff;return db[_0x92d9('0x4b')]['findOne']({'where':{'id':_0x3cfdf0['params']['id']}})['then'](handleEntityNotFound(_0x172f64,null))[_0x92d9('0x1c')](function(_0x375162){if(_0x375162){_0xd437e1=_0x375162;_0x2e08dd[_0x92d9('0x45')]=_['keys'](db[_0x92d9('0xc5')]['rawAttributes']);_0x2e08dd[_0x92d9('0x4f')]=_[_0x92d9('0x50')](_0x3cfdf0[_0x92d9('0x4f')]);_0x2e08dd[_0x92d9('0x51')]=_[_0x92d9('0x52')](_0x2e08dd['model'],_0x2e08dd[_0x92d9('0x4f')]);_0x5880eb[_0x92d9('0x53')]=_[_0x92d9('0x52')](_0x2e08dd[_0x92d9('0x45')],qs['fields'](_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x54')]));_0x5880eb[_0x92d9('0x53')]=_0x5880eb[_0x92d9('0x53')][_0x92d9('0x55')]?_0x5880eb[_0x92d9('0x53')]:_0x2e08dd[_0x92d9('0x45')];_0x5880eb['order']=qs[_0x92d9('0x56')](_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x56')]);_0x5880eb['where']=qs['filters'](_[_0x92d9('0x7d')](_0x3cfdf0[_0x92d9('0x4f')],_0x2e08dd[_0x92d9('0x51')]));if(_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x59')]){_0x5880eb['where']=_['merge'](_0x5880eb['where'],{'$or':_[_0x92d9('0x4e')](_0x5880eb[_0x92d9('0x53')],function(_0x25f0d0){var _0x297aee={};_0x297aee[_0x25f0d0]={'$like':'%'+_0x3cfdf0['query']['filter']+'%'};return _0x297aee;})});}_0x5880eb=_['merge']({},_0x5880eb,_0x3cfdf0['options']);return _0xd437e1[_0x92d9('0x12d')](_0x5880eb);}})[_0x92d9('0x1c')](function(_0x15b3d4){if(_0x15b3d4){_0x2a0dff=_0x15b3d4[_0x92d9('0x55')];if(!_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x76')](_0x92d9('0x77'))){_0x5880eb['limit']=qs[_0x92d9('0x2d')](_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x2d')]);_0x5880eb[_0x92d9('0x2b')]=qs[_0x92d9('0x2b')](_0x3cfdf0[_0x92d9('0x4f')][_0x92d9('0x2b')]);}return _0xd437e1[_0x92d9('0x12d')](_0x5880eb);}})[_0x92d9('0x1c')](function(_0x2fa851){if(_0x2fa851){return _0x2fa851?{'count':_0x2a0dff,'rows':_0x2fa851}:null;}})[_0x92d9('0x1c')](respondWithResult(_0x172f64,null))[_0x92d9('0x26')](handleError(_0x172f64,null));}; \ No newline at end of file +var _0xa9e0=['handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','ChatWebsites','UserProfileResource','name','send','user-agent-parser','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','rows','show','options','create','testWildcardValidity','address','body','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','nolimit','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','filename','file','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','notify','from','mapKey','isEmpty','Body\x20is\x20mandatory','customerIp','CmContact','updatedAt','includes','createdAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','Contacts','DESC','ChatApplication','Applications','Intervals','interval','account','applications','orderBy','priority','list','defaults','contact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','findOrCreate','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','mimetype','files','attachments','basename','openNewInteraction','transaction','bulkCreate','MailAccount','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','MailAccountId','subjectOffline','toPairsIn','email','lastName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','fullname','internal','Tag','color','tag','getSnippet','getProactiveActions','virtual','increment','chatLicenseExceeded','timezone','replace','origin','headers','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var Mustache=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a9e('0x3'));var querystring=require('querystring');var htmlToText=require(_0x0a9e('0x4'));var Redis=require(_0x0a9e('0x5'));var jayson=require(_0x0a9e('0x6'));var qs=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');var config=require(_0x0a9e('0x9'));var APIBadRequestError=require(_0x0a9e('0xa'))[_0x0a9e('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIOutOfIntervalError=require(_0x0a9e('0xa'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0x0a9e('0xc')];var APIConflictError=require(_0x0a9e('0xa'))[_0x0a9e('0xd')];var wildcardUtils=require(_0x0a9e('0xe'));var URL=require(_0x0a9e('0xf'))[_0x0a9e('0x10')];var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0a9e('0x11'),'port':0x18eb});var socket=require(_0x0a9e('0x12'))(new Redis(config[_0x0a9e('0x13')]));require(_0x0a9e('0x14'))[_0x0a9e('0x15')](socket);var client=jayson[_0x0a9e('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});var client9003=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232b});var client9001=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return new Promise(function(_0x519dfd,_0x16033c){var _0x12066b=_0x1985b6||client;return _0x12066b['request'](_0x52a03d,_0x5d0880)[_0x0a9e('0x18')](function(_0x5a0a06){logger[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x22dccb,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')](_0x0a9e('0x1d'),_0x22dccb,_0x0a9e('0x1b'),JSON[_0x0a9e('0x1e')](_0x5a0a06));if(_0x5a0a06[_0x0a9e('0x1f')]){if(_0x5a0a06[_0x0a9e('0x1f')][_0x0a9e('0x20')]===0x1f4){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x21')]);return _0x16033c(_0x5a0a06[_0x0a9e('0x1f')]['message']);}logger[_0x0a9e('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x22dccb,_0x5a0a06['error'][_0x0a9e('0x21')]);return _0x519dfd(_0x5a0a06[_0x0a9e('0x1f')][_0x0a9e('0x21')]);}else{logger[_0x0a9e('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x22dccb,_0x0a9e('0x1b'));_0x519dfd(_0x5a0a06[_0x0a9e('0x22')][_0x0a9e('0x21')]);}})[_0x0a9e('0x23')](function(_0x370d86){logger[_0x0a9e('0x1f')](_0x0a9e('0x1a'),_0x22dccb,_0x370d86);_0x16033c(_0x370d86);});});}function respondWithStatusCode(_0x5ea472,_0x59181e){_0x59181e=_0x59181e||0xcc;return function(_0x197ec0){if(_0x197ec0){return _0x5ea472[_0x0a9e('0x24')](_0x59181e);}return _0x5ea472[_0x0a9e('0x25')](_0x59181e)[_0x0a9e('0x26')]();};}function respondWithResult(_0x526cf3,_0x384319){_0x384319=_0x384319||0xc8;return function(_0x479bc4){if(_0x479bc4){return _0x526cf3[_0x0a9e('0x25')](_0x384319)['json'](_0x479bc4);}};}function respondWithFilteredResult(_0x1dc186,_0x34dc65){return function(_0x25fba9){if(_0x25fba9){var _0x14433c=typeof _0x34dc65[_0x0a9e('0x27')]===_0x0a9e('0x28')&&typeof _0x34dc65[_0x0a9e('0x29')]===_0x0a9e('0x28');var _0x5a101a=_0x25fba9[_0x0a9e('0x2a')];var _0x468813=_0x14433c?0x0:_0x34dc65[_0x0a9e('0x27')];var _0x2ec755=_0x14433c?_0x25fba9['count']:_0x34dc65[_0x0a9e('0x27')]+_0x34dc65[_0x0a9e('0x29')];var _0x1843b2;if(_0x2ec755>=_0x5a101a){_0x2ec755=_0x5a101a;_0x1843b2=0xc8;}else{_0x1843b2=0xce;}_0x1dc186[_0x0a9e('0x25')](_0x1843b2);return _0x1dc186[_0x0a9e('0x2b')](_0x0a9e('0x2c'),_0x468813+'-'+_0x2ec755+'/'+_0x5a101a)[_0x0a9e('0x2d')](_0x25fba9);}return null;};}function saveUpdates(_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x2e8759)[_0x0a9e('0x18')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x2e')]()[_0x0a9e('0x18')](function(){var _0x25ce3a=_0x3ae878['get']({'plain':!![]});var _0x66c1d2=_0x0a9e('0x2f');return db[_0x0a9e('0x30')][_0x0a9e('0x2e')]({'where':{'type':_0x66c1d2,'resourceId':_0x25ce3a['id']}})[_0x0a9e('0x18')](function(){return _0x3ae878;});})[_0x0a9e('0x18')](function(){_0x2407f9[_0x0a9e('0x25')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x5583a4){return function(_0x44295a){if(!_0x44295a){_0x5583a4['sendStatus'](0x194);}return _0x44295a;};}function handleError(_0x2cc7a0,_0x14b13f){_0x14b13f=_0x14b13f||0x1f4;return function(_0x2b7e7f){logger[_0x0a9e('0x1f')](_0x2b7e7f['stack']);if(_0x2b7e7f[_0x0a9e('0x31')]){delete _0x2b7e7f[_0x0a9e('0x31')];}_0x2cc7a0[_0x0a9e('0x25')](_0x14b13f)[_0x0a9e('0x32')](_0x2b7e7f);};}function createInteractionObject(_0x4853b1,_0x54135e,_0x1e8694,_0x5640eb){var _0x24936a=require(_0x0a9e('0x33'));var _0x381c37=new _0x24936a();var _0x1ef87a=_0x381c37['setUA'](_0x1e8694[_0x0a9e('0x34')])[_0x0a9e('0x35')]();var _0x3cae=_0x54135e['customerIp'];if(_0x1e8694[_0x0a9e('0x36')]){_0x3cae=_0x1e8694[_0x0a9e('0x36')];}else if(_0x1e8694[_0x0a9e('0x37')]){_0x3cae=_['first'](_0x1e8694['x-forwarded-for'][_0x0a9e('0x38')](','));}return{'ContactId':_0x5640eb['id'],'ChatWebsiteId':_0x4853b1,'from':(_0x5640eb[_0x0a9e('0x39')]||'')+'\x20'+(_0x5640eb['lastName']||''),'customerIp':_0x3cae,'customerPort':_0x1e8694[_0x0a9e('0x3a')]?_0x1e8694[_0x0a9e('0x3a')]:null,'referer':_0x54135e[_0x0a9e('0x3b')],'browserName':_0x1ef87a[_0x0a9e('0x3c')]['name']&&_0x1ef87a['browser'][_0x0a9e('0x3d')]?util[_0x0a9e('0x3e')]('%s\x20%s',_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x31')],_0x1ef87a[_0x0a9e('0x3c')]['version']):_0x0a9e('0x3f'),'browserVersion':_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3d')]||_0x0a9e('0x3f'),'osName':util[_0x0a9e('0x3e')](_0x0a9e('0x40'),_0x1ef87a['os'][_0x0a9e('0x31')],_0x1ef87a['os'][_0x0a9e('0x3d')]),'osVersion':_0x1ef87a['os'][_0x0a9e('0x3d')],'deviceModel':_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x42')]&&_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x43')]?util[_0x0a9e('0x3e')](_0x0a9e('0x44'),_0x1ef87a['device']['model'],_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x43')],_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x45')]):null,'deviceVendor':_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x43')],'deviceType':_0x1ef87a[_0x0a9e('0x41')][_0x0a9e('0x45')],'formData':JSON[_0x0a9e('0x1e')](_0x54135e)};}exports[_0x0a9e('0x46')]=function(_0x2c2cb0,_0x35ed4a){var _0x5026aa={'include':[{'model':db[_0x0a9e('0x47')],'as':_0x0a9e('0x48')}]},_0x117c99={},_0x138b8b={'count':0x0,'rows':[]};var _0x2e8caf=_[_0x0a9e('0x49')](db[_0x0a9e('0x4a')][_0x0a9e('0x4b')],function(_0x59afe8){return{'name':_0x59afe8[_0x0a9e('0x4c')],'type':_0x59afe8['type'][_0x0a9e('0x4d')]};});_0x117c99[_0x0a9e('0x42')]=_[_0x0a9e('0x49')](_0x2e8caf,'name');_0x117c99[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x2c2cb0[_0x0a9e('0x4e')]);_0x117c99[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x117c99[_0x0a9e('0x42')],_0x117c99[_0x0a9e('0x4e')]);_0x5026aa['attributes']=_[_0x0a9e('0x51')](_0x117c99[_0x0a9e('0x42')],qs[_0x0a9e('0x52')](_0x2c2cb0[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x5026aa[_0x0a9e('0x53')]=_0x5026aa[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0x5026aa[_0x0a9e('0x53')]:_0x117c99['model'];if(!_0x2c2cb0[_0x0a9e('0x4e')][_0x0a9e('0x55')]('nolimit')){_0x5026aa['limit']=qs['limit'](_0x2c2cb0[_0x0a9e('0x4e')][_0x0a9e('0x29')]);_0x5026aa[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2c2cb0[_0x0a9e('0x4e')][_0x0a9e('0x27')]);}_0x5026aa[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x2c2cb0['query']['sort']);_0x5026aa['where']=qs[_0x0a9e('0x50')](_[_0x0a9e('0x58')](_0x2c2cb0[_0x0a9e('0x4e')],_0x117c99['filters']),_0x2e8caf);if(_0x2c2cb0[_0x0a9e('0x4e')][_0x0a9e('0x59')]){_0x5026aa['where']=_['merge'](_0x5026aa[_0x0a9e('0x5a')],{'$or':_['map'](_0x2e8caf,function(_0x443e72){if(_0x443e72['type']!==_0x0a9e('0x5b')){var _0x3c20b2={};_0x3c20b2[_0x443e72[_0x0a9e('0x31')]]={'$like':'%'+_0x2c2cb0['query'][_0x0a9e('0x59')]+'%'};return _0x3c20b2;}})});}_0x5026aa=_[_0x0a9e('0x5c')]({},_0x5026aa,_0x2c2cb0['options']);var _0x50f687={'where':_0x5026aa[_0x0a9e('0x5a')]};return db[_0x0a9e('0x4a')]['count'](_0x50f687)[_0x0a9e('0x18')](function(_0x5ce9ac){_0x138b8b[_0x0a9e('0x2a')]=_0x5ce9ac;if(_0x2c2cb0['query'][_0x0a9e('0x5d')]){_0x5026aa['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x5026aa);})[_0x0a9e('0x18')](function(_0x47de4c){_0x138b8b[_0x0a9e('0x5e')]=_0x47de4c;return _0x138b8b;})[_0x0a9e('0x18')](respondWithFilteredResult(_0x35ed4a,_0x5026aa))[_0x0a9e('0x23')](handleError(_0x35ed4a,null));};exports[_0x0a9e('0x5f')]=function(_0x232830,_0x272738){var _0xd10662={'raw':![],'where':{'id':_0x232830['params']['id']},'include':[{'model':db[_0x0a9e('0x47')],'as':_0x0a9e('0x48')}]},_0x28d814={};_0x28d814[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0x4a')][_0x0a9e('0x4b')]);_0x28d814['query']=_[_0x0a9e('0x4f')](_0x232830[_0x0a9e('0x4e')]);_0x28d814['filters']=_[_0x0a9e('0x51')](_0x28d814['model'],_0x28d814[_0x0a9e('0x4e')]);_0xd10662['attributes']=_['intersection'](_0x28d814['model'],qs[_0x0a9e('0x52')](_0x232830['query'][_0x0a9e('0x52')]));_0xd10662[_0x0a9e('0x53')]=_0xd10662[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0xd10662[_0x0a9e('0x53')]:_0x28d814[_0x0a9e('0x42')];if(_0x232830['query'][_0x0a9e('0x5d')]){_0xd10662['include']=[{'all':!![]}];}_0xd10662=_[_0x0a9e('0x5c')]({},_0xd10662,_0x232830[_0x0a9e('0x60')]);return db[_0x0a9e('0x4a')]['find'](_0xd10662)[_0x0a9e('0x18')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x18')](respondWithResult(_0x272738,null))[_0x0a9e('0x23')](handleError(_0x272738,null));};exports[_0x0a9e('0x61')]=function(_0x497d91,_0x1d0dc8){if(!wildcardUtils[_0x0a9e('0x62')](_0x497d91['body'][_0x0a9e('0x63')])){return handleError(_0x1d0dc8,null)(new APIBadRequestError('\x22'+_0x497d91[_0x0a9e('0x64')][_0x0a9e('0x63')]+_0x0a9e('0x65')));}return db[_0x0a9e('0x4a')]['create'](_0x497d91[_0x0a9e('0x64')],{})[_0x0a9e('0x18')](function(_0x281c7d){var _0x47bb43=_0x497d91[_0x0a9e('0x66')]['get']({'plain':!![]});if(!_0x47bb43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47bb43[_0x0a9e('0x67')]===_0x0a9e('0x66')){var _0x9375fb=_0x281c7d[_0x0a9e('0x68')]({'plain':!![]});var _0x186f39=_0x0a9e('0x2f');return db[_0x0a9e('0x69')][_0x0a9e('0x6a')]({'where':{'name':_0x186f39,'userProfileId':_0x47bb43[_0x0a9e('0x6b')]},'raw':!![]})[_0x0a9e('0x18')](function(_0x2e89b7){if(_0x2e89b7&&_0x2e89b7[_0x0a9e('0x6c')]===0x0){return db[_0x0a9e('0x30')][_0x0a9e('0x61')]({'name':_0x9375fb[_0x0a9e('0x31')],'resourceId':_0x9375fb['id'],'type':_0x2e89b7[_0x0a9e('0x31')],'sectionId':_0x2e89b7['id']},{})[_0x0a9e('0x18')](function(){return _0x281c7d;});}else{return _0x281c7d;}})[_0x0a9e('0x23')](function(_0x5150a4){logger[_0x0a9e('0x1f')](_0x0a9e('0x6d'),_0x5150a4);throw _0x5150a4;});}return _0x281c7d;})[_0x0a9e('0x18')](respondWithResult(_0x1d0dc8,0xc9))['catch'](handleError(_0x1d0dc8,null));};exports[_0x0a9e('0x6e')]=function(_0x30944e,_0x4b341d){if(!wildcardUtils[_0x0a9e('0x62')](_0x30944e[_0x0a9e('0x64')][_0x0a9e('0x63')])){return handleError(_0x4b341d,null)(new APIBadRequestError('\x22'+_0x30944e[_0x0a9e('0x64')][_0x0a9e('0x63')]+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}if(_0x30944e['body']['id']){delete _0x30944e['body']['id'];}return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x30944e[_0x0a9e('0x6f')]['id']},'include':[{'model':db[_0x0a9e('0x47')],'as':_0x0a9e('0x48')}]})[_0x0a9e('0x18')](handleEntityNotFound(_0x4b341d,null))[_0x0a9e('0x18')](saveUpdates(_0x30944e[_0x0a9e('0x64')],null))['then'](respondWithResult(_0x4b341d,null))[_0x0a9e('0x23')](handleError(_0x4b341d,null));};exports[_0x0a9e('0x2e')]=function(_0x12ccdb,_0x4a4fc7){return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x12ccdb[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x4a4fc7,null))['then'](removeEntity(_0x4a4fc7,null))[_0x0a9e('0x23')](handleError(_0x4a4fc7,null));};exports[_0x0a9e('0x70')]=function(_0x2cc7a7,_0x317c0c){return db['ChatWebsite'][_0x0a9e('0x70')]()[_0x0a9e('0x18')](respondWithResult(_0x317c0c,null))[_0x0a9e('0x23')](handleError(_0x317c0c,null));};exports[_0x0a9e('0x71')]=function(_0x5b7fc3,_0x109ccb){if(_0x5b7fc3[_0x0a9e('0x64')]['id']){delete _0x5b7fc3[_0x0a9e('0x64')]['id'];}return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x5b7fc3[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x109ccb,null))[_0x0a9e('0x18')](function(_0xf410e5){if(_0xf410e5){_0x5b7fc3[_0x0a9e('0x64')][_0x0a9e('0x72')]=_0xf410e5['id'];return db[_0x0a9e('0x73')][_0x0a9e('0x61')](_0x5b7fc3[_0x0a9e('0x64')]);}})[_0x0a9e('0x18')](respondWithResult(_0x109ccb,null))[_0x0a9e('0x23')](handleError(_0x109ccb,null));};exports[_0x0a9e('0x74')]=function(_0x25744a,_0xe0749e){var _0x5b35db={'raw':![],'where':{}};var _0xf4120f={};var _0x11da9c={'count':0x0,'rows':[]};return db[_0x0a9e('0x4a')]['findOne']({'where':{'id':_0x25744a[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0xe0749e,null))[_0x0a9e('0x18')](function(_0x2b9463){if(_0x2b9463){_0xf4120f['model']=_['keys'](db[_0x0a9e('0x73')][_0x0a9e('0x4b')]);_0xf4120f['query']=_[_0x0a9e('0x4f')](_0x25744a['query']);_0xf4120f[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0xf4120f['model'],_0xf4120f[_0x0a9e('0x4e')]);_0x5b35db[_0x0a9e('0x53')]=_[_0x0a9e('0x51')](_0xf4120f[_0x0a9e('0x42')],qs[_0x0a9e('0x52')](_0x25744a[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x5b35db['attributes']=_0x5b35db[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0x5b35db[_0x0a9e('0x53')]:_0xf4120f[_0x0a9e('0x42')];if(!_0x25744a['query'][_0x0a9e('0x55')](_0x0a9e('0x75'))){_0x5b35db['limit']=qs[_0x0a9e('0x29')](_0x25744a['query'][_0x0a9e('0x29')]);_0x5b35db[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x25744a[_0x0a9e('0x4e')]['offset']);}_0x5b35db['order']=qs[_0x0a9e('0x57')](_0x25744a[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x5b35db['where']=qs[_0x0a9e('0x50')](_[_0x0a9e('0x58')](_0x25744a['query'],_0xf4120f['filters']));_0x5b35db[_0x0a9e('0x5a')]['ChatWebsiteId']=_0x2b9463['id'];if(_0x25744a['query']['filter']){_0x5b35db[_0x0a9e('0x5a')]=_[_0x0a9e('0x5c')](_0x5b35db[_0x0a9e('0x5a')],{'$or':_[_0x0a9e('0x49')](_0x5b35db[_0x0a9e('0x53')],function(_0x2600de){var _0x5a8854={};_0x5a8854[_0x2600de]={'$like':'%'+_0x25744a[_0x0a9e('0x4e')]['filter']+'%'};return _0x5a8854;})});}_0x5b35db=_[_0x0a9e('0x5c')]({},_0x5b35db,_0x25744a[_0x0a9e('0x60')]);return db[_0x0a9e('0x73')][_0x0a9e('0x2a')]({'where':_0x5b35db['where']})[_0x0a9e('0x18')](function(_0x32f761){_0x11da9c[_0x0a9e('0x2a')]=_0x32f761;if(_0x25744a['query'][_0x0a9e('0x5d')]){_0x5b35db[_0x0a9e('0x76')]=[{'all':!![]}];}return db[_0x0a9e('0x73')][_0x0a9e('0x77')](_0x5b35db);})[_0x0a9e('0x18')](function(_0x1910bf){_0x11da9c[_0x0a9e('0x5e')]=_0x1910bf;return _0x11da9c;});}})[_0x0a9e('0x18')](respondWithFilteredResult(_0xe0749e,_0x5b35db))['catch'](handleError(_0xe0749e,null));};exports[_0x0a9e('0x78')]=function(_0x3325c5,_0x589ff3){return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x3325c5[_0x0a9e('0x6f')]['id']}})['then'](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x18')](function(_0x52ec10){if(_0x52ec10){return _0x52ec10[_0x0a9e('0x78')](_0x3325c5[_0x0a9e('0x4e')][_0x0a9e('0x79')]);}})[_0x0a9e('0x18')](respondWithStatusCode(_0x589ff3,null))[_0x0a9e('0x23')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x7a')]=function(_0x16a039,_0x3a9a85){if(_0x16a039['body']['id']){delete _0x16a039[_0x0a9e('0x64')]['id'];}return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x16a039[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x3a9a85,null))[_0x0a9e('0x18')](function(_0x6803d6){if(_0x6803d6){_0x16a039[_0x0a9e('0x64')][_0x0a9e('0x72')]=_0x6803d6['id'];return db[_0x0a9e('0x7b')][_0x0a9e('0x61')](_0x16a039[_0x0a9e('0x64')]);}})[_0x0a9e('0x18')](respondWithResult(_0x3a9a85,null))['catch'](handleError(_0x3a9a85,null));};exports[_0x0a9e('0x7c')]=function(_0x23e2bd,_0x12843d){var _0x2ed526={'raw':![],'where':{}};var _0xb0599a={};var _0x5d9ddb={'count':0x0,'rows':[]};return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x23e2bd['params']['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x12843d,null))['then'](function(_0x45d113){if(_0x45d113){_0xb0599a[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0x7b')]['rawAttributes']);_0xb0599a[_0x0a9e('0x4e')]=_['keys'](_0x23e2bd[_0x0a9e('0x4e')]);_0xb0599a[_0x0a9e('0x50')]=_['intersection'](_0xb0599a[_0x0a9e('0x42')],_0xb0599a[_0x0a9e('0x4e')]);_0x2ed526[_0x0a9e('0x53')]=_['intersection'](_0xb0599a['model'],qs[_0x0a9e('0x52')](_0x23e2bd[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x2ed526[_0x0a9e('0x53')]=_0x2ed526[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0x2ed526[_0x0a9e('0x53')]:_0xb0599a[_0x0a9e('0x42')];if(!_0x23e2bd[_0x0a9e('0x4e')]['hasOwnProperty'](_0x0a9e('0x75'))){_0x2ed526['limit']=qs[_0x0a9e('0x29')](_0x23e2bd[_0x0a9e('0x4e')][_0x0a9e('0x29')]);_0x2ed526[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x23e2bd['query'][_0x0a9e('0x27')]);}_0x2ed526[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x23e2bd[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x2ed526['where']=qs['filters'](_[_0x0a9e('0x58')](_0x23e2bd['query'],_0xb0599a[_0x0a9e('0x50')]));_0x2ed526[_0x0a9e('0x5a')][_0x0a9e('0x72')]=_0x45d113['id'];if(_0x23e2bd[_0x0a9e('0x4e')][_0x0a9e('0x59')]){_0x2ed526[_0x0a9e('0x5a')]=_['merge'](_0x2ed526['where'],{'$or':_[_0x0a9e('0x49')](_0x2ed526['attributes'],function(_0x2469d1){var _0x5c689c={};_0x5c689c[_0x2469d1]={'$like':'%'+_0x23e2bd[_0x0a9e('0x4e')]['filter']+'%'};return _0x5c689c;})});}_0x2ed526=_['merge']({},_0x2ed526,_0x23e2bd[_0x0a9e('0x60')]);return db[_0x0a9e('0x7b')]['count']({'where':_0x2ed526[_0x0a9e('0x5a')]})[_0x0a9e('0x18')](function(_0x15c6b9){_0x5d9ddb[_0x0a9e('0x2a')]=_0x15c6b9;if(_0x23e2bd[_0x0a9e('0x4e')]['includeAll']){_0x2ed526['include']=[{'all':!![]}];}return db[_0x0a9e('0x7b')][_0x0a9e('0x77')](_0x2ed526);})[_0x0a9e('0x18')](function(_0x24beb6){_0x5d9ddb[_0x0a9e('0x5e')]=_0x24beb6;return _0x5d9ddb;});}})['then'](respondWithFilteredResult(_0x12843d,_0x2ed526))[_0x0a9e('0x23')](handleError(_0x12843d,null));};exports[_0x0a9e('0x7e')]=function(_0x5416a9,_0x3c313d){return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x5416a9[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x3c313d,null))[_0x0a9e('0x18')](function(_0x1ef1b0){if(_0x1ef1b0){return _0x1ef1b0[_0x0a9e('0x7e')](_0x5416a9[_0x0a9e('0x4e')][_0x0a9e('0x79')]);}})['then'](respondWithStatusCode(_0x3c313d,null))[_0x0a9e('0x23')](handleError(_0x3c313d,null));};exports[_0x0a9e('0x7f')]=function(_0x2ada60,_0x1c4232){_0x2ada60[_0x0a9e('0x64')]['sitepic']=_0x2ada60['file'][_0x0a9e('0x80')];return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x2ada60[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x1c4232,null))['then'](saveUpdates(_0x2ada60[_0x0a9e('0x64')],null))[_0x0a9e('0x18')](respondWithResult(_0x1c4232,null))[_0x0a9e('0x23')](handleError(_0x1c4232,null));};exports['addAvatar']=function(_0x318fc3,_0x59aa7b){_0x318fc3[_0x0a9e('0x64')]['agentAvatar']=_0x318fc3[_0x0a9e('0x81')][_0x0a9e('0x80')];return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x318fc3[_0x0a9e('0x6f')]['id']}})['then'](handleEntityNotFound(_0x59aa7b,null))[_0x0a9e('0x18')](saveUpdates(_0x318fc3[_0x0a9e('0x64')],null))[_0x0a9e('0x18')](respondWithResult(_0x59aa7b,null))[_0x0a9e('0x23')](handleError(_0x59aa7b,null));};exports[_0x0a9e('0x82')]=function(_0x1bee04,_0x4014c7){_0x1bee04[_0x0a9e('0x64')][_0x0a9e('0x83')]=_0x1bee04[_0x0a9e('0x81')][_0x0a9e('0x80')];return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x1bee04[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x4014c7,null))[_0x0a9e('0x18')](saveUpdates(_0x1bee04['body'],null))['then'](respondWithResult(_0x4014c7,null))[_0x0a9e('0x23')](handleError(_0x4014c7,null));};exports['addSystemAvatar']=function(_0x1d999b,_0x3428c9){_0x1d999b['body'][_0x0a9e('0x84')]=_0x1d999b[_0x0a9e('0x81')][_0x0a9e('0x80')];return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x1d999b[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x3428c9,null))[_0x0a9e('0x18')](saveUpdates(_0x1d999b[_0x0a9e('0x64')],null))['then'](respondWithResult(_0x3428c9,null))[_0x0a9e('0x23')](handleError(_0x3428c9,null));};exports[_0x0a9e('0x85')]=function(_0x2b7092,_0x5c838b){var _0x2650eb=path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],'server/files/images/logos/default_logo.svg');var _0x303f75={'where':{'id':_0x2b7092[_0x0a9e('0x6f')]['id']},'attributes':['id',_0x0a9e('0x88')],'raw':!![]};var _0x1a7f58=![];return require(_0x0a9e('0x89'))['getLicense']()[_0x0a9e('0x18')](function(_0x289e65){if(_0x289e65){_0x1a7f58=_0x289e65['custom'];}})[_0x0a9e('0x18')](function(){return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')](_0x303f75);})['then'](handleEntityNotFound(_0x5c838b,null))['then'](function(_0x523d08){if(_0x523d08){if(!_[_0x0a9e('0x8a')](_0x523d08[_0x0a9e('0x88')])){if(fs['existsSync'](path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x8b'),_0x523d08['sitepic']))&&_0x1a7f58){_0x2650eb=path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x8b'),_0x523d08[_0x0a9e('0x88')]);}}return _0x5c838b[_0x0a9e('0x8c')](_0x2650eb);}})[_0x0a9e('0x23')](handleError(_0x5c838b,null));};exports[_0x0a9e('0x8d')]=function(_0x328ec5,_0x3b5bda){var _0x5a1848=path[_0x0a9e('0x86')](config['root'],_0x0a9e('0x8e'));var _0x4093e6={'where':{'id':_0x328ec5[_0x0a9e('0x6f')]['id']},'attributes':['id',_0x0a9e('0x8f')],'raw':!![]};return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')](_0x4093e6)['then'](handleEntityNotFound(_0x3b5bda,null))[_0x0a9e('0x18')](function(_0x33da81){if(_0x33da81){if(!_[_0x0a9e('0x8a')](_0x33da81[_0x0a9e('0x8f')])){if(fs['existsSync'](path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x33da81[_0x0a9e('0x8f')]))){_0x5a1848=path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x33da81[_0x0a9e('0x8f')]);}}return _0x3b5bda[_0x0a9e('0x8c')](_0x5a1848);}})[_0x0a9e('0x23')](handleError(_0x3b5bda,null));};exports['getCustomerAvatar']=function(_0x2272bc,_0x88b25f){var _0x2ff265=path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x91'));var _0x2895c5={'where':{'id':_0x2272bc[_0x0a9e('0x6f')]['id']},'attributes':['id','customerAvatar',_0x0a9e('0x92')],'raw':!![]};return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')](_0x2895c5)['then'](handleEntityNotFound(_0x88b25f,null))[_0x0a9e('0x18')](function(_0x41e446){if(_0x41e446){if(!_[_0x0a9e('0x8a')](_0x41e446[_0x0a9e('0x83')])){if(fs[_0x0a9e('0x93')](path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x41e446[_0x0a9e('0x83')]))&&_0x41e446[_0x0a9e('0x92')]){_0x2ff265=path['join'](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x41e446[_0x0a9e('0x83')]);}}return _0x88b25f[_0x0a9e('0x8c')](_0x2ff265);}})[_0x0a9e('0x23')](handleError(_0x88b25f,null));};exports[_0x0a9e('0x94')]=function(_0x5cb48d,_0x382687){var _0x4f854b=path['join'](config['root'],_0x0a9e('0x95'));var _0x3fa3f2={'where':{'id':_0x5cb48d[_0x0a9e('0x6f')]['id']},'attributes':['id',_0x0a9e('0x84')],'raw':!![]};return db['ChatWebsite'][_0x0a9e('0x6a')](_0x3fa3f2)[_0x0a9e('0x18')](handleEntityNotFound(_0x382687,null))[_0x0a9e('0x18')](function(_0x1fdb10){if(_0x1fdb10){if(!_[_0x0a9e('0x8a')](_0x1fdb10['systemAvatar'])){if(fs['existsSync'](path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x1fdb10['systemAvatar']))){_0x4f854b=path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],_0x0a9e('0x90'),_0x1fdb10['systemAvatar']);}}return _0x382687[_0x0a9e('0x8c')](_0x4f854b);}})[_0x0a9e('0x23')](handleError(_0x382687,null));};function checkWebsiteInterval(_0x15ba6b){var _0x4eda8f=_0x15ba6b[_0x0a9e('0x96')];if(!_0x4eda8f){return Promise[_0x0a9e('0x97')](_0x15ba6b);}var _0x3b7213=_0x15ba6b['timezone']||undefined;return _0x4eda8f['ifTime'](_0x3b7213)['then'](function(_0x3b04fd){if(!_0x3b04fd){throw new APIOutOfIntervalError();}return _0x15ba6b;});}exports[_0x0a9e('0x98')]=function(_0xcbc73c,_0x26931c){var _0x5d83fd={'body':_0xcbc73c[_0x0a9e('0x64')],'channel':'chat'};var _0x3b4af9=[];var _0x2ff2ab=[];var _0x242f23={};var _0x57f673=![];if(_0xcbc73c[_0x0a9e('0x64')]['id']){delete _0xcbc73c[_0x0a9e('0x64')]['id'];}if(_[_0x0a9e('0x8a')](_0xcbc73c['body'][_0x0a9e('0x99')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x0a9e('0x8a')](_0xcbc73c['body'][_0x0a9e('0x9a')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x0a9e('0x9b')](_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x64')])){throw new APIBadRequestError(_0x0a9e('0x9c'));}var _0x1e306c=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x9d')]&&_0xcbc73c['body'][_0x0a9e('0x3b')];return db[_0x0a9e('0x9e')]['describe']()[_0x0a9e('0x18')](function(_0x3753ca){if(!_0x3753ca){throw new Error('No\x20available\x20attributes');}_0x3b4af9=Object[_0x0a9e('0x4f')](_0x3753ca)[_0x0a9e('0x59')](function(_0x16b578){return!['createdAt',_0x0a9e('0x9f')][_0x0a9e('0xa0')](_0x16b578);});_0x2ff2ab=Object[_0x0a9e('0x4f')](_0x3753ca)[_0x0a9e('0x59')](function(_0x2003bc){return![_0x0a9e('0xa1'),_0x0a9e('0x9f'),_0x0a9e('0xa2'),_0x0a9e('0xa3')][_0x0a9e('0xa0')](_0x2003bc);});if(!_['includes'](_0x2ff2ab,_0xcbc73c[_0x0a9e('0x64')]['mapKey'])){throw new APIBadRequestError(_0x0a9e('0xa4')+_0x2ff2ab[_0x0a9e('0x86')](',\x20'));}_0x242f23[_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x9a')]]=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x99')];})['then'](function(){return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0xcbc73c[_0x0a9e('0x6f')]['id']},'include':[{'model':db['CmList'],'as':_0x0a9e('0xa5'),'include':[{'model':db[_0x0a9e('0x9e')],'as':_0x0a9e('0xa6'),'where':_0x242f23,'limit':0x1,'order':[[_0x0a9e('0x9f'),_0x0a9e('0xa7')]]}]},{'model':db[_0x0a9e('0xa8')],'as':_0x0a9e('0xa9')},{'model':db['Interval'],'as':_0x0a9e('0x96'),'include':[{'model':db[_0x0a9e('0x96')],'as':_0x0a9e('0xaa'),'attributes':['id',_0x0a9e('0xab')],'raw':!![]}]}]});})[_0x0a9e('0x18')](function(_0x241404){if(!_0x241404){throw new APINotFoundError(util[_0x0a9e('0x3e')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0xcbc73c['params']['id']));}if(_0x1e306c){return checkWebsiteInterval(_0x241404);}return _0x241404;})[_0x0a9e('0x18')](function(_0x3f507c){_0x5d83fd[_0x0a9e('0xac')]=_0x3f507c;_0x5d83fd[_0x0a9e('0xad')]=_[_0x0a9e('0xae')](_0x3f507c[_0x0a9e('0xa9')],[_0x0a9e('0xaf')],['asc']);if(_0x5d83fd[_0x0a9e('0xac')][_0x0a9e('0xa9')]){delete _0x5d83fd[_0x0a9e('0xac')][_0x0a9e('0xa9')];}_0x5d83fd[_0x0a9e('0xb0')]=_0x3f507c[_0x0a9e('0xa5')]||{'id':_0x3f507c[_0x0a9e('0xa3')]};if(_0x5d83fd['list']&&_0x5d83fd[_0x0a9e('0xb0')][_0x0a9e('0xa6')][_0x0a9e('0x54')]){return _0x5d83fd['list'][_0x0a9e('0xa6')][0x0];}var _0x387817=_[_0x0a9e('0xb1')](_0xcbc73c[_0x0a9e('0x64')],{'firstName':_0xcbc73c['body'][_0x0a9e('0x99')],'ListId':_0x3f507c[_0x0a9e('0xa3')]});_0x387817[_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x9a')]]=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x99')];return db[_0x0a9e('0x9e')][_0x0a9e('0x61')](_0x387817,{'fields':_0x3b4af9,'raw':!![]});})['then'](function(_0x3ede01){_0x5d83fd[_0x0a9e('0xb2')]=_0x3ede01;var _0x25e41f=createInteractionObject(_0xcbc73c[_0x0a9e('0x6f')]['id'],_0xcbc73c['body'],_0xcbc73c['headers'],_0x3ede01);var _0x2190b8={'ChatWebsiteId':_0xcbc73c[_0x0a9e('0x6f')]['id']};if(_0xcbc73c[_0x0a9e('0x64')]['threadId']){_0x2190b8[_0x0a9e('0xb3')]=_0xcbc73c[_0x0a9e('0x64')]['threadId'];_0x2190b8[_0x0a9e('0xb4')]=![];return db['ChatInteraction'][_0x0a9e('0x6a')]({'where':_0x2190b8})['then'](function(_0x5b42b9){var _0x48eaa3=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x9d')]&&_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x3b')];if(_0x5b42b9){_0x57f673=!![];return _0x5b42b9;}else if(!_0x48eaa3&&_0x5b42b9&&_0x5b42b9[_0x0a9e('0xb4')]){throw new APIConflictError(_0x0a9e('0xb5'));}_0x25e41f['threadId']=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb3')];_0x25e41f[_0x0a9e('0xb6')]=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb6')];return db[_0x0a9e('0xb7')][_0x0a9e('0x61')](_0x25e41f);});}_0x2190b8['ContactId']=_0x3ede01['id'];if(_0xcbc73c['body'][_0x0a9e('0xb8')]&&_0xcbc73c['body'][_0x0a9e('0xb8')]['id']){_0x2190b8['id']=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb8')]['id'];return db[_0x0a9e('0xb7')][_0x0a9e('0x6a')]({'where':_0x2190b8})[_0x0a9e('0x18')](function(_0x594f25){var _0x4716d1=_0xcbc73c['body']['customerIp']&&_0xcbc73c[_0x0a9e('0x64')]['referer'];if(!_0x4716d1&&_0x594f25&&_0x594f25[_0x0a9e('0xb4')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x594f25){_0x57f673=!![];return _0x594f25;}else{return db['ChatInteraction'][_0x0a9e('0x61')](_0x25e41f);}});}return db['ChatInteraction'][_0x0a9e('0x61')](_0x25e41f);})[_0x0a9e('0x18')](function(_0xe1ab0d){if(!_0x57f673){return _0xe1ab0d;}var _0x48f532={'from':(_0x5d83fd[_0x0a9e('0xb2')][_0x0a9e('0x39')]||'')+'\x20'+(_0x5d83fd[_0x0a9e('0xb2')]['lastName']||'')};if(_0xcbc73c['body'][_0x0a9e('0xb3')]&&_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb9')]&&_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb3')]!=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb9')]){_0x48f532[_0x0a9e('0xb3')]=_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xb9')];}return _0xe1ab0d['update'](_0x48f532);})['then'](function(_0x558171){_0x5d83fd[_0x0a9e('0xb8')]=_0x558171[_0x0a9e('0x68')]({'plain':!![]});_0x5d83fd[_0x0a9e('0xb8')][_0x0a9e('0xba')]=!_0x57f673;if(_0x5d83fd[_0x0a9e('0xb8')][_0x0a9e('0xba')]){if(_0x5d83fd[_0x0a9e('0xac')][_0x0a9e('0xbb')]){_0x5d83fd['applications']['push']({'id':0x0,'priority':_0x5d83fd[_0x0a9e('0xad')][_0x0a9e('0x54')]+0x1,'app':'close','appdata':_0x0a9e('0xbc'),'interval':_0x0a9e('0xbd')});}}return db[_0x0a9e('0xbe')][_0x0a9e('0x61')]({'body':_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0x64')],'ChatWebsiteId':_0xcbc73c[_0x0a9e('0x6f')]['id'],'ChatInteractionId':_0x558171['id'],'direction':'in','ContactId':_0x5d83fd[_0x0a9e('0xb2')]['id'],'AttachmentId':_0xcbc73c[_0x0a9e('0x64')][_0x0a9e('0xbf')]});})[_0x0a9e('0x18')](function(_0x20e191){_0x5d83fd['message']=_0x20e191;if(!_0x5d83fd[_0x0a9e('0xb8')][_0x0a9e('0xc0')]){return;}return db[_0x0a9e('0xc1')][_0x0a9e('0x6a')]({'attributes':['id',_0x0a9e('0x31')],'where':{'id':_0x5d83fd[_0x0a9e('0xb8')][_0x0a9e('0xc0')]}});})[_0x0a9e('0x18')](function(_0x3a9c0f){if(_0x3a9c0f){_0x5d83fd[_0x0a9e('0xad')][_0x0a9e('0xc2')]({'id':0x0,'priority':0x0,'app':_0x0a9e('0xc3'),'appdata':_0x3a9c0f['name']+','+(_0x5d83fd['account'][_0x0a9e('0xc4')]||0xa),'interval':_0x0a9e('0xbd')});_0x5d83fd[_0x0a9e('0xc5')]=!![];}if(!_0x5d83fd[_0x0a9e('0xb8')][_0x0a9e('0xc6')]){return;}return db[_0x0a9e('0xc7')][_0x0a9e('0x6a')]({'attributes':['id','name'],'where':{'id':_0x5d83fd[_0x0a9e('0xb8')]['queueId']}});})[_0x0a9e('0x18')](function(_0x1ad1d7){if(_0x1ad1d7){_0x5d83fd[_0x0a9e('0xad')][_0x0a9e('0xc2')]({'id':0x0,'priority':0x1,'app':_0x0a9e('0xc8'),'appdata':_0x1ad1d7[_0x0a9e('0x31')]+','+(_0x5d83fd[_0x0a9e('0xac')][_0x0a9e('0xc9')]||0x12c),'interval':_0x0a9e('0xbd')});}return respondWithRpcPromise(_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x5d83fd);})[_0x0a9e('0x18')](function(_0x43111e){respondWithRpcPromise(_0x0a9e('0xcc'),_0x0a9e('0xcc'),{'event':_0x0a9e('0x98'),'message':_0x43111e},client9002);return _0x43111e;})['then'](respondWithResult(_0x26931c,null))['catch'](APIHandleError(_0x26931c));};exports[_0x0a9e('0xcd')]=function(_0x410e12,_0x52b365){var _0x5500de,_0x2cb05c,_0x1feb9;var _0x3304a1=[];var _0x596178={};var _0x268eae=_0x410e12['files']||[];var _0x31fe9e=[];var _0x4bf1e3;return db[_0x0a9e('0x9e')]['describe']()[_0x0a9e('0x18')](function(_0x21e210){if(!_0x21e210){throw new db[(_0x0a9e('0xce'))]['ValidationError'](_0x0a9e('0xcf'));}_0x3304a1=_['difference'](_['keys'](_0x21e210),[_0x0a9e('0xa1'),_0x0a9e('0x9f'),_0x0a9e('0xa2'),_0x0a9e('0xa3')]);if(_0x410e12[_0x0a9e('0x64')]['id']){delete _0x410e12[_0x0a9e('0x64')]['id'];}if(_[_0x0a9e('0x8a')](_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x99')])){throw _0x52b365[_0x0a9e('0x25')](0x1f4)[_0x0a9e('0x32')](new db[(_0x0a9e('0xce'))][(_0x0a9e('0xd0'))](_0x0a9e('0xd1')));}if(_[_0x0a9e('0x8a')](_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x64')])||_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x64')]===''){throw _0x52b365['status'](0x1f4)[_0x0a9e('0x32')](new db[(_0x0a9e('0xce'))][(_0x0a9e('0xd0'))](_0x0a9e('0xd2')));}if(_['isNil'](_0x410e12['body']['mapKeyOffline'])){throw _0x52b365[_0x0a9e('0x25')](0x1f4)['send'](new db[(_0x0a9e('0xce'))][(_0x0a9e('0xd0'))](_0x0a9e('0xd3')+_0x3304a1));}if(!_[_0x0a9e('0xa0')](_0x3304a1,_0x410e12[_0x0a9e('0x64')][_0x0a9e('0xd4')])){throw _0x52b365[_0x0a9e('0x25')](0x1f4)[_0x0a9e('0x32')](new db[(_0x0a9e('0xce'))][(_0x0a9e('0xd0'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3304a1));}_0x596178[_0x410e12[_0x0a9e('0x64')]['mapKeyOffline']]=_0x410e12[_0x0a9e('0x64')]['from'];})[_0x0a9e('0x18')](function(){return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x410e12['params']['id']},'include':[{'model':db[_0x0a9e('0xd5')],'as':_0x0a9e('0xa5')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x0a9e('0x18')](handleEntityNotFound(_0x52b365,null))[_0x0a9e('0x18')](function(_0x1262ff){if(_0x1262ff&&_0x1262ff['List']){_0x2cb05c=_0x1262ff;var _0x578e8d=_['defaults'](_0x410e12[_0x0a9e('0x64')],{'firstName':_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x99')],'phone':_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x99')],'ListId':_0x1262ff[_0x0a9e('0xa3')]});_0x578e8d[_0x410e12[_0x0a9e('0x64')][_0x0a9e('0xd4')]]=_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x99')];return db[_0x0a9e('0x9e')][_0x0a9e('0xd6')]({'where':_0x596178,'defaults':_0x578e8d});}})[_0x0a9e('0xd7')](function(_0x4104d1){if(_0x4104d1){_0x1feb9=_0x4104d1;var _0x310758=fs[_0x0a9e('0xd8')](path[_0x0a9e('0x86')](config[_0x0a9e('0x87')],'server/files/templates/chatOfflineMessage.ejs'),_0x0a9e('0xd9'));var _0x25ba4e=ejs[_0x0a9e('0xda')](_0x310758,{'body':_[_0x0a9e('0xdb')](_0x410e12[_0x0a9e('0x64')][_0x0a9e('0x64')]),'bodyTitle':_0x2cb05c['offlineMessageBody']});return db[_0x0a9e('0xdc')][_0x0a9e('0x61')]({'body':_0x25ba4e,'plainBody':htmlToText[_0x0a9e('0xdd')](_0x25ba4e),'ContactId':_0x4104d1['id'],'ChatWebsiteId':_0x2cb05c['id']});}})[_0x0a9e('0x18')](function(_0x37390b){_0x4bf1e3=_0x37390b;if(_0x268eae[_0x0a9e('0x54')]){var _0x103ad9=_0x268eae[_0x0a9e('0x49')](function(_0x4175a6){return{'name':_0x4175a6['originalname'],'basename':_0x4175a6['filename'],'type':_0x4175a6[_0x0a9e('0xde')],'ChatOfflineMessageId':_0x37390b['id']};});_0x31fe9e=_0x103ad9[_0x0a9e('0x49')](_0x5c2996=>{var _0x1f52b4={'filename':_0x5c2996[_0x0a9e('0x31')],'path':path['join'](config[_0x0a9e('0x87')],'server',_0x0a9e('0xdf'),_0x0a9e('0xe0'),'offline-chat',_0x5c2996[_0x0a9e('0xe1')])};return _0x1f52b4;});if(!_0x2cb05c[_0x0a9e('0xe2')]){return db['sequelize'][_0x0a9e('0xe3')](function(_0x44e01f){return db['Attachment'][_0x0a9e('0xe4')](_0x103ad9,{'transaction':_0x44e01f});});}}})[_0x0a9e('0x18')](function(){if(_0x4bf1e3){_0x5500de=_0x4bf1e3;return db[_0x0a9e('0xe5')][_0x0a9e('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0x0a9e('0xe6')],'as':_0x0a9e('0xe7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0a9e('0xe8'),'raw':!![]}]}]});}})[_0x0a9e('0x18')](function(_0x51e697){if(_0x51e697&&_0x51e697[_0x0a9e('0xe7')]&&_0x2cb05c[_0x0a9e('0xe9')]&&_0x2cb05c[_0x0a9e('0xea')]){var _0x2a6789=_0x51e697[_0x0a9e('0xeb')]();return respondWithRpcPromise(_0x0a9e('0xec'),_0x0a9e('0xed'),{'account':_0x2a6789,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x51e697['name'],_0x51e697['email']||_0x51e697['Smtp'][_0x0a9e('0x66')]),'to':_0x2cb05c[_0x0a9e('0xea')],'subject':_0x2cb05c['offlineMessageSubject'],'html':_0x5500de['body'],'attachments':_0x31fe9e}},client9003)[_0x0a9e('0x18')](function(){return _0x5500de;})['catch'](function(_0x41600e){logger[_0x0a9e('0x1f')](_0x41600e);});}})[_0x0a9e('0x18')](function(){if(_0x2cb05c&&_0x2cb05c[_0x0a9e('0xe2')]&&_0x2cb05c[_0x0a9e('0xee')]){var _0x14a683=[];if(_0x268eae['length']){_0x14a683=_0x268eae[_0x0a9e('0x49')](function(_0x4733c6){return{'name':_0x4733c6['originalname'],'basename':_0x4733c6[_0x0a9e('0x80')],'type':_0x4733c6[_0x0a9e('0xde')],'ChatOfflineMessageId':_0x4bf1e3['id']};});}var _0x2e0e9b;if(!_[_0x0a9e('0x8a')](_0x2cb05c[_0x0a9e('0xef')])){var _0x2f1cc0=_[_0x0a9e('0x49')](_0x410e12['body'],function(_0x331216){return _0x331216;});var _0x508395=_[_0x0a9e('0xf0')](_0x2f1cc0)[0x0];var _0xd456e6=_['mapValues'](_0x508395,function(_0x28b7de){return _0x28b7de;});_0x2e0e9b=_0xd456e6[0x1][_0x2cb05c[_0x0a9e('0xef')]];}var _0x5061e5={'from':_0x1feb9[_0x0a9e('0xf1')],'firstName':_0x1feb9['firstName'],'lastName':_0x1feb9[_0x0a9e('0xf2')],'mapKey':_0x0a9e('0xf1'),'message':{'from':_0x1feb9['email'],'to':_0x2cb05c[_0x0a9e('0xe5')]['email'],'cc':'','subject':_[_0x0a9e('0x8a')](_0x2e0e9b)?_0x2cb05c[_0x0a9e('0xf3')]:_0x2e0e9b,'messageId':'','sentAt':new Date(),'attach':_0x14a683[_0x0a9e('0x54')],'attachments':_0x14a683,'originChannel':_0x0a9e('0xf4'),'ChatWebsiteId':_0x2cb05c['id'],'ChatOfflineMessageId':_0x5500de['id'],'originTo':_0x2cb05c[_0x0a9e('0xe5')][_0x0a9e('0xf1')]},'body':_0x5500de[_0x0a9e('0x64')]};var _0x53b5c2={'account':{'id':_0x2cb05c[_0x0a9e('0xee')]},'body':_0x5061e5,'log':_0x0a9e('0xf5')};return respondWithRpcPromise(_0x0a9e('0xf5'),_0x0a9e('0xf6'),_0x53b5c2,client9001)[_0x0a9e('0x18')](function(){return _0x5500de;})['catch'](function(_0xb376ed){logger['error'](_0xb376ed);});}return;})['then'](function(){if(_0x5500de){return _0x5500de;}})[_0x0a9e('0x18')](respondWithResult(_0x52b365,null))['catch'](function(){for(var _0x43cb0 of _0x268eae){var _0x255ed6=path['join'](config[_0x0a9e('0x87')],_0x0a9e('0xf7'),_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xf8'),_0x43cb0[_0x0a9e('0x80')]);fs_extra[_0x0a9e('0xf9')](_0x255ed6)[_0x0a9e('0x23')](function(_0x3d02ae){logger['error'](_0x0a9e('0xfa'),_0x255ed6,_0x3d02ae);});}});};exports[_0x0a9e('0xfb')]=function(_0x23ff8c,_0x43403c){return db['ChatInteraction'][_0x0a9e('0x6a')]({'where':{'id':_0x23ff8c[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x43403c,null))['then'](function(_0x2b73da){if(_0x2b73da){return _0x2b73da[_0x0a9e('0xfb')](_0x23ff8c[_0x0a9e('0x64')]['ids'],_[_0x0a9e('0xfc')](_0x23ff8c['body'],[_0x0a9e('0x79'),'id'])||{});}})[_0x0a9e('0x18')](respondWithResult(_0x43403c,null))[_0x0a9e('0x23')](handleError(_0x43403c,null));};exports[_0x0a9e('0xfd')]=function(_0x2b93bc,_0x1b86e6){var _0x81f0f5={'raw':![],'where':{}};var _0x5363f5={};var _0x163e97={'count':0x0,'rows':[]};return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x2b93bc[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x1b86e6,null))[_0x0a9e('0x18')](function(_0x3a4def){if(_0x3a4def){_0x5363f5[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xb7')][_0x0a9e('0x4b')]);_0x5363f5[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x2b93bc[_0x0a9e('0x4e')]);_0x5363f5[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x5363f5[_0x0a9e('0x42')],_0x5363f5[_0x0a9e('0x4e')]);_0x81f0f5[_0x0a9e('0x53')]=_[_0x0a9e('0x51')](_0x5363f5[_0x0a9e('0x42')],qs[_0x0a9e('0x52')](_0x2b93bc[_0x0a9e('0x4e')]['fields']));_0x81f0f5[_0x0a9e('0x53')]=_0x81f0f5[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0x81f0f5['attributes']:_0x5363f5[_0x0a9e('0x42')];if(!_0x2b93bc['query'][_0x0a9e('0x55')](_0x0a9e('0x75'))){_0x81f0f5[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x29')]);_0x81f0f5[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2b93bc['query'][_0x0a9e('0x27')]);}_0x81f0f5[_0x0a9e('0x56')]=qs['sort'](_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x81f0f5[_0x0a9e('0x5a')]=qs['filters'](_[_0x0a9e('0x58')](_0x2b93bc[_0x0a9e('0x4e')],_0x5363f5[_0x0a9e('0x50')]));_0x81f0f5[_0x0a9e('0x5a')]['ChatWebsiteId']=_0x3a4def['id'];if(_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x59')]){_0x81f0f5[_0x0a9e('0x5a')]=_[_0x0a9e('0x5c')](_0x81f0f5[_0x0a9e('0x5a')],{'$or':_['map'](_0x81f0f5[_0x0a9e('0x53')],function(_0x3fc431){var _0x4df303={};_0x4df303[_0x3fc431]={'$like':'%'+_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x59')]+'%'};return _0x4df303;})});}_0x81f0f5=_[_0x0a9e('0x5c')]({},_0x81f0f5,_0x2b93bc['options']);return db['ChatInteraction'][_0x0a9e('0x2a')]({'where':_0x81f0f5[_0x0a9e('0x5a')]})[_0x0a9e('0x18')](function(_0x283bbb){_0x163e97[_0x0a9e('0x2a')]=_0x283bbb;if(_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x5d')]){_0x81f0f5[_0x0a9e('0x76')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x0a9e('0xc1')],'as':'Owner','attributes':[_0x0a9e('0x31'),_0x0a9e('0xfe'),_0x0a9e('0xff')],'required':![]},{'model':db[_0x0a9e('0x100')],'as':'Tags','attributes':['id',_0x0a9e('0x31'),_0x0a9e('0x101')],'where':_0x2b93bc['query'][_0x0a9e('0x102')]?{'id':_0x2b93bc['query'][_0x0a9e('0x102')]}:undefined,'required':_0x2b93bc[_0x0a9e('0x4e')][_0x0a9e('0x102')]?!![]:![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0x77')](_0x81f0f5);})[_0x0a9e('0x18')](function(_0x595efc){_0x163e97[_0x0a9e('0x5e')]=_0x595efc;return _0x163e97;});}})['then'](respondWithFilteredResult(_0x1b86e6,_0x81f0f5))[_0x0a9e('0x23')](handleError(_0x1b86e6,null));};exports[_0x0a9e('0x103')]=function(_0x4229e6,_0x206562){var _0xa244bc=0x0;var _0x393e9c=0x0;var _0x2d7d76=![];var _0x5bdba6;var _0x37d9b9;return db[_0x0a9e('0x4a')][_0x0a9e('0x6a')]({'where':{'id':_0x4229e6[_0x0a9e('0x6f')]['id']},'include':[{'model':db[_0x0a9e('0x96')],'as':'Interval','include':[{'model':db[_0x0a9e('0x96')],'as':_0x0a9e('0xaa'),'attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x206562,null))[_0x0a9e('0x18')](function(_0x11b33b){if(_0x11b33b){_0x5bdba6=_0x11b33b;return _0x11b33b[_0x0a9e('0x104')]({'raw':!![]});}})[_0x0a9e('0x18')](function(_0x380539){if(_0x5bdba6){if(_0x380539){_0x37d9b9=_0x380539;}}return require(_0x0a9e('0x89'))['getLicense']();})[_0x0a9e('0x18')](function(_0x13782b){if(_0x13782b){_0x393e9c=_0x13782b[_0x0a9e('0x105')];_0x2d7d76=_0x13782b['custom'];}})[_0x0a9e('0x18')](function(){return db[_0x0a9e('0xb7')][_0x0a9e('0x2a')]({'where':{'closed':![]}});})[_0x0a9e('0x18')](function(_0x57425c){_0xa244bc=_0x57425c;if(_0x393e9c&&_0x57425c>_0x393e9c){return db['License'][_0x0a9e('0x7d')]({'where':{'id':0x1}})[_0x0a9e('0x18')](function(_0x45630b){if(_0x45630b){_0x45630b[_0x0a9e('0x106')](_0x0a9e('0x107'));}});}})[_0x0a9e('0x18')](function(){var _0x371943=_0x5bdba6[_0x0a9e('0x96')];var _0x4a4f79=_0x5bdba6[_0x0a9e('0x108')]||undefined;return _0x371943?_0x371943['ifTime'](_0x4a4f79):!![];})[_0x0a9e('0x18')](function(_0x20dcfd){var _0x3fd399=fs['readFileSync'](path['join'](config[_0x0a9e('0x87')],'server/files/chat/iframe.ejs'),_0x0a9e('0xd9'));var _0x5f1f79='3.9.0';var _0x229d20=![];_0x5bdba6[_0x0a9e('0x63')]=_0x5bdba6[_0x0a9e('0x63')][_0x0a9e('0x109')](/\/$/,'');try{var _0x1f0776=new URL(_0x5bdba6[_0x0a9e('0x63')]);_0x5bdba6[_0x0a9e('0x63')]=_0x1f0776[_0x0a9e('0x10a')];}catch(_0x106e04){}var _0x3b3e30=new URL(_0x4229e6[_0x0a9e('0x10b')][_0x0a9e('0x3b')])[_0x0a9e('0x10a')];var _0x52aa27=wildcardUtils['testWebsiteWithWildcard'](_0x5bdba6[_0x0a9e('0x63')],_0x3b3e30);var _0x48c889={'chatVersion':_0x5f1f79,'chatWebsiteAddressOrigin':_0x52aa27?_0x3b3e30:_0x5bdba6[_0x0a9e('0x63')],'remote':_0x5bdba6[_0x0a9e('0x10c')],'query':querystring[_0x0a9e('0x1e')](_['merge'](_0x5bdba6['get']({'plain':!![]}),{'customerIp':_0x4229e6[_0x0a9e('0x10b')][_0x0a9e('0x37')]||_0x4229e6[_0x0a9e('0x10b')][_0x0a9e('0x10d')]||_0x4229e6[_0x0a9e('0x10e')][_0x0a9e('0x10f')]||_0x4229e6['ip'],'referer':_0x4229e6[_0x0a9e('0x10b')]['referer'],'openedInteractions':_0xa244bc,'maxInteractions':_0x393e9c,'virtual':_0x2d7d76[_0x0a9e('0x105')],'online':_0x20dcfd,'custom':_0x2d7d76,'address':_0x52aa27?_0x3b3e30:null}))['replace'](/'/g,'\x5c\x27')};_0x206562[_0x0a9e('0x32')](ejs[_0x0a9e('0xda')](Mustache['render'](_0x3fd399,_0x48c889),{'proactiveActions':_0x37d9b9,'alignment':_0x5bdba6[_0x0a9e('0x110')],'verticalAlignment':_0x5bdba6[_0x0a9e('0x111')],'div_color':_0x5bdba6[_0x0a9e('0x101')],'labelText':_0x5bdba6[_0x0a9e('0x112')],'text_color':_0x5bdba6[_0x0a9e('0x113')],'text_button_color':_0x5bdba6[_0x0a9e('0x114')],'button_color':_0x5bdba6['color_button'],'background_color':_0x5bdba6[_0x0a9e('0x115')],'hideWhenOffline':_0x5bdba6[_0x0a9e('0x116')],'intervalId':_0x5bdba6[_0x0a9e('0x117')],'isDevelopment':_0x229d20,'chatVersion':_0x5f1f79}));})['catch'](handleError(_0x206562,null));};exports[_0x0a9e('0x118')]=function(_0x934f69,_0x24dc3f){var _0x525928=_0x934f69[_0x0a9e('0x6f')]['id'];var _0x3607c6=_0x934f69[_0x0a9e('0x64')];var _0x2317e7=0xc8;var _0x1d39bd=null;return db[_0x0a9e('0x119')]['transaction']({'isolationLevel':db['sequelize'][_0x0a9e('0x11a')][_0x0a9e('0x11b')]['READ_COMMITTED']},function(_0x3eb0a9){return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x525928},'transaction':_0x3eb0a9})[_0x0a9e('0x18')](function(_0x2e413d){if(_0x2e413d){return db[_0x0a9e('0xa8')]['destroy']({'where':{'ChatWebsiteId':_0x525928},'transaction':_0x3eb0a9})[_0x0a9e('0x18')](function(){var _0x34e639=_[_0x0a9e('0x49')](_0x3607c6,function(_0x4edb79){_0x4edb79[_0x0a9e('0x72')]=_0x525928;return _0x4edb79;});return db[_0x0a9e('0xa8')][_0x0a9e('0xe4')](_0x34e639,{'transaction':_0x3eb0a9});});}else{_0x2317e7=0x194;_0x1d39bd=[];}});})[_0x0a9e('0x18')](function(){if(_0x2317e7!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x525928},'order':_0x0a9e('0xaf')})[_0x0a9e('0x18')](function(_0x16b4ae){_0x1d39bd=_0x16b4ae;});}})['catch'](function(_0x3d75c9){_0x2317e7=0x1f4;logger[_0x0a9e('0x1f')](_0x3d75c9[_0x0a9e('0x11c')]);if(_0x3d75c9[_0x0a9e('0x31')]){delete _0x3d75c9[_0x0a9e('0x31')];}_0x1d39bd=_0x3d75c9;})[_0x0a9e('0x11d')](function(){if(_0x1d39bd===null){_0x24dc3f[_0x0a9e('0x24')](_0x2317e7);}else{if(_0x2317e7===0x1f4){_0x24dc3f[_0x0a9e('0x25')](_0x2317e7)['send'](_0x1d39bd);}else{_0x24dc3f['status'](_0x2317e7)[_0x0a9e('0x2d')](_0x1d39bd);}}});};exports[_0x0a9e('0x11e')]=function(_0x58e948,_0xe6701c){var _0x5eb336={};var _0x1f80cb={};var _0xfb2f3a;var _0x4d9e93;return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x58e948['params']['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0xe6701c,null))[_0x0a9e('0x18')](function(_0x6933ab){if(_0x6933ab){_0xfb2f3a=_0x6933ab;_0x1f80cb[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xa8')][_0x0a9e('0x4b')]);_0x1f80cb['query']=_[_0x0a9e('0x4f')](_0x58e948[_0x0a9e('0x4e')]);_0x1f80cb[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x1f80cb[_0x0a9e('0x42')],_0x1f80cb[_0x0a9e('0x4e')]);_0x5eb336[_0x0a9e('0x53')]=_['intersection'](_0x1f80cb['model'],qs[_0x0a9e('0x52')](_0x58e948[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x5eb336['attributes']=_0x5eb336['attributes'][_0x0a9e('0x54')]?_0x5eb336['attributes']:_0x1f80cb[_0x0a9e('0x42')];_0x5eb336[_0x0a9e('0x56')]=qs[_0x0a9e('0x57')](_0x58e948[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x5eb336[_0x0a9e('0x5a')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x58')](_0x58e948[_0x0a9e('0x4e')],_0x1f80cb['filters']));if(_0x58e948['query'][_0x0a9e('0x59')]){_0x5eb336['where']=_[_0x0a9e('0x5c')](_0x5eb336[_0x0a9e('0x5a')],{'$or':_[_0x0a9e('0x49')](_0x5eb336[_0x0a9e('0x53')],function(_0x4ad6fc){var _0xaa43da={};_0xaa43da[_0x4ad6fc]={'$like':'%'+_0x58e948[_0x0a9e('0x4e')][_0x0a9e('0x59')]+'%'};return _0xaa43da;})});}_0x5eb336=_['merge']({},_0x5eb336,_0x58e948[_0x0a9e('0x60')]);return _0xfb2f3a[_0x0a9e('0x11e')](_0x5eb336);}})[_0x0a9e('0x18')](function(_0x5c09d6){if(_0x5c09d6){_0x4d9e93=_0x5c09d6[_0x0a9e('0x54')];if(!_0x58e948[_0x0a9e('0x4e')][_0x0a9e('0x55')](_0x0a9e('0x75'))){_0x5eb336[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x58e948['query']['limit']);_0x5eb336[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x58e948[_0x0a9e('0x4e')]['offset']);}return _0xfb2f3a['getApplications'](_0x5eb336);}})[_0x0a9e('0x18')](function(_0x304a57){if(_0x304a57){return _0x304a57?{'count':_0x4d9e93,'rows':_0x304a57}:null;}})[_0x0a9e('0x18')](respondWithResult(_0xe6701c,null))['catch'](handleError(_0xe6701c,null));};exports['addProactiveActions']=function(_0x12d1dd,_0x2c8d95){return db[_0x0a9e('0x11f')][_0x0a9e('0x6a')]({'where':{'id':_0x12d1dd[_0x0a9e('0x6f')]['id']}})['then'](handleEntityNotFound(_0x2c8d95,null))[_0x0a9e('0x18')](function(_0x4b62e8){if(_0x4b62e8){return _0x4b62e8[_0x0a9e('0x120')](_0x12d1dd[_0x0a9e('0x64')]['ids'],_[_0x0a9e('0xfc')](_0x12d1dd['body'],[_0x0a9e('0x79'),'id'])||{});}})[_0x0a9e('0x18')](respondWithResult(_0x2c8d95,null))[_0x0a9e('0x23')](handleError(_0x2c8d95,null));};exports[_0x0a9e('0x104')]=function(_0x385a3b,_0x57f53e){var _0x42c3a9={};var _0x2ef5c8={};var _0x226d6f;var _0x535619;return db[_0x0a9e('0x4a')]['findOne']({'where':{'id':_0x385a3b[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x57f53e,null))[_0x0a9e('0x18')](function(_0x498d4e){if(_0x498d4e){_0x226d6f=_0x498d4e;_0x2ef5c8[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0x121')][_0x0a9e('0x4b')]);_0x2ef5c8[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x385a3b['query']);_0x2ef5c8[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x2ef5c8[_0x0a9e('0x42')],_0x2ef5c8[_0x0a9e('0x4e')]);_0x42c3a9[_0x0a9e('0x53')]=_[_0x0a9e('0x51')](_0x2ef5c8[_0x0a9e('0x42')],qs[_0x0a9e('0x52')](_0x385a3b['query'][_0x0a9e('0x52')]));_0x42c3a9[_0x0a9e('0x53')]=_0x42c3a9[_0x0a9e('0x53')][_0x0a9e('0x54')]?_0x42c3a9['attributes']:_0x2ef5c8[_0x0a9e('0x42')];_0x42c3a9['order']=qs[_0x0a9e('0x57')](_0x385a3b[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x42c3a9['where']=qs[_0x0a9e('0x50')](_[_0x0a9e('0x58')](_0x385a3b[_0x0a9e('0x4e')],_0x2ef5c8[_0x0a9e('0x50')]));if(_0x385a3b['query'][_0x0a9e('0x59')]){_0x42c3a9[_0x0a9e('0x5a')]=_[_0x0a9e('0x5c')](_0x42c3a9[_0x0a9e('0x5a')],{'$or':_[_0x0a9e('0x49')](_0x42c3a9[_0x0a9e('0x53')],function(_0xbdc88e){var _0x5af336={};_0x5af336[_0xbdc88e]={'$like':'%'+_0x385a3b[_0x0a9e('0x4e')][_0x0a9e('0x59')]+'%'};return _0x5af336;})});}_0x42c3a9=_[_0x0a9e('0x5c')]({},_0x42c3a9,_0x385a3b[_0x0a9e('0x60')]);return _0x226d6f['getProactiveActions'](_0x42c3a9);}})[_0x0a9e('0x18')](function(_0x4bd161){if(_0x4bd161){_0x535619=_0x4bd161[_0x0a9e('0x54')];if(!_0x385a3b[_0x0a9e('0x4e')][_0x0a9e('0x55')](_0x0a9e('0x75'))){_0x42c3a9[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x385a3b[_0x0a9e('0x4e')]['limit']);_0x42c3a9[_0x0a9e('0x27')]=qs['offset'](_0x385a3b[_0x0a9e('0x4e')][_0x0a9e('0x27')]);}return _0x226d6f['getProactiveActions'](_0x42c3a9);}})[_0x0a9e('0x18')](function(_0x167f89){if(_0x167f89){return _0x167f89?{'count':_0x535619,'rows':_0x167f89}:null;}})[_0x0a9e('0x18')](respondWithResult(_0x57f53e,null))[_0x0a9e('0x23')](handleError(_0x57f53e,null));};exports['getFields']=function(_0x3d00a8,_0x15d538){var _0x5a75d9=_0x3d00a8[_0x0a9e('0x4e')]['online']==='false'?'offlineForm':_0x0a9e('0x122');return db[_0x0a9e('0x4a')]['find']({'attributes':['id',_0x5a75d9],'where':{'id':_0x3d00a8[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x15d538,null))['then'](function(_0xc48226){if(_0xc48226){var _0xc5839b=_0xc48226[_0x5a75d9];var _0x216a72=_0xc5839b&&_0xc5839b[_0x0a9e('0x123')]?_0xc5839b[_0x0a9e('0x123')]:[];_0x15d538[_0x0a9e('0x32')]({'fromKey':_[_0x0a9e('0x8a')](_0xc5839b['fromKey'])?undefined:_0xc5839b[_0x0a9e('0x124')],'count':_0x216a72['length'],'rows':_0x216a72});}})[_0x0a9e('0x23')](handleError(_0x15d538,null));};exports[_0x0a9e('0x125')]=function(_0x2af126,_0x216255){var _0x1b8053={'raw':![],'where':{}};var _0x184453={};var _0x57da3c={'count':0x0,'rows':[]};return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x2af126[_0x0a9e('0x6f')]['id']}})['then'](handleEntityNotFound(_0x216255,null))[_0x0a9e('0x18')](function(_0x434f3c){if(_0x434f3c){_0x184453[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db[_0x0a9e('0xdc')][_0x0a9e('0x4b')]);_0x184453[_0x0a9e('0x4e')]=_[_0x0a9e('0x4f')](_0x2af126[_0x0a9e('0x4e')]);_0x184453[_0x0a9e('0x50')]=_[_0x0a9e('0x51')](_0x184453[_0x0a9e('0x42')],_0x184453[_0x0a9e('0x4e')]);_0x1b8053[_0x0a9e('0x53')]=_[_0x0a9e('0x51')](_0x184453[_0x0a9e('0x42')],qs['fields'](_0x2af126[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x1b8053[_0x0a9e('0x53')]=_0x1b8053['attributes'][_0x0a9e('0x54')]?_0x1b8053[_0x0a9e('0x53')]:_0x184453[_0x0a9e('0x42')];if(!_0x2af126[_0x0a9e('0x4e')]['hasOwnProperty'](_0x0a9e('0x75'))){_0x1b8053[_0x0a9e('0x29')]=qs[_0x0a9e('0x29')](_0x2af126[_0x0a9e('0x4e')]['limit']);_0x1b8053[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2af126[_0x0a9e('0x4e')][_0x0a9e('0x27')]);}_0x1b8053['order']=qs['sort'](_0x2af126[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x1b8053[_0x0a9e('0x5a')]=qs[_0x0a9e('0x50')](_[_0x0a9e('0x58')](_0x2af126[_0x0a9e('0x4e')],_0x184453[_0x0a9e('0x50')]));_0x1b8053[_0x0a9e('0x5a')][_0x0a9e('0x72')]=_0x434f3c['id'];if(_0x2af126[_0x0a9e('0x4e')][_0x0a9e('0x59')]){_0x1b8053[_0x0a9e('0x5a')]=_[_0x0a9e('0x5c')](_0x1b8053[_0x0a9e('0x5a')],{'$or':_['map'](_0x1b8053[_0x0a9e('0x53')],function(_0x5ce227){var _0x4e146d={};_0x4e146d[_0x5ce227]={'$like':'%'+_0x2af126['query']['filter']+'%'};return _0x4e146d;})});}_0x1b8053=_[_0x0a9e('0x5c')]({},_0x1b8053,_0x2af126['options']);return db[_0x0a9e('0xdc')][_0x0a9e('0x2a')]({'where':_0x1b8053[_0x0a9e('0x5a')]})[_0x0a9e('0x18')](function(_0x56caca){_0x57da3c['count']=_0x56caca;if(_0x2af126[_0x0a9e('0x4e')][_0x0a9e('0x5d')]){_0x1b8053[_0x0a9e('0x76')]=[{'all':!![]}];}else{_0x1b8053[_0x0a9e('0x76')]=[{'model':db['CmContact'],'as':_0x0a9e('0x126'),'required':![]},{'model':db[_0x0a9e('0x127')],'as':_0x0a9e('0x128'),'required':![]}];}return db[_0x0a9e('0xdc')][_0x0a9e('0x77')](_0x1b8053);})['then'](function(_0x5cfe15){_0x57da3c[_0x0a9e('0x5e')]=_0x5cfe15;return _0x57da3c;});}})[_0x0a9e('0x18')](respondWithFilteredResult(_0x216255,_0x1b8053))[_0x0a9e('0x23')](handleError(_0x216255,null));};exports[_0x0a9e('0x129')]=function(_0x126620,_0x25f447){return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x126620[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x25f447,null))[_0x0a9e('0x18')](function(_0x5c40b9){if(_0x5c40b9){return _0x5c40b9['addAgents'](_0x126620['body'][_0x0a9e('0x79')],_[_0x0a9e('0xfc')](_0x126620['body'],[_0x0a9e('0x79'),'id'])||{})[_0x0a9e('0xd7')](function(_0x42d776){for(var _0x583347=0x0;_0x583347<_0x126620['body'][_0x0a9e('0x79')][_0x0a9e('0x54')];_0x583347+=0x1){socket[_0x0a9e('0x12a')](_0x0a9e('0x12b'),{'UserId':Number(_0x126620['body'][_0x0a9e('0x79')][_0x583347]),'ChatWebsiteId':Number(_0x126620['params']['id'])});}return _0x42d776;});}})['then'](respondWithResult(_0x25f447,null))[_0x0a9e('0x23')](handleError(_0x25f447,null));};exports['removeAgents']=function(_0x98bab3,_0x991bfc){return db[_0x0a9e('0x4a')]['find']({'where':{'id':_0x98bab3[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x991bfc,null))[_0x0a9e('0x18')](function(_0x5c39d1){if(_0x5c39d1){return _0x5c39d1['removeAgents'](_0x98bab3[_0x0a9e('0x4e')][_0x0a9e('0x79')])[_0x0a9e('0x18')](function(){if(_[_0x0a9e('0x12c')](_0x98bab3[_0x0a9e('0x4e')][_0x0a9e('0x79')])){for(var _0x589ff5=0x0;_0x589ff5<_0x98bab3['query'][_0x0a9e('0x79')][_0x0a9e('0x54')];_0x589ff5+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x98bab3['query']['ids'][_0x589ff5]),'ChatWebsiteId':Number(_0x98bab3['params']['id'])});}}else{socket['emit'](_0x0a9e('0x12d'),{'UserId':Number(_0x98bab3['query'][_0x0a9e('0x79')]),'ChatWebsiteId':Number(_0x98bab3[_0x0a9e('0x6f')]['id'])});}});}})[_0x0a9e('0x18')](respondWithStatusCode(_0x991bfc,null))[_0x0a9e('0x23')](handleError(_0x991bfc,null));};exports[_0x0a9e('0x12e')]=function(_0x2e42d2,_0x135905){var _0x55675d={};var _0x2866e7={};var _0x13e8bd;var _0x221fe4;return db[_0x0a9e('0x4a')][_0x0a9e('0x7d')]({'where':{'id':_0x2e42d2[_0x0a9e('0x6f')]['id']}})[_0x0a9e('0x18')](handleEntityNotFound(_0x135905,null))[_0x0a9e('0x18')](function(_0x1911d0){if(_0x1911d0){_0x13e8bd=_0x1911d0;_0x2866e7[_0x0a9e('0x42')]=_[_0x0a9e('0x4f')](db['User'][_0x0a9e('0x4b')]);_0x2866e7[_0x0a9e('0x4e')]=_['keys'](_0x2e42d2[_0x0a9e('0x4e')]);_0x2866e7['filters']=_[_0x0a9e('0x51')](_0x2866e7[_0x0a9e('0x42')],_0x2866e7['query']);_0x55675d['attributes']=_[_0x0a9e('0x51')](_0x2866e7['model'],qs[_0x0a9e('0x52')](_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x52')]));_0x55675d[_0x0a9e('0x53')]=_0x55675d[_0x0a9e('0x53')]['length']?_0x55675d[_0x0a9e('0x53')]:_0x2866e7['model'];_0x55675d['order']=qs[_0x0a9e('0x57')](_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x57')]);_0x55675d[_0x0a9e('0x5a')]=qs[_0x0a9e('0x50')](_['pick'](_0x2e42d2[_0x0a9e('0x4e')],_0x2866e7[_0x0a9e('0x50')]));if(_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x59')]){_0x55675d['where']=_[_0x0a9e('0x5c')](_0x55675d[_0x0a9e('0x5a')],{'$or':_['map'](_0x55675d[_0x0a9e('0x53')],function(_0x36d8a1){var _0x1acaad={};_0x1acaad[_0x36d8a1]={'$like':'%'+_0x2e42d2[_0x0a9e('0x4e')]['filter']+'%'};return _0x1acaad;})});}_0x55675d=_[_0x0a9e('0x5c')]({},_0x55675d,_0x2e42d2[_0x0a9e('0x60')]);return _0x13e8bd[_0x0a9e('0x12e')](_0x55675d);}})[_0x0a9e('0x18')](function(_0x2673ea){if(_0x2673ea){_0x221fe4=_0x2673ea['length'];if(!_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x55')]('nolimit')){_0x55675d[_0x0a9e('0x29')]=qs['limit'](_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x29')]);_0x55675d[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2e42d2[_0x0a9e('0x4e')][_0x0a9e('0x27')]);}return _0x13e8bd[_0x0a9e('0x12e')](_0x55675d);}})[_0x0a9e('0x18')](function(_0x1a63e8){if(_0x1a63e8){return _0x1a63e8?{'count':_0x221fe4,'rows':_0x1a63e8}:null;}})[_0x0a9e('0x18')](respondWithResult(_0x135905,null))[_0x0a9e('0x23')](handleError(_0x135905,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 763c067..02f3fe9 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 _0xedd9=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xedd9,0xfc));var _0x9edd=function(_0x115dfa,_0xa32a7b){_0x115dfa=_0x115dfa-0x0;var _0x358464=_0xedd9[_0x115dfa];return _0x358464;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){ChatWebsiteEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);ChatWebsiteEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xff16=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x39a688,_0x30d9e2){var _0x39a03b=function(_0x187328){while(--_0x187328){_0x39a688['push'](_0x39a688['shift']());}};_0x39a03b(++_0x30d9e2);}(_0xff16,0x7f));var _0x6ff1=function(_0xcdb1f1,_0x49b4fd){_0xcdb1f1=_0xcdb1f1-0x0;var _0x36d1df=_0xff16[_0xcdb1f1];return _0x36d1df;};'use strict';var EventEmitter=require(_0x6ff1('0x0'));var ChatWebsite=require(_0x6ff1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6ff1('0x2')](0x0);var events={'afterCreate':_0x6ff1('0x3'),'afterUpdate':_0x6ff1('0x4'),'afterDestroy':_0x6ff1('0x5')};function emitEvent(_0x3f3c60){return function(_0x3f53b2,_0x3e4c94,_0x18be1c){ChatWebsiteEvents['emit'](_0x3f3c60+':'+_0x3f53b2['id'],_0x3f53b2);ChatWebsiteEvents[_0x6ff1('0x6')](_0x3f3c60,_0x3f53b2);_0x18be1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6ff1('0x7')](e,emitEvent(event));}}module[_0x6ff1('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 965628e..ce47d15 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 _0xef49=['api','bluebird','request-promise','rimraf','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xef49,0x152));var _0x9ef4=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xef49[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x9ef4('0x0'));var util=require(_0x9ef4('0x1'));var logger=require(_0x9ef4('0x2'))(_0x9ef4('0x3'));var moment=require('moment');var BPromise=require(_0x9ef4('0x4'));var rp=require(_0x9ef4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ef4('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ef4('0x7'));module['exports']=function(_0x6621c3,_0x34a36d){return _0x6621c3[_0x9ef4('0x8')](_0x9ef4('0x9'),attributes,{'tableName':_0x9ef4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b13=['rimraf','../../config/environment','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise','path'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8b13,0x94));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x38b1('0x0'));var util=require(_0x38b1('0x1'));var logger=require('../../config/logger')(_0x38b1('0x2'));var moment=require('moment');var BPromise=require(_0x38b1('0x3'));var rp=require(_0x38b1('0x4'));var fs=require('fs');var path=require(_0x38b1('0x5'));var rimraf=require(_0x38b1('0x6'));var config=require(_0x38b1('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x46966e,_0x2ea58b){return _0x46966e[_0x38b1('0x8')](_0x38b1('0x9'),attributes,{'tableName':_0x38b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 08d8026..35bf04f 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 _0xe28e=['request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s'];(function(_0x5bb257,_0x2ac141){var _0x1c3de2=function(_0x45882d){while(--_0x45882d){_0x5bb257['push'](_0x5bb257['shift']());}};_0x1c3de2(++_0x2ac141);}(_0xe28e,0xcc));var _0xee28=function(_0x440547,_0x1c21ed){_0x440547=_0x440547-0x0;var _0x2f0d05=_0xe28e[_0x440547];return _0x2f0d05;};'use strict';var _=require(_0xee28('0x0'));var util=require('util');var moment=require(_0xee28('0x1'));var BPromise=require(_0xee28('0x2'));var rs=require(_0xee28('0x3'));var fs=require('fs');var Redis=require(_0xee28('0x4'));var db=require(_0xee28('0x5'))['db'];var utils=require(_0xee28('0x6'));var logger=require(_0xee28('0x7'))(_0xee28('0x8'));var config=require(_0xee28('0x9'));var jayson=require(_0xee28('0xa'));var client=jayson['client'][_0xee28('0xb')]({'port':0x232a});config[_0xee28('0xc')]=_[_0xee28('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xee28('0xe'))(new Redis(config[_0xee28('0xc')]));require(_0xee28('0xf'))[_0xee28('0x10')](socket);function respondWithRpcPromise(_0x198939,_0x2d9337,_0x977c58){return new BPromise(function(_0xe388a5,_0x11f985){return client[_0xee28('0x11')](_0x198939,_0x977c58)[_0xee28('0x12')](function(_0x12b6ad){logger['info'](_0xee28('0x13'),_0x2d9337,_0xee28('0x14'));logger[_0xee28('0x15')](_0xee28('0x16'),_0x2d9337,_0xee28('0x14'),JSON[_0xee28('0x17')](_0x12b6ad));if(_0x12b6ad[_0xee28('0x18')]){if(_0x12b6ad[_0xee28('0x18')]['code']===0x1f4){logger['error'](_0xee28('0x13'),_0x2d9337,_0x12b6ad[_0xee28('0x18')]['message']);return _0x11f985(_0x12b6ad['error'][_0xee28('0x19')]);}logger[_0xee28('0x18')](_0xee28('0x13'),_0x2d9337,_0x12b6ad[_0xee28('0x18')][_0xee28('0x19')]);return _0xe388a5(_0x12b6ad['error'][_0xee28('0x19')]);}else{logger[_0xee28('0x1a')](_0xee28('0x13'),_0x2d9337,'request\x20sent');_0xe388a5(_0x12b6ad[_0xee28('0x1b')]['message']);}})['catch'](function(_0x5f2902){logger['error'](_0xee28('0x13'),_0x2d9337,_0x5f2902);_0x11f985(_0x5f2902);});});} \ No newline at end of file +var _0x0480=['defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x4856b2,_0xbb9a3b){var _0x477a45=function(_0x54e3bd){while(--_0x54e3bd){_0x4856b2['push'](_0x4856b2['shift']());}};_0x477a45(++_0xbb9a3b);}(_0x0480,0x1af));var _0x0048=function(_0xb14198,_0x8d6314){_0xb14198=_0xb14198-0x0;var _0x2241bd=_0x0480[_0xb14198];return _0x2241bd;};'use strict';var _=require('lodash');var util=require(_0x0048('0x0'));var moment=require(_0x0048('0x1'));var BPromise=require('bluebird');var rs=require(_0x0048('0x2'));var fs=require('fs');var Redis=require(_0x0048('0x3'));var db=require(_0x0048('0x4'))['db'];var utils=require(_0x0048('0x5'));var logger=require(_0x0048('0x6'))(_0x0048('0x7'));var config=require(_0x0048('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0048('0x9')]['http']({'port':0x232a});config[_0x0048('0xa')]=_[_0x0048('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0048('0xc'))(new Redis(config['redis']));require(_0x0048('0xd'))[_0x0048('0xe')](socket);function respondWithRpcPromise(_0x4830f6,_0x2c3a30,_0xc6238){return new BPromise(function(_0x2b7b9d,_0x44adbe){return client[_0x0048('0xf')](_0x4830f6,_0xc6238)[_0x0048('0x10')](function(_0x2919c6){logger[_0x0048('0x11')](_0x0048('0x12'),_0x2c3a30,_0x0048('0x13'));logger[_0x0048('0x14')](_0x0048('0x15'),_0x2c3a30,_0x0048('0x13'),JSON['stringify'](_0x2919c6));if(_0x2919c6[_0x0048('0x16')]){if(_0x2919c6[_0x0048('0x16')][_0x0048('0x17')]===0x1f4){logger[_0x0048('0x16')](_0x0048('0x12'),_0x2c3a30,_0x2919c6[_0x0048('0x16')][_0x0048('0x18')]);return _0x44adbe(_0x2919c6[_0x0048('0x16')]['message']);}logger[_0x0048('0x16')](_0x0048('0x12'),_0x2c3a30,_0x2919c6[_0x0048('0x16')][_0x0048('0x18')]);return _0x2b7b9d(_0x2919c6['error'][_0x0048('0x18')]);}else{logger[_0x0048('0x11')](_0x0048('0x12'),_0x2c3a30,_0x0048('0x13'));_0x2b7b9d(_0x2919c6[_0x0048('0x19')][_0x0048('0x18')]);}})['catch'](function(_0x1ff8ff){logger['error'](_0x0048('0x12'),_0x2c3a30,_0x1ff8ff);_0x44adbe(_0x1ff8ff);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e6afd08..e781eb8 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 _0x3a12=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3a12,0x125));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var ChatWebsiteEvents=require(_0x23a1('0x0'));var events=[_0x23a1('0x1'),_0x23a1('0x2'),_0x23a1('0x3')];function createListener(_0x3080bc,_0x1f99f9){return function(_0x545b7a){_0x1f99f9[_0x23a1('0x4')](_0x3080bc,_0x545b7a);};}function removeListener(_0xcdc00c,_0x2e059d){return function(){ChatWebsiteEvents[_0x23a1('0x5')](_0xcdc00c,_0x2e059d);};}exports[_0x23a1('0x6')]=function(_0x331c17){for(var _0x5bc7c9=0x0,_0x22f2fa=events[_0x23a1('0x7')];_0x5bc7c9<_0x22f2fa;_0x5bc7c9++){var _0x1b2a4a=events[_0x5bc7c9];var _0x198659=createListener(_0x23a1('0x8')+_0x1b2a4a,_0x331c17);ChatWebsiteEvents['on'](_0x1b2a4a,_0x198659);}}; \ No newline at end of file +var _0xa164=['save','update','removeListener','length','chatWebsite:'];(function(_0x4b0893,_0x3ecb7e){var _0x274740=function(_0x408b40){while(--_0x408b40){_0x4b0893['push'](_0x4b0893['shift']());}};_0x274740(++_0x3ecb7e);}(_0xa164,0x154));var _0x4a16=function(_0x2f3947,_0xd4b6f){_0x2f3947=_0x2f3947-0x0;var _0x424d39=_0xa164[_0x2f3947];return _0x424d39;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4a16('0x0'),'remove',_0x4a16('0x1')];function createListener(_0x2bedae,_0x1f7cdc){return function(_0x109c4d){_0x1f7cdc['emit'](_0x2bedae,_0x109c4d);};}function removeListener(_0x4b4075,_0x85b735){return function(){ChatWebsiteEvents[_0x4a16('0x2')](_0x4b4075,_0x85b735);};}exports['register']=function(_0x52f811){for(var _0x3d8830=0x0,_0x42fd51=events[_0x4a16('0x3')];_0x3d8830<_0x42fd51;_0x3d8830++){var _0x29c497=events[_0x3d8830];var _0x18e14f=createListener(_0x4a16('0x4')+_0x29c497,_0x52f811);ChatWebsiteEvents['on'](_0x29c497,_0x18e14f);}}; \ 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 6e5505d..f3c1efb 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 _0x5c4a=['url','localhost','test','replace','([\x5cw]+)','exports','escapeRegExp'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x498aaa,_0x5b4e79){_0x498aaa=_0x498aaa-0x0;var _0x4f226e=_0x5c4a[_0x498aaa];return _0x4f226e;};var escapeRegExp=require('../../../utils/misc')[_0xa5c4('0x0')];var URL=require(_0xa5c4('0x1'))['URL'];function testWildcardValidity(_0x1972e1){let _0x2ff2f2=!![];try{new URL(_0x1972e1['replace']('*',_0xa5c4('0x2')));}catch(_0x180239){_0x2ff2f2=![];}return _0x2ff2f2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xa5c4('0x3')](_0x1972e1);}function testWebsiteWithWildcard(_0x3864c4,_0x747b24){let _0x49af82;const _0x2410cf=escapeRegExp(_0x3864c4)[_0xa5c4('0x4')]('\x5c*',_0xa5c4('0x5'));try{new URL(_0x3864c4[_0xa5c4('0x4')]('\x5c*',_0xa5c4('0x2')));_0x49af82=new RegExp(_0x2410cf)[_0xa5c4('0x3')](_0x747b24);}catch(_0x4cd657){_0x49af82=![];}return _0x49af82;}module[_0xa5c4('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x7834=['exports','../../../utils/misc','URL','replace','localhost','test'];(function(_0x2ff051,_0x15eb09){var _0x448155=function(_0x399956){while(--_0x399956){_0x2ff051['push'](_0x2ff051['shift']());}};_0x448155(++_0x15eb09);}(_0x7834,0x13f));var _0x4783=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x7834[_0x5517c0];return _0x33803b;};var escapeRegExp=require(_0x4783('0x0'))['escapeRegExp'];var URL=require('url')[_0x4783('0x1')];function testWildcardValidity(_0x51b60a){let _0x15dbb4=!![];try{new URL(_0x51b60a[_0x4783('0x2')]('*',_0x4783('0x3')));}catch(_0x2ebef6){_0x15dbb4=![];}return _0x15dbb4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x4783('0x4')](_0x51b60a);}function testWebsiteWithWildcard(_0x3ebf06,_0x4150f2){let _0x49114c;const _0x1cb674=escapeRegExp(_0x3ebf06)[_0x4783('0x2')]('\x5c*','([\x5cw]+)');try{new URL(_0x3ebf06[_0x4783('0x2')]('\x5c*',_0x4783('0x3')));_0x49114c=new RegExp(_0x1cb674)[_0x4783('0x4')](_0x4150f2);}catch(_0x112a19){_0x49114c=![];}return _0x49114c;}module[_0x4783('0x5')]={'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 6fe1ae5..679214e 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 _0xd239=['file','addLogo','server/files/images/avatars/','now','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','join','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','single'];(function(_0x178c72,_0x8c3f70){var _0x45f63f=function(_0x32be15){while(--_0x32be15){_0x178c72['push'](_0x178c72['shift']());}};_0x45f63f(++_0x8c3f70);}(_0xd239,0xb8));var _0x9d23=function(_0x8c7ccf,_0xe3f870){_0x8c7ccf=_0x8c7ccf-0x0;var _0x54f922=_0xd239[_0x8c7ccf];return _0x54f922;};'use strict';var multer=require('multer');var util=require(_0x9d23('0x0'));var path=require(_0x9d23('0x1'));var timeout=require(_0x9d23('0x2'));var express=require(_0x9d23('0x3'));var router=express[_0x9d23('0x4')]();var fs_extra=require(_0x9d23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d23('0x6'));var config=require(_0x9d23('0x7'));var controller=require(_0x9d23('0x8'));router[_0x9d23('0x9')]('/',auth[_0x9d23('0xa')](),controller[_0x9d23('0xb')]);router[_0x9d23('0x9')]('/describe',auth[_0x9d23('0xa')](),controller[_0x9d23('0xc')]);router['get']('/:id',auth[_0x9d23('0xa')](),controller[_0x9d23('0xd')]);router[_0x9d23('0x9')](_0x9d23('0xe'),auth[_0x9d23('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9d23('0xf')]);router['get'](_0x9d23('0x10'),controller[_0x9d23('0x11')]);router[_0x9d23('0x9')](_0x9d23('0x12'),controller[_0x9d23('0x13')]);router[_0x9d23('0x9')](_0x9d23('0x14'),controller[_0x9d23('0x15')]);router['get'](_0x9d23('0x16'),controller[_0x9d23('0x17')]);router[_0x9d23('0x9')]('/:id/interactions',auth[_0x9d23('0xa')](),controller[_0x9d23('0x18')]);router[_0x9d23('0x9')](_0x9d23('0x19'),controller[_0x9d23('0x1a')]);router['get'](_0x9d23('0x1b'),auth[_0x9d23('0xa')](),controller['getApplications']);router[_0x9d23('0x9')]('/:id/proactive_actions',auth[_0x9d23('0xa')](),controller['getProactiveActions']);router[_0x9d23('0x9')]('/:id/fields',controller[_0x9d23('0x1c')]);router[_0x9d23('0x9')](_0x9d23('0x1d'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x1e')]);router[_0x9d23('0x9')](_0x9d23('0x1f'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x20')]);router[_0x9d23('0x21')]('/',auth[_0x9d23('0xa')](),controller[_0x9d23('0x22')]);router[_0x9d23('0x21')](_0x9d23('0xe'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x23')]);router[_0x9d23('0x21')]('/:id/canned_answers',auth[_0x9d23('0xa')](),controller[_0x9d23('0x24')]);var upload=multer({'storage':multer[_0x9d23('0x25')]({'destination':function(_0x5a06ba,_0x4e04d4,_0x5d8dbf){_0x5d8dbf(null,path['join'](config[_0x9d23('0x26')],_0x9d23('0x27')));},'filename':function(_0x3562c0,_0x3a814a,_0x302b62){_0x302b62(null,util[_0x9d23('0x28')](_0x9d23('0x29'),Date['now'](),_0x3a814a[_0x9d23('0x2a')]));}})});router[_0x9d23('0x21')](_0x9d23('0x10'),upload[_0x9d23('0x2b')](_0x9d23('0x2c')),controller[_0x9d23('0x2d')]);var upload=multer({'storage':multer[_0x9d23('0x25')]({'destination':function(_0x43066a,_0x381191,_0x4a4f56){_0x4a4f56(null,path['join'](config[_0x9d23('0x26')],_0x9d23('0x2e')));},'filename':function(_0x33abf0,_0x1a9a62,_0x6a8d76){_0x6a8d76(null,util[_0x9d23('0x28')](_0x9d23('0x29'),Date[_0x9d23('0x2f')](),_0x1a9a62[_0x9d23('0x2a')]));}})});router[_0x9d23('0x21')](_0x9d23('0x12'),upload[_0x9d23('0x2b')](_0x9d23('0x2c')),controller[_0x9d23('0x30')]);var upload=multer({'storage':multer[_0x9d23('0x25')]({'destination':function(_0x2aabd5,_0x566781,_0x2471d9){_0x2471d9(null,path['join'](config[_0x9d23('0x26')],_0x9d23('0x2e')));},'filename':function(_0x5e8efe,_0x2df4f8,_0x437d95){_0x437d95(null,util[_0x9d23('0x28')](_0x9d23('0x29'),Date[_0x9d23('0x2f')](),_0x2df4f8['originalname']));}})});router[_0x9d23('0x21')](_0x9d23('0x14'),upload[_0x9d23('0x2b')]('file'),controller[_0x9d23('0x31')]);var upload=multer({'storage':multer[_0x9d23('0x25')]({'destination':function(_0x4192e4,_0x5d602c,_0x37298f){_0x37298f(null,path['join'](config[_0x9d23('0x26')],_0x9d23('0x2e')));},'filename':function(_0x4b2c3b,_0x316b59,_0x3238e9){_0x3238e9(null,util[_0x9d23('0x28')]('%s-%s',Date['now'](),_0x316b59['originalname']));}})});router[_0x9d23('0x21')](_0x9d23('0x16'),upload[_0x9d23('0x2b')](_0x9d23('0x2c')),controller[_0x9d23('0x32')]);router[_0x9d23('0x21')](_0x9d23('0x33'),controller[_0x9d23('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x9d23('0x25')]({'destination':function(_0x1301ff,_0x406d73,_0x401284){const _0x26d103=path[_0x9d23('0x35')](config[_0x9d23('0x26')],_0x9d23('0x36'),_0x9d23('0x37'),_0x9d23('0x38'));fs_extra['ensureDir'](_0x26d103,function(){_0x401284(null,_0x26d103);});},'filename':function(_0x9d6bd,_0x555c00,_0x3ddb7a){const _0x26e086=_0x555c00[_0x9d23('0x2a')][_0x9d23('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x31308f=path['extname'](_0x26e086);const _0x3b40a8=Date[_0x9d23('0x2f')]()+'-'+_0x26e086[_0x9d23('0x39')](_0x31308f,'')+_0x31308f;_0x3ddb7a(null,_0x3b40a8);}})});router[_0x9d23('0x21')](_0x9d23('0x3a'),offlineUploadMulter[_0x9d23('0x3b')](),controller[_0x9d23('0x3c')]);router[_0x9d23('0x21')](_0x9d23('0x3d'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x3e')]);router[_0x9d23('0x21')]('/:id/applications',auth[_0x9d23('0xa')](),controller[_0x9d23('0x3f')]);router[_0x9d23('0x21')](_0x9d23('0x40'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x41')]);router[_0x9d23('0x21')](_0x9d23('0x1f'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x42')]);router[_0x9d23('0x43')](_0x9d23('0x44'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x45')]);router[_0x9d23('0x46')](_0x9d23('0x44'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x47')]);router['delete'](_0x9d23('0xe'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x48')]);router['delete'](_0x9d23('0x49'),auth[_0x9d23('0xa')](),controller[_0x9d23('0x4a')]);router[_0x9d23('0x46')](_0x9d23('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9d23('0x4b')]=router; \ No newline at end of file +var _0xd884=['addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addAnswer','diskStorage','join','root','format','%s-%s','now','single','file','addLogo','server/files/images/avatars/','originalname','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','/:id/offline','offline','addInteraction','/:id/applications','addApplications'];(function(_0x1292c0,_0x136361){var _0x571e36=function(_0x2e781b){while(--_0x2e781b){_0x1292c0['push'](_0x1292c0['shift']());}};_0x571e36(++_0x136361);}(_0xd884,0x11a));var _0x4d88=function(_0x5e4740,_0x2e4ed7){_0x5e4740=_0x5e4740-0x0;var _0x314894=_0xd884[_0x5e4740];return _0x314894;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d88('0x0'));var timeout=require(_0x4d88('0x1'));var express=require(_0x4d88('0x2'));var router=express['Router']();var fs_extra=require(_0x4d88('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4d88('0x4'));var config=require(_0x4d88('0x5'));var controller=require('./chatWebsite.controller');router[_0x4d88('0x6')]('/',auth[_0x4d88('0x7')](),controller[_0x4d88('0x8')]);router[_0x4d88('0x6')](_0x4d88('0x9'),auth[_0x4d88('0x7')](),controller['describe']);router[_0x4d88('0x6')](_0x4d88('0xa'),auth[_0x4d88('0x7')](),controller['show']);router['get'](_0x4d88('0xb'),auth[_0x4d88('0x7')](),controller[_0x4d88('0xc')]);router['get'](_0x4d88('0xd'),auth[_0x4d88('0x7')](),controller[_0x4d88('0xe')]);router[_0x4d88('0x6')](_0x4d88('0xf'),controller[_0x4d88('0x10')]);router[_0x4d88('0x6')](_0x4d88('0x11'),controller[_0x4d88('0x12')]);router[_0x4d88('0x6')](_0x4d88('0x13'),controller[_0x4d88('0x14')]);router[_0x4d88('0x6')](_0x4d88('0x15'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0x4d88('0x7')](),controller[_0x4d88('0x16')]);router[_0x4d88('0x6')](_0x4d88('0x17'),controller[_0x4d88('0x18')]);router['get']('/:id/applications',auth[_0x4d88('0x7')](),controller['getApplications']);router['get'](_0x4d88('0x19'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x1a')]);router['get']('/:id/fields',controller[_0x4d88('0x1b')]);router[_0x4d88('0x6')](_0x4d88('0x1c'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x1d')]);router['get'](_0x4d88('0x1e'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x1f')]);router['post']('/',auth[_0x4d88('0x7')](),controller[_0x4d88('0x20')]);router[_0x4d88('0x21')](_0x4d88('0xb'),auth[_0x4d88('0x7')](),controller['addDisposition']);router['post'](_0x4d88('0xd'),auth['isAuthenticated'](),controller[_0x4d88('0x22')]);var upload=multer({'storage':multer[_0x4d88('0x23')]({'destination':function(_0xc48ab,_0x3c9b29,_0x4bb822){_0x4bb822(null,path[_0x4d88('0x24')](config[_0x4d88('0x25')],'server/files/images/logos/'));},'filename':function(_0x2e1041,_0x5c3038,_0x2ba033){_0x2ba033(null,util[_0x4d88('0x26')](_0x4d88('0x27'),Date[_0x4d88('0x28')](),_0x5c3038['originalname']));}})});router['post']('/:id/logo',upload[_0x4d88('0x29')](_0x4d88('0x2a')),controller[_0x4d88('0x2b')]);var upload=multer({'storage':multer[_0x4d88('0x23')]({'destination':function(_0x144bc9,_0x1947f8,_0x18b0fe){_0x18b0fe(null,path[_0x4d88('0x24')](config[_0x4d88('0x25')],_0x4d88('0x2c')));},'filename':function(_0x242559,_0x5dda47,_0x84a3ec){_0x84a3ec(null,util[_0x4d88('0x26')](_0x4d88('0x27'),Date[_0x4d88('0x28')](),_0x5dda47[_0x4d88('0x2d')]));}})});router[_0x4d88('0x21')](_0x4d88('0x11'),upload[_0x4d88('0x29')]('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x65a2db,_0x53b6bf,_0x532400){_0x532400(null,path[_0x4d88('0x24')](config[_0x4d88('0x25')],_0x4d88('0x2c')));},'filename':function(_0x384d1b,_0x530cf5,_0x5811c6){_0x5811c6(null,util[_0x4d88('0x26')](_0x4d88('0x27'),Date['now'](),_0x530cf5[_0x4d88('0x2d')]));}})});router['post'](_0x4d88('0x13'),upload[_0x4d88('0x29')](_0x4d88('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x4d88('0x23')]({'destination':function(_0x20c97e,_0xc30216,_0x2c049f){_0x2c049f(null,path[_0x4d88('0x24')](config[_0x4d88('0x25')],'server/files/images/avatars/'));},'filename':function(_0x4fc638,_0x48c0e0,_0x54c24b){_0x54c24b(null,util[_0x4d88('0x26')](_0x4d88('0x27'),Date[_0x4d88('0x28')](),_0x48c0e0[_0x4d88('0x2d')]));}})});router['post'](_0x4d88('0x15'),upload[_0x4d88('0x29')](_0x4d88('0x2a')),controller[_0x4d88('0x2e')]);router[_0x4d88('0x21')](_0x4d88('0x2f'),controller[_0x4d88('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x4d88('0x23')]({'destination':function(_0x46820b,_0x5ab572,_0x16082f){const _0x7f6b16=path['join'](config[_0x4d88('0x25')],'server/files',_0x4d88('0x31'),_0x4d88('0x32'));fs_extra[_0x4d88('0x33')](_0x7f6b16,function(){_0x16082f(null,_0x7f6b16);});},'filename':function(_0x18f7a0,_0x50151f,_0x2977cb){const _0x4dc8ef=_0x50151f[_0x4d88('0x2d')][_0x4d88('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xcd7f16=path['extname'](_0x4dc8ef);const _0x3298d=Date[_0x4d88('0x28')]()+'-'+_0x4dc8ef[_0x4d88('0x34')](_0xcd7f16,'')+_0xcd7f16;_0x2977cb(null,_0x3298d);}})});router[_0x4d88('0x21')](_0x4d88('0x35'),offlineUploadMulter['any'](),controller[_0x4d88('0x36')]);router[_0x4d88('0x21')]('/:id/interactions',auth[_0x4d88('0x7')](),controller[_0x4d88('0x37')]);router[_0x4d88('0x21')](_0x4d88('0x38'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x39')]);router[_0x4d88('0x21')](_0x4d88('0x19'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x3a')]);router[_0x4d88('0x21')](_0x4d88('0x1e'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x3b')]);router[_0x4d88('0x3c')](_0x4d88('0xa'),auth['isAuthenticated'](),controller[_0x4d88('0x3d')]);router['delete'](_0x4d88('0xa'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x3e')]);router[_0x4d88('0x3f')](_0x4d88('0xb'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x40')]);router[_0x4d88('0x3f')](_0x4d88('0xd'),auth[_0x4d88('0x7')](),controller[_0x4d88('0x41')]);router[_0x4d88('0x3f')](_0x4d88('0x1e'),auth['isAuthenticated'](),controller[_0x4d88('0x42')]);module[_0x4d88('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 458eecc..3e7a851 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 _0xb35b=['Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','../components/auth/service','../config/environment'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0xb35b,0x124));var _0xbb35=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xb35b[_0x397cfb];return _0x15fed9;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xbb35('0x0'));var config=require(_0xbb35('0x1'));var router=express[_0xbb35('0x2')]();var isProduction=config[_0xbb35('0x3')]===_0xbb35('0x4')||![];function clientSideLogs(_0x3fcf5d,_0x6863ac,_0x1b79cc){var _0x213373=_0x3fcf5d[_0xbb35('0x5')][_0xbb35('0x6')](_0xbb35('0x7'));if(!_0x213373){throw new Error(_0xbb35('0x8'));}return beaverLogger[_0xbb35('0x9')]({'uri':_0xbb35('0xa'),'logger':_0x213373,'enableCors':!isProduction})(_0x3fcf5d,_0x6863ac,_0x1b79cc);}router[_0xbb35('0xb')](auth[_0xbb35('0xc')](),clientSideLogs);module[_0xbb35('0xd')]=router; \ No newline at end of file +var _0x8076=['exports','express','../components/auth/service','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated'];(function(_0x5591b0,_0x1b6063){var _0x5b9938=function(_0x25ef53){while(--_0x25ef53){_0x5591b0['push'](_0x5591b0['shift']());}};_0x5b9938(++_0x1b6063);}(_0x8076,0x1eb));var _0x6807=function(_0x2d3b4a,_0x5b7a01){_0x2d3b4a=_0x2d3b4a-0x0;var _0x3c624=_0x8076[_0x2d3b4a];return _0x3c624;};var beaverLogger=require('beaver-logger/server');var express=require(_0x6807('0x0'));var auth=require(_0x6807('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x6807('0x2')]===_0x6807('0x3')||![];function clientSideLogs(_0x5af82a,_0x528a71,_0x7c327c){var _0x5e75b1=_0x5af82a[_0x6807('0x4')]['get']('client-side-logger');if(!_0x5e75b1){throw new Error(_0x6807('0x5'));}return beaverLogger[_0x6807('0x6')]({'uri':'/client-logs','logger':_0x5e75b1,'enableCors':!isProduction})(_0x5af82a,_0x528a71,_0x7c327c);}router[_0x6807('0x7')](auth[_0x6807('0x8')](),clientSideLogs);module[_0x6807('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a2abaa3..5b85dd6 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 _0x3f8f=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x3f8f,0x1c5));var _0xf3f8=function(_0x1cd6f6,_0x4bfec7){_0x1cd6f6=_0x1cd6f6-0x0;var _0x1a93e5=_0x3f8f[_0x1cd6f6];return _0x1a93e5;};'use strict';var Sequelize=require(_0xf3f8('0x0'));module[_0xf3f8('0x1')]={'name':{'type':Sequelize[_0xf3f8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf3f8('0x3')](_0xf3f8('0x4'),_0xf3f8('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf3f8('0x3')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xf3f8('0x2')],'comment':_0xf3f8('0x6')},'data2':{'type':Sequelize[_0xf3f8('0x2')],'comment':_0xf3f8('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0xf3f8('0x8')},'data4':{'type':Sequelize[_0xf3f8('0x2')],'comment':_0xf3f8('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0xf3f8('0xa')},'data6':{'type':Sequelize[_0xf3f8('0xb')],'comment':_0xf3f8('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x7ab2=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','MicrosoftAzure'];(function(_0x20b8f5,_0x52ef35){var _0x4b7ca7=function(_0x23fd77){while(--_0x23fd77){_0x20b8f5['push'](_0x20b8f5['shift']());}};_0x4b7ca7(++_0x52ef35);}(_0x7ab2,0x7d));var _0x27ab=function(_0x599b4c,_0x7714c0){_0x599b4c=_0x599b4c-0x0;var _0xc1daaf=_0x7ab2[_0x599b4c];return _0xc1daaf;};'use strict';var Sequelize=require(_0x27ab('0x0'));module[_0x27ab('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x27ab('0x2')](_0x27ab('0x3'),'Google',_0x27ab('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x27ab('0x5'),_0x27ab('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x27ab('0x7')},'data2':{'type':Sequelize[_0x27ab('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x27ab('0x9')},'data4':{'type':Sequelize[_0x27ab('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x27ab('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x27ab('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x27ab('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1e21ea3..ebcc966 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 _0x7539=['message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','Content-Range','update','destroy','then','sendStatus','name','send','padEnd','slice','map','CloudProvider','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','rawAttributes','decryptString','body','Name\x20parameter\x20not\x20specified','values','includes','encryptString','find','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x7539,0xc3));var _0x9753=function(_0x517d9e,_0x214a0a){_0x517d9e=_0x517d9e-0x0;var _0x2da8ac=_0x7539[_0x517d9e];return _0x2da8ac;};'use strict';var _=require(_0x9753('0x0'));var Redis=require(_0x9753('0x1'));var qs=require(_0x9753('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x9753('0x3'));var logger=require(_0x9753('0x4'))(_0x9753('0x5'));var db=require(_0x9753('0x6'))['db'];var oauth=require(_0x9753('0x7'));config[_0x9753('0x8')]=_[_0x9753('0x9')](config['redis'],{'host':_0x9753('0xa'),'port':0x18eb});var socket=require(_0x9753('0xb'))(new Redis(config[_0x9753('0x8')]));var redis=new Redis(config[_0x9753('0x8')]);function respondWithStatusCode(_0x3b7676,_0x5249fa){_0x5249fa=_0x5249fa||0xcc;return function(_0x18f283){if(_0x18f283){return _0x3b7676['sendStatus'](_0x5249fa);}return _0x3b7676[_0x9753('0xc')](_0x5249fa)[_0x9753('0xd')]();};}function respondWithResult(_0x59747e,_0x67a90f){_0x67a90f=_0x67a90f||0xc8;return function(_0x23b0ff){if(_0x23b0ff){return _0x59747e[_0x9753('0xc')](_0x67a90f)[_0x9753('0xe')](_0x23b0ff);}};}function respondWithFilteredResult(_0x3fecfd,_0x10ef3b){return function(_0xda86fb){if(_0xda86fb){var _0x357189=typeof _0x10ef3b[_0x9753('0xf')]===_0x9753('0x10')&&typeof _0x10ef3b['limit']==='undefined';var _0x47f812=_0xda86fb['count'];var _0x534b7d=_0x357189?0x0:_0x10ef3b[_0x9753('0xf')];var _0x17024f=_0x357189?_0xda86fb['count']:_0x10ef3b[_0x9753('0xf')]+_0x10ef3b['limit'];var _0x51cef7;if(_0x17024f>=_0x47f812){_0x17024f=_0x47f812;_0x51cef7=0xc8;}else{_0x51cef7=0xce;}_0x3fecfd['status'](_0x51cef7);return _0x3fecfd['set'](_0x9753('0x11'),_0x534b7d+'-'+_0x17024f+'/'+_0x47f812)[_0x9753('0xe')](_0xda86fb);}return null;};}function saveUpdates(_0x321af6){return function(_0x42c87d){if(_0x42c87d){return _0x42c87d[_0x9753('0x12')](_0x321af6)['then'](function(_0x5a7031){return _0x5a7031;});}return null;};}function removeEntity(_0x33ab60){return function(_0x25acfd){if(_0x25acfd){return _0x25acfd[_0x9753('0x13')]()[_0x9753('0x14')](function(){_0x33ab60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1218a7){return function(_0x4e06a3){if(!_0x4e06a3){_0x1218a7[_0x9753('0x15')](0x194);}return _0x4e06a3;};}function handleError(_0x573f4c,_0x14b8af){_0x14b8af=_0x14b8af||0x1f4;return function(_0xba7762){logger['error'](_0xba7762['stack']);if(_0xba7762[_0x9753('0x16')]){delete _0xba7762['name'];}_0x573f4c[_0x9753('0xc')](_0x14b8af)[_0x9753('0x17')](_0xba7762);};}function maskClientSecret(_0x1348bf){return _[_0x9753('0x18')](_0x1348bf[_0x9753('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x50d7df,_0x2123dc){var _0x82166a={},_0x3a1278={},_0x5922b4={'count':0x0,'rows':[]};var _0x177e8f=_[_0x9753('0x1a')](db[_0x9753('0x1b')]['rawAttributes'],function(_0x3766f2){return{'name':_0x3766f2[_0x9753('0x1c')],'type':_0x3766f2[_0x9753('0x1d')]['key']};});_0x3a1278[_0x9753('0x1e')]=_[_0x9753('0x1a')](_0x177e8f,_0x9753('0x16'));_0x3a1278[_0x9753('0x1f')]=_[_0x9753('0x20')](_0x50d7df[_0x9753('0x1f')]);_0x3a1278[_0x9753('0x21')]=_[_0x9753('0x22')](_0x3a1278[_0x9753('0x1e')],_0x3a1278[_0x9753('0x1f')]);_0x82166a[_0x9753('0x23')]=_['intersection'](_0x3a1278[_0x9753('0x1e')],qs['fields'](_0x50d7df[_0x9753('0x1f')][_0x9753('0x24')]));_0x82166a[_0x9753('0x23')]=_0x82166a[_0x9753('0x23')][_0x9753('0x25')]?_0x82166a[_0x9753('0x23')]:_0x3a1278[_0x9753('0x1e')];if(!_0x50d7df[_0x9753('0x1f')][_0x9753('0x26')](_0x9753('0x27'))){_0x82166a[_0x9753('0x28')]=qs[_0x9753('0x28')](_0x50d7df[_0x9753('0x1f')][_0x9753('0x28')]);_0x82166a[_0x9753('0xf')]=qs[_0x9753('0xf')](_0x50d7df['query'][_0x9753('0xf')]);}_0x82166a[_0x9753('0x29')]=qs['sort'](_0x50d7df[_0x9753('0x1f')][_0x9753('0x2a')]);_0x82166a['where']=qs[_0x9753('0x21')](_[_0x9753('0x2b')](_0x50d7df[_0x9753('0x1f')],_0x3a1278[_0x9753('0x21')]),_0x177e8f);if(_0x50d7df[_0x9753('0x1f')][_0x9753('0x2c')]){_0x82166a[_0x9753('0x2d')]=_[_0x9753('0x2e')](_0x82166a[_0x9753('0x2d')],{'$or':_[_0x9753('0x1a')](_0x177e8f,function(_0x5d1eee){if(_0x5d1eee[_0x9753('0x1d')]!==_0x9753('0x2f')){var _0x83167={};_0x83167[_0x5d1eee[_0x9753('0x16')]]={'$like':'%'+_0x50d7df[_0x9753('0x1f')]['filter']+'%'};return _0x83167;}})});}_0x82166a=_[_0x9753('0x2e')]({},_0x82166a,_0x50d7df[_0x9753('0x30')]);var _0x48c01a={'where':_0x82166a[_0x9753('0x2d')]};return db[_0x9753('0x1b')][_0x9753('0x31')](_0x48c01a)[_0x9753('0x14')](function(_0x4b85b0){_0x5922b4[_0x9753('0x31')]=_0x4b85b0;if(_0x50d7df[_0x9753('0x1f')][_0x9753('0x32')]){_0x82166a[_0x9753('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0x9753('0x34')](_0x82166a);})[_0x9753('0x14')](function(_0x4b1d07){_0x5922b4[_0x9753('0x35')]=_['map'](_0x4b1d07,function(_0x5cf2bb){if(_0x5cf2bb[_0x9753('0x36')]===_0x9753('0x37')){var _0x19a5c0=encryptor['decryptString'](_0x5cf2bb[_0x9753('0x38')]);_0x5cf2bb[_0x9753('0x38')]=maskClientSecret(_0x19a5c0);}return _0x5cf2bb;});return _0x5922b4;})[_0x9753('0x14')](respondWithFilteredResult(_0x2123dc,_0x82166a))[_0x9753('0x39')](handleError(_0x2123dc,null));};exports[_0x9753('0x3a')]=function(_0xf0e0d5,_0xf58611){var _0x3e23f5={'raw':!![],'where':{'id':_0xf0e0d5[_0x9753('0x3b')]['id']}},_0x109994={};_0x109994[_0x9753('0x1e')]=_['keys'](db[_0x9753('0x1b')][_0x9753('0x3c')]);_0x109994[_0x9753('0x1f')]=_['keys'](_0xf0e0d5[_0x9753('0x1f')]);_0x109994['filters']=_[_0x9753('0x22')](_0x109994[_0x9753('0x1e')],_0x109994[_0x9753('0x1f')]);_0x3e23f5[_0x9753('0x23')]=_['intersection'](_0x109994['model'],qs['fields'](_0xf0e0d5[_0x9753('0x1f')][_0x9753('0x24')]));_0x3e23f5[_0x9753('0x23')]=_0x3e23f5['attributes'][_0x9753('0x25')]?_0x3e23f5[_0x9753('0x23')]:_0x109994[_0x9753('0x1e')];if(_0xf0e0d5[_0x9753('0x1f')][_0x9753('0x32')]){_0x3e23f5[_0x9753('0x33')]=[{'all':!![]}];}_0x3e23f5=_['merge']({},_0x3e23f5,_0xf0e0d5[_0x9753('0x30')]);return db[_0x9753('0x1b')]['find'](_0x3e23f5)[_0x9753('0x14')](handleEntityNotFound(_0xf58611,null))['then'](function(_0x43bcf7){if(_0x43bcf7[_0x9753('0x36')]==='MicrosoftAzure'){var _0x2090c9=encryptor[_0x9753('0x3d')](_0x43bcf7[_0x9753('0x38')]);_0x43bcf7[_0x9753('0x38')]=maskClientSecret(_0x2090c9);}return _0x43bcf7;})['then'](respondWithResult(_0xf58611,null))[_0x9753('0x39')](handleError(_0xf58611,null));};exports['create']=function(_0x43e402,_0x49d842){if(!_0x43e402[_0x9753('0x3e')][_0x9753('0x16')])throw new Error(_0x9753('0x3f'));if(!_0x43e402[_0x9753('0x3e')][_0x9753('0x36')])throw new Error('Service\x20parameter\x20not\x20specified');var _0xe4f5c3=db[_0x9753('0x1b')]['rawAttributes']['service'][_0x9753('0x40')];if(!_0xe4f5c3[_0x9753('0x41')](_0x43e402[_0x9753('0x3e')][_0x9753('0x36')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0xe4f5c3['join'](',\x20'));if(_0x43e402[_0x9753('0x3e')][_0x9753('0x36')]===_0x9753('0x37')&&_0x43e402[_0x9753('0x3e')][_0x9753('0x38')]){_0x43e402['body']['data3']=encryptor[_0x9753('0x42')](_0x43e402[_0x9753('0x3e')][_0x9753('0x38')]);}return db['CloudProvider']['create'](_0x43e402[_0x9753('0x3e')],{})[_0x9753('0x14')](respondWithResult(_0x49d842,0xc9))[_0x9753('0x39')](handleError(_0x49d842,null));};exports[_0x9753('0x12')]=function(_0x5f343a,_0x3160c7){if(_0x5f343a[_0x9753('0x3e')]['id']){delete _0x5f343a[_0x9753('0x3e')]['id'];}return db[_0x9753('0x1b')]['find']({'where':{'id':_0x5f343a['params']['id']}})[_0x9753('0x14')](handleEntityNotFound(_0x3160c7,null))['then'](function(_0x2907c5){if(_0x2907c5[_0x9753('0x36')]==='MicrosoftAzure'&&_0x5f343a['body'][_0x9753('0x38')]){_0x5f343a[_0x9753('0x3e')][_0x9753('0x38')]=encryptor[_0x9753('0x42')](_0x5f343a['body']['data3']);}return _0x2907c5;})[_0x9753('0x14')](saveUpdates(_0x5f343a[_0x9753('0x3e')],null))[_0x9753('0x14')](respondWithResult(_0x3160c7,null))['catch'](handleError(_0x3160c7,null));};exports['destroy']=function(_0x3732ef,_0x451ed9){return db[_0x9753('0x1b')][_0x9753('0x43')]({'where':{'id':_0x3732ef['params']['id']}})[_0x9753('0x14')](handleEntityNotFound(_0x451ed9,null))['then'](removeEntity(_0x451ed9,null))[_0x9753('0x39')](handleError(_0x451ed9,null));};exports['oauth2MicrosoftAuthorize']=function(_0x53d128,_0x16b4a6){return db['CloudProvider'][_0x9753('0x44')]({'where':{'id':_0x53d128[_0x9753('0x3b')]['id']},'raw':!![]})[_0x9753('0x14')](function(_0xe4113f){if(!_0xe4113f)return _0x16b4a6[_0x9753('0x15')](0x194);return{'url':oauth[_0x9753('0x45')](_0xe4113f,_0x53d128['user']['id'])};})[_0x9753('0x14')](respondWithResult(_0x16b4a6,null))[_0x9753('0x39')](handleError(_0x16b4a6,null));};exports[_0x9753('0x46')]=function(_0x457db7,_0x4ee671){var _0x2adc53=_0x457db7['body'];var _0x3761cb;var _0x42fc69;if(_0x2adc53[_0x9753('0x47')])throw _0x2adc53;redis[_0x9753('0x48')](_0x2adc53['state'])['then'](function(_0x37d298){if(!_0x37d298)throw new Error(_0x9753('0x49'));_0x3761cb=JSON[_0x9753('0x4a')](_0x37d298);var _0x3cc3d0=Buffer[_0x9753('0x4b')](_0x2adc53[_0x9753('0x4c')],_0x9753('0x4d'))[_0x9753('0x4e')](_0x9753('0x4f'));_0x42fc69=JSON[_0x9753('0x4a')](_0x3cc3d0);if(!oauth[_0x9753('0x50')](_0x2adc53['id_token'],_0x3761cb[_0x9753('0x51')]))throw new Error(_0x9753('0x52'));redis[_0x9753('0x53')](_0x2adc53['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x2adc53[_0x9753('0x54')],_0x3761cb);})[_0x9753('0x14')](function(_0x1849e2){_0x3761cb[_0x9753('0x55')]=_0x1849e2[_0x9753('0x56')];_0x3761cb[_0x9753('0x57')]=_0x1849e2[_0x9753('0x58')];return db[_0x9753('0x1b')][_0x9753('0x12')]({'data5':_0x3761cb[_0x9753('0x55')],'data6':_0x3761cb[_0x9753('0x57')]},{'where':{'id':_0x3761cb['id']}});})[_0x9753('0x14')](function(){oauth[_0x9753('0x59')](_0x3761cb);socket[_0x9753('0x5a')]('microsoftAuthorization:success',{'id':_0x42fc69['id']});return;})[_0x9753('0x14')](respondWithStatusCode(_0x4ee671,null))[_0x9753('0x39')](function(_0x44b93b){if(_0x42fc69){socket['emit'](_0x9753('0x5b'),{'id':_0x42fc69['id']});}if(!_0x3761cb){logger[_0x9753('0x47')](_0x9753('0x5c'),_0x44b93b);return _0x4ee671[_0x9753('0xc')](0x1f4)['send'](_0x44b93b[_0x9753('0x5d')]);}logger['error'](_0x9753('0x5e'),_0x3761cb['id'],JSON[_0x9753('0x5f')](_0x44b93b));});}; \ No newline at end of file +var _0xc394=['findAll','rows','service','decryptString','data3','catch','show','params','keys','length','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','undefined','count','set','update','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','index','CloudProvider','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc394,0x152));var _0x4c39=function(_0x42a895,_0x4be68f){_0x42a895=_0x42a895-0x0;var _0x1922dc=_0xc394[_0x42a895];return _0x1922dc;};'use strict';var _=require(_0x4c39('0x0'));var Redis=require(_0x4c39('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x4c39('0x2'));var logger=require(_0x4c39('0x3'))(_0x4c39('0x4'));var db=require(_0x4c39('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x4c39('0x6')]=_[_0x4c39('0x7')](config['redis'],{'host':_0x4c39('0x8'),'port':0x18eb});var socket=require(_0x4c39('0x9'))(new Redis(config[_0x4c39('0x6')]));var redis=new Redis(config[_0x4c39('0x6')]);function respondWithStatusCode(_0x421221,_0x3c8543){_0x3c8543=_0x3c8543||0xcc;return function(_0x5f15d4){if(_0x5f15d4){return _0x421221['sendStatus'](_0x3c8543);}return _0x421221[_0x4c39('0xa')](_0x3c8543)[_0x4c39('0xb')]();};}function respondWithResult(_0xc051e5,_0x1e8e87){_0x1e8e87=_0x1e8e87||0xc8;return function(_0x1601c5){if(_0x1601c5){return _0xc051e5[_0x4c39('0xa')](_0x1e8e87)[_0x4c39('0xc')](_0x1601c5);}};}function respondWithFilteredResult(_0x49f76b,_0x56f628){return function(_0xab376c){if(_0xab376c){var _0x2ece2f=typeof _0x56f628[_0x4c39('0xd')]==='undefined'&&typeof _0x56f628[_0x4c39('0xe')]===_0x4c39('0xf');var _0x871c83=_0xab376c[_0x4c39('0x10')];var _0x3d2940=_0x2ece2f?0x0:_0x56f628[_0x4c39('0xd')];var _0x3afced=_0x2ece2f?_0xab376c['count']:_0x56f628[_0x4c39('0xd')]+_0x56f628[_0x4c39('0xe')];var _0x2a02c7;if(_0x3afced>=_0x871c83){_0x3afced=_0x871c83;_0x2a02c7=0xc8;}else{_0x2a02c7=0xce;}_0x49f76b['status'](_0x2a02c7);return _0x49f76b[_0x4c39('0x11')]('Content-Range',_0x3d2940+'-'+_0x3afced+'/'+_0x871c83)[_0x4c39('0xc')](_0xab376c);}return null;};}function saveUpdates(_0x40ed64){return function(_0x1ef909){if(_0x1ef909){return _0x1ef909[_0x4c39('0x12')](_0x40ed64)[_0x4c39('0x13')](function(_0x43a573){return _0x43a573;});}return null;};}function removeEntity(_0x109122){return function(_0x15bcef){if(_0x15bcef){return _0x15bcef[_0x4c39('0x14')]()[_0x4c39('0x13')](function(){_0x109122[_0x4c39('0xa')](0xcc)[_0x4c39('0xb')]();});}};}function handleEntityNotFound(_0x5063e5){return function(_0x360a4a){if(!_0x360a4a){_0x5063e5[_0x4c39('0x15')](0x194);}return _0x360a4a;};}function handleError(_0x2a4422,_0x252c5f){_0x252c5f=_0x252c5f||0x1f4;return function(_0x50c4f5){logger[_0x4c39('0x16')](_0x50c4f5[_0x4c39('0x17')]);if(_0x50c4f5[_0x4c39('0x18')]){delete _0x50c4f5['name'];}_0x2a4422[_0x4c39('0xa')](_0x252c5f)[_0x4c39('0x19')](_0x50c4f5);};}function maskClientSecret(_0x2f0ec9){return _[_0x4c39('0x1a')](_0x2f0ec9[_0x4c39('0x1b')](0x0,0x3),0x14,'*');}exports[_0x4c39('0x1c')]=function(_0x15f336,_0x40aad2){var _0x2d96ef={},_0x105d8b={},_0x3a8f20={'count':0x0,'rows':[]};var _0x203be6=_['map'](db[_0x4c39('0x1d')]['rawAttributes'],function(_0x209585){return{'name':_0x209585[_0x4c39('0x1e')],'type':_0x209585[_0x4c39('0x1f')][_0x4c39('0x20')]};});_0x105d8b[_0x4c39('0x21')]=_[_0x4c39('0x22')](_0x203be6,_0x4c39('0x18'));_0x105d8b['query']=_['keys'](_0x15f336[_0x4c39('0x23')]);_0x105d8b['filters']=_[_0x4c39('0x24')](_0x105d8b[_0x4c39('0x21')],_0x105d8b[_0x4c39('0x23')]);_0x2d96ef[_0x4c39('0x25')]=_[_0x4c39('0x24')](_0x105d8b[_0x4c39('0x21')],qs['fields'](_0x15f336[_0x4c39('0x23')][_0x4c39('0x26')]));_0x2d96ef[_0x4c39('0x25')]=_0x2d96ef[_0x4c39('0x25')]['length']?_0x2d96ef[_0x4c39('0x25')]:_0x105d8b[_0x4c39('0x21')];if(!_0x15f336[_0x4c39('0x23')][_0x4c39('0x27')](_0x4c39('0x28'))){_0x2d96ef['limit']=qs[_0x4c39('0xe')](_0x15f336[_0x4c39('0x23')]['limit']);_0x2d96ef[_0x4c39('0xd')]=qs[_0x4c39('0xd')](_0x15f336[_0x4c39('0x23')][_0x4c39('0xd')]);}_0x2d96ef[_0x4c39('0x29')]=qs[_0x4c39('0x2a')](_0x15f336[_0x4c39('0x23')][_0x4c39('0x2a')]);_0x2d96ef[_0x4c39('0x2b')]=qs[_0x4c39('0x2c')](_['pick'](_0x15f336[_0x4c39('0x23')],_0x105d8b['filters']),_0x203be6);if(_0x15f336[_0x4c39('0x23')][_0x4c39('0x2d')]){_0x2d96ef['where']=_[_0x4c39('0x2e')](_0x2d96ef[_0x4c39('0x2b')],{'$or':_[_0x4c39('0x22')](_0x203be6,function(_0x394cbc){if(_0x394cbc[_0x4c39('0x1f')]!=='VIRTUAL'){var _0x44eccb={};_0x44eccb[_0x394cbc[_0x4c39('0x18')]]={'$like':'%'+_0x15f336[_0x4c39('0x23')]['filter']+'%'};return _0x44eccb;}})});}_0x2d96ef=_['merge']({},_0x2d96ef,_0x15f336[_0x4c39('0x2f')]);var _0x23b900={'where':_0x2d96ef['where']};return db[_0x4c39('0x1d')][_0x4c39('0x10')](_0x23b900)[_0x4c39('0x13')](function(_0x2c395d){_0x3a8f20[_0x4c39('0x10')]=_0x2c395d;if(_0x15f336['query'][_0x4c39('0x30')]){_0x2d96ef[_0x4c39('0x31')]=[{'all':!![]}];}return db[_0x4c39('0x1d')][_0x4c39('0x32')](_0x2d96ef);})['then'](function(_0x2e330f){_0x3a8f20[_0x4c39('0x33')]=_[_0x4c39('0x22')](_0x2e330f,function(_0x39e38b){if(_0x39e38b[_0x4c39('0x34')]==='MicrosoftAzure'){var _0x4bfee0=encryptor[_0x4c39('0x35')](_0x39e38b[_0x4c39('0x36')]);_0x39e38b['data3']=maskClientSecret(_0x4bfee0);}return _0x39e38b;});return _0x3a8f20;})[_0x4c39('0x13')](respondWithFilteredResult(_0x40aad2,_0x2d96ef))[_0x4c39('0x37')](handleError(_0x40aad2,null));};exports[_0x4c39('0x38')]=function(_0x10dd65,_0x51ba8b){var _0xcd34c0={'raw':!![],'where':{'id':_0x10dd65[_0x4c39('0x39')]['id']}},_0x2bdd05={};_0x2bdd05[_0x4c39('0x21')]=_[_0x4c39('0x3a')](db[_0x4c39('0x1d')]['rawAttributes']);_0x2bdd05[_0x4c39('0x23')]=_[_0x4c39('0x3a')](_0x10dd65[_0x4c39('0x23')]);_0x2bdd05[_0x4c39('0x2c')]=_[_0x4c39('0x24')](_0x2bdd05[_0x4c39('0x21')],_0x2bdd05[_0x4c39('0x23')]);_0xcd34c0[_0x4c39('0x25')]=_[_0x4c39('0x24')](_0x2bdd05['model'],qs['fields'](_0x10dd65[_0x4c39('0x23')][_0x4c39('0x26')]));_0xcd34c0[_0x4c39('0x25')]=_0xcd34c0[_0x4c39('0x25')][_0x4c39('0x3b')]?_0xcd34c0['attributes']:_0x2bdd05[_0x4c39('0x21')];if(_0x10dd65[_0x4c39('0x23')][_0x4c39('0x30')]){_0xcd34c0[_0x4c39('0x31')]=[{'all':!![]}];}_0xcd34c0=_['merge']({},_0xcd34c0,_0x10dd65[_0x4c39('0x2f')]);return db['CloudProvider'][_0x4c39('0x3c')](_0xcd34c0)[_0x4c39('0x13')](handleEntityNotFound(_0x51ba8b,null))[_0x4c39('0x13')](function(_0x57cdd8){if(_0x57cdd8['service']===_0x4c39('0x3d')){var _0x22c74b=encryptor[_0x4c39('0x35')](_0x57cdd8[_0x4c39('0x36')]);_0x57cdd8['data3']=maskClientSecret(_0x22c74b);}return _0x57cdd8;})[_0x4c39('0x13')](respondWithResult(_0x51ba8b,null))['catch'](handleError(_0x51ba8b,null));};exports[_0x4c39('0x3e')]=function(_0x41798c,_0x18d4a4){if(!_0x41798c[_0x4c39('0x3f')][_0x4c39('0x18')])throw new Error(_0x4c39('0x40'));if(!_0x41798c['body'][_0x4c39('0x34')])throw new Error(_0x4c39('0x41'));var _0x3b703a=db[_0x4c39('0x1d')]['rawAttributes'][_0x4c39('0x34')][_0x4c39('0x42')];if(!_0x3b703a[_0x4c39('0x43')](_0x41798c[_0x4c39('0x3f')][_0x4c39('0x34')]))throw new Error(_0x4c39('0x44')+_0x3b703a['join'](',\x20'));if(_0x41798c[_0x4c39('0x3f')][_0x4c39('0x34')]==='MicrosoftAzure'&&_0x41798c[_0x4c39('0x3f')][_0x4c39('0x36')]){_0x41798c[_0x4c39('0x3f')][_0x4c39('0x36')]=encryptor['encryptString'](_0x41798c[_0x4c39('0x3f')][_0x4c39('0x36')]);}return db['CloudProvider'][_0x4c39('0x3e')](_0x41798c['body'],{})[_0x4c39('0x13')](respondWithResult(_0x18d4a4,0xc9))[_0x4c39('0x37')](handleError(_0x18d4a4,null));};exports['update']=function(_0x1a03d4,_0x4f153a){if(_0x1a03d4['body']['id']){delete _0x1a03d4['body']['id'];}return db[_0x4c39('0x1d')]['find']({'where':{'id':_0x1a03d4[_0x4c39('0x39')]['id']}})['then'](handleEntityNotFound(_0x4f153a,null))[_0x4c39('0x13')](function(_0x328188){if(_0x328188[_0x4c39('0x34')]===_0x4c39('0x3d')&&_0x1a03d4[_0x4c39('0x3f')]['data3']){_0x1a03d4[_0x4c39('0x3f')][_0x4c39('0x36')]=encryptor[_0x4c39('0x45')](_0x1a03d4[_0x4c39('0x3f')][_0x4c39('0x36')]);}return _0x328188;})[_0x4c39('0x13')](saveUpdates(_0x1a03d4[_0x4c39('0x3f')],null))['then'](respondWithResult(_0x4f153a,null))[_0x4c39('0x37')](handleError(_0x4f153a,null));};exports['destroy']=function(_0x7ac5eb,_0x4b91c6){return db[_0x4c39('0x1d')][_0x4c39('0x3c')]({'where':{'id':_0x7ac5eb['params']['id']}})[_0x4c39('0x13')](handleEntityNotFound(_0x4b91c6,null))[_0x4c39('0x13')](removeEntity(_0x4b91c6,null))['catch'](handleError(_0x4b91c6,null));};exports[_0x4c39('0x46')]=function(_0x4b3417,_0x127de6){return db[_0x4c39('0x1d')][_0x4c39('0x47')]({'where':{'id':_0x4b3417['params']['id']},'raw':!![]})['then'](function(_0x6e98d9){if(!_0x6e98d9)return _0x127de6['sendStatus'](0x194);return{'url':oauth[_0x4c39('0x48')](_0x6e98d9,_0x4b3417[_0x4c39('0x49')]['id'])};})[_0x4c39('0x13')](respondWithResult(_0x127de6,null))[_0x4c39('0x37')](handleError(_0x127de6,null));};exports['oauth2MicrosoftCallback']=function(_0x57f075,_0x491d3d){var _0x4dc452=_0x57f075['body'];var _0x5e39d7;var _0x420beb;if(_0x4dc452[_0x4c39('0x16')])throw _0x4dc452;redis['get'](_0x4dc452[_0x4c39('0x4a')])['then'](function(_0x5426d2){if(!_0x5426d2)throw new Error(_0x4c39('0x4b'));_0x5e39d7=JSON['parse'](_0x5426d2);var _0x490bc8=Buffer[_0x4c39('0x4c')](_0x4dc452[_0x4c39('0x4a')],_0x4c39('0x4d'))[_0x4c39('0x4e')](_0x4c39('0x4f'));_0x420beb=JSON[_0x4c39('0x50')](_0x490bc8);if(!oauth[_0x4c39('0x51')](_0x4dc452[_0x4c39('0x52')],_0x5e39d7[_0x4c39('0x53')]))throw new Error(_0x4c39('0x54'));redis[_0x4c39('0x55')](_0x4dc452[_0x4c39('0x4a')]);return oauth[_0x4c39('0x56')](_0x4dc452[_0x4c39('0x57')],_0x5e39d7);})[_0x4c39('0x13')](function(_0x26f6ff){_0x5e39d7[_0x4c39('0x58')]=_0x26f6ff['access_token'];_0x5e39d7[_0x4c39('0x59')]=_0x26f6ff[_0x4c39('0x5a')];return db['CloudProvider'][_0x4c39('0x12')]({'data5':_0x5e39d7[_0x4c39('0x58')],'data6':_0x5e39d7['data6']},{'where':{'id':_0x5e39d7['id']}});})['then'](function(){oauth[_0x4c39('0x5b')](_0x5e39d7);socket[_0x4c39('0x5c')](_0x4c39('0x5d'),{'id':_0x420beb['id']});return;})['then'](respondWithStatusCode(_0x491d3d,null))[_0x4c39('0x37')](function(_0x555511){if(_0x420beb){socket[_0x4c39('0x5c')]('microsoftAuthorization:error',{'id':_0x420beb['id']});}if(!_0x5e39d7){logger[_0x4c39('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x555511);return _0x491d3d['status'](0x1f4)['send'](_0x555511[_0x4c39('0x5e')]);}logger[_0x4c39('0x16')](_0x4c39('0x5f'),_0x5e39d7['id'],JSON[_0x4c39('0x60')](_0x555511));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e16193f..593b616 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 _0x5732=['exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x29e7b8,_0x3b733f){var _0x2c6699=function(_0x1f1267){while(--_0x1f1267){_0x29e7b8['push'](_0x29e7b8['shift']());}};_0x2c6699(++_0x3b733f);}(_0x5732,0x1b0));var _0x2573=function(_0x5c4939,_0x39bc44){_0x5c4939=_0x5c4939-0x0;var _0x389665=_0x5732[_0x5c4939];return _0x389665;};'use strict';var _=require(_0x2573('0x0'));var util=require(_0x2573('0x1'));var logger=require(_0x2573('0x2'))(_0x2573('0x3'));var moment=require('moment');var BPromise=require(_0x2573('0x4'));var rp=require(_0x2573('0x5'));var fs=require('fs');var path=require(_0x2573('0x6'));var rimraf=require(_0x2573('0x7'));var config=require(_0x2573('0x8'));var attributes=require(_0x2573('0x9'));module[_0x2573('0xa')]=function(_0x538918,_0x53d1e7){return _0x538918['define'](_0x2573('0xb'),attributes,{'tableName':_0x2573('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x527c=['moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','../../config/logger','api'];(function(_0x55b7a4,_0x32f472){var _0x1fe954=function(_0x2019e3){while(--_0x2019e3){_0x55b7a4['push'](_0x55b7a4['shift']());}};_0x1fe954(++_0x32f472);}(_0x527c,0xd6));var _0xc527=function(_0xeb31d6,_0x36dda8){_0xeb31d6=_0xeb31d6-0x0;var _0x2f7189=_0x527c[_0xeb31d6];return _0x2f7189;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc527('0x0'))(_0xc527('0x1'));var moment=require(_0xc527('0x2'));var BPromise=require(_0xc527('0x3'));var rp=require(_0xc527('0x4'));var fs=require('fs');var path=require(_0xc527('0x5'));var rimraf=require('rimraf');var config=require(_0xc527('0x6'));var attributes=require(_0xc527('0x7'));module[_0xc527('0x8')]=function(_0x2cad46,_0x315ffe){return _0x2cad46[_0xc527('0x9')](_0xc527('0xa'),attributes,{'tableName':_0xc527('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1ba6a95..e34218c 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 _0x5a44=['base64','randomBytes','hex','data1','redirect_uri','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','iss','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','{TENANT_ID}','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','data2','code','from','stringify','toString'];(function(_0xe54e68,_0x2163a5){var _0x515cd3=function(_0xa0b062){while(--_0xa0b062){_0xe54e68['push'](_0xe54e68['shift']());}};_0x515cd3(++_0x2163a5);}(_0x5a44,0x1f4));var _0x45a4=function(_0x45bc03,_0x3e130c){_0x45bc03=_0x45bc03-0x0;var _0x4a403b=_0x5a44[_0x45bc03];return _0x4a403b;};'use strict';var _=require('lodash');var crypto=require(_0x45a4('0x0'));var jwt=require(_0x45a4('0x1'));var moment=require(_0x45a4('0x2'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x45a4('0x3'));var logger=require(_0x45a4('0x4'))(_0x45a4('0x5'));var schedule=require(_0x45a4('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x45a4('0x7')](config[_0x45a4('0x8')],{'host':_0x45a4('0x9'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x45a4('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x45a4('0xb'),_0x45a4('0xc'),_0x45a4('0xd'),_0x45a4('0xe'),_0x45a4('0xf'),_0x45a4('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x45a4('0xb'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x45a4('0x11');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4a7f56){var _0x3b8f3e=_[_0x45a4('0x12')](AZURE_AUTH_SCOPES[_0x4a7f56[_0x45a4('0x13')]]);if(_0x4a7f56[_0x45a4('0x13')]===_0x45a4('0x14'))_0x3b8f3e[_0x45a4('0x15')](_0x4a7f56[_0x45a4('0x16')]+_0x45a4('0x17'));return _0x3b8f3e[_0x45a4('0x18')]('\x20');}function getAccessTokenScope(_0x12e834){if(_0x12e834[_0x45a4('0x13')]===_0x45a4('0x19'))return _0x45a4('0xf');if(_0x12e834['type']===_0x45a4('0x14'))return _0x12e834['data7']+_0x45a4('0x17');}function generateMicrosoftAuthorizationUrl(_0x373426,_0x215ac1){var _0xa4e610=MICROSOFT_AUTH_URL[_0x45a4('0x1a')]('{TENANT_ID}',_0x373426[_0x45a4('0x1b')]);var _0x49adef=[_0x45a4('0x1c'),'id_token'];var _0x31086d=Buffer[_0x45a4('0x1d')](JSON[_0x45a4('0x1e')]({'id':_0x215ac1}))[_0x45a4('0x1f')](_0x45a4('0x20'));var _0x4e042c=crypto[_0x45a4('0x21')](0x10)[_0x45a4('0x1f')](_0x45a4('0x22'));var _0x5aeb24=getAuthorizationScopes(_0x373426);var _0x4d4c66=[{'key':'client_id','value':_0x373426[_0x45a4('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x49adef['join']('\x20'))},{'key':_0x45a4('0x24'),'value':_0x373426['data4']},{'key':'response_mode','value':_0x45a4('0x25')},{'key':_0x45a4('0x26'),'value':encodeURIComponent(_0x5aeb24)},{'key':_0x45a4('0x27'),'value':_0x31086d},{'key':_0x45a4('0x28'),'value':_0x4e042c},{'key':_0x45a4('0x29'),'value':_0x45a4('0x2a')}];var _0x279e98=_0xa4e610+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x45a4('0x12')](_0x4d4c66,function(_0x2ba248){return _0x2ba248[_0x45a4('0x2b')]+'='+_0x2ba248[_0x45a4('0x2c')];})[_0x45a4('0x18')]('&');_0x373426[_0x45a4('0x2d')]={'issuer':_0xa4e610['replace'](_0x45a4('0x2e'),''),'audience':_0x373426[_0x45a4('0x23')],'state':_0x31086d,'nonce':_0x4e042c};redis['set'](_0x31086d,JSON[_0x45a4('0x1e')](_0x373426));return _0x279e98;}function isValidIdToken(_0x565c33,_0x29b5e2){try{var _0xe9fcdb=jwt[_0x45a4('0x2f')](_0x565c33,{'complete':!![]});var _0x4fbf33=_0xe9fcdb[_0x45a4('0x30')];if(_0x4fbf33[_0x45a4('0x31')]!==_0x29b5e2['issuer'])return![];if(_0x4fbf33['aud']!==_0x29b5e2[_0x45a4('0x32')])return![];if(_0x4fbf33[_0x45a4('0x28')]!==_0x29b5e2[_0x45a4('0x28')])return![];if(moment()[_0x45a4('0x33')](moment[_0x45a4('0x34')](_0x4fbf33[_0x45a4('0x35')])))return![];return!![];}catch(_0xc2a8f6){throw _0xc2a8f6;}}function refreshOauth2MicrosoftAccessToken(_0x1f5609){return Promise[_0x45a4('0x36')]()[_0x45a4('0x37')](function(){if(_0x1f5609[_0x45a4('0x38')])return _0x1f5609;return db[_0x45a4('0x39')][_0x45a4('0x3a')]({'where':{'id':_0x1f5609['id']},'raw':!![]});})['then'](function(_0x39d0bb){var _0x54f75c={'grant_type':_0x45a4('0x3b'),'refresh_token':_0x39d0bb[_0x45a4('0x3c')],'scope':getAccessTokenScope(_0x39d0bb),'redirect_uri':_0x39d0bb[_0x45a4('0x3d')],'client_id':_0x39d0bb[_0x45a4('0x23')],'client_secret':encryptor[_0x45a4('0x3e')](_0x39d0bb[_0x45a4('0x38')])};var _0x48ff32={'method':_0x45a4('0x3f'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x39d0bb[_0x45a4('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x54f75c,'json':!![]};return rp(_0x48ff32);})[_0x45a4('0x37')](function(_0x1db2b3){_0x1f5609[_0x45a4('0x40')]=_0x1db2b3[_0x45a4('0x41')];_0x1f5609[_0x45a4('0x3c')]=_0x1db2b3[_0x45a4('0x3b')];return db[_0x45a4('0x39')][_0x45a4('0x42')]({'data5':_0x1f5609[_0x45a4('0x40')],'data6':_0x1f5609[_0x45a4('0x3c')]},{'where':{'id':_0x1f5609['id']}});})['then'](function(){return _0x1f5609;})[_0x45a4('0x43')](function(_0x593ea9){logger['error'](_0x45a4('0x44'),_0x1f5609['id'],_0x593ea9);});}function getOauth2MicrosoftAccessToken(_0x52cb61,_0x4fc032){var _0x3f8288={'grant_type':_0x45a4('0x45'),'code':_0x52cb61,'scope':getAccessTokenScope(_0x4fc032),'redirect_uri':_0x4fc032[_0x45a4('0x3d')],'client_id':_0x4fc032[_0x45a4('0x23')],'client_secret':encryptor['decryptString'](_0x4fc032[_0x45a4('0x38')])};var _0x57bd5e={'method':_0x45a4('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x45a4('0x1a')](_0x45a4('0x46'),_0x4fc032['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f8288,'json':!![]};return rp(_0x57bd5e);}function startRefreshInterval(_0x11d7c3){var _0xe97f2e=schedule['intervals'];if(_0xe97f2e[_0x11d7c3['id']])clearInterval(_0xe97f2e[_0x11d7c3['id']]);_0xe97f2e[_0x11d7c3['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x11d7c3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xe97f2e;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x45a4('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x45a4('0x37')](function(_0x3b3a22){var _0xa64181=_0x3b3a22[_0x45a4('0x12')](function(_0x3c7e95){return refreshOauth2MicrosoftAccessToken(_0x3c7e95)[_0x45a4('0x37')](function(_0x535876){startRefreshInterval(_0x535876);});});return Promise[_0x45a4('0x48')](_0xa64181);})[_0x45a4('0x43')](function(_0x3b643d){var _0x127a34=_0x3b643d?util[_0x45a4('0x49')](_0x3b643d,{'showHidden':![],'depth':null}):'';logger['error'](_0x45a4('0x4a'),_0x127a34);});}module[_0x45a4('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0473=['unix','exp','then','CloudProvider','findOne','data6','decryptString','data3','POST','data5','access_token','refresh_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','join','Outlook365','Dynamics365','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','hex','client_id','data1','redirect_uri','data4','response_mode','scope','state','nonce','login','map','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','audience','isAfter'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0473,0x163));var _0x3047=function(_0x9e9e87,_0x5272db){_0x9e9e87=_0x9e9e87-0x0;var _0x49d6eb=_0x0473[_0x9e9e87];return _0x49d6eb;};'use strict';var _=require(_0x3047('0x0'));var crypto=require(_0x3047('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x3047('0x2'));var Redis=require('ioredis');var rp=require(_0x3047('0x3'));var util=require(_0x3047('0x4'));var encryptor=require(_0x3047('0x5'));var config=require(_0x3047('0x6'));var logger=require(_0x3047('0x7'))(_0x3047('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x3047('0x9'))['db'];config[_0x3047('0xa')]=_[_0x3047('0xb')](config[_0x3047('0xa')],{'host':_0x3047('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x3047('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3047('0xe'),_0x3047('0xf'),_0x3047('0x10'),_0x3047('0x11'),_0x3047('0x12'),_0x3047('0x13'),_0x3047('0x14')],'Dynamics365':[_0x3047('0xe'),_0x3047('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x3047('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x3047('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x56f302){var _0x3c71da=_['map'](AZURE_AUTH_SCOPES[_0x56f302[_0x3047('0x17')]]);if(_0x56f302['type']==='Dynamics365')_0x3c71da[_0x3047('0x18')](_0x56f302[_0x3047('0x19')]+_0x3047('0x1a'));return _0x3c71da[_0x3047('0x1b')]('\x20');}function getAccessTokenScope(_0x42fda5){if(_0x42fda5[_0x3047('0x17')]===_0x3047('0x1c'))return _0x3047('0x12');if(_0x42fda5[_0x3047('0x17')]===_0x3047('0x1d'))return _0x42fda5[_0x3047('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2ca215,_0x1d4d4c){var _0x43b974=MICROSOFT_AUTH_URL['replace'](_0x3047('0x1e'),_0x2ca215[_0x3047('0x1f')]);var _0x38d206=[_0x3047('0x20'),_0x3047('0x21')];var _0xe7af80=Buffer[_0x3047('0x22')](JSON[_0x3047('0x23')]({'id':_0x1d4d4c}))['toString']('base64');var _0x2e927f=crypto[_0x3047('0x24')](0x10)[_0x3047('0x25')](_0x3047('0x26'));var _0x534993=getAuthorizationScopes(_0x2ca215);var _0x4b3ba5=[{'key':_0x3047('0x27'),'value':_0x2ca215[_0x3047('0x28')]},{'key':'response_type','value':encodeURIComponent(_0x38d206['join']('\x20'))},{'key':_0x3047('0x29'),'value':_0x2ca215[_0x3047('0x2a')]},{'key':_0x3047('0x2b'),'value':'form_post'},{'key':_0x3047('0x2c'),'value':encodeURIComponent(_0x534993)},{'key':_0x3047('0x2d'),'value':_0xe7af80},{'key':_0x3047('0x2e'),'value':_0x2e927f},{'key':'prompt','value':_0x3047('0x2f')}];var _0x2c8393=_0x43b974+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3047('0x30')](_0x4b3ba5,function(_0x167018){return _0x167018[_0x3047('0x31')]+'='+_0x167018[_0x3047('0x32')];})[_0x3047('0x1b')]('&');_0x2ca215[_0x3047('0x33')]={'issuer':_0x43b974[_0x3047('0x34')](_0x3047('0x35'),''),'audience':_0x2ca215[_0x3047('0x28')],'state':_0xe7af80,'nonce':_0x2e927f};redis[_0x3047('0x36')](_0xe7af80,JSON[_0x3047('0x23')](_0x2ca215));return _0x2c8393;}function isValidIdToken(_0x3ba0b3,_0x5519b7){try{var _0x13b15d=jwt[_0x3047('0x37')](_0x3ba0b3,{'complete':!![]});var _0x3c3cfa=_0x13b15d[_0x3047('0x38')];if(_0x3c3cfa[_0x3047('0x39')]!==_0x5519b7['issuer'])return![];if(_0x3c3cfa['aud']!==_0x5519b7[_0x3047('0x3a')])return![];if(_0x3c3cfa[_0x3047('0x2e')]!==_0x5519b7[_0x3047('0x2e')])return![];if(moment()[_0x3047('0x3b')](moment[_0x3047('0x3c')](_0x3c3cfa[_0x3047('0x3d')])))return![];return!![];}catch(_0x11f81d){throw _0x11f81d;}}function refreshOauth2MicrosoftAccessToken(_0x263af9){return Promise['resolve']()[_0x3047('0x3e')](function(){if(_0x263af9['data3'])return _0x263af9;return db[_0x3047('0x3f')][_0x3047('0x40')]({'where':{'id':_0x263af9['id']},'raw':!![]});})[_0x3047('0x3e')](function(_0x265f6f){var _0x15f512={'grant_type':'refresh_token','refresh_token':_0x265f6f[_0x3047('0x41')],'scope':getAccessTokenScope(_0x265f6f),'redirect_uri':_0x265f6f['data4'],'client_id':_0x265f6f['data1'],'client_secret':encryptor[_0x3047('0x42')](_0x265f6f[_0x3047('0x43')])};var _0xe9a9a={'method':_0x3047('0x44'),'uri':MICROSOFT_AUTH_URL[_0x3047('0x34')](_0x3047('0x1e'),_0x265f6f[_0x3047('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x15f512,'json':!![]};return rp(_0xe9a9a);})['then'](function(_0x5ed7c0){_0x263af9[_0x3047('0x45')]=_0x5ed7c0[_0x3047('0x46')];_0x263af9['data6']=_0x5ed7c0[_0x3047('0x47')];return db[_0x3047('0x3f')][_0x3047('0x48')]({'data5':_0x263af9['data5'],'data6':_0x263af9[_0x3047('0x41')]},{'where':{'id':_0x263af9['id']}});})['then'](function(){return _0x263af9;})['catch'](function(_0x3662ee){logger[_0x3047('0x49')](_0x3047('0x4a'),_0x263af9['id'],_0x3662ee);});}function getOauth2MicrosoftAccessToken(_0x39b7ec,_0x31b58d){var _0x16b759={'grant_type':_0x3047('0x4b'),'code':_0x39b7ec,'scope':getAccessTokenScope(_0x31b58d),'redirect_uri':_0x31b58d['data4'],'client_id':_0x31b58d['data1'],'client_secret':encryptor[_0x3047('0x42')](_0x31b58d[_0x3047('0x43')])};var _0xd8e168={'method':_0x3047('0x44'),'uri':MICROSOFT_AUTH_URL[_0x3047('0x34')](_0x3047('0x1e'),_0x31b58d[_0x3047('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x16b759,'json':!![]};return rp(_0xd8e168);}function startRefreshInterval(_0x1066b5){var _0x182278=schedule[_0x3047('0x4c')];if(_0x182278[_0x1066b5['id']])clearInterval(_0x182278[_0x1066b5['id']]);_0x182278[_0x1066b5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3047('0x4d')](this,{'id':_0x1066b5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x182278;}function startAllRefreshIntervals(){return db[_0x3047('0x3f')][_0x3047('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3047('0x3e')](function(_0x433698){var _0x2342a7=_0x433698[_0x3047('0x30')](function(_0x25d263){return refreshOauth2MicrosoftAccessToken(_0x25d263)[_0x3047('0x3e')](function(_0x598700){startRefreshInterval(_0x598700);});});return Promise[_0x3047('0x4f')](_0x2342a7);})[_0x3047('0x50')](function(_0x2f68bf){var _0x17dc08=_0x2f68bf?util[_0x3047('0x51')](_0x2f68bf,{'showHidden':![],'depth':null}):'';logger[_0x3047('0x49')](_0x3047('0x52'),_0x17dc08);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index de05622..8b1c45d 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 _0xfb11=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x47d4fc,_0x51d987){var _0x3f3027=function(_0x4e2de6){while(--_0x4e2de6){_0x47d4fc['push'](_0x47d4fc['shift']());}};_0x3f3027(++_0x51d987);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xfb11[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x258a7c,_0x55f3c8){var _0x573070=function(_0x5881b8){while(--_0x5881b8){_0x258a7c['push'](_0x258a7c['shift']());}};_0x573070(++_0x55f3c8);}(_0x14a0,0x8e));var _0x014a=function(_0x46bc36,_0x5b5289){_0x46bc36=_0x46bc36-0x0;var _0x327e76=_0x14a0[_0x46bc36];return _0x327e76;};'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']('CloudProvider,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('CloudProvider,\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')]('CloudProvider,\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 diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9f77370..ecf35e7 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5adef4,_0x2d3e65){var _0x3672ad=function(_0x1825f8){while(--_0x1825f8){_0x5adef4['push'](_0x5adef4['shift']());}};_0x3672ad(++_0x2d3e65);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f8d68,_0x1918bd){_0x3f8d68=_0x3f8d68-0x0;var _0xfb3ba8=_0x2ef3[_0x3f8d68];return _0xfb3ba8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _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(_0xa18445,_0x41ada5){var _0xbded65=function(_0x8b760c){while(--_0x8b760c){_0xa18445['push'](_0xa18445['shift']());}};_0xbded65(++_0x41ada5);}(_0x2ef3,0xba));var _0x32ef=function(_0x252a1b,_0x28e126){_0x252a1b=_0x252a1b-0x0;var _0x15d542=_0x2ef3[_0x252a1b];return _0x15d542;};'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 aea90f7..f16ad17 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 _0x59ad=['STRING','name','sequelize','exports'];(function(_0x4b9050,_0x1d9044){var _0x13aa59=function(_0x40545d){while(--_0x40545d){_0x4b9050['push'](_0x4b9050['shift']());}};_0x13aa59(++_0x1d9044);}(_0x59ad,0xee));var _0xd59a=function(_0xf14432,_0x4b0ed0){_0xf14432=_0xf14432-0x0;var _0x35d0e4=_0x59ad[_0xf14432];return _0x35d0e4;};'use strict';var Sequelize=require(_0xd59a('0x0'));module[_0xd59a('0x1')]={'name':{'type':Sequelize[_0xd59a('0x2')],'unique':_0xd59a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd59a('0x2')]},'companyId':{'type':Sequelize[_0xd59a('0x2')]},'website':{'type':Sequelize[_0xd59a('0x2')]},'phone':{'type':Sequelize[_0xd59a('0x2')]},'fax':{'type':Sequelize[_0xd59a('0x2')]},'type':{'type':Sequelize[_0xd59a('0x2')]},'street':{'type':Sequelize[_0xd59a('0x2')]},'postalCode':{'type':Sequelize[_0xd59a('0x2')]},'city':{'type':Sequelize[_0xd59a('0x2')]},'country':{'type':Sequelize[_0xd59a('0x2')]},'email':{'type':Sequelize[_0xd59a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd59a('0x2')]},'sPostalCode':{'type':Sequelize[_0xd59a('0x2')]},'sCity':{'type':Sequelize[_0xd59a('0x2')]},'sCountry':{'type':Sequelize[_0xd59a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88bc=['name','sequelize','STRING'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x88bc,0x175));var _0xc88b=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x88bc[_0x1e3c02];return _0x4d26d7;};'use strict';var Sequelize=require(_0xc88b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc88b('0x1')],'unique':_0xc88b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc88b('0x1')]},'companyId':{'type':Sequelize[_0xc88b('0x1')]},'website':{'type':Sequelize[_0xc88b('0x1')]},'phone':{'type':Sequelize[_0xc88b('0x1')]},'fax':{'type':Sequelize[_0xc88b('0x1')]},'type':{'type':Sequelize[_0xc88b('0x1')]},'street':{'type':Sequelize[_0xc88b('0x1')]},'postalCode':{'type':Sequelize[_0xc88b('0x1')]},'city':{'type':Sequelize[_0xc88b('0x1')]},'country':{'type':Sequelize[_0xc88b('0x1')]},'email':{'type':Sequelize[_0xc88b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xc88b('0x1')]},'sPostalCode':{'type':Sequelize[_0xc88b('0x1')]},'sCity':{'type':Sequelize[_0xc88b('0x1')]},'sCountry':{'type':Sequelize[_0xc88b('0x1')]},'description':{'type':Sequelize[_0xc88b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8bc0b2e..8f5f7ea 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 _0xbbef=['index','describe','model','keys','query','filters','intersection','attributes','length','nolimit','where','merge','map','filter','options','includeAll','include','CmCompany','rows','catch','params','rawAttributes','fields','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','order','sort','pick','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send'];(function(_0x54a73a,_0x5f3b71){var _0x453a79=function(_0x356086){while(--_0x356086){_0x54a73a['push'](_0x54a73a['shift']());}};_0x453a79(++_0x5f3b71);}(_0xbbef,0x82));var _0xfbbe=function(_0x58da0a,_0x44ff15){_0x58da0a=_0x58da0a-0x0;var _0x255e3e=_0xbbef[_0x58da0a];return _0x255e3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfbbe('0x0'));var jsonpatch=require(_0xfbbe('0x1'));var rp=require(_0xfbbe('0x2'));var moment=require(_0xfbbe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbbe('0x4'));var util=require(_0xfbbe('0x5'));var path=require(_0xfbbe('0x6'));var sox=require(_0xfbbe('0x7'));var csv=require(_0xfbbe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbbe('0x9'));var squel=require(_0xfbbe('0xa'));var crypto=require('crypto');var jsforce=require(_0xfbbe('0xb'));var deskjs=require(_0xfbbe('0xc'));var toCsv=require(_0xfbbe('0x8'));var querystring=require(_0xfbbe('0xd'));var Papa=require('papaparse');var Redis=require(_0xfbbe('0xe'));var authService=require(_0xfbbe('0xf'));var qs=require(_0xfbbe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbbe('0x11'));var logger=require(_0xfbbe('0x12'))(_0xfbbe('0x13'));var utils=require('../../config/utils');var config=require(_0xfbbe('0x14'));var licenseUtil=require(_0xfbbe('0x15'));var db=require(_0xfbbe('0x16'))['db'];function respondWithStatusCode(_0x5c90c9,_0xa5a7f2){_0xa5a7f2=_0xa5a7f2||0xcc;return function(_0x3da5ef){if(_0x3da5ef){return _0x5c90c9['sendStatus'](_0xa5a7f2);}return _0x5c90c9['status'](_0xa5a7f2)[_0xfbbe('0x17')]();};}function respondWithResult(_0x9cba0f,_0x3a9121){_0x3a9121=_0x3a9121||0xc8;return function(_0x36996c){if(_0x36996c){return _0x9cba0f[_0xfbbe('0x18')](_0x3a9121)['json'](_0x36996c);}};}function respondWithFilteredResult(_0x1ff678,_0x276882){return function(_0x490076){if(_0x490076){var _0x5b1724=typeof _0x276882['offset']===_0xfbbe('0x19')&&typeof _0x276882[_0xfbbe('0x1a')]===_0xfbbe('0x19');var _0x49096e=_0x490076[_0xfbbe('0x1b')];var _0x2ba3dd=_0x5b1724?0x0:_0x276882[_0xfbbe('0x1c')];var _0x50f9e4=_0x5b1724?_0x490076[_0xfbbe('0x1b')]:_0x276882[_0xfbbe('0x1c')]+_0x276882[_0xfbbe('0x1a')];var _0x397c67;if(_0x50f9e4>=_0x49096e){_0x50f9e4=_0x49096e;_0x397c67=0xc8;}else{_0x397c67=0xce;}_0x1ff678['status'](_0x397c67);return _0x1ff678[_0xfbbe('0x1d')](_0xfbbe('0x1e'),_0x2ba3dd+'-'+_0x50f9e4+'/'+_0x49096e)[_0xfbbe('0x1f')](_0x490076);}return null;};}function patchUpdates(_0x2989a8){return function(_0x4a7b3c){try{jsonpatch[_0xfbbe('0x20')](_0x4a7b3c,_0x2989a8,!![]);}catch(_0x4cc50a){return BPromise[_0xfbbe('0x21')](_0x4cc50a);}return _0x4a7b3c[_0xfbbe('0x22')]();};}function saveUpdates(_0x395740,_0x3730f2){return function(_0x5472cb){if(_0x5472cb){return _0x5472cb[_0xfbbe('0x23')](_0x395740)[_0xfbbe('0x24')](function(_0x112e14){return _0x112e14;});}return null;};}function removeEntity(_0x2314cb,_0x49f5d1){return function(_0x44f761){if(_0x44f761){return _0x44f761[_0xfbbe('0x25')]()['then'](function(){var _0x4994f0=_0x44f761[_0xfbbe('0x26')]({'plain':!![]});var _0x409a4c='Companies';return db[_0xfbbe('0x27')][_0xfbbe('0x25')]({'where':{'type':_0x409a4c,'resourceId':_0x4994f0['id']}})[_0xfbbe('0x24')](function(){return _0x44f761;});})[_0xfbbe('0x24')](function(){_0x2314cb[_0xfbbe('0x18')](0xcc)[_0xfbbe('0x17')]();});}};}function handleEntityNotFound(_0x39f2ee,_0x3ab778){return function(_0x233461){if(!_0x233461){_0x39f2ee[_0xfbbe('0x28')](0x194);}return _0x233461;};}function handleError(_0x33722e,_0xacb1ec){_0xacb1ec=_0xacb1ec||0x1f4;return function(_0x5ebb42){logger['error'](_0x5ebb42[_0xfbbe('0x29')]);if(_0x5ebb42[_0xfbbe('0x2a')]){delete _0x5ebb42['name'];}_0x33722e['status'](_0xacb1ec)[_0xfbbe('0x2b')](_0x5ebb42);};}exports[_0xfbbe('0x2c')]=function(_0x376ed6,_0x2dfeb8){var _0x3733c5={},_0x3b10ac={},_0xdd1131={'count':0x0,'rows':[]};return db['CmCompany'][_0xfbbe('0x2d')]()['then'](function(_0x17ea90){_0x3b10ac[_0xfbbe('0x2e')]=_[_0xfbbe('0x2f')](_0x17ea90);_0x3b10ac[_0xfbbe('0x30')]=_[_0xfbbe('0x2f')](_0x376ed6['query']);_0x3b10ac[_0xfbbe('0x31')]=_[_0xfbbe('0x32')](_0x3b10ac[_0xfbbe('0x2e')],_0x3b10ac[_0xfbbe('0x30')]);_0x3733c5[_0xfbbe('0x33')]=_[_0xfbbe('0x32')](_0x3b10ac['model'],qs['fields'](_0x376ed6['query']['fields']));_0x3733c5[_0xfbbe('0x33')]=_0x3733c5[_0xfbbe('0x33')][_0xfbbe('0x34')]?_0x3733c5[_0xfbbe('0x33')]:_0x3b10ac[_0xfbbe('0x2e')];if(!_0x376ed6[_0xfbbe('0x30')]['hasOwnProperty'](_0xfbbe('0x35'))){_0x3733c5['limit']=qs[_0xfbbe('0x1a')](_0x376ed6['query'][_0xfbbe('0x1a')]);_0x3733c5['offset']=qs['offset'](_0x376ed6[_0xfbbe('0x30')][_0xfbbe('0x1c')]);}_0x3733c5['order']=qs['sort'](_0x376ed6['query']['sort']);_0x3733c5[_0xfbbe('0x36')]=qs[_0xfbbe('0x31')](_['pick'](_0x376ed6[_0xfbbe('0x30')],_0x3b10ac[_0xfbbe('0x31')]),_0x17ea90);if(_0x376ed6['query']['filter']){_0x3733c5[_0xfbbe('0x36')]=_[_0xfbbe('0x37')](_0x3733c5[_0xfbbe('0x36')],{'$or':_[_0xfbbe('0x38')](_0x3733c5[_0xfbbe('0x33')],function(_0x5b71fd){var _0x2cf1ff={};_0x2cf1ff[_0x5b71fd]={'$like':'%'+_0x376ed6['query'][_0xfbbe('0x39')]+'%'};return _0x2cf1ff;})});}_0x3733c5=_[_0xfbbe('0x37')]({},_0x3733c5,_0x376ed6[_0xfbbe('0x3a')]);var _0x282054={'where':_0x3733c5[_0xfbbe('0x36')]};return db['CmCompany']['count'](_0x282054)[_0xfbbe('0x24')](function(_0x1542ee){_0xdd1131[_0xfbbe('0x1b')]=_0x1542ee;if(_0x376ed6[_0xfbbe('0x30')][_0xfbbe('0x3b')]){_0x3733c5[_0xfbbe('0x3c')]=[{'all':!![]}];}return db[_0xfbbe('0x3d')]['findAll'](_0x3733c5);})[_0xfbbe('0x24')](function(_0x11edd9){_0xdd1131[_0xfbbe('0x3e')]=_0x11edd9;return _0xdd1131;})[_0xfbbe('0x24')](respondWithFilteredResult(_0x2dfeb8,_0x3733c5))['catch'](handleError(_0x2dfeb8,null));})[_0xfbbe('0x3f')](handleError(_0x2dfeb8,null));};exports['show']=function(_0x582ae5,_0x51c0eb){var _0x2425d0={'raw':![],'where':{'id':_0x582ae5[_0xfbbe('0x40')]['id']}},_0x26a9d0={};_0x26a9d0[_0xfbbe('0x2e')]=_[_0xfbbe('0x2f')](db['CmCompany'][_0xfbbe('0x41')]);_0x26a9d0['query']=_[_0xfbbe('0x2f')](_0x582ae5[_0xfbbe('0x30')]);_0x26a9d0[_0xfbbe('0x31')]=_[_0xfbbe('0x32')](_0x26a9d0[_0xfbbe('0x2e')],_0x26a9d0['query']);_0x2425d0[_0xfbbe('0x33')]=_[_0xfbbe('0x32')](_0x26a9d0['model'],qs['fields'](_0x582ae5[_0xfbbe('0x30')][_0xfbbe('0x42')]));_0x2425d0[_0xfbbe('0x33')]=_0x2425d0[_0xfbbe('0x33')][_0xfbbe('0x34')]?_0x2425d0['attributes']:_0x26a9d0[_0xfbbe('0x2e')];if(_0x582ae5['query'][_0xfbbe('0x3b')]){_0x2425d0[_0xfbbe('0x3c')]=[{'all':!![]}];}_0x2425d0=_['merge']({},_0x2425d0,_0x582ae5[_0xfbbe('0x3a')]);return db['CmCompany'][_0xfbbe('0x43')](_0x2425d0)[_0xfbbe('0x24')](handleEntityNotFound(_0x51c0eb,null))['then'](respondWithResult(_0x51c0eb,null))[_0xfbbe('0x3f')](handleError(_0x51c0eb,null));};exports[_0xfbbe('0x44')]=function(_0x46ac9a,_0x3517d8){return db[_0xfbbe('0x3d')]['create'](_0x46ac9a['body'],{})['then'](function(_0x1a97d4){var _0x333979=_0x46ac9a[_0xfbbe('0x45')]['get']({'plain':!![]});if(!_0x333979)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x333979[_0xfbbe('0x46')]===_0xfbbe('0x45')){var _0x31a74a=_0x1a97d4[_0xfbbe('0x26')]({'plain':!![]});var _0x2b24c7='Companies';return db[_0xfbbe('0x47')][_0xfbbe('0x43')]({'where':{'name':_0x2b24c7,'userProfileId':_0x333979[_0xfbbe('0x48')]},'raw':!![]})['then'](function(_0xd66fad){if(_0xd66fad&&_0xd66fad[_0xfbbe('0x49')]===0x0){return db[_0xfbbe('0x27')][_0xfbbe('0x44')]({'name':_0x31a74a[_0xfbbe('0x2a')],'resourceId':_0x31a74a['id'],'type':_0xd66fad[_0xfbbe('0x2a')],'sectionId':_0xd66fad['id']},{})[_0xfbbe('0x24')](function(){return _0x1a97d4;});}else{return _0x1a97d4;}})['catch'](function(_0x5d47f8){logger[_0xfbbe('0x4a')](_0xfbbe('0x4b'),_0x5d47f8);throw _0x5d47f8;});}return _0x1a97d4;})[_0xfbbe('0x24')](respondWithResult(_0x3517d8,0xc9))['catch'](handleError(_0x3517d8,null));};exports[_0xfbbe('0x23')]=function(_0x26599d,_0x36482d){if(_0x26599d[_0xfbbe('0x4c')]['id']){delete _0x26599d['body']['id'];}return db[_0xfbbe('0x3d')][_0xfbbe('0x43')]({'where':{'id':_0x26599d[_0xfbbe('0x40')]['id']}})[_0xfbbe('0x24')](handleEntityNotFound(_0x36482d,null))[_0xfbbe('0x24')](saveUpdates(_0x26599d[_0xfbbe('0x4c')],null))['then'](respondWithResult(_0x36482d,null))[_0xfbbe('0x3f')](handleError(_0x36482d,null));};exports['destroy']=function(_0x463a32,_0x3ebef8){return db['CmCompany'][_0xfbbe('0x43')]({'where':{'id':_0x463a32[_0xfbbe('0x40')]['id']}})[_0xfbbe('0x24')](handleEntityNotFound(_0x3ebef8,null))[_0xfbbe('0x24')](removeEntity(_0x3ebef8,null))[_0xfbbe('0x3f')](handleError(_0x3ebef8,null));};exports[_0xfbbe('0x2d')]=function(_0xd6dcc0,_0x19de48){return db[_0xfbbe('0x3d')][_0xfbbe('0x2d')]()[_0xfbbe('0x24')](respondWithResult(_0x19de48,null))[_0xfbbe('0x3f')](handleError(_0x19de48,null));};exports[_0xfbbe('0x4d')]=function(_0x1d5e97,_0x49dc84,_0x12ca1e){return db[_0xfbbe('0x4e')][_0xfbbe('0x43')]({'where':{'id':_0x1d5e97[_0xfbbe('0x40')]['id']}})[_0xfbbe('0x24')](handleEntityNotFound(_0x49dc84,null))['then'](function(_0x2ddbfa){if(_0x2ddbfa){return _0x2ddbfa[_0xfbbe('0x4d')](_0x1d5e97[_0xfbbe('0x4c')][_0xfbbe('0x4f')],_[_0xfbbe('0x50')](_0x1d5e97[_0xfbbe('0x4c')],[_0xfbbe('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x49dc84,null))[_0xfbbe('0x3f')](handleError(_0x49dc84,null));};exports[_0xfbbe('0x51')]=function(_0x407e0b,_0x416b92,_0x1be856){var _0x4f0f76={};var _0x3dd67e={};var _0x38acfe;var _0x1ec3bd;return db[_0xfbbe('0x3d')][_0xfbbe('0x52')]({'where':{'id':_0x407e0b[_0xfbbe('0x40')]['id']}})[_0xfbbe('0x24')](handleEntityNotFound(_0x416b92,null))[_0xfbbe('0x24')](function(_0x5e9ec3){if(_0x5e9ec3){_0x38acfe=_0x5e9ec3;_0x3dd67e[_0xfbbe('0x2e')]=_[_0xfbbe('0x2f')](db[_0xfbbe('0x4e')][_0xfbbe('0x41')]);_0x3dd67e[_0xfbbe('0x30')]=_['keys'](_0x407e0b[_0xfbbe('0x30')]);_0x3dd67e[_0xfbbe('0x31')]=_[_0xfbbe('0x32')](_0x3dd67e[_0xfbbe('0x2e')],_0x3dd67e[_0xfbbe('0x30')]);_0x4f0f76['attributes']=_[_0xfbbe('0x32')](_0x3dd67e[_0xfbbe('0x2e')],qs['fields'](_0x407e0b['query'][_0xfbbe('0x42')]));_0x4f0f76[_0xfbbe('0x33')]=_0x4f0f76['attributes'][_0xfbbe('0x34')]?_0x4f0f76[_0xfbbe('0x33')]:_0x3dd67e[_0xfbbe('0x2e')];_0x4f0f76[_0xfbbe('0x53')]=qs['sort'](_0x407e0b[_0xfbbe('0x30')][_0xfbbe('0x54')]);_0x4f0f76['where']=qs[_0xfbbe('0x31')](_[_0xfbbe('0x55')](_0x407e0b[_0xfbbe('0x30')],_0x3dd67e[_0xfbbe('0x31')]));if(_0x407e0b[_0xfbbe('0x30')][_0xfbbe('0x39')]){_0x4f0f76[_0xfbbe('0x36')]=_['merge'](_0x4f0f76[_0xfbbe('0x36')],{'$or':_['map'](_0x4f0f76[_0xfbbe('0x33')],function(_0x5f241e){var _0x10e7fc={};_0x10e7fc[_0x5f241e]={'$like':'%'+_0x407e0b[_0xfbbe('0x30')][_0xfbbe('0x39')]+'%'};return _0x10e7fc;})});}_0x4f0f76=_['merge']({},_0x4f0f76,_0x407e0b[_0xfbbe('0x3a')]);return _0x38acfe['getContacts'](_0x4f0f76);}})[_0xfbbe('0x24')](function(_0x459c1e){if(_0x459c1e){_0x1ec3bd=_0x459c1e['length'];if(!_0x407e0b['query'][_0xfbbe('0x56')](_0xfbbe('0x35'))){_0x4f0f76[_0xfbbe('0x1a')]=qs['limit'](_0x407e0b[_0xfbbe('0x30')][_0xfbbe('0x1a')]);_0x4f0f76[_0xfbbe('0x1c')]=qs[_0xfbbe('0x1c')](_0x407e0b['query']['offset']);}return _0x38acfe[_0xfbbe('0x51')](_0x4f0f76);}})['then'](function(_0x55d93d){if(_0x55d93d){return _0x55d93d?{'count':_0x1ec3bd,'rows':_0x55d93d}:null;}})[_0xfbbe('0x24')](respondWithResult(_0x416b92,null))[_0xfbbe('0x3f')](handleError(_0x416b92,null));}; \ No newline at end of file +var _0x0e64=['index','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','CmCompany','includeAll','include','rows','show','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','addContacts','CmContact','ids','getContacts','findOne','map','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x0e64,0x17e));var _0x40e6=function(_0x5c2bee,_0x458b7e){_0x5c2bee=_0x5c2bee-0x0;var _0x440173=_0x0e64[_0x5c2bee];return _0x440173;};'use strict';var emlformat=require(_0x40e6('0x0'));var rimraf=require(_0x40e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40e6('0x2'));var moment=require(_0x40e6('0x3'));var BPromise=require(_0x40e6('0x4'));var Mustache=require(_0x40e6('0x5'));var util=require('util');var path=require(_0x40e6('0x6'));var sox=require(_0x40e6('0x7'));var csv=require(_0x40e6('0x8'));var ejs=require(_0x40e6('0x9'));var fs=require('fs');var fs_extra=require(_0x40e6('0xa'));var _=require(_0x40e6('0xb'));var squel=require(_0x40e6('0xc'));var crypto=require(_0x40e6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40e6('0xe'));var toCsv=require(_0x40e6('0x8'));var querystring=require(_0x40e6('0xf'));var Papa=require(_0x40e6('0x10'));var Redis=require(_0x40e6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40e6('0x12'));var logger=require(_0x40e6('0x13'))(_0x40e6('0x14'));var utils=require(_0x40e6('0x15'));var config=require(_0x40e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x40e6('0x17'))['db'];function respondWithStatusCode(_0x4b75da,_0x342a4e){_0x342a4e=_0x342a4e||0xcc;return function(_0x1344e8){if(_0x1344e8){return _0x4b75da['sendStatus'](_0x342a4e);}return _0x4b75da['status'](_0x342a4e)[_0x40e6('0x18')]();};}function respondWithResult(_0x491dff,_0x557790){_0x557790=_0x557790||0xc8;return function(_0x306387){if(_0x306387){return _0x491dff['status'](_0x557790)[_0x40e6('0x19')](_0x306387);}};}function respondWithFilteredResult(_0x25eef9,_0x154d65){return function(_0x378745){if(_0x378745){var _0x5f43aa=typeof _0x154d65['offset']===_0x40e6('0x1a')&&typeof _0x154d65[_0x40e6('0x1b')]===_0x40e6('0x1a');var _0x575915=_0x378745[_0x40e6('0x1c')];var _0x3592df=_0x5f43aa?0x0:_0x154d65['offset'];var _0x2703d9=_0x5f43aa?_0x378745[_0x40e6('0x1c')]:_0x154d65[_0x40e6('0x1d')]+_0x154d65[_0x40e6('0x1b')];var _0x31b4ec;if(_0x2703d9>=_0x575915){_0x2703d9=_0x575915;_0x31b4ec=0xc8;}else{_0x31b4ec=0xce;}_0x25eef9[_0x40e6('0x1e')](_0x31b4ec);return _0x25eef9['set'](_0x40e6('0x1f'),_0x3592df+'-'+_0x2703d9+'/'+_0x575915)[_0x40e6('0x19')](_0x378745);}return null;};}function patchUpdates(_0x58a670){return function(_0x36c62a){try{jsonpatch[_0x40e6('0x20')](_0x36c62a,_0x58a670,!![]);}catch(_0x2060e5){return BPromise[_0x40e6('0x21')](_0x2060e5);}return _0x36c62a[_0x40e6('0x22')]();};}function saveUpdates(_0x840648,_0x13e33b){return function(_0x9bfa69){if(_0x9bfa69){return _0x9bfa69[_0x40e6('0x23')](_0x840648)[_0x40e6('0x24')](function(_0x1fe7e0){return _0x1fe7e0;});}return null;};}function removeEntity(_0x42ebd5,_0x3ca036){return function(_0x67cfa5){if(_0x67cfa5){return _0x67cfa5[_0x40e6('0x25')]()[_0x40e6('0x24')](function(){var _0x446567=_0x67cfa5[_0x40e6('0x26')]({'plain':!![]});var _0x1e077d='Companies';return db[_0x40e6('0x27')]['destroy']({'where':{'type':_0x1e077d,'resourceId':_0x446567['id']}})['then'](function(){return _0x67cfa5;});})['then'](function(){_0x42ebd5[_0x40e6('0x1e')](0xcc)[_0x40e6('0x18')]();});}};}function handleEntityNotFound(_0x5f4546,_0x1a1b21){return function(_0x3a6fde){if(!_0x3a6fde){_0x5f4546['sendStatus'](0x194);}return _0x3a6fde;};}function handleError(_0x4ad067,_0x10d41a){_0x10d41a=_0x10d41a||0x1f4;return function(_0x4714b9){logger[_0x40e6('0x28')](_0x4714b9[_0x40e6('0x29')]);if(_0x4714b9[_0x40e6('0x2a')]){delete _0x4714b9[_0x40e6('0x2a')];}_0x4ad067[_0x40e6('0x1e')](_0x10d41a)['send'](_0x4714b9);};}exports[_0x40e6('0x2b')]=function(_0x333691,_0x93d1c0){var _0x19f706={},_0x288688={},_0xf1903d={'count':0x0,'rows':[]};return db['CmCompany'][_0x40e6('0x2c')]()[_0x40e6('0x24')](function(_0x4dfd84){_0x288688[_0x40e6('0x2d')]=_[_0x40e6('0x2e')](_0x4dfd84);_0x288688[_0x40e6('0x2f')]=_[_0x40e6('0x2e')](_0x333691[_0x40e6('0x2f')]);_0x288688[_0x40e6('0x30')]=_[_0x40e6('0x31')](_0x288688['model'],_0x288688['query']);_0x19f706[_0x40e6('0x32')]=_[_0x40e6('0x31')](_0x288688[_0x40e6('0x2d')],qs[_0x40e6('0x33')](_0x333691[_0x40e6('0x2f')]['fields']));_0x19f706[_0x40e6('0x32')]=_0x19f706[_0x40e6('0x32')]['length']?_0x19f706[_0x40e6('0x32')]:_0x288688[_0x40e6('0x2d')];if(!_0x333691[_0x40e6('0x2f')][_0x40e6('0x34')]('nolimit')){_0x19f706[_0x40e6('0x1b')]=qs[_0x40e6('0x1b')](_0x333691['query'][_0x40e6('0x1b')]);_0x19f706[_0x40e6('0x1d')]=qs[_0x40e6('0x1d')](_0x333691[_0x40e6('0x2f')]['offset']);}_0x19f706['order']=qs[_0x40e6('0x35')](_0x333691[_0x40e6('0x2f')][_0x40e6('0x35')]);_0x19f706['where']=qs[_0x40e6('0x30')](_[_0x40e6('0x36')](_0x333691[_0x40e6('0x2f')],_0x288688[_0x40e6('0x30')]),_0x4dfd84);if(_0x333691['query'][_0x40e6('0x37')]){_0x19f706[_0x40e6('0x38')]=_['merge'](_0x19f706[_0x40e6('0x38')],{'$or':_['map'](_0x19f706[_0x40e6('0x32')],function(_0x42fac2){var _0x8a5bb7={};_0x8a5bb7[_0x42fac2]={'$like':'%'+_0x333691[_0x40e6('0x2f')][_0x40e6('0x37')]+'%'};return _0x8a5bb7;})});}_0x19f706=_[_0x40e6('0x39')]({},_0x19f706,_0x333691[_0x40e6('0x3a')]);var _0x5419b1={'where':_0x19f706['where']};return db[_0x40e6('0x3b')][_0x40e6('0x1c')](_0x5419b1)['then'](function(_0x408d4a){_0xf1903d[_0x40e6('0x1c')]=_0x408d4a;if(_0x333691['query'][_0x40e6('0x3c')]){_0x19f706[_0x40e6('0x3d')]=[{'all':!![]}];}return db[_0x40e6('0x3b')]['findAll'](_0x19f706);})[_0x40e6('0x24')](function(_0x3892cd){_0xf1903d[_0x40e6('0x3e')]=_0x3892cd;return _0xf1903d;})[_0x40e6('0x24')](respondWithFilteredResult(_0x93d1c0,_0x19f706))['catch'](handleError(_0x93d1c0,null));})['catch'](handleError(_0x93d1c0,null));};exports[_0x40e6('0x3f')]=function(_0x5c79ae,_0x3bbb42){var _0x57868f={'raw':![],'where':{'id':_0x5c79ae['params']['id']}},_0x37eeef={};_0x37eeef['model']=_['keys'](db[_0x40e6('0x3b')][_0x40e6('0x40')]);_0x37eeef[_0x40e6('0x2f')]=_[_0x40e6('0x2e')](_0x5c79ae[_0x40e6('0x2f')]);_0x37eeef[_0x40e6('0x30')]=_[_0x40e6('0x31')](_0x37eeef[_0x40e6('0x2d')],_0x37eeef[_0x40e6('0x2f')]);_0x57868f[_0x40e6('0x32')]=_[_0x40e6('0x31')](_0x37eeef[_0x40e6('0x2d')],qs[_0x40e6('0x33')](_0x5c79ae[_0x40e6('0x2f')][_0x40e6('0x33')]));_0x57868f[_0x40e6('0x32')]=_0x57868f['attributes'][_0x40e6('0x41')]?_0x57868f['attributes']:_0x37eeef[_0x40e6('0x2d')];if(_0x5c79ae['query'][_0x40e6('0x3c')]){_0x57868f['include']=[{'all':!![]}];}_0x57868f=_[_0x40e6('0x39')]({},_0x57868f,_0x5c79ae[_0x40e6('0x3a')]);return db[_0x40e6('0x3b')][_0x40e6('0x42')](_0x57868f)[_0x40e6('0x24')](handleEntityNotFound(_0x3bbb42,null))[_0x40e6('0x24')](respondWithResult(_0x3bbb42,null))['catch'](handleError(_0x3bbb42,null));};exports[_0x40e6('0x43')]=function(_0x30c159,_0x5df94c){return db['CmCompany']['create'](_0x30c159[_0x40e6('0x44')],{})[_0x40e6('0x24')](function(_0x4a33b3){var _0x300ff9=_0x30c159['user'][_0x40e6('0x26')]({'plain':!![]});if(!_0x300ff9)throw new Error(_0x40e6('0x45'));if(_0x300ff9[_0x40e6('0x46')]===_0x40e6('0x47')){var _0xe52b3f=_0x4a33b3[_0x40e6('0x26')]({'plain':!![]});var _0x150f0f=_0x40e6('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x150f0f,'userProfileId':_0x300ff9[_0x40e6('0x49')]},'raw':!![]})[_0x40e6('0x24')](function(_0x511b40){if(_0x511b40&&_0x511b40[_0x40e6('0x4a')]===0x0){return db[_0x40e6('0x27')]['create']({'name':_0xe52b3f[_0x40e6('0x2a')],'resourceId':_0xe52b3f['id'],'type':_0x511b40[_0x40e6('0x2a')],'sectionId':_0x511b40['id']},{})[_0x40e6('0x24')](function(){return _0x4a33b3;});}else{return _0x4a33b3;}})['catch'](function(_0x17e115){logger['error'](_0x40e6('0x4b'),_0x17e115);throw _0x17e115;});}return _0x4a33b3;})['then'](respondWithResult(_0x5df94c,0xc9))[_0x40e6('0x4c')](handleError(_0x5df94c,null));};exports['update']=function(_0x513009,_0x3511c8){if(_0x513009[_0x40e6('0x44')]['id']){delete _0x513009[_0x40e6('0x44')]['id'];}return db[_0x40e6('0x3b')]['find']({'where':{'id':_0x513009['params']['id']}})['then'](handleEntityNotFound(_0x3511c8,null))[_0x40e6('0x24')](saveUpdates(_0x513009['body'],null))[_0x40e6('0x24')](respondWithResult(_0x3511c8,null))[_0x40e6('0x4c')](handleError(_0x3511c8,null));};exports['destroy']=function(_0xa711d7,_0x3ef1d7){return db[_0x40e6('0x3b')][_0x40e6('0x42')]({'where':{'id':_0xa711d7[_0x40e6('0x4d')]['id']}})[_0x40e6('0x24')](handleEntityNotFound(_0x3ef1d7,null))[_0x40e6('0x24')](removeEntity(_0x3ef1d7,null))['catch'](handleError(_0x3ef1d7,null));};exports[_0x40e6('0x2c')]=function(_0x2e784f,_0x8c5d4){return db[_0x40e6('0x3b')][_0x40e6('0x2c')]()[_0x40e6('0x24')](respondWithResult(_0x8c5d4,null))[_0x40e6('0x4c')](handleError(_0x8c5d4,null));};exports[_0x40e6('0x4e')]=function(_0x441362,_0x4a9026,_0x3b5c5e){return db[_0x40e6('0x4f')][_0x40e6('0x42')]({'where':{'id':_0x441362[_0x40e6('0x4d')]['id']}})[_0x40e6('0x24')](handleEntityNotFound(_0x4a9026,null))[_0x40e6('0x24')](function(_0x45bcae){if(_0x45bcae){return _0x45bcae[_0x40e6('0x4e')](_0x441362[_0x40e6('0x44')][_0x40e6('0x50')],_['omit'](_0x441362['body'],[_0x40e6('0x50'),'id'])||{});}})[_0x40e6('0x24')](respondWithResult(_0x4a9026,null))['catch'](handleError(_0x4a9026,null));};exports[_0x40e6('0x51')]=function(_0x34ca36,_0xf47211,_0x5505fa){var _0x31fedb={};var _0x164a73={};var _0x18364c;var _0x3c2f97;return db['CmCompany'][_0x40e6('0x52')]({'where':{'id':_0x34ca36[_0x40e6('0x4d')]['id']}})[_0x40e6('0x24')](handleEntityNotFound(_0xf47211,null))['then'](function(_0xd0b6a5){if(_0xd0b6a5){_0x18364c=_0xd0b6a5;_0x164a73[_0x40e6('0x2d')]=_[_0x40e6('0x2e')](db[_0x40e6('0x4f')]['rawAttributes']);_0x164a73[_0x40e6('0x2f')]=_[_0x40e6('0x2e')](_0x34ca36[_0x40e6('0x2f')]);_0x164a73[_0x40e6('0x30')]=_[_0x40e6('0x31')](_0x164a73['model'],_0x164a73['query']);_0x31fedb[_0x40e6('0x32')]=_['intersection'](_0x164a73[_0x40e6('0x2d')],qs[_0x40e6('0x33')](_0x34ca36[_0x40e6('0x2f')][_0x40e6('0x33')]));_0x31fedb[_0x40e6('0x32')]=_0x31fedb['attributes'][_0x40e6('0x41')]?_0x31fedb[_0x40e6('0x32')]:_0x164a73[_0x40e6('0x2d')];_0x31fedb['order']=qs['sort'](_0x34ca36[_0x40e6('0x2f')][_0x40e6('0x35')]);_0x31fedb['where']=qs[_0x40e6('0x30')](_[_0x40e6('0x36')](_0x34ca36[_0x40e6('0x2f')],_0x164a73[_0x40e6('0x30')]));if(_0x34ca36['query'][_0x40e6('0x37')]){_0x31fedb[_0x40e6('0x38')]=_[_0x40e6('0x39')](_0x31fedb[_0x40e6('0x38')],{'$or':_[_0x40e6('0x53')](_0x31fedb[_0x40e6('0x32')],function(_0xfaa9ac){var _0x4f63e5={};_0x4f63e5[_0xfaa9ac]={'$like':'%'+_0x34ca36['query'][_0x40e6('0x37')]+'%'};return _0x4f63e5;})});}_0x31fedb=_[_0x40e6('0x39')]({},_0x31fedb,_0x34ca36['options']);return _0x18364c[_0x40e6('0x51')](_0x31fedb);}})[_0x40e6('0x24')](function(_0x3c4bc9){if(_0x3c4bc9){_0x3c2f97=_0x3c4bc9[_0x40e6('0x41')];if(!_0x34ca36[_0x40e6('0x2f')]['hasOwnProperty'](_0x40e6('0x54'))){_0x31fedb['limit']=qs[_0x40e6('0x1b')](_0x34ca36['query'][_0x40e6('0x1b')]);_0x31fedb['offset']=qs[_0x40e6('0x1d')](_0x34ca36['query'][_0x40e6('0x1d')]);}return _0x18364c['getContacts'](_0x31fedb);}})[_0x40e6('0x24')](function(_0x510126){if(_0x510126){return _0x510126?{'count':_0x3c2f97,'rows':_0x510126}:null;}})['then'](respondWithResult(_0xf47211,null))[_0x40e6('0x4c')](handleError(_0xf47211,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 10fffce..f482d23 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 _0x2baf=['util','api','moment','bluebird','./cmCompany.attributes','define','CmCompany','cm_companies','lodash'];(function(_0x422e79,_0x4e7a2f){var _0x4560ad=function(_0xeaa377){while(--_0xeaa377){_0x422e79['push'](_0x422e79['shift']());}};_0x4560ad(++_0x4e7a2f);}(_0x2baf,0xbc));var _0xf2ba=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x2baf[_0x21205e];return _0x136ebb;};'use strict';var _=require(_0xf2ba('0x0'));var util=require(_0xf2ba('0x1'));var logger=require('../../config/logger')(_0xf2ba('0x2'));var moment=require(_0xf2ba('0x3'));var BPromise=require(_0xf2ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf2ba('0x5'));module['exports']=function(_0x3785f3,_0x3ea093){return _0x3785f3[_0xf2ba('0x6')](_0xf2ba('0x7'),attributes,{'tableName':_0xf2ba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2644=['define','cm_companies','lodash','util','api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x196370,_0x48d501){var _0x1f93b2=function(_0x397615){while(--_0x397615){_0x196370['push'](_0x196370['shift']());}};_0x1f93b2(++_0x48d501);}(_0x2644,0x188));var _0x4264=function(_0x5ea7a8,_0x257068){_0x5ea7a8=_0x5ea7a8-0x0;var _0x1b2e3a=_0x2644[_0x5ea7a8];return _0x1b2e3a;};'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(_0x4264('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4264('0x4'));var rimraf=require(_0x4264('0x5'));var config=require(_0x4264('0x6'));var attributes=require(_0x4264('0x7'));module['exports']=function(_0x4fb345,_0x1a9768){return _0x4fb345[_0x4264('0x8')]('CmCompany',attributes,{'tableName':_0x4264('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 15027ff..3d77f87 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 _0x493c=['../../config/utils','../../config/environment','client','http','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x42decb,_0x576852){var _0x14e3f2=function(_0x1ab70b){while(--_0x1ab70b){_0x42decb['push'](_0x42decb['shift']());}};_0x14e3f2(++_0x576852);}(_0x493c,0x13f));var _0xc493=function(_0x4c0ba0,_0x1f9a1b){_0x4c0ba0=_0x4c0ba0-0x0;var _0x10be64=_0x493c[_0x4c0ba0];return _0x10be64;};'use strict';var _=require(_0xc493('0x0'));var util=require(_0xc493('0x1'));var moment=require('moment');var BPromise=require(_0xc493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc493('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc493('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc493('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc493('0x6')][_0xc493('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9050f,_0x3b38a8,_0x311711){return new BPromise(function(_0x16d901,_0x49c485){return client[_0xc493('0x8')](_0x9050f,_0x311711)['then'](function(_0x12f1ff){logger[_0xc493('0x9')]('CmCompany,\x20%s,\x20%s',_0x3b38a8,_0xc493('0xa'));logger[_0xc493('0xb')](_0xc493('0xc'),_0x3b38a8,'request\x20sent',JSON[_0xc493('0xd')](_0x12f1ff));if(_0x12f1ff[_0xc493('0xe')]){if(_0x12f1ff[_0xc493('0xe')]['code']===0x1f4){logger[_0xc493('0xe')](_0xc493('0xf'),_0x3b38a8,_0x12f1ff[_0xc493('0xe')][_0xc493('0x10')]);return _0x49c485(_0x12f1ff[_0xc493('0xe')][_0xc493('0x10')]);}logger[_0xc493('0xe')](_0xc493('0xf'),_0x3b38a8,_0x12f1ff[_0xc493('0xe')][_0xc493('0x10')]);return _0x16d901(_0x12f1ff[_0xc493('0xe')][_0xc493('0x10')]);}else{logger[_0xc493('0x9')]('CmCompany,\x20%s,\x20%s',_0x3b38a8,_0xc493('0xa'));_0x16d901(_0x12f1ff[_0xc493('0x11')]['message']);}})[_0xc493('0x12')](function(_0x205fa3){logger[_0xc493('0xe')](_0xc493('0xf'),_0x3b38a8,_0x205fa3);_0x49c485(_0x205fa3);});});} \ No newline at end of file +var _0x7b35=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x1f736e,_0x23a84d){var _0x5760f1=function(_0xe2d2d1){while(--_0xe2d2d1){_0x1f736e['push'](_0x1f736e['shift']());}};_0x5760f1(++_0x23a84d);}(_0x7b35,0x81));var _0x57b3=function(_0x5d2bbd,_0x43d5d9){_0x5d2bbd=_0x5d2bbd-0x0;var _0x18c180=_0x7b35[_0x5d2bbd];return _0x18c180;};'use strict';var _=require(_0x57b3('0x0'));var util=require(_0x57b3('0x1'));var moment=require(_0x57b3('0x2'));var BPromise=require(_0x57b3('0x3'));var rs=require(_0x57b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57b3('0x5'))['db'];var utils=require(_0x57b3('0x6'));var logger=require('../../config/logger')(_0x57b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x57b3('0x8'));var client=jayson[_0x57b3('0x9')][_0x57b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49ce43,_0x1ac505,_0x2b686b){return new BPromise(function(_0x918fcf,_0x5bbc27){return client[_0x57b3('0xb')](_0x49ce43,_0x2b686b)['then'](function(_0x527967){logger[_0x57b3('0xc')](_0x57b3('0xd'),_0x1ac505,'request\x20sent');logger[_0x57b3('0xe')](_0x57b3('0xf'),_0x1ac505,'request\x20sent',JSON['stringify'](_0x527967));if(_0x527967['error']){if(_0x527967[_0x57b3('0x10')][_0x57b3('0x11')]===0x1f4){logger[_0x57b3('0x10')](_0x57b3('0xd'),_0x1ac505,_0x527967[_0x57b3('0x10')][_0x57b3('0x12')]);return _0x5bbc27(_0x527967[_0x57b3('0x10')][_0x57b3('0x12')]);}logger[_0x57b3('0x10')](_0x57b3('0xd'),_0x1ac505,_0x527967[_0x57b3('0x10')][_0x57b3('0x12')]);return _0x918fcf(_0x527967[_0x57b3('0x10')]['message']);}else{logger[_0x57b3('0xc')](_0x57b3('0xd'),_0x1ac505,_0x57b3('0x13'));_0x918fcf(_0x527967[_0x57b3('0x14')][_0x57b3('0x12')]);}})[_0x57b3('0x15')](function(_0x2f76e1){logger[_0x57b3('0x10')](_0x57b3('0xd'),_0x1ac505,_0x2f76e1);_0x5bbc27(_0x2f76e1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f5ca38a..ff58e84 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 _0x1094=['getContacts','create','post','update','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts'];(function(_0x4a8d77,_0x376df2){var _0xac3836=function(_0xadaa7e){while(--_0xadaa7e){_0x4a8d77['push'](_0x4a8d77['shift']());}};_0xac3836(++_0x376df2);}(_0x1094,0x101));var _0x4109=function(_0x3b4d1b,_0x12517b){_0x3b4d1b=_0x3b4d1b-0x0;var _0x5a2ffd=_0x1094[_0x3b4d1b];return _0x5a2ffd;};'use strict';var multer=require(_0x4109('0x0'));var util=require('util');var path=require(_0x4109('0x1'));var timeout=require('connect-timeout');var express=require(_0x4109('0x2'));var router=express['Router']();var fs_extra=require(_0x4109('0x3'));var auth=require(_0x4109('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4109('0x5'));var controller=require('./cmCompany.controller');router[_0x4109('0x6')]('/',auth[_0x4109('0x7')](),controller[_0x4109('0x8')]);router[_0x4109('0x6')](_0x4109('0x9'),auth['isAuthenticated'](),controller[_0x4109('0xa')]);router[_0x4109('0x6')](_0x4109('0xb'),auth[_0x4109('0x7')](),controller['show']);router['get'](_0x4109('0xc'),auth[_0x4109('0x7')](),controller[_0x4109('0xd')]);router['post']('/',auth[_0x4109('0x7')](),controller[_0x4109('0xe')]);router[_0x4109('0xf')](_0x4109('0xc'),auth[_0x4109('0x7')](),controller['addContacts']);router['put'](_0x4109('0xb'),auth[_0x4109('0x7')](),controller[_0x4109('0x10')]);router['delete'](_0x4109('0xb'),auth[_0x4109('0x7')](),controller[_0x4109('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9a2e=['delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put'];(function(_0x5b0890,_0x14f8cf){var _0xabfe11=function(_0x193a61){while(--_0x193a61){_0x5b0890['push'](_0x5b0890['shift']());}};_0xabfe11(++_0x14f8cf);}(_0x9a2e,0xc0));var _0xe9a2=function(_0x5d099f,_0x50d9f5){_0x5d099f=_0x5d099f-0x0;var _0x15ba45=_0x9a2e[_0x5d099f];return _0x15ba45;};'use strict';var multer=require(_0xe9a2('0x0'));var util=require(_0xe9a2('0x1'));var path=require(_0xe9a2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9a2('0x3'));var interaction=require(_0xe9a2('0x4'));var config=require(_0xe9a2('0x5'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0xe9a2('0x6')](),controller[_0xe9a2('0x7')]);router[_0xe9a2('0x8')](_0xe9a2('0x9'),auth[_0xe9a2('0x6')](),controller['describe']);router[_0xe9a2('0x8')](_0xe9a2('0xa'),auth[_0xe9a2('0x6')](),controller[_0xe9a2('0xb')]);router[_0xe9a2('0x8')](_0xe9a2('0xc'),auth[_0xe9a2('0x6')](),controller[_0xe9a2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe9a2('0xe')]);router[_0xe9a2('0xf')](_0xe9a2('0xc'),auth['isAuthenticated'](),controller[_0xe9a2('0x10')]);router[_0xe9a2('0x11')](_0xe9a2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe9a2('0x12')](_0xe9a2('0xa'),auth[_0xe9a2('0x6')](),controller[_0xe9a2('0x13')]);module[_0xe9a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 54698c4..6df16e7 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 _0xf168=['UNSIGNED','NOW','lodash','exports','STRING','TEXT','INTEGER'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xf168,0x11a));var _0x8f16=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xf168[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x8f16('0x0'));var Sequelize=require('sequelize');module[_0x8f16('0x1')]={'firstName':{'type':Sequelize[_0x8f16('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8f16('0x2')]},'postalCode':{'type':Sequelize[_0x8f16('0x2')]},'city':{'type':Sequelize[_0x8f16('0x2')]},'country':{'type':Sequelize[_0x8f16('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8f16('0x2')]},'description':{'type':Sequelize[_0x8f16('0x3')]},'phone':{'type':Sequelize[_0x8f16('0x2')]},'mobile':{'type':Sequelize[_0x8f16('0x2')]},'fax':{'type':Sequelize[_0x8f16('0x2')]},'email':{'type':Sequelize[_0x8f16('0x2')]},'url':{'type':Sequelize[_0x8f16('0x2')]},'facebook':{'type':Sequelize[_0x8f16('0x2')]},'fb_data':{'type':Sequelize[_0x8f16('0x2')]},'twitter':{'type':Sequelize[_0x8f16('0x2')]},'skype':{'type':Sequelize[_0x8f16('0x2')]},'teams':{'type':Sequelize[_0x8f16('0x2')]},'viber':{'type':Sequelize[_0x8f16('0x2')]},'line':{'type':Sequelize[_0x8f16('0x2')]},'wechat':{'type':Sequelize[_0x8f16('0x2')]},'telegram':{'type':Sequelize[_0x8f16('0x2')]},'UserId':{'type':Sequelize[_0x8f16('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8f16('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8f16('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x8f16('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x8f16('0x4')]}}; \ No newline at end of file +var _0xd83f=['UNSIGNED','DATE','lodash','exports','STRING','TEXT','INTEGER'];(function(_0xc1a7a4,_0x15029d){var _0x1a9782=function(_0x238784){while(--_0x238784){_0xc1a7a4['push'](_0xc1a7a4['shift']());}};_0x1a9782(++_0x15029d);}(_0xd83f,0xb8));var _0xfd83=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd83f[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xfd83('0x0'));var Sequelize=require('sequelize');module[_0xfd83('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xfd83('0x2')]},'street':{'type':Sequelize[_0xfd83('0x2')]},'postalCode':{'type':Sequelize[_0xfd83('0x2')]},'city':{'type':Sequelize[_0xfd83('0x2')]},'country':{'type':Sequelize[_0xfd83('0x2')]},'dateOfBirth':{'type':Sequelize[_0xfd83('0x2')]},'description':{'type':Sequelize[_0xfd83('0x3')]},'phone':{'type':Sequelize[_0xfd83('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfd83('0x2')]},'email':{'type':Sequelize[_0xfd83('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xfd83('0x2')]},'twitter':{'type':Sequelize[_0xfd83('0x2')]},'skype':{'type':Sequelize[_0xfd83('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xfd83('0x2')]},'line':{'type':Sequelize[_0xfd83('0x2')]},'wechat':{'type':Sequelize[_0xfd83('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfd83('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xfd83('0x2')]},'priority':{'type':Sequelize[_0xfd83('0x4')](0x2)[_0xfd83('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfd83('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xfd83('0x2')]},'utcOffset':{'type':Sequelize[_0xfd83('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0871e65..5e8ebfb 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 _0xe6e5=['then','destroy','end','sendStatus','stack','name','send','index','getOptions','findAll','query','catch','CmContact','find','params','describe','tags','keys','cf_','columnName','displayName','analytics','CmCustomField','length','custom','type','values','info','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','push','contact','all','tag','CmContactHasItem','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','format','pickBy','startsWith','map','cf_%d','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','sequelize','text','phone','getTags','model','rawAttributes','filters','attributes','intersection','fields','order','sort','pick','filter','options','nolimit','offset','setTags','findOne','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','getHoppers','ContactId','include','rows','getHopperHistories','includeAll','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','createdAt','findAndCountAll','fullname','startCase','chat','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','customerPort','deviceModel','referer','subject','substatus','externalUrl','threadId','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','limit','set','Content-Range','update'];(function(_0x59661a,_0x2d5ce8){var _0x4a216c=function(_0x4c2285){while(--_0x4c2285){_0x59661a['push'](_0x59661a['shift']());}};_0x4a216c(++_0x2d5ce8);}(_0xe6e5,0x1e7));var _0x5e6e=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xe6e5[_0x22b68a];return _0x1ac67a;};'use strict';var moment=require(_0x5e6e('0x0'));var BPromise=require(_0x5e6e('0x1'));var util=require(_0x5e6e('0x2'));var path=require(_0x5e6e('0x3'));var fs=require('fs');var _=require(_0x5e6e('0x4'));var squel=require(_0x5e6e('0x5'));var Papa=require('papaparse');var Redis=require(_0x5e6e('0x6'));var contacts=require(_0x5e6e('0x7'));var qs=require(_0x5e6e('0x8'));var logger=require(_0x5e6e('0x9'))(_0x5e6e('0xa'));var config=require('../../config/environment');var shared=require(_0x5e6e('0xb'));var db=require(_0x5e6e('0xc'))['db'];config[_0x5e6e('0xd')]=_[_0x5e6e('0xe')](config[_0x5e6e('0xd')],{'host':_0x5e6e('0xf'),'port':0x18eb});var socket=require(_0x5e6e('0x10'))(new Redis(config['redis']));require(_0x5e6e('0x11'))[_0x5e6e('0x12')](socket);function respondWithResult(_0x26ea1b,_0x29f03c){_0x29f03c=_0x29f03c||0xc8;return function(_0x5a843c){if(_0x5a843c){return _0x26ea1b[_0x5e6e('0x13')](_0x29f03c)[_0x5e6e('0x14')](_0x5a843c);}};}function respondWithFilteredResult(_0x56ae06,_0x4468f9){return function(_0x5d61bd){if(_0x5d61bd){var _0x31aa86=typeof _0x4468f9['offset']===_0x5e6e('0x15')&&typeof _0x4468f9['limit']==='undefined';var _0x2c2eb3=_0x5d61bd[_0x5e6e('0x16')];var _0x1bce14=_0x31aa86?0x0:_0x4468f9['offset'];var _0x5911b3=_0x31aa86?_0x5d61bd['count']:_0x4468f9['offset']+_0x4468f9[_0x5e6e('0x17')];var _0x221000;if(_0x5911b3>=_0x2c2eb3){_0x5911b3=_0x2c2eb3;_0x221000=0xc8;}else{_0x221000=0xce;}_0x56ae06[_0x5e6e('0x13')](_0x221000);return _0x56ae06[_0x5e6e('0x18')](_0x5e6e('0x19'),_0x1bce14+'-'+_0x5911b3+'/'+_0x2c2eb3)[_0x5e6e('0x14')](_0x5d61bd);}return null;};}function saveUpdates(_0x4ff27d){return function(_0xd07b99){if(_0xd07b99){return _0xd07b99[_0x5e6e('0x1a')](_0x4ff27d)[_0x5e6e('0x1b')](function(_0x2bcd00){return _0x2bcd00;});}return null;};}function removeEntity(_0x4de0b5){return function(_0x45f127){if(_0x45f127){return _0x45f127[_0x5e6e('0x1c')]()['then'](function(){_0x4de0b5[_0x5e6e('0x13')](0xcc)[_0x5e6e('0x1d')]();});}};}function handleEntityNotFound(_0xd7fd83){return function(_0x1e2e41){if(!_0x1e2e41){_0xd7fd83[_0x5e6e('0x1e')](0x194);}return _0x1e2e41;};}function handleError(_0x2ebda7,_0x42810c){_0x42810c=_0x42810c||0x1f4;return function(_0x284ca0){logger['error'](_0x284ca0[_0x5e6e('0x1f')]);if(_0x284ca0[_0x5e6e('0x20')]){delete _0x284ca0['name'];}_0x2ebda7[_0x5e6e('0x13')](_0x42810c)[_0x5e6e('0x21')](_0x284ca0);};}exports[_0x5e6e('0x22')]=function(_0x35bb90,_0x1095c9){var _0x9d79f7={};return contacts['describe']()[_0x5e6e('0x1b')](function(_0x261e8c){_0x9d79f7=qs[_0x5e6e('0x23')](_0x261e8c,_0x35bb90);return contacts[_0x5e6e('0x24')](_0x35bb90[_0x5e6e('0x25')],_0x35bb90['user'],_0x9d79f7,_0x261e8c);})[_0x5e6e('0x1b')](respondWithFilteredResult(_0x1095c9,_0x9d79f7))[_0x5e6e('0x26')](handleError(_0x1095c9,null));};exports[_0x5e6e('0x1c')]=function(_0x25ba8f,_0x532fe6){return db[_0x5e6e('0x27')][_0x5e6e('0x28')]({'where':{'id':_0x25ba8f[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0x532fe6,null))['then'](removeEntity(_0x532fe6,null))[_0x5e6e('0x26')](handleError(_0x532fe6,null));};exports['describe']=function(_0xf8f7bd,_0x3cc99f){return db[_0x5e6e('0x27')][_0x5e6e('0x2a')]()[_0x5e6e('0x1b')](function(_0x1c1aab){delete _0x1c1aab[_0x5e6e('0x2b')];for(var _0x54ed59=0x0;_0x54ed590x0){return new Promise(function(_0x11803c){var _0x59b145=[];for(var _0x3ac8a5=0x0;_0x3ac8a5<_0x4a7cb5['length'];_0x3ac8a5++){_0x59b145[_0x5e6e('0x62')](insertAdditionalPhones(_0x4a7cb5[_0x3ac8a5][_0x5e6e('0x63')],_0x4a7cb5[_0x3ac8a5][_0x5e6e('0x5b')]));}Promise[_0x5e6e('0x64')](_0x59b145)['then'](function(){_0x11803c(0x1);});})[_0x5e6e('0x1b')](function(){return{'success':_0x14d039,'failure':_0x1dd2b3,'duplicates':_0x10b5f9};});}else{return{'success':_0x14d039,'failure':_0x1dd2b3,'duplicates':_0x10b5f9};}}})[_0x5e6e('0x1b')](respondWithResult(_0x3ce110,0xc9))[_0x5e6e('0x26')](handleError(_0x3ce110,null));};exports['show']=function(_0x53feab,_0x3c702c){var _0x5ee5bf;return db[_0x5e6e('0x27')][_0x5e6e('0x2a')]()[_0x5e6e('0x1b')](function(_0x22f448){return db[_0x5e6e('0x27')][_0x5e6e('0x28')]({'where':{'id':_0x53feab[_0x5e6e('0x29')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5e6e('0x20'),'color'],'required':_0x53feab[_0x5e6e('0x25')][_0x5e6e('0x65')]?!![]:![]},{'model':db[_0x5e6e('0x66')],'as':_0x5e6e('0x67'),'where':{'CmContactId':_0x53feab[_0x5e6e('0x29')]['id']},'required':![],'include':[{'model':db[_0x5e6e('0x68')],'as':_0x5e6e('0x69')}]}],'order':[db['sequelize'][_0x5e6e('0x6a')](_0x5e6e('0x6b'))],'attributes':_[_0x5e6e('0x2c')](_0x22f448)});})[_0x5e6e('0x1b')](function(_0x542797){if(!_['isNil'](_0x542797)){_0x5ee5bf=_0x542797[_0x5e6e('0x3c')]({'plain':!![]});var _0x5cedba={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x542797&&_0x542797[_0x5e6e('0x61')]){if(_0x542797[_0x5e6e('0x61')]){_0x5cedba[_0x5e6e('0x5f')][_0x5e6e('0x6c')][_0x5e6e('0x62')]({'ListId':{'$ne':_0x542797['ListId']}});}}return db['CmCustomField'][_0x5e6e('0x24')](_0x5cedba);}})['then'](function(_0x387866){if(!_[_0x5e6e('0x57')](_0x387866)){return _[_0x5e6e('0x6d')](_0x5ee5bf,_['map'](_0x387866,function(_0x1d791f){return util[_0x5e6e('0x6e')]('cf_%d',_0x1d791f['id']);}));}})[_0x5e6e('0x1b')](handleEntityNotFound(_0x3c702c,null))[_0x5e6e('0x1b')](respondWithResult(_0x3c702c,null))['catch'](handleError(_0x3c702c,null));};exports['update']=function(_0x1ae1e9,_0x284dd3){var _0x1968f7;if(_0x1ae1e9['body']['id']){delete _0x1ae1e9['body']['id'];}if(!_[_0x5e6e('0x57')](_0x1ae1e9[_0x5e6e('0x3a')][_0x5e6e('0x58')])){var _0x4c35a1=_0x1ae1e9['body']['dialTimezone'];if(!_[_0x5e6e('0x57')](shared[_0x5e6e('0x59')][_0x4c35a1]))_0x1ae1e9['body'][_0x5e6e('0x5a')]=shared[_0x5e6e('0x59')][_0x4c35a1]['utcOffset'];}return db[_0x5e6e('0x27')][_0x5e6e('0x28')]({'where':{'id':_0x1ae1e9[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0x284dd3,null))[_0x5e6e('0x1b')](saveUpdates(_0x1ae1e9[_0x5e6e('0x3a')],null))['then'](function(_0x181e18){_0x1968f7=_0x181e18;var _0x52601e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x181e18&&_0x181e18['ListId']){if(_0x181e18['ListId']){_0x52601e[_0x5e6e('0x5f')][_0x5e6e('0x6c')][_0x5e6e('0x62')]({'ListId':{'$ne':_0x181e18['ListId']}});}}return db[_0x5e6e('0x31')]['findAll'](_0x52601e);})[_0x5e6e('0x1b')](function(_0x487ebe){if(_0x487ebe){return _['omit'](_[_0x5e6e('0x6f')](_0x1ae1e9['body'],function(_0x5956e8,_0x3c8742){return _[_0x5e6e('0x70')](_0x3c8742,_0x5e6e('0x2d'));}),_[_0x5e6e('0x71')](_0x487ebe,function(_0xc31c75){return util['format'](_0x5e6e('0x72'),_0xc31c75['id']);}));}})[_0x5e6e('0x1b')](function(_0x3409f6){if(_0x3409f6&&!_[_0x5e6e('0x73')](_0x3409f6)){var _0x4bba6c=squel['update']()[_0x5e6e('0x74')](_0x5e6e('0x75'))[_0x5e6e('0x76')](_0x3409f6)['where'](_0x5e6e('0x77'),_0x1ae1e9[_0x5e6e('0x29')]['id'])['toParam']();return db[_0x5e6e('0x78')][_0x5e6e('0x25')](_0x4bba6c[_0x5e6e('0x79')],{'replacements':_0x4bba6c[_0x5e6e('0x35')]});}})[_0x5e6e('0x1b')](function(){if(_0x1ae1e9[_0x5e6e('0x3a')][_0x5e6e('0x7a')]&&_0x1968f7){return db[_0x5e6e('0x40')][_0x5e6e('0x1a')]({'phone':_0x1ae1e9[_0x5e6e('0x3a')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1968f7['id']}});}})[_0x5e6e('0x1b')](function(){return _0x1968f7;})['then'](respondWithResult(_0x284dd3,null))[_0x5e6e('0x26')](handleError(_0x284dd3,null));};exports[_0x5e6e('0x7b')]=function(_0x5685af,_0x3cc68f){var _0x534765={};var _0x2a9c11={};var _0x3ec080;var _0x52b62e;return db[_0x5e6e('0x27')]['findOne']({'where':{'id':_0x5685af[_0x5e6e('0x29')]['id']}})['then'](handleEntityNotFound(_0x3cc68f,null))[_0x5e6e('0x1b')](function(_0x57f834){if(_0x57f834){_0x3ec080=_0x57f834;_0x2a9c11[_0x5e6e('0x7c')]=_['keys'](db['Tag'][_0x5e6e('0x7d')]);_0x2a9c11[_0x5e6e('0x25')]=_[_0x5e6e('0x2c')](_0x5685af[_0x5e6e('0x25')]);_0x2a9c11[_0x5e6e('0x7e')]=_['intersection'](_0x2a9c11[_0x5e6e('0x7c')],_0x2a9c11['query']);_0x534765[_0x5e6e('0x7f')]=_[_0x5e6e('0x80')](_0x2a9c11['model'],qs[_0x5e6e('0x81')](_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x81')]));_0x534765[_0x5e6e('0x7f')]=_0x534765[_0x5e6e('0x7f')][_0x5e6e('0x32')]?_0x534765[_0x5e6e('0x7f')]:_0x2a9c11[_0x5e6e('0x7c')];_0x534765[_0x5e6e('0x82')]=qs[_0x5e6e('0x83')](_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x83')]);_0x534765[_0x5e6e('0x5f')]=qs['filters'](_[_0x5e6e('0x84')](_0x5685af[_0x5e6e('0x25')],_0x2a9c11[_0x5e6e('0x7e')]));if(_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x85')]){_0x534765[_0x5e6e('0x5f')]=_[_0x5e6e('0x39')](_0x534765[_0x5e6e('0x5f')],{'$or':_[_0x5e6e('0x71')](_0x534765[_0x5e6e('0x7f')],function(_0x450eeb){var _0x15915b={};_0x15915b[_0x450eeb]={'$like':'%'+_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x85')]+'%'};return _0x15915b;})});}_0x534765=_['merge']({},_0x534765,_0x5685af[_0x5e6e('0x86')]);return _0x3ec080[_0x5e6e('0x7b')](_0x534765);}})['then'](function(_0x4c9748){if(_0x4c9748){_0x52b62e=_0x4c9748[_0x5e6e('0x32')];if(!_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x38')](_0x5e6e('0x87'))){_0x534765[_0x5e6e('0x17')]=qs[_0x5e6e('0x17')](_0x5685af[_0x5e6e('0x25')]['limit']);_0x534765[_0x5e6e('0x88')]=qs[_0x5e6e('0x88')](_0x5685af[_0x5e6e('0x25')][_0x5e6e('0x88')]);}return _0x3ec080['getTags'](_0x534765);}})[_0x5e6e('0x1b')](function(_0x564eb8){if(_0x564eb8){return _0x564eb8?{'count':_0x52b62e,'rows':_0x564eb8}:null;}})['then'](respondWithResult(_0x3cc68f,null))['catch'](handleError(_0x3cc68f,null));};exports[_0x5e6e('0x89')]=function(_0x9d86e7,_0xc1e91){if(_0x9d86e7[_0x5e6e('0x3a')]['id']){delete _0x9d86e7[_0x5e6e('0x3a')]['id'];}return db[_0x5e6e('0x27')][_0x5e6e('0x8a')]({'where':{'id':_0x9d86e7[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0xc1e91,null))[_0x5e6e('0x1b')](function(_0x4c2d7a){if(_0x4c2d7a){return _0x4c2d7a[_0x5e6e('0x89')](_0x9d86e7[_0x5e6e('0x3a')]['ids']||[]);}return null;})[_0x5e6e('0x1b')](respondWithResult(_0xc1e91,null))[_0x5e6e('0x26')](handleError(_0xc1e91,null));};exports[_0x5e6e('0x8b')]=function(_0x4747f5,_0x1281f2){var _0x470f7a=[];_0x470f7a[_0x5e6e('0x62')](addAdditionalPhones(_0x4747f5[_0x5e6e('0x3a')]));Promise[_0x5e6e('0x64')](_0x470f7a)['then'](function(){_0x470f7a=[];_0x470f7a[_0x5e6e('0x62')](deleteCmHopperPhones(_0x4747f5[_0x5e6e('0x3a')]['id']));_0x470f7a[_0x5e6e('0x62')](addCmHopperPhones(_0x4747f5['body']['id']));Promise['all'](_0x470f7a)[_0x5e6e('0x1b')](function(){return[0x1];})[_0x5e6e('0x1b')](respondWithResult(_0x1281f2,null));});};function addAdditionalPhones(_0x2c3ae4){var _0xc1f98b;return new Promise(function(_0x27db91){return db[_0x5e6e('0x66')][_0x5e6e('0x1c')]({'where':{'CmContactId':_0x2c3ae4['id']}})['then'](function(){db[_0x5e6e('0x68')][_0x5e6e('0x24')]({'raw':!![],'attributes':['id',_0x5e6e('0x8c')]})['then'](function(_0x5a6365){var _0x3bec26=[];for(var _0x25a071=0x0;_0x25a071<_0x2c3ae4[_0x5e6e('0x8d')][_0x5e6e('0x32')];_0x25a071++){var _0x85b054=_0x2c3ae4[_0x5e6e('0x8e')]?_[_0x5e6e('0x57')](_0x2c3ae4[_0x5e6e('0x8e')][_0x25a071])?'':_0x2c3ae4[_0x5e6e('0x8e')][_0x25a071]:_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071][_0x5e6e('0x8f')]?_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071][_0x5e6e('0x8f')]:'';var _0x56c48a=_['isNil'](_0x2c3ae4['items'][_0x25a071]['description'])?'':_0x2c3ae4['items'][_0x25a071][_0x5e6e('0x90')];var _0x2b9a36=_0x85b054+':'+_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071][_0x5e6e('0x7a')]+'§'+_0x56c48a;if(_['isNil'](_0xc1f98b))_0xc1f98b=_0x2b9a36;else _0xc1f98b+=';'+_0x2b9a36;var _0x2fd32b=null;var _0x148ee1=null;if(_0x2c3ae4[_0x5e6e('0x8e')]){if(!_[_0x5e6e('0x57')](_0x2c3ae4[_0x5e6e('0x8e')][_0x25a071])){_0x148ee1=_['find'](_0x5a6365,function(_0x4e0058){return _0x4e0058['id']===_0x2c3ae4[_0x5e6e('0x8e')][_0x25a071];});if(!_[_0x5e6e('0x57')](_0x148ee1)){_0x2fd32b=_0x148ee1[_0x5e6e('0x8c')];}}}else{if(!_['isNil'](_0x2c3ae4['items'][_0x25a071])){_0x148ee1=_[_0x5e6e('0x28')](_0x5a6365,function(_0x4d499c){return _0x4d499c['id']===_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071]['ItemTypeId'];});if(!_['isNil'](_0x148ee1)){_0x2fd32b=_0x25a071;}}}if(_['isNil'](_0x2fd32b)){_0x2fd32b=0x64;}_0x3bec26[_0x5e6e('0x62')](addAdditionalPhone(_0x2c3ae4['id'],_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071]['phone'],_0x2c3ae4[_0x5e6e('0x8e')]?_[_0x5e6e('0x57')](_0x2c3ae4['item_types'][_0x25a071])?null:_0x2c3ae4[_0x5e6e('0x8e')][_0x25a071]:_0x2c3ae4[_0x5e6e('0x8d')][_0x25a071][_0x5e6e('0x8f')]?_0x2c3ae4['items'][_0x25a071][_0x5e6e('0x8f')]:null,_0x2fd32b,_0x56c48a));}Promise[_0x5e6e('0x64')](_0x3bec26)[_0x5e6e('0x1b')](function(){db[_0x5e6e('0x27')][_0x5e6e('0x1a')]({'AdditionalPhones':_0xc1f98b},{'where':{'id':_0x2c3ae4['id']}})[_0x5e6e('0x1b')](function(){_0x27db91(0x1);});});});});});}function addAdditionalPhone(_0x3599f8,_0x39d093,_0xe96b2e,_0x1030ed,_0x23e691){return db[_0x5e6e('0x66')][_0x5e6e('0x28')]({'where':{'CmContactId':_0x3599f8,'item':_0x39d093}})['then'](function(_0x527c7d){if(_0x527c7d)logger[_0x5e6e('0x36')](_0x5e6e('0x91'),_0x527c7d);else{db[_0x5e6e('0x66')][_0x5e6e('0x44')]({'CmContactId':_0x3599f8,'item':_0x39d093,'ItemTypeId':_0xe96b2e,'OrderBy':_0x1030ed,'ItemClass':_0x5e6e('0x92'),'description':_0x23e691});}});}function deleteCmHopperPhones(_0xd8a1a){return new Promise(function(_0x37d400){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd8a1a}})[_0x5e6e('0x1b')](function(_0x222c3b){db['CmHopperAdditionalPhone'][_0x5e6e('0x1c')]({'where':{'CmHopperId':{'$in':_['map'](_0x222c3b,'id')}}});})['then'](function(){_0x37d400(0x1);});});}function addCmHopperPhones(_0x48354f){return new Promise(function(_0x1bef9e){return db[_0x5e6e('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48354f}})[_0x5e6e('0x1b')](function(_0x45baae){var _0x10a17a=[];_[_0x5e6e('0x71')](_0x45baae,function(_0x36e91e){_0x10a17a['push'](createCmHopperPhone(_0x48354f,_0x36e91e['id']));});Promise[_0x5e6e('0x64')](_0x10a17a)[_0x5e6e('0x1b')](function(){_0x1bef9e(0x1);});});});}function createCmHopperPhone(_0x2603cd,_0x2442d6){return new Promise(function(_0x32762f){db[_0x5e6e('0x66')][_0x5e6e('0x24')]({'raw':!![],'attributes':[_0x5e6e('0x93'),_0x5e6e('0x8c')],'where':{'CmContactId':_0x2603cd,'ItemClass':_0x5e6e('0x92')},'include':[{'model':db[_0x5e6e('0x68')],'attributes':[_0x5e6e('0x8c')],'as':_0x5e6e('0x69')}],'order':[_0x5e6e('0x8c'),db[_0x5e6e('0x78')][_0x5e6e('0x6a')](_0x5e6e('0x94'))]})[_0x5e6e('0x1b')](function(_0x5a0fcb){var _0x10558d=0x1;var _0x55a7a9=_[_0x5e6e('0x71')](_0x5a0fcb,function(_0x45f7ec){_0x45f7ec[_0x5e6e('0x95')]=_0x2442d6;_0x45f7ec[_0x5e6e('0x7a')]=_0x45f7ec[_0x5e6e('0x93')];_0x45f7ec[_0x5e6e('0x8c')]=_0x10558d;delete _0x45f7ec[_0x5e6e('0x96')];_0x10558d=_0x10558d+0x1;return _0x45f7ec;});return db['CmHopperAdditionalPhone'][_0x5e6e('0x5c')](_0x55a7a9,{});})['then'](function(){_0x32762f(0x1);});});}function insertAdditionalPhones(_0x19a67c,_0x15a71a){return new Promise(function(_0x2806a7){var _0x717339=[];for(var _0xf52b4c=0x0;_0xf52b4c<_0x15a71a['length'];_0xf52b4c++){var _0x226c41=_0x15a71a[_0xf52b4c];_0x717339[_0x5e6e('0x62')](parseContactItemType(_0x226c41));}Promise[_0x5e6e('0x64')](_0x717339)[_0x5e6e('0x1b')](function(){var _0x3f8bfb={'id':_0x19a67c['id'],'items':_0x15a71a};return addAdditionalPhones(_0x3f8bfb)[_0x5e6e('0x1b')](function(){return addCmHopperPhones(_0x19a67c['id']);});})[_0x5e6e('0x1b')](function(){_0x2806a7(_0x19a67c);});});}function parseContactItemType(_0x12019d){return new Promise(function(_0x4170ca){if(_0x12019d['hasOwnProperty'](_0x5e6e('0x8f'))){_0x4170ca(_0x12019d);}else{return db[_0x5e6e('0x68')][_0x5e6e('0x28')]({'where':{'name':_0x12019d[_0x5e6e('0x69')]}})[_0x5e6e('0x1b')](function(_0x461bac){if(_['isNil'](_0x461bac))_0x12019d[_0x5e6e('0x8f')]=null;else _0x12019d[_0x5e6e('0x8f')]=_0x461bac['id'];_0x4170ca(_0x12019d);});}});}exports['getAdditionalPhones']=function(_0x415627,_0x32c190){return db['CmContactHasItem'][_0x5e6e('0x24')]({'raw':!![],'where':{'CmContactId':_0x415627[_0x5e6e('0x29')]['id'],'ItemClass':_0x5e6e('0x92')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x5e6e('0x8c')],[db[_0x5e6e('0x78')][_0x5e6e('0x6a')](_0x5e6e('0x94'))]]})[_0x5e6e('0x1b')](function(_0x2ce54a){return _0x2ce54a;})[_0x5e6e('0x1b')](respondWithResult(_0x32c190,null))[_0x5e6e('0x26')](handleError(_0x32c190,null));};exports[_0x5e6e('0x97')]=function(_0x4327c6,_0x2184e0){return db[_0x5e6e('0x66')][_0x5e6e('0x24')]({'raw':!![],'where':{'CmContactId':_0x4327c6[_0x5e6e('0x3a')][_0x5e6e('0x98')]}})[_0x5e6e('0x1b')](function(_0x229cc5){var _0x535fe5=_[_0x5e6e('0x71')](_0x229cc5,function(_0x2d9e00){_0x2d9e00[_0x5e6e('0x99')]=_0x4327c6['body']['toContactId'];return _0x2d9e00;});return db[_0x5e6e('0x66')][_0x5e6e('0x5c')](_0x535fe5,{});})[_0x5e6e('0x1b')](function(){return addCmHopperPhones(_0x4327c6[_0x5e6e('0x3a')]['toContactId']);})[_0x5e6e('0x1b')](function(){return['ok'];})['then'](respondWithResult(_0x2184e0,null))[_0x5e6e('0x26')](handleError(_0x2184e0,null));};exports['rescheduleAdditionalPhones']=function(_0x469121,_0x5d3cb8){var _0x1f790c=[];_0x1f790c[_0x5e6e('0x62')](createCmHopperPhone(_0x469121[_0x5e6e('0x3a')]['id'],_0x469121['body']['hopperId']));Promise[_0x5e6e('0x64')](_0x1f790c)['then'](function(){return[0x1];})[_0x5e6e('0x1b')](respondWithResult(_0x5d3cb8,null));};exports[_0x5e6e('0x9a')]=function(_0x2f89f5,_0xd83504){var _0x49cb74={'raw':![],'where':{}};var _0xac6a30={};var _0x1f92f2={'count':0x0,'rows':[]};return db[_0x5e6e('0x27')][_0x5e6e('0x8a')]({'where':{'id':_0x2f89f5[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0xd83504,null))[_0x5e6e('0x1b')](function(_0x50866b){if(_0x50866b){_0xac6a30[_0x5e6e('0x7c')]=_[_0x5e6e('0x2c')](db[_0x5e6e('0x40')][_0x5e6e('0x7d')]);_0xac6a30[_0x5e6e('0x25')]=_[_0x5e6e('0x2c')](_0x2f89f5[_0x5e6e('0x25')]);_0xac6a30[_0x5e6e('0x7e')]=_[_0x5e6e('0x80')](_0xac6a30['model'],_0xac6a30['query']);_0x49cb74[_0x5e6e('0x7f')]=_[_0x5e6e('0x80')](_0xac6a30[_0x5e6e('0x7c')],qs[_0x5e6e('0x81')](_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x81')]));_0x49cb74['attributes']=_0x49cb74[_0x5e6e('0x7f')][_0x5e6e('0x32')]?_0x49cb74[_0x5e6e('0x7f')]:_0xac6a30['model'];if(!_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x38')](_0x5e6e('0x87'))){_0x49cb74['limit']=qs['limit'](_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x17')]);_0x49cb74[_0x5e6e('0x88')]=qs[_0x5e6e('0x88')](_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x88')]);}_0x49cb74[_0x5e6e('0x82')]=qs[_0x5e6e('0x83')](_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x83')]);_0x49cb74[_0x5e6e('0x5f')]=qs['filters'](_['pick'](_0x2f89f5[_0x5e6e('0x25')],_0xac6a30[_0x5e6e('0x7e')]));_0x49cb74['where'][_0x5e6e('0x9b')]=_0x50866b['id'];if(_0x2f89f5[_0x5e6e('0x25')]['filter']){_0x49cb74['where']=_[_0x5e6e('0x39')](_0x49cb74['where'],{'$or':_[_0x5e6e('0x71')](_0x49cb74[_0x5e6e('0x7f')],function(_0x2cec97){var _0x3e5ef2={};_0x3e5ef2[_0x2cec97]={'$like':'%'+_0x2f89f5[_0x5e6e('0x25')][_0x5e6e('0x85')]+'%'};return _0x3e5ef2;})});}_0x49cb74=_[_0x5e6e('0x39')]({},_0x49cb74,_0x2f89f5[_0x5e6e('0x86')]);return db[_0x5e6e('0x40')][_0x5e6e('0x16')]({'where':_0x49cb74[_0x5e6e('0x5f')]})[_0x5e6e('0x1b')](function(_0x25932c){_0x1f92f2[_0x5e6e('0x16')]=_0x25932c;if(_0x2f89f5[_0x5e6e('0x25')]['includeAll']){_0x49cb74[_0x5e6e('0x9c')]=[{'all':!![]}];}return db[_0x5e6e('0x40')]['findAll'](_0x49cb74);})[_0x5e6e('0x1b')](function(_0x33cd97){_0x1f92f2[_0x5e6e('0x9d')]=_0x33cd97;return _0x1f92f2;});}})[_0x5e6e('0x1b')](respondWithFilteredResult(_0xd83504,_0x49cb74))[_0x5e6e('0x26')](handleError(_0xd83504,null));};exports[_0x5e6e('0x9e')]=function(_0x127aaa,_0x177a4a){var _0x507b9f={'raw':!![],'where':{}};var _0x591e8f={};var _0x2df9c4={'count':0x0,'rows':[]};return db[_0x5e6e('0x27')][_0x5e6e('0x8a')]({'where':{'id':_0x127aaa[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0x177a4a,null))[_0x5e6e('0x1b')](function(_0x13ead5){if(_0x13ead5){_0x591e8f[_0x5e6e('0x7c')]=_[_0x5e6e('0x2c')](db[_0x5e6e('0x4e')][_0x5e6e('0x7d')]);_0x591e8f['query']=_[_0x5e6e('0x2c')](_0x127aaa[_0x5e6e('0x25')]);_0x591e8f[_0x5e6e('0x7e')]=_[_0x5e6e('0x80')](_0x591e8f[_0x5e6e('0x7c')],_0x591e8f[_0x5e6e('0x25')]);_0x507b9f[_0x5e6e('0x7f')]=_[_0x5e6e('0x80')](_0x591e8f[_0x5e6e('0x7c')],qs[_0x5e6e('0x81')](_0x127aaa['query'][_0x5e6e('0x81')]));_0x507b9f[_0x5e6e('0x7f')]=_0x507b9f['attributes']['length']?_0x507b9f[_0x5e6e('0x7f')]:_0x591e8f[_0x5e6e('0x7c')];if(!_0x127aaa[_0x5e6e('0x25')][_0x5e6e('0x38')]('nolimit')){_0x507b9f['limit']=qs['limit'](_0x127aaa['query'][_0x5e6e('0x17')]);_0x507b9f[_0x5e6e('0x88')]=qs['offset'](_0x127aaa[_0x5e6e('0x25')][_0x5e6e('0x88')]);}_0x507b9f[_0x5e6e('0x82')]=qs[_0x5e6e('0x83')](_0x127aaa[_0x5e6e('0x25')]['sort']);_0x507b9f[_0x5e6e('0x5f')]=qs[_0x5e6e('0x7e')](_[_0x5e6e('0x84')](_0x127aaa[_0x5e6e('0x25')],_0x591e8f[_0x5e6e('0x7e')]));_0x507b9f[_0x5e6e('0x5f')][_0x5e6e('0x9b')]=_0x13ead5['id'];if(_0x127aaa['query']['filter']){_0x507b9f[_0x5e6e('0x5f')]=_['merge'](_0x507b9f[_0x5e6e('0x5f')],{'$or':_[_0x5e6e('0x71')](_0x507b9f[_0x5e6e('0x7f')],function(_0x3dfd8a){var _0x411469={};_0x411469[_0x3dfd8a]={'$like':'%'+_0x127aaa['query'][_0x5e6e('0x85')]+'%'};return _0x411469;})});}_0x507b9f=_[_0x5e6e('0x39')]({},_0x507b9f,_0x127aaa['options']);return db['CmHopperHistory']['count']({'where':_0x507b9f[_0x5e6e('0x5f')]})[_0x5e6e('0x1b')](function(_0x587587){_0x2df9c4[_0x5e6e('0x16')]=_0x587587;if(_0x127aaa[_0x5e6e('0x25')][_0x5e6e('0x9f')]){_0x507b9f[_0x5e6e('0x9c')]=[{'all':!![]}];}return db[_0x5e6e('0x4e')][_0x5e6e('0x24')](_0x507b9f);})[_0x5e6e('0x1b')](function(_0x416c9d){_0x2df9c4['rows']=_0x416c9d;return _0x2df9c4;});}})['then'](respondWithFilteredResult(_0x177a4a,_0x507b9f))[_0x5e6e('0x26')](handleError(_0x177a4a,null));};exports[_0x5e6e('0xa0')]=function(_0x59746f,_0x331623){var _0x42c130={'raw':!![],'where':{}};var _0x36714a={};var _0x186d5f={'count':0x0,'rows':[]};return db[_0x5e6e('0x27')][_0x5e6e('0x8a')]({'where':{'id':_0x59746f[_0x5e6e('0x29')]['id']}})['then'](handleEntityNotFound(_0x331623,null))[_0x5e6e('0x1b')](function(_0x38e15f){if(_0x38e15f){_0x36714a[_0x5e6e('0x7c')]=_[_0x5e6e('0x2c')](db[_0x5e6e('0x4d')][_0x5e6e('0x7d')]);_0x36714a['query']=_[_0x5e6e('0x2c')](_0x59746f['query']);_0x36714a[_0x5e6e('0x7e')]=_[_0x5e6e('0x80')](_0x36714a[_0x5e6e('0x7c')],_0x36714a[_0x5e6e('0x25')]);_0x42c130['attributes']=_[_0x5e6e('0x80')](_0x36714a[_0x5e6e('0x7c')],qs[_0x5e6e('0x81')](_0x59746f['query'][_0x5e6e('0x81')]));_0x42c130['attributes']=_0x42c130[_0x5e6e('0x7f')][_0x5e6e('0x32')]?_0x42c130[_0x5e6e('0x7f')]:_0x36714a[_0x5e6e('0x7c')];if(!_0x59746f[_0x5e6e('0x25')][_0x5e6e('0x38')](_0x5e6e('0x87'))){_0x42c130[_0x5e6e('0x17')]=qs[_0x5e6e('0x17')](_0x59746f[_0x5e6e('0x25')][_0x5e6e('0x17')]);_0x42c130[_0x5e6e('0x88')]=qs[_0x5e6e('0x88')](_0x59746f['query'][_0x5e6e('0x88')]);}_0x42c130[_0x5e6e('0x82')]=qs[_0x5e6e('0x83')](_0x59746f['query'][_0x5e6e('0x83')]);_0x42c130[_0x5e6e('0x5f')]=qs['filters'](_['pick'](_0x59746f[_0x5e6e('0x25')],_0x36714a[_0x5e6e('0x7e')]));_0x42c130[_0x5e6e('0x5f')][_0x5e6e('0x9b')]=_0x38e15f['id'];if(_0x59746f[_0x5e6e('0x25')][_0x5e6e('0x85')]){_0x42c130[_0x5e6e('0x5f')]=_[_0x5e6e('0x39')](_0x42c130['where'],{'$or':_['map'](_0x42c130[_0x5e6e('0x7f')],function(_0x15ac00){var _0x4a7354={};_0x4a7354[_0x15ac00]={'$like':'%'+_0x59746f[_0x5e6e('0x25')][_0x5e6e('0x85')]+'%'};return _0x4a7354;})});}_0x42c130=_['merge']({},_0x42c130,_0x59746f[_0x5e6e('0x86')]);return db['CmHopperFinal'][_0x5e6e('0x16')]({'where':_0x42c130['where']})[_0x5e6e('0x1b')](function(_0x2e854e){_0x186d5f['count']=_0x2e854e;if(_0x59746f[_0x5e6e('0x25')][_0x5e6e('0x9f')]){_0x42c130[_0x5e6e('0x9c')]=[{'all':!![]}];}return db[_0x5e6e('0x4d')][_0x5e6e('0x24')](_0x42c130);})[_0x5e6e('0x1b')](function(_0x5100b6){_0x186d5f[_0x5e6e('0x9d')]=_0x5100b6;return _0x186d5f;});}})[_0x5e6e('0x1b')](respondWithFilteredResult(_0x331623,_0x42c130))[_0x5e6e('0x26')](handleError(_0x331623,null));};exports[_0x5e6e('0xa1')]=function(_0x27bdf1,_0x1d6f50){var _0x2e9cfb={'raw':!![],'where':{}};var _0x36b8e1={};var _0x2e778b={'count':0x0,'rows':[]};return db[_0x5e6e('0x27')][_0x5e6e('0x8a')]({'where':{'id':_0x27bdf1[_0x5e6e('0x29')]['id']}})[_0x5e6e('0x1b')](handleEntityNotFound(_0x1d6f50,null))[_0x5e6e('0x1b')](function(_0x2bbb8f){if(_0x2bbb8f){_0x36b8e1[_0x5e6e('0x7c')]=_[_0x5e6e('0x2c')](db[_0x5e6e('0xa2')][_0x5e6e('0x7d')]);_0x36b8e1[_0x5e6e('0x25')]=_[_0x5e6e('0x2c')](_0x27bdf1[_0x5e6e('0x25')]);_0x36b8e1[_0x5e6e('0x7e')]=_[_0x5e6e('0x80')](_0x36b8e1[_0x5e6e('0x7c')],_0x36b8e1[_0x5e6e('0x25')]);_0x2e9cfb[_0x5e6e('0x7f')]=_['intersection'](_0x36b8e1[_0x5e6e('0x7c')],qs[_0x5e6e('0x81')](_0x27bdf1[_0x5e6e('0x25')][_0x5e6e('0x81')]));_0x2e9cfb['attributes']=_0x2e9cfb[_0x5e6e('0x7f')]['length']?_0x2e9cfb['attributes']:_0x36b8e1[_0x5e6e('0x7c')];if(!_0x27bdf1['query'][_0x5e6e('0x38')](_0x5e6e('0x87'))){_0x2e9cfb['limit']=qs[_0x5e6e('0x17')](_0x27bdf1[_0x5e6e('0x25')]['limit']);_0x2e9cfb[_0x5e6e('0x88')]=qs[_0x5e6e('0x88')](_0x27bdf1[_0x5e6e('0x25')][_0x5e6e('0x88')]);}_0x2e9cfb[_0x5e6e('0x82')]=qs[_0x5e6e('0x83')](_0x27bdf1[_0x5e6e('0x25')]['sort']);_0x2e9cfb[_0x5e6e('0x5f')]=qs[_0x5e6e('0x7e')](_[_0x5e6e('0x84')](_0x27bdf1[_0x5e6e('0x25')],_0x36b8e1[_0x5e6e('0x7e')]));_0x2e9cfb[_0x5e6e('0x5f')][_0x5e6e('0x9b')]=_0x2bbb8f['id'];if(_0x27bdf1[_0x5e6e('0x25')][_0x5e6e('0x85')]){_0x2e9cfb['where']=_['merge'](_0x2e9cfb[_0x5e6e('0x5f')],{'$or':_['map'](_0x2e9cfb[_0x5e6e('0x7f')],function(_0x21dd8d){var _0xf84ddc={};_0xf84ddc[_0x21dd8d]={'$like':'%'+_0x27bdf1[_0x5e6e('0x25')][_0x5e6e('0x85')]+'%'};return _0xf84ddc;})});}_0x2e9cfb=_['merge']({},_0x2e9cfb,_0x27bdf1[_0x5e6e('0x86')]);return db[_0x5e6e('0xa2')][_0x5e6e('0x16')]({'where':_0x2e9cfb[_0x5e6e('0x5f')]})['then'](function(_0x32c357){_0x2e778b[_0x5e6e('0x16')]=_0x32c357;if(_0x27bdf1[_0x5e6e('0x25')]['includeAll']){_0x2e9cfb['include']=[{'all':!![]}];}return db[_0x5e6e('0xa2')][_0x5e6e('0x24')](_0x2e9cfb);})['then'](function(_0x4b5c1a){_0x2e778b[_0x5e6e('0x9d')]=_0x4b5c1a;return _0x2e778b;});}})[_0x5e6e('0x1b')](respondWithFilteredResult(_0x1d6f50,_0x2e9cfb))['catch'](handleError(_0x1d6f50,null));};exports[_0x5e6e('0xa3')]=function(_0x24a02a,_0x2a3a0a){try{if(!_0x24a02a[_0x5e6e('0x3a')]['ListId']){throw new Error(_0x5e6e('0xa4'));}if(!_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0xa5')]){throw new Error(_0x5e6e('0xa6'));}if(!_0x24a02a['body'][_0x5e6e('0xa7')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x24a02a['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x240222=_0x24a02a[_0x5e6e('0x3a')]['binding_keys'][_0x5e6e('0xa8')](',');var _0x36f584=_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0xa7')][_0x5e6e('0xa8')](',');if(!_0x240222[_0x5e6e('0x32')]||!_0x36f584[_0x5e6e('0x32')]||_0x240222[_0x5e6e('0x32')]!==_0x36f584['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0x81')]=_[_0x5e6e('0xa9')](_0x240222,_0x36f584);if(!_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0x81')][_0x5e6e('0x7a')]){throw new Error(_0x5e6e('0xaa'));}if(!_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0x81')][_0x5e6e('0xab')]){throw new Error(_0x5e6e('0xac'));}var _0x4c3b1a=path[_0x5e6e('0x3e')](config[_0x5e6e('0xad')],_0x5e6e('0xae'),_0x24a02a[_0x5e6e('0xaf')][_0x5e6e('0xb0')]);fs[_0x5e6e('0xb1')](_0x4c3b1a,parseInt(_0x5e6e('0xb2'),0x8));var _0x47c59d=require('child_process')[_0x5e6e('0xb3')](path[_0x5e6e('0x3e')](__dirname,_0x5e6e('0xb4')),[_0x4c3b1a,_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0xa5')],_0x24a02a['body'][_0x5e6e('0xa7')],_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0x61')],_0x24a02a['body']['CompanyId'],_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0x5e')],_0x24a02a[_0x5e6e('0x3a')][_0x5e6e('0xb5')]]);return _0x2a3a0a[_0x5e6e('0x13')](0xc8)[_0x5e6e('0x14')]({'message':_0x5e6e('0xb6'),'pid':_0x47c59d[_0x5e6e('0xb7')]});}catch(_0x21541b){return _0x2a3a0a[_0x5e6e('0x13')](0x1f4)['send'](_0x21541b);}};exports[_0x5e6e('0xb8')]=function(_0x1203f9,_0x163810){var _0x244db9=fs[_0x5e6e('0xb9')](_0x1203f9[_0x5e6e('0xaf')][_0x5e6e('0x3')]);Papa[_0x5e6e('0xba')](_0x244db9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x45675b){return _0x163810[_0x5e6e('0x13')](0xc8)[_0x5e6e('0x14')]({'file':_0x1203f9[_0x5e6e('0xaf')],'fields':_0x45675b[_0x5e6e('0xbb')]['fields']});}});};exports[_0x5e6e('0xbc')]=function(_0x2b5375,_0x556dac){return db[_0x5e6e('0xbd')][_0x5e6e('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5e6e('0xbe')}})[_0x5e6e('0x1b')](function(_0x100e20){var _0x4b735a=![];if(!_0x2b5375[_0x5e6e('0x3a')][_0x5e6e('0x61')]){throw new Error(_0x5e6e('0xa4'));}if(!_0x2b5375['body'][_0x5e6e('0xbf')][_0x5e6e('0x7a')]){throw new Error(_0x5e6e('0xaa'));}if(!_0x2b5375[_0x5e6e('0x3a')]['binding'][_0x5e6e('0xab')]){throw new Error(_0x5e6e('0xac'));}if(!_0x2b5375[_0x5e6e('0x3a')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4abd3d=require(_0x5e6e('0xc0'))['fork'](path[_0x5e6e('0x3e')](__dirname,_0x5e6e('0xc1')),[_0x2b5375['params']['id'],JSON[_0x5e6e('0xc2')](_0x2b5375[_0x5e6e('0x3a')]),JSON[_0x5e6e('0xc2')](_0x100e20)]);_0x4abd3d['on'](_0x5e6e('0xc3'),function(){_0x4b735a=!![];return _0x556dac['status'](0xc8)[_0x5e6e('0x14')]({'message':_0x5e6e('0xc4'),'pid':_0x4abd3d[_0x5e6e('0xb7')]});});_0x4abd3d['on'](_0x5e6e('0xc5'),function(_0x30c01e){if(_0x30c01e&&!_0x4b735a){return _0x556dac[_0x5e6e('0x13')](0x1f4)[_0x5e6e('0x14')]({'message':_0x5e6e('0xc6'),'pid':_0x4abd3d[_0x5e6e('0xb7')]});}});})[_0x5e6e('0x26')](handleError(_0x556dac,null));};exports[_0x5e6e('0xc7')]=function(_0x3f210a,_0x5e6339){return db[_0x5e6e('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x5e6e('0xbe')}})[_0x5e6e('0x1b')](function(_0xd81a9c){var _0x30fc7e=![];if(!_0x3f210a[_0x5e6e('0x3a')][_0x5e6e('0x61')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3f210a[_0x5e6e('0x3a')][_0x5e6e('0xbf')][_0x5e6e('0x7a')]){throw new Error(_0x5e6e('0xaa'));}if(!_0x3f210a[_0x5e6e('0x3a')][_0x5e6e('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x3f210a[_0x5e6e('0x3a')][_0x5e6e('0xb5')]){throw new Error(_0x5e6e('0xc8'));}var _0xb7708e=require(_0x5e6e('0xc0'))[_0x5e6e('0xb3')](path[_0x5e6e('0x3e')](__dirname,_0x5e6e('0xc9')),[_0x3f210a[_0x5e6e('0x29')]['id'],JSON['stringify'](_0x3f210a['body']),JSON['stringify'](_0xd81a9c)]);_0xb7708e['on'](_0x5e6e('0xc3'),function(){_0x30fc7e=!![];return _0x5e6339[_0x5e6e('0x13')](0xc8)['json']({'message':_0x5e6e('0xc4'),'pid':_0xb7708e[_0x5e6e('0xb7')]});});_0xb7708e['on'](_0x5e6e('0xc5'),function(_0x8abdc1){if(_0x8abdc1&&!_0x30fc7e){return _0x5e6339['status'](0x1f4)[_0x5e6e('0x14')]({'message':'error\x20child\x20process','pid':_0xb7708e['pid']});}});})['catch'](handleError(_0x5e6339,null));};exports[_0x5e6e('0xca')]=function(_0x529682,_0x91022d){var _0x203738=[_0x5e6e('0xcb'),'chat',_0x5e6e('0xcc'),_0x5e6e('0xcd'),_0x5e6e('0xce'),_0x5e6e('0xcf'),_0x5e6e('0xd0')];var _0x2f25cb={'offset':0x0,'order':qs['sort'](_0x5e6e('0xd1'))},_0x2c3c75={'count':0x0,'rows':[]};Promise[_0x5e6e('0xd2')]()['then'](function(){if(_0x529682['query'][_0x5e6e('0xd3')]){if(!_[_0x5e6e('0xd4')](_0x203738,_0x529682['query'][_0x5e6e('0xd3')][_0x5e6e('0xd5')]())){throw new Error(_0x5e6e('0xd6'));}_0x203738=[_0x529682['query']['channel']['toLowerCase']()];}if(_0x529682['query'][_0x5e6e('0xd7')]){try{var _0x4ab6f1=JSON[_0x5e6e('0xba')](_0x529682['query'][_0x5e6e('0xd7')]);if(!moment(_0x4ab6f1[_0x5e6e('0x3b')])[_0x5e6e('0xd8')]()){throw new Error(_0x5e6e('0xd9'));}if(!moment(_0x4ab6f1['to'])[_0x5e6e('0xd8')]()){throw new Error(_0x5e6e('0xda'));}}catch(_0x101366){throw new Error(_0x5e6e('0xdb'));}}if(!_0x529682['query'][_0x5e6e('0x38')](_0x5e6e('0x87'))){_0x2f25cb[_0x5e6e('0x17')]=qs[_0x5e6e('0x17')](_0x529682[_0x5e6e('0x25')][_0x5e6e('0x17')]||0xa);_0x2f25cb['offset']=qs[_0x5e6e('0x88')](_0x529682[_0x5e6e('0x25')]['offset']);}var _0x5be6d9=_0x203738['map'](function(_0x43004b){if(_0x43004b===_0x5e6e('0xd0')){var _0x2bb871={'attributes':['id','uniqueid',_0x5e6e('0x34'),_0x5e6e('0xdc'),_0x5e6e('0xdd'),_0x5e6e('0xde'),_0x5e6e('0xdf'),'endtime',_0x5e6e('0xe0'),_0x5e6e('0xe1'),'createdAt','userDisposition',_0x5e6e('0xe2'),_0x5e6e('0xe3'),_0x5e6e('0xe4')],'where':{'ContactId':_0x529682[_0x5e6e('0x29')]['id']},'include':[{'model':db['User'],'as':_0x5e6e('0xbd'),'attributes':['id',_0x5e6e('0x20'),'fullname',_0x5e6e('0xe5')]}],'order':[['createdAt',_0x5e6e('0xe6')]]};if(_0x529682['query'][_0x5e6e('0xd7')]){_0x2bb871[_0x5e6e('0x5f')][_0x5e6e('0xe7')]={'$gte':_0x4ab6f1[_0x5e6e('0x3b')],'$lte':_0x4ab6f1['to']};}return db[_0x5e6e('0x4f')][_0x5e6e('0xe8')](_0x2bb871)['then'](function(_0x4763f8){_0x2c3c75[_0x5e6e('0x16')]+=_0x4763f8[_0x5e6e('0x16')];return _['map'](_0x4763f8[_0x5e6e('0x9d')],function(_0x483e92){var _0x5cc981=_0x483e92[_0x5e6e('0x3c')]({'plain':!![]});_0x5cc981['channel']=_0x43004b;if(_0x5cc981[_0x5e6e('0xbd')]){_0x5cc981[_0x5e6e('0xbd')]={'id':_0x5cc981[_0x5e6e('0xbd')]['id'],'name':_0x5cc981['User']['name'],'fullname':_0x5cc981['User'][_0x5e6e('0xe9')],'alias':_0x5cc981['User'][_0x5e6e('0xe5')]};}return _0x5cc981;});});}else{var _0x3a3e23=_[_0x5e6e('0xea')](_0x43004b)+(_0x43004b===_0x5e6e('0xeb')?_0x5e6e('0xec'):'Account');var _0x1d7cbb={'attributes':['id',_0x5e6e('0xed'),_0x5e6e('0xee'),_0x5e6e('0xe7'),_0x5e6e('0xe1'),_0x5e6e('0xef'),_0x5e6e('0xf0'),_0x5e6e('0xf1'),_0x5e6e('0xe4'),_0x3a3e23+'Id'],'where':{'ContactId':_0x529682['params']['id']},'include':[{'model':db[_0x3a3e23],'as':'Account','attributes':['id',_0x5e6e('0x20'),_0x5e6e('0xf2')]},{'model':db[_0x5e6e('0xbd')],'as':_0x5e6e('0xf3'),'attributes':['id',_0x5e6e('0x20'),_0x5e6e('0xe9')]},{'model':db['Tag'],'as':_0x5e6e('0xf4'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[['createdAt',_0x5e6e('0xe6')]]};if(_0x529682[_0x5e6e('0x25')][_0x5e6e('0xd7')]){_0x1d7cbb[_0x5e6e('0x5f')][_0x5e6e('0xe7')]={'$gte':_0x4ab6f1[_0x5e6e('0x3b')],'$lte':_0x4ab6f1['to']};}switch(_0x43004b){case _0x5e6e('0xeb'):_0x1d7cbb['attributes']['push'](_0x5e6e('0xf5'),'customerIp',_0x5e6e('0xf6'),_0x5e6e('0xf7'),'osName','ratingMessage','ratingType','ratingValue',_0x5e6e('0xf8'));break;case'mail':_0x1d7cbb['attributes'][_0x5e6e('0x62')](_0x5e6e('0xf9'),_0x5e6e('0xfa'));break;case'openchannel':_0x1d7cbb['attributes'][_0x5e6e('0x62')](_0x5e6e('0xfb'),_0x5e6e('0xfc'));break;}return db[_[_0x5e6e('0xea')](_0x43004b)+'Interaction']['findAndCountAll'](_0x1d7cbb)[_0x5e6e('0x1b')](function(_0x416f26){_0x2c3c75['count']+=_0x416f26[_0x5e6e('0x16')];return _[_0x5e6e('0x71')](_0x416f26['rows'],function(_0x572806){var _0x580499=_0x572806[_0x5e6e('0x3c')]({'plain':!![]});_0x580499[_0x5e6e('0xd3')]=_0x43004b;if(_0x580499[_0x5e6e('0xf3')]){_0x580499[_0x5e6e('0xf3')]={'id':_0x580499[_0x5e6e('0xf3')]['id'],'name':_0x580499[_0x5e6e('0xf3')][_0x5e6e('0x20')],'fullname':_0x580499[_0x5e6e('0xf3')]['fullname']};}return _0x580499;});});}});return Promise['all'](_0x5be6d9);})[_0x5e6e('0x1b')](function(_0x2722c9){return _(_0x2722c9)[_0x5e6e('0xfd')]()[_0x5e6e('0xfe')](_0x5e6e('0xe7'))[_0x5e6e('0xff')]()[_0x5e6e('0x100')]();})[_0x5e6e('0x1b')](function(_0x1f6e32){_0x2c3c75['rows']=_0x2f25cb[_0x5e6e('0x17')]?_0x1f6e32['slice'](_0x2f25cb[_0x5e6e('0x88')],_0x2f25cb[_0x5e6e('0x88')]+_0x2f25cb[_0x5e6e('0x17')]):_0x1f6e32;return _0x2c3c75;})['then'](respondWithFilteredResult(_0x91022d,_0x2f25cb))[_0x5e6e('0x26')](handleError(_0x91022d,null));}; \ No newline at end of file +var _0x3170=['include','getHopperHistories','getHopperFinals','CmHopperFinal','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','callerid','starttime','endtime','note','userDisposition','userThirdDisposition','UserId','fullname','alias','DESC','createdAt','findAndCountAll','startCase','chat','Account','closed','closedAt','secondDisposition','thirdDisposition','Owner','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','value','util','path','squel','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','redis','localhost','register','status','count','offset','limit','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','user','catch','CmContact','find','keys','length','columnName','displayName','query','cf_','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','from','get','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','tags','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','params','Tag','Tags','tag','CmContactHasItem','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','pick','filter','options','hasOwnProperty','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll'];(function(_0x2bcb6e,_0x582f44){var _0x5c08b=function(_0x44fada){while(--_0x44fada){_0x2bcb6e['push'](_0x2bcb6e['shift']());}};_0x5c08b(++_0x582f44);}(_0x3170,0x64));var _0x0317=function(_0x39d18b,_0x497c48){_0x39d18b=_0x39d18b-0x0;var _0x3dbf1e=_0x3170[_0x39d18b];return _0x3dbf1e;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0317('0x0'));var path=require(_0x0317('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0317('0x2'));var Papa=require(_0x0317('0x3'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x0317('0x4'));var logger=require(_0x0317('0x5'))('api');var config=require(_0x0317('0x6'));var shared=require(_0x0317('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0317('0x8')],{'host':_0x0317('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0317('0x8')]));require('./cmContact.socket')[_0x0317('0xa')](socket);function respondWithResult(_0x150050,_0x37b70f){_0x37b70f=_0x37b70f||0xc8;return function(_0x2e4e5b){if(_0x2e4e5b){return _0x150050[_0x0317('0xb')](_0x37b70f)['json'](_0x2e4e5b);}};}function respondWithFilteredResult(_0x661a60,_0x4fc438){return function(_0x323bf0){if(_0x323bf0){var _0x489587=typeof _0x4fc438['offset']==='undefined'&&typeof _0x4fc438['limit']==='undefined';var _0x4a0385=_0x323bf0[_0x0317('0xc')];var _0x2e46cb=_0x489587?0x0:_0x4fc438['offset'];var _0x436f28=_0x489587?_0x323bf0[_0x0317('0xc')]:_0x4fc438[_0x0317('0xd')]+_0x4fc438[_0x0317('0xe')];var _0x3299f0;if(_0x436f28>=_0x4a0385){_0x436f28=_0x4a0385;_0x3299f0=0xc8;}else{_0x3299f0=0xce;}_0x661a60[_0x0317('0xb')](_0x3299f0);return _0x661a60['set'](_0x0317('0xf'),_0x2e46cb+'-'+_0x436f28+'/'+_0x4a0385)[_0x0317('0x10')](_0x323bf0);}return null;};}function saveUpdates(_0xb90e05){return function(_0x5160e4){if(_0x5160e4){return _0x5160e4[_0x0317('0x11')](_0xb90e05)[_0x0317('0x12')](function(_0x38da46){return _0x38da46;});}return null;};}function removeEntity(_0x2b7fab){return function(_0x5d7979){if(_0x5d7979){return _0x5d7979[_0x0317('0x13')]()[_0x0317('0x12')](function(){_0x2b7fab['status'](0xcc)[_0x0317('0x14')]();});}};}function handleEntityNotFound(_0x510529){return function(_0x5b9865){if(!_0x5b9865){_0x510529[_0x0317('0x15')](0x194);}return _0x5b9865;};}function handleError(_0x33528d,_0x289c91){_0x289c91=_0x289c91||0x1f4;return function(_0x52747b){logger[_0x0317('0x16')](_0x52747b[_0x0317('0x17')]);if(_0x52747b[_0x0317('0x18')]){delete _0x52747b[_0x0317('0x18')];}_0x33528d[_0x0317('0xb')](_0x289c91)[_0x0317('0x19')](_0x52747b);};}exports[_0x0317('0x1a')]=function(_0x3c7398,_0x582c2d){var _0x1283fd={};return contacts[_0x0317('0x1b')]()[_0x0317('0x12')](function(_0x199c73){_0x1283fd=qs[_0x0317('0x1c')](_0x199c73,_0x3c7398);return contacts[_0x0317('0x1d')](_0x3c7398['query'],_0x3c7398[_0x0317('0x1e')],_0x1283fd,_0x199c73);})['then'](respondWithFilteredResult(_0x582c2d,_0x1283fd))[_0x0317('0x1f')](handleError(_0x582c2d,null));};exports[_0x0317('0x13')]=function(_0x35c0f4,_0xbcaee1){return db[_0x0317('0x20')][_0x0317('0x21')]({'where':{'id':_0x35c0f4['params']['id']}})[_0x0317('0x12')](handleEntityNotFound(_0xbcaee1,null))[_0x0317('0x12')](removeEntity(_0xbcaee1,null))[_0x0317('0x1f')](handleError(_0xbcaee1,null));};exports[_0x0317('0x1b')]=function(_0x58c454,_0x5729a8){return db[_0x0317('0x20')][_0x0317('0x1b')]()['then'](function(_0x5d2bf1){delete _0x5d2bf1['tags'];for(var _0x244afb=0x0;_0x244afb0x0){return new Promise(function(_0x1e6215){var _0x3cc178=[];for(var _0x4cdbd3=0x0;_0x4cdbd3<_0x334fe6[_0x0317('0x23')];_0x4cdbd3++){_0x3cc178[_0x0317('0x51')](insertAdditionalPhones(_0x334fe6[_0x4cdbd3][_0x0317('0x55')],_0x334fe6[_0x4cdbd3]['additionalPhones']));}Promise[_0x0317('0x56')](_0x3cc178)['then'](function(){_0x1e6215(0x1);});})[_0x0317('0x12')](function(){return{'success':_0x570866,'failure':_0x45f629,'duplicates':_0x186180};});}else{return{'success':_0x570866,'failure':_0x45f629,'duplicates':_0x186180};}}})[_0x0317('0x12')](respondWithResult(_0x511d20,0xc9))[_0x0317('0x1f')](handleError(_0x511d20,null));};exports[_0x0317('0x57')]=function(_0x40d5b0,_0x1fd656){var _0x5bccf2;return db[_0x0317('0x20')][_0x0317('0x1b')]()['then'](function(_0x4bb7ca){return db[_0x0317('0x20')][_0x0317('0x21')]({'where':{'id':_0x40d5b0[_0x0317('0x58')]['id']},'include':[{'model':db[_0x0317('0x59')],'as':_0x0317('0x5a'),'attributes':['id',_0x0317('0x18'),'color'],'required':_0x40d5b0[_0x0317('0x26')][_0x0317('0x5b')]?!![]:![]},{'model':db[_0x0317('0x5c')],'as':'Phones','where':{'CmContactId':_0x40d5b0[_0x0317('0x58')]['id']},'required':![],'include':[{'model':db[_0x0317('0x5d')],'as':_0x0317('0x5e')}]}],'order':[db[_0x0317('0x5f')][_0x0317('0x60')](_0x0317('0x61'))],'attributes':_[_0x0317('0x22')](_0x4bb7ca)});})['then'](function(_0x53fd63){if(!_[_0x0317('0x48')](_0x53fd63)){_0x5bccf2=_0x53fd63[_0x0317('0x2e')]({'plain':!![]});var _0x4df65f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x53fd63&&_0x53fd63[_0x0317('0x52')]){if(_0x53fd63['ListId']){_0x4df65f[_0x0317('0x4f')][_0x0317('0x62')][_0x0317('0x51')]({'ListId':{'$ne':_0x53fd63[_0x0317('0x52')]}});}}return db[_0x0317('0x63')][_0x0317('0x1d')](_0x4df65f);}})[_0x0317('0x12')](function(_0xe600be){if(!_[_0x0317('0x48')](_0xe600be)){return _[_0x0317('0x64')](_0x5bccf2,_[_0x0317('0x65')](_0xe600be,function(_0x1d0d3f){return util[_0x0317('0x66')](_0x0317('0x67'),_0x1d0d3f['id']);}));}})[_0x0317('0x12')](handleEntityNotFound(_0x1fd656,null))[_0x0317('0x12')](respondWithResult(_0x1fd656,null))[_0x0317('0x1f')](handleError(_0x1fd656,null));};exports[_0x0317('0x11')]=function(_0x506c32,_0x551a51){var _0x5e1379;if(_0x506c32[_0x0317('0x2c')]['id']){delete _0x506c32[_0x0317('0x2c')]['id'];}if(!_[_0x0317('0x48')](_0x506c32[_0x0317('0x2c')]['dialTimezone'])){var _0x327ba8=_0x506c32[_0x0317('0x2c')]['dialTimezone'];if(!_[_0x0317('0x48')](shared['timezones'][_0x327ba8]))_0x506c32[_0x0317('0x2c')][_0x0317('0x4b')]=shared['timezones'][_0x327ba8][_0x0317('0x4b')];}return db['CmContact'][_0x0317('0x21')]({'where':{'id':_0x506c32[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x551a51,null))[_0x0317('0x12')](saveUpdates(_0x506c32[_0x0317('0x2c')],null))[_0x0317('0x12')](function(_0x254562){_0x5e1379=_0x254562;var _0x2d4ef1={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x254562&&_0x254562['ListId']){if(_0x254562[_0x0317('0x52')]){_0x2d4ef1[_0x0317('0x4f')][_0x0317('0x62')][_0x0317('0x51')]({'ListId':{'$ne':_0x254562['ListId']}});}}return db[_0x0317('0x63')][_0x0317('0x1d')](_0x2d4ef1);})[_0x0317('0x12')](function(_0x46e26b){if(_0x46e26b){return _[_0x0317('0x64')](_[_0x0317('0x68')](_0x506c32[_0x0317('0x2c')],function(_0x7800ac,_0x572f08){return _[_0x0317('0x69')](_0x572f08,_0x0317('0x27'));}),_['map'](_0x46e26b,function(_0x4b2f59){return util['format'](_0x0317('0x67'),_0x4b2f59['id']);}));}})[_0x0317('0x12')](function(_0x152d2a){if(_0x152d2a&&!_[_0x0317('0x6a')](_0x152d2a)){var _0x214cca=squel[_0x0317('0x11')]()[_0x0317('0x6b')](_0x0317('0x6c'))[_0x0317('0x6d')](_0x152d2a)['where'](_0x0317('0x6e'),_0x506c32[_0x0317('0x58')]['id'])[_0x0317('0x6f')]();return db['sequelize'][_0x0317('0x26')](_0x214cca['text'],{'replacements':_0x214cca['values']});}})['then'](function(){if(_0x506c32[_0x0317('0x2c')]['phone']&&_0x5e1379){return db['CmHopper'][_0x0317('0x11')]({'phone':_0x506c32['body'][_0x0317('0x70')],'OrderBy':0x0},{'where':{'ContactId':_0x5e1379['id']}});}})['then'](function(){return _0x5e1379;})[_0x0317('0x12')](respondWithResult(_0x551a51,null))['catch'](handleError(_0x551a51,null));};exports[_0x0317('0x71')]=function(_0x584880,_0x413d94){var _0x2571e2={};var _0x71716b={};var _0x496597;var _0x4f8216;return db[_0x0317('0x20')][_0x0317('0x72')]({'where':{'id':_0x584880[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x413d94,null))[_0x0317('0x12')](function(_0x1c41a6){if(_0x1c41a6){_0x496597=_0x1c41a6;_0x71716b[_0x0317('0x73')]=_[_0x0317('0x22')](db[_0x0317('0x59')][_0x0317('0x74')]);_0x71716b[_0x0317('0x26')]=_[_0x0317('0x22')](_0x584880[_0x0317('0x26')]);_0x71716b['filters']=_[_0x0317('0x75')](_0x71716b['model'],_0x71716b[_0x0317('0x26')]);_0x2571e2[_0x0317('0x76')]=_[_0x0317('0x75')](_0x71716b[_0x0317('0x73')],qs[_0x0317('0x77')](_0x584880[_0x0317('0x26')][_0x0317('0x77')]));_0x2571e2['attributes']=_0x2571e2[_0x0317('0x76')][_0x0317('0x23')]?_0x2571e2[_0x0317('0x76')]:_0x71716b[_0x0317('0x73')];_0x2571e2[_0x0317('0x78')]=qs[_0x0317('0x79')](_0x584880['query'][_0x0317('0x79')]);_0x2571e2[_0x0317('0x4f')]=qs[_0x0317('0x7a')](_[_0x0317('0x7b')](_0x584880[_0x0317('0x26')],_0x71716b[_0x0317('0x7a')]));if(_0x584880[_0x0317('0x26')][_0x0317('0x7c')]){_0x2571e2['where']=_['merge'](_0x2571e2[_0x0317('0x4f')],{'$or':_[_0x0317('0x65')](_0x2571e2[_0x0317('0x76')],function(_0x41c28d){var _0x568ee5={};_0x568ee5[_0x41c28d]={'$like':'%'+_0x584880[_0x0317('0x26')]['filter']+'%'};return _0x568ee5;})});}_0x2571e2=_['merge']({},_0x2571e2,_0x584880[_0x0317('0x7d')]);return _0x496597['getTags'](_0x2571e2);}})[_0x0317('0x12')](function(_0x29efa6){if(_0x29efa6){_0x4f8216=_0x29efa6[_0x0317('0x23')];if(!_0x584880[_0x0317('0x26')][_0x0317('0x7e')](_0x0317('0x7f'))){_0x2571e2[_0x0317('0xe')]=qs[_0x0317('0xe')](_0x584880[_0x0317('0x26')]['limit']);_0x2571e2[_0x0317('0xd')]=qs[_0x0317('0xd')](_0x584880[_0x0317('0x26')][_0x0317('0xd')]);}return _0x496597[_0x0317('0x71')](_0x2571e2);}})[_0x0317('0x12')](function(_0x426775){if(_0x426775){return _0x426775?{'count':_0x4f8216,'rows':_0x426775}:null;}})['then'](respondWithResult(_0x413d94,null))[_0x0317('0x1f')](handleError(_0x413d94,null));};exports[_0x0317('0x80')]=function(_0x3c2fa4,_0x1746ef){if(_0x3c2fa4[_0x0317('0x2c')]['id']){delete _0x3c2fa4[_0x0317('0x2c')]['id'];}return db[_0x0317('0x20')][_0x0317('0x72')]({'where':{'id':_0x3c2fa4[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x1746ef,null))['then'](function(_0x43551f){if(_0x43551f){return _0x43551f[_0x0317('0x80')](_0x3c2fa4[_0x0317('0x2c')][_0x0317('0x81')]||[]);}return null;})[_0x0317('0x12')](respondWithResult(_0x1746ef,null))[_0x0317('0x1f')](handleError(_0x1746ef,null));};exports[_0x0317('0x82')]=function(_0x2fc56f,_0x217ab4){var _0x223179=[];_0x223179['push'](addAdditionalPhones(_0x2fc56f[_0x0317('0x2c')]));Promise[_0x0317('0x56')](_0x223179)[_0x0317('0x12')](function(){_0x223179=[];_0x223179['push'](deleteCmHopperPhones(_0x2fc56f[_0x0317('0x2c')]['id']));_0x223179[_0x0317('0x51')](addCmHopperPhones(_0x2fc56f['body']['id']));Promise[_0x0317('0x56')](_0x223179)[_0x0317('0x12')](function(){return[0x1];})[_0x0317('0x12')](respondWithResult(_0x217ab4,null));});};function addAdditionalPhones(_0x5eacb7){var _0x497c0a;return new Promise(function(_0x3dbc76){return db[_0x0317('0x5c')]['destroy']({'where':{'CmContactId':_0x5eacb7['id']}})[_0x0317('0x12')](function(){db['ContactItemType'][_0x0317('0x1d')]({'raw':!![],'attributes':['id',_0x0317('0x83')]})[_0x0317('0x12')](function(_0x9c4394){var _0x27487b=[];for(var _0x39b59d=0x0;_0x39b59d<_0x5eacb7['items']['length'];_0x39b59d++){var _0x102b37=_0x5eacb7['item_types']?_['isNil'](_0x5eacb7[_0x0317('0x84')][_0x39b59d])?'':_0x5eacb7[_0x0317('0x84')][_0x39b59d]:_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x86')]?_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x86')]:'';var _0x301480=_[_0x0317('0x48')](_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x87')])?'':_0x5eacb7[_0x0317('0x85')][_0x39b59d]['description'];var _0x5f31ea=_0x102b37+':'+_0x5eacb7['items'][_0x39b59d][_0x0317('0x70')]+'§'+_0x301480;if(_['isNil'](_0x497c0a))_0x497c0a=_0x5f31ea;else _0x497c0a+=';'+_0x5f31ea;var _0x29dcdd=null;var _0x2dc9fb=null;if(_0x5eacb7['item_types']){if(!_[_0x0317('0x48')](_0x5eacb7[_0x0317('0x84')][_0x39b59d])){_0x2dc9fb=_[_0x0317('0x21')](_0x9c4394,function(_0x10a587){return _0x10a587['id']===_0x5eacb7[_0x0317('0x84')][_0x39b59d];});if(!_['isNil'](_0x2dc9fb)){_0x29dcdd=_0x2dc9fb[_0x0317('0x83')];}}}else{if(!_['isNil'](_0x5eacb7['items'][_0x39b59d])){_0x2dc9fb=_[_0x0317('0x21')](_0x9c4394,function(_0x13f3c6){return _0x13f3c6['id']===_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x86')];});if(!_['isNil'](_0x2dc9fb)){_0x29dcdd=_0x39b59d;}}}if(_[_0x0317('0x48')](_0x29dcdd)){_0x29dcdd=0x64;}_0x27487b['push'](addAdditionalPhone(_0x5eacb7['id'],_0x5eacb7[_0x0317('0x85')][_0x39b59d]['phone'],_0x5eacb7[_0x0317('0x84')]?_['isNil'](_0x5eacb7[_0x0317('0x84')][_0x39b59d])?null:_0x5eacb7['item_types'][_0x39b59d]:_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x86')]?_0x5eacb7[_0x0317('0x85')][_0x39b59d][_0x0317('0x86')]:null,_0x29dcdd,_0x301480));}Promise[_0x0317('0x56')](_0x27487b)['then'](function(){db['CmContact'][_0x0317('0x11')]({'AdditionalPhones':_0x497c0a},{'where':{'id':_0x5eacb7['id']}})[_0x0317('0x12')](function(){_0x3dbc76(0x1);});});});});});}function addAdditionalPhone(_0x1d4577,_0x1f4a10,_0x4db456,_0x1ba9a8,_0x1be71d){return db[_0x0317('0x5c')]['find']({'where':{'CmContactId':_0x1d4577,'item':_0x1f4a10}})[_0x0317('0x12')](function(_0x51df14){if(_0x51df14)logger[_0x0317('0x29')](_0x0317('0x88'),_0x51df14);else{db[_0x0317('0x5c')][_0x0317('0x34')]({'CmContactId':_0x1d4577,'item':_0x1f4a10,'ItemTypeId':_0x4db456,'OrderBy':_0x1ba9a8,'ItemClass':_0x0317('0x89'),'description':_0x1be71d});}});}function deleteCmHopperPhones(_0x3f8501){return new Promise(function(_0x5a01f9){return db[_0x0317('0x31')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3f8501}})['then'](function(_0x148748){db[_0x0317('0x8a')][_0x0317('0x13')]({'where':{'CmHopperId':{'$in':_[_0x0317('0x65')](_0x148748,'id')}}});})['then'](function(){_0x5a01f9(0x1);});});}function addCmHopperPhones(_0xb318ff){return new Promise(function(_0x2a0a7a){return db['CmHopper'][_0x0317('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb318ff}})[_0x0317('0x12')](function(_0x5536a5){var _0x2fb4a7=[];_[_0x0317('0x65')](_0x5536a5,function(_0x373f6c){_0x2fb4a7[_0x0317('0x51')](createCmHopperPhone(_0xb318ff,_0x373f6c['id']));});Promise[_0x0317('0x56')](_0x2fb4a7)[_0x0317('0x12')](function(){_0x2a0a7a(0x1);});});});}function createCmHopperPhone(_0x8608ea,_0x37f861){return new Promise(function(_0x54f902){db[_0x0317('0x5c')][_0x0317('0x1d')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x8608ea,'ItemClass':'PHONE'},'include':[{'model':db[_0x0317('0x5d')],'attributes':[_0x0317('0x83')],'as':'ItemType'}],'order':[_0x0317('0x83'),db['sequelize'][_0x0317('0x60')](_0x0317('0x8b'))]})['then'](function(_0x17edde){var _0x2088a2=0x1;var _0x58876e=_['map'](_0x17edde,function(_0x24206b){_0x24206b[_0x0317('0x8c')]=_0x37f861;_0x24206b[_0x0317('0x70')]=_0x24206b[_0x0317('0x8d')];_0x24206b['OrderBy']=_0x2088a2;delete _0x24206b[_0x0317('0x8e')];_0x2088a2=_0x2088a2+0x1;return _0x24206b;});return db[_0x0317('0x8a')][_0x0317('0x4d')](_0x58876e,{});})['then'](function(){_0x54f902(0x1);});});}function insertAdditionalPhones(_0x348e64,_0x34d83f){return new Promise(function(_0x712a98){var _0x3e6e06=[];for(var _0xca820b=0x0;_0xca820b<_0x34d83f['length'];_0xca820b++){var _0x594d05=_0x34d83f[_0xca820b];_0x3e6e06[_0x0317('0x51')](parseContactItemType(_0x594d05));}Promise['all'](_0x3e6e06)[_0x0317('0x12')](function(){var _0x174a0b={'id':_0x348e64['id'],'items':_0x34d83f};return addAdditionalPhones(_0x174a0b)['then'](function(){return addCmHopperPhones(_0x348e64['id']);});})[_0x0317('0x12')](function(){_0x712a98(_0x348e64);});});}function parseContactItemType(_0x527d81){return new Promise(function(_0x2d5703){if(_0x527d81[_0x0317('0x7e')](_0x0317('0x86'))){_0x2d5703(_0x527d81);}else{return db[_0x0317('0x5d')]['find']({'where':{'name':_0x527d81[_0x0317('0x5e')]}})['then'](function(_0x3db206){if(_[_0x0317('0x48')](_0x3db206))_0x527d81[_0x0317('0x86')]=null;else _0x527d81['ItemTypeId']=_0x3db206['id'];_0x2d5703(_0x527d81);});}});}exports[_0x0317('0x8f')]=function(_0x1ed30f,_0x3c34d3){return db['CmContactHasItem'][_0x0317('0x1d')]({'raw':!![],'where':{'CmContactId':_0x1ed30f['params']['id'],'ItemClass':_0x0317('0x89')},'include':[{'model':db[_0x0317('0x5d')],'as':_0x0317('0x5e')}],'order':[[_0x0317('0x83')],[db['sequelize']['literal'](_0x0317('0x8b'))]]})[_0x0317('0x12')](function(_0x59dc65){return _0x59dc65;})[_0x0317('0x12')](respondWithResult(_0x3c34d3,null))[_0x0317('0x1f')](handleError(_0x3c34d3,null));};exports[_0x0317('0x90')]=function(_0x525019,_0x4f506d){return db[_0x0317('0x5c')][_0x0317('0x1d')]({'raw':!![],'where':{'CmContactId':_0x525019[_0x0317('0x2c')][_0x0317('0x91')]}})[_0x0317('0x12')](function(_0x501b60){var _0x2f846b=_[_0x0317('0x65')](_0x501b60,function(_0xbc81d4){_0xbc81d4['CmContactId']=_0x525019['body'][_0x0317('0x92')];return _0xbc81d4;});return db['CmContactHasItem'][_0x0317('0x4d')](_0x2f846b,{});})[_0x0317('0x12')](function(){return addCmHopperPhones(_0x525019[_0x0317('0x2c')]['toContactId']);})['then'](function(){return['ok'];})[_0x0317('0x12')](respondWithResult(_0x4f506d,null))[_0x0317('0x1f')](handleError(_0x4f506d,null));};exports[_0x0317('0x93')]=function(_0x5e96a7,_0x2511e3){var _0x1e8d9d=[];_0x1e8d9d['push'](createCmHopperPhone(_0x5e96a7[_0x0317('0x2c')]['id'],_0x5e96a7['body'][_0x0317('0x94')]));Promise[_0x0317('0x56')](_0x1e8d9d)[_0x0317('0x12')](function(){return[0x1];})['then'](respondWithResult(_0x2511e3,null));};exports['getHoppers']=function(_0x5b161b,_0x1e0645){var _0x1ddf93={'raw':![],'where':{}};var _0x59c1c7={};var _0x44f5c3={'count':0x0,'rows':[]};return db['CmContact'][_0x0317('0x72')]({'where':{'id':_0x5b161b[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x1e0645,null))[_0x0317('0x12')](function(_0x149101){if(_0x149101){_0x59c1c7[_0x0317('0x73')]=_[_0x0317('0x22')](db[_0x0317('0x31')][_0x0317('0x74')]);_0x59c1c7[_0x0317('0x26')]=_[_0x0317('0x22')](_0x5b161b[_0x0317('0x26')]);_0x59c1c7['filters']=_[_0x0317('0x75')](_0x59c1c7[_0x0317('0x73')],_0x59c1c7[_0x0317('0x26')]);_0x1ddf93[_0x0317('0x76')]=_[_0x0317('0x75')](_0x59c1c7[_0x0317('0x73')],qs['fields'](_0x5b161b[_0x0317('0x26')]['fields']));_0x1ddf93[_0x0317('0x76')]=_0x1ddf93[_0x0317('0x76')][_0x0317('0x23')]?_0x1ddf93['attributes']:_0x59c1c7[_0x0317('0x73')];if(!_0x5b161b['query'][_0x0317('0x7e')](_0x0317('0x7f'))){_0x1ddf93['limit']=qs[_0x0317('0xe')](_0x5b161b['query'][_0x0317('0xe')]);_0x1ddf93['offset']=qs['offset'](_0x5b161b[_0x0317('0x26')][_0x0317('0xd')]);}_0x1ddf93[_0x0317('0x78')]=qs['sort'](_0x5b161b[_0x0317('0x26')][_0x0317('0x79')]);_0x1ddf93[_0x0317('0x4f')]=qs[_0x0317('0x7a')](_[_0x0317('0x7b')](_0x5b161b[_0x0317('0x26')],_0x59c1c7['filters']));_0x1ddf93[_0x0317('0x4f')][_0x0317('0x95')]=_0x149101['id'];if(_0x5b161b[_0x0317('0x26')]['filter']){_0x1ddf93[_0x0317('0x4f')]=_[_0x0317('0x2b')](_0x1ddf93[_0x0317('0x4f')],{'$or':_['map'](_0x1ddf93['attributes'],function(_0xf9b3cc){var _0x9b5376={};_0x9b5376[_0xf9b3cc]={'$like':'%'+_0x5b161b[_0x0317('0x26')][_0x0317('0x7c')]+'%'};return _0x9b5376;})});}_0x1ddf93=_['merge']({},_0x1ddf93,_0x5b161b['options']);return db[_0x0317('0x31')][_0x0317('0xc')]({'where':_0x1ddf93[_0x0317('0x4f')]})[_0x0317('0x12')](function(_0x4daee4){_0x44f5c3[_0x0317('0xc')]=_0x4daee4;if(_0x5b161b[_0x0317('0x26')][_0x0317('0x96')]){_0x1ddf93[_0x0317('0x97')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1ddf93);})[_0x0317('0x12')](function(_0x314c2d){_0x44f5c3['rows']=_0x314c2d;return _0x44f5c3;});}})['then'](respondWithFilteredResult(_0x1e0645,_0x1ddf93))[_0x0317('0x1f')](handleError(_0x1e0645,null));};exports[_0x0317('0x98')]=function(_0x1f631c,_0x36589f){var _0x486e37={'raw':!![],'where':{}};var _0x1660d3={};var _0x18ae37={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1f631c[_0x0317('0x58')]['id']}})['then'](handleEntityNotFound(_0x36589f,null))[_0x0317('0x12')](function(_0x3d1398){if(_0x3d1398){_0x1660d3[_0x0317('0x73')]=_[_0x0317('0x22')](db['CmHopperHistory'][_0x0317('0x74')]);_0x1660d3[_0x0317('0x26')]=_[_0x0317('0x22')](_0x1f631c[_0x0317('0x26')]);_0x1660d3['filters']=_['intersection'](_0x1660d3['model'],_0x1660d3['query']);_0x486e37[_0x0317('0x76')]=_[_0x0317('0x75')](_0x1660d3[_0x0317('0x73')],qs['fields'](_0x1f631c[_0x0317('0x26')][_0x0317('0x77')]));_0x486e37[_0x0317('0x76')]=_0x486e37[_0x0317('0x76')][_0x0317('0x23')]?_0x486e37[_0x0317('0x76')]:_0x1660d3[_0x0317('0x73')];if(!_0x1f631c[_0x0317('0x26')][_0x0317('0x7e')](_0x0317('0x7f'))){_0x486e37[_0x0317('0xe')]=qs['limit'](_0x1f631c[_0x0317('0x26')][_0x0317('0xe')]);_0x486e37[_0x0317('0xd')]=qs[_0x0317('0xd')](_0x1f631c['query'][_0x0317('0xd')]);}_0x486e37[_0x0317('0x78')]=qs[_0x0317('0x79')](_0x1f631c[_0x0317('0x26')][_0x0317('0x79')]);_0x486e37[_0x0317('0x4f')]=qs[_0x0317('0x7a')](_[_0x0317('0x7b')](_0x1f631c[_0x0317('0x26')],_0x1660d3[_0x0317('0x7a')]));_0x486e37[_0x0317('0x4f')][_0x0317('0x95')]=_0x3d1398['id'];if(_0x1f631c[_0x0317('0x26')][_0x0317('0x7c')]){_0x486e37[_0x0317('0x4f')]=_['merge'](_0x486e37[_0x0317('0x4f')],{'$or':_[_0x0317('0x65')](_0x486e37[_0x0317('0x76')],function(_0x4adf4c){var _0xe13475={};_0xe13475[_0x4adf4c]={'$like':'%'+_0x1f631c[_0x0317('0x26')][_0x0317('0x7c')]+'%'};return _0xe13475;})});}_0x486e37=_['merge']({},_0x486e37,_0x1f631c[_0x0317('0x7d')]);return db[_0x0317('0x3d')][_0x0317('0xc')]({'where':_0x486e37['where']})[_0x0317('0x12')](function(_0x2af8ca){_0x18ae37[_0x0317('0xc')]=_0x2af8ca;if(_0x1f631c[_0x0317('0x26')]['includeAll']){_0x486e37['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0317('0x1d')](_0x486e37);})[_0x0317('0x12')](function(_0x585ba7){_0x18ae37['rows']=_0x585ba7;return _0x18ae37;});}})[_0x0317('0x12')](respondWithFilteredResult(_0x36589f,_0x486e37))[_0x0317('0x1f')](handleError(_0x36589f,null));};exports[_0x0317('0x99')]=function(_0x3a3b1e,_0x104b1c){var _0x266691={'raw':!![],'where':{}};var _0x26ec5d={};var _0xe8f9dd={'count':0x0,'rows':[]};return db[_0x0317('0x20')][_0x0317('0x72')]({'where':{'id':_0x3a3b1e[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x104b1c,null))[_0x0317('0x12')](function(_0x5006a0){if(_0x5006a0){_0x26ec5d['model']=_[_0x0317('0x22')](db[_0x0317('0x9a')][_0x0317('0x74')]);_0x26ec5d[_0x0317('0x26')]=_[_0x0317('0x22')](_0x3a3b1e[_0x0317('0x26')]);_0x26ec5d[_0x0317('0x7a')]=_[_0x0317('0x75')](_0x26ec5d[_0x0317('0x73')],_0x26ec5d[_0x0317('0x26')]);_0x266691[_0x0317('0x76')]=_[_0x0317('0x75')](_0x26ec5d[_0x0317('0x73')],qs['fields'](_0x3a3b1e[_0x0317('0x26')][_0x0317('0x77')]));_0x266691[_0x0317('0x76')]=_0x266691[_0x0317('0x76')][_0x0317('0x23')]?_0x266691['attributes']:_0x26ec5d[_0x0317('0x73')];if(!_0x3a3b1e[_0x0317('0x26')][_0x0317('0x7e')](_0x0317('0x7f'))){_0x266691[_0x0317('0xe')]=qs[_0x0317('0xe')](_0x3a3b1e[_0x0317('0x26')][_0x0317('0xe')]);_0x266691['offset']=qs[_0x0317('0xd')](_0x3a3b1e[_0x0317('0x26')][_0x0317('0xd')]);}_0x266691[_0x0317('0x78')]=qs[_0x0317('0x79')](_0x3a3b1e[_0x0317('0x26')][_0x0317('0x79')]);_0x266691[_0x0317('0x4f')]=qs[_0x0317('0x7a')](_['pick'](_0x3a3b1e['query'],_0x26ec5d[_0x0317('0x7a')]));_0x266691[_0x0317('0x4f')][_0x0317('0x95')]=_0x5006a0['id'];if(_0x3a3b1e['query'][_0x0317('0x7c')]){_0x266691[_0x0317('0x4f')]=_[_0x0317('0x2b')](_0x266691['where'],{'$or':_[_0x0317('0x65')](_0x266691['attributes'],function(_0x12f665){var _0x4e7cbf={};_0x4e7cbf[_0x12f665]={'$like':'%'+_0x3a3b1e['query'][_0x0317('0x7c')]+'%'};return _0x4e7cbf;})});}_0x266691=_[_0x0317('0x2b')]({},_0x266691,_0x3a3b1e['options']);return db[_0x0317('0x9a')]['count']({'where':_0x266691['where']})[_0x0317('0x12')](function(_0xb7afce){_0xe8f9dd['count']=_0xb7afce;if(_0x3a3b1e[_0x0317('0x26')]['includeAll']){_0x266691[_0x0317('0x97')]=[{'all':!![]}];}return db[_0x0317('0x9a')][_0x0317('0x1d')](_0x266691);})[_0x0317('0x12')](function(_0x4ecaa4){_0xe8f9dd[_0x0317('0x9b')]=_0x4ecaa4;return _0xe8f9dd;});}})[_0x0317('0x12')](respondWithFilteredResult(_0x104b1c,_0x266691))[_0x0317('0x1f')](handleError(_0x104b1c,null));};exports[_0x0317('0x9c')]=function(_0x4fcfac,_0x7def7e){var _0x3e3b60={'raw':!![],'where':{}};var _0x1ccd52={};var _0x16fe96={'count':0x0,'rows':[]};return db[_0x0317('0x20')]['findOne']({'where':{'id':_0x4fcfac[_0x0317('0x58')]['id']}})[_0x0317('0x12')](handleEntityNotFound(_0x7def7e,null))[_0x0317('0x12')](function(_0x490a56){if(_0x490a56){_0x1ccd52['model']=_[_0x0317('0x22')](db['JscriptySessionReport'][_0x0317('0x74')]);_0x1ccd52[_0x0317('0x26')]=_[_0x0317('0x22')](_0x4fcfac[_0x0317('0x26')]);_0x1ccd52[_0x0317('0x7a')]=_[_0x0317('0x75')](_0x1ccd52['model'],_0x1ccd52[_0x0317('0x26')]);_0x3e3b60[_0x0317('0x76')]=_['intersection'](_0x1ccd52[_0x0317('0x73')],qs[_0x0317('0x77')](_0x4fcfac[_0x0317('0x26')][_0x0317('0x77')]));_0x3e3b60[_0x0317('0x76')]=_0x3e3b60[_0x0317('0x76')]['length']?_0x3e3b60[_0x0317('0x76')]:_0x1ccd52[_0x0317('0x73')];if(!_0x4fcfac['query']['hasOwnProperty'](_0x0317('0x7f'))){_0x3e3b60[_0x0317('0xe')]=qs[_0x0317('0xe')](_0x4fcfac[_0x0317('0x26')][_0x0317('0xe')]);_0x3e3b60[_0x0317('0xd')]=qs[_0x0317('0xd')](_0x4fcfac['query'][_0x0317('0xd')]);}_0x3e3b60[_0x0317('0x78')]=qs[_0x0317('0x79')](_0x4fcfac[_0x0317('0x26')][_0x0317('0x79')]);_0x3e3b60[_0x0317('0x4f')]=qs[_0x0317('0x7a')](_[_0x0317('0x7b')](_0x4fcfac[_0x0317('0x26')],_0x1ccd52['filters']));_0x3e3b60['where']['ContactId']=_0x490a56['id'];if(_0x4fcfac[_0x0317('0x26')][_0x0317('0x7c')]){_0x3e3b60[_0x0317('0x4f')]=_[_0x0317('0x2b')](_0x3e3b60[_0x0317('0x4f')],{'$or':_[_0x0317('0x65')](_0x3e3b60[_0x0317('0x76')],function(_0x1f037c){var _0x554030={};_0x554030[_0x1f037c]={'$like':'%'+_0x4fcfac[_0x0317('0x26')][_0x0317('0x7c')]+'%'};return _0x554030;})});}_0x3e3b60=_['merge']({},_0x3e3b60,_0x4fcfac[_0x0317('0x7d')]);return db[_0x0317('0x42')][_0x0317('0xc')]({'where':_0x3e3b60[_0x0317('0x4f')]})['then'](function(_0x541d8f){_0x16fe96['count']=_0x541d8f;if(_0x4fcfac['query'][_0x0317('0x96')]){_0x3e3b60['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0317('0x1d')](_0x3e3b60);})[_0x0317('0x12')](function(_0xb48b3f){_0x16fe96['rows']=_0xb48b3f;return _0x16fe96;});}})[_0x0317('0x12')](respondWithFilteredResult(_0x7def7e,_0x3e3b60))[_0x0317('0x1f')](handleError(_0x7def7e,null));};exports[_0x0317('0x9d')]=function(_0x565537,_0x577b53){try{if(!_0x565537[_0x0317('0x2c')]['ListId']){throw new Error(_0x0317('0x9e'));}if(!_0x565537[_0x0317('0x2c')][_0x0317('0x9f')]){throw new Error(_0x0317('0xa0'));}if(!_0x565537[_0x0317('0x2c')][_0x0317('0xa1')]){throw new Error(_0x0317('0xa2'));}if(!_0x565537[_0x0317('0x2c')][_0x0317('0xa3')]){throw new Error(_0x0317('0xa4'));}var _0x179333=_0x565537[_0x0317('0x2c')][_0x0317('0x9f')]['split'](',');var _0x5e40a6=_0x565537[_0x0317('0x2c')][_0x0317('0xa1')][_0x0317('0xa5')](',');if(!_0x179333['length']||!_0x5e40a6[_0x0317('0x23')]||_0x179333[_0x0317('0x23')]!==_0x5e40a6[_0x0317('0x23')]){throw new Error(_0x0317('0xa6'));}_0x565537['body'][_0x0317('0x77')]=_[_0x0317('0xa7')](_0x179333,_0x5e40a6);if(!_0x565537['body'][_0x0317('0x77')][_0x0317('0x70')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x565537['body'][_0x0317('0x77')][_0x0317('0xa8')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x552670=path[_0x0317('0x47')](config[_0x0317('0xa9')],_0x0317('0xaa'),_0x565537[_0x0317('0xab')][_0x0317('0xac')]);fs[_0x0317('0xad')](_0x552670,parseInt(_0x0317('0xae'),0x8));var _0x462abe=require(_0x0317('0xaf'))[_0x0317('0xb0')](path[_0x0317('0x47')](__dirname,_0x0317('0xb1')),[_0x552670,_0x565537[_0x0317('0x2c')]['binding_keys'],_0x565537[_0x0317('0x2c')][_0x0317('0xa1')],_0x565537[_0x0317('0x2c')][_0x0317('0x52')],_0x565537[_0x0317('0x2c')]['CompanyId'],_0x565537[_0x0317('0x2c')][_0x0317('0x4e')],_0x565537[_0x0317('0x2c')][_0x0317('0xa3')]]);return _0x577b53['status'](0xc8)[_0x0317('0x10')]({'message':_0x0317('0xb2'),'pid':_0x462abe[_0x0317('0xb3')]});}catch(_0x10a8bd){return _0x577b53['status'](0x1f4)[_0x0317('0x19')](_0x10a8bd);}};exports[_0x0317('0xb4')]=function(_0x440ed0,_0x24c554){var _0x517c61=fs[_0x0317('0xb5')](_0x440ed0[_0x0317('0xab')][_0x0317('0x1')]);Papa[_0x0317('0xb6')](_0x517c61,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3d98ac){return _0x24c554[_0x0317('0xb')](0xc8)['json']({'file':_0x440ed0[_0x0317('0xab')],'fields':_0x3d98ac[_0x0317('0xb7')][_0x0317('0x77')]});}});};exports['import']=function(_0x2aa253,_0x2183ae){return db[_0x0317('0xb8')][_0x0317('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0317('0xb9')}})[_0x0317('0x12')](function(_0x2e70cf){var _0x4c4229=![];if(!_0x2aa253['body'][_0x0317('0x52')]){throw new Error(_0x0317('0x9e'));}if(!_0x2aa253[_0x0317('0x2c')][_0x0317('0xba')][_0x0317('0x70')]){throw new Error(_0x0317('0xbb'));}if(!_0x2aa253[_0x0317('0x2c')]['binding'][_0x0317('0xa8')]){throw new Error(_0x0317('0xbc'));}if(!_0x2aa253[_0x0317('0x2c')][_0x0317('0xa3')]){throw new Error(_0x0317('0xa4'));}var _0x45920d=require(_0x0317('0xaf'))[_0x0317('0xb0')](path[_0x0317('0x47')](__dirname,_0x0317('0xbd')),[_0x2aa253[_0x0317('0x58')]['id'],JSON[_0x0317('0xbe')](_0x2aa253[_0x0317('0x2c')]),JSON[_0x0317('0xbe')](_0x2e70cf)]);_0x45920d['on'](_0x0317('0xbf'),function(){_0x4c4229=!![];return _0x2183ae['status'](0xc8)[_0x0317('0x10')]({'message':_0x0317('0xc0'),'pid':_0x45920d[_0x0317('0xb3')]});});_0x45920d['on'](_0x0317('0xc1'),function(_0x592e4c){if(_0x592e4c&&!_0x4c4229){return _0x2183ae['status'](0x1f4)[_0x0317('0x10')]({'message':_0x0317('0xc2'),'pid':_0x45920d[_0x0317('0xb3')]});}});})['catch'](handleError(_0x2183ae,null));};exports[_0x0317('0xc3')]=function(_0x13484b,_0x6f170d){return db['User'][_0x0317('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0317('0xb9')}})[_0x0317('0x12')](function(_0x4e2a2d){var _0x3c131b=![];if(!_0x13484b[_0x0317('0x2c')]['ListId']){throw new Error(_0x0317('0x9e'));}if(!_0x13484b[_0x0317('0x2c')]['binding'][_0x0317('0x70')]){throw new Error(_0x0317('0xbb'));}if(!_0x13484b[_0x0317('0x2c')]['binding'][_0x0317('0xa8')]){throw new Error(_0x0317('0xbc'));}if(!_0x13484b[_0x0317('0x2c')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x39a882=require(_0x0317('0xaf'))[_0x0317('0xb0')](path[_0x0317('0x47')](__dirname,_0x0317('0xc4')),[_0x13484b[_0x0317('0x58')]['id'],JSON['stringify'](_0x13484b[_0x0317('0x2c')]),JSON[_0x0317('0xbe')](_0x4e2a2d)]);_0x39a882['on'](_0x0317('0xbf'),function(){_0x3c131b=!![];return _0x6f170d[_0x0317('0xb')](0xc8)[_0x0317('0x10')]({'message':_0x0317('0xc0'),'pid':_0x39a882['pid']});});_0x39a882['on']('exit',function(_0x36b565){if(_0x36b565&&!_0x3c131b){return _0x6f170d[_0x0317('0xb')](0x1f4)[_0x0317('0x10')]({'message':'error\x20child\x20process','pid':_0x39a882[_0x0317('0xb3')]});}});})[_0x0317('0x1f')](handleError(_0x6f170d,null));};exports[_0x0317('0xc5')]=function(_0x2229af,_0x1526ea){var _0x38bb54=[_0x0317('0xc6'),'chat',_0x0317('0xc7'),_0x0317('0xc8'),_0x0317('0xc9'),_0x0317('0xca'),'voice'];var _0xe8bd8={'offset':0x0,'order':qs['sort'](_0x0317('0xcb'))},_0x48dec4={'count':0x0,'rows':[]};Promise[_0x0317('0xcc')]()['then'](function(){if(_0x2229af[_0x0317('0x26')][_0x0317('0xcd')]){if(!_['includes'](_0x38bb54,_0x2229af[_0x0317('0x26')][_0x0317('0xcd')][_0x0317('0xce')]())){throw new Error(_0x0317('0xcf'));}_0x38bb54=[_0x2229af[_0x0317('0x26')][_0x0317('0xcd')][_0x0317('0xce')]()];}if(_0x2229af['query'][_0x0317('0xd0')]){try{var _0x141842=JSON['parse'](_0x2229af['query'][_0x0317('0xd0')]);if(!moment(_0x141842['from'])['isValid']()){throw new Error(_0x0317('0xd1'));}if(!moment(_0x141842['to'])['isValid']()){throw new Error(_0x0317('0xd2'));}}catch(_0xdd026e){throw new Error(_0x0317('0xd3'));}}if(!_0x2229af['query'][_0x0317('0x7e')](_0x0317('0x7f'))){_0xe8bd8[_0x0317('0xe')]=qs[_0x0317('0xe')](_0x2229af[_0x0317('0x26')][_0x0317('0xe')]||0xa);_0xe8bd8['offset']=qs[_0x0317('0xd')](_0x2229af[_0x0317('0x26')][_0x0317('0xd')]);}var _0x576d7b=_0x38bb54[_0x0317('0x65')](function(_0x399a59){if(_0x399a59==='voice'){var _0x4e7078={'attributes':['id',_0x0317('0xd4'),_0x0317('0xd5'),_0x0317('0xd6'),_0x0317('0xd7'),_0x0317('0xd8'),_0x0317('0xd9'),_0x0317('0xda'),'duration',_0x0317('0xdb'),'createdAt',_0x0317('0xdc'),'userSecondDisposition',_0x0317('0xdd'),_0x0317('0xde')],'where':{'ContactId':_0x2229af[_0x0317('0x58')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x0317('0x18'),_0x0317('0xdf'),_0x0317('0xe0')]}],'order':[['createdAt',_0x0317('0xe1')]]};if(_0x2229af[_0x0317('0x26')]['range']){_0x4e7078[_0x0317('0x4f')][_0x0317('0xe2')]={'$gte':_0x141842['from'],'$lte':_0x141842['to']};}return db['VoiceCallReport'][_0x0317('0xe3')](_0x4e7078)[_0x0317('0x12')](function(_0x1788ed){_0x48dec4[_0x0317('0xc')]+=_0x1788ed[_0x0317('0xc')];return _[_0x0317('0x65')](_0x1788ed[_0x0317('0x9b')],function(_0x4057d5){var _0x4528f2=_0x4057d5['get']({'plain':!![]});_0x4528f2[_0x0317('0xcd')]=_0x399a59;if(_0x4528f2[_0x0317('0xb8')]){_0x4528f2[_0x0317('0xb8')]={'id':_0x4528f2[_0x0317('0xb8')]['id'],'name':_0x4528f2['User']['name'],'fullname':_0x4528f2['User'][_0x0317('0xdf')],'alias':_0x4528f2[_0x0317('0xb8')][_0x0317('0xe0')]};}return _0x4528f2;});});}else{var _0x36b2cf=_[_0x0317('0xe4')](_0x399a59)+(_0x399a59===_0x0317('0xe5')?'Website':_0x0317('0xe6'));var _0x12c676={'attributes':['id',_0x0317('0xe7'),_0x0317('0xe8'),'createdAt',_0x0317('0xdb'),'disposition',_0x0317('0xe9'),_0x0317('0xea'),_0x0317('0xde'),_0x36b2cf+'Id'],'where':{'ContactId':_0x2229af[_0x0317('0x58')]['id']},'include':[{'model':db[_0x36b2cf],'as':_0x0317('0xe6'),'attributes':['id',_0x0317('0x18'),'key']},{'model':db[_0x0317('0xb8')],'as':_0x0317('0xeb'),'attributes':['id',_0x0317('0x18'),_0x0317('0xdf')]},{'model':db[_0x0317('0x59')],'as':'Tags','attributes':['id',_0x0317('0x18'),'color'],'through':{'attributes':[]}}],'order':[[_0x0317('0xe2'),_0x0317('0xe1')]]};if(_0x2229af[_0x0317('0x26')][_0x0317('0xd0')]){_0x12c676[_0x0317('0x4f')]['createdAt']={'$gte':_0x141842['from'],'$lte':_0x141842['to']};}switch(_0x399a59){case _0x0317('0xe5'):_0x12c676['attributes'][_0x0317('0x51')]('browserName',_0x0317('0xec'),_0x0317('0xed'),'deviceModel',_0x0317('0xee'),_0x0317('0xef'),_0x0317('0xf0'),_0x0317('0xf1'),_0x0317('0xf2'));break;case _0x0317('0xc6'):_0x12c676[_0x0317('0x76')]['push'](_0x0317('0xf3'),_0x0317('0xf4'));break;case _0x0317('0xc8'):_0x12c676[_0x0317('0x76')]['push'](_0x0317('0xf5'),_0x0317('0xf6'));break;}return db[_[_0x0317('0xe4')](_0x399a59)+_0x0317('0xf7')][_0x0317('0xe3')](_0x12c676)['then'](function(_0x259943){_0x48dec4[_0x0317('0xc')]+=_0x259943[_0x0317('0xc')];return _[_0x0317('0x65')](_0x259943[_0x0317('0x9b')],function(_0xa253b4){var _0x569415=_0xa253b4['get']({'plain':!![]});_0x569415[_0x0317('0xcd')]=_0x399a59;if(_0x569415[_0x0317('0xeb')]){_0x569415[_0x0317('0xeb')]={'id':_0x569415[_0x0317('0xeb')]['id'],'name':_0x569415[_0x0317('0xeb')]['name'],'fullname':_0x569415[_0x0317('0xeb')][_0x0317('0xdf')]};}return _0x569415;});});}});return Promise[_0x0317('0x56')](_0x576d7b);})[_0x0317('0x12')](function(_0x5544f8){return _(_0x5544f8)['flatten']()[_0x0317('0xf8')](_0x0317('0xe2'))[_0x0317('0xf9')]()[_0x0317('0xfa')]();})[_0x0317('0x12')](function(_0xf63883){_0x48dec4[_0x0317('0x9b')]=_0xe8bd8['limit']?_0xf63883['slice'](_0xe8bd8[_0x0317('0xd')],_0xe8bd8[_0x0317('0xd')]+_0xe8bd8['limit']):_0xf63883;return _0x48dec4;})['then'](respondWithFilteredResult(_0x1526ea,_0xe8bd8))['catch'](handleError(_0x1526ea,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fbab246..2bdbe5e 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 _0x834b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update'];(function(_0x4cdfb5,_0x58ce18){var _0x5ca496=function(_0x39e67b){while(--_0x39e67b){_0x4cdfb5['push'](_0x4cdfb5['shift']());}};_0x5ca496(++_0x58ce18);}(_0x834b,0xaf));var _0xb834=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x834b[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xb834('0x0'));var CmContact=require(_0xb834('0x1'))['db'][_0xb834('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb834('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb834('0x4'),'afterDestroy':_0xb834('0x5')};function emitEvent(_0x4d2c26){return function(_0x36a888,_0x13fe96,_0x19f45b){CmContactEvents['emit'](_0x4d2c26+':'+_0x36a888['id'],_0x36a888);CmContactEvents[_0xb834('0x6')](_0x4d2c26,_0x36a888);_0x19f45b(null);};}for(var e in events){if(events[_0xb834('0x7')](e)){var event=events[e];CmContact[_0xb834('0x8')](e,emitEvent(event));}}module[_0xb834('0x9')]=CmContactEvents; \ No newline at end of file +var _0x2ea2=['hasOwnProperty','hook','exports','events','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x2da86b,_0x4b2386){var _0x2dc888=function(_0x1288e3){while(--_0x1288e3){_0x2da86b['push'](_0x2da86b['shift']());}};_0x2dc888(++_0x4b2386);}(_0x2ea2,0x175));var _0x22ea=function(_0x46cac5,_0x23d94a){_0x46cac5=_0x46cac5-0x0;var _0x2eca3d=_0x2ea2[_0x46cac5];return _0x2eca3d;};'use strict';var EventEmitter=require(_0x22ea('0x0'));var CmContact=require('../../mysqldb')['db'][_0x22ea('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x22ea('0x2')](0x0);var events={'afterCreate':_0x22ea('0x3'),'afterUpdate':_0x22ea('0x4'),'afterDestroy':_0x22ea('0x5')};function emitEvent(_0x475669){return function(_0x3db2dd,_0x40c304,_0x67d9c2){CmContactEvents[_0x22ea('0x6')](_0x475669+':'+_0x3db2dd['id'],_0x3db2dd);CmContactEvents[_0x22ea('0x6')](_0x475669,_0x3db2dd);_0x67d9c2(null);};}for(var e in events){if(events[_0x22ea('0x7')](e)){var event=events[e];CmContact[_0x22ea('0x8')](e,emitEvent(event));}}module[_0x22ea('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 09a758f..392787a 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 _0xcbb0=['exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','email','utf8mb4','models','get','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','utcOffset','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','cmContact','inspect','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','Lists','length','always','onlyIfOpen','outbound','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','dialCheckDuplicateType','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes'];(function(_0x3e9c04,_0x39186c){var _0x504218=function(_0x4f4a1c){while(--_0x4f4a1c){_0x3e9c04['push'](_0x3e9c04['shift']());}};_0x504218(++_0x39186c);}(_0xcbb0,0x8d));var _0x0cbb=function(_0x17cb5a,_0x10f9bb){_0x17cb5a=_0x17cb5a-0x0;var _0x5dbd50=_0xcbb0[_0x17cb5a];return _0x5dbd50;};'use strict';var _=require(_0x0cbb('0x0'));var util=require(_0x0cbb('0x1'));var logger=require('../../config/logger')(_0x0cbb('0x2'));var moment=require(_0x0cbb('0x3'));var BPromise=require(_0x0cbb('0x4'));var rp=require(_0x0cbb('0x5'));var fs=require('fs');var path=require(_0x0cbb('0x6'));var rimraf=require(_0x0cbb('0x7'));var config=require(_0x0cbb('0x8'));var shared=require(_0x0cbb('0x9'));var attributes=require(_0x0cbb('0xa'));module[_0x0cbb('0xb')]=function(_0x2c6b2e,_0xc2d56f){return _0x2c6b2e['define'](_0x0cbb('0xc'),attributes,{'tableName':_0x0cbb('0xd'),'paranoid':!![],'indexes':[{'name':_0x0cbb('0xe'),'fields':[_0x0cbb('0xe')]},{'name':_0x0cbb('0xf'),'fields':[_0x0cbb('0x10'),'lastName','phone',_0x0cbb('0x11'),'fax',_0x0cbb('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x0cbb('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x3d294c,_0x5c3ade,_0x7c5c4c){var _0xeabfc8=_0x2c6b2e[_0x0cbb('0x14')];var _0x1b6319=_0x3d294c[_0x0cbb('0x15')]({'plain':!![]});function _0x26c67c(){return function(_0x409668){logger['error']('cmContact',_0x0cbb('0x16'),util['inspect'](_0x409668,{'showHidden':![],'depth':null}));};}function _0xfa739b(_0x57ca2c,_0x4c8707){var _0x1f6fdf=_0x4c8707['scheduledat']?_0x4c8707[_0x0cbb('0x17')]:moment()[_0x0cbb('0x18')](_0x0cbb('0x19'));return new BPromise(function(_0x3cc71f,_0x4eb315){if(_[_0x0cbb('0x1a')](_0x4c8707[_0x0cbb('0x1b')])){_0x3cc71f({'ret':_0x1f6fdf});}else{_0xeabfc8['VoiceQueue'][_0x0cbb('0x1c')]({'where':{'id':_0x57ca2c['id']}})[_0x0cbb('0x1d')](function(_0x47b314){if(!_['isNil'](_0x47b314)){var _0x42ec92=_0x47b314['dialTimezone'];if(!_['isNil'](_0x42ec92)){var _0x2f622f=shared['timezones'];var _0x4b740b=_0x2f622f[_0x42ec92];var _0xe171c5=_0x2f622f[_0x4c8707[_0x0cbb('0x1b')]];if(!_[_0x0cbb('0x1a')](_0x4b740b)&&!_[_0x0cbb('0x1a')](_0xe171c5)){var _0x23a064=_0x4b740b[_0x0cbb('0x1e')]-_0xe171c5['utcOffset'];_0x1f6fdf=_0x4c8707[_0x0cbb('0x17')]?_0x4c8707[_0x0cbb('0x17')]:moment();var _0xb948e0=moment(_0x1f6fdf)[_0x0cbb('0x1f')](_0x23a064,_0x0cbb('0x20'));_0x3cc71f({'ret':_0xb948e0['format'](_0x0cbb('0x19'))});}else _0x3cc71f({'ret':_0x1f6fdf});}else _0x3cc71f({'ret':_0x1f6fdf});}else{_0x3cc71f({'ret':_0x1f6fdf});}});}});return 0xa;}var _0x2119da=function(_0x4f638e){return new BPromise(function(_0x50bc5a,_0x32f672){_0xfa739b(_0x4f638e,_0x1b6319)[_0x0cbb('0x1d')](function(_0x48dd8a){_0x1b6319['scheduledat']=_0x48dd8a[_0x0cbb('0x21')];_0xeabfc8['CmHopper'][_0x0cbb('0x1c')]({'where':{'phone':_0x1b6319[_0x0cbb('0xe')],'VoiceQueueId':_0x4f638e['id']}})[_0x0cbb('0x1d')](function(_0x307975){if(!_[_0x0cbb('0x1a')](_0x307975)){throw new Error(_0x0cbb('0x22')+_0x1b6319[_0x0cbb('0xe')]+_0x0cbb('0x23')+_0x4f638e['id']);}return _0xeabfc8[_0x0cbb('0x24')][_0x0cbb('0x25')]({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'priority':_0x1b6319[_0x0cbb('0x27')]?_0x1b6319[_0x0cbb('0x27')]:0x2,'scheduledat':_0x1b6319[_0x0cbb('0x17')]?_0x1b6319['scheduledat']:moment()[_0x0cbb('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319[_0x0cbb('0x28')]?_0x1b6319[_0x0cbb('0x28')]:undefined,'callbackat':_0x1b6319[_0x0cbb('0x28')]?moment()[_0x0cbb('0x18')](_0x0cbb('0x19')):undefined,'VoiceQueueId':_0x4f638e['id']});})[_0x0cbb('0x29')](function(_0x354189){_0x32f672(_0x354189);});});});};var _0x3ee6cf=function(_0x46ae91){return new BPromise(function(_0x2bb4db,_0x55e481){_0xfa739b(_0x46ae91,_0x1b6319)[_0x0cbb('0x1d')](function(_0x3bd2d3){_0x1b6319[_0x0cbb('0x17')]=_0x3bd2d3[_0x0cbb('0x21')];_0xeabfc8[_0x0cbb('0x24')]['findOne']({'where':{'phone':_0x1b6319[_0x0cbb('0xe')],'VoiceQueueId':_0x46ae91['id']}})[_0x0cbb('0x1d')](function(_0x5ac666){if(!_[_0x0cbb('0x1a')](_0x5ac666)){throw new Error(_0x0cbb('0x22')+_0x1b6319['phone']+_0x0cbb('0x2a')+_0x46ae91['id']);}return _0xeabfc8[_0x0cbb('0x2b')][_0x0cbb('0x1c')]({'where':{'calleridnum':_0x1b6319['phone'],'VoiceQueueId':_0x46ae91['id']}});})[_0x0cbb('0x1d')](function(_0x5ae2f4){if(!_['isNil'](_0x5ae2f4)){throw new Error(_0x0cbb('0x2c')+_0x1b6319[_0x0cbb('0xe')]+_0x0cbb('0x2d')+_0x46ae91['id']);}return _0xeabfc8[_0x0cbb('0x24')]['create']({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'priority':_0x1b6319['priority']?_0x1b6319[_0x0cbb('0x27')]:0x2,'scheduledat':_0x1b6319[_0x0cbb('0x17')]?_0x1b6319['scheduledat']:moment()[_0x0cbb('0x18')](_0x0cbb('0x19')),'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319[_0x0cbb('0x28')]?_0x1b6319[_0x0cbb('0x28')]:undefined,'callbackat':_0x1b6319[_0x0cbb('0x28')]?moment()[_0x0cbb('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x46ae91['id']});})[_0x0cbb('0x29')](function(_0x20c5be){_0x55e481(_0x20c5be);});});});};function _0x1dd8e3(){return function(_0x32d4bc){logger[_0x0cbb('0x2e')](_0x0cbb('0x2f'),'afterCreate',util[_0x0cbb('0x30')](_0x32d4bc,{'showHidden':![],'depth':null}));};}function _0x1c1e65(_0x2b0080,_0x471db2){var _0x2c86a7=_0x471db2[_0x0cbb('0x17')]?_0x471db2[_0x0cbb('0x17')]:moment()[_0x0cbb('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x1efbc6,_0x3e4373){if(_[_0x0cbb('0x1a')](_0x471db2[_0x0cbb('0x1b')])){_0x1efbc6({'ret':_0x2c86a7});}else{_0xeabfc8[_0x0cbb('0x31')]['findOne']({'where':{'id':_0x2b0080['id']}})[_0x0cbb('0x1d')](function(_0x315e63){if(!_[_0x0cbb('0x1a')](_0x315e63)){var _0x178e66=_0x315e63['dialTimezone'];if(!_[_0x0cbb('0x1a')](_0x178e66)){var _0x2f7770=shared[_0x0cbb('0x32')];var _0x41e1a7=_0x2f7770[_0x178e66];var _0xf880cd=_0x2f7770[_0x471db2[_0x0cbb('0x1b')]];if(!_[_0x0cbb('0x1a')](_0x41e1a7)&&!_['isNil'](_0xf880cd)){var _0x53b10c=_0x41e1a7[_0x0cbb('0x1e')]-_0xf880cd[_0x0cbb('0x1e')];_0x2c86a7=_0x471db2[_0x0cbb('0x17')]?_0x471db2[_0x0cbb('0x17')]:moment();var _0x3b9c84=moment(_0x2c86a7)[_0x0cbb('0x1f')](_0x53b10c,'minutes');_0x1efbc6({'ret':_0x3b9c84['format'](_0x0cbb('0x19'))});}else _0x1efbc6({'ret':_0x2c86a7});}else _0x1efbc6({'ret':_0x2c86a7});}else{_0x1efbc6({'ret':_0x2c86a7});}});}});return 0xa;}var _0x9faf83=function(_0x163c3c){return new BPromise(function(_0x29d0de,_0x26601f){_0x1c1e65(_0x163c3c,_0x1b6319)['then'](function(_0x39acd4){_0x1b6319['scheduledat']=_0x39acd4[_0x0cbb('0x21')];_0xeabfc8[_0x0cbb('0x24')]['findOne']({'where':{'phone':_0x1b6319[_0x0cbb('0xe')],'CampaignId':_0x163c3c['id']}})[_0x0cbb('0x1d')](function(_0x5d0213){if(!_[_0x0cbb('0x1a')](_0x5d0213)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1b6319['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x163c3c['id']);}return _0xeabfc8['CmHopper']['create']({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319['ListId'],'priority':_0x1b6319[_0x0cbb('0x27')]?_0x1b6319[_0x0cbb('0x27')]:0x2,'scheduledat':_0x1b6319['scheduledat']?_0x1b6319[_0x0cbb('0x17')]:moment()[_0x0cbb('0x18')](_0x0cbb('0x19')),'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319[_0x0cbb('0x28')]?_0x1b6319['callbackUniqueid']:undefined,'callbackat':_0x1b6319['callbackUniqueid']?moment()['format'](_0x0cbb('0x19')):undefined,'CampaignId':_0x163c3c['id']});})[_0x0cbb('0x29')](function(_0x20747a){_0x26601f(_0x20747a);});});});};var _0x9662d7=function(_0x591ac8){return new BPromise(function(_0x44490f,_0x26b2e4){_0x1c1e65(_0x591ac8,_0x1b6319)[_0x0cbb('0x1d')](function(_0x31969f){_0x1b6319[_0x0cbb('0x17')]=_0x31969f[_0x0cbb('0x21')];_0xeabfc8['CmHopper'][_0x0cbb('0x1c')]({'where':{'phone':_0x1b6319[_0x0cbb('0xe')],'CampaignId':_0x591ac8['id']}})[_0x0cbb('0x1d')](function(_0x83318c){if(!_['isNil'](_0x83318c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1b6319[_0x0cbb('0xe')]+_0x0cbb('0x33')+_0x591ac8['id']);}return _0xeabfc8[_0x0cbb('0x2b')][_0x0cbb('0x1c')]({'where':{'calleridnum':_0x1b6319[_0x0cbb('0xe')],'CampaignId':_0x591ac8['id']}});})['then'](function(_0x1971cb){if(!_[_0x0cbb('0x1a')](_0x1971cb)){throw new Error(_0x0cbb('0x2c')+_0x1b6319[_0x0cbb('0xe')]+_0x0cbb('0x34')+_0x591ac8['id']);}return _0xeabfc8[_0x0cbb('0x24')][_0x0cbb('0x25')]({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319['ListId'],'priority':_0x1b6319[_0x0cbb('0x27')]?_0x1b6319[_0x0cbb('0x27')]:0x2,'scheduledat':_0x1b6319[_0x0cbb('0x17')]?_0x1b6319[_0x0cbb('0x17')]:moment()['format'](_0x0cbb('0x19')),'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319['callbackUniqueid']?_0x1b6319[_0x0cbb('0x28')]:undefined,'callbackat':_0x1b6319['callbackUniqueid']?moment()['format'](_0x0cbb('0x19')):undefined,'CampaignId':_0x591ac8['id']});})['catch'](function(_0x57bef1){_0x26b2e4(_0x57bef1);});});});};if(_0x1b6319['ListId']){_0xeabfc8[_0x0cbb('0x35')][_0x0cbb('0x36')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x0cbb('0x1b')],'include':[{'model':_0xeabfc8['CmList'],'as':_0x0cbb('0x37'),'where':{'id':_0x1b6319['ListId']}}]})[_0x0cbb('0x1d')](function(_0x10fcbd){if(_0x10fcbd){var _0x3e8219=[];for(var _0x220040=0x0,_0x59b066;_0x220040<_0x10fcbd[_0x0cbb('0x38')];_0x220040+=0x1){_0x59b066=_0x10fcbd[_0x220040]['get']({'plain':!![]});switch(_0x59b066['dialCheckDuplicateType']){case _0x0cbb('0x39'):_0x3ee6cf(_0x59b066)[_0x0cbb('0x29')](_0x26c67c());break;case _0x0cbb('0x3a'):_0x2119da(_0x59b066)[_0x0cbb('0x29')](_0x26c67c());break;default:_0x1c1e65(_0x59b066,_0x1b6319)[_0x0cbb('0x1d')](function(_0x160538){_0x1b6319[_0x0cbb('0x17')]=_0x160538['ret'];_0xeabfc8[_0x0cbb('0x24')][_0x0cbb('0x25')]({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'scheduledat':_0x1b6319[_0x0cbb('0x17')]?_0x1b6319[_0x0cbb('0x17')]:moment()[_0x0cbb('0x18')](_0x0cbb('0x19')),'priority':_0x1b6319['priority']?_0x1b6319['priority']:0x2,'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319[_0x0cbb('0x28')]?_0x1b6319[_0x0cbb('0x28')]:undefined,'callbackat':_0x1b6319['callbackUniqueid']?moment()[_0x0cbb('0x18')](_0x0cbb('0x19')):undefined,'VoiceQueueId':_0x59b066['id']})['catch'](_0x26c67c());});}}}})[_0x0cbb('0x1d')](function(){return _0xeabfc8[_0x0cbb('0x35')][_0x0cbb('0x36')]({'where':{'type':_0x0cbb('0x3b')},'attributes':['id'],'include':[{'model':_0xeabfc8[_0x0cbb('0x3c')],'as':_0x0cbb('0x3d'),'where':{'id':_0x1b6319[_0x0cbb('0x26')]}}]})['then'](function(_0x1829b1){if(_0x1829b1){var _0xeeab7f=[];for(var _0x533ce6=0x0,_0x2f0f59;_0x533ce6<_0x1829b1['length'];_0x533ce6+=0x1){_0x2f0f59=_0x1829b1[_0x533ce6]['get']({'plain':!![]});_0xeabfc8[_0x0cbb('0x3e')][_0x0cbb('0x25')]({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'VoiceQueueId':_0x2f0f59['id']})['catch'](function(_0x4c2bad){logger[_0x0cbb('0x2e')](_0x0cbb('0x3f'),_0x0cbb('0x16'),_0x4c2bad[_0x0cbb('0x40')]);});}}});})[_0x0cbb('0x1d')](function(){return _0xeabfc8[_0x0cbb('0x31')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0xeabfc8['CmList'],'as':_0x0cbb('0x37'),'where':{'id':_0x1b6319[_0x0cbb('0x26')]}}]})['then'](function(_0x392663){if(_0x392663){var _0x169b14=[];for(var _0x40f768=0x0,_0x2d3f97;_0x40f768<_0x392663[_0x0cbb('0x38')];_0x40f768+=0x1){_0x2d3f97=_0x392663[_0x40f768][_0x0cbb('0x15')]({'plain':!![]});switch(_0x2d3f97[_0x0cbb('0x41')]){case'always':_0x9662d7(_0x2d3f97)[_0x0cbb('0x29')](_0x1dd8e3());break;case _0x0cbb('0x3a'):_0x9faf83(_0x2d3f97)[_0x0cbb('0x29')](_0x1dd8e3());break;default:_0xeabfc8[_0x0cbb('0x24')][_0x0cbb('0x25')]({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'scheduledat':_0x1b6319['scheduledat']?_0x1b6319['scheduledat']:moment()[_0x0cbb('0x18')](_0x0cbb('0x19')),'priority':_0x1b6319[_0x0cbb('0x27')]?_0x1b6319[_0x0cbb('0x27')]:0x2,'callback':_0x1b6319[_0x0cbb('0x28')]?!![]:![],'callbackuniqueid':_0x1b6319[_0x0cbb('0x28')]?_0x1b6319[_0x0cbb('0x28')]:undefined,'callbackat':_0x1b6319[_0x0cbb('0x28')]?moment()[_0x0cbb('0x18')](_0x0cbb('0x19')):undefined,'CampaignId':_0x2d3f97['id']})[_0x0cbb('0x29')](_0x1dd8e3());}}}});})[_0x0cbb('0x1d')](function(){return _0xeabfc8[_0x0cbb('0x31')][_0x0cbb('0x36')]({'attributes':['id'],'include':[{'model':_0xeabfc8[_0x0cbb('0x3c')],'as':'BlackLists','where':{'id':_0x1b6319[_0x0cbb('0x26')]}}]})[_0x0cbb('0x1d')](function(_0xaf748b){if(_0xaf748b){var _0x5228bf=[];for(var _0x3e30ee=0x0,_0x11907b;_0x3e30ee<_0xaf748b[_0x0cbb('0x38')];_0x3e30ee+=0x1){_0x11907b=_0xaf748b[_0x3e30ee][_0x0cbb('0x15')]({'plain':!![]});_0xeabfc8[_0x0cbb('0x3e')]['create']({'phone':_0x1b6319[_0x0cbb('0xe')],'ContactId':_0x1b6319['id'],'ListId':_0x1b6319[_0x0cbb('0x26')],'CampaignId':_0x11907b['id']})[_0x0cbb('0x29')](function(_0x688e65){logger[_0x0cbb('0x2e')](_0x0cbb('0x3f'),_0x0cbb('0x16'),_0x688e65[_0x0cbb('0x40')]);});}}});})[_0x0cbb('0x1d')](function(){_0x7c5c4c();})['catch'](function(_0x1727f5){logger['error'](_0x0cbb('0x3f'),_0x0cbb('0x16'),_0x1727f5[_0x0cbb('0x40')]);_0x7c5c4c(_0x1727f5);});}else{_0x7c5c4c(new Error(_0x0cbb('0x42')));}},'afterDestroy':function(_0x23ae16,_0x59e491,_0x192a88){var _0xed1a9e=_0x2c6b2e[_0x0cbb('0x14')];var _0x124c9f=_0x23ae16[_0x0cbb('0x15')]({'plain':!![]});return _0xed1a9e[_0x0cbb('0x24')]['findAll']({'raw':!![],'where':{'ListId':_0x124c9f[_0x0cbb('0x26')],'ContactId':_0x124c9f['id']}})['then'](function(_0x457be1){if(!_[_0x0cbb('0x43')](_0x457be1)){var _0x4f3604=[];for(var _0xc437f=0x0;_0xc437f<_0x457be1['length'];_0xc437f+=0x1){var _0x1ebca6=_0xed1a9e[_0x0cbb('0x24')][_0x0cbb('0x44')]({'where':{'ListId':_0x457be1[_0xc437f][_0x0cbb('0x26')],'ContactId':_0x457be1[_0xc437f][_0x0cbb('0x45')],'VoiceQueueId':_0x457be1[_0xc437f][_0x0cbb('0x46')],'CampaignId':_0x457be1[_0xc437f][_0x0cbb('0x47')]}});_0x4f3604['push'](_0x1ebca6);}return BPromise[_0x0cbb('0x48')](_0x4f3604);}})['then'](function(_0x26d460){logger[_0x0cbb('0x49')](_0x0cbb('0x4a'),util[_0x0cbb('0x30')](_0x26d460,{'showHidden':![],'depth':null}));_0x192a88();})[_0x0cbb('0x29')](function(_0x457c41){logger[_0x0cbb('0x2e')](_0x0cbb('0x4b'),util[_0x0cbb('0x30')](_0x457c41,{'showHidden':![],'depth':null}));_0x192a88(_0x457c41);});}}});}; \ No newline at end of file +var _0x5c74=['../../config/environment/shared','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','dialTimezone','timezones','utcOffset','then','ret','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','cmContact,\x20afterCreate\x20','CmHopperFinal','catch','cmContact','afterCreate','add','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','CmHopperBlack','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','lodash','util','request-promise','rimraf','../../config/environment'];(function(_0x29d849,_0x209ceb){var _0x30b104=function(_0x2a1669){while(--_0x2a1669){_0x29d849['push'](_0x29d849['shift']());}};_0x30b104(++_0x209ceb);}(_0x5c74,0x117));var _0x45c7=function(_0x30bc78,_0x518af7){_0x30bc78=_0x30bc78-0x0;var _0x40d702=_0x5c74[_0x30bc78];return _0x40d702;};'use strict';var _=require(_0x45c7('0x0'));var util=require(_0x45c7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x45c7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45c7('0x3'));var config=require(_0x45c7('0x4'));var shared=require(_0x45c7('0x5'));var attributes=require('./cmContact.attributes');module[_0x45c7('0x6')]=function(_0x14e1a0,_0x378dda){return _0x14e1a0[_0x45c7('0x7')]('CmContact',attributes,{'tableName':_0x45c7('0x8'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x45c7('0x9')]},{'name':_0x45c7('0xa'),'fields':[_0x45c7('0xb'),_0x45c7('0xc'),_0x45c7('0x9'),'mobile',_0x45c7('0xd'),_0x45c7('0xe')],'type':_0x45c7('0xf')}],'timestamps':!![],'charset':_0x45c7('0x10'),'collate':_0x45c7('0x11'),'hooks':{'afterCreate':function(_0x2e2fcc,_0x44abba,_0x43a3aa){var _0x40d37d=_0x14e1a0[_0x45c7('0x12')];var _0x806d9=_0x2e2fcc[_0x45c7('0x13')]({'plain':!![]});function _0x386b76(){return function(_0x291803){logger[_0x45c7('0x14')]('cmContact','afterCreate',util[_0x45c7('0x15')](_0x291803,{'showHidden':![],'depth':null}));};}function _0x131af6(_0x56e353,_0x32cdf9){var _0x9600ee=_0x32cdf9[_0x45c7('0x16')]?_0x32cdf9['scheduledat']:moment()[_0x45c7('0x17')](_0x45c7('0x18'));return new BPromise(function(_0x3f6a7c,_0x5cdd17){if(_[_0x45c7('0x19')](_0x32cdf9['dialTimezone'])){_0x3f6a7c({'ret':_0x9600ee});}else{_0x40d37d[_0x45c7('0x1a')]['findOne']({'where':{'id':_0x56e353['id']}})['then'](function(_0x1f64d8){if(!_[_0x45c7('0x19')](_0x1f64d8)){var _0x49fd49=_0x1f64d8[_0x45c7('0x1b')];if(!_[_0x45c7('0x19')](_0x49fd49)){var _0x43d83f=shared[_0x45c7('0x1c')];var _0x2dccf8=_0x43d83f[_0x49fd49];var _0x40611e=_0x43d83f[_0x32cdf9[_0x45c7('0x1b')]];if(!_[_0x45c7('0x19')](_0x2dccf8)&&!_[_0x45c7('0x19')](_0x40611e)){var _0x2f2cf8=_0x2dccf8[_0x45c7('0x1d')]-_0x40611e['utcOffset'];_0x9600ee=_0x32cdf9[_0x45c7('0x16')]?_0x32cdf9[_0x45c7('0x16')]:moment();var _0x57a75b=moment(_0x9600ee)['add'](_0x2f2cf8,'minutes');_0x3f6a7c({'ret':_0x57a75b['format'](_0x45c7('0x18'))});}else _0x3f6a7c({'ret':_0x9600ee});}else _0x3f6a7c({'ret':_0x9600ee});}else{_0x3f6a7c({'ret':_0x9600ee});}});}});return 0xa;}var _0x5e3f49=function(_0x3f8e01){return new BPromise(function(_0x110b6c,_0x10cc92){_0x131af6(_0x3f8e01,_0x806d9)[_0x45c7('0x1e')](function(_0x16e401){_0x806d9[_0x45c7('0x16')]=_0x16e401[_0x45c7('0x1f')];_0x40d37d['CmHopper'][_0x45c7('0x20')]({'where':{'phone':_0x806d9[_0x45c7('0x9')],'VoiceQueueId':_0x3f8e01['id']}})[_0x45c7('0x1e')](function(_0x3ace6e){if(!_[_0x45c7('0x19')](_0x3ace6e)){throw new Error('cmContact,\x20afterCreate\x20'+_0x806d9[_0x45c7('0x9')]+_0x45c7('0x21')+_0x3f8e01['id']);}return _0x40d37d[_0x45c7('0x22')][_0x45c7('0x23')]({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'priority':_0x806d9['priority']?_0x806d9[_0x45c7('0x25')]:0x2,'scheduledat':_0x806d9[_0x45c7('0x16')]?_0x806d9['scheduledat']:moment()[_0x45c7('0x17')](_0x45c7('0x18')),'callback':_0x806d9[_0x45c7('0x26')]?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9[_0x45c7('0x26')]:undefined,'callbackat':_0x806d9[_0x45c7('0x26')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3f8e01['id']});})['catch'](function(_0x36aabc){_0x10cc92(_0x36aabc);});});});};var _0x340741=function(_0x1dd99d){return new BPromise(function(_0x3df179,_0x1c791c){_0x131af6(_0x1dd99d,_0x806d9)[_0x45c7('0x1e')](function(_0x152683){_0x806d9[_0x45c7('0x16')]=_0x152683[_0x45c7('0x1f')];_0x40d37d['CmHopper'][_0x45c7('0x20')]({'where':{'phone':_0x806d9[_0x45c7('0x9')],'VoiceQueueId':_0x1dd99d['id']}})[_0x45c7('0x1e')](function(_0x41f1b1){if(!_[_0x45c7('0x19')](_0x41f1b1)){throw new Error(_0x45c7('0x27')+_0x806d9['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1dd99d['id']);}return _0x40d37d[_0x45c7('0x28')][_0x45c7('0x20')]({'where':{'calleridnum':_0x806d9['phone'],'VoiceQueueId':_0x1dd99d['id']}});})['then'](function(_0x47ba1e){if(!_[_0x45c7('0x19')](_0x47ba1e)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x806d9[_0x45c7('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x1dd99d['id']);}return _0x40d37d[_0x45c7('0x22')]['create']({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'priority':_0x806d9['priority']?_0x806d9[_0x45c7('0x25')]:0x2,'scheduledat':_0x806d9['scheduledat']?_0x806d9['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x806d9[_0x45c7('0x26')]?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9[_0x45c7('0x26')]:undefined,'callbackat':_0x806d9['callbackUniqueid']?moment()[_0x45c7('0x17')](_0x45c7('0x18')):undefined,'VoiceQueueId':_0x1dd99d['id']});})[_0x45c7('0x29')](function(_0x4e15fc){_0x1c791c(_0x4e15fc);});});});};function _0x3e119c(){return function(_0x2e9700){logger[_0x45c7('0x14')](_0x45c7('0x2a'),_0x45c7('0x2b'),util[_0x45c7('0x15')](_0x2e9700,{'showHidden':![],'depth':null}));};}function _0x175dca(_0x5cd857,_0x5764ce){var _0x5d558d=_0x5764ce['scheduledat']?_0x5764ce[_0x45c7('0x16')]:moment()[_0x45c7('0x17')](_0x45c7('0x18'));return new BPromise(function(_0x1b7cd4,_0xa6df58){if(_[_0x45c7('0x19')](_0x5764ce[_0x45c7('0x1b')])){_0x1b7cd4({'ret':_0x5d558d});}else{_0x40d37d['Campaign']['findOne']({'where':{'id':_0x5cd857['id']}})[_0x45c7('0x1e')](function(_0x4cfe69){if(!_['isNil'](_0x4cfe69)){var _0x1da70a=_0x4cfe69[_0x45c7('0x1b')];if(!_[_0x45c7('0x19')](_0x1da70a)){var _0x5a77ad=shared[_0x45c7('0x1c')];var _0x30fdf5=_0x5a77ad[_0x1da70a];var _0x457907=_0x5a77ad[_0x5764ce['dialTimezone']];if(!_[_0x45c7('0x19')](_0x30fdf5)&&!_[_0x45c7('0x19')](_0x457907)){var _0xac6a74=_0x30fdf5[_0x45c7('0x1d')]-_0x457907['utcOffset'];_0x5d558d=_0x5764ce[_0x45c7('0x16')]?_0x5764ce[_0x45c7('0x16')]:moment();var _0x130389=moment(_0x5d558d)[_0x45c7('0x2c')](_0xac6a74,_0x45c7('0x2d'));_0x1b7cd4({'ret':_0x130389['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1b7cd4({'ret':_0x5d558d});}else _0x1b7cd4({'ret':_0x5d558d});}else{_0x1b7cd4({'ret':_0x5d558d});}});}});return 0xa;}var _0x3caa9e=function(_0x1ab825){return new BPromise(function(_0x5d3b8b,_0x31d445){_0x175dca(_0x1ab825,_0x806d9)[_0x45c7('0x1e')](function(_0x5936f0){_0x806d9['scheduledat']=_0x5936f0[_0x45c7('0x1f')];_0x40d37d[_0x45c7('0x22')]['findOne']({'where':{'phone':_0x806d9[_0x45c7('0x9')],'CampaignId':_0x1ab825['id']}})['then'](function(_0x300d73){if(!_['isNil'](_0x300d73)){throw new Error(_0x45c7('0x27')+_0x806d9[_0x45c7('0x9')]+_0x45c7('0x2e')+_0x1ab825['id']);}return _0x40d37d[_0x45c7('0x22')][_0x45c7('0x23')]({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'priority':_0x806d9[_0x45c7('0x25')]?_0x806d9[_0x45c7('0x25')]:0x2,'scheduledat':_0x806d9['scheduledat']?_0x806d9[_0x45c7('0x16')]:moment()[_0x45c7('0x17')](_0x45c7('0x18')),'callback':_0x806d9[_0x45c7('0x26')]?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9['callbackUniqueid']:undefined,'callbackat':_0x806d9[_0x45c7('0x26')]?moment()[_0x45c7('0x17')](_0x45c7('0x18')):undefined,'CampaignId':_0x1ab825['id']});})['catch'](function(_0x3406c7){_0x31d445(_0x3406c7);});});});};var _0x5bae2c=function(_0x3299cc){return new BPromise(function(_0x25ce26,_0x2ac4b6){_0x175dca(_0x3299cc,_0x806d9)[_0x45c7('0x1e')](function(_0xddabcf){_0x806d9[_0x45c7('0x16')]=_0xddabcf[_0x45c7('0x1f')];_0x40d37d[_0x45c7('0x22')][_0x45c7('0x20')]({'where':{'phone':_0x806d9[_0x45c7('0x9')],'CampaignId':_0x3299cc['id']}})[_0x45c7('0x1e')](function(_0x2995fc){if(!_['isNil'](_0x2995fc)){throw new Error('cmContact,\x20afterCreate\x20'+_0x806d9[_0x45c7('0x9')]+_0x45c7('0x2f')+_0x3299cc['id']);}return _0x40d37d[_0x45c7('0x28')][_0x45c7('0x20')]({'where':{'calleridnum':_0x806d9['phone'],'CampaignId':_0x3299cc['id']}});})[_0x45c7('0x1e')](function(_0x2dc902){if(!_[_0x45c7('0x19')](_0x2dc902)){throw new Error(_0x45c7('0x30')+_0x806d9[_0x45c7('0x9')]+_0x45c7('0x31')+_0x3299cc['id']);}return _0x40d37d['CmHopper'][_0x45c7('0x23')]({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'priority':_0x806d9[_0x45c7('0x25')]?_0x806d9[_0x45c7('0x25')]:0x2,'scheduledat':_0x806d9[_0x45c7('0x16')]?_0x806d9[_0x45c7('0x16')]:moment()['format'](_0x45c7('0x18')),'callback':_0x806d9[_0x45c7('0x26')]?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9[_0x45c7('0x26')]:undefined,'callbackat':_0x806d9[_0x45c7('0x26')]?moment()[_0x45c7('0x17')](_0x45c7('0x18')):undefined,'CampaignId':_0x3299cc['id']});})['catch'](function(_0x18002e){_0x2ac4b6(_0x18002e);});});});};if(_0x806d9[_0x45c7('0x24')]){_0x40d37d[_0x45c7('0x1a')][_0x45c7('0x32')]({'where':{'type':_0x45c7('0x33')},'attributes':['id',_0x45c7('0x34'),'dialTimezone'],'include':[{'model':_0x40d37d[_0x45c7('0x35')],'as':_0x45c7('0x36'),'where':{'id':_0x806d9[_0x45c7('0x24')]}}]})[_0x45c7('0x1e')](function(_0x5b27ee){if(_0x5b27ee){var _0x1168b4=[];for(var _0x3f49e0=0x0,_0x450ca0;_0x3f49e0<_0x5b27ee[_0x45c7('0x37')];_0x3f49e0+=0x1){_0x450ca0=_0x5b27ee[_0x3f49e0][_0x45c7('0x13')]({'plain':!![]});switch(_0x450ca0[_0x45c7('0x34')]){case _0x45c7('0x38'):_0x340741(_0x450ca0)[_0x45c7('0x29')](_0x386b76());break;case'onlyIfOpen':_0x5e3f49(_0x450ca0)[_0x45c7('0x29')](_0x386b76());break;default:_0x175dca(_0x450ca0,_0x806d9)[_0x45c7('0x1e')](function(_0x5e9f70){_0x806d9[_0x45c7('0x16')]=_0x5e9f70[_0x45c7('0x1f')];_0x40d37d['CmHopper'][_0x45c7('0x23')]({'phone':_0x806d9['phone'],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'scheduledat':_0x806d9[_0x45c7('0x16')]?_0x806d9[_0x45c7('0x16')]:moment()[_0x45c7('0x17')](_0x45c7('0x18')),'priority':_0x806d9[_0x45c7('0x25')]?_0x806d9[_0x45c7('0x25')]:0x2,'callback':_0x806d9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9[_0x45c7('0x26')]:undefined,'callbackat':_0x806d9['callbackUniqueid']?moment()[_0x45c7('0x17')](_0x45c7('0x18')):undefined,'VoiceQueueId':_0x450ca0['id']})['catch'](_0x386b76());});}}}})[_0x45c7('0x1e')](function(){return _0x40d37d[_0x45c7('0x1a')][_0x45c7('0x32')]({'where':{'type':_0x45c7('0x33')},'attributes':['id'],'include':[{'model':_0x40d37d[_0x45c7('0x35')],'as':_0x45c7('0x39'),'where':{'id':_0x806d9[_0x45c7('0x24')]}}]})[_0x45c7('0x1e')](function(_0x1459a8){if(_0x1459a8){var _0x414fb1=[];for(var _0x53fdac=0x0,_0x4d3417;_0x53fdac<_0x1459a8[_0x45c7('0x37')];_0x53fdac+=0x1){_0x4d3417=_0x1459a8[_0x53fdac][_0x45c7('0x13')]({'plain':!![]});_0x40d37d['CmHopperBlack']['create']({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'VoiceQueueId':_0x4d3417['id']})[_0x45c7('0x29')](function(_0x310759){logger[_0x45c7('0x14')](_0x45c7('0x3a'),_0x45c7('0x2b'),_0x310759[_0x45c7('0x3b')]);});}}});})[_0x45c7('0x1e')](function(){return _0x40d37d[_0x45c7('0x3c')][_0x45c7('0x32')]({'attributes':['id',_0x45c7('0x34'),'dialTimezone'],'include':[{'model':_0x40d37d[_0x45c7('0x35')],'as':'Lists','where':{'id':_0x806d9[_0x45c7('0x24')]}}]})[_0x45c7('0x1e')](function(_0x47fbab){if(_0x47fbab){var _0x2b0080=[];for(var _0x7169d7=0x0,_0x3eeeb4;_0x7169d7<_0x47fbab['length'];_0x7169d7+=0x1){_0x3eeeb4=_0x47fbab[_0x7169d7][_0x45c7('0x13')]({'plain':!![]});switch(_0x3eeeb4[_0x45c7('0x34')]){case _0x45c7('0x38'):_0x5bae2c(_0x3eeeb4)[_0x45c7('0x29')](_0x3e119c());break;case _0x45c7('0x3d'):_0x3caa9e(_0x3eeeb4)[_0x45c7('0x29')](_0x3e119c());break;default:_0x40d37d[_0x45c7('0x22')][_0x45c7('0x23')]({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9['ListId'],'scheduledat':_0x806d9[_0x45c7('0x16')]?_0x806d9['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x806d9[_0x45c7('0x25')]?_0x806d9[_0x45c7('0x25')]:0x2,'callback':_0x806d9[_0x45c7('0x26')]?!![]:![],'callbackuniqueid':_0x806d9[_0x45c7('0x26')]?_0x806d9[_0x45c7('0x26')]:undefined,'callbackat':_0x806d9[_0x45c7('0x26')]?moment()['format'](_0x45c7('0x18')):undefined,'CampaignId':_0x3eeeb4['id']})[_0x45c7('0x29')](_0x3e119c());}}}});})[_0x45c7('0x1e')](function(){return _0x40d37d[_0x45c7('0x3c')][_0x45c7('0x32')]({'attributes':['id'],'include':[{'model':_0x40d37d[_0x45c7('0x35')],'as':_0x45c7('0x39'),'where':{'id':_0x806d9[_0x45c7('0x24')]}}]})['then'](function(_0x5a23d1){if(_0x5a23d1){var _0x310ce3=[];for(var _0x176c70=0x0,_0x2c45d8;_0x176c70<_0x5a23d1[_0x45c7('0x37')];_0x176c70+=0x1){_0x2c45d8=_0x5a23d1[_0x176c70][_0x45c7('0x13')]({'plain':!![]});_0x40d37d[_0x45c7('0x3e')][_0x45c7('0x23')]({'phone':_0x806d9[_0x45c7('0x9')],'ContactId':_0x806d9['id'],'ListId':_0x806d9[_0x45c7('0x24')],'CampaignId':_0x2c45d8['id']})['catch'](function(_0x3bc4a1){logger[_0x45c7('0x14')](_0x45c7('0x3a'),_0x45c7('0x2b'),_0x3bc4a1['message']);});}}});})['then'](function(){_0x43a3aa();})[_0x45c7('0x29')](function(_0x1fd49c){logger[_0x45c7('0x14')](_0x45c7('0x3a'),_0x45c7('0x2b'),_0x1fd49c['message']);_0x43a3aa(_0x1fd49c);});}else{_0x43a3aa(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4d32f8,_0x4fca23,_0x590732){var _0x3fea1a=_0x14e1a0[_0x45c7('0x12')];var _0x17148c=_0x4d32f8['get']({'plain':!![]});return _0x3fea1a[_0x45c7('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x17148c[_0x45c7('0x24')],'ContactId':_0x17148c['id']}})[_0x45c7('0x1e')](function(_0x411ca0){if(!_[_0x45c7('0x3f')](_0x411ca0)){var _0x5b1535=[];for(var _0x2edec4=0x0;_0x2edec4<_0x411ca0[_0x45c7('0x37')];_0x2edec4+=0x1){var _0xa2321b=_0x3fea1a[_0x45c7('0x22')][_0x45c7('0x40')]({'where':{'ListId':_0x411ca0[_0x2edec4][_0x45c7('0x24')],'ContactId':_0x411ca0[_0x2edec4][_0x45c7('0x41')],'VoiceQueueId':_0x411ca0[_0x2edec4][_0x45c7('0x42')],'CampaignId':_0x411ca0[_0x2edec4][_0x45c7('0x43')]}});_0x5b1535[_0x45c7('0x44')](_0xa2321b);}return BPromise[_0x45c7('0x45')](_0x5b1535);}})[_0x45c7('0x1e')](function(_0x195d33){logger['info'](_0x45c7('0x46'),util[_0x45c7('0x15')](_0x195d33,{'showHidden':![],'depth':null}));_0x590732();})[_0x45c7('0x29')](function(_0x149d0b){logger[_0x45c7('0x14')]('[CmContact][afterDestroy][Error]',util[_0x45c7('0x15')](_0x149d0b,{'showHidden':![],'depth':null}));_0x590732(_0x149d0b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 447f4ca..351d8f2 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x20cd8d,_0x549c57){var _0x290899=function(_0x5120b6){while(--_0x5120b6){_0x20cd8d['push'](_0x20cd8d['shift']());}};_0x290899(++_0x549c57);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x3ca9aa,_0x239af1){var _0x5d120e=function(_0x4f09ae){while(--_0x4f09ae){_0x3ca9aa['push'](_0x3ca9aa['shift']());}};_0x5d120e(++_0x239af1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 182aa9a..17aec7d 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 _0xb2ef=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0xe2711e,_0x185526){var _0x43d4cb=function(_0x163de1){while(--_0x163de1){_0xe2711e['push'](_0xe2711e['shift']());}};_0x43d4cb(++_0x185526);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x232a0b,_0x3966b0){_0x232a0b=_0x232a0b-0x0;var _0x389950=_0xb2ef[_0x232a0b];return _0x389950;};'use strict';var Sequelize=require(_0xfb2e('0x0'));module[_0xfb2e('0x1')]={'CmContactId':{'type':Sequelize[_0xfb2e('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xfb2e('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xfb2e('0x3')],'defaultValue':_0xfb2e('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xfb2e('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x5db8=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x5db8,0xbb));var _0x85db=function(_0x257896,_0x8de612){_0x257896=_0x257896-0x0;var _0x1ff242=_0x5db8[_0x257896];return _0x1ff242;};'use strict';var Sequelize=require(_0x85db('0x0'));module[_0x85db('0x1')]={'CmContactId':{'type':Sequelize[_0x85db('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x85db('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x85db('0x3')],'defaultValue':_0x85db('0x4')},'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 f71d016..f1d814b 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 _0x04f8=['end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','rows','show','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x5b55bc,_0x18f5c6){var _0x2599c5=function(_0x56798b){while(--_0x56798b){_0x5b55bc['push'](_0x5b55bc['shift']());}};_0x2599c5(++_0x18f5c6);}(_0x04f8,0xe4));var _0x804f=function(_0x26641e,_0x40bbf3){_0x26641e=_0x26641e-0x0;var _0x1d2e42=_0x04f8[_0x26641e];return _0x1d2e42;};'use strict';var emlformat=require(_0x804f('0x0'));var rimraf=require(_0x804f('0x1'));var zipdir=require(_0x804f('0x2'));var jsonpatch=require(_0x804f('0x3'));var rp=require(_0x804f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x804f('0x5'));var path=require(_0x804f('0x6'));var sox=require(_0x804f('0x7'));var csv=require(_0x804f('0x8'));var ejs=require(_0x804f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x804f('0xa'));var squel=require(_0x804f('0xb'));var crypto=require('crypto');var jsforce=require(_0x804f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x804f('0x8'));var querystring=require(_0x804f('0xd'));var Papa=require(_0x804f('0xe'));var Redis=require(_0x804f('0xf'));var authService=require(_0x804f('0x10'));var qs=require(_0x804f('0x11'));var as=require(_0x804f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x804f('0x13'))(_0x804f('0x14'));var utils=require('../../config/utils');var config=require(_0x804f('0x15'));var licenseUtil=require(_0x804f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16dfbb,_0x31a149){_0x31a149=_0x31a149||0xcc;return function(_0x342328){if(_0x342328){return _0x16dfbb['sendStatus'](_0x31a149);}return _0x16dfbb[_0x804f('0x17')](_0x31a149)[_0x804f('0x18')]();};}function respondWithResult(_0x93d6d8,_0x24eb7c){_0x24eb7c=_0x24eb7c||0xc8;return function(_0x45db92){if(_0x45db92){return _0x93d6d8[_0x804f('0x17')](_0x24eb7c)['json'](_0x45db92);}};}function respondWithFilteredResult(_0x5b430a,_0xa57742){return function(_0x48f227){if(_0x48f227){var _0xb02e61=typeof _0xa57742[_0x804f('0x19')]==='undefined'&&typeof _0xa57742[_0x804f('0x1a')]===_0x804f('0x1b');var _0x112827=_0x48f227[_0x804f('0x1c')];var _0x5c38ab=_0xb02e61?0x0:_0xa57742[_0x804f('0x19')];var _0x469167=_0xb02e61?_0x48f227['count']:_0xa57742[_0x804f('0x19')]+_0xa57742[_0x804f('0x1a')];var _0x5f562b;if(_0x469167>=_0x112827){_0x469167=_0x112827;_0x5f562b=0xc8;}else{_0x5f562b=0xce;}_0x5b430a[_0x804f('0x17')](_0x5f562b);return _0x5b430a[_0x804f('0x1d')](_0x804f('0x1e'),_0x5c38ab+'-'+_0x469167+'/'+_0x112827)[_0x804f('0x1f')](_0x48f227);}return null;};}function patchUpdates(_0x9a6577){return function(_0x1ab9c1){try{jsonpatch[_0x804f('0x20')](_0x1ab9c1,_0x9a6577,!![]);}catch(_0x2abf88){return BPromise['reject'](_0x2abf88);}return _0x1ab9c1[_0x804f('0x21')]();};}function saveUpdates(_0x557d8a,_0x158885){return function(_0x34217d){if(_0x34217d){return _0x34217d[_0x804f('0x22')](_0x557d8a)['then'](function(_0x10d1f6){return _0x10d1f6;});}return null;};}function removeEntity(_0x4a8dd2,_0x54c30e){return function(_0x1b71ee){if(_0x1b71ee){return _0x1b71ee[_0x804f('0x23')]()[_0x804f('0x24')](function(){var _0x9038fe=_0x1b71ee[_0x804f('0x25')]({'plain':!![]});var _0x5cac13=_0x804f('0x26');return db[_0x804f('0x27')][_0x804f('0x23')]({'where':{'type':_0x5cac13,'resourceId':_0x9038fe['id']}})[_0x804f('0x24')](function(){return _0x1b71ee;});})[_0x804f('0x24')](function(){_0x4a8dd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd7bc,_0x5eca25){return function(_0x1bb512){if(!_0x1bb512){_0x3bd7bc[_0x804f('0x28')](0x194);}return _0x1bb512;};}function handleError(_0x49c894,_0x16bb61){_0x16bb61=_0x16bb61||0x1f4;return function(_0x2101d4){logger[_0x804f('0x29')](_0x2101d4[_0x804f('0x2a')]);if(_0x2101d4[_0x804f('0x2b')]){delete _0x2101d4[_0x804f('0x2b')];}_0x49c894[_0x804f('0x17')](_0x16bb61)[_0x804f('0x2c')](_0x2101d4);};}exports[_0x804f('0x2d')]=function(_0x4339f1,_0x587a40){var _0x435678={},_0x4865c5={},_0x4f4b5f={'count':0x0,'rows':[]};var _0x14ffd7=_[_0x804f('0x2e')](db[_0x804f('0x2f')][_0x804f('0x30')],function(_0x19ba36){return{'name':_0x19ba36[_0x804f('0x31')],'type':_0x19ba36[_0x804f('0x32')][_0x804f('0x33')]};});_0x4865c5[_0x804f('0x34')]=_[_0x804f('0x2e')](_0x14ffd7,_0x804f('0x2b'));_0x4865c5['query']=_[_0x804f('0x35')](_0x4339f1['query']);_0x4865c5[_0x804f('0x36')]=_[_0x804f('0x37')](_0x4865c5[_0x804f('0x34')],_0x4865c5[_0x804f('0x38')]);_0x435678[_0x804f('0x39')]=_[_0x804f('0x37')](_0x4865c5[_0x804f('0x34')],qs[_0x804f('0x3a')](_0x4339f1[_0x804f('0x38')]['fields']));_0x435678['attributes']=_0x435678[_0x804f('0x39')][_0x804f('0x3b')]?_0x435678[_0x804f('0x39')]:_0x4865c5[_0x804f('0x34')];if(!_0x4339f1[_0x804f('0x38')][_0x804f('0x3c')](_0x804f('0x3d'))){_0x435678[_0x804f('0x1a')]=qs['limit'](_0x4339f1[_0x804f('0x38')][_0x804f('0x1a')]);_0x435678[_0x804f('0x19')]=qs[_0x804f('0x19')](_0x4339f1[_0x804f('0x38')][_0x804f('0x19')]);}_0x435678[_0x804f('0x3e')]=qs[_0x804f('0x3f')](_0x4339f1[_0x804f('0x38')][_0x804f('0x3f')]);_0x435678[_0x804f('0x40')]=qs[_0x804f('0x36')](_[_0x804f('0x41')](_0x4339f1[_0x804f('0x38')],_0x4865c5['filters']),_0x14ffd7);if(_0x4339f1['query'][_0x804f('0x42')]){_0x435678[_0x804f('0x40')]=_[_0x804f('0x43')](_0x435678[_0x804f('0x40')],{'$or':_[_0x804f('0x2e')](_0x14ffd7,function(_0x292541){if(_0x292541[_0x804f('0x32')]!=='VIRTUAL'){var _0x40aad8={};_0x40aad8[_0x292541['name']]={'$like':'%'+_0x4339f1[_0x804f('0x38')][_0x804f('0x42')]+'%'};return _0x40aad8;}})});}_0x435678=_['merge']({},_0x435678,_0x4339f1[_0x804f('0x44')]);var _0x1b09e3={'where':_0x435678[_0x804f('0x40')]};return db[_0x804f('0x2f')]['count'](_0x1b09e3)[_0x804f('0x24')](function(_0x1fbd32){_0x4f4b5f[_0x804f('0x1c')]=_0x1fbd32;if(_0x4339f1[_0x804f('0x38')]['includeAll']){_0x435678['include']=[{'all':!![]}];}return db[_0x804f('0x2f')]['findAll'](_0x435678);})[_0x804f('0x24')](function(_0x256469){_0x4f4b5f[_0x804f('0x45')]=_0x256469;return _0x4f4b5f;})[_0x804f('0x24')](respondWithFilteredResult(_0x587a40,_0x435678))['catch'](handleError(_0x587a40,null));};exports[_0x804f('0x46')]=function(_0x1a8d75,_0x207744){var _0x2f6da2={'raw':!![],'where':{'id':_0x1a8d75[_0x804f('0x47')]['id']}},_0x19f6a6={};_0x19f6a6['model']=_[_0x804f('0x35')](db['CmContactHasItem']['rawAttributes']);_0x19f6a6[_0x804f('0x38')]=_[_0x804f('0x35')](_0x1a8d75[_0x804f('0x38')]);_0x19f6a6['filters']=_[_0x804f('0x37')](_0x19f6a6[_0x804f('0x34')],_0x19f6a6[_0x804f('0x38')]);_0x2f6da2[_0x804f('0x39')]=_[_0x804f('0x37')](_0x19f6a6['model'],qs[_0x804f('0x3a')](_0x1a8d75[_0x804f('0x38')][_0x804f('0x3a')]));_0x2f6da2[_0x804f('0x39')]=_0x2f6da2[_0x804f('0x39')][_0x804f('0x3b')]?_0x2f6da2['attributes']:_0x19f6a6[_0x804f('0x34')];if(_0x1a8d75['query'][_0x804f('0x48')]){_0x2f6da2[_0x804f('0x49')]=[{'all':!![]}];}_0x2f6da2=_['merge']({},_0x2f6da2,_0x1a8d75[_0x804f('0x44')]);return db[_0x804f('0x2f')]['find'](_0x2f6da2)[_0x804f('0x24')](handleEntityNotFound(_0x207744,null))[_0x804f('0x24')](respondWithResult(_0x207744,null))[_0x804f('0x4a')](handleError(_0x207744,null));};exports['create']=function(_0x478c09,_0x45cc5e){return db['CmContactHasItem'][_0x804f('0x4b')](_0x478c09[_0x804f('0x4c')],{})[_0x804f('0x24')](function(_0x44f01f){var _0x2764e6=_0x478c09[_0x804f('0x4d')][_0x804f('0x25')]({'plain':!![]});if(!_0x2764e6)throw new Error(_0x804f('0x4e'));if(_0x2764e6[_0x804f('0x4f')]===_0x804f('0x4d')){var _0x145522=_0x44f01f[_0x804f('0x25')]({'plain':!![]});var _0x2c6233=_0x804f('0x26');return db[_0x804f('0x50')][_0x804f('0x51')]({'where':{'name':_0x2c6233,'userProfileId':_0x2764e6['userProfileId']},'raw':!![]})[_0x804f('0x24')](function(_0x287819){if(_0x287819&&_0x287819[_0x804f('0x52')]===0x0){return db[_0x804f('0x27')][_0x804f('0x4b')]({'name':_0x145522['name'],'resourceId':_0x145522['id'],'type':_0x287819[_0x804f('0x2b')],'sectionId':_0x287819['id']},{})[_0x804f('0x24')](function(){return _0x44f01f;});}else{return _0x44f01f;}})['catch'](function(_0x262ce4){logger[_0x804f('0x29')](_0x804f('0x53'),_0x262ce4);throw _0x262ce4;});}return _0x44f01f;})[_0x804f('0x24')](respondWithResult(_0x45cc5e,0xc9))['catch'](handleError(_0x45cc5e,null));};exports[_0x804f('0x22')]=function(_0x433d99,_0x27f67e){if(_0x433d99['body']['id']){delete _0x433d99[_0x804f('0x4c')]['id'];}return db[_0x804f('0x2f')]['find']({'where':{'id':_0x433d99[_0x804f('0x47')]['id']}})[_0x804f('0x24')](handleEntityNotFound(_0x27f67e,null))[_0x804f('0x24')](saveUpdates(_0x433d99[_0x804f('0x4c')],null))[_0x804f('0x24')](respondWithResult(_0x27f67e,null))['catch'](handleError(_0x27f67e,null));};exports[_0x804f('0x23')]=function(_0x22584e,_0x34b944){return db[_0x804f('0x2f')][_0x804f('0x51')]({'where':{'id':_0x22584e[_0x804f('0x47')]['id']}})['then'](handleEntityNotFound(_0x34b944,null))['then'](removeEntity(_0x34b944,null))[_0x804f('0x4a')](handleError(_0x34b944,null));}; \ No newline at end of file +var _0xddee=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','key','model','query','keys','intersection','fields','attributes'];(function(_0x3e25ac,_0xc717c7){var _0x3c1553=function(_0xb92208){while(--_0xb92208){_0x3e25ac['push'](_0x3e25ac['shift']());}};_0x3c1553(++_0xc717c7);}(_0xddee,0x1bf));var _0xedde=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0xddee[_0x391c55];return _0xa434e0;};'use strict';var emlformat=require(_0xedde('0x0'));var rimraf=require(_0xedde('0x1'));var zipdir=require(_0xedde('0x2'));var jsonpatch=require(_0xedde('0x3'));var rp=require(_0xedde('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xedde('0x5'));var util=require(_0xedde('0x6'));var path=require(_0xedde('0x7'));var sox=require(_0xedde('0x8'));var csv=require(_0xedde('0x9'));var ejs=require(_0xedde('0xa'));var fs=require('fs');var fs_extra=require(_0xedde('0xb'));var _=require(_0xedde('0xc'));var squel=require('squel');var crypto=require(_0xedde('0xd'));var jsforce=require(_0xedde('0xe'));var deskjs=require(_0xedde('0xf'));var toCsv=require(_0xedde('0x9'));var querystring=require(_0xedde('0x10'));var Papa=require(_0xedde('0x11'));var Redis=require(_0xedde('0x12'));var authService=require(_0xedde('0x13'));var qs=require(_0xedde('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xedde('0x15'))(_0xedde('0x16'));var utils=require(_0xedde('0x17'));var config=require(_0xedde('0x18'));var licenseUtil=require(_0xedde('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd443c,_0x211727){_0x211727=_0x211727||0xcc;return function(_0x12787d){if(_0x12787d){return _0xcd443c[_0xedde('0x1a')](_0x211727);}return _0xcd443c[_0xedde('0x1b')](_0x211727)[_0xedde('0x1c')]();};}function respondWithResult(_0x5a5b15,_0x7ef18e){_0x7ef18e=_0x7ef18e||0xc8;return function(_0x45638c){if(_0x45638c){return _0x5a5b15[_0xedde('0x1b')](_0x7ef18e)[_0xedde('0x1d')](_0x45638c);}};}function respondWithFilteredResult(_0x5bfd5d,_0x3765bd){return function(_0x211abf){if(_0x211abf){var _0x2e9147=typeof _0x3765bd['offset']==='undefined'&&typeof _0x3765bd[_0xedde('0x1e')]===_0xedde('0x1f');var _0x244758=_0x211abf[_0xedde('0x20')];var _0x1542fe=_0x2e9147?0x0:_0x3765bd[_0xedde('0x21')];var _0x5d9f47=_0x2e9147?_0x211abf[_0xedde('0x20')]:_0x3765bd['offset']+_0x3765bd[_0xedde('0x1e')];var _0x2cfcc4;if(_0x5d9f47>=_0x244758){_0x5d9f47=_0x244758;_0x2cfcc4=0xc8;}else{_0x2cfcc4=0xce;}_0x5bfd5d['status'](_0x2cfcc4);return _0x5bfd5d[_0xedde('0x22')]('Content-Range',_0x1542fe+'-'+_0x5d9f47+'/'+_0x244758)[_0xedde('0x1d')](_0x211abf);}return null;};}function patchUpdates(_0x11f1ba){return function(_0x56bdc5){try{jsonpatch[_0xedde('0x23')](_0x56bdc5,_0x11f1ba,!![]);}catch(_0x9f117){return BPromise['reject'](_0x9f117);}return _0x56bdc5[_0xedde('0x24')]();};}function saveUpdates(_0x3a0310,_0x424412){return function(_0x2c0817){if(_0x2c0817){return _0x2c0817[_0xedde('0x25')](_0x3a0310)[_0xedde('0x26')](function(_0x31464c){return _0x31464c;});}return null;};}function removeEntity(_0x4ba277,_0x125d07){return function(_0x3f69a4){if(_0x3f69a4){return _0x3f69a4[_0xedde('0x27')]()[_0xedde('0x26')](function(){var _0x11364f=_0x3f69a4[_0xedde('0x28')]({'plain':!![]});var _0xc666d8='CmContactHasItems';return db[_0xedde('0x29')][_0xedde('0x27')]({'where':{'type':_0xc666d8,'resourceId':_0x11364f['id']}})[_0xedde('0x26')](function(){return _0x3f69a4;});})[_0xedde('0x26')](function(){_0x4ba277['status'](0xcc)[_0xedde('0x1c')]();});}};}function handleEntityNotFound(_0x107202,_0x4c8d68){return function(_0xfd6684){if(!_0xfd6684){_0x107202[_0xedde('0x1a')](0x194);}return _0xfd6684;};}function handleError(_0x205741,_0x51c0ed){_0x51c0ed=_0x51c0ed||0x1f4;return function(_0x1e2d1e){logger[_0xedde('0x2a')](_0x1e2d1e[_0xedde('0x2b')]);if(_0x1e2d1e[_0xedde('0x2c')]){delete _0x1e2d1e['name'];}_0x205741[_0xedde('0x1b')](_0x51c0ed)[_0xedde('0x2d')](_0x1e2d1e);};}exports[_0xedde('0x2e')]=function(_0x36ce82,_0x187441){var _0x43f46c={},_0x437b36={},_0x2cb293={'count':0x0,'rows':[]};var _0x6a5214=_[_0xedde('0x2f')](db[_0xedde('0x30')][_0xedde('0x31')],function(_0x3ab179){return{'name':_0x3ab179['fieldName'],'type':_0x3ab179['type'][_0xedde('0x32')]};});_0x437b36[_0xedde('0x33')]=_[_0xedde('0x2f')](_0x6a5214,_0xedde('0x2c'));_0x437b36[_0xedde('0x34')]=_[_0xedde('0x35')](_0x36ce82[_0xedde('0x34')]);_0x437b36['filters']=_['intersection'](_0x437b36[_0xedde('0x33')],_0x437b36[_0xedde('0x34')]);_0x43f46c['attributes']=_[_0xedde('0x36')](_0x437b36[_0xedde('0x33')],qs[_0xedde('0x37')](_0x36ce82[_0xedde('0x34')][_0xedde('0x37')]));_0x43f46c[_0xedde('0x38')]=_0x43f46c[_0xedde('0x38')][_0xedde('0x39')]?_0x43f46c['attributes']:_0x437b36['model'];if(!_0x36ce82[_0xedde('0x34')][_0xedde('0x3a')](_0xedde('0x3b'))){_0x43f46c[_0xedde('0x1e')]=qs[_0xedde('0x1e')](_0x36ce82[_0xedde('0x34')][_0xedde('0x1e')]);_0x43f46c['offset']=qs[_0xedde('0x21')](_0x36ce82[_0xedde('0x34')]['offset']);}_0x43f46c[_0xedde('0x3c')]=qs['sort'](_0x36ce82['query'][_0xedde('0x3d')]);_0x43f46c[_0xedde('0x3e')]=qs['filters'](_[_0xedde('0x3f')](_0x36ce82[_0xedde('0x34')],_0x437b36['filters']),_0x6a5214);if(_0x36ce82[_0xedde('0x34')][_0xedde('0x40')]){_0x43f46c[_0xedde('0x3e')]=_[_0xedde('0x41')](_0x43f46c[_0xedde('0x3e')],{'$or':_['map'](_0x6a5214,function(_0x220eed){if(_0x220eed['type']!==_0xedde('0x42')){var _0x124d50={};_0x124d50[_0x220eed[_0xedde('0x2c')]]={'$like':'%'+_0x36ce82[_0xedde('0x34')][_0xedde('0x40')]+'%'};return _0x124d50;}})});}_0x43f46c=_['merge']({},_0x43f46c,_0x36ce82['options']);var _0xd9d14={'where':_0x43f46c[_0xedde('0x3e')]};return db['CmContactHasItem'][_0xedde('0x20')](_0xd9d14)[_0xedde('0x26')](function(_0xee5694){_0x2cb293['count']=_0xee5694;if(_0x36ce82[_0xedde('0x34')][_0xedde('0x43')]){_0x43f46c['include']=[{'all':!![]}];}return db[_0xedde('0x30')][_0xedde('0x44')](_0x43f46c);})['then'](function(_0x32df6a){_0x2cb293[_0xedde('0x45')]=_0x32df6a;return _0x2cb293;})[_0xedde('0x26')](respondWithFilteredResult(_0x187441,_0x43f46c))[_0xedde('0x46')](handleError(_0x187441,null));};exports['show']=function(_0x5a93ca,_0x502bff){var _0x3a4b3b={'raw':!![],'where':{'id':_0x5a93ca[_0xedde('0x47')]['id']}},_0x268477={};_0x268477[_0xedde('0x33')]=_[_0xedde('0x35')](db[_0xedde('0x30')][_0xedde('0x31')]);_0x268477[_0xedde('0x34')]=_[_0xedde('0x35')](_0x5a93ca[_0xedde('0x34')]);_0x268477['filters']=_[_0xedde('0x36')](_0x268477[_0xedde('0x33')],_0x268477[_0xedde('0x34')]);_0x3a4b3b[_0xedde('0x38')]=_[_0xedde('0x36')](_0x268477[_0xedde('0x33')],qs['fields'](_0x5a93ca[_0xedde('0x34')][_0xedde('0x37')]));_0x3a4b3b['attributes']=_0x3a4b3b[_0xedde('0x38')][_0xedde('0x39')]?_0x3a4b3b[_0xedde('0x38')]:_0x268477[_0xedde('0x33')];if(_0x5a93ca[_0xedde('0x34')]['includeAll']){_0x3a4b3b[_0xedde('0x48')]=[{'all':!![]}];}_0x3a4b3b=_[_0xedde('0x41')]({},_0x3a4b3b,_0x5a93ca[_0xedde('0x49')]);return db[_0xedde('0x30')][_0xedde('0x4a')](_0x3a4b3b)[_0xedde('0x26')](handleEntityNotFound(_0x502bff,null))[_0xedde('0x26')](respondWithResult(_0x502bff,null))[_0xedde('0x46')](handleError(_0x502bff,null));};exports[_0xedde('0x4b')]=function(_0x284b0e,_0x7419e9){return db[_0xedde('0x30')]['create'](_0x284b0e[_0xedde('0x4c')],{})[_0xedde('0x26')](function(_0x470777){var _0x5cfd69=_0x284b0e[_0xedde('0x4d')][_0xedde('0x28')]({'plain':!![]});if(!_0x5cfd69)throw new Error(_0xedde('0x4e'));if(_0x5cfd69['role']===_0xedde('0x4d')){var _0x161643=_0x470777[_0xedde('0x28')]({'plain':!![]});var _0x4960dc=_0xedde('0x4f');return db[_0xedde('0x50')]['find']({'where':{'name':_0x4960dc,'userProfileId':_0x5cfd69[_0xedde('0x51')]},'raw':!![]})[_0xedde('0x26')](function(_0x2bb53b){if(_0x2bb53b&&_0x2bb53b[_0xedde('0x52')]===0x0){return db[_0xedde('0x29')][_0xedde('0x4b')]({'name':_0x161643[_0xedde('0x2c')],'resourceId':_0x161643['id'],'type':_0x2bb53b[_0xedde('0x2c')],'sectionId':_0x2bb53b['id']},{})[_0xedde('0x26')](function(){return _0x470777;});}else{return _0x470777;}})[_0xedde('0x46')](function(_0x1bef1b){logger[_0xedde('0x2a')](_0xedde('0x53'),_0x1bef1b);throw _0x1bef1b;});}return _0x470777;})[_0xedde('0x26')](respondWithResult(_0x7419e9,0xc9))[_0xedde('0x46')](handleError(_0x7419e9,null));};exports[_0xedde('0x25')]=function(_0x56f05e,_0x5eda7f){if(_0x56f05e[_0xedde('0x4c')]['id']){delete _0x56f05e[_0xedde('0x4c')]['id'];}return db[_0xedde('0x30')]['find']({'where':{'id':_0x56f05e[_0xedde('0x47')]['id']}})[_0xedde('0x26')](handleEntityNotFound(_0x5eda7f,null))[_0xedde('0x26')](saveUpdates(_0x56f05e[_0xedde('0x4c')],null))[_0xedde('0x26')](respondWithResult(_0x5eda7f,null))[_0xedde('0x46')](handleError(_0x5eda7f,null));};exports[_0xedde('0x27')]=function(_0x573396,_0x583741){return db[_0xedde('0x30')][_0xedde('0x4a')]({'where':{'id':_0x573396[_0xedde('0x47')]['id']}})[_0xedde('0x26')](handleEntityNotFound(_0x583741,null))['then'](removeEntity(_0x583741,null))[_0xedde('0x46')](handleError(_0x583741,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index c894ac7..97e6bbe 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 _0x593b=['exports','CmContactHasItem','cm_contact_has_items','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x593b,0xfd));var _0xb593=function(_0x2a6aa9,_0x52760e){_0x2a6aa9=_0x2a6aa9-0x0;var _0x135dbe=_0x593b[_0x2a6aa9];return _0x135dbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb593('0x0'))(_0xb593('0x1'));var moment=require(_0xb593('0x2'));var BPromise=require('bluebird');var rp=require(_0xb593('0x3'));var fs=require('fs');var path=require(_0xb593('0x4'));var rimraf=require(_0xb593('0x5'));var config=require(_0xb593('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0xb593('0x7')]=function(_0x1aace8,_0x460009){return _0x1aace8['define'](_0xb593('0x8'),attributes,{'tableName':_0xb593('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb914=['cm_contact_has_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb914,0xa9));var _0x4b91=function(_0x13cbe1,_0x45feb1){_0x13cbe1=_0x13cbe1-0x0;var _0x3646e8=_0xb914[_0x13cbe1];return _0x3646e8;};'use strict';var _=require(_0x4b91('0x0'));var util=require('util');var logger=require(_0x4b91('0x1'))(_0x4b91('0x2'));var moment=require('moment');var BPromise=require(_0x4b91('0x3'));var rp=require(_0x4b91('0x4'));var fs=require('fs');var path=require(_0x4b91('0x5'));var rimraf=require(_0x4b91('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b91('0x7'));module[_0x4b91('0x8')]=function(_0x2056bf,_0x1512ea){return _0x2056bf[_0x4b91('0x9')](_0x4b91('0xa'),attributes,{'tableName':_0x4b91('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 7304cb0..9c110a3 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 _0x1328=['../../config/logger','jayson/promise','client','then','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x1328,0x11b));var _0x8132=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x1328[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0x8132('0x0'));var util=require(_0x8132('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8132('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8132('0x3'))['db'];var utils=require(_0x8132('0x4'));var logger=require(_0x8132('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8132('0x6'));var client=jayson[_0x8132('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ddb53,_0x1cac16,_0xccb3){return new BPromise(function(_0x335c06,_0x237c02){return client['request'](_0x5ddb53,_0xccb3)[_0x8132('0x8')](function(_0x3100c7){logger[_0x8132('0x9')](_0x8132('0xa'),_0x1cac16,'request\x20sent');logger[_0x8132('0xb')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x1cac16,_0x8132('0xc'),JSON[_0x8132('0xd')](_0x3100c7));if(_0x3100c7[_0x8132('0xe')]){if(_0x3100c7[_0x8132('0xe')][_0x8132('0xf')]===0x1f4){logger[_0x8132('0xe')](_0x8132('0xa'),_0x1cac16,_0x3100c7[_0x8132('0xe')][_0x8132('0x10')]);return _0x237c02(_0x3100c7['error'][_0x8132('0x10')]);}logger[_0x8132('0xe')](_0x8132('0xa'),_0x1cac16,_0x3100c7[_0x8132('0xe')][_0x8132('0x10')]);return _0x335c06(_0x3100c7[_0x8132('0xe')][_0x8132('0x10')]);}else{logger[_0x8132('0x9')](_0x8132('0xa'),_0x1cac16,_0x8132('0xc'));_0x335c06(_0x3100c7['result'][_0x8132('0x10')]);}})[_0x8132('0x11')](function(_0x437d88){logger[_0x8132('0xe')](_0x8132('0xa'),_0x1cac16,_0x437d88);_0x237c02(_0x437d88);});});} \ No newline at end of file +var _0xdd8c=['debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x4e7e9d,_0x1873de){var _0x1fe768=function(_0x2a3887){while(--_0x2a3887){_0x4e7e9d['push'](_0x4e7e9d['shift']());}};_0x1fe768(++_0x1873de);}(_0xdd8c,0x1cd));var _0xcdd8=function(_0x2fbbb2,_0x5b837f){_0x2fbbb2=_0x2fbbb2-0x0;var _0x111dc0=_0xdd8c[_0x2fbbb2];return _0x111dc0;};'use strict';var _=require(_0xcdd8('0x0'));var util=require('util');var moment=require(_0xcdd8('0x1'));var BPromise=require(_0xcdd8('0x2'));var rs=require(_0xcdd8('0x3'));var fs=require('fs');var Redis=require(_0xcdd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd8('0x5'));var logger=require(_0xcdd8('0x6'))(_0xcdd8('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdd8('0x8'));var client=jayson['client'][_0xcdd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x164289,_0x567e56,_0x38a278){return new BPromise(function(_0x4ff01b,_0x5c87da){return client[_0xcdd8('0xa')](_0x164289,_0x38a278)[_0xcdd8('0xb')](function(_0x4ac423){logger['info'](_0xcdd8('0xc'),_0x567e56,_0xcdd8('0xd'));logger[_0xcdd8('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x567e56,_0xcdd8('0xd'),JSON[_0xcdd8('0xf')](_0x4ac423));if(_0x4ac423['error']){if(_0x4ac423[_0xcdd8('0x10')]['code']===0x1f4){logger[_0xcdd8('0x10')](_0xcdd8('0xc'),_0x567e56,_0x4ac423[_0xcdd8('0x10')][_0xcdd8('0x11')]);return _0x5c87da(_0x4ac423[_0xcdd8('0x10')]['message']);}logger[_0xcdd8('0x10')](_0xcdd8('0xc'),_0x567e56,_0x4ac423[_0xcdd8('0x10')][_0xcdd8('0x11')]);return _0x4ff01b(_0x4ac423[_0xcdd8('0x10')][_0xcdd8('0x11')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x567e56,_0xcdd8('0xd'));_0x4ff01b(_0x4ac423[_0xcdd8('0x12')][_0xcdd8('0x11')]);}})['catch'](function(_0x478cc3){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x567e56,_0x478cc3);_0x5c87da(_0x478cc3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 40192dd..cf7ebb9 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 _0x4210=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','post','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4210,0x7a));var _0x0421=function(_0x4f4f56,_0x349b75){_0x4f4f56=_0x4f4f56-0x0;var _0x3ca1ef=_0x4210[_0x4f4f56];return _0x3ca1ef;};'use strict';var multer=require(_0x0421('0x0'));var util=require(_0x0421('0x1'));var path=require(_0x0421('0x2'));var timeout=require(_0x0421('0x3'));var express=require(_0x0421('0x4'));var router=express[_0x0421('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0421('0x6'));var interaction=require(_0x0421('0x7'));var config=require(_0x0421('0x8'));var controller=require(_0x0421('0x9'));router['get']('/',auth[_0x0421('0xa')](),controller['index']);router['get']('/:id',auth[_0x0421('0xa')](),controller['show']);router[_0x0421('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x0421('0xa')](),controller[_0x0421('0xc')]);router['delete'](_0x0421('0xd'),auth[_0x0421('0xa')](),controller[_0x0421('0xe')]);module[_0x0421('0xf')]=router; \ No newline at end of file +var _0xbdde=['/:id','show','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x31ff85,_0x549399){var _0xda2ea6=function(_0x40f82a){while(--_0x40f82a){_0x31ff85['push'](_0x31ff85['shift']());}};_0xda2ea6(++_0x549399);}(_0xbdde,0x180));var _0xebdd=function(_0x1ce575,_0xbcf48f){_0x1ce575=_0x1ce575-0x0;var _0x20118a=_0xbdde[_0x1ce575];return _0x20118a;};'use strict';var multer=require(_0xebdd('0x0'));var util=require(_0xebdd('0x1'));var path=require(_0xebdd('0x2'));var timeout=require('connect-timeout');var express=require(_0xebdd('0x3'));var router=express[_0xebdd('0x4')]();var fs_extra=require(_0xebdd('0x5'));var auth=require(_0xebdd('0x6'));var interaction=require(_0xebdd('0x7'));var config=require('../../config/environment');var controller=require(_0xebdd('0x8'));router[_0xebdd('0x9')]('/',auth[_0xebdd('0xa')](),controller[_0xebdd('0xb')]);router[_0xebdd('0x9')](_0xebdd('0xc'),auth['isAuthenticated'](),controller[_0xebdd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xebdd('0xc'),auth['isAuthenticated'](),controller[_0xebdd('0xe')]);router[_0xebdd('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xebdd('0x10')]);module[_0xebdd('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3a811dc..b2063e2 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 _0xb9af=['long','type','select','parse','values','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','alias','STRING','getDataValue','TEXT'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xb9af,0x8a));var _0xfb9a=function(_0x2ff2b1,_0x39c367){_0x2ff2b1=_0x2ff2b1-0x0;var _0x15bd18=_0xb9af[_0x2ff2b1];return _0x15bd18;};'use strict';var Sequelize=require(_0xfb9a('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xfb9a('0x1')],'get':function(_0x1269ea){return this['getDataValue'](_0xfb9a('0x2'));}},'alias':{'type':Sequelize[_0xfb9a('0x3')],'allowNull':![],'set':function(_0x4c145c){this['setDataValue'](_0xfb9a('0x2'),_0x4c145c?_0x4c145c:this[_0xfb9a('0x4')]('name'));}},'type':{'type':Sequelize[_0xfb9a('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xfb9a('0x5')](_0xfb9a('0x6')),'get':function(){if(this[_0xfb9a('0x4')](_0xfb9a('0x7'))===_0xfb9a('0x8')){return JSON[_0xfb9a('0x9')](this[_0xfb9a('0x4')](_0xfb9a('0xa')));}else{return this[_0xfb9a('0x4')](_0xfb9a('0xa'));}},'set':function(_0x438795){if(Array['isArray'](_0x438795)){this[_0xfb9a('0xb')]('values',JSON[_0xfb9a('0xc')](_0x438795));}else{this[_0xfb9a('0xb')](_0xfb9a('0xa'),_0x438795);}}},'required':{'type':Sequelize[_0xfb9a('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfb9a('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfb9a('0xe')](_0xfb9a('0xf'))}}; \ No newline at end of file +var _0x3496=['type','select','parse','values','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','TEXT','long'];(function(_0x4d8cfa,_0x5ca213){var _0x2b9fc2=function(_0x291236){while(--_0x291236){_0x4d8cfa['push'](_0x4d8cfa['shift']());}};_0x2b9fc2(++_0x5ca213);}(_0x3496,0x1e7));var _0x6349=function(_0x107e2a,_0x5346a){_0x107e2a=_0x107e2a-0x0;var _0x536d9b=_0x3496[_0x107e2a];return _0x536d9b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6349('0x0'));module[_0x6349('0x1')]={'name':{'type':Sequelize[_0x6349('0x2')],'get':function(_0x3dc414){return this[_0x6349('0x3')](_0x6349('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2150ad){this[_0x6349('0x5')](_0x6349('0x4'),_0x2150ad?_0x2150ad:this[_0x6349('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6349('0x6')](_0x6349('0x7')),'get':function(){if(this[_0x6349('0x3')](_0x6349('0x8'))===_0x6349('0x9')){return JSON[_0x6349('0xa')](this[_0x6349('0x3')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x10bfcb){if(Array['isArray'](_0x10bfcb)){this[_0x6349('0x5')](_0x6349('0xb'),JSON['stringify'](_0x10bfcb));}else{this[_0x6349('0x5')](_0x6349('0xb'),_0x10bfcb);}}},'required':{'type':Sequelize[_0x6349('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6349('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6349('0xd')](_0x6349('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d2a5b90..b8f9a22 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 _0xfb14=['include','find','body','create','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','rows','catch','show','params'];(function(_0x468401,_0x33bddf){var _0x2a91d2=function(_0x39d914){while(--_0x39d914){_0x468401['push'](_0x468401['shift']());}};_0x2a91d2(++_0x33bddf);}(_0xfb14,0xc6));var _0x4fb1=function(_0xd1ca93,_0x142f75){_0xd1ca93=_0xd1ca93-0x0;var _0x17c2f5=_0xfb14[_0xd1ca93];return _0x17c2f5;};'use strict';var emlformat=require(_0x4fb1('0x0'));var rimraf=require(_0x4fb1('0x1'));var zipdir=require(_0x4fb1('0x2'));var jsonpatch=require(_0x4fb1('0x3'));var rp=require(_0x4fb1('0x4'));var moment=require(_0x4fb1('0x5'));var BPromise=require(_0x4fb1('0x6'));var Mustache=require(_0x4fb1('0x7'));var util=require(_0x4fb1('0x8'));var path=require('path');var sox=require(_0x4fb1('0x9'));var csv=require(_0x4fb1('0xa'));var ejs=require(_0x4fb1('0xb'));var fs=require('fs');var fs_extra=require(_0x4fb1('0xc'));var _=require(_0x4fb1('0xd'));var squel=require(_0x4fb1('0xe'));var crypto=require('crypto');var jsforce=require(_0x4fb1('0xf'));var deskjs=require(_0x4fb1('0x10'));var toCsv=require(_0x4fb1('0xa'));var querystring=require(_0x4fb1('0x11'));var Papa=require(_0x4fb1('0x12'));var Redis=require(_0x4fb1('0x13'));var authService=require(_0x4fb1('0x14'));var qs=require(_0x4fb1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fb1('0x16'));var logger=require('../../config/logger')(_0x4fb1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4fb1('0x18'))['db'];function respondWithStatusCode(_0x238baf,_0x31619a){_0x31619a=_0x31619a||0xcc;return function(_0x7a74c3){if(_0x7a74c3){return _0x238baf['sendStatus'](_0x31619a);}return _0x238baf[_0x4fb1('0x19')](_0x31619a)[_0x4fb1('0x1a')]();};}function respondWithResult(_0x1f20e2,_0x546612){_0x546612=_0x546612||0xc8;return function(_0xd189c){if(_0xd189c){return _0x1f20e2['status'](_0x546612)[_0x4fb1('0x1b')](_0xd189c);}};}function respondWithFilteredResult(_0x11209b,_0x59c73e){return function(_0x1ad967){if(_0x1ad967){var _0x2ea2ab=typeof _0x59c73e[_0x4fb1('0x1c')]===_0x4fb1('0x1d')&&typeof _0x59c73e[_0x4fb1('0x1e')]==='undefined';var _0x1b30cb=_0x1ad967['count'];var _0x3e9305=_0x2ea2ab?0x0:_0x59c73e['offset'];var _0x36418e=_0x2ea2ab?_0x1ad967[_0x4fb1('0x1f')]:_0x59c73e[_0x4fb1('0x1c')]+_0x59c73e[_0x4fb1('0x1e')];var _0x27e246;if(_0x36418e>=_0x1b30cb){_0x36418e=_0x1b30cb;_0x27e246=0xc8;}else{_0x27e246=0xce;}_0x11209b[_0x4fb1('0x19')](_0x27e246);return _0x11209b[_0x4fb1('0x20')](_0x4fb1('0x21'),_0x3e9305+'-'+_0x36418e+'/'+_0x1b30cb)['json'](_0x1ad967);}return null;};}function patchUpdates(_0x203b00){return function(_0x14d4fd){try{jsonpatch[_0x4fb1('0x22')](_0x14d4fd,_0x203b00,!![]);}catch(_0x55c251){return BPromise[_0x4fb1('0x23')](_0x55c251);}return _0x14d4fd[_0x4fb1('0x24')]();};}function saveUpdates(_0x4f7b9b,_0x60a591){return function(_0x4515bf){if(_0x4515bf){return _0x4515bf[_0x4fb1('0x25')](_0x4f7b9b)[_0x4fb1('0x26')](function(_0x2f6d37){return _0x2f6d37;});}return null;};}function removeEntity(_0x2305c1,_0x19a729){return function(_0xb2de1c){if(_0xb2de1c){return _0xb2de1c[_0x4fb1('0x27')]()[_0x4fb1('0x26')](function(){_0x2305c1[_0x4fb1('0x19')](0xcc)[_0x4fb1('0x1a')]();});}};}function handleEntityNotFound(_0x205209,_0x49abbb){return function(_0x7c6661){if(!_0x7c6661){_0x205209[_0x4fb1('0x28')](0x194);}return _0x7c6661;};}function handleError(_0x3158aa,_0x35992d){_0x35992d=_0x35992d||0x1f4;return function(_0x2c69da){logger[_0x4fb1('0x29')](_0x2c69da['stack']);if(_0x2c69da['name']){delete _0x2c69da[_0x4fb1('0x2a')];}_0x3158aa[_0x4fb1('0x19')](_0x35992d)[_0x4fb1('0x2b')](_0x2c69da);};}exports['index']=function(_0xcebbb2,_0x4e1232){var _0x416f01={},_0x3c766f={},_0x1d7046={'count':0x0,'rows':[]};var _0x2c2eeb=_['map'](db[_0x4fb1('0x2c')][_0x4fb1('0x2d')],function(_0x4ac867){return{'name':_0x4ac867[_0x4fb1('0x2e')],'type':_0x4ac867['type'][_0x4fb1('0x2f')]};});_0x3c766f[_0x4fb1('0x30')]=_[_0x4fb1('0x31')](_[_0x4fb1('0x32')](_0x2c2eeb,'name'),[_0x4fb1('0x2a')]);_0x3c766f['query']=_[_0x4fb1('0x33')](_0xcebbb2['query']);_0x3c766f['filters']=_[_0x4fb1('0x34')](_0x3c766f['model'],_0x3c766f['query']);_0x416f01[_0x4fb1('0x35')]=_[_0x4fb1('0x34')](_0x3c766f[_0x4fb1('0x30')],qs[_0x4fb1('0x36')](_0xcebbb2[_0x4fb1('0x37')][_0x4fb1('0x36')]));_0x416f01['attributes']=_0x416f01[_0x4fb1('0x35')][_0x4fb1('0x38')]?_0x416f01[_0x4fb1('0x35')]:_0x3c766f[_0x4fb1('0x30')];if(!_0xcebbb2[_0x4fb1('0x37')][_0x4fb1('0x39')](_0x4fb1('0x3a'))){_0x416f01[_0x4fb1('0x1e')]=qs[_0x4fb1('0x1e')](_0xcebbb2[_0x4fb1('0x37')][_0x4fb1('0x1e')]);_0x416f01['offset']=qs['offset'](_0xcebbb2['query'][_0x4fb1('0x1c')]);}_0x416f01[_0x4fb1('0x3b')]=qs[_0x4fb1('0x3c')](_0xcebbb2['query'][_0x4fb1('0x3c')]);_0x416f01[_0x4fb1('0x3d')]=qs[_0x4fb1('0x3e')](_[_0x4fb1('0x3f')](_0xcebbb2[_0x4fb1('0x37')],_0x3c766f['filters']),_0x2c2eeb);if(_0xcebbb2[_0x4fb1('0x37')][_0x4fb1('0x40')]){_0x416f01['where']=_['merge'](_0x416f01[_0x4fb1('0x3d')],{'$or':_[_0x4fb1('0x32')](_0x2c2eeb,function(_0x4137f4){if(_0x4137f4[_0x4fb1('0x41')]!=='VIRTUAL'){var _0x4db8fa={};_0x4db8fa[_0x4137f4['name']]={'$like':'%'+_0xcebbb2[_0x4fb1('0x37')]['filter']+'%'};return _0x4db8fa;}})});}_0x416f01=_[_0x4fb1('0x42')]({},_0x416f01,_0xcebbb2['options']);var _0x1d4f46={'where':_0x416f01['where']};return db[_0x4fb1('0x2c')][_0x4fb1('0x1f')](_0x1d4f46)[_0x4fb1('0x26')](function(_0x39b381){_0x1d7046[_0x4fb1('0x1f')]=_0x39b381;if(_0xcebbb2['query'][_0x4fb1('0x43')]){_0x416f01['include']=[{'all':!![]}];}return db[_0x4fb1('0x2c')]['findAll'](_0x416f01);})[_0x4fb1('0x26')](function(_0x4054fe){_0x1d7046[_0x4fb1('0x44')]=_0x4054fe;return _0x1d7046;})[_0x4fb1('0x26')](respondWithFilteredResult(_0x4e1232,_0x416f01))[_0x4fb1('0x45')](handleError(_0x4e1232,null));};exports[_0x4fb1('0x46')]=function(_0x1ba1e8,_0x489445){var _0x7a10e3={'raw':!![],'where':{'id':_0x1ba1e8[_0x4fb1('0x47')]['id']}},_0x3d2045={};_0x3d2045[_0x4fb1('0x30')]=_[_0x4fb1('0x33')](db[_0x4fb1('0x2c')]['rawAttributes']);_0x3d2045[_0x4fb1('0x37')]=_[_0x4fb1('0x33')](_0x1ba1e8[_0x4fb1('0x37')]);_0x3d2045['filters']=_[_0x4fb1('0x34')](_0x3d2045[_0x4fb1('0x30')],_0x3d2045[_0x4fb1('0x37')]);_0x7a10e3[_0x4fb1('0x35')]=_[_0x4fb1('0x34')](_0x3d2045[_0x4fb1('0x30')],qs[_0x4fb1('0x36')](_0x1ba1e8[_0x4fb1('0x37')]['fields']));_0x7a10e3[_0x4fb1('0x35')]=_0x7a10e3[_0x4fb1('0x35')][_0x4fb1('0x38')]?_0x7a10e3[_0x4fb1('0x35')]:_0x3d2045[_0x4fb1('0x30')];if(_0x1ba1e8['query'][_0x4fb1('0x43')]){_0x7a10e3[_0x4fb1('0x48')]=[{'all':!![]}];}_0x7a10e3=_['merge']({},_0x7a10e3,_0x1ba1e8['options']);return db[_0x4fb1('0x2c')][_0x4fb1('0x49')](_0x7a10e3)[_0x4fb1('0x26')](handleEntityNotFound(_0x489445,null))[_0x4fb1('0x26')](respondWithResult(_0x489445,null))['catch'](handleError(_0x489445,null));};exports['update']=function(_0x12f84c,_0x165f25){if(_0x12f84c[_0x4fb1('0x4a')]['id']){delete _0x12f84c[_0x4fb1('0x4a')]['id'];}return db[_0x4fb1('0x2c')][_0x4fb1('0x49')]({'where':{'id':_0x12f84c[_0x4fb1('0x47')]['id']}})[_0x4fb1('0x26')](handleEntityNotFound(_0x165f25,null))[_0x4fb1('0x26')](saveUpdates(_0x12f84c['body'],null))[_0x4fb1('0x26')](respondWithResult(_0x165f25,null))[_0x4fb1('0x45')](handleError(_0x165f25,null));};exports[_0x4fb1('0x27')]=function(_0x35fabf,_0x417443){return db[_0x4fb1('0x2c')]['find']({'where':{'id':_0x35fabf[_0x4fb1('0x47')]['id']}})[_0x4fb1('0x26')](handleEntityNotFound(_0x417443,null))['then'](removeEntity(_0x417443,null))[_0x4fb1('0x45')](handleError(_0x417443,null));};exports[_0x4fb1('0x4b')]=function(_0xc908ba,_0x2343a0){var _0x581f70;return db[_0x4fb1('0x4c')]['transaction'](function(_0x177054){return db['CmCustomField'][_0x4fb1('0x4b')](_0xc908ba[_0x4fb1('0x4a')],{'transaction':_0x177054})[_0x4fb1('0x26')](function(_0x16b844){_0x581f70=_0x16b844;var _0x45e80f={'type':db[_0x4fb1('0x4d')]['TEXT'],'transaction':_0x177054};switch(_0xc908ba[_0x4fb1('0x4a')]['type']){case _0x4fb1('0x4e'):_0x45e80f[_0x4fb1('0x41')]=db[_0x4fb1('0x4d')][_0x4fb1('0x4f')];break;case _0x4fb1('0x50'):_0x45e80f[_0x4fb1('0x41')]=db[_0x4fb1('0x4d')][_0x4fb1('0x51')];break;case _0x4fb1('0x52'):_0x45e80f[_0x4fb1('0x41')]=db['Sequelize'][_0x4fb1('0x53')];_0x45e80f[_0x4fb1('0x54')]=![];break;default:}return db[_0x4fb1('0x4c')][_0x4fb1('0x55')][_0x4fb1('0x56')](_0x4fb1('0x57'),util[_0x4fb1('0x58')](_0x4fb1('0x59'),_0x581f70['id']),_0x45e80f);})['then'](function(){return _0x581f70;});})[_0x4fb1('0x26')](respondWithResult(_0x2343a0,0xc9))[_0x4fb1('0x45')](handleError(_0x2343a0,null));}; \ No newline at end of file +var _0x9edf=['hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','then','rows','catch','show','params','intersection','length','includeAll','body','find','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','fields','attributes'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x9edf,0x76));var _0xf9ed=function(_0x564121,_0xe41916){_0x564121=_0x564121-0x0;var _0x208777=_0x9edf[_0x564121];return _0x208777;};'use strict';var emlformat=require(_0xf9ed('0x0'));var rimraf=require(_0xf9ed('0x1'));var zipdir=require(_0xf9ed('0x2'));var jsonpatch=require(_0xf9ed('0x3'));var rp=require(_0xf9ed('0x4'));var moment=require(_0xf9ed('0x5'));var BPromise=require(_0xf9ed('0x6'));var Mustache=require(_0xf9ed('0x7'));var util=require(_0xf9ed('0x8'));var path=require('path');var sox=require(_0xf9ed('0x9'));var csv=require(_0xf9ed('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9ed('0xb'));var squel=require(_0xf9ed('0xc'));var crypto=require(_0xf9ed('0xd'));var jsforce=require(_0xf9ed('0xe'));var deskjs=require(_0xf9ed('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf9ed('0x10'));var Redis=require(_0xf9ed('0x11'));var authService=require(_0xf9ed('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf9ed('0x13'));var utils=require(_0xf9ed('0x14'));var config=require(_0xf9ed('0x15'));var licenseUtil=require(_0xf9ed('0x16'));var db=require(_0xf9ed('0x17'))['db'];function respondWithStatusCode(_0x4a60f7,_0xfe6f8){_0xfe6f8=_0xfe6f8||0xcc;return function(_0x5a21eb){if(_0x5a21eb){return _0x4a60f7[_0xf9ed('0x18')](_0xfe6f8);}return _0x4a60f7['status'](_0xfe6f8)[_0xf9ed('0x19')]();};}function respondWithResult(_0x18814b,_0x23799e){_0x23799e=_0x23799e||0xc8;return function(_0x3fa47f){if(_0x3fa47f){return _0x18814b[_0xf9ed('0x1a')](_0x23799e)[_0xf9ed('0x1b')](_0x3fa47f);}};}function respondWithFilteredResult(_0x1e0e3c,_0x201ea7){return function(_0x4d69f9){if(_0x4d69f9){var _0x1c3822=typeof _0x201ea7[_0xf9ed('0x1c')]===_0xf9ed('0x1d')&&typeof _0x201ea7[_0xf9ed('0x1e')]===_0xf9ed('0x1d');var _0x12c217=_0x4d69f9[_0xf9ed('0x1f')];var _0x159602=_0x1c3822?0x0:_0x201ea7[_0xf9ed('0x1c')];var _0x466a2d=_0x1c3822?_0x4d69f9[_0xf9ed('0x1f')]:_0x201ea7['offset']+_0x201ea7['limit'];var _0x291369;if(_0x466a2d>=_0x12c217){_0x466a2d=_0x12c217;_0x291369=0xc8;}else{_0x291369=0xce;}_0x1e0e3c[_0xf9ed('0x1a')](_0x291369);return _0x1e0e3c[_0xf9ed('0x20')](_0xf9ed('0x21'),_0x159602+'-'+_0x466a2d+'/'+_0x12c217)[_0xf9ed('0x1b')](_0x4d69f9);}return null;};}function patchUpdates(_0x19ffad){return function(_0x222ee4){try{jsonpatch[_0xf9ed('0x22')](_0x222ee4,_0x19ffad,!![]);}catch(_0x21009e){return BPromise[_0xf9ed('0x23')](_0x21009e);}return _0x222ee4[_0xf9ed('0x24')]();};}function saveUpdates(_0x1a4747,_0x27a6f4){return function(_0x3877e8){if(_0x3877e8){return _0x3877e8[_0xf9ed('0x25')](_0x1a4747)['then'](function(_0x1ede89){return _0x1ede89;});}return null;};}function removeEntity(_0x4fe0fe,_0x2c439b){return function(_0x3531ac){if(_0x3531ac){return _0x3531ac[_0xf9ed('0x26')]()['then'](function(){_0x4fe0fe[_0xf9ed('0x1a')](0xcc)[_0xf9ed('0x19')]();});}};}function handleEntityNotFound(_0x100b80,_0x1554b8){return function(_0x382732){if(!_0x382732){_0x100b80['sendStatus'](0x194);}return _0x382732;};}function handleError(_0x1095e5,_0x15e51f){_0x15e51f=_0x15e51f||0x1f4;return function(_0x33e4fb){logger['error'](_0x33e4fb[_0xf9ed('0x27')]);if(_0x33e4fb['name']){delete _0x33e4fb[_0xf9ed('0x28')];}_0x1095e5[_0xf9ed('0x1a')](_0x15e51f)['send'](_0x33e4fb);};}exports['index']=function(_0x7f3e0b,_0xf34dd3){var _0xf51858={},_0x1dcfd1={},_0x3eb4ec={'count':0x0,'rows':[]};var _0x51adbc=_[_0xf9ed('0x29')](db[_0xf9ed('0x2a')][_0xf9ed('0x2b')],function(_0x5485b6){return{'name':_0x5485b6[_0xf9ed('0x2c')],'type':_0x5485b6[_0xf9ed('0x2d')]['key']};});_0x1dcfd1[_0xf9ed('0x2e')]=_[_0xf9ed('0x2f')](_['map'](_0x51adbc,_0xf9ed('0x28')),[_0xf9ed('0x28')]);_0x1dcfd1[_0xf9ed('0x30')]=_[_0xf9ed('0x31')](_0x7f3e0b[_0xf9ed('0x30')]);_0x1dcfd1['filters']=_['intersection'](_0x1dcfd1[_0xf9ed('0x2e')],_0x1dcfd1[_0xf9ed('0x30')]);_0xf51858['attributes']=_['intersection'](_0x1dcfd1[_0xf9ed('0x2e')],qs[_0xf9ed('0x32')](_0x7f3e0b[_0xf9ed('0x30')][_0xf9ed('0x32')]));_0xf51858[_0xf9ed('0x33')]=_0xf51858[_0xf9ed('0x33')]['length']?_0xf51858[_0xf9ed('0x33')]:_0x1dcfd1[_0xf9ed('0x2e')];if(!_0x7f3e0b[_0xf9ed('0x30')][_0xf9ed('0x34')](_0xf9ed('0x35'))){_0xf51858['limit']=qs['limit'](_0x7f3e0b[_0xf9ed('0x30')][_0xf9ed('0x1e')]);_0xf51858[_0xf9ed('0x1c')]=qs['offset'](_0x7f3e0b['query']['offset']);}_0xf51858[_0xf9ed('0x36')]=qs['sort'](_0x7f3e0b['query'][_0xf9ed('0x37')]);_0xf51858[_0xf9ed('0x38')]=qs['filters'](_[_0xf9ed('0x39')](_0x7f3e0b[_0xf9ed('0x30')],_0x1dcfd1[_0xf9ed('0x3a')]),_0x51adbc);if(_0x7f3e0b[_0xf9ed('0x30')][_0xf9ed('0x3b')]){_0xf51858[_0xf9ed('0x38')]=_[_0xf9ed('0x3c')](_0xf51858['where'],{'$or':_['map'](_0x51adbc,function(_0x46437e){if(_0x46437e[_0xf9ed('0x2d')]!==_0xf9ed('0x3d')){var _0xba9b9d={};_0xba9b9d[_0x46437e['name']]={'$like':'%'+_0x7f3e0b['query'][_0xf9ed('0x3b')]+'%'};return _0xba9b9d;}})});}_0xf51858=_['merge']({},_0xf51858,_0x7f3e0b[_0xf9ed('0x3e')]);var _0xa49952={'where':_0xf51858['where']};return db[_0xf9ed('0x2a')][_0xf9ed('0x1f')](_0xa49952)['then'](function(_0x586335){_0x3eb4ec[_0xf9ed('0x1f')]=_0x586335;if(_0x7f3e0b[_0xf9ed('0x30')]['includeAll']){_0xf51858[_0xf9ed('0x3f')]=[{'all':!![]}];}return db[_0xf9ed('0x2a')]['findAll'](_0xf51858);})[_0xf9ed('0x40')](function(_0x37a222){_0x3eb4ec[_0xf9ed('0x41')]=_0x37a222;return _0x3eb4ec;})[_0xf9ed('0x40')](respondWithFilteredResult(_0xf34dd3,_0xf51858))[_0xf9ed('0x42')](handleError(_0xf34dd3,null));};exports[_0xf9ed('0x43')]=function(_0x82fea9,_0x79bf9c){var _0x568cde={'raw':!![],'where':{'id':_0x82fea9[_0xf9ed('0x44')]['id']}},_0x50d6cf={};_0x50d6cf[_0xf9ed('0x2e')]=_[_0xf9ed('0x31')](db[_0xf9ed('0x2a')][_0xf9ed('0x2b')]);_0x50d6cf[_0xf9ed('0x30')]=_[_0xf9ed('0x31')](_0x82fea9[_0xf9ed('0x30')]);_0x50d6cf[_0xf9ed('0x3a')]=_[_0xf9ed('0x45')](_0x50d6cf['model'],_0x50d6cf[_0xf9ed('0x30')]);_0x568cde[_0xf9ed('0x33')]=_['intersection'](_0x50d6cf['model'],qs[_0xf9ed('0x32')](_0x82fea9[_0xf9ed('0x30')]['fields']));_0x568cde[_0xf9ed('0x33')]=_0x568cde[_0xf9ed('0x33')][_0xf9ed('0x46')]?_0x568cde[_0xf9ed('0x33')]:_0x50d6cf[_0xf9ed('0x2e')];if(_0x82fea9[_0xf9ed('0x30')][_0xf9ed('0x47')]){_0x568cde[_0xf9ed('0x3f')]=[{'all':!![]}];}_0x568cde=_[_0xf9ed('0x3c')]({},_0x568cde,_0x82fea9[_0xf9ed('0x3e')]);return db[_0xf9ed('0x2a')]['find'](_0x568cde)[_0xf9ed('0x40')](handleEntityNotFound(_0x79bf9c,null))[_0xf9ed('0x40')](respondWithResult(_0x79bf9c,null))[_0xf9ed('0x42')](handleError(_0x79bf9c,null));};exports[_0xf9ed('0x25')]=function(_0x512c03,_0x4f65a5){if(_0x512c03[_0xf9ed('0x48')]['id']){delete _0x512c03[_0xf9ed('0x48')]['id'];}return db[_0xf9ed('0x2a')][_0xf9ed('0x49')]({'where':{'id':_0x512c03[_0xf9ed('0x44')]['id']}})[_0xf9ed('0x40')](handleEntityNotFound(_0x4f65a5,null))[_0xf9ed('0x40')](saveUpdates(_0x512c03[_0xf9ed('0x48')],null))[_0xf9ed('0x40')](respondWithResult(_0x4f65a5,null))['catch'](handleError(_0x4f65a5,null));};exports[_0xf9ed('0x26')]=function(_0x33508c,_0x44e432){return db['CmCustomField']['find']({'where':{'id':_0x33508c[_0xf9ed('0x44')]['id']}})['then'](handleEntityNotFound(_0x44e432,null))[_0xf9ed('0x40')](removeEntity(_0x44e432,null))[_0xf9ed('0x42')](handleError(_0x44e432,null));};exports[_0xf9ed('0x4a')]=function(_0x576ebc,_0x2b637d){var _0x4495b8;return db[_0xf9ed('0x4b')][_0xf9ed('0x4c')](function(_0x38deb4){return db[_0xf9ed('0x2a')][_0xf9ed('0x4a')](_0x576ebc[_0xf9ed('0x48')],{'transaction':_0x38deb4})[_0xf9ed('0x40')](function(_0x1a41de){_0x4495b8=_0x1a41de;var _0x39921e={'type':db[_0xf9ed('0x4d')][_0xf9ed('0x4e')],'transaction':_0x38deb4};switch(_0x576ebc['body'][_0xf9ed('0x2d')]){case _0xf9ed('0x4f'):_0x39921e[_0xf9ed('0x2d')]=db['Sequelize']['TEXT'];break;case'number':_0x39921e[_0xf9ed('0x2d')]=db[_0xf9ed('0x4d')][_0xf9ed('0x50')];break;case'switch':_0x39921e[_0xf9ed('0x2d')]=db['Sequelize'][_0xf9ed('0x51')];_0x39921e[_0xf9ed('0x52')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xf9ed('0x53'),util[_0xf9ed('0x54')]('cf_%d',_0x4495b8['id']),_0x39921e);})['then'](function(){return _0x4495b8;});})['then'](respondWithResult(_0x2b637d,0xc9))[_0xf9ed('0x42')](handleError(_0x2b637d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 660f901..d7e055a 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 _0x8d81=['CmCustomField','lodash','../../config/logger','moment','request-promise','path','rimraf','./cmCustomField.attributes','exports'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x8d81,0x10f));var _0x18d8=function(_0x4cd391,_0x414618){_0x4cd391=_0x4cd391-0x0;var _0x232865=_0x8d81[_0x4cd391];return _0x232865;};'use strict';var _=require(_0x18d8('0x0'));var util=require('util');var logger=require(_0x18d8('0x1'))('api');var moment=require(_0x18d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x18d8('0x3'));var fs=require('fs');var path=require(_0x18d8('0x4'));var rimraf=require(_0x18d8('0x5'));var config=require('../../config/environment');var attributes=require(_0x18d8('0x6'));module[_0x18d8('0x7')]=function(_0x233503,_0x43b625){return _0x233503['define'](_0x18d8('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf86=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x18d1e1,_0x199096){var _0x379bb8=function(_0x4d8fbf){while(--_0x4d8fbf){_0x18d1e1['push'](_0x18d1e1['shift']());}};_0x379bb8(++_0x199096);}(_0xbf86,0xb4));var _0x6bf8=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0xbf86[_0x28a180];return _0x1161d3;};'use strict';var _=require(_0x6bf8('0x0'));var util=require(_0x6bf8('0x1'));var logger=require(_0x6bf8('0x2'))(_0x6bf8('0x3'));var moment=require('moment');var BPromise=require(_0x6bf8('0x4'));var rp=require(_0x6bf8('0x5'));var fs=require('fs');var path=require(_0x6bf8('0x6'));var rimraf=require(_0x6bf8('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bf8('0x8'));module[_0x6bf8('0x9')]=function(_0x3cfdba,_0x2a1326){return _0x3cfdba[_0x6bf8('0xa')](_0x6bf8('0xb'),attributes,{'tableName':_0x6bf8('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 5b1d876..a6ac3c1 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 _0x2ec7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x2ec7,0x1d0));var _0x72ec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2ec7[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x72ec('0x0'));var util=require(_0x72ec('0x1'));var moment=require(_0x72ec('0x2'));var BPromise=require(_0x72ec('0x3'));var rs=require(_0x72ec('0x4'));var fs=require('fs');var Redis=require(_0x72ec('0x5'));var db=require(_0x72ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x72ec('0x7'))(_0x72ec('0x8'));var config=require('../../config/environment');var jayson=require(_0x72ec('0x9'));var client=jayson[_0x72ec('0xa')][_0x72ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3701aa,_0x4d6bc1,_0x5e8bd9){return new BPromise(function(_0x2edb4f,_0x32d6e0){return client['request'](_0x3701aa,_0x5e8bd9)[_0x72ec('0xc')](function(_0x508124){logger[_0x72ec('0xd')](_0x72ec('0xe'),_0x4d6bc1,'request\x20sent');logger['debug'](_0x72ec('0xf'),_0x4d6bc1,_0x72ec('0x10'),JSON['stringify'](_0x508124));if(_0x508124[_0x72ec('0x11')]){if(_0x508124[_0x72ec('0x11')][_0x72ec('0x12')]===0x1f4){logger['error'](_0x72ec('0xe'),_0x4d6bc1,_0x508124[_0x72ec('0x11')][_0x72ec('0x13')]);return _0x32d6e0(_0x508124[_0x72ec('0x11')]['message']);}logger['error'](_0x72ec('0xe'),_0x4d6bc1,_0x508124['error'][_0x72ec('0x13')]);return _0x2edb4f(_0x508124[_0x72ec('0x11')][_0x72ec('0x13')]);}else{logger['info'](_0x72ec('0xe'),_0x4d6bc1,_0x72ec('0x10'));_0x2edb4f(_0x508124[_0x72ec('0x14')][_0x72ec('0x13')]);}})[_0x72ec('0x15')](function(_0x17546b){logger[_0x72ec('0x11')](_0x72ec('0xe'),_0x4d6bc1,_0x17546b);_0x32d6e0(_0x17546b);});});} \ No newline at end of file +var _0xee3e=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0xa86fd6,_0x4281b4){var _0x23e829=function(_0x134a33){while(--_0x134a33){_0xa86fd6['push'](_0xa86fd6['shift']());}};_0x23e829(++_0x4281b4);}(_0xee3e,0x1aa));var _0xeee3=function(_0x1244c0,_0x564083){_0x1244c0=_0x1244c0-0x0;var _0x4adde8=_0xee3e[_0x1244c0];return _0x4adde8;};'use strict';var _=require(_0xeee3('0x0'));var util=require(_0xeee3('0x1'));var moment=require(_0xeee3('0x2'));var BPromise=require(_0xeee3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeee3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeee3('0x5'));var config=require(_0xeee3('0x6'));var jayson=require(_0xeee3('0x7'));var client=jayson[_0xeee3('0x8')][_0xeee3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2efc23,_0xec976a,_0x10d05b){return new BPromise(function(_0x4d513c,_0x2dcd61){return client[_0xeee3('0xa')](_0x2efc23,_0x10d05b)[_0xeee3('0xb')](function(_0x213dd7){logger[_0xeee3('0xc')](_0xeee3('0xd'),_0xec976a,_0xeee3('0xe'));logger[_0xeee3('0xf')](_0xeee3('0x10'),_0xec976a,_0xeee3('0xe'),JSON['stringify'](_0x213dd7));if(_0x213dd7[_0xeee3('0x11')]){if(_0x213dd7[_0xeee3('0x11')][_0xeee3('0x12')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0xec976a,_0x213dd7[_0xeee3('0x11')]['message']);return _0x2dcd61(_0x213dd7[_0xeee3('0x11')]['message']);}logger[_0xeee3('0x11')](_0xeee3('0xd'),_0xec976a,_0x213dd7['error']['message']);return _0x4d513c(_0x213dd7[_0xeee3('0x11')][_0xeee3('0x13')]);}else{logger[_0xeee3('0xc')](_0xeee3('0xd'),_0xec976a,_0xeee3('0xe'));_0x4d513c(_0x213dd7[_0xeee3('0x14')]['message']);}})[_0xeee3('0x15')](function(_0x260736){logger['error'](_0xeee3('0xd'),_0xec976a,_0x260736);_0x2dcd61(_0x260736);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5b1b910..f673965 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 _0x9d5c=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports'];(function(_0x33cca0,_0x1745e0){var _0x3028bf=function(_0x4e35d4){while(--_0x4e35d4){_0x33cca0['push'](_0x33cca0['shift']());}};_0x3028bf(++_0x1745e0);}(_0x9d5c,0x98));var _0xc9d5=function(_0x35f257,_0x1b5b8e){_0x35f257=_0x35f257-0x0;var _0x357721=_0x9d5c[_0x35f257];return _0x357721;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require('util');var path=require(_0xc9d5('0x1'));var timeout=require(_0xc9d5('0x2'));var express=require('express');var router=express[_0xc9d5('0x3')]();var fs_extra=require(_0xc9d5('0x4'));var auth=require(_0xc9d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9d5('0x6'));var controller=require(_0xc9d5('0x7'));router['get']('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x9')]);router[_0xc9d5('0xa')](_0xc9d5('0xb'),auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xc')]);router[_0xc9d5('0xd')]('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xe')]);router[_0xc9d5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc9d5('0x10')]);router['delete'](_0xc9d5('0xb'),auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x11')]);module[_0xc9d5('0x12')]=router; \ No newline at end of file +var _0x85d8=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d3531,_0x1e4748){var _0x299781=function(_0x3b90e8){while(--_0x3b90e8){_0x3d3531['push'](_0x3d3531['shift']());}};_0x299781(++_0x1e4748);}(_0x85d8,0x1b0));var _0x885d=function(_0x2ebffb,_0x9bd3c1){_0x2ebffb=_0x2ebffb-0x0;var _0x108e96=_0x85d8[_0x2ebffb];return _0x108e96;};'use strict';var multer=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var path=require(_0x885d('0x2'));var timeout=require(_0x885d('0x3'));var express=require(_0x885d('0x4'));var router=express['Router']();var fs_extra=require(_0x885d('0x5'));var auth=require(_0x885d('0x6'));var interaction=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x885d('0x9')](),controller[_0x885d('0xa')]);router[_0x885d('0xb')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0xd')]);router[_0x885d('0xe')]('/',auth[_0x885d('0x9')](),controller[_0x885d('0xf')]);router[_0x885d('0x10')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x11')]);router[_0x885d('0x12')](_0x885d('0xc'),auth[_0x885d('0x9')](),controller[_0x885d('0x13')]);module[_0x885d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 92c040b..7a4911e 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 _0x69eb=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x69eb,0x118));var _0xb69e=function(_0x36cf0e,_0x3871c1){_0x36cf0e=_0x36cf0e-0x0;var _0x19667a=_0x69eb[_0x36cf0e];return _0x19667a;};'use strict';var moment=require(_0xb69e('0x0'));var Sequelize=require(_0xb69e('0x1'));module[_0xb69e('0x2')]={'phone':{'type':Sequelize[_0xb69e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb69e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xb69e('0x5'))},'countbusyretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb69e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb69e('0x7')]},'priority':{'type':Sequelize[_0xb69e('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb69e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb69e('0x8')},'ListId':{'type':Sequelize[_0xb69e('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xb69e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xb69e('0x6')],'unique':_0xb69e('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb69e('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb69e('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb69e('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb69e('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7f2f=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7f2f,0xdc));var _0xf7f2=function(_0x140752,_0x3cc756){_0x140752=_0x140752-0x0;var _0x24de5b=_0x7f2f[_0x140752];return _0x24de5b;};'use strict';var moment=require(_0xf7f2('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xf7f2('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf7f2('0x2')],'defaultValue':moment()['format'](_0xf7f2('0x3'))},'countbusyretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf7f2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf7f2('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf7f2('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf7f2('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf7f2('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf7f2('0x4')],'unique':_0xf7f2('0x7')},'ListId':{'type':Sequelize[_0xf7f2('0x4')],'unique':_0xf7f2('0x7')},'UserId':{'type':Sequelize[_0xf7f2('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xf7f2('0x4')],'unique':_0xf7f2('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf7f2('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf7f2('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf7f2('0x1')]},'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 bdd8f01..d3d773e 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 _0xfd87=['count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','create','body','find','params','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','dataValues','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','DESC','isEmpty','scheduledAt','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','LOCK','CmList','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var qs=require(_0x7fd8('0x2'));var logger=require(_0x7fd8('0x3'))(_0x7fd8('0x4'));var shared=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];function respondWithResult(_0x42b06c,_0x4429f2){_0x4429f2=_0x4429f2||0xc8;return function(_0x43b442){if(_0x43b442){return _0x42b06c[_0x7fd8('0x7')](_0x4429f2)['json'](_0x43b442);}};}function respondWithFilteredResult(_0x1395b6,_0x10a778){return function(_0x55681d){if(_0x55681d){var _0x378037=typeof _0x10a778[_0x7fd8('0x8')]===_0x7fd8('0x9')&&typeof _0x10a778[_0x7fd8('0xa')]===_0x7fd8('0x9');var _0x515439=_0x55681d[_0x7fd8('0xb')];var _0x18e3ea=_0x378037?0x0:_0x10a778[_0x7fd8('0x8')];var _0x596d03=_0x378037?_0x55681d['count']:_0x10a778['offset']+_0x10a778[_0x7fd8('0xa')];var _0x4e6096;if(_0x596d03>=_0x515439){_0x596d03=_0x515439;_0x4e6096=0xc8;}else{_0x4e6096=0xce;}_0x1395b6[_0x7fd8('0x7')](_0x4e6096);return _0x1395b6[_0x7fd8('0xc')](_0x7fd8('0xd'),_0x18e3ea+'-'+_0x596d03+'/'+_0x515439)['json'](_0x55681d);}return null;};}function saveUpdates(_0x136770,_0x2cccdb){return function(_0xe84aa7){if(_0xe84aa7){return _0xe84aa7[_0x7fd8('0xe')](_0x136770)[_0x7fd8('0xf')](function(_0x5b7061){return _0x5b7061;});}return null;};}function handleEntityNotFound(_0x1af365,_0x17a3a1){return function(_0x1d481a){if(!_0x1d481a){_0x1af365[_0x7fd8('0x10')](0x194);}return _0x1d481a;};}function handleError(_0x250a02,_0x38d45a){_0x38d45a=_0x38d45a||0x1f4;return function(_0x1a4a52){logger[_0x7fd8('0x11')](_0x1a4a52[_0x7fd8('0x12')]);if(_0x1a4a52[_0x7fd8('0x13')]){delete _0x1a4a52[_0x7fd8('0x13')];}_0x250a02['status'](_0x38d45a)['send'](_0x1a4a52);};}exports['index']=function(_0xab57f7,_0xce23dc){var _0x48734c={},_0x39e301={},_0xb6f53b={'count':0x0,'rows':[]};var _0x40b134=_[_0x7fd8('0x14')](db[_0x7fd8('0x15')][_0x7fd8('0x16')],function(_0x2edf31){return{'name':_0x2edf31[_0x7fd8('0x17')],'type':_0x2edf31['type'][_0x7fd8('0x18')]};});_0x39e301[_0x7fd8('0x19')]=_[_0x7fd8('0x14')](_0x40b134,_0x7fd8('0x13'));_0x39e301[_0x7fd8('0x1a')]=_[_0x7fd8('0x1b')](_0xab57f7['query']);_0x39e301[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x39e301[_0x7fd8('0x19')],_0x39e301[_0x7fd8('0x1a')]);_0x39e301['filters']=_[_0x7fd8('0x1e')](_0x39e301[_0x7fd8('0x1c')],[_0x7fd8('0x1f'),_0x7fd8('0x20'),_0x7fd8('0x21'),'$gte','$lt',_0x7fd8('0x22'),_0x7fd8('0x23'),_0x7fd8('0x24'),_0x7fd8('0x25'),_0x7fd8('0x26'),'$notBetween',_0x7fd8('0x27'),_0x7fd8('0x28'),_0x7fd8('0x29'),_0x7fd8('0x2a'),_0x7fd8('0x2b'),'$notILike','$like',_0x7fd8('0x2c'),_0x7fd8('0x2d'),_0x7fd8('0x2e'),_0x7fd8('0x2f')]);_0x48734c['attributes']=_['intersection'](_0x39e301[_0x7fd8('0x19')],qs['fields'](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x48734c[_0x7fd8('0x31')]=_0x48734c['attributes'][_0x7fd8('0x32')]?_0x48734c['attributes']:_0x39e301[_0x7fd8('0x19')];if(!_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x33')](_0x7fd8('0x34'))){_0x48734c[_0x7fd8('0xa')]=qs[_0x7fd8('0xa')](_0xab57f7[_0x7fd8('0x1a')]['limit']);_0x48734c[_0x7fd8('0x8')]=qs[_0x7fd8('0x8')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x8')]);}_0x48734c[_0x7fd8('0x35')]=qs[_0x7fd8('0x36')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x36')]);_0x48734c['where']=qs['filters'](_[_0x7fd8('0x37')](_0xab57f7[_0x7fd8('0x1a')],_0x39e301[_0x7fd8('0x1c')]),_0x40b134);if(_0xab57f7['query'][_0x7fd8('0x38')]){_0x48734c['where']=_['merge'](_0x48734c[_0x7fd8('0x39')],{'$or':_[_0x7fd8('0x14')](_0x40b134,function(_0x298dd6){if(_0x298dd6[_0x7fd8('0x3a')]!==_0x7fd8('0x3b')){var _0x3a889e={};_0x3a889e[_0x298dd6[_0x7fd8('0x13')]]={'$like':'%'+_0xab57f7[_0x7fd8('0x1a')]['filter']+'%'};return _0x3a889e;}})});}_0x48734c=_[_0x7fd8('0x3c')]({},_0x48734c,_0xab57f7['options']);var _0x5e6231={'where':_0x48734c[_0x7fd8('0x39')]};return db['CmHopper']['count'](_0x5e6231)['then'](function(_0x6c5e52){_0xb6f53b[_0x7fd8('0xb')]=_0x6c5e52;if(_0xab57f7['query'][_0x7fd8('0x3d')]){_0x48734c[_0x7fd8('0x3e')]=[{'all':!![]}];}return db[_0x7fd8('0x15')]['findAll'](_0x48734c);})['then'](function(_0x4ec65a){_0xb6f53b[_0x7fd8('0x3f')]=_0x4ec65a;return _0xb6f53b;})[_0x7fd8('0xf')](respondWithFilteredResult(_0xce23dc,_0x48734c))[_0x7fd8('0x40')](handleError(_0xce23dc,null));};exports[_0x7fd8('0x41')]=function(_0x1d2eca,_0x1b8737){var _0x2b5abb={'raw':!![],'where':{'id':_0x1d2eca['params']['id']}},_0x501f59={};_0x501f59['model']=_[_0x7fd8('0x1b')](db[_0x7fd8('0x15')][_0x7fd8('0x16')]);_0x501f59['query']=_[_0x7fd8('0x1b')](_0x1d2eca[_0x7fd8('0x1a')]);_0x501f59[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x501f59['model'],_0x501f59[_0x7fd8('0x1a')]);_0x2b5abb[_0x7fd8('0x31')]=_['intersection'](_0x501f59[_0x7fd8('0x19')],qs['fields'](_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x2b5abb[_0x7fd8('0x31')]=_0x2b5abb[_0x7fd8('0x31')]['length']?_0x2b5abb[_0x7fd8('0x31')]:_0x501f59[_0x7fd8('0x19')];if(_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x3d')]){_0x2b5abb[_0x7fd8('0x3e')]=[{'all':!![]}];}_0x2b5abb=_[_0x7fd8('0x3c')]({},_0x2b5abb,_0x1d2eca['options']);return db['CmHopper']['find'](_0x2b5abb)[_0x7fd8('0xf')](handleEntityNotFound(_0x1b8737,null))[_0x7fd8('0xf')](respondWithResult(_0x1b8737,null))['catch'](handleError(_0x1b8737,null));};exports['create']=function(_0x328e81,_0x371a02){return db['CmHopper'][_0x7fd8('0x42')](_0x328e81[_0x7fd8('0x43')],{})[_0x7fd8('0xf')](respondWithResult(_0x371a02,0xc9))['catch'](handleError(_0x371a02,null));};exports[_0x7fd8('0xe')]=function(_0x47462e,_0x4f6a65){if(_0x47462e[_0x7fd8('0x43')]['id']){delete _0x47462e['body']['id'];}return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x47462e[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x4f6a65,null))[_0x7fd8('0xf')](saveUpdates(_0x47462e[_0x7fd8('0x43')],null))[_0x7fd8('0xf')](respondWithResult(_0x4f6a65,null))[_0x7fd8('0x40')](handleError(_0x4f6a65,null));};exports['describe']=function(_0x1666e7,_0x5ca89e){return db[_0x7fd8('0x15')][_0x7fd8('0x46')]()['then'](respondWithResult(_0x5ca89e,null))[_0x7fd8('0x40')](handleError(_0x5ca89e,null));};exports[_0x7fd8('0x47')]=function(_0x5cbc91,_0x5e3a45){var _0x59dc51;var _0xcfb3a8=_0x5cbc91['params']['id'];return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x5cbc91[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0xf')](function(_0x4bbd34){if(_0x4bbd34){return _0x4bbd34['destroy']()[_0x7fd8('0xf')](function(_0x46c230){return _0x46c230;});}})[_0x7fd8('0xf')](function(_0x169317){_0x59dc51=_0x169317;if(_0x169317){if(_0x169317['VoiceQueueId']||_0x169317[_0x7fd8('0x48')]){return db[_0x169317['VoiceQueueId']?_0x7fd8('0x49'):_0x7fd8('0x4a')][_0x7fd8('0x44')]({'where':{'id':_0x169317[_0x7fd8('0x4b')]?_0x169317[_0x7fd8('0x4b')]:_0x169317[_0x7fd8('0x48')]},'attributes':['id',_0x7fd8('0x13')],'raw':!![]});}}})[_0x7fd8('0xf')](function(_0x369e11){var _0x20f460={};if(_0x369e11){_[_0x7fd8('0x3c')](_0x20f460,_['omit'](_0x59dc51[_0x7fd8('0x4c')],[_0x7fd8('0x4d'),_0x7fd8('0x4e'),'id']));_0x20f460[_0x7fd8('0x4f')]=0x15;_0x20f460[_0x7fd8('0x50')]='deleted';_0x20f460['campaign']=_0x369e11['name'];_0x20f460[_0x7fd8('0x51')]=_0x5cbc91[_0x7fd8('0x52')][_0x7fd8('0x13')];_0x20f460[_0x7fd8('0x53')]=_0x5cbc91[_0x7fd8('0x52')]['id'];_0x20f460[_0x7fd8('0x54')]=!![];_0x20f460[_0x7fd8('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20f460[_0x7fd8('0x56')]=_0x59dc51['phone'];_0x20f460[_0x7fd8('0x57')]=_0x59dc51[_0x7fd8('0x4b')]?'queue':_0x7fd8('0x58');return db[_0x7fd8('0x59')]['find']({'where':{'id':_0x20f460[_0x7fd8('0x5a')]},'attributes':[_0x7fd8('0x5b'),_0x7fd8('0x5c')]})[_0x7fd8('0xf')](function(_0x47013a){if(!_[_0x7fd8('0x5d')](_0x5e3a45)&&!_[_0x7fd8('0x5d')](_0x47013a['firstName'])){_0x20f460[_0x7fd8('0x5e')]=_0x47013a[_0x7fd8('0x5b')];if(!_[_0x7fd8('0x5d')](_0x47013a[_0x7fd8('0x5c')])){_0x20f460[_0x7fd8('0x5e')]+='\x20'+_0x47013a['lastName'];}}})[_0x7fd8('0x5f')](function(){return db[_0x7fd8('0x60')][_0x7fd8('0x42')](_0x20f460);});}})['then'](function(_0x5e7495){return db[_0x7fd8('0x61')][_0x7fd8('0x47')]({'where':{'CmHopperId':_0xcfb3a8}});})[_0x7fd8('0xf')](function(){return _0x5e3a45[_0x7fd8('0x7')](0xcc)[_0x7fd8('0x62')]();})[_0x7fd8('0x40')](handleError(_0x5e3a45,null));};exports['getPreview']=function(_0x24756f,_0x1cb6e4){var _0xa04550=[];return db[_0x7fd8('0x59')]['describe']()[_0x7fd8('0xf')](function(_0x6118d7){_0xa04550=_[_0x7fd8('0x1b')](_0x6118d7);return _0x24756f[_0x7fd8('0x52')][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id',_0x7fd8('0x66'),_0x7fd8('0x67')],'raw':!![]});})[_0x7fd8('0xf')](function(_0x3fc049){if(_0x3fc049&&_0x3fc049[_0x7fd8('0x32')]){return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x5cb9a0){var _0x48e1cc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_[_0x7fd8('0x14')](_0x3fc049,'id')},'$or':[{'UserId':null},{'UserId':_0x24756f[_0x7fd8('0x52')]['id']}]};var _0xd62b0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc049)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x7fd8('0x14')]('id')[_0x7fd8('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x24756f['user']['id']}]};var _0x4c04b3={'$or':[_0x48e1cc,_0xd62b0]};var _0x489bf3=[];if(_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]&&_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]===_0x7fd8('0x6e')){if(!_['isEmpty'](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$in':_0x24756f[_0x7fd8('0x43')]['hopperIds']};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x71')],['scheduledAt',_0x3fc049[0x0][_0x7fd8('0x66')]==='ASC'?_0x7fd8('0x72'):'ASC'],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7fd8('0x72')]];}else{if(!_[_0x7fd8('0x73')](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$notIn':_0x24756f['body'][_0x7fd8('0x6f')]};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x72')],[_0x7fd8('0x74'),_0x3fc049[0x0][_0x7fd8('0x66')]],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7fd8('0x71')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x7fd8('0x75'),_0x7fd8('0x76'),_0x7fd8('0x77')],'where':_0x4c04b3,'order':_0x489bf3,'transaction':_0x5cb9a0,'lock':_0x5cb9a0['LOCK'][_0x7fd8('0x78')],'include':[{'model':db[_0x7fd8('0x59')],'as':_0x7fd8('0x79'),'attributes':_0xa04550,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db['CmList'],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x1c46eb){if(_0x1c46eb){return _0x1c46eb['update']({'UserId':_0x24756f[_0x7fd8('0x52')]['id']},{'transaction':_0x5cb9a0});}});});}})[_0x7fd8('0xf')](handleEntityNotFound(_0x1cb6e4,null))[_0x7fd8('0xf')](respondWithResult(_0x1cb6e4,null))['catch'](handleError(_0x1cb6e4,null));};exports[_0x7fd8('0x7f')]=function(_0x4394f3,_0x1fd9bc,_0x4426cb){var _0x43fef0=[];var _0xafff06=_0x4394f3['params']['id'];var _0x335333=_0x4394f3[_0x7fd8('0x52')]['id'];return db[_0x7fd8('0x59')][_0x7fd8('0x46')]()['then'](function(_0x72429a){_0x43fef0=_[_0x7fd8('0x1b')](_0x72429a);return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x42e7ae){const _0x296119={'id':_0xafff06};return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x7fd8('0x77')],'where':_0x296119,'transaction':_0x42e7ae,'lock':_0x42e7ae[_0x7fd8('0x80')]['UPDATE'],'include':[{'model':db[_0x7fd8('0x59')],'as':'Contact','attributes':_0x43fef0,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db[_0x7fd8('0x81')],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x446b01){if(_0x446b01){return _0x446b01[_0x7fd8('0xe')]({'UserId':_0x335333},{'transaction':_0x42e7ae});}});});})['then'](handleEntityNotFound(_0x1fd9bc,null))[_0x7fd8('0xf')](respondWithResult(_0x1fd9bc,null))[_0x7fd8('0x40')](handleError(_0x1fd9bc,null));};exports[_0x7fd8('0x82')]=function(_0x3c353c,_0x68df89){return _0x3c353c['user'][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id'],'raw':!![]})[_0x7fd8('0xf')](function(_0x58f956){if(_0x58f956&&_0x58f956[_0x7fd8('0x32')]){return db[_0x7fd8('0x15')][_0x7fd8('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x58f956,'id')},'$or':[{'UserId':null},{'UserId':_0x3c353c[_0x7fd8('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x111114){if(!_[_0x7fd8('0x5d')](_0x111114)&&_[_0x7fd8('0x83')](_0x111114)){return _0x68df89['status'](0xc8)[_0x7fd8('0x84')]({'contacts':_0x111114});}else{logger[_0x7fd8('0x11')](_0x7fd8('0x85'),_0x7fd8('0x82'),0x194,'entity\x20not\x20found');_0x68df89[_0x7fd8('0x10')](0x194);}})[_0x7fd8('0x40')](handleError(_0x68df89,null));};exports[_0x7fd8('0x86')]=function(_0x4cfe36,_0x408a07){var _0x148843=shared[_0x7fd8('0x87')];var _0xb66bee=[];_[_0x7fd8('0x14')](_0x148843,function(_0x147343){_0xb66bee[_0x7fd8('0x88')]({'id':_0x147343[_0x7fd8('0x13')],'name':_0x147343[_0x7fd8('0x13')],'utcOffset':_0x147343[_0x7fd8('0x89')]});});return _0x408a07['status'](0xc8)[_0x7fd8('0x84')]({'tz':_0xb66bee});};exports[_0x7fd8('0x8a')]=function(_0x2affd1,_0x15025d){var _0x56aff8=shared[_0x7fd8('0x87')];var _0x5f28fa={};if(!_['isNil'](_0x56aff8[_0x2affd1[_0x7fd8('0x43')]['id']]))_0x5f28fa=_0x56aff8[_0x2affd1['body']['id']];return _0x15025d[_0x7fd8('0x7')](0xc8)[_0x7fd8('0x84')](_0x5f28fa);}; \ No newline at end of file +var _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x3b62f4,_0xefbe7e){var _0x84154=function(_0x17c534){while(--_0x17c534){_0x3b62f4['push'](_0x3b62f4['shift']());}};_0x84154(++_0xefbe7e);}(_0x8d0a,0x65));var _0xa8d0=function(_0x5dd17c,_0x1e5cdc){_0x5dd17c=_0x5dd17c-0x0;var _0x224c4c=_0x8d0a[_0x5dd17c];return _0x224c4c;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b26dfb1..930eb0f 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 _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x86c253,_0x3029ef){var _0x3c7c6b=function(_0xae35ce){while(--_0xae35ce){_0x86c253['push'](_0x86c253['shift']());}};_0x3c7c6b(++_0x3029ef);}(_0x7096,0x10c));var _0x6709=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7096[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeda8=['exports','define','cm_hopper','scheduledat','phone','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0xeda8,0x104));var _0x8eda=function(_0x2b4fb1,_0x6f5964){_0x2b4fb1=_0x2b4fb1-0x0;var _0x174ff9=_0xeda8[_0x2b4fb1];return _0x174ff9;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('CmHopper',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['phone']},{'name':'priority','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 93e41b5..789d990 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 _0xe0e7=['debug','stringify','catch','message','error','ShowCmHopper','CmHopper','find','info','create','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','util','moment','../../mysqldb','../../config/logger','rpc','findAll','options','raw','where','limit','map','include','model','attributes','then','GetCmHopper'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe0e7,0x17b));var _0x7e0e=function(_0x20e79a,_0x322d4e){_0x20e79a=_0x20e79a-0x0;var _0x70801f=_0xe0e7[_0x20e79a];return _0x70801f;};'use strict';var _=require('lodash');var util=require(_0x7e0e('0x0'));var moment=require(_0x7e0e('0x1'));var BPromise=require('bluebird');var db=require(_0x7e0e('0x2'))['db'];var logger=require(_0x7e0e('0x3'))(_0x7e0e('0x4'));exports['GetCmHopper']=function(_0x2ac11f){var _0x5b4dac=this;return new Promise(function(_0x216b0f,_0x5bd25f){return db['CmHopper'][_0x7e0e('0x5')]({'raw':_0x2ac11f[_0x7e0e('0x6')]?_0x2ac11f[_0x7e0e('0x6')][_0x7e0e('0x7')]===undefined?!![]:![]:!![],'where':_0x2ac11f[_0x7e0e('0x6')]?_0x2ac11f[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null,'attributes':_0x2ac11f[_0x7e0e('0x6')]?_0x2ac11f[_0x7e0e('0x6')]['attributes']||null:null,'limit':_0x2ac11f[_0x7e0e('0x6')]?_0x2ac11f[_0x7e0e('0x6')][_0x7e0e('0x9')]||null:null,'include':_0x2ac11f[_0x7e0e('0x6')]?_0x2ac11f['options']['include']?_[_0x7e0e('0xa')](_0x2ac11f[_0x7e0e('0x6')][_0x7e0e('0xb')],function(_0x186c0d){return{'model':db[_0x186c0d[_0x7e0e('0xc')]],'as':_0x186c0d['as'],'attributes':_0x186c0d[_0x7e0e('0xd')],'include':_0x186c0d['include']?_[_0x7e0e('0xa')](_0x186c0d[_0x7e0e('0xb')],function(_0x4174ad){return{'model':db[_0x4174ad['model']],'as':_0x4174ad['as'],'attributes':_0x4174ad['attributes'],'include':_0x4174ad['include']?_[_0x7e0e('0xa')](_0x4174ad['include'],function(_0x40d7f0){return{'model':db[_0x40d7f0[_0x7e0e('0xc')]],'as':_0x40d7f0['as'],'attributes':_0x40d7f0[_0x7e0e('0xd')]};}):[]};}):[]};}):[]:[]})[_0x7e0e('0xe')](function(_0x30d1f5){logger['info'](_0x7e0e('0xf'),_0x2ac11f);logger[_0x7e0e('0x10')](_0x7e0e('0xf'),_0x2ac11f,JSON[_0x7e0e('0x11')](_0x30d1f5));_0x216b0f(_0x30d1f5);})[_0x7e0e('0x12')](function(_0x4b17ad){logger['error']('GetCmHopper',_0x4b17ad[_0x7e0e('0x13')],_0x2ac11f);_0x5bd25f(_0x5b4dac[_0x7e0e('0x14')](0x1f4,_0x4b17ad[_0x7e0e('0x13')]));});});};exports[_0x7e0e('0x15')]=function(_0x20ecf4){var _0x1eddd4=this;return new Promise(function(_0x3a5434,_0x44ef5c){return db[_0x7e0e('0x16')][_0x7e0e('0x17')]({'raw':_0x20ecf4[_0x7e0e('0x6')]?_0x20ecf4['options'][_0x7e0e('0x7')]===undefined?!![]:![]:!![],'where':_0x20ecf4[_0x7e0e('0x6')]?_0x20ecf4['options'][_0x7e0e('0x8')]||null:null,'attributes':_0x20ecf4['options']?_0x20ecf4[_0x7e0e('0x6')][_0x7e0e('0xd')]||null:null,'include':_0x20ecf4[_0x7e0e('0x6')]?_0x20ecf4[_0x7e0e('0x6')][_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0x20ecf4['options']['include'],function(_0x46ceec){return{'model':db[_0x46ceec['model']],'as':_0x46ceec['as'],'attributes':_0x46ceec[_0x7e0e('0xd')],'include':_0x46ceec[_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0x46ceec[_0x7e0e('0xb')],function(_0x4a4d5d){return{'model':db[_0x4a4d5d[_0x7e0e('0xc')]],'as':_0x4a4d5d['as'],'attributes':_0x4a4d5d[_0x7e0e('0xd')],'include':_0x4a4d5d[_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0x4a4d5d[_0x7e0e('0xb')],function(_0x418fde){return{'model':db[_0x418fde[_0x7e0e('0xc')]],'as':_0x418fde['as'],'attributes':_0x418fde[_0x7e0e('0xd')]};}):[]};}):[]};}):[]:[]})[_0x7e0e('0xe')](function(_0x4d4d25){logger[_0x7e0e('0x18')]('ShowCmHopper',_0x20ecf4);logger[_0x7e0e('0x10')](_0x7e0e('0x15'),_0x20ecf4,JSON['stringify'](_0x4d4d25));_0x3a5434(_0x4d4d25);})['catch'](function(_0x33541d){logger[_0x7e0e('0x14')](_0x7e0e('0x15'),_0x33541d[_0x7e0e('0x13')],_0x20ecf4);_0x44ef5c(_0x1eddd4[_0x7e0e('0x14')](0x1f4,_0x33541d[_0x7e0e('0x13')]));});});};exports['CreateCmHopper']=function(_0x3d4a2e){var _0x35c04c=this;return new Promise(function(_0xdd7460,_0x351bfb){return db['CmHopper'][_0x7e0e('0x19')](_0x3d4a2e['body'],{'raw':_0x3d4a2e[_0x7e0e('0x6')]?_0x3d4a2e[_0x7e0e('0x6')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3a3e19){logger[_0x7e0e('0x18')]('CreateCmHopper',_0x3d4a2e);logger[_0x7e0e('0x10')]('CreateCmHopper',_0x3d4a2e,JSON['stringify'](_0x3a3e19));_0xdd7460(_0x3a3e19);})[_0x7e0e('0x12')](function(_0x3fb6ac){logger[_0x7e0e('0x14')](_0x7e0e('0x1a'),_0x3fb6ac[_0x7e0e('0x13')],_0x3d4a2e);_0x351bfb(_0x35c04c['error'](0x1f4,_0x3fb6ac[_0x7e0e('0x13')]));});});};exports['UpdateCmHopper']=function(_0xc9e654){var _0x2bf57b=this;return new Promise(function(_0x5c4894,_0x4fbc66){return db[_0x7e0e('0x16')]['update'](_0xc9e654['body'],{'raw':_0xc9e654[_0x7e0e('0x6')]?_0xc9e654[_0x7e0e('0x6')][_0x7e0e('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9e654[_0x7e0e('0x6')]?_0xc9e654['options'][_0x7e0e('0x8')]||null:null,'attributes':_0xc9e654[_0x7e0e('0x6')]?_0xc9e654[_0x7e0e('0x6')][_0x7e0e('0xd')]||null:null,'limit':_0xc9e654[_0x7e0e('0x6')]?_0xc9e654[_0x7e0e('0x6')][_0x7e0e('0x9')]||null:null})[_0x7e0e('0xe')](function(_0x24210a){logger[_0x7e0e('0x18')](_0x7e0e('0x1b'),_0xc9e654);logger[_0x7e0e('0x18')](_0x7e0e('0x1c'),JSON['stringify'](_0xc9e654[_0x7e0e('0x6')][_0x7e0e('0x8')]),_0xc9e654[_0x7e0e('0x1d')][_0x7e0e('0x1e')]);logger['debug'](_0x7e0e('0x1b'),_0xc9e654,JSON[_0x7e0e('0x11')](_0x24210a));_0x5c4894(_0x24210a);})['catch'](function(_0x11685d){logger[_0x7e0e('0x14')](_0x7e0e('0x1b'),_0x11685d[_0x7e0e('0x13')],_0xc9e654);_0x4fbc66(_0x2bf57b[_0x7e0e('0x14')](0x1f4,_0x11685d[_0x7e0e('0x13')]));});});};exports[_0x7e0e('0x1f')]=function(_0x2fcba2){var _0x59e1db=this;return new Promise(function(_0x4aff56,_0x313d56){return db[_0x7e0e('0x16')]['destroy']({'where':_0x2fcba2[_0x7e0e('0x6')]?_0x2fcba2[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null})[_0x7e0e('0xe')](function(_0x13276b){logger[_0x7e0e('0x18')]('DestroyCmHopper',_0x2fcba2);logger[_0x7e0e('0x10')](_0x7e0e('0x1f'),_0x2fcba2,JSON['stringify'](_0x13276b));_0x4aff56(_0x13276b);})[_0x7e0e('0x12')](function(_0x3e43b0){logger[_0x7e0e('0x14')](_0x7e0e('0x1f'),_0x3e43b0['message'],_0x2fcba2);_0x313d56(_0x59e1db['error'](0x1f4,_0x3e43b0['message']));});});};exports[_0x7e0e('0x20')]=function(_0x456a4c){var _0x3e17dd=this;return new Promise(function(_0x5392f5,_0x596b89){return db[_0x7e0e('0x21')][_0x7e0e('0x22')]()[_0x7e0e('0xe')](function(_0x15df40){return db['sequelize'][_0x7e0e('0x23')](function(_0x172bf1){return db[_0x7e0e('0x16')]['findAll']({'where':_0x456a4c[_0x7e0e('0x6')]?_0x456a4c[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null,'attributes':_0x456a4c['options']?_0x456a4c[_0x7e0e('0x6')][_0x7e0e('0xd')]||null:null,'limit':_0x456a4c[_0x7e0e('0x6')]?_0x456a4c[_0x7e0e('0x6')]['limit']||null:null,'order':_0x456a4c['options']?_0x456a4c[_0x7e0e('0x6')][_0x7e0e('0x24')]||null:null,'transaction':_0x172bf1,'lock':_0x172bf1[_0x7e0e('0x25')][_0x7e0e('0x26')],'include':[{'model':db[_0x7e0e('0x21')],'as':_0x7e0e('0x27'),'attributes':_[_0x7e0e('0x28')](_0x15df40)},{'model':db[_0x7e0e('0x29')],'as':_0x7e0e('0x2a'),'attributes':['id',_0x7e0e('0x2b'),_0x7e0e('0x2c')]}]})[_0x7e0e('0xe')](function(_0x1b4646){var _0x527b5f=[];var _0x30b0b7=[];for(var _0x2827d5=0x0;_0x2827d5<_0x1b4646[_0x7e0e('0x2d')];_0x2827d5+=0x1){var _0x559808=_0x1b4646[_0x2827d5][_0x7e0e('0x2e')];if(_0x559808===null){_0x527b5f[_0x7e0e('0x2f')](_0x1b4646[_0x2827d5][_0x7e0e('0x30')](_0x456a4c[_0x7e0e('0x1d')],{'transaction':_0x172bf1}));}else if(!_0x30b0b7[_0x7e0e('0x31')](_0x559808)){_0x30b0b7[_0x7e0e('0x2f')](_0x559808);_0x527b5f[_0x7e0e('0x2f')](_0x1b4646[_0x2827d5][_0x7e0e('0x30')](_0x456a4c['body'],{'transaction':_0x172bf1}));}}return BPromise[_0x7e0e('0x32')](_0x527b5f);});})[_0x7e0e('0xe')](function(_0x33710b){logger[_0x7e0e('0x18')](_0x7e0e('0x20'),_0x456a4c);if(_0x33710b[_0x7e0e('0x2d')]>0x0){logger[_0x7e0e('0x18')](_0x7e0e('0x33'),_0x33710b[0x0][_0x7e0e('0x34')]['id'],_0x33710b[0x0][_0x7e0e('0x34')][_0x7e0e('0x35')],_0x33710b[0x0][_0x7e0e('0x34')][_0x7e0e('0x1e')]);}logger[_0x7e0e('0x10')](_0x7e0e('0x20'),_0x456a4c,JSON[_0x7e0e('0x11')](_0x33710b));_0x5392f5(_0x33710b);})['catch'](function(_0x342511){logger['error']('GetContactDialer',_0x342511[_0x7e0e('0x13')],_0x456a4c);_0x596b89(_0x3e17dd[_0x7e0e('0x14')](0x1f4,_0x342511[_0x7e0e('0x13')]));});});});};exports[_0x7e0e('0x36')]=function(_0x4956c0){var _0x315e25=this;return new Promise(function(_0x1c093e,_0x10a315){return db[_0x7e0e('0x37')][_0x7e0e('0x23')](function(_0x4becfa){return db[_0x7e0e('0x38')][_0x7e0e('0x19')](_0x4956c0[_0x7e0e('0x1d')],{'raw':_0x4956c0[_0x7e0e('0x6')]?_0x4956c0['options'][_0x7e0e('0x7')]===undefined?!![]:![]:!![],'transaction':_0x4becfa})[_0x7e0e('0xe')](function(){logger[_0x7e0e('0x18')](_0x7e0e('0x39'),JSON[_0x7e0e('0x11')](_0x4956c0['options']['where']),_0x4956c0[_0x7e0e('0x6')][_0x7e0e('0x8')]['active']);return db[_0x7e0e('0x16')][_0x7e0e('0x3a')]({'where':_0x4956c0[_0x7e0e('0x6')]?_0x4956c0[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null,'transaction':_0x4becfa});});})['then'](function(_0x1bd407){logger[_0x7e0e('0x18')](_0x7e0e('0x36'),_0x4956c0);logger['debug'](_0x7e0e('0x36'),_0x4956c0,JSON[_0x7e0e('0x11')](_0x1bd407));_0x1c093e(_0x1bd407);})['catch'](function(_0x1aff06){logger[_0x7e0e('0x14')](_0x7e0e('0x36'),_0x1aff06[_0x7e0e('0x13')],_0x4956c0);_0x10a315(_0x315e25['error'](0x1f4,_0x1aff06[_0x7e0e('0x13')]));});});};exports[_0x7e0e('0x3b')]=function(_0x5aa338){var _0x535078=this;return new Promise(function(_0x4cf54e,_0x2d3605){return db[_0x7e0e('0x16')]['findAll']({'raw':_0x5aa338[_0x7e0e('0x6')]?_0x5aa338[_0x7e0e('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5aa338[_0x7e0e('0x6')]?_0x5aa338[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null,'attributes':[[db[_0x7e0e('0x37')]['fn'](_0x7e0e('0x3c'),db[_0x7e0e('0x37')]['fn']('IF',db[_0x7e0e('0x37')]['literal']('`scheduledat`\x20>=\x20'+util[_0x7e0e('0x3d')](_0x7e0e('0x3e'),moment()[_0x7e0e('0x3d')](_0x7e0e('0x3f')))+_0x7e0e('0x40')))),_0x7e0e('0x41')]]})['then'](function(_0x23584f){logger[_0x7e0e('0x18')](_0x7e0e('0x3b'),_0x5aa338);logger[_0x7e0e('0x10')](_0x7e0e('0x3b'),_0x5aa338,JSON['stringify'](_0x23584f));_0x4cf54e(_0x23584f);})[_0x7e0e('0x12')](function(_0x59a077){logger['error']('CountReScheduled',_0x59a077[_0x7e0e('0x13')],_0x5aa338);_0x2d3605(_0x535078[_0x7e0e('0x14')](0x1f4,_0x59a077['message']));});});};exports[_0x7e0e('0x42')]=function(_0xb6841c){var _0x57a506=this;return new Promise(function(_0x1beecf,_0xbe26b8){return db[_0x7e0e('0x21')][_0x7e0e('0x22')]()[_0x7e0e('0xe')](function(){return db[_0x7e0e('0x37')]['transaction'](function(_0x8b3b78){return db['CmHopper'][_0x7e0e('0x5')]({'where':_0xb6841c[_0x7e0e('0x6')]?_0xb6841c['options'][_0x7e0e('0x8')]||null:null,'attributes':_0xb6841c[_0x7e0e('0x6')]?_0xb6841c[_0x7e0e('0x6')][_0x7e0e('0xd')]||null:null,'limit':0x1,'order':_0xb6841c[_0x7e0e('0x6')]?_0xb6841c[_0x7e0e('0x6')][_0x7e0e('0x24')]||null:null,'group':db['CmHopper'][_0x7e0e('0x2e')],'transaction':_0x8b3b78,'lock':_0x8b3b78[_0x7e0e('0x25')][_0x7e0e('0x26')],'include':_0xb6841c['options']?_0xb6841c[_0x7e0e('0x6')][_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0xb6841c[_0x7e0e('0x6')][_0x7e0e('0xb')],function(_0x3b5094){return{'model':db[_0x3b5094['model']],'as':_0x3b5094['as'],'attributes':_0x3b5094[_0x7e0e('0xd')],'include':_0x3b5094[_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0x3b5094[_0x7e0e('0xb')],function(_0x46cf11){return{'model':db[_0x46cf11[_0x7e0e('0xc')]],'as':_0x46cf11['as'],'attributes':_0x46cf11[_0x7e0e('0xd')],'include':_0x46cf11[_0x7e0e('0xb')]?_['map'](_0x46cf11[_0x7e0e('0xb')],function(_0x473bc7){return{'model':db[_0x473bc7[_0x7e0e('0xc')]],'as':_0x473bc7['as'],'attributes':_0x473bc7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a7dc1){var _0x46b6b2=[];for(var _0x30e22f=0x0;_0x30e22f<_0x2a7dc1[_0x7e0e('0x2d')];_0x30e22f+=0x1){_0x46b6b2[_0x7e0e('0x2f')](_0x2a7dc1[_0x30e22f]['update'](_0xb6841c[_0x7e0e('0x1d')],{'transaction':_0x8b3b78}));}return BPromise['all'](_0x46b6b2);});})[_0x7e0e('0xe')](function(_0x3d47e7){logger[_0x7e0e('0x18')](_0x7e0e('0x42'),_0xb6841c);logger[_0x7e0e('0x10')](_0x7e0e('0x42'),_0xb6841c,JSON[_0x7e0e('0x11')](_0x3d47e7));_0x1beecf(_0x3d47e7);})[_0x7e0e('0x12')](function(_0x19f602){logger['error'](_0x7e0e('0x42'),_0x19f602[_0x7e0e('0x13')],_0xb6841c);_0xbe26b8(_0x57a506[_0x7e0e('0x14')](0x1f4,_0x19f602[_0x7e0e('0x13')]));});});});};exports[_0x7e0e('0x43')]=function(_0x17beb5){var _0x2d52d0=this;return new Promise(function(_0x1f0282,_0x496f61){db[_0x7e0e('0x21')]['describe']()['then'](function(_0x156f04){return db['CmHopper'][_0x7e0e('0x5')]({'raw':_0x17beb5[_0x7e0e('0x6')]?_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0x7')]===undefined?!![]:![]:!![],'where':_0x17beb5['options']?_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0x8')]||null:null,'attributes':_0x17beb5[_0x7e0e('0x6')]?_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0xd')]||null:null,'limit':_0x17beb5[_0x7e0e('0x6')]?_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0x9')]||null:null,'include':_0x17beb5[_0x7e0e('0x6')]?_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0xb')]?_['map'](_0x17beb5[_0x7e0e('0x6')][_0x7e0e('0xb')],function(_0x1be775){return{'model':db[_0x1be775[_0x7e0e('0xc')]],'as':_0x1be775['as'],'attributes':_0x1be775['as']===_0x7e0e('0x27')?_[_0x7e0e('0x28')](_0x156f04):_0x1be775[_0x7e0e('0xd')],'include':_0x1be775[_0x7e0e('0xb')]?_['map'](_0x1be775[_0x7e0e('0xb')],function(_0x106117){return{'model':db[_0x106117[_0x7e0e('0xc')]],'as':_0x106117['as'],'attributes':_0x106117[_0x7e0e('0xd')],'include':_0x106117[_0x7e0e('0xb')]?_[_0x7e0e('0xa')](_0x106117[_0x7e0e('0xb')],function(_0x5192f2){return{'model':db[_0x5192f2['model']],'as':_0x5192f2['as'],'attributes':_0x5192f2[_0x7e0e('0xd')]};}):[]};}):[]};}):[]:[]})[_0x7e0e('0xe')](function(_0x264d2d){logger[_0x7e0e('0x18')](_0x7e0e('0xf'),_0x17beb5);logger[_0x7e0e('0x10')]('GetCmHopper',_0x17beb5,JSON[_0x7e0e('0x11')](_0x264d2d));_0x1f0282(_0x264d2d);})[_0x7e0e('0x12')](function(_0x85534c){logger[_0x7e0e('0x14')](_0x7e0e('0xf'),_0x85534c['message'],_0x17beb5);_0x496f61(_0x2d52d0[_0x7e0e('0x14')](0x1f4,_0x85534c[_0x7e0e('0x13')]));});});});};exports['GetContactByPhone']=function(_0x48ee3a){var _0x41db03=this;return new Promise(function(_0x311315,_0x47122b){return db[_0x7e0e('0x21')]['findOne']({'raw':!![],'where':{'phone':_0x48ee3a[_0x7e0e('0x6')]['where'][_0x7e0e('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x7e0e('0x45')]]})[_0x7e0e('0xe')](function(_0x8296c){logger[_0x7e0e('0x18')]('getContactByPhone',_0x48ee3a);logger['debug']('getContactByPhone',_0x48ee3a,JSON['stringify'](_0x8296c));_0x311315(_0x8296c);})['catch'](function(_0xd8f0b6){logger[_0x7e0e('0x14')](_0x7e0e('0x46'),_0xd8f0b6['message'],_0x48ee3a);_0x47122b(_0x41db03['error'](0x1f4,_0xd8f0b6[_0x7e0e('0x13')]));});});};exports[_0x7e0e('0x47')]=function(_0x189f38){var _0x195bf5=this;return new Promise(function(_0x55c126,_0x47d8f6){return db[_0x7e0e('0x37')][_0x7e0e('0x23')](function(_0x3e4435){var _0x2743d=_0x189f38[_0x7e0e('0x6')]&&_0x189f38[_0x7e0e('0x6')][_0x7e0e('0x8')]?_0x189f38[_0x7e0e('0x6')][_0x7e0e('0x8')]:{};return db['CmHopper'][_0x7e0e('0x30')](_0x189f38[_0x7e0e('0x1d')],{'where':_0x2743d,'transaction':_0x3e4435})[_0x7e0e('0xe')](function(_0xc08a67){logger[_0x7e0e('0x18')](_0x7e0e('0x47'),_0x189f38);logger[_0x7e0e('0x10')](_0x7e0e('0x47'),_0x189f38,JSON[_0x7e0e('0x11')](_0xc08a67));_0x55c126(_0xc08a67);})[_0x7e0e('0x12')](function(_0x536ac8){logger[_0x7e0e('0x14')](_0x7e0e('0x47'),_0x536ac8[_0x7e0e('0x13')],_0x189f38);_0x47d8f6(_0x195bf5[_0x7e0e('0x14')](0x1f4,_0x536ac8[_0x7e0e('0x13')]));});});});};exports[_0x7e0e('0x48')]=function(_0x460128){var _0x68d7de=this;var _0x1fd10f=_0x460128[_0x7e0e('0x1d')]['where'][_0x7e0e('0x49')];var _0x4648f8=_0x460128[_0x7e0e('0x1d')][_0x7e0e('0x8')][_0x7e0e('0x4a')];var _0x5cca4d=_0x460128[_0x7e0e('0x1d')][_0x7e0e('0x8')]['availableAgentsIds'];return new Promise(function(_0x5cd487,_0x75060c){return db[_0x7e0e('0x16')][_0x7e0e('0x5')]({'where':{'voiceQueueId':{'$in':_0x1fd10f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7e0e('0x37')][_0x7e0e('0x4b')](_0x7e0e('0x4c')+_0x4648f8+_0x7e0e('0x4d')),'$gt':db[_0x7e0e('0x37')][_0x7e0e('0x4b')](_0x7e0e('0x4e'))}},'UserId':{'$in':_0x5cca4d}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x7e0e('0x29')],'as':_0x7e0e('0x2a'),'attributes':['id','name',_0x7e0e('0x2c')]},{'model':db['CmList'],'as':'List'}]})[_0x7e0e('0xe')](function(_0xb4ebd){if(_0xb4ebd[_0x7e0e('0x2d')]>0x0){return db[_0x7e0e('0x37')][_0x7e0e('0x23')](function(_0x205d56){return db[_0x7e0e('0x16')][_0x7e0e('0x30')]({'recallmeNotifiedDate':db['sequelize'][_0x7e0e('0x4b')]('NOW()')},{'where':{'id':{'$in':_[_0x7e0e('0xa')](_0xb4ebd,'id')}},'transaction':_0x205d56})[_0x7e0e('0xe')](function(){_0x5cd487(_0xb4ebd);})[_0x7e0e('0x12')](function(_0x3f6860){logger[_0x7e0e('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x3f6860[_0x7e0e('0x13')],_0x460128);_0x75060c(_0x68d7de['error'](0x1f4,_0x3f6860[_0x7e0e('0x13')]));});})[_0x7e0e('0x12')](function(_0x20e304){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x20e304[_0x7e0e('0x13')],_0x460128);_0x75060c(_0x68d7de[_0x7e0e('0x14')](0x1f4,_0x20e304[_0x7e0e('0x13')]));});}else{_0x5cd487(_0xb4ebd);}});});}; \ No newline at end of file +var _0x20d6=['GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','lodash','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','where','attributes','include','map','model','info','stringify','catch','error','message','ShowCmHopper','find','raw','then','debug','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','sequelize','transaction','findAll','limit','order','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','all'];(function(_0x53f73e,_0x373809){var _0x329497=function(_0x56fe4b){while(--_0x56fe4b){_0x53f73e['push'](_0x53f73e['shift']());}};_0x329497(++_0x373809);}(_0x20d6,0x6f));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require('util');var moment=require(_0x620d('0x1'));var BPromise=require(_0x620d('0x2'));var db=require(_0x620d('0x3'))['db'];var logger=require('../../config/logger')(_0x620d('0x4'));exports[_0x620d('0x5')]=function(_0x2684ca){var _0x45e9b1=this;return new Promise(function(_0x33ad95,_0x5b4bdf){return db[_0x620d('0x6')]['findAll']({'raw':_0x2684ca[_0x620d('0x7')]?_0x2684ca[_0x620d('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x2684ca[_0x620d('0x7')]?_0x2684ca[_0x620d('0x7')][_0x620d('0x8')]||null:null,'attributes':_0x2684ca['options']?_0x2684ca[_0x620d('0x7')][_0x620d('0x9')]||null:null,'limit':_0x2684ca['options']?_0x2684ca[_0x620d('0x7')]['limit']||null:null,'include':_0x2684ca[_0x620d('0x7')]?_0x2684ca[_0x620d('0x7')][_0x620d('0xa')]?_[_0x620d('0xb')](_0x2684ca['options'][_0x620d('0xa')],function(_0x35c66a){return{'model':db[_0x35c66a[_0x620d('0xc')]],'as':_0x35c66a['as'],'attributes':_0x35c66a[_0x620d('0x9')],'include':_0x35c66a[_0x620d('0xa')]?_['map'](_0x35c66a[_0x620d('0xa')],function(_0x3d74b4){return{'model':db[_0x3d74b4[_0x620d('0xc')]],'as':_0x3d74b4['as'],'attributes':_0x3d74b4[_0x620d('0x9')],'include':_0x3d74b4[_0x620d('0xa')]?_['map'](_0x3d74b4[_0x620d('0xa')],function(_0x687a2e){return{'model':db[_0x687a2e[_0x620d('0xc')]],'as':_0x687a2e['as'],'attributes':_0x687a2e[_0x620d('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b675d){logger[_0x620d('0xd')](_0x620d('0x5'),_0x2684ca);logger['debug'](_0x620d('0x5'),_0x2684ca,JSON[_0x620d('0xe')](_0x3b675d));_0x33ad95(_0x3b675d);})[_0x620d('0xf')](function(_0x56234a){logger[_0x620d('0x10')](_0x620d('0x5'),_0x56234a[_0x620d('0x11')],_0x2684ca);_0x5b4bdf(_0x45e9b1[_0x620d('0x10')](0x1f4,_0x56234a['message']));});});};exports[_0x620d('0x12')]=function(_0x10f0fb){var _0x3d9048=this;return new Promise(function(_0x1300c3,_0x549e30){return db[_0x620d('0x6')][_0x620d('0x13')]({'raw':_0x10f0fb[_0x620d('0x7')]?_0x10f0fb[_0x620d('0x7')][_0x620d('0x14')]===undefined?!![]:![]:!![],'where':_0x10f0fb[_0x620d('0x7')]?_0x10f0fb[_0x620d('0x7')][_0x620d('0x8')]||null:null,'attributes':_0x10f0fb[_0x620d('0x7')]?_0x10f0fb['options']['attributes']||null:null,'include':_0x10f0fb['options']?_0x10f0fb[_0x620d('0x7')][_0x620d('0xa')]?_[_0x620d('0xb')](_0x10f0fb[_0x620d('0x7')][_0x620d('0xa')],function(_0x4d5dc1){return{'model':db[_0x4d5dc1[_0x620d('0xc')]],'as':_0x4d5dc1['as'],'attributes':_0x4d5dc1[_0x620d('0x9')],'include':_0x4d5dc1[_0x620d('0xa')]?_['map'](_0x4d5dc1[_0x620d('0xa')],function(_0xb5c8d5){return{'model':db[_0xb5c8d5['model']],'as':_0xb5c8d5['as'],'attributes':_0xb5c8d5[_0x620d('0x9')],'include':_0xb5c8d5['include']?_['map'](_0xb5c8d5['include'],function(_0x43d0e2){return{'model':db[_0x43d0e2[_0x620d('0xc')]],'as':_0x43d0e2['as'],'attributes':_0x43d0e2[_0x620d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x620d('0x15')](function(_0x1390c9){logger[_0x620d('0xd')]('ShowCmHopper',_0x10f0fb);logger[_0x620d('0x16')](_0x620d('0x12'),_0x10f0fb,JSON[_0x620d('0xe')](_0x1390c9));_0x1300c3(_0x1390c9);})[_0x620d('0xf')](function(_0x1f4f29){logger['error'](_0x620d('0x12'),_0x1f4f29['message'],_0x10f0fb);_0x549e30(_0x3d9048['error'](0x1f4,_0x1f4f29[_0x620d('0x11')]));});});};exports[_0x620d('0x17')]=function(_0x2cd83c){var _0x371784=this;return new Promise(function(_0x489268,_0x4a8130){return db[_0x620d('0x6')][_0x620d('0x18')](_0x2cd83c['body'],{'raw':_0x2cd83c[_0x620d('0x7')]?_0x2cd83c[_0x620d('0x7')][_0x620d('0x14')]===undefined?!![]:![]:!![]})[_0x620d('0x15')](function(_0x155939){logger[_0x620d('0xd')](_0x620d('0x17'),_0x2cd83c);logger[_0x620d('0x16')]('CreateCmHopper',_0x2cd83c,JSON[_0x620d('0xe')](_0x155939));_0x489268(_0x155939);})[_0x620d('0xf')](function(_0x20e8d4){logger[_0x620d('0x10')](_0x620d('0x17'),_0x20e8d4['message'],_0x2cd83c);_0x4a8130(_0x371784[_0x620d('0x10')](0x1f4,_0x20e8d4['message']));});});};exports[_0x620d('0x19')]=function(_0x337698){var _0x25defa=this;return new Promise(function(_0x3bb2e0,_0x450107){return db[_0x620d('0x6')][_0x620d('0x1a')](_0x337698[_0x620d('0x1b')],{'raw':_0x337698['options']?_0x337698[_0x620d('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337698[_0x620d('0x7')]?_0x337698[_0x620d('0x7')]['where']||null:null,'attributes':_0x337698['options']?_0x337698[_0x620d('0x7')]['attributes']||null:null,'limit':_0x337698[_0x620d('0x7')]?_0x337698['options']['limit']||null:null})['then'](function(_0x268cf2){logger['info'](_0x620d('0x19'),_0x337698);logger['info'](_0x620d('0x1c'),JSON[_0x620d('0xe')](_0x337698['options'][_0x620d('0x8')]),_0x337698[_0x620d('0x1b')][_0x620d('0x1d')]);logger[_0x620d('0x16')]('UpdateCmHopper',_0x337698,JSON[_0x620d('0xe')](_0x268cf2));_0x3bb2e0(_0x268cf2);})[_0x620d('0xf')](function(_0x55cd80){logger[_0x620d('0x10')](_0x620d('0x19'),_0x55cd80[_0x620d('0x11')],_0x337698);_0x450107(_0x25defa[_0x620d('0x10')](0x1f4,_0x55cd80[_0x620d('0x11')]));});});};exports[_0x620d('0x1e')]=function(_0x56a3dd){var _0x2a8c27=this;return new Promise(function(_0x27f399,_0x3a9fc6){return db['CmHopper'][_0x620d('0x1f')]({'where':_0x56a3dd[_0x620d('0x7')]?_0x56a3dd[_0x620d('0x7')][_0x620d('0x8')]||null:null})['then'](function(_0x19c5bb){logger['info'](_0x620d('0x1e'),_0x56a3dd);logger['debug'](_0x620d('0x1e'),_0x56a3dd,JSON[_0x620d('0xe')](_0x19c5bb));_0x27f399(_0x19c5bb);})['catch'](function(_0x4eb593){logger['error'](_0x620d('0x1e'),_0x4eb593['message'],_0x56a3dd);_0x3a9fc6(_0x2a8c27[_0x620d('0x10')](0x1f4,_0x4eb593[_0x620d('0x11')]));});});};exports['GetContactDialer']=function(_0x53d247){var _0x5b496e=this;return new Promise(function(_0x2ab3dc,_0x4ef31b){return db['CmContact'][_0x620d('0x20')]()[_0x620d('0x15')](function(_0x5c9099){return db[_0x620d('0x21')][_0x620d('0x22')](function(_0x20fa58){return db[_0x620d('0x6')][_0x620d('0x23')]({'where':_0x53d247[_0x620d('0x7')]?_0x53d247[_0x620d('0x7')][_0x620d('0x8')]||null:null,'attributes':_0x53d247[_0x620d('0x7')]?_0x53d247[_0x620d('0x7')][_0x620d('0x9')]||null:null,'limit':_0x53d247['options']?_0x53d247['options'][_0x620d('0x24')]||null:null,'order':_0x53d247[_0x620d('0x7')]?_0x53d247[_0x620d('0x7')][_0x620d('0x25')]||null:null,'transaction':_0x20fa58,'lock':_0x20fa58['LOCK'][_0x620d('0x26')],'include':[{'model':db[_0x620d('0x27')],'as':'Contact','attributes':_[_0x620d('0x28')](_0x5c9099)},{'model':db[_0x620d('0x29')],'as':_0x620d('0x2a'),'attributes':['id',_0x620d('0x2b'),_0x620d('0x2c')]}]})[_0x620d('0x15')](function(_0x498b19){var _0x28ccee=[];var _0x1fdf25=[];for(var _0x4cd182=0x0;_0x4cd182<_0x498b19[_0x620d('0x2d')];_0x4cd182+=0x1){var _0x3cf2a3=_0x498b19[_0x4cd182][_0x620d('0x2e')];if(_0x3cf2a3===null){_0x28ccee[_0x620d('0x2f')](_0x498b19[_0x4cd182]['update'](_0x53d247[_0x620d('0x1b')],{'transaction':_0x20fa58}));}else if(!_0x1fdf25['includes'](_0x3cf2a3)){_0x1fdf25['push'](_0x3cf2a3);_0x28ccee['push'](_0x498b19[_0x4cd182]['update'](_0x53d247[_0x620d('0x1b')],{'transaction':_0x20fa58}));}}return BPromise[_0x620d('0x30')](_0x28ccee);});})['then'](function(_0x49350e){logger['info'](_0x620d('0x31'),_0x53d247);if(_0x49350e['length']>0x0){logger[_0x620d('0xd')](_0x620d('0x32'),_0x49350e[0x0][_0x620d('0x33')]['id'],_0x49350e[0x0][_0x620d('0x33')]['ContactId'],_0x49350e[0x0][_0x620d('0x33')][_0x620d('0x1d')]);}logger[_0x620d('0x16')](_0x620d('0x31'),_0x53d247,JSON[_0x620d('0xe')](_0x49350e));_0x2ab3dc(_0x49350e);})[_0x620d('0xf')](function(_0x372186){logger[_0x620d('0x10')](_0x620d('0x31'),_0x372186[_0x620d('0x11')],_0x53d247);_0x4ef31b(_0x5b496e['error'](0x1f4,_0x372186[_0x620d('0x11')]));});});});};exports[_0x620d('0x34')]=function(_0x3f7c6e){var _0x1b2f2e=this;return new Promise(function(_0x5d80ee,_0x2c24e6){return db[_0x620d('0x21')][_0x620d('0x22')](function(_0x5481bd){return db[_0x620d('0x35')][_0x620d('0x18')](_0x3f7c6e[_0x620d('0x1b')],{'raw':_0x3f7c6e[_0x620d('0x7')]?_0x3f7c6e[_0x620d('0x7')][_0x620d('0x14')]===undefined?!![]:![]:!![],'transaction':_0x5481bd})[_0x620d('0x15')](function(){logger[_0x620d('0xd')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x620d('0xe')](_0x3f7c6e['options'][_0x620d('0x8')]),_0x3f7c6e[_0x620d('0x7')][_0x620d('0x8')][_0x620d('0x1d')]);return db['CmHopper'][_0x620d('0x1f')]({'where':_0x3f7c6e[_0x620d('0x7')]?_0x3f7c6e[_0x620d('0x7')][_0x620d('0x8')]||null:null,'transaction':_0x5481bd});});})['then'](function(_0x14b25b){logger[_0x620d('0xd')](_0x620d('0x34'),_0x3f7c6e);logger['debug'](_0x620d('0x34'),_0x3f7c6e,JSON[_0x620d('0xe')](_0x14b25b));_0x5d80ee(_0x14b25b);})['catch'](function(_0x46d96f){logger['error']('MoveContactManagedDialer',_0x46d96f['message'],_0x3f7c6e);_0x2c24e6(_0x1b2f2e['error'](0x1f4,_0x46d96f[_0x620d('0x11')]));});});};exports['CountReScheduled']=function(_0x10f5c9){var _0x5d3ed9=this;return new Promise(function(_0x576b2,_0x1b5ca9){return db[_0x620d('0x6')]['findAll']({'raw':_0x10f5c9[_0x620d('0x7')]?_0x10f5c9[_0x620d('0x7')][_0x620d('0x14')]===undefined?!![]:![]:!![],'where':_0x10f5c9['options']?_0x10f5c9[_0x620d('0x7')][_0x620d('0x8')]||null:null,'attributes':[[db[_0x620d('0x21')]['fn'](_0x620d('0x36'),db[_0x620d('0x21')]['fn']('IF',db['sequelize'][_0x620d('0x37')](_0x620d('0x38')+util[_0x620d('0x39')](_0x620d('0x3a'),moment()['format'](_0x620d('0x3b')))+'\x20,\x201,\x20null'))),_0x620d('0x3c')]]})[_0x620d('0x15')](function(_0x519cab){logger['info'](_0x620d('0x3d'),_0x10f5c9);logger[_0x620d('0x16')](_0x620d('0x3d'),_0x10f5c9,JSON[_0x620d('0xe')](_0x519cab));_0x576b2(_0x519cab);})[_0x620d('0xf')](function(_0x44f63d){logger['error']('CountReScheduled',_0x44f63d[_0x620d('0x11')],_0x10f5c9);_0x1b5ca9(_0x5d3ed9['error'](0x1f4,_0x44f63d[_0x620d('0x11')]));});});};exports[_0x620d('0x3e')]=function(_0x415c58){var _0x5b3507=this;return new Promise(function(_0x554710,_0x379276){return db[_0x620d('0x27')][_0x620d('0x20')]()[_0x620d('0x15')](function(){return db[_0x620d('0x21')]['transaction'](function(_0x4a4e59){return db[_0x620d('0x6')]['findAll']({'where':_0x415c58['options']?_0x415c58['options']['where']||null:null,'attributes':_0x415c58[_0x620d('0x7')]?_0x415c58[_0x620d('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x415c58[_0x620d('0x7')]?_0x415c58[_0x620d('0x7')][_0x620d('0x25')]||null:null,'group':db['CmHopper'][_0x620d('0x2e')],'transaction':_0x4a4e59,'lock':_0x4a4e59[_0x620d('0x3f')][_0x620d('0x26')],'include':_0x415c58[_0x620d('0x7')]?_0x415c58['options'][_0x620d('0xa')]?_[_0x620d('0xb')](_0x415c58[_0x620d('0x7')][_0x620d('0xa')],function(_0x43c9e8){return{'model':db[_0x43c9e8[_0x620d('0xc')]],'as':_0x43c9e8['as'],'attributes':_0x43c9e8[_0x620d('0x9')],'include':_0x43c9e8[_0x620d('0xa')]?_[_0x620d('0xb')](_0x43c9e8[_0x620d('0xa')],function(_0x2c9728){return{'model':db[_0x2c9728[_0x620d('0xc')]],'as':_0x2c9728['as'],'attributes':_0x2c9728[_0x620d('0x9')],'include':_0x2c9728[_0x620d('0xa')]?_[_0x620d('0xb')](_0x2c9728['include'],function(_0x473d90){return{'model':db[_0x473d90['model']],'as':_0x473d90['as'],'attributes':_0x473d90['attributes']};}):[]};}):[]};}):[]:[]})[_0x620d('0x15')](function(_0x5f488f){var _0x2f3726=[];for(var _0x40be8c=0x0;_0x40be8c<_0x5f488f[_0x620d('0x2d')];_0x40be8c+=0x1){_0x2f3726['push'](_0x5f488f[_0x40be8c][_0x620d('0x1a')](_0x415c58['body'],{'transaction':_0x4a4e59}));}return BPromise[_0x620d('0x30')](_0x2f3726);});})[_0x620d('0x15')](function(_0x129aa7){logger[_0x620d('0xd')](_0x620d('0x3e'),_0x415c58);logger[_0x620d('0x16')]('GetContactRecallMe',_0x415c58,JSON['stringify'](_0x129aa7));_0x554710(_0x129aa7);})[_0x620d('0xf')](function(_0x31f3f7){logger[_0x620d('0x10')](_0x620d('0x3e'),_0x31f3f7[_0x620d('0x11')],_0x415c58);_0x379276(_0x5b3507[_0x620d('0x10')](0x1f4,_0x31f3f7['message']));});});});};exports[_0x620d('0x40')]=function(_0x15093a){var _0x56cabe=this;return new Promise(function(_0x413e2e,_0xd7b2dd){db['CmContact'][_0x620d('0x20')]()['then'](function(_0x1fd464){return db[_0x620d('0x6')][_0x620d('0x23')]({'raw':_0x15093a[_0x620d('0x7')]?_0x15093a[_0x620d('0x7')][_0x620d('0x14')]===undefined?!![]:![]:!![],'where':_0x15093a[_0x620d('0x7')]?_0x15093a['options'][_0x620d('0x8')]||null:null,'attributes':_0x15093a[_0x620d('0x7')]?_0x15093a[_0x620d('0x7')]['attributes']||null:null,'limit':_0x15093a[_0x620d('0x7')]?_0x15093a[_0x620d('0x7')][_0x620d('0x24')]||null:null,'include':_0x15093a[_0x620d('0x7')]?_0x15093a[_0x620d('0x7')][_0x620d('0xa')]?_[_0x620d('0xb')](_0x15093a[_0x620d('0x7')]['include'],function(_0x5304fe){return{'model':db[_0x5304fe['model']],'as':_0x5304fe['as'],'attributes':_0x5304fe['as']===_0x620d('0x41')?_['keys'](_0x1fd464):_0x5304fe[_0x620d('0x9')],'include':_0x5304fe['include']?_['map'](_0x5304fe[_0x620d('0xa')],function(_0x366a70){return{'model':db[_0x366a70[_0x620d('0xc')]],'as':_0x366a70['as'],'attributes':_0x366a70[_0x620d('0x9')],'include':_0x366a70[_0x620d('0xa')]?_['map'](_0x366a70[_0x620d('0xa')],function(_0x19091d){return{'model':db[_0x19091d[_0x620d('0xc')]],'as':_0x19091d['as'],'attributes':_0x19091d[_0x620d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x620d('0x15')](function(_0x52ab0f){logger[_0x620d('0xd')]('GetCmHopper',_0x15093a);logger[_0x620d('0x16')]('GetCmHopper',_0x15093a,JSON[_0x620d('0xe')](_0x52ab0f));_0x413e2e(_0x52ab0f);})['catch'](function(_0x588aa2){logger['error'](_0x620d('0x5'),_0x588aa2[_0x620d('0x11')],_0x15093a);_0xd7b2dd(_0x56cabe['error'](0x1f4,_0x588aa2[_0x620d('0x11')]));});});});};exports[_0x620d('0x42')]=function(_0xa91808){var _0xfb375b=this;return new Promise(function(_0x106261,_0x398d2d){return db[_0x620d('0x27')][_0x620d('0x43')]({'raw':!![],'where':{'phone':_0xa91808['options'][_0x620d('0x8')][_0x620d('0x44')]},'attributes':['id',_0x620d('0x45')],'order':[['id',_0x620d('0x46')]]})['then'](function(_0x9f36da){logger['info'](_0x620d('0x47'),_0xa91808);logger[_0x620d('0x16')](_0x620d('0x47'),_0xa91808,JSON['stringify'](_0x9f36da));_0x106261(_0x9f36da);})[_0x620d('0xf')](function(_0x4d4e79){logger[_0x620d('0x10')](_0x620d('0x47'),_0x4d4e79[_0x620d('0x11')],_0xa91808);_0x398d2d(_0xfb375b[_0x620d('0x10')](0x1f4,_0x4d4e79[_0x620d('0x11')]));});});};exports['ResetActiveCalls']=function(_0x17e780){var _0x2bfb4a=this;return new Promise(function(_0x3ac65d,_0x1a3387){return db[_0x620d('0x21')][_0x620d('0x22')](function(_0x114b4e){var _0x9eb586=_0x17e780['options']&&_0x17e780['options']['where']?_0x17e780[_0x620d('0x7')]['where']:{};return db[_0x620d('0x6')][_0x620d('0x1a')](_0x17e780[_0x620d('0x1b')],{'where':_0x9eb586,'transaction':_0x114b4e})['then'](function(_0x491442){logger[_0x620d('0xd')](_0x620d('0x48'),_0x17e780);logger[_0x620d('0x16')](_0x620d('0x48'),_0x17e780,JSON[_0x620d('0xe')](_0x491442));_0x3ac65d(_0x491442);})['catch'](function(_0xe80da9){logger[_0x620d('0x10')](_0x620d('0x48'),_0xe80da9['message'],_0x17e780);_0x1a3387(_0x2bfb4a['error'](0x1f4,_0xe80da9[_0x620d('0x11')]));});});});};exports[_0x620d('0x49')]=function(_0x2f48cf){var _0x1a03db=this;var _0x5e816b=_0x2f48cf[_0x620d('0x1b')]['where'][_0x620d('0x4a')];var _0x527b23=_0x2f48cf[_0x620d('0x1b')]['where'][_0x620d('0x4b')];var _0x49baf3=_0x2f48cf[_0x620d('0x1b')][_0x620d('0x8')][_0x620d('0x4c')];return new Promise(function(_0x24ffdb,_0x182129){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x5e816b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x620d('0x21')][_0x620d('0x37')](_0x620d('0x4d')+_0x527b23+_0x620d('0x4e')),'$gt':db[_0x620d('0x21')][_0x620d('0x37')](_0x620d('0x4f'))}},'UserId':{'$in':_0x49baf3}},'include':[{'model':db[_0x620d('0x27')],'as':_0x620d('0x41')},{'model':db['User'],'as':'Agent','attributes':['id',_0x620d('0x2b'),_0x620d('0x2c')]},{'model':db['CmList'],'as':'List'}]})[_0x620d('0x15')](function(_0x4d18a5){if(_0x4d18a5[_0x620d('0x2d')]>0x0){return db[_0x620d('0x21')][_0x620d('0x22')](function(_0xbfc003){return db['CmHopper'][_0x620d('0x1a')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0x620d('0x4f'))},{'where':{'id':{'$in':_[_0x620d('0xb')](_0x4d18a5,'id')}},'transaction':_0xbfc003})[_0x620d('0x15')](function(){_0x24ffdb(_0x4d18a5);})[_0x620d('0xf')](function(_0x3ef61c){logger['error'](_0x620d('0x49'),_0x3ef61c[_0x620d('0x11')],_0x2f48cf);_0x182129(_0x1a03db[_0x620d('0x10')](0x1f4,_0x3ef61c[_0x620d('0x11')]));});})[_0x620d('0xf')](function(_0xfcf4c3){logger[_0x620d('0x10')](_0x620d('0x49'),_0xfcf4c3[_0x620d('0x11')],_0x2f48cf);_0x182129(_0x1a03db[_0x620d('0x10')](0x1f4,_0xfcf4c3['message']));});}else{_0x24ffdb(_0x4d18a5);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 44276ea..ea08cd1 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 _0x935d=['getPreview','/timezone','getTimezone','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','/timezones','/:id','show','getPreviewRecall','create','post'];(function(_0x85d355,_0x546c82){var _0x31057a=function(_0x5d5dbc){while(--_0x5d5dbc){_0x85d355['push'](_0x85d355['shift']());}};_0x31057a(++_0x546c82);}(_0x935d,0xa5));var _0xd935=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x935d[_0x4bacb6];return _0x58c029;};'use strict';var express=require(_0xd935('0x0'));var router=express[_0xd935('0x1')]();var auth=require(_0xd935('0x2'));var controller=require(_0xd935('0x3'));router[_0xd935('0x4')]('/',auth[_0xd935('0x5')](),controller[_0xd935('0x6')]);router[_0xd935('0x4')]('/describe',auth[_0xd935('0x5')](),controller['describe']);router['get'](_0xd935('0x7'),auth[_0xd935('0x5')](),controller[_0xd935('0x8')]);router['get'](_0xd935('0x9'),auth[_0xd935('0x5')](),controller['getTimezones']);router['get'](_0xd935('0xa'),auth[_0xd935('0x5')](),controller[_0xd935('0xb')]);router[_0xd935('0x4')]('/:id/previewrecall',auth[_0xd935('0x5')](),controller[_0xd935('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd935('0xd')]);router[_0xd935('0xe')]('/preview',auth[_0xd935('0x5')](),controller[_0xd935('0xf')]);router[_0xd935('0xe')](_0xd935('0x10'),auth[_0xd935('0x5')](),controller[_0xd935('0x11')]);router['put'](_0xd935('0xa'),auth[_0xd935('0x5')](),controller['update']);router[_0xd935('0x12')]('/:id',auth[_0xd935('0x5')](),controller[_0xd935('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd35c=['get','isAuthenticated','index','describe','getOpenContacts','/timezones','getTimezones','/:id','show','/preview','/timezone','getTimezone','put','update','destroy','exports','Router','./cmHopper.controller'];(function(_0x3c2f47,_0x1a8813){var _0x509acf=function(_0x41489a){while(--_0x41489a){_0x3c2f47['push'](_0x3c2f47['shift']());}};_0x509acf(++_0x1a8813);}(_0xd35c,0xe8));var _0xcd35=function(_0x3a1491,_0x2c67df){_0x3a1491=_0x3a1491-0x0;var _0x49003a=_0xd35c[_0x3a1491];return _0x49003a;};'use strict';var express=require('express');var router=express[_0xcd35('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xcd35('0x1'));router[_0xcd35('0x2')]('/',auth[_0xcd35('0x3')](),controller[_0xcd35('0x4')]);router[_0xcd35('0x2')]('/describe',auth[_0xcd35('0x3')](),controller[_0xcd35('0x5')]);router[_0xcd35('0x2')]('/opencontacts',auth[_0xcd35('0x3')](),controller[_0xcd35('0x6')]);router[_0xcd35('0x2')](_0xcd35('0x7'),auth[_0xcd35('0x3')](),controller[_0xcd35('0x8')]);router[_0xcd35('0x2')](_0xcd35('0x9'),auth['isAuthenticated'](),controller[_0xcd35('0xa')]);router[_0xcd35('0x2')]('/:id/previewrecall',auth['isAuthenticated'](),controller['getPreviewRecall']);router['post']('/',auth[_0xcd35('0x3')](),controller['create']);router['post'](_0xcd35('0xb'),auth[_0xcd35('0x3')](),controller['getPreview']);router['post'](_0xcd35('0xc'),auth['isAuthenticated'](),controller[_0xcd35('0xd')]);router[_0xcd35('0xe')](_0xcd35('0x9'),auth[_0xcd35('0x3')](),controller[_0xcd35('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcd35('0x10')]);module[_0xcd35('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 8fd01cd..6a16e9f 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 _0x95f4=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x95f4,0x190));var _0x495f=function(_0x371bed,_0x3480ea){_0x371bed=_0x371bed-0x0;var _0x1405f2=_0x95f4[_0x371bed];return _0x1405f2;};'use strict';var moment=require(_0x495f('0x0'));var Sequelize=require(_0x495f('0x1'));module[_0x495f('0x2')]={'CmHopperId':{'type':Sequelize[_0x495f('0x3')]},'phone':{'type':Sequelize[_0x495f('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x495f('0x5')],'defaultValue':moment()['format'](_0x495f('0x6'))},'countbusyretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x495f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8143=['moment','sequelize','INTEGER','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x8143,0x124));var _0x3814=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8143[_0x40a045];return _0x1a687c;};'use strict';var moment=require(_0x3814('0x0'));var Sequelize=require(_0x3814('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x3814('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x3814('0x3'))},'countbusyretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3814('0x2')],'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 b4fb27c..07209ea 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 _0xc39a=['limit','offset','count','set','Content-Range','apply','reject','update','then','get','error','name','send','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined'];(function(_0x3ed4fc,_0x3678d7){var _0x2fd4d4=function(_0x543f2c){while(--_0x543f2c){_0x3ed4fc['push'](_0x3ed4fc['shift']());}};_0x2fd4d4(++_0x3678d7);}(_0xc39a,0x130));var _0xac39=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc39a[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xac39('0x0'));var rimraf=require(_0xac39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac39('0x2'));var moment=require(_0xac39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac39('0x4'));var util=require(_0xac39('0x5'));var path=require(_0xac39('0x6'));var sox=require(_0xac39('0x7'));var csv=require(_0xac39('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac39('0x9'));var _=require('lodash');var squel=require(_0xac39('0xa'));var crypto=require('crypto');var jsforce=require(_0xac39('0xb'));var deskjs=require(_0xac39('0xc'));var toCsv=require(_0xac39('0x8'));var querystring=require(_0xac39('0xd'));var Papa=require(_0xac39('0xe'));var Redis=require(_0xac39('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xac39('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac39('0x11'))(_0xac39('0x12'));var utils=require(_0xac39('0x13'));var config=require(_0xac39('0x14'));var licenseUtil=require(_0xac39('0x15'));var db=require(_0xac39('0x16'))['db'];function respondWithStatusCode(_0x4e83d0,_0x192793){_0x192793=_0x192793||0xcc;return function(_0xa37405){if(_0xa37405){return _0x4e83d0[_0xac39('0x17')](_0x192793);}return _0x4e83d0['status'](_0x192793)[_0xac39('0x18')]();};}function respondWithResult(_0x4310dc,_0x3b60dc){_0x3b60dc=_0x3b60dc||0xc8;return function(_0x4aeb4b){if(_0x4aeb4b){return _0x4310dc[_0xac39('0x19')](_0x3b60dc)[_0xac39('0x1a')](_0x4aeb4b);}};}function respondWithFilteredResult(_0x1013bb,_0x3675f6){return function(_0x30d88b){if(_0x30d88b){var _0x148255=typeof _0x3675f6['offset']===_0xac39('0x1b')&&typeof _0x3675f6[_0xac39('0x1c')]===_0xac39('0x1b');var _0x3f630e=_0x30d88b['count'];var _0x444459=_0x148255?0x0:_0x3675f6[_0xac39('0x1d')];var _0x314df6=_0x148255?_0x30d88b[_0xac39('0x1e')]:_0x3675f6[_0xac39('0x1d')]+_0x3675f6['limit'];var _0x238859;if(_0x314df6>=_0x3f630e){_0x314df6=_0x3f630e;_0x238859=0xc8;}else{_0x238859=0xce;}_0x1013bb[_0xac39('0x19')](_0x238859);return _0x1013bb[_0xac39('0x1f')](_0xac39('0x20'),_0x444459+'-'+_0x314df6+'/'+_0x3f630e)[_0xac39('0x1a')](_0x30d88b);}return null;};}function patchUpdates(_0x45ec28){return function(_0x51d922){try{jsonpatch[_0xac39('0x21')](_0x51d922,_0x45ec28,!![]);}catch(_0x2f619b){return BPromise[_0xac39('0x22')](_0x2f619b);}return _0x51d922['save']();};}function saveUpdates(_0x285511,_0x1ff01b){return function(_0x5bf22b){if(_0x5bf22b){return _0x5bf22b[_0xac39('0x23')](_0x285511)[_0xac39('0x24')](function(_0x2bd616){return _0x2bd616;});}return null;};}function removeEntity(_0x4e6f48,_0x4d3312){return function(_0x113953){if(_0x113953){return _0x113953['destroy']()[_0xac39('0x24')](function(){var _0x45b90e=_0x113953[_0xac39('0x25')]({'plain':!![]});var _0x41fc2c='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x41fc2c,'resourceId':_0x45b90e['id']}})[_0xac39('0x24')](function(){return _0x113953;});})[_0xac39('0x24')](function(){_0x4e6f48[_0xac39('0x19')](0xcc)[_0xac39('0x18')]();});}};}function handleEntityNotFound(_0x58fc4a,_0x13ee11){return function(_0x1e50ba){if(!_0x1e50ba){_0x58fc4a[_0xac39('0x17')](0x194);}return _0x1e50ba;};}function handleError(_0x56f9c3,_0x14fcda){_0x14fcda=_0x14fcda||0x1f4;return function(_0xae05fe){logger[_0xac39('0x26')](_0xae05fe['stack']);if(_0xae05fe[_0xac39('0x27')]){delete _0xae05fe['name'];}_0x56f9c3[_0xac39('0x19')](_0x14fcda)[_0xac39('0x28')](_0xae05fe);};}exports['index']=function(_0x289015,_0x544d2f){var _0xa6dbdb={},_0x63e88={},_0xb5622e={'count':0x0,'rows':[]};var _0xb192fc=_[_0xac39('0x29')](db[_0xac39('0x2a')]['rawAttributes'],function(_0x17ca46){return{'name':_0x17ca46[_0xac39('0x2b')],'type':_0x17ca46[_0xac39('0x2c')][_0xac39('0x2d')]};});_0x63e88[_0xac39('0x2e')]=_['map'](_0xb192fc,_0xac39('0x27'));_0x63e88[_0xac39('0x2f')]=_[_0xac39('0x30')](_0x289015[_0xac39('0x2f')]);_0x63e88[_0xac39('0x31')]=_[_0xac39('0x32')](_0x63e88[_0xac39('0x2e')],_0x63e88[_0xac39('0x2f')]);_0xa6dbdb[_0xac39('0x33')]=_[_0xac39('0x32')](_0x63e88[_0xac39('0x2e')],qs[_0xac39('0x34')](_0x289015['query'][_0xac39('0x34')]));_0xa6dbdb[_0xac39('0x33')]=_0xa6dbdb[_0xac39('0x33')][_0xac39('0x35')]?_0xa6dbdb[_0xac39('0x33')]:_0x63e88[_0xac39('0x2e')];if(!_0x289015[_0xac39('0x2f')][_0xac39('0x36')]('nolimit')){_0xa6dbdb[_0xac39('0x1c')]=qs[_0xac39('0x1c')](_0x289015[_0xac39('0x2f')][_0xac39('0x1c')]);_0xa6dbdb[_0xac39('0x1d')]=qs[_0xac39('0x1d')](_0x289015[_0xac39('0x2f')]['offset']);}_0xa6dbdb[_0xac39('0x37')]=qs[_0xac39('0x38')](_0x289015[_0xac39('0x2f')][_0xac39('0x38')]);_0xa6dbdb[_0xac39('0x39')]=qs[_0xac39('0x31')](_[_0xac39('0x3a')](_0x289015['query'],_0x63e88['filters']),_0xb192fc);if(_0x289015[_0xac39('0x2f')][_0xac39('0x3b')]){_0xa6dbdb[_0xac39('0x39')]=_[_0xac39('0x3c')](_0xa6dbdb[_0xac39('0x39')],{'$or':_[_0xac39('0x29')](_0xb192fc,function(_0x118b84){if(_0x118b84['type']!==_0xac39('0x3d')){var _0x1e46e7={};_0x1e46e7[_0x118b84[_0xac39('0x27')]]={'$like':'%'+_0x289015['query']['filter']+'%'};return _0x1e46e7;}})});}_0xa6dbdb=_[_0xac39('0x3c')]({},_0xa6dbdb,_0x289015['options']);var _0x314c73={'where':_0xa6dbdb[_0xac39('0x39')]};return db[_0xac39('0x2a')]['count'](_0x314c73)[_0xac39('0x24')](function(_0x194acf){_0xb5622e[_0xac39('0x1e')]=_0x194acf;if(_0x289015[_0xac39('0x2f')][_0xac39('0x3e')]){_0xa6dbdb[_0xac39('0x3f')]=[{'all':!![]}];}return db[_0xac39('0x2a')][_0xac39('0x40')](_0xa6dbdb);})[_0xac39('0x24')](function(_0x9e709){_0xb5622e[_0xac39('0x41')]=_0x9e709;return _0xb5622e;})[_0xac39('0x24')](respondWithFilteredResult(_0x544d2f,_0xa6dbdb))['catch'](handleError(_0x544d2f,null));};exports[_0xac39('0x42')]=function(_0x301975,_0x278e74){var _0x1ed97b={'raw':!![],'where':{'id':_0x301975['params']['id']}},_0x1e153c={};_0x1e153c['model']=_['keys'](db['CmHopperAdditionalPhone'][_0xac39('0x43')]);_0x1e153c[_0xac39('0x2f')]=_[_0xac39('0x30')](_0x301975[_0xac39('0x2f')]);_0x1e153c['filters']=_['intersection'](_0x1e153c[_0xac39('0x2e')],_0x1e153c['query']);_0x1ed97b['attributes']=_[_0xac39('0x32')](_0x1e153c[_0xac39('0x2e')],qs[_0xac39('0x34')](_0x301975[_0xac39('0x2f')]['fields']));_0x1ed97b[_0xac39('0x33')]=_0x1ed97b[_0xac39('0x33')]['length']?_0x1ed97b[_0xac39('0x33')]:_0x1e153c[_0xac39('0x2e')];if(_0x301975[_0xac39('0x2f')][_0xac39('0x3e')]){_0x1ed97b[_0xac39('0x3f')]=[{'all':!![]}];}_0x1ed97b=_[_0xac39('0x3c')]({},_0x1ed97b,_0x301975[_0xac39('0x44')]);return db[_0xac39('0x2a')][_0xac39('0x45')](_0x1ed97b)[_0xac39('0x24')](handleEntityNotFound(_0x278e74,null))[_0xac39('0x24')](respondWithResult(_0x278e74,null))[_0xac39('0x46')](handleError(_0x278e74,null));};exports[_0xac39('0x47')]=function(_0x5f19dc,_0x465df6){return db[_0xac39('0x2a')][_0xac39('0x47')](_0x5f19dc[_0xac39('0x48')],{})[_0xac39('0x24')](function(_0x102d30){var _0x2a4b1=_0x5f19dc[_0xac39('0x49')]['get']({'plain':!![]});if(!_0x2a4b1)throw new Error(_0xac39('0x4a'));if(_0x2a4b1['role']===_0xac39('0x49')){var _0x19a76f=_0x102d30[_0xac39('0x25')]({'plain':!![]});var _0x39c62c=_0xac39('0x4b');return db[_0xac39('0x4c')]['find']({'where':{'name':_0x39c62c,'userProfileId':_0x2a4b1[_0xac39('0x4d')]},'raw':!![]})['then'](function(_0x3d0471){if(_0x3d0471&&_0x3d0471[_0xac39('0x4e')]===0x0){return db[_0xac39('0x4f')][_0xac39('0x47')]({'name':_0x19a76f[_0xac39('0x27')],'resourceId':_0x19a76f['id'],'type':_0x3d0471[_0xac39('0x27')],'sectionId':_0x3d0471['id']},{})['then'](function(){return _0x102d30;});}else{return _0x102d30;}})[_0xac39('0x46')](function(_0x48ce9b){logger[_0xac39('0x26')](_0xac39('0x50'),_0x48ce9b);throw _0x48ce9b;});}return _0x102d30;})[_0xac39('0x24')](respondWithResult(_0x465df6,0xc9))[_0xac39('0x46')](handleError(_0x465df6,null));};exports[_0xac39('0x23')]=function(_0x10e90c,_0x5eb3b0){if(_0x10e90c[_0xac39('0x48')]['id']){delete _0x10e90c[_0xac39('0x48')]['id'];}return db[_0xac39('0x2a')]['find']({'where':{'id':_0x10e90c[_0xac39('0x51')]['id']}})[_0xac39('0x24')](handleEntityNotFound(_0x5eb3b0,null))[_0xac39('0x24')](saveUpdates(_0x10e90c[_0xac39('0x48')],null))[_0xac39('0x24')](respondWithResult(_0x5eb3b0,null))[_0xac39('0x46')](handleError(_0x5eb3b0,null));};exports[_0xac39('0x52')]=function(_0x17eee1,_0x2d5110){return db[_0xac39('0x2a')][_0xac39('0x45')]({'where':{'id':_0x17eee1[_0xac39('0x51')]['id']}})[_0xac39('0x24')](handleEntityNotFound(_0x2d5110,null))[_0xac39('0x24')](removeEntity(_0x2d5110,null))[_0xac39('0x46')](handleError(_0x2d5110,null));}; \ No newline at end of file +var _0xe41c=['end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x17723c,_0x1ea81d){var _0x1ffbf3=function(_0x5276cd){while(--_0x5276cd){_0x17723c['push'](_0x17723c['shift']());}};_0x1ffbf3(++_0x1ea81d);}(_0xe41c,0x13f));var _0xce41=function(_0x49cb37,_0x5d6890){_0x49cb37=_0x49cb37-0x0;var _0x50c29b=_0xe41c[_0x49cb37];return _0x50c29b;};'use strict';var emlformat=require(_0xce41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce41('0x1'));var jsonpatch=require(_0xce41('0x2'));var rp=require(_0xce41('0x3'));var moment=require(_0xce41('0x4'));var BPromise=require(_0xce41('0x5'));var Mustache=require(_0xce41('0x6'));var util=require(_0xce41('0x7'));var path=require(_0xce41('0x8'));var sox=require(_0xce41('0x9'));var csv=require(_0xce41('0xa'));var ejs=require(_0xce41('0xb'));var fs=require('fs');var fs_extra=require(_0xce41('0xc'));var _=require(_0xce41('0xd'));var squel=require(_0xce41('0xe'));var crypto=require(_0xce41('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xce41('0x10'));var toCsv=require(_0xce41('0xa'));var querystring=require('querystring');var Papa=require(_0xce41('0x11'));var Redis=require('ioredis');var authService=require(_0xce41('0x12'));var qs=require(_0xce41('0x13'));var as=require(_0xce41('0x14'));var hardwareService=require(_0xce41('0x15'));var logger=require(_0xce41('0x16'))(_0xce41('0x17'));var utils=require('../../config/utils');var config=require(_0xce41('0x18'));var licenseUtil=require(_0xce41('0x19'));var db=require(_0xce41('0x1a'))['db'];function respondWithStatusCode(_0x9c653a,_0x1b62f6){_0x1b62f6=_0x1b62f6||0xcc;return function(_0xe30a1a){if(_0xe30a1a){return _0x9c653a[_0xce41('0x1b')](_0x1b62f6);}return _0x9c653a[_0xce41('0x1c')](_0x1b62f6)[_0xce41('0x1d')]();};}function respondWithResult(_0x4154a6,_0x5664d1){_0x5664d1=_0x5664d1||0xc8;return function(_0x17b133){if(_0x17b133){return _0x4154a6[_0xce41('0x1c')](_0x5664d1)[_0xce41('0x1e')](_0x17b133);}};}function respondWithFilteredResult(_0x4a9de0,_0x18c6cf){return function(_0x278164){if(_0x278164){var _0x156fd7=typeof _0x18c6cf['offset']==='undefined'&&typeof _0x18c6cf[_0xce41('0x1f')]===_0xce41('0x20');var _0x5c8f16=_0x278164['count'];var _0x53c177=_0x156fd7?0x0:_0x18c6cf[_0xce41('0x21')];var _0x509c61=_0x156fd7?_0x278164[_0xce41('0x22')]:_0x18c6cf['offset']+_0x18c6cf[_0xce41('0x1f')];var _0x547adf;if(_0x509c61>=_0x5c8f16){_0x509c61=_0x5c8f16;_0x547adf=0xc8;}else{_0x547adf=0xce;}_0x4a9de0[_0xce41('0x1c')](_0x547adf);return _0x4a9de0[_0xce41('0x23')](_0xce41('0x24'),_0x53c177+'-'+_0x509c61+'/'+_0x5c8f16)[_0xce41('0x1e')](_0x278164);}return null;};}function patchUpdates(_0xcd6d7a){return function(_0x30cad6){try{jsonpatch[_0xce41('0x25')](_0x30cad6,_0xcd6d7a,!![]);}catch(_0x316548){return BPromise[_0xce41('0x26')](_0x316548);}return _0x30cad6[_0xce41('0x27')]();};}function saveUpdates(_0x4bf7f8,_0x19f879){return function(_0x1fb501){if(_0x1fb501){return _0x1fb501[_0xce41('0x28')](_0x4bf7f8)[_0xce41('0x29')](function(_0x5c2675){return _0x5c2675;});}return null;};}function removeEntity(_0x563bbd,_0x15ef02){return function(_0x37cc11){if(_0x37cc11){return _0x37cc11['destroy']()[_0xce41('0x29')](function(){var _0x181ff4=_0x37cc11[_0xce41('0x2a')]({'plain':!![]});var _0x31d864=_0xce41('0x2b');return db[_0xce41('0x2c')]['destroy']({'where':{'type':_0x31d864,'resourceId':_0x181ff4['id']}})[_0xce41('0x29')](function(){return _0x37cc11;});})['then'](function(){_0x563bbd[_0xce41('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3af2,_0x5894f4){return function(_0x4d0db3){if(!_0x4d0db3){_0x1f3af2[_0xce41('0x1b')](0x194);}return _0x4d0db3;};}function handleError(_0x53e44b,_0x3afde6){_0x3afde6=_0x3afde6||0x1f4;return function(_0x37e306){logger[_0xce41('0x2d')](_0x37e306[_0xce41('0x2e')]);if(_0x37e306[_0xce41('0x2f')]){delete _0x37e306[_0xce41('0x2f')];}_0x53e44b['status'](_0x3afde6)[_0xce41('0x30')](_0x37e306);};}exports[_0xce41('0x31')]=function(_0xd4a1e8,_0x5f0925){var _0x2d8c94={},_0x593b6b={},_0x149814={'count':0x0,'rows':[]};var _0x3f76ae=_[_0xce41('0x32')](db[_0xce41('0x33')]['rawAttributes'],function(_0x293930){return{'name':_0x293930[_0xce41('0x34')],'type':_0x293930[_0xce41('0x35')][_0xce41('0x36')]};});_0x593b6b[_0xce41('0x37')]=_[_0xce41('0x32')](_0x3f76ae,_0xce41('0x2f'));_0x593b6b['query']=_[_0xce41('0x38')](_0xd4a1e8[_0xce41('0x39')]);_0x593b6b[_0xce41('0x3a')]=_[_0xce41('0x3b')](_0x593b6b[_0xce41('0x37')],_0x593b6b['query']);_0x2d8c94[_0xce41('0x3c')]=_[_0xce41('0x3b')](_0x593b6b[_0xce41('0x37')],qs[_0xce41('0x3d')](_0xd4a1e8[_0xce41('0x39')][_0xce41('0x3d')]));_0x2d8c94['attributes']=_0x2d8c94[_0xce41('0x3c')][_0xce41('0x3e')]?_0x2d8c94['attributes']:_0x593b6b[_0xce41('0x37')];if(!_0xd4a1e8[_0xce41('0x39')][_0xce41('0x3f')]('nolimit')){_0x2d8c94[_0xce41('0x1f')]=qs[_0xce41('0x1f')](_0xd4a1e8[_0xce41('0x39')][_0xce41('0x1f')]);_0x2d8c94[_0xce41('0x21')]=qs[_0xce41('0x21')](_0xd4a1e8[_0xce41('0x39')]['offset']);}_0x2d8c94[_0xce41('0x40')]=qs['sort'](_0xd4a1e8[_0xce41('0x39')][_0xce41('0x41')]);_0x2d8c94[_0xce41('0x42')]=qs[_0xce41('0x3a')](_[_0xce41('0x43')](_0xd4a1e8[_0xce41('0x39')],_0x593b6b[_0xce41('0x3a')]),_0x3f76ae);if(_0xd4a1e8[_0xce41('0x39')][_0xce41('0x44')]){_0x2d8c94['where']=_[_0xce41('0x45')](_0x2d8c94[_0xce41('0x42')],{'$or':_[_0xce41('0x32')](_0x3f76ae,function(_0x550c49){if(_0x550c49[_0xce41('0x35')]!==_0xce41('0x46')){var _0x4a0553={};_0x4a0553[_0x550c49['name']]={'$like':'%'+_0xd4a1e8[_0xce41('0x39')][_0xce41('0x44')]+'%'};return _0x4a0553;}})});}_0x2d8c94=_[_0xce41('0x45')]({},_0x2d8c94,_0xd4a1e8[_0xce41('0x47')]);var _0x270203={'where':_0x2d8c94['where']};return db['CmHopperAdditionalPhone'][_0xce41('0x22')](_0x270203)[_0xce41('0x29')](function(_0x350de6){_0x149814[_0xce41('0x22')]=_0x350de6;if(_0xd4a1e8[_0xce41('0x39')][_0xce41('0x48')]){_0x2d8c94[_0xce41('0x49')]=[{'all':!![]}];}return db[_0xce41('0x33')][_0xce41('0x4a')](_0x2d8c94);})[_0xce41('0x29')](function(_0x3e6b7a){_0x149814['rows']=_0x3e6b7a;return _0x149814;})['then'](respondWithFilteredResult(_0x5f0925,_0x2d8c94))[_0xce41('0x4b')](handleError(_0x5f0925,null));};exports[_0xce41('0x4c')]=function(_0x4f30dc,_0x428b2c){var _0x44f054={'raw':!![],'where':{'id':_0x4f30dc['params']['id']}},_0x521d92={};_0x521d92['model']=_[_0xce41('0x38')](db['CmHopperAdditionalPhone'][_0xce41('0x4d')]);_0x521d92[_0xce41('0x39')]=_[_0xce41('0x38')](_0x4f30dc[_0xce41('0x39')]);_0x521d92[_0xce41('0x3a')]=_[_0xce41('0x3b')](_0x521d92[_0xce41('0x37')],_0x521d92[_0xce41('0x39')]);_0x44f054['attributes']=_['intersection'](_0x521d92[_0xce41('0x37')],qs[_0xce41('0x3d')](_0x4f30dc[_0xce41('0x39')]['fields']));_0x44f054['attributes']=_0x44f054[_0xce41('0x3c')][_0xce41('0x3e')]?_0x44f054['attributes']:_0x521d92['model'];if(_0x4f30dc[_0xce41('0x39')][_0xce41('0x48')]){_0x44f054['include']=[{'all':!![]}];}_0x44f054=_['merge']({},_0x44f054,_0x4f30dc[_0xce41('0x47')]);return db[_0xce41('0x33')][_0xce41('0x4e')](_0x44f054)['then'](handleEntityNotFound(_0x428b2c,null))[_0xce41('0x29')](respondWithResult(_0x428b2c,null))[_0xce41('0x4b')](handleError(_0x428b2c,null));};exports[_0xce41('0x4f')]=function(_0x531ddb,_0x5d3ba5){return db[_0xce41('0x33')][_0xce41('0x4f')](_0x531ddb[_0xce41('0x50')],{})['then'](function(_0x2e566f){var _0x46fb90=_0x531ddb[_0xce41('0x51')]['get']({'plain':!![]});if(!_0x46fb90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46fb90[_0xce41('0x52')]==='user'){var _0x3f84ef=_0x2e566f[_0xce41('0x2a')]({'plain':!![]});var _0x4e95a6=_0xce41('0x2b');return db[_0xce41('0x53')][_0xce41('0x4e')]({'where':{'name':_0x4e95a6,'userProfileId':_0x46fb90['userProfileId']},'raw':!![]})['then'](function(_0x4e9691){if(_0x4e9691&&_0x4e9691[_0xce41('0x54')]===0x0){return db[_0xce41('0x2c')][_0xce41('0x4f')]({'name':_0x3f84ef['name'],'resourceId':_0x3f84ef['id'],'type':_0x4e9691[_0xce41('0x2f')],'sectionId':_0x4e9691['id']},{})[_0xce41('0x29')](function(){return _0x2e566f;});}else{return _0x2e566f;}})[_0xce41('0x4b')](function(_0x2851bc){logger[_0xce41('0x2d')](_0xce41('0x55'),_0x2851bc);throw _0x2851bc;});}return _0x2e566f;})[_0xce41('0x29')](respondWithResult(_0x5d3ba5,0xc9))[_0xce41('0x4b')](handleError(_0x5d3ba5,null));};exports[_0xce41('0x28')]=function(_0x1167f2,_0x23c0cb){if(_0x1167f2[_0xce41('0x50')]['id']){delete _0x1167f2['body']['id'];}return db[_0xce41('0x33')][_0xce41('0x4e')]({'where':{'id':_0x1167f2[_0xce41('0x56')]['id']}})[_0xce41('0x29')](handleEntityNotFound(_0x23c0cb,null))['then'](saveUpdates(_0x1167f2[_0xce41('0x50')],null))[_0xce41('0x29')](respondWithResult(_0x23c0cb,null))[_0xce41('0x4b')](handleError(_0x23c0cb,null));};exports['destroy']=function(_0xafbf39,_0x5558e6){return db['CmHopperAdditionalPhone'][_0xce41('0x4e')]({'where':{'id':_0xafbf39[_0xce41('0x56')]['id']}})[_0xce41('0x29')](handleEntityNotFound(_0x5558e6,null))[_0xce41('0x29')](removeEntity(_0x5558e6,null))[_0xce41('0x4b')](handleError(_0x5558e6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f25f90b..37bb91e 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 _0xb0c2=['request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x436873,_0x3f6143){var _0x333709=function(_0x272272){while(--_0x272272){_0x436873['push'](_0x436873['shift']());}};_0x333709(++_0x3f6143);}(_0xb0c2,0x1aa));var _0x2b0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b0c('0x0'));var util=require(_0x2b0c('0x1'));var logger=require(_0x2b0c('0x2'))(_0x2b0c('0x3'));var moment=require(_0x2b0c('0x4'));var BPromise=require(_0x2b0c('0x5'));var rp=require(_0x2b0c('0x6'));var fs=require('fs');var path=require(_0x2b0c('0x7'));var rimraf=require('rimraf');var config=require(_0x2b0c('0x8'));var attributes=require(_0x2b0c('0x9'));module[_0x2b0c('0xa')]=function(_0x5080d0,_0x55fc15){return _0x5080d0[_0x2b0c('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61af=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util'];(function(_0xb8dcd7,_0x5d832b){var _0x121a74=function(_0x5af714){while(--_0x5af714){_0xb8dcd7['push'](_0xb8dcd7['shift']());}};_0x121a74(++_0x5d832b);}(_0x61af,0x196));var _0xf61a=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x61af[_0x1b745b];return _0x120a9d;};'use strict';var _=require(_0xf61a('0x0'));var util=require(_0xf61a('0x1'));var logger=require(_0xf61a('0x2'))(_0xf61a('0x3'));var moment=require(_0xf61a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf61a('0x5'));var fs=require('fs');var path=require(_0xf61a('0x6'));var rimraf=require('rimraf');var config=require(_0xf61a('0x7'));var attributes=require(_0xf61a('0x8'));module[_0xf61a('0x9')]=function(_0x1fd636,_0x39d7a1){return _0x1fd636[_0xf61a('0xa')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xf61a('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 50c6ca7..d35a768 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 _0x13a3=['body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countcongestionretry','countdropretry','catch','duration','isNil','scheduledat','add','minutes','countagentrejectretry','createdAt','updatedAt','phone','sequelize','transaction','update','CmHopper','field','IncrementPreviewCounters','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','VerifyAdditionalPhones','findOne'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x13a3,0x102));var _0x313a=function(_0x1872bb,_0x91004d){_0x1872bb=_0x1872bb-0x0;var _0x17e08f=_0x13a3[_0x1872bb];return _0x17e08f;};'use strict';var _=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var moment=require(_0x313a('0x2'));var BPromise=require(_0x313a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x313a('0x4'))['db'];var utils=require(_0x313a('0x5'));var logger=require(_0x313a('0x6'))(_0x313a('0x7'));var config=require(_0x313a('0x8'));var jayson=require(_0x313a('0x9'));var client=jayson[_0x313a('0xa')][_0x313a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1afdc2,_0x31a964,_0x5525e4){return new BPromise(function(_0x30fb98,_0x5a9a3a){return client[_0x313a('0xc')](_0x1afdc2,_0x5525e4)['then'](function(_0x28549a){logger[_0x313a('0xd')](_0x313a('0xe'),_0x31a964,_0x313a('0xf'));logger['debug'](_0x313a('0x10'),_0x31a964,_0x313a('0xf'),JSON['stringify'](_0x28549a));if(_0x28549a[_0x313a('0x11')]){if(_0x28549a[_0x313a('0x11')][_0x313a('0x12')]===0x1f4){logger[_0x313a('0x11')](_0x313a('0xe'),_0x31a964,_0x28549a[_0x313a('0x11')][_0x313a('0x13')]);return _0x5a9a3a(_0x28549a[_0x313a('0x11')][_0x313a('0x13')]);}logger['error'](_0x313a('0xe'),_0x31a964,_0x28549a[_0x313a('0x11')]['message']);return _0x30fb98(_0x28549a[_0x313a('0x11')][_0x313a('0x13')]);}else{logger[_0x313a('0xd')](_0x313a('0xe'),_0x31a964,'request\x20sent');_0x30fb98(_0x28549a['result'][_0x313a('0x13')]);}})['catch'](function(_0x46cba4){logger[_0x313a('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x31a964,_0x46cba4);_0x5a9a3a(_0x46cba4);});});}exports[_0x313a('0x14')]=function(_0x27082a){var _0x1ea401=this;return new Promise(function(_0x14c331,_0x58c8a1){return db['CmHopper'][_0x313a('0x15')]({'raw':!![],'where':{'ContactId':_0x27082a[_0x313a('0x16')][_0x313a('0x17')],'ListId':_0x27082a['body'][_0x313a('0x18')],'VoiceQueueId':_0x27082a[_0x313a('0x16')][_0x313a('0x19')]===undefined?null:_0x27082a[_0x313a('0x16')][_0x313a('0x19')],'CampaignId':_0x27082a[_0x313a('0x16')][_0x313a('0x1a')]===undefined?null:_0x27082a[_0x313a('0x16')][_0x313a('0x1a')]}})[_0x313a('0x1b')](function(_0x4645cb){if(_0x4645cb!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4645cb['id'],'OrderBy':{'$gt':_0x4645cb[_0x313a('0x1c')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x45e2ef){var _0x29635c=0x0;if(_0x45e2ef){if(_0x45e2ef[_0x313a('0x1d')]+_0x45e2ef['countcongestionretry']+_0x45e2ef[_0x313a('0x1e')]+_0x45e2ef[_0x313a('0x1f')]+_0x45e2ef['countdropretry']+_0x45e2ef[_0x313a('0x20')]+_0x45e2ef[_0x313a('0x21')]+_0x45e2ef['countagentrejectretry']<_0x27082a[_0x313a('0x22')][_0x313a('0x23')])_0x29635c=0x1;_0x14c331({'additional':_0x29635c});}else{return db[_0x313a('0x24')][_0x313a('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4645cb['id']},'order':[['OrderBy',_0x313a('0x25')]]})[_0x313a('0x1b')](function(_0x411a56){var _0x5520d2=0x0;if(_0x411a56){if(_0x411a56[_0x313a('0x1d')]+_0x411a56[_0x313a('0x26')]+_0x411a56[_0x313a('0x1e')]+_0x411a56[_0x313a('0x1f')]+_0x411a56[_0x313a('0x27')]+_0x411a56[_0x313a('0x20')]+_0x411a56[_0x313a('0x21')]+_0x411a56['countagentrejectretry']<_0x27082a[_0x313a('0x22')][_0x313a('0x23')])_0x5520d2=0x1;_0x14c331({'additional':_0x5520d2});}else{_0x14c331({'additional':0x0});}})[_0x313a('0x28')](function(_0x2d5b17){logger[_0x313a('0x11')]('VerifyAdditionalPhones',_0x2d5b17[_0x313a('0x13')]);_0x58c8a1(_0x1ea401[_0x313a('0x11')](0x1f4,_0x2d5b17[_0x313a('0x13')]));});}})[_0x313a('0x28')](function(_0x775679){logger[_0x313a('0x11')](_0x313a('0x14'),_0x775679[_0x313a('0x13')]);_0x58c8a1(_0x1ea401[_0x313a('0x11')](0x1f4,_0x775679[_0x313a('0x13')]));});}else _0x14c331({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x243a53){var _0x5e3606=this;return new Promise(function(_0x4f5af7,_0x184a8f){return db['CmHopper'][_0x313a('0x15')]({'raw':!![],'where':{'ContactId':_0x243a53[_0x313a('0x16')][_0x313a('0x17')],'ListId':_0x243a53['body'][_0x313a('0x18')],'VoiceQueueId':_0x243a53[_0x313a('0x16')][_0x313a('0x19')]===undefined?null:_0x243a53[_0x313a('0x16')][_0x313a('0x19')],'CampaignId':_0x243a53[_0x313a('0x16')][_0x313a('0x1a')]===undefined?null:_0x243a53[_0x313a('0x16')][_0x313a('0x1a')]}})[_0x313a('0x1b')](function(_0x509501){if(_0x509501!=null){return db[_0x313a('0x24')][_0x313a('0x15')]({'raw':!![],'where':{'CmHopperId':_0x509501['id'],'OrderBy':{'$gte':_0x509501[_0x313a('0x1c')]}},'order':[[_0x313a('0x1c'),'ASC']]})[_0x313a('0x1b')](function(_0x5cf36a){if(_0x5cf36a)return activateAdditionalPhone(_0x509501,_0x243a53[_0x313a('0x16')],_0x5cf36a,_0x243a53[_0x313a('0x29')],_0x243a53['waitTime'])[_0x313a('0x1b')](function(_0x1688af){_0x4f5af7(_0x1688af);});else{return db[_0x313a('0x24')][_0x313a('0x15')]({'raw':!![],'where':{'CmHopperId':_0x509501['id']},'order':[[_0x313a('0x1c'),_0x313a('0x25')]]})['then'](function(_0x1c181e){if(_0x1c181e)return activateAdditionalPhone(_0x509501,_0x243a53[_0x313a('0x16')],_0x1c181e,_0x243a53['duration'],_0x243a53['waitTime'])[_0x313a('0x1b')](function(_0x20cd1b){_0x4f5af7(_0x20cd1b);});else{_0x4f5af7({'id':_0x509501['id'],'phone':''});}})[_0x313a('0x28')](function(_0x5580b7){logger[_0x313a('0x11')](_0x313a('0x14'),_0x5580b7[_0x313a('0x13')]);_0x184a8f(_0x5e3606['error'](0x1f4,_0x5580b7[_0x313a('0x13')]));});}})[_0x313a('0x28')](function(_0x1eaf3e){logger[_0x313a('0x11')]('VerifyAdditionalPhones',_0x1eaf3e[_0x313a('0x13')]);_0x184a8f(_0x5e3606['error'](0x1f4,_0x1eaf3e[_0x313a('0x13')]));});}else _0x4f5af7(0x1);});});};function activateAdditionalPhone(_0x183489,_0x504f88,_0x148271,_0x45f7c0,_0x22272d){return new Promise(function(_0x300506,_0x4ca6d0){var _0x3886a8;if(_[_0x313a('0x2a')](_0x148271[_0x313a('0x2b')])){_0x148271[_0x313a('0x2b')]=moment();}if(moment()>moment(_0x148271[_0x313a('0x2b')])){_0x3886a8=moment()[_0x313a('0x2c')](_0x22272d||0x3,_0x313a('0x2d'));}else{if(_0x148271['OrderBy']==0x0){_0x3886a8=moment(_0x148271['scheduledat']);}else{_0x3886a8=moment()['add'](_0x22272d||0x3,_0x313a('0x2d'));}}if(_[_0x313a('0x2a')](_0x3886a8)){_0x3886a8=moment()[_0x313a('0x2c')](_0x22272d||0x3,_0x313a('0x2d'));}var _0x453218={'phone':_0x183489['phone'],'active':0x0,'OrderBy':_['isNil'](_0x183489[_0x313a('0x1c')])?0x0:_0x183489[_0x313a('0x1c')],'scheduledat':moment()[_0x313a('0x2c')](_0x45f7c0||0x1,_0x313a('0x2d')),'countbusyretry':_0x504f88[_0x313a('0x1d')],'countcongestionretry':_0x504f88[_0x313a('0x26')],'countnoanswerretry':_0x504f88[_0x313a('0x1e')],'countnosuchnumberretry':_0x504f88['countnosuchnumberretry'],'countdropretry':_0x504f88[_0x313a('0x27')],'countabandonedretry':_0x504f88[_0x313a('0x20')],'countmachineretry':_0x504f88[_0x313a('0x21')],'countagentrejectretry':_0x504f88[_0x313a('0x2e')],'createdAt':_0x504f88[_0x313a('0x2f')],'updatedAt':_0x504f88[_0x313a('0x30')]};var _0x2810cb={'CmHopperId':_0x183489['id'],'phone':_0x148271[_0x313a('0x31')],'active':0x0,'OrderBy':_[_0x313a('0x2a')](_0x148271['OrderBy'])?0x0:_0x148271['OrderBy'],'scheduledat':_0x3886a8,'countbusyretry':_0x148271['countbusyretry'],'countcongestionretry':_0x148271[_0x313a('0x26')],'countnoanswerretry':_0x148271[_0x313a('0x1e')],'countnosuchnumberretry':_0x148271['countnosuchnumberretry'],'countdropretry':_0x148271[_0x313a('0x27')],'countabandonedretry':_0x148271[_0x313a('0x20')],'countmachineretry':_0x148271[_0x313a('0x21')],'countagentrejectretry':_0x148271['countagentrejectretry'],'createdAt':_0x148271[_0x313a('0x2f')],'updatedAt':_0x148271[_0x313a('0x30')]};return db[_0x313a('0x32')][_0x313a('0x33')](function(_0x59e069){return db[_0x313a('0x24')][_0x313a('0x34')](_0x453218,{'where':{'id':_0x148271['id']}},{'transaction':_0x59e069})[_0x313a('0x1b')](function(){return db[_0x313a('0x35')][_0x313a('0x34')](_0x2810cb,{'where':{'id':_0x183489['id']}},{'transaction':_0x59e069});});})[_0x313a('0x1b')](function(_0x31226c){_0x300506({'id':_0x183489['id'],'phone':_0x148271[_0x313a('0x31')]});})['catch'](function(_0x160300){logger[_0x313a('0x11')]('activateAdditionalPhone',_0x160300[_0x313a('0x13')]);_0x4ca6d0({'error':_0x160300[_0x313a('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x54d46d){var _0xbcad07=this;return new Promise(function(_0x177072,_0x27aaa4){return db[_0x313a('0x35')][_0x313a('0x34')](_0x54d46d[_0x313a('0x16')][_0x313a('0x36')],{'where':{'id':_0x54d46d[_0x313a('0x16')]['id']}})[_0x313a('0x1b')](function(_0x57e791){_0x177072(_0x57e791);})[_0x313a('0x28')](function(_0x278623){logger[_0x313a('0x11')](_0x313a('0x37'),_0x278623[_0x313a('0x13')]);_0x27aaa4(_0xbcad07[_0x313a('0x11')](0x1f4,_0x278623[_0x313a('0x13')]));});});}; \ No newline at end of file +var _0x71ee=['activateAdditionalPhone','field','IncrementPreviewCounters','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countbusyretry','ContactId','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update'];(function(_0x26661e,_0x169193){var _0x31c9b3=function(_0x503c82){while(--_0x503c82){_0x26661e['push'](_0x26661e['shift']());}};_0x31c9b3(++_0x169193);}(_0x71ee,0x1cb));var _0xe71e=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x71ee[_0x12c66e];return _0x19481a;};'use strict';var _=require(_0xe71e('0x0'));var util=require('util');var moment=require(_0xe71e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe71e('0x2'));var fs=require('fs');var Redis=require(_0xe71e('0x3'));var db=require(_0xe71e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe71e('0x5'))(_0xe71e('0x6'));var config=require(_0xe71e('0x7'));var jayson=require(_0xe71e('0x8'));var client=jayson[_0xe71e('0x9')][_0xe71e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530050,_0x38dcfc,_0x5d3456){return new BPromise(function(_0x20811b,_0x57a1c9){return client['request'](_0x530050,_0x5d3456)[_0xe71e('0xb')](function(_0x1302ed){logger[_0xe71e('0xc')](_0xe71e('0xd'),_0x38dcfc,_0xe71e('0xe'));logger['debug'](_0xe71e('0xf'),_0x38dcfc,_0xe71e('0xe'),JSON[_0xe71e('0x10')](_0x1302ed));if(_0x1302ed['error']){if(_0x1302ed[_0xe71e('0x11')]['code']===0x1f4){logger['error'](_0xe71e('0xd'),_0x38dcfc,_0x1302ed['error'][_0xe71e('0x12')]);return _0x57a1c9(_0x1302ed[_0xe71e('0x11')]['message']);}logger[_0xe71e('0x11')](_0xe71e('0xd'),_0x38dcfc,_0x1302ed[_0xe71e('0x11')][_0xe71e('0x12')]);return _0x20811b(_0x1302ed[_0xe71e('0x11')][_0xe71e('0x12')]);}else{logger[_0xe71e('0xc')](_0xe71e('0xd'),_0x38dcfc,_0xe71e('0xe'));_0x20811b(_0x1302ed[_0xe71e('0x13')]['message']);}})[_0xe71e('0x14')](function(_0x36fb43){logger[_0xe71e('0x11')](_0xe71e('0xd'),_0x38dcfc,_0x36fb43);_0x57a1c9(_0x36fb43);});});}exports[_0xe71e('0x15')]=function(_0x1c004a){var _0x5cdaf3=this;return new Promise(function(_0x48937f,_0x466b46){return db[_0xe71e('0x16')][_0xe71e('0x17')]({'raw':!![],'where':{'ContactId':_0x1c004a['body']['ContactId'],'ListId':_0x1c004a[_0xe71e('0x18')][_0xe71e('0x19')],'VoiceQueueId':_0x1c004a[_0xe71e('0x18')][_0xe71e('0x1a')]===undefined?null:_0x1c004a[_0xe71e('0x18')][_0xe71e('0x1a')],'CampaignId':_0x1c004a[_0xe71e('0x18')][_0xe71e('0x1b')]===undefined?null:_0x1c004a[_0xe71e('0x18')][_0xe71e('0x1b')]}})[_0xe71e('0xb')](function(_0x1f2e7c){if(_0x1f2e7c!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1f2e7c['id'],'OrderBy':{'$gt':_0x1f2e7c[_0xe71e('0x1c')]}},'order':[[_0xe71e('0x1c'),_0xe71e('0x1d')]]})[_0xe71e('0xb')](function(_0x3045c5){var _0x219d24=0x0;if(_0x3045c5){if(_0x3045c5['countbusyretry']+_0x3045c5[_0xe71e('0x1e')]+_0x3045c5[_0xe71e('0x1f')]+_0x3045c5[_0xe71e('0x20')]+_0x3045c5[_0xe71e('0x21')]+_0x3045c5[_0xe71e('0x22')]+_0x3045c5[_0xe71e('0x23')]+_0x3045c5[_0xe71e('0x24')]<_0x1c004a[_0xe71e('0x25')][_0xe71e('0x26')])_0x219d24=0x1;_0x48937f({'additional':_0x219d24});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1f2e7c['id']},'order':[['OrderBy','ASC']]})[_0xe71e('0xb')](function(_0x2739b9){var _0x1e3f56=0x0;if(_0x2739b9){if(_0x2739b9[_0xe71e('0x27')]+_0x2739b9[_0xe71e('0x1e')]+_0x2739b9[_0xe71e('0x1f')]+_0x2739b9[_0xe71e('0x20')]+_0x2739b9[_0xe71e('0x21')]+_0x2739b9['countabandonedretry']+_0x2739b9[_0xe71e('0x23')]+_0x2739b9[_0xe71e('0x24')]<_0x1c004a[_0xe71e('0x25')][_0xe71e('0x26')])_0x1e3f56=0x1;_0x48937f({'additional':_0x1e3f56});}else{_0x48937f({'additional':0x0});}})[_0xe71e('0x14')](function(_0x3ad322){logger[_0xe71e('0x11')](_0xe71e('0x15'),_0x3ad322[_0xe71e('0x12')]);_0x466b46(_0x5cdaf3[_0xe71e('0x11')](0x1f4,_0x3ad322[_0xe71e('0x12')]));});}})['catch'](function(_0x3e147f){logger[_0xe71e('0x11')]('VerifyAdditionalPhones',_0x3e147f[_0xe71e('0x12')]);_0x466b46(_0x5cdaf3[_0xe71e('0x11')](0x1f4,_0x3e147f[_0xe71e('0x12')]));});}else _0x48937f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1642b8){var _0x44493c=this;return new Promise(function(_0x228def,_0x57d69f){return db[_0xe71e('0x16')][_0xe71e('0x17')]({'raw':!![],'where':{'ContactId':_0x1642b8['body'][_0xe71e('0x28')],'ListId':_0x1642b8[_0xe71e('0x18')][_0xe71e('0x19')],'VoiceQueueId':_0x1642b8[_0xe71e('0x18')][_0xe71e('0x1a')]===undefined?null:_0x1642b8[_0xe71e('0x18')][_0xe71e('0x1a')],'CampaignId':_0x1642b8[_0xe71e('0x18')][_0xe71e('0x1b')]===undefined?null:_0x1642b8[_0xe71e('0x18')][_0xe71e('0x1b')]}})['then'](function(_0xe44767){if(_0xe44767!=null){return db[_0xe71e('0x29')][_0xe71e('0x17')]({'raw':!![],'where':{'CmHopperId':_0xe44767['id'],'OrderBy':{'$gte':_0xe44767['OrderBy']}},'order':[['OrderBy',_0xe71e('0x1d')]]})['then'](function(_0x38c2a3){if(_0x38c2a3)return activateAdditionalPhone(_0xe44767,_0x1642b8[_0xe71e('0x18')],_0x38c2a3,_0x1642b8[_0xe71e('0x2a')],_0x1642b8['waitTime'])['then'](function(_0x3cd598){_0x228def(_0x3cd598);});else{return db[_0xe71e('0x29')][_0xe71e('0x17')]({'raw':!![],'where':{'CmHopperId':_0xe44767['id']},'order':[['OrderBy','ASC']]})[_0xe71e('0xb')](function(_0x4092a8){if(_0x4092a8)return activateAdditionalPhone(_0xe44767,_0x1642b8[_0xe71e('0x18')],_0x4092a8,_0x1642b8[_0xe71e('0x2a')],_0x1642b8[_0xe71e('0x2b')])[_0xe71e('0xb')](function(_0x1f669e){_0x228def(_0x1f669e);});else{_0x228def({'id':_0xe44767['id'],'phone':''});}})[_0xe71e('0x14')](function(_0x223702){logger['error'](_0xe71e('0x15'),_0x223702[_0xe71e('0x12')]);_0x57d69f(_0x44493c[_0xe71e('0x11')](0x1f4,_0x223702['message']));});}})[_0xe71e('0x14')](function(_0x59e145){logger['error'](_0xe71e('0x15'),_0x59e145[_0xe71e('0x12')]);_0x57d69f(_0x44493c[_0xe71e('0x11')](0x1f4,_0x59e145[_0xe71e('0x12')]));});}else _0x228def(0x1);});});};function activateAdditionalPhone(_0x3efa6c,_0x4ea7a1,_0x499ac8,_0x541344,_0x154ec8){return new Promise(function(_0x5705d1,_0xb8d305){var _0x12e6b0;if(_[_0xe71e('0x2c')](_0x499ac8['scheduledat'])){_0x499ac8['scheduledat']=moment();}if(moment()>moment(_0x499ac8[_0xe71e('0x2d')])){_0x12e6b0=moment()[_0xe71e('0x2e')](_0x154ec8||0x3,_0xe71e('0x2f'));}else{if(_0x499ac8['OrderBy']==0x0){_0x12e6b0=moment(_0x499ac8[_0xe71e('0x2d')]);}else{_0x12e6b0=moment()[_0xe71e('0x2e')](_0x154ec8||0x3,'minutes');}}if(_[_0xe71e('0x2c')](_0x12e6b0)){_0x12e6b0=moment()['add'](_0x154ec8||0x3,'minutes');}var _0x279d00={'phone':_0x3efa6c[_0xe71e('0x30')],'active':0x0,'OrderBy':_[_0xe71e('0x2c')](_0x3efa6c[_0xe71e('0x1c')])?0x0:_0x3efa6c[_0xe71e('0x1c')],'scheduledat':moment()[_0xe71e('0x2e')](_0x541344||0x1,'minutes'),'countbusyretry':_0x4ea7a1[_0xe71e('0x27')],'countcongestionretry':_0x4ea7a1[_0xe71e('0x1e')],'countnoanswerretry':_0x4ea7a1[_0xe71e('0x1f')],'countnosuchnumberretry':_0x4ea7a1['countnosuchnumberretry'],'countdropretry':_0x4ea7a1['countdropretry'],'countabandonedretry':_0x4ea7a1[_0xe71e('0x22')],'countmachineretry':_0x4ea7a1['countmachineretry'],'countagentrejectretry':_0x4ea7a1[_0xe71e('0x24')],'createdAt':_0x4ea7a1[_0xe71e('0x31')],'updatedAt':_0x4ea7a1[_0xe71e('0x32')]};var _0x580ae4={'CmHopperId':_0x3efa6c['id'],'phone':_0x499ac8['phone'],'active':0x0,'OrderBy':_[_0xe71e('0x2c')](_0x499ac8[_0xe71e('0x1c')])?0x0:_0x499ac8[_0xe71e('0x1c')],'scheduledat':_0x12e6b0,'countbusyretry':_0x499ac8[_0xe71e('0x27')],'countcongestionretry':_0x499ac8[_0xe71e('0x1e')],'countnoanswerretry':_0x499ac8[_0xe71e('0x1f')],'countnosuchnumberretry':_0x499ac8[_0xe71e('0x20')],'countdropretry':_0x499ac8[_0xe71e('0x21')],'countabandonedretry':_0x499ac8[_0xe71e('0x22')],'countmachineretry':_0x499ac8[_0xe71e('0x23')],'countagentrejectretry':_0x499ac8[_0xe71e('0x24')],'createdAt':_0x499ac8[_0xe71e('0x31')],'updatedAt':_0x499ac8[_0xe71e('0x32')]};return db[_0xe71e('0x33')][_0xe71e('0x34')](function(_0x16b30f){return db[_0xe71e('0x29')][_0xe71e('0x35')](_0x279d00,{'where':{'id':_0x499ac8['id']}},{'transaction':_0x16b30f})[_0xe71e('0xb')](function(){return db[_0xe71e('0x16')][_0xe71e('0x35')](_0x580ae4,{'where':{'id':_0x3efa6c['id']}},{'transaction':_0x16b30f});});})[_0xe71e('0xb')](function(_0x1344b6){_0x5705d1({'id':_0x3efa6c['id'],'phone':_0x499ac8[_0xe71e('0x30')]});})[_0xe71e('0x14')](function(_0x543dd4){logger[_0xe71e('0x11')](_0xe71e('0x36'),_0x543dd4['message']);_0xb8d305({'error':_0x543dd4[_0xe71e('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x437034){var _0x1e8f1c=this;return new Promise(function(_0x3c449b,_0x4d2d52){return db[_0xe71e('0x16')]['update'](_0x437034[_0xe71e('0x18')][_0xe71e('0x37')],{'where':{'id':_0x437034[_0xe71e('0x18')]['id']}})[_0xe71e('0xb')](function(_0x2035b4){_0x3c449b(_0x2035b4);})['catch'](function(_0x475ddd){logger[_0xe71e('0x11')](_0xe71e('0x38'),_0x475ddd['message']);_0x4d2d52(_0x1e8f1c['error'](0x1f4,_0x475ddd[_0xe71e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index a68d748..31fa311 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 _0xbd20=['isAuthenticated','create','put','update','delete','/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','show','post'];(function(_0x5c736b,_0x915334){var _0xd3161f=function(_0x14227c){while(--_0x14227c){_0x5c736b['push'](_0x5c736b['shift']());}};_0xd3161f(++_0x915334);}(_0xbd20,0x14a));var _0x0bd2=function(_0x53972e,_0x275c){_0x53972e=_0x53972e-0x0;var _0xc48fcf=_0xbd20[_0x53972e];return _0xc48fcf;};'use strict';var multer=require(_0x0bd2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0bd2('0x1'));var express=require(_0x0bd2('0x2'));var router=express[_0x0bd2('0x3')]();var fs_extra=require(_0x0bd2('0x4'));var auth=require(_0x0bd2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bd2('0x6'));var controller=require(_0x0bd2('0x7'));router[_0x0bd2('0x8')]('/',auth['isAuthenticated'](),controller[_0x0bd2('0x9')]);router[_0x0bd2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0bd2('0xa')]);router[_0x0bd2('0xb')]('/',auth[_0x0bd2('0xc')](),controller[_0x0bd2('0xd')]);router[_0x0bd2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0bd2('0xf')]);router[_0x0bd2('0x10')](_0x0bd2('0x11'),auth[_0x0bd2('0xc')](),controller[_0x0bd2('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb1d5=['get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c1b0c,_0x12cfba){var _0x268a79=function(_0x30af08){while(--_0x30af08){_0x5c1b0c['push'](_0x5c1b0c['shift']());}};_0x268a79(++_0x12cfba);}(_0xb1d5,0x187));var _0x5b1d=function(_0x8b8f41,_0x56e288){_0x8b8f41=_0x8b8f41-0x0;var _0xe6645f=_0xb1d5[_0x8b8f41];return _0xe6645f;};'use strict';var multer=require(_0x5b1d('0x0'));var util=require(_0x5b1d('0x1'));var path=require(_0x5b1d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b1d('0x3')]();var fs_extra=require(_0x5b1d('0x4'));var auth=require(_0x5b1d('0x5'));var interaction=require(_0x5b1d('0x6'));var config=require(_0x5b1d('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x5b1d('0x8')]('/',auth[_0x5b1d('0x9')](),controller[_0x5b1d('0xa')]);router[_0x5b1d('0x8')]('/:id',auth[_0x5b1d('0x9')](),controller[_0x5b1d('0xb')]);router[_0x5b1d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b1d('0xd')](_0x5b1d('0xe'),auth['isAuthenticated'](),controller[_0x5b1d('0xf')]);router[_0x5b1d('0x10')]('/:id',auth[_0x5b1d('0x9')](),controller[_0x5b1d('0x11')]);module[_0x5b1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0b5d961..cac428a 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 _0x2171=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x2a4555,_0x3fc654){var _0x1261fc=function(_0x1d269f){while(--_0x1d269f){_0x2a4555['push'](_0x2a4555['shift']());}};_0x1261fc(++_0x3fc654);}(_0x2171,0x143));var _0x1217=function(_0x188165,_0x4de657){_0x188165=_0x188165-0x0;var _0x2ab64a=_0x2171[_0x188165];return _0x2ab64a;};'use strict';var moment=require('moment');var Sequelize=require(_0x1217('0x0'));module[_0x1217('0x1')]={'phone':{'type':Sequelize[_0x1217('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1217('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x1217('0x3')],'unique':_0x1217('0x4')}}; \ No newline at end of file +var _0xe0ad=['contactListQueue','moment','exports','STRING','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0ad,0x1a5));var _0xde0a=function(_0x31f936,_0x11b57d){_0x31f936=_0x31f936-0x0;var _0x2f1859=_0xe0ad[_0x31f936];return _0x2f1859;};'use strict';var moment=require(_0xde0a('0x0'));var Sequelize=require('sequelize');module[_0xde0a('0x1')]={'phone':{'type':Sequelize[_0xde0a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xde0a('0x3')],'unique':_0xde0a('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xde0a('0x4')},'VoiceQueueId':{'type':Sequelize[_0xde0a('0x3')],'unique':_0xde0a('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7c3bb65..804fb8b 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 _0x8e8c=['stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy'];(function(_0xd7f3ea,_0x2da7d8){var _0x4362b2=function(_0x167fbe){while(--_0x167fbe){_0xd7f3ea['push'](_0xd7f3ea['shift']());}};_0x4362b2(++_0x2da7d8);}(_0x8e8c,0x1cc));var _0xc8e8=function(_0x3285d4,_0x136036){_0x3285d4=_0x3285d4-0x0;var _0x5408c9=_0x8e8c[_0x3285d4];return _0x5408c9;};'use strict';var emlformat=require(_0xc8e8('0x0'));var rimraf=require(_0xc8e8('0x1'));var zipdir=require(_0xc8e8('0x2'));var jsonpatch=require(_0xc8e8('0x3'));var rp=require(_0xc8e8('0x4'));var moment=require(_0xc8e8('0x5'));var BPromise=require(_0xc8e8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8e8('0x7'));var sox=require(_0xc8e8('0x8'));var csv=require('to-csv');var ejs=require(_0xc8e8('0x9'));var fs=require('fs');var fs_extra=require(_0xc8e8('0xa'));var _=require(_0xc8e8('0xb'));var squel=require(_0xc8e8('0xc'));var crypto=require(_0xc8e8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc8e8('0xe'));var toCsv=require(_0xc8e8('0xf'));var querystring=require(_0xc8e8('0x10'));var Papa=require(_0xc8e8('0x11'));var Redis=require('ioredis');var authService=require(_0xc8e8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8e8('0x13'));var logger=require('../../config/logger')(_0xc8e8('0x14'));var utils=require('../../config/utils');var config=require(_0xc8e8('0x15'));var licenseUtil=require(_0xc8e8('0x16'));var db=require(_0xc8e8('0x17'))['db'];function respondWithStatusCode(_0x57a96e,_0x5cca18){_0x5cca18=_0x5cca18||0xcc;return function(_0x599f61){if(_0x599f61){return _0x57a96e[_0xc8e8('0x18')](_0x5cca18);}return _0x57a96e[_0xc8e8('0x19')](_0x5cca18)['end']();};}function respondWithResult(_0x18fb99,_0x5a5510){_0x5a5510=_0x5a5510||0xc8;return function(_0x42acfe){if(_0x42acfe){return _0x18fb99[_0xc8e8('0x19')](_0x5a5510)[_0xc8e8('0x1a')](_0x42acfe);}};}function respondWithFilteredResult(_0x1d4df3,_0x45c75c){return function(_0x4bf21f){if(_0x4bf21f){var _0x141433=typeof _0x45c75c['offset']===_0xc8e8('0x1b')&&typeof _0x45c75c[_0xc8e8('0x1c')]===_0xc8e8('0x1b');var _0x5ed4cc=_0x4bf21f[_0xc8e8('0x1d')];var _0x46c2dd=_0x141433?0x0:_0x45c75c['offset'];var _0x51387f=_0x141433?_0x4bf21f['count']:_0x45c75c[_0xc8e8('0x1e')]+_0x45c75c[_0xc8e8('0x1c')];var _0x2d88eb;if(_0x51387f>=_0x5ed4cc){_0x51387f=_0x5ed4cc;_0x2d88eb=0xc8;}else{_0x2d88eb=0xce;}_0x1d4df3[_0xc8e8('0x19')](_0x2d88eb);return _0x1d4df3['set'](_0xc8e8('0x1f'),_0x46c2dd+'-'+_0x51387f+'/'+_0x5ed4cc)[_0xc8e8('0x1a')](_0x4bf21f);}return null;};}function patchUpdates(_0x10ba8f){return function(_0x7d6dc2){try{jsonpatch[_0xc8e8('0x20')](_0x7d6dc2,_0x10ba8f,!![]);}catch(_0x1a9618){return BPromise['reject'](_0x1a9618);}return _0x7d6dc2[_0xc8e8('0x21')]();};}function saveUpdates(_0x1240d7,_0x39eb62){return function(_0xd4114b){if(_0xd4114b){return _0xd4114b[_0xc8e8('0x22')](_0x1240d7)[_0xc8e8('0x23')](function(_0x313413){return _0x313413;});}return null;};}function removeEntity(_0x5e1f45,_0x1b2199){return function(_0x56bb5d){if(_0x56bb5d){return _0x56bb5d[_0xc8e8('0x24')]()['then'](function(){_0x5e1f45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1583a5,_0x5c11e0){return function(_0x2b0b2b){if(!_0x2b0b2b){_0x1583a5['sendStatus'](0x194);}return _0x2b0b2b;};}function handleError(_0x4f36c8,_0x1b8999){_0x1b8999=_0x1b8999||0x1f4;return function(_0x3e2806){logger['error'](_0x3e2806[_0xc8e8('0x25')]);if(_0x3e2806['name']){delete _0x3e2806[_0xc8e8('0x26')];}_0x4f36c8[_0xc8e8('0x19')](_0x1b8999)[_0xc8e8('0x27')](_0x3e2806);};}exports['index']=function(_0x35d62e,_0x30d17c){var _0x2427f5={},_0x4fda3b={},_0x18a8a5={'count':0x0,'rows':[]};var _0x44344e=_[_0xc8e8('0x28')](db[_0xc8e8('0x29')][_0xc8e8('0x2a')],function(_0x16f56c){return{'name':_0x16f56c[_0xc8e8('0x2b')],'type':_0x16f56c[_0xc8e8('0x2c')]['key']};});_0x4fda3b[_0xc8e8('0x2d')]=_[_0xc8e8('0x28')](_0x44344e,_0xc8e8('0x26'));_0x4fda3b[_0xc8e8('0x2e')]=_[_0xc8e8('0x2f')](_0x35d62e[_0xc8e8('0x2e')]);_0x4fda3b[_0xc8e8('0x30')]=_['intersection'](_0x4fda3b['model'],_0x4fda3b[_0xc8e8('0x2e')]);_0x2427f5[_0xc8e8('0x31')]=_['intersection'](_0x4fda3b[_0xc8e8('0x2d')],qs[_0xc8e8('0x32')](_0x35d62e[_0xc8e8('0x2e')][_0xc8e8('0x32')]));_0x2427f5['attributes']=_0x2427f5[_0xc8e8('0x31')][_0xc8e8('0x33')]?_0x2427f5[_0xc8e8('0x31')]:_0x4fda3b['model'];if(!_0x35d62e[_0xc8e8('0x2e')][_0xc8e8('0x34')](_0xc8e8('0x35'))){_0x2427f5[_0xc8e8('0x1c')]=qs[_0xc8e8('0x1c')](_0x35d62e[_0xc8e8('0x2e')][_0xc8e8('0x1c')]);_0x2427f5[_0xc8e8('0x1e')]=qs[_0xc8e8('0x1e')](_0x35d62e[_0xc8e8('0x2e')]['offset']);}_0x2427f5[_0xc8e8('0x36')]=qs['sort'](_0x35d62e['query'][_0xc8e8('0x37')]);_0x2427f5[_0xc8e8('0x38')]=qs[_0xc8e8('0x30')](_[_0xc8e8('0x39')](_0x35d62e[_0xc8e8('0x2e')],_0x4fda3b[_0xc8e8('0x30')]),_0x44344e);if(_0x35d62e[_0xc8e8('0x2e')][_0xc8e8('0x3a')]){_0x2427f5[_0xc8e8('0x38')]=_[_0xc8e8('0x3b')](_0x2427f5['where'],{'$or':_[_0xc8e8('0x28')](_0x44344e,function(_0x312ea8){if(_0x312ea8[_0xc8e8('0x2c')]!=='VIRTUAL'){var _0x58b8ed={};_0x58b8ed[_0x312ea8[_0xc8e8('0x26')]]={'$like':'%'+_0x35d62e[_0xc8e8('0x2e')][_0xc8e8('0x3a')]+'%'};return _0x58b8ed;}})});}_0x2427f5=_[_0xc8e8('0x3b')]({},_0x2427f5,_0x35d62e[_0xc8e8('0x3c')]);var _0x3104aa={'where':_0x2427f5[_0xc8e8('0x38')]};return db[_0xc8e8('0x29')][_0xc8e8('0x1d')](_0x3104aa)[_0xc8e8('0x23')](function(_0x572c1d){_0x18a8a5[_0xc8e8('0x1d')]=_0x572c1d;if(_0x35d62e['query'][_0xc8e8('0x3d')]){_0x2427f5[_0xc8e8('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc8e8('0x3f')](_0x2427f5);})[_0xc8e8('0x23')](function(_0x260c8a){_0x18a8a5['rows']=_0x260c8a;return _0x18a8a5;})[_0xc8e8('0x23')](respondWithFilteredResult(_0x30d17c,_0x2427f5))[_0xc8e8('0x40')](handleError(_0x30d17c,null));};exports[_0xc8e8('0x41')]=function(_0x8c7b70,_0x41b245){var _0x5585ed={'raw':!![],'where':{'id':_0x8c7b70[_0xc8e8('0x42')]['id']}},_0x52db48={};_0x52db48['model']=_['keys'](db[_0xc8e8('0x29')][_0xc8e8('0x2a')]);_0x52db48[_0xc8e8('0x2e')]=_[_0xc8e8('0x2f')](_0x8c7b70[_0xc8e8('0x2e')]);_0x52db48[_0xc8e8('0x30')]=_['intersection'](_0x52db48[_0xc8e8('0x2d')],_0x52db48[_0xc8e8('0x2e')]);_0x5585ed[_0xc8e8('0x31')]=_[_0xc8e8('0x43')](_0x52db48[_0xc8e8('0x2d')],qs[_0xc8e8('0x32')](_0x8c7b70['query'][_0xc8e8('0x32')]));_0x5585ed['attributes']=_0x5585ed['attributes'][_0xc8e8('0x33')]?_0x5585ed[_0xc8e8('0x31')]:_0x52db48[_0xc8e8('0x2d')];if(_0x8c7b70['query'][_0xc8e8('0x3d')]){_0x5585ed['include']=[{'all':!![]}];}_0x5585ed=_[_0xc8e8('0x3b')]({},_0x5585ed,_0x8c7b70['options']);return db[_0xc8e8('0x29')][_0xc8e8('0x44')](_0x5585ed)[_0xc8e8('0x23')](handleEntityNotFound(_0x41b245,null))[_0xc8e8('0x23')](respondWithResult(_0x41b245,null))[_0xc8e8('0x40')](handleError(_0x41b245,null));};exports['update']=function(_0x47f450,_0x4c5fa8){if(_0x47f450[_0xc8e8('0x45')]['id']){delete _0x47f450[_0xc8e8('0x45')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x47f450['params']['id']}})[_0xc8e8('0x23')](handleEntityNotFound(_0x4c5fa8,null))[_0xc8e8('0x23')](saveUpdates(_0x47f450['body'],null))['then'](respondWithResult(_0x4c5fa8,null))[_0xc8e8('0x40')](handleError(_0x4c5fa8,null));};exports['destroy']=function(_0x45e0c3,_0x5c0735){return db[_0xc8e8('0x29')][_0xc8e8('0x44')]({'where':{'id':_0x45e0c3[_0xc8e8('0x42')]['id']}})[_0xc8e8('0x23')](handleEntityNotFound(_0x5c0735,null))['then'](removeEntity(_0x5c0735,null))[_0xc8e8('0x40')](handleError(_0x5c0735,null));};exports['describe']=function(_0x1e185a,_0x3d7624){return db[_0xc8e8('0x29')][_0xc8e8('0x46')]()['then'](respondWithResult(_0x3d7624,null))[_0xc8e8('0x40')](handleError(_0x3d7624,null));}; \ No newline at end of file +var _0xf95b=['path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','then','stack','name','send','index','map','CmHopperBlack','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','length','find','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1644e5,_0x31ac5f){var _0x5bc914=function(_0x2302a1){while(--_0x2302a1){_0x1644e5['push'](_0x1644e5['shift']());}};_0x5bc914(++_0x31ac5f);}(_0xf95b,0x197));var _0xbf95=function(_0x299e08,_0x16434c){_0x299e08=_0x299e08-0x0;var _0x15a309=_0xf95b[_0x299e08];return _0x15a309;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf95('0x0'));var jsonpatch=require(_0xbf95('0x1'));var rp=require(_0xbf95('0x2'));var moment=require(_0xbf95('0x3'));var BPromise=require(_0xbf95('0x4'));var Mustache=require(_0xbf95('0x5'));var util=require(_0xbf95('0x6'));var path=require(_0xbf95('0x7'));var sox=require(_0xbf95('0x8'));var csv=require(_0xbf95('0x9'));var ejs=require(_0xbf95('0xa'));var fs=require('fs');var fs_extra=require(_0xbf95('0xb'));var _=require('lodash');var squel=require(_0xbf95('0xc'));var crypto=require(_0xbf95('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf95('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf95('0xf'));var authService=require(_0xbf95('0x10'));var qs=require(_0xbf95('0x11'));var as=require(_0xbf95('0x12'));var hardwareService=require(_0xbf95('0x13'));var logger=require(_0xbf95('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbf95('0x15'));var licenseUtil=require(_0xbf95('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14ce3f,_0x38a31b){_0x38a31b=_0x38a31b||0xcc;return function(_0xaff266){if(_0xaff266){return _0x14ce3f['sendStatus'](_0x38a31b);}return _0x14ce3f['status'](_0x38a31b)[_0xbf95('0x17')]();};}function respondWithResult(_0x18ad19,_0x4a1704){_0x4a1704=_0x4a1704||0xc8;return function(_0x2a4662){if(_0x2a4662){return _0x18ad19[_0xbf95('0x18')](_0x4a1704)['json'](_0x2a4662);}};}function respondWithFilteredResult(_0x3f9d8f,_0x273cd4){return function(_0x355ed0){if(_0x355ed0){var _0x1471b9=typeof _0x273cd4[_0xbf95('0x19')]===_0xbf95('0x1a')&&typeof _0x273cd4[_0xbf95('0x1b')]===_0xbf95('0x1a');var _0x41ec12=_0x355ed0['count'];var _0x5b5b15=_0x1471b9?0x0:_0x273cd4[_0xbf95('0x19')];var _0x296d7d=_0x1471b9?_0x355ed0[_0xbf95('0x1c')]:_0x273cd4[_0xbf95('0x19')]+_0x273cd4['limit'];var _0x4b9926;if(_0x296d7d>=_0x41ec12){_0x296d7d=_0x41ec12;_0x4b9926=0xc8;}else{_0x4b9926=0xce;}_0x3f9d8f[_0xbf95('0x18')](_0x4b9926);return _0x3f9d8f[_0xbf95('0x1d')](_0xbf95('0x1e'),_0x5b5b15+'-'+_0x296d7d+'/'+_0x41ec12)[_0xbf95('0x1f')](_0x355ed0);}return null;};}function patchUpdates(_0x236897){return function(_0x3ff687){try{jsonpatch['apply'](_0x3ff687,_0x236897,!![]);}catch(_0x1fa2a4){return BPromise[_0xbf95('0x20')](_0x1fa2a4);}return _0x3ff687['save']();};}function saveUpdates(_0x4f0849,_0x3d73e5){return function(_0x422b81){if(_0x422b81){return _0x422b81['update'](_0x4f0849)[_0xbf95('0x21')](function(_0x3c7f2f){return _0x3c7f2f;});}return null;};}function removeEntity(_0x2766fb,_0x5807fc){return function(_0x5bacc7){if(_0x5bacc7){return _0x5bacc7['destroy']()['then'](function(){_0x2766fb[_0xbf95('0x18')](0xcc)[_0xbf95('0x17')]();});}};}function handleEntityNotFound(_0x1c9923,_0xf8ded2){return function(_0x575db8){if(!_0x575db8){_0x1c9923['sendStatus'](0x194);}return _0x575db8;};}function handleError(_0x20817b,_0x542213){_0x542213=_0x542213||0x1f4;return function(_0x5a3d38){logger['error'](_0x5a3d38[_0xbf95('0x22')]);if(_0x5a3d38['name']){delete _0x5a3d38[_0xbf95('0x23')];}_0x20817b['status'](_0x542213)[_0xbf95('0x24')](_0x5a3d38);};}exports[_0xbf95('0x25')]=function(_0xa74446,_0x19d3f6){var _0x4b6021={},_0x5d1d99={},_0x5057d7={'count':0x0,'rows':[]};var _0x2fdb34=_[_0xbf95('0x26')](db[_0xbf95('0x27')]['rawAttributes'],function(_0x109888){return{'name':_0x109888['fieldName'],'type':_0x109888[_0xbf95('0x28')]['key']};});_0x5d1d99[_0xbf95('0x29')]=_[_0xbf95('0x26')](_0x2fdb34,_0xbf95('0x23'));_0x5d1d99[_0xbf95('0x2a')]=_[_0xbf95('0x2b')](_0xa74446[_0xbf95('0x2a')]);_0x5d1d99['filters']=_[_0xbf95('0x2c')](_0x5d1d99['model'],_0x5d1d99['query']);_0x4b6021[_0xbf95('0x2d')]=_[_0xbf95('0x2c')](_0x5d1d99[_0xbf95('0x29')],qs[_0xbf95('0x2e')](_0xa74446[_0xbf95('0x2a')][_0xbf95('0x2e')]));_0x4b6021[_0xbf95('0x2d')]=_0x4b6021['attributes']['length']?_0x4b6021[_0xbf95('0x2d')]:_0x5d1d99[_0xbf95('0x29')];if(!_0xa74446['query'][_0xbf95('0x2f')](_0xbf95('0x30'))){_0x4b6021[_0xbf95('0x1b')]=qs[_0xbf95('0x1b')](_0xa74446[_0xbf95('0x2a')][_0xbf95('0x1b')]);_0x4b6021[_0xbf95('0x19')]=qs['offset'](_0xa74446[_0xbf95('0x2a')][_0xbf95('0x19')]);}_0x4b6021[_0xbf95('0x31')]=qs['sort'](_0xa74446[_0xbf95('0x2a')][_0xbf95('0x32')]);_0x4b6021['where']=qs[_0xbf95('0x33')](_[_0xbf95('0x34')](_0xa74446[_0xbf95('0x2a')],_0x5d1d99['filters']),_0x2fdb34);if(_0xa74446[_0xbf95('0x2a')][_0xbf95('0x35')]){_0x4b6021[_0xbf95('0x36')]=_[_0xbf95('0x37')](_0x4b6021[_0xbf95('0x36')],{'$or':_[_0xbf95('0x26')](_0x2fdb34,function(_0x4a8f94){if(_0x4a8f94[_0xbf95('0x28')]!==_0xbf95('0x38')){var _0x249143={};_0x249143[_0x4a8f94['name']]={'$like':'%'+_0xa74446['query'][_0xbf95('0x35')]+'%'};return _0x249143;}})});}_0x4b6021=_[_0xbf95('0x37')]({},_0x4b6021,_0xa74446[_0xbf95('0x39')]);var _0x30ae13={'where':_0x4b6021[_0xbf95('0x36')]};return db['CmHopperBlack'][_0xbf95('0x1c')](_0x30ae13)[_0xbf95('0x21')](function(_0x1c35c2){_0x5057d7['count']=_0x1c35c2;if(_0xa74446[_0xbf95('0x2a')][_0xbf95('0x3a')]){_0x4b6021[_0xbf95('0x3b')]=[{'all':!![]}];}return db[_0xbf95('0x27')]['findAll'](_0x4b6021);})[_0xbf95('0x21')](function(_0x5a4996){_0x5057d7[_0xbf95('0x3c')]=_0x5a4996;return _0x5057d7;})[_0xbf95('0x21')](respondWithFilteredResult(_0x19d3f6,_0x4b6021))[_0xbf95('0x3d')](handleError(_0x19d3f6,null));};exports['show']=function(_0x103b0c,_0x1839c1){var _0x4c5b99={'raw':!![],'where':{'id':_0x103b0c[_0xbf95('0x3e')]['id']}},_0x5c9f97={};_0x5c9f97['model']=_[_0xbf95('0x2b')](db[_0xbf95('0x27')][_0xbf95('0x3f')]);_0x5c9f97[_0xbf95('0x2a')]=_[_0xbf95('0x2b')](_0x103b0c[_0xbf95('0x2a')]);_0x5c9f97[_0xbf95('0x33')]=_['intersection'](_0x5c9f97['model'],_0x5c9f97['query']);_0x4c5b99['attributes']=_[_0xbf95('0x2c')](_0x5c9f97[_0xbf95('0x29')],qs[_0xbf95('0x2e')](_0x103b0c['query'][_0xbf95('0x2e')]));_0x4c5b99[_0xbf95('0x2d')]=_0x4c5b99['attributes'][_0xbf95('0x40')]?_0x4c5b99['attributes']:_0x5c9f97[_0xbf95('0x29')];if(_0x103b0c[_0xbf95('0x2a')][_0xbf95('0x3a')]){_0x4c5b99[_0xbf95('0x3b')]=[{'all':!![]}];}_0x4c5b99=_['merge']({},_0x4c5b99,_0x103b0c[_0xbf95('0x39')]);return db[_0xbf95('0x27')][_0xbf95('0x41')](_0x4c5b99)[_0xbf95('0x21')](handleEntityNotFound(_0x1839c1,null))[_0xbf95('0x21')](respondWithResult(_0x1839c1,null))[_0xbf95('0x3d')](handleError(_0x1839c1,null));};exports[_0xbf95('0x42')]=function(_0x2d7eec,_0x1625e4){if(_0x2d7eec[_0xbf95('0x43')]['id']){delete _0x2d7eec['body']['id'];}return db[_0xbf95('0x27')][_0xbf95('0x41')]({'where':{'id':_0x2d7eec[_0xbf95('0x3e')]['id']}})[_0xbf95('0x21')](handleEntityNotFound(_0x1625e4,null))['then'](saveUpdates(_0x2d7eec[_0xbf95('0x43')],null))[_0xbf95('0x21')](respondWithResult(_0x1625e4,null))[_0xbf95('0x3d')](handleError(_0x1625e4,null));};exports['destroy']=function(_0x1b82a0,_0x532b2f){return db['CmHopperBlack'][_0xbf95('0x41')]({'where':{'id':_0x1b82a0[_0xbf95('0x3e')]['id']}})[_0xbf95('0x21')](handleEntityNotFound(_0x532b2f,null))[_0xbf95('0x21')](removeEntity(_0x532b2f,null))['catch'](handleError(_0x532b2f,null));};exports[_0xbf95('0x44')]=function(_0x3ffe26,_0x328793){return db[_0xbf95('0x27')][_0xbf95('0x44')]()['then'](respondWithResult(_0x328793,null))[_0xbf95('0x3d')](handleError(_0x328793,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a777309..b2796ab 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 _0xd0f7=['../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x686067,_0x5a237e){var _0x3f4b7c=function(_0x97caed){while(--_0x97caed){_0x686067['push'](_0x686067['shift']());}};_0x3f4b7c(++_0x5a237e);}(_0xd0f7,0x139));var _0x7d0f=function(_0x486c91,_0x257b1b){_0x486c91=_0x486c91-0x0;var _0x4de8b0=_0xd0f7[_0x486c91];return _0x4de8b0;};'use strict';var _=require(_0x7d0f('0x0'));var util=require(_0x7d0f('0x1'));var logger=require(_0x7d0f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d0f('0x3'));var fs=require('fs');var path=require(_0x7d0f('0x4'));var rimraf=require(_0x7d0f('0x5'));var config=require(_0x7d0f('0x6'));var attributes=require(_0x7d0f('0x7'));module[_0x7d0f('0x8')]=function(_0x252399,_0x48d49a){return _0x252399['define'](_0x7d0f('0x9'),attributes,{'tableName':_0x7d0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf834=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf834,0x171));var _0x4f83=function(_0x45261c,_0x591e43){_0x45261c=_0x45261c-0x0;var _0x8760a2=_0xf834[_0x45261c];return _0x8760a2;};'use strict';var _=require(_0x4f83('0x0'));var util=require(_0x4f83('0x1'));var logger=require('../../config/logger')(_0x4f83('0x2'));var moment=require('moment');var BPromise=require(_0x4f83('0x3'));var rp=require(_0x4f83('0x4'));var fs=require('fs');var path=require(_0x4f83('0x5'));var rimraf=require(_0x4f83('0x6'));var config=require(_0x4f83('0x7'));var attributes=require(_0x4f83('0x8'));module[_0x4f83('0x9')]=function(_0x3e0e8d,_0x57d3e7){return _0x3e0e8d['define'](_0x4f83('0xa'),attributes,{'tableName':_0x4f83('0xb'),'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 3e38af5..703069f 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 _0x39a6=['error','message','info','result','catch','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4569fb,_0x394fdb){var _0x5387ce=function(_0x111f8c){while(--_0x111f8c){_0x4569fb['push'](_0x4569fb['shift']());}};_0x5387ce(++_0x394fdb);}(_0x39a6,0xfd));var _0x639a=function(_0x4bde61,_0x37941a){_0x4bde61=_0x4bde61-0x0;var _0x215b96=_0x39a6[_0x4bde61];return _0x215b96;};'use strict';var _=require(_0x639a('0x0'));var util=require(_0x639a('0x1'));var moment=require(_0x639a('0x2'));var BPromise=require(_0x639a('0x3'));var rs=require(_0x639a('0x4'));var fs=require('fs');var Redis=require(_0x639a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x639a('0x6'));var logger=require(_0x639a('0x7'))(_0x639a('0x8'));var config=require(_0x639a('0x9'));var jayson=require(_0x639a('0xa'));var client=jayson[_0x639a('0xb')][_0x639a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12eda6,_0x28870f,_0x564ae5){return new BPromise(function(_0x17c2e5,_0x3b7c91){return client[_0x639a('0xd')](_0x12eda6,_0x564ae5)[_0x639a('0xe')](function(_0x33b0ff){logger['info'](_0x639a('0xf'),_0x28870f,_0x639a('0x10'));logger[_0x639a('0x11')](_0x639a('0x12'),_0x28870f,'request\x20sent',JSON[_0x639a('0x13')](_0x33b0ff));if(_0x33b0ff[_0x639a('0x14')]){if(_0x33b0ff[_0x639a('0x14')]['code']===0x1f4){logger[_0x639a('0x14')](_0x639a('0xf'),_0x28870f,_0x33b0ff[_0x639a('0x14')][_0x639a('0x15')]);return _0x3b7c91(_0x33b0ff['error']['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x28870f,_0x33b0ff[_0x639a('0x14')]['message']);return _0x17c2e5(_0x33b0ff['error']['message']);}else{logger[_0x639a('0x16')]('CmHopperBlack,\x20%s,\x20%s',_0x28870f,_0x639a('0x10'));_0x17c2e5(_0x33b0ff[_0x639a('0x17')][_0x639a('0x15')]);}})[_0x639a('0x18')](function(_0x33488c){logger[_0x639a('0x14')](_0x639a('0xf'),_0x28870f,_0x33488c);_0x3b7c91(_0x33488c);});});}exports[_0x639a('0x19')]=function(_0x183275){var _0x245611=this;return new Promise(function(_0x21a073,_0x28ea30){return db['CmHopperBlack'][_0x639a('0x1a')]({'raw':_0x183275[_0x639a('0x1b')]?_0x183275[_0x639a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x183275['options']?_0x183275[_0x639a('0x1b')][_0x639a('0x1c')]||null:null,'attributes':_0x183275[_0x639a('0x1b')]?_0x183275[_0x639a('0x1b')][_0x639a('0x1d')]||null:null,'limit':_0x183275['options']?_0x183275[_0x639a('0x1b')][_0x639a('0x1e')]||null:null,'include':_0x183275[_0x639a('0x1b')]?_0x183275['options'][_0x639a('0x1f')]?_[_0x639a('0x20')](_0x183275[_0x639a('0x1b')]['include'],function(_0x531663){return{'model':db[_0x531663[_0x639a('0x21')]],'as':_0x531663['as'],'attributes':_0x531663['attributes'],'include':_0x531663[_0x639a('0x1f')]?_[_0x639a('0x20')](_0x531663[_0x639a('0x1f')],function(_0x51b731){return{'model':db[_0x51b731[_0x639a('0x21')]],'as':_0x51b731['as'],'attributes':_0x51b731['attributes'],'include':_0x51b731[_0x639a('0x1f')]?_['map'](_0x51b731[_0x639a('0x1f')],function(_0x4cf819){return{'model':db[_0x4cf819[_0x639a('0x21')]],'as':_0x4cf819['as'],'attributes':_0x4cf819['attributes']};}):[]};}):[]};}):[]:[]})[_0x639a('0xe')](function(_0x523989){logger[_0x639a('0x16')](_0x639a('0x19'),_0x183275);logger[_0x639a('0x11')](_0x639a('0x19'),_0x183275,JSON['stringify'](_0x523989));_0x21a073(_0x523989);})[_0x639a('0x18')](function(_0x616236){logger[_0x639a('0x14')](_0x639a('0x19'),_0x616236[_0x639a('0x15')],_0x183275);_0x28ea30(_0x245611['error'](0x1f4,_0x616236[_0x639a('0x15')]));});});};exports[_0x639a('0x22')]=function(_0x4fe24e){var _0x1fb92c=this;return new Promise(function(_0x293367,_0x306926){return db['CmHopperBlack'][_0x639a('0x23')](_0x4fe24e['body'],{'raw':_0x4fe24e[_0x639a('0x1b')]?_0x4fe24e['options'][_0x639a('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe24e['options']?_0x4fe24e[_0x639a('0x1b')][_0x639a('0x1c')]||null:null,'attributes':_0x4fe24e[_0x639a('0x1b')]?_0x4fe24e[_0x639a('0x1b')]['attributes']||null:null,'limit':_0x4fe24e[_0x639a('0x1b')]?_0x4fe24e[_0x639a('0x1b')][_0x639a('0x1e')]||null:null})[_0x639a('0xe')](function(_0x43dd46){logger[_0x639a('0x16')]('UpdateCmHopperBlack',_0x4fe24e);logger['debug'](_0x639a('0x22'),_0x4fe24e,JSON[_0x639a('0x13')](_0x43dd46));_0x293367(_0x43dd46);})[_0x639a('0x18')](function(_0x1cc795){logger[_0x639a('0x14')](_0x639a('0x22'),_0x1cc795['message'],_0x4fe24e);_0x306926(_0x1fb92c['error'](0x1f4,_0x1cc795[_0x639a('0x15')]));});});};exports[_0x639a('0x25')]=function(_0x150464){var _0x32bcca=this;return new Promise(function(_0x189b8c,_0xb41ff4){return db['CmHopperBlack'][_0x639a('0x26')]({'where':_0x150464[_0x639a('0x1b')]?_0x150464[_0x639a('0x1b')][_0x639a('0x1c')]||null:null})[_0x639a('0xe')](function(_0xaf2775){logger[_0x639a('0x16')]('DestroyCmHopperBlack',_0x150464);logger[_0x639a('0x11')](_0x639a('0x25'),_0x150464,JSON[_0x639a('0x13')](_0xaf2775));_0x189b8c(_0xaf2775);})[_0x639a('0x18')](function(_0xebb4bf){logger['error'](_0x639a('0x25'),_0xebb4bf['message'],_0x150464);_0xb41ff4(_0x32bcca[_0x639a('0x14')](0x1f4,_0xebb4bf[_0x639a('0x15')]));});});}; \ No newline at end of file +var _0xacf6=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','code','error','CmHopperBlack,\x20%s,\x20%s','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xee95aa,_0x56bc39){var _0x301db2=function(_0x1162b1){while(--_0x1162b1){_0xee95aa['push'](_0xee95aa['shift']());}};_0x301db2(++_0x56bc39);}(_0xacf6,0x92));var _0x6acf=function(_0x1a7535,_0x499724){_0x1a7535=_0x1a7535-0x0;var _0x5a21e0=_0xacf6[_0x1a7535];return _0x5a21e0;};'use strict';var _=require('lodash');var util=require(_0x6acf('0x0'));var moment=require('moment');var BPromise=require(_0x6acf('0x1'));var rs=require(_0x6acf('0x2'));var fs=require('fs');var Redis=require(_0x6acf('0x3'));var db=require(_0x6acf('0x4'))['db'];var utils=require(_0x6acf('0x5'));var logger=require(_0x6acf('0x6'))('rpc');var config=require(_0x6acf('0x7'));var jayson=require(_0x6acf('0x8'));var client=jayson[_0x6acf('0x9')][_0x6acf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348fe0,_0x18580a,_0x3a39b0){return new BPromise(function(_0x49391e,_0x4ff2ee){return client[_0x6acf('0xb')](_0x348fe0,_0x3a39b0)[_0x6acf('0xc')](function(_0x4d6bc9){logger[_0x6acf('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x18580a,'request\x20sent');logger[_0x6acf('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x18580a,'request\x20sent',JSON[_0x6acf('0xf')](_0x4d6bc9));if(_0x4d6bc9['error']){if(_0x4d6bc9['error'][_0x6acf('0x10')]===0x1f4){logger[_0x6acf('0x11')](_0x6acf('0x12'),_0x18580a,_0x4d6bc9['error'][_0x6acf('0x13')]);return _0x4ff2ee(_0x4d6bc9[_0x6acf('0x11')]['message']);}logger['error'](_0x6acf('0x12'),_0x18580a,_0x4d6bc9[_0x6acf('0x11')]['message']);return _0x49391e(_0x4d6bc9[_0x6acf('0x11')]['message']);}else{logger[_0x6acf('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x18580a,_0x6acf('0x14'));_0x49391e(_0x4d6bc9[_0x6acf('0x15')][_0x6acf('0x13')]);}})[_0x6acf('0x16')](function(_0x502475){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x18580a,_0x502475);_0x4ff2ee(_0x502475);});});}exports[_0x6acf('0x17')]=function(_0x261a3f){var _0x3fd6ba=this;return new Promise(function(_0x2317d1,_0x3f9c99){return db[_0x6acf('0x18')][_0x6acf('0x19')]({'raw':_0x261a3f[_0x6acf('0x1a')]?_0x261a3f[_0x6acf('0x1a')][_0x6acf('0x1b')]===undefined?!![]:![]:!![],'where':_0x261a3f[_0x6acf('0x1a')]?_0x261a3f[_0x6acf('0x1a')]['where']||null:null,'attributes':_0x261a3f['options']?_0x261a3f[_0x6acf('0x1a')][_0x6acf('0x1c')]||null:null,'limit':_0x261a3f['options']?_0x261a3f[_0x6acf('0x1a')][_0x6acf('0x1d')]||null:null,'include':_0x261a3f['options']?_0x261a3f[_0x6acf('0x1a')]['include']?_['map'](_0x261a3f['options'][_0x6acf('0x1e')],function(_0x113186){return{'model':db[_0x113186[_0x6acf('0x1f')]],'as':_0x113186['as'],'attributes':_0x113186[_0x6acf('0x1c')],'include':_0x113186[_0x6acf('0x1e')]?_[_0x6acf('0x20')](_0x113186[_0x6acf('0x1e')],function(_0x160330){return{'model':db[_0x160330[_0x6acf('0x1f')]],'as':_0x160330['as'],'attributes':_0x160330[_0x6acf('0x1c')],'include':_0x160330['include']?_[_0x6acf('0x20')](_0x160330[_0x6acf('0x1e')],function(_0x3e179c){return{'model':db[_0x3e179c[_0x6acf('0x1f')]],'as':_0x3e179c['as'],'attributes':_0x3e179c[_0x6acf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6acf('0xc')](function(_0x58cd04){logger['info']('GetCmHopperBlack',_0x261a3f);logger[_0x6acf('0xe')](_0x6acf('0x17'),_0x261a3f,JSON[_0x6acf('0xf')](_0x58cd04));_0x2317d1(_0x58cd04);})[_0x6acf('0x16')](function(_0x538204){logger[_0x6acf('0x11')](_0x6acf('0x17'),_0x538204[_0x6acf('0x13')],_0x261a3f);_0x3f9c99(_0x3fd6ba[_0x6acf('0x11')](0x1f4,_0x538204[_0x6acf('0x13')]));});});};exports[_0x6acf('0x21')]=function(_0x3be12e){var _0x46e96e=this;return new Promise(function(_0x24a78e,_0x6f75f5){return db['CmHopperBlack'][_0x6acf('0x22')](_0x3be12e[_0x6acf('0x23')],{'raw':_0x3be12e['options']?_0x3be12e[_0x6acf('0x1a')][_0x6acf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3be12e[_0x6acf('0x1a')]?_0x3be12e[_0x6acf('0x1a')]['where']||null:null,'attributes':_0x3be12e['options']?_0x3be12e[_0x6acf('0x1a')][_0x6acf('0x1c')]||null:null,'limit':_0x3be12e['options']?_0x3be12e[_0x6acf('0x1a')]['limit']||null:null})['then'](function(_0x25b3c7){logger[_0x6acf('0xd')](_0x6acf('0x21'),_0x3be12e);logger[_0x6acf('0xe')](_0x6acf('0x21'),_0x3be12e,JSON['stringify'](_0x25b3c7));_0x24a78e(_0x25b3c7);})[_0x6acf('0x16')](function(_0x3984a1){logger['error'](_0x6acf('0x21'),_0x3984a1[_0x6acf('0x13')],_0x3be12e);_0x6f75f5(_0x46e96e[_0x6acf('0x11')](0x1f4,_0x3984a1[_0x6acf('0x13')]));});});};exports[_0x6acf('0x24')]=function(_0x5ee497){var _0x197a81=this;return new Promise(function(_0x5431fd,_0x3e2fd6){return db['CmHopperBlack']['destroy']({'where':_0x5ee497[_0x6acf('0x1a')]?_0x5ee497[_0x6acf('0x1a')][_0x6acf('0x25')]||null:null})[_0x6acf('0xc')](function(_0x2ac7ce){logger[_0x6acf('0xd')](_0x6acf('0x24'),_0x5ee497);logger['debug'](_0x6acf('0x24'),_0x5ee497,JSON['stringify'](_0x2ac7ce));_0x5431fd(_0x2ac7ce);})['catch'](function(_0x55a156){logger[_0x6acf('0x11')](_0x6acf('0x24'),_0x55a156[_0x6acf('0x13')],_0x5ee497);_0x3e2fd6(_0x197a81[_0x6acf('0x11')](0x1f4,_0x55a156['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d481c84..3050ce0 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 _0x5fab=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4c1195,_0x2022ec){var _0xcabe5f=function(_0x9d0ac){while(--_0x9d0ac){_0x4c1195['push'](_0x4c1195['shift']());}};_0xcabe5f(++_0x2022ec);}(_0x5fab,0x177));var _0xb5fa=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x5fab[_0x4e697a];return _0x88850c;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['put']('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('0x13')]=router; \ No newline at end of file +var _0x627e=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x45416a,_0x50d3ec){var _0x5c24f3=function(_0x902ad4){while(--_0x902ad4){_0x45416a['push'](_0x45416a['shift']());}};_0x5c24f3(++_0x50d3ec);}(_0x627e,0x14a));var _0xe627=function(_0x40ba3d,_0x2090ef){_0x40ba3d=_0x40ba3d-0x0;var _0x3314db=_0x627e[_0x40ba3d];return _0x3314db;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xe')](_0xe627('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 979f509..6104c76 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 _0x896b=['DATE','endtime','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x420865,_0x4488ce){var _0x3c3225=function(_0x406aa3){while(--_0x406aa3){_0x420865['push'](_0x420865['shift']());}};_0x3c3225(++_0x4488ce);}(_0x896b,0x9e));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb896('0x0'));var moment=require(_0xb896('0x1'));module['exports']={'state':{'type':Sequelize[_0xb896('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb896('0x3')]},'scheduledat':{'type':Sequelize[_0xb896('0x4')]},'countbusyretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb896('0x3')]},'calleridnum':{'type':Sequelize[_0xb896('0x3')]},'calleridname':{'type':Sequelize[_0xb896('0x3')]},'starttime':{'type':Sequelize[_0xb896('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb896('0x4')]},'droptime':{'type':Sequelize[_0xb896('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb896('0x3')]},'campaign':{'type':Sequelize[_0xb896('0x3')]},'campaigntype':{'type':Sequelize[_0xb896('0x3')]},'membername':{'type':Sequelize[_0xb896('0x3')]},'reason':{'type':Sequelize[_0xb896('0x3')]},'disposition':{'type':Sequelize[_0xb896('0x3')]},'secondDisposition':{'type':Sequelize[_0xb896('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb896('0x3')]},'dispositionat':{'type':Sequelize[_0xb896('0x4')],'set':function(_0x54d9ad){var _0x1f756c=this['getDataValue'](_0xb896('0x5'));if(_0x1f756c&&_0x54d9ad){this['setDataValue'](_0xb896('0x6'),moment(_0x54d9ad)[_0xb896('0x7')](moment(_0x1f756c),'seconds'));}}},'amd':{'type':Sequelize[_0xb896('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb896('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb896('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb896('0x4')]},'callback':{'type':Sequelize[_0xb896('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb896('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb896('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb896('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5373=['sequelize','exports','INTEGER','STRING','DATE','followuptime','diff','BOOLEAN'];(function(_0x2ff3b1,_0x55fbfd){var _0x5900d1=function(_0x2e24a9){while(--_0x2e24a9){_0x2ff3b1['push'](_0x2ff3b1['shift']());}};_0x5900d1(++_0x55fbfd);}(_0x5373,0x98));var _0x3537=function(_0x18de67,_0x2af4a4){_0x18de67=_0x18de67-0x0;var _0x28af8c=_0x5373[_0x18de67];return _0x28af8c;};'use strict';var Sequelize=require(_0x3537('0x0'));var moment=require('moment');module[_0x3537('0x1')]={'state':{'type':Sequelize[_0x3537('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3537('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3537('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3537('0x3')]},'calleridnum':{'type':Sequelize[_0x3537('0x3')]},'calleridname':{'type':Sequelize[_0x3537('0x3')]},'starttime':{'type':Sequelize[_0x3537('0x4')]},'responsetime':{'type':Sequelize[_0x3537('0x4')]},'answertime':{'type':Sequelize[_0x3537('0x4')]},'droptime':{'type':Sequelize[_0x3537('0x4')]},'endtime':{'type':Sequelize[_0x3537('0x4')]},'ringtime':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3537('0x3')]},'campaign':{'type':Sequelize[_0x3537('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3537('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3537('0x3')]},'secondDisposition':{'type':Sequelize[_0x3537('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x30ed08){var _0x2f833c=this['getDataValue']('endtime');if(_0x2f833c&&_0x30ed08){this['setDataValue'](_0x3537('0x5'),moment(_0x30ed08)[_0x3537('0x6')](moment(_0x2f833c),'seconds'));}}},'amd':{'type':Sequelize[_0x3537('0x7')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3537('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3537('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3537('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3537('0x4')]},'deleted':{'type':Sequelize[_0x3537('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3537('0x4')]},'recallme':{'type':Sequelize[_0x3537('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3537('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3537('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3537('0x2')],'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 d5a1730..a6331ab 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 _0x781d=['length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0x781d,0x14a));var _0xd781=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x781d[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['describe']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['describe']()[_0xd781('0x26')](respondWithResult(_0x16d16e,null))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x39ecdb,_0x336d30){if(_0x39ecdb[_0xd781('0x44')][_0xd781('0x45')]){delete _0x39ecdb['body'][_0xd781('0x45')];}return db[_0xd781('0x2c')][_0xd781('0x46')]({'where':{'uniqueid':_0x39ecdb['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x336d30,null))[_0xd781('0x26')](saveUpdates(_0x39ecdb['body'],null))[_0xd781('0x26')](respondWithResult(_0x336d30,null))[_0xd781('0x3f')](handleError(_0x336d30,null));};exports[_0xd781('0x47')]=function(_0x207546,_0x42a2f9,_0x599915){return db[_0xd781('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x207546[_0xd781('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xd781('0x4b')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xd781('0x4c')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal'](_0xd781('0x4f')))),_0xd781('0x50')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xd781('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd781('0x53')],[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')]['literal'](_0xd781('0x54')))),_0xd781('0x55')]]})['then'](handleEntityNotFound(_0x42a2f9,null))[_0xd781('0x26')](respondWithResult(_0x42a2f9,null))[_0xd781('0x3f')](handleError(_0x42a2f9,null));};exports[_0xd781('0x56')]=function(_0x2c4874,_0x2e8bab,_0x38bd3e){return db[_0xd781('0x2c')][_0xd781('0x57')]({'raw':![],'where':{'CampaignId':_0x2c4874[_0xd781('0x41')]['id']},'attributes':[[db[_0xd781('0x49')]['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x58')))),_0xd781('0x59')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5a')))),_0xd781('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4d')))),_0xd781('0x4e')],[db['sequelize']['fn'](_0xd781('0x48'),db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x4f')))),_0xd781('0x50')],[db['sequelize']['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db['sequelize'][_0xd781('0x4a')](_0xd781('0x51')))),_0xd781('0x52')],[db[_0xd781('0x49')]['fn']('COUNT',db[_0xd781('0x49')]['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')](_0xd781('0x5b')))),_0xd781('0x53')],[db['sequelize']['fn'](_0xd781('0x48'),db['sequelize']['fn']('IF',db[_0xd781('0x49')][_0xd781('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xd781('0x26')](handleEntityNotFound(_0x2e8bab,null))[_0xd781('0x26')](respondWithResult(_0x2e8bab,null))[_0xd781('0x3f')](handleError(_0x2e8bab,null));};exports[_0xd781('0x5c')]=function(_0x26a0a9,_0x172a05,_0x2e0401){return db[_0xd781('0x5d')][_0xd781('0x46')]({'where':{'id':_0x26a0a9['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x172a05,null))[_0xd781('0x26')](function(_0x4c712f){var _0x24e3f5;if(_0x4c712f){_0x24e3f5=squel['insert']()[_0xd781('0x5e')](_0xd781('0x5f'))['fromQuery'](['phone',_0xd781('0x60'),_0xd781('0x61'),_0xd781('0x62'),_0xd781('0x63'),_0xd781('0x64'),_0xd781('0x65')],squel['select']()[_0xd781('0x66')](_0xd781('0x67'),_0xd781('0x68'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),'ListId')[_0xd781('0x66')]('ANY_VALUE(VoiceQueueId)',_0xd781('0x63'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x65'))[_0xd781('0x6c')](_0xd781('0x6d'))[_0xd781('0x39')]('VoiceQueueId\x20=\x20?',_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]())['where'](_0xd781('0x6f'),_0x26a0a9[_0xd781('0x44')][_0xd781('0x70')]['toString']())['where'](_0xd781('0x71'))['where'](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x68'))[_0xd781('0x6c')]('cm_hopper')[_0xd781('0x39')](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))[_0xd781('0x6c')](_0xd781('0x6d'))['where'](_0xd781('0x74'),_0x26a0a9[_0xd781('0x41')]['id']['toString']())[_0xd781('0x39')](_0xd781('0x76')))[_0xd781('0x77')]('ContactId'))[_0xd781('0x6e')]();return db[_0xd781('0x49')]['query'](_0x24e3f5);}return[];})[_0xd781('0x26')](respondWithResult(_0x172a05,null))['catch'](handleError(_0x172a05,null));};exports[_0xd781('0x78')]=function(_0x23dba5,_0x3e0749,_0x192c95){return db[_0xd781('0x79')]['find']({'where':{'id':_0x23dba5[_0xd781('0x41')]['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x3e0749,null))[_0xd781('0x26')](function(_0x3897bf){var _0xaa945b;if(_0x3897bf){_0xaa945b=squel[_0xd781('0x7a')]()['into'](_0xd781('0x5f'))[_0xd781('0x7b')](['phone',_0xd781('0x60'),_0xd781('0x61'),'ListId',_0xd781('0x7c'),_0xd781('0x64'),_0xd781('0x65')],squel[_0xd781('0x73')]()[_0xd781('0x66')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd781('0x69'),_0xd781('0x60'))[_0xd781('0x66')](_0xd781('0x6a'),_0xd781('0x61'))[_0xd781('0x66')](_0xd781('0x6b'),_0xd781('0x62'))[_0xd781('0x66')]('ANY_VALUE(CampaignId)',_0xd781('0x7c'))[_0xd781('0x66')](_0xd781('0x69'),_0xd781('0x64'))[_0xd781('0x66')]('NOW()','updatedAt')['from'](_0xd781('0x6d'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id']['toString']())['where'](_0xd781('0x6f'),_0x23dba5[_0xd781('0x44')][_0xd781('0x70')][_0xd781('0x6e')]())['where'](_0xd781('0x71'))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')]('phone')[_0xd781('0x6c')](_0xd781('0x5f'))['where'](_0xd781('0x7d'),_0x23dba5[_0xd781('0x41')]['id'][_0xd781('0x6e')]()))[_0xd781('0x39')](_0xd781('0x72'),squel[_0xd781('0x73')]()[_0xd781('0x66')](_0xd781('0x75'))['from']('cm_hopper_final')[_0xd781('0x39')](_0xd781('0x7d'),_0x23dba5['params']['id'][_0xd781('0x6e')]())[_0xd781('0x39')]('state\x20=\x204'))[_0xd781('0x77')](_0xd781('0x61')))['toString']();return db[_0xd781('0x49')]['query'](_0xaa945b);}return[];})[_0xd781('0x26')](respondWithResult(_0x3e0749,null))[_0xd781('0x3f')](handleError(_0x3e0749,null));};exports[_0xd781('0x7e')]=function(_0x52b9c6,_0x5a2252,_0x356c56){return db[_0xd781('0x7f')]['findOne']({'where':{'VoiceQueueId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x63')],'CampaignId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x7c')],'ContactId':_0x52b9c6[_0xd781('0x44')][_0xd781('0x61')]}})[_0xd781('0x26')](handleEntityNotFound(_0x5a2252,null))[_0xd781('0x26')](function(_0x532fd8){if(_0x532fd8){return _0x532fd8;}return null;})[_0xd781('0x26')](respondWithResult(_0x5a2252,null))[_0xd781('0x3f')](handleError(_0x5a2252,null));}; \ No newline at end of file +var _0x2ef3=['params','keys','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','select','from','calleridnum','state\x20=\x204','group','Campaign','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CmHopperFinal','then','includeAll','include','findAll','catch','show'];(function(_0x2c497c,_0xb3a9a9){var _0x64b305=function(_0x23cfb){while(--_0x23cfb){_0x2c497c['push'](_0x2c497c['shift']());}};_0x64b305(++_0xb3a9a9);}(_0x2ef3,0xba));var _0x32ef=function(_0x514f38,_0x446d7a){_0x514f38=_0x514f38-0x0;var _0x3a16a2=_0x2ef3[_0x514f38];return _0x3a16a2;};'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['CmHopperFinal'][_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['CmHopperFinal'][_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['CmHopperFinal']['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')]()[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,null))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x30ad49,_0x36a65c){if(_0x30ad49['body'][_0x32ef('0x47')]){delete _0x30ad49[_0x32ef('0x48')][_0x32ef('0x47')];}return db[_0x32ef('0x3d')][_0x32ef('0x49')]({'where':{'uniqueid':_0x30ad49[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x36a65c,null))[_0x32ef('0x3e')](saveUpdates(_0x30ad49[_0x32ef('0x48')],null))[_0x32ef('0x3e')](respondWithResult(_0x36a65c,null))[_0x32ef('0x42')](handleError(_0x36a65c,null));};exports[_0x32ef('0x4a')]=function(_0x272377,_0x326445,_0x307ac8){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x272377[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x4d')))),_0x32ef('0x4e')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x50')))),'noAnswerContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x51')))),'busyContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x32ef('0x55')],[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),_0x32ef('0x57')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x32ef('0x3e')](handleEntityNotFound(_0x326445,null))[_0x32ef('0x3e')](respondWithResult(_0x326445,null))['catch'](handleError(_0x326445,null));};exports[_0x32ef('0x58')]=function(_0x12e1ef,_0x2b5703,_0x49c245){return db[_0x32ef('0x3d')][_0x32ef('0x41')]({'raw':![],'where':{'CampaignId':_0x12e1ef[_0x32ef('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize'][_0x32ef('0x4c')](_0x32ef('0x50')))),_0x32ef('0x59')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x32ef('0x51')))),_0x32ef('0x5a')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal'](_0x32ef('0x5b')))),_0x32ef('0x52')],[db[_0x32ef('0x4b')]['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x53')))),_0x32ef('0x54')],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x32ef('0x4f'),db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')][_0x32ef('0x4c')](_0x32ef('0x56')))),'reCallContacts'],[db[_0x32ef('0x4b')]['fn']('COUNT',db[_0x32ef('0x4b')]['fn']('IF',db[_0x32ef('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x32ef('0x5d')]]})[_0x32ef('0x3e')](handleEntityNotFound(_0x2b5703,null))[_0x32ef('0x3e')](respondWithResult(_0x2b5703,null))['catch'](handleError(_0x2b5703,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3b4a8e,_0x5edd29,_0x7d2c3a){return db[_0x32ef('0x5e')]['find']({'where':{'id':_0x3b4a8e[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x5edd29,null))[_0x32ef('0x3e')](function(_0xd7a78){var _0x9df27c;if(_0xd7a78){_0x9df27c=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')](_0x32ef('0x61'))[_0x32ef('0x62')]([_0x32ef('0x63'),_0x32ef('0x64'),_0x32ef('0x65'),'ListId','VoiceQueueId',_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')]('ANY_VALUE(calleridnum)',_0x32ef('0x63'))[_0x32ef('0x68')](_0x32ef('0x69'),'scheduledAt')[_0x32ef('0x68')]('ANY_VALUE(ContactId)',_0x32ef('0x65'))[_0x32ef('0x68')]('ANY_VALUE(ListId)','ListId')[_0x32ef('0x68')]('ANY_VALUE(VoiceQueueId)',_0x32ef('0x6a'))['field'](_0x32ef('0x69'),_0x32ef('0x66'))[_0x32ef('0x68')]('NOW()','updatedAt')['from'](_0x32ef('0x6b'))['where'](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x6e'),_0x3b4a8e[_0x32ef('0x48')]['state'][_0x32ef('0x6d')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x32ef('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()[_0x32ef('0x68')]('phone')[_0x32ef('0x70')](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x32ef('0x6f')]()['field'](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))[_0x32ef('0x38')](_0x32ef('0x6c'),_0x3b4a8e[_0x32ef('0x44')]['id']['toString']())[_0x32ef('0x38')](_0x32ef('0x72')))[_0x32ef('0x73')](_0x32ef('0x65')))[_0x32ef('0x6d')]();return db['sequelize']['query'](_0x9df27c);}return[];})[_0x32ef('0x3e')](respondWithResult(_0x5edd29,null))[_0x32ef('0x42')](handleError(_0x5edd29,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x211fb1,_0x2e333d,_0x338578){return db[_0x32ef('0x74')][_0x32ef('0x49')]({'where':{'id':_0x211fb1[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x2e333d,null))[_0x32ef('0x3e')](function(_0x353641){var _0x54e65d;if(_0x353641){_0x54e65d=squel[_0x32ef('0x5f')]()[_0x32ef('0x60')]('cm_hopper')[_0x32ef('0x62')](['phone',_0x32ef('0x64'),'ContactId',_0x32ef('0x75'),_0x32ef('0x76'),_0x32ef('0x66'),_0x32ef('0x67')],squel['select']()[_0x32ef('0x68')](_0x32ef('0x77'),_0x32ef('0x63'))['field']('NOW()','scheduledAt')[_0x32ef('0x68')](_0x32ef('0x78'),_0x32ef('0x65'))[_0x32ef('0x68')](_0x32ef('0x79'),'ListId')[_0x32ef('0x68')]('ANY_VALUE(CampaignId)',_0x32ef('0x76'))[_0x32ef('0x68')](_0x32ef('0x69'),'createdAt')[_0x32ef('0x68')](_0x32ef('0x69'),_0x32ef('0x67'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1['params']['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x20?',_0x211fb1['body'][_0x32ef('0x7b')][_0x32ef('0x6d')]())[_0x32ef('0x38')](_0x32ef('0x7c'))['where'](_0x32ef('0x7d'),squel['select']()['field'](_0x32ef('0x63'))['from'](_0x32ef('0x61'))[_0x32ef('0x38')](_0x32ef('0x7a'),_0x211fb1['params']['id']['toString']()))[_0x32ef('0x38')](_0x32ef('0x7d'),squel[_0x32ef('0x6f')]()[_0x32ef('0x68')](_0x32ef('0x71'))[_0x32ef('0x70')](_0x32ef('0x6b'))['where'](_0x32ef('0x7a'),_0x211fb1[_0x32ef('0x44')]['id'][_0x32ef('0x6d')]())[_0x32ef('0x38')]('state\x20=\x204'))['group'](_0x32ef('0x65')))['toString']();return db[_0x32ef('0x4b')][_0x32ef('0x2f')](_0x54e65d);}return[];})['then'](respondWithResult(_0x2e333d,null))['catch'](handleError(_0x2e333d,null));};exports['checkContactHopper']=function(_0x201675,_0x33f6c3,_0xa53375){return db[_0x32ef('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x201675[_0x32ef('0x48')][_0x32ef('0x6a')],'CampaignId':_0x201675[_0x32ef('0x48')]['CampaignId'],'ContactId':_0x201675[_0x32ef('0x48')]['ContactId']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x33f6c3,null))[_0x32ef('0x3e')](function(_0x5f4890){if(_0x5f4890){return _0x5f4890;}return null;})['then'](respondWithResult(_0x33f6c3,null))[_0x32ef('0x42')](handleError(_0x33f6c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0b8d550..99b705f 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 _0xf8c0=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','path','exports'];(function(_0x4221bf,_0x5c86fa){var _0x5d5d99=function(_0x2fab2){while(--_0x2fab2){_0x4221bf['push'](_0x4221bf['shift']());}};_0x5d5d99(++_0x5c86fa);}(_0xf8c0,0x10d));var _0x0f8c=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xf8c0[_0x43fdf8];return _0x1160c6;};'use strict';var _=require(_0x0f8c('0x0'));var util=require(_0x0f8c('0x1'));var logger=require(_0x0f8c('0x2'))(_0x0f8c('0x3'));var moment=require('moment');var BPromise=require(_0x0f8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f8c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x0f8c('0x6')]=function(_0x173f8f,_0x488892){return _0x173f8f[_0x0f8c('0x7')](_0x0f8c('0x8'),attributes,{'tableName':_0x0f8c('0x9'),'paranoid':![],'indexes':[{'name':_0x0f8c('0xa'),'fields':[_0x0f8c('0xa')]},{'name':_0x0f8c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7339=['calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x29ca48,_0x6b00fe){var _0x5f47d2=function(_0x58b43a){while(--_0x58b43a){_0x29ca48['push'](_0x29ca48['shift']());}};_0x5f47d2(++_0x6b00fe);}(_0x7339,0xd4));var _0x9733=function(_0x30843a,_0x147e7e){_0x30843a=_0x30843a-0x0;var _0xe2d97a=_0x7339[_0x30843a];return _0xe2d97a;};'use strict';var _=require(_0x9733('0x0'));var util=require('util');var logger=require(_0x9733('0x1'))(_0x9733('0x2'));var moment=require(_0x9733('0x3'));var BPromise=require(_0x9733('0x4'));var rp=require(_0x9733('0x5'));var fs=require('fs');var path=require(_0x9733('0x6'));var rimraf=require(_0x9733('0x7'));var config=require('../../config/environment');var attributes=require(_0x9733('0x8'));module[_0x9733('0x9')]=function(_0x7f27c0,_0x376248){return _0x7f27c0[_0x9733('0xa')](_0x9733('0xb'),attributes,{'tableName':_0x9733('0xc'),'paranoid':![],'indexes':[{'name':_0x9733('0xd'),'fields':[_0x9733('0xd')]},{'name':_0x9733('0xe'),'fields':[_0x9733('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 649a648..25bea85 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x9fd77a,_0x3ea75f){var _0x5dc4a6=function(_0x4aa0d6){while(--_0x4aa0d6){_0x9fd77a['push'](_0x9fd77a['shift']());}};_0x5dc4a6(++_0x3ea75f);}(_0x7a54,0x106));var _0x47a5=function(_0x4ac175,_0xd68907){_0x4ac175=_0x4ac175-0x0;var _0x7620da=_0x7a54[_0x4ac175];return _0x7620da;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x905d95,_0x1dbfcb){var _0x46af04=function(_0x30a715){while(--_0x30a715){_0x905d95['push'](_0x905d95['shift']());}};_0x46af04(++_0x1dbfcb);}(_0xb10b,0x12a));var _0xbb10=function(_0x116549,_0x210e8b){_0x116549=_0x116549-0x0;var _0x1321e5=_0xb10b[_0x116549];return _0x1321e5;};'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 1ff8229..54bc770 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 _0x66fa=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x229527,_0x337664){var _0x1b88d3=function(_0x571b4e){while(--_0x571b4e){_0x229527['push'](_0x229527['shift']());}};_0x1b88d3(++_0x337664);}(_0x66fa,0x126));var _0xa66f=function(_0x2ebddb,_0x20f4e7){_0x2ebddb=_0x2ebddb-0x0;var _0x45d4e8=_0x66fa[_0x2ebddb];return _0x45d4e8;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require(_0xa66f('0x2'));var timeout=require(_0xa66f('0x3'));var express=require('express');var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xa66f('0x7')]('/',auth[_0xa66f('0x8')](),controller[_0xa66f('0x9')]);router[_0xa66f('0x7')](_0xa66f('0xa'),auth[_0xa66f('0x8')](),controller['describe']);router[_0xa66f('0x7')](_0xa66f('0xb'),auth[_0xa66f('0x8')](),controller['show']);router[_0xa66f('0x7')](_0xa66f('0xc'),auth['isAuthenticated'](),controller[_0xa66f('0xd')]);router['get'](_0xa66f('0xe'),auth[_0xa66f('0x8')](),controller[_0xa66f('0xf')]);router[_0xa66f('0x10')](_0xa66f('0x11'),auth[_0xa66f('0x8')](),controller[_0xa66f('0x12')]);router['post'](_0xa66f('0x13'),auth[_0xa66f('0x8')](),controller[_0xa66f('0x14')]);router[_0xa66f('0x10')](_0xa66f('0x15'),auth[_0xa66f('0x8')](),controller[_0xa66f('0x16')]);router[_0xa66f('0x17')](_0xa66f('0xb'),auth[_0xa66f('0x8')](),controller[_0xa66f('0x18')]);module[_0xa66f('0x19')]=router; \ No newline at end of file +var _0x52ac=['index','/describe','describe','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0x53ebab,_0x4f6aba){var _0x4156b3=function(_0x1aca3c){while(--_0x1aca3c){_0x53ebab['push'](_0x53ebab['shift']());}};_0x4156b3(++_0x4f6aba);}(_0x52ac,0x12e));var _0xc52a=function(_0x2c3bd9,_0x45f815){_0x2c3bd9=_0x2c3bd9-0x0;var _0x112e55=_0x52ac[_0x2c3bd9];return _0x112e55;};'use strict';var multer=require(_0xc52a('0x0'));var util=require('util');var path=require(_0xc52a('0x1'));var timeout=require(_0xc52a('0x2'));var express=require(_0xc52a('0x3'));var router=express[_0xc52a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc52a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc52a('0x6'));var controller=require(_0xc52a('0x7'));router[_0xc52a('0x8')]('/',auth[_0xc52a('0x9')](),controller[_0xc52a('0xa')]);router[_0xc52a('0x8')](_0xc52a('0xb'),auth['isAuthenticated'](),controller[_0xc52a('0xc')]);router[_0xc52a('0x8')](_0xc52a('0xd'),auth[_0xc52a('0x9')](),controller['show']);router[_0xc52a('0x8')](_0xc52a('0xe'),auth[_0xc52a('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xc52a('0x8')](_0xc52a('0xf'),auth[_0xc52a('0x9')](),controller[_0xc52a('0x10')]);router['post'](_0xc52a('0x11'),auth[_0xc52a('0x9')](),controller[_0xc52a('0x12')]);router[_0xc52a('0x13')](_0xc52a('0x14'),auth[_0xc52a('0x9')](),controller[_0xc52a('0x15')]);router[_0xc52a('0x13')](_0xc52a('0x16'),auth[_0xc52a('0x9')](),controller[_0xc52a('0x17')]);router[_0xc52a('0x18')]('/:id',auth[_0xc52a('0x9')](),controller['update']);module[_0xc52a('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5f88e0d..63ee5a7 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 _0x84d6=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x2683d4,_0x1148c2){var _0x493266=function(_0x566c4a){while(--_0x566c4a){_0x2683d4['push'](_0x2683d4['shift']());}};_0x493266(++_0x1148c2);}(_0x84d6,0x180));var _0x684d=function(_0xc86613,_0x29cb6e){_0xc86613=_0xc86613-0x0;var _0x313542=_0x84d6[_0xc86613];return _0x313542;};'use strict';var Sequelize=require(_0x684d('0x0'));module[_0x684d('0x1')]={'state':{'type':Sequelize[_0x684d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x684d('0x3')]},'scheduledat':{'type':Sequelize[_0x684d('0x4')]},'countbusyretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x684d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x684d('0x3')]},'originatecalleridname':{'type':Sequelize[_0x684d('0x3')]},'calleridnum':{'type':Sequelize[_0x684d('0x3')]},'calleridname':{'type':Sequelize[_0x684d('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x684d('0x4')]},'droptime':{'type':Sequelize[_0x684d('0x4')]},'endtime':{'type':Sequelize[_0x684d('0x4')]},'ringtime':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x684d('0x3')]},'campaign':{'type':Sequelize[_0x684d('0x3')]},'campaigntype':{'type':Sequelize[_0x684d('0x3')]},'membername':{'type':Sequelize[_0x684d('0x3')]},'reason':{'type':Sequelize[_0x684d('0x3')]},'amd':{'type':Sequelize[_0x684d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x684d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x684d('0x4')]},'recallme':{'type':Sequelize[_0x684d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x684d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x684d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4892=['DATE','BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x585723,_0x25250e){var _0x54edcf=function(_0x9cd647){while(--_0x9cd647){_0x585723['push'](_0x585723['shift']());}};_0x54edcf(++_0x25250e);}(_0x4892,0x1ee));var _0x2489=function(_0x714a42,_0x29c375){_0x714a42=_0x714a42-0x0;var _0x353d83=_0x4892[_0x714a42];return _0x353d83;};'use strict';var Sequelize=require(_0x2489('0x0'));module[_0x2489('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2489('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2489('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x2489('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2489('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2489('0x4')]},'responsetime':{'type':Sequelize[_0x2489('0x4')]},'answertime':{'type':Sequelize[_0x2489('0x4')]},'droptime':{'type':Sequelize[_0x2489('0x4')]},'endtime':{'type':Sequelize[_0x2489('0x4')]},'ringtime':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2489('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x2489('0x2')]},'amd':{'type':Sequelize[_0x2489('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2489('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2489('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x2489('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2489('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2489('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2489('0x3')],'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 ed67384..af2db73 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 _0x7190=['limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','findAll','catch','show','params','includeAll','options','create','describe','update','body','uniqueid','find','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset'];(function(_0x1e9a3c,_0xe26243){var _0x3c7c29=function(_0x280196){while(--_0x280196){_0x1e9a3c['push'](_0x1e9a3c['shift']());}};_0x3c7c29(++_0xe26243);}(_0x7190,0xbf));var _0x0719=function(_0x4233aa,_0x4e707c){_0x4233aa=_0x4233aa-0x0;var _0xf4bdaf=_0x7190[_0x4233aa];return _0xf4bdaf;};'use strict';var emlformat=require(_0x0719('0x0'));var rimraf=require(_0x0719('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0719('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0719('0x3'));var Mustache=require(_0x0719('0x4'));var util=require(_0x0719('0x5'));var path=require(_0x0719('0x6'));var sox=require(_0x0719('0x7'));var csv=require(_0x0719('0x8'));var ejs=require(_0x0719('0x9'));var fs=require('fs');var fs_extra=require(_0x0719('0xa'));var _=require(_0x0719('0xb'));var squel=require(_0x0719('0xc'));var crypto=require(_0x0719('0xd'));var jsforce=require(_0x0719('0xe'));var deskjs=require(_0x0719('0xf'));var toCsv=require(_0x0719('0x8'));var querystring=require('querystring');var Papa=require(_0x0719('0x10'));var Redis=require(_0x0719('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0719('0x12'));var as=require(_0x0719('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0719('0x14'))('api');var utils=require(_0x0719('0x15'));var config=require(_0x0719('0x16'));var licenseUtil=require(_0x0719('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e2ba,_0x4e3e6b){_0x4e3e6b=_0x4e3e6b||0xcc;return function(_0x1c26fa){if(_0x1c26fa){return _0x35e2ba[_0x0719('0x18')](_0x4e3e6b);}return _0x35e2ba[_0x0719('0x19')](_0x4e3e6b)[_0x0719('0x1a')]();};}function respondWithResult(_0x55628d,_0x298761){_0x298761=_0x298761||0xc8;return function(_0x2c5193){if(_0x2c5193){return _0x55628d[_0x0719('0x19')](_0x298761)[_0x0719('0x1b')](_0x2c5193);}};}function respondWithFilteredResult(_0x3f07f6,_0x56fc9c){return function(_0x223f3d){if(_0x223f3d){var _0x9c73b6=typeof _0x56fc9c['offset']===_0x0719('0x1c')&&typeof _0x56fc9c['limit']===_0x0719('0x1c');var _0x13dc85=_0x223f3d[_0x0719('0x1d')];var _0x480fad=_0x9c73b6?0x0:_0x56fc9c['offset'];var _0xb9c4ce=_0x9c73b6?_0x223f3d[_0x0719('0x1d')]:_0x56fc9c[_0x0719('0x1e')]+_0x56fc9c[_0x0719('0x1f')];var _0x15df17;if(_0xb9c4ce>=_0x13dc85){_0xb9c4ce=_0x13dc85;_0x15df17=0xc8;}else{_0x15df17=0xce;}_0x3f07f6[_0x0719('0x19')](_0x15df17);return _0x3f07f6[_0x0719('0x20')](_0x0719('0x21'),_0x480fad+'-'+_0xb9c4ce+'/'+_0x13dc85)['json'](_0x223f3d);}return null;};}function patchUpdates(_0xbf9e20){return function(_0x3e1548){try{jsonpatch[_0x0719('0x22')](_0x3e1548,_0xbf9e20,!![]);}catch(_0x5c1c45){return BPromise[_0x0719('0x23')](_0x5c1c45);}return _0x3e1548[_0x0719('0x24')]();};}function saveUpdates(_0x3c0a97,_0x55057b){return function(_0x4493fa){if(_0x4493fa){return _0x4493fa['update'](_0x3c0a97)[_0x0719('0x25')](function(_0x3e5fc1){return _0x3e5fc1;});}return null;};}function removeEntity(_0xebd49f,_0x58cfd8){return function(_0x5cfe8c){if(_0x5cfe8c){return _0x5cfe8c[_0x0719('0x26')]()['then'](function(){_0xebd49f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b008,_0x5470d8){return function(_0x26d63a){if(!_0x26d63a){_0x20b008[_0x0719('0x18')](0x194);}return _0x26d63a;};}function handleError(_0x425528,_0x33292b){_0x33292b=_0x33292b||0x1f4;return function(_0xbcf174){logger[_0x0719('0x27')](_0xbcf174[_0x0719('0x28')]);if(_0xbcf174[_0x0719('0x29')]){delete _0xbcf174[_0x0719('0x29')];}_0x425528[_0x0719('0x19')](_0x33292b)['send'](_0xbcf174);};}exports['index']=function(_0x5be1d2,_0x274000){var _0x404658={},_0x6b69e8={},_0x2e3839={'count':0x0,'rows':[]};var _0x2aa44d=_[_0x0719('0x2a')](db[_0x0719('0x2b')][_0x0719('0x2c')],function(_0x162744){return{'name':_0x162744[_0x0719('0x2d')],'type':_0x162744[_0x0719('0x2e')][_0x0719('0x2f')]};});_0x6b69e8[_0x0719('0x30')]=_[_0x0719('0x2a')](_0x2aa44d,'name');_0x6b69e8['query']=_[_0x0719('0x31')](_0x5be1d2[_0x0719('0x32')]);_0x6b69e8['filters']=_[_0x0719('0x33')](_0x6b69e8[_0x0719('0x30')],_0x6b69e8['query']);_0x404658['attributes']=_[_0x0719('0x33')](_0x6b69e8[_0x0719('0x30')],qs[_0x0719('0x34')](_0x5be1d2['query']['fields']));_0x404658[_0x0719('0x35')]=_0x404658[_0x0719('0x35')][_0x0719('0x36')]?_0x404658[_0x0719('0x35')]:_0x6b69e8[_0x0719('0x30')];if(!_0x5be1d2[_0x0719('0x32')][_0x0719('0x37')]('nolimit')){_0x404658[_0x0719('0x1f')]=qs['limit'](_0x5be1d2[_0x0719('0x32')][_0x0719('0x1f')]);_0x404658[_0x0719('0x1e')]=qs[_0x0719('0x1e')](_0x5be1d2['query'][_0x0719('0x1e')]);}_0x404658['order']=qs[_0x0719('0x38')](_0x5be1d2['query']['sort']);_0x404658[_0x0719('0x39')]=qs[_0x0719('0x3a')](_['pick'](_0x5be1d2[_0x0719('0x32')],_0x6b69e8[_0x0719('0x3a')]),_0x2aa44d);if(_0x5be1d2['query'][_0x0719('0x3b')]){_0x404658[_0x0719('0x39')]=_['merge'](_0x404658['where'],{'$or':_[_0x0719('0x2a')](_0x2aa44d,function(_0x1d95fb){if(_0x1d95fb[_0x0719('0x2e')]!==_0x0719('0x3c')){var _0x418636={};_0x418636[_0x1d95fb[_0x0719('0x29')]]={'$like':'%'+_0x5be1d2[_0x0719('0x32')][_0x0719('0x3b')]+'%'};return _0x418636;}})});}_0x404658=_[_0x0719('0x3d')]({},_0x404658,_0x5be1d2['options']);var _0x3309c4={'where':_0x404658['where']};return db['CmHopperHistory'][_0x0719('0x1d')](_0x3309c4)[_0x0719('0x25')](function(_0x2311a8){_0x2e3839[_0x0719('0x1d')]=_0x2311a8;if(_0x5be1d2[_0x0719('0x32')]['includeAll']){_0x404658['include']=[{'all':!![]}];}return db[_0x0719('0x2b')][_0x0719('0x3e')](_0x404658);})[_0x0719('0x25')](function(_0x50e7a3){_0x2e3839['rows']=_0x50e7a3;return _0x2e3839;})[_0x0719('0x25')](respondWithFilteredResult(_0x274000,_0x404658))[_0x0719('0x3f')](handleError(_0x274000,null));};exports[_0x0719('0x40')]=function(_0x1f1546,_0x2bd432){var _0x265980={'raw':!![],'where':{'id':_0x1f1546[_0x0719('0x41')]['id']}},_0x2c7452={};_0x2c7452[_0x0719('0x30')]=_[_0x0719('0x31')](db[_0x0719('0x2b')][_0x0719('0x2c')]);_0x2c7452['query']=_['keys'](_0x1f1546['query']);_0x2c7452['filters']=_['intersection'](_0x2c7452[_0x0719('0x30')],_0x2c7452['query']);_0x265980[_0x0719('0x35')]=_[_0x0719('0x33')](_0x2c7452[_0x0719('0x30')],qs['fields'](_0x1f1546[_0x0719('0x32')][_0x0719('0x34')]));_0x265980[_0x0719('0x35')]=_0x265980[_0x0719('0x35')][_0x0719('0x36')]?_0x265980['attributes']:_0x2c7452[_0x0719('0x30')];if(_0x1f1546[_0x0719('0x32')][_0x0719('0x42')]){_0x265980['include']=[{'all':!![]}];}_0x265980=_[_0x0719('0x3d')]({},_0x265980,_0x1f1546[_0x0719('0x43')]);return db[_0x0719('0x2b')]['find'](_0x265980)['then'](handleEntityNotFound(_0x2bd432,null))[_0x0719('0x25')](respondWithResult(_0x2bd432,null))[_0x0719('0x3f')](handleError(_0x2bd432,null));};exports['create']=function(_0x17bc9e,_0x2984e2){return db['CmHopperHistory'][_0x0719('0x44')](_0x17bc9e['body'],{})[_0x0719('0x25')](respondWithResult(_0x2984e2,0xc9))['catch'](handleError(_0x2984e2,null));};exports['describe']=function(_0x5198b8,_0x5e99e1){return db[_0x0719('0x2b')][_0x0719('0x45')]()[_0x0719('0x25')](respondWithResult(_0x5e99e1,null))[_0x0719('0x3f')](handleError(_0x5e99e1,null));};exports[_0x0719('0x46')]=function(_0x1fd4c6,_0x2b717d){if(_0x1fd4c6[_0x0719('0x47')][_0x0719('0x48')]){delete _0x1fd4c6[_0x0719('0x47')]['uniqueid'];}return db[_0x0719('0x2b')][_0x0719('0x49')]({'where':{'uniqueid':_0x1fd4c6[_0x0719('0x41')]['id']}})[_0x0719('0x25')](handleEntityNotFound(_0x2b717d,null))[_0x0719('0x25')](saveUpdates(_0x1fd4c6['body'],null))[_0x0719('0x25')](respondWithResult(_0x2b717d,null))[_0x0719('0x3f')](handleError(_0x2b717d,null));}; \ No newline at end of file +var _0x91d6=['map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','create','describe','uniqueid','find','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','model'];(function(_0x41f31f,_0x4f677a){var _0x493f80=function(_0x30bde0){while(--_0x30bde0){_0x41f31f['push'](_0x41f31f['shift']());}};_0x493f80(++_0x4f677a);}(_0x91d6,0x15b));var _0x691d=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x91d6[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x691d('0x0'));var jsonpatch=require(_0x691d('0x1'));var rp=require(_0x691d('0x2'));var moment=require(_0x691d('0x3'));var BPromise=require(_0x691d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x691d('0x5'));var csv=require('to-csv');var ejs=require(_0x691d('0x6'));var fs=require('fs');var fs_extra=require(_0x691d('0x7'));var _=require(_0x691d('0x8'));var squel=require(_0x691d('0x9'));var crypto=require(_0x691d('0xa'));var jsforce=require(_0x691d('0xb'));var deskjs=require(_0x691d('0xc'));var toCsv=require(_0x691d('0xd'));var querystring=require(_0x691d('0xe'));var Papa=require(_0x691d('0xf'));var Redis=require(_0x691d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x691d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x691d('0x12'));var logger=require(_0x691d('0x13'))(_0x691d('0x14'));var utils=require(_0x691d('0x15'));var config=require(_0x691d('0x16'));var licenseUtil=require(_0x691d('0x17'));var db=require(_0x691d('0x18'))['db'];function respondWithStatusCode(_0x338bf3,_0x286abd){_0x286abd=_0x286abd||0xcc;return function(_0x1b969f){if(_0x1b969f){return _0x338bf3[_0x691d('0x19')](_0x286abd);}return _0x338bf3[_0x691d('0x1a')](_0x286abd)[_0x691d('0x1b')]();};}function respondWithResult(_0x2b15e0,_0x438151){_0x438151=_0x438151||0xc8;return function(_0x2a338e){if(_0x2a338e){return _0x2b15e0['status'](_0x438151)[_0x691d('0x1c')](_0x2a338e);}};}function respondWithFilteredResult(_0x30af5f,_0x20fcd8){return function(_0x28cb7f){if(_0x28cb7f){var _0x2ffd16=typeof _0x20fcd8[_0x691d('0x1d')]===_0x691d('0x1e')&&typeof _0x20fcd8[_0x691d('0x1f')]==='undefined';var _0x33d2a8=_0x28cb7f[_0x691d('0x20')];var _0x4668d5=_0x2ffd16?0x0:_0x20fcd8[_0x691d('0x1d')];var _0x15ecad=_0x2ffd16?_0x28cb7f[_0x691d('0x20')]:_0x20fcd8[_0x691d('0x1d')]+_0x20fcd8[_0x691d('0x1f')];var _0x5a86a6;if(_0x15ecad>=_0x33d2a8){_0x15ecad=_0x33d2a8;_0x5a86a6=0xc8;}else{_0x5a86a6=0xce;}_0x30af5f[_0x691d('0x1a')](_0x5a86a6);return _0x30af5f[_0x691d('0x21')](_0x691d('0x22'),_0x4668d5+'-'+_0x15ecad+'/'+_0x33d2a8)[_0x691d('0x1c')](_0x28cb7f);}return null;};}function patchUpdates(_0x41b83c){return function(_0x2f9ff9){try{jsonpatch[_0x691d('0x23')](_0x2f9ff9,_0x41b83c,!![]);}catch(_0x179419){return BPromise[_0x691d('0x24')](_0x179419);}return _0x2f9ff9[_0x691d('0x25')]();};}function saveUpdates(_0xef4eff,_0x29bec8){return function(_0x5e9ad9){if(_0x5e9ad9){return _0x5e9ad9[_0x691d('0x26')](_0xef4eff)[_0x691d('0x27')](function(_0x40c427){return _0x40c427;});}return null;};}function removeEntity(_0x3e55ae,_0x4e65f5){return function(_0x15c7f1){if(_0x15c7f1){return _0x15c7f1[_0x691d('0x28')]()[_0x691d('0x27')](function(){_0x3e55ae[_0x691d('0x1a')](0xcc)[_0x691d('0x1b')]();});}};}function handleEntityNotFound(_0x5ddf03,_0x30f492){return function(_0x3111a6){if(!_0x3111a6){_0x5ddf03[_0x691d('0x19')](0x194);}return _0x3111a6;};}function handleError(_0x3f161b,_0x32b79b){_0x32b79b=_0x32b79b||0x1f4;return function(_0x3650f1){logger['error'](_0x3650f1['stack']);if(_0x3650f1[_0x691d('0x29')]){delete _0x3650f1[_0x691d('0x29')];}_0x3f161b['status'](_0x32b79b)[_0x691d('0x2a')](_0x3650f1);};}exports[_0x691d('0x2b')]=function(_0x9756d,_0x4c1b70){var _0x4b4996={},_0x184769={},_0x598af2={'count':0x0,'rows':[]};var _0x150f4d=_['map'](db['CmHopperHistory'][_0x691d('0x2c')],function(_0x17cb46){return{'name':_0x17cb46[_0x691d('0x2d')],'type':_0x17cb46['type'][_0x691d('0x2e')]};});_0x184769[_0x691d('0x2f')]=_[_0x691d('0x30')](_0x150f4d,_0x691d('0x29'));_0x184769[_0x691d('0x31')]=_[_0x691d('0x32')](_0x9756d[_0x691d('0x31')]);_0x184769[_0x691d('0x33')]=_[_0x691d('0x34')](_0x184769[_0x691d('0x2f')],_0x184769[_0x691d('0x31')]);_0x4b4996['attributes']=_[_0x691d('0x34')](_0x184769[_0x691d('0x2f')],qs['fields'](_0x9756d['query'][_0x691d('0x35')]));_0x4b4996[_0x691d('0x36')]=_0x4b4996[_0x691d('0x36')][_0x691d('0x37')]?_0x4b4996[_0x691d('0x36')]:_0x184769[_0x691d('0x2f')];if(!_0x9756d[_0x691d('0x31')][_0x691d('0x38')](_0x691d('0x39'))){_0x4b4996[_0x691d('0x1f')]=qs['limit'](_0x9756d[_0x691d('0x31')][_0x691d('0x1f')]);_0x4b4996['offset']=qs['offset'](_0x9756d[_0x691d('0x31')][_0x691d('0x1d')]);}_0x4b4996[_0x691d('0x3a')]=qs[_0x691d('0x3b')](_0x9756d[_0x691d('0x31')][_0x691d('0x3b')]);_0x4b4996[_0x691d('0x3c')]=qs[_0x691d('0x33')](_[_0x691d('0x3d')](_0x9756d[_0x691d('0x31')],_0x184769[_0x691d('0x33')]),_0x150f4d);if(_0x9756d[_0x691d('0x31')]['filter']){_0x4b4996['where']=_['merge'](_0x4b4996[_0x691d('0x3c')],{'$or':_[_0x691d('0x30')](_0x150f4d,function(_0x218329){if(_0x218329[_0x691d('0x3e')]!==_0x691d('0x3f')){var _0x2f7a75={};_0x2f7a75[_0x218329[_0x691d('0x29')]]={'$like':'%'+_0x9756d[_0x691d('0x31')]['filter']+'%'};return _0x2f7a75;}})});}_0x4b4996=_[_0x691d('0x40')]({},_0x4b4996,_0x9756d[_0x691d('0x41')]);var _0x8abddc={'where':_0x4b4996['where']};return db[_0x691d('0x42')][_0x691d('0x20')](_0x8abddc)[_0x691d('0x27')](function(_0x1cd457){_0x598af2['count']=_0x1cd457;if(_0x9756d[_0x691d('0x31')][_0x691d('0x43')]){_0x4b4996[_0x691d('0x44')]=[{'all':!![]}];}return db[_0x691d('0x42')][_0x691d('0x45')](_0x4b4996);})[_0x691d('0x27')](function(_0x4a800e){_0x598af2[_0x691d('0x46')]=_0x4a800e;return _0x598af2;})[_0x691d('0x27')](respondWithFilteredResult(_0x4c1b70,_0x4b4996))[_0x691d('0x47')](handleError(_0x4c1b70,null));};exports[_0x691d('0x48')]=function(_0x3ccb28,_0x1fab8b){var _0x405ab5={'raw':!![],'where':{'id':_0x3ccb28[_0x691d('0x49')]['id']}},_0x2ef933={};_0x2ef933[_0x691d('0x2f')]=_[_0x691d('0x32')](db[_0x691d('0x42')][_0x691d('0x2c')]);_0x2ef933[_0x691d('0x31')]=_['keys'](_0x3ccb28[_0x691d('0x31')]);_0x2ef933[_0x691d('0x33')]=_[_0x691d('0x34')](_0x2ef933['model'],_0x2ef933[_0x691d('0x31')]);_0x405ab5[_0x691d('0x36')]=_[_0x691d('0x34')](_0x2ef933[_0x691d('0x2f')],qs[_0x691d('0x35')](_0x3ccb28[_0x691d('0x31')][_0x691d('0x35')]));_0x405ab5[_0x691d('0x36')]=_0x405ab5[_0x691d('0x36')]['length']?_0x405ab5[_0x691d('0x36')]:_0x2ef933[_0x691d('0x2f')];if(_0x3ccb28[_0x691d('0x31')][_0x691d('0x43')]){_0x405ab5[_0x691d('0x44')]=[{'all':!![]}];}_0x405ab5=_[_0x691d('0x40')]({},_0x405ab5,_0x3ccb28[_0x691d('0x41')]);return db[_0x691d('0x42')]['find'](_0x405ab5)[_0x691d('0x27')](handleEntityNotFound(_0x1fab8b,null))[_0x691d('0x27')](respondWithResult(_0x1fab8b,null))[_0x691d('0x47')](handleError(_0x1fab8b,null));};exports[_0x691d('0x4a')]=function(_0x42091c,_0x1e008e){return db[_0x691d('0x42')][_0x691d('0x4a')](_0x42091c['body'],{})[_0x691d('0x27')](respondWithResult(_0x1e008e,0xc9))['catch'](handleError(_0x1e008e,null));};exports[_0x691d('0x4b')]=function(_0x170a0c,_0x4a4b59){return db[_0x691d('0x42')][_0x691d('0x4b')]()[_0x691d('0x27')](respondWithResult(_0x4a4b59,null))['catch'](handleError(_0x4a4b59,null));};exports[_0x691d('0x26')]=function(_0x4b73d9,_0x80f654){if(_0x4b73d9['body'][_0x691d('0x4c')]){delete _0x4b73d9['body'][_0x691d('0x4c')];}return db[_0x691d('0x42')][_0x691d('0x4d')]({'where':{'uniqueid':_0x4b73d9['params']['id']}})[_0x691d('0x27')](handleEntityNotFound(_0x80f654,null))[_0x691d('0x27')](saveUpdates(_0x4b73d9[_0x691d('0x4e')],null))['then'](respondWithResult(_0x80f654,null))[_0x691d('0x47')](handleError(_0x80f654,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 99d2eab..3b85e33 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 _0xc6ac=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x52a53d,_0x39240f){var _0x4cbbc4=function(_0x6bd2b5){while(--_0x6bd2b5){_0x52a53d['push'](_0x52a53d['shift']());}};_0x4cbbc4(++_0x39240f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x370d0d,_0x1a8e22){_0x370d0d=_0x370d0d-0x0;var _0x24a565=_0xc6ac[_0x370d0d];return _0x24a565;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['endtime']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x508a=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require('util');var logger=require(_0xa508('0x1'))(_0xa508('0x2'));var moment=require(_0xa508('0x3'));var BPromise=require(_0xa508('0x4'));var rp=require(_0xa508('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa508('0x6'));var config=require(_0xa508('0x7'));var attributes=require(_0xa508('0x8'));module['exports']=function(_0x89d08e,_0x11c154){return _0x89d08e[_0xa508('0x9')]('CmHopperHistory',attributes,{'tableName':_0xa508('0xa'),'paranoid':![],'indexes':[{'name':_0xa508('0xb'),'fields':['endtime']},{'name':_0xa508('0xc'),'fields':[_0xa508('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f463f65..9f2bdec 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 _0x6599=['outboundNoAnswerCallsDay','`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','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','create','body','options','raw','CmHopperHistory','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null'];(function(_0x5bea4b,_0x42054a){var _0x143dda=function(_0x4dc998){while(--_0x4dc998){_0x5bea4b['push'](_0x5bea4b['shift']());}};_0x143dda(++_0x42054a);}(_0x6599,0xb0));var _0x9659=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x6599[_0x22cb5f];return _0x274d36;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});}exports[_0x9659('0x16')]=function(_0x434249){var _0x1a2c0d=this;return new Promise(function(_0x266721,_0x1e4f0e){return db['CmHopperHistory'][_0x9659('0x17')](_0x434249[_0x9659('0x18')],{'raw':_0x434249[_0x9659('0x19')]?_0x434249['options'][_0x9659('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x301c36){logger[_0x9659('0xb')](_0x9659('0x16'),_0x434249);logger[_0x9659('0xd')](_0x9659('0x16'),_0x434249,JSON[_0x9659('0xf')](_0x301c36));_0x266721(_0x301c36);})['catch'](function(_0x31a3c9){logger[_0x9659('0x10')]('CreateCmHopperHistory',_0x31a3c9[_0x9659('0x12')],_0x434249);_0x1e4f0e(_0x1a2c0d[_0x9659('0x10')](0x1f4,_0x31a3c9[_0x9659('0x12')]));});});};exports['AvgHandleTime']=function(_0x34cff7){var _0x1053a0=this;return new Promise(function(_0x1186ab,_0x46f3c6){return db[_0x9659('0x1b')]['findAll']({'raw':_0x34cff7[_0x9659('0x19')]?_0x34cff7[_0x9659('0x19')][_0x9659('0x1a')]===undefined?!![]:![]:!![],'where':_0x34cff7[_0x9659('0x19')]?_0x34cff7['options'][_0x9659('0x1c')]||null:null,'attributes':[[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['col']('id')),_0x9659('0x1f')],[db['sequelize']['fn'](_0x9659('0x1e'),db['sequelize']['fn']('IF',db[_0x9659('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9659('0x20')],[db[_0x9659('0x1d')]['fn']('COUNT',db[_0x9659('0x1d')]['fn']('IF',db['sequelize'][_0x9659('0x21')](_0x9659('0x22')))),_0x9659('0x23')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')]['literal'](_0x9659('0x24')))),_0x9659('0x25')],[db[_0x9659('0x1d')]['fn']('AVG',db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')]['literal'](_0x9659('0x26')))),_0x9659('0x27')],[db['sequelize']['fn'](_0x9659('0x28'),db[_0x9659('0x1d')]['fn']('IF',db['sequelize'][_0x9659('0x21')](_0x9659('0x29')))),_0x9659('0x2a')]]})[_0x9659('0x2b')](function(_0x1e59ec){logger[_0x9659('0xb')](_0x9659('0x2c'),_0x34cff7);logger[_0x9659('0xd')](_0x9659('0x2c'),_0x34cff7,JSON[_0x9659('0xf')](_0x1e59ec));_0x1186ab(_0x1e59ec);})[_0x9659('0x15')](function(_0x3832a8){logger[_0x9659('0x10')](_0x9659('0x2c'),_0x3832a8[_0x9659('0x12')],_0x34cff7);_0x46f3c6(_0x1053a0['error'](0x1f4,_0x3832a8[_0x9659('0x12')]));});});};exports[_0x9659('0x2d')]=function(_0x58f0c2){var _0x6dcbc9=this;return new Promise(function(_0x27b588,_0x10c771){return db[_0x9659('0x1b')][_0x9659('0x2e')]({'raw':_0x58f0c2[_0x9659('0x19')]?_0x58f0c2[_0x9659('0x19')][_0x9659('0x1a')]===undefined?!![]:![]:!![],'where':_0x58f0c2[_0x9659('0x19')]?_0x58f0c2[_0x9659('0x19')]['where']||null:null,'attributes':[[_0x9659('0x2f'),_0x9659('0x30')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x31')))),_0x9659('0x32')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')]['literal'](_0x9659('0x33')))),_0x9659('0x34')],[db[_0x9659('0x1d')]['fn']('COUNT',db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x35')))),_0x9659('0x36')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db['sequelize'][_0x9659('0x21')](_0x9659('0x37')))),_0x9659('0x38')],[db['sequelize']['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x39')))),_0x9659('0x3a')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db['sequelize'][_0x9659('0x21')](_0x9659('0x3b')))),_0x9659('0x3c')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9659('0x3d')],[db[_0x9659('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x9659('0x3e')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db['sequelize'][_0x9659('0x21')](_0x9659('0x3f')))),_0x9659('0x40')],[db['sequelize']['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x41')))),_0x9659('0x42')],[db[_0x9659('0x1d')]['fn']('COUNT',db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x43')))),_0x9659('0x44')],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')]['literal'](_0x9659('0x45')))),_0x9659('0x42')],[db['sequelize']['fn'](_0x9659('0x1e'),db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')](_0x9659('0x46')))),_0x9659('0x47')]],'group':[_0x9659('0x2f')]})[_0x9659('0x2b')](function(_0x2d8803){logger['info'](_0x9659('0x2d'),_0x58f0c2);logger[_0x9659('0xd')](_0x9659('0x2d'),_0x58f0c2,JSON[_0x9659('0xf')](_0x2d8803));_0x27b588(_0x2d8803);})[_0x9659('0x15')](function(_0x210edb){logger['error'](_0x9659('0x2d'),_0x210edb[_0x9659('0x12')],_0x58f0c2);_0x10c771(_0x6dcbc9[_0x9659('0x10')](0x1f4,_0x210edb[_0x9659('0x12')]));});});};exports[_0x9659('0x48')]=function(_0xc4c3a8){var _0x185d74=this;return new Promise(function(_0x5acff,_0x2b32a2){return db[_0x9659('0x1b')][_0x9659('0x2e')]({'raw':_0xc4c3a8[_0x9659('0x19')]?_0xc4c3a8['options'][_0x9659('0x1a')]===undefined?!![]:![]:!![],'where':_0xc4c3a8[_0x9659('0x19')]?_0xc4c3a8[_0x9659('0x19')][_0x9659('0x1c')]||null:null,'attributes':[[_0x9659('0x2f'),'name'],[db[_0x9659('0x1d')]['fn'](_0x9659('0x1e'),db['sequelize'][_0x9659('0x49')]('id')),_0x9659('0x4a')],[db[_0x9659('0x1d')]['fn']('COUNT',db[_0x9659('0x1d')]['fn']('IF',db[_0x9659('0x1d')][_0x9659('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x9659('0x4b')]],'group':['campaign']})[_0x9659('0x2b')](function(_0x15663c){logger[_0x9659('0xb')](_0x9659('0x48'),_0xc4c3a8);logger['debug'](_0x9659('0x48'),_0xc4c3a8,JSON[_0x9659('0xf')](_0x15663c));_0x5acff(_0x15663c);})[_0x9659('0x15')](function(_0x5a08af){logger['error']('GetCampaignHopperHistory',_0x5a08af['message'],_0xc4c3a8);_0x2b32a2(_0x185d74['error'](0x1f4,_0x5a08af['message']));});});}; \ No newline at end of file +var _0xb9f0=['../../config/logger','jayson/promise','client','request','info','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','body','options','raw','then','debug','AvgHandleTime','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','../../config/utils'];(function(_0x445d3d,_0x22d4f5){var _0x4f35e2=function(_0x4dd8ca){while(--_0x4dd8ca){_0x445d3d['push'](_0x445d3d['shift']());}};_0x4f35e2(++_0x22d4f5);}(_0xb9f0,0xc8));var _0x0b9f=function(_0x3937e7,_0x91712b){_0x3937e7=_0x3937e7-0x0;var _0x197ad7=_0xb9f0[_0x3937e7];return _0x197ad7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b9f('0x0'));var BPromise=require(_0x0b9f('0x1'));var rs=require(_0x0b9f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b9f('0x3'));var logger=require(_0x0b9f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b9f('0x5'));var client=jayson[_0x0b9f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee3dd,_0x4b0d80,_0x1af962){return new BPromise(function(_0x14ed7d,_0x4041fa){return client[_0x0b9f('0x7')](_0x1ee3dd,_0x1af962)['then'](function(_0x392d48){logger[_0x0b9f('0x8')]('CmHopperHistory,\x20%s,\x20%s',_0x4b0d80,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b0d80,_0x0b9f('0x9'),JSON[_0x0b9f('0xa')](_0x392d48));if(_0x392d48['error']){if(_0x392d48[_0x0b9f('0xb')][_0x0b9f('0xc')]===0x1f4){logger[_0x0b9f('0xb')](_0x0b9f('0xd'),_0x4b0d80,_0x392d48['error'][_0x0b9f('0xe')]);return _0x4041fa(_0x392d48['error'][_0x0b9f('0xe')]);}logger[_0x0b9f('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4b0d80,_0x392d48[_0x0b9f('0xb')][_0x0b9f('0xe')]);return _0x14ed7d(_0x392d48['error'][_0x0b9f('0xe')]);}else{logger[_0x0b9f('0x8')](_0x0b9f('0xd'),_0x4b0d80,_0x0b9f('0x9'));_0x14ed7d(_0x392d48[_0x0b9f('0xf')][_0x0b9f('0xe')]);}})[_0x0b9f('0x10')](function(_0x1bbdae){logger[_0x0b9f('0xb')](_0x0b9f('0xd'),_0x4b0d80,_0x1bbdae);_0x4041fa(_0x1bbdae);});});}exports[_0x0b9f('0x11')]=function(_0x23d243){var _0x3c4a92=this;return new Promise(function(_0x1f17d0,_0xd78226){return db['CmHopperHistory']['create'](_0x23d243[_0x0b9f('0x12')],{'raw':_0x23d243[_0x0b9f('0x13')]?_0x23d243[_0x0b9f('0x13')][_0x0b9f('0x14')]===undefined?!![]:![]:!![]})[_0x0b9f('0x15')](function(_0x1179e8){logger[_0x0b9f('0x8')]('CreateCmHopperHistory',_0x23d243);logger[_0x0b9f('0x16')](_0x0b9f('0x11'),_0x23d243,JSON[_0x0b9f('0xa')](_0x1179e8));_0x1f17d0(_0x1179e8);})[_0x0b9f('0x10')](function(_0x2bdc15){logger['error'](_0x0b9f('0x11'),_0x2bdc15[_0x0b9f('0xe')],_0x23d243);_0xd78226(_0x3c4a92[_0x0b9f('0xb')](0x1f4,_0x2bdc15[_0x0b9f('0xe')]));});});};exports[_0x0b9f('0x17')]=function(_0x15bc97){var _0x27c1f4=this;return new Promise(function(_0x255392,_0x4cca96){return db['CmHopperHistory']['findAll']({'raw':_0x15bc97[_0x0b9f('0x13')]?_0x15bc97['options'][_0x0b9f('0x14')]===undefined?!![]:![]:!![],'where':_0x15bc97['options']?_0x15bc97[_0x0b9f('0x13')][_0x0b9f('0x18')]||null:null,'attributes':[[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')][_0x0b9f('0x1b')]('id')),'predictiveIntervalTotalCalls'],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize'][_0x0b9f('0x1c')]('`state`\x20=\x204,\x201,\x20null'))),_0x0b9f('0x1d')],[db['sequelize']['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x1e')))),_0x0b9f('0x1f')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0x0b9f('0x1c')](_0x0b9f('0x20')))),_0x0b9f('0x21')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x22'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x0b9f('0x23')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x22'),db['sequelize']['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x24')))),_0x0b9f('0x25')]]})[_0x0b9f('0x15')](function(_0x3bba02){logger[_0x0b9f('0x8')](_0x0b9f('0x17'),_0x15bc97);logger[_0x0b9f('0x16')]('AvgHandleTime',_0x15bc97,JSON[_0x0b9f('0xa')](_0x3bba02));_0x255392(_0x3bba02);})[_0x0b9f('0x10')](function(_0x214f94){logger[_0x0b9f('0xb')](_0x0b9f('0x17'),_0x214f94[_0x0b9f('0xe')],_0x15bc97);_0x4cca96(_0x27c1f4[_0x0b9f('0xb')](0x1f4,_0x214f94['message']));});});};exports[_0x0b9f('0x26')]=function(_0x2b9f1b){var _0x1bf32a=this;return new Promise(function(_0x53966e,_0x1e876f){return db[_0x0b9f('0x27')][_0x0b9f('0x28')]({'raw':_0x2b9f1b[_0x0b9f('0x13')]?_0x2b9f1b[_0x0b9f('0x13')][_0x0b9f('0x14')]===undefined?!![]:![]:!![],'where':_0x2b9f1b['options']?_0x2b9f1b['options'][_0x0b9f('0x18')]||null:null,'attributes':[[_0x0b9f('0x29'),_0x0b9f('0x2a')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x2b')))),_0x0b9f('0x2c')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize']['literal'](_0x0b9f('0x2d')))),_0x0b9f('0x2e')],[db['sequelize']['fn'](_0x0b9f('0x1a'),db['sequelize']['fn']('IF',db[_0x0b9f('0x19')]['literal'](_0x0b9f('0x2f')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize'][_0x0b9f('0x1c')](_0x0b9f('0x30')))),_0x0b9f('0x31')],[db['sequelize']['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x32')))),_0x0b9f('0x33')],[db['sequelize']['fn']('COUNT',db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x34')))),_0x0b9f('0x35')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x36')))),_0x0b9f('0x37')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize'][_0x0b9f('0x1c')](_0x0b9f('0x38')))),'outboundBlacklistCallsDay'],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize'][_0x0b9f('0x1c')](_0x0b9f('0x39')))),_0x0b9f('0x3a')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')]['literal'](_0x0b9f('0x3b')))),_0x0b9f('0x3c')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db['sequelize']['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x3d')))),_0x0b9f('0x3e')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db['sequelize'][_0x0b9f('0x1c')](_0x0b9f('0x3f')))),_0x0b9f('0x3c')],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')]['literal'](_0x0b9f('0x40')))),'outboundReCallsDay']],'group':[_0x0b9f('0x29')]})[_0x0b9f('0x15')](function(_0xc3fbc6){logger[_0x0b9f('0x8')](_0x0b9f('0x26'),_0x2b9f1b);logger[_0x0b9f('0x16')](_0x0b9f('0x26'),_0x2b9f1b,JSON[_0x0b9f('0xa')](_0xc3fbc6));_0x53966e(_0xc3fbc6);})[_0x0b9f('0x10')](function(_0xdfbd2e){logger[_0x0b9f('0xb')](_0x0b9f('0x26'),_0xdfbd2e[_0x0b9f('0xe')],_0x2b9f1b);_0x1e876f(_0x1bf32a[_0x0b9f('0xb')](0x1f4,_0xdfbd2e[_0x0b9f('0xe')]));});});};exports['GetCampaignHopperHistory']=function(_0x13a256){var _0x25123f=this;return new Promise(function(_0x269614,_0x12e665){return db[_0x0b9f('0x27')]['findAll']({'raw':_0x13a256[_0x0b9f('0x13')]?_0x13a256[_0x0b9f('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x13a256[_0x0b9f('0x13')]?_0x13a256[_0x0b9f('0x13')]['where']||null:null,'attributes':[[_0x0b9f('0x29'),'name'],[db[_0x0b9f('0x19')]['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')][_0x0b9f('0x1b')]('id')),_0x0b9f('0x41')],[db['sequelize']['fn'](_0x0b9f('0x1a'),db[_0x0b9f('0x19')]['fn']('IF',db[_0x0b9f('0x19')][_0x0b9f('0x1c')](_0x0b9f('0x2f')))),_0x0b9f('0x42')]],'group':['campaign']})[_0x0b9f('0x15')](function(_0x163ab3){logger[_0x0b9f('0x8')](_0x0b9f('0x43'),_0x13a256);logger[_0x0b9f('0x16')](_0x0b9f('0x43'),_0x13a256,JSON[_0x0b9f('0xa')](_0x163ab3));_0x269614(_0x163ab3);})[_0x0b9f('0x10')](function(_0x52f448){logger[_0x0b9f('0xb')](_0x0b9f('0x43'),_0x52f448[_0x0b9f('0xe')],_0x13a256);_0x12e665(_0x25123f['error'](0x1f4,_0x52f448[_0x0b9f('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b277d97..410ddf6 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 _0x2499=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','/:id','update'];(function(_0x462529,_0x17e492){var _0x13806d=function(_0x88b33d){while(--_0x88b33d){_0x462529['push'](_0x462529['shift']());}};_0x13806d(++_0x17e492);}(_0x2499,0x144));var _0x9249=function(_0x979420,_0x2c7ff7){_0x979420=_0x979420-0x0;var _0x89f720=_0x2499[_0x979420];return _0x89f720;};'use strict';var multer=require(_0x9249('0x0'));var util=require(_0x9249('0x1'));var path=require(_0x9249('0x2'));var timeout=require(_0x9249('0x3'));var express=require(_0x9249('0x4'));var router=express[_0x9249('0x5')]();var fs_extra=require(_0x9249('0x6'));var auth=require(_0x9249('0x7'));var interaction=require(_0x9249('0x8'));var config=require('../../config/environment');var controller=require(_0x9249('0x9'));router[_0x9249('0xa')]('/',auth[_0x9249('0xb')](),controller[_0x9249('0xc')]);router[_0x9249('0xa')](_0x9249('0xd'),auth[_0x9249('0xb')](),controller[_0x9249('0xe')]);router['get']('/:id',auth[_0x9249('0xb')](),controller['show']);router[_0x9249('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9249('0x10'),auth['isAuthenticated'](),controller[_0x9249('0x11')]);module['exports']=router; \ No newline at end of file +var _0x86a9=['show','post','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x51ba93,_0x330824){var _0x17d275=function(_0x597e04){while(--_0x597e04){_0x51ba93['push'](_0x51ba93['shift']());}};_0x17d275(++_0x330824);}(_0x86a9,0x1e2));var _0x986a=function(_0x12e927,_0x48ff77){_0x12e927=_0x12e927-0x0;var _0x18cc77=_0x86a9[_0x12e927];return _0x18cc77;};'use strict';var multer=require(_0x986a('0x0'));var util=require('util');var path=require(_0x986a('0x1'));var timeout=require(_0x986a('0x2'));var express=require(_0x986a('0x3'));var router=express['Router']();var fs_extra=require(_0x986a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x986a('0x5'));var config=require(_0x986a('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x986a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x986a('0x7')]('/describe',auth[_0x986a('0x8')](),controller[_0x986a('0x9')]);router[_0x986a('0x7')](_0x986a('0xa'),auth['isAuthenticated'](),controller[_0x986a('0xb')]);router[_0x986a('0xc')]('/',auth[_0x986a('0x8')](),controller[_0x986a('0xd')]);router[_0x986a('0xe')]('/:id',auth[_0x986a('0x8')](),controller[_0x986a('0xf')]);module[_0x986a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3fcbaef..2a487b5 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 _0x8664=['STRING','name','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8664,0x11a));var _0x4866=function(_0x524b10,_0x246d19){_0x524b10=_0x524b10-0x0;var _0x5ef75a=_0x8664[_0x524b10];return _0x5ef75a;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'name':{'type':Sequelize[_0x4866('0x2')],'unique':_0x4866('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4866('0x2')]},'dialPrefix':{'type':Sequelize[_0x4866('0x2')]}}; \ No newline at end of file +var _0xd493=['name','sequelize','STRING'];(function(_0x2fb54c,_0x4e113f){var _0x6f4acd=function(_0x54ed8b){while(--_0x54ed8b){_0x2fb54c['push'](_0x2fb54c['shift']());}};_0x6f4acd(++_0x4e113f);}(_0xd493,0x1bd));var _0x3d49=function(_0x32368b,_0x4c2278){_0x32368b=_0x32368b-0x0;var _0x24c34f=_0xd493[_0x32368b];return _0x24c34f;};'use strict';var Sequelize=require(_0x3d49('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d49('0x1')],'unique':_0x3d49('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3d49('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b3d10bb..d4b1384 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 _0xf3f3=['queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','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','./cmList.socket','register','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','params','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','omit','success','message','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','defaultValue'];(function(_0x22ae60,_0x383dbf){var _0x5bba4d=function(_0x35788b){while(--_0x35788b){_0x22ae60['push'](_0x22ae60['shift']());}};_0x5bba4d(++_0x383dbf);}(_0xf3f3,0xae));var _0x3f3f=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xf3f3[_0x4bd06e];return _0x85ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f3f('0x0'));var zipdir=require(_0x3f3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f3f('0x2'));var moment=require('moment');var BPromise=require(_0x3f3f('0x3'));var Mustache=require(_0x3f3f('0x4'));var util=require('util');var path=require(_0x3f3f('0x5'));var sox=require('sox');var csv=require(_0x3f3f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f3f('0x7'));var _=require(_0x3f3f('0x8'));var squel=require(_0x3f3f('0x9'));var crypto=require('crypto');var jsforce=require(_0x3f3f('0xa'));var deskjs=require(_0x3f3f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3f3f('0xc'));var Papa=require(_0x3f3f('0xd'));var Redis=require(_0x3f3f('0xe'));var authService=require(_0x3f3f('0xf'));var qs=require(_0x3f3f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f3f('0x11'))(_0x3f3f('0x12'));var utils=require(_0x3f3f('0x13'));var config=require(_0x3f3f('0x14'));var licenseUtil=require(_0x3f3f('0x15'));var db=require(_0x3f3f('0x16'))['db'];var csv_results;config[_0x3f3f('0x17')]=_[_0x3f3f('0x18')](config['redis'],{'host':_0x3f3f('0x19'),'port':0x18eb});var socket=require(_0x3f3f('0x1a'))(new Redis(config['redis']));require(_0x3f3f('0x1b'))[_0x3f3f('0x1c')](socket);function respondWithStatusCode(_0x1bb94f,_0x492b37){_0x492b37=_0x492b37||0xcc;return function(_0xcb898c){if(_0xcb898c){return _0x1bb94f['sendStatus'](_0x492b37);}return _0x1bb94f['status'](_0x492b37)['end']();};}function respondWithResult(_0x3721d7,_0x350e7e){_0x350e7e=_0x350e7e||0xc8;return function(_0x4f2d1b){if(_0x4f2d1b){return _0x3721d7[_0x3f3f('0x1d')](_0x350e7e)[_0x3f3f('0x1e')](_0x4f2d1b);}};}function respondWithFilteredResult(_0x2b0264,_0x4fb977){return function(_0x44cf72){if(_0x44cf72){var _0x404508=typeof _0x4fb977[_0x3f3f('0x1f')]==='undefined'&&typeof _0x4fb977[_0x3f3f('0x20')]==='undefined';var _0x2af268=_0x44cf72[_0x3f3f('0x21')];var _0x1b698e=_0x404508?0x0:_0x4fb977['offset'];var _0x8749a0=_0x404508?_0x44cf72[_0x3f3f('0x21')]:_0x4fb977['offset']+_0x4fb977[_0x3f3f('0x20')];var _0x5e2fb2;if(_0x8749a0>=_0x2af268){_0x8749a0=_0x2af268;_0x5e2fb2=0xc8;}else{_0x5e2fb2=0xce;}_0x2b0264[_0x3f3f('0x1d')](_0x5e2fb2);return _0x2b0264[_0x3f3f('0x22')](_0x3f3f('0x23'),_0x1b698e+'-'+_0x8749a0+'/'+_0x2af268)['json'](_0x44cf72);}return null;};}function patchUpdates(_0x1070ec){return function(_0x33b7ca){try{jsonpatch['apply'](_0x33b7ca,_0x1070ec,!![]);}catch(_0x51221e){return BPromise[_0x3f3f('0x24')](_0x51221e);}return _0x33b7ca[_0x3f3f('0x25')]();};}function saveUpdates(_0x2e6006,_0x4d18f7){return function(_0xe9f52f){if(_0xe9f52f){return _0xe9f52f[_0x3f3f('0x26')](_0x2e6006)[_0x3f3f('0x27')](function(_0x1f06b7){return _0x1f06b7;});}return null;};}function removeEntity(_0x3caf4f,_0x4c35f3){return function(_0x34cd96){if(_0x34cd96){return _0x34cd96[_0x3f3f('0x28')]()[_0x3f3f('0x27')](function(){var _0xeee8c1=_0x34cd96[_0x3f3f('0x29')]({'plain':!![]});var _0x229981='Lists';return db[_0x3f3f('0x2a')]['destroy']({'where':{'type':_0x229981,'resourceId':_0xeee8c1['id']}})[_0x3f3f('0x27')](function(){return _0x34cd96;});})['then'](function(){_0x3caf4f[_0x3f3f('0x1d')](0xcc)[_0x3f3f('0x2b')]();});}};}function handleEntityNotFound(_0x26b23b,_0x1c0ca2){return function(_0x4299ab){if(!_0x4299ab){_0x26b23b['sendStatus'](0x194);}return _0x4299ab;};}function handleError(_0x3485b1,_0x1bf18b){_0x1bf18b=_0x1bf18b||0x1f4;return function(_0x1b004e){logger[_0x3f3f('0x2c')](_0x1b004e['stack']);if(_0x1b004e[_0x3f3f('0x2d')]){delete _0x1b004e[_0x3f3f('0x2d')];}_0x3485b1[_0x3f3f('0x1d')](_0x1bf18b)['send'](_0x1b004e);};}exports[_0x3f3f('0x2e')]=function(_0x71a485,_0x46e23e){var _0x41d034={},_0x31a7b7={},_0x3a425f={'count':0x0,'rows':[]};var _0x52fc3c=_[_0x3f3f('0x2f')](db[_0x3f3f('0x30')]['rawAttributes'],function(_0x35eb8d){return{'name':_0x35eb8d[_0x3f3f('0x31')],'type':_0x35eb8d[_0x3f3f('0x32')][_0x3f3f('0x33')]};});_0x31a7b7[_0x3f3f('0x34')]=_['map'](_0x52fc3c,_0x3f3f('0x2d'));_0x31a7b7[_0x3f3f('0x35')]=_[_0x3f3f('0x36')](_0x71a485[_0x3f3f('0x35')]);_0x31a7b7[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x31a7b7[_0x3f3f('0x34')],_0x31a7b7[_0x3f3f('0x35')]);_0x41d034[_0x3f3f('0x39')]=_[_0x3f3f('0x38')](_0x31a7b7[_0x3f3f('0x34')],qs['fields'](_0x71a485[_0x3f3f('0x35')]['fields']));_0x41d034[_0x3f3f('0x39')]=_0x41d034[_0x3f3f('0x39')][_0x3f3f('0x3a')]?_0x41d034[_0x3f3f('0x39')]:_0x31a7b7[_0x3f3f('0x34')];if(!_0x71a485['query'][_0x3f3f('0x3b')](_0x3f3f('0x3c'))){_0x41d034['limit']=qs['limit'](_0x71a485[_0x3f3f('0x35')]['limit']);_0x41d034[_0x3f3f('0x1f')]=qs[_0x3f3f('0x1f')](_0x71a485[_0x3f3f('0x35')][_0x3f3f('0x1f')]);}_0x41d034[_0x3f3f('0x3d')]=qs[_0x3f3f('0x3e')](_0x71a485['query'][_0x3f3f('0x3e')]);_0x41d034['where']=qs[_0x3f3f('0x37')](_[_0x3f3f('0x3f')](_0x71a485['query'],_0x31a7b7[_0x3f3f('0x37')]),_0x52fc3c);if(_0x71a485[_0x3f3f('0x35')][_0x3f3f('0x40')]){_0x41d034[_0x3f3f('0x41')]=_['merge'](_0x41d034['where'],{'$or':_[_0x3f3f('0x2f')](_0x52fc3c,function(_0x1e9e65){if(_0x1e9e65[_0x3f3f('0x32')]!=='VIRTUAL'){var _0x14a873={};_0x14a873[_0x1e9e65[_0x3f3f('0x2d')]]={'$like':'%'+_0x71a485['query']['filter']+'%'};return _0x14a873;}})});}_0x41d034=_[_0x3f3f('0x42')]({},_0x41d034,_0x71a485[_0x3f3f('0x43')]);var _0x95d6={'where':_0x41d034[_0x3f3f('0x41')]};return db[_0x3f3f('0x30')]['count'](_0x95d6)[_0x3f3f('0x27')](function(_0x1662d6){_0x3a425f[_0x3f3f('0x21')]=_0x1662d6;if(_0x71a485[_0x3f3f('0x35')][_0x3f3f('0x44')]){_0x41d034[_0x3f3f('0x45')]=[{'all':!![]}];}return db[_0x3f3f('0x30')]['findAll'](_0x41d034);})[_0x3f3f('0x27')](function(_0x438b66){_0x3a425f[_0x3f3f('0x46')]=_0x438b66;return _0x3a425f;})[_0x3f3f('0x27')](respondWithFilteredResult(_0x46e23e,_0x41d034))['catch'](handleError(_0x46e23e,null));};exports[_0x3f3f('0x47')]=function(_0x2a965a,_0x2c8d2c){var _0x358a28={'raw':![],'where':{'id':_0x2a965a[_0x3f3f('0x48')]['id']}},_0x4598a0={};_0x4598a0[_0x3f3f('0x34')]=_[_0x3f3f('0x36')](db['CmList'][_0x3f3f('0x49')]);_0x4598a0[_0x3f3f('0x35')]=_[_0x3f3f('0x36')](_0x2a965a[_0x3f3f('0x35')]);_0x4598a0[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x4598a0['model'],_0x4598a0[_0x3f3f('0x35')]);_0x358a28[_0x3f3f('0x39')]=_['intersection'](_0x4598a0[_0x3f3f('0x34')],qs[_0x3f3f('0x4a')](_0x2a965a[_0x3f3f('0x35')][_0x3f3f('0x4a')]));_0x358a28[_0x3f3f('0x39')]=_0x358a28[_0x3f3f('0x39')]['length']?_0x358a28[_0x3f3f('0x39')]:_0x4598a0[_0x3f3f('0x34')];if(_0x2a965a[_0x3f3f('0x35')]['includeAll']){_0x358a28['include']=[{'all':!![]}];}_0x358a28=_['merge']({},_0x358a28,_0x2a965a[_0x3f3f('0x43')]);return db[_0x3f3f('0x30')][_0x3f3f('0x4b')](_0x358a28)['then'](handleEntityNotFound(_0x2c8d2c,null))[_0x3f3f('0x27')](respondWithResult(_0x2c8d2c,null))[_0x3f3f('0x4c')](handleError(_0x2c8d2c,null));};exports[_0x3f3f('0x4d')]=function(_0x1e0ea3,_0x2b2948){return db[_0x3f3f('0x30')][_0x3f3f('0x4d')](_0x1e0ea3[_0x3f3f('0x4e')],{})[_0x3f3f('0x27')](function(_0x2a24b8){var _0x2af1d7=_0x1e0ea3[_0x3f3f('0x4f')]['get']({'plain':!![]});if(!_0x2af1d7)throw new Error(_0x3f3f('0x50'));if(_0x2af1d7[_0x3f3f('0x51')]===_0x3f3f('0x4f')){var _0x42bfe4=_0x2a24b8[_0x3f3f('0x29')]({'plain':!![]});var _0x455e02=_0x3f3f('0x52');return db[_0x3f3f('0x53')]['find']({'where':{'name':_0x455e02,'userProfileId':_0x2af1d7['userProfileId']},'raw':!![]})[_0x3f3f('0x27')](function(_0x24ed7b){if(_0x24ed7b&&_0x24ed7b[_0x3f3f('0x54')]===0x0){return db[_0x3f3f('0x2a')][_0x3f3f('0x4d')]({'name':_0x42bfe4[_0x3f3f('0x2d')],'resourceId':_0x42bfe4['id'],'type':_0x24ed7b['name'],'sectionId':_0x24ed7b['id']},{})[_0x3f3f('0x27')](function(){return _0x2a24b8;});}else{return _0x2a24b8;}})['catch'](function(_0x1942b7){logger[_0x3f3f('0x2c')](_0x3f3f('0x55'),_0x1942b7);throw _0x1942b7;});}return _0x2a24b8;})['then'](respondWithResult(_0x2b2948,0xc9))['catch'](handleError(_0x2b2948,null));};exports[_0x3f3f('0x26')]=function(_0x495829,_0x4fdb26){if(_0x495829['body']['id']){delete _0x495829[_0x3f3f('0x4e')]['id'];}return db[_0x3f3f('0x30')][_0x3f3f('0x4b')]({'where':{'id':_0x495829['params']['id']}})['then'](handleEntityNotFound(_0x4fdb26,null))[_0x3f3f('0x27')](saveUpdates(_0x495829[_0x3f3f('0x4e')],null))[_0x3f3f('0x27')](respondWithResult(_0x4fdb26,null))[_0x3f3f('0x4c')](handleError(_0x4fdb26,null));};exports[_0x3f3f('0x28')]=function(_0x263c69,_0x14c9b2){return db['CmList'][_0x3f3f('0x4b')]({'where':{'id':_0x263c69[_0x3f3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x14c9b2,null))[_0x3f3f('0x27')](removeEntity(_0x14c9b2,null))[_0x3f3f('0x4c')](handleError(_0x14c9b2,null));};exports[_0x3f3f('0x56')]=function(_0x485ebd,_0x251e41){return db['CmList'][_0x3f3f('0x56')]()[_0x3f3f('0x27')](respondWithResult(_0x251e41,null))[_0x3f3f('0x4c')](handleError(_0x251e41,null));};exports['addDisposition']=function(_0x388479,_0x565d3e,_0x22e419){if(_0x388479[_0x3f3f('0x4e')]['id']){delete _0x388479[_0x3f3f('0x4e')]['id'];}return db['CmList']['find']({'where':{'id':_0x388479[_0x3f3f('0x48')]['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x565d3e,null))[_0x3f3f('0x27')](function(_0x44ab06){if(_0x44ab06){_0x388479[_0x3f3f('0x4e')][_0x3f3f('0x57')]=_0x44ab06['id'];return db[_0x3f3f('0x58')][_0x3f3f('0x4d')](_0x388479[_0x3f3f('0x4e')]);}})[_0x3f3f('0x27')](respondWithResult(_0x565d3e,null))[_0x3f3f('0x4c')](handleError(_0x565d3e,null));};exports[_0x3f3f('0x59')]=function(_0x54ec7c,_0x1c4bb2,_0x136277){var _0x4bab13={'raw':![],'where':{}};var _0x208d6d={};var _0x552dbf={'count':0x0,'rows':[]};return db[_0x3f3f('0x30')][_0x3f3f('0x5a')]({'where':{'id':_0x54ec7c[_0x3f3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c4bb2,null))[_0x3f3f('0x27')](function(_0x469821){if(_0x469821){_0x208d6d[_0x3f3f('0x34')]=_['keys'](db[_0x3f3f('0x58')][_0x3f3f('0x49')]);_0x208d6d[_0x3f3f('0x35')]=_['keys'](_0x54ec7c[_0x3f3f('0x35')]);_0x208d6d[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x208d6d[_0x3f3f('0x34')],_0x208d6d[_0x3f3f('0x35')]);_0x4bab13[_0x3f3f('0x39')]=_['intersection'](_0x208d6d['model'],qs['fields'](_0x54ec7c[_0x3f3f('0x35')][_0x3f3f('0x4a')]));_0x4bab13[_0x3f3f('0x39')]=_0x4bab13[_0x3f3f('0x39')][_0x3f3f('0x3a')]?_0x4bab13[_0x3f3f('0x39')]:_0x208d6d[_0x3f3f('0x34')];if(!_0x54ec7c['query']['hasOwnProperty'](_0x3f3f('0x3c'))){_0x4bab13[_0x3f3f('0x20')]=qs[_0x3f3f('0x20')](_0x54ec7c[_0x3f3f('0x35')][_0x3f3f('0x20')]);_0x4bab13[_0x3f3f('0x1f')]=qs[_0x3f3f('0x1f')](_0x54ec7c[_0x3f3f('0x35')][_0x3f3f('0x1f')]);}_0x4bab13[_0x3f3f('0x3d')]=qs[_0x3f3f('0x3e')](_0x54ec7c[_0x3f3f('0x35')][_0x3f3f('0x3e')]);_0x4bab13[_0x3f3f('0x41')]=qs[_0x3f3f('0x37')](_[_0x3f3f('0x3f')](_0x54ec7c['query'],_0x208d6d[_0x3f3f('0x37')]));_0x4bab13[_0x3f3f('0x41')][_0x3f3f('0x57')]=_0x469821['id'];if(_0x54ec7c[_0x3f3f('0x35')][_0x3f3f('0x40')]){_0x4bab13[_0x3f3f('0x41')]=_['merge'](_0x4bab13['where'],{'$or':_[_0x3f3f('0x2f')](_0x4bab13[_0x3f3f('0x39')],function(_0xdf4a5b){var _0x47be43={};_0x47be43[_0xdf4a5b]={'$like':'%'+_0x54ec7c['query'][_0x3f3f('0x40')]+'%'};return _0x47be43;})});}_0x4bab13=_[_0x3f3f('0x42')]({},_0x4bab13,_0x54ec7c['options']);return db['Disposition']['count']({'where':_0x4bab13[_0x3f3f('0x41')]})[_0x3f3f('0x27')](function(_0x57c452){_0x552dbf[_0x3f3f('0x21')]=_0x57c452;if(_0x54ec7c[_0x3f3f('0x35')]['includeAll']){_0x4bab13[_0x3f3f('0x45')]=[{'all':!![]}];}return db[_0x3f3f('0x58')][_0x3f3f('0x5b')](_0x4bab13);})[_0x3f3f('0x27')](function(_0x1bbe9b){_0x552dbf['rows']=_0x1bbe9b;return _0x552dbf;});}})[_0x3f3f('0x27')](respondWithFilteredResult(_0x1c4bb2,_0x4bab13))[_0x3f3f('0x4c')](handleError(_0x1c4bb2,null));};exports[_0x3f3f('0x5c')]=function(_0x41e6a3,_0x21ed40,_0x662dbc){return db[_0x3f3f('0x30')][_0x3f3f('0x4b')]({'where':{'id':_0x41e6a3['params']['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x21ed40,null))[_0x3f3f('0x27')](function(_0x12a210){if(_0x12a210){return _0x12a210['removeDispositions'](_0x41e6a3[_0x3f3f('0x35')][_0x3f3f('0x5d')]);}})[_0x3f3f('0x27')](respondWithStatusCode(_0x21ed40,null))['catch'](handleError(_0x21ed40,null));};exports[_0x3f3f('0x5e')]=function(_0x5357f4,_0x2376ee,_0x17d1c2){return db[_0x3f3f('0x30')]['find']({'where':{'id':_0x5357f4['params']['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x2376ee,null))[_0x3f3f('0x27')](function(_0x407567){if(_0x407567){var _0x5ddee0=[];var _0x171a2b={'success':[],'errors':[]};return db[_0x3f3f('0x5f')][_0x3f3f('0x56')]()[_0x3f3f('0x27')](function(_0x4e6c7b){if(_0x5357f4[_0x3f3f('0x4e')]['tags']&&_[_0x3f3f('0x60')](_0x5357f4[_0x3f3f('0x4e')][_0x3f3f('0x61')])){if(_0x5357f4['body'][_0x3f3f('0x61')][_0x3f3f('0x3a')]){_0x5357f4[_0x3f3f('0x4e')][_0x3f3f('0x61')]=_0x5357f4['body'][_0x3f3f('0x61')]['join'](';')+';';}else{_0x5357f4['body'][_0x3f3f('0x61')]=null;}}else{_0x5357f4['body'][_0x3f3f('0x61')]=null;}if(_0x5357f4['body']&&_['isArray'](_0x5357f4[_0x3f3f('0x4e')])){for(var _0xc86cd4=0x0;_0xc86cd4<_0x5357f4[_0x3f3f('0x4e')][_0x3f3f('0x3a')];_0xc86cd4+=0x1){_0x5357f4[_0x3f3f('0x4e')][_0xc86cd4]['ListId']=_0x5357f4[_0x3f3f('0x48')]['id'];_0x5ddee0[_0x3f3f('0x62')](_0x5357f4[_0x3f3f('0x4e')][_0xc86cd4]);}return BPromise[_0x3f3f('0x63')](_0x5ddee0,function(_0x2640b5){return db[_0x3f3f('0x5f')][_0x3f3f('0x4d')](_[_0x3f3f('0x64')](_0x2640b5,[_0x3f3f('0x5d'),'id'])||{},{'fields':_[_0x3f3f('0x36')](_0x4e6c7b),'raw':!![]})[_0x3f3f('0x27')](function(_0x34e6ad){_0x171a2b[_0x3f3f('0x65')][_0x3f3f('0x62')](_0x34e6ad['dataValues']);})['catch'](function(_0x564060){_0x171a2b['errors']['push']({'data':_0x2640b5,'error':_0x564060[_0x3f3f('0x66')]});});})[_0x3f3f('0x27')](function(_0x1648e1){return _0x171a2b;})[_0x3f3f('0x4c')](function(_0x54f0df){return _0x54f0df;});}else{_0x2376ee[_0x3f3f('0x1d')](0x190)[_0x3f3f('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x3f3f('0x27')](respondWithResult(_0x2376ee,null))[_0x3f3f('0x4c')](handleError(_0x2376ee,null));};exports['getContacts']=function(_0x118ca0,_0x2a95a3,_0x3e7a9f){var _0x1594f0;return db[_0x3f3f('0x30')][_0x3f3f('0x4b')]({'where':{'id':_0x118ca0[_0x3f3f('0x48')]['id']},'include':[{'model':db[_0x3f3f('0x67')],'as':_0x3f3f('0x68')}]})[_0x3f3f('0x27')](handleEntityNotFound(_0x2a95a3,null))['then'](function(_0x4699af){if(_0x4699af){_0x1594f0=_0x4699af;return db[_0x3f3f('0x5f')][_0x3f3f('0x49')];}})[_0x3f3f('0x27')](function(_0x4600e1){if(_0x4600e1){var _0x1fb0d6={};var _0x34e723={};_0x34e723[_0x3f3f('0x34')]=_[_0x3f3f('0x69')](_[_0x3f3f('0x36')](_0x4600e1),_[_0x3f3f('0x2f')](_0x1594f0[_0x3f3f('0x68')],function(_0x27599c){return util[_0x3f3f('0x6a')](_0x3f3f('0x6b'),_0x27599c['id']);}));_0x34e723[_0x3f3f('0x35')]=_['keys'](_0x118ca0[_0x3f3f('0x35')]);_0x34e723[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x34e723['model'],_0x34e723[_0x3f3f('0x35')]);_0x1fb0d6[_0x3f3f('0x39')]=_[_0x3f3f('0x38')](_0x34e723[_0x3f3f('0x34')],qs[_0x3f3f('0x4a')](_0x118ca0[_0x3f3f('0x35')][_0x3f3f('0x4a')]));_0x1fb0d6[_0x3f3f('0x39')]=_0x1fb0d6[_0x3f3f('0x39')][_0x3f3f('0x3a')]?_0x1fb0d6[_0x3f3f('0x39')]:_0x34e723['model'];if(!_0x118ca0['query'][_0x3f3f('0x3b')](_0x3f3f('0x3c'))){_0x1fb0d6['limit']=qs[_0x3f3f('0x20')](_0x118ca0['query'][_0x3f3f('0x20')]);_0x1fb0d6['offset']=qs[_0x3f3f('0x1f')](_0x118ca0[_0x3f3f('0x35')][_0x3f3f('0x1f')]);}_0x1fb0d6[_0x3f3f('0x3d')]=qs[_0x3f3f('0x3e')](_0x118ca0[_0x3f3f('0x35')]['sort']);_0x1fb0d6[_0x3f3f('0x41')]=qs['filters'](_[_0x3f3f('0x3f')](_0x118ca0[_0x3f3f('0x35')],_0x34e723[_0x3f3f('0x37')]));_0x1fb0d6[_0x3f3f('0x6c')]=!![];if(_0x118ca0[_0x3f3f('0x35')][_0x3f3f('0x40')]){_0x1fb0d6[_0x3f3f('0x41')]=_[_0x3f3f('0x42')](_0x1fb0d6[_0x3f3f('0x41')],{'$or':_[_0x3f3f('0x2f')](_0x1fb0d6[_0x3f3f('0x39')],function(_0x56ce92){var _0x5f1dae={};_0x5f1dae[_0x56ce92]={'$like':'%'+_0x118ca0[_0x3f3f('0x35')]['filter']+'%'};return _0x5f1dae;})});}_0x1fb0d6=_[_0x3f3f('0x42')]({},_0x1fb0d6,_0x118ca0[_0x3f3f('0x43')]);return _0x1594f0[_0x3f3f('0x6d')](_0x1fb0d6);}})['then'](respondWithResult(_0x2a95a3,null))[_0x3f3f('0x4c')](handleError(_0x2a95a3,null));};exports[_0x3f3f('0x6e')]=function(_0x2203fd,_0xe88ff,_0x33b1a0){var _0x534eb3;var _0x1b4cba;var _0x4a1e43;var _0x24118b=_0x2203fd[_0x3f3f('0x48')]['id'];csv_results=[];return db[_0x3f3f('0x6f')][_0x3f3f('0x5b')]({'attributes':['id',_0x3f3f('0x2d')],'raw':!![],'order':[_0x3f3f('0x70')]})['then'](function(_0x4a5e98){_0x534eb3=_0x4a5e98;var _0x3f984f=_[_0x3f3f('0x36')](db['CmContact'][_0x3f3f('0x49')]);return db[_0x3f3f('0x67')][_0x3f3f('0x5b')]({'raw':!![],'attributes':['id',_0x3f3f('0x71')]})[_0x3f3f('0x27')](function(_0x5de01d){_0x1b4cba=_0x5de01d;var _0x1de89c=squel[_0x3f3f('0x72')]()['fields'](_0x3f984f)[_0x3f3f('0x73')]('cm_contacts','c')['where'](_0x3f3f('0x74'),_0x24118b)[_0x3f3f('0x41')](_0x3f3f('0x75'))[_0x3f3f('0x76')]();for(var _0x4f59d2=0x0;_0x4f59d2<_0x1b4cba[_0x3f3f('0x3a')];_0x4f59d2++){_0x1de89c[_0x3f3f('0x77')](_0x3f3f('0x78')+_0x1b4cba[_0x4f59d2]['id'],_0x3f3f('0x79')+_0x1b4cba[_0x4f59d2]['alias']);}for(var _0x4f59d2=0x0;_0x4f59d2<_0x534eb3[_0x3f3f('0x3a')];_0x4f59d2++){_0x1de89c['field'](squel['select']()[_0x3f3f('0x77')](_0x3f3f('0x7a'))[_0x3f3f('0x73')](_0x3f3f('0x7b'))['where'](_0x3f3f('0x7c'),_0x534eb3[_0x4f59d2]['id'])[_0x3f3f('0x41')](_0x3f3f('0x7d')),_0x3f3f('0x7e')+_0x534eb3[_0x4f59d2][_0x3f3f('0x2d')]);_0x1de89c[_0x3f3f('0x77')](squel[_0x3f3f('0x72')]()[_0x3f3f('0x77')]('description')['from'](_0x3f3f('0x7b'))[_0x3f3f('0x41')](_0x3f3f('0x7c'),_0x534eb3[_0x4f59d2]['id'])[_0x3f3f('0x41')](_0x3f3f('0x7d')),_0x3f3f('0x7f')+_0x534eb3[_0x4f59d2]['name']);}var _0x7fb358=[];_0x7fb358[_0x3f3f('0x62')](_0x1de89c['toString']());BPromise[_0x3f3f('0x63')](_0x7fb358,handleQuery)[_0x3f3f('0x27')](function(_0x50c22c){handleQuery(_0x1de89c[_0x3f3f('0x80')]());var _0x3b4ed0=csv_results[0x0];if(!_[_0x3f3f('0x81')](_0x3b4ed0)){var _0x32ec45=toCsv(_0x3b4ed0);var _0xe88570=Date['now']();fs['writeFileSync'](util[_0x3f3f('0x6a')](_0x3f3f('0x82'),_0x24118b,_0xe88570),_0x32ec45);_0xe88ff[_0x3f3f('0x83')](_0x3f3f('0x84'),_0x3f3f('0x85')+util[_0x3f3f('0x6a')](_0x3f3f('0x86'),_0x24118b,_0xe88570));_0xe88ff[_0x3f3f('0x83')](_0x3f3f('0x87'),_0x3f3f('0x88'));return _0xe88ff['download'](util[_0x3f3f('0x6a')](_0x3f3f('0x82'),_0x24118b,_0xe88570));}else{return _0xe88ff[_0x3f3f('0x89')](0xcc);}});});});};exports[_0x3f3f('0x8a')]=function(_0x3af24a,_0x7d3ff8,_0x7a63d0){var _0x4553e5;delete _0x3af24a[_0x3f3f('0x4e')]['id'];return db[_0x3f3f('0x30')][_0x3f3f('0x5a')]({'where':{'id':_0x3af24a[_0x3f3f('0x48')]['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x7d3ff8,null))['then'](function(_0x5dad15){if(_0x5dad15){return db[_0x3f3f('0x8b')][_0x3f3f('0x8c')](function(_0x328588){return db[_0x3f3f('0x67')][_0x3f3f('0x4d')](_0x3af24a[_0x3f3f('0x4e')],{'transaction':_0x328588})[_0x3f3f('0x27')](function(_0x4ea620){_0x4553e5=_0x4ea620;return _0x5dad15[_0x3f3f('0x8d')](_0x4ea620,{'transaction':_0x328588});})[_0x3f3f('0x27')](function(){var _0x6cd5b4={'type':db[_0x3f3f('0x8e')][_0x3f3f('0x8f')],'transaction':_0x328588};switch(_0x3af24a[_0x3f3f('0x4e')][_0x3f3f('0x32')]){case'text':_0x6cd5b4[_0x3f3f('0x32')]=db[_0x3f3f('0x8e')][_0x3f3f('0x8f')];break;case _0x3f3f('0x90'):_0x6cd5b4['type']=db['Sequelize'][_0x3f3f('0x91')];break;case _0x3f3f('0x92'):_0x6cd5b4[_0x3f3f('0x32')]=db[_0x3f3f('0x8e')]['BOOLEAN'];_0x6cd5b4[_0x3f3f('0x93')]=![];break;default:}return db[_0x3f3f('0x8b')][_0x3f3f('0x94')][_0x3f3f('0x95')]('cm_contacts',util[_0x3f3f('0x6a')](_0x3f3f('0x96'),_0x4553e5['id']),_0x6cd5b4);})[_0x3f3f('0x27')](function(){return _0x4553e5;});});}})['then'](respondWithResult(_0x7d3ff8,null))['catch'](handleError(_0x7d3ff8,null));};exports[_0x3f3f('0x97')]=function(_0x45f07a,_0x34b18a,_0x20ad33){var _0xb69720={};var _0x45a7b6={};var _0x82aeb4;var _0x3c9eb1;return db['CmList'][_0x3f3f('0x5a')]({'where':{'id':_0x45f07a[_0x3f3f('0x48')]['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x34b18a,null))[_0x3f3f('0x27')](function(_0x2eca5b){if(_0x2eca5b){_0x82aeb4=_0x2eca5b;_0x45a7b6['model']=_[_0x3f3f('0x36')](db[_0x3f3f('0x67')][_0x3f3f('0x49')]);_0x45a7b6[_0x3f3f('0x35')]=_['keys'](_0x45f07a[_0x3f3f('0x35')]);_0x45a7b6[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x45a7b6[_0x3f3f('0x34')],_0x45a7b6[_0x3f3f('0x35')]);_0xb69720['attributes']=_[_0x3f3f('0x38')](_0x45a7b6[_0x3f3f('0x34')],qs[_0x3f3f('0x4a')](_0x45f07a[_0x3f3f('0x35')][_0x3f3f('0x4a')]));_0xb69720[_0x3f3f('0x39')]=_0xb69720[_0x3f3f('0x39')]['length']?_0xb69720[_0x3f3f('0x39')]:_0x45a7b6['model'];_0xb69720[_0x3f3f('0x3d')]=qs[_0x3f3f('0x3e')](_0x45f07a[_0x3f3f('0x35')][_0x3f3f('0x3e')]);_0xb69720['where']=qs[_0x3f3f('0x37')](_[_0x3f3f('0x3f')](_0x45f07a[_0x3f3f('0x35')],_0x45a7b6['filters']));_0xb69720[_0x3f3f('0x41')]=_[_0x3f3f('0x42')](_0xb69720[_0x3f3f('0x41')],{'$or':[{'ListId':_0x2eca5b['id']},{'ListId':null}]});if(_0x45f07a[_0x3f3f('0x35')][_0x3f3f('0x40')]){_0xb69720[_0x3f3f('0x41')]=_[_0x3f3f('0x42')](_0xb69720[_0x3f3f('0x41')],{'$or':_['map'](_0xb69720[_0x3f3f('0x39')],function(_0x334e8e){var _0x1ed968={};_0x1ed968[_0x334e8e]={'$like':'%'+_0x45f07a['query'][_0x3f3f('0x40')]+'%'};return _0x1ed968;})});}_0xb69720=_[_0x3f3f('0x42')]({},_0xb69720,_0x45f07a[_0x3f3f('0x43')]);return db[_0x3f3f('0x67')][_0x3f3f('0x98')](_0xb69720);}})[_0x3f3f('0x27')](respondWithResult(_0x34b18a,null))[_0x3f3f('0x4c')](handleError(_0x34b18a,null));};exports['getGlobalCustomFields']=function(_0x53f4d5,_0x166156){return db[_0x3f3f('0x67')]['findAndCountAll']({'where':{'ListId':null}})[_0x3f3f('0x27')](handleEntityNotFound(_0x166156,null))['then'](function(_0x395e63){return _0x395e63;})[_0x3f3f('0x27')](respondWithResult(_0x166156,null))['catch'](handleError(_0x166156,null));};exports[_0x3f3f('0x99')]=function(_0x597daf,_0x32a123,_0x5093b1){return db['CmList'][_0x3f3f('0x4b')]({'where':{'id':_0x597daf[_0x3f3f('0x48')]['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x32a123,null))[_0x3f3f('0x27')](function(_0x1872eb){if(_0x1872eb){return _0x1872eb['addAgents'](_0x597daf[_0x3f3f('0x4e')][_0x3f3f('0x5d')],_[_0x3f3f('0x64')](_0x597daf[_0x3f3f('0x4e')],[_0x3f3f('0x5d'),'id'])||{})[_0x3f3f('0x9a')](function(_0x697101){for(var _0x265a76=0x0;_0x265a76<_0x597daf[_0x3f3f('0x4e')][_0x3f3f('0x5d')][_0x3f3f('0x3a')];_0x265a76+=0x1){socket[_0x3f3f('0x9b')](_0x3f3f('0x9c'),{'UserId':Number(_0x597daf[_0x3f3f('0x4e')][_0x3f3f('0x5d')][_0x265a76]),'CmListId':Number(_0x597daf[_0x3f3f('0x48')]['id'])});}return _0x697101;});}})[_0x3f3f('0x27')](respondWithResult(_0x32a123,null))[_0x3f3f('0x4c')](handleError(_0x32a123,null));};exports['removeAgents']=function(_0x5a4fc7,_0x219268,_0x469314){return db[_0x3f3f('0x30')][_0x3f3f('0x4b')]({'where':{'id':_0x5a4fc7[_0x3f3f('0x48')]['id']}})['then'](handleEntityNotFound(_0x219268,null))['then'](function(_0xf4f5db){if(_0xf4f5db){return _0xf4f5db[_0x3f3f('0x9d')](_0x5a4fc7[_0x3f3f('0x35')][_0x3f3f('0x5d')])['then'](function(){if(_[_0x3f3f('0x60')](_0x5a4fc7[_0x3f3f('0x35')][_0x3f3f('0x5d')])){for(var _0x28abda=0x0;_0x28abda<_0x5a4fc7[_0x3f3f('0x35')][_0x3f3f('0x5d')][_0x3f3f('0x3a')];_0x28abda+=0x1){socket['emit'](_0x3f3f('0x9e'),{'UserId':Number(_0x5a4fc7[_0x3f3f('0x35')]['ids'][_0x28abda]),'CmListId':Number(_0x5a4fc7[_0x3f3f('0x48')]['id'])});}}else{socket['emit'](_0x3f3f('0x9e'),{'UserId':Number(_0x5a4fc7[_0x3f3f('0x35')][_0x3f3f('0x5d')]),'CmListId':Number(_0x5a4fc7[_0x3f3f('0x48')]['id'])});}});}})[_0x3f3f('0x27')](respondWithStatusCode(_0x219268,null))[_0x3f3f('0x4c')](handleError(_0x219268,null));};exports['getAgents']=function(_0x18d938,_0x59ca7f,_0x30e75a){var _0x3e9d05={};var _0x47b4b0={};var _0x522ef6;var _0x36642b;return db[_0x3f3f('0x30')][_0x3f3f('0x5a')]({'where':{'id':_0x18d938[_0x3f3f('0x48')]['id']}})[_0x3f3f('0x27')](handleEntityNotFound(_0x59ca7f,null))[_0x3f3f('0x27')](function(_0x7f96e){if(_0x7f96e){_0x522ef6=_0x7f96e;_0x47b4b0['model']=_[_0x3f3f('0x36')](db['User'][_0x3f3f('0x49')]);_0x47b4b0[_0x3f3f('0x35')]=_['keys'](_0x18d938['query']);_0x47b4b0[_0x3f3f('0x37')]=_[_0x3f3f('0x38')](_0x47b4b0['model'],_0x47b4b0[_0x3f3f('0x35')]);_0x3e9d05['attributes']=_[_0x3f3f('0x38')](_0x47b4b0[_0x3f3f('0x34')],qs['fields'](_0x18d938[_0x3f3f('0x35')][_0x3f3f('0x4a')]));_0x3e9d05['attributes']=_0x3e9d05[_0x3f3f('0x39')][_0x3f3f('0x3a')]?_0x3e9d05[_0x3f3f('0x39')]:_0x47b4b0['model'];_0x3e9d05[_0x3f3f('0x3d')]=qs[_0x3f3f('0x3e')](_0x18d938[_0x3f3f('0x35')]['sort']);_0x3e9d05[_0x3f3f('0x41')]=qs[_0x3f3f('0x37')](_[_0x3f3f('0x3f')](_0x18d938[_0x3f3f('0x35')],_0x47b4b0[_0x3f3f('0x37')]));if(_0x18d938[_0x3f3f('0x35')][_0x3f3f('0x40')]){_0x3e9d05[_0x3f3f('0x41')]=_[_0x3f3f('0x42')](_0x3e9d05[_0x3f3f('0x41')],{'$or':_[_0x3f3f('0x2f')](_0x3e9d05[_0x3f3f('0x39')],function(_0x53b577){var _0x553713={};_0x553713[_0x53b577]={'$like':'%'+_0x18d938[_0x3f3f('0x35')][_0x3f3f('0x40')]+'%'};return _0x553713;})});}_0x3e9d05=_[_0x3f3f('0x42')]({},_0x3e9d05,_0x18d938['options']);return _0x522ef6[_0x3f3f('0x9f')](_0x3e9d05);}})[_0x3f3f('0x27')](function(_0x182191){if(_0x182191){_0x36642b=_0x182191['length'];if(!_0x18d938[_0x3f3f('0x35')][_0x3f3f('0x3b')]('nolimit')){_0x3e9d05[_0x3f3f('0x20')]=qs[_0x3f3f('0x20')](_0x18d938[_0x3f3f('0x35')][_0x3f3f('0x20')]);_0x3e9d05[_0x3f3f('0x1f')]=qs[_0x3f3f('0x1f')](_0x18d938[_0x3f3f('0x35')]['offset']);}return _0x522ef6[_0x3f3f('0x9f')](_0x3e9d05);}})['then'](function(_0x5e0166){if(_0x5e0166){return _0x5e0166?{'count':_0x36642b,'rows':_0x5e0166}:null;}})[_0x3f3f('0x27')](respondWithResult(_0x59ca7f,null))[_0x3f3f('0x4c')](handleError(_0x59ca7f,null));};function handleQuery(_0x25c5f0){logger[_0x3f3f('0xa0')](_0x25c5f0);return db[_0x3f3f('0x8b')][_0x3f3f('0x35')](_0x25c5f0)['spread'](function(_0x4880e2){csv_results[_0x3f3f('0x62')](_0x4880e2);})['catch'](function(_0x293a7c){logger[_0x3f3f('0x2c')](_0x293a7c['message']);});} \ No newline at end of file +var _0xfd30=['includeAll','include','findAll','rows','catch','show','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','create','getDispositions','findOne','ids','tags','isArray','join','each','CmContact','omit','success','dataValues','errors','push','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmList'];(function(_0x405d98,_0x4f3b66){var _0x40435=function(_0x46633f){while(--_0x46633f){_0x405d98['push'](_0x405d98['shift']());}};_0x40435(++_0x4f3b66);}(_0xfd30,0xff));var _0x0fd3=function(_0x17ca69,_0x59139d){_0x17ca69=_0x17ca69-0x0;var _0xbbb5c6=_0xfd30[_0x17ca69];return _0xbbb5c6;};'use strict';var emlformat=require(_0x0fd3('0x0'));var rimraf=require(_0x0fd3('0x1'));var zipdir=require(_0x0fd3('0x2'));var jsonpatch=require(_0x0fd3('0x3'));var rp=require(_0x0fd3('0x4'));var moment=require(_0x0fd3('0x5'));var BPromise=require(_0x0fd3('0x6'));var Mustache=require(_0x0fd3('0x7'));var util=require(_0x0fd3('0x8'));var path=require(_0x0fd3('0x9'));var sox=require(_0x0fd3('0xa'));var csv=require(_0x0fd3('0xb'));var ejs=require(_0x0fd3('0xc'));var fs=require('fs');var fs_extra=require(_0x0fd3('0xd'));var _=require(_0x0fd3('0xe'));var squel=require('squel');var crypto=require(_0x0fd3('0xf'));var jsforce=require(_0x0fd3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0fd3('0xb'));var querystring=require(_0x0fd3('0x11'));var Papa=require(_0x0fd3('0x12'));var Redis=require(_0x0fd3('0x13'));var authService=require(_0x0fd3('0x14'));var qs=require(_0x0fd3('0x15'));var as=require(_0x0fd3('0x16'));var hardwareService=require(_0x0fd3('0x17'));var logger=require(_0x0fd3('0x18'))(_0x0fd3('0x19'));var utils=require('../../config/utils');var config=require(_0x0fd3('0x1a'));var licenseUtil=require(_0x0fd3('0x1b'));var db=require(_0x0fd3('0x1c'))['db'];var csv_results;config[_0x0fd3('0x1d')]=_[_0x0fd3('0x1e')](config[_0x0fd3('0x1d')],{'host':_0x0fd3('0x1f'),'port':0x18eb});var socket=require(_0x0fd3('0x20'))(new Redis(config[_0x0fd3('0x1d')]));require('./cmList.socket')[_0x0fd3('0x21')](socket);function respondWithStatusCode(_0x337b08,_0xea4809){_0xea4809=_0xea4809||0xcc;return function(_0x3d8973){if(_0x3d8973){return _0x337b08[_0x0fd3('0x22')](_0xea4809);}return _0x337b08['status'](_0xea4809)[_0x0fd3('0x23')]();};}function respondWithResult(_0xb0f29b,_0x213865){_0x213865=_0x213865||0xc8;return function(_0x29538e){if(_0x29538e){return _0xb0f29b[_0x0fd3('0x24')](_0x213865)[_0x0fd3('0x25')](_0x29538e);}};}function respondWithFilteredResult(_0x523d50,_0x67dc1d){return function(_0x19ad26){if(_0x19ad26){var _0x528fbc=typeof _0x67dc1d[_0x0fd3('0x26')]===_0x0fd3('0x27')&&typeof _0x67dc1d[_0x0fd3('0x28')]===_0x0fd3('0x27');var _0xd4af58=_0x19ad26['count'];var _0x499cf4=_0x528fbc?0x0:_0x67dc1d[_0x0fd3('0x26')];var _0x3ac6a9=_0x528fbc?_0x19ad26[_0x0fd3('0x29')]:_0x67dc1d['offset']+_0x67dc1d[_0x0fd3('0x28')];var _0x1a1072;if(_0x3ac6a9>=_0xd4af58){_0x3ac6a9=_0xd4af58;_0x1a1072=0xc8;}else{_0x1a1072=0xce;}_0x523d50['status'](_0x1a1072);return _0x523d50[_0x0fd3('0x2a')](_0x0fd3('0x2b'),_0x499cf4+'-'+_0x3ac6a9+'/'+_0xd4af58)['json'](_0x19ad26);}return null;};}function patchUpdates(_0x37b437){return function(_0x5cab70){try{jsonpatch[_0x0fd3('0x2c')](_0x5cab70,_0x37b437,!![]);}catch(_0x33d222){return BPromise[_0x0fd3('0x2d')](_0x33d222);}return _0x5cab70['save']();};}function saveUpdates(_0x49dc34,_0x526941){return function(_0x590e5c){if(_0x590e5c){return _0x590e5c[_0x0fd3('0x2e')](_0x49dc34)[_0x0fd3('0x2f')](function(_0x3616a9){return _0x3616a9;});}return null;};}function removeEntity(_0xba27de,_0x4415b5){return function(_0x518527){if(_0x518527){return _0x518527[_0x0fd3('0x30')]()[_0x0fd3('0x2f')](function(){var _0xa0498d=_0x518527[_0x0fd3('0x31')]({'plain':!![]});var _0x506b17=_0x0fd3('0x32');return db[_0x0fd3('0x33')][_0x0fd3('0x30')]({'where':{'type':_0x506b17,'resourceId':_0xa0498d['id']}})['then'](function(){return _0x518527;});})[_0x0fd3('0x2f')](function(){_0xba27de[_0x0fd3('0x24')](0xcc)[_0x0fd3('0x23')]();});}};}function handleEntityNotFound(_0x9507f8,_0x7994fe){return function(_0x554b34){if(!_0x554b34){_0x9507f8[_0x0fd3('0x22')](0x194);}return _0x554b34;};}function handleError(_0x52bf5e,_0x14a3d7){_0x14a3d7=_0x14a3d7||0x1f4;return function(_0x4fce33){logger[_0x0fd3('0x34')](_0x4fce33[_0x0fd3('0x35')]);if(_0x4fce33[_0x0fd3('0x36')]){delete _0x4fce33['name'];}_0x52bf5e[_0x0fd3('0x24')](_0x14a3d7)['send'](_0x4fce33);};}exports[_0x0fd3('0x37')]=function(_0x1b83e4,_0x275bad){var _0xe2457={},_0x414044={},_0x12f620={'count':0x0,'rows':[]};var _0x79428f=_[_0x0fd3('0x38')](db['CmList'][_0x0fd3('0x39')],function(_0x5c8651){return{'name':_0x5c8651[_0x0fd3('0x3a')],'type':_0x5c8651[_0x0fd3('0x3b')][_0x0fd3('0x3c')]};});_0x414044[_0x0fd3('0x3d')]=_['map'](_0x79428f,_0x0fd3('0x36'));_0x414044[_0x0fd3('0x3e')]=_['keys'](_0x1b83e4[_0x0fd3('0x3e')]);_0x414044[_0x0fd3('0x3f')]=_[_0x0fd3('0x40')](_0x414044['model'],_0x414044[_0x0fd3('0x3e')]);_0xe2457[_0x0fd3('0x41')]=_[_0x0fd3('0x40')](_0x414044[_0x0fd3('0x3d')],qs['fields'](_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x42')]));_0xe2457[_0x0fd3('0x41')]=_0xe2457[_0x0fd3('0x41')][_0x0fd3('0x43')]?_0xe2457[_0x0fd3('0x41')]:_0x414044[_0x0fd3('0x3d')];if(!_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x44')](_0x0fd3('0x45'))){_0xe2457[_0x0fd3('0x28')]=qs['limit'](_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x28')]);_0xe2457['offset']=qs['offset'](_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x26')]);}_0xe2457[_0x0fd3('0x46')]=qs[_0x0fd3('0x47')](_0x1b83e4['query']['sort']);_0xe2457[_0x0fd3('0x48')]=qs['filters'](_[_0x0fd3('0x49')](_0x1b83e4[_0x0fd3('0x3e')],_0x414044['filters']),_0x79428f);if(_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x4a')]){_0xe2457['where']=_[_0x0fd3('0x4b')](_0xe2457[_0x0fd3('0x48')],{'$or':_[_0x0fd3('0x38')](_0x79428f,function(_0x108b60){if(_0x108b60['type']!==_0x0fd3('0x4c')){var _0x3dd08e={};_0x3dd08e[_0x108b60[_0x0fd3('0x36')]]={'$like':'%'+_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x4a')]+'%'};return _0x3dd08e;}})});}_0xe2457=_[_0x0fd3('0x4b')]({},_0xe2457,_0x1b83e4[_0x0fd3('0x4d')]);var _0x337b32={'where':_0xe2457[_0x0fd3('0x48')]};return db[_0x0fd3('0x4e')][_0x0fd3('0x29')](_0x337b32)[_0x0fd3('0x2f')](function(_0x1b58d1){_0x12f620[_0x0fd3('0x29')]=_0x1b58d1;if(_0x1b83e4[_0x0fd3('0x3e')][_0x0fd3('0x4f')]){_0xe2457[_0x0fd3('0x50')]=[{'all':!![]}];}return db[_0x0fd3('0x4e')][_0x0fd3('0x51')](_0xe2457);})[_0x0fd3('0x2f')](function(_0x4de443){_0x12f620[_0x0fd3('0x52')]=_0x4de443;return _0x12f620;})[_0x0fd3('0x2f')](respondWithFilteredResult(_0x275bad,_0xe2457))[_0x0fd3('0x53')](handleError(_0x275bad,null));};exports[_0x0fd3('0x54')]=function(_0x1dfbb7,_0x5b2c75){var _0x2169bf={'raw':![],'where':{'id':_0x1dfbb7[_0x0fd3('0x55')]['id']}},_0x3d7cb9={};_0x3d7cb9[_0x0fd3('0x3d')]=_[_0x0fd3('0x56')](db[_0x0fd3('0x4e')]['rawAttributes']);_0x3d7cb9[_0x0fd3('0x3e')]=_[_0x0fd3('0x56')](_0x1dfbb7[_0x0fd3('0x3e')]);_0x3d7cb9['filters']=_[_0x0fd3('0x40')](_0x3d7cb9['model'],_0x3d7cb9[_0x0fd3('0x3e')]);_0x2169bf[_0x0fd3('0x41')]=_[_0x0fd3('0x40')](_0x3d7cb9[_0x0fd3('0x3d')],qs[_0x0fd3('0x42')](_0x1dfbb7[_0x0fd3('0x3e')]['fields']));_0x2169bf['attributes']=_0x2169bf['attributes']['length']?_0x2169bf[_0x0fd3('0x41')]:_0x3d7cb9[_0x0fd3('0x3d')];if(_0x1dfbb7[_0x0fd3('0x3e')][_0x0fd3('0x4f')]){_0x2169bf['include']=[{'all':!![]}];}_0x2169bf=_[_0x0fd3('0x4b')]({},_0x2169bf,_0x1dfbb7['options']);return db['CmList'][_0x0fd3('0x57')](_0x2169bf)[_0x0fd3('0x2f')](handleEntityNotFound(_0x5b2c75,null))[_0x0fd3('0x2f')](respondWithResult(_0x5b2c75,null))[_0x0fd3('0x53')](handleError(_0x5b2c75,null));};exports['create']=function(_0xd54b40,_0x1dd9e7){return db[_0x0fd3('0x4e')]['create'](_0xd54b40[_0x0fd3('0x58')],{})[_0x0fd3('0x2f')](function(_0x5f1e9b){var _0x10af55=_0xd54b40[_0x0fd3('0x59')][_0x0fd3('0x31')]({'plain':!![]});if(!_0x10af55)throw new Error(_0x0fd3('0x5a'));if(_0x10af55[_0x0fd3('0x5b')]===_0x0fd3('0x59')){var _0x16dc54=_0x5f1e9b[_0x0fd3('0x31')]({'plain':!![]});var _0x4fdd80=_0x0fd3('0x32');return db[_0x0fd3('0x5c')][_0x0fd3('0x57')]({'where':{'name':_0x4fdd80,'userProfileId':_0x10af55['userProfileId']},'raw':!![]})[_0x0fd3('0x2f')](function(_0x532822){if(_0x532822&&_0x532822[_0x0fd3('0x5d')]===0x0){return db[_0x0fd3('0x33')]['create']({'name':_0x16dc54[_0x0fd3('0x36')],'resourceId':_0x16dc54['id'],'type':_0x532822['name'],'sectionId':_0x532822['id']},{})[_0x0fd3('0x2f')](function(){return _0x5f1e9b;});}else{return _0x5f1e9b;}})[_0x0fd3('0x53')](function(_0x38c51e){logger[_0x0fd3('0x34')](_0x0fd3('0x5e'),_0x38c51e);throw _0x38c51e;});}return _0x5f1e9b;})[_0x0fd3('0x2f')](respondWithResult(_0x1dd9e7,0xc9))[_0x0fd3('0x53')](handleError(_0x1dd9e7,null));};exports[_0x0fd3('0x2e')]=function(_0x1ed4fd,_0x3e7623){if(_0x1ed4fd[_0x0fd3('0x58')]['id']){delete _0x1ed4fd[_0x0fd3('0x58')]['id'];}return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x1ed4fd[_0x0fd3('0x55')]['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x3e7623,null))[_0x0fd3('0x2f')](saveUpdates(_0x1ed4fd['body'],null))[_0x0fd3('0x2f')](respondWithResult(_0x3e7623,null))['catch'](handleError(_0x3e7623,null));};exports['destroy']=function(_0x30e031,_0x5bd750){return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x30e031['params']['id']}})['then'](handleEntityNotFound(_0x5bd750,null))['then'](removeEntity(_0x5bd750,null))[_0x0fd3('0x53')](handleError(_0x5bd750,null));};exports[_0x0fd3('0x5f')]=function(_0xf2f24d,_0x38f8b9){return db['CmList'][_0x0fd3('0x5f')]()[_0x0fd3('0x2f')](respondWithResult(_0x38f8b9,null))[_0x0fd3('0x53')](handleError(_0x38f8b9,null));};exports['addDisposition']=function(_0x27dd05,_0x455444,_0x452c85){if(_0x27dd05[_0x0fd3('0x58')]['id']){delete _0x27dd05[_0x0fd3('0x58')]['id'];}return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x27dd05[_0x0fd3('0x55')]['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x455444,null))['then'](function(_0x209112){if(_0x209112){_0x27dd05[_0x0fd3('0x58')][_0x0fd3('0x60')]=_0x209112['id'];return db[_0x0fd3('0x61')][_0x0fd3('0x62')](_0x27dd05[_0x0fd3('0x58')]);}})[_0x0fd3('0x2f')](respondWithResult(_0x455444,null))[_0x0fd3('0x53')](handleError(_0x455444,null));};exports[_0x0fd3('0x63')]=function(_0x11fa3b,_0xbce445,_0x302d76){var _0x4e7d35={'raw':![],'where':{}};var _0x19bab2={};var _0x2264f6={'count':0x0,'rows':[]};return db['CmList'][_0x0fd3('0x64')]({'where':{'id':_0x11fa3b[_0x0fd3('0x55')]['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0xbce445,null))[_0x0fd3('0x2f')](function(_0x10e419){if(_0x10e419){_0x19bab2[_0x0fd3('0x3d')]=_[_0x0fd3('0x56')](db[_0x0fd3('0x61')][_0x0fd3('0x39')]);_0x19bab2['query']=_[_0x0fd3('0x56')](_0x11fa3b[_0x0fd3('0x3e')]);_0x19bab2[_0x0fd3('0x3f')]=_[_0x0fd3('0x40')](_0x19bab2[_0x0fd3('0x3d')],_0x19bab2['query']);_0x4e7d35[_0x0fd3('0x41')]=_['intersection'](_0x19bab2[_0x0fd3('0x3d')],qs['fields'](_0x11fa3b[_0x0fd3('0x3e')]['fields']));_0x4e7d35[_0x0fd3('0x41')]=_0x4e7d35[_0x0fd3('0x41')][_0x0fd3('0x43')]?_0x4e7d35[_0x0fd3('0x41')]:_0x19bab2[_0x0fd3('0x3d')];if(!_0x11fa3b[_0x0fd3('0x3e')][_0x0fd3('0x44')]('nolimit')){_0x4e7d35[_0x0fd3('0x28')]=qs[_0x0fd3('0x28')](_0x11fa3b['query']['limit']);_0x4e7d35['offset']=qs['offset'](_0x11fa3b['query'][_0x0fd3('0x26')]);}_0x4e7d35[_0x0fd3('0x46')]=qs[_0x0fd3('0x47')](_0x11fa3b[_0x0fd3('0x3e')][_0x0fd3('0x47')]);_0x4e7d35[_0x0fd3('0x48')]=qs[_0x0fd3('0x3f')](_[_0x0fd3('0x49')](_0x11fa3b[_0x0fd3('0x3e')],_0x19bab2[_0x0fd3('0x3f')]));_0x4e7d35['where'][_0x0fd3('0x60')]=_0x10e419['id'];if(_0x11fa3b[_0x0fd3('0x3e')]['filter']){_0x4e7d35[_0x0fd3('0x48')]=_['merge'](_0x4e7d35['where'],{'$or':_[_0x0fd3('0x38')](_0x4e7d35['attributes'],function(_0x10ef6a){var _0x4b6ae0={};_0x4b6ae0[_0x10ef6a]={'$like':'%'+_0x11fa3b[_0x0fd3('0x3e')][_0x0fd3('0x4a')]+'%'};return _0x4b6ae0;})});}_0x4e7d35=_[_0x0fd3('0x4b')]({},_0x4e7d35,_0x11fa3b[_0x0fd3('0x4d')]);return db[_0x0fd3('0x61')][_0x0fd3('0x29')]({'where':_0x4e7d35[_0x0fd3('0x48')]})['then'](function(_0x1c165e){_0x2264f6[_0x0fd3('0x29')]=_0x1c165e;if(_0x11fa3b['query']['includeAll']){_0x4e7d35[_0x0fd3('0x50')]=[{'all':!![]}];}return db[_0x0fd3('0x61')]['findAll'](_0x4e7d35);})['then'](function(_0x56ba8e){_0x2264f6['rows']=_0x56ba8e;return _0x2264f6;});}})[_0x0fd3('0x2f')](respondWithFilteredResult(_0xbce445,_0x4e7d35))['catch'](handleError(_0xbce445,null));};exports['removeDispositions']=function(_0x247d49,_0x164079,_0x3b40ea){return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x247d49['params']['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x164079,null))[_0x0fd3('0x2f')](function(_0x4da756){if(_0x4da756){return _0x4da756['removeDispositions'](_0x247d49['query'][_0x0fd3('0x65')]);}})[_0x0fd3('0x2f')](respondWithStatusCode(_0x164079,null))[_0x0fd3('0x53')](handleError(_0x164079,null));};exports['addContacts']=function(_0x4a92ac,_0x4c7bc2,_0x55829f){return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x4a92ac[_0x0fd3('0x55')]['id']}})['then'](handleEntityNotFound(_0x4c7bc2,null))[_0x0fd3('0x2f')](function(_0x3bc20d){if(_0x3bc20d){var _0x4f9367=[];var _0x24b236={'success':[],'errors':[]};return db['CmContact'][_0x0fd3('0x5f')]()[_0x0fd3('0x2f')](function(_0x1134fc){if(_0x4a92ac[_0x0fd3('0x58')][_0x0fd3('0x66')]&&_[_0x0fd3('0x67')](_0x4a92ac[_0x0fd3('0x58')][_0x0fd3('0x66')])){if(_0x4a92ac['body'][_0x0fd3('0x66')][_0x0fd3('0x43')]){_0x4a92ac[_0x0fd3('0x58')][_0x0fd3('0x66')]=_0x4a92ac['body']['tags'][_0x0fd3('0x68')](';')+';';}else{_0x4a92ac[_0x0fd3('0x58')][_0x0fd3('0x66')]=null;}}else{_0x4a92ac[_0x0fd3('0x58')]['tags']=null;}if(_0x4a92ac[_0x0fd3('0x58')]&&_['isArray'](_0x4a92ac[_0x0fd3('0x58')])){for(var _0x2d79ca=0x0;_0x2d79ca<_0x4a92ac['body']['length'];_0x2d79ca+=0x1){_0x4a92ac[_0x0fd3('0x58')][_0x2d79ca][_0x0fd3('0x60')]=_0x4a92ac['params']['id'];_0x4f9367['push'](_0x4a92ac[_0x0fd3('0x58')][_0x2d79ca]);}return BPromise[_0x0fd3('0x69')](_0x4f9367,function(_0x339561){return db[_0x0fd3('0x6a')][_0x0fd3('0x62')](_[_0x0fd3('0x6b')](_0x339561,['ids','id'])||{},{'fields':_[_0x0fd3('0x56')](_0x1134fc),'raw':!![]})[_0x0fd3('0x2f')](function(_0x4c2484){_0x24b236[_0x0fd3('0x6c')]['push'](_0x4c2484[_0x0fd3('0x6d')]);})[_0x0fd3('0x53')](function(_0x1bc3f1){_0x24b236[_0x0fd3('0x6e')][_0x0fd3('0x6f')]({'data':_0x339561,'error':_0x1bc3f1['message']});});})['then'](function(_0x5d3507){return _0x24b236;})[_0x0fd3('0x53')](function(_0x46d8ba){return _0x46d8ba;});}else{_0x4c7bc2[_0x0fd3('0x24')](0x190)[_0x0fd3('0x25')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x0fd3('0x2f')](respondWithResult(_0x4c7bc2,null))[_0x0fd3('0x53')](handleError(_0x4c7bc2,null));};exports[_0x0fd3('0x70')]=function(_0x1f0dc0,_0x5e7b8d,_0x73bb65){var _0x3d7e58;return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x1f0dc0['params']['id']},'include':[{'model':db[_0x0fd3('0x71')],'as':_0x0fd3('0x72')}]})[_0x0fd3('0x2f')](handleEntityNotFound(_0x5e7b8d,null))[_0x0fd3('0x2f')](function(_0x454719){if(_0x454719){_0x3d7e58=_0x454719;return db['CmContact']['rawAttributes'];}})[_0x0fd3('0x2f')](function(_0xdadd4f){if(_0xdadd4f){var _0x4b3603={};var _0x2490b2={};_0x2490b2['model']=_[_0x0fd3('0x73')](_['keys'](_0xdadd4f),_[_0x0fd3('0x38')](_0x3d7e58[_0x0fd3('0x72')],function(_0x2c7224){return util[_0x0fd3('0x74')](_0x0fd3('0x75'),_0x2c7224['id']);}));_0x2490b2[_0x0fd3('0x3e')]=_[_0x0fd3('0x56')](_0x1f0dc0[_0x0fd3('0x3e')]);_0x2490b2[_0x0fd3('0x3f')]=_['intersection'](_0x2490b2['model'],_0x2490b2[_0x0fd3('0x3e')]);_0x4b3603[_0x0fd3('0x41')]=_[_0x0fd3('0x40')](_0x2490b2['model'],qs[_0x0fd3('0x42')](_0x1f0dc0[_0x0fd3('0x3e')][_0x0fd3('0x42')]));_0x4b3603[_0x0fd3('0x41')]=_0x4b3603[_0x0fd3('0x41')][_0x0fd3('0x43')]?_0x4b3603['attributes']:_0x2490b2['model'];if(!_0x1f0dc0[_0x0fd3('0x3e')][_0x0fd3('0x44')](_0x0fd3('0x45'))){_0x4b3603[_0x0fd3('0x28')]=qs[_0x0fd3('0x28')](_0x1f0dc0[_0x0fd3('0x3e')][_0x0fd3('0x28')]);_0x4b3603[_0x0fd3('0x26')]=qs[_0x0fd3('0x26')](_0x1f0dc0['query'][_0x0fd3('0x26')]);}_0x4b3603[_0x0fd3('0x46')]=qs[_0x0fd3('0x47')](_0x1f0dc0[_0x0fd3('0x3e')][_0x0fd3('0x47')]);_0x4b3603['where']=qs[_0x0fd3('0x3f')](_['pick'](_0x1f0dc0['query'],_0x2490b2[_0x0fd3('0x3f')]));_0x4b3603[_0x0fd3('0x76')]=!![];if(_0x1f0dc0['query'][_0x0fd3('0x4a')]){_0x4b3603[_0x0fd3('0x48')]=_[_0x0fd3('0x4b')](_0x4b3603[_0x0fd3('0x48')],{'$or':_[_0x0fd3('0x38')](_0x4b3603[_0x0fd3('0x41')],function(_0x27c65a){var _0x9330e3={};_0x9330e3[_0x27c65a]={'$like':'%'+_0x1f0dc0[_0x0fd3('0x3e')][_0x0fd3('0x4a')]+'%'};return _0x9330e3;})});}_0x4b3603=_['merge']({},_0x4b3603,_0x1f0dc0['options']);return _0x3d7e58[_0x0fd3('0x70')](_0x4b3603);}})[_0x0fd3('0x2f')](respondWithResult(_0x5e7b8d,null))[_0x0fd3('0x53')](handleError(_0x5e7b8d,null));};exports[_0x0fd3('0x77')]=function(_0x3f7879,_0x82b759,_0x4cd081){var _0x4eac4;var _0x584f41;var _0x1542aa;var _0x4eebec=_0x3f7879[_0x0fd3('0x55')]['id'];csv_results=[];return db[_0x0fd3('0x78')][_0x0fd3('0x51')]({'attributes':['id',_0x0fd3('0x36')],'raw':!![],'order':[_0x0fd3('0x79')]})[_0x0fd3('0x2f')](function(_0x3f7793){_0x4eac4=_0x3f7793;var _0x10f732=_[_0x0fd3('0x56')](db[_0x0fd3('0x6a')][_0x0fd3('0x39')]);return db[_0x0fd3('0x71')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0x0fd3('0x2f')](function(_0x2e18e8){_0x584f41=_0x2e18e8;var _0x19d7a7=squel['select']()['fields'](_0x10f732)[_0x0fd3('0x7a')](_0x0fd3('0x7b'),'c')[_0x0fd3('0x48')]('c.ListId\x20=\x20?',_0x4eebec)[_0x0fd3('0x48')](_0x0fd3('0x7c'))[_0x0fd3('0x7d')]();for(var _0x4f0257=0x0;_0x4f0257<_0x584f41[_0x0fd3('0x43')];_0x4f0257++){_0x19d7a7[_0x0fd3('0x7e')](_0x0fd3('0x7f')+_0x584f41[_0x4f0257]['id'],_0x0fd3('0x80')+_0x584f41[_0x4f0257][_0x0fd3('0x81')]);}for(var _0x4f0257=0x0;_0x4f0257<_0x4eac4[_0x0fd3('0x43')];_0x4f0257++){_0x19d7a7['field'](squel[_0x0fd3('0x82')]()['field'](_0x0fd3('0x83'))[_0x0fd3('0x7a')](_0x0fd3('0x84'))[_0x0fd3('0x48')](_0x0fd3('0x85'),_0x4eac4[_0x4f0257]['id'])[_0x0fd3('0x48')](_0x0fd3('0x86')),_0x0fd3('0x87')+_0x4eac4[_0x4f0257][_0x0fd3('0x36')]);_0x19d7a7['field'](squel[_0x0fd3('0x82')]()[_0x0fd3('0x7e')](_0x0fd3('0x88'))[_0x0fd3('0x7a')]('cm_contact_has_items')[_0x0fd3('0x48')](_0x0fd3('0x85'),_0x4eac4[_0x4f0257]['id'])[_0x0fd3('0x48')](_0x0fd3('0x86')),'description_additionalPhone_'+_0x4eac4[_0x4f0257][_0x0fd3('0x36')]);}var _0x418f94=[];_0x418f94[_0x0fd3('0x6f')](_0x19d7a7[_0x0fd3('0x89')]());BPromise['each'](_0x418f94,handleQuery)[_0x0fd3('0x2f')](function(_0x258f4d){handleQuery(_0x19d7a7[_0x0fd3('0x89')]());var _0x3a0100=csv_results[0x0];if(!_['isEmpty'](_0x3a0100)){var _0x459d19=toCsv(_0x3a0100);var _0x45c1e3=Date['now']();fs[_0x0fd3('0x8a')](util[_0x0fd3('0x74')]('/tmp/list_%d_%s.csv',_0x4eebec,_0x45c1e3),_0x459d19);_0x82b759['setHeader'](_0x0fd3('0x8b'),_0x0fd3('0x8c')+util[_0x0fd3('0x74')](_0x0fd3('0x8d'),_0x4eebec,_0x45c1e3));_0x82b759[_0x0fd3('0x8e')](_0x0fd3('0x8f'),_0x0fd3('0x90'));return _0x82b759[_0x0fd3('0x91')](util[_0x0fd3('0x74')](_0x0fd3('0x92'),_0x4eebec,_0x45c1e3));}else{return _0x82b759[_0x0fd3('0x22')](0xcc);}});});});};exports[_0x0fd3('0x93')]=function(_0x2da0da,_0xb551f2,_0x8daa44){var _0x5adc6b;delete _0x2da0da[_0x0fd3('0x58')]['id'];return db['CmList'][_0x0fd3('0x64')]({'where':{'id':_0x2da0da[_0x0fd3('0x55')]['id']}})['then'](handleEntityNotFound(_0xb551f2,null))[_0x0fd3('0x2f')](function(_0xcf826a){if(_0xcf826a){return db[_0x0fd3('0x94')]['transaction'](function(_0x45bd88){return db[_0x0fd3('0x71')][_0x0fd3('0x62')](_0x2da0da['body'],{'transaction':_0x45bd88})[_0x0fd3('0x2f')](function(_0x21382f){_0x5adc6b=_0x21382f;return _0xcf826a[_0x0fd3('0x95')](_0x21382f,{'transaction':_0x45bd88});})[_0x0fd3('0x2f')](function(){var _0x59f492={'type':db[_0x0fd3('0x96')][_0x0fd3('0x97')],'transaction':_0x45bd88};switch(_0x2da0da['body'][_0x0fd3('0x3b')]){case'text':_0x59f492[_0x0fd3('0x3b')]=db[_0x0fd3('0x96')][_0x0fd3('0x97')];break;case _0x0fd3('0x98'):_0x59f492['type']=db['Sequelize']['INTEGER'];break;case'switch':_0x59f492[_0x0fd3('0x3b')]=db[_0x0fd3('0x96')][_0x0fd3('0x99')];_0x59f492[_0x0fd3('0x9a')]=![];break;default:}return db[_0x0fd3('0x94')]['queryInterface'][_0x0fd3('0x9b')](_0x0fd3('0x7b'),util['format'](_0x0fd3('0x9c'),_0x5adc6b['id']),_0x59f492);})[_0x0fd3('0x2f')](function(){return _0x5adc6b;});});}})['then'](respondWithResult(_0xb551f2,null))['catch'](handleError(_0xb551f2,null));};exports[_0x0fd3('0x9d')]=function(_0x5c88af,_0x4e1a50,_0x43753c){var _0x79c32={};var _0x1acb72={};var _0x5b4b65;var _0x2c91fd;return db[_0x0fd3('0x4e')]['findOne']({'where':{'id':_0x5c88af[_0x0fd3('0x55')]['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x4e1a50,null))[_0x0fd3('0x2f')](function(_0x32ee13){if(_0x32ee13){_0x5b4b65=_0x32ee13;_0x1acb72[_0x0fd3('0x3d')]=_[_0x0fd3('0x56')](db['CmCustomField'][_0x0fd3('0x39')]);_0x1acb72[_0x0fd3('0x3e')]=_[_0x0fd3('0x56')](_0x5c88af[_0x0fd3('0x3e')]);_0x1acb72[_0x0fd3('0x3f')]=_['intersection'](_0x1acb72[_0x0fd3('0x3d')],_0x1acb72[_0x0fd3('0x3e')]);_0x79c32[_0x0fd3('0x41')]=_[_0x0fd3('0x40')](_0x1acb72[_0x0fd3('0x3d')],qs['fields'](_0x5c88af[_0x0fd3('0x3e')][_0x0fd3('0x42')]));_0x79c32[_0x0fd3('0x41')]=_0x79c32[_0x0fd3('0x41')][_0x0fd3('0x43')]?_0x79c32[_0x0fd3('0x41')]:_0x1acb72[_0x0fd3('0x3d')];_0x79c32[_0x0fd3('0x46')]=qs[_0x0fd3('0x47')](_0x5c88af[_0x0fd3('0x3e')][_0x0fd3('0x47')]);_0x79c32['where']=qs[_0x0fd3('0x3f')](_['pick'](_0x5c88af[_0x0fd3('0x3e')],_0x1acb72['filters']));_0x79c32['where']=_['merge'](_0x79c32['where'],{'$or':[{'ListId':_0x32ee13['id']},{'ListId':null}]});if(_0x5c88af['query'][_0x0fd3('0x4a')]){_0x79c32[_0x0fd3('0x48')]=_[_0x0fd3('0x4b')](_0x79c32[_0x0fd3('0x48')],{'$or':_[_0x0fd3('0x38')](_0x79c32[_0x0fd3('0x41')],function(_0x1159c0){var _0x34b5b3={};_0x34b5b3[_0x1159c0]={'$like':'%'+_0x5c88af[_0x0fd3('0x3e')]['filter']+'%'};return _0x34b5b3;})});}_0x79c32=_[_0x0fd3('0x4b')]({},_0x79c32,_0x5c88af[_0x0fd3('0x4d')]);return db[_0x0fd3('0x71')]['findAndCountAll'](_0x79c32);}})[_0x0fd3('0x2f')](respondWithResult(_0x4e1a50,null))[_0x0fd3('0x53')](handleError(_0x4e1a50,null));};exports[_0x0fd3('0x9e')]=function(_0x4ae7ac,_0x10c97c){return db[_0x0fd3('0x71')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x10c97c,null))[_0x0fd3('0x2f')](function(_0x566ddb){return _0x566ddb;})['then'](respondWithResult(_0x10c97c,null))[_0x0fd3('0x53')](handleError(_0x10c97c,null));};exports['addAgents']=function(_0x370738,_0x546069,_0xa6765){return db[_0x0fd3('0x4e')]['find']({'where':{'id':_0x370738['params']['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x546069,null))[_0x0fd3('0x2f')](function(_0x31b48b){if(_0x31b48b){return _0x31b48b['addAgents'](_0x370738['body'][_0x0fd3('0x65')],_[_0x0fd3('0x6b')](_0x370738['body'],[_0x0fd3('0x65'),'id'])||{})[_0x0fd3('0x9f')](function(_0x398d32){for(var _0x1faab8=0x0;_0x1faab8<_0x370738['body'][_0x0fd3('0x65')]['length'];_0x1faab8+=0x1){socket[_0x0fd3('0xa0')]('userCmList:save',{'UserId':Number(_0x370738['body'][_0x0fd3('0x65')][_0x1faab8]),'CmListId':Number(_0x370738[_0x0fd3('0x55')]['id'])});}return _0x398d32;});}})[_0x0fd3('0x2f')](respondWithResult(_0x546069,null))[_0x0fd3('0x53')](handleError(_0x546069,null));};exports[_0x0fd3('0xa1')]=function(_0x312e97,_0xc1b71c,_0x4ab6ce){return db[_0x0fd3('0x4e')][_0x0fd3('0x57')]({'where':{'id':_0x312e97[_0x0fd3('0x55')]['id']}})['then'](handleEntityNotFound(_0xc1b71c,null))[_0x0fd3('0x2f')](function(_0x949f29){if(_0x949f29){return _0x949f29[_0x0fd3('0xa1')](_0x312e97['query']['ids'])['then'](function(){if(_[_0x0fd3('0x67')](_0x312e97[_0x0fd3('0x3e')][_0x0fd3('0x65')])){for(var _0x57e23b=0x0;_0x57e23b<_0x312e97[_0x0fd3('0x3e')][_0x0fd3('0x65')][_0x0fd3('0x43')];_0x57e23b+=0x1){socket[_0x0fd3('0xa0')](_0x0fd3('0xa2'),{'UserId':Number(_0x312e97['query'][_0x0fd3('0x65')][_0x57e23b]),'CmListId':Number(_0x312e97[_0x0fd3('0x55')]['id'])});}}else{socket[_0x0fd3('0xa0')](_0x0fd3('0xa2'),{'UserId':Number(_0x312e97[_0x0fd3('0x3e')][_0x0fd3('0x65')]),'CmListId':Number(_0x312e97[_0x0fd3('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xc1b71c,null))[_0x0fd3('0x53')](handleError(_0xc1b71c,null));};exports[_0x0fd3('0xa3')]=function(_0x550153,_0x2ba965,_0x2398bf){var _0x3ef46={};var _0x307d28={};var _0x4cf77c;var _0x21f1b9;return db[_0x0fd3('0x4e')][_0x0fd3('0x64')]({'where':{'id':_0x550153[_0x0fd3('0x55')]['id']}})[_0x0fd3('0x2f')](handleEntityNotFound(_0x2ba965,null))[_0x0fd3('0x2f')](function(_0x3cf9d4){if(_0x3cf9d4){_0x4cf77c=_0x3cf9d4;_0x307d28['model']=_[_0x0fd3('0x56')](db[_0x0fd3('0xa4')]['rawAttributes']);_0x307d28[_0x0fd3('0x3e')]=_['keys'](_0x550153['query']);_0x307d28[_0x0fd3('0x3f')]=_['intersection'](_0x307d28[_0x0fd3('0x3d')],_0x307d28[_0x0fd3('0x3e')]);_0x3ef46[_0x0fd3('0x41')]=_[_0x0fd3('0x40')](_0x307d28[_0x0fd3('0x3d')],qs[_0x0fd3('0x42')](_0x550153['query'][_0x0fd3('0x42')]));_0x3ef46[_0x0fd3('0x41')]=_0x3ef46[_0x0fd3('0x41')][_0x0fd3('0x43')]?_0x3ef46['attributes']:_0x307d28[_0x0fd3('0x3d')];_0x3ef46[_0x0fd3('0x46')]=qs[_0x0fd3('0x47')](_0x550153[_0x0fd3('0x3e')][_0x0fd3('0x47')]);_0x3ef46[_0x0fd3('0x48')]=qs['filters'](_[_0x0fd3('0x49')](_0x550153[_0x0fd3('0x3e')],_0x307d28[_0x0fd3('0x3f')]));if(_0x550153[_0x0fd3('0x3e')][_0x0fd3('0x4a')]){_0x3ef46['where']=_[_0x0fd3('0x4b')](_0x3ef46[_0x0fd3('0x48')],{'$or':_['map'](_0x3ef46[_0x0fd3('0x41')],function(_0x1da420){var _0x4cdfb6={};_0x4cdfb6[_0x1da420]={'$like':'%'+_0x550153[_0x0fd3('0x3e')][_0x0fd3('0x4a')]+'%'};return _0x4cdfb6;})});}_0x3ef46=_[_0x0fd3('0x4b')]({},_0x3ef46,_0x550153[_0x0fd3('0x4d')]);return _0x4cf77c['getAgents'](_0x3ef46);}})[_0x0fd3('0x2f')](function(_0xb55aab){if(_0xb55aab){_0x21f1b9=_0xb55aab[_0x0fd3('0x43')];if(!_0x550153[_0x0fd3('0x3e')]['hasOwnProperty'](_0x0fd3('0x45'))){_0x3ef46[_0x0fd3('0x28')]=qs[_0x0fd3('0x28')](_0x550153['query'][_0x0fd3('0x28')]);_0x3ef46[_0x0fd3('0x26')]=qs[_0x0fd3('0x26')](_0x550153[_0x0fd3('0x3e')][_0x0fd3('0x26')]);}return _0x4cf77c[_0x0fd3('0xa3')](_0x3ef46);}})[_0x0fd3('0x2f')](function(_0x54059c){if(_0x54059c){return _0x54059c?{'count':_0x21f1b9,'rows':_0x54059c}:null;}})['then'](respondWithResult(_0x2ba965,null))[_0x0fd3('0x53')](handleError(_0x2ba965,null));};function handleQuery(_0x25b553){logger[_0x0fd3('0xa5')](_0x25b553);return db['sequelize'][_0x0fd3('0x3e')](_0x25b553)[_0x0fd3('0x9f')](function(_0xe916a9){csv_results[_0x0fd3('0x6f')](_0xe916a9);})[_0x0fd3('0x53')](function(_0x8a0dbb){logger[_0x0fd3('0x34')](_0x8a0dbb[_0x0fd3('0xa6')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 46018ae..bc417a1 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(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x5fc3[_0xcfc44];return _0x307a25;};'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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x48ef6b,_0x1f535a){var _0x4157b3=function(_0x189a80){while(--_0x189a80){_0x48ef6b['push'](_0x48ef6b['shift']());}};_0x4157b3(++_0x1f535a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7e38d0a..cbc2cd9 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x3b4137,_0x3729ae){var _0x4606ab=function(_0x11b5ce){while(--_0x11b5ce){_0x3b4137['push'](_0x3b4137['shift']());}};_0x4606ab(++_0x3729ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb5=['define','CmList','cm_lists','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x258376,_0x1bcb8d){var _0x75ac11=function(_0xd21397){while(--_0xd21397){_0x258376['push'](_0x258376['shift']());}};_0x75ac11(++_0x1bcb8d);}(_0x0bb5,0x148));var _0x50bb=function(_0x1ab25d,_0x46fa77){_0x1ab25d=_0x1ab25d-0x0;var _0xd0db44=_0x0bb5[_0x1ab25d];return _0xd0db44;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50bb('0x2'));var BPromise=require(_0x50bb('0x3'));var rp=require(_0x50bb('0x4'));var fs=require('fs');var path=require(_0x50bb('0x5'));var rimraf=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var attributes=require(_0x50bb('0x8'));module[_0x50bb('0x9')]=function(_0x4e6093,_0x4a105c){return _0x4e6093[_0x50bb('0xa')](_0x50bb('0xb'),attributes,{'tableName':_0x50bb('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 410ac88..a09dba9 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 _0x124f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x124f,0x127));var _0xf124=function(_0x1c29df,_0x21ee17){_0x1c29df=_0x1c29df-0x0;var _0x262ce0=_0x124f[_0x1c29df];return _0x262ce0;};'use strict';var _=require(_0xf124('0x0'));var util=require(_0xf124('0x1'));var moment=require(_0xf124('0x2'));var BPromise=require(_0xf124('0x3'));var rs=require(_0xf124('0x4'));var fs=require('fs');var Redis=require(_0xf124('0x5'));var db=require(_0xf124('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf124('0x7'))(_0xf124('0x8'));var config=require(_0xf124('0x9'));var jayson=require(_0xf124('0xa'));var client=jayson[_0xf124('0xb')][_0xf124('0xc')]({'port':0x232a});config[_0xf124('0xd')]=_[_0xf124('0xe')](config['redis'],{'host':_0xf124('0xf'),'port':0x18eb});var socket=require(_0xf124('0x10'))(new Redis(config[_0xf124('0xd')]));require(_0xf124('0x11'))[_0xf124('0x12')](socket);function respondWithRpcPromise(_0x52b8f8,_0x36f119,_0x58abdb){return new BPromise(function(_0x28cb46,_0x9ce20){return client[_0xf124('0x13')](_0x52b8f8,_0x58abdb)[_0xf124('0x14')](function(_0xbd7275){logger[_0xf124('0x15')](_0xf124('0x16'),_0x36f119,_0xf124('0x17'));logger[_0xf124('0x18')]('CmList,\x20%s,\x20%s,\x20%s',_0x36f119,_0xf124('0x17'),JSON[_0xf124('0x19')](_0xbd7275));if(_0xbd7275[_0xf124('0x1a')]){if(_0xbd7275[_0xf124('0x1a')]['code']===0x1f4){logger[_0xf124('0x1a')](_0xf124('0x16'),_0x36f119,_0xbd7275[_0xf124('0x1a')][_0xf124('0x1b')]);return _0x9ce20(_0xbd7275[_0xf124('0x1a')][_0xf124('0x1b')]);}logger[_0xf124('0x1a')]('CmList,\x20%s,\x20%s',_0x36f119,_0xbd7275['error'][_0xf124('0x1b')]);return _0x28cb46(_0xbd7275['error'][_0xf124('0x1b')]);}else{logger[_0xf124('0x15')](_0xf124('0x16'),_0x36f119,_0xf124('0x17'));_0x28cb46(_0xbd7275[_0xf124('0x1c')][_0xf124('0x1b')]);}})[_0xf124('0x1d')](function(_0xdf98b2){logger[_0xf124('0x1a')](_0xf124('0x16'),_0x36f119,_0xdf98b2);_0x9ce20(_0xdf98b2);});});} \ No newline at end of file +var _0x427a=['rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33b603,_0x188ef2){var _0x5eed38=function(_0xfcd223){while(--_0xfcd223){_0x33b603['push'](_0x33b603['shift']());}};_0x5eed38(++_0x188ef2);}(_0x427a,0xb6));var _0xa427=function(_0x530beb,_0x4a813f){_0x530beb=_0x530beb-0x0;var _0x2f7cd9=_0x427a[_0x530beb];return _0x2f7cd9;};'use strict';var _=require(_0xa427('0x0'));var util=require('util');var moment=require(_0xa427('0x1'));var BPromise=require('bluebird');var rs=require(_0xa427('0x2'));var fs=require('fs');var Redis=require(_0xa427('0x3'));var db=require(_0xa427('0x4'))['db'];var utils=require(_0xa427('0x5'));var logger=require(_0xa427('0x6'))(_0xa427('0x7'));var config=require(_0xa427('0x8'));var jayson=require(_0xa427('0x9'));var client=jayson['client'][_0xa427('0xa')]({'port':0x232a});config['redis']=_[_0xa427('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa427('0xc'))(new Redis(config[_0xa427('0xd')]));require(_0xa427('0xe'))[_0xa427('0xf')](socket);function respondWithRpcPromise(_0x32d262,_0x273d0c,_0x122b0d){return new BPromise(function(_0x3c906d,_0x51dba3){return client['request'](_0x32d262,_0x122b0d)[_0xa427('0x10')](function(_0x55799f){logger[_0xa427('0x11')](_0xa427('0x12'),_0x273d0c,_0xa427('0x13'));logger[_0xa427('0x14')](_0xa427('0x15'),_0x273d0c,_0xa427('0x13'),JSON[_0xa427('0x16')](_0x55799f));if(_0x55799f[_0xa427('0x17')]){if(_0x55799f['error'][_0xa427('0x18')]===0x1f4){logger[_0xa427('0x17')]('CmList,\x20%s,\x20%s',_0x273d0c,_0x55799f[_0xa427('0x17')][_0xa427('0x19')]);return _0x51dba3(_0x55799f[_0xa427('0x17')]['message']);}logger[_0xa427('0x17')](_0xa427('0x12'),_0x273d0c,_0x55799f[_0xa427('0x17')][_0xa427('0x19')]);return _0x3c906d(_0x55799f[_0xa427('0x17')][_0xa427('0x19')]);}else{logger[_0xa427('0x11')](_0xa427('0x12'),_0x273d0c,_0xa427('0x13'));_0x3c906d(_0x55799f['result']['message']);}})[_0xa427('0x1a')](function(_0x12e00e){logger[_0xa427('0x17')](_0xa427('0x12'),_0x273d0c,_0x12e00e);_0x51dba3(_0x12e00e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 779969b..e3f28f2 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 _0x8d19=['./cmList.events','save','update','emit','removeListener','length','cmList:'];(function(_0x33131e,_0x27c1ee){var _0x2bc457=function(_0x5c59fd){while(--_0x5c59fd){_0x33131e['push'](_0x33131e['shift']());}};_0x2bc457(++_0x27c1ee);}(_0x8d19,0x142));var _0x98d1=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8d19[_0x2b5eae];return _0x5f3ac9;};'use strict';var CmListEvents=require(_0x98d1('0x0'));var events=[_0x98d1('0x1'),'remove',_0x98d1('0x2')];function createListener(_0x3e5d36,_0x1ff67a){return function(_0x428e7e){_0x1ff67a[_0x98d1('0x3')](_0x3e5d36,_0x428e7e);};}function removeListener(_0xfcfe7b,_0x1f0517){return function(){CmListEvents[_0x98d1('0x4')](_0xfcfe7b,_0x1f0517);};}exports['register']=function(_0x5be1df){for(var _0x497392=0x0,_0x3acff4=events[_0x98d1('0x5')];_0x497392<_0x3acff4;_0x497392++){var _0x159547=events[_0x497392];var _0x462f5f=createListener(_0x98d1('0x6')+_0x159547,_0x5be1df);CmListEvents['on'](_0x159547,_0x462f5f);}}; \ No newline at end of file +var _0xa554=['cmList:','./cmList.events','save','remove','removeListener','length'];(function(_0x1f443c,_0x4a10fa){var _0x33a72f=function(_0x9bf066){while(--_0x9bf066){_0x1f443c['push'](_0x1f443c['shift']());}};_0x33a72f(++_0x4a10fa);}(_0xa554,0x1c9));var _0x4a55=function(_0x3dd472,_0x5c3153){_0x3dd472=_0x3dd472-0x0;var _0x469e99=_0xa554[_0x3dd472];return _0x469e99;};'use strict';var CmListEvents=require(_0x4a55('0x0'));var events=[_0x4a55('0x1'),_0x4a55('0x2'),'update'];function createListener(_0x582d4e,_0x479dc3){return function(_0x691df1){_0x479dc3['emit'](_0x582d4e,_0x691df1);};}function removeListener(_0x25704c,_0x438ca8){return function(){CmListEvents[_0x4a55('0x3')](_0x25704c,_0x438ca8);};}exports['register']=function(_0x18ffb4){for(var _0x30d1d8=0x0,_0x169033=events[_0x4a55('0x4')];_0x30d1d8<_0x169033;_0x30d1d8++){var _0x17782b=events[_0x30d1d8];var _0x1aac4a=createListener(_0x4a55('0x5')+_0x17782b,_0x18ffb4);CmListEvents['on'](_0x17782b,_0x1aac4a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a60fe40..d46c8cf 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 _0xf9f9=['update','destroy','delete','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put'];(function(_0xd1a41d,_0x11e22d){var _0x2d95a7=function(_0x4d1791){while(--_0x4d1791){_0xd1a41d['push'](_0xd1a41d['shift']());}};_0x2d95a7(++_0x11e22d);}(_0xf9f9,0x15b));var _0x9f9f=function(_0x2c5759,_0xe54d3c){_0x2c5759=_0x2c5759-0x0;var _0x314822=_0xf9f9[_0x2c5759];return _0x314822;};'use strict';var multer=require(_0x9f9f('0x0'));var util=require('util');var path=require(_0x9f9f('0x1'));var timeout=require(_0x9f9f('0x2'));var express=require(_0x9f9f('0x3'));var router=express['Router']();var fs_extra=require(_0x9f9f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f9f('0x5'));var config=require(_0x9f9f('0x6'));var controller=require(_0x9f9f('0x7'));router[_0x9f9f('0x8')]('/',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0xa')]);router['get'](_0x9f9f('0xb'),auth['isAuthenticated'](),controller[_0x9f9f('0xc')]);router[_0x9f9f('0x8')](_0x9f9f('0xd'),auth['isAuthenticated'](),controller[_0x9f9f('0xe')]);router[_0x9f9f('0x8')](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x10')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9f9f('0x11')]);router[_0x9f9f('0x8')](_0x9f9f('0x12'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x13')]);router[_0x9f9f('0x8')](_0x9f9f('0x14'),auth['isAuthenticated'](),controller[_0x9f9f('0x15')]);router['get']('/:id/fields',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x16')]);router[_0x9f9f('0x8')]('/:id/users',auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x17')]);router[_0x9f9f('0x18')]('/',auth[_0x9f9f('0x9')](),controller['create']);router['post'](_0x9f9f('0x19'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1a')]);router[_0x9f9f('0x18')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9f9f('0x1b')]);router[_0x9f9f('0x18')](_0x9f9f('0x1c'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1d')]);router['post'](_0x9f9f('0x1e'),auth[_0x9f9f('0x9')](),controller[_0x9f9f('0x1f')]);router[_0x9f9f('0x20')](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x21')]);router['delete'](_0x9f9f('0xf'),auth['isAuthenticated'](),controller[_0x9f9f('0x22')]);router[_0x9f9f('0x23')](_0x9f9f('0x19'),auth['isAuthenticated'](),controller[_0x9f9f('0x24')]);router[_0x9f9f('0x23')]('/:id/users',auth[_0x9f9f('0x9')](),controller['removeAgents']);module[_0x9f9f('0x25')]=router; \ No newline at end of file +var _0x436b=['../../config/environment','./cmList.controller','get','/describe','isAuthenticated','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users','addAgents','put','delete','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x346974,_0x58b2ae){var _0x3f21eb=function(_0x397817){while(--_0x397817){_0x346974['push'](_0x346974['shift']());}};_0x3f21eb(++_0x58b2ae);}(_0x436b,0x9a));var _0xb436=function(_0x13ee85,_0x3d2720){_0x13ee85=_0x13ee85-0x0;var _0x19a3db=_0x436b[_0x13ee85];return _0x19a3db;};'use strict';var multer=require('multer');var util=require(_0xb436('0x0'));var path=require(_0xb436('0x1'));var timeout=require(_0xb436('0x2'));var express=require(_0xb436('0x3'));var router=express['Router']();var fs_extra=require(_0xb436('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb436('0x5'));var config=require(_0xb436('0x6'));var controller=require(_0xb436('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb436('0x8')](_0xb436('0x9'),auth[_0xb436('0xa')](),controller['describe']);router[_0xb436('0x8')]('/global_fields',auth[_0xb436('0xa')](),controller[_0xb436('0xb')]);router[_0xb436('0x8')](_0xb436('0xc'),auth[_0xb436('0xa')](),controller['show']);router[_0xb436('0x8')](_0xb436('0xd'),auth[_0xb436('0xa')](),controller[_0xb436('0xe')]);router['get']('/:id/contacts',auth[_0xb436('0xa')](),controller[_0xb436('0xf')]);router[_0xb436('0x8')]('/:id/contacts/csv',auth[_0xb436('0xa')](),controller[_0xb436('0x10')]);router[_0xb436('0x8')](_0xb436('0x11'),auth['isAuthenticated'](),controller[_0xb436('0x12')]);router[_0xb436('0x8')]('/:id/users',auth[_0xb436('0xa')](),controller[_0xb436('0x13')]);router[_0xb436('0x14')]('/',auth[_0xb436('0xa')](),controller[_0xb436('0x15')]);router[_0xb436('0x14')](_0xb436('0xd'),auth[_0xb436('0xa')](),controller[_0xb436('0x16')]);router[_0xb436('0x14')](_0xb436('0x17'),auth['isAuthenticated'](),controller[_0xb436('0x18')]);router[_0xb436('0x14')]('/:id/fields',auth[_0xb436('0xa')](),controller[_0xb436('0x19')]);router['post'](_0xb436('0x1a'),auth[_0xb436('0xa')](),controller[_0xb436('0x1b')]);router[_0xb436('0x1c')](_0xb436('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb436('0x1d')](_0xb436('0xc'),auth[_0xb436('0xa')](),controller['destroy']);router[_0xb436('0x1d')](_0xb436('0xd'),auth[_0xb436('0xa')](),controller['removeDispositions']);router[_0xb436('0x1d')](_0xb436('0x1a'),auth[_0xb436('0xa')](),controller[_0xb436('0x1e')]);module[_0xb436('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index bdbe29e..1874e3d 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 _0xd760=['exports','getDataValue','field','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd760,0x1d0));var _0x0d76=function(_0x2e03a1,_0x10187c){_0x2e03a1=_0x2e03a1-0x0;var _0x5c667c=_0xd760[_0x2e03a1];return _0x5c667c;};'use strict';var Sequelize=require('sequelize');module[_0x0d76('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x488c40){return this[_0x0d76('0x1')](_0x0d76('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0d76('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x0d76('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xb857=['getDataValue','field','STRING','sequelize','exports'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0xb857,0x1d4));var _0x7b85=function(_0x486065,_0x3e73bf){_0x486065=_0x486065-0x0;var _0x2f9205=_0xb857[_0x486065];return _0x2f9205;};'use strict';var Sequelize=require(_0x7b85('0x0'));module[_0x7b85('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2afd88){return this[_0x7b85('0x2')](_0x7b85('0x3'));}},'field':{'type':Sequelize[_0x7b85('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7b85('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7b85('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 81ff783..06f9a2f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xfd1e7a,_0x5669bd){var _0x4b6085=function(_0x426919){while(--_0x426919){_0xfd1e7a['push'](_0xfd1e7a['shift']());}};_0x4b6085(++_0x5669bd);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x400787,_0x2d0b13){var _0x4d8737=function(_0x5e99c7){while(--_0x5e99c7){_0x400787['push'](_0x400787['shift']());}};_0x4d8737(++_0x2d0b13);}(_0x7a54,0x106));var _0x47a5=function(_0x16d8ac,_0x301160){_0x16d8ac=_0x16d8ac-0x0;var _0x1735e3=_0x7a54[_0x16d8ac];return _0x1735e3;};'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 cbb2d91..dc3e5f2 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 _0xf0e9=['exports','define','Condition','tools_conditions','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x3af7d4,_0x2f817b){var _0x4c8da4=function(_0x1b4c4f){while(--_0x1b4c4f){_0x3af7d4['push'](_0x3af7d4['shift']());}};_0x4c8da4(++_0x2f817b);}(_0xf0e9,0xcc));var _0x9f0e=function(_0x5b26f6,_0x556145){_0x5b26f6=_0x5b26f6-0x0;var _0x85411d=_0xf0e9[_0x5b26f6];return _0x85411d;};'use strict';var _=require(_0x9f0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f0e('0x1'));var moment=require('moment');var BPromise=require(_0x9f0e('0x2'));var rp=require(_0x9f0e('0x3'));var fs=require('fs');var path=require(_0x9f0e('0x4'));var rimraf=require(_0x9f0e('0x5'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x9f0e('0x6')]=function(_0x2f104d,_0x5a26f8){return _0x2f104d[_0x9f0e('0x7')](_0x9f0e('0x8'),attributes,{'tableName':_0x9f0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72f5=['api','moment','request-promise','path','./condition.attributes','exports','define','Condition','../../config/logger'];(function(_0x195546,_0x1a0479){var _0x1c6836=function(_0x214fe4){while(--_0x214fe4){_0x195546['push'](_0x195546['shift']());}};_0x1c6836(++_0x1a0479);}(_0x72f5,0x11f));var _0x572f=function(_0x4ea820,_0x1e03ed){_0x4ea820=_0x4ea820-0x0;var _0x402071=_0x72f5[_0x4ea820];return _0x402071;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x572f('0x0'))(_0x572f('0x1'));var moment=require(_0x572f('0x2'));var BPromise=require('bluebird');var rp=require(_0x572f('0x3'));var fs=require('fs');var path=require(_0x572f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x572f('0x5'));module[_0x572f('0x6')]=function(_0x1f70ff,_0x332074){return _0x1f70ff[_0x572f('0x7')](_0x572f('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index c8d6929..4601713 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 _0xeaa2=['rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xeaa2,0x160));var _0x2eaa=function(_0x2f202e,_0x5ed293){_0x2f202e=_0x2f202e-0x0;var _0x398ac6=_0xeaa2[_0x2f202e];return _0x398ac6;};'use strict';var _=require(_0x2eaa('0x0'));var util=require(_0x2eaa('0x1'));var moment=require('moment');var BPromise=require(_0x2eaa('0x2'));var rs=require(_0x2eaa('0x3'));var fs=require('fs');var Redis=require(_0x2eaa('0x4'));var db=require(_0x2eaa('0x5'))['db'];var utils=require(_0x2eaa('0x6'));var logger=require(_0x2eaa('0x7'))(_0x2eaa('0x8'));var config=require(_0x2eaa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2eaa('0xa')][_0x2eaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c1c61,_0x12bfae,_0x7cbc9){return new BPromise(function(_0x1580ce,_0x2e7e33){return client[_0x2eaa('0xc')](_0x1c1c61,_0x7cbc9)[_0x2eaa('0xd')](function(_0x23a4eb){logger['info'](_0x2eaa('0xe'),_0x12bfae,_0x2eaa('0xf'));logger[_0x2eaa('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x12bfae,_0x2eaa('0xf'),JSON[_0x2eaa('0x11')](_0x23a4eb));if(_0x23a4eb[_0x2eaa('0x12')]){if(_0x23a4eb['error'][_0x2eaa('0x13')]===0x1f4){logger['error'](_0x2eaa('0xe'),_0x12bfae,_0x23a4eb[_0x2eaa('0x12')][_0x2eaa('0x14')]);return _0x2e7e33(_0x23a4eb[_0x2eaa('0x12')]['message']);}logger[_0x2eaa('0x12')](_0x2eaa('0xe'),_0x12bfae,_0x23a4eb[_0x2eaa('0x12')][_0x2eaa('0x14')]);return _0x1580ce(_0x23a4eb[_0x2eaa('0x12')][_0x2eaa('0x14')]);}else{logger[_0x2eaa('0x15')](_0x2eaa('0xe'),_0x12bfae,_0x2eaa('0xf'));_0x1580ce(_0x23a4eb[_0x2eaa('0x16')][_0x2eaa('0x14')]);}})[_0x2eaa('0x17')](function(_0x3a604d){logger['error'](_0x2eaa('0xe'),_0x12bfae,_0x3a604d);_0x2e7e33(_0x3a604d);});});} \ No newline at end of file +var _0x629a=['client','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x629a,0x165));var _0xa629=function(_0x1e4fea,_0x1413c4){_0x1e4fea=_0x1e4fea-0x0;var _0xf29be6=_0x629a[_0x1e4fea];return _0xf29be6;};'use strict';var _=require(_0xa629('0x0'));var util=require(_0xa629('0x1'));var moment=require(_0xa629('0x2'));var BPromise=require(_0xa629('0x3'));var rs=require(_0xa629('0x4'));var fs=require('fs');var Redis=require(_0xa629('0x5'));var db=require(_0xa629('0x6'))['db'];var utils=require(_0xa629('0x7'));var logger=require(_0xa629('0x8'))(_0xa629('0x9'));var config=require('../../config/environment');var jayson=require(_0xa629('0xa'));var client=jayson[_0xa629('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2f7d,_0x1c04b2,_0x4e1230){return new BPromise(function(_0x42a28d,_0x59efe9){return client['request'](_0x2f2f7d,_0x4e1230)[_0xa629('0xc')](function(_0x447e0a){logger[_0xa629('0xd')](_0xa629('0xe'),_0x1c04b2,_0xa629('0xf'));logger[_0xa629('0x10')](_0xa629('0x11'),_0x1c04b2,_0xa629('0xf'),JSON[_0xa629('0x12')](_0x447e0a));if(_0x447e0a[_0xa629('0x13')]){if(_0x447e0a['error'][_0xa629('0x14')]===0x1f4){logger[_0xa629('0x13')](_0xa629('0xe'),_0x1c04b2,_0x447e0a[_0xa629('0x13')][_0xa629('0x15')]);return _0x59efe9(_0x447e0a[_0xa629('0x13')]['message']);}logger[_0xa629('0x13')]('Condition,\x20%s,\x20%s',_0x1c04b2,_0x447e0a[_0xa629('0x13')][_0xa629('0x15')]);return _0x42a28d(_0x447e0a['error']['message']);}else{logger[_0xa629('0xd')](_0xa629('0xe'),_0x1c04b2,_0xa629('0xf'));_0x42a28d(_0x447e0a[_0xa629('0x16')]['message']);}})['catch'](function(_0x42277d){logger[_0xa629('0x13')](_0xa629('0xe'),_0x1c04b2,_0x42277d);_0x59efe9(_0x42277d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 60d1a0a..8b1999e 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 _0xf717=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2eef02,_0x408f43){var _0xf0bbda=function(_0x47baa1){while(--_0x47baa1){_0x2eef02['push'](_0x2eef02['shift']());}};_0xf0bbda(++_0x408f43);}(_0xf717,0xb6));var _0x7f71=function(_0x5d5e39,_0x500a9e){_0x5d5e39=_0x5d5e39-0x0;var _0x45efe1=_0xf717[_0x5d5e39];return _0x45efe1;};'use strict';var multer=require(_0x7f71('0x0'));var util=require(_0x7f71('0x1'));var path=require(_0x7f71('0x2'));var timeout=require(_0x7f71('0x3'));var express=require(_0x7f71('0x4'));var router=express[_0x7f71('0x5')]();var fs_extra=require(_0x7f71('0x6'));var auth=require(_0x7f71('0x7'));var interaction=require(_0x7f71('0x8'));var config=require(_0x7f71('0x9'));var controller=require(_0x7f71('0xa'));router[_0x7f71('0xb')](_0x7f71('0xc'),auth[_0x7f71('0xd')](),controller['update']);router[_0x7f71('0xe')](_0x7f71('0xc'),auth[_0x7f71('0xd')](),controller[_0x7f71('0xf')]);module[_0x7f71('0x10')]=router; \ No newline at end of file +var _0x66e6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x66e6,0xbf));var _0x666e=function(_0x417905,_0x1d716a){_0x417905=_0x417905-0x0;var _0x5047c6=_0x66e6[_0x417905];return _0x5047c6;};'use strict';var multer=require('multer');var util=require(_0x666e('0x0'));var path=require(_0x666e('0x1'));var timeout=require(_0x666e('0x2'));var express=require('express');var router=express[_0x666e('0x3')]();var fs_extra=require(_0x666e('0x4'));var auth=require(_0x666e('0x5'));var interaction=require(_0x666e('0x6'));var config=require(_0x666e('0x7'));var controller=require(_0x666e('0x8'));router[_0x666e('0x9')](_0x666e('0xa'),auth['isAuthenticated'](),controller[_0x666e('0xb')]);router[_0x666e('0xc')](_0x666e('0xa'),auth['isAuthenticated'](),controller[_0x666e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 719e5a5..19720e3 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 _0x3d18=['STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d18,0x174));var _0x83d1=function(_0x4182c9,_0x4cb37e){_0x4182c9=_0x4182c9-0x0;var _0x36ed74=_0x3d18[_0x4182c9];return _0x36ed74;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x83d1('0x0')],'allowNull':![],'unique':_0x83d1('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x83d1('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xd408=['name','INTEGER','sequelize','exports','STRING'];(function(_0x35db01,_0x3daa6a){var _0x44a434=function(_0x3e2ced){while(--_0x3e2ced){_0x35db01['push'](_0x35db01['shift']());}};_0x44a434(++_0x3daa6a);}(_0xd408,0x1e7));var _0x8d40=function(_0x5523d5,_0x356cc6){_0x5523d5=_0x5523d5-0x0;var _0x49b4a2=_0xd408[_0x5523d5];return _0x49b4a2;};'use strict';var Sequelize=require(_0x8d40('0x0'));module[_0x8d40('0x1')]={'name':{'type':Sequelize[_0x8d40('0x2')],'allowNull':![],'unique':_0x8d40('0x3')},'OrderBy':{'type':Sequelize[_0x8d40('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4b92b64..f973148 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 _0x955f=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','user','catch'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x955f,0x1eb));var _0xf955=function(_0x1e1594,_0x5712aa){_0x1e1594=_0x1e1594-0x0;var _0x16ef8b=_0x955f[_0x1e1594];return _0x16ef8b;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x12'));var logger=require('../../config/logger')(_0xf955('0x13'));var utils=require(_0xf955('0x14'));var config=require(_0xf955('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x16'))['db'];function respondWithStatusCode(_0x542347,_0x23e0c6){_0x23e0c6=_0x23e0c6||0xcc;return function(_0x50d9a9){if(_0x50d9a9){return _0x542347[_0xf955('0x17')](_0x23e0c6);}return _0x542347[_0xf955('0x18')](_0x23e0c6)[_0xf955('0x19')]();};}function respondWithResult(_0x109bc5,_0x2080c4){_0x2080c4=_0x2080c4||0xc8;return function(_0x341b8c){if(_0x341b8c){return _0x109bc5[_0xf955('0x18')](_0x2080c4)[_0xf955('0x1a')](_0x341b8c);}};}function respondWithFilteredResult(_0x3c6af7,_0x24e75c){return function(_0x5350e4){if(_0x5350e4){var _0xc29b35=typeof _0x24e75c['offset']===_0xf955('0x1b')&&typeof _0x24e75c[_0xf955('0x1c')]===_0xf955('0x1b');var _0x15c07c=_0x5350e4['count'];var _0x5ac6cb=_0xc29b35?0x0:_0x24e75c[_0xf955('0x1d')];var _0xe6de5c=_0xc29b35?_0x5350e4[_0xf955('0x1e')]:_0x24e75c['offset']+_0x24e75c[_0xf955('0x1c')];var _0x3576fa;if(_0xe6de5c>=_0x15c07c){_0xe6de5c=_0x15c07c;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x3c6af7[_0xf955('0x18')](_0x3576fa);return _0x3c6af7[_0xf955('0x1f')](_0xf955('0x20'),_0x5ac6cb+'-'+_0xe6de5c+'/'+_0x15c07c)['json'](_0x5350e4);}return null;};}function patchUpdates(_0x17d86a){return function(_0x3dbbe8){try{jsonpatch[_0xf955('0x21')](_0x3dbbe8,_0x17d86a,!![]);}catch(_0x488d04){return BPromise[_0xf955('0x22')](_0x488d04);}return _0x3dbbe8['save']();};}function saveUpdates(_0x21ae24,_0x43b078){return function(_0x37143d){if(_0x37143d){return _0x37143d[_0xf955('0x23')](_0x21ae24)[_0xf955('0x24')](function(_0x565641){return _0x565641;});}return null;};}function removeEntity(_0x25f4f2,_0x5fab1c){return function(_0x3585c7){if(_0x3585c7){return _0x3585c7[_0xf955('0x25')]()[_0xf955('0x24')](function(){var _0x102e36=_0x3585c7[_0xf955('0x26')]({'plain':!![]});var _0x552cf3=_0xf955('0x27');return db[_0xf955('0x28')][_0xf955('0x25')]({'where':{'type':_0x552cf3,'resourceId':_0x102e36['id']}})[_0xf955('0x24')](function(){return _0x3585c7;});})[_0xf955('0x24')](function(){_0x25f4f2[_0xf955('0x18')](0xcc)[_0xf955('0x19')]();});}};}function handleEntityNotFound(_0x51f3ab,_0x3caea6){return function(_0x145098){if(!_0x145098){_0x51f3ab[_0xf955('0x17')](0x194);}return _0x145098;};}function handleError(_0xbd0b74,_0x28fa9c){_0x28fa9c=_0x28fa9c||0x1f4;return function(_0x264f6d){logger['error'](_0x264f6d[_0xf955('0x29')]);if(_0x264f6d[_0xf955('0x2a')]){delete _0x264f6d['name'];}_0xbd0b74[_0xf955('0x18')](_0x28fa9c)[_0xf955('0x2b')](_0x264f6d);};}exports[_0xf955('0x2c')]=function(_0x1ef794,_0x59bfb5){var _0x3a951c={},_0x518fb3={},_0x227104={'count':0x0,'rows':[]};var _0x2c222a=_[_0xf955('0x2d')](db[_0xf955('0x2e')][_0xf955('0x2f')],function(_0x32121b){return{'name':_0x32121b[_0xf955('0x30')],'type':_0x32121b[_0xf955('0x31')]['key']};});_0x518fb3[_0xf955('0x32')]=_[_0xf955('0x2d')](_0x2c222a,_0xf955('0x2a'));_0x518fb3[_0xf955('0x33')]=_['keys'](_0x1ef794[_0xf955('0x33')]);_0x518fb3[_0xf955('0x34')]=_[_0xf955('0x35')](_0x518fb3[_0xf955('0x32')],_0x518fb3[_0xf955('0x33')]);_0x3a951c['attributes']=_['intersection'](_0x518fb3['model'],qs[_0xf955('0x36')](_0x1ef794[_0xf955('0x33')][_0xf955('0x36')]));_0x3a951c[_0xf955('0x37')]=_0x3a951c[_0xf955('0x37')][_0xf955('0x38')]?_0x3a951c['attributes']:_0x518fb3[_0xf955('0x32')];if(!_0x1ef794['query'][_0xf955('0x39')](_0xf955('0x3a'))){_0x3a951c[_0xf955('0x1c')]=qs['limit'](_0x1ef794[_0xf955('0x33')]['limit']);_0x3a951c[_0xf955('0x1d')]=qs[_0xf955('0x1d')](_0x1ef794[_0xf955('0x33')][_0xf955('0x1d')]);}_0x3a951c['order']=qs[_0xf955('0x3b')](_0x1ef794[_0xf955('0x33')]['sort']);_0x3a951c[_0xf955('0x3c')]=qs[_0xf955('0x34')](_[_0xf955('0x3d')](_0x1ef794['query'],_0x518fb3[_0xf955('0x34')]),_0x2c222a);if(_0x1ef794[_0xf955('0x33')][_0xf955('0x3e')]){_0x3a951c['where']=_[_0xf955('0x3f')](_0x3a951c[_0xf955('0x3c')],{'$or':_[_0xf955('0x2d')](_0x2c222a,function(_0x2069f3){if(_0x2069f3[_0xf955('0x31')]!==_0xf955('0x40')){var _0x2b614d={};_0x2b614d[_0x2069f3[_0xf955('0x2a')]]={'$like':'%'+_0x1ef794['query'][_0xf955('0x3e')]+'%'};return _0x2b614d;}})});}_0x3a951c=_[_0xf955('0x3f')]({},_0x3a951c,_0x1ef794[_0xf955('0x41')]);var _0xe633fa={'where':_0x3a951c[_0xf955('0x3c')]};return db[_0xf955('0x2e')][_0xf955('0x1e')](_0xe633fa)[_0xf955('0x24')](function(_0x47651b){_0x227104[_0xf955('0x1e')]=_0x47651b;if(_0x1ef794[_0xf955('0x33')][_0xf955('0x42')]){_0x3a951c[_0xf955('0x43')]=[{'all':!![]}];}return db[_0xf955('0x2e')][_0xf955('0x44')](_0x3a951c);})[_0xf955('0x24')](function(_0x356ec2){_0x227104[_0xf955('0x45')]=_0x356ec2;return _0x227104;})[_0xf955('0x24')](respondWithFilteredResult(_0x59bfb5,_0x3a951c))['catch'](handleError(_0x59bfb5,null));};exports[_0xf955('0x46')]=function(_0x25d809,_0x2db18d){var _0x5f0ef9={'raw':!![],'where':{'id':_0x25d809['params']['id']}},_0x16fc1a={};_0x16fc1a[_0xf955('0x32')]=_['keys'](db[_0xf955('0x2e')][_0xf955('0x2f')]);_0x16fc1a[_0xf955('0x33')]=_[_0xf955('0x47')](_0x25d809['query']);_0x16fc1a[_0xf955('0x34')]=_[_0xf955('0x35')](_0x16fc1a[_0xf955('0x32')],_0x16fc1a['query']);_0x5f0ef9['attributes']=_[_0xf955('0x35')](_0x16fc1a[_0xf955('0x32')],qs[_0xf955('0x36')](_0x25d809[_0xf955('0x33')]['fields']));_0x5f0ef9[_0xf955('0x37')]=_0x5f0ef9[_0xf955('0x37')][_0xf955('0x38')]?_0x5f0ef9['attributes']:_0x16fc1a[_0xf955('0x32')];if(_0x25d809['query'][_0xf955('0x42')]){_0x5f0ef9[_0xf955('0x43')]=[{'all':!![]}];}_0x5f0ef9=_[_0xf955('0x3f')]({},_0x5f0ef9,_0x25d809['options']);return db[_0xf955('0x2e')][_0xf955('0x48')](_0x5f0ef9)[_0xf955('0x24')](handleEntityNotFound(_0x2db18d,null))[_0xf955('0x24')](respondWithResult(_0x2db18d,null))['catch'](handleError(_0x2db18d,null));};exports[_0xf955('0x49')]=function(_0x4ff0f1,_0x1c6d76){return db[_0xf955('0x2e')][_0xf955('0x49')](_0x4ff0f1['body'],{})[_0xf955('0x24')](function(_0x4e7269){var _0x35c23c=_0x4ff0f1['user'][_0xf955('0x26')]({'plain':!![]});if(!_0x35c23c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35c23c['role']===_0xf955('0x4a')){var _0x45c7fe=_0x4e7269['get']({'plain':!![]});var _0x142e8f='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x142e8f,'userProfileId':_0x35c23c['userProfileId']},'raw':!![]})[_0xf955('0x24')](function(_0x1abe1c){if(_0x1abe1c&&_0x1abe1c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf955('0x49')]({'name':_0x45c7fe[_0xf955('0x2a')],'resourceId':_0x45c7fe['id'],'type':_0x1abe1c[_0xf955('0x2a')],'sectionId':_0x1abe1c['id']},{})[_0xf955('0x24')](function(){return _0x4e7269;});}else{return _0x4e7269;}})[_0xf955('0x4b')](function(_0xa56483){logger[_0xf955('0x4c')](_0xf955('0x4d'),_0xa56483);throw _0xa56483;});}return _0x4e7269;})[_0xf955('0x24')](respondWithResult(_0x1c6d76,0xc9))[_0xf955('0x4b')](handleError(_0x1c6d76,null));};exports[_0xf955('0x23')]=function(_0x350873,_0x47a3a6){if(_0x350873[_0xf955('0x4e')]['id']){delete _0x350873[_0xf955('0x4e')]['id'];}return db[_0xf955('0x2e')][_0xf955('0x48')]({'where':{'id':_0x350873[_0xf955('0x4f')]['id']}})['then'](handleEntityNotFound(_0x47a3a6,null))[_0xf955('0x24')](saveUpdates(_0x350873[_0xf955('0x4e')],null))[_0xf955('0x24')](respondWithResult(_0x47a3a6,null))[_0xf955('0x4b')](handleError(_0x47a3a6,null));};exports[_0xf955('0x25')]=function(_0x9057df,_0x228d59){return db[_0xf955('0x2e')][_0xf955('0x48')]({'where':{'id':_0x9057df[_0xf955('0x4f')]['id']}})['then'](handleEntityNotFound(_0x228d59,null))[_0xf955('0x24')](db[_0xf955('0x50')][_0xf955('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x9057df[_0xf955('0x4f')]['id']}}))[_0xf955('0x24')](removeEntity(_0x228d59,null))[_0xf955('0x4b')](handleError(_0x228d59,null));}; \ No newline at end of file +var _0x5b12=['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','get','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','map','query','keys','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','intersection','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x5295a9,_0x2881d6){var _0x455975=function(_0x478fca){while(--_0x478fca){_0x5295a9['push'](_0x5295a9['shift']());}};_0x455975(++_0x2881d6);}(_0x5b12,0xa3));var _0x25b1=function(_0x51ada9,_0x4f5fef){_0x51ada9=_0x51ada9-0x0;var _0x537d85=_0x5b12[_0x51ada9];return _0x537d85;};'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(){var _0x3fa043=_0x246acd[_0x25b1('0x24')]({'plain':!![]});var _0xd22469=_0x25b1('0x25');return db[_0x25b1('0x26')][_0x25b1('0x23')]({'where':{'type':_0xd22469,'resourceId':_0x3fa043['id']}})['then'](function(){return _0x246acd;});})[_0x25b1('0x27')](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0x5bc8fc,_0x20a218){return function(_0x9e175f){if(!_0x9e175f){_0x5bc8fc[_0x25b1('0x19')](0x194);}return _0x9e175f;};}function handleError(_0x584357,_0x33baed){_0x33baed=_0x33baed||0x1f4;return function(_0x54ce2d){logger[_0x25b1('0x28')](_0x54ce2d[_0x25b1('0x29')]);if(_0x54ce2d[_0x25b1('0x2a')]){delete _0x54ce2d[_0x25b1('0x2a')];}_0x584357[_0x25b1('0x1a')](_0x33baed)[_0x25b1('0x2b')](_0x54ce2d);};}exports[_0x25b1('0x2c')]=function(_0x4cd825,_0x30d455){var _0xca56f0={},_0x925e99={},_0x26f323={'count':0x0,'rows':[]};var _0x274205=_['map'](db[_0x25b1('0x2d')][_0x25b1('0x2e')],function(_0x42441d){return{'name':_0x42441d[_0x25b1('0x2f')],'type':_0x42441d[_0x25b1('0x30')]['key']};});_0x925e99['model']=_[_0x25b1('0x31')](_0x274205,'name');_0x925e99[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x4cd825[_0x25b1('0x32')]);_0x925e99['filters']=_['intersection'](_0x925e99[_0x25b1('0x34')],_0x925e99[_0x25b1('0x32')]);_0xca56f0[_0x25b1('0x35')]=_['intersection'](_0x925e99[_0x25b1('0x34')],qs[_0x25b1('0x36')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x36')]));_0xca56f0['attributes']=_0xca56f0[_0x25b1('0x35')][_0x25b1('0x37')]?_0xca56f0[_0x25b1('0x35')]:_0x925e99['model'];if(!_0x4cd825['query'][_0x25b1('0x38')]('nolimit')){_0xca56f0[_0x25b1('0x39')]=qs[_0x25b1('0x39')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x39')]);_0xca56f0[_0x25b1('0x1e')]=qs[_0x25b1('0x1e')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x1e')]);}_0xca56f0[_0x25b1('0x3a')]=qs[_0x25b1('0x3b')](_0x4cd825[_0x25b1('0x32')][_0x25b1('0x3b')]);_0xca56f0[_0x25b1('0x3c')]=qs[_0x25b1('0x3d')](_[_0x25b1('0x3e')](_0x4cd825['query'],_0x925e99[_0x25b1('0x3d')]),_0x274205);if(_0x4cd825[_0x25b1('0x32')]['filter']){_0xca56f0[_0x25b1('0x3c')]=_[_0x25b1('0x3f')](_0xca56f0[_0x25b1('0x3c')],{'$or':_[_0x25b1('0x31')](_0x274205,function(_0xb82930){if(_0xb82930['type']!==_0x25b1('0x40')){var _0x5c729d={};_0x5c729d[_0xb82930[_0x25b1('0x2a')]]={'$like':'%'+_0x4cd825['query'][_0x25b1('0x41')]+'%'};return _0x5c729d;}})});}_0xca56f0=_[_0x25b1('0x3f')]({},_0xca56f0,_0x4cd825[_0x25b1('0x42')]);var _0x454eac={'where':_0xca56f0[_0x25b1('0x3c')]};return db[_0x25b1('0x2d')][_0x25b1('0x1d')](_0x454eac)[_0x25b1('0x27')](function(_0x3f9754){_0x26f323['count']=_0x3f9754;if(_0x4cd825[_0x25b1('0x32')]['includeAll']){_0xca56f0[_0x25b1('0x43')]=[{'all':!![]}];}return db[_0x25b1('0x2d')]['findAll'](_0xca56f0);})[_0x25b1('0x27')](function(_0x39b4c7){_0x26f323[_0x25b1('0x44')]=_0x39b4c7;return _0x26f323;})[_0x25b1('0x27')](respondWithFilteredResult(_0x30d455,_0xca56f0))[_0x25b1('0x45')](handleError(_0x30d455,null));};exports[_0x25b1('0x46')]=function(_0x122ce4,_0x30ee65){var _0x33e39c={'raw':!![],'where':{'id':_0x122ce4[_0x25b1('0x47')]['id']}},_0x453352={};_0x453352[_0x25b1('0x34')]=_[_0x25b1('0x33')](db[_0x25b1('0x2d')][_0x25b1('0x2e')]);_0x453352[_0x25b1('0x32')]=_[_0x25b1('0x33')](_0x122ce4[_0x25b1('0x32')]);_0x453352['filters']=_['intersection'](_0x453352['model'],_0x453352[_0x25b1('0x32')]);_0x33e39c['attributes']=_[_0x25b1('0x48')](_0x453352['model'],qs[_0x25b1('0x36')](_0x122ce4[_0x25b1('0x32')][_0x25b1('0x36')]));_0x33e39c[_0x25b1('0x35')]=_0x33e39c[_0x25b1('0x35')][_0x25b1('0x37')]?_0x33e39c['attributes']:_0x453352[_0x25b1('0x34')];if(_0x122ce4[_0x25b1('0x32')][_0x25b1('0x49')]){_0x33e39c[_0x25b1('0x43')]=[{'all':!![]}];}_0x33e39c=_['merge']({},_0x33e39c,_0x122ce4[_0x25b1('0x42')]);return db[_0x25b1('0x2d')][_0x25b1('0x4a')](_0x33e39c)['then'](handleEntityNotFound(_0x30ee65,null))[_0x25b1('0x27')](respondWithResult(_0x30ee65,null))['catch'](handleError(_0x30ee65,null));};exports[_0x25b1('0x4b')]=function(_0x4b6181,_0x543f9b){return db[_0x25b1('0x2d')][_0x25b1('0x4b')](_0x4b6181[_0x25b1('0x4c')],{})[_0x25b1('0x27')](function(_0x5de62e){var _0x2b38ca=_0x4b6181['user'][_0x25b1('0x24')]({'plain':!![]});if(!_0x2b38ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b38ca[_0x25b1('0x4d')]===_0x25b1('0x4e')){var _0x1fcc79=_0x5de62e['get']({'plain':!![]});var _0x1f3b01=_0x25b1('0x25');return db[_0x25b1('0x4f')][_0x25b1('0x4a')]({'where':{'name':_0x1f3b01,'userProfileId':_0x2b38ca[_0x25b1('0x50')]},'raw':!![]})[_0x25b1('0x27')](function(_0x59859e){if(_0x59859e&&_0x59859e[_0x25b1('0x51')]===0x0){return db[_0x25b1('0x26')][_0x25b1('0x4b')]({'name':_0x1fcc79[_0x25b1('0x2a')],'resourceId':_0x1fcc79['id'],'type':_0x59859e[_0x25b1('0x2a')],'sectionId':_0x59859e['id']},{})[_0x25b1('0x27')](function(){return _0x5de62e;});}else{return _0x5de62e;}})[_0x25b1('0x45')](function(_0x40d574){logger[_0x25b1('0x28')](_0x25b1('0x52'),_0x40d574);throw _0x40d574;});}return _0x5de62e;})[_0x25b1('0x27')](respondWithResult(_0x543f9b,0xc9))[_0x25b1('0x45')](handleError(_0x543f9b,null));};exports[_0x25b1('0x22')]=function(_0x2f17b2,_0x3191d7){if(_0x2f17b2[_0x25b1('0x4c')]['id']){delete _0x2f17b2[_0x25b1('0x4c')]['id'];}return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x2f17b2[_0x25b1('0x47')]['id']}})[_0x25b1('0x27')](handleEntityNotFound(_0x3191d7,null))[_0x25b1('0x27')](saveUpdates(_0x2f17b2[_0x25b1('0x4c')],null))[_0x25b1('0x27')](respondWithResult(_0x3191d7,null))[_0x25b1('0x45')](handleError(_0x3191d7,null));};exports['destroy']=function(_0x105587,_0x3af93d){return db[_0x25b1('0x2d')]['find']({'where':{'id':_0x105587[_0x25b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x3af93d,null))['then'](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x105587[_0x25b1('0x47')]['id']}}))['then'](removeEntity(_0x3af93d,null))[_0x25b1('0x45')](handleError(_0x3af93d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 83c4431..5b7313e 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 _0x1d48=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','define'];(function(_0x1c2d88,_0x969c07){var _0x5a2c9f=function(_0xe6420f){while(--_0xe6420f){_0x1c2d88['push'](_0x1c2d88['shift']());}};_0x5a2c9f(++_0x969c07);}(_0x1d48,0x129));var _0x81d4=function(_0x2683e7,_0x36cb22){_0x2683e7=_0x2683e7-0x0;var _0x397e26=_0x1d48[_0x2683e7];return _0x397e26;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81d4('0x0'))(_0x81d4('0x1'));var moment=require(_0x81d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x81d4('0x3'));var fs=require('fs');var path=require(_0x81d4('0x4'));var rimraf=require(_0x81d4('0x5'));var config=require(_0x81d4('0x6'));var attributes=require(_0x81d4('0x7'));module['exports']=function(_0x3ecb19,_0x52160a){return _0x3ecb19[_0x81d4('0x8')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15b2=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','../../config/logger','api'];(function(_0x11ddb3,_0x39a77c){var _0x2ef1dd=function(_0x2de237){while(--_0x2de237){_0x11ddb3['push'](_0x11ddb3['shift']());}};_0x2ef1dd(++_0x39a77c);}(_0x15b2,0x1c1));var _0x215b=function(_0x561467,_0x4e72f3){_0x561467=_0x561467-0x0;var _0x3ea7eb=_0x15b2[_0x561467];return _0x3ea7eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x215b('0x0'))(_0x215b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x215b('0x2'));var fs=require('fs');var path=require(_0x215b('0x3'));var rimraf=require(_0x215b('0x4'));var config=require(_0x215b('0x5'));var attributes=require(_0x215b('0x6'));module[_0x215b('0x7')]=function(_0x25a178,_0x39986c){return _0x25a178[_0x215b('0x8')](_0x215b('0x9'),attributes,{'tableName':_0x215b('0xa'),'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 ac1a6ee..b29cbf0 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 _0xce5b=['client','http','info','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5df584,_0x1279d3){var _0x283d94=function(_0x39aca9){while(--_0x39aca9){_0x5df584['push'](_0x5df584['shift']());}};_0x283d94(++_0x1279d3);}(_0xce5b,0x76));var _0xbce5=function(_0x3329bf,_0x121dc3){_0x3329bf=_0x3329bf-0x0;var _0x56d49c=_0xce5b[_0x3329bf];return _0x56d49c;};'use strict';var _=require(_0xbce5('0x0'));var util=require(_0xbce5('0x1'));var moment=require(_0xbce5('0x2'));var BPromise=require(_0xbce5('0x3'));var rs=require(_0xbce5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbce5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbce5('0x6'))(_0xbce5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbce5('0x8')][_0xbce5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45a360,_0x2e2d25,_0xbf3f37){return new BPromise(function(_0x48dabf,_0x529566){return client['request'](_0x45a360,_0xbf3f37)['then'](function(_0x2721bb){logger[_0xbce5('0xa')](_0xbce5('0xb'),_0x2e2d25,'request\x20sent');logger[_0xbce5('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2e2d25,_0xbce5('0xd'),JSON['stringify'](_0x2721bb));if(_0x2721bb[_0xbce5('0xe')]){if(_0x2721bb[_0xbce5('0xe')][_0xbce5('0xf')]===0x1f4){logger[_0xbce5('0xe')](_0xbce5('0xb'),_0x2e2d25,_0x2721bb[_0xbce5('0xe')][_0xbce5('0x10')]);return _0x529566(_0x2721bb['error']['message']);}logger[_0xbce5('0xe')](_0xbce5('0xb'),_0x2e2d25,_0x2721bb[_0xbce5('0xe')]['message']);return _0x48dabf(_0x2721bb[_0xbce5('0xe')][_0xbce5('0x10')]);}else{logger[_0xbce5('0xa')]('ContactItemType,\x20%s,\x20%s',_0x2e2d25,_0xbce5('0xd'));_0x48dabf(_0x2721bb[_0xbce5('0x11')][_0xbce5('0x10')]);}})['catch'](function(_0x5e0236){logger['error'](_0xbce5('0xb'),_0x2e2d25,_0x5e0236);_0x529566(_0x5e0236);});});} \ No newline at end of file +var _0xb804=['http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0xb804,0x107));var _0x4b80=function(_0xa83791,_0x30f4bb){_0xa83791=_0xa83791-0x0;var _0x307272=_0xb804[_0xa83791];return _0x307272;};'use strict';var _=require(_0x4b80('0x0'));var util=require(_0x4b80('0x1'));var moment=require(_0x4b80('0x2'));var BPromise=require(_0x4b80('0x3'));var rs=require(_0x4b80('0x4'));var fs=require('fs');var Redis=require(_0x4b80('0x5'));var db=require(_0x4b80('0x6'))['db'];var utils=require(_0x4b80('0x7'));var logger=require(_0x4b80('0x8'))(_0x4b80('0x9'));var config=require(_0x4b80('0xa'));var jayson=require(_0x4b80('0xb'));var client=jayson['client'][_0x4b80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ff897,_0x177d96,_0x51c4fa){return new BPromise(function(_0x3fffd5,_0x5621ba){return client[_0x4b80('0xd')](_0x5ff897,_0x51c4fa)[_0x4b80('0xe')](function(_0x1c6862){logger[_0x4b80('0xf')](_0x4b80('0x10'),_0x177d96,_0x4b80('0x11'));logger[_0x4b80('0x12')](_0x4b80('0x13'),_0x177d96,'request\x20sent',JSON[_0x4b80('0x14')](_0x1c6862));if(_0x1c6862[_0x4b80('0x15')]){if(_0x1c6862['error']['code']===0x1f4){logger['error'](_0x4b80('0x10'),_0x177d96,_0x1c6862[_0x4b80('0x15')][_0x4b80('0x16')]);return _0x5621ba(_0x1c6862[_0x4b80('0x15')][_0x4b80('0x16')]);}logger[_0x4b80('0x15')](_0x4b80('0x10'),_0x177d96,_0x1c6862['error'][_0x4b80('0x16')]);return _0x3fffd5(_0x1c6862['error'][_0x4b80('0x16')]);}else{logger[_0x4b80('0xf')](_0x4b80('0x10'),_0x177d96,'request\x20sent');_0x3fffd5(_0x1c6862[_0x4b80('0x17')][_0x4b80('0x16')]);}})[_0x4b80('0x18')](function(_0x356679){logger['error'](_0x4b80('0x10'),_0x177d96,_0x356679);_0x5621ba(_0x356679);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fd67bd3..63b4813 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 _0x9219=['/:id','update','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated','create','put'];(function(_0x460498,_0x376c49){var _0x2730c3=function(_0x4a9a90){while(--_0x4a9a90){_0x460498['push'](_0x460498['shift']());}};_0x2730c3(++_0x376c49);}(_0x9219,0x73));var _0x9921=function(_0x126cfc,_0x528b1c){_0x126cfc=_0x126cfc-0x0;var _0x43c787=_0x9219[_0x126cfc];return _0x43c787;};'use strict';var multer=require(_0x9921('0x0'));var util=require(_0x9921('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9921('0x2'));var router=express[_0x9921('0x3')]();var fs_extra=require(_0x9921('0x4'));var auth=require(_0x9921('0x5'));var interaction=require(_0x9921('0x6'));var config=require('../../config/environment');var controller=require(_0x9921('0x7'));router['get']('/',auth[_0x9921('0x8')](),controller['index']);router['get']('/:id',auth[_0x9921('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9921('0x9')]);router[_0x9921('0xa')](_0x9921('0xb'),auth[_0x9921('0x8')](),controller[_0x9921('0xc')]);router['delete'](_0x9921('0xb'),auth[_0x9921('0x8')](),controller[_0x9921('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6389=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x33707a,_0xae45af){var _0x342010=function(_0x198f9a){while(--_0x198f9a){_0x33707a['push'](_0x33707a['shift']());}};_0x342010(++_0xae45af);}(_0x6389,0x7d));var _0x9638=function(_0x5ca5ef,_0x5bf617){_0x5ca5ef=_0x5ca5ef-0x0;var _0x33c41d=_0x6389[_0x5ca5ef];return _0x33c41d;};'use strict';var multer=require(_0x9638('0x0'));var util=require(_0x9638('0x1'));var path=require('path');var timeout=require(_0x9638('0x2'));var express=require(_0x9638('0x3'));var router=express[_0x9638('0x4')]();var fs_extra=require(_0x9638('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9638('0x6'));var config=require(_0x9638('0x7'));var controller=require('./contactItemType.controller');router[_0x9638('0x8')]('/',auth[_0x9638('0x9')](),controller[_0x9638('0xa')]);router[_0x9638('0x8')](_0x9638('0xb'),auth[_0x9638('0x9')](),controller['show']);router[_0x9638('0xc')]('/',auth[_0x9638('0x9')](),controller['create']);router[_0x9638('0xd')](_0x9638('0xb'),auth['isAuthenticated'](),controller[_0x9638('0xe')]);router[_0x9638('0xf')](_0x9638('0xb'),auth['isAuthenticated'](),controller[_0x9638('0x10')]);module[_0x9638('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 62d0744..f888af6 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x526ee4,_0x4cad06){var _0x5c5d52=function(_0x2ee422){while(--_0x2ee422){_0x526ee4['push'](_0x526ee4['shift']());}};_0x5c5d52(++_0x4cad06);}(_0x2032,0xd9));var _0x2203=function(_0x3cbe09,_0x17164f){_0x3cbe09=_0x3cbe09-0x0;var _0x14245e=_0x2032[_0x3cbe09];return _0x14245e;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0effdde..0a413a0 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 _0x1152=['attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','pick','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','json','offset','undefined','count','limit','set','apply','then','destroy','CustomDashboards','UserProfileResource','end','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','options','get','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport'];(function(_0x3af770,_0x1a957a){var _0x42c9a9=function(_0x2afac3){while(--_0x2afac3){_0x3af770['push'](_0x3af770['shift']());}};_0x42c9a9(++_0x1a957a);}(_0x1152,0x10b));var _0x2115=function(_0x329808,_0x343255){_0x329808=_0x329808-0x0;var _0x1bbad0=_0x1152[_0x329808];return _0x1bbad0;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2115('0x1'));var rp=require(_0x2115('0x2'));var moment=require(_0x2115('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2115('0x4'));var util=require(_0x2115('0x5'));var path=require('path');var sox=require(_0x2115('0x6'));var csv=require(_0x2115('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2115('0x8'));var squel=require(_0x2115('0x9'));var crypto=require(_0x2115('0xa'));var jsforce=require(_0x2115('0xb'));var deskjs=require(_0x2115('0xc'));var toCsv=require(_0x2115('0x7'));var querystring=require(_0x2115('0xd'));var Papa=require(_0x2115('0xe'));var Redis=require(_0x2115('0xf'));var authService=require(_0x2115('0x10'));var qs=require(_0x2115('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2115('0x12'));var logger=require('../../config/logger')(_0x2115('0x13'));var utils=require(_0x2115('0x14'));var config=require(_0x2115('0x15'));var licenseUtil=require(_0x2115('0x16'));var db=require('../../mysqldb')['db'];config[_0x2115('0x17')]=_[_0x2115('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2115('0x19'))(new Redis(config[_0x2115('0x17')]));require(_0x2115('0x1a'))['register'](socket);function respondWithStatusCode(_0x1130fc,_0x54e81e){_0x54e81e=_0x54e81e||0xcc;return function(_0x1230e8){if(_0x1230e8){return _0x1130fc[_0x2115('0x1b')](_0x54e81e);}return _0x1130fc['status'](_0x54e81e)['end']();};}function respondWithResult(_0x226c09,_0x167c26){_0x167c26=_0x167c26||0xc8;return function(_0x2be9d6){if(_0x2be9d6){return _0x226c09[_0x2115('0x1c')](_0x167c26)[_0x2115('0x1d')](_0x2be9d6);}};}function respondWithFilteredResult(_0x5337b5,_0x5d777b){return function(_0x58b3f6){if(_0x58b3f6){var _0x3200a0=typeof _0x5d777b[_0x2115('0x1e')]===_0x2115('0x1f')&&typeof _0x5d777b['limit']==='undefined';var _0x10d0cf=_0x58b3f6[_0x2115('0x20')];var _0x3f9ef0=_0x3200a0?0x0:_0x5d777b[_0x2115('0x1e')];var _0x495010=_0x3200a0?_0x58b3f6['count']:_0x5d777b[_0x2115('0x1e')]+_0x5d777b[_0x2115('0x21')];var _0x23e612;if(_0x495010>=_0x10d0cf){_0x495010=_0x10d0cf;_0x23e612=0xc8;}else{_0x23e612=0xce;}_0x5337b5[_0x2115('0x1c')](_0x23e612);return _0x5337b5[_0x2115('0x22')]('Content-Range',_0x3f9ef0+'-'+_0x495010+'/'+_0x10d0cf)[_0x2115('0x1d')](_0x58b3f6);}return null;};}function patchUpdates(_0x31524a){return function(_0x3f9b4e){try{jsonpatch[_0x2115('0x23')](_0x3f9b4e,_0x31524a,!![]);}catch(_0x5eccf8){return BPromise['reject'](_0x5eccf8);}return _0x3f9b4e['save']();};}function saveUpdates(_0x588490,_0x39e937){return function(_0x36aea8){if(_0x36aea8){return _0x36aea8['update'](_0x588490)[_0x2115('0x24')](function(_0x20e805){return _0x20e805;});}return null;};}function removeEntity(_0x1489a7,_0x27d496){return function(_0x2fd815){if(_0x2fd815){return _0x2fd815[_0x2115('0x25')]()['then'](function(){var _0x2ef6eb=_0x2fd815['get']({'plain':!![]});var _0x58844b=_0x2115('0x26');return db[_0x2115('0x27')]['destroy']({'where':{'type':_0x58844b,'resourceId':_0x2ef6eb['id']}})['then'](function(){return _0x2fd815;});})['then'](function(){_0x1489a7['status'](0xcc)[_0x2115('0x28')]();});}};}function handleEntityNotFound(_0x235acb,_0xe8623e){return function(_0x4d48d9){if(!_0x4d48d9){_0x235acb[_0x2115('0x1b')](0x194);}return _0x4d48d9;};}function handleError(_0x34dbbe,_0x4e2b46){_0x4e2b46=_0x4e2b46||0x1f4;return function(_0x41d8b0){logger['error'](_0x41d8b0[_0x2115('0x29')]);if(_0x41d8b0[_0x2115('0x2a')]){delete _0x41d8b0['name'];}_0x34dbbe[_0x2115('0x1c')](_0x4e2b46)[_0x2115('0x2b')](_0x41d8b0);};}exports[_0x2115('0x2c')]=function(_0x4c9a4e,_0xb82d54){var _0x1e31a5={},_0x1d69af={},_0x5c67a8={'count':0x0,'rows':[]};var _0x402cfd=_[_0x2115('0x2d')](db[_0x2115('0x2e')][_0x2115('0x2f')],function(_0x1b32e3){return{'name':_0x1b32e3[_0x2115('0x30')],'type':_0x1b32e3[_0x2115('0x31')][_0x2115('0x32')]};});_0x1d69af[_0x2115('0x33')]=_[_0x2115('0x2d')](_0x402cfd,_0x2115('0x2a'));_0x1d69af[_0x2115('0x34')]=_[_0x2115('0x35')](_0x4c9a4e[_0x2115('0x34')]);_0x1d69af[_0x2115('0x36')]=_[_0x2115('0x37')](_0x1d69af[_0x2115('0x33')],_0x1d69af[_0x2115('0x34')]);_0x1e31a5[_0x2115('0x38')]=_[_0x2115('0x37')](_0x1d69af[_0x2115('0x33')],qs[_0x2115('0x39')](_0x4c9a4e[_0x2115('0x34')]['fields']));_0x1e31a5['attributes']=_0x1e31a5[_0x2115('0x38')][_0x2115('0x3a')]?_0x1e31a5[_0x2115('0x38')]:_0x1d69af[_0x2115('0x33')];if(!_0x4c9a4e[_0x2115('0x34')]['hasOwnProperty']('nolimit')){_0x1e31a5['limit']=qs[_0x2115('0x21')](_0x4c9a4e[_0x2115('0x34')][_0x2115('0x21')]);_0x1e31a5['offset']=qs['offset'](_0x4c9a4e[_0x2115('0x34')][_0x2115('0x1e')]);}_0x1e31a5['order']=qs[_0x2115('0x3b')](_0x4c9a4e[_0x2115('0x34')][_0x2115('0x3b')]);_0x1e31a5[_0x2115('0x3c')]=qs['filters'](_['pick'](_0x4c9a4e[_0x2115('0x34')],_0x1d69af['filters']),_0x402cfd);if(_0x4c9a4e['query'][_0x2115('0x3d')]){_0x1e31a5['where']=_[_0x2115('0x3e')](_0x1e31a5['where'],{'$or':_[_0x2115('0x2d')](_0x402cfd,function(_0x211c43){if(_0x211c43[_0x2115('0x31')]!==_0x2115('0x3f')){var _0x52f49d={};_0x52f49d[_0x211c43['name']]={'$like':'%'+_0x4c9a4e[_0x2115('0x34')][_0x2115('0x3d')]+'%'};return _0x52f49d;}})});}_0x1e31a5=_[_0x2115('0x3e')]({},_0x1e31a5,_0x4c9a4e['options']);var _0x432650={'where':_0x1e31a5[_0x2115('0x3c')]};return db[_0x2115('0x2e')]['count'](_0x432650)['then'](function(_0x426d84){_0x5c67a8['count']=_0x426d84;if(_0x4c9a4e[_0x2115('0x34')][_0x2115('0x40')]){_0x1e31a5['include']=[{'all':!![]}];}return db[_0x2115('0x2e')][_0x2115('0x41')](_0x1e31a5);})[_0x2115('0x24')](function(_0x345192){_0x5c67a8[_0x2115('0x42')]=_0x345192;return _0x5c67a8;})[_0x2115('0x24')](respondWithFilteredResult(_0xb82d54,_0x1e31a5))[_0x2115('0x43')](handleError(_0xb82d54,null));};exports['show']=function(_0x1ec937,_0x90d803){var _0x529a71={'raw':![],'where':{'id':_0x1ec937[_0x2115('0x44')]['id']}},_0x241ce5={};_0x241ce5[_0x2115('0x33')]=_[_0x2115('0x35')](db[_0x2115('0x2e')][_0x2115('0x2f')]);_0x241ce5[_0x2115('0x34')]=_[_0x2115('0x35')](_0x1ec937[_0x2115('0x34')]);_0x241ce5[_0x2115('0x36')]=_[_0x2115('0x37')](_0x241ce5['model'],_0x241ce5[_0x2115('0x34')]);_0x529a71[_0x2115('0x38')]=_['intersection'](_0x241ce5['model'],qs[_0x2115('0x39')](_0x1ec937['query'][_0x2115('0x39')]));_0x529a71[_0x2115('0x38')]=_0x529a71[_0x2115('0x38')][_0x2115('0x3a')]?_0x529a71['attributes']:_0x241ce5[_0x2115('0x33')];if(_0x1ec937['query'][_0x2115('0x40')]){_0x529a71[_0x2115('0x45')]=[{'all':!![]}];}_0x529a71=_[_0x2115('0x3e')]({},_0x529a71,_0x1ec937['options']);return db[_0x2115('0x2e')][_0x2115('0x46')](_0x529a71)['then'](handleEntityNotFound(_0x90d803,null))['then'](respondWithResult(_0x90d803,null))[_0x2115('0x43')](handleError(_0x90d803,null));};exports[_0x2115('0x47')]=function(_0x377dfd,_0x1578ca){return db['Dashboard'][_0x2115('0x47')](_0x377dfd[_0x2115('0x48')],{})[_0x2115('0x24')](function(_0x4265de){var _0x42bcc1=_0x377dfd['user']['get']({'plain':!![]});if(!_0x42bcc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42bcc1[_0x2115('0x49')]===_0x2115('0x4a')){var _0x595bce=_0x4265de['get']({'plain':!![]});var _0x1c6f36=_0x2115('0x26');return db[_0x2115('0x4b')][_0x2115('0x46')]({'where':{'name':_0x1c6f36,'userProfileId':_0x42bcc1['userProfileId']},'raw':!![]})['then'](function(_0x3a2baa){if(_0x3a2baa&&_0x3a2baa[_0x2115('0x4c')]===0x0){return db[_0x2115('0x27')][_0x2115('0x47')]({'name':_0x595bce['name'],'resourceId':_0x595bce['id'],'type':_0x3a2baa[_0x2115('0x2a')],'sectionId':_0x3a2baa['id']},{})[_0x2115('0x24')](function(){return _0x4265de;});}else{return _0x4265de;}})[_0x2115('0x43')](function(_0x1b31bf){logger[_0x2115('0x4d')](_0x2115('0x4e'),_0x1b31bf);throw _0x1b31bf;});}return _0x4265de;})[_0x2115('0x24')](respondWithResult(_0x1578ca,0xc9))[_0x2115('0x43')](handleError(_0x1578ca,null));};exports['clone']=function(_0x4ce468,_0x27717f){var _0x19b98d={'where':{'id':_0x4ce468['params']['id']}},_0x3e6f25={};_0x3e6f25[_0x2115('0x33')]=_[_0x2115('0x35')](db[_0x2115('0x2e')][_0x2115('0x2f')]);_0x19b98d[_0x2115('0x38')]=_[_0x2115('0x37')](_0x3e6f25[_0x2115('0x33')],qs[_0x2115('0x39')](_0x4ce468[_0x2115('0x34')]['fields']));_0x19b98d[_0x2115('0x38')]=_0x19b98d[_0x2115('0x38')][_0x2115('0x3a')]?_0x19b98d[_0x2115('0x38')]:_0x3e6f25[_0x2115('0x33')];if(_0x4ce468[_0x2115('0x34')][_0x2115('0x40')]){_0x19b98d[_0x2115('0x45')]=[{'all':!![]}];}_0x19b98d=_[_0x2115('0x3e')]({},_0x19b98d,_0x4ce468[_0x2115('0x4f')]);return db['Dashboard'][_0x2115('0x46')](_0x19b98d)[_0x2115('0x24')](handleEntityNotFound(_0x27717f,null))[_0x2115('0x24')](function(_0x4e39b9){if(_0x4e39b9){var _0x35e218=_0x4e39b9[_0x2115('0x50')]({'plain':!![]});_0x35e218=qs[_0x2115('0x51')](_0x35e218,['id',_0x2115('0x52'),_0x2115('0x53')]);_0x4ce468[_0x2115('0x48')]=_[_0x2115('0x51')](_0x4ce468['body'],['id',_0x2115('0x52'),'updatedAt']);return db['Dashboard'][_0x2115('0x47')](_[_0x2115('0x3e')](_0x35e218,_0x4ce468['body']),{'include':_0x4ce468[_0x2115('0x34')][_0x2115('0x40')]?[{'all':!![]}]:undefined})[_0x2115('0x24')](function(_0x283820){var _0x416a94=_0x4ce468[_0x2115('0x4a')][_0x2115('0x50')]({'plain':!![]});if(!_0x416a94)throw new Error(_0x2115('0x54'));if(_0x416a94['role']==='user'){var _0x4297da=_0x283820['get']({'plain':!![]});var _0x495340=_0x2115('0x26');return db[_0x2115('0x4b')][_0x2115('0x46')]({'where':{'name':_0x495340,'userProfileId':_0x416a94[_0x2115('0x55')]},'raw':!![]})[_0x2115('0x24')](function(_0x3636b5){if(_0x3636b5&&_0x3636b5['autoAssociation']===0x0){return db[_0x2115('0x27')][_0x2115('0x47')]({'name':_0x4297da[_0x2115('0x2a')],'resourceId':_0x4297da['id'],'type':_0x3636b5['name'],'sectionId':_0x3636b5['id']},{})[_0x2115('0x24')](function(){return _0x283820;});}else{return _0x283820;}})[_0x2115('0x43')](function(_0x40df86){logger[_0x2115('0x4d')](_0x2115('0x4e'),_0x40df86);throw _0x40df86;});}return _0x283820;});}})['then'](respondWithResult(_0x27717f,0xc9))[_0x2115('0x43')](handleError(_0x27717f,null));};exports[_0x2115('0x56')]=function(_0x128c69,_0x2dfdcc){if(_0x128c69['body']['id']){delete _0x128c69[_0x2115('0x48')]['id'];}return db['Dashboard'][_0x2115('0x46')]({'where':{'id':_0x128c69['params']['id']}})[_0x2115('0x24')](handleEntityNotFound(_0x2dfdcc,null))[_0x2115('0x24')](saveUpdates(_0x128c69[_0x2115('0x48')],null))[_0x2115('0x24')](respondWithResult(_0x2dfdcc,null))[_0x2115('0x43')](handleError(_0x2dfdcc,null));};exports[_0x2115('0x25')]=function(_0x20844c,_0x28e4d5){return db[_0x2115('0x2e')][_0x2115('0x46')]({'where':{'id':_0x20844c['params']['id']}})[_0x2115('0x24')](handleEntityNotFound(_0x28e4d5,null))['then'](removeEntity(_0x28e4d5,null))[_0x2115('0x43')](handleError(_0x28e4d5,null));};function widgetAttributes(_0x2ded58){try{switch(_0x2ded58[_0x2115('0x31')]){case _0x2115('0x57'):return[{'name':_0x2115('0x58'),'value':_0x2ded58[_0x2115('0x58')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0]['value']:undefined)||_0x2115('0x5a')}];case _0x2115('0x5b'):return[{'name':'attrPath','value':_0x2ded58[_0x2115('0x5c')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0][_0x2115('0x5d')]:undefined)||''}];case _0x2115('0x5e'):return[{'name':_0x2115('0x5f'),'value':_0x2ded58[_0x2115('0x5f')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2ded58[_0x2115('0x60')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x1]?_0x2ded58['attrs'][0x1][_0x2115('0x5d')]:undefined)||_0x2115('0x61')},{'name':_0x2115('0x62'),'value':_0x2ded58['attrFontSize']||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x2]?_0x2ded58[_0x2115('0x59')][0x2][_0x2115('0x5d')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x2ded58[_0x2115('0x63')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0][_0x2115('0x5d')]:undefined)||_0x2115('0x64')},{'name':'attrVoiceQueues','value':_0x2ded58[_0x2115('0x65')]||(_0x2ded58['attrs']&&_0x2ded58['attrs'][0x1]?_0x2ded58[_0x2115('0x59')][0x1][_0x2115('0x5d')]:undefined)||[]},{'name':_0x2115('0x62'),'value':_0x2ded58[_0x2115('0x62')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x2]?_0x2ded58[_0x2115('0x59')][0x2][_0x2115('0x5d')]:undefined)||0x14},{'name':_0x2115('0x66'),'value':_0x2ded58[_0x2115('0x66')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x3]?_0x2ded58[_0x2115('0x59')][0x3][_0x2115('0x5d')]:undefined)||'voice'},{'name':_0x2115('0x67'),'value':_0x2ded58['attrEmailAccounts']||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x4]?_0x2ded58[_0x2115('0x59')][0x4][_0x2115('0x5d')]:undefined)||''},{'name':_0x2115('0x68'),'value':_0x2ded58[_0x2115('0x68')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x5]?_0x2ded58[_0x2115('0x59')][0x5][_0x2115('0x5d')]:undefined)||''},{'name':_0x2115('0x69'),'value':_0x2ded58['attrSmsAccounts']||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x6]?_0x2ded58[_0x2115('0x59')][0x6][_0x2115('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2ded58['attrOpenchannelAccounts']||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x7]?_0x2ded58['attrs'][0x7]['value']:undefined)||''},{'name':_0x2115('0x6a'),'value':_0x2ded58[_0x2115('0x6a')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x8]?_0x2ded58[_0x2115('0x59')][0x8][_0x2115('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2ded58[_0x2115('0x6b')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x9]?_0x2ded58[_0x2115('0x59')][0x9][_0x2115('0x5d')]:undefined)||''}];case _0x2115('0x6c'):case _0x2115('0x6d'):return[{'name':_0x2115('0x6e'),'value':_0x2ded58[_0x2115('0x6e')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58['attrs'][0x0][_0x2115('0x5d')]:undefined)||'total'},{'name':_0x2115('0x6f'),'value':_0x2ded58[_0x2115('0x6f')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x1]?_0x2ded58['attrs'][0x1][_0x2115('0x5d')]:undefined)||null},{'name':_0x2115('0x70'),'value':_0x2ded58[_0x2115('0x70')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x2]?_0x2ded58[_0x2115('0x59')][0x2][_0x2115('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2ded58['attrVoiceQueues']||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x3]?_0x2ded58[_0x2115('0x59')][0x3][_0x2115('0x5d')]:undefined)||[]},{'name':_0x2115('0x66'),'value':_0x2ded58[_0x2115('0x66')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x4]?_0x2ded58[_0x2115('0x59')][0x4][_0x2115('0x5d')]:undefined)||'voice'},{'name':_0x2115('0x67'),'value':_0x2ded58[_0x2115('0x67')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x5]?_0x2ded58[_0x2115('0x59')][0x5][_0x2115('0x5d')]:undefined)||''},{'name':_0x2115('0x68'),'value':_0x2ded58[_0x2115('0x68')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x6]?_0x2ded58[_0x2115('0x59')][0x6][_0x2115('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2ded58[_0x2115('0x69')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x7]?_0x2ded58[_0x2115('0x59')][0x7][_0x2115('0x5d')]:undefined)||''},{'name':_0x2115('0x71'),'value':_0x2ded58[_0x2115('0x71')]||(_0x2ded58['attrs']&&_0x2ded58[_0x2115('0x59')][0x8]?_0x2ded58[_0x2115('0x59')][0x8][_0x2115('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ded58['attrWhatsappAccounts']||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x9]?_0x2ded58[_0x2115('0x59')][0x9][_0x2115('0x5d')]:undefined)||''},{'name':_0x2115('0x6b'),'value':_0x2ded58[_0x2115('0x6b')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0xa]?_0x2ded58['attrs'][0xa][_0x2115('0x5d')]:undefined)||''}];case _0x2115('0x72'):return[{'name':'attrReport','type':_0x2ded58[_0x2115('0x73')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0][_0x2115('0x31')]:undefined)||null,'value':_0x2ded58[_0x2115('0x74')]||(_0x2ded58[_0x2115('0x59')]&&_0x2ded58[_0x2115('0x59')][0x0]?_0x2ded58[_0x2115('0x59')][0x0]['value']:undefined)||null},{'name':_0x2115('0x75'),'value':_0x2ded58[_0x2115('0x75')]||(_0x2ded58['attrs']&&_0x2ded58['attrs'][0x1]?_0x2ded58[_0x2115('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3745e0){logger[_0x2115('0x4d')](_0x2115('0x76'),JSON[_0x2115('0x77')](_0x3745e0));return[];}}exports[_0x2115('0x78')]=function(_0x36b753,_0x4fde2b,_0x6bb848){if(_0x36b753[_0x2115('0x48')]['id']){delete _0x36b753[_0x2115('0x48')]['id'];}return db[_0x2115('0x2e')][_0x2115('0x46')]({'where':{'id':_0x36b753[_0x2115('0x44')]['id']}})[_0x2115('0x24')](handleEntityNotFound(_0x4fde2b,null))[_0x2115('0x24')](function(_0x36fe27){if(_0x36fe27){_0x36b753[_0x2115('0x48')][_0x2115('0x79')]=_0x36fe27['id'];_0x36b753[_0x2115('0x48')][_0x2115('0x59')]=widgetAttributes(_0x36b753['body']);return db['DashboardItem']['create'](_0x36b753[_0x2115('0x48')]);}})[_0x2115('0x24')](respondWithResult(_0x4fde2b,null))[_0x2115('0x43')](handleError(_0x4fde2b,null));};exports[_0x2115('0x7a')]=function(_0x28aff2,_0x53388d,_0x2c18d6){var _0x312f68={};var _0x333072={};var _0x48da5c;var _0x157a1d;return db[_0x2115('0x2e')][_0x2115('0x7b')]({'where':{'id':_0x28aff2[_0x2115('0x44')]['id']}})[_0x2115('0x24')](handleEntityNotFound(_0x53388d,null))[_0x2115('0x24')](function(_0x1e6f65){if(_0x1e6f65){_0x48da5c=_0x1e6f65;_0x333072[_0x2115('0x33')]=_[_0x2115('0x35')](db[_0x2115('0x7c')][_0x2115('0x2f')]);_0x333072[_0x2115('0x34')]=_[_0x2115('0x35')](_0x28aff2[_0x2115('0x34')]);_0x333072['filters']=_['intersection'](_0x333072['model'],_0x333072[_0x2115('0x34')]);_0x312f68[_0x2115('0x38')]=_[_0x2115('0x37')](_0x333072[_0x2115('0x33')],qs['fields'](_0x28aff2['query'][_0x2115('0x39')]));_0x312f68[_0x2115('0x38')]=_0x312f68[_0x2115('0x38')][_0x2115('0x3a')]?_0x312f68[_0x2115('0x38')]:_0x333072[_0x2115('0x33')];_0x312f68['order']=qs[_0x2115('0x3b')](_0x28aff2[_0x2115('0x34')][_0x2115('0x3b')]);_0x312f68[_0x2115('0x3c')]=qs['filters'](_[_0x2115('0x7d')](_0x28aff2[_0x2115('0x34')],_0x333072[_0x2115('0x36')]));if(_0x28aff2['query'][_0x2115('0x3d')]){_0x312f68[_0x2115('0x3c')]=_[_0x2115('0x3e')](_0x312f68[_0x2115('0x3c')],{'$or':_[_0x2115('0x2d')](_0x312f68[_0x2115('0x38')],function(_0x46f9af){var _0x5e1bf9={};_0x5e1bf9[_0x46f9af]={'$like':'%'+_0x28aff2['query']['filter']+'%'};return _0x5e1bf9;})});}_0x312f68=_[_0x2115('0x3e')]({},_0x312f68,_0x28aff2['options']);return _0x48da5c[_0x2115('0x7a')](_0x312f68);}})[_0x2115('0x24')](function(_0x2ae57b){if(_0x2ae57b){_0x157a1d=_0x2ae57b[_0x2115('0x3a')];if(!_0x28aff2[_0x2115('0x34')][_0x2115('0x7e')](_0x2115('0x7f'))){_0x312f68['limit']=qs['limit'](_0x28aff2[_0x2115('0x34')][_0x2115('0x21')]);_0x312f68[_0x2115('0x1e')]=qs[_0x2115('0x1e')](_0x28aff2[_0x2115('0x34')][_0x2115('0x1e')]);}return _0x48da5c[_0x2115('0x7a')](_0x312f68);}})[_0x2115('0x24')](function(_0x4ca29c){if(_0x4ca29c){return _0x4ca29c?{'count':_0x157a1d,'rows':_0x4ca29c}:null;}})[_0x2115('0x24')](respondWithResult(_0x53388d,null))[_0x2115('0x43')](handleError(_0x53388d,null));}; \ No newline at end of file +var _0x097f=['attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','getItems','findOne','pick','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','end','stack','name','send','index','map','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','Dashboard','includeAll','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','UserProfileSection','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1'];(function(_0x5e32ce,_0x53dace){var _0x2a6398=function(_0x104469){while(--_0x104469){_0x5e32ce['push'](_0x5e32ce['shift']());}};_0x2a6398(++_0x53dace);}(_0x097f,0x8c));var _0xf097=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x097f[_0x529a0f];return _0x187a88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf097('0x0'));var jsonpatch=require(_0xf097('0x1'));var rp=require(_0xf097('0x2'));var moment=require(_0xf097('0x3'));var BPromise=require(_0xf097('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf097('0x5'));var sox=require(_0xf097('0x6'));var csv=require(_0xf097('0x7'));var ejs=require(_0xf097('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf097('0x9'));var squel=require('squel');var crypto=require(_0xf097('0xa'));var jsforce=require(_0xf097('0xb'));var deskjs=require(_0xf097('0xc'));var toCsv=require(_0xf097('0x7'));var querystring=require(_0xf097('0xd'));var Papa=require(_0xf097('0xe'));var Redis=require(_0xf097('0xf'));var authService=require(_0xf097('0x10'));var qs=require(_0xf097('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf097('0x12'));var logger=require(_0xf097('0x13'))(_0xf097('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf097('0x15'));var db=require(_0xf097('0x16'))['db'];config[_0xf097('0x17')]=_['defaults'](config[_0xf097('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf097('0x18'))(new Redis(config[_0xf097('0x17')]));require(_0xf097('0x19'))['register'](socket);function respondWithStatusCode(_0x483f59,_0x47de66){_0x47de66=_0x47de66||0xcc;return function(_0x267e3b){if(_0x267e3b){return _0x483f59[_0xf097('0x1a')](_0x47de66);}return _0x483f59[_0xf097('0x1b')](_0x47de66)['end']();};}function respondWithResult(_0x3de6a1,_0x37d9b3){_0x37d9b3=_0x37d9b3||0xc8;return function(_0xf34a05){if(_0xf34a05){return _0x3de6a1[_0xf097('0x1b')](_0x37d9b3)[_0xf097('0x1c')](_0xf34a05);}};}function respondWithFilteredResult(_0xdd5109,_0x34abd0){return function(_0x2aa5e2){if(_0x2aa5e2){var _0x1e24cc=typeof _0x34abd0['offset']===_0xf097('0x1d')&&typeof _0x34abd0[_0xf097('0x1e')]===_0xf097('0x1d');var _0x46ec72=_0x2aa5e2[_0xf097('0x1f')];var _0x303811=_0x1e24cc?0x0:_0x34abd0[_0xf097('0x20')];var _0x419003=_0x1e24cc?_0x2aa5e2[_0xf097('0x1f')]:_0x34abd0[_0xf097('0x20')]+_0x34abd0[_0xf097('0x1e')];var _0x37dd71;if(_0x419003>=_0x46ec72){_0x419003=_0x46ec72;_0x37dd71=0xc8;}else{_0x37dd71=0xce;}_0xdd5109[_0xf097('0x1b')](_0x37dd71);return _0xdd5109[_0xf097('0x21')](_0xf097('0x22'),_0x303811+'-'+_0x419003+'/'+_0x46ec72)[_0xf097('0x1c')](_0x2aa5e2);}return null;};}function patchUpdates(_0x3a3ec5){return function(_0x31b621){try{jsonpatch['apply'](_0x31b621,_0x3a3ec5,!![]);}catch(_0x1509fb){return BPromise[_0xf097('0x23')](_0x1509fb);}return _0x31b621[_0xf097('0x24')]();};}function saveUpdates(_0x13efe9,_0x271526){return function(_0x4d234a){if(_0x4d234a){return _0x4d234a[_0xf097('0x25')](_0x13efe9)[_0xf097('0x26')](function(_0x1e608c){return _0x1e608c;});}return null;};}function removeEntity(_0x41ba9e,_0x5ef9a4){return function(_0x56f84c){if(_0x56f84c){return _0x56f84c[_0xf097('0x27')]()[_0xf097('0x26')](function(){var _0x9f80b7=_0x56f84c[_0xf097('0x28')]({'plain':!![]});var _0xce8f42=_0xf097('0x29');return db[_0xf097('0x2a')]['destroy']({'where':{'type':_0xce8f42,'resourceId':_0x9f80b7['id']}})[_0xf097('0x26')](function(){return _0x56f84c;});})[_0xf097('0x26')](function(){_0x41ba9e[_0xf097('0x1b')](0xcc)[_0xf097('0x2b')]();});}};}function handleEntityNotFound(_0x4ca677,_0x4f3adf){return function(_0x4c3ae9){if(!_0x4c3ae9){_0x4ca677['sendStatus'](0x194);}return _0x4c3ae9;};}function handleError(_0x525a2d,_0x919960){_0x919960=_0x919960||0x1f4;return function(_0x3af0c6){logger['error'](_0x3af0c6[_0xf097('0x2c')]);if(_0x3af0c6['name']){delete _0x3af0c6[_0xf097('0x2d')];}_0x525a2d[_0xf097('0x1b')](_0x919960)[_0xf097('0x2e')](_0x3af0c6);};}exports[_0xf097('0x2f')]=function(_0x5c466f,_0x12e6d4){var _0x2faac6={},_0x2ea780={},_0x4cbb46={'count':0x0,'rows':[]};var _0x3c3d9a=_[_0xf097('0x30')](db['Dashboard']['rawAttributes'],function(_0x5bdc36){return{'name':_0x5bdc36['fieldName'],'type':_0x5bdc36['type'][_0xf097('0x31')]};});_0x2ea780[_0xf097('0x32')]=_[_0xf097('0x30')](_0x3c3d9a,_0xf097('0x2d'));_0x2ea780[_0xf097('0x33')]=_[_0xf097('0x34')](_0x5c466f['query']);_0x2ea780['filters']=_[_0xf097('0x35')](_0x2ea780[_0xf097('0x32')],_0x2ea780[_0xf097('0x33')]);_0x2faac6[_0xf097('0x36')]=_[_0xf097('0x35')](_0x2ea780[_0xf097('0x32')],qs[_0xf097('0x37')](_0x5c466f[_0xf097('0x33')][_0xf097('0x37')]));_0x2faac6['attributes']=_0x2faac6[_0xf097('0x36')][_0xf097('0x38')]?_0x2faac6[_0xf097('0x36')]:_0x2ea780[_0xf097('0x32')];if(!_0x5c466f[_0xf097('0x33')][_0xf097('0x39')](_0xf097('0x3a'))){_0x2faac6[_0xf097('0x1e')]=qs[_0xf097('0x1e')](_0x5c466f['query'][_0xf097('0x1e')]);_0x2faac6[_0xf097('0x20')]=qs['offset'](_0x5c466f[_0xf097('0x33')][_0xf097('0x20')]);}_0x2faac6[_0xf097('0x3b')]=qs[_0xf097('0x3c')](_0x5c466f[_0xf097('0x33')][_0xf097('0x3c')]);_0x2faac6[_0xf097('0x3d')]=qs[_0xf097('0x3e')](_['pick'](_0x5c466f[_0xf097('0x33')],_0x2ea780['filters']),_0x3c3d9a);if(_0x5c466f[_0xf097('0x33')][_0xf097('0x3f')]){_0x2faac6['where']=_[_0xf097('0x40')](_0x2faac6[_0xf097('0x3d')],{'$or':_[_0xf097('0x30')](_0x3c3d9a,function(_0x17867d){if(_0x17867d[_0xf097('0x41')]!==_0xf097('0x42')){var _0x22b2ed={};_0x22b2ed[_0x17867d[_0xf097('0x2d')]]={'$like':'%'+_0x5c466f[_0xf097('0x33')]['filter']+'%'};return _0x22b2ed;}})});}_0x2faac6=_[_0xf097('0x40')]({},_0x2faac6,_0x5c466f[_0xf097('0x43')]);var _0x3e1508={'where':_0x2faac6[_0xf097('0x3d')]};return db[_0xf097('0x44')][_0xf097('0x1f')](_0x3e1508)[_0xf097('0x26')](function(_0x193268){_0x4cbb46[_0xf097('0x1f')]=_0x193268;if(_0x5c466f[_0xf097('0x33')][_0xf097('0x45')]){_0x2faac6['include']=[{'all':!![]}];}return db[_0xf097('0x44')][_0xf097('0x46')](_0x2faac6);})['then'](function(_0x4f14ae){_0x4cbb46[_0xf097('0x47')]=_0x4f14ae;return _0x4cbb46;})['then'](respondWithFilteredResult(_0x12e6d4,_0x2faac6))['catch'](handleError(_0x12e6d4,null));};exports[_0xf097('0x48')]=function(_0x116fdb,_0x59648f){var _0x47d2f8={'raw':![],'where':{'id':_0x116fdb[_0xf097('0x49')]['id']}},_0x397b76={};_0x397b76[_0xf097('0x32')]=_[_0xf097('0x34')](db[_0xf097('0x44')]['rawAttributes']);_0x397b76[_0xf097('0x33')]=_['keys'](_0x116fdb[_0xf097('0x33')]);_0x397b76[_0xf097('0x3e')]=_[_0xf097('0x35')](_0x397b76[_0xf097('0x32')],_0x397b76['query']);_0x47d2f8[_0xf097('0x36')]=_[_0xf097('0x35')](_0x397b76[_0xf097('0x32')],qs[_0xf097('0x37')](_0x116fdb[_0xf097('0x33')][_0xf097('0x37')]));_0x47d2f8[_0xf097('0x36')]=_0x47d2f8['attributes'][_0xf097('0x38')]?_0x47d2f8['attributes']:_0x397b76[_0xf097('0x32')];if(_0x116fdb[_0xf097('0x33')]['includeAll']){_0x47d2f8['include']=[{'all':!![]}];}_0x47d2f8=_[_0xf097('0x40')]({},_0x47d2f8,_0x116fdb['options']);return db[_0xf097('0x44')][_0xf097('0x4a')](_0x47d2f8)[_0xf097('0x26')](handleEntityNotFound(_0x59648f,null))[_0xf097('0x26')](respondWithResult(_0x59648f,null))[_0xf097('0x4b')](handleError(_0x59648f,null));};exports['create']=function(_0x394eb5,_0x37b2ce){return db[_0xf097('0x44')][_0xf097('0x4c')](_0x394eb5[_0xf097('0x4d')],{})[_0xf097('0x26')](function(_0x3bc968){var _0x4e18e0=_0x394eb5[_0xf097('0x4e')][_0xf097('0x28')]({'plain':!![]});if(!_0x4e18e0)throw new Error(_0xf097('0x4f'));if(_0x4e18e0[_0xf097('0x50')]===_0xf097('0x4e')){var _0xe42c45=_0x3bc968['get']({'plain':!![]});var _0x5e7195=_0xf097('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x5e7195,'userProfileId':_0x4e18e0[_0xf097('0x51')]},'raw':!![]})['then'](function(_0x337f41){if(_0x337f41&&_0x337f41[_0xf097('0x52')]===0x0){return db[_0xf097('0x2a')][_0xf097('0x4c')]({'name':_0xe42c45[_0xf097('0x2d')],'resourceId':_0xe42c45['id'],'type':_0x337f41[_0xf097('0x2d')],'sectionId':_0x337f41['id']},{})[_0xf097('0x26')](function(){return _0x3bc968;});}else{return _0x3bc968;}})[_0xf097('0x4b')](function(_0x4da2c7){logger[_0xf097('0x53')](_0xf097('0x54'),_0x4da2c7);throw _0x4da2c7;});}return _0x3bc968;})[_0xf097('0x26')](respondWithResult(_0x37b2ce,0xc9))[_0xf097('0x4b')](handleError(_0x37b2ce,null));};exports[_0xf097('0x55')]=function(_0x50aed1,_0x55b7a8){var _0x45b800={'where':{'id':_0x50aed1['params']['id']}},_0x3abc89={};_0x3abc89['model']=_[_0xf097('0x34')](db['Dashboard'][_0xf097('0x56')]);_0x45b800[_0xf097('0x36')]=_[_0xf097('0x35')](_0x3abc89['model'],qs[_0xf097('0x37')](_0x50aed1[_0xf097('0x33')]['fields']));_0x45b800['attributes']=_0x45b800[_0xf097('0x36')][_0xf097('0x38')]?_0x45b800[_0xf097('0x36')]:_0x3abc89[_0xf097('0x32')];if(_0x50aed1[_0xf097('0x33')][_0xf097('0x45')]){_0x45b800['include']=[{'all':!![]}];}_0x45b800=_[_0xf097('0x40')]({},_0x45b800,_0x50aed1[_0xf097('0x43')]);return db[_0xf097('0x44')]['find'](_0x45b800)[_0xf097('0x26')](handleEntityNotFound(_0x55b7a8,null))[_0xf097('0x26')](function(_0x3e4f16){if(_0x3e4f16){var _0x4e54ed=_0x3e4f16[_0xf097('0x28')]({'plain':!![]});_0x4e54ed=qs[_0xf097('0x57')](_0x4e54ed,['id',_0xf097('0x58'),'updatedAt']);_0x50aed1[_0xf097('0x4d')]=_['omit'](_0x50aed1[_0xf097('0x4d')],['id','createdAt','updatedAt']);return db[_0xf097('0x44')][_0xf097('0x4c')](_[_0xf097('0x40')](_0x4e54ed,_0x50aed1['body']),{'include':_0x50aed1['query'][_0xf097('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x15c286){var _0x49071=_0x50aed1[_0xf097('0x4e')][_0xf097('0x28')]({'plain':!![]});if(!_0x49071)throw new Error(_0xf097('0x4f'));if(_0x49071[_0xf097('0x50')]===_0xf097('0x4e')){var _0x263f28=_0x15c286[_0xf097('0x28')]({'plain':!![]});var _0x3de6ee=_0xf097('0x29');return db[_0xf097('0x59')][_0xf097('0x4a')]({'where':{'name':_0x3de6ee,'userProfileId':_0x49071[_0xf097('0x51')]},'raw':!![]})[_0xf097('0x26')](function(_0x4ca052){if(_0x4ca052&&_0x4ca052[_0xf097('0x52')]===0x0){return db[_0xf097('0x2a')][_0xf097('0x4c')]({'name':_0x263f28[_0xf097('0x2d')],'resourceId':_0x263f28['id'],'type':_0x4ca052[_0xf097('0x2d')],'sectionId':_0x4ca052['id']},{})[_0xf097('0x26')](function(){return _0x15c286;});}else{return _0x15c286;}})[_0xf097('0x4b')](function(_0x2042cc){logger[_0xf097('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2042cc);throw _0x2042cc;});}return _0x15c286;});}})[_0xf097('0x26')](respondWithResult(_0x55b7a8,0xc9))[_0xf097('0x4b')](handleError(_0x55b7a8,null));};exports['update']=function(_0x28d53,_0x49e9fe){if(_0x28d53[_0xf097('0x4d')]['id']){delete _0x28d53[_0xf097('0x4d')]['id'];}return db[_0xf097('0x44')][_0xf097('0x4a')]({'where':{'id':_0x28d53['params']['id']}})[_0xf097('0x26')](handleEntityNotFound(_0x49e9fe,null))['then'](saveUpdates(_0x28d53['body'],null))[_0xf097('0x26')](respondWithResult(_0x49e9fe,null))[_0xf097('0x4b')](handleError(_0x49e9fe,null));};exports[_0xf097('0x27')]=function(_0x5a75af,_0x3ec6a8){return db[_0xf097('0x44')]['find']({'where':{'id':_0x5a75af[_0xf097('0x49')]['id']}})[_0xf097('0x26')](handleEntityNotFound(_0x3ec6a8,null))[_0xf097('0x26')](removeEntity(_0x3ec6a8,null))[_0xf097('0x4b')](handleError(_0x3ec6a8,null));};function widgetAttributes(_0x4c80ae){try{switch(_0x4c80ae[_0xf097('0x41')]){case _0xf097('0x5a'):return[{'name':'attrUrl','value':_0x4c80ae[_0xf097('0x5b')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||'https://'}];case _0xf097('0x5e'):return[{'name':_0xf097('0x5f'),'value':_0x4c80ae[_0xf097('0x5f')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||''}];case _0xf097('0x60'):return[{'name':_0xf097('0x61'),'value':_0x4c80ae[_0xf097('0x61')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||_0xf097('0x62')},{'name':_0xf097('0x63'),'value':_0x4c80ae[_0xf097('0x63')]||(_0x4c80ae['attrs']&&_0x4c80ae[_0xf097('0x5c')][0x1]?_0x4c80ae['attrs'][0x1]['value']:undefined)||_0xf097('0x64')},{'name':_0xf097('0x65'),'value':_0x4c80ae[_0xf097('0x65')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x2]?_0x4c80ae[_0xf097('0x5c')][0x2][_0xf097('0x5d')]:undefined)||0xc}];case _0xf097('0x66'):return[{'name':'attrMetric','value':_0x4c80ae['attrMetric']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||_0xf097('0x67')},{'name':_0xf097('0x68'),'value':_0x4c80ae['attrVoiceQueues']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x1]?_0x4c80ae[_0xf097('0x5c')][0x1][_0xf097('0x5d')]:undefined)||[]},{'name':_0xf097('0x65'),'value':_0x4c80ae[_0xf097('0x65')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x2]?_0x4c80ae['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xf097('0x69'),'value':_0x4c80ae[_0xf097('0x69')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x3]?_0x4c80ae[_0xf097('0x5c')][0x3][_0xf097('0x5d')]:undefined)||_0xf097('0x6a')},{'name':_0xf097('0x6b'),'value':_0x4c80ae['attrEmailAccounts']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x4]?_0x4c80ae[_0xf097('0x5c')][0x4][_0xf097('0x5d')]:undefined)||''},{'name':_0xf097('0x6c'),'value':_0x4c80ae['attrFaxAccounts']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x5]?_0x4c80ae[_0xf097('0x5c')][0x5][_0xf097('0x5d')]:undefined)||''},{'name':_0xf097('0x6d'),'value':_0x4c80ae[_0xf097('0x6d')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x6]?_0x4c80ae[_0xf097('0x5c')][0x6][_0xf097('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4c80ae[_0xf097('0x6e')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x7]?_0x4c80ae['attrs'][0x7][_0xf097('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c80ae[_0xf097('0x6f')]||(_0x4c80ae['attrs']&&_0x4c80ae[_0xf097('0x5c')][0x8]?_0x4c80ae['attrs'][0x8]['value']:undefined)||''},{'name':_0xf097('0x70'),'value':_0x4c80ae[_0xf097('0x70')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x9]?_0x4c80ae[_0xf097('0x5c')][0x9]['value']:undefined)||''}];case _0xf097('0x71'):case _0xf097('0x72'):return[{'name':_0xf097('0x73'),'value':_0x4c80ae[_0xf097('0x73')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||_0xf097('0x67')},{'name':_0xf097('0x74'),'value':_0x4c80ae[_0xf097('0x74')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x1]?_0x4c80ae[_0xf097('0x5c')][0x1]['value']:undefined)||null},{'name':_0xf097('0x75'),'value':_0x4c80ae['attrSerie3']||(_0x4c80ae['attrs']&&_0x4c80ae[_0xf097('0x5c')][0x2]?_0x4c80ae[_0xf097('0x5c')][0x2][_0xf097('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4c80ae['attrVoiceQueues']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x3]?_0x4c80ae[_0xf097('0x5c')][0x3][_0xf097('0x5d')]:undefined)||[]},{'name':'attrChannel','value':_0x4c80ae[_0xf097('0x69')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x4]?_0x4c80ae['attrs'][0x4][_0xf097('0x5d')]:undefined)||_0xf097('0x6a')},{'name':_0xf097('0x6b'),'value':_0x4c80ae['attrEmailAccounts']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x5]?_0x4c80ae[_0xf097('0x5c')][0x5][_0xf097('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4c80ae['attrFaxAccounts']||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x6]?_0x4c80ae['attrs'][0x6][_0xf097('0x5d')]:undefined)||''},{'name':_0xf097('0x6d'),'value':_0x4c80ae[_0xf097('0x6d')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae['attrs'][0x7]?_0x4c80ae[_0xf097('0x5c')][0x7][_0xf097('0x5d')]:undefined)||''},{'name':_0xf097('0x6e'),'value':_0x4c80ae[_0xf097('0x6e')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x8]?_0x4c80ae[_0xf097('0x5c')][0x8][_0xf097('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c80ae[_0xf097('0x6f')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x9]?_0x4c80ae['attrs'][0x9]['value']:undefined)||''},{'name':_0xf097('0x70'),'value':_0x4c80ae[_0xf097('0x70')]||(_0x4c80ae['attrs']&&_0x4c80ae[_0xf097('0x5c')][0xa]?_0x4c80ae[_0xf097('0x5c')][0xa][_0xf097('0x5d')]:undefined)||''}];case _0xf097('0x76'):return[{'name':_0xf097('0x77'),'type':_0x4c80ae[_0xf097('0x78')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x41')]:undefined)||null,'value':_0x4c80ae[_0xf097('0x77')]||(_0x4c80ae['attrs']&&_0x4c80ae[_0xf097('0x5c')][0x0]?_0x4c80ae[_0xf097('0x5c')][0x0][_0xf097('0x5d')]:undefined)||null},{'name':_0xf097('0x79'),'value':_0x4c80ae[_0xf097('0x79')]||(_0x4c80ae[_0xf097('0x5c')]&&_0x4c80ae[_0xf097('0x5c')][0x1]?_0x4c80ae['attrs'][0x1][_0xf097('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x5d0a34){logger['error'](_0xf097('0x7a'),JSON[_0xf097('0x7b')](_0x5d0a34));return[];}}exports['addItem']=function(_0x5ef72e,_0x163e23,_0x12a1fe){if(_0x5ef72e[_0xf097('0x4d')]['id']){delete _0x5ef72e['body']['id'];}return db['Dashboard'][_0xf097('0x4a')]({'where':{'id':_0x5ef72e['params']['id']}})['then'](handleEntityNotFound(_0x163e23,null))[_0xf097('0x26')](function(_0x1d091e){if(_0x1d091e){_0x5ef72e[_0xf097('0x4d')]['DashboardId']=_0x1d091e['id'];_0x5ef72e[_0xf097('0x4d')][_0xf097('0x5c')]=widgetAttributes(_0x5ef72e[_0xf097('0x4d')]);return db[_0xf097('0x7c')][_0xf097('0x4c')](_0x5ef72e[_0xf097('0x4d')]);}})['then'](respondWithResult(_0x163e23,null))[_0xf097('0x4b')](handleError(_0x163e23,null));};exports[_0xf097('0x7d')]=function(_0x6a20fa,_0x3ed77b,_0x17a9ad){var _0x188355={};var _0x314017={};var _0x1a7ff5;var _0x21e9cb;return db['Dashboard'][_0xf097('0x7e')]({'where':{'id':_0x6a20fa[_0xf097('0x49')]['id']}})[_0xf097('0x26')](handleEntityNotFound(_0x3ed77b,null))[_0xf097('0x26')](function(_0x35edb3){if(_0x35edb3){_0x1a7ff5=_0x35edb3;_0x314017[_0xf097('0x32')]=_[_0xf097('0x34')](db['DashboardItem']['rawAttributes']);_0x314017['query']=_['keys'](_0x6a20fa['query']);_0x314017[_0xf097('0x3e')]=_[_0xf097('0x35')](_0x314017['model'],_0x314017['query']);_0x188355[_0xf097('0x36')]=_[_0xf097('0x35')](_0x314017[_0xf097('0x32')],qs[_0xf097('0x37')](_0x6a20fa['query'][_0xf097('0x37')]));_0x188355[_0xf097('0x36')]=_0x188355[_0xf097('0x36')]['length']?_0x188355['attributes']:_0x314017[_0xf097('0x32')];_0x188355['order']=qs[_0xf097('0x3c')](_0x6a20fa[_0xf097('0x33')][_0xf097('0x3c')]);_0x188355['where']=qs[_0xf097('0x3e')](_[_0xf097('0x7f')](_0x6a20fa[_0xf097('0x33')],_0x314017[_0xf097('0x3e')]));if(_0x6a20fa[_0xf097('0x33')][_0xf097('0x3f')]){_0x188355[_0xf097('0x3d')]=_[_0xf097('0x40')](_0x188355['where'],{'$or':_['map'](_0x188355['attributes'],function(_0x426732){var _0x23beb1={};_0x23beb1[_0x426732]={'$like':'%'+_0x6a20fa[_0xf097('0x33')]['filter']+'%'};return _0x23beb1;})});}_0x188355=_[_0xf097('0x40')]({},_0x188355,_0x6a20fa[_0xf097('0x43')]);return _0x1a7ff5['getItems'](_0x188355);}})['then'](function(_0x355f54){if(_0x355f54){_0x21e9cb=_0x355f54['length'];if(!_0x6a20fa[_0xf097('0x33')][_0xf097('0x39')]('nolimit')){_0x188355[_0xf097('0x1e')]=qs[_0xf097('0x1e')](_0x6a20fa[_0xf097('0x33')][_0xf097('0x1e')]);_0x188355['offset']=qs['offset'](_0x6a20fa['query']['offset']);}return _0x1a7ff5[_0xf097('0x7d')](_0x188355);}})[_0xf097('0x26')](function(_0x3eb4d2){if(_0x3eb4d2){return _0x3eb4d2?{'count':_0x21e9cb,'rows':_0x3eb4d2}:null;}})[_0xf097('0x26')](respondWithResult(_0x3ed77b,null))[_0xf097('0x4b')](handleError(_0x3ed77b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1e1c9ad..6e0eb7d 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 _0x4421=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x3c23c8,_0x361ce2){var _0x4e494a=function(_0x327935){while(--_0x327935){_0x3c23c8['push'](_0x3c23c8['shift']());}};_0x4e494a(++_0x361ce2);}(_0x4421,0x163));var _0x1442=function(_0x391e0a,_0x168392){_0x391e0a=_0x391e0a-0x0;var _0x258d57=_0x4421[_0x391e0a];return _0x258d57;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x1442('0x0'))['db'][_0x1442('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1442('0x2')](0x0);var events={'afterCreate':_0x1442('0x3'),'afterUpdate':_0x1442('0x4'),'afterDestroy':_0x1442('0x5')};function emitEvent(_0xf37556){return function(_0x3ebf6a,_0x12c293,_0x2242b0){DashboardEvents[_0x1442('0x6')](_0xf37556+':'+_0x3ebf6a['id'],_0x3ebf6a);DashboardEvents[_0x1442('0x6')](_0xf37556,_0x3ebf6a);_0x2242b0(null);};}for(var e in events){if(events[_0x1442('0x7')](e)){var event=events[e];Dashboard[_0x1442('0x8')](e,emitEvent(event));}}module[_0x1442('0x9')]=DashboardEvents; \ No newline at end of file +var _0x3a89=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x3a89,0xc5));var _0x93a8=function(_0x560af9,_0x5c089f){_0x560af9=_0x560af9-0x0;var _0x559cd4=_0x3a89[_0x560af9];return _0x559cd4;};'use strict';var EventEmitter=require(_0x93a8('0x0'));var Dashboard=require(_0x93a8('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x93a8('0x2')](0x0);var events={'afterCreate':_0x93a8('0x3'),'afterUpdate':_0x93a8('0x4'),'afterDestroy':_0x93a8('0x5')};function emitEvent(_0x4f705d){return function(_0x570cde,_0x5b0264,_0x167b94){DashboardEvents[_0x93a8('0x6')](_0x4f705d+':'+_0x570cde['id'],_0x570cde);DashboardEvents[_0x93a8('0x6')](_0x4f705d,_0x570cde);_0x167b94(null);};}for(var e in events){if(events[_0x93a8('0x7')](e)){var event=events[e];Dashboard[_0x93a8('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 899f077..ba526e9 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 _0x1178=['define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x19cedd,_0x2aed35){var _0x586d22=function(_0x45adb5){while(--_0x45adb5){_0x19cedd['push'](_0x19cedd['shift']());}};_0x586d22(++_0x2aed35);}(_0x1178,0xb7));var _0x8117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1178[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8117('0x0'));var util=require(_0x8117('0x1'));var logger=require(_0x8117('0x2'))(_0x8117('0x3'));var moment=require(_0x8117('0x4'));var BPromise=require(_0x8117('0x5'));var rp=require(_0x8117('0x6'));var fs=require('fs');var path=require(_0x8117('0x7'));var rimraf=require(_0x8117('0x8'));var config=require(_0x8117('0x9'));var attributes=require(_0x8117('0xa'));module[_0x8117('0xb')]=function(_0x4b1d50,_0x536c79){return _0x4b1d50[_0x8117('0xc')](_0x8117('0xd'),attributes,{'tableName':_0x8117('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bed=['Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','./dashboard.attributes'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x9bed,0xea));var _0xd9be=function(_0x11a21b,_0x5bd582){_0x11a21b=_0x11a21b-0x0;var _0x239aa4=_0x9bed[_0x11a21b];return _0x239aa4;};'use strict';var _=require(_0xd9be('0x0'));var util=require(_0xd9be('0x1'));var logger=require(_0xd9be('0x2'))('api');var moment=require(_0xd9be('0x3'));var BPromise=require(_0xd9be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd9be('0x5'));module['exports']=function(_0x293b4f,_0x5ad1f1){return _0x293b4f['define'](_0xd9be('0x6'),attributes,{'tableName':_0xd9be('0x7'),'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 642cb69..ae5e7f9 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 _0x846d=['socket.io-emitter','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x22126b,_0x2d833c){var _0x2d099b=function(_0x269fe9){while(--_0x269fe9){_0x22126b['push'](_0x22126b['shift']());}};_0x2d099b(++_0x2d833c);}(_0x846d,0x173));var _0xd846=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0x846d[_0x4e198a];return _0xb84bfe;};'use strict';var _=require('lodash');var util=require(_0xd846('0x0'));var moment=require('moment');var BPromise=require(_0xd846('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd846('0x2'));var db=require(_0xd846('0x3'))['db'];var utils=require(_0xd846('0x4'));var logger=require(_0xd846('0x5'))(_0xd846('0x6'));var config=require(_0xd846('0x7'));var jayson=require(_0xd846('0x8'));var client=jayson[_0xd846('0x9')][_0xd846('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd846('0xb')],{'host':_0xd846('0xc'),'port':0x18eb});var socket=require(_0xd846('0xd'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x2da5f4,_0x418c95,_0x1d76a8){return new BPromise(function(_0x19329b,_0x959c76){return client[_0xd846('0xe')](_0x2da5f4,_0x1d76a8)['then'](function(_0x5cf278){logger[_0xd846('0xf')]('Dashboard,\x20%s,\x20%s',_0x418c95,_0xd846('0x10'));logger[_0xd846('0x11')](_0xd846('0x12'),_0x418c95,_0xd846('0x10'),JSON['stringify'](_0x5cf278));if(_0x5cf278[_0xd846('0x13')]){if(_0x5cf278[_0xd846('0x13')][_0xd846('0x14')]===0x1f4){logger[_0xd846('0x13')](_0xd846('0x15'),_0x418c95,_0x5cf278[_0xd846('0x13')][_0xd846('0x16')]);return _0x959c76(_0x5cf278['error'][_0xd846('0x16')]);}logger[_0xd846('0x13')](_0xd846('0x15'),_0x418c95,_0x5cf278[_0xd846('0x13')][_0xd846('0x16')]);return _0x19329b(_0x5cf278[_0xd846('0x13')][_0xd846('0x16')]);}else{logger[_0xd846('0xf')](_0xd846('0x15'),_0x418c95,_0xd846('0x10'));_0x19329b(_0x5cf278[_0xd846('0x17')][_0xd846('0x16')]);}})['catch'](function(_0x434e4b){logger[_0xd846('0x13')](_0xd846('0x15'),_0x418c95,_0x434e4b);_0x959c76(_0x434e4b);});});} \ No newline at end of file +var _0xf4d2=['request','info','request\x20sent','debug','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','socket.io-emitter','./dashboard.socket','register'];(function(_0x445364,_0x5236fb){var _0x380706=function(_0x20d996){while(--_0x20d996){_0x445364['push'](_0x445364['shift']());}};_0x380706(++_0x5236fb);}(_0xf4d2,0x7d));var _0x2f4d=function(_0x8e5f5f,_0x356352){_0x8e5f5f=_0x8e5f5f-0x0;var _0x423bed=_0xf4d2[_0x8e5f5f];return _0x423bed;};'use strict';var _=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var moment=require(_0x2f4d('0x2'));var BPromise=require(_0x2f4d('0x3'));var rs=require(_0x2f4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f4d('0x5'))['db'];var utils=require(_0x2f4d('0x6'));var logger=require(_0x2f4d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f4d('0x8'));var client=jayson['client'][_0x2f4d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f4d('0xa'))(new Redis(config['redis']));require(_0x2f4d('0xb'))[_0x2f4d('0xc')](socket);function respondWithRpcPromise(_0x84e831,_0x4f0c22,_0x285bec){return new BPromise(function(_0x1941e4,_0x33f4fc){return client[_0x2f4d('0xd')](_0x84e831,_0x285bec)['then'](function(_0x4e8aa9){logger[_0x2f4d('0xe')]('Dashboard,\x20%s,\x20%s',_0x4f0c22,_0x2f4d('0xf'));logger[_0x2f4d('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4f0c22,_0x2f4d('0xf'),JSON['stringify'](_0x4e8aa9));if(_0x4e8aa9[_0x2f4d('0x11')]){if(_0x4e8aa9[_0x2f4d('0x11')][_0x2f4d('0x12')]===0x1f4){logger[_0x2f4d('0x11')]('Dashboard,\x20%s,\x20%s',_0x4f0c22,_0x4e8aa9[_0x2f4d('0x11')]['message']);return _0x33f4fc(_0x4e8aa9['error'][_0x2f4d('0x13')]);}logger[_0x2f4d('0x11')](_0x2f4d('0x14'),_0x4f0c22,_0x4e8aa9[_0x2f4d('0x11')][_0x2f4d('0x13')]);return _0x1941e4(_0x4e8aa9[_0x2f4d('0x11')][_0x2f4d('0x13')]);}else{logger[_0x2f4d('0xe')](_0x2f4d('0x14'),_0x4f0c22,_0x2f4d('0xf'));_0x1941e4(_0x4e8aa9[_0x2f4d('0x15')]['message']);}})[_0x2f4d('0x16')](function(_0x50ef76){logger[_0x2f4d('0x11')](_0x2f4d('0x14'),_0x4f0c22,_0x50ef76);_0x33f4fc(_0x50ef76);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index cdfbb70..3a911c6 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 _0x7c98=['./dashboard.events','update','emit','removeListener','register','length','dashboard:'];(function(_0x31949d,_0xa371f2){var _0x367ada=function(_0x24a55b){while(--_0x24a55b){_0x31949d['push'](_0x31949d['shift']());}};_0x367ada(++_0xa371f2);}(_0x7c98,0xd2));var _0x87c9=function(_0x1dd034,_0x5f5a76){_0x1dd034=_0x1dd034-0x0;var _0x4ecb48=_0x7c98[_0x1dd034];return _0x4ecb48;};'use strict';var DashboardEvents=require(_0x87c9('0x0'));var events=['save','remove',_0x87c9('0x1')];function createListener(_0x5880e0,_0x3daba0){return function(_0x49de75){_0x3daba0[_0x87c9('0x2')](_0x5880e0,_0x49de75);};}function removeListener(_0x3be14b,_0x29f417){return function(){DashboardEvents[_0x87c9('0x3')](_0x3be14b,_0x29f417);};}exports[_0x87c9('0x4')]=function(_0x2b2aff){for(var _0x55c114=0x0,_0x28579a=events[_0x87c9('0x5')];_0x55c114<_0x28579a;_0x55c114++){var _0x35f5ca=events[_0x55c114];var _0x2e4b11=createListener(_0x87c9('0x6')+_0x35f5ca,_0x2b2aff);DashboardEvents['on'](_0x35f5ca,_0x2e4b11);}}; \ No newline at end of file +var _0xd059=['update','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x2feff5,_0x324af6){var _0x37fd1c=function(_0x1e5f1f){while(--_0x1e5f1f){_0x2feff5['push'](_0x2feff5['shift']());}};_0x37fd1c(++_0x324af6);}(_0xd059,0x1a5));var _0x9d05=function(_0x54fe57,_0x1792a0){_0x54fe57=_0x54fe57-0x0;var _0x2d0b3a=_0xd059[_0x54fe57];return _0x2d0b3a;};'use strict';var DashboardEvents=require(_0x9d05('0x0'));var events=[_0x9d05('0x1'),_0x9d05('0x2'),_0x9d05('0x3')];function createListener(_0x327369,_0x571c68){return function(_0x3fa116){_0x571c68['emit'](_0x327369,_0x3fa116);};}function removeListener(_0x201de6,_0x14117e){return function(){DashboardEvents[_0x9d05('0x4')](_0x201de6,_0x14117e);};}exports[_0x9d05('0x5')]=function(_0x16c0cd){for(var _0x58a9b6=0x0,_0x3daba2=events[_0x9d05('0x6')];_0x58a9b6<_0x3daba2;_0x58a9b6++){var _0x57f9fe=events[_0x58a9b6];var _0x123dfe=createListener(_0x9d05('0x7')+_0x57f9fe,_0x16c0cd);DashboardEvents['on'](_0x57f9fe,_0x123dfe);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8f8b1dd..0ff1536 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 _0x5161=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','update'];(function(_0xa026b8,_0x30b0cb){var _0x46c85d=function(_0x5813da){while(--_0x5813da){_0xa026b8['push'](_0xa026b8['shift']());}};_0x46c85d(++_0x30b0cb);}(_0x5161,0x135));var _0x1516=function(_0x18475d,_0x5d584f){_0x18475d=_0x18475d-0x0;var _0x17a2ff=_0x5161[_0x18475d];return _0x17a2ff;};'use strict';var multer=require(_0x1516('0x0'));var util=require(_0x1516('0x1'));var path=require('path');var timeout=require(_0x1516('0x2'));var express=require(_0x1516('0x3'));var router=express[_0x1516('0x4')]();var fs_extra=require(_0x1516('0x5'));var auth=require(_0x1516('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1516('0x7'));var controller=require('./dashboard.controller');router[_0x1516('0x8')]('/',auth[_0x1516('0x9')](),controller[_0x1516('0xa')]);router[_0x1516('0x8')](_0x1516('0xb'),auth[_0x1516('0x9')](),controller[_0x1516('0xc')]);router[_0x1516('0x8')](_0x1516('0xd'),auth[_0x1516('0x9')](),controller[_0x1516('0xe')]);router[_0x1516('0xf')]('/',auth[_0x1516('0x9')](),controller[_0x1516('0x10')]);router['post'](_0x1516('0x11'),auth[_0x1516('0x9')](),controller[_0x1516('0x12')]);router['post'](_0x1516('0xd'),auth[_0x1516('0x9')](),controller['addItem']);router[_0x1516('0x13')](_0x1516('0xb'),auth['isAuthenticated'](),controller[_0x1516('0x14')]);router[_0x1516('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe073=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','addItem','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2e4929,_0x26bada){var _0x2f6153=function(_0xb558c3){while(--_0xb558c3){_0x2e4929['push'](_0x2e4929['shift']());}};_0x2f6153(++_0x26bada);}(_0xe073,0x1b6));var _0x3e07=function(_0x1a0c7f,_0x2137de){_0x1a0c7f=_0x1a0c7f-0x0;var _0x557663=_0xe073[_0x1a0c7f];return _0x557663;};'use strict';var multer=require(_0x3e07('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e07('0x1'));var express=require(_0x3e07('0x2'));var router=express[_0x3e07('0x3')]();var fs_extra=require(_0x3e07('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3e07('0x5'));var config=require(_0x3e07('0x6'));var controller=require(_0x3e07('0x7'));router[_0x3e07('0x8')]('/',auth[_0x3e07('0x9')](),controller[_0x3e07('0xa')]);router[_0x3e07('0x8')](_0x3e07('0xb'),auth[_0x3e07('0x9')](),controller['show']);router[_0x3e07('0x8')](_0x3e07('0xc'),auth['isAuthenticated'](),controller[_0x3e07('0xd')]);router[_0x3e07('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e07('0xf')]);router[_0x3e07('0xe')]('/:id/clone',auth[_0x3e07('0x9')](),controller['clone']);router[_0x3e07('0xe')](_0x3e07('0xc'),auth[_0x3e07('0x9')](),controller[_0x3e07('0x10')]);router[_0x3e07('0x11')](_0x3e07('0xb'),auth[_0x3e07('0x9')](),controller[_0x3e07('0x12')]);router[_0x3e07('0x13')](_0x3e07('0xb'),auth[_0x3e07('0x9')](),controller[_0x3e07('0x14')]);module[_0x3e07('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3a8395d..4c961e3 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xacf4,0xe7));var _0x4acf=function(_0xe5745d,_0x22ed33){_0xe5745d=_0xe5745d-0x0;var _0x58787a=_0xacf4[_0xe5745d];return _0x58787a;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x5f0cbd,_0x3048b9){var _0xd9b313=function(_0x36a0a6){while(--_0x36a0a6){_0x5f0cbd['push'](_0x5f0cbd['shift']());}};_0xd9b313(++_0x3048b9);}(_0x326f,0xd1));var _0xf326=function(_0x142c52,_0x4f083c){_0x142c52=_0x142c52-0x0;var _0x268718=_0x326f[_0x142c52];return _0x268718;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'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 c149307..adfaa3a 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 _0x5226=['attrSerie1','total','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','destroy','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart'];(function(_0xd1f920,_0x18dbc8){var _0x11fd3c=function(_0x550f37){while(--_0x550f37){_0xd1f920['push'](_0xd1f920['shift']());}};_0x11fd3c(++_0x18dbc8);}(_0x5226,0x137));var _0x6522=function(_0x1d33d2,_0x16650e){_0x1d33d2=_0x1d33d2-0x0;var _0x4b5460=_0x5226[_0x1d33d2];return _0x4b5460;};'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(_0x6522('0x4'));var moment=require('moment');var BPromise=require(_0x6522('0x5'));var Mustache=require(_0x6522('0x6'));var util=require(_0x6522('0x7'));var path=require('path');var sox=require(_0x6522('0x8'));var csv=require('to-csv');var ejs=require(_0x6522('0x9'));var fs=require('fs');var fs_extra=require(_0x6522('0xa'));var _=require(_0x6522('0xb'));var squel=require(_0x6522('0xc'));var crypto=require(_0x6522('0xd'));var jsforce=require(_0x6522('0xe'));var deskjs=require(_0x6522('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6522('0x10'));var Redis=require(_0x6522('0x11'));var authService=require(_0x6522('0x12'));var qs=require(_0x6522('0x13'));var as=require(_0x6522('0x14'));var hardwareService=require(_0x6522('0x15'));var logger=require(_0x6522('0x16'))(_0x6522('0x17'));var utils=require(_0x6522('0x18'));var config=require(_0x6522('0x19'));var licenseUtil=require(_0x6522('0x1a'));var db=require(_0x6522('0x1b'))['db'];config[_0x6522('0x1c')]=_['defaults'](config[_0x6522('0x1c')],{'host':_0x6522('0x1d'),'port':0x18eb});var socket=require(_0x6522('0x1e'))(new Redis(config[_0x6522('0x1c')]));require(_0x6522('0x1f'))['register'](socket);function respondWithStatusCode(_0x3c855a,_0x2ab9a0){_0x2ab9a0=_0x2ab9a0||0xcc;return function(_0x26ed67){if(_0x26ed67){return _0x3c855a[_0x6522('0x20')](_0x2ab9a0);}return _0x3c855a[_0x6522('0x21')](_0x2ab9a0)[_0x6522('0x22')]();};}function respondWithResult(_0x31ddff,_0x1e12b7){_0x1e12b7=_0x1e12b7||0xc8;return function(_0x36a557){if(_0x36a557){return _0x31ddff[_0x6522('0x21')](_0x1e12b7)[_0x6522('0x23')](_0x36a557);}};}function respondWithFilteredResult(_0x434a84,_0x51a8e0){return function(_0x6f0909){if(_0x6f0909){var _0x1edcb6=typeof _0x51a8e0[_0x6522('0x24')]===_0x6522('0x25')&&typeof _0x51a8e0['limit']===_0x6522('0x25');var _0x9a5622=_0x6f0909['count'];var _0x38aae6=_0x1edcb6?0x0:_0x51a8e0['offset'];var _0x1bb7df=_0x1edcb6?_0x6f0909[_0x6522('0x26')]:_0x51a8e0[_0x6522('0x24')]+_0x51a8e0[_0x6522('0x27')];var _0x44bd23;if(_0x1bb7df>=_0x9a5622){_0x1bb7df=_0x9a5622;_0x44bd23=0xc8;}else{_0x44bd23=0xce;}_0x434a84[_0x6522('0x21')](_0x44bd23);return _0x434a84['set'](_0x6522('0x28'),_0x38aae6+'-'+_0x1bb7df+'/'+_0x9a5622)[_0x6522('0x23')](_0x6f0909);}return null;};}function patchUpdates(_0x13ec44){return function(_0x14ba8f){try{jsonpatch[_0x6522('0x29')](_0x14ba8f,_0x13ec44,!![]);}catch(_0x16c3cf){return BPromise['reject'](_0x16c3cf);}return _0x14ba8f[_0x6522('0x2a')]();};}function saveUpdates(_0x415f16,_0xcb377c){return function(_0x2c3269){if(_0x2c3269){return _0x2c3269['update'](_0x415f16)['then'](function(_0x263d7d){return _0x263d7d;});}return null;};}function removeEntity(_0x38045b,_0x2c20dc){return function(_0x29b7f4){if(_0x29b7f4){return _0x29b7f4['destroy']()[_0x6522('0x2b')](function(){_0x38045b[_0x6522('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375555,_0x2f6e86){return function(_0x23dc77){if(!_0x23dc77){_0x375555[_0x6522('0x20')](0x194);}return _0x23dc77;};}function handleError(_0x5db9bb,_0x204305){_0x204305=_0x204305||0x1f4;return function(_0x27bbc0){logger[_0x6522('0x2c')](_0x27bbc0[_0x6522('0x2d')]);if(_0x27bbc0[_0x6522('0x2e')]){delete _0x27bbc0[_0x6522('0x2e')];}_0x5db9bb[_0x6522('0x21')](_0x204305)[_0x6522('0x2f')](_0x27bbc0);};}exports[_0x6522('0x30')]=function(_0x2c57f7,_0x9e6606){var _0x2c2e97={'raw':![],'where':{'id':_0x2c57f7[_0x6522('0x31')]['id']}},_0x4c4d29={};_0x4c4d29[_0x6522('0x32')]=_[_0x6522('0x33')](db[_0x6522('0x34')][_0x6522('0x35')]);_0x4c4d29[_0x6522('0x36')]=_['keys'](_0x2c57f7[_0x6522('0x36')]);_0x4c4d29[_0x6522('0x37')]=_[_0x6522('0x38')](_0x4c4d29[_0x6522('0x32')],_0x4c4d29[_0x6522('0x36')]);_0x2c2e97[_0x6522('0x39')]=_[_0x6522('0x38')](_0x4c4d29[_0x6522('0x32')],qs[_0x6522('0x3a')](_0x2c57f7[_0x6522('0x36')][_0x6522('0x3a')]));_0x2c2e97[_0x6522('0x39')]=_0x2c2e97[_0x6522('0x39')]['length']?_0x2c2e97['attributes']:_0x4c4d29['model'];if(_0x2c57f7[_0x6522('0x36')][_0x6522('0x3b')]){_0x2c2e97[_0x6522('0x3c')]=[{'all':!![]}];}_0x2c2e97=_[_0x6522('0x3d')]({},_0x2c2e97,_0x2c57f7[_0x6522('0x3e')]);return db[_0x6522('0x34')]['find'](_0x2c2e97)[_0x6522('0x2b')](handleEntityNotFound(_0x9e6606,null))[_0x6522('0x2b')](respondWithResult(_0x9e6606,null))[_0x6522('0x3f')](handleError(_0x9e6606,null));};exports[_0x6522('0x40')]=function(_0x15d709,_0x4ec7ab){return db['DashboardItem']['find']({'where':{'id':_0x15d709[_0x6522('0x31')]['id']}})[_0x6522('0x2b')](handleEntityNotFound(_0x4ec7ab,null))['then'](removeEntity(_0x4ec7ab,null))['catch'](handleError(_0x4ec7ab,null));};function widgetAttributes(_0xed4641){try{switch(_0xed4641['type']){case'iframe':return[{'name':_0x6522('0x41'),'value':_0xed4641[_0x6522('0x41')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0]['value']:undefined)||_0x6522('0x43')}];case _0x6522('0x44'):return[{'name':_0x6522('0x45'),'value':_0xed4641[_0x6522('0x45')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0xed4641[_0x6522('0x47')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x6522('0x48'),'value':_0xed4641[_0x6522('0x48')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||'0.00'},{'name':_0x6522('0x49'),'value':_0xed4641['attrFontSize']||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||0xc}];case _0x6522('0x4a'):return[{'name':'attrMetric','value':_0xed4641[_0x6522('0x4b')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641['attrs'][0x0][_0x6522('0x46')]:undefined)||'total'},{'name':_0x6522('0x4c'),'value':_0xed4641[_0x6522('0x4c')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||[]},{'name':_0x6522('0x49'),'value':_0xed4641[_0x6522('0x49')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||0x14},{'name':_0x6522('0x4d'),'value':_0xed4641[_0x6522('0x4d')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x3]?_0xed4641[_0x6522('0x42')][0x3][_0x6522('0x46')]:undefined)||_0x6522('0x4e')},{'name':_0x6522('0x4f'),'value':_0xed4641[_0x6522('0x4f')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x4]?_0xed4641[_0x6522('0x42')][0x4][_0x6522('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xed4641['attrFaxAccounts']||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x5]?_0xed4641['attrs'][0x5][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x50'),'value':_0xed4641['attrSmsAccounts']||(_0xed4641['attrs']&&_0xed4641['attrs'][0x6]?_0xed4641['attrs'][0x6][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x51'),'value':_0xed4641[_0x6522('0x51')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x7]?_0xed4641[_0x6522('0x42')][0x7]['value']:undefined)||''},{'name':_0x6522('0x52'),'value':_0xed4641[_0x6522('0x52')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x8]?_0xed4641[_0x6522('0x42')][0x8][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x53'),'value':_0xed4641[_0x6522('0x53')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x9]?_0xed4641[_0x6522('0x42')][0x9][_0x6522('0x46')]:undefined)||''}];case'multibar-chart':case _0x6522('0x54'):return[{'name':_0x6522('0x55'),'value':_0xed4641[_0x6522('0x55')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0]['value']:undefined)||_0x6522('0x56')},{'name':'attrSerie2','value':_0xed4641['attrSerie2']||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641['attrs'][0x1]['value']:undefined)||null},{'name':_0x6522('0x57'),'value':_0xed4641['attrSerie3']||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x2]?_0xed4641[_0x6522('0x42')][0x2][_0x6522('0x46')]:undefined)||null},{'name':_0x6522('0x4c'),'value':_0xed4641[_0x6522('0x4c')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x3]?_0xed4641['attrs'][0x3][_0x6522('0x46')]:undefined)||[]},{'name':_0x6522('0x4d'),'value':_0xed4641[_0x6522('0x4d')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x4]?_0xed4641['attrs'][0x4][_0x6522('0x46')]:undefined)||_0x6522('0x4e')},{'name':_0x6522('0x4f'),'value':_0xed4641[_0x6522('0x4f')]||(_0xed4641['attrs']&&_0xed4641[_0x6522('0x42')][0x5]?_0xed4641[_0x6522('0x42')][0x5][_0x6522('0x46')]:undefined)||''},{'name':_0x6522('0x58'),'value':_0xed4641[_0x6522('0x58')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x6]?_0xed4641[_0x6522('0x42')][0x6][_0x6522('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xed4641[_0x6522('0x50')]||(_0xed4641['attrs']&&_0xed4641['attrs'][0x7]?_0xed4641[_0x6522('0x42')][0x7][_0x6522('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xed4641[_0x6522('0x51')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x8]?_0xed4641[_0x6522('0x42')][0x8][_0x6522('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xed4641[_0x6522('0x52')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x9]?_0xed4641[_0x6522('0x42')][0x9][_0x6522('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0xed4641[_0x6522('0x53')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641['attrs'][0xa]?_0xed4641['attrs'][0xa][_0x6522('0x46')]:undefined)||''}];case _0x6522('0x59'):return[{'name':_0x6522('0x5a'),'type':_0xed4641[_0x6522('0x5b')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x5c')]:undefined)||null,'value':_0xed4641[_0x6522('0x5a')]||(_0xed4641['attrs']&&_0xed4641['attrs'][0x0]?_0xed4641[_0x6522('0x42')][0x0][_0x6522('0x46')]:undefined)||null},{'name':_0x6522('0x5d'),'value':_0xed4641[_0x6522('0x5d')]||(_0xed4641[_0x6522('0x42')]&&_0xed4641[_0x6522('0x42')][0x1]?_0xed4641[_0x6522('0x42')][0x1][_0x6522('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x3e4686){logger[_0x6522('0x2c')](_0x6522('0x5e'),JSON[_0x6522('0x5f')](_0x3e4686));return[];}}exports['create']=function(_0x1cac9e,_0x24c8f8){if(_0x1cac9e[_0x6522('0x60')]){_0x1cac9e[_0x6522('0x60')]['attrs']=widgetAttributes(_0x1cac9e[_0x6522('0x60')]);}return db[_0x6522('0x34')]['create'](_0x1cac9e[_0x6522('0x60')],{})[_0x6522('0x2b')](respondWithResult(_0x24c8f8,0xc9))[_0x6522('0x3f')](handleError(_0x24c8f8,null));};exports[_0x6522('0x61')]=function(_0x1c0ede,_0x11f1e1){if(_0x1c0ede[_0x6522('0x60')]['id']){delete _0x1c0ede[_0x6522('0x60')]['id'];}_0x1c0ede[_0x6522('0x60')][_0x6522('0x42')]=widgetAttributes(_0x1c0ede[_0x6522('0x60')]);return db[_0x6522('0x34')][_0x6522('0x62')]({'where':{'id':_0x1c0ede['params']['id']}})['then'](handleEntityNotFound(_0x11f1e1,null))[_0x6522('0x2b')](saveUpdates(_0x1c0ede['body'],null))[_0x6522('0x2b')](respondWithResult(_0x11f1e1,null))['catch'](handleError(_0x11f1e1,null));}; \ No newline at end of file +var _0x5e8d=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','end','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','find','catch','type','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x22c81c,_0x30ddaf){var _0x5254a8=function(_0x77dce6){while(--_0x77dce6){_0x22c81c['push'](_0x22c81c['shift']());}};_0x5254a8(++_0x30ddaf);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x4bf55f,_0xaa2689){_0x4bf55f=_0x4bf55f-0x0;var _0x34f33c=_0x5e8d[_0x4bf55f];return _0x34f33c;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];config[_0xd5e8('0x1a')]=_[_0xd5e8('0x1b')](config[_0xd5e8('0x1a')],{'host':_0xd5e8('0x1c'),'port':0x18eb});var socket=require(_0xd5e8('0x1d'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xd5e8('0x1e')](socket);function respondWithStatusCode(_0x32de91,_0x470d94){_0x470d94=_0x470d94||0xcc;return function(_0x3ce0c5){if(_0x3ce0c5){return _0x32de91[_0xd5e8('0x1f')](_0x470d94);}return _0x32de91[_0xd5e8('0x20')](_0x470d94)['end']();};}function respondWithResult(_0x2ef357,_0x18c61f){_0x18c61f=_0x18c61f||0xc8;return function(_0x282ce2){if(_0x282ce2){return _0x2ef357[_0xd5e8('0x20')](_0x18c61f)['json'](_0x282ce2);}};}function respondWithFilteredResult(_0x3daf6a,_0x9467c3){return function(_0x529d45){if(_0x529d45){var _0x4b89e9=typeof _0x9467c3[_0xd5e8('0x21')]===_0xd5e8('0x22')&&typeof _0x9467c3[_0xd5e8('0x23')]===_0xd5e8('0x22');var _0x196648=_0x529d45[_0xd5e8('0x24')];var _0x7370d3=_0x4b89e9?0x0:_0x9467c3['offset'];var _0x36ee49=_0x4b89e9?_0x529d45[_0xd5e8('0x24')]:_0x9467c3[_0xd5e8('0x21')]+_0x9467c3[_0xd5e8('0x23')];var _0x26b187;if(_0x36ee49>=_0x196648){_0x36ee49=_0x196648;_0x26b187=0xc8;}else{_0x26b187=0xce;}_0x3daf6a[_0xd5e8('0x20')](_0x26b187);return _0x3daf6a[_0xd5e8('0x25')](_0xd5e8('0x26'),_0x7370d3+'-'+_0x36ee49+'/'+_0x196648)[_0xd5e8('0x27')](_0x529d45);}return null;};}function patchUpdates(_0x33a4ff){return function(_0x49c411){try{jsonpatch[_0xd5e8('0x28')](_0x49c411,_0x33a4ff,!![]);}catch(_0x4592e5){return BPromise['reject'](_0x4592e5);}return _0x49c411['save']();};}function saveUpdates(_0x5f177c,_0x4ca072){return function(_0x28214f){if(_0x28214f){return _0x28214f['update'](_0x5f177c)[_0xd5e8('0x29')](function(_0x3b1a69){return _0x3b1a69;});}return null;};}function removeEntity(_0x4add91,_0x4efec6){return function(_0x29d415){if(_0x29d415){return _0x29d415[_0xd5e8('0x2a')]()[_0xd5e8('0x29')](function(){_0x4add91[_0xd5e8('0x20')](0xcc)[_0xd5e8('0x2b')]();});}};}function handleEntityNotFound(_0x314352,_0x3cb0ea){return function(_0x2b7244){if(!_0x2b7244){_0x314352[_0xd5e8('0x1f')](0x194);}return _0x2b7244;};}function handleError(_0x583ea1,_0x46b78d){_0x46b78d=_0x46b78d||0x1f4;return function(_0x570e6a){logger[_0xd5e8('0x2c')](_0x570e6a[_0xd5e8('0x2d')]);if(_0x570e6a[_0xd5e8('0x2e')]){delete _0x570e6a[_0xd5e8('0x2e')];}_0x583ea1[_0xd5e8('0x20')](_0x46b78d)['send'](_0x570e6a);};}exports[_0xd5e8('0x2f')]=function(_0x3d2e7b,_0x49276c){var _0x315955={'raw':![],'where':{'id':_0x3d2e7b[_0xd5e8('0x30')]['id']}},_0x5d4b1c={};_0x5d4b1c[_0xd5e8('0x31')]=_[_0xd5e8('0x32')](db[_0xd5e8('0x33')][_0xd5e8('0x34')]);_0x5d4b1c[_0xd5e8('0x35')]=_[_0xd5e8('0x32')](_0x3d2e7b[_0xd5e8('0x35')]);_0x5d4b1c['filters']=_[_0xd5e8('0x36')](_0x5d4b1c[_0xd5e8('0x31')],_0x5d4b1c[_0xd5e8('0x35')]);_0x315955[_0xd5e8('0x37')]=_[_0xd5e8('0x36')](_0x5d4b1c[_0xd5e8('0x31')],qs[_0xd5e8('0x38')](_0x3d2e7b[_0xd5e8('0x35')]['fields']));_0x315955['attributes']=_0x315955['attributes'][_0xd5e8('0x39')]?_0x315955[_0xd5e8('0x37')]:_0x5d4b1c[_0xd5e8('0x31')];if(_0x3d2e7b[_0xd5e8('0x35')][_0xd5e8('0x3a')]){_0x315955[_0xd5e8('0x3b')]=[{'all':!![]}];}_0x315955=_[_0xd5e8('0x3c')]({},_0x315955,_0x3d2e7b['options']);return db['DashboardItem'][_0xd5e8('0x3d')](_0x315955)[_0xd5e8('0x29')](handleEntityNotFound(_0x49276c,null))[_0xd5e8('0x29')](respondWithResult(_0x49276c,null))[_0xd5e8('0x3e')](handleError(_0x49276c,null));};exports[_0xd5e8('0x2a')]=function(_0x37b5c5,_0x3b6d13){return db[_0xd5e8('0x33')][_0xd5e8('0x3d')]({'where':{'id':_0x37b5c5[_0xd5e8('0x30')]['id']}})[_0xd5e8('0x29')](handleEntityNotFound(_0x3b6d13,null))['then'](removeEntity(_0x3b6d13,null))[_0xd5e8('0x3e')](handleError(_0x3b6d13,null));};function widgetAttributes(_0x569f00){try{switch(_0x569f00[_0xd5e8('0x3f')]){case'iframe':return[{'name':_0xd5e8('0x40'),'value':_0x569f00['attrUrl']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x0]?_0x569f00[_0xd5e8('0x41')][0x0][_0xd5e8('0x42')]:undefined)||_0xd5e8('0x43')}];case _0xd5e8('0x44'):return[{'name':'attrPath','value':_0x569f00['attrPath']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x0]?_0x569f00['attrs'][0x0]['value']:undefined)||''}];case _0xd5e8('0x45'):return[{'name':_0xd5e8('0x46'),'value':_0x569f00[_0xd5e8('0x46')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x0]?_0x569f00[_0xd5e8('0x41')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xd5e8('0x47'),'value':_0x569f00[_0xd5e8('0x47')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x1]?_0x569f00[_0xd5e8('0x41')][0x1][_0xd5e8('0x42')]:undefined)||_0xd5e8('0x48')},{'name':_0xd5e8('0x49'),'value':_0x569f00[_0xd5e8('0x49')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x2]?_0x569f00[_0xd5e8('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xd5e8('0x4a'),'value':_0x569f00[_0xd5e8('0x4a')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00['attrs'][0x0]?_0x569f00['attrs'][0x0][_0xd5e8('0x42')]:undefined)||_0xd5e8('0x4b')},{'name':'attrVoiceQueues','value':_0x569f00[_0xd5e8('0x4c')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x1]?_0x569f00[_0xd5e8('0x41')][0x1][_0xd5e8('0x42')]:undefined)||[]},{'name':_0xd5e8('0x49'),'value':_0x569f00[_0xd5e8('0x49')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x2]?_0x569f00[_0xd5e8('0x41')][0x2][_0xd5e8('0x42')]:undefined)||0x14},{'name':_0xd5e8('0x4d'),'value':_0x569f00[_0xd5e8('0x4d')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x3]?_0x569f00[_0xd5e8('0x41')][0x3]['value']:undefined)||_0xd5e8('0x4e')},{'name':_0xd5e8('0x4f'),'value':_0x569f00[_0xd5e8('0x4f')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x4]?_0x569f00['attrs'][0x4][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x50'),'value':_0x569f00[_0xd5e8('0x50')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00['attrs'][0x5]?_0x569f00[_0xd5e8('0x41')][0x5][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x51'),'value':_0x569f00['attrSmsAccounts']||(_0x569f00['attrs']&&_0x569f00['attrs'][0x6]?_0x569f00['attrs'][0x6][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x52'),'value':_0x569f00[_0xd5e8('0x52')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x7]?_0x569f00[_0xd5e8('0x41')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x569f00['attrWhatsappAccounts']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x8]?_0x569f00[_0xd5e8('0x41')][0x8][_0xd5e8('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x569f00[_0xd5e8('0x53')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x9]?_0x569f00[_0xd5e8('0x41')][0x9][_0xd5e8('0x42')]:undefined)||''}];case _0xd5e8('0x54'):case _0xd5e8('0x55'):return[{'name':'attrSerie1','value':_0x569f00[_0xd5e8('0x56')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00['attrs'][0x0]?_0x569f00[_0xd5e8('0x41')][0x0][_0xd5e8('0x42')]:undefined)||'total'},{'name':_0xd5e8('0x57'),'value':_0x569f00['attrSerie2']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x1]?_0x569f00['attrs'][0x1]['value']:undefined)||null},{'name':_0xd5e8('0x58'),'value':_0x569f00[_0xd5e8('0x58')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x2]?_0x569f00[_0xd5e8('0x41')][0x2]['value']:undefined)||null},{'name':_0xd5e8('0x4c'),'value':_0x569f00[_0xd5e8('0x4c')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x3]?_0x569f00[_0xd5e8('0x41')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x569f00[_0xd5e8('0x4d')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x4]?_0x569f00[_0xd5e8('0x41')][0x4][_0xd5e8('0x42')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x569f00[_0xd5e8('0x4f')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x5]?_0x569f00[_0xd5e8('0x41')][0x5][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x50'),'value':_0x569f00['attrFaxAccounts']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x6]?_0x569f00[_0xd5e8('0x41')][0x6][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x51'),'value':_0x569f00[_0xd5e8('0x51')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x7]?_0x569f00[_0xd5e8('0x41')][0x7][_0xd5e8('0x42')]:undefined)||''},{'name':_0xd5e8('0x52'),'value':_0x569f00['attrOpenchannelAccounts']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x8]?_0x569f00[_0xd5e8('0x41')][0x8][_0xd5e8('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x569f00[_0xd5e8('0x59')]||(_0x569f00['attrs']&&_0x569f00[_0xd5e8('0x41')][0x9]?_0x569f00[_0xd5e8('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x569f00['attrChatWebsites']||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00['attrs'][0xa]?_0x569f00[_0xd5e8('0x41')][0xa][_0xd5e8('0x42')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x569f00[_0xd5e8('0x5a')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x0]?_0x569f00[_0xd5e8('0x41')][0x0][_0xd5e8('0x3f')]:undefined)||null,'value':_0x569f00[_0xd5e8('0x5b')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x0]?_0x569f00['attrs'][0x0][_0xd5e8('0x42')]:undefined)||null},{'name':_0xd5e8('0x5c'),'value':_0x569f00[_0xd5e8('0x5c')]||(_0x569f00[_0xd5e8('0x41')]&&_0x569f00[_0xd5e8('0x41')][0x1]?_0x569f00[_0xd5e8('0x41')][0x1][_0xd5e8('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x4855c7){logger[_0xd5e8('0x2c')](_0xd5e8('0x5d'),JSON['stringify'](_0x4855c7));return[];}}exports[_0xd5e8('0x5e')]=function(_0x40f074,_0xf2a367){if(_0x40f074[_0xd5e8('0x5f')]){_0x40f074[_0xd5e8('0x5f')][_0xd5e8('0x41')]=widgetAttributes(_0x40f074[_0xd5e8('0x5f')]);}return db['DashboardItem'][_0xd5e8('0x5e')](_0x40f074[_0xd5e8('0x5f')],{})['then'](respondWithResult(_0xf2a367,0xc9))[_0xd5e8('0x3e')](handleError(_0xf2a367,null));};exports[_0xd5e8('0x60')]=function(_0x16eaee,_0x4233ec){if(_0x16eaee['body']['id']){delete _0x16eaee[_0xd5e8('0x5f')]['id'];}_0x16eaee[_0xd5e8('0x5f')][_0xd5e8('0x41')]=widgetAttributes(_0x16eaee[_0xd5e8('0x5f')]);return db['DashboardItem'][_0xd5e8('0x3d')]({'where':{'id':_0x16eaee['params']['id']}})[_0xd5e8('0x29')](handleEntityNotFound(_0x4233ec,null))[_0xd5e8('0x29')](saveUpdates(_0x16eaee[_0xd5e8('0x5f')],null))[_0xd5e8('0x29')](respondWithResult(_0x4233ec,null))['catch'](handleError(_0x4233ec,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1457d14..522c8b9 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 _0x4260=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x4ed9ef,_0x381176){var _0x2bb85b=function(_0x35c24d){while(--_0x35c24d){_0x4ed9ef['push'](_0x4ed9ef['shift']());}};_0x2bb85b(++_0x381176);}(_0x4260,0x98));var _0x0426=function(_0x237f49,_0x5f32aa){_0x237f49=_0x237f49-0x0;var _0x480824=_0x4260[_0x237f49];return _0x480824;};'use strict';var EventEmitter=require(_0x0426('0x0'));var DashboardItem=require(_0x0426('0x1'))['db'][_0x0426('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0426('0x3')](0x0);var events={'afterCreate':_0x0426('0x4'),'afterUpdate':_0x0426('0x5'),'afterDestroy':_0x0426('0x6')};function emitEvent(_0x4b3b7d){return function(_0x110f72,_0x302241,_0x5f0352){DashboardItemEvents[_0x0426('0x7')](_0x4b3b7d+':'+_0x110f72['id'],_0x110f72);DashboardItemEvents[_0x0426('0x7')](_0x4b3b7d,_0x110f72);_0x5f0352(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x0426('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x46a9=['emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x46dd05,_0x108989){var _0x1cdfb0=function(_0x767cbc){while(--_0x767cbc){_0x46dd05['push'](_0x46dd05['shift']());}};_0x1cdfb0(++_0x108989);}(_0x46a9,0x162));var _0x946a=function(_0x2c6839,_0x3a4f30){_0x2c6839=_0x2c6839-0x0;var _0x19a865=_0x46a9[_0x2c6839];return _0x19a865;};'use strict';var EventEmitter=require(_0x946a('0x0'));var DashboardItem=require(_0x946a('0x1'))['db'][_0x946a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x946a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x946a('0x4'),'afterDestroy':_0x946a('0x5')};function emitEvent(_0x33e16f){return function(_0x3ed675,_0x550235,_0x3ec39a){DashboardItemEvents[_0x946a('0x6')](_0x33e16f+':'+_0x3ed675['id'],_0x3ed675);DashboardItemEvents[_0x946a('0x6')](_0x33e16f,_0x3ed675);_0x3ec39a(null);};}for(var e in events){if(events[_0x946a('0x7')](e)){var event=events[e];DashboardItem[_0x946a('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 7e94b3c..0deafb4 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 _0x6a73=['dashboard_items','lodash','util','bluebird','request-promise','rimraf','./dashboardItem.attributes','DashboardItem'];(function(_0x432b9d,_0x2c3d74){var _0x2e5770=function(_0x2747d1){while(--_0x2747d1){_0x432b9d['push'](_0x432b9d['shift']());}};_0x2e5770(++_0x2c3d74);}(_0x6a73,0x171));var _0x36a7=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x6a73[_0x57db49];return _0xd0636f;};'use strict';var _=require(_0x36a7('0x0'));var util=require(_0x36a7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x36a7('0x2'));var rp=require(_0x36a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36a7('0x4'));var config=require('../../config/environment');var attributes=require(_0x36a7('0x5'));module['exports']=function(_0x23ecdb,_0x1ef676){return _0x23ecdb['define'](_0x36a7('0x6'),attributes,{'tableName':_0x36a7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb08b=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem'];(function(_0x211832,_0x116d80){var _0x585ffe=function(_0x5f24c0){while(--_0x5f24c0){_0x211832['push'](_0x211832['shift']());}};_0x585ffe(++_0x116d80);}(_0xb08b,0x181));var _0xbb08=function(_0x38cca1,_0x485df1){_0x38cca1=_0x38cca1-0x0;var _0x29969e=_0xb08b[_0x38cca1];return _0x29969e;};'use strict';var _=require('lodash');var util=require(_0xbb08('0x0'));var logger=require(_0xbb08('0x1'))(_0xbb08('0x2'));var moment=require(_0xbb08('0x3'));var BPromise=require(_0xbb08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb08('0x5'));var rimraf=require(_0xbb08('0x6'));var config=require(_0xbb08('0x7'));var attributes=require(_0xbb08('0x8'));module['exports']=function(_0x47454d,_0x21bc25){return _0x47454d[_0xbb08('0x9')](_0xbb08('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4bdff13..5e67acc 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 _0xc24e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','util','randomstring','../../mysqldb'];(function(_0x3bb571,_0x32cfb7){var _0x54ff33=function(_0x447f2f){while(--_0x447f2f){_0x3bb571['push'](_0x3bb571['shift']());}};_0x54ff33(++_0x32cfb7);}(_0xc24e,0x183));var _0xec24=function(_0x164726,_0x11f6d3){_0x164726=_0x164726-0x0;var _0x29150a=_0xc24e[_0x164726];return _0x29150a;};'use strict';var _=require('lodash');var util=require(_0xec24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec24('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec24('0x2'))['db'];var utils=require(_0xec24('0x3'));var logger=require(_0xec24('0x4'))('rpc');var config=require(_0xec24('0x5'));var jayson=require(_0xec24('0x6'));var client=jayson[_0xec24('0x7')][_0xec24('0x8')]({'port':0x232a});config[_0xec24('0x9')]=_[_0xec24('0xa')](config[_0xec24('0x9')],{'host':_0xec24('0xb'),'port':0x18eb});var socket=require(_0xec24('0xc'))(new Redis(config[_0xec24('0x9')]));require(_0xec24('0xd'))[_0xec24('0xe')](socket);function respondWithRpcPromise(_0x2719f3,_0x4d533f,_0x1c3417){return new BPromise(function(_0x2e56a0,_0x4ea495){return client[_0xec24('0xf')](_0x2719f3,_0x1c3417)[_0xec24('0x10')](function(_0x5504d0){logger[_0xec24('0x11')]('DashboardItem,\x20%s,\x20%s',_0x4d533f,_0xec24('0x12'));logger[_0xec24('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4d533f,'request\x20sent',JSON[_0xec24('0x14')](_0x5504d0));if(_0x5504d0[_0xec24('0x15')]){if(_0x5504d0[_0xec24('0x15')][_0xec24('0x16')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x4d533f,_0x5504d0[_0xec24('0x15')]['message']);return _0x4ea495(_0x5504d0[_0xec24('0x15')][_0xec24('0x17')]);}logger[_0xec24('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4d533f,_0x5504d0[_0xec24('0x15')][_0xec24('0x17')]);return _0x2e56a0(_0x5504d0[_0xec24('0x15')][_0xec24('0x17')]);}else{logger[_0xec24('0x11')](_0xec24('0x18'),_0x4d533f,_0xec24('0x12'));_0x2e56a0(_0x5504d0[_0xec24('0x19')]['message']);}})['catch'](function(_0x328db1){logger[_0xec24('0x15')](_0xec24('0x18'),_0x4d533f,_0x328db1);_0x4ea495(_0x328db1);});});} \ No newline at end of file +var _0x732e=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x732e,0x154));var _0xe732=function(_0x49c699,_0x314403){_0x49c699=_0x49c699-0x0;var _0x2853ea=_0x732e[_0x49c699];return _0x2853ea;};'use strict';var _=require(_0xe732('0x0'));var util=require(_0xe732('0x1'));var moment=require(_0xe732('0x2'));var BPromise=require(_0xe732('0x3'));var rs=require(_0xe732('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe732('0x5'))['db'];var utils=require(_0xe732('0x6'));var logger=require(_0xe732('0x7'))(_0xe732('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe732('0x9')]['http']({'port':0x232a});config[_0xe732('0xa')]=_[_0xe732('0xb')](config[_0xe732('0xa')],{'host':_0xe732('0xc'),'port':0x18eb});var socket=require(_0xe732('0xd'))(new Redis(config['redis']));require(_0xe732('0xe'))[_0xe732('0xf')](socket);function respondWithRpcPromise(_0x124f92,_0x5281a0,_0x4bb158){return new BPromise(function(_0x3f1ffa,_0x2b05d3){return client['request'](_0x124f92,_0x4bb158)[_0xe732('0x10')](function(_0x4d8b70){logger[_0xe732('0x11')](_0xe732('0x12'),_0x5281a0,_0xe732('0x13'));logger[_0xe732('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5281a0,_0xe732('0x13'),JSON[_0xe732('0x15')](_0x4d8b70));if(_0x4d8b70[_0xe732('0x16')]){if(_0x4d8b70[_0xe732('0x16')][_0xe732('0x17')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x5281a0,_0x4d8b70[_0xe732('0x16')][_0xe732('0x18')]);return _0x2b05d3(_0x4d8b70[_0xe732('0x16')][_0xe732('0x18')]);}logger[_0xe732('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5281a0,_0x4d8b70['error']['message']);return _0x3f1ffa(_0x4d8b70[_0xe732('0x16')][_0xe732('0x18')]);}else{logger[_0xe732('0x11')]('DashboardItem,\x20%s,\x20%s',_0x5281a0,_0xe732('0x13'));_0x3f1ffa(_0x4d8b70[_0xe732('0x19')][_0xe732('0x18')]);}})[_0xe732('0x1a')](function(_0x4ae6cb){logger[_0xe732('0x16')](_0xe732('0x12'),_0x5281a0,_0x4ae6cb);_0x2b05d3(_0x4ae6cb);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 77faa15..6547d5a 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 _0x95a6=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x3b86d5,_0x2264a2){var _0x527c20=function(_0x29f33c){while(--_0x29f33c){_0x3b86d5['push'](_0x3b86d5['shift']());}};_0x527c20(++_0x2264a2);}(_0x95a6,0x10e));var _0x695a=function(_0x526d51,_0x22fa21){_0x526d51=_0x526d51-0x0;var _0x545b1d=_0x95a6[_0x526d51];return _0x545b1d;};'use strict';var DashboardItemEvents=require(_0x695a('0x0'));var events=[_0x695a('0x1'),'remove',_0x695a('0x2')];function createListener(_0x4d6889,_0x39f1fb){return function(_0x91c8b9){_0x39f1fb[_0x695a('0x3')](_0x4d6889,_0x91c8b9);};}function removeListener(_0x45571f,_0x3add7f){return function(){DashboardItemEvents[_0x695a('0x4')](_0x45571f,_0x3add7f);};}exports[_0x695a('0x5')]=function(_0x3a4e69){for(var _0x50c82d=0x0,_0x3bfac2=events['length'];_0x50c82d<_0x3bfac2;_0x50c82d++){var _0x4b0e69=events[_0x50c82d];var _0x1530b7=createListener(_0x695a('0x6')+_0x4b0e69,_0x3a4e69);DashboardItemEvents['on'](_0x4b0e69,_0x1530b7);}}; \ No newline at end of file +var _0xed2e=['removeListener','register','dashboardItem:','./dashboardItem.events','remove','emit'];(function(_0x4dec59,_0x28bc87){var _0x12424f=function(_0x25f689){while(--_0x25f689){_0x4dec59['push'](_0x4dec59['shift']());}};_0x12424f(++_0x28bc87);}(_0xed2e,0x17d));var _0xeed2=function(_0x502482,_0x4f5625){_0x502482=_0x502482-0x0;var _0x390433=_0xed2e[_0x502482];return _0x390433;};'use strict';var DashboardItemEvents=require(_0xeed2('0x0'));var events=['save',_0xeed2('0x1'),'update'];function createListener(_0x36561c,_0x41c17e){return function(_0x1d09fa){_0x41c17e[_0xeed2('0x2')](_0x36561c,_0x1d09fa);};}function removeListener(_0x1b336f,_0x40e80b){return function(){DashboardItemEvents[_0xeed2('0x3')](_0x1b336f,_0x40e80b);};}exports[_0xeed2('0x4')]=function(_0x144744){for(var _0xa7b14c=0x0,_0x486783=events['length'];_0xa7b14c<_0x486783;_0xa7b14c++){var _0x219242=events[_0xa7b14c];var _0x1f895b=createListener(_0xeed2('0x5')+_0x219242,_0x144744);DashboardItemEvents['on'](_0x219242,_0x1f895b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index dec056f..d324e4e 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 _0x454a=['create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x454a,0xae));var _0xa454=function(_0x527666,_0x5009c3){_0x527666=_0x527666-0x0;var _0x359827=_0x454a[_0x527666];return _0x359827;};'use strict';var multer=require(_0xa454('0x0'));var util=require('util');var path=require(_0xa454('0x1'));var timeout=require(_0xa454('0x2'));var express=require(_0xa454('0x3'));var router=express[_0xa454('0x4')]();var fs_extra=require(_0xa454('0x5'));var auth=require(_0xa454('0x6'));var interaction=require(_0xa454('0x7'));var config=require(_0xa454('0x8'));var controller=require('./dashboardItem.controller');router[_0xa454('0x9')](_0xa454('0xa'),auth[_0xa454('0xb')](),controller['show']);router[_0xa454('0xc')]('/',auth[_0xa454('0xb')](),controller[_0xa454('0xd')]);router[_0xa454('0xe')](_0xa454('0xa'),auth[_0xa454('0xb')](),controller[_0xa454('0xf')]);router[_0xa454('0x10')](_0xa454('0xa'),auth[_0xa454('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0b8b=['/:id','show','post','put','update','delete','isAuthenticated','exports','multer','util','Router','../../components/interaction/service','./dashboardItem.controller','get'];(function(_0x1b36ef,_0x229735){var _0x13899e=function(_0x1ae5f5){while(--_0x1ae5f5){_0x1b36ef['push'](_0x1b36ef['shift']());}};_0x13899e(++_0x229735);}(_0x0b8b,0x174));var _0xb0b8=function(_0x511c1f,_0x4cf980){_0x511c1f=_0x511c1f-0x0;var _0x28a239=_0x0b8b[_0x511c1f];return _0x28a239;};'use strict';var multer=require(_0xb0b8('0x0'));var util=require(_0xb0b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0b8('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0b8('0x3'));var config=require('../../config/environment');var controller=require(_0xb0b8('0x4'));router[_0xb0b8('0x5')](_0xb0b8('0x6'),auth['isAuthenticated'](),controller[_0xb0b8('0x7')]);router[_0xb0b8('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb0b8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb0b8('0xa')]);router[_0xb0b8('0xb')](_0xb0b8('0x6'),auth[_0xb0b8('0xc')](),controller['destroy']);module[_0xb0b8('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index fb34296..50f5b90 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 _0x1e5b=['exports','ENUM','first','second','STRING'];(function(_0x20ff08,_0x33b79f){var _0x37a85f=function(_0xa8b024){while(--_0xa8b024){_0x20ff08['push'](_0x20ff08['shift']());}};_0x37a85f(++_0x33b79f);}(_0x1e5b,0x82));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb1e5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xb1e5('0x1')](_0xb1e5('0x2'),_0xb1e5('0x3'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xb1e5('0x4')]}}; \ No newline at end of file +var _0x763b=['third','sequelize','exports','STRING','ENUM','second'];(function(_0x4f9dd3,_0xd1ef53){var _0x467cd6=function(_0x4b7158){while(--_0x4b7158){_0x4f9dd3['push'](_0x4f9dd3['shift']());}};_0x467cd6(++_0xd1ef53);}(_0x763b,0x1ab));var _0xb763=function(_0x582939,_0x488566){_0x582939=_0x582939-0x0;var _0x27ee9e=_0x763b[_0x582939];return _0x27ee9e;};'use strict';var Sequelize=require(_0xb763('0x0'));module[_0xb763('0x1')]={'name':{'type':Sequelize[_0xb763('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xb763('0x3')]('first',_0xb763('0x4'),_0xb763('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xb763('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e980a01..57bea5f 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 _0x0804=['offset','limit','set','Content-Range','reject','save','destroy','then','Dispositions','UserProfileResource','error','stack','send','map','rawAttributes','key','model','name','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','Disposition','findAll','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count'];(function(_0x861b93,_0x530847){var _0x3e8988=function(_0x290a3f){while(--_0x290a3f){_0x861b93['push'](_0x861b93['shift']());}};_0x3e8988(++_0x530847);}(_0x0804,0x175));var _0x4080=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x0804[_0x2f3794];return _0x1c9fbe;};'use strict';var emlformat=require(_0x4080('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4080('0x1'));var jsonpatch=require(_0x4080('0x2'));var rp=require(_0x4080('0x3'));var moment=require('moment');var BPromise=require(_0x4080('0x4'));var Mustache=require(_0x4080('0x5'));var util=require(_0x4080('0x6'));var path=require(_0x4080('0x7'));var sox=require(_0x4080('0x8'));var csv=require(_0x4080('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4080('0xa'));var _=require(_0x4080('0xb'));var squel=require(_0x4080('0xc'));var crypto=require(_0x4080('0xd'));var jsforce=require(_0x4080('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4080('0xf'));var Papa=require(_0x4080('0x10'));var Redis=require(_0x4080('0x11'));var authService=require(_0x4080('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4080('0x13'));var logger=require(_0x4080('0x14'))(_0x4080('0x15'));var utils=require(_0x4080('0x16'));var config=require(_0x4080('0x17'));var licenseUtil=require(_0x4080('0x18'));var db=require(_0x4080('0x19'))['db'];function respondWithStatusCode(_0x2e2895,_0x79cc8e){_0x79cc8e=_0x79cc8e||0xcc;return function(_0x56cc47){if(_0x56cc47){return _0x2e2895[_0x4080('0x1a')](_0x79cc8e);}return _0x2e2895['status'](_0x79cc8e)[_0x4080('0x1b')]();};}function respondWithResult(_0x237b05,_0x58cc13){_0x58cc13=_0x58cc13||0xc8;return function(_0x3377f2){if(_0x3377f2){return _0x237b05[_0x4080('0x1c')](_0x58cc13)[_0x4080('0x1d')](_0x3377f2);}};}function respondWithFilteredResult(_0x20fa70,_0x14c9b2){return function(_0x43eb6e){if(_0x43eb6e){var _0x686a0d=typeof _0x14c9b2['offset']==='undefined'&&typeof _0x14c9b2['limit']===_0x4080('0x1e');var _0x5874e1=_0x43eb6e[_0x4080('0x1f')];var _0x3a153e=_0x686a0d?0x0:_0x14c9b2[_0x4080('0x20')];var _0x3b104b=_0x686a0d?_0x43eb6e[_0x4080('0x1f')]:_0x14c9b2[_0x4080('0x20')]+_0x14c9b2[_0x4080('0x21')];var _0x288926;if(_0x3b104b>=_0x5874e1){_0x3b104b=_0x5874e1;_0x288926=0xc8;}else{_0x288926=0xce;}_0x20fa70[_0x4080('0x1c')](_0x288926);return _0x20fa70[_0x4080('0x22')](_0x4080('0x23'),_0x3a153e+'-'+_0x3b104b+'/'+_0x5874e1)[_0x4080('0x1d')](_0x43eb6e);}return null;};}function patchUpdates(_0x59b19d){return function(_0x366c36){try{jsonpatch['apply'](_0x366c36,_0x59b19d,!![]);}catch(_0x281d9b){return BPromise[_0x4080('0x24')](_0x281d9b);}return _0x366c36[_0x4080('0x25')]();};}function saveUpdates(_0x361c40,_0x2c2453){return function(_0x3a41ff){if(_0x3a41ff){return _0x3a41ff['update'](_0x361c40)['then'](function(_0x34cf97){return _0x34cf97;});}return null;};}function removeEntity(_0x3b700f,_0x258451){return function(_0x1d075c){if(_0x1d075c){return _0x1d075c[_0x4080('0x26')]()[_0x4080('0x27')](function(){var _0x106693=_0x1d075c['get']({'plain':!![]});var _0x42e00b=_0x4080('0x28');return db[_0x4080('0x29')][_0x4080('0x26')]({'where':{'type':_0x42e00b,'resourceId':_0x106693['id']}})['then'](function(){return _0x1d075c;});})[_0x4080('0x27')](function(){_0x3b700f[_0x4080('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xda29a3,_0x309d5c){return function(_0x249060){if(!_0x249060){_0xda29a3[_0x4080('0x1a')](0x194);}return _0x249060;};}function handleError(_0x33c090,_0x64be3b){_0x64be3b=_0x64be3b||0x1f4;return function(_0x28c12f){logger[_0x4080('0x2a')](_0x28c12f[_0x4080('0x2b')]);if(_0x28c12f['name']){delete _0x28c12f['name'];}_0x33c090['status'](_0x64be3b)[_0x4080('0x2c')](_0x28c12f);};}exports['index']=function(_0x54ca72,_0x262463){var _0x4f58ff={},_0x160d03={},_0x42887f={'count':0x0,'rows':[]};var _0x24aaf3=_[_0x4080('0x2d')](db['Disposition'][_0x4080('0x2e')],function(_0x5ce817){return{'name':_0x5ce817['fieldName'],'type':_0x5ce817['type'][_0x4080('0x2f')]};});_0x160d03[_0x4080('0x30')]=_[_0x4080('0x2d')](_0x24aaf3,_0x4080('0x31'));_0x160d03[_0x4080('0x32')]=_['keys'](_0x54ca72[_0x4080('0x32')]);_0x160d03[_0x4080('0x33')]=_[_0x4080('0x34')](_0x160d03['model'],_0x160d03['query']);_0x4f58ff[_0x4080('0x35')]=_['intersection'](_0x160d03[_0x4080('0x30')],qs['fields'](_0x54ca72[_0x4080('0x32')]['fields']));_0x4f58ff[_0x4080('0x35')]=_0x4f58ff[_0x4080('0x35')]['length']?_0x4f58ff[_0x4080('0x35')]:_0x160d03[_0x4080('0x30')];if(!_0x54ca72[_0x4080('0x32')][_0x4080('0x36')](_0x4080('0x37'))){_0x4f58ff['limit']=qs[_0x4080('0x21')](_0x54ca72[_0x4080('0x32')][_0x4080('0x21')]);_0x4f58ff['offset']=qs[_0x4080('0x20')](_0x54ca72['query'][_0x4080('0x20')]);}_0x4f58ff[_0x4080('0x38')]=qs['sort'](_0x54ca72[_0x4080('0x32')][_0x4080('0x39')]);_0x4f58ff['where']=qs[_0x4080('0x33')](_[_0x4080('0x3a')](_0x54ca72[_0x4080('0x32')],_0x160d03[_0x4080('0x33')]),_0x24aaf3);if(_0x54ca72[_0x4080('0x32')][_0x4080('0x3b')]){_0x4f58ff[_0x4080('0x3c')]=_[_0x4080('0x3d')](_0x4f58ff['where'],{'$or':_[_0x4080('0x2d')](_0x24aaf3,function(_0x2ce308){if(_0x2ce308[_0x4080('0x3e')]!=='VIRTUAL'){var _0x471b6d={};_0x471b6d[_0x2ce308['name']]={'$like':'%'+_0x54ca72[_0x4080('0x32')][_0x4080('0x3b')]+'%'};return _0x471b6d;}})});}_0x4f58ff=_['merge']({},_0x4f58ff,_0x54ca72[_0x4080('0x3f')]);var _0x13b0ec={'where':_0x4f58ff[_0x4080('0x3c')]};return db[_0x4080('0x40')][_0x4080('0x1f')](_0x13b0ec)[_0x4080('0x27')](function(_0x365d51){_0x42887f[_0x4080('0x1f')]=_0x365d51;if(_0x54ca72[_0x4080('0x32')]['includeAll']){_0x4f58ff['include']=[{'all':!![]}];}return db[_0x4080('0x40')][_0x4080('0x41')](_0x4f58ff);})[_0x4080('0x27')](function(_0x1bc296){_0x42887f['rows']=_0x1bc296;return _0x42887f;})[_0x4080('0x27')](respondWithFilteredResult(_0x262463,_0x4f58ff))['catch'](handleError(_0x262463,null));};exports['show']=function(_0x278495,_0x4ba5d6){var _0x2cef49={'raw':!![],'where':{'id':_0x278495[_0x4080('0x42')]['id']}},_0x308340={};_0x308340[_0x4080('0x30')]=_['keys'](db['Disposition']['rawAttributes']);_0x308340['query']=_[_0x4080('0x43')](_0x278495[_0x4080('0x32')]);_0x308340[_0x4080('0x33')]=_[_0x4080('0x34')](_0x308340[_0x4080('0x30')],_0x308340['query']);_0x2cef49[_0x4080('0x35')]=_[_0x4080('0x34')](_0x308340[_0x4080('0x30')],qs['fields'](_0x278495[_0x4080('0x32')]['fields']));_0x2cef49['attributes']=_0x2cef49['attributes']['length']?_0x2cef49[_0x4080('0x35')]:_0x308340[_0x4080('0x30')];if(_0x278495[_0x4080('0x32')]['includeAll']){_0x2cef49[_0x4080('0x44')]=[{'all':!![]}];}_0x2cef49=_[_0x4080('0x3d')]({},_0x2cef49,_0x278495['options']);return db[_0x4080('0x40')][_0x4080('0x45')](_0x2cef49)[_0x4080('0x27')](handleEntityNotFound(_0x4ba5d6,null))['then'](respondWithResult(_0x4ba5d6,null))[_0x4080('0x46')](handleError(_0x4ba5d6,null));};exports[_0x4080('0x47')]=function(_0x213f45,_0x58202b){return db[_0x4080('0x40')][_0x4080('0x47')](_0x213f45[_0x4080('0x48')],{})['then'](function(_0x4d465b){var _0x145e49=_0x213f45[_0x4080('0x49')]['get']({'plain':!![]});if(!_0x145e49)throw new Error(_0x4080('0x4a'));if(_0x145e49[_0x4080('0x4b')]===_0x4080('0x49')){var _0x30b362=_0x4d465b[_0x4080('0x4c')]({'plain':!![]});var _0x648e80=_0x4080('0x28');return db[_0x4080('0x4d')]['find']({'where':{'name':_0x648e80,'userProfileId':_0x145e49[_0x4080('0x4e')]},'raw':!![]})[_0x4080('0x27')](function(_0x4dde66){if(_0x4dde66&&_0x4dde66[_0x4080('0x4f')]===0x0){return db['UserProfileResource'][_0x4080('0x47')]({'name':_0x30b362['name'],'resourceId':_0x30b362['id'],'type':_0x4dde66['name'],'sectionId':_0x4dde66['id']},{})[_0x4080('0x27')](function(){return _0x4d465b;});}else{return _0x4d465b;}})[_0x4080('0x46')](function(_0xc0f54d){logger['error'](_0x4080('0x50'),_0xc0f54d);throw _0xc0f54d;});}return _0x4d465b;})[_0x4080('0x27')](respondWithResult(_0x58202b,0xc9))[_0x4080('0x46')](handleError(_0x58202b,null));};exports['update']=function(_0x4ff9ae,_0xbcbfb1){if(_0x4ff9ae[_0x4080('0x48')]['id']){delete _0x4ff9ae[_0x4080('0x48')]['id'];}return db[_0x4080('0x40')][_0x4080('0x45')]({'where':{'id':_0x4ff9ae[_0x4080('0x42')]['id']}})[_0x4080('0x27')](handleEntityNotFound(_0xbcbfb1,null))[_0x4080('0x27')](saveUpdates(_0x4ff9ae[_0x4080('0x48')],null))[_0x4080('0x27')](respondWithResult(_0xbcbfb1,null))[_0x4080('0x46')](handleError(_0xbcbfb1,null));};exports[_0x4080('0x26')]=function(_0x254bb7,_0x15a2f3){return db['Disposition'][_0x4080('0x45')]({'where':{'id':_0x254bb7[_0x4080('0x42')]['id']}})[_0x4080('0x27')](handleEntityNotFound(_0x15a2f3,null))[_0x4080('0x27')](removeEntity(_0x15a2f3,null))[_0x4080('0x46')](handleError(_0x15a2f3,null));}; \ No newline at end of file +var _0x0c48=['../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x4c2401,_0x4c7a4c){var _0x258245=function(_0x390611){while(--_0x390611){_0x4c2401['push'](_0x4c2401['shift']());}};_0x258245(++_0x4c7a4c);}(_0x0c48,0xed));var _0x80c4=function(_0x1fbf37,_0x98c6db){_0x1fbf37=_0x1fbf37-0x0;var _0x578424=_0x0c48[_0x1fbf37];return _0x578424;};'use strict';var emlformat=require(_0x80c4('0x0'));var rimraf=require(_0x80c4('0x1'));var zipdir=require(_0x80c4('0x2'));var jsonpatch=require(_0x80c4('0x3'));var rp=require(_0x80c4('0x4'));var moment=require(_0x80c4('0x5'));var BPromise=require(_0x80c4('0x6'));var Mustache=require(_0x80c4('0x7'));var util=require(_0x80c4('0x8'));var path=require(_0x80c4('0x9'));var sox=require(_0x80c4('0xa'));var csv=require(_0x80c4('0xb'));var ejs=require(_0x80c4('0xc'));var fs=require('fs');var fs_extra=require(_0x80c4('0xd'));var _=require(_0x80c4('0xe'));var squel=require(_0x80c4('0xf'));var crypto=require('crypto');var jsforce=require(_0x80c4('0x10'));var deskjs=require(_0x80c4('0x11'));var toCsv=require(_0x80c4('0xb'));var querystring=require(_0x80c4('0x12'));var Papa=require(_0x80c4('0x13'));var Redis=require(_0x80c4('0x14'));var authService=require(_0x80c4('0x15'));var qs=require(_0x80c4('0x16'));var as=require(_0x80c4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80c4('0x18'));var utils=require('../../config/utils');var config=require(_0x80c4('0x19'));var licenseUtil=require(_0x80c4('0x1a'));var db=require(_0x80c4('0x1b'))['db'];function respondWithStatusCode(_0x9384f7,_0x1e2b05){_0x1e2b05=_0x1e2b05||0xcc;return function(_0x5c6d7a){if(_0x5c6d7a){return _0x9384f7[_0x80c4('0x1c')](_0x1e2b05);}return _0x9384f7[_0x80c4('0x1d')](_0x1e2b05)[_0x80c4('0x1e')]();};}function respondWithResult(_0xa584c1,_0x5849b0){_0x5849b0=_0x5849b0||0xc8;return function(_0xa92a44){if(_0xa92a44){return _0xa584c1[_0x80c4('0x1d')](_0x5849b0)['json'](_0xa92a44);}};}function respondWithFilteredResult(_0x2ee1dc,_0x3b8768){return function(_0x59139b){if(_0x59139b){var _0x22549c=typeof _0x3b8768[_0x80c4('0x1f')]===_0x80c4('0x20')&&typeof _0x3b8768['limit']===_0x80c4('0x20');var _0x9d8302=_0x59139b[_0x80c4('0x21')];var _0x537f42=_0x22549c?0x0:_0x3b8768[_0x80c4('0x1f')];var _0x5b247a=_0x22549c?_0x59139b[_0x80c4('0x21')]:_0x3b8768[_0x80c4('0x1f')]+_0x3b8768[_0x80c4('0x22')];var _0x5aebc9;if(_0x5b247a>=_0x9d8302){_0x5b247a=_0x9d8302;_0x5aebc9=0xc8;}else{_0x5aebc9=0xce;}_0x2ee1dc['status'](_0x5aebc9);return _0x2ee1dc[_0x80c4('0x23')](_0x80c4('0x24'),_0x537f42+'-'+_0x5b247a+'/'+_0x9d8302)['json'](_0x59139b);}return null;};}function patchUpdates(_0x17e644){return function(_0x3e3a32){try{jsonpatch[_0x80c4('0x25')](_0x3e3a32,_0x17e644,!![]);}catch(_0x2b07a1){return BPromise[_0x80c4('0x26')](_0x2b07a1);}return _0x3e3a32[_0x80c4('0x27')]();};}function saveUpdates(_0x24de51,_0x33849a){return function(_0x540909){if(_0x540909){return _0x540909[_0x80c4('0x28')](_0x24de51)[_0x80c4('0x29')](function(_0x2798db){return _0x2798db;});}return null;};}function removeEntity(_0x349579,_0x2f9108){return function(_0x27f9a0){if(_0x27f9a0){return _0x27f9a0[_0x80c4('0x2a')]()['then'](function(){var _0x1e8bed=_0x27f9a0['get']({'plain':!![]});var _0x3c6b79=_0x80c4('0x2b');return db[_0x80c4('0x2c')][_0x80c4('0x2a')]({'where':{'type':_0x3c6b79,'resourceId':_0x1e8bed['id']}})[_0x80c4('0x29')](function(){return _0x27f9a0;});})[_0x80c4('0x29')](function(){_0x349579[_0x80c4('0x1d')](0xcc)[_0x80c4('0x1e')]();});}};}function handleEntityNotFound(_0x4cb408,_0x76b610){return function(_0x4bc391){if(!_0x4bc391){_0x4cb408[_0x80c4('0x1c')](0x194);}return _0x4bc391;};}function handleError(_0x23a08c,_0x27b9f9){_0x27b9f9=_0x27b9f9||0x1f4;return function(_0x23fe5f){logger[_0x80c4('0x2d')](_0x23fe5f[_0x80c4('0x2e')]);if(_0x23fe5f[_0x80c4('0x2f')]){delete _0x23fe5f['name'];}_0x23a08c['status'](_0x27b9f9)[_0x80c4('0x30')](_0x23fe5f);};}exports['index']=function(_0x9043ae,_0x8e7c48){var _0x8f9f2c={},_0x45f20f={},_0x41f279={'count':0x0,'rows':[]};var _0x44d862=_['map'](db[_0x80c4('0x31')][_0x80c4('0x32')],function(_0x4bcb1a){return{'name':_0x4bcb1a[_0x80c4('0x33')],'type':_0x4bcb1a[_0x80c4('0x34')][_0x80c4('0x35')]};});_0x45f20f[_0x80c4('0x36')]=_[_0x80c4('0x37')](_0x44d862,_0x80c4('0x2f'));_0x45f20f[_0x80c4('0x38')]=_[_0x80c4('0x39')](_0x9043ae[_0x80c4('0x38')]);_0x45f20f[_0x80c4('0x3a')]=_['intersection'](_0x45f20f[_0x80c4('0x36')],_0x45f20f['query']);_0x8f9f2c[_0x80c4('0x3b')]=_[_0x80c4('0x3c')](_0x45f20f[_0x80c4('0x36')],qs['fields'](_0x9043ae['query'][_0x80c4('0x3d')]));_0x8f9f2c['attributes']=_0x8f9f2c[_0x80c4('0x3b')]['length']?_0x8f9f2c[_0x80c4('0x3b')]:_0x45f20f[_0x80c4('0x36')];if(!_0x9043ae[_0x80c4('0x38')][_0x80c4('0x3e')](_0x80c4('0x3f'))){_0x8f9f2c[_0x80c4('0x22')]=qs[_0x80c4('0x22')](_0x9043ae[_0x80c4('0x38')]['limit']);_0x8f9f2c[_0x80c4('0x1f')]=qs[_0x80c4('0x1f')](_0x9043ae[_0x80c4('0x38')][_0x80c4('0x1f')]);}_0x8f9f2c[_0x80c4('0x40')]=qs[_0x80c4('0x41')](_0x9043ae[_0x80c4('0x38')][_0x80c4('0x41')]);_0x8f9f2c[_0x80c4('0x42')]=qs[_0x80c4('0x3a')](_[_0x80c4('0x43')](_0x9043ae[_0x80c4('0x38')],_0x45f20f[_0x80c4('0x3a')]),_0x44d862);if(_0x9043ae['query'][_0x80c4('0x44')]){_0x8f9f2c[_0x80c4('0x42')]=_[_0x80c4('0x45')](_0x8f9f2c[_0x80c4('0x42')],{'$or':_[_0x80c4('0x37')](_0x44d862,function(_0x382b60){if(_0x382b60['type']!=='VIRTUAL'){var _0x142736={};_0x142736[_0x382b60['name']]={'$like':'%'+_0x9043ae['query'][_0x80c4('0x44')]+'%'};return _0x142736;}})});}_0x8f9f2c=_[_0x80c4('0x45')]({},_0x8f9f2c,_0x9043ae[_0x80c4('0x46')]);var _0x187982={'where':_0x8f9f2c[_0x80c4('0x42')]};return db[_0x80c4('0x31')][_0x80c4('0x21')](_0x187982)[_0x80c4('0x29')](function(_0x3697eb){_0x41f279[_0x80c4('0x21')]=_0x3697eb;if(_0x9043ae[_0x80c4('0x38')]['includeAll']){_0x8f9f2c[_0x80c4('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x80c4('0x48')](_0x8f9f2c);})[_0x80c4('0x29')](function(_0x472884){_0x41f279[_0x80c4('0x49')]=_0x472884;return _0x41f279;})[_0x80c4('0x29')](respondWithFilteredResult(_0x8e7c48,_0x8f9f2c))[_0x80c4('0x4a')](handleError(_0x8e7c48,null));};exports[_0x80c4('0x4b')]=function(_0x18268a,_0x502553){var _0x27282d={'raw':!![],'where':{'id':_0x18268a['params']['id']}},_0x4950ee={};_0x4950ee[_0x80c4('0x36')]=_['keys'](db['Disposition'][_0x80c4('0x32')]);_0x4950ee[_0x80c4('0x38')]=_['keys'](_0x18268a[_0x80c4('0x38')]);_0x4950ee[_0x80c4('0x3a')]=_[_0x80c4('0x3c')](_0x4950ee['model'],_0x4950ee[_0x80c4('0x38')]);_0x27282d['attributes']=_[_0x80c4('0x3c')](_0x4950ee[_0x80c4('0x36')],qs['fields'](_0x18268a['query'][_0x80c4('0x3d')]));_0x27282d['attributes']=_0x27282d[_0x80c4('0x3b')]['length']?_0x27282d['attributes']:_0x4950ee['model'];if(_0x18268a['query'][_0x80c4('0x4c')]){_0x27282d['include']=[{'all':!![]}];}_0x27282d=_['merge']({},_0x27282d,_0x18268a[_0x80c4('0x46')]);return db[_0x80c4('0x31')]['find'](_0x27282d)['then'](handleEntityNotFound(_0x502553,null))[_0x80c4('0x29')](respondWithResult(_0x502553,null))[_0x80c4('0x4a')](handleError(_0x502553,null));};exports[_0x80c4('0x4d')]=function(_0x4bb619,_0x590580){return db[_0x80c4('0x31')][_0x80c4('0x4d')](_0x4bb619[_0x80c4('0x4e')],{})[_0x80c4('0x29')](function(_0x37bf30){var _0x2962c0=_0x4bb619[_0x80c4('0x4f')][_0x80c4('0x50')]({'plain':!![]});if(!_0x2962c0)throw new Error(_0x80c4('0x51'));if(_0x2962c0[_0x80c4('0x52')]===_0x80c4('0x4f')){var _0x2dff26=_0x37bf30[_0x80c4('0x50')]({'plain':!![]});var _0x4bc930=_0x80c4('0x2b');return db[_0x80c4('0x53')][_0x80c4('0x54')]({'where':{'name':_0x4bc930,'userProfileId':_0x2962c0[_0x80c4('0x55')]},'raw':!![]})[_0x80c4('0x29')](function(_0x165596){if(_0x165596&&_0x165596[_0x80c4('0x56')]===0x0){return db[_0x80c4('0x2c')][_0x80c4('0x4d')]({'name':_0x2dff26[_0x80c4('0x2f')],'resourceId':_0x2dff26['id'],'type':_0x165596[_0x80c4('0x2f')],'sectionId':_0x165596['id']},{})['then'](function(){return _0x37bf30;});}else{return _0x37bf30;}})['catch'](function(_0x3aaff4){logger[_0x80c4('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aaff4);throw _0x3aaff4;});}return _0x37bf30;})['then'](respondWithResult(_0x590580,0xc9))[_0x80c4('0x4a')](handleError(_0x590580,null));};exports[_0x80c4('0x28')]=function(_0x646feb,_0x2ccb59){if(_0x646feb[_0x80c4('0x4e')]['id']){delete _0x646feb[_0x80c4('0x4e')]['id'];}return db['Disposition'][_0x80c4('0x54')]({'where':{'id':_0x646feb['params']['id']}})[_0x80c4('0x29')](handleEntityNotFound(_0x2ccb59,null))[_0x80c4('0x29')](saveUpdates(_0x646feb['body'],null))[_0x80c4('0x29')](respondWithResult(_0x2ccb59,null))[_0x80c4('0x4a')](handleError(_0x2ccb59,null));};exports[_0x80c4('0x2a')]=function(_0x2ecc3d,_0x18366f){return db['Disposition'][_0x80c4('0x54')]({'where':{'id':_0x2ecc3d[_0x80c4('0x57')]['id']}})[_0x80c4('0x29')](handleEntityNotFound(_0x18366f,null))[_0x80c4('0x29')](removeEntity(_0x18366f,null))[_0x80c4('0x4a')](handleError(_0x18366f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2934fa8..19980b6 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 _0x77e5=['name','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','bluebird','../../config/environment','define','name_voice','ListId','name_chat'];(function(_0x11b55e,_0x47f1ff){var _0x268a13=function(_0x3dc694){while(--_0x3dc694){_0x11b55e['push'](_0x11b55e['shift']());}};_0x268a13(++_0x47f1ff);}(_0x77e5,0x1b8));var _0x577e=function(_0x4b6019,_0x500a56){_0x4b6019=_0x4b6019-0x0;var _0x27b8eb=_0x77e5[_0x4b6019];return _0x27b8eb;};'use strict';var _=require(_0x577e('0x0'));var util=require(_0x577e('0x1'));var logger=require(_0x577e('0x2'))(_0x577e('0x3'));var moment=require('moment');var BPromise=require(_0x577e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x577e('0x5'));var attributes=require('./disposition.attributes');module['exports']=function(_0x337c4f,_0x216bb1){return _0x337c4f[_0x577e('0x6')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x577e('0x7'),'fields':['name',_0x577e('0x8')]},{'unique':!![],'name':_0x577e('0x9'),'fields':[_0x577e('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x577e('0xb'),'fields':['name',_0x577e('0xc')]},{'unique':!![],'name':'name_sms','fields':[_0x577e('0xa'),_0x577e('0xd')]},{'unique':!![],'name':_0x577e('0xe'),'fields':[_0x577e('0xa'),_0x577e('0xf')]},{'unique':!![],'name':_0x577e('0x10'),'fields':['name',_0x577e('0x11')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x577e('0xa'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x74b6=['WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x90a443,_0x10d204){var _0x139bad=function(_0x102907){while(--_0x102907){_0x90a443['push'](_0x90a443['shift']());}};_0x139bad(++_0x10d204);}(_0x74b6,0x12d));var _0x674b=function(_0x3fc0b3,_0x4b249a){_0x3fc0b3=_0x3fc0b3-0x0;var _0x1e7582=_0x74b6[_0x3fc0b3];return _0x1e7582;};'use strict';var _=require(_0x674b('0x0'));var util=require('util');var logger=require(_0x674b('0x1'))(_0x674b('0x2'));var moment=require(_0x674b('0x3'));var BPromise=require(_0x674b('0x4'));var rp=require(_0x674b('0x5'));var fs=require('fs');var path=require(_0x674b('0x6'));var rimraf=require('rimraf');var config=require(_0x674b('0x7'));var attributes=require(_0x674b('0x8'));module[_0x674b('0x9')]=function(_0x31f832,_0xa537e0){return _0x31f832[_0x674b('0xa')](_0x674b('0xb'),attributes,{'tableName':_0x674b('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x674b('0xd'),_0x674b('0xe')]},{'unique':!![],'name':_0x674b('0xf'),'fields':[_0x674b('0xd'),_0x674b('0x10')]},{'unique':!![],'name':_0x674b('0x11'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x674b('0x12'),'fields':[_0x674b('0xd'),'SmsAccountId']},{'unique':!![],'name':_0x674b('0x13'),'fields':[_0x674b('0xd'),_0x674b('0x14')]},{'unique':!![],'name':_0x674b('0x15'),'fields':[_0x674b('0xd'),_0x674b('0x16')]},{'unique':!![],'name':_0x674b('0x17'),'fields':[_0x674b('0xd'),_0x674b('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 925c1a9..a6a9cb2 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(_0x1c460e,_0xafaa8a){var _0x1a4498=function(_0x1b2b01){while(--_0x1b2b01){_0x1c460e['push'](_0x1c460e['shift']());}};_0x1a4498(++_0xafaa8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x230b78,_0xeeaecb){var _0x2612bd=function(_0x5d174b){while(--_0x5d174b){_0x230b78['push'](_0x230b78['shift']());}};_0x2612bd(++_0xeeaecb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 258917f..37a06c4 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 _0x5532=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','index','get'];(function(_0x3c1bfe,_0x2915dd){var _0x55fc6d=function(_0x324bd8){while(--_0x324bd8){_0x3c1bfe['push'](_0x3c1bfe['shift']());}};_0x55fc6d(++_0x2915dd);}(_0x5532,0x19a));var _0x2553=function(_0x113ad0,_0x476444){_0x113ad0=_0x113ad0-0x0;var _0x2f7717=_0x5532[_0x113ad0];return _0x2f7717;};'use strict';var multer=require(_0x2553('0x0'));var util=require(_0x2553('0x1'));var path=require(_0x2553('0x2'));var timeout=require('connect-timeout');var express=require(_0x2553('0x3'));var router=express['Router']();var fs_extra=require(_0x2553('0x4'));var auth=require(_0x2553('0x5'));var interaction=require(_0x2553('0x6'));var config=require('../../config/environment');var controller=require(_0x2553('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2553('0x8')]);router[_0x2553('0x9')]('/:id',auth[_0x2553('0xa')](),controller[_0x2553('0xb')]);router[_0x2553('0xc')]('/',auth[_0x2553('0xa')](),controller[_0x2553('0xd')]);router[_0x2553('0xe')](_0x2553('0xf'),auth[_0x2553('0xa')](),controller[_0x2553('0x10')]);router[_0x2553('0x11')]('/:id',auth[_0x2553('0xa')](),controller[_0x2553('0x12')]);module[_0x2553('0x13')]=router; \ No newline at end of file +var _0x350a=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x371c7c,_0x18cc98){var _0x225962=function(_0x10a255){while(--_0x10a255){_0x371c7c['push'](_0x371c7c['shift']());}};_0x225962(++_0x18cc98);}(_0x350a,0x86));var _0xa350=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x350a[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0xa350('0x0'));var util=require(_0xa350('0x1'));var path=require(_0xa350('0x2'));var timeout=require(_0xa350('0x3'));var express=require(_0xa350('0x4'));var router=express['Router']();var fs_extra=require(_0xa350('0x5'));var auth=require(_0xa350('0x6'));var interaction=require(_0xa350('0x7'));var config=require('../../config/environment');var controller=require(_0xa350('0x8'));router['get']('/',auth[_0xa350('0x9')](),controller['index']);router[_0xa350('0xa')](_0xa350('0xb'),auth['isAuthenticated'](),controller[_0xa350('0xc')]);router[_0xa350('0xd')]('/',auth[_0xa350('0x9')](),controller[_0xa350('0xe')]);router[_0xa350('0xf')](_0xa350('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa350('0x10')]('/:id',auth[_0xa350('0x9')](),controller[_0xa350('0x11')]);module[_0xa350('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f65bb7b..4179c2d 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 _0x0af5=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x3a46b7,_0x38b8ea){var _0x57413a=function(_0x23eea5){while(--_0x23eea5){_0x3a46b7['push'](_0x3a46b7['shift']());}};_0x57413a(++_0x38b8ea);}(_0x0af5,0x158));var _0x50af=function(_0x2b1615,_0x177a3c){_0x2b1615=_0x2b1615-0x0;var _0x5e24c6=_0x0af5[_0x2b1615];return _0x5e24c6;};'use strict';var Sequelize=require('sequelize');module[_0x50af('0x0')]={'name':{'type':Sequelize[_0x50af('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x50af('0x1')]},'ecm':{'type':Sequelize[_0x50af('0x2')](_0x50af('0x3'),'no'),'defaultValue':_0x50af('0x3')},'headerinfo':{'type':Sequelize[_0x50af('0x1')],'defaultValue':_0x50af('0x4')},'localstationid':{'type':Sequelize[_0x50af('0x1')],'unique':_0x50af('0x5')},'minrate':{'type':Sequelize[_0x50af('0x2')](_0x50af('0x6'),'4800','7200',_0x50af('0x7'),_0x50af('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x50af('0x2')](_0x50af('0x6'),'4800','7200',_0x50af('0x7'),_0x50af('0x8'),'14400'),'defaultValue':_0x50af('0x9')},'modem':{'type':Sequelize[_0x50af('0x1')],'defaultValue':_0x50af('0xa')},'gateway':{'type':Sequelize[_0x50af('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[_0x50af('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x50af('0x2')](_0x50af('0xc'),_0x50af('0xd'),_0x50af('0xe'),_0x50af('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x50af('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50af('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x50af('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x50af('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50af('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x50af('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x50af('0x11')],'defaultValue':![],'comment':_0x50af('0x13'),'set':function(_0x30e2ec){if(!_0x30e2ec)this[_0x50af('0x14')](_0x50af('0x15'),null);this[_0x50af('0x14')](_0x50af('0x16'),_0x30e2ec);}}}; \ No newline at end of file +var _0xe2fe=['7200','9600','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xee2f('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xee2f('0x2'),'no'),'defaultValue':_0xee2f('0x2')},'headerinfo':{'type':Sequelize[_0xee2f('0x1')],'defaultValue':_0xee2f('0x3')},'localstationid':{'type':Sequelize[_0xee2f('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xee2f('0x4')](_0xee2f('0x5'),'4800',_0xee2f('0x6'),_0xee2f('0x7'),'12000',_0xee2f('0x8')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xee2f('0x4')](_0xee2f('0x5'),'4800',_0xee2f('0x6'),_0xee2f('0x7'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xee2f('0x9')},'gateway':{'type':Sequelize['STRING'],'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[_0xee2f('0x4')](_0xee2f('0xa'),_0xee2f('0xb'),_0xee2f('0xc'),_0xee2f('0xd')),'defaultValue':_0xee2f('0xa')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xee2f('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xee2f('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee2f('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xee2f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee2f('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee2f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xee2f('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xee2f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xee2f('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xee2f('0x12'),'set':function(_0x3359ff){if(!_0x3359ff)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xee2f('0x13')]('mandatoryDisposition',_0x3359ff);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8292fcd..895d256 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 _0x8080=['addDisposition','FaxAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','ids','order','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','send','getApplications','context','from-voip-provider','system','description','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','/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','bulkCreate','omit','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','CmContact','Contacts','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','Pause','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe'];(function(_0x422059,_0x55d477){var _0x3669d9=function(_0x1d1a61){while(--_0x1d1a61){_0x422059['push'](_0x422059['shift']());}};_0x3669d9(++_0x55d477);}(_0x8080,0x11a));var _0x0808=function(_0x1e8d03,_0x33fae0){_0x1e8d03=_0x1e8d03-0x0;var _0x225ee9=_0x8080[_0x1e8d03];return _0x225ee9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0808('0x0'));var jsonpatch=require(_0x0808('0x1'));var rp=require(_0x0808('0x2'));var moment=require(_0x0808('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0808('0x4'));var util=require(_0x0808('0x5'));var path=require(_0x0808('0x6'));var sox=require('sox');var csv=require(_0x0808('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0808('0x8'));var _=require(_0x0808('0x9'));var squel=require(_0x0808('0xa'));var crypto=require('crypto');var jsforce=require(_0x0808('0xb'));var deskjs=require(_0x0808('0xc'));var toCsv=require(_0x0808('0x7'));var querystring=require(_0x0808('0xd'));var Papa=require(_0x0808('0xe'));var Redis=require(_0x0808('0xf'));var authService=require(_0x0808('0x10'));var qs=require(_0x0808('0x11'));var as=require(_0x0808('0x12'));var hardwareService=require(_0x0808('0x13'));var logger=require(_0x0808('0x14'))(_0x0808('0x15'));var utils=require(_0x0808('0x16'));var config=require(_0x0808('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0808('0x18')]=_[_0x0808('0x19')](config[_0x0808('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0808('0x1a'))(new Redis(config[_0x0808('0x18')]));require('./faxAccount.socket')[_0x0808('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0808('0x1c')][_0x0808('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x0808('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x52fc1c,_0x3e2b5c,_0x3aeca9,_0x42c7c5){return new BPromise(function(_0x2ef0ef,_0x27f0ce){var _0x51377c=_0x42c7c5||client;return _0x51377c[_0x0808('0x1e')](_0x52fc1c,_0x3aeca9)[_0x0808('0x1f')](function(_0x7865a5){logger[_0x0808('0x20')](_0x0808('0x21'),_0x3e2b5c,_0x0808('0x22'));logger[_0x0808('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3e2b5c,'request\x20sent',JSON[_0x0808('0x24')](_0x7865a5));if(_0x7865a5[_0x0808('0x25')]){if(_0x7865a5[_0x0808('0x25')][_0x0808('0x26')]===0x1f4){logger[_0x0808('0x25')](_0x0808('0x21'),_0x3e2b5c,_0x7865a5['error'][_0x0808('0x27')]);return _0x27f0ce(_0x7865a5[_0x0808('0x25')][_0x0808('0x27')]);}logger[_0x0808('0x25')](_0x0808('0x21'),_0x3e2b5c,_0x7865a5[_0x0808('0x25')][_0x0808('0x27')]);return _0x2ef0ef(_0x7865a5[_0x0808('0x25')][_0x0808('0x27')]);}else{logger[_0x0808('0x20')]('FaxAccount,\x20%s,\x20%s',_0x3e2b5c,_0x0808('0x22'));_0x2ef0ef(_0x7865a5[_0x0808('0x28')][_0x0808('0x27')]);}})[_0x0808('0x29')](function(_0x8191ac){logger['error'](_0x0808('0x21'),_0x3e2b5c,_0x8191ac);_0x27f0ce(_0x8191ac);});});}function respondWithStatusCode(_0x197988,_0x85862e){_0x85862e=_0x85862e||0xcc;return function(_0x1e8195){if(_0x1e8195){return _0x197988[_0x0808('0x2a')](_0x85862e);}return _0x197988[_0x0808('0x2b')](_0x85862e)[_0x0808('0x2c')]();};}function respondWithResult(_0x11d00b,_0x3dac14){_0x3dac14=_0x3dac14||0xc8;return function(_0x587d93){if(_0x587d93){return _0x11d00b[_0x0808('0x2b')](_0x3dac14)[_0x0808('0x2d')](_0x587d93);}};}function respondWithFilteredResult(_0x5d6187,_0x200b90){return function(_0x3a59e7){if(_0x3a59e7){var _0x45efc1=typeof _0x200b90[_0x0808('0x2e')]===_0x0808('0x2f')&&typeof _0x200b90[_0x0808('0x30')]==='undefined';var _0x4a513=_0x3a59e7['count'];var _0x75026f=_0x45efc1?0x0:_0x200b90['offset'];var _0x3302b7=_0x45efc1?_0x3a59e7['count']:_0x200b90[_0x0808('0x2e')]+_0x200b90[_0x0808('0x30')];var _0x54e097;if(_0x3302b7>=_0x4a513){_0x3302b7=_0x4a513;_0x54e097=0xc8;}else{_0x54e097=0xce;}_0x5d6187[_0x0808('0x2b')](_0x54e097);return _0x5d6187[_0x0808('0x31')](_0x0808('0x32'),_0x75026f+'-'+_0x3302b7+'/'+_0x4a513)[_0x0808('0x2d')](_0x3a59e7);}return null;};}function patchUpdates(_0x2a2dcc){return function(_0x4e4270){try{jsonpatch['apply'](_0x4e4270,_0x2a2dcc,!![]);}catch(_0x19fc6f){return BPromise[_0x0808('0x33')](_0x19fc6f);}return _0x4e4270[_0x0808('0x34')]();};}function saveUpdates(_0x2bc10f,_0x525fb4){return function(_0x35411a){if(_0x35411a){return _0x35411a[_0x0808('0x35')](_0x2bc10f)[_0x0808('0x1f')](function(_0x32e792){return _0x32e792;});}return null;};}function removeEntity(_0x3d53ae,_0xf8d00f){return function(_0x483174){if(_0x483174){return _0x483174['destroy']()[_0x0808('0x1f')](function(){var _0x263120=_0x483174[_0x0808('0x36')]({'plain':!![]});var _0x1dc25f=_0x0808('0x37');return db[_0x0808('0x38')][_0x0808('0x39')]({'where':{'type':_0x1dc25f,'resourceId':_0x263120['id']}})['then'](function(){return _0x483174;});})['then'](function(){_0x3d53ae[_0x0808('0x2b')](0xcc)[_0x0808('0x2c')]();});}};}function handleEntityNotFound(_0x42e506,_0x1198cf){return function(_0xa1350d){if(!_0xa1350d){_0x42e506[_0x0808('0x2a')](0x194);}return _0xa1350d;};}function handleError(_0x18d692,_0x2bacfd){_0x2bacfd=_0x2bacfd||0x1f4;return function(_0x47ab10){logger['error'](_0x47ab10[_0x0808('0x3a')]);if(_0x47ab10[_0x0808('0x3b')]){delete _0x47ab10[_0x0808('0x3b')];}_0x18d692[_0x0808('0x2b')](_0x2bacfd)['send'](_0x47ab10);};}exports[_0x0808('0x3c')]=function(_0x5a9a0e,_0x484e5b){var _0x222190={'include':[{'model':db['Pause'],'as':_0x0808('0x3d')}]},_0x3a29db={},_0x45c6f5={'count':0x0,'rows':[]};var _0x134277=_['map'](db[_0x0808('0x3e')][_0x0808('0x3f')],function(_0x483bfb){return{'name':_0x483bfb[_0x0808('0x40')],'type':_0x483bfb[_0x0808('0x41')][_0x0808('0x42')]};});_0x3a29db[_0x0808('0x43')]=_[_0x0808('0x44')](_0x134277,_0x0808('0x3b'));_0x3a29db[_0x0808('0x45')]=_[_0x0808('0x46')](_0x5a9a0e['query']);_0x3a29db[_0x0808('0x47')]=_[_0x0808('0x48')](_0x3a29db[_0x0808('0x43')],_0x3a29db['query']);_0x222190[_0x0808('0x49')]=_['intersection'](_0x3a29db[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x5a9a0e['query'][_0x0808('0x4a')]));_0x222190[_0x0808('0x49')]=_0x222190[_0x0808('0x49')][_0x0808('0x4b')]?_0x222190['attributes']:_0x3a29db[_0x0808('0x43')];if(!_0x5a9a0e[_0x0808('0x45')][_0x0808('0x4c')]('nolimit')){_0x222190[_0x0808('0x30')]=qs[_0x0808('0x30')](_0x5a9a0e[_0x0808('0x45')][_0x0808('0x30')]);_0x222190[_0x0808('0x2e')]=qs['offset'](_0x5a9a0e[_0x0808('0x45')]['offset']);}_0x222190['order']=qs[_0x0808('0x4d')](_0x5a9a0e[_0x0808('0x45')]['sort']);_0x222190[_0x0808('0x4e')]=qs[_0x0808('0x47')](_[_0x0808('0x4f')](_0x5a9a0e[_0x0808('0x45')],_0x3a29db['filters']),_0x134277);if(_0x5a9a0e[_0x0808('0x45')][_0x0808('0x50')]){_0x222190['where']=_[_0x0808('0x51')](_0x222190[_0x0808('0x4e')],{'$or':_[_0x0808('0x44')](_0x134277,function(_0x199f22){if(_0x199f22[_0x0808('0x41')]!=='VIRTUAL'){var _0x24360e={};_0x24360e[_0x199f22[_0x0808('0x3b')]]={'$like':'%'+_0x5a9a0e['query'][_0x0808('0x50')]+'%'};return _0x24360e;}})});}_0x222190=_[_0x0808('0x51')]({},_0x222190,_0x5a9a0e[_0x0808('0x52')]);var _0x389afd={'where':_0x222190['where']};return db[_0x0808('0x3e')][_0x0808('0x53')](_0x389afd)[_0x0808('0x1f')](function(_0xaef0f5){_0x45c6f5[_0x0808('0x53')]=_0xaef0f5;if(_0x5a9a0e[_0x0808('0x45')][_0x0808('0x54')]){_0x222190['include']=[{'all':!![]}];}return db[_0x0808('0x3e')][_0x0808('0x55')](_0x222190);})[_0x0808('0x1f')](function(_0xf2523){_0x45c6f5[_0x0808('0x56')]=_0xf2523;return _0x45c6f5;})[_0x0808('0x1f')](respondWithFilteredResult(_0x484e5b,_0x222190))[_0x0808('0x29')](handleError(_0x484e5b,null));};exports[_0x0808('0x57')]=function(_0x101294,_0x353f6a){var _0x5d1136={'raw':![],'where':{'id':_0x101294[_0x0808('0x58')]['id']},'include':[{'model':db[_0x0808('0x59')],'as':_0x0808('0x3d')}]},_0x17d86c={};_0x17d86c['model']=_[_0x0808('0x46')](db['FaxAccount']['rawAttributes']);_0x17d86c[_0x0808('0x45')]=_['keys'](_0x101294[_0x0808('0x45')]);_0x17d86c[_0x0808('0x47')]=_['intersection'](_0x17d86c['model'],_0x17d86c['query']);_0x5d1136[_0x0808('0x49')]=_['intersection'](_0x17d86c[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x101294[_0x0808('0x45')][_0x0808('0x4a')]));_0x5d1136[_0x0808('0x49')]=_0x5d1136[_0x0808('0x49')][_0x0808('0x4b')]?_0x5d1136[_0x0808('0x49')]:_0x17d86c[_0x0808('0x43')];if(_0x101294[_0x0808('0x45')][_0x0808('0x54')]){_0x5d1136[_0x0808('0x5a')]=[{'all':!![]}];}_0x5d1136=_[_0x0808('0x51')]({},_0x5d1136,_0x101294[_0x0808('0x52')]);return db['FaxAccount']['find'](_0x5d1136)[_0x0808('0x1f')](handleEntityNotFound(_0x353f6a,null))[_0x0808('0x1f')](respondWithResult(_0x353f6a,null))['catch'](handleError(_0x353f6a,null));};exports[_0x0808('0x5b')]=function(_0x50abbc,_0x1abb77){return db[_0x0808('0x3e')]['create'](_0x50abbc['body'],{})[_0x0808('0x1f')](function(_0x4cdb9d){var _0x70b39c=_0x50abbc['user']['get']({'plain':!![]});if(!_0x70b39c)throw new Error(_0x0808('0x5c'));if(_0x70b39c[_0x0808('0x5d')]===_0x0808('0x5e')){var _0x3bb757=_0x4cdb9d[_0x0808('0x36')]({'plain':!![]});var _0x270ca3=_0x0808('0x37');return db[_0x0808('0x5f')]['find']({'where':{'name':_0x270ca3,'userProfileId':_0x70b39c[_0x0808('0x60')]},'raw':!![]})[_0x0808('0x1f')](function(_0x489cfe){if(_0x489cfe&&_0x489cfe[_0x0808('0x61')]===0x0){return db[_0x0808('0x38')][_0x0808('0x5b')]({'name':_0x3bb757[_0x0808('0x3b')],'resourceId':_0x3bb757['id'],'type':_0x489cfe[_0x0808('0x3b')],'sectionId':_0x489cfe['id']},{})[_0x0808('0x1f')](function(){return _0x4cdb9d;});}else{return _0x4cdb9d;}})[_0x0808('0x29')](function(_0x2540e0){logger[_0x0808('0x25')](_0x0808('0x62'),_0x2540e0);throw _0x2540e0;});}return _0x4cdb9d;})[_0x0808('0x1f')](respondWithResult(_0x1abb77,0xc9))['catch'](handleError(_0x1abb77,null));};exports[_0x0808('0x35')]=function(_0x34ce0d,_0x106615){if(_0x34ce0d[_0x0808('0x63')]['id']){delete _0x34ce0d[_0x0808('0x63')]['id'];}return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x34ce0d[_0x0808('0x58')]['id']},'include':[{'model':db[_0x0808('0x59')],'as':'mandatoryDispositionPause'}]})[_0x0808('0x1f')](handleEntityNotFound(_0x106615,null))[_0x0808('0x1f')](saveUpdates(_0x34ce0d[_0x0808('0x63')],null))[_0x0808('0x1f')](respondWithResult(_0x106615,null))[_0x0808('0x29')](handleError(_0x106615,null));};exports[_0x0808('0x39')]=function(_0x22f64c,_0x5a60eb){return db[_0x0808('0x3e')]['find']({'where':{'id':_0x22f64c[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x5a60eb,null))[_0x0808('0x1f')](removeEntity(_0x5a60eb,null))[_0x0808('0x29')](handleError(_0x5a60eb,null));};exports['describe']=function(_0x407a8f,_0x568788){return db[_0x0808('0x3e')][_0x0808('0x65')]()[_0x0808('0x1f')](respondWithResult(_0x568788,null))[_0x0808('0x29')](handleError(_0x568788,null));};exports[_0x0808('0x66')]=function(_0x193c14,_0x139da4,_0x54e51e){if(_0x193c14[_0x0808('0x63')]['id']){delete _0x193c14[_0x0808('0x63')]['id'];}return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x193c14[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x139da4,null))[_0x0808('0x1f')](function(_0x33756f){if(_0x33756f){_0x193c14['body'][_0x0808('0x67')]=_0x33756f['id'];return db['Disposition'][_0x0808('0x5b')](_0x193c14[_0x0808('0x63')]);}})[_0x0808('0x1f')](respondWithResult(_0x139da4,null))[_0x0808('0x29')](handleError(_0x139da4,null));};exports[_0x0808('0x68')]=function(_0x3c8c74,_0x4d3c5d,_0x156678){var _0x2aa497={'raw':![],'where':{}};var _0xdec7ad={};var _0x4e97d2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0808('0x69')]({'where':{'id':_0x3c8c74[_0x0808('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d3c5d,null))['then'](function(_0x451784){if(_0x451784){_0xdec7ad[_0x0808('0x43')]=_['keys'](db[_0x0808('0x6a')][_0x0808('0x3f')]);_0xdec7ad[_0x0808('0x45')]=_['keys'](_0x3c8c74[_0x0808('0x45')]);_0xdec7ad[_0x0808('0x47')]=_[_0x0808('0x48')](_0xdec7ad['model'],_0xdec7ad['query']);_0x2aa497['attributes']=_[_0x0808('0x48')](_0xdec7ad[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x3c8c74[_0x0808('0x45')]['fields']));_0x2aa497['attributes']=_0x2aa497[_0x0808('0x49')][_0x0808('0x4b')]?_0x2aa497[_0x0808('0x49')]:_0xdec7ad[_0x0808('0x43')];if(!_0x3c8c74['query'][_0x0808('0x4c')](_0x0808('0x6b'))){_0x2aa497[_0x0808('0x30')]=qs[_0x0808('0x30')](_0x3c8c74[_0x0808('0x45')][_0x0808('0x30')]);_0x2aa497[_0x0808('0x2e')]=qs[_0x0808('0x2e')](_0x3c8c74[_0x0808('0x45')][_0x0808('0x2e')]);}_0x2aa497['order']=qs['sort'](_0x3c8c74['query'][_0x0808('0x4d')]);_0x2aa497[_0x0808('0x4e')]=qs[_0x0808('0x47')](_[_0x0808('0x4f')](_0x3c8c74[_0x0808('0x45')],_0xdec7ad[_0x0808('0x47')]));_0x2aa497[_0x0808('0x4e')][_0x0808('0x67')]=_0x451784['id'];if(_0x3c8c74[_0x0808('0x45')][_0x0808('0x50')]){_0x2aa497['where']=_[_0x0808('0x51')](_0x2aa497[_0x0808('0x4e')],{'$or':_['map'](_0x2aa497['attributes'],function(_0x56dbf8){var _0x7b2adc={};_0x7b2adc[_0x56dbf8]={'$like':'%'+_0x3c8c74[_0x0808('0x45')][_0x0808('0x50')]+'%'};return _0x7b2adc;})});}_0x2aa497=_[_0x0808('0x51')]({},_0x2aa497,_0x3c8c74[_0x0808('0x52')]);return db[_0x0808('0x6a')][_0x0808('0x53')]({'where':_0x2aa497[_0x0808('0x4e')]})['then'](function(_0x49b5c7){_0x4e97d2['count']=_0x49b5c7;if(_0x3c8c74[_0x0808('0x45')]['includeAll']){_0x2aa497['include']=[{'all':!![]}];}return db[_0x0808('0x6a')][_0x0808('0x55')](_0x2aa497);})[_0x0808('0x1f')](function(_0x109f0f){_0x4e97d2[_0x0808('0x56')]=_0x109f0f;return _0x4e97d2;});}})[_0x0808('0x1f')](respondWithFilteredResult(_0x4d3c5d,_0x2aa497))[_0x0808('0x29')](handleError(_0x4d3c5d,null));};exports[_0x0808('0x6c')]=function(_0x5c94bb,_0x50c9b7,_0x586598){return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x5c94bb[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x50c9b7,null))['then'](function(_0x371454){if(_0x371454){return _0x371454['removeDispositions'](_0x5c94bb[_0x0808('0x45')]['ids']);}})[_0x0808('0x1f')](respondWithStatusCode(_0x50c9b7,null))[_0x0808('0x29')](handleError(_0x50c9b7,null));};exports['addAnswer']=function(_0x49f4bd,_0x33afce,_0x2fb5af){if(_0x49f4bd[_0x0808('0x63')]['id']){delete _0x49f4bd[_0x0808('0x63')]['id'];}return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x49f4bd[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x33afce,null))[_0x0808('0x1f')](function(_0x3781b0){if(_0x3781b0){_0x49f4bd['body'][_0x0808('0x67')]=_0x3781b0['id'];return db[_0x0808('0x6d')]['create'](_0x49f4bd[_0x0808('0x63')]);}})[_0x0808('0x1f')](respondWithResult(_0x33afce,null))[_0x0808('0x29')](handleError(_0x33afce,null));};exports[_0x0808('0x6e')]=function(_0x174f3d,_0x15fc3e,_0x48060){var _0x15553e={'raw':![],'where':{}};var _0x55cdb9={};var _0x570670={'count':0x0,'rows':[]};return db[_0x0808('0x3e')][_0x0808('0x69')]({'where':{'id':_0x174f3d[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x15fc3e,null))[_0x0808('0x1f')](function(_0x2c7fef){if(_0x2c7fef){_0x55cdb9['model']=_[_0x0808('0x46')](db[_0x0808('0x6d')][_0x0808('0x3f')]);_0x55cdb9[_0x0808('0x45')]=_[_0x0808('0x46')](_0x174f3d[_0x0808('0x45')]);_0x55cdb9[_0x0808('0x47')]=_[_0x0808('0x48')](_0x55cdb9[_0x0808('0x43')],_0x55cdb9[_0x0808('0x45')]);_0x15553e[_0x0808('0x49')]=_['intersection'](_0x55cdb9[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x174f3d[_0x0808('0x45')]['fields']));_0x15553e[_0x0808('0x49')]=_0x15553e['attributes'][_0x0808('0x4b')]?_0x15553e[_0x0808('0x49')]:_0x55cdb9[_0x0808('0x43')];if(!_0x174f3d[_0x0808('0x45')][_0x0808('0x4c')](_0x0808('0x6b'))){_0x15553e[_0x0808('0x30')]=qs[_0x0808('0x30')](_0x174f3d[_0x0808('0x45')][_0x0808('0x30')]);_0x15553e[_0x0808('0x2e')]=qs['offset'](_0x174f3d['query'][_0x0808('0x2e')]);}_0x15553e['order']=qs[_0x0808('0x4d')](_0x174f3d[_0x0808('0x45')]['sort']);_0x15553e[_0x0808('0x4e')]=qs['filters'](_[_0x0808('0x4f')](_0x174f3d[_0x0808('0x45')],_0x55cdb9[_0x0808('0x47')]));_0x15553e[_0x0808('0x4e')][_0x0808('0x67')]=_0x2c7fef['id'];if(_0x174f3d[_0x0808('0x45')][_0x0808('0x50')]){_0x15553e['where']=_['merge'](_0x15553e[_0x0808('0x4e')],{'$or':_[_0x0808('0x44')](_0x15553e[_0x0808('0x49')],function(_0x3a190e){var _0x885c88={};_0x885c88[_0x3a190e]={'$like':'%'+_0x174f3d[_0x0808('0x45')][_0x0808('0x50')]+'%'};return _0x885c88;})});}_0x15553e=_[_0x0808('0x51')]({},_0x15553e,_0x174f3d['options']);return db['CannedAnswer']['count']({'where':_0x15553e[_0x0808('0x4e')]})['then'](function(_0x1411ee){_0x570670[_0x0808('0x53')]=_0x1411ee;if(_0x174f3d[_0x0808('0x45')]['includeAll']){_0x15553e['include']=[{'all':!![]}];}return db[_0x0808('0x6d')][_0x0808('0x55')](_0x15553e);})['then'](function(_0x6dbd8e){_0x570670[_0x0808('0x56')]=_0x6dbd8e;return _0x570670;});}})[_0x0808('0x1f')](respondWithFilteredResult(_0x15fc3e,_0x15553e))[_0x0808('0x29')](handleError(_0x15fc3e,null));};exports[_0x0808('0x6f')]=function(_0x26fd87,_0x5b5893,_0x2f2bd9){return db[_0x0808('0x3e')]['find']({'where':{'id':_0x26fd87['params']['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x5b5893,null))[_0x0808('0x1f')](function(_0x1a73bd){if(_0x1a73bd){return _0x1a73bd[_0x0808('0x6f')](_0x26fd87[_0x0808('0x45')]['ids']);}})[_0x0808('0x1f')](respondWithStatusCode(_0x5b5893,null))[_0x0808('0x29')](handleError(_0x5b5893,null));};exports['addInteraction']=function(_0x2d1357,_0x4e73ed,_0x4671d4){return db[_0x0808('0x70')][_0x0808('0x64')]({'where':{'id':_0x2d1357[_0x0808('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e73ed,null))[_0x0808('0x1f')](function(_0x3019ab){if(_0x3019ab){return _0x3019ab[_0x0808('0x71')](_0x2d1357['body'][_0x0808('0x72')],_['omit'](_0x2d1357[_0x0808('0x63')],[_0x0808('0x72'),'id'])||{});}})[_0x0808('0x1f')](respondWithResult(_0x4e73ed,null))[_0x0808('0x29')](handleError(_0x4e73ed,null));};exports['getInteractions']=function(_0xe6264b,_0x427a70,_0x36ebcc){var _0x216116={'raw':![],'where':{}};var _0x8bbf0a={};var _0x14d99a={'count':0x0,'rows':[]};return db[_0x0808('0x3e')]['findOne']({'where':{'id':_0xe6264b[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x427a70,null))['then'](function(_0x6342dd){if(_0x6342dd){_0x8bbf0a[_0x0808('0x43')]=_[_0x0808('0x46')](db[_0x0808('0x70')][_0x0808('0x3f')]);_0x8bbf0a[_0x0808('0x45')]=_[_0x0808('0x46')](_0xe6264b[_0x0808('0x45')]);_0x8bbf0a['filters']=_[_0x0808('0x48')](_0x8bbf0a['model'],_0x8bbf0a[_0x0808('0x45')]);_0x216116[_0x0808('0x49')]=_['intersection'](_0x8bbf0a[_0x0808('0x43')],qs[_0x0808('0x4a')](_0xe6264b[_0x0808('0x45')][_0x0808('0x4a')]));_0x216116[_0x0808('0x49')]=_0x216116['attributes'][_0x0808('0x4b')]?_0x216116['attributes']:_0x8bbf0a[_0x0808('0x43')];if(!_0xe6264b['query'][_0x0808('0x4c')](_0x0808('0x6b'))){_0x216116['limit']=qs['limit'](_0xe6264b[_0x0808('0x45')]['limit']);_0x216116['offset']=qs['offset'](_0xe6264b[_0x0808('0x45')][_0x0808('0x2e')]);}_0x216116[_0x0808('0x73')]=qs[_0x0808('0x4d')](_0xe6264b[_0x0808('0x45')][_0x0808('0x4d')]);_0x216116[_0x0808('0x4e')]=qs[_0x0808('0x47')](_[_0x0808('0x4f')](_0xe6264b[_0x0808('0x45')],_0x8bbf0a[_0x0808('0x47')]));_0x216116[_0x0808('0x4e')]['FaxAccountId']=_0x6342dd['id'];if(_0xe6264b['query'][_0x0808('0x50')]){_0x216116['where']=_[_0x0808('0x51')](_0x216116[_0x0808('0x4e')],{'$or':_[_0x0808('0x44')](_0x216116[_0x0808('0x49')],function(_0x951f05){var _0x22a572={};_0x22a572[_0x951f05]={'$like':'%'+_0xe6264b[_0x0808('0x45')]['filter']+'%'};return _0x22a572;})});}_0x216116=_[_0x0808('0x51')]({},_0x216116,_0xe6264b[_0x0808('0x52')]);return db['FaxInteraction']['count']({'where':_0x216116['where']})[_0x0808('0x1f')](function(_0x544c04){_0x14d99a['count']=_0x544c04;if(_0xe6264b[_0x0808('0x45')][_0x0808('0x54')]){_0x216116['include']=[{'model':db['CmContact'],'as':_0x0808('0x74'),'required':![]},{'model':db[_0x0808('0x75')],'as':_0x0808('0x76'),'attributes':[_0x0808('0x3b'),_0x0808('0x77'),_0x0808('0x78')],'required':![]},{'model':db[_0x0808('0x79')],'as':_0x0808('0x7a'),'attributes':['id',_0x0808('0x3b'),_0x0808('0x7b')],'where':_0xe6264b[_0x0808('0x45')][_0x0808('0x7c')]?{'id':_0xe6264b['query']['tag']}:undefined,'required':_0xe6264b[_0x0808('0x45')][_0x0808('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x0808('0x55')](_0x216116);})[_0x0808('0x1f')](function(_0x47e287){_0x14d99a[_0x0808('0x56')]=_0x47e287;return _0x14d99a;});}})[_0x0808('0x1f')](respondWithFilteredResult(_0x427a70,_0x216116))[_0x0808('0x29')](handleError(_0x427a70,null));};exports['addApplications']=function(_0x2115e2,_0x372c28){var _0x5dc55f=_0x2115e2[_0x0808('0x58')]['id'];var _0x17cf85=_0x2115e2['body'];var _0x160852=0xc8;var _0x3b7076=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0808('0x7d')][_0x0808('0x7e')][_0x0808('0x7f')][_0x0808('0x80')]},function(_0x6d64ea){return db[_0x0808('0x3e')][_0x0808('0x69')]({'where':{'id':_0x5dc55f},'transaction':_0x6d64ea})[_0x0808('0x1f')](function(_0x48a6e6){if(_0x48a6e6){return db[_0x0808('0x81')]['destroy']({'where':{'FaxAccountId':_0x5dc55f},'transaction':_0x6d64ea})['then'](function(){var _0x5657a9=_[_0x0808('0x44')](_0x17cf85,function(_0x4333fd){_0x4333fd[_0x0808('0x67')]=_0x5dc55f;return _0x4333fd;});return db['FaxApplication']['bulkCreate'](_0x5657a9,{'transaction':_0x6d64ea});});}else{_0x160852=0x194;_0x3b7076=[];}});})[_0x0808('0x1f')](function(){if(_0x160852!==0x194){return db['FaxApplication'][_0x0808('0x82')]({'where':{'FaxAccountId':_0x5dc55f},'order':_0x0808('0x83')})[_0x0808('0x1f')](function(_0x4a227f){_0x3b7076=_0x4a227f;});}})['catch'](function(_0x458e1b){_0x160852=0x1f4;logger[_0x0808('0x25')](_0x458e1b[_0x0808('0x3a')]);if(_0x458e1b['name']){delete _0x458e1b[_0x0808('0x3b')];}_0x3b7076=_0x458e1b;})['finally'](function(){if(_0x3b7076===null){_0x372c28[_0x0808('0x2a')](_0x160852);}else{if(_0x160852===0x1f4){_0x372c28[_0x0808('0x2b')](_0x160852)[_0x0808('0x84')](_0x3b7076);}else{_0x372c28[_0x0808('0x2b')](_0x160852)['json'](_0x3b7076);}}});};exports[_0x0808('0x85')]=function(_0xcb14ad,_0x571211,_0x5bf88a){var _0x14d2f1={};var _0x835149={};var _0x7cf364;var _0x44aa70;return db[_0x0808('0x3e')][_0x0808('0x69')]({'where':{'id':_0xcb14ad[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x571211,null))[_0x0808('0x1f')](function(_0x4d1723){if(_0x4d1723){_0x7cf364=_0x4d1723;_0x835149[_0x0808('0x43')]=_[_0x0808('0x46')](db['FaxApplication'][_0x0808('0x3f')]);_0x835149[_0x0808('0x45')]=_[_0x0808('0x46')](_0xcb14ad[_0x0808('0x45')]);_0x835149['filters']=_[_0x0808('0x48')](_0x835149[_0x0808('0x43')],_0x835149[_0x0808('0x45')]);_0x14d2f1['attributes']=_[_0x0808('0x48')](_0x835149[_0x0808('0x43')],qs[_0x0808('0x4a')](_0xcb14ad[_0x0808('0x45')][_0x0808('0x4a')]));_0x14d2f1['attributes']=_0x14d2f1['attributes'][_0x0808('0x4b')]?_0x14d2f1[_0x0808('0x49')]:_0x835149[_0x0808('0x43')];_0x14d2f1[_0x0808('0x73')]=qs[_0x0808('0x4d')](_0xcb14ad['query'][_0x0808('0x4d')]);_0x14d2f1[_0x0808('0x4e')]=qs[_0x0808('0x47')](_['pick'](_0xcb14ad[_0x0808('0x45')],_0x835149[_0x0808('0x47')]));if(_0xcb14ad['query'][_0x0808('0x50')]){_0x14d2f1[_0x0808('0x4e')]=_['merge'](_0x14d2f1[_0x0808('0x4e')],{'$or':_[_0x0808('0x44')](_0x14d2f1[_0x0808('0x49')],function(_0x2ade01){var _0x30da77={};_0x30da77[_0x2ade01]={'$like':'%'+_0xcb14ad[_0x0808('0x45')][_0x0808('0x50')]+'%'};return _0x30da77;})});}_0x14d2f1=_[_0x0808('0x51')]({},_0x14d2f1,_0xcb14ad[_0x0808('0x52')]);return _0x7cf364[_0x0808('0x85')](_0x14d2f1);}})[_0x0808('0x1f')](function(_0x25267b){if(_0x25267b){_0x44aa70=_0x25267b[_0x0808('0x4b')];if(!_0xcb14ad[_0x0808('0x45')][_0x0808('0x4c')](_0x0808('0x6b'))){_0x14d2f1[_0x0808('0x30')]=qs[_0x0808('0x30')](_0xcb14ad[_0x0808('0x45')][_0x0808('0x30')]);_0x14d2f1[_0x0808('0x2e')]=qs[_0x0808('0x2e')](_0xcb14ad[_0x0808('0x45')][_0x0808('0x2e')]);}return _0x7cf364[_0x0808('0x85')](_0x14d2f1);}})[_0x0808('0x1f')](function(_0x21f5f3){if(_0x21f5f3){return _0x21f5f3?{'count':_0x44aa70,'rows':_0x21f5f3}:null;}})['then'](respondWithResult(_0x571211,null))[_0x0808('0x29')](handleError(_0x571211,null));};function Extension(_0xb6c404,_0xc9da23,_0x4a4943,_0x56a278){this[_0x0808('0x86')]=_0x0808('0x87');this['exten']=_0xb6c404['localstationid'];this['app']=_0x56a278;this['type']=_0x0808('0x88');this[_0x0808('0x89')]='Fax\x20Extension';this[_0x0808('0x67')]=_0xb6c404['id'];this[_0x0808('0x83')]=_0xc9da23;this[_0x0808('0x8a')]=_0x4a4943;}function createExtensionsReciveFax(_0x48c8db){var _0x577b9a=0x1;var _0x5f51c1=[];_0x5f51c1[_0x0808('0x8b')](new Extension(_0x48c8db,_0x577b9a,'',_0x0808('0x8c')));_0x577b9a+=0x1;_0x5f51c1[_0x0808('0x8b')](new Extension(_0x48c8db,_0x577b9a,'CDR(type)=inbound-fax',_0x0808('0x8d')));_0x577b9a+=0x1;for(var _0x221c7e in _0x48c8db){if(_0x48c8db['hasOwnProperty'](_0x221c7e)&&(_0x221c7e==='ecm'||_0x221c7e==='localstationid'||_0x221c7e===_0x0808('0x8e')||_0x221c7e===_0x0808('0x8f')||_0x221c7e===_0x0808('0x90')||_0x221c7e===_0x0808('0x91')||_0x221c7e==='minrate'||_0x221c7e===_0x0808('0x92')||_0x221c7e===_0x0808('0x93'))){_0x5f51c1[_0x0808('0x8b')](new Extension(_0x48c8db,_0x577b9a,_0x0808('0x94')+_0x221c7e+')='+_0x48c8db[_0x221c7e],'Set'));_0x577b9a+=0x1;}}_0x5f51c1['push'](new Extension(_0x48c8db,_0x577b9a,'6','Wait'));_0x577b9a+=0x1;_0x5f51c1[_0x0808('0x8b')](new Extension(_0x48c8db,_0x577b9a,_0x0808('0x95'),_0x0808('0x96')));_0x577b9a=0x0;return _0x5f51c1;}exports[_0x0808('0x97')]=function(_0x200e9f,_0x29461c,_0x4dc9d2){var _0x28a59b;return db[_0x0808('0x7d')][_0x0808('0x98')](function(_0xdc06ea){return db[_0x0808('0x3e')][_0x0808('0x5b')](_0x200e9f['body'],{'transaction':_0xdc06ea})[_0x0808('0x1f')](function(_0x4816e1){_0x28a59b=_0x4816e1[_0x0808('0x36')]({'plain':!![]});return db[_0x0808('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x28a59b),{'transaction':_0xdc06ea});});})[_0x0808('0x1f')](function(){return _0x28a59b;})['then'](respondWithResult(_0x29461c,null))[_0x0808('0x29')](handleError(_0x29461c,null));};exports[_0x0808('0x9a')]=function(_0x178428,_0x589911,_0x13f96b){var _0x2c63cb;return db[_0x0808('0x7d')][_0x0808('0x98')](function(_0x5c798e){return db['FaxAccount'][_0x0808('0x35')](_0x178428['body'],{'where':{'id':_0x178428[_0x0808('0x63')]['id']},'transaction':_0x5c798e})['then'](function(_0x2ebfeb){return db[_0x0808('0x99')][_0x0808('0x39')]({'where':{'FaxAccountId':_0x178428[_0x0808('0x63')]['id']},'transaction':_0x5c798e})['then'](function(_0x14b881){return db[_0x0808('0x99')][_0x0808('0x9b')](createExtensionsReciveFax(_[_0x0808('0x9c')](_0x178428['body'],['tech','key',_0x0808('0x9d'),_0x0808('0x9e'),'TrunkId',_0x0808('0x9f')])),{'transaction':_0x5c798e});});});})[_0x0808('0x1f')](function(){return db[_0x0808('0x3e')][_0x0808('0xa0')](_0x178428[_0x0808('0x63')]['id']);})[_0x0808('0x1f')](respondWithResult(_0x589911,null))[_0x0808('0x29')](handleError(_0x589911,null));};exports[_0x0808('0xa1')]=function(_0x5c3ed6,_0x3ede28,_0x252c8c){var _0x3d16fe={'raw':!![],'where':{}};var _0x453573={};var _0x5b38c9={'count':0x0,'rows':[]};return db[_0x0808('0x3e')][_0x0808('0x69')]({'where':{'id':_0x5c3ed6['params']['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x3ede28,null))[_0x0808('0x1f')](function(_0xe25f6b){if(_0xe25f6b){_0x453573[_0x0808('0x43')]=_[_0x0808('0x46')](db['FaxMessage'][_0x0808('0x3f')]);_0x453573[_0x0808('0x45')]=_[_0x0808('0x46')](_0x5c3ed6[_0x0808('0x45')]);_0x453573['filters']=_['intersection'](_0x453573[_0x0808('0x43')],_0x453573['query']);_0x3d16fe[_0x0808('0x49')]=_[_0x0808('0x48')](_0x453573[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x5c3ed6[_0x0808('0x45')][_0x0808('0x4a')]));_0x3d16fe[_0x0808('0x49')]=_0x3d16fe[_0x0808('0x49')]['length']?_0x3d16fe['attributes']:_0x453573[_0x0808('0x43')];if(!_0x5c3ed6[_0x0808('0x45')][_0x0808('0x4c')]('nolimit')){_0x3d16fe[_0x0808('0x30')]=qs[_0x0808('0x30')](_0x5c3ed6[_0x0808('0x45')][_0x0808('0x30')]);_0x3d16fe[_0x0808('0x2e')]=qs['offset'](_0x5c3ed6['query'][_0x0808('0x2e')]);}_0x3d16fe[_0x0808('0x73')]=qs[_0x0808('0x4d')](_0x5c3ed6[_0x0808('0x45')][_0x0808('0x4d')]);_0x3d16fe[_0x0808('0x4e')]=qs[_0x0808('0x47')](_[_0x0808('0x4f')](_0x5c3ed6['query'],_0x453573[_0x0808('0x47')]));_0x3d16fe[_0x0808('0x4e')][_0x0808('0x67')]=_0xe25f6b['id'];if(_0x5c3ed6['query'][_0x0808('0x50')]){_0x3d16fe[_0x0808('0x4e')]=_[_0x0808('0x51')](_0x3d16fe[_0x0808('0x4e')],{'$or':_[_0x0808('0x44')](_0x3d16fe[_0x0808('0x49')],function(_0x47d432){var _0x2eb8ec={};_0x2eb8ec[_0x47d432]={'$like':'%'+_0x5c3ed6[_0x0808('0x45')][_0x0808('0x50')]+'%'};return _0x2eb8ec;})});}if(_0x5c3ed6[_0x0808('0x45')][_0x0808('0xa2')]){var _0xc23c8f=_0x5c3ed6[_0x0808('0x45')][_0x0808('0xa2')][_0x0808('0xa3')](',');var _0x5950cf={};_0x5950cf[_0xc23c8f[0x0]]={'$gte':moment(_0xc23c8f[0x1])[_0x0808('0xa4')](_0x0808('0xa5'))};_0x3d16fe['where']=_[_0x0808('0x51')](_0x3d16fe[_0x0808('0x4e')],_0x5950cf);}_0x3d16fe=_['merge']({},_0x3d16fe,_0x5c3ed6[_0x0808('0x52')]);return db[_0x0808('0xa6')][_0x0808('0x53')]({'where':_0x3d16fe['where']})[_0x0808('0x1f')](function(_0x25f602){_0x5b38c9[_0x0808('0x53')]=_0x25f602;if(_0x5c3ed6[_0x0808('0x45')][_0x0808('0x54')]){_0x3d16fe['include']=[{'all':!![]}];}return db[_0x0808('0xa6')][_0x0808('0x55')](_0x3d16fe);})[_0x0808('0x1f')](function(_0x55bc54){_0x5b38c9[_0x0808('0x56')]=_0x55bc54;return _0x5b38c9;});}})[_0x0808('0x1f')](respondWithFilteredResult(_0x3ede28,_0x3d16fe))[_0x0808('0x29')](handleError(_0x3ede28,null));};exports[_0x0808('0x84')]=function(_0x286c56,_0x2f3cfe,_0x4e9822){var _0x36c465,_0x446514={},_0x56b742;if(_0x286c56['body']['to']){_0x56b742=_0x286c56[_0x0808('0x63')]['to'][0x0];}return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x286c56['params']['id']},'include':[{'model':db['CmList'],'as':_0x0808('0xa7'),'include':[{'model':db[_0x0808('0xa8')],'as':_0x0808('0xa9'),'where':{'fax':_0x56b742},'limit':0x1,'order':[[_0x0808('0x9e'),'DESC']]}]}]})[_0x0808('0x1f')](handleEntityNotFound(_0x2f3cfe,null))['then'](function(_0x1c1659){_0x36c465=_0x1c1659;if(_0x286c56[_0x0808('0x63')][_0x0808('0xaa')]&&_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][_0x0808('0x4b')]){for(var _0x50399a=0x0;_0x50399a<_0x286c56['body'][_0x0808('0xaa')][_0x0808('0x4b')];_0x50399a+=0x1){_0x286c56[_0x0808('0x63')]['attachments'][_0x50399a]={'filename':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][_0x50399a][_0x0808('0x3b')],'id':_0x286c56['body'][_0x0808('0xaa')][_0x50399a]['id'],'path':path['join'](config[_0x0808('0xab')],'server/files/attachments',_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][_0x50399a][_0x0808('0xac')])};}}return respondWithRpcPromise(_0x0808('0xad'),_0x0808('0xad'),{'FaxAccountId':_['isNil'](_0x286c56[_0x0808('0x58')]['id'])?undefined:_0x286c56[_0x0808('0x58')]['id'],'path':_[_0x0808('0xae')](_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0][_0x0808('0x6')])?undefined:_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0][_0x0808('0x6')],'fax':_[_0x0808('0xae')](_0x286c56['body']['to'][0x0])?undefined:_0x286c56[_0x0808('0x63')]['to'][0x0]},client9002);})[_0x0808('0x1f')](function(){if(_0x36c465){if(_[_0x0808('0xae')](_0x286c56[_0x0808('0x63')]['from'])){_0x286c56[_0x0808('0x63')][_0x0808('0xaf')]=util[_0x0808('0xa4')](_0x0808('0xb0'),_0x36c465[_0x0808('0x3b')],_0x36c465[_0x0808('0xb1')]);}if(_0x36c465[_0x0808('0xa7')]){if(_0x36c465[_0x0808('0xa7')][_0x0808('0xa9')][_0x0808('0x4b')]){return _0x36c465[_0x0808('0xa7')][_0x0808('0xa9')][0x0];}else{return db[_0x0808('0xa8')][_0x0808('0x5b')](_[_0x0808('0x19')](_0x286c56[_0x0808('0x63')],{'firstName':_0x286c56[_0x0808('0x63')]['to'][0x0],'phone':_0x286c56[_0x0808('0x63')]['to'][0x0],'fax':_0x286c56[_0x0808('0x63')]['to'][0x0],'ListId':_0x36c465[_0x0808('0x9f')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0808('0x1f')](function(_0xcf278f){if(_0xcf278f){return db['FaxInteraction'][_0x0808('0x64')]({'where':{'ContactId':_0xcf278f['id'],'closed':![],'FaxAccountId':_0x36c465['id']}})[_0x0808('0x1f')](function(_0x3e2fcb){if(_0x3e2fcb){return[_0x3e2fcb,![]];}return db[_0x0808('0x70')][_0x0808('0x5b')]({'UserId':_0x286c56['user']['id'],'ContactId':_0xcf278f['id'],'FaxAccountId':_0x36c465['id'],'fax':_0x286c56[_0x0808('0x63')]['to'][0x0],'firstMsgDirection':_0x0808('0xb2'),'Messages':[_['merge'](_0x286c56['body'],{'read':![],'body':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0][_0x0808('0xb3')],'FaxAccountId':_0x36c465['id'],'UserId':_0x286c56[_0x0808('0x5e')]['id'],'ContactId':_0xcf278f['id'],'AttachmentId':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x0808('0xb4')}]})['then'](function(_0x3592e7){return[_0x3592e7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0808('0xb5')](function(_0x34f065,_0x14c734){if(_0x14c734){return _0x34f065;}return db['FaxMessage'][_0x0808('0x5b')]({'direction':_0x0808('0xb2'),'read':![],'body':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0][_0x0808('0xb3')],'FaxAccountId':_0x36c465['id'],'FaxInteractionId':_0x34f065['id'],'UserId':_0x286c56['user']['id'],'ContactId':_0x34f065[_0x0808('0xb6')],'AttachmentId':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0]['id']})[_0x0808('0x1f')](function(_0x277acb){_0x34f065[_0x0808('0xb7')][_0x0808('0xb4')]=[];_0x34f065['dataValues'][_0x0808('0xb4')][_0x0808('0x8b')](_0x277acb[_0x0808('0xb7')]);return _0x34f065;});})[_0x0808('0x1f')](function(_0x292d91){respondWithRpcPromise(_0x0808('0xb8'),_0x0808('0xb8'),{'FaxAccountId':_[_0x0808('0xae')](_0x286c56[_0x0808('0x58')]['id'])?undefined:_0x286c56[_0x0808('0x58')]['id'],'path':_[_0x0808('0xae')](_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0][_0x0808('0x6')])?undefined:_0x286c56['body'][_0x0808('0xaa')][0x0][_0x0808('0x6')],'fax':_[_0x0808('0xae')](_0x286c56[_0x0808('0x63')]['to'][0x0])?undefined:_0x286c56[_0x0808('0x63')]['to'][0x0],'AttachmentId':_0x286c56[_0x0808('0x63')][_0x0808('0xaa')][0x0]['id']},client9002)[_0x0808('0x1f')](function(_0x27c05d){logger[_0x0808('0x20')]('SendFaxRpc,\x20%s',_0x27c05d);})[_0x0808('0x29')](function(_0x38763d){logger[_0x0808('0x20')](_0x0808('0xb9'),_0x38763d);});return _0x292d91;})[_0x0808('0x1f')](respondWithResult(_0x2f3cfe,null))[_0x0808('0x29')](handleError(_0x2f3cfe,null));};exports['addAgents']=function(_0x41e33a,_0x10b139,_0x5c482f){return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x41e33a[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x10b139,null))[_0x0808('0x1f')](function(_0x254b91){if(_0x254b91){return _0x254b91[_0x0808('0xba')](_0x41e33a[_0x0808('0x63')][_0x0808('0x72')],_[_0x0808('0x9c')](_0x41e33a[_0x0808('0x63')],[_0x0808('0x72'),'id'])||{})[_0x0808('0xb5')](function(_0x235aee){for(var _0x5733fe=0x0;_0x5733fe<_0x41e33a[_0x0808('0x63')][_0x0808('0x72')][_0x0808('0x4b')];_0x5733fe+=0x1){socket[_0x0808('0xbb')]('userFaxAccount:save',{'UserId':Number(_0x41e33a[_0x0808('0x63')]['ids'][_0x5733fe]),'FaxAccountId':Number(_0x41e33a[_0x0808('0x58')]['id'])});}return _0x235aee;});}})[_0x0808('0x1f')](respondWithResult(_0x10b139,null))[_0x0808('0x29')](handleError(_0x10b139,null));};exports[_0x0808('0xbc')]=function(_0x54ae13,_0x19c0c6,_0x44535c){return db[_0x0808('0x3e')][_0x0808('0x64')]({'where':{'id':_0x54ae13[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x19c0c6,null))[_0x0808('0x1f')](function(_0x1c3801){if(_0x1c3801){return _0x1c3801[_0x0808('0xbc')](_0x54ae13[_0x0808('0x45')][_0x0808('0x72')])[_0x0808('0x1f')](function(){if(_[_0x0808('0xbd')](_0x54ae13[_0x0808('0x45')][_0x0808('0x72')])){for(var _0x21f604=0x0;_0x21f604<_0x54ae13[_0x0808('0x45')][_0x0808('0x72')][_0x0808('0x4b')];_0x21f604+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x54ae13[_0x0808('0x45')][_0x0808('0x72')][_0x21f604]),'FaxAccountId':Number(_0x54ae13[_0x0808('0x58')]['id'])});}}else{socket['emit'](_0x0808('0xbe'),{'UserId':Number(_0x54ae13[_0x0808('0x45')][_0x0808('0x72')]),'FaxAccountId':Number(_0x54ae13['params']['id'])});}});}})[_0x0808('0x1f')](respondWithStatusCode(_0x19c0c6,null))[_0x0808('0x29')](handleError(_0x19c0c6,null));};exports[_0x0808('0xbf')]=function(_0x7d6ca8,_0x26c1b4,_0x2e701f){var _0x1fd93={};var _0x4f6a5e={};var _0xcb9df6;var _0x5ac4f6;return db[_0x0808('0x3e')][_0x0808('0x69')]({'where':{'id':_0x7d6ca8[_0x0808('0x58')]['id']}})[_0x0808('0x1f')](handleEntityNotFound(_0x26c1b4,null))[_0x0808('0x1f')](function(_0x4d0f9d){if(_0x4d0f9d){_0xcb9df6=_0x4d0f9d;_0x4f6a5e['model']=_['keys'](db[_0x0808('0x75')][_0x0808('0x3f')]);_0x4f6a5e['query']=_['keys'](_0x7d6ca8[_0x0808('0x45')]);_0x4f6a5e['filters']=_[_0x0808('0x48')](_0x4f6a5e[_0x0808('0x43')],_0x4f6a5e[_0x0808('0x45')]);_0x1fd93[_0x0808('0x49')]=_[_0x0808('0x48')](_0x4f6a5e[_0x0808('0x43')],qs[_0x0808('0x4a')](_0x7d6ca8[_0x0808('0x45')][_0x0808('0x4a')]));_0x1fd93['attributes']=_0x1fd93[_0x0808('0x49')][_0x0808('0x4b')]?_0x1fd93['attributes']:_0x4f6a5e[_0x0808('0x43')];_0x1fd93[_0x0808('0x73')]=qs[_0x0808('0x4d')](_0x7d6ca8[_0x0808('0x45')][_0x0808('0x4d')]);_0x1fd93[_0x0808('0x4e')]=qs[_0x0808('0x47')](_[_0x0808('0x4f')](_0x7d6ca8[_0x0808('0x45')],_0x4f6a5e[_0x0808('0x47')]));if(_0x7d6ca8[_0x0808('0x45')][_0x0808('0x50')]){_0x1fd93[_0x0808('0x4e')]=_[_0x0808('0x51')](_0x1fd93['where'],{'$or':_['map'](_0x1fd93['attributes'],function(_0xe8fa1f){var _0x1b9a60={};_0x1b9a60[_0xe8fa1f]={'$like':'%'+_0x7d6ca8[_0x0808('0x45')][_0x0808('0x50')]+'%'};return _0x1b9a60;})});}_0x1fd93=_[_0x0808('0x51')]({},_0x1fd93,_0x7d6ca8[_0x0808('0x52')]);return _0xcb9df6[_0x0808('0xbf')](_0x1fd93);}})[_0x0808('0x1f')](function(_0x1a233e){if(_0x1a233e){_0x5ac4f6=_0x1a233e[_0x0808('0x4b')];if(!_0x7d6ca8[_0x0808('0x45')][_0x0808('0x4c')](_0x0808('0x6b'))){_0x1fd93[_0x0808('0x30')]=qs[_0x0808('0x30')](_0x7d6ca8[_0x0808('0x45')][_0x0808('0x30')]);_0x1fd93[_0x0808('0x2e')]=qs['offset'](_0x7d6ca8[_0x0808('0x45')][_0x0808('0x2e')]);}return _0xcb9df6[_0x0808('0xbf')](_0x1fd93);}})[_0x0808('0x1f')](function(_0x4e1244){if(_0x4e1244){return _0x4e1244?{'count':_0x5ac4f6,'rows':_0x4e1244}:null;}})[_0x0808('0x1f')](respondWithResult(_0x26c1b4,null))[_0x0808('0x29')](handleError(_0x26c1b4,null));}; \ No newline at end of file +var _0xcb9f=['findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','update','get','FaxAccounts','UserProfileResource','name','send','map','FaxAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','keys','length','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','CmContact','Owner','internal','Tag','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','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','bulkCreate','omit','tech','key','createdAt','updatedAt','TrunkId','ListId'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xcb9f,0x1b9));var _0xfcb9=function(_0x5b380a,_0x713c2b){_0x5b380a=_0x5b380a-0x0;var _0x421f55=_0xcb9f[_0x5b380a];return _0x421f55;};'use strict';var emlformat=require(_0xfcb9('0x0'));var rimraf=require(_0xfcb9('0x1'));var zipdir=require(_0xfcb9('0x2'));var jsonpatch=require(_0xfcb9('0x3'));var rp=require(_0xfcb9('0x4'));var moment=require(_0xfcb9('0x5'));var BPromise=require(_0xfcb9('0x6'));var Mustache=require('mustache');var util=require(_0xfcb9('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfcb9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcb9('0x9'));var _=require(_0xfcb9('0xa'));var squel=require(_0xfcb9('0xb'));var crypto=require('crypto');var jsforce=require(_0xfcb9('0xc'));var deskjs=require(_0xfcb9('0xd'));var toCsv=require(_0xfcb9('0x8'));var querystring=require(_0xfcb9('0xe'));var Papa=require(_0xfcb9('0xf'));var Redis=require(_0xfcb9('0x10'));var authService=require(_0xfcb9('0x11'));var qs=require(_0xfcb9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcb9('0x13'));var logger=require(_0xfcb9('0x14'))(_0xfcb9('0x15'));var utils=require(_0xfcb9('0x16'));var config=require(_0xfcb9('0x17'));var licenseUtil=require(_0xfcb9('0x18'));var db=require(_0xfcb9('0x19'))['db'];config[_0xfcb9('0x1a')]=_[_0xfcb9('0x1b')](config['redis'],{'host':_0xfcb9('0x1c'),'port':0x18eb});var socket=require(_0xfcb9('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xfcb9('0x1e')](socket);var jayson=require(_0xfcb9('0x1f'));var client=jayson[_0xfcb9('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xfcb9('0x20')][_0xfcb9('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2e248b,_0x4e8544,_0x5d7a04,_0x52e6a9){return new BPromise(function(_0x313449,_0xecc5f9){var _0x11a925=_0x52e6a9||client;return _0x11a925[_0xfcb9('0x22')](_0x2e248b,_0x5d7a04)[_0xfcb9('0x23')](function(_0x2d56fd){logger['info'](_0xfcb9('0x24'),_0x4e8544,'request\x20sent');logger[_0xfcb9('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4e8544,_0xfcb9('0x26'),JSON[_0xfcb9('0x27')](_0x2d56fd));if(_0x2d56fd['error']){if(_0x2d56fd[_0xfcb9('0x28')][_0xfcb9('0x29')]===0x1f4){logger[_0xfcb9('0x28')](_0xfcb9('0x24'),_0x4e8544,_0x2d56fd['error'][_0xfcb9('0x2a')]);return _0xecc5f9(_0x2d56fd[_0xfcb9('0x28')][_0xfcb9('0x2a')]);}logger[_0xfcb9('0x28')](_0xfcb9('0x24'),_0x4e8544,_0x2d56fd[_0xfcb9('0x28')][_0xfcb9('0x2a')]);return _0x313449(_0x2d56fd['error'][_0xfcb9('0x2a')]);}else{logger[_0xfcb9('0x2b')](_0xfcb9('0x24'),_0x4e8544,_0xfcb9('0x26'));_0x313449(_0x2d56fd[_0xfcb9('0x2c')][_0xfcb9('0x2a')]);}})[_0xfcb9('0x2d')](function(_0x5424d3){logger[_0xfcb9('0x28')](_0xfcb9('0x24'),_0x4e8544,_0x5424d3);_0xecc5f9(_0x5424d3);});});}function respondWithStatusCode(_0x29d0ea,_0x528fc4){_0x528fc4=_0x528fc4||0xcc;return function(_0x1b15df){if(_0x1b15df){return _0x29d0ea[_0xfcb9('0x2e')](_0x528fc4);}return _0x29d0ea[_0xfcb9('0x2f')](_0x528fc4)[_0xfcb9('0x30')]();};}function respondWithResult(_0x43458b,_0x3b8f82){_0x3b8f82=_0x3b8f82||0xc8;return function(_0x175ade){if(_0x175ade){return _0x43458b[_0xfcb9('0x2f')](_0x3b8f82)['json'](_0x175ade);}};}function respondWithFilteredResult(_0x59a117,_0x211108){return function(_0x35bac7){if(_0x35bac7){var _0x1bf5b9=typeof _0x211108[_0xfcb9('0x31')]==='undefined'&&typeof _0x211108[_0xfcb9('0x32')]===_0xfcb9('0x33');var _0xbe8e50=_0x35bac7[_0xfcb9('0x34')];var _0x161883=_0x1bf5b9?0x0:_0x211108[_0xfcb9('0x31')];var _0x364622=_0x1bf5b9?_0x35bac7[_0xfcb9('0x34')]:_0x211108[_0xfcb9('0x31')]+_0x211108[_0xfcb9('0x32')];var _0xad41da;if(_0x364622>=_0xbe8e50){_0x364622=_0xbe8e50;_0xad41da=0xc8;}else{_0xad41da=0xce;}_0x59a117[_0xfcb9('0x2f')](_0xad41da);return _0x59a117['set']('Content-Range',_0x161883+'-'+_0x364622+'/'+_0xbe8e50)[_0xfcb9('0x35')](_0x35bac7);}return null;};}function patchUpdates(_0x51fceb){return function(_0x58feaa){try{jsonpatch['apply'](_0x58feaa,_0x51fceb,!![]);}catch(_0x2d8d47){return BPromise[_0xfcb9('0x36')](_0x2d8d47);}return _0x58feaa[_0xfcb9('0x37')]();};}function saveUpdates(_0x3324d1,_0x4c4dd8){return function(_0x3d272a){if(_0x3d272a){return _0x3d272a[_0xfcb9('0x38')](_0x3324d1)[_0xfcb9('0x23')](function(_0x1b0a9b){return _0x1b0a9b;});}return null;};}function removeEntity(_0x2d01d5,_0x39b704){return function(_0x31886f){if(_0x31886f){return _0x31886f['destroy']()[_0xfcb9('0x23')](function(){var _0x4fd5f0=_0x31886f[_0xfcb9('0x39')]({'plain':!![]});var _0x2b8720=_0xfcb9('0x3a');return db[_0xfcb9('0x3b')]['destroy']({'where':{'type':_0x2b8720,'resourceId':_0x4fd5f0['id']}})[_0xfcb9('0x23')](function(){return _0x31886f;});})[_0xfcb9('0x23')](function(){_0x2d01d5[_0xfcb9('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46674f,_0x5ac3d2){return function(_0x1e756c){if(!_0x1e756c){_0x46674f[_0xfcb9('0x2e')](0x194);}return _0x1e756c;};}function handleError(_0x4f812d,_0x69424a){_0x69424a=_0x69424a||0x1f4;return function(_0x63e0c){logger[_0xfcb9('0x28')](_0x63e0c['stack']);if(_0x63e0c[_0xfcb9('0x3c')]){delete _0x63e0c['name'];}_0x4f812d[_0xfcb9('0x2f')](_0x69424a)[_0xfcb9('0x3d')](_0x63e0c);};}exports['index']=function(_0x5050cb,_0x3b8199){var _0x2efd9a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5715b4={},_0x199263={'count':0x0,'rows':[]};var _0x3ae1a3=_[_0xfcb9('0x3e')](db[_0xfcb9('0x3f')][_0xfcb9('0x40')],function(_0xd7948f){return{'name':_0xd7948f[_0xfcb9('0x41')],'type':_0xd7948f[_0xfcb9('0x42')]['key']};});_0x5715b4[_0xfcb9('0x43')]=_[_0xfcb9('0x3e')](_0x3ae1a3,_0xfcb9('0x3c'));_0x5715b4[_0xfcb9('0x44')]=_['keys'](_0x5050cb['query']);_0x5715b4[_0xfcb9('0x45')]=_['intersection'](_0x5715b4[_0xfcb9('0x43')],_0x5715b4[_0xfcb9('0x44')]);_0x2efd9a['attributes']=_[_0xfcb9('0x46')](_0x5715b4[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x5050cb[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x2efd9a[_0xfcb9('0x48')]=_0x2efd9a[_0xfcb9('0x48')]['length']?_0x2efd9a[_0xfcb9('0x48')]:_0x5715b4[_0xfcb9('0x43')];if(!_0x5050cb[_0xfcb9('0x44')][_0xfcb9('0x49')](_0xfcb9('0x4a'))){_0x2efd9a[_0xfcb9('0x32')]=qs[_0xfcb9('0x32')](_0x5050cb[_0xfcb9('0x44')]['limit']);_0x2efd9a[_0xfcb9('0x31')]=qs['offset'](_0x5050cb['query'][_0xfcb9('0x31')]);}_0x2efd9a[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x5050cb['query']['sort']);_0x2efd9a[_0xfcb9('0x4d')]=qs[_0xfcb9('0x45')](_[_0xfcb9('0x4e')](_0x5050cb[_0xfcb9('0x44')],_0x5715b4[_0xfcb9('0x45')]),_0x3ae1a3);if(_0x5050cb['query'][_0xfcb9('0x4f')]){_0x2efd9a['where']=_[_0xfcb9('0x50')](_0x2efd9a['where'],{'$or':_['map'](_0x3ae1a3,function(_0x2f991c){if(_0x2f991c['type']!=='VIRTUAL'){var _0x1a161b={};_0x1a161b[_0x2f991c[_0xfcb9('0x3c')]]={'$like':'%'+_0x5050cb[_0xfcb9('0x44')][_0xfcb9('0x4f')]+'%'};return _0x1a161b;}})});}_0x2efd9a=_[_0xfcb9('0x50')]({},_0x2efd9a,_0x5050cb[_0xfcb9('0x51')]);var _0x2e7bcc={'where':_0x2efd9a[_0xfcb9('0x4d')]};return db[_0xfcb9('0x3f')][_0xfcb9('0x34')](_0x2e7bcc)['then'](function(_0x2727fb){_0x199263[_0xfcb9('0x34')]=_0x2727fb;if(_0x5050cb[_0xfcb9('0x44')][_0xfcb9('0x52')]){_0x2efd9a[_0xfcb9('0x53')]=[{'all':!![]}];}return db[_0xfcb9('0x3f')][_0xfcb9('0x54')](_0x2efd9a);})['then'](function(_0x57b714){_0x199263[_0xfcb9('0x55')]=_0x57b714;return _0x199263;})['then'](respondWithFilteredResult(_0x3b8199,_0x2efd9a))[_0xfcb9('0x2d')](handleError(_0x3b8199,null));};exports[_0xfcb9('0x56')]=function(_0x3d4ecf,_0x47c793){var _0x4e72df={'raw':![],'where':{'id':_0x3d4ecf['params']['id']},'include':[{'model':db[_0xfcb9('0x57')],'as':_0xfcb9('0x58')}]},_0x8bccb={};_0x8bccb[_0xfcb9('0x43')]=_[_0xfcb9('0x59')](db['FaxAccount']['rawAttributes']);_0x8bccb[_0xfcb9('0x44')]=_[_0xfcb9('0x59')](_0x3d4ecf[_0xfcb9('0x44')]);_0x8bccb[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x8bccb[_0xfcb9('0x43')],_0x8bccb[_0xfcb9('0x44')]);_0x4e72df['attributes']=_[_0xfcb9('0x46')](_0x8bccb['model'],qs[_0xfcb9('0x47')](_0x3d4ecf[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x4e72df[_0xfcb9('0x48')]=_0x4e72df[_0xfcb9('0x48')][_0xfcb9('0x5a')]?_0x4e72df[_0xfcb9('0x48')]:_0x8bccb['model'];if(_0x3d4ecf[_0xfcb9('0x44')][_0xfcb9('0x52')]){_0x4e72df['include']=[{'all':!![]}];}_0x4e72df=_['merge']({},_0x4e72df,_0x3d4ecf[_0xfcb9('0x51')]);return db[_0xfcb9('0x3f')]['find'](_0x4e72df)['then'](handleEntityNotFound(_0x47c793,null))[_0xfcb9('0x23')](respondWithResult(_0x47c793,null))[_0xfcb9('0x2d')](handleError(_0x47c793,null));};exports['create']=function(_0x622f54,_0x21275e){return db[_0xfcb9('0x3f')][_0xfcb9('0x5b')](_0x622f54[_0xfcb9('0x5c')],{})[_0xfcb9('0x23')](function(_0x1c836c){var _0x4c950e=_0x622f54[_0xfcb9('0x5d')][_0xfcb9('0x39')]({'plain':!![]});if(!_0x4c950e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c950e[_0xfcb9('0x5e')]===_0xfcb9('0x5d')){var _0x281bde=_0x1c836c['get']({'plain':!![]});var _0x3a6b97=_0xfcb9('0x3a');return db['UserProfileSection'][_0xfcb9('0x5f')]({'where':{'name':_0x3a6b97,'userProfileId':_0x4c950e[_0xfcb9('0x60')]},'raw':!![]})[_0xfcb9('0x23')](function(_0x234b26){if(_0x234b26&&_0x234b26[_0xfcb9('0x61')]===0x0){return db[_0xfcb9('0x3b')][_0xfcb9('0x5b')]({'name':_0x281bde[_0xfcb9('0x3c')],'resourceId':_0x281bde['id'],'type':_0x234b26[_0xfcb9('0x3c')],'sectionId':_0x234b26['id']},{})[_0xfcb9('0x23')](function(){return _0x1c836c;});}else{return _0x1c836c;}})[_0xfcb9('0x2d')](function(_0x13ea86){logger[_0xfcb9('0x28')](_0xfcb9('0x62'),_0x13ea86);throw _0x13ea86;});}return _0x1c836c;})[_0xfcb9('0x23')](respondWithResult(_0x21275e,0xc9))[_0xfcb9('0x2d')](handleError(_0x21275e,null));};exports['update']=function(_0x517387,_0x5ee876){if(_0x517387[_0xfcb9('0x5c')]['id']){delete _0x517387[_0xfcb9('0x5c')]['id'];}return db[_0xfcb9('0x3f')][_0xfcb9('0x5f')]({'where':{'id':_0x517387[_0xfcb9('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0xfcb9('0x58')}]})[_0xfcb9('0x23')](handleEntityNotFound(_0x5ee876,null))['then'](saveUpdates(_0x517387['body'],null))[_0xfcb9('0x23')](respondWithResult(_0x5ee876,null))[_0xfcb9('0x2d')](handleError(_0x5ee876,null));};exports[_0xfcb9('0x64')]=function(_0x2dd1b3,_0x18d840){return db['FaxAccount']['find']({'where':{'id':_0x2dd1b3['params']['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x18d840,null))[_0xfcb9('0x23')](removeEntity(_0x18d840,null))[_0xfcb9('0x2d')](handleError(_0x18d840,null));};exports['describe']=function(_0x2ec36b,_0x96eafb){return db[_0xfcb9('0x3f')]['describe']()[_0xfcb9('0x23')](respondWithResult(_0x96eafb,null))['catch'](handleError(_0x96eafb,null));};exports[_0xfcb9('0x65')]=function(_0x24a307,_0x223f3a,_0x527b4f){if(_0x24a307['body']['id']){delete _0x24a307[_0xfcb9('0x5c')]['id'];}return db['FaxAccount'][_0xfcb9('0x5f')]({'where':{'id':_0x24a307[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x223f3a,null))['then'](function(_0x528a11){if(_0x528a11){_0x24a307[_0xfcb9('0x5c')][_0xfcb9('0x66')]=_0x528a11['id'];return db['Disposition'][_0xfcb9('0x5b')](_0x24a307['body']);}})[_0xfcb9('0x23')](respondWithResult(_0x223f3a,null))[_0xfcb9('0x2d')](handleError(_0x223f3a,null));};exports[_0xfcb9('0x67')]=function(_0x1630fa,_0x2fb182,_0x53cec3){var _0x1c42b9={'raw':![],'where':{}};var _0x30d2e3={};var _0xab7af5={'count':0x0,'rows':[]};return db[_0xfcb9('0x3f')][_0xfcb9('0x68')]({'where':{'id':_0x1630fa[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x2fb182,null))[_0xfcb9('0x23')](function(_0x13b914){if(_0x13b914){_0x30d2e3[_0xfcb9('0x43')]=_[_0xfcb9('0x59')](db[_0xfcb9('0x69')]['rawAttributes']);_0x30d2e3[_0xfcb9('0x44')]=_[_0xfcb9('0x59')](_0x1630fa[_0xfcb9('0x44')]);_0x30d2e3[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x30d2e3[_0xfcb9('0x43')],_0x30d2e3[_0xfcb9('0x44')]);_0x1c42b9['attributes']=_[_0xfcb9('0x46')](_0x30d2e3['model'],qs['fields'](_0x1630fa[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x1c42b9[_0xfcb9('0x48')]=_0x1c42b9[_0xfcb9('0x48')][_0xfcb9('0x5a')]?_0x1c42b9[_0xfcb9('0x48')]:_0x30d2e3[_0xfcb9('0x43')];if(!_0x1630fa['query'][_0xfcb9('0x49')](_0xfcb9('0x4a'))){_0x1c42b9[_0xfcb9('0x32')]=qs[_0xfcb9('0x32')](_0x1630fa[_0xfcb9('0x44')][_0xfcb9('0x32')]);_0x1c42b9['offset']=qs[_0xfcb9('0x31')](_0x1630fa[_0xfcb9('0x44')][_0xfcb9('0x31')]);}_0x1c42b9['order']=qs[_0xfcb9('0x4c')](_0x1630fa[_0xfcb9('0x44')][_0xfcb9('0x4c')]);_0x1c42b9[_0xfcb9('0x4d')]=qs[_0xfcb9('0x45')](_[_0xfcb9('0x4e')](_0x1630fa['query'],_0x30d2e3[_0xfcb9('0x45')]));_0x1c42b9[_0xfcb9('0x4d')][_0xfcb9('0x66')]=_0x13b914['id'];if(_0x1630fa[_0xfcb9('0x44')][_0xfcb9('0x4f')]){_0x1c42b9[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x1c42b9['where'],{'$or':_[_0xfcb9('0x3e')](_0x1c42b9[_0xfcb9('0x48')],function(_0x34fa5a){var _0x4a28f9={};_0x4a28f9[_0x34fa5a]={'$like':'%'+_0x1630fa[_0xfcb9('0x44')]['filter']+'%'};return _0x4a28f9;})});}_0x1c42b9=_[_0xfcb9('0x50')]({},_0x1c42b9,_0x1630fa[_0xfcb9('0x51')]);return db[_0xfcb9('0x69')]['count']({'where':_0x1c42b9[_0xfcb9('0x4d')]})[_0xfcb9('0x23')](function(_0x47d4b){_0xab7af5['count']=_0x47d4b;if(_0x1630fa['query'][_0xfcb9('0x52')]){_0x1c42b9[_0xfcb9('0x53')]=[{'all':!![]}];}return db[_0xfcb9('0x69')]['findAll'](_0x1c42b9);})[_0xfcb9('0x23')](function(_0x2dda25){_0xab7af5[_0xfcb9('0x55')]=_0x2dda25;return _0xab7af5;});}})[_0xfcb9('0x23')](respondWithFilteredResult(_0x2fb182,_0x1c42b9))[_0xfcb9('0x2d')](handleError(_0x2fb182,null));};exports[_0xfcb9('0x6a')]=function(_0x3f12c5,_0x2d26,_0x269fa1){return db[_0xfcb9('0x3f')][_0xfcb9('0x5f')]({'where':{'id':_0x3f12c5[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x2d26,null))['then'](function(_0x195c0f){if(_0x195c0f){return _0x195c0f['removeDispositions'](_0x3f12c5[_0xfcb9('0x44')][_0xfcb9('0x6b')]);}})[_0xfcb9('0x23')](respondWithStatusCode(_0x2d26,null))['catch'](handleError(_0x2d26,null));};exports['addAnswer']=function(_0x24cb3a,_0x3882ad,_0x2abe7d){if(_0x24cb3a['body']['id']){delete _0x24cb3a['body']['id'];}return db[_0xfcb9('0x3f')][_0xfcb9('0x5f')]({'where':{'id':_0x24cb3a[_0xfcb9('0x63')]['id']}})['then'](handleEntityNotFound(_0x3882ad,null))[_0xfcb9('0x23')](function(_0x3256a5){if(_0x3256a5){_0x24cb3a['body'][_0xfcb9('0x66')]=_0x3256a5['id'];return db[_0xfcb9('0x6c')][_0xfcb9('0x5b')](_0x24cb3a[_0xfcb9('0x5c')]);}})[_0xfcb9('0x23')](respondWithResult(_0x3882ad,null))[_0xfcb9('0x2d')](handleError(_0x3882ad,null));};exports[_0xfcb9('0x6d')]=function(_0x4b98e3,_0x19dc64,_0x543432){var _0x5d6251={'raw':![],'where':{}};var _0x11ddef={};var _0x5f4da8={'count':0x0,'rows':[]};return db[_0xfcb9('0x3f')]['findOne']({'where':{'id':_0x4b98e3[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x19dc64,null))['then'](function(_0x8a5edf){if(_0x8a5edf){_0x11ddef[_0xfcb9('0x43')]=_['keys'](db[_0xfcb9('0x6c')]['rawAttributes']);_0x11ddef[_0xfcb9('0x44')]=_[_0xfcb9('0x59')](_0x4b98e3[_0xfcb9('0x44')]);_0x11ddef[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x11ddef[_0xfcb9('0x43')],_0x11ddef[_0xfcb9('0x44')]);_0x5d6251['attributes']=_[_0xfcb9('0x46')](_0x11ddef[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x5d6251[_0xfcb9('0x48')]=_0x5d6251['attributes'][_0xfcb9('0x5a')]?_0x5d6251['attributes']:_0x11ddef[_0xfcb9('0x43')];if(!_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x49')](_0xfcb9('0x4a'))){_0x5d6251[_0xfcb9('0x32')]=qs['limit'](_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x32')]);_0x5d6251[_0xfcb9('0x31')]=qs[_0xfcb9('0x31')](_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x31')]);}_0x5d6251[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x4c')]);_0x5d6251['where']=qs[_0xfcb9('0x45')](_['pick'](_0x4b98e3[_0xfcb9('0x44')],_0x11ddef[_0xfcb9('0x45')]));_0x5d6251[_0xfcb9('0x4d')]['FaxAccountId']=_0x8a5edf['id'];if(_0x4b98e3['query'][_0xfcb9('0x4f')]){_0x5d6251[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x5d6251[_0xfcb9('0x4d')],{'$or':_[_0xfcb9('0x3e')](_0x5d6251[_0xfcb9('0x48')],function(_0x3cca19){var _0x1b1dd2={};_0x1b1dd2[_0x3cca19]={'$like':'%'+_0x4b98e3[_0xfcb9('0x44')]['filter']+'%'};return _0x1b1dd2;})});}_0x5d6251=_[_0xfcb9('0x50')]({},_0x5d6251,_0x4b98e3[_0xfcb9('0x51')]);return db[_0xfcb9('0x6c')][_0xfcb9('0x34')]({'where':_0x5d6251[_0xfcb9('0x4d')]})['then'](function(_0x18edd7){_0x5f4da8[_0xfcb9('0x34')]=_0x18edd7;if(_0x4b98e3[_0xfcb9('0x44')][_0xfcb9('0x52')]){_0x5d6251['include']=[{'all':!![]}];}return db[_0xfcb9('0x6c')][_0xfcb9('0x54')](_0x5d6251);})[_0xfcb9('0x23')](function(_0x305092){_0x5f4da8[_0xfcb9('0x55')]=_0x305092;return _0x5f4da8;});}})[_0xfcb9('0x23')](respondWithFilteredResult(_0x19dc64,_0x5d6251))[_0xfcb9('0x2d')](handleError(_0x19dc64,null));};exports[_0xfcb9('0x6e')]=function(_0x299582,_0x21d3cc,_0x2df633){return db[_0xfcb9('0x3f')][_0xfcb9('0x5f')]({'where':{'id':_0x299582[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x21d3cc,null))[_0xfcb9('0x23')](function(_0x8a7056){if(_0x8a7056){return _0x8a7056[_0xfcb9('0x6e')](_0x299582[_0xfcb9('0x44')][_0xfcb9('0x6b')]);}})['then'](respondWithStatusCode(_0x21d3cc,null))[_0xfcb9('0x2d')](handleError(_0x21d3cc,null));};exports['addInteraction']=function(_0x298a01,_0x1c0730,_0xb5419d){return db[_0xfcb9('0x6f')][_0xfcb9('0x5f')]({'where':{'id':_0x298a01['params']['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x1c0730,null))[_0xfcb9('0x23')](function(_0x55105c){if(_0x55105c){return _0x55105c[_0xfcb9('0x70')](_0x298a01[_0xfcb9('0x5c')]['ids'],_['omit'](_0x298a01[_0xfcb9('0x5c')],[_0xfcb9('0x6b'),'id'])||{});}})[_0xfcb9('0x23')](respondWithResult(_0x1c0730,null))[_0xfcb9('0x2d')](handleError(_0x1c0730,null));};exports['getInteractions']=function(_0x188a59,_0x59a4c8,_0x1d6ed1){var _0x9c350a={'raw':![],'where':{}};var _0x13aee2={};var _0x59ad89={'count':0x0,'rows':[]};return db[_0xfcb9('0x3f')][_0xfcb9('0x68')]({'where':{'id':_0x188a59[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x59a4c8,null))[_0xfcb9('0x23')](function(_0x49b630){if(_0x49b630){_0x13aee2[_0xfcb9('0x43')]=_['keys'](db[_0xfcb9('0x6f')]['rawAttributes']);_0x13aee2['query']=_[_0xfcb9('0x59')](_0x188a59[_0xfcb9('0x44')]);_0x13aee2[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x13aee2[_0xfcb9('0x43')],_0x13aee2[_0xfcb9('0x44')]);_0x9c350a[_0xfcb9('0x48')]=_[_0xfcb9('0x46')](_0x13aee2[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x9c350a[_0xfcb9('0x48')]=_0x9c350a[_0xfcb9('0x48')][_0xfcb9('0x5a')]?_0x9c350a[_0xfcb9('0x48')]:_0x13aee2['model'];if(!_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x49')]('nolimit')){_0x9c350a[_0xfcb9('0x32')]=qs[_0xfcb9('0x32')](_0x188a59['query'][_0xfcb9('0x32')]);_0x9c350a[_0xfcb9('0x31')]=qs[_0xfcb9('0x31')](_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x31')]);}_0x9c350a[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x4c')]);_0x9c350a[_0xfcb9('0x4d')]=qs[_0xfcb9('0x45')](_[_0xfcb9('0x4e')](_0x188a59[_0xfcb9('0x44')],_0x13aee2['filters']));_0x9c350a[_0xfcb9('0x4d')][_0xfcb9('0x66')]=_0x49b630['id'];if(_0x188a59['query'][_0xfcb9('0x4f')]){_0x9c350a[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x9c350a[_0xfcb9('0x4d')],{'$or':_[_0xfcb9('0x3e')](_0x9c350a[_0xfcb9('0x48')],function(_0x5eb362){var _0x42a7ff={};_0x42a7ff[_0x5eb362]={'$like':'%'+_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x4f')]+'%'};return _0x42a7ff;})});}_0x9c350a=_[_0xfcb9('0x50')]({},_0x9c350a,_0x188a59[_0xfcb9('0x51')]);return db[_0xfcb9('0x6f')][_0xfcb9('0x34')]({'where':_0x9c350a[_0xfcb9('0x4d')]})[_0xfcb9('0x23')](function(_0x3e9e21){_0x59ad89[_0xfcb9('0x34')]=_0x3e9e21;if(_0x188a59[_0xfcb9('0x44')]['includeAll']){_0x9c350a['include']=[{'model':db[_0xfcb9('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xfcb9('0x72'),'attributes':[_0xfcb9('0x3c'),'fullname',_0xfcb9('0x73')],'required':![]},{'model':db[_0xfcb9('0x74')],'as':'Tags','attributes':['id',_0xfcb9('0x3c'),_0xfcb9('0x75')],'where':_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x76')]?{'id':_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x76')]}:undefined,'required':_0x188a59[_0xfcb9('0x44')][_0xfcb9('0x76')]?!![]:![]}];}return db[_0xfcb9('0x6f')][_0xfcb9('0x54')](_0x9c350a);})['then'](function(_0x190095){_0x59ad89[_0xfcb9('0x55')]=_0x190095;return _0x59ad89;});}})[_0xfcb9('0x23')](respondWithFilteredResult(_0x59a4c8,_0x9c350a))[_0xfcb9('0x2d')](handleError(_0x59a4c8,null));};exports['addApplications']=function(_0x33e422,_0x3531bb){var _0x49d89a=_0x33e422[_0xfcb9('0x63')]['id'];var _0x25954e=_0x33e422[_0xfcb9('0x5c')];var _0x537c12=0xc8;var _0x26b1fe=null;return db[_0xfcb9('0x77')]['transaction']({'isolationLevel':db['sequelize'][_0xfcb9('0x78')][_0xfcb9('0x79')][_0xfcb9('0x7a')]},function(_0xbe7a7e){return db[_0xfcb9('0x3f')][_0xfcb9('0x68')]({'where':{'id':_0x49d89a},'transaction':_0xbe7a7e})[_0xfcb9('0x23')](function(_0x10695d){if(_0x10695d){return db[_0xfcb9('0x7b')]['destroy']({'where':{'FaxAccountId':_0x49d89a},'transaction':_0xbe7a7e})[_0xfcb9('0x23')](function(){var _0x417669=_['map'](_0x25954e,function(_0x578e6f){_0x578e6f['FaxAccountId']=_0x49d89a;return _0x578e6f;});return db[_0xfcb9('0x7b')]['bulkCreate'](_0x417669,{'transaction':_0xbe7a7e});});}else{_0x537c12=0x194;_0x26b1fe=[];}});})[_0xfcb9('0x23')](function(){if(_0x537c12!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x49d89a},'order':_0xfcb9('0x7c')})['then'](function(_0x553b61){_0x26b1fe=_0x553b61;});}})[_0xfcb9('0x2d')](function(_0x4c501a){_0x537c12=0x1f4;logger['error'](_0x4c501a[_0xfcb9('0x7d')]);if(_0x4c501a[_0xfcb9('0x3c')]){delete _0x4c501a['name'];}_0x26b1fe=_0x4c501a;})[_0xfcb9('0x7e')](function(){if(_0x26b1fe===null){_0x3531bb[_0xfcb9('0x2e')](_0x537c12);}else{if(_0x537c12===0x1f4){_0x3531bb[_0xfcb9('0x2f')](_0x537c12)['send'](_0x26b1fe);}else{_0x3531bb[_0xfcb9('0x2f')](_0x537c12)['json'](_0x26b1fe);}}});};exports[_0xfcb9('0x7f')]=function(_0x5ad034,_0x1e1dce,_0x694dfd){var _0x642b68={};var _0x3b5f69={};var _0x496ba9;var _0x52dd3a;return db[_0xfcb9('0x3f')][_0xfcb9('0x68')]({'where':{'id':_0x5ad034['params']['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x1e1dce,null))['then'](function(_0x40866a){if(_0x40866a){_0x496ba9=_0x40866a;_0x3b5f69[_0xfcb9('0x43')]=_[_0xfcb9('0x59')](db[_0xfcb9('0x7b')][_0xfcb9('0x40')]);_0x3b5f69['query']=_[_0xfcb9('0x59')](_0x5ad034['query']);_0x3b5f69[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x3b5f69[_0xfcb9('0x43')],_0x3b5f69[_0xfcb9('0x44')]);_0x642b68['attributes']=_[_0xfcb9('0x46')](_0x3b5f69[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x5ad034[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x642b68[_0xfcb9('0x48')]=_0x642b68[_0xfcb9('0x48')][_0xfcb9('0x5a')]?_0x642b68['attributes']:_0x3b5f69[_0xfcb9('0x43')];_0x642b68[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x5ad034['query'][_0xfcb9('0x4c')]);_0x642b68['where']=qs[_0xfcb9('0x45')](_['pick'](_0x5ad034[_0xfcb9('0x44')],_0x3b5f69['filters']));if(_0x5ad034['query'][_0xfcb9('0x4f')]){_0x642b68[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x642b68[_0xfcb9('0x4d')],{'$or':_[_0xfcb9('0x3e')](_0x642b68[_0xfcb9('0x48')],function(_0x154426){var _0x1fe5c7={};_0x1fe5c7[_0x154426]={'$like':'%'+_0x5ad034[_0xfcb9('0x44')][_0xfcb9('0x4f')]+'%'};return _0x1fe5c7;})});}_0x642b68=_[_0xfcb9('0x50')]({},_0x642b68,_0x5ad034[_0xfcb9('0x51')]);return _0x496ba9['getApplications'](_0x642b68);}})[_0xfcb9('0x23')](function(_0x44517a){if(_0x44517a){_0x52dd3a=_0x44517a['length'];if(!_0x5ad034[_0xfcb9('0x44')][_0xfcb9('0x49')]('nolimit')){_0x642b68[_0xfcb9('0x32')]=qs[_0xfcb9('0x32')](_0x5ad034[_0xfcb9('0x44')][_0xfcb9('0x32')]);_0x642b68[_0xfcb9('0x31')]=qs[_0xfcb9('0x31')](_0x5ad034[_0xfcb9('0x44')][_0xfcb9('0x31')]);}return _0x496ba9[_0xfcb9('0x7f')](_0x642b68);}})['then'](function(_0x56236c){if(_0x56236c){return _0x56236c?{'count':_0x52dd3a,'rows':_0x56236c}:null;}})[_0xfcb9('0x23')](respondWithResult(_0x1e1dce,null))[_0xfcb9('0x2d')](handleError(_0x1e1dce,null));};function Extension(_0x1de3c2,_0x1f7aee,_0x5dbe21,_0x1df8f9){this[_0xfcb9('0x80')]=_0xfcb9('0x81');this[_0xfcb9('0x82')]=_0x1de3c2[_0xfcb9('0x83')];this['app']=_0x1df8f9;this['type']=_0xfcb9('0x84');this[_0xfcb9('0x85')]=_0xfcb9('0x86');this[_0xfcb9('0x66')]=_0x1de3c2['id'];this[_0xfcb9('0x7c')]=_0x1f7aee;this['appdata']=_0x5dbe21;}function createExtensionsReciveFax(_0x3490f6){var _0x53516d=0x1;var _0x57c390=[];_0x57c390['push'](new Extension(_0x3490f6,_0x53516d,'',_0xfcb9('0x87')));_0x53516d+=0x1;_0x57c390[_0xfcb9('0x88')](new Extension(_0x3490f6,_0x53516d,_0xfcb9('0x89'),_0xfcb9('0x8a')));_0x53516d+=0x1;for(var _0x18f151 in _0x3490f6){if(_0x3490f6['hasOwnProperty'](_0x18f151)&&(_0x18f151===_0xfcb9('0x8b')||_0x18f151===_0xfcb9('0x83')||_0x18f151===_0xfcb9('0x8c')||_0x18f151===_0xfcb9('0x8d')||_0x18f151===_0xfcb9('0x8e')||_0x18f151===_0xfcb9('0x8f')||_0x18f151===_0xfcb9('0x90')||_0x18f151===_0xfcb9('0x91')||_0x18f151===_0xfcb9('0x92'))){_0x57c390[_0xfcb9('0x88')](new Extension(_0x3490f6,_0x53516d,'FAXOPT('+_0x18f151+')='+_0x3490f6[_0x18f151],_0xfcb9('0x8a')));_0x53516d+=0x1;}}_0x57c390[_0xfcb9('0x88')](new Extension(_0x3490f6,_0x53516d,'6',_0xfcb9('0x93')));_0x53516d+=0x1;_0x57c390[_0xfcb9('0x88')](new Extension(_0x3490f6,_0x53516d,_0xfcb9('0x94'),_0xfcb9('0x95')));_0x53516d=0x0;return _0x57c390;}exports[_0xfcb9('0x96')]=function(_0x46402a,_0x513051,_0x44dec1){var _0x10b5a5;return db['sequelize'][_0xfcb9('0x97')](function(_0x288677){return db[_0xfcb9('0x3f')][_0xfcb9('0x5b')](_0x46402a[_0xfcb9('0x5c')],{'transaction':_0x288677})['then'](function(_0x2df3d3){_0x10b5a5=_0x2df3d3[_0xfcb9('0x39')]({'plain':!![]});return db[_0xfcb9('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x10b5a5),{'transaction':_0x288677});});})['then'](function(){return _0x10b5a5;})['then'](respondWithResult(_0x513051,null))['catch'](handleError(_0x513051,null));};exports[_0xfcb9('0x99')]=function(_0x263b5d,_0x4d23ae,_0x3d6c71){var _0x5607f1;return db[_0xfcb9('0x77')][_0xfcb9('0x97')](function(_0x424743){return db[_0xfcb9('0x3f')][_0xfcb9('0x38')](_0x263b5d[_0xfcb9('0x5c')],{'where':{'id':_0x263b5d['body']['id']},'transaction':_0x424743})['then'](function(_0x550ca9){return db[_0xfcb9('0x98')][_0xfcb9('0x64')]({'where':{'FaxAccountId':_0x263b5d['body']['id']},'transaction':_0x424743})['then'](function(_0x528096){return db['VoiceExtension'][_0xfcb9('0x9a')](createExtensionsReciveFax(_[_0xfcb9('0x9b')](_0x263b5d[_0xfcb9('0x5c')],[_0xfcb9('0x9c'),_0xfcb9('0x9d'),_0xfcb9('0x9e'),_0xfcb9('0x9f'),_0xfcb9('0xa0'),_0xfcb9('0xa1')])),{'transaction':_0x424743});});});})[_0xfcb9('0x23')](function(){return db[_0xfcb9('0x3f')][_0xfcb9('0xa2')](_0x263b5d['body']['id']);})[_0xfcb9('0x23')](respondWithResult(_0x4d23ae,null))['catch'](handleError(_0x4d23ae,null));};exports[_0xfcb9('0xa3')]=function(_0x468c0e,_0x537afd,_0x3470f0){var _0x206861={'raw':!![],'where':{}};var _0xe3c575={};var _0x4a4d88={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfcb9('0x68')]({'where':{'id':_0x468c0e[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x537afd,null))['then'](function(_0x40ed1a){if(_0x40ed1a){_0xe3c575['model']=_['keys'](db[_0xfcb9('0xa4')][_0xfcb9('0x40')]);_0xe3c575[_0xfcb9('0x44')]=_[_0xfcb9('0x59')](_0x468c0e['query']);_0xe3c575[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0xe3c575[_0xfcb9('0x43')],_0xe3c575[_0xfcb9('0x44')]);_0x206861[_0xfcb9('0x48')]=_[_0xfcb9('0x46')](_0xe3c575[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x206861[_0xfcb9('0x48')]=_0x206861['attributes'][_0xfcb9('0x5a')]?_0x206861[_0xfcb9('0x48')]:_0xe3c575[_0xfcb9('0x43')];if(!_0x468c0e['query'][_0xfcb9('0x49')](_0xfcb9('0x4a'))){_0x206861['limit']=qs[_0xfcb9('0x32')](_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0x32')]);_0x206861['offset']=qs[_0xfcb9('0x31')](_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0x31')]);}_0x206861[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0x4c')]);_0x206861[_0xfcb9('0x4d')]=qs[_0xfcb9('0x45')](_[_0xfcb9('0x4e')](_0x468c0e[_0xfcb9('0x44')],_0xe3c575['filters']));_0x206861[_0xfcb9('0x4d')][_0xfcb9('0x66')]=_0x40ed1a['id'];if(_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0x4f')]){_0x206861[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x206861[_0xfcb9('0x4d')],{'$or':_[_0xfcb9('0x3e')](_0x206861[_0xfcb9('0x48')],function(_0x253b14){var _0xd83f6d={};_0xd83f6d[_0x253b14]={'$like':'%'+_0x468c0e['query'][_0xfcb9('0x4f')]+'%'};return _0xd83f6d;})});}if(_0x468c0e['query'][_0xfcb9('0xa5')]){var _0x563f91=_0x468c0e[_0xfcb9('0x44')][_0xfcb9('0xa5')]['split'](',');var _0x102606={};_0x102606[_0x563f91[0x0]]={'$gte':moment(_0x563f91[0x1])[_0xfcb9('0xa6')](_0xfcb9('0xa7'))};_0x206861[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x206861[_0xfcb9('0x4d')],_0x102606);}_0x206861=_['merge']({},_0x206861,_0x468c0e[_0xfcb9('0x51')]);return db[_0xfcb9('0xa4')][_0xfcb9('0x34')]({'where':_0x206861[_0xfcb9('0x4d')]})[_0xfcb9('0x23')](function(_0x3911c5){_0x4a4d88[_0xfcb9('0x34')]=_0x3911c5;if(_0x468c0e[_0xfcb9('0x44')]['includeAll']){_0x206861[_0xfcb9('0x53')]=[{'all':!![]}];}return db[_0xfcb9('0xa4')][_0xfcb9('0x54')](_0x206861);})[_0xfcb9('0x23')](function(_0x37e70f){_0x4a4d88[_0xfcb9('0x55')]=_0x37e70f;return _0x4a4d88;});}})[_0xfcb9('0x23')](respondWithFilteredResult(_0x537afd,_0x206861))[_0xfcb9('0x2d')](handleError(_0x537afd,null));};exports['send']=function(_0x5343ef,_0x21eb2d,_0x333013){var _0x43fa0b,_0x5986fa={},_0x135cd8;if(_0x5343ef[_0xfcb9('0x5c')]['to']){_0x135cd8=_0x5343ef[_0xfcb9('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xfcb9('0x5f')]({'where':{'id':_0x5343ef['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xfcb9('0x71')],'as':_0xfcb9('0xa8'),'where':{'fax':_0x135cd8},'limit':0x1,'order':[['updatedAt',_0xfcb9('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x21eb2d,null))[_0xfcb9('0x23')](function(_0x4768cd){_0x43fa0b=_0x4768cd;if(_0x5343ef[_0xfcb9('0x5c')]['attachments']&&_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][_0xfcb9('0x5a')]){for(var _0x365b3=0x0;_0x365b3<_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][_0xfcb9('0x5a')];_0x365b3+=0x1){_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][_0x365b3]={'filename':_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][_0x365b3][_0xfcb9('0x3c')],'id':_0x5343ef[_0xfcb9('0x5c')]['attachments'][_0x365b3]['id'],'path':path[_0xfcb9('0xab')](config[_0xfcb9('0xac')],_0xfcb9('0xad'),_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][_0x365b3][_0xfcb9('0xae')])};}}return respondWithRpcPromise(_0xfcb9('0xaf'),_0xfcb9('0xaf'),{'FaxAccountId':_[_0xfcb9('0xb0')](_0x5343ef[_0xfcb9('0x63')]['id'])?undefined:_0x5343ef[_0xfcb9('0x63')]['id'],'path':_[_0xfcb9('0xb0')](_0x5343ef['body'][_0xfcb9('0xaa')][0x0][_0xfcb9('0xb1')])?undefined:_0x5343ef['body'][_0xfcb9('0xaa')][0x0][_0xfcb9('0xb1')],'fax':_[_0xfcb9('0xb0')](_0x5343ef['body']['to'][0x0])?undefined:_0x5343ef['body']['to'][0x0]},client9002);})[_0xfcb9('0x23')](function(){if(_0x43fa0b){if(_[_0xfcb9('0xb0')](_0x5343ef['body']['from'])){_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xb2')]=util[_0xfcb9('0xa6')](_0xfcb9('0xb3'),_0x43fa0b['name'],_0x43fa0b[_0xfcb9('0xb4')]);}if(_0x43fa0b[_0xfcb9('0xb5')]){if(_0x43fa0b[_0xfcb9('0xb5')]['Contacts'][_0xfcb9('0x5a')]){return _0x43fa0b[_0xfcb9('0xb5')]['Contacts'][0x0];}else{return db[_0xfcb9('0x71')]['create'](_[_0xfcb9('0x1b')](_0x5343ef[_0xfcb9('0x5c')],{'firstName':_0x5343ef[_0xfcb9('0x5c')]['to'][0x0],'phone':_0x5343ef[_0xfcb9('0x5c')]['to'][0x0],'fax':_0x5343ef[_0xfcb9('0x5c')]['to'][0x0],'ListId':_0x43fa0b[_0xfcb9('0xa1')]}));}}else{throw new Error(_0xfcb9('0xb6'));}}else{throw new Error(_0xfcb9('0xb7'));}})['then'](function(_0x51c262){if(_0x51c262){return db[_0xfcb9('0x6f')][_0xfcb9('0x5f')]({'where':{'ContactId':_0x51c262['id'],'closed':![],'FaxAccountId':_0x43fa0b['id']}})[_0xfcb9('0x23')](function(_0xfbdde8){if(_0xfbdde8){return[_0xfbdde8,![]];}return db[_0xfcb9('0x6f')][_0xfcb9('0x5b')]({'UserId':_0x5343ef[_0xfcb9('0x5d')]['id'],'ContactId':_0x51c262['id'],'FaxAccountId':_0x43fa0b['id'],'fax':_0x5343ef[_0xfcb9('0x5c')]['to'][0x0],'firstMsgDirection':_0xfcb9('0xb8'),'Messages':[_[_0xfcb9('0x50')](_0x5343ef[_0xfcb9('0x5c')],{'read':![],'body':_0x5343ef['body'][_0xfcb9('0xaa')][0x0][_0xfcb9('0xb9')],'FaxAccountId':_0x43fa0b['id'],'UserId':_0x5343ef[_0xfcb9('0x5d')]['id'],'ContactId':_0x51c262['id'],'AttachmentId':_0x5343ef[_0xfcb9('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xfcb9('0xa4')],'as':_0xfcb9('0xba')}]})[_0xfcb9('0x23')](function(_0x49d1e8){return[_0x49d1e8,!![]];});});}else{throw new Error(_0xfcb9('0xbb'));}})[_0xfcb9('0xbc')](function(_0x19bbdc,_0x2f9e04){if(_0x2f9e04){return _0x19bbdc;}return db[_0xfcb9('0xa4')]['create']({'direction':_0xfcb9('0xb8'),'read':![],'body':_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][0x0][_0xfcb9('0xb9')],'FaxAccountId':_0x43fa0b['id'],'FaxInteractionId':_0x19bbdc['id'],'UserId':_0x5343ef[_0xfcb9('0x5d')]['id'],'ContactId':_0x19bbdc[_0xfcb9('0xbd')],'AttachmentId':_0x5343ef['body']['attachments'][0x0]['id']})[_0xfcb9('0x23')](function(_0x1f5373){_0x19bbdc['dataValues']['Messages']=[];_0x19bbdc['dataValues'][_0xfcb9('0xba')][_0xfcb9('0x88')](_0x1f5373[_0xfcb9('0xbe')]);return _0x19bbdc;});})[_0xfcb9('0x23')](function(_0x1f821d){respondWithRpcPromise(_0xfcb9('0xbf'),'SendFax',{'FaxAccountId':_[_0xfcb9('0xb0')](_0x5343ef[_0xfcb9('0x63')]['id'])?undefined:_0x5343ef[_0xfcb9('0x63')]['id'],'path':_['isNil'](_0x5343ef['body']['attachments'][0x0][_0xfcb9('0xb1')])?undefined:_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][0x0][_0xfcb9('0xb1')],'fax':_['isNil'](_0x5343ef[_0xfcb9('0x5c')]['to'][0x0])?undefined:_0x5343ef[_0xfcb9('0x5c')]['to'][0x0],'AttachmentId':_0x5343ef[_0xfcb9('0x5c')][_0xfcb9('0xaa')][0x0]['id']},client9002)['then'](function(_0x432fa1){logger[_0xfcb9('0x2b')](_0xfcb9('0xc0'),_0x432fa1);})[_0xfcb9('0x2d')](function(_0x40517f){logger[_0xfcb9('0x2b')]('SendFaxRpc,\x20%s',_0x40517f);});return _0x1f821d;})[_0xfcb9('0x23')](respondWithResult(_0x21eb2d,null))['catch'](handleError(_0x21eb2d,null));};exports[_0xfcb9('0xc1')]=function(_0x2ce34d,_0x1aa1ce,_0x52df71){return db[_0xfcb9('0x3f')][_0xfcb9('0x5f')]({'where':{'id':_0x2ce34d['params']['id']}})['then'](handleEntityNotFound(_0x1aa1ce,null))[_0xfcb9('0x23')](function(_0x576ffb){if(_0x576ffb){return _0x576ffb['addAgents'](_0x2ce34d[_0xfcb9('0x5c')][_0xfcb9('0x6b')],_[_0xfcb9('0x9b')](_0x2ce34d[_0xfcb9('0x5c')],[_0xfcb9('0x6b'),'id'])||{})[_0xfcb9('0xbc')](function(_0x498157){for(var _0x4d6085=0x0;_0x4d6085<_0x2ce34d[_0xfcb9('0x5c')][_0xfcb9('0x6b')][_0xfcb9('0x5a')];_0x4d6085+=0x1){socket['emit'](_0xfcb9('0xc2'),{'UserId':Number(_0x2ce34d[_0xfcb9('0x5c')]['ids'][_0x4d6085]),'FaxAccountId':Number(_0x2ce34d[_0xfcb9('0x63')]['id'])});}return _0x498157;});}})['then'](respondWithResult(_0x1aa1ce,null))[_0xfcb9('0x2d')](handleError(_0x1aa1ce,null));};exports[_0xfcb9('0xc3')]=function(_0x416746,_0x18b99f,_0x22fb91){return db[_0xfcb9('0x3f')]['find']({'where':{'id':_0x416746[_0xfcb9('0x63')]['id']}})[_0xfcb9('0x23')](handleEntityNotFound(_0x18b99f,null))[_0xfcb9('0x23')](function(_0x4d3519){if(_0x4d3519){return _0x4d3519[_0xfcb9('0xc3')](_0x416746[_0xfcb9('0x44')][_0xfcb9('0x6b')])[_0xfcb9('0x23')](function(){if(_[_0xfcb9('0xc4')](_0x416746['query'][_0xfcb9('0x6b')])){for(var _0x35930f=0x0;_0x35930f<_0x416746[_0xfcb9('0x44')][_0xfcb9('0x6b')][_0xfcb9('0x5a')];_0x35930f+=0x1){socket['emit'](_0xfcb9('0xc5'),{'UserId':Number(_0x416746[_0xfcb9('0x44')][_0xfcb9('0x6b')][_0x35930f]),'FaxAccountId':Number(_0x416746['params']['id'])});}}else{socket[_0xfcb9('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x416746['query'][_0xfcb9('0x6b')]),'FaxAccountId':Number(_0x416746[_0xfcb9('0x63')]['id'])});}});}})[_0xfcb9('0x23')](respondWithStatusCode(_0x18b99f,null))[_0xfcb9('0x2d')](handleError(_0x18b99f,null));};exports['getAgents']=function(_0x45ec42,_0x361869,_0x181e4f){var _0x48d52b={};var _0x44bd65={};var _0x1d1779;var _0x593ba8;return db[_0xfcb9('0x3f')][_0xfcb9('0x68')]({'where':{'id':_0x45ec42[_0xfcb9('0x63')]['id']}})['then'](handleEntityNotFound(_0x361869,null))[_0xfcb9('0x23')](function(_0x308902){if(_0x308902){_0x1d1779=_0x308902;_0x44bd65['model']=_['keys'](db[_0xfcb9('0xc7')][_0xfcb9('0x40')]);_0x44bd65[_0xfcb9('0x44')]=_['keys'](_0x45ec42[_0xfcb9('0x44')]);_0x44bd65[_0xfcb9('0x45')]=_[_0xfcb9('0x46')](_0x44bd65['model'],_0x44bd65[_0xfcb9('0x44')]);_0x48d52b[_0xfcb9('0x48')]=_[_0xfcb9('0x46')](_0x44bd65[_0xfcb9('0x43')],qs[_0xfcb9('0x47')](_0x45ec42[_0xfcb9('0x44')][_0xfcb9('0x47')]));_0x48d52b[_0xfcb9('0x48')]=_0x48d52b[_0xfcb9('0x48')]['length']?_0x48d52b[_0xfcb9('0x48')]:_0x44bd65[_0xfcb9('0x43')];_0x48d52b[_0xfcb9('0x4b')]=qs[_0xfcb9('0x4c')](_0x45ec42[_0xfcb9('0x44')]['sort']);_0x48d52b[_0xfcb9('0x4d')]=qs['filters'](_[_0xfcb9('0x4e')](_0x45ec42['query'],_0x44bd65[_0xfcb9('0x45')]));if(_0x45ec42[_0xfcb9('0x44')][_0xfcb9('0x4f')]){_0x48d52b[_0xfcb9('0x4d')]=_[_0xfcb9('0x50')](_0x48d52b[_0xfcb9('0x4d')],{'$or':_[_0xfcb9('0x3e')](_0x48d52b[_0xfcb9('0x48')],function(_0x29d864){var _0x3304d9={};_0x3304d9[_0x29d864]={'$like':'%'+_0x45ec42[_0xfcb9('0x44')]['filter']+'%'};return _0x3304d9;})});}_0x48d52b=_['merge']({},_0x48d52b,_0x45ec42[_0xfcb9('0x51')]);return _0x1d1779[_0xfcb9('0xc8')](_0x48d52b);}})[_0xfcb9('0x23')](function(_0x3adbbf){if(_0x3adbbf){_0x593ba8=_0x3adbbf[_0xfcb9('0x5a')];if(!_0x45ec42[_0xfcb9('0x44')][_0xfcb9('0x49')](_0xfcb9('0x4a'))){_0x48d52b[_0xfcb9('0x32')]=qs['limit'](_0x45ec42[_0xfcb9('0x44')]['limit']);_0x48d52b['offset']=qs[_0xfcb9('0x31')](_0x45ec42['query'][_0xfcb9('0x31')]);}return _0x1d1779[_0xfcb9('0xc8')](_0x48d52b);}})[_0xfcb9('0x23')](function(_0x18f78d){if(_0x18f78d){return _0x18f78d?{'count':_0x593ba8,'rows':_0x18f78d}:null;}})[_0xfcb9('0x23')](respondWithResult(_0x361869,null))[_0xfcb9('0x2d')](handleError(_0x361869,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1cf661c..4c7a973 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 _0x4bc7=['hook','exports','FaxAccount','setMaxListeners','remove','emit'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0x4bc7,0x188));var _0x74bc=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0x4bc7[_0x3ba537];return _0x585c1a;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x74bc('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x74bc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x74bc('0x2')};function emitEvent(_0x5b08d0){return function(_0x249871,_0x3089fb,_0x2eee2f){FaxAccountEvents['emit'](_0x5b08d0+':'+_0x249871['id'],_0x249871);FaxAccountEvents[_0x74bc('0x3')](_0x5b08d0,_0x249871);_0x2eee2f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x74bc('0x4')](e,emitEvent(event));}}module[_0x74bc('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x6257=['FaxAccount','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x40e13e,_0x376d13){var _0x5db39e=function(_0x2dc3f6){while(--_0x2dc3f6){_0x40e13e['push'](_0x40e13e['shift']());}};_0x5db39e(++_0x376d13);}(_0x6257,0x1d4));var _0x7625=function(_0x11e358,_0x521350){_0x11e358=_0x11e358-0x0;var _0x3cab8a=_0x6257[_0x11e358];return _0x3cab8a;};'use strict';var EventEmitter=require(_0x7625('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x7625('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7625('0x2'),'afterDestroy':_0x7625('0x3')};function emitEvent(_0x203b40){return function(_0x2eefab,_0x182db5,_0x2a28bb){FaxAccountEvents[_0x7625('0x4')](_0x203b40+':'+_0x2eefab['id'],_0x2eefab);FaxAccountEvents[_0x7625('0x4')](_0x203b40,_0x2eefab);_0x2a28bb(null);};}for(var e in events){if(events[_0x7625('0x5')](e)){var event=events[e];FaxAccount[_0x7625('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e43aeac..3c93f14 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 _0xa67b=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports'];(function(_0x9f42c5,_0xbf9b7d){var _0x586fa8=function(_0x232150){while(--_0x232150){_0x9f42c5['push'](_0x9f42c5['shift']());}};_0x586fa8(++_0xbf9b7d);}(_0xa67b,0x1f2));var _0xba67=function(_0x45fd6d,_0x571072){_0x45fd6d=_0x45fd6d-0x0;var _0x5d27bd=_0xa67b[_0x45fd6d];return _0x5d27bd;};'use strict';var _=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var logger=require(_0xba67('0x2'))('api');var moment=require(_0xba67('0x3'));var BPromise=require(_0xba67('0x4'));var rp=require(_0xba67('0x5'));var fs=require('fs');var path=require(_0xba67('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xba67('0x7')]=function(_0x528601,_0x13da7b){return _0x528601[_0xba67('0x8')](_0xba67('0x9'),attributes,{'tableName':_0xba67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3daf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','fax_accounts','util'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3daf,0xc7));var _0xf3da=function(_0x3c9bde,_0x15e7e){_0x3c9bde=_0x3c9bde-0x0;var _0x3dd7af=_0x3daf[_0x3c9bde];return _0x3dd7af;};'use strict';var _=require('lodash');var util=require(_0xf3da('0x0'));var logger=require(_0xf3da('0x1'))(_0xf3da('0x2'));var moment=require(_0xf3da('0x3'));var BPromise=require(_0xf3da('0x4'));var rp=require(_0xf3da('0x5'));var fs=require('fs');var path=require(_0xf3da('0x6'));var rimraf=require(_0xf3da('0x7'));var config=require(_0xf3da('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x57a42b,_0x17ed6b){return _0x57a42b['define']('FaxAccount',attributes,{'tableName':_0xf3da('0x9'),'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 aa13b00..3f48f98 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 _0xf289=['name','waitForTheAssignedAgent','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','get','applications','Applications','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','find','unshift'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0xf289,0x1c4));var _0x9f28=function(_0x18c472,_0x12335f){_0x18c472=_0x18c472-0x0;var _0x178de4=_0xf289[_0x18c472];return _0x178de4;};'use strict';var _=require('lodash');var util=require(_0x9f28('0x0'));var moment=require('moment');var BPromise=require(_0x9f28('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f28('0x2'))['db'];var utils=require(_0x9f28('0x3'));var logger=require(_0x9f28('0x4'))(_0x9f28('0x5'));var config=require(_0x9f28('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9f28('0x7')][_0x9f28('0x8')]({'port':0x232c});config[_0x9f28('0x9')]=_['defaults'](config[_0x9f28('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f28('0xa'))(new Redis(config['redis']));require(_0x9f28('0xb'))[_0x9f28('0xc')](socket);function respondWithRpcPromise(_0x54177b,_0x6e107d,_0x3d2249){return new BPromise(function(_0x45dae8,_0x1d2d7b){return client[_0x9f28('0xd')](_0x54177b,_0x3d2249)[_0x9f28('0xe')](function(_0x232c15){logger[_0x9f28('0xf')](_0x9f28('0x10'),_0x6e107d,_0x9f28('0x11'));logger[_0x9f28('0x12')](_0x9f28('0x13'),_0x6e107d,_0x9f28('0x11'),JSON['stringify'](_0x232c15));if(_0x232c15[_0x9f28('0x14')]){if(_0x232c15[_0x9f28('0x14')][_0x9f28('0x15')]===0x1f4){logger[_0x9f28('0x14')](_0x9f28('0x10'),_0x6e107d,_0x232c15[_0x9f28('0x14')][_0x9f28('0x16')]);return _0x1d2d7b(_0x232c15['error'][_0x9f28('0x16')]);}logger[_0x9f28('0x14')](_0x9f28('0x10'),_0x6e107d,_0x232c15[_0x9f28('0x14')][_0x9f28('0x16')]);return _0x45dae8(_0x232c15[_0x9f28('0x14')][_0x9f28('0x16')]);}else{logger[_0x9f28('0xf')](_0x9f28('0x10'),_0x6e107d,_0x9f28('0x11'));_0x45dae8(_0x232c15[_0x9f28('0x17')][_0x9f28('0x16')]);}})[_0x9f28('0x18')](function(_0x47b7d7){logger[_0x9f28('0x14')]('FaxAccount,\x20%s,\x20%s',_0x6e107d,_0x47b7d7);_0x1d2d7b(_0x47b7d7);});});}exports['GetFaxAccount']=function(_0x538132){var _0x32637f=this;return new Promise(function(_0x574032,_0x5783bc){return db[_0x9f28('0x19')][_0x9f28('0x1a')]({'raw':_0x538132[_0x9f28('0x1b')]?_0x538132['options'][_0x9f28('0x1c')]===undefined?!![]:![]:!![],'where':_0x538132['options']?_0x538132['options'][_0x9f28('0x1d')]||null:null,'attributes':_0x538132[_0x9f28('0x1b')]?_0x538132[_0x9f28('0x1b')][_0x9f28('0x1e')]||null:null,'limit':_0x538132[_0x9f28('0x1b')]?_0x538132['options'][_0x9f28('0x1f')]||null:null,'include':_0x538132['options']?_0x538132[_0x9f28('0x1b')][_0x9f28('0x20')]?_['map'](_0x538132[_0x9f28('0x1b')][_0x9f28('0x20')],function(_0x470c08){return{'model':db[_0x470c08[_0x9f28('0x21')]],'as':_0x470c08['as'],'attributes':_0x470c08[_0x9f28('0x1e')],'include':_0x470c08['include']?_['map'](_0x470c08[_0x9f28('0x20')],function(_0x4b962c){return{'model':db[_0x4b962c[_0x9f28('0x21')]],'as':_0x4b962c['as'],'attributes':_0x4b962c[_0x9f28('0x1e')],'include':_0x4b962c[_0x9f28('0x20')]?_['map'](_0x4b962c['include'],function(_0x2354d2){return{'model':db[_0x2354d2[_0x9f28('0x21')]],'as':_0x2354d2['as'],'attributes':_0x2354d2[_0x9f28('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9f28('0xe')](function(_0x132b18){logger[_0x9f28('0xf')](_0x9f28('0x22'),_0x538132);logger[_0x9f28('0x12')]('GetFaxAccount',_0x538132,JSON['stringify'](_0x132b18));_0x574032(_0x132b18);})[_0x9f28('0x18')](function(_0x371c65){logger[_0x9f28('0x14')](_0x9f28('0x22'),_0x371c65[_0x9f28('0x16')],_0x538132);_0x5783bc(_0x32637f[_0x9f28('0x14')](0x1f4,_0x371c65[_0x9f28('0x16')]));});});};exports[_0x9f28('0x23')]=function(_0x412171,_0x19adc3,_0x297e19){var _0x191d29=this;return new Promise(function(_0x3e71f7,_0x435128){var _0x7f66df={'body':_0x412171[_0x9f28('0x24')],'channel':_0x9f28('0x25')};var _0x143785=[];var _0xa46551=[];var _0x23060f={};return db[_0x9f28('0x26')]['describe']()[_0x9f28('0xe')](function(_0x29aa72){if(!_0x29aa72){throw new db[(_0x9f28('0x27'))][(_0x9f28('0x28'))](_0x9f28('0x29'));}_0x143785=_[_0x9f28('0x2a')](_[_0x9f28('0x2b')](_0x29aa72),['createdAt','updatedAt']);_0xa46551=_[_0x9f28('0x2a')](_[_0x9f28('0x2b')](_0x29aa72),['createdAt',_0x9f28('0x2c'),_0x9f28('0x2d'),_0x9f28('0x2e')]);if(_0x412171[_0x9f28('0x24')]['id']){delete _0x412171['body']['id'];}if(_[_0x9f28('0x2f')](_0x412171['body'][_0x9f28('0x30')])){throw new db[(_0x9f28('0x27'))][(_0x9f28('0x28'))](_0x9f28('0x31'));}if(_[_0x9f28('0x2f')](_0x412171[_0x9f28('0x24')]['body'])||_0x412171['body'][_0x9f28('0x24')]===''){throw new db[(_0x9f28('0x27'))][(_0x9f28('0x28'))](_0x9f28('0x32'));}if(_['isNil'](_0x412171['body'][_0x9f28('0x33')])){throw new db[(_0x9f28('0x27'))][(_0x9f28('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa46551);}if(!_[_0x9f28('0x34')](_0xa46551,_0x412171[_0x9f28('0x24')][_0x9f28('0x33')])){throw new db[(_0x9f28('0x27'))][(_0x9f28('0x28'))](_0x9f28('0x35')+_0xa46551);}_0x23060f[_0x412171[_0x9f28('0x24')][_0x9f28('0x33')]]=_0x412171[_0x9f28('0x24')][_0x9f28('0x30')];})['then'](function(){return db[_0x9f28('0x19')]['find']({'where':{'id':_0x412171[_0x9f28('0x36')]['id']},'include':[{'model':db[_0x9f28('0x37')],'as':_0x9f28('0x38'),'include':[{'model':db['CmContact'],'as':_0x9f28('0x39'),'where':_0x23060f,'limit':0x1,'order':[[_0x9f28('0x2c'),_0x9f28('0x3a')]]}]},{'model':db[_0x9f28('0x3b')],'as':'Applications'}]});})['then'](function(_0x2a28f4){if(_0x2a28f4&&_0x2a28f4['List']){var _0x240020=_0x2a28f4[_0x9f28('0x3c')]({'plain':!![]});_0x7f66df[_0x9f28('0x36')]=_0x240020;_0x7f66df[_0x9f28('0x3d')]=_0x240020[_0x9f28('0x3e')];_0x7f66df['list']=_0x240020['List'];_0x7f66df[_0x9f28('0x3d')]=_['orderBy'](_0x7f66df[_0x9f28('0x3d')],[_0x9f28('0x3f')],['asc']);if(_0x7f66df[_0x9f28('0x36')][_0x9f28('0x3e')]){delete _0x7f66df[_0x9f28('0x36')]['Applications'];}if(_0x7f66df[_0x9f28('0x36')][_0x9f28('0x38')]&&_0x7f66df[_0x9f28('0x36')][_0x9f28('0x38')][_0x9f28('0x39')][_0x9f28('0x40')]){return _0x7f66df[_0x9f28('0x36')][_0x9f28('0x38')]['Contacts'][0x0];}var _0x4177ba=_['defaults'](_0x412171['body'],{'firstName':_0x412171[_0x9f28('0x24')]['from'],'ListId':_0x240020[_0x9f28('0x2e')]});_0x4177ba[_0x412171[_0x9f28('0x24')][_0x9f28('0x33')]]=_0x412171[_0x9f28('0x24')][_0x9f28('0x30')];return db[_0x9f28('0x26')][_0x9f28('0x41')](_0x4177ba,{'fields':_0x143785,'raw':!![]});}})[_0x9f28('0xe')](function(_0x32ae5f){_0x7f66df[_0x9f28('0x42')]=_0x32ae5f;if(_0x32ae5f){var _0x399448={'ContactId':_0x32ae5f['id'],'FaxAccountId':_0x412171[_0x9f28('0x36')]['id'],'fax':_0x32ae5f[_0x9f28('0x25')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x32ae5f['id'],'closed':![],'FaxAccountId':_0x412171[_0x9f28('0x36')]['id']}})[_0x9f28('0xe')](function(_0x3619db){if(_0x3619db){return[_0x3619db,![]];}return db[_0x9f28('0x43')][_0x9f28('0x41')](_0x399448)['then'](function(_0x2aa69e){return[_0x2aa69e,!![]];});});}else{throw new Error(_0x9f28('0x44'));}})['spread'](function(_0x1d6fe3,_0x356e49){var _0x396a9c=_0x1d6fe3[_0x9f28('0x3c')]({'plain':!![]});if(_0x356e49){if(_0x7f66df[_0x9f28('0x36')][_0x9f28('0x45')]){_0x7f66df[_0x9f28('0x3d')]['push']({'id':0x0,'priority':_0x7f66df[_0x9f28('0x3d')]['length']+0x1,'app':_0x9f28('0x46'),'appdata':_0x9f28('0x47'),'interval':_0x9f28('0x48')});}_0x396a9c[_0x9f28('0x49')]=!![];}else{_0x396a9c[_0x9f28('0x49')]=![];}_0x7f66df[_0x9f28('0x4a')]=_0x396a9c;return db[_0x9f28('0x4b')][_0x9f28('0x41')]({'body':_0x412171[_0x9f28('0x24')][_0x9f28('0x24')],'FaxAccountId':_0x412171[_0x9f28('0x36')]['id'],'FaxInteractionId':_0x1d6fe3['id'],'direction':'in','ContactId':_0x1d6fe3[_0x9f28('0x4c')],'AttachmentId':_0x412171[_0x9f28('0x24')][_0x9f28('0x4d')]});})[_0x9f28('0xe')](function(_0x514450){_0x7f66df[_0x9f28('0x16')]=_0x514450;if(!_0x7f66df[_0x9f28('0x4a')][_0x9f28('0x4e')])return;return db[_0x9f28('0x4f')][_0x9f28('0x50')]({'attributes':['id','name'],'where':{'id':_0x7f66df[_0x9f28('0x4a')][_0x9f28('0x4e')]}});})['then'](function(_0x548ea8){if(_0x548ea8){_0x7f66df[_0x9f28('0x3d')][_0x9f28('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x548ea8[_0x9f28('0x52')]+','+(_0x7f66df['account'][_0x9f28('0x53')]||0xa),'interval':_0x9f28('0x48')});}if(!_0x7f66df[_0x9f28('0x4a')]['queueId'])return;return db[_0x9f28('0x54')][_0x9f28('0x50')]({'attributes':['id',_0x9f28('0x52')],'where':{'id':_0x7f66df[_0x9f28('0x4a')]['queueId']}});})[_0x9f28('0xe')](function(_0x36ec0f){if(_0x36ec0f){_0x7f66df[_0x9f28('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x9f28('0x55'),'appdata':_0x36ec0f[_0x9f28('0x52')]+','+(_0x7f66df[_0x9f28('0x36')][_0x9f28('0x56')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9f28('0x57'),_0x9f28('0x58'),_0x7f66df);})[_0x9f28('0xe')](function(_0x399e83){_0x3e71f7(_0x399e83);})[_0x9f28('0x18')](function(_0x312b88){_0x435128(_0x191d29[_0x9f28('0x14')](0x1f4,_0x312b88[_0x9f28('0x16')]));});});}; \ No newline at end of file +var _0x1abb=['Applications','length','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','FaxQueue','queue','Start','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','options','raw','where','attributes','limit','map','model','include','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','find','account','CmList','List','CmContact','Contacts','FaxApplication','get','list','applications','priority','asc'];(function(_0x1e5014,_0x4508ff){var _0x4daccb=function(_0x11fcf9){while(--_0x11fcf9){_0x1e5014['push'](_0x1e5014['shift']());}};_0x4daccb(++_0x4508ff);}(_0x1abb,0x177));var _0xb1ab=function(_0x526298,_0x2ec3ba){_0x526298=_0x526298-0x0;var _0x467835=_0x1abb[_0x526298];return _0x467835;};'use strict';var _=require('lodash');var util=require(_0xb1ab('0x0'));var moment=require(_0xb1ab('0x1'));var BPromise=require(_0xb1ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1ab('0x3'));var db=require(_0xb1ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1ab('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb1ab('0x6'));var client=jayson[_0xb1ab('0x7')][_0xb1ab('0x8')]({'port':0x232c});config[_0xb1ab('0x9')]=_[_0xb1ab('0xa')](config[_0xb1ab('0x9')],{'host':_0xb1ab('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1ab('0x9')]));require(_0xb1ab('0xc'))[_0xb1ab('0xd')](socket);function respondWithRpcPromise(_0x3f313c,_0x1b7104,_0x4806f1){return new BPromise(function(_0xc3f345,_0x4506f0){return client[_0xb1ab('0xe')](_0x3f313c,_0x4806f1)[_0xb1ab('0xf')](function(_0x3e4053){logger[_0xb1ab('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1b7104,_0xb1ab('0x11'));logger[_0xb1ab('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b7104,_0xb1ab('0x11'),JSON[_0xb1ab('0x13')](_0x3e4053));if(_0x3e4053[_0xb1ab('0x14')]){if(_0x3e4053[_0xb1ab('0x14')][_0xb1ab('0x15')]===0x1f4){logger[_0xb1ab('0x14')](_0xb1ab('0x16'),_0x1b7104,_0x3e4053[_0xb1ab('0x14')]['message']);return _0x4506f0(_0x3e4053['error'][_0xb1ab('0x17')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1b7104,_0x3e4053[_0xb1ab('0x14')][_0xb1ab('0x17')]);return _0xc3f345(_0x3e4053[_0xb1ab('0x14')]['message']);}else{logger[_0xb1ab('0x10')](_0xb1ab('0x16'),_0x1b7104,'request\x20sent');_0xc3f345(_0x3e4053[_0xb1ab('0x18')][_0xb1ab('0x17')]);}})[_0xb1ab('0x19')](function(_0x15d3aa){logger[_0xb1ab('0x14')](_0xb1ab('0x16'),_0x1b7104,_0x15d3aa);_0x4506f0(_0x15d3aa);});});}exports[_0xb1ab('0x1a')]=function(_0x281831){var _0x57461b=this;return new Promise(function(_0x78bbf9,_0xf63002){return db['FaxAccount']['findAll']({'raw':_0x281831[_0xb1ab('0x1b')]?_0x281831[_0xb1ab('0x1b')][_0xb1ab('0x1c')]===undefined?!![]:![]:!![],'where':_0x281831[_0xb1ab('0x1b')]?_0x281831['options'][_0xb1ab('0x1d')]||null:null,'attributes':_0x281831[_0xb1ab('0x1b')]?_0x281831[_0xb1ab('0x1b')][_0xb1ab('0x1e')]||null:null,'limit':_0x281831[_0xb1ab('0x1b')]?_0x281831[_0xb1ab('0x1b')][_0xb1ab('0x1f')]||null:null,'include':_0x281831[_0xb1ab('0x1b')]?_0x281831['options']['include']?_[_0xb1ab('0x20')](_0x281831[_0xb1ab('0x1b')]['include'],function(_0x556b97){return{'model':db[_0x556b97[_0xb1ab('0x21')]],'as':_0x556b97['as'],'attributes':_0x556b97[_0xb1ab('0x1e')],'include':_0x556b97[_0xb1ab('0x22')]?_['map'](_0x556b97[_0xb1ab('0x22')],function(_0x5afa8c){return{'model':db[_0x5afa8c[_0xb1ab('0x21')]],'as':_0x5afa8c['as'],'attributes':_0x5afa8c[_0xb1ab('0x1e')],'include':_0x5afa8c['include']?_['map'](_0x5afa8c[_0xb1ab('0x22')],function(_0x3b4820){return{'model':db[_0x3b4820[_0xb1ab('0x21')]],'as':_0x3b4820['as'],'attributes':_0x3b4820[_0xb1ab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb1ab('0xf')](function(_0x94395c){logger[_0xb1ab('0x10')](_0xb1ab('0x1a'),_0x281831);logger[_0xb1ab('0x12')](_0xb1ab('0x1a'),_0x281831,JSON[_0xb1ab('0x13')](_0x94395c));_0x78bbf9(_0x94395c);})[_0xb1ab('0x19')](function(_0x32e9eb){logger[_0xb1ab('0x14')]('GetFaxAccount',_0x32e9eb['message'],_0x281831);_0xf63002(_0x57461b[_0xb1ab('0x14')](0x1f4,_0x32e9eb[_0xb1ab('0x17')]));});});};exports[_0xb1ab('0x23')]=function(_0x86d531,_0x5b4411,_0x557f23){var _0x46584a=this;return new Promise(function(_0x284f6a,_0x21de53){var _0x422569={'body':_0x86d531[_0xb1ab('0x24')],'channel':_0xb1ab('0x25')};var _0x3bba76=[];var _0x54757d=[];var _0x3f3be9={};return db['CmContact'][_0xb1ab('0x26')]()[_0xb1ab('0xf')](function(_0x4b1544){if(!_0x4b1544){throw new db[(_0xb1ab('0x27'))][(_0xb1ab('0x28'))](_0xb1ab('0x29'));}_0x3bba76=_[_0xb1ab('0x2a')](_[_0xb1ab('0x2b')](_0x4b1544),[_0xb1ab('0x2c'),_0xb1ab('0x2d')]);_0x54757d=_[_0xb1ab('0x2a')](_['keys'](_0x4b1544),[_0xb1ab('0x2c'),_0xb1ab('0x2d'),_0xb1ab('0x2e'),_0xb1ab('0x2f')]);if(_0x86d531[_0xb1ab('0x24')]['id']){delete _0x86d531[_0xb1ab('0x24')]['id'];}if(_[_0xb1ab('0x30')](_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x31')])){throw new db['Sequelize'][(_0xb1ab('0x28'))](_0xb1ab('0x32'));}if(_[_0xb1ab('0x30')](_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x24')])||_0x86d531['body'][_0xb1ab('0x24')]===''){throw new db[(_0xb1ab('0x27'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb1ab('0x30')](_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x33')])){throw new db['Sequelize'][(_0xb1ab('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54757d);}if(!_[_0xb1ab('0x34')](_0x54757d,_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x33')])){throw new db[(_0xb1ab('0x27'))][(_0xb1ab('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54757d);}_0x3f3be9[_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x33')]]=_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x31')];})[_0xb1ab('0xf')](function(){return db['FaxAccount'][_0xb1ab('0x35')]({'where':{'id':_0x86d531[_0xb1ab('0x36')]['id']},'include':[{'model':db[_0xb1ab('0x37')],'as':_0xb1ab('0x38'),'include':[{'model':db[_0xb1ab('0x39')],'as':_0xb1ab('0x3a'),'where':_0x3f3be9,'limit':0x1,'order':[[_0xb1ab('0x2d'),'DESC']]}]},{'model':db[_0xb1ab('0x3b')],'as':'Applications'}]});})[_0xb1ab('0xf')](function(_0x34bbe3){if(_0x34bbe3&&_0x34bbe3[_0xb1ab('0x38')]){var _0x3ae052=_0x34bbe3[_0xb1ab('0x3c')]({'plain':!![]});_0x422569[_0xb1ab('0x36')]=_0x3ae052;_0x422569['applications']=_0x3ae052['Applications'];_0x422569[_0xb1ab('0x3d')]=_0x3ae052['List'];_0x422569[_0xb1ab('0x3e')]=_['orderBy'](_0x422569[_0xb1ab('0x3e')],[_0xb1ab('0x3f')],[_0xb1ab('0x40')]);if(_0x422569[_0xb1ab('0x36')][_0xb1ab('0x41')]){delete _0x422569[_0xb1ab('0x36')]['Applications'];}if(_0x422569[_0xb1ab('0x36')][_0xb1ab('0x38')]&&_0x422569[_0xb1ab('0x36')][_0xb1ab('0x38')][_0xb1ab('0x3a')][_0xb1ab('0x42')]){return _0x422569['account'][_0xb1ab('0x38')][_0xb1ab('0x3a')][0x0];}var _0x52d0eb=_['defaults'](_0x86d531[_0xb1ab('0x24')],{'firstName':_0x86d531[_0xb1ab('0x24')]['from'],'ListId':_0x3ae052[_0xb1ab('0x2f')]});_0x52d0eb[_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x33')]]=_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x31')];return db[_0xb1ab('0x39')]['create'](_0x52d0eb,{'fields':_0x3bba76,'raw':!![]});}})[_0xb1ab('0xf')](function(_0x29ad4c){_0x422569[_0xb1ab('0x43')]=_0x29ad4c;if(_0x29ad4c){var _0x141f28={'ContactId':_0x29ad4c['id'],'FaxAccountId':_0x86d531[_0xb1ab('0x36')]['id'],'fax':_0x29ad4c[_0xb1ab('0x25')]};return db[_0xb1ab('0x44')][_0xb1ab('0x35')]({'where':{'ContactId':_0x29ad4c['id'],'closed':![],'FaxAccountId':_0x86d531['account']['id']}})[_0xb1ab('0xf')](function(_0xb5a09a){if(_0xb5a09a){return[_0xb5a09a,![]];}return db['FaxInteraction'][_0xb1ab('0x45')](_0x141f28)[_0xb1ab('0xf')](function(_0x323fdc){return[_0x323fdc,!![]];});});}else{throw new Error(_0xb1ab('0x46'));}})[_0xb1ab('0x47')](function(_0x1bda60,_0x1134de){var _0x4627d5=_0x1bda60['get']({'plain':!![]});if(_0x1134de){if(_0x422569[_0xb1ab('0x36')][_0xb1ab('0x48')]){_0x422569[_0xb1ab('0x3e')]['push']({'id':0x0,'priority':_0x422569[_0xb1ab('0x3e')]['length']+0x1,'app':'close','appdata':_0xb1ab('0x49'),'interval':_0xb1ab('0x4a')});}_0x4627d5['created']=!![];}else{_0x4627d5[_0xb1ab('0x4b')]=![];}_0x422569[_0xb1ab('0x4c')]=_0x4627d5;return db[_0xb1ab('0x4d')][_0xb1ab('0x45')]({'body':_0x86d531['body'][_0xb1ab('0x24')],'FaxAccountId':_0x86d531[_0xb1ab('0x36')]['id'],'FaxInteractionId':_0x1bda60['id'],'direction':'in','ContactId':_0x1bda60[_0xb1ab('0x4e')],'AttachmentId':_0x86d531[_0xb1ab('0x24')][_0xb1ab('0x4f')]});})['then'](function(_0x203663){_0x422569[_0xb1ab('0x17')]=_0x203663;if(!_0x422569['interaction'][_0xb1ab('0x50')])return;return db[_0xb1ab('0x51')][_0xb1ab('0x35')]({'attributes':['id',_0xb1ab('0x52')],'where':{'id':_0x422569[_0xb1ab('0x4c')][_0xb1ab('0x50')]}});})[_0xb1ab('0xf')](function(_0x3b848d){if(_0x3b848d){_0x422569[_0xb1ab('0x3e')][_0xb1ab('0x53')]({'id':0x0,'priority':0x0,'app':_0xb1ab('0x54'),'appdata':_0x3b848d['name']+','+(_0x422569[_0xb1ab('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0xb1ab('0x4a')});}if(!_0x422569[_0xb1ab('0x4c')]['queueId'])return;return db[_0xb1ab('0x55')][_0xb1ab('0x35')]({'attributes':['id',_0xb1ab('0x52')],'where':{'id':_0x422569['interaction']['queueId']}});})[_0xb1ab('0xf')](function(_0x83cdb3){if(_0x83cdb3){_0x422569[_0xb1ab('0x3e')][_0xb1ab('0x53')]({'id':0x0,'priority':0x1,'app':_0xb1ab('0x56'),'appdata':_0x83cdb3[_0xb1ab('0x52')]+','+(_0x422569['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xb1ab('0x4a')});}return respondWithRpcPromise(_0xb1ab('0x57'),'startRouting',_0x422569);})[_0xb1ab('0xf')](function(_0x4e406f){_0x284f6a(_0x4e406f);})[_0xb1ab('0x19')](function(_0x37ff1b){_0x21de53(_0x46584a[_0xb1ab('0x14')](0x1f4,_0x37ff1b[_0xb1ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ee4d32d..9f29c4c 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 _0x2230=['./faxAccount.events','save','remove','update','emit','removeListener','register','faxAccount:'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x2230,0x1e8));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x0223('0x0'));var events=[_0x0223('0x1'),_0x0223('0x2'),_0x0223('0x3')];function createListener(_0x220a23,_0x359617){return function(_0x5929e2){_0x359617[_0x0223('0x4')](_0x220a23,_0x5929e2);};}function removeListener(_0x51b881,_0xaaa26c){return function(){FaxAccountEvents[_0x0223('0x5')](_0x51b881,_0xaaa26c);};}exports[_0x0223('0x6')]=function(_0x1a575c){for(var _0x269a9a=0x0,_0x5f9ccc=events['length'];_0x269a9a<_0x5f9ccc;_0x269a9a++){var _0x2d0b03=events[_0x269a9a];var _0x165ae1=createListener(_0x0223('0x7')+_0x2d0b03,_0x1a575c);FaxAccountEvents['on'](_0x2d0b03,_0x165ae1);}}; \ No newline at end of file +var _0xbc9b=['emit','removeListener','register','faxAccount:','./faxAccount.events','save','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbc9b,0x1d9));var _0xbbc9=function(_0x18fee1,_0x55d732){_0x18fee1=_0x18fee1-0x0;var _0x29d585=_0xbc9b[_0x18fee1];return _0x29d585;};'use strict';var FaxAccountEvents=require(_0xbbc9('0x0'));var events=[_0xbbc9('0x1'),_0xbbc9('0x2'),'update'];function createListener(_0x25e1f5,_0x34004f){return function(_0x506b8d){_0x34004f[_0xbbc9('0x3')](_0x25e1f5,_0x506b8d);};}function removeListener(_0x212849,_0x53ad92){return function(){FaxAccountEvents[_0xbbc9('0x4')](_0x212849,_0x53ad92);};}exports[_0xbbc9('0x5')]=function(_0x3e931f){for(var _0x12124b=0x0,_0x551964=events['length'];_0x12124b<_0x551964;_0x12124b++){var _0x1b60cb=events[_0x12124b];var _0x1c4fb2=createListener(_0xbbc9('0x6')+_0x1b60cb,_0x3e931f);FaxAccountEvents['on'](_0x1b60cb,_0x1c4fb2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e065fae..437bc0c 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 _0x1c6e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','addInteraction','/addaccountapplications','updateAccountApplications','/:id/send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x57436d,_0x352644){var _0x25a27c=function(_0x3e5c57){while(--_0x3e5c57){_0x57436d['push'](_0x57436d['shift']());}};_0x25a27c(++_0x352644);}(_0x1c6e,0x79));var _0xe1c6=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x1c6e[_0x4c7b20];return _0x4872bd;};'use strict';var multer=require(_0xe1c6('0x0'));var util=require(_0xe1c6('0x1'));var path=require(_0xe1c6('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1c6('0x3'));var router=express[_0xe1c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe1c6('0x5'));var interaction=require(_0xe1c6('0x6'));var config=require(_0xe1c6('0x7'));var controller=require('./faxAccount.controller');router[_0xe1c6('0x8')]('/',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0xa')]);router[_0xe1c6('0x8')](_0xe1c6('0xb'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0xc')]);router[_0xe1c6('0x8')](_0xe1c6('0xd'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0xe')]);router[_0xe1c6('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe1c6('0xf')]);router[_0xe1c6('0x8')]('/:id/canned_answers',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x10')]);router[_0xe1c6('0x8')](_0xe1c6('0x11'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x12')]);router[_0xe1c6('0x8')](_0xe1c6('0x13'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x14')]);router[_0xe1c6('0x8')](_0xe1c6('0x15'),auth['isAuthenticated'](),controller[_0xe1c6('0x16')]);router[_0xe1c6('0x8')](_0xe1c6('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe1c6('0x18')]('/',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x19')]);router['post'](_0xe1c6('0x1a'),auth[_0xe1c6('0x9')](),controller['addDisposition']);router['post'](_0xe1c6('0x1b'),auth['isAuthenticated'](),controller[_0xe1c6('0x1c')]);router[_0xe1c6('0x18')](_0xe1c6('0x11'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x1d')]);router[_0xe1c6('0x18')]('/:id/applications',auth[_0xe1c6('0x9')](),controller['addApplications']);router[_0xe1c6('0x18')](_0xe1c6('0x1e'),auth[_0xe1c6('0x9')](),controller['addAccountApplications']);router[_0xe1c6('0x18')]('/updateaccountapplications',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x1f')]);router[_0xe1c6('0x18')](_0xe1c6('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0xe1c6('0x17'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x21')]);router['put']('/:id',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x22')]);router[_0xe1c6('0x23')](_0xe1c6('0xd'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x24')]);router[_0xe1c6('0x23')](_0xe1c6('0x1a'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x25')]);router[_0xe1c6('0x23')]('/:id/canned_answers',auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x26')]);router[_0xe1c6('0x23')](_0xe1c6('0x17'),auth[_0xe1c6('0x9')](),controller[_0xe1c6('0x27')]);module[_0xe1c6('0x28')]=router; \ No newline at end of file +var _0xf56d=['removeAgents','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','getApplications','/:id/users','post','create','addDisposition','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers'];(function(_0x228d4b,_0x24d551){var _0xa5d147=function(_0x55bc1c){while(--_0x55bc1c){_0x228d4b['push'](_0x228d4b['shift']());}};_0xa5d147(++_0x24d551);}(_0xf56d,0x76));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdf56('0x0'));var util=require(_0xdf56('0x1'));var path=require(_0xdf56('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf56('0x3'));var router=express[_0xdf56('0x4')]();var fs_extra=require(_0xdf56('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdf56('0x6'));var config=require(_0xdf56('0x7'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0xdf56('0x8')](),controller[_0xdf56('0x9')]);router[_0xdf56('0xa')]('/describe',auth[_0xdf56('0x8')](),controller[_0xdf56('0xb')]);router[_0xdf56('0xa')](_0xdf56('0xc'),auth[_0xdf56('0x8')](),controller['show']);router['get'](_0xdf56('0xd'),auth[_0xdf56('0x8')](),controller[_0xdf56('0xe')]);router[_0xdf56('0xa')](_0xdf56('0xf'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x10')]);router[_0xdf56('0xa')]('/:id/interactions',auth[_0xdf56('0x8')](),controller[_0xdf56('0x11')]);router[_0xdf56('0xa')]('/:id/applications',auth[_0xdf56('0x8')](),controller[_0xdf56('0x12')]);router[_0xdf56('0xa')]('/:id/messages',auth[_0xdf56('0x8')](),controller['getMessages']);router[_0xdf56('0xa')](_0xdf56('0x13'),auth[_0xdf56('0x8')](),controller['getAgents']);router[_0xdf56('0x14')]('/',auth[_0xdf56('0x8')](),controller[_0xdf56('0x15')]);router[_0xdf56('0x14')](_0xdf56('0xd'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x16')]);router[_0xdf56('0x14')]('/:id/canned_answers',auth[_0xdf56('0x8')](),controller[_0xdf56('0x17')]);router[_0xdf56('0x14')](_0xdf56('0x18'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x19')]);router['post'](_0xdf56('0x1a'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x1b')]);router[_0xdf56('0x14')](_0xdf56('0x1c'),auth[_0xdf56('0x8')](),controller['addAccountApplications']);router[_0xdf56('0x14')](_0xdf56('0x1d'),auth[_0xdf56('0x8')](),controller['updateAccountApplications']);router[_0xdf56('0x14')](_0xdf56('0x1e'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x1f')]);router['post'](_0xdf56('0x13'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x20')]);router[_0xdf56('0x21')](_0xdf56('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xdf56('0x22')](_0xdf56('0xc'),auth['isAuthenticated'](),controller[_0xdf56('0x23')]);router[_0xdf56('0x22')]('/:id/dispositions',auth[_0xdf56('0x8')](),controller[_0xdf56('0x24')]);router[_0xdf56('0x22')]('/:id/canned_answers',auth[_0xdf56('0x8')](),controller[_0xdf56('0x25')]);router[_0xdf56('0x22')](_0xdf56('0x13'),auth[_0xdf56('0x8')](),controller[_0xdf56('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index a516f87..debc880 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 _0x1472=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x1472,0xe9));var _0x2147=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0x1472[_0x227cfb];return _0x131407;};'use strict';var Sequelize=require(_0x2147('0x0'));module[_0x2147('0x1')]={'priority':{'type':Sequelize[_0x2147('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2147('0x3')],'allowNull':![],'defaultValue':_0x2147('0x4')},'appdata':{'type':Sequelize[_0x2147('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2147('0x3')],'defaultValue':_0x2147('0x6')}}; \ No newline at end of file +var _0x0299=['*,*,*,*','exports','STRING'];(function(_0x1d9d93,_0x581406){var _0x430d54=function(_0x10a2a3){while(--_0x10a2a3){_0x1d9d93['push'](_0x1d9d93['shift']());}};_0x430d54(++_0x581406);}(_0x0299,0xa6));var _0x9029=function(_0x3de3ef,_0x463bb2){_0x3de3ef=_0x3de3ef-0x0;var _0x48943c=_0x0299[_0x3de3ef];return _0x48943c;};'use strict';var Sequelize=require('sequelize');module[_0x9029('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9029('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9029('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9029('0x2')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 030064e..137e0e7 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 _0xe50a=['sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','FaxApplication','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x44c817,_0x593100){var _0x424d3c=function(_0x5ea3ad){while(--_0x5ea3ad){_0x44c817['push'](_0x44c817['shift']());}};_0x424d3c(++_0x593100);}(_0xe50a,0x117));var _0xae50=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xe50a[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0xae50('0x0'));var rimraf=require(_0xae50('0x1'));var zipdir=require(_0xae50('0x2'));var jsonpatch=require(_0xae50('0x3'));var rp=require(_0xae50('0x4'));var moment=require(_0xae50('0x5'));var BPromise=require(_0xae50('0x6'));var Mustache=require(_0xae50('0x7'));var util=require(_0xae50('0x8'));var path=require(_0xae50('0x9'));var sox=require(_0xae50('0xa'));var csv=require(_0xae50('0xb'));var ejs=require(_0xae50('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae50('0xd'));var squel=require(_0xae50('0xe'));var crypto=require(_0xae50('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xae50('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae50('0x11'));var Redis=require('ioredis');var authService=require(_0xae50('0x12'));var qs=require(_0xae50('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae50('0x14'))(_0xae50('0x15'));var utils=require(_0xae50('0x16'));var config=require(_0xae50('0x17'));var licenseUtil=require(_0xae50('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbccb8e,_0x21bb16){_0x21bb16=_0x21bb16||0xcc;return function(_0x5a1fbc){if(_0x5a1fbc){return _0xbccb8e[_0xae50('0x19')](_0x21bb16);}return _0xbccb8e['status'](_0x21bb16)[_0xae50('0x1a')]();};}function respondWithResult(_0x321f14,_0x59c685){_0x59c685=_0x59c685||0xc8;return function(_0xb92e87){if(_0xb92e87){return _0x321f14[_0xae50('0x1b')](_0x59c685)[_0xae50('0x1c')](_0xb92e87);}};}function respondWithFilteredResult(_0x1a97e5,_0x270d80){return function(_0x47f244){if(_0x47f244){var _0x14f70e=typeof _0x270d80[_0xae50('0x1d')]==='undefined'&&typeof _0x270d80[_0xae50('0x1e')]===_0xae50('0x1f');var _0x8ccb26=_0x47f244[_0xae50('0x20')];var _0x314387=_0x14f70e?0x0:_0x270d80[_0xae50('0x1d')];var _0x2153d0=_0x14f70e?_0x47f244[_0xae50('0x20')]:_0x270d80['offset']+_0x270d80[_0xae50('0x1e')];var _0x2f59da;if(_0x2153d0>=_0x8ccb26){_0x2153d0=_0x8ccb26;_0x2f59da=0xc8;}else{_0x2f59da=0xce;}_0x1a97e5[_0xae50('0x1b')](_0x2f59da);return _0x1a97e5[_0xae50('0x21')]('Content-Range',_0x314387+'-'+_0x2153d0+'/'+_0x8ccb26)['json'](_0x47f244);}return null;};}function patchUpdates(_0x86b159){return function(_0x28964b){try{jsonpatch[_0xae50('0x22')](_0x28964b,_0x86b159,!![]);}catch(_0x5101d4){return BPromise[_0xae50('0x23')](_0x5101d4);}return _0x28964b[_0xae50('0x24')]();};}function saveUpdates(_0x5364c3,_0x52f7c5){return function(_0x4092d4){if(_0x4092d4){return _0x4092d4[_0xae50('0x25')](_0x5364c3)[_0xae50('0x26')](function(_0x9f9e1b){return _0x9f9e1b;});}return null;};}function removeEntity(_0x3f95c0,_0x1c7752){return function(_0x440d86){if(_0x440d86){return _0x440d86[_0xae50('0x27')]()[_0xae50('0x26')](function(){_0x3f95c0['status'](0xcc)[_0xae50('0x1a')]();});}};}function handleEntityNotFound(_0x3438db,_0xc3a87a){return function(_0x352289){if(!_0x352289){_0x3438db[_0xae50('0x19')](0x194);}return _0x352289;};}function handleError(_0x5f5cd1,_0x24079f){_0x24079f=_0x24079f||0x1f4;return function(_0x48a5a7){logger['error'](_0x48a5a7[_0xae50('0x28')]);if(_0x48a5a7[_0xae50('0x29')]){delete _0x48a5a7[_0xae50('0x29')];}_0x5f5cd1['status'](_0x24079f)[_0xae50('0x2a')](_0x48a5a7);};}exports[_0xae50('0x2b')]=function(_0x1d63ab,_0x1e002b){var _0x241742={},_0x401639={},_0x31fb99={'count':0x0,'rows':[]};var _0x18e522=_[_0xae50('0x2c')](db['FaxApplication'][_0xae50('0x2d')],function(_0xf60cac){return{'name':_0xf60cac[_0xae50('0x2e')],'type':_0xf60cac['type'][_0xae50('0x2f')]};});_0x401639[_0xae50('0x30')]=_[_0xae50('0x2c')](_0x18e522,_0xae50('0x29'));_0x401639[_0xae50('0x31')]=_[_0xae50('0x32')](_0x1d63ab['query']);_0x401639[_0xae50('0x33')]=_[_0xae50('0x34')](_0x401639[_0xae50('0x30')],_0x401639[_0xae50('0x31')]);_0x241742[_0xae50('0x35')]=_['intersection'](_0x401639[_0xae50('0x30')],qs[_0xae50('0x36')](_0x1d63ab[_0xae50('0x31')]['fields']));_0x241742[_0xae50('0x35')]=_0x241742[_0xae50('0x35')][_0xae50('0x37')]?_0x241742[_0xae50('0x35')]:_0x401639[_0xae50('0x30')];if(!_0x1d63ab['query'][_0xae50('0x38')](_0xae50('0x39'))){_0x241742['limit']=qs[_0xae50('0x1e')](_0x1d63ab[_0xae50('0x31')]['limit']);_0x241742[_0xae50('0x1d')]=qs['offset'](_0x1d63ab[_0xae50('0x31')][_0xae50('0x1d')]);}_0x241742[_0xae50('0x3a')]=qs[_0xae50('0x3b')](_0x1d63ab[_0xae50('0x31')][_0xae50('0x3b')]);_0x241742['where']=qs[_0xae50('0x33')](_[_0xae50('0x3c')](_0x1d63ab['query'],_0x401639['filters']),_0x18e522);if(_0x1d63ab[_0xae50('0x31')]['filter']){_0x241742[_0xae50('0x3d')]=_[_0xae50('0x3e')](_0x241742[_0xae50('0x3d')],{'$or':_[_0xae50('0x2c')](_0x18e522,function(_0x22d61e){if(_0x22d61e['type']!==_0xae50('0x3f')){var _0x82e6d7={};_0x82e6d7[_0x22d61e[_0xae50('0x29')]]={'$like':'%'+_0x1d63ab[_0xae50('0x31')][_0xae50('0x40')]+'%'};return _0x82e6d7;}})});}_0x241742=_[_0xae50('0x3e')]({},_0x241742,_0x1d63ab[_0xae50('0x41')]);var _0x4905ba={'where':_0x241742['where']};return db[_0xae50('0x42')][_0xae50('0x20')](_0x4905ba)['then'](function(_0x5f0721){_0x31fb99[_0xae50('0x20')]=_0x5f0721;if(_0x1d63ab[_0xae50('0x31')][_0xae50('0x43')]){_0x241742[_0xae50('0x44')]=[{'all':!![]}];}return db[_0xae50('0x42')]['findAll'](_0x241742);})[_0xae50('0x26')](function(_0x21f9f7){_0x31fb99[_0xae50('0x45')]=_0x21f9f7;return _0x31fb99;})[_0xae50('0x26')](respondWithFilteredResult(_0x1e002b,_0x241742))[_0xae50('0x46')](handleError(_0x1e002b,null));};exports[_0xae50('0x47')]=function(_0x53304d,_0x3b49f7){var _0x56cf74={'raw':!![],'where':{'id':_0x53304d[_0xae50('0x48')]['id']}},_0x419a69={};_0x419a69[_0xae50('0x30')]=_[_0xae50('0x32')](db[_0xae50('0x42')][_0xae50('0x2d')]);_0x419a69[_0xae50('0x31')]=_['keys'](_0x53304d[_0xae50('0x31')]);_0x419a69[_0xae50('0x33')]=_[_0xae50('0x34')](_0x419a69['model'],_0x419a69['query']);_0x56cf74[_0xae50('0x35')]=_['intersection'](_0x419a69[_0xae50('0x30')],qs[_0xae50('0x36')](_0x53304d[_0xae50('0x31')][_0xae50('0x36')]));_0x56cf74[_0xae50('0x35')]=_0x56cf74[_0xae50('0x35')][_0xae50('0x37')]?_0x56cf74[_0xae50('0x35')]:_0x419a69[_0xae50('0x30')];if(_0x53304d['query']['includeAll']){_0x56cf74[_0xae50('0x44')]=[{'all':!![]}];}_0x56cf74=_[_0xae50('0x3e')]({},_0x56cf74,_0x53304d['options']);return db[_0xae50('0x42')][_0xae50('0x49')](_0x56cf74)[_0xae50('0x26')](handleEntityNotFound(_0x3b49f7,null))['then'](respondWithResult(_0x3b49f7,null))[_0xae50('0x46')](handleError(_0x3b49f7,null));};exports[_0xae50('0x4a')]=function(_0x34e08a,_0x58ba74){return db[_0xae50('0x42')][_0xae50('0x4a')](_0x34e08a[_0xae50('0x4b')],{})[_0xae50('0x26')](respondWithResult(_0x58ba74,0xc9))[_0xae50('0x46')](handleError(_0x58ba74,null));};exports[_0xae50('0x25')]=function(_0x288e4a,_0xd8b57a){if(_0x288e4a['body']['id']){delete _0x288e4a[_0xae50('0x4b')]['id'];}return db[_0xae50('0x42')]['find']({'where':{'id':_0x288e4a['params']['id']}})[_0xae50('0x26')](handleEntityNotFound(_0xd8b57a,null))['then'](saveUpdates(_0x288e4a['body'],null))['then'](respondWithResult(_0xd8b57a,null))[_0xae50('0x46')](handleError(_0xd8b57a,null));};exports[_0xae50('0x27')]=function(_0x565939,_0x32efa7){return db['FaxApplication'][_0xae50('0x49')]({'where':{'id':_0x565939[_0xae50('0x48')]['id']}})[_0xae50('0x26')](handleEntityNotFound(_0x32efa7,null))['then'](removeEntity(_0x32efa7,null))[_0xae50('0x46')](handleError(_0x32efa7,null));}; \ No newline at end of file +var _0xacb7=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','FaxApplication','fieldName','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','create','catch','body','params','rimraf','zip-dir','fast-json-patch'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0xacb7,0x12d));var _0x7acb=function(_0x17af8b,_0x1db499){_0x17af8b=_0x17af8b-0x0;var _0x2bbf33=_0xacb7[_0x17af8b];return _0x2bbf33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7acb('0x0'));var zipdir=require(_0x7acb('0x1'));var jsonpatch=require(_0x7acb('0x2'));var rp=require(_0x7acb('0x3'));var moment=require('moment');var BPromise=require(_0x7acb('0x4'));var Mustache=require(_0x7acb('0x5'));var util=require(_0x7acb('0x6'));var path=require(_0x7acb('0x7'));var sox=require(_0x7acb('0x8'));var csv=require(_0x7acb('0x9'));var ejs=require(_0x7acb('0xa'));var fs=require('fs');var fs_extra=require(_0x7acb('0xb'));var _=require(_0x7acb('0xc'));var squel=require(_0x7acb('0xd'));var crypto=require(_0x7acb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7acb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7acb('0x10'));var Papa=require('papaparse');var Redis=require(_0x7acb('0x11'));var authService=require(_0x7acb('0x12'));var qs=require(_0x7acb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7acb('0x14'));var logger=require(_0x7acb('0x15'))('api');var utils=require(_0x7acb('0x16'));var config=require(_0x7acb('0x17'));var licenseUtil=require(_0x7acb('0x18'));var db=require(_0x7acb('0x19'))['db'];function respondWithStatusCode(_0x570d8d,_0xa66036){_0xa66036=_0xa66036||0xcc;return function(_0x471c68){if(_0x471c68){return _0x570d8d[_0x7acb('0x1a')](_0xa66036);}return _0x570d8d[_0x7acb('0x1b')](_0xa66036)[_0x7acb('0x1c')]();};}function respondWithResult(_0xe18dd7,_0x474ade){_0x474ade=_0x474ade||0xc8;return function(_0x34ee12){if(_0x34ee12){return _0xe18dd7[_0x7acb('0x1b')](_0x474ade)['json'](_0x34ee12);}};}function respondWithFilteredResult(_0x55311d,_0x14cdb3){return function(_0x566ff8){if(_0x566ff8){var _0x48d50e=typeof _0x14cdb3[_0x7acb('0x1d')]===_0x7acb('0x1e')&&typeof _0x14cdb3['limit']==='undefined';var _0xedd46e=_0x566ff8[_0x7acb('0x1f')];var _0x24137b=_0x48d50e?0x0:_0x14cdb3[_0x7acb('0x1d')];var _0x1589a5=_0x48d50e?_0x566ff8[_0x7acb('0x1f')]:_0x14cdb3[_0x7acb('0x1d')]+_0x14cdb3[_0x7acb('0x20')];var _0x21c6cc;if(_0x1589a5>=_0xedd46e){_0x1589a5=_0xedd46e;_0x21c6cc=0xc8;}else{_0x21c6cc=0xce;}_0x55311d[_0x7acb('0x1b')](_0x21c6cc);return _0x55311d[_0x7acb('0x21')](_0x7acb('0x22'),_0x24137b+'-'+_0x1589a5+'/'+_0xedd46e)[_0x7acb('0x23')](_0x566ff8);}return null;};}function patchUpdates(_0x2e107f){return function(_0x39ded7){try{jsonpatch[_0x7acb('0x24')](_0x39ded7,_0x2e107f,!![]);}catch(_0x2f23e7){return BPromise[_0x7acb('0x25')](_0x2f23e7);}return _0x39ded7[_0x7acb('0x26')]();};}function saveUpdates(_0x463af2,_0x27cc2f){return function(_0xadeade){if(_0xadeade){return _0xadeade[_0x7acb('0x27')](_0x463af2)[_0x7acb('0x28')](function(_0x326bed){return _0x326bed;});}return null;};}function removeEntity(_0x5025de,_0x1bae58){return function(_0x42394d){if(_0x42394d){return _0x42394d[_0x7acb('0x29')]()[_0x7acb('0x28')](function(){_0x5025de[_0x7acb('0x1b')](0xcc)[_0x7acb('0x1c')]();});}};}function handleEntityNotFound(_0x4dc83,_0x494008){return function(_0x4912d6){if(!_0x4912d6){_0x4dc83['sendStatus'](0x194);}return _0x4912d6;};}function handleError(_0x49d1b4,_0x2729aa){_0x2729aa=_0x2729aa||0x1f4;return function(_0x481e25){logger['error'](_0x481e25['stack']);if(_0x481e25[_0x7acb('0x2a')]){delete _0x481e25[_0x7acb('0x2a')];}_0x49d1b4[_0x7acb('0x1b')](_0x2729aa)[_0x7acb('0x2b')](_0x481e25);};}exports[_0x7acb('0x2c')]=function(_0xf5adac,_0x553a63){var _0x4a137c={},_0x1cb3e1={},_0x3948de={'count':0x0,'rows':[]};var _0x2401b9=_['map'](db[_0x7acb('0x2d')]['rawAttributes'],function(_0x3128b4){return{'name':_0x3128b4[_0x7acb('0x2e')],'type':_0x3128b4[_0x7acb('0x2f')]['key']};});_0x1cb3e1[_0x7acb('0x30')]=_[_0x7acb('0x31')](_0x2401b9,'name');_0x1cb3e1[_0x7acb('0x32')]=_[_0x7acb('0x33')](_0xf5adac[_0x7acb('0x32')]);_0x1cb3e1['filters']=_['intersection'](_0x1cb3e1[_0x7acb('0x30')],_0x1cb3e1[_0x7acb('0x32')]);_0x4a137c[_0x7acb('0x34')]=_['intersection'](_0x1cb3e1[_0x7acb('0x30')],qs[_0x7acb('0x35')](_0xf5adac[_0x7acb('0x32')][_0x7acb('0x35')]));_0x4a137c[_0x7acb('0x34')]=_0x4a137c[_0x7acb('0x34')][_0x7acb('0x36')]?_0x4a137c[_0x7acb('0x34')]:_0x1cb3e1[_0x7acb('0x30')];if(!_0xf5adac[_0x7acb('0x32')][_0x7acb('0x37')](_0x7acb('0x38'))){_0x4a137c['limit']=qs['limit'](_0xf5adac[_0x7acb('0x32')]['limit']);_0x4a137c[_0x7acb('0x1d')]=qs['offset'](_0xf5adac[_0x7acb('0x32')]['offset']);}_0x4a137c[_0x7acb('0x39')]=qs['sort'](_0xf5adac[_0x7acb('0x32')][_0x7acb('0x3a')]);_0x4a137c[_0x7acb('0x3b')]=qs[_0x7acb('0x3c')](_['pick'](_0xf5adac[_0x7acb('0x32')],_0x1cb3e1['filters']),_0x2401b9);if(_0xf5adac[_0x7acb('0x32')][_0x7acb('0x3d')]){_0x4a137c[_0x7acb('0x3b')]=_[_0x7acb('0x3e')](_0x4a137c['where'],{'$or':_['map'](_0x2401b9,function(_0x3026fb){if(_0x3026fb[_0x7acb('0x2f')]!==_0x7acb('0x3f')){var _0x9a8cb3={};_0x9a8cb3[_0x3026fb[_0x7acb('0x2a')]]={'$like':'%'+_0xf5adac[_0x7acb('0x32')][_0x7acb('0x3d')]+'%'};return _0x9a8cb3;}})});}_0x4a137c=_[_0x7acb('0x3e')]({},_0x4a137c,_0xf5adac[_0x7acb('0x40')]);var _0x37c56b={'where':_0x4a137c[_0x7acb('0x3b')]};return db[_0x7acb('0x2d')][_0x7acb('0x1f')](_0x37c56b)['then'](function(_0x3571ce){_0x3948de[_0x7acb('0x1f')]=_0x3571ce;if(_0xf5adac[_0x7acb('0x32')][_0x7acb('0x41')]){_0x4a137c[_0x7acb('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x7acb('0x43')](_0x4a137c);})[_0x7acb('0x28')](function(_0x26c6ea){_0x3948de[_0x7acb('0x44')]=_0x26c6ea;return _0x3948de;})[_0x7acb('0x28')](respondWithFilteredResult(_0x553a63,_0x4a137c))['catch'](handleError(_0x553a63,null));};exports[_0x7acb('0x45')]=function(_0x4f9478,_0x59284b){var _0x48cf2d={'raw':!![],'where':{'id':_0x4f9478['params']['id']}},_0x23d99a={};_0x23d99a['model']=_[_0x7acb('0x33')](db[_0x7acb('0x2d')]['rawAttributes']);_0x23d99a[_0x7acb('0x32')]=_[_0x7acb('0x33')](_0x4f9478[_0x7acb('0x32')]);_0x23d99a[_0x7acb('0x3c')]=_[_0x7acb('0x46')](_0x23d99a[_0x7acb('0x30')],_0x23d99a[_0x7acb('0x32')]);_0x48cf2d[_0x7acb('0x34')]=_[_0x7acb('0x46')](_0x23d99a[_0x7acb('0x30')],qs[_0x7acb('0x35')](_0x4f9478[_0x7acb('0x32')][_0x7acb('0x35')]));_0x48cf2d[_0x7acb('0x34')]=_0x48cf2d[_0x7acb('0x34')][_0x7acb('0x36')]?_0x48cf2d['attributes']:_0x23d99a[_0x7acb('0x30')];if(_0x4f9478[_0x7acb('0x32')][_0x7acb('0x41')]){_0x48cf2d[_0x7acb('0x42')]=[{'all':!![]}];}_0x48cf2d=_[_0x7acb('0x3e')]({},_0x48cf2d,_0x4f9478[_0x7acb('0x40')]);return db['FaxApplication'][_0x7acb('0x47')](_0x48cf2d)[_0x7acb('0x28')](handleEntityNotFound(_0x59284b,null))[_0x7acb('0x28')](respondWithResult(_0x59284b,null))['catch'](handleError(_0x59284b,null));};exports['create']=function(_0x1d06eb,_0x2b4fa6){return db['FaxApplication'][_0x7acb('0x48')](_0x1d06eb['body'],{})['then'](respondWithResult(_0x2b4fa6,0xc9))[_0x7acb('0x49')](handleError(_0x2b4fa6,null));};exports[_0x7acb('0x27')]=function(_0xdedfba,_0x4b1bec){if(_0xdedfba['body']['id']){delete _0xdedfba[_0x7acb('0x4a')]['id'];}return db[_0x7acb('0x2d')][_0x7acb('0x47')]({'where':{'id':_0xdedfba[_0x7acb('0x4b')]['id']}})[_0x7acb('0x28')](handleEntityNotFound(_0x4b1bec,null))['then'](saveUpdates(_0xdedfba[_0x7acb('0x4a')],null))[_0x7acb('0x28')](respondWithResult(_0x4b1bec,null))[_0x7acb('0x49')](handleError(_0x4b1bec,null));};exports[_0x7acb('0x29')]=function(_0x3365ee,_0x303ecf){return db[_0x7acb('0x2d')][_0x7acb('0x47')]({'where':{'id':_0x3365ee[_0x7acb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x303ecf,null))[_0x7acb('0x28')](removeEntity(_0x303ecf,null))['catch'](handleError(_0x303ecf,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6db5f92..d584f2d 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 _0xd0fa=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xd0fa,0xb1));var _0xad0f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xd0fa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xad0f('0x0'));var util=require(_0xad0f('0x1'));var logger=require(_0xad0f('0x2'))(_0xad0f('0x3'));var moment=require(_0xad0f('0x4'));var BPromise=require(_0xad0f('0x5'));var rp=require(_0xad0f('0x6'));var fs=require('fs');var path=require(_0xad0f('0x7'));var rimraf=require(_0xad0f('0x8'));var config=require(_0xad0f('0x9'));var attributes=require(_0xad0f('0xa'));module[_0xad0f('0xb')]=function(_0x3e0bc2,_0x506c6d){return _0x3e0bc2['define'](_0xad0f('0xc'),attributes,{'tableName':_0xad0f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad0f('0xe'),'collate':_0xad0f('0xf')});}; \ No newline at end of file +var _0x2629=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x2629,0x16e));var _0x9262=function(_0x42aa0a,_0x57286c){_0x42aa0a=_0x42aa0a-0x0;var _0x1150e4=_0x2629[_0x42aa0a];return _0x1150e4;};'use strict';var _=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var logger=require(_0x9262('0x2'))(_0x9262('0x3'));var moment=require('moment');var BPromise=require(_0x9262('0x4'));var rp=require(_0x9262('0x5'));var fs=require('fs');var path=require(_0x9262('0x6'));var rimraf=require('rimraf');var config=require(_0x9262('0x7'));var attributes=require(_0x9262('0x8'));module[_0x9262('0x9')]=function(_0x1b213e,_0x30572f){return _0x1b213e[_0x9262('0xa')](_0x9262('0xb'),attributes,{'tableName':_0x9262('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9262('0xd'),'collate':_0x9262('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 144199e..d197e44 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 _0x070f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','catch','lodash','util','moment','bluebird'];(function(_0x122fa0,_0x4b8d15){var _0x4859de=function(_0x3f180d){while(--_0x3f180d){_0x122fa0['push'](_0x122fa0['shift']());}};_0x4859de(++_0x4b8d15);}(_0x070f,0x9c));var _0xf070=function(_0x362723,_0x52903c){_0x362723=_0x362723-0x0;var _0x53eabc=_0x070f[_0x362723];return _0x53eabc;};'use strict';var _=require(_0xf070('0x0'));var util=require(_0xf070('0x1'));var moment=require(_0xf070('0x2'));var BPromise=require(_0xf070('0x3'));var rs=require(_0xf070('0x4'));var fs=require('fs');var Redis=require(_0xf070('0x5'));var db=require(_0xf070('0x6'))['db'];var utils=require(_0xf070('0x7'));var logger=require(_0xf070('0x8'))(_0xf070('0x9'));var config=require(_0xf070('0xa'));var jayson=require(_0xf070('0xb'));var client=jayson[_0xf070('0xc')][_0xf070('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b06ab,_0x276e23,_0x1b1093){return new BPromise(function(_0x3bb11e,_0x3100a6){return client['request'](_0x4b06ab,_0x1b1093)[_0xf070('0xe')](function(_0x347256){logger[_0xf070('0xf')](_0xf070('0x10'),_0x276e23,_0xf070('0x11'));logger[_0xf070('0x12')](_0xf070('0x13'),_0x276e23,_0xf070('0x11'),JSON['stringify'](_0x347256));if(_0x347256[_0xf070('0x14')]){if(_0x347256['error'][_0xf070('0x15')]===0x1f4){logger[_0xf070('0x14')](_0xf070('0x10'),_0x276e23,_0x347256[_0xf070('0x14')][_0xf070('0x16')]);return _0x3100a6(_0x347256['error']['message']);}logger[_0xf070('0x14')](_0xf070('0x10'),_0x276e23,_0x347256[_0xf070('0x14')][_0xf070('0x16')]);return _0x3bb11e(_0x347256[_0xf070('0x14')][_0xf070('0x16')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x276e23,'request\x20sent');_0x3bb11e(_0x347256[_0xf070('0x17')]['message']);}})['catch'](function(_0x55431b){logger['error'](_0xf070('0x10'),_0x276e23,_0x55431b);_0x3100a6(_0x55431b);});});}exports[_0xf070('0x18')]=function(_0x43f25c){var _0x519319=this;return new Promise(function(_0x551d,_0x204c5b){return db[_0xf070('0x19')][_0xf070('0x1a')](_0x43f25c[_0xf070('0x1b')],{'raw':_0x43f25c[_0xf070('0x1c')]?_0x43f25c['options'][_0xf070('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f25c[_0xf070('0x1c')]?_0x43f25c['options']['where']||null:null,'attributes':_0x43f25c[_0xf070('0x1c')]?_0x43f25c[_0xf070('0x1c')][_0xf070('0x1e')]||null:null,'limit':_0x43f25c[_0xf070('0x1c')]?_0x43f25c[_0xf070('0x1c')]['limit']||null:null})['then'](function(_0x3f9128){logger[_0xf070('0xf')](_0xf070('0x18'),_0x43f25c);logger[_0xf070('0x12')](_0xf070('0x18'),_0x43f25c,JSON['stringify'](_0x3f9128));_0x551d(_0x3f9128);})[_0xf070('0x1f')](function(_0x207c92){logger[_0xf070('0x14')]('UpdateFaxApplication',_0x207c92[_0xf070('0x16')],_0x43f25c);_0x204c5b(_0x519319[_0xf070('0x14')](0x1f4,_0x207c92[_0xf070('0x16')]));});});}; \ No newline at end of file +var _0x1226=['../../config/utils','../../config/logger','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','randomstring'];(function(_0x14c072,_0x2aedf4){var _0x4ef3ce=function(_0x1e5ca1){while(--_0x1e5ca1){_0x14c072['push'](_0x14c072['shift']());}};_0x4ef3ce(++_0x2aedf4);}(_0x1226,0x173));var _0x6122=function(_0x584b48,_0x3008c7){_0x584b48=_0x584b48-0x0;var _0x3b76a4=_0x1226[_0x584b48];return _0x3b76a4;};'use strict';var _=require(_0x6122('0x0'));var util=require(_0x6122('0x1'));var moment=require(_0x6122('0x2'));var BPromise=require('bluebird');var rs=require(_0x6122('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6122('0x4'));var logger=require(_0x6122('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6122('0x6')][_0x6122('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d7df5,_0x5e32d4,_0x3c71bd){return new BPromise(function(_0x3aff2e,_0x44a021){return client[_0x6122('0x8')](_0x2d7df5,_0x3c71bd)['then'](function(_0x5d1374){logger[_0x6122('0x9')](_0x6122('0xa'),_0x5e32d4,_0x6122('0xb'));logger[_0x6122('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5e32d4,'request\x20sent',JSON['stringify'](_0x5d1374));if(_0x5d1374[_0x6122('0xd')]){if(_0x5d1374['error'][_0x6122('0xe')]===0x1f4){logger[_0x6122('0xd')](_0x6122('0xa'),_0x5e32d4,_0x5d1374[_0x6122('0xd')][_0x6122('0xf')]);return _0x44a021(_0x5d1374[_0x6122('0xd')][_0x6122('0xf')]);}logger[_0x6122('0xd')](_0x6122('0xa'),_0x5e32d4,_0x5d1374[_0x6122('0xd')]['message']);return _0x3aff2e(_0x5d1374['error']['message']);}else{logger[_0x6122('0x9')](_0x6122('0xa'),_0x5e32d4,_0x6122('0xb'));_0x3aff2e(_0x5d1374['result']['message']);}})[_0x6122('0x10')](function(_0x591807){logger['error'](_0x6122('0xa'),_0x5e32d4,_0x591807);_0x44a021(_0x591807);});});}exports['UpdateFaxApplication']=function(_0x5ab861){var _0x22fec5=this;return new Promise(function(_0x328239,_0x4258a2){return db['FaxApplication'][_0x6122('0x11')](_0x5ab861[_0x6122('0x12')],{'raw':_0x5ab861[_0x6122('0x13')]?_0x5ab861[_0x6122('0x13')][_0x6122('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ab861[_0x6122('0x13')]?_0x5ab861['options'][_0x6122('0x15')]||null:null,'attributes':_0x5ab861[_0x6122('0x13')]?_0x5ab861[_0x6122('0x13')][_0x6122('0x16')]||null:null,'limit':_0x5ab861[_0x6122('0x13')]?_0x5ab861[_0x6122('0x13')][_0x6122('0x17')]||null:null})['then'](function(_0x3c82c7){logger[_0x6122('0x9')](_0x6122('0x18'),_0x5ab861);logger[_0x6122('0xc')](_0x6122('0x18'),_0x5ab861,JSON['stringify'](_0x3c82c7));_0x328239(_0x3c82c7);})[_0x6122('0x10')](function(_0x150b1a){logger[_0x6122('0xd')](_0x6122('0x18'),_0x150b1a[_0x6122('0xf')],_0x5ab861);_0x4258a2(_0x22fec5[_0x6122('0xd')](0x1f4,_0x150b1a[_0x6122('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index acc3acd..5d6cfc1 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 _0x0b0e=['./faxApplication.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(_0x27999e,_0x1cbbd2){var _0x19498d=function(_0x2bd9ab){while(--_0x2bd9ab){_0x27999e['push'](_0x27999e['shift']());}};_0x19498d(++_0x1cbbd2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x0b0e[_0x136a0d];return _0x212ea5;};'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 +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1a05743..300bbe1 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 _0xe2fe=['DATE','STRING','out','INTEGER','sequelize'];(function(_0x1c3ad0,_0x389868){var _0x185376=function(_0x3ee39e){while(--_0x3ee39e){_0x1c3ad0['push'](_0x1c3ad0['shift']());}};_0x185376(++_0x389868);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee2f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xee2f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xee2f('0x2')]},'note':{'type':Sequelize[_0xee2f('0x2')]},'read1stAt':{'type':Sequelize[_0xee2f('0x1')]},'fax':{'type':Sequelize[_0xee2f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee2f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xee2f('0x4')]}}; \ No newline at end of file +var _0x8ace=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x4e0b2d,_0x4bc8e6){var _0x4d53ef=function(_0x27851a){while(--_0x27851a){_0x4e0b2d['push'](_0x4e0b2d['shift']());}};_0x4d53ef(++_0x4bc8e6);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x349ac1,_0x443243){_0x349ac1=_0x349ac1-0x0;var _0x77840a=_0x8ace[_0x349ac1];return _0x77840a;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'closed':{'type':Sequelize[_0xe8ac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe8ac('0x3')]},'disposition':{'type':Sequelize[_0xe8ac('0x4')]},'secondDisposition':{'type':Sequelize[_0xe8ac('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe8ac('0x4')]},'note':{'type':Sequelize[_0xe8ac('0x4')]},'read1stAt':{'type':Sequelize[_0xe8ac('0x3')]},'fax':{'type':Sequelize[_0xe8ac('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe8ac('0x5')]('in',_0xe8ac('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe8ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe8ac('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xe8ac('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 08684d7..6b91cf7 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 _0xf024=['undefined','limit','count','set','then','destroy','end','stack','name','send','map','FaxInteraction','type','key','getOptions','findAll','fax','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','includeAll','include','merge','options','create','body','describe','addMessage','FaxMessage','find','ids','getMessages','findOne','rawAttributes','length','hasOwnProperty','nolimit','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','resolve','err','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset'];(function(_0x1b32e2,_0x202f0e){var _0xdc6735=function(_0x2cc3d5){while(--_0x2cc3d5){_0x1b32e2['push'](_0x1b32e2['shift']());}};_0xdc6735(++_0x202f0e);}(_0xf024,0x124));var _0x4f02=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf024[_0x13b8f3];return _0x1a6d06;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x4f02('0x0'));var BPromise=require(_0x4f02('0x1'));var util=require(_0x4f02('0x2'));var path=require(_0x4f02('0x3'));var fs=require('fs');var _=require(_0x4f02('0x4'));var Redis=require(_0x4f02('0x5'));var interaction=require(_0x4f02('0x6'));var qs=require(_0x4f02('0x7'));var logger=require(_0x4f02('0x8'))(_0x4f02('0x9'));var config=require(_0x4f02('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4f02('0xb')](config[_0x4f02('0xc')],{'host':_0x4f02('0xd'),'port':0x18eb});var socket=require(_0x4f02('0xe'))(new Redis(config[_0x4f02('0xc')]));require(_0x4f02('0xf'))[_0x4f02('0x10')](socket);function respondWithStatusCode(_0x190d5d,_0x3cb1ad){_0x3cb1ad=_0x3cb1ad||0xcc;return function(_0x2f055b){if(_0x2f055b){return _0x190d5d[_0x4f02('0x11')](_0x3cb1ad);}return _0x190d5d[_0x4f02('0x12')](_0x3cb1ad)['end']();};}function respondWithResult(_0x2b17de,_0x391e5a){_0x391e5a=_0x391e5a||0xc8;return function(_0x330fdc){if(_0x330fdc){return _0x2b17de['status'](_0x391e5a)['json'](_0x330fdc);}};}function respondWithFilteredResult(_0x4954ac,_0x5dc890){return function(_0x595eae){if(_0x595eae){var _0x4747e3=typeof _0x5dc890[_0x4f02('0x13')]===_0x4f02('0x14')&&typeof _0x5dc890[_0x4f02('0x15')]==='undefined';var _0x157484=_0x595eae[_0x4f02('0x16')];var _0x215ed8=_0x4747e3?0x0:_0x5dc890[_0x4f02('0x13')];var _0x138278=_0x4747e3?_0x595eae[_0x4f02('0x16')]:_0x5dc890[_0x4f02('0x13')]+_0x5dc890['limit'];var _0x5ca5d7;if(_0x138278>=_0x157484){_0x138278=_0x157484;_0x5ca5d7=0xc8;}else{_0x5ca5d7=0xce;}_0x4954ac[_0x4f02('0x12')](_0x5ca5d7);return _0x4954ac[_0x4f02('0x17')]('Content-Range',_0x215ed8+'-'+_0x138278+'/'+_0x157484)['json'](_0x595eae);}return null;};}function saveUpdates(_0x24dc67){return function(_0x4f6945){if(_0x4f6945){return _0x4f6945['update'](_0x24dc67)[_0x4f02('0x18')](function(_0x697c69){return _0x697c69;});}return null;};}function removeEntity(_0x194d0e){return function(_0x208116){if(_0x208116){return _0x208116[_0x4f02('0x19')]()['then'](function(){_0x194d0e[_0x4f02('0x12')](0xcc)[_0x4f02('0x1a')]();});}};}function handleEntityNotFound(_0x3ef1ea){return function(_0x26c21d){if(!_0x26c21d){_0x3ef1ea[_0x4f02('0x11')](0x194);}return _0x26c21d;};}function handleError(_0x2126b9,_0x3e7337){_0x3e7337=_0x3e7337||0x1f4;return function(_0x2e0fc9){logger['error'](_0x2e0fc9[_0x4f02('0x1b')]);if(_0x2e0fc9[_0x4f02('0x1c')]){delete _0x2e0fc9[_0x4f02('0x1c')];}_0x2126b9[_0x4f02('0x12')](_0x3e7337)[_0x4f02('0x1d')](_0x2e0fc9);};}exports['index']=function(_0x51fd4f,_0x5bda83){var _0x280800={};var _0x5afd98=_[_0x4f02('0x1e')](db[_0x4f02('0x1f')]['rawAttributes'],function(_0x374397){return{'name':_0x374397['fieldName'],'type':_0x374397[_0x4f02('0x20')][_0x4f02('0x21')]};});_0x280800=qs[_0x4f02('0x22')](_0x5afd98,_0x51fd4f);return interaction[_0x4f02('0x23')](_0x4f02('0x24'),_0x51fd4f['query'],_0x51fd4f[_0x4f02('0x25')],_0x280800,_0x5afd98)[_0x4f02('0x18')](respondWithFilteredResult(_0x5bda83,_0x280800))[_0x4f02('0x26')](handleError(_0x5bda83,null));};exports[_0x4f02('0x27')]=function(_0x171c20,_0x49f285){var _0x559f89={'raw':![],'where':{'id':_0x171c20[_0x4f02('0x28')]['id']}},_0x4736bf={};_0x4736bf[_0x4f02('0x29')]=_[_0x4f02('0x2a')](db[_0x4f02('0x1f')]['rawAttributes']);_0x4736bf[_0x4f02('0x2b')]=_[_0x4f02('0x2a')](_0x171c20[_0x4f02('0x2b')]);_0x4736bf[_0x4f02('0x2c')]=_['intersection'](_0x4736bf[_0x4f02('0x29')],_0x4736bf[_0x4f02('0x2b')]);_0x559f89[_0x4f02('0x2d')]=_[_0x4f02('0x2e')](_0x4736bf[_0x4f02('0x29')],qs['fields'](_0x171c20[_0x4f02('0x2b')][_0x4f02('0x2f')]));_0x559f89[_0x4f02('0x2d')]=_0x559f89[_0x4f02('0x2d')]['length']?_0x559f89[_0x4f02('0x2d')]:_0x4736bf[_0x4f02('0x29')];if(_0x171c20[_0x4f02('0x2b')][_0x4f02('0x30')]){_0x559f89[_0x4f02('0x31')]=[{'all':!![]}];}_0x559f89=_[_0x4f02('0x32')]({},_0x559f89,_0x171c20[_0x4f02('0x33')]);return db[_0x4f02('0x1f')]['find'](_0x559f89)[_0x4f02('0x18')](handleEntityNotFound(_0x49f285,null))[_0x4f02('0x18')](respondWithResult(_0x49f285,null))['catch'](handleError(_0x49f285,null));};exports[_0x4f02('0x34')]=function(_0x3a9f03,_0x370f07){return db['FaxInteraction']['create'](_0x3a9f03[_0x4f02('0x35')],{})[_0x4f02('0x18')](respondWithResult(_0x370f07,0xc9))[_0x4f02('0x26')](handleError(_0x370f07,null));};exports['update']=function(_0x2b212a,_0x318ba4){if(_0x2b212a[_0x4f02('0x35')]['id']){delete _0x2b212a[_0x4f02('0x35')]['id'];}return db[_0x4f02('0x1f')]['find']({'where':{'id':_0x2b212a[_0x4f02('0x28')]['id']}})[_0x4f02('0x18')](handleEntityNotFound(_0x318ba4,null))[_0x4f02('0x18')](saveUpdates(_0x2b212a['body'],null))[_0x4f02('0x18')](respondWithResult(_0x318ba4,null))[_0x4f02('0x26')](handleError(_0x318ba4,null));};exports[_0x4f02('0x19')]=function(_0x5b1d13,_0x46a243){return db[_0x4f02('0x1f')]['find']({'where':{'id':_0x5b1d13[_0x4f02('0x28')]['id']}})['then'](handleEntityNotFound(_0x46a243,null))[_0x4f02('0x18')](removeEntity(_0x46a243,null))[_0x4f02('0x26')](handleError(_0x46a243,null));};exports['describe']=function(_0x4509c3,_0x27d421){return db[_0x4f02('0x1f')][_0x4f02('0x36')]()[_0x4f02('0x18')](respondWithResult(_0x27d421,null))[_0x4f02('0x26')](handleError(_0x27d421,null));};exports[_0x4f02('0x37')]=function(_0x489b76,_0x19827c){return db[_0x4f02('0x38')][_0x4f02('0x39')]({'where':{'id':_0x489b76[_0x4f02('0x28')]['id']}})[_0x4f02('0x18')](handleEntityNotFound(_0x19827c,null))[_0x4f02('0x18')](function(_0x1b6de4){if(_0x1b6de4){return _0x1b6de4[_0x4f02('0x37')](_0x489b76[_0x4f02('0x35')][_0x4f02('0x3a')],_['omit'](_0x489b76[_0x4f02('0x35')],[_0x4f02('0x3a'),'id'])||{});}})[_0x4f02('0x18')](respondWithResult(_0x19827c,null))['catch'](handleError(_0x19827c,null));};exports[_0x4f02('0x3b')]=function(_0x59725d,_0x2ca1ce){var _0x2c6182={'raw':![],'where':{}};var _0x40b033={};var _0x1167c1={'count':0x0,'rows':[]};return db[_0x4f02('0x1f')][_0x4f02('0x3c')]({'where':{'id':_0x59725d['params']['id']}})['then'](handleEntityNotFound(_0x2ca1ce,null))[_0x4f02('0x18')](function(_0x33f840){if(_0x33f840){_0x40b033[_0x4f02('0x29')]=_['keys'](db['FaxMessage'][_0x4f02('0x3d')]);_0x40b033[_0x4f02('0x2b')]=_[_0x4f02('0x2a')](_0x59725d[_0x4f02('0x2b')]);_0x40b033[_0x4f02('0x2c')]=_['intersection'](_0x40b033[_0x4f02('0x29')],_0x40b033['query']);_0x2c6182['attributes']=_[_0x4f02('0x2e')](_0x40b033[_0x4f02('0x29')],qs[_0x4f02('0x2f')](_0x59725d['query'][_0x4f02('0x2f')]));_0x2c6182[_0x4f02('0x2d')]=_0x2c6182[_0x4f02('0x2d')][_0x4f02('0x3e')]?_0x2c6182[_0x4f02('0x2d')]:_0x40b033[_0x4f02('0x29')];if(!_0x59725d['query'][_0x4f02('0x3f')](_0x4f02('0x40'))){_0x2c6182[_0x4f02('0x15')]=qs[_0x4f02('0x15')](_0x59725d['query'][_0x4f02('0x15')]);_0x2c6182[_0x4f02('0x13')]=qs[_0x4f02('0x13')](_0x59725d[_0x4f02('0x2b')][_0x4f02('0x13')]);}_0x2c6182['order']=qs[_0x4f02('0x41')](_0x59725d[_0x4f02('0x2b')]['sort']);_0x2c6182[_0x4f02('0x42')]=qs[_0x4f02('0x2c')](_[_0x4f02('0x43')](_0x59725d[_0x4f02('0x2b')],_0x40b033[_0x4f02('0x2c')]));_0x2c6182[_0x4f02('0x42')][_0x4f02('0x44')]=_0x33f840['id'];if(_0x59725d['query'][_0x4f02('0x45')]){_0x2c6182['where']=_[_0x4f02('0x32')](_0x2c6182[_0x4f02('0x42')],{'$or':_[_0x4f02('0x1e')](_0x2c6182[_0x4f02('0x2d')],function(_0x19b1bc){var _0x4f0708={};_0x4f0708[_0x19b1bc]={'$like':'%'+_0x59725d[_0x4f02('0x2b')][_0x4f02('0x45')]+'%'};return _0x4f0708;})});}if(_0x59725d[_0x4f02('0x2b')][_0x4f02('0x46')]){var _0x414010=_0x59725d['query'][_0x4f02('0x46')][_0x4f02('0x47')](',');var _0x6c9583={};_0x6c9583[_0x414010[0x0]]={'$gte':moment(_0x414010[0x1])[_0x4f02('0x48')](_0x4f02('0x49'))};_0x2c6182['where']=_[_0x4f02('0x32')](_0x2c6182[_0x4f02('0x42')],_0x6c9583);}_0x2c6182=_['merge']({},_0x2c6182,_0x59725d['options']);return db['FaxMessage']['count']({'where':_0x2c6182[_0x4f02('0x42')]})[_0x4f02('0x18')](function(_0x409624){_0x1167c1[_0x4f02('0x16')]=_0x409624;if(_0x59725d['query'][_0x4f02('0x30')]){_0x2c6182[_0x4f02('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0x4f02('0x23')](_0x2c6182);})[_0x4f02('0x18')](function(_0x242ddb){_0x1167c1[_0x4f02('0x4a')]=_0x242ddb;return _0x1167c1;});}})[_0x4f02('0x18')](respondWithFilteredResult(_0x2ca1ce,_0x2c6182))[_0x4f02('0x26')](handleError(_0x2ca1ce,null));};exports[_0x4f02('0x4b')]=function(_0x3b52ee,_0x1dff8f){return db[_0x4f02('0x1f')][_0x4f02('0x39')]({'where':{'id':_0x3b52ee[_0x4f02('0x28')]['id']}})[_0x4f02('0x18')](handleEntityNotFound(_0x1dff8f,null))[_0x4f02('0x18')](function(_0x51d2e4){if(_0x51d2e4){return _0x51d2e4[_0x4f02('0x4c')](_0x3b52ee['body'][_0x4f02('0x3a')],_[_0x4f02('0x4d')](_0x3b52ee[_0x4f02('0x35')],['ids','id'])||{})[_0x4f02('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0x4f02('0x1c'),_0x4f02('0x4f')],'where':{'id':_0x3b52ee['body']['ids']}});})[_0x4f02('0x18')](function(_0x27c617){socket[_0x4f02('0x50')](_0x4f02('0x51'),{'id':Number(_0x3b52ee[_0x4f02('0x28')]['id']),'tags':_0x27c617||[]});return{'id':Number(_0x3b52ee['params']['id']),'tags':_0x27c617||[]};});}})[_0x4f02('0x18')](respondWithResult(_0x1dff8f,null))[_0x4f02('0x26')](handleError(_0x1dff8f,null));};exports[_0x4f02('0x52')]=function(_0x565424,_0x16acc8){return db[_0x4f02('0x1f')][_0x4f02('0x39')]({'where':{'id':_0x565424[_0x4f02('0x28')]['id']}})['then'](handleEntityNotFound(_0x16acc8,null))[_0x4f02('0x18')](function(_0x1593b3){if(_0x1593b3){return _0x1593b3[_0x4f02('0x52')](_0x565424[_0x4f02('0x2b')][_0x4f02('0x3a')]);}})[_0x4f02('0x18')](respondWithStatusCode(_0x16acc8,null))[_0x4f02('0x26')](handleError(_0x16acc8,null));};exports[_0x4f02('0x53')]=function(_0x32e848,_0x18f385){var _0x5f46ea=moment()['unix']()[_0x4f02('0x54')]();var _0x1a29d7=path[_0x4f02('0x55')](config['root'],_0x4f02('0x56'),_0x4f02('0x57'),_0x4f02('0x58'));var _0x4269ac=path[_0x4f02('0x55')](config[_0x4f02('0x59')],_0x4f02('0x56'),_0x4f02('0x57'),_0x4f02('0x5a'));var _0x247618=path[_0x4f02('0x55')](_0x1a29d7,_0x5f46ea);var _0x1d823b=util[_0x4f02('0x48')](_0x4f02('0x5b'),_0x32e848[_0x4f02('0x28')]['id'],_0x5f46ea);var _0x4c4be3=path[_0x4f02('0x55')](_0x1a29d7,_0x1d823b);var _0x119a49=[];_0x119a49[_0x4f02('0x5c')]({'model':db[_0x4f02('0x5d')],'as':_0x4f02('0x5d'),'raw':!![]});var _0x2f5778=[{'model':db[_0x4f02('0x38')],'as':_0x4f02('0x5e'),'attributes':['id',_0x4f02('0x35'),_0x4f02('0x5f')],'include':_0x119a49}];return db[_0x4f02('0x1f')][_0x4f02('0x39')]({'where':{'id':_0x32e848[_0x4f02('0x28')]['id']},'include':_0x2f5778})[_0x4f02('0x18')](handleEntityNotFound(_0x18f385,null))[_0x4f02('0x18')](function(_0x192c8b){if(_0x192c8b&&_0x192c8b[_0x4f02('0x5e')]){var _0x5da2b5=_0x192c8b[_0x4f02('0x60')]({'plain':!![]});fs[_0x4f02('0x61')](_0x247618);for(var _0x522b07=0x0;_0x522b07<_0x5da2b5['Messages'][_0x4f02('0x3e')];_0x522b07++){var _0x4f0d83=_0x5da2b5[_0x4f02('0x5e')][_0x522b07][_0x4f02('0x5d')];if(_0x4f0d83){var _0x53c636=path[_0x4f02('0x55')](_0x4269ac,_0x4f0d83['basename']);if(fs['existsSync'](_0x53c636)){fs[_0x4f02('0x62')](_0x53c636)[_0x4f02('0x63')](fs[_0x4f02('0x64')](path[_0x4f02('0x55')](_0x247618,_0x4f0d83[_0x4f02('0x65')])));}}}return BPromise[_0x4f02('0x66')]()[_0x4f02('0x18')](function(){return new BPromise(function(_0x4c5477,_0x3567ee){zipdir(_0x247618,{'saveTo':_0x4c4be3},function(_0x311b4b,_0xe983c8){if(_0x311b4b)return _0x3567ee(_0x311b4b);return _0x4c5477(_0xe983c8);});})[_0x4f02('0x18')](function(){return new BPromise(function(_0x477dcf,_0x3f9861){rimraf(_0x247618,function(_0x410b5b){if(_0x410b5b)_0x3f9861(_0x410b5b);return _0x477dcf();});});})[_0x4f02('0x18')](function(){return _0x18f385[_0x4f02('0x53')](_0x4c4be3,_0x1d823b,function(_0x5511e5){if(_0x5511e5){console['log'](_0x4f02('0x67'),_0x5511e5);}else{fs['unlinkSync'](_0x4c4be3);}});});});}else{return _0x18f385[_0x4f02('0x11')](0xc8);}})[_0x4f02('0x26')](handleError(_0x18f385,null));}; \ No newline at end of file +var _0x1d87=['pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','root','join','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','unlinkSync','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','destroy','end','error','stack','name','send','index','map','FaxInteraction','getOptions','findAll','fax','query','user','then','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','filters','hasOwnProperty','order','sort','where'];(function(_0x1408b4,_0x22e866){var _0x39276b=function(_0x5d7918){while(--_0x5d7918){_0x1408b4['push'](_0x1408b4['shift']());}};_0x39276b(++_0x22e866);}(_0x1d87,0x155));var _0x71d8=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x1d87[_0x158a58];return _0x4935d9;};'use strict';var rimraf=require(_0x71d8('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x71d8('0x1'));var util=require(_0x71d8('0x2'));var path=require(_0x71d8('0x3'));var fs=require('fs');var _=require(_0x71d8('0x4'));var Redis=require(_0x71d8('0x5'));var interaction=require(_0x71d8('0x6'));var qs=require(_0x71d8('0x7'));var logger=require(_0x71d8('0x8'))(_0x71d8('0x9'));var config=require(_0x71d8('0xa'));var db=require(_0x71d8('0xb'))['db'];config[_0x71d8('0xc')]=_['defaults'](config['redis'],{'host':_0x71d8('0xd'),'port':0x18eb});var socket=require(_0x71d8('0xe'))(new Redis(config[_0x71d8('0xc')]));require(_0x71d8('0xf'))['register'](socket);function respondWithStatusCode(_0x1e6477,_0x361f02){_0x361f02=_0x361f02||0xcc;return function(_0x31001e){if(_0x31001e){return _0x1e6477[_0x71d8('0x10')](_0x361f02);}return _0x1e6477[_0x71d8('0x11')](_0x361f02)['end']();};}function respondWithResult(_0x82ca91,_0x3ea079){_0x3ea079=_0x3ea079||0xc8;return function(_0x385b70){if(_0x385b70){return _0x82ca91[_0x71d8('0x11')](_0x3ea079)[_0x71d8('0x12')](_0x385b70);}};}function respondWithFilteredResult(_0x4fcf74,_0x4b960d){return function(_0x39c420){if(_0x39c420){var _0x417667=typeof _0x4b960d['offset']==='undefined'&&typeof _0x4b960d['limit']==='undefined';var _0x51dc58=_0x39c420[_0x71d8('0x13')];var _0x53119d=_0x417667?0x0:_0x4b960d['offset'];var _0x1b43c1=_0x417667?_0x39c420[_0x71d8('0x13')]:_0x4b960d[_0x71d8('0x14')]+_0x4b960d[_0x71d8('0x15')];var _0x492e94;if(_0x1b43c1>=_0x51dc58){_0x1b43c1=_0x51dc58;_0x492e94=0xc8;}else{_0x492e94=0xce;}_0x4fcf74[_0x71d8('0x11')](_0x492e94);return _0x4fcf74[_0x71d8('0x16')](_0x71d8('0x17'),_0x53119d+'-'+_0x1b43c1+'/'+_0x51dc58)[_0x71d8('0x12')](_0x39c420);}return null;};}function saveUpdates(_0x16a6e9){return function(_0x395eb4){if(_0x395eb4){return _0x395eb4['update'](_0x16a6e9)['then'](function(_0x2c0b4f){return _0x2c0b4f;});}return null;};}function removeEntity(_0x55f754){return function(_0x53877f){if(_0x53877f){return _0x53877f[_0x71d8('0x18')]()['then'](function(){_0x55f754[_0x71d8('0x11')](0xcc)[_0x71d8('0x19')]();});}};}function handleEntityNotFound(_0x571c05){return function(_0x2dc8c8){if(!_0x2dc8c8){_0x571c05[_0x71d8('0x10')](0x194);}return _0x2dc8c8;};}function handleError(_0x225586,_0x58729e){_0x58729e=_0x58729e||0x1f4;return function(_0x583723){logger[_0x71d8('0x1a')](_0x583723[_0x71d8('0x1b')]);if(_0x583723[_0x71d8('0x1c')]){delete _0x583723[_0x71d8('0x1c')];}_0x225586['status'](_0x58729e)[_0x71d8('0x1d')](_0x583723);};}exports[_0x71d8('0x1e')]=function(_0x5c190a,_0x4ee2bd){var _0x473bb6={};var _0x215b46=_[_0x71d8('0x1f')](db[_0x71d8('0x20')]['rawAttributes'],function(_0x19d13a){return{'name':_0x19d13a['fieldName'],'type':_0x19d13a['type']['key']};});_0x473bb6=qs[_0x71d8('0x21')](_0x215b46,_0x5c190a);return interaction[_0x71d8('0x22')](_0x71d8('0x23'),_0x5c190a[_0x71d8('0x24')],_0x5c190a[_0x71d8('0x25')],_0x473bb6,_0x215b46)[_0x71d8('0x26')](respondWithFilteredResult(_0x4ee2bd,_0x473bb6))['catch'](handleError(_0x4ee2bd,null));};exports['show']=function(_0x2208b4,_0x5c5e5d){var _0x1beb49={'raw':![],'where':{'id':_0x2208b4[_0x71d8('0x27')]['id']}},_0x36a425={};_0x36a425[_0x71d8('0x28')]=_[_0x71d8('0x29')](db[_0x71d8('0x20')][_0x71d8('0x2a')]);_0x36a425[_0x71d8('0x24')]=_['keys'](_0x2208b4['query']);_0x36a425['filters']=_[_0x71d8('0x2b')](_0x36a425[_0x71d8('0x28')],_0x36a425[_0x71d8('0x24')]);_0x1beb49[_0x71d8('0x2c')]=_[_0x71d8('0x2b')](_0x36a425[_0x71d8('0x28')],qs['fields'](_0x2208b4[_0x71d8('0x24')][_0x71d8('0x2d')]));_0x1beb49[_0x71d8('0x2c')]=_0x1beb49['attributes'][_0x71d8('0x2e')]?_0x1beb49[_0x71d8('0x2c')]:_0x36a425['model'];if(_0x2208b4[_0x71d8('0x24')][_0x71d8('0x2f')]){_0x1beb49[_0x71d8('0x30')]=[{'all':!![]}];}_0x1beb49=_[_0x71d8('0x31')]({},_0x1beb49,_0x2208b4[_0x71d8('0x32')]);return db[_0x71d8('0x20')][_0x71d8('0x33')](_0x1beb49)['then'](handleEntityNotFound(_0x5c5e5d,null))['then'](respondWithResult(_0x5c5e5d,null))['catch'](handleError(_0x5c5e5d,null));};exports[_0x71d8('0x34')]=function(_0x19ed56,_0x6bc626){return db['FaxInteraction']['create'](_0x19ed56[_0x71d8('0x35')],{})[_0x71d8('0x26')](respondWithResult(_0x6bc626,0xc9))[_0x71d8('0x36')](handleError(_0x6bc626,null));};exports['update']=function(_0x339eca,_0x3dee97){if(_0x339eca[_0x71d8('0x35')]['id']){delete _0x339eca[_0x71d8('0x35')]['id'];}return db[_0x71d8('0x20')]['find']({'where':{'id':_0x339eca[_0x71d8('0x27')]['id']}})[_0x71d8('0x26')](handleEntityNotFound(_0x3dee97,null))[_0x71d8('0x26')](saveUpdates(_0x339eca[_0x71d8('0x35')],null))[_0x71d8('0x26')](respondWithResult(_0x3dee97,null))[_0x71d8('0x36')](handleError(_0x3dee97,null));};exports[_0x71d8('0x18')]=function(_0x49d9be,_0x8d59ee){return db[_0x71d8('0x20')][_0x71d8('0x33')]({'where':{'id':_0x49d9be[_0x71d8('0x27')]['id']}})['then'](handleEntityNotFound(_0x8d59ee,null))[_0x71d8('0x26')](removeEntity(_0x8d59ee,null))[_0x71d8('0x36')](handleError(_0x8d59ee,null));};exports[_0x71d8('0x37')]=function(_0x754311,_0x5e6658){return db[_0x71d8('0x20')][_0x71d8('0x37')]()[_0x71d8('0x26')](respondWithResult(_0x5e6658,null))[_0x71d8('0x36')](handleError(_0x5e6658,null));};exports[_0x71d8('0x38')]=function(_0x5c98f6,_0x4a7295){return db['FaxMessage']['find']({'where':{'id':_0x5c98f6[_0x71d8('0x27')]['id']}})[_0x71d8('0x26')](handleEntityNotFound(_0x4a7295,null))[_0x71d8('0x26')](function(_0x1c1347){if(_0x1c1347){return _0x1c1347[_0x71d8('0x38')](_0x5c98f6[_0x71d8('0x35')][_0x71d8('0x39')],_[_0x71d8('0x3a')](_0x5c98f6['body'],[_0x71d8('0x39'),'id'])||{});}})['then'](respondWithResult(_0x4a7295,null))[_0x71d8('0x36')](handleError(_0x4a7295,null));};exports[_0x71d8('0x3b')]=function(_0x570731,_0x57a163){var _0x5ab178={'raw':![],'where':{}};var _0x231048={};var _0x3d5f5a={'count':0x0,'rows':[]};return db[_0x71d8('0x20')][_0x71d8('0x3c')]({'where':{'id':_0x570731[_0x71d8('0x27')]['id']}})['then'](handleEntityNotFound(_0x57a163,null))[_0x71d8('0x26')](function(_0x5bd8ea){if(_0x5bd8ea){_0x231048[_0x71d8('0x28')]=_[_0x71d8('0x29')](db[_0x71d8('0x3d')]['rawAttributes']);_0x231048[_0x71d8('0x24')]=_['keys'](_0x570731['query']);_0x231048[_0x71d8('0x3e')]=_['intersection'](_0x231048[_0x71d8('0x28')],_0x231048[_0x71d8('0x24')]);_0x5ab178[_0x71d8('0x2c')]=_[_0x71d8('0x2b')](_0x231048[_0x71d8('0x28')],qs['fields'](_0x570731[_0x71d8('0x24')][_0x71d8('0x2d')]));_0x5ab178[_0x71d8('0x2c')]=_0x5ab178[_0x71d8('0x2c')][_0x71d8('0x2e')]?_0x5ab178[_0x71d8('0x2c')]:_0x231048[_0x71d8('0x28')];if(!_0x570731[_0x71d8('0x24')][_0x71d8('0x3f')]('nolimit')){_0x5ab178[_0x71d8('0x15')]=qs[_0x71d8('0x15')](_0x570731[_0x71d8('0x24')][_0x71d8('0x15')]);_0x5ab178['offset']=qs['offset'](_0x570731['query'][_0x71d8('0x14')]);}_0x5ab178[_0x71d8('0x40')]=qs[_0x71d8('0x41')](_0x570731[_0x71d8('0x24')][_0x71d8('0x41')]);_0x5ab178[_0x71d8('0x42')]=qs[_0x71d8('0x3e')](_[_0x71d8('0x43')](_0x570731[_0x71d8('0x24')],_0x231048[_0x71d8('0x3e')]));_0x5ab178[_0x71d8('0x42')][_0x71d8('0x44')]=_0x5bd8ea['id'];if(_0x570731[_0x71d8('0x24')][_0x71d8('0x45')]){_0x5ab178[_0x71d8('0x42')]=_[_0x71d8('0x31')](_0x5ab178['where'],{'$or':_[_0x71d8('0x1f')](_0x5ab178[_0x71d8('0x2c')],function(_0x2b6e4b){var _0xb4ee78={};_0xb4ee78[_0x2b6e4b]={'$like':'%'+_0x570731[_0x71d8('0x24')][_0x71d8('0x45')]+'%'};return _0xb4ee78;})});}if(_0x570731[_0x71d8('0x24')][_0x71d8('0x46')]){var _0x23b4e1=_0x570731[_0x71d8('0x24')][_0x71d8('0x46')][_0x71d8('0x47')](',');var _0x25f20c={};_0x25f20c[_0x23b4e1[0x0]]={'$gte':moment(_0x23b4e1[0x1])[_0x71d8('0x48')](_0x71d8('0x49'))};_0x5ab178[_0x71d8('0x42')]=_['merge'](_0x5ab178[_0x71d8('0x42')],_0x25f20c);}_0x5ab178=_[_0x71d8('0x31')]({},_0x5ab178,_0x570731[_0x71d8('0x32')]);return db[_0x71d8('0x3d')][_0x71d8('0x13')]({'where':_0x5ab178['where']})[_0x71d8('0x26')](function(_0x42e141){_0x3d5f5a['count']=_0x42e141;if(_0x570731[_0x71d8('0x24')][_0x71d8('0x2f')]){_0x5ab178['include']=[{'all':!![]}];}return db['FaxMessage'][_0x71d8('0x22')](_0x5ab178);})[_0x71d8('0x26')](function(_0x36ac49){_0x3d5f5a[_0x71d8('0x4a')]=_0x36ac49;return _0x3d5f5a;});}})[_0x71d8('0x26')](respondWithFilteredResult(_0x57a163,_0x5ab178))[_0x71d8('0x36')](handleError(_0x57a163,null));};exports[_0x71d8('0x4b')]=function(_0x22f939,_0x5cbf1c){return db[_0x71d8('0x20')][_0x71d8('0x33')]({'where':{'id':_0x22f939['params']['id']}})[_0x71d8('0x26')](handleEntityNotFound(_0x5cbf1c,null))[_0x71d8('0x26')](function(_0x1f3429){if(_0x1f3429){return _0x1f3429[_0x71d8('0x4c')](_0x22f939['body'][_0x71d8('0x39')],_[_0x71d8('0x3a')](_0x22f939['body'],[_0x71d8('0x39'),'id'])||{})[_0x71d8('0x4d')](function(){return db[_0x71d8('0x4e')][_0x71d8('0x22')]({'attributes':['id',_0x71d8('0x1c'),_0x71d8('0x4f')],'where':{'id':_0x22f939[_0x71d8('0x35')][_0x71d8('0x39')]}});})['then'](function(_0x5ac19c){socket['emit'](_0x71d8('0x50'),{'id':Number(_0x22f939[_0x71d8('0x27')]['id']),'tags':_0x5ac19c||[]});return{'id':Number(_0x22f939[_0x71d8('0x27')]['id']),'tags':_0x5ac19c||[]};});}})[_0x71d8('0x26')](respondWithResult(_0x5cbf1c,null))[_0x71d8('0x36')](handleError(_0x5cbf1c,null));};exports[_0x71d8('0x51')]=function(_0x468fa8,_0x2a930d){return db['FaxInteraction']['find']({'where':{'id':_0x468fa8[_0x71d8('0x27')]['id']}})[_0x71d8('0x26')](handleEntityNotFound(_0x2a930d,null))['then'](function(_0x352c02){if(_0x352c02){return _0x352c02[_0x71d8('0x51')](_0x468fa8[_0x71d8('0x24')][_0x71d8('0x39')]);}})[_0x71d8('0x26')](respondWithStatusCode(_0x2a930d,null))['catch'](handleError(_0x2a930d,null));};exports[_0x71d8('0x52')]=function(_0x17ae5e,_0x30aafa){var _0x2347f7=moment()[_0x71d8('0x53')]()[_0x71d8('0x54')]();var _0x94a2bb=path['join'](config[_0x71d8('0x55')],'server','files','tmp');var _0x1d9833=path[_0x71d8('0x56')](config[_0x71d8('0x55')],_0x71d8('0x57'),_0x71d8('0x58'),_0x71d8('0x59'));var _0x510780=path[_0x71d8('0x56')](_0x94a2bb,_0x2347f7);var _0x129193=util[_0x71d8('0x48')](_0x71d8('0x5a'),_0x17ae5e[_0x71d8('0x27')]['id'],_0x2347f7);var _0x23d30a=path[_0x71d8('0x56')](_0x94a2bb,_0x129193);var _0x2f6be7=[];_0x2f6be7['push']({'model':db[_0x71d8('0x5b')],'as':_0x71d8('0x5b'),'raw':!![]});var _0x21e636=[{'model':db['FaxMessage'],'as':_0x71d8('0x5c'),'attributes':['id',_0x71d8('0x35'),'createdAt'],'include':_0x2f6be7}];return db[_0x71d8('0x20')][_0x71d8('0x33')]({'where':{'id':_0x17ae5e[_0x71d8('0x27')]['id']},'include':_0x21e636})[_0x71d8('0x26')](handleEntityNotFound(_0x30aafa,null))[_0x71d8('0x26')](function(_0x4b6d99){if(_0x4b6d99&&_0x4b6d99['Messages']){var _0x3d9d64=_0x4b6d99[_0x71d8('0x5d')]({'plain':!![]});fs[_0x71d8('0x5e')](_0x510780);for(var _0x1509ac=0x0;_0x1509ac<_0x3d9d64[_0x71d8('0x5c')][_0x71d8('0x2e')];_0x1509ac++){var _0x2d9dd9=_0x3d9d64['Messages'][_0x1509ac][_0x71d8('0x5b')];if(_0x2d9dd9){var _0x25dda3=path[_0x71d8('0x56')](_0x1d9833,_0x2d9dd9[_0x71d8('0x5f')]);if(fs[_0x71d8('0x60')](_0x25dda3)){fs['createReadStream'](_0x25dda3)[_0x71d8('0x61')](fs[_0x71d8('0x62')](path['join'](_0x510780,_0x2d9dd9['basename'])));}}}return BPromise[_0x71d8('0x63')]()['then'](function(){return new BPromise(function(_0x43915c,_0x131887){zipdir(_0x510780,{'saveTo':_0x23d30a},function(_0x2623b1,_0x2e2d67){if(_0x2623b1)return _0x131887(_0x2623b1);return _0x43915c(_0x2e2d67);});})[_0x71d8('0x26')](function(){return new BPromise(function(_0x557440,_0x3d9435){rimraf(_0x510780,function(_0x362981){if(_0x362981)_0x3d9435(_0x362981);return _0x557440();});});})['then'](function(){return _0x30aafa[_0x71d8('0x52')](_0x23d30a,_0x129193,function(_0x1b2f78){if(_0x1b2f78){console[_0x71d8('0x64')]('err',_0x1b2f78);}else{fs[_0x71d8('0x65')](_0x23d30a);}});});});}else{return _0x30aafa[_0x71d8('0x10')](0xc8);}})[_0x71d8('0x36')](handleError(_0x30aafa,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3c8f361..7888568 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 _0xff83=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0xff83,0x167));var _0x3ff8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xff83[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x3ff8('0x0'));var FaxInteraction=require(_0x3ff8('0x1'))['db'][_0x3ff8('0x2')];var FaxMessage=require(_0x3ff8('0x1'))['db'][_0x3ff8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3ff8('0x4')](0x0);var events={'afterCreate':_0x3ff8('0x5'),'afterUpdate':_0x3ff8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x23a5ca){return function(_0x247bfb,_0x206ad6,_0x27a2d1){_0x247bfb[_0x3ff8('0x7')]({'attributes':['id'],'raw':!![]})[_0x3ff8('0x8')](function(_0x526daf){_0x247bfb[_0x3ff8('0x9')](_0x3ff8('0xa'),_0x526daf[_0x3ff8('0xb')](function(_0x5e6afb){return{'id':_0x5e6afb['id']};}));return FaxMessage[_0x3ff8('0xc')]({'where':{'FaxInteractionId':_0x247bfb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3ff8('0x8')](function(_0x52ac7c){_0x247bfb[_0x3ff8('0x9')](_0x3ff8('0xd'),_0x52ac7c[_0x3ff8('0xe')]);FaxInteractionEvents[_0x3ff8('0xf')](_0x23a5ca+':'+_0x247bfb['id'],_0x247bfb);FaxInteractionEvents['emit'](_0x23a5ca,_0x247bfb);_0x27a2d1(null);})[_0x3ff8('0x10')](_0x27a2d1(null));};}for(var e in events){if(events[_0x3ff8('0x11')](e)){var event=events[e];FaxInteraction[_0x3ff8('0x12')](e,emitEvent(event));}}module[_0x3ff8('0x13')]=FaxInteractionEvents; \ No newline at end of file +var _0x5bd6=['save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x286f7e,_0x773619){var _0x3400a4=function(_0x53a790){while(--_0x53a790){_0x286f7e['push'](_0x286f7e['shift']());}};_0x3400a4(++_0x773619);}(_0x5bd6,0xfc));var _0x65bd=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x5bd6[_0x1ac120];return _0x19b703;};'use strict';var EventEmitter=require(_0x65bd('0x0'));var FaxInteraction=require(_0x65bd('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x65bd('0x1'))['db'][_0x65bd('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x65bd('0x3')](0x0);var events={'afterCreate':_0x65bd('0x4'),'afterUpdate':'update','afterDestroy':_0x65bd('0x5')};function emitEvent(_0x1970b2){return function(_0x3c265b,_0x22fb45,_0x34306a){_0x3c265b[_0x65bd('0x6')]({'attributes':['id'],'raw':!![]})[_0x65bd('0x7')](function(_0x5b4c0b){_0x3c265b[_0x65bd('0x8')](_0x65bd('0x9'),_0x5b4c0b['map'](function(_0x5c1afb){return{'id':_0x5c1afb['id']};}));return FaxMessage[_0x65bd('0xa')]({'where':{'FaxInteractionId':_0x3c265b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x65bd('0x7')](function(_0x88b5a0){_0x3c265b['setDataValue'](_0x65bd('0xb'),_0x88b5a0[_0x65bd('0xc')]);FaxInteractionEvents[_0x65bd('0xd')](_0x1970b2+':'+_0x3c265b['id'],_0x3c265b);FaxInteractionEvents[_0x65bd('0xd')](_0x1970b2,_0x3c265b);_0x34306a(null);})[_0x65bd('0xe')](_0x34306a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x65bd('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 ba234d4..40f49da 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 _0xfa81=['define','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x2e0cee,_0x501154){var _0x30ea4c=function(_0xf9a545){while(--_0xf9a545){_0x2e0cee['push'](_0x2e0cee['shift']());}};_0x30ea4c(++_0x501154);}(_0xfa81,0x1d6));var _0x1fa8=function(_0x54682f,_0x1a9e20){_0x54682f=_0x54682f-0x0;var _0x2bd048=_0xfa81[_0x54682f];return _0x2bd048;};'use strict';var _=require(_0x1fa8('0x0'));var util=require(_0x1fa8('0x1'));var logger=require(_0x1fa8('0x2'))('api');var moment=require(_0x1fa8('0x3'));var BPromise=require(_0x1fa8('0x4'));var rp=require(_0x1fa8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fa8('0x6'));var config=require(_0x1fa8('0x7'));var attributes=require(_0x1fa8('0x8'));module[_0x1fa8('0x9')]=function(_0x442f45,_0x384358){return _0x442f45[_0x1fa8('0xa')](_0x1fa8('0xb'),attributes,{'tableName':_0x1fa8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f8cd1,_0x1366a6,_0x2c2608){if(_0x1f8cd1[_0x1fa8('0xd')]('closed')){_0x1f8cd1[_0x1fa8('0xe')]=moment()['format'](_0x1fa8('0xf'));}_0x2c2608(null,_0x1f8cd1);}}});}; \ No newline at end of file +var _0xf5dd=['rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x24fdc7,_0x13b25d){var _0x321a1f=function(_0x5b1571){while(--_0x5b1571){_0x24fdc7['push'](_0x24fdc7['shift']());}};_0x321a1f(++_0x13b25d);}(_0xf5dd,0x1ad));var _0xdf5d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf5dd[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var logger=require(_0xdf5d('0x2'))(_0xdf5d('0x3'));var moment=require(_0xdf5d('0x4'));var BPromise=require(_0xdf5d('0x5'));var rp=require(_0xdf5d('0x6'));var fs=require('fs');var path=require(_0xdf5d('0x7'));var rimraf=require(_0xdf5d('0x8'));var config=require(_0xdf5d('0x9'));var attributes=require(_0xdf5d('0xa'));module['exports']=function(_0x915558,_0x3731a9){return _0x915558[_0xdf5d('0xb')](_0xdf5d('0xc'),attributes,{'tableName':_0xdf5d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1cb65a,_0x390ed9,_0x3053c7){if(_0x1cb65a[_0xdf5d('0xe')](_0xdf5d('0xf'))){_0x1cb65a[_0xdf5d('0x10')]=moment()[_0xdf5d('0x11')](_0xdf5d('0x12'));}_0x3053c7(null,_0x1cb65a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e26d356..7e00264 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 _0xfa1e=['result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','omit','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x759a16,_0x1ca7a2){var _0x4dc897=function(_0x4f0b3b){while(--_0x4f0b3b){_0x759a16['push'](_0x759a16['shift']());}};_0x4dc897(++_0x1ca7a2);}(_0xfa1e,0x165));var _0xefa1=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xfa1e[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0xefa1('0x0'));var util=require('util');var moment=require(_0xefa1('0x1'));var BPromise=require(_0xefa1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefa1('0x3'))['db'];var utils=require(_0xefa1('0x4'));var logger=require(_0xefa1('0x5'))(_0xefa1('0x6'));var config=require('../../config/environment');var jayson=require(_0xefa1('0x7'));var client=jayson[_0xefa1('0x8')]['http']({'port':0x232a});config[_0xefa1('0x9')]=_[_0xefa1('0xa')](config[_0xefa1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xefa1('0xb'))(new Redis(config[_0xefa1('0x9')]));require(_0xefa1('0xc'))[_0xefa1('0xd')](socket);function respondWithRpcPromise(_0x2599d7,_0x4f910d,_0x343ba8){return new BPromise(function(_0x24eb91,_0x837115){return client['request'](_0x2599d7,_0x343ba8)[_0xefa1('0xe')](function(_0x1aff4f){logger[_0xefa1('0xf')](_0xefa1('0x10'),_0x4f910d,_0xefa1('0x11'));logger[_0xefa1('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4f910d,_0xefa1('0x11'),JSON[_0xefa1('0x13')](_0x1aff4f));if(_0x1aff4f['error']){if(_0x1aff4f[_0xefa1('0x14')][_0xefa1('0x15')]===0x1f4){logger[_0xefa1('0x14')](_0xefa1('0x10'),_0x4f910d,_0x1aff4f[_0xefa1('0x14')]['message']);return _0x837115(_0x1aff4f[_0xefa1('0x14')]['message']);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4f910d,_0x1aff4f[_0xefa1('0x14')][_0xefa1('0x16')]);return _0x24eb91(_0x1aff4f[_0xefa1('0x14')][_0xefa1('0x16')]);}else{logger['info'](_0xefa1('0x10'),_0x4f910d,_0xefa1('0x11'));_0x24eb91(_0x1aff4f[_0xefa1('0x17')][_0xefa1('0x16')]);}})[_0xefa1('0x18')](function(_0x183b2a){logger[_0xefa1('0x14')](_0xefa1('0x10'),_0x4f910d,_0x183b2a);_0x837115(_0x183b2a);});});}exports[_0xefa1('0x19')]=function(_0x28c02d){var _0x3cdf1d=this;return new Promise(function(_0x5beeea,_0x547277){return db[_0xefa1('0x1a')]['update'](_0x28c02d[_0xefa1('0x1b')],{'raw':_0x28c02d[_0xefa1('0x1c')]?_0x28c02d[_0xefa1('0x1c')][_0xefa1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28c02d[_0xefa1('0x1c')]?_0x28c02d[_0xefa1('0x1c')][_0xefa1('0x1e')]||null:null,'attributes':_0x28c02d[_0xefa1('0x1c')]?_0x28c02d[_0xefa1('0x1c')][_0xefa1('0x1f')]||null:null,'limit':_0x28c02d['options']?_0x28c02d[_0xefa1('0x1c')][_0xefa1('0x20')]||null:null})[_0xefa1('0xe')](function(_0x4c94ae){logger[_0xefa1('0xf')](_0xefa1('0x19'),_0x28c02d);logger[_0xefa1('0x12')]('UpdateFaxInteraction',_0x28c02d,JSON[_0xefa1('0x13')](_0x4c94ae));_0x5beeea(_0x4c94ae);})[_0xefa1('0x18')](function(_0x9eae1){logger['error'](_0xefa1('0x19'),_0x9eae1[_0xefa1('0x16')],_0x28c02d);_0x547277(_0x3cdf1d['error'](0x1f4,_0x9eae1[_0xefa1('0x16')]));});});};exports[_0xefa1('0x21')]=function(_0x485bef){return new Promise(function(_0xf30de1,_0x323025){return db[_0xefa1('0x1a')][_0xefa1('0x22')]({'where':_0x485bef[_0xefa1('0x1c')]?_0x485bef['options'][_0xefa1('0x1e')]||null:null})[_0xefa1('0xe')](function(_0x5c4a48){if(_0x5c4a48){return _0x5c4a48[_0xefa1('0x23')](_0x485bef[_0xefa1('0x1b')]['ids'],_[_0xefa1('0x24')](_0x485bef[_0xefa1('0x1b')],['ids','id'])||{});}})['spread'](function(_0x3e6e92){logger[_0xefa1('0xf')](_0xefa1('0x25'),_0x485bef);logger[_0xefa1('0x12')](_0xefa1('0x25'),_0x485bef,JSON['stringify'](_0x3e6e92));_0xf30de1(_0x3e6e92);})[_0xefa1('0x18')](function(_0x3d4be8){logger[_0xefa1('0x14')](_0xefa1('0x25'),_0x3d4be8[_0xefa1('0x16')],_0x485bef);_0x323025(_this[_0xefa1('0x14')](0x1f4,_0x3d4be8[_0xefa1('0x16')]));});});}; \ No newline at end of file +var _0xb06e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','AddTags','catch'];(function(_0x5e5089,_0x866793){var _0x19ac2c=function(_0x31ec3d){while(--_0x31ec3d){_0x5e5089['push'](_0x5e5089['shift']());}};_0x19ac2c(++_0x866793);}(_0xb06e,0xb0));var _0xeb06=function(_0x30417a,_0x38ff00){_0x30417a=_0x30417a-0x0;var _0x3e9bcd=_0xb06e[_0x30417a];return _0x3e9bcd;};'use strict';var _=require(_0xeb06('0x0'));var util=require(_0xeb06('0x1'));var moment=require(_0xeb06('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb06('0x3'));var fs=require('fs');var Redis=require(_0xeb06('0x4'));var db=require(_0xeb06('0x5'))['db'];var utils=require(_0xeb06('0x6'));var logger=require(_0xeb06('0x7'))(_0xeb06('0x8'));var config=require(_0xeb06('0x9'));var jayson=require(_0xeb06('0xa'));var client=jayson[_0xeb06('0xb')][_0xeb06('0xc')]({'port':0x232a});config[_0xeb06('0xd')]=_[_0xeb06('0xe')](config[_0xeb06('0xd')],{'host':_0xeb06('0xf'),'port':0x18eb});var socket=require(_0xeb06('0x10'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1e970e,_0x2cbd05,_0x2aa341){return new BPromise(function(_0x40d01a,_0x5e3de5){return client[_0xeb06('0x11')](_0x1e970e,_0x2aa341)[_0xeb06('0x12')](function(_0x4863ce){logger[_0xeb06('0x13')](_0xeb06('0x14'),_0x2cbd05,'request\x20sent');logger[_0xeb06('0x15')](_0xeb06('0x16'),_0x2cbd05,_0xeb06('0x17'),JSON[_0xeb06('0x18')](_0x4863ce));if(_0x4863ce[_0xeb06('0x19')]){if(_0x4863ce['error'][_0xeb06('0x1a')]===0x1f4){logger['error'](_0xeb06('0x14'),_0x2cbd05,_0x4863ce['error'][_0xeb06('0x1b')]);return _0x5e3de5(_0x4863ce['error']['message']);}logger[_0xeb06('0x19')](_0xeb06('0x14'),_0x2cbd05,_0x4863ce[_0xeb06('0x19')]['message']);return _0x40d01a(_0x4863ce[_0xeb06('0x19')][_0xeb06('0x1b')]);}else{logger[_0xeb06('0x13')](_0xeb06('0x14'),_0x2cbd05,_0xeb06('0x17'));_0x40d01a(_0x4863ce[_0xeb06('0x1c')][_0xeb06('0x1b')]);}})['catch'](function(_0x1f3531){logger[_0xeb06('0x19')](_0xeb06('0x14'),_0x2cbd05,_0x1f3531);_0x5e3de5(_0x1f3531);});});}exports['UpdateFaxInteraction']=function(_0x1e82ad){var _0x3d9a9e=this;return new Promise(function(_0x3b69ee,_0x18c201){return db[_0xeb06('0x1d')][_0xeb06('0x1e')](_0x1e82ad[_0xeb06('0x1f')],{'raw':_0x1e82ad[_0xeb06('0x20')]?_0x1e82ad['options'][_0xeb06('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e82ad[_0xeb06('0x20')]?_0x1e82ad[_0xeb06('0x20')][_0xeb06('0x22')]||null:null,'attributes':_0x1e82ad['options']?_0x1e82ad[_0xeb06('0x20')][_0xeb06('0x23')]||null:null,'limit':_0x1e82ad[_0xeb06('0x20')]?_0x1e82ad[_0xeb06('0x20')][_0xeb06('0x24')]||null:null})[_0xeb06('0x12')](function(_0x483ee5){logger[_0xeb06('0x13')](_0xeb06('0x25'),_0x1e82ad);logger[_0xeb06('0x15')](_0xeb06('0x25'),_0x1e82ad,JSON[_0xeb06('0x18')](_0x483ee5));_0x3b69ee(_0x483ee5);})['catch'](function(_0x2c0be4){logger['error'](_0xeb06('0x25'),_0x2c0be4[_0xeb06('0x1b')],_0x1e82ad);_0x18c201(_0x3d9a9e['error'](0x1f4,_0x2c0be4[_0xeb06('0x1b')]));});});};exports[_0xeb06('0x26')]=function(_0x1fd665){return new Promise(function(_0x56531f,_0x19a79a){return db[_0xeb06('0x1d')][_0xeb06('0x27')]({'where':_0x1fd665['options']?_0x1fd665['options'][_0xeb06('0x22')]||null:null})[_0xeb06('0x12')](function(_0x4d2471){if(_0x4d2471){return _0x4d2471[_0xeb06('0x28')](_0x1fd665[_0xeb06('0x1f')][_0xeb06('0x29')],_['omit'](_0x1fd665[_0xeb06('0x1f')],[_0xeb06('0x29'),'id'])||{});}})['spread'](function(_0x58512c){logger[_0xeb06('0x13')](_0xeb06('0x2a'),_0x1fd665);logger[_0xeb06('0x15')]('AddTags',_0x1fd665,JSON[_0xeb06('0x18')](_0x58512c));_0x56531f(_0x58512c);})[_0xeb06('0x2b')](function(_0xd0f14){logger[_0xeb06('0x19')](_0xeb06('0x2a'),_0xd0f14[_0xeb06('0x1b')],_0x1fd665);_0x19a79a(_this[_0xeb06('0x19')](0x1f4,_0xd0f14[_0xeb06('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b589bea..af8f3df 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 _0xaba8=['update','removeListener','length','faxInteraction:','./faxInteraction.events'];(function(_0x2d9660,_0x247c7e){var _0x52f92a=function(_0x1bc7d3){while(--_0x1bc7d3){_0x2d9660['push'](_0x2d9660['shift']());}};_0x52f92a(++_0x247c7e);}(_0xaba8,0x1c6));var _0x8aba=function(_0x4ed0e7,_0x5c3888){_0x4ed0e7=_0x4ed0e7-0x0;var _0x50b1cc=_0xaba8[_0x4ed0e7];return _0x50b1cc;};'use strict';var FaxInteractionEvents=require(_0x8aba('0x0'));var events=['save','remove',_0x8aba('0x1')];function createListener(_0x27fe9a,_0x51c6ca){return function(_0x424971){_0x51c6ca['emit'](_0x27fe9a,_0x424971);};}function removeListener(_0x1f60b6,_0x1a0ec3){return function(){FaxInteractionEvents[_0x8aba('0x2')](_0x1f60b6,_0x1a0ec3);};}exports['register']=function(_0x152549){for(var _0x2617e0=0x0,_0x22df95=events[_0x8aba('0x3')];_0x2617e0<_0x22df95;_0x2617e0++){var _0x1bdd39=events[_0x2617e0];var _0x574f57=createListener(_0x8aba('0x4')+_0x1bdd39,_0x152549);FaxInteractionEvents['on'](_0x1bdd39,_0x574f57);}}; \ No newline at end of file +var _0x3fcb=['removeListener','register','length','faxInteraction:','save','remove','update'];(function(_0x54931e,_0x1b0aba){var _0x507ae6=function(_0x79c653){while(--_0x79c653){_0x54931e['push'](_0x54931e['shift']());}};_0x507ae6(++_0x1b0aba);}(_0x3fcb,0xf2));var _0xb3fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3fcb[_0x5b644e];return _0x49c6bf;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xb3fc('0x0'),_0xb3fc('0x1'),_0xb3fc('0x2')];function createListener(_0x3a6d19,_0x31cfc2){return function(_0x5a900a){_0x31cfc2['emit'](_0x3a6d19,_0x5a900a);};}function removeListener(_0x1c3588,_0x593611){return function(){FaxInteractionEvents[_0xb3fc('0x3')](_0x1c3588,_0x593611);};}exports[_0xb3fc('0x4')]=function(_0x42d908){for(var _0x55005e=0x0,_0x560360=events[_0xb3fc('0x5')];_0x55005e<_0x560360;_0x55005e++){var _0x1f5a1e=events[_0x55005e];var _0x3d739d=createListener(_0xb3fc('0x6')+_0x1f5a1e,_0x42d908);FaxInteractionEvents['on'](_0x1f5a1e,_0x3d739d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3807a84..ca64e53 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 _0x5057=['show','/:id/messages','/:id/download','download','post','create','/:id/tags','fax','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0x5057,0x151));var _0x7505=function(_0x723cce,_0x1740f9){_0x723cce=_0x723cce-0x0;var _0x1b3c1f=_0x5057[_0x723cce];return _0x1b3c1f;};'use strict';var multer=require(_0x7505('0x0'));var util=require(_0x7505('0x1'));var path=require(_0x7505('0x2'));var timeout=require('connect-timeout');var express=require(_0x7505('0x3'));var router=express[_0x7505('0x4')]();var fs_extra=require(_0x7505('0x5'));var auth=require(_0x7505('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7505('0x7'));var controller=require(_0x7505('0x8'));router['get']('/',auth[_0x7505('0x9')](),controller[_0x7505('0xa')]);router[_0x7505('0xb')](_0x7505('0xc'),auth[_0x7505('0x9')](),controller[_0x7505('0xd')]);router['get'](_0x7505('0xe'),auth['isAuthenticated'](),controller[_0x7505('0xf')]);router[_0x7505('0xb')](_0x7505('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7505('0xb')](_0x7505('0x11'),auth[_0x7505('0x9')](),controller[_0x7505('0x12')]);router[_0x7505('0x13')]('/',auth['isAuthenticated'](),controller[_0x7505('0x14')]);router[_0x7505('0x13')]('/:id/messages',auth[_0x7505('0x9')](),controller['addMessage']);router[_0x7505('0x13')](_0x7505('0x15'),auth[_0x7505('0x9')](),interaction['tracked'](_0x7505('0x16'),'faxinteraction:addtags'),controller[_0x7505('0x17')]);router['put'](_0x7505('0xe'),auth['isAuthenticated'](),interaction[_0x7505('0x18')]('fax',_0x7505('0x19')),controller[_0x7505('0x1a')]);router[_0x7505('0x1b')](_0x7505('0xe'),auth[_0x7505('0x9')](),interaction['tracked'](_0x7505('0x16'),_0x7505('0x1c')),controller[_0x7505('0x1d')]);router[_0x7505('0x1b')](_0x7505('0x15'),auth[_0x7505('0x9')](),controller[_0x7505('0x1e')]);module[_0x7505('0x1f')]=router; \ No newline at end of file +var _0xd9e9=['faxinteraction:update','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','fax','addTags','put','/:id'];(function(_0x389c5b,_0x492498){var _0x45c1ba=function(_0x5c8e42){while(--_0x5c8e42){_0x389c5b['push'](_0x389c5b['shift']());}};_0x45c1ba(++_0x492498);}(_0xd9e9,0xba));var _0x9d9e=function(_0x54ede5,_0x3355c7){_0x54ede5=_0x54ede5-0x0;var _0x3ad08f=_0xd9e9[_0x54ede5];return _0x3ad08f;};'use strict';var multer=require(_0x9d9e('0x0'));var util=require(_0x9d9e('0x1'));var path=require(_0x9d9e('0x2'));var timeout=require(_0x9d9e('0x3'));var express=require(_0x9d9e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9d9e('0x5'));var config=require(_0x9d9e('0x6'));var controller=require(_0x9d9e('0x7'));router[_0x9d9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d9e('0x9')]);router[_0x9d9e('0x8')](_0x9d9e('0xa'),auth[_0x9d9e('0xb')](),controller[_0x9d9e('0xc')]);router[_0x9d9e('0x8')]('/:id',auth[_0x9d9e('0xb')](),controller[_0x9d9e('0xd')]);router[_0x9d9e('0x8')](_0x9d9e('0xe'),auth[_0x9d9e('0xb')](),controller[_0x9d9e('0xf')]);router[_0x9d9e('0x8')](_0x9d9e('0x10'),auth[_0x9d9e('0xb')](),controller['download']);router[_0x9d9e('0x11')]('/',auth[_0x9d9e('0xb')](),controller[_0x9d9e('0x12')]);router[_0x9d9e('0x11')](_0x9d9e('0xe'),auth[_0x9d9e('0xb')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x9d9e('0x13')](_0x9d9e('0x14'),'faxinteraction:addtags'),controller[_0x9d9e('0x15')]);router[_0x9d9e('0x16')](_0x9d9e('0x17'),auth[_0x9d9e('0xb')](),interaction[_0x9d9e('0x13')](_0x9d9e('0x14'),_0x9d9e('0x18')),controller['update']);router['delete']('/:id',auth[_0x9d9e('0xb')](),interaction[_0x9d9e('0x13')]('fax','faxinteraction:destroy'),controller[_0x9d9e('0x19')]);router[_0x9d9e('0x1a')](_0x9d9e('0x1b'),auth[_0x9d9e('0xb')](),controller[_0x9d9e('0x1c')]);module[_0x9d9e('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 dce2fd8..8cef4e7 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 _0x8db0=['exports','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x34d1fa,_0x58f584){var _0x14d54e=function(_0x391d07){while(--_0x391d07){_0x34d1fa['push'](_0x34d1fa['shift']());}};_0x14d54e(++_0x58f584);}(_0x8db0,0x65));var _0x08db=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x8db0[_0x2f6541];return _0x4d76d8;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'body':{'type':Sequelize['TEXT'](_0x08db('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x08db('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x08db('0x4')]('in','out'),'defaultValue':_0x08db('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xaa19=['out','DATE','sequelize','exports','TEXT','medium','ENUM'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaa19,0x79));var _0x9aa1=function(_0x3426b9,_0x5148d5){_0x3426b9=_0x3426b9-0x0;var _0x21330c=_0xaa19[_0x3426b9];return _0x21330c;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'body':{'type':Sequelize[_0x9aa1('0x2')](_0x9aa1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9aa1('0x4')]('in','out'),'defaultValue':_0x9aa1('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9aa1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c12b83e..4c325e9 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 _0x1992=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','sendStatus','stack','name','send','FaxMessage','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','describe','fax-interactions','accept','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','read1stAt','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','Sequelize','QueryTypes','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x13945b,_0x289c94){var _0x1b1643=function(_0x18f4c3){while(--_0x18f4c3){_0x13945b['push'](_0x13945b['shift']());}};_0x1b1643(++_0x289c94);}(_0x1992,0x84));var _0x2199=function(_0x24e469,_0x46a571){_0x24e469=_0x24e469-0x0;var _0x11590c=_0x1992[_0x24e469];return _0x11590c;};'use strict';var emlformat=require(_0x2199('0x0'));var rimraf=require(_0x2199('0x1'));var zipdir=require(_0x2199('0x2'));var jsonpatch=require(_0x2199('0x3'));var rp=require(_0x2199('0x4'));var moment=require(_0x2199('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2199('0x6'));var util=require(_0x2199('0x7'));var path=require(_0x2199('0x8'));var sox=require('sox');var csv=require(_0x2199('0x9'));var ejs=require(_0x2199('0xa'));var fs=require('fs');var fs_extra=require(_0x2199('0xb'));var _=require(_0x2199('0xc'));var squel=require('squel');var crypto=require(_0x2199('0xd'));var jsforce=require(_0x2199('0xe'));var deskjs=require(_0x2199('0xf'));var toCsv=require(_0x2199('0x9'));var querystring=require(_0x2199('0x10'));var Papa=require(_0x2199('0x11'));var Redis=require(_0x2199('0x12'));var authService=require(_0x2199('0x13'));var qs=require(_0x2199('0x14'));var as=require(_0x2199('0x15'));var hardwareService=require(_0x2199('0x16'));var logger=require(_0x2199('0x17'))(_0x2199('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2199('0x19')]=_[_0x2199('0x1a')](config[_0x2199('0x19')],{'host':_0x2199('0x1b'),'port':0x18eb});var socket=require(_0x2199('0x1c'))(new Redis(config[_0x2199('0x19')]));require('./faxMessage.socket')[_0x2199('0x1d')](socket);var jayson=require(_0x2199('0x1e'));var client=jayson[_0x2199('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2199('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x530bed,_0x611aa0,_0x8245cd,_0x50791b){return new BPromise(function(_0x1f182c,_0x2a7e32){var _0x12be76=_0x50791b||client;return _0x12be76[_0x2199('0x21')](_0x530bed,_0x8245cd)[_0x2199('0x22')](function(_0xa95d76){logger[_0x2199('0x23')](_0x2199('0x24'),_0x611aa0,_0x2199('0x25'));logger[_0x2199('0x26')](_0x2199('0x27'),_0x611aa0,_0x2199('0x25'),JSON[_0x2199('0x28')](_0xa95d76));if(_0xa95d76[_0x2199('0x29')]){if(_0xa95d76[_0x2199('0x29')][_0x2199('0x2a')]===0x1f4){logger[_0x2199('0x29')](_0x2199('0x24'),_0x611aa0,_0xa95d76[_0x2199('0x29')]['message']);return _0x2a7e32(_0xa95d76['error'][_0x2199('0x2b')]);}logger[_0x2199('0x29')]('FaxMessage,\x20%s,\x20%s',_0x611aa0,_0xa95d76[_0x2199('0x29')][_0x2199('0x2b')]);return _0x1f182c(_0xa95d76[_0x2199('0x29')]['message']);}else{logger[_0x2199('0x23')]('FaxMessage,\x20%s,\x20%s',_0x611aa0,_0x2199('0x25'));_0x1f182c(_0xa95d76[_0x2199('0x2c')][_0x2199('0x2b')]);}})[_0x2199('0x2d')](function(_0x1f88a8){logger[_0x2199('0x29')](_0x2199('0x24'),_0x611aa0,_0x1f88a8);_0x2a7e32(_0x1f88a8);});});}function respondWithStatusCode(_0x479987,_0x49da89){_0x49da89=_0x49da89||0xcc;return function(_0x4b7ca1){if(_0x4b7ca1){return _0x479987['sendStatus'](_0x49da89);}return _0x479987['status'](_0x49da89)[_0x2199('0x2e')]();};}function respondWithResult(_0x2fc9a5,_0x5ccbae){_0x5ccbae=_0x5ccbae||0xc8;return function(_0x2e4abf){if(_0x2e4abf){return _0x2fc9a5[_0x2199('0x2f')](_0x5ccbae)[_0x2199('0x30')](_0x2e4abf);}};}function respondWithFilteredResult(_0x19f730,_0x51560){return function(_0x1c1939){if(_0x1c1939){var _0x453f34=typeof _0x51560[_0x2199('0x31')]===_0x2199('0x32')&&typeof _0x51560['limit']==='undefined';var _0x468072=_0x1c1939[_0x2199('0x33')];var _0x348b67=_0x453f34?0x0:_0x51560[_0x2199('0x31')];var _0x499c68=_0x453f34?_0x1c1939['count']:_0x51560[_0x2199('0x31')]+_0x51560[_0x2199('0x34')];var _0x2e5c85;if(_0x499c68>=_0x468072){_0x499c68=_0x468072;_0x2e5c85=0xc8;}else{_0x2e5c85=0xce;}_0x19f730[_0x2199('0x2f')](_0x2e5c85);return _0x19f730[_0x2199('0x35')](_0x2199('0x36'),_0x348b67+'-'+_0x499c68+'/'+_0x468072)[_0x2199('0x30')](_0x1c1939);}return null;};}function patchUpdates(_0x30c227){return function(_0x2064f5){try{jsonpatch[_0x2199('0x37')](_0x2064f5,_0x30c227,!![]);}catch(_0xf3f6c3){return BPromise[_0x2199('0x38')](_0xf3f6c3);}return _0x2064f5['save']();};}function saveUpdates(_0x7c6837,_0x3951c3){return function(_0x5beb7f){if(_0x5beb7f){return _0x5beb7f[_0x2199('0x39')](_0x7c6837)[_0x2199('0x22')](function(_0x426126){return _0x426126;});}return null;};}function removeEntity(_0x5ceb36,_0x41b1aa){return function(_0x3dd368){if(_0x3dd368){return _0x3dd368['destroy']()[_0x2199('0x22')](function(){_0x5ceb36[_0x2199('0x2f')](0xcc)[_0x2199('0x2e')]();});}};}function handleEntityNotFound(_0x1be4cf,_0xdab02c){return function(_0x127f0f){if(!_0x127f0f){_0x1be4cf[_0x2199('0x3a')](0x194);}return _0x127f0f;};}function handleError(_0x108838,_0x657baa){_0x657baa=_0x657baa||0x1f4;return function(_0x153578){logger[_0x2199('0x29')](_0x153578[_0x2199('0x3b')]);if(_0x153578['name']){delete _0x153578[_0x2199('0x3c')];}_0x108838['status'](_0x657baa)[_0x2199('0x3d')](_0x153578);};}exports['index']=function(_0xeda9ef,_0x456cf2){var _0x521520={},_0x274a43={},_0x4f9b40={'count':0x0,'rows':[]};var _0x3ed620=_['map'](db[_0x2199('0x3e')]['rawAttributes'],function(_0x59cdf9){return{'name':_0x59cdf9[_0x2199('0x3f')],'type':_0x59cdf9[_0x2199('0x40')]['key']};});_0x274a43['model']=_['map'](_0x3ed620,_0x2199('0x3c'));_0x274a43[_0x2199('0x41')]=_[_0x2199('0x42')](_0xeda9ef[_0x2199('0x41')]);_0x274a43[_0x2199('0x43')]=_[_0x2199('0x44')](_0x274a43['model'],_0x274a43[_0x2199('0x41')]);_0x521520[_0x2199('0x45')]=_[_0x2199('0x44')](_0x274a43[_0x2199('0x46')],qs[_0x2199('0x47')](_0xeda9ef[_0x2199('0x41')][_0x2199('0x47')]));_0x521520['attributes']=_0x521520['attributes'][_0x2199('0x48')]?_0x521520[_0x2199('0x45')]:_0x274a43['model'];if(!_0xeda9ef[_0x2199('0x41')][_0x2199('0x49')](_0x2199('0x4a'))){_0x521520['limit']=qs[_0x2199('0x34')](_0xeda9ef[_0x2199('0x41')][_0x2199('0x34')]);_0x521520[_0x2199('0x31')]=qs['offset'](_0xeda9ef[_0x2199('0x41')][_0x2199('0x31')]);}_0x521520[_0x2199('0x4b')]=qs[_0x2199('0x4c')](_0xeda9ef['query']['sort']);_0x521520[_0x2199('0x4d')]=qs[_0x2199('0x43')](_[_0x2199('0x4e')](_0xeda9ef[_0x2199('0x41')],_0x274a43['filters']),_0x3ed620);if(_0xeda9ef[_0x2199('0x41')][_0x2199('0x4f')]){_0x521520[_0x2199('0x4d')]=_[_0x2199('0x50')](_0x521520['where'],{'$or':_[_0x2199('0x51')](_0x3ed620,function(_0x22732a){if(_0x22732a[_0x2199('0x40')]!==_0x2199('0x52')){var _0x1a4326={};_0x1a4326[_0x22732a['name']]={'$like':'%'+_0xeda9ef[_0x2199('0x41')][_0x2199('0x4f')]+'%'};return _0x1a4326;}})});}_0x521520=_[_0x2199('0x50')]({},_0x521520,_0xeda9ef[_0x2199('0x53')]);var _0x5479b7={'where':_0x521520['where']};return db[_0x2199('0x3e')][_0x2199('0x33')](_0x5479b7)[_0x2199('0x22')](function(_0x1d5b3c){_0x4f9b40[_0x2199('0x33')]=_0x1d5b3c;if(_0xeda9ef[_0x2199('0x41')][_0x2199('0x54')]){_0x521520[_0x2199('0x55')]=[{'all':!![]}];}return db[_0x2199('0x3e')]['findAll'](_0x521520);})[_0x2199('0x22')](function(_0x465da1){_0x4f9b40[_0x2199('0x56')]=_0x465da1;return _0x4f9b40;})[_0x2199('0x22')](respondWithFilteredResult(_0x456cf2,_0x521520))[_0x2199('0x2d')](handleError(_0x456cf2,null));};exports[_0x2199('0x57')]=function(_0x4f2100,_0xe73677){var _0x27c27a={'raw':!![],'where':{'id':_0x4f2100[_0x2199('0x58')]['id']}},_0x1bfb1b={};_0x1bfb1b[_0x2199('0x46')]=_[_0x2199('0x42')](db[_0x2199('0x3e')][_0x2199('0x59')]);_0x1bfb1b['query']=_[_0x2199('0x42')](_0x4f2100[_0x2199('0x41')]);_0x1bfb1b[_0x2199('0x43')]=_['intersection'](_0x1bfb1b['model'],_0x1bfb1b[_0x2199('0x41')]);_0x27c27a[_0x2199('0x45')]=_['intersection'](_0x1bfb1b[_0x2199('0x46')],qs[_0x2199('0x47')](_0x4f2100[_0x2199('0x41')][_0x2199('0x47')]));_0x27c27a[_0x2199('0x45')]=_0x27c27a[_0x2199('0x45')][_0x2199('0x48')]?_0x27c27a[_0x2199('0x45')]:_0x1bfb1b[_0x2199('0x46')];if(_0x4f2100[_0x2199('0x41')][_0x2199('0x54')]){_0x27c27a['include']=[{'all':!![]}];}_0x27c27a=_[_0x2199('0x50')]({},_0x27c27a,_0x4f2100[_0x2199('0x53')]);return db[_0x2199('0x3e')][_0x2199('0x5a')](_0x27c27a)[_0x2199('0x22')](handleEntityNotFound(_0xe73677,null))[_0x2199('0x22')](respondWithResult(_0xe73677,null))[_0x2199('0x2d')](handleError(_0xe73677,null));};exports[_0x2199('0x39')]=function(_0x21224d,_0x3f09e3){if(_0x21224d['body']['id']){delete _0x21224d['body']['id'];}return db[_0x2199('0x3e')][_0x2199('0x5a')]({'where':{'id':_0x21224d[_0x2199('0x58')]['id']}})[_0x2199('0x22')](handleEntityNotFound(_0x3f09e3,null))[_0x2199('0x22')](saveUpdates(_0x21224d['body'],null))[_0x2199('0x22')](respondWithResult(_0x3f09e3,null))[_0x2199('0x2d')](handleError(_0x3f09e3,null));};exports['destroy']=function(_0x4526c8,_0x47b2dd){return db['FaxMessage'][_0x2199('0x5a')]({'where':{'id':_0x4526c8[_0x2199('0x58')]['id']}})[_0x2199('0x22')](handleEntityNotFound(_0x47b2dd,null))['then'](removeEntity(_0x47b2dd,null))[_0x2199('0x2d')](handleError(_0x47b2dd,null));};exports[_0x2199('0x5b')]=function(_0x4f8ba6,_0x3e7f57){return db['FaxMessage']['describe']()[_0x2199('0x22')](respondWithResult(_0x3e7f57,null))[_0x2199('0x2d')](handleError(_0x3e7f57,null));};var interaction_log=require(_0x2199('0x17'))(_0x2199('0x5c'));exports[_0x2199('0x5d')]=function(_0x4c0c21,_0x47186a,_0x53af13){var _0x33f261={'agent':{},'channel':'fax'};if(_0x4c0c21['body']['id']){delete _0x4c0c21[_0x2199('0x5e')]['id'];}_0x4c0c21['body'][_0x2199('0x5f')]=!![];_0x4c0c21[_0x2199('0x5e')][_0x2199('0x60')]=moment()[_0x2199('0x61')](_0x2199('0x62'));_0x4c0c21[_0x2199('0x5e')][_0x2199('0x63')]=_0x4c0c21[_0x2199('0x5e')][_0x2199('0x63')]||_0x4c0c21[_0x2199('0x64')]['id'];_0x33f261[_0x2199('0x65')]['id']=_0x4c0c21[_0x2199('0x5e')][_0x2199('0x63')];return db['FaxMessage'][_0x2199('0x5a')]({'where':{'id':_0x4c0c21[_0x2199('0x58')]['id'],'UserId':null}})[_0x2199('0x22')](handleEntityNotFound(_0x47186a,null))['then'](saveUpdates(_0x4c0c21['body'],null))[_0x2199('0x22')](function(_0x333ad5){if(_0x333ad5){_0x33f261['message']=_0x333ad5[_0x2199('0x66')]({'plain':!![]});return db['FaxInteraction'][_0x2199('0x5a')]({'where':{'id':_0x333ad5[_0x2199('0x67')]}});}return null;})[_0x2199('0x22')](handleEntityNotFound(_0x47186a,null))[_0x2199('0x22')](function(_0x33d5fb){if(_0x33d5fb){return _0x33d5fb[_0x2199('0x39')]({'UserId':_0x4c0c21[_0x2199('0x5e')]['UserId'],'read1stAt':_['isNil'](_0x33d5fb[_0x2199('0x68')])?moment()[_0x2199('0x61')](_0x2199('0x62')):undefined});}return null;})[_0x2199('0x22')](function(_0x271040){if(_0x271040){_0x33f261[_0x2199('0x69')]=_0x271040[_0x2199('0x66')]({'plain':!![]});interaction_log[_0x2199('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c0c21[_0x2199('0x64')]['id'],_0x4c0c21[_0x2199('0x64')][_0x2199('0x3c')],_0x4c0c21[_0x2199('0x64')]['role'],_0x33f261[_0x2199('0x69')]['id'],_0x4c0c21[_0x2199('0x5e')]?JSON[_0x2199('0x28')](_0x4c0c21[_0x2199('0x5e')]):'null');return respondWithRpcPromise('AcceptMessage',_0x2199('0x6a'),_0x33f261);}return null;})[_0x2199('0x22')](function(_0x2ab12d){var _0x418f7f=_0x2199('0x6b')+_0x2ab12d[_0x2199('0x2b')][_0x2199('0x6c')];return db[_0x2199('0x6d')][_0x2199('0x41')](_0x418f7f,{'type':db['Sequelize']['QueryTypes'][_0x2199('0x6e')],'raw':!![]})[_0x2199('0x22')](function(_0x547965){return _0x547965;});})[_0x2199('0x22')](function(_0x5100c7){if(_0x5100c7){_0x33f261[_0x2199('0x2b')][_0x2199('0x6f')]=_0x5100c7[0x0];if(!_0x4c0c21[_0x2199('0x5e')][_0x2199('0x63')])return;return db[_0x2199('0x70')]['find']({'where':{'id':_0x4c0c21[_0x2199('0x5e')][_0x2199('0x63')],'role':_0x2199('0x65')},'attributes':['id',_0x2199('0x3c'),_0x2199('0x71'),'email',_0x2199('0x72')],'raw':!![]});}return null;})[_0x2199('0x22')](function(_0x418c64){if(!_0x418c64)return null;_0x33f261[_0x2199('0x2b')][_0x2199('0x65')]=_0x418c64;return _0x33f261;})['then'](function(_0x339d16){if(_0x339d16){if(_0x4c0c21['body'][_0x2199('0x73')]){_0x33f261[_0x2199('0x2b')][_0x2199('0x74')]=util[_0x2199('0x61')](_0x2199('0x75'),_0x4c0c21[_0x2199('0x64')]['name']);_0x33f261[_0x2199('0x2b')][_0x2199('0x76')]=_0x33f261['channel'];_0x33f261[_0x2199('0x2b')][_0x2199('0x77')]=_0x33f261[_0x2199('0x76')];_0x33f261[_0x2199('0x2b')][_0x2199('0x78')]=_0x2199('0x5d');return respondWithRpcPromise(_0x2199('0x79'),_0x2199('0x79'),{'event':_0x2199('0x7a'),'message':_0x33f261['message']},client9002)[_0x2199('0x22')](function(){return _0x33f261;});}return _0x33f261;}return null;})['then'](respondWithResult(_0x47186a,null))[_0x2199('0x2d')](handleError(_0x47186a,null));};var interaction_log=require('../../config/logger')(_0x2199('0x5c'));exports[_0x2199('0x38')]=function(_0xa5a6a9,_0x3724e1,_0x364298){var _0x5c2b45={'agent':{},'channel':_0x2199('0x7b')};if(_0xa5a6a9[_0x2199('0x5e')]['id']){delete _0xa5a6a9['body']['id'];}_0xa5a6a9['body'][_0x2199('0x63')]=_0xa5a6a9['body'][_0x2199('0x63')]||_0xa5a6a9[_0x2199('0x64')]['id'];_0x5c2b45[_0x2199('0x65')]['id']=_0xa5a6a9['body'][_0x2199('0x63')];return db['FaxMessage']['find']({'where':{'id':_0xa5a6a9[_0x2199('0x58')]['id'],'UserId':null}})[_0x2199('0x22')](handleEntityNotFound(_0x3724e1,null))[_0x2199('0x22')](function(_0x45d0d3){if(_0x45d0d3){_0x5c2b45[_0x2199('0x2b')]=_0x45d0d3[_0x2199('0x66')]({'plain':!![]});return db[_0x2199('0x7c')][_0x2199('0x5a')]({'where':{'id':_0x45d0d3['FaxInteractionId']}});}return null;})[_0x2199('0x22')](handleEntityNotFound(_0x3724e1,null))[_0x2199('0x22')](function(_0x36374a){if(_0x36374a){_0x5c2b45[_0x2199('0x69')]=_0x36374a['get']({'plain':!![]});interaction_log[_0x2199('0x23')](_0x2199('0x7d'),_0xa5a6a9[_0x2199('0x64')]['id'],_0xa5a6a9['user'][_0x2199('0x3c')],_0xa5a6a9[_0x2199('0x64')][_0x2199('0x7e')],_0x5c2b45[_0x2199('0x69')]['id'],_0xa5a6a9[_0x2199('0x5e')]?JSON['stringify'](_0xa5a6a9[_0x2199('0x5e')]):_0x2199('0x7f'));return respondWithRpcPromise(_0x2199('0x80'),'rejectMessage',_0x5c2b45);}return null;})[_0x2199('0x22')](function(_0x2441df){var _0x4848ff='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2441df[_0x2199('0x2b')][_0x2199('0x6c')];return db[_0x2199('0x6d')][_0x2199('0x41')](_0x4848ff,{'type':db[_0x2199('0x81')][_0x2199('0x82')][_0x2199('0x6e')],'raw':!![]})[_0x2199('0x22')](function(_0x4f7589){return _0x4f7589;});})[_0x2199('0x22')](function(_0x25805c){if(_0x25805c){_0x5c2b45[_0x2199('0x2b')][_0x2199('0x6f')]=_0x25805c[0x0];if(!_0xa5a6a9[_0x2199('0x5e')][_0x2199('0x63')])return;return db['User'][_0x2199('0x5a')]({'where':{'id':_0xa5a6a9['body'][_0x2199('0x63')],'role':_0x2199('0x65')},'attributes':['id',_0x2199('0x3c'),_0x2199('0x71'),'email',_0x2199('0x72')],'raw':!![]});}return null;})[_0x2199('0x22')](function(_0x464777){if(!_0x464777)return null;_0x5c2b45['message'][_0x2199('0x65')]=_0x464777;return _0x5c2b45;})['then'](function(_0x4ddeac){if(_0x4ddeac){_0x4ddeac[_0x2199('0x2b')][_0x2199('0x74')]=util[_0x2199('0x61')]('SIP/%s',_0xa5a6a9[_0x2199('0x64')][_0x2199('0x3c')]);_0x4ddeac['message'][_0x2199('0x76')]=_0x5c2b45[_0x2199('0x76')];_0x4ddeac[_0x2199('0x2b')][_0x2199('0x77')]=_0x5c2b45['channel'];_0x4ddeac['message'][_0x2199('0x78')]=_0x2199('0x38');respondWithRpcPromise(_0x2199('0x79'),_0x2199('0x79'),{'event':_0x2199('0x83'),'message':_0x4ddeac['message']},client9002);return _0x5c2b45;}return null;})[_0x2199('0x22')](respondWithResult(_0x3724e1,null))[_0x2199('0x2d')](handleError(_0x3724e1,null));};exports['create']=function(_0x342c71,_0x2aab04){var _0x116a56;return db[_0x2199('0x3e')][_0x2199('0x84')](_0x342c71['body'],{})[_0x2199('0x22')](function(_0x4aa886){_0x116a56=_0x4aa886;return db[_0x2199('0x85')][_0x2199('0x86')]({'where':{'id':_0x116a56[_0x2199('0x6c')]}});})['then'](function(_0x18df40){if(_[_0x2199('0x87')](_0x18df40)){return;}else{_0x116a56[_0x2199('0x7b')]=_0x18df40['fax'];return db[_0x2199('0x88')][_0x2199('0x86')]({'where':{'id':_0x116a56[_0x2199('0x89')]}});}})['then'](function(_0x576da0){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x2199('0x87')](_0x342c71[_0x2199('0x5e')])?undefined:_0x342c71[_0x2199('0x5e')]['FaxAccountId'],'path':_[_0x2199('0x87')](_0x576da0)?undefined:util[_0x2199('0x61')](_0x2199('0x8a'),_0x576da0['basename']),'fax':_['isNil'](_0x116a56[_0x2199('0x7b')])?undefined:_0x116a56[_0x2199('0x7b')],'AttachmentId':_0x116a56[_0x2199('0x89')]},client9002);})['then'](respondWithResult(_0x2aab04,0xc9))['catch'](handleError(_0x2aab04,null));};exports[_0x2199('0x8b')]=function(_0x433505,_0x237042){var _0x1d99c1=path[_0x2199('0x8c')](config[_0x2199('0x8d')],'server',_0x2199('0x8e'),_0x2199('0x8f'));return db[_0x2199('0x3e')]['find']({'where':{'id':_0x433505['params']['id']},'include':[{'model':db[_0x2199('0x88')],'as':_0x2199('0x88')}]})[_0x2199('0x22')](handleEntityNotFound(_0x237042,null))[_0x2199('0x22')](function(_0x2fc9b9){if(_0x2fc9b9){return _0x237042[_0x2199('0x8b')](path[_0x2199('0x8c')](_0x1d99c1,_0x2fc9b9['Attachment'][_0x2199('0x90')]));}})['catch'](handleError(_0x237042,null));}; \ No newline at end of file +var _0x1ae9=['params','length','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','RejectMessage','rejectMessage','ContactId','SELECT','rejectmessage','create','CmContact','findOne','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x574dea,_0x4cf209){var _0x3ed444=function(_0x3423a2){while(--_0x3423a2){_0x574dea['push'](_0x574dea['shift']());}};_0x3ed444(++_0x4cf209);}(_0x1ae9,0x152));var _0x91ae=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1ae9[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x91ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91ae('0x1'));var jsonpatch=require(_0x91ae('0x2'));var rp=require(_0x91ae('0x3'));var moment=require(_0x91ae('0x4'));var BPromise=require(_0x91ae('0x5'));var Mustache=require('mustache');var util=require(_0x91ae('0x6'));var path=require('path');var sox=require(_0x91ae('0x7'));var csv=require(_0x91ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ae('0x9'));var _=require(_0x91ae('0xa'));var squel=require(_0x91ae('0xb'));var crypto=require(_0x91ae('0xc'));var jsforce=require(_0x91ae('0xd'));var deskjs=require(_0x91ae('0xe'));var toCsv=require(_0x91ae('0x8'));var querystring=require(_0x91ae('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91ae('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x91ae('0x11'));var hardwareService=require(_0x91ae('0x12'));var logger=require(_0x91ae('0x13'))('api');var utils=require(_0x91ae('0x14'));var config=require(_0x91ae('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x91ae('0x16'))['db'];config['redis']=_[_0x91ae('0x17')](config[_0x91ae('0x18')],{'host':_0x91ae('0x19'),'port':0x18eb});var socket=require(_0x91ae('0x1a'))(new Redis(config[_0x91ae('0x18')]));require('./faxMessage.socket')[_0x91ae('0x1b')](socket);var jayson=require(_0x91ae('0x1c'));var client=jayson[_0x91ae('0x1d')][_0x91ae('0x1e')]({'port':0x232c});var client9002=jayson[_0x91ae('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x227de1,_0x5295f5,_0x44561f,_0x271258){return new BPromise(function(_0x177f03,_0x1b852f){var _0x4a4b16=_0x271258||client;return _0x4a4b16[_0x91ae('0x1f')](_0x227de1,_0x44561f)[_0x91ae('0x20')](function(_0x49e65f){logger['info'](_0x91ae('0x21'),_0x5295f5,_0x91ae('0x22'));logger['debug'](_0x91ae('0x23'),_0x5295f5,_0x91ae('0x22'),JSON['stringify'](_0x49e65f));if(_0x49e65f[_0x91ae('0x24')]){if(_0x49e65f['error'][_0x91ae('0x25')]===0x1f4){logger[_0x91ae('0x24')](_0x91ae('0x21'),_0x5295f5,_0x49e65f[_0x91ae('0x24')][_0x91ae('0x26')]);return _0x1b852f(_0x49e65f['error'][_0x91ae('0x26')]);}logger[_0x91ae('0x24')](_0x91ae('0x21'),_0x5295f5,_0x49e65f[_0x91ae('0x24')][_0x91ae('0x26')]);return _0x177f03(_0x49e65f[_0x91ae('0x24')]['message']);}else{logger[_0x91ae('0x27')](_0x91ae('0x21'),_0x5295f5,_0x91ae('0x22'));_0x177f03(_0x49e65f['result'][_0x91ae('0x26')]);}})[_0x91ae('0x28')](function(_0x94a8dd){logger[_0x91ae('0x24')](_0x91ae('0x21'),_0x5295f5,_0x94a8dd);_0x1b852f(_0x94a8dd);});});}function respondWithStatusCode(_0x997d99,_0x833871){_0x833871=_0x833871||0xcc;return function(_0x1c5105){if(_0x1c5105){return _0x997d99[_0x91ae('0x29')](_0x833871);}return _0x997d99[_0x91ae('0x2a')](_0x833871)[_0x91ae('0x2b')]();};}function respondWithResult(_0x2cccc7,_0x49dac1){_0x49dac1=_0x49dac1||0xc8;return function(_0x2720ba){if(_0x2720ba){return _0x2cccc7[_0x91ae('0x2a')](_0x49dac1)[_0x91ae('0x2c')](_0x2720ba);}};}function respondWithFilteredResult(_0xf76387,_0xe34a82){return function(_0x2ba37d){if(_0x2ba37d){var _0x58cc9=typeof _0xe34a82[_0x91ae('0x2d')]===_0x91ae('0x2e')&&typeof _0xe34a82[_0x91ae('0x2f')]===_0x91ae('0x2e');var _0x3b4cb0=_0x2ba37d[_0x91ae('0x30')];var _0xc6e687=_0x58cc9?0x0:_0xe34a82[_0x91ae('0x2d')];var _0x4b425d=_0x58cc9?_0x2ba37d['count']:_0xe34a82[_0x91ae('0x2d')]+_0xe34a82['limit'];var _0x3c32a1;if(_0x4b425d>=_0x3b4cb0){_0x4b425d=_0x3b4cb0;_0x3c32a1=0xc8;}else{_0x3c32a1=0xce;}_0xf76387[_0x91ae('0x2a')](_0x3c32a1);return _0xf76387[_0x91ae('0x31')](_0x91ae('0x32'),_0xc6e687+'-'+_0x4b425d+'/'+_0x3b4cb0)[_0x91ae('0x2c')](_0x2ba37d);}return null;};}function patchUpdates(_0x2ea2d4){return function(_0x10426e){try{jsonpatch[_0x91ae('0x33')](_0x10426e,_0x2ea2d4,!![]);}catch(_0xc9a62d){return BPromise[_0x91ae('0x34')](_0xc9a62d);}return _0x10426e[_0x91ae('0x35')]();};}function saveUpdates(_0x5d51e1,_0x9d8a3b){return function(_0x87a8d7){if(_0x87a8d7){return _0x87a8d7[_0x91ae('0x36')](_0x5d51e1)[_0x91ae('0x20')](function(_0x333717){return _0x333717;});}return null;};}function removeEntity(_0x291500,_0x3fa607){return function(_0xba8499){if(_0xba8499){return _0xba8499[_0x91ae('0x37')]()[_0x91ae('0x20')](function(){_0x291500[_0x91ae('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde09a8,_0xdac000){return function(_0xf79e1d){if(!_0xf79e1d){_0xde09a8[_0x91ae('0x29')](0x194);}return _0xf79e1d;};}function handleError(_0x994119,_0x35a7c9){_0x35a7c9=_0x35a7c9||0x1f4;return function(_0x44588a){logger[_0x91ae('0x24')](_0x44588a[_0x91ae('0x38')]);if(_0x44588a['name']){delete _0x44588a[_0x91ae('0x39')];}_0x994119[_0x91ae('0x2a')](_0x35a7c9)[_0x91ae('0x3a')](_0x44588a);};}exports[_0x91ae('0x3b')]=function(_0x617376,_0x3fa1d8){var _0xacc06c={},_0x42aa21={},_0x4c2d46={'count':0x0,'rows':[]};var _0x4e5a42=_[_0x91ae('0x3c')](db[_0x91ae('0x3d')][_0x91ae('0x3e')],function(_0x5a9291){return{'name':_0x5a9291['fieldName'],'type':_0x5a9291[_0x91ae('0x3f')][_0x91ae('0x40')]};});_0x42aa21[_0x91ae('0x41')]=_[_0x91ae('0x3c')](_0x4e5a42,_0x91ae('0x39'));_0x42aa21[_0x91ae('0x42')]=_[_0x91ae('0x43')](_0x617376['query']);_0x42aa21[_0x91ae('0x44')]=_[_0x91ae('0x45')](_0x42aa21[_0x91ae('0x41')],_0x42aa21[_0x91ae('0x42')]);_0xacc06c['attributes']=_[_0x91ae('0x45')](_0x42aa21[_0x91ae('0x41')],qs[_0x91ae('0x46')](_0x617376[_0x91ae('0x42')]['fields']));_0xacc06c['attributes']=_0xacc06c[_0x91ae('0x47')]['length']?_0xacc06c[_0x91ae('0x47')]:_0x42aa21[_0x91ae('0x41')];if(!_0x617376[_0x91ae('0x42')]['hasOwnProperty'](_0x91ae('0x48'))){_0xacc06c[_0x91ae('0x2f')]=qs['limit'](_0x617376[_0x91ae('0x42')][_0x91ae('0x2f')]);_0xacc06c[_0x91ae('0x2d')]=qs['offset'](_0x617376['query']['offset']);}_0xacc06c[_0x91ae('0x49')]=qs[_0x91ae('0x4a')](_0x617376[_0x91ae('0x42')][_0x91ae('0x4a')]);_0xacc06c[_0x91ae('0x4b')]=qs['filters'](_['pick'](_0x617376[_0x91ae('0x42')],_0x42aa21[_0x91ae('0x44')]),_0x4e5a42);if(_0x617376[_0x91ae('0x42')][_0x91ae('0x4c')]){_0xacc06c[_0x91ae('0x4b')]=_[_0x91ae('0x4d')](_0xacc06c['where'],{'$or':_['map'](_0x4e5a42,function(_0x26480d){if(_0x26480d['type']!==_0x91ae('0x4e')){var _0x4e9be7={};_0x4e9be7[_0x26480d['name']]={'$like':'%'+_0x617376[_0x91ae('0x42')][_0x91ae('0x4c')]+'%'};return _0x4e9be7;}})});}_0xacc06c=_['merge']({},_0xacc06c,_0x617376[_0x91ae('0x4f')]);var _0x3941ad={'where':_0xacc06c['where']};return db[_0x91ae('0x3d')][_0x91ae('0x30')](_0x3941ad)[_0x91ae('0x20')](function(_0xffa070){_0x4c2d46[_0x91ae('0x30')]=_0xffa070;if(_0x617376[_0x91ae('0x42')][_0x91ae('0x50')]){_0xacc06c[_0x91ae('0x51')]=[{'all':!![]}];}return db[_0x91ae('0x3d')][_0x91ae('0x52')](_0xacc06c);})[_0x91ae('0x20')](function(_0x3bd90a){_0x4c2d46[_0x91ae('0x53')]=_0x3bd90a;return _0x4c2d46;})[_0x91ae('0x20')](respondWithFilteredResult(_0x3fa1d8,_0xacc06c))['catch'](handleError(_0x3fa1d8,null));};exports[_0x91ae('0x54')]=function(_0x27bfc5,_0x15c55f){var _0x370df0={'raw':!![],'where':{'id':_0x27bfc5[_0x91ae('0x55')]['id']}},_0x5e8049={};_0x5e8049[_0x91ae('0x41')]=_[_0x91ae('0x43')](db[_0x91ae('0x3d')][_0x91ae('0x3e')]);_0x5e8049['query']=_['keys'](_0x27bfc5['query']);_0x5e8049[_0x91ae('0x44')]=_[_0x91ae('0x45')](_0x5e8049['model'],_0x5e8049[_0x91ae('0x42')]);_0x370df0['attributes']=_[_0x91ae('0x45')](_0x5e8049[_0x91ae('0x41')],qs[_0x91ae('0x46')](_0x27bfc5[_0x91ae('0x42')][_0x91ae('0x46')]));_0x370df0[_0x91ae('0x47')]=_0x370df0[_0x91ae('0x47')][_0x91ae('0x56')]?_0x370df0[_0x91ae('0x47')]:_0x5e8049['model'];if(_0x27bfc5[_0x91ae('0x42')]['includeAll']){_0x370df0[_0x91ae('0x51')]=[{'all':!![]}];}_0x370df0=_[_0x91ae('0x4d')]({},_0x370df0,_0x27bfc5['options']);return db[_0x91ae('0x3d')][_0x91ae('0x57')](_0x370df0)[_0x91ae('0x20')](handleEntityNotFound(_0x15c55f,null))['then'](respondWithResult(_0x15c55f,null))[_0x91ae('0x28')](handleError(_0x15c55f,null));};exports[_0x91ae('0x36')]=function(_0x498789,_0x82d226){if(_0x498789[_0x91ae('0x58')]['id']){delete _0x498789['body']['id'];}return db[_0x91ae('0x3d')][_0x91ae('0x57')]({'where':{'id':_0x498789[_0x91ae('0x55')]['id']}})[_0x91ae('0x20')](handleEntityNotFound(_0x82d226,null))[_0x91ae('0x20')](saveUpdates(_0x498789[_0x91ae('0x58')],null))[_0x91ae('0x20')](respondWithResult(_0x82d226,null))[_0x91ae('0x28')](handleError(_0x82d226,null));};exports[_0x91ae('0x37')]=function(_0x499c0b,_0xad47a1){return db[_0x91ae('0x3d')][_0x91ae('0x57')]({'where':{'id':_0x499c0b[_0x91ae('0x55')]['id']}})[_0x91ae('0x20')](handleEntityNotFound(_0xad47a1,null))[_0x91ae('0x20')](removeEntity(_0xad47a1,null))['catch'](handleError(_0xad47a1,null));};exports['describe']=function(_0x68b812,_0xef11b9){return db[_0x91ae('0x3d')][_0x91ae('0x59')]()[_0x91ae('0x20')](respondWithResult(_0xef11b9,null))['catch'](handleError(_0xef11b9,null));};var interaction_log=require('../../config/logger')(_0x91ae('0x5a'));exports[_0x91ae('0x5b')]=function(_0x2eaf19,_0x3ebdbd,_0x2b1ef0){var _0x140465={'agent':{},'channel':_0x91ae('0x5c')};if(_0x2eaf19[_0x91ae('0x58')]['id']){delete _0x2eaf19[_0x91ae('0x58')]['id'];}_0x2eaf19[_0x91ae('0x58')][_0x91ae('0x5d')]=!![];_0x2eaf19[_0x91ae('0x58')][_0x91ae('0x5e')]=moment()[_0x91ae('0x5f')](_0x91ae('0x60'));_0x2eaf19[_0x91ae('0x58')][_0x91ae('0x61')]=_0x2eaf19[_0x91ae('0x58')]['UserId']||_0x2eaf19[_0x91ae('0x62')]['id'];_0x140465[_0x91ae('0x63')]['id']=_0x2eaf19[_0x91ae('0x58')][_0x91ae('0x61')];return db[_0x91ae('0x3d')]['find']({'where':{'id':_0x2eaf19[_0x91ae('0x55')]['id'],'UserId':null}})[_0x91ae('0x20')](handleEntityNotFound(_0x3ebdbd,null))[_0x91ae('0x20')](saveUpdates(_0x2eaf19[_0x91ae('0x58')],null))['then'](function(_0x15d13e){if(_0x15d13e){_0x140465[_0x91ae('0x26')]=_0x15d13e['get']({'plain':!![]});return db[_0x91ae('0x64')][_0x91ae('0x57')]({'where':{'id':_0x15d13e[_0x91ae('0x65')]}});}return null;})[_0x91ae('0x20')](handleEntityNotFound(_0x3ebdbd,null))[_0x91ae('0x20')](function(_0x4d9a12){if(_0x4d9a12){return _0x4d9a12['update']({'UserId':_0x2eaf19['body'][_0x91ae('0x61')],'read1stAt':_[_0x91ae('0x66')](_0x4d9a12[_0x91ae('0x67')])?moment()[_0x91ae('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x91ae('0x20')](function(_0x41f842){if(_0x41f842){_0x140465[_0x91ae('0x68')]=_0x41f842[_0x91ae('0x69')]({'plain':!![]});interaction_log[_0x91ae('0x27')](_0x91ae('0x6a'),_0x2eaf19['user']['id'],_0x2eaf19['user'][_0x91ae('0x39')],_0x2eaf19[_0x91ae('0x62')][_0x91ae('0x6b')],_0x140465['interaction']['id'],_0x2eaf19['body']?JSON[_0x91ae('0x6c')](_0x2eaf19[_0x91ae('0x58')]):'null');return respondWithRpcPromise(_0x91ae('0x6d'),_0x91ae('0x6e'),_0x140465);}return null;})['then'](function(_0x2663ae){var _0x24dd94=_0x91ae('0x6f')+_0x2663ae['message']['ContactId'];return db[_0x91ae('0x70')][_0x91ae('0x42')](_0x24dd94,{'type':db[_0x91ae('0x71')][_0x91ae('0x72')]['SELECT'],'raw':!![]})[_0x91ae('0x20')](function(_0x2a052f){return _0x2a052f;});})[_0x91ae('0x20')](function(_0x5c04a9){if(_0x5c04a9){_0x140465[_0x91ae('0x26')][_0x91ae('0x73')]=_0x5c04a9[0x0];if(!_0x2eaf19['body'][_0x91ae('0x61')])return;return db[_0x91ae('0x74')][_0x91ae('0x57')]({'where':{'id':_0x2eaf19[_0x91ae('0x58')]['UserId'],'role':_0x91ae('0x63')},'attributes':['id','name',_0x91ae('0x75'),_0x91ae('0x76'),_0x91ae('0x77')],'raw':!![]});}return null;})[_0x91ae('0x20')](function(_0x231497){if(!_0x231497)return null;_0x140465[_0x91ae('0x26')][_0x91ae('0x63')]=_0x231497;return _0x140465;})[_0x91ae('0x20')](function(_0x281385){if(_0x281385){if(_0x2eaf19[_0x91ae('0x58')]['manual']){_0x140465['message'][_0x91ae('0x78')]=util['format'](_0x91ae('0x79'),_0x2eaf19[_0x91ae('0x62')][_0x91ae('0x39')]);_0x140465[_0x91ae('0x26')][_0x91ae('0x7a')]=_0x140465[_0x91ae('0x7a')];_0x140465[_0x91ae('0x26')][_0x91ae('0x7b')]=_0x140465[_0x91ae('0x7a')];_0x140465[_0x91ae('0x26')][_0x91ae('0x7c')]=_0x91ae('0x5b');return respondWithRpcPromise(_0x91ae('0x7d'),_0x91ae('0x7d'),{'event':'acceptmessage','message':_0x140465[_0x91ae('0x26')]},client9002)[_0x91ae('0x20')](function(){return _0x140465;});}return _0x140465;}return null;})['then'](respondWithResult(_0x3ebdbd,null))[_0x91ae('0x28')](handleError(_0x3ebdbd,null));};var interaction_log=require(_0x91ae('0x13'))('fax-interactions');exports[_0x91ae('0x34')]=function(_0x4902dd,_0x1c94c8,_0x3339bf){var _0x1be1ed={'agent':{},'channel':_0x91ae('0x5c')};if(_0x4902dd[_0x91ae('0x58')]['id']){delete _0x4902dd['body']['id'];}_0x4902dd[_0x91ae('0x58')]['UserId']=_0x4902dd['body'][_0x91ae('0x61')]||_0x4902dd[_0x91ae('0x62')]['id'];_0x1be1ed[_0x91ae('0x63')]['id']=_0x4902dd[_0x91ae('0x58')][_0x91ae('0x61')];return db['FaxMessage']['find']({'where':{'id':_0x4902dd[_0x91ae('0x55')]['id'],'UserId':null}})[_0x91ae('0x20')](handleEntityNotFound(_0x1c94c8,null))[_0x91ae('0x20')](function(_0x11ec4f){if(_0x11ec4f){_0x1be1ed[_0x91ae('0x26')]=_0x11ec4f[_0x91ae('0x69')]({'plain':!![]});return db[_0x91ae('0x64')][_0x91ae('0x57')]({'where':{'id':_0x11ec4f[_0x91ae('0x65')]}});}return null;})[_0x91ae('0x20')](handleEntityNotFound(_0x1c94c8,null))[_0x91ae('0x20')](function(_0x508c2b){if(_0x508c2b){_0x1be1ed[_0x91ae('0x68')]=_0x508c2b[_0x91ae('0x69')]({'plain':!![]});interaction_log[_0x91ae('0x27')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4902dd[_0x91ae('0x62')]['id'],_0x4902dd[_0x91ae('0x62')][_0x91ae('0x39')],_0x4902dd[_0x91ae('0x62')][_0x91ae('0x6b')],_0x1be1ed[_0x91ae('0x68')]['id'],_0x4902dd[_0x91ae('0x58')]?JSON[_0x91ae('0x6c')](_0x4902dd['body']):'null');return respondWithRpcPromise(_0x91ae('0x7e'),_0x91ae('0x7f'),_0x1be1ed);}return null;})[_0x91ae('0x20')](function(_0x1c7d94){var _0x42b900=_0x91ae('0x6f')+_0x1c7d94[_0x91ae('0x26')][_0x91ae('0x80')];return db[_0x91ae('0x70')][_0x91ae('0x42')](_0x42b900,{'type':db[_0x91ae('0x71')]['QueryTypes'][_0x91ae('0x81')],'raw':!![]})[_0x91ae('0x20')](function(_0x3d2f8a){return _0x3d2f8a;});})['then'](function(_0xaab2ec){if(_0xaab2ec){_0x1be1ed[_0x91ae('0x26')]['contact']=_0xaab2ec[0x0];if(!_0x4902dd[_0x91ae('0x58')][_0x91ae('0x61')])return;return db[_0x91ae('0x74')][_0x91ae('0x57')]({'where':{'id':_0x4902dd['body'][_0x91ae('0x61')],'role':'agent'},'attributes':['id',_0x91ae('0x39'),_0x91ae('0x75'),'email',_0x91ae('0x77')],'raw':!![]});}return null;})['then'](function(_0x42a26e){if(!_0x42a26e)return null;_0x1be1ed[_0x91ae('0x26')][_0x91ae('0x63')]=_0x42a26e;return _0x1be1ed;})[_0x91ae('0x20')](function(_0x3c7969){if(_0x3c7969){_0x3c7969[_0x91ae('0x26')]['interface']=util[_0x91ae('0x5f')](_0x91ae('0x79'),_0x4902dd['user']['name']);_0x3c7969[_0x91ae('0x26')][_0x91ae('0x7a')]=_0x1be1ed[_0x91ae('0x7a')];_0x3c7969['message'][_0x91ae('0x7b')]=_0x1be1ed[_0x91ae('0x7a')];_0x3c7969[_0x91ae('0x26')][_0x91ae('0x7c')]=_0x91ae('0x34');respondWithRpcPromise(_0x91ae('0x7d'),_0x91ae('0x7d'),{'event':_0x91ae('0x82'),'message':_0x3c7969[_0x91ae('0x26')]},client9002);return _0x1be1ed;}return null;})[_0x91ae('0x20')](respondWithResult(_0x1c94c8,null))['catch'](handleError(_0x1c94c8,null));};exports[_0x91ae('0x83')]=function(_0x1334bf,_0x38c9d9){var _0x28ca18;return db[_0x91ae('0x3d')]['create'](_0x1334bf['body'],{})['then'](function(_0x1cd025){_0x28ca18=_0x1cd025;return db[_0x91ae('0x84')][_0x91ae('0x85')]({'where':{'id':_0x28ca18[_0x91ae('0x80')]}});})[_0x91ae('0x20')](function(_0x1e3f2f){if(_[_0x91ae('0x66')](_0x1e3f2f)){return;}else{_0x28ca18[_0x91ae('0x5c')]=_0x1e3f2f['fax'];return db[_0x91ae('0x86')]['findOne']({'where':{'id':_0x28ca18['AttachmentId']}});}})[_0x91ae('0x20')](function(_0x10ac86){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x91ae('0x66')](_0x1334bf[_0x91ae('0x58')])?undefined:_0x1334bf['body'][_0x91ae('0x87')],'path':_['isNil'](_0x10ac86)?undefined:util[_0x91ae('0x5f')](_0x91ae('0x88'),_0x10ac86[_0x91ae('0x89')]),'fax':_['isNil'](_0x28ca18[_0x91ae('0x5c')])?undefined:_0x28ca18['fax'],'AttachmentId':_0x28ca18[_0x91ae('0x8a')]},client9002);})[_0x91ae('0x20')](respondWithResult(_0x38c9d9,0xc9))['catch'](handleError(_0x38c9d9,null));};exports[_0x91ae('0x8b')]=function(_0x221359,_0x4d0894){var _0x52fdfd=path['join'](config[_0x91ae('0x8c')],'server','files','attachments');return db[_0x91ae('0x3d')][_0x91ae('0x57')]({'where':{'id':_0x221359[_0x91ae('0x55')]['id']},'include':[{'model':db[_0x91ae('0x86')],'as':_0x91ae('0x86')}]})[_0x91ae('0x20')](handleEntityNotFound(_0x4d0894,null))['then'](function(_0x1ac99a){if(_0x1ac99a){return _0x4d0894[_0x91ae('0x8b')](path['join'](_0x52fdfd,_0x1ac99a[_0x91ae('0x86')][_0x91ae('0x89')]));}})['catch'](handleError(_0x4d0894,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8eda3a5..2dcf719 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 _0xc812=['FaxMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5506cd,_0x3488e4){var _0x5e6a99=function(_0x18e0de){while(--_0x18e0de){_0x5506cd['push'](_0x5506cd['shift']());}};_0x5e6a99(++_0x3488e4);}(_0xc812,0xbc));var _0x2c81=function(_0x1f87e8,_0x243cd3){_0x1f87e8=_0x1f87e8-0x0;var _0x208eac=_0xc812[_0x1f87e8];return _0x208eac;};'use strict';var EventEmitter=require(_0x2c81('0x0'));var FaxMessage=require(_0x2c81('0x1'))['db'][_0x2c81('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c81('0x3'),'afterUpdate':_0x2c81('0x4'),'afterDestroy':_0x2c81('0x5')};function emitEvent(_0x1a02ae){return function(_0x5b0772,_0x9ad923,_0x19ed27){FaxMessageEvents['emit'](_0x1a02ae+':'+_0x5b0772['id'],_0x5b0772);FaxMessageEvents[_0x2c81('0x6')](_0x1a02ae,_0x5b0772);_0x19ed27(null);};}for(var e in events){if(events[_0x2c81('0x7')](e)){var event=events[e];FaxMessage[_0x2c81('0x8')](e,emitEvent(event));}}module[_0x2c81('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x1298=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x1298,0x19e));var _0x8129=function(_0x596c74,_0x5ed57f){_0x596c74=_0x596c74-0x0;var _0x5b99c7=_0x1298[_0x596c74];return _0x5b99c7;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x8129('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8129('0x1')](0x0);var events={'afterCreate':_0x8129('0x2'),'afterUpdate':_0x8129('0x3'),'afterDestroy':_0x8129('0x4')};function emitEvent(_0x6031b2){return function(_0x31d02a,_0x39e214,_0x4fbaf9){FaxMessageEvents[_0x8129('0x5')](_0x6031b2+':'+_0x31d02a['id'],_0x31d02a);FaxMessageEvents[_0x8129('0x5')](_0x6031b2,_0x31d02a);_0x4fbaf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x8129('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9c935ff..e25e5ff 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 _0x49dd=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','catch','error'];(function(_0x4b1720,_0x247db7){var _0x40efb0=function(_0x3dab6c){while(--_0x3dab6c){_0x4b1720['push'](_0x4b1720['shift']());}};_0x40efb0(++_0x247db7);}(_0x49dd,0x11f));var _0xd49d=function(_0x415923,_0xa57d8d){_0x415923=_0x415923-0x0;var _0x508943=_0x49dd[_0x415923];return _0x508943;};'use strict';var _=require('lodash');var util=require(_0xd49d('0x0'));var logger=require(_0xd49d('0x1'))(_0xd49d('0x2'));var moment=require(_0xd49d('0x3'));var BPromise=require(_0xd49d('0x4'));var rp=require(_0xd49d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd49d('0x6'));module[_0xd49d('0x7')]=function(_0x2a960a,_0x2aa539){return _0x2a960a[_0xd49d('0x8')](_0xd49d('0x9'),attributes,{'tableName':_0xd49d('0xa'),'paranoid':![],'indexes':[{'name':_0xd49d('0xb'),'fields':[_0xd49d('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ea4c9,_0x34f660,_0x18bf79){var _0x59fd43=_0x2a960a[_0xd49d('0xd')];var _0x59a642=_0x5ea4c9['get']({'plain':!![]});if(_0x59a642['direction'][_0xd49d('0xe')]()==='in'||_0x59a642[_0xd49d('0xf')]['toLowerCase']()==='out'&&!_0x59a642[_0xd49d('0x10')]&&!_[_0xd49d('0x11')](_0x59a642[_0xd49d('0x12')])){_0x59fd43[_0xd49d('0x13')]['findOne']({'where':{'id':_0x59a642[_0xd49d('0x14')]}})[_0xd49d('0x15')](function(_0x8339fb){if(_0x8339fb){_0x8339fb[_0xd49d('0x16')]({'lastMsgAt':_0x59a642['createdAt'],'lastMsgDirection':_0x59a642[_0xd49d('0xf')][_0xd49d('0xe')]()});}})[_0xd49d('0x17')](function(_0x460d5a){console[_0xd49d('0x18')](_0x460d5a);});}_0x18bf79();}},'charset':'utf8mb4','collate':_0xd49d('0x19')});}; \ No newline at end of file +var _0x472d=['../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x472d,0xe1));var _0xd472=function(_0x4b8a5d,_0x441f33){_0x4b8a5d=_0x4b8a5d-0x0;var _0x52a8ce=_0x472d[_0x4b8a5d];return _0x52a8ce;};'use strict';var _=require('lodash');var util=require(_0xd472('0x0'));var logger=require(_0xd472('0x1'))(_0xd472('0x2'));var moment=require(_0xd472('0x3'));var BPromise=require(_0xd472('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd472('0x5'));var rimraf=require(_0xd472('0x6'));var config=require(_0xd472('0x7'));var attributes=require(_0xd472('0x8'));module['exports']=function(_0x55caab,_0x5914cf){return _0x55caab[_0xd472('0x9')](_0xd472('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd472('0xb'),'fields':[_0xd472('0xc')],'type':_0xd472('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28e5cc,_0x242ae4,_0x36f273){var _0x319cad=_0x55caab[_0xd472('0xe')];var _0x5eaafb=_0x28e5cc[_0xd472('0xf')]({'plain':!![]});if(_0x5eaafb[_0xd472('0x10')][_0xd472('0x11')]()==='in'||_0x5eaafb[_0xd472('0x10')][_0xd472('0x11')]()===_0xd472('0x12')&&!_0x5eaafb[_0xd472('0x13')]&&!_[_0xd472('0x14')](_0x5eaafb[_0xd472('0x15')])){_0x319cad['FaxInteraction'][_0xd472('0x16')]({'where':{'id':_0x5eaafb['FaxInteractionId']}})[_0xd472('0x17')](function(_0x5a3492){if(_0x5a3492){_0x5a3492[_0xd472('0x18')]({'lastMsgAt':_0x5eaafb[_0xd472('0x19')],'lastMsgDirection':_0x5eaafb[_0xd472('0x10')][_0xd472('0x11')]()});}})[_0xd472('0x1a')](function(_0x5d9e6f){console['error'](_0x5d9e6f);});}_0x36f273();}},'charset':_0xd472('0x1b'),'collate':_0xd472('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5fce536..0b80c21 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 _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(_0x2f1c70,_0x1e332){var _0x1e0302=function(_0x33f0d9){while(--_0x33f0d9){_0x2f1c70['push'](_0x2f1c70['shift']());}};_0x1e0302(++_0x1e332);}(_0x54ef,0x112));var _0xf54e=function(_0x5e6f02,_0xaf60fa){_0x5e6f02=_0x5e6f02-0x0;var _0x16a578=_0x54ef[_0x5e6f02];return _0x16a578;};'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 +var _0x6f0d=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1cbfd3,_0x8b30a4){_0x1cbfd3=_0x1cbfd3-0x0;var _0x400c68=_0x6f0d[_0x1cbfd3];return _0x400c68;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});config[_0xd6f0('0xa')]=_[_0xd6f0('0xb')](config[_0xd6f0('0xa')],{'host':_0xd6f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd6f0('0xd'))[_0xd6f0('0xe')](socket);function respondWithRpcPromise(_0x2854cd,_0x382a2e,_0x225dcf){return new BPromise(function(_0x4db64a,_0x136eee){return client[_0xd6f0('0xf')](_0x2854cd,_0x225dcf)[_0xd6f0('0x10')](function(_0x44bba6){logger['info'](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x382a2e,_0xd6f0('0x12'),JSON[_0xd6f0('0x15')](_0x44bba6));if(_0x44bba6[_0xd6f0('0x16')]){if(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x17')]===0x1f4){logger['error'](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')]['message']);return _0x136eee(_0x44bba6[_0xd6f0('0x16')]['message']);}logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);return _0x4db64a(_0x44bba6[_0xd6f0('0x16')][_0xd6f0('0x18')]);}else{logger[_0xd6f0('0x19')](_0xd6f0('0x11'),_0x382a2e,_0xd6f0('0x12'));_0x4db64a(_0x44bba6[_0xd6f0('0x1a')][_0xd6f0('0x18')]);}})[_0xd6f0('0x1b')](function(_0x327231){logger[_0xd6f0('0x16')](_0xd6f0('0x11'),_0x382a2e,_0x327231);_0x136eee(_0x327231);});});}exports[_0xd6f0('0x1c')]=function(_0x5cd367){var _0x48ac38=this;return new Promise(function(_0x3939aa,_0x264104){return db[_0xd6f0('0x1d')]['create'](_0x5cd367[_0xd6f0('0x1e')],{'raw':_0x5cd367[_0xd6f0('0x1f')]?_0x5cd367['options'][_0xd6f0('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1ee584){logger[_0xd6f0('0x19')]('CreateFaxMessage',_0x5cd367);logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x5cd367,JSON['stringify'](_0x1ee584));_0x3939aa(_0x1ee584);})[_0xd6f0('0x1b')](function(_0x402070){logger[_0xd6f0('0x16')]('CreateFaxMessage',_0x402070[_0xd6f0('0x18')],_0x5cd367);_0x264104(_0x48ac38[_0xd6f0('0x16')](0x1f4,_0x402070['message']));});});};exports[_0xd6f0('0x21')]=function(_0x551be8){var _0x2042d5=this;return new Promise(function(_0x3fb5c3,_0x1630dc){return db[_0xd6f0('0x1d')][_0xd6f0('0x22')](_0x551be8[_0xd6f0('0x1e')],{'raw':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')]['where']||null:null,'attributes':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x23')]||null:null,'limit':_0x551be8[_0xd6f0('0x1f')]?_0x551be8[_0xd6f0('0x1f')][_0xd6f0('0x24')]||null:null})[_0xd6f0('0x10')](function(_0x3151f8){logger[_0xd6f0('0x19')](_0xd6f0('0x21'),_0x551be8);logger[_0xd6f0('0x13')](_0xd6f0('0x21'),_0x551be8,JSON[_0xd6f0('0x15')](_0x3151f8));_0x3fb5c3(_0x3151f8);})[_0xd6f0('0x1b')](function(_0xbdd223){logger[_0xd6f0('0x16')](_0xd6f0('0x21'),_0xbdd223[_0xd6f0('0x18')],_0x551be8);_0x1630dc(_0x2042d5[_0xd6f0('0x16')](0x1f4,_0xbdd223[_0xd6f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 301e105..b82f51e 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 _0x21b4=['emit','removeListener','faxMessage:','./faxMessage.events','save','remove'];(function(_0x13a9b1,_0x341a46){var _0x396ff8=function(_0xd2fd7d){while(--_0xd2fd7d){_0x13a9b1['push'](_0x13a9b1['shift']());}};_0x396ff8(++_0x341a46);}(_0x21b4,0x10b));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0x421b('0x0'));var events=[_0x421b('0x1'),_0x421b('0x2'),'update'];function createListener(_0x5ab94a,_0x64d268){return function(_0xafcf05){_0x64d268[_0x421b('0x3')](_0x5ab94a,_0xafcf05);};}function removeListener(_0x17d36a,_0x32fa78){return function(){FaxMessageEvents[_0x421b('0x4')](_0x17d36a,_0x32fa78);};}exports['register']=function(_0x4f125c){for(var _0x19f313=0x0,_0x1776d3=events['length'];_0x19f313<_0x1776d3;_0x19f313++){var _0x1daa48=events[_0x19f313];var _0x29f393=createListener(_0x421b('0x5')+_0x1daa48,_0x4f125c);FaxMessageEvents['on'](_0x1daa48,_0x29f393);}}; \ No newline at end of file +var _0x4ea5=['save','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x2d53cd,_0x242774){var _0xd69a27=function(_0x39449b){while(--_0x39449b){_0x2d53cd['push'](_0x2d53cd['shift']());}};_0xd69a27(++_0x242774);}(_0x4ea5,0x18f));var _0x54ea=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x4ea5[_0x912d27];return _0x31b918;};'use strict';var FaxMessageEvents=require(_0x54ea('0x0'));var events=[_0x54ea('0x1'),'remove',_0x54ea('0x2')];function createListener(_0x4bb558,_0x55bf15){return function(_0x406513){_0x55bf15[_0x54ea('0x3')](_0x4bb558,_0x406513);};}function removeListener(_0x1dd999,_0x41b68a){return function(){FaxMessageEvents[_0x54ea('0x4')](_0x1dd999,_0x41b68a);};}exports[_0x54ea('0x5')]=function(_0x4c85b7){for(var _0x48510d=0x0,_0x43a464=events[_0x54ea('0x6')];_0x48510d<_0x43a464;_0x48510d++){var _0x328ec1=events[_0x48510d];var _0x4c6935=createListener(_0x54ea('0x7')+_0x328ec1,_0x4c85b7);FaxMessageEvents['on'](_0x328ec1,_0x4c6935);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 20913ca..7d4adf4 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 _0xb469=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb469,0x13b));var _0x9b46=function(_0x30de0c,_0xfa3f7){_0x30de0c=_0x30de0c-0x0;var _0xf38475=_0xb469[_0x30de0c];return _0xf38475;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./faxMessage.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['get'](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0xd')]);router['get'](_0x9b46('0xe'),auth['isAuthenticated'](),controller[_0x9b46('0xf')]);router['post']('/',auth[_0x9b46('0xa')](),interaction['tracked'](_0x9b46('0x10'),_0x9b46('0x11')),controller['create']);router[_0x9b46('0x12')](_0x9b46('0xc'),auth['isAuthenticated'](),controller[_0x9b46('0x13')]);router[_0x9b46('0x12')](_0x9b46('0x14'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x15')]);router[_0x9b46('0x12')](_0x9b46('0x16'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x17')]);router[_0x9b46('0x18')](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc368,0x7b));var _0x8c36=function(_0x1dca4e,_0x51bd7e){_0x1dca4e=_0x1dca4e-0x0;var _0x221e4a=_0xc368[_0x1dca4e];return _0x221e4a;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c2308b4..43b7301 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 _0x1069=['beepall','roundrobin','sequelize','exports','STRING','name','rrmemory'];(function(_0x5b2767,_0xc983df){var _0x482816=function(_0x1c8a6c){while(--_0x1c8a6c){_0x5b2767['push'](_0x5b2767['shift']());}};_0x482816(++_0xc983df);}(_0x1069,0x167));var _0x9106=function(_0x23c447,_0x67046a){_0x23c447=_0x23c447-0x0;var _0x70f697=_0x1069[_0x23c447];return _0x70f697;};'use strict';var Sequelize=require(_0x9106('0x0'));module[_0x9106('0x1')]={'name':{'type':Sequelize[_0x9106('0x2')],'unique':_0x9106('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9106('0x4'),_0x9106('0x5'),_0x9106('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x894b=['INTEGER','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x894b,0x104));var _0xb894=function(_0x46f2c2,_0x139b26){_0x46f2c2=_0x46f2c2-0x0;var _0x128b9e=_0x894b[_0x46f2c2];return _0x128b9e;};'use strict';var Sequelize=require(_0xb894('0x0'));module[_0xb894('0x1')]={'name':{'type':Sequelize[_0xb894('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb894('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb894('0x3')](_0xb894('0x4'),_0xb894('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb894('0x6')],'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 28ea0ec..6f88658 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 _0x1261=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','pick','FaxQueueId','filter','merge','findAll','findAndCountAll','agent','faxPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','sort','addTeams','ids','User','voicePause','interface','flatMap','transaction','each','forEach','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','findOne','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','error','name','index','map','FaxQueue','fieldName','type','where','include','catch','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','user','role','UserProfileSection','userProfileId'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1261,0x144));var _0x1126=function(_0x543eac,_0x3a39a1){_0x543eac=_0x543eac-0x0;var _0x16c036=_0x1261[_0x543eac];return _0x16c036;};'use strict';var BPromise=require('bluebird');var util=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));var squel=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var qs=require(_0x1126('0x4'));var logger=require(_0x1126('0x5'))(_0x1126('0x6'));var config=require(_0x1126('0x7'));var db=require(_0x1126('0x8'))['db'];config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var socket=require(_0x1126('0xb'))(new Redis(config['redis']));require(_0x1126('0xc'))[_0x1126('0xd')](socket);function respondWithStatusCode(_0x245be9,_0x3abb0b){_0x3abb0b=_0x3abb0b||0xcc;return function(_0x2d9033){if(_0x2d9033){return _0x245be9['sendStatus'](_0x3abb0b);}return _0x245be9[_0x1126('0xe')](_0x3abb0b)[_0x1126('0xf')]();};}function respondWithResult(_0x167ef1,_0x5e72e2){_0x5e72e2=_0x5e72e2||0xc8;return function(_0x34571c){if(_0x34571c){return _0x167ef1['status'](_0x5e72e2)['json'](_0x34571c);}};}function respondWithFilteredResult(_0x15c071,_0x561b93){return function(_0x15e89b){if(_0x15e89b){var _0x1b364a=typeof _0x561b93[_0x1126('0x10')]===_0x1126('0x11')&&typeof _0x561b93[_0x1126('0x12')]===_0x1126('0x11');var _0xd8ca42=_0x15e89b[_0x1126('0x13')];var _0x43850b=_0x1b364a?0x0:_0x561b93['offset'];var _0x5de9a7=_0x1b364a?_0x15e89b[_0x1126('0x13')]:_0x561b93[_0x1126('0x10')]+_0x561b93[_0x1126('0x12')];var _0x4be0c6;if(_0x5de9a7>=_0xd8ca42){_0x5de9a7=_0xd8ca42;_0x4be0c6=0xc8;}else{_0x4be0c6=0xce;}_0x15c071[_0x1126('0xe')](_0x4be0c6);return _0x15c071['set'](_0x1126('0x14'),_0x43850b+'-'+_0x5de9a7+'/'+_0xd8ca42)[_0x1126('0x15')](_0x15e89b);}return null;};}function saveUpdates(_0x257b5f){return function(_0x4e1c97){if(_0x4e1c97){return _0x4e1c97[_0x1126('0x16')](_0x257b5f)[_0x1126('0x17')](function(_0x4a7b49){return _0x4a7b49;});}return null;};}function removeEntity(_0x4d2b38){return function(_0x22ae0b){if(_0x22ae0b){return _0x22ae0b[_0x1126('0x18')]()['then'](function(){var _0x548359=_0x22ae0b[_0x1126('0x19')]({'plain':!![]});var _0x58b109=_0x1126('0x1a');return db[_0x1126('0x1b')][_0x1126('0x18')]({'where':{'type':_0x58b109,'resourceId':_0x548359['id']}})['then'](function(){return _0x22ae0b;});})[_0x1126('0x17')](function(){_0x4d2b38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f6b3){return function(_0x3a9bed){if(!_0x3a9bed){_0x30f6b3[_0x1126('0x1c')](0x194);}return _0x3a9bed;};}function handleError(_0x36d254,_0x526ca1){_0x526ca1=_0x526ca1||0x1f4;return function(_0x29ab60){logger[_0x1126('0x1d')](_0x29ab60['stack']);if(_0x29ab60[_0x1126('0x1e')]){delete _0x29ab60['name'];}_0x36d254['status'](_0x526ca1)['send'](_0x29ab60);};}exports[_0x1126('0x1f')]=function(_0x15bcc3,_0x329914){var _0x34bcf1={};var _0x566c09={'count':0x0,'rows':[]};var _0x1b07a7=_[_0x1126('0x20')](db[_0x1126('0x21')]['rawAttributes'],function(_0x35eec3){return{'name':_0x35eec3[_0x1126('0x22')],'type':_0x35eec3[_0x1126('0x23')]['key']};});_0x34bcf1=qs['getOptions'](_0x1b07a7,_0x15bcc3);var _0xeb7d89={'where':_0x34bcf1[_0x1126('0x24')]};return db['FaxQueue'][_0x1126('0x13')](_0xeb7d89)[_0x1126('0x17')](function(_0x4a334a){_0x566c09[_0x1126('0x13')]=_0x4a334a;_0x34bcf1['include']=qs[_0x1126('0x25')](_0x15bcc3['query']);return db[_0x1126('0x21')]['findAll'](_0x34bcf1);})[_0x1126('0x17')](function(_0x5f2611){_0x566c09['rows']=_0x5f2611;return _0x566c09;})['then'](respondWithFilteredResult(_0x329914,_0x34bcf1))[_0x1126('0x26')](handleError(_0x329914,null));};exports[_0x1126('0x27')]=function(_0x1cef48,_0x5b8bea){var _0x2a3055={'raw':!![],'where':{'id':_0x1cef48['params']['id']}},_0x226afb={};_0x226afb[_0x1126('0x28')]=_[_0x1126('0x29')](db[_0x1126('0x21')][_0x1126('0x2a')]);_0x226afb['query']=_['keys'](_0x1cef48[_0x1126('0x2b')]);_0x226afb[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0x226afb[_0x1126('0x28')],_0x226afb['query']);_0x2a3055[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x226afb[_0x1126('0x28')],qs[_0x1126('0x2f')](_0x1cef48[_0x1126('0x2b')]['fields']));_0x2a3055[_0x1126('0x2e')]=_0x2a3055[_0x1126('0x2e')][_0x1126('0x30')]?_0x2a3055[_0x1126('0x2e')]:_0x226afb['model'];if(_0x1cef48['query'][_0x1126('0x31')]){_0x2a3055[_0x1126('0x25')]=[{'all':!![]}];}_0x2a3055=_['merge']({},_0x2a3055,_0x1cef48[_0x1126('0x32')]);return db[_0x1126('0x21')][_0x1126('0x33')](_0x2a3055)['then'](handleEntityNotFound(_0x5b8bea,null))['then'](respondWithResult(_0x5b8bea,null))[_0x1126('0x26')](handleError(_0x5b8bea,null));};exports[_0x1126('0x34')]=function(_0x3aa08f,_0x156554){return db['FaxQueue'][_0x1126('0x34')](_0x3aa08f['body'],{})[_0x1126('0x17')](function(_0x20e43a){var _0xfa96e0=_0x3aa08f[_0x1126('0x35')][_0x1126('0x19')]({'plain':!![]});if(!_0xfa96e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfa96e0[_0x1126('0x36')]===_0x1126('0x35')){var _0x2939a9=_0x20e43a[_0x1126('0x19')]({'plain':!![]});var _0x3469a2=_0x1126('0x1a');return db[_0x1126('0x37')]['find']({'where':{'name':_0x3469a2,'userProfileId':_0xfa96e0[_0x1126('0x38')]},'raw':!![]})[_0x1126('0x17')](function(_0x227a6b){if(_0x227a6b&&_0x227a6b[_0x1126('0x39')]===0x0){return db[_0x1126('0x1b')]['create']({'name':_0x2939a9['name'],'resourceId':_0x2939a9['id'],'type':_0x227a6b[_0x1126('0x1e')],'sectionId':_0x227a6b['id']},{})[_0x1126('0x17')](function(){return _0x20e43a;});}else{return _0x20e43a;}})[_0x1126('0x26')](function(_0x21c38e){logger[_0x1126('0x1d')](_0x1126('0x3a'),_0x21c38e);throw _0x21c38e;});}return _0x20e43a;})['then'](respondWithResult(_0x156554,0xc9))['catch'](handleError(_0x156554,null));};exports['update']=function(_0xb8054e,_0x5d4194){if(_0xb8054e[_0x1126('0x3b')]['id']){delete _0xb8054e[_0x1126('0x3b')]['id'];}return db[_0x1126('0x21')][_0x1126('0x33')]({'where':{'id':_0xb8054e['params']['id']}})['then'](handleEntityNotFound(_0x5d4194,null))[_0x1126('0x17')](saveUpdates(_0xb8054e[_0x1126('0x3b')],null))[_0x1126('0x17')](respondWithResult(_0x5d4194,null))['catch'](handleError(_0x5d4194,null));};exports[_0x1126('0x18')]=function(_0x5f35fa,_0x3a5f20){return db['FaxQueue'][_0x1126('0x33')]({'where':{'id':_0x5f35fa[_0x1126('0x3c')]['id']}})[_0x1126('0x17')](handleEntityNotFound(_0x3a5f20,null))['then'](removeEntity(_0x3a5f20,null))[_0x1126('0x26')](handleError(_0x3a5f20,null));};exports[_0x1126('0x3d')]=function(_0xf8ec5f,_0x48c694){return db['FaxQueue']['describe']()[_0x1126('0x17')](respondWithResult(_0x48c694,null))['catch'](handleError(_0x48c694,null));};exports[_0x1126('0x3e')]=function(_0x507568,_0x2f45b9){var _0x323499={'raw':!![],'where':{}},_0x146066={},_0x120de1;return db[_0x1126('0x21')]['findOne']({'where':{'id':_0x507568[_0x1126('0x3c')]['id']}})[_0x1126('0x17')](handleEntityNotFound(_0x2f45b9,null))['then'](function(_0x1a15f8){if(_0x1a15f8){_0x120de1=_0x1a15f8[_0x1126('0x19')]({'plain':!![]});_0x146066['model']=_[_0x1126('0x29')](db[_0x1126('0x3f')]['rawAttributes']);_0x146066[_0x1126('0x2b')]=_[_0x1126('0x29')](_0x507568[_0x1126('0x2b')]);_0x146066['filters']=_[_0x1126('0x2d')](_0x146066[_0x1126('0x28')],_0x146066[_0x1126('0x2b')]);_0x323499[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x146066[_0x1126('0x28')],qs[_0x1126('0x2f')](_0x507568[_0x1126('0x2b')]['fields']));_0x323499[_0x1126('0x2e')]=_0x323499['attributes'][_0x1126('0x30')]?_0x323499[_0x1126('0x2e')]:_0x146066['model'];if(!_0x507568['query'][_0x1126('0x40')](_0x1126('0x41'))){_0x323499[_0x1126('0x12')]=qs['limit'](_0x507568[_0x1126('0x2b')][_0x1126('0x12')]);_0x323499[_0x1126('0x10')]=qs[_0x1126('0x10')](_0x507568['query'][_0x1126('0x10')]);}_0x323499[_0x1126('0x42')]=qs['sort'](_0x507568['query']['sort']);_0x323499['where']=qs[_0x1126('0x2c')](_[_0x1126('0x43')](_0x507568['query'],_0x146066[_0x1126('0x2c')]));_0x323499[_0x1126('0x24')][_0x1126('0x44')]=_0x1a15f8['id'];if(_0x507568[_0x1126('0x2b')][_0x1126('0x45')]){_0x323499['where']=_[_0x1126('0x46')](_0x323499[_0x1126('0x24')],{'$or':_['map'](_0x323499[_0x1126('0x2e')],function(_0x476aca){var _0xcc9499={};_0xcc9499[_0x476aca]={'$like':'%'+_0x507568[_0x1126('0x2b')][_0x1126('0x45')]+'%'};return _0xcc9499;})});}_0x323499=_['merge']({},_0x323499,_0x507568[_0x1126('0x32')]);return db['UserFaxQueue'][_0x1126('0x47')](_0x323499);}})[_0x1126('0x17')](function(_0x33c971){if(_0x33c971){return db['User'][_0x1126('0x48')]({'where':{'id':_[_0x1126('0x20')](_0x33c971,'UserId'),'role':_0x1126('0x49')},'attributes':['id',_0x1126('0x1e'),_0x1126('0x4a'),'updatedAt',_0x1126('0x4b')]});}})[_0x1126('0x17')](function(_0x22ab18){if(_0x22ab18){return{'count':_0x22ab18[_0x1126('0x13')],'rows':_[_0x1126('0x20')](_0x22ab18[_0x1126('0x4c')],function(_0x30c848){return{'membername':_0x30c848[_0x1126('0x1e')],'UserId':_0x30c848['id'],'queue_name':_0x120de1['name'],'FaxQueueId':_0x120de1['id'],'interface':util[_0x1126('0x4d')](_0x1126('0x4e'),_0x1126('0x4f'),_0x30c848[_0x1126('0x1e')]),'penalty':0x0,'paused':_0x30c848[_0x1126('0x4a')],'createdAt':_0x30c848['createdAt'],'updatedAt':_0x30c848[_0x1126('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1126('0x17')](respondWithFilteredResult(_0x2f45b9,_0x323499))['catch'](handleError(_0x2f45b9,null));};exports[_0x1126('0x51')]=function(_0x5246aa,_0x272274){var _0x10ff91={};var _0x478806={};var _0x3062d6;var _0x21d4ef;return db[_0x1126('0x21')]['findOne']({'where':{'id':_0x5246aa[_0x1126('0x3c')]['id']}})['then'](handleEntityNotFound(_0x272274,null))['then'](function(_0xbdc58){if(_0xbdc58){_0x3062d6=_0xbdc58;_0x478806[_0x1126('0x28')]=_[_0x1126('0x29')](db[_0x1126('0x52')][_0x1126('0x2a')]);_0x478806[_0x1126('0x2b')]=_[_0x1126('0x29')](_0x5246aa['query']);_0x478806[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0x478806[_0x1126('0x28')],_0x478806[_0x1126('0x2b')]);_0x10ff91[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x478806['model'],qs['fields'](_0x5246aa[_0x1126('0x2b')][_0x1126('0x2f')]));_0x10ff91['attributes']=_0x10ff91['attributes']['length']?_0x10ff91['attributes']:_0x478806[_0x1126('0x28')];_0x10ff91[_0x1126('0x42')]=qs[_0x1126('0x53')](_0x5246aa['query'][_0x1126('0x53')]);_0x10ff91[_0x1126('0x24')]=qs[_0x1126('0x2c')](_[_0x1126('0x43')](_0x5246aa[_0x1126('0x2b')],_0x478806[_0x1126('0x2c')]));if(_0x5246aa[_0x1126('0x2b')]['filter']){_0x10ff91[_0x1126('0x24')]=_[_0x1126('0x46')](_0x10ff91[_0x1126('0x24')],{'$or':_[_0x1126('0x20')](_0x10ff91[_0x1126('0x2e')],function(_0x56c003){var _0x5d758d={};_0x5d758d[_0x56c003]={'$like':'%'+_0x5246aa[_0x1126('0x2b')][_0x1126('0x45')]+'%'};return _0x5d758d;})});}_0x10ff91=_['merge']({},_0x10ff91,_0x5246aa[_0x1126('0x32')]);return _0x3062d6[_0x1126('0x51')](_0x10ff91);}})[_0x1126('0x17')](function(_0x6a41c0){if(_0x6a41c0){_0x21d4ef=_0x6a41c0[_0x1126('0x30')];if(!_0x5246aa[_0x1126('0x2b')][_0x1126('0x40')](_0x1126('0x41'))){_0x10ff91[_0x1126('0x12')]=qs[_0x1126('0x12')](_0x5246aa[_0x1126('0x2b')][_0x1126('0x12')]);_0x10ff91[_0x1126('0x10')]=qs['offset'](_0x5246aa[_0x1126('0x2b')][_0x1126('0x10')]);}return _0x3062d6[_0x1126('0x51')](_0x10ff91);}})['then'](function(_0x484881){if(_0x484881){return _0x484881?{'count':_0x21d4ef,'rows':_0x484881}:null;}})[_0x1126('0x17')](respondWithResult(_0x272274,null))[_0x1126('0x26')](handleError(_0x272274,null));};exports[_0x1126('0x54')]=function(_0x3bfeb8,_0x51929e){var _0x590ee9=_0x3bfeb8['body'][_0x1126('0x55')];return db[_0x1126('0x52')][_0x1126('0x47')]({'where':{'id':_0x590ee9},'attributes':['id'],'include':[{'model':db[_0x1126('0x56')],'as':'Agents','attributes':['id',_0x1126('0x1e'),'online',_0x1126('0x57'),_0x1126('0x58')],'raw':!![]}]})[_0x1126('0x17')](function(_0xe8bda7){if(_0xe8bda7){var _0x3263cf=_[_0x1126('0x59')](_0xe8bda7,function(_0x9a61b1){var _0x5f5a36=_0x9a61b1[_0x1126('0x19')]({'plain':!![]});return _0x5f5a36['Agents'];});return db[_0x1126('0x21')][_0x1126('0x33')]({'where':{'id':_0x3bfeb8['params']['id']}})[_0x1126('0x17')](function(_0x372fbe){return db['sequelize'][_0x1126('0x5a')](function(_0x1442ab){return _0x372fbe['addTeams'](_0x590ee9,{'transaction':_0x1442ab})['then'](function(){return BPromise[_0x1126('0x5b')](_0x3263cf,function(_0xa27290){return db[_0x1126('0x3f')]['findOrCreate']({'where':{'UserId':_0xa27290['id'],'FaxQueueId':_0x3bfeb8['params']['id']},'transaction':_0x1442ab});});})['then'](function(){_0x3263cf[_0x1126('0x5c')](function(_0x4e5b01){socket['emit'](_0x1126('0x5d'),{'UserId':_0x4e5b01['id'],'FaxQueueId':_0x372fbe['id']});});});});});}})['then'](respondWithStatusCode(_0x51929e,null))[_0x1126('0x26')](handleError(_0x51929e,null));};exports[_0x1126('0x5e')]=function(_0x51ccdc,_0x133075){return db[_0x1126('0x52')][_0x1126('0x47')]({'where':{'id':_0x51ccdc[_0x1126('0x2b')][_0x1126('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1126('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x1126('0x17')](handleEntityNotFound(_0x133075,null))['then'](function(_0xd182b1){var _0x2d6fcf=_[_0x1126('0x20')](_0xd182b1,'id');var _0x2af2d0=[];var _0x2598a7=[];var _0x2cf3b9=squel[_0x1126('0x60')]();_0x2cf3b9[_0x1126('0x61')](_0x1126('0x62'))[_0x1126('0x63')](_0x1126('0x64'),'tq')[_0x1126('0x65')](_0x1126('0x66'),'ut',_0x1126('0x67'))[_0x1126('0x24')](_0x1126('0x68'),_0x51ccdc['params']['id']);for(var _0x31cfb5=0x0;_0x31cfb5<_0xd182b1[_0x1126('0x30')];_0x31cfb5+=0x1){let _0x33cccf=_0xd182b1[_0x31cfb5];for(var _0x1483f4=0x0;_0x1483f4<_0x33cccf[_0x1126('0x5f')]['length'];_0x1483f4+=0x1){let _0xd11e1f=_0x33cccf['Agents'][_0x1483f4];var _0x5bdb30=_0x2cf3b9[_0x1126('0x69')]();_0x5bdb30[_0x1126('0x24')]('ut.UserId\x20=\x20?',_0xd11e1f['id']);_0x2598a7['push'](db[_0x1126('0x6a')][_0x1126('0x2b')](_0x5bdb30[_0x1126('0x6b')](),{'type':db[_0x1126('0x6a')][_0x1126('0x6c')][_0x1126('0x6d')]})[_0x1126('0x17')](function(_0x35a9a4){if(_0x35a9a4[_0x1126('0x30')]===0x1){return _0xd11e1f['id'];}else{var _0x5644ea=_[_0x1126('0x6e')](_[_0x1126('0x20')](_0x35a9a4,_0x1126('0x6f')),function(_0xc69f7c){return _[_0x1126('0x70')](_0x2d6fcf,_0xc69f7c);});if(_0x5644ea){return _0xd11e1f['id'];}}}));}}return BPromise[_0x1126('0x71')](_0x2598a7)['then'](function(_0xadea7b){_0x2af2d0=_(_0x2af2d0)[_0x1126('0x72')](_0xadea7b)[_0x1126('0x73')]()[_0x1126('0x74')]();return db[_0x1126('0x21')][_0x1126('0x33')]({'where':{'id':_0x51ccdc[_0x1126('0x3c')]['id']}})[_0x1126('0x17')](function(_0x38eac6){return db[_0x1126('0x6a')]['transaction'](function(_0x50238d){return _0x38eac6[_0x1126('0x5e')](_0x51ccdc['query'][_0x1126('0x55')],{'transaction':_0x50238d})['then'](function(){if(!_[_0x1126('0x75')](_0x2af2d0)){return _0x38eac6['removeAgents'](_0x2af2d0,{'transaction':_0x50238d});}})[_0x1126('0x17')](function(){_0x2af2d0['forEach'](function(_0x5c5044){socket['emit'](_0x1126('0x76'),{'UserId':_0x5c5044,'FaxQueueId':_0x38eac6['id']});});});});});});})[_0x1126('0x17')](respondWithStatusCode(_0x133075,null))['catch'](handleError(_0x133075,null));};exports['addAgents']=function(_0x44325d,_0xe2f82d){return db[_0x1126('0x21')]['find']({'where':{'id':_0x44325d['params']['id']}})[_0x1126('0x17')](handleEntityNotFound(_0xe2f82d,null))['then'](function(_0x41679a){if(_0x41679a){return _0x41679a[_0x1126('0x77')](_0x44325d[_0x1126('0x3b')][_0x1126('0x55')],_[_0x1126('0x78')](_0x44325d['body'],['ids','id'])||{})[_0x1126('0x79')](function(_0xd808db){for(var _0xfc9fb4=0x0;_0xfc9fb4<_0x44325d[_0x1126('0x3b')][_0x1126('0x55')][_0x1126('0x30')];_0xfc9fb4+=0x1){socket[_0x1126('0x7a')](_0x1126('0x5d'),{'UserId':Number(_0x44325d[_0x1126('0x3b')][_0x1126('0x55')][_0xfc9fb4]),'FaxQueueId':Number(_0x44325d[_0x1126('0x3c')]['id'])});}return _0xd808db;});}})['then'](respondWithResult(_0xe2f82d,null))[_0x1126('0x26')](handleError(_0xe2f82d,null));};exports['removeAgents']=function(_0x99eb4e,_0x4ec8b9){return db[_0x1126('0x21')][_0x1126('0x33')]({'where':{'id':_0x99eb4e[_0x1126('0x3c')]['id']}})[_0x1126('0x17')](handleEntityNotFound(_0x4ec8b9,null))['then'](function(_0x429183){if(_0x429183){return _0x429183[_0x1126('0x7b')](_0x99eb4e['query']['ids'])[_0x1126('0x17')](function(){if(_[_0x1126('0x7c')](_0x99eb4e[_0x1126('0x2b')]['ids'])){for(var _0x8e044c=0x0;_0x8e044c<_0x99eb4e['query'][_0x1126('0x55')][_0x1126('0x30')];_0x8e044c+=0x1){socket['emit'](_0x1126('0x76'),{'UserId':Number(_0x99eb4e[_0x1126('0x2b')][_0x1126('0x55')][_0x8e044c]),'FaxQueueId':Number(_0x99eb4e[_0x1126('0x3c')]['id'])});}}else{socket[_0x1126('0x7a')]('userFaxQueue:remove',{'UserId':Number(_0x99eb4e[_0x1126('0x2b')][_0x1126('0x55')]),'FaxQueueId':Number(_0x99eb4e[_0x1126('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ec8b9,null))['catch'](handleError(_0x4ec8b9,null));};exports['getAgents']=function(_0x9d7607,_0x463051){var _0x1a7c9b={};var _0x2a1b22={};var _0x4fcca3;var _0x101553;return db[_0x1126('0x21')][_0x1126('0x7d')]({'where':{'id':_0x9d7607[_0x1126('0x3c')]['id']}})[_0x1126('0x17')](handleEntityNotFound(_0x463051,null))['then'](function(_0x1d5379){if(_0x1d5379){_0x4fcca3=_0x1d5379;_0x2a1b22[_0x1126('0x28')]=_['keys'](db[_0x1126('0x56')]['rawAttributes']);_0x2a1b22['query']=_[_0x1126('0x29')](_0x9d7607['query']);_0x2a1b22[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0x2a1b22[_0x1126('0x28')],_0x2a1b22[_0x1126('0x2b')]);_0x1a7c9b[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x2a1b22[_0x1126('0x28')],qs[_0x1126('0x2f')](_0x9d7607[_0x1126('0x2b')]['fields']));_0x1a7c9b[_0x1126('0x2e')]=_0x1a7c9b[_0x1126('0x2e')][_0x1126('0x30')]?_0x1a7c9b[_0x1126('0x2e')]:_0x2a1b22['model'];_0x1a7c9b[_0x1126('0x42')]=qs[_0x1126('0x53')](_0x9d7607[_0x1126('0x2b')][_0x1126('0x53')]);_0x1a7c9b['where']=qs['filters'](_['pick'](_0x9d7607[_0x1126('0x2b')],_0x2a1b22['filters']));if(_0x9d7607[_0x1126('0x2b')][_0x1126('0x45')]){_0x1a7c9b['where']=_['merge'](_0x1a7c9b[_0x1126('0x24')],{'$or':_[_0x1126('0x20')](_0x1a7c9b['attributes'],function(_0x1e4172){var _0x1f9a7c={};_0x1f9a7c[_0x1e4172]={'$like':'%'+_0x9d7607['query'][_0x1126('0x45')]+'%'};return _0x1f9a7c;})});}_0x1a7c9b=_['merge']({},_0x1a7c9b,_0x9d7607[_0x1126('0x32')]);return _0x4fcca3[_0x1126('0x7e')](_0x1a7c9b);}})[_0x1126('0x17')](function(_0x4b65d8){if(_0x4b65d8){_0x101553=_0x4b65d8[_0x1126('0x30')];if(!_0x9d7607[_0x1126('0x2b')][_0x1126('0x40')](_0x1126('0x41'))){_0x1a7c9b[_0x1126('0x12')]=qs[_0x1126('0x12')](_0x9d7607[_0x1126('0x2b')][_0x1126('0x12')]);_0x1a7c9b[_0x1126('0x10')]=qs[_0x1126('0x10')](_0x9d7607[_0x1126('0x2b')][_0x1126('0x10')]);}return _0x4fcca3[_0x1126('0x7e')](_0x1a7c9b);}})[_0x1126('0x17')](function(_0x12ffa5){if(_0x12ffa5){return _0x12ffa5?{'count':_0x101553,'rows':_0x12ffa5}:null;}})[_0x1126('0x17')](respondWithResult(_0x463051,null))[_0x1126('0x26')](handleError(_0x463051,null));}; \ No newline at end of file +var _0x9541=['body','describe','getMembers','findOne','UserFaxQueue','nolimit','limit','order','sort','filters','pick','FaxQueueId','filter','User','createdAt','format','%s/%s','SIP','faxPause','updatedAt','getTeams','Team','length','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','emit','userFaxQueue:save','select','field','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','all','union','removeTeams','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','send','index','map','FaxQueue','rawAttributes','type','key','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x9541,0xb3));var _0x1954=function(_0xf75976,_0x4db597){_0xf75976=_0xf75976-0x0;var _0x1da48b=_0x9541[_0xf75976];return _0x1da48b;};'use strict';var BPromise=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var _=require(_0x1954('0x2'));var squel=require(_0x1954('0x3'));var Redis=require(_0x1954('0x4'));var qs=require(_0x1954('0x5'));var logger=require(_0x1954('0x6'))(_0x1954('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1954('0x8')]=_[_0x1954('0x9')](config['redis'],{'host':_0x1954('0xa'),'port':0x18eb});var socket=require(_0x1954('0xb'))(new Redis(config[_0x1954('0x8')]));require(_0x1954('0xc'))[_0x1954('0xd')](socket);function respondWithStatusCode(_0xa7a784,_0x5d95b1){_0x5d95b1=_0x5d95b1||0xcc;return function(_0x22752d){if(_0x22752d){return _0xa7a784[_0x1954('0xe')](_0x5d95b1);}return _0xa7a784[_0x1954('0xf')](_0x5d95b1)[_0x1954('0x10')]();};}function respondWithResult(_0x40bbfb,_0x1733f8){_0x1733f8=_0x1733f8||0xc8;return function(_0x2f711d){if(_0x2f711d){return _0x40bbfb[_0x1954('0xf')](_0x1733f8)['json'](_0x2f711d);}};}function respondWithFilteredResult(_0x39e5fe,_0x2e1fb4){return function(_0x51a041){if(_0x51a041){var _0x267cfc=typeof _0x2e1fb4['offset']===_0x1954('0x11')&&typeof _0x2e1fb4['limit']==='undefined';var _0x5bfd52=_0x51a041[_0x1954('0x12')];var _0x1b33cb=_0x267cfc?0x0:_0x2e1fb4[_0x1954('0x13')];var _0x520dc7=_0x267cfc?_0x51a041[_0x1954('0x12')]:_0x2e1fb4['offset']+_0x2e1fb4['limit'];var _0xaeb0e3;if(_0x520dc7>=_0x5bfd52){_0x520dc7=_0x5bfd52;_0xaeb0e3=0xc8;}else{_0xaeb0e3=0xce;}_0x39e5fe[_0x1954('0xf')](_0xaeb0e3);return _0x39e5fe[_0x1954('0x14')](_0x1954('0x15'),_0x1b33cb+'-'+_0x520dc7+'/'+_0x5bfd52)[_0x1954('0x16')](_0x51a041);}return null;};}function saveUpdates(_0x37f4fc){return function(_0x166641){if(_0x166641){return _0x166641[_0x1954('0x17')](_0x37f4fc)[_0x1954('0x18')](function(_0xb9c2cd){return _0xb9c2cd;});}return null;};}function removeEntity(_0xc8cb0b){return function(_0x3da757){if(_0x3da757){return _0x3da757[_0x1954('0x19')]()[_0x1954('0x18')](function(){var _0x1db9f1=_0x3da757[_0x1954('0x1a')]({'plain':!![]});var _0x286ff1=_0x1954('0x1b');return db[_0x1954('0x1c')][_0x1954('0x19')]({'where':{'type':_0x286ff1,'resourceId':_0x1db9f1['id']}})['then'](function(){return _0x3da757;});})[_0x1954('0x18')](function(){_0xc8cb0b[_0x1954('0xf')](0xcc)[_0x1954('0x10')]();});}};}function handleEntityNotFound(_0x4455be){return function(_0x193f8f){if(!_0x193f8f){_0x4455be['sendStatus'](0x194);}return _0x193f8f;};}function handleError(_0x61107d,_0x15dd0b){_0x15dd0b=_0x15dd0b||0x1f4;return function(_0x5ea2c3){logger[_0x1954('0x1d')](_0x5ea2c3[_0x1954('0x1e')]);if(_0x5ea2c3['name']){delete _0x5ea2c3['name'];}_0x61107d[_0x1954('0xf')](_0x15dd0b)[_0x1954('0x1f')](_0x5ea2c3);};}exports[_0x1954('0x20')]=function(_0x406699,_0x5c1b19){var _0x21f395={};var _0x26484f={'count':0x0,'rows':[]};var _0x27dc66=_[_0x1954('0x21')](db[_0x1954('0x22')][_0x1954('0x23')],function(_0x46fdc1){return{'name':_0x46fdc1['fieldName'],'type':_0x46fdc1[_0x1954('0x24')][_0x1954('0x25')]};});_0x21f395=qs['getOptions'](_0x27dc66,_0x406699);var _0x14e94e={'where':_0x21f395[_0x1954('0x26')]};return db[_0x1954('0x22')][_0x1954('0x12')](_0x14e94e)[_0x1954('0x18')](function(_0x251386){_0x26484f[_0x1954('0x12')]=_0x251386;_0x21f395[_0x1954('0x27')]=qs[_0x1954('0x27')](_0x406699[_0x1954('0x28')]);return db[_0x1954('0x22')][_0x1954('0x29')](_0x21f395);})[_0x1954('0x18')](function(_0x22509c){_0x26484f[_0x1954('0x2a')]=_0x22509c;return _0x26484f;})[_0x1954('0x18')](respondWithFilteredResult(_0x5c1b19,_0x21f395))[_0x1954('0x2b')](handleError(_0x5c1b19,null));};exports[_0x1954('0x2c')]=function(_0x109312,_0x24032d){var _0x1bcf3a={'raw':!![],'where':{'id':_0x109312[_0x1954('0x2d')]['id']}},_0x2fe88d={};_0x2fe88d[_0x1954('0x2e')]=_['keys'](db['FaxQueue'][_0x1954('0x23')]);_0x2fe88d['query']=_[_0x1954('0x2f')](_0x109312[_0x1954('0x28')]);_0x2fe88d['filters']=_[_0x1954('0x30')](_0x2fe88d[_0x1954('0x2e')],_0x2fe88d['query']);_0x1bcf3a['attributes']=_[_0x1954('0x30')](_0x2fe88d[_0x1954('0x2e')],qs[_0x1954('0x31')](_0x109312[_0x1954('0x28')][_0x1954('0x31')]));_0x1bcf3a[_0x1954('0x32')]=_0x1bcf3a[_0x1954('0x32')]['length']?_0x1bcf3a['attributes']:_0x2fe88d[_0x1954('0x2e')];if(_0x109312[_0x1954('0x28')][_0x1954('0x33')]){_0x1bcf3a[_0x1954('0x27')]=[{'all':!![]}];}_0x1bcf3a=_[_0x1954('0x34')]({},_0x1bcf3a,_0x109312[_0x1954('0x35')]);return db['FaxQueue'][_0x1954('0x36')](_0x1bcf3a)[_0x1954('0x18')](handleEntityNotFound(_0x24032d,null))['then'](respondWithResult(_0x24032d,null))[_0x1954('0x2b')](handleError(_0x24032d,null));};exports[_0x1954('0x37')]=function(_0x524eeb,_0x580990){return db[_0x1954('0x22')][_0x1954('0x37')](_0x524eeb['body'],{})[_0x1954('0x18')](function(_0x341681){var _0x13725c=_0x524eeb[_0x1954('0x38')]['get']({'plain':!![]});if(!_0x13725c)throw new Error(_0x1954('0x39'));if(_0x13725c['role']===_0x1954('0x38')){var _0x3c3e3f=_0x341681[_0x1954('0x1a')]({'plain':!![]});var _0x57812c=_0x1954('0x1b');return db[_0x1954('0x3a')][_0x1954('0x36')]({'where':{'name':_0x57812c,'userProfileId':_0x13725c[_0x1954('0x3b')]},'raw':!![]})[_0x1954('0x18')](function(_0x517492){if(_0x517492&&_0x517492[_0x1954('0x3c')]===0x0){return db['UserProfileResource'][_0x1954('0x37')]({'name':_0x3c3e3f['name'],'resourceId':_0x3c3e3f['id'],'type':_0x517492[_0x1954('0x3d')],'sectionId':_0x517492['id']},{})[_0x1954('0x18')](function(){return _0x341681;});}else{return _0x341681;}})[_0x1954('0x2b')](function(_0x4334f9){logger['error'](_0x1954('0x3e'),_0x4334f9);throw _0x4334f9;});}return _0x341681;})['then'](respondWithResult(_0x580990,0xc9))[_0x1954('0x2b')](handleError(_0x580990,null));};exports[_0x1954('0x17')]=function(_0x59c4cb,_0x1dede8){if(_0x59c4cb[_0x1954('0x3f')]['id']){delete _0x59c4cb[_0x1954('0x3f')]['id'];}return db[_0x1954('0x22')][_0x1954('0x36')]({'where':{'id':_0x59c4cb[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](handleEntityNotFound(_0x1dede8,null))[_0x1954('0x18')](saveUpdates(_0x59c4cb[_0x1954('0x3f')],null))['then'](respondWithResult(_0x1dede8,null))['catch'](handleError(_0x1dede8,null));};exports['destroy']=function(_0x259a45,_0x55f465){return db[_0x1954('0x22')][_0x1954('0x36')]({'where':{'id':_0x259a45[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](handleEntityNotFound(_0x55f465,null))[_0x1954('0x18')](removeEntity(_0x55f465,null))[_0x1954('0x2b')](handleError(_0x55f465,null));};exports[_0x1954('0x40')]=function(_0x439862,_0x15243c){return db['FaxQueue']['describe']()[_0x1954('0x18')](respondWithResult(_0x15243c,null))['catch'](handleError(_0x15243c,null));};exports[_0x1954('0x41')]=function(_0x4e0359,_0x109b3e){var _0x8aeb7={'raw':!![],'where':{}},_0x231c42={},_0x3ab299;return db[_0x1954('0x22')][_0x1954('0x42')]({'where':{'id':_0x4e0359[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](handleEntityNotFound(_0x109b3e,null))[_0x1954('0x18')](function(_0x2dd24d){if(_0x2dd24d){_0x3ab299=_0x2dd24d['get']({'plain':!![]});_0x231c42[_0x1954('0x2e')]=_[_0x1954('0x2f')](db[_0x1954('0x43')][_0x1954('0x23')]);_0x231c42['query']=_[_0x1954('0x2f')](_0x4e0359[_0x1954('0x28')]);_0x231c42['filters']=_[_0x1954('0x30')](_0x231c42['model'],_0x231c42[_0x1954('0x28')]);_0x8aeb7[_0x1954('0x32')]=_[_0x1954('0x30')](_0x231c42[_0x1954('0x2e')],qs[_0x1954('0x31')](_0x4e0359[_0x1954('0x28')][_0x1954('0x31')]));_0x8aeb7['attributes']=_0x8aeb7[_0x1954('0x32')]['length']?_0x8aeb7[_0x1954('0x32')]:_0x231c42[_0x1954('0x2e')];if(!_0x4e0359[_0x1954('0x28')]['hasOwnProperty'](_0x1954('0x44'))){_0x8aeb7[_0x1954('0x45')]=qs[_0x1954('0x45')](_0x4e0359[_0x1954('0x28')][_0x1954('0x45')]);_0x8aeb7['offset']=qs[_0x1954('0x13')](_0x4e0359[_0x1954('0x28')][_0x1954('0x13')]);}_0x8aeb7[_0x1954('0x46')]=qs[_0x1954('0x47')](_0x4e0359['query'][_0x1954('0x47')]);_0x8aeb7[_0x1954('0x26')]=qs[_0x1954('0x48')](_[_0x1954('0x49')](_0x4e0359[_0x1954('0x28')],_0x231c42[_0x1954('0x48')]));_0x8aeb7[_0x1954('0x26')][_0x1954('0x4a')]=_0x2dd24d['id'];if(_0x4e0359[_0x1954('0x28')]['filter']){_0x8aeb7[_0x1954('0x26')]=_[_0x1954('0x34')](_0x8aeb7[_0x1954('0x26')],{'$or':_[_0x1954('0x21')](_0x8aeb7[_0x1954('0x32')],function(_0x2e2943){var _0x1fa09b={};_0x1fa09b[_0x2e2943]={'$like':'%'+_0x4e0359[_0x1954('0x28')][_0x1954('0x4b')]+'%'};return _0x1fa09b;})});}_0x8aeb7=_[_0x1954('0x34')]({},_0x8aeb7,_0x4e0359[_0x1954('0x35')]);return db[_0x1954('0x43')][_0x1954('0x29')](_0x8aeb7);}})[_0x1954('0x18')](function(_0x1ad607){if(_0x1ad607){return db[_0x1954('0x4c')]['findAndCountAll']({'where':{'id':_['map'](_0x1ad607,'UserId'),'role':'agent'},'attributes':['id',_0x1954('0x3d'),'faxPause','updatedAt',_0x1954('0x4d')]});}})[_0x1954('0x18')](function(_0x989a6d){if(_0x989a6d){return{'count':_0x989a6d[_0x1954('0x12')],'rows':_[_0x1954('0x21')](_0x989a6d['rows'],function(_0x4a900c){return{'membername':_0x4a900c[_0x1954('0x3d')],'UserId':_0x4a900c['id'],'queue_name':_0x3ab299[_0x1954('0x3d')],'FaxQueueId':_0x3ab299['id'],'interface':util[_0x1954('0x4e')](_0x1954('0x4f'),_0x1954('0x50'),_0x4a900c[_0x1954('0x3d')]),'penalty':0x0,'paused':_0x4a900c[_0x1954('0x51')],'createdAt':_0x4a900c[_0x1954('0x4d')],'updatedAt':_0x4a900c[_0x1954('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x109b3e,_0x8aeb7))[_0x1954('0x2b')](handleError(_0x109b3e,null));};exports[_0x1954('0x53')]=function(_0xae43df,_0x4e6a10){var _0x2480d2={};var _0x28bca8={};var _0x2d0777;var _0x4ad813;return db[_0x1954('0x22')]['findOne']({'where':{'id':_0xae43df[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](handleEntityNotFound(_0x4e6a10,null))[_0x1954('0x18')](function(_0xb7601d){if(_0xb7601d){_0x2d0777=_0xb7601d;_0x28bca8[_0x1954('0x2e')]=_[_0x1954('0x2f')](db[_0x1954('0x54')][_0x1954('0x23')]);_0x28bca8[_0x1954('0x28')]=_['keys'](_0xae43df[_0x1954('0x28')]);_0x28bca8[_0x1954('0x48')]=_['intersection'](_0x28bca8[_0x1954('0x2e')],_0x28bca8[_0x1954('0x28')]);_0x2480d2[_0x1954('0x32')]=_[_0x1954('0x30')](_0x28bca8['model'],qs[_0x1954('0x31')](_0xae43df[_0x1954('0x28')][_0x1954('0x31')]));_0x2480d2[_0x1954('0x32')]=_0x2480d2[_0x1954('0x32')][_0x1954('0x55')]?_0x2480d2[_0x1954('0x32')]:_0x28bca8[_0x1954('0x2e')];_0x2480d2['order']=qs['sort'](_0xae43df[_0x1954('0x28')]['sort']);_0x2480d2[_0x1954('0x26')]=qs['filters'](_[_0x1954('0x49')](_0xae43df[_0x1954('0x28')],_0x28bca8[_0x1954('0x48')]));if(_0xae43df['query'][_0x1954('0x4b')]){_0x2480d2[_0x1954('0x26')]=_[_0x1954('0x34')](_0x2480d2['where'],{'$or':_['map'](_0x2480d2[_0x1954('0x32')],function(_0x30b981){var _0x466758={};_0x466758[_0x30b981]={'$like':'%'+_0xae43df[_0x1954('0x28')]['filter']+'%'};return _0x466758;})});}_0x2480d2=_[_0x1954('0x34')]({},_0x2480d2,_0xae43df['options']);return _0x2d0777['getTeams'](_0x2480d2);}})['then'](function(_0x3b7520){if(_0x3b7520){_0x4ad813=_0x3b7520[_0x1954('0x55')];if(!_0xae43df[_0x1954('0x28')][_0x1954('0x56')]('nolimit')){_0x2480d2[_0x1954('0x45')]=qs[_0x1954('0x45')](_0xae43df['query'][_0x1954('0x45')]);_0x2480d2[_0x1954('0x13')]=qs[_0x1954('0x13')](_0xae43df[_0x1954('0x28')][_0x1954('0x13')]);}return _0x2d0777['getTeams'](_0x2480d2);}})[_0x1954('0x18')](function(_0x22f6d3){if(_0x22f6d3){return _0x22f6d3?{'count':_0x4ad813,'rows':_0x22f6d3}:null;}})['then'](respondWithResult(_0x4e6a10,null))['catch'](handleError(_0x4e6a10,null));};exports[_0x1954('0x57')]=function(_0x3d2f01,_0x565769){var _0x126ca6=_0x3d2f01[_0x1954('0x3f')][_0x1954('0x58')];return db['Team'][_0x1954('0x29')]({'where':{'id':_0x126ca6},'attributes':['id'],'include':[{'model':db[_0x1954('0x4c')],'as':_0x1954('0x59'),'attributes':['id',_0x1954('0x3d'),_0x1954('0x5a'),_0x1954('0x5b'),'interface'],'raw':!![]}]})[_0x1954('0x18')](function(_0x1bfc1d){if(_0x1bfc1d){var _0x38ef05=_[_0x1954('0x5c')](_0x1bfc1d,function(_0x23c24f){var _0x3ad0d9=_0x23c24f[_0x1954('0x1a')]({'plain':!![]});return _0x3ad0d9[_0x1954('0x59')];});return db[_0x1954('0x22')][_0x1954('0x36')]({'where':{'id':_0x3d2f01[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](function(_0x1e8879){return db[_0x1954('0x5d')][_0x1954('0x5e')](function(_0x3479ef){return _0x1e8879['addTeams'](_0x126ca6,{'transaction':_0x3479ef})['then'](function(){return BPromise[_0x1954('0x5f')](_0x38ef05,function(_0x183efe){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x183efe['id'],'FaxQueueId':_0x3d2f01[_0x1954('0x2d')]['id']},'transaction':_0x3479ef});});})[_0x1954('0x18')](function(){_0x38ef05['forEach'](function(_0xa82f38){socket[_0x1954('0x60')](_0x1954('0x61'),{'UserId':_0xa82f38['id'],'FaxQueueId':_0x1e8879['id']});});});});});}})['then'](respondWithStatusCode(_0x565769,null))['catch'](handleError(_0x565769,null));};exports['removeTeams']=function(_0x5c206f,_0x364c64){return db[_0x1954('0x54')][_0x1954('0x29')]({'where':{'id':_0x5c206f[_0x1954('0x28')][_0x1954('0x58')]},'attributes':['id'],'include':[{'model':db[_0x1954('0x4c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1954('0x18')](handleEntityNotFound(_0x364c64,null))[_0x1954('0x18')](function(_0x38a188){var _0x2d04a0=_['map'](_0x38a188,'id');var _0x16c259=[];var _0x28c0a2=[];var _0x1a7cc7=squel[_0x1954('0x62')]();_0x1a7cc7[_0x1954('0x63')]('tq.TeamId')['from'](_0x1954('0x64'),'tq')[_0x1954('0x65')](_0x1954('0x66'),'ut',_0x1954('0x67'))[_0x1954('0x26')](_0x1954('0x68'),_0x5c206f[_0x1954('0x2d')]['id']);for(var _0x2b1453=0x0;_0x2b1453<_0x38a188[_0x1954('0x55')];_0x2b1453+=0x1){let _0x18553e=_0x38a188[_0x2b1453];for(var _0x2bd8ba=0x0;_0x2bd8ba<_0x18553e[_0x1954('0x59')][_0x1954('0x55')];_0x2bd8ba+=0x1){let _0x3985f5=_0x18553e[_0x1954('0x59')][_0x2bd8ba];var _0x340738=_0x1a7cc7[_0x1954('0x69')]();_0x340738[_0x1954('0x26')](_0x1954('0x6a'),_0x3985f5['id']);_0x28c0a2[_0x1954('0x6b')](db[_0x1954('0x5d')][_0x1954('0x28')](_0x340738[_0x1954('0x6c')](),{'type':db[_0x1954('0x5d')]['QueryTypes']['SELECT']})[_0x1954('0x18')](function(_0x2ac068){if(_0x2ac068['length']===0x1){return _0x3985f5['id'];}else{var _0x38cf87=_[_0x1954('0x6d')](_['map'](_0x2ac068,'TeamId'),function(_0x4ade20){return _['includes'](_0x2d04a0,_0x4ade20);});if(_0x38cf87){return _0x3985f5['id'];}}}));}}return BPromise[_0x1954('0x6e')](_0x28c0a2)[_0x1954('0x18')](function(_0x95a2fb){_0x16c259=_(_0x16c259)[_0x1954('0x6f')](_0x95a2fb)['compact']()['value']();return db[_0x1954('0x22')][_0x1954('0x36')]({'where':{'id':_0x5c206f['params']['id']}})[_0x1954('0x18')](function(_0x25c2f5){return db[_0x1954('0x5d')][_0x1954('0x5e')](function(_0x15be76){return _0x25c2f5[_0x1954('0x70')](_0x5c206f[_0x1954('0x28')][_0x1954('0x58')],{'transaction':_0x15be76})['then'](function(){if(!_[_0x1954('0x71')](_0x16c259)){return _0x25c2f5['removeAgents'](_0x16c259,{'transaction':_0x15be76});}})[_0x1954('0x18')](function(){_0x16c259['forEach'](function(_0x174104){socket['emit'](_0x1954('0x72'),{'UserId':_0x174104,'FaxQueueId':_0x25c2f5['id']});});});});});});})['then'](respondWithStatusCode(_0x364c64,null))[_0x1954('0x2b')](handleError(_0x364c64,null));};exports['addAgents']=function(_0x5161ff,_0x15c502){return db['FaxQueue'][_0x1954('0x36')]({'where':{'id':_0x5161ff['params']['id']}})['then'](handleEntityNotFound(_0x15c502,null))[_0x1954('0x18')](function(_0x456d83){if(_0x456d83){return _0x456d83[_0x1954('0x73')](_0x5161ff[_0x1954('0x3f')][_0x1954('0x58')],_[_0x1954('0x74')](_0x5161ff[_0x1954('0x3f')],['ids','id'])||{})[_0x1954('0x75')](function(_0xf82bfb){for(var _0x16ab2b=0x0;_0x16ab2b<_0x5161ff[_0x1954('0x3f')][_0x1954('0x58')][_0x1954('0x55')];_0x16ab2b+=0x1){socket[_0x1954('0x60')](_0x1954('0x61'),{'UserId':Number(_0x5161ff['body'][_0x1954('0x58')][_0x16ab2b]),'FaxQueueId':Number(_0x5161ff[_0x1954('0x2d')]['id'])});}return _0xf82bfb;});}})['then'](respondWithResult(_0x15c502,null))[_0x1954('0x2b')](handleError(_0x15c502,null));};exports[_0x1954('0x76')]=function(_0x284a27,_0x4b9697){return db[_0x1954('0x22')][_0x1954('0x36')]({'where':{'id':_0x284a27[_0x1954('0x2d')]['id']}})[_0x1954('0x18')](handleEntityNotFound(_0x4b9697,null))['then'](function(_0x19f88c){if(_0x19f88c){return _0x19f88c[_0x1954('0x76')](_0x284a27[_0x1954('0x28')][_0x1954('0x58')])['then'](function(){if(_[_0x1954('0x77')](_0x284a27['query'][_0x1954('0x58')])){for(var _0x17b9e1=0x0;_0x17b9e1<_0x284a27[_0x1954('0x28')]['ids'][_0x1954('0x55')];_0x17b9e1+=0x1){socket[_0x1954('0x60')]('userFaxQueue:remove',{'UserId':Number(_0x284a27[_0x1954('0x28')][_0x1954('0x58')][_0x17b9e1]),'FaxQueueId':Number(_0x284a27[_0x1954('0x2d')]['id'])});}}else{socket[_0x1954('0x60')](_0x1954('0x72'),{'UserId':Number(_0x284a27['query']['ids']),'FaxQueueId':Number(_0x284a27[_0x1954('0x2d')]['id'])});}});}})[_0x1954('0x18')](respondWithStatusCode(_0x4b9697,null))[_0x1954('0x2b')](handleError(_0x4b9697,null));};exports[_0x1954('0x78')]=function(_0x51503f,_0x2d4258){var _0x4a2752={};var _0x9f2f79={};var _0x36ae1b;var _0x44e09e;return db['FaxQueue'][_0x1954('0x42')]({'where':{'id':_0x51503f[_0x1954('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2d4258,null))[_0x1954('0x18')](function(_0x14418b){if(_0x14418b){_0x36ae1b=_0x14418b;_0x9f2f79[_0x1954('0x2e')]=_[_0x1954('0x2f')](db[_0x1954('0x4c')][_0x1954('0x23')]);_0x9f2f79[_0x1954('0x28')]=_[_0x1954('0x2f')](_0x51503f[_0x1954('0x28')]);_0x9f2f79['filters']=_[_0x1954('0x30')](_0x9f2f79[_0x1954('0x2e')],_0x9f2f79[_0x1954('0x28')]);_0x4a2752[_0x1954('0x32')]=_[_0x1954('0x30')](_0x9f2f79[_0x1954('0x2e')],qs[_0x1954('0x31')](_0x51503f[_0x1954('0x28')][_0x1954('0x31')]));_0x4a2752['attributes']=_0x4a2752[_0x1954('0x32')][_0x1954('0x55')]?_0x4a2752[_0x1954('0x32')]:_0x9f2f79[_0x1954('0x2e')];_0x4a2752['order']=qs[_0x1954('0x47')](_0x51503f['query'][_0x1954('0x47')]);_0x4a2752[_0x1954('0x26')]=qs[_0x1954('0x48')](_[_0x1954('0x49')](_0x51503f[_0x1954('0x28')],_0x9f2f79[_0x1954('0x48')]));if(_0x51503f['query']['filter']){_0x4a2752[_0x1954('0x26')]=_[_0x1954('0x34')](_0x4a2752[_0x1954('0x26')],{'$or':_[_0x1954('0x21')](_0x4a2752['attributes'],function(_0x8a2d29){var _0x155d00={};_0x155d00[_0x8a2d29]={'$like':'%'+_0x51503f[_0x1954('0x28')]['filter']+'%'};return _0x155d00;})});}_0x4a2752=_[_0x1954('0x34')]({},_0x4a2752,_0x51503f[_0x1954('0x35')]);return _0x36ae1b[_0x1954('0x78')](_0x4a2752);}})['then'](function(_0x2e88f5){if(_0x2e88f5){_0x44e09e=_0x2e88f5['length'];if(!_0x51503f['query']['hasOwnProperty'](_0x1954('0x44'))){_0x4a2752[_0x1954('0x45')]=qs['limit'](_0x51503f[_0x1954('0x28')][_0x1954('0x45')]);_0x4a2752[_0x1954('0x13')]=qs[_0x1954('0x13')](_0x51503f[_0x1954('0x28')]['offset']);}return _0x36ae1b['getAgents'](_0x4a2752);}})[_0x1954('0x18')](function(_0x5990a1){if(_0x5990a1){return _0x5990a1?{'count':_0x44e09e,'rows':_0x5990a1}:null;}})[_0x1954('0x18')](respondWithResult(_0x2d4258,null))[_0x1954('0x2b')](handleError(_0x2d4258,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a61b20a..5e53167 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 _0xe346=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x27d813,_0x39aa42){var _0x249870=function(_0x58c92b){while(--_0x58c92b){_0x27d813['push'](_0x27d813['shift']());}};_0x249870(++_0x39aa42);}(_0xe346,0x105));var _0x6e34=function(_0x2af569,_0x21d377){_0x2af569=_0x2af569-0x0;var _0x336636=_0xe346[_0x2af569];return _0x336636;};'use strict';var EventEmitter=require(_0x6e34('0x0'));var FaxQueue=require(_0x6e34('0x1'))['db'][_0x6e34('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6e34('0x3')](0x0);var events={'afterCreate':_0x6e34('0x4'),'afterUpdate':_0x6e34('0x5'),'afterDestroy':_0x6e34('0x6')};function emitEvent(_0x5aa653){return function(_0x3c7434,_0x1c6fea,_0x5ecac6){FaxQueueEvents[_0x6e34('0x7')](_0x5aa653+':'+_0x3c7434['id'],_0x3c7434);FaxQueueEvents[_0x6e34('0x7')](_0x5aa653,_0x3c7434);_0x5ecac6(null);};}for(var e in events){if(events[_0x6e34('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x6001=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6001,0x1c3));var _0x1600=function(_0x895ad0,_0xf67203){_0x895ad0=_0x895ad0-0x0;var _0x3d32f9=_0x6001[_0x895ad0];return _0x3d32f9;};'use strict';var EventEmitter=require(_0x1600('0x0'));var FaxQueue=require(_0x1600('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1600('0x2')](0x0);var events={'afterCreate':_0x1600('0x3'),'afterUpdate':_0x1600('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bd976){return function(_0x1d9233,_0x63180a,_0x922a00){FaxQueueEvents['emit'](_0x5bd976+':'+_0x1d9233['id'],_0x1d9233);FaxQueueEvents['emit'](_0x5bd976,_0x1d9233);_0x922a00(null);};}for(var e in events){if(events[_0x1600('0x5')](e)){var event=events[e];FaxQueue[_0x1600('0x6')](e,emitEvent(event));}}module[_0x1600('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 543ceb5..473451c 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 _0x9462=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x5451b7,_0x2b65e9){var _0x4eafb6=function(_0x582cb8){while(--_0x582cb8){_0x5451b7['push'](_0x5451b7['shift']());}};_0x4eafb6(++_0x2b65e9);}(_0x9462,0x8e));var _0x2946=function(_0x2246d8,_0x18d75a){_0x2246d8=_0x2246d8-0x0;var _0x4b6134=_0x9462[_0x2246d8];return _0x4b6134;};'use strict';var _=require(_0x2946('0x0'));var util=require(_0x2946('0x1'));var logger=require(_0x2946('0x2'))(_0x2946('0x3'));var moment=require(_0x2946('0x4'));var BPromise=require(_0x2946('0x5'));var rp=require(_0x2946('0x6'));var fs=require('fs');var path=require(_0x2946('0x7'));var rimraf=require(_0x2946('0x8'));var config=require(_0x2946('0x9'));var attributes=require(_0x2946('0xa'));module[_0x2946('0xb')]=function(_0x35ff91,_0x1d8a81){return _0x35ff91['define'](_0x2946('0xc'),attributes,{'tableName':_0x2946('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9950=['api','moment','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','fax_queues','util','../../config/logger'];(function(_0x475dce,_0x1754ff){var _0x40687a=function(_0xdfa78a){while(--_0xdfa78a){_0x475dce['push'](_0x475dce['shift']());}};_0x40687a(++_0x1754ff);}(_0x9950,0x8a));var _0x0995=function(_0x20f584,_0x1e73a2){_0x20f584=_0x20f584-0x0;var _0x2110cd=_0x9950[_0x20f584];return _0x2110cd;};'use strict';var _=require('lodash');var util=require(_0x0995('0x0'));var logger=require(_0x0995('0x1'))(_0x0995('0x2'));var moment=require(_0x0995('0x3'));var BPromise=require('bluebird');var rp=require(_0x0995('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0995('0x5'));var config=require(_0x0995('0x6'));var attributes=require(_0x0995('0x7'));module[_0x0995('0x8')]=function(_0x8fc1d5,_0x2bc8a4){return _0x8fc1d5['define']('FaxQueue',attributes,{'tableName':_0x0995('0x9'),'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 f4270d6..7b2ff4a 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 _0xfe19=['debug','catch','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','FaxQueue','findAll','options','raw','where','include','map','model','attributes','GetFaxQueue'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0xfe19,0x1b3));var _0x9fe1=function(_0x4e9f12,_0x7122af){_0x4e9f12=_0x4e9f12-0x0;var _0x23aecd=_0xfe19[_0x4e9f12];return _0x23aecd;};'use strict';var _=require(_0x9fe1('0x0'));var util=require(_0x9fe1('0x1'));var moment=require(_0x9fe1('0x2'));var BPromise=require(_0x9fe1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fe1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9fe1('0x5'))('rpc');var config=require(_0x9fe1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9fe1('0x7')][_0x9fe1('0x8')]({'port':0x232a});config[_0x9fe1('0x9')]=_[_0x9fe1('0xa')](config[_0x9fe1('0x9')],{'host':_0x9fe1('0xb'),'port':0x18eb});var socket=require(_0x9fe1('0xc'))(new Redis(config[_0x9fe1('0x9')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x116501,_0x3309c9,_0x2cbeda){return new BPromise(function(_0x4a90ed,_0x31aab4){return client['request'](_0x116501,_0x2cbeda)[_0x9fe1('0xd')](function(_0x1ca76f){logger['info'](_0x9fe1('0xe'),_0x3309c9,_0x9fe1('0xf'));logger['debug'](_0x9fe1('0x10'),_0x3309c9,_0x9fe1('0xf'),JSON[_0x9fe1('0x11')](_0x1ca76f));if(_0x1ca76f[_0x9fe1('0x12')]){if(_0x1ca76f[_0x9fe1('0x12')][_0x9fe1('0x13')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3309c9,_0x1ca76f[_0x9fe1('0x12')][_0x9fe1('0x14')]);return _0x31aab4(_0x1ca76f[_0x9fe1('0x12')][_0x9fe1('0x14')]);}logger[_0x9fe1('0x12')](_0x9fe1('0xe'),_0x3309c9,_0x1ca76f[_0x9fe1('0x12')][_0x9fe1('0x14')]);return _0x4a90ed(_0x1ca76f['error']['message']);}else{logger[_0x9fe1('0x15')](_0x9fe1('0xe'),_0x3309c9,_0x9fe1('0xf'));_0x4a90ed(_0x1ca76f[_0x9fe1('0x16')][_0x9fe1('0x14')]);}})['catch'](function(_0x49af6f){logger[_0x9fe1('0x12')](_0x9fe1('0xe'),_0x3309c9,_0x49af6f);_0x31aab4(_0x49af6f);});});}exports['GetFaxQueue']=function(_0x5b4faa){var _0x3400b8=this;return new Promise(function(_0x4c61dc,_0x51f305){return db[_0x9fe1('0x17')][_0x9fe1('0x18')]({'raw':_0x5b4faa['options']?_0x5b4faa[_0x9fe1('0x19')][_0x9fe1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b4faa['options']?_0x5b4faa['options'][_0x9fe1('0x1b')]||null:null,'attributes':_0x5b4faa[_0x9fe1('0x19')]?_0x5b4faa[_0x9fe1('0x19')]['attributes']||null:null,'limit':_0x5b4faa[_0x9fe1('0x19')]?_0x5b4faa['options']['limit']||null:null,'include':_0x5b4faa[_0x9fe1('0x19')]?_0x5b4faa['options'][_0x9fe1('0x1c')]?_[_0x9fe1('0x1d')](_0x5b4faa[_0x9fe1('0x19')][_0x9fe1('0x1c')],function(_0x111e1f){return{'model':db[_0x111e1f[_0x9fe1('0x1e')]],'as':_0x111e1f['as'],'attributes':_0x111e1f[_0x9fe1('0x1f')],'include':_0x111e1f[_0x9fe1('0x1c')]?_[_0x9fe1('0x1d')](_0x111e1f[_0x9fe1('0x1c')],function(_0x3b8966){return{'model':db[_0x3b8966[_0x9fe1('0x1e')]],'as':_0x3b8966['as'],'attributes':_0x3b8966[_0x9fe1('0x1f')],'include':_0x3b8966[_0x9fe1('0x1c')]?_['map'](_0x3b8966['include'],function(_0x3cc37b){return{'model':db[_0x3cc37b[_0x9fe1('0x1e')]],'as':_0x3cc37b['as'],'attributes':_0x3cc37b[_0x9fe1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9fe1('0xd')](function(_0x56bc92){logger[_0x9fe1('0x15')](_0x9fe1('0x20'),_0x5b4faa);logger[_0x9fe1('0x21')](_0x9fe1('0x20'),_0x5b4faa,JSON['stringify'](_0x56bc92));_0x4c61dc(_0x56bc92);})[_0x9fe1('0x22')](function(_0x1e640d){logger['error'](_0x9fe1('0x20'),_0x1e640d[_0x9fe1('0x14')],_0x5b4faa);_0x51f305(_0x3400b8[_0x9fe1('0x12')](0x1f4,_0x1e640d[_0x9fe1('0x14')]));});});};exports['ShowFaxQueue']=function(_0x4e5792){var _0x2a9f90=this;return new Promise(function(_0x1f7c1b,_0xfd394){return db[_0x9fe1('0x17')]['find']({'raw':_0x4e5792[_0x9fe1('0x19')]?_0x4e5792[_0x9fe1('0x19')][_0x9fe1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e5792[_0x9fe1('0x19')]?_0x4e5792['options'][_0x9fe1('0x1b')]||null:null,'attributes':_0x4e5792[_0x9fe1('0x19')]?_0x4e5792[_0x9fe1('0x19')][_0x9fe1('0x1f')]||null:null,'include':_0x4e5792[_0x9fe1('0x19')]?_0x4e5792['options'][_0x9fe1('0x1c')]?_[_0x9fe1('0x1d')](_0x4e5792['options']['include'],function(_0x315d1e){return{'model':db[_0x315d1e[_0x9fe1('0x1e')]],'as':_0x315d1e['as'],'attributes':_0x315d1e[_0x9fe1('0x1f')],'include':_0x315d1e[_0x9fe1('0x1c')]?_[_0x9fe1('0x1d')](_0x315d1e[_0x9fe1('0x1c')],function(_0x17e51c){return{'model':db[_0x17e51c[_0x9fe1('0x1e')]],'as':_0x17e51c['as'],'attributes':_0x17e51c[_0x9fe1('0x1f')],'include':_0x17e51c['include']?_[_0x9fe1('0x1d')](_0x17e51c['include'],function(_0x1cfebc){return{'model':db[_0x1cfebc[_0x9fe1('0x1e')]],'as':_0x1cfebc['as'],'attributes':_0x1cfebc['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fe1('0xd')](function(_0x3ee1fd){logger[_0x9fe1('0x15')](_0x9fe1('0x23'),_0x4e5792);logger[_0x9fe1('0x21')](_0x9fe1('0x23'),_0x4e5792,JSON['stringify'](_0x3ee1fd));_0x1f7c1b(_0x3ee1fd);})['catch'](function(_0x27f1ef){logger[_0x9fe1('0x12')](_0x9fe1('0x23'),_0x27f1ef[_0x9fe1('0x14')],_0x4e5792);_0xfd394(_0x2a9f90[_0x9fe1('0x12')](0x1f4,_0x27f1ef[_0x9fe1('0x14')]));});});}; \ No newline at end of file +var _0xe5e9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5e9,0x9a));var _0x9e5e=function(_0xd2548e,_0x556106){_0xd2548e=_0xd2548e-0x0;var _0x1258d3=_0xe5e9[_0xd2548e];return _0x1258d3;};'use strict';var _=require(_0x9e5e('0x0'));var util=require(_0x9e5e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e5e('0x2'));var fs=require('fs');var Redis=require(_0x9e5e('0x3'));var db=require(_0x9e5e('0x4'))['db'];var utils=require(_0x9e5e('0x5'));var logger=require(_0x9e5e('0x6'))(_0x9e5e('0x7'));var config=require(_0x9e5e('0x8'));var jayson=require(_0x9e5e('0x9'));var client=jayson[_0x9e5e('0xa')][_0x9e5e('0xb')]({'port':0x232a});config[_0x9e5e('0xc')]=_[_0x9e5e('0xd')](config[_0x9e5e('0xc')],{'host':_0x9e5e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e5e('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4313c9,_0x5da6dd,_0x512dbf){return new BPromise(function(_0x12b7a8,_0x3cb3e6){return client[_0x9e5e('0xf')](_0x4313c9,_0x512dbf)['then'](function(_0x18dc97){logger[_0x9e5e('0x10')](_0x9e5e('0x11'),_0x5da6dd,_0x9e5e('0x12'));logger[_0x9e5e('0x13')](_0x9e5e('0x14'),_0x5da6dd,_0x9e5e('0x12'),JSON[_0x9e5e('0x15')](_0x18dc97));if(_0x18dc97[_0x9e5e('0x16')]){if(_0x18dc97[_0x9e5e('0x16')][_0x9e5e('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5da6dd,_0x18dc97[_0x9e5e('0x16')][_0x9e5e('0x18')]);return _0x3cb3e6(_0x18dc97[_0x9e5e('0x16')][_0x9e5e('0x18')]);}logger[_0x9e5e('0x16')](_0x9e5e('0x11'),_0x5da6dd,_0x18dc97[_0x9e5e('0x16')][_0x9e5e('0x18')]);return _0x12b7a8(_0x18dc97[_0x9e5e('0x16')][_0x9e5e('0x18')]);}else{logger[_0x9e5e('0x10')](_0x9e5e('0x11'),_0x5da6dd,_0x9e5e('0x12'));_0x12b7a8(_0x18dc97[_0x9e5e('0x19')][_0x9e5e('0x18')]);}})[_0x9e5e('0x1a')](function(_0x2c10d5){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5da6dd,_0x2c10d5);_0x3cb3e6(_0x2c10d5);});});}exports[_0x9e5e('0x1b')]=function(_0xf447d5){var _0x10b5ee=this;return new Promise(function(_0x51b32e,_0x59615c){return db[_0x9e5e('0x1c')][_0x9e5e('0x1d')]({'raw':_0xf447d5[_0x9e5e('0x1e')]?_0xf447d5['options'][_0x9e5e('0x1f')]===undefined?!![]:![]:!![],'where':_0xf447d5[_0x9e5e('0x1e')]?_0xf447d5[_0x9e5e('0x1e')][_0x9e5e('0x20')]||null:null,'attributes':_0xf447d5[_0x9e5e('0x1e')]?_0xf447d5[_0x9e5e('0x1e')][_0x9e5e('0x21')]||null:null,'limit':_0xf447d5[_0x9e5e('0x1e')]?_0xf447d5['options'][_0x9e5e('0x22')]||null:null,'include':_0xf447d5['options']?_0xf447d5[_0x9e5e('0x1e')][_0x9e5e('0x23')]?_[_0x9e5e('0x24')](_0xf447d5[_0x9e5e('0x1e')][_0x9e5e('0x23')],function(_0x1d6e9f){return{'model':db[_0x1d6e9f[_0x9e5e('0x25')]],'as':_0x1d6e9f['as'],'attributes':_0x1d6e9f[_0x9e5e('0x21')],'include':_0x1d6e9f[_0x9e5e('0x23')]?_[_0x9e5e('0x24')](_0x1d6e9f[_0x9e5e('0x23')],function(_0x1b4287){return{'model':db[_0x1b4287['model']],'as':_0x1b4287['as'],'attributes':_0x1b4287[_0x9e5e('0x21')],'include':_0x1b4287[_0x9e5e('0x23')]?_[_0x9e5e('0x24')](_0x1b4287[_0x9e5e('0x23')],function(_0x9d8178){return{'model':db[_0x9d8178[_0x9e5e('0x25')]],'as':_0x9d8178['as'],'attributes':_0x9d8178[_0x9e5e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32a211){logger[_0x9e5e('0x10')](_0x9e5e('0x1b'),_0xf447d5);logger[_0x9e5e('0x13')](_0x9e5e('0x1b'),_0xf447d5,JSON['stringify'](_0x32a211));_0x51b32e(_0x32a211);})[_0x9e5e('0x1a')](function(_0x1a99ea){logger['error'](_0x9e5e('0x1b'),_0x1a99ea[_0x9e5e('0x18')],_0xf447d5);_0x59615c(_0x10b5ee[_0x9e5e('0x16')](0x1f4,_0x1a99ea[_0x9e5e('0x18')]));});});};exports[_0x9e5e('0x26')]=function(_0x5946c9){var _0x577f07=this;return new Promise(function(_0x45c34f,_0x24c1e2){return db['FaxQueue'][_0x9e5e('0x27')]({'raw':_0x5946c9[_0x9e5e('0x1e')]?_0x5946c9['options'][_0x9e5e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5946c9['options']?_0x5946c9[_0x9e5e('0x1e')]['where']||null:null,'attributes':_0x5946c9['options']?_0x5946c9[_0x9e5e('0x1e')][_0x9e5e('0x21')]||null:null,'include':_0x5946c9[_0x9e5e('0x1e')]?_0x5946c9[_0x9e5e('0x1e')][_0x9e5e('0x23')]?_[_0x9e5e('0x24')](_0x5946c9[_0x9e5e('0x1e')]['include'],function(_0x16bc8a){return{'model':db[_0x16bc8a[_0x9e5e('0x25')]],'as':_0x16bc8a['as'],'attributes':_0x16bc8a[_0x9e5e('0x21')],'include':_0x16bc8a[_0x9e5e('0x23')]?_[_0x9e5e('0x24')](_0x16bc8a['include'],function(_0x2519cf){return{'model':db[_0x2519cf['model']],'as':_0x2519cf['as'],'attributes':_0x2519cf[_0x9e5e('0x21')],'include':_0x2519cf['include']?_['map'](_0x2519cf[_0x9e5e('0x23')],function(_0x665985){return{'model':db[_0x665985['model']],'as':_0x665985['as'],'attributes':_0x665985['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1242a9){logger['info'](_0x9e5e('0x26'),_0x5946c9);logger['debug'](_0x9e5e('0x26'),_0x5946c9,JSON[_0x9e5e('0x15')](_0x1242a9));_0x45c34f(_0x1242a9);})['catch'](function(_0x9b02bd){logger[_0x9e5e('0x16')](_0x9e5e('0x26'),_0x9b02bd[_0x9e5e('0x18')],_0x5946c9);_0x24c1e2(_0x577f07[_0x9e5e('0x16')](0x1f4,_0x9b02bd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0b42f3a..14734a1 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 _0xcbd1=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x571098,_0x5721a8){var _0x41e5ab=function(_0x1bae03){while(--_0x1bae03){_0x571098['push'](_0x571098['shift']());}};_0x41e5ab(++_0x5721a8);}(_0xcbd1,0x15b));var _0x1cbd=function(_0x40ac03,_0x24c9db){_0x40ac03=_0x40ac03-0x0;var _0x4c26a3=_0xcbd1[_0x40ac03];return _0x4c26a3;};'use strict';var FaxQueueEvents=require(_0x1cbd('0x0'));var events=[_0x1cbd('0x1'),_0x1cbd('0x2'),_0x1cbd('0x3')];function createListener(_0x383061,_0x1b33cf){return function(_0x36d569){_0x1b33cf[_0x1cbd('0x4')](_0x383061,_0x36d569);};}function removeListener(_0x159d92,_0x4b0ff2){return function(){FaxQueueEvents[_0x1cbd('0x5')](_0x159d92,_0x4b0ff2);};}exports[_0x1cbd('0x6')]=function(_0x2afb5f){for(var _0x73b901=0x0,_0x2c93a3=events[_0x1cbd('0x7')];_0x73b901<_0x2c93a3;_0x73b901++){var _0x208c8d=events[_0x73b901];var _0x28305f=createListener(_0x1cbd('0x8')+_0x208c8d,_0x2afb5f);FaxQueueEvents['on'](_0x208c8d,_0x28305f);}}; \ No newline at end of file +var _0xb7d8=['register','length','faxQueue:','./faxQueue.events','save','update','emit','removeListener'];(function(_0x380039,_0x27f062){var _0xcb236b=function(_0x4b47b5){while(--_0x4b47b5){_0x380039['push'](_0x380039['shift']());}};_0xcb236b(++_0x27f062);}(_0xb7d8,0x163));var _0x8b7d=function(_0x31acc7,_0x23a019){_0x31acc7=_0x31acc7-0x0;var _0x452714=_0xb7d8[_0x31acc7];return _0x452714;};'use strict';var FaxQueueEvents=require(_0x8b7d('0x0'));var events=[_0x8b7d('0x1'),'remove',_0x8b7d('0x2')];function createListener(_0x4b4885,_0x5a1453){return function(_0x15a695){_0x5a1453[_0x8b7d('0x3')](_0x4b4885,_0x15a695);};}function removeListener(_0x52295d,_0x149252){return function(){FaxQueueEvents[_0x8b7d('0x4')](_0x52295d,_0x149252);};}exports[_0x8b7d('0x5')]=function(_0x1feb9f){for(var _0x3cc856=0x0,_0x31b4c8=events[_0x8b7d('0x6')];_0x3cc856<_0x31b4c8;_0x3cc856++){var _0x5d69ed=events[_0x3cc856];var _0x4da93c=createListener(_0x8b7d('0x7')+_0x5d69ed,_0x1feb9f);FaxQueueEvents['on'](_0x5d69ed,_0x4da93c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 97a1738..a9bf7c4 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 _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x13dcbf,_0x2576c6){var _0x251d94=function(_0x5480dc){while(--_0x5480dc){_0x13dcbf['push'](_0x13dcbf['shift']());}};_0x251d94(++_0x2576c6);}(_0x6a55,0xdb));var _0x56a5=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x6a55[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file +var _0x36c3=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','update','destroy','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x506f24,_0x2f471b){var _0x1d4d59=function(_0x2bdc48){while(--_0x2bdc48){_0x506f24['push'](_0x506f24['shift']());}};_0x1d4d59(++_0x2f471b);}(_0x36c3,0x1a6));var _0x336c=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x36c3[_0x4605dc];return _0x5d3e81;};'use strict';var multer=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var path=require('path');var timeout=require(_0x336c('0x2'));var express=require(_0x336c('0x3'));var router=express[_0x336c('0x4')]();var fs_extra=require(_0x336c('0x5'));var auth=require(_0x336c('0x6'));var interaction=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var controller=require('./faxQueue.controller');router[_0x336c('0x9')]('/',auth[_0x336c('0xa')](),controller[_0x336c('0xb')]);router[_0x336c('0x9')](_0x336c('0xc'),auth['isAuthenticated'](),controller[_0x336c('0xd')]);router[_0x336c('0x9')](_0x336c('0xe'),auth[_0x336c('0xa')](),controller[_0x336c('0xf')]);router[_0x336c('0x9')](_0x336c('0x10'),auth[_0x336c('0xa')](),controller[_0x336c('0x11')]);router[_0x336c('0x9')](_0x336c('0x12'),auth[_0x336c('0xa')](),controller[_0x336c('0x13')]);router[_0x336c('0x9')](_0x336c('0x14'),auth[_0x336c('0xa')](),controller[_0x336c('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x336c('0x16')]);router['post'](_0x336c('0x12'),auth[_0x336c('0xa')](),controller[_0x336c('0x17')]);router[_0x336c('0x18')]('/:id/users',auth[_0x336c('0xa')](),controller[_0x336c('0x19')]);router['put'](_0x336c('0xe'),auth['isAuthenticated'](),controller[_0x336c('0x1a')]);router['delete'](_0x336c('0xe'),auth['isAuthenticated'](),controller[_0x336c('0x1b')]);router[_0x336c('0x1c')]('/:id/teams',auth['isAuthenticated'](),controller[_0x336c('0x1d')]);router[_0x336c('0x1c')](_0x336c('0x14'),auth[_0x336c('0xa')](),controller[_0x336c('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2b9b225..bd35fbf 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 _0x4afa=['sequelize','exports','STRING','DATE'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x4afa,0x10c));var _0xa4af=function(_0x1b3746,_0x311230){_0x1b3746=_0x1b3746-0x0;var _0x317103=_0x4afa[_0x1b3746];return _0x317103;};'use strict';var moment=require('moment');var Sequelize=require(_0xa4af('0x0'));module[_0xa4af('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa4af('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa4af('0x3')]},'acceptAt':{'type':Sequelize[_0xa4af('0x3')]},'exitAt':{'type':Sequelize[_0xa4af('0x3')]},'reason':{'type':Sequelize[_0xa4af('0x2')]}}; \ No newline at end of file +var _0xdc25=['DATE','moment','exports','STRING'];(function(_0x19c1f4,_0x3a9e79){var _0x2a6b81=function(_0x532585){while(--_0x532585){_0x19c1f4['push'](_0x19c1f4['shift']());}};_0x2a6b81(++_0x3a9e79);}(_0xdc25,0x135));var _0x5dc2=function(_0x7505b8,_0x4375b6){_0x7505b8=_0x7505b8-0x0;var _0x3bf0fd=_0xdc25[_0x7505b8];return _0x3bf0fd;};'use strict';var moment=require(_0x5dc2('0x0'));var Sequelize=require('sequelize');module[_0x5dc2('0x1')]={'uniqueid':{'type':Sequelize[_0x5dc2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5dc2('0x2')]},'joinAt':{'type':Sequelize[_0x5dc2('0x3')]},'leaveAt':{'type':Sequelize[_0x5dc2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5dc2('0x3')]},'reason':{'type':Sequelize[_0x5dc2('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 89918eb..827caa7 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 _0xe28e=['squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','send','index','map','FaxQueueReport','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x3797f1,_0x4c7281){var _0x366490=function(_0x3b39bd){while(--_0x3b39bd){_0x3797f1['push'](_0x3797f1['shift']());}};_0x366490(++_0x4c7281);}(_0xe28e,0x1ba));var _0xee28=function(_0x377b33,_0x3c57cc){_0x377b33=_0x377b33-0x0;var _0x4dad04=_0xe28e[_0x377b33];return _0x4dad04;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];function respondWithStatusCode(_0x2488cf,_0x267031){_0x267031=_0x267031||0xcc;return function(_0x46e784){if(_0x46e784){return _0x2488cf[_0xee28('0x1a')](_0x267031);}return _0x2488cf['status'](_0x267031)[_0xee28('0x1b')]();};}function respondWithResult(_0x1df69a,_0x555b9c){_0x555b9c=_0x555b9c||0xc8;return function(_0x331b7c){if(_0x331b7c){return _0x1df69a[_0xee28('0x1c')](_0x555b9c)['json'](_0x331b7c);}};}function respondWithFilteredResult(_0x11ac93,_0x17c99a){return function(_0x3d3a5c){if(_0x3d3a5c){var _0x343358=typeof _0x17c99a[_0xee28('0x1d')]===_0xee28('0x1e')&&typeof _0x17c99a['limit']===_0xee28('0x1e');var _0x5de212=_0x3d3a5c[_0xee28('0x1f')];var _0x19472a=_0x343358?0x0:_0x17c99a['offset'];var _0x355b07=_0x343358?_0x3d3a5c['count']:_0x17c99a[_0xee28('0x1d')]+_0x17c99a['limit'];var _0x28da88;if(_0x355b07>=_0x5de212){_0x355b07=_0x5de212;_0x28da88=0xc8;}else{_0x28da88=0xce;}_0x11ac93['status'](_0x28da88);return _0x11ac93[_0xee28('0x20')]('Content-Range',_0x19472a+'-'+_0x355b07+'/'+_0x5de212)[_0xee28('0x21')](_0x3d3a5c);}return null;};}function patchUpdates(_0x2a01ff){return function(_0x96f5db){try{jsonpatch[_0xee28('0x22')](_0x96f5db,_0x2a01ff,!![]);}catch(_0x21ee24){return BPromise[_0xee28('0x23')](_0x21ee24);}return _0x96f5db[_0xee28('0x24')]();};}function saveUpdates(_0x4bda53,_0x342798){return function(_0x44d7ff){if(_0x44d7ff){return _0x44d7ff[_0xee28('0x25')](_0x4bda53)['then'](function(_0x5b500b){return _0x5b500b;});}return null;};}function removeEntity(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(_0x1519ae){return _0x1519ae[_0xee28('0x26')]()[_0xee28('0x27')](function(){_0x17d8e4[_0xee28('0x1c')](0xcc)[_0xee28('0x1b')]();});}};}function handleEntityNotFound(_0x95d917,_0x2a7c95){return function(_0x733ca8){if(!_0x733ca8){_0x95d917[_0xee28('0x1a')](0x194);}return _0x733ca8;};}function handleError(_0x4ce19b,_0x2c847b){_0x2c847b=_0x2c847b||0x1f4;return function(_0x5b1b1e){logger['error'](_0x5b1b1e['stack']);if(_0x5b1b1e['name']){delete _0x5b1b1e['name'];}_0x4ce19b[_0xee28('0x1c')](_0x2c847b)[_0xee28('0x28')](_0x5b1b1e);};}exports[_0xee28('0x29')]=function(_0x469889,_0x346201){var _0x417840={},_0xbafd67={},_0x4fcc8f={'count':0x0,'rows':[]};var _0x84e0ba=_[_0xee28('0x2a')](db[_0xee28('0x2b')]['rawAttributes'],function(_0x14f7c4){return{'name':_0x14f7c4[_0xee28('0x2c')],'type':_0x14f7c4[_0xee28('0x2d')][_0xee28('0x2e')]};});_0xbafd67[_0xee28('0x2f')]=_[_0xee28('0x2a')](_0x84e0ba,_0xee28('0x30'));_0xbafd67['query']=_[_0xee28('0x31')](_0x469889[_0xee28('0x32')]);_0xbafd67['filters']=_[_0xee28('0x33')](_0xbafd67[_0xee28('0x2f')],_0xbafd67[_0xee28('0x32')]);_0x417840[_0xee28('0x34')]=_[_0xee28('0x33')](_0xbafd67[_0xee28('0x2f')],qs[_0xee28('0x35')](_0x469889['query']['fields']));_0x417840['attributes']=_0x417840[_0xee28('0x34')][_0xee28('0x36')]?_0x417840[_0xee28('0x34')]:_0xbafd67[_0xee28('0x2f')];if(!_0x469889[_0xee28('0x32')][_0xee28('0x37')]('nolimit')){_0x417840[_0xee28('0x38')]=qs[_0xee28('0x38')](_0x469889['query']['limit']);_0x417840[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x469889['query']['offset']);}_0x417840[_0xee28('0x39')]=qs[_0xee28('0x3a')](_0x469889['query'][_0xee28('0x3a')]);_0x417840[_0xee28('0x3b')]=qs[_0xee28('0x3c')](_[_0xee28('0x3d')](_0x469889[_0xee28('0x32')],_0xbafd67[_0xee28('0x3c')]),_0x84e0ba);if(_0x469889[_0xee28('0x32')][_0xee28('0x3e')]){_0x417840[_0xee28('0x3b')]=_[_0xee28('0x3f')](_0x417840[_0xee28('0x3b')],{'$or':_[_0xee28('0x2a')](_0x84e0ba,function(_0x486d55){if(_0x486d55[_0xee28('0x2d')]!=='VIRTUAL'){var _0x4b0b75={};_0x4b0b75[_0x486d55[_0xee28('0x30')]]={'$like':'%'+_0x469889['query'][_0xee28('0x3e')]+'%'};return _0x4b0b75;}})});}_0x417840=_['merge']({},_0x417840,_0x469889[_0xee28('0x40')]);var _0x4d096c={'where':_0x417840[_0xee28('0x3b')]};return db[_0xee28('0x2b')][_0xee28('0x1f')](_0x4d096c)[_0xee28('0x27')](function(_0x58ebb5){_0x4fcc8f[_0xee28('0x1f')]=_0x58ebb5;if(_0x469889['query'][_0xee28('0x41')]){_0x417840[_0xee28('0x42')]=[{'all':!![]}];}return db[_0xee28('0x2b')][_0xee28('0x43')](_0x417840);})[_0xee28('0x27')](function(_0x2e046e){_0x4fcc8f[_0xee28('0x44')]=_0x2e046e;return _0x4fcc8f;})['then'](respondWithFilteredResult(_0x346201,_0x417840))['catch'](handleError(_0x346201,null));};exports[_0xee28('0x45')]=function(_0x5c710d,_0x52b666){var _0x4064cf={'raw':!![],'where':{'id':_0x5c710d['params']['id']}},_0x14bd8d={};_0x14bd8d[_0xee28('0x2f')]=_[_0xee28('0x31')](db[_0xee28('0x2b')][_0xee28('0x46')]);_0x14bd8d[_0xee28('0x32')]=_[_0xee28('0x31')](_0x5c710d[_0xee28('0x32')]);_0x14bd8d['filters']=_[_0xee28('0x33')](_0x14bd8d[_0xee28('0x2f')],_0x14bd8d[_0xee28('0x32')]);_0x4064cf[_0xee28('0x34')]=_[_0xee28('0x33')](_0x14bd8d['model'],qs[_0xee28('0x35')](_0x5c710d[_0xee28('0x32')]['fields']));_0x4064cf[_0xee28('0x34')]=_0x4064cf[_0xee28('0x34')][_0xee28('0x36')]?_0x4064cf[_0xee28('0x34')]:_0x14bd8d[_0xee28('0x2f')];if(_0x5c710d[_0xee28('0x32')]['includeAll']){_0x4064cf[_0xee28('0x42')]=[{'all':!![]}];}_0x4064cf=_['merge']({},_0x4064cf,_0x5c710d['options']);return db[_0xee28('0x2b')][_0xee28('0x47')](_0x4064cf)['then'](handleEntityNotFound(_0x52b666,null))[_0xee28('0x27')](respondWithResult(_0x52b666,null))[_0xee28('0x48')](handleError(_0x52b666,null));};exports[_0xee28('0x49')]=function(_0x5d07ed,_0x57e57e){return db[_0xee28('0x2b')][_0xee28('0x49')](_0x5d07ed[_0xee28('0x4a')],{})[_0xee28('0x27')](respondWithResult(_0x57e57e,0xc9))[_0xee28('0x48')](handleError(_0x57e57e,null));};exports[_0xee28('0x25')]=function(_0x2574c5,_0x2b5f36){if(_0x2574c5[_0xee28('0x4a')]['id']){delete _0x2574c5[_0xee28('0x4a')]['id'];}return db['FaxQueueReport'][_0xee28('0x47')]({'where':{'id':_0x2574c5['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x2b5f36,null))[_0xee28('0x27')](saveUpdates(_0x2574c5[_0xee28('0x4a')],null))[_0xee28('0x27')](respondWithResult(_0x2b5f36,null))[_0xee28('0x48')](handleError(_0x2b5f36,null));};exports['destroy']=function(_0x5247fe,_0x5ca018){return db[_0xee28('0x2b')]['find']({'where':{'id':_0x5247fe['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x5ca018,null))['then'](removeEntity(_0x5ca018,null))[_0xee28('0x48')](handleError(_0x5ca018,null));};exports[_0xee28('0x4b')]=function(_0x45c4c0,_0x3a4e74){return db[_0xee28('0x2b')][_0xee28('0x4b')]()[_0xee28('0x27')](respondWithResult(_0x3a4e74,null))[_0xee28('0x48')](handleError(_0x3a4e74,null));}; \ No newline at end of file +var _0x3715=['reject','save','update','then','error','stack','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x89dce9,_0x4edfb2){var _0x12413e=function(_0x5c3d72){while(--_0x5c3d72){_0x89dce9['push'](_0x89dce9['shift']());}};_0x12413e(++_0x4edfb2);}(_0x3715,0xc3));var _0x5371=function(_0x7bcb1b,_0x1e1f67){_0x7bcb1b=_0x7bcb1b-0x0;var _0x45638c=_0x3715[_0x7bcb1b];return _0x45638c;};'use strict';var emlformat=require(_0x5371('0x0'));var rimraf=require(_0x5371('0x1'));var zipdir=require(_0x5371('0x2'));var jsonpatch=require(_0x5371('0x3'));var rp=require(_0x5371('0x4'));var moment=require(_0x5371('0x5'));var BPromise=require(_0x5371('0x6'));var Mustache=require(_0x5371('0x7'));var util=require(_0x5371('0x8'));var path=require(_0x5371('0x9'));var sox=require(_0x5371('0xa'));var csv=require(_0x5371('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5371('0xc'));var _=require(_0x5371('0xd'));var squel=require('squel');var crypto=require(_0x5371('0xe'));var jsforce=require(_0x5371('0xf'));var deskjs=require(_0x5371('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5371('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5371('0x12'));var qs=require(_0x5371('0x13'));var as=require(_0x5371('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5371('0x15'))(_0x5371('0x16'));var utils=require(_0x5371('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5371('0x18'));var db=require(_0x5371('0x19'))['db'];function respondWithStatusCode(_0x1faac2,_0x1b0a8a){_0x1b0a8a=_0x1b0a8a||0xcc;return function(_0x5b4adf){if(_0x5b4adf){return _0x1faac2[_0x5371('0x1a')](_0x1b0a8a);}return _0x1faac2['status'](_0x1b0a8a)[_0x5371('0x1b')]();};}function respondWithResult(_0x777eaf,_0x4c8eb8){_0x4c8eb8=_0x4c8eb8||0xc8;return function(_0x4611dd){if(_0x4611dd){return _0x777eaf[_0x5371('0x1c')](_0x4c8eb8)[_0x5371('0x1d')](_0x4611dd);}};}function respondWithFilteredResult(_0x29bf5b,_0x178130){return function(_0x41d0c2){if(_0x41d0c2){var _0x33b592=typeof _0x178130['offset']===_0x5371('0x1e')&&typeof _0x178130[_0x5371('0x1f')]===_0x5371('0x1e');var _0x22dbcd=_0x41d0c2[_0x5371('0x20')];var _0x32f469=_0x33b592?0x0:_0x178130[_0x5371('0x21')];var _0x4855b3=_0x33b592?_0x41d0c2['count']:_0x178130[_0x5371('0x21')]+_0x178130['limit'];var _0x2579f9;if(_0x4855b3>=_0x22dbcd){_0x4855b3=_0x22dbcd;_0x2579f9=0xc8;}else{_0x2579f9=0xce;}_0x29bf5b['status'](_0x2579f9);return _0x29bf5b[_0x5371('0x22')](_0x5371('0x23'),_0x32f469+'-'+_0x4855b3+'/'+_0x22dbcd)['json'](_0x41d0c2);}return null;};}function patchUpdates(_0x470cd2){return function(_0x2c989c){try{jsonpatch['apply'](_0x2c989c,_0x470cd2,!![]);}catch(_0x3c2d4a){return BPromise[_0x5371('0x24')](_0x3c2d4a);}return _0x2c989c[_0x5371('0x25')]();};}function saveUpdates(_0x5eacf2,_0x4add7e){return function(_0x4d7dad){if(_0x4d7dad){return _0x4d7dad[_0x5371('0x26')](_0x5eacf2)[_0x5371('0x27')](function(_0x2a897e){return _0x2a897e;});}return null;};}function removeEntity(_0x2bae28,_0x1f0998){return function(_0xabe2a6){if(_0xabe2a6){return _0xabe2a6['destroy']()[_0x5371('0x27')](function(){_0x2bae28['status'](0xcc)[_0x5371('0x1b')]();});}};}function handleEntityNotFound(_0x522a53,_0xc02f21){return function(_0x427f20){if(!_0x427f20){_0x522a53['sendStatus'](0x194);}return _0x427f20;};}function handleError(_0x395aa9,_0x2a7a93){_0x2a7a93=_0x2a7a93||0x1f4;return function(_0x30d3c2){logger[_0x5371('0x28')](_0x30d3c2[_0x5371('0x29')]);if(_0x30d3c2['name']){delete _0x30d3c2['name'];}_0x395aa9[_0x5371('0x1c')](_0x2a7a93)['send'](_0x30d3c2);};}exports['index']=function(_0x2138e6,_0x167280){var _0x5a84c1={},_0x311021={},_0x32554f={'count':0x0,'rows':[]};var _0x1ea613=_[_0x5371('0x2a')](db[_0x5371('0x2b')][_0x5371('0x2c')],function(_0x1f60c3){return{'name':_0x1f60c3[_0x5371('0x2d')],'type':_0x1f60c3[_0x5371('0x2e')][_0x5371('0x2f')]};});_0x311021['model']=_[_0x5371('0x2a')](_0x1ea613,'name');_0x311021[_0x5371('0x30')]=_['keys'](_0x2138e6['query']);_0x311021[_0x5371('0x31')]=_[_0x5371('0x32')](_0x311021[_0x5371('0x33')],_0x311021[_0x5371('0x30')]);_0x5a84c1[_0x5371('0x34')]=_[_0x5371('0x32')](_0x311021['model'],qs[_0x5371('0x35')](_0x2138e6['query'][_0x5371('0x35')]));_0x5a84c1[_0x5371('0x34')]=_0x5a84c1[_0x5371('0x34')][_0x5371('0x36')]?_0x5a84c1[_0x5371('0x34')]:_0x311021[_0x5371('0x33')];if(!_0x2138e6[_0x5371('0x30')]['hasOwnProperty'](_0x5371('0x37'))){_0x5a84c1[_0x5371('0x1f')]=qs[_0x5371('0x1f')](_0x2138e6[_0x5371('0x30')][_0x5371('0x1f')]);_0x5a84c1[_0x5371('0x21')]=qs[_0x5371('0x21')](_0x2138e6['query'][_0x5371('0x21')]);}_0x5a84c1[_0x5371('0x38')]=qs['sort'](_0x2138e6[_0x5371('0x30')][_0x5371('0x39')]);_0x5a84c1[_0x5371('0x3a')]=qs[_0x5371('0x31')](_['pick'](_0x2138e6[_0x5371('0x30')],_0x311021[_0x5371('0x31')]),_0x1ea613);if(_0x2138e6['query'][_0x5371('0x3b')]){_0x5a84c1[_0x5371('0x3a')]=_[_0x5371('0x3c')](_0x5a84c1[_0x5371('0x3a')],{'$or':_[_0x5371('0x2a')](_0x1ea613,function(_0x131409){if(_0x131409[_0x5371('0x2e')]!==_0x5371('0x3d')){var _0x50e7e3={};_0x50e7e3[_0x131409[_0x5371('0x3e')]]={'$like':'%'+_0x2138e6[_0x5371('0x30')][_0x5371('0x3b')]+'%'};return _0x50e7e3;}})});}_0x5a84c1=_[_0x5371('0x3c')]({},_0x5a84c1,_0x2138e6['options']);var _0x175296={'where':_0x5a84c1[_0x5371('0x3a')]};return db[_0x5371('0x2b')][_0x5371('0x20')](_0x175296)[_0x5371('0x27')](function(_0x2b7859){_0x32554f['count']=_0x2b7859;if(_0x2138e6[_0x5371('0x30')][_0x5371('0x3f')]){_0x5a84c1[_0x5371('0x40')]=[{'all':!![]}];}return db[_0x5371('0x2b')][_0x5371('0x41')](_0x5a84c1);})[_0x5371('0x27')](function(_0x47f7fd){_0x32554f[_0x5371('0x42')]=_0x47f7fd;return _0x32554f;})[_0x5371('0x27')](respondWithFilteredResult(_0x167280,_0x5a84c1))[_0x5371('0x43')](handleError(_0x167280,null));};exports[_0x5371('0x44')]=function(_0x454985,_0x331087){var _0x4db26a={'raw':!![],'where':{'id':_0x454985['params']['id']}},_0x29d7ac={};_0x29d7ac['model']=_[_0x5371('0x45')](db['FaxQueueReport']['rawAttributes']);_0x29d7ac['query']=_[_0x5371('0x45')](_0x454985[_0x5371('0x30')]);_0x29d7ac[_0x5371('0x31')]=_['intersection'](_0x29d7ac[_0x5371('0x33')],_0x29d7ac[_0x5371('0x30')]);_0x4db26a['attributes']=_['intersection'](_0x29d7ac[_0x5371('0x33')],qs[_0x5371('0x35')](_0x454985[_0x5371('0x30')][_0x5371('0x35')]));_0x4db26a['attributes']=_0x4db26a['attributes']['length']?_0x4db26a['attributes']:_0x29d7ac['model'];if(_0x454985[_0x5371('0x30')]['includeAll']){_0x4db26a[_0x5371('0x40')]=[{'all':!![]}];}_0x4db26a=_['merge']({},_0x4db26a,_0x454985[_0x5371('0x46')]);return db[_0x5371('0x2b')][_0x5371('0x47')](_0x4db26a)[_0x5371('0x27')](handleEntityNotFound(_0x331087,null))['then'](respondWithResult(_0x331087,null))[_0x5371('0x43')](handleError(_0x331087,null));};exports[_0x5371('0x48')]=function(_0x5efa09,_0x389bb8){return db[_0x5371('0x2b')]['create'](_0x5efa09[_0x5371('0x49')],{})['then'](respondWithResult(_0x389bb8,0xc9))['catch'](handleError(_0x389bb8,null));};exports[_0x5371('0x26')]=function(_0x179163,_0x2daa6e){if(_0x179163[_0x5371('0x49')]['id']){delete _0x179163[_0x5371('0x49')]['id'];}return db[_0x5371('0x2b')][_0x5371('0x47')]({'where':{'id':_0x179163['params']['id']}})[_0x5371('0x27')](handleEntityNotFound(_0x2daa6e,null))[_0x5371('0x27')](saveUpdates(_0x179163[_0x5371('0x49')],null))['then'](respondWithResult(_0x2daa6e,null))['catch'](handleError(_0x2daa6e,null));};exports[_0x5371('0x4a')]=function(_0x334b29,_0x5e39d2){return db[_0x5371('0x2b')]['find']({'where':{'id':_0x334b29[_0x5371('0x4b')]['id']}})[_0x5371('0x27')](handleEntityNotFound(_0x5e39d2,null))[_0x5371('0x27')](removeEntity(_0x5e39d2,null))[_0x5371('0x43')](handleError(_0x5e39d2,null));};exports['describe']=function(_0x3c75b5,_0x4f9227){return db['FaxQueueReport'][_0x5371('0x4c')]()[_0x5371('0x27')](respondWithResult(_0x4f9227,null))[_0x5371('0x43')](handleError(_0x4f9227,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f9ce61d..04328b5 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x4ce26c,_0x1ad38b){var _0x461547=function(_0x5d12a7){while(--_0x5d12a7){_0x4ce26c['push'](_0x4ce26c['shift']());}};_0x461547(++_0x1ad38b);}(_0x326f,0xd1));var _0xf326=function(_0x3a3c3b,_0x1ef69d){_0x3a3c3b=_0x3a3c3b-0x0;var _0x310269=_0x326f[_0x3a3c3b];return _0x310269;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x57a4bb,_0x4d3f02){var _0x563069=function(_0x1f799d){while(--_0x1f799d){_0x57a4bb['push'](_0x57a4bb['shift']());}};_0x563069(++_0x4d3f02);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x7fbe[_0x4704dc];return _0x254d81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 687c395..20bb7a1 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 _0xf7af=['FaxQueueReport','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport'];(function(_0x39d6a8,_0xc9c91a){var _0x93f3db=function(_0x953b09){while(--_0x953b09){_0x39d6a8['push'](_0x39d6a8['shift']());}};_0x93f3db(++_0xc9c91a);}(_0xf7af,0x92));var _0xff7a=function(_0x5d4570,_0x259bbb){_0x5d4570=_0x5d4570-0x0;var _0x356fdc=_0xf7af[_0x5d4570];return _0x356fdc;};'use strict';var _=require(_0xff7a('0x0'));var util=require(_0xff7a('0x1'));var moment=require(_0xff7a('0x2'));var BPromise=require(_0xff7a('0x3'));var rs=require(_0xff7a('0x4'));var fs=require('fs');var Redis=require(_0xff7a('0x5'));var db=require(_0xff7a('0x6'))['db'];var utils=require(_0xff7a('0x7'));var logger=require(_0xff7a('0x8'))(_0xff7a('0x9'));var config=require(_0xff7a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xff7a('0xb')][_0xff7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c67de,_0x233b73,_0x544474){return new BPromise(function(_0x4ed07e,_0x289703){return client[_0xff7a('0xd')](_0x1c67de,_0x544474)['then'](function(_0x5262fd){logger[_0xff7a('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x233b73,_0xff7a('0xf'));logger[_0xff7a('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x233b73,_0xff7a('0xf'),JSON[_0xff7a('0x11')](_0x5262fd));if(_0x5262fd[_0xff7a('0x12')]){if(_0x5262fd[_0xff7a('0x12')]['code']===0x1f4){logger[_0xff7a('0x12')](_0xff7a('0x13'),_0x233b73,_0x5262fd[_0xff7a('0x12')]['message']);return _0x289703(_0x5262fd['error'][_0xff7a('0x14')]);}logger[_0xff7a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x233b73,_0x5262fd['error']['message']);return _0x4ed07e(_0x5262fd[_0xff7a('0x12')][_0xff7a('0x14')]);}else{logger[_0xff7a('0xe')](_0xff7a('0x13'),_0x233b73,_0xff7a('0xf'));_0x4ed07e(_0x5262fd[_0xff7a('0x15')]['message']);}})[_0xff7a('0x16')](function(_0x1ed13b){logger[_0xff7a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x233b73,_0x1ed13b);_0x289703(_0x1ed13b);});});}exports[_0xff7a('0x17')]=function(_0x2ef871){var _0x5490b0=this;return new Promise(function(_0x263646,_0x303137){return db[_0xff7a('0x18')]['create'](_0x2ef871[_0xff7a('0x19')],{'raw':_0x2ef871['options']?_0x2ef871[_0xff7a('0x1a')][_0xff7a('0x1b')]===undefined?!![]:![]:!![]})[_0xff7a('0x1c')](function(_0x52e78b){logger[_0xff7a('0xe')](_0xff7a('0x17'),_0x2ef871);logger[_0xff7a('0x10')](_0xff7a('0x17'),_0x2ef871,JSON[_0xff7a('0x11')](_0x52e78b));_0x263646(_0x52e78b);})[_0xff7a('0x16')](function(_0x2cc9dc){logger[_0xff7a('0x12')](_0xff7a('0x17'),_0x2cc9dc[_0xff7a('0x14')],_0x2ef871);_0x303137(_0x5490b0[_0xff7a('0x12')](0x1f4,_0x2cc9dc[_0xff7a('0x14')]));});});};exports[_0xff7a('0x1d')]=function(_0x309814){var _0x3e160f=this;return new Promise(function(_0x5c02cd,_0x3e2e28){return db[_0xff7a('0x18')][_0xff7a('0x1e')](_0x309814[_0xff7a('0x19')],{'raw':_0x309814['options']?_0x309814[_0xff7a('0x1a')][_0xff7a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309814[_0xff7a('0x1a')]?_0x309814[_0xff7a('0x1a')][_0xff7a('0x1f')]||null:null,'attributes':_0x309814[_0xff7a('0x1a')]?_0x309814[_0xff7a('0x1a')][_0xff7a('0x20')]||null:null,'limit':_0x309814['options']?_0x309814[_0xff7a('0x1a')][_0xff7a('0x21')]||null:null})[_0xff7a('0x1c')](function(_0xe9763c){logger[_0xff7a('0xe')](_0xff7a('0x1d'),_0x309814);logger[_0xff7a('0x10')]('UpdateFaxQueueReport',_0x309814,JSON[_0xff7a('0x11')](_0xe9763c));_0x5c02cd(_0xe9763c);})[_0xff7a('0x16')](function(_0x1cc1cb){logger[_0xff7a('0x12')](_0xff7a('0x1d'),_0x1cc1cb[_0xff7a('0x14')],_0x309814);_0x3e2e28(_0x3e160f[_0xff7a('0x12')](0x1f4,_0x1cc1cb['message']));});});}; \ No newline at end of file +var _0x30e1=['limit','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','info','debug','UpdateFaxQueueReport','update','where','attributes'];(function(_0x4945db,_0x5ee694){var _0xdf2593=function(_0x10bb5a){while(--_0x10bb5a){_0x4945db['push'](_0x4945db['shift']());}};_0xdf2593(++_0x5ee694);}(_0x30e1,0x67));var _0x130e=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x30e1[_0x55e1d1];return _0x1165db;};'use strict';var _=require(_0x130e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x130e('0x1'));var rs=require(_0x130e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x130e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x130e('0x4'))(_0x130e('0x5'));var config=require(_0x130e('0x6'));var jayson=require(_0x130e('0x7'));var client=jayson[_0x130e('0x8')][_0x130e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x273418,_0x54686f,_0x418f39){return new BPromise(function(_0xf9d564,_0x4f9ab1){return client[_0x130e('0xa')](_0x273418,_0x418f39)[_0x130e('0xb')](function(_0x2acc7c){logger['info'](_0x130e('0xc'),_0x54686f,_0x130e('0xd'));logger['debug'](_0x130e('0xe'),_0x54686f,_0x130e('0xd'),JSON[_0x130e('0xf')](_0x2acc7c));if(_0x2acc7c['error']){if(_0x2acc7c[_0x130e('0x10')][_0x130e('0x11')]===0x1f4){logger[_0x130e('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x54686f,_0x2acc7c[_0x130e('0x10')][_0x130e('0x12')]);return _0x4f9ab1(_0x2acc7c[_0x130e('0x10')][_0x130e('0x12')]);}logger[_0x130e('0x10')](_0x130e('0xc'),_0x54686f,_0x2acc7c[_0x130e('0x10')][_0x130e('0x12')]);return _0xf9d564(_0x2acc7c[_0x130e('0x10')]['message']);}else{logger['info'](_0x130e('0xc'),_0x54686f,_0x130e('0xd'));_0xf9d564(_0x2acc7c[_0x130e('0x13')][_0x130e('0x12')]);}})[_0x130e('0x14')](function(_0x191675){logger[_0x130e('0x10')](_0x130e('0xc'),_0x54686f,_0x191675);_0x4f9ab1(_0x191675);});});}exports[_0x130e('0x15')]=function(_0xa5f166){var _0x959b95=this;return new Promise(function(_0x22b13e,_0x5cb133){return db[_0x130e('0x16')][_0x130e('0x17')](_0xa5f166[_0x130e('0x18')],{'raw':_0xa5f166[_0x130e('0x19')]?_0xa5f166['options'][_0x130e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x58eb50){logger[_0x130e('0x1b')](_0x130e('0x15'),_0xa5f166);logger[_0x130e('0x1c')](_0x130e('0x15'),_0xa5f166,JSON[_0x130e('0xf')](_0x58eb50));_0x22b13e(_0x58eb50);})[_0x130e('0x14')](function(_0x3e0bb9){logger['error'](_0x130e('0x15'),_0x3e0bb9[_0x130e('0x12')],_0xa5f166);_0x5cb133(_0x959b95[_0x130e('0x10')](0x1f4,_0x3e0bb9[_0x130e('0x12')]));});});};exports[_0x130e('0x1d')]=function(_0x241b8b){var _0x581e36=this;return new Promise(function(_0x13850d,_0x2bb622){return db[_0x130e('0x16')][_0x130e('0x1e')](_0x241b8b[_0x130e('0x18')],{'raw':_0x241b8b['options']?_0x241b8b[_0x130e('0x19')][_0x130e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x241b8b['options']?_0x241b8b['options'][_0x130e('0x1f')]||null:null,'attributes':_0x241b8b[_0x130e('0x19')]?_0x241b8b[_0x130e('0x19')][_0x130e('0x20')]||null:null,'limit':_0x241b8b[_0x130e('0x19')]?_0x241b8b[_0x130e('0x19')][_0x130e('0x21')]||null:null})[_0x130e('0xb')](function(_0x12901a){logger[_0x130e('0x1b')](_0x130e('0x1d'),_0x241b8b);logger[_0x130e('0x1c')](_0x130e('0x1d'),_0x241b8b,JSON[_0x130e('0xf')](_0x12901a));_0x13850d(_0x12901a);})['catch'](function(_0x437f33){logger[_0x130e('0x10')](_0x130e('0x1d'),_0x437f33['message'],_0x241b8b);_0x2bb622(_0x581e36[_0x130e('0x10')](0x1f4,_0x437f33[_0x130e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 0a2a89d..f6786aa 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 _0x6d89=['./faxQueueReport.controller','isAuthenticated','get','/describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11afcf,_0x46133b){var _0x209a87=function(_0x1d6b6c){while(--_0x1d6b6c){_0x11afcf['push'](_0x11afcf['shift']());}};_0x209a87(++_0x46133b);}(_0x6d89,0x10f));var _0x96d8=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x6d89[_0xe1b5f6];return _0x44636e;};'use strict';var multer=require(_0x96d8('0x0'));var util=require(_0x96d8('0x1'));var path=require(_0x96d8('0x2'));var timeout=require(_0x96d8('0x3'));var express=require(_0x96d8('0x4'));var router=express['Router']();var fs_extra=require(_0x96d8('0x5'));var auth=require(_0x96d8('0x6'));var interaction=require(_0x96d8('0x7'));var config=require(_0x96d8('0x8'));var controller=require(_0x96d8('0x9'));router['get']('/',auth[_0x96d8('0xa')](),controller['index']);router[_0x96d8('0xb')](_0x96d8('0xc'),auth[_0x96d8('0xa')](),controller['describe']);router['get'](_0x96d8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x96d8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x96d8('0xf')]('/:id',auth[_0x96d8('0xa')](),controller[_0x96d8('0x10')]);router[_0x96d8('0x11')](_0x96d8('0xd'),auth['isAuthenticated'](),controller[_0x96d8('0x12')]);module[_0x96d8('0x13')]=router; \ No newline at end of file +var _0x0b09=['describe','show','post','create','put','/:id','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x0b09,0x197));var _0x90b0=function(_0x12c72d,_0x320832){_0x12c72d=_0x12c72d-0x0;var _0x211a39=_0x0b09[_0x12c72d];return _0x211a39;};'use strict';var multer=require(_0x90b0('0x0'));var util=require('util');var path=require(_0x90b0('0x1'));var timeout=require(_0x90b0('0x2'));var express=require('express');var router=express[_0x90b0('0x3')]();var fs_extra=require(_0x90b0('0x4'));var auth=require(_0x90b0('0x5'));var interaction=require(_0x90b0('0x6'));var config=require(_0x90b0('0x7'));var controller=require(_0x90b0('0x8'));router[_0x90b0('0x9')]('/',auth[_0x90b0('0xa')](),controller[_0x90b0('0xb')]);router['get'](_0x90b0('0xc'),auth[_0x90b0('0xa')](),controller[_0x90b0('0xd')]);router['get']('/:id',auth[_0x90b0('0xa')](),controller[_0x90b0('0xe')]);router[_0x90b0('0xf')]('/',auth[_0x90b0('0xa')](),controller[_0x90b0('0x10')]);router[_0x90b0('0x11')](_0x90b0('0x12'),auth[_0x90b0('0xa')](),controller[_0x90b0('0x13')]);router['delete'](_0x90b0('0x12'),auth[_0x90b0('0xa')](),controller['destroy']);module[_0x90b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6a45374..43f699b 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x46e3ff,_0x50ca39){var _0x4bf847=function(_0x3fa9b9){while(--_0x3fa9b9){_0x46e3ff['push'](_0x46e3ff['shift']());}};_0x4bf847(++_0x50ca39);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x15ed17,_0x434837){var _0x3e7421=function(_0x443af2){while(--_0x443af2){_0x15ed17['push'](_0x15ed17['shift']());}};_0x3e7421(++_0x434837);}(_0x70e0,0x17b));var _0x070e=function(_0x4b15c5,_0x2c98b4){_0x4b15c5=_0x4b15c5-0x0;var _0x44e949=_0x70e0[_0x4b15c5];return _0x44e949;};'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 e03998b..3f8893d 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 _0xc8a4=['type','key','keys','query','filters','intersection','model','fields','attributes','sort','where','filter','merge','VIRTUAL','options','includeAll','include','FaxTransferReport','rows','show','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x526713,_0x2d99c7){var _0x883e74=function(_0x477c82){while(--_0x477c82){_0x526713['push'](_0x526713['shift']());}};_0x883e74(++_0x2d99c7);}(_0xc8a4,0x1dc));var _0x4c8a=function(_0x2cc1f2,_0x29f13e){_0x2cc1f2=_0x2cc1f2-0x0;var _0xc22d02=_0xc8a4[_0x2cc1f2];return _0xc22d02;};'use strict';var emlformat=require(_0x4c8a('0x0'));var rimraf=require(_0x4c8a('0x1'));var zipdir=require(_0x4c8a('0x2'));var jsonpatch=require(_0x4c8a('0x3'));var rp=require(_0x4c8a('0x4'));var moment=require('moment');var BPromise=require(_0x4c8a('0x5'));var Mustache=require(_0x4c8a('0x6'));var util=require(_0x4c8a('0x7'));var path=require(_0x4c8a('0x8'));var sox=require('sox');var csv=require(_0x4c8a('0x9'));var ejs=require(_0x4c8a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c8a('0xb'));var squel=require(_0x4c8a('0xc'));var crypto=require(_0x4c8a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4c8a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4c8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c8a('0x10'));var authService=require(_0x4c8a('0x11'));var qs=require(_0x4c8a('0x12'));var as=require(_0x4c8a('0x13'));var hardwareService=require(_0x4c8a('0x14'));var logger=require(_0x4c8a('0x15'))(_0x4c8a('0x16'));var utils=require(_0x4c8a('0x17'));var config=require(_0x4c8a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c8a('0x19'))['db'];function respondWithStatusCode(_0x4d987b,_0x2bed3c){_0x2bed3c=_0x2bed3c||0xcc;return function(_0x9ce93a){if(_0x9ce93a){return _0x4d987b[_0x4c8a('0x1a')](_0x2bed3c);}return _0x4d987b['status'](_0x2bed3c)[_0x4c8a('0x1b')]();};}function respondWithResult(_0x4e74b7,_0x409c86){_0x409c86=_0x409c86||0xc8;return function(_0x35d376){if(_0x35d376){return _0x4e74b7['status'](_0x409c86)['json'](_0x35d376);}};}function respondWithFilteredResult(_0x28b3b0,_0x2a2245){return function(_0x5b47c4){if(_0x5b47c4){var _0x4a717b=typeof _0x2a2245['offset']===_0x4c8a('0x1c')&&typeof _0x2a2245[_0x4c8a('0x1d')]===_0x4c8a('0x1c');var _0x58ae9a=_0x5b47c4[_0x4c8a('0x1e')];var _0x4cb4b1=_0x4a717b?0x0:_0x2a2245[_0x4c8a('0x1f')];var _0xdfc5bc=_0x4a717b?_0x5b47c4[_0x4c8a('0x1e')]:_0x2a2245[_0x4c8a('0x1f')]+_0x2a2245['limit'];var _0x1171ea;if(_0xdfc5bc>=_0x58ae9a){_0xdfc5bc=_0x58ae9a;_0x1171ea=0xc8;}else{_0x1171ea=0xce;}_0x28b3b0[_0x4c8a('0x20')](_0x1171ea);return _0x28b3b0[_0x4c8a('0x21')](_0x4c8a('0x22'),_0x4cb4b1+'-'+_0xdfc5bc+'/'+_0x58ae9a)[_0x4c8a('0x23')](_0x5b47c4);}return null;};}function patchUpdates(_0x4a1daa){return function(_0x2cec76){try{jsonpatch[_0x4c8a('0x24')](_0x2cec76,_0x4a1daa,!![]);}catch(_0x11f749){return BPromise[_0x4c8a('0x25')](_0x11f749);}return _0x2cec76[_0x4c8a('0x26')]();};}function saveUpdates(_0x258910,_0x1eb96d){return function(_0x511f5d){if(_0x511f5d){return _0x511f5d[_0x4c8a('0x27')](_0x258910)[_0x4c8a('0x28')](function(_0x4aa3cd){return _0x4aa3cd;});}return null;};}function removeEntity(_0x337bcb,_0xb3cf9d){return function(_0x323350){if(_0x323350){return _0x323350[_0x4c8a('0x29')]()[_0x4c8a('0x28')](function(){_0x337bcb[_0x4c8a('0x20')](0xcc)[_0x4c8a('0x1b')]();});}};}function handleEntityNotFound(_0x93cf41,_0x1cbe5c){return function(_0x1f257d){if(!_0x1f257d){_0x93cf41['sendStatus'](0x194);}return _0x1f257d;};}function handleError(_0xa0b8e8,_0xaec35a){_0xaec35a=_0xaec35a||0x1f4;return function(_0x5a7f6f){logger['error'](_0x5a7f6f[_0x4c8a('0x2a')]);if(_0x5a7f6f[_0x4c8a('0x2b')]){delete _0x5a7f6f[_0x4c8a('0x2b')];}_0xa0b8e8[_0x4c8a('0x20')](_0xaec35a)[_0x4c8a('0x2c')](_0x5a7f6f);};}exports[_0x4c8a('0x2d')]=function(_0x419ae8,_0x1932af){var _0x55a9b1={},_0x3589a4={},_0x241f20={'count':0x0,'rows':[]};var _0x58d7a4=_[_0x4c8a('0x2e')](db['FaxTransferReport'][_0x4c8a('0x2f')],function(_0x4b7adc){return{'name':_0x4b7adc[_0x4c8a('0x30')],'type':_0x4b7adc[_0x4c8a('0x31')][_0x4c8a('0x32')]};});_0x3589a4['model']=_['map'](_0x58d7a4,_0x4c8a('0x2b'));_0x3589a4['query']=_[_0x4c8a('0x33')](_0x419ae8[_0x4c8a('0x34')]);_0x3589a4[_0x4c8a('0x35')]=_[_0x4c8a('0x36')](_0x3589a4[_0x4c8a('0x37')],_0x3589a4[_0x4c8a('0x34')]);_0x55a9b1['attributes']=_[_0x4c8a('0x36')](_0x3589a4['model'],qs[_0x4c8a('0x38')](_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x38')]));_0x55a9b1[_0x4c8a('0x39')]=_0x55a9b1['attributes']['length']?_0x55a9b1['attributes']:_0x3589a4['model'];if(!_0x419ae8[_0x4c8a('0x34')]['hasOwnProperty']('nolimit')){_0x55a9b1[_0x4c8a('0x1d')]=qs[_0x4c8a('0x1d')](_0x419ae8['query'][_0x4c8a('0x1d')]);_0x55a9b1['offset']=qs[_0x4c8a('0x1f')](_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x1f')]);}_0x55a9b1['order']=qs['sort'](_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x3a')]);_0x55a9b1[_0x4c8a('0x3b')]=qs[_0x4c8a('0x35')](_['pick'](_0x419ae8[_0x4c8a('0x34')],_0x3589a4[_0x4c8a('0x35')]),_0x58d7a4);if(_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x3c')]){_0x55a9b1[_0x4c8a('0x3b')]=_[_0x4c8a('0x3d')](_0x55a9b1[_0x4c8a('0x3b')],{'$or':_[_0x4c8a('0x2e')](_0x58d7a4,function(_0x192d7f){if(_0x192d7f[_0x4c8a('0x31')]!==_0x4c8a('0x3e')){var _0x5a5f47={};_0x5a5f47[_0x192d7f[_0x4c8a('0x2b')]]={'$like':'%'+_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x3c')]+'%'};return _0x5a5f47;}})});}_0x55a9b1=_[_0x4c8a('0x3d')]({},_0x55a9b1,_0x419ae8[_0x4c8a('0x3f')]);var _0x225b76={'where':_0x55a9b1[_0x4c8a('0x3b')]};return db['FaxTransferReport'][_0x4c8a('0x1e')](_0x225b76)['then'](function(_0xf52fc0){_0x241f20[_0x4c8a('0x1e')]=_0xf52fc0;if(_0x419ae8[_0x4c8a('0x34')][_0x4c8a('0x40')]){_0x55a9b1[_0x4c8a('0x41')]=[{'all':!![]}];}return db[_0x4c8a('0x42')]['findAll'](_0x55a9b1);})[_0x4c8a('0x28')](function(_0x11a516){_0x241f20[_0x4c8a('0x43')]=_0x11a516;return _0x241f20;})['then'](respondWithFilteredResult(_0x1932af,_0x55a9b1))['catch'](handleError(_0x1932af,null));};exports[_0x4c8a('0x44')]=function(_0x4d0060,_0x1ec757){var _0x2301f0={'raw':!![],'where':{'id':_0x4d0060['params']['id']}},_0x3161c2={};_0x3161c2[_0x4c8a('0x37')]=_[_0x4c8a('0x33')](db[_0x4c8a('0x42')][_0x4c8a('0x2f')]);_0x3161c2[_0x4c8a('0x34')]=_[_0x4c8a('0x33')](_0x4d0060[_0x4c8a('0x34')]);_0x3161c2[_0x4c8a('0x35')]=_[_0x4c8a('0x36')](_0x3161c2[_0x4c8a('0x37')],_0x3161c2[_0x4c8a('0x34')]);_0x2301f0[_0x4c8a('0x39')]=_[_0x4c8a('0x36')](_0x3161c2[_0x4c8a('0x37')],qs[_0x4c8a('0x38')](_0x4d0060[_0x4c8a('0x34')][_0x4c8a('0x38')]));_0x2301f0['attributes']=_0x2301f0[_0x4c8a('0x39')]['length']?_0x2301f0['attributes']:_0x3161c2[_0x4c8a('0x37')];if(_0x4d0060['query'][_0x4c8a('0x40')]){_0x2301f0[_0x4c8a('0x41')]=[{'all':!![]}];}_0x2301f0=_[_0x4c8a('0x3d')]({},_0x2301f0,_0x4d0060[_0x4c8a('0x3f')]);return db[_0x4c8a('0x42')][_0x4c8a('0x45')](_0x2301f0)[_0x4c8a('0x28')](handleEntityNotFound(_0x1ec757,null))[_0x4c8a('0x28')](respondWithResult(_0x1ec757,null))['catch'](handleError(_0x1ec757,null));};exports[_0x4c8a('0x46')]=function(_0x3f9e06,_0x38e1e7){return db[_0x4c8a('0x42')]['create'](_0x3f9e06['body'],{})[_0x4c8a('0x28')](respondWithResult(_0x38e1e7,0xc9))[_0x4c8a('0x47')](handleError(_0x38e1e7,null));};exports[_0x4c8a('0x27')]=function(_0x9080b8,_0x5caeac){if(_0x9080b8[_0x4c8a('0x48')]['id']){delete _0x9080b8[_0x4c8a('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x9080b8[_0x4c8a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5caeac,null))[_0x4c8a('0x28')](saveUpdates(_0x9080b8[_0x4c8a('0x48')],null))[_0x4c8a('0x28')](respondWithResult(_0x5caeac,null))['catch'](handleError(_0x5caeac,null));};exports[_0x4c8a('0x29')]=function(_0x47218f,_0x544caf){return db['FaxTransferReport']['find']({'where':{'id':_0x47218f['params']['id']}})[_0x4c8a('0x28')](handleEntityNotFound(_0x544caf,null))[_0x4c8a('0x28')](removeEntity(_0x544caf,null))[_0x4c8a('0x47')](handleError(_0x544caf,null));};exports['describe']=function(_0x211e28,_0x42d9a4){return db[_0x4c8a('0x42')][_0x4c8a('0x4a')]()['then'](respondWithResult(_0x42d9a4,null))[_0x4c8a('0x47')](handleError(_0x42d9a4,null));}; \ No newline at end of file +var _0x1111=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','FaxTransferReport','includeAll','findAll','rows','catch','show','fields','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection'];(function(_0x570982,_0x593909){var _0x1814f0=function(_0x542185){while(--_0x542185){_0x570982['push'](_0x570982['shift']());}};_0x1814f0(++_0x593909);}(_0x1111,0xb1));var _0x1111=function(_0x5f0977,_0x749021){_0x5f0977=_0x5f0977-0x0;var _0x379dfa=_0x1111[_0x5f0977];return _0x379dfa;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1111('0x2'));var rp=require('request-promise');var moment=require(_0x1111('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1111('0x4'));var util=require(_0x1111('0x5'));var path=require('path');var sox=require(_0x1111('0x6'));var csv=require('to-csv');var ejs=require(_0x1111('0x7'));var fs=require('fs');var fs_extra=require(_0x1111('0x8'));var _=require(_0x1111('0x9'));var squel=require(_0x1111('0xa'));var crypto=require('crypto');var jsforce=require(_0x1111('0xb'));var deskjs=require(_0x1111('0xc'));var toCsv=require(_0x1111('0xd'));var querystring=require(_0x1111('0xe'));var Papa=require(_0x1111('0xf'));var Redis=require(_0x1111('0x10'));var authService=require(_0x1111('0x11'));var qs=require(_0x1111('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1111('0x13'));var logger=require(_0x1111('0x14'))(_0x1111('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1111('0x16'));var db=require(_0x1111('0x17'))['db'];function respondWithStatusCode(_0x93408f,_0x17bc04){_0x17bc04=_0x17bc04||0xcc;return function(_0x162f3b){if(_0x162f3b){return _0x93408f[_0x1111('0x18')](_0x17bc04);}return _0x93408f[_0x1111('0x19')](_0x17bc04)['end']();};}function respondWithResult(_0x200f95,_0x3d6d91){_0x3d6d91=_0x3d6d91||0xc8;return function(_0x592dcf){if(_0x592dcf){return _0x200f95[_0x1111('0x19')](_0x3d6d91)[_0x1111('0x1a')](_0x592dcf);}};}function respondWithFilteredResult(_0x4d99b3,_0x43289a){return function(_0x3fe8e7){if(_0x3fe8e7){var _0x28b586=typeof _0x43289a[_0x1111('0x1b')]===_0x1111('0x1c')&&typeof _0x43289a[_0x1111('0x1d')]===_0x1111('0x1c');var _0xb45d5d=_0x3fe8e7[_0x1111('0x1e')];var _0x102140=_0x28b586?0x0:_0x43289a['offset'];var _0x5cdabb=_0x28b586?_0x3fe8e7[_0x1111('0x1e')]:_0x43289a[_0x1111('0x1b')]+_0x43289a[_0x1111('0x1d')];var _0x564d8f;if(_0x5cdabb>=_0xb45d5d){_0x5cdabb=_0xb45d5d;_0x564d8f=0xc8;}else{_0x564d8f=0xce;}_0x4d99b3[_0x1111('0x19')](_0x564d8f);return _0x4d99b3[_0x1111('0x1f')]('Content-Range',_0x102140+'-'+_0x5cdabb+'/'+_0xb45d5d)['json'](_0x3fe8e7);}return null;};}function patchUpdates(_0x5f3db9){return function(_0x4f89bc){try{jsonpatch[_0x1111('0x20')](_0x4f89bc,_0x5f3db9,!![]);}catch(_0x31b587){return BPromise[_0x1111('0x21')](_0x31b587);}return _0x4f89bc[_0x1111('0x22')]();};}function saveUpdates(_0xd594b1,_0x10942f){return function(_0x24614e){if(_0x24614e){return _0x24614e[_0x1111('0x23')](_0xd594b1)[_0x1111('0x24')](function(_0x29fa70){return _0x29fa70;});}return null;};}function removeEntity(_0x5af864,_0x1fd3dd){return function(_0x3f48a1){if(_0x3f48a1){return _0x3f48a1['destroy']()[_0x1111('0x24')](function(){_0x5af864[_0x1111('0x19')](0xcc)[_0x1111('0x25')]();});}};}function handleEntityNotFound(_0x59c2a9,_0x586994){return function(_0x31ada9){if(!_0x31ada9){_0x59c2a9[_0x1111('0x18')](0x194);}return _0x31ada9;};}function handleError(_0x293579,_0x24a2fe){_0x24a2fe=_0x24a2fe||0x1f4;return function(_0x515333){logger['error'](_0x515333[_0x1111('0x26')]);if(_0x515333[_0x1111('0x27')]){delete _0x515333[_0x1111('0x27')];}_0x293579['status'](_0x24a2fe)[_0x1111('0x28')](_0x515333);};}exports[_0x1111('0x29')]=function(_0xa2930e,_0x2c3ae6){var _0x59fd10={},_0x5c0898={},_0x252648={'count':0x0,'rows':[]};var _0x2ea09f=_[_0x1111('0x2a')](db['FaxTransferReport'][_0x1111('0x2b')],function(_0x228ce0){return{'name':_0x228ce0[_0x1111('0x2c')],'type':_0x228ce0[_0x1111('0x2d')][_0x1111('0x2e')]};});_0x5c0898[_0x1111('0x2f')]=_[_0x1111('0x2a')](_0x2ea09f,_0x1111('0x27'));_0x5c0898['query']=_[_0x1111('0x30')](_0xa2930e[_0x1111('0x31')]);_0x5c0898['filters']=_[_0x1111('0x32')](_0x5c0898[_0x1111('0x2f')],_0x5c0898[_0x1111('0x31')]);_0x59fd10[_0x1111('0x33')]=_[_0x1111('0x32')](_0x5c0898[_0x1111('0x2f')],qs['fields'](_0xa2930e[_0x1111('0x31')]['fields']));_0x59fd10[_0x1111('0x33')]=_0x59fd10[_0x1111('0x33')][_0x1111('0x34')]?_0x59fd10[_0x1111('0x33')]:_0x5c0898[_0x1111('0x2f')];if(!_0xa2930e['query'][_0x1111('0x35')](_0x1111('0x36'))){_0x59fd10[_0x1111('0x1d')]=qs[_0x1111('0x1d')](_0xa2930e[_0x1111('0x31')][_0x1111('0x1d')]);_0x59fd10[_0x1111('0x1b')]=qs[_0x1111('0x1b')](_0xa2930e['query'][_0x1111('0x1b')]);}_0x59fd10[_0x1111('0x37')]=qs[_0x1111('0x38')](_0xa2930e[_0x1111('0x31')][_0x1111('0x38')]);_0x59fd10[_0x1111('0x39')]=qs['filters'](_[_0x1111('0x3a')](_0xa2930e['query'],_0x5c0898[_0x1111('0x3b')]),_0x2ea09f);if(_0xa2930e['query']['filter']){_0x59fd10[_0x1111('0x39')]=_[_0x1111('0x3c')](_0x59fd10[_0x1111('0x39')],{'$or':_[_0x1111('0x2a')](_0x2ea09f,function(_0x3657d0){if(_0x3657d0[_0x1111('0x2d')]!==_0x1111('0x3d')){var _0x5ef1f5={};_0x5ef1f5[_0x3657d0[_0x1111('0x27')]]={'$like':'%'+_0xa2930e[_0x1111('0x31')][_0x1111('0x3e')]+'%'};return _0x5ef1f5;}})});}_0x59fd10=_[_0x1111('0x3c')]({},_0x59fd10,_0xa2930e[_0x1111('0x3f')]);var _0x533f0b={'where':_0x59fd10[_0x1111('0x39')]};return db[_0x1111('0x40')][_0x1111('0x1e')](_0x533f0b)[_0x1111('0x24')](function(_0x49dd43){_0x252648['count']=_0x49dd43;if(_0xa2930e[_0x1111('0x31')][_0x1111('0x41')]){_0x59fd10['include']=[{'all':!![]}];}return db[_0x1111('0x40')][_0x1111('0x42')](_0x59fd10);})[_0x1111('0x24')](function(_0x4f6871){_0x252648[_0x1111('0x43')]=_0x4f6871;return _0x252648;})[_0x1111('0x24')](respondWithFilteredResult(_0x2c3ae6,_0x59fd10))[_0x1111('0x44')](handleError(_0x2c3ae6,null));};exports[_0x1111('0x45')]=function(_0x4d0f04,_0x1f2b69){var _0xdca2a5={'raw':!![],'where':{'id':_0x4d0f04['params']['id']}},_0x39b82b={};_0x39b82b['model']=_['keys'](db['FaxTransferReport'][_0x1111('0x2b')]);_0x39b82b['query']=_['keys'](_0x4d0f04['query']);_0x39b82b[_0x1111('0x3b')]=_[_0x1111('0x32')](_0x39b82b[_0x1111('0x2f')],_0x39b82b['query']);_0xdca2a5[_0x1111('0x33')]=_[_0x1111('0x32')](_0x39b82b['model'],qs[_0x1111('0x46')](_0x4d0f04[_0x1111('0x31')]['fields']));_0xdca2a5['attributes']=_0xdca2a5[_0x1111('0x33')][_0x1111('0x34')]?_0xdca2a5['attributes']:_0x39b82b[_0x1111('0x2f')];if(_0x4d0f04[_0x1111('0x31')][_0x1111('0x41')]){_0xdca2a5['include']=[{'all':!![]}];}_0xdca2a5=_[_0x1111('0x3c')]({},_0xdca2a5,_0x4d0f04[_0x1111('0x3f')]);return db['FaxTransferReport'][_0x1111('0x47')](_0xdca2a5)[_0x1111('0x24')](handleEntityNotFound(_0x1f2b69,null))['then'](respondWithResult(_0x1f2b69,null))[_0x1111('0x44')](handleError(_0x1f2b69,null));};exports[_0x1111('0x48')]=function(_0x326d7e,_0x238c31){return db[_0x1111('0x40')][_0x1111('0x48')](_0x326d7e[_0x1111('0x49')],{})['then'](respondWithResult(_0x238c31,0xc9))[_0x1111('0x44')](handleError(_0x238c31,null));};exports[_0x1111('0x23')]=function(_0x28de6a,_0x81fc45){if(_0x28de6a[_0x1111('0x49')]['id']){delete _0x28de6a['body']['id'];}return db[_0x1111('0x40')][_0x1111('0x47')]({'where':{'id':_0x28de6a[_0x1111('0x4a')]['id']}})[_0x1111('0x24')](handleEntityNotFound(_0x81fc45,null))[_0x1111('0x24')](saveUpdates(_0x28de6a[_0x1111('0x49')],null))['then'](respondWithResult(_0x81fc45,null))['catch'](handleError(_0x81fc45,null));};exports['destroy']=function(_0x1ea866,_0x2ff6c3){return db[_0x1111('0x40')][_0x1111('0x47')]({'where':{'id':_0x1ea866['params']['id']}})[_0x1111('0x24')](handleEntityNotFound(_0x2ff6c3,null))['then'](removeEntity(_0x2ff6c3,null))['catch'](handleError(_0x2ff6c3,null));};exports[_0x1111('0x4b')]=function(_0x5242e2,_0xa887e8){return db[_0x1111('0x40')][_0x1111('0x4b')]()[_0x1111('0x24')](respondWithResult(_0xa887e8,null))[_0x1111('0x44')](handleError(_0xa887e8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7994db5..89e9853 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 _0x6427=['rimraf','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','moment','path'];(function(_0x20d39b,_0xa1e8c2){var _0x422960=function(_0x153d63){while(--_0x153d63){_0x20d39b['push'](_0x20d39b['shift']());}};_0x422960(++_0xa1e8c2);}(_0x6427,0x191));var _0x7642=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x6427[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x7642('0x0'));var util=require(_0x7642('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7642('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7642('0x3'));var rimraf=require(_0x7642('0x4'));var config=require('../../config/environment');var attributes=require(_0x7642('0x5'));module[_0x7642('0x6')]=function(_0x541e3c,_0x404548){return _0x541e3c[_0x7642('0x7')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7642('0x8'),'fields':[_0x7642('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17fb=['bluebird','path','rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x1abf8c,_0x1f8fda){var _0x18c6a3=function(_0x557d6b){while(--_0x557d6b){_0x1abf8c['push'](_0x1abf8c['shift']());}};_0x18c6a3(++_0x1f8fda);}(_0x17fb,0xa2));var _0xb17f=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0x17fb[_0x24a88e];return _0x232cbb;};'use strict';var _=require(_0xb17f('0x0'));var util=require('util');var logger=require(_0xb17f('0x1'))(_0xb17f('0x2'));var moment=require('moment');var BPromise=require(_0xb17f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb17f('0x4'));var rimraf=require(_0xb17f('0x5'));var config=require(_0xb17f('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0xb17f('0x7')]=function(_0x93e4b0,_0x5d67cd){return _0x93e4b0[_0xb17f('0x8')]('FaxTransferReport',attributes,{'tableName':_0xb17f('0x9'),'paranoid':![],'indexes':[{'name':_0xb17f('0xa'),'fields':[_0xb17f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3f52fb1..0f5e507 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 _0x5e3f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x3679a4,_0x40ea13){var _0x3ac97e=function(_0x15c0a4){while(--_0x15c0a4){_0x3679a4['push'](_0x3679a4['shift']());}};_0x3ac97e(++_0x40ea13);}(_0x5e3f,0xa4));var _0xf5e3=function(_0x20faae,_0x48a339){_0x20faae=_0x20faae-0x0;var _0x27b18b=_0x5e3f[_0x20faae];return _0x27b18b;};'use strict';var _=require(_0xf5e3('0x0'));var util=require(_0xf5e3('0x1'));var moment=require(_0xf5e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5e3('0x3'));var fs=require('fs');var Redis=require(_0xf5e3('0x4'));var db=require(_0xf5e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5e3('0x6'))(_0xf5e3('0x7'));var config=require(_0xf5e3('0x8'));var jayson=require(_0xf5e3('0x9'));var client=jayson[_0xf5e3('0xa')][_0xf5e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x534df0,_0x5b3174,_0x295d3a){return new BPromise(function(_0x220f43,_0x3dcc62){return client[_0xf5e3('0xc')](_0x534df0,_0x295d3a)[_0xf5e3('0xd')](function(_0x2ec976){logger['info'](_0xf5e3('0xe'),_0x5b3174,_0xf5e3('0xf'));logger[_0xf5e3('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5b3174,_0xf5e3('0xf'),JSON[_0xf5e3('0x11')](_0x2ec976));if(_0x2ec976[_0xf5e3('0x12')]){if(_0x2ec976[_0xf5e3('0x12')][_0xf5e3('0x13')]===0x1f4){logger[_0xf5e3('0x12')](_0xf5e3('0xe'),_0x5b3174,_0x2ec976[_0xf5e3('0x12')][_0xf5e3('0x14')]);return _0x3dcc62(_0x2ec976[_0xf5e3('0x12')][_0xf5e3('0x14')]);}logger['error'](_0xf5e3('0xe'),_0x5b3174,_0x2ec976[_0xf5e3('0x12')][_0xf5e3('0x14')]);return _0x220f43(_0x2ec976[_0xf5e3('0x12')]['message']);}else{logger[_0xf5e3('0x15')](_0xf5e3('0xe'),_0x5b3174,_0xf5e3('0xf'));_0x220f43(_0x2ec976[_0xf5e3('0x16')][_0xf5e3('0x14')]);}})[_0xf5e3('0x17')](function(_0x15a930){logger[_0xf5e3('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5b3174,_0x15a930);_0x3dcc62(_0x15a930);});});} \ No newline at end of file +var _0x6282=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1f9efa,_0x473bb1){var _0x123bce=function(_0x5b118b){while(--_0x5b118b){_0x1f9efa['push'](_0x1f9efa['shift']());}};_0x123bce(++_0x473bb1);}(_0x6282,0x1cf));var _0x2628=function(_0x3f1ad8,_0x43d4f1){_0x3f1ad8=_0x3f1ad8-0x0;var _0x232498=_0x6282[_0x3f1ad8];return _0x232498;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var moment=require(_0x2628('0x2'));var BPromise=require(_0x2628('0x3'));var rs=require(_0x2628('0x4'));var fs=require('fs');var Redis=require(_0x2628('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2628('0x6'));var logger=require(_0x2628('0x7'))('rpc');var config=require(_0x2628('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2628('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d8d88,_0x404004,_0x44c2d8){return new BPromise(function(_0x1edc16,_0x128446){return client[_0x2628('0xa')](_0x3d8d88,_0x44c2d8)[_0x2628('0xb')](function(_0x1c478f){logger['info'](_0x2628('0xc'),_0x404004,_0x2628('0xd'));logger[_0x2628('0xe')](_0x2628('0xf'),_0x404004,_0x2628('0xd'),JSON[_0x2628('0x10')](_0x1c478f));if(_0x1c478f['error']){if(_0x1c478f[_0x2628('0x11')][_0x2628('0x12')]===0x1f4){logger[_0x2628('0x11')](_0x2628('0xc'),_0x404004,_0x1c478f[_0x2628('0x11')]['message']);return _0x128446(_0x1c478f[_0x2628('0x11')][_0x2628('0x13')]);}logger[_0x2628('0x11')](_0x2628('0xc'),_0x404004,_0x1c478f[_0x2628('0x11')][_0x2628('0x13')]);return _0x1edc16(_0x1c478f[_0x2628('0x11')][_0x2628('0x13')]);}else{logger['info'](_0x2628('0xc'),_0x404004,_0x2628('0xd'));_0x1edc16(_0x1c478f[_0x2628('0x14')][_0x2628('0x13')]);}})[_0x2628('0x15')](function(_0x529f53){logger[_0x2628('0x11')](_0x2628('0xc'),_0x404004,_0x529f53);_0x128446(_0x529f53);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8648bb6..4d849c3 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 _0xe58e=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create'];(function(_0x3c495f,_0x201f95){var _0x5d62de=function(_0x25ef50){while(--_0x25ef50){_0x3c495f['push'](_0x3c495f['shift']());}};_0x5d62de(++_0x201f95);}(_0xe58e,0xec));var _0xee58=function(_0x5e0e9b,_0x17d638){_0x5e0e9b=_0x5e0e9b-0x0;var _0x42fb18=_0xe58e[_0x5e0e9b];return _0x42fb18;};'use strict';var multer=require(_0xee58('0x0'));var util=require('util');var path=require(_0xee58('0x1'));var timeout=require(_0xee58('0x2'));var express=require('express');var router=express[_0xee58('0x3')]();var fs_extra=require(_0xee58('0x4'));var auth=require(_0xee58('0x5'));var interaction=require(_0xee58('0x6'));var config=require(_0xee58('0x7'));var controller=require(_0xee58('0x8'));router[_0xee58('0x9')]('/',auth[_0xee58('0xa')](),controller[_0xee58('0xb')]);router[_0xee58('0x9')](_0xee58('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xee58('0xd'),auth[_0xee58('0xa')](),controller[_0xee58('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xee58('0xf')]);router[_0xee58('0x10')](_0xee58('0xd'),auth['isAuthenticated'](),controller[_0xee58('0x11')]);router[_0xee58('0x12')](_0xee58('0xd'),auth[_0xee58('0xa')](),controller[_0xee58('0x13')]);module[_0xee58('0x14')]=router; \ No newline at end of file +var _0xac4a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x55469d,_0x189fe2){var _0x280bfb=function(_0x528a15){while(--_0x528a15){_0x55469d['push'](_0x55469d['shift']());}};_0x280bfb(++_0x189fe2);}(_0xac4a,0x153));var _0xaac4=function(_0x22a921,_0x153044){_0x22a921=_0x22a921-0x0;var _0x336052=_0xac4a[_0x22a921];return _0x336052;};'use strict';var multer=require(_0xaac4('0x0'));var util=require('util');var path=require(_0xaac4('0x1'));var timeout=require(_0xaac4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaac4('0x3'));var auth=require(_0xaac4('0x4'));var interaction=require(_0xaac4('0x5'));var config=require(_0xaac4('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaac4('0x7')]);router['get']('/describe',auth[_0xaac4('0x8')](),controller[_0xaac4('0x9')]);router[_0xaac4('0xa')](_0xaac4('0xb'),auth[_0xaac4('0x8')](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')]('/',auth[_0xaac4('0x8')](),controller[_0xaac4('0xe')]);router['put'](_0xaac4('0xb'),auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaac4('0x10')]);module[_0xaac4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a9cb6ad..6c726b8 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 _0xc89d=['path','connect-timeout','fs-extra','../../config/environment','./intDeskAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','post','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xc89d,0x17a));var _0xdc89=function(_0xf7341c,_0x46711a){_0xf7341c=_0xf7341c-0x0;var _0x35efed=_0xc89d[_0xf7341c];return _0x35efed;};'use strict';var multer=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var path=require(_0xdc89('0x2'));var timeout=require(_0xdc89('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc89('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdc89('0x5'));var controller=require(_0xdc89('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdc89('0x7')]);router[_0xdc89('0x8')](_0xdc89('0x9'),auth[_0xdc89('0xa')](),controller[_0xdc89('0xb')]);router[_0xdc89('0x8')]('/:id/configurations',auth[_0xdc89('0xa')](),controller[_0xdc89('0xc')]);router[_0xdc89('0x8')]('/:id/fields',auth[_0xdc89('0xa')](),controller['getFields']);router[_0xdc89('0xd')]('/',auth[_0xdc89('0xa')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xdc89('0xe')]);router[_0xdc89('0xf')](_0xdc89('0x9'),auth[_0xdc89('0xa')](),controller[_0xdc89('0x10')]);router[_0xdc89('0x11')](_0xdc89('0x9'),auth[_0xdc89('0xa')](),controller[_0xdc89('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9a0b=['post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xf1ceb4,_0x3443e6){var _0x42ed45=function(_0x9ec7fa){while(--_0x9ec7fa){_0xf1ceb4['push'](_0xf1ceb4['shift']());}};_0x42ed45(++_0x3443e6);}(_0x9a0b,0x177));var _0xb9a0=function(_0x4cfbc2,_0x4be483){_0x4cfbc2=_0x4cfbc2-0x0;var _0x4bca83=_0x9a0b[_0x4cfbc2];return _0x4bca83;};'use strict';var multer=require(_0xb9a0('0x0'));var util=require(_0xb9a0('0x1'));var path=require(_0xb9a0('0x2'));var timeout=require(_0xb9a0('0x3'));var express=require(_0xb9a0('0x4'));var router=express['Router']();var fs_extra=require(_0xb9a0('0x5'));var auth=require(_0xb9a0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xb9a0('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9a0('0x8')]);router[_0xb9a0('0x7')](_0xb9a0('0x9'),auth[_0xb9a0('0xa')](),controller[_0xb9a0('0xb')]);router[_0xb9a0('0x7')](_0xb9a0('0xc'),auth[_0xb9a0('0xa')](),controller[_0xb9a0('0xd')]);router[_0xb9a0('0x7')](_0xb9a0('0xe'),auth[_0xb9a0('0xa')](),controller[_0xb9a0('0xf')]);router[_0xb9a0('0x10')]('/',auth[_0xb9a0('0xa')](),controller[_0xb9a0('0x11')]);router[_0xb9a0('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb9a0('0x12')]);router[_0xb9a0('0x13')](_0xb9a0('0x9'),auth[_0xb9a0('0xa')](),controller['update']);router[_0xb9a0('0x14')]('/:id',auth[_0xb9a0('0xa')](),controller[_0xb9a0('0x15')]);module[_0xb9a0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ed04e62..202bd65 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 _0xe95f=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x272402,_0x283488){var _0x4f8f2b=function(_0x55bc53){while(--_0x55bc53){_0x272402['push'](_0x272402['shift']());}};_0x4f8f2b(++_0x283488);}(_0xe95f,0x1d2));var _0xfe95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe95f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xfe95('0x0')]={'name':{'type':Sequelize[_0xfe95('0x1')]},'description':{'type':Sequelize[_0xfe95('0x1')]},'username':{'type':Sequelize[_0xfe95('0x1')]},'remoteUri':{'type':Sequelize[_0xfe95('0x1')]},'authType':{'type':Sequelize[_0xfe95('0x2')](_0xfe95('0x3')),'defaultValue':_0xfe95('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xfe95('0x1')]},'consumerSecret':{'type':Sequelize[_0xfe95('0x1')]},'token':{'type':Sequelize[_0xfe95('0x1')]},'tokenSecret':{'type':Sequelize[_0xfe95('0x1')]},'serverUrl':{'type':Sequelize[_0xfe95('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfe95('0x2')](_0xfe95('0x4'),_0xfe95('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa8f5=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x1e2270,_0xbcc393){var _0x5173ec=function(_0x431270){while(--_0x431270){_0x1e2270['push'](_0x1e2270['shift']());}};_0x5173ec(++_0xbcc393);}(_0xa8f5,0x18f));var _0x5a8f=function(_0x22cc36,_0x2c8292){_0x22cc36=_0x22cc36-0x0;var _0x7fc85=_0xa8f5[_0x22cc36];return _0x7fc85;};'use strict';var Sequelize=require(_0x5a8f('0x0'));module[_0x5a8f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a8f('0x2')]},'remoteUri':{'type':Sequelize[_0x5a8f('0x2')]},'authType':{'type':Sequelize[_0x5a8f('0x3')]('basic'),'defaultValue':_0x5a8f('0x4')},'password':{'type':Sequelize[_0x5a8f('0x2')]},'consumerKey':{'type':Sequelize[_0x5a8f('0x2')]},'consumerSecret':{'type':Sequelize[_0x5a8f('0x2')]},'token':{'type':Sequelize[_0x5a8f('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5a8f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5a8f('0x3')](_0x5a8f('0x5'),_0x5a8f('0x6')),'defaultValue':_0x5a8f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7dbc896..27f05ca 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 _0xa227=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','DeskAccount','include','rows','catch','params','find','create','body','getConfigurations','findOne','DeskConfiguration','filter','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','application/json','basic','headers','Authorization','toString','base64','concat','entries','active','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','util'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0xa227,0x69));var _0x7a22=function(_0x584660,_0x1cedb2){_0x584660=_0x584660-0x0;var _0x34bbc2=_0xa227[_0x584660];return _0x34bbc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a22('0x0'));var zipdir=require(_0x7a22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a22('0x2'));var moment=require(_0x7a22('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7a22('0x4'));var path=require('path');var sox=require(_0x7a22('0x5'));var csv=require(_0x7a22('0x6'));var ejs=require(_0x7a22('0x7'));var fs=require('fs');var fs_extra=require(_0x7a22('0x8'));var _=require(_0x7a22('0x9'));var squel=require(_0x7a22('0xa'));var crypto=require(_0x7a22('0xb'));var jsforce=require(_0x7a22('0xc'));var deskjs=require(_0x7a22('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a22('0xe'));var Papa=require(_0x7a22('0xf'));var Redis=require(_0x7a22('0x10'));var authService=require(_0x7a22('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a22('0x12'));var hardwareService=require(_0x7a22('0x13'));var logger=require(_0x7a22('0x14'))(_0x7a22('0x15'));var utils=require(_0x7a22('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7a22('0x17'));var db=require(_0x7a22('0x18'))['db'];var integrations=require(_0x7a22('0x19'));function respondWithStatusCode(_0xa0ae8c,_0x400004){_0x400004=_0x400004||0xcc;return function(_0x4dabe7){if(_0x4dabe7){return _0xa0ae8c[_0x7a22('0x1a')](_0x400004);}return _0xa0ae8c[_0x7a22('0x1b')](_0x400004)['end']();};}function respondWithResult(_0x329da7,_0x20fc0c){_0x20fc0c=_0x20fc0c||0xc8;return function(_0x57ac74){if(_0x57ac74){return _0x329da7[_0x7a22('0x1b')](_0x20fc0c)[_0x7a22('0x1c')](_0x57ac74);}};}function respondWithFilteredResult(_0x56b7d9,_0x1c5702){return function(_0xe80d41){if(_0xe80d41){var _0x224f40=typeof _0x1c5702['offset']===_0x7a22('0x1d')&&typeof _0x1c5702['limit']===_0x7a22('0x1d');var _0xc71cc5=_0xe80d41[_0x7a22('0x1e')];var _0x3199e5=_0x224f40?0x0:_0x1c5702[_0x7a22('0x1f')];var _0x55c311=_0x224f40?_0xe80d41[_0x7a22('0x1e')]:_0x1c5702[_0x7a22('0x1f')]+_0x1c5702[_0x7a22('0x20')];var _0x593da9;if(_0x55c311>=_0xc71cc5){_0x55c311=_0xc71cc5;_0x593da9=0xc8;}else{_0x593da9=0xce;}_0x56b7d9['status'](_0x593da9);return _0x56b7d9[_0x7a22('0x21')](_0x7a22('0x22'),_0x3199e5+'-'+_0x55c311+'/'+_0xc71cc5)[_0x7a22('0x1c')](_0xe80d41);}return null;};}function patchUpdates(_0x5cbeb2){return function(_0x2e827a){try{jsonpatch['apply'](_0x2e827a,_0x5cbeb2,!![]);}catch(_0x3b999f){return BPromise[_0x7a22('0x23')](_0x3b999f);}return _0x2e827a[_0x7a22('0x24')]();};}function saveUpdates(_0x2c3377,_0x58aeec){return function(_0x2ff937){if(_0x2ff937){return _0x2ff937[_0x7a22('0x25')](_0x2c3377)[_0x7a22('0x26')](function(_0x30a1bb){return _0x30a1bb;});}return null;};}function removeEntity(_0xa35d49,_0x1c7e17){return function(_0x518012){if(_0x518012){return _0x518012[_0x7a22('0x27')]()['then'](function(){_0xa35d49[_0x7a22('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36923c,_0x9016aa){return function(_0x2541ec){if(!_0x2541ec){_0x36923c[_0x7a22('0x1a')](0x194);}return _0x2541ec;};}function handleError(_0x2d1cfe,_0x116406){_0x116406=_0x116406||0x1f4;return function(_0xe70680){logger['error'](_0xe70680['stack']);if(_0xe70680[_0x7a22('0x28')]){delete _0xe70680[_0x7a22('0x28')];}_0x2d1cfe[_0x7a22('0x1b')](_0x116406)[_0x7a22('0x29')](_0xe70680);};}exports[_0x7a22('0x2a')]=function(_0x19fa69,_0x19f89a){var _0x518217={},_0x34c952={},_0x16b047={'count':0x0,'rows':[]};var _0x5f905b=_[_0x7a22('0x2b')](db['DeskAccount'][_0x7a22('0x2c')],function(_0x211ba7){return{'name':_0x211ba7[_0x7a22('0x2d')],'type':_0x211ba7[_0x7a22('0x2e')]['key']};});_0x34c952[_0x7a22('0x2f')]=_['map'](_0x5f905b,_0x7a22('0x28'));_0x34c952['query']=_[_0x7a22('0x30')](_0x19fa69[_0x7a22('0x31')]);_0x34c952[_0x7a22('0x32')]=_[_0x7a22('0x33')](_0x34c952[_0x7a22('0x2f')],_0x34c952['query']);_0x518217[_0x7a22('0x34')]=_['intersection'](_0x34c952['model'],qs[_0x7a22('0x35')](_0x19fa69[_0x7a22('0x31')][_0x7a22('0x35')]));_0x518217[_0x7a22('0x34')]=_0x518217[_0x7a22('0x34')][_0x7a22('0x36')]?_0x518217['attributes']:_0x34c952[_0x7a22('0x2f')];if(!_0x19fa69['query'][_0x7a22('0x37')](_0x7a22('0x38'))){_0x518217[_0x7a22('0x20')]=qs[_0x7a22('0x20')](_0x19fa69[_0x7a22('0x31')][_0x7a22('0x20')]);_0x518217['offset']=qs[_0x7a22('0x1f')](_0x19fa69[_0x7a22('0x31')][_0x7a22('0x1f')]);}_0x518217['order']=qs[_0x7a22('0x39')](_0x19fa69[_0x7a22('0x31')][_0x7a22('0x39')]);_0x518217[_0x7a22('0x3a')]=qs['filters'](_[_0x7a22('0x3b')](_0x19fa69[_0x7a22('0x31')],_0x34c952[_0x7a22('0x32')]),_0x5f905b);if(_0x19fa69[_0x7a22('0x31')]['filter']){_0x518217[_0x7a22('0x3a')]=_[_0x7a22('0x3c')](_0x518217['where'],{'$or':_[_0x7a22('0x2b')](_0x5f905b,function(_0x357503){if(_0x357503[_0x7a22('0x2e')]!==_0x7a22('0x3d')){var _0x5e2ab2={};_0x5e2ab2[_0x357503[_0x7a22('0x28')]]={'$like':'%'+_0x19fa69['query']['filter']+'%'};return _0x5e2ab2;}})});}_0x518217=_[_0x7a22('0x3c')]({},_0x518217,_0x19fa69[_0x7a22('0x3e')]);var _0x3d4b6e={'where':_0x518217[_0x7a22('0x3a')]};return db[_0x7a22('0x3f')][_0x7a22('0x1e')](_0x3d4b6e)[_0x7a22('0x26')](function(_0xcbf1e5){_0x16b047[_0x7a22('0x1e')]=_0xcbf1e5;if(_0x19fa69[_0x7a22('0x31')]['includeAll']){_0x518217[_0x7a22('0x40')]=[{'all':!![]}];}return db[_0x7a22('0x3f')]['findAll'](_0x518217);})[_0x7a22('0x26')](function(_0x498095){_0x16b047[_0x7a22('0x41')]=_0x498095;return _0x16b047;})[_0x7a22('0x26')](respondWithFilteredResult(_0x19f89a,_0x518217))[_0x7a22('0x42')](handleError(_0x19f89a,null));};exports['show']=function(_0x1387fd,_0x1d9024){var _0x34cde9={'raw':![],'where':{'id':_0x1387fd[_0x7a22('0x43')]['id']}},_0x202b71={};_0x202b71['model']=_[_0x7a22('0x30')](db[_0x7a22('0x3f')][_0x7a22('0x2c')]);_0x202b71['query']=_[_0x7a22('0x30')](_0x1387fd[_0x7a22('0x31')]);_0x202b71[_0x7a22('0x32')]=_[_0x7a22('0x33')](_0x202b71['model'],_0x202b71[_0x7a22('0x31')]);_0x34cde9[_0x7a22('0x34')]=_[_0x7a22('0x33')](_0x202b71[_0x7a22('0x2f')],qs['fields'](_0x1387fd['query']['fields']));_0x34cde9[_0x7a22('0x34')]=_0x34cde9[_0x7a22('0x34')][_0x7a22('0x36')]?_0x34cde9['attributes']:_0x202b71[_0x7a22('0x2f')];if(_0x1387fd[_0x7a22('0x31')]['includeAll']){_0x34cde9['include']=[{'all':!![]}];}_0x34cde9=_['merge']({},_0x34cde9,_0x1387fd[_0x7a22('0x3e')]);return db['DeskAccount'][_0x7a22('0x44')](_0x34cde9)[_0x7a22('0x26')](handleEntityNotFound(_0x1d9024,null))[_0x7a22('0x26')](respondWithResult(_0x1d9024,null))['catch'](handleError(_0x1d9024,null));};exports[_0x7a22('0x45')]=function(_0x38109a,_0xadbfd){return db['DeskAccount'][_0x7a22('0x45')](_0x38109a[_0x7a22('0x46')],{})[_0x7a22('0x26')](respondWithResult(_0xadbfd,0xc9))[_0x7a22('0x42')](handleError(_0xadbfd,null));};exports['update']=function(_0x239a0b,_0x47d6da){if(_0x239a0b[_0x7a22('0x46')]['id']){delete _0x239a0b['body']['id'];}return db[_0x7a22('0x3f')]['find']({'where':{'id':_0x239a0b[_0x7a22('0x43')]['id']}})[_0x7a22('0x26')](handleEntityNotFound(_0x47d6da,null))[_0x7a22('0x26')](saveUpdates(_0x239a0b[_0x7a22('0x46')],null))[_0x7a22('0x26')](respondWithResult(_0x47d6da,null))[_0x7a22('0x42')](handleError(_0x47d6da,null));};exports['destroy']=function(_0x48a319,_0x596032){return db[_0x7a22('0x3f')][_0x7a22('0x44')]({'where':{'id':_0x48a319[_0x7a22('0x43')]['id']}})[_0x7a22('0x26')](handleEntityNotFound(_0x596032,null))[_0x7a22('0x26')](removeEntity(_0x596032,null))[_0x7a22('0x42')](handleError(_0x596032,null));};exports[_0x7a22('0x47')]=function(_0x46c186,_0x3c567d,_0x4a8d42){var _0xf5cf65={};var _0x37933b={};var _0x4da9e5;var _0x57ded9;return db[_0x7a22('0x3f')][_0x7a22('0x48')]({'where':{'id':_0x46c186[_0x7a22('0x43')]['id']}})[_0x7a22('0x26')](handleEntityNotFound(_0x3c567d,null))[_0x7a22('0x26')](function(_0x542327){if(_0x542327){_0x4da9e5=_0x542327;_0x37933b[_0x7a22('0x2f')]=_[_0x7a22('0x30')](db[_0x7a22('0x49')][_0x7a22('0x2c')]);_0x37933b[_0x7a22('0x31')]=_[_0x7a22('0x30')](_0x46c186[_0x7a22('0x31')]);_0x37933b['filters']=_['intersection'](_0x37933b['model'],_0x37933b[_0x7a22('0x31')]);_0xf5cf65[_0x7a22('0x34')]=_[_0x7a22('0x33')](_0x37933b[_0x7a22('0x2f')],qs[_0x7a22('0x35')](_0x46c186[_0x7a22('0x31')][_0x7a22('0x35')]));_0xf5cf65[_0x7a22('0x34')]=_0xf5cf65[_0x7a22('0x34')][_0x7a22('0x36')]?_0xf5cf65['attributes']:_0x37933b[_0x7a22('0x2f')];_0xf5cf65['order']=qs[_0x7a22('0x39')](_0x46c186['query'][_0x7a22('0x39')]);_0xf5cf65['where']=qs['filters'](_[_0x7a22('0x3b')](_0x46c186[_0x7a22('0x31')],_0x37933b[_0x7a22('0x32')]));if(_0x46c186[_0x7a22('0x31')][_0x7a22('0x4a')]){_0xf5cf65[_0x7a22('0x3a')]=_['merge'](_0xf5cf65[_0x7a22('0x3a')],{'$or':_[_0x7a22('0x2b')](_0xf5cf65[_0x7a22('0x34')],function(_0x1f4ce3){var _0x41ccc7={};_0x41ccc7[_0x1f4ce3]={'$like':'%'+_0x46c186['query']['filter']+'%'};return _0x41ccc7;})});}_0xf5cf65=_['merge']({},_0xf5cf65,_0x46c186[_0x7a22('0x3e')]);return _0x4da9e5[_0x7a22('0x47')](_0xf5cf65);}})[_0x7a22('0x26')](function(_0x25bb6b){if(_0x25bb6b){_0x57ded9=_0x25bb6b['length'];if(!_0x46c186[_0x7a22('0x31')][_0x7a22('0x37')]('nolimit')){_0xf5cf65[_0x7a22('0x20')]=qs[_0x7a22('0x20')](_0x46c186[_0x7a22('0x31')]['limit']);_0xf5cf65['offset']=qs[_0x7a22('0x1f')](_0x46c186[_0x7a22('0x31')]['offset']);}return _0x4da9e5['getConfigurations'](_0xf5cf65);}})['then'](function(_0x21a239){if(_0x21a239){return _0x21a239?{'count':_0x57ded9,'rows':_0x21a239}:null;}})[_0x7a22('0x26')](respondWithResult(_0x3c567d,null))['catch'](handleError(_0x3c567d,null));};exports['addConfiguration']=function(_0x5cfd24,_0x39a314,_0x15c1d3){if(_0x5cfd24[_0x7a22('0x46')]['id']){delete _0x5cfd24[_0x7a22('0x46')]['id'];}return db[_0x7a22('0x3f')][_0x7a22('0x48')]({'where':{'id':_0x5cfd24['params']['id']}})['then'](handleEntityNotFound(_0x39a314,null))[_0x7a22('0x26')](function(_0x12842d){if(_0x12842d){_0x5cfd24[_0x7a22('0x46')][_0x7a22('0x4b')]=_0x12842d['id'];_0x5cfd24['body'][_0x7a22('0x4c')]=integrations[_0x7a22('0x4d')](_0x5cfd24[_0x7a22('0x46')][_0x7a22('0x4e')],_0x5cfd24[_0x7a22('0x46')][_0x7a22('0x2e')]);_0x5cfd24[_0x7a22('0x46')][_0x7a22('0x4f')]=integrations[_0x7a22('0x50')](_0x5cfd24[_0x7a22('0x46')][_0x7a22('0x4e')],_0x5cfd24['body']['type']);return db['DeskConfiguration'][_0x7a22('0x45')](_0x5cfd24[_0x7a22('0x46')],{'include':[{'model':db[_0x7a22('0x51')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x7a22('0x4f')}]});}return null;})['then'](respondWithResult(_0x39a314,null))[_0x7a22('0x42')](handleError(_0x39a314,null));};exports[_0x7a22('0x52')]=function(_0x9333f5,_0x1e1aab,_0x2433af){var _0x549b62=[{'name':_0x7a22('0x53'),'label':_0x7a22('0x53'),'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 _0x81be0a='';return db[_0x7a22('0x3f')][_0x7a22('0x48')]({'where':{'id':_0x9333f5['params']['id']},'attributes':['id',_0x7a22('0x54'),_0x7a22('0x55'),_0x7a22('0x56'),_0x7a22('0x57'),_0x7a22('0x58'),_0x7a22('0x59'),_0x7a22('0x5a'),_0x7a22('0x5b')]})[_0x7a22('0x26')](handleEntityNotFound(_0x1e1aab,null))[_0x7a22('0x26')](function(_0x4410ec){if(_0x4410ec){_0x81be0a=_0x4410ec[_0x7a22('0x54')];var _0x41bca3=_0x81be0a[_0x7a22('0x5c')](-0x1);if(_0x41bca3==='/'){_0x81be0a=_0x81be0a['substring'](0x0,_0x81be0a['lastIndexOf'](_0x41bca3));}var _0x1ceb7b={'method':_0x7a22('0x5d'),'uri':util[_0x7a22('0x5e')]('%s/custom_fields',_0x81be0a),'headers':{'Content-Type':_0x7a22('0x5f'),'Accept':_0x7a22('0x5f')},'json':!![]};if(_0x4410ec[_0x7a22('0x55')]===_0x7a22('0x60')){_0x1ceb7b[_0x7a22('0x61')][_0x7a22('0x62')]=util['format']('Basic\x20%s',new Buffer(util[_0x7a22('0x5e')]('%s:%s',_0x4410ec['username'],_0x4410ec[_0x7a22('0x57')]))[_0x7a22('0x63')](_0x7a22('0x64')));}return rp(_0x1ceb7b)[_0x7a22('0x26')](function(_0x189bd6){return _0x549b62[_0x7a22('0x65')](_[_0x7a22('0x2b')](_0x189bd6['_embedded'][_0x7a22('0x66')],function(_0x4058e2){return{'id':_0x4058e2[_0x7a22('0x28')],'name':_0x4058e2[_0x7a22('0x28')],'type':_0x4058e2[_0x7a22('0x2e')],'active':_0x4058e2[_0x7a22('0x67')],'label':_0x4058e2['label'],'custom':!![]};}));});}})[_0x7a22('0x26')](function(_0x1c2c36){return{'count':_0x1c2c36[_0x7a22('0x36')],'rows':_0x1c2c36};})[_0x7a22('0x26')](respondWithResult(_0x1e1aab,null))[_0x7a22('0x42')](function(_0x20282){var _0x4c743a=_0x9333f5[_0x7a22('0x31')]['test']?0x1f4:_0x20282['statusCode']||0x1f4;logger[_0x7a22('0x68')](_0x7a22('0x69'),'getFields',_0x4c743a,JSON[_0x7a22('0x6a')](_0x20282));delete _0x20282[_0x7a22('0x28')];if(_0x4c743a===0x191){_0x4c743a=0x190;}_0x1e1aab[_0x7a22('0x1b')](_0x4c743a)['send'](_0x9333f5[_0x7a22('0x31')][_0x7a22('0x6b')]?{'message':_0x7a22('0x6c'),'statusCode':_0x20282[_0x7a22('0x6d')]}:_0x20282);});}; \ No newline at end of file +var _0x9a38=['fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','then','catch','show','params','keys','includeAll','find','create','body','getConfigurations','DeskConfiguration','rawAttributes','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','password','toString','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','DeskAccount'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x9a38,0x12c));var _0x89a3=function(_0x531695,_0x91f94c){_0x531695=_0x531695-0x0;var _0x1216b2=_0x9a38[_0x531695];return _0x1216b2;};'use strict';var emlformat=require(_0x89a3('0x0'));var rimraf=require(_0x89a3('0x1'));var zipdir=require(_0x89a3('0x2'));var jsonpatch=require(_0x89a3('0x3'));var rp=require(_0x89a3('0x4'));var moment=require(_0x89a3('0x5'));var BPromise=require(_0x89a3('0x6'));var Mustache=require('mustache');var util=require(_0x89a3('0x7'));var path=require(_0x89a3('0x8'));var sox=require('sox');var csv=require(_0x89a3('0x9'));var ejs=require(_0x89a3('0xa'));var fs=require('fs');var fs_extra=require(_0x89a3('0xb'));var _=require(_0x89a3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x89a3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x89a3('0xe'));var Papa=require('papaparse');var Redis=require(_0x89a3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x89a3('0x10'));var as=require(_0x89a3('0x11'));var hardwareService=require(_0x89a3('0x12'));var logger=require(_0x89a3('0x13'))('api');var utils=require(_0x89a3('0x14'));var config=require(_0x89a3('0x15'));var licenseUtil=require(_0x89a3('0x16'));var db=require(_0x89a3('0x17'))['db'];var integrations=require(_0x89a3('0x18'));function respondWithStatusCode(_0x26de6f,_0x53a2d8){_0x53a2d8=_0x53a2d8||0xcc;return function(_0x448e05){if(_0x448e05){return _0x26de6f[_0x89a3('0x19')](_0x53a2d8);}return _0x26de6f[_0x89a3('0x1a')](_0x53a2d8)[_0x89a3('0x1b')]();};}function respondWithResult(_0x3962d6,_0x59f4e7){_0x59f4e7=_0x59f4e7||0xc8;return function(_0x5a3774){if(_0x5a3774){return _0x3962d6['status'](_0x59f4e7)[_0x89a3('0x1c')](_0x5a3774);}};}function respondWithFilteredResult(_0x3b1874,_0x5c4aa3){return function(_0x18c926){if(_0x18c926){var _0x3fed12=typeof _0x5c4aa3[_0x89a3('0x1d')]===_0x89a3('0x1e')&&typeof _0x5c4aa3['limit']===_0x89a3('0x1e');var _0x40dd05=_0x18c926['count'];var _0x229c1f=_0x3fed12?0x0:_0x5c4aa3[_0x89a3('0x1d')];var _0x5462af=_0x3fed12?_0x18c926[_0x89a3('0x1f')]:_0x5c4aa3[_0x89a3('0x1d')]+_0x5c4aa3[_0x89a3('0x20')];var _0x251cee;if(_0x5462af>=_0x40dd05){_0x5462af=_0x40dd05;_0x251cee=0xc8;}else{_0x251cee=0xce;}_0x3b1874[_0x89a3('0x1a')](_0x251cee);return _0x3b1874[_0x89a3('0x21')]('Content-Range',_0x229c1f+'-'+_0x5462af+'/'+_0x40dd05)[_0x89a3('0x1c')](_0x18c926);}return null;};}function patchUpdates(_0x5474ee){return function(_0x48b722){try{jsonpatch[_0x89a3('0x22')](_0x48b722,_0x5474ee,!![]);}catch(_0x2b693f){return BPromise[_0x89a3('0x23')](_0x2b693f);}return _0x48b722[_0x89a3('0x24')]();};}function saveUpdates(_0x57c37b,_0x50de27){return function(_0x1e767c){if(_0x1e767c){return _0x1e767c[_0x89a3('0x25')](_0x57c37b)['then'](function(_0x16ddf6){return _0x16ddf6;});}return null;};}function removeEntity(_0x58fc67,_0x59a252){return function(_0x2f107f){if(_0x2f107f){return _0x2f107f[_0x89a3('0x26')]()['then'](function(){_0x58fc67['status'](0xcc)[_0x89a3('0x1b')]();});}};}function handleEntityNotFound(_0x1ccdf6,_0x264af1){return function(_0x3f3184){if(!_0x3f3184){_0x1ccdf6[_0x89a3('0x19')](0x194);}return _0x3f3184;};}function handleError(_0x524287,_0x53dbfc){_0x53dbfc=_0x53dbfc||0x1f4;return function(_0x1b1739){logger[_0x89a3('0x27')](_0x1b1739[_0x89a3('0x28')]);if(_0x1b1739[_0x89a3('0x29')]){delete _0x1b1739[_0x89a3('0x29')];}_0x524287['status'](_0x53dbfc)[_0x89a3('0x2a')](_0x1b1739);};}exports[_0x89a3('0x2b')]=function(_0x4e0e1a,_0x2c13c){var _0x3c0b62={},_0x3da647={},_0x11a4dd={'count':0x0,'rows':[]};var _0x166831=_['map'](db[_0x89a3('0x2c')]['rawAttributes'],function(_0x60ab7a){return{'name':_0x60ab7a[_0x89a3('0x2d')],'type':_0x60ab7a['type'][_0x89a3('0x2e')]};});_0x3da647[_0x89a3('0x2f')]=_[_0x89a3('0x30')](_0x166831,_0x89a3('0x29'));_0x3da647[_0x89a3('0x31')]=_['keys'](_0x4e0e1a[_0x89a3('0x31')]);_0x3da647[_0x89a3('0x32')]=_[_0x89a3('0x33')](_0x3da647[_0x89a3('0x2f')],_0x3da647[_0x89a3('0x31')]);_0x3c0b62[_0x89a3('0x34')]=_[_0x89a3('0x33')](_0x3da647[_0x89a3('0x2f')],qs[_0x89a3('0x35')](_0x4e0e1a[_0x89a3('0x31')]['fields']));_0x3c0b62[_0x89a3('0x34')]=_0x3c0b62['attributes'][_0x89a3('0x36')]?_0x3c0b62[_0x89a3('0x34')]:_0x3da647['model'];if(!_0x4e0e1a[_0x89a3('0x31')][_0x89a3('0x37')](_0x89a3('0x38'))){_0x3c0b62[_0x89a3('0x20')]=qs[_0x89a3('0x20')](_0x4e0e1a[_0x89a3('0x31')][_0x89a3('0x20')]);_0x3c0b62[_0x89a3('0x1d')]=qs[_0x89a3('0x1d')](_0x4e0e1a['query'][_0x89a3('0x1d')]);}_0x3c0b62[_0x89a3('0x39')]=qs[_0x89a3('0x3a')](_0x4e0e1a[_0x89a3('0x31')]['sort']);_0x3c0b62[_0x89a3('0x3b')]=qs['filters'](_[_0x89a3('0x3c')](_0x4e0e1a[_0x89a3('0x31')],_0x3da647[_0x89a3('0x32')]),_0x166831);if(_0x4e0e1a[_0x89a3('0x31')]['filter']){_0x3c0b62[_0x89a3('0x3b')]=_[_0x89a3('0x3d')](_0x3c0b62[_0x89a3('0x3b')],{'$or':_[_0x89a3('0x30')](_0x166831,function(_0x95c318){if(_0x95c318[_0x89a3('0x3e')]!==_0x89a3('0x3f')){var _0x38853a={};_0x38853a[_0x95c318['name']]={'$like':'%'+_0x4e0e1a[_0x89a3('0x31')][_0x89a3('0x40')]+'%'};return _0x38853a;}})});}_0x3c0b62=_[_0x89a3('0x3d')]({},_0x3c0b62,_0x4e0e1a[_0x89a3('0x41')]);var _0x498492={'where':_0x3c0b62[_0x89a3('0x3b')]};return db[_0x89a3('0x2c')][_0x89a3('0x1f')](_0x498492)['then'](function(_0x314509){_0x11a4dd[_0x89a3('0x1f')]=_0x314509;if(_0x4e0e1a[_0x89a3('0x31')]['includeAll']){_0x3c0b62[_0x89a3('0x42')]=[{'all':!![]}];}return db[_0x89a3('0x2c')]['findAll'](_0x3c0b62);})[_0x89a3('0x43')](function(_0x43e41b){_0x11a4dd['rows']=_0x43e41b;return _0x11a4dd;})[_0x89a3('0x43')](respondWithFilteredResult(_0x2c13c,_0x3c0b62))[_0x89a3('0x44')](handleError(_0x2c13c,null));};exports[_0x89a3('0x45')]=function(_0x46f11a,_0x2c2dab){var _0x5aebc3={'raw':![],'where':{'id':_0x46f11a[_0x89a3('0x46')]['id']}},_0x4eabf8={};_0x4eabf8['model']=_['keys'](db[_0x89a3('0x2c')]['rawAttributes']);_0x4eabf8[_0x89a3('0x31')]=_[_0x89a3('0x47')](_0x46f11a[_0x89a3('0x31')]);_0x4eabf8[_0x89a3('0x32')]=_[_0x89a3('0x33')](_0x4eabf8[_0x89a3('0x2f')],_0x4eabf8['query']);_0x5aebc3['attributes']=_[_0x89a3('0x33')](_0x4eabf8[_0x89a3('0x2f')],qs['fields'](_0x46f11a[_0x89a3('0x31')][_0x89a3('0x35')]));_0x5aebc3[_0x89a3('0x34')]=_0x5aebc3[_0x89a3('0x34')]['length']?_0x5aebc3[_0x89a3('0x34')]:_0x4eabf8[_0x89a3('0x2f')];if(_0x46f11a[_0x89a3('0x31')][_0x89a3('0x48')]){_0x5aebc3['include']=[{'all':!![]}];}_0x5aebc3=_[_0x89a3('0x3d')]({},_0x5aebc3,_0x46f11a[_0x89a3('0x41')]);return db[_0x89a3('0x2c')][_0x89a3('0x49')](_0x5aebc3)[_0x89a3('0x43')](handleEntityNotFound(_0x2c2dab,null))[_0x89a3('0x43')](respondWithResult(_0x2c2dab,null))[_0x89a3('0x44')](handleError(_0x2c2dab,null));};exports[_0x89a3('0x4a')]=function(_0x192ffd,_0x16cc02){return db[_0x89a3('0x2c')][_0x89a3('0x4a')](_0x192ffd[_0x89a3('0x4b')],{})['then'](respondWithResult(_0x16cc02,0xc9))['catch'](handleError(_0x16cc02,null));};exports[_0x89a3('0x25')]=function(_0x584e32,_0x154e88){if(_0x584e32[_0x89a3('0x4b')]['id']){delete _0x584e32[_0x89a3('0x4b')]['id'];}return db[_0x89a3('0x2c')][_0x89a3('0x49')]({'where':{'id':_0x584e32['params']['id']}})[_0x89a3('0x43')](handleEntityNotFound(_0x154e88,null))[_0x89a3('0x43')](saveUpdates(_0x584e32['body'],null))['then'](respondWithResult(_0x154e88,null))['catch'](handleError(_0x154e88,null));};exports[_0x89a3('0x26')]=function(_0x275441,_0x35b1b9){return db[_0x89a3('0x2c')]['find']({'where':{'id':_0x275441[_0x89a3('0x46')]['id']}})[_0x89a3('0x43')](handleEntityNotFound(_0x35b1b9,null))[_0x89a3('0x43')](removeEntity(_0x35b1b9,null))['catch'](handleError(_0x35b1b9,null));};exports[_0x89a3('0x4c')]=function(_0xf0f317,_0x32baa8,_0x5ea2fe){var _0x292e2d={};var _0x5a96c4={};var _0x21b273;var _0x4e5d07;return db[_0x89a3('0x2c')]['findOne']({'where':{'id':_0xf0f317[_0x89a3('0x46')]['id']}})[_0x89a3('0x43')](handleEntityNotFound(_0x32baa8,null))['then'](function(_0x1535a6){if(_0x1535a6){_0x21b273=_0x1535a6;_0x5a96c4['model']=_['keys'](db[_0x89a3('0x4d')][_0x89a3('0x4e')]);_0x5a96c4[_0x89a3('0x31')]=_['keys'](_0xf0f317[_0x89a3('0x31')]);_0x5a96c4['filters']=_['intersection'](_0x5a96c4[_0x89a3('0x2f')],_0x5a96c4[_0x89a3('0x31')]);_0x292e2d[_0x89a3('0x34')]=_[_0x89a3('0x33')](_0x5a96c4[_0x89a3('0x2f')],qs[_0x89a3('0x35')](_0xf0f317[_0x89a3('0x31')][_0x89a3('0x35')]));_0x292e2d['attributes']=_0x292e2d['attributes'][_0x89a3('0x36')]?_0x292e2d[_0x89a3('0x34')]:_0x5a96c4['model'];_0x292e2d['order']=qs[_0x89a3('0x3a')](_0xf0f317[_0x89a3('0x31')][_0x89a3('0x3a')]);_0x292e2d[_0x89a3('0x3b')]=qs[_0x89a3('0x32')](_[_0x89a3('0x3c')](_0xf0f317['query'],_0x5a96c4[_0x89a3('0x32')]));if(_0xf0f317['query'][_0x89a3('0x40')]){_0x292e2d[_0x89a3('0x3b')]=_[_0x89a3('0x3d')](_0x292e2d[_0x89a3('0x3b')],{'$or':_[_0x89a3('0x30')](_0x292e2d['attributes'],function(_0x44fbf8){var _0x21a190={};_0x21a190[_0x44fbf8]={'$like':'%'+_0xf0f317[_0x89a3('0x31')][_0x89a3('0x40')]+'%'};return _0x21a190;})});}_0x292e2d=_[_0x89a3('0x3d')]({},_0x292e2d,_0xf0f317[_0x89a3('0x41')]);return _0x21b273[_0x89a3('0x4c')](_0x292e2d);}})['then'](function(_0x326258){if(_0x326258){_0x4e5d07=_0x326258['length'];if(!_0xf0f317[_0x89a3('0x31')][_0x89a3('0x37')](_0x89a3('0x38'))){_0x292e2d[_0x89a3('0x20')]=qs[_0x89a3('0x20')](_0xf0f317[_0x89a3('0x31')][_0x89a3('0x20')]);_0x292e2d[_0x89a3('0x1d')]=qs['offset'](_0xf0f317[_0x89a3('0x31')][_0x89a3('0x1d')]);}return _0x21b273['getConfigurations'](_0x292e2d);}})['then'](function(_0x2a0ef0){if(_0x2a0ef0){return _0x2a0ef0?{'count':_0x4e5d07,'rows':_0x2a0ef0}:null;}})[_0x89a3('0x43')](respondWithResult(_0x32baa8,null))['catch'](handleError(_0x32baa8,null));};exports[_0x89a3('0x4f')]=function(_0x68d1bc,_0x419426,_0x186157){if(_0x68d1bc[_0x89a3('0x4b')]['id']){delete _0x68d1bc[_0x89a3('0x4b')]['id'];}return db[_0x89a3('0x2c')][_0x89a3('0x50')]({'where':{'id':_0x68d1bc[_0x89a3('0x46')]['id']}})[_0x89a3('0x43')](handleEntityNotFound(_0x419426,null))[_0x89a3('0x43')](function(_0x218d8e){if(_0x218d8e){_0x68d1bc[_0x89a3('0x4b')][_0x89a3('0x51')]=_0x218d8e['id'];_0x68d1bc[_0x89a3('0x4b')][_0x89a3('0x52')]=integrations[_0x89a3('0x53')](_0x68d1bc[_0x89a3('0x4b')][_0x89a3('0x54')],_0x68d1bc[_0x89a3('0x4b')][_0x89a3('0x3e')]);_0x68d1bc[_0x89a3('0x4b')]['Descriptions']=integrations[_0x89a3('0x55')](_0x68d1bc['body']['channel'],_0x68d1bc['body']['type']);return db[_0x89a3('0x4d')]['create'](_0x68d1bc[_0x89a3('0x4b')],{'include':[{'model':db[_0x89a3('0x56')],'as':'Subjects'},{'model':db[_0x89a3('0x56')],'as':_0x89a3('0x57')}]});}return null;})[_0x89a3('0x43')](respondWithResult(_0x419426,null))[_0x89a3('0x44')](handleError(_0x419426,null));};exports[_0x89a3('0x58')]=function(_0x124eb0,_0x3efa0f,_0x14d5f2){var _0x5d9440=[{'name':_0x89a3('0x59'),'label':_0x89a3('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5af5b6='';return db[_0x89a3('0x2c')][_0x89a3('0x50')]({'where':{'id':_0x124eb0[_0x89a3('0x46')]['id']},'attributes':['id',_0x89a3('0x5a'),_0x89a3('0x5b'),'username','password',_0x89a3('0x5c'),_0x89a3('0x5d'),_0x89a3('0x5e'),_0x89a3('0x5f')]})['then'](handleEntityNotFound(_0x3efa0f,null))[_0x89a3('0x43')](function(_0x2f4818){if(_0x2f4818){_0x5af5b6=_0x2f4818[_0x89a3('0x5a')];var _0x882cd4=_0x5af5b6[_0x89a3('0x60')](-0x1);if(_0x882cd4==='/'){_0x5af5b6=_0x5af5b6['substring'](0x0,_0x5af5b6['lastIndexOf'](_0x882cd4));}var _0x58dac8={'method':_0x89a3('0x61'),'uri':util[_0x89a3('0x62')]('%s/custom_fields',_0x5af5b6),'headers':{'Content-Type':_0x89a3('0x63'),'Accept':_0x89a3('0x63')},'json':!![]};if(_0x2f4818[_0x89a3('0x5b')]===_0x89a3('0x64')){_0x58dac8[_0x89a3('0x65')][_0x89a3('0x66')]=util[_0x89a3('0x62')](_0x89a3('0x67'),new Buffer(util[_0x89a3('0x62')]('%s:%s',_0x2f4818['username'],_0x2f4818[_0x89a3('0x68')]))[_0x89a3('0x69')]('base64'));}return rp(_0x58dac8)[_0x89a3('0x43')](function(_0x4b7ec6){return _0x5d9440[_0x89a3('0x6a')](_[_0x89a3('0x30')](_0x4b7ec6['_embedded'][_0x89a3('0x6b')],function(_0x55344b){return{'id':_0x55344b[_0x89a3('0x29')],'name':_0x55344b[_0x89a3('0x29')],'type':_0x55344b[_0x89a3('0x3e')],'active':_0x55344b[_0x89a3('0x6c')],'label':_0x55344b[_0x89a3('0x6d')],'custom':!![]};}));});}})[_0x89a3('0x43')](function(_0x5c04c5){return{'count':_0x5c04c5[_0x89a3('0x36')],'rows':_0x5c04c5};})[_0x89a3('0x43')](respondWithResult(_0x3efa0f,null))['catch'](function(_0x13e587){var _0x21dc66=_0x124eb0[_0x89a3('0x31')][_0x89a3('0x6e')]?0x1f4:_0x13e587[_0x89a3('0x6f')]||0x1f4;logger['error'](_0x89a3('0x70'),_0x89a3('0x58'),_0x21dc66,JSON[_0x89a3('0x71')](_0x13e587));delete _0x13e587[_0x89a3('0x29')];if(_0x21dc66===0x191){_0x21dc66=0x190;}_0x3efa0f[_0x89a3('0x1a')](_0x21dc66)[_0x89a3('0x2a')](_0x124eb0[_0x89a3('0x31')][_0x89a3('0x6e')]?{'message':_0x89a3('0x72'),'statusCode':_0x13e587[_0x89a3('0x6f')]}:_0x13e587);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index fa54cf6..4011398 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 _0xaac4=['../../config/environment','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','api','moment','bluebird','request-promise','path'];(function(_0x311374,_0x132c28){var _0x1bf041=function(_0x97fff2){while(--_0x97fff2){_0x311374['push'](_0x311374['shift']());}};_0x1bf041(++_0x132c28);}(_0xaac4,0x73));var _0x4aac=function(_0x2c3514,_0x5604d4){_0x2c3514=_0x2c3514-0x0;var _0x22ab07=_0xaac4[_0x2c3514];return _0x22ab07;};'use strict';var _=require(_0x4aac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4aac('0x1'));var moment=require(_0x4aac('0x2'));var BPromise=require(_0x4aac('0x3'));var rp=require(_0x4aac('0x4'));var fs=require('fs');var path=require(_0x4aac('0x5'));var rimraf=require('rimraf');var config=require(_0x4aac('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x4aac('0x7'));module[_0x4aac('0x8')]=function(_0x5710ee,_0x366bf8){return _0x5710ee[_0x4aac('0x9')]('DeskAccount',attributes,{'tableName':_0x4aac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca2=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x39c016,_0x42b3bc){var _0x3793b8=function(_0x208056){while(--_0x208056){_0x39c016['push'](_0x39c016['shift']());}};_0x3793b8(++_0x42b3bc);}(_0xeca2,0xa0));var _0x2eca=function(_0x44ad1b,_0x114b4a){_0x44ad1b=_0x44ad1b-0x0;var _0x41be54=_0xeca2[_0x44ad1b];return _0x41be54;};'use strict';var _=require(_0x2eca('0x0'));var util=require(_0x2eca('0x1'));var logger=require(_0x2eca('0x2'))('api');var moment=require(_0x2eca('0x3'));var BPromise=require(_0x2eca('0x4'));var rp=require(_0x2eca('0x5'));var fs=require('fs');var path=require(_0x2eca('0x6'));var rimraf=require(_0x2eca('0x7'));var config=require(_0x2eca('0x8'));var attributes=require(_0x2eca('0x9'));var integrations=require(_0x2eca('0xa'));module['exports']=function(_0x3be3cd,_0x32a47f){return _0x3be3cd[_0x2eca('0xb')](_0x2eca('0xc'),attributes,{'tableName':_0x2eca('0xd'),'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 ea2268d..26fbd5a 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 _0x3543=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','DeskAccount','find','util','moment','bluebird','randomstring','ioredis'];(function(_0x1e52cb,_0x1f9dc4){var _0x259b73=function(_0x1c3c6c){while(--_0x1c3c6c){_0x1e52cb['push'](_0x1e52cb['shift']());}};_0x259b73(++_0x1f9dc4);}(_0x3543,0x105));var _0x3354=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x3543[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0x3354('0x0'));var moment=require(_0x3354('0x1'));var BPromise=require(_0x3354('0x2'));var rs=require(_0x3354('0x3'));var fs=require('fs');var Redis=require(_0x3354('0x4'));var db=require(_0x3354('0x5'))['db'];var utils=require(_0x3354('0x6'));var logger=require(_0x3354('0x7'))(_0x3354('0x8'));var config=require('../../config/environment');var jayson=require(_0x3354('0x9'));var client=jayson[_0x3354('0xa')][_0x3354('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x399123,_0x2221de,_0x4811d6){return new BPromise(function(_0x2f19b3,_0x5ad3ff){return client[_0x3354('0xc')](_0x399123,_0x4811d6)[_0x3354('0xd')](function(_0x3a84fd){logger[_0x3354('0xe')](_0x3354('0xf'),_0x2221de,_0x3354('0x10'));logger[_0x3354('0x11')](_0x3354('0x12'),_0x2221de,'request\x20sent',JSON[_0x3354('0x13')](_0x3a84fd));if(_0x3a84fd['error']){if(_0x3a84fd[_0x3354('0x14')][_0x3354('0x15')]===0x1f4){logger[_0x3354('0x14')](_0x3354('0xf'),_0x2221de,_0x3a84fd[_0x3354('0x14')][_0x3354('0x16')]);return _0x5ad3ff(_0x3a84fd['error'][_0x3354('0x16')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x2221de,_0x3a84fd[_0x3354('0x14')][_0x3354('0x16')]);return _0x2f19b3(_0x3a84fd[_0x3354('0x14')][_0x3354('0x16')]);}else{logger[_0x3354('0xe')](_0x3354('0xf'),_0x2221de,_0x3354('0x10'));_0x2f19b3(_0x3a84fd[_0x3354('0x17')][_0x3354('0x16')]);}})[_0x3354('0x18')](function(_0x5dfb06){logger[_0x3354('0x14')]('DeskAccount,\x20%s,\x20%s',_0x2221de,_0x5dfb06);_0x5ad3ff(_0x5dfb06);});});}exports[_0x3354('0x19')]=function(_0xa963b2){var _0x200320=this;return new Promise(function(_0x2ca559,_0x216bc3){return db['DeskAccount'][_0x3354('0x1a')]({'raw':_0xa963b2[_0x3354('0x1b')]?_0xa963b2[_0x3354('0x1b')][_0x3354('0x1c')]===undefined?!![]:![]:!![],'where':_0xa963b2[_0x3354('0x1b')]?_0xa963b2[_0x3354('0x1b')][_0x3354('0x1d')]||null:null,'attributes':_0xa963b2[_0x3354('0x1b')]?_0xa963b2[_0x3354('0x1b')]['attributes']||null:null,'limit':_0xa963b2[_0x3354('0x1b')]?_0xa963b2['options'][_0x3354('0x1e')]||null:null,'include':_0xa963b2[_0x3354('0x1b')]?_0xa963b2[_0x3354('0x1b')][_0x3354('0x1f')]?_[_0x3354('0x20')](_0xa963b2[_0x3354('0x1b')][_0x3354('0x1f')],function(_0x26e25d){return{'model':db[_0x26e25d[_0x3354('0x21')]],'as':_0x26e25d['as'],'attributes':_0x26e25d['attributes'],'include':_0x26e25d['include']?_[_0x3354('0x20')](_0x26e25d[_0x3354('0x1f')],function(_0x16bf21){return{'model':db[_0x16bf21[_0x3354('0x21')]],'as':_0x16bf21['as'],'attributes':_0x16bf21['attributes'],'include':_0x16bf21[_0x3354('0x1f')]?_['map'](_0x16bf21[_0x3354('0x1f')],function(_0x106984){return{'model':db[_0x106984[_0x3354('0x21')]],'as':_0x106984['as'],'attributes':_0x106984[_0x3354('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3354('0xd')](function(_0x569de8){logger[_0x3354('0xe')]('GetDeskAccount',_0xa963b2);logger[_0x3354('0x11')]('GetDeskAccount',_0xa963b2,JSON['stringify'](_0x569de8));_0x2ca559(_0x569de8);})[_0x3354('0x18')](function(_0x22cea2){logger[_0x3354('0x14')](_0x3354('0x19'),_0x22cea2[_0x3354('0x16')],_0xa963b2);_0x216bc3(_0x200320['error'](0x1f4,_0x22cea2[_0x3354('0x16')]));});});};exports[_0x3354('0x23')]=function(_0x317981){var _0x4bc092=this;return new Promise(function(_0x25ddb4,_0x41f371){return db[_0x3354('0x24')][_0x3354('0x25')]({'raw':_0x317981[_0x3354('0x1b')]?_0x317981[_0x3354('0x1b')][_0x3354('0x1c')]===undefined?!![]:![]:!![],'where':_0x317981[_0x3354('0x1b')]?_0x317981['options'][_0x3354('0x1d')]||null:null,'attributes':_0x317981[_0x3354('0x1b')]?_0x317981[_0x3354('0x1b')][_0x3354('0x22')]||null:null,'include':_0x317981[_0x3354('0x1b')]?_0x317981[_0x3354('0x1b')][_0x3354('0x1f')]?_[_0x3354('0x20')](_0x317981[_0x3354('0x1b')][_0x3354('0x1f')],function(_0xd11864){return{'model':db[_0xd11864[_0x3354('0x21')]],'as':_0xd11864['as'],'attributes':_0xd11864[_0x3354('0x22')],'include':_0xd11864[_0x3354('0x1f')]?_['map'](_0xd11864[_0x3354('0x1f')],function(_0x44e6d4){return{'model':db[_0x44e6d4[_0x3354('0x21')]],'as':_0x44e6d4['as'],'attributes':_0x44e6d4[_0x3354('0x22')],'include':_0x44e6d4['include']?_[_0x3354('0x20')](_0x44e6d4['include'],function(_0x2e4950){return{'model':db[_0x2e4950['model']],'as':_0x2e4950['as'],'attributes':_0x2e4950[_0x3354('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3354('0xd')](function(_0x43be60){logger[_0x3354('0xe')](_0x3354('0x23'),_0x317981);logger['debug']('ShowDeskAccount',_0x317981,JSON[_0x3354('0x13')](_0x43be60));_0x25ddb4(_0x43be60);})['catch'](function(_0x11c315){logger[_0x3354('0x14')](_0x3354('0x23'),_0x11c315[_0x3354('0x16')],_0x317981);_0x41f371(_0x4bc092[_0x3354('0x14')](0x1f4,_0x11c315[_0x3354('0x16')]));});});}; \ No newline at end of file +var _0x8c89=['GetDeskAccount','DeskAccount','ShowDeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','raw','options','where','attributes','limit','include','model','map','catch'];(function(_0x399e14,_0x37d2eb){var _0x42b3de=function(_0x300297){while(--_0x300297){_0x399e14['push'](_0x399e14['shift']());}};_0x42b3de(++_0x37d2eb);}(_0x8c89,0x1ca));var _0x98c8=function(_0x2692c4,_0x437621){_0x2692c4=_0x2692c4-0x0;var _0x355005=_0x8c89[_0x2692c4];return _0x355005;};'use strict';var _=require(_0x98c8('0x0'));var util=require(_0x98c8('0x1'));var moment=require(_0x98c8('0x2'));var BPromise=require(_0x98c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98c8('0x4'));var db=require(_0x98c8('0x5'))['db'];var utils=require(_0x98c8('0x6'));var logger=require('../../config/logger')(_0x98c8('0x7'));var config=require(_0x98c8('0x8'));var jayson=require(_0x98c8('0x9'));var client=jayson[_0x98c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x535a4e,_0x236efd,_0x49d8f9){return new BPromise(function(_0x41868,_0x57babd){return client[_0x98c8('0xb')](_0x535a4e,_0x49d8f9)[_0x98c8('0xc')](function(_0x4f06f6){logger[_0x98c8('0xd')](_0x98c8('0xe'),_0x236efd,_0x98c8('0xf'));logger[_0x98c8('0x10')](_0x98c8('0x11'),_0x236efd,_0x98c8('0xf'),JSON[_0x98c8('0x12')](_0x4f06f6));if(_0x4f06f6[_0x98c8('0x13')]){if(_0x4f06f6[_0x98c8('0x13')][_0x98c8('0x14')]===0x1f4){logger[_0x98c8('0x13')](_0x98c8('0xe'),_0x236efd,_0x4f06f6[_0x98c8('0x13')][_0x98c8('0x15')]);return _0x57babd(_0x4f06f6[_0x98c8('0x13')][_0x98c8('0x15')]);}logger[_0x98c8('0x13')](_0x98c8('0xe'),_0x236efd,_0x4f06f6[_0x98c8('0x13')][_0x98c8('0x15')]);return _0x41868(_0x4f06f6[_0x98c8('0x13')]['message']);}else{logger[_0x98c8('0xd')](_0x98c8('0xe'),_0x236efd,_0x98c8('0xf'));_0x41868(_0x4f06f6[_0x98c8('0x16')][_0x98c8('0x15')]);}})['catch'](function(_0x41a86a){logger[_0x98c8('0x13')](_0x98c8('0xe'),_0x236efd,_0x41a86a);_0x57babd(_0x41a86a);});});}exports['GetDeskAccount']=function(_0xd24da){var _0x262862=this;return new Promise(function(_0x1cb880,_0x321024){return db['DeskAccount']['findAll']({'raw':_0xd24da['options']?_0xd24da['options'][_0x98c8('0x17')]===undefined?!![]:![]:!![],'where':_0xd24da[_0x98c8('0x18')]?_0xd24da['options'][_0x98c8('0x19')]||null:null,'attributes':_0xd24da['options']?_0xd24da[_0x98c8('0x18')][_0x98c8('0x1a')]||null:null,'limit':_0xd24da[_0x98c8('0x18')]?_0xd24da[_0x98c8('0x18')][_0x98c8('0x1b')]||null:null,'include':_0xd24da[_0x98c8('0x18')]?_0xd24da[_0x98c8('0x18')][_0x98c8('0x1c')]?_['map'](_0xd24da['options']['include'],function(_0x3146c3){return{'model':db[_0x3146c3[_0x98c8('0x1d')]],'as':_0x3146c3['as'],'attributes':_0x3146c3[_0x98c8('0x1a')],'include':_0x3146c3[_0x98c8('0x1c')]?_[_0x98c8('0x1e')](_0x3146c3[_0x98c8('0x1c')],function(_0x9d53f2){return{'model':db[_0x9d53f2[_0x98c8('0x1d')]],'as':_0x9d53f2['as'],'attributes':_0x9d53f2['attributes'],'include':_0x9d53f2[_0x98c8('0x1c')]?_['map'](_0x9d53f2[_0x98c8('0x1c')],function(_0x305eea){return{'model':db[_0x305eea[_0x98c8('0x1d')]],'as':_0x305eea['as'],'attributes':_0x305eea['attributes']};}):[]};}):[]};}):[]:[]})[_0x98c8('0xc')](function(_0x3deb24){logger[_0x98c8('0xd')]('GetDeskAccount',_0xd24da);logger[_0x98c8('0x10')]('GetDeskAccount',_0xd24da,JSON[_0x98c8('0x12')](_0x3deb24));_0x1cb880(_0x3deb24);})[_0x98c8('0x1f')](function(_0x4f4f72){logger['error'](_0x98c8('0x20'),_0x4f4f72[_0x98c8('0x15')],_0xd24da);_0x321024(_0x262862['error'](0x1f4,_0x4f4f72[_0x98c8('0x15')]));});});};exports['ShowDeskAccount']=function(_0x254cf4){var _0x3704d5=this;return new Promise(function(_0x10951e,_0x5d3f07){return db[_0x98c8('0x21')]['find']({'raw':_0x254cf4[_0x98c8('0x18')]?_0x254cf4['options'][_0x98c8('0x17')]===undefined?!![]:![]:!![],'where':_0x254cf4['options']?_0x254cf4[_0x98c8('0x18')][_0x98c8('0x19')]||null:null,'attributes':_0x254cf4['options']?_0x254cf4[_0x98c8('0x18')][_0x98c8('0x1a')]||null:null,'include':_0x254cf4['options']?_0x254cf4[_0x98c8('0x18')][_0x98c8('0x1c')]?_[_0x98c8('0x1e')](_0x254cf4[_0x98c8('0x18')][_0x98c8('0x1c')],function(_0x2395bd){return{'model':db[_0x2395bd[_0x98c8('0x1d')]],'as':_0x2395bd['as'],'attributes':_0x2395bd['attributes'],'include':_0x2395bd[_0x98c8('0x1c')]?_['map'](_0x2395bd[_0x98c8('0x1c')],function(_0x55f68c){return{'model':db[_0x55f68c[_0x98c8('0x1d')]],'as':_0x55f68c['as'],'attributes':_0x55f68c[_0x98c8('0x1a')],'include':_0x55f68c[_0x98c8('0x1c')]?_[_0x98c8('0x1e')](_0x55f68c['include'],function(_0x93dff4){return{'model':db[_0x93dff4['model']],'as':_0x93dff4['as'],'attributes':_0x93dff4[_0x98c8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98c8('0xc')](function(_0x199b6e){logger[_0x98c8('0xd')](_0x98c8('0x22'),_0x254cf4);logger['debug']('ShowDeskAccount',_0x254cf4,JSON[_0x98c8('0x12')](_0x199b6e));_0x10951e(_0x199b6e);})[_0x98c8('0x1f')](function(_0x6597e3){logger['error'](_0x98c8('0x22'),_0x6597e3[_0x98c8('0x15')],_0x254cf4);_0x5d3f07(_0x3704d5['error'](0x1f4,_0x6597e3[_0x98c8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 720a43b..af62b2a 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56e0fb,_0x4a2de7){var _0x22b957=function(_0x11b457){while(--_0x11b457){_0x56e0fb['push'](_0x56e0fb['shift']());}};_0x22b957(++_0x4a2de7);}(_0x34e8,0x12c));var _0x834e=function(_0x69f4c5,_0x4dd38d){_0x69f4c5=_0x69f4c5-0x0;var _0x55f7f6=_0x34e8[_0x69f4c5];return _0x55f7f6;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x222e95,_0x4f7eea){var _0x16c617=function(_0x1e0b8e){while(--_0x1e0b8e){_0x222e95['push'](_0x222e95['shift']());}};_0x16c617(++_0x4f7eea);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 29319d6..2af11a5 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 _0xb66a=['sequelize','exports'];(function(_0x2bef65,_0x13fecd){var _0x16c29e=function(_0x3bc2d5){while(--_0x3bc2d5){_0x2bef65['push'](_0x2bef65['shift']());}};_0x16c29e(++_0x13fecd);}(_0xb66a,0x18e));var _0xab66=function(_0x3d3426,_0x302e8c){_0x3d3426=_0x3d3426-0x0;var _0x5ab087=_0xb66a[_0x3d3426];return _0x5ab087;};'use strict';var Sequelize=require(_0xab66('0x0'));module[_0xab66('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x67b0=['sequelize','exports'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x67b0,0x17e));var _0x067b=function(_0x1c57b3,_0x4e14bb){_0x1c57b3=_0x1c57b3-0x0;var _0x3441d9=_0x67b0[_0x1c57b3];return _0x3441d9;};'use strict';var Sequelize=require(_0x067b('0x0'));module[_0x067b('0x1')]={'name':{'type':Sequelize['STRING']},'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 1ca0c7c..30b6fc9 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 _0xea86=['apply','reject','save','update','then','sendStatus','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','intersection','includeAll','find','create','body','destroy','params','getFields','findOne','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range'];(function(_0x356738,_0x375739){var _0x380d79=function(_0x327aa4){while(--_0x327aa4){_0x356738['push'](_0x356738['shift']());}};_0x380d79(++_0x375739);}(_0xea86,0xd8));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x6ea8('0x0'));var rimraf=require(_0x6ea8('0x1'));var zipdir=require(_0x6ea8('0x2'));var jsonpatch=require(_0x6ea8('0x3'));var rp=require(_0x6ea8('0x4'));var moment=require(_0x6ea8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6ea8('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6ea8('0x7'));var csv=require(_0x6ea8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ea8('0x9'));var _=require(_0x6ea8('0xa'));var squel=require(_0x6ea8('0xb'));var crypto=require('crypto');var jsforce=require(_0x6ea8('0xc'));var deskjs=require(_0x6ea8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6ea8('0xe'));var Papa=require(_0x6ea8('0xf'));var Redis=require('ioredis');var authService=require(_0x6ea8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ea8('0x11'));var hardwareService=require(_0x6ea8('0x12'));var logger=require(_0x6ea8('0x13'))('api');var utils=require(_0x6ea8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6ea8('0x15'));var db=require(_0x6ea8('0x16'))['db'];function respondWithStatusCode(_0x3860c1,_0x14c22b){_0x14c22b=_0x14c22b||0xcc;return function(_0xe91d79){if(_0xe91d79){return _0x3860c1['sendStatus'](_0x14c22b);}return _0x3860c1[_0x6ea8('0x17')](_0x14c22b)['end']();};}function respondWithResult(_0x2ae436,_0x5c1cb4){_0x5c1cb4=_0x5c1cb4||0xc8;return function(_0x40bb7f){if(_0x40bb7f){return _0x2ae436[_0x6ea8('0x17')](_0x5c1cb4)[_0x6ea8('0x18')](_0x40bb7f);}};}function respondWithFilteredResult(_0x10e33d,_0xb457e3){return function(_0x30b5c4){if(_0x30b5c4){var _0x28d301=typeof _0xb457e3[_0x6ea8('0x19')]===_0x6ea8('0x1a')&&typeof _0xb457e3['limit']==='undefined';var _0x1f5aef=_0x30b5c4[_0x6ea8('0x1b')];var _0x1a812f=_0x28d301?0x0:_0xb457e3[_0x6ea8('0x19')];var _0x31ab9e=_0x28d301?_0x30b5c4[_0x6ea8('0x1b')]:_0xb457e3[_0x6ea8('0x19')]+_0xb457e3[_0x6ea8('0x1c')];var _0x1c89d8;if(_0x31ab9e>=_0x1f5aef){_0x31ab9e=_0x1f5aef;_0x1c89d8=0xc8;}else{_0x1c89d8=0xce;}_0x10e33d[_0x6ea8('0x17')](_0x1c89d8);return _0x10e33d['set'](_0x6ea8('0x1d'),_0x1a812f+'-'+_0x31ab9e+'/'+_0x1f5aef)[_0x6ea8('0x18')](_0x30b5c4);}return null;};}function patchUpdates(_0x3ad8a6){return function(_0x4b6785){try{jsonpatch[_0x6ea8('0x1e')](_0x4b6785,_0x3ad8a6,!![]);}catch(_0x49bd24){return BPromise[_0x6ea8('0x1f')](_0x49bd24);}return _0x4b6785[_0x6ea8('0x20')]();};}function saveUpdates(_0x33195e,_0x14b80c){return function(_0x589ac9){if(_0x589ac9){return _0x589ac9[_0x6ea8('0x21')](_0x33195e)[_0x6ea8('0x22')](function(_0x50a36b){return _0x50a36b;});}return null;};}function removeEntity(_0x26769a,_0x28fe55){return function(_0x2597fa){if(_0x2597fa){return _0x2597fa['destroy']()['then'](function(){_0x26769a[_0x6ea8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x710fbd,_0x1a6ee2){return function(_0x3439bd){if(!_0x3439bd){_0x710fbd[_0x6ea8('0x23')](0x194);}return _0x3439bd;};}function handleError(_0x59537e,_0x4b272c){_0x4b272c=_0x4b272c||0x1f4;return function(_0x12d8e2){logger[_0x6ea8('0x24')](_0x12d8e2[_0x6ea8('0x25')]);if(_0x12d8e2[_0x6ea8('0x26')]){delete _0x12d8e2[_0x6ea8('0x26')];}_0x59537e[_0x6ea8('0x17')](_0x4b272c)[_0x6ea8('0x27')](_0x12d8e2);};}exports['index']=function(_0x2f34d3,_0x4cfd20){var _0x27ac7f={},_0x10a163={},_0x269945={'count':0x0,'rows':[]};var _0x46cf72=_['map'](db[_0x6ea8('0x28')][_0x6ea8('0x29')],function(_0x380937){return{'name':_0x380937[_0x6ea8('0x2a')],'type':_0x380937[_0x6ea8('0x2b')][_0x6ea8('0x2c')]};});_0x10a163[_0x6ea8('0x2d')]=_[_0x6ea8('0x2e')](_0x46cf72,'name');_0x10a163[_0x6ea8('0x2f')]=_[_0x6ea8('0x30')](_0x2f34d3['query']);_0x10a163['filters']=_['intersection'](_0x10a163[_0x6ea8('0x2d')],_0x10a163[_0x6ea8('0x2f')]);_0x27ac7f['attributes']=_['intersection'](_0x10a163[_0x6ea8('0x2d')],qs[_0x6ea8('0x31')](_0x2f34d3['query'][_0x6ea8('0x31')]));_0x27ac7f[_0x6ea8('0x32')]=_0x27ac7f[_0x6ea8('0x32')][_0x6ea8('0x33')]?_0x27ac7f[_0x6ea8('0x32')]:_0x10a163['model'];if(!_0x2f34d3[_0x6ea8('0x2f')][_0x6ea8('0x34')](_0x6ea8('0x35'))){_0x27ac7f[_0x6ea8('0x1c')]=qs[_0x6ea8('0x1c')](_0x2f34d3['query'][_0x6ea8('0x1c')]);_0x27ac7f['offset']=qs[_0x6ea8('0x19')](_0x2f34d3['query']['offset']);}_0x27ac7f[_0x6ea8('0x36')]=qs[_0x6ea8('0x37')](_0x2f34d3[_0x6ea8('0x2f')]['sort']);_0x27ac7f[_0x6ea8('0x38')]=qs[_0x6ea8('0x39')](_[_0x6ea8('0x3a')](_0x2f34d3[_0x6ea8('0x2f')],_0x10a163[_0x6ea8('0x39')]),_0x46cf72);if(_0x2f34d3[_0x6ea8('0x2f')][_0x6ea8('0x3b')]){_0x27ac7f[_0x6ea8('0x38')]=_['merge'](_0x27ac7f[_0x6ea8('0x38')],{'$or':_[_0x6ea8('0x2e')](_0x46cf72,function(_0x2f4e9b){if(_0x2f4e9b['type']!==_0x6ea8('0x3c')){var _0x25acfa={};_0x25acfa[_0x2f4e9b['name']]={'$like':'%'+_0x2f34d3[_0x6ea8('0x2f')][_0x6ea8('0x3b')]+'%'};return _0x25acfa;}})});}_0x27ac7f=_[_0x6ea8('0x3d')]({},_0x27ac7f,_0x2f34d3[_0x6ea8('0x3e')]);var _0x2a59e8={'where':_0x27ac7f[_0x6ea8('0x38')]};return db['DeskConfiguration'][_0x6ea8('0x1b')](_0x2a59e8)[_0x6ea8('0x22')](function(_0x2e4cc8){_0x269945[_0x6ea8('0x1b')]=_0x2e4cc8;if(_0x2f34d3[_0x6ea8('0x2f')]['includeAll']){_0x27ac7f[_0x6ea8('0x3f')]=[{'all':!![]}];}return db[_0x6ea8('0x28')][_0x6ea8('0x40')](_0x27ac7f);})[_0x6ea8('0x22')](function(_0x379778){_0x269945[_0x6ea8('0x41')]=_0x379778;return _0x269945;})['then'](respondWithFilteredResult(_0x4cfd20,_0x27ac7f))[_0x6ea8('0x42')](handleError(_0x4cfd20,null));};exports['show']=function(_0x4dd4d4,_0x1eb3c0){var _0x3ef29d={'raw':![],'where':{'id':_0x4dd4d4['params']['id']}},_0x49f563={};_0x49f563['model']=_['keys'](db[_0x6ea8('0x28')][_0x6ea8('0x29')]);_0x49f563[_0x6ea8('0x2f')]=_[_0x6ea8('0x30')](_0x4dd4d4[_0x6ea8('0x2f')]);_0x49f563[_0x6ea8('0x39')]=_[_0x6ea8('0x43')](_0x49f563[_0x6ea8('0x2d')],_0x49f563[_0x6ea8('0x2f')]);_0x3ef29d[_0x6ea8('0x32')]=_[_0x6ea8('0x43')](_0x49f563[_0x6ea8('0x2d')],qs[_0x6ea8('0x31')](_0x4dd4d4['query'][_0x6ea8('0x31')]));_0x3ef29d['attributes']=_0x3ef29d[_0x6ea8('0x32')][_0x6ea8('0x33')]?_0x3ef29d[_0x6ea8('0x32')]:_0x49f563[_0x6ea8('0x2d')];if(_0x4dd4d4[_0x6ea8('0x2f')][_0x6ea8('0x44')]){_0x3ef29d['include']=[{'all':!![]}];}_0x3ef29d=_[_0x6ea8('0x3d')]({},_0x3ef29d,_0x4dd4d4[_0x6ea8('0x3e')]);return db[_0x6ea8('0x28')][_0x6ea8('0x45')](_0x3ef29d)[_0x6ea8('0x22')](handleEntityNotFound(_0x1eb3c0,null))[_0x6ea8('0x22')](respondWithResult(_0x1eb3c0,null))['catch'](handleError(_0x1eb3c0,null));};exports[_0x6ea8('0x46')]=function(_0xe814cf,_0x23c225){return db['DeskConfiguration'][_0x6ea8('0x46')](_0xe814cf['body'],{})[_0x6ea8('0x22')](respondWithResult(_0x23c225,0xc9))[_0x6ea8('0x42')](handleError(_0x23c225,null));};exports[_0x6ea8('0x21')]=function(_0x5a090d,_0x4debec){if(_0x5a090d[_0x6ea8('0x47')]['id']){delete _0x5a090d[_0x6ea8('0x47')]['id'];}return db[_0x6ea8('0x28')]['find']({'where':{'id':_0x5a090d['params']['id']}})['then'](handleEntityNotFound(_0x4debec,null))[_0x6ea8('0x22')](saveUpdates(_0x5a090d[_0x6ea8('0x47')],null))[_0x6ea8('0x22')](respondWithResult(_0x4debec,null))[_0x6ea8('0x42')](handleError(_0x4debec,null));};exports[_0x6ea8('0x48')]=function(_0x36e7da,_0x18e128){return db['DeskConfiguration'][_0x6ea8('0x45')]({'where':{'id':_0x36e7da[_0x6ea8('0x49')]['id']}})['then'](handleEntityNotFound(_0x18e128,null))[_0x6ea8('0x22')](removeEntity(_0x18e128,null))['catch'](handleError(_0x18e128,null));};exports[_0x6ea8('0x4a')]=function(_0x45bff1,_0x47684c,_0x3385c5){var _0x219ee2={};var _0x1ce565={};var _0x293bd6;var _0x28ff5a;return db[_0x6ea8('0x28')][_0x6ea8('0x4b')]({'where':{'id':_0x45bff1['params']['id']}})[_0x6ea8('0x22')](handleEntityNotFound(_0x47684c,null))[_0x6ea8('0x22')](function(_0x28937b){if(_0x28937b){_0x293bd6=_0x28937b;_0x1ce565['model']=_[_0x6ea8('0x30')](db['DeskField'][_0x6ea8('0x29')]);_0x1ce565[_0x6ea8('0x2f')]=_[_0x6ea8('0x30')](_0x45bff1['query']);_0x1ce565[_0x6ea8('0x39')]=_['intersection'](_0x1ce565[_0x6ea8('0x2d')],_0x1ce565[_0x6ea8('0x2f')]);_0x219ee2['attributes']=_[_0x6ea8('0x43')](_0x1ce565[_0x6ea8('0x2d')],qs[_0x6ea8('0x31')](_0x45bff1['query'][_0x6ea8('0x31')]));_0x219ee2[_0x6ea8('0x32')]=_0x219ee2['attributes']['length']?_0x219ee2[_0x6ea8('0x32')]:_0x1ce565[_0x6ea8('0x2d')];_0x219ee2[_0x6ea8('0x36')]=qs['sort'](_0x45bff1[_0x6ea8('0x2f')][_0x6ea8('0x37')]);_0x219ee2['where']=qs[_0x6ea8('0x39')](_['pick'](_0x45bff1[_0x6ea8('0x2f')],_0x1ce565[_0x6ea8('0x39')]));if(_0x45bff1['query'][_0x6ea8('0x3b')]){_0x219ee2[_0x6ea8('0x38')]=_[_0x6ea8('0x3d')](_0x219ee2[_0x6ea8('0x38')],{'$or':_[_0x6ea8('0x2e')](_0x219ee2[_0x6ea8('0x32')],function(_0x21b7bf){var _0x384f11={};_0x384f11[_0x21b7bf]={'$like':'%'+_0x45bff1[_0x6ea8('0x2f')][_0x6ea8('0x3b')]+'%'};return _0x384f11;})});}_0x219ee2=_[_0x6ea8('0x3d')]({},_0x219ee2,_0x45bff1[_0x6ea8('0x3e')]);return _0x293bd6[_0x6ea8('0x4a')](_0x219ee2);}})[_0x6ea8('0x22')](function(_0x205c88){if(_0x205c88){_0x28ff5a=_0x205c88[_0x6ea8('0x33')];if(!_0x45bff1[_0x6ea8('0x2f')][_0x6ea8('0x34')]('nolimit')){_0x219ee2['limit']=qs['limit'](_0x45bff1[_0x6ea8('0x2f')][_0x6ea8('0x1c')]);_0x219ee2[_0x6ea8('0x19')]=qs['offset'](_0x45bff1['query'][_0x6ea8('0x19')]);}return _0x293bd6[_0x6ea8('0x4a')](_0x219ee2);}})['then'](function(_0xdbd419){if(_0xdbd419){return _0xdbd419?{'count':_0x28ff5a,'rows':_0xdbd419}:null;}})[_0x6ea8('0x22')](respondWithResult(_0x47684c,null))['catch'](handleError(_0x47684c,null));};exports[_0x6ea8('0x4c')]=function(_0x157846,_0xb60a78,_0x24357e){var _0x4c28ec={};var _0x268a04={};var _0xaa98c4;var _0x25574d;return db[_0x6ea8('0x28')][_0x6ea8('0x4b')]({'where':{'id':_0x157846['params']['id']}})[_0x6ea8('0x22')](handleEntityNotFound(_0xb60a78,null))[_0x6ea8('0x22')](function(_0x41d8ed){if(_0x41d8ed){_0xaa98c4=_0x41d8ed;_0x268a04[_0x6ea8('0x2d')]=_['keys'](db[_0x6ea8('0x4d')][_0x6ea8('0x29')]);_0x268a04[_0x6ea8('0x2f')]=_[_0x6ea8('0x30')](_0x157846[_0x6ea8('0x2f')]);_0x268a04[_0x6ea8('0x39')]=_[_0x6ea8('0x43')](_0x268a04['model'],_0x268a04[_0x6ea8('0x2f')]);_0x4c28ec[_0x6ea8('0x32')]=_[_0x6ea8('0x43')](_0x268a04[_0x6ea8('0x2d')],qs['fields'](_0x157846['query'][_0x6ea8('0x31')]));_0x4c28ec[_0x6ea8('0x32')]=_0x4c28ec[_0x6ea8('0x32')][_0x6ea8('0x33')]?_0x4c28ec[_0x6ea8('0x32')]:_0x268a04['model'];_0x4c28ec[_0x6ea8('0x36')]=qs[_0x6ea8('0x37')](_0x157846[_0x6ea8('0x2f')][_0x6ea8('0x37')]);_0x4c28ec[_0x6ea8('0x38')]=qs[_0x6ea8('0x39')](_[_0x6ea8('0x3a')](_0x157846[_0x6ea8('0x2f')],_0x268a04['filters']));if(_0x157846['query'][_0x6ea8('0x3b')]){_0x4c28ec[_0x6ea8('0x38')]=_['merge'](_0x4c28ec[_0x6ea8('0x38')],{'$or':_[_0x6ea8('0x2e')](_0x4c28ec['attributes'],function(_0x206d53){var _0x5307cb={};_0x5307cb[_0x206d53]={'$like':'%'+_0x157846[_0x6ea8('0x2f')][_0x6ea8('0x3b')]+'%'};return _0x5307cb;})});}_0x4c28ec=_[_0x6ea8('0x3d')]({},_0x4c28ec,_0x157846[_0x6ea8('0x3e')]);return _0xaa98c4['getSubjects'](_0x4c28ec);}})[_0x6ea8('0x22')](function(_0x114a78){if(_0x114a78){_0x25574d=_0x114a78[_0x6ea8('0x33')];if(!_0x157846['query'][_0x6ea8('0x34')](_0x6ea8('0x35'))){_0x4c28ec[_0x6ea8('0x1c')]=qs[_0x6ea8('0x1c')](_0x157846[_0x6ea8('0x2f')][_0x6ea8('0x1c')]);_0x4c28ec[_0x6ea8('0x19')]=qs[_0x6ea8('0x19')](_0x157846['query'][_0x6ea8('0x19')]);}return _0xaa98c4[_0x6ea8('0x4c')](_0x4c28ec);}})[_0x6ea8('0x22')](function(_0x58bec9){if(_0x58bec9){return _0x58bec9?{'count':_0x25574d,'rows':_0x58bec9}:null;}})[_0x6ea8('0x22')](respondWithResult(_0xb60a78,null))[_0x6ea8('0x42')](handleError(_0xb60a78,null));};exports[_0x6ea8('0x4e')]=function(_0x2e2372,_0x205a8d,_0xf1b984){var _0x4df362={};var _0x4fa7b0={};var _0x47cc8a;var _0x22f6b7;return db[_0x6ea8('0x28')][_0x6ea8('0x4b')]({'where':{'id':_0x2e2372['params']['id']}})['then'](handleEntityNotFound(_0x205a8d,null))[_0x6ea8('0x22')](function(_0x4b43ec){if(_0x4b43ec){_0x47cc8a=_0x4b43ec;_0x4fa7b0[_0x6ea8('0x2d')]=_[_0x6ea8('0x30')](db[_0x6ea8('0x4d')][_0x6ea8('0x29')]);_0x4fa7b0[_0x6ea8('0x2f')]=_['keys'](_0x2e2372[_0x6ea8('0x2f')]);_0x4fa7b0[_0x6ea8('0x39')]=_[_0x6ea8('0x43')](_0x4fa7b0[_0x6ea8('0x2d')],_0x4fa7b0[_0x6ea8('0x2f')]);_0x4df362[_0x6ea8('0x32')]=_[_0x6ea8('0x43')](_0x4fa7b0[_0x6ea8('0x2d')],qs['fields'](_0x2e2372['query']['fields']));_0x4df362[_0x6ea8('0x32')]=_0x4df362[_0x6ea8('0x32')][_0x6ea8('0x33')]?_0x4df362[_0x6ea8('0x32')]:_0x4fa7b0['model'];_0x4df362[_0x6ea8('0x36')]=qs[_0x6ea8('0x37')](_0x2e2372[_0x6ea8('0x2f')]['sort']);_0x4df362[_0x6ea8('0x38')]=qs[_0x6ea8('0x39')](_['pick'](_0x2e2372[_0x6ea8('0x2f')],_0x4fa7b0[_0x6ea8('0x39')]));if(_0x2e2372[_0x6ea8('0x2f')]['filter']){_0x4df362[_0x6ea8('0x38')]=_[_0x6ea8('0x3d')](_0x4df362[_0x6ea8('0x38')],{'$or':_['map'](_0x4df362[_0x6ea8('0x32')],function(_0x37a88e){var _0x465470={};_0x465470[_0x37a88e]={'$like':'%'+_0x2e2372[_0x6ea8('0x2f')][_0x6ea8('0x3b')]+'%'};return _0x465470;})});}_0x4df362=_['merge']({},_0x4df362,_0x2e2372[_0x6ea8('0x3e')]);return _0x47cc8a['getDescriptions'](_0x4df362);}})[_0x6ea8('0x22')](function(_0x29c81e){if(_0x29c81e){_0x22f6b7=_0x29c81e[_0x6ea8('0x33')];if(!_0x2e2372[_0x6ea8('0x2f')]['hasOwnProperty']('nolimit')){_0x4df362[_0x6ea8('0x1c')]=qs['limit'](_0x2e2372[_0x6ea8('0x2f')]['limit']);_0x4df362[_0x6ea8('0x19')]=qs[_0x6ea8('0x19')](_0x2e2372[_0x6ea8('0x2f')]['offset']);}return _0x47cc8a['getDescriptions'](_0x4df362);}})[_0x6ea8('0x22')](function(_0x39ed07){if(_0x39ed07){return _0x39ed07?{'count':_0x22f6b7,'rows':_0x39ed07}:null;}})['then'](respondWithResult(_0x205a8d,null))['catch'](handleError(_0x205a8d,null));};exports[_0x6ea8('0x4f')]=function(_0x32c969,_0x229ff5,_0x39ae8){var _0x4802d7={};var _0x11a54b={};var _0x22b862;var _0x41b2f1;return db[_0x6ea8('0x28')]['findOne']({'where':{'id':_0x32c969[_0x6ea8('0x49')]['id']}})[_0x6ea8('0x22')](handleEntityNotFound(_0x229ff5,null))[_0x6ea8('0x22')](function(_0x4aa675){if(_0x4aa675){_0x22b862=_0x4aa675;_0x11a54b[_0x6ea8('0x2d')]=_[_0x6ea8('0x30')](db['Tag'][_0x6ea8('0x29')]);_0x11a54b[_0x6ea8('0x2f')]=_['keys'](_0x32c969['query']);_0x11a54b[_0x6ea8('0x39')]=_['intersection'](_0x11a54b[_0x6ea8('0x2d')],_0x11a54b[_0x6ea8('0x2f')]);_0x4802d7['attributes']=_['intersection'](_0x11a54b['model'],qs[_0x6ea8('0x31')](_0x32c969['query'][_0x6ea8('0x31')]));_0x4802d7[_0x6ea8('0x32')]=_0x4802d7[_0x6ea8('0x32')]['length']?_0x4802d7[_0x6ea8('0x32')]:_0x11a54b['model'];_0x4802d7[_0x6ea8('0x36')]=qs[_0x6ea8('0x37')](_0x32c969[_0x6ea8('0x2f')][_0x6ea8('0x37')]);_0x4802d7[_0x6ea8('0x38')]=qs['filters'](_['pick'](_0x32c969[_0x6ea8('0x2f')],_0x11a54b['filters']));if(_0x32c969[_0x6ea8('0x2f')][_0x6ea8('0x3b')]){_0x4802d7[_0x6ea8('0x38')]=_['merge'](_0x4802d7[_0x6ea8('0x38')],{'$or':_[_0x6ea8('0x2e')](_0x4802d7[_0x6ea8('0x32')],function(_0x408207){var _0x12d4af={};_0x12d4af[_0x408207]={'$like':'%'+_0x32c969[_0x6ea8('0x2f')][_0x6ea8('0x3b')]+'%'};return _0x12d4af;})});}_0x4802d7=_[_0x6ea8('0x3d')]({},_0x4802d7,_0x32c969[_0x6ea8('0x3e')]);return _0x22b862[_0x6ea8('0x4f')](_0x4802d7);}})[_0x6ea8('0x22')](function(_0xd44559){if(_0xd44559){_0x41b2f1=_0xd44559[_0x6ea8('0x33')];if(!_0x32c969['query'][_0x6ea8('0x34')]('nolimit')){_0x4802d7[_0x6ea8('0x1c')]=qs[_0x6ea8('0x1c')](_0x32c969[_0x6ea8('0x2f')][_0x6ea8('0x1c')]);_0x4802d7[_0x6ea8('0x19')]=qs[_0x6ea8('0x19')](_0x32c969[_0x6ea8('0x2f')][_0x6ea8('0x19')]);}return _0x22b862[_0x6ea8('0x4f')](_0x4802d7);}})['then'](function(_0x49fa59){if(_0x49fa59){return _0x49fa59?{'count':_0x41b2f1,'rows':_0x49fa59}:null;}})['then'](respondWithResult(_0x229ff5,null))['catch'](handleError(_0x229ff5,null));};exports[_0x6ea8('0x50')]=function(_0x255897,_0x372c00,_0x224d05){if(_0x255897['body']['id']){delete _0x255897[_0x6ea8('0x47')]['id'];}return db[_0x6ea8('0x28')][_0x6ea8('0x4b')]({'where':{'id':_0x255897[_0x6ea8('0x49')]['id']}})[_0x6ea8('0x22')](handleEntityNotFound(_0x372c00,null))[_0x6ea8('0x22')](function(_0x1200de){if(_0x1200de){return _0x1200de[_0x6ea8('0x50')](_0x255897[_0x6ea8('0x47')][_0x6ea8('0x51')]||[]);}return null;})[_0x6ea8('0x22')](respondWithResult(_0x372c00,null))[_0x6ea8('0x42')](handleError(_0x372c00,null));}; \ No newline at end of file +var _0xee3f=['attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','findOne','DeskField','length','order','getFields','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','Content-Range','reject','save','then','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection'];(function(_0x455fea,_0x51f808){var _0x32f39b=function(_0x339cac){while(--_0x339cac){_0x455fea['push'](_0x455fea['shift']());}};_0x32f39b(++_0x51f808);}(_0xee3f,0x18a));var _0xfee3=function(_0x1d655b,_0x334c48){_0x1d655b=_0x1d655b-0x0;var _0x5a0978=_0xee3f[_0x1d655b];return _0x5a0978;};'use strict';var emlformat=require(_0xfee3('0x0'));var rimraf=require(_0xfee3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfee3('0x2'));var rp=require(_0xfee3('0x3'));var moment=require(_0xfee3('0x4'));var BPromise=require(_0xfee3('0x5'));var Mustache=require(_0xfee3('0x6'));var util=require(_0xfee3('0x7'));var path=require(_0xfee3('0x8'));var sox=require(_0xfee3('0x9'));var csv=require('to-csv');var ejs=require(_0xfee3('0xa'));var fs=require('fs');var fs_extra=require(_0xfee3('0xb'));var _=require(_0xfee3('0xc'));var squel=require(_0xfee3('0xd'));var crypto=require(_0xfee3('0xe'));var jsforce=require(_0xfee3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfee3('0x10'));var querystring=require(_0xfee3('0x11'));var Papa=require(_0xfee3('0x12'));var Redis=require(_0xfee3('0x13'));var authService=require(_0xfee3('0x14'));var qs=require(_0xfee3('0x15'));var as=require(_0xfee3('0x16'));var hardwareService=require(_0xfee3('0x17'));var logger=require(_0xfee3('0x18'))(_0xfee3('0x19'));var utils=require(_0xfee3('0x1a'));var config=require(_0xfee3('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xfee3('0x1c'))['db'];function respondWithStatusCode(_0x1d5dc2,_0x30f018){_0x30f018=_0x30f018||0xcc;return function(_0x4eca9d){if(_0x4eca9d){return _0x1d5dc2[_0xfee3('0x1d')](_0x30f018);}return _0x1d5dc2[_0xfee3('0x1e')](_0x30f018)[_0xfee3('0x1f')]();};}function respondWithResult(_0x49d73f,_0x7b4e9d){_0x7b4e9d=_0x7b4e9d||0xc8;return function(_0x450ca6){if(_0x450ca6){return _0x49d73f[_0xfee3('0x1e')](_0x7b4e9d)[_0xfee3('0x20')](_0x450ca6);}};}function respondWithFilteredResult(_0x5ba052,_0x1061ee){return function(_0x48d1a4){if(_0x48d1a4){var _0x207d49=typeof _0x1061ee[_0xfee3('0x21')]==='undefined'&&typeof _0x1061ee['limit']===_0xfee3('0x22');var _0x4af9f2=_0x48d1a4['count'];var _0x157200=_0x207d49?0x0:_0x1061ee[_0xfee3('0x21')];var _0x35bafd=_0x207d49?_0x48d1a4['count']:_0x1061ee[_0xfee3('0x21')]+_0x1061ee['limit'];var _0x12151f;if(_0x35bafd>=_0x4af9f2){_0x35bafd=_0x4af9f2;_0x12151f=0xc8;}else{_0x12151f=0xce;}_0x5ba052[_0xfee3('0x1e')](_0x12151f);return _0x5ba052['set'](_0xfee3('0x23'),_0x157200+'-'+_0x35bafd+'/'+_0x4af9f2)[_0xfee3('0x20')](_0x48d1a4);}return null;};}function patchUpdates(_0x4909b0){return function(_0x2c12bc){try{jsonpatch['apply'](_0x2c12bc,_0x4909b0,!![]);}catch(_0x3b38db){return BPromise[_0xfee3('0x24')](_0x3b38db);}return _0x2c12bc[_0xfee3('0x25')]();};}function saveUpdates(_0x3f7982,_0x5244dc){return function(_0x2899a5){if(_0x2899a5){return _0x2899a5['update'](_0x3f7982)[_0xfee3('0x26')](function(_0x167d53){return _0x167d53;});}return null;};}function removeEntity(_0x3744d8,_0x5142df){return function(_0x3f70b5){if(_0x3f70b5){return _0x3f70b5[_0xfee3('0x27')]()[_0xfee3('0x26')](function(){_0x3744d8[_0xfee3('0x1e')](0xcc)[_0xfee3('0x1f')]();});}};}function handleEntityNotFound(_0x3bd1bb,_0xfd75a2){return function(_0x2769e7){if(!_0x2769e7){_0x3bd1bb[_0xfee3('0x1d')](0x194);}return _0x2769e7;};}function handleError(_0x2a4f7a,_0x2981db){_0x2981db=_0x2981db||0x1f4;return function(_0x5476a3){logger[_0xfee3('0x28')](_0x5476a3[_0xfee3('0x29')]);if(_0x5476a3[_0xfee3('0x2a')]){delete _0x5476a3[_0xfee3('0x2a')];}_0x2a4f7a[_0xfee3('0x1e')](_0x2981db)[_0xfee3('0x2b')](_0x5476a3);};}exports[_0xfee3('0x2c')]=function(_0x4f96a1,_0x3261ac){var _0x2ea4bc={},_0x382582={},_0x4d276f={'count':0x0,'rows':[]};var _0x5bdd2e=_['map'](db[_0xfee3('0x2d')][_0xfee3('0x2e')],function(_0x286b3b){return{'name':_0x286b3b[_0xfee3('0x2f')],'type':_0x286b3b[_0xfee3('0x30')][_0xfee3('0x31')]};});_0x382582[_0xfee3('0x32')]=_[_0xfee3('0x33')](_0x5bdd2e,_0xfee3('0x2a'));_0x382582['query']=_[_0xfee3('0x34')](_0x4f96a1[_0xfee3('0x35')]);_0x382582[_0xfee3('0x36')]=_[_0xfee3('0x37')](_0x382582[_0xfee3('0x32')],_0x382582[_0xfee3('0x35')]);_0x2ea4bc[_0xfee3('0x38')]=_[_0xfee3('0x37')](_0x382582[_0xfee3('0x32')],qs['fields'](_0x4f96a1[_0xfee3('0x35')][_0xfee3('0x39')]));_0x2ea4bc[_0xfee3('0x38')]=_0x2ea4bc[_0xfee3('0x38')]['length']?_0x2ea4bc[_0xfee3('0x38')]:_0x382582[_0xfee3('0x32')];if(!_0x4f96a1[_0xfee3('0x35')][_0xfee3('0x3a')](_0xfee3('0x3b'))){_0x2ea4bc['limit']=qs['limit'](_0x4f96a1[_0xfee3('0x35')][_0xfee3('0x3c')]);_0x2ea4bc[_0xfee3('0x21')]=qs[_0xfee3('0x21')](_0x4f96a1[_0xfee3('0x35')]['offset']);}_0x2ea4bc['order']=qs[_0xfee3('0x3d')](_0x4f96a1['query'][_0xfee3('0x3d')]);_0x2ea4bc[_0xfee3('0x3e')]=qs['filters'](_[_0xfee3('0x3f')](_0x4f96a1[_0xfee3('0x35')],_0x382582[_0xfee3('0x36')]),_0x5bdd2e);if(_0x4f96a1['query'][_0xfee3('0x40')]){_0x2ea4bc[_0xfee3('0x3e')]=_[_0xfee3('0x41')](_0x2ea4bc[_0xfee3('0x3e')],{'$or':_[_0xfee3('0x33')](_0x5bdd2e,function(_0x48fcd6){if(_0x48fcd6[_0xfee3('0x30')]!==_0xfee3('0x42')){var _0x34aa28={};_0x34aa28[_0x48fcd6['name']]={'$like':'%'+_0x4f96a1['query'][_0xfee3('0x40')]+'%'};return _0x34aa28;}})});}_0x2ea4bc=_[_0xfee3('0x41')]({},_0x2ea4bc,_0x4f96a1[_0xfee3('0x43')]);var _0x46e795={'where':_0x2ea4bc[_0xfee3('0x3e')]};return db[_0xfee3('0x2d')][_0xfee3('0x44')](_0x46e795)[_0xfee3('0x26')](function(_0x139b2a){_0x4d276f[_0xfee3('0x44')]=_0x139b2a;if(_0x4f96a1[_0xfee3('0x35')][_0xfee3('0x45')]){_0x2ea4bc[_0xfee3('0x46')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xfee3('0x47')](_0x2ea4bc);})['then'](function(_0x49bede){_0x4d276f[_0xfee3('0x48')]=_0x49bede;return _0x4d276f;})['then'](respondWithFilteredResult(_0x3261ac,_0x2ea4bc))[_0xfee3('0x49')](handleError(_0x3261ac,null));};exports[_0xfee3('0x4a')]=function(_0x1ef35e,_0x49141f){var _0x2340ed={'raw':![],'where':{'id':_0x1ef35e[_0xfee3('0x4b')]['id']}},_0x539de2={};_0x539de2[_0xfee3('0x32')]=_[_0xfee3('0x34')](db[_0xfee3('0x2d')]['rawAttributes']);_0x539de2['query']=_[_0xfee3('0x34')](_0x1ef35e[_0xfee3('0x35')]);_0x539de2['filters']=_['intersection'](_0x539de2['model'],_0x539de2[_0xfee3('0x35')]);_0x2340ed[_0xfee3('0x38')]=_['intersection'](_0x539de2[_0xfee3('0x32')],qs[_0xfee3('0x39')](_0x1ef35e[_0xfee3('0x35')][_0xfee3('0x39')]));_0x2340ed[_0xfee3('0x38')]=_0x2340ed[_0xfee3('0x38')]['length']?_0x2340ed[_0xfee3('0x38')]:_0x539de2[_0xfee3('0x32')];if(_0x1ef35e[_0xfee3('0x35')][_0xfee3('0x45')]){_0x2340ed['include']=[{'all':!![]}];}_0x2340ed=_[_0xfee3('0x41')]({},_0x2340ed,_0x1ef35e[_0xfee3('0x43')]);return db[_0xfee3('0x2d')][_0xfee3('0x4c')](_0x2340ed)['then'](handleEntityNotFound(_0x49141f,null))[_0xfee3('0x26')](respondWithResult(_0x49141f,null))[_0xfee3('0x49')](handleError(_0x49141f,null));};exports['create']=function(_0x5ca5b1,_0x280a8d){return db[_0xfee3('0x2d')][_0xfee3('0x4d')](_0x5ca5b1[_0xfee3('0x4e')],{})[_0xfee3('0x26')](respondWithResult(_0x280a8d,0xc9))[_0xfee3('0x49')](handleError(_0x280a8d,null));};exports[_0xfee3('0x4f')]=function(_0x448cc4,_0x57c8ac){if(_0x448cc4[_0xfee3('0x4e')]['id']){delete _0x448cc4[_0xfee3('0x4e')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x448cc4['params']['id']}})['then'](handleEntityNotFound(_0x57c8ac,null))[_0xfee3('0x26')](saveUpdates(_0x448cc4['body'],null))[_0xfee3('0x26')](respondWithResult(_0x57c8ac,null))[_0xfee3('0x49')](handleError(_0x57c8ac,null));};exports[_0xfee3('0x27')]=function(_0x2ce298,_0x2d6a14){return db[_0xfee3('0x2d')]['find']({'where':{'id':_0x2ce298[_0xfee3('0x4b')]['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x2d6a14,null))[_0xfee3('0x26')](removeEntity(_0x2d6a14,null))[_0xfee3('0x49')](handleError(_0x2d6a14,null));};exports['getFields']=function(_0x4660e3,_0x1d92d7,_0x299cec){var _0x1a75ab={};var _0x4ccb77={};var _0x290e60;var _0x35528d;return db['DeskConfiguration'][_0xfee3('0x50')]({'where':{'id':_0x4660e3[_0xfee3('0x4b')]['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x1d92d7,null))['then'](function(_0x2ffff9){if(_0x2ffff9){_0x290e60=_0x2ffff9;_0x4ccb77[_0xfee3('0x32')]=_[_0xfee3('0x34')](db[_0xfee3('0x51')][_0xfee3('0x2e')]);_0x4ccb77[_0xfee3('0x35')]=_['keys'](_0x4660e3[_0xfee3('0x35')]);_0x4ccb77[_0xfee3('0x36')]=_[_0xfee3('0x37')](_0x4ccb77[_0xfee3('0x32')],_0x4ccb77['query']);_0x1a75ab[_0xfee3('0x38')]=_[_0xfee3('0x37')](_0x4ccb77['model'],qs[_0xfee3('0x39')](_0x4660e3[_0xfee3('0x35')][_0xfee3('0x39')]));_0x1a75ab[_0xfee3('0x38')]=_0x1a75ab[_0xfee3('0x38')][_0xfee3('0x52')]?_0x1a75ab[_0xfee3('0x38')]:_0x4ccb77[_0xfee3('0x32')];_0x1a75ab[_0xfee3('0x53')]=qs[_0xfee3('0x3d')](_0x4660e3[_0xfee3('0x35')][_0xfee3('0x3d')]);_0x1a75ab[_0xfee3('0x3e')]=qs[_0xfee3('0x36')](_[_0xfee3('0x3f')](_0x4660e3['query'],_0x4ccb77[_0xfee3('0x36')]));if(_0x4660e3[_0xfee3('0x35')][_0xfee3('0x40')]){_0x1a75ab[_0xfee3('0x3e')]=_[_0xfee3('0x41')](_0x1a75ab[_0xfee3('0x3e')],{'$or':_[_0xfee3('0x33')](_0x1a75ab[_0xfee3('0x38')],function(_0x4bbcb5){var _0x4a25e9={};_0x4a25e9[_0x4bbcb5]={'$like':'%'+_0x4660e3['query']['filter']+'%'};return _0x4a25e9;})});}_0x1a75ab=_[_0xfee3('0x41')]({},_0x1a75ab,_0x4660e3['options']);return _0x290e60[_0xfee3('0x54')](_0x1a75ab);}})[_0xfee3('0x26')](function(_0x4885d7){if(_0x4885d7){_0x35528d=_0x4885d7[_0xfee3('0x52')];if(!_0x4660e3[_0xfee3('0x35')][_0xfee3('0x3a')](_0xfee3('0x3b'))){_0x1a75ab['limit']=qs[_0xfee3('0x3c')](_0x4660e3['query']['limit']);_0x1a75ab[_0xfee3('0x21')]=qs[_0xfee3('0x21')](_0x4660e3['query'][_0xfee3('0x21')]);}return _0x290e60[_0xfee3('0x54')](_0x1a75ab);}})['then'](function(_0x16c72c){if(_0x16c72c){return _0x16c72c?{'count':_0x35528d,'rows':_0x16c72c}:null;}})['then'](respondWithResult(_0x1d92d7,null))[_0xfee3('0x49')](handleError(_0x1d92d7,null));};exports['getSubjects']=function(_0x52f4c1,_0x1c2760,_0x97c408){var _0xeb1ba1={};var _0x27c17f={};var _0x330b31;var _0x143dbb;return db[_0xfee3('0x2d')][_0xfee3('0x50')]({'where':{'id':_0x52f4c1[_0xfee3('0x4b')]['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x1c2760,null))[_0xfee3('0x26')](function(_0x3427c4){if(_0x3427c4){_0x330b31=_0x3427c4;_0x27c17f['model']=_['keys'](db[_0xfee3('0x51')][_0xfee3('0x2e')]);_0x27c17f[_0xfee3('0x35')]=_[_0xfee3('0x34')](_0x52f4c1[_0xfee3('0x35')]);_0x27c17f[_0xfee3('0x36')]=_[_0xfee3('0x37')](_0x27c17f[_0xfee3('0x32')],_0x27c17f[_0xfee3('0x35')]);_0xeb1ba1[_0xfee3('0x38')]=_[_0xfee3('0x37')](_0x27c17f['model'],qs['fields'](_0x52f4c1[_0xfee3('0x35')]['fields']));_0xeb1ba1['attributes']=_0xeb1ba1[_0xfee3('0x38')][_0xfee3('0x52')]?_0xeb1ba1[_0xfee3('0x38')]:_0x27c17f['model'];_0xeb1ba1[_0xfee3('0x53')]=qs[_0xfee3('0x3d')](_0x52f4c1[_0xfee3('0x35')][_0xfee3('0x3d')]);_0xeb1ba1['where']=qs['filters'](_[_0xfee3('0x3f')](_0x52f4c1[_0xfee3('0x35')],_0x27c17f['filters']));if(_0x52f4c1[_0xfee3('0x35')]['filter']){_0xeb1ba1[_0xfee3('0x3e')]=_['merge'](_0xeb1ba1[_0xfee3('0x3e')],{'$or':_[_0xfee3('0x33')](_0xeb1ba1['attributes'],function(_0x4e0892){var _0x40564d={};_0x40564d[_0x4e0892]={'$like':'%'+_0x52f4c1[_0xfee3('0x35')]['filter']+'%'};return _0x40564d;})});}_0xeb1ba1=_['merge']({},_0xeb1ba1,_0x52f4c1[_0xfee3('0x43')]);return _0x330b31['getSubjects'](_0xeb1ba1);}})[_0xfee3('0x26')](function(_0x4568ae){if(_0x4568ae){_0x143dbb=_0x4568ae[_0xfee3('0x52')];if(!_0x52f4c1[_0xfee3('0x35')][_0xfee3('0x3a')](_0xfee3('0x3b'))){_0xeb1ba1['limit']=qs[_0xfee3('0x3c')](_0x52f4c1[_0xfee3('0x35')][_0xfee3('0x3c')]);_0xeb1ba1[_0xfee3('0x21')]=qs[_0xfee3('0x21')](_0x52f4c1[_0xfee3('0x35')][_0xfee3('0x21')]);}return _0x330b31['getSubjects'](_0xeb1ba1);}})['then'](function(_0xfe9e82){if(_0xfe9e82){return _0xfe9e82?{'count':_0x143dbb,'rows':_0xfe9e82}:null;}})[_0xfee3('0x26')](respondWithResult(_0x1c2760,null))[_0xfee3('0x49')](handleError(_0x1c2760,null));};exports['getDescriptions']=function(_0x2cabb6,_0x2b443d,_0x4cef83){var _0x414528={};var _0x2d8257={};var _0x24e7d9;var _0x2f954e;return db[_0xfee3('0x2d')][_0xfee3('0x50')]({'where':{'id':_0x2cabb6['params']['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x2b443d,null))[_0xfee3('0x26')](function(_0x225449){if(_0x225449){_0x24e7d9=_0x225449;_0x2d8257[_0xfee3('0x32')]=_[_0xfee3('0x34')](db[_0xfee3('0x51')][_0xfee3('0x2e')]);_0x2d8257['query']=_[_0xfee3('0x34')](_0x2cabb6[_0xfee3('0x35')]);_0x2d8257[_0xfee3('0x36')]=_[_0xfee3('0x37')](_0x2d8257['model'],_0x2d8257['query']);_0x414528['attributes']=_[_0xfee3('0x37')](_0x2d8257[_0xfee3('0x32')],qs[_0xfee3('0x39')](_0x2cabb6[_0xfee3('0x35')][_0xfee3('0x39')]));_0x414528[_0xfee3('0x38')]=_0x414528[_0xfee3('0x38')][_0xfee3('0x52')]?_0x414528[_0xfee3('0x38')]:_0x2d8257[_0xfee3('0x32')];_0x414528[_0xfee3('0x53')]=qs[_0xfee3('0x3d')](_0x2cabb6[_0xfee3('0x35')][_0xfee3('0x3d')]);_0x414528['where']=qs[_0xfee3('0x36')](_[_0xfee3('0x3f')](_0x2cabb6['query'],_0x2d8257['filters']));if(_0x2cabb6[_0xfee3('0x35')][_0xfee3('0x40')]){_0x414528[_0xfee3('0x3e')]=_['merge'](_0x414528['where'],{'$or':_['map'](_0x414528[_0xfee3('0x38')],function(_0x248500){var _0x21018f={};_0x21018f[_0x248500]={'$like':'%'+_0x2cabb6[_0xfee3('0x35')]['filter']+'%'};return _0x21018f;})});}_0x414528=_[_0xfee3('0x41')]({},_0x414528,_0x2cabb6[_0xfee3('0x43')]);return _0x24e7d9[_0xfee3('0x55')](_0x414528);}})['then'](function(_0x187356){if(_0x187356){_0x2f954e=_0x187356['length'];if(!_0x2cabb6[_0xfee3('0x35')][_0xfee3('0x3a')](_0xfee3('0x3b'))){_0x414528[_0xfee3('0x3c')]=qs[_0xfee3('0x3c')](_0x2cabb6['query'][_0xfee3('0x3c')]);_0x414528[_0xfee3('0x21')]=qs[_0xfee3('0x21')](_0x2cabb6[_0xfee3('0x35')][_0xfee3('0x21')]);}return _0x24e7d9[_0xfee3('0x55')](_0x414528);}})[_0xfee3('0x26')](function(_0x1379db){if(_0x1379db){return _0x1379db?{'count':_0x2f954e,'rows':_0x1379db}:null;}})[_0xfee3('0x26')](respondWithResult(_0x2b443d,null))[_0xfee3('0x49')](handleError(_0x2b443d,null));};exports[_0xfee3('0x56')]=function(_0x23b7dd,_0x35f382,_0xd33995){var _0x55e12d={};var _0x53402c={};var _0x1d6c29;var _0x18ab85;return db[_0xfee3('0x2d')]['findOne']({'where':{'id':_0x23b7dd[_0xfee3('0x4b')]['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x35f382,null))[_0xfee3('0x26')](function(_0x25a72b){if(_0x25a72b){_0x1d6c29=_0x25a72b;_0x53402c[_0xfee3('0x32')]=_[_0xfee3('0x34')](db[_0xfee3('0x57')][_0xfee3('0x2e')]);_0x53402c[_0xfee3('0x35')]=_[_0xfee3('0x34')](_0x23b7dd[_0xfee3('0x35')]);_0x53402c[_0xfee3('0x36')]=_[_0xfee3('0x37')](_0x53402c[_0xfee3('0x32')],_0x53402c['query']);_0x55e12d[_0xfee3('0x38')]=_[_0xfee3('0x37')](_0x53402c[_0xfee3('0x32')],qs[_0xfee3('0x39')](_0x23b7dd[_0xfee3('0x35')][_0xfee3('0x39')]));_0x55e12d['attributes']=_0x55e12d[_0xfee3('0x38')][_0xfee3('0x52')]?_0x55e12d[_0xfee3('0x38')]:_0x53402c[_0xfee3('0x32')];_0x55e12d[_0xfee3('0x53')]=qs['sort'](_0x23b7dd['query']['sort']);_0x55e12d[_0xfee3('0x3e')]=qs[_0xfee3('0x36')](_['pick'](_0x23b7dd[_0xfee3('0x35')],_0x53402c[_0xfee3('0x36')]));if(_0x23b7dd[_0xfee3('0x35')][_0xfee3('0x40')]){_0x55e12d[_0xfee3('0x3e')]=_['merge'](_0x55e12d[_0xfee3('0x3e')],{'$or':_['map'](_0x55e12d['attributes'],function(_0x204e48){var _0x3fde48={};_0x3fde48[_0x204e48]={'$like':'%'+_0x23b7dd[_0xfee3('0x35')][_0xfee3('0x40')]+'%'};return _0x3fde48;})});}_0x55e12d=_['merge']({},_0x55e12d,_0x23b7dd[_0xfee3('0x43')]);return _0x1d6c29['getTags'](_0x55e12d);}})[_0xfee3('0x26')](function(_0x46bba0){if(_0x46bba0){_0x18ab85=_0x46bba0['length'];if(!_0x23b7dd[_0xfee3('0x35')]['hasOwnProperty'](_0xfee3('0x3b'))){_0x55e12d[_0xfee3('0x3c')]=qs[_0xfee3('0x3c')](_0x23b7dd[_0xfee3('0x35')]['limit']);_0x55e12d[_0xfee3('0x21')]=qs['offset'](_0x23b7dd[_0xfee3('0x35')][_0xfee3('0x21')]);}return _0x1d6c29[_0xfee3('0x56')](_0x55e12d);}})[_0xfee3('0x26')](function(_0xaa567f){if(_0xaa567f){return _0xaa567f?{'count':_0x18ab85,'rows':_0xaa567f}:null;}})[_0xfee3('0x26')](respondWithResult(_0x35f382,null))[_0xfee3('0x49')](handleError(_0x35f382,null));};exports[_0xfee3('0x58')]=function(_0x406eb9,_0x256a62,_0x4177f9){if(_0x406eb9[_0xfee3('0x4e')]['id']){delete _0x406eb9[_0xfee3('0x4e')]['id'];}return db[_0xfee3('0x2d')]['findOne']({'where':{'id':_0x406eb9[_0xfee3('0x4b')]['id']}})[_0xfee3('0x26')](handleEntityNotFound(_0x256a62,null))[_0xfee3('0x26')](function(_0x57fbd9){if(_0x57fbd9){return _0x57fbd9[_0xfee3('0x58')](_0x406eb9['body'][_0xfee3('0x59')]||[]);}return null;})[_0xfee3('0x26')](respondWithResult(_0x256a62,null))[_0xfee3('0x49')](handleError(_0x256a62,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0447f8e..89eecce 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 _0x4086=['api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x2cd796,_0x47d578){var _0x42e314=function(_0x36d3f5){while(--_0x36d3f5){_0x2cd796['push'](_0x2cd796['shift']());}};_0x42e314(++_0x47d578);}(_0x4086,0xdd));var _0x6408=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4086[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6408('0x0'));var util=require(_0x6408('0x1'));var logger=require(_0x6408('0x2'))(_0x6408('0x3'));var moment=require(_0x6408('0x4'));var BPromise=require(_0x6408('0x5'));var rp=require(_0x6408('0x6'));var fs=require('fs');var path=require(_0x6408('0x7'));var rimraf=require(_0x6408('0x8'));var config=require('../../config/environment');var attributes=require(_0x6408('0x9'));module[_0x6408('0xa')]=function(_0x151059,_0x1ce7be){return _0x151059[_0x6408('0xb')](_0x6408('0xc'),attributes,{'tableName':_0x6408('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90c4=['exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x90c4,0x137));var _0x490c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x90c4[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x490c('0x0'));var util=require('util');var logger=require(_0x490c('0x1'))(_0x490c('0x2'));var moment=require(_0x490c('0x3'));var BPromise=require('bluebird');var rp=require(_0x490c('0x4'));var fs=require('fs');var path=require(_0x490c('0x5'));var rimraf=require(_0x490c('0x6'));var config=require(_0x490c('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x490c('0x8')]=function(_0x192a08,_0x179a04){return _0x192a08['define'](_0x490c('0x9'),attributes,{'tableName':_0x490c('0xa'),'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 49ee762..56ebb58 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 _0x0570=['request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x0570,0x172));var _0x0057=function(_0x57ca00,_0x4ce92b){_0x57ca00=_0x57ca00-0x0;var _0x552f28=_0x0570[_0x57ca00];return _0x552f28;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});} \ No newline at end of file +var _0x6d38=['request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b35c7,_0x2f551f){var _0x45545a=function(_0x4bab07){while(--_0x4bab07){_0x5b35c7['push'](_0x5b35c7['shift']());}};_0x45545a(++_0x2f551f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 487666e..2739e12 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 _0x3bd3=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','show'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x3bd3,0x110));var _0x33bd=function(_0x524dfb,_0x954399){_0x524dfb=_0x524dfb-0x0;var _0x3bec28=_0x3bd3[_0x524dfb];return _0x3bec28;};'use strict';var multer=require(_0x33bd('0x0'));var util=require(_0x33bd('0x1'));var path=require(_0x33bd('0x2'));var timeout=require(_0x33bd('0x3'));var express=require(_0x33bd('0x4'));var router=express[_0x33bd('0x5')]();var fs_extra=require(_0x33bd('0x6'));var auth=require(_0x33bd('0x7'));var interaction=require(_0x33bd('0x8'));var config=require('../../config/environment');var controller=require(_0x33bd('0x9'));router[_0x33bd('0xa')]('/',auth[_0x33bd('0xb')](),controller[_0x33bd('0xc')]);router['get']('/:id',auth[_0x33bd('0xb')](),controller[_0x33bd('0xd')]);router[_0x33bd('0xe')]('/',auth[_0x33bd('0xb')](),controller[_0x33bd('0xf')]);router[_0x33bd('0x10')](_0x33bd('0x11'),auth['isAuthenticated'](),controller[_0x33bd('0x12')]);router[_0x33bd('0x13')]('/:id',auth[_0x33bd('0xb')](),controller[_0x33bd('0x14')]);module[_0x33bd('0x15')]=router; \ No newline at end of file +var _0xae08=['../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae08,0x115));var _0x8ae0=function(_0x4e19e4,_0x4b1544){_0x4e19e4=_0x4e19e4-0x0;var _0x4c780f=_0xae08[_0x4e19e4];return _0x4c780f;};'use strict';var multer=require('multer');var util=require(_0x8ae0('0x0'));var path=require(_0x8ae0('0x1'));var timeout=require(_0x8ae0('0x2'));var express=require(_0x8ae0('0x3'));var router=express[_0x8ae0('0x4')]();var fs_extra=require(_0x8ae0('0x5'));var auth=require(_0x8ae0('0x6'));var interaction=require(_0x8ae0('0x7'));var config=require(_0x8ae0('0x8'));var controller=require(_0x8ae0('0x9'));router[_0x8ae0('0xa')]('/',auth[_0x8ae0('0xb')](),controller[_0x8ae0('0xc')]);router[_0x8ae0('0xa')](_0x8ae0('0xd'),auth[_0x8ae0('0xb')](),controller['show']);router[_0x8ae0('0xe')]('/',auth['isAuthenticated'](),controller[_0x8ae0('0xf')]);router[_0x8ae0('0x10')](_0x8ae0('0xd'),auth[_0x8ae0('0xb')](),controller['update']);router[_0x8ae0('0x11')](_0x8ae0('0xd'),auth[_0x8ae0('0xb')](),controller[_0x8ae0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a833629..e5c912a 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 _0x788e=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0xd69e68,_0x6e75cf){var _0x38c3ef=function(_0x3693b9){while(--_0x3693b9){_0xd69e68['push'](_0xd69e68['shift']());}};_0x38c3ef(++_0x6e75cf);}(_0x788e,0xdd));var _0xe788=function(_0x571ede,_0x4b1f0a){_0x571ede=_0x571ede-0x0;var _0x4c6bf5=_0x788e[_0x571ede];return _0x4c6bf5;};'use strict';var Sequelize=require(_0xe788('0x0'));module[_0xe788('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe788('0x2'),_0xe788('0x3'),_0xe788('0x4'),_0xe788('0x5'),_0xe788('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe788('0x7')]},'key':{'type':Sequelize[_0xe788('0x7')]},'keyType':{'type':Sequelize[_0xe788('0x8')](_0xe788('0x2'),_0xe788('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe788('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe788('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe788('0x7')]}}; \ No newline at end of file +var _0xff11=['ENUM','string','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0xff11,0x12b));var _0x1ff1=function(_0x8af759,_0x340c5f){_0x8af759=_0x8af759-0x0;var _0x4268d7=_0xff11[_0x8af759];return _0x4268d7;};'use strict';var Sequelize=require(_0x1ff1('0x0'));module[_0x1ff1('0x1')]={'type':{'type':Sequelize[_0x1ff1('0x2')](_0x1ff1('0x3'),_0x1ff1('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0x1ff1('0x3')},'content':{'type':Sequelize[_0x1ff1('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1ff1('0x3'),_0x1ff1('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1ff1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1ff1('0x5')]},'customField':{'type':Sequelize[_0x1ff1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ff1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a7e0657..99250f7 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 _0x556b=['send','index','DeskField','rawAttributes','type','model','name','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','map','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','destroy','sendStatus','stack'];(function(_0x59af9d,_0x2ba234){var _0x200c6a=function(_0x5a4c9f){while(--_0x5a4c9f){_0x59af9d['push'](_0x59af9d['shift']());}};_0x200c6a(++_0x2ba234);}(_0x556b,0x1d7));var _0xb556=function(_0x3dc130,_0x116fd2){_0x3dc130=_0x3dc130-0x0;var _0x46651a=_0x556b[_0x3dc130];return _0x46651a;};'use strict';var emlformat=require(_0xb556('0x0'));var rimraf=require(_0xb556('0x1'));var zipdir=require(_0xb556('0x2'));var jsonpatch=require(_0xb556('0x3'));var rp=require(_0xb556('0x4'));var moment=require('moment');var BPromise=require(_0xb556('0x5'));var Mustache=require(_0xb556('0x6'));var util=require(_0xb556('0x7'));var path=require(_0xb556('0x8'));var sox=require(_0xb556('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb556('0xa'));var squel=require(_0xb556('0xb'));var crypto=require(_0xb556('0xc'));var jsforce=require(_0xb556('0xd'));var deskjs=require(_0xb556('0xe'));var toCsv=require(_0xb556('0xf'));var querystring=require(_0xb556('0x10'));var Papa=require(_0xb556('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb556('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb556('0x13'));var logger=require(_0xb556('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb556('0x15'));var licenseUtil=require(_0xb556('0x16'));var db=require(_0xb556('0x17'))['db'];function respondWithStatusCode(_0x40d9f2,_0xef593){_0xef593=_0xef593||0xcc;return function(_0x383401){if(_0x383401){return _0x40d9f2['sendStatus'](_0xef593);}return _0x40d9f2['status'](_0xef593)[_0xb556('0x18')]();};}function respondWithResult(_0x5a002a,_0x29fa7e){_0x29fa7e=_0x29fa7e||0xc8;return function(_0x52ff5e){if(_0x52ff5e){return _0x5a002a['status'](_0x29fa7e)['json'](_0x52ff5e);}};}function respondWithFilteredResult(_0x39305f,_0x9c69d9){return function(_0xffd07){if(_0xffd07){var _0x329bd0=typeof _0x9c69d9[_0xb556('0x19')]===_0xb556('0x1a')&&typeof _0x9c69d9[_0xb556('0x1b')]===_0xb556('0x1a');var _0xcfaa19=_0xffd07['count'];var _0x475808=_0x329bd0?0x0:_0x9c69d9[_0xb556('0x19')];var _0xb378b2=_0x329bd0?_0xffd07[_0xb556('0x1c')]:_0x9c69d9['offset']+_0x9c69d9[_0xb556('0x1b')];var _0x355b15;if(_0xb378b2>=_0xcfaa19){_0xb378b2=_0xcfaa19;_0x355b15=0xc8;}else{_0x355b15=0xce;}_0x39305f[_0xb556('0x1d')](_0x355b15);return _0x39305f[_0xb556('0x1e')]('Content-Range',_0x475808+'-'+_0xb378b2+'/'+_0xcfaa19)[_0xb556('0x1f')](_0xffd07);}return null;};}function patchUpdates(_0x3f1f30){return function(_0xa840e7){try{jsonpatch[_0xb556('0x20')](_0xa840e7,_0x3f1f30,!![]);}catch(_0x49d0b5){return BPromise[_0xb556('0x21')](_0x49d0b5);}return _0xa840e7[_0xb556('0x22')]();};}function saveUpdates(_0x21a3b6,_0x126af6){return function(_0x420ddb){if(_0x420ddb){return _0x420ddb[_0xb556('0x23')](_0x21a3b6)[_0xb556('0x24')](function(_0x5f10a5){return _0x5f10a5;});}return null;};}function removeEntity(_0x33797a,_0x3d5ae7){return function(_0x12b195){if(_0x12b195){return _0x12b195[_0xb556('0x25')]()[_0xb556('0x24')](function(){_0x33797a[_0xb556('0x1d')](0xcc)[_0xb556('0x18')]();});}};}function handleEntityNotFound(_0x442264,_0x22abed){return function(_0x184e87){if(!_0x184e87){_0x442264[_0xb556('0x26')](0x194);}return _0x184e87;};}function handleError(_0x3a328c,_0xb89dbe){_0xb89dbe=_0xb89dbe||0x1f4;return function(_0x1962b1){logger['error'](_0x1962b1[_0xb556('0x27')]);if(_0x1962b1['name']){delete _0x1962b1['name'];}_0x3a328c['status'](_0xb89dbe)[_0xb556('0x28')](_0x1962b1);};}exports[_0xb556('0x29')]=function(_0x27fd7e,_0x58180c){var _0x19544e={},_0x3c9a87={},_0x5d8d06={'count':0x0,'rows':[]};var _0x58990f=_['map'](db[_0xb556('0x2a')][_0xb556('0x2b')],function(_0x4bba03){return{'name':_0x4bba03['fieldName'],'type':_0x4bba03[_0xb556('0x2c')]['key']};});_0x3c9a87[_0xb556('0x2d')]=_['map'](_0x58990f,_0xb556('0x2e'));_0x3c9a87['query']=_[_0xb556('0x2f')](_0x27fd7e[_0xb556('0x30')]);_0x3c9a87['filters']=_['intersection'](_0x3c9a87[_0xb556('0x2d')],_0x3c9a87[_0xb556('0x30')]);_0x19544e[_0xb556('0x31')]=_['intersection'](_0x3c9a87[_0xb556('0x2d')],qs[_0xb556('0x32')](_0x27fd7e[_0xb556('0x30')][_0xb556('0x32')]));_0x19544e['attributes']=_0x19544e[_0xb556('0x31')][_0xb556('0x33')]?_0x19544e['attributes']:_0x3c9a87['model'];if(!_0x27fd7e[_0xb556('0x30')][_0xb556('0x34')](_0xb556('0x35'))){_0x19544e['limit']=qs[_0xb556('0x1b')](_0x27fd7e[_0xb556('0x30')]['limit']);_0x19544e[_0xb556('0x19')]=qs[_0xb556('0x19')](_0x27fd7e[_0xb556('0x30')]['offset']);}_0x19544e['order']=qs[_0xb556('0x36')](_0x27fd7e[_0xb556('0x30')][_0xb556('0x36')]);_0x19544e['where']=qs[_0xb556('0x37')](_[_0xb556('0x38')](_0x27fd7e['query'],_0x3c9a87['filters']),_0x58990f);if(_0x27fd7e[_0xb556('0x30')][_0xb556('0x39')]){_0x19544e['where']=_['merge'](_0x19544e[_0xb556('0x3a')],{'$or':_[_0xb556('0x3b')](_0x58990f,function(_0x38c26d){if(_0x38c26d[_0xb556('0x2c')]!=='VIRTUAL'){var _0x348a8e={};_0x348a8e[_0x38c26d['name']]={'$like':'%'+_0x27fd7e['query'][_0xb556('0x39')]+'%'};return _0x348a8e;}})});}_0x19544e=_[_0xb556('0x3c')]({},_0x19544e,_0x27fd7e[_0xb556('0x3d')]);var _0x15add6={'where':_0x19544e[_0xb556('0x3a')]};return db[_0xb556('0x2a')]['count'](_0x15add6)[_0xb556('0x24')](function(_0xe1e49){_0x5d8d06[_0xb556('0x1c')]=_0xe1e49;if(_0x27fd7e[_0xb556('0x30')][_0xb556('0x3e')]){_0x19544e['include']=[{'all':!![]}];}return db[_0xb556('0x2a')][_0xb556('0x3f')](_0x19544e);})['then'](function(_0x107746){_0x5d8d06[_0xb556('0x40')]=_0x107746;return _0x5d8d06;})[_0xb556('0x24')](respondWithFilteredResult(_0x58180c,_0x19544e))[_0xb556('0x41')](handleError(_0x58180c,null));};exports[_0xb556('0x42')]=function(_0x35c0ad,_0xfb9f2b){var _0x488888={'raw':!![],'where':{'id':_0x35c0ad[_0xb556('0x43')]['id']}},_0x51ad59={};_0x51ad59[_0xb556('0x2d')]=_['keys'](db['DeskField'][_0xb556('0x2b')]);_0x51ad59[_0xb556('0x30')]=_[_0xb556('0x2f')](_0x35c0ad['query']);_0x51ad59[_0xb556('0x37')]=_['intersection'](_0x51ad59[_0xb556('0x2d')],_0x51ad59[_0xb556('0x30')]);_0x488888[_0xb556('0x31')]=_[_0xb556('0x44')](_0x51ad59['model'],qs[_0xb556('0x32')](_0x35c0ad[_0xb556('0x30')]['fields']));_0x488888[_0xb556('0x31')]=_0x488888[_0xb556('0x31')][_0xb556('0x33')]?_0x488888[_0xb556('0x31')]:_0x51ad59['model'];if(_0x35c0ad[_0xb556('0x30')][_0xb556('0x3e')]){_0x488888[_0xb556('0x45')]=[{'all':!![]}];}_0x488888=_[_0xb556('0x3c')]({},_0x488888,_0x35c0ad['options']);return db['DeskField'][_0xb556('0x46')](_0x488888)[_0xb556('0x24')](handleEntityNotFound(_0xfb9f2b,null))['then'](respondWithResult(_0xfb9f2b,null))[_0xb556('0x41')](handleError(_0xfb9f2b,null));};exports[_0xb556('0x47')]=function(_0x55b9a1,_0x29ac04){return db[_0xb556('0x2a')][_0xb556('0x47')](_0x55b9a1[_0xb556('0x48')],{})[_0xb556('0x24')](respondWithResult(_0x29ac04,0xc9))[_0xb556('0x41')](handleError(_0x29ac04,null));};exports[_0xb556('0x23')]=function(_0x167e6b,_0x221df8){if(_0x167e6b[_0xb556('0x48')]['id']){delete _0x167e6b[_0xb556('0x48')]['id'];}return db[_0xb556('0x2a')][_0xb556('0x46')]({'where':{'id':_0x167e6b[_0xb556('0x43')]['id']}})[_0xb556('0x24')](handleEntityNotFound(_0x221df8,null))[_0xb556('0x24')](saveUpdates(_0x167e6b['body'],null))[_0xb556('0x24')](respondWithResult(_0x221df8,null))[_0xb556('0x41')](handleError(_0x221df8,null));};exports['destroy']=function(_0x496b7f,_0x4686d5){return db[_0xb556('0x2a')][_0xb556('0x46')]({'where':{'id':_0x496b7f[_0xb556('0x43')]['id']}})['then'](handleEntityNotFound(_0x4686d5,null))['then'](removeEntity(_0x4686d5,null))[_0xb556('0x41')](handleError(_0x4686d5,null));}; \ No newline at end of file +var _0xdd0c=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','map','VIRTUAL','where','include','rows','catch','params','includeAll','DeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0xdd0c,0x1ad));var _0xcdd0=function(_0x5e7e3a,_0x510aa0){_0x5e7e3a=_0x5e7e3a-0x0;var _0x3ce9b7=_0xdd0c[_0x5e7e3a];return _0x3ce9b7;};'use strict';var emlformat=require(_0xcdd0('0x0'));var rimraf=require(_0xcdd0('0x1'));var zipdir=require(_0xcdd0('0x2'));var jsonpatch=require(_0xcdd0('0x3'));var rp=require('request-promise');var moment=require(_0xcdd0('0x4'));var BPromise=require(_0xcdd0('0x5'));var Mustache=require(_0xcdd0('0x6'));var util=require(_0xcdd0('0x7'));var path=require(_0xcdd0('0x8'));var sox=require('sox');var csv=require(_0xcdd0('0x9'));var ejs=require(_0xcdd0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdd0('0xb'));var squel=require(_0xcdd0('0xc'));var crypto=require(_0xcdd0('0xd'));var jsforce=require(_0xcdd0('0xe'));var deskjs=require(_0xcdd0('0xf'));var toCsv=require(_0xcdd0('0x9'));var querystring=require(_0xcdd0('0x10'));var Papa=require(_0xcdd0('0x11'));var Redis=require(_0xcdd0('0x12'));var authService=require(_0xcdd0('0x13'));var qs=require(_0xcdd0('0x14'));var as=require(_0xcdd0('0x15'));var hardwareService=require(_0xcdd0('0x16'));var logger=require(_0xcdd0('0x17'))(_0xcdd0('0x18'));var utils=require(_0xcdd0('0x19'));var config=require(_0xcdd0('0x1a'));var licenseUtil=require(_0xcdd0('0x1b'));var db=require(_0xcdd0('0x1c'))['db'];function respondWithStatusCode(_0x5d123a,_0x24f51a){_0x24f51a=_0x24f51a||0xcc;return function(_0xccaf24){if(_0xccaf24){return _0x5d123a['sendStatus'](_0x24f51a);}return _0x5d123a[_0xcdd0('0x1d')](_0x24f51a)[_0xcdd0('0x1e')]();};}function respondWithResult(_0x322162,_0x7237ec){_0x7237ec=_0x7237ec||0xc8;return function(_0x4da318){if(_0x4da318){return _0x322162[_0xcdd0('0x1d')](_0x7237ec)[_0xcdd0('0x1f')](_0x4da318);}};}function respondWithFilteredResult(_0x3db13f,_0x7df15f){return function(_0x271098){if(_0x271098){var _0x23b3d0=typeof _0x7df15f[_0xcdd0('0x20')]===_0xcdd0('0x21')&&typeof _0x7df15f[_0xcdd0('0x22')]===_0xcdd0('0x21');var _0x3df052=_0x271098[_0xcdd0('0x23')];var _0x1376a8=_0x23b3d0?0x0:_0x7df15f[_0xcdd0('0x20')];var _0x3b32cc=_0x23b3d0?_0x271098[_0xcdd0('0x23')]:_0x7df15f['offset']+_0x7df15f['limit'];var _0xdbbe1b;if(_0x3b32cc>=_0x3df052){_0x3b32cc=_0x3df052;_0xdbbe1b=0xc8;}else{_0xdbbe1b=0xce;}_0x3db13f[_0xcdd0('0x1d')](_0xdbbe1b);return _0x3db13f[_0xcdd0('0x24')](_0xcdd0('0x25'),_0x1376a8+'-'+_0x3b32cc+'/'+_0x3df052)[_0xcdd0('0x1f')](_0x271098);}return null;};}function patchUpdates(_0x5f381b){return function(_0xb8d45){try{jsonpatch[_0xcdd0('0x26')](_0xb8d45,_0x5f381b,!![]);}catch(_0x23364d){return BPromise[_0xcdd0('0x27')](_0x23364d);}return _0xb8d45[_0xcdd0('0x28')]();};}function saveUpdates(_0x52241b,_0x4fbacf){return function(_0x1509b4){if(_0x1509b4){return _0x1509b4[_0xcdd0('0x29')](_0x52241b)[_0xcdd0('0x2a')](function(_0x5a9cdf){return _0x5a9cdf;});}return null;};}function removeEntity(_0x58ef60,_0x5d2f58){return function(_0x240f0e){if(_0x240f0e){return _0x240f0e[_0xcdd0('0x2b')]()['then'](function(){_0x58ef60['status'](0xcc)[_0xcdd0('0x1e')]();});}};}function handleEntityNotFound(_0x50017a,_0x5da9e9){return function(_0x3899ad){if(!_0x3899ad){_0x50017a[_0xcdd0('0x2c')](0x194);}return _0x3899ad;};}function handleError(_0xdf7654,_0x39af74){_0x39af74=_0x39af74||0x1f4;return function(_0x4c5c1d){logger[_0xcdd0('0x2d')](_0x4c5c1d['stack']);if(_0x4c5c1d[_0xcdd0('0x2e')]){delete _0x4c5c1d['name'];}_0xdf7654[_0xcdd0('0x1d')](_0x39af74)[_0xcdd0('0x2f')](_0x4c5c1d);};}exports[_0xcdd0('0x30')]=function(_0x2e9eed,_0x3eee3a){var _0xee2416={},_0x33eb6f={},_0x352b46={'count':0x0,'rows':[]};var _0xc26336=_['map'](db['DeskField'][_0xcdd0('0x31')],function(_0x4bc6c4){return{'name':_0x4bc6c4[_0xcdd0('0x32')],'type':_0x4bc6c4[_0xcdd0('0x33')]['key']};});_0x33eb6f[_0xcdd0('0x34')]=_['map'](_0xc26336,_0xcdd0('0x2e'));_0x33eb6f[_0xcdd0('0x35')]=_[_0xcdd0('0x36')](_0x2e9eed[_0xcdd0('0x35')]);_0x33eb6f[_0xcdd0('0x37')]=_['intersection'](_0x33eb6f[_0xcdd0('0x34')],_0x33eb6f[_0xcdd0('0x35')]);_0xee2416[_0xcdd0('0x38')]=_[_0xcdd0('0x39')](_0x33eb6f[_0xcdd0('0x34')],qs['fields'](_0x2e9eed[_0xcdd0('0x35')][_0xcdd0('0x3a')]));_0xee2416['attributes']=_0xee2416[_0xcdd0('0x38')][_0xcdd0('0x3b')]?_0xee2416['attributes']:_0x33eb6f['model'];if(!_0x2e9eed[_0xcdd0('0x35')][_0xcdd0('0x3c')](_0xcdd0('0x3d'))){_0xee2416[_0xcdd0('0x22')]=qs[_0xcdd0('0x22')](_0x2e9eed['query'][_0xcdd0('0x22')]);_0xee2416[_0xcdd0('0x20')]=qs[_0xcdd0('0x20')](_0x2e9eed[_0xcdd0('0x35')][_0xcdd0('0x20')]);}_0xee2416['order']=qs[_0xcdd0('0x3e')](_0x2e9eed['query'][_0xcdd0('0x3e')]);_0xee2416['where']=qs[_0xcdd0('0x37')](_['pick'](_0x2e9eed[_0xcdd0('0x35')],_0x33eb6f[_0xcdd0('0x37')]),_0xc26336);if(_0x2e9eed[_0xcdd0('0x35')][_0xcdd0('0x3f')]){_0xee2416['where']=_[_0xcdd0('0x40')](_0xee2416['where'],{'$or':_[_0xcdd0('0x41')](_0xc26336,function(_0x5c65ef){if(_0x5c65ef[_0xcdd0('0x33')]!==_0xcdd0('0x42')){var _0x11269f={};_0x11269f[_0x5c65ef[_0xcdd0('0x2e')]]={'$like':'%'+_0x2e9eed[_0xcdd0('0x35')][_0xcdd0('0x3f')]+'%'};return _0x11269f;}})});}_0xee2416=_[_0xcdd0('0x40')]({},_0xee2416,_0x2e9eed['options']);var _0x2042b2={'where':_0xee2416[_0xcdd0('0x43')]};return db['DeskField'][_0xcdd0('0x23')](_0x2042b2)[_0xcdd0('0x2a')](function(_0x42ff7b){_0x352b46[_0xcdd0('0x23')]=_0x42ff7b;if(_0x2e9eed['query']['includeAll']){_0xee2416[_0xcdd0('0x44')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xee2416);})[_0xcdd0('0x2a')](function(_0x23aeb5){_0x352b46[_0xcdd0('0x45')]=_0x23aeb5;return _0x352b46;})[_0xcdd0('0x2a')](respondWithFilteredResult(_0x3eee3a,_0xee2416))[_0xcdd0('0x46')](handleError(_0x3eee3a,null));};exports['show']=function(_0x4dc8ce,_0xeadf6e){var _0x4a638d={'raw':!![],'where':{'id':_0x4dc8ce[_0xcdd0('0x47')]['id']}},_0x1d2a07={};_0x1d2a07[_0xcdd0('0x34')]=_[_0xcdd0('0x36')](db['DeskField'][_0xcdd0('0x31')]);_0x1d2a07[_0xcdd0('0x35')]=_[_0xcdd0('0x36')](_0x4dc8ce[_0xcdd0('0x35')]);_0x1d2a07['filters']=_['intersection'](_0x1d2a07['model'],_0x1d2a07[_0xcdd0('0x35')]);_0x4a638d[_0xcdd0('0x38')]=_[_0xcdd0('0x39')](_0x1d2a07[_0xcdd0('0x34')],qs[_0xcdd0('0x3a')](_0x4dc8ce[_0xcdd0('0x35')]['fields']));_0x4a638d[_0xcdd0('0x38')]=_0x4a638d[_0xcdd0('0x38')][_0xcdd0('0x3b')]?_0x4a638d[_0xcdd0('0x38')]:_0x1d2a07['model'];if(_0x4dc8ce[_0xcdd0('0x35')][_0xcdd0('0x48')]){_0x4a638d[_0xcdd0('0x44')]=[{'all':!![]}];}_0x4a638d=_[_0xcdd0('0x40')]({},_0x4a638d,_0x4dc8ce['options']);return db[_0xcdd0('0x49')][_0xcdd0('0x4a')](_0x4a638d)[_0xcdd0('0x2a')](handleEntityNotFound(_0xeadf6e,null))[_0xcdd0('0x2a')](respondWithResult(_0xeadf6e,null))[_0xcdd0('0x46')](handleError(_0xeadf6e,null));};exports['create']=function(_0xd78767,_0x261e9f){return db[_0xcdd0('0x49')][_0xcdd0('0x4b')](_0xd78767[_0xcdd0('0x4c')],{})[_0xcdd0('0x2a')](respondWithResult(_0x261e9f,0xc9))[_0xcdd0('0x46')](handleError(_0x261e9f,null));};exports[_0xcdd0('0x29')]=function(_0x55e3a1,_0x14383f){if(_0x55e3a1[_0xcdd0('0x4c')]['id']){delete _0x55e3a1[_0xcdd0('0x4c')]['id'];}return db['DeskField'][_0xcdd0('0x4a')]({'where':{'id':_0x55e3a1[_0xcdd0('0x47')]['id']}})[_0xcdd0('0x2a')](handleEntityNotFound(_0x14383f,null))['then'](saveUpdates(_0x55e3a1[_0xcdd0('0x4c')],null))['then'](respondWithResult(_0x14383f,null))[_0xcdd0('0x46')](handleError(_0x14383f,null));};exports['destroy']=function(_0x58df29,_0x34f4f1){return db['DeskField'][_0xcdd0('0x4a')]({'where':{'id':_0x58df29[_0xcdd0('0x47')]['id']}})['then'](handleEntityNotFound(_0x34f4f1,null))[_0xcdd0('0x2a')](removeEntity(_0x34f4f1,null))['catch'](handleError(_0x34f4f1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e3fe2c3..3d0cdb1 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 _0xad8f=['DeskField','int_desk_fields','desk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x447b19,_0x7df010){var _0x3d92e0=function(_0x1a1e0b){while(--_0x1a1e0b){_0x447b19['push'](_0x447b19['shift']());}};_0x3d92e0(++_0x7df010);}(_0xad8f,0xd4));var _0xfad8=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xad8f[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0xfad8('0x0'));var logger=require(_0xfad8('0x1'))(_0xfad8('0x2'));var moment=require(_0xfad8('0x3'));var BPromise=require(_0xfad8('0x4'));var rp=require(_0xfad8('0x5'));var fs=require('fs');var path=require(_0xfad8('0x6'));var rimraf=require(_0xfad8('0x7'));var config=require(_0xfad8('0x8'));var attributes=require(_0xfad8('0x9'));module[_0xfad8('0xa')]=function(_0x2df88f,_0x2a16c3){return _0x2df88f[_0xfad8('0xb')](_0xfad8('0xc'),attributes,{'tableName':_0xfad8('0xd'),'paranoid':![],'indexes':[{'name':_0xfad8('0xe'),'fields':['idField',_0xfad8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf268=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_desk_fields','desk_unique_index','FieldId','lodash'];(function(_0x1642d4,_0x52b650){var _0x3c533f=function(_0x27cdff){while(--_0x27cdff){_0x1642d4['push'](_0x1642d4['shift']());}};_0x3c533f(++_0x52b650);}(_0xf268,0x8e));var _0x8f26=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0xf268[_0x17fd72];return _0xa8d8c6;};'use strict';var _=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var logger=require(_0x8f26('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8f26('0x3'));var rp=require(_0x8f26('0x4'));var fs=require('fs');var path=require(_0x8f26('0x5'));var rimraf=require(_0x8f26('0x6'));var config=require(_0x8f26('0x7'));var attributes=require('./intDeskField.attributes');module[_0x8f26('0x8')]=function(_0x3ab617,_0x573ecd){return _0x3ab617[_0x8f26('0x9')]('DeskField',attributes,{'tableName':_0x8f26('0xa'),'paranoid':![],'indexes':[{'name':_0x8f26('0xb'),'fields':['idField',_0x8f26('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 1a63c96..2d35747 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 _0x34c0=['stringify','error','message','DeskField,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent'];(function(_0x1c4982,_0x56c863){var _0x31de9b=function(_0xcb537e){while(--_0xcb537e){_0x1c4982['push'](_0x1c4982['shift']());}};_0x31de9b(++_0x56c863);}(_0x34c0,0x1ab));var _0x034c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x034c('0x0'));var util=require('util');var moment=require(_0x034c('0x1'));var BPromise=require(_0x034c('0x2'));var rs=require(_0x034c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x034c('0x4'))['db'];var utils=require(_0x034c('0x5'));var logger=require('../../config/logger')(_0x034c('0x6'));var config=require(_0x034c('0x7'));var jayson=require(_0x034c('0x8'));var client=jayson['client'][_0x034c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29d566,_0x1b53c6,_0x1af3bb){return new BPromise(function(_0x22da50,_0x2e7c9e){return client[_0x034c('0xa')](_0x29d566,_0x1af3bb)[_0x034c('0xb')](function(_0x3a880e){logger['info']('DeskField,\x20%s,\x20%s',_0x1b53c6,_0x034c('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x1b53c6,_0x034c('0xc'),JSON[_0x034c('0xd')](_0x3a880e));if(_0x3a880e[_0x034c('0xe')]){if(_0x3a880e['error']['code']===0x1f4){logger[_0x034c('0xe')]('DeskField,\x20%s,\x20%s',_0x1b53c6,_0x3a880e[_0x034c('0xe')][_0x034c('0xf')]);return _0x2e7c9e(_0x3a880e[_0x034c('0xe')][_0x034c('0xf')]);}logger[_0x034c('0xe')](_0x034c('0x10'),_0x1b53c6,_0x3a880e[_0x034c('0xe')][_0x034c('0xf')]);return _0x22da50(_0x3a880e[_0x034c('0xe')][_0x034c('0xf')]);}else{logger[_0x034c('0x11')](_0x034c('0x10'),_0x1b53c6,_0x034c('0xc'));_0x22da50(_0x3a880e[_0x034c('0x12')][_0x034c('0xf')]);}})[_0x034c('0x13')](function(_0x43671a){logger[_0x034c('0xe')](_0x034c('0x10'),_0x1b53c6,_0x43671a);_0x2e7c9e(_0x43671a);});});} \ No newline at end of file +var _0xd1e8=['jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e934c,_0x5edffc){var _0x3e3e4a=function(_0x65294d){while(--_0x65294d){_0x4e934c['push'](_0x4e934c['shift']());}};_0x3e3e4a(++_0x5edffc);}(_0xd1e8,0x117));var _0x8d1e=function(_0x2873e4,_0xcf831e){_0x2873e4=_0x2873e4-0x0;var _0x384c08=_0xd1e8[_0x2873e4];return _0x384c08;};'use strict';var _=require(_0x8d1e('0x0'));var util=require(_0x8d1e('0x1'));var moment=require(_0x8d1e('0x2'));var BPromise=require(_0x8d1e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d1e('0x4'))['db'];var utils=require(_0x8d1e('0x5'));var logger=require(_0x8d1e('0x6'))(_0x8d1e('0x7'));var config=require(_0x8d1e('0x8'));var jayson=require(_0x8d1e('0x9'));var client=jayson[_0x8d1e('0xa')][_0x8d1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31029f,_0x3d3791,_0x27b387){return new BPromise(function(_0x556ad1,_0x472a70){return client[_0x8d1e('0xc')](_0x31029f,_0x27b387)[_0x8d1e('0xd')](function(_0x2d7ef8){logger[_0x8d1e('0xe')](_0x8d1e('0xf'),_0x3d3791,_0x8d1e('0x10'));logger[_0x8d1e('0x11')](_0x8d1e('0x12'),_0x3d3791,_0x8d1e('0x10'),JSON[_0x8d1e('0x13')](_0x2d7ef8));if(_0x2d7ef8['error']){if(_0x2d7ef8[_0x8d1e('0x14')][_0x8d1e('0x15')]===0x1f4){logger[_0x8d1e('0x14')]('DeskField,\x20%s,\x20%s',_0x3d3791,_0x2d7ef8[_0x8d1e('0x14')][_0x8d1e('0x16')]);return _0x472a70(_0x2d7ef8[_0x8d1e('0x14')][_0x8d1e('0x16')]);}logger[_0x8d1e('0x14')](_0x8d1e('0xf'),_0x3d3791,_0x2d7ef8[_0x8d1e('0x14')][_0x8d1e('0x16')]);return _0x556ad1(_0x2d7ef8['error'][_0x8d1e('0x16')]);}else{logger['info'](_0x8d1e('0xf'),_0x3d3791,_0x8d1e('0x10'));_0x556ad1(_0x2d7ef8['result'][_0x8d1e('0x16')]);}})[_0x8d1e('0x17')](function(_0x42a05){logger[_0x8d1e('0x14')](_0x8d1e('0xf'),_0x3d3791,_0x42a05);_0x472a70(_0x42a05);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1637fe0..0e83546 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 _0x8935=['getConfigurations','getFields','post','addConfiguration','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','/:id/configurations'];(function(_0x43b3ac,_0x294393){var _0x816124=function(_0x157bb5){while(--_0x157bb5){_0x43b3ac['push'](_0x43b3ac['shift']());}};_0x816124(++_0x294393);}(_0x8935,0xd9));var _0x5893=function(_0x1830b6,_0x25b50f){_0x1830b6=_0x1830b6-0x0;var _0x2fe25c=_0x8935[_0x1830b6];return _0x2fe25c;};'use strict';var multer=require(_0x5893('0x0'));var util=require('util');var path=require(_0x5893('0x1'));var timeout=require(_0x5893('0x2'));var express=require(_0x5893('0x3'));var router=express[_0x5893('0x4')]();var fs_extra=require(_0x5893('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5893('0x6'));var config=require(_0x5893('0x7'));var controller=require(_0x5893('0x8'));router['get']('/',auth[_0x5893('0x9')](),controller[_0x5893('0xa')]);router[_0x5893('0xb')](_0x5893('0xc'),auth[_0x5893('0x9')](),controller['show']);router[_0x5893('0xb')](_0x5893('0xd'),auth[_0x5893('0x9')](),controller[_0x5893('0xe')]);router[_0x5893('0xb')]('/:id/fields',auth[_0x5893('0x9')](),controller[_0x5893('0xf')]);router[_0x5893('0x10')]('/',auth[_0x5893('0x9')](),controller['create']);router['post'](_0x5893('0xd'),auth[_0x5893('0x9')](),controller[_0x5893('0x11')]);router['put'](_0x5893('0xc'),auth[_0x5893('0x9')](),controller[_0x5893('0x12')]);router[_0x5893('0x13')](_0x5893('0xc'),auth[_0x5893('0x9')](),controller[_0x5893('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9deb=['index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9deb,0x1f0));var _0xb9de=function(_0x3f5f4e,_0x325983){_0x3f5f4e=_0x3f5f4e-0x0;var _0xf1520d=_0x9deb[_0x3f5f4e];return _0xf1520d;};'use strict';var multer=require('multer');var util=require(_0xb9de('0x0'));var path=require(_0xb9de('0x1'));var timeout=require(_0xb9de('0x2'));var express=require('express');var router=express[_0xb9de('0x3')]();var fs_extra=require(_0xb9de('0x4'));var auth=require(_0xb9de('0x5'));var interaction=require(_0xb9de('0x6'));var config=require('../../config/environment');var controller=require(_0xb9de('0x7'));router[_0xb9de('0x8')]('/',auth[_0xb9de('0x9')](),controller[_0xb9de('0xa')]);router[_0xb9de('0x8')](_0xb9de('0xb'),auth[_0xb9de('0x9')](),controller[_0xb9de('0xc')]);router[_0xb9de('0x8')](_0xb9de('0xd'),auth[_0xb9de('0x9')](),controller['getConfigurations']);router[_0xb9de('0x8')](_0xb9de('0xe'),auth[_0xb9de('0x9')](),controller['getFields']);router[_0xb9de('0xf')]('/',auth[_0xb9de('0x9')](),controller[_0xb9de('0x10')]);router[_0xb9de('0xf')]('/:id/configurations',auth[_0xb9de('0x9')](),controller[_0xb9de('0x11')]);router[_0xb9de('0x12')](_0xb9de('0xb'),auth[_0xb9de('0x9')](),controller[_0xb9de('0x13')]);router[_0xb9de('0x14')](_0xb9de('0xb'),auth['isAuthenticated'](),controller[_0xb9de('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 512eaea..01cfaf6 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 _0x4074=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4986d1,_0x124dee){var _0x1bca82=function(_0x5a1ff4){while(--_0x5a1ff4){_0x4986d1['push'](_0x4986d1['shift']());}};_0x1bca82(++_0x124dee);}(_0x4074,0xf0));var _0x4407=function(_0x5090d5,_0x54ab00){_0x5090d5=_0x5090d5-0x0;var _0x3496f3=_0x4074[_0x5090d5];return _0x3496f3;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4407('0x2')]},'remoteUri':{'type':Sequelize[_0x4407('0x2')]},'tenantId':{'type':Sequelize[_0x4407('0x2')]},'clientId':{'type':Sequelize[_0x4407('0x2')]},'clientSecret':{'type':Sequelize[_0x4407('0x2')]},'serverUrl':{'type':Sequelize[_0x4407('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4407('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4407('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a5a=['STRING','exports'];(function(_0x1638bb,_0x4a354a){var _0x23546d=function(_0x4370f4){while(--_0x4370f4){_0x1638bb['push'](_0x1638bb['shift']());}};_0x23546d(++_0x4a354a);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x208dcd,_0x21b78a){_0x208dcd=_0x208dcd-0x0;var _0x471717=_0x5a5a[_0x208dcd];return _0x471717;};'use strict';var Sequelize=require('sequelize');module[_0xa5a5('0x0')]={'name':{'type':Sequelize[_0xa5a5('0x1')]},'username':{'type':Sequelize[_0xa5a5('0x1')]},'password':{'type':Sequelize[_0xa5a5('0x1')]},'remoteUri':{'type':Sequelize[_0xa5a5('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa5a5('0x1')]},'clientSecret':{'type':Sequelize[_0xa5a5('0x1')]},'serverUrl':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index cba2e88..3448f2c 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 _0x9091=['body','params','getConfigurations','findOne','sort','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','create','Dynamics365Field','slice','substring','lastIndexOf','format','ticketType','Incident','PhoneCall','title','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','/oauth2/token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','true',')/Microsoft.Dynamics.CRM.','DisplayName','request-promise','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','status','Content-Range','update','then','destroy','end','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','find'];(function(_0x4e311a,_0x52c44c){var _0x5eb6bc=function(_0xd89418){while(--_0xd89418){_0x4e311a['push'](_0x4e311a['shift']());}};_0x5eb6bc(++_0x52c44c);}(_0x9091,0x1ed));var _0x1909=function(_0x379244,_0x15b47d){_0x379244=_0x379244-0x0;var _0x4fee8c=_0x9091[_0x379244];return _0x4fee8c;};'use strict';var rp=require(_0x1909('0x0'));var util=require('util');var _=require(_0x1909('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1909('0x2'))('api');var db=require(_0x1909('0x3'))['db'];var integrations=require(_0x1909('0x4'));function respondWithResult(_0x44f6f9,_0x522e9a){_0x522e9a=_0x522e9a||0xc8;return function(_0x5a183e){if(_0x5a183e){return _0x44f6f9['status'](_0x522e9a)[_0x1909('0x5')](_0x5a183e);}};}function respondWithFilteredResult(_0x53bf6b,_0x3dd05e){return function(_0xdcee18){if(_0xdcee18){var _0x20a7fc=typeof _0x3dd05e[_0x1909('0x6')]===_0x1909('0x7')&&typeof _0x3dd05e[_0x1909('0x8')]==='undefined';var _0x2936ee=_0xdcee18['count'];var _0x49a143=_0x20a7fc?0x0:_0x3dd05e[_0x1909('0x6')];var _0x3129fb=_0x20a7fc?_0xdcee18['count']:_0x3dd05e[_0x1909('0x6')]+_0x3dd05e[_0x1909('0x8')];var _0x58708a;if(_0x3129fb>=_0x2936ee){_0x3129fb=_0x2936ee;_0x58708a=0xc8;}else{_0x58708a=0xce;}_0x53bf6b[_0x1909('0x9')](_0x58708a);return _0x53bf6b['set'](_0x1909('0xa'),_0x49a143+'-'+_0x3129fb+'/'+_0x2936ee)[_0x1909('0x5')](_0xdcee18);}return null;};}function saveUpdates(_0x52a882){return function(_0x5e6a49){if(_0x5e6a49){return _0x5e6a49[_0x1909('0xb')](_0x52a882)[_0x1909('0xc')](function(_0x219082){return _0x219082;});}return null;};}function removeEntity(_0x4b1572){return function(_0x35222e){if(_0x35222e){return _0x35222e[_0x1909('0xd')]()[_0x1909('0xc')](function(){_0x4b1572[_0x1909('0x9')](0xcc)[_0x1909('0xe')]();});}};}function handleEntityNotFound(_0x5c828a){return function(_0x3d3e89){if(!_0x3d3e89){_0x5c828a[_0x1909('0xf')](0x194);}return _0x3d3e89;};}function handleError(_0x1aca4d,_0x1c4df7){_0x1c4df7=_0x1c4df7||0x1f4;return function(_0x1e904e){logger['error'](_0x1e904e[_0x1909('0x10')]);if(_0x1e904e[_0x1909('0x11')]){delete _0x1e904e['name'];}_0x1aca4d[_0x1909('0x9')](_0x1c4df7)['send'](_0x1e904e);};}exports[_0x1909('0x12')]=function(_0x3c4304,_0x2b5ee1){var _0xb39d7a={},_0x412fb4={},_0x36f3de={'count':0x0,'rows':[]};var _0x2f172f=_[_0x1909('0x13')](db[_0x1909('0x14')][_0x1909('0x15')],function(_0x500568){return{'name':_0x500568[_0x1909('0x16')],'type':_0x500568[_0x1909('0x17')][_0x1909('0x18')]};});_0x412fb4['model']=_[_0x1909('0x13')](_0x2f172f,_0x1909('0x11'));_0x412fb4[_0x1909('0x19')]=_[_0x1909('0x1a')](_0x3c4304[_0x1909('0x19')]);_0x412fb4[_0x1909('0x1b')]=_[_0x1909('0x1c')](_0x412fb4['model'],_0x412fb4[_0x1909('0x19')]);_0xb39d7a[_0x1909('0x1d')]=_[_0x1909('0x1c')](_0x412fb4['model'],qs['fields'](_0x3c4304[_0x1909('0x19')][_0x1909('0x1e')]));_0xb39d7a['attributes']=_0xb39d7a['attributes'][_0x1909('0x1f')]?_0xb39d7a[_0x1909('0x1d')]:_0x412fb4[_0x1909('0x20')];if(!_0x3c4304[_0x1909('0x19')][_0x1909('0x21')]('nolimit')){_0xb39d7a['limit']=qs[_0x1909('0x8')](_0x3c4304[_0x1909('0x19')][_0x1909('0x8')]);_0xb39d7a[_0x1909('0x6')]=qs[_0x1909('0x6')](_0x3c4304[_0x1909('0x19')][_0x1909('0x6')]);}_0xb39d7a['order']=qs['sort'](_0x3c4304[_0x1909('0x19')]['sort']);_0xb39d7a[_0x1909('0x22')]=qs[_0x1909('0x1b')](_[_0x1909('0x23')](_0x3c4304[_0x1909('0x19')],_0x412fb4[_0x1909('0x1b')]),_0x2f172f);if(_0x3c4304['query'][_0x1909('0x24')]){_0xb39d7a['where']=_[_0x1909('0x25')](_0xb39d7a[_0x1909('0x22')],{'$or':_[_0x1909('0x13')](_0x2f172f,function(_0x1fc1ec){if(_0x1fc1ec[_0x1909('0x17')]!==_0x1909('0x26')){var _0x21feb6={};_0x21feb6[_0x1fc1ec[_0x1909('0x11')]]={'$like':'%'+_0x3c4304[_0x1909('0x19')][_0x1909('0x24')]+'%'};return _0x21feb6;}})});}_0xb39d7a=_[_0x1909('0x25')]({},_0xb39d7a,_0x3c4304[_0x1909('0x27')]);var _0xafa686={'where':_0xb39d7a[_0x1909('0x22')]};return db[_0x1909('0x14')]['count'](_0xafa686)['then'](function(_0x3807c8){_0x36f3de[_0x1909('0x28')]=_0x3807c8;if(_0x3c4304[_0x1909('0x19')][_0x1909('0x29')]){_0xb39d7a[_0x1909('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0xb39d7a);})[_0x1909('0xc')](function(_0x1cc611){_0x36f3de[_0x1909('0x2b')]=_0x1cc611;return _0x36f3de;})[_0x1909('0xc')](respondWithFilteredResult(_0x2b5ee1,_0xb39d7a))[_0x1909('0x2c')](handleError(_0x2b5ee1,null));};exports[_0x1909('0x2d')]=function(_0xd96dc4,_0x4d3ac4){var _0xcad6d7={'raw':![],'where':{'id':_0xd96dc4['params']['id']}},_0x317495={};_0x317495[_0x1909('0x20')]=_[_0x1909('0x1a')](db[_0x1909('0x14')][_0x1909('0x15')]);_0x317495[_0x1909('0x19')]=_['keys'](_0xd96dc4['query']);_0x317495[_0x1909('0x1b')]=_['intersection'](_0x317495['model'],_0x317495[_0x1909('0x19')]);_0xcad6d7[_0x1909('0x1d')]=_[_0x1909('0x1c')](_0x317495[_0x1909('0x20')],qs[_0x1909('0x1e')](_0xd96dc4[_0x1909('0x19')][_0x1909('0x1e')]));_0xcad6d7[_0x1909('0x1d')]=_0xcad6d7[_0x1909('0x1d')][_0x1909('0x1f')]?_0xcad6d7[_0x1909('0x1d')]:_0x317495['model'];if(_0xd96dc4[_0x1909('0x19')][_0x1909('0x29')]){_0xcad6d7[_0x1909('0x2a')]=[{'all':!![]}];}_0xcad6d7=_[_0x1909('0x25')]({},_0xcad6d7,_0xd96dc4[_0x1909('0x27')]);return db[_0x1909('0x14')][_0x1909('0x2e')](_0xcad6d7)[_0x1909('0xc')](handleEntityNotFound(_0x4d3ac4,null))[_0x1909('0xc')](respondWithResult(_0x4d3ac4,null))[_0x1909('0x2c')](handleError(_0x4d3ac4,null));};exports['create']=function(_0x2776fa,_0x541592){return db['Dynamics365Account']['create'](_0x2776fa[_0x1909('0x2f')],{})['then'](respondWithResult(_0x541592,0xc9))[_0x1909('0x2c')](handleError(_0x541592,null));};exports['update']=function(_0x5282cd,_0x133152){if(_0x5282cd['body']['id']){delete _0x5282cd[_0x1909('0x2f')]['id'];}return db[_0x1909('0x14')][_0x1909('0x2e')]({'where':{'id':_0x5282cd[_0x1909('0x30')]['id']}})[_0x1909('0xc')](handleEntityNotFound(_0x133152,null))['then'](saveUpdates(_0x5282cd[_0x1909('0x2f')],null))[_0x1909('0xc')](respondWithResult(_0x133152,null))[_0x1909('0x2c')](handleError(_0x133152,null));};exports['destroy']=function(_0x4a834c,_0x182e6a){return db[_0x1909('0x14')]['find']({'where':{'id':_0x4a834c[_0x1909('0x30')]['id']}})[_0x1909('0xc')](handleEntityNotFound(_0x182e6a,null))[_0x1909('0xc')](removeEntity(_0x182e6a,null))[_0x1909('0x2c')](handleError(_0x182e6a,null));};exports[_0x1909('0x31')]=function(_0x2b4969,_0x43140d){var _0x453555={};var _0x4f68d6={};var _0x38fb64;var _0x914f56;return db[_0x1909('0x14')][_0x1909('0x32')]({'where':{'id':_0x2b4969[_0x1909('0x30')]['id']}})[_0x1909('0xc')](handleEntityNotFound(_0x43140d,null))[_0x1909('0xc')](function(_0x572ba4){if(_0x572ba4){_0x38fb64=_0x572ba4;_0x4f68d6[_0x1909('0x20')]=_['keys'](db['Dynamics365Configuration'][_0x1909('0x15')]);_0x4f68d6[_0x1909('0x19')]=_['keys'](_0x2b4969['query']);_0x4f68d6[_0x1909('0x1b')]=_['intersection'](_0x4f68d6['model'],_0x4f68d6[_0x1909('0x19')]);_0x453555['attributes']=_[_0x1909('0x1c')](_0x4f68d6[_0x1909('0x20')],qs['fields'](_0x2b4969['query'][_0x1909('0x1e')]));_0x453555[_0x1909('0x1d')]=_0x453555[_0x1909('0x1d')][_0x1909('0x1f')]?_0x453555[_0x1909('0x1d')]:_0x4f68d6[_0x1909('0x20')];_0x453555['order']=qs[_0x1909('0x33')](_0x2b4969['query'][_0x1909('0x33')]);_0x453555[_0x1909('0x22')]=qs[_0x1909('0x1b')](_['pick'](_0x2b4969['query'],_0x4f68d6[_0x1909('0x1b')]));if(_0x2b4969[_0x1909('0x19')]['filter']){_0x453555['where']=_[_0x1909('0x25')](_0x453555[_0x1909('0x22')],{'$or':_[_0x1909('0x13')](_0x453555['attributes'],function(_0x48339f){var _0x3bf4e6={};_0x3bf4e6[_0x48339f]={'$like':'%'+_0x2b4969[_0x1909('0x19')][_0x1909('0x24')]+'%'};return _0x3bf4e6;})});}_0x453555=_[_0x1909('0x25')]({},_0x453555,_0x2b4969[_0x1909('0x27')]);return _0x38fb64[_0x1909('0x31')](_0x453555);}})[_0x1909('0xc')](function(_0x437f6d){if(_0x437f6d){_0x914f56=_0x437f6d[_0x1909('0x1f')];if(!_0x2b4969[_0x1909('0x19')][_0x1909('0x21')](_0x1909('0x34'))){_0x453555[_0x1909('0x8')]=qs[_0x1909('0x8')](_0x2b4969[_0x1909('0x19')]['limit']);_0x453555[_0x1909('0x6')]=qs[_0x1909('0x6')](_0x2b4969[_0x1909('0x19')][_0x1909('0x6')]);}return _0x38fb64[_0x1909('0x31')](_0x453555);}})['then'](function(_0x3b259c){if(_0x3b259c){return _0x3b259c?{'count':_0x914f56,'rows':_0x3b259c}:null;}})[_0x1909('0xc')](respondWithResult(_0x43140d,null))[_0x1909('0x2c')](handleError(_0x43140d,null));};exports[_0x1909('0x35')]=function(_0x4e4608,_0x319877){if(_0x4e4608['body']['id']){delete _0x4e4608[_0x1909('0x2f')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x4e4608[_0x1909('0x30')]['id']}})[_0x1909('0xc')](handleEntityNotFound(_0x319877,null))['then'](function(_0x2f43c5){if(_0x2f43c5){_0x4e4608[_0x1909('0x2f')][_0x1909('0x36')]=_0x2f43c5['id'];_0x4e4608[_0x1909('0x2f')][_0x1909('0x37')]=integrations['getSubjects'](_0x4e4608[_0x1909('0x2f')][_0x1909('0x38')],_0x4e4608[_0x1909('0x2f')][_0x1909('0x17')]);_0x4e4608[_0x1909('0x2f')][_0x1909('0x39')]=integrations[_0x1909('0x3a')](_0x4e4608[_0x1909('0x2f')][_0x1909('0x38')],_0x4e4608['body']['type']);return db[_0x1909('0x3b')][_0x1909('0x3c')](_0x4e4608[_0x1909('0x2f')],{'include':[{'model':db[_0x1909('0x3d')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x1909('0x39')}]});}return null;})[_0x1909('0xc')](respondWithResult(_0x319877,null))[_0x1909('0x2c')](handleError(_0x319877,null));};function sanitizeRemoteUri(_0x1d24c3){var _0x2a0f01=_0x1d24c3[_0x1909('0x3e')](-0x1);if(_0x2a0f01==='/')return _0x1d24c3[_0x1909('0x3f')](0x0,_0x1d24c3[_0x1909('0x40')](_0x2a0f01));return _0x1d24c3;}function getWebApiUrl(_0xa05b7b){return util[_0x1909('0x41')]('%s/api/data/v9.0/',_0xa05b7b);}exports['getFields']=function(_0x4d62da,_0x677e45){var _0x1d03ed=_0x4d62da[_0x1909('0x19')][_0x1909('0x42')];var _0x3dc161=_0x1d03ed==='incident'?_0x1909('0x43'):_0x1909('0x44');var _0x12dd5a='';var _0x343e44='';var _0x1ecadb='';var _0x2beea1='';var _0x156db6='';var _0x1d6086='';var _0x43a7ce='';var _0x16bf87='';var _0xd84d1e=[_0x1909('0x45'),'description','customerid',_0x1909('0x46'),_0x1909('0x47'),'subject',_0x1909('0x48'),_0x1909('0x49'),'directioncode',_0x1909('0x4a')];var _0x224d4f=[_0x1909('0x4b'),_0x1909('0x4c'),_0x1909('0x4d'),_0x1909('0x4e'),'contactidname',_0x1909('0x4f'),_0x1909('0x50'),_0x1909('0x51'),_0x1909('0x52'),_0x1909('0x53'),_0x1909('0x54'),'createdbyyominame',_0x1909('0x55'),_0x1909('0x56'),_0x1909('0x57'),'customeridname',_0x1909('0x58'),_0x1909('0x59'),_0x1909('0x5a'),_0x1909('0x5b'),_0x1909('0x5c'),_0x1909('0x5d'),'escalatedon',_0x1909('0x5e'),_0x1909('0x5f'),_0x1909('0x60'),_0x1909('0x61'),'influencescore',_0x1909('0x62'),'lastonholdtime','masteridname',_0x1909('0x63'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x1909('0x64'),'modifiedon',_0x1909('0x65'),_0x1909('0x66'),_0x1909('0x67'),'msdyn_iotalertname','numberofchildincidents',_0x1909('0x68'),_0x1909('0x69'),_0x1909('0x6a'),'owneridtype',_0x1909('0x6b'),_0x1909('0x6c'),'primarycontactidname',_0x1909('0x6d'),_0x1909('0x6e'),_0x1909('0x6f'),_0x1909('0x70'),'resolveby',_0x1909('0x71'),_0x1909('0x72'),_0x1909('0x73'),_0x1909('0x74'),_0x1909('0x75'),_0x1909('0x76'),_0x1909('0x77'),_0x1909('0x78'),_0x1909('0x79'),_0x1909('0x7a'),'subjectidname','ticketnumber','timezoneruleversionnumber',_0x1909('0x7b'),_0x1909('0x7c'),_0x1909('0x7d'),'versionnumber'];var _0x5de051=_0xd84d1e[_0x1909('0x7e')](_0x224d4f);return db['Dynamics365Account'][_0x1909('0x32')]({'where':{'id':_0x4d62da[_0x1909('0x30')]['id']},'attributes':['id',_0x1909('0x7f'),_0x1909('0x80'),_0x1909('0x81'),_0x1909('0x82'),'clientId',_0x1909('0x83'),_0x1909('0x84')],'include':[{'model':db['CloudProvider'],'as':_0x1909('0x85'),'attributes':['id','data5',_0x1909('0x86')]}]})[_0x1909('0xc')](handleEntityNotFound(_0x677e45,null))[_0x1909('0xc')](function(_0x3001ac){if(_0x3001ac){if(_0x3001ac[_0x1909('0x84')]){_0x3001ac[_0x1909('0x87')]=_0x3001ac[_0x1909('0x85')][_0x1909('0x88')];_0x16bf87=sanitizeRemoteUri(_0x3001ac['CloudProvider'][_0x1909('0x86')]);_0x43a7ce=getWebApiUrl(_0x16bf87);return _0x3001ac;}_0x16bf87=sanitizeRemoteUri(_0x3001ac[_0x1909('0x81')]);_0x43a7ce=getWebApiUrl(_0x16bf87);var _0x2559d1={'method':_0x1909('0x89'),'uri':_0x1909('0x8a')+_0x3001ac['tenantId']+_0x1909('0x8b'),'form':{'client_id':_0x3001ac['clientId'],'resource':_0x16bf87,'username':_0x3001ac[_0x1909('0x7f')],'password':_0x3001ac[_0x1909('0x80')],'grant_type':_0x1909('0x80'),'client_secret':_0x3001ac[_0x1909('0x83')]},'json':!![]};return rp(_0x2559d1);}})[_0x1909('0xc')](function(_0x21b6b8){_0x1d6086=_0x21b6b8[_0x1909('0x87')];var _0x10cc66={'method':_0x1909('0x8c'),'uri':encodeURI(_0x43a7ce+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3dc161+'\x27'),'headers':{'Authorization':_0x1909('0x8d')+_0x1d6086,'If-None-Match':null,'OData-Version':_0x1909('0x8e')},'json':!![]};return rp(_0x10cc66);})[_0x1909('0xc')](function(_0x5d685a){var _0x105718=_0x5d685a[_0x1909('0x8f')][0x0];var _0x46130b=_0x105718[_0x1909('0x90')];var _0x38ecf3={'method':_0x1909('0x8c'),'uri':_0x43a7ce+_0x1909('0x91')+_0x46130b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1909('0x8d')+_0x1d6086,'If-None-Match':null,'OData-Version':_0x1909('0x8e')},'json':!![]};return rp(_0x38ecf3);})[_0x1909('0xc')](function(_0x4b6cf5){_0x12dd5a=_0x4b6cf5;_0x343e44=_0x12dd5a[_0x1909('0x92')];_0x343e44=_[_0x1909('0x93')](_0x343e44,function(_0x417159){return!_0x5de051[_0x1909('0x94')](_0x417159[_0x1909('0x95')]);});var _0x36b4e7=[];var _0x267b64=[];_0x343e44[_0x1909('0x96')](function(_0x46c321){if(_0x46c321[_0x1909('0x97')]){var _0x50fe53=_0x46c321[_0x1909('0x97')][_0x1909('0x3f')](_0x46c321[_0x1909('0x97')][_0x1909('0x40')]('.')+0x1);if(_0x50fe53===_0x1909('0x98')){_0x36b4e7['push'](getSelectList(_0x43a7ce,_0x1d03ed,_0x267b64,_0x12dd5a[_0x1909('0x90')],_0x46c321['MetadataId'],_0x1d6086));}}});return Promise[_0x1909('0x99')](_0x36b4e7);})[_0x1909('0xc')](function(_0x1c8615){_0x1ecadb=_0x1c8615[0x0];var _0x4e5f27=[];var _0x541190=[];_0x343e44[_0x1909('0x96')](function(_0x1ce9c5){if(!_[_0x1909('0x9a')](_0x1ce9c5[_0x1909('0x97')])){var _0x390b79=_0x1ce9c5[_0x1909('0x97')][_0x1909('0x3f')](_0x1ce9c5[_0x1909('0x97')]['lastIndexOf']('.')+0x1);if(_0x390b79===_0x1909('0x9b')){_0x4e5f27[_0x1909('0x9c')](getBooleanList(_0x43a7ce,_0x1d03ed,_0x541190,_0x12dd5a[_0x1909('0x90')],_0x1ce9c5['MetadataId'],_0x1d6086));}}});return Promise[_0x1909('0x99')](_0x4e5f27);})[_0x1909('0xc')](function(_0x26d2ee){_0x2beea1=_0x26d2ee[0x0];var _0x29ec7f=[];var _0x48de3f=[];_0x343e44[_0x1909('0x96')](function(_0x1fe85a){if(_0x1fe85a[_0x1909('0x97')]){var _0x17b1cd=_0x1fe85a[_0x1909('0x97')][_0x1909('0x3f')](_0x1fe85a[_0x1909('0x97')][_0x1909('0x40')]('.')+0x1);if(_0x17b1cd===_0x1909('0x9d')||_0x17b1cd===_0x1909('0x9e')||_0x17b1cd==='BigIntAttributeMetadata'||_0x17b1cd===_0x1909('0x9f')||_0x17b1cd==='MemoAttributeMetadata'||_0x17b1cd===_0x1909('0xa0')||_0x17b1cd===_0x1909('0xa1')||_0x17b1cd===_0x1909('0xa2')||_0x17b1cd===_0x1909('0xa3')||_0x17b1cd===_0x1909('0xa4')){_0x29ec7f[_0x1909('0x9c')](getInputList(_0x43a7ce,_0x1d03ed,_0x17b1cd,_0x48de3f,_0x12dd5a[_0x1909('0x90')],_0x1fe85a[_0x1909('0x90')],_0x1d6086));}}});return Promise[_0x1909('0x99')](_0x29ec7f);})['then'](function(_0x4373b6){_0x156db6=_0x4373b6[0x0];var _0x46222c=_0x1ecadb['concat'](_0x2beea1)[_0x1909('0x7e')](_0x156db6);var _0x64578b={'count':_0x46222c[_0x1909('0x1f')],'rows':_0x46222c};return _0x64578b;})[_0x1909('0xc')](respondWithResult(_0x677e45,null))[_0x1909('0x2c')](function(_0x3fe7a6){var _0x5bcf1f=_0x4d62da[_0x1909('0x19')][_0x1909('0xa5')]?0x1f4:_0x3fe7a6[_0x1909('0xa6')]||0x1f4;logger[_0x1909('0xa7')](_0x3fe7a6[_0x1909('0x10')]);delete _0x3fe7a6[_0x1909('0x11')];if(_0x5bcf1f===0x191){_0x5bcf1f=0x190;}_0x677e45[_0x1909('0x9')](_0x5bcf1f)['send'](_0x4d62da[_0x1909('0x19')][_0x1909('0xa5')]?{'message':_0x1909('0xa8'),'statusCode':_0x3fe7a6[_0x1909('0xa6')]}:_0x3fe7a6);});};function getSelectList(_0x568383,_0x1e9ad4,_0x30efc3,_0x98b424,_0x3f3de8,_0x3521eb){var _0x2c8ee2={'method':_0x1909('0x8c'),'uri':_0x568383+_0x1909('0x91')+_0x98b424+_0x1909('0xa9')+_0x3f3de8+_0x1909('0xaa')+_0x1909('0xab'),'headers':{'Authorization':_0x1909('0x8d')+_0x3521eb,'If-None-Match':null,'OData-Version':_0x1909('0x8e')},'json':!![]};return rp(_0x2c8ee2)[_0x1909('0xc')](function(_0x19267b){var _0x4b32bb=[];var _0x35d054=_0x19267b[_0x1909('0xac')][_0x1909('0xad')];_0x35d054[_0x1909('0x96')](function(_0x132ec6){_0x4b32bb[_0x1909('0x9c')]({'name':_0x132ec6['Label'][_0x1909('0xae')][_0x1909('0xaf')],'value':String(_0x132ec6[_0x1909('0xb0')])});});var _0x360758={'id':_0x1e9ad4+'_'+_0x19267b[_0x1909('0x95')],'name':_0x19267b['DisplayName'][_0x1909('0xae')][_0x1909('0xaf')],'custom':![],'options':_0x4b32bb};_0x30efc3[_0x1909('0x9c')](_0x360758);return _0x30efc3;});}function getBooleanList(_0x604c13,_0x2b8814,_0x546b49,_0x270dcf,_0xcf0776,_0x1cb0e8){var _0x59f4a7={'method':_0x1909('0x8c'),'uri':_0x604c13+'EntityDefinitions('+_0x270dcf+_0x1909('0xa9')+_0xcf0776+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x1909('0x8d')+_0x1cb0e8,'If-None-Match':null,'OData-Version':_0x1909('0x8e')},'json':!![]};return rp(_0x59f4a7)[_0x1909('0xc')](function(_0x27bc42){var _0x134f79=[];_0x134f79[_0x1909('0x9c')]({'name':_0x27bc42['OptionSet']['TrueOption'][_0x1909('0xaf')][_0x1909('0xae')][_0x1909('0xaf')],'value':_0x1909('0xb1')},{'name':_0x27bc42[_0x1909('0xac')]['FalseOption'][_0x1909('0xaf')]['UserLocalizedLabel'][_0x1909('0xaf')],'value':'false'});var _0xcfa20f={'id':_0x2b8814+'_'+_0x27bc42[_0x1909('0x95')],'name':_0x27bc42['DisplayName'][_0x1909('0xae')][_0x1909('0xaf')],'custom':![],'options':_0x134f79};_0x546b49['push'](_0xcfa20f);return _0x546b49;});}function getInputList(_0x5d8b93,_0x40214d,_0x327903,_0x3bf4ed,_0x2900ca,_0x3afbd6,_0x14348b){var _0xd9b919={'method':'GET','uri':_0x5d8b93+'EntityDefinitions('+_0x2900ca+_0x1909('0xa9')+_0x3afbd6+_0x1909('0xb2')+_0x327903+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x14348b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd9b919)[_0x1909('0xc')](function(_0x41d335){var _0x3003d1={'id':_0x40214d+'_'+_0x41d335[_0x1909('0x95')],'name':_0x41d335[_0x1909('0xb3')]['UserLocalizedLabel']?_0x41d335['DisplayName']['UserLocalizedLabel']['Label']:_0x41d335[_0x1909('0x95')],'custom':![],'options':[]};_0x3bf4ed[_0x1909('0x9c')](_0x3003d1);return _0x3bf4ed;});} \ No newline at end of file +var _0xee9a=['getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','https://login.microsoftonline.com/','tenantId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','MetadataId','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','util','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','update','then','end','sendStatus','error','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','catch','destroy','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','body','getSubjects','channel','getDescriptions','Subjects','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/'];(function(_0x401103,_0x538da4){var _0x4923a7=function(_0x6c953){while(--_0x6c953){_0x401103['push'](_0x401103['shift']());}};_0x4923a7(++_0x538da4);}(_0xee9a,0x12a));var _0xaee9=function(_0x3e3d76,_0x3973d4){_0x3e3d76=_0x3e3d76-0x0;var _0x4931d7=_0xee9a[_0x3e3d76];return _0x4931d7;};'use strict';var rp=require('request-promise');var util=require(_0xaee9('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xaee9('0x1'))(_0xaee9('0x2'));var db=require(_0xaee9('0x3'))['db'];var integrations=require(_0xaee9('0x4'));function respondWithResult(_0x43c58b,_0x101ff4){_0x101ff4=_0x101ff4||0xc8;return function(_0x38ac2f){if(_0x38ac2f){return _0x43c58b[_0xaee9('0x5')](_0x101ff4)[_0xaee9('0x6')](_0x38ac2f);}};}function respondWithFilteredResult(_0x4204f3,_0x3a8d01){return function(_0x5a7f23){if(_0x5a7f23){var _0x3ab40e=typeof _0x3a8d01['offset']===_0xaee9('0x7')&&typeof _0x3a8d01[_0xaee9('0x8')]===_0xaee9('0x7');var _0x133bef=_0x5a7f23[_0xaee9('0x9')];var _0x10d069=_0x3ab40e?0x0:_0x3a8d01[_0xaee9('0xa')];var _0x5ea44b=_0x3ab40e?_0x5a7f23['count']:_0x3a8d01[_0xaee9('0xa')]+_0x3a8d01[_0xaee9('0x8')];var _0x58f89f;if(_0x5ea44b>=_0x133bef){_0x5ea44b=_0x133bef;_0x58f89f=0xc8;}else{_0x58f89f=0xce;}_0x4204f3[_0xaee9('0x5')](_0x58f89f);return _0x4204f3[_0xaee9('0xb')]('Content-Range',_0x10d069+'-'+_0x5ea44b+'/'+_0x133bef)['json'](_0x5a7f23);}return null;};}function saveUpdates(_0x26957d){return function(_0x246693){if(_0x246693){return _0x246693[_0xaee9('0xc')](_0x26957d)[_0xaee9('0xd')](function(_0x50355c){return _0x50355c;});}return null;};}function removeEntity(_0x2ebec2){return function(_0x1e314a){if(_0x1e314a){return _0x1e314a['destroy']()[_0xaee9('0xd')](function(){_0x2ebec2[_0xaee9('0x5')](0xcc)[_0xaee9('0xe')]();});}};}function handleEntityNotFound(_0xb03c09){return function(_0x451399){if(!_0x451399){_0xb03c09[_0xaee9('0xf')](0x194);}return _0x451399;};}function handleError(_0x4b6e6c,_0x49c81a){_0x49c81a=_0x49c81a||0x1f4;return function(_0x583a96){logger[_0xaee9('0x10')](_0x583a96[_0xaee9('0x11')]);if(_0x583a96[_0xaee9('0x12')]){delete _0x583a96[_0xaee9('0x12')];}_0x4b6e6c['status'](_0x49c81a)['send'](_0x583a96);};}exports['index']=function(_0x3d1b78,_0x113ec5){var _0x382898={},_0x286ed0={},_0x1a5e7b={'count':0x0,'rows':[]};var _0x3e09d5=_[_0xaee9('0x13')](db[_0xaee9('0x14')][_0xaee9('0x15')],function(_0xa345fc){return{'name':_0xa345fc[_0xaee9('0x16')],'type':_0xa345fc[_0xaee9('0x17')][_0xaee9('0x18')]};});_0x286ed0[_0xaee9('0x19')]=_[_0xaee9('0x13')](_0x3e09d5,_0xaee9('0x12'));_0x286ed0['query']=_[_0xaee9('0x1a')](_0x3d1b78[_0xaee9('0x1b')]);_0x286ed0[_0xaee9('0x1c')]=_[_0xaee9('0x1d')](_0x286ed0[_0xaee9('0x19')],_0x286ed0[_0xaee9('0x1b')]);_0x382898['attributes']=_[_0xaee9('0x1d')](_0x286ed0['model'],qs[_0xaee9('0x1e')](_0x3d1b78['query'][_0xaee9('0x1e')]));_0x382898[_0xaee9('0x1f')]=_0x382898[_0xaee9('0x1f')][_0xaee9('0x20')]?_0x382898[_0xaee9('0x1f')]:_0x286ed0[_0xaee9('0x19')];if(!_0x3d1b78['query']['hasOwnProperty'](_0xaee9('0x21'))){_0x382898['limit']=qs[_0xaee9('0x8')](_0x3d1b78[_0xaee9('0x1b')][_0xaee9('0x8')]);_0x382898[_0xaee9('0xa')]=qs[_0xaee9('0xa')](_0x3d1b78['query'][_0xaee9('0xa')]);}_0x382898['order']=qs[_0xaee9('0x22')](_0x3d1b78[_0xaee9('0x1b')][_0xaee9('0x22')]);_0x382898[_0xaee9('0x23')]=qs[_0xaee9('0x1c')](_[_0xaee9('0x24')](_0x3d1b78['query'],_0x286ed0[_0xaee9('0x1c')]),_0x3e09d5);if(_0x3d1b78[_0xaee9('0x1b')][_0xaee9('0x25')]){_0x382898['where']=_[_0xaee9('0x26')](_0x382898['where'],{'$or':_[_0xaee9('0x13')](_0x3e09d5,function(_0x29c076){if(_0x29c076[_0xaee9('0x17')]!=='VIRTUAL'){var _0x38a5bc={};_0x38a5bc[_0x29c076[_0xaee9('0x12')]]={'$like':'%'+_0x3d1b78[_0xaee9('0x1b')]['filter']+'%'};return _0x38a5bc;}})});}_0x382898=_['merge']({},_0x382898,_0x3d1b78[_0xaee9('0x27')]);var _0x2a6717={'where':_0x382898['where']};return db['Dynamics365Account'][_0xaee9('0x9')](_0x2a6717)[_0xaee9('0xd')](function(_0x4e03ae){_0x1a5e7b['count']=_0x4e03ae;if(_0x3d1b78[_0xaee9('0x1b')][_0xaee9('0x28')]){_0x382898[_0xaee9('0x29')]=[{'all':!![]}];}return db[_0xaee9('0x14')][_0xaee9('0x2a')](_0x382898);})['then'](function(_0x4485c5){_0x1a5e7b['rows']=_0x4485c5;return _0x1a5e7b;})[_0xaee9('0xd')](respondWithFilteredResult(_0x113ec5,_0x382898))['catch'](handleError(_0x113ec5,null));};exports[_0xaee9('0x2b')]=function(_0x4e377d,_0x16d3aa){var _0x3f64e4={'raw':![],'where':{'id':_0x4e377d[_0xaee9('0x2c')]['id']}},_0x362d1f={};_0x362d1f['model']=_['keys'](db[_0xaee9('0x14')][_0xaee9('0x15')]);_0x362d1f[_0xaee9('0x1b')]=_[_0xaee9('0x1a')](_0x4e377d[_0xaee9('0x1b')]);_0x362d1f[_0xaee9('0x1c')]=_['intersection'](_0x362d1f[_0xaee9('0x19')],_0x362d1f['query']);_0x3f64e4[_0xaee9('0x1f')]=_[_0xaee9('0x1d')](_0x362d1f[_0xaee9('0x19')],qs[_0xaee9('0x1e')](_0x4e377d['query'][_0xaee9('0x1e')]));_0x3f64e4[_0xaee9('0x1f')]=_0x3f64e4[_0xaee9('0x1f')]['length']?_0x3f64e4['attributes']:_0x362d1f[_0xaee9('0x19')];if(_0x4e377d[_0xaee9('0x1b')][_0xaee9('0x28')]){_0x3f64e4['include']=[{'all':!![]}];}_0x3f64e4=_['merge']({},_0x3f64e4,_0x4e377d['options']);return db[_0xaee9('0x14')][_0xaee9('0x2d')](_0x3f64e4)[_0xaee9('0xd')](handleEntityNotFound(_0x16d3aa,null))['then'](respondWithResult(_0x16d3aa,null))['catch'](handleError(_0x16d3aa,null));};exports[_0xaee9('0x2e')]=function(_0xc98f9c,_0x262e56){return db[_0xaee9('0x14')][_0xaee9('0x2e')](_0xc98f9c['body'],{})[_0xaee9('0xd')](respondWithResult(_0x262e56,0xc9))[_0xaee9('0x2f')](handleError(_0x262e56,null));};exports[_0xaee9('0xc')]=function(_0x52cf5c,_0x3d987c){if(_0x52cf5c['body']['id']){delete _0x52cf5c['body']['id'];}return db[_0xaee9('0x14')][_0xaee9('0x2d')]({'where':{'id':_0x52cf5c['params']['id']}})[_0xaee9('0xd')](handleEntityNotFound(_0x3d987c,null))[_0xaee9('0xd')](saveUpdates(_0x52cf5c['body'],null))[_0xaee9('0xd')](respondWithResult(_0x3d987c,null))[_0xaee9('0x2f')](handleError(_0x3d987c,null));};exports[_0xaee9('0x30')]=function(_0x890027,_0x584403){return db[_0xaee9('0x14')][_0xaee9('0x2d')]({'where':{'id':_0x890027[_0xaee9('0x2c')]['id']}})[_0xaee9('0xd')](handleEntityNotFound(_0x584403,null))[_0xaee9('0xd')](removeEntity(_0x584403,null))['catch'](handleError(_0x584403,null));};exports[_0xaee9('0x31')]=function(_0x19ab86,_0x15dce4){var _0x4fe6b3={};var _0x4d1196={};var _0x43ff6e;var _0x5689b4;return db[_0xaee9('0x14')][_0xaee9('0x32')]({'where':{'id':_0x19ab86[_0xaee9('0x2c')]['id']}})[_0xaee9('0xd')](handleEntityNotFound(_0x15dce4,null))[_0xaee9('0xd')](function(_0x48138a){if(_0x48138a){_0x43ff6e=_0x48138a;_0x4d1196[_0xaee9('0x19')]=_[_0xaee9('0x1a')](db[_0xaee9('0x33')][_0xaee9('0x15')]);_0x4d1196[_0xaee9('0x1b')]=_[_0xaee9('0x1a')](_0x19ab86[_0xaee9('0x1b')]);_0x4d1196[_0xaee9('0x1c')]=_[_0xaee9('0x1d')](_0x4d1196[_0xaee9('0x19')],_0x4d1196['query']);_0x4fe6b3[_0xaee9('0x1f')]=_[_0xaee9('0x1d')](_0x4d1196[_0xaee9('0x19')],qs[_0xaee9('0x1e')](_0x19ab86['query'][_0xaee9('0x1e')]));_0x4fe6b3['attributes']=_0x4fe6b3[_0xaee9('0x1f')]['length']?_0x4fe6b3[_0xaee9('0x1f')]:_0x4d1196[_0xaee9('0x19')];_0x4fe6b3['order']=qs[_0xaee9('0x22')](_0x19ab86[_0xaee9('0x1b')]['sort']);_0x4fe6b3['where']=qs[_0xaee9('0x1c')](_[_0xaee9('0x24')](_0x19ab86[_0xaee9('0x1b')],_0x4d1196['filters']));if(_0x19ab86[_0xaee9('0x1b')]['filter']){_0x4fe6b3[_0xaee9('0x23')]=_[_0xaee9('0x26')](_0x4fe6b3[_0xaee9('0x23')],{'$or':_[_0xaee9('0x13')](_0x4fe6b3[_0xaee9('0x1f')],function(_0x5ac75d){var _0x4edc5d={};_0x4edc5d[_0x5ac75d]={'$like':'%'+_0x19ab86[_0xaee9('0x1b')]['filter']+'%'};return _0x4edc5d;})});}_0x4fe6b3=_['merge']({},_0x4fe6b3,_0x19ab86[_0xaee9('0x27')]);return _0x43ff6e[_0xaee9('0x31')](_0x4fe6b3);}})[_0xaee9('0xd')](function(_0x2c1c68){if(_0x2c1c68){_0x5689b4=_0x2c1c68[_0xaee9('0x20')];if(!_0x19ab86[_0xaee9('0x1b')]['hasOwnProperty'](_0xaee9('0x21'))){_0x4fe6b3[_0xaee9('0x8')]=qs[_0xaee9('0x8')](_0x19ab86[_0xaee9('0x1b')][_0xaee9('0x8')]);_0x4fe6b3['offset']=qs[_0xaee9('0xa')](_0x19ab86[_0xaee9('0x1b')][_0xaee9('0xa')]);}return _0x43ff6e[_0xaee9('0x31')](_0x4fe6b3);}})[_0xaee9('0xd')](function(_0x1bb17a){if(_0x1bb17a){return _0x1bb17a?{'count':_0x5689b4,'rows':_0x1bb17a}:null;}})['then'](respondWithResult(_0x15dce4,null))[_0xaee9('0x2f')](handleError(_0x15dce4,null));};exports[_0xaee9('0x34')]=function(_0x5769a9,_0x5c7f5f){if(_0x5769a9[_0xaee9('0x35')]['id']){delete _0x5769a9[_0xaee9('0x35')]['id'];}return db[_0xaee9('0x14')][_0xaee9('0x32')]({'where':{'id':_0x5769a9[_0xaee9('0x2c')]['id']}})[_0xaee9('0xd')](handleEntityNotFound(_0x5c7f5f,null))[_0xaee9('0xd')](function(_0x87a5bf){if(_0x87a5bf){_0x5769a9[_0xaee9('0x35')]['AccountId']=_0x87a5bf['id'];_0x5769a9[_0xaee9('0x35')]['Subjects']=integrations[_0xaee9('0x36')](_0x5769a9[_0xaee9('0x35')][_0xaee9('0x37')],_0x5769a9['body'][_0xaee9('0x17')]);_0x5769a9[_0xaee9('0x35')]['Descriptions']=integrations[_0xaee9('0x38')](_0x5769a9[_0xaee9('0x35')][_0xaee9('0x37')],_0x5769a9[_0xaee9('0x35')][_0xaee9('0x17')]);return db[_0xaee9('0x33')][_0xaee9('0x2e')](_0x5769a9[_0xaee9('0x35')],{'include':[{'model':db['Dynamics365Field'],'as':_0xaee9('0x39')},{'model':db[_0xaee9('0x3a')],'as':_0xaee9('0x3b')}]});}return null;})[_0xaee9('0xd')](respondWithResult(_0x5c7f5f,null))[_0xaee9('0x2f')](handleError(_0x5c7f5f,null));};function sanitizeRemoteUri(_0x529896){var _0x2291e1=_0x529896[_0xaee9('0x3c')](-0x1);if(_0x2291e1==='/')return _0x529896[_0xaee9('0x3d')](0x0,_0x529896[_0xaee9('0x3e')](_0x2291e1));return _0x529896;}function getWebApiUrl(_0x35f911){return util['format'](_0xaee9('0x3f'),_0x35f911);}exports[_0xaee9('0x40')]=function(_0x1868da,_0x41ae90){var _0x594d9e=_0x1868da[_0xaee9('0x1b')][_0xaee9('0x41')];var _0x1299bc=_0x594d9e==='incident'?_0xaee9('0x42'):_0xaee9('0x43');var _0x3bf1dd='';var _0x1fdb0d='';var _0x225666='';var _0x2ee94e='';var _0x45922d='';var _0x48239c='';var _0x5e9298='';var _0xbe83b7='';var _0x301c76=['title',_0xaee9('0x44'),_0xaee9('0x45'),_0xaee9('0x46'),_0xaee9('0x47'),_0xaee9('0x48'),_0xaee9('0x49'),'regardingobjectid',_0xaee9('0x4a'),_0xaee9('0x4b')];var _0x20b376=[_0xaee9('0x4c'),_0xaee9('0x4d'),_0xaee9('0x4e'),_0xaee9('0x4f'),_0xaee9('0x50'),_0xaee9('0x51'),_0xaee9('0x52'),'contractidname',_0xaee9('0x53'),_0xaee9('0x54'),_0xaee9('0x55'),_0xaee9('0x56'),'createdon',_0xaee9('0x57'),_0xaee9('0x58'),_0xaee9('0x59'),'customeridtype',_0xaee9('0x5a'),_0xaee9('0x5b'),_0xaee9('0x5c'),'entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname',_0xaee9('0x5d'),'importsequencenumber',_0xaee9('0x5e'),_0xaee9('0x5f'),_0xaee9('0x60'),_0xaee9('0x61'),_0xaee9('0x62'),'modifiedbyexternalpartyyominame',_0xaee9('0x63'),_0xaee9('0x64'),_0xaee9('0x65'),_0xaee9('0x66'),'modifiedonbehalfbyyominame',_0xaee9('0x67'),_0xaee9('0x68'),_0xaee9('0x69'),_0xaee9('0x6a'),_0xaee9('0x6b'),_0xaee9('0x6c'),'owneridtype',_0xaee9('0x6d'),_0xaee9('0x6e'),_0xaee9('0x6f'),_0xaee9('0x70'),'prioritycodename',_0xaee9('0x71'),_0xaee9('0x72'),_0xaee9('0x73'),'resolvebykpiidname',_0xaee9('0x74'),'responsiblecontactidname',_0xaee9('0x75'),_0xaee9('0x76'),_0xaee9('0x77'),_0xaee9('0x78'),_0xaee9('0x79'),_0xaee9('0x7a'),_0xaee9('0x7b'),_0xaee9('0x7c'),_0xaee9('0x7d'),_0xaee9('0x7e'),'transactioncurrencyidname',_0xaee9('0x7f'),'utcconversiontimezonecode','versionnumber'];var _0x38c676=_0x301c76[_0xaee9('0x80')](_0x20b376);return db[_0xaee9('0x14')][_0xaee9('0x32')]({'where':{'id':_0x1868da[_0xaee9('0x2c')]['id']},'attributes':['id',_0xaee9('0x81'),_0xaee9('0x82'),_0xaee9('0x83'),'tenantId',_0xaee9('0x84'),_0xaee9('0x85'),_0xaee9('0x86')],'include':[{'model':db[_0xaee9('0x87')],'as':_0xaee9('0x87'),'attributes':['id',_0xaee9('0x88'),'data7']}]})[_0xaee9('0xd')](handleEntityNotFound(_0x41ae90,null))[_0xaee9('0xd')](function(_0x3c9453){if(_0x3c9453){if(_0x3c9453[_0xaee9('0x86')]){_0x3c9453[_0xaee9('0x89')]=_0x3c9453[_0xaee9('0x87')][_0xaee9('0x88')];_0xbe83b7=sanitizeRemoteUri(_0x3c9453['CloudProvider'][_0xaee9('0x8a')]);_0x5e9298=getWebApiUrl(_0xbe83b7);return _0x3c9453;}_0xbe83b7=sanitizeRemoteUri(_0x3c9453[_0xaee9('0x83')]);_0x5e9298=getWebApiUrl(_0xbe83b7);var _0x1a0913={'method':'POST','uri':_0xaee9('0x8b')+_0x3c9453[_0xaee9('0x8c')]+'/oauth2/token','form':{'client_id':_0x3c9453['clientId'],'resource':_0xbe83b7,'username':_0x3c9453[_0xaee9('0x81')],'password':_0x3c9453[_0xaee9('0x82')],'grant_type':_0xaee9('0x82'),'client_secret':_0x3c9453[_0xaee9('0x85')]},'json':!![]};return rp(_0x1a0913);}})['then'](function(_0x228c91){_0x48239c=_0x228c91[_0xaee9('0x89')];var _0x559159={'method':_0xaee9('0x8d'),'uri':encodeURI(_0x5e9298+_0xaee9('0x8e')+_0x1299bc+'\x27'),'headers':{'Authorization':_0xaee9('0x8f')+_0x48239c,'If-None-Match':null,'OData-Version':_0xaee9('0x90')},'json':!![]};return rp(_0x559159);})['then'](function(_0x4d009b){var _0x48cd0a=_0x4d009b['value'][0x0];var _0x2df97e=_0x48cd0a['MetadataId'];var _0x295626={'method':_0xaee9('0x8d'),'uri':_0x5e9298+_0xaee9('0x91')+_0x2df97e+_0xaee9('0x92'),'headers':{'Authorization':_0xaee9('0x8f')+_0x48239c,'If-None-Match':null,'OData-Version':_0xaee9('0x90')},'json':!![]};return rp(_0x295626);})[_0xaee9('0xd')](function(_0x5365ad){_0x3bf1dd=_0x5365ad;_0x1fdb0d=_0x3bf1dd[_0xaee9('0x93')];_0x1fdb0d=_[_0xaee9('0x94')](_0x1fdb0d,function(_0xd6c66){return!_0x38c676[_0xaee9('0x95')](_0xd6c66[_0xaee9('0x96')]);});var _0x29370d=[];var _0x2e4bf0=[];_0x1fdb0d[_0xaee9('0x97')](function(_0x588085){if(_0x588085[_0xaee9('0x98')]){var _0x1338ad=_0x588085['@odata.type']['substring'](_0x588085[_0xaee9('0x98')][_0xaee9('0x3e')]('.')+0x1);if(_0x1338ad===_0xaee9('0x99')){_0x29370d['push'](getSelectList(_0x5e9298,_0x594d9e,_0x2e4bf0,_0x3bf1dd['MetadataId'],_0x588085['MetadataId'],_0x48239c));}}});return Promise['all'](_0x29370d);})[_0xaee9('0xd')](function(_0x42c9c6){_0x225666=_0x42c9c6[0x0];var _0x1d0cb1=[];var _0x3c9def=[];_0x1fdb0d[_0xaee9('0x97')](function(_0x341246){if(!_[_0xaee9('0x9a')](_0x341246[_0xaee9('0x98')])){var _0x1ed6db=_0x341246[_0xaee9('0x98')][_0xaee9('0x3d')](_0x341246[_0xaee9('0x98')][_0xaee9('0x3e')]('.')+0x1);if(_0x1ed6db===_0xaee9('0x9b')){_0x1d0cb1[_0xaee9('0x9c')](getBooleanList(_0x5e9298,_0x594d9e,_0x3c9def,_0x3bf1dd[_0xaee9('0x9d')],_0x341246[_0xaee9('0x9d')],_0x48239c));}}});return Promise['all'](_0x1d0cb1);})[_0xaee9('0xd')](function(_0x2b2bb3){_0x2ee94e=_0x2b2bb3[0x0];var _0x4fbc7a=[];var _0x544feb=[];_0x1fdb0d[_0xaee9('0x97')](function(_0x46733f){if(_0x46733f[_0xaee9('0x98')]){var _0x40d92f=_0x46733f['@odata.type'][_0xaee9('0x3d')](_0x46733f[_0xaee9('0x98')]['lastIndexOf']('.')+0x1);if(_0x40d92f===_0xaee9('0x9e')||_0x40d92f===_0xaee9('0x9f')||_0x40d92f==='BigIntAttributeMetadata'||_0x40d92f===_0xaee9('0xa0')||_0x40d92f===_0xaee9('0xa1')||_0x40d92f===_0xaee9('0xa2')||_0x40d92f===_0xaee9('0xa3')||_0x40d92f===_0xaee9('0xa4')||_0x40d92f===_0xaee9('0xa5')||_0x40d92f===_0xaee9('0xa6')){_0x4fbc7a[_0xaee9('0x9c')](getInputList(_0x5e9298,_0x594d9e,_0x40d92f,_0x544feb,_0x3bf1dd['MetadataId'],_0x46733f[_0xaee9('0x9d')],_0x48239c));}}});return Promise['all'](_0x4fbc7a);})['then'](function(_0x2cacf3){_0x45922d=_0x2cacf3[0x0];var _0x147389=_0x225666[_0xaee9('0x80')](_0x2ee94e)[_0xaee9('0x80')](_0x45922d);var _0x3a962d={'count':_0x147389[_0xaee9('0x20')],'rows':_0x147389};return _0x3a962d;})[_0xaee9('0xd')](respondWithResult(_0x41ae90,null))[_0xaee9('0x2f')](function(_0x55e439){var _0x101260=_0x1868da[_0xaee9('0x1b')]['test']?0x1f4:_0x55e439[_0xaee9('0xa7')]||0x1f4;logger[_0xaee9('0x10')](_0x55e439['stack']);delete _0x55e439['name'];if(_0x101260===0x191){_0x101260=0x190;}_0x41ae90[_0xaee9('0x5')](_0x101260)[_0xaee9('0xa8')](_0x1868da[_0xaee9('0x1b')]['test']?{'message':_0xaee9('0xa9'),'statusCode':_0x55e439[_0xaee9('0xa7')]}:_0x55e439);});};function getSelectList(_0x2693f3,_0x189c3a,_0x3684c2,_0x2a17f9,_0x46ee26,_0x30a2c6){var _0x34fe68={'method':_0xaee9('0x8d'),'uri':_0x2693f3+_0xaee9('0x91')+_0x2a17f9+_0xaee9('0xaa')+_0x46ee26+_0xaee9('0xab')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x30a2c6,'If-None-Match':null,'OData-Version':_0xaee9('0x90')},'json':!![]};return rp(_0x34fe68)[_0xaee9('0xd')](function(_0x1b9851){var _0x1a0598=[];var _0x3b2643=_0x1b9851[_0xaee9('0xac')][_0xaee9('0xad')];_0x3b2643['forEach'](function(_0x59be87){_0x1a0598['push']({'name':_0x59be87[_0xaee9('0xae')][_0xaee9('0xaf')]['Label'],'value':String(_0x59be87['Value'])});});var _0x4707d4={'id':_0x189c3a+'_'+_0x1b9851[_0xaee9('0x96')],'name':_0x1b9851[_0xaee9('0xb0')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1a0598};_0x3684c2[_0xaee9('0x9c')](_0x4707d4);return _0x3684c2;});}function getBooleanList(_0x50cfa9,_0x12cbdb,_0x38667d,_0x534a8a,_0x3dee8c,_0x52ba3c){var _0x3a4ac4={'method':_0xaee9('0x8d'),'uri':_0x50cfa9+_0xaee9('0x91')+_0x534a8a+_0xaee9('0xaa')+_0x3dee8c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xaee9('0x8f')+_0x52ba3c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a4ac4)['then'](function(_0x49e65a){var _0x6b640e=[];_0x6b640e[_0xaee9('0x9c')]({'name':_0x49e65a[_0xaee9('0xac')][_0xaee9('0xb1')]['Label'][_0xaee9('0xaf')][_0xaee9('0xae')],'value':'true'},{'name':_0x49e65a[_0xaee9('0xac')][_0xaee9('0xb2')][_0xaee9('0xae')]['UserLocalizedLabel'][_0xaee9('0xae')],'value':_0xaee9('0xb3')});var _0x194b66={'id':_0x12cbdb+'_'+_0x49e65a[_0xaee9('0x96')],'name':_0x49e65a[_0xaee9('0xb0')][_0xaee9('0xaf')]['Label'],'custom':![],'options':_0x6b640e};_0x38667d['push'](_0x194b66);return _0x38667d;});}function getInputList(_0x1618ff,_0x1d2b1c,_0x685a6d,_0x578658,_0x366f91,_0x447913,_0x5b26bb){var _0x27d6db={'method':_0xaee9('0x8d'),'uri':_0x1618ff+_0xaee9('0x91')+_0x366f91+_0xaee9('0xaa')+_0x447913+')/Microsoft.Dynamics.CRM.'+_0x685a6d+_0xaee9('0xb4'),'headers':{'Authorization':_0xaee9('0x8f')+_0x5b26bb,'If-None-Match':null,'OData-Version':_0xaee9('0x90')},'json':!![]};return rp(_0x27d6db)['then'](function(_0x337d4a){var _0x250ac8={'id':_0x1d2b1c+'_'+_0x337d4a['LogicalName'],'name':_0x337d4a[_0xaee9('0xb0')][_0xaee9('0xaf')]?_0x337d4a[_0xaee9('0xb0')][_0xaee9('0xaf')][_0xaee9('0xae')]:_0x337d4a[_0xaee9('0x96')],'custom':![],'options':[]};_0x578658[_0xaee9('0x9c')](_0x250ac8);return _0x578658;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 63d020d..9d90a7f 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x568922,_0x51d358){var _0xbbb82c=function(_0x31607e){while(--_0x31607e){_0x568922['push'](_0x568922['shift']());}};_0xbbb82c(++_0x51d358);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x278601,_0x23fa7b){var _0x4c5bed=function(_0x5880b1){while(--_0x5880b1){_0x278601['push'](_0x278601['shift']());}};_0x4c5bed(++_0x23fa7b);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0477ee6..0a39511 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 _0x71e8=['findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','stringify','catch','ShowDynamics365Account','Dynamics365Account','find','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x71e8,0x18e));var _0x871e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71e8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x871e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x871e('0x1'));var rs=require(_0x871e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x871e('0x3'));var logger=require(_0x871e('0x4'))(_0x871e('0x5'));var config=require(_0x871e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x871e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49ee3e,_0x2059ef,_0x5bede6){return new BPromise(function(_0x139397,_0x48ae25){return client[_0x871e('0x8')](_0x49ee3e,_0x5bede6)[_0x871e('0x9')](function(_0x9e90c1){logger[_0x871e('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x2059ef,_0x871e('0xb'));logger[_0x871e('0xc')](_0x871e('0xd'),_0x2059ef,_0x871e('0xb'),JSON['stringify'](_0x9e90c1));if(_0x9e90c1[_0x871e('0xe')]){if(_0x9e90c1[_0x871e('0xe')][_0x871e('0xf')]===0x1f4){logger[_0x871e('0xe')](_0x871e('0x10'),_0x2059ef,_0x9e90c1[_0x871e('0xe')][_0x871e('0x11')]);return _0x48ae25(_0x9e90c1[_0x871e('0xe')]['message']);}logger[_0x871e('0xe')](_0x871e('0x10'),_0x2059ef,_0x9e90c1[_0x871e('0xe')][_0x871e('0x11')]);return _0x139397(_0x9e90c1[_0x871e('0xe')][_0x871e('0x11')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2059ef,'request\x20sent');_0x139397(_0x9e90c1['result'][_0x871e('0x11')]);}})['catch'](function(_0xa7436){logger[_0x871e('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x2059ef,_0xa7436);_0x48ae25(_0xa7436);});});}exports['GetDynamics365Account']=function(_0x2b201a){var _0x3f09b2=this;return new Promise(function(_0x3e30f0,_0x763962){return db['Dynamics365Account'][_0x871e('0x12')]({'raw':_0x2b201a[_0x871e('0x13')]?_0x2b201a['options'][_0x871e('0x14')]===undefined?!![]:![]:!![],'where':_0x2b201a['options']?_0x2b201a[_0x871e('0x13')][_0x871e('0x15')]||null:null,'attributes':_0x2b201a[_0x871e('0x13')]?_0x2b201a['options'][_0x871e('0x16')]||null:null,'limit':_0x2b201a['options']?_0x2b201a['options']['limit']||null:null,'include':_0x2b201a[_0x871e('0x13')]?_0x2b201a['options'][_0x871e('0x17')]?_[_0x871e('0x18')](_0x2b201a[_0x871e('0x13')][_0x871e('0x17')],function(_0x2a872d){return{'model':db[_0x2a872d[_0x871e('0x19')]],'as':_0x2a872d['as'],'attributes':_0x2a872d[_0x871e('0x16')],'include':_0x2a872d['include']?_[_0x871e('0x18')](_0x2a872d[_0x871e('0x17')],function(_0x5a8df9){return{'model':db[_0x5a8df9['model']],'as':_0x5a8df9['as'],'attributes':_0x5a8df9[_0x871e('0x16')],'include':_0x5a8df9[_0x871e('0x17')]?_[_0x871e('0x18')](_0x5a8df9[_0x871e('0x17')],function(_0x4aff81){return{'model':db[_0x4aff81[_0x871e('0x19')]],'as':_0x4aff81['as'],'attributes':_0x4aff81[_0x871e('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2daf89){logger[_0x871e('0xa')](_0x871e('0x1a'),_0x2b201a);logger[_0x871e('0xc')](_0x871e('0x1a'),_0x2b201a,JSON[_0x871e('0x1b')](_0x2daf89));_0x3e30f0(_0x2daf89);})[_0x871e('0x1c')](function(_0x59d8b2){logger[_0x871e('0xe')]('GetDynamics365Account',_0x59d8b2[_0x871e('0x11')],_0x2b201a);_0x763962(_0x3f09b2[_0x871e('0xe')](0x1f4,_0x59d8b2[_0x871e('0x11')]));});});};exports[_0x871e('0x1d')]=function(_0x20d07e){var _0x43b88e=this;return new Promise(function(_0x41b3da,_0x1fca3e){return db[_0x871e('0x1e')][_0x871e('0x1f')]({'raw':_0x20d07e['options']?_0x20d07e['options'][_0x871e('0x14')]===undefined?!![]:![]:!![],'where':_0x20d07e[_0x871e('0x13')]?_0x20d07e[_0x871e('0x13')]['where']||null:null,'attributes':_0x20d07e[_0x871e('0x13')]?_0x20d07e[_0x871e('0x13')]['attributes']||null:null,'include':_0x20d07e[_0x871e('0x13')]?_0x20d07e[_0x871e('0x13')][_0x871e('0x17')]?_['map'](_0x20d07e[_0x871e('0x13')][_0x871e('0x17')],function(_0x1564a7){return{'model':db[_0x1564a7[_0x871e('0x19')]],'as':_0x1564a7['as'],'attributes':_0x1564a7['attributes'],'include':_0x1564a7[_0x871e('0x17')]?_[_0x871e('0x18')](_0x1564a7['include'],function(_0x50056f){return{'model':db[_0x50056f[_0x871e('0x19')]],'as':_0x50056f['as'],'attributes':_0x50056f[_0x871e('0x16')],'include':_0x50056f[_0x871e('0x17')]?_[_0x871e('0x18')](_0x50056f[_0x871e('0x17')],function(_0x31733a){return{'model':db[_0x31733a[_0x871e('0x19')]],'as':_0x31733a['as'],'attributes':_0x31733a[_0x871e('0x16')]};}):[]};}):[]};}):[]:[]})[_0x871e('0x9')](function(_0x9e5df2){logger[_0x871e('0xa')](_0x871e('0x1d'),_0x20d07e);logger[_0x871e('0xc')](_0x871e('0x1d'),_0x20d07e,JSON[_0x871e('0x1b')](_0x9e5df2));_0x41b3da(_0x9e5df2);})[_0x871e('0x1c')](function(_0x30f82d){logger[_0x871e('0xe')](_0x871e('0x1d'),_0x30f82d[_0x871e('0x11')],_0x20d07e);_0x1fca3e(_0x43b88e[_0x871e('0xe')](0x1f4,_0x30f82d[_0x871e('0x11')]));});});}; \ No newline at end of file +var _0x1bc9=['findAll','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account'];(function(_0x9c592d,_0x24edec){var _0x1ad53e=function(_0x2a2c64){while(--_0x2a2c64){_0x9c592d['push'](_0x9c592d['shift']());}};_0x1ad53e(++_0x24edec);}(_0x1bc9,0x121));var _0x91bc=function(_0x41b0bf,_0x4b6017){_0x41b0bf=_0x41b0bf-0x0;var _0x1868e4=_0x1bc9[_0x41b0bf];return _0x1868e4;};'use strict';var _=require(_0x91bc('0x0'));var util=require(_0x91bc('0x1'));var moment=require(_0x91bc('0x2'));var BPromise=require(_0x91bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91bc('0x4'))['db'];var utils=require(_0x91bc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91bc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404209,_0x4453fe,_0x58eea4){return new BPromise(function(_0x2c3e99,_0x464ec9){return client[_0x91bc('0x7')](_0x404209,_0x58eea4)[_0x91bc('0x8')](function(_0x4ee1e1){logger[_0x91bc('0x9')](_0x91bc('0xa'),_0x4453fe,_0x91bc('0xb'));logger[_0x91bc('0xc')](_0x91bc('0xd'),_0x4453fe,_0x91bc('0xb'),JSON[_0x91bc('0xe')](_0x4ee1e1));if(_0x4ee1e1[_0x91bc('0xf')]){if(_0x4ee1e1[_0x91bc('0xf')][_0x91bc('0x10')]===0x1f4){logger[_0x91bc('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x4453fe,_0x4ee1e1[_0x91bc('0xf')]['message']);return _0x464ec9(_0x4ee1e1[_0x91bc('0xf')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4453fe,_0x4ee1e1[_0x91bc('0xf')][_0x91bc('0x11')]);return _0x2c3e99(_0x4ee1e1[_0x91bc('0xf')][_0x91bc('0x11')]);}else{logger[_0x91bc('0x9')](_0x91bc('0xa'),_0x4453fe,_0x91bc('0xb'));_0x2c3e99(_0x4ee1e1['result'][_0x91bc('0x11')]);}})[_0x91bc('0x12')](function(_0x394614){logger[_0x91bc('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x4453fe,_0x394614);_0x464ec9(_0x394614);});});}exports[_0x91bc('0x13')]=function(_0x39522f){var _0x540753=this;return new Promise(function(_0x5bf1dc,_0x376eca){return db[_0x91bc('0x14')][_0x91bc('0x15')]({'raw':_0x39522f[_0x91bc('0x16')]?_0x39522f[_0x91bc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x39522f[_0x91bc('0x16')]?_0x39522f[_0x91bc('0x16')][_0x91bc('0x17')]||null:null,'attributes':_0x39522f['options']?_0x39522f[_0x91bc('0x16')][_0x91bc('0x18')]||null:null,'limit':_0x39522f[_0x91bc('0x16')]?_0x39522f[_0x91bc('0x16')][_0x91bc('0x19')]||null:null,'include':_0x39522f[_0x91bc('0x16')]?_0x39522f['options'][_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x39522f[_0x91bc('0x16')][_0x91bc('0x1a')],function(_0x4fd0ee){return{'model':db[_0x4fd0ee[_0x91bc('0x1c')]],'as':_0x4fd0ee['as'],'attributes':_0x4fd0ee[_0x91bc('0x18')],'include':_0x4fd0ee[_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x4fd0ee[_0x91bc('0x1a')],function(_0x5172dc){return{'model':db[_0x5172dc[_0x91bc('0x1c')]],'as':_0x5172dc['as'],'attributes':_0x5172dc[_0x91bc('0x18')],'include':_0x5172dc[_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x5172dc['include'],function(_0x36ec74){return{'model':db[_0x36ec74['model']],'as':_0x36ec74['as'],'attributes':_0x36ec74[_0x91bc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x91bc('0x8')](function(_0x245d0a){logger['info'](_0x91bc('0x13'),_0x39522f);logger[_0x91bc('0xc')](_0x91bc('0x13'),_0x39522f,JSON[_0x91bc('0xe')](_0x245d0a));_0x5bf1dc(_0x245d0a);})[_0x91bc('0x12')](function(_0x5a5f34){logger['error'](_0x91bc('0x13'),_0x5a5f34[_0x91bc('0x11')],_0x39522f);_0x376eca(_0x540753['error'](0x1f4,_0x5a5f34[_0x91bc('0x11')]));});});};exports[_0x91bc('0x1d')]=function(_0x5019c9){var _0x3a5771=this;return new Promise(function(_0xeb51d3,_0x40e079){return db[_0x91bc('0x14')][_0x91bc('0x1e')]({'raw':_0x5019c9[_0x91bc('0x16')]?_0x5019c9[_0x91bc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5019c9[_0x91bc('0x16')]?_0x5019c9[_0x91bc('0x16')][_0x91bc('0x17')]||null:null,'attributes':_0x5019c9['options']?_0x5019c9['options'][_0x91bc('0x18')]||null:null,'include':_0x5019c9[_0x91bc('0x16')]?_0x5019c9[_0x91bc('0x16')][_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x5019c9[_0x91bc('0x16')]['include'],function(_0x1ce4e7){return{'model':db[_0x1ce4e7[_0x91bc('0x1c')]],'as':_0x1ce4e7['as'],'attributes':_0x1ce4e7[_0x91bc('0x18')],'include':_0x1ce4e7[_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x1ce4e7['include'],function(_0x4ceab4){return{'model':db[_0x4ceab4[_0x91bc('0x1c')]],'as':_0x4ceab4['as'],'attributes':_0x4ceab4[_0x91bc('0x18')],'include':_0x4ceab4[_0x91bc('0x1a')]?_[_0x91bc('0x1b')](_0x4ceab4[_0x91bc('0x1a')],function(_0x2e3123){return{'model':db[_0x2e3123[_0x91bc('0x1c')]],'as':_0x2e3123['as'],'attributes':_0x2e3123[_0x91bc('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27315d){logger[_0x91bc('0x9')](_0x91bc('0x1d'),_0x5019c9);logger[_0x91bc('0xc')](_0x91bc('0x1d'),_0x5019c9,JSON[_0x91bc('0xe')](_0x27315d));_0xeb51d3(_0x27315d);})['catch'](function(_0x172e51){logger[_0x91bc('0xf')](_0x91bc('0x1d'),_0x172e51['message'],_0x5019c9);_0x40e079(_0x3a5771[_0x91bc('0xf')](0x1f4,_0x172e51['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d06cad4..16d8af2 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 _0x3149=['getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x1088e8,_0x410fed){var _0x42021b=function(_0x125305){while(--_0x125305){_0x1088e8['push'](_0x1088e8['shift']());}};_0x42021b(++_0x410fed);}(_0x3149,0x181));var _0x9314=function(_0x37b402,_0x228b61){_0x37b402=_0x37b402-0x0;var _0x5299e6=_0x3149[_0x37b402];return _0x5299e6;};'use strict';var multer=require(_0x9314('0x0'));var util=require('util');var path=require(_0x9314('0x1'));var timeout=require(_0x9314('0x2'));var express=require(_0x9314('0x3'));var router=express[_0x9314('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9314('0x5'));var interaction=require(_0x9314('0x6'));var config=require(_0x9314('0x7'));var controller=require(_0x9314('0x8'));router[_0x9314('0x9')]('/',auth['isAuthenticated'](),controller[_0x9314('0xa')]);router[_0x9314('0x9')](_0x9314('0xb'),auth[_0x9314('0xc')](),controller[_0x9314('0xd')]);router['get'](_0x9314('0xe'),auth['isAuthenticated'](),controller[_0x9314('0xf')]);router['get'](_0x9314('0x10'),auth[_0x9314('0xc')](),controller['getSubjects']);router[_0x9314('0x9')]('/:id/descriptions',auth[_0x9314('0xc')](),controller[_0x9314('0x11')]);router[_0x9314('0x12')]('/',auth['isAuthenticated'](),controller[_0x9314('0x13')]);router[_0x9314('0x14')](_0x9314('0xb'),auth[_0x9314('0xc')](),controller[_0x9314('0x15')]);router[_0x9314('0x16')](_0x9314('0xb'),auth['isAuthenticated'](),controller[_0x9314('0x17')]);module[_0x9314('0x18')]=router; \ No newline at end of file +var _0x94c9=['../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','express','fs-extra','../../components/auth/service'];(function(_0x3ae24a,_0x7d32f9){var _0x18690f=function(_0x2c2389){while(--_0x2c2389){_0x3ae24a['push'](_0x3ae24a['shift']());}};_0x18690f(++_0x7d32f9);}(_0x94c9,0x1b5));var _0x994c=function(_0x5cd7b7,_0xe04ef3){_0x5cd7b7=_0x5cd7b7-0x0;var _0xdab773=_0x94c9[_0x5cd7b7];return _0xdab773;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x994c('0x0'));var router=express['Router']();var fs_extra=require(_0x994c('0x1'));var auth=require(_0x994c('0x2'));var interaction=require(_0x994c('0x3'));var config=require(_0x994c('0x4'));var controller=require(_0x994c('0x5'));router[_0x994c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x994c('0x6')](_0x994c('0x7'),auth['isAuthenticated'](),controller[_0x994c('0x8')]);router[_0x994c('0x6')]('/:id/fields',auth[_0x994c('0x9')](),controller[_0x994c('0xa')]);router[_0x994c('0x6')](_0x994c('0xb'),auth['isAuthenticated'](),controller[_0x994c('0xc')]);router[_0x994c('0x6')](_0x994c('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x994c('0xe')]('/',auth[_0x994c('0x9')](),controller[_0x994c('0xf')]);router[_0x994c('0x10')](_0x994c('0x7'),auth[_0x994c('0x9')](),controller['update']);router[_0x994c('0x11')]('/:id',auth[_0x994c('0x9')](),controller[_0x994c('0x12')]);module[_0x994c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 18a5fe9..f2aee97 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 _0xa27c=['BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa27c,0xab));var _0xca27=function(_0x16f147,_0x50a6f7){_0x16f147=_0x16f147-0x0;var _0x55b504=_0xa27c[_0x16f147];return _0x55b504;};'use strict';var Sequelize=require(_0xca27('0x0'));module['exports']={'name':{'type':Sequelize[_0xca27('0x1')]},'description':{'type':Sequelize[_0xca27('0x1')]},'ticketType':{'type':Sequelize[_0xca27('0x2')](_0xca27('0x3'),'phonecall'),'defaultValue':_0xca27('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact','nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xca27('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xca27('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8772=['phonecall','contact','nothing','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x8772,0x17c));var _0x2877=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x8772[_0x2bc2a2];return _0x20de67;};'use strict';var Sequelize=require('sequelize');module[_0x2877('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2877('0x1')]},'ticketType':{'type':Sequelize[_0x2877('0x2')](_0x2877('0x3'),_0x2877('0x4')),'defaultValue':_0x2877('0x3')},'moduleCreate':{'type':Sequelize[_0x2877('0x2')](_0x2877('0x5'),_0x2877('0x6')),'defaultValue':_0x2877('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2877('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0807924..40149ba 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 _0x93e9=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','rows','catch','show','params','includeAll','find','create','body','destroy','Dynamics365Field','order','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3102ce,_0x237f66){var _0x535895=function(_0xd34964){while(--_0xd34964){_0x3102ce['push'](_0x3102ce['shift']());}};_0x535895(++_0x237f66);}(_0x93e9,0xa3));var _0x993e=function(_0x453271,_0x52ee0f){_0x453271=_0x453271-0x0;var _0x54530b=_0x93e9[_0x453271];return _0x54530b;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require(_0x993e('0x7'));var util=require(_0x993e('0x8'));var path=require(_0x993e('0x9'));var sox=require(_0x993e('0xa'));var csv=require(_0x993e('0xb'));var ejs=require(_0x993e('0xc'));var fs=require('fs');var fs_extra=require(_0x993e('0xd'));var _=require(_0x993e('0xe'));var squel=require('squel');var crypto=require(_0x993e('0xf'));var jsforce=require(_0x993e('0x10'));var deskjs=require(_0x993e('0x11'));var toCsv=require(_0x993e('0xb'));var querystring=require(_0x993e('0x12'));var Papa=require(_0x993e('0x13'));var Redis=require(_0x993e('0x14'));var authService=require(_0x993e('0x15'));var qs=require(_0x993e('0x16'));var as=require(_0x993e('0x17'));var hardwareService=require(_0x993e('0x18'));var logger=require(_0x993e('0x19'))(_0x993e('0x1a'));var utils=require(_0x993e('0x1b'));var config=require(_0x993e('0x1c'));var licenseUtil=require(_0x993e('0x1d'));var db=require(_0x993e('0x1e'))['db'];function respondWithStatusCode(_0x55a7fd,_0x2f2c30){_0x2f2c30=_0x2f2c30||0xcc;return function(_0x5c14bb){if(_0x5c14bb){return _0x55a7fd['sendStatus'](_0x2f2c30);}return _0x55a7fd[_0x993e('0x1f')](_0x2f2c30)['end']();};}function respondWithResult(_0x26f5a3,_0x28be6d){_0x28be6d=_0x28be6d||0xc8;return function(_0x4c4bc8){if(_0x4c4bc8){return _0x26f5a3[_0x993e('0x1f')](_0x28be6d)['json'](_0x4c4bc8);}};}function respondWithFilteredResult(_0x51766a,_0xf00024){return function(_0x10835a){if(_0x10835a){var _0x564502=typeof _0xf00024[_0x993e('0x20')]===_0x993e('0x21')&&typeof _0xf00024[_0x993e('0x22')]===_0x993e('0x21');var _0x3ce3a6=_0x10835a[_0x993e('0x23')];var _0x2cfccb=_0x564502?0x0:_0xf00024[_0x993e('0x20')];var _0x11639c=_0x564502?_0x10835a[_0x993e('0x23')]:_0xf00024[_0x993e('0x20')]+_0xf00024['limit'];var _0x2c7ac7;if(_0x11639c>=_0x3ce3a6){_0x11639c=_0x3ce3a6;_0x2c7ac7=0xc8;}else{_0x2c7ac7=0xce;}_0x51766a['status'](_0x2c7ac7);return _0x51766a[_0x993e('0x24')](_0x993e('0x25'),_0x2cfccb+'-'+_0x11639c+'/'+_0x3ce3a6)[_0x993e('0x26')](_0x10835a);}return null;};}function patchUpdates(_0x4c2dae){return function(_0x5dd777){try{jsonpatch[_0x993e('0x27')](_0x5dd777,_0x4c2dae,!![]);}catch(_0x16b27e){return BPromise[_0x993e('0x28')](_0x16b27e);}return _0x5dd777['save']();};}function saveUpdates(_0x557c08,_0xa7cae4){return function(_0x4d6b86){if(_0x4d6b86){return _0x4d6b86['update'](_0x557c08)[_0x993e('0x29')](function(_0x2488d4){return _0x2488d4;});}return null;};}function removeEntity(_0x12fc37,_0x205f74){return function(_0x158027){if(_0x158027){return _0x158027['destroy']()[_0x993e('0x29')](function(){_0x12fc37[_0x993e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fde8f,_0x4a8de4){return function(_0x184a5e){if(!_0x184a5e){_0x1fde8f['sendStatus'](0x194);}return _0x184a5e;};}function handleError(_0x313112,_0xccbe09){_0xccbe09=_0xccbe09||0x1f4;return function(_0x4df3fc){logger[_0x993e('0x2a')](_0x4df3fc[_0x993e('0x2b')]);if(_0x4df3fc[_0x993e('0x2c')]){delete _0x4df3fc['name'];}_0x313112[_0x993e('0x1f')](_0xccbe09)[_0x993e('0x2d')](_0x4df3fc);};}exports[_0x993e('0x2e')]=function(_0x23f338,_0x4a68de){var _0x54f972={},_0x1b49f7={},_0xd1bc14={'count':0x0,'rows':[]};var _0x514bec=_[_0x993e('0x2f')](db[_0x993e('0x30')][_0x993e('0x31')],function(_0x54d0cf){return{'name':_0x54d0cf[_0x993e('0x32')],'type':_0x54d0cf[_0x993e('0x33')][_0x993e('0x34')]};});_0x1b49f7[_0x993e('0x35')]=_['map'](_0x514bec,_0x993e('0x2c'));_0x1b49f7[_0x993e('0x36')]=_[_0x993e('0x37')](_0x23f338[_0x993e('0x36')]);_0x1b49f7[_0x993e('0x38')]=_[_0x993e('0x39')](_0x1b49f7[_0x993e('0x35')],_0x1b49f7['query']);_0x54f972[_0x993e('0x3a')]=_[_0x993e('0x39')](_0x1b49f7['model'],qs[_0x993e('0x3b')](_0x23f338[_0x993e('0x36')][_0x993e('0x3b')]));_0x54f972[_0x993e('0x3a')]=_0x54f972['attributes'][_0x993e('0x3c')]?_0x54f972[_0x993e('0x3a')]:_0x1b49f7[_0x993e('0x35')];if(!_0x23f338['query'][_0x993e('0x3d')](_0x993e('0x3e'))){_0x54f972[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x23f338[_0x993e('0x36')]['limit']);_0x54f972[_0x993e('0x20')]=qs['offset'](_0x23f338[_0x993e('0x36')][_0x993e('0x20')]);}_0x54f972['order']=qs[_0x993e('0x3f')](_0x23f338[_0x993e('0x36')][_0x993e('0x3f')]);_0x54f972[_0x993e('0x40')]=qs[_0x993e('0x38')](_[_0x993e('0x41')](_0x23f338[_0x993e('0x36')],_0x1b49f7[_0x993e('0x38')]),_0x514bec);if(_0x23f338['query'][_0x993e('0x42')]){_0x54f972[_0x993e('0x40')]=_['merge'](_0x54f972['where'],{'$or':_[_0x993e('0x2f')](_0x514bec,function(_0x1e46c5){if(_0x1e46c5[_0x993e('0x33')]!==_0x993e('0x43')){var _0x2bef12={};_0x2bef12[_0x1e46c5[_0x993e('0x2c')]]={'$like':'%'+_0x23f338[_0x993e('0x36')]['filter']+'%'};return _0x2bef12;}})});}_0x54f972=_[_0x993e('0x44')]({},_0x54f972,_0x23f338[_0x993e('0x45')]);var _0x3a3c88={'where':_0x54f972[_0x993e('0x40')]};return db[_0x993e('0x30')][_0x993e('0x23')](_0x3a3c88)[_0x993e('0x29')](function(_0x549d82){_0xd1bc14[_0x993e('0x23')]=_0x549d82;if(_0x23f338[_0x993e('0x36')]['includeAll']){_0x54f972['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x54f972);})[_0x993e('0x29')](function(_0xf0c04a){_0xd1bc14[_0x993e('0x46')]=_0xf0c04a;return _0xd1bc14;})[_0x993e('0x29')](respondWithFilteredResult(_0x4a68de,_0x54f972))[_0x993e('0x47')](handleError(_0x4a68de,null));};exports[_0x993e('0x48')]=function(_0x5dc1b7,_0x1ae59c){var _0x2bf119={'raw':![],'where':{'id':_0x5dc1b7[_0x993e('0x49')]['id']}},_0x471b12={};_0x471b12['model']=_['keys'](db[_0x993e('0x30')][_0x993e('0x31')]);_0x471b12[_0x993e('0x36')]=_['keys'](_0x5dc1b7[_0x993e('0x36')]);_0x471b12[_0x993e('0x38')]=_[_0x993e('0x39')](_0x471b12[_0x993e('0x35')],_0x471b12[_0x993e('0x36')]);_0x2bf119['attributes']=_['intersection'](_0x471b12[_0x993e('0x35')],qs[_0x993e('0x3b')](_0x5dc1b7['query']['fields']));_0x2bf119['attributes']=_0x2bf119['attributes'][_0x993e('0x3c')]?_0x2bf119[_0x993e('0x3a')]:_0x471b12['model'];if(_0x5dc1b7[_0x993e('0x36')][_0x993e('0x4a')]){_0x2bf119['include']=[{'all':!![]}];}_0x2bf119=_[_0x993e('0x44')]({},_0x2bf119,_0x5dc1b7[_0x993e('0x45')]);return db[_0x993e('0x30')][_0x993e('0x4b')](_0x2bf119)[_0x993e('0x29')](handleEntityNotFound(_0x1ae59c,null))['then'](respondWithResult(_0x1ae59c,null))[_0x993e('0x47')](handleError(_0x1ae59c,null));};exports[_0x993e('0x4c')]=function(_0x5b1149,_0x196e37){return db[_0x993e('0x30')][_0x993e('0x4c')](_0x5b1149[_0x993e('0x4d')],{})[_0x993e('0x29')](respondWithResult(_0x196e37,0xc9))[_0x993e('0x47')](handleError(_0x196e37,null));};exports['update']=function(_0x552f4b,_0x4c82e0){if(_0x552f4b[_0x993e('0x4d')]['id']){delete _0x552f4b['body']['id'];}return db[_0x993e('0x30')][_0x993e('0x4b')]({'where':{'id':_0x552f4b[_0x993e('0x49')]['id']}})[_0x993e('0x29')](handleEntityNotFound(_0x4c82e0,null))[_0x993e('0x29')](saveUpdates(_0x552f4b[_0x993e('0x4d')],null))[_0x993e('0x29')](respondWithResult(_0x4c82e0,null))['catch'](handleError(_0x4c82e0,null));};exports[_0x993e('0x4e')]=function(_0x42d16d,_0x3ddb4d){return db[_0x993e('0x30')][_0x993e('0x4b')]({'where':{'id':_0x42d16d[_0x993e('0x49')]['id']}})[_0x993e('0x29')](handleEntityNotFound(_0x3ddb4d,null))[_0x993e('0x29')](removeEntity(_0x3ddb4d,null))[_0x993e('0x47')](handleError(_0x3ddb4d,null));};exports['getFields']=function(_0x4bb88e,_0x33eb12,_0x37ca61){var _0x2dc676={};var _0x2524c2={};var _0x23717d;var _0x4374aa;return db[_0x993e('0x30')]['findOne']({'where':{'id':_0x4bb88e[_0x993e('0x49')]['id']}})[_0x993e('0x29')](handleEntityNotFound(_0x33eb12,null))[_0x993e('0x29')](function(_0x33ab31){if(_0x33ab31){_0x23717d=_0x33ab31;_0x2524c2[_0x993e('0x35')]=_[_0x993e('0x37')](db[_0x993e('0x4f')][_0x993e('0x31')]);_0x2524c2[_0x993e('0x36')]=_[_0x993e('0x37')](_0x4bb88e[_0x993e('0x36')]);_0x2524c2[_0x993e('0x38')]=_[_0x993e('0x39')](_0x2524c2[_0x993e('0x35')],_0x2524c2[_0x993e('0x36')]);_0x2dc676[_0x993e('0x3a')]=_[_0x993e('0x39')](_0x2524c2['model'],qs[_0x993e('0x3b')](_0x4bb88e['query'][_0x993e('0x3b')]));_0x2dc676[_0x993e('0x3a')]=_0x2dc676[_0x993e('0x3a')][_0x993e('0x3c')]?_0x2dc676['attributes']:_0x2524c2[_0x993e('0x35')];_0x2dc676[_0x993e('0x50')]=qs[_0x993e('0x3f')](_0x4bb88e[_0x993e('0x36')][_0x993e('0x3f')]);_0x2dc676['where']=qs['filters'](_[_0x993e('0x41')](_0x4bb88e[_0x993e('0x36')],_0x2524c2['filters']));if(_0x4bb88e[_0x993e('0x36')][_0x993e('0x42')]){_0x2dc676[_0x993e('0x40')]=_[_0x993e('0x44')](_0x2dc676[_0x993e('0x40')],{'$or':_['map'](_0x2dc676[_0x993e('0x3a')],function(_0x43519d){var _0x39525a={};_0x39525a[_0x43519d]={'$like':'%'+_0x4bb88e['query']['filter']+'%'};return _0x39525a;})});}_0x2dc676=_[_0x993e('0x44')]({},_0x2dc676,_0x4bb88e[_0x993e('0x45')]);return _0x23717d[_0x993e('0x51')](_0x2dc676);}})[_0x993e('0x29')](function(_0xa5028b){if(_0xa5028b){_0x4374aa=_0xa5028b['length'];if(!_0x4bb88e[_0x993e('0x36')][_0x993e('0x3d')](_0x993e('0x3e'))){_0x2dc676[_0x993e('0x22')]=qs[_0x993e('0x22')](_0x4bb88e[_0x993e('0x36')]['limit']);_0x2dc676[_0x993e('0x20')]=qs[_0x993e('0x20')](_0x4bb88e[_0x993e('0x36')][_0x993e('0x20')]);}return _0x23717d[_0x993e('0x51')](_0x2dc676);}})[_0x993e('0x29')](function(_0x4951da){if(_0x4951da){return _0x4951da?{'count':_0x4374aa,'rows':_0x4951da}:null;}})[_0x993e('0x29')](respondWithResult(_0x33eb12,null))[_0x993e('0x47')](handleError(_0x33eb12,null));};exports[_0x993e('0x52')]=function(_0xa1d9dc,_0x5051a7,_0x34b234){var _0x13c59b={};var _0x5df963={};var _0x32151f;var _0x2da891;return db[_0x993e('0x30')][_0x993e('0x53')]({'where':{'id':_0xa1d9dc[_0x993e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5051a7,null))[_0x993e('0x29')](function(_0x416d55){if(_0x416d55){_0x32151f=_0x416d55;_0x5df963[_0x993e('0x35')]=_[_0x993e('0x37')](db[_0x993e('0x4f')]['rawAttributes']);_0x5df963['query']=_[_0x993e('0x37')](_0xa1d9dc[_0x993e('0x36')]);_0x5df963['filters']=_[_0x993e('0x39')](_0x5df963[_0x993e('0x35')],_0x5df963['query']);_0x13c59b[_0x993e('0x3a')]=_['intersection'](_0x5df963['model'],qs[_0x993e('0x3b')](_0xa1d9dc[_0x993e('0x36')][_0x993e('0x3b')]));_0x13c59b[_0x993e('0x3a')]=_0x13c59b[_0x993e('0x3a')][_0x993e('0x3c')]?_0x13c59b[_0x993e('0x3a')]:_0x5df963[_0x993e('0x35')];_0x13c59b[_0x993e('0x50')]=qs[_0x993e('0x3f')](_0xa1d9dc[_0x993e('0x36')]['sort']);_0x13c59b[_0x993e('0x40')]=qs[_0x993e('0x38')](_[_0x993e('0x41')](_0xa1d9dc['query'],_0x5df963[_0x993e('0x38')]));if(_0xa1d9dc[_0x993e('0x36')][_0x993e('0x42')]){_0x13c59b[_0x993e('0x40')]=_['merge'](_0x13c59b[_0x993e('0x40')],{'$or':_['map'](_0x13c59b['attributes'],function(_0x214da2){var _0xd3ecda={};_0xd3ecda[_0x214da2]={'$like':'%'+_0xa1d9dc[_0x993e('0x36')][_0x993e('0x42')]+'%'};return _0xd3ecda;})});}_0x13c59b=_[_0x993e('0x44')]({},_0x13c59b,_0xa1d9dc['options']);return _0x32151f['getSubjects'](_0x13c59b);}})['then'](function(_0x50c09e){if(_0x50c09e){_0x2da891=_0x50c09e[_0x993e('0x3c')];if(!_0xa1d9dc[_0x993e('0x36')]['hasOwnProperty']('nolimit')){_0x13c59b[_0x993e('0x22')]=qs[_0x993e('0x22')](_0xa1d9dc[_0x993e('0x36')]['limit']);_0x13c59b[_0x993e('0x20')]=qs[_0x993e('0x20')](_0xa1d9dc[_0x993e('0x36')][_0x993e('0x20')]);}return _0x32151f['getSubjects'](_0x13c59b);}})[_0x993e('0x29')](function(_0x285fc4){if(_0x285fc4){return _0x285fc4?{'count':_0x2da891,'rows':_0x285fc4}:null;}})[_0x993e('0x29')](respondWithResult(_0x5051a7,null))[_0x993e('0x47')](handleError(_0x5051a7,null));};exports[_0x993e('0x54')]=function(_0x342dec,_0x125835,_0x550128){var _0x2df57e={};var _0x4a26fe={};var _0x3ee855;var _0x4cdcd1;return db[_0x993e('0x30')][_0x993e('0x53')]({'where':{'id':_0x342dec[_0x993e('0x49')]['id']}})[_0x993e('0x29')](handleEntityNotFound(_0x125835,null))[_0x993e('0x29')](function(_0x2e1995){if(_0x2e1995){_0x3ee855=_0x2e1995;_0x4a26fe[_0x993e('0x35')]=_[_0x993e('0x37')](db['Dynamics365Field'][_0x993e('0x31')]);_0x4a26fe[_0x993e('0x36')]=_[_0x993e('0x37')](_0x342dec[_0x993e('0x36')]);_0x4a26fe[_0x993e('0x38')]=_[_0x993e('0x39')](_0x4a26fe[_0x993e('0x35')],_0x4a26fe[_0x993e('0x36')]);_0x2df57e['attributes']=_['intersection'](_0x4a26fe[_0x993e('0x35')],qs[_0x993e('0x3b')](_0x342dec[_0x993e('0x36')]['fields']));_0x2df57e['attributes']=_0x2df57e[_0x993e('0x3a')]['length']?_0x2df57e['attributes']:_0x4a26fe[_0x993e('0x35')];_0x2df57e['order']=qs[_0x993e('0x3f')](_0x342dec[_0x993e('0x36')]['sort']);_0x2df57e[_0x993e('0x40')]=qs[_0x993e('0x38')](_[_0x993e('0x41')](_0x342dec['query'],_0x4a26fe['filters']));if(_0x342dec[_0x993e('0x36')][_0x993e('0x42')]){_0x2df57e[_0x993e('0x40')]=_[_0x993e('0x44')](_0x2df57e[_0x993e('0x40')],{'$or':_[_0x993e('0x2f')](_0x2df57e[_0x993e('0x3a')],function(_0x261ad7){var _0x4f3331={};_0x4f3331[_0x261ad7]={'$like':'%'+_0x342dec[_0x993e('0x36')][_0x993e('0x42')]+'%'};return _0x4f3331;})});}_0x2df57e=_[_0x993e('0x44')]({},_0x2df57e,_0x342dec['options']);return _0x3ee855[_0x993e('0x54')](_0x2df57e);}})[_0x993e('0x29')](function(_0x226bee){if(_0x226bee){_0x4cdcd1=_0x226bee[_0x993e('0x3c')];if(!_0x342dec[_0x993e('0x36')][_0x993e('0x3d')](_0x993e('0x3e'))){_0x2df57e['limit']=qs['limit'](_0x342dec[_0x993e('0x36')][_0x993e('0x22')]);_0x2df57e[_0x993e('0x20')]=qs['offset'](_0x342dec[_0x993e('0x36')][_0x993e('0x20')]);}return _0x3ee855['getDescriptions'](_0x2df57e);}})[_0x993e('0x29')](function(_0x3a776c){if(_0x3a776c){return _0x3a776c?{'count':_0x4cdcd1,'rows':_0x3a776c}:null;}})[_0x993e('0x29')](respondWithResult(_0x125835,null))[_0x993e('0x47')](handleError(_0x125835,null));}; \ No newline at end of file +var _0xb8cd=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','catch','destroy','getFields','Dynamics365Field','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb8cd,0x11a));var _0xdb8c=function(_0x58a4db,_0x272a7d){_0x58a4db=_0x58a4db-0x0;var _0x4c8a15=_0xb8cd[_0x58a4db];return _0x4c8a15;};'use strict';var emlformat=require(_0xdb8c('0x0'));var rimraf=require(_0xdb8c('0x1'));var zipdir=require(_0xdb8c('0x2'));var jsonpatch=require(_0xdb8c('0x3'));var rp=require(_0xdb8c('0x4'));var moment=require(_0xdb8c('0x5'));var BPromise=require(_0xdb8c('0x6'));var Mustache=require('mustache');var util=require(_0xdb8c('0x7'));var path=require(_0xdb8c('0x8'));var sox=require(_0xdb8c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb8c('0xa'));var _=require(_0xdb8c('0xb'));var squel=require(_0xdb8c('0xc'));var crypto=require('crypto');var jsforce=require(_0xdb8c('0xd'));var deskjs=require(_0xdb8c('0xe'));var toCsv=require(_0xdb8c('0xf'));var querystring=require(_0xdb8c('0x10'));var Papa=require(_0xdb8c('0x11'));var Redis=require(_0xdb8c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdb8c('0x13'));var as=require(_0xdb8c('0x14'));var hardwareService=require(_0xdb8c('0x15'));var logger=require(_0xdb8c('0x16'))(_0xdb8c('0x17'));var utils=require(_0xdb8c('0x18'));var config=require(_0xdb8c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb8c('0x1a'))['db'];function respondWithStatusCode(_0x93fdd,_0x260eb7){_0x260eb7=_0x260eb7||0xcc;return function(_0xb65102){if(_0xb65102){return _0x93fdd['sendStatus'](_0x260eb7);}return _0x93fdd[_0xdb8c('0x1b')](_0x260eb7)['end']();};}function respondWithResult(_0x1fb631,_0x235b05){_0x235b05=_0x235b05||0xc8;return function(_0x3d2410){if(_0x3d2410){return _0x1fb631[_0xdb8c('0x1b')](_0x235b05)[_0xdb8c('0x1c')](_0x3d2410);}};}function respondWithFilteredResult(_0x2e766c,_0x33e4b7){return function(_0x11a422){if(_0x11a422){var _0x1a1914=typeof _0x33e4b7['offset']===_0xdb8c('0x1d')&&typeof _0x33e4b7[_0xdb8c('0x1e')]===_0xdb8c('0x1d');var _0x5e57ed=_0x11a422[_0xdb8c('0x1f')];var _0x50275a=_0x1a1914?0x0:_0x33e4b7['offset'];var _0x4f7c34=_0x1a1914?_0x11a422[_0xdb8c('0x1f')]:_0x33e4b7[_0xdb8c('0x20')]+_0x33e4b7[_0xdb8c('0x1e')];var _0x357484;if(_0x4f7c34>=_0x5e57ed){_0x4f7c34=_0x5e57ed;_0x357484=0xc8;}else{_0x357484=0xce;}_0x2e766c[_0xdb8c('0x1b')](_0x357484);return _0x2e766c[_0xdb8c('0x21')](_0xdb8c('0x22'),_0x50275a+'-'+_0x4f7c34+'/'+_0x5e57ed)['json'](_0x11a422);}return null;};}function patchUpdates(_0x1b2a26){return function(_0x259971){try{jsonpatch[_0xdb8c('0x23')](_0x259971,_0x1b2a26,!![]);}catch(_0x48dfd1){return BPromise[_0xdb8c('0x24')](_0x48dfd1);}return _0x259971[_0xdb8c('0x25')]();};}function saveUpdates(_0x569cee,_0x512bf5){return function(_0x946145){if(_0x946145){return _0x946145[_0xdb8c('0x26')](_0x569cee)['then'](function(_0x5a817b){return _0x5a817b;});}return null;};}function removeEntity(_0x40a7a2,_0x40bc13){return function(_0x2147c7){if(_0x2147c7){return _0x2147c7['destroy']()[_0xdb8c('0x27')](function(){_0x40a7a2[_0xdb8c('0x1b')](0xcc)[_0xdb8c('0x28')]();});}};}function handleEntityNotFound(_0x307746,_0x2009aa){return function(_0x3a6273){if(!_0x3a6273){_0x307746[_0xdb8c('0x29')](0x194);}return _0x3a6273;};}function handleError(_0x37194b,_0x34f9ac){_0x34f9ac=_0x34f9ac||0x1f4;return function(_0x3ffe0c){logger[_0xdb8c('0x2a')](_0x3ffe0c[_0xdb8c('0x2b')]);if(_0x3ffe0c[_0xdb8c('0x2c')]){delete _0x3ffe0c[_0xdb8c('0x2c')];}_0x37194b[_0xdb8c('0x1b')](_0x34f9ac)['send'](_0x3ffe0c);};}exports[_0xdb8c('0x2d')]=function(_0x5cf2e5,_0x5d2285){var _0x37ccf8={},_0x4ad42f={},_0x3d8034={'count':0x0,'rows':[]};var _0x3bf2f7=_['map'](db[_0xdb8c('0x2e')][_0xdb8c('0x2f')],function(_0x47adc2){return{'name':_0x47adc2[_0xdb8c('0x30')],'type':_0x47adc2[_0xdb8c('0x31')][_0xdb8c('0x32')]};});_0x4ad42f[_0xdb8c('0x33')]=_[_0xdb8c('0x34')](_0x3bf2f7,_0xdb8c('0x2c'));_0x4ad42f[_0xdb8c('0x35')]=_[_0xdb8c('0x36')](_0x5cf2e5['query']);_0x4ad42f['filters']=_[_0xdb8c('0x37')](_0x4ad42f[_0xdb8c('0x33')],_0x4ad42f[_0xdb8c('0x35')]);_0x37ccf8[_0xdb8c('0x38')]=_[_0xdb8c('0x37')](_0x4ad42f[_0xdb8c('0x33')],qs[_0xdb8c('0x39')](_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x39')]));_0x37ccf8[_0xdb8c('0x38')]=_0x37ccf8[_0xdb8c('0x38')][_0xdb8c('0x3a')]?_0x37ccf8[_0xdb8c('0x38')]:_0x4ad42f['model'];if(!_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x3b')](_0xdb8c('0x3c'))){_0x37ccf8['limit']=qs[_0xdb8c('0x1e')](_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x1e')]);_0x37ccf8[_0xdb8c('0x20')]=qs[_0xdb8c('0x20')](_0x5cf2e5[_0xdb8c('0x35')]['offset']);}_0x37ccf8[_0xdb8c('0x3d')]=qs[_0xdb8c('0x3e')](_0x5cf2e5['query']['sort']);_0x37ccf8[_0xdb8c('0x3f')]=qs[_0xdb8c('0x40')](_[_0xdb8c('0x41')](_0x5cf2e5[_0xdb8c('0x35')],_0x4ad42f[_0xdb8c('0x40')]),_0x3bf2f7);if(_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x42')]){_0x37ccf8[_0xdb8c('0x3f')]=_[_0xdb8c('0x43')](_0x37ccf8[_0xdb8c('0x3f')],{'$or':_[_0xdb8c('0x34')](_0x3bf2f7,function(_0x3a64c6){if(_0x3a64c6['type']!==_0xdb8c('0x44')){var _0x5e8e5c={};_0x5e8e5c[_0x3a64c6[_0xdb8c('0x2c')]]={'$like':'%'+_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x42')]+'%'};return _0x5e8e5c;}})});}_0x37ccf8=_[_0xdb8c('0x43')]({},_0x37ccf8,_0x5cf2e5[_0xdb8c('0x45')]);var _0x52aec7={'where':_0x37ccf8[_0xdb8c('0x3f')]};return db['Dynamics365Configuration']['count'](_0x52aec7)[_0xdb8c('0x27')](function(_0x3e7e62){_0x3d8034[_0xdb8c('0x1f')]=_0x3e7e62;if(_0x5cf2e5[_0xdb8c('0x35')][_0xdb8c('0x46')]){_0x37ccf8[_0xdb8c('0x47')]=[{'all':!![]}];}return db[_0xdb8c('0x2e')][_0xdb8c('0x48')](_0x37ccf8);})[_0xdb8c('0x27')](function(_0x45eee2){_0x3d8034['rows']=_0x45eee2;return _0x3d8034;})[_0xdb8c('0x27')](respondWithFilteredResult(_0x5d2285,_0x37ccf8))['catch'](handleError(_0x5d2285,null));};exports['show']=function(_0x4a3185,_0x353a74){var _0x453f0e={'raw':![],'where':{'id':_0x4a3185[_0xdb8c('0x49')]['id']}},_0x3c771a={};_0x3c771a[_0xdb8c('0x33')]=_[_0xdb8c('0x36')](db['Dynamics365Configuration'][_0xdb8c('0x2f')]);_0x3c771a[_0xdb8c('0x35')]=_[_0xdb8c('0x36')](_0x4a3185[_0xdb8c('0x35')]);_0x3c771a['filters']=_['intersection'](_0x3c771a[_0xdb8c('0x33')],_0x3c771a[_0xdb8c('0x35')]);_0x453f0e[_0xdb8c('0x38')]=_['intersection'](_0x3c771a[_0xdb8c('0x33')],qs[_0xdb8c('0x39')](_0x4a3185[_0xdb8c('0x35')]['fields']));_0x453f0e[_0xdb8c('0x38')]=_0x453f0e['attributes'][_0xdb8c('0x3a')]?_0x453f0e[_0xdb8c('0x38')]:_0x3c771a[_0xdb8c('0x33')];if(_0x4a3185[_0xdb8c('0x35')][_0xdb8c('0x46')]){_0x453f0e[_0xdb8c('0x47')]=[{'all':!![]}];}_0x453f0e=_[_0xdb8c('0x43')]({},_0x453f0e,_0x4a3185['options']);return db[_0xdb8c('0x2e')][_0xdb8c('0x4a')](_0x453f0e)[_0xdb8c('0x27')](handleEntityNotFound(_0x353a74,null))['then'](respondWithResult(_0x353a74,null))['catch'](handleError(_0x353a74,null));};exports['create']=function(_0x1a9bd3,_0x341bb4){return db[_0xdb8c('0x2e')][_0xdb8c('0x4b')](_0x1a9bd3['body'],{})['then'](respondWithResult(_0x341bb4,0xc9))['catch'](handleError(_0x341bb4,null));};exports['update']=function(_0x2a9a85,_0x106f21){if(_0x2a9a85[_0xdb8c('0x4c')]['id']){delete _0x2a9a85[_0xdb8c('0x4c')]['id'];}return db['Dynamics365Configuration'][_0xdb8c('0x4a')]({'where':{'id':_0x2a9a85['params']['id']}})['then'](handleEntityNotFound(_0x106f21,null))[_0xdb8c('0x27')](saveUpdates(_0x2a9a85[_0xdb8c('0x4c')],null))['then'](respondWithResult(_0x106f21,null))[_0xdb8c('0x4d')](handleError(_0x106f21,null));};exports[_0xdb8c('0x4e')]=function(_0x57b1a5,_0x3d0291){return db[_0xdb8c('0x2e')]['find']({'where':{'id':_0x57b1a5['params']['id']}})['then'](handleEntityNotFound(_0x3d0291,null))[_0xdb8c('0x27')](removeEntity(_0x3d0291,null))[_0xdb8c('0x4d')](handleError(_0x3d0291,null));};exports[_0xdb8c('0x4f')]=function(_0x462d90,_0x76ab41,_0x4ec54a){var _0x5a8537={};var _0x4d1b39={};var _0x273b87;var _0x405143;return db[_0xdb8c('0x2e')]['findOne']({'where':{'id':_0x462d90['params']['id']}})[_0xdb8c('0x27')](handleEntityNotFound(_0x76ab41,null))['then'](function(_0x5244ac){if(_0x5244ac){_0x273b87=_0x5244ac;_0x4d1b39[_0xdb8c('0x33')]=_[_0xdb8c('0x36')](db[_0xdb8c('0x50')]['rawAttributes']);_0x4d1b39[_0xdb8c('0x35')]=_[_0xdb8c('0x36')](_0x462d90[_0xdb8c('0x35')]);_0x4d1b39[_0xdb8c('0x40')]=_[_0xdb8c('0x37')](_0x4d1b39[_0xdb8c('0x33')],_0x4d1b39['query']);_0x5a8537[_0xdb8c('0x38')]=_[_0xdb8c('0x37')](_0x4d1b39['model'],qs[_0xdb8c('0x39')](_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x39')]));_0x5a8537[_0xdb8c('0x38')]=_0x5a8537[_0xdb8c('0x38')][_0xdb8c('0x3a')]?_0x5a8537[_0xdb8c('0x38')]:_0x4d1b39[_0xdb8c('0x33')];_0x5a8537[_0xdb8c('0x3d')]=qs['sort'](_0x462d90[_0xdb8c('0x35')]['sort']);_0x5a8537[_0xdb8c('0x3f')]=qs[_0xdb8c('0x40')](_['pick'](_0x462d90[_0xdb8c('0x35')],_0x4d1b39[_0xdb8c('0x40')]));if(_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x42')]){_0x5a8537[_0xdb8c('0x3f')]=_[_0xdb8c('0x43')](_0x5a8537[_0xdb8c('0x3f')],{'$or':_[_0xdb8c('0x34')](_0x5a8537['attributes'],function(_0x4a7eb1){var _0x78b6b8={};_0x78b6b8[_0x4a7eb1]={'$like':'%'+_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x42')]+'%'};return _0x78b6b8;})});}_0x5a8537=_[_0xdb8c('0x43')]({},_0x5a8537,_0x462d90['options']);return _0x273b87[_0xdb8c('0x4f')](_0x5a8537);}})[_0xdb8c('0x27')](function(_0xcc57ee){if(_0xcc57ee){_0x405143=_0xcc57ee[_0xdb8c('0x3a')];if(!_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x3b')](_0xdb8c('0x3c'))){_0x5a8537[_0xdb8c('0x1e')]=qs[_0xdb8c('0x1e')](_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x1e')]);_0x5a8537['offset']=qs[_0xdb8c('0x20')](_0x462d90[_0xdb8c('0x35')][_0xdb8c('0x20')]);}return _0x273b87[_0xdb8c('0x4f')](_0x5a8537);}})[_0xdb8c('0x27')](function(_0xff53c6){if(_0xff53c6){return _0xff53c6?{'count':_0x405143,'rows':_0xff53c6}:null;}})[_0xdb8c('0x27')](respondWithResult(_0x76ab41,null))[_0xdb8c('0x4d')](handleError(_0x76ab41,null));};exports[_0xdb8c('0x51')]=function(_0xe080cc,_0x430a57,_0x58df01){var _0x3c4a13={};var _0x14ed5d={};var _0x52a002;var _0x1f5940;return db[_0xdb8c('0x2e')]['findOne']({'where':{'id':_0xe080cc['params']['id']}})[_0xdb8c('0x27')](handleEntityNotFound(_0x430a57,null))[_0xdb8c('0x27')](function(_0x606377){if(_0x606377){_0x52a002=_0x606377;_0x14ed5d[_0xdb8c('0x33')]=_[_0xdb8c('0x36')](db[_0xdb8c('0x50')]['rawAttributes']);_0x14ed5d['query']=_[_0xdb8c('0x36')](_0xe080cc[_0xdb8c('0x35')]);_0x14ed5d[_0xdb8c('0x40')]=_[_0xdb8c('0x37')](_0x14ed5d[_0xdb8c('0x33')],_0x14ed5d[_0xdb8c('0x35')]);_0x3c4a13[_0xdb8c('0x38')]=_[_0xdb8c('0x37')](_0x14ed5d[_0xdb8c('0x33')],qs['fields'](_0xe080cc[_0xdb8c('0x35')]['fields']));_0x3c4a13[_0xdb8c('0x38')]=_0x3c4a13[_0xdb8c('0x38')]['length']?_0x3c4a13[_0xdb8c('0x38')]:_0x14ed5d[_0xdb8c('0x33')];_0x3c4a13[_0xdb8c('0x3d')]=qs[_0xdb8c('0x3e')](_0xe080cc['query'][_0xdb8c('0x3e')]);_0x3c4a13[_0xdb8c('0x3f')]=qs[_0xdb8c('0x40')](_[_0xdb8c('0x41')](_0xe080cc[_0xdb8c('0x35')],_0x14ed5d[_0xdb8c('0x40')]));if(_0xe080cc[_0xdb8c('0x35')][_0xdb8c('0x42')]){_0x3c4a13[_0xdb8c('0x3f')]=_['merge'](_0x3c4a13[_0xdb8c('0x3f')],{'$or':_[_0xdb8c('0x34')](_0x3c4a13[_0xdb8c('0x38')],function(_0x1fdcf8){var _0x78ea37={};_0x78ea37[_0x1fdcf8]={'$like':'%'+_0xe080cc[_0xdb8c('0x35')][_0xdb8c('0x42')]+'%'};return _0x78ea37;})});}_0x3c4a13=_[_0xdb8c('0x43')]({},_0x3c4a13,_0xe080cc[_0xdb8c('0x45')]);return _0x52a002['getSubjects'](_0x3c4a13);}})[_0xdb8c('0x27')](function(_0x46982f){if(_0x46982f){_0x1f5940=_0x46982f['length'];if(!_0xe080cc[_0xdb8c('0x35')][_0xdb8c('0x3b')]('nolimit')){_0x3c4a13[_0xdb8c('0x1e')]=qs[_0xdb8c('0x1e')](_0xe080cc['query'][_0xdb8c('0x1e')]);_0x3c4a13[_0xdb8c('0x20')]=qs[_0xdb8c('0x20')](_0xe080cc['query'][_0xdb8c('0x20')]);}return _0x52a002[_0xdb8c('0x51')](_0x3c4a13);}})[_0xdb8c('0x27')](function(_0x8c18fa){if(_0x8c18fa){return _0x8c18fa?{'count':_0x1f5940,'rows':_0x8c18fa}:null;}})['then'](respondWithResult(_0x430a57,null))[_0xdb8c('0x4d')](handleError(_0x430a57,null));};exports[_0xdb8c('0x52')]=function(_0x160f4c,_0x25a79d,_0x2bcbcd){var _0x23995b={};var _0x48cb11={};var _0x5eda36;var _0x345dbc;return db[_0xdb8c('0x2e')][_0xdb8c('0x53')]({'where':{'id':_0x160f4c[_0xdb8c('0x49')]['id']}})[_0xdb8c('0x27')](handleEntityNotFound(_0x25a79d,null))[_0xdb8c('0x27')](function(_0xa7980e){if(_0xa7980e){_0x5eda36=_0xa7980e;_0x48cb11[_0xdb8c('0x33')]=_[_0xdb8c('0x36')](db[_0xdb8c('0x50')][_0xdb8c('0x2f')]);_0x48cb11['query']=_[_0xdb8c('0x36')](_0x160f4c[_0xdb8c('0x35')]);_0x48cb11[_0xdb8c('0x40')]=_['intersection'](_0x48cb11['model'],_0x48cb11[_0xdb8c('0x35')]);_0x23995b[_0xdb8c('0x38')]=_[_0xdb8c('0x37')](_0x48cb11[_0xdb8c('0x33')],qs[_0xdb8c('0x39')](_0x160f4c['query'][_0xdb8c('0x39')]));_0x23995b[_0xdb8c('0x38')]=_0x23995b[_0xdb8c('0x38')][_0xdb8c('0x3a')]?_0x23995b[_0xdb8c('0x38')]:_0x48cb11['model'];_0x23995b[_0xdb8c('0x3d')]=qs[_0xdb8c('0x3e')](_0x160f4c[_0xdb8c('0x35')][_0xdb8c('0x3e')]);_0x23995b[_0xdb8c('0x3f')]=qs[_0xdb8c('0x40')](_[_0xdb8c('0x41')](_0x160f4c['query'],_0x48cb11['filters']));if(_0x160f4c[_0xdb8c('0x35')][_0xdb8c('0x42')]){_0x23995b[_0xdb8c('0x3f')]=_['merge'](_0x23995b['where'],{'$or':_['map'](_0x23995b[_0xdb8c('0x38')],function(_0x588dc4){var _0x57df70={};_0x57df70[_0x588dc4]={'$like':'%'+_0x160f4c[_0xdb8c('0x35')]['filter']+'%'};return _0x57df70;})});}_0x23995b=_['merge']({},_0x23995b,_0x160f4c[_0xdb8c('0x45')]);return _0x5eda36[_0xdb8c('0x52')](_0x23995b);}})[_0xdb8c('0x27')](function(_0x20bb81){if(_0x20bb81){_0x345dbc=_0x20bb81[_0xdb8c('0x3a')];if(!_0x160f4c[_0xdb8c('0x35')][_0xdb8c('0x3b')]('nolimit')){_0x23995b[_0xdb8c('0x1e')]=qs[_0xdb8c('0x1e')](_0x160f4c[_0xdb8c('0x35')][_0xdb8c('0x1e')]);_0x23995b[_0xdb8c('0x20')]=qs[_0xdb8c('0x20')](_0x160f4c[_0xdb8c('0x35')]['offset']);}return _0x5eda36[_0xdb8c('0x52')](_0x23995b);}})[_0xdb8c('0x27')](function(_0x44d480){if(_0x44d480){return _0x44d480?{'count':_0x345dbc,'rows':_0x44d480}:null;}})[_0xdb8c('0x27')](respondWithResult(_0x25a79d,null))[_0xdb8c('0x4d')](handleError(_0x25a79d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1f9d606..bd89e3b 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x374320,_0x55464d){var _0x6a96c9=function(_0x3231a8){while(--_0x3231a8){_0x374320['push'](_0x374320['shift']());}};_0x6a96c9(++_0x55464d);}(_0xaa88,0x137));var _0x8aa8=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0xaa88[_0x47e309];return _0x2e1900;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x10a42c,_0x142b89){var _0x46b8ca=function(_0x526248){while(--_0x526248){_0x10a42c['push'](_0x10a42c['shift']());}};_0x46b8ca(++_0x142b89);}(_0xdace,0xc5));var _0xedac=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xdace[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 21a0691..9282fcb 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 _0xc796=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x40c763,_0x5386c0){var _0x14e3b6=function(_0x44f6dc){while(--_0x44f6dc){_0x40c763['push'](_0x40c763['shift']());}};_0x14e3b6(++_0x5386c0);}(_0xc796,0x1a3));var _0x6c79=function(_0xab0515,_0x4b8ab2){_0xab0515=_0xab0515-0x0;var _0x443d59=_0xc796[_0xab0515];return _0x443d59;};'use strict';var _=require(_0x6c79('0x0'));var util=require(_0x6c79('0x1'));var moment=require(_0x6c79('0x2'));var BPromise=require(_0x6c79('0x3'));var rs=require(_0x6c79('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c79('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c79('0x6'))('rpc');var config=require(_0x6c79('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c79('0x8')][_0x6c79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eeeda,_0x46246b,_0x8faa3b){return new BPromise(function(_0x5c6ab6,_0x1aaa74){return client['request'](_0x2eeeda,_0x8faa3b)['then'](function(_0x39b52a){logger[_0x6c79('0xa')](_0x6c79('0xb'),_0x46246b,_0x6c79('0xc'));logger[_0x6c79('0xd')](_0x6c79('0xe'),_0x46246b,_0x6c79('0xc'),JSON['stringify'](_0x39b52a));if(_0x39b52a[_0x6c79('0xf')]){if(_0x39b52a[_0x6c79('0xf')][_0x6c79('0x10')]===0x1f4){logger[_0x6c79('0xf')](_0x6c79('0xb'),_0x46246b,_0x39b52a['error'][_0x6c79('0x11')]);return _0x1aaa74(_0x39b52a[_0x6c79('0xf')][_0x6c79('0x11')]);}logger[_0x6c79('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46246b,_0x39b52a[_0x6c79('0xf')][_0x6c79('0x11')]);return _0x5c6ab6(_0x39b52a['error'][_0x6c79('0x11')]);}else{logger[_0x6c79('0xa')](_0x6c79('0xb'),_0x46246b,_0x6c79('0xc'));_0x5c6ab6(_0x39b52a['result'][_0x6c79('0x11')]);}})['catch'](function(_0x3096b5){logger[_0x6c79('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46246b,_0x3096b5);_0x1aaa74(_0x3096b5);});});} \ No newline at end of file +var _0x6086=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3cbe24,_0x4bd096){var _0x3a4aa6=function(_0x2675e8){while(--_0x2675e8){_0x3cbe24['push'](_0x3cbe24['shift']());}};_0x3a4aa6(++_0x4bd096);}(_0x6086,0xfc));var _0x6608=function(_0x50f123,_0x22053f){_0x50f123=_0x50f123-0x0;var _0x51fdd7=_0x6086[_0x50f123];return _0x51fdd7;};'use strict';var _=require(_0x6608('0x0'));var util=require(_0x6608('0x1'));var moment=require(_0x6608('0x2'));var BPromise=require(_0x6608('0x3'));var rs=require(_0x6608('0x4'));var fs=require('fs');var Redis=require(_0x6608('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6608('0x6'))(_0x6608('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6608('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370fbe,_0x6f2ce5,_0x38ca9a){return new BPromise(function(_0x5d6dc3,_0x789dd8){return client[_0x6608('0x9')](_0x370fbe,_0x38ca9a)['then'](function(_0x3250f9){logger[_0x6608('0xa')](_0x6608('0xb'),_0x6f2ce5,_0x6608('0xc'));logger[_0x6608('0xd')](_0x6608('0xe'),_0x6f2ce5,_0x6608('0xc'),JSON[_0x6608('0xf')](_0x3250f9));if(_0x3250f9[_0x6608('0x10')]){if(_0x3250f9[_0x6608('0x10')][_0x6608('0x11')]===0x1f4){logger[_0x6608('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x6f2ce5,_0x3250f9[_0x6608('0x10')]['message']);return _0x789dd8(_0x3250f9['error'][_0x6608('0x12')]);}logger[_0x6608('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x6f2ce5,_0x3250f9[_0x6608('0x10')]['message']);return _0x5d6dc3(_0x3250f9[_0x6608('0x10')]['message']);}else{logger['info'](_0x6608('0xb'),_0x6f2ce5,_0x6608('0xc'));_0x5d6dc3(_0x3250f9[_0x6608('0x13')][_0x6608('0x12')]);}})[_0x6608('0x14')](function(_0x1e88bd){logger[_0x6608('0x10')](_0x6608('0xb'),_0x6f2ce5,_0x1e88bd);_0x789dd8(_0x1e88bd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2a7bb7a..690cfe2 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 _0x8123=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x25e2a5,_0x2d7270){var _0x429243=function(_0x16853){while(--_0x16853){_0x25e2a5['push'](_0x25e2a5['shift']());}};_0x429243(++_0x2d7270);}(_0x8123,0x10d));var _0x3812=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x8123[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x3812('0x0'));var util=require(_0x3812('0x1'));var path=require('path');var timeout=require(_0x3812('0x2'));var express=require('express');var router=express[_0x3812('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3812('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x3812('0x5')]('/',auth[_0x3812('0x6')](),controller[_0x3812('0x7')]);router['get'](_0x3812('0x8'),auth[_0x3812('0x6')](),controller[_0x3812('0x9')]);router[_0x3812('0xa')]('/',auth[_0x3812('0x6')](),controller[_0x3812('0xb')]);router[_0x3812('0xc')](_0x3812('0x8'),auth[_0x3812('0x6')](),controller[_0x3812('0xd')]);router['delete'](_0x3812('0x8'),auth[_0x3812('0x6')](),controller[_0x3812('0xe')]);module[_0x3812('0xf')]=router; \ No newline at end of file +var _0xf99e=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x1e9e39,_0x62e4f9){var _0x4692b7=function(_0x15bb7e){while(--_0x15bb7e){_0x1e9e39['push'](_0x1e9e39['shift']());}};_0x4692b7(++_0x62e4f9);}(_0xf99e,0x6a));var _0xef99=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xf99e[_0x499210];return _0x2e153d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xef99('0x0'));var timeout=require(_0xef99('0x1'));var express=require('express');var router=express[_0xef99('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xef99('0x3'));var interaction=require(_0xef99('0x4'));var config=require('../../config/environment');var controller=require(_0xef99('0x5'));router[_0xef99('0x6')]('/',auth[_0xef99('0x7')](),controller['index']);router['get'](_0xef99('0x8'),auth[_0xef99('0x7')](),controller[_0xef99('0x9')]);router[_0xef99('0xa')]('/',auth[_0xef99('0x7')](),controller[_0xef99('0xb')]);router[_0xef99('0xc')]('/:id',auth[_0xef99('0x7')](),controller[_0xef99('0xd')]);router['delete']('/:id',auth[_0xef99('0x7')](),controller['destroy']);module[_0xef99('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2898dda..b71a928 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 _0xecc7=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xecc7,0x1df));var _0x7ecc=function(_0x5407ab,_0x1c4865){_0x5407ab=_0x5407ab-0x0;var _0x1d79e9=_0xecc7[_0x5407ab];return _0x1d79e9;};'use strict';var Sequelize=require('sequelize');module[_0x7ecc('0x0')]={'type':{'type':Sequelize[_0x7ecc('0x1')](_0x7ecc('0x2'),_0x7ecc('0x3'),_0x7ecc('0x4'),_0x7ecc('0x5'),_0x7ecc('0x6')),'defaultValue':_0x7ecc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7ecc('0x2'),_0x7ecc('0x3'),_0x7ecc('0x4'))},'keyContent':{'type':Sequelize[_0x7ecc('0x7')]},'idField':{'type':Sequelize[_0x7ecc('0x7')]},'nameField':{'type':Sequelize[_0x7ecc('0x7')]},'customField':{'type':Sequelize[_0x7ecc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ecc('0x7')]}}; \ No newline at end of file +var _0x9717=['string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','picklist'];(function(_0x341f66,_0x5e076b){var _0x8abe82=function(_0x19ca44){while(--_0x19ca44){_0x341f66['push'](_0x341f66['shift']());}};_0x8abe82(++_0x5e076b);}(_0x9717,0x133));var _0x7971=function(_0x58cf13,_0xe8d0c0){_0x58cf13=_0x58cf13-0x0;var _0x5372eb=_0x9717[_0x58cf13];return _0x5372eb;};'use strict';var Sequelize=require(_0x7971('0x0'));module['exports']={'type':{'type':Sequelize[_0x7971('0x1')]('string',_0x7971('0x2'),_0x7971('0x3'),'keyValue',_0x7971('0x4')),'defaultValue':_0x7971('0x5')},'content':{'type':Sequelize[_0x7971('0x6')]},'key':{'type':Sequelize[_0x7971('0x6')]},'keyType':{'type':Sequelize[_0x7971('0x1')]('string','variable',_0x7971('0x3'))},'keyContent':{'type':Sequelize[_0x7971('0x6')]},'idField':{'type':Sequelize[_0x7971('0x6')]},'nameField':{'type':Sequelize[_0x7971('0x6')]},'customField':{'type':Sequelize[_0x7971('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 19dce63..76fd01c 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 _0x63b3=['show','params','length','includeAll','find','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','end','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','Dynamics365Field','include','catch'];(function(_0x867f95,_0x43d423){var _0x4cd98d=function(_0x85348e){while(--_0x85348e){_0x867f95['push'](_0x867f95['shift']());}};_0x4cd98d(++_0x43d423);}(_0x63b3,0xdf));var _0x363b=function(_0x17cffd,_0x545117){_0x17cffd=_0x17cffd-0x0;var _0x9f0892=_0x63b3[_0x17cffd];return _0x9f0892;};'use strict';var emlformat=require(_0x363b('0x0'));var rimraf=require(_0x363b('0x1'));var zipdir=require(_0x363b('0x2'));var jsonpatch=require(_0x363b('0x3'));var rp=require(_0x363b('0x4'));var moment=require(_0x363b('0x5'));var BPromise=require(_0x363b('0x6'));var Mustache=require(_0x363b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x363b('0x8'));var _=require('lodash');var squel=require(_0x363b('0x9'));var crypto=require(_0x363b('0xa'));var jsforce=require(_0x363b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x363b('0xc'));var querystring=require(_0x363b('0xd'));var Papa=require(_0x363b('0xe'));var Redis=require('ioredis');var authService=require(_0x363b('0xf'));var qs=require(_0x363b('0x10'));var as=require(_0x363b('0x11'));var hardwareService=require(_0x363b('0x12'));var logger=require(_0x363b('0x13'))(_0x363b('0x14'));var utils=require(_0x363b('0x15'));var config=require(_0x363b('0x16'));var licenseUtil=require(_0x363b('0x17'));var db=require(_0x363b('0x18'))['db'];function respondWithStatusCode(_0xef3d00,_0x44dea0){_0x44dea0=_0x44dea0||0xcc;return function(_0xd9ca6f){if(_0xd9ca6f){return _0xef3d00['sendStatus'](_0x44dea0);}return _0xef3d00[_0x363b('0x19')](_0x44dea0)['end']();};}function respondWithResult(_0x8c89c5,_0x2edda4){_0x2edda4=_0x2edda4||0xc8;return function(_0x50b571){if(_0x50b571){return _0x8c89c5['status'](_0x2edda4)[_0x363b('0x1a')](_0x50b571);}};}function respondWithFilteredResult(_0x58df5f,_0xacd846){return function(_0x4c904c){if(_0x4c904c){var _0x2f07c3=typeof _0xacd846[_0x363b('0x1b')]===_0x363b('0x1c')&&typeof _0xacd846['limit']===_0x363b('0x1c');var _0x306b80=_0x4c904c[_0x363b('0x1d')];var _0x5566b2=_0x2f07c3?0x0:_0xacd846[_0x363b('0x1b')];var _0x961430=_0x2f07c3?_0x4c904c[_0x363b('0x1d')]:_0xacd846[_0x363b('0x1b')]+_0xacd846[_0x363b('0x1e')];var _0x381662;if(_0x961430>=_0x306b80){_0x961430=_0x306b80;_0x381662=0xc8;}else{_0x381662=0xce;}_0x58df5f[_0x363b('0x19')](_0x381662);return _0x58df5f[_0x363b('0x1f')]('Content-Range',_0x5566b2+'-'+_0x961430+'/'+_0x306b80)['json'](_0x4c904c);}return null;};}function patchUpdates(_0x2625da){return function(_0x40a25b){try{jsonpatch[_0x363b('0x20')](_0x40a25b,_0x2625da,!![]);}catch(_0x5b3d61){return BPromise[_0x363b('0x21')](_0x5b3d61);}return _0x40a25b[_0x363b('0x22')]();};}function saveUpdates(_0x4b20de,_0x5361b4){return function(_0x426750){if(_0x426750){return _0x426750['update'](_0x4b20de)['then'](function(_0x43d54e){return _0x43d54e;});}return null;};}function removeEntity(_0x5caac5,_0x2fbdcf){return function(_0x16bd06){if(_0x16bd06){return _0x16bd06[_0x363b('0x23')]()[_0x363b('0x24')](function(){_0x5caac5[_0x363b('0x19')](0xcc)[_0x363b('0x25')]();});}};}function handleEntityNotFound(_0x10cb8a,_0x4ec252){return function(_0x481931){if(!_0x481931){_0x10cb8a[_0x363b('0x26')](0x194);}return _0x481931;};}function handleError(_0xa617d6,_0x793653){_0x793653=_0x793653||0x1f4;return function(_0x15ff8f){logger[_0x363b('0x27')](_0x15ff8f['stack']);if(_0x15ff8f['name']){delete _0x15ff8f[_0x363b('0x28')];}_0xa617d6['status'](_0x793653)[_0x363b('0x29')](_0x15ff8f);};}exports['index']=function(_0x1a9ce7,_0x53912a){var _0x3dc0ca={},_0x318dd7={},_0x246a10={'count':0x0,'rows':[]};var _0x567b50=_[_0x363b('0x2a')](db['Dynamics365Field'][_0x363b('0x2b')],function(_0x4c9cee){return{'name':_0x4c9cee[_0x363b('0x2c')],'type':_0x4c9cee[_0x363b('0x2d')][_0x363b('0x2e')]};});_0x318dd7[_0x363b('0x2f')]=_[_0x363b('0x2a')](_0x567b50,_0x363b('0x28'));_0x318dd7[_0x363b('0x30')]=_[_0x363b('0x31')](_0x1a9ce7[_0x363b('0x30')]);_0x318dd7[_0x363b('0x32')]=_[_0x363b('0x33')](_0x318dd7[_0x363b('0x2f')],_0x318dd7['query']);_0x3dc0ca[_0x363b('0x34')]=_[_0x363b('0x33')](_0x318dd7[_0x363b('0x2f')],qs[_0x363b('0x35')](_0x1a9ce7[_0x363b('0x30')][_0x363b('0x35')]));_0x3dc0ca[_0x363b('0x34')]=_0x3dc0ca[_0x363b('0x34')]['length']?_0x3dc0ca['attributes']:_0x318dd7[_0x363b('0x2f')];if(!_0x1a9ce7[_0x363b('0x30')][_0x363b('0x36')](_0x363b('0x37'))){_0x3dc0ca[_0x363b('0x1e')]=qs['limit'](_0x1a9ce7['query'][_0x363b('0x1e')]);_0x3dc0ca[_0x363b('0x1b')]=qs[_0x363b('0x1b')](_0x1a9ce7[_0x363b('0x30')]['offset']);}_0x3dc0ca[_0x363b('0x38')]=qs[_0x363b('0x39')](_0x1a9ce7[_0x363b('0x30')][_0x363b('0x39')]);_0x3dc0ca['where']=qs['filters'](_['pick'](_0x1a9ce7[_0x363b('0x30')],_0x318dd7[_0x363b('0x32')]),_0x567b50);if(_0x1a9ce7['query'][_0x363b('0x3a')]){_0x3dc0ca[_0x363b('0x3b')]=_[_0x363b('0x3c')](_0x3dc0ca[_0x363b('0x3b')],{'$or':_['map'](_0x567b50,function(_0xe7ad27){if(_0xe7ad27['type']!=='VIRTUAL'){var _0x5a337c={};_0x5a337c[_0xe7ad27['name']]={'$like':'%'+_0x1a9ce7[_0x363b('0x30')][_0x363b('0x3a')]+'%'};return _0x5a337c;}})});}_0x3dc0ca=_[_0x363b('0x3c')]({},_0x3dc0ca,_0x1a9ce7[_0x363b('0x3d')]);var _0x5eab19={'where':_0x3dc0ca[_0x363b('0x3b')]};return db[_0x363b('0x3e')][_0x363b('0x1d')](_0x5eab19)[_0x363b('0x24')](function(_0x5b92b8){_0x246a10[_0x363b('0x1d')]=_0x5b92b8;if(_0x1a9ce7[_0x363b('0x30')]['includeAll']){_0x3dc0ca[_0x363b('0x3f')]=[{'all':!![]}];}return db[_0x363b('0x3e')]['findAll'](_0x3dc0ca);})[_0x363b('0x24')](function(_0x4ef699){_0x246a10['rows']=_0x4ef699;return _0x246a10;})[_0x363b('0x24')](respondWithFilteredResult(_0x53912a,_0x3dc0ca))[_0x363b('0x40')](handleError(_0x53912a,null));};exports[_0x363b('0x41')]=function(_0x3599c0,_0x58aedf){var _0x3fae4b={'raw':!![],'where':{'id':_0x3599c0[_0x363b('0x42')]['id']}},_0x17198a={};_0x17198a[_0x363b('0x2f')]=_[_0x363b('0x31')](db['Dynamics365Field'][_0x363b('0x2b')]);_0x17198a[_0x363b('0x30')]=_['keys'](_0x3599c0[_0x363b('0x30')]);_0x17198a[_0x363b('0x32')]=_['intersection'](_0x17198a[_0x363b('0x2f')],_0x17198a[_0x363b('0x30')]);_0x3fae4b[_0x363b('0x34')]=_[_0x363b('0x33')](_0x17198a['model'],qs['fields'](_0x3599c0['query'][_0x363b('0x35')]));_0x3fae4b[_0x363b('0x34')]=_0x3fae4b['attributes'][_0x363b('0x43')]?_0x3fae4b[_0x363b('0x34')]:_0x17198a[_0x363b('0x2f')];if(_0x3599c0[_0x363b('0x30')][_0x363b('0x44')]){_0x3fae4b[_0x363b('0x3f')]=[{'all':!![]}];}_0x3fae4b=_[_0x363b('0x3c')]({},_0x3fae4b,_0x3599c0['options']);return db[_0x363b('0x3e')][_0x363b('0x45')](_0x3fae4b)[_0x363b('0x24')](handleEntityNotFound(_0x58aedf,null))['then'](respondWithResult(_0x58aedf,null))[_0x363b('0x40')](handleError(_0x58aedf,null));};exports['create']=function(_0x3d79fb,_0x36690f){return db[_0x363b('0x3e')]['create'](_0x3d79fb['body'],{})['then'](respondWithResult(_0x36690f,0xc9))[_0x363b('0x40')](handleError(_0x36690f,null));};exports[_0x363b('0x46')]=function(_0x4c399a,_0x5f251e){if(_0x4c399a[_0x363b('0x47')]['id']){delete _0x4c399a['body']['id'];}return db['Dynamics365Field'][_0x363b('0x45')]({'where':{'id':_0x4c399a[_0x363b('0x42')]['id']}})[_0x363b('0x24')](handleEntityNotFound(_0x5f251e,null))[_0x363b('0x24')](saveUpdates(_0x4c399a[_0x363b('0x47')],null))['then'](respondWithResult(_0x5f251e,null))[_0x363b('0x40')](handleError(_0x5f251e,null));};exports['destroy']=function(_0x2c099e,_0x2e68a0){return db[_0x363b('0x3e')][_0x363b('0x45')]({'where':{'id':_0x2c099e[_0x363b('0x42')]['id']}})[_0x363b('0x24')](handleEntityNotFound(_0x2e68a0,null))[_0x363b('0x24')](removeEntity(_0x2e68a0,null))[_0x363b('0x40')](handleError(_0x2e68a0,null));}; \ No newline at end of file +var _0x3ad4=['offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','stack','name','send','map','Dynamics365Field','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0x8bb037,_0x9e448){var _0x21fc83=function(_0x33cf5f){while(--_0x33cf5f){_0x8bb037['push'](_0x8bb037['shift']());}};_0x21fc83(++_0x9e448);}(_0x3ad4,0x15f));var _0x43ad=function(_0x244f8a,_0x5d6b6b){_0x244f8a=_0x244f8a-0x0;var _0x410e61=_0x3ad4[_0x244f8a];return _0x410e61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x43ad('0x0'));var zipdir=require(_0x43ad('0x1'));var jsonpatch=require(_0x43ad('0x2'));var rp=require(_0x43ad('0x3'));var moment=require(_0x43ad('0x4'));var BPromise=require(_0x43ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x43ad('0x6'));var sox=require(_0x43ad('0x7'));var csv=require(_0x43ad('0x8'));var ejs=require(_0x43ad('0x9'));var fs=require('fs');var fs_extra=require(_0x43ad('0xa'));var _=require(_0x43ad('0xb'));var squel=require(_0x43ad('0xc'));var crypto=require(_0x43ad('0xd'));var jsforce=require(_0x43ad('0xe'));var deskjs=require(_0x43ad('0xf'));var toCsv=require(_0x43ad('0x8'));var querystring=require(_0x43ad('0x10'));var Papa=require(_0x43ad('0x11'));var Redis=require('ioredis');var authService=require(_0x43ad('0x12'));var qs=require(_0x43ad('0x13'));var as=require(_0x43ad('0x14'));var hardwareService=require(_0x43ad('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x43ad('0x16'));var config=require(_0x43ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x43ad('0x18'))['db'];function respondWithStatusCode(_0x4bc2f9,_0x2a9aa9){_0x2a9aa9=_0x2a9aa9||0xcc;return function(_0x4b9a6f){if(_0x4b9a6f){return _0x4bc2f9[_0x43ad('0x19')](_0x2a9aa9);}return _0x4bc2f9['status'](_0x2a9aa9)[_0x43ad('0x1a')]();};}function respondWithResult(_0x887dc1,_0x5a0dca){_0x5a0dca=_0x5a0dca||0xc8;return function(_0x15761f){if(_0x15761f){return _0x887dc1[_0x43ad('0x1b')](_0x5a0dca)[_0x43ad('0x1c')](_0x15761f);}};}function respondWithFilteredResult(_0x4d9aeb,_0x39c27e){return function(_0x517578){if(_0x517578){var _0x3ebee2=typeof _0x39c27e[_0x43ad('0x1d')]==='undefined'&&typeof _0x39c27e[_0x43ad('0x1e')]===_0x43ad('0x1f');var _0x131051=_0x517578[_0x43ad('0x20')];var _0x5c922d=_0x3ebee2?0x0:_0x39c27e[_0x43ad('0x1d')];var _0x3aea9a=_0x3ebee2?_0x517578[_0x43ad('0x20')]:_0x39c27e[_0x43ad('0x1d')]+_0x39c27e['limit'];var _0x3e3873;if(_0x3aea9a>=_0x131051){_0x3aea9a=_0x131051;_0x3e3873=0xc8;}else{_0x3e3873=0xce;}_0x4d9aeb['status'](_0x3e3873);return _0x4d9aeb['set'](_0x43ad('0x21'),_0x5c922d+'-'+_0x3aea9a+'/'+_0x131051)[_0x43ad('0x1c')](_0x517578);}return null;};}function patchUpdates(_0xc614f8){return function(_0x1ca0eb){try{jsonpatch[_0x43ad('0x22')](_0x1ca0eb,_0xc614f8,!![]);}catch(_0x214253){return BPromise[_0x43ad('0x23')](_0x214253);}return _0x1ca0eb[_0x43ad('0x24')]();};}function saveUpdates(_0x4a5106,_0x58a2ec){return function(_0x421eed){if(_0x421eed){return _0x421eed[_0x43ad('0x25')](_0x4a5106)[_0x43ad('0x26')](function(_0x238b2b){return _0x238b2b;});}return null;};}function removeEntity(_0x31102f,_0x490955){return function(_0x191a2a){if(_0x191a2a){return _0x191a2a['destroy']()[_0x43ad('0x26')](function(){_0x31102f[_0x43ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118cde,_0x32528e){return function(_0x593f8a){if(!_0x593f8a){_0x118cde[_0x43ad('0x19')](0x194);}return _0x593f8a;};}function handleError(_0x46c58e,_0x38e4d8){_0x38e4d8=_0x38e4d8||0x1f4;return function(_0x400f77){logger['error'](_0x400f77[_0x43ad('0x27')]);if(_0x400f77[_0x43ad('0x28')]){delete _0x400f77[_0x43ad('0x28')];}_0x46c58e[_0x43ad('0x1b')](_0x38e4d8)[_0x43ad('0x29')](_0x400f77);};}exports['index']=function(_0x2ac08d,_0x5074a6){var _0x1fe874={},_0x4fb101={},_0x483816={'count':0x0,'rows':[]};var _0xb06f6e=_[_0x43ad('0x2a')](db[_0x43ad('0x2b')]['rawAttributes'],function(_0x5b7e31){return{'name':_0x5b7e31[_0x43ad('0x2c')],'type':_0x5b7e31[_0x43ad('0x2d')][_0x43ad('0x2e')]};});_0x4fb101[_0x43ad('0x2f')]=_['map'](_0xb06f6e,_0x43ad('0x28'));_0x4fb101[_0x43ad('0x30')]=_[_0x43ad('0x31')](_0x2ac08d[_0x43ad('0x30')]);_0x4fb101['filters']=_[_0x43ad('0x32')](_0x4fb101[_0x43ad('0x2f')],_0x4fb101['query']);_0x1fe874[_0x43ad('0x33')]=_[_0x43ad('0x32')](_0x4fb101['model'],qs[_0x43ad('0x34')](_0x2ac08d[_0x43ad('0x30')][_0x43ad('0x34')]));_0x1fe874['attributes']=_0x1fe874['attributes'][_0x43ad('0x35')]?_0x1fe874[_0x43ad('0x33')]:_0x4fb101[_0x43ad('0x2f')];if(!_0x2ac08d[_0x43ad('0x30')][_0x43ad('0x36')](_0x43ad('0x37'))){_0x1fe874[_0x43ad('0x1e')]=qs[_0x43ad('0x1e')](_0x2ac08d[_0x43ad('0x30')][_0x43ad('0x1e')]);_0x1fe874[_0x43ad('0x1d')]=qs[_0x43ad('0x1d')](_0x2ac08d['query'][_0x43ad('0x1d')]);}_0x1fe874[_0x43ad('0x38')]=qs[_0x43ad('0x39')](_0x2ac08d[_0x43ad('0x30')][_0x43ad('0x39')]);_0x1fe874[_0x43ad('0x3a')]=qs[_0x43ad('0x3b')](_[_0x43ad('0x3c')](_0x2ac08d[_0x43ad('0x30')],_0x4fb101[_0x43ad('0x3b')]),_0xb06f6e);if(_0x2ac08d['query']['filter']){_0x1fe874[_0x43ad('0x3a')]=_['merge'](_0x1fe874['where'],{'$or':_['map'](_0xb06f6e,function(_0x586604){if(_0x586604[_0x43ad('0x2d')]!==_0x43ad('0x3d')){var _0x3297fb={};_0x3297fb[_0x586604['name']]={'$like':'%'+_0x2ac08d[_0x43ad('0x30')][_0x43ad('0x3e')]+'%'};return _0x3297fb;}})});}_0x1fe874=_[_0x43ad('0x3f')]({},_0x1fe874,_0x2ac08d['options']);var _0x53184d={'where':_0x1fe874[_0x43ad('0x3a')]};return db[_0x43ad('0x2b')]['count'](_0x53184d)[_0x43ad('0x26')](function(_0x196936){_0x483816[_0x43ad('0x20')]=_0x196936;if(_0x2ac08d[_0x43ad('0x30')]['includeAll']){_0x1fe874['include']=[{'all':!![]}];}return db[_0x43ad('0x2b')][_0x43ad('0x40')](_0x1fe874);})[_0x43ad('0x26')](function(_0x4ae6f4){_0x483816[_0x43ad('0x41')]=_0x4ae6f4;return _0x483816;})['then'](respondWithFilteredResult(_0x5074a6,_0x1fe874))[_0x43ad('0x42')](handleError(_0x5074a6,null));};exports[_0x43ad('0x43')]=function(_0x138413,_0x3b4173){var _0x5c5cef={'raw':!![],'where':{'id':_0x138413[_0x43ad('0x44')]['id']}},_0x7917ea={};_0x7917ea[_0x43ad('0x2f')]=_[_0x43ad('0x31')](db[_0x43ad('0x2b')][_0x43ad('0x45')]);_0x7917ea[_0x43ad('0x30')]=_[_0x43ad('0x31')](_0x138413[_0x43ad('0x30')]);_0x7917ea['filters']=_[_0x43ad('0x32')](_0x7917ea[_0x43ad('0x2f')],_0x7917ea[_0x43ad('0x30')]);_0x5c5cef[_0x43ad('0x33')]=_['intersection'](_0x7917ea['model'],qs[_0x43ad('0x34')](_0x138413[_0x43ad('0x30')][_0x43ad('0x34')]));_0x5c5cef[_0x43ad('0x33')]=_0x5c5cef[_0x43ad('0x33')][_0x43ad('0x35')]?_0x5c5cef[_0x43ad('0x33')]:_0x7917ea[_0x43ad('0x2f')];if(_0x138413[_0x43ad('0x30')][_0x43ad('0x46')]){_0x5c5cef['include']=[{'all':!![]}];}_0x5c5cef=_[_0x43ad('0x3f')]({},_0x5c5cef,_0x138413[_0x43ad('0x47')]);return db['Dynamics365Field'][_0x43ad('0x48')](_0x5c5cef)[_0x43ad('0x26')](handleEntityNotFound(_0x3b4173,null))['then'](respondWithResult(_0x3b4173,null))[_0x43ad('0x42')](handleError(_0x3b4173,null));};exports[_0x43ad('0x49')]=function(_0x5681df,_0x1f2495){return db[_0x43ad('0x2b')][_0x43ad('0x49')](_0x5681df[_0x43ad('0x4a')],{})[_0x43ad('0x26')](respondWithResult(_0x1f2495,0xc9))[_0x43ad('0x42')](handleError(_0x1f2495,null));};exports[_0x43ad('0x25')]=function(_0x394def,_0x41d7b5){if(_0x394def['body']['id']){delete _0x394def['body']['id'];}return db[_0x43ad('0x2b')][_0x43ad('0x48')]({'where':{'id':_0x394def[_0x43ad('0x44')]['id']}})[_0x43ad('0x26')](handleEntityNotFound(_0x41d7b5,null))[_0x43ad('0x26')](saveUpdates(_0x394def[_0x43ad('0x4a')],null))[_0x43ad('0x26')](respondWithResult(_0x41d7b5,null))[_0x43ad('0x42')](handleError(_0x41d7b5,null));};exports[_0x43ad('0x4b')]=function(_0x5ab221,_0x1aef25){return db[_0x43ad('0x2b')][_0x43ad('0x48')]({'where':{'id':_0x5ab221['params']['id']}})[_0x43ad('0x26')](handleEntityNotFound(_0x1aef25,null))[_0x43ad('0x26')](removeEntity(_0x1aef25,null))[_0x43ad('0x42')](handleError(_0x1aef25,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f989ddd..6524067 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 _0xcb8a=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes','exports'];(function(_0x400a4f,_0x302b31){var _0x2d0335=function(_0x3d0955){while(--_0x3d0955){_0x400a4f['push'](_0x400a4f['shift']());}};_0x2d0335(++_0x302b31);}(_0xcb8a,0xf3));var _0xacb8=function(_0x2d97ac,_0x41e63e){_0x2d97ac=_0x2d97ac-0x0;var _0x5acd9f=_0xcb8a[_0x2d97ac];return _0x5acd9f;};'use strict';var _=require('lodash');var util=require(_0xacb8('0x0'));var logger=require(_0xacb8('0x1'))(_0xacb8('0x2'));var moment=require(_0xacb8('0x3'));var BPromise=require(_0xacb8('0x4'));var rp=require(_0xacb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacb8('0x6'));var config=require('../../config/environment');var attributes=require(_0xacb8('0x7'));module[_0xacb8('0x8')]=function(_0x5830ed,_0x5a05f4){return _0x5830ed[_0xacb8('0x9')](_0xacb8('0xa'),attributes,{'tableName':_0xacb8('0xb'),'paranoid':![],'indexes':[{'name':_0xacb8('0xc'),'fields':['idField',_0xacb8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60bc=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x60bc,0x189));var _0xc60b=function(_0x4f9922,_0x5182d5){_0x4f9922=_0x4f9922-0x0;var _0x3d6a25=_0x60bc[_0x4f9922];return _0x3d6a25;};'use strict';var _=require(_0xc60b('0x0'));var util=require(_0xc60b('0x1'));var logger=require(_0xc60b('0x2'))(_0xc60b('0x3'));var moment=require('moment');var BPromise=require(_0xc60b('0x4'));var rp=require(_0xc60b('0x5'));var fs=require('fs');var path=require(_0xc60b('0x6'));var rimraf=require(_0xc60b('0x7'));var config=require(_0xc60b('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0xc60b('0x9')]=function(_0x4c8b0a,_0x4f5d3b){return _0x4c8b0a[_0xc60b('0xa')]('Dynamics365Field',attributes,{'tableName':_0xc60b('0xb'),'paranoid':![],'indexes':[{'name':_0xc60b('0xc'),'fields':['idField',_0xc60b('0xd')],'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 7e052c3..0698635 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 _0x60fb=['error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x60fb,0x1a8));var _0xb60f=function(_0x173172,_0x2e7b5f){_0x173172=_0x173172-0x0;var _0x50c018=_0x60fb[_0x173172];return _0x50c018;};'use strict';var _=require(_0xb60f('0x0'));var util=require('util');var moment=require(_0xb60f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb60f('0x2'));var fs=require('fs');var Redis=require(_0xb60f('0x3'));var db=require(_0xb60f('0x4'))['db'];var utils=require(_0xb60f('0x5'));var logger=require(_0xb60f('0x6'))(_0xb60f('0x7'));var config=require(_0xb60f('0x8'));var jayson=require(_0xb60f('0x9'));var client=jayson[_0xb60f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40609d,_0x3e8f7f,_0x52de1e){return new BPromise(function(_0x709f64,_0x55400d){return client[_0xb60f('0xb')](_0x40609d,_0x52de1e)[_0xb60f('0xc')](function(_0x17f654){logger[_0xb60f('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3e8f7f,_0xb60f('0xe'));logger[_0xb60f('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3e8f7f,_0xb60f('0xe'),JSON['stringify'](_0x17f654));if(_0x17f654[_0xb60f('0x10')]){if(_0x17f654[_0xb60f('0x10')][_0xb60f('0x11')]===0x1f4){logger[_0xb60f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3e8f7f,_0x17f654[_0xb60f('0x10')][_0xb60f('0x12')]);return _0x55400d(_0x17f654[_0xb60f('0x10')][_0xb60f('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3e8f7f,_0x17f654[_0xb60f('0x10')][_0xb60f('0x12')]);return _0x709f64(_0x17f654[_0xb60f('0x10')][_0xb60f('0x12')]);}else{logger[_0xb60f('0xd')](_0xb60f('0x13'),_0x3e8f7f,_0xb60f('0xe'));_0x709f64(_0x17f654[_0xb60f('0x14')][_0xb60f('0x12')]);}})[_0xb60f('0x15')](function(_0xa990d4){logger[_0xb60f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3e8f7f,_0xa990d4);_0x55400d(_0xa990d4);});});} \ No newline at end of file +var _0xb841=['rpc','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x57a10b,_0x51c54e){var _0x527632=function(_0x4a1ca5){while(--_0x4a1ca5){_0x57a10b['push'](_0x57a10b['shift']());}};_0x527632(++_0x51c54e);}(_0xb841,0x117));var _0x1b84=function(_0x1dcb35,_0x455f4f){_0x1dcb35=_0x1dcb35-0x0;var _0x523bd4=_0xb841[_0x1dcb35];return _0x523bd4;};'use strict';var _=require(_0x1b84('0x0'));var util=require(_0x1b84('0x1'));var moment=require(_0x1b84('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b84('0x3'));var fs=require('fs');var Redis=require(_0x1b84('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b84('0x5'));var logger=require(_0x1b84('0x6'))(_0x1b84('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b84('0x8'));var client=jayson[_0x1b84('0x9')][_0x1b84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53dd41,_0x40ef7b,_0x24d4b9){return new BPromise(function(_0x455772,_0x317db8){return client[_0x1b84('0xb')](_0x53dd41,_0x24d4b9)[_0x1b84('0xc')](function(_0x2b96b2){logger['info'](_0x1b84('0xd'),_0x40ef7b,_0x1b84('0xe'));logger[_0x1b84('0xf')](_0x1b84('0x10'),_0x40ef7b,_0x1b84('0xe'),JSON[_0x1b84('0x11')](_0x2b96b2));if(_0x2b96b2[_0x1b84('0x12')]){if(_0x2b96b2[_0x1b84('0x12')][_0x1b84('0x13')]===0x1f4){logger['error'](_0x1b84('0xd'),_0x40ef7b,_0x2b96b2['error'][_0x1b84('0x14')]);return _0x317db8(_0x2b96b2[_0x1b84('0x12')][_0x1b84('0x14')]);}logger[_0x1b84('0x12')](_0x1b84('0xd'),_0x40ef7b,_0x2b96b2[_0x1b84('0x12')][_0x1b84('0x14')]);return _0x455772(_0x2b96b2[_0x1b84('0x12')][_0x1b84('0x14')]);}else{logger[_0x1b84('0x15')](_0x1b84('0xd'),_0x40ef7b,_0x1b84('0xe'));_0x455772(_0x2b96b2['result'][_0x1b84('0x14')]);}})['catch'](function(_0x22e53e){logger[_0x1b84('0x12')](_0x1b84('0xd'),_0x40ef7b,_0x22e53e);_0x317db8(_0x22e53e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8076d0c..69a1cf2 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 _0xd65e=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0xd65e,0x9c));var _0xed65=function(_0x424746,_0x3eac28){_0x424746=_0x424746-0x0;var _0xe8b699=_0xd65e[_0x424746];return _0xe8b699;};'use strict';var multer=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var path=require(_0xed65('0x2'));var timeout=require('connect-timeout');var express=require(_0xed65('0x3'));var router=express[_0xed65('0x4')]();var fs_extra=require(_0xed65('0x5'));var auth=require(_0xed65('0x6'));var interaction=require(_0xed65('0x7'));var config=require('../../config/environment');var controller=require(_0xed65('0x8'));router[_0xed65('0x9')]('/',auth[_0xed65('0xa')](),controller[_0xed65('0xb')]);router['get']('/:id',auth[_0xed65('0xa')](),controller[_0xed65('0xc')]);router[_0xed65('0x9')]('/:id/configurations',auth[_0xed65('0xa')](),controller[_0xed65('0xd')]);router[_0xed65('0x9')](_0xed65('0xe'),auth[_0xed65('0xa')](),controller[_0xed65('0xf')]);router[_0xed65('0x10')]('/',auth[_0xed65('0xa')](),controller[_0xed65('0x11')]);router[_0xed65('0x10')](_0xed65('0x12'),auth[_0xed65('0xa')](),controller['addConfiguration']);router['put'](_0xed65('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xed65('0x14')]('/:id',auth[_0xed65('0xa')](),controller[_0xed65('0x15')]);module['exports']=router; \ No newline at end of file +var _0xee7c=['delete','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update'];(function(_0x35054a,_0xd2170f){var _0x3353e0=function(_0x370867){while(--_0x370867){_0x35054a['push'](_0x35054a['shift']());}};_0x3353e0(++_0xd2170f);}(_0xee7c,0x127));var _0xcee7=function(_0x4eefc8,_0x4b3a2d){_0x4eefc8=_0x4eefc8-0x0;var _0x2c661f=_0xee7c[_0x4eefc8];return _0x2c661f;};'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(_0xcee7('0x4'));var interaction=require(_0xcee7('0x5'));var config=require(_0xcee7('0x6'));var controller=require(_0xcee7('0x7'));router['get']('/',auth[_0xcee7('0x8')](),controller[_0xcee7('0x9')]);router[_0xcee7('0xa')](_0xcee7('0xb'),auth[_0xcee7('0x8')](),controller[_0xcee7('0xc')]);router[_0xcee7('0xa')](_0xcee7('0xd'),auth['isAuthenticated'](),controller[_0xcee7('0xe')]);router[_0xcee7('0xa')](_0xcee7('0xf'),auth['isAuthenticated'](),controller[_0xcee7('0x10')]);router[_0xcee7('0x11')]('/',auth[_0xcee7('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xcee7('0x12')]('/:id',auth[_0xcee7('0x8')](),controller[_0xcee7('0x13')]);router[_0xcee7('0x14')](_0xcee7('0xb'),auth[_0xcee7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index dd2e245..37afbe7 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 _0x8aad=['STRING','username','sequelize','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8aad,0x146));var _0xd8aa=function(_0x39bdc9,_0x4b87b0){_0x39bdc9=_0x39bdc9-0x0;var _0x3e0339=_0x8aad[_0x39bdc9];return _0x3e0339;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'apiKey':{'type':Sequelize[_0xd8aa('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfff0=['username','exports','STRING'];(function(_0x113982,_0x597be2){var _0x13ff92=function(_0x344be9){while(--_0x344be9){_0x113982['push'](_0x113982['shift']());}};_0x13ff92(++_0x597be2);}(_0xfff0,0x139));var _0x0fff=function(_0x36c114,_0x50f0a6){_0x36c114=_0x36c114-0x0;var _0x1f0721=_0xfff0[_0x36c114];return _0x1f0721;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c1f7dff..506952f 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 _0x33a1=['%s/%s','Basic\x20%s','base64','requester','agent','description','group','source','ticket_type','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskField','remoteUri','slice','substring','GET','format'];(function(_0xa99abd,_0x3ea6c2){var _0x16f824=function(_0x51af3f){while(--_0x51af3f){_0xa99abd['push'](_0xa99abd['shift']());}};_0x16f824(++_0x3ea6c2);}(_0x33a1,0x7c));var _0x133a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x33a1[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x133a('0x0'));var rimraf=require(_0x133a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x133a('0x2'));var Mustache=require(_0x133a('0x3'));var util=require(_0x133a('0x4'));var path=require('path');var sox=require(_0x133a('0x5'));var csv=require(_0x133a('0x6'));var ejs=require(_0x133a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x133a('0x8'));var squel=require(_0x133a('0x9'));var crypto=require(_0x133a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x133a('0xb'));var toCsv=require(_0x133a('0x6'));var querystring=require(_0x133a('0xc'));var Papa=require(_0x133a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x133a('0xe'));var hardwareService=require(_0x133a('0xf'));var logger=require(_0x133a('0x10'))(_0x133a('0x11'));var utils=require(_0x133a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x133a('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56ccca,_0x504181){_0x504181=_0x504181||0xcc;return function(_0x39c7b5){if(_0x39c7b5){return _0x56ccca['sendStatus'](_0x504181);}return _0x56ccca[_0x133a('0x14')](_0x504181)[_0x133a('0x15')]();};}function respondWithResult(_0x3ed1b1,_0x56a6dd){_0x56a6dd=_0x56a6dd||0xc8;return function(_0x5b8131){if(_0x5b8131){return _0x3ed1b1[_0x133a('0x14')](_0x56a6dd)[_0x133a('0x16')](_0x5b8131);}};}function respondWithFilteredResult(_0x587863,_0x1221bc){return function(_0x49066a){if(_0x49066a){var _0x4c95ea=typeof _0x1221bc['offset']===_0x133a('0x17')&&typeof _0x1221bc['limit']===_0x133a('0x17');var _0x3119bb=_0x49066a['count'];var _0xb91a9e=_0x4c95ea?0x0:_0x1221bc[_0x133a('0x18')];var _0x5483dc=_0x4c95ea?_0x49066a['count']:_0x1221bc[_0x133a('0x18')]+_0x1221bc['limit'];var _0x3084b5;if(_0x5483dc>=_0x3119bb){_0x5483dc=_0x3119bb;_0x3084b5=0xc8;}else{_0x3084b5=0xce;}_0x587863[_0x133a('0x14')](_0x3084b5);return _0x587863[_0x133a('0x19')](_0x133a('0x1a'),_0xb91a9e+'-'+_0x5483dc+'/'+_0x3119bb)[_0x133a('0x16')](_0x49066a);}return null;};}function patchUpdates(_0x5dcdd0){return function(_0x5deb69){try{jsonpatch[_0x133a('0x1b')](_0x5deb69,_0x5dcdd0,!![]);}catch(_0x3a4cba){return BPromise[_0x133a('0x1c')](_0x3a4cba);}return _0x5deb69[_0x133a('0x1d')]();};}function saveUpdates(_0x122405,_0xceda38){return function(_0x5cf4cb){if(_0x5cf4cb){return _0x5cf4cb['update'](_0x122405)['then'](function(_0x4a137c){return _0x4a137c;});}return null;};}function removeEntity(_0xa50e62,_0x63f401){return function(_0x1d4035){if(_0x1d4035){return _0x1d4035['destroy']()[_0x133a('0x1e')](function(){_0xa50e62[_0x133a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x201dce,_0x3ba968){return function(_0x4d1abd){if(!_0x4d1abd){_0x201dce[_0x133a('0x1f')](0x194);}return _0x4d1abd;};}function handleError(_0x2952f8,_0x935699){_0x935699=_0x935699||0x1f4;return function(_0x3d4ef7){logger[_0x133a('0x20')](_0x3d4ef7[_0x133a('0x21')]);if(_0x3d4ef7[_0x133a('0x22')]){delete _0x3d4ef7[_0x133a('0x22')];}_0x2952f8[_0x133a('0x14')](_0x935699)[_0x133a('0x23')](_0x3d4ef7);};}exports[_0x133a('0x24')]=function(_0x5b28c5,_0x294885){var _0x5413aa={},_0x1f3c7d={},_0x47bd6d={'count':0x0,'rows':[]};var _0x1f75da=_['map'](db[_0x133a('0x25')][_0x133a('0x26')],function(_0x380b2a){return{'name':_0x380b2a[_0x133a('0x27')],'type':_0x380b2a[_0x133a('0x28')][_0x133a('0x29')]};});_0x1f3c7d[_0x133a('0x2a')]=_[_0x133a('0x2b')](_0x1f75da,_0x133a('0x22'));_0x1f3c7d[_0x133a('0x2c')]=_[_0x133a('0x2d')](_0x5b28c5[_0x133a('0x2c')]);_0x1f3c7d[_0x133a('0x2e')]=_[_0x133a('0x2f')](_0x1f3c7d[_0x133a('0x2a')],_0x1f3c7d[_0x133a('0x2c')]);_0x5413aa[_0x133a('0x30')]=_[_0x133a('0x2f')](_0x1f3c7d[_0x133a('0x2a')],qs[_0x133a('0x31')](_0x5b28c5['query'][_0x133a('0x31')]));_0x5413aa[_0x133a('0x30')]=_0x5413aa[_0x133a('0x30')][_0x133a('0x32')]?_0x5413aa['attributes']:_0x1f3c7d[_0x133a('0x2a')];if(!_0x5b28c5[_0x133a('0x2c')][_0x133a('0x33')]('nolimit')){_0x5413aa[_0x133a('0x34')]=qs[_0x133a('0x34')](_0x5b28c5[_0x133a('0x2c')][_0x133a('0x34')]);_0x5413aa[_0x133a('0x18')]=qs[_0x133a('0x18')](_0x5b28c5[_0x133a('0x2c')][_0x133a('0x18')]);}_0x5413aa[_0x133a('0x35')]=qs[_0x133a('0x36')](_0x5b28c5['query'][_0x133a('0x36')]);_0x5413aa[_0x133a('0x37')]=qs[_0x133a('0x2e')](_[_0x133a('0x38')](_0x5b28c5[_0x133a('0x2c')],_0x1f3c7d['filters']),_0x1f75da);if(_0x5b28c5[_0x133a('0x2c')][_0x133a('0x39')]){_0x5413aa['where']=_[_0x133a('0x3a')](_0x5413aa[_0x133a('0x37')],{'$or':_['map'](_0x1f75da,function(_0xb06cf4){if(_0xb06cf4[_0x133a('0x28')]!==_0x133a('0x3b')){var _0x51c1aa={};_0x51c1aa[_0xb06cf4[_0x133a('0x22')]]={'$like':'%'+_0x5b28c5[_0x133a('0x2c')][_0x133a('0x39')]+'%'};return _0x51c1aa;}})});}_0x5413aa=_[_0x133a('0x3a')]({},_0x5413aa,_0x5b28c5['options']);var _0x55b286={'where':_0x5413aa[_0x133a('0x37')]};return db[_0x133a('0x25')][_0x133a('0x3c')](_0x55b286)['then'](function(_0x14d76a){_0x47bd6d['count']=_0x14d76a;if(_0x5b28c5['query'][_0x133a('0x3d')]){_0x5413aa[_0x133a('0x3e')]=[{'all':!![]}];}return db[_0x133a('0x25')][_0x133a('0x3f')](_0x5413aa);})[_0x133a('0x1e')](function(_0x3dd5a5){_0x47bd6d[_0x133a('0x40')]=_0x3dd5a5;return _0x47bd6d;})[_0x133a('0x1e')](respondWithFilteredResult(_0x294885,_0x5413aa))[_0x133a('0x41')](handleError(_0x294885,null));};exports['show']=function(_0x57586f,_0x55bdd2){var _0x17cba4={'raw':![],'where':{'id':_0x57586f[_0x133a('0x42')]['id']}},_0x13afe4={};_0x13afe4[_0x133a('0x2a')]=_[_0x133a('0x2d')](db[_0x133a('0x25')][_0x133a('0x26')]);_0x13afe4['query']=_[_0x133a('0x2d')](_0x57586f[_0x133a('0x2c')]);_0x13afe4[_0x133a('0x2e')]=_['intersection'](_0x13afe4['model'],_0x13afe4[_0x133a('0x2c')]);_0x17cba4['attributes']=_[_0x133a('0x2f')](_0x13afe4[_0x133a('0x2a')],qs[_0x133a('0x31')](_0x57586f['query']['fields']));_0x17cba4[_0x133a('0x30')]=_0x17cba4[_0x133a('0x30')]['length']?_0x17cba4[_0x133a('0x30')]:_0x13afe4[_0x133a('0x2a')];if(_0x57586f['query']['includeAll']){_0x17cba4['include']=[{'all':!![]}];}_0x17cba4=_[_0x133a('0x3a')]({},_0x17cba4,_0x57586f[_0x133a('0x43')]);return db[_0x133a('0x25')][_0x133a('0x44')](_0x17cba4)[_0x133a('0x1e')](handleEntityNotFound(_0x55bdd2,null))[_0x133a('0x1e')](respondWithResult(_0x55bdd2,null))[_0x133a('0x41')](handleError(_0x55bdd2,null));};exports['create']=function(_0x3d35d3,_0x2c9992){return db['FreshdeskAccount'][_0x133a('0x45')](_0x3d35d3[_0x133a('0x46')],{})[_0x133a('0x1e')](respondWithResult(_0x2c9992,0xc9))['catch'](handleError(_0x2c9992,null));};exports['update']=function(_0x46f12b,_0x3f868d){if(_0x46f12b['body']['id']){delete _0x46f12b[_0x133a('0x46')]['id'];}return db[_0x133a('0x25')][_0x133a('0x44')]({'where':{'id':_0x46f12b[_0x133a('0x42')]['id']}})[_0x133a('0x1e')](handleEntityNotFound(_0x3f868d,null))[_0x133a('0x1e')](saveUpdates(_0x46f12b[_0x133a('0x46')],null))['then'](respondWithResult(_0x3f868d,null))[_0x133a('0x41')](handleError(_0x3f868d,null));};exports[_0x133a('0x47')]=function(_0x295b55,_0x3fa32d){return db['FreshdeskAccount'][_0x133a('0x44')]({'where':{'id':_0x295b55['params']['id']}})[_0x133a('0x1e')](handleEntityNotFound(_0x3fa32d,null))[_0x133a('0x1e')](removeEntity(_0x3fa32d,null))[_0x133a('0x41')](handleError(_0x3fa32d,null));};exports[_0x133a('0x48')]=function(_0x297bb3,_0x457e28,_0x1d1f89){var _0x2fe365={};var _0xbdc574={};var _0x2549ca;var _0x216aad;return db[_0x133a('0x25')][_0x133a('0x49')]({'where':{'id':_0x297bb3[_0x133a('0x42')]['id']}})[_0x133a('0x1e')](handleEntityNotFound(_0x457e28,null))['then'](function(_0x1d1bfa){if(_0x1d1bfa){_0x2549ca=_0x1d1bfa;_0xbdc574['model']=_[_0x133a('0x2d')](db[_0x133a('0x4a')][_0x133a('0x26')]);_0xbdc574['query']=_[_0x133a('0x2d')](_0x297bb3[_0x133a('0x2c')]);_0xbdc574['filters']=_['intersection'](_0xbdc574[_0x133a('0x2a')],_0xbdc574[_0x133a('0x2c')]);_0x2fe365['attributes']=_['intersection'](_0xbdc574[_0x133a('0x2a')],qs[_0x133a('0x31')](_0x297bb3[_0x133a('0x2c')]['fields']));_0x2fe365[_0x133a('0x30')]=_0x2fe365[_0x133a('0x30')]['length']?_0x2fe365[_0x133a('0x30')]:_0xbdc574['model'];_0x2fe365[_0x133a('0x35')]=qs[_0x133a('0x36')](_0x297bb3[_0x133a('0x2c')]['sort']);_0x2fe365[_0x133a('0x37')]=qs['filters'](_[_0x133a('0x38')](_0x297bb3[_0x133a('0x2c')],_0xbdc574[_0x133a('0x2e')]));if(_0x297bb3[_0x133a('0x2c')][_0x133a('0x39')]){_0x2fe365['where']=_[_0x133a('0x3a')](_0x2fe365[_0x133a('0x37')],{'$or':_['map'](_0x2fe365[_0x133a('0x30')],function(_0x2048e6){var _0x4421fa={};_0x4421fa[_0x2048e6]={'$like':'%'+_0x297bb3['query'][_0x133a('0x39')]+'%'};return _0x4421fa;})});}_0x2fe365=_['merge']({},_0x2fe365,_0x297bb3[_0x133a('0x43')]);return _0x2549ca[_0x133a('0x48')](_0x2fe365);}})['then'](function(_0x22a768){if(_0x22a768){_0x216aad=_0x22a768[_0x133a('0x32')];if(!_0x297bb3[_0x133a('0x2c')][_0x133a('0x33')]('nolimit')){_0x2fe365[_0x133a('0x34')]=qs[_0x133a('0x34')](_0x297bb3[_0x133a('0x2c')][_0x133a('0x34')]);_0x2fe365['offset']=qs['offset'](_0x297bb3[_0x133a('0x2c')]['offset']);}return _0x2549ca[_0x133a('0x48')](_0x2fe365);}})[_0x133a('0x1e')](function(_0x3bfece){if(_0x3bfece){return _0x3bfece?{'count':_0x216aad,'rows':_0x3bfece}:null;}})[_0x133a('0x1e')](respondWithResult(_0x457e28,null))[_0x133a('0x41')](handleError(_0x457e28,null));};exports[_0x133a('0x4b')]=function(_0x50d0de,_0x24ecc0,_0x1bb45c){if(_0x50d0de[_0x133a('0x46')]['id']){delete _0x50d0de['body']['id'];}return db[_0x133a('0x25')][_0x133a('0x49')]({'where':{'id':_0x50d0de['params']['id']}})[_0x133a('0x1e')](handleEntityNotFound(_0x24ecc0,null))[_0x133a('0x1e')](function(_0x1ea3f4){if(_0x1ea3f4){_0x50d0de[_0x133a('0x46')]['AccountId']=_0x1ea3f4['id'];_0x50d0de['body'][_0x133a('0x4c')]=integrations[_0x133a('0x4d')](_0x50d0de[_0x133a('0x46')][_0x133a('0x4e')],_0x50d0de['body'][_0x133a('0x28')]);_0x50d0de['body'][_0x133a('0x4f')]=integrations['getDescriptions'](_0x50d0de[_0x133a('0x46')][_0x133a('0x4e')],_0x50d0de[_0x133a('0x46')]['type']);return db['FreshdeskConfiguration'][_0x133a('0x45')](_0x50d0de[_0x133a('0x46')],{'include':[{'model':db[_0x133a('0x50')],'as':_0x133a('0x4c')},{'model':db['FreshdeskField'],'as':_0x133a('0x4f')}]});}return null;})[_0x133a('0x1e')](respondWithResult(_0x24ecc0,null))['catch'](handleError(_0x24ecc0,null));};exports['getFields']=function(_0x2dc7e5,_0x1a5884,_0x3c1c86){var _0x33773e='';return db['FreshdeskAccount'][_0x133a('0x49')]({'where':{'id':_0x2dc7e5['params']['id']},'attributes':['id',_0x133a('0x51'),'apiKey']})[_0x133a('0x1e')](handleEntityNotFound(_0x1a5884,null))[_0x133a('0x1e')](function(_0x46e8cb){if(_0x46e8cb){_0x33773e=_0x46e8cb[_0x133a('0x51')];var _0x2a05ed=_0x33773e[_0x133a('0x52')](-0x1);if(_0x2a05ed==='/'){_0x33773e=_0x33773e[_0x133a('0x53')](0x0,_0x33773e['lastIndexOf'](_0x2a05ed));}return rp({'method':_0x133a('0x54'),'uri':util[_0x133a('0x55')](_0x133a('0x56'),_0x33773e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x133a('0x55')](_0x133a('0x57'),new Buffer(util[_0x133a('0x55')]('%s:X',_0x46e8cb['apiKey']))['toString'](_0x133a('0x58')))},'json':!![]});}})[_0x133a('0x1e')](function(_0x24e68f){if(_0x24e68f){var _0x47be30=[_0x133a('0x59'),'subject',_0x133a('0x5a'),_0x133a('0x5b'),_0x133a('0x14'),'priority',_0x133a('0x5c'),_0x133a('0x5d'),_0x133a('0x5e'),_0x133a('0x5c'),'company'];_['remove'](_0x24e68f,function(_0x55fd0e){return _0x47be30[_0x133a('0x5f')](_0x55fd0e[_0x133a('0x22')])||!_0x55fd0e[_0x133a('0x60')]&&_0x55fd0e[_0x133a('0x28')]!=='custom_text'&&_0x55fd0e[_0x133a('0x28')]!==_0x133a('0x61');});return{'count':_0x24e68f['length'],'rows':_[_0x133a('0x2b')](_0x24e68f,function(_0x7c4d0d){return{'id':_0x7c4d0d['name'],'name':_0x7c4d0d[_0x133a('0x62')],'custom':!_0x7c4d0d['default'],'options':_0x7c4d0d[_0x133a('0x63')]?_[_0x133a('0x2b')](_0x7c4d0d[_0x133a('0x63')],function(_0x1012da){return{'name':_[_0x133a('0x64')](_0x1012da),'value':_0x1012da};}):[]};})};}})[_0x133a('0x1e')](respondWithResult(_0x1a5884,null))['catch'](function(_0x4130ac){var _0x5d7e28=_0x2dc7e5[_0x133a('0x2c')][_0x133a('0x65')]?0x1f4:_0x4130ac[_0x133a('0x66')]||0x1f4;logger[_0x133a('0x20')](_0x133a('0x67'),'getFields',_0x5d7e28,JSON[_0x133a('0x68')](_0x4130ac));delete _0x4130ac[_0x133a('0x22')];if(_0x5d7e28===0x191){_0x5d7e28=0x190;}_0x1a5884['status'](_0x5d7e28)['send'](_0x2dc7e5[_0x133a('0x2c')][_0x133a('0x65')]?{'message':'Wrong\x20credentials','statusCode':_0x4130ac['statusCode']}:_0x4130ac);});}; \ No newline at end of file +var _0xb350=['stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','FreshdeskAccount','includeAll','include','rows','catch','show','params','length','body','find','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','base64','requester','subject','agent','description','priority','group','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x4dec3b,_0x1acb3d){var _0x76fe18=function(_0x5f5b17){while(--_0x5f5b17){_0x4dec3b['push'](_0x4dec3b['shift']());}};_0x76fe18(++_0x1acb3d);}(_0xb350,0x6f));var _0x0b35=function(_0x4431c3,_0x32b598){_0x4431c3=_0x4431c3-0x0;var _0x5f1caf=_0xb350[_0x4431c3];return _0x5f1caf;};'use strict';var emlformat=require(_0x0b35('0x0'));var rimraf=require(_0x0b35('0x1'));var zipdir=require(_0x0b35('0x2'));var jsonpatch=require(_0x0b35('0x3'));var rp=require('request-promise');var moment=require(_0x0b35('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b35('0x5'));var util=require('util');var path=require(_0x0b35('0x6'));var sox=require(_0x0b35('0x7'));var csv=require(_0x0b35('0x8'));var ejs=require(_0x0b35('0x9'));var fs=require('fs');var fs_extra=require(_0x0b35('0xa'));var _=require(_0x0b35('0xb'));var squel=require(_0x0b35('0xc'));var crypto=require(_0x0b35('0xd'));var jsforce=require(_0x0b35('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0b35('0xf'));var Papa=require(_0x0b35('0x10'));var Redis=require(_0x0b35('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b35('0x12'));var hardwareService=require(_0x0b35('0x13'));var logger=require(_0x0b35('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0b35('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b35('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4748f2,_0x5e39cd){_0x5e39cd=_0x5e39cd||0xcc;return function(_0x4ff93f){if(_0x4ff93f){return _0x4748f2['sendStatus'](_0x5e39cd);}return _0x4748f2[_0x0b35('0x17')](_0x5e39cd)[_0x0b35('0x18')]();};}function respondWithResult(_0x169b36,_0x3064ea){_0x3064ea=_0x3064ea||0xc8;return function(_0x2c0872){if(_0x2c0872){return _0x169b36[_0x0b35('0x17')](_0x3064ea)[_0x0b35('0x19')](_0x2c0872);}};}function respondWithFilteredResult(_0x373263,_0x568f37){return function(_0x6b1c41){if(_0x6b1c41){var _0x4cb4f2=typeof _0x568f37[_0x0b35('0x1a')]===_0x0b35('0x1b')&&typeof _0x568f37[_0x0b35('0x1c')]===_0x0b35('0x1b');var _0x538b93=_0x6b1c41['count'];var _0xaf50b=_0x4cb4f2?0x0:_0x568f37[_0x0b35('0x1a')];var _0x154688=_0x4cb4f2?_0x6b1c41[_0x0b35('0x1d')]:_0x568f37[_0x0b35('0x1a')]+_0x568f37['limit'];var _0x29312d;if(_0x154688>=_0x538b93){_0x154688=_0x538b93;_0x29312d=0xc8;}else{_0x29312d=0xce;}_0x373263[_0x0b35('0x17')](_0x29312d);return _0x373263[_0x0b35('0x1e')]('Content-Range',_0xaf50b+'-'+_0x154688+'/'+_0x538b93)[_0x0b35('0x19')](_0x6b1c41);}return null;};}function patchUpdates(_0x563f8a){return function(_0x115196){try{jsonpatch['apply'](_0x115196,_0x563f8a,!![]);}catch(_0x9eec22){return BPromise['reject'](_0x9eec22);}return _0x115196['save']();};}function saveUpdates(_0x514201,_0x51e907){return function(_0x370104){if(_0x370104){return _0x370104[_0x0b35('0x1f')](_0x514201)[_0x0b35('0x20')](function(_0x5361d6){return _0x5361d6;});}return null;};}function removeEntity(_0x224c71,_0x2ce7ba){return function(_0x212736){if(_0x212736){return _0x212736[_0x0b35('0x21')]()[_0x0b35('0x20')](function(){_0x224c71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5daa42,_0x31ea3b){return function(_0x4d3517){if(!_0x4d3517){_0x5daa42[_0x0b35('0x22')](0x194);}return _0x4d3517;};}function handleError(_0x5a63f3,_0x17f21b){_0x17f21b=_0x17f21b||0x1f4;return function(_0x7f4750){logger[_0x0b35('0x23')](_0x7f4750[_0x0b35('0x24')]);if(_0x7f4750[_0x0b35('0x25')]){delete _0x7f4750[_0x0b35('0x25')];}_0x5a63f3[_0x0b35('0x17')](_0x17f21b)[_0x0b35('0x26')](_0x7f4750);};}exports[_0x0b35('0x27')]=function(_0x40061a,_0x58038e){var _0x156f25={},_0x326c7c={},_0x3cb374={'count':0x0,'rows':[]};var _0x339096=_[_0x0b35('0x28')](db['FreshdeskAccount'][_0x0b35('0x29')],function(_0x1b90b2){return{'name':_0x1b90b2['fieldName'],'type':_0x1b90b2['type'][_0x0b35('0x2a')]};});_0x326c7c['model']=_[_0x0b35('0x28')](_0x339096,_0x0b35('0x25'));_0x326c7c[_0x0b35('0x2b')]=_[_0x0b35('0x2c')](_0x40061a[_0x0b35('0x2b')]);_0x326c7c[_0x0b35('0x2d')]=_[_0x0b35('0x2e')](_0x326c7c['model'],_0x326c7c[_0x0b35('0x2b')]);_0x156f25[_0x0b35('0x2f')]=_[_0x0b35('0x2e')](_0x326c7c['model'],qs[_0x0b35('0x30')](_0x40061a[_0x0b35('0x2b')][_0x0b35('0x30')]));_0x156f25[_0x0b35('0x2f')]=_0x156f25[_0x0b35('0x2f')]['length']?_0x156f25['attributes']:_0x326c7c[_0x0b35('0x31')];if(!_0x40061a[_0x0b35('0x2b')][_0x0b35('0x32')](_0x0b35('0x33'))){_0x156f25[_0x0b35('0x1c')]=qs['limit'](_0x40061a[_0x0b35('0x2b')][_0x0b35('0x1c')]);_0x156f25[_0x0b35('0x1a')]=qs[_0x0b35('0x1a')](_0x40061a[_0x0b35('0x2b')][_0x0b35('0x1a')]);}_0x156f25[_0x0b35('0x34')]=qs[_0x0b35('0x35')](_0x40061a[_0x0b35('0x2b')]['sort']);_0x156f25['where']=qs[_0x0b35('0x2d')](_['pick'](_0x40061a[_0x0b35('0x2b')],_0x326c7c[_0x0b35('0x2d')]),_0x339096);if(_0x40061a[_0x0b35('0x2b')][_0x0b35('0x36')]){_0x156f25[_0x0b35('0x37')]=_[_0x0b35('0x38')](_0x156f25['where'],{'$or':_['map'](_0x339096,function(_0x3af9af){if(_0x3af9af[_0x0b35('0x39')]!==_0x0b35('0x3a')){var _0x2ecb1e={};_0x2ecb1e[_0x3af9af[_0x0b35('0x25')]]={'$like':'%'+_0x40061a[_0x0b35('0x2b')][_0x0b35('0x36')]+'%'};return _0x2ecb1e;}})});}_0x156f25=_['merge']({},_0x156f25,_0x40061a[_0x0b35('0x3b')]);var _0x15af52={'where':_0x156f25[_0x0b35('0x37')]};return db[_0x0b35('0x3c')]['count'](_0x15af52)[_0x0b35('0x20')](function(_0x230e52){_0x3cb374[_0x0b35('0x1d')]=_0x230e52;if(_0x40061a['query'][_0x0b35('0x3d')]){_0x156f25[_0x0b35('0x3e')]=[{'all':!![]}];}return db[_0x0b35('0x3c')]['findAll'](_0x156f25);})['then'](function(_0x48e1ba){_0x3cb374[_0x0b35('0x3f')]=_0x48e1ba;return _0x3cb374;})['then'](respondWithFilteredResult(_0x58038e,_0x156f25))[_0x0b35('0x40')](handleError(_0x58038e,null));};exports[_0x0b35('0x41')]=function(_0x443982,_0xb04c0c){var _0x516316={'raw':![],'where':{'id':_0x443982[_0x0b35('0x42')]['id']}},_0x32ec91={};_0x32ec91[_0x0b35('0x31')]=_[_0x0b35('0x2c')](db[_0x0b35('0x3c')][_0x0b35('0x29')]);_0x32ec91[_0x0b35('0x2b')]=_['keys'](_0x443982[_0x0b35('0x2b')]);_0x32ec91[_0x0b35('0x2d')]=_[_0x0b35('0x2e')](_0x32ec91[_0x0b35('0x31')],_0x32ec91['query']);_0x516316[_0x0b35('0x2f')]=_[_0x0b35('0x2e')](_0x32ec91[_0x0b35('0x31')],qs[_0x0b35('0x30')](_0x443982[_0x0b35('0x2b')]['fields']));_0x516316[_0x0b35('0x2f')]=_0x516316[_0x0b35('0x2f')][_0x0b35('0x43')]?_0x516316['attributes']:_0x32ec91[_0x0b35('0x31')];if(_0x443982[_0x0b35('0x2b')]['includeAll']){_0x516316[_0x0b35('0x3e')]=[{'all':!![]}];}_0x516316=_['merge']({},_0x516316,_0x443982[_0x0b35('0x3b')]);return db[_0x0b35('0x3c')]['find'](_0x516316)['then'](handleEntityNotFound(_0xb04c0c,null))[_0x0b35('0x20')](respondWithResult(_0xb04c0c,null))[_0x0b35('0x40')](handleError(_0xb04c0c,null));};exports['create']=function(_0x5320fe,_0xcb64a5){return db['FreshdeskAccount']['create'](_0x5320fe[_0x0b35('0x44')],{})[_0x0b35('0x20')](respondWithResult(_0xcb64a5,0xc9))[_0x0b35('0x40')](handleError(_0xcb64a5,null));};exports[_0x0b35('0x1f')]=function(_0x7f1df2,_0x173356){if(_0x7f1df2[_0x0b35('0x44')]['id']){delete _0x7f1df2['body']['id'];}return db[_0x0b35('0x3c')][_0x0b35('0x45')]({'where':{'id':_0x7f1df2[_0x0b35('0x42')]['id']}})[_0x0b35('0x20')](handleEntityNotFound(_0x173356,null))[_0x0b35('0x20')](saveUpdates(_0x7f1df2['body'],null))[_0x0b35('0x20')](respondWithResult(_0x173356,null))[_0x0b35('0x40')](handleError(_0x173356,null));};exports[_0x0b35('0x21')]=function(_0x3105c1,_0x18ec34){return db[_0x0b35('0x3c')][_0x0b35('0x45')]({'where':{'id':_0x3105c1[_0x0b35('0x42')]['id']}})[_0x0b35('0x20')](handleEntityNotFound(_0x18ec34,null))[_0x0b35('0x20')](removeEntity(_0x18ec34,null))[_0x0b35('0x40')](handleError(_0x18ec34,null));};exports[_0x0b35('0x46')]=function(_0x228af5,_0x496a41,_0x13d6ec){var _0x31abab={};var _0x151b51={};var _0x165880;var _0x2fd586;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x228af5[_0x0b35('0x42')]['id']}})[_0x0b35('0x20')](handleEntityNotFound(_0x496a41,null))['then'](function(_0x3f41da){if(_0x3f41da){_0x165880=_0x3f41da;_0x151b51[_0x0b35('0x31')]=_[_0x0b35('0x2c')](db[_0x0b35('0x47')]['rawAttributes']);_0x151b51[_0x0b35('0x2b')]=_[_0x0b35('0x2c')](_0x228af5['query']);_0x151b51['filters']=_[_0x0b35('0x2e')](_0x151b51['model'],_0x151b51[_0x0b35('0x2b')]);_0x31abab[_0x0b35('0x2f')]=_['intersection'](_0x151b51[_0x0b35('0x31')],qs[_0x0b35('0x30')](_0x228af5[_0x0b35('0x2b')][_0x0b35('0x30')]));_0x31abab[_0x0b35('0x2f')]=_0x31abab['attributes'][_0x0b35('0x43')]?_0x31abab[_0x0b35('0x2f')]:_0x151b51[_0x0b35('0x31')];_0x31abab[_0x0b35('0x34')]=qs[_0x0b35('0x35')](_0x228af5['query'][_0x0b35('0x35')]);_0x31abab[_0x0b35('0x37')]=qs[_0x0b35('0x2d')](_['pick'](_0x228af5['query'],_0x151b51['filters']));if(_0x228af5[_0x0b35('0x2b')][_0x0b35('0x36')]){_0x31abab['where']=_[_0x0b35('0x38')](_0x31abab[_0x0b35('0x37')],{'$or':_['map'](_0x31abab[_0x0b35('0x2f')],function(_0x278111){var _0xe352f0={};_0xe352f0[_0x278111]={'$like':'%'+_0x228af5['query'][_0x0b35('0x36')]+'%'};return _0xe352f0;})});}_0x31abab=_['merge']({},_0x31abab,_0x228af5[_0x0b35('0x3b')]);return _0x165880[_0x0b35('0x46')](_0x31abab);}})['then'](function(_0x5a8ca5){if(_0x5a8ca5){_0x2fd586=_0x5a8ca5[_0x0b35('0x43')];if(!_0x228af5['query'][_0x0b35('0x32')]('nolimit')){_0x31abab[_0x0b35('0x1c')]=qs['limit'](_0x228af5[_0x0b35('0x2b')][_0x0b35('0x1c')]);_0x31abab[_0x0b35('0x1a')]=qs[_0x0b35('0x1a')](_0x228af5[_0x0b35('0x2b')]['offset']);}return _0x165880['getConfigurations'](_0x31abab);}})[_0x0b35('0x20')](function(_0x7e836c){if(_0x7e836c){return _0x7e836c?{'count':_0x2fd586,'rows':_0x7e836c}:null;}})[_0x0b35('0x20')](respondWithResult(_0x496a41,null))[_0x0b35('0x40')](handleError(_0x496a41,null));};exports[_0x0b35('0x48')]=function(_0x23d066,_0x2f6251,_0x5534dc){if(_0x23d066[_0x0b35('0x44')]['id']){delete _0x23d066[_0x0b35('0x44')]['id'];}return db[_0x0b35('0x3c')][_0x0b35('0x49')]({'where':{'id':_0x23d066['params']['id']}})['then'](handleEntityNotFound(_0x2f6251,null))[_0x0b35('0x20')](function(_0x48eb85){if(_0x48eb85){_0x23d066[_0x0b35('0x44')]['AccountId']=_0x48eb85['id'];_0x23d066['body'][_0x0b35('0x4a')]=integrations[_0x0b35('0x4b')](_0x23d066[_0x0b35('0x44')][_0x0b35('0x4c')],_0x23d066[_0x0b35('0x44')]['type']);_0x23d066['body'][_0x0b35('0x4d')]=integrations[_0x0b35('0x4e')](_0x23d066[_0x0b35('0x44')][_0x0b35('0x4c')],_0x23d066[_0x0b35('0x44')]['type']);return db[_0x0b35('0x47')][_0x0b35('0x4f')](_0x23d066['body'],{'include':[{'model':db[_0x0b35('0x50')],'as':_0x0b35('0x4a')},{'model':db[_0x0b35('0x50')],'as':_0x0b35('0x4d')}]});}return null;})['then'](respondWithResult(_0x2f6251,null))[_0x0b35('0x40')](handleError(_0x2f6251,null));};exports[_0x0b35('0x51')]=function(_0x1464a7,_0x3c18e2,_0x3fd9fd){var _0x1abb95='';return db[_0x0b35('0x3c')]['findOne']({'where':{'id':_0x1464a7[_0x0b35('0x42')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x0b35('0x20')](handleEntityNotFound(_0x3c18e2,null))[_0x0b35('0x20')](function(_0x3a6767){if(_0x3a6767){_0x1abb95=_0x3a6767[_0x0b35('0x52')];var _0x19a97d=_0x1abb95[_0x0b35('0x53')](-0x1);if(_0x19a97d==='/'){_0x1abb95=_0x1abb95[_0x0b35('0x54')](0x0,_0x1abb95['lastIndexOf'](_0x19a97d));}return rp({'method':_0x0b35('0x55'),'uri':util[_0x0b35('0x56')]('%s/%s',_0x1abb95,_0x0b35('0x57')),'headers':{'Authorization':util[_0x0b35('0x56')](_0x0b35('0x58'),new Buffer(util[_0x0b35('0x56')](_0x0b35('0x59'),_0x3a6767[_0x0b35('0x5a')]))['toString'](_0x0b35('0x5b')))},'json':!![]});}})['then'](function(_0x552b32){if(_0x552b32){var _0x5ac939=[_0x0b35('0x5c'),_0x0b35('0x5d'),_0x0b35('0x5e'),_0x0b35('0x5f'),_0x0b35('0x17'),_0x0b35('0x60'),_0x0b35('0x61'),'source','ticket_type','group','company'];_['remove'](_0x552b32,function(_0x226b8a){return _0x5ac939[_0x0b35('0x62')](_0x226b8a[_0x0b35('0x25')])||!_0x226b8a[_0x0b35('0x63')]&&_0x226b8a[_0x0b35('0x39')]!==_0x0b35('0x64')&&_0x226b8a[_0x0b35('0x39')]!==_0x0b35('0x65');});return{'count':_0x552b32[_0x0b35('0x43')],'rows':_[_0x0b35('0x28')](_0x552b32,function(_0x3a0090){return{'id':_0x3a0090[_0x0b35('0x25')],'name':_0x3a0090['label'],'custom':!_0x3a0090[_0x0b35('0x63')],'options':_0x3a0090['choices']?_[_0x0b35('0x28')](_0x3a0090[_0x0b35('0x66')],function(_0x278920){return{'name':_[_0x0b35('0x67')](_0x278920),'value':_0x278920};}):[]};})};}})[_0x0b35('0x20')](respondWithResult(_0x3c18e2,null))[_0x0b35('0x40')](function(_0x4ba5e2){var _0x15cd88=_0x1464a7[_0x0b35('0x2b')][_0x0b35('0x68')]?0x1f4:_0x4ba5e2[_0x0b35('0x69')]||0x1f4;logger[_0x0b35('0x23')](_0x0b35('0x6a'),_0x0b35('0x51'),_0x15cd88,JSON[_0x0b35('0x6b')](_0x4ba5e2));delete _0x4ba5e2[_0x0b35('0x25')];if(_0x15cd88===0x191){_0x15cd88=0x190;}_0x3c18e2[_0x0b35('0x17')](_0x15cd88)['send'](_0x1464a7['query'][_0x0b35('0x68')]?{'message':_0x0b35('0x6c'),'statusCode':_0x4ba5e2[_0x0b35('0x69')]}:_0x4ba5e2);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 33ac541..ede5343 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 _0x6e35=['api','bluebird','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger'];(function(_0x8873b4,_0xa9231a){var _0x5c7c83=function(_0x558161){while(--_0x558161){_0x8873b4['push'](_0x8873b4['shift']());}};_0x5c7c83(++_0xa9231a);}(_0x6e35,0x14d));var _0x56e3=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x6e35[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x56e3('0x0'));var util=require(_0x56e3('0x1'));var logger=require(_0x56e3('0x2'))(_0x56e3('0x3'));var moment=require('moment');var BPromise=require(_0x56e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56e3('0x5'));var rimraf=require(_0x56e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x56e3('0x7'));var integrations=require(_0x56e3('0x8'));module[_0x56e3('0x9')]=function(_0x2032dc,_0xe6834f){return _0x2032dc[_0x56e3('0xa')](_0x56e3('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x718f=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','define','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x15d189,_0x4bac28){var _0x46edf8=function(_0x433034){while(--_0x433034){_0x15d189['push'](_0x15d189['shift']());}};_0x46edf8(++_0x4bac28);}(_0x718f,0x96));var _0xf718=function(_0x4738b7,_0x9096f0){_0x4738b7=_0x4738b7-0x0;var _0x47cb9e=_0x718f[_0x4738b7];return _0x47cb9e;};'use strict';var _=require(_0xf718('0x0'));var util=require(_0xf718('0x1'));var logger=require('../../config/logger')(_0xf718('0x2'));var moment=require(_0xf718('0x3'));var BPromise=require(_0xf718('0x4'));var rp=require(_0xf718('0x5'));var fs=require('fs');var path=require(_0xf718('0x6'));var rimraf=require(_0xf718('0x7'));var config=require(_0xf718('0x8'));var attributes=require(_0xf718('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x48a09e,_0x2a80e1){return _0x48a09e[_0xf718('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xf718('0xb'),'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 0c85c52..0a9a4ce 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 _0x12ee=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','find','moment'];(function(_0x46b061,_0x55dad6){var _0x37321f=function(_0x48acd8){while(--_0x48acd8){_0x46b061['push'](_0x46b061['shift']());}};_0x37321f(++_0x55dad6);}(_0x12ee,0x1a3));var _0xe12e=function(_0x35031a,_0x1c8c62){_0x35031a=_0x35031a-0x0;var _0x44ec8f=_0x12ee[_0x35031a];return _0x44ec8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe12e('0x0'));var BPromise=require(_0xe12e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe12e('0x2'));var db=require(_0xe12e('0x3'))['db'];var utils=require(_0xe12e('0x4'));var logger=require(_0xe12e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe12e('0x6'));var client=jayson[_0xe12e('0x7')][_0xe12e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a7db1,_0x50cddc,_0x2bdf37){return new BPromise(function(_0xa71b8e,_0x3a838c){return client[_0xe12e('0x9')](_0x1a7db1,_0x2bdf37)[_0xe12e('0xa')](function(_0x609808){logger['info'](_0xe12e('0xb'),_0x50cddc,_0xe12e('0xc'));logger[_0xe12e('0xd')](_0xe12e('0xe'),_0x50cddc,'request\x20sent',JSON[_0xe12e('0xf')](_0x609808));if(_0x609808[_0xe12e('0x10')]){if(_0x609808[_0xe12e('0x10')][_0xe12e('0x11')]===0x1f4){logger[_0xe12e('0x10')](_0xe12e('0xb'),_0x50cddc,_0x609808[_0xe12e('0x10')]['message']);return _0x3a838c(_0x609808[_0xe12e('0x10')][_0xe12e('0x12')]);}logger[_0xe12e('0x10')](_0xe12e('0xb'),_0x50cddc,_0x609808['error'][_0xe12e('0x12')]);return _0xa71b8e(_0x609808[_0xe12e('0x10')]['message']);}else{logger[_0xe12e('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x50cddc,_0xe12e('0xc'));_0xa71b8e(_0x609808[_0xe12e('0x14')]['message']);}})['catch'](function(_0x215548){logger[_0xe12e('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x50cddc,_0x215548);_0x3a838c(_0x215548);});});}exports[_0xe12e('0x15')]=function(_0x368857){var _0x170ea6=this;return new Promise(function(_0x48ff4f,_0x503dee){return db[_0xe12e('0x16')][_0xe12e('0x17')]({'raw':_0x368857[_0xe12e('0x18')]?_0x368857['options'][_0xe12e('0x19')]===undefined?!![]:![]:!![],'where':_0x368857[_0xe12e('0x18')]?_0x368857[_0xe12e('0x18')][_0xe12e('0x1a')]||null:null,'attributes':_0x368857[_0xe12e('0x18')]?_0x368857['options'][_0xe12e('0x1b')]||null:null,'limit':_0x368857[_0xe12e('0x18')]?_0x368857[_0xe12e('0x18')][_0xe12e('0x1c')]||null:null,'include':_0x368857[_0xe12e('0x18')]?_0x368857[_0xe12e('0x18')][_0xe12e('0x1d')]?_[_0xe12e('0x1e')](_0x368857[_0xe12e('0x18')][_0xe12e('0x1d')],function(_0x9d3d64){return{'model':db[_0x9d3d64[_0xe12e('0x1f')]],'as':_0x9d3d64['as'],'attributes':_0x9d3d64[_0xe12e('0x1b')],'include':_0x9d3d64['include']?_['map'](_0x9d3d64[_0xe12e('0x1d')],function(_0x1e87bc){return{'model':db[_0x1e87bc[_0xe12e('0x1f')]],'as':_0x1e87bc['as'],'attributes':_0x1e87bc[_0xe12e('0x1b')],'include':_0x1e87bc[_0xe12e('0x1d')]?_[_0xe12e('0x1e')](_0x1e87bc[_0xe12e('0x1d')],function(_0x1dd7f5){return{'model':db[_0x1dd7f5[_0xe12e('0x1f')]],'as':_0x1dd7f5['as'],'attributes':_0x1dd7f5[_0xe12e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe12e('0xa')](function(_0x8e65c0){logger['info']('GetFreshdeskAccount',_0x368857);logger[_0xe12e('0xd')](_0xe12e('0x15'),_0x368857,JSON['stringify'](_0x8e65c0));_0x48ff4f(_0x8e65c0);})[_0xe12e('0x20')](function(_0x15c43a){logger['error'](_0xe12e('0x15'),_0x15c43a['message'],_0x368857);_0x503dee(_0x170ea6[_0xe12e('0x10')](0x1f4,_0x15c43a[_0xe12e('0x12')]));});});};exports[_0xe12e('0x21')]=function(_0x4b4325){var _0x53fcbf=this;return new Promise(function(_0x358166,_0x3986c4){return db[_0xe12e('0x16')][_0xe12e('0x22')]({'raw':_0x4b4325[_0xe12e('0x18')]?_0x4b4325[_0xe12e('0x18')][_0xe12e('0x19')]===undefined?!![]:![]:!![],'where':_0x4b4325[_0xe12e('0x18')]?_0x4b4325[_0xe12e('0x18')][_0xe12e('0x1a')]||null:null,'attributes':_0x4b4325[_0xe12e('0x18')]?_0x4b4325[_0xe12e('0x18')]['attributes']||null:null,'include':_0x4b4325['options']?_0x4b4325[_0xe12e('0x18')][_0xe12e('0x1d')]?_[_0xe12e('0x1e')](_0x4b4325[_0xe12e('0x18')]['include'],function(_0x2dc54b){return{'model':db[_0x2dc54b[_0xe12e('0x1f')]],'as':_0x2dc54b['as'],'attributes':_0x2dc54b[_0xe12e('0x1b')],'include':_0x2dc54b[_0xe12e('0x1d')]?_[_0xe12e('0x1e')](_0x2dc54b[_0xe12e('0x1d')],function(_0x297e70){return{'model':db[_0x297e70[_0xe12e('0x1f')]],'as':_0x297e70['as'],'attributes':_0x297e70[_0xe12e('0x1b')],'include':_0x297e70['include']?_[_0xe12e('0x1e')](_0x297e70[_0xe12e('0x1d')],function(_0x59129f){return{'model':db[_0x59129f['model']],'as':_0x59129f['as'],'attributes':_0x59129f[_0xe12e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48b155){logger[_0xe12e('0x13')](_0xe12e('0x21'),_0x4b4325);logger[_0xe12e('0xd')](_0xe12e('0x21'),_0x4b4325,JSON['stringify'](_0x48b155));_0x358166(_0x48b155);})[_0xe12e('0x20')](function(_0x7ce564){logger[_0xe12e('0x10')](_0xe12e('0x21'),_0x7ce564[_0xe12e('0x12')],_0x4b4325);_0x3986c4(_0x53fcbf[_0xe12e('0x10')](0x1f4,_0x7ce564[_0xe12e('0x12')]));});});}; \ No newline at end of file +var _0x84f2=['../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshdeskAccount','FreshdeskAccount','options','attributes','limit','include','map','model','catch','ShowFreshdeskAccount','raw','where','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x84f2,0xe8));var _0x284f=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x84f2[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0x284f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x284f('0x1'));var rs=require(_0x284f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x284f('0x3'))['db'];var utils=require(_0x284f('0x4'));var logger=require(_0x284f('0x5'))('rpc');var config=require(_0x284f('0x6'));var jayson=require(_0x284f('0x7'));var client=jayson[_0x284f('0x8')][_0x284f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9b1795,_0x3faed5,_0x1245c8){return new BPromise(function(_0x2c0d88,_0x56f734){return client[_0x284f('0xa')](_0x9b1795,_0x1245c8)[_0x284f('0xb')](function(_0x3dfa86){logger['info'](_0x284f('0xc'),_0x3faed5,_0x284f('0xd'));logger['debug'](_0x284f('0xe'),_0x3faed5,_0x284f('0xd'),JSON[_0x284f('0xf')](_0x3dfa86));if(_0x3dfa86[_0x284f('0x10')]){if(_0x3dfa86[_0x284f('0x10')][_0x284f('0x11')]===0x1f4){logger[_0x284f('0x10')](_0x284f('0xc'),_0x3faed5,_0x3dfa86[_0x284f('0x10')][_0x284f('0x12')]);return _0x56f734(_0x3dfa86[_0x284f('0x10')][_0x284f('0x12')]);}logger[_0x284f('0x10')](_0x284f('0xc'),_0x3faed5,_0x3dfa86[_0x284f('0x10')][_0x284f('0x12')]);return _0x2c0d88(_0x3dfa86['error'][_0x284f('0x12')]);}else{logger[_0x284f('0x13')](_0x284f('0xc'),_0x3faed5,_0x284f('0xd'));_0x2c0d88(_0x3dfa86[_0x284f('0x14')][_0x284f('0x12')]);}})['catch'](function(_0x259ac9){logger[_0x284f('0x10')](_0x284f('0xc'),_0x3faed5,_0x259ac9);_0x56f734(_0x259ac9);});});}exports[_0x284f('0x15')]=function(_0x5f01e6){var _0x4c27ba=this;return new Promise(function(_0x32ee40,_0x2e28b6){return db[_0x284f('0x16')]['findAll']({'raw':_0x5f01e6['options']?_0x5f01e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5f01e6[_0x284f('0x17')]?_0x5f01e6[_0x284f('0x17')]['where']||null:null,'attributes':_0x5f01e6[_0x284f('0x17')]?_0x5f01e6[_0x284f('0x17')][_0x284f('0x18')]||null:null,'limit':_0x5f01e6['options']?_0x5f01e6[_0x284f('0x17')][_0x284f('0x19')]||null:null,'include':_0x5f01e6['options']?_0x5f01e6['options'][_0x284f('0x1a')]?_[_0x284f('0x1b')](_0x5f01e6[_0x284f('0x17')][_0x284f('0x1a')],function(_0x5f33bb){return{'model':db[_0x5f33bb[_0x284f('0x1c')]],'as':_0x5f33bb['as'],'attributes':_0x5f33bb[_0x284f('0x18')],'include':_0x5f33bb[_0x284f('0x1a')]?_[_0x284f('0x1b')](_0x5f33bb['include'],function(_0x534fff){return{'model':db[_0x534fff[_0x284f('0x1c')]],'as':_0x534fff['as'],'attributes':_0x534fff[_0x284f('0x18')],'include':_0x534fff[_0x284f('0x1a')]?_[_0x284f('0x1b')](_0x534fff[_0x284f('0x1a')],function(_0x4fbc10){return{'model':db[_0x4fbc10[_0x284f('0x1c')]],'as':_0x4fbc10['as'],'attributes':_0x4fbc10['attributes']};}):[]};}):[]};}):[]:[]})[_0x284f('0xb')](function(_0x3f50f7){logger[_0x284f('0x13')](_0x284f('0x15'),_0x5f01e6);logger['debug']('GetFreshdeskAccount',_0x5f01e6,JSON[_0x284f('0xf')](_0x3f50f7));_0x32ee40(_0x3f50f7);})[_0x284f('0x1d')](function(_0x2c17c5){logger['error'](_0x284f('0x15'),_0x2c17c5[_0x284f('0x12')],_0x5f01e6);_0x2e28b6(_0x4c27ba['error'](0x1f4,_0x2c17c5[_0x284f('0x12')]));});});};exports[_0x284f('0x1e')]=function(_0xaa3a6){var _0x48f36c=this;return new Promise(function(_0x16e18f,_0x34459c){return db[_0x284f('0x16')]['find']({'raw':_0xaa3a6[_0x284f('0x17')]?_0xaa3a6[_0x284f('0x17')][_0x284f('0x1f')]===undefined?!![]:![]:!![],'where':_0xaa3a6[_0x284f('0x17')]?_0xaa3a6[_0x284f('0x17')][_0x284f('0x20')]||null:null,'attributes':_0xaa3a6[_0x284f('0x17')]?_0xaa3a6['options'][_0x284f('0x18')]||null:null,'include':_0xaa3a6[_0x284f('0x17')]?_0xaa3a6['options']['include']?_[_0x284f('0x1b')](_0xaa3a6[_0x284f('0x17')][_0x284f('0x1a')],function(_0x4186ba){return{'model':db[_0x4186ba['model']],'as':_0x4186ba['as'],'attributes':_0x4186ba[_0x284f('0x18')],'include':_0x4186ba[_0x284f('0x1a')]?_[_0x284f('0x1b')](_0x4186ba[_0x284f('0x1a')],function(_0x2a7c77){return{'model':db[_0x2a7c77['model']],'as':_0x2a7c77['as'],'attributes':_0x2a7c77[_0x284f('0x18')],'include':_0x2a7c77[_0x284f('0x1a')]?_['map'](_0x2a7c77[_0x284f('0x1a')],function(_0x1cfff5){return{'model':db[_0x1cfff5[_0x284f('0x1c')]],'as':_0x1cfff5['as'],'attributes':_0x1cfff5[_0x284f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x284f('0xb')](function(_0x4ae34a){logger[_0x284f('0x13')]('ShowFreshdeskAccount',_0xaa3a6);logger[_0x284f('0x21')]('ShowFreshdeskAccount',_0xaa3a6,JSON[_0x284f('0xf')](_0x4ae34a));_0x16e18f(_0x4ae34a);})[_0x284f('0x1d')](function(_0x476a1b){logger['error']('ShowFreshdeskAccount',_0x476a1b[_0x284f('0x12')],_0xaa3a6);_0x34459c(_0x48f36c[_0x284f('0x10')](0x1f4,_0x476a1b[_0x284f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7d12e57..2845f59 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 _0x1ad7=['isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x55a801,_0x1769e7){var _0x303292=function(_0x367c62){while(--_0x367c62){_0x55a801['push'](_0x55a801['shift']());}};_0x303292(++_0x1769e7);}(_0x1ad7,0x154));var _0x71ad=function(_0xf022be,_0x14e78e){_0xf022be=_0xf022be-0x0;var _0x18d7d5=_0x1ad7[_0xf022be];return _0x18d7d5;};'use strict';var multer=require(_0x71ad('0x0'));var util=require(_0x71ad('0x1'));var path=require(_0x71ad('0x2'));var timeout=require(_0x71ad('0x3'));var express=require(_0x71ad('0x4'));var router=express[_0x71ad('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x71ad('0x6'));var interaction=require(_0x71ad('0x7'));var config=require(_0x71ad('0x8'));var controller=require(_0x71ad('0x9'));router[_0x71ad('0xa')]('/',auth[_0x71ad('0xb')](),controller[_0x71ad('0xc')]);router[_0x71ad('0xa')]('/:id',auth[_0x71ad('0xb')](),controller['show']);router[_0x71ad('0xa')](_0x71ad('0xd'),auth[_0x71ad('0xb')](),controller[_0x71ad('0xe')]);router[_0x71ad('0xa')](_0x71ad('0xf'),auth['isAuthenticated'](),controller[_0x71ad('0x10')]);router[_0x71ad('0xa')](_0x71ad('0x11'),auth[_0x71ad('0xb')](),controller[_0x71ad('0x12')]);router[_0x71ad('0xa')](_0x71ad('0x13'),auth[_0x71ad('0xb')](),controller[_0x71ad('0x14')]);router[_0x71ad('0x15')]('/',auth[_0x71ad('0xb')](),controller[_0x71ad('0x16')]);router[_0x71ad('0x15')](_0x71ad('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x71ad('0x17')](_0x71ad('0x18'),auth[_0x71ad('0xb')](),controller[_0x71ad('0x19')]);router['delete'](_0x71ad('0x18'),auth[_0x71ad('0xb')](),controller['destroy']);module[_0x71ad('0x1a')]=router; \ No newline at end of file +var _0xb67c=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id'];(function(_0x197678,_0x22a43f){var _0x449beb=function(_0x2ad89a){while(--_0x2ad89a){_0x197678['push'](_0x197678['shift']());}};_0x449beb(++_0x22a43f);}(_0xb67c,0x12c));var _0xcb67=function(_0x322dac,_0xa46f61){_0x322dac=_0x322dac-0x0;var _0x561bf1=_0xb67c[_0x322dac];return _0x561bf1;};'use strict';var multer=require(_0xcb67('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb67('0x1'));var express=require(_0xcb67('0x2'));var router=express[_0xcb67('0x3')]();var fs_extra=require(_0xcb67('0x4'));var auth=require(_0xcb67('0x5'));var interaction=require(_0xcb67('0x6'));var config=require(_0xcb67('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xcb67('0x8')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xa')]);router[_0xcb67('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcb67('0xb')]);router['get'](_0xcb67('0xc'),auth[_0xcb67('0x9')](),controller[_0xcb67('0xd')]);router['get'](_0xcb67('0xe'),auth[_0xcb67('0x9')](),controller[_0xcb67('0xf')]);router[_0xcb67('0x8')](_0xcb67('0x10'),auth[_0xcb67('0x9')](),controller[_0xcb67('0x11')]);router[_0xcb67('0x8')](_0xcb67('0x12'),auth[_0xcb67('0x9')](),controller[_0xcb67('0x13')]);router[_0xcb67('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb67('0x14')]('/:id/tags',auth[_0xcb67('0x9')](),controller[_0xcb67('0x15')]);router[_0xcb67('0x16')](_0xcb67('0x17'),auth[_0xcb67('0x9')](),controller[_0xcb67('0x18')]);router[_0xcb67('0x19')](_0xcb67('0x17'),auth['isAuthenticated'](),controller[_0xcb67('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index eabf00e..0bf0349 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 _0xccb6=['exports','STRING','sequelize'];(function(_0x49e52,_0x5d4d48){var _0x4d707c=function(_0x22453d){while(--_0x22453d){_0x49e52['push'](_0x49e52['shift']());}};_0x4d707c(++_0x5d4d48);}(_0xccb6,0x9e));var _0x6ccb=function(_0xed9c99,_0x2217b1){_0xed9c99=_0xed9c99-0x0;var _0x5443a1=_0xccb6[_0xed9c99];return _0x5443a1;};'use strict';var Sequelize=require(_0x6ccb('0x0'));module[_0x6ccb('0x1')]={'name':{'type':Sequelize[_0x6ccb('0x2')]},'description':{'type':Sequelize[_0x6ccb('0x2')]}}; \ No newline at end of file +var _0x7cbc=['STRING','sequelize','exports'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0x7cbc,0x148));var _0xc7cb=function(_0x3135dd,_0x59856a){_0x3135dd=_0x3135dd-0x0;var _0x475164=_0x7cbc[_0x3135dd];return _0x475164;};'use strict';var Sequelize=require(_0xc7cb('0x0'));module[_0xc7cb('0x1')]={'name':{'type':Sequelize[_0xc7cb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2f96ad6..4af2dce 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 _0x84b6=['find','create','body','getFields','findOne','sort','filter','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','length'];(function(_0x5ea948,_0x4c13be){var _0x3535e1=function(_0x18a1c9){while(--_0x18a1c9){_0x5ea948['push'](_0x5ea948['shift']());}};_0x3535e1(++_0x4c13be);}(_0x84b6,0x151));var _0x684b=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x84b6[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x684b('0x0'));var zipdir=require(_0x684b('0x1'));var jsonpatch=require(_0x684b('0x2'));var rp=require(_0x684b('0x3'));var moment=require(_0x684b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x684b('0x5'));var path=require(_0x684b('0x6'));var sox=require('sox');var csv=require(_0x684b('0x7'));var ejs=require(_0x684b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x684b('0x9'));var crypto=require(_0x684b('0xa'));var jsforce=require(_0x684b('0xb'));var deskjs=require(_0x684b('0xc'));var toCsv=require(_0x684b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x684b('0xd'));var authService=require(_0x684b('0xe'));var qs=require(_0x684b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x684b('0x10'));var logger=require(_0x684b('0x11'))(_0x684b('0x12'));var utils=require(_0x684b('0x13'));var config=require(_0x684b('0x14'));var licenseUtil=require(_0x684b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50a9f6,_0x124007){_0x124007=_0x124007||0xcc;return function(_0x32b1d6){if(_0x32b1d6){return _0x50a9f6[_0x684b('0x16')](_0x124007);}return _0x50a9f6[_0x684b('0x17')](_0x124007)[_0x684b('0x18')]();};}function respondWithResult(_0x285a1e,_0x5c0fe0){_0x5c0fe0=_0x5c0fe0||0xc8;return function(_0x35765c){if(_0x35765c){return _0x285a1e[_0x684b('0x17')](_0x5c0fe0)[_0x684b('0x19')](_0x35765c);}};}function respondWithFilteredResult(_0x2376bd,_0x632642){return function(_0x42b75a){if(_0x42b75a){var _0x31a947=typeof _0x632642['offset']===_0x684b('0x1a')&&typeof _0x632642[_0x684b('0x1b')]==='undefined';var _0x28bc43=_0x42b75a['count'];var _0x301263=_0x31a947?0x0:_0x632642[_0x684b('0x1c')];var _0x593ba6=_0x31a947?_0x42b75a[_0x684b('0x1d')]:_0x632642[_0x684b('0x1c')]+_0x632642[_0x684b('0x1b')];var _0x49d28a;if(_0x593ba6>=_0x28bc43){_0x593ba6=_0x28bc43;_0x49d28a=0xc8;}else{_0x49d28a=0xce;}_0x2376bd[_0x684b('0x17')](_0x49d28a);return _0x2376bd[_0x684b('0x1e')](_0x684b('0x1f'),_0x301263+'-'+_0x593ba6+'/'+_0x28bc43)[_0x684b('0x19')](_0x42b75a);}return null;};}function patchUpdates(_0x422b12){return function(_0x4024ae){try{jsonpatch['apply'](_0x4024ae,_0x422b12,!![]);}catch(_0x5e9127){return BPromise[_0x684b('0x20')](_0x5e9127);}return _0x4024ae[_0x684b('0x21')]();};}function saveUpdates(_0x202db9,_0x13ce9e){return function(_0x3f6e03){if(_0x3f6e03){return _0x3f6e03[_0x684b('0x22')](_0x202db9)[_0x684b('0x23')](function(_0xcd38b8){return _0xcd38b8;});}return null;};}function removeEntity(_0x56dfba,_0x5dc651){return function(_0x4882a9){if(_0x4882a9){return _0x4882a9[_0x684b('0x24')]()['then'](function(){_0x56dfba[_0x684b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f8ac,_0x5e1f93){return function(_0x121216){if(!_0x121216){_0x19f8ac['sendStatus'](0x194);}return _0x121216;};}function handleError(_0x243c54,_0x54bc18){_0x54bc18=_0x54bc18||0x1f4;return function(_0x10cd44){logger[_0x684b('0x25')](_0x10cd44[_0x684b('0x26')]);if(_0x10cd44[_0x684b('0x27')]){delete _0x10cd44[_0x684b('0x27')];}_0x243c54[_0x684b('0x17')](_0x54bc18)[_0x684b('0x28')](_0x10cd44);};}exports[_0x684b('0x29')]=function(_0x1d80ef,_0x90688e){var _0x37098f={},_0x4f9c9c={},_0x421401={'count':0x0,'rows':[]};var _0x327304=_[_0x684b('0x2a')](db[_0x684b('0x2b')][_0x684b('0x2c')],function(_0x3dbc15){return{'name':_0x3dbc15['fieldName'],'type':_0x3dbc15[_0x684b('0x2d')][_0x684b('0x2e')]};});_0x4f9c9c[_0x684b('0x2f')]=_[_0x684b('0x2a')](_0x327304,_0x684b('0x27'));_0x4f9c9c[_0x684b('0x30')]=_[_0x684b('0x31')](_0x1d80ef[_0x684b('0x30')]);_0x4f9c9c[_0x684b('0x32')]=_['intersection'](_0x4f9c9c[_0x684b('0x2f')],_0x4f9c9c['query']);_0x37098f['attributes']=_['intersection'](_0x4f9c9c['model'],qs['fields'](_0x1d80ef['query'][_0x684b('0x33')]));_0x37098f[_0x684b('0x34')]=_0x37098f['attributes']['length']?_0x37098f[_0x684b('0x34')]:_0x4f9c9c['model'];if(!_0x1d80ef[_0x684b('0x30')][_0x684b('0x35')](_0x684b('0x36'))){_0x37098f[_0x684b('0x1b')]=qs[_0x684b('0x1b')](_0x1d80ef[_0x684b('0x30')][_0x684b('0x1b')]);_0x37098f['offset']=qs['offset'](_0x1d80ef[_0x684b('0x30')]['offset']);}_0x37098f[_0x684b('0x37')]=qs['sort'](_0x1d80ef[_0x684b('0x30')]['sort']);_0x37098f[_0x684b('0x38')]=qs[_0x684b('0x32')](_[_0x684b('0x39')](_0x1d80ef[_0x684b('0x30')],_0x4f9c9c[_0x684b('0x32')]),_0x327304);if(_0x1d80ef['query']['filter']){_0x37098f[_0x684b('0x38')]=_[_0x684b('0x3a')](_0x37098f[_0x684b('0x38')],{'$or':_[_0x684b('0x2a')](_0x327304,function(_0x5e4810){if(_0x5e4810[_0x684b('0x2d')]!==_0x684b('0x3b')){var _0x4e53c7={};_0x4e53c7[_0x5e4810[_0x684b('0x27')]]={'$like':'%'+_0x1d80ef[_0x684b('0x30')]['filter']+'%'};return _0x4e53c7;}})});}_0x37098f=_[_0x684b('0x3a')]({},_0x37098f,_0x1d80ef[_0x684b('0x3c')]);var _0x3f7ebd={'where':_0x37098f[_0x684b('0x38')]};return db[_0x684b('0x2b')][_0x684b('0x1d')](_0x3f7ebd)['then'](function(_0x3c278b){_0x421401[_0x684b('0x1d')]=_0x3c278b;if(_0x1d80ef['query'][_0x684b('0x3d')]){_0x37098f['include']=[{'all':!![]}];}return db[_0x684b('0x2b')]['findAll'](_0x37098f);})[_0x684b('0x23')](function(_0x2e99bf){_0x421401[_0x684b('0x3e')]=_0x2e99bf;return _0x421401;})[_0x684b('0x23')](respondWithFilteredResult(_0x90688e,_0x37098f))[_0x684b('0x3f')](handleError(_0x90688e,null));};exports[_0x684b('0x40')]=function(_0x34fdea,_0x512e4e){var _0x3d8e7b={'raw':![],'where':{'id':_0x34fdea[_0x684b('0x41')]['id']}},_0x19ff58={};_0x19ff58[_0x684b('0x2f')]=_[_0x684b('0x31')](db[_0x684b('0x2b')][_0x684b('0x2c')]);_0x19ff58['query']=_['keys'](_0x34fdea[_0x684b('0x30')]);_0x19ff58[_0x684b('0x32')]=_[_0x684b('0x42')](_0x19ff58[_0x684b('0x2f')],_0x19ff58['query']);_0x3d8e7b[_0x684b('0x34')]=_[_0x684b('0x42')](_0x19ff58[_0x684b('0x2f')],qs[_0x684b('0x33')](_0x34fdea[_0x684b('0x30')][_0x684b('0x33')]));_0x3d8e7b[_0x684b('0x34')]=_0x3d8e7b[_0x684b('0x34')][_0x684b('0x43')]?_0x3d8e7b['attributes']:_0x19ff58['model'];if(_0x34fdea[_0x684b('0x30')][_0x684b('0x3d')]){_0x3d8e7b['include']=[{'all':!![]}];}_0x3d8e7b=_[_0x684b('0x3a')]({},_0x3d8e7b,_0x34fdea['options']);return db[_0x684b('0x2b')][_0x684b('0x44')](_0x3d8e7b)[_0x684b('0x23')](handleEntityNotFound(_0x512e4e,null))['then'](respondWithResult(_0x512e4e,null))[_0x684b('0x3f')](handleError(_0x512e4e,null));};exports[_0x684b('0x45')]=function(_0x3ee989,_0x540aaf){return db[_0x684b('0x2b')][_0x684b('0x45')](_0x3ee989[_0x684b('0x46')],{})[_0x684b('0x23')](respondWithResult(_0x540aaf,0xc9))[_0x684b('0x3f')](handleError(_0x540aaf,null));};exports['update']=function(_0x464d8a,_0x1b65e7){if(_0x464d8a[_0x684b('0x46')]['id']){delete _0x464d8a[_0x684b('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x684b('0x44')]({'where':{'id':_0x464d8a['params']['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x1b65e7,null))[_0x684b('0x23')](saveUpdates(_0x464d8a[_0x684b('0x46')],null))[_0x684b('0x23')](respondWithResult(_0x1b65e7,null))[_0x684b('0x3f')](handleError(_0x1b65e7,null));};exports['destroy']=function(_0x2b5f78,_0x49e5f2){return db[_0x684b('0x2b')][_0x684b('0x44')]({'where':{'id':_0x2b5f78[_0x684b('0x41')]['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x49e5f2,null))['then'](removeEntity(_0x49e5f2,null))[_0x684b('0x3f')](handleError(_0x49e5f2,null));};exports[_0x684b('0x47')]=function(_0x106860,_0xb0c1ef,_0x6f4ba2){var _0x3d4242={};var _0x578ca4={};var _0x1ee52c;var _0x285cf5;return db[_0x684b('0x2b')][_0x684b('0x48')]({'where':{'id':_0x106860['params']['id']}})[_0x684b('0x23')](handleEntityNotFound(_0xb0c1ef,null))['then'](function(_0x4a4fb7){if(_0x4a4fb7){_0x1ee52c=_0x4a4fb7;_0x578ca4[_0x684b('0x2f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x578ca4[_0x684b('0x30')]=_[_0x684b('0x31')](_0x106860[_0x684b('0x30')]);_0x578ca4[_0x684b('0x32')]=_[_0x684b('0x42')](_0x578ca4[_0x684b('0x2f')],_0x578ca4[_0x684b('0x30')]);_0x3d4242[_0x684b('0x34')]=_[_0x684b('0x42')](_0x578ca4[_0x684b('0x2f')],qs['fields'](_0x106860[_0x684b('0x30')][_0x684b('0x33')]));_0x3d4242[_0x684b('0x34')]=_0x3d4242['attributes']['length']?_0x3d4242[_0x684b('0x34')]:_0x578ca4['model'];_0x3d4242[_0x684b('0x37')]=qs['sort'](_0x106860[_0x684b('0x30')][_0x684b('0x49')]);_0x3d4242[_0x684b('0x38')]=qs[_0x684b('0x32')](_[_0x684b('0x39')](_0x106860[_0x684b('0x30')],_0x578ca4[_0x684b('0x32')]));if(_0x106860['query'][_0x684b('0x4a')]){_0x3d4242[_0x684b('0x38')]=_[_0x684b('0x3a')](_0x3d4242[_0x684b('0x38')],{'$or':_[_0x684b('0x2a')](_0x3d4242[_0x684b('0x34')],function(_0x2fdc28){var _0x510d95={};_0x510d95[_0x2fdc28]={'$like':'%'+_0x106860[_0x684b('0x30')][_0x684b('0x4a')]+'%'};return _0x510d95;})});}_0x3d4242=_['merge']({},_0x3d4242,_0x106860[_0x684b('0x3c')]);return _0x1ee52c[_0x684b('0x47')](_0x3d4242);}})[_0x684b('0x23')](function(_0x37233e){if(_0x37233e){_0x285cf5=_0x37233e[_0x684b('0x43')];if(!_0x106860[_0x684b('0x30')][_0x684b('0x35')](_0x684b('0x36'))){_0x3d4242[_0x684b('0x1b')]=qs[_0x684b('0x1b')](_0x106860[_0x684b('0x30')][_0x684b('0x1b')]);_0x3d4242[_0x684b('0x1c')]=qs[_0x684b('0x1c')](_0x106860['query'][_0x684b('0x1c')]);}return _0x1ee52c[_0x684b('0x47')](_0x3d4242);}})[_0x684b('0x23')](function(_0x4a8724){if(_0x4a8724){return _0x4a8724?{'count':_0x285cf5,'rows':_0x4a8724}:null;}})[_0x684b('0x23')](respondWithResult(_0xb0c1ef,null))[_0x684b('0x3f')](handleError(_0xb0c1ef,null));};exports['getSubjects']=function(_0xb93dc0,_0x4e0454,_0x1cb176){var _0x5ab51a={};var _0x2a6a82={};var _0x55c31c;var _0x21e244;return db[_0x684b('0x2b')][_0x684b('0x48')]({'where':{'id':_0xb93dc0[_0x684b('0x41')]['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x4e0454,null))['then'](function(_0x4f0dd9){if(_0x4f0dd9){_0x55c31c=_0x4f0dd9;_0x2a6a82[_0x684b('0x2f')]=_[_0x684b('0x31')](db[_0x684b('0x4b')][_0x684b('0x2c')]);_0x2a6a82[_0x684b('0x30')]=_[_0x684b('0x31')](_0xb93dc0['query']);_0x2a6a82[_0x684b('0x32')]=_[_0x684b('0x42')](_0x2a6a82[_0x684b('0x2f')],_0x2a6a82[_0x684b('0x30')]);_0x5ab51a[_0x684b('0x34')]=_[_0x684b('0x42')](_0x2a6a82[_0x684b('0x2f')],qs[_0x684b('0x33')](_0xb93dc0[_0x684b('0x30')][_0x684b('0x33')]));_0x5ab51a[_0x684b('0x34')]=_0x5ab51a[_0x684b('0x34')][_0x684b('0x43')]?_0x5ab51a[_0x684b('0x34')]:_0x2a6a82[_0x684b('0x2f')];_0x5ab51a['order']=qs[_0x684b('0x49')](_0xb93dc0['query'][_0x684b('0x49')]);_0x5ab51a['where']=qs[_0x684b('0x32')](_[_0x684b('0x39')](_0xb93dc0[_0x684b('0x30')],_0x2a6a82[_0x684b('0x32')]));if(_0xb93dc0[_0x684b('0x30')][_0x684b('0x4a')]){_0x5ab51a[_0x684b('0x38')]=_[_0x684b('0x3a')](_0x5ab51a[_0x684b('0x38')],{'$or':_[_0x684b('0x2a')](_0x5ab51a[_0x684b('0x34')],function(_0x48c3ab){var _0xacaa28={};_0xacaa28[_0x48c3ab]={'$like':'%'+_0xb93dc0['query'][_0x684b('0x4a')]+'%'};return _0xacaa28;})});}_0x5ab51a=_[_0x684b('0x3a')]({},_0x5ab51a,_0xb93dc0[_0x684b('0x3c')]);return _0x55c31c[_0x684b('0x4c')](_0x5ab51a);}})['then'](function(_0x3d1cef){if(_0x3d1cef){_0x21e244=_0x3d1cef[_0x684b('0x43')];if(!_0xb93dc0[_0x684b('0x30')][_0x684b('0x35')]('nolimit')){_0x5ab51a[_0x684b('0x1b')]=qs['limit'](_0xb93dc0[_0x684b('0x30')][_0x684b('0x1b')]);_0x5ab51a[_0x684b('0x1c')]=qs['offset'](_0xb93dc0[_0x684b('0x30')][_0x684b('0x1c')]);}return _0x55c31c['getSubjects'](_0x5ab51a);}})[_0x684b('0x23')](function(_0x4a3099){if(_0x4a3099){return _0x4a3099?{'count':_0x21e244,'rows':_0x4a3099}:null;}})[_0x684b('0x23')](respondWithResult(_0x4e0454,null))['catch'](handleError(_0x4e0454,null));};exports[_0x684b('0x4d')]=function(_0x2f3ce0,_0x23b12f,_0x13618c){var _0x1cecd8={};var _0x2c987f={};var _0x4fff6d;var _0x347ec9;return db[_0x684b('0x2b')][_0x684b('0x48')]({'where':{'id':_0x2f3ce0['params']['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x23b12f,null))['then'](function(_0x3a5dbb){if(_0x3a5dbb){_0x4fff6d=_0x3a5dbb;_0x2c987f[_0x684b('0x2f')]=_[_0x684b('0x31')](db[_0x684b('0x4b')][_0x684b('0x2c')]);_0x2c987f[_0x684b('0x30')]=_[_0x684b('0x31')](_0x2f3ce0[_0x684b('0x30')]);_0x2c987f[_0x684b('0x32')]=_['intersection'](_0x2c987f['model'],_0x2c987f[_0x684b('0x30')]);_0x1cecd8[_0x684b('0x34')]=_[_0x684b('0x42')](_0x2c987f['model'],qs['fields'](_0x2f3ce0[_0x684b('0x30')][_0x684b('0x33')]));_0x1cecd8[_0x684b('0x34')]=_0x1cecd8['attributes'][_0x684b('0x43')]?_0x1cecd8[_0x684b('0x34')]:_0x2c987f[_0x684b('0x2f')];_0x1cecd8[_0x684b('0x37')]=qs[_0x684b('0x49')](_0x2f3ce0[_0x684b('0x30')][_0x684b('0x49')]);_0x1cecd8['where']=qs[_0x684b('0x32')](_[_0x684b('0x39')](_0x2f3ce0[_0x684b('0x30')],_0x2c987f[_0x684b('0x32')]));if(_0x2f3ce0[_0x684b('0x30')][_0x684b('0x4a')]){_0x1cecd8[_0x684b('0x38')]=_[_0x684b('0x3a')](_0x1cecd8[_0x684b('0x38')],{'$or':_['map'](_0x1cecd8[_0x684b('0x34')],function(_0x2c70d8){var _0x2fc370={};_0x2fc370[_0x2c70d8]={'$like':'%'+_0x2f3ce0[_0x684b('0x30')]['filter']+'%'};return _0x2fc370;})});}_0x1cecd8=_['merge']({},_0x1cecd8,_0x2f3ce0[_0x684b('0x3c')]);return _0x4fff6d[_0x684b('0x4d')](_0x1cecd8);}})['then'](function(_0x7a5dc8){if(_0x7a5dc8){_0x347ec9=_0x7a5dc8[_0x684b('0x43')];if(!_0x2f3ce0[_0x684b('0x30')][_0x684b('0x35')](_0x684b('0x36'))){_0x1cecd8[_0x684b('0x1b')]=qs[_0x684b('0x1b')](_0x2f3ce0[_0x684b('0x30')]['limit']);_0x1cecd8[_0x684b('0x1c')]=qs['offset'](_0x2f3ce0[_0x684b('0x30')][_0x684b('0x1c')]);}return _0x4fff6d[_0x684b('0x4d')](_0x1cecd8);}})[_0x684b('0x23')](function(_0x4790dc){if(_0x4790dc){return _0x4790dc?{'count':_0x347ec9,'rows':_0x4790dc}:null;}})['then'](respondWithResult(_0x23b12f,null))['catch'](handleError(_0x23b12f,null));};exports['getTags']=function(_0x34e28b,_0x3b4dcc,_0xca1bee){var _0x49513f={};var _0x4b28d0={};var _0x14d105;var _0x5376ba;return db['FreshdeskConfiguration'][_0x684b('0x48')]({'where':{'id':_0x34e28b['params']['id']}})['then'](handleEntityNotFound(_0x3b4dcc,null))[_0x684b('0x23')](function(_0x5114e2){if(_0x5114e2){_0x14d105=_0x5114e2;_0x4b28d0[_0x684b('0x2f')]=_[_0x684b('0x31')](db[_0x684b('0x4e')]['rawAttributes']);_0x4b28d0[_0x684b('0x30')]=_[_0x684b('0x31')](_0x34e28b['query']);_0x4b28d0[_0x684b('0x32')]=_[_0x684b('0x42')](_0x4b28d0[_0x684b('0x2f')],_0x4b28d0['query']);_0x49513f[_0x684b('0x34')]=_[_0x684b('0x42')](_0x4b28d0[_0x684b('0x2f')],qs['fields'](_0x34e28b[_0x684b('0x30')][_0x684b('0x33')]));_0x49513f[_0x684b('0x34')]=_0x49513f['attributes'][_0x684b('0x43')]?_0x49513f[_0x684b('0x34')]:_0x4b28d0[_0x684b('0x2f')];_0x49513f['order']=qs[_0x684b('0x49')](_0x34e28b[_0x684b('0x30')][_0x684b('0x49')]);_0x49513f[_0x684b('0x38')]=qs['filters'](_[_0x684b('0x39')](_0x34e28b[_0x684b('0x30')],_0x4b28d0[_0x684b('0x32')]));if(_0x34e28b[_0x684b('0x30')][_0x684b('0x4a')]){_0x49513f['where']=_[_0x684b('0x3a')](_0x49513f[_0x684b('0x38')],{'$or':_[_0x684b('0x2a')](_0x49513f['attributes'],function(_0x234e38){var _0x2c6092={};_0x2c6092[_0x234e38]={'$like':'%'+_0x34e28b[_0x684b('0x30')][_0x684b('0x4a')]+'%'};return _0x2c6092;})});}_0x49513f=_['merge']({},_0x49513f,_0x34e28b[_0x684b('0x3c')]);return _0x14d105['getTags'](_0x49513f);}})[_0x684b('0x23')](function(_0x36845c){if(_0x36845c){_0x5376ba=_0x36845c[_0x684b('0x43')];if(!_0x34e28b[_0x684b('0x30')][_0x684b('0x35')](_0x684b('0x36'))){_0x49513f[_0x684b('0x1b')]=qs['limit'](_0x34e28b[_0x684b('0x30')][_0x684b('0x1b')]);_0x49513f[_0x684b('0x1c')]=qs[_0x684b('0x1c')](_0x34e28b[_0x684b('0x30')][_0x684b('0x1c')]);}return _0x14d105[_0x684b('0x4f')](_0x49513f);}})[_0x684b('0x23')](function(_0x49d6d7){if(_0x49d6d7){return _0x49d6d7?{'count':_0x5376ba,'rows':_0x49d6d7}:null;}})[_0x684b('0x23')](respondWithResult(_0x3b4dcc,null))[_0x684b('0x3f')](handleError(_0x3b4dcc,null));};exports['setTags']=function(_0x2a1ad9,_0x1f47dd,_0x36092b){if(_0x2a1ad9[_0x684b('0x46')]['id']){delete _0x2a1ad9[_0x684b('0x46')]['id'];}return db[_0x684b('0x2b')]['findOne']({'where':{'id':_0x2a1ad9[_0x684b('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f47dd,null))[_0x684b('0x23')](function(_0x1f8ec5){if(_0x1f8ec5){return _0x1f8ec5['setTags'](_0x2a1ad9['body'][_0x684b('0x50')]||[]);}return null;})[_0x684b('0x23')](respondWithResult(_0x1f47dd,null))['catch'](handleError(_0x1f47dd,null));}; \ No newline at end of file +var _0x1733=['key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','where','filters','pick','merge','options','includeAll','include','rows','show','params','catch','body','find','getFields','findOne','FreshdeskField','filter','hasOwnProperty','getSubjects','order','sort','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type'];(function(_0x337b5e,_0x5e4687){var _0x11916c=function(_0x431963){while(--_0x431963){_0x337b5e['push'](_0x337b5e['shift']());}};_0x11916c(++_0x5e4687);}(_0x1733,0xce));var _0x3173=function(_0x3ab080,_0xb0c046){_0x3ab080=_0x3ab080-0x0;var _0x24cfde=_0x1733[_0x3ab080];return _0x24cfde;};'use strict';var emlformat=require(_0x3173('0x0'));var rimraf=require(_0x3173('0x1'));var zipdir=require(_0x3173('0x2'));var jsonpatch=require(_0x3173('0x3'));var rp=require(_0x3173('0x4'));var moment=require(_0x3173('0x5'));var BPromise=require(_0x3173('0x6'));var Mustache=require(_0x3173('0x7'));var util=require(_0x3173('0x8'));var path=require(_0x3173('0x9'));var sox=require(_0x3173('0xa'));var csv=require(_0x3173('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3173('0xc'));var _=require('lodash');var squel=require(_0x3173('0xd'));var crypto=require(_0x3173('0xe'));var jsforce=require(_0x3173('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3173('0xb'));var querystring=require(_0x3173('0x10'));var Papa=require(_0x3173('0x11'));var Redis=require(_0x3173('0x12'));var authService=require(_0x3173('0x13'));var qs=require(_0x3173('0x14'));var as=require(_0x3173('0x15'));var hardwareService=require(_0x3173('0x16'));var logger=require('../../config/logger')(_0x3173('0x17'));var utils=require(_0x3173('0x18'));var config=require(_0x3173('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3173('0x1a'))['db'];function respondWithStatusCode(_0x55bbfa,_0x477345){_0x477345=_0x477345||0xcc;return function(_0x8f14b7){if(_0x8f14b7){return _0x55bbfa[_0x3173('0x1b')](_0x477345);}return _0x55bbfa['status'](_0x477345)[_0x3173('0x1c')]();};}function respondWithResult(_0x522416,_0x4993e3){_0x4993e3=_0x4993e3||0xc8;return function(_0x5ce4ca){if(_0x5ce4ca){return _0x522416[_0x3173('0x1d')](_0x4993e3)[_0x3173('0x1e')](_0x5ce4ca);}};}function respondWithFilteredResult(_0x4ee1a3,_0x275025){return function(_0x84e0a7){if(_0x84e0a7){var _0x2c3725=typeof _0x275025[_0x3173('0x1f')]===_0x3173('0x20')&&typeof _0x275025['limit']===_0x3173('0x20');var _0x2571c1=_0x84e0a7[_0x3173('0x21')];var _0x2d54c5=_0x2c3725?0x0:_0x275025[_0x3173('0x1f')];var _0x237664=_0x2c3725?_0x84e0a7[_0x3173('0x21')]:_0x275025[_0x3173('0x1f')]+_0x275025['limit'];var _0x5b8d87;if(_0x237664>=_0x2571c1){_0x237664=_0x2571c1;_0x5b8d87=0xc8;}else{_0x5b8d87=0xce;}_0x4ee1a3[_0x3173('0x1d')](_0x5b8d87);return _0x4ee1a3['set'](_0x3173('0x22'),_0x2d54c5+'-'+_0x237664+'/'+_0x2571c1)['json'](_0x84e0a7);}return null;};}function patchUpdates(_0x12fc4f){return function(_0x407d37){try{jsonpatch[_0x3173('0x23')](_0x407d37,_0x12fc4f,!![]);}catch(_0x1c78fe){return BPromise['reject'](_0x1c78fe);}return _0x407d37[_0x3173('0x24')]();};}function saveUpdates(_0x38a585,_0x209b10){return function(_0x3fe1e1){if(_0x3fe1e1){return _0x3fe1e1['update'](_0x38a585)[_0x3173('0x25')](function(_0x3ec4da){return _0x3ec4da;});}return null;};}function removeEntity(_0x2f65e8,_0x561cbd){return function(_0x2ac78c){if(_0x2ac78c){return _0x2ac78c[_0x3173('0x26')]()[_0x3173('0x25')](function(){_0x2f65e8[_0x3173('0x1d')](0xcc)[_0x3173('0x1c')]();});}};}function handleEntityNotFound(_0x1d0b4f,_0x1ae97f){return function(_0x45763e){if(!_0x45763e){_0x1d0b4f[_0x3173('0x1b')](0x194);}return _0x45763e;};}function handleError(_0x3e59db,_0x2db820){_0x2db820=_0x2db820||0x1f4;return function(_0x566bdd){logger[_0x3173('0x27')](_0x566bdd[_0x3173('0x28')]);if(_0x566bdd[_0x3173('0x29')]){delete _0x566bdd['name'];}_0x3e59db[_0x3173('0x1d')](_0x2db820)[_0x3173('0x2a')](_0x566bdd);};}exports[_0x3173('0x2b')]=function(_0x37e123,_0x213366){var _0x14fc5d={},_0x48223e={},_0x47f4c6={'count':0x0,'rows':[]};var _0xb14c9f=_[_0x3173('0x2c')](db[_0x3173('0x2d')][_0x3173('0x2e')],function(_0x66738e){return{'name':_0x66738e[_0x3173('0x2f')],'type':_0x66738e[_0x3173('0x30')][_0x3173('0x31')]};});_0x48223e[_0x3173('0x32')]=_['map'](_0xb14c9f,_0x3173('0x29'));_0x48223e[_0x3173('0x33')]=_[_0x3173('0x34')](_0x37e123[_0x3173('0x33')]);_0x48223e['filters']=_[_0x3173('0x35')](_0x48223e['model'],_0x48223e[_0x3173('0x33')]);_0x14fc5d[_0x3173('0x36')]=_[_0x3173('0x35')](_0x48223e[_0x3173('0x32')],qs[_0x3173('0x37')](_0x37e123[_0x3173('0x33')][_0x3173('0x37')]));_0x14fc5d[_0x3173('0x36')]=_0x14fc5d[_0x3173('0x36')][_0x3173('0x38')]?_0x14fc5d[_0x3173('0x36')]:_0x48223e[_0x3173('0x32')];if(!_0x37e123[_0x3173('0x33')]['hasOwnProperty'](_0x3173('0x39'))){_0x14fc5d[_0x3173('0x3a')]=qs[_0x3173('0x3a')](_0x37e123['query'][_0x3173('0x3a')]);_0x14fc5d[_0x3173('0x1f')]=qs[_0x3173('0x1f')](_0x37e123[_0x3173('0x33')][_0x3173('0x1f')]);}_0x14fc5d['order']=qs['sort'](_0x37e123[_0x3173('0x33')]['sort']);_0x14fc5d[_0x3173('0x3b')]=qs[_0x3173('0x3c')](_[_0x3173('0x3d')](_0x37e123[_0x3173('0x33')],_0x48223e[_0x3173('0x3c')]),_0xb14c9f);if(_0x37e123['query']['filter']){_0x14fc5d['where']=_[_0x3173('0x3e')](_0x14fc5d['where'],{'$or':_['map'](_0xb14c9f,function(_0x2aa812){if(_0x2aa812[_0x3173('0x30')]!=='VIRTUAL'){var _0x137830={};_0x137830[_0x2aa812[_0x3173('0x29')]]={'$like':'%'+_0x37e123[_0x3173('0x33')]['filter']+'%'};return _0x137830;}})});}_0x14fc5d=_[_0x3173('0x3e')]({},_0x14fc5d,_0x37e123[_0x3173('0x3f')]);var _0x4c0c5e={'where':_0x14fc5d[_0x3173('0x3b')]};return db[_0x3173('0x2d')]['count'](_0x4c0c5e)[_0x3173('0x25')](function(_0x2ae135){_0x47f4c6[_0x3173('0x21')]=_0x2ae135;if(_0x37e123['query'][_0x3173('0x40')]){_0x14fc5d[_0x3173('0x41')]=[{'all':!![]}];}return db[_0x3173('0x2d')]['findAll'](_0x14fc5d);})[_0x3173('0x25')](function(_0x5d3628){_0x47f4c6[_0x3173('0x42')]=_0x5d3628;return _0x47f4c6;})[_0x3173('0x25')](respondWithFilteredResult(_0x213366,_0x14fc5d))['catch'](handleError(_0x213366,null));};exports[_0x3173('0x43')]=function(_0x2fb95f,_0x16b135){var _0x34126d={'raw':![],'where':{'id':_0x2fb95f[_0x3173('0x44')]['id']}},_0x1e3163={};_0x1e3163[_0x3173('0x32')]=_[_0x3173('0x34')](db[_0x3173('0x2d')][_0x3173('0x2e')]);_0x1e3163['query']=_[_0x3173('0x34')](_0x2fb95f['query']);_0x1e3163[_0x3173('0x3c')]=_[_0x3173('0x35')](_0x1e3163['model'],_0x1e3163[_0x3173('0x33')]);_0x34126d['attributes']=_[_0x3173('0x35')](_0x1e3163[_0x3173('0x32')],qs[_0x3173('0x37')](_0x2fb95f[_0x3173('0x33')][_0x3173('0x37')]));_0x34126d['attributes']=_0x34126d[_0x3173('0x36')][_0x3173('0x38')]?_0x34126d[_0x3173('0x36')]:_0x1e3163['model'];if(_0x2fb95f[_0x3173('0x33')][_0x3173('0x40')]){_0x34126d[_0x3173('0x41')]=[{'all':!![]}];}_0x34126d=_['merge']({},_0x34126d,_0x2fb95f[_0x3173('0x3f')]);return db[_0x3173('0x2d')]['find'](_0x34126d)[_0x3173('0x25')](handleEntityNotFound(_0x16b135,null))[_0x3173('0x25')](respondWithResult(_0x16b135,null))[_0x3173('0x45')](handleError(_0x16b135,null));};exports['create']=function(_0x25448d,_0xfb60a7){return db[_0x3173('0x2d')]['create'](_0x25448d['body'],{})[_0x3173('0x25')](respondWithResult(_0xfb60a7,0xc9))[_0x3173('0x45')](handleError(_0xfb60a7,null));};exports['update']=function(_0x30dc1c,_0x2cade7){if(_0x30dc1c[_0x3173('0x46')]['id']){delete _0x30dc1c[_0x3173('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x3173('0x47')]({'where':{'id':_0x30dc1c[_0x3173('0x44')]['id']}})[_0x3173('0x25')](handleEntityNotFound(_0x2cade7,null))[_0x3173('0x25')](saveUpdates(_0x30dc1c[_0x3173('0x46')],null))[_0x3173('0x25')](respondWithResult(_0x2cade7,null))[_0x3173('0x45')](handleError(_0x2cade7,null));};exports['destroy']=function(_0x3768b9,_0x473996){return db[_0x3173('0x2d')]['find']({'where':{'id':_0x3768b9[_0x3173('0x44')]['id']}})[_0x3173('0x25')](handleEntityNotFound(_0x473996,null))[_0x3173('0x25')](removeEntity(_0x473996,null))[_0x3173('0x45')](handleError(_0x473996,null));};exports[_0x3173('0x48')]=function(_0x3c8c80,_0x9c372,_0x25249b){var _0x25c2ed={};var _0x119639={};var _0x11a3b3;var _0x22fff2;return db[_0x3173('0x2d')][_0x3173('0x49')]({'where':{'id':_0x3c8c80[_0x3173('0x44')]['id']}})[_0x3173('0x25')](handleEntityNotFound(_0x9c372,null))[_0x3173('0x25')](function(_0x30ef01){if(_0x30ef01){_0x11a3b3=_0x30ef01;_0x119639['model']=_['keys'](db[_0x3173('0x4a')]['rawAttributes']);_0x119639[_0x3173('0x33')]=_[_0x3173('0x34')](_0x3c8c80[_0x3173('0x33')]);_0x119639[_0x3173('0x3c')]=_[_0x3173('0x35')](_0x119639[_0x3173('0x32')],_0x119639[_0x3173('0x33')]);_0x25c2ed[_0x3173('0x36')]=_[_0x3173('0x35')](_0x119639['model'],qs[_0x3173('0x37')](_0x3c8c80[_0x3173('0x33')][_0x3173('0x37')]));_0x25c2ed[_0x3173('0x36')]=_0x25c2ed[_0x3173('0x36')][_0x3173('0x38')]?_0x25c2ed[_0x3173('0x36')]:_0x119639[_0x3173('0x32')];_0x25c2ed['order']=qs['sort'](_0x3c8c80[_0x3173('0x33')]['sort']);_0x25c2ed[_0x3173('0x3b')]=qs[_0x3173('0x3c')](_[_0x3173('0x3d')](_0x3c8c80[_0x3173('0x33')],_0x119639[_0x3173('0x3c')]));if(_0x3c8c80[_0x3173('0x33')]['filter']){_0x25c2ed['where']=_[_0x3173('0x3e')](_0x25c2ed[_0x3173('0x3b')],{'$or':_[_0x3173('0x2c')](_0x25c2ed[_0x3173('0x36')],function(_0x357601){var _0x5ea066={};_0x5ea066[_0x357601]={'$like':'%'+_0x3c8c80[_0x3173('0x33')][_0x3173('0x4b')]+'%'};return _0x5ea066;})});}_0x25c2ed=_[_0x3173('0x3e')]({},_0x25c2ed,_0x3c8c80[_0x3173('0x3f')]);return _0x11a3b3['getFields'](_0x25c2ed);}})[_0x3173('0x25')](function(_0x4189c0){if(_0x4189c0){_0x22fff2=_0x4189c0['length'];if(!_0x3c8c80[_0x3173('0x33')][_0x3173('0x4c')]('nolimit')){_0x25c2ed[_0x3173('0x3a')]=qs['limit'](_0x3c8c80[_0x3173('0x33')]['limit']);_0x25c2ed[_0x3173('0x1f')]=qs[_0x3173('0x1f')](_0x3c8c80[_0x3173('0x33')]['offset']);}return _0x11a3b3[_0x3173('0x48')](_0x25c2ed);}})[_0x3173('0x25')](function(_0x3ce8de){if(_0x3ce8de){return _0x3ce8de?{'count':_0x22fff2,'rows':_0x3ce8de}:null;}})[_0x3173('0x25')](respondWithResult(_0x9c372,null))[_0x3173('0x45')](handleError(_0x9c372,null));};exports[_0x3173('0x4d')]=function(_0x5ee142,_0x1677ed,_0x128bd7){var _0x9233df={};var _0x489dcb={};var _0x4d0006;var _0x288d03;return db['FreshdeskConfiguration'][_0x3173('0x49')]({'where':{'id':_0x5ee142[_0x3173('0x44')]['id']}})[_0x3173('0x25')](handleEntityNotFound(_0x1677ed,null))[_0x3173('0x25')](function(_0x17f2a5){if(_0x17f2a5){_0x4d0006=_0x17f2a5;_0x489dcb[_0x3173('0x32')]=_[_0x3173('0x34')](db[_0x3173('0x4a')][_0x3173('0x2e')]);_0x489dcb[_0x3173('0x33')]=_[_0x3173('0x34')](_0x5ee142[_0x3173('0x33')]);_0x489dcb['filters']=_[_0x3173('0x35')](_0x489dcb[_0x3173('0x32')],_0x489dcb['query']);_0x9233df['attributes']=_[_0x3173('0x35')](_0x489dcb['model'],qs[_0x3173('0x37')](_0x5ee142[_0x3173('0x33')][_0x3173('0x37')]));_0x9233df[_0x3173('0x36')]=_0x9233df['attributes'][_0x3173('0x38')]?_0x9233df[_0x3173('0x36')]:_0x489dcb[_0x3173('0x32')];_0x9233df[_0x3173('0x4e')]=qs[_0x3173('0x4f')](_0x5ee142['query'][_0x3173('0x4f')]);_0x9233df[_0x3173('0x3b')]=qs[_0x3173('0x3c')](_[_0x3173('0x3d')](_0x5ee142[_0x3173('0x33')],_0x489dcb[_0x3173('0x3c')]));if(_0x5ee142[_0x3173('0x33')]['filter']){_0x9233df[_0x3173('0x3b')]=_[_0x3173('0x3e')](_0x9233df[_0x3173('0x3b')],{'$or':_[_0x3173('0x2c')](_0x9233df[_0x3173('0x36')],function(_0x35887e){var _0x233f0d={};_0x233f0d[_0x35887e]={'$like':'%'+_0x5ee142[_0x3173('0x33')]['filter']+'%'};return _0x233f0d;})});}_0x9233df=_[_0x3173('0x3e')]({},_0x9233df,_0x5ee142[_0x3173('0x3f')]);return _0x4d0006['getSubjects'](_0x9233df);}})['then'](function(_0x49411e){if(_0x49411e){_0x288d03=_0x49411e[_0x3173('0x38')];if(!_0x5ee142[_0x3173('0x33')][_0x3173('0x4c')]('nolimit')){_0x9233df[_0x3173('0x3a')]=qs['limit'](_0x5ee142[_0x3173('0x33')]['limit']);_0x9233df[_0x3173('0x1f')]=qs[_0x3173('0x1f')](_0x5ee142[_0x3173('0x33')][_0x3173('0x1f')]);}return _0x4d0006[_0x3173('0x4d')](_0x9233df);}})[_0x3173('0x25')](function(_0x25db27){if(_0x25db27){return _0x25db27?{'count':_0x288d03,'rows':_0x25db27}:null;}})[_0x3173('0x25')](respondWithResult(_0x1677ed,null))['catch'](handleError(_0x1677ed,null));};exports[_0x3173('0x50')]=function(_0x555b47,_0x4bba21,_0x24521b){var _0x45c6a2={};var _0xa63895={};var _0x1c434d;var _0xf2cc0f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x555b47[_0x3173('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bba21,null))[_0x3173('0x25')](function(_0x3532b4){if(_0x3532b4){_0x1c434d=_0x3532b4;_0xa63895[_0x3173('0x32')]=_[_0x3173('0x34')](db[_0x3173('0x4a')]['rawAttributes']);_0xa63895['query']=_[_0x3173('0x34')](_0x555b47[_0x3173('0x33')]);_0xa63895[_0x3173('0x3c')]=_[_0x3173('0x35')](_0xa63895[_0x3173('0x32')],_0xa63895[_0x3173('0x33')]);_0x45c6a2[_0x3173('0x36')]=_[_0x3173('0x35')](_0xa63895[_0x3173('0x32')],qs[_0x3173('0x37')](_0x555b47[_0x3173('0x33')][_0x3173('0x37')]));_0x45c6a2[_0x3173('0x36')]=_0x45c6a2[_0x3173('0x36')][_0x3173('0x38')]?_0x45c6a2[_0x3173('0x36')]:_0xa63895['model'];_0x45c6a2['order']=qs['sort'](_0x555b47[_0x3173('0x33')]['sort']);_0x45c6a2[_0x3173('0x3b')]=qs[_0x3173('0x3c')](_[_0x3173('0x3d')](_0x555b47[_0x3173('0x33')],_0xa63895[_0x3173('0x3c')]));if(_0x555b47[_0x3173('0x33')]['filter']){_0x45c6a2['where']=_['merge'](_0x45c6a2[_0x3173('0x3b')],{'$or':_[_0x3173('0x2c')](_0x45c6a2['attributes'],function(_0x55455f){var _0x312fe9={};_0x312fe9[_0x55455f]={'$like':'%'+_0x555b47[_0x3173('0x33')][_0x3173('0x4b')]+'%'};return _0x312fe9;})});}_0x45c6a2=_[_0x3173('0x3e')]({},_0x45c6a2,_0x555b47[_0x3173('0x3f')]);return _0x1c434d[_0x3173('0x50')](_0x45c6a2);}})[_0x3173('0x25')](function(_0x436d29){if(_0x436d29){_0xf2cc0f=_0x436d29[_0x3173('0x38')];if(!_0x555b47[_0x3173('0x33')][_0x3173('0x4c')](_0x3173('0x39'))){_0x45c6a2[_0x3173('0x3a')]=qs[_0x3173('0x3a')](_0x555b47[_0x3173('0x33')][_0x3173('0x3a')]);_0x45c6a2['offset']=qs[_0x3173('0x1f')](_0x555b47['query']['offset']);}return _0x1c434d[_0x3173('0x50')](_0x45c6a2);}})[_0x3173('0x25')](function(_0x5d1a0a){if(_0x5d1a0a){return _0x5d1a0a?{'count':_0xf2cc0f,'rows':_0x5d1a0a}:null;}})['then'](respondWithResult(_0x4bba21,null))[_0x3173('0x45')](handleError(_0x4bba21,null));};exports[_0x3173('0x51')]=function(_0x4442e1,_0x621be8,_0x208179){var _0x1874e1={};var _0x8dc154={};var _0x40e094;var _0x11814a;return db[_0x3173('0x2d')][_0x3173('0x49')]({'where':{'id':_0x4442e1['params']['id']}})[_0x3173('0x25')](handleEntityNotFound(_0x621be8,null))[_0x3173('0x25')](function(_0x3e2c8d){if(_0x3e2c8d){_0x40e094=_0x3e2c8d;_0x8dc154['model']=_[_0x3173('0x34')](db[_0x3173('0x52')][_0x3173('0x2e')]);_0x8dc154[_0x3173('0x33')]=_[_0x3173('0x34')](_0x4442e1[_0x3173('0x33')]);_0x8dc154[_0x3173('0x3c')]=_[_0x3173('0x35')](_0x8dc154[_0x3173('0x32')],_0x8dc154['query']);_0x1874e1[_0x3173('0x36')]=_[_0x3173('0x35')](_0x8dc154[_0x3173('0x32')],qs['fields'](_0x4442e1[_0x3173('0x33')][_0x3173('0x37')]));_0x1874e1[_0x3173('0x36')]=_0x1874e1['attributes'][_0x3173('0x38')]?_0x1874e1[_0x3173('0x36')]:_0x8dc154[_0x3173('0x32')];_0x1874e1[_0x3173('0x4e')]=qs[_0x3173('0x4f')](_0x4442e1[_0x3173('0x33')][_0x3173('0x4f')]);_0x1874e1[_0x3173('0x3b')]=qs['filters'](_[_0x3173('0x3d')](_0x4442e1['query'],_0x8dc154['filters']));if(_0x4442e1[_0x3173('0x33')][_0x3173('0x4b')]){_0x1874e1['where']=_[_0x3173('0x3e')](_0x1874e1[_0x3173('0x3b')],{'$or':_[_0x3173('0x2c')](_0x1874e1[_0x3173('0x36')],function(_0x1d41a4){var _0x3e0479={};_0x3e0479[_0x1d41a4]={'$like':'%'+_0x4442e1[_0x3173('0x33')][_0x3173('0x4b')]+'%'};return _0x3e0479;})});}_0x1874e1=_[_0x3173('0x3e')]({},_0x1874e1,_0x4442e1['options']);return _0x40e094['getTags'](_0x1874e1);}})['then'](function(_0x524db4){if(_0x524db4){_0x11814a=_0x524db4[_0x3173('0x38')];if(!_0x4442e1[_0x3173('0x33')][_0x3173('0x4c')](_0x3173('0x39'))){_0x1874e1[_0x3173('0x3a')]=qs[_0x3173('0x3a')](_0x4442e1[_0x3173('0x33')][_0x3173('0x3a')]);_0x1874e1[_0x3173('0x1f')]=qs[_0x3173('0x1f')](_0x4442e1[_0x3173('0x33')][_0x3173('0x1f')]);}return _0x40e094[_0x3173('0x51')](_0x1874e1);}})[_0x3173('0x25')](function(_0x10c1a0){if(_0x10c1a0){return _0x10c1a0?{'count':_0x11814a,'rows':_0x10c1a0}:null;}})[_0x3173('0x25')](respondWithResult(_0x621be8,null))['catch'](handleError(_0x621be8,null));};exports['setTags']=function(_0x12fc6b,_0x10abb3,_0x2fb899){if(_0x12fc6b['body']['id']){delete _0x12fc6b['body']['id'];}return db[_0x3173('0x2d')][_0x3173('0x49')]({'where':{'id':_0x12fc6b[_0x3173('0x44')]['id']}})['then'](handleEntityNotFound(_0x10abb3,null))['then'](function(_0x5d9c34){if(_0x5d9c34){return _0x5d9c34[_0x3173('0x53')](_0x12fc6b[_0x3173('0x46')][_0x3173('0x54')]||[]);}return null;})[_0x3173('0x25')](respondWithResult(_0x10abb3,null))[_0x3173('0x45')](handleError(_0x10abb3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f8495a9..7bf4838 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 _0x0430=['../../config/environment','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x0430,0x1b1));var _0x0043=function(_0x2d56ef,_0x399c70){_0x2d56ef=_0x2d56ef-0x0;var _0x29b4ca=_0x0430[_0x2d56ef];return _0x29b4ca;};'use strict';var _=require(_0x0043('0x0'));var util=require(_0x0043('0x1'));var logger=require(_0x0043('0x2'))('api');var moment=require(_0x0043('0x3'));var BPromise=require(_0x0043('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0043('0x5'));var rimraf=require(_0x0043('0x6'));var config=require(_0x0043('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0043('0x8')]=function(_0x56aa7f,_0x2f3ab8){return _0x56aa7f[_0x0043('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x0043('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a7e=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3b54f7,_0x113c5d){var _0x1b30ba=function(_0x316997){while(--_0x316997){_0x3b54f7['push'](_0x3b54f7['shift']());}};_0x1b30ba(++_0x113c5d);}(_0x3a7e,0xef));var _0xe3a7=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x3a7e[_0x1b3564];return _0x504069;};'use strict';var _=require(_0xe3a7('0x0'));var util=require('util');var logger=require(_0xe3a7('0x1'))(_0xe3a7('0x2'));var moment=require(_0xe3a7('0x3'));var BPromise=require(_0xe3a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a7('0x5'));var rimraf=require(_0xe3a7('0x6'));var config=require(_0xe3a7('0x7'));var attributes=require(_0xe3a7('0x8'));module[_0xe3a7('0x9')]=function(_0x4aae31,_0xb5240d){return _0x4aae31[_0xe3a7('0xa')](_0xe3a7('0xb'),attributes,{'tableName':_0xe3a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index b24be07..19d5969 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 _0xe861=['info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message'];(function(_0x12a275,_0x31c510){var _0x2e63f4=function(_0x3d1a2b){while(--_0x3d1a2b){_0x12a275['push'](_0x12a275['shift']());}};_0x2e63f4(++_0x31c510);}(_0xe861,0x179));var _0x1e86=function(_0xcfc89b,_0x43479d){_0xcfc89b=_0xcfc89b-0x0;var _0x39341b=_0xe861[_0xcfc89b];return _0x39341b;};'use strict';var _=require(_0x1e86('0x0'));var util=require('util');var moment=require(_0x1e86('0x1'));var BPromise=require(_0x1e86('0x2'));var rs=require(_0x1e86('0x3'));var fs=require('fs');var Redis=require(_0x1e86('0x4'));var db=require(_0x1e86('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e86('0x6'))(_0x1e86('0x7'));var config=require(_0x1e86('0x8'));var jayson=require(_0x1e86('0x9'));var client=jayson[_0x1e86('0xa')][_0x1e86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xebf8e1,_0x5e507e,_0x54b4db){return new BPromise(function(_0x364b34,_0x1b659b){return client[_0x1e86('0xc')](_0xebf8e1,_0x54b4db)['then'](function(_0x5b9ccf){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5e507e,_0x1e86('0xd'));logger['debug'](_0x1e86('0xe'),_0x5e507e,'request\x20sent',JSON['stringify'](_0x5b9ccf));if(_0x5b9ccf[_0x1e86('0xf')]){if(_0x5b9ccf[_0x1e86('0xf')][_0x1e86('0x10')]===0x1f4){logger[_0x1e86('0xf')](_0x1e86('0x11'),_0x5e507e,_0x5b9ccf['error']['message']);return _0x1b659b(_0x5b9ccf[_0x1e86('0xf')]['message']);}logger[_0x1e86('0xf')](_0x1e86('0x11'),_0x5e507e,_0x5b9ccf['error'][_0x1e86('0x12')]);return _0x364b34(_0x5b9ccf[_0x1e86('0xf')]['message']);}else{logger[_0x1e86('0x13')](_0x1e86('0x11'),_0x5e507e,_0x1e86('0xd'));_0x364b34(_0x5b9ccf[_0x1e86('0x14')][_0x1e86('0x12')]);}})[_0x1e86('0x15')](function(_0x1bd708){logger[_0x1e86('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5e507e,_0x1bd708);_0x1b659b(_0x1bd708);});});} \ No newline at end of file +var _0x25fa=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird'];(function(_0x572404,_0x3c1a38){var _0x4a2f19=function(_0x4e0ada){while(--_0x4e0ada){_0x572404['push'](_0x572404['shift']());}};_0x4a2f19(++_0x3c1a38);}(_0x25fa,0xb2));var _0xa25f=function(_0x1b5631,_0x4bdda7){_0x1b5631=_0x1b5631-0x0;var _0x1c29b8=_0x25fa[_0x1b5631];return _0x1c29b8;};'use strict';var _=require('lodash');var util=require(_0xa25f('0x0'));var moment=require('moment');var BPromise=require(_0xa25f('0x1'));var rs=require(_0xa25f('0x2'));var fs=require('fs');var Redis=require(_0xa25f('0x3'));var db=require(_0xa25f('0x4'))['db'];var utils=require(_0xa25f('0x5'));var logger=require('../../config/logger')(_0xa25f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa25f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12cda9,_0x1b0028,_0x4b6d35){return new BPromise(function(_0x5315ea,_0x11bb71){return client['request'](_0x12cda9,_0x4b6d35)[_0xa25f('0x8')](function(_0x2a5129){logger[_0xa25f('0x9')](_0xa25f('0xa'),_0x1b0028,_0xa25f('0xb'));logger['debug'](_0xa25f('0xc'),_0x1b0028,_0xa25f('0xb'),JSON[_0xa25f('0xd')](_0x2a5129));if(_0x2a5129[_0xa25f('0xe')]){if(_0x2a5129['error']['code']===0x1f4){logger[_0xa25f('0xe')](_0xa25f('0xa'),_0x1b0028,_0x2a5129[_0xa25f('0xe')][_0xa25f('0xf')]);return _0x11bb71(_0x2a5129['error'][_0xa25f('0xf')]);}logger['error'](_0xa25f('0xa'),_0x1b0028,_0x2a5129[_0xa25f('0xe')][_0xa25f('0xf')]);return _0x5315ea(_0x2a5129['error'][_0xa25f('0xf')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1b0028,'request\x20sent');_0x5315ea(_0x2a5129[_0xa25f('0x10')][_0xa25f('0xf')]);}})[_0xa25f('0x11')](function(_0x140b3c){logger[_0xa25f('0xe')](_0xa25f('0xa'),_0x1b0028,_0x140b3c);_0x11bb71(_0x140b3c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f73cd0b..8eb170f 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 _0x0ace=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x370bbe,_0x5a20a6){var _0x41d4e3=function(_0x3d8c22){while(--_0x3d8c22){_0x370bbe['push'](_0x370bbe['shift']());}};_0x41d4e3(++_0x5a20a6);}(_0x0ace,0xeb));var _0xe0ac=function(_0x1fd450,_0x42cbf6){_0x1fd450=_0x1fd450-0x0;var _0x4cb0a5=_0x0ace[_0x1fd450];return _0x4cb0a5;};'use strict';var multer=require(_0xe0ac('0x0'));var util=require(_0xe0ac('0x1'));var path=require('path');var timeout=require(_0xe0ac('0x2'));var express=require(_0xe0ac('0x3'));var router=express[_0xe0ac('0x4')]();var fs_extra=require(_0xe0ac('0x5'));var auth=require(_0xe0ac('0x6'));var interaction=require(_0xe0ac('0x7'));var config=require(_0xe0ac('0x8'));var controller=require(_0xe0ac('0x9'));router[_0xe0ac('0xa')]('/',auth[_0xe0ac('0xb')](),controller[_0xe0ac('0xc')]);router['get'](_0xe0ac('0xd'),auth[_0xe0ac('0xb')](),controller[_0xe0ac('0xe')]);router[_0xe0ac('0xf')]('/',auth[_0xe0ac('0xb')](),controller[_0xe0ac('0x10')]);router[_0xe0ac('0x11')](_0xe0ac('0xd'),auth[_0xe0ac('0xb')](),controller[_0xe0ac('0x12')]);router[_0xe0ac('0x13')](_0xe0ac('0xd'),auth[_0xe0ac('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x85d0=['isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x85d0,0x1d8));var _0x085d=function(_0xfdf759,_0x2e3743){_0xfdf759=_0xfdf759-0x0;var _0x39333e=_0x85d0[_0xfdf759];return _0x39333e;};'use strict';var multer=require(_0x085d('0x0'));var util=require(_0x085d('0x1'));var path=require(_0x085d('0x2'));var timeout=require(_0x085d('0x3'));var express=require(_0x085d('0x4'));var router=express[_0x085d('0x5')]();var fs_extra=require(_0x085d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x085d('0x7'));var config=require(_0x085d('0x8'));var controller=require(_0x085d('0x9'));router[_0x085d('0xa')]('/',auth[_0x085d('0xb')](),controller[_0x085d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x085d('0xd')]);router[_0x085d('0xe')]('/',auth['isAuthenticated'](),controller[_0x085d('0xf')]);router[_0x085d('0x10')](_0x085d('0x11'),auth[_0x085d('0xb')](),controller[_0x085d('0x12')]);router[_0x085d('0x13')]('/:id',auth[_0x085d('0xb')](),controller['destroy']);module[_0x085d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 553cef2..3822cc5 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 _0x8bd0=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x5b10e0,_0x8fa359){var _0x417976=function(_0x5c23c7){while(--_0x5c23c7){_0x5b10e0['push'](_0x5b10e0['shift']());}};_0x417976(++_0x8fa359);}(_0x8bd0,0xe1));var _0x08bd=function(_0x4f46e6,_0x1e71d1){_0x4f46e6=_0x4f46e6-0x0;var _0x2f1799=_0x8bd0[_0x4f46e6];return _0x2f1799;};'use strict';var Sequelize=require(_0x08bd('0x0'));module[_0x08bd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x08bd('0x2'),'variable',_0x08bd('0x3'),_0x08bd('0x4'),_0x08bd('0x5')),'defaultValue':_0x08bd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x08bd('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x08bd('0x7'),_0x08bd('0x3'))},'keyContent':{'type':Sequelize[_0x08bd('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x08bd('0x6')]},'customField':{'type':Sequelize[_0x08bd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x08bd('0x6')]}}; \ No newline at end of file +var _0xe0de=['BOOLEAN','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x4d2c5c,_0x23c951){var _0x589e2f=function(_0xb6b078){while(--_0xb6b078){_0x4d2c5c['push'](_0x4d2c5c['shift']());}};_0x589e2f(++_0x23c951);}(_0xe0de,0x89));var _0xee0d=function(_0x3bdb86,_0x35cac8){_0x3bdb86=_0x3bdb86-0x0;var _0x2a66b3=_0xe0de[_0x3bdb86];return _0x2a66b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xee0d('0x0')](_0xee0d('0x1'),_0xee0d('0x2'),'customVariable',_0xee0d('0x3'),_0xee0d('0x4')),'defaultValue':_0xee0d('0x1')},'content':{'type':Sequelize[_0xee0d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xee0d('0x0')](_0xee0d('0x1'),_0xee0d('0x2'),_0xee0d('0x6'))},'keyContent':{'type':Sequelize[_0xee0d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xee0d('0x5')]},'customField':{'type':Sequelize[_0xee0d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 84b7fe4..b931ad7 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 _0x6953=['rimraf','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6953,0x91));var _0x3695=function(_0x1f214b,_0x2fc240){_0x1f214b=_0x1f214b-0x0;var _0x472309=_0x6953[_0x1f214b];return _0x472309;};'use strict';var emlformat=require(_0x3695('0x0'));var rimraf=require(_0x3695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3695('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3695('0x3'));var util=require(_0x3695('0x4'));var path=require(_0x3695('0x5'));var sox=require('sox');var csv=require(_0x3695('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3695('0x7'));var _=require(_0x3695('0x8'));var squel=require(_0x3695('0x9'));var crypto=require(_0x3695('0xa'));var jsforce=require(_0x3695('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3695('0x6'));var querystring=require('querystring');var Papa=require(_0x3695('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3695('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3695('0xe'));var logger=require(_0x3695('0xf'))(_0x3695('0x10'));var utils=require(_0x3695('0x11'));var config=require(_0x3695('0x12'));var licenseUtil=require(_0x3695('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19080e,_0x345587){_0x345587=_0x345587||0xcc;return function(_0x212011){if(_0x212011){return _0x19080e[_0x3695('0x14')](_0x345587);}return _0x19080e[_0x3695('0x15')](_0x345587)[_0x3695('0x16')]();};}function respondWithResult(_0x439bd9,_0x4df429){_0x4df429=_0x4df429||0xc8;return function(_0x26dfc9){if(_0x26dfc9){return _0x439bd9[_0x3695('0x15')](_0x4df429)[_0x3695('0x17')](_0x26dfc9);}};}function respondWithFilteredResult(_0x4ca317,_0x3aa59d){return function(_0x231c7d){if(_0x231c7d){var _0x2cdd3=typeof _0x3aa59d[_0x3695('0x18')]===_0x3695('0x19')&&typeof _0x3aa59d[_0x3695('0x1a')]===_0x3695('0x19');var _0x4fa2d9=_0x231c7d[_0x3695('0x1b')];var _0x5edf8d=_0x2cdd3?0x0:_0x3aa59d[_0x3695('0x18')];var _0xcc93bb=_0x2cdd3?_0x231c7d[_0x3695('0x1b')]:_0x3aa59d[_0x3695('0x18')]+_0x3aa59d[_0x3695('0x1a')];var _0x5dec2a;if(_0xcc93bb>=_0x4fa2d9){_0xcc93bb=_0x4fa2d9;_0x5dec2a=0xc8;}else{_0x5dec2a=0xce;}_0x4ca317[_0x3695('0x15')](_0x5dec2a);return _0x4ca317[_0x3695('0x1c')](_0x3695('0x1d'),_0x5edf8d+'-'+_0xcc93bb+'/'+_0x4fa2d9)[_0x3695('0x17')](_0x231c7d);}return null;};}function patchUpdates(_0xc076a9){return function(_0x1ebba8){try{jsonpatch[_0x3695('0x1e')](_0x1ebba8,_0xc076a9,!![]);}catch(_0xb85811){return BPromise[_0x3695('0x1f')](_0xb85811);}return _0x1ebba8[_0x3695('0x20')]();};}function saveUpdates(_0x1b97d2,_0xf2c747){return function(_0x459f33){if(_0x459f33){return _0x459f33[_0x3695('0x21')](_0x1b97d2)['then'](function(_0x42648c){return _0x42648c;});}return null;};}function removeEntity(_0xdb0934,_0x4899c0){return function(_0x4940e9){if(_0x4940e9){return _0x4940e9[_0x3695('0x22')]()[_0x3695('0x23')](function(){_0xdb0934[_0x3695('0x15')](0xcc)[_0x3695('0x16')]();});}};}function handleEntityNotFound(_0x534d38,_0x180f77){return function(_0x48c2fd){if(!_0x48c2fd){_0x534d38[_0x3695('0x14')](0x194);}return _0x48c2fd;};}function handleError(_0x5319f4,_0xe085de){_0xe085de=_0xe085de||0x1f4;return function(_0x5adea3){logger[_0x3695('0x24')](_0x5adea3[_0x3695('0x25')]);if(_0x5adea3[_0x3695('0x26')]){delete _0x5adea3[_0x3695('0x26')];}_0x5319f4[_0x3695('0x15')](_0xe085de)[_0x3695('0x27')](_0x5adea3);};}exports['index']=function(_0x2be6ee,_0x354ae0){var _0x5f193c={},_0x392107={},_0x4d0742={'count':0x0,'rows':[]};var _0x39c39f=_[_0x3695('0x28')](db[_0x3695('0x29')][_0x3695('0x2a')],function(_0x30a5ba){return{'name':_0x30a5ba[_0x3695('0x2b')],'type':_0x30a5ba[_0x3695('0x2c')][_0x3695('0x2d')]};});_0x392107['model']=_[_0x3695('0x28')](_0x39c39f,_0x3695('0x26'));_0x392107[_0x3695('0x2e')]=_['keys'](_0x2be6ee['query']);_0x392107[_0x3695('0x2f')]=_['intersection'](_0x392107[_0x3695('0x30')],_0x392107[_0x3695('0x2e')]);_0x5f193c['attributes']=_[_0x3695('0x31')](_0x392107['model'],qs[_0x3695('0x32')](_0x2be6ee[_0x3695('0x2e')][_0x3695('0x32')]));_0x5f193c[_0x3695('0x33')]=_0x5f193c[_0x3695('0x33')][_0x3695('0x34')]?_0x5f193c['attributes']:_0x392107[_0x3695('0x30')];if(!_0x2be6ee[_0x3695('0x2e')]['hasOwnProperty'](_0x3695('0x35'))){_0x5f193c[_0x3695('0x1a')]=qs['limit'](_0x2be6ee['query']['limit']);_0x5f193c['offset']=qs[_0x3695('0x18')](_0x2be6ee[_0x3695('0x2e')]['offset']);}_0x5f193c[_0x3695('0x36')]=qs[_0x3695('0x37')](_0x2be6ee[_0x3695('0x2e')][_0x3695('0x37')]);_0x5f193c['where']=qs['filters'](_[_0x3695('0x38')](_0x2be6ee[_0x3695('0x2e')],_0x392107['filters']),_0x39c39f);if(_0x2be6ee[_0x3695('0x2e')][_0x3695('0x39')]){_0x5f193c[_0x3695('0x3a')]=_[_0x3695('0x3b')](_0x5f193c[_0x3695('0x3a')],{'$or':_[_0x3695('0x28')](_0x39c39f,function(_0x36cfd5){if(_0x36cfd5[_0x3695('0x2c')]!==_0x3695('0x3c')){var _0x927c71={};_0x927c71[_0x36cfd5[_0x3695('0x26')]]={'$like':'%'+_0x2be6ee[_0x3695('0x2e')][_0x3695('0x39')]+'%'};return _0x927c71;}})});}_0x5f193c=_[_0x3695('0x3b')]({},_0x5f193c,_0x2be6ee[_0x3695('0x3d')]);var _0x318551={'where':_0x5f193c['where']};return db[_0x3695('0x29')][_0x3695('0x1b')](_0x318551)[_0x3695('0x23')](function(_0xb0931){_0x4d0742[_0x3695('0x1b')]=_0xb0931;if(_0x2be6ee[_0x3695('0x2e')][_0x3695('0x3e')]){_0x5f193c['include']=[{'all':!![]}];}return db[_0x3695('0x29')][_0x3695('0x3f')](_0x5f193c);})[_0x3695('0x23')](function(_0x547af9){_0x4d0742[_0x3695('0x40')]=_0x547af9;return _0x4d0742;})[_0x3695('0x23')](respondWithFilteredResult(_0x354ae0,_0x5f193c))[_0x3695('0x41')](handleError(_0x354ae0,null));};exports[_0x3695('0x42')]=function(_0x22d1e1,_0x322923){var _0x4261d1={'raw':!![],'where':{'id':_0x22d1e1[_0x3695('0x43')]['id']}},_0x5b825a={};_0x5b825a['model']=_['keys'](db[_0x3695('0x29')]['rawAttributes']);_0x5b825a[_0x3695('0x2e')]=_[_0x3695('0x44')](_0x22d1e1[_0x3695('0x2e')]);_0x5b825a[_0x3695('0x2f')]=_['intersection'](_0x5b825a[_0x3695('0x30')],_0x5b825a[_0x3695('0x2e')]);_0x4261d1[_0x3695('0x33')]=_['intersection'](_0x5b825a[_0x3695('0x30')],qs[_0x3695('0x32')](_0x22d1e1[_0x3695('0x2e')][_0x3695('0x32')]));_0x4261d1[_0x3695('0x33')]=_0x4261d1[_0x3695('0x33')][_0x3695('0x34')]?_0x4261d1[_0x3695('0x33')]:_0x5b825a[_0x3695('0x30')];if(_0x22d1e1['query']['includeAll']){_0x4261d1[_0x3695('0x45')]=[{'all':!![]}];}_0x4261d1=_[_0x3695('0x3b')]({},_0x4261d1,_0x22d1e1[_0x3695('0x3d')]);return db['FreshdeskField'][_0x3695('0x46')](_0x4261d1)[_0x3695('0x23')](handleEntityNotFound(_0x322923,null))[_0x3695('0x23')](respondWithResult(_0x322923,null))['catch'](handleError(_0x322923,null));};exports[_0x3695('0x47')]=function(_0x161752,_0x3d6a61){return db[_0x3695('0x29')][_0x3695('0x47')](_0x161752['body'],{})[_0x3695('0x23')](respondWithResult(_0x3d6a61,0xc9))[_0x3695('0x41')](handleError(_0x3d6a61,null));};exports[_0x3695('0x21')]=function(_0x361a9f,_0x557619){if(_0x361a9f[_0x3695('0x48')]['id']){delete _0x361a9f['body']['id'];}return db['FreshdeskField'][_0x3695('0x46')]({'where':{'id':_0x361a9f[_0x3695('0x43')]['id']}})[_0x3695('0x23')](handleEntityNotFound(_0x557619,null))[_0x3695('0x23')](saveUpdates(_0x361a9f[_0x3695('0x48')],null))['then'](respondWithResult(_0x557619,null))['catch'](handleError(_0x557619,null));};exports['destroy']=function(_0x5173b8,_0x5eeaca){return db['FreshdeskField']['find']({'where':{'id':_0x5173b8['params']['id']}})[_0x3695('0x23')](handleEntityNotFound(_0x5eeaca,null))[_0x3695('0x23')](removeEntity(_0x5eeaca,null))['catch'](handleError(_0x5eeaca,null));}; \ No newline at end of file +var _0x55e0=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','end','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','fields','includeAll','find','catch','create','body','params'];(function(_0x2497ba,_0x90732d){var _0x43b7f9=function(_0x4ec25e){while(--_0x4ec25e){_0x2497ba['push'](_0x2497ba['shift']());}};_0x43b7f9(++_0x90732d);}(_0x55e0,0xdc));var _0x055e=function(_0x172887,_0xdd0e84){_0x172887=_0x172887-0x0;var _0x1ef2e6=_0x55e0[_0x172887];return _0x1ef2e6;};'use strict';var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require(_0x055e('0x2'));var jsonpatch=require(_0x055e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x055e('0x4'));var Mustache=require(_0x055e('0x5'));var util=require(_0x055e('0x6'));var path=require(_0x055e('0x7'));var sox=require(_0x055e('0x8'));var csv=require(_0x055e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0x9'));var querystring=require(_0x055e('0xe'));var Papa=require('papaparse');var Redis=require(_0x055e('0xf'));var authService=require(_0x055e('0x10'));var qs=require(_0x055e('0x11'));var as=require(_0x055e('0x12'));var hardwareService=require(_0x055e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x055e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x15'));var db=require(_0x055e('0x16'))['db'];function respondWithStatusCode(_0x72d424,_0x101bc3){_0x101bc3=_0x101bc3||0xcc;return function(_0xc98c6a){if(_0xc98c6a){return _0x72d424[_0x055e('0x17')](_0x101bc3);}return _0x72d424[_0x055e('0x18')](_0x101bc3)['end']();};}function respondWithResult(_0x14064d,_0xb80d83){_0xb80d83=_0xb80d83||0xc8;return function(_0x3cfd14){if(_0x3cfd14){return _0x14064d[_0x055e('0x18')](_0xb80d83)[_0x055e('0x19')](_0x3cfd14);}};}function respondWithFilteredResult(_0x56af18,_0x230674){return function(_0x2fe55f){if(_0x2fe55f){var _0x111cdb=typeof _0x230674['offset']===_0x055e('0x1a')&&typeof _0x230674[_0x055e('0x1b')]===_0x055e('0x1a');var _0x2bad86=_0x2fe55f[_0x055e('0x1c')];var _0x4c85dd=_0x111cdb?0x0:_0x230674[_0x055e('0x1d')];var _0x2cf3de=_0x111cdb?_0x2fe55f[_0x055e('0x1c')]:_0x230674[_0x055e('0x1d')]+_0x230674['limit'];var _0x4004ce;if(_0x2cf3de>=_0x2bad86){_0x2cf3de=_0x2bad86;_0x4004ce=0xc8;}else{_0x4004ce=0xce;}_0x56af18[_0x055e('0x18')](_0x4004ce);return _0x56af18['set'](_0x055e('0x1e'),_0x4c85dd+'-'+_0x2cf3de+'/'+_0x2bad86)[_0x055e('0x19')](_0x2fe55f);}return null;};}function patchUpdates(_0x10258f){return function(_0x124d86){try{jsonpatch[_0x055e('0x1f')](_0x124d86,_0x10258f,!![]);}catch(_0x4675ff){return BPromise['reject'](_0x4675ff);}return _0x124d86[_0x055e('0x20')]();};}function saveUpdates(_0x2f0346,_0x211594){return function(_0x5930ff){if(_0x5930ff){return _0x5930ff[_0x055e('0x21')](_0x2f0346)[_0x055e('0x22')](function(_0x32c64e){return _0x32c64e;});}return null;};}function removeEntity(_0x37243b,_0x51df23){return function(_0x71a6e1){if(_0x71a6e1){return _0x71a6e1['destroy']()[_0x055e('0x22')](function(){_0x37243b[_0x055e('0x18')](0xcc)[_0x055e('0x23')]();});}};}function handleEntityNotFound(_0x1a76c6,_0x40c62a){return function(_0x4c653c){if(!_0x4c653c){_0x1a76c6['sendStatus'](0x194);}return _0x4c653c;};}function handleError(_0x2fb49b,_0x1f90a9){_0x1f90a9=_0x1f90a9||0x1f4;return function(_0x2a82f8){logger['error'](_0x2a82f8[_0x055e('0x24')]);if(_0x2a82f8[_0x055e('0x25')]){delete _0x2a82f8[_0x055e('0x25')];}_0x2fb49b[_0x055e('0x18')](_0x1f90a9)['send'](_0x2a82f8);};}exports[_0x055e('0x26')]=function(_0x5958ef,_0x1528c3){var _0x35def0={},_0x23a506={},_0x7822db={'count':0x0,'rows':[]};var _0x1610f1=_['map'](db[_0x055e('0x27')][_0x055e('0x28')],function(_0x293062){return{'name':_0x293062[_0x055e('0x29')],'type':_0x293062[_0x055e('0x2a')][_0x055e('0x2b')]};});_0x23a506[_0x055e('0x2c')]=_[_0x055e('0x2d')](_0x1610f1,'name');_0x23a506[_0x055e('0x2e')]=_[_0x055e('0x2f')](_0x5958ef['query']);_0x23a506[_0x055e('0x30')]=_[_0x055e('0x31')](_0x23a506[_0x055e('0x2c')],_0x23a506[_0x055e('0x2e')]);_0x35def0[_0x055e('0x32')]=_[_0x055e('0x31')](_0x23a506['model'],qs['fields'](_0x5958ef[_0x055e('0x2e')]['fields']));_0x35def0['attributes']=_0x35def0['attributes'][_0x055e('0x33')]?_0x35def0[_0x055e('0x32')]:_0x23a506[_0x055e('0x2c')];if(!_0x5958ef[_0x055e('0x2e')][_0x055e('0x34')](_0x055e('0x35'))){_0x35def0[_0x055e('0x1b')]=qs[_0x055e('0x1b')](_0x5958ef[_0x055e('0x2e')][_0x055e('0x1b')]);_0x35def0[_0x055e('0x1d')]=qs[_0x055e('0x1d')](_0x5958ef['query']['offset']);}_0x35def0[_0x055e('0x36')]=qs[_0x055e('0x37')](_0x5958ef[_0x055e('0x2e')][_0x055e('0x37')]);_0x35def0[_0x055e('0x38')]=qs[_0x055e('0x30')](_[_0x055e('0x39')](_0x5958ef['query'],_0x23a506[_0x055e('0x30')]),_0x1610f1);if(_0x5958ef[_0x055e('0x2e')][_0x055e('0x3a')]){_0x35def0[_0x055e('0x38')]=_[_0x055e('0x3b')](_0x35def0['where'],{'$or':_[_0x055e('0x2d')](_0x1610f1,function(_0x3017f4){if(_0x3017f4['type']!==_0x055e('0x3c')){var _0x1a109f={};_0x1a109f[_0x3017f4['name']]={'$like':'%'+_0x5958ef[_0x055e('0x2e')][_0x055e('0x3a')]+'%'};return _0x1a109f;}})});}_0x35def0=_['merge']({},_0x35def0,_0x5958ef[_0x055e('0x3d')]);var _0x233423={'where':_0x35def0['where']};return db[_0x055e('0x27')][_0x055e('0x1c')](_0x233423)[_0x055e('0x22')](function(_0x4ac128){_0x7822db[_0x055e('0x1c')]=_0x4ac128;if(_0x5958ef[_0x055e('0x2e')]['includeAll']){_0x35def0[_0x055e('0x3e')]=[{'all':!![]}];}return db[_0x055e('0x27')][_0x055e('0x3f')](_0x35def0);})['then'](function(_0x228eca){_0x7822db[_0x055e('0x40')]=_0x228eca;return _0x7822db;})[_0x055e('0x22')](respondWithFilteredResult(_0x1528c3,_0x35def0))['catch'](handleError(_0x1528c3,null));};exports['show']=function(_0x27c49c,_0x237318){var _0x4ff19e={'raw':!![],'where':{'id':_0x27c49c['params']['id']}},_0x3a5bc5={};_0x3a5bc5[_0x055e('0x2c')]=_['keys'](db[_0x055e('0x27')][_0x055e('0x28')]);_0x3a5bc5[_0x055e('0x2e')]=_['keys'](_0x27c49c['query']);_0x3a5bc5[_0x055e('0x30')]=_[_0x055e('0x31')](_0x3a5bc5[_0x055e('0x2c')],_0x3a5bc5[_0x055e('0x2e')]);_0x4ff19e['attributes']=_['intersection'](_0x3a5bc5[_0x055e('0x2c')],qs[_0x055e('0x41')](_0x27c49c['query'][_0x055e('0x41')]));_0x4ff19e[_0x055e('0x32')]=_0x4ff19e[_0x055e('0x32')][_0x055e('0x33')]?_0x4ff19e[_0x055e('0x32')]:_0x3a5bc5[_0x055e('0x2c')];if(_0x27c49c['query'][_0x055e('0x42')]){_0x4ff19e[_0x055e('0x3e')]=[{'all':!![]}];}_0x4ff19e=_['merge']({},_0x4ff19e,_0x27c49c[_0x055e('0x3d')]);return db[_0x055e('0x27')][_0x055e('0x43')](_0x4ff19e)[_0x055e('0x22')](handleEntityNotFound(_0x237318,null))[_0x055e('0x22')](respondWithResult(_0x237318,null))[_0x055e('0x44')](handleError(_0x237318,null));};exports[_0x055e('0x45')]=function(_0x4ee2f8,_0x35b2c6){return db['FreshdeskField'][_0x055e('0x45')](_0x4ee2f8[_0x055e('0x46')],{})[_0x055e('0x22')](respondWithResult(_0x35b2c6,0xc9))['catch'](handleError(_0x35b2c6,null));};exports['update']=function(_0x45845e,_0x20114c){if(_0x45845e[_0x055e('0x46')]['id']){delete _0x45845e[_0x055e('0x46')]['id'];}return db[_0x055e('0x27')][_0x055e('0x43')]({'where':{'id':_0x45845e[_0x055e('0x47')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x20114c,null))[_0x055e('0x22')](saveUpdates(_0x45845e['body'],null))[_0x055e('0x22')](respondWithResult(_0x20114c,null))[_0x055e('0x44')](handleError(_0x20114c,null));};exports[_0x055e('0x48')]=function(_0x17695b,_0x335415){return db['FreshdeskField'][_0x055e('0x43')]({'where':{'id':_0x17695b[_0x055e('0x47')]['id']}})[_0x055e('0x22')](handleEntityNotFound(_0x335415,null))['then'](removeEntity(_0x335415,null))[_0x055e('0x44')](handleError(_0x335415,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 29d0ee7..4975083 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 _0xe526=['FreshdeskField','freshdesk_unique_index','idField','FieldId','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0xd03355,_0x2ffd0b){var _0x49bafd=function(_0x32dc40){while(--_0x32dc40){_0xd03355['push'](_0xd03355['shift']());}};_0x49bafd(++_0x2ffd0b);}(_0xe526,0x6c));var _0x6e52=function(_0x5b8a2d,_0x27f682){_0x5b8a2d=_0x5b8a2d-0x0;var _0x3c4bbe=_0xe526[_0x5b8a2d];return _0x3c4bbe;};'use strict';var _=require('lodash');var util=require(_0x6e52('0x0'));var logger=require('../../config/logger')(_0x6e52('0x1'));var moment=require('moment');var BPromise=require(_0x6e52('0x2'));var rp=require(_0x6e52('0x3'));var fs=require('fs');var path=require(_0x6e52('0x4'));var rimraf=require(_0x6e52('0x5'));var config=require(_0x6e52('0x6'));var attributes=require(_0x6e52('0x7'));module['exports']=function(_0xf6cc3a,_0x652124){return _0xf6cc3a[_0x6e52('0x8')](_0x6e52('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x6e52('0xa'),'fields':[_0x6e52('0xb'),_0x6e52('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14b9=['request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x405927,_0x2179e0){var _0x4704ca=function(_0x5820a5){while(--_0x5820a5){_0x405927['push'](_0x405927['shift']());}};_0x4704ca(++_0x2179e0);}(_0x14b9,0x191));var _0x914b=function(_0x3a1efd,_0x174ca8){_0x3a1efd=_0x3a1efd-0x0;var _0x5b25b9=_0x14b9[_0x3a1efd];return _0x5b25b9;};'use strict';var _=require(_0x914b('0x0'));var util=require('util');var logger=require(_0x914b('0x1'))(_0x914b('0x2'));var moment=require(_0x914b('0x3'));var BPromise=require(_0x914b('0x4'));var rp=require(_0x914b('0x5'));var fs=require('fs');var path=require(_0x914b('0x6'));var rimraf=require('rimraf');var config=require(_0x914b('0x7'));var attributes=require(_0x914b('0x8'));module[_0x914b('0x9')]=function(_0x105ca0,_0x3aaec8){return _0x105ca0['define'](_0x914b('0xa'),attributes,{'tableName':_0x914b('0xb'),'paranoid':![],'indexes':[{'name':_0x914b('0xc'),'fields':[_0x914b('0xd'),'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 16cb3e8..4d14777 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 _0x92a2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0x92a2,0x134));var _0x292a=function(_0x23a182,_0x1b0c10){_0x23a182=_0x23a182-0x0;var _0x4144b1=_0x92a2[_0x23a182];return _0x4144b1;};'use strict';var _=require(_0x292a('0x0'));var util=require('util');var moment=require(_0x292a('0x1'));var BPromise=require(_0x292a('0x2'));var rs=require(_0x292a('0x3'));var fs=require('fs');var Redis=require(_0x292a('0x4'));var db=require(_0x292a('0x5'))['db'];var utils=require(_0x292a('0x6'));var logger=require(_0x292a('0x7'))('rpc');var config=require(_0x292a('0x8'));var jayson=require(_0x292a('0x9'));var client=jayson[_0x292a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c854d,_0x523cf2,_0x23038e){return new BPromise(function(_0x259841,_0x3a2e29){return client[_0x292a('0xb')](_0x1c854d,_0x23038e)[_0x292a('0xc')](function(_0x2b98f3){logger[_0x292a('0xd')](_0x292a('0xe'),_0x523cf2,_0x292a('0xf'));logger[_0x292a('0x10')](_0x292a('0x11'),_0x523cf2,_0x292a('0xf'),JSON[_0x292a('0x12')](_0x2b98f3));if(_0x2b98f3[_0x292a('0x13')]){if(_0x2b98f3['error'][_0x292a('0x14')]===0x1f4){logger[_0x292a('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x523cf2,_0x2b98f3['error'][_0x292a('0x15')]);return _0x3a2e29(_0x2b98f3[_0x292a('0x13')]['message']);}logger[_0x292a('0x13')](_0x292a('0xe'),_0x523cf2,_0x2b98f3[_0x292a('0x13')][_0x292a('0x15')]);return _0x259841(_0x2b98f3[_0x292a('0x13')]['message']);}else{logger[_0x292a('0xd')](_0x292a('0xe'),_0x523cf2,_0x292a('0xf'));_0x259841(_0x2b98f3[_0x292a('0x16')][_0x292a('0x15')]);}})[_0x292a('0x17')](function(_0x45bda2){logger['error'](_0x292a('0xe'),_0x523cf2,_0x45bda2);_0x3a2e29(_0x45bda2);});});} \ No newline at end of file +var _0x24cb=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x24cb,0x8f));var _0xb24c=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x24cb[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0xb24c('0x0'));var moment=require(_0xb24c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb24c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb24c('0x3'))['db'];var utils=require(_0xb24c('0x4'));var logger=require(_0xb24c('0x5'))('rpc');var config=require(_0xb24c('0x6'));var jayson=require(_0xb24c('0x7'));var client=jayson[_0xb24c('0x8')][_0xb24c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47bb4c,_0x307d9a,_0x11897b){return new BPromise(function(_0x4986f8,_0x4d355f){return client['request'](_0x47bb4c,_0x11897b)[_0xb24c('0xa')](function(_0x4e5e32){logger[_0xb24c('0xb')](_0xb24c('0xc'),_0x307d9a,_0xb24c('0xd'));logger[_0xb24c('0xe')](_0xb24c('0xf'),_0x307d9a,_0xb24c('0xd'),JSON[_0xb24c('0x10')](_0x4e5e32));if(_0x4e5e32[_0xb24c('0x11')]){if(_0x4e5e32[_0xb24c('0x11')][_0xb24c('0x12')]===0x1f4){logger[_0xb24c('0x11')](_0xb24c('0xc'),_0x307d9a,_0x4e5e32[_0xb24c('0x11')]['message']);return _0x4d355f(_0x4e5e32['error']['message']);}logger[_0xb24c('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x307d9a,_0x4e5e32[_0xb24c('0x11')][_0xb24c('0x13')]);return _0x4986f8(_0x4e5e32[_0xb24c('0x11')][_0xb24c('0x13')]);}else{logger[_0xb24c('0xb')](_0xb24c('0xc'),_0x307d9a,_0xb24c('0xd'));_0x4986f8(_0x4e5e32[_0xb24c('0x14')]['message']);}})[_0xb24c('0x15')](function(_0x45b31c){logger[_0xb24c('0x11')](_0xb24c('0xc'),_0x307d9a,_0x45b31c);_0x4d355f(_0x45b31c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8dfae69..0fdd84c 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 _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x39b40f,_0x5633ae){var _0x223bf5=function(_0x4d3b6a){while(--_0x4d3b6a){_0x39b40f['push'](_0x39b40f['shift']());}};_0x223bf5(++_0x5633ae);}(_0x57f8,0x198));var _0x857f=function(_0x51227e,_0x21f277){_0x51227e=_0x51227e-0x0;var _0x457194=_0x57f8[_0x51227e];return _0x457194;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file +var _0x36ee=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x52cfa3,_0x32824e){var _0x2e0cb6=function(_0x4cb51d){while(--_0x4cb51d){_0x52cfa3['push'](_0x52cfa3['shift']());}};_0x2e0cb6(++_0x32824e);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x11')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x11')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x13')]);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router[_0xe36e('0x15')]('/:id',auth[_0xe36e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ecf477b..ea54812 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x658d6c,_0x297996){var _0xba451a=function(_0x160e90){while(--_0x160e90){_0x658d6c['push'](_0x658d6c['shift']());}};_0xba451a(++_0x297996);}(_0x5204,0xdf));var _0x4520=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x5204[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3a6d=['exports','STRING','username','sequelize'];(function(_0x23b416,_0x8fefea){var _0x4013ca=function(_0x13a1a4){while(--_0x13a1a4){_0x23b416['push'](_0x23b416['shift']());}};_0x4013ca(++_0x8fefea);}(_0x3a6d,0x143));var _0xd3a6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3a6d[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'apiKey':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize[_0xd3a6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd3a6('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 f122bea..3136213 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 _0xa2d8=['undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','getConfigurations','findOne','order','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset'];(function(_0x17c84b,_0x209fb2){var _0x168720=function(_0xdafa7f){while(--_0xdafa7f){_0x17c84b['push'](_0x17c84b['shift']());}};_0x168720(++_0x209fb2);}(_0xa2d8,0x115));var _0x8a2d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2d8[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x8a2d('0x0'));var rimraf=require(_0x8a2d('0x1'));var zipdir=require(_0x8a2d('0x2'));var jsonpatch=require(_0x8a2d('0x3'));var rp=require('request-promise');var moment=require(_0x8a2d('0x4'));var BPromise=require(_0x8a2d('0x5'));var Mustache=require('mustache');var util=require(_0x8a2d('0x6'));var path=require(_0x8a2d('0x7'));var sox=require(_0x8a2d('0x8'));var csv=require(_0x8a2d('0x9'));var ejs=require(_0x8a2d('0xa'));var fs=require('fs');var fs_extra=require(_0x8a2d('0xb'));var _=require(_0x8a2d('0xc'));var squel=require(_0x8a2d('0xd'));var crypto=require(_0x8a2d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8a2d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8a2d('0x10'));var Papa=require(_0x8a2d('0x11'));var Redis=require(_0x8a2d('0x12'));var authService=require(_0x8a2d('0x13'));var qs=require(_0x8a2d('0x14'));var as=require(_0x8a2d('0x15'));var hardwareService=require(_0x8a2d('0x16'));var logger=require('../../config/logger')(_0x8a2d('0x17'));var utils=require('../../config/utils');var config=require(_0x8a2d('0x18'));var licenseUtil=require(_0x8a2d('0x19'));var db=require(_0x8a2d('0x1a'))['db'];var integrations=require(_0x8a2d('0x1b'));function respondWithStatusCode(_0x51c8f8,_0x540eef){_0x540eef=_0x540eef||0xcc;return function(_0x206e06){if(_0x206e06){return _0x51c8f8['sendStatus'](_0x540eef);}return _0x51c8f8[_0x8a2d('0x1c')](_0x540eef)[_0x8a2d('0x1d')]();};}function respondWithResult(_0x424faf,_0x84847b){_0x84847b=_0x84847b||0xc8;return function(_0xc60c4){if(_0xc60c4){return _0x424faf[_0x8a2d('0x1c')](_0x84847b)[_0x8a2d('0x1e')](_0xc60c4);}};}function respondWithFilteredResult(_0xc9eb09,_0x56e98b){return function(_0x4f6e7a){if(_0x4f6e7a){var _0x545db7=typeof _0x56e98b[_0x8a2d('0x1f')]===_0x8a2d('0x20')&&typeof _0x56e98b[_0x8a2d('0x21')]===_0x8a2d('0x20');var _0x2549ee=_0x4f6e7a[_0x8a2d('0x22')];var _0x5f594a=_0x545db7?0x0:_0x56e98b[_0x8a2d('0x1f')];var _0x5e84d1=_0x545db7?_0x4f6e7a[_0x8a2d('0x22')]:_0x56e98b[_0x8a2d('0x1f')]+_0x56e98b['limit'];var _0x3ffde5;if(_0x5e84d1>=_0x2549ee){_0x5e84d1=_0x2549ee;_0x3ffde5=0xc8;}else{_0x3ffde5=0xce;}_0xc9eb09['status'](_0x3ffde5);return _0xc9eb09[_0x8a2d('0x23')]('Content-Range',_0x5f594a+'-'+_0x5e84d1+'/'+_0x2549ee)['json'](_0x4f6e7a);}return null;};}function patchUpdates(_0x3eed25){return function(_0x1a4a81){try{jsonpatch[_0x8a2d('0x24')](_0x1a4a81,_0x3eed25,!![]);}catch(_0x53abf0){return BPromise['reject'](_0x53abf0);}return _0x1a4a81[_0x8a2d('0x25')]();};}function saveUpdates(_0x3a55fe,_0x46fd21){return function(_0x31b03f){if(_0x31b03f){return _0x31b03f[_0x8a2d('0x26')](_0x3a55fe)[_0x8a2d('0x27')](function(_0xfceea9){return _0xfceea9;});}return null;};}function removeEntity(_0x4a9e15,_0x431eaa){return function(_0x4decaa){if(_0x4decaa){return _0x4decaa[_0x8a2d('0x28')]()[_0x8a2d('0x27')](function(){_0x4a9e15[_0x8a2d('0x1c')](0xcc)[_0x8a2d('0x1d')]();});}};}function handleEntityNotFound(_0x4c31b3,_0xf3d64){return function(_0x516d99){if(!_0x516d99){_0x4c31b3[_0x8a2d('0x29')](0x194);}return _0x516d99;};}function handleError(_0x522e2b,_0x2df8fd){_0x2df8fd=_0x2df8fd||0x1f4;return function(_0x277247){logger['error'](_0x277247[_0x8a2d('0x2a')]);if(_0x277247['name']){delete _0x277247[_0x8a2d('0x2b')];}_0x522e2b[_0x8a2d('0x1c')](_0x2df8fd)[_0x8a2d('0x2c')](_0x277247);};}exports[_0x8a2d('0x2d')]=function(_0x53b0f8,_0x1ed4bd){var _0x4ec402={},_0x47b64b={},_0x2b5bc6={'count':0x0,'rows':[]};var _0x4390fd=_[_0x8a2d('0x2e')](db[_0x8a2d('0x2f')][_0x8a2d('0x30')],function(_0x5e3a7c){return{'name':_0x5e3a7c[_0x8a2d('0x31')],'type':_0x5e3a7c[_0x8a2d('0x32')]['key']};});_0x47b64b[_0x8a2d('0x33')]=_['map'](_0x4390fd,_0x8a2d('0x2b'));_0x47b64b['query']=_['keys'](_0x53b0f8[_0x8a2d('0x34')]);_0x47b64b[_0x8a2d('0x35')]=_[_0x8a2d('0x36')](_0x47b64b['model'],_0x47b64b['query']);_0x4ec402['attributes']=_['intersection'](_0x47b64b[_0x8a2d('0x33')],qs[_0x8a2d('0x37')](_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x37')]));_0x4ec402[_0x8a2d('0x38')]=_0x4ec402[_0x8a2d('0x38')][_0x8a2d('0x39')]?_0x4ec402[_0x8a2d('0x38')]:_0x47b64b[_0x8a2d('0x33')];if(!_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x3a')](_0x8a2d('0x3b'))){_0x4ec402[_0x8a2d('0x21')]=qs[_0x8a2d('0x21')](_0x53b0f8['query']['limit']);_0x4ec402['offset']=qs[_0x8a2d('0x1f')](_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x1f')]);}_0x4ec402['order']=qs[_0x8a2d('0x3c')](_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x3c')]);_0x4ec402['where']=qs[_0x8a2d('0x35')](_[_0x8a2d('0x3d')](_0x53b0f8[_0x8a2d('0x34')],_0x47b64b[_0x8a2d('0x35')]),_0x4390fd);if(_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x3e')]){_0x4ec402[_0x8a2d('0x3f')]=_[_0x8a2d('0x40')](_0x4ec402[_0x8a2d('0x3f')],{'$or':_[_0x8a2d('0x2e')](_0x4390fd,function(_0x8e5414){if(_0x8e5414[_0x8a2d('0x32')]!=='VIRTUAL'){var _0x48decb={};_0x48decb[_0x8e5414[_0x8a2d('0x2b')]]={'$like':'%'+_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x3e')]+'%'};return _0x48decb;}})});}_0x4ec402=_[_0x8a2d('0x40')]({},_0x4ec402,_0x53b0f8[_0x8a2d('0x41')]);var _0x37d7e9={'where':_0x4ec402['where']};return db[_0x8a2d('0x2f')][_0x8a2d('0x22')](_0x37d7e9)[_0x8a2d('0x27')](function(_0xe577ea){_0x2b5bc6[_0x8a2d('0x22')]=_0xe577ea;if(_0x53b0f8[_0x8a2d('0x34')][_0x8a2d('0x42')]){_0x4ec402[_0x8a2d('0x43')]=[{'all':!![]}];}return db[_0x8a2d('0x2f')][_0x8a2d('0x44')](_0x4ec402);})[_0x8a2d('0x27')](function(_0x5d5f51){_0x2b5bc6['rows']=_0x5d5f51;return _0x2b5bc6;})['then'](respondWithFilteredResult(_0x1ed4bd,_0x4ec402))[_0x8a2d('0x45')](handleError(_0x1ed4bd,null));};exports['show']=function(_0x1ab598,_0x16cc26){var _0xedf719={'raw':![],'where':{'id':_0x1ab598[_0x8a2d('0x46')]['id']}},_0x3aa189={};_0x3aa189['model']=_[_0x8a2d('0x47')](db[_0x8a2d('0x2f')]['rawAttributes']);_0x3aa189[_0x8a2d('0x34')]=_[_0x8a2d('0x47')](_0x1ab598[_0x8a2d('0x34')]);_0x3aa189[_0x8a2d('0x35')]=_['intersection'](_0x3aa189[_0x8a2d('0x33')],_0x3aa189['query']);_0xedf719[_0x8a2d('0x38')]=_[_0x8a2d('0x36')](_0x3aa189['model'],qs[_0x8a2d('0x37')](_0x1ab598[_0x8a2d('0x34')][_0x8a2d('0x37')]));_0xedf719['attributes']=_0xedf719['attributes']['length']?_0xedf719[_0x8a2d('0x38')]:_0x3aa189[_0x8a2d('0x33')];if(_0x1ab598[_0x8a2d('0x34')][_0x8a2d('0x42')]){_0xedf719[_0x8a2d('0x43')]=[{'all':!![]}];}_0xedf719=_[_0x8a2d('0x40')]({},_0xedf719,_0x1ab598[_0x8a2d('0x41')]);return db[_0x8a2d('0x2f')][_0x8a2d('0x48')](_0xedf719)['then'](handleEntityNotFound(_0x16cc26,null))[_0x8a2d('0x27')](respondWithResult(_0x16cc26,null))[_0x8a2d('0x45')](handleError(_0x16cc26,null));};exports[_0x8a2d('0x49')]=function(_0x1e9af1,_0x288544){return db[_0x8a2d('0x2f')]['create'](_0x1e9af1[_0x8a2d('0x4a')],{})['then'](respondWithResult(_0x288544,0xc9))[_0x8a2d('0x45')](handleError(_0x288544,null));};exports[_0x8a2d('0x26')]=function(_0x34b7d4,_0x8e5024){if(_0x34b7d4[_0x8a2d('0x4a')]['id']){delete _0x34b7d4[_0x8a2d('0x4a')]['id'];}return db[_0x8a2d('0x2f')][_0x8a2d('0x48')]({'where':{'id':_0x34b7d4[_0x8a2d('0x46')]['id']}})['then'](handleEntityNotFound(_0x8e5024,null))[_0x8a2d('0x27')](saveUpdates(_0x34b7d4[_0x8a2d('0x4a')],null))['then'](respondWithResult(_0x8e5024,null))[_0x8a2d('0x45')](handleError(_0x8e5024,null));};exports[_0x8a2d('0x28')]=function(_0x447fbf,_0x37a46f){return db[_0x8a2d('0x2f')][_0x8a2d('0x48')]({'where':{'id':_0x447fbf[_0x8a2d('0x46')]['id']}})['then'](handleEntityNotFound(_0x37a46f,null))[_0x8a2d('0x27')](removeEntity(_0x37a46f,null))[_0x8a2d('0x45')](handleError(_0x37a46f,null));};exports[_0x8a2d('0x4b')]=function(_0x5413ad,_0x47b012,_0x55947e){var _0x3961ce={};var _0x1f7087={};var _0x432002;var _0x32a5e1;return db[_0x8a2d('0x2f')][_0x8a2d('0x4c')]({'where':{'id':_0x5413ad['params']['id']}})['then'](handleEntityNotFound(_0x47b012,null))[_0x8a2d('0x27')](function(_0x1de029){if(_0x1de029){_0x432002=_0x1de029;_0x1f7087[_0x8a2d('0x33')]=_[_0x8a2d('0x47')](db['FreshsalesConfiguration'][_0x8a2d('0x30')]);_0x1f7087[_0x8a2d('0x34')]=_[_0x8a2d('0x47')](_0x5413ad[_0x8a2d('0x34')]);_0x1f7087['filters']=_['intersection'](_0x1f7087[_0x8a2d('0x33')],_0x1f7087['query']);_0x3961ce['attributes']=_[_0x8a2d('0x36')](_0x1f7087['model'],qs['fields'](_0x5413ad[_0x8a2d('0x34')]['fields']));_0x3961ce[_0x8a2d('0x38')]=_0x3961ce[_0x8a2d('0x38')][_0x8a2d('0x39')]?_0x3961ce[_0x8a2d('0x38')]:_0x1f7087[_0x8a2d('0x33')];_0x3961ce[_0x8a2d('0x4d')]=qs[_0x8a2d('0x3c')](_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x3c')]);_0x3961ce[_0x8a2d('0x3f')]=qs['filters'](_[_0x8a2d('0x3d')](_0x5413ad['query'],_0x1f7087['filters']));if(_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x3e')]){_0x3961ce['where']=_['merge'](_0x3961ce[_0x8a2d('0x3f')],{'$or':_[_0x8a2d('0x2e')](_0x3961ce[_0x8a2d('0x38')],function(_0x26fac1){var _0x558350={};_0x558350[_0x26fac1]={'$like':'%'+_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x3e')]+'%'};return _0x558350;})});}_0x3961ce=_[_0x8a2d('0x40')]({},_0x3961ce,_0x5413ad[_0x8a2d('0x41')]);return _0x432002['getConfigurations'](_0x3961ce);}})['then'](function(_0x722f34){if(_0x722f34){_0x32a5e1=_0x722f34['length'];if(!_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x3a')]('nolimit')){_0x3961ce[_0x8a2d('0x21')]=qs[_0x8a2d('0x21')](_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x21')]);_0x3961ce[_0x8a2d('0x1f')]=qs[_0x8a2d('0x1f')](_0x5413ad[_0x8a2d('0x34')][_0x8a2d('0x1f')]);}return _0x432002[_0x8a2d('0x4b')](_0x3961ce);}})[_0x8a2d('0x27')](function(_0x2738ab){if(_0x2738ab){return _0x2738ab?{'count':_0x32a5e1,'rows':_0x2738ab}:null;}})[_0x8a2d('0x27')](respondWithResult(_0x47b012,null))[_0x8a2d('0x45')](handleError(_0x47b012,null));};exports['addConfiguration']=function(_0x309884,_0x41a4fb,_0x499086){if(_0x309884[_0x8a2d('0x4a')]['id']){delete _0x309884[_0x8a2d('0x4a')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x309884[_0x8a2d('0x46')]['id']}})['then'](handleEntityNotFound(_0x41a4fb,null))[_0x8a2d('0x27')](function(_0x471be2){if(_0x471be2){_0x309884[_0x8a2d('0x4a')]['AccountId']=_0x471be2['id'];_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x4e')]=integrations[_0x8a2d('0x4f')](_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x50')],_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x32')]);_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x51')]=integrations['getDescriptions'](_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x50')],_0x309884[_0x8a2d('0x4a')][_0x8a2d('0x32')]);return db[_0x8a2d('0x52')][_0x8a2d('0x49')](_0x309884[_0x8a2d('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0x8a2d('0x4e')},{'model':db['FreshsalesField'],'as':_0x8a2d('0x51')}]});}return null;})[_0x8a2d('0x27')](respondWithResult(_0x41a4fb,null))['catch'](handleError(_0x41a4fb,null));};exports[_0x8a2d('0x53')]=function(_0x5ccc49,_0x34f4b9,_0x328f78){var _0x266b11='';var _0x5827db='';return db[_0x8a2d('0x2f')]['findOne']({'where':{'id':_0x5ccc49[_0x8a2d('0x46')]['id']},'attributes':['id',_0x8a2d('0x54'),_0x8a2d('0x55'),_0x8a2d('0x56')]})[_0x8a2d('0x27')](handleEntityNotFound(_0x34f4b9,null))[_0x8a2d('0x27')](function(_0x4bf4ed){if(_0x4bf4ed){_0x5827db=_0x4bf4ed[_0x8a2d('0x54')];_0x266b11=_0x4bf4ed[_0x8a2d('0x55')];var _0x3dd606=_0x4bf4ed[_0x8a2d('0x55')][_0x8a2d('0x57')](-0x1);if(_0x3dd606==='/'){_0x266b11=_0x266b11['substring'](0x0,_0x266b11[_0x8a2d('0x58')](_0x3dd606));}return rp({'method':_0x8a2d('0x59'),'uri':util[_0x8a2d('0x5a')](_0x8a2d('0x5b'),_0x266b11,_0x8a2d('0x5c')),'headers':{'Authorization':_0x8a2d('0x5d')+_0x4bf4ed['apiKey']},'json':!![]});}})['then'](function(_0xc389f9){if(_0xc389f9){var _0x1d3b06=_0xc389f9[_0x8a2d('0x5e')];var _0x485a7=![];var _0x18a399=null;for(_0x18a399=0x0;_0x18a399<_0x1d3b06[_0x8a2d('0x39')];_0x18a399++){if(_0x1d3b06[_0x18a399][_0x8a2d('0x5f')]===_0x5827db){_0x485a7=!![];}}if(_0x485a7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8a2d('0x60')});}}})['then'](respondWithResult(_0x34f4b9,null))[_0x8a2d('0x45')](function(_0x31bfcb){var _0x4af850=_0x5ccc49['query'][_0x8a2d('0x61')]?0x1f4:_0x31bfcb[_0x8a2d('0x62')]||0x1f4;logger[_0x8a2d('0x63')](_0x8a2d('0x64'),'getFields',_0x4af850,JSON[_0x8a2d('0x65')](_0x31bfcb));delete _0x31bfcb['name'];if(_0x4af850===0x191){_0x4af850=0x190;}_0x34f4b9[_0x8a2d('0x1c')](_0x4af850)[_0x8a2d('0x2c')](_0x5ccc49['query'][_0x8a2d('0x61')]?{'message':_0x8a2d('0x66'),'statusCode':_0x31bfcb[_0x8a2d('0x62')]}:_0x31bfcb);});}; \ No newline at end of file +var _0xa17c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials'];(function(_0x38ed64,_0x34dd07){var _0x4370e4=function(_0x99c9b3){while(--_0x99c9b3){_0x38ed64['push'](_0x38ed64['shift']());}};_0x4370e4(++_0x34dd07);}(_0xa17c,0x1bc));var _0xca17=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xa17c[_0x22431e];return _0xd978e9;};'use strict';var emlformat=require(_0xca17('0x0'));var rimraf=require(_0xca17('0x1'));var zipdir=require(_0xca17('0x2'));var jsonpatch=require(_0xca17('0x3'));var rp=require(_0xca17('0x4'));var moment=require(_0xca17('0x5'));var BPromise=require(_0xca17('0x6'));var Mustache=require('mustache');var util=require(_0xca17('0x7'));var path=require(_0xca17('0x8'));var sox=require(_0xca17('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca17('0xa'));var _=require(_0xca17('0xb'));var squel=require(_0xca17('0xc'));var crypto=require(_0xca17('0xd'));var jsforce=require(_0xca17('0xe'));var deskjs=require(_0xca17('0xf'));var toCsv=require(_0xca17('0x10'));var querystring=require(_0xca17('0x11'));var Papa=require(_0xca17('0x12'));var Redis=require(_0xca17('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xca17('0x14'));var as=require(_0xca17('0x15'));var hardwareService=require(_0xca17('0x16'));var logger=require(_0xca17('0x17'))(_0xca17('0x18'));var utils=require(_0xca17('0x19'));var config=require(_0xca17('0x1a'));var licenseUtil=require(_0xca17('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xca17('0x1c'));function respondWithStatusCode(_0x249847,_0x4ae3c7){_0x4ae3c7=_0x4ae3c7||0xcc;return function(_0x569717){if(_0x569717){return _0x249847[_0xca17('0x1d')](_0x4ae3c7);}return _0x249847[_0xca17('0x1e')](_0x4ae3c7)[_0xca17('0x1f')]();};}function respondWithResult(_0x154c2e,_0x55d933){_0x55d933=_0x55d933||0xc8;return function(_0x277b97){if(_0x277b97){return _0x154c2e['status'](_0x55d933)[_0xca17('0x20')](_0x277b97);}};}function respondWithFilteredResult(_0x4abf99,_0x10e533){return function(_0x2f6c62){if(_0x2f6c62){var _0x4fef65=typeof _0x10e533[_0xca17('0x21')]===_0xca17('0x22')&&typeof _0x10e533[_0xca17('0x23')]==='undefined';var _0x25c5f0=_0x2f6c62[_0xca17('0x24')];var _0x4b5139=_0x4fef65?0x0:_0x10e533[_0xca17('0x21')];var _0x162649=_0x4fef65?_0x2f6c62[_0xca17('0x24')]:_0x10e533[_0xca17('0x21')]+_0x10e533[_0xca17('0x23')];var _0x3ecb75;if(_0x162649>=_0x25c5f0){_0x162649=_0x25c5f0;_0x3ecb75=0xc8;}else{_0x3ecb75=0xce;}_0x4abf99[_0xca17('0x1e')](_0x3ecb75);return _0x4abf99[_0xca17('0x25')](_0xca17('0x26'),_0x4b5139+'-'+_0x162649+'/'+_0x25c5f0)[_0xca17('0x20')](_0x2f6c62);}return null;};}function patchUpdates(_0x343b94){return function(_0x5cd0bf){try{jsonpatch['apply'](_0x5cd0bf,_0x343b94,!![]);}catch(_0x3d1969){return BPromise[_0xca17('0x27')](_0x3d1969);}return _0x5cd0bf[_0xca17('0x28')]();};}function saveUpdates(_0x9f7c61,_0x1e195c){return function(_0x614081){if(_0x614081){return _0x614081[_0xca17('0x29')](_0x9f7c61)[_0xca17('0x2a')](function(_0x562011){return _0x562011;});}return null;};}function removeEntity(_0xfc13a7,_0x864692){return function(_0x168a9c){if(_0x168a9c){return _0x168a9c[_0xca17('0x2b')]()[_0xca17('0x2a')](function(){_0xfc13a7[_0xca17('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb12d,_0x2753a9){return function(_0xb61f11){if(!_0xb61f11){_0x2fb12d[_0xca17('0x1d')](0x194);}return _0xb61f11;};}function handleError(_0x5e9437,_0x579a66){_0x579a66=_0x579a66||0x1f4;return function(_0x612e67){logger['error'](_0x612e67[_0xca17('0x2c')]);if(_0x612e67[_0xca17('0x2d')]){delete _0x612e67['name'];}_0x5e9437[_0xca17('0x1e')](_0x579a66)['send'](_0x612e67);};}exports[_0xca17('0x2e')]=function(_0x530bac,_0x4bd426){var _0x53954b={},_0x20bd90={},_0x40ede9={'count':0x0,'rows':[]};var _0x2c0f43=_[_0xca17('0x2f')](db[_0xca17('0x30')]['rawAttributes'],function(_0xd59aae){return{'name':_0xd59aae[_0xca17('0x31')],'type':_0xd59aae[_0xca17('0x32')][_0xca17('0x33')]};});_0x20bd90[_0xca17('0x34')]=_[_0xca17('0x2f')](_0x2c0f43,_0xca17('0x2d'));_0x20bd90[_0xca17('0x35')]=_[_0xca17('0x36')](_0x530bac['query']);_0x20bd90[_0xca17('0x37')]=_[_0xca17('0x38')](_0x20bd90[_0xca17('0x34')],_0x20bd90['query']);_0x53954b[_0xca17('0x39')]=_[_0xca17('0x38')](_0x20bd90[_0xca17('0x34')],qs[_0xca17('0x3a')](_0x530bac[_0xca17('0x35')][_0xca17('0x3a')]));_0x53954b[_0xca17('0x39')]=_0x53954b[_0xca17('0x39')][_0xca17('0x3b')]?_0x53954b[_0xca17('0x39')]:_0x20bd90[_0xca17('0x34')];if(!_0x530bac['query'][_0xca17('0x3c')](_0xca17('0x3d'))){_0x53954b[_0xca17('0x23')]=qs[_0xca17('0x23')](_0x530bac[_0xca17('0x35')][_0xca17('0x23')]);_0x53954b[_0xca17('0x21')]=qs[_0xca17('0x21')](_0x530bac[_0xca17('0x35')][_0xca17('0x21')]);}_0x53954b[_0xca17('0x3e')]=qs[_0xca17('0x3f')](_0x530bac[_0xca17('0x35')]['sort']);_0x53954b[_0xca17('0x40')]=qs[_0xca17('0x37')](_[_0xca17('0x41')](_0x530bac[_0xca17('0x35')],_0x20bd90[_0xca17('0x37')]),_0x2c0f43);if(_0x530bac[_0xca17('0x35')][_0xca17('0x42')]){_0x53954b[_0xca17('0x40')]=_[_0xca17('0x43')](_0x53954b['where'],{'$or':_[_0xca17('0x2f')](_0x2c0f43,function(_0xd5815){if(_0xd5815['type']!=='VIRTUAL'){var _0x1b00d7={};_0x1b00d7[_0xd5815['name']]={'$like':'%'+_0x530bac[_0xca17('0x35')][_0xca17('0x42')]+'%'};return _0x1b00d7;}})});}_0x53954b=_[_0xca17('0x43')]({},_0x53954b,_0x530bac[_0xca17('0x44')]);var _0x2903c9={'where':_0x53954b[_0xca17('0x40')]};return db[_0xca17('0x30')][_0xca17('0x24')](_0x2903c9)['then'](function(_0x16b7ee){_0x40ede9[_0xca17('0x24')]=_0x16b7ee;if(_0x530bac['query'][_0xca17('0x45')]){_0x53954b[_0xca17('0x46')]=[{'all':!![]}];}return db[_0xca17('0x30')][_0xca17('0x47')](_0x53954b);})[_0xca17('0x2a')](function(_0x335f37){_0x40ede9[_0xca17('0x48')]=_0x335f37;return _0x40ede9;})[_0xca17('0x2a')](respondWithFilteredResult(_0x4bd426,_0x53954b))[_0xca17('0x49')](handleError(_0x4bd426,null));};exports[_0xca17('0x4a')]=function(_0x50f186,_0x7eeb90){var _0x3be013={'raw':![],'where':{'id':_0x50f186['params']['id']}},_0x2349f9={};_0x2349f9[_0xca17('0x34')]=_[_0xca17('0x36')](db['FreshsalesAccount'][_0xca17('0x4b')]);_0x2349f9['query']=_['keys'](_0x50f186[_0xca17('0x35')]);_0x2349f9[_0xca17('0x37')]=_['intersection'](_0x2349f9[_0xca17('0x34')],_0x2349f9['query']);_0x3be013[_0xca17('0x39')]=_[_0xca17('0x38')](_0x2349f9[_0xca17('0x34')],qs[_0xca17('0x3a')](_0x50f186['query'][_0xca17('0x3a')]));_0x3be013[_0xca17('0x39')]=_0x3be013[_0xca17('0x39')]['length']?_0x3be013[_0xca17('0x39')]:_0x2349f9[_0xca17('0x34')];if(_0x50f186['query']['includeAll']){_0x3be013['include']=[{'all':!![]}];}_0x3be013=_[_0xca17('0x43')]({},_0x3be013,_0x50f186[_0xca17('0x44')]);return db[_0xca17('0x30')]['find'](_0x3be013)['then'](handleEntityNotFound(_0x7eeb90,null))['then'](respondWithResult(_0x7eeb90,null))[_0xca17('0x49')](handleError(_0x7eeb90,null));};exports['create']=function(_0x3d0fae,_0x36b945){return db[_0xca17('0x30')][_0xca17('0x4c')](_0x3d0fae[_0xca17('0x4d')],{})[_0xca17('0x2a')](respondWithResult(_0x36b945,0xc9))['catch'](handleError(_0x36b945,null));};exports[_0xca17('0x29')]=function(_0xfeaa54,_0x225ca4){if(_0xfeaa54[_0xca17('0x4d')]['id']){delete _0xfeaa54[_0xca17('0x4d')]['id'];}return db['FreshsalesAccount'][_0xca17('0x4e')]({'where':{'id':_0xfeaa54[_0xca17('0x4f')]['id']}})[_0xca17('0x2a')](handleEntityNotFound(_0x225ca4,null))['then'](saveUpdates(_0xfeaa54[_0xca17('0x4d')],null))[_0xca17('0x2a')](respondWithResult(_0x225ca4,null))[_0xca17('0x49')](handleError(_0x225ca4,null));};exports[_0xca17('0x2b')]=function(_0x5e7cd0,_0x47b82f){return db['FreshsalesAccount'][_0xca17('0x4e')]({'where':{'id':_0x5e7cd0[_0xca17('0x4f')]['id']}})[_0xca17('0x2a')](handleEntityNotFound(_0x47b82f,null))[_0xca17('0x2a')](removeEntity(_0x47b82f,null))[_0xca17('0x49')](handleError(_0x47b82f,null));};exports[_0xca17('0x50')]=function(_0x12d0d5,_0x32daee,_0x23a90c){var _0x59170d={};var _0x1b7232={};var _0x1a6bed;var _0x19001b;return db[_0xca17('0x30')][_0xca17('0x51')]({'where':{'id':_0x12d0d5[_0xca17('0x4f')]['id']}})[_0xca17('0x2a')](handleEntityNotFound(_0x32daee,null))[_0xca17('0x2a')](function(_0xff838e){if(_0xff838e){_0x1a6bed=_0xff838e;_0x1b7232[_0xca17('0x34')]=_[_0xca17('0x36')](db[_0xca17('0x52')]['rawAttributes']);_0x1b7232[_0xca17('0x35')]=_[_0xca17('0x36')](_0x12d0d5[_0xca17('0x35')]);_0x1b7232['filters']=_[_0xca17('0x38')](_0x1b7232[_0xca17('0x34')],_0x1b7232[_0xca17('0x35')]);_0x59170d[_0xca17('0x39')]=_['intersection'](_0x1b7232[_0xca17('0x34')],qs[_0xca17('0x3a')](_0x12d0d5[_0xca17('0x35')][_0xca17('0x3a')]));_0x59170d['attributes']=_0x59170d['attributes']['length']?_0x59170d[_0xca17('0x39')]:_0x1b7232[_0xca17('0x34')];_0x59170d['order']=qs['sort'](_0x12d0d5['query'][_0xca17('0x3f')]);_0x59170d[_0xca17('0x40')]=qs[_0xca17('0x37')](_[_0xca17('0x41')](_0x12d0d5[_0xca17('0x35')],_0x1b7232[_0xca17('0x37')]));if(_0x12d0d5[_0xca17('0x35')]['filter']){_0x59170d['where']=_[_0xca17('0x43')](_0x59170d['where'],{'$or':_[_0xca17('0x2f')](_0x59170d[_0xca17('0x39')],function(_0x532107){var _0x230319={};_0x230319[_0x532107]={'$like':'%'+_0x12d0d5[_0xca17('0x35')]['filter']+'%'};return _0x230319;})});}_0x59170d=_[_0xca17('0x43')]({},_0x59170d,_0x12d0d5[_0xca17('0x44')]);return _0x1a6bed[_0xca17('0x50')](_0x59170d);}})[_0xca17('0x2a')](function(_0x15da8f){if(_0x15da8f){_0x19001b=_0x15da8f[_0xca17('0x3b')];if(!_0x12d0d5[_0xca17('0x35')][_0xca17('0x3c')](_0xca17('0x3d'))){_0x59170d[_0xca17('0x23')]=qs[_0xca17('0x23')](_0x12d0d5['query'][_0xca17('0x23')]);_0x59170d[_0xca17('0x21')]=qs[_0xca17('0x21')](_0x12d0d5[_0xca17('0x35')][_0xca17('0x21')]);}return _0x1a6bed[_0xca17('0x50')](_0x59170d);}})['then'](function(_0x1f088e){if(_0x1f088e){return _0x1f088e?{'count':_0x19001b,'rows':_0x1f088e}:null;}})[_0xca17('0x2a')](respondWithResult(_0x32daee,null))[_0xca17('0x49')](handleError(_0x32daee,null));};exports[_0xca17('0x53')]=function(_0x2ff1fa,_0x5c0eda,_0x5a91a2){if(_0x2ff1fa[_0xca17('0x4d')]['id']){delete _0x2ff1fa[_0xca17('0x4d')]['id'];}return db[_0xca17('0x30')][_0xca17('0x51')]({'where':{'id':_0x2ff1fa[_0xca17('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c0eda,null))['then'](function(_0x4a9bbf){if(_0x4a9bbf){_0x2ff1fa[_0xca17('0x4d')][_0xca17('0x54')]=_0x4a9bbf['id'];_0x2ff1fa['body'][_0xca17('0x55')]=integrations[_0xca17('0x56')](_0x2ff1fa[_0xca17('0x4d')][_0xca17('0x57')],_0x2ff1fa[_0xca17('0x4d')]['type']);_0x2ff1fa['body']['Descriptions']=integrations[_0xca17('0x58')](_0x2ff1fa['body']['channel'],_0x2ff1fa[_0xca17('0x4d')][_0xca17('0x32')]);return db[_0xca17('0x52')][_0xca17('0x4c')](_0x2ff1fa[_0xca17('0x4d')],{'include':[{'model':db[_0xca17('0x59')],'as':_0xca17('0x55')},{'model':db[_0xca17('0x59')],'as':_0xca17('0x5a')}]});}return null;})[_0xca17('0x2a')](respondWithResult(_0x5c0eda,null))['catch'](handleError(_0x5c0eda,null));};exports[_0xca17('0x5b')]=function(_0x5e21c7,_0x3d654d,_0x8fc602){var _0x5e7177='';var _0x3ff896='';return db[_0xca17('0x30')][_0xca17('0x51')]({'where':{'id':_0x5e21c7[_0xca17('0x4f')]['id']},'attributes':['id',_0xca17('0x5c'),_0xca17('0x5d'),_0xca17('0x5e')]})['then'](handleEntityNotFound(_0x3d654d,null))['then'](function(_0xa474c9){if(_0xa474c9){_0x3ff896=_0xa474c9[_0xca17('0x5c')];_0x5e7177=_0xa474c9[_0xca17('0x5d')];var _0xcf3fcd=_0xa474c9[_0xca17('0x5d')][_0xca17('0x5f')](-0x1);if(_0xcf3fcd==='/'){_0x5e7177=_0x5e7177[_0xca17('0x60')](0x0,_0x5e7177['lastIndexOf'](_0xcf3fcd));}return rp({'method':_0xca17('0x61'),'uri':util[_0xca17('0x62')](_0xca17('0x63'),_0x5e7177,_0xca17('0x64')),'headers':{'Authorization':'Token\x20token='+_0xa474c9[_0xca17('0x5e')]},'json':!![]});}})['then'](function(_0xd00b9c){if(_0xd00b9c){var _0x371152=_0xd00b9c[_0xca17('0x65')];var _0x544c00=![];var _0x1ed5cb=null;for(_0x1ed5cb=0x0;_0x1ed5cb<_0x371152[_0xca17('0x3b')];_0x1ed5cb++){if(_0x371152[_0x1ed5cb][_0xca17('0x66')]===_0x3ff896){_0x544c00=!![];}}if(_0x544c00){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xca17('0x67')});}}})['then'](respondWithResult(_0x3d654d,null))[_0xca17('0x49')](function(_0x19bff5){var _0x2e8e4a=_0x5e21c7[_0xca17('0x35')][_0xca17('0x68')]?0x1f4:_0x19bff5[_0xca17('0x69')]||0x1f4;logger[_0xca17('0x6a')](_0xca17('0x6b'),_0xca17('0x5b'),_0x2e8e4a,JSON[_0xca17('0x6c')](_0x19bff5));delete _0x19bff5[_0xca17('0x2d')];if(_0x2e8e4a===0x191){_0x2e8e4a=0x190;}_0x3d654d[_0xca17('0x1e')](_0x2e8e4a)[_0xca17('0x6d')](_0x5e21c7[_0xca17('0x35')]['test']?{'message':_0xca17('0x6e'),'statusCode':_0x19bff5[_0xca17('0x69')]}:_0x19bff5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4ca233a..2fbeda7 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 _0x33af=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x33af,0xec));var _0xf33a=function(_0x282f96,_0x2be4be){_0x282f96=_0x282f96-0x0;var _0x12d02b=_0x33af[_0x282f96];return _0x12d02b;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));var integrations=require(_0xf33a('0x8'));module['exports']=function(_0xc0dd13,_0x384b14){return _0xc0dd13[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1687e6,_0x26c7b8){var _0x5672b3=function(_0x5e8398){while(--_0x5e8398){_0x1687e6['push'](_0x1687e6['shift']());}};_0x5672b3(++_0x26c7b8);}(_0x32f4,0x154));var _0x432f=function(_0x237d29,_0x439645){_0x237d29=_0x237d29-0x0;var _0x1e73ad=_0x32f4[_0x237d29];return _0x1e73ad;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));var integrations=require(_0x432f('0x9'));module[_0x432f('0xa')]=function(_0x5d8cc0,_0x5b5f08){return _0x5d8cc0[_0x432f('0xb')](_0x432f('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 5011a54..ac225e4 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 _0x2542=['options','raw','attributes','include','map','model','catch','ShowFreshsalesAccount','FreshsalesAccount','find','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','GetFreshsalesAccount','findAll'];(function(_0x309f40,_0x467a80){var _0x3d8d95=function(_0x245987){while(--_0x245987){_0x309f40['push'](_0x309f40['shift']());}};_0x3d8d95(++_0x467a80);}(_0x2542,0x169));var _0x2254=function(_0x59131,_0x507aa2){_0x59131=_0x59131-0x0;var _0x5eee1a=_0x2542[_0x59131];return _0x5eee1a;};'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['FreshsalesAccount'][_0x2254('0x17')]({'raw':_0x1ae11e[_0x2254('0x18')]?_0x1ae11e[_0x2254('0x18')][_0x2254('0x19')]===undefined?!![]:![]:!![],'where':_0x1ae11e[_0x2254('0x18')]?_0x1ae11e[_0x2254('0x18')]['where']||null:null,'attributes':_0x1ae11e[_0x2254('0x18')]?_0x1ae11e[_0x2254('0x18')][_0x2254('0x1a')]||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options']['limit']||null:null,'include':_0x1ae11e[_0x2254('0x18')]?_0x1ae11e[_0x2254('0x18')][_0x2254('0x1b')]?_['map'](_0x1ae11e['options']['include'],function(_0x540020){return{'model':db[_0x540020['model']],'as':_0x540020['as'],'attributes':_0x540020['attributes'],'include':_0x540020[_0x2254('0x1b')]?_[_0x2254('0x1c')](_0x540020[_0x2254('0x1b')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x1d')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x1a')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x1b')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x1d')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2254('0xc')](function(_0x3aa0bd){logger[_0x2254('0xd')]('GetFreshsalesAccount',_0x1ae11e);logger[_0x2254('0xf')](_0x2254('0x16'),_0x1ae11e,JSON[_0x2254('0x12')](_0x3aa0bd));_0x497724(_0x3aa0bd);})[_0x2254('0x1e')](function(_0x13366a){logger[_0x2254('0x14')](_0x2254('0x16'),_0x13366a[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x13366a[_0x2254('0x15')]));});});};exports[_0x2254('0x1f')]=function(_0xad7774){var _0x220f2a=this;return new Promise(function(_0x27d30a,_0x4577f4){return db[_0x2254('0x20')][_0x2254('0x21')]({'raw':_0xad7774[_0x2254('0x18')]?_0xad7774[_0x2254('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xad7774[_0x2254('0x18')]?_0xad7774[_0x2254('0x18')][_0x2254('0x22')]||null:null,'attributes':_0xad7774[_0x2254('0x18')]?_0xad7774[_0x2254('0x18')][_0x2254('0x1a')]||null:null,'include':_0xad7774[_0x2254('0x18')]?_0xad7774[_0x2254('0x18')][_0x2254('0x1b')]?_['map'](_0xad7774[_0x2254('0x18')][_0x2254('0x1b')],function(_0x503540){return{'model':db[_0x503540[_0x2254('0x1d')]],'as':_0x503540['as'],'attributes':_0x503540[_0x2254('0x1a')],'include':_0x503540[_0x2254('0x1b')]?_[_0x2254('0x1c')](_0x503540['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x1d')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x1b')]?_[_0x2254('0x1c')](_0x4a2df0[_0x2254('0x1b')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x1d')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2254('0xc')](function(_0x51f235){logger[_0x2254('0xd')](_0x2254('0x1f'),_0xad7774);logger[_0x2254('0xf')](_0x2254('0x1f'),_0xad7774,JSON[_0x2254('0x12')](_0x51f235));_0x27d30a(_0x51f235);})[_0x2254('0x1e')](function(_0x3e7ccb){logger[_0x2254('0x14')](_0x2254('0x1f'),_0x3e7ccb[_0x2254('0x15')],_0xad7774);_0x4577f4(_0x220f2a['error'](0x1f4,_0x3e7ccb[_0x2254('0x15')]));});});}; \ No newline at end of file +var _0x5430=['map','model','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include'];(function(_0x54b53e,_0xc854d0){var _0x11eb9b=function(_0x535a8b){while(--_0x535a8b){_0x54b53e['push'](_0x54b53e['shift']());}};_0x11eb9b(++_0xc854d0);}(_0x5430,0x10c));var _0x0543=function(_0x41eae9,_0x22523e){_0x41eae9=_0x41eae9-0x0;var _0x1f024a=_0x5430[_0x41eae9];return _0x1f024a;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['findAll']({'raw':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x20b396[_0x0543('0x17')]?_0x20b396['options'][_0x0543('0x19')]||null:null,'attributes':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'limit':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1b')]||null:null,'include':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x20b396['options']['include'],function(_0x59f1b2){return{'model':db[_0x59f1b2[_0x0543('0x1e')]],'as':_0x59f1b2['as'],'attributes':_0x59f1b2[_0x0543('0x1a')],'include':_0x59f1b2[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x59f1b2[_0x0543('0x1c')],function(_0x26e500){return{'model':db[_0x26e500[_0x0543('0x1e')]],'as':_0x26e500['as'],'attributes':_0x26e500[_0x0543('0x1a')],'include':_0x26e500[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x26e500[_0x0543('0x1c')],function(_0x21fc63){return{'model':db[_0x21fc63['model']],'as':_0x21fc63['as'],'attributes':_0x21fc63[_0x0543('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x30ad9e){logger['info'](_0x0543('0x15'),_0x20b396);logger[_0x0543('0xe')](_0x0543('0x15'),_0x20b396,JSON[_0x0543('0xf')](_0x30ad9e));_0x577cf0(_0x30ad9e);})['catch'](function(_0x1732be){logger[_0x0543('0x10')]('GetFreshsalesAccount',_0x1732be['message'],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x1732be[_0x0543('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x3b879b){var _0x2e03d1=this;return new Promise(function(_0x931ccc,_0x2bd6ce){return db[_0x0543('0x16')][_0x0543('0x1f')]({'raw':_0x3b879b[_0x0543('0x17')]?_0x3b879b['options'][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')][_0x0543('0x19')]||null:null,'attributes':_0x3b879b[_0x0543('0x17')]?_0x3b879b[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'include':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')]['include']?_[_0x0543('0x1d')](_0x3b879b[_0x0543('0x17')][_0x0543('0x1c')],function(_0x327027){return{'model':db[_0x327027['model']],'as':_0x327027['as'],'attributes':_0x327027[_0x0543('0x1a')],'include':_0x327027['include']?_[_0x0543('0x1d')](_0x327027[_0x0543('0x1c')],function(_0x3fbf5f){return{'model':db[_0x3fbf5f[_0x0543('0x1e')]],'as':_0x3fbf5f['as'],'attributes':_0x3fbf5f[_0x0543('0x1a')],'include':_0x3fbf5f[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x3fbf5f[_0x0543('0x1c')],function(_0x8ef4d4){return{'model':db[_0x8ef4d4[_0x0543('0x1e')]],'as':_0x8ef4d4['as'],'attributes':_0x8ef4d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x2d76d6){logger['info'](_0x0543('0x20'),_0x3b879b);logger['debug'](_0x0543('0x20'),_0x3b879b,JSON[_0x0543('0xf')](_0x2d76d6));_0x931ccc(_0x2d76d6);})['catch'](function(_0x5e8800){logger[_0x0543('0x10')](_0x0543('0x20'),_0x5e8800['message'],_0x3b879b);_0x2bd6ce(_0x2e03d1[_0x0543('0x10')](0x1f4,_0x5e8800[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0238b8f..9e0506e 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 _0xd477=['/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x1ea170,_0x28d157){var _0x32487e=function(_0x5bebe9){while(--_0x5bebe9){_0x1ea170['push'](_0x1ea170['shift']());}};_0x32487e(++_0x28d157);}(_0xd477,0x1ed));var _0x7d47=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0xd477[_0x15ec4e];return _0xb5e5dd;};'use strict';var multer=require(_0x7d47('0x0'));var util=require('util');var path=require(_0x7d47('0x1'));var timeout=require(_0x7d47('0x2'));var express=require(_0x7d47('0x3'));var router=express[_0x7d47('0x4')]();var fs_extra=require(_0x7d47('0x5'));var auth=require(_0x7d47('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d47('0x7'));router[_0x7d47('0x8')]('/',auth[_0x7d47('0x9')](),controller[_0x7d47('0xa')]);router['get'](_0x7d47('0xb'),auth[_0x7d47('0x9')](),controller[_0x7d47('0xc')]);router[_0x7d47('0x8')](_0x7d47('0xd'),auth[_0x7d47('0x9')](),controller['getSubjects']);router[_0x7d47('0x8')](_0x7d47('0xe'),auth[_0x7d47('0x9')](),controller[_0x7d47('0xf')]);router[_0x7d47('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7d47('0x10')]);router[_0x7d47('0x11')]('/',auth[_0x7d47('0x9')](),controller[_0x7d47('0x12')]);router[_0x7d47('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7d47('0x14')]);router[_0x7d47('0x15')](_0x7d47('0xb'),auth['isAuthenticated'](),controller[_0x7d47('0x16')]);module[_0x7d47('0x17')]=router; \ No newline at end of file +var _0x0575=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create','put','/:id','update','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x1cd833,_0x1766a6){var _0x57001c=function(_0x4b2ba4){while(--_0x4b2ba4){_0x1cd833['push'](_0x1cd833['shift']());}};_0x57001c(++_0x1766a6);}(_0x0575,0x95));var _0x5057=function(_0xc1f4c4,_0x479306){_0xc1f4c4=_0xc1f4c4-0x0;var _0xbb5e2=_0x0575[_0xc1f4c4];return _0xbb5e2;};'use strict';var multer=require(_0x5057('0x0'));var util=require('util');var path=require(_0x5057('0x1'));var timeout=require(_0x5057('0x2'));var express=require('express');var router=express[_0x5057('0x3')]();var fs_extra=require(_0x5057('0x4'));var auth=require(_0x5057('0x5'));var interaction=require(_0x5057('0x6'));var config=require(_0x5057('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x5057('0x8')]('/',auth[_0x5057('0x9')](),controller[_0x5057('0xa')]);router[_0x5057('0x8')]('/:id',auth[_0x5057('0x9')](),controller[_0x5057('0xb')]);router[_0x5057('0x8')](_0x5057('0xc'),auth[_0x5057('0x9')](),controller[_0x5057('0xd')]);router['get'](_0x5057('0xe'),auth['isAuthenticated'](),controller[_0x5057('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x5057('0x10')]);router['post']('/',auth[_0x5057('0x9')](),controller[_0x5057('0x11')]);router[_0x5057('0x12')](_0x5057('0x13'),auth[_0x5057('0x9')](),controller[_0x5057('0x14')]);router['delete'](_0x5057('0x13'),auth[_0x5057('0x9')](),controller['destroy']);module[_0x5057('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index cab570e..c9351ed 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 _0xae5a=['exports','STRING','sequelize'];(function(_0xad2182,_0x16d18f){var _0x2275d0=function(_0x54b76d){while(--_0x54b76d){_0xad2182['push'](_0xad2182['shift']());}};_0x2275d0(++_0x16d18f);}(_0xae5a,0xec));var _0xaae5=function(_0x8841a9,_0x11db72){_0x8841a9=_0x8841a9-0x0;var _0x207982=_0xae5a[_0x8841a9];return _0x207982;};'use strict';var Sequelize=require(_0xaae5('0x0'));module[_0xaae5('0x1')]={'name':{'type':Sequelize[_0xaae5('0x2')]},'description':{'type':Sequelize[_0xaae5('0x2')]}}; \ No newline at end of file +var _0x405f=['STRING','sequelize','exports'];(function(_0x334ec3,_0x1324fe){var _0x37f076=function(_0x3b44de){while(--_0x3b44de){_0x334ec3['push'](_0x334ec3['shift']());}};_0x37f076(++_0x1324fe);}(_0x405f,0x1e1));var _0xf405=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x405f[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0xf405('0x0'));module[_0xf405('0x1')]={'name':{'type':Sequelize[_0xf405('0x2')]},'description':{'type':Sequelize[_0xf405('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9c13398..7ebca17 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 _0x1060=['keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','findOne','FreshsalesField','order','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','name','send','index','map','FreshsalesConfiguration','fieldName','key','model'];(function(_0x1bc96d,_0x33d6f7){var _0x29744b=function(_0x2f31db){while(--_0x2f31db){_0x1bc96d['push'](_0x1bc96d['shift']());}};_0x29744b(++_0x33d6f7);}(_0x1060,0x14b));var _0x0106=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1060[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x0106('0x0'));var rimraf=require(_0x0106('0x1'));var zipdir=require(_0x0106('0x2'));var jsonpatch=require(_0x0106('0x3'));var rp=require(_0x0106('0x4'));var moment=require(_0x0106('0x5'));var BPromise=require(_0x0106('0x6'));var Mustache=require(_0x0106('0x7'));var util=require(_0x0106('0x8'));var path=require(_0x0106('0x9'));var sox=require(_0x0106('0xa'));var csv=require(_0x0106('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0106('0xc'));var _=require(_0x0106('0xd'));var squel=require(_0x0106('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0106('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0106('0x10'));var Redis=require(_0x0106('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0106('0x12'));var hardwareService=require(_0x0106('0x13'));var logger=require(_0x0106('0x14'))('api');var utils=require(_0x0106('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0106('0x16'))['db'];function respondWithStatusCode(_0x243b21,_0x919723){_0x919723=_0x919723||0xcc;return function(_0x604541){if(_0x604541){return _0x243b21[_0x0106('0x17')](_0x919723);}return _0x243b21[_0x0106('0x18')](_0x919723)[_0x0106('0x19')]();};}function respondWithResult(_0x1caa87,_0x11fd5f){_0x11fd5f=_0x11fd5f||0xc8;return function(_0x26045c){if(_0x26045c){return _0x1caa87['status'](_0x11fd5f)['json'](_0x26045c);}};}function respondWithFilteredResult(_0xb296c,_0x54a724){return function(_0x1ef7e4){if(_0x1ef7e4){var _0x55432f=typeof _0x54a724[_0x0106('0x1a')]===_0x0106('0x1b')&&typeof _0x54a724[_0x0106('0x1c')]===_0x0106('0x1b');var _0x470576=_0x1ef7e4[_0x0106('0x1d')];var _0xf4edc0=_0x55432f?0x0:_0x54a724[_0x0106('0x1a')];var _0x556499=_0x55432f?_0x1ef7e4[_0x0106('0x1d')]:_0x54a724[_0x0106('0x1a')]+_0x54a724[_0x0106('0x1c')];var _0xfabf06;if(_0x556499>=_0x470576){_0x556499=_0x470576;_0xfabf06=0xc8;}else{_0xfabf06=0xce;}_0xb296c[_0x0106('0x18')](_0xfabf06);return _0xb296c[_0x0106('0x1e')]('Content-Range',_0xf4edc0+'-'+_0x556499+'/'+_0x470576)[_0x0106('0x1f')](_0x1ef7e4);}return null;};}function patchUpdates(_0x4a40e0){return function(_0x14b86a){try{jsonpatch[_0x0106('0x20')](_0x14b86a,_0x4a40e0,!![]);}catch(_0x1fc771){return BPromise[_0x0106('0x21')](_0x1fc771);}return _0x14b86a['save']();};}function saveUpdates(_0x2c34bc,_0x303fba){return function(_0x11a71a){if(_0x11a71a){return _0x11a71a['update'](_0x2c34bc)[_0x0106('0x22')](function(_0x3cf796){return _0x3cf796;});}return null;};}function removeEntity(_0x1225b7,_0x4a57ee){return function(_0x3e290a){if(_0x3e290a){return _0x3e290a[_0x0106('0x23')]()[_0x0106('0x22')](function(){_0x1225b7[_0x0106('0x18')](0xcc)[_0x0106('0x19')]();});}};}function handleEntityNotFound(_0x3c8d9c,_0x1aa812){return function(_0xfe6e65){if(!_0xfe6e65){_0x3c8d9c[_0x0106('0x17')](0x194);}return _0xfe6e65;};}function handleError(_0x151a21,_0xc984cc){_0xc984cc=_0xc984cc||0x1f4;return function(_0x1519ee){logger['error'](_0x1519ee['stack']);if(_0x1519ee[_0x0106('0x24')]){delete _0x1519ee[_0x0106('0x24')];}_0x151a21[_0x0106('0x18')](_0xc984cc)[_0x0106('0x25')](_0x1519ee);};}exports[_0x0106('0x26')]=function(_0xb0b26a,_0x88aa61){var _0x3d09e8={},_0x404db9={},_0x33d7e5={'count':0x0,'rows':[]};var _0xf1e961=_[_0x0106('0x27')](db[_0x0106('0x28')]['rawAttributes'],function(_0x425eb9){return{'name':_0x425eb9[_0x0106('0x29')],'type':_0x425eb9['type'][_0x0106('0x2a')]};});_0x404db9[_0x0106('0x2b')]=_['map'](_0xf1e961,_0x0106('0x24'));_0x404db9['query']=_[_0x0106('0x2c')](_0xb0b26a[_0x0106('0x2d')]);_0x404db9[_0x0106('0x2e')]=_['intersection'](_0x404db9[_0x0106('0x2b')],_0x404db9[_0x0106('0x2d')]);_0x3d09e8[_0x0106('0x2f')]=_[_0x0106('0x30')](_0x404db9['model'],qs[_0x0106('0x31')](_0xb0b26a[_0x0106('0x2d')]['fields']));_0x3d09e8[_0x0106('0x2f')]=_0x3d09e8[_0x0106('0x2f')][_0x0106('0x32')]?_0x3d09e8['attributes']:_0x404db9[_0x0106('0x2b')];if(!_0xb0b26a[_0x0106('0x2d')][_0x0106('0x33')](_0x0106('0x34'))){_0x3d09e8[_0x0106('0x1c')]=qs['limit'](_0xb0b26a[_0x0106('0x2d')][_0x0106('0x1c')]);_0x3d09e8[_0x0106('0x1a')]=qs['offset'](_0xb0b26a[_0x0106('0x2d')][_0x0106('0x1a')]);}_0x3d09e8['order']=qs[_0x0106('0x35')](_0xb0b26a[_0x0106('0x2d')][_0x0106('0x35')]);_0x3d09e8[_0x0106('0x36')]=qs['filters'](_[_0x0106('0x37')](_0xb0b26a[_0x0106('0x2d')],_0x404db9[_0x0106('0x2e')]),_0xf1e961);if(_0xb0b26a[_0x0106('0x2d')][_0x0106('0x38')]){_0x3d09e8[_0x0106('0x36')]=_['merge'](_0x3d09e8['where'],{'$or':_['map'](_0xf1e961,function(_0x423e79){if(_0x423e79['type']!==_0x0106('0x39')){var _0x47bb30={};_0x47bb30[_0x423e79['name']]={'$like':'%'+_0xb0b26a[_0x0106('0x2d')]['filter']+'%'};return _0x47bb30;}})});}_0x3d09e8=_[_0x0106('0x3a')]({},_0x3d09e8,_0xb0b26a[_0x0106('0x3b')]);var _0x3e58f3={'where':_0x3d09e8[_0x0106('0x36')]};return db['FreshsalesConfiguration']['count'](_0x3e58f3)[_0x0106('0x22')](function(_0x11a37f){_0x33d7e5[_0x0106('0x1d')]=_0x11a37f;if(_0xb0b26a[_0x0106('0x2d')][_0x0106('0x3c')]){_0x3d09e8[_0x0106('0x3d')]=[{'all':!![]}];}return db[_0x0106('0x28')]['findAll'](_0x3d09e8);})[_0x0106('0x22')](function(_0x1631e7){_0x33d7e5[_0x0106('0x3e')]=_0x1631e7;return _0x33d7e5;})[_0x0106('0x22')](respondWithFilteredResult(_0x88aa61,_0x3d09e8))[_0x0106('0x3f')](handleError(_0x88aa61,null));};exports['show']=function(_0x175031,_0x166952){var _0xaa3d01={'raw':![],'where':{'id':_0x175031[_0x0106('0x40')]['id']}},_0x1bce22={};_0x1bce22['model']=_[_0x0106('0x2c')](db[_0x0106('0x28')][_0x0106('0x41')]);_0x1bce22[_0x0106('0x2d')]=_[_0x0106('0x2c')](_0x175031['query']);_0x1bce22['filters']=_[_0x0106('0x30')](_0x1bce22[_0x0106('0x2b')],_0x1bce22['query']);_0xaa3d01[_0x0106('0x2f')]=_[_0x0106('0x30')](_0x1bce22[_0x0106('0x2b')],qs[_0x0106('0x31')](_0x175031[_0x0106('0x2d')]['fields']));_0xaa3d01[_0x0106('0x2f')]=_0xaa3d01[_0x0106('0x2f')][_0x0106('0x32')]?_0xaa3d01[_0x0106('0x2f')]:_0x1bce22[_0x0106('0x2b')];if(_0x175031[_0x0106('0x2d')][_0x0106('0x3c')]){_0xaa3d01[_0x0106('0x3d')]=[{'all':!![]}];}_0xaa3d01=_['merge']({},_0xaa3d01,_0x175031['options']);return db['FreshsalesConfiguration'][_0x0106('0x42')](_0xaa3d01)[_0x0106('0x22')](handleEntityNotFound(_0x166952,null))['then'](respondWithResult(_0x166952,null))[_0x0106('0x3f')](handleError(_0x166952,null));};exports['create']=function(_0x55a952,_0x5ea042){return db[_0x0106('0x28')][_0x0106('0x43')](_0x55a952['body'],{})['then'](respondWithResult(_0x5ea042,0xc9))['catch'](handleError(_0x5ea042,null));};exports['update']=function(_0x2e04e0,_0x40b7f7){if(_0x2e04e0['body']['id']){delete _0x2e04e0[_0x0106('0x44')]['id'];}return db[_0x0106('0x28')]['find']({'where':{'id':_0x2e04e0['params']['id']}})['then'](handleEntityNotFound(_0x40b7f7,null))[_0x0106('0x22')](saveUpdates(_0x2e04e0[_0x0106('0x44')],null))['then'](respondWithResult(_0x40b7f7,null))[_0x0106('0x3f')](handleError(_0x40b7f7,null));};exports[_0x0106('0x23')]=function(_0xf83e1a,_0x593d80){return db[_0x0106('0x28')][_0x0106('0x42')]({'where':{'id':_0xf83e1a[_0x0106('0x40')]['id']}})[_0x0106('0x22')](handleEntityNotFound(_0x593d80,null))[_0x0106('0x22')](removeEntity(_0x593d80,null))[_0x0106('0x3f')](handleError(_0x593d80,null));};exports['getSubjects']=function(_0x5667bb,_0x12c1b0,_0x1999a9){var _0x1b453b={};var _0x851f48={};var _0x46bd42;var _0x2f586d;return db['FreshsalesConfiguration'][_0x0106('0x45')]({'where':{'id':_0x5667bb[_0x0106('0x40')]['id']}})[_0x0106('0x22')](handleEntityNotFound(_0x12c1b0,null))[_0x0106('0x22')](function(_0x446590){if(_0x446590){_0x46bd42=_0x446590;_0x851f48['model']=_[_0x0106('0x2c')](db[_0x0106('0x46')][_0x0106('0x41')]);_0x851f48[_0x0106('0x2d')]=_[_0x0106('0x2c')](_0x5667bb['query']);_0x851f48[_0x0106('0x2e')]=_['intersection'](_0x851f48[_0x0106('0x2b')],_0x851f48[_0x0106('0x2d')]);_0x1b453b['attributes']=_[_0x0106('0x30')](_0x851f48[_0x0106('0x2b')],qs['fields'](_0x5667bb[_0x0106('0x2d')][_0x0106('0x31')]));_0x1b453b['attributes']=_0x1b453b[_0x0106('0x2f')][_0x0106('0x32')]?_0x1b453b['attributes']:_0x851f48[_0x0106('0x2b')];_0x1b453b[_0x0106('0x47')]=qs[_0x0106('0x35')](_0x5667bb['query'][_0x0106('0x35')]);_0x1b453b[_0x0106('0x36')]=qs['filters'](_[_0x0106('0x37')](_0x5667bb[_0x0106('0x2d')],_0x851f48[_0x0106('0x2e')]));if(_0x5667bb[_0x0106('0x2d')]['filter']){_0x1b453b[_0x0106('0x36')]=_['merge'](_0x1b453b[_0x0106('0x36')],{'$or':_[_0x0106('0x27')](_0x1b453b[_0x0106('0x2f')],function(_0x66ccc3){var _0x31beae={};_0x31beae[_0x66ccc3]={'$like':'%'+_0x5667bb[_0x0106('0x2d')][_0x0106('0x38')]+'%'};return _0x31beae;})});}_0x1b453b=_['merge']({},_0x1b453b,_0x5667bb[_0x0106('0x3b')]);return _0x46bd42[_0x0106('0x48')](_0x1b453b);}})['then'](function(_0x186679){if(_0x186679){_0x2f586d=_0x186679[_0x0106('0x32')];if(!_0x5667bb[_0x0106('0x2d')][_0x0106('0x33')](_0x0106('0x34'))){_0x1b453b[_0x0106('0x1c')]=qs['limit'](_0x5667bb[_0x0106('0x2d')]['limit']);_0x1b453b['offset']=qs[_0x0106('0x1a')](_0x5667bb[_0x0106('0x2d')][_0x0106('0x1a')]);}return _0x46bd42[_0x0106('0x48')](_0x1b453b);}})[_0x0106('0x22')](function(_0x127e2c){if(_0x127e2c){return _0x127e2c?{'count':_0x2f586d,'rows':_0x127e2c}:null;}})[_0x0106('0x22')](respondWithResult(_0x12c1b0,null))[_0x0106('0x3f')](handleError(_0x12c1b0,null));};exports[_0x0106('0x49')]=function(_0x16dd62,_0xdcfd96,_0x54f567){var _0x10b092={};var _0x44e5bc={};var _0x384f73;var _0x20cc99;return db[_0x0106('0x28')][_0x0106('0x45')]({'where':{'id':_0x16dd62['params']['id']}})[_0x0106('0x22')](handleEntityNotFound(_0xdcfd96,null))[_0x0106('0x22')](function(_0x11005a){if(_0x11005a){_0x384f73=_0x11005a;_0x44e5bc[_0x0106('0x2b')]=_[_0x0106('0x2c')](db[_0x0106('0x46')][_0x0106('0x41')]);_0x44e5bc[_0x0106('0x2d')]=_['keys'](_0x16dd62[_0x0106('0x2d')]);_0x44e5bc['filters']=_['intersection'](_0x44e5bc['model'],_0x44e5bc[_0x0106('0x2d')]);_0x10b092[_0x0106('0x2f')]=_['intersection'](_0x44e5bc[_0x0106('0x2b')],qs[_0x0106('0x31')](_0x16dd62['query']['fields']));_0x10b092[_0x0106('0x2f')]=_0x10b092[_0x0106('0x2f')][_0x0106('0x32')]?_0x10b092[_0x0106('0x2f')]:_0x44e5bc['model'];_0x10b092[_0x0106('0x47')]=qs[_0x0106('0x35')](_0x16dd62[_0x0106('0x2d')]['sort']);_0x10b092[_0x0106('0x36')]=qs['filters'](_['pick'](_0x16dd62[_0x0106('0x2d')],_0x44e5bc[_0x0106('0x2e')]));if(_0x16dd62[_0x0106('0x2d')]['filter']){_0x10b092[_0x0106('0x36')]=_['merge'](_0x10b092[_0x0106('0x36')],{'$or':_['map'](_0x10b092[_0x0106('0x2f')],function(_0x196b7e){var _0x2a16ea={};_0x2a16ea[_0x196b7e]={'$like':'%'+_0x16dd62[_0x0106('0x2d')][_0x0106('0x38')]+'%'};return _0x2a16ea;})});}_0x10b092=_[_0x0106('0x3a')]({},_0x10b092,_0x16dd62[_0x0106('0x3b')]);return _0x384f73[_0x0106('0x49')](_0x10b092);}})[_0x0106('0x22')](function(_0x547cfd){if(_0x547cfd){_0x20cc99=_0x547cfd[_0x0106('0x32')];if(!_0x16dd62[_0x0106('0x2d')][_0x0106('0x33')](_0x0106('0x34'))){_0x10b092[_0x0106('0x1c')]=qs[_0x0106('0x1c')](_0x16dd62[_0x0106('0x2d')][_0x0106('0x1c')]);_0x10b092['offset']=qs[_0x0106('0x1a')](_0x16dd62[_0x0106('0x2d')][_0x0106('0x1a')]);}return _0x384f73[_0x0106('0x49')](_0x10b092);}})[_0x0106('0x22')](function(_0x227b19){if(_0x227b19){return _0x227b19?{'count':_0x20cc99,'rows':_0x227b19}:null;}})[_0x0106('0x22')](respondWithResult(_0xdcfd96,null))[_0x0106('0x3f')](handleError(_0xdcfd96,null));};exports[_0x0106('0x4a')]=function(_0x481054,_0x294a15,_0x2b3680){var _0x5062e1={};var _0x1e7827={};var _0x80f63d;var _0x222f49;return db['FreshsalesConfiguration'][_0x0106('0x45')]({'where':{'id':_0x481054[_0x0106('0x40')]['id']}})[_0x0106('0x22')](handleEntityNotFound(_0x294a15,null))[_0x0106('0x22')](function(_0x41333c){if(_0x41333c){_0x80f63d=_0x41333c;_0x1e7827[_0x0106('0x2b')]=_[_0x0106('0x2c')](db[_0x0106('0x46')]['rawAttributes']);_0x1e7827['query']=_[_0x0106('0x2c')](_0x481054[_0x0106('0x2d')]);_0x1e7827[_0x0106('0x2e')]=_[_0x0106('0x30')](_0x1e7827[_0x0106('0x2b')],_0x1e7827[_0x0106('0x2d')]);_0x5062e1[_0x0106('0x2f')]=_[_0x0106('0x30')](_0x1e7827[_0x0106('0x2b')],qs[_0x0106('0x31')](_0x481054[_0x0106('0x2d')]['fields']));_0x5062e1['attributes']=_0x5062e1[_0x0106('0x2f')][_0x0106('0x32')]?_0x5062e1['attributes']:_0x1e7827['model'];_0x5062e1[_0x0106('0x47')]=qs[_0x0106('0x35')](_0x481054[_0x0106('0x2d')][_0x0106('0x35')]);_0x5062e1[_0x0106('0x36')]=qs[_0x0106('0x2e')](_[_0x0106('0x37')](_0x481054[_0x0106('0x2d')],_0x1e7827[_0x0106('0x2e')]));if(_0x481054['query'][_0x0106('0x38')]){_0x5062e1[_0x0106('0x36')]=_['merge'](_0x5062e1['where'],{'$or':_[_0x0106('0x27')](_0x5062e1['attributes'],function(_0x14f455){var _0x1d9f57={};_0x1d9f57[_0x14f455]={'$like':'%'+_0x481054[_0x0106('0x2d')][_0x0106('0x38')]+'%'};return _0x1d9f57;})});}_0x5062e1=_['merge']({},_0x5062e1,_0x481054[_0x0106('0x3b')]);return _0x80f63d[_0x0106('0x4a')](_0x5062e1);}})[_0x0106('0x22')](function(_0x4a3bf4){if(_0x4a3bf4){_0x222f49=_0x4a3bf4['length'];if(!_0x481054[_0x0106('0x2d')][_0x0106('0x33')](_0x0106('0x34'))){_0x5062e1[_0x0106('0x1c')]=qs['limit'](_0x481054[_0x0106('0x2d')][_0x0106('0x1c')]);_0x5062e1['offset']=qs[_0x0106('0x1a')](_0x481054[_0x0106('0x2d')][_0x0106('0x1a')]);}return _0x80f63d[_0x0106('0x4a')](_0x5062e1);}})[_0x0106('0x22')](function(_0x306dfc){if(_0x306dfc){return _0x306dfc?{'count':_0x222f49,'rows':_0x306dfc}:null;}})[_0x0106('0x22')](respondWithResult(_0x294a15,null))['catch'](handleError(_0x294a15,null));}; \ No newline at end of file +var _0x104d=['pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','getSubjects','findOne','length','hasOwnProperty','getDescriptions','getFields','FreshsalesField','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where'];(function(_0x3f188f,_0x4808f0){var _0x347edc=function(_0x5a6d59){while(--_0x5a6d59){_0x3f188f['push'](_0x3f188f['shift']());}};_0x347edc(++_0x4808f0);}(_0x104d,0x1ee));var _0xd104=function(_0x3e978c,_0x1d5774){_0x3e978c=_0x3e978c-0x0;var _0x295585=_0x104d[_0x3e978c];return _0x295585;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd104('0x0'));var rp=require('request-promise');var moment=require(_0xd104('0x1'));var BPromise=require(_0xd104('0x2'));var Mustache=require(_0xd104('0x3'));var util=require(_0xd104('0x4'));var path=require(_0xd104('0x5'));var sox=require(_0xd104('0x6'));var csv=require(_0xd104('0x7'));var ejs=require(_0xd104('0x8'));var fs=require('fs');var fs_extra=require(_0xd104('0x9'));var _=require(_0xd104('0xa'));var squel=require(_0xd104('0xb'));var crypto=require(_0xd104('0xc'));var jsforce=require(_0xd104('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd104('0x7'));var querystring=require(_0xd104('0xe'));var Papa=require('papaparse');var Redis=require(_0xd104('0xf'));var authService=require(_0xd104('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd104('0x11'));var hardwareService=require(_0xd104('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd104('0x13'));var config=require(_0xd104('0x14'));var licenseUtil=require(_0xd104('0x15'));var db=require(_0xd104('0x16'))['db'];function respondWithStatusCode(_0x20b9d3,_0x447722){_0x447722=_0x447722||0xcc;return function(_0xe7b4c2){if(_0xe7b4c2){return _0x20b9d3[_0xd104('0x17')](_0x447722);}return _0x20b9d3[_0xd104('0x18')](_0x447722)[_0xd104('0x19')]();};}function respondWithResult(_0x4481e3,_0x15852e){_0x15852e=_0x15852e||0xc8;return function(_0x299991){if(_0x299991){return _0x4481e3[_0xd104('0x18')](_0x15852e)[_0xd104('0x1a')](_0x299991);}};}function respondWithFilteredResult(_0x31cb63,_0x7528d7){return function(_0x4392cc){if(_0x4392cc){var _0x4164b3=typeof _0x7528d7['offset']===_0xd104('0x1b')&&typeof _0x7528d7[_0xd104('0x1c')]==='undefined';var _0x5587d9=_0x4392cc['count'];var _0x390415=_0x4164b3?0x0:_0x7528d7[_0xd104('0x1d')];var _0x38d332=_0x4164b3?_0x4392cc[_0xd104('0x1e')]:_0x7528d7['offset']+_0x7528d7[_0xd104('0x1c')];var _0x30328d;if(_0x38d332>=_0x5587d9){_0x38d332=_0x5587d9;_0x30328d=0xc8;}else{_0x30328d=0xce;}_0x31cb63[_0xd104('0x18')](_0x30328d);return _0x31cb63[_0xd104('0x1f')](_0xd104('0x20'),_0x390415+'-'+_0x38d332+'/'+_0x5587d9)[_0xd104('0x1a')](_0x4392cc);}return null;};}function patchUpdates(_0x1d0a9c){return function(_0x2920d2){try{jsonpatch[_0xd104('0x21')](_0x2920d2,_0x1d0a9c,!![]);}catch(_0x114dd0){return BPromise['reject'](_0x114dd0);}return _0x2920d2[_0xd104('0x22')]();};}function saveUpdates(_0x4aa5eb,_0x27ae78){return function(_0x2e169d){if(_0x2e169d){return _0x2e169d[_0xd104('0x23')](_0x4aa5eb)[_0xd104('0x24')](function(_0x1d822b){return _0x1d822b;});}return null;};}function removeEntity(_0x45a49f,_0x331470){return function(_0x16200d){if(_0x16200d){return _0x16200d[_0xd104('0x25')]()[_0xd104('0x24')](function(){_0x45a49f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d4ad,_0x552458){return function(_0x11b52d){if(!_0x11b52d){_0x28d4ad[_0xd104('0x17')](0x194);}return _0x11b52d;};}function handleError(_0x981dee,_0x4b4ce0){_0x4b4ce0=_0x4b4ce0||0x1f4;return function(_0x10e062){logger[_0xd104('0x26')](_0x10e062[_0xd104('0x27')]);if(_0x10e062[_0xd104('0x28')]){delete _0x10e062['name'];}_0x981dee[_0xd104('0x18')](_0x4b4ce0)['send'](_0x10e062);};}exports[_0xd104('0x29')]=function(_0x54d61b,_0x4cf4a3){var _0x20f577={},_0xef6df4={},_0x4b761b={'count':0x0,'rows':[]};var _0x5c4de8=_['map'](db[_0xd104('0x2a')][_0xd104('0x2b')],function(_0x2a0c16){return{'name':_0x2a0c16[_0xd104('0x2c')],'type':_0x2a0c16[_0xd104('0x2d')][_0xd104('0x2e')]};});_0xef6df4[_0xd104('0x2f')]=_[_0xd104('0x30')](_0x5c4de8,'name');_0xef6df4[_0xd104('0x31')]=_[_0xd104('0x32')](_0x54d61b['query']);_0xef6df4[_0xd104('0x33')]=_['intersection'](_0xef6df4[_0xd104('0x2f')],_0xef6df4[_0xd104('0x31')]);_0x20f577[_0xd104('0x34')]=_[_0xd104('0x35')](_0xef6df4[_0xd104('0x2f')],qs[_0xd104('0x36')](_0x54d61b[_0xd104('0x31')][_0xd104('0x36')]));_0x20f577[_0xd104('0x34')]=_0x20f577[_0xd104('0x34')]['length']?_0x20f577[_0xd104('0x34')]:_0xef6df4[_0xd104('0x2f')];if(!_0x54d61b[_0xd104('0x31')]['hasOwnProperty'](_0xd104('0x37'))){_0x20f577['limit']=qs[_0xd104('0x1c')](_0x54d61b[_0xd104('0x31')][_0xd104('0x1c')]);_0x20f577[_0xd104('0x1d')]=qs[_0xd104('0x1d')](_0x54d61b[_0xd104('0x31')][_0xd104('0x1d')]);}_0x20f577[_0xd104('0x38')]=qs[_0xd104('0x39')](_0x54d61b[_0xd104('0x31')][_0xd104('0x39')]);_0x20f577[_0xd104('0x3a')]=qs['filters'](_[_0xd104('0x3b')](_0x54d61b[_0xd104('0x31')],_0xef6df4[_0xd104('0x33')]),_0x5c4de8);if(_0x54d61b[_0xd104('0x31')]['filter']){_0x20f577['where']=_[_0xd104('0x3c')](_0x20f577['where'],{'$or':_[_0xd104('0x30')](_0x5c4de8,function(_0x51d209){if(_0x51d209[_0xd104('0x2d')]!=='VIRTUAL'){var _0x5332fa={};_0x5332fa[_0x51d209[_0xd104('0x28')]]={'$like':'%'+_0x54d61b['query'][_0xd104('0x3d')]+'%'};return _0x5332fa;}})});}_0x20f577=_[_0xd104('0x3c')]({},_0x20f577,_0x54d61b[_0xd104('0x3e')]);var _0x230251={'where':_0x20f577[_0xd104('0x3a')]};return db['FreshsalesConfiguration']['count'](_0x230251)[_0xd104('0x24')](function(_0x5e71ec){_0x4b761b[_0xd104('0x1e')]=_0x5e71ec;if(_0x54d61b[_0xd104('0x31')][_0xd104('0x3f')]){_0x20f577[_0xd104('0x40')]=[{'all':!![]}];}return db[_0xd104('0x2a')][_0xd104('0x41')](_0x20f577);})[_0xd104('0x24')](function(_0x225461){_0x4b761b['rows']=_0x225461;return _0x4b761b;})['then'](respondWithFilteredResult(_0x4cf4a3,_0x20f577))[_0xd104('0x42')](handleError(_0x4cf4a3,null));};exports[_0xd104('0x43')]=function(_0x1da9e4,_0x2e502f){var _0x152146={'raw':![],'where':{'id':_0x1da9e4[_0xd104('0x44')]['id']}},_0x1b3091={};_0x1b3091[_0xd104('0x2f')]=_[_0xd104('0x32')](db['FreshsalesConfiguration'][_0xd104('0x2b')]);_0x1b3091['query']=_[_0xd104('0x32')](_0x1da9e4[_0xd104('0x31')]);_0x1b3091['filters']=_[_0xd104('0x35')](_0x1b3091['model'],_0x1b3091[_0xd104('0x31')]);_0x152146[_0xd104('0x34')]=_[_0xd104('0x35')](_0x1b3091[_0xd104('0x2f')],qs[_0xd104('0x36')](_0x1da9e4['query'][_0xd104('0x36')]));_0x152146[_0xd104('0x34')]=_0x152146[_0xd104('0x34')]['length']?_0x152146['attributes']:_0x1b3091[_0xd104('0x2f')];if(_0x1da9e4[_0xd104('0x31')]['includeAll']){_0x152146[_0xd104('0x40')]=[{'all':!![]}];}_0x152146=_[_0xd104('0x3c')]({},_0x152146,_0x1da9e4[_0xd104('0x3e')]);return db['FreshsalesConfiguration'][_0xd104('0x45')](_0x152146)[_0xd104('0x24')](handleEntityNotFound(_0x2e502f,null))['then'](respondWithResult(_0x2e502f,null))['catch'](handleError(_0x2e502f,null));};exports[_0xd104('0x46')]=function(_0xca065c,_0x47e673){return db[_0xd104('0x2a')]['create'](_0xca065c[_0xd104('0x47')],{})['then'](respondWithResult(_0x47e673,0xc9))['catch'](handleError(_0x47e673,null));};exports[_0xd104('0x23')]=function(_0x212573,_0x47edb4){if(_0x212573[_0xd104('0x47')]['id']){delete _0x212573[_0xd104('0x47')]['id'];}return db[_0xd104('0x2a')][_0xd104('0x45')]({'where':{'id':_0x212573[_0xd104('0x44')]['id']}})[_0xd104('0x24')](handleEntityNotFound(_0x47edb4,null))['then'](saveUpdates(_0x212573[_0xd104('0x47')],null))[_0xd104('0x24')](respondWithResult(_0x47edb4,null))[_0xd104('0x42')](handleError(_0x47edb4,null));};exports[_0xd104('0x25')]=function(_0x2d499a,_0x564c5b){return db[_0xd104('0x2a')][_0xd104('0x45')]({'where':{'id':_0x2d499a['params']['id']}})[_0xd104('0x24')](handleEntityNotFound(_0x564c5b,null))[_0xd104('0x24')](removeEntity(_0x564c5b,null))[_0xd104('0x42')](handleError(_0x564c5b,null));};exports[_0xd104('0x48')]=function(_0x24f4d3,_0x216cb2,_0x4a3987){var _0x1aa6eb={};var _0x6bcead={};var _0x51cd1a;var _0x4c66c4;return db[_0xd104('0x2a')][_0xd104('0x49')]({'where':{'id':_0x24f4d3[_0xd104('0x44')]['id']}})[_0xd104('0x24')](handleEntityNotFound(_0x216cb2,null))[_0xd104('0x24')](function(_0xdb5ed){if(_0xdb5ed){_0x51cd1a=_0xdb5ed;_0x6bcead[_0xd104('0x2f')]=_[_0xd104('0x32')](db['FreshsalesField'][_0xd104('0x2b')]);_0x6bcead[_0xd104('0x31')]=_['keys'](_0x24f4d3[_0xd104('0x31')]);_0x6bcead['filters']=_[_0xd104('0x35')](_0x6bcead[_0xd104('0x2f')],_0x6bcead[_0xd104('0x31')]);_0x1aa6eb['attributes']=_['intersection'](_0x6bcead['model'],qs['fields'](_0x24f4d3['query'][_0xd104('0x36')]));_0x1aa6eb['attributes']=_0x1aa6eb[_0xd104('0x34')][_0xd104('0x4a')]?_0x1aa6eb[_0xd104('0x34')]:_0x6bcead[_0xd104('0x2f')];_0x1aa6eb[_0xd104('0x38')]=qs['sort'](_0x24f4d3[_0xd104('0x31')][_0xd104('0x39')]);_0x1aa6eb[_0xd104('0x3a')]=qs[_0xd104('0x33')](_[_0xd104('0x3b')](_0x24f4d3[_0xd104('0x31')],_0x6bcead[_0xd104('0x33')]));if(_0x24f4d3[_0xd104('0x31')][_0xd104('0x3d')]){_0x1aa6eb[_0xd104('0x3a')]=_['merge'](_0x1aa6eb[_0xd104('0x3a')],{'$or':_[_0xd104('0x30')](_0x1aa6eb[_0xd104('0x34')],function(_0x72f8a5){var _0x392c6f={};_0x392c6f[_0x72f8a5]={'$like':'%'+_0x24f4d3[_0xd104('0x31')][_0xd104('0x3d')]+'%'};return _0x392c6f;})});}_0x1aa6eb=_[_0xd104('0x3c')]({},_0x1aa6eb,_0x24f4d3[_0xd104('0x3e')]);return _0x51cd1a[_0xd104('0x48')](_0x1aa6eb);}})[_0xd104('0x24')](function(_0x1fcc83){if(_0x1fcc83){_0x4c66c4=_0x1fcc83[_0xd104('0x4a')];if(!_0x24f4d3[_0xd104('0x31')][_0xd104('0x4b')]('nolimit')){_0x1aa6eb[_0xd104('0x1c')]=qs[_0xd104('0x1c')](_0x24f4d3[_0xd104('0x31')]['limit']);_0x1aa6eb[_0xd104('0x1d')]=qs[_0xd104('0x1d')](_0x24f4d3[_0xd104('0x31')][_0xd104('0x1d')]);}return _0x51cd1a[_0xd104('0x48')](_0x1aa6eb);}})[_0xd104('0x24')](function(_0x205dac){if(_0x205dac){return _0x205dac?{'count':_0x4c66c4,'rows':_0x205dac}:null;}})[_0xd104('0x24')](respondWithResult(_0x216cb2,null))[_0xd104('0x42')](handleError(_0x216cb2,null));};exports['getDescriptions']=function(_0x1ce51c,_0x2c9f76,_0x4ab869){var _0xb69482={};var _0xb6bad2={};var _0x51fa8c;var _0x2a3fe5;return db['FreshsalesConfiguration'][_0xd104('0x49')]({'where':{'id':_0x1ce51c[_0xd104('0x44')]['id']}})[_0xd104('0x24')](handleEntityNotFound(_0x2c9f76,null))[_0xd104('0x24')](function(_0x63a4e4){if(_0x63a4e4){_0x51fa8c=_0x63a4e4;_0xb6bad2[_0xd104('0x2f')]=_[_0xd104('0x32')](db['FreshsalesField']['rawAttributes']);_0xb6bad2[_0xd104('0x31')]=_[_0xd104('0x32')](_0x1ce51c[_0xd104('0x31')]);_0xb6bad2['filters']=_[_0xd104('0x35')](_0xb6bad2[_0xd104('0x2f')],_0xb6bad2[_0xd104('0x31')]);_0xb69482[_0xd104('0x34')]=_[_0xd104('0x35')](_0xb6bad2[_0xd104('0x2f')],qs[_0xd104('0x36')](_0x1ce51c['query']['fields']));_0xb69482['attributes']=_0xb69482['attributes'][_0xd104('0x4a')]?_0xb69482['attributes']:_0xb6bad2[_0xd104('0x2f')];_0xb69482['order']=qs[_0xd104('0x39')](_0x1ce51c[_0xd104('0x31')][_0xd104('0x39')]);_0xb69482[_0xd104('0x3a')]=qs[_0xd104('0x33')](_[_0xd104('0x3b')](_0x1ce51c[_0xd104('0x31')],_0xb6bad2[_0xd104('0x33')]));if(_0x1ce51c['query'][_0xd104('0x3d')]){_0xb69482[_0xd104('0x3a')]=_['merge'](_0xb69482[_0xd104('0x3a')],{'$or':_[_0xd104('0x30')](_0xb69482['attributes'],function(_0x4b3e0d){var _0x3a160c={};_0x3a160c[_0x4b3e0d]={'$like':'%'+_0x1ce51c['query'][_0xd104('0x3d')]+'%'};return _0x3a160c;})});}_0xb69482=_['merge']({},_0xb69482,_0x1ce51c['options']);return _0x51fa8c[_0xd104('0x4c')](_0xb69482);}})[_0xd104('0x24')](function(_0x3551ef){if(_0x3551ef){_0x2a3fe5=_0x3551ef[_0xd104('0x4a')];if(!_0x1ce51c[_0xd104('0x31')][_0xd104('0x4b')](_0xd104('0x37'))){_0xb69482['limit']=qs['limit'](_0x1ce51c[_0xd104('0x31')][_0xd104('0x1c')]);_0xb69482[_0xd104('0x1d')]=qs[_0xd104('0x1d')](_0x1ce51c[_0xd104('0x31')][_0xd104('0x1d')]);}return _0x51fa8c[_0xd104('0x4c')](_0xb69482);}})['then'](function(_0x1dc36b){if(_0x1dc36b){return _0x1dc36b?{'count':_0x2a3fe5,'rows':_0x1dc36b}:null;}})[_0xd104('0x24')](respondWithResult(_0x2c9f76,null))['catch'](handleError(_0x2c9f76,null));};exports[_0xd104('0x4d')]=function(_0x2af637,_0x4811e7,_0x20b851){var _0x334e6a={};var _0x12c7ce={};var _0x5b7ebb;var _0x54a73b;return db[_0xd104('0x2a')][_0xd104('0x49')]({'where':{'id':_0x2af637[_0xd104('0x44')]['id']}})['then'](handleEntityNotFound(_0x4811e7,null))[_0xd104('0x24')](function(_0x3da8fa){if(_0x3da8fa){_0x5b7ebb=_0x3da8fa;_0x12c7ce[_0xd104('0x2f')]=_['keys'](db[_0xd104('0x4e')][_0xd104('0x2b')]);_0x12c7ce[_0xd104('0x31')]=_[_0xd104('0x32')](_0x2af637[_0xd104('0x31')]);_0x12c7ce[_0xd104('0x33')]=_[_0xd104('0x35')](_0x12c7ce[_0xd104('0x2f')],_0x12c7ce[_0xd104('0x31')]);_0x334e6a[_0xd104('0x34')]=_[_0xd104('0x35')](_0x12c7ce['model'],qs['fields'](_0x2af637[_0xd104('0x31')][_0xd104('0x36')]));_0x334e6a['attributes']=_0x334e6a[_0xd104('0x34')]['length']?_0x334e6a[_0xd104('0x34')]:_0x12c7ce[_0xd104('0x2f')];_0x334e6a[_0xd104('0x38')]=qs[_0xd104('0x39')](_0x2af637[_0xd104('0x31')][_0xd104('0x39')]);_0x334e6a[_0xd104('0x3a')]=qs[_0xd104('0x33')](_[_0xd104('0x3b')](_0x2af637[_0xd104('0x31')],_0x12c7ce[_0xd104('0x33')]));if(_0x2af637[_0xd104('0x31')][_0xd104('0x3d')]){_0x334e6a['where']=_['merge'](_0x334e6a['where'],{'$or':_['map'](_0x334e6a[_0xd104('0x34')],function(_0x17fec0){var _0x568a0f={};_0x568a0f[_0x17fec0]={'$like':'%'+_0x2af637[_0xd104('0x31')][_0xd104('0x3d')]+'%'};return _0x568a0f;})});}_0x334e6a=_[_0xd104('0x3c')]({},_0x334e6a,_0x2af637[_0xd104('0x3e')]);return _0x5b7ebb[_0xd104('0x4d')](_0x334e6a);}})[_0xd104('0x24')](function(_0x5e3f4e){if(_0x5e3f4e){_0x54a73b=_0x5e3f4e[_0xd104('0x4a')];if(!_0x2af637[_0xd104('0x31')]['hasOwnProperty']('nolimit')){_0x334e6a[_0xd104('0x1c')]=qs[_0xd104('0x1c')](_0x2af637[_0xd104('0x31')]['limit']);_0x334e6a[_0xd104('0x1d')]=qs[_0xd104('0x1d')](_0x2af637[_0xd104('0x31')][_0xd104('0x1d')]);}return _0x5b7ebb[_0xd104('0x4d')](_0x334e6a);}})[_0xd104('0x24')](function(_0x363410){if(_0x363410){return _0x363410?{'count':_0x54a73b,'rows':_0x363410}:null;}})[_0xd104('0x24')](respondWithResult(_0x4811e7,null))[_0xd104('0x42')](handleError(_0x4811e7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 141207c..71fc8af 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 _0xd77d=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','util','../../config/logger','api','moment','request-promise'];(function(_0x29ee43,_0x37f00e){var _0x4d8059=function(_0x56b52b){while(--_0x56b52b){_0x29ee43['push'](_0x29ee43['shift']());}};_0x4d8059(++_0x37f00e);}(_0xd77d,0xd7));var _0xdd77=function(_0x2df9bc,_0x4e3d97){_0x2df9bc=_0x2df9bc-0x0;var _0x4fd55c=_0xd77d[_0x2df9bc];return _0x4fd55c;};'use strict';var _=require('lodash');var util=require(_0xdd77('0x0'));var logger=require(_0xdd77('0x1'))(_0xdd77('0x2'));var moment=require(_0xdd77('0x3'));var BPromise=require('bluebird');var rp=require(_0xdd77('0x4'));var fs=require('fs');var path=require(_0xdd77('0x5'));var rimraf=require(_0xdd77('0x6'));var config=require(_0xdd77('0x7'));var attributes=require(_0xdd77('0x8'));module['exports']=function(_0x8c25c5,_0x52bfd3){return _0x8c25c5[_0xdd77('0x9')](_0xdd77('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e28=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7e28,0x100));var _0x87e2=function(_0x5d52f6,_0x516244){_0x5d52f6=_0x5d52f6-0x0;var _0x299aa6=_0x7e28[_0x5d52f6];return _0x299aa6;};'use strict';var _=require(_0x87e2('0x0'));var util=require(_0x87e2('0x1'));var logger=require(_0x87e2('0x2'))(_0x87e2('0x3'));var moment=require(_0x87e2('0x4'));var BPromise=require(_0x87e2('0x5'));var rp=require(_0x87e2('0x6'));var fs=require('fs');var path=require(_0x87e2('0x7'));var rimraf=require(_0x87e2('0x8'));var config=require(_0x87e2('0x9'));var attributes=require(_0x87e2('0xa'));module[_0x87e2('0xb')]=function(_0x1d7c7c,_0x3ae366){return _0x1d7c7c[_0x87e2('0xc')](_0x87e2('0xd'),attributes,{'tableName':_0x87e2('0xe'),'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 a1c54de..5674b67 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 _0xcb5a=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','stringify','error'];(function(_0x2e7f42,_0x14c27d){var _0x126f6b=function(_0x5964e9){while(--_0x5964e9){_0x2e7f42['push'](_0x2e7f42['shift']());}};_0x126f6b(++_0x14c27d);}(_0xcb5a,0x1e8));var _0xacb5=function(_0x4cebba,_0x53404b){_0x4cebba=_0x4cebba-0x0;var _0x5f2ff4=_0xcb5a[_0x4cebba];return _0x5f2ff4;};'use strict';var _=require(_0xacb5('0x0'));var util=require(_0xacb5('0x1'));var moment=require(_0xacb5('0x2'));var BPromise=require(_0xacb5('0x3'));var rs=require(_0xacb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacb5('0x5'));var logger=require(_0xacb5('0x6'))('rpc');var config=require(_0xacb5('0x7'));var jayson=require(_0xacb5('0x8'));var client=jayson[_0xacb5('0x9')][_0xacb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedc698,_0x48fc39,_0x79d9bc){return new BPromise(function(_0x5d11d3,_0x5a95e3){return client[_0xacb5('0xb')](_0xedc698,_0x79d9bc)[_0xacb5('0xc')](function(_0x4ac3c6){logger[_0xacb5('0xd')](_0xacb5('0xe'),_0x48fc39,'request\x20sent');logger[_0xacb5('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x48fc39,'request\x20sent',JSON[_0xacb5('0x10')](_0x4ac3c6));if(_0x4ac3c6[_0xacb5('0x11')]){if(_0x4ac3c6['error'][_0xacb5('0x12')]===0x1f4){logger[_0xacb5('0x11')](_0xacb5('0xe'),_0x48fc39,_0x4ac3c6[_0xacb5('0x11')][_0xacb5('0x13')]);return _0x5a95e3(_0x4ac3c6['error'][_0xacb5('0x13')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x48fc39,_0x4ac3c6[_0xacb5('0x11')][_0xacb5('0x13')]);return _0x5d11d3(_0x4ac3c6[_0xacb5('0x11')][_0xacb5('0x13')]);}else{logger[_0xacb5('0xd')](_0xacb5('0xe'),_0x48fc39,_0xacb5('0x14'));_0x5d11d3(_0x4ac3c6[_0xacb5('0x15')][_0xacb5('0x13')]);}})[_0xacb5('0x16')](function(_0x5731d1){logger[_0xacb5('0x11')](_0xacb5('0xe'),_0x48fc39,_0x5731d1);_0x5a95e3(_0x5731d1);});});} \ No newline at end of file +var _0x2486=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0x168cd3,_0x12013e){var _0x22e557=function(_0x4fd183){while(--_0x4fd183){_0x168cd3['push'](_0x168cd3['shift']());}};_0x22e557(++_0x12013e);}(_0x2486,0x144));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6248('0x0'));var rs=require(_0x6248('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6248('0x2'));var logger=require(_0x6248('0x3'))(_0x6248('0x4'));var config=require(_0x6248('0x5'));var jayson=require(_0x6248('0x6'));var client=jayson['client'][_0x6248('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x24eb08,_0x423550,_0xbc3dc7){return new BPromise(function(_0x3be317,_0x46af07){return client[_0x6248('0x8')](_0x24eb08,_0xbc3dc7)[_0x6248('0x9')](function(_0x3e7051){logger['info'](_0x6248('0xa'),_0x423550,_0x6248('0xb'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x423550,'request\x20sent',JSON[_0x6248('0xc')](_0x3e7051));if(_0x3e7051[_0x6248('0xd')]){if(_0x3e7051['error']['code']===0x1f4){logger['error'](_0x6248('0xa'),_0x423550,_0x3e7051[_0x6248('0xd')][_0x6248('0xe')]);return _0x46af07(_0x3e7051['error'][_0x6248('0xe')]);}logger[_0x6248('0xd')](_0x6248('0xa'),_0x423550,_0x3e7051[_0x6248('0xd')][_0x6248('0xe')]);return _0x3be317(_0x3e7051[_0x6248('0xd')]['message']);}else{logger[_0x6248('0xf')](_0x6248('0xa'),_0x423550,_0x6248('0xb'));_0x3be317(_0x3e7051[_0x6248('0x10')][_0x6248('0xe')]);}})[_0x6248('0x11')](function(_0x2e4187){logger[_0x6248('0xd')](_0x6248('0xa'),_0x423550,_0x2e4187);_0x46af07(_0x2e4187);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d8c1864..79f4588 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 _0xbefe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','exports','util'];(function(_0x4f3af4,_0x2d048c){var _0x557e86=function(_0x222f68){while(--_0x222f68){_0x4f3af4['push'](_0x4f3af4['shift']());}};_0x557e86(++_0x2d048c);}(_0xbefe,0x168));var _0xebef=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xbefe[_0x77d310];return _0x2cdce4;};'use strict';var multer=require('multer');var util=require(_0xebef('0x0'));var path=require('path');var timeout=require(_0xebef('0x1'));var express=require(_0xebef('0x2'));var router=express[_0xebef('0x3')]();var fs_extra=require(_0xebef('0x4'));var auth=require(_0xebef('0x5'));var interaction=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var controller=require(_0xebef('0x8'));router['get']('/',auth[_0xebef('0x9')](),controller[_0xebef('0xa')]);router[_0xebef('0xb')]('/:id',auth[_0xebef('0x9')](),controller[_0xebef('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xebef('0xd')]);router[_0xebef('0xe')](_0xebef('0xf'),auth[_0xebef('0x9')](),controller[_0xebef('0x10')]);router[_0xebef('0x11')](_0xebef('0xf'),auth[_0xebef('0x9')](),controller['destroy']);module[_0xebef('0x12')]=router; \ No newline at end of file +var _0xff96=['post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','show'];(function(_0x537106,_0x57d602){var _0x10c1dc=function(_0x1004fe){while(--_0x1004fe){_0x537106['push'](_0x537106['shift']());}};_0x10c1dc(++_0x57d602);}(_0xff96,0x179));var _0x6ff9=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0xff96[_0x2c63a4];return _0x210eb8;};'use strict';var multer=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var path=require(_0x6ff9('0x2'));var timeout=require(_0x6ff9('0x3'));var express=require(_0x6ff9('0x4'));var router=express[_0x6ff9('0x5')]();var fs_extra=require(_0x6ff9('0x6'));var auth=require(_0x6ff9('0x7'));var interaction=require(_0x6ff9('0x8'));var config=require(_0x6ff9('0x9'));var controller=require(_0x6ff9('0xa'));router[_0x6ff9('0xb')]('/',auth['isAuthenticated'](),controller[_0x6ff9('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6ff9('0xd')]);router[_0x6ff9('0xe')]('/',auth[_0x6ff9('0xf')](),controller[_0x6ff9('0x10')]);router[_0x6ff9('0x11')](_0x6ff9('0x12'),auth['isAuthenticated'](),controller[_0x6ff9('0x13')]);router[_0x6ff9('0x14')](_0x6ff9('0x12'),auth[_0x6ff9('0xf')](),controller[_0x6ff9('0x15')]);module[_0x6ff9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b6c21c9..1bd1dec 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 _0x962d=['customVariable','sequelize','exports','ENUM','variable','picklist','STRING'];(function(_0x5a57cd,_0x498a68){var _0x3b9e9d=function(_0x467509){while(--_0x467509){_0x5a57cd['push'](_0x5a57cd['shift']());}};_0x3b9e9d(++_0x498a68);}(_0x962d,0x10b));var _0xd962=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x962d[_0x15ea09];return _0x3e9c78;};'use strict';var Sequelize=require(_0xd962('0x0'));module[_0xd962('0x1')]={'type':{'type':Sequelize[_0xd962('0x2')]('string',_0xd962('0x3'),'customVariable','keyValue',_0xd962('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd962('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd962('0x2')]('string',_0xd962('0x3'),_0xd962('0x6'))},'keyContent':{'type':Sequelize[_0xd962('0x5')]},'idField':{'type':Sequelize[_0xd962('0x5')]},'nameField':{'type':Sequelize[_0xd962('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd962('0x5')]}}; \ No newline at end of file +var _0x9b5f=['exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x1b1d27,_0x10256a){var _0x42fa2a=function(_0x44c051){while(--_0x44c051){_0x1b1d27['push'](_0x1b1d27['shift']());}};_0x42fa2a(++_0x10256a);}(_0x9b5f,0x185));var _0xf9b5=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x9b5f[_0x4a1353];return _0x3805cc;};'use strict';var Sequelize=require(_0xf9b5('0x0'));module[_0xf9b5('0x1')]={'type':{'type':Sequelize[_0xf9b5('0x2')]('string',_0xf9b5('0x3'),'customVariable',_0xf9b5('0x4'),_0xf9b5('0x5')),'defaultValue':_0xf9b5('0x6')},'content':{'type':Sequelize[_0xf9b5('0x7')]},'key':{'type':Sequelize[_0xf9b5('0x7')]},'keyType':{'type':Sequelize[_0xf9b5('0x2')](_0xf9b5('0x6'),_0xf9b5('0x3'),_0xf9b5('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf9b5('0x7')]},'nameField':{'type':Sequelize[_0xf9b5('0x7')]},'customField':{'type':Sequelize[_0xf9b5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf9b5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0e234f5..ac768c6 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 _0x64bf=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','length','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','FreshsalesField','rawAttributes','type','model','query','keys','filters'];(function(_0x1d2e96,_0x5ac8c7){var _0x5846fd=function(_0xb8440d){while(--_0xb8440d){_0x1d2e96['push'](_0x1d2e96['shift']());}};_0x5846fd(++_0x5ac8c7);}(_0x64bf,0xb2));var _0xf64b=function(_0x37b8b8,_0x25a846){_0x37b8b8=_0x37b8b8-0x0;var _0x1fd994=_0x64bf[_0x37b8b8];return _0x1fd994;};'use strict';var emlformat=require(_0xf64b('0x0'));var rimraf=require(_0xf64b('0x1'));var zipdir=require(_0xf64b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf64b('0x3'));var moment=require(_0xf64b('0x4'));var BPromise=require(_0xf64b('0x5'));var Mustache=require(_0xf64b('0x6'));var util=require(_0xf64b('0x7'));var path=require(_0xf64b('0x8'));var sox=require(_0xf64b('0x9'));var csv=require('to-csv');var ejs=require(_0xf64b('0xa'));var fs=require('fs');var fs_extra=require(_0xf64b('0xb'));var _=require(_0xf64b('0xc'));var squel=require(_0xf64b('0xd'));var crypto=require(_0xf64b('0xe'));var jsforce=require(_0xf64b('0xf'));var deskjs=require(_0xf64b('0x10'));var toCsv=require(_0xf64b('0x11'));var querystring=require('querystring');var Papa=require(_0xf64b('0x12'));var Redis=require('ioredis');var authService=require(_0xf64b('0x13'));var qs=require(_0xf64b('0x14'));var as=require(_0xf64b('0x15'));var hardwareService=require(_0xf64b('0x16'));var logger=require(_0xf64b('0x17'))(_0xf64b('0x18'));var utils=require(_0xf64b('0x19'));var config=require(_0xf64b('0x1a'));var licenseUtil=require(_0xf64b('0x1b'));var db=require(_0xf64b('0x1c'))['db'];function respondWithStatusCode(_0x54a023,_0x1a8e86){_0x1a8e86=_0x1a8e86||0xcc;return function(_0xe3b48b){if(_0xe3b48b){return _0x54a023[_0xf64b('0x1d')](_0x1a8e86);}return _0x54a023[_0xf64b('0x1e')](_0x1a8e86)[_0xf64b('0x1f')]();};}function respondWithResult(_0x3686c1,_0x5e5021){_0x5e5021=_0x5e5021||0xc8;return function(_0x381836){if(_0x381836){return _0x3686c1['status'](_0x5e5021)[_0xf64b('0x20')](_0x381836);}};}function respondWithFilteredResult(_0x1e1e9b,_0x38f3ba){return function(_0x58c831){if(_0x58c831){var _0x3227a0=typeof _0x38f3ba[_0xf64b('0x21')]===_0xf64b('0x22')&&typeof _0x38f3ba[_0xf64b('0x23')]===_0xf64b('0x22');var _0xf6d3e5=_0x58c831[_0xf64b('0x24')];var _0x1e0a9a=_0x3227a0?0x0:_0x38f3ba['offset'];var _0x10e165=_0x3227a0?_0x58c831[_0xf64b('0x24')]:_0x38f3ba[_0xf64b('0x21')]+_0x38f3ba['limit'];var _0x400a5f;if(_0x10e165>=_0xf6d3e5){_0x10e165=_0xf6d3e5;_0x400a5f=0xc8;}else{_0x400a5f=0xce;}_0x1e1e9b[_0xf64b('0x1e')](_0x400a5f);return _0x1e1e9b[_0xf64b('0x25')](_0xf64b('0x26'),_0x1e0a9a+'-'+_0x10e165+'/'+_0xf6d3e5)[_0xf64b('0x20')](_0x58c831);}return null;};}function patchUpdates(_0x1e006d){return function(_0x21bbea){try{jsonpatch[_0xf64b('0x27')](_0x21bbea,_0x1e006d,!![]);}catch(_0x4c7e68){return BPromise[_0xf64b('0x28')](_0x4c7e68);}return _0x21bbea[_0xf64b('0x29')]();};}function saveUpdates(_0x3011f5,_0x94da11){return function(_0x5a3ff3){if(_0x5a3ff3){return _0x5a3ff3[_0xf64b('0x2a')](_0x3011f5)[_0xf64b('0x2b')](function(_0x5ac703){return _0x5ac703;});}return null;};}function removeEntity(_0x521cf7,_0x99c2bd){return function(_0x18d6c2){if(_0x18d6c2){return _0x18d6c2[_0xf64b('0x2c')]()[_0xf64b('0x2b')](function(){_0x521cf7['status'](0xcc)[_0xf64b('0x1f')]();});}};}function handleEntityNotFound(_0x500b99,_0x361524){return function(_0x23d33a){if(!_0x23d33a){_0x500b99[_0xf64b('0x1d')](0x194);}return _0x23d33a;};}function handleError(_0x56cd42,_0x464f4a){_0x464f4a=_0x464f4a||0x1f4;return function(_0x42bc4b){logger[_0xf64b('0x2d')](_0x42bc4b['stack']);if(_0x42bc4b[_0xf64b('0x2e')]){delete _0x42bc4b[_0xf64b('0x2e')];}_0x56cd42[_0xf64b('0x1e')](_0x464f4a)[_0xf64b('0x2f')](_0x42bc4b);};}exports['index']=function(_0x5764ac,_0x9312b7){var _0xaf50f5={},_0x54b9eb={},_0x3e38b6={'count':0x0,'rows':[]};var _0x4919a7=_[_0xf64b('0x30')](db[_0xf64b('0x31')][_0xf64b('0x32')],function(_0xf9dcf7){return{'name':_0xf9dcf7['fieldName'],'type':_0xf9dcf7[_0xf64b('0x33')]['key']};});_0x54b9eb[_0xf64b('0x34')]=_[_0xf64b('0x30')](_0x4919a7,_0xf64b('0x2e'));_0x54b9eb[_0xf64b('0x35')]=_[_0xf64b('0x36')](_0x5764ac['query']);_0x54b9eb[_0xf64b('0x37')]=_[_0xf64b('0x38')](_0x54b9eb[_0xf64b('0x34')],_0x54b9eb[_0xf64b('0x35')]);_0xaf50f5[_0xf64b('0x39')]=_[_0xf64b('0x38')](_0x54b9eb['model'],qs[_0xf64b('0x3a')](_0x5764ac[_0xf64b('0x35')][_0xf64b('0x3a')]));_0xaf50f5[_0xf64b('0x39')]=_0xaf50f5['attributes']['length']?_0xaf50f5[_0xf64b('0x39')]:_0x54b9eb['model'];if(!_0x5764ac[_0xf64b('0x35')][_0xf64b('0x3b')](_0xf64b('0x3c'))){_0xaf50f5[_0xf64b('0x23')]=qs[_0xf64b('0x23')](_0x5764ac[_0xf64b('0x35')][_0xf64b('0x23')]);_0xaf50f5[_0xf64b('0x21')]=qs[_0xf64b('0x21')](_0x5764ac[_0xf64b('0x35')][_0xf64b('0x21')]);}_0xaf50f5[_0xf64b('0x3d')]=qs[_0xf64b('0x3e')](_0x5764ac['query'][_0xf64b('0x3e')]);_0xaf50f5[_0xf64b('0x3f')]=qs['filters'](_['pick'](_0x5764ac[_0xf64b('0x35')],_0x54b9eb['filters']),_0x4919a7);if(_0x5764ac[_0xf64b('0x35')][_0xf64b('0x40')]){_0xaf50f5[_0xf64b('0x3f')]=_['merge'](_0xaf50f5['where'],{'$or':_[_0xf64b('0x30')](_0x4919a7,function(_0x43bd0f){if(_0x43bd0f['type']!==_0xf64b('0x41')){var _0x40a19a={};_0x40a19a[_0x43bd0f[_0xf64b('0x2e')]]={'$like':'%'+_0x5764ac['query'][_0xf64b('0x40')]+'%'};return _0x40a19a;}})});}_0xaf50f5=_[_0xf64b('0x42')]({},_0xaf50f5,_0x5764ac[_0xf64b('0x43')]);var _0x1e8116={'where':_0xaf50f5[_0xf64b('0x3f')]};return db[_0xf64b('0x31')][_0xf64b('0x24')](_0x1e8116)[_0xf64b('0x2b')](function(_0x3df665){_0x3e38b6[_0xf64b('0x24')]=_0x3df665;if(_0x5764ac[_0xf64b('0x35')][_0xf64b('0x44')]){_0xaf50f5[_0xf64b('0x45')]=[{'all':!![]}];}return db[_0xf64b('0x31')][_0xf64b('0x46')](_0xaf50f5);})[_0xf64b('0x2b')](function(_0x2a58f8){_0x3e38b6[_0xf64b('0x47')]=_0x2a58f8;return _0x3e38b6;})[_0xf64b('0x2b')](respondWithFilteredResult(_0x9312b7,_0xaf50f5))['catch'](handleError(_0x9312b7,null));};exports['show']=function(_0x1f15d3,_0x4659d8){var _0x1c7181={'raw':!![],'where':{'id':_0x1f15d3[_0xf64b('0x48')]['id']}},_0x1defa5={};_0x1defa5[_0xf64b('0x34')]=_[_0xf64b('0x36')](db[_0xf64b('0x31')]['rawAttributes']);_0x1defa5[_0xf64b('0x35')]=_[_0xf64b('0x36')](_0x1f15d3[_0xf64b('0x35')]);_0x1defa5[_0xf64b('0x37')]=_[_0xf64b('0x38')](_0x1defa5[_0xf64b('0x34')],_0x1defa5[_0xf64b('0x35')]);_0x1c7181[_0xf64b('0x39')]=_[_0xf64b('0x38')](_0x1defa5[_0xf64b('0x34')],qs[_0xf64b('0x3a')](_0x1f15d3[_0xf64b('0x35')][_0xf64b('0x3a')]));_0x1c7181[_0xf64b('0x39')]=_0x1c7181[_0xf64b('0x39')][_0xf64b('0x49')]?_0x1c7181['attributes']:_0x1defa5[_0xf64b('0x34')];if(_0x1f15d3[_0xf64b('0x35')][_0xf64b('0x44')]){_0x1c7181[_0xf64b('0x45')]=[{'all':!![]}];}_0x1c7181=_['merge']({},_0x1c7181,_0x1f15d3[_0xf64b('0x43')]);return db[_0xf64b('0x31')]['find'](_0x1c7181)[_0xf64b('0x2b')](handleEntityNotFound(_0x4659d8,null))[_0xf64b('0x2b')](respondWithResult(_0x4659d8,null))[_0xf64b('0x4a')](handleError(_0x4659d8,null));};exports[_0xf64b('0x4b')]=function(_0x14ac45,_0x384e57){return db[_0xf64b('0x31')][_0xf64b('0x4b')](_0x14ac45[_0xf64b('0x4c')],{})[_0xf64b('0x2b')](respondWithResult(_0x384e57,0xc9))[_0xf64b('0x4a')](handleError(_0x384e57,null));};exports['update']=function(_0x543903,_0x3dcae4){if(_0x543903[_0xf64b('0x4c')]['id']){delete _0x543903[_0xf64b('0x4c')]['id'];}return db[_0xf64b('0x31')][_0xf64b('0x4d')]({'where':{'id':_0x543903['params']['id']}})[_0xf64b('0x2b')](handleEntityNotFound(_0x3dcae4,null))['then'](saveUpdates(_0x543903[_0xf64b('0x4c')],null))['then'](respondWithResult(_0x3dcae4,null))['catch'](handleError(_0x3dcae4,null));};exports[_0xf64b('0x2c')]=function(_0x3f42d9,_0x11cbc4){return db[_0xf64b('0x31')][_0xf64b('0x4d')]({'where':{'id':_0x3f42d9[_0xf64b('0x48')]['id']}})[_0xf64b('0x2b')](handleEntityNotFound(_0x11cbc4,null))[_0xf64b('0x2b')](removeEntity(_0x11cbc4,null))[_0xf64b('0x4a')](handleError(_0x11cbc4,null));}; \ No newline at end of file +var _0x6240=['VIRTUAL','includeAll','include','rows','catch','keys','options','find','create','update','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x589acb,_0x1073fa){var _0xa04ef5=function(_0x331bb6){while(--_0x331bb6){_0x589acb['push'](_0x589acb['shift']());}};_0xa04ef5(++_0x1073fa);}(_0x6240,0x175));var _0x0624=function(_0x1ad276,_0x3d02c2){_0x1ad276=_0x1ad276-0x0;var _0x1856b4=_0x6240[_0x1ad276];return _0x1856b4;};'use strict';var emlformat=require(_0x0624('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0624('0x1'));var jsonpatch=require(_0x0624('0x2'));var rp=require(_0x0624('0x3'));var moment=require(_0x0624('0x4'));var BPromise=require(_0x0624('0x5'));var Mustache=require(_0x0624('0x6'));var util=require(_0x0624('0x7'));var path=require(_0x0624('0x8'));var sox=require('sox');var csv=require(_0x0624('0x9'));var ejs=require(_0x0624('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0624('0xb'));var squel=require(_0x0624('0xc'));var crypto=require(_0x0624('0xd'));var jsforce=require(_0x0624('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0624('0x9'));var querystring=require('querystring');var Papa=require('papaparse');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(_0x0624('0xf'));var logger=require(_0x0624('0x10'))(_0x0624('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0624('0x12'));var db=require(_0x0624('0x13'))['db'];function respondWithStatusCode(_0x20087f,_0x315958){_0x315958=_0x315958||0xcc;return function(_0x4fa212){if(_0x4fa212){return _0x20087f[_0x0624('0x14')](_0x315958);}return _0x20087f['status'](_0x315958)[_0x0624('0x15')]();};}function respondWithResult(_0x2dd3e2,_0x1c3ead){_0x1c3ead=_0x1c3ead||0xc8;return function(_0x5472c3){if(_0x5472c3){return _0x2dd3e2['status'](_0x1c3ead)[_0x0624('0x16')](_0x5472c3);}};}function respondWithFilteredResult(_0x464afb,_0x275819){return function(_0x415481){if(_0x415481){var _0x1d2879=typeof _0x275819[_0x0624('0x17')]===_0x0624('0x18')&&typeof _0x275819[_0x0624('0x19')]===_0x0624('0x18');var _0x33a10a=_0x415481[_0x0624('0x1a')];var _0x5b1e78=_0x1d2879?0x0:_0x275819[_0x0624('0x17')];var _0x5b3620=_0x1d2879?_0x415481[_0x0624('0x1a')]:_0x275819['offset']+_0x275819['limit'];var _0x162056;if(_0x5b3620>=_0x33a10a){_0x5b3620=_0x33a10a;_0x162056=0xc8;}else{_0x162056=0xce;}_0x464afb[_0x0624('0x1b')](_0x162056);return _0x464afb[_0x0624('0x1c')](_0x0624('0x1d'),_0x5b1e78+'-'+_0x5b3620+'/'+_0x33a10a)[_0x0624('0x16')](_0x415481);}return null;};}function patchUpdates(_0x29c8d0){return function(_0x524419){try{jsonpatch[_0x0624('0x1e')](_0x524419,_0x29c8d0,!![]);}catch(_0x13bff9){return BPromise[_0x0624('0x1f')](_0x13bff9);}return _0x524419[_0x0624('0x20')]();};}function saveUpdates(_0xfd2189,_0x33ae6d){return function(_0x1bc616){if(_0x1bc616){return _0x1bc616['update'](_0xfd2189)['then'](function(_0x43c368){return _0x43c368;});}return null;};}function removeEntity(_0x4285e0,_0x5ac2e5){return function(_0x2c6c53){if(_0x2c6c53){return _0x2c6c53['destroy']()[_0x0624('0x21')](function(){_0x4285e0['status'](0xcc)[_0x0624('0x15')]();});}};}function handleEntityNotFound(_0x35f5c7,_0xd0f2f9){return function(_0x3e6411){if(!_0x3e6411){_0x35f5c7[_0x0624('0x14')](0x194);}return _0x3e6411;};}function handleError(_0x17ffd2,_0x37fca8){_0x37fca8=_0x37fca8||0x1f4;return function(_0x24bba5){logger[_0x0624('0x22')](_0x24bba5[_0x0624('0x23')]);if(_0x24bba5[_0x0624('0x24')]){delete _0x24bba5[_0x0624('0x24')];}_0x17ffd2[_0x0624('0x1b')](_0x37fca8)[_0x0624('0x25')](_0x24bba5);};}exports['index']=function(_0x3381d3,_0x216b92){var _0x5e1132={},_0x2af360={},_0x55be02={'count':0x0,'rows':[]};var _0x3dcbfe=_[_0x0624('0x26')](db[_0x0624('0x27')][_0x0624('0x28')],function(_0x56bd9f){return{'name':_0x56bd9f[_0x0624('0x29')],'type':_0x56bd9f[_0x0624('0x2a')][_0x0624('0x2b')]};});_0x2af360[_0x0624('0x2c')]=_[_0x0624('0x26')](_0x3dcbfe,_0x0624('0x24'));_0x2af360['query']=_['keys'](_0x3381d3['query']);_0x2af360[_0x0624('0x2d')]=_[_0x0624('0x2e')](_0x2af360['model'],_0x2af360[_0x0624('0x2f')]);_0x5e1132[_0x0624('0x30')]=_['intersection'](_0x2af360[_0x0624('0x2c')],qs[_0x0624('0x31')](_0x3381d3['query'][_0x0624('0x31')]));_0x5e1132[_0x0624('0x30')]=_0x5e1132[_0x0624('0x30')][_0x0624('0x32')]?_0x5e1132[_0x0624('0x30')]:_0x2af360[_0x0624('0x2c')];if(!_0x3381d3[_0x0624('0x2f')][_0x0624('0x33')](_0x0624('0x34'))){_0x5e1132[_0x0624('0x19')]=qs[_0x0624('0x19')](_0x3381d3[_0x0624('0x2f')][_0x0624('0x19')]);_0x5e1132[_0x0624('0x17')]=qs['offset'](_0x3381d3[_0x0624('0x2f')][_0x0624('0x17')]);}_0x5e1132[_0x0624('0x35')]=qs[_0x0624('0x36')](_0x3381d3['query'][_0x0624('0x36')]);_0x5e1132[_0x0624('0x37')]=qs['filters'](_[_0x0624('0x38')](_0x3381d3['query'],_0x2af360['filters']),_0x3dcbfe);if(_0x3381d3['query'][_0x0624('0x39')]){_0x5e1132[_0x0624('0x37')]=_[_0x0624('0x3a')](_0x5e1132[_0x0624('0x37')],{'$or':_[_0x0624('0x26')](_0x3dcbfe,function(_0x4ee15a){if(_0x4ee15a['type']!==_0x0624('0x3b')){var _0x3b9866={};_0x3b9866[_0x4ee15a[_0x0624('0x24')]]={'$like':'%'+_0x3381d3['query'][_0x0624('0x39')]+'%'};return _0x3b9866;}})});}_0x5e1132=_[_0x0624('0x3a')]({},_0x5e1132,_0x3381d3['options']);var _0x10d706={'where':_0x5e1132[_0x0624('0x37')]};return db[_0x0624('0x27')][_0x0624('0x1a')](_0x10d706)[_0x0624('0x21')](function(_0x4f5fa5){_0x55be02[_0x0624('0x1a')]=_0x4f5fa5;if(_0x3381d3['query'][_0x0624('0x3c')]){_0x5e1132[_0x0624('0x3d')]=[{'all':!![]}];}return db[_0x0624('0x27')]['findAll'](_0x5e1132);})[_0x0624('0x21')](function(_0x10f4d4){_0x55be02[_0x0624('0x3e')]=_0x10f4d4;return _0x55be02;})[_0x0624('0x21')](respondWithFilteredResult(_0x216b92,_0x5e1132))[_0x0624('0x3f')](handleError(_0x216b92,null));};exports['show']=function(_0x7cdd9,_0x492e97){var _0x2a6388={'raw':!![],'where':{'id':_0x7cdd9['params']['id']}},_0x1021f4={};_0x1021f4[_0x0624('0x2c')]=_['keys'](db[_0x0624('0x27')][_0x0624('0x28')]);_0x1021f4[_0x0624('0x2f')]=_[_0x0624('0x40')](_0x7cdd9[_0x0624('0x2f')]);_0x1021f4[_0x0624('0x2d')]=_[_0x0624('0x2e')](_0x1021f4[_0x0624('0x2c')],_0x1021f4[_0x0624('0x2f')]);_0x2a6388[_0x0624('0x30')]=_[_0x0624('0x2e')](_0x1021f4[_0x0624('0x2c')],qs[_0x0624('0x31')](_0x7cdd9[_0x0624('0x2f')]['fields']));_0x2a6388[_0x0624('0x30')]=_0x2a6388['attributes'][_0x0624('0x32')]?_0x2a6388['attributes']:_0x1021f4[_0x0624('0x2c')];if(_0x7cdd9[_0x0624('0x2f')][_0x0624('0x3c')]){_0x2a6388[_0x0624('0x3d')]=[{'all':!![]}];}_0x2a6388=_[_0x0624('0x3a')]({},_0x2a6388,_0x7cdd9[_0x0624('0x41')]);return db[_0x0624('0x27')][_0x0624('0x42')](_0x2a6388)[_0x0624('0x21')](handleEntityNotFound(_0x492e97,null))[_0x0624('0x21')](respondWithResult(_0x492e97,null))[_0x0624('0x3f')](handleError(_0x492e97,null));};exports[_0x0624('0x43')]=function(_0x864f5,_0x124985){return db[_0x0624('0x27')][_0x0624('0x43')](_0x864f5['body'],{})[_0x0624('0x21')](respondWithResult(_0x124985,0xc9))['catch'](handleError(_0x124985,null));};exports[_0x0624('0x44')]=function(_0x4b61d2,_0x2c0090){if(_0x4b61d2[_0x0624('0x45')]['id']){delete _0x4b61d2[_0x0624('0x45')]['id'];}return db['FreshsalesField'][_0x0624('0x42')]({'where':{'id':_0x4b61d2[_0x0624('0x46')]['id']}})[_0x0624('0x21')](handleEntityNotFound(_0x2c0090,null))[_0x0624('0x21')](saveUpdates(_0x4b61d2[_0x0624('0x45')],null))[_0x0624('0x21')](respondWithResult(_0x2c0090,null))[_0x0624('0x3f')](handleError(_0x2c0090,null));};exports[_0x0624('0x47')]=function(_0x24c335,_0x5b153d){return db[_0x0624('0x27')][_0x0624('0x42')]({'where':{'id':_0x24c335['params']['id']}})['then'](handleEntityNotFound(_0x5b153d,null))['then'](removeEntity(_0x5b153d,null))['catch'](handleError(_0x5b153d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5f74350..d444714 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 _0xfb11=['bluebird','path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x366cd6,_0xc04558){var _0x2502bf=function(_0x5827e4){while(--_0x5827e4){_0x366cd6['push'](_0x366cd6['shift']());}};_0x2502bf(++_0xc04558);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xfb11[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[{'name':_0x1fb1('0x9'),'fields':[_0x1fb1('0xa'),_0x1fb1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dcb=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x588473,_0x2b5c33){var _0x5588c7=function(_0x162acb){while(--_0x162acb){_0x588473['push'](_0x588473['shift']());}};_0x5588c7(++_0x2b5c33);}(_0x4dcb,0x186));var _0xb4dc=function(_0x411762,_0x3a6a0a){_0x411762=_0x411762-0x0;var _0x3129ef=_0x4dcb[_0x411762];return _0x3129ef;};'use strict';var _=require('lodash');var util=require(_0xb4dc('0x0'));var logger=require(_0xb4dc('0x1'))(_0xb4dc('0x2'));var moment=require(_0xb4dc('0x3'));var BPromise=require(_0xb4dc('0x4'));var rp=require(_0xb4dc('0x5'));var fs=require('fs');var path=require(_0xb4dc('0x6'));var rimraf=require(_0xb4dc('0x7'));var config=require(_0xb4dc('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x244be0,_0x5be4d1){return _0x244be0[_0xb4dc('0x9')](_0xb4dc('0xa'),attributes,{'tableName':_0xb4dc('0xb'),'paranoid':![],'indexes':[{'name':_0xb4dc('0xc'),'fields':[_0xb4dc('0xd'),_0xb4dc('0xe')],'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 8c2b192..ca9d0d8 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x237e45,_0x2f8d71){var _0x96b3b1=function(_0x38a53f){while(--_0x38a53f){_0x237e45['push'](_0x237e45['shift']());}};_0x96b3b1(++_0x2f8d71);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x153b6c,_0x17ae58){var _0x1c4b04=function(_0x16dfb8){while(--_0x16dfb8){_0x153b6c['push'](_0x153b6c['shift']());}};_0x1c4b04(++_0x17ae58);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2b4bc5a..1cf4e2c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x32043a,_0x58d9f8){var _0xc10212=function(_0x10c0bc){while(--_0x10c0bc){_0x32043a['push'](_0x32043a['shift']());}};_0xc10212(++_0x58d9f8);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x406875,_0x20b2a1){var _0x522a4e=function(_0xc102b){while(--_0xc102b){_0x406875['push'](_0x406875['shift']());}};_0x522a4e(++_0x20b2a1);}(_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('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 992fe87..b06622a 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 _0xa1c5=['sequelize','exports','STRING','username','integrationTab','newTab'];(function(_0x1f686d,_0x47ab23){var _0x63346a=function(_0x41d93d){while(--_0x41d93d){_0x1f686d['push'](_0x1f686d['shift']());}};_0x63346a(++_0x47ab23);}(_0xa1c5,0x96));var _0x5a1c=function(_0x4cd438,_0x220d7b){_0x4cd438=_0x4cd438-0x0;var _0x80f58=_0xa1c5[_0x4cd438];return _0x80f58;};'use strict';var Sequelize=require(_0x5a1c('0x0'));module[_0x5a1c('0x1')]={'name':{'type':Sequelize[_0x5a1c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x5a1c('0x3')},'remoteUri':{'type':Sequelize[_0x5a1c('0x2')]},'password':{'type':Sequelize[_0x5a1c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5a1c('0x2')]},'securityToken':{'type':Sequelize[_0x5a1c('0x2')]},'serverUrl':{'type':Sequelize[_0x5a1c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5a1c('0x4'),_0x5a1c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd7a3=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x3e9925,_0x3bb69e){var _0x268498=function(_0x52a3f6){while(--_0x52a3f6){_0x3e9925['push'](_0x3e9925['shift']());}};_0x268498(++_0x3bb69e);}(_0xd7a3,0xf4));var _0x3d7a=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xd7a3[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x3d7a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d7a('0x1')]},'username':{'type':Sequelize[_0x3d7a('0x1')],'unique':_0x3d7a('0x2')},'remoteUri':{'type':Sequelize[_0x3d7a('0x1')]},'password':{'type':Sequelize[_0x3d7a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3d7a('0x1')]},'securityToken':{'type':Sequelize[_0x3d7a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3d7a('0x3')](_0x3d7a('0x4'),_0x3d7a('0x5')),'defaultValue':_0x3d7a('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 693920d..e3976bb 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 _0x1933=['order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','SalesforceAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','map','type','VIRTUAL','options','includeAll','include','findAll','show','params','length','merge','catch','create','body','find','getConfigurations','findOne','SalesforceConfiguration'];(function(_0x2b9002,_0x1e5306){var _0x2835e9=function(_0x406001){while(--_0x406001){_0x2b9002['push'](_0x2b9002['shift']());}};_0x2835e9(++_0x1e5306);}(_0x1933,0xa7));var _0x3193=function(_0x45ad39,_0x1709b3){_0x45ad39=_0x45ad39-0x0;var _0x2a5772=_0x1933[_0x45ad39];return _0x2a5772;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3193('0x0'));var zipdir=require(_0x3193('0x1'));var jsonpatch=require(_0x3193('0x2'));var rp=require(_0x3193('0x3'));var moment=require(_0x3193('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3193('0x5'));var util=require(_0x3193('0x6'));var path=require(_0x3193('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3193('0x8'));var fs=require('fs');var fs_extra=require(_0x3193('0x9'));var _=require(_0x3193('0xa'));var squel=require(_0x3193('0xb'));var crypto=require(_0x3193('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3193('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3193('0xe'));var Redis=require(_0x3193('0xf'));var authService=require(_0x3193('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3193('0x11'));var hardwareService=require(_0x3193('0x12'));var logger=require(_0x3193('0x13'))(_0x3193('0x14'));var utils=require(_0x3193('0x15'));var config=require(_0x3193('0x16'));var licenseUtil=require(_0x3193('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a5411,_0x32e551){_0x32e551=_0x32e551||0xcc;return function(_0x57f3db){if(_0x57f3db){return _0x5a5411[_0x3193('0x18')](_0x32e551);}return _0x5a5411['status'](_0x32e551)[_0x3193('0x19')]();};}function respondWithResult(_0x1a9e1d,_0x5e4b83){_0x5e4b83=_0x5e4b83||0xc8;return function(_0x59a3ab){if(_0x59a3ab){return _0x1a9e1d[_0x3193('0x1a')](_0x5e4b83)[_0x3193('0x1b')](_0x59a3ab);}};}function respondWithFilteredResult(_0x248b95,_0x53064d){return function(_0xee07b0){if(_0xee07b0){var _0x25c089=typeof _0x53064d[_0x3193('0x1c')]===_0x3193('0x1d')&&typeof _0x53064d[_0x3193('0x1e')]===_0x3193('0x1d');var _0x12c863=_0xee07b0[_0x3193('0x1f')];var _0x2f210a=_0x25c089?0x0:_0x53064d['offset'];var _0x14efbe=_0x25c089?_0xee07b0[_0x3193('0x1f')]:_0x53064d[_0x3193('0x1c')]+_0x53064d['limit'];var _0x59821f;if(_0x14efbe>=_0x12c863){_0x14efbe=_0x12c863;_0x59821f=0xc8;}else{_0x59821f=0xce;}_0x248b95[_0x3193('0x1a')](_0x59821f);return _0x248b95[_0x3193('0x20')](_0x3193('0x21'),_0x2f210a+'-'+_0x14efbe+'/'+_0x12c863)[_0x3193('0x1b')](_0xee07b0);}return null;};}function patchUpdates(_0x2899f0){return function(_0x5596fc){try{jsonpatch['apply'](_0x5596fc,_0x2899f0,!![]);}catch(_0x20f603){return BPromise[_0x3193('0x22')](_0x20f603);}return _0x5596fc['save']();};}function saveUpdates(_0xf45b55,_0x150adb){return function(_0x40bfe8){if(_0x40bfe8){return _0x40bfe8[_0x3193('0x23')](_0xf45b55)[_0x3193('0x24')](function(_0xafe44b){return _0xafe44b;});}return null;};}function removeEntity(_0xc6971f,_0x480cce){return function(_0x14ee9b){if(_0x14ee9b){return _0x14ee9b[_0x3193('0x25')]()[_0x3193('0x24')](function(){_0xc6971f['status'](0xcc)[_0x3193('0x19')]();});}};}function handleEntityNotFound(_0x381e11,_0x40e6ac){return function(_0x536989){if(!_0x536989){_0x381e11[_0x3193('0x18')](0x194);}return _0x536989;};}function handleError(_0x36298c,_0x41e79a){_0x41e79a=_0x41e79a||0x1f4;return function(_0x37a475){logger[_0x3193('0x26')](_0x37a475[_0x3193('0x27')]);if(_0x37a475[_0x3193('0x28')]){delete _0x37a475[_0x3193('0x28')];}_0x36298c[_0x3193('0x1a')](_0x41e79a)['send'](_0x37a475);};}exports[_0x3193('0x29')]=function(_0x30e0db,_0x34ada1){var _0x574642={},_0x4289df={},_0x5e3697={'count':0x0,'rows':[]};var _0x1e789b=_['map'](db[_0x3193('0x2a')][_0x3193('0x2b')],function(_0x3a8bd1){return{'name':_0x3a8bd1['fieldName'],'type':_0x3a8bd1['type'][_0x3193('0x2c')]};});_0x4289df[_0x3193('0x2d')]=_['map'](_0x1e789b,_0x3193('0x28'));_0x4289df[_0x3193('0x2e')]=_[_0x3193('0x2f')](_0x30e0db[_0x3193('0x2e')]);_0x4289df[_0x3193('0x30')]=_['intersection'](_0x4289df[_0x3193('0x2d')],_0x4289df[_0x3193('0x2e')]);_0x574642[_0x3193('0x31')]=_[_0x3193('0x32')](_0x4289df[_0x3193('0x2d')],qs['fields'](_0x30e0db[_0x3193('0x2e')][_0x3193('0x33')]));_0x574642[_0x3193('0x31')]=_0x574642[_0x3193('0x31')]['length']?_0x574642[_0x3193('0x31')]:_0x4289df[_0x3193('0x2d')];if(!_0x30e0db['query']['hasOwnProperty'](_0x3193('0x34'))){_0x574642[_0x3193('0x1e')]=qs[_0x3193('0x1e')](_0x30e0db[_0x3193('0x2e')][_0x3193('0x1e')]);_0x574642[_0x3193('0x1c')]=qs[_0x3193('0x1c')](_0x30e0db[_0x3193('0x2e')][_0x3193('0x1c')]);}_0x574642['order']=qs[_0x3193('0x35')](_0x30e0db['query'][_0x3193('0x35')]);_0x574642[_0x3193('0x36')]=qs[_0x3193('0x30')](_[_0x3193('0x37')](_0x30e0db['query'],_0x4289df['filters']),_0x1e789b);if(_0x30e0db['query'][_0x3193('0x38')]){_0x574642[_0x3193('0x36')]=_['merge'](_0x574642[_0x3193('0x36')],{'$or':_[_0x3193('0x39')](_0x1e789b,function(_0x14ae24){if(_0x14ae24[_0x3193('0x3a')]!==_0x3193('0x3b')){var _0x4ef26a={};_0x4ef26a[_0x14ae24[_0x3193('0x28')]]={'$like':'%'+_0x30e0db['query'][_0x3193('0x38')]+'%'};return _0x4ef26a;}})});}_0x574642=_['merge']({},_0x574642,_0x30e0db[_0x3193('0x3c')]);var _0x3e82e2={'where':_0x574642['where']};return db['SalesforceAccount'][_0x3193('0x1f')](_0x3e82e2)[_0x3193('0x24')](function(_0x2dedb){_0x5e3697[_0x3193('0x1f')]=_0x2dedb;if(_0x30e0db[_0x3193('0x2e')][_0x3193('0x3d')]){_0x574642[_0x3193('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x3193('0x3f')](_0x574642);})[_0x3193('0x24')](function(_0x2001d1){_0x5e3697['rows']=_0x2001d1;return _0x5e3697;})[_0x3193('0x24')](respondWithFilteredResult(_0x34ada1,_0x574642))['catch'](handleError(_0x34ada1,null));};exports[_0x3193('0x40')]=function(_0x222e7e,_0x3f71b8){var _0x94fe57={'raw':![],'where':{'id':_0x222e7e[_0x3193('0x41')]['id']}},_0x221aae={};_0x221aae['model']=_[_0x3193('0x2f')](db['SalesforceAccount'][_0x3193('0x2b')]);_0x221aae['query']=_['keys'](_0x222e7e[_0x3193('0x2e')]);_0x221aae['filters']=_[_0x3193('0x32')](_0x221aae['model'],_0x221aae[_0x3193('0x2e')]);_0x94fe57['attributes']=_[_0x3193('0x32')](_0x221aae[_0x3193('0x2d')],qs[_0x3193('0x33')](_0x222e7e['query'][_0x3193('0x33')]));_0x94fe57[_0x3193('0x31')]=_0x94fe57[_0x3193('0x31')][_0x3193('0x42')]?_0x94fe57['attributes']:_0x221aae[_0x3193('0x2d')];if(_0x222e7e[_0x3193('0x2e')]['includeAll']){_0x94fe57[_0x3193('0x3e')]=[{'all':!![]}];}_0x94fe57=_[_0x3193('0x43')]({},_0x94fe57,_0x222e7e[_0x3193('0x3c')]);return db[_0x3193('0x2a')]['find'](_0x94fe57)[_0x3193('0x24')](handleEntityNotFound(_0x3f71b8,null))[_0x3193('0x24')](respondWithResult(_0x3f71b8,null))[_0x3193('0x44')](handleError(_0x3f71b8,null));};exports[_0x3193('0x45')]=function(_0x19650b,_0x222bb5){return db[_0x3193('0x2a')][_0x3193('0x45')](_0x19650b['body'],{})[_0x3193('0x24')](respondWithResult(_0x222bb5,0xc9))[_0x3193('0x44')](handleError(_0x222bb5,null));};exports[_0x3193('0x23')]=function(_0x2317a0,_0x56f2b1){if(_0x2317a0[_0x3193('0x46')]['id']){delete _0x2317a0[_0x3193('0x46')]['id'];}return db[_0x3193('0x2a')]['find']({'where':{'id':_0x2317a0[_0x3193('0x41')]['id']}})[_0x3193('0x24')](handleEntityNotFound(_0x56f2b1,null))[_0x3193('0x24')](saveUpdates(_0x2317a0['body'],null))[_0x3193('0x24')](respondWithResult(_0x56f2b1,null))['catch'](handleError(_0x56f2b1,null));};exports[_0x3193('0x25')]=function(_0x1251d3,_0xc5e821){return db[_0x3193('0x2a')][_0x3193('0x47')]({'where':{'id':_0x1251d3[_0x3193('0x41')]['id']}})[_0x3193('0x24')](handleEntityNotFound(_0xc5e821,null))[_0x3193('0x24')](removeEntity(_0xc5e821,null))[_0x3193('0x44')](handleError(_0xc5e821,null));};exports[_0x3193('0x48')]=function(_0x190157,_0x497769,_0x32c63b){var _0x3c348a={};var _0x368568={};var _0xd65969;var _0x1acaf2;return db[_0x3193('0x2a')][_0x3193('0x49')]({'where':{'id':_0x190157[_0x3193('0x41')]['id']}})['then'](handleEntityNotFound(_0x497769,null))['then'](function(_0x3922e5){if(_0x3922e5){_0xd65969=_0x3922e5;_0x368568[_0x3193('0x2d')]=_[_0x3193('0x2f')](db[_0x3193('0x4a')][_0x3193('0x2b')]);_0x368568[_0x3193('0x2e')]=_[_0x3193('0x2f')](_0x190157[_0x3193('0x2e')]);_0x368568[_0x3193('0x30')]=_[_0x3193('0x32')](_0x368568[_0x3193('0x2d')],_0x368568['query']);_0x3c348a[_0x3193('0x31')]=_[_0x3193('0x32')](_0x368568[_0x3193('0x2d')],qs[_0x3193('0x33')](_0x190157[_0x3193('0x2e')][_0x3193('0x33')]));_0x3c348a['attributes']=_0x3c348a[_0x3193('0x31')][_0x3193('0x42')]?_0x3c348a[_0x3193('0x31')]:_0x368568['model'];_0x3c348a[_0x3193('0x4b')]=qs[_0x3193('0x35')](_0x190157[_0x3193('0x2e')][_0x3193('0x35')]);_0x3c348a[_0x3193('0x36')]=qs[_0x3193('0x30')](_[_0x3193('0x37')](_0x190157['query'],_0x368568[_0x3193('0x30')]));if(_0x190157[_0x3193('0x2e')][_0x3193('0x38')]){_0x3c348a[_0x3193('0x36')]=_[_0x3193('0x43')](_0x3c348a[_0x3193('0x36')],{'$or':_[_0x3193('0x39')](_0x3c348a[_0x3193('0x31')],function(_0x209922){var _0x152c8d={};_0x152c8d[_0x209922]={'$like':'%'+_0x190157['query']['filter']+'%'};return _0x152c8d;})});}_0x3c348a=_[_0x3193('0x43')]({},_0x3c348a,_0x190157[_0x3193('0x3c')]);return _0xd65969['getConfigurations'](_0x3c348a);}})[_0x3193('0x24')](function(_0x14b392){if(_0x14b392){_0x1acaf2=_0x14b392['length'];if(!_0x190157[_0x3193('0x2e')][_0x3193('0x4c')](_0x3193('0x34'))){_0x3c348a[_0x3193('0x1e')]=qs[_0x3193('0x1e')](_0x190157[_0x3193('0x2e')]['limit']);_0x3c348a['offset']=qs[_0x3193('0x1c')](_0x190157[_0x3193('0x2e')][_0x3193('0x1c')]);}return _0xd65969[_0x3193('0x48')](_0x3c348a);}})['then'](function(_0x5d4eef){if(_0x5d4eef){return _0x5d4eef?{'count':_0x1acaf2,'rows':_0x5d4eef}:null;}})['then'](respondWithResult(_0x497769,null))[_0x3193('0x44')](handleError(_0x497769,null));};exports[_0x3193('0x4d')]=function(_0x4b6830,_0x482dc5,_0x57bfa2){if(_0x4b6830[_0x3193('0x46')]['id']){delete _0x4b6830[_0x3193('0x46')]['id'];}return db[_0x3193('0x2a')][_0x3193('0x49')]({'where':{'id':_0x4b6830['params']['id']}})[_0x3193('0x24')](handleEntityNotFound(_0x482dc5,null))[_0x3193('0x24')](function(_0x148537){if(_0x148537){_0x4b6830[_0x3193('0x46')]['AccountId']=_0x148537['id'];_0x4b6830['body'][_0x3193('0x4e')]=integrations[_0x3193('0x4f')](_0x4b6830[_0x3193('0x46')][_0x3193('0x50')],_0x4b6830[_0x3193('0x46')]['type']);_0x4b6830[_0x3193('0x46')]['Descriptions']=integrations[_0x3193('0x51')](_0x4b6830['body'][_0x3193('0x50')],_0x4b6830['body'][_0x3193('0x3a')]);return db[_0x3193('0x4a')][_0x3193('0x45')](_0x4b6830[_0x3193('0x46')],{'include':[{'model':db[_0x3193('0x52')],'as':_0x3193('0x4e')},{'model':db[_0x3193('0x52')],'as':_0x3193('0x53')}]});}return null;})[_0x3193('0x24')](respondWithResult(_0x482dc5,null))[_0x3193('0x44')](handleError(_0x482dc5,null));};exports[_0x3193('0x54')]=function(_0x29ae39,_0x48b961,_0x593221){var _0x2a6b8a;var _0x4dc370='';var _0x213243='Task';return db[_0x3193('0x2a')][_0x3193('0x49')]({'where':{'id':_0x29ae39[_0x3193('0x41')]['id']},'attributes':['id',_0x3193('0x55'),_0x3193('0x56'),'clientSecret',_0x3193('0x57'),'password',_0x3193('0x58')]})[_0x3193('0x24')](handleEntityNotFound(_0x48b961,null))[_0x3193('0x24')](function(_0xeb7d2b){if(_0xeb7d2b){_0x4dc370=_0xeb7d2b[_0x3193('0x55')];var _0x4edd17=_0x4dc370[_0x3193('0x59')](-0x1);if(_0x4edd17==='/'){_0x4dc370=_0x4dc370[_0x3193('0x5a')](0x0,_0x4dc370[_0x3193('0x5b')](_0x4edd17));}_0x2a6b8a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4dc370,'clientId':_0xeb7d2b['clientId'],'clientSecret':_0xeb7d2b['clientSecret']}});return _0x2a6b8a[_0x3193('0x5c')](_0xeb7d2b[_0x3193('0x57')],_0xeb7d2b['password'][_0x3193('0x5d')](_0xeb7d2b['securityToken']));}})['then'](function(_0x1e27ae){if(_0x1e27ae){if(!_[_0x3193('0x5e')](_0x29ae39[_0x3193('0x2e')][_0x3193('0x5f')])){_0x213243=_0x29ae39[_0x3193('0x2e')][_0x3193('0x5f')];}return _0x2a6b8a['sobject'](_0x213243)[_0x3193('0x60')]();}})['then'](function(_0x2d6f31){var _0x51442b=['OwnerId',_0x3193('0x61'),_0x3193('0x62'),_0x3193('0x63'),_0x3193('0x64'),_0x3193('0x65')];var _0x318f45=['string','int','picklist',_0x3193('0x66'),_0x3193('0x67'),'textarea',_0x3193('0x68')];if(_0x2d6f31){_[_0x3193('0x69')](_0x2d6f31['fields'],function(_0x16e498){return _0x51442b[_0x3193('0x6a')](_0x16e498['name'])||!_0x318f45['includes'](_0x16e498[_0x3193('0x3a')]);});return{'count':_0x2d6f31['fields'][_0x3193('0x42')],'rows':_[_0x3193('0x39')](_0x2d6f31[_0x3193('0x33')],function(_0x4c353f){return{'id':_0x4c353f['name'],'name':_0x4c353f[_0x3193('0x6b')],'custom':_0x4c353f[_0x3193('0x6c')],'options':_0x4c353f[_0x3193('0x6d')][_0x3193('0x42')]>0x0?_[_0x3193('0x39')](_0x4c353f[_0x3193('0x6d')],function(_0x5304f1){return{'name':_0x5304f1[_0x3193('0x6b')],'value':_0x5304f1[_0x3193('0x6e')]};}):_0x4c353f['type']==_0x3193('0x66')?[{'name':_0x3193('0x6f'),'value':_0x3193('0x70')},{'name':_0x3193('0x71'),'value':_0x3193('0x72')}]:[]};})};}})[_0x3193('0x24')](respondWithResult(_0x48b961,null))[_0x3193('0x44')](function(_0x27bad0){var _0x2c7fc0=_0x29ae39['query'][_0x3193('0x73')]?0x1f4:_0x27bad0[_0x3193('0x74')]||0x1f4;logger[_0x3193('0x26')](_0x3193('0x75'),'getFields',_0x2c7fc0,JSON[_0x3193('0x76')](_0x27bad0));delete _0x27bad0[_0x3193('0x28')];if(_0x2c7fc0===0x191){_0x2c7fc0=0x190;}_0x48b961[_0x3193('0x1a')](_0x2c7fc0)[_0x3193('0x77')](_0x29ae39[_0x3193('0x2e')][_0x3193('0x73')]?{'message':_0x3193('0x78'),'statusCode':_0x27bad0[_0x3193('0x74')]}:_0x27bad0);});}; \ No newline at end of file +var _0x1178=['clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','picklistValues','label','value','True','true','statusCode','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Task','remoteUri','username','password','securityToken','slice','clientId'];(function(_0x308bb9,_0x2d172f){var _0x3f211c=function(_0x389f92){while(--_0x389f92){_0x308bb9['push'](_0x308bb9['shift']());}};_0x3f211c(++_0x2d172f);}(_0x1178,0x11c));var _0x8117=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1178[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8117('0x0'));var zipdir=require(_0x8117('0x1'));var jsonpatch=require(_0x8117('0x2'));var rp=require(_0x8117('0x3'));var moment=require('moment');var BPromise=require(_0x8117('0x4'));var Mustache=require(_0x8117('0x5'));var util=require(_0x8117('0x6'));var path=require(_0x8117('0x7'));var sox=require(_0x8117('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8117('0x9'));var _=require(_0x8117('0xa'));var squel=require('squel');var crypto=require(_0x8117('0xb'));var jsforce=require(_0x8117('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8117('0xd'));var querystring=require(_0x8117('0xe'));var Papa=require(_0x8117('0xf'));var Redis=require('ioredis');var authService=require(_0x8117('0x10'));var qs=require(_0x8117('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8117('0x12'));var logger=require(_0x8117('0x13'))(_0x8117('0x14'));var utils=require(_0x8117('0x15'));var config=require(_0x8117('0x16'));var licenseUtil=require(_0x8117('0x17'));var db=require(_0x8117('0x18'))['db'];var integrations=require(_0x8117('0x19'));function respondWithStatusCode(_0x227903,_0x491728){_0x491728=_0x491728||0xcc;return function(_0x20fcd0){if(_0x20fcd0){return _0x227903[_0x8117('0x1a')](_0x491728);}return _0x227903[_0x8117('0x1b')](_0x491728)[_0x8117('0x1c')]();};}function respondWithResult(_0x4af2c2,_0x4034f4){_0x4034f4=_0x4034f4||0xc8;return function(_0x344eb1){if(_0x344eb1){return _0x4af2c2[_0x8117('0x1b')](_0x4034f4)[_0x8117('0x1d')](_0x344eb1);}};}function respondWithFilteredResult(_0x318665,_0x2a6114){return function(_0x219fe1){if(_0x219fe1){var _0x10e552=typeof _0x2a6114[_0x8117('0x1e')]===_0x8117('0x1f')&&typeof _0x2a6114[_0x8117('0x20')]===_0x8117('0x1f');var _0x3570bd=_0x219fe1[_0x8117('0x21')];var _0x25dbf0=_0x10e552?0x0:_0x2a6114['offset'];var _0x5dbfe7=_0x10e552?_0x219fe1['count']:_0x2a6114[_0x8117('0x1e')]+_0x2a6114[_0x8117('0x20')];var _0x179aea;if(_0x5dbfe7>=_0x3570bd){_0x5dbfe7=_0x3570bd;_0x179aea=0xc8;}else{_0x179aea=0xce;}_0x318665[_0x8117('0x1b')](_0x179aea);return _0x318665['set'](_0x8117('0x22'),_0x25dbf0+'-'+_0x5dbfe7+'/'+_0x3570bd)[_0x8117('0x1d')](_0x219fe1);}return null;};}function patchUpdates(_0x121f67){return function(_0x162ce2){try{jsonpatch[_0x8117('0x23')](_0x162ce2,_0x121f67,!![]);}catch(_0x42cbc6){return BPromise[_0x8117('0x24')](_0x42cbc6);}return _0x162ce2[_0x8117('0x25')]();};}function saveUpdates(_0x12413e,_0x1c8d15){return function(_0x35e3ce){if(_0x35e3ce){return _0x35e3ce[_0x8117('0x26')](_0x12413e)[_0x8117('0x27')](function(_0x57b69b){return _0x57b69b;});}return null;};}function removeEntity(_0x18fbcd,_0x5f496b){return function(_0x30f384){if(_0x30f384){return _0x30f384['destroy']()[_0x8117('0x27')](function(){_0x18fbcd['status'](0xcc)[_0x8117('0x1c')]();});}};}function handleEntityNotFound(_0x15ad6b,_0x203c69){return function(_0x3e23ea){if(!_0x3e23ea){_0x15ad6b['sendStatus'](0x194);}return _0x3e23ea;};}function handleError(_0x4738b2,_0x591cd3){_0x591cd3=_0x591cd3||0x1f4;return function(_0x450582){logger[_0x8117('0x28')](_0x450582[_0x8117('0x29')]);if(_0x450582[_0x8117('0x2a')]){delete _0x450582[_0x8117('0x2a')];}_0x4738b2['status'](_0x591cd3)[_0x8117('0x2b')](_0x450582);};}exports[_0x8117('0x2c')]=function(_0x140c1c,_0x3bc5cf){var _0x5c1639={},_0x2e3387={},_0x58b2ff={'count':0x0,'rows':[]};var _0x3be7c5=_[_0x8117('0x2d')](db[_0x8117('0x2e')][_0x8117('0x2f')],function(_0x36b591){return{'name':_0x36b591[_0x8117('0x30')],'type':_0x36b591[_0x8117('0x31')][_0x8117('0x32')]};});_0x2e3387[_0x8117('0x33')]=_[_0x8117('0x2d')](_0x3be7c5,_0x8117('0x2a'));_0x2e3387[_0x8117('0x34')]=_[_0x8117('0x35')](_0x140c1c[_0x8117('0x34')]);_0x2e3387[_0x8117('0x36')]=_['intersection'](_0x2e3387[_0x8117('0x33')],_0x2e3387[_0x8117('0x34')]);_0x5c1639[_0x8117('0x37')]=_[_0x8117('0x38')](_0x2e3387[_0x8117('0x33')],qs[_0x8117('0x39')](_0x140c1c['query']['fields']));_0x5c1639[_0x8117('0x37')]=_0x5c1639[_0x8117('0x37')][_0x8117('0x3a')]?_0x5c1639[_0x8117('0x37')]:_0x2e3387['model'];if(!_0x140c1c[_0x8117('0x34')][_0x8117('0x3b')](_0x8117('0x3c'))){_0x5c1639[_0x8117('0x20')]=qs[_0x8117('0x20')](_0x140c1c[_0x8117('0x34')][_0x8117('0x20')]);_0x5c1639[_0x8117('0x1e')]=qs[_0x8117('0x1e')](_0x140c1c['query'][_0x8117('0x1e')]);}_0x5c1639[_0x8117('0x3d')]=qs[_0x8117('0x3e')](_0x140c1c['query'][_0x8117('0x3e')]);_0x5c1639[_0x8117('0x3f')]=qs['filters'](_[_0x8117('0x40')](_0x140c1c[_0x8117('0x34')],_0x2e3387[_0x8117('0x36')]),_0x3be7c5);if(_0x140c1c[_0x8117('0x34')]['filter']){_0x5c1639[_0x8117('0x3f')]=_[_0x8117('0x41')](_0x5c1639[_0x8117('0x3f')],{'$or':_[_0x8117('0x2d')](_0x3be7c5,function(_0x481c7d){if(_0x481c7d[_0x8117('0x31')]!==_0x8117('0x42')){var _0x848917={};_0x848917[_0x481c7d[_0x8117('0x2a')]]={'$like':'%'+_0x140c1c[_0x8117('0x34')][_0x8117('0x43')]+'%'};return _0x848917;}})});}_0x5c1639=_[_0x8117('0x41')]({},_0x5c1639,_0x140c1c[_0x8117('0x44')]);var _0x467e05={'where':_0x5c1639[_0x8117('0x3f')]};return db[_0x8117('0x2e')]['count'](_0x467e05)[_0x8117('0x27')](function(_0x22413e){_0x58b2ff[_0x8117('0x21')]=_0x22413e;if(_0x140c1c[_0x8117('0x34')][_0x8117('0x45')]){_0x5c1639[_0x8117('0x46')]=[{'all':!![]}];}return db[_0x8117('0x2e')]['findAll'](_0x5c1639);})[_0x8117('0x27')](function(_0x3fed26){_0x58b2ff[_0x8117('0x47')]=_0x3fed26;return _0x58b2ff;})[_0x8117('0x27')](respondWithFilteredResult(_0x3bc5cf,_0x5c1639))[_0x8117('0x48')](handleError(_0x3bc5cf,null));};exports[_0x8117('0x49')]=function(_0x5450ac,_0x22aa71){var _0x1d1a1e={'raw':![],'where':{'id':_0x5450ac['params']['id']}},_0x2f7f08={};_0x2f7f08[_0x8117('0x33')]=_['keys'](db[_0x8117('0x2e')]['rawAttributes']);_0x2f7f08[_0x8117('0x34')]=_[_0x8117('0x35')](_0x5450ac[_0x8117('0x34')]);_0x2f7f08[_0x8117('0x36')]=_[_0x8117('0x38')](_0x2f7f08[_0x8117('0x33')],_0x2f7f08[_0x8117('0x34')]);_0x1d1a1e[_0x8117('0x37')]=_['intersection'](_0x2f7f08[_0x8117('0x33')],qs[_0x8117('0x39')](_0x5450ac[_0x8117('0x34')]['fields']));_0x1d1a1e['attributes']=_0x1d1a1e[_0x8117('0x37')][_0x8117('0x3a')]?_0x1d1a1e[_0x8117('0x37')]:_0x2f7f08['model'];if(_0x5450ac[_0x8117('0x34')]['includeAll']){_0x1d1a1e[_0x8117('0x46')]=[{'all':!![]}];}_0x1d1a1e=_[_0x8117('0x41')]({},_0x1d1a1e,_0x5450ac[_0x8117('0x44')]);return db[_0x8117('0x2e')][_0x8117('0x4a')](_0x1d1a1e)[_0x8117('0x27')](handleEntityNotFound(_0x22aa71,null))['then'](respondWithResult(_0x22aa71,null))[_0x8117('0x48')](handleError(_0x22aa71,null));};exports[_0x8117('0x4b')]=function(_0x227bd7,_0x28fd92){return db[_0x8117('0x2e')]['create'](_0x227bd7[_0x8117('0x4c')],{})[_0x8117('0x27')](respondWithResult(_0x28fd92,0xc9))[_0x8117('0x48')](handleError(_0x28fd92,null));};exports[_0x8117('0x26')]=function(_0x2744af,_0x624bc5){if(_0x2744af[_0x8117('0x4c')]['id']){delete _0x2744af['body']['id'];}return db[_0x8117('0x2e')][_0x8117('0x4a')]({'where':{'id':_0x2744af[_0x8117('0x4d')]['id']}})[_0x8117('0x27')](handleEntityNotFound(_0x624bc5,null))[_0x8117('0x27')](saveUpdates(_0x2744af[_0x8117('0x4c')],null))[_0x8117('0x27')](respondWithResult(_0x624bc5,null))['catch'](handleError(_0x624bc5,null));};exports['destroy']=function(_0x45dbd7,_0x1b9cc6){return db['SalesforceAccount']['find']({'where':{'id':_0x45dbd7[_0x8117('0x4d')]['id']}})[_0x8117('0x27')](handleEntityNotFound(_0x1b9cc6,null))[_0x8117('0x27')](removeEntity(_0x1b9cc6,null))[_0x8117('0x48')](handleError(_0x1b9cc6,null));};exports[_0x8117('0x4e')]=function(_0x3e633e,_0x53c0ad,_0x2ac125){var _0x5ac93b={};var _0x39894a={};var _0x3ffb72;var _0x5a0fae;return db['SalesforceAccount'][_0x8117('0x4f')]({'where':{'id':_0x3e633e['params']['id']}})['then'](handleEntityNotFound(_0x53c0ad,null))[_0x8117('0x27')](function(_0x4cecd0){if(_0x4cecd0){_0x3ffb72=_0x4cecd0;_0x39894a[_0x8117('0x33')]=_[_0x8117('0x35')](db['SalesforceConfiguration'][_0x8117('0x2f')]);_0x39894a[_0x8117('0x34')]=_['keys'](_0x3e633e[_0x8117('0x34')]);_0x39894a[_0x8117('0x36')]=_[_0x8117('0x38')](_0x39894a[_0x8117('0x33')],_0x39894a[_0x8117('0x34')]);_0x5ac93b[_0x8117('0x37')]=_['intersection'](_0x39894a[_0x8117('0x33')],qs['fields'](_0x3e633e[_0x8117('0x34')][_0x8117('0x39')]));_0x5ac93b[_0x8117('0x37')]=_0x5ac93b[_0x8117('0x37')][_0x8117('0x3a')]?_0x5ac93b[_0x8117('0x37')]:_0x39894a[_0x8117('0x33')];_0x5ac93b[_0x8117('0x3d')]=qs[_0x8117('0x3e')](_0x3e633e['query'][_0x8117('0x3e')]);_0x5ac93b[_0x8117('0x3f')]=qs['filters'](_[_0x8117('0x40')](_0x3e633e['query'],_0x39894a[_0x8117('0x36')]));if(_0x3e633e[_0x8117('0x34')][_0x8117('0x43')]){_0x5ac93b['where']=_['merge'](_0x5ac93b[_0x8117('0x3f')],{'$or':_[_0x8117('0x2d')](_0x5ac93b['attributes'],function(_0x3bcfae){var _0x32b45c={};_0x32b45c[_0x3bcfae]={'$like':'%'+_0x3e633e[_0x8117('0x34')][_0x8117('0x43')]+'%'};return _0x32b45c;})});}_0x5ac93b=_['merge']({},_0x5ac93b,_0x3e633e[_0x8117('0x44')]);return _0x3ffb72[_0x8117('0x4e')](_0x5ac93b);}})[_0x8117('0x27')](function(_0x10c2b1){if(_0x10c2b1){_0x5a0fae=_0x10c2b1['length'];if(!_0x3e633e[_0x8117('0x34')][_0x8117('0x3b')]('nolimit')){_0x5ac93b[_0x8117('0x20')]=qs[_0x8117('0x20')](_0x3e633e[_0x8117('0x34')][_0x8117('0x20')]);_0x5ac93b[_0x8117('0x1e')]=qs['offset'](_0x3e633e[_0x8117('0x34')][_0x8117('0x1e')]);}return _0x3ffb72[_0x8117('0x4e')](_0x5ac93b);}})[_0x8117('0x27')](function(_0x1eb451){if(_0x1eb451){return _0x1eb451?{'count':_0x5a0fae,'rows':_0x1eb451}:null;}})[_0x8117('0x27')](respondWithResult(_0x53c0ad,null))['catch'](handleError(_0x53c0ad,null));};exports['addConfiguration']=function(_0x45abf0,_0x2fb027,_0xc0202e){if(_0x45abf0['body']['id']){delete _0x45abf0[_0x8117('0x4c')]['id'];}return db[_0x8117('0x2e')][_0x8117('0x4f')]({'where':{'id':_0x45abf0['params']['id']}})[_0x8117('0x27')](handleEntityNotFound(_0x2fb027,null))['then'](function(_0x19eecc){if(_0x19eecc){_0x45abf0[_0x8117('0x4c')][_0x8117('0x50')]=_0x19eecc['id'];_0x45abf0[_0x8117('0x4c')][_0x8117('0x51')]=integrations[_0x8117('0x52')](_0x45abf0[_0x8117('0x4c')][_0x8117('0x53')],_0x45abf0[_0x8117('0x4c')][_0x8117('0x31')]);_0x45abf0['body']['Descriptions']=integrations[_0x8117('0x54')](_0x45abf0['body'][_0x8117('0x53')],_0x45abf0[_0x8117('0x4c')][_0x8117('0x31')]);return db[_0x8117('0x55')][_0x8117('0x4b')](_0x45abf0['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x8117('0x56')],'as':'Descriptions'}]});}return null;})[_0x8117('0x27')](respondWithResult(_0x2fb027,null))['catch'](handleError(_0x2fb027,null));};exports['getFields']=function(_0x13fa2c,_0x4e3952,_0x51ce57){var _0x59b87d;var _0x163b09='';var _0x1535da=_0x8117('0x57');return db['SalesforceAccount'][_0x8117('0x4f')]({'where':{'id':_0x13fa2c['params']['id']},'attributes':['id',_0x8117('0x58'),'clientId','clientSecret',_0x8117('0x59'),_0x8117('0x5a'),_0x8117('0x5b')]})['then'](handleEntityNotFound(_0x4e3952,null))['then'](function(_0x197272){if(_0x197272){_0x163b09=_0x197272[_0x8117('0x58')];var _0x11fe97=_0x163b09[_0x8117('0x5c')](-0x1);if(_0x11fe97==='/'){_0x163b09=_0x163b09['substring'](0x0,_0x163b09['lastIndexOf'](_0x11fe97));}_0x59b87d=new jsforce['Connection']({'oauth2':{'loginUrl':_0x163b09,'clientId':_0x197272[_0x8117('0x5d')],'clientSecret':_0x197272[_0x8117('0x5e')]}});return _0x59b87d[_0x8117('0x5f')](_0x197272[_0x8117('0x59')],_0x197272['password'][_0x8117('0x60')](_0x197272[_0x8117('0x5b')]));}})[_0x8117('0x27')](function(_0x34df6c){if(_0x34df6c){if(!_[_0x8117('0x61')](_0x13fa2c['query']['ticketType'])){_0x1535da=_0x13fa2c[_0x8117('0x34')][_0x8117('0x62')];}return _0x59b87d[_0x8117('0x63')](_0x1535da)[_0x8117('0x64')]();}})[_0x8117('0x27')](function(_0x277517){var _0x37108d=[_0x8117('0x65'),_0x8117('0x66'),_0x8117('0x67'),_0x8117('0x68'),_0x8117('0x69'),_0x8117('0x6a')];var _0x3aecaf=[_0x8117('0x6b'),_0x8117('0x6c'),_0x8117('0x6d'),_0x8117('0x6e'),_0x8117('0x6f'),_0x8117('0x70'),_0x8117('0x71')];if(_0x277517){_[_0x8117('0x72')](_0x277517['fields'],function(_0x306f90){return _0x37108d['includes'](_0x306f90[_0x8117('0x2a')])||!_0x3aecaf[_0x8117('0x73')](_0x306f90[_0x8117('0x31')]);});return{'count':_0x277517[_0x8117('0x39')][_0x8117('0x3a')],'rows':_[_0x8117('0x2d')](_0x277517[_0x8117('0x39')],function(_0x4f1d6b){return{'id':_0x4f1d6b['name'],'name':_0x4f1d6b['label'],'custom':_0x4f1d6b['custom'],'options':_0x4f1d6b[_0x8117('0x74')]['length']>0x0?_['map'](_0x4f1d6b[_0x8117('0x74')],function(_0x841811){return{'name':_0x841811[_0x8117('0x75')],'value':_0x841811[_0x8117('0x76')]};}):_0x4f1d6b[_0x8117('0x31')]==_0x8117('0x6e')?[{'name':_0x8117('0x77'),'value':_0x8117('0x78')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x4e3952,null))['catch'](function(_0x46a59f){var _0x2ce83e=_0x13fa2c['query']['test']?0x1f4:_0x46a59f[_0x8117('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8117('0x7a'),_0x2ce83e,JSON[_0x8117('0x7b')](_0x46a59f));delete _0x46a59f['name'];if(_0x2ce83e===0x191){_0x2ce83e=0x190;}_0x4e3952[_0x8117('0x1b')](_0x2ce83e)[_0x8117('0x2b')](_0x13fa2c[_0x8117('0x34')][_0x8117('0x7c')]?{'message':_0x8117('0x7d'),'statusCode':_0x46a59f[_0x8117('0x79')]}:_0x46a59f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 847bd2f..ac3bc41 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 _0xbde8=['exports','define','int_salesforce_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x47516e,_0x579fcc){var _0x384bcd=function(_0x4e41c7){while(--_0x4e41c7){_0x47516e['push'](_0x47516e['shift']());}};_0x384bcd(++_0x579fcc);}(_0xbde8,0x155));var _0x8bde=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xbde8[_0x351b46];return _0x1515df;};'use strict';var _=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var logger=require('../../config/logger')(_0x8bde('0x2'));var moment=require(_0x8bde('0x3'));var BPromise=require(_0x8bde('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bde('0x5'));var rimraf=require(_0x8bde('0x6'));var config=require(_0x8bde('0x7'));var attributes=require(_0x8bde('0x8'));var integrations=require(_0x8bde('0x9'));module[_0x8bde('0xa')]=function(_0x2a3965,_0x2fa161){return _0x2a3965[_0x8bde('0xb')]('SalesforceAccount',attributes,{'tableName':_0x8bde('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c2=['../../components/integrations/configuration','exports','define','SalesforceAccount','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x5ac98e,_0xd19ec){var _0x59df45=function(_0x4b7d69){while(--_0x4b7d69){_0x5ac98e['push'](_0x5ac98e['shift']());}};_0x59df45(++_0xd19ec);}(_0x21c2,0x86));var _0x221c=function(_0xfe2b6e,_0x2f49f5){_0xfe2b6e=_0xfe2b6e-0x0;var _0xf65699=_0x21c2[_0xfe2b6e];return _0xf65699;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x221c('0x0'))('api');var moment=require(_0x221c('0x1'));var BPromise=require(_0x221c('0x2'));var rp=require(_0x221c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x221c('0x4'));var attributes=require(_0x221c('0x5'));var integrations=require(_0x221c('0x6'));module[_0x221c('0x7')]=function(_0x2cd349,_0x12dff8){return _0x2cd349[_0x221c('0x8')](_0x221c('0x9'),attributes,{'tableName':'int_salesforce_accounts','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 a88d9d2..1a37640 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 _0xcc7d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','GetSalesforceAccount','catch','ShowSalesforceAccount','find','lodash','util'];(function(_0x41f868,_0x253a6a){var _0xce8ba=function(_0x1eb35f){while(--_0x1eb35f){_0x41f868['push'](_0x41f868['shift']());}};_0xce8ba(++_0x253a6a);}(_0xcc7d,0x1ae));var _0xdcc7=function(_0xa4a1e4,_0x7afc8c){_0xa4a1e4=_0xa4a1e4-0x0;var _0x1036bc=_0xcc7d[_0xa4a1e4];return _0x1036bc;};'use strict';var _=require(_0xdcc7('0x0'));var util=require(_0xdcc7('0x1'));var moment=require('moment');var BPromise=require(_0xdcc7('0x2'));var rs=require(_0xdcc7('0x3'));var fs=require('fs');var Redis=require(_0xdcc7('0x4'));var db=require(_0xdcc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcc7('0x6'))('rpc');var config=require(_0xdcc7('0x7'));var jayson=require(_0xdcc7('0x8'));var client=jayson[_0xdcc7('0x9')][_0xdcc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9f4a,_0x160fa4,_0x4f7762){return new BPromise(function(_0x3f06b0,_0x3be02a){return client[_0xdcc7('0xb')](_0x4f9f4a,_0x4f7762)[_0xdcc7('0xc')](function(_0x1c0928){logger[_0xdcc7('0xd')](_0xdcc7('0xe'),_0x160fa4,_0xdcc7('0xf'));logger['debug'](_0xdcc7('0x10'),_0x160fa4,_0xdcc7('0xf'),JSON[_0xdcc7('0x11')](_0x1c0928));if(_0x1c0928[_0xdcc7('0x12')]){if(_0x1c0928['error']['code']===0x1f4){logger[_0xdcc7('0x12')](_0xdcc7('0xe'),_0x160fa4,_0x1c0928['error'][_0xdcc7('0x13')]);return _0x3be02a(_0x1c0928[_0xdcc7('0x12')][_0xdcc7('0x13')]);}logger[_0xdcc7('0x12')](_0xdcc7('0xe'),_0x160fa4,_0x1c0928['error'][_0xdcc7('0x13')]);return _0x3f06b0(_0x1c0928[_0xdcc7('0x12')][_0xdcc7('0x13')]);}else{logger[_0xdcc7('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x160fa4,_0xdcc7('0xf'));_0x3f06b0(_0x1c0928[_0xdcc7('0x14')][_0xdcc7('0x13')]);}})['catch'](function(_0x2e4aea){logger['error'](_0xdcc7('0xe'),_0x160fa4,_0x2e4aea);_0x3be02a(_0x2e4aea);});});}exports['GetSalesforceAccount']=function(_0x289dc0){var _0x36bf3=this;return new Promise(function(_0x3ffbb8,_0x1e42e6){return db[_0xdcc7('0x15')][_0xdcc7('0x16')]({'raw':_0x289dc0[_0xdcc7('0x17')]?_0x289dc0['options'][_0xdcc7('0x18')]===undefined?!![]:![]:!![],'where':_0x289dc0['options']?_0x289dc0[_0xdcc7('0x17')][_0xdcc7('0x19')]||null:null,'attributes':_0x289dc0[_0xdcc7('0x17')]?_0x289dc0[_0xdcc7('0x17')]['attributes']||null:null,'limit':_0x289dc0[_0xdcc7('0x17')]?_0x289dc0[_0xdcc7('0x17')][_0xdcc7('0x1a')]||null:null,'include':_0x289dc0[_0xdcc7('0x17')]?_0x289dc0[_0xdcc7('0x17')][_0xdcc7('0x1b')]?_[_0xdcc7('0x1c')](_0x289dc0['options'][_0xdcc7('0x1b')],function(_0x28104b){return{'model':db[_0x28104b[_0xdcc7('0x1d')]],'as':_0x28104b['as'],'attributes':_0x28104b[_0xdcc7('0x1e')],'include':_0x28104b[_0xdcc7('0x1b')]?_[_0xdcc7('0x1c')](_0x28104b[_0xdcc7('0x1b')],function(_0x1ce7c9){return{'model':db[_0x1ce7c9[_0xdcc7('0x1d')]],'as':_0x1ce7c9['as'],'attributes':_0x1ce7c9[_0xdcc7('0x1e')],'include':_0x1ce7c9[_0xdcc7('0x1b')]?_['map'](_0x1ce7c9['include'],function(_0x1a3d61){return{'model':db[_0x1a3d61[_0xdcc7('0x1d')]],'as':_0x1a3d61['as'],'attributes':_0x1a3d61['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a2e68){logger['info']('GetSalesforceAccount',_0x289dc0);logger[_0xdcc7('0x1f')](_0xdcc7('0x20'),_0x289dc0,JSON[_0xdcc7('0x11')](_0x3a2e68));_0x3ffbb8(_0x3a2e68);})[_0xdcc7('0x21')](function(_0xb1ff05){logger['error'](_0xdcc7('0x20'),_0xb1ff05[_0xdcc7('0x13')],_0x289dc0);_0x1e42e6(_0x36bf3[_0xdcc7('0x12')](0x1f4,_0xb1ff05['message']));});});};exports[_0xdcc7('0x22')]=function(_0x19111b){var _0x169e2f=this;return new Promise(function(_0x1a1550,_0x3fffe4){return db['SalesforceAccount'][_0xdcc7('0x23')]({'raw':_0x19111b[_0xdcc7('0x17')]?_0x19111b['options'][_0xdcc7('0x18')]===undefined?!![]:![]:!![],'where':_0x19111b['options']?_0x19111b['options'][_0xdcc7('0x19')]||null:null,'attributes':_0x19111b[_0xdcc7('0x17')]?_0x19111b[_0xdcc7('0x17')]['attributes']||null:null,'include':_0x19111b[_0xdcc7('0x17')]?_0x19111b['options'][_0xdcc7('0x1b')]?_['map'](_0x19111b[_0xdcc7('0x17')][_0xdcc7('0x1b')],function(_0x51c484){return{'model':db[_0x51c484['model']],'as':_0x51c484['as'],'attributes':_0x51c484['attributes'],'include':_0x51c484[_0xdcc7('0x1b')]?_[_0xdcc7('0x1c')](_0x51c484['include'],function(_0x2de45a){return{'model':db[_0x2de45a[_0xdcc7('0x1d')]],'as':_0x2de45a['as'],'attributes':_0x2de45a[_0xdcc7('0x1e')],'include':_0x2de45a[_0xdcc7('0x1b')]?_[_0xdcc7('0x1c')](_0x2de45a[_0xdcc7('0x1b')],function(_0x5a6eb7){return{'model':db[_0x5a6eb7['model']],'as':_0x5a6eb7['as'],'attributes':_0x5a6eb7[_0xdcc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdcc7('0xc')](function(_0x17efb4){logger[_0xdcc7('0xd')](_0xdcc7('0x22'),_0x19111b);logger[_0xdcc7('0x1f')](_0xdcc7('0x22'),_0x19111b,JSON[_0xdcc7('0x11')](_0x17efb4));_0x1a1550(_0x17efb4);})[_0xdcc7('0x21')](function(_0xf6c7a2){logger[_0xdcc7('0x12')](_0xdcc7('0x22'),_0xf6c7a2['message'],_0x19111b);_0x3fffe4(_0x169e2f[_0xdcc7('0x12')](0x1f4,_0xf6c7a2[_0xdcc7('0x13')]));});});}; \ No newline at end of file +var _0x0373=['debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','raw','util','moment','bluebird','../../mysqldb','../../config/utils','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1ab5aa,_0x456d7b){var _0x3f9e51=function(_0x303518){while(--_0x303518){_0x1ab5aa['push'](_0x1ab5aa['shift']());}};_0x3f9e51(++_0x456d7b);}(_0x0373,0xf6));var _0x3037=function(_0x3364fc,_0x559233){_0x3364fc=_0x3364fc-0x0;var _0x10df36=_0x0373[_0x3364fc];return _0x10df36;};'use strict';var _=require('lodash');var util=require(_0x3037('0x0'));var moment=require(_0x3037('0x1'));var BPromise=require(_0x3037('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3037('0x3'))['db'];var utils=require(_0x3037('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3037('0x5')][_0x3037('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a99ad,_0x5944cc,_0x29b9c3){return new BPromise(function(_0x40ce42,_0x52a4ce){return client['request'](_0x4a99ad,_0x29b9c3)[_0x3037('0x7')](function(_0x2268e7){logger['info'](_0x3037('0x8'),_0x5944cc,_0x3037('0x9'));logger[_0x3037('0xa')](_0x3037('0xb'),_0x5944cc,_0x3037('0x9'),JSON[_0x3037('0xc')](_0x2268e7));if(_0x2268e7[_0x3037('0xd')]){if(_0x2268e7[_0x3037('0xd')][_0x3037('0xe')]===0x1f4){logger['error'](_0x3037('0x8'),_0x5944cc,_0x2268e7[_0x3037('0xd')][_0x3037('0xf')]);return _0x52a4ce(_0x2268e7['error'][_0x3037('0xf')]);}logger[_0x3037('0xd')](_0x3037('0x8'),_0x5944cc,_0x2268e7[_0x3037('0xd')][_0x3037('0xf')]);return _0x40ce42(_0x2268e7['error']['message']);}else{logger[_0x3037('0x10')](_0x3037('0x8'),_0x5944cc,_0x3037('0x9'));_0x40ce42(_0x2268e7[_0x3037('0x11')][_0x3037('0xf')]);}})[_0x3037('0x12')](function(_0x3e3504){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5944cc,_0x3e3504);_0x52a4ce(_0x3e3504);});});}exports[_0x3037('0x13')]=function(_0x49a8c7){var _0x1a86b7=this;return new Promise(function(_0x1a5480,_0x10dcba){return db[_0x3037('0x14')][_0x3037('0x15')]({'raw':_0x49a8c7[_0x3037('0x16')]?_0x49a8c7[_0x3037('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x49a8c7[_0x3037('0x16')]?_0x49a8c7[_0x3037('0x16')][_0x3037('0x17')]||null:null,'attributes':_0x49a8c7[_0x3037('0x16')]?_0x49a8c7['options'][_0x3037('0x18')]||null:null,'limit':_0x49a8c7[_0x3037('0x16')]?_0x49a8c7[_0x3037('0x16')][_0x3037('0x19')]||null:null,'include':_0x49a8c7[_0x3037('0x16')]?_0x49a8c7[_0x3037('0x16')][_0x3037('0x1a')]?_[_0x3037('0x1b')](_0x49a8c7[_0x3037('0x16')][_0x3037('0x1a')],function(_0x1a763b){return{'model':db[_0x1a763b[_0x3037('0x1c')]],'as':_0x1a763b['as'],'attributes':_0x1a763b[_0x3037('0x18')],'include':_0x1a763b[_0x3037('0x1a')]?_[_0x3037('0x1b')](_0x1a763b[_0x3037('0x1a')],function(_0x4ad019){return{'model':db[_0x4ad019[_0x3037('0x1c')]],'as':_0x4ad019['as'],'attributes':_0x4ad019[_0x3037('0x18')],'include':_0x4ad019['include']?_['map'](_0x4ad019['include'],function(_0x39605f){return{'model':db[_0x39605f['model']],'as':_0x39605f['as'],'attributes':_0x39605f[_0x3037('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3037('0x7')](function(_0x559a2d){logger[_0x3037('0x10')](_0x3037('0x13'),_0x49a8c7);logger[_0x3037('0xa')]('GetSalesforceAccount',_0x49a8c7,JSON[_0x3037('0xc')](_0x559a2d));_0x1a5480(_0x559a2d);})['catch'](function(_0x1b5210){logger[_0x3037('0xd')](_0x3037('0x13'),_0x1b5210[_0x3037('0xf')],_0x49a8c7);_0x10dcba(_0x1a86b7[_0x3037('0xd')](0x1f4,_0x1b5210['message']));});});};exports[_0x3037('0x1d')]=function(_0x3588ce){var _0x2633f7=this;return new Promise(function(_0x5d7c8e,_0x1326b3){return db['SalesforceAccount'][_0x3037('0x1e')]({'raw':_0x3588ce[_0x3037('0x16')]?_0x3588ce['options'][_0x3037('0x1f')]===undefined?!![]:![]:!![],'where':_0x3588ce['options']?_0x3588ce[_0x3037('0x16')]['where']||null:null,'attributes':_0x3588ce[_0x3037('0x16')]?_0x3588ce['options'][_0x3037('0x18')]||null:null,'include':_0x3588ce['options']?_0x3588ce['options'][_0x3037('0x1a')]?_[_0x3037('0x1b')](_0x3588ce[_0x3037('0x16')][_0x3037('0x1a')],function(_0x2efee5){return{'model':db[_0x2efee5[_0x3037('0x1c')]],'as':_0x2efee5['as'],'attributes':_0x2efee5[_0x3037('0x18')],'include':_0x2efee5[_0x3037('0x1a')]?_[_0x3037('0x1b')](_0x2efee5['include'],function(_0xb040dc){return{'model':db[_0xb040dc[_0x3037('0x1c')]],'as':_0xb040dc['as'],'attributes':_0xb040dc['attributes'],'include':_0xb040dc['include']?_[_0x3037('0x1b')](_0xb040dc['include'],function(_0x3569f4){return{'model':db[_0x3569f4['model']],'as':_0x3569f4['as'],'attributes':_0x3569f4[_0x3037('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3037('0x7')](function(_0x28d4c1){logger[_0x3037('0x10')]('ShowSalesforceAccount',_0x3588ce);logger[_0x3037('0xa')](_0x3037('0x1d'),_0x3588ce,JSON[_0x3037('0xc')](_0x28d4c1));_0x5d7c8e(_0x28d4c1);})['catch'](function(_0x5ab3ea){logger[_0x3037('0xd')](_0x3037('0x1d'),_0x5ab3ea[_0x3037('0xf')],_0x3588ce);_0x1326b3(_0x2633f7[_0x3037('0xd')](0x1f4,_0x5ab3ea[_0x3037('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c81e650..9d6bbb2 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdb28,0x106));var _0x8db2=function(_0x2865d8,_0x42de40){_0x2865d8=_0x2865d8-0x0;var _0x229dfd=_0xdb28[_0x2865d8];return _0x229dfd;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5c506c,_0x2218ae){var _0x5cc64a=function(_0x2c1518){while(--_0x2c1518){_0x5c506c['push'](_0x5c506c['shift']());}};_0x5cc64a(++_0x2218ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46a445,_0x3660d3){_0x46a445=_0x46a445-0x0;var _0xe3df0d=_0x5f2f[_0x46a445];return _0xe3df0d;};'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('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f9fc594..812b9e1 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 _0x4a4d=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x253498,_0x4ba257){var _0x5b7a5a=function(_0xbe404a){while(--_0xbe404a){_0x253498['push'](_0x253498['shift']());}};_0x5b7a5a(++_0x4ba257);}(_0x4a4d,0x111));var _0xd4a4=function(_0x8e2e88,_0x112b81){_0x8e2e88=_0x8e2e88-0x0;var _0x2cf053=_0x4a4d[_0x8e2e88];return _0x2cf053;};'use strict';var Sequelize=require(_0xd4a4('0x0'));module[_0xd4a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd4a4('0x2')]},'ticketType':{'type':Sequelize[_0xd4a4('0x3')](_0xd4a4('0x4'),_0xd4a4('0x5')),'defaultValue':_0xd4a4('0x4')},'moduleSearch':{'type':Sequelize[_0xd4a4('0x3')](_0xd4a4('0x6'),_0xd4a4('0x7'),_0xd4a4('0x8'),_0xd4a4('0x9'),_0xd4a4('0xa')),'defaultValue':_0xd4a4('0x6')},'moduleCreate':{'type':Sequelize[_0xd4a4('0x3')](_0xd4a4('0xb'),_0xd4a4('0x7'),'lead',_0xd4a4('0xa')),'defaultValue':_0xd4a4('0x8')},'leadId':{'type':Sequelize[_0xd4a4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd4a4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd4a4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd4a4('0x2')]}}; \ No newline at end of file +var _0x5974=['lead','account_contact_lead','account','nothing','sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x499f91,_0x86c976){var _0x8426f8=function(_0x167926){while(--_0x167926){_0x499f91['push'](_0x499f91['shift']());}};_0x8426f8(++_0x86c976);}(_0x5974,0x1d8));var _0x4597=function(_0x2b5d39,_0x55a5f2){_0x2b5d39=_0x2b5d39-0x0;var _0x3917c4=_0x5974[_0x2b5d39];return _0x3917c4;};'use strict';var Sequelize=require(_0x4597('0x0'));module[_0x4597('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4597('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x4597('0x3'),_0x4597('0x4')),'defaultValue':_0x4597('0x3')},'moduleSearch':{'type':Sequelize[_0x4597('0x5')](_0x4597('0x6'),_0x4597('0x7'),_0x4597('0x8'),_0x4597('0x9'),_0x4597('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x4597('0x5')](_0x4597('0xb'),_0x4597('0x7'),'lead','account'),'defaultValue':_0x4597('0x8')},'leadId':{'type':Sequelize[_0x4597('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4597('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x4597('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 662bd50..41d8c39 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 _0xf977=['filter','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','findOne','SalesforceField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf977,0x161));var _0x7f97=function(_0x51bcd1,_0x59c0e3){_0x51bcd1=_0x51bcd1-0x0;var _0x4b08bc=_0xf977[_0x51bcd1];return _0x4b08bc;};'use strict';var emlformat=require(_0x7f97('0x0'));var rimraf=require(_0x7f97('0x1'));var zipdir=require(_0x7f97('0x2'));var jsonpatch=require(_0x7f97('0x3'));var rp=require(_0x7f97('0x4'));var moment=require(_0x7f97('0x5'));var BPromise=require(_0x7f97('0x6'));var Mustache=require(_0x7f97('0x7'));var util=require(_0x7f97('0x8'));var path=require(_0x7f97('0x9'));var sox=require(_0x7f97('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f97('0xb'));var squel=require('squel');var crypto=require(_0x7f97('0xc'));var jsforce=require(_0x7f97('0xd'));var deskjs=require(_0x7f97('0xe'));var toCsv=require(_0x7f97('0xf'));var querystring=require(_0x7f97('0x10'));var Papa=require('papaparse');var Redis=require(_0x7f97('0x11'));var authService=require(_0x7f97('0x12'));var qs=require(_0x7f97('0x13'));var as=require(_0x7f97('0x14'));var hardwareService=require(_0x7f97('0x15'));var logger=require('../../config/logger')(_0x7f97('0x16'));var utils=require(_0x7f97('0x17'));var config=require(_0x7f97('0x18'));var licenseUtil=require(_0x7f97('0x19'));var db=require(_0x7f97('0x1a'))['db'];function respondWithStatusCode(_0x58305c,_0x14d25d){_0x14d25d=_0x14d25d||0xcc;return function(_0x20386f){if(_0x20386f){return _0x58305c[_0x7f97('0x1b')](_0x14d25d);}return _0x58305c[_0x7f97('0x1c')](_0x14d25d)[_0x7f97('0x1d')]();};}function respondWithResult(_0x286293,_0x72e7ba){_0x72e7ba=_0x72e7ba||0xc8;return function(_0x854b08){if(_0x854b08){return _0x286293['status'](_0x72e7ba)[_0x7f97('0x1e')](_0x854b08);}};}function respondWithFilteredResult(_0x851c19,_0x101206){return function(_0x1201ee){if(_0x1201ee){var _0x1ebd13=typeof _0x101206['offset']==='undefined'&&typeof _0x101206[_0x7f97('0x1f')]===_0x7f97('0x20');var _0xde56a0=_0x1201ee[_0x7f97('0x21')];var _0x54d1b8=_0x1ebd13?0x0:_0x101206['offset'];var _0x353065=_0x1ebd13?_0x1201ee[_0x7f97('0x21')]:_0x101206[_0x7f97('0x22')]+_0x101206[_0x7f97('0x1f')];var _0x130973;if(_0x353065>=_0xde56a0){_0x353065=_0xde56a0;_0x130973=0xc8;}else{_0x130973=0xce;}_0x851c19[_0x7f97('0x1c')](_0x130973);return _0x851c19[_0x7f97('0x23')](_0x7f97('0x24'),_0x54d1b8+'-'+_0x353065+'/'+_0xde56a0)[_0x7f97('0x1e')](_0x1201ee);}return null;};}function patchUpdates(_0x37dcac){return function(_0x53e2cc){try{jsonpatch[_0x7f97('0x25')](_0x53e2cc,_0x37dcac,!![]);}catch(_0x44e7eb){return BPromise[_0x7f97('0x26')](_0x44e7eb);}return _0x53e2cc['save']();};}function saveUpdates(_0x1a5f6b,_0x1b645a){return function(_0x282a4c){if(_0x282a4c){return _0x282a4c[_0x7f97('0x27')](_0x1a5f6b)[_0x7f97('0x28')](function(_0x14f793){return _0x14f793;});}return null;};}function removeEntity(_0x24f475,_0x594048){return function(_0x223be2){if(_0x223be2){return _0x223be2[_0x7f97('0x29')]()[_0x7f97('0x28')](function(){_0x24f475[_0x7f97('0x1c')](0xcc)[_0x7f97('0x1d')]();});}};}function handleEntityNotFound(_0x4eade7,_0x15e1e0){return function(_0x1a7f43){if(!_0x1a7f43){_0x4eade7[_0x7f97('0x1b')](0x194);}return _0x1a7f43;};}function handleError(_0x23c804,_0x1eadaa){_0x1eadaa=_0x1eadaa||0x1f4;return function(_0x2f588c){logger[_0x7f97('0x2a')](_0x2f588c[_0x7f97('0x2b')]);if(_0x2f588c[_0x7f97('0x2c')]){delete _0x2f588c[_0x7f97('0x2c')];}_0x23c804[_0x7f97('0x1c')](_0x1eadaa)[_0x7f97('0x2d')](_0x2f588c);};}exports[_0x7f97('0x2e')]=function(_0xe9787d,_0x473aec){var _0xf6cdf2={},_0x1f3d7a={},_0x13c5f3={'count':0x0,'rows':[]};var _0x453f2a=_[_0x7f97('0x2f')](db[_0x7f97('0x30')][_0x7f97('0x31')],function(_0x56dd07){return{'name':_0x56dd07[_0x7f97('0x32')],'type':_0x56dd07[_0x7f97('0x33')][_0x7f97('0x34')]};});_0x1f3d7a[_0x7f97('0x35')]=_[_0x7f97('0x2f')](_0x453f2a,_0x7f97('0x2c'));_0x1f3d7a['query']=_[_0x7f97('0x36')](_0xe9787d[_0x7f97('0x37')]);_0x1f3d7a[_0x7f97('0x38')]=_[_0x7f97('0x39')](_0x1f3d7a[_0x7f97('0x35')],_0x1f3d7a[_0x7f97('0x37')]);_0xf6cdf2[_0x7f97('0x3a')]=_['intersection'](_0x1f3d7a[_0x7f97('0x35')],qs['fields'](_0xe9787d[_0x7f97('0x37')][_0x7f97('0x3b')]));_0xf6cdf2[_0x7f97('0x3a')]=_0xf6cdf2['attributes'][_0x7f97('0x3c')]?_0xf6cdf2[_0x7f97('0x3a')]:_0x1f3d7a['model'];if(!_0xe9787d[_0x7f97('0x37')][_0x7f97('0x3d')](_0x7f97('0x3e'))){_0xf6cdf2[_0x7f97('0x1f')]=qs[_0x7f97('0x1f')](_0xe9787d[_0x7f97('0x37')][_0x7f97('0x1f')]);_0xf6cdf2[_0x7f97('0x22')]=qs[_0x7f97('0x22')](_0xe9787d['query'][_0x7f97('0x22')]);}_0xf6cdf2[_0x7f97('0x3f')]=qs[_0x7f97('0x40')](_0xe9787d[_0x7f97('0x37')][_0x7f97('0x40')]);_0xf6cdf2[_0x7f97('0x41')]=qs[_0x7f97('0x38')](_[_0x7f97('0x42')](_0xe9787d[_0x7f97('0x37')],_0x1f3d7a[_0x7f97('0x38')]),_0x453f2a);if(_0xe9787d[_0x7f97('0x37')][_0x7f97('0x43')]){_0xf6cdf2[_0x7f97('0x41')]=_[_0x7f97('0x44')](_0xf6cdf2[_0x7f97('0x41')],{'$or':_[_0x7f97('0x2f')](_0x453f2a,function(_0x543afb){if(_0x543afb['type']!=='VIRTUAL'){var _0x25047d={};_0x25047d[_0x543afb[_0x7f97('0x2c')]]={'$like':'%'+_0xe9787d[_0x7f97('0x37')][_0x7f97('0x43')]+'%'};return _0x25047d;}})});}_0xf6cdf2=_[_0x7f97('0x44')]({},_0xf6cdf2,_0xe9787d[_0x7f97('0x45')]);var _0x4dead3={'where':_0xf6cdf2[_0x7f97('0x41')]};return db[_0x7f97('0x30')][_0x7f97('0x21')](_0x4dead3)[_0x7f97('0x28')](function(_0x31e746){_0x13c5f3['count']=_0x31e746;if(_0xe9787d[_0x7f97('0x37')][_0x7f97('0x46')]){_0xf6cdf2[_0x7f97('0x47')]=[{'all':!![]}];}return db[_0x7f97('0x30')][_0x7f97('0x48')](_0xf6cdf2);})['then'](function(_0x4a870f){_0x13c5f3[_0x7f97('0x49')]=_0x4a870f;return _0x13c5f3;})[_0x7f97('0x28')](respondWithFilteredResult(_0x473aec,_0xf6cdf2))['catch'](handleError(_0x473aec,null));};exports['show']=function(_0x2d03ca,_0x172406){var _0x319390={'raw':![],'where':{'id':_0x2d03ca[_0x7f97('0x4a')]['id']}},_0x204248={};_0x204248[_0x7f97('0x35')]=_[_0x7f97('0x36')](db[_0x7f97('0x30')][_0x7f97('0x31')]);_0x204248[_0x7f97('0x37')]=_[_0x7f97('0x36')](_0x2d03ca['query']);_0x204248['filters']=_[_0x7f97('0x39')](_0x204248[_0x7f97('0x35')],_0x204248[_0x7f97('0x37')]);_0x319390[_0x7f97('0x3a')]=_[_0x7f97('0x39')](_0x204248['model'],qs[_0x7f97('0x3b')](_0x2d03ca[_0x7f97('0x37')][_0x7f97('0x3b')]));_0x319390[_0x7f97('0x3a')]=_0x319390[_0x7f97('0x3a')][_0x7f97('0x3c')]?_0x319390[_0x7f97('0x3a')]:_0x204248[_0x7f97('0x35')];if(_0x2d03ca[_0x7f97('0x37')][_0x7f97('0x46')]){_0x319390[_0x7f97('0x47')]=[{'all':!![]}];}_0x319390=_['merge']({},_0x319390,_0x2d03ca[_0x7f97('0x45')]);return db['SalesforceConfiguration']['find'](_0x319390)[_0x7f97('0x28')](handleEntityNotFound(_0x172406,null))[_0x7f97('0x28')](respondWithResult(_0x172406,null))[_0x7f97('0x4b')](handleError(_0x172406,null));};exports[_0x7f97('0x4c')]=function(_0x170e2f,_0x5cccc9){return db['SalesforceConfiguration'][_0x7f97('0x4c')](_0x170e2f[_0x7f97('0x4d')],{})['then'](respondWithResult(_0x5cccc9,0xc9))['catch'](handleError(_0x5cccc9,null));};exports[_0x7f97('0x27')]=function(_0xf5a00b,_0x49d47a){if(_0xf5a00b[_0x7f97('0x4d')]['id']){delete _0xf5a00b['body']['id'];}return db['SalesforceConfiguration'][_0x7f97('0x4e')]({'where':{'id':_0xf5a00b['params']['id']}})['then'](handleEntityNotFound(_0x49d47a,null))[_0x7f97('0x28')](saveUpdates(_0xf5a00b[_0x7f97('0x4d')],null))[_0x7f97('0x28')](respondWithResult(_0x49d47a,null))['catch'](handleError(_0x49d47a,null));};exports['destroy']=function(_0x3aa799,_0x29230a){return db['SalesforceConfiguration']['find']({'where':{'id':_0x3aa799[_0x7f97('0x4a')]['id']}})[_0x7f97('0x28')](handleEntityNotFound(_0x29230a,null))[_0x7f97('0x28')](removeEntity(_0x29230a,null))[_0x7f97('0x4b')](handleError(_0x29230a,null));};exports['getFields']=function(_0x45c635,_0x233b45,_0x256c1b){var _0x3b00d5={};var _0x1d195b={};var _0x749f30;var _0x4b0fff;return db['SalesforceConfiguration'][_0x7f97('0x4f')]({'where':{'id':_0x45c635[_0x7f97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x233b45,null))[_0x7f97('0x28')](function(_0x47ccbb){if(_0x47ccbb){_0x749f30=_0x47ccbb;_0x1d195b[_0x7f97('0x35')]=_[_0x7f97('0x36')](db[_0x7f97('0x50')][_0x7f97('0x31')]);_0x1d195b[_0x7f97('0x37')]=_['keys'](_0x45c635[_0x7f97('0x37')]);_0x1d195b[_0x7f97('0x38')]=_[_0x7f97('0x39')](_0x1d195b[_0x7f97('0x35')],_0x1d195b[_0x7f97('0x37')]);_0x3b00d5['attributes']=_[_0x7f97('0x39')](_0x1d195b['model'],qs['fields'](_0x45c635['query'][_0x7f97('0x3b')]));_0x3b00d5['attributes']=_0x3b00d5[_0x7f97('0x3a')][_0x7f97('0x3c')]?_0x3b00d5[_0x7f97('0x3a')]:_0x1d195b['model'];_0x3b00d5[_0x7f97('0x3f')]=qs['sort'](_0x45c635['query'][_0x7f97('0x40')]);_0x3b00d5[_0x7f97('0x41')]=qs['filters'](_[_0x7f97('0x42')](_0x45c635[_0x7f97('0x37')],_0x1d195b[_0x7f97('0x38')]));if(_0x45c635[_0x7f97('0x37')][_0x7f97('0x43')]){_0x3b00d5['where']=_[_0x7f97('0x44')](_0x3b00d5[_0x7f97('0x41')],{'$or':_[_0x7f97('0x2f')](_0x3b00d5[_0x7f97('0x3a')],function(_0x3b3657){var _0x2170f2={};_0x2170f2[_0x3b3657]={'$like':'%'+_0x45c635[_0x7f97('0x37')][_0x7f97('0x43')]+'%'};return _0x2170f2;})});}_0x3b00d5=_[_0x7f97('0x44')]({},_0x3b00d5,_0x45c635['options']);return _0x749f30[_0x7f97('0x51')](_0x3b00d5);}})[_0x7f97('0x28')](function(_0x4c9330){if(_0x4c9330){_0x4b0fff=_0x4c9330[_0x7f97('0x3c')];if(!_0x45c635[_0x7f97('0x37')]['hasOwnProperty'](_0x7f97('0x3e'))){_0x3b00d5['limit']=qs[_0x7f97('0x1f')](_0x45c635[_0x7f97('0x37')][_0x7f97('0x1f')]);_0x3b00d5['offset']=qs[_0x7f97('0x22')](_0x45c635[_0x7f97('0x37')][_0x7f97('0x22')]);}return _0x749f30['getFields'](_0x3b00d5);}})[_0x7f97('0x28')](function(_0x325130){if(_0x325130){return _0x325130?{'count':_0x4b0fff,'rows':_0x325130}:null;}})[_0x7f97('0x28')](respondWithResult(_0x233b45,null))[_0x7f97('0x4b')](handleError(_0x233b45,null));};exports[_0x7f97('0x52')]=function(_0x1b4fc3,_0x365e03,_0x2dc24d){var _0x84e9c2={};var _0x1c7b81={};var _0x589596;var _0x13d43d;return db[_0x7f97('0x30')][_0x7f97('0x4f')]({'where':{'id':_0x1b4fc3[_0x7f97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x365e03,null))[_0x7f97('0x28')](function(_0x2050d8){if(_0x2050d8){_0x589596=_0x2050d8;_0x1c7b81[_0x7f97('0x35')]=_[_0x7f97('0x36')](db[_0x7f97('0x50')][_0x7f97('0x31')]);_0x1c7b81[_0x7f97('0x37')]=_['keys'](_0x1b4fc3[_0x7f97('0x37')]);_0x1c7b81[_0x7f97('0x38')]=_[_0x7f97('0x39')](_0x1c7b81[_0x7f97('0x35')],_0x1c7b81[_0x7f97('0x37')]);_0x84e9c2[_0x7f97('0x3a')]=_[_0x7f97('0x39')](_0x1c7b81[_0x7f97('0x35')],qs['fields'](_0x1b4fc3['query']['fields']));_0x84e9c2[_0x7f97('0x3a')]=_0x84e9c2['attributes']['length']?_0x84e9c2[_0x7f97('0x3a')]:_0x1c7b81[_0x7f97('0x35')];_0x84e9c2[_0x7f97('0x3f')]=qs['sort'](_0x1b4fc3['query'][_0x7f97('0x40')]);_0x84e9c2[_0x7f97('0x41')]=qs['filters'](_[_0x7f97('0x42')](_0x1b4fc3[_0x7f97('0x37')],_0x1c7b81[_0x7f97('0x38')]));if(_0x1b4fc3[_0x7f97('0x37')][_0x7f97('0x43')]){_0x84e9c2[_0x7f97('0x41')]=_[_0x7f97('0x44')](_0x84e9c2['where'],{'$or':_[_0x7f97('0x2f')](_0x84e9c2[_0x7f97('0x3a')],function(_0x4f5c40){var _0x29d887={};_0x29d887[_0x4f5c40]={'$like':'%'+_0x1b4fc3[_0x7f97('0x37')][_0x7f97('0x43')]+'%'};return _0x29d887;})});}_0x84e9c2=_['merge']({},_0x84e9c2,_0x1b4fc3[_0x7f97('0x45')]);return _0x589596[_0x7f97('0x52')](_0x84e9c2);}})[_0x7f97('0x28')](function(_0x4bd775){if(_0x4bd775){_0x13d43d=_0x4bd775['length'];if(!_0x1b4fc3['query'][_0x7f97('0x3d')](_0x7f97('0x3e'))){_0x84e9c2[_0x7f97('0x1f')]=qs[_0x7f97('0x1f')](_0x1b4fc3[_0x7f97('0x37')][_0x7f97('0x1f')]);_0x84e9c2[_0x7f97('0x22')]=qs[_0x7f97('0x22')](_0x1b4fc3[_0x7f97('0x37')][_0x7f97('0x22')]);}return _0x589596[_0x7f97('0x52')](_0x84e9c2);}})[_0x7f97('0x28')](function(_0x5cac21){if(_0x5cac21){return _0x5cac21?{'count':_0x13d43d,'rows':_0x5cac21}:null;}})[_0x7f97('0x28')](respondWithResult(_0x365e03,null))[_0x7f97('0x4b')](handleError(_0x365e03,null));};exports[_0x7f97('0x53')]=function(_0x158385,_0x3b3204,_0x785f76){var _0x22eddc={};var _0x132e9f={};var _0x4ad550;var _0x5d2bef;return db[_0x7f97('0x30')][_0x7f97('0x4f')]({'where':{'id':_0x158385[_0x7f97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b3204,null))[_0x7f97('0x28')](function(_0xf70717){if(_0xf70717){_0x4ad550=_0xf70717;_0x132e9f['model']=_['keys'](db[_0x7f97('0x50')][_0x7f97('0x31')]);_0x132e9f[_0x7f97('0x37')]=_[_0x7f97('0x36')](_0x158385[_0x7f97('0x37')]);_0x132e9f['filters']=_[_0x7f97('0x39')](_0x132e9f[_0x7f97('0x35')],_0x132e9f[_0x7f97('0x37')]);_0x22eddc[_0x7f97('0x3a')]=_[_0x7f97('0x39')](_0x132e9f[_0x7f97('0x35')],qs[_0x7f97('0x3b')](_0x158385['query'][_0x7f97('0x3b')]));_0x22eddc[_0x7f97('0x3a')]=_0x22eddc['attributes'][_0x7f97('0x3c')]?_0x22eddc[_0x7f97('0x3a')]:_0x132e9f[_0x7f97('0x35')];_0x22eddc[_0x7f97('0x3f')]=qs[_0x7f97('0x40')](_0x158385[_0x7f97('0x37')]['sort']);_0x22eddc[_0x7f97('0x41')]=qs[_0x7f97('0x38')](_[_0x7f97('0x42')](_0x158385[_0x7f97('0x37')],_0x132e9f[_0x7f97('0x38')]));if(_0x158385[_0x7f97('0x37')]['filter']){_0x22eddc[_0x7f97('0x41')]=_[_0x7f97('0x44')](_0x22eddc['where'],{'$or':_[_0x7f97('0x2f')](_0x22eddc[_0x7f97('0x3a')],function(_0x12be15){var _0x3dc832={};_0x3dc832[_0x12be15]={'$like':'%'+_0x158385[_0x7f97('0x37')][_0x7f97('0x43')]+'%'};return _0x3dc832;})});}_0x22eddc=_[_0x7f97('0x44')]({},_0x22eddc,_0x158385[_0x7f97('0x45')]);return _0x4ad550[_0x7f97('0x53')](_0x22eddc);}})[_0x7f97('0x28')](function(_0x17ab95){if(_0x17ab95){_0x5d2bef=_0x17ab95['length'];if(!_0x158385[_0x7f97('0x37')][_0x7f97('0x3d')](_0x7f97('0x3e'))){_0x22eddc[_0x7f97('0x1f')]=qs[_0x7f97('0x1f')](_0x158385[_0x7f97('0x37')][_0x7f97('0x1f')]);_0x22eddc[_0x7f97('0x22')]=qs[_0x7f97('0x22')](_0x158385[_0x7f97('0x37')][_0x7f97('0x22')]);}return _0x4ad550[_0x7f97('0x53')](_0x22eddc);}})['then'](function(_0x19ed4b){if(_0x19ed4b){return _0x19ed4b?{'count':_0x5d2bef,'rows':_0x19ed4b}:null;}})[_0x7f97('0x28')](respondWithResult(_0x3b3204,null))[_0x7f97('0x4b')](handleError(_0x3b3204,null));}; \ No newline at end of file +var _0xa921=['catch','params','create','body','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','offset','limit','count','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','findAll'];(function(_0x799109,_0x13dfc9){var _0x51b5bb=function(_0x2041be){while(--_0x2041be){_0x799109['push'](_0x799109['shift']());}};_0x51b5bb(++_0x13dfc9);}(_0xa921,0x181));var _0x1a92=function(_0xa118a,_0x48e051){_0xa118a=_0xa118a-0x0;var _0x922eaa=_0xa921[_0xa118a];return _0x922eaa;};'use strict';var emlformat=require(_0x1a92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a92('0x1'));var jsonpatch=require(_0x1a92('0x2'));var rp=require(_0x1a92('0x3'));var moment=require(_0x1a92('0x4'));var BPromise=require(_0x1a92('0x5'));var Mustache=require(_0x1a92('0x6'));var util=require(_0x1a92('0x7'));var path=require(_0x1a92('0x8'));var sox=require('sox');var csv=require(_0x1a92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a92('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a92('0xb'));var deskjs=require(_0x1a92('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1a92('0xd'));var Papa=require(_0x1a92('0xe'));var Redis=require(_0x1a92('0xf'));var authService=require(_0x1a92('0x10'));var qs=require(_0x1a92('0x11'));var as=require(_0x1a92('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1a92('0x13'));var config=require(_0x1a92('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38c16c,_0x5281b6){_0x5281b6=_0x5281b6||0xcc;return function(_0x4ff87e){if(_0x4ff87e){return _0x38c16c['sendStatus'](_0x5281b6);}return _0x38c16c[_0x1a92('0x15')](_0x5281b6)[_0x1a92('0x16')]();};}function respondWithResult(_0x1482fb,_0x2d365f){_0x2d365f=_0x2d365f||0xc8;return function(_0x38a432){if(_0x38a432){return _0x1482fb[_0x1a92('0x15')](_0x2d365f)['json'](_0x38a432);}};}function respondWithFilteredResult(_0x102ea8,_0x246ffe){return function(_0x461968){if(_0x461968){var _0x2949fb=typeof _0x246ffe[_0x1a92('0x17')]==='undefined'&&typeof _0x246ffe[_0x1a92('0x18')]==='undefined';var _0x4a9f77=_0x461968[_0x1a92('0x19')];var _0x42e438=_0x2949fb?0x0:_0x246ffe[_0x1a92('0x17')];var _0x1d4d5e=_0x2949fb?_0x461968[_0x1a92('0x19')]:_0x246ffe[_0x1a92('0x17')]+_0x246ffe[_0x1a92('0x18')];var _0x462dcf;if(_0x1d4d5e>=_0x4a9f77){_0x1d4d5e=_0x4a9f77;_0x462dcf=0xc8;}else{_0x462dcf=0xce;}_0x102ea8[_0x1a92('0x15')](_0x462dcf);return _0x102ea8['set'](_0x1a92('0x1a'),_0x42e438+'-'+_0x1d4d5e+'/'+_0x4a9f77)[_0x1a92('0x1b')](_0x461968);}return null;};}function patchUpdates(_0x4ec04e){return function(_0x40aa52){try{jsonpatch['apply'](_0x40aa52,_0x4ec04e,!![]);}catch(_0x587a19){return BPromise[_0x1a92('0x1c')](_0x587a19);}return _0x40aa52[_0x1a92('0x1d')]();};}function saveUpdates(_0x1d4656,_0x5aafd5){return function(_0x3a67dd){if(_0x3a67dd){return _0x3a67dd[_0x1a92('0x1e')](_0x1d4656)[_0x1a92('0x1f')](function(_0x184091){return _0x184091;});}return null;};}function removeEntity(_0x20c38a,_0x41f59d){return function(_0x26fade){if(_0x26fade){return _0x26fade[_0x1a92('0x20')]()['then'](function(){_0x20c38a[_0x1a92('0x15')](0xcc)[_0x1a92('0x16')]();});}};}function handleEntityNotFound(_0x4cd189,_0x10cd98){return function(_0x468504){if(!_0x468504){_0x4cd189[_0x1a92('0x21')](0x194);}return _0x468504;};}function handleError(_0x3763b9,_0x34b316){_0x34b316=_0x34b316||0x1f4;return function(_0x13dc25){logger[_0x1a92('0x22')](_0x13dc25[_0x1a92('0x23')]);if(_0x13dc25[_0x1a92('0x24')]){delete _0x13dc25[_0x1a92('0x24')];}_0x3763b9[_0x1a92('0x15')](_0x34b316)[_0x1a92('0x25')](_0x13dc25);};}exports[_0x1a92('0x26')]=function(_0x2c2149,_0x536790){var _0x188eca={},_0xddea72={},_0x44b63c={'count':0x0,'rows':[]};var _0x4acf84=_[_0x1a92('0x27')](db['SalesforceConfiguration'][_0x1a92('0x28')],function(_0x3d93c2){return{'name':_0x3d93c2[_0x1a92('0x29')],'type':_0x3d93c2[_0x1a92('0x2a')][_0x1a92('0x2b')]};});_0xddea72[_0x1a92('0x2c')]=_[_0x1a92('0x27')](_0x4acf84,'name');_0xddea72[_0x1a92('0x2d')]=_[_0x1a92('0x2e')](_0x2c2149[_0x1a92('0x2d')]);_0xddea72['filters']=_[_0x1a92('0x2f')](_0xddea72['model'],_0xddea72[_0x1a92('0x2d')]);_0x188eca['attributes']=_['intersection'](_0xddea72[_0x1a92('0x2c')],qs[_0x1a92('0x30')](_0x2c2149[_0x1a92('0x2d')][_0x1a92('0x30')]));_0x188eca[_0x1a92('0x31')]=_0x188eca[_0x1a92('0x31')][_0x1a92('0x32')]?_0x188eca['attributes']:_0xddea72[_0x1a92('0x2c')];if(!_0x2c2149[_0x1a92('0x2d')][_0x1a92('0x33')](_0x1a92('0x34'))){_0x188eca[_0x1a92('0x18')]=qs[_0x1a92('0x18')](_0x2c2149['query'][_0x1a92('0x18')]);_0x188eca['offset']=qs[_0x1a92('0x17')](_0x2c2149[_0x1a92('0x2d')][_0x1a92('0x17')]);}_0x188eca[_0x1a92('0x35')]=qs[_0x1a92('0x36')](_0x2c2149['query'][_0x1a92('0x36')]);_0x188eca['where']=qs['filters'](_[_0x1a92('0x37')](_0x2c2149['query'],_0xddea72[_0x1a92('0x38')]),_0x4acf84);if(_0x2c2149[_0x1a92('0x2d')][_0x1a92('0x39')]){_0x188eca[_0x1a92('0x3a')]=_[_0x1a92('0x3b')](_0x188eca[_0x1a92('0x3a')],{'$or':_[_0x1a92('0x27')](_0x4acf84,function(_0x4ab968){if(_0x4ab968[_0x1a92('0x2a')]!==_0x1a92('0x3c')){var _0x3dc1cc={};_0x3dc1cc[_0x4ab968[_0x1a92('0x24')]]={'$like':'%'+_0x2c2149[_0x1a92('0x2d')]['filter']+'%'};return _0x3dc1cc;}})});}_0x188eca=_['merge']({},_0x188eca,_0x2c2149[_0x1a92('0x3d')]);var _0x2ad1ee={'where':_0x188eca['where']};return db[_0x1a92('0x3e')][_0x1a92('0x19')](_0x2ad1ee)[_0x1a92('0x1f')](function(_0x71d19){_0x44b63c['count']=_0x71d19;if(_0x2c2149[_0x1a92('0x2d')][_0x1a92('0x3f')]){_0x188eca['include']=[{'all':!![]}];}return db[_0x1a92('0x3e')][_0x1a92('0x40')](_0x188eca);})[_0x1a92('0x1f')](function(_0x511b54){_0x44b63c['rows']=_0x511b54;return _0x44b63c;})[_0x1a92('0x1f')](respondWithFilteredResult(_0x536790,_0x188eca))[_0x1a92('0x41')](handleError(_0x536790,null));};exports['show']=function(_0x2fee6d,_0x1f2f7e){var _0x4553d5={'raw':![],'where':{'id':_0x2fee6d[_0x1a92('0x42')]['id']}},_0x46c37c={};_0x46c37c[_0x1a92('0x2c')]=_['keys'](db[_0x1a92('0x3e')][_0x1a92('0x28')]);_0x46c37c[_0x1a92('0x2d')]=_[_0x1a92('0x2e')](_0x2fee6d[_0x1a92('0x2d')]);_0x46c37c[_0x1a92('0x38')]=_[_0x1a92('0x2f')](_0x46c37c[_0x1a92('0x2c')],_0x46c37c[_0x1a92('0x2d')]);_0x4553d5[_0x1a92('0x31')]=_['intersection'](_0x46c37c['model'],qs[_0x1a92('0x30')](_0x2fee6d['query'][_0x1a92('0x30')]));_0x4553d5[_0x1a92('0x31')]=_0x4553d5[_0x1a92('0x31')][_0x1a92('0x32')]?_0x4553d5[_0x1a92('0x31')]:_0x46c37c['model'];if(_0x2fee6d['query'][_0x1a92('0x3f')]){_0x4553d5['include']=[{'all':!![]}];}_0x4553d5=_[_0x1a92('0x3b')]({},_0x4553d5,_0x2fee6d['options']);return db[_0x1a92('0x3e')]['find'](_0x4553d5)[_0x1a92('0x1f')](handleEntityNotFound(_0x1f2f7e,null))[_0x1a92('0x1f')](respondWithResult(_0x1f2f7e,null))[_0x1a92('0x41')](handleError(_0x1f2f7e,null));};exports[_0x1a92('0x43')]=function(_0x1c1b2e,_0x318384){return db['SalesforceConfiguration']['create'](_0x1c1b2e[_0x1a92('0x44')],{})[_0x1a92('0x1f')](respondWithResult(_0x318384,0xc9))[_0x1a92('0x41')](handleError(_0x318384,null));};exports['update']=function(_0x1869f7,_0x130453){if(_0x1869f7[_0x1a92('0x44')]['id']){delete _0x1869f7[_0x1a92('0x44')]['id'];}return db[_0x1a92('0x3e')][_0x1a92('0x45')]({'where':{'id':_0x1869f7['params']['id']}})['then'](handleEntityNotFound(_0x130453,null))[_0x1a92('0x1f')](saveUpdates(_0x1869f7[_0x1a92('0x44')],null))[_0x1a92('0x1f')](respondWithResult(_0x130453,null))[_0x1a92('0x41')](handleError(_0x130453,null));};exports[_0x1a92('0x20')]=function(_0x139b92,_0x4aded4){return db[_0x1a92('0x3e')][_0x1a92('0x45')]({'where':{'id':_0x139b92['params']['id']}})[_0x1a92('0x1f')](handleEntityNotFound(_0x4aded4,null))[_0x1a92('0x1f')](removeEntity(_0x4aded4,null))['catch'](handleError(_0x4aded4,null));};exports[_0x1a92('0x46')]=function(_0x2cf59a,_0x48eac4,_0x4c824c){var _0x93d240={};var _0xf9ee1a={};var _0x4ad33f;var _0x28d23c;return db[_0x1a92('0x3e')][_0x1a92('0x47')]({'where':{'id':_0x2cf59a[_0x1a92('0x42')]['id']}})[_0x1a92('0x1f')](handleEntityNotFound(_0x48eac4,null))[_0x1a92('0x1f')](function(_0x3c7989){if(_0x3c7989){_0x4ad33f=_0x3c7989;_0xf9ee1a[_0x1a92('0x2c')]=_[_0x1a92('0x2e')](db[_0x1a92('0x48')]['rawAttributes']);_0xf9ee1a['query']=_['keys'](_0x2cf59a[_0x1a92('0x2d')]);_0xf9ee1a['filters']=_[_0x1a92('0x2f')](_0xf9ee1a['model'],_0xf9ee1a[_0x1a92('0x2d')]);_0x93d240[_0x1a92('0x31')]=_[_0x1a92('0x2f')](_0xf9ee1a[_0x1a92('0x2c')],qs['fields'](_0x2cf59a[_0x1a92('0x2d')][_0x1a92('0x30')]));_0x93d240['attributes']=_0x93d240[_0x1a92('0x31')][_0x1a92('0x32')]?_0x93d240[_0x1a92('0x31')]:_0xf9ee1a[_0x1a92('0x2c')];_0x93d240[_0x1a92('0x35')]=qs[_0x1a92('0x36')](_0x2cf59a[_0x1a92('0x2d')][_0x1a92('0x36')]);_0x93d240[_0x1a92('0x3a')]=qs[_0x1a92('0x38')](_['pick'](_0x2cf59a['query'],_0xf9ee1a[_0x1a92('0x38')]));if(_0x2cf59a[_0x1a92('0x2d')][_0x1a92('0x39')]){_0x93d240[_0x1a92('0x3a')]=_[_0x1a92('0x3b')](_0x93d240['where'],{'$or':_[_0x1a92('0x27')](_0x93d240[_0x1a92('0x31')],function(_0x3f6bf0){var _0x5e02e1={};_0x5e02e1[_0x3f6bf0]={'$like':'%'+_0x2cf59a[_0x1a92('0x2d')][_0x1a92('0x39')]+'%'};return _0x5e02e1;})});}_0x93d240=_[_0x1a92('0x3b')]({},_0x93d240,_0x2cf59a[_0x1a92('0x3d')]);return _0x4ad33f[_0x1a92('0x46')](_0x93d240);}})[_0x1a92('0x1f')](function(_0x34f435){if(_0x34f435){_0x28d23c=_0x34f435[_0x1a92('0x32')];if(!_0x2cf59a[_0x1a92('0x2d')]['hasOwnProperty'](_0x1a92('0x34'))){_0x93d240[_0x1a92('0x18')]=qs[_0x1a92('0x18')](_0x2cf59a[_0x1a92('0x2d')][_0x1a92('0x18')]);_0x93d240[_0x1a92('0x17')]=qs[_0x1a92('0x17')](_0x2cf59a['query']['offset']);}return _0x4ad33f[_0x1a92('0x46')](_0x93d240);}})['then'](function(_0x5351b7){if(_0x5351b7){return _0x5351b7?{'count':_0x28d23c,'rows':_0x5351b7}:null;}})[_0x1a92('0x1f')](respondWithResult(_0x48eac4,null))['catch'](handleError(_0x48eac4,null));};exports[_0x1a92('0x49')]=function(_0x1f5b3a,_0x13593a,_0x446fdf){var _0x10f18c={};var _0x1b4e2a={};var _0x261c03;var _0x53fdbe;return db[_0x1a92('0x3e')][_0x1a92('0x47')]({'where':{'id':_0x1f5b3a[_0x1a92('0x42')]['id']}})[_0x1a92('0x1f')](handleEntityNotFound(_0x13593a,null))[_0x1a92('0x1f')](function(_0x225ac0){if(_0x225ac0){_0x261c03=_0x225ac0;_0x1b4e2a[_0x1a92('0x2c')]=_['keys'](db[_0x1a92('0x48')][_0x1a92('0x28')]);_0x1b4e2a[_0x1a92('0x2d')]=_[_0x1a92('0x2e')](_0x1f5b3a[_0x1a92('0x2d')]);_0x1b4e2a[_0x1a92('0x38')]=_[_0x1a92('0x2f')](_0x1b4e2a[_0x1a92('0x2c')],_0x1b4e2a[_0x1a92('0x2d')]);_0x10f18c[_0x1a92('0x31')]=_[_0x1a92('0x2f')](_0x1b4e2a['model'],qs[_0x1a92('0x30')](_0x1f5b3a[_0x1a92('0x2d')][_0x1a92('0x30')]));_0x10f18c[_0x1a92('0x31')]=_0x10f18c[_0x1a92('0x31')][_0x1a92('0x32')]?_0x10f18c[_0x1a92('0x31')]:_0x1b4e2a[_0x1a92('0x2c')];_0x10f18c[_0x1a92('0x35')]=qs[_0x1a92('0x36')](_0x1f5b3a['query']['sort']);_0x10f18c['where']=qs['filters'](_[_0x1a92('0x37')](_0x1f5b3a[_0x1a92('0x2d')],_0x1b4e2a[_0x1a92('0x38')]));if(_0x1f5b3a[_0x1a92('0x2d')][_0x1a92('0x39')]){_0x10f18c[_0x1a92('0x3a')]=_[_0x1a92('0x3b')](_0x10f18c['where'],{'$or':_[_0x1a92('0x27')](_0x10f18c['attributes'],function(_0x1fe386){var _0x546678={};_0x546678[_0x1fe386]={'$like':'%'+_0x1f5b3a['query']['filter']+'%'};return _0x546678;})});}_0x10f18c=_[_0x1a92('0x3b')]({},_0x10f18c,_0x1f5b3a[_0x1a92('0x3d')]);return _0x261c03['getSubjects'](_0x10f18c);}})[_0x1a92('0x1f')](function(_0x240665){if(_0x240665){_0x53fdbe=_0x240665['length'];if(!_0x1f5b3a[_0x1a92('0x2d')][_0x1a92('0x33')](_0x1a92('0x34'))){_0x10f18c['limit']=qs['limit'](_0x1f5b3a['query'][_0x1a92('0x18')]);_0x10f18c[_0x1a92('0x17')]=qs[_0x1a92('0x17')](_0x1f5b3a['query'][_0x1a92('0x17')]);}return _0x261c03[_0x1a92('0x49')](_0x10f18c);}})[_0x1a92('0x1f')](function(_0xfbead5){if(_0xfbead5){return _0xfbead5?{'count':_0x53fdbe,'rows':_0xfbead5}:null;}})[_0x1a92('0x1f')](respondWithResult(_0x13593a,null))[_0x1a92('0x41')](handleError(_0x13593a,null));};exports[_0x1a92('0x4a')]=function(_0x3f43af,_0x27a3b5,_0x37ab4d){var _0x198766={};var _0x4880c1={};var _0x32dab4;var _0x4a5ceb;return db[_0x1a92('0x3e')][_0x1a92('0x47')]({'where':{'id':_0x3f43af['params']['id']}})['then'](handleEntityNotFound(_0x27a3b5,null))[_0x1a92('0x1f')](function(_0x3e9be1){if(_0x3e9be1){_0x32dab4=_0x3e9be1;_0x4880c1[_0x1a92('0x2c')]=_[_0x1a92('0x2e')](db[_0x1a92('0x48')][_0x1a92('0x28')]);_0x4880c1['query']=_['keys'](_0x3f43af[_0x1a92('0x2d')]);_0x4880c1['filters']=_[_0x1a92('0x2f')](_0x4880c1[_0x1a92('0x2c')],_0x4880c1[_0x1a92('0x2d')]);_0x198766[_0x1a92('0x31')]=_[_0x1a92('0x2f')](_0x4880c1[_0x1a92('0x2c')],qs[_0x1a92('0x30')](_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x30')]));_0x198766[_0x1a92('0x31')]=_0x198766[_0x1a92('0x31')][_0x1a92('0x32')]?_0x198766[_0x1a92('0x31')]:_0x4880c1[_0x1a92('0x2c')];_0x198766[_0x1a92('0x35')]=qs[_0x1a92('0x36')](_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x36')]);_0x198766[_0x1a92('0x3a')]=qs[_0x1a92('0x38')](_[_0x1a92('0x37')](_0x3f43af[_0x1a92('0x2d')],_0x4880c1[_0x1a92('0x38')]));if(_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x39')]){_0x198766[_0x1a92('0x3a')]=_['merge'](_0x198766[_0x1a92('0x3a')],{'$or':_[_0x1a92('0x27')](_0x198766[_0x1a92('0x31')],function(_0x179c9e){var _0x33a996={};_0x33a996[_0x179c9e]={'$like':'%'+_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x39')]+'%'};return _0x33a996;})});}_0x198766=_['merge']({},_0x198766,_0x3f43af[_0x1a92('0x3d')]);return _0x32dab4['getDescriptions'](_0x198766);}})[_0x1a92('0x1f')](function(_0x1ca099){if(_0x1ca099){_0x4a5ceb=_0x1ca099['length'];if(!_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x33')]('nolimit')){_0x198766[_0x1a92('0x18')]=qs[_0x1a92('0x18')](_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x18')]);_0x198766[_0x1a92('0x17')]=qs[_0x1a92('0x17')](_0x3f43af[_0x1a92('0x2d')][_0x1a92('0x17')]);}return _0x32dab4[_0x1a92('0x4a')](_0x198766);}})[_0x1a92('0x1f')](function(_0x5dce2b){if(_0x5dce2b){return _0x5dce2b?{'count':_0x4a5ceb,'rows':_0x5dce2b}:null;}})['then'](respondWithResult(_0x27a3b5,null))[_0x1a92('0x41')](handleError(_0x27a3b5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 64637ba..59deddd 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 _0xacc7=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xacc7,0xf1));var _0x7acc=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0xacc7[_0x5a2291];return _0x10e3f5;};'use strict';var _=require(_0x7acc('0x0'));var util=require(_0x7acc('0x1'));var logger=require(_0x7acc('0x2'))(_0x7acc('0x3'));var moment=require(_0x7acc('0x4'));var BPromise=require(_0x7acc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7acc('0x6'));module[_0x7acc('0x7')]=function(_0x3911bf,_0x1435bd){return _0x3911bf['define'](_0x7acc('0x8'),attributes,{'tableName':_0x7acc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61e3=['util','../../config/logger','api','moment','bluebird','request-promise','path','define','int_salesforce_configurations'];(function(_0x472935,_0x5805db){var _0x3a68ee=function(_0x4abb83){while(--_0x4abb83){_0x472935['push'](_0x472935['shift']());}};_0x3a68ee(++_0x5805db);}(_0x61e3,0x17a));var _0x361e=function(_0x24250b,_0x1198b8){_0x24250b=_0x24250b-0x0;var _0x2e7349=_0x61e3[_0x24250b];return _0x2e7349;};'use strict';var _=require('lodash');var util=require(_0x361e('0x0'));var logger=require(_0x361e('0x1'))(_0x361e('0x2'));var moment=require(_0x361e('0x3'));var BPromise=require(_0x361e('0x4'));var rp=require(_0x361e('0x5'));var fs=require('fs');var path=require(_0x361e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x547c49,_0x3cf8b){return _0x547c49[_0x361e('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0x361e('0x8'),'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 aa81bbd..50a8c16 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 _0xaed3=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5423d6,_0x21af16){var _0x14b02f=function(_0x400ae1){while(--_0x400ae1){_0x5423d6['push'](_0x5423d6['shift']());}};_0x14b02f(++_0x21af16);}(_0xaed3,0x13d));var _0x3aed=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xaed3[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x3aed('0x0'));var util=require(_0x3aed('0x1'));var moment=require(_0x3aed('0x2'));var BPromise=require(_0x3aed('0x3'));var rs=require(_0x3aed('0x4'));var fs=require('fs');var Redis=require(_0x3aed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3aed('0x6'));var logger=require(_0x3aed('0x7'))(_0x3aed('0x8'));var config=require(_0x3aed('0x9'));var jayson=require(_0x3aed('0xa'));var client=jayson[_0x3aed('0xb')][_0x3aed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22c6ad,_0x196f79,_0x53f61e){return new BPromise(function(_0x4c4d38,_0x10fe06){return client['request'](_0x22c6ad,_0x53f61e)[_0x3aed('0xd')](function(_0x5ab074){logger[_0x3aed('0xe')](_0x3aed('0xf'),_0x196f79,'request\x20sent');logger[_0x3aed('0x10')](_0x3aed('0x11'),_0x196f79,_0x3aed('0x12'),JSON[_0x3aed('0x13')](_0x5ab074));if(_0x5ab074[_0x3aed('0x14')]){if(_0x5ab074[_0x3aed('0x14')][_0x3aed('0x15')]===0x1f4){logger['error'](_0x3aed('0xf'),_0x196f79,_0x5ab074[_0x3aed('0x14')][_0x3aed('0x16')]);return _0x10fe06(_0x5ab074[_0x3aed('0x14')][_0x3aed('0x16')]);}logger[_0x3aed('0x14')](_0x3aed('0xf'),_0x196f79,_0x5ab074[_0x3aed('0x14')][_0x3aed('0x16')]);return _0x4c4d38(_0x5ab074[_0x3aed('0x14')][_0x3aed('0x16')]);}else{logger['info'](_0x3aed('0xf'),_0x196f79,_0x3aed('0x12'));_0x4c4d38(_0x5ab074['result'][_0x3aed('0x16')]);}})[_0x3aed('0x17')](function(_0x1ba4ef){logger[_0x3aed('0x14')](_0x3aed('0xf'),_0x196f79,_0x1ba4ef);_0x10fe06(_0x1ba4ef);});});} \ No newline at end of file +var _0x5d12=['request','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','code','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x409a0c,_0x288157){var _0x4faf41=function(_0x4029bf){while(--_0x4029bf){_0x409a0c['push'](_0x409a0c['shift']());}};_0x4faf41(++_0x288157);}(_0x5d12,0xdc));var _0x25d1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5d12[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x25d1('0x0'));var util=require(_0x25d1('0x1'));var moment=require(_0x25d1('0x2'));var BPromise=require(_0x25d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25d1('0x4'));var db=require(_0x25d1('0x5'))['db'];var utils=require(_0x25d1('0x6'));var logger=require(_0x25d1('0x7'))(_0x25d1('0x8'));var config=require('../../config/environment');var jayson=require(_0x25d1('0x9'));var client=jayson['client'][_0x25d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f465f,_0x5883e8,_0x53ff51){return new BPromise(function(_0x6af230,_0x2d98f5){return client[_0x25d1('0xb')](_0x5f465f,_0x53ff51)[_0x25d1('0xc')](function(_0x527d5b){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5883e8,_0x25d1('0xd'));logger['debug'](_0x25d1('0xe'),_0x5883e8,_0x25d1('0xd'),JSON['stringify'](_0x527d5b));if(_0x527d5b['error']){if(_0x527d5b['error'][_0x25d1('0xf')]===0x1f4){logger[_0x25d1('0x10')](_0x25d1('0x11'),_0x5883e8,_0x527d5b[_0x25d1('0x10')]['message']);return _0x2d98f5(_0x527d5b[_0x25d1('0x10')][_0x25d1('0x12')]);}logger[_0x25d1('0x10')](_0x25d1('0x11'),_0x5883e8,_0x527d5b[_0x25d1('0x10')][_0x25d1('0x12')]);return _0x6af230(_0x527d5b[_0x25d1('0x10')][_0x25d1('0x12')]);}else{logger[_0x25d1('0x13')](_0x25d1('0x11'),_0x5883e8,'request\x20sent');_0x6af230(_0x527d5b['result']['message']);}})[_0x25d1('0x14')](function(_0x2f509d){logger[_0x25d1('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5883e8,_0x2f509d);_0x2d98f5(_0x2f509d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 765c40f..a29409e 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 _0xef9d=['../../components/interaction/service','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x34f950,_0x1ce5b9){var _0x593002=function(_0x3f129a){while(--_0x3f129a){_0x34f950['push'](_0x34f950['shift']());}};_0x593002(++_0x1ce5b9);}(_0xef9d,0x1de));var _0xdef9=function(_0x1d0487,_0x24e562){_0x1d0487=_0x1d0487-0x0;var _0x2d3823=_0xef9d[_0x1d0487];return _0x2d3823;};'use strict';var multer=require(_0xdef9('0x0'));var util=require(_0xdef9('0x1'));var path=require(_0xdef9('0x2'));var timeout=require(_0xdef9('0x3'));var express=require(_0xdef9('0x4'));var router=express[_0xdef9('0x5')]();var fs_extra=require(_0xdef9('0x6'));var auth=require(_0xdef9('0x7'));var interaction=require(_0xdef9('0x8'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xdef9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdef9('0x9')](_0xdef9('0xa'),auth[_0xdef9('0xb')](),controller['show']);router[_0xdef9('0xc')]('/',auth[_0xdef9('0xb')](),controller[_0xdef9('0xd')]);router[_0xdef9('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdef9('0xf')]('/:id',auth[_0xdef9('0xb')](),controller[_0xdef9('0x10')]);module[_0xdef9('0x11')]=router; \ No newline at end of file +var _0x0742=['get','/:id','isAuthenticated','show','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','index'];(function(_0xf38066,_0x2fe205){var _0x536e6a=function(_0x399948){while(--_0x399948){_0xf38066['push'](_0xf38066['shift']());}};_0x536e6a(++_0x2fe205);}(_0x0742,0x187));var _0x2074=function(_0x249f8c,_0xfb3946){_0x249f8c=_0x249f8c-0x0;var _0x5e224a=_0x0742[_0x249f8c];return _0x5e224a;};'use strict';var multer=require(_0x2074('0x0'));var util=require(_0x2074('0x1'));var path=require(_0x2074('0x2'));var timeout=require(_0x2074('0x3'));var express=require(_0x2074('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2074('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2074('0x6'));var controller=require(_0x2074('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2074('0x8')]);router[_0x2074('0x9')](_0x2074('0xa'),auth[_0x2074('0xb')](),controller[_0x2074('0xc')]);router['post']('/',auth[_0x2074('0xb')](),controller['create']);router[_0x2074('0xd')](_0x2074('0xa'),auth[_0x2074('0xb')](),controller['update']);router[_0x2074('0xe')]('/:id',auth[_0x2074('0xb')](),controller[_0x2074('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2102b4b..3d05871 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 _0x9eb6=['ENUM','string','variable','picklist','STRING','sequelize','exports'];(function(_0x4e5d67,_0x54dffc){var _0x4acdf3=function(_0x53e5a3){while(--_0x53e5a3){_0x4e5d67['push'](_0x4e5d67['shift']());}};_0x4acdf3(++_0x54dffc);}(_0x9eb6,0xde));var _0x69eb=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x9eb6[_0x59bcb1];return _0x4a737f;};'use strict';var Sequelize=require(_0x69eb('0x0'));module[_0x69eb('0x1')]={'type':{'type':Sequelize[_0x69eb('0x2')](_0x69eb('0x3'),_0x69eb('0x4'),'customVariable','keyValue',_0x69eb('0x5')),'defaultValue':_0x69eb('0x3')},'content':{'type':Sequelize[_0x69eb('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x69eb('0x2')](_0x69eb('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x69eb('0x6')]},'idField':{'type':Sequelize[_0x69eb('0x6')]},'variableName':{'type':Sequelize[_0x69eb('0x6')]}}; \ No newline at end of file +var _0x9ce9=['exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable','sequelize'];(function(_0x58b675,_0x299036){var _0x543148=function(_0x1c0bbc){while(--_0x1c0bbc){_0x58b675['push'](_0x58b675['shift']());}};_0x543148(++_0x299036);}(_0x9ce9,0x131));var _0x99ce=function(_0x38b44b,_0x31ea96){_0x38b44b=_0x38b44b-0x0;var _0x3bce1a=_0x9ce9[_0x38b44b];return _0x3bce1a;};'use strict';var Sequelize=require(_0x99ce('0x0'));module[_0x99ce('0x1')]={'type':{'type':Sequelize[_0x99ce('0x2')]('string',_0x99ce('0x3'),'customVariable',_0x99ce('0x4'),_0x99ce('0x5')),'defaultValue':_0x99ce('0x6')},'content':{'type':Sequelize[_0x99ce('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x99ce('0x2')](_0x99ce('0x6'),_0x99ce('0x3'),_0x99ce('0x8'))},'keyContent':{'type':Sequelize[_0x99ce('0x7')]},'idField':{'type':Sequelize[_0x99ce('0x7')]},'variableName':{'type':Sequelize[_0x99ce('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f36e6d5..bb378f6 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 _0xb81a=['SalesforceField','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','send','map'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xb81a,0x133));var _0xab81=function(_0x1b9464,_0x9c4cab){_0x1b9464=_0x1b9464-0x0;var _0x5bdf8e=_0xb81a[_0x1b9464];return _0x5bdf8e;};'use strict';var emlformat=require(_0xab81('0x0'));var rimraf=require(_0xab81('0x1'));var zipdir=require(_0xab81('0x2'));var jsonpatch=require(_0xab81('0x3'));var rp=require(_0xab81('0x4'));var moment=require(_0xab81('0x5'));var BPromise=require(_0xab81('0x6'));var Mustache=require('mustache');var util=require(_0xab81('0x7'));var path=require(_0xab81('0x8'));var sox=require('sox');var csv=require(_0xab81('0x9'));var ejs=require(_0xab81('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab81('0xb'));var squel=require(_0xab81('0xc'));var crypto=require(_0xab81('0xd'));var jsforce=require(_0xab81('0xe'));var deskjs=require(_0xab81('0xf'));var toCsv=require(_0xab81('0x9'));var querystring=require(_0xab81('0x10'));var Papa=require(_0xab81('0x11'));var Redis=require(_0xab81('0x12'));var authService=require(_0xab81('0x13'));var qs=require(_0xab81('0x14'));var as=require(_0xab81('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab81('0x16'));var utils=require(_0xab81('0x17'));var config=require(_0xab81('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d12f,_0x144500){_0x144500=_0x144500||0xcc;return function(_0x556e28){if(_0x556e28){return _0x27d12f[_0xab81('0x19')](_0x144500);}return _0x27d12f[_0xab81('0x1a')](_0x144500)[_0xab81('0x1b')]();};}function respondWithResult(_0x587f4d,_0x2c5564){_0x2c5564=_0x2c5564||0xc8;return function(_0x153dc1){if(_0x153dc1){return _0x587f4d[_0xab81('0x1a')](_0x2c5564)[_0xab81('0x1c')](_0x153dc1);}};}function respondWithFilteredResult(_0x5e8f24,_0x27f11e){return function(_0x10bf0d){if(_0x10bf0d){var _0x24f221=typeof _0x27f11e[_0xab81('0x1d')]===_0xab81('0x1e')&&typeof _0x27f11e[_0xab81('0x1f')]===_0xab81('0x1e');var _0x118404=_0x10bf0d['count'];var _0x5bdcbe=_0x24f221?0x0:_0x27f11e[_0xab81('0x1d')];var _0x1f749d=_0x24f221?_0x10bf0d[_0xab81('0x20')]:_0x27f11e[_0xab81('0x1d')]+_0x27f11e[_0xab81('0x1f')];var _0x163386;if(_0x1f749d>=_0x118404){_0x1f749d=_0x118404;_0x163386=0xc8;}else{_0x163386=0xce;}_0x5e8f24[_0xab81('0x1a')](_0x163386);return _0x5e8f24[_0xab81('0x21')](_0xab81('0x22'),_0x5bdcbe+'-'+_0x1f749d+'/'+_0x118404)['json'](_0x10bf0d);}return null;};}function patchUpdates(_0x3144f9){return function(_0x17dc6f){try{jsonpatch[_0xab81('0x23')](_0x17dc6f,_0x3144f9,!![]);}catch(_0xb1596a){return BPromise[_0xab81('0x24')](_0xb1596a);}return _0x17dc6f['save']();};}function saveUpdates(_0x31968a,_0x17cab6){return function(_0x7930f8){if(_0x7930f8){return _0x7930f8[_0xab81('0x25')](_0x31968a)[_0xab81('0x26')](function(_0x8fd1c5){return _0x8fd1c5;});}return null;};}function removeEntity(_0x4a1557,_0x57f3d4){return function(_0x5c34c5){if(_0x5c34c5){return _0x5c34c5[_0xab81('0x27')]()[_0xab81('0x26')](function(){_0x4a1557['status'](0xcc)[_0xab81('0x1b')]();});}};}function handleEntityNotFound(_0x4ce55d,_0x9b812d){return function(_0x574c9d){if(!_0x574c9d){_0x4ce55d[_0xab81('0x19')](0x194);}return _0x574c9d;};}function handleError(_0x2fea7b,_0x5b1cf3){_0x5b1cf3=_0x5b1cf3||0x1f4;return function(_0x3d38f1){logger[_0xab81('0x28')](_0x3d38f1['stack']);if(_0x3d38f1['name']){delete _0x3d38f1['name'];}_0x2fea7b[_0xab81('0x1a')](_0x5b1cf3)[_0xab81('0x29')](_0x3d38f1);};}exports['index']=function(_0x20eccd,_0x4f5c6c){var _0x573864={},_0xa6d87f={},_0x477771={'count':0x0,'rows':[]};var _0x2e8b8e=_[_0xab81('0x2a')](db[_0xab81('0x2b')][_0xab81('0x2c')],function(_0x5bc2ef){return{'name':_0x5bc2ef['fieldName'],'type':_0x5bc2ef[_0xab81('0x2d')][_0xab81('0x2e')]};});_0xa6d87f[_0xab81('0x2f')]=_[_0xab81('0x2a')](_0x2e8b8e,_0xab81('0x30'));_0xa6d87f[_0xab81('0x31')]=_['keys'](_0x20eccd[_0xab81('0x31')]);_0xa6d87f[_0xab81('0x32')]=_[_0xab81('0x33')](_0xa6d87f[_0xab81('0x2f')],_0xa6d87f[_0xab81('0x31')]);_0x573864[_0xab81('0x34')]=_['intersection'](_0xa6d87f[_0xab81('0x2f')],qs['fields'](_0x20eccd[_0xab81('0x31')][_0xab81('0x35')]));_0x573864['attributes']=_0x573864[_0xab81('0x34')]['length']?_0x573864[_0xab81('0x34')]:_0xa6d87f['model'];if(!_0x20eccd[_0xab81('0x31')][_0xab81('0x36')](_0xab81('0x37'))){_0x573864[_0xab81('0x1f')]=qs[_0xab81('0x1f')](_0x20eccd['query'][_0xab81('0x1f')]);_0x573864[_0xab81('0x1d')]=qs[_0xab81('0x1d')](_0x20eccd[_0xab81('0x31')]['offset']);}_0x573864['order']=qs[_0xab81('0x38')](_0x20eccd[_0xab81('0x31')][_0xab81('0x38')]);_0x573864[_0xab81('0x39')]=qs[_0xab81('0x32')](_['pick'](_0x20eccd[_0xab81('0x31')],_0xa6d87f['filters']),_0x2e8b8e);if(_0x20eccd[_0xab81('0x31')][_0xab81('0x3a')]){_0x573864[_0xab81('0x39')]=_[_0xab81('0x3b')](_0x573864['where'],{'$or':_[_0xab81('0x2a')](_0x2e8b8e,function(_0xac2292){if(_0xac2292[_0xab81('0x2d')]!==_0xab81('0x3c')){var _0x4b3377={};_0x4b3377[_0xac2292[_0xab81('0x30')]]={'$like':'%'+_0x20eccd['query'][_0xab81('0x3a')]+'%'};return _0x4b3377;}})});}_0x573864=_[_0xab81('0x3b')]({},_0x573864,_0x20eccd[_0xab81('0x3d')]);var _0x47ce92={'where':_0x573864[_0xab81('0x39')]};return db['SalesforceField'][_0xab81('0x20')](_0x47ce92)['then'](function(_0x11f371){_0x477771[_0xab81('0x20')]=_0x11f371;if(_0x20eccd['query'][_0xab81('0x3e')]){_0x573864[_0xab81('0x3f')]=[{'all':!![]}];}return db[_0xab81('0x2b')][_0xab81('0x40')](_0x573864);})['then'](function(_0x3c8f89){_0x477771['rows']=_0x3c8f89;return _0x477771;})[_0xab81('0x26')](respondWithFilteredResult(_0x4f5c6c,_0x573864))[_0xab81('0x41')](handleError(_0x4f5c6c,null));};exports['show']=function(_0x131997,_0x477e60){var _0x382db0={'raw':!![],'where':{'id':_0x131997[_0xab81('0x42')]['id']}},_0x7cbef9={};_0x7cbef9[_0xab81('0x2f')]=_['keys'](db[_0xab81('0x2b')]['rawAttributes']);_0x7cbef9[_0xab81('0x31')]=_['keys'](_0x131997[_0xab81('0x31')]);_0x7cbef9[_0xab81('0x32')]=_[_0xab81('0x33')](_0x7cbef9[_0xab81('0x2f')],_0x7cbef9['query']);_0x382db0[_0xab81('0x34')]=_['intersection'](_0x7cbef9[_0xab81('0x2f')],qs[_0xab81('0x35')](_0x131997['query'][_0xab81('0x35')]));_0x382db0[_0xab81('0x34')]=_0x382db0[_0xab81('0x34')]['length']?_0x382db0[_0xab81('0x34')]:_0x7cbef9[_0xab81('0x2f')];if(_0x131997[_0xab81('0x31')][_0xab81('0x3e')]){_0x382db0[_0xab81('0x3f')]=[{'all':!![]}];}_0x382db0=_[_0xab81('0x3b')]({},_0x382db0,_0x131997[_0xab81('0x3d')]);return db[_0xab81('0x2b')][_0xab81('0x43')](_0x382db0)['then'](handleEntityNotFound(_0x477e60,null))[_0xab81('0x26')](respondWithResult(_0x477e60,null))[_0xab81('0x41')](handleError(_0x477e60,null));};exports[_0xab81('0x44')]=function(_0x4cef31,_0x215db4){return db[_0xab81('0x2b')][_0xab81('0x44')](_0x4cef31['body'],{})[_0xab81('0x26')](respondWithResult(_0x215db4,0xc9))[_0xab81('0x41')](handleError(_0x215db4,null));};exports[_0xab81('0x25')]=function(_0x3345a5,_0x5a4768){if(_0x3345a5[_0xab81('0x45')]['id']){delete _0x3345a5[_0xab81('0x45')]['id'];}return db[_0xab81('0x2b')]['find']({'where':{'id':_0x3345a5[_0xab81('0x42')]['id']}})[_0xab81('0x26')](handleEntityNotFound(_0x5a4768,null))[_0xab81('0x26')](saveUpdates(_0x3345a5['body'],null))[_0xab81('0x26')](respondWithResult(_0x5a4768,null))[_0xab81('0x41')](handleError(_0x5a4768,null));};exports['destroy']=function(_0x5c6195,_0x1dcb2f){return db[_0xab81('0x2b')][_0xab81('0x43')]({'where':{'id':_0x5c6195[_0xab81('0x42')]['id']}})['then'](handleEntityNotFound(_0x1dcb2f,null))[_0xab81('0x26')](removeEntity(_0x1dcb2f,null))[_0xab81('0x41')](handleError(_0x1dcb2f,null));}; \ No newline at end of file +var _0xe248=['offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xe248,0x1e1));var _0x8e24=function(_0x17d120,_0x17088b){_0x17d120=_0x17d120-0x0;var _0x1254b3=_0xe248[_0x17d120];return _0x1254b3;};'use strict';var emlformat=require(_0x8e24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e24('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8e24('0x3'));var util=require(_0x8e24('0x4'));var path=require(_0x8e24('0x5'));var sox=require(_0x8e24('0x6'));var csv=require(_0x8e24('0x7'));var ejs=require(_0x8e24('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e24('0x9'));var toCsv=require(_0x8e24('0x7'));var querystring=require(_0x8e24('0xa'));var Papa=require(_0x8e24('0xb'));var Redis=require(_0x8e24('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8e24('0xd'));var as=require(_0x8e24('0xe'));var hardwareService=require(_0x8e24('0xf'));var logger=require(_0x8e24('0x10'))(_0x8e24('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8e24('0x12'));var db=require(_0x8e24('0x13'))['db'];function respondWithStatusCode(_0x25d7ab,_0x23b503){_0x23b503=_0x23b503||0xcc;return function(_0x3f8351){if(_0x3f8351){return _0x25d7ab['sendStatus'](_0x23b503);}return _0x25d7ab['status'](_0x23b503)[_0x8e24('0x14')]();};}function respondWithResult(_0x15ec30,_0x1340d5){_0x1340d5=_0x1340d5||0xc8;return function(_0x182404){if(_0x182404){return _0x15ec30[_0x8e24('0x15')](_0x1340d5)[_0x8e24('0x16')](_0x182404);}};}function respondWithFilteredResult(_0x434396,_0x53ae96){return function(_0x2d8d83){if(_0x2d8d83){var _0x49c6e4=typeof _0x53ae96[_0x8e24('0x17')]===_0x8e24('0x18')&&typeof _0x53ae96[_0x8e24('0x19')]===_0x8e24('0x18');var _0x13b795=_0x2d8d83[_0x8e24('0x1a')];var _0x548b2b=_0x49c6e4?0x0:_0x53ae96[_0x8e24('0x17')];var _0x57ff06=_0x49c6e4?_0x2d8d83[_0x8e24('0x1a')]:_0x53ae96[_0x8e24('0x17')]+_0x53ae96[_0x8e24('0x19')];var _0x463b9f;if(_0x57ff06>=_0x13b795){_0x57ff06=_0x13b795;_0x463b9f=0xc8;}else{_0x463b9f=0xce;}_0x434396[_0x8e24('0x15')](_0x463b9f);return _0x434396[_0x8e24('0x1b')]('Content-Range',_0x548b2b+'-'+_0x57ff06+'/'+_0x13b795)[_0x8e24('0x16')](_0x2d8d83);}return null;};}function patchUpdates(_0xac1114){return function(_0x277350){try{jsonpatch[_0x8e24('0x1c')](_0x277350,_0xac1114,!![]);}catch(_0x140930){return BPromise['reject'](_0x140930);}return _0x277350[_0x8e24('0x1d')]();};}function saveUpdates(_0x3eb6de,_0x5c9a34){return function(_0xe3b94f){if(_0xe3b94f){return _0xe3b94f[_0x8e24('0x1e')](_0x3eb6de)[_0x8e24('0x1f')](function(_0x1bf145){return _0x1bf145;});}return null;};}function removeEntity(_0x1fdeab,_0x933906){return function(_0x1643b3){if(_0x1643b3){return _0x1643b3[_0x8e24('0x20')]()[_0x8e24('0x1f')](function(){_0x1fdeab['status'](0xcc)[_0x8e24('0x14')]();});}};}function handleEntityNotFound(_0x27e4bb,_0x4ab60c){return function(_0x21e279){if(!_0x21e279){_0x27e4bb[_0x8e24('0x21')](0x194);}return _0x21e279;};}function handleError(_0x535164,_0x335838){_0x335838=_0x335838||0x1f4;return function(_0x141f09){logger[_0x8e24('0x22')](_0x141f09[_0x8e24('0x23')]);if(_0x141f09[_0x8e24('0x24')]){delete _0x141f09[_0x8e24('0x24')];}_0x535164[_0x8e24('0x15')](_0x335838)[_0x8e24('0x25')](_0x141f09);};}exports['index']=function(_0x2362e5,_0x519903){var _0x1f939f={},_0x25a02b={},_0x4ef827={'count':0x0,'rows':[]};var _0x3aed56=_[_0x8e24('0x26')](db[_0x8e24('0x27')][_0x8e24('0x28')],function(_0x233c38){return{'name':_0x233c38[_0x8e24('0x29')],'type':_0x233c38[_0x8e24('0x2a')][_0x8e24('0x2b')]};});_0x25a02b['model']=_[_0x8e24('0x26')](_0x3aed56,_0x8e24('0x24'));_0x25a02b[_0x8e24('0x2c')]=_['keys'](_0x2362e5[_0x8e24('0x2c')]);_0x25a02b[_0x8e24('0x2d')]=_[_0x8e24('0x2e')](_0x25a02b[_0x8e24('0x2f')],_0x25a02b[_0x8e24('0x2c')]);_0x1f939f[_0x8e24('0x30')]=_[_0x8e24('0x2e')](_0x25a02b['model'],qs[_0x8e24('0x31')](_0x2362e5['query']['fields']));_0x1f939f[_0x8e24('0x30')]=_0x1f939f[_0x8e24('0x30')][_0x8e24('0x32')]?_0x1f939f[_0x8e24('0x30')]:_0x25a02b[_0x8e24('0x2f')];if(!_0x2362e5['query'][_0x8e24('0x33')](_0x8e24('0x34'))){_0x1f939f[_0x8e24('0x19')]=qs[_0x8e24('0x19')](_0x2362e5['query'][_0x8e24('0x19')]);_0x1f939f['offset']=qs['offset'](_0x2362e5['query'][_0x8e24('0x17')]);}_0x1f939f[_0x8e24('0x35')]=qs[_0x8e24('0x36')](_0x2362e5[_0x8e24('0x2c')]['sort']);_0x1f939f[_0x8e24('0x37')]=qs[_0x8e24('0x2d')](_[_0x8e24('0x38')](_0x2362e5[_0x8e24('0x2c')],_0x25a02b[_0x8e24('0x2d')]),_0x3aed56);if(_0x2362e5[_0x8e24('0x2c')][_0x8e24('0x39')]){_0x1f939f[_0x8e24('0x37')]=_[_0x8e24('0x3a')](_0x1f939f[_0x8e24('0x37')],{'$or':_['map'](_0x3aed56,function(_0x10d6fc){if(_0x10d6fc[_0x8e24('0x2a')]!==_0x8e24('0x3b')){var _0x100248={};_0x100248[_0x10d6fc[_0x8e24('0x24')]]={'$like':'%'+_0x2362e5['query'][_0x8e24('0x39')]+'%'};return _0x100248;}})});}_0x1f939f=_['merge']({},_0x1f939f,_0x2362e5[_0x8e24('0x3c')]);var _0x4f9091={'where':_0x1f939f[_0x8e24('0x37')]};return db[_0x8e24('0x27')][_0x8e24('0x1a')](_0x4f9091)[_0x8e24('0x1f')](function(_0x13bd9c){_0x4ef827[_0x8e24('0x1a')]=_0x13bd9c;if(_0x2362e5[_0x8e24('0x2c')][_0x8e24('0x3d')]){_0x1f939f[_0x8e24('0x3e')]=[{'all':!![]}];}return db[_0x8e24('0x27')][_0x8e24('0x3f')](_0x1f939f);})[_0x8e24('0x1f')](function(_0x4a91da){_0x4ef827[_0x8e24('0x40')]=_0x4a91da;return _0x4ef827;})[_0x8e24('0x1f')](respondWithFilteredResult(_0x519903,_0x1f939f))[_0x8e24('0x41')](handleError(_0x519903,null));};exports[_0x8e24('0x42')]=function(_0x5062bf,_0x2a1f7a){var _0x56727e={'raw':!![],'where':{'id':_0x5062bf[_0x8e24('0x43')]['id']}},_0xe53bf2={};_0xe53bf2['model']=_['keys'](db[_0x8e24('0x27')][_0x8e24('0x28')]);_0xe53bf2['query']=_[_0x8e24('0x44')](_0x5062bf[_0x8e24('0x2c')]);_0xe53bf2[_0x8e24('0x2d')]=_[_0x8e24('0x2e')](_0xe53bf2[_0x8e24('0x2f')],_0xe53bf2['query']);_0x56727e['attributes']=_[_0x8e24('0x2e')](_0xe53bf2[_0x8e24('0x2f')],qs[_0x8e24('0x31')](_0x5062bf[_0x8e24('0x2c')]['fields']));_0x56727e[_0x8e24('0x30')]=_0x56727e['attributes'][_0x8e24('0x32')]?_0x56727e[_0x8e24('0x30')]:_0xe53bf2[_0x8e24('0x2f')];if(_0x5062bf[_0x8e24('0x2c')][_0x8e24('0x3d')]){_0x56727e['include']=[{'all':!![]}];}_0x56727e=_[_0x8e24('0x3a')]({},_0x56727e,_0x5062bf[_0x8e24('0x3c')]);return db[_0x8e24('0x27')][_0x8e24('0x45')](_0x56727e)[_0x8e24('0x1f')](handleEntityNotFound(_0x2a1f7a,null))[_0x8e24('0x1f')](respondWithResult(_0x2a1f7a,null))[_0x8e24('0x41')](handleError(_0x2a1f7a,null));};exports['create']=function(_0xa2e0ba,_0x9c5995){return db['SalesforceField'][_0x8e24('0x46')](_0xa2e0ba[_0x8e24('0x47')],{})[_0x8e24('0x1f')](respondWithResult(_0x9c5995,0xc9))['catch'](handleError(_0x9c5995,null));};exports[_0x8e24('0x1e')]=function(_0xe82a9d,_0xadfb93){if(_0xe82a9d[_0x8e24('0x47')]['id']){delete _0xe82a9d[_0x8e24('0x47')]['id'];}return db[_0x8e24('0x27')][_0x8e24('0x45')]({'where':{'id':_0xe82a9d['params']['id']}})[_0x8e24('0x1f')](handleEntityNotFound(_0xadfb93,null))[_0x8e24('0x1f')](saveUpdates(_0xe82a9d[_0x8e24('0x47')],null))[_0x8e24('0x1f')](respondWithResult(_0xadfb93,null))[_0x8e24('0x41')](handleError(_0xadfb93,null));};exports[_0x8e24('0x20')]=function(_0x5722be,_0x27e3b8){return db['SalesforceField']['find']({'where':{'id':_0x5722be[_0x8e24('0x43')]['id']}})[_0x8e24('0x1f')](handleEntityNotFound(_0x27e3b8,null))[_0x8e24('0x1f')](removeEntity(_0x27e3b8,null))[_0x8e24('0x41')](handleError(_0x27e3b8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f8656fd..736c99e 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 _0x64c4=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes'];(function(_0x2af47e,_0x1d2a86){var _0x5bca26=function(_0x4ba3db){while(--_0x4ba3db){_0x2af47e['push'](_0x2af47e['shift']());}};_0x5bca26(++_0x1d2a86);}(_0x64c4,0x142));var _0x464c=function(_0x28c372,_0x46b647){_0x28c372=_0x28c372-0x0;var _0x381389=_0x64c4[_0x28c372];return _0x381389;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x464c('0x0'))(_0x464c('0x1'));var moment=require(_0x464c('0x2'));var BPromise=require(_0x464c('0x3'));var rp=require(_0x464c('0x4'));var fs=require('fs');var path=require(_0x464c('0x5'));var rimraf=require(_0x464c('0x6'));var config=require('../../config/environment');var attributes=require(_0x464c('0x7'));module[_0x464c('0x8')]=function(_0x23b175,_0x40fa18){return _0x23b175[_0x464c('0x9')](_0x464c('0xa'),attributes,{'tableName':_0x464c('0xb'),'paranoid':![],'indexes':[{'name':_0x464c('0xc'),'fields':[_0x464c('0xd'),_0x464c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb657=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xb657,0x1ac));var _0x7b65=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xb657[_0x176329];return _0x31997c;};'use strict';var _=require(_0x7b65('0x0'));var util=require('util');var logger=require(_0x7b65('0x1'))(_0x7b65('0x2'));var moment=require(_0x7b65('0x3'));var BPromise=require(_0x7b65('0x4'));var rp=require(_0x7b65('0x5'));var fs=require('fs');var path=require(_0x7b65('0x6'));var rimraf=require(_0x7b65('0x7'));var config=require(_0x7b65('0x8'));var attributes=require(_0x7b65('0x9'));module[_0x7b65('0xa')]=function(_0x159aec,_0x576a6d){return _0x159aec[_0x7b65('0xb')]('SalesforceField',attributes,{'tableName':_0x7b65('0xc'),'paranoid':![],'indexes':[{'name':_0x7b65('0xd'),'fields':[_0x7b65('0xe'),_0x7b65('0xf')],'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 867c22b..fe50d65 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 _0x1a3a=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2fda05,_0x442a79){var _0x521ad9=function(_0x2cb82b){while(--_0x2cb82b){_0x2fda05['push'](_0x2fda05['shift']());}};_0x521ad9(++_0x442a79);}(_0x1a3a,0x9d));var _0xa1a3=function(_0x580a90,_0x4095ce){_0x580a90=_0x580a90-0x0;var _0x4c7d83=_0x1a3a[_0x580a90];return _0x4c7d83;};'use strict';var _=require(_0xa1a3('0x0'));var util=require('util');var moment=require(_0xa1a3('0x1'));var BPromise=require(_0xa1a3('0x2'));var rs=require(_0xa1a3('0x3'));var fs=require('fs');var Redis=require(_0xa1a3('0x4'));var db=require(_0xa1a3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1a3('0x6'))('rpc');var config=require(_0xa1a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa1a3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c68d3,_0x34c057,_0x5e33aa){return new BPromise(function(_0xf3b8ee,_0x113dab){return client['request'](_0x2c68d3,_0x5e33aa)['then'](function(_0x313d81){logger[_0xa1a3('0x9')](_0xa1a3('0xa'),_0x34c057,_0xa1a3('0xb'));logger[_0xa1a3('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x34c057,_0xa1a3('0xb'),JSON['stringify'](_0x313d81));if(_0x313d81[_0xa1a3('0xd')]){if(_0x313d81[_0xa1a3('0xd')][_0xa1a3('0xe')]===0x1f4){logger[_0xa1a3('0xd')](_0xa1a3('0xa'),_0x34c057,_0x313d81['error'][_0xa1a3('0xf')]);return _0x113dab(_0x313d81['error'][_0xa1a3('0xf')]);}logger[_0xa1a3('0xd')](_0xa1a3('0xa'),_0x34c057,_0x313d81['error']['message']);return _0xf3b8ee(_0x313d81[_0xa1a3('0xd')][_0xa1a3('0xf')]);}else{logger[_0xa1a3('0x9')](_0xa1a3('0xa'),_0x34c057,'request\x20sent');_0xf3b8ee(_0x313d81['result'][_0xa1a3('0xf')]);}})[_0xa1a3('0x10')](function(_0x55e977){logger['error'](_0xa1a3('0xa'),_0x34c057,_0x55e977);_0x113dab(_0x55e977);});});} \ No newline at end of file +var _0xe687=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xe687,0xa1));var _0x7e68=function(_0xb53cf3,_0x506b5c){_0xb53cf3=_0xb53cf3-0x0;var _0x4e23f9=_0xe687[_0xb53cf3];return _0x4e23f9;};'use strict';var _=require(_0x7e68('0x0'));var util=require(_0x7e68('0x1'));var moment=require(_0x7e68('0x2'));var BPromise=require(_0x7e68('0x3'));var rs=require(_0x7e68('0x4'));var fs=require('fs');var Redis=require(_0x7e68('0x5'));var db=require(_0x7e68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e68('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e68('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc01098,_0x22b0fe,_0x3d053e){return new BPromise(function(_0x597257,_0x47bc81){return client[_0x7e68('0x9')](_0xc01098,_0x3d053e)[_0x7e68('0xa')](function(_0x585e1f){logger[_0x7e68('0xb')](_0x7e68('0xc'),_0x22b0fe,'request\x20sent');logger[_0x7e68('0xd')](_0x7e68('0xe'),_0x22b0fe,_0x7e68('0xf'),JSON[_0x7e68('0x10')](_0x585e1f));if(_0x585e1f[_0x7e68('0x11')]){if(_0x585e1f[_0x7e68('0x11')]['code']===0x1f4){logger[_0x7e68('0x11')](_0x7e68('0xc'),_0x22b0fe,_0x585e1f[_0x7e68('0x11')][_0x7e68('0x12')]);return _0x47bc81(_0x585e1f['error']['message']);}logger['error'](_0x7e68('0xc'),_0x22b0fe,_0x585e1f['error']['message']);return _0x597257(_0x585e1f[_0x7e68('0x11')][_0x7e68('0x12')]);}else{logger[_0x7e68('0xb')]('SalesforceField,\x20%s,\x20%s',_0x22b0fe,_0x7e68('0xf'));_0x597257(_0x585e1f[_0x7e68('0x13')][_0x7e68('0x12')]);}})['catch'](function(_0x4926b9){logger['error']('SalesforceField,\x20%s,\x20%s',_0x22b0fe,_0x4926b9);_0x47bc81(_0x4926b9);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 64f8809..5d8bdbf 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 _0x2888=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x2888,0x97));var _0x8288=function(_0xb97434,_0x427ea5){_0xb97434=_0xb97434-0x0;var _0xdc1951=_0x2888[_0xb97434];return _0xdc1951;};'use strict';var multer=require(_0x8288('0x0'));var util=require(_0x8288('0x1'));var path=require('path');var timeout=require(_0x8288('0x2'));var express=require(_0x8288('0x3'));var router=express[_0x8288('0x4')]();var fs_extra=require(_0x8288('0x5'));var auth=require(_0x8288('0x6'));var interaction=require(_0x8288('0x7'));var config=require(_0x8288('0x8'));var controller=require(_0x8288('0x9'));router['get']('/',auth[_0x8288('0xa')](),controller['index']);router[_0x8288('0xb')](_0x8288('0xc'),auth['isAuthenticated'](),controller[_0x8288('0xd')]);router[_0x8288('0xb')]('/:id/configurations',auth[_0x8288('0xa')](),controller[_0x8288('0xe')]);router[_0x8288('0xb')](_0x8288('0xf'),auth[_0x8288('0xa')](),controller[_0x8288('0x10')]);router[_0x8288('0x11')]('/',auth[_0x8288('0xa')](),controller[_0x8288('0x12')]);router[_0x8288('0x11')](_0x8288('0x13'),auth[_0x8288('0xa')](),controller[_0x8288('0x14')]);router[_0x8288('0x15')](_0x8288('0xc'),auth[_0x8288('0xa')](),controller[_0x8288('0x16')]);router[_0x8288('0x17')](_0x8288('0xc'),auth['isAuthenticated'](),controller[_0x8288('0x18')]);module[_0x8288('0x19')]=router; \ No newline at end of file +var _0x1af8=['../../config/environment','get','isAuthenticated','index','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a39f3,_0x5c6d1e){var _0x535e13=function(_0x451ee9){while(--_0x451ee9){_0x1a39f3['push'](_0x1a39f3['shift']());}};_0x535e13(++_0x5c6d1e);}(_0x1af8,0x99));var _0x81af=function(_0x40526d,_0x3d158d){_0x40526d=_0x40526d-0x0;var _0x390a9e=_0x1af8[_0x40526d];return _0x390a9e;};'use strict';var multer=require(_0x81af('0x0'));var util=require('util');var path=require(_0x81af('0x1'));var timeout=require(_0x81af('0x2'));var express=require(_0x81af('0x3'));var router=express[_0x81af('0x4')]();var fs_extra=require(_0x81af('0x5'));var auth=require(_0x81af('0x6'));var interaction=require(_0x81af('0x7'));var config=require(_0x81af('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x81af('0x9')]('/',auth[_0x81af('0xa')](),controller[_0x81af('0xb')]);router[_0x81af('0x9')]('/:id',auth[_0x81af('0xa')](),controller['show']);router[_0x81af('0x9')]('/:id/configurations',auth[_0x81af('0xa')](),controller[_0x81af('0xc')]);router[_0x81af('0x9')]('/:id/fields',auth[_0x81af('0xa')](),controller[_0x81af('0xd')]);router[_0x81af('0xe')]('/',auth[_0x81af('0xa')](),controller[_0x81af('0xf')]);router[_0x81af('0xe')](_0x81af('0x10'),auth[_0x81af('0xa')](),controller[_0x81af('0x11')]);router[_0x81af('0x12')]('/:id',auth[_0x81af('0xa')](),controller[_0x81af('0x13')]);router['delete'](_0x81af('0x14'),auth[_0x81af('0xa')](),controller[_0x81af('0x15')]);module[_0x81af('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 1928223..b455f3a 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 _0x22a4=['exports','STRING','username','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x22a4,0xcb));var _0x422a=function(_0x3403ec,_0x33f0c2){_0x3403ec=_0x3403ec-0x0;var _0x4b8260=_0x22a4[_0x3403ec];return _0x4b8260;};'use strict';var Sequelize=require(_0x422a('0x0'));module[_0x422a('0x1')]={'name':{'type':Sequelize[_0x422a('0x2')]},'description':{'type':Sequelize[_0x422a('0x2')]},'username':{'type':Sequelize[_0x422a('0x2')],'unique':_0x422a('0x3')},'password':{'type':Sequelize[_0x422a('0x2')]},'email':{'type':Sequelize[_0x422a('0x2')]},'remoteUri':{'type':Sequelize[_0x422a('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x422a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeffd=['remoteUri','sequelize','STRING','username'];(function(_0x211c4d,_0xf66ff){var _0x314443=function(_0x4f8e9f){while(--_0x4f8e9f){_0x211c4d['push'](_0x211c4d['shift']());}};_0x314443(++_0xf66ff);}(_0xeffd,0x185));var _0xdeff=function(_0x4778a5,_0x50b3ec){_0x4778a5=_0x4778a5-0x0;var _0x1ae483=_0xeffd[_0x4778a5];return _0x1ae483;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdeff('0x1')]},'username':{'type':Sequelize[_0xdeff('0x1')],'unique':_0xdeff('0x2')},'password':{'type':Sequelize[_0xdeff('0x1')]},'email':{'type':Sequelize[_0xdeff('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdeff('0x3')},'serverUrl':{'type':Sequelize[_0xdeff('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5336504..507a4ef 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 _0x2d3e=['password','remoteUri','serverUrl','substring','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','statusCode','test','Wrong\x20credentials','boolean','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','length','include','find','create','body','update','ServicenowConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','incident_state','urgency','problem_id','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','location','username'];(function(_0x229344,_0x3af03d){var _0x426f93=function(_0x380924){while(--_0x380924){_0x229344['push'](_0x229344['shift']());}};_0x426f93(++_0x3af03d);}(_0x2d3e,0x17c));var _0xe2d3=function(_0x32c99a,_0x45ca14){_0x32c99a=_0x32c99a-0x0;var _0x5ee563=_0x2d3e[_0x32c99a];return _0x5ee563;};'use strict';var emlformat=require(_0xe2d3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2d3('0x1'));var rp=require(_0xe2d3('0x2'));var moment=require('moment');var BPromise=require(_0xe2d3('0x3'));var Mustache=require('mustache');var util=require(_0xe2d3('0x4'));var path=require(_0xe2d3('0x5'));var sox=require('sox');var csv=require(_0xe2d3('0x6'));var ejs=require(_0xe2d3('0x7'));var fs=require('fs');var fs_extra=require(_0xe2d3('0x8'));var _=require(_0xe2d3('0x9'));var squel=require(_0xe2d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe2d3('0xb'));var toCsv=require(_0xe2d3('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2d3('0xc'));var authService=require(_0xe2d3('0xd'));var qs=require(_0xe2d3('0xe'));var as=require(_0xe2d3('0xf'));var hardwareService=require(_0xe2d3('0x10'));var logger=require(_0xe2d3('0x11'))('api');var utils=require(_0xe2d3('0x12'));var config=require(_0xe2d3('0x13'));var licenseUtil=require(_0xe2d3('0x14'));var db=require(_0xe2d3('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5bc7c3,_0x190a8f){_0x190a8f=_0x190a8f||0xcc;return function(_0x410324){if(_0x410324){return _0x5bc7c3[_0xe2d3('0x16')](_0x190a8f);}return _0x5bc7c3['status'](_0x190a8f)[_0xe2d3('0x17')]();};}function respondWithResult(_0x10b2de,_0x1b998c){_0x1b998c=_0x1b998c||0xc8;return function(_0x128c4d){if(_0x128c4d){return _0x10b2de[_0xe2d3('0x18')](_0x1b998c)['json'](_0x128c4d);}};}function respondWithFilteredResult(_0x52f668,_0x5afe8f){return function(_0xa60a65){if(_0xa60a65){var _0x3754bb=typeof _0x5afe8f['offset']==='undefined'&&typeof _0x5afe8f[_0xe2d3('0x19')]===_0xe2d3('0x1a');var _0x15aa2c=_0xa60a65['count'];var _0x5203fc=_0x3754bb?0x0:_0x5afe8f[_0xe2d3('0x1b')];var _0x585d60=_0x3754bb?_0xa60a65[_0xe2d3('0x1c')]:_0x5afe8f[_0xe2d3('0x1b')]+_0x5afe8f[_0xe2d3('0x19')];var _0x28dcea;if(_0x585d60>=_0x15aa2c){_0x585d60=_0x15aa2c;_0x28dcea=0xc8;}else{_0x28dcea=0xce;}_0x52f668[_0xe2d3('0x18')](_0x28dcea);return _0x52f668['set'](_0xe2d3('0x1d'),_0x5203fc+'-'+_0x585d60+'/'+_0x15aa2c)[_0xe2d3('0x1e')](_0xa60a65);}return null;};}function patchUpdates(_0x359e18){return function(_0x15f667){try{jsonpatch['apply'](_0x15f667,_0x359e18,!![]);}catch(_0x4b9abd){return BPromise[_0xe2d3('0x1f')](_0x4b9abd);}return _0x15f667[_0xe2d3('0x20')]();};}function saveUpdates(_0x3988df,_0x27d7a3){return function(_0x29d5f7){if(_0x29d5f7){return _0x29d5f7['update'](_0x3988df)[_0xe2d3('0x21')](function(_0x5f3c0b){return _0x5f3c0b;});}return null;};}function removeEntity(_0x19e27e,_0x57b20b){return function(_0x2cd436){if(_0x2cd436){return _0x2cd436[_0xe2d3('0x22')]()[_0xe2d3('0x21')](function(){_0x19e27e['status'](0xcc)[_0xe2d3('0x17')]();});}};}function handleEntityNotFound(_0x340e45,_0x5ebd22){return function(_0x410990){if(!_0x410990){_0x340e45[_0xe2d3('0x16')](0x194);}return _0x410990;};}function handleError(_0x4e78d3,_0x1947fb){_0x1947fb=_0x1947fb||0x1f4;return function(_0x386c5b){logger[_0xe2d3('0x23')](_0x386c5b[_0xe2d3('0x24')]);if(_0x386c5b[_0xe2d3('0x25')]){delete _0x386c5b[_0xe2d3('0x25')];}_0x4e78d3['status'](_0x1947fb)[_0xe2d3('0x26')](_0x386c5b);};}exports[_0xe2d3('0x27')]=function(_0x221dea,_0x4dc644){var _0x5ee65c={},_0x1f1014={},_0x243af9={'count':0x0,'rows':[]};var _0x22c3bb=_[_0xe2d3('0x28')](db[_0xe2d3('0x29')][_0xe2d3('0x2a')],function(_0x45cdce){return{'name':_0x45cdce[_0xe2d3('0x2b')],'type':_0x45cdce['type'][_0xe2d3('0x2c')]};});_0x1f1014['model']=_[_0xe2d3('0x28')](_0x22c3bb,'name');_0x1f1014[_0xe2d3('0x2d')]=_[_0xe2d3('0x2e')](_0x221dea['query']);_0x1f1014['filters']=_['intersection'](_0x1f1014[_0xe2d3('0x2f')],_0x1f1014[_0xe2d3('0x2d')]);_0x5ee65c[_0xe2d3('0x30')]=_[_0xe2d3('0x31')](_0x1f1014[_0xe2d3('0x2f')],qs[_0xe2d3('0x32')](_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x32')]));_0x5ee65c[_0xe2d3('0x30')]=_0x5ee65c[_0xe2d3('0x30')]['length']?_0x5ee65c['attributes']:_0x1f1014[_0xe2d3('0x2f')];if(!_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x33')](_0xe2d3('0x34'))){_0x5ee65c[_0xe2d3('0x19')]=qs['limit'](_0x221dea[_0xe2d3('0x2d')]['limit']);_0x5ee65c['offset']=qs[_0xe2d3('0x1b')](_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x1b')]);}_0x5ee65c[_0xe2d3('0x35')]=qs[_0xe2d3('0x36')](_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x36')]);_0x5ee65c['where']=qs['filters'](_[_0xe2d3('0x37')](_0x221dea[_0xe2d3('0x2d')],_0x1f1014[_0xe2d3('0x38')]),_0x22c3bb);if(_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x39')]){_0x5ee65c[_0xe2d3('0x3a')]=_['merge'](_0x5ee65c[_0xe2d3('0x3a')],{'$or':_[_0xe2d3('0x28')](_0x22c3bb,function(_0x2ff1c0){if(_0x2ff1c0[_0xe2d3('0x3b')]!==_0xe2d3('0x3c')){var _0xc5231a={};_0xc5231a[_0x2ff1c0[_0xe2d3('0x25')]]={'$like':'%'+_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x39')]+'%'};return _0xc5231a;}})});}_0x5ee65c=_[_0xe2d3('0x3d')]({},_0x5ee65c,_0x221dea[_0xe2d3('0x3e')]);var _0x1aa753={'where':_0x5ee65c[_0xe2d3('0x3a')]};return db['ServicenowAccount'][_0xe2d3('0x1c')](_0x1aa753)['then'](function(_0x245f1c){_0x243af9[_0xe2d3('0x1c')]=_0x245f1c;if(_0x221dea[_0xe2d3('0x2d')][_0xe2d3('0x3f')]){_0x5ee65c['include']=[{'all':!![]}];}return db[_0xe2d3('0x29')]['findAll'](_0x5ee65c);})[_0xe2d3('0x21')](function(_0x1bb93b){_0x243af9[_0xe2d3('0x40')]=_0x1bb93b;return _0x243af9;})[_0xe2d3('0x21')](respondWithFilteredResult(_0x4dc644,_0x5ee65c))[_0xe2d3('0x41')](handleError(_0x4dc644,null));};exports[_0xe2d3('0x42')]=function(_0x553a31,_0x2b7c16){var _0x4740c0={'raw':![],'where':{'id':_0x553a31[_0xe2d3('0x43')]['id']}},_0x39a7f5={};_0x39a7f5['model']=_[_0xe2d3('0x2e')](db[_0xe2d3('0x29')]['rawAttributes']);_0x39a7f5[_0xe2d3('0x2d')]=_[_0xe2d3('0x2e')](_0x553a31[_0xe2d3('0x2d')]);_0x39a7f5[_0xe2d3('0x38')]=_[_0xe2d3('0x31')](_0x39a7f5[_0xe2d3('0x2f')],_0x39a7f5[_0xe2d3('0x2d')]);_0x4740c0[_0xe2d3('0x30')]=_['intersection'](_0x39a7f5[_0xe2d3('0x2f')],qs[_0xe2d3('0x32')](_0x553a31[_0xe2d3('0x2d')]['fields']));_0x4740c0[_0xe2d3('0x30')]=_0x4740c0[_0xe2d3('0x30')][_0xe2d3('0x44')]?_0x4740c0[_0xe2d3('0x30')]:_0x39a7f5[_0xe2d3('0x2f')];if(_0x553a31['query'][_0xe2d3('0x3f')]){_0x4740c0[_0xe2d3('0x45')]=[{'all':!![]}];}_0x4740c0=_['merge']({},_0x4740c0,_0x553a31[_0xe2d3('0x3e')]);return db[_0xe2d3('0x29')][_0xe2d3('0x46')](_0x4740c0)[_0xe2d3('0x21')](handleEntityNotFound(_0x2b7c16,null))[_0xe2d3('0x21')](respondWithResult(_0x2b7c16,null))['catch'](handleError(_0x2b7c16,null));};exports[_0xe2d3('0x47')]=function(_0x414928,_0x2b6465){return db[_0xe2d3('0x29')][_0xe2d3('0x47')](_0x414928[_0xe2d3('0x48')],{})[_0xe2d3('0x21')](respondWithResult(_0x2b6465,0xc9))[_0xe2d3('0x41')](handleError(_0x2b6465,null));};exports[_0xe2d3('0x49')]=function(_0x56e952,_0x526b02){if(_0x56e952[_0xe2d3('0x48')]['id']){delete _0x56e952['body']['id'];}return db[_0xe2d3('0x29')][_0xe2d3('0x46')]({'where':{'id':_0x56e952[_0xe2d3('0x43')]['id']}})[_0xe2d3('0x21')](handleEntityNotFound(_0x526b02,null))[_0xe2d3('0x21')](saveUpdates(_0x56e952['body'],null))[_0xe2d3('0x21')](respondWithResult(_0x526b02,null))[_0xe2d3('0x41')](handleError(_0x526b02,null));};exports[_0xe2d3('0x22')]=function(_0x51d445,_0x417b22){return db['ServicenowAccount'][_0xe2d3('0x46')]({'where':{'id':_0x51d445[_0xe2d3('0x43')]['id']}})[_0xe2d3('0x21')](handleEntityNotFound(_0x417b22,null))[_0xe2d3('0x21')](removeEntity(_0x417b22,null))[_0xe2d3('0x41')](handleError(_0x417b22,null));};exports['getConfigurations']=function(_0x5a9dff,_0x296d93,_0x2e8b44){var _0x2e9a59={};var _0x5d15cd={};var _0x4c7c97;var _0x2db6a2;return db[_0xe2d3('0x29')]['findOne']({'where':{'id':_0x5a9dff[_0xe2d3('0x43')]['id']}})[_0xe2d3('0x21')](handleEntityNotFound(_0x296d93,null))['then'](function(_0x28bfc7){if(_0x28bfc7){_0x4c7c97=_0x28bfc7;_0x5d15cd[_0xe2d3('0x2f')]=_[_0xe2d3('0x2e')](db[_0xe2d3('0x4a')][_0xe2d3('0x2a')]);_0x5d15cd['query']=_['keys'](_0x5a9dff['query']);_0x5d15cd[_0xe2d3('0x38')]=_[_0xe2d3('0x31')](_0x5d15cd[_0xe2d3('0x2f')],_0x5d15cd[_0xe2d3('0x2d')]);_0x2e9a59[_0xe2d3('0x30')]=_[_0xe2d3('0x31')](_0x5d15cd['model'],qs[_0xe2d3('0x32')](_0x5a9dff[_0xe2d3('0x2d')][_0xe2d3('0x32')]));_0x2e9a59[_0xe2d3('0x30')]=_0x2e9a59[_0xe2d3('0x30')][_0xe2d3('0x44')]?_0x2e9a59[_0xe2d3('0x30')]:_0x5d15cd[_0xe2d3('0x2f')];_0x2e9a59[_0xe2d3('0x35')]=qs[_0xe2d3('0x36')](_0x5a9dff['query'][_0xe2d3('0x36')]);_0x2e9a59['where']=qs[_0xe2d3('0x38')](_['pick'](_0x5a9dff[_0xe2d3('0x2d')],_0x5d15cd[_0xe2d3('0x38')]));if(_0x5a9dff[_0xe2d3('0x2d')][_0xe2d3('0x39')]){_0x2e9a59[_0xe2d3('0x3a')]=_[_0xe2d3('0x3d')](_0x2e9a59['where'],{'$or':_[_0xe2d3('0x28')](_0x2e9a59[_0xe2d3('0x30')],function(_0x1964f6){var _0x1b3a63={};_0x1b3a63[_0x1964f6]={'$like':'%'+_0x5a9dff[_0xe2d3('0x2d')][_0xe2d3('0x39')]+'%'};return _0x1b3a63;})});}_0x2e9a59=_[_0xe2d3('0x3d')]({},_0x2e9a59,_0x5a9dff[_0xe2d3('0x3e')]);return _0x4c7c97[_0xe2d3('0x4b')](_0x2e9a59);}})[_0xe2d3('0x21')](function(_0x47c760){if(_0x47c760){_0x2db6a2=_0x47c760['length'];if(!_0x5a9dff[_0xe2d3('0x2d')][_0xe2d3('0x33')](_0xe2d3('0x34'))){_0x2e9a59['limit']=qs[_0xe2d3('0x19')](_0x5a9dff[_0xe2d3('0x2d')]['limit']);_0x2e9a59[_0xe2d3('0x1b')]=qs[_0xe2d3('0x1b')](_0x5a9dff[_0xe2d3('0x2d')]['offset']);}return _0x4c7c97[_0xe2d3('0x4b')](_0x2e9a59);}})['then'](function(_0x2a1827){if(_0x2a1827){return _0x2a1827?{'count':_0x2db6a2,'rows':_0x2a1827}:null;}})['then'](respondWithResult(_0x296d93,null))['catch'](handleError(_0x296d93,null));};exports['addConfiguration']=function(_0x1ff9ce,_0x501fd6,_0x331620){if(_0x1ff9ce[_0xe2d3('0x48')]['id']){delete _0x1ff9ce[_0xe2d3('0x48')]['id'];}return db[_0xe2d3('0x29')][_0xe2d3('0x4c')]({'where':{'id':_0x1ff9ce[_0xe2d3('0x43')]['id']}})[_0xe2d3('0x21')](handleEntityNotFound(_0x501fd6,null))['then'](function(_0xbfaa5e){if(_0xbfaa5e){_0x1ff9ce['body'][_0xe2d3('0x4d')]=_0xbfaa5e['id'];_0x1ff9ce['body'][_0xe2d3('0x4e')]=integrations[_0xe2d3('0x4f')](_0x1ff9ce[_0xe2d3('0x48')][_0xe2d3('0x50')],_0x1ff9ce[_0xe2d3('0x48')][_0xe2d3('0x3b')]);_0x1ff9ce['body'][_0xe2d3('0x51')]=integrations[_0xe2d3('0x52')](_0x1ff9ce[_0xe2d3('0x48')][_0xe2d3('0x50')],_0x1ff9ce[_0xe2d3('0x48')][_0xe2d3('0x3b')]);return db[_0xe2d3('0x4a')][_0xe2d3('0x47')](_0x1ff9ce[_0xe2d3('0x48')],{'include':[{'model':db[_0xe2d3('0x53')],'as':'Subjects'},{'model':db[_0xe2d3('0x53')],'as':_0xe2d3('0x51')}]});}return null;})[_0xe2d3('0x21')](respondWithResult(_0x501fd6,null))[_0xe2d3('0x41')](handleError(_0x501fd6,null));};exports[_0xe2d3('0x54')]=function(_0x539faf,_0xdc897e,_0xe0cabf){var _0x4b80b3=[_0xe2d3('0x55'),_0xe2d3('0x56'),_0xe2d3('0x57'),_0xe2d3('0x58'),_0xe2d3('0x59'),'notify','incident_state',_0xe2d3('0x5a'),_0xe2d3('0x5b')];var _0x3207fc=[_0xe2d3('0x5c'),_0xe2d3('0x55'),_0xe2d3('0x5d'),_0xe2d3('0x5e'),'upon_reject',_0xe2d3('0x5f'),_0xe2d3('0x60'),_0xe2d3('0x56'),_0xe2d3('0x61'),_0xe2d3('0x62'),'resolved_by',_0xe2d3('0x63'),'opened_by','user_input',_0xe2d3('0x64'),_0xe2d3('0x65'),'state',_0xe2d3('0x66'),_0xe2d3('0x57'),_0xe2d3('0x35'),_0xe2d3('0x67'),_0xe2d3('0x68'),_0xe2d3('0x69'),_0xe2d3('0x6a'),_0xe2d3('0x6b'),_0xe2d3('0x6c'),'work_notes_list',_0xe2d3('0x6d'),_0xe2d3('0x6e'),_0xe2d3('0x6f'),_0xe2d3('0x70'),_0xe2d3('0x71'),_0xe2d3('0x72'),_0xe2d3('0x73'),'business_duration',_0xe2d3('0x74'),_0xe2d3('0x75'),_0xe2d3('0x76'),_0xe2d3('0x77'),_0xe2d3('0x78'),_0xe2d3('0x79'),_0xe2d3('0x58'),'work_notes',_0xe2d3('0x7a'),'close_code',_0xe2d3('0x7b'),'delivery_task',_0xe2d3('0x7c'),_0xe2d3('0x7d'),'business_stc',_0xe2d3('0x7e'),_0xe2d3('0x7f'),_0xe2d3('0x80'),_0xe2d3('0x81'),_0xe2d3('0x82'),_0xe2d3('0x83'),_0xe2d3('0x84'),_0xe2d3('0x85'),'parent_incident','sys_id','contact_type','reopened_by',_0xe2d3('0x86'),_0xe2d3('0x87'),_0xe2d3('0x88'),'company',_0xe2d3('0x89'),'activity_due',_0xe2d3('0x8a'),_0xe2d3('0x5a'),_0xe2d3('0x8b'),'sla_due',_0xe2d3('0x8c'),_0xe2d3('0x8d'),_0xe2d3('0x8e'),_0xe2d3('0x8f'),_0xe2d3('0x90'),_0xe2d3('0x91'),'escalation','upon_approval','correlation_id',_0xe2d3('0x92'),_0xe2d3('0x5b')];var _0x3ea802='';var _0x40246a='';var _0x437c9c=[];var _0x52cf6d='';var _0x146047='';var _0x146751=[];var _0x3df638='';var _0x125d8d='';var _0x500035={};var _0x35c664='';return db[_0xe2d3('0x29')][_0xe2d3('0x4c')]({'where':{'id':_0x539faf['params']['id']},'attributes':['id',_0xe2d3('0x93'),_0xe2d3('0x94'),'email',_0xe2d3('0x95'),_0xe2d3('0x96')]})[_0xe2d3('0x21')](handleEntityNotFound(_0xdc897e,null))[_0xe2d3('0x21')](function(_0x23e59f){if(_0x23e59f){_0x35c664=_0x23e59f[_0xe2d3('0x95')];var _0x732a3b=_0x35c664['slice'](-0x1);if(_0x732a3b==='/'){_0x35c664=_0x35c664[_0xe2d3('0x97')](0x0,_0x35c664['lastIndexOf'](_0x732a3b));}_0x125d8d=util[_0xe2d3('0x98')]('%s/api/now/doc/table/schema/',_0x35c664);_0x3df638=util[_0xe2d3('0x98')](_0xe2d3('0x99'),_0x35c664);_0x500035={'user':_0x23e59f['username'],'pass':_0x23e59f[_0xe2d3('0x94')]};var _0x3a7921={'method':'GET','uri':_0x125d8d+_0xe2d3('0x9a'),'auth':_0x500035,'json':!![]};return rp(_0x3a7921);}})[_0xe2d3('0x21')](function(_0x413ebf){if(_0x413ebf[_0xe2d3('0x9b')][_0xe2d3('0x44')]>0x0){_0x3ea802=_0x413ebf[_0xe2d3('0x9b')];}console[_0xe2d3('0x9c')](_0xe2d3('0x9d'),_0x3ea802);_0x146751=[];_0x40246a=Object[_0xe2d3('0x9e')]([],_0x3ea802);_[_0xe2d3('0x9f')](_0x40246a,function(_0x3cbfdc){return!_0x4b80b3[_0xe2d3('0xa0')](_0x3cbfdc[_0xe2d3('0x25')]);});_0x40246a[_0xe2d3('0xa1')](function(_0x25e852){var _0x52b3f1=createFieldObject(_0x3df638,_0x500035,_0x25e852[_0xe2d3('0xa2')],_0x25e852[_0xe2d3('0x25')],_0x25e852[_0xe2d3('0xa3')],![]);_0x146751['push'](_0x52b3f1);});return Promise[_0xe2d3('0xa4')](_0x146751);})[_0xe2d3('0x21')](function(_0x23bf6b){_0x437c9c=_0x23bf6b;_0x52cf6d=Object[_0xe2d3('0x9e')]([],_0x3ea802);console[_0xe2d3('0x9c')](_0xe2d3('0xa5'),_0x3ea802);_[_0xe2d3('0x9f')](_0x52cf6d,function(_0x4096f1){return _0x3207fc[_0xe2d3('0xa0')](_0x4096f1[_0xe2d3('0x25')]);});console[_0xe2d3('0x9c')](_0xe2d3('0xa6'),_0x52cf6d);_0x146751=[];_0x52cf6d[_0xe2d3('0xa1')](function(_0x288b7b){var _0x3d958e=createFieldObject(_0x3df638,_0x500035,_0x288b7b['internalType'],_0x288b7b[_0xe2d3('0x25')],_0x288b7b[_0xe2d3('0xa3')],!![]);_0x146751[_0xe2d3('0xa7')](_0x3d958e);});return Promise[_0xe2d3('0xa4')](_0x146751);})[_0xe2d3('0x21')](function(_0x5999e9){_0x146047=_0x5999e9;var _0x57d7c2=_0x437c9c['concat'](_0x146047);return{'count':_0x57d7c2['length'],'rows':_0x57d7c2};})[_0xe2d3('0x21')](respondWithResult(_0xdc897e,null))['catch'](function(_0x1a5074){console[_0xe2d3('0x9c')]('ServiceNow\x20error:\x20'+_0x1a5074);var _0x42975a=_0x539faf[_0xe2d3('0x2d')]['test']?0x1f4:_0x1a5074[_0xe2d3('0xa8')]||0x1f4;logger['error'](_0x1a5074['stack']);delete _0x1a5074[_0xe2d3('0x25')];if(_0x42975a===0x191){_0x42975a=0x190;}_0xdc897e[_0xe2d3('0x18')](_0x42975a)[_0xe2d3('0x26')](_0x539faf[_0xe2d3('0x2d')][_0xe2d3('0xa9')]?{'message':_0xe2d3('0xaa'),'statusCode':_0x1a5074[_0xe2d3('0xa8')]}:_0x1a5074);});};function createFieldObject(_0x30226f,_0xbc9696,_0x2e24e2,_0x1b698d,_0x531fb4,_0x103b92){return new Promise(function(_0x3f084c,_0x4aef4c){var _0x1a614e={'id':_0x1b698d,'name':_0x531fb4,'custom':_0x103b92};if(_0x2e24e2===_0xe2d3('0xab')){_0x1a614e['options']=[{'name':'True','value':'true'},{'name':'False','value':_0xe2d3('0xac')}];_0x3f084c(_0x1a614e);}else{var _0x1630c8={'method':'GET','uri':_0x30226f+_0xe2d3('0xad')+_0x1b698d,'auth':_0xbc9696,'json':!![]};return rp(_0x1630c8)['then'](function(_0x5b8632){var _0xe7bd6=[];if(_0x5b8632['result'][_0xe2d3('0x44')]>0x0){_0x5b8632['result'][_0xe2d3('0xa1')](function(_0x33a35f){if(_0x33a35f[_0xe2d3('0xae')]===_0xe2d3('0xac')){var _0x585a11={'name':_0x33a35f['label'],'value':_0x33a35f[_0xe2d3('0xaf')]};_0xe7bd6[_0xe2d3('0xa7')](_0x585a11);}});}_0x1a614e[_0xe2d3('0x3e')]=_0xe7bd6;if(_0x1a614e['options'][_0xe2d3('0x44')]>0x0){_0x3f084c(_0x1a614e);}else{if(_0x103b92==![]){_0x3f084c();}else{_0x3f084c(_0x1a614e);}}});}});} \ No newline at end of file +var _0x42ba=['group_list','work_end','reopened_time','resolved_at','caller_id','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','parent_incident','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','log','concat','ServiceNow\x20error:\x20','test','error','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','status','send','index','map','ServicenowAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','caused_by','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','priority','sys_domain_path','time_worked','expected_start','business_duration'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x42ba,0x1a8));var _0xa42b=function(_0x2e80e6,_0x41b63d){_0x2e80e6=_0x2e80e6-0x0;var _0x290d5c=_0x42ba[_0x2e80e6];return _0x290d5c;};'use strict';var emlformat=require(_0xa42b('0x0'));var rimraf=require(_0xa42b('0x1'));var zipdir=require(_0xa42b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa42b('0x3'));var BPromise=require(_0xa42b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa42b('0x5'));var sox=require('sox');var csv=require(_0xa42b('0x6'));var ejs=require(_0xa42b('0x7'));var fs=require('fs');var fs_extra=require(_0xa42b('0x8'));var _=require(_0xa42b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa42b('0xa'));var deskjs=require(_0xa42b('0xb'));var toCsv=require(_0xa42b('0x6'));var querystring=require('querystring');var Papa=require(_0xa42b('0xc'));var Redis=require(_0xa42b('0xd'));var authService=require(_0xa42b('0xe'));var qs=require(_0xa42b('0xf'));var as=require(_0xa42b('0x10'));var hardwareService=require(_0xa42b('0x11'));var logger=require(_0xa42b('0x12'))(_0xa42b('0x13'));var utils=require('../../config/utils');var config=require(_0xa42b('0x14'));var licenseUtil=require(_0xa42b('0x15'));var db=require(_0xa42b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbef338,_0x51c753){_0x51c753=_0x51c753||0xcc;return function(_0x1b6529){if(_0x1b6529){return _0xbef338[_0xa42b('0x17')](_0x51c753);}return _0xbef338['status'](_0x51c753)[_0xa42b('0x18')]();};}function respondWithResult(_0x4d216a,_0x2bc26d){_0x2bc26d=_0x2bc26d||0xc8;return function(_0x3c25f9){if(_0x3c25f9){return _0x4d216a['status'](_0x2bc26d)['json'](_0x3c25f9);}};}function respondWithFilteredResult(_0xda4367,_0xac15be){return function(_0x395738){if(_0x395738){var _0x5a1d66=typeof _0xac15be[_0xa42b('0x19')]==='undefined'&&typeof _0xac15be[_0xa42b('0x1a')]===_0xa42b('0x1b');var _0x34abdf=_0x395738[_0xa42b('0x1c')];var _0x3febc4=_0x5a1d66?0x0:_0xac15be[_0xa42b('0x19')];var _0x14ccc3=_0x5a1d66?_0x395738['count']:_0xac15be[_0xa42b('0x19')]+_0xac15be[_0xa42b('0x1a')];var _0x47592a;if(_0x14ccc3>=_0x34abdf){_0x14ccc3=_0x34abdf;_0x47592a=0xc8;}else{_0x47592a=0xce;}_0xda4367['status'](_0x47592a);return _0xda4367[_0xa42b('0x1d')](_0xa42b('0x1e'),_0x3febc4+'-'+_0x14ccc3+'/'+_0x34abdf)['json'](_0x395738);}return null;};}function patchUpdates(_0x11ed17){return function(_0x17f097){try{jsonpatch[_0xa42b('0x1f')](_0x17f097,_0x11ed17,!![]);}catch(_0x4813a6){return BPromise[_0xa42b('0x20')](_0x4813a6);}return _0x17f097['save']();};}function saveUpdates(_0x3184f5,_0x1021b2){return function(_0x25ecdc){if(_0x25ecdc){return _0x25ecdc[_0xa42b('0x21')](_0x3184f5)[_0xa42b('0x22')](function(_0x579af3){return _0x579af3;});}return null;};}function removeEntity(_0x1cfda4,_0x495f52){return function(_0x5eccd7){if(_0x5eccd7){return _0x5eccd7[_0xa42b('0x23')]()[_0xa42b('0x22')](function(){_0x1cfda4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8bed,_0x397a08){return function(_0x1a2118){if(!_0x1a2118){_0x1e8bed[_0xa42b('0x17')](0x194);}return _0x1a2118;};}function handleError(_0x261a8d,_0x4f18cd){_0x4f18cd=_0x4f18cd||0x1f4;return function(_0x57ef5b){logger['error'](_0x57ef5b[_0xa42b('0x24')]);if(_0x57ef5b[_0xa42b('0x25')]){delete _0x57ef5b[_0xa42b('0x25')];}_0x261a8d[_0xa42b('0x26')](_0x4f18cd)[_0xa42b('0x27')](_0x57ef5b);};}exports[_0xa42b('0x28')]=function(_0x3bcaa4,_0xd4d9dd){var _0x590936={},_0x3f3a12={},_0x24d81a={'count':0x0,'rows':[]};var _0x346753=_[_0xa42b('0x29')](db[_0xa42b('0x2a')][_0xa42b('0x2b')],function(_0x3fbe4b){return{'name':_0x3fbe4b['fieldName'],'type':_0x3fbe4b[_0xa42b('0x2c')][_0xa42b('0x2d')]};});_0x3f3a12[_0xa42b('0x2e')]=_['map'](_0x346753,_0xa42b('0x25'));_0x3f3a12[_0xa42b('0x2f')]=_['keys'](_0x3bcaa4['query']);_0x3f3a12['filters']=_[_0xa42b('0x30')](_0x3f3a12[_0xa42b('0x2e')],_0x3f3a12[_0xa42b('0x2f')]);_0x590936[_0xa42b('0x31')]=_[_0xa42b('0x30')](_0x3f3a12[_0xa42b('0x2e')],qs[_0xa42b('0x32')](_0x3bcaa4['query']['fields']));_0x590936['attributes']=_0x590936['attributes']['length']?_0x590936[_0xa42b('0x31')]:_0x3f3a12[_0xa42b('0x2e')];if(!_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x33')](_0xa42b('0x34'))){_0x590936['limit']=qs[_0xa42b('0x1a')](_0x3bcaa4['query'][_0xa42b('0x1a')]);_0x590936['offset']=qs['offset'](_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x19')]);}_0x590936[_0xa42b('0x35')]=qs[_0xa42b('0x36')](_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x36')]);_0x590936[_0xa42b('0x37')]=qs['filters'](_[_0xa42b('0x38')](_0x3bcaa4[_0xa42b('0x2f')],_0x3f3a12[_0xa42b('0x39')]),_0x346753);if(_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x3a')]){_0x590936['where']=_[_0xa42b('0x3b')](_0x590936[_0xa42b('0x37')],{'$or':_[_0xa42b('0x29')](_0x346753,function(_0x399337){if(_0x399337[_0xa42b('0x2c')]!==_0xa42b('0x3c')){var _0x1e59cb={};_0x1e59cb[_0x399337[_0xa42b('0x25')]]={'$like':'%'+_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x3a')]+'%'};return _0x1e59cb;}})});}_0x590936=_[_0xa42b('0x3b')]({},_0x590936,_0x3bcaa4['options']);var _0x5cc1dd={'where':_0x590936[_0xa42b('0x37')]};return db[_0xa42b('0x2a')][_0xa42b('0x1c')](_0x5cc1dd)[_0xa42b('0x22')](function(_0x190780){_0x24d81a[_0xa42b('0x1c')]=_0x190780;if(_0x3bcaa4[_0xa42b('0x2f')][_0xa42b('0x3d')]){_0x590936[_0xa42b('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x590936);})[_0xa42b('0x22')](function(_0x3ce77a){_0x24d81a[_0xa42b('0x3f')]=_0x3ce77a;return _0x24d81a;})['then'](respondWithFilteredResult(_0xd4d9dd,_0x590936))['catch'](handleError(_0xd4d9dd,null));};exports[_0xa42b('0x40')]=function(_0x362a0b,_0xc0ad2d){var _0x20ac79={'raw':![],'where':{'id':_0x362a0b[_0xa42b('0x41')]['id']}},_0x480179={};_0x480179[_0xa42b('0x2e')]=_['keys'](db[_0xa42b('0x2a')][_0xa42b('0x2b')]);_0x480179['query']=_[_0xa42b('0x42')](_0x362a0b['query']);_0x480179[_0xa42b('0x39')]=_[_0xa42b('0x30')](_0x480179[_0xa42b('0x2e')],_0x480179[_0xa42b('0x2f')]);_0x20ac79[_0xa42b('0x31')]=_[_0xa42b('0x30')](_0x480179[_0xa42b('0x2e')],qs['fields'](_0x362a0b[_0xa42b('0x2f')][_0xa42b('0x32')]));_0x20ac79[_0xa42b('0x31')]=_0x20ac79['attributes']['length']?_0x20ac79[_0xa42b('0x31')]:_0x480179[_0xa42b('0x2e')];if(_0x362a0b[_0xa42b('0x2f')][_0xa42b('0x3d')]){_0x20ac79[_0xa42b('0x3e')]=[{'all':!![]}];}_0x20ac79=_[_0xa42b('0x3b')]({},_0x20ac79,_0x362a0b[_0xa42b('0x43')]);return db[_0xa42b('0x2a')][_0xa42b('0x44')](_0x20ac79)[_0xa42b('0x22')](handleEntityNotFound(_0xc0ad2d,null))[_0xa42b('0x22')](respondWithResult(_0xc0ad2d,null))[_0xa42b('0x45')](handleError(_0xc0ad2d,null));};exports[_0xa42b('0x46')]=function(_0x5c1ec9,_0xbbb57f){return db['ServicenowAccount'][_0xa42b('0x46')](_0x5c1ec9['body'],{})[_0xa42b('0x22')](respondWithResult(_0xbbb57f,0xc9))[_0xa42b('0x45')](handleError(_0xbbb57f,null));};exports[_0xa42b('0x21')]=function(_0x326a88,_0x513948){if(_0x326a88[_0xa42b('0x47')]['id']){delete _0x326a88['body']['id'];}return db['ServicenowAccount'][_0xa42b('0x44')]({'where':{'id':_0x326a88['params']['id']}})[_0xa42b('0x22')](handleEntityNotFound(_0x513948,null))[_0xa42b('0x22')](saveUpdates(_0x326a88[_0xa42b('0x47')],null))['then'](respondWithResult(_0x513948,null))[_0xa42b('0x45')](handleError(_0x513948,null));};exports[_0xa42b('0x23')]=function(_0x390232,_0x6644b6){return db[_0xa42b('0x2a')][_0xa42b('0x44')]({'where':{'id':_0x390232[_0xa42b('0x41')]['id']}})['then'](handleEntityNotFound(_0x6644b6,null))[_0xa42b('0x22')](removeEntity(_0x6644b6,null))[_0xa42b('0x45')](handleError(_0x6644b6,null));};exports[_0xa42b('0x48')]=function(_0x1df5f5,_0x31aafc,_0x2dcedb){var _0xebe11d={};var _0x277144={};var _0x5d2bb5;var _0x206f39;return db['ServicenowAccount'][_0xa42b('0x49')]({'where':{'id':_0x1df5f5[_0xa42b('0x41')]['id']}})[_0xa42b('0x22')](handleEntityNotFound(_0x31aafc,null))[_0xa42b('0x22')](function(_0x5e59fd){if(_0x5e59fd){_0x5d2bb5=_0x5e59fd;_0x277144[_0xa42b('0x2e')]=_['keys'](db[_0xa42b('0x4a')][_0xa42b('0x2b')]);_0x277144[_0xa42b('0x2f')]=_['keys'](_0x1df5f5['query']);_0x277144[_0xa42b('0x39')]=_['intersection'](_0x277144['model'],_0x277144[_0xa42b('0x2f')]);_0xebe11d['attributes']=_[_0xa42b('0x30')](_0x277144[_0xa42b('0x2e')],qs[_0xa42b('0x32')](_0x1df5f5['query']['fields']));_0xebe11d[_0xa42b('0x31')]=_0xebe11d['attributes']['length']?_0xebe11d['attributes']:_0x277144[_0xa42b('0x2e')];_0xebe11d[_0xa42b('0x35')]=qs[_0xa42b('0x36')](_0x1df5f5[_0xa42b('0x2f')][_0xa42b('0x36')]);_0xebe11d['where']=qs['filters'](_['pick'](_0x1df5f5[_0xa42b('0x2f')],_0x277144['filters']));if(_0x1df5f5['query'][_0xa42b('0x3a')]){_0xebe11d['where']=_[_0xa42b('0x3b')](_0xebe11d[_0xa42b('0x37')],{'$or':_[_0xa42b('0x29')](_0xebe11d['attributes'],function(_0x4957be){var _0x4f751d={};_0x4f751d[_0x4957be]={'$like':'%'+_0x1df5f5['query'][_0xa42b('0x3a')]+'%'};return _0x4f751d;})});}_0xebe11d=_['merge']({},_0xebe11d,_0x1df5f5['options']);return _0x5d2bb5[_0xa42b('0x48')](_0xebe11d);}})[_0xa42b('0x22')](function(_0x40436a){if(_0x40436a){_0x206f39=_0x40436a[_0xa42b('0x4b')];if(!_0x1df5f5[_0xa42b('0x2f')][_0xa42b('0x33')](_0xa42b('0x34'))){_0xebe11d['limit']=qs[_0xa42b('0x1a')](_0x1df5f5['query']['limit']);_0xebe11d['offset']=qs[_0xa42b('0x19')](_0x1df5f5[_0xa42b('0x2f')][_0xa42b('0x19')]);}return _0x5d2bb5[_0xa42b('0x48')](_0xebe11d);}})[_0xa42b('0x22')](function(_0x50f64c){if(_0x50f64c){return _0x50f64c?{'count':_0x206f39,'rows':_0x50f64c}:null;}})[_0xa42b('0x22')](respondWithResult(_0x31aafc,null))[_0xa42b('0x45')](handleError(_0x31aafc,null));};exports[_0xa42b('0x4c')]=function(_0x75d731,_0xbd5fb8,_0x16c89c){if(_0x75d731[_0xa42b('0x47')]['id']){delete _0x75d731[_0xa42b('0x47')]['id'];}return db[_0xa42b('0x2a')][_0xa42b('0x49')]({'where':{'id':_0x75d731[_0xa42b('0x41')]['id']}})[_0xa42b('0x22')](handleEntityNotFound(_0xbd5fb8,null))[_0xa42b('0x22')](function(_0xb4e01c){if(_0xb4e01c){_0x75d731['body'][_0xa42b('0x4d')]=_0xb4e01c['id'];_0x75d731[_0xa42b('0x47')][_0xa42b('0x4e')]=integrations[_0xa42b('0x4f')](_0x75d731[_0xa42b('0x47')][_0xa42b('0x50')],_0x75d731['body'][_0xa42b('0x2c')]);_0x75d731[_0xa42b('0x47')][_0xa42b('0x51')]=integrations['getDescriptions'](_0x75d731['body'][_0xa42b('0x50')],_0x75d731[_0xa42b('0x47')][_0xa42b('0x2c')]);return db['ServicenowConfiguration']['create'](_0x75d731[_0xa42b('0x47')],{'include':[{'model':db[_0xa42b('0x52')],'as':_0xa42b('0x4e')},{'model':db[_0xa42b('0x52')],'as':_0xa42b('0x51')}]});}return null;})[_0xa42b('0x22')](respondWithResult(_0xbd5fb8,null))[_0xa42b('0x45')](handleError(_0xbd5fb8,null));};exports[_0xa42b('0x53')]=function(_0x3b5352,_0x349e43,_0x2c9805){var _0x574b2b=[_0xa42b('0x54'),_0xa42b('0x55'),'knowledge',_0xa42b('0x56'),_0xa42b('0x57'),'notify',_0xa42b('0x58'),_0xa42b('0x59'),'category'];var _0x3e9bf1=['parent',_0xa42b('0x54'),_0xa42b('0x5a'),'watch_list',_0xa42b('0x5b'),'sys_updated_on',_0xa42b('0x5c'),'hold_reason',_0xa42b('0x5d'),_0xa42b('0x5e'),_0xa42b('0x5f'),_0xa42b('0x60'),_0xa42b('0x61'),_0xa42b('0x62'),'sys_created_on','sys_domain','state',_0xa42b('0x63'),'knowledge','order',_0xa42b('0x64'),_0xa42b('0x65'),_0xa42b('0x66'),_0xa42b('0x67'),_0xa42b('0x68'),'active','work_notes_list','business_service',_0xa42b('0x69'),_0xa42b('0x6a'),'rfc',_0xa42b('0x6b'),_0xa42b('0x6c'),'opened_at',_0xa42b('0x6d'),_0xa42b('0x6e'),_0xa42b('0x6f'),_0xa42b('0x70'),_0xa42b('0x71'),_0xa42b('0x72'),_0xa42b('0x73'),'subcategory',_0xa42b('0x74'),_0xa42b('0x75'),_0xa42b('0x57'),_0xa42b('0x76'),_0xa42b('0x77'),_0xa42b('0x78'),_0xa42b('0x79'),_0xa42b('0x7a'),'additional_assignee_list',_0xa42b('0x7b'),_0xa42b('0x7c'),_0xa42b('0x7d'),_0xa42b('0x7e'),'close_notes',_0xa42b('0x7f'),'follow_up',_0xa42b('0x80'),'sys_id','contact_type',_0xa42b('0x81'),_0xa42b('0x58'),_0xa42b('0x82'),'problem_id',_0xa42b('0x83'),_0xa42b('0x84'),_0xa42b('0x85'),_0xa42b('0x86'),_0xa42b('0x59'),_0xa42b('0x87'),_0xa42b('0x88'),_0xa42b('0x89'),_0xa42b('0x8a'),_0xa42b('0x8b'),_0xa42b('0x8c'),_0xa42b('0x8d'),'sys_tags',_0xa42b('0x8e'),_0xa42b('0x8f'),'correlation_id',_0xa42b('0x90'),'category'];var _0x12dacc='';var _0x5a92b9='';var _0x49f030=[];var _0x153006='';var _0x4b2736='';var _0x181a81=[];var _0x271767='';var _0x107702='';var _0x20c133={};var _0x161007='';return db['ServicenowAccount'][_0xa42b('0x49')]({'where':{'id':_0x3b5352[_0xa42b('0x41')]['id']},'attributes':['id',_0xa42b('0x91'),_0xa42b('0x92'),_0xa42b('0x93'),'remoteUri',_0xa42b('0x94')]})[_0xa42b('0x22')](handleEntityNotFound(_0x349e43,null))[_0xa42b('0x22')](function(_0x166b22){if(_0x166b22){_0x161007=_0x166b22[_0xa42b('0x95')];var _0x1b5cc5=_0x161007[_0xa42b('0x96')](-0x1);if(_0x1b5cc5==='/'){_0x161007=_0x161007['substring'](0x0,_0x161007[_0xa42b('0x97')](_0x1b5cc5));}_0x107702=util[_0xa42b('0x98')](_0xa42b('0x99'),_0x161007);_0x271767=util[_0xa42b('0x98')](_0xa42b('0x9a'),_0x161007);_0x20c133={'user':_0x166b22['username'],'pass':_0x166b22[_0xa42b('0x92')]};var _0x2bb67b={'method':'GET','uri':_0x107702+_0xa42b('0x9b'),'auth':_0x20c133,'json':!![]};return rp(_0x2bb67b);}})['then'](function(_0x39c493){if(_0x39c493[_0xa42b('0x9c')][_0xa42b('0x4b')]>0x0){_0x12dacc=_0x39c493[_0xa42b('0x9c')];}console['log'](_0xa42b('0x9d'),_0x12dacc);_0x181a81=[];_0x5a92b9=Object[_0xa42b('0x9e')]([],_0x12dacc);_[_0xa42b('0x9f')](_0x5a92b9,function(_0x3a5c12){return!_0x574b2b[_0xa42b('0xa0')](_0x3a5c12[_0xa42b('0x25')]);});_0x5a92b9[_0xa42b('0xa1')](function(_0x105b99){var _0x41a0c4=createFieldObject(_0x271767,_0x20c133,_0x105b99[_0xa42b('0xa2')],_0x105b99[_0xa42b('0x25')],_0x105b99[_0xa42b('0xa3')],![]);_0x181a81[_0xa42b('0xa4')](_0x41a0c4);});return Promise['all'](_0x181a81);})[_0xa42b('0x22')](function(_0x35cac8){_0x49f030=_0x35cac8;_0x153006=Object[_0xa42b('0x9e')]([],_0x12dacc);console[_0xa42b('0xa5')]('TCL:\x20_object',_0x12dacc);_[_0xa42b('0x9f')](_0x153006,function(_0x31280a){return _0x3e9bf1['includes'](_0x31280a['name']);});console[_0xa42b('0xa5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x153006);_0x181a81=[];_0x153006[_0xa42b('0xa1')](function(_0x322d99){var _0x15a8dc=createFieldObject(_0x271767,_0x20c133,_0x322d99[_0xa42b('0xa2')],_0x322d99[_0xa42b('0x25')],_0x322d99['label'],!![]);_0x181a81[_0xa42b('0xa4')](_0x15a8dc);});return Promise['all'](_0x181a81);})['then'](function(_0x1df12b){_0x4b2736=_0x1df12b;var _0x56397e=_0x49f030[_0xa42b('0xa6')](_0x4b2736);return{'count':_0x56397e[_0xa42b('0x4b')],'rows':_0x56397e};})[_0xa42b('0x22')](respondWithResult(_0x349e43,null))[_0xa42b('0x45')](function(_0x2f9914){console[_0xa42b('0xa5')](_0xa42b('0xa7')+_0x2f9914);var _0x554dd8=_0x3b5352[_0xa42b('0x2f')][_0xa42b('0xa8')]?0x1f4:_0x2f9914['statusCode']||0x1f4;logger[_0xa42b('0xa9')](_0x2f9914[_0xa42b('0x24')]);delete _0x2f9914['name'];if(_0x554dd8===0x191){_0x554dd8=0x190;}_0x349e43[_0xa42b('0x26')](_0x554dd8)[_0xa42b('0x27')](_0x3b5352[_0xa42b('0x2f')][_0xa42b('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x2f9914[_0xa42b('0xaa')]}:_0x2f9914);});};function createFieldObject(_0x5a1a3a,_0x3f2ef8,_0x4c5794,_0x486043,_0xf9b754,_0x50293f){return new Promise(function(_0x3e28c1,_0x3c0f9a){var _0x5b6b53={'id':_0x486043,'name':_0xf9b754,'custom':_0x50293f};if(_0x4c5794===_0xa42b('0xab')){_0x5b6b53[_0xa42b('0x43')]=[{'name':_0xa42b('0xac'),'value':_0xa42b('0xad')},{'name':'False','value':_0xa42b('0xae')}];_0x3e28c1(_0x5b6b53);}else{var _0x3ede0f={'method':'GET','uri':_0x5a1a3a+_0xa42b('0xaf')+_0x486043,'auth':_0x3f2ef8,'json':!![]};return rp(_0x3ede0f)['then'](function(_0x1374cc){var _0x3f0568=[];if(_0x1374cc[_0xa42b('0x9c')][_0xa42b('0x4b')]>0x0){_0x1374cc[_0xa42b('0x9c')]['forEach'](function(_0x9d6ce6){if(_0x9d6ce6[_0xa42b('0xb0')]===_0xa42b('0xae')){var _0x4aa7a9={'name':_0x9d6ce6[_0xa42b('0xa3')],'value':_0x9d6ce6[_0xa42b('0xb1')]};_0x3f0568[_0xa42b('0xa4')](_0x4aa7a9);}});}_0x5b6b53[_0xa42b('0x43')]=_0x3f0568;if(_0x5b6b53['options']['length']>0x0){_0x3e28c1(_0x5b6b53);}else{if(_0x50293f==![]){_0x3e28c1();}else{_0x3e28c1(_0x5b6b53);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4d4576c..e4b04ee 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 _0x2675=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','moment','bluebird'];(function(_0x159183,_0xb67a84){var _0x17eca7=function(_0x414087){while(--_0x414087){_0x159183['push'](_0x159183['shift']());}};_0x17eca7(++_0xb67a84);}(_0x2675,0x75));var _0x5267=function(_0x4e436f,_0x9c7bf4){_0x4e436f=_0x4e436f-0x0;var _0x2218a2=_0x2675[_0x4e436f];return _0x2218a2;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));var integrations=require(_0x5267('0x6'));module[_0x5267('0x7')]=function(_0x10f92c,_0x20f065){return _0x10f92c[_0x5267('0x8')]('ServicenowAccount',attributes,{'tableName':_0x5267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x2235e9,_0x3e2eb4){var _0x10784e=function(_0x4d5d30){while(--_0x4d5d30){_0x2235e9['push'](_0x2235e9['shift']());}};_0x10784e(++_0x3e2eb4);}(_0x8958,0x93));var _0x8895=function(_0x480f7d,_0x325b45){_0x480f7d=_0x480f7d-0x0;var _0x50e3ea=_0x8958[_0x480f7d];return _0x50e3ea;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 2d92ecd..92a1d49 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 _0x7409=['map','model','attributes','then','debug','catch','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include'];(function(_0x8e8849,_0x39e175){var _0x46d9dc=function(_0x5a56a8){while(--_0x5a56a8){_0x8e8849['push'](_0x8e8849['shift']());}};_0x46d9dc(++_0x39e175);}(_0x7409,0x6e));var _0x9740=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0x7409[_0x5a9fb9];return _0x110430;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require('moment');var BPromise=require(_0x9740('0x2'));var rs=require(_0x9740('0x3'));var fs=require('fs');var Redis=require(_0x9740('0x4'));var db=require(_0x9740('0x5'))['db'];var utils=require(_0x9740('0x6'));var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require(_0x9740('0xa'));var client=jayson['client'][_0x9740('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x96d19c,_0x2929cd,_0x529edf){return new BPromise(function(_0x279226,_0x2dc9a6){return client[_0x9740('0xc')](_0x96d19c,_0x529edf)['then'](function(_0x142319){logger['info'](_0x9740('0xd'),_0x2929cd,_0x9740('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2929cd,'request\x20sent',JSON[_0x9740('0xf')](_0x142319));if(_0x142319[_0x9740('0x10')]){if(_0x142319[_0x9740('0x10')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2929cd,_0x142319['error']['message']);return _0x2dc9a6(_0x142319['error']['message']);}logger[_0x9740('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2929cd,_0x142319['error'][_0x9740('0x11')]);return _0x279226(_0x142319['error'][_0x9740('0x11')]);}else{logger[_0x9740('0x12')](_0x9740('0xd'),_0x2929cd,_0x9740('0xe'));_0x279226(_0x142319['result'][_0x9740('0x11')]);}})['catch'](function(_0x35e98c){logger[_0x9740('0x10')](_0x9740('0xd'),_0x2929cd,_0x35e98c);_0x2dc9a6(_0x35e98c);});});}exports[_0x9740('0x13')]=function(_0x22843a){var _0xa6cedd=this;return new Promise(function(_0xd5d590,_0x1c8210){return db[_0x9740('0x14')]['findAll']({'raw':_0x22843a[_0x9740('0x15')]?_0x22843a[_0x9740('0x15')][_0x9740('0x16')]===undefined?!![]:![]:!![],'where':_0x22843a[_0x9740('0x15')]?_0x22843a[_0x9740('0x15')][_0x9740('0x17')]||null:null,'attributes':_0x22843a[_0x9740('0x15')]?_0x22843a[_0x9740('0x15')]['attributes']||null:null,'limit':_0x22843a[_0x9740('0x15')]?_0x22843a['options'][_0x9740('0x18')]||null:null,'include':_0x22843a[_0x9740('0x15')]?_0x22843a[_0x9740('0x15')][_0x9740('0x19')]?_[_0x9740('0x1a')](_0x22843a[_0x9740('0x15')]['include'],function(_0x2550f2){return{'model':db[_0x2550f2[_0x9740('0x1b')]],'as':_0x2550f2['as'],'attributes':_0x2550f2[_0x9740('0x1c')],'include':_0x2550f2[_0x9740('0x19')]?_[_0x9740('0x1a')](_0x2550f2[_0x9740('0x19')],function(_0x15aa2f){return{'model':db[_0x15aa2f[_0x9740('0x1b')]],'as':_0x15aa2f['as'],'attributes':_0x15aa2f[_0x9740('0x1c')],'include':_0x15aa2f['include']?_[_0x9740('0x1a')](_0x15aa2f['include'],function(_0x4e5074){return{'model':db[_0x4e5074['model']],'as':_0x4e5074['as'],'attributes':_0x4e5074['attributes']};}):[]};}):[]};}):[]:[]})[_0x9740('0x1d')](function(_0x169d65){logger[_0x9740('0x12')]('GetServicenowAccount',_0x22843a);logger[_0x9740('0x1e')](_0x9740('0x13'),_0x22843a,JSON[_0x9740('0xf')](_0x169d65));_0xd5d590(_0x169d65);})[_0x9740('0x1f')](function(_0x4cdccd){logger[_0x9740('0x10')](_0x9740('0x13'),_0x4cdccd[_0x9740('0x11')],_0x22843a);_0x1c8210(_0xa6cedd['error'](0x1f4,_0x4cdccd[_0x9740('0x11')]));});});};exports[_0x9740('0x20')]=function(_0x1fdd06){var _0x2bba86=this;return new Promise(function(_0x3dcc58,_0x194451){return db[_0x9740('0x14')][_0x9740('0x21')]({'raw':_0x1fdd06[_0x9740('0x15')]?_0x1fdd06[_0x9740('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1fdd06[_0x9740('0x15')]?_0x1fdd06[_0x9740('0x15')][_0x9740('0x17')]||null:null,'attributes':_0x1fdd06[_0x9740('0x15')]?_0x1fdd06[_0x9740('0x15')][_0x9740('0x1c')]||null:null,'include':_0x1fdd06['options']?_0x1fdd06[_0x9740('0x15')]['include']?_['map'](_0x1fdd06[_0x9740('0x15')][_0x9740('0x19')],function(_0x431fae){return{'model':db[_0x431fae[_0x9740('0x1b')]],'as':_0x431fae['as'],'attributes':_0x431fae[_0x9740('0x1c')],'include':_0x431fae['include']?_[_0x9740('0x1a')](_0x431fae[_0x9740('0x19')],function(_0x2f4f6e){return{'model':db[_0x2f4f6e[_0x9740('0x1b')]],'as':_0x2f4f6e['as'],'attributes':_0x2f4f6e[_0x9740('0x1c')],'include':_0x2f4f6e[_0x9740('0x19')]?_[_0x9740('0x1a')](_0x2f4f6e[_0x9740('0x19')],function(_0x33bb9c){return{'model':db[_0x33bb9c[_0x9740('0x1b')]],'as':_0x33bb9c['as'],'attributes':_0x33bb9c[_0x9740('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9740('0x1d')](function(_0x19920d){logger[_0x9740('0x12')](_0x9740('0x20'),_0x1fdd06);logger[_0x9740('0x1e')](_0x9740('0x20'),_0x1fdd06,JSON[_0x9740('0xf')](_0x19920d));_0x3dcc58(_0x19920d);})[_0x9740('0x1f')](function(_0xb9c606){logger[_0x9740('0x10')](_0x9740('0x20'),_0xb9c606['message'],_0x1fdd06);_0x194451(_0x2bba86[_0x9740('0x10')](0x1f4,_0xb9c606['message']));});});}; \ No newline at end of file +var _0xd7f8=['message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowServicenowAccount','find','stringify','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7f8,0x107));var _0x8d7f=function(_0x21acb5,_0x1df19f){_0x21acb5=_0x21acb5-0x0;var _0x548d9d=_0xd7f8[_0x21acb5];return _0x548d9d;};'use strict';var _=require(_0x8d7f('0x0'));var util=require(_0x8d7f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d7f('0x3'));var logger=require(_0x8d7f('0x4'))(_0x8d7f('0x5'));var config=require(_0x8d7f('0x6'));var jayson=require(_0x8d7f('0x7'));var client=jayson['client'][_0x8d7f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x501828,_0x2c5a80,_0x5538ca){return new BPromise(function(_0xf92766,_0x1f3e3f){return client[_0x8d7f('0x9')](_0x501828,_0x5538ca)[_0x8d7f('0xa')](function(_0xb1cfa){logger['info'](_0x8d7f('0xb'),_0x2c5a80,_0x8d7f('0xc'));logger[_0x8d7f('0xd')](_0x8d7f('0xe'),_0x2c5a80,_0x8d7f('0xc'),JSON['stringify'](_0xb1cfa));if(_0xb1cfa['error']){if(_0xb1cfa[_0x8d7f('0xf')][_0x8d7f('0x10')]===0x1f4){logger[_0x8d7f('0xf')](_0x8d7f('0xb'),_0x2c5a80,_0xb1cfa['error'][_0x8d7f('0x11')]);return _0x1f3e3f(_0xb1cfa['error'][_0x8d7f('0x11')]);}logger[_0x8d7f('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x2c5a80,_0xb1cfa['error'][_0x8d7f('0x11')]);return _0xf92766(_0xb1cfa['error']['message']);}else{logger[_0x8d7f('0x12')](_0x8d7f('0xb'),_0x2c5a80,_0x8d7f('0xc'));_0xf92766(_0xb1cfa[_0x8d7f('0x13')]['message']);}})[_0x8d7f('0x14')](function(_0x4afd08){logger[_0x8d7f('0xf')](_0x8d7f('0xb'),_0x2c5a80,_0x4afd08);_0x1f3e3f(_0x4afd08);});});}exports[_0x8d7f('0x15')]=function(_0xf85e49){var _0x1c14a1=this;return new Promise(function(_0x2d260e,_0x3e4e49){return db[_0x8d7f('0x16')][_0x8d7f('0x17')]({'raw':_0xf85e49[_0x8d7f('0x18')]?_0xf85e49[_0x8d7f('0x18')][_0x8d7f('0x19')]===undefined?!![]:![]:!![],'where':_0xf85e49[_0x8d7f('0x18')]?_0xf85e49[_0x8d7f('0x18')][_0x8d7f('0x1a')]||null:null,'attributes':_0xf85e49['options']?_0xf85e49['options']['attributes']||null:null,'limit':_0xf85e49[_0x8d7f('0x18')]?_0xf85e49[_0x8d7f('0x18')][_0x8d7f('0x1b')]||null:null,'include':_0xf85e49[_0x8d7f('0x18')]?_0xf85e49[_0x8d7f('0x18')][_0x8d7f('0x1c')]?_[_0x8d7f('0x1d')](_0xf85e49[_0x8d7f('0x18')][_0x8d7f('0x1c')],function(_0xe0fa64){return{'model':db[_0xe0fa64[_0x8d7f('0x1e')]],'as':_0xe0fa64['as'],'attributes':_0xe0fa64[_0x8d7f('0x1f')],'include':_0xe0fa64['include']?_[_0x8d7f('0x1d')](_0xe0fa64[_0x8d7f('0x1c')],function(_0xa2c0c0){return{'model':db[_0xa2c0c0[_0x8d7f('0x1e')]],'as':_0xa2c0c0['as'],'attributes':_0xa2c0c0['attributes'],'include':_0xa2c0c0['include']?_[_0x8d7f('0x1d')](_0xa2c0c0[_0x8d7f('0x1c')],function(_0x49bf94){return{'model':db[_0x49bf94[_0x8d7f('0x1e')]],'as':_0x49bf94['as'],'attributes':_0x49bf94[_0x8d7f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8d7f('0xa')](function(_0x51f3af){logger['info']('GetServicenowAccount',_0xf85e49);logger[_0x8d7f('0xd')](_0x8d7f('0x15'),_0xf85e49,JSON['stringify'](_0x51f3af));_0x2d260e(_0x51f3af);})[_0x8d7f('0x14')](function(_0xd885df){logger[_0x8d7f('0xf')](_0x8d7f('0x15'),_0xd885df[_0x8d7f('0x11')],_0xf85e49);_0x3e4e49(_0x1c14a1[_0x8d7f('0xf')](0x1f4,_0xd885df[_0x8d7f('0x11')]));});});};exports[_0x8d7f('0x20')]=function(_0x52dc8f){var _0x2d82c8=this;return new Promise(function(_0x5af1b8,_0x300bc8){return db['ServicenowAccount'][_0x8d7f('0x21')]({'raw':_0x52dc8f[_0x8d7f('0x18')]?_0x52dc8f[_0x8d7f('0x18')][_0x8d7f('0x19')]===undefined?!![]:![]:!![],'where':_0x52dc8f['options']?_0x52dc8f['options']['where']||null:null,'attributes':_0x52dc8f[_0x8d7f('0x18')]?_0x52dc8f[_0x8d7f('0x18')][_0x8d7f('0x1f')]||null:null,'include':_0x52dc8f['options']?_0x52dc8f['options'][_0x8d7f('0x1c')]?_['map'](_0x52dc8f[_0x8d7f('0x18')][_0x8d7f('0x1c')],function(_0x52047a){return{'model':db[_0x52047a['model']],'as':_0x52047a['as'],'attributes':_0x52047a[_0x8d7f('0x1f')],'include':_0x52047a[_0x8d7f('0x1c')]?_[_0x8d7f('0x1d')](_0x52047a['include'],function(_0x506266){return{'model':db[_0x506266[_0x8d7f('0x1e')]],'as':_0x506266['as'],'attributes':_0x506266[_0x8d7f('0x1f')],'include':_0x506266['include']?_[_0x8d7f('0x1d')](_0x506266[_0x8d7f('0x1c')],function(_0x3a5455){return{'model':db[_0x3a5455[_0x8d7f('0x1e')]],'as':_0x3a5455['as'],'attributes':_0x3a5455[_0x8d7f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8d7f('0xa')](function(_0x48ca86){logger[_0x8d7f('0x12')]('ShowServicenowAccount',_0x52dc8f);logger[_0x8d7f('0xd')](_0x8d7f('0x20'),_0x52dc8f,JSON[_0x8d7f('0x22')](_0x48ca86));_0x5af1b8(_0x48ca86);})['catch'](function(_0x17758f){logger['error'](_0x8d7f('0x20'),_0x17758f[_0x8d7f('0x11')],_0x52dc8f);_0x300bc8(_0x2d82c8[_0x8d7f('0xf')](0x1f4,_0x17758f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2d3d988..77ba18e 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 _0x2e8f=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x296378,_0x131677){var _0x5880d5=function(_0x1b122e){while(--_0x1b122e){_0x296378['push'](_0x296378['shift']());}};_0x5880d5(++_0x131677);}(_0x2e8f,0x79));var _0xf2e8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2e8f[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xf2e8('0x0'));var util=require('util');var path=require(_0xf2e8('0x1'));var timeout=require(_0xf2e8('0x2'));var express=require(_0xf2e8('0x3'));var router=express[_0xf2e8('0x4')]();var fs_extra=require(_0xf2e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf2e8('0x6'));var controller=require(_0xf2e8('0x7'));router[_0xf2e8('0x8')]('/',auth['isAuthenticated'](),controller[_0xf2e8('0x9')]);router[_0xf2e8('0x8')](_0xf2e8('0xa'),auth[_0xf2e8('0xb')](),controller['show']);router[_0xf2e8('0x8')]('/:id/fields',auth[_0xf2e8('0xb')](),controller[_0xf2e8('0xc')]);router[_0xf2e8('0x8')](_0xf2e8('0xd'),auth[_0xf2e8('0xb')](),controller[_0xf2e8('0xe')]);router[_0xf2e8('0x8')]('/:id/descriptions',auth[_0xf2e8('0xb')](),controller[_0xf2e8('0xf')]);router[_0xf2e8('0x10')]('/',auth[_0xf2e8('0xb')](),controller[_0xf2e8('0x11')]);router[_0xf2e8('0x12')](_0xf2e8('0xa'),auth[_0xf2e8('0xb')](),controller[_0xf2e8('0x13')]);router[_0xf2e8('0x14')](_0xf2e8('0xa'),auth[_0xf2e8('0xb')](),controller[_0xf2e8('0x15')]);module[_0xf2e8('0x16')]=router; \ No newline at end of file +var _0x3d1c=['isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3d1c,0x14f));var _0xc3d1=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x3d1c[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0xc3d1('0x0'));var util=require(_0xc3d1('0x1'));var path=require(_0xc3d1('0x2'));var timeout=require(_0xc3d1('0x3'));var express=require(_0xc3d1('0x4'));var router=express[_0xc3d1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc3d1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc3d1('0x7'));var controller=require(_0xc3d1('0x8'));router[_0xc3d1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc3d1('0x9')]('/:id',auth[_0xc3d1('0xa')](),controller[_0xc3d1('0xb')]);router['get'](_0xc3d1('0xc'),auth[_0xc3d1('0xa')](),controller['getFields']);router[_0xc3d1('0x9')]('/:id/subjects',auth[_0xc3d1('0xa')](),controller[_0xc3d1('0xd')]);router[_0xc3d1('0x9')](_0xc3d1('0xe'),auth['isAuthenticated'](),controller[_0xc3d1('0xf')]);router[_0xc3d1('0x10')]('/',auth['isAuthenticated'](),controller[_0xc3d1('0x11')]);router[_0xc3d1('0x12')](_0xc3d1('0x13'),auth[_0xc3d1('0xa')](),controller[_0xc3d1('0x14')]);router['delete'](_0xc3d1('0x13'),auth[_0xc3d1('0xa')](),controller[_0xc3d1('0x15')]);module[_0xc3d1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2e59e29..bc5c53a 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 _0xfb8b=['sequelize','exports','STRING'];(function(_0x14637b,_0x1f1073){var _0x493860=function(_0x35471d){while(--_0x35471d){_0x14637b['push'](_0x14637b['shift']());}};_0x493860(++_0x1f1073);}(_0xfb8b,0x114));var _0xbfb8=function(_0x40dea0,_0x2cfa79){_0x40dea0=_0x40dea0-0x0;var _0x2a6ccb=_0xfb8b[_0x40dea0];return _0x2a6ccb;};'use strict';var Sequelize=require(_0xbfb8('0x0'));module[_0xbfb8('0x1')]={'name':{'type':Sequelize[_0xbfb8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65f8=['exports','STRING','sequelize'];(function(_0x200fba,_0x53269f){var _0x29b94d=function(_0x588894){while(--_0x588894){_0x200fba['push'](_0x200fba['shift']());}};_0x29b94d(++_0x53269f);}(_0x65f8,0xc5));var _0x865f=function(_0x5eff7f,_0xb93af2){_0x5eff7f=_0x5eff7f-0x0;var _0x51958a=_0x65f8[_0x5eff7f];return _0x51958a;};'use strict';var Sequelize=require(_0x865f('0x0'));module[_0x865f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x865f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 48d7d40..e48bcab 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 _0xbbac=['filter','merge','VIRTUAL','options','rows','catch','show','params','include','create','update','body','find','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','error','name','ServicenowConfiguration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0xbbac,0x18f));var _0xcbba=function(_0x2d269e,_0x4b2f76){_0x2d269e=_0x2d269e-0x0;var _0x595612=_0xbbac[_0x2d269e];return _0x595612;};'use strict';var emlformat=require(_0xcbba('0x0'));var rimraf=require(_0xcbba('0x1'));var zipdir=require(_0xcbba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbba('0x3'));var moment=require(_0xcbba('0x4'));var BPromise=require(_0xcbba('0x5'));var Mustache=require('mustache');var util=require(_0xcbba('0x6'));var path=require(_0xcbba('0x7'));var sox=require(_0xcbba('0x8'));var csv=require('to-csv');var ejs=require(_0xcbba('0x9'));var fs=require('fs');var fs_extra=require(_0xcbba('0xa'));var _=require(_0xcbba('0xb'));var squel=require(_0xcbba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbba('0xd'));var querystring=require(_0xcbba('0xe'));var Papa=require(_0xcbba('0xf'));var Redis=require(_0xcbba('0x10'));var authService=require(_0xcbba('0x11'));var qs=require(_0xcbba('0x12'));var as=require(_0xcbba('0x13'));var hardwareService=require(_0xcbba('0x14'));var logger=require('../../config/logger')(_0xcbba('0x15'));var utils=require(_0xcbba('0x16'));var config=require(_0xcbba('0x17'));var licenseUtil=require(_0xcbba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dcf48,_0x2800db){_0x2800db=_0x2800db||0xcc;return function(_0x4667eb){if(_0x4667eb){return _0x3dcf48[_0xcbba('0x19')](_0x2800db);}return _0x3dcf48[_0xcbba('0x1a')](_0x2800db)[_0xcbba('0x1b')]();};}function respondWithResult(_0x122614,_0x152cc7){_0x152cc7=_0x152cc7||0xc8;return function(_0x228afc){if(_0x228afc){return _0x122614[_0xcbba('0x1a')](_0x152cc7)[_0xcbba('0x1c')](_0x228afc);}};}function respondWithFilteredResult(_0x3d3f84,_0x14b944){return function(_0x1eb8e8){if(_0x1eb8e8){var _0x3c9630=typeof _0x14b944[_0xcbba('0x1d')]===_0xcbba('0x1e')&&typeof _0x14b944['limit']===_0xcbba('0x1e');var _0x5ee134=_0x1eb8e8[_0xcbba('0x1f')];var _0x33fc68=_0x3c9630?0x0:_0x14b944['offset'];var _0x31d28c=_0x3c9630?_0x1eb8e8['count']:_0x14b944[_0xcbba('0x1d')]+_0x14b944['limit'];var _0x1a4a29;if(_0x31d28c>=_0x5ee134){_0x31d28c=_0x5ee134;_0x1a4a29=0xc8;}else{_0x1a4a29=0xce;}_0x3d3f84[_0xcbba('0x1a')](_0x1a4a29);return _0x3d3f84['set'](_0xcbba('0x20'),_0x33fc68+'-'+_0x31d28c+'/'+_0x5ee134)[_0xcbba('0x1c')](_0x1eb8e8);}return null;};}function patchUpdates(_0x51813f){return function(_0x671985){try{jsonpatch[_0xcbba('0x21')](_0x671985,_0x51813f,!![]);}catch(_0x1f6a9f){return BPromise['reject'](_0x1f6a9f);}return _0x671985[_0xcbba('0x22')]();};}function saveUpdates(_0xe16ba0,_0x351a1e){return function(_0xf663fe){if(_0xf663fe){return _0xf663fe['update'](_0xe16ba0)[_0xcbba('0x23')](function(_0x275f31){return _0x275f31;});}return null;};}function removeEntity(_0x595e31,_0x550445){return function(_0x19fbaf){if(_0x19fbaf){return _0x19fbaf[_0xcbba('0x24')]()[_0xcbba('0x23')](function(){_0x595e31[_0xcbba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1022ce,_0x1084b2){return function(_0x4b3407){if(!_0x4b3407){_0x1022ce[_0xcbba('0x19')](0x194);}return _0x4b3407;};}function handleError(_0x32664d,_0x523331){_0x523331=_0x523331||0x1f4;return function(_0xa7544f){logger[_0xcbba('0x25')](_0xa7544f['stack']);if(_0xa7544f[_0xcbba('0x26')]){delete _0xa7544f['name'];}_0x32664d[_0xcbba('0x1a')](_0x523331)['send'](_0xa7544f);};}exports['index']=function(_0xf23041,_0x16f17e){var _0x48d666={},_0xf6c53c={},_0x390a58={'count':0x0,'rows':[]};var _0x4697df=_['map'](db[_0xcbba('0x27')][_0xcbba('0x28')],function(_0x468d19){return{'name':_0x468d19['fieldName'],'type':_0x468d19['type'][_0xcbba('0x29')]};});_0xf6c53c[_0xcbba('0x2a')]=_[_0xcbba('0x2b')](_0x4697df,_0xcbba('0x26'));_0xf6c53c[_0xcbba('0x2c')]=_[_0xcbba('0x2d')](_0xf23041[_0xcbba('0x2c')]);_0xf6c53c[_0xcbba('0x2e')]=_[_0xcbba('0x2f')](_0xf6c53c['model'],_0xf6c53c[_0xcbba('0x2c')]);_0x48d666[_0xcbba('0x30')]=_[_0xcbba('0x2f')](_0xf6c53c['model'],qs[_0xcbba('0x31')](_0xf23041['query']['fields']));_0x48d666['attributes']=_0x48d666['attributes'][_0xcbba('0x32')]?_0x48d666[_0xcbba('0x30')]:_0xf6c53c['model'];if(!_0xf23041[_0xcbba('0x2c')][_0xcbba('0x33')](_0xcbba('0x34'))){_0x48d666[_0xcbba('0x35')]=qs[_0xcbba('0x35')](_0xf23041[_0xcbba('0x2c')]['limit']);_0x48d666['offset']=qs[_0xcbba('0x1d')](_0xf23041[_0xcbba('0x2c')][_0xcbba('0x1d')]);}_0x48d666['order']=qs[_0xcbba('0x36')](_0xf23041[_0xcbba('0x2c')][_0xcbba('0x36')]);_0x48d666[_0xcbba('0x37')]=qs[_0xcbba('0x2e')](_[_0xcbba('0x38')](_0xf23041[_0xcbba('0x2c')],_0xf6c53c[_0xcbba('0x2e')]),_0x4697df);if(_0xf23041['query'][_0xcbba('0x39')]){_0x48d666[_0xcbba('0x37')]=_[_0xcbba('0x3a')](_0x48d666[_0xcbba('0x37')],{'$or':_[_0xcbba('0x2b')](_0x4697df,function(_0x18518c){if(_0x18518c['type']!==_0xcbba('0x3b')){var _0x3ac868={};_0x3ac868[_0x18518c['name']]={'$like':'%'+_0xf23041['query'][_0xcbba('0x39')]+'%'};return _0x3ac868;}})});}_0x48d666=_[_0xcbba('0x3a')]({},_0x48d666,_0xf23041[_0xcbba('0x3c')]);var _0x4fd745={'where':_0x48d666[_0xcbba('0x37')]};return db[_0xcbba('0x27')][_0xcbba('0x1f')](_0x4fd745)[_0xcbba('0x23')](function(_0x11fcc2){_0x390a58[_0xcbba('0x1f')]=_0x11fcc2;if(_0xf23041['query']['includeAll']){_0x48d666['include']=[{'all':!![]}];}return db[_0xcbba('0x27')]['findAll'](_0x48d666);})[_0xcbba('0x23')](function(_0x177903){_0x390a58[_0xcbba('0x3d')]=_0x177903;return _0x390a58;})[_0xcbba('0x23')](respondWithFilteredResult(_0x16f17e,_0x48d666))[_0xcbba('0x3e')](handleError(_0x16f17e,null));};exports[_0xcbba('0x3f')]=function(_0x495746,_0x5dfe9f){var _0x42c7e8={'raw':![],'where':{'id':_0x495746[_0xcbba('0x40')]['id']}},_0x13ac16={};_0x13ac16[_0xcbba('0x2a')]=_[_0xcbba('0x2d')](db['ServicenowConfiguration'][_0xcbba('0x28')]);_0x13ac16['query']=_[_0xcbba('0x2d')](_0x495746[_0xcbba('0x2c')]);_0x13ac16[_0xcbba('0x2e')]=_[_0xcbba('0x2f')](_0x13ac16[_0xcbba('0x2a')],_0x13ac16[_0xcbba('0x2c')]);_0x42c7e8[_0xcbba('0x30')]=_['intersection'](_0x13ac16[_0xcbba('0x2a')],qs[_0xcbba('0x31')](_0x495746[_0xcbba('0x2c')][_0xcbba('0x31')]));_0x42c7e8[_0xcbba('0x30')]=_0x42c7e8[_0xcbba('0x30')][_0xcbba('0x32')]?_0x42c7e8['attributes']:_0x13ac16[_0xcbba('0x2a')];if(_0x495746[_0xcbba('0x2c')]['includeAll']){_0x42c7e8[_0xcbba('0x41')]=[{'all':!![]}];}_0x42c7e8=_[_0xcbba('0x3a')]({},_0x42c7e8,_0x495746[_0xcbba('0x3c')]);return db[_0xcbba('0x27')]['find'](_0x42c7e8)[_0xcbba('0x23')](handleEntityNotFound(_0x5dfe9f,null))[_0xcbba('0x23')](respondWithResult(_0x5dfe9f,null))[_0xcbba('0x3e')](handleError(_0x5dfe9f,null));};exports[_0xcbba('0x42')]=function(_0x1b1c71,_0x330bb6){return db[_0xcbba('0x27')]['create'](_0x1b1c71['body'],{})['then'](respondWithResult(_0x330bb6,0xc9))['catch'](handleError(_0x330bb6,null));};exports[_0xcbba('0x43')]=function(_0x3f367d,_0x1ebce8){if(_0x3f367d[_0xcbba('0x44')]['id']){delete _0x3f367d[_0xcbba('0x44')]['id'];}return db[_0xcbba('0x27')][_0xcbba('0x45')]({'where':{'id':_0x3f367d['params']['id']}})[_0xcbba('0x23')](handleEntityNotFound(_0x1ebce8,null))['then'](saveUpdates(_0x3f367d[_0xcbba('0x44')],null))['then'](respondWithResult(_0x1ebce8,null))[_0xcbba('0x3e')](handleError(_0x1ebce8,null));};exports[_0xcbba('0x24')]=function(_0x3ff8f8,_0x4765c3){return db[_0xcbba('0x27')][_0xcbba('0x45')]({'where':{'id':_0x3ff8f8[_0xcbba('0x40')]['id']}})[_0xcbba('0x23')](handleEntityNotFound(_0x4765c3,null))[_0xcbba('0x23')](removeEntity(_0x4765c3,null))[_0xcbba('0x3e')](handleError(_0x4765c3,null));};exports[_0xcbba('0x46')]=function(_0x2a7cb0,_0x318f02,_0x3c45cf){var _0x247b06={};var _0x57ed7a={};var _0x240d91;var _0x170189;return db[_0xcbba('0x27')][_0xcbba('0x47')]({'where':{'id':_0x2a7cb0['params']['id']}})[_0xcbba('0x23')](handleEntityNotFound(_0x318f02,null))[_0xcbba('0x23')](function(_0x37c481){if(_0x37c481){_0x240d91=_0x37c481;_0x57ed7a[_0xcbba('0x2a')]=_[_0xcbba('0x2d')](db[_0xcbba('0x48')]['rawAttributes']);_0x57ed7a[_0xcbba('0x2c')]=_[_0xcbba('0x2d')](_0x2a7cb0[_0xcbba('0x2c')]);_0x57ed7a[_0xcbba('0x2e')]=_[_0xcbba('0x2f')](_0x57ed7a[_0xcbba('0x2a')],_0x57ed7a[_0xcbba('0x2c')]);_0x247b06[_0xcbba('0x30')]=_['intersection'](_0x57ed7a[_0xcbba('0x2a')],qs[_0xcbba('0x31')](_0x2a7cb0['query'][_0xcbba('0x31')]));_0x247b06[_0xcbba('0x30')]=_0x247b06[_0xcbba('0x30')][_0xcbba('0x32')]?_0x247b06[_0xcbba('0x30')]:_0x57ed7a['model'];_0x247b06[_0xcbba('0x49')]=qs['sort'](_0x2a7cb0[_0xcbba('0x2c')]['sort']);_0x247b06[_0xcbba('0x37')]=qs[_0xcbba('0x2e')](_[_0xcbba('0x38')](_0x2a7cb0[_0xcbba('0x2c')],_0x57ed7a['filters']));if(_0x2a7cb0['query']['filter']){_0x247b06['where']=_[_0xcbba('0x3a')](_0x247b06[_0xcbba('0x37')],{'$or':_[_0xcbba('0x2b')](_0x247b06['attributes'],function(_0x4e432d){var _0x4484fc={};_0x4484fc[_0x4e432d]={'$like':'%'+_0x2a7cb0[_0xcbba('0x2c')][_0xcbba('0x39')]+'%'};return _0x4484fc;})});}_0x247b06=_[_0xcbba('0x3a')]({},_0x247b06,_0x2a7cb0['options']);return _0x240d91[_0xcbba('0x46')](_0x247b06);}})[_0xcbba('0x23')](function(_0x3225f5){if(_0x3225f5){_0x170189=_0x3225f5[_0xcbba('0x32')];if(!_0x2a7cb0[_0xcbba('0x2c')][_0xcbba('0x33')]('nolimit')){_0x247b06[_0xcbba('0x35')]=qs[_0xcbba('0x35')](_0x2a7cb0[_0xcbba('0x2c')][_0xcbba('0x35')]);_0x247b06['offset']=qs[_0xcbba('0x1d')](_0x2a7cb0['query']['offset']);}return _0x240d91[_0xcbba('0x46')](_0x247b06);}})[_0xcbba('0x23')](function(_0x29a185){if(_0x29a185){return _0x29a185?{'count':_0x170189,'rows':_0x29a185}:null;}})['then'](respondWithResult(_0x318f02,null))[_0xcbba('0x3e')](handleError(_0x318f02,null));};exports[_0xcbba('0x4a')]=function(_0x1c31d8,_0x5a625f,_0x11274a){var _0x844362={};var _0x4cd354={};var _0x2227fb;var _0x58ff39;return db[_0xcbba('0x27')]['findOne']({'where':{'id':_0x1c31d8[_0xcbba('0x40')]['id']}})[_0xcbba('0x23')](handleEntityNotFound(_0x5a625f,null))[_0xcbba('0x23')](function(_0xbc7bfa){if(_0xbc7bfa){_0x2227fb=_0xbc7bfa;_0x4cd354['model']=_[_0xcbba('0x2d')](db['ServicenowField']['rawAttributes']);_0x4cd354[_0xcbba('0x2c')]=_[_0xcbba('0x2d')](_0x1c31d8[_0xcbba('0x2c')]);_0x4cd354[_0xcbba('0x2e')]=_['intersection'](_0x4cd354[_0xcbba('0x2a')],_0x4cd354[_0xcbba('0x2c')]);_0x844362['attributes']=_[_0xcbba('0x2f')](_0x4cd354[_0xcbba('0x2a')],qs[_0xcbba('0x31')](_0x1c31d8['query']['fields']));_0x844362[_0xcbba('0x30')]=_0x844362['attributes']['length']?_0x844362[_0xcbba('0x30')]:_0x4cd354[_0xcbba('0x2a')];_0x844362[_0xcbba('0x49')]=qs[_0xcbba('0x36')](_0x1c31d8[_0xcbba('0x2c')]['sort']);_0x844362[_0xcbba('0x37')]=qs[_0xcbba('0x2e')](_[_0xcbba('0x38')](_0x1c31d8[_0xcbba('0x2c')],_0x4cd354[_0xcbba('0x2e')]));if(_0x1c31d8[_0xcbba('0x2c')][_0xcbba('0x39')]){_0x844362[_0xcbba('0x37')]=_[_0xcbba('0x3a')](_0x844362[_0xcbba('0x37')],{'$or':_[_0xcbba('0x2b')](_0x844362['attributes'],function(_0x10a796){var _0x486ae0={};_0x486ae0[_0x10a796]={'$like':'%'+_0x1c31d8[_0xcbba('0x2c')][_0xcbba('0x39')]+'%'};return _0x486ae0;})});}_0x844362=_[_0xcbba('0x3a')]({},_0x844362,_0x1c31d8[_0xcbba('0x3c')]);return _0x2227fb[_0xcbba('0x4a')](_0x844362);}})[_0xcbba('0x23')](function(_0x22078e){if(_0x22078e){_0x58ff39=_0x22078e[_0xcbba('0x32')];if(!_0x1c31d8[_0xcbba('0x2c')][_0xcbba('0x33')](_0xcbba('0x34'))){_0x844362[_0xcbba('0x35')]=qs['limit'](_0x1c31d8[_0xcbba('0x2c')][_0xcbba('0x35')]);_0x844362[_0xcbba('0x1d')]=qs[_0xcbba('0x1d')](_0x1c31d8['query'][_0xcbba('0x1d')]);}return _0x2227fb[_0xcbba('0x4a')](_0x844362);}})[_0xcbba('0x23')](function(_0x14fb62){if(_0x14fb62){return _0x14fb62?{'count':_0x58ff39,'rows':_0x14fb62}:null;}})[_0xcbba('0x23')](respondWithResult(_0x5a625f,null))['catch'](handleError(_0x5a625f,null));};exports[_0xcbba('0x4b')]=function(_0x112cf5,_0x39322b,_0x5274ef){var _0x386f28={};var _0x3c51f2={};var _0x42fd90;var _0x13c742;return db['ServicenowConfiguration'][_0xcbba('0x47')]({'where':{'id':_0x112cf5[_0xcbba('0x40')]['id']}})[_0xcbba('0x23')](handleEntityNotFound(_0x39322b,null))['then'](function(_0x55c6b3){if(_0x55c6b3){_0x42fd90=_0x55c6b3;_0x3c51f2[_0xcbba('0x2a')]=_[_0xcbba('0x2d')](db[_0xcbba('0x48')][_0xcbba('0x28')]);_0x3c51f2['query']=_[_0xcbba('0x2d')](_0x112cf5[_0xcbba('0x2c')]);_0x3c51f2[_0xcbba('0x2e')]=_[_0xcbba('0x2f')](_0x3c51f2[_0xcbba('0x2a')],_0x3c51f2[_0xcbba('0x2c')]);_0x386f28[_0xcbba('0x30')]=_[_0xcbba('0x2f')](_0x3c51f2[_0xcbba('0x2a')],qs[_0xcbba('0x31')](_0x112cf5[_0xcbba('0x2c')][_0xcbba('0x31')]));_0x386f28[_0xcbba('0x30')]=_0x386f28[_0xcbba('0x30')][_0xcbba('0x32')]?_0x386f28[_0xcbba('0x30')]:_0x3c51f2[_0xcbba('0x2a')];_0x386f28[_0xcbba('0x49')]=qs[_0xcbba('0x36')](_0x112cf5['query'][_0xcbba('0x36')]);_0x386f28[_0xcbba('0x37')]=qs[_0xcbba('0x2e')](_[_0xcbba('0x38')](_0x112cf5['query'],_0x3c51f2['filters']));if(_0x112cf5['query'][_0xcbba('0x39')]){_0x386f28[_0xcbba('0x37')]=_[_0xcbba('0x3a')](_0x386f28[_0xcbba('0x37')],{'$or':_[_0xcbba('0x2b')](_0x386f28[_0xcbba('0x30')],function(_0x27e9aa){var _0x4fe5cd={};_0x4fe5cd[_0x27e9aa]={'$like':'%'+_0x112cf5['query'][_0xcbba('0x39')]+'%'};return _0x4fe5cd;})});}_0x386f28=_['merge']({},_0x386f28,_0x112cf5[_0xcbba('0x3c')]);return _0x42fd90[_0xcbba('0x4b')](_0x386f28);}})[_0xcbba('0x23')](function(_0x20c228){if(_0x20c228){_0x13c742=_0x20c228[_0xcbba('0x32')];if(!_0x112cf5[_0xcbba('0x2c')][_0xcbba('0x33')]('nolimit')){_0x386f28[_0xcbba('0x35')]=qs[_0xcbba('0x35')](_0x112cf5[_0xcbba('0x2c')][_0xcbba('0x35')]);_0x386f28[_0xcbba('0x1d')]=qs[_0xcbba('0x1d')](_0x112cf5[_0xcbba('0x2c')][_0xcbba('0x1d')]);}return _0x42fd90[_0xcbba('0x4b')](_0x386f28);}})['then'](function(_0x3ddeff){if(_0x3ddeff){return _0x3ddeff?{'count':_0x13c742,'rows':_0x3ddeff}:null;}})[_0xcbba('0x23')](respondWithResult(_0x39322b,null))[_0xcbba('0x3e')](handleError(_0x39322b,null));}; \ No newline at end of file +var _0xf335=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','fields','length','find','create','body','params','destroy','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x88b66,_0x4fcf71){var _0x1547ab=function(_0x543c6c){while(--_0x543c6c){_0x88b66['push'](_0x88b66['shift']());}};_0x1547ab(++_0x4fcf71);}(_0xf335,0xe7));var _0x5f33=function(_0x4954e4,_0x5ae5d6){_0x4954e4=_0x4954e4-0x0;var _0x36d83c=_0xf335[_0x4954e4];return _0x36d83c;};'use strict';var emlformat=require(_0x5f33('0x0'));var rimraf=require(_0x5f33('0x1'));var zipdir=require(_0x5f33('0x2'));var jsonpatch=require(_0x5f33('0x3'));var rp=require(_0x5f33('0x4'));var moment=require(_0x5f33('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f33('0x6'));var util=require(_0x5f33('0x7'));var path=require(_0x5f33('0x8'));var sox=require(_0x5f33('0x9'));var csv=require('to-csv');var ejs=require(_0x5f33('0xa'));var fs=require('fs');var fs_extra=require(_0x5f33('0xb'));var _=require('lodash');var squel=require(_0x5f33('0xc'));var crypto=require(_0x5f33('0xd'));var jsforce=require(_0x5f33('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5f33('0xf'));var querystring=require(_0x5f33('0x10'));var Papa=require(_0x5f33('0x11'));var Redis=require(_0x5f33('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5f33('0x13'));var as=require(_0x5f33('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f33('0x15'))(_0x5f33('0x16'));var utils=require(_0x5f33('0x17'));var config=require(_0x5f33('0x18'));var licenseUtil=require(_0x5f33('0x19'));var db=require(_0x5f33('0x1a'))['db'];function respondWithStatusCode(_0x110dc0,_0x55867e){_0x55867e=_0x55867e||0xcc;return function(_0x537711){if(_0x537711){return _0x110dc0[_0x5f33('0x1b')](_0x55867e);}return _0x110dc0['status'](_0x55867e)[_0x5f33('0x1c')]();};}function respondWithResult(_0x5f54f2,_0x5c11d4){_0x5c11d4=_0x5c11d4||0xc8;return function(_0x21c6e9){if(_0x21c6e9){return _0x5f54f2[_0x5f33('0x1d')](_0x5c11d4)[_0x5f33('0x1e')](_0x21c6e9);}};}function respondWithFilteredResult(_0x5cbe18,_0x4898e9){return function(_0x6e308d){if(_0x6e308d){var _0x1829e3=typeof _0x4898e9[_0x5f33('0x1f')]===_0x5f33('0x20')&&typeof _0x4898e9[_0x5f33('0x21')]==='undefined';var _0x3de3fd=_0x6e308d[_0x5f33('0x22')];var _0xda791f=_0x1829e3?0x0:_0x4898e9[_0x5f33('0x1f')];var _0x2cd6ed=_0x1829e3?_0x6e308d[_0x5f33('0x22')]:_0x4898e9['offset']+_0x4898e9['limit'];var _0x51382f;if(_0x2cd6ed>=_0x3de3fd){_0x2cd6ed=_0x3de3fd;_0x51382f=0xc8;}else{_0x51382f=0xce;}_0x5cbe18['status'](_0x51382f);return _0x5cbe18['set'](_0x5f33('0x23'),_0xda791f+'-'+_0x2cd6ed+'/'+_0x3de3fd)[_0x5f33('0x1e')](_0x6e308d);}return null;};}function patchUpdates(_0x3b6cb8){return function(_0x40c960){try{jsonpatch[_0x5f33('0x24')](_0x40c960,_0x3b6cb8,!![]);}catch(_0x46a768){return BPromise[_0x5f33('0x25')](_0x46a768);}return _0x40c960[_0x5f33('0x26')]();};}function saveUpdates(_0x3a0321,_0xf71085){return function(_0x4a91da){if(_0x4a91da){return _0x4a91da[_0x5f33('0x27')](_0x3a0321)[_0x5f33('0x28')](function(_0x275adc){return _0x275adc;});}return null;};}function removeEntity(_0x144660,_0x43d441){return function(_0x28464c){if(_0x28464c){return _0x28464c['destroy']()[_0x5f33('0x28')](function(){_0x144660[_0x5f33('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb5ae,_0x25d2dd){return function(_0x463e28){if(!_0x463e28){_0x1eb5ae[_0x5f33('0x1b')](0x194);}return _0x463e28;};}function handleError(_0x18165b,_0x588c7f){_0x588c7f=_0x588c7f||0x1f4;return function(_0xcb15d9){logger[_0x5f33('0x29')](_0xcb15d9[_0x5f33('0x2a')]);if(_0xcb15d9[_0x5f33('0x2b')]){delete _0xcb15d9['name'];}_0x18165b[_0x5f33('0x1d')](_0x588c7f)[_0x5f33('0x2c')](_0xcb15d9);};}exports[_0x5f33('0x2d')]=function(_0x2c0d05,_0x100e33){var _0x1290b0={},_0x455380={},_0x4183fc={'count':0x0,'rows':[]};var _0x5a3c77=_[_0x5f33('0x2e')](db[_0x5f33('0x2f')][_0x5f33('0x30')],function(_0xbf6492){return{'name':_0xbf6492[_0x5f33('0x31')],'type':_0xbf6492[_0x5f33('0x32')][_0x5f33('0x33')]};});_0x455380[_0x5f33('0x34')]=_['map'](_0x5a3c77,_0x5f33('0x2b'));_0x455380[_0x5f33('0x35')]=_[_0x5f33('0x36')](_0x2c0d05['query']);_0x455380[_0x5f33('0x37')]=_[_0x5f33('0x38')](_0x455380[_0x5f33('0x34')],_0x455380[_0x5f33('0x35')]);_0x1290b0[_0x5f33('0x39')]=_[_0x5f33('0x38')](_0x455380[_0x5f33('0x34')],qs['fields'](_0x2c0d05[_0x5f33('0x35')]['fields']));_0x1290b0[_0x5f33('0x39')]=_0x1290b0[_0x5f33('0x39')]['length']?_0x1290b0['attributes']:_0x455380[_0x5f33('0x34')];if(!_0x2c0d05['query']['hasOwnProperty'](_0x5f33('0x3a'))){_0x1290b0[_0x5f33('0x21')]=qs[_0x5f33('0x21')](_0x2c0d05[_0x5f33('0x35')][_0x5f33('0x21')]);_0x1290b0[_0x5f33('0x1f')]=qs[_0x5f33('0x1f')](_0x2c0d05[_0x5f33('0x35')][_0x5f33('0x1f')]);}_0x1290b0[_0x5f33('0x3b')]=qs[_0x5f33('0x3c')](_0x2c0d05[_0x5f33('0x35')][_0x5f33('0x3c')]);_0x1290b0['where']=qs[_0x5f33('0x37')](_[_0x5f33('0x3d')](_0x2c0d05[_0x5f33('0x35')],_0x455380[_0x5f33('0x37')]),_0x5a3c77);if(_0x2c0d05[_0x5f33('0x35')]['filter']){_0x1290b0[_0x5f33('0x3e')]=_[_0x5f33('0x3f')](_0x1290b0[_0x5f33('0x3e')],{'$or':_['map'](_0x5a3c77,function(_0x1e04e6){if(_0x1e04e6[_0x5f33('0x32')]!==_0x5f33('0x40')){var _0x1f6a5d={};_0x1f6a5d[_0x1e04e6[_0x5f33('0x2b')]]={'$like':'%'+_0x2c0d05['query'][_0x5f33('0x41')]+'%'};return _0x1f6a5d;}})});}_0x1290b0=_[_0x5f33('0x3f')]({},_0x1290b0,_0x2c0d05[_0x5f33('0x42')]);var _0x45d8fd={'where':_0x1290b0[_0x5f33('0x3e')]};return db['ServicenowConfiguration'][_0x5f33('0x22')](_0x45d8fd)[_0x5f33('0x28')](function(_0xa1e140){_0x4183fc[_0x5f33('0x22')]=_0xa1e140;if(_0x2c0d05[_0x5f33('0x35')][_0x5f33('0x43')]){_0x1290b0['include']=[{'all':!![]}];}return db[_0x5f33('0x2f')][_0x5f33('0x44')](_0x1290b0);})[_0x5f33('0x28')](function(_0x106a53){_0x4183fc['rows']=_0x106a53;return _0x4183fc;})[_0x5f33('0x28')](respondWithFilteredResult(_0x100e33,_0x1290b0))[_0x5f33('0x45')](handleError(_0x100e33,null));};exports[_0x5f33('0x46')]=function(_0x3eac76,_0x41a27f){var _0x193485={'raw':![],'where':{'id':_0x3eac76['params']['id']}},_0x72993c={};_0x72993c['model']=_[_0x5f33('0x36')](db['ServicenowConfiguration'][_0x5f33('0x30')]);_0x72993c[_0x5f33('0x35')]=_[_0x5f33('0x36')](_0x3eac76[_0x5f33('0x35')]);_0x72993c[_0x5f33('0x37')]=_[_0x5f33('0x38')](_0x72993c[_0x5f33('0x34')],_0x72993c[_0x5f33('0x35')]);_0x193485['attributes']=_['intersection'](_0x72993c[_0x5f33('0x34')],qs[_0x5f33('0x47')](_0x3eac76['query'][_0x5f33('0x47')]));_0x193485[_0x5f33('0x39')]=_0x193485['attributes'][_0x5f33('0x48')]?_0x193485['attributes']:_0x72993c[_0x5f33('0x34')];if(_0x3eac76[_0x5f33('0x35')][_0x5f33('0x43')]){_0x193485['include']=[{'all':!![]}];}_0x193485=_[_0x5f33('0x3f')]({},_0x193485,_0x3eac76[_0x5f33('0x42')]);return db[_0x5f33('0x2f')][_0x5f33('0x49')](_0x193485)[_0x5f33('0x28')](handleEntityNotFound(_0x41a27f,null))[_0x5f33('0x28')](respondWithResult(_0x41a27f,null))[_0x5f33('0x45')](handleError(_0x41a27f,null));};exports[_0x5f33('0x4a')]=function(_0x5dd342,_0x47b739){return db[_0x5f33('0x2f')]['create'](_0x5dd342[_0x5f33('0x4b')],{})[_0x5f33('0x28')](respondWithResult(_0x47b739,0xc9))[_0x5f33('0x45')](handleError(_0x47b739,null));};exports['update']=function(_0x14686d,_0x3242eb){if(_0x14686d['body']['id']){delete _0x14686d[_0x5f33('0x4b')]['id'];}return db[_0x5f33('0x2f')][_0x5f33('0x49')]({'where':{'id':_0x14686d[_0x5f33('0x4c')]['id']}})[_0x5f33('0x28')](handleEntityNotFound(_0x3242eb,null))[_0x5f33('0x28')](saveUpdates(_0x14686d[_0x5f33('0x4b')],null))['then'](respondWithResult(_0x3242eb,null))[_0x5f33('0x45')](handleError(_0x3242eb,null));};exports[_0x5f33('0x4d')]=function(_0x255713,_0x3e7668){return db[_0x5f33('0x2f')][_0x5f33('0x49')]({'where':{'id':_0x255713[_0x5f33('0x4c')]['id']}})[_0x5f33('0x28')](handleEntityNotFound(_0x3e7668,null))[_0x5f33('0x28')](removeEntity(_0x3e7668,null))['catch'](handleError(_0x3e7668,null));};exports[_0x5f33('0x4e')]=function(_0x23f501,_0x4319c6,_0x9512dd){var _0x991512={};var _0xa12e3a={};var _0xc56826;var _0x4be7f7;return db[_0x5f33('0x2f')][_0x5f33('0x4f')]({'where':{'id':_0x23f501[_0x5f33('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4319c6,null))[_0x5f33('0x28')](function(_0x21a0d3){if(_0x21a0d3){_0xc56826=_0x21a0d3;_0xa12e3a[_0x5f33('0x34')]=_[_0x5f33('0x36')](db['ServicenowField'][_0x5f33('0x30')]);_0xa12e3a['query']=_[_0x5f33('0x36')](_0x23f501[_0x5f33('0x35')]);_0xa12e3a[_0x5f33('0x37')]=_[_0x5f33('0x38')](_0xa12e3a[_0x5f33('0x34')],_0xa12e3a[_0x5f33('0x35')]);_0x991512[_0x5f33('0x39')]=_[_0x5f33('0x38')](_0xa12e3a[_0x5f33('0x34')],qs['fields'](_0x23f501[_0x5f33('0x35')]['fields']));_0x991512[_0x5f33('0x39')]=_0x991512['attributes'][_0x5f33('0x48')]?_0x991512[_0x5f33('0x39')]:_0xa12e3a[_0x5f33('0x34')];_0x991512[_0x5f33('0x3b')]=qs[_0x5f33('0x3c')](_0x23f501[_0x5f33('0x35')][_0x5f33('0x3c')]);_0x991512[_0x5f33('0x3e')]=qs[_0x5f33('0x37')](_[_0x5f33('0x3d')](_0x23f501[_0x5f33('0x35')],_0xa12e3a[_0x5f33('0x37')]));if(_0x23f501[_0x5f33('0x35')][_0x5f33('0x41')]){_0x991512[_0x5f33('0x3e')]=_['merge'](_0x991512[_0x5f33('0x3e')],{'$or':_[_0x5f33('0x2e')](_0x991512['attributes'],function(_0x7f19e7){var _0xd4f8ab={};_0xd4f8ab[_0x7f19e7]={'$like':'%'+_0x23f501[_0x5f33('0x35')]['filter']+'%'};return _0xd4f8ab;})});}_0x991512=_[_0x5f33('0x3f')]({},_0x991512,_0x23f501[_0x5f33('0x42')]);return _0xc56826['getFields'](_0x991512);}})[_0x5f33('0x28')](function(_0x5b1290){if(_0x5b1290){_0x4be7f7=_0x5b1290[_0x5f33('0x48')];if(!_0x23f501[_0x5f33('0x35')][_0x5f33('0x50')](_0x5f33('0x3a'))){_0x991512[_0x5f33('0x21')]=qs[_0x5f33('0x21')](_0x23f501[_0x5f33('0x35')][_0x5f33('0x21')]);_0x991512[_0x5f33('0x1f')]=qs[_0x5f33('0x1f')](_0x23f501['query'][_0x5f33('0x1f')]);}return _0xc56826[_0x5f33('0x4e')](_0x991512);}})['then'](function(_0x2e9093){if(_0x2e9093){return _0x2e9093?{'count':_0x4be7f7,'rows':_0x2e9093}:null;}})[_0x5f33('0x28')](respondWithResult(_0x4319c6,null))[_0x5f33('0x45')](handleError(_0x4319c6,null));};exports[_0x5f33('0x51')]=function(_0x30fd4e,_0x2bcae2,_0x404a81){var _0x5d75b8={};var _0x47fc65={};var _0x413b7b;var _0xf42c87;return db[_0x5f33('0x2f')][_0x5f33('0x4f')]({'where':{'id':_0x30fd4e[_0x5f33('0x4c')]['id']}})[_0x5f33('0x28')](handleEntityNotFound(_0x2bcae2,null))['then'](function(_0x23b5ba){if(_0x23b5ba){_0x413b7b=_0x23b5ba;_0x47fc65[_0x5f33('0x34')]=_[_0x5f33('0x36')](db['ServicenowField']['rawAttributes']);_0x47fc65[_0x5f33('0x35')]=_[_0x5f33('0x36')](_0x30fd4e[_0x5f33('0x35')]);_0x47fc65[_0x5f33('0x37')]=_['intersection'](_0x47fc65[_0x5f33('0x34')],_0x47fc65[_0x5f33('0x35')]);_0x5d75b8[_0x5f33('0x39')]=_['intersection'](_0x47fc65[_0x5f33('0x34')],qs[_0x5f33('0x47')](_0x30fd4e['query']['fields']));_0x5d75b8[_0x5f33('0x39')]=_0x5d75b8[_0x5f33('0x39')][_0x5f33('0x48')]?_0x5d75b8[_0x5f33('0x39')]:_0x47fc65[_0x5f33('0x34')];_0x5d75b8['order']=qs[_0x5f33('0x3c')](_0x30fd4e[_0x5f33('0x35')][_0x5f33('0x3c')]);_0x5d75b8[_0x5f33('0x3e')]=qs['filters'](_['pick'](_0x30fd4e[_0x5f33('0x35')],_0x47fc65[_0x5f33('0x37')]));if(_0x30fd4e[_0x5f33('0x35')][_0x5f33('0x41')]){_0x5d75b8['where']=_[_0x5f33('0x3f')](_0x5d75b8['where'],{'$or':_[_0x5f33('0x2e')](_0x5d75b8[_0x5f33('0x39')],function(_0x28ccfd){var _0x5b39ed={};_0x5b39ed[_0x28ccfd]={'$like':'%'+_0x30fd4e[_0x5f33('0x35')][_0x5f33('0x41')]+'%'};return _0x5b39ed;})});}_0x5d75b8=_[_0x5f33('0x3f')]({},_0x5d75b8,_0x30fd4e[_0x5f33('0x42')]);return _0x413b7b[_0x5f33('0x51')](_0x5d75b8);}})[_0x5f33('0x28')](function(_0x4bdcbc){if(_0x4bdcbc){_0xf42c87=_0x4bdcbc[_0x5f33('0x48')];if(!_0x30fd4e['query'][_0x5f33('0x50')](_0x5f33('0x3a'))){_0x5d75b8[_0x5f33('0x21')]=qs[_0x5f33('0x21')](_0x30fd4e['query']['limit']);_0x5d75b8[_0x5f33('0x1f')]=qs[_0x5f33('0x1f')](_0x30fd4e[_0x5f33('0x35')]['offset']);}return _0x413b7b[_0x5f33('0x51')](_0x5d75b8);}})['then'](function(_0x129f25){if(_0x129f25){return _0x129f25?{'count':_0xf42c87,'rows':_0x129f25}:null;}})[_0x5f33('0x28')](respondWithResult(_0x2bcae2,null))[_0x5f33('0x45')](handleError(_0x2bcae2,null));};exports[_0x5f33('0x52')]=function(_0x3ab247,_0x2bf666,_0x282837){var _0x51362c={};var _0x1d78d2={};var _0x40d552;var _0x1d7996;return db['ServicenowConfiguration'][_0x5f33('0x4f')]({'where':{'id':_0x3ab247[_0x5f33('0x4c')]['id']}})[_0x5f33('0x28')](handleEntityNotFound(_0x2bf666,null))[_0x5f33('0x28')](function(_0x202fe0){if(_0x202fe0){_0x40d552=_0x202fe0;_0x1d78d2[_0x5f33('0x34')]=_['keys'](db[_0x5f33('0x53')][_0x5f33('0x30')]);_0x1d78d2['query']=_[_0x5f33('0x36')](_0x3ab247[_0x5f33('0x35')]);_0x1d78d2[_0x5f33('0x37')]=_[_0x5f33('0x38')](_0x1d78d2['model'],_0x1d78d2[_0x5f33('0x35')]);_0x51362c['attributes']=_[_0x5f33('0x38')](_0x1d78d2[_0x5f33('0x34')],qs[_0x5f33('0x47')](_0x3ab247[_0x5f33('0x35')][_0x5f33('0x47')]));_0x51362c[_0x5f33('0x39')]=_0x51362c[_0x5f33('0x39')][_0x5f33('0x48')]?_0x51362c[_0x5f33('0x39')]:_0x1d78d2[_0x5f33('0x34')];_0x51362c[_0x5f33('0x3b')]=qs[_0x5f33('0x3c')](_0x3ab247[_0x5f33('0x35')][_0x5f33('0x3c')]);_0x51362c[_0x5f33('0x3e')]=qs[_0x5f33('0x37')](_[_0x5f33('0x3d')](_0x3ab247['query'],_0x1d78d2['filters']));if(_0x3ab247[_0x5f33('0x35')]['filter']){_0x51362c[_0x5f33('0x3e')]=_[_0x5f33('0x3f')](_0x51362c[_0x5f33('0x3e')],{'$or':_[_0x5f33('0x2e')](_0x51362c[_0x5f33('0x39')],function(_0xa4485a){var _0x22f2df={};_0x22f2df[_0xa4485a]={'$like':'%'+_0x3ab247[_0x5f33('0x35')][_0x5f33('0x41')]+'%'};return _0x22f2df;})});}_0x51362c=_[_0x5f33('0x3f')]({},_0x51362c,_0x3ab247[_0x5f33('0x42')]);return _0x40d552[_0x5f33('0x52')](_0x51362c);}})[_0x5f33('0x28')](function(_0x4aa181){if(_0x4aa181){_0x1d7996=_0x4aa181[_0x5f33('0x48')];if(!_0x3ab247[_0x5f33('0x35')][_0x5f33('0x50')](_0x5f33('0x3a'))){_0x51362c[_0x5f33('0x21')]=qs['limit'](_0x3ab247['query'][_0x5f33('0x21')]);_0x51362c['offset']=qs[_0x5f33('0x1f')](_0x3ab247[_0x5f33('0x35')][_0x5f33('0x1f')]);}return _0x40d552[_0x5f33('0x52')](_0x51362c);}})['then'](function(_0x11f025){if(_0x11f025){return _0x11f025?{'count':_0x1d7996,'rows':_0x11f025}:null;}})[_0x5f33('0x28')](respondWithResult(_0x2bf666,null))[_0x5f33('0x45')](handleError(_0x2bf666,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0e512fd..3658f3d 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ServicenowConfiguration'];(function(_0x5f24dd,_0x3538dd){var _0x2d8f94=function(_0x50ed30){while(--_0x50ed30){_0x5f24dd['push'](_0x5f24dd['shift']());}};_0x2d8f94(++_0x3538dd);}(_0x8f4c,0x113));var _0xc8f4=function(_0x20352e,_0x1ee2ac){_0x20352e=_0x20352e-0x0;var _0x5a9319=_0x8f4c[_0x20352e];return _0x5a9319;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x570f=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x5cc457,_0x21b673){var _0x55aaf5=function(_0x166f2b){while(--_0x166f2b){_0x5cc457['push'](_0x5cc457['shift']());}};_0x55aaf5(++_0x21b673);}(_0x570f,0x152));var _0xf570=function(_0xcdd749,_0x19f007){_0xcdd749=_0xcdd749-0x0;var _0xa16c06=_0x570f[_0xcdd749];return _0xa16c06;};'use strict';var _=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var logger=require(_0xf570('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf570('0x3'));var rp=require(_0xf570('0x4'));var fs=require('fs');var path=require(_0xf570('0x5'));var rimraf=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));var attributes=require(_0xf570('0x8'));module[_0xf570('0x9')]=function(_0x5ce063,_0x2ec4ba){return _0x5ce063['define'](_0xf570('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index ffd1c98..579198a 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 _0x3dec=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x535b26,_0xeb426b){var _0x1ec755=function(_0x188fb9){while(--_0x188fb9){_0x535b26['push'](_0x535b26['shift']());}};_0x1ec755(++_0xeb426b);}(_0x3dec,0x8e));var _0xc3de=function(_0x21fc68,_0x459828){_0x21fc68=_0x21fc68-0x0;var _0x3561e1=_0x3dec[_0x21fc68];return _0x3561e1;};'use strict';var _=require(_0xc3de('0x0'));var util=require(_0xc3de('0x1'));var moment=require(_0xc3de('0x2'));var BPromise=require(_0xc3de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3de('0x4'))['db'];var utils=require(_0xc3de('0x5'));var logger=require('../../config/logger')(_0xc3de('0x6'));var config=require(_0xc3de('0x7'));var jayson=require(_0xc3de('0x8'));var client=jayson[_0xc3de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225c8e,_0x2c79f3,_0x295b66){return new BPromise(function(_0x47957a,_0x1cf2c9){return client[_0xc3de('0xa')](_0x225c8e,_0x295b66)[_0xc3de('0xb')](function(_0x1d86ce){logger[_0xc3de('0xc')](_0xc3de('0xd'),_0x2c79f3,_0xc3de('0xe'));logger[_0xc3de('0xf')](_0xc3de('0x10'),_0x2c79f3,'request\x20sent',JSON['stringify'](_0x1d86ce));if(_0x1d86ce[_0xc3de('0x11')]){if(_0x1d86ce[_0xc3de('0x11')][_0xc3de('0x12')]===0x1f4){logger[_0xc3de('0x11')](_0xc3de('0xd'),_0x2c79f3,_0x1d86ce[_0xc3de('0x11')][_0xc3de('0x13')]);return _0x1cf2c9(_0x1d86ce[_0xc3de('0x11')][_0xc3de('0x13')]);}logger[_0xc3de('0x11')](_0xc3de('0xd'),_0x2c79f3,_0x1d86ce['error'][_0xc3de('0x13')]);return _0x47957a(_0x1d86ce['error'][_0xc3de('0x13')]);}else{logger[_0xc3de('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c79f3,_0xc3de('0xe'));_0x47957a(_0x1d86ce[_0xc3de('0x14')][_0xc3de('0x13')]);}})[_0xc3de('0x15')](function(_0x26e440){logger[_0xc3de('0x11')](_0xc3de('0xd'),_0x2c79f3,_0x26e440);_0x1cf2c9(_0x26e440);});});} \ No newline at end of file +var _0x8f0a=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4f70bf,_0x552b14){var _0xde77ad=function(_0x29b9bb){while(--_0x29b9bb){_0x4f70bf['push'](_0x4f70bf['shift']());}};_0xde77ad(++_0x552b14);}(_0x8f0a,0x1e4));var _0xa8f0=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x8f0a[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0xa8f0('0x0'));var util=require(_0xa8f0('0x1'));var moment=require(_0xa8f0('0x2'));var BPromise=require(_0xa8f0('0x3'));var rs=require(_0xa8f0('0x4'));var fs=require('fs');var Redis=require(_0xa8f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa8f0('0x6'))(_0xa8f0('0x7'));var config=require(_0xa8f0('0x8'));var jayson=require(_0xa8f0('0x9'));var client=jayson['client'][_0xa8f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422b9e,_0x5224f1,_0x44b60c){return new BPromise(function(_0x46a63e,_0x33989f){return client[_0xa8f0('0xb')](_0x422b9e,_0x44b60c)[_0xa8f0('0xc')](function(_0x479c72){logger['info'](_0xa8f0('0xd'),_0x5224f1,'request\x20sent');logger[_0xa8f0('0xe')](_0xa8f0('0xf'),_0x5224f1,'request\x20sent',JSON[_0xa8f0('0x10')](_0x479c72));if(_0x479c72[_0xa8f0('0x11')]){if(_0x479c72[_0xa8f0('0x11')][_0xa8f0('0x12')]===0x1f4){logger[_0xa8f0('0x11')](_0xa8f0('0xd'),_0x5224f1,_0x479c72[_0xa8f0('0x11')][_0xa8f0('0x13')]);return _0x33989f(_0x479c72['error']['message']);}logger[_0xa8f0('0x11')](_0xa8f0('0xd'),_0x5224f1,_0x479c72['error'][_0xa8f0('0x13')]);return _0x46a63e(_0x479c72['error'][_0xa8f0('0x13')]);}else{logger[_0xa8f0('0x14')](_0xa8f0('0xd'),_0x5224f1,'request\x20sent');_0x46a63e(_0x479c72[_0xa8f0('0x15')][_0xa8f0('0x13')]);}})['catch'](function(_0x2f637a){logger[_0xa8f0('0x11')](_0xa8f0('0xd'),_0x5224f1,_0x2f637a);_0x33989f(_0x2f637a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 52519c4..965e197 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 _0x00be=['isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id'];(function(_0x14a83a,_0x54500b){var _0x474b3d=function(_0x252db6){while(--_0x252db6){_0x14a83a['push'](_0x14a83a['shift']());}};_0x474b3d(++_0x54500b);}(_0x00be,0xe3));var _0xe00b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x00be[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xe00b('0x0'));var util=require(_0xe00b('0x1'));var path=require(_0xe00b('0x2'));var timeout=require(_0xe00b('0x3'));var express=require(_0xe00b('0x4'));var router=express['Router']();var fs_extra=require(_0xe00b('0x5'));var auth=require(_0xe00b('0x6'));var interaction=require(_0xe00b('0x7'));var config=require(_0xe00b('0x8'));var controller=require(_0xe00b('0x9'));router[_0xe00b('0xa')]('/',auth['isAuthenticated'](),controller[_0xe00b('0xb')]);router[_0xe00b('0xa')](_0xe00b('0xc'),auth[_0xe00b('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe00b('0xc'),auth[_0xe00b('0xd')](),controller[_0xe00b('0xe')]);router['delete'](_0xe00b('0xc'),auth['isAuthenticated'](),controller[_0xe00b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x74e0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x322970,_0x17b718){var _0x2b1ab4=function(_0x30ef18){while(--_0x30ef18){_0x322970['push'](_0x322970['shift']());}};_0x2b1ab4(++_0x17b718);}(_0x74e0,0xcd));var _0x074e=function(_0x59777e,_0x1f33d0){_0x59777e=_0x59777e-0x0;var _0x39c12b=_0x74e0[_0x59777e];return _0x39c12b;};'use strict';var multer=require(_0x074e('0x0'));var util=require(_0x074e('0x1'));var path=require(_0x074e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x074e('0x3')]();var fs_extra=require(_0x074e('0x4'));var auth=require(_0x074e('0x5'));var interaction=require(_0x074e('0x6'));var config=require(_0x074e('0x7'));var controller=require(_0x074e('0x8'));router['get']('/',auth[_0x074e('0x9')](),controller[_0x074e('0xa')]);router['get']('/:id',auth[_0x074e('0x9')](),controller['show']);router[_0x074e('0xb')]('/',auth[_0x074e('0x9')](),controller[_0x074e('0xc')]);router[_0x074e('0xd')](_0x074e('0xe'),auth[_0x074e('0x9')](),controller[_0x074e('0xf')]);router[_0x074e('0x10')](_0x074e('0xe'),auth[_0x074e('0x9')](),controller[_0x074e('0x11')]);module[_0x074e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2bc064b..7bc6ee2 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 _0xb3bf=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x45f723,_0x2dc573){var _0x516734=function(_0x19453f){while(--_0x19453f){_0x45f723['push'](_0x45f723['shift']());}};_0x516734(++_0x2dc573);}(_0xb3bf,0x13f));var _0xfb3b=function(_0x3b4ce6,_0x5c5d3f){_0x3b4ce6=_0x3b4ce6-0x0;var _0x3098ed=_0xb3bf[_0x3b4ce6];return _0x3098ed;};'use strict';var Sequelize=require(_0xfb3b('0x0'));module[_0xfb3b('0x1')]={'type':{'type':Sequelize[_0xfb3b('0x2')](_0xfb3b('0x3'),'variable',_0xfb3b('0x4'),_0xfb3b('0x5'),_0xfb3b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfb3b('0x7')]},'keyType':{'type':Sequelize[_0xfb3b('0x2')](_0xfb3b('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfb3b('0x7')]},'idField':{'type':Sequelize[_0xfb3b('0x7')]},'nameField':{'type':Sequelize[_0xfb3b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb3b('0x7')]}}; \ No newline at end of file +var _0xd671=['STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x185d1e,_0x5ad33b){var _0x211a49=function(_0x4903ac){while(--_0x4903ac){_0x185d1e['push'](_0x185d1e['shift']());}};_0x211a49(++_0x5ad33b);}(_0xd671,0x1c4));var _0x1d67=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd671[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x1d67('0x0'));module['exports']={'type':{'type':Sequelize[_0x1d67('0x1')]('string',_0x1d67('0x2'),_0x1d67('0x3'),_0x1d67('0x4'),_0x1d67('0x5')),'defaultValue':_0x1d67('0x6')},'content':{'type':Sequelize[_0x1d67('0x7')]},'key':{'type':Sequelize[_0x1d67('0x7')]},'keyType':{'type':Sequelize[_0x1d67('0x1')](_0x1d67('0x6'),_0x1d67('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x1d67('0x7')]},'idField':{'type':Sequelize[_0x1d67('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1d67('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d009ad3..1c57e0a 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 _0x7b0f=['send','index','map','ServicenowField','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','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','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','error','stack','name'];(function(_0x4437db,_0xb4e66a){var _0x128b3e=function(_0x2f48ab){while(--_0x2f48ab){_0x4437db['push'](_0x4437db['shift']());}};_0x128b3e(++_0xb4e66a);}(_0x7b0f,0x1ce));var _0xf7b0=function(_0x40ea15,_0x3853b5){_0x40ea15=_0x40ea15-0x0;var _0x20d4d9=_0x7b0f[_0x40ea15];return _0x20d4d9;};'use strict';var emlformat=require(_0xf7b0('0x0'));var rimraf=require(_0xf7b0('0x1'));var zipdir=require(_0xf7b0('0x2'));var jsonpatch=require(_0xf7b0('0x3'));var rp=require('request-promise');var moment=require(_0xf7b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7b0('0x5'));var util=require(_0xf7b0('0x6'));var path=require(_0xf7b0('0x7'));var sox=require('sox');var csv=require(_0xf7b0('0x8'));var ejs=require(_0xf7b0('0x9'));var fs=require('fs');var fs_extra=require(_0xf7b0('0xa'));var _=require(_0xf7b0('0xb'));var squel=require('squel');var crypto=require(_0xf7b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7b0('0x8'));var querystring=require(_0xf7b0('0xd'));var Papa=require(_0xf7b0('0xe'));var Redis=require(_0xf7b0('0xf'));var authService=require(_0xf7b0('0x10'));var qs=require(_0xf7b0('0x11'));var as=require(_0xf7b0('0x12'));var hardwareService=require(_0xf7b0('0x13'));var logger=require(_0xf7b0('0x14'))(_0xf7b0('0x15'));var utils=require(_0xf7b0('0x16'));var config=require(_0xf7b0('0x17'));var licenseUtil=require(_0xf7b0('0x18'));var db=require(_0xf7b0('0x19'))['db'];function respondWithStatusCode(_0x532c4b,_0x37ca30){_0x37ca30=_0x37ca30||0xcc;return function(_0x382df0){if(_0x382df0){return _0x532c4b[_0xf7b0('0x1a')](_0x37ca30);}return _0x532c4b['status'](_0x37ca30)[_0xf7b0('0x1b')]();};}function respondWithResult(_0x3c842b,_0x479101){_0x479101=_0x479101||0xc8;return function(_0x1546db){if(_0x1546db){return _0x3c842b[_0xf7b0('0x1c')](_0x479101)[_0xf7b0('0x1d')](_0x1546db);}};}function respondWithFilteredResult(_0x5ca6f1,_0x1c42d6){return function(_0x5b9518){if(_0x5b9518){var _0x568a7d=typeof _0x1c42d6[_0xf7b0('0x1e')]===_0xf7b0('0x1f')&&typeof _0x1c42d6['limit']===_0xf7b0('0x1f');var _0x3c6163=_0x5b9518['count'];var _0x37c834=_0x568a7d?0x0:_0x1c42d6[_0xf7b0('0x1e')];var _0x2b71c6=_0x568a7d?_0x5b9518[_0xf7b0('0x20')]:_0x1c42d6[_0xf7b0('0x1e')]+_0x1c42d6[_0xf7b0('0x21')];var _0x255a70;if(_0x2b71c6>=_0x3c6163){_0x2b71c6=_0x3c6163;_0x255a70=0xc8;}else{_0x255a70=0xce;}_0x5ca6f1[_0xf7b0('0x1c')](_0x255a70);return _0x5ca6f1[_0xf7b0('0x22')](_0xf7b0('0x23'),_0x37c834+'-'+_0x2b71c6+'/'+_0x3c6163)['json'](_0x5b9518);}return null;};}function patchUpdates(_0x2f73c3){return function(_0x52e0cf){try{jsonpatch[_0xf7b0('0x24')](_0x52e0cf,_0x2f73c3,!![]);}catch(_0x4d5f8c){return BPromise['reject'](_0x4d5f8c);}return _0x52e0cf[_0xf7b0('0x25')]();};}function saveUpdates(_0x3c46be,_0x40edfb){return function(_0x5a70cc){if(_0x5a70cc){return _0x5a70cc['update'](_0x3c46be)['then'](function(_0x210a3b){return _0x210a3b;});}return null;};}function removeEntity(_0x36e02d,_0x31acff){return function(_0x5d7444){if(_0x5d7444){return _0x5d7444[_0xf7b0('0x26')]()['then'](function(){_0x36e02d[_0xf7b0('0x1c')](0xcc)[_0xf7b0('0x1b')]();});}};}function handleEntityNotFound(_0x1abd85,_0x3ffff7){return function(_0x16d636){if(!_0x16d636){_0x1abd85[_0xf7b0('0x1a')](0x194);}return _0x16d636;};}function handleError(_0x364bca,_0x1943bc){_0x1943bc=_0x1943bc||0x1f4;return function(_0x1fb7ab){logger[_0xf7b0('0x27')](_0x1fb7ab[_0xf7b0('0x28')]);if(_0x1fb7ab[_0xf7b0('0x29')]){delete _0x1fb7ab[_0xf7b0('0x29')];}_0x364bca[_0xf7b0('0x1c')](_0x1943bc)[_0xf7b0('0x2a')](_0x1fb7ab);};}exports[_0xf7b0('0x2b')]=function(_0x1c81e7,_0x4de9b4){var _0xf9bfb={},_0x458778={},_0xd3c33d={'count':0x0,'rows':[]};var _0x1c9327=_[_0xf7b0('0x2c')](db[_0xf7b0('0x2d')][_0xf7b0('0x2e')],function(_0xcac160){return{'name':_0xcac160[_0xf7b0('0x2f')],'type':_0xcac160['type']['key']};});_0x458778[_0xf7b0('0x30')]=_[_0xf7b0('0x2c')](_0x1c9327,_0xf7b0('0x29'));_0x458778['query']=_[_0xf7b0('0x31')](_0x1c81e7['query']);_0x458778[_0xf7b0('0x32')]=_['intersection'](_0x458778[_0xf7b0('0x30')],_0x458778[_0xf7b0('0x33')]);_0xf9bfb[_0xf7b0('0x34')]=_[_0xf7b0('0x35')](_0x458778['model'],qs[_0xf7b0('0x36')](_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x36')]));_0xf9bfb[_0xf7b0('0x34')]=_0xf9bfb[_0xf7b0('0x34')]['length']?_0xf9bfb[_0xf7b0('0x34')]:_0x458778[_0xf7b0('0x30')];if(!_0x1c81e7[_0xf7b0('0x33')]['hasOwnProperty']('nolimit')){_0xf9bfb['limit']=qs['limit'](_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x21')]);_0xf9bfb[_0xf7b0('0x1e')]=qs[_0xf7b0('0x1e')](_0x1c81e7[_0xf7b0('0x33')]['offset']);}_0xf9bfb[_0xf7b0('0x37')]=qs[_0xf7b0('0x38')](_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x38')]);_0xf9bfb[_0xf7b0('0x39')]=qs[_0xf7b0('0x32')](_['pick'](_0x1c81e7['query'],_0x458778[_0xf7b0('0x32')]),_0x1c9327);if(_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x3a')]){_0xf9bfb[_0xf7b0('0x39')]=_[_0xf7b0('0x3b')](_0xf9bfb[_0xf7b0('0x39')],{'$or':_[_0xf7b0('0x2c')](_0x1c9327,function(_0xd9ff1){if(_0xd9ff1[_0xf7b0('0x3c')]!==_0xf7b0('0x3d')){var _0x30213c={};_0x30213c[_0xd9ff1[_0xf7b0('0x29')]]={'$like':'%'+_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x3a')]+'%'};return _0x30213c;}})});}_0xf9bfb=_['merge']({},_0xf9bfb,_0x1c81e7[_0xf7b0('0x3e')]);var _0x126ac3={'where':_0xf9bfb[_0xf7b0('0x39')]};return db[_0xf7b0('0x2d')][_0xf7b0('0x20')](_0x126ac3)['then'](function(_0x37a8a6){_0xd3c33d['count']=_0x37a8a6;if(_0x1c81e7[_0xf7b0('0x33')][_0xf7b0('0x3f')]){_0xf9bfb[_0xf7b0('0x40')]=[{'all':!![]}];}return db[_0xf7b0('0x2d')][_0xf7b0('0x41')](_0xf9bfb);})[_0xf7b0('0x42')](function(_0x1104a4){_0xd3c33d['rows']=_0x1104a4;return _0xd3c33d;})['then'](respondWithFilteredResult(_0x4de9b4,_0xf9bfb))[_0xf7b0('0x43')](handleError(_0x4de9b4,null));};exports['show']=function(_0x3e47ab,_0x44bc59){var _0x4034db={'raw':!![],'where':{'id':_0x3e47ab[_0xf7b0('0x44')]['id']}},_0x2c4757={};_0x2c4757['model']=_[_0xf7b0('0x31')](db[_0xf7b0('0x2d')][_0xf7b0('0x2e')]);_0x2c4757['query']=_['keys'](_0x3e47ab[_0xf7b0('0x33')]);_0x2c4757[_0xf7b0('0x32')]=_[_0xf7b0('0x35')](_0x2c4757[_0xf7b0('0x30')],_0x2c4757[_0xf7b0('0x33')]);_0x4034db[_0xf7b0('0x34')]=_[_0xf7b0('0x35')](_0x2c4757[_0xf7b0('0x30')],qs[_0xf7b0('0x36')](_0x3e47ab[_0xf7b0('0x33')][_0xf7b0('0x36')]));_0x4034db['attributes']=_0x4034db[_0xf7b0('0x34')]['length']?_0x4034db[_0xf7b0('0x34')]:_0x2c4757[_0xf7b0('0x30')];if(_0x3e47ab[_0xf7b0('0x33')]['includeAll']){_0x4034db[_0xf7b0('0x40')]=[{'all':!![]}];}_0x4034db=_['merge']({},_0x4034db,_0x3e47ab[_0xf7b0('0x3e')]);return db[_0xf7b0('0x2d')]['find'](_0x4034db)[_0xf7b0('0x42')](handleEntityNotFound(_0x44bc59,null))[_0xf7b0('0x42')](respondWithResult(_0x44bc59,null))[_0xf7b0('0x43')](handleError(_0x44bc59,null));};exports[_0xf7b0('0x45')]=function(_0x5270c0,_0x2075bf){return db['ServicenowField']['create'](_0x5270c0[_0xf7b0('0x46')],{})['then'](respondWithResult(_0x2075bf,0xc9))[_0xf7b0('0x43')](handleError(_0x2075bf,null));};exports['update']=function(_0x1b3e85,_0x326be0){if(_0x1b3e85['body']['id']){delete _0x1b3e85[_0xf7b0('0x46')]['id'];}return db[_0xf7b0('0x2d')][_0xf7b0('0x47')]({'where':{'id':_0x1b3e85['params']['id']}})[_0xf7b0('0x42')](handleEntityNotFound(_0x326be0,null))[_0xf7b0('0x42')](saveUpdates(_0x1b3e85[_0xf7b0('0x46')],null))['then'](respondWithResult(_0x326be0,null))['catch'](handleError(_0x326be0,null));};exports['destroy']=function(_0x45a463,_0x197e28){return db[_0xf7b0('0x2d')][_0xf7b0('0x47')]({'where':{'id':_0x45a463[_0xf7b0('0x44')]['id']}})[_0xf7b0('0x42')](handleEntityNotFound(_0x197e28,null))[_0xf7b0('0x42')](removeEntity(_0x197e28,null))[_0xf7b0('0x43')](handleError(_0x197e28,null));}; \ No newline at end of file +var _0xdbf2=['model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','ServicenowField','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','type','key'];(function(_0x460f26,_0x18ab5c){var _0x237d6b=function(_0x5bf4f9){while(--_0x5bf4f9){_0x460f26['push'](_0x460f26['shift']());}};_0x237d6b(++_0x18ab5c);}(_0xdbf2,0xab));var _0x2dbf=function(_0x902e77,_0x213d25){_0x902e77=_0x902e77-0x0;var _0x180d7b=_0xdbf2[_0x902e77];return _0x180d7b;};'use strict';var emlformat=require(_0x2dbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dbf('0x1'));var jsonpatch=require(_0x2dbf('0x2'));var rp=require(_0x2dbf('0x3'));var moment=require(_0x2dbf('0x4'));var BPromise=require(_0x2dbf('0x5'));var Mustache=require('mustache');var util=require(_0x2dbf('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dbf('0x7'));var fs=require('fs');var fs_extra=require(_0x2dbf('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dbf('0x9'));var jsforce=require(_0x2dbf('0xa'));var deskjs=require(_0x2dbf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2dbf('0xc'));var Papa=require(_0x2dbf('0xd'));var Redis=require(_0x2dbf('0xe'));var authService=require(_0x2dbf('0xf'));var qs=require(_0x2dbf('0x10'));var as=require(_0x2dbf('0x11'));var hardwareService=require(_0x2dbf('0x12'));var logger=require(_0x2dbf('0x13'))(_0x2dbf('0x14'));var utils=require('../../config/utils');var config=require(_0x2dbf('0x15'));var licenseUtil=require(_0x2dbf('0x16'));var db=require(_0x2dbf('0x17'))['db'];function respondWithStatusCode(_0x2ec6b1,_0x4cfec6){_0x4cfec6=_0x4cfec6||0xcc;return function(_0x520f86){if(_0x520f86){return _0x2ec6b1[_0x2dbf('0x18')](_0x4cfec6);}return _0x2ec6b1[_0x2dbf('0x19')](_0x4cfec6)[_0x2dbf('0x1a')]();};}function respondWithResult(_0x34fd6d,_0x2716cd){_0x2716cd=_0x2716cd||0xc8;return function(_0x4ce593){if(_0x4ce593){return _0x34fd6d[_0x2dbf('0x19')](_0x2716cd)[_0x2dbf('0x1b')](_0x4ce593);}};}function respondWithFilteredResult(_0x2337f5,_0x192704){return function(_0x2dfed9){if(_0x2dfed9){var _0x5bfe69=typeof _0x192704[_0x2dbf('0x1c')]===_0x2dbf('0x1d')&&typeof _0x192704[_0x2dbf('0x1e')]==='undefined';var _0x55021c=_0x2dfed9[_0x2dbf('0x1f')];var _0x4bc316=_0x5bfe69?0x0:_0x192704[_0x2dbf('0x1c')];var _0xae089e=_0x5bfe69?_0x2dfed9[_0x2dbf('0x1f')]:_0x192704[_0x2dbf('0x1c')]+_0x192704[_0x2dbf('0x1e')];var _0x2f38a3;if(_0xae089e>=_0x55021c){_0xae089e=_0x55021c;_0x2f38a3=0xc8;}else{_0x2f38a3=0xce;}_0x2337f5[_0x2dbf('0x19')](_0x2f38a3);return _0x2337f5['set'](_0x2dbf('0x20'),_0x4bc316+'-'+_0xae089e+'/'+_0x55021c)[_0x2dbf('0x1b')](_0x2dfed9);}return null;};}function patchUpdates(_0xf86bbd){return function(_0x41b40e){try{jsonpatch[_0x2dbf('0x21')](_0x41b40e,_0xf86bbd,!![]);}catch(_0x5bad01){return BPromise[_0x2dbf('0x22')](_0x5bad01);}return _0x41b40e['save']();};}function saveUpdates(_0x5f22e6,_0x472082){return function(_0x6e9365){if(_0x6e9365){return _0x6e9365[_0x2dbf('0x23')](_0x5f22e6)['then'](function(_0x1302d1){return _0x1302d1;});}return null;};}function removeEntity(_0x18054a,_0x155141){return function(_0x100f01){if(_0x100f01){return _0x100f01[_0x2dbf('0x24')]()[_0x2dbf('0x25')](function(){_0x18054a[_0x2dbf('0x19')](0xcc)[_0x2dbf('0x1a')]();});}};}function handleEntityNotFound(_0x46d916,_0x2d7ea2){return function(_0x29a8b2){if(!_0x29a8b2){_0x46d916[_0x2dbf('0x18')](0x194);}return _0x29a8b2;};}function handleError(_0x1b1b92,_0x578825){_0x578825=_0x578825||0x1f4;return function(_0x451a00){logger[_0x2dbf('0x26')](_0x451a00[_0x2dbf('0x27')]);if(_0x451a00[_0x2dbf('0x28')]){delete _0x451a00[_0x2dbf('0x28')];}_0x1b1b92[_0x2dbf('0x19')](_0x578825)['send'](_0x451a00);};}exports[_0x2dbf('0x29')]=function(_0x5a3b6e,_0x8ac8a){var _0x49399d={},_0x32151d={},_0x58400b={'count':0x0,'rows':[]};var _0x4004a3=_[_0x2dbf('0x2a')](db['ServicenowField']['rawAttributes'],function(_0x4a4f3e){return{'name':_0x4a4f3e['fieldName'],'type':_0x4a4f3e[_0x2dbf('0x2b')][_0x2dbf('0x2c')]};});_0x32151d[_0x2dbf('0x2d')]=_[_0x2dbf('0x2a')](_0x4004a3,'name');_0x32151d[_0x2dbf('0x2e')]=_[_0x2dbf('0x2f')](_0x5a3b6e[_0x2dbf('0x2e')]);_0x32151d[_0x2dbf('0x30')]=_[_0x2dbf('0x31')](_0x32151d[_0x2dbf('0x2d')],_0x32151d['query']);_0x49399d['attributes']=_[_0x2dbf('0x31')](_0x32151d['model'],qs['fields'](_0x5a3b6e[_0x2dbf('0x2e')][_0x2dbf('0x32')]));_0x49399d[_0x2dbf('0x33')]=_0x49399d[_0x2dbf('0x33')][_0x2dbf('0x34')]?_0x49399d['attributes']:_0x32151d[_0x2dbf('0x2d')];if(!_0x5a3b6e[_0x2dbf('0x2e')]['hasOwnProperty'](_0x2dbf('0x35'))){_0x49399d[_0x2dbf('0x1e')]=qs[_0x2dbf('0x1e')](_0x5a3b6e[_0x2dbf('0x2e')]['limit']);_0x49399d[_0x2dbf('0x1c')]=qs['offset'](_0x5a3b6e[_0x2dbf('0x2e')][_0x2dbf('0x1c')]);}_0x49399d[_0x2dbf('0x36')]=qs[_0x2dbf('0x37')](_0x5a3b6e[_0x2dbf('0x2e')][_0x2dbf('0x37')]);_0x49399d['where']=qs[_0x2dbf('0x30')](_['pick'](_0x5a3b6e[_0x2dbf('0x2e')],_0x32151d[_0x2dbf('0x30')]),_0x4004a3);if(_0x5a3b6e[_0x2dbf('0x2e')]['filter']){_0x49399d[_0x2dbf('0x38')]=_[_0x2dbf('0x39')](_0x49399d[_0x2dbf('0x38')],{'$or':_[_0x2dbf('0x2a')](_0x4004a3,function(_0x5c8db5){if(_0x5c8db5['type']!==_0x2dbf('0x3a')){var _0x33415f={};_0x33415f[_0x5c8db5[_0x2dbf('0x28')]]={'$like':'%'+_0x5a3b6e[_0x2dbf('0x2e')][_0x2dbf('0x3b')]+'%'};return _0x33415f;}})});}_0x49399d=_[_0x2dbf('0x39')]({},_0x49399d,_0x5a3b6e[_0x2dbf('0x3c')]);var _0x2d57f4={'where':_0x49399d['where']};return db[_0x2dbf('0x3d')]['count'](_0x2d57f4)[_0x2dbf('0x25')](function(_0x15a87c){_0x58400b['count']=_0x15a87c;if(_0x5a3b6e[_0x2dbf('0x2e')][_0x2dbf('0x3e')]){_0x49399d[_0x2dbf('0x3f')]=[{'all':!![]}];}return db[_0x2dbf('0x3d')][_0x2dbf('0x40')](_0x49399d);})[_0x2dbf('0x25')](function(_0x46e654){_0x58400b[_0x2dbf('0x41')]=_0x46e654;return _0x58400b;})[_0x2dbf('0x25')](respondWithFilteredResult(_0x8ac8a,_0x49399d))[_0x2dbf('0x42')](handleError(_0x8ac8a,null));};exports[_0x2dbf('0x43')]=function(_0x5edb47,_0x3c272d){var _0x301677={'raw':!![],'where':{'id':_0x5edb47['params']['id']}},_0x395d3d={};_0x395d3d['model']=_[_0x2dbf('0x2f')](db[_0x2dbf('0x3d')][_0x2dbf('0x44')]);_0x395d3d['query']=_[_0x2dbf('0x2f')](_0x5edb47[_0x2dbf('0x2e')]);_0x395d3d['filters']=_[_0x2dbf('0x31')](_0x395d3d[_0x2dbf('0x2d')],_0x395d3d[_0x2dbf('0x2e')]);_0x301677['attributes']=_[_0x2dbf('0x31')](_0x395d3d['model'],qs[_0x2dbf('0x32')](_0x5edb47[_0x2dbf('0x2e')]['fields']));_0x301677['attributes']=_0x301677[_0x2dbf('0x33')][_0x2dbf('0x34')]?_0x301677[_0x2dbf('0x33')]:_0x395d3d[_0x2dbf('0x2d')];if(_0x5edb47['query'][_0x2dbf('0x3e')]){_0x301677[_0x2dbf('0x3f')]=[{'all':!![]}];}_0x301677=_[_0x2dbf('0x39')]({},_0x301677,_0x5edb47[_0x2dbf('0x3c')]);return db[_0x2dbf('0x3d')][_0x2dbf('0x45')](_0x301677)['then'](handleEntityNotFound(_0x3c272d,null))[_0x2dbf('0x25')](respondWithResult(_0x3c272d,null))[_0x2dbf('0x42')](handleError(_0x3c272d,null));};exports[_0x2dbf('0x46')]=function(_0x10e242,_0x261c6a){return db[_0x2dbf('0x3d')][_0x2dbf('0x46')](_0x10e242[_0x2dbf('0x47')],{})[_0x2dbf('0x25')](respondWithResult(_0x261c6a,0xc9))[_0x2dbf('0x42')](handleError(_0x261c6a,null));};exports[_0x2dbf('0x23')]=function(_0x1b2d0d,_0x1ff94c){if(_0x1b2d0d[_0x2dbf('0x47')]['id']){delete _0x1b2d0d[_0x2dbf('0x47')]['id'];}return db[_0x2dbf('0x3d')][_0x2dbf('0x45')]({'where':{'id':_0x1b2d0d['params']['id']}})[_0x2dbf('0x25')](handleEntityNotFound(_0x1ff94c,null))[_0x2dbf('0x25')](saveUpdates(_0x1b2d0d[_0x2dbf('0x47')],null))[_0x2dbf('0x25')](respondWithResult(_0x1ff94c,null))[_0x2dbf('0x42')](handleError(_0x1ff94c,null));};exports[_0x2dbf('0x24')]=function(_0x201b3b,_0x209b7e){return db[_0x2dbf('0x3d')]['find']({'where':{'id':_0x201b3b['params']['id']}})[_0x2dbf('0x25')](handleEntityNotFound(_0x209b7e,null))[_0x2dbf('0x25')](removeEntity(_0x209b7e,null))[_0x2dbf('0x42')](handleError(_0x209b7e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bf775cd..dc51334 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 _0x96ce=['api','moment','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x96ce,0x123));var _0xe96c=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x96ce[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0xe96c('0x0'));var util=require(_0xe96c('0x1'));var logger=require(_0xe96c('0x2'))(_0xe96c('0x3'));var moment=require(_0xe96c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe96c('0x5'));var rimraf=require(_0xe96c('0x6'));var config=require(_0xe96c('0x7'));var attributes=require(_0xe96c('0x8'));module[_0xe96c('0x9')]=function(_0x28f80a,_0x59bb93){return _0x28f80a[_0xe96c('0xa')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xe96c('0xb'),'fields':[_0xe96c('0xc'),_0xe96c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c48=['rimraf','../../config/environment','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c48,0x1e8));var _0x80c4=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x0c48[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0x80c4('0x0'));var util=require(_0x80c4('0x1'));var logger=require(_0x80c4('0x2'))(_0x80c4('0x3'));var moment=require(_0x80c4('0x4'));var BPromise=require(_0x80c4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80c4('0x6'));var rimraf=require(_0x80c4('0x7'));var config=require(_0x80c4('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x80c4('0x9')]=function(_0x4916ab,_0x70db3e){return _0x4916ab[_0x80c4('0xa')](_0x80c4('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x80c4('0xc'),'fields':[_0x80c4('0xd'),_0x80c4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 864a44f..c4fd05f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x568b6a,_0x302921){var _0x9de80c=function(_0x5a5fc4){while(--_0x5a5fc4){_0x568b6a['push'](_0x568b6a['shift']());}};_0x9de80c(++_0x302921);}(_0xb43b,0x1b2));var _0xbb43=function(_0xaa8745,_0x11a703){_0xaa8745=_0xaa8745-0x0;var _0x1fcd1e=_0xb43b[_0xaa8745];return _0x1fcd1e;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x46b82d,_0x26f9db){var _0x17bdc0=function(_0x87040c){while(--_0x87040c){_0x46b82d['push'](_0x46b82d['shift']());}};_0x17bdc0(++_0x26f9db);}(_0x70e0,0x17b));var _0x070e=function(_0x3ecb4d,_0x3a47db){_0x3ecb4d=_0x3ecb4d-0x0;var _0xc37de5=_0x70e0[_0x3ecb4d];return _0xc37de5;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d171d1a..c0c2fa6 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(_0x1d70a4,_0x379d2c){var _0xe10a25=function(_0x3d8368){while(--_0x3d8368){_0x1d70a4['push'](_0x1d70a4['shift']());}};_0xe10a25(++_0x379d2c);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x56e194,_0x1a65a0){var _0x1f08cb=function(_0x584cd3){while(--_0x584cd3){_0x56e194['push'](_0x56e194['shift']());}};_0x1f08cb(++_0x1a65a0);}(_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/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2eb965a..e989b18 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(_0x264295,_0x172c74){var _0x414112=function(_0x42bfec){while(--_0x42bfec){_0x264295['push'](_0x264295['shift']());}};_0x414112(++_0x172c74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x3c1743,_0x1dfbf2){var _0x3238c3=function(_0x35a8b2){while(--_0x35a8b2){_0x3c1743['push'](_0x3c1743['shift']());}};_0x3238c3(++_0x1dfbf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 56c38e0..62f1657 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 _0x760e=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmAccount','include','findAll','catch','params','includeAll','create','body','update','find','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','slice','substring','POST','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x10b565,_0x36c8e7){var _0x2d84e4=function(_0x317b46){while(--_0x317b46){_0x10b565['push'](_0x10b565['shift']());}};_0x2d84e4(++_0x36c8e7);}(_0x760e,0x1d4));var _0xe760=function(_0x1323a5,_0x4b3ac4){_0x1323a5=_0x1323a5-0x0;var _0x30fec9=_0x760e[_0x1323a5];return _0x30fec9;};'use strict';var emlformat=require(_0xe760('0x0'));var rimraf=require(_0xe760('0x1'));var zipdir=require(_0xe760('0x2'));var jsonpatch=require(_0xe760('0x3'));var rp=require('request-promise');var moment=require(_0xe760('0x4'));var BPromise=require(_0xe760('0x5'));var Mustache=require(_0xe760('0x6'));var util=require('util');var path=require(_0xe760('0x7'));var sox=require(_0xe760('0x8'));var csv=require(_0xe760('0x9'));var ejs=require(_0xe760('0xa'));var fs=require('fs');var fs_extra=require(_0xe760('0xb'));var _=require(_0xe760('0xc'));var squel=require(_0xe760('0xd'));var crypto=require('crypto');var jsforce=require(_0xe760('0xe'));var deskjs=require(_0xe760('0xf'));var toCsv=require(_0xe760('0x9'));var querystring=require(_0xe760('0x10'));var Papa=require(_0xe760('0x11'));var Redis=require(_0xe760('0x12'));var authService=require(_0xe760('0x13'));var qs=require(_0xe760('0x14'));var as=require(_0xe760('0x15'));var hardwareService=require(_0xe760('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe760('0x17'));var config=require(_0xe760('0x18'));var licenseUtil=require(_0xe760('0x19'));var db=require(_0xe760('0x1a'))['db'];var integrations=require(_0xe760('0x1b'));function respondWithStatusCode(_0x4c46be,_0x50ced6){_0x50ced6=_0x50ced6||0xcc;return function(_0x11e58a){if(_0x11e58a){return _0x4c46be['sendStatus'](_0x50ced6);}return _0x4c46be[_0xe760('0x1c')](_0x50ced6)[_0xe760('0x1d')]();};}function respondWithResult(_0x32882a,_0xb7b5a6){_0xb7b5a6=_0xb7b5a6||0xc8;return function(_0x13c081){if(_0x13c081){return _0x32882a[_0xe760('0x1c')](_0xb7b5a6)[_0xe760('0x1e')](_0x13c081);}};}function respondWithFilteredResult(_0x40ebd3,_0x3b758a){return function(_0x1fa666){if(_0x1fa666){var _0x532806=typeof _0x3b758a[_0xe760('0x1f')]==='undefined'&&typeof _0x3b758a[_0xe760('0x20')]===_0xe760('0x21');var _0x248fec=_0x1fa666[_0xe760('0x22')];var _0x4b0b0a=_0x532806?0x0:_0x3b758a[_0xe760('0x1f')];var _0x7ebf45=_0x532806?_0x1fa666[_0xe760('0x22')]:_0x3b758a['offset']+_0x3b758a[_0xe760('0x20')];var _0xefdbd8;if(_0x7ebf45>=_0x248fec){_0x7ebf45=_0x248fec;_0xefdbd8=0xc8;}else{_0xefdbd8=0xce;}_0x40ebd3[_0xe760('0x1c')](_0xefdbd8);return _0x40ebd3[_0xe760('0x23')]('Content-Range',_0x4b0b0a+'-'+_0x7ebf45+'/'+_0x248fec)[_0xe760('0x1e')](_0x1fa666);}return null;};}function patchUpdates(_0x2d2348){return function(_0x33cb81){try{jsonpatch[_0xe760('0x24')](_0x33cb81,_0x2d2348,!![]);}catch(_0x58f803){return BPromise[_0xe760('0x25')](_0x58f803);}return _0x33cb81[_0xe760('0x26')]();};}function saveUpdates(_0x5362ed,_0x12fffe){return function(_0x260221){if(_0x260221){return _0x260221['update'](_0x5362ed)[_0xe760('0x27')](function(_0xeb86be){return _0xeb86be;});}return null;};}function removeEntity(_0x38996b,_0xa8f91e){return function(_0x47abba){if(_0x47abba){return _0x47abba[_0xe760('0x28')]()[_0xe760('0x27')](function(){_0x38996b[_0xe760('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8a9ff6,_0x5b8165){return function(_0x2310d7){if(!_0x2310d7){_0x8a9ff6[_0xe760('0x29')](0x194);}return _0x2310d7;};}function handleError(_0x2d3f3f,_0x284d20){_0x284d20=_0x284d20||0x1f4;return function(_0x4d6e2b){logger[_0xe760('0x2a')](_0x4d6e2b['stack']);if(_0x4d6e2b[_0xe760('0x2b')]){delete _0x4d6e2b[_0xe760('0x2b')];}_0x2d3f3f['status'](_0x284d20)['send'](_0x4d6e2b);};}exports[_0xe760('0x2c')]=function(_0x44e92d,_0x8e7d4a){var _0x21fe9a={},_0x2ddc10={},_0x4ba8ad={'count':0x0,'rows':[]};var _0x425b65=_[_0xe760('0x2d')](db['SugarcrmAccount'][_0xe760('0x2e')],function(_0x506a96){return{'name':_0x506a96[_0xe760('0x2f')],'type':_0x506a96['type']['key']};});_0x2ddc10[_0xe760('0x30')]=_[_0xe760('0x2d')](_0x425b65,_0xe760('0x2b'));_0x2ddc10['query']=_[_0xe760('0x31')](_0x44e92d['query']);_0x2ddc10[_0xe760('0x32')]=_[_0xe760('0x33')](_0x2ddc10[_0xe760('0x30')],_0x2ddc10[_0xe760('0x34')]);_0x21fe9a[_0xe760('0x35')]=_[_0xe760('0x33')](_0x2ddc10[_0xe760('0x30')],qs[_0xe760('0x36')](_0x44e92d[_0xe760('0x34')]['fields']));_0x21fe9a[_0xe760('0x35')]=_0x21fe9a[_0xe760('0x35')][_0xe760('0x37')]?_0x21fe9a[_0xe760('0x35')]:_0x2ddc10['model'];if(!_0x44e92d[_0xe760('0x34')]['hasOwnProperty'](_0xe760('0x38'))){_0x21fe9a[_0xe760('0x20')]=qs['limit'](_0x44e92d[_0xe760('0x34')][_0xe760('0x20')]);_0x21fe9a[_0xe760('0x1f')]=qs[_0xe760('0x1f')](_0x44e92d['query'][_0xe760('0x1f')]);}_0x21fe9a[_0xe760('0x39')]=qs[_0xe760('0x3a')](_0x44e92d[_0xe760('0x34')][_0xe760('0x3a')]);_0x21fe9a[_0xe760('0x3b')]=qs[_0xe760('0x32')](_[_0xe760('0x3c')](_0x44e92d[_0xe760('0x34')],_0x2ddc10[_0xe760('0x32')]),_0x425b65);if(_0x44e92d[_0xe760('0x34')][_0xe760('0x3d')]){_0x21fe9a['where']=_[_0xe760('0x3e')](_0x21fe9a[_0xe760('0x3b')],{'$or':_[_0xe760('0x2d')](_0x425b65,function(_0x2dcd27){if(_0x2dcd27[_0xe760('0x3f')]!==_0xe760('0x40')){var _0x5dccf4={};_0x5dccf4[_0x2dcd27['name']]={'$like':'%'+_0x44e92d['query']['filter']+'%'};return _0x5dccf4;}})});}_0x21fe9a=_[_0xe760('0x3e')]({},_0x21fe9a,_0x44e92d[_0xe760('0x41')]);var _0xd88eb4={'where':_0x21fe9a[_0xe760('0x3b')]};return db[_0xe760('0x42')]['count'](_0xd88eb4)[_0xe760('0x27')](function(_0x5d8286){_0x4ba8ad[_0xe760('0x22')]=_0x5d8286;if(_0x44e92d[_0xe760('0x34')]['includeAll']){_0x21fe9a[_0xe760('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xe760('0x44')](_0x21fe9a);})[_0xe760('0x27')](function(_0x384dfd){_0x4ba8ad['rows']=_0x384dfd;return _0x4ba8ad;})[_0xe760('0x27')](respondWithFilteredResult(_0x8e7d4a,_0x21fe9a))[_0xe760('0x45')](handleError(_0x8e7d4a,null));};exports['show']=function(_0x36c649,_0x33a3cc){var _0x4608b2={'raw':![],'where':{'id':_0x36c649[_0xe760('0x46')]['id']}},_0x45563e={};_0x45563e['model']=_['keys'](db[_0xe760('0x42')][_0xe760('0x2e')]);_0x45563e[_0xe760('0x34')]=_[_0xe760('0x31')](_0x36c649['query']);_0x45563e[_0xe760('0x32')]=_['intersection'](_0x45563e[_0xe760('0x30')],_0x45563e[_0xe760('0x34')]);_0x4608b2[_0xe760('0x35')]=_[_0xe760('0x33')](_0x45563e[_0xe760('0x30')],qs[_0xe760('0x36')](_0x36c649[_0xe760('0x34')][_0xe760('0x36')]));_0x4608b2[_0xe760('0x35')]=_0x4608b2['attributes'][_0xe760('0x37')]?_0x4608b2[_0xe760('0x35')]:_0x45563e[_0xe760('0x30')];if(_0x36c649[_0xe760('0x34')][_0xe760('0x47')]){_0x4608b2['include']=[{'all':!![]}];}_0x4608b2=_[_0xe760('0x3e')]({},_0x4608b2,_0x36c649[_0xe760('0x41')]);return db['SugarcrmAccount']['find'](_0x4608b2)['then'](handleEntityNotFound(_0x33a3cc,null))['then'](respondWithResult(_0x33a3cc,null))['catch'](handleError(_0x33a3cc,null));};exports[_0xe760('0x48')]=function(_0x2fb45d,_0x1c43ca){return db[_0xe760('0x42')][_0xe760('0x48')](_0x2fb45d[_0xe760('0x49')],{})[_0xe760('0x27')](respondWithResult(_0x1c43ca,0xc9))[_0xe760('0x45')](handleError(_0x1c43ca,null));};exports[_0xe760('0x4a')]=function(_0x8307bb,_0x307aa7){if(_0x8307bb[_0xe760('0x49')]['id']){delete _0x8307bb[_0xe760('0x49')]['id'];}return db[_0xe760('0x42')][_0xe760('0x4b')]({'where':{'id':_0x8307bb[_0xe760('0x46')]['id']}})[_0xe760('0x27')](handleEntityNotFound(_0x307aa7,null))[_0xe760('0x27')](saveUpdates(_0x8307bb[_0xe760('0x49')],null))[_0xe760('0x27')](respondWithResult(_0x307aa7,null))[_0xe760('0x45')](handleError(_0x307aa7,null));};exports[_0xe760('0x28')]=function(_0xbc2220,_0x5cc07c){return db[_0xe760('0x42')][_0xe760('0x4b')]({'where':{'id':_0xbc2220[_0xe760('0x46')]['id']}})[_0xe760('0x27')](handleEntityNotFound(_0x5cc07c,null))[_0xe760('0x27')](removeEntity(_0x5cc07c,null))[_0xe760('0x45')](handleError(_0x5cc07c,null));};exports[_0xe760('0x4c')]=function(_0x40ae88,_0x440c56,_0x24cc5e){var _0x532e16={};var _0x4bf161={};var _0x163e7f;var _0x3845f0;return db[_0xe760('0x42')][_0xe760('0x4d')]({'where':{'id':_0x40ae88[_0xe760('0x46')]['id']}})[_0xe760('0x27')](handleEntityNotFound(_0x440c56,null))['then'](function(_0x1e41bf){if(_0x1e41bf){_0x163e7f=_0x1e41bf;_0x4bf161[_0xe760('0x30')]=_[_0xe760('0x31')](db[_0xe760('0x4e')][_0xe760('0x2e')]);_0x4bf161[_0xe760('0x34')]=_['keys'](_0x40ae88[_0xe760('0x34')]);_0x4bf161[_0xe760('0x32')]=_[_0xe760('0x33')](_0x4bf161[_0xe760('0x30')],_0x4bf161['query']);_0x532e16[_0xe760('0x35')]=_[_0xe760('0x33')](_0x4bf161[_0xe760('0x30')],qs[_0xe760('0x36')](_0x40ae88[_0xe760('0x34')][_0xe760('0x36')]));_0x532e16[_0xe760('0x35')]=_0x532e16[_0xe760('0x35')]['length']?_0x532e16['attributes']:_0x4bf161[_0xe760('0x30')];_0x532e16['order']=qs[_0xe760('0x3a')](_0x40ae88['query'][_0xe760('0x3a')]);_0x532e16[_0xe760('0x3b')]=qs[_0xe760('0x32')](_['pick'](_0x40ae88['query'],_0x4bf161[_0xe760('0x32')]));if(_0x40ae88['query'][_0xe760('0x3d')]){_0x532e16[_0xe760('0x3b')]=_[_0xe760('0x3e')](_0x532e16[_0xe760('0x3b')],{'$or':_[_0xe760('0x2d')](_0x532e16[_0xe760('0x35')],function(_0x49fa95){var _0x5d1933={};_0x5d1933[_0x49fa95]={'$like':'%'+_0x40ae88[_0xe760('0x34')]['filter']+'%'};return _0x5d1933;})});}_0x532e16=_[_0xe760('0x3e')]({},_0x532e16,_0x40ae88['options']);return _0x163e7f[_0xe760('0x4c')](_0x532e16);}})[_0xe760('0x27')](function(_0xc32246){if(_0xc32246){_0x3845f0=_0xc32246[_0xe760('0x37')];if(!_0x40ae88[_0xe760('0x34')][_0xe760('0x4f')]('nolimit')){_0x532e16[_0xe760('0x20')]=qs[_0xe760('0x20')](_0x40ae88['query'][_0xe760('0x20')]);_0x532e16[_0xe760('0x1f')]=qs[_0xe760('0x1f')](_0x40ae88[_0xe760('0x34')][_0xe760('0x1f')]);}return _0x163e7f[_0xe760('0x4c')](_0x532e16);}})[_0xe760('0x27')](function(_0xef4131){if(_0xef4131){return _0xef4131?{'count':_0x3845f0,'rows':_0xef4131}:null;}})['then'](respondWithResult(_0x440c56,null))[_0xe760('0x45')](handleError(_0x440c56,null));};exports[_0xe760('0x50')]=function(_0x2e96fe,_0x360495,_0x29a6dd){if(_0x2e96fe[_0xe760('0x49')]['id']){delete _0x2e96fe[_0xe760('0x49')]['id'];}return db[_0xe760('0x42')][_0xe760('0x4d')]({'where':{'id':_0x2e96fe[_0xe760('0x46')]['id']}})['then'](handleEntityNotFound(_0x360495,null))[_0xe760('0x27')](function(_0x3c6cdc){if(_0x3c6cdc){_0x2e96fe['body'][_0xe760('0x51')]=_0x3c6cdc['id'];_0x2e96fe[_0xe760('0x49')]['Subjects']=integrations[_0xe760('0x52')](_0x2e96fe[_0xe760('0x49')][_0xe760('0x53')],_0x2e96fe[_0xe760('0x49')][_0xe760('0x3f')]);_0x2e96fe['body']['Descriptions']=integrations[_0xe760('0x54')](_0x2e96fe[_0xe760('0x49')][_0xe760('0x53')],_0x2e96fe[_0xe760('0x49')]['type']);return db[_0xe760('0x4e')][_0xe760('0x48')](_0x2e96fe[_0xe760('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0xe760('0x55')},{'model':db['SugarcrmField'],'as':_0xe760('0x56')}]});}return null;})[_0xe760('0x27')](respondWithResult(_0x360495,null))['catch'](handleError(_0x360495,null));};exports[_0xe760('0x57')]=function(_0x6d44ac,_0x297657,_0x10a1bf){var _0x58760a='';var _0x550dd1=['id',_0xe760('0x2b'),_0xe760('0x58'),_0xe760('0x59'),_0xe760('0x5a'),_0xe760('0x5b'),_0xe760('0x5c'),_0xe760('0x5d'),_0xe760('0x5e'),_0xe760('0x5f'),_0xe760('0x60'),_0xe760('0x61')];return db['SugarcrmAccount'][_0xe760('0x4d')]({'where':{'id':_0x6d44ac['params']['id']},'attributes':['id',_0xe760('0x62'),_0xe760('0x63'),'remoteUri']})[_0xe760('0x27')](handleEntityNotFound(_0x297657,null))[_0xe760('0x27')](function(_0x2db835){if(_0x2db835){_0x58760a=_0x2db835['remoteUri'];var _0x3b42dd=_0x58760a[_0xe760('0x64')](-0x1);if(_0x3b42dd==='/'){_0x58760a=_0x58760a[_0xe760('0x65')](0x0,_0x58760a['lastIndexOf'](_0x3b42dd));}return rp({'method':_0xe760('0x66'),'uri':util['format'](_0xe760('0x67'),_0x58760a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xe760('0x68'),'response_type':'JSON','rest_data':JSON[_0xe760('0x69')]({'user_auth':{'user_name':_0x2db835[_0xe760('0x62')],'password':_0x2db835[_0xe760('0x63')],'encryption':_0xe760('0x6a')},'application':_0xe760('0x6b')})}});}})['then'](function(_0x4edd8f){if(_0x4edd8f&&_0x4edd8f[_0xe760('0x2b')]!==_0xe760('0x6c')&&_0x4edd8f[_0xe760('0x2b')]!==_0xe760('0x6d')){return rp({'method':_0xe760('0x66'),'uri':util[_0xe760('0x6e')](_0xe760('0x67'),_0x58760a,_0xe760('0x6f')),'json':!![],'form':{'method':_0xe760('0x70'),'input_type':_0xe760('0x68'),'response_type':_0xe760('0x68'),'rest_data':JSON[_0xe760('0x69')]({'session':_0x4edd8f['id'],'module_name':_0xe760('0x71')})}})[_0xe760('0x27')](function(_0x523945){if(_0x523945){var _0x114f53=_[_0xe760('0x72')](_0x523945[_0xe760('0x73')]);_[_0xe760('0x74')](_0x114f53,function(_0x356c00){return _0x550dd1[_0xe760('0x75')](_0x356c00[_0xe760('0x2b')]);});return{'count':_0x114f53[_0xe760('0x37')],'rows':_['map'](_0x114f53,function(_0x484956){return{'id':_0x484956[_0xe760('0x2b')],'name':_0x484956['label'],'custom':_[_0xe760('0x76')](_0x484956[_0xe760('0x2b')],'_c')?!![]:![],'options':_0x484956[_0xe760('0x41')]?_[_0xe760('0x2d')](_[_0xe760('0x72')](_0x484956[_0xe760('0x41')]),function(_0x33f9f3){return{'name':_0x33f9f3['value'],'value':_0x33f9f3[_0xe760('0x2b')]};}):[]};})};}})[_0xe760('0x27')](respondWithResult(_0x297657,null))[_0xe760('0x45')](function(_0x5e3c94){var _0x677628=_0x6d44ac[_0xe760('0x34')][_0xe760('0x77')]?0x1f4:_0x5e3c94[_0xe760('0x78')]||0x1f4;logger[_0xe760('0x2a')](_0xe760('0x79'),_0xe760('0x57'),_0x677628,JSON[_0xe760('0x69')](_0x5e3c94));delete _0x5e3c94[_0xe760('0x2b')];if(_0x677628===0x191){_0x677628=0x190;}_0x297657[_0xe760('0x1c')](_0x677628)[_0xe760('0x7a')](_0x6d44ac[_0xe760('0x34')][_0xe760('0x77')]?{'message':_0xe760('0x7b'),'statusCode':_0x5e3c94['statusCode']}:_0x5e3c94);});}else{var _0x2aaa68=0x1f4;_0x297657['status'](_0x2aaa68)[_0xe760('0x7a')]({'message':_0xe760('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xff6a=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','save','then','error','stack','name','send','index','SugarcrmAccount','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','update','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','length','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','endsWith','value','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5eccff,_0x1674eb){var _0x37a2c6=function(_0x48fe90){while(--_0x48fe90){_0x5eccff['push'](_0x5eccff['shift']());}};_0x37a2c6(++_0x1674eb);}(_0xff6a,0x161));var _0xaff6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xff6a[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff6('0x0'));var zipdir=require(_0xaff6('0x1'));var jsonpatch=require(_0xaff6('0x2'));var rp=require('request-promise');var moment=require(_0xaff6('0x3'));var BPromise=require(_0xaff6('0x4'));var Mustache=require(_0xaff6('0x5'));var util=require(_0xaff6('0x6'));var path=require(_0xaff6('0x7'));var sox=require(_0xaff6('0x8'));var csv=require(_0xaff6('0x9'));var ejs=require(_0xaff6('0xa'));var fs=require('fs');var fs_extra=require(_0xaff6('0xb'));var _=require('lodash');var squel=require(_0xaff6('0xc'));var crypto=require(_0xaff6('0xd'));var jsforce=require(_0xaff6('0xe'));var deskjs=require(_0xaff6('0xf'));var toCsv=require(_0xaff6('0x9'));var querystring=require('querystring');var Papa=require(_0xaff6('0x10'));var Redis=require('ioredis');var authService=require(_0xaff6('0x11'));var qs=require(_0xaff6('0x12'));var as=require(_0xaff6('0x13'));var hardwareService=require(_0xaff6('0x14'));var logger=require(_0xaff6('0x15'))(_0xaff6('0x16'));var utils=require(_0xaff6('0x17'));var config=require(_0xaff6('0x18'));var licenseUtil=require(_0xaff6('0x19'));var db=require(_0xaff6('0x1a'))['db'];var integrations=require(_0xaff6('0x1b'));function respondWithStatusCode(_0x2e7678,_0x3d249a){_0x3d249a=_0x3d249a||0xcc;return function(_0x2a12ed){if(_0x2a12ed){return _0x2e7678[_0xaff6('0x1c')](_0x3d249a);}return _0x2e7678[_0xaff6('0x1d')](_0x3d249a)[_0xaff6('0x1e')]();};}function respondWithResult(_0x44935d,_0x4b711a){_0x4b711a=_0x4b711a||0xc8;return function(_0x3c5b54){if(_0x3c5b54){return _0x44935d[_0xaff6('0x1d')](_0x4b711a)[_0xaff6('0x1f')](_0x3c5b54);}};}function respondWithFilteredResult(_0x5cda69,_0x2bcede){return function(_0x1bcabc){if(_0x1bcabc){var _0x16fa5f=typeof _0x2bcede[_0xaff6('0x20')]==='undefined'&&typeof _0x2bcede[_0xaff6('0x21')]==='undefined';var _0x24379c=_0x1bcabc[_0xaff6('0x22')];var _0x4a128e=_0x16fa5f?0x0:_0x2bcede[_0xaff6('0x20')];var _0x4a79ae=_0x16fa5f?_0x1bcabc[_0xaff6('0x22')]:_0x2bcede['offset']+_0x2bcede[_0xaff6('0x21')];var _0x1be4f1;if(_0x4a79ae>=_0x24379c){_0x4a79ae=_0x24379c;_0x1be4f1=0xc8;}else{_0x1be4f1=0xce;}_0x5cda69[_0xaff6('0x1d')](_0x1be4f1);return _0x5cda69[_0xaff6('0x23')]('Content-Range',_0x4a128e+'-'+_0x4a79ae+'/'+_0x24379c)[_0xaff6('0x1f')](_0x1bcabc);}return null;};}function patchUpdates(_0x349895){return function(_0x2273c7){try{jsonpatch['apply'](_0x2273c7,_0x349895,!![]);}catch(_0x48fea6){return BPromise['reject'](_0x48fea6);}return _0x2273c7[_0xaff6('0x24')]();};}function saveUpdates(_0x1ee73b,_0x2f04d9){return function(_0xb12598){if(_0xb12598){return _0xb12598['update'](_0x1ee73b)[_0xaff6('0x25')](function(_0x11e195){return _0x11e195;});}return null;};}function removeEntity(_0xae0c24,_0x6ff664){return function(_0xd7f4a2){if(_0xd7f4a2){return _0xd7f4a2['destroy']()[_0xaff6('0x25')](function(){_0xae0c24[_0xaff6('0x1d')](0xcc)[_0xaff6('0x1e')]();});}};}function handleEntityNotFound(_0x1eb23d,_0x4cffd0){return function(_0x1c9486){if(!_0x1c9486){_0x1eb23d[_0xaff6('0x1c')](0x194);}return _0x1c9486;};}function handleError(_0x26fd19,_0x35c8cf){_0x35c8cf=_0x35c8cf||0x1f4;return function(_0x278087){logger[_0xaff6('0x26')](_0x278087[_0xaff6('0x27')]);if(_0x278087[_0xaff6('0x28')]){delete _0x278087[_0xaff6('0x28')];}_0x26fd19[_0xaff6('0x1d')](_0x35c8cf)[_0xaff6('0x29')](_0x278087);};}exports[_0xaff6('0x2a')]=function(_0xd63529,_0x4a827e){var _0x5bc7ca={},_0x378094={},_0x536b3b={'count':0x0,'rows':[]};var _0x21db43=_['map'](db[_0xaff6('0x2b')][_0xaff6('0x2c')],function(_0x42993b){return{'name':_0x42993b['fieldName'],'type':_0x42993b['type'][_0xaff6('0x2d')]};});_0x378094[_0xaff6('0x2e')]=_[_0xaff6('0x2f')](_0x21db43,'name');_0x378094['query']=_['keys'](_0xd63529[_0xaff6('0x30')]);_0x378094[_0xaff6('0x31')]=_[_0xaff6('0x32')](_0x378094['model'],_0x378094[_0xaff6('0x30')]);_0x5bc7ca[_0xaff6('0x33')]=_[_0xaff6('0x32')](_0x378094[_0xaff6('0x2e')],qs[_0xaff6('0x34')](_0xd63529[_0xaff6('0x30')][_0xaff6('0x34')]));_0x5bc7ca['attributes']=_0x5bc7ca['attributes']['length']?_0x5bc7ca[_0xaff6('0x33')]:_0x378094['model'];if(!_0xd63529[_0xaff6('0x30')][_0xaff6('0x35')](_0xaff6('0x36'))){_0x5bc7ca['limit']=qs['limit'](_0xd63529[_0xaff6('0x30')]['limit']);_0x5bc7ca['offset']=qs[_0xaff6('0x20')](_0xd63529[_0xaff6('0x30')]['offset']);}_0x5bc7ca[_0xaff6('0x37')]=qs[_0xaff6('0x38')](_0xd63529['query']['sort']);_0x5bc7ca[_0xaff6('0x39')]=qs[_0xaff6('0x31')](_[_0xaff6('0x3a')](_0xd63529[_0xaff6('0x30')],_0x378094[_0xaff6('0x31')]),_0x21db43);if(_0xd63529[_0xaff6('0x30')][_0xaff6('0x3b')]){_0x5bc7ca[_0xaff6('0x39')]=_[_0xaff6('0x3c')](_0x5bc7ca[_0xaff6('0x39')],{'$or':_[_0xaff6('0x2f')](_0x21db43,function(_0x545b6c){if(_0x545b6c[_0xaff6('0x3d')]!==_0xaff6('0x3e')){var _0x52753c={};_0x52753c[_0x545b6c[_0xaff6('0x28')]]={'$like':'%'+_0xd63529[_0xaff6('0x30')]['filter']+'%'};return _0x52753c;}})});}_0x5bc7ca=_[_0xaff6('0x3c')]({},_0x5bc7ca,_0xd63529[_0xaff6('0x3f')]);var _0x5ca168={'where':_0x5bc7ca[_0xaff6('0x39')]};return db[_0xaff6('0x2b')][_0xaff6('0x22')](_0x5ca168)[_0xaff6('0x25')](function(_0x4e915b){_0x536b3b[_0xaff6('0x22')]=_0x4e915b;if(_0xd63529[_0xaff6('0x30')][_0xaff6('0x40')]){_0x5bc7ca[_0xaff6('0x41')]=[{'all':!![]}];}return db[_0xaff6('0x2b')]['findAll'](_0x5bc7ca);})[_0xaff6('0x25')](function(_0x3935a8){_0x536b3b[_0xaff6('0x42')]=_0x3935a8;return _0x536b3b;})[_0xaff6('0x25')](respondWithFilteredResult(_0x4a827e,_0x5bc7ca))[_0xaff6('0x43')](handleError(_0x4a827e,null));};exports[_0xaff6('0x44')]=function(_0x4a7048,_0x398f23){var _0x4bf839={'raw':![],'where':{'id':_0x4a7048['params']['id']}},_0x241c6f={};_0x241c6f['model']=_[_0xaff6('0x45')](db[_0xaff6('0x2b')][_0xaff6('0x2c')]);_0x241c6f[_0xaff6('0x30')]=_[_0xaff6('0x45')](_0x4a7048[_0xaff6('0x30')]);_0x241c6f[_0xaff6('0x31')]=_['intersection'](_0x241c6f[_0xaff6('0x2e')],_0x241c6f[_0xaff6('0x30')]);_0x4bf839['attributes']=_['intersection'](_0x241c6f[_0xaff6('0x2e')],qs[_0xaff6('0x34')](_0x4a7048[_0xaff6('0x30')][_0xaff6('0x34')]));_0x4bf839[_0xaff6('0x33')]=_0x4bf839[_0xaff6('0x33')]['length']?_0x4bf839[_0xaff6('0x33')]:_0x241c6f[_0xaff6('0x2e')];if(_0x4a7048[_0xaff6('0x30')]['includeAll']){_0x4bf839[_0xaff6('0x41')]=[{'all':!![]}];}_0x4bf839=_[_0xaff6('0x3c')]({},_0x4bf839,_0x4a7048['options']);return db[_0xaff6('0x2b')][_0xaff6('0x46')](_0x4bf839)[_0xaff6('0x25')](handleEntityNotFound(_0x398f23,null))[_0xaff6('0x25')](respondWithResult(_0x398f23,null))[_0xaff6('0x43')](handleError(_0x398f23,null));};exports['create']=function(_0x4b970a,_0x21c48b){return db[_0xaff6('0x2b')][_0xaff6('0x47')](_0x4b970a[_0xaff6('0x48')],{})[_0xaff6('0x25')](respondWithResult(_0x21c48b,0xc9))[_0xaff6('0x43')](handleError(_0x21c48b,null));};exports[_0xaff6('0x49')]=function(_0x4b3fdf,_0x43a580){if(_0x4b3fdf['body']['id']){delete _0x4b3fdf['body']['id'];}return db[_0xaff6('0x2b')]['find']({'where':{'id':_0x4b3fdf[_0xaff6('0x4a')]['id']}})[_0xaff6('0x25')](handleEntityNotFound(_0x43a580,null))[_0xaff6('0x25')](saveUpdates(_0x4b3fdf[_0xaff6('0x48')],null))['then'](respondWithResult(_0x43a580,null))[_0xaff6('0x43')](handleError(_0x43a580,null));};exports[_0xaff6('0x4b')]=function(_0xa6a834,_0x54eacb){return db[_0xaff6('0x2b')]['find']({'where':{'id':_0xa6a834[_0xaff6('0x4a')]['id']}})[_0xaff6('0x25')](handleEntityNotFound(_0x54eacb,null))[_0xaff6('0x25')](removeEntity(_0x54eacb,null))['catch'](handleError(_0x54eacb,null));};exports[_0xaff6('0x4c')]=function(_0x429f06,_0xf8371b,_0x249b9a){var _0x19f05c={};var _0x21c1a9={};var _0x5287d5;var _0x3f49ca;return db['SugarcrmAccount'][_0xaff6('0x4d')]({'where':{'id':_0x429f06[_0xaff6('0x4a')]['id']}})[_0xaff6('0x25')](handleEntityNotFound(_0xf8371b,null))['then'](function(_0x33c795){if(_0x33c795){_0x5287d5=_0x33c795;_0x21c1a9[_0xaff6('0x2e')]=_[_0xaff6('0x45')](db[_0xaff6('0x4e')][_0xaff6('0x2c')]);_0x21c1a9[_0xaff6('0x30')]=_[_0xaff6('0x45')](_0x429f06[_0xaff6('0x30')]);_0x21c1a9[_0xaff6('0x31')]=_[_0xaff6('0x32')](_0x21c1a9[_0xaff6('0x2e')],_0x21c1a9[_0xaff6('0x30')]);_0x19f05c['attributes']=_[_0xaff6('0x32')](_0x21c1a9[_0xaff6('0x2e')],qs[_0xaff6('0x34')](_0x429f06['query'][_0xaff6('0x34')]));_0x19f05c['attributes']=_0x19f05c[_0xaff6('0x33')][_0xaff6('0x4f')]?_0x19f05c[_0xaff6('0x33')]:_0x21c1a9[_0xaff6('0x2e')];_0x19f05c[_0xaff6('0x37')]=qs[_0xaff6('0x38')](_0x429f06['query'][_0xaff6('0x38')]);_0x19f05c['where']=qs[_0xaff6('0x31')](_[_0xaff6('0x3a')](_0x429f06[_0xaff6('0x30')],_0x21c1a9[_0xaff6('0x31')]));if(_0x429f06[_0xaff6('0x30')]['filter']){_0x19f05c[_0xaff6('0x39')]=_[_0xaff6('0x3c')](_0x19f05c[_0xaff6('0x39')],{'$or':_['map'](_0x19f05c[_0xaff6('0x33')],function(_0x10d72b){var _0x3e9f99={};_0x3e9f99[_0x10d72b]={'$like':'%'+_0x429f06['query']['filter']+'%'};return _0x3e9f99;})});}_0x19f05c=_[_0xaff6('0x3c')]({},_0x19f05c,_0x429f06['options']);return _0x5287d5[_0xaff6('0x4c')](_0x19f05c);}})[_0xaff6('0x25')](function(_0x3a93bf){if(_0x3a93bf){_0x3f49ca=_0x3a93bf[_0xaff6('0x4f')];if(!_0x429f06[_0xaff6('0x30')][_0xaff6('0x35')](_0xaff6('0x36'))){_0x19f05c[_0xaff6('0x21')]=qs[_0xaff6('0x21')](_0x429f06[_0xaff6('0x30')][_0xaff6('0x21')]);_0x19f05c[_0xaff6('0x20')]=qs[_0xaff6('0x20')](_0x429f06['query']['offset']);}return _0x5287d5[_0xaff6('0x4c')](_0x19f05c);}})[_0xaff6('0x25')](function(_0xc34c02){if(_0xc34c02){return _0xc34c02?{'count':_0x3f49ca,'rows':_0xc34c02}:null;}})[_0xaff6('0x25')](respondWithResult(_0xf8371b,null))[_0xaff6('0x43')](handleError(_0xf8371b,null));};exports[_0xaff6('0x50')]=function(_0x1a8aa4,_0x5a440e,_0x86813d){if(_0x1a8aa4['body']['id']){delete _0x1a8aa4[_0xaff6('0x48')]['id'];}return db['SugarcrmAccount'][_0xaff6('0x4d')]({'where':{'id':_0x1a8aa4[_0xaff6('0x4a')]['id']}})[_0xaff6('0x25')](handleEntityNotFound(_0x5a440e,null))['then'](function(_0x268e5a){if(_0x268e5a){_0x1a8aa4['body'][_0xaff6('0x51')]=_0x268e5a['id'];_0x1a8aa4[_0xaff6('0x48')][_0xaff6('0x52')]=integrations['getSubjects'](_0x1a8aa4['body']['channel'],_0x1a8aa4[_0xaff6('0x48')][_0xaff6('0x3d')]);_0x1a8aa4[_0xaff6('0x48')][_0xaff6('0x53')]=integrations[_0xaff6('0x54')](_0x1a8aa4[_0xaff6('0x48')]['channel'],_0x1a8aa4[_0xaff6('0x48')][_0xaff6('0x3d')]);return db[_0xaff6('0x4e')][_0xaff6('0x47')](_0x1a8aa4[_0xaff6('0x48')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xaff6('0x55')],'as':_0xaff6('0x53')}]});}return null;})['then'](respondWithResult(_0x5a440e,null))['catch'](handleError(_0x5a440e,null));};exports[_0xaff6('0x56')]=function(_0x48860c,_0x32c744,_0x1f9418){var _0x4b74f9='';var _0x16b7dd=['id',_0xaff6('0x28'),_0xaff6('0x57'),_0xaff6('0x58'),_0xaff6('0x59'),'date_start',_0xaff6('0x5a'),_0xaff6('0x5b'),_0xaff6('0x5c'),'parent_type',_0xaff6('0x5d'),'direction'];return db[_0xaff6('0x2b')][_0xaff6('0x4d')]({'where':{'id':_0x48860c[_0xaff6('0x4a')]['id']},'attributes':['id',_0xaff6('0x5e'),_0xaff6('0x5f'),_0xaff6('0x60')]})[_0xaff6('0x25')](handleEntityNotFound(_0x32c744,null))[_0xaff6('0x25')](function(_0x104566){if(_0x104566){_0x4b74f9=_0x104566[_0xaff6('0x60')];var _0x20646c=_0x4b74f9['slice'](-0x1);if(_0x20646c==='/'){_0x4b74f9=_0x4b74f9[_0xaff6('0x61')](0x0,_0x4b74f9[_0xaff6('0x62')](_0x20646c));}return rp({'method':_0xaff6('0x63'),'uri':util['format'](_0xaff6('0x64'),_0x4b74f9,_0xaff6('0x65')),'json':!![],'form':{'method':'login','input_type':_0xaff6('0x66'),'response_type':_0xaff6('0x66'),'rest_data':JSON[_0xaff6('0x67')]({'user_auth':{'user_name':_0x104566[_0xaff6('0x5e')],'password':_0x104566[_0xaff6('0x5f')],'encryption':'PLAIN'},'application':_0xaff6('0x68')})}});}})[_0xaff6('0x25')](function(_0x429232){if(_0x429232&&_0x429232[_0xaff6('0x28')]!==_0xaff6('0x69')&&_0x429232['name']!==_0xaff6('0x6a')){return rp({'method':_0xaff6('0x63'),'uri':util[_0xaff6('0x6b')]('%s%s',_0x4b74f9,_0xaff6('0x65')),'json':!![],'form':{'method':_0xaff6('0x6c'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xaff6('0x67')]({'session':_0x429232['id'],'module_name':_0xaff6('0x6d')})}})[_0xaff6('0x25')](function(_0x3ad12d){if(_0x3ad12d){var _0x6123b5=_[_0xaff6('0x6e')](_0x3ad12d[_0xaff6('0x6f')]);_[_0xaff6('0x70')](_0x6123b5,function(_0x3acfd5){return _0x16b7dd['includes'](_0x3acfd5[_0xaff6('0x28')]);});return{'count':_0x6123b5[_0xaff6('0x4f')],'rows':_[_0xaff6('0x2f')](_0x6123b5,function(_0x13b9c8){return{'id':_0x13b9c8[_0xaff6('0x28')],'name':_0x13b9c8['label'],'custom':_[_0xaff6('0x71')](_0x13b9c8[_0xaff6('0x28')],'_c')?!![]:![],'options':_0x13b9c8[_0xaff6('0x3f')]?_['map'](_[_0xaff6('0x6e')](_0x13b9c8[_0xaff6('0x3f')]),function(_0x122cea){return{'name':_0x122cea[_0xaff6('0x72')],'value':_0x122cea[_0xaff6('0x28')]};}):[]};})};}})[_0xaff6('0x25')](respondWithResult(_0x32c744,null))[_0xaff6('0x43')](function(_0x402807){var _0x57accb=_0x48860c['query']['test']?0x1f4:_0x402807['statusCode']||0x1f4;logger[_0xaff6('0x26')](_0xaff6('0x73'),_0xaff6('0x56'),_0x57accb,JSON['stringify'](_0x402807));delete _0x402807[_0xaff6('0x28')];if(_0x57accb===0x191){_0x57accb=0x190;}_0x32c744[_0xaff6('0x1d')](_0x57accb)[_0xaff6('0x29')](_0x48860c[_0xaff6('0x30')][_0xaff6('0x74')]?{'message':_0xaff6('0x75'),'statusCode':_0x402807[_0xaff6('0x76')]}:_0x402807);});}else{var _0x1bf215=0x1f4;_0x32c744[_0xaff6('0x1d')](_0x1bf215)[_0xaff6('0x29')]({'message':_0xaff6('0x75'),'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 298fc41..b57615b 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 _0x0b4b=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x250bf7,_0xe89f16){var _0x58fe2b=function(_0x2a135a){while(--_0x2a135a){_0x250bf7['push'](_0x250bf7['shift']());}};_0x58fe2b(++_0xe89f16);}(_0x0b4b,0x16a));var _0xb0b4=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x0b4b[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0xb0b4('0x0'));var util=require('util');var logger=require(_0xb0b4('0x1'))(_0xb0b4('0x2'));var moment=require('moment');var BPromise=require(_0xb0b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0b4('0x4'));var rimraf=require('rimraf');var config=require(_0xb0b4('0x5'));var attributes=require(_0xb0b4('0x6'));var integrations=require(_0xb0b4('0x7'));module[_0xb0b4('0x8')]=function(_0x791956,_0x378f36){return _0x791956[_0xb0b4('0x9')](_0xb0b4('0xa'),attributes,{'tableName':_0xb0b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25b7=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x4a3bc2,_0x4e98a9){var _0x2703b8=function(_0x9ab551){while(--_0x9ab551){_0x4a3bc2['push'](_0x4a3bc2['shift']());}};_0x2703b8(++_0x4e98a9);}(_0x25b7,0x1d4));var _0x725b=function(_0x511111,_0x4ab3d8){_0x511111=_0x511111-0x0;var _0x265601=_0x25b7[_0x511111];return _0x265601;};'use strict';var _=require(_0x725b('0x0'));var util=require('util');var logger=require(_0x725b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x725b('0x2'));var rp=require(_0x725b('0x3'));var fs=require('fs');var path=require(_0x725b('0x4'));var rimraf=require(_0x725b('0x5'));var config=require(_0x725b('0x6'));var attributes=require(_0x725b('0x7'));var integrations=require(_0x725b('0x8'));module[_0x725b('0x9')]=function(_0x5540c6,_0x2997d2){return _0x5540c6[_0x725b('0xa')](_0x725b('0xb'),attributes,{'tableName':_0x725b('0xc'),'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 a19a6ec..f542da8 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 _0xfeca=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3c9fcf,_0x4f639f){var _0x26d6a5=function(_0x352d4c){while(--_0x352d4c){_0x3c9fcf['push'](_0x3c9fcf['shift']());}};_0x26d6a5(++_0x4f639f);}(_0xfeca,0x1ad));var _0xafec=function(_0x44c2a4,_0xe609b){_0x44c2a4=_0x44c2a4-0x0;var _0x5e1427=_0xfeca[_0x44c2a4];return _0x5e1427;};'use strict';var _=require(_0xafec('0x0'));var util=require('util');var moment=require(_0xafec('0x1'));var BPromise=require('bluebird');var rs=require(_0xafec('0x2'));var fs=require('fs');var Redis=require(_0xafec('0x3'));var db=require(_0xafec('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xafec('0x5'));var config=require(_0xafec('0x6'));var jayson=require(_0xafec('0x7'));var client=jayson[_0xafec('0x8')][_0xafec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c8b8f,_0xc085bc,_0x3abf8c){return new BPromise(function(_0x6eeb97,_0xff4fda){return client[_0xafec('0xa')](_0x7c8b8f,_0x3abf8c)[_0xafec('0xb')](function(_0x2ad403){logger[_0xafec('0xc')](_0xafec('0xd'),_0xc085bc,_0xafec('0xe'));logger[_0xafec('0xf')](_0xafec('0x10'),_0xc085bc,_0xafec('0xe'),JSON[_0xafec('0x11')](_0x2ad403));if(_0x2ad403[_0xafec('0x12')]){if(_0x2ad403[_0xafec('0x12')]['code']===0x1f4){logger[_0xafec('0x12')](_0xafec('0xd'),_0xc085bc,_0x2ad403[_0xafec('0x12')][_0xafec('0x13')]);return _0xff4fda(_0x2ad403[_0xafec('0x12')]['message']);}logger['error'](_0xafec('0xd'),_0xc085bc,_0x2ad403[_0xafec('0x12')][_0xafec('0x13')]);return _0x6eeb97(_0x2ad403[_0xafec('0x12')][_0xafec('0x13')]);}else{logger[_0xafec('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0xc085bc,_0xafec('0xe'));_0x6eeb97(_0x2ad403['result']['message']);}})[_0xafec('0x14')](function(_0x19159b){logger[_0xafec('0x12')](_0xafec('0xd'),_0xc085bc,_0x19159b);_0xff4fda(_0x19159b);});});}exports[_0xafec('0x15')]=function(_0x374638){var _0x3a9a87=this;return new Promise(function(_0x2ac40c,_0x88915e){return db[_0xafec('0x16')][_0xafec('0x17')]({'raw':_0x374638[_0xafec('0x18')]?_0x374638['options'][_0xafec('0x19')]===undefined?!![]:![]:!![],'where':_0x374638[_0xafec('0x18')]?_0x374638[_0xafec('0x18')]['where']||null:null,'attributes':_0x374638[_0xafec('0x18')]?_0x374638['options'][_0xafec('0x1a')]||null:null,'limit':_0x374638[_0xafec('0x18')]?_0x374638[_0xafec('0x18')][_0xafec('0x1b')]||null:null,'include':_0x374638[_0xafec('0x18')]?_0x374638[_0xafec('0x18')][_0xafec('0x1c')]?_[_0xafec('0x1d')](_0x374638[_0xafec('0x18')][_0xafec('0x1c')],function(_0x5e110c){return{'model':db[_0x5e110c[_0xafec('0x1e')]],'as':_0x5e110c['as'],'attributes':_0x5e110c['attributes'],'include':_0x5e110c[_0xafec('0x1c')]?_[_0xafec('0x1d')](_0x5e110c['include'],function(_0xe2c10a){return{'model':db[_0xe2c10a[_0xafec('0x1e')]],'as':_0xe2c10a['as'],'attributes':_0xe2c10a[_0xafec('0x1a')],'include':_0xe2c10a[_0xafec('0x1c')]?_[_0xafec('0x1d')](_0xe2c10a['include'],function(_0x210263){return{'model':db[_0x210263[_0xafec('0x1e')]],'as':_0x210263['as'],'attributes':_0x210263[_0xafec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafec('0xb')](function(_0x2826ab){logger[_0xafec('0xc')](_0xafec('0x15'),_0x374638);logger[_0xafec('0xf')](_0xafec('0x15'),_0x374638,JSON[_0xafec('0x11')](_0x2826ab));_0x2ac40c(_0x2826ab);})[_0xafec('0x14')](function(_0x587f08){logger['error'](_0xafec('0x15'),_0x587f08[_0xafec('0x13')],_0x374638);_0x88915e(_0x3a9a87[_0xafec('0x12')](0x1f4,_0x587f08[_0xafec('0x13')]));});});};exports[_0xafec('0x1f')]=function(_0x598d3c){var _0x3dca1f=this;return new Promise(function(_0x135886,_0x5cae0c){return db[_0xafec('0x16')][_0xafec('0x20')]({'raw':_0x598d3c[_0xafec('0x18')]?_0x598d3c[_0xafec('0x18')][_0xafec('0x19')]===undefined?!![]:![]:!![],'where':_0x598d3c[_0xafec('0x18')]?_0x598d3c[_0xafec('0x18')][_0xafec('0x21')]||null:null,'attributes':_0x598d3c['options']?_0x598d3c[_0xafec('0x18')]['attributes']||null:null,'include':_0x598d3c[_0xafec('0x18')]?_0x598d3c[_0xafec('0x18')]['include']?_[_0xafec('0x1d')](_0x598d3c['options'][_0xafec('0x1c')],function(_0x5b44d3){return{'model':db[_0x5b44d3['model']],'as':_0x5b44d3['as'],'attributes':_0x5b44d3[_0xafec('0x1a')],'include':_0x5b44d3[_0xafec('0x1c')]?_['map'](_0x5b44d3[_0xafec('0x1c')],function(_0xe0dc18){return{'model':db[_0xe0dc18[_0xafec('0x1e')]],'as':_0xe0dc18['as'],'attributes':_0xe0dc18['attributes'],'include':_0xe0dc18[_0xafec('0x1c')]?_[_0xafec('0x1d')](_0xe0dc18[_0xafec('0x1c')],function(_0x3c5edb){return{'model':db[_0x3c5edb['model']],'as':_0x3c5edb['as'],'attributes':_0x3c5edb[_0xafec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xafec('0xb')](function(_0x5dfccb){logger['info'](_0xafec('0x1f'),_0x598d3c);logger[_0xafec('0xf')](_0xafec('0x1f'),_0x598d3c,JSON[_0xafec('0x11')](_0x5dfccb));_0x135886(_0x5dfccb);})[_0xafec('0x14')](function(_0x1d6e16){logger[_0xafec('0x12')]('ShowSugarcrmAccount',_0x1d6e16[_0xafec('0x13')],_0x598d3c);_0x5cae0c(_0x3dca1f[_0xafec('0x12')](0x1f4,_0x1d6e16[_0xafec('0x13')]));});});}; \ No newline at end of file +var _0xa826=['error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','SugarcrmAccount','ShowSugarcrmAccount','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0xaa8317,_0x427edf){var _0x4a3bda=function(_0x4bdb3c){while(--_0x4bdb3c){_0xaa8317['push'](_0xaa8317['shift']());}};_0x4a3bda(++_0x427edf);}(_0xa826,0x97));var _0x6a82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa826[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x6a82('0x0'));var util=require(_0x6a82('0x1'));var moment=require(_0x6a82('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a82('0x3'))['db'];var utils=require(_0x6a82('0x4'));var logger=require(_0x6a82('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6a82('0x6'));var client=jayson[_0x6a82('0x7')][_0x6a82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5803ab,_0x51ab96,_0x1a5aeb){return new BPromise(function(_0x5d84a3,_0x3a73f9){return client[_0x6a82('0x9')](_0x5803ab,_0x1a5aeb)[_0x6a82('0xa')](function(_0x1daa39){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x51ab96,_0x6a82('0xb'));logger[_0x6a82('0xc')](_0x6a82('0xd'),_0x51ab96,_0x6a82('0xb'),JSON['stringify'](_0x1daa39));if(_0x1daa39[_0x6a82('0xe')]){if(_0x1daa39['error'][_0x6a82('0xf')]===0x1f4){logger['error'](_0x6a82('0x10'),_0x51ab96,_0x1daa39['error'][_0x6a82('0x11')]);return _0x3a73f9(_0x1daa39['error'][_0x6a82('0x11')]);}logger[_0x6a82('0xe')](_0x6a82('0x10'),_0x51ab96,_0x1daa39['error'][_0x6a82('0x11')]);return _0x5d84a3(_0x1daa39[_0x6a82('0xe')][_0x6a82('0x11')]);}else{logger[_0x6a82('0x12')](_0x6a82('0x10'),_0x51ab96,_0x6a82('0xb'));_0x5d84a3(_0x1daa39['result']['message']);}})['catch'](function(_0x3072f7){logger[_0x6a82('0xe')](_0x6a82('0x10'),_0x51ab96,_0x3072f7);_0x3a73f9(_0x3072f7);});});}exports[_0x6a82('0x13')]=function(_0x45cbf8){var _0x184c1e=this;return new Promise(function(_0x2aa81c,_0x4ab6a9){return db['SugarcrmAccount'][_0x6a82('0x14')]({'raw':_0x45cbf8['options']?_0x45cbf8[_0x6a82('0x15')][_0x6a82('0x16')]===undefined?!![]:![]:!![],'where':_0x45cbf8[_0x6a82('0x15')]?_0x45cbf8['options'][_0x6a82('0x17')]||null:null,'attributes':_0x45cbf8[_0x6a82('0x15')]?_0x45cbf8['options'][_0x6a82('0x18')]||null:null,'limit':_0x45cbf8[_0x6a82('0x15')]?_0x45cbf8['options'][_0x6a82('0x19')]||null:null,'include':_0x45cbf8[_0x6a82('0x15')]?_0x45cbf8[_0x6a82('0x15')]['include']?_['map'](_0x45cbf8[_0x6a82('0x15')][_0x6a82('0x1a')],function(_0x3adcef){return{'model':db[_0x3adcef['model']],'as':_0x3adcef['as'],'attributes':_0x3adcef['attributes'],'include':_0x3adcef[_0x6a82('0x1a')]?_[_0x6a82('0x1b')](_0x3adcef[_0x6a82('0x1a')],function(_0x2981cb){return{'model':db[_0x2981cb[_0x6a82('0x1c')]],'as':_0x2981cb['as'],'attributes':_0x2981cb[_0x6a82('0x18')],'include':_0x2981cb[_0x6a82('0x1a')]?_['map'](_0x2981cb['include'],function(_0x1aadc0){return{'model':db[_0x1aadc0[_0x6a82('0x1c')]],'as':_0x1aadc0['as'],'attributes':_0x1aadc0[_0x6a82('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x245ce5){logger[_0x6a82('0x12')](_0x6a82('0x13'),_0x45cbf8);logger[_0x6a82('0xc')](_0x6a82('0x13'),_0x45cbf8,JSON[_0x6a82('0x1d')](_0x245ce5));_0x2aa81c(_0x245ce5);})[_0x6a82('0x1e')](function(_0x2cef13){logger[_0x6a82('0xe')](_0x6a82('0x13'),_0x2cef13[_0x6a82('0x11')],_0x45cbf8);_0x4ab6a9(_0x184c1e[_0x6a82('0xe')](0x1f4,_0x2cef13[_0x6a82('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x1a410f){var _0x5b4629=this;return new Promise(function(_0x563b93,_0x16094){return db[_0x6a82('0x1f')]['find']({'raw':_0x1a410f['options']?_0x1a410f[_0x6a82('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1a410f[_0x6a82('0x15')]?_0x1a410f[_0x6a82('0x15')]['where']||null:null,'attributes':_0x1a410f[_0x6a82('0x15')]?_0x1a410f[_0x6a82('0x15')]['attributes']||null:null,'include':_0x1a410f[_0x6a82('0x15')]?_0x1a410f['options'][_0x6a82('0x1a')]?_[_0x6a82('0x1b')](_0x1a410f[_0x6a82('0x15')]['include'],function(_0x13dca9){return{'model':db[_0x13dca9[_0x6a82('0x1c')]],'as':_0x13dca9['as'],'attributes':_0x13dca9[_0x6a82('0x18')],'include':_0x13dca9[_0x6a82('0x1a')]?_[_0x6a82('0x1b')](_0x13dca9['include'],function(_0x45710d){return{'model':db[_0x45710d[_0x6a82('0x1c')]],'as':_0x45710d['as'],'attributes':_0x45710d[_0x6a82('0x18')],'include':_0x45710d[_0x6a82('0x1a')]?_[_0x6a82('0x1b')](_0x45710d['include'],function(_0x4e5d81){return{'model':db[_0x4e5d81['model']],'as':_0x4e5d81['as'],'attributes':_0x4e5d81[_0x6a82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a82('0xa')](function(_0x389cc9){logger[_0x6a82('0x12')]('ShowSugarcrmAccount',_0x1a410f);logger[_0x6a82('0xc')](_0x6a82('0x20'),_0x1a410f,JSON[_0x6a82('0x1d')](_0x389cc9));_0x563b93(_0x389cc9);})[_0x6a82('0x1e')](function(_0x1d01d7){logger['error'](_0x6a82('0x20'),_0x1d01d7['message'],_0x1a410f);_0x16094(_0x5b4629[_0x6a82('0xe')](0x1f4,_0x1d01d7[_0x6a82('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 49dc093..9fa9960 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 _0x26f0=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x2737b9,_0x591d52){var _0x19b617=function(_0x4cd3ae){while(--_0x4cd3ae){_0x2737b9['push'](_0x2737b9['shift']());}};_0x19b617(++_0x591d52);}(_0x26f0,0xf4));var _0x026f=function(_0x3d980e,_0x3cea3f){_0x3d980e=_0x3d980e-0x0;var _0x4517c7=_0x26f0[_0x3d980e];return _0x4517c7;};'use strict';var multer=require(_0x026f('0x0'));var util=require(_0x026f('0x1'));var path=require(_0x026f('0x2'));var timeout=require(_0x026f('0x3'));var express=require('express');var router=express[_0x026f('0x4')]();var fs_extra=require(_0x026f('0x5'));var auth=require(_0x026f('0x6'));var interaction=require(_0x026f('0x7'));var config=require(_0x026f('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x026f('0x9')]('/',auth['isAuthenticated'](),controller[_0x026f('0xa')]);router['get'](_0x026f('0xb'),auth[_0x026f('0xc')](),controller['show']);router[_0x026f('0x9')]('/:id/fields',auth[_0x026f('0xc')](),controller[_0x026f('0xd')]);router['get'](_0x026f('0xe'),auth['isAuthenticated'](),controller[_0x026f('0xf')]);router[_0x026f('0x9')](_0x026f('0x10'),auth[_0x026f('0xc')](),controller[_0x026f('0x11')]);router[_0x026f('0x12')]('/',auth[_0x026f('0xc')](),controller['create']);router[_0x026f('0x13')](_0x026f('0xb'),auth[_0x026f('0xc')](),controller[_0x026f('0x14')]);router[_0x026f('0x15')](_0x026f('0xb'),auth[_0x026f('0xc')](),controller[_0x026f('0x16')]);module[_0x026f('0x17')]=router; \ No newline at end of file +var _0xf367=['/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xf367,0x1b9));var _0x7f36=function(_0x51d921,_0x2f9ba3){_0x51d921=_0x51d921-0x0;var _0x39ca56=_0xf367[_0x51d921];return _0x39ca56;};'use strict';var multer=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var path=require(_0x7f36('0x2'));var timeout=require(_0x7f36('0x3'));var express=require('express');var router=express[_0x7f36('0x4')]();var fs_extra=require(_0x7f36('0x5'));var auth=require(_0x7f36('0x6'));var interaction=require(_0x7f36('0x7'));var config=require('../../config/environment');var controller=require(_0x7f36('0x8'));router[_0x7f36('0x9')]('/',auth[_0x7f36('0xa')](),controller[_0x7f36('0xb')]);router['get'](_0x7f36('0xc'),auth[_0x7f36('0xa')](),controller[_0x7f36('0xd')]);router[_0x7f36('0x9')]('/:id/fields',auth[_0x7f36('0xa')](),controller[_0x7f36('0xe')]);router[_0x7f36('0x9')](_0x7f36('0xf'),auth[_0x7f36('0xa')](),controller[_0x7f36('0x10')]);router['get']('/:id/descriptions',auth[_0x7f36('0xa')](),controller[_0x7f36('0x11')]);router[_0x7f36('0x12')]('/',auth[_0x7f36('0xa')](),controller[_0x7f36('0x13')]);router[_0x7f36('0x14')](_0x7f36('0xc'),auth[_0x7f36('0xa')](),controller['update']);router[_0x7f36('0x15')]('/:id',auth[_0x7f36('0xa')](),controller[_0x7f36('0x16')]);module[_0x7f36('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bafefae..7f4f08e 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 _0x048c=['exports','STRING'];(function(_0x332926,_0x199a9f){var _0x2fb205=function(_0x59e599){while(--_0x59e599){_0x332926['push'](_0x332926['shift']());}};_0x2fb205(++_0x199a9f);}(_0x048c,0x1cc));var _0xc048=function(_0xcd02aa,_0x13625a){_0xcd02aa=_0xcd02aa-0x0;var _0x4b6d99=_0x048c[_0xcd02aa];return _0x4b6d99;};'use strict';var Sequelize=require('sequelize');module[_0xc048('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc048('0x1')]}}; \ No newline at end of file +var _0xba25=['exports','STRING','sequelize'];(function(_0x2eb769,_0xde4bc3){var _0x19f008=function(_0x105572){while(--_0x105572){_0x2eb769['push'](_0x2eb769['shift']());}};_0x19f008(++_0xde4bc3);}(_0xba25,0x11f));var _0x5ba2=function(_0x2e69f5,_0x2c9e33){_0x2e69f5=_0x2e69f5-0x0;var _0x44e177=_0xba25[_0x2e69f5];return _0x44e177;};'use strict';var Sequelize=require(_0x5ba2('0x0'));module[_0x5ba2('0x1')]={'name':{'type':Sequelize[_0x5ba2('0x2')]},'description':{'type':Sequelize[_0x5ba2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9158926..4115c1d 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 _0x382b=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','filters','find','create','body','params','findOne','SugarcrmField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','update','destroy','then','error','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type'];(function(_0x3bd82a,_0x5bde5b){var _0x480b2d=function(_0x31e018){while(--_0x31e018){_0x3bd82a['push'](_0x3bd82a['shift']());}};_0x480b2d(++_0x5bde5b);}(_0x382b,0xbf));var _0xb382=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x382b[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xb382('0x0'));var rimraf=require(_0xb382('0x1'));var zipdir=require(_0xb382('0x2'));var jsonpatch=require(_0xb382('0x3'));var rp=require('request-promise');var moment=require(_0xb382('0x4'));var BPromise=require(_0xb382('0x5'));var Mustache=require('mustache');var util=require(_0xb382('0x6'));var path=require(_0xb382('0x7'));var sox=require(_0xb382('0x8'));var csv=require(_0xb382('0x9'));var ejs=require(_0xb382('0xa'));var fs=require('fs');var fs_extra=require(_0xb382('0xb'));var _=require('lodash');var squel=require(_0xb382('0xc'));var crypto=require(_0xb382('0xd'));var jsforce=require(_0xb382('0xe'));var deskjs=require(_0xb382('0xf'));var toCsv=require(_0xb382('0x9'));var querystring=require(_0xb382('0x10'));var Papa=require(_0xb382('0x11'));var Redis=require(_0xb382('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb382('0x13'));var hardwareService=require(_0xb382('0x14'));var logger=require(_0xb382('0x15'))(_0xb382('0x16'));var utils=require(_0xb382('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb382('0x18'));var db=require(_0xb382('0x19'))['db'];function respondWithStatusCode(_0x272d16,_0x5af4c7){_0x5af4c7=_0x5af4c7||0xcc;return function(_0x202869){if(_0x202869){return _0x272d16[_0xb382('0x1a')](_0x5af4c7);}return _0x272d16[_0xb382('0x1b')](_0x5af4c7)[_0xb382('0x1c')]();};}function respondWithResult(_0x5087f4,_0x10f408){_0x10f408=_0x10f408||0xc8;return function(_0x47fad1){if(_0x47fad1){return _0x5087f4[_0xb382('0x1b')](_0x10f408)[_0xb382('0x1d')](_0x47fad1);}};}function respondWithFilteredResult(_0x247bf9,_0x2014ae){return function(_0x3aced1){if(_0x3aced1){var _0x4a17ed=typeof _0x2014ae[_0xb382('0x1e')]===_0xb382('0x1f')&&typeof _0x2014ae[_0xb382('0x20')]===_0xb382('0x1f');var _0x4da52a=_0x3aced1[_0xb382('0x21')];var _0x2369d0=_0x4a17ed?0x0:_0x2014ae[_0xb382('0x1e')];var _0x493efd=_0x4a17ed?_0x3aced1[_0xb382('0x21')]:_0x2014ae['offset']+_0x2014ae['limit'];var _0x1e2025;if(_0x493efd>=_0x4da52a){_0x493efd=_0x4da52a;_0x1e2025=0xc8;}else{_0x1e2025=0xce;}_0x247bf9[_0xb382('0x1b')](_0x1e2025);return _0x247bf9[_0xb382('0x22')](_0xb382('0x23'),_0x2369d0+'-'+_0x493efd+'/'+_0x4da52a)[_0xb382('0x1d')](_0x3aced1);}return null;};}function patchUpdates(_0x141647){return function(_0x2a5223){try{jsonpatch[_0xb382('0x24')](_0x2a5223,_0x141647,!![]);}catch(_0x42ec9a){return BPromise[_0xb382('0x25')](_0x42ec9a);}return _0x2a5223['save']();};}function saveUpdates(_0x18c24a,_0x21b40f){return function(_0x4885c5){if(_0x4885c5){return _0x4885c5[_0xb382('0x26')](_0x18c24a)['then'](function(_0x190d6c){return _0x190d6c;});}return null;};}function removeEntity(_0x51a787,_0x34de02){return function(_0x36558f){if(_0x36558f){return _0x36558f[_0xb382('0x27')]()[_0xb382('0x28')](function(){_0x51a787[_0xb382('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36548c,_0x4bb70b){return function(_0x4f840e){if(!_0x4f840e){_0x36548c[_0xb382('0x1a')](0x194);}return _0x4f840e;};}function handleError(_0x30f53a,_0x54d03c){_0x54d03c=_0x54d03c||0x1f4;return function(_0x3fef24){logger[_0xb382('0x29')](_0x3fef24['stack']);if(_0x3fef24[_0xb382('0x2a')]){delete _0x3fef24['name'];}_0x30f53a['status'](_0x54d03c)[_0xb382('0x2b')](_0x3fef24);};}exports['index']=function(_0x284698,_0x3064f8){var _0x13ebc5={},_0x231b7c={},_0x14538b={'count':0x0,'rows':[]};var _0x125474=_[_0xb382('0x2c')](db[_0xb382('0x2d')][_0xb382('0x2e')],function(_0xd5f942){return{'name':_0xd5f942[_0xb382('0x2f')],'type':_0xd5f942[_0xb382('0x30')][_0xb382('0x31')]};});_0x231b7c[_0xb382('0x32')]=_['map'](_0x125474,'name');_0x231b7c[_0xb382('0x33')]=_[_0xb382('0x34')](_0x284698[_0xb382('0x33')]);_0x231b7c['filters']=_[_0xb382('0x35')](_0x231b7c[_0xb382('0x32')],_0x231b7c[_0xb382('0x33')]);_0x13ebc5[_0xb382('0x36')]=_['intersection'](_0x231b7c['model'],qs[_0xb382('0x37')](_0x284698[_0xb382('0x33')][_0xb382('0x37')]));_0x13ebc5['attributes']=_0x13ebc5[_0xb382('0x36')][_0xb382('0x38')]?_0x13ebc5['attributes']:_0x231b7c['model'];if(!_0x284698[_0xb382('0x33')][_0xb382('0x39')](_0xb382('0x3a'))){_0x13ebc5[_0xb382('0x20')]=qs[_0xb382('0x20')](_0x284698[_0xb382('0x33')][_0xb382('0x20')]);_0x13ebc5[_0xb382('0x1e')]=qs[_0xb382('0x1e')](_0x284698[_0xb382('0x33')]['offset']);}_0x13ebc5['order']=qs[_0xb382('0x3b')](_0x284698[_0xb382('0x33')][_0xb382('0x3b')]);_0x13ebc5[_0xb382('0x3c')]=qs['filters'](_[_0xb382('0x3d')](_0x284698['query'],_0x231b7c['filters']),_0x125474);if(_0x284698[_0xb382('0x33')][_0xb382('0x3e')]){_0x13ebc5[_0xb382('0x3c')]=_[_0xb382('0x3f')](_0x13ebc5[_0xb382('0x3c')],{'$or':_[_0xb382('0x2c')](_0x125474,function(_0x51a6ed){if(_0x51a6ed[_0xb382('0x30')]!=='VIRTUAL'){var _0x1fc5a5={};_0x1fc5a5[_0x51a6ed[_0xb382('0x2a')]]={'$like':'%'+_0x284698['query'][_0xb382('0x3e')]+'%'};return _0x1fc5a5;}})});}_0x13ebc5=_['merge']({},_0x13ebc5,_0x284698[_0xb382('0x40')]);var _0x56a9dc={'where':_0x13ebc5[_0xb382('0x3c')]};return db[_0xb382('0x2d')][_0xb382('0x21')](_0x56a9dc)['then'](function(_0x5aafff){_0x14538b[_0xb382('0x21')]=_0x5aafff;if(_0x284698[_0xb382('0x33')][_0xb382('0x41')]){_0x13ebc5['include']=[{'all':!![]}];}return db[_0xb382('0x2d')]['findAll'](_0x13ebc5);})[_0xb382('0x28')](function(_0x3d86cb){_0x14538b[_0xb382('0x42')]=_0x3d86cb;return _0x14538b;})[_0xb382('0x28')](respondWithFilteredResult(_0x3064f8,_0x13ebc5))[_0xb382('0x43')](handleError(_0x3064f8,null));};exports[_0xb382('0x44')]=function(_0x445ba6,_0x5266ec){var _0x3a6487={'raw':![],'where':{'id':_0x445ba6['params']['id']}},_0x528cec={};_0x528cec[_0xb382('0x32')]=_[_0xb382('0x34')](db[_0xb382('0x2d')][_0xb382('0x2e')]);_0x528cec[_0xb382('0x33')]=_[_0xb382('0x34')](_0x445ba6[_0xb382('0x33')]);_0x528cec[_0xb382('0x45')]=_['intersection'](_0x528cec['model'],_0x528cec[_0xb382('0x33')]);_0x3a6487[_0xb382('0x36')]=_[_0xb382('0x35')](_0x528cec['model'],qs[_0xb382('0x37')](_0x445ba6[_0xb382('0x33')][_0xb382('0x37')]));_0x3a6487[_0xb382('0x36')]=_0x3a6487[_0xb382('0x36')][_0xb382('0x38')]?_0x3a6487[_0xb382('0x36')]:_0x528cec[_0xb382('0x32')];if(_0x445ba6[_0xb382('0x33')]['includeAll']){_0x3a6487['include']=[{'all':!![]}];}_0x3a6487=_['merge']({},_0x3a6487,_0x445ba6['options']);return db[_0xb382('0x2d')][_0xb382('0x46')](_0x3a6487)['then'](handleEntityNotFound(_0x5266ec,null))[_0xb382('0x28')](respondWithResult(_0x5266ec,null))[_0xb382('0x43')](handleError(_0x5266ec,null));};exports[_0xb382('0x47')]=function(_0x25dbad,_0x5cd737){return db['SugarcrmConfiguration'][_0xb382('0x47')](_0x25dbad[_0xb382('0x48')],{})[_0xb382('0x28')](respondWithResult(_0x5cd737,0xc9))['catch'](handleError(_0x5cd737,null));};exports[_0xb382('0x26')]=function(_0x2772a0,_0x3fbcf5){if(_0x2772a0[_0xb382('0x48')]['id']){delete _0x2772a0['body']['id'];}return db['SugarcrmConfiguration'][_0xb382('0x46')]({'where':{'id':_0x2772a0[_0xb382('0x49')]['id']}})[_0xb382('0x28')](handleEntityNotFound(_0x3fbcf5,null))['then'](saveUpdates(_0x2772a0[_0xb382('0x48')],null))[_0xb382('0x28')](respondWithResult(_0x3fbcf5,null))[_0xb382('0x43')](handleError(_0x3fbcf5,null));};exports['destroy']=function(_0x26649b,_0x31e937){return db['SugarcrmConfiguration'][_0xb382('0x46')]({'where':{'id':_0x26649b[_0xb382('0x49')]['id']}})[_0xb382('0x28')](handleEntityNotFound(_0x31e937,null))[_0xb382('0x28')](removeEntity(_0x31e937,null))['catch'](handleError(_0x31e937,null));};exports['getFields']=function(_0x59e150,_0x51f688,_0x36d7e4){var _0x367356={};var _0x12483e={};var _0x345cbd;var _0x91cc22;return db[_0xb382('0x2d')][_0xb382('0x4a')]({'where':{'id':_0x59e150[_0xb382('0x49')]['id']}})['then'](handleEntityNotFound(_0x51f688,null))[_0xb382('0x28')](function(_0x47e233){if(_0x47e233){_0x345cbd=_0x47e233;_0x12483e[_0xb382('0x32')]=_[_0xb382('0x34')](db[_0xb382('0x4b')]['rawAttributes']);_0x12483e[_0xb382('0x33')]=_[_0xb382('0x34')](_0x59e150[_0xb382('0x33')]);_0x12483e[_0xb382('0x45')]=_[_0xb382('0x35')](_0x12483e[_0xb382('0x32')],_0x12483e[_0xb382('0x33')]);_0x367356[_0xb382('0x36')]=_[_0xb382('0x35')](_0x12483e[_0xb382('0x32')],qs[_0xb382('0x37')](_0x59e150[_0xb382('0x33')][_0xb382('0x37')]));_0x367356[_0xb382('0x36')]=_0x367356[_0xb382('0x36')]['length']?_0x367356[_0xb382('0x36')]:_0x12483e[_0xb382('0x32')];_0x367356[_0xb382('0x4c')]=qs[_0xb382('0x3b')](_0x59e150[_0xb382('0x33')][_0xb382('0x3b')]);_0x367356[_0xb382('0x3c')]=qs[_0xb382('0x45')](_[_0xb382('0x3d')](_0x59e150[_0xb382('0x33')],_0x12483e[_0xb382('0x45')]));if(_0x59e150[_0xb382('0x33')]['filter']){_0x367356['where']=_['merge'](_0x367356[_0xb382('0x3c')],{'$or':_[_0xb382('0x2c')](_0x367356[_0xb382('0x36')],function(_0x5a8814){var _0x1ab79a={};_0x1ab79a[_0x5a8814]={'$like':'%'+_0x59e150[_0xb382('0x33')]['filter']+'%'};return _0x1ab79a;})});}_0x367356=_[_0xb382('0x3f')]({},_0x367356,_0x59e150[_0xb382('0x40')]);return _0x345cbd['getFields'](_0x367356);}})[_0xb382('0x28')](function(_0xc2edf5){if(_0xc2edf5){_0x91cc22=_0xc2edf5['length'];if(!_0x59e150['query']['hasOwnProperty'](_0xb382('0x3a'))){_0x367356['limit']=qs[_0xb382('0x20')](_0x59e150['query'][_0xb382('0x20')]);_0x367356[_0xb382('0x1e')]=qs[_0xb382('0x1e')](_0x59e150[_0xb382('0x33')][_0xb382('0x1e')]);}return _0x345cbd[_0xb382('0x4d')](_0x367356);}})[_0xb382('0x28')](function(_0x25c55b){if(_0x25c55b){return _0x25c55b?{'count':_0x91cc22,'rows':_0x25c55b}:null;}})[_0xb382('0x28')](respondWithResult(_0x51f688,null))[_0xb382('0x43')](handleError(_0x51f688,null));};exports['getSubjects']=function(_0x4e7019,_0x976b6c,_0x94e058){var _0x4568ab={};var _0x10020d={};var _0x57401a;var _0x24079b;return db[_0xb382('0x2d')]['findOne']({'where':{'id':_0x4e7019[_0xb382('0x49')]['id']}})[_0xb382('0x28')](handleEntityNotFound(_0x976b6c,null))[_0xb382('0x28')](function(_0x38c6c1){if(_0x38c6c1){_0x57401a=_0x38c6c1;_0x10020d[_0xb382('0x32')]=_[_0xb382('0x34')](db[_0xb382('0x4b')]['rawAttributes']);_0x10020d['query']=_[_0xb382('0x34')](_0x4e7019[_0xb382('0x33')]);_0x10020d[_0xb382('0x45')]=_[_0xb382('0x35')](_0x10020d['model'],_0x10020d['query']);_0x4568ab['attributes']=_[_0xb382('0x35')](_0x10020d[_0xb382('0x32')],qs[_0xb382('0x37')](_0x4e7019[_0xb382('0x33')]['fields']));_0x4568ab[_0xb382('0x36')]=_0x4568ab[_0xb382('0x36')]['length']?_0x4568ab[_0xb382('0x36')]:_0x10020d[_0xb382('0x32')];_0x4568ab[_0xb382('0x4c')]=qs['sort'](_0x4e7019[_0xb382('0x33')][_0xb382('0x3b')]);_0x4568ab[_0xb382('0x3c')]=qs[_0xb382('0x45')](_[_0xb382('0x3d')](_0x4e7019['query'],_0x10020d[_0xb382('0x45')]));if(_0x4e7019['query'][_0xb382('0x3e')]){_0x4568ab['where']=_[_0xb382('0x3f')](_0x4568ab[_0xb382('0x3c')],{'$or':_['map'](_0x4568ab['attributes'],function(_0x4b71af){var _0x3f7612={};_0x3f7612[_0x4b71af]={'$like':'%'+_0x4e7019[_0xb382('0x33')][_0xb382('0x3e')]+'%'};return _0x3f7612;})});}_0x4568ab=_['merge']({},_0x4568ab,_0x4e7019[_0xb382('0x40')]);return _0x57401a[_0xb382('0x4e')](_0x4568ab);}})[_0xb382('0x28')](function(_0x296a51){if(_0x296a51){_0x24079b=_0x296a51[_0xb382('0x38')];if(!_0x4e7019[_0xb382('0x33')][_0xb382('0x39')](_0xb382('0x3a'))){_0x4568ab[_0xb382('0x20')]=qs[_0xb382('0x20')](_0x4e7019[_0xb382('0x33')]['limit']);_0x4568ab[_0xb382('0x1e')]=qs[_0xb382('0x1e')](_0x4e7019[_0xb382('0x33')][_0xb382('0x1e')]);}return _0x57401a[_0xb382('0x4e')](_0x4568ab);}})[_0xb382('0x28')](function(_0x3f4a45){if(_0x3f4a45){return _0x3f4a45?{'count':_0x24079b,'rows':_0x3f4a45}:null;}})[_0xb382('0x28')](respondWithResult(_0x976b6c,null))[_0xb382('0x43')](handleError(_0x976b6c,null));};exports[_0xb382('0x4f')]=function(_0x5ae3d3,_0x229174,_0x3dc68b){var _0x440f91={};var _0x2e45bf={};var _0x11b170;var _0x2ff3e7;return db['SugarcrmConfiguration'][_0xb382('0x4a')]({'where':{'id':_0x5ae3d3[_0xb382('0x49')]['id']}})[_0xb382('0x28')](handleEntityNotFound(_0x229174,null))[_0xb382('0x28')](function(_0x438d16){if(_0x438d16){_0x11b170=_0x438d16;_0x2e45bf['model']=_['keys'](db[_0xb382('0x4b')][_0xb382('0x2e')]);_0x2e45bf['query']=_[_0xb382('0x34')](_0x5ae3d3[_0xb382('0x33')]);_0x2e45bf[_0xb382('0x45')]=_[_0xb382('0x35')](_0x2e45bf[_0xb382('0x32')],_0x2e45bf[_0xb382('0x33')]);_0x440f91[_0xb382('0x36')]=_[_0xb382('0x35')](_0x2e45bf[_0xb382('0x32')],qs[_0xb382('0x37')](_0x5ae3d3[_0xb382('0x33')][_0xb382('0x37')]));_0x440f91[_0xb382('0x36')]=_0x440f91['attributes']['length']?_0x440f91[_0xb382('0x36')]:_0x2e45bf[_0xb382('0x32')];_0x440f91['order']=qs[_0xb382('0x3b')](_0x5ae3d3[_0xb382('0x33')][_0xb382('0x3b')]);_0x440f91[_0xb382('0x3c')]=qs[_0xb382('0x45')](_[_0xb382('0x3d')](_0x5ae3d3[_0xb382('0x33')],_0x2e45bf[_0xb382('0x45')]));if(_0x5ae3d3[_0xb382('0x33')][_0xb382('0x3e')]){_0x440f91[_0xb382('0x3c')]=_[_0xb382('0x3f')](_0x440f91[_0xb382('0x3c')],{'$or':_['map'](_0x440f91[_0xb382('0x36')],function(_0x2de56e){var _0x1abb0f={};_0x1abb0f[_0x2de56e]={'$like':'%'+_0x5ae3d3['query']['filter']+'%'};return _0x1abb0f;})});}_0x440f91=_[_0xb382('0x3f')]({},_0x440f91,_0x5ae3d3[_0xb382('0x40')]);return _0x11b170[_0xb382('0x4f')](_0x440f91);}})[_0xb382('0x28')](function(_0x439d12){if(_0x439d12){_0x2ff3e7=_0x439d12[_0xb382('0x38')];if(!_0x5ae3d3[_0xb382('0x33')]['hasOwnProperty'](_0xb382('0x3a'))){_0x440f91[_0xb382('0x20')]=qs[_0xb382('0x20')](_0x5ae3d3['query'][_0xb382('0x20')]);_0x440f91[_0xb382('0x1e')]=qs[_0xb382('0x1e')](_0x5ae3d3[_0xb382('0x33')][_0xb382('0x1e')]);}return _0x11b170[_0xb382('0x4f')](_0x440f91);}})[_0xb382('0x28')](function(_0x335255){if(_0x335255){return _0x335255?{'count':_0x2ff3e7,'rows':_0x335255}:null;}})[_0xb382('0x28')](respondWithResult(_0x229174,null))[_0xb382('0x43')](handleError(_0x229174,null));}; \ No newline at end of file +var _0xee37=['SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','count','includeAll','rows','catch','show','params','keys','include','options','find','create','body','destroy','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','map'];(function(_0x4dcbbb,_0x513f25){var _0x40cac1=function(_0x22d650){while(--_0x22d650){_0x4dcbbb['push'](_0x4dcbbb['shift']());}};_0x40cac1(++_0x513f25);}(_0xee37,0xc2));var _0x7ee3=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0xee37[_0x4f3c9b];return _0x84e58a;};'use strict';var emlformat=require(_0x7ee3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ee3('0x1'));var jsonpatch=require(_0x7ee3('0x2'));var rp=require(_0x7ee3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ee3('0x4'));var util=require(_0x7ee3('0x5'));var path=require(_0x7ee3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ee3('0x7'));var _=require('lodash');var squel=require(_0x7ee3('0x8'));var crypto=require(_0x7ee3('0x9'));var jsforce=require(_0x7ee3('0xa'));var deskjs=require(_0x7ee3('0xb'));var toCsv=require(_0x7ee3('0xc'));var querystring=require('querystring');var Papa=require(_0x7ee3('0xd'));var Redis=require(_0x7ee3('0xe'));var authService=require(_0x7ee3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7ee3('0x10'));var hardwareService=require(_0x7ee3('0x11'));var logger=require('../../config/logger')(_0x7ee3('0x12'));var utils=require(_0x7ee3('0x13'));var config=require(_0x7ee3('0x14'));var licenseUtil=require(_0x7ee3('0x15'));var db=require(_0x7ee3('0x16'))['db'];function respondWithStatusCode(_0x40aac4,_0x59a96b){_0x59a96b=_0x59a96b||0xcc;return function(_0x4efbfe){if(_0x4efbfe){return _0x40aac4[_0x7ee3('0x17')](_0x59a96b);}return _0x40aac4[_0x7ee3('0x18')](_0x59a96b)['end']();};}function respondWithResult(_0x3b9811,_0x5c5152){_0x5c5152=_0x5c5152||0xc8;return function(_0x5b375e){if(_0x5b375e){return _0x3b9811[_0x7ee3('0x18')](_0x5c5152)[_0x7ee3('0x19')](_0x5b375e);}};}function respondWithFilteredResult(_0x46dbfb,_0x58b146){return function(_0x40aa30){if(_0x40aa30){var _0x33eb73=typeof _0x58b146[_0x7ee3('0x1a')]===_0x7ee3('0x1b')&&typeof _0x58b146[_0x7ee3('0x1c')]===_0x7ee3('0x1b');var _0x15d52b=_0x40aa30['count'];var _0x3ee695=_0x33eb73?0x0:_0x58b146['offset'];var _0x43b8ce=_0x33eb73?_0x40aa30['count']:_0x58b146['offset']+_0x58b146['limit'];var _0x3142c4;if(_0x43b8ce>=_0x15d52b){_0x43b8ce=_0x15d52b;_0x3142c4=0xc8;}else{_0x3142c4=0xce;}_0x46dbfb[_0x7ee3('0x18')](_0x3142c4);return _0x46dbfb[_0x7ee3('0x1d')](_0x7ee3('0x1e'),_0x3ee695+'-'+_0x43b8ce+'/'+_0x15d52b)['json'](_0x40aa30);}return null;};}function patchUpdates(_0x16434b){return function(_0x47f004){try{jsonpatch[_0x7ee3('0x1f')](_0x47f004,_0x16434b,!![]);}catch(_0x54a24b){return BPromise['reject'](_0x54a24b);}return _0x47f004[_0x7ee3('0x20')]();};}function saveUpdates(_0x6c9793,_0x1ac716){return function(_0x48c906){if(_0x48c906){return _0x48c906[_0x7ee3('0x21')](_0x6c9793)[_0x7ee3('0x22')](function(_0x58ebfc){return _0x58ebfc;});}return null;};}function removeEntity(_0x243f0b,_0x5aacd0){return function(_0x5a3d8f){if(_0x5a3d8f){return _0x5a3d8f['destroy']()[_0x7ee3('0x22')](function(){_0x243f0b[_0x7ee3('0x18')](0xcc)[_0x7ee3('0x23')]();});}};}function handleEntityNotFound(_0x4942fa,_0xe53fb3){return function(_0x398940){if(!_0x398940){_0x4942fa[_0x7ee3('0x17')](0x194);}return _0x398940;};}function handleError(_0x2e7aba,_0x2bdf74){_0x2bdf74=_0x2bdf74||0x1f4;return function(_0x50d0b0){logger[_0x7ee3('0x24')](_0x50d0b0[_0x7ee3('0x25')]);if(_0x50d0b0[_0x7ee3('0x26')]){delete _0x50d0b0[_0x7ee3('0x26')];}_0x2e7aba['status'](_0x2bdf74)['send'](_0x50d0b0);};}exports['index']=function(_0x3e94dc,_0x30913b){var _0x3355c2={},_0x518670={},_0x5f3503={'count':0x0,'rows':[]};var _0x36bc22=_[_0x7ee3('0x27')](db[_0x7ee3('0x28')][_0x7ee3('0x29')],function(_0x188f7d){return{'name':_0x188f7d[_0x7ee3('0x2a')],'type':_0x188f7d[_0x7ee3('0x2b')][_0x7ee3('0x2c')]};});_0x518670[_0x7ee3('0x2d')]=_[_0x7ee3('0x27')](_0x36bc22,_0x7ee3('0x26'));_0x518670[_0x7ee3('0x2e')]=_['keys'](_0x3e94dc[_0x7ee3('0x2e')]);_0x518670[_0x7ee3('0x2f')]=_[_0x7ee3('0x30')](_0x518670[_0x7ee3('0x2d')],_0x518670[_0x7ee3('0x2e')]);_0x3355c2[_0x7ee3('0x31')]=_[_0x7ee3('0x30')](_0x518670[_0x7ee3('0x2d')],qs[_0x7ee3('0x32')](_0x3e94dc[_0x7ee3('0x2e')]['fields']));_0x3355c2['attributes']=_0x3355c2[_0x7ee3('0x31')][_0x7ee3('0x33')]?_0x3355c2['attributes']:_0x518670[_0x7ee3('0x2d')];if(!_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x34')]('nolimit')){_0x3355c2['limit']=qs[_0x7ee3('0x1c')](_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x1c')]);_0x3355c2[_0x7ee3('0x1a')]=qs[_0x7ee3('0x1a')](_0x3e94dc['query'][_0x7ee3('0x1a')]);}_0x3355c2[_0x7ee3('0x35')]=qs[_0x7ee3('0x36')](_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x36')]);_0x3355c2['where']=qs['filters'](_[_0x7ee3('0x37')](_0x3e94dc[_0x7ee3('0x2e')],_0x518670['filters']),_0x36bc22);if(_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x38')]){_0x3355c2['where']=_[_0x7ee3('0x39')](_0x3355c2[_0x7ee3('0x3a')],{'$or':_[_0x7ee3('0x27')](_0x36bc22,function(_0x76c1c0){if(_0x76c1c0[_0x7ee3('0x2b')]!=='VIRTUAL'){var _0x62e8={};_0x62e8[_0x76c1c0['name']]={'$like':'%'+_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x38')]+'%'};return _0x62e8;}})});}_0x3355c2=_[_0x7ee3('0x39')]({},_0x3355c2,_0x3e94dc['options']);var _0x3d542b={'where':_0x3355c2[_0x7ee3('0x3a')]};return db[_0x7ee3('0x28')][_0x7ee3('0x3b')](_0x3d542b)[_0x7ee3('0x22')](function(_0x1291c1){_0x5f3503[_0x7ee3('0x3b')]=_0x1291c1;if(_0x3e94dc[_0x7ee3('0x2e')][_0x7ee3('0x3c')]){_0x3355c2['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x3355c2);})[_0x7ee3('0x22')](function(_0x2ce6a1){_0x5f3503[_0x7ee3('0x3d')]=_0x2ce6a1;return _0x5f3503;})[_0x7ee3('0x22')](respondWithFilteredResult(_0x30913b,_0x3355c2))[_0x7ee3('0x3e')](handleError(_0x30913b,null));};exports[_0x7ee3('0x3f')]=function(_0x503595,_0x5d0bec){var _0x46cf6b={'raw':![],'where':{'id':_0x503595[_0x7ee3('0x40')]['id']}},_0x307cc6={};_0x307cc6[_0x7ee3('0x2d')]=_['keys'](db[_0x7ee3('0x28')][_0x7ee3('0x29')]);_0x307cc6[_0x7ee3('0x2e')]=_[_0x7ee3('0x41')](_0x503595[_0x7ee3('0x2e')]);_0x307cc6[_0x7ee3('0x2f')]=_['intersection'](_0x307cc6[_0x7ee3('0x2d')],_0x307cc6[_0x7ee3('0x2e')]);_0x46cf6b[_0x7ee3('0x31')]=_[_0x7ee3('0x30')](_0x307cc6[_0x7ee3('0x2d')],qs[_0x7ee3('0x32')](_0x503595[_0x7ee3('0x2e')][_0x7ee3('0x32')]));_0x46cf6b['attributes']=_0x46cf6b[_0x7ee3('0x31')]['length']?_0x46cf6b[_0x7ee3('0x31')]:_0x307cc6['model'];if(_0x503595[_0x7ee3('0x2e')][_0x7ee3('0x3c')]){_0x46cf6b[_0x7ee3('0x42')]=[{'all':!![]}];}_0x46cf6b=_[_0x7ee3('0x39')]({},_0x46cf6b,_0x503595[_0x7ee3('0x43')]);return db[_0x7ee3('0x28')][_0x7ee3('0x44')](_0x46cf6b)[_0x7ee3('0x22')](handleEntityNotFound(_0x5d0bec,null))[_0x7ee3('0x22')](respondWithResult(_0x5d0bec,null))[_0x7ee3('0x3e')](handleError(_0x5d0bec,null));};exports[_0x7ee3('0x45')]=function(_0x51501a,_0x53fdd7){return db[_0x7ee3('0x28')][_0x7ee3('0x45')](_0x51501a[_0x7ee3('0x46')],{})['then'](respondWithResult(_0x53fdd7,0xc9))[_0x7ee3('0x3e')](handleError(_0x53fdd7,null));};exports[_0x7ee3('0x21')]=function(_0x4cfdd9,_0x4907d3){if(_0x4cfdd9[_0x7ee3('0x46')]['id']){delete _0x4cfdd9['body']['id'];}return db[_0x7ee3('0x28')][_0x7ee3('0x44')]({'where':{'id':_0x4cfdd9['params']['id']}})['then'](handleEntityNotFound(_0x4907d3,null))['then'](saveUpdates(_0x4cfdd9[_0x7ee3('0x46')],null))[_0x7ee3('0x22')](respondWithResult(_0x4907d3,null))['catch'](handleError(_0x4907d3,null));};exports[_0x7ee3('0x47')]=function(_0x5cf486,_0x52cae5){return db[_0x7ee3('0x28')][_0x7ee3('0x44')]({'where':{'id':_0x5cf486['params']['id']}})[_0x7ee3('0x22')](handleEntityNotFound(_0x52cae5,null))['then'](removeEntity(_0x52cae5,null))['catch'](handleError(_0x52cae5,null));};exports[_0x7ee3('0x48')]=function(_0x42d1d3,_0x21447,_0x385043){var _0xfb97da={};var _0x48030a={};var _0x48f2f5;var _0x559b1e;return db['SugarcrmConfiguration'][_0x7ee3('0x49')]({'where':{'id':_0x42d1d3['params']['id']}})[_0x7ee3('0x22')](handleEntityNotFound(_0x21447,null))[_0x7ee3('0x22')](function(_0x2d5da0){if(_0x2d5da0){_0x48f2f5=_0x2d5da0;_0x48030a[_0x7ee3('0x2d')]=_[_0x7ee3('0x41')](db[_0x7ee3('0x4a')][_0x7ee3('0x29')]);_0x48030a[_0x7ee3('0x2e')]=_[_0x7ee3('0x41')](_0x42d1d3[_0x7ee3('0x2e')]);_0x48030a[_0x7ee3('0x2f')]=_[_0x7ee3('0x30')](_0x48030a[_0x7ee3('0x2d')],_0x48030a[_0x7ee3('0x2e')]);_0xfb97da[_0x7ee3('0x31')]=_['intersection'](_0x48030a[_0x7ee3('0x2d')],qs[_0x7ee3('0x32')](_0x42d1d3[_0x7ee3('0x2e')][_0x7ee3('0x32')]));_0xfb97da['attributes']=_0xfb97da[_0x7ee3('0x31')][_0x7ee3('0x33')]?_0xfb97da[_0x7ee3('0x31')]:_0x48030a[_0x7ee3('0x2d')];_0xfb97da[_0x7ee3('0x35')]=qs[_0x7ee3('0x36')](_0x42d1d3[_0x7ee3('0x2e')]['sort']);_0xfb97da[_0x7ee3('0x3a')]=qs[_0x7ee3('0x2f')](_[_0x7ee3('0x37')](_0x42d1d3[_0x7ee3('0x2e')],_0x48030a['filters']));if(_0x42d1d3[_0x7ee3('0x2e')]['filter']){_0xfb97da[_0x7ee3('0x3a')]=_['merge'](_0xfb97da[_0x7ee3('0x3a')],{'$or':_['map'](_0xfb97da[_0x7ee3('0x31')],function(_0x7eea67){var _0x359742={};_0x359742[_0x7eea67]={'$like':'%'+_0x42d1d3['query']['filter']+'%'};return _0x359742;})});}_0xfb97da=_[_0x7ee3('0x39')]({},_0xfb97da,_0x42d1d3['options']);return _0x48f2f5['getFields'](_0xfb97da);}})['then'](function(_0x3675f3){if(_0x3675f3){_0x559b1e=_0x3675f3[_0x7ee3('0x33')];if(!_0x42d1d3[_0x7ee3('0x2e')]['hasOwnProperty'](_0x7ee3('0x4b'))){_0xfb97da[_0x7ee3('0x1c')]=qs['limit'](_0x42d1d3[_0x7ee3('0x2e')][_0x7ee3('0x1c')]);_0xfb97da[_0x7ee3('0x1a')]=qs[_0x7ee3('0x1a')](_0x42d1d3[_0x7ee3('0x2e')][_0x7ee3('0x1a')]);}return _0x48f2f5[_0x7ee3('0x48')](_0xfb97da);}})[_0x7ee3('0x22')](function(_0x9c36ff){if(_0x9c36ff){return _0x9c36ff?{'count':_0x559b1e,'rows':_0x9c36ff}:null;}})[_0x7ee3('0x22')](respondWithResult(_0x21447,null))['catch'](handleError(_0x21447,null));};exports[_0x7ee3('0x4c')]=function(_0xdd8958,_0x34407b,_0x3ba611){var _0x1cb799={};var _0x2c5635={};var _0x1f33a4;var _0x2c4e9c;return db[_0x7ee3('0x28')]['findOne']({'where':{'id':_0xdd8958['params']['id']}})[_0x7ee3('0x22')](handleEntityNotFound(_0x34407b,null))[_0x7ee3('0x22')](function(_0x4ac07b){if(_0x4ac07b){_0x1f33a4=_0x4ac07b;_0x2c5635['model']=_[_0x7ee3('0x41')](db[_0x7ee3('0x4a')][_0x7ee3('0x29')]);_0x2c5635[_0x7ee3('0x2e')]=_['keys'](_0xdd8958['query']);_0x2c5635[_0x7ee3('0x2f')]=_[_0x7ee3('0x30')](_0x2c5635[_0x7ee3('0x2d')],_0x2c5635['query']);_0x1cb799['attributes']=_[_0x7ee3('0x30')](_0x2c5635['model'],qs[_0x7ee3('0x32')](_0xdd8958['query'][_0x7ee3('0x32')]));_0x1cb799['attributes']=_0x1cb799[_0x7ee3('0x31')]['length']?_0x1cb799[_0x7ee3('0x31')]:_0x2c5635[_0x7ee3('0x2d')];_0x1cb799['order']=qs[_0x7ee3('0x36')](_0xdd8958[_0x7ee3('0x2e')][_0x7ee3('0x36')]);_0x1cb799[_0x7ee3('0x3a')]=qs[_0x7ee3('0x2f')](_[_0x7ee3('0x37')](_0xdd8958[_0x7ee3('0x2e')],_0x2c5635[_0x7ee3('0x2f')]));if(_0xdd8958[_0x7ee3('0x2e')]['filter']){_0x1cb799['where']=_[_0x7ee3('0x39')](_0x1cb799[_0x7ee3('0x3a')],{'$or':_[_0x7ee3('0x27')](_0x1cb799[_0x7ee3('0x31')],function(_0x992399){var _0x27bda2={};_0x27bda2[_0x992399]={'$like':'%'+_0xdd8958[_0x7ee3('0x2e')][_0x7ee3('0x38')]+'%'};return _0x27bda2;})});}_0x1cb799=_[_0x7ee3('0x39')]({},_0x1cb799,_0xdd8958[_0x7ee3('0x43')]);return _0x1f33a4[_0x7ee3('0x4c')](_0x1cb799);}})[_0x7ee3('0x22')](function(_0x345cb8){if(_0x345cb8){_0x2c4e9c=_0x345cb8[_0x7ee3('0x33')];if(!_0xdd8958[_0x7ee3('0x2e')][_0x7ee3('0x34')]('nolimit')){_0x1cb799[_0x7ee3('0x1c')]=qs[_0x7ee3('0x1c')](_0xdd8958['query'][_0x7ee3('0x1c')]);_0x1cb799[_0x7ee3('0x1a')]=qs[_0x7ee3('0x1a')](_0xdd8958[_0x7ee3('0x2e')][_0x7ee3('0x1a')]);}return _0x1f33a4['getSubjects'](_0x1cb799);}})[_0x7ee3('0x22')](function(_0x1a7fe4){if(_0x1a7fe4){return _0x1a7fe4?{'count':_0x2c4e9c,'rows':_0x1a7fe4}:null;}})[_0x7ee3('0x22')](respondWithResult(_0x34407b,null))[_0x7ee3('0x3e')](handleError(_0x34407b,null));};exports[_0x7ee3('0x4d')]=function(_0x3934c6,_0x55009b,_0x1c2327){var _0x18a88e={};var _0x5ce487={};var _0x4b28a4;var _0x1bc3bd;return db['SugarcrmConfiguration'][_0x7ee3('0x49')]({'where':{'id':_0x3934c6[_0x7ee3('0x40')]['id']}})[_0x7ee3('0x22')](handleEntityNotFound(_0x55009b,null))['then'](function(_0x57a73b){if(_0x57a73b){_0x4b28a4=_0x57a73b;_0x5ce487['model']=_[_0x7ee3('0x41')](db[_0x7ee3('0x4a')][_0x7ee3('0x29')]);_0x5ce487[_0x7ee3('0x2e')]=_[_0x7ee3('0x41')](_0x3934c6[_0x7ee3('0x2e')]);_0x5ce487[_0x7ee3('0x2f')]=_[_0x7ee3('0x30')](_0x5ce487[_0x7ee3('0x2d')],_0x5ce487['query']);_0x18a88e[_0x7ee3('0x31')]=_[_0x7ee3('0x30')](_0x5ce487[_0x7ee3('0x2d')],qs[_0x7ee3('0x32')](_0x3934c6[_0x7ee3('0x2e')]['fields']));_0x18a88e[_0x7ee3('0x31')]=_0x18a88e[_0x7ee3('0x31')][_0x7ee3('0x33')]?_0x18a88e[_0x7ee3('0x31')]:_0x5ce487[_0x7ee3('0x2d')];_0x18a88e[_0x7ee3('0x35')]=qs[_0x7ee3('0x36')](_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x36')]);_0x18a88e[_0x7ee3('0x3a')]=qs[_0x7ee3('0x2f')](_[_0x7ee3('0x37')](_0x3934c6[_0x7ee3('0x2e')],_0x5ce487['filters']));if(_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x38')]){_0x18a88e[_0x7ee3('0x3a')]=_[_0x7ee3('0x39')](_0x18a88e[_0x7ee3('0x3a')],{'$or':_[_0x7ee3('0x27')](_0x18a88e[_0x7ee3('0x31')],function(_0x38c634){var _0x4a3da4={};_0x4a3da4[_0x38c634]={'$like':'%'+_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x38')]+'%'};return _0x4a3da4;})});}_0x18a88e=_[_0x7ee3('0x39')]({},_0x18a88e,_0x3934c6[_0x7ee3('0x43')]);return _0x4b28a4[_0x7ee3('0x4d')](_0x18a88e);}})[_0x7ee3('0x22')](function(_0x4dea87){if(_0x4dea87){_0x1bc3bd=_0x4dea87[_0x7ee3('0x33')];if(!_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x34')](_0x7ee3('0x4b'))){_0x18a88e[_0x7ee3('0x1c')]=qs[_0x7ee3('0x1c')](_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x1c')]);_0x18a88e[_0x7ee3('0x1a')]=qs[_0x7ee3('0x1a')](_0x3934c6[_0x7ee3('0x2e')][_0x7ee3('0x1a')]);}return _0x4b28a4['getDescriptions'](_0x18a88e);}})[_0x7ee3('0x22')](function(_0x1ff944){if(_0x1ff944){return _0x1ff944?{'count':_0x1bc3bd,'rows':_0x1ff944}:null;}})[_0x7ee3('0x22')](respondWithResult(_0x55009b,null))['catch'](handleError(_0x55009b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index acd5926..41a4332 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 _0xdbea=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdbea,0x149));var _0xadbe=function(_0x479dfd,_0x47ff77){_0x479dfd=_0x479dfd-0x0;var _0x5b82b4=_0xdbea[_0x479dfd];return _0x5b82b4;};'use strict';var _=require(_0xadbe('0x0'));var util=require('util');var logger=require(_0xadbe('0x1'))(_0xadbe('0x2'));var moment=require(_0xadbe('0x3'));var BPromise=require(_0xadbe('0x4'));var rp=require(_0xadbe('0x5'));var fs=require('fs');var path=require(_0xadbe('0x6'));var rimraf=require(_0xadbe('0x7'));var config=require(_0xadbe('0x8'));var attributes=require(_0xadbe('0x9'));module['exports']=function(_0x326515,_0x4b945d){return _0x326515['define'](_0xadbe('0xa'),attributes,{'tableName':_0xadbe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd820=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0xd820,0x18b));var _0x0d82=function(_0x1d3471,_0x57a634){_0x1d3471=_0x1d3471-0x0;var _0x448b30=_0xd820[_0x1d3471];return _0x448b30;};'use strict';var _=require(_0x0d82('0x0'));var util=require('util');var logger=require(_0x0d82('0x1'))(_0x0d82('0x2'));var moment=require(_0x0d82('0x3'));var BPromise=require(_0x0d82('0x4'));var rp=require(_0x0d82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d82('0x6'));var config=require(_0x0d82('0x7'));var attributes=require(_0x0d82('0x8'));module[_0x0d82('0x9')]=function(_0x46c8b4,_0x24c4c1){return _0x46c8b4['define'](_0x0d82('0xa'),attributes,{'tableName':_0x0d82('0xb'),'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 f71d180..8caa8c8 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 _0x76aa=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x283c38,_0x28eb9c){var _0x5de6e5=function(_0x41194b){while(--_0x41194b){_0x283c38['push'](_0x283c38['shift']());}};_0x5de6e5(++_0x28eb9c);}(_0x76aa,0x1f4));var _0xa76a=function(_0x22147e,_0x168f4c){_0x22147e=_0x22147e-0x0;var _0x42829a=_0x76aa[_0x22147e];return _0x42829a;};'use strict';var _=require(_0xa76a('0x0'));var util=require(_0xa76a('0x1'));var moment=require(_0xa76a('0x2'));var BPromise=require(_0xa76a('0x3'));var rs=require(_0xa76a('0x4'));var fs=require('fs');var Redis=require(_0xa76a('0x5'));var db=require(_0xa76a('0x6'))['db'];var utils=require(_0xa76a('0x7'));var logger=require(_0xa76a('0x8'))('rpc');var config=require(_0xa76a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa76a('0xa')][_0xa76a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b2f8,_0x28d06b,_0x2b7a1d){return new BPromise(function(_0x5b42b5,_0x460d58){return client[_0xa76a('0xc')](_0x11b2f8,_0x2b7a1d)[_0xa76a('0xd')](function(_0x441175){logger['info'](_0xa76a('0xe'),_0x28d06b,_0xa76a('0xf'));logger[_0xa76a('0x10')](_0xa76a('0x11'),_0x28d06b,'request\x20sent',JSON[_0xa76a('0x12')](_0x441175));if(_0x441175['error']){if(_0x441175[_0xa76a('0x13')]['code']===0x1f4){logger[_0xa76a('0x13')](_0xa76a('0xe'),_0x28d06b,_0x441175[_0xa76a('0x13')][_0xa76a('0x14')]);return _0x460d58(_0x441175[_0xa76a('0x13')][_0xa76a('0x14')]);}logger[_0xa76a('0x13')](_0xa76a('0xe'),_0x28d06b,_0x441175['error'][_0xa76a('0x14')]);return _0x5b42b5(_0x441175[_0xa76a('0x13')][_0xa76a('0x14')]);}else{logger['info'](_0xa76a('0xe'),_0x28d06b,'request\x20sent');_0x5b42b5(_0x441175[_0xa76a('0x15')]['message']);}})[_0xa76a('0x16')](function(_0x538a87){logger[_0xa76a('0x13')](_0xa76a('0xe'),_0x28d06b,_0x538a87);_0x460d58(_0x538a87);});});} \ No newline at end of file +var _0x9f89=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x165863,_0x3f1636){var _0x38a218=function(_0x36b8b7){while(--_0x36b8b7){_0x165863['push'](_0x165863['shift']());}};_0x38a218(++_0x3f1636);}(_0x9f89,0x107));var _0x99f8=function(_0x194907,_0x2f2a3e){_0x194907=_0x194907-0x0;var _0x2f35e5=_0x9f89[_0x194907];return _0x2f35e5;};'use strict';var _=require(_0x99f8('0x0'));var util=require(_0x99f8('0x1'));var moment=require(_0x99f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x99f8('0x3'));var fs=require('fs');var Redis=require(_0x99f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99f8('0x5'));var logger=require(_0x99f8('0x6'))('rpc');var config=require(_0x99f8('0x7'));var jayson=require(_0x99f8('0x8'));var client=jayson[_0x99f8('0x9')][_0x99f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1487c1,_0x2a9bc9,_0xabb535){return new BPromise(function(_0x1369a3,_0x513d1c){return client[_0x99f8('0xb')](_0x1487c1,_0xabb535)[_0x99f8('0xc')](function(_0x520e1f){logger[_0x99f8('0xd')](_0x99f8('0xe'),_0x2a9bc9,_0x99f8('0xf'));logger[_0x99f8('0x10')](_0x99f8('0x11'),_0x2a9bc9,'request\x20sent',JSON['stringify'](_0x520e1f));if(_0x520e1f['error']){if(_0x520e1f[_0x99f8('0x12')][_0x99f8('0x13')]===0x1f4){logger[_0x99f8('0x12')](_0x99f8('0xe'),_0x2a9bc9,_0x520e1f[_0x99f8('0x12')][_0x99f8('0x14')]);return _0x513d1c(_0x520e1f[_0x99f8('0x12')][_0x99f8('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a9bc9,_0x520e1f['error'][_0x99f8('0x14')]);return _0x1369a3(_0x520e1f['error'][_0x99f8('0x14')]);}else{logger[_0x99f8('0xd')](_0x99f8('0xe'),_0x2a9bc9,_0x99f8('0xf'));_0x1369a3(_0x520e1f[_0x99f8('0x15')][_0x99f8('0x14')]);}})[_0x99f8('0x16')](function(_0x268ac0){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a9bc9,_0x268ac0);_0x513d1c(_0x268ac0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a161f31..786a252 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 _0x52ce=['update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','put'];(function(_0x34b0ba,_0x261567){var _0x138788=function(_0x194226){while(--_0x194226){_0x34b0ba['push'](_0x34b0ba['shift']());}};_0x138788(++_0x261567);}(_0x52ce,0x102));var _0xe52c=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x52ce[_0x4b7895];return _0x264180;};'use strict';var multer=require('multer');var util=require(_0xe52c('0x0'));var path=require(_0xe52c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe52c('0x2')]();var fs_extra=require(_0xe52c('0x3'));var auth=require(_0xe52c('0x4'));var interaction=require(_0xe52c('0x5'));var config=require(_0xe52c('0x6'));var controller=require(_0xe52c('0x7'));router['get']('/',auth[_0xe52c('0x8')](),controller[_0xe52c('0x9')]);router[_0xe52c('0xa')](_0xe52c('0xb'),auth[_0xe52c('0x8')](),controller[_0xe52c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe52c('0xd')]('/:id',auth[_0xe52c('0x8')](),controller[_0xe52c('0xe')]);router[_0xe52c('0xf')](_0xe52c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe52c('0x10')]=router; \ No newline at end of file +var _0xe2e8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xe2e8,0x135));var _0x8e2e=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xe2e8[_0x319cb9];return _0x1735fc;};'use strict';var multer=require(_0x8e2e('0x0'));var util=require(_0x8e2e('0x1'));var path=require(_0x8e2e('0x2'));var timeout=require(_0x8e2e('0x3'));var express=require(_0x8e2e('0x4'));var router=express[_0x8e2e('0x5')]();var fs_extra=require(_0x8e2e('0x6'));var auth=require(_0x8e2e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8e2e('0x8'));var controller=require(_0x8e2e('0x9'));router[_0x8e2e('0xa')]('/',auth[_0x8e2e('0xb')](),controller[_0x8e2e('0xc')]);router[_0x8e2e('0xa')](_0x8e2e('0xd'),auth[_0x8e2e('0xb')](),controller[_0x8e2e('0xe')]);router[_0x8e2e('0xf')]('/',auth[_0x8e2e('0xb')](),controller[_0x8e2e('0x10')]);router[_0x8e2e('0x11')](_0x8e2e('0xd'),auth[_0x8e2e('0xb')](),controller[_0x8e2e('0x12')]);router[_0x8e2e('0x13')](_0x8e2e('0xd'),auth[_0x8e2e('0xb')](),controller[_0x8e2e('0x14')]);module[_0x8e2e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2aec608..824e82f 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 _0x051e=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','exports'];(function(_0x5de320,_0x1439d6){var _0x34ec93=function(_0x206abc){while(--_0x206abc){_0x5de320['push'](_0x5de320['shift']());}};_0x34ec93(++_0x1439d6);}(_0x051e,0xd7));var _0xe051=function(_0x82dd94,_0x247ebf){_0x82dd94=_0x82dd94-0x0;var _0x368f56=_0x051e[_0x82dd94];return _0x368f56;};'use strict';var Sequelize=require('sequelize');module[_0xe051('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe051('0x1'),_0xe051('0x2'),_0xe051('0x3'),_0xe051('0x4')),'defaultValue':_0xe051('0x5')},'content':{'type':Sequelize[_0xe051('0x6')]},'key':{'type':Sequelize[_0xe051('0x6')]},'keyType':{'type':Sequelize[_0xe051('0x7')](_0xe051('0x5'),_0xe051('0x1'),_0xe051('0x2'))},'keyContent':{'type':Sequelize[_0xe051('0x6')]},'idField':{'type':Sequelize[_0xe051('0x6')]},'nameField':{'type':Sequelize[_0xe051('0x6')]},'customField':{'type':Sequelize[_0xe051('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe051('0x6')]}}; \ No newline at end of file +var _0x0a80=['picklist','string','STRING','ENUM','sequelize','exports','variable','keyValue'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0a80,0x1ac));var _0x00a8=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0x0a80[_0x339d45];return _0x5e4a60;};'use strict';var Sequelize=require(_0x00a8('0x0'));module[_0x00a8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x00a8('0x2'),'customVariable',_0x00a8('0x3'),_0x00a8('0x4')),'defaultValue':_0x00a8('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x00a8('0x6')]},'keyType':{'type':Sequelize[_0x00a8('0x7')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x00a8('0x6')]},'nameField':{'type':Sequelize[_0x00a8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00a8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1ef76c8..26f6cb3 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 _0x814f=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','mustache','util','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes'];(function(_0x263999,_0x477176){var _0x336996=function(_0x43c50a){while(--_0x43c50a){_0x263999['push'](_0x263999['shift']());}};_0x336996(++_0x477176);}(_0x814f,0xfa));var _0xf814=function(_0x521a9e,_0x12dc38){_0x521a9e=_0x521a9e-0x0;var _0x72bfce=_0x814f[_0x521a9e];return _0x72bfce;};'use strict';var emlformat=require(_0xf814('0x0'));var rimraf=require(_0xf814('0x1'));var zipdir=require(_0xf814('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf814('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf814('0x4'));var util=require(_0xf814('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf814('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf814('0x7'));var squel=require(_0xf814('0x8'));var crypto=require(_0xf814('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf814('0xa'));var toCsv=require(_0xf814('0xb'));var querystring=require(_0xf814('0xc'));var Papa=require(_0xf814('0xd'));var Redis=require('ioredis');var authService=require(_0xf814('0xe'));var qs=require(_0xf814('0xf'));var as=require(_0xf814('0x10'));var hardwareService=require(_0xf814('0x11'));var logger=require(_0xf814('0x12'))(_0xf814('0x13'));var utils=require(_0xf814('0x14'));var config=require(_0xf814('0x15'));var licenseUtil=require(_0xf814('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x589e52,_0x118de1){_0x118de1=_0x118de1||0xcc;return function(_0x2d8182){if(_0x2d8182){return _0x589e52[_0xf814('0x17')](_0x118de1);}return _0x589e52[_0xf814('0x18')](_0x118de1)[_0xf814('0x19')]();};}function respondWithResult(_0x7f5232,_0x480935){_0x480935=_0x480935||0xc8;return function(_0x45a2c6){if(_0x45a2c6){return _0x7f5232[_0xf814('0x18')](_0x480935)[_0xf814('0x1a')](_0x45a2c6);}};}function respondWithFilteredResult(_0x15b3bd,_0x3dde43){return function(_0x5b40e8){if(_0x5b40e8){var _0x1d8b10=typeof _0x3dde43['offset']==='undefined'&&typeof _0x3dde43[_0xf814('0x1b')]===_0xf814('0x1c');var _0x57fd52=_0x5b40e8[_0xf814('0x1d')];var _0x4ef21f=_0x1d8b10?0x0:_0x3dde43[_0xf814('0x1e')];var _0x211618=_0x1d8b10?_0x5b40e8[_0xf814('0x1d')]:_0x3dde43[_0xf814('0x1e')]+_0x3dde43[_0xf814('0x1b')];var _0x24d077;if(_0x211618>=_0x57fd52){_0x211618=_0x57fd52;_0x24d077=0xc8;}else{_0x24d077=0xce;}_0x15b3bd[_0xf814('0x18')](_0x24d077);return _0x15b3bd[_0xf814('0x1f')](_0xf814('0x20'),_0x4ef21f+'-'+_0x211618+'/'+_0x57fd52)['json'](_0x5b40e8);}return null;};}function patchUpdates(_0x288acb){return function(_0x387f26){try{jsonpatch[_0xf814('0x21')](_0x387f26,_0x288acb,!![]);}catch(_0x16e017){return BPromise[_0xf814('0x22')](_0x16e017);}return _0x387f26[_0xf814('0x23')]();};}function saveUpdates(_0x528231,_0x514302){return function(_0x5067f1){if(_0x5067f1){return _0x5067f1[_0xf814('0x24')](_0x528231)[_0xf814('0x25')](function(_0x37fbed){return _0x37fbed;});}return null;};}function removeEntity(_0x41e9dc,_0x5378de){return function(_0x2e30f1){if(_0x2e30f1){return _0x2e30f1['destroy']()[_0xf814('0x25')](function(){_0x41e9dc['status'](0xcc)[_0xf814('0x19')]();});}};}function handleEntityNotFound(_0x24724f,_0x131376){return function(_0x30655a){if(!_0x30655a){_0x24724f[_0xf814('0x17')](0x194);}return _0x30655a;};}function handleError(_0x20bb17,_0x14ef8b){_0x14ef8b=_0x14ef8b||0x1f4;return function(_0x44b2f6){logger[_0xf814('0x26')](_0x44b2f6[_0xf814('0x27')]);if(_0x44b2f6[_0xf814('0x28')]){delete _0x44b2f6['name'];}_0x20bb17[_0xf814('0x18')](_0x14ef8b)[_0xf814('0x29')](_0x44b2f6);};}exports[_0xf814('0x2a')]=function(_0xc439cf,_0x412122){var _0x497574={},_0x1ff2f0={},_0x471480={'count':0x0,'rows':[]};var _0x596f9c=_[_0xf814('0x2b')](db[_0xf814('0x2c')][_0xf814('0x2d')],function(_0x46c406){return{'name':_0x46c406[_0xf814('0x2e')],'type':_0x46c406['type'][_0xf814('0x2f')]};});_0x1ff2f0[_0xf814('0x30')]=_[_0xf814('0x2b')](_0x596f9c,'name');_0x1ff2f0[_0xf814('0x31')]=_[_0xf814('0x32')](_0xc439cf[_0xf814('0x31')]);_0x1ff2f0[_0xf814('0x33')]=_[_0xf814('0x34')](_0x1ff2f0['model'],_0x1ff2f0[_0xf814('0x31')]);_0x497574['attributes']=_[_0xf814('0x34')](_0x1ff2f0['model'],qs[_0xf814('0x35')](_0xc439cf[_0xf814('0x31')][_0xf814('0x35')]));_0x497574['attributes']=_0x497574[_0xf814('0x36')][_0xf814('0x37')]?_0x497574[_0xf814('0x36')]:_0x1ff2f0['model'];if(!_0xc439cf[_0xf814('0x31')][_0xf814('0x38')]('nolimit')){_0x497574[_0xf814('0x1b')]=qs[_0xf814('0x1b')](_0xc439cf['query']['limit']);_0x497574[_0xf814('0x1e')]=qs[_0xf814('0x1e')](_0xc439cf[_0xf814('0x31')]['offset']);}_0x497574[_0xf814('0x39')]=qs[_0xf814('0x3a')](_0xc439cf['query'][_0xf814('0x3a')]);_0x497574[_0xf814('0x3b')]=qs[_0xf814('0x33')](_['pick'](_0xc439cf[_0xf814('0x31')],_0x1ff2f0[_0xf814('0x33')]),_0x596f9c);if(_0xc439cf[_0xf814('0x31')][_0xf814('0x3c')]){_0x497574[_0xf814('0x3b')]=_[_0xf814('0x3d')](_0x497574[_0xf814('0x3b')],{'$or':_['map'](_0x596f9c,function(_0x253e5e){if(_0x253e5e['type']!==_0xf814('0x3e')){var _0x3d833f={};_0x3d833f[_0x253e5e[_0xf814('0x28')]]={'$like':'%'+_0xc439cf[_0xf814('0x31')][_0xf814('0x3c')]+'%'};return _0x3d833f;}})});}_0x497574=_[_0xf814('0x3d')]({},_0x497574,_0xc439cf['options']);var _0x40b124={'where':_0x497574[_0xf814('0x3b')]};return db[_0xf814('0x2c')][_0xf814('0x1d')](_0x40b124)[_0xf814('0x25')](function(_0x2f085f){_0x471480[_0xf814('0x1d')]=_0x2f085f;if(_0xc439cf[_0xf814('0x31')][_0xf814('0x3f')]){_0x497574['include']=[{'all':!![]}];}return db[_0xf814('0x2c')][_0xf814('0x40')](_0x497574);})[_0xf814('0x25')](function(_0xd36eaf){_0x471480[_0xf814('0x41')]=_0xd36eaf;return _0x471480;})[_0xf814('0x25')](respondWithFilteredResult(_0x412122,_0x497574))[_0xf814('0x42')](handleError(_0x412122,null));};exports[_0xf814('0x43')]=function(_0x1ebfe0,_0x2bbf6a){var _0x2e0089={'raw':!![],'where':{'id':_0x1ebfe0[_0xf814('0x44')]['id']}},_0x132eae={};_0x132eae['model']=_[_0xf814('0x32')](db[_0xf814('0x2c')][_0xf814('0x2d')]);_0x132eae[_0xf814('0x31')]=_[_0xf814('0x32')](_0x1ebfe0[_0xf814('0x31')]);_0x132eae[_0xf814('0x33')]=_[_0xf814('0x34')](_0x132eae[_0xf814('0x30')],_0x132eae[_0xf814('0x31')]);_0x2e0089[_0xf814('0x36')]=_[_0xf814('0x34')](_0x132eae[_0xf814('0x30')],qs[_0xf814('0x35')](_0x1ebfe0[_0xf814('0x31')]['fields']));_0x2e0089['attributes']=_0x2e0089['attributes']['length']?_0x2e0089[_0xf814('0x36')]:_0x132eae[_0xf814('0x30')];if(_0x1ebfe0[_0xf814('0x31')][_0xf814('0x3f')]){_0x2e0089['include']=[{'all':!![]}];}_0x2e0089=_[_0xf814('0x3d')]({},_0x2e0089,_0x1ebfe0[_0xf814('0x45')]);return db['SugarcrmField'][_0xf814('0x46')](_0x2e0089)[_0xf814('0x25')](handleEntityNotFound(_0x2bbf6a,null))[_0xf814('0x25')](respondWithResult(_0x2bbf6a,null))[_0xf814('0x42')](handleError(_0x2bbf6a,null));};exports[_0xf814('0x47')]=function(_0x5261aa,_0xf17a8c){return db[_0xf814('0x2c')][_0xf814('0x47')](_0x5261aa['body'],{})[_0xf814('0x25')](respondWithResult(_0xf17a8c,0xc9))[_0xf814('0x42')](handleError(_0xf17a8c,null));};exports[_0xf814('0x24')]=function(_0x3eb29e,_0x5779d7){if(_0x3eb29e['body']['id']){delete _0x3eb29e['body']['id'];}return db[_0xf814('0x2c')][_0xf814('0x46')]({'where':{'id':_0x3eb29e[_0xf814('0x44')]['id']}})[_0xf814('0x25')](handleEntityNotFound(_0x5779d7,null))[_0xf814('0x25')](saveUpdates(_0x3eb29e[_0xf814('0x48')],null))[_0xf814('0x25')](respondWithResult(_0x5779d7,null))[_0xf814('0x42')](handleError(_0x5779d7,null));};exports[_0xf814('0x49')]=function(_0x3e7f8c,_0x24262e){return db['SugarcrmField'][_0xf814('0x46')]({'where':{'id':_0x3e7f8c['params']['id']}})['then'](handleEntityNotFound(_0x24262e,null))[_0xf814('0x25')](removeEntity(_0x24262e,null))[_0xf814('0x42')](handleError(_0x24262e,null));}; \ No newline at end of file +var _0xbad7=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','eml-format','rimraf'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xbad7,0x1ae));var _0x7bad=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0xbad7[_0x39db05];return _0x3f0e22;};'use strict';var emlformat=require(_0x7bad('0x0'));var rimraf=require(_0x7bad('0x1'));var zipdir=require(_0x7bad('0x2'));var jsonpatch=require(_0x7bad('0x3'));var rp=require(_0x7bad('0x4'));var moment=require(_0x7bad('0x5'));var BPromise=require(_0x7bad('0x6'));var Mustache=require(_0x7bad('0x7'));var util=require(_0x7bad('0x8'));var path=require('path');var sox=require(_0x7bad('0x9'));var csv=require(_0x7bad('0xa'));var ejs=require(_0x7bad('0xb'));var fs=require('fs');var fs_extra=require(_0x7bad('0xc'));var _=require('lodash');var squel=require(_0x7bad('0xd'));var crypto=require('crypto');var jsforce=require(_0x7bad('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bad('0xf'));var Papa=require(_0x7bad('0x10'));var Redis=require(_0x7bad('0x11'));var authService=require(_0x7bad('0x12'));var qs=require(_0x7bad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7bad('0x14'));var utils=require(_0x7bad('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7bad('0x16'));var db=require(_0x7bad('0x17'))['db'];function respondWithStatusCode(_0x3b90de,_0x1ffe8d){_0x1ffe8d=_0x1ffe8d||0xcc;return function(_0x5d4dfc){if(_0x5d4dfc){return _0x3b90de[_0x7bad('0x18')](_0x1ffe8d);}return _0x3b90de['status'](_0x1ffe8d)['end']();};}function respondWithResult(_0x55713a,_0x52cd3e){_0x52cd3e=_0x52cd3e||0xc8;return function(_0x3f2e71){if(_0x3f2e71){return _0x55713a[_0x7bad('0x19')](_0x52cd3e)[_0x7bad('0x1a')](_0x3f2e71);}};}function respondWithFilteredResult(_0x44dea9,_0x39e81c){return function(_0x3a8019){if(_0x3a8019){var _0x440507=typeof _0x39e81c[_0x7bad('0x1b')]===_0x7bad('0x1c')&&typeof _0x39e81c[_0x7bad('0x1d')]===_0x7bad('0x1c');var _0x5c8b9d=_0x3a8019['count'];var _0x4147f0=_0x440507?0x0:_0x39e81c[_0x7bad('0x1b')];var _0x2bd128=_0x440507?_0x3a8019[_0x7bad('0x1e')]:_0x39e81c['offset']+_0x39e81c['limit'];var _0x904d9d;if(_0x2bd128>=_0x5c8b9d){_0x2bd128=_0x5c8b9d;_0x904d9d=0xc8;}else{_0x904d9d=0xce;}_0x44dea9[_0x7bad('0x19')](_0x904d9d);return _0x44dea9[_0x7bad('0x1f')](_0x7bad('0x20'),_0x4147f0+'-'+_0x2bd128+'/'+_0x5c8b9d)['json'](_0x3a8019);}return null;};}function patchUpdates(_0x4d5f2e){return function(_0x2a89ce){try{jsonpatch['apply'](_0x2a89ce,_0x4d5f2e,!![]);}catch(_0x248c7f){return BPromise['reject'](_0x248c7f);}return _0x2a89ce['save']();};}function saveUpdates(_0x346f1b,_0x26b909){return function(_0x4541b3){if(_0x4541b3){return _0x4541b3[_0x7bad('0x21')](_0x346f1b)[_0x7bad('0x22')](function(_0x58aa80){return _0x58aa80;});}return null;};}function removeEntity(_0x2908dc,_0xead8b0){return function(_0x5e5da4){if(_0x5e5da4){return _0x5e5da4['destroy']()[_0x7bad('0x22')](function(){_0x2908dc[_0x7bad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6df3,_0x2b97c8){return function(_0x332e4d){if(!_0x332e4d){_0x1f6df3[_0x7bad('0x18')](0x194);}return _0x332e4d;};}function handleError(_0x5d4c64,_0x9efe29){_0x9efe29=_0x9efe29||0x1f4;return function(_0xd4c393){logger[_0x7bad('0x23')](_0xd4c393[_0x7bad('0x24')]);if(_0xd4c393['name']){delete _0xd4c393[_0x7bad('0x25')];}_0x5d4c64['status'](_0x9efe29)[_0x7bad('0x26')](_0xd4c393);};}exports[_0x7bad('0x27')]=function(_0x5b3fac,_0x294d8e){var _0x1285c5={},_0x4f6932={},_0x36bbf3={'count':0x0,'rows':[]};var _0x70d7ec=_['map'](db[_0x7bad('0x28')][_0x7bad('0x29')],function(_0x339dbc){return{'name':_0x339dbc[_0x7bad('0x2a')],'type':_0x339dbc[_0x7bad('0x2b')][_0x7bad('0x2c')]};});_0x4f6932[_0x7bad('0x2d')]=_[_0x7bad('0x2e')](_0x70d7ec,_0x7bad('0x25'));_0x4f6932['query']=_[_0x7bad('0x2f')](_0x5b3fac['query']);_0x4f6932[_0x7bad('0x30')]=_[_0x7bad('0x31')](_0x4f6932[_0x7bad('0x2d')],_0x4f6932[_0x7bad('0x32')]);_0x1285c5[_0x7bad('0x33')]=_[_0x7bad('0x31')](_0x4f6932['model'],qs[_0x7bad('0x34')](_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x34')]));_0x1285c5['attributes']=_0x1285c5[_0x7bad('0x33')][_0x7bad('0x35')]?_0x1285c5[_0x7bad('0x33')]:_0x4f6932['model'];if(!_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x36')](_0x7bad('0x37'))){_0x1285c5[_0x7bad('0x1d')]=qs[_0x7bad('0x1d')](_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x1d')]);_0x1285c5['offset']=qs[_0x7bad('0x1b')](_0x5b3fac[_0x7bad('0x32')]['offset']);}_0x1285c5['order']=qs[_0x7bad('0x38')](_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x38')]);_0x1285c5[_0x7bad('0x39')]=qs[_0x7bad('0x30')](_[_0x7bad('0x3a')](_0x5b3fac[_0x7bad('0x32')],_0x4f6932[_0x7bad('0x30')]),_0x70d7ec);if(_0x5b3fac['query'][_0x7bad('0x3b')]){_0x1285c5['where']=_['merge'](_0x1285c5[_0x7bad('0x39')],{'$or':_['map'](_0x70d7ec,function(_0x157944){if(_0x157944[_0x7bad('0x2b')]!=='VIRTUAL'){var _0x2dd76d={};_0x2dd76d[_0x157944['name']]={'$like':'%'+_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x3b')]+'%'};return _0x2dd76d;}})});}_0x1285c5=_['merge']({},_0x1285c5,_0x5b3fac[_0x7bad('0x3c')]);var _0x1c22ad={'where':_0x1285c5[_0x7bad('0x39')]};return db[_0x7bad('0x28')][_0x7bad('0x1e')](_0x1c22ad)[_0x7bad('0x22')](function(_0x1afd1c){_0x36bbf3['count']=_0x1afd1c;if(_0x5b3fac[_0x7bad('0x32')][_0x7bad('0x3d')]){_0x1285c5['include']=[{'all':!![]}];}return db[_0x7bad('0x28')][_0x7bad('0x3e')](_0x1285c5);})[_0x7bad('0x22')](function(_0x2e7ff6){_0x36bbf3[_0x7bad('0x3f')]=_0x2e7ff6;return _0x36bbf3;})[_0x7bad('0x22')](respondWithFilteredResult(_0x294d8e,_0x1285c5))[_0x7bad('0x40')](handleError(_0x294d8e,null));};exports[_0x7bad('0x41')]=function(_0x5ee8a7,_0x4ee7e1){var _0x2f471f={'raw':!![],'where':{'id':_0x5ee8a7[_0x7bad('0x42')]['id']}},_0x1a4a70={};_0x1a4a70[_0x7bad('0x2d')]=_[_0x7bad('0x2f')](db[_0x7bad('0x28')][_0x7bad('0x29')]);_0x1a4a70['query']=_['keys'](_0x5ee8a7[_0x7bad('0x32')]);_0x1a4a70[_0x7bad('0x30')]=_[_0x7bad('0x31')](_0x1a4a70['model'],_0x1a4a70[_0x7bad('0x32')]);_0x2f471f[_0x7bad('0x33')]=_['intersection'](_0x1a4a70['model'],qs[_0x7bad('0x34')](_0x5ee8a7[_0x7bad('0x32')][_0x7bad('0x34')]));_0x2f471f[_0x7bad('0x33')]=_0x2f471f[_0x7bad('0x33')][_0x7bad('0x35')]?_0x2f471f[_0x7bad('0x33')]:_0x1a4a70[_0x7bad('0x2d')];if(_0x5ee8a7[_0x7bad('0x32')][_0x7bad('0x3d')]){_0x2f471f[_0x7bad('0x43')]=[{'all':!![]}];}_0x2f471f=_['merge']({},_0x2f471f,_0x5ee8a7[_0x7bad('0x3c')]);return db[_0x7bad('0x28')]['find'](_0x2f471f)[_0x7bad('0x22')](handleEntityNotFound(_0x4ee7e1,null))[_0x7bad('0x22')](respondWithResult(_0x4ee7e1,null))[_0x7bad('0x40')](handleError(_0x4ee7e1,null));};exports[_0x7bad('0x44')]=function(_0x5b7a55,_0x16d26){return db[_0x7bad('0x28')][_0x7bad('0x44')](_0x5b7a55['body'],{})[_0x7bad('0x22')](respondWithResult(_0x16d26,0xc9))[_0x7bad('0x40')](handleError(_0x16d26,null));};exports[_0x7bad('0x21')]=function(_0x1753c6,_0x465363){if(_0x1753c6[_0x7bad('0x45')]['id']){delete _0x1753c6[_0x7bad('0x45')]['id'];}return db[_0x7bad('0x28')][_0x7bad('0x46')]({'where':{'id':_0x1753c6[_0x7bad('0x42')]['id']}})['then'](handleEntityNotFound(_0x465363,null))[_0x7bad('0x22')](saveUpdates(_0x1753c6[_0x7bad('0x45')],null))[_0x7bad('0x22')](respondWithResult(_0x465363,null))[_0x7bad('0x40')](handleError(_0x465363,null));};exports[_0x7bad('0x47')]=function(_0x57a5ab,_0x4a711f){return db[_0x7bad('0x28')][_0x7bad('0x46')]({'where':{'id':_0x57a5ab[_0x7bad('0x42')]['id']}})[_0x7bad('0x22')](handleEntityNotFound(_0x4a711f,null))['then'](removeEntity(_0x4a711f,null))[_0x7bad('0x40')](handleError(_0x4a711f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0cb7775..7f38725 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 _0xa5d6=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa5d6,0x186));var _0x6a5d=function(_0x16c812,_0x7fc2af){_0x16c812=_0x16c812-0x0;var _0x4814fe=_0xa5d6[_0x16c812];return _0x4814fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a5d('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6a5d('0x1'));var rp=require(_0x6a5d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a5d('0x3'));var config=require(_0x6a5d('0x4'));var attributes=require(_0x6a5d('0x5'));module[_0x6a5d('0x6')]=function(_0x15d4a1,_0x311588){return _0x15d4a1[_0x6a5d('0x7')](_0x6a5d('0x8'),attributes,{'tableName':_0x6a5d('0x9'),'paranoid':![],'indexes':[{'name':_0x6a5d('0xa'),'fields':['idField',_0x6a5d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e92=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e92,0xc2));var _0x23e9=function(_0x209b5a,_0x40153c){_0x209b5a=_0x209b5a-0x0;var _0x4b733a=_0x3e92[_0x209b5a];return _0x4b733a;};'use strict';var _=require(_0x23e9('0x0'));var util=require('util');var logger=require(_0x23e9('0x1'))(_0x23e9('0x2'));var moment=require(_0x23e9('0x3'));var BPromise=require(_0x23e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23e9('0x5'));var rimraf=require(_0x23e9('0x6'));var config=require(_0x23e9('0x7'));var attributes=require(_0x23e9('0x8'));module['exports']=function(_0x36eb79,_0x3c8e32){return _0x36eb79[_0x23e9('0x9')](_0x23e9('0xa'),attributes,{'tableName':_0x23e9('0xb'),'paranoid':![],'indexes':[{'name':_0x23e9('0xc'),'fields':[_0x23e9('0xd'),_0x23e9('0xe')],'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 ad0dcc6..803431f 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 _0x3d95=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','code','error','SugarcrmField,\x20%s,\x20%s','message','info','request\x20sent','result','catch','util','moment'];(function(_0x4390f3,_0x48017d){var _0x2e5694=function(_0x4fcfa4){while(--_0x4fcfa4){_0x4390f3['push'](_0x4390f3['shift']());}};_0x2e5694(++_0x48017d);}(_0x3d95,0x136));var _0x53d9=function(_0x5f2512,_0x2819cf){_0x5f2512=_0x5f2512-0x0;var _0x2f1662=_0x3d95[_0x5f2512];return _0x2f1662;};'use strict';var _=require('lodash');var util=require(_0x53d9('0x0'));var moment=require(_0x53d9('0x1'));var BPromise=require(_0x53d9('0x2'));var rs=require(_0x53d9('0x3'));var fs=require('fs');var Redis=require(_0x53d9('0x4'));var db=require(_0x53d9('0x5'))['db'];var utils=require(_0x53d9('0x6'));var logger=require(_0x53d9('0x7'))(_0x53d9('0x8'));var config=require(_0x53d9('0x9'));var jayson=require(_0x53d9('0xa'));var client=jayson[_0x53d9('0xb')][_0x53d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3180d7,_0x169cae,_0x208296){return new BPromise(function(_0x56e257,_0x2a7439){return client['request'](_0x3180d7,_0x208296)[_0x53d9('0xd')](function(_0x5ced5f){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x169cae,'request\x20sent');logger[_0x53d9('0xe')](_0x53d9('0xf'),_0x169cae,'request\x20sent',JSON['stringify'](_0x5ced5f));if(_0x5ced5f['error']){if(_0x5ced5f['error'][_0x53d9('0x10')]===0x1f4){logger[_0x53d9('0x11')](_0x53d9('0x12'),_0x169cae,_0x5ced5f[_0x53d9('0x11')]['message']);return _0x2a7439(_0x5ced5f[_0x53d9('0x11')][_0x53d9('0x13')]);}logger[_0x53d9('0x11')](_0x53d9('0x12'),_0x169cae,_0x5ced5f[_0x53d9('0x11')][_0x53d9('0x13')]);return _0x56e257(_0x5ced5f['error']['message']);}else{logger[_0x53d9('0x14')](_0x53d9('0x12'),_0x169cae,_0x53d9('0x15'));_0x56e257(_0x5ced5f[_0x53d9('0x16')][_0x53d9('0x13')]);}})[_0x53d9('0x17')](function(_0x44bbe3){logger[_0x53d9('0x11')](_0x53d9('0x12'),_0x169cae,_0x44bbe3);_0x2a7439(_0x44bbe3);});});} \ No newline at end of file +var _0x85e1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3df29d,_0x38f3d1){var _0x2b4a4f=function(_0x4d92e7){while(--_0x4d92e7){_0x3df29d['push'](_0x3df29d['shift']());}};_0x2b4a4f(++_0x38f3d1);}(_0x85e1,0x1c6));var _0x185e=function(_0x41ca6c,_0x53b190){_0x41ca6c=_0x41ca6c-0x0;var _0x125422=_0x85e1[_0x41ca6c];return _0x125422;};'use strict';var _=require(_0x185e('0x0'));var util=require(_0x185e('0x1'));var moment=require(_0x185e('0x2'));var BPromise=require(_0x185e('0x3'));var rs=require(_0x185e('0x4'));var fs=require('fs');var Redis=require(_0x185e('0x5'));var db=require(_0x185e('0x6'))['db'];var utils=require(_0x185e('0x7'));var logger=require('../../config/logger')(_0x185e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1894da,_0x222646,_0x41aae5){return new BPromise(function(_0x54133b,_0x190326){return client[_0x185e('0x9')](_0x1894da,_0x41aae5)['then'](function(_0x3959c2){logger[_0x185e('0xa')](_0x185e('0xb'),_0x222646,_0x185e('0xc'));logger['debug'](_0x185e('0xd'),_0x222646,_0x185e('0xc'),JSON[_0x185e('0xe')](_0x3959c2));if(_0x3959c2[_0x185e('0xf')]){if(_0x3959c2['error'][_0x185e('0x10')]===0x1f4){logger['error'](_0x185e('0xb'),_0x222646,_0x3959c2[_0x185e('0xf')][_0x185e('0x11')]);return _0x190326(_0x3959c2[_0x185e('0xf')]['message']);}logger[_0x185e('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x222646,_0x3959c2[_0x185e('0xf')][_0x185e('0x11')]);return _0x54133b(_0x3959c2['error'][_0x185e('0x11')]);}else{logger[_0x185e('0xa')](_0x185e('0xb'),_0x222646,_0x185e('0xc'));_0x54133b(_0x3959c2['result']['message']);}})[_0x185e('0x12')](function(_0x45708e){logger[_0x185e('0xf')](_0x185e('0xb'),_0x222646,_0x45708e);_0x190326(_0x45708e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a9ec46a..884c611 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 _0x34ea=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','exports'];(function(_0x4be00e,_0x103947){var _0x3fd9ac=function(_0x13cc57){while(--_0x13cc57){_0x4be00e['push'](_0x4be00e['shift']());}};_0x3fd9ac(++_0x103947);}(_0x34ea,0xa8));var _0xa34e=function(_0x5edb7e,_0x338142){_0x5edb7e=_0x5edb7e-0x0;var _0x19fe94=_0x34ea[_0x5edb7e];return _0x19fe94;};'use strict';var multer=require(_0xa34e('0x0'));var util=require(_0xa34e('0x1'));var path=require(_0xa34e('0x2'));var timeout=require(_0xa34e('0x3'));var express=require(_0xa34e('0x4'));var router=express[_0xa34e('0x5')]();var fs_extra=require(_0xa34e('0x6'));var auth=require(_0xa34e('0x7'));var interaction=require(_0xa34e('0x8'));var config=require(_0xa34e('0x9'));var controller=require('./intVtigerAccount.controller');router[_0xa34e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa34e('0xa')](_0xa34e('0xb'),auth[_0xa34e('0xc')](),controller['show']);router[_0xa34e('0xa')](_0xa34e('0xd'),auth[_0xa34e('0xc')](),controller[_0xa34e('0xe')]);router[_0xa34e('0xa')]('/:id/fields',auth[_0xa34e('0xc')](),controller['getFields']);router['post']('/',auth[_0xa34e('0xc')](),controller['create']);router[_0xa34e('0xf')](_0xa34e('0xd'),auth[_0xa34e('0xc')](),controller[_0xa34e('0x10')]);router[_0xa34e('0x11')]('/:id',auth[_0xa34e('0xc')](),controller[_0xa34e('0x12')]);router[_0xa34e('0x13')](_0xa34e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa34e('0x14')]=router; \ No newline at end of file +var _0x7a43=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4b6760,_0x1a4e67){var _0x2dee58=function(_0x58c35f){while(--_0x58c35f){_0x4b6760['push'](_0x4b6760['shift']());}};_0x2dee58(++_0x1a4e67);}(_0x7a43,0x13e));var _0x37a4=function(_0x220d26,_0x4643b6){_0x220d26=_0x220d26-0x0;var _0x1462fb=_0x7a43[_0x220d26];return _0x1462fb;};'use strict';var multer=require('multer');var util=require(_0x37a4('0x0'));var path=require(_0x37a4('0x1'));var timeout=require(_0x37a4('0x2'));var express=require(_0x37a4('0x3'));var router=express[_0x37a4('0x4')]();var fs_extra=require(_0x37a4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37a4('0x6'));var config=require(_0x37a4('0x7'));var controller=require(_0x37a4('0x8'));router[_0x37a4('0x9')]('/',auth[_0x37a4('0xa')](),controller[_0x37a4('0xb')]);router[_0x37a4('0x9')](_0x37a4('0xc'),auth[_0x37a4('0xa')](),controller[_0x37a4('0xd')]);router[_0x37a4('0x9')]('/:id/configurations',auth[_0x37a4('0xa')](),controller[_0x37a4('0xe')]);router[_0x37a4('0x9')]('/:id/fields',auth[_0x37a4('0xa')](),controller[_0x37a4('0xf')]);router['post']('/',auth[_0x37a4('0xa')](),controller[_0x37a4('0x10')]);router['post'](_0x37a4('0x11'),auth[_0x37a4('0xa')](),controller[_0x37a4('0x12')]);router['put'](_0x37a4('0xc'),auth['isAuthenticated'](),controller[_0x37a4('0x13')]);router[_0x37a4('0x14')](_0x37a4('0xc'),auth['isAuthenticated'](),controller[_0x37a4('0x15')]);module[_0x37a4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 31fd4f1..72ef958 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 _0x3dac=['sequelize','exports','STRING'];(function(_0xe04ebf,_0x5b44cd){var _0x36256f=function(_0x472c78){while(--_0x472c78){_0xe04ebf['push'](_0xe04ebf['shift']());}};_0x36256f(++_0x5b44cd);}(_0x3dac,0xa2));var _0xc3da=function(_0x19631e,_0x4ff76e){_0x19631e=_0x19631e-0x0;var _0xa9b9ec=_0x3dac[_0x19631e];return _0xa9b9ec;};'use strict';var Sequelize=require(_0xc3da('0x0'));module[_0xc3da('0x1')]={'name':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc3da('0x2')]},'username':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc3da('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4ac5=['sequelize','STRING','HelpDesk'];(function(_0x32e9e9,_0x3df5aa){var _0x400b63=function(_0x5d0454){while(--_0x5d0454){_0x32e9e9['push'](_0x32e9e9['shift']());}};_0x400b63(++_0x3df5aa);}(_0x4ac5,0x147));var _0x54ac=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x4ac5[_0x4b1032];return _0x5a1d55;};'use strict';var Sequelize=require(_0x54ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x54ac('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54ac('0x2')},'remoteUri':{'type':Sequelize[_0x54ac('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x54ac('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x54ac('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 e72002b..c0fd78d 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 _0x2c98=['sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','username','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','%s/webservice.php','GET','POST','login','result','success','sessionName','autogenerated','owner','includes','remove','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x42ab56,_0x358dc3){var _0x256d09=function(_0x4fe951){while(--_0x4fe951){_0x42ab56['push'](_0x42ab56['shift']());}};_0x256d09(++_0x358dc3);}(_0x2c98,0x1d1));var _0x82c9=function(_0x3949ac,_0x1b0e2e){_0x3949ac=_0x3949ac-0x0;var _0x3a8ea4=_0x2c98[_0x3949ac];return _0x3a8ea4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82c9('0x0'));var zipdir=require(_0x82c9('0x1'));var jsonpatch=require(_0x82c9('0x2'));var rp=require(_0x82c9('0x3'));var moment=require(_0x82c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82c9('0x5'));var util=require(_0x82c9('0x6'));var path=require('path');var sox=require(_0x82c9('0x7'));var csv=require(_0x82c9('0x8'));var ejs=require(_0x82c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82c9('0xa'));var squel=require(_0x82c9('0xb'));var crypto=require(_0x82c9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x82c9('0x8'));var querystring=require(_0x82c9('0xd'));var Papa=require(_0x82c9('0xe'));var Redis=require('ioredis');var authService=require(_0x82c9('0xf'));var qs=require(_0x82c9('0x10'));var as=require(_0x82c9('0x11'));var hardwareService=require(_0x82c9('0x12'));var logger=require(_0x82c9('0x13'))(_0x82c9('0x14'));var utils=require(_0x82c9('0x15'));var config=require(_0x82c9('0x16'));var licenseUtil=require(_0x82c9('0x17'));var db=require(_0x82c9('0x18'))['db'];var integrations=require(_0x82c9('0x19'));function respondWithStatusCode(_0x291c30,_0x30e04f){_0x30e04f=_0x30e04f||0xcc;return function(_0xbaf44){if(_0xbaf44){return _0x291c30[_0x82c9('0x1a')](_0x30e04f);}return _0x291c30[_0x82c9('0x1b')](_0x30e04f)[_0x82c9('0x1c')]();};}function respondWithResult(_0x5c096f,_0x1f16f5){_0x1f16f5=_0x1f16f5||0xc8;return function(_0x1c641a){if(_0x1c641a){return _0x5c096f[_0x82c9('0x1b')](_0x1f16f5)['json'](_0x1c641a);}};}function respondWithFilteredResult(_0x52bb51,_0x31b4a2){return function(_0x4c25fc){if(_0x4c25fc){var _0x3e15a7=typeof _0x31b4a2['offset']===_0x82c9('0x1d')&&typeof _0x31b4a2[_0x82c9('0x1e')]===_0x82c9('0x1d');var _0x445be0=_0x4c25fc[_0x82c9('0x1f')];var _0x347b94=_0x3e15a7?0x0:_0x31b4a2[_0x82c9('0x20')];var _0x4d23e8=_0x3e15a7?_0x4c25fc[_0x82c9('0x1f')]:_0x31b4a2['offset']+_0x31b4a2[_0x82c9('0x1e')];var _0x37590c;if(_0x4d23e8>=_0x445be0){_0x4d23e8=_0x445be0;_0x37590c=0xc8;}else{_0x37590c=0xce;}_0x52bb51['status'](_0x37590c);return _0x52bb51[_0x82c9('0x21')](_0x82c9('0x22'),_0x347b94+'-'+_0x4d23e8+'/'+_0x445be0)[_0x82c9('0x23')](_0x4c25fc);}return null;};}function patchUpdates(_0x7c3f){return function(_0x8d05f4){try{jsonpatch[_0x82c9('0x24')](_0x8d05f4,_0x7c3f,!![]);}catch(_0x54a910){return BPromise[_0x82c9('0x25')](_0x54a910);}return _0x8d05f4[_0x82c9('0x26')]();};}function saveUpdates(_0x37f085,_0x4436a1){return function(_0x190422){if(_0x190422){return _0x190422['update'](_0x37f085)[_0x82c9('0x27')](function(_0x1539d9){return _0x1539d9;});}return null;};}function removeEntity(_0x315f47,_0x1993bd){return function(_0x40b9d0){if(_0x40b9d0){return _0x40b9d0[_0x82c9('0x28')]()[_0x82c9('0x27')](function(){_0x315f47[_0x82c9('0x1b')](0xcc)[_0x82c9('0x1c')]();});}};}function handleEntityNotFound(_0x38b537,_0x48a13b){return function(_0x77593a){if(!_0x77593a){_0x38b537[_0x82c9('0x1a')](0x194);}return _0x77593a;};}function handleError(_0x1e481c,_0x1e3246){_0x1e3246=_0x1e3246||0x1f4;return function(_0x7b414f){logger[_0x82c9('0x29')](_0x7b414f[_0x82c9('0x2a')]);if(_0x7b414f[_0x82c9('0x2b')]){delete _0x7b414f[_0x82c9('0x2b')];}_0x1e481c[_0x82c9('0x1b')](_0x1e3246)[_0x82c9('0x2c')](_0x7b414f);};}exports[_0x82c9('0x2d')]=function(_0x3b4e49,_0x5a8ac1){var _0x176ce9={},_0x1eda9b={},_0x40cbb6={'count':0x0,'rows':[]};var _0x3c2181=_['map'](db[_0x82c9('0x2e')][_0x82c9('0x2f')],function(_0xdb0d01){return{'name':_0xdb0d01[_0x82c9('0x30')],'type':_0xdb0d01[_0x82c9('0x31')][_0x82c9('0x32')]};});_0x1eda9b['model']=_[_0x82c9('0x33')](_0x3c2181,_0x82c9('0x2b'));_0x1eda9b[_0x82c9('0x34')]=_[_0x82c9('0x35')](_0x3b4e49[_0x82c9('0x34')]);_0x1eda9b[_0x82c9('0x36')]=_[_0x82c9('0x37')](_0x1eda9b[_0x82c9('0x38')],_0x1eda9b[_0x82c9('0x34')]);_0x176ce9[_0x82c9('0x39')]=_['intersection'](_0x1eda9b['model'],qs[_0x82c9('0x3a')](_0x3b4e49[_0x82c9('0x34')][_0x82c9('0x3a')]));_0x176ce9[_0x82c9('0x39')]=_0x176ce9[_0x82c9('0x39')][_0x82c9('0x3b')]?_0x176ce9[_0x82c9('0x39')]:_0x1eda9b[_0x82c9('0x38')];if(!_0x3b4e49[_0x82c9('0x34')][_0x82c9('0x3c')](_0x82c9('0x3d'))){_0x176ce9['limit']=qs[_0x82c9('0x1e')](_0x3b4e49['query']['limit']);_0x176ce9[_0x82c9('0x20')]=qs[_0x82c9('0x20')](_0x3b4e49['query']['offset']);}_0x176ce9[_0x82c9('0x3e')]=qs[_0x82c9('0x3f')](_0x3b4e49[_0x82c9('0x34')]['sort']);_0x176ce9['where']=qs[_0x82c9('0x36')](_[_0x82c9('0x40')](_0x3b4e49[_0x82c9('0x34')],_0x1eda9b['filters']),_0x3c2181);if(_0x3b4e49[_0x82c9('0x34')]['filter']){_0x176ce9[_0x82c9('0x41')]=_[_0x82c9('0x42')](_0x176ce9[_0x82c9('0x41')],{'$or':_[_0x82c9('0x33')](_0x3c2181,function(_0x23f803){if(_0x23f803['type']!==_0x82c9('0x43')){var _0x48ceaa={};_0x48ceaa[_0x23f803[_0x82c9('0x2b')]]={'$like':'%'+_0x3b4e49[_0x82c9('0x34')][_0x82c9('0x44')]+'%'};return _0x48ceaa;}})});}_0x176ce9=_[_0x82c9('0x42')]({},_0x176ce9,_0x3b4e49[_0x82c9('0x45')]);var _0x4ea666={'where':_0x176ce9[_0x82c9('0x41')]};return db[_0x82c9('0x2e')][_0x82c9('0x1f')](_0x4ea666)['then'](function(_0x3e3312){_0x40cbb6['count']=_0x3e3312;if(_0x3b4e49[_0x82c9('0x34')][_0x82c9('0x46')]){_0x176ce9[_0x82c9('0x47')]=[{'all':!![]}];}return db[_0x82c9('0x2e')][_0x82c9('0x48')](_0x176ce9);})[_0x82c9('0x27')](function(_0x38ca68){_0x40cbb6['rows']=_0x38ca68;return _0x40cbb6;})[_0x82c9('0x27')](respondWithFilteredResult(_0x5a8ac1,_0x176ce9))[_0x82c9('0x49')](handleError(_0x5a8ac1,null));};exports[_0x82c9('0x4a')]=function(_0x8b6995,_0x18dede){var _0xb3bf08={'raw':![],'where':{'id':_0x8b6995[_0x82c9('0x4b')]['id']}},_0xb10833={};_0xb10833['model']=_[_0x82c9('0x35')](db[_0x82c9('0x2e')]['rawAttributes']);_0xb10833[_0x82c9('0x34')]=_[_0x82c9('0x35')](_0x8b6995[_0x82c9('0x34')]);_0xb10833['filters']=_[_0x82c9('0x37')](_0xb10833[_0x82c9('0x38')],_0xb10833['query']);_0xb3bf08[_0x82c9('0x39')]=_[_0x82c9('0x37')](_0xb10833['model'],qs[_0x82c9('0x3a')](_0x8b6995[_0x82c9('0x34')][_0x82c9('0x3a')]));_0xb3bf08[_0x82c9('0x39')]=_0xb3bf08[_0x82c9('0x39')][_0x82c9('0x3b')]?_0xb3bf08[_0x82c9('0x39')]:_0xb10833[_0x82c9('0x38')];if(_0x8b6995['query'][_0x82c9('0x46')]){_0xb3bf08[_0x82c9('0x47')]=[{'all':!![]}];}_0xb3bf08=_[_0x82c9('0x42')]({},_0xb3bf08,_0x8b6995['options']);return db[_0x82c9('0x2e')][_0x82c9('0x4c')](_0xb3bf08)['then'](handleEntityNotFound(_0x18dede,null))[_0x82c9('0x27')](respondWithResult(_0x18dede,null))[_0x82c9('0x49')](handleError(_0x18dede,null));};exports[_0x82c9('0x4d')]=function(_0x445194,_0x1120af){return db[_0x82c9('0x2e')][_0x82c9('0x4d')](_0x445194[_0x82c9('0x4e')],{})[_0x82c9('0x27')](respondWithResult(_0x1120af,0xc9))['catch'](handleError(_0x1120af,null));};exports[_0x82c9('0x4f')]=function(_0x131159,_0x6dba37){if(_0x131159[_0x82c9('0x4e')]['id']){delete _0x131159[_0x82c9('0x4e')]['id'];}return db[_0x82c9('0x2e')][_0x82c9('0x4c')]({'where':{'id':_0x131159[_0x82c9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6dba37,null))[_0x82c9('0x27')](saveUpdates(_0x131159['body'],null))[_0x82c9('0x27')](respondWithResult(_0x6dba37,null))[_0x82c9('0x49')](handleError(_0x6dba37,null));};exports[_0x82c9('0x28')]=function(_0x313ec7,_0x2271cf){return db[_0x82c9('0x2e')][_0x82c9('0x4c')]({'where':{'id':_0x313ec7[_0x82c9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2271cf,null))[_0x82c9('0x27')](removeEntity(_0x2271cf,null))['catch'](handleError(_0x2271cf,null));};exports[_0x82c9('0x50')]=function(_0x3d450c,_0x18d188,_0x446155){var _0x5b1375={};var _0x443b87={};var _0x1b36d4;var _0x33667e;return db[_0x82c9('0x2e')][_0x82c9('0x51')]({'where':{'id':_0x3d450c[_0x82c9('0x4b')]['id']}})[_0x82c9('0x27')](handleEntityNotFound(_0x18d188,null))[_0x82c9('0x27')](function(_0xbf112c){if(_0xbf112c){_0x1b36d4=_0xbf112c;_0x443b87[_0x82c9('0x38')]=_['keys'](db[_0x82c9('0x52')][_0x82c9('0x2f')]);_0x443b87[_0x82c9('0x34')]=_[_0x82c9('0x35')](_0x3d450c[_0x82c9('0x34')]);_0x443b87[_0x82c9('0x36')]=_[_0x82c9('0x37')](_0x443b87['model'],_0x443b87[_0x82c9('0x34')]);_0x5b1375[_0x82c9('0x39')]=_[_0x82c9('0x37')](_0x443b87[_0x82c9('0x38')],qs['fields'](_0x3d450c[_0x82c9('0x34')][_0x82c9('0x3a')]));_0x5b1375[_0x82c9('0x39')]=_0x5b1375['attributes'][_0x82c9('0x3b')]?_0x5b1375[_0x82c9('0x39')]:_0x443b87[_0x82c9('0x38')];_0x5b1375[_0x82c9('0x3e')]=qs[_0x82c9('0x3f')](_0x3d450c['query']['sort']);_0x5b1375[_0x82c9('0x41')]=qs[_0x82c9('0x36')](_[_0x82c9('0x40')](_0x3d450c[_0x82c9('0x34')],_0x443b87[_0x82c9('0x36')]));if(_0x3d450c[_0x82c9('0x34')]['filter']){_0x5b1375['where']=_['merge'](_0x5b1375[_0x82c9('0x41')],{'$or':_[_0x82c9('0x33')](_0x5b1375[_0x82c9('0x39')],function(_0x307183){var _0x5be06e={};_0x5be06e[_0x307183]={'$like':'%'+_0x3d450c[_0x82c9('0x34')][_0x82c9('0x44')]+'%'};return _0x5be06e;})});}_0x5b1375=_['merge']({},_0x5b1375,_0x3d450c[_0x82c9('0x45')]);return _0x1b36d4[_0x82c9('0x50')](_0x5b1375);}})[_0x82c9('0x27')](function(_0x26df11){if(_0x26df11){_0x33667e=_0x26df11[_0x82c9('0x3b')];if(!_0x3d450c['query'][_0x82c9('0x3c')](_0x82c9('0x3d'))){_0x5b1375[_0x82c9('0x1e')]=qs[_0x82c9('0x1e')](_0x3d450c[_0x82c9('0x34')][_0x82c9('0x1e')]);_0x5b1375[_0x82c9('0x20')]=qs[_0x82c9('0x20')](_0x3d450c[_0x82c9('0x34')][_0x82c9('0x20')]);}return _0x1b36d4[_0x82c9('0x50')](_0x5b1375);}})[_0x82c9('0x27')](function(_0x102d4f){if(_0x102d4f){return _0x102d4f?{'count':_0x33667e,'rows':_0x102d4f}:null;}})[_0x82c9('0x27')](respondWithResult(_0x18d188,null))[_0x82c9('0x49')](handleError(_0x18d188,null));};exports['addConfiguration']=function(_0x3c1ccd,_0x106ec9,_0x4237e1){if(_0x3c1ccd[_0x82c9('0x4e')]['id']){delete _0x3c1ccd[_0x82c9('0x4e')]['id'];}return db[_0x82c9('0x2e')][_0x82c9('0x51')]({'where':{'id':_0x3c1ccd[_0x82c9('0x4b')]['id']}})[_0x82c9('0x27')](handleEntityNotFound(_0x106ec9,null))[_0x82c9('0x27')](function(_0x5a3a32){if(_0x5a3a32){_0x3c1ccd[_0x82c9('0x4e')]['AccountId']=_0x5a3a32['id'];_0x3c1ccd[_0x82c9('0x4e')][_0x82c9('0x53')]=integrations[_0x82c9('0x54')](_0x3c1ccd[_0x82c9('0x4e')][_0x82c9('0x55')],_0x3c1ccd[_0x82c9('0x4e')][_0x82c9('0x31')]);_0x3c1ccd['body'][_0x82c9('0x56')]=integrations[_0x82c9('0x57')](_0x3c1ccd[_0x82c9('0x4e')][_0x82c9('0x55')],_0x3c1ccd[_0x82c9('0x4e')][_0x82c9('0x31')]);return db['VtigerConfiguration'][_0x82c9('0x4d')](_0x3c1ccd[_0x82c9('0x4e')],{'include':[{'model':db[_0x82c9('0x58')],'as':_0x82c9('0x53')},{'model':db[_0x82c9('0x58')],'as':_0x82c9('0x56')}]});}return null;})[_0x82c9('0x27')](respondWithResult(_0x106ec9,null))[_0x82c9('0x49')](handleError(_0x106ec9,null));};var md5=require('md5');exports['getFields']=function(_0x378bdb,_0xacd92a,_0x244d7f){var _0x5b0ae7=null;var _0x2b6a76=null;var _0x16b22c=null;var _0x4fe196=null;var _0x4364f4='';return db['VtigerAccount'][_0x82c9('0x51')]({'where':{'id':_0x378bdb[_0x82c9('0x4b')]['id']},'attributes':['id',_0x82c9('0x2b'),_0x82c9('0x59'),'description',_0x82c9('0x5a'),_0x82c9('0x5b'),_0x82c9('0x5c'),'accessKey']})[_0x82c9('0x27')](handleEntityNotFound(_0xacd92a,null))['then'](function(_0x3540eb){if(_0x3540eb){_0x5b0ae7=_0x3540eb['username'];_0x2b6a76=_0x3540eb[_0x82c9('0x5d')];_0x16b22c=_0x3540eb[_0x82c9('0x5a')];_0x4364f4=_0x3540eb[_0x82c9('0x5b')];var _0x5ee0e5=_0x4364f4['slice'](-0x1);if(_0x5ee0e5==='/'){_0x4364f4=_0x4364f4['substring'](0x0,_0x4364f4[_0x82c9('0x5e')](_0x5ee0e5));}_0x4fe196=util['format'](_0x82c9('0x5f'),_0x4364f4);var _0x36882f={'method':_0x82c9('0x60'),'uri':_0x4fe196,'qs':{'operation':'getchallenge','username':_0x3540eb[_0x82c9('0x59')]},'json':!![]};return rp(_0x36882f);}})[_0x82c9('0x27')](function(_0x18d5f8){if(_0x18d5f8['success']){var _0xe6d4f0={'method':_0x82c9('0x61'),'uri':_0x4fe196,'form':{'operation':_0x82c9('0x62'),'username':_0x5b0ae7,'accessKey':md5(_0x18d5f8[_0x82c9('0x63')]['token']+_0x2b6a76)},'json':!![]};return rp(_0xe6d4f0);}})[_0x82c9('0x27')](function(_0x254492){if(_0x254492[_0x82c9('0x64')]){var _0x3a5fe5={'method':_0x82c9('0x60'),'uri':_0x4fe196,'qs':{'operation':'describe','username':_0x5b0ae7,'sessionName':_0x254492['result'][_0x82c9('0x65')],'elementType':_0x16b22c},'json':!![]};return rp(_0x3a5fe5);}})[_0x82c9('0x27')](function(_0xa3981a){if(_0xa3981a[_0x82c9('0x64')]){var _0x10b9a0=[_0x82c9('0x66'),'reference',_0x82c9('0x67')];_['remove'](_0xa3981a['result'][_0x82c9('0x3a')],function(_0x8b2745){return _0x10b9a0[_0x82c9('0x68')](_0x8b2745[_0x82c9('0x31')][_0x82c9('0x2b')]);});_[_0x82c9('0x69')](_0xa3981a[_0x82c9('0x63')][_0x82c9('0x3a')],function(_0x47664a){return _0x47664a['editable']===_0x82c9('0x6a');});return{'count':_0xa3981a[_0x82c9('0x63')][_0x82c9('0x3a')][_0x82c9('0x3b')],'rows':_['map'](_0xa3981a[_0x82c9('0x63')]['fields'],function(_0x5aa88b){return{'id':_0x5aa88b[_0x82c9('0x2b')],'name':_0x5aa88b[_0x82c9('0x6b')],'custom':_['startsWith'](_0x5aa88b[_0x82c9('0x2b')],_0x82c9('0x6c'))?!![]:![],'options':_0x5aa88b[_0x82c9('0x31')][_0x82c9('0x2b')]===_0x82c9('0x6d')&&_0x5aa88b[_0x82c9('0x31')][_0x82c9('0x6e')][_0x82c9('0x3b')]>0x0?_['map'](_0x5aa88b[_0x82c9('0x31')]['picklistValues'],function(_0x131a77){return{'name':_0x131a77[_0x82c9('0x6b')],'value':_0x131a77[_0x82c9('0x6f')]};}):[]};})};}})['then'](respondWithResult(_0xacd92a,null))[_0x82c9('0x49')](function(_0x12a864){console[_0x82c9('0x70')](_0x82c9('0x71')+_0x12a864);var _0x195168=_0x378bdb[_0x82c9('0x34')][_0x82c9('0x72')]?0x1f4:_0x12a864['statusCode']||0x1f4;logger[_0x82c9('0x29')](_0x82c9('0x73'),'getFields',_0x195168,JSON['stringify'](_0x12a864));delete _0x12a864[_0x82c9('0x2b')];if(_0x195168===0x191){_0x195168=0x190;}_0xacd92a[_0x82c9('0x1b')](_0x195168)[_0x82c9('0x2c')](_0x378bdb['query']['test']?{'message':_0x82c9('0x74'),'statusCode':_0x12a864[_0x82c9('0x75')]}:_0x12a864);});}; \ No newline at end of file +var _0x7cb4=['name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','VtigerConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','channel','VtigerField','Subjects','Descriptions','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','%s/webservice.php','GET','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','editable','false','startsWith','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','stack'];(function(_0x16eed2,_0x14d1d2){var _0x102394=function(_0x20aca6){while(--_0x20aca6){_0x16eed2['push'](_0x16eed2['shift']());}};_0x102394(++_0x14d1d2);}(_0x7cb4,0x1c4));var _0x47cb=function(_0xc83796,_0x11fd59){_0xc83796=_0xc83796-0x0;var _0x1aec06=_0x7cb4[_0xc83796];return _0x1aec06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47cb('0x0'));var zipdir=require(_0x47cb('0x1'));var jsonpatch=require(_0x47cb('0x2'));var rp=require(_0x47cb('0x3'));var moment=require(_0x47cb('0x4'));var BPromise=require(_0x47cb('0x5'));var Mustache=require(_0x47cb('0x6'));var util=require(_0x47cb('0x7'));var path=require(_0x47cb('0x8'));var sox=require(_0x47cb('0x9'));var csv=require(_0x47cb('0xa'));var ejs=require(_0x47cb('0xb'));var fs=require('fs');var fs_extra=require(_0x47cb('0xc'));var _=require(_0x47cb('0xd'));var squel=require(_0x47cb('0xe'));var crypto=require('crypto');var jsforce=require(_0x47cb('0xf'));var deskjs=require(_0x47cb('0x10'));var toCsv=require(_0x47cb('0xa'));var querystring=require(_0x47cb('0x11'));var Papa=require(_0x47cb('0x12'));var Redis=require(_0x47cb('0x13'));var authService=require(_0x47cb('0x14'));var qs=require(_0x47cb('0x15'));var as=require(_0x47cb('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47cb('0x17'))(_0x47cb('0x18'));var utils=require('../../config/utils');var config=require(_0x47cb('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x47cb('0x1a'))['db'];var integrations=require(_0x47cb('0x1b'));function respondWithStatusCode(_0x59dcad,_0x215576){_0x215576=_0x215576||0xcc;return function(_0x4436a9){if(_0x4436a9){return _0x59dcad[_0x47cb('0x1c')](_0x215576);}return _0x59dcad[_0x47cb('0x1d')](_0x215576)[_0x47cb('0x1e')]();};}function respondWithResult(_0x19fe9e,_0x4c8446){_0x4c8446=_0x4c8446||0xc8;return function(_0x6ae5ad){if(_0x6ae5ad){return _0x19fe9e[_0x47cb('0x1d')](_0x4c8446)[_0x47cb('0x1f')](_0x6ae5ad);}};}function respondWithFilteredResult(_0x1bc235,_0x4462f5){return function(_0x3eeb9e){if(_0x3eeb9e){var _0xce8a8=typeof _0x4462f5['offset']===_0x47cb('0x20')&&typeof _0x4462f5[_0x47cb('0x21')]===_0x47cb('0x20');var _0x1951df=_0x3eeb9e[_0x47cb('0x22')];var _0x22655b=_0xce8a8?0x0:_0x4462f5[_0x47cb('0x23')];var _0x1a24fa=_0xce8a8?_0x3eeb9e['count']:_0x4462f5[_0x47cb('0x23')]+_0x4462f5[_0x47cb('0x21')];var _0x11a6ba;if(_0x1a24fa>=_0x1951df){_0x1a24fa=_0x1951df;_0x11a6ba=0xc8;}else{_0x11a6ba=0xce;}_0x1bc235['status'](_0x11a6ba);return _0x1bc235[_0x47cb('0x24')]('Content-Range',_0x22655b+'-'+_0x1a24fa+'/'+_0x1951df)[_0x47cb('0x1f')](_0x3eeb9e);}return null;};}function patchUpdates(_0x2d1868){return function(_0x4eaea8){try{jsonpatch[_0x47cb('0x25')](_0x4eaea8,_0x2d1868,!![]);}catch(_0xe3f020){return BPromise[_0x47cb('0x26')](_0xe3f020);}return _0x4eaea8[_0x47cb('0x27')]();};}function saveUpdates(_0x4d58b0,_0x102ae4){return function(_0x51a454){if(_0x51a454){return _0x51a454[_0x47cb('0x28')](_0x4d58b0)[_0x47cb('0x29')](function(_0x33baff){return _0x33baff;});}return null;};}function removeEntity(_0x51e0df,_0x1a3c14){return function(_0x6247df){if(_0x6247df){return _0x6247df[_0x47cb('0x2a')]()[_0x47cb('0x29')](function(){_0x51e0df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x991c1e,_0x318472){return function(_0x463fb2){if(!_0x463fb2){_0x991c1e[_0x47cb('0x1c')](0x194);}return _0x463fb2;};}function handleError(_0x22dde2,_0x2431f4){_0x2431f4=_0x2431f4||0x1f4;return function(_0x29da76){logger['error'](_0x29da76[_0x47cb('0x2b')]);if(_0x29da76[_0x47cb('0x2c')]){delete _0x29da76['name'];}_0x22dde2[_0x47cb('0x1d')](_0x2431f4)[_0x47cb('0x2d')](_0x29da76);};}exports[_0x47cb('0x2e')]=function(_0x3748dd,_0x2bc3e9){var _0x3b0c10={},_0x2f3a47={},_0x5996be={'count':0x0,'rows':[]};var _0x4d1504=_[_0x47cb('0x2f')](db[_0x47cb('0x30')][_0x47cb('0x31')],function(_0x26be4){return{'name':_0x26be4[_0x47cb('0x32')],'type':_0x26be4[_0x47cb('0x33')][_0x47cb('0x34')]};});_0x2f3a47['model']=_[_0x47cb('0x2f')](_0x4d1504,_0x47cb('0x2c'));_0x2f3a47[_0x47cb('0x35')]=_[_0x47cb('0x36')](_0x3748dd['query']);_0x2f3a47[_0x47cb('0x37')]=_[_0x47cb('0x38')](_0x2f3a47[_0x47cb('0x39')],_0x2f3a47[_0x47cb('0x35')]);_0x3b0c10[_0x47cb('0x3a')]=_['intersection'](_0x2f3a47['model'],qs[_0x47cb('0x3b')](_0x3748dd['query'][_0x47cb('0x3b')]));_0x3b0c10[_0x47cb('0x3a')]=_0x3b0c10['attributes']['length']?_0x3b0c10['attributes']:_0x2f3a47['model'];if(!_0x3748dd[_0x47cb('0x35')][_0x47cb('0x3c')](_0x47cb('0x3d'))){_0x3b0c10['limit']=qs['limit'](_0x3748dd[_0x47cb('0x35')][_0x47cb('0x21')]);_0x3b0c10[_0x47cb('0x23')]=qs[_0x47cb('0x23')](_0x3748dd[_0x47cb('0x35')][_0x47cb('0x23')]);}_0x3b0c10[_0x47cb('0x3e')]=qs['sort'](_0x3748dd[_0x47cb('0x35')][_0x47cb('0x3f')]);_0x3b0c10[_0x47cb('0x40')]=qs[_0x47cb('0x37')](_['pick'](_0x3748dd[_0x47cb('0x35')],_0x2f3a47[_0x47cb('0x37')]),_0x4d1504);if(_0x3748dd[_0x47cb('0x35')]['filter']){_0x3b0c10[_0x47cb('0x40')]=_[_0x47cb('0x41')](_0x3b0c10['where'],{'$or':_[_0x47cb('0x2f')](_0x4d1504,function(_0x535882){if(_0x535882['type']!==_0x47cb('0x42')){var _0x1b639c={};_0x1b639c[_0x535882[_0x47cb('0x2c')]]={'$like':'%'+_0x3748dd[_0x47cb('0x35')][_0x47cb('0x43')]+'%'};return _0x1b639c;}})});}_0x3b0c10=_[_0x47cb('0x41')]({},_0x3b0c10,_0x3748dd[_0x47cb('0x44')]);var _0xb18745={'where':_0x3b0c10[_0x47cb('0x40')]};return db['VtigerAccount'][_0x47cb('0x22')](_0xb18745)[_0x47cb('0x29')](function(_0x2f9360){_0x5996be[_0x47cb('0x22')]=_0x2f9360;if(_0x3748dd['query'][_0x47cb('0x45')]){_0x3b0c10['include']=[{'all':!![]}];}return db[_0x47cb('0x30')][_0x47cb('0x46')](_0x3b0c10);})[_0x47cb('0x29')](function(_0x422f4f){_0x5996be[_0x47cb('0x47')]=_0x422f4f;return _0x5996be;})[_0x47cb('0x29')](respondWithFilteredResult(_0x2bc3e9,_0x3b0c10))[_0x47cb('0x48')](handleError(_0x2bc3e9,null));};exports[_0x47cb('0x49')]=function(_0x24cf41,_0x182c3c){var _0x18b7f9={'raw':![],'where':{'id':_0x24cf41[_0x47cb('0x4a')]['id']}},_0x50d5e1={};_0x50d5e1['model']=_[_0x47cb('0x36')](db[_0x47cb('0x30')][_0x47cb('0x31')]);_0x50d5e1['query']=_[_0x47cb('0x36')](_0x24cf41['query']);_0x50d5e1[_0x47cb('0x37')]=_[_0x47cb('0x38')](_0x50d5e1[_0x47cb('0x39')],_0x50d5e1['query']);_0x18b7f9['attributes']=_[_0x47cb('0x38')](_0x50d5e1['model'],qs[_0x47cb('0x3b')](_0x24cf41[_0x47cb('0x35')][_0x47cb('0x3b')]));_0x18b7f9['attributes']=_0x18b7f9[_0x47cb('0x3a')][_0x47cb('0x4b')]?_0x18b7f9[_0x47cb('0x3a')]:_0x50d5e1[_0x47cb('0x39')];if(_0x24cf41[_0x47cb('0x35')][_0x47cb('0x45')]){_0x18b7f9['include']=[{'all':!![]}];}_0x18b7f9=_['merge']({},_0x18b7f9,_0x24cf41['options']);return db[_0x47cb('0x30')][_0x47cb('0x4c')](_0x18b7f9)[_0x47cb('0x29')](handleEntityNotFound(_0x182c3c,null))['then'](respondWithResult(_0x182c3c,null))['catch'](handleError(_0x182c3c,null));};exports[_0x47cb('0x4d')]=function(_0x34ebe1,_0x40a94a){return db['VtigerAccount'][_0x47cb('0x4d')](_0x34ebe1['body'],{})[_0x47cb('0x29')](respondWithResult(_0x40a94a,0xc9))[_0x47cb('0x48')](handleError(_0x40a94a,null));};exports['update']=function(_0x2965b3,_0xad9855){if(_0x2965b3[_0x47cb('0x4e')]['id']){delete _0x2965b3['body']['id'];}return db[_0x47cb('0x30')]['find']({'where':{'id':_0x2965b3[_0x47cb('0x4a')]['id']}})[_0x47cb('0x29')](handleEntityNotFound(_0xad9855,null))[_0x47cb('0x29')](saveUpdates(_0x2965b3[_0x47cb('0x4e')],null))[_0x47cb('0x29')](respondWithResult(_0xad9855,null))['catch'](handleError(_0xad9855,null));};exports['destroy']=function(_0x2727ea,_0x2838d4){return db[_0x47cb('0x30')][_0x47cb('0x4c')]({'where':{'id':_0x2727ea[_0x47cb('0x4a')]['id']}})[_0x47cb('0x29')](handleEntityNotFound(_0x2838d4,null))['then'](removeEntity(_0x2838d4,null))[_0x47cb('0x48')](handleError(_0x2838d4,null));};exports['getConfigurations']=function(_0x4ca9ab,_0xba7853,_0x5dc407){var _0x4bebea={};var _0x4ad967={};var _0x3ac7f2;var _0x28fb59;return db[_0x47cb('0x30')]['findOne']({'where':{'id':_0x4ca9ab['params']['id']}})[_0x47cb('0x29')](handleEntityNotFound(_0xba7853,null))['then'](function(_0x568796){if(_0x568796){_0x3ac7f2=_0x568796;_0x4ad967[_0x47cb('0x39')]=_[_0x47cb('0x36')](db[_0x47cb('0x4f')][_0x47cb('0x31')]);_0x4ad967['query']=_[_0x47cb('0x36')](_0x4ca9ab['query']);_0x4ad967['filters']=_[_0x47cb('0x38')](_0x4ad967[_0x47cb('0x39')],_0x4ad967[_0x47cb('0x35')]);_0x4bebea[_0x47cb('0x3a')]=_[_0x47cb('0x38')](_0x4ad967[_0x47cb('0x39')],qs['fields'](_0x4ca9ab['query'][_0x47cb('0x3b')]));_0x4bebea[_0x47cb('0x3a')]=_0x4bebea['attributes'][_0x47cb('0x4b')]?_0x4bebea['attributes']:_0x4ad967[_0x47cb('0x39')];_0x4bebea[_0x47cb('0x3e')]=qs[_0x47cb('0x3f')](_0x4ca9ab[_0x47cb('0x35')][_0x47cb('0x3f')]);_0x4bebea['where']=qs[_0x47cb('0x37')](_[_0x47cb('0x50')](_0x4ca9ab[_0x47cb('0x35')],_0x4ad967[_0x47cb('0x37')]));if(_0x4ca9ab[_0x47cb('0x35')][_0x47cb('0x43')]){_0x4bebea[_0x47cb('0x40')]=_[_0x47cb('0x41')](_0x4bebea['where'],{'$or':_[_0x47cb('0x2f')](_0x4bebea[_0x47cb('0x3a')],function(_0xe9f8f5){var _0x57a90e={};_0x57a90e[_0xe9f8f5]={'$like':'%'+_0x4ca9ab[_0x47cb('0x35')][_0x47cb('0x43')]+'%'};return _0x57a90e;})});}_0x4bebea=_['merge']({},_0x4bebea,_0x4ca9ab[_0x47cb('0x44')]);return _0x3ac7f2['getConfigurations'](_0x4bebea);}})[_0x47cb('0x29')](function(_0x43ad7c){if(_0x43ad7c){_0x28fb59=_0x43ad7c[_0x47cb('0x4b')];if(!_0x4ca9ab['query'][_0x47cb('0x3c')](_0x47cb('0x3d'))){_0x4bebea[_0x47cb('0x21')]=qs['limit'](_0x4ca9ab['query'][_0x47cb('0x21')]);_0x4bebea['offset']=qs['offset'](_0x4ca9ab[_0x47cb('0x35')][_0x47cb('0x23')]);}return _0x3ac7f2['getConfigurations'](_0x4bebea);}})[_0x47cb('0x29')](function(_0x463544){if(_0x463544){return _0x463544?{'count':_0x28fb59,'rows':_0x463544}:null;}})[_0x47cb('0x29')](respondWithResult(_0xba7853,null))['catch'](handleError(_0xba7853,null));};exports[_0x47cb('0x51')]=function(_0x3c5ecf,_0x328126,_0x596c35){if(_0x3c5ecf['body']['id']){delete _0x3c5ecf['body']['id'];}return db[_0x47cb('0x30')][_0x47cb('0x52')]({'where':{'id':_0x3c5ecf[_0x47cb('0x4a')]['id']}})[_0x47cb('0x29')](handleEntityNotFound(_0x328126,null))['then'](function(_0x19bc4d){if(_0x19bc4d){_0x3c5ecf[_0x47cb('0x4e')][_0x47cb('0x53')]=_0x19bc4d['id'];_0x3c5ecf[_0x47cb('0x4e')]['Subjects']=integrations[_0x47cb('0x54')](_0x3c5ecf[_0x47cb('0x4e')][_0x47cb('0x55')],_0x3c5ecf[_0x47cb('0x4e')][_0x47cb('0x33')]);_0x3c5ecf[_0x47cb('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x3c5ecf[_0x47cb('0x4e')][_0x47cb('0x55')],_0x3c5ecf[_0x47cb('0x4e')][_0x47cb('0x33')]);return db[_0x47cb('0x4f')][_0x47cb('0x4d')](_0x3c5ecf[_0x47cb('0x4e')],{'include':[{'model':db[_0x47cb('0x56')],'as':_0x47cb('0x57')},{'model':db[_0x47cb('0x56')],'as':_0x47cb('0x58')}]});}return null;})[_0x47cb('0x29')](respondWithResult(_0x328126,null))[_0x47cb('0x48')](handleError(_0x328126,null));};var md5=require(_0x47cb('0x59'));exports['getFields']=function(_0x350218,_0x258c0f,_0xff78e4){var _0x4c20db=null;var _0x46735b=null;var _0x1832e3=null;var _0x25095e=null;var _0x1c7746='';return db['VtigerAccount'][_0x47cb('0x52')]({'where':{'id':_0x350218[_0x47cb('0x4a')]['id']},'attributes':['id','name',_0x47cb('0x5a'),_0x47cb('0x5b'),'moduleName',_0x47cb('0x5c'),_0x47cb('0x5d'),'accessKey']})[_0x47cb('0x29')](handleEntityNotFound(_0x258c0f,null))[_0x47cb('0x29')](function(_0x344fff){if(_0x344fff){_0x4c20db=_0x344fff[_0x47cb('0x5a')];_0x46735b=_0x344fff[_0x47cb('0x5e')];_0x1832e3=_0x344fff[_0x47cb('0x5f')];_0x1c7746=_0x344fff['remoteUri'];var _0xc8a5f2=_0x1c7746['slice'](-0x1);if(_0xc8a5f2==='/'){_0x1c7746=_0x1c7746[_0x47cb('0x60')](0x0,_0x1c7746[_0x47cb('0x61')](_0xc8a5f2));}_0x25095e=util['format'](_0x47cb('0x62'),_0x1c7746);var _0x3e0263={'method':_0x47cb('0x63'),'uri':_0x25095e,'qs':{'operation':'getchallenge','username':_0x344fff[_0x47cb('0x5a')]},'json':!![]};return rp(_0x3e0263);}})[_0x47cb('0x29')](function(_0x29fa92){if(_0x29fa92['success']){var _0x3e29ab={'method':_0x47cb('0x64'),'uri':_0x25095e,'form':{'operation':_0x47cb('0x65'),'username':_0x4c20db,'accessKey':md5(_0x29fa92[_0x47cb('0x66')][_0x47cb('0x67')]+_0x46735b)},'json':!![]};return rp(_0x3e29ab);}})['then'](function(_0x86ce32){if(_0x86ce32[_0x47cb('0x68')]){var _0x5e34e3={'method':_0x47cb('0x63'),'uri':_0x25095e,'qs':{'operation':'describe','username':_0x4c20db,'sessionName':_0x86ce32[_0x47cb('0x66')][_0x47cb('0x69')],'elementType':_0x1832e3},'json':!![]};return rp(_0x5e34e3);}})[_0x47cb('0x29')](function(_0x41c74d){if(_0x41c74d[_0x47cb('0x68')]){var _0x2e41dc=[_0x47cb('0x6a'),_0x47cb('0x6b'),_0x47cb('0x6c')];_[_0x47cb('0x6d')](_0x41c74d['result'][_0x47cb('0x3b')],function(_0x430b0d){return _0x2e41dc['includes'](_0x430b0d[_0x47cb('0x33')]['name']);});_['remove'](_0x41c74d[_0x47cb('0x66')][_0x47cb('0x3b')],function(_0x5684a2){return _0x5684a2[_0x47cb('0x6e')]===_0x47cb('0x6f');});return{'count':_0x41c74d['result'][_0x47cb('0x3b')][_0x47cb('0x4b')],'rows':_['map'](_0x41c74d[_0x47cb('0x66')][_0x47cb('0x3b')],function(_0xc204fa){return{'id':_0xc204fa[_0x47cb('0x2c')],'name':_0xc204fa['label'],'custom':_[_0x47cb('0x70')](_0xc204fa[_0x47cb('0x2c')],'cf_')?!![]:![],'options':_0xc204fa[_0x47cb('0x33')][_0x47cb('0x2c')]===_0x47cb('0x71')&&_0xc204fa['type'][_0x47cb('0x72')][_0x47cb('0x4b')]>0x0?_['map'](_0xc204fa[_0x47cb('0x33')][_0x47cb('0x72')],function(_0x4cf7e5){return{'name':_0x4cf7e5[_0x47cb('0x73')],'value':_0x4cf7e5[_0x47cb('0x74')]};}):[]};})};}})[_0x47cb('0x29')](respondWithResult(_0x258c0f,null))['catch'](function(_0x566499){console[_0x47cb('0x75')](_0x47cb('0x76')+_0x566499);var _0x2f4b49=_0x350218[_0x47cb('0x35')][_0x47cb('0x77')]?0x1f4:_0x566499[_0x47cb('0x78')]||0x1f4;logger[_0x47cb('0x79')](_0x47cb('0x7a'),'getFields',_0x2f4b49,JSON[_0x47cb('0x7b')](_0x566499));delete _0x566499[_0x47cb('0x2c')];if(_0x2f4b49===0x191){_0x2f4b49=0x190;}_0x258c0f['status'](_0x2f4b49)[_0x47cb('0x2d')](_0x350218[_0x47cb('0x35')][_0x47cb('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x566499[_0x47cb('0x78')]}:_0x566499);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3018e2d..9f70622 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 _0xc8dd=['int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define'];(function(_0x35d147,_0x86fd){var _0x57a2ec=function(_0x1d0fed){while(--_0x1d0fed){_0x35d147['push'](_0x35d147['shift']());}};_0x57a2ec(++_0x86fd);}(_0xc8dd,0x127));var _0xdc8d=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xc8dd[_0x568cf0];return _0x360f81;};'use strict';var _=require(_0xdc8d('0x0'));var util=require(_0xdc8d('0x1'));var logger=require(_0xdc8d('0x2'))(_0xdc8d('0x3'));var moment=require(_0xdc8d('0x4'));var BPromise=require(_0xdc8d('0x5'));var rp=require(_0xdc8d('0x6'));var fs=require('fs');var path=require(_0xdc8d('0x7'));var rimraf=require(_0xdc8d('0x8'));var config=require(_0xdc8d('0x9'));var attributes=require(_0xdc8d('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xdc8d('0xb')]=function(_0x3eef22,_0x1c5b65){return _0x3eef22[_0xdc8d('0xc')]('VtigerAccount',attributes,{'tableName':_0xdc8d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d97=['../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','api','moment','request-promise','path','rimraf'];(function(_0x27f0fc,_0x35beb4){var _0x172ddc=function(_0x8af266){while(--_0x8af266){_0x27f0fc['push'](_0x27f0fc['shift']());}};_0x172ddc(++_0x35beb4);}(_0x6d97,0xf5));var _0x76d9=function(_0x3a5b9f,_0x599f46){_0x3a5b9f=_0x3a5b9f-0x0;var _0x4e9b72=_0x6d97[_0x3a5b9f];return _0x4e9b72;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x76d9('0x0'));var moment=require(_0x76d9('0x1'));var BPromise=require('bluebird');var rp=require(_0x76d9('0x2'));var fs=require('fs');var path=require(_0x76d9('0x3'));var rimraf=require(_0x76d9('0x4'));var config=require(_0x76d9('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x76d9('0x6'));module[_0x76d9('0x7')]=function(_0x301de1,_0x11a55b){return _0x301de1[_0x76d9('0x8')](_0x76d9('0x9'),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 7dc6efc..9f9d1b4 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 _0x0fd9=['../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x0fd9,0xa3));var _0x90fd=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x0fd9[_0x40ebff];return _0x40122a;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});}exports[_0x90fd('0x15')]=function(_0x1fcc87){var _0x4d8f3b=this;return new Promise(function(_0x3f9c76,_0x16e9e3){return db[_0x90fd('0x16')][_0x90fd('0x17')]({'raw':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'limit':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')]['limit']||null:null,'include':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x30f67e){return{'model':db[_0x30f67e[_0x90fd('0x1e')]],'as':_0x30f67e['as'],'attributes':_0x30f67e['attributes'],'include':_0x30f67e[_0x90fd('0x1c')]?_['map'](_0x30f67e[_0x90fd('0x1c')],function(_0x18d5b3){return{'model':db[_0x18d5b3[_0x90fd('0x1e')]],'as':_0x18d5b3['as'],'attributes':_0x18d5b3[_0x90fd('0x1b')],'include':_0x18d5b3[_0x90fd('0x1c')]?_['map'](_0x18d5b3[_0x90fd('0x1c')],function(_0xe333f0){return{'model':db[_0xe333f0[_0x90fd('0x1e')]],'as':_0xe333f0['as'],'attributes':_0xe333f0[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x428bc2){logger['info']('GetVtigerAccount',_0x1fcc87);logger[_0x90fd('0xe')](_0x90fd('0x15'),_0x1fcc87,JSON[_0x90fd('0x10')](_0x428bc2));_0x3f9c76(_0x428bc2);})[_0x90fd('0x14')](function(_0x397aaf){logger['error']('GetVtigerAccount',_0x397aaf[_0x90fd('0x13')],_0x1fcc87);_0x16e9e3(_0x4d8f3b[_0x90fd('0x11')](0x1f4,_0x397aaf[_0x90fd('0x13')]));});});};exports[_0x90fd('0x20')]=function(_0x4a3ae4){var _0x59aede=this;return new Promise(function(_0x12dea4,_0x21a9cf){return db[_0x90fd('0x16')][_0x90fd('0x21')]({'raw':_0x4a3ae4['options']?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'include':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x209e5c){return{'model':db[_0x209e5c[_0x90fd('0x1e')]],'as':_0x209e5c['as'],'attributes':_0x209e5c['attributes'],'include':_0x209e5c[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x209e5c[_0x90fd('0x1c')],function(_0x3aee5){return{'model':db[_0x3aee5[_0x90fd('0x1e')]],'as':_0x3aee5['as'],'attributes':_0x3aee5[_0x90fd('0x1b')],'include':_0x3aee5[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x3aee5[_0x90fd('0x1c')],function(_0x186f4f){return{'model':db[_0x186f4f[_0x90fd('0x1e')]],'as':_0x186f4f['as'],'attributes':_0x186f4f[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x4c20b0){logger[_0x90fd('0xb')](_0x90fd('0x20'),_0x4a3ae4);logger[_0x90fd('0xe')](_0x90fd('0x20'),_0x4a3ae4,JSON['stringify'](_0x4c20b0));_0x12dea4(_0x4c20b0);})[_0x90fd('0x14')](function(_0x2c4f37){logger[_0x90fd('0x11')]('ShowVtigerAccount',_0x2c4f37['message'],_0x4a3ae4);_0x21a9cf(_0x59aede[_0x90fd('0x11')](0x1f4,_0x2c4f37[_0x90fd('0x13')]));});});}; \ No newline at end of file +var _0xc788=['request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xebef6e,_0x26fa15){var _0x3a6eb8=function(_0x1072a3){while(--_0x1072a3){_0xebef6e['push'](_0xebef6e['shift']());}};_0x3a6eb8(++_0x26fa15);}(_0xc788,0xc4));var _0x8c78=function(_0x210b46,_0x52a05f){_0x210b46=_0x210b46-0x0;var _0x203df2=_0xc788[_0x210b46];return _0x203df2;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});}exports[_0x8c78('0x15')]=function(_0x461eff){var _0x54eafa=this;return new Promise(function(_0x4f7bf9,_0x339d04){return db['VtigerAccount']['findAll']({'raw':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x461eff[_0x8c78('0x16')]?_0x461eff['options'][_0x8c78('0x18')]||null:null,'attributes':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x19')]||null:null,'limit':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1a')]||null:null,'include':_0x461eff['options']?_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x461eff[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x20f483){return{'model':db[_0x20f483[_0x8c78('0x1d')]],'as':_0x20f483['as'],'attributes':_0x20f483[_0x8c78('0x19')],'include':_0x20f483[_0x8c78('0x1b')]?_['map'](_0x20f483[_0x8c78('0x1b')],function(_0x458763){return{'model':db[_0x458763[_0x8c78('0x1d')]],'as':_0x458763['as'],'attributes':_0x458763['attributes'],'include':_0x458763[_0x8c78('0x1b')]?_['map'](_0x458763[_0x8c78('0x1b')],function(_0x24f9a7){return{'model':db[_0x24f9a7[_0x8c78('0x1d')]],'as':_0x24f9a7['as'],'attributes':_0x24f9a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x2568d5){logger['info'](_0x8c78('0x15'),_0x461eff);logger[_0x8c78('0x1e')](_0x8c78('0x15'),_0x461eff,JSON[_0x8c78('0x1f')](_0x2568d5));_0x4f7bf9(_0x2568d5);})[_0x8c78('0x14')](function(_0x2ab5cc){logger['error'](_0x8c78('0x15'),_0x2ab5cc['message'],_0x461eff);_0x339d04(_0x54eafa[_0x8c78('0x10')](0x1f4,_0x2ab5cc[_0x8c78('0x11')]));});});};exports[_0x8c78('0x20')]=function(_0x4e764f){var _0x1f1a0c=this;return new Promise(function(_0x3816d2,_0x4f0005){return db[_0x8c78('0x21')][_0x8c78('0x22')]({'raw':_0x4e764f[_0x8c78('0x16')]?_0x4e764f['options'][_0x8c78('0x17')]===undefined?!![]:![]:!![],'where':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['where']||null:null,'attributes':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')]['attributes']||null:null,'include':_0x4e764f[_0x8c78('0x16')]?_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')]?_[_0x8c78('0x1c')](_0x4e764f[_0x8c78('0x16')][_0x8c78('0x1b')],function(_0x1218f4){return{'model':db[_0x1218f4[_0x8c78('0x1d')]],'as':_0x1218f4['as'],'attributes':_0x1218f4[_0x8c78('0x19')],'include':_0x1218f4[_0x8c78('0x1b')]?_['map'](_0x1218f4[_0x8c78('0x1b')],function(_0x45e673){return{'model':db[_0x45e673[_0x8c78('0x1d')]],'as':_0x45e673['as'],'attributes':_0x45e673[_0x8c78('0x19')],'include':_0x45e673[_0x8c78('0x1b')]?_['map'](_0x45e673[_0x8c78('0x1b')],function(_0xc4d0cf){return{'model':db[_0xc4d0cf[_0x8c78('0x1d')]],'as':_0xc4d0cf['as'],'attributes':_0xc4d0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c78('0xc')](function(_0x25ea2f){logger['info'](_0x8c78('0x20'),_0x4e764f);logger['debug'](_0x8c78('0x20'),_0x4e764f,JSON[_0x8c78('0x1f')](_0x25ea2f));_0x3816d2(_0x25ea2f);})[_0x8c78('0x14')](function(_0x157b81){logger['error'](_0x8c78('0x20'),_0x157b81['message'],_0x4e764f);_0x4f0005(_0x1f1a0c[_0x8c78('0x10')](0x1f4,_0x157b81[_0x8c78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index fa2ab83..d8eb809 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 _0x5d84=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2adf51,_0x2dfab0){var _0x4c9876=function(_0x1a3524){while(--_0x1a3524){_0x2adf51['push'](_0x2adf51['shift']());}};_0x4c9876(++_0x2dfab0);}(_0x5d84,0x1a0));var _0x45d8=function(_0x24c228,_0xa0b01d){_0x24c228=_0x24c228-0x0;var _0xb1035e=_0x5d84[_0x24c228];return _0xb1035e;};'use strict';var multer=require(_0x45d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x45d8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x45d8('0x2'));var auth=require(_0x45d8('0x3'));var interaction=require(_0x45d8('0x4'));var config=require(_0x45d8('0x5'));var controller=require(_0x45d8('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x45d8('0x7')](_0x45d8('0x8'),auth[_0x45d8('0x9')](),controller[_0x45d8('0xa')]);router[_0x45d8('0x7')](_0x45d8('0xb'),auth['isAuthenticated'](),controller[_0x45d8('0xc')]);router[_0x45d8('0x7')]('/:id/subjects',auth[_0x45d8('0x9')](),controller[_0x45d8('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x45d8('0xe')]);router[_0x45d8('0xf')]('/',auth['isAuthenticated'](),controller[_0x45d8('0x10')]);router[_0x45d8('0x11')](_0x45d8('0x8'),auth[_0x45d8('0x9')](),controller[_0x45d8('0x12')]);router[_0x45d8('0x13')](_0x45d8('0x8'),auth['isAuthenticated'](),controller[_0x45d8('0x14')]);module[_0x45d8('0x15')]=router; \ No newline at end of file +var _0x737b=['express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getSubjects','getDescriptions','post','put','destroy','multer','util','path','connect-timeout'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x737b,0x68));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb737('0x0'));var util=require(_0xb737('0x1'));var path=require(_0xb737('0x2'));var timeout=require(_0xb737('0x3'));var express=require(_0xb737('0x4'));var router=express[_0xb737('0x5')]();var fs_extra=require(_0xb737('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb737('0x7'));var controller=require(_0xb737('0x8'));router['get']('/',auth[_0xb737('0x9')](),controller['index']);router[_0xb737('0xa')](_0xb737('0xb'),auth[_0xb737('0x9')](),controller['show']);router['get'](_0xb737('0xc'),auth[_0xb737('0x9')](),controller['getFields']);router[_0xb737('0xa')]('/:id/subjects',auth[_0xb737('0x9')](),controller[_0xb737('0xd')]);router[_0xb737('0xa')]('/:id/descriptions',auth[_0xb737('0x9')](),controller[_0xb737('0xe')]);router[_0xb737('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb737('0x10')](_0xb737('0xb'),auth[_0xb737('0x9')](),controller['update']);router['delete'](_0xb737('0xb'),auth[_0xb737('0x9')](),controller[_0xb737('0x11')]);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 c0c33b9..f7baf3f 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 _0xd6b4=['STRING'];(function(_0x4c03ea,_0x3465be){var _0x7a6922=function(_0xd50354){while(--_0xd50354){_0x4c03ea['push'](_0x4c03ea['shift']());}};_0x7a6922(++_0x3465be);}(_0xd6b4,0x1ca));var _0x4d6b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6b4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4d6b('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7350=['STRING','sequelize'];(function(_0x52a5a8,_0x2b20a5){var _0xf66ddf=function(_0x377048){while(--_0x377048){_0x52a5a8['push'](_0x52a5a8['shift']());}};_0xf66ddf(++_0x2b20a5);}(_0x7350,0x19f));var _0x0735=function(_0x3d0a3f,_0x8746f9){_0x3d0a3f=_0x3d0a3f-0x0;var _0x31ee89=_0x7350[_0x3d0a3f];return _0x31ee89;};'use strict';var Sequelize=require(_0x0735('0x0'));module['exports']={'name':{'type':Sequelize[_0x0735('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 670cc86..ebb7cdd 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 _0x340d=['destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','VtigerField','pick','getFields','getSubjects','nolimit','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x340d,0x11c));var _0xd340=function(_0x7f89ee,_0x2ad151){_0x7f89ee=_0x7f89ee-0x0;var _0x1d5523=_0x340d[_0x7f89ee];return _0x1d5523;};'use strict';var emlformat=require(_0xd340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd340('0x1'));var jsonpatch=require(_0xd340('0x2'));var rp=require(_0xd340('0x3'));var moment=require(_0xd340('0x4'));var BPromise=require(_0xd340('0x5'));var Mustache=require(_0xd340('0x6'));var util=require(_0xd340('0x7'));var path=require(_0xd340('0x8'));var sox=require(_0xd340('0x9'));var csv=require(_0xd340('0xa'));var ejs=require(_0xd340('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd340('0xc'));var squel=require(_0xd340('0xd'));var crypto=require(_0xd340('0xe'));var jsforce=require(_0xd340('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd340('0xa'));var querystring=require(_0xd340('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd340('0x11'));var as=require(_0xd340('0x12'));var hardwareService=require(_0xd340('0x13'));var logger=require('../../config/logger')(_0xd340('0x14'));var utils=require(_0xd340('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd340('0x16'))['db'];function respondWithStatusCode(_0x59c819,_0x405119){_0x405119=_0x405119||0xcc;return function(_0x5056ef){if(_0x5056ef){return _0x59c819['sendStatus'](_0x405119);}return _0x59c819[_0xd340('0x17')](_0x405119)[_0xd340('0x18')]();};}function respondWithResult(_0x4aeda0,_0x1ee933){_0x1ee933=_0x1ee933||0xc8;return function(_0x19b6b0){if(_0x19b6b0){return _0x4aeda0[_0xd340('0x17')](_0x1ee933)[_0xd340('0x19')](_0x19b6b0);}};}function respondWithFilteredResult(_0x85e745,_0x179971){return function(_0x33859f){if(_0x33859f){var _0x172a39=typeof _0x179971[_0xd340('0x1a')]===_0xd340('0x1b')&&typeof _0x179971[_0xd340('0x1c')]==='undefined';var _0x80b902=_0x33859f[_0xd340('0x1d')];var _0x1d90f6=_0x172a39?0x0:_0x179971[_0xd340('0x1a')];var _0x216d27=_0x172a39?_0x33859f['count']:_0x179971['offset']+_0x179971[_0xd340('0x1c')];var _0x32eb77;if(_0x216d27>=_0x80b902){_0x216d27=_0x80b902;_0x32eb77=0xc8;}else{_0x32eb77=0xce;}_0x85e745[_0xd340('0x17')](_0x32eb77);return _0x85e745[_0xd340('0x1e')](_0xd340('0x1f'),_0x1d90f6+'-'+_0x216d27+'/'+_0x80b902)[_0xd340('0x19')](_0x33859f);}return null;};}function patchUpdates(_0x3a5021){return function(_0xb7f093){try{jsonpatch[_0xd340('0x20')](_0xb7f093,_0x3a5021,!![]);}catch(_0x48ab86){return BPromise[_0xd340('0x21')](_0x48ab86);}return _0xb7f093[_0xd340('0x22')]();};}function saveUpdates(_0x353736,_0x3d37c6){return function(_0x964eea){if(_0x964eea){return _0x964eea[_0xd340('0x23')](_0x353736)['then'](function(_0xb878b4){return _0xb878b4;});}return null;};}function removeEntity(_0x1e2cb6,_0x16a20e){return function(_0x4fca88){if(_0x4fca88){return _0x4fca88[_0xd340('0x24')]()['then'](function(){_0x1e2cb6[_0xd340('0x17')](0xcc)[_0xd340('0x18')]();});}};}function handleEntityNotFound(_0x193298,_0x129706){return function(_0x4eecde){if(!_0x4eecde){_0x193298['sendStatus'](0x194);}return _0x4eecde;};}function handleError(_0x557556,_0x330ed3){_0x330ed3=_0x330ed3||0x1f4;return function(_0x30dda0){logger[_0xd340('0x25')](_0x30dda0[_0xd340('0x26')]);if(_0x30dda0[_0xd340('0x27')]){delete _0x30dda0['name'];}_0x557556[_0xd340('0x17')](_0x330ed3)[_0xd340('0x28')](_0x30dda0);};}exports[_0xd340('0x29')]=function(_0x4616d0,_0x1b3123){var _0x3b83d1={},_0x488f69={},_0x3548c8={'count':0x0,'rows':[]};var _0x842235=_['map'](db[_0xd340('0x2a')][_0xd340('0x2b')],function(_0x2e2f45){return{'name':_0x2e2f45['fieldName'],'type':_0x2e2f45[_0xd340('0x2c')]['key']};});_0x488f69[_0xd340('0x2d')]=_['map'](_0x842235,_0xd340('0x27'));_0x488f69[_0xd340('0x2e')]=_[_0xd340('0x2f')](_0x4616d0['query']);_0x488f69[_0xd340('0x30')]=_['intersection'](_0x488f69[_0xd340('0x2d')],_0x488f69[_0xd340('0x2e')]);_0x3b83d1[_0xd340('0x31')]=_[_0xd340('0x32')](_0x488f69[_0xd340('0x2d')],qs['fields'](_0x4616d0[_0xd340('0x2e')][_0xd340('0x33')]));_0x3b83d1[_0xd340('0x31')]=_0x3b83d1['attributes'][_0xd340('0x34')]?_0x3b83d1[_0xd340('0x31')]:_0x488f69['model'];if(!_0x4616d0[_0xd340('0x2e')][_0xd340('0x35')]('nolimit')){_0x3b83d1[_0xd340('0x1c')]=qs[_0xd340('0x1c')](_0x4616d0[_0xd340('0x2e')]['limit']);_0x3b83d1[_0xd340('0x1a')]=qs[_0xd340('0x1a')](_0x4616d0[_0xd340('0x2e')][_0xd340('0x1a')]);}_0x3b83d1[_0xd340('0x36')]=qs[_0xd340('0x37')](_0x4616d0[_0xd340('0x2e')][_0xd340('0x37')]);_0x3b83d1[_0xd340('0x38')]=qs[_0xd340('0x30')](_['pick'](_0x4616d0[_0xd340('0x2e')],_0x488f69[_0xd340('0x30')]),_0x842235);if(_0x4616d0[_0xd340('0x2e')][_0xd340('0x39')]){_0x3b83d1['where']=_[_0xd340('0x3a')](_0x3b83d1[_0xd340('0x38')],{'$or':_[_0xd340('0x3b')](_0x842235,function(_0x35b746){if(_0x35b746[_0xd340('0x2c')]!==_0xd340('0x3c')){var _0x201946={};_0x201946[_0x35b746[_0xd340('0x27')]]={'$like':'%'+_0x4616d0[_0xd340('0x2e')][_0xd340('0x39')]+'%'};return _0x201946;}})});}_0x3b83d1=_[_0xd340('0x3a')]({},_0x3b83d1,_0x4616d0[_0xd340('0x3d')]);var _0x4f43a4={'where':_0x3b83d1[_0xd340('0x38')]};return db[_0xd340('0x2a')][_0xd340('0x1d')](_0x4f43a4)[_0xd340('0x3e')](function(_0x236198){_0x3548c8['count']=_0x236198;if(_0x4616d0['query'][_0xd340('0x3f')]){_0x3b83d1['include']=[{'all':!![]}];}return db[_0xd340('0x2a')][_0xd340('0x40')](_0x3b83d1);})[_0xd340('0x3e')](function(_0x23d0d2){_0x3548c8[_0xd340('0x41')]=_0x23d0d2;return _0x3548c8;})[_0xd340('0x3e')](respondWithFilteredResult(_0x1b3123,_0x3b83d1))[_0xd340('0x42')](handleError(_0x1b3123,null));};exports[_0xd340('0x43')]=function(_0x4fee49,_0x14d0b2){var _0x4ba344={'raw':![],'where':{'id':_0x4fee49[_0xd340('0x44')]['id']}},_0x4942e2={};_0x4942e2[_0xd340('0x2d')]=_[_0xd340('0x2f')](db[_0xd340('0x2a')][_0xd340('0x2b')]);_0x4942e2[_0xd340('0x2e')]=_[_0xd340('0x2f')](_0x4fee49[_0xd340('0x2e')]);_0x4942e2[_0xd340('0x30')]=_[_0xd340('0x32')](_0x4942e2['model'],_0x4942e2['query']);_0x4ba344[_0xd340('0x31')]=_['intersection'](_0x4942e2['model'],qs[_0xd340('0x33')](_0x4fee49['query']['fields']));_0x4ba344[_0xd340('0x31')]=_0x4ba344[_0xd340('0x31')][_0xd340('0x34')]?_0x4ba344[_0xd340('0x31')]:_0x4942e2[_0xd340('0x2d')];if(_0x4fee49[_0xd340('0x2e')][_0xd340('0x3f')]){_0x4ba344[_0xd340('0x45')]=[{'all':!![]}];}_0x4ba344=_['merge']({},_0x4ba344,_0x4fee49['options']);return db[_0xd340('0x2a')][_0xd340('0x46')](_0x4ba344)[_0xd340('0x3e')](handleEntityNotFound(_0x14d0b2,null))[_0xd340('0x3e')](respondWithResult(_0x14d0b2,null))[_0xd340('0x42')](handleError(_0x14d0b2,null));};exports[_0xd340('0x47')]=function(_0x1e53ff,_0x259419){return db[_0xd340('0x2a')]['create'](_0x1e53ff['body'],{})[_0xd340('0x3e')](respondWithResult(_0x259419,0xc9))[_0xd340('0x42')](handleError(_0x259419,null));};exports['update']=function(_0x502706,_0x4716b6){if(_0x502706[_0xd340('0x48')]['id']){delete _0x502706[_0xd340('0x48')]['id'];}return db[_0xd340('0x2a')]['find']({'where':{'id':_0x502706[_0xd340('0x44')]['id']}})[_0xd340('0x3e')](handleEntityNotFound(_0x4716b6,null))[_0xd340('0x3e')](saveUpdates(_0x502706[_0xd340('0x48')],null))['then'](respondWithResult(_0x4716b6,null))[_0xd340('0x42')](handleError(_0x4716b6,null));};exports['destroy']=function(_0x5091b0,_0x57b6a2){return db[_0xd340('0x2a')]['find']({'where':{'id':_0x5091b0[_0xd340('0x44')]['id']}})[_0xd340('0x3e')](handleEntityNotFound(_0x57b6a2,null))['then'](removeEntity(_0x57b6a2,null))[_0xd340('0x42')](handleError(_0x57b6a2,null));};exports['getFields']=function(_0x4288ca,_0x1852e5,_0x4ca8b1){var _0x5b44fb={};var _0x48fe3a={};var _0x3f35b;var _0xca8f1b;return db[_0xd340('0x2a')]['findOne']({'where':{'id':_0x4288ca[_0xd340('0x44')]['id']}})[_0xd340('0x3e')](handleEntityNotFound(_0x1852e5,null))[_0xd340('0x3e')](function(_0x3f5d94){if(_0x3f5d94){_0x3f35b=_0x3f5d94;_0x48fe3a[_0xd340('0x2d')]=_['keys'](db[_0xd340('0x49')]['rawAttributes']);_0x48fe3a[_0xd340('0x2e')]=_[_0xd340('0x2f')](_0x4288ca[_0xd340('0x2e')]);_0x48fe3a[_0xd340('0x30')]=_['intersection'](_0x48fe3a['model'],_0x48fe3a[_0xd340('0x2e')]);_0x5b44fb[_0xd340('0x31')]=_[_0xd340('0x32')](_0x48fe3a['model'],qs[_0xd340('0x33')](_0x4288ca[_0xd340('0x2e')][_0xd340('0x33')]));_0x5b44fb[_0xd340('0x31')]=_0x5b44fb['attributes'][_0xd340('0x34')]?_0x5b44fb[_0xd340('0x31')]:_0x48fe3a[_0xd340('0x2d')];_0x5b44fb['order']=qs[_0xd340('0x37')](_0x4288ca[_0xd340('0x2e')][_0xd340('0x37')]);_0x5b44fb[_0xd340('0x38')]=qs['filters'](_[_0xd340('0x4a')](_0x4288ca[_0xd340('0x2e')],_0x48fe3a[_0xd340('0x30')]));if(_0x4288ca[_0xd340('0x2e')][_0xd340('0x39')]){_0x5b44fb[_0xd340('0x38')]=_[_0xd340('0x3a')](_0x5b44fb['where'],{'$or':_['map'](_0x5b44fb['attributes'],function(_0x8f253e){var _0x5bd45b={};_0x5bd45b[_0x8f253e]={'$like':'%'+_0x4288ca[_0xd340('0x2e')][_0xd340('0x39')]+'%'};return _0x5bd45b;})});}_0x5b44fb=_[_0xd340('0x3a')]({},_0x5b44fb,_0x4288ca['options']);return _0x3f35b[_0xd340('0x4b')](_0x5b44fb);}})['then'](function(_0x27c6c6){if(_0x27c6c6){_0xca8f1b=_0x27c6c6[_0xd340('0x34')];if(!_0x4288ca[_0xd340('0x2e')][_0xd340('0x35')]('nolimit')){_0x5b44fb[_0xd340('0x1c')]=qs[_0xd340('0x1c')](_0x4288ca[_0xd340('0x2e')][_0xd340('0x1c')]);_0x5b44fb['offset']=qs[_0xd340('0x1a')](_0x4288ca[_0xd340('0x2e')][_0xd340('0x1a')]);}return _0x3f35b['getFields'](_0x5b44fb);}})[_0xd340('0x3e')](function(_0x1fd602){if(_0x1fd602){return _0x1fd602?{'count':_0xca8f1b,'rows':_0x1fd602}:null;}})['then'](respondWithResult(_0x1852e5,null))[_0xd340('0x42')](handleError(_0x1852e5,null));};exports['getSubjects']=function(_0x219f52,_0x3df0c5,_0x353868){var _0x49bcce={};var _0x43581b={};var _0x1e0916;var _0x14c632;return db[_0xd340('0x2a')]['findOne']({'where':{'id':_0x219f52['params']['id']}})[_0xd340('0x3e')](handleEntityNotFound(_0x3df0c5,null))[_0xd340('0x3e')](function(_0x1b41d2){if(_0x1b41d2){_0x1e0916=_0x1b41d2;_0x43581b[_0xd340('0x2d')]=_['keys'](db[_0xd340('0x49')]['rawAttributes']);_0x43581b[_0xd340('0x2e')]=_[_0xd340('0x2f')](_0x219f52[_0xd340('0x2e')]);_0x43581b[_0xd340('0x30')]=_['intersection'](_0x43581b['model'],_0x43581b[_0xd340('0x2e')]);_0x49bcce[_0xd340('0x31')]=_[_0xd340('0x32')](_0x43581b[_0xd340('0x2d')],qs[_0xd340('0x33')](_0x219f52['query'][_0xd340('0x33')]));_0x49bcce[_0xd340('0x31')]=_0x49bcce[_0xd340('0x31')][_0xd340('0x34')]?_0x49bcce[_0xd340('0x31')]:_0x43581b[_0xd340('0x2d')];_0x49bcce['order']=qs[_0xd340('0x37')](_0x219f52[_0xd340('0x2e')][_0xd340('0x37')]);_0x49bcce[_0xd340('0x38')]=qs[_0xd340('0x30')](_[_0xd340('0x4a')](_0x219f52[_0xd340('0x2e')],_0x43581b['filters']));if(_0x219f52['query']['filter']){_0x49bcce[_0xd340('0x38')]=_[_0xd340('0x3a')](_0x49bcce[_0xd340('0x38')],{'$or':_[_0xd340('0x3b')](_0x49bcce[_0xd340('0x31')],function(_0x526308){var _0x151557={};_0x151557[_0x526308]={'$like':'%'+_0x219f52[_0xd340('0x2e')][_0xd340('0x39')]+'%'};return _0x151557;})});}_0x49bcce=_[_0xd340('0x3a')]({},_0x49bcce,_0x219f52[_0xd340('0x3d')]);return _0x1e0916[_0xd340('0x4c')](_0x49bcce);}})['then'](function(_0x1de39b){if(_0x1de39b){_0x14c632=_0x1de39b['length'];if(!_0x219f52['query']['hasOwnProperty'](_0xd340('0x4d'))){_0x49bcce['limit']=qs['limit'](_0x219f52[_0xd340('0x2e')]['limit']);_0x49bcce[_0xd340('0x1a')]=qs['offset'](_0x219f52[_0xd340('0x2e')][_0xd340('0x1a')]);}return _0x1e0916[_0xd340('0x4c')](_0x49bcce);}})['then'](function(_0xe6ac90){if(_0xe6ac90){return _0xe6ac90?{'count':_0x14c632,'rows':_0xe6ac90}:null;}})[_0xd340('0x3e')](respondWithResult(_0x3df0c5,null))[_0xd340('0x42')](handleError(_0x3df0c5,null));};exports[_0xd340('0x4e')]=function(_0x5badb9,_0x2d46f1,_0x9050e1){var _0x2260e1={};var _0x523af6={};var _0x4ba590;var _0x5b979a;return db[_0xd340('0x2a')][_0xd340('0x4f')]({'where':{'id':_0x5badb9['params']['id']}})[_0xd340('0x3e')](handleEntityNotFound(_0x2d46f1,null))[_0xd340('0x3e')](function(_0x42de6a){if(_0x42de6a){_0x4ba590=_0x42de6a;_0x523af6[_0xd340('0x2d')]=_['keys'](db[_0xd340('0x49')][_0xd340('0x2b')]);_0x523af6[_0xd340('0x2e')]=_[_0xd340('0x2f')](_0x5badb9[_0xd340('0x2e')]);_0x523af6[_0xd340('0x30')]=_[_0xd340('0x32')](_0x523af6['model'],_0x523af6[_0xd340('0x2e')]);_0x2260e1[_0xd340('0x31')]=_[_0xd340('0x32')](_0x523af6[_0xd340('0x2d')],qs[_0xd340('0x33')](_0x5badb9[_0xd340('0x2e')][_0xd340('0x33')]));_0x2260e1[_0xd340('0x31')]=_0x2260e1[_0xd340('0x31')][_0xd340('0x34')]?_0x2260e1[_0xd340('0x31')]:_0x523af6[_0xd340('0x2d')];_0x2260e1[_0xd340('0x36')]=qs[_0xd340('0x37')](_0x5badb9[_0xd340('0x2e')]['sort']);_0x2260e1[_0xd340('0x38')]=qs[_0xd340('0x30')](_['pick'](_0x5badb9[_0xd340('0x2e')],_0x523af6[_0xd340('0x30')]));if(_0x5badb9['query']['filter']){_0x2260e1[_0xd340('0x38')]=_[_0xd340('0x3a')](_0x2260e1[_0xd340('0x38')],{'$or':_[_0xd340('0x3b')](_0x2260e1[_0xd340('0x31')],function(_0x54c171){var _0x5da964={};_0x5da964[_0x54c171]={'$like':'%'+_0x5badb9[_0xd340('0x2e')][_0xd340('0x39')]+'%'};return _0x5da964;})});}_0x2260e1=_[_0xd340('0x3a')]({},_0x2260e1,_0x5badb9['options']);return _0x4ba590['getDescriptions'](_0x2260e1);}})[_0xd340('0x3e')](function(_0x49a8a9){if(_0x49a8a9){_0x5b979a=_0x49a8a9[_0xd340('0x34')];if(!_0x5badb9[_0xd340('0x2e')][_0xd340('0x35')](_0xd340('0x4d'))){_0x2260e1[_0xd340('0x1c')]=qs[_0xd340('0x1c')](_0x5badb9['query'][_0xd340('0x1c')]);_0x2260e1[_0xd340('0x1a')]=qs[_0xd340('0x1a')](_0x5badb9[_0xd340('0x2e')]['offset']);}return _0x4ba590[_0xd340('0x4e')](_0x2260e1);}})[_0xd340('0x3e')](function(_0x56e250){if(_0x56e250){return _0x56e250?{'count':_0x5b979a,'rows':_0x56e250}:null;}})[_0xd340('0x3e')](respondWithResult(_0x2d46f1,null))[_0xd340('0x42')](handleError(_0x2d46f1,null));}; \ No newline at end of file +var _0x01d5=['VtigerConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','findOne','VtigerField','merge','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x5bbf1c,_0x2e54d0){var _0x3b9d9c=function(_0x2e715b){while(--_0x2e715b){_0x5bbf1c['push'](_0x5bbf1c['shift']());}};_0x3b9d9c(++_0x2e54d0);}(_0x01d5,0x10f));var _0x501d=function(_0x2bbe59,_0x4d967a){_0x2bbe59=_0x2bbe59-0x0;var _0xc7466=_0x01d5[_0x2bbe59];return _0xc7466;};'use strict';var emlformat=require(_0x501d('0x0'));var rimraf=require(_0x501d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x501d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x501d('0x3'));var Mustache=require(_0x501d('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x501d('0x5'));var ejs=require(_0x501d('0x6'));var fs=require('fs');var fs_extra=require(_0x501d('0x7'));var _=require(_0x501d('0x8'));var squel=require(_0x501d('0x9'));var crypto=require(_0x501d('0xa'));var jsforce=require(_0x501d('0xb'));var deskjs=require(_0x501d('0xc'));var toCsv=require(_0x501d('0x5'));var querystring=require(_0x501d('0xd'));var Papa=require(_0x501d('0xe'));var Redis=require('ioredis');var authService=require(_0x501d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x501d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x501d('0x11'))(_0x501d('0x12'));var utils=require('../../config/utils');var config=require(_0x501d('0x13'));var licenseUtil=require(_0x501d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412113,_0x1f678c){_0x1f678c=_0x1f678c||0xcc;return function(_0x30a4e4){if(_0x30a4e4){return _0x412113[_0x501d('0x15')](_0x1f678c);}return _0x412113[_0x501d('0x16')](_0x1f678c)[_0x501d('0x17')]();};}function respondWithResult(_0xcc523a,_0x1e335e){_0x1e335e=_0x1e335e||0xc8;return function(_0x59221c){if(_0x59221c){return _0xcc523a[_0x501d('0x16')](_0x1e335e)[_0x501d('0x18')](_0x59221c);}};}function respondWithFilteredResult(_0x8fe54d,_0x26de30){return function(_0x5adc33){if(_0x5adc33){var _0x3df29f=typeof _0x26de30[_0x501d('0x19')]===_0x501d('0x1a')&&typeof _0x26de30['limit']==='undefined';var _0x4a4d79=_0x5adc33[_0x501d('0x1b')];var _0x5a21d5=_0x3df29f?0x0:_0x26de30[_0x501d('0x19')];var _0x33f8d3=_0x3df29f?_0x5adc33[_0x501d('0x1b')]:_0x26de30[_0x501d('0x19')]+_0x26de30[_0x501d('0x1c')];var _0x412db0;if(_0x33f8d3>=_0x4a4d79){_0x33f8d3=_0x4a4d79;_0x412db0=0xc8;}else{_0x412db0=0xce;}_0x8fe54d[_0x501d('0x16')](_0x412db0);return _0x8fe54d[_0x501d('0x1d')]('Content-Range',_0x5a21d5+'-'+_0x33f8d3+'/'+_0x4a4d79)['json'](_0x5adc33);}return null;};}function patchUpdates(_0x3482a5){return function(_0x1dcbac){try{jsonpatch['apply'](_0x1dcbac,_0x3482a5,!![]);}catch(_0x4cc5c1){return BPromise[_0x501d('0x1e')](_0x4cc5c1);}return _0x1dcbac[_0x501d('0x1f')]();};}function saveUpdates(_0x3cba2e,_0x313782){return function(_0x3703e2){if(_0x3703e2){return _0x3703e2[_0x501d('0x20')](_0x3cba2e)[_0x501d('0x21')](function(_0x543bdf){return _0x543bdf;});}return null;};}function removeEntity(_0x238fb7,_0x49a355){return function(_0x20e94f){if(_0x20e94f){return _0x20e94f[_0x501d('0x22')]()[_0x501d('0x21')](function(){_0x238fb7[_0x501d('0x16')](0xcc)[_0x501d('0x17')]();});}};}function handleEntityNotFound(_0x59b809,_0x5db543){return function(_0x5469ec){if(!_0x5469ec){_0x59b809[_0x501d('0x15')](0x194);}return _0x5469ec;};}function handleError(_0x16f4b1,_0x49e78a){_0x49e78a=_0x49e78a||0x1f4;return function(_0x2d3cb9){logger[_0x501d('0x23')](_0x2d3cb9[_0x501d('0x24')]);if(_0x2d3cb9['name']){delete _0x2d3cb9[_0x501d('0x25')];}_0x16f4b1[_0x501d('0x16')](_0x49e78a)[_0x501d('0x26')](_0x2d3cb9);};}exports[_0x501d('0x27')]=function(_0x21c9b8,_0x3c2ffd){var _0x377b75={},_0x400f71={},_0x4f46f6={'count':0x0,'rows':[]};var _0x367c81=_[_0x501d('0x28')](db[_0x501d('0x29')]['rawAttributes'],function(_0x5dbb1a){return{'name':_0x5dbb1a[_0x501d('0x2a')],'type':_0x5dbb1a['type'][_0x501d('0x2b')]};});_0x400f71[_0x501d('0x2c')]=_[_0x501d('0x28')](_0x367c81,_0x501d('0x25'));_0x400f71[_0x501d('0x2d')]=_[_0x501d('0x2e')](_0x21c9b8[_0x501d('0x2d')]);_0x400f71[_0x501d('0x2f')]=_[_0x501d('0x30')](_0x400f71[_0x501d('0x2c')],_0x400f71[_0x501d('0x2d')]);_0x377b75[_0x501d('0x31')]=_[_0x501d('0x30')](_0x400f71['model'],qs['fields'](_0x21c9b8['query'][_0x501d('0x32')]));_0x377b75[_0x501d('0x31')]=_0x377b75[_0x501d('0x31')][_0x501d('0x33')]?_0x377b75['attributes']:_0x400f71[_0x501d('0x2c')];if(!_0x21c9b8[_0x501d('0x2d')][_0x501d('0x34')](_0x501d('0x35'))){_0x377b75[_0x501d('0x1c')]=qs[_0x501d('0x1c')](_0x21c9b8[_0x501d('0x2d')][_0x501d('0x1c')]);_0x377b75[_0x501d('0x19')]=qs[_0x501d('0x19')](_0x21c9b8[_0x501d('0x2d')][_0x501d('0x19')]);}_0x377b75[_0x501d('0x36')]=qs[_0x501d('0x37')](_0x21c9b8[_0x501d('0x2d')][_0x501d('0x37')]);_0x377b75[_0x501d('0x38')]=qs[_0x501d('0x2f')](_[_0x501d('0x39')](_0x21c9b8[_0x501d('0x2d')],_0x400f71[_0x501d('0x2f')]),_0x367c81);if(_0x21c9b8[_0x501d('0x2d')]['filter']){_0x377b75[_0x501d('0x38')]=_['merge'](_0x377b75[_0x501d('0x38')],{'$or':_[_0x501d('0x28')](_0x367c81,function(_0x3e6ae9){if(_0x3e6ae9[_0x501d('0x3a')]!==_0x501d('0x3b')){var _0x3cf976={};_0x3cf976[_0x3e6ae9['name']]={'$like':'%'+_0x21c9b8[_0x501d('0x2d')][_0x501d('0x3c')]+'%'};return _0x3cf976;}})});}_0x377b75=_['merge']({},_0x377b75,_0x21c9b8[_0x501d('0x3d')]);var _0x20bf1b={'where':_0x377b75[_0x501d('0x38')]};return db[_0x501d('0x29')][_0x501d('0x1b')](_0x20bf1b)[_0x501d('0x21')](function(_0x2c684a){_0x4f46f6['count']=_0x2c684a;if(_0x21c9b8[_0x501d('0x2d')][_0x501d('0x3e')]){_0x377b75[_0x501d('0x3f')]=[{'all':!![]}];}return db[_0x501d('0x29')][_0x501d('0x40')](_0x377b75);})[_0x501d('0x21')](function(_0x5e8393){_0x4f46f6['rows']=_0x5e8393;return _0x4f46f6;})['then'](respondWithFilteredResult(_0x3c2ffd,_0x377b75))['catch'](handleError(_0x3c2ffd,null));};exports[_0x501d('0x41')]=function(_0x507830,_0x4641f9){var _0x5d63da={'raw':![],'where':{'id':_0x507830[_0x501d('0x42')]['id']}},_0x28940e={};_0x28940e[_0x501d('0x2c')]=_[_0x501d('0x2e')](db[_0x501d('0x29')][_0x501d('0x43')]);_0x28940e[_0x501d('0x2d')]=_['keys'](_0x507830[_0x501d('0x2d')]);_0x28940e[_0x501d('0x2f')]=_[_0x501d('0x30')](_0x28940e[_0x501d('0x2c')],_0x28940e[_0x501d('0x2d')]);_0x5d63da[_0x501d('0x31')]=_['intersection'](_0x28940e[_0x501d('0x2c')],qs[_0x501d('0x32')](_0x507830['query']['fields']));_0x5d63da[_0x501d('0x31')]=_0x5d63da['attributes']['length']?_0x5d63da[_0x501d('0x31')]:_0x28940e[_0x501d('0x2c')];if(_0x507830[_0x501d('0x2d')][_0x501d('0x3e')]){_0x5d63da[_0x501d('0x3f')]=[{'all':!![]}];}_0x5d63da=_['merge']({},_0x5d63da,_0x507830[_0x501d('0x3d')]);return db[_0x501d('0x29')][_0x501d('0x44')](_0x5d63da)[_0x501d('0x21')](handleEntityNotFound(_0x4641f9,null))[_0x501d('0x21')](respondWithResult(_0x4641f9,null))[_0x501d('0x45')](handleError(_0x4641f9,null));};exports[_0x501d('0x46')]=function(_0x4e0b8e,_0xb1837d){return db[_0x501d('0x29')][_0x501d('0x46')](_0x4e0b8e[_0x501d('0x47')],{})[_0x501d('0x21')](respondWithResult(_0xb1837d,0xc9))[_0x501d('0x45')](handleError(_0xb1837d,null));};exports[_0x501d('0x20')]=function(_0x452b65,_0x12d04d){if(_0x452b65[_0x501d('0x47')]['id']){delete _0x452b65[_0x501d('0x47')]['id'];}return db[_0x501d('0x29')][_0x501d('0x44')]({'where':{'id':_0x452b65[_0x501d('0x42')]['id']}})[_0x501d('0x21')](handleEntityNotFound(_0x12d04d,null))[_0x501d('0x21')](saveUpdates(_0x452b65[_0x501d('0x47')],null))['then'](respondWithResult(_0x12d04d,null))['catch'](handleError(_0x12d04d,null));};exports[_0x501d('0x22')]=function(_0x5c45d0,_0x30cd80){return db[_0x501d('0x29')]['find']({'where':{'id':_0x5c45d0['params']['id']}})[_0x501d('0x21')](handleEntityNotFound(_0x30cd80,null))[_0x501d('0x21')](removeEntity(_0x30cd80,null))[_0x501d('0x45')](handleError(_0x30cd80,null));};exports['getFields']=function(_0x236561,_0x24c687,_0x4e9e12){var _0x5982da={};var _0x145222={};var _0x554f74;var _0x2fa9f7;return db['VtigerConfiguration'][_0x501d('0x48')]({'where':{'id':_0x236561['params']['id']}})[_0x501d('0x21')](handleEntityNotFound(_0x24c687,null))[_0x501d('0x21')](function(_0x417334){if(_0x417334){_0x554f74=_0x417334;_0x145222[_0x501d('0x2c')]=_[_0x501d('0x2e')](db[_0x501d('0x49')]['rawAttributes']);_0x145222[_0x501d('0x2d')]=_['keys'](_0x236561['query']);_0x145222[_0x501d('0x2f')]=_[_0x501d('0x30')](_0x145222[_0x501d('0x2c')],_0x145222[_0x501d('0x2d')]);_0x5982da[_0x501d('0x31')]=_[_0x501d('0x30')](_0x145222['model'],qs[_0x501d('0x32')](_0x236561['query'][_0x501d('0x32')]));_0x5982da['attributes']=_0x5982da['attributes']['length']?_0x5982da['attributes']:_0x145222['model'];_0x5982da[_0x501d('0x36')]=qs['sort'](_0x236561[_0x501d('0x2d')][_0x501d('0x37')]);_0x5982da['where']=qs['filters'](_[_0x501d('0x39')](_0x236561['query'],_0x145222[_0x501d('0x2f')]));if(_0x236561['query'][_0x501d('0x3c')]){_0x5982da['where']=_[_0x501d('0x4a')](_0x5982da[_0x501d('0x38')],{'$or':_[_0x501d('0x28')](_0x5982da['attributes'],function(_0x59ef58){var _0x54eec3={};_0x54eec3[_0x59ef58]={'$like':'%'+_0x236561['query'][_0x501d('0x3c')]+'%'};return _0x54eec3;})});}_0x5982da=_[_0x501d('0x4a')]({},_0x5982da,_0x236561[_0x501d('0x3d')]);return _0x554f74['getFields'](_0x5982da);}})[_0x501d('0x21')](function(_0x37d0a1){if(_0x37d0a1){_0x2fa9f7=_0x37d0a1['length'];if(!_0x236561[_0x501d('0x2d')][_0x501d('0x34')](_0x501d('0x35'))){_0x5982da[_0x501d('0x1c')]=qs['limit'](_0x236561[_0x501d('0x2d')][_0x501d('0x1c')]);_0x5982da['offset']=qs[_0x501d('0x19')](_0x236561[_0x501d('0x2d')][_0x501d('0x19')]);}return _0x554f74[_0x501d('0x4b')](_0x5982da);}})[_0x501d('0x21')](function(_0x3c3ef2){if(_0x3c3ef2){return _0x3c3ef2?{'count':_0x2fa9f7,'rows':_0x3c3ef2}:null;}})[_0x501d('0x21')](respondWithResult(_0x24c687,null))[_0x501d('0x45')](handleError(_0x24c687,null));};exports[_0x501d('0x4c')]=function(_0x1db051,_0x2e70f4,_0x45c775){var _0x381907={};var _0x1041de={};var _0x13f9ac;var _0x4f5490;return db[_0x501d('0x29')][_0x501d('0x48')]({'where':{'id':_0x1db051[_0x501d('0x42')]['id']}})[_0x501d('0x21')](handleEntityNotFound(_0x2e70f4,null))['then'](function(_0x44ce53){if(_0x44ce53){_0x13f9ac=_0x44ce53;_0x1041de[_0x501d('0x2c')]=_[_0x501d('0x2e')](db[_0x501d('0x49')]['rawAttributes']);_0x1041de[_0x501d('0x2d')]=_[_0x501d('0x2e')](_0x1db051['query']);_0x1041de['filters']=_[_0x501d('0x30')](_0x1041de['model'],_0x1041de[_0x501d('0x2d')]);_0x381907[_0x501d('0x31')]=_[_0x501d('0x30')](_0x1041de[_0x501d('0x2c')],qs[_0x501d('0x32')](_0x1db051[_0x501d('0x2d')][_0x501d('0x32')]));_0x381907[_0x501d('0x31')]=_0x381907['attributes'][_0x501d('0x33')]?_0x381907['attributes']:_0x1041de['model'];_0x381907[_0x501d('0x36')]=qs['sort'](_0x1db051[_0x501d('0x2d')]['sort']);_0x381907[_0x501d('0x38')]=qs['filters'](_[_0x501d('0x39')](_0x1db051[_0x501d('0x2d')],_0x1041de[_0x501d('0x2f')]));if(_0x1db051[_0x501d('0x2d')][_0x501d('0x3c')]){_0x381907[_0x501d('0x38')]=_[_0x501d('0x4a')](_0x381907[_0x501d('0x38')],{'$or':_[_0x501d('0x28')](_0x381907[_0x501d('0x31')],function(_0x1d84f6){var _0x4d48ee={};_0x4d48ee[_0x1d84f6]={'$like':'%'+_0x1db051[_0x501d('0x2d')]['filter']+'%'};return _0x4d48ee;})});}_0x381907=_[_0x501d('0x4a')]({},_0x381907,_0x1db051[_0x501d('0x3d')]);return _0x13f9ac['getSubjects'](_0x381907);}})[_0x501d('0x21')](function(_0x44439d){if(_0x44439d){_0x4f5490=_0x44439d[_0x501d('0x33')];if(!_0x1db051[_0x501d('0x2d')][_0x501d('0x34')](_0x501d('0x35'))){_0x381907[_0x501d('0x1c')]=qs[_0x501d('0x1c')](_0x1db051['query'][_0x501d('0x1c')]);_0x381907[_0x501d('0x19')]=qs[_0x501d('0x19')](_0x1db051['query']['offset']);}return _0x13f9ac[_0x501d('0x4c')](_0x381907);}})[_0x501d('0x21')](function(_0x3fa767){if(_0x3fa767){return _0x3fa767?{'count':_0x4f5490,'rows':_0x3fa767}:null;}})[_0x501d('0x21')](respondWithResult(_0x2e70f4,null))[_0x501d('0x45')](handleError(_0x2e70f4,null));};exports[_0x501d('0x4d')]=function(_0xb6cde3,_0x2d04fa,_0x4f7497){var _0x32c73a={};var _0x1d8966={};var _0x40318a;var _0x48f60a;return db[_0x501d('0x29')][_0x501d('0x48')]({'where':{'id':_0xb6cde3[_0x501d('0x42')]['id']}})[_0x501d('0x21')](handleEntityNotFound(_0x2d04fa,null))['then'](function(_0x241202){if(_0x241202){_0x40318a=_0x241202;_0x1d8966['model']=_[_0x501d('0x2e')](db[_0x501d('0x49')][_0x501d('0x43')]);_0x1d8966[_0x501d('0x2d')]=_[_0x501d('0x2e')](_0xb6cde3['query']);_0x1d8966[_0x501d('0x2f')]=_['intersection'](_0x1d8966[_0x501d('0x2c')],_0x1d8966[_0x501d('0x2d')]);_0x32c73a[_0x501d('0x31')]=_[_0x501d('0x30')](_0x1d8966[_0x501d('0x2c')],qs[_0x501d('0x32')](_0xb6cde3['query']['fields']));_0x32c73a[_0x501d('0x31')]=_0x32c73a[_0x501d('0x31')][_0x501d('0x33')]?_0x32c73a[_0x501d('0x31')]:_0x1d8966[_0x501d('0x2c')];_0x32c73a['order']=qs[_0x501d('0x37')](_0xb6cde3[_0x501d('0x2d')][_0x501d('0x37')]);_0x32c73a['where']=qs[_0x501d('0x2f')](_[_0x501d('0x39')](_0xb6cde3['query'],_0x1d8966[_0x501d('0x2f')]));if(_0xb6cde3[_0x501d('0x2d')][_0x501d('0x3c')]){_0x32c73a[_0x501d('0x38')]=_['merge'](_0x32c73a[_0x501d('0x38')],{'$or':_['map'](_0x32c73a['attributes'],function(_0x37bf0c){var _0x1162f1={};_0x1162f1[_0x37bf0c]={'$like':'%'+_0xb6cde3[_0x501d('0x2d')]['filter']+'%'};return _0x1162f1;})});}_0x32c73a=_['merge']({},_0x32c73a,_0xb6cde3[_0x501d('0x3d')]);return _0x40318a['getDescriptions'](_0x32c73a);}})[_0x501d('0x21')](function(_0x245fe5){if(_0x245fe5){_0x48f60a=_0x245fe5[_0x501d('0x33')];if(!_0xb6cde3[_0x501d('0x2d')]['hasOwnProperty'](_0x501d('0x35'))){_0x32c73a[_0x501d('0x1c')]=qs[_0x501d('0x1c')](_0xb6cde3[_0x501d('0x2d')][_0x501d('0x1c')]);_0x32c73a['offset']=qs[_0x501d('0x19')](_0xb6cde3[_0x501d('0x2d')][_0x501d('0x19')]);}return _0x40318a[_0x501d('0x4d')](_0x32c73a);}})[_0x501d('0x21')](function(_0x2fe71c){if(_0x2fe71c){return _0x2fe71c?{'count':_0x48f60a,'rows':_0x2fe71c}:null;}})['then'](respondWithResult(_0x2d04fa,null))[_0x501d('0x45')](handleError(_0x2d04fa,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd7fd43..d6a581e 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 _0xbbd2=['../../config/environment','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf33afd,_0x2363b6){var _0x5f432a=function(_0x2599b5){while(--_0x2599b5){_0xf33afd['push'](_0xf33afd['shift']());}};_0x5f432a(++_0x2363b6);}(_0xbbd2,0x1d1));var _0x2bbd=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0xbbd2[_0x114b7c];return _0x47185f;};'use strict';var _=require(_0x2bbd('0x0'));var util=require('util');var logger=require(_0x2bbd('0x1'))(_0x2bbd('0x2'));var moment=require(_0x2bbd('0x3'));var BPromise=require(_0x2bbd('0x4'));var rp=require(_0x2bbd('0x5'));var fs=require('fs');var path=require(_0x2bbd('0x6'));var rimraf=require(_0x2bbd('0x7'));var config=require(_0x2bbd('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x2bbd('0x9')]=function(_0x564d61,_0x88f1a8){return _0x564d61[_0x2bbd('0xa')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e44=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x7e44,0xea));var _0x47e4=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x7e44[_0x43aee5];return _0x76d1d0;};'use strict';var _=require(_0x47e4('0x0'));var util=require(_0x47e4('0x1'));var logger=require(_0x47e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x47e4('0x3'));var rp=require(_0x47e4('0x4'));var fs=require('fs');var path=require(_0x47e4('0x5'));var rimraf=require(_0x47e4('0x6'));var config=require(_0x47e4('0x7'));var attributes=require(_0x47e4('0x8'));module[_0x47e4('0x9')]=function(_0x3d1d30,_0x120271){return _0x3d1d30['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 5c84ac6..ef715d0 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 _0x475e=['jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a8ce2,_0x4cd94e){var _0x38c265=function(_0x1fb277){while(--_0x1fb277){_0x4a8ce2['push'](_0x4a8ce2['shift']());}};_0x38c265(++_0x4cd94e);}(_0x475e,0x160));var _0xe475=function(_0x4b093a,_0x96977){_0x4b093a=_0x4b093a-0x0;var _0x5712f5=_0x475e[_0x4b093a];return _0x5712f5;};'use strict';var _=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var moment=require(_0xe475('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe475('0x3'));var db=require(_0xe475('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe475('0x5'))(_0xe475('0x6'));var config=require(_0xe475('0x7'));var jayson=require(_0xe475('0x8'));var client=jayson[_0xe475('0x9')][_0xe475('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56c62a,_0x52cd72,_0x3ab43c){return new BPromise(function(_0x193a7e,_0xce8cac){return client['request'](_0x56c62a,_0x3ab43c)['then'](function(_0x15a174){logger[_0xe475('0xb')](_0xe475('0xc'),_0x52cd72,'request\x20sent');logger[_0xe475('0xd')](_0xe475('0xe'),_0x52cd72,_0xe475('0xf'),JSON[_0xe475('0x10')](_0x15a174));if(_0x15a174[_0xe475('0x11')]){if(_0x15a174[_0xe475('0x11')]['code']===0x1f4){logger[_0xe475('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x52cd72,_0x15a174['error'][_0xe475('0x12')]);return _0xce8cac(_0x15a174['error']['message']);}logger[_0xe475('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x52cd72,_0x15a174[_0xe475('0x11')][_0xe475('0x12')]);return _0x193a7e(_0x15a174[_0xe475('0x11')]['message']);}else{logger[_0xe475('0xb')](_0xe475('0xc'),_0x52cd72,_0xe475('0xf'));_0x193a7e(_0x15a174['result'][_0xe475('0x12')]);}})[_0xe475('0x13')](function(_0x3464d7){logger[_0xe475('0x11')](_0xe475('0xc'),_0x52cd72,_0x3464d7);_0xce8cac(_0x3464d7);});});} \ No newline at end of file +var _0x0c56=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x336566,_0x59b54a){var _0x4b58b1=function(_0x301935){while(--_0x301935){_0x336566['push'](_0x336566['shift']());}};_0x4b58b1(++_0x59b54a);}(_0x0c56,0xa2));var _0x60c5=function(_0x3c2f57,_0x194009){_0x3c2f57=_0x3c2f57-0x0;var _0x4bee53=_0x0c56[_0x3c2f57];return _0x4bee53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60c5('0x0'));var BPromise=require('bluebird');var rs=require(_0x60c5('0x1'));var fs=require('fs');var Redis=require(_0x60c5('0x2'));var db=require(_0x60c5('0x3'))['db'];var utils=require(_0x60c5('0x4'));var logger=require(_0x60c5('0x5'))('rpc');var config=require(_0x60c5('0x6'));var jayson=require(_0x60c5('0x7'));var client=jayson[_0x60c5('0x8')][_0x60c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcff3be,_0x482834,_0x2de7a9){return new BPromise(function(_0xa30e14,_0x28b4f9){return client[_0x60c5('0xa')](_0xcff3be,_0x2de7a9)[_0x60c5('0xb')](function(_0x155139){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x482834,_0x60c5('0xc'));logger[_0x60c5('0xd')](_0x60c5('0xe'),_0x482834,'request\x20sent',JSON[_0x60c5('0xf')](_0x155139));if(_0x155139[_0x60c5('0x10')]){if(_0x155139['error']['code']===0x1f4){logger[_0x60c5('0x10')](_0x60c5('0x11'),_0x482834,_0x155139['error'][_0x60c5('0x12')]);return _0x28b4f9(_0x155139[_0x60c5('0x10')]['message']);}logger[_0x60c5('0x10')](_0x60c5('0x11'),_0x482834,_0x155139['error'][_0x60c5('0x12')]);return _0xa30e14(_0x155139[_0x60c5('0x10')][_0x60c5('0x12')]);}else{logger[_0x60c5('0x13')](_0x60c5('0x11'),_0x482834,_0x60c5('0xc'));_0xa30e14(_0x155139[_0x60c5('0x14')][_0x60c5('0x12')]);}})[_0x60c5('0x15')](function(_0x434ea1){logger[_0x60c5('0x10')](_0x60c5('0x11'),_0x482834,_0x434ea1);_0x28b4f9(_0x434ea1);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8391651..d8f13ee 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 _0x0a22=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x82885d,_0x4bdfbd){var _0x39c9b9=function(_0x1f3365){while(--_0x1f3365){_0x82885d['push'](_0x82885d['shift']());}};_0x39c9b9(++_0x4bdfbd);}(_0x0a22,0x1eb));var _0x20a2=function(_0x4336a6,_0x1bb68b){_0x4336a6=_0x4336a6-0x0;var _0x2331c8=_0x0a22[_0x4336a6];return _0x2331c8;};'use strict';var multer=require(_0x20a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x20a2('0x1'));var express=require(_0x20a2('0x2'));var router=express[_0x20a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x20a2('0x4'));var interaction=require(_0x20a2('0x5'));var config=require(_0x20a2('0x6'));var controller=require(_0x20a2('0x7'));router[_0x20a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x20a2('0x8')](_0x20a2('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x20a2('0xa')](),controller[_0x20a2('0xb')]);router[_0x20a2('0xc')]('/:id',auth[_0x20a2('0xa')](),controller[_0x20a2('0xd')]);router[_0x20a2('0xe')](_0x20a2('0x9'),auth[_0x20a2('0xa')](),controller[_0x20a2('0xf')]);module[_0x20a2('0x10')]=router; \ No newline at end of file +var _0xb0d7=['post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x3b138e,_0x44514f){var _0x558b61=function(_0x3ff182){while(--_0x3ff182){_0x3b138e['push'](_0x3b138e['shift']());}};_0x558b61(++_0x44514f);}(_0xb0d7,0x72));var _0x7b0d=function(_0x33c387,_0x153c73){_0x33c387=_0x33c387-0x0;var _0x55e61c=_0xb0d7[_0x33c387];return _0x55e61c;};'use strict';var multer=require('multer');var util=require(_0x7b0d('0x0'));var path=require('path');var timeout=require(_0x7b0d('0x1'));var express=require(_0x7b0d('0x2'));var router=express[_0x7b0d('0x3')]();var fs_extra=require(_0x7b0d('0x4'));var auth=require(_0x7b0d('0x5'));var interaction=require(_0x7b0d('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x7b0d('0x7')]('/',auth[_0x7b0d('0x8')](),controller[_0x7b0d('0x9')]);router[_0x7b0d('0x7')](_0x7b0d('0xa'),auth['isAuthenticated'](),controller[_0x7b0d('0xb')]);router[_0x7b0d('0xc')]('/',auth[_0x7b0d('0x8')](),controller[_0x7b0d('0xd')]);router[_0x7b0d('0xe')](_0x7b0d('0xa'),auth[_0x7b0d('0x8')](),controller['update']);router[_0x7b0d('0xf')](_0x7b0d('0xa'),auth[_0x7b0d('0x8')](),controller[_0x7b0d('0x10')]);module[_0x7b0d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 42d1614..653de35 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 _0x5aea=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1b4326,_0x5eef0e){var _0x53999e=function(_0x235bd0){while(--_0x235bd0){_0x1b4326['push'](_0x1b4326['shift']());}};_0x53999e(++_0x5eef0e);}(_0x5aea,0x198));var _0xa5ae=function(_0x30bec1,_0x2c0639){_0x30bec1=_0x30bec1-0x0;var _0x36ce28=_0x5aea[_0x30bec1];return _0x36ce28;};'use strict';var Sequelize=require(_0xa5ae('0x0'));module[_0xa5ae('0x1')]={'type':{'type':Sequelize[_0xa5ae('0x2')](_0xa5ae('0x3'),_0xa5ae('0x4'),_0xa5ae('0x5'),_0xa5ae('0x6'),_0xa5ae('0x7')),'defaultValue':_0xa5ae('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa5ae('0x3'),_0xa5ae('0x4'),_0xa5ae('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa5ae('0x8')]},'nameField':{'type':Sequelize[_0xa5ae('0x8')]},'customField':{'type':Sequelize[_0xa5ae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa5ae('0x8')]}}; \ No newline at end of file +var _0x6c0f=['sequelize','exports','ENUM','string','keyValue','picklist','variable','STRING'];(function(_0x5aa272,_0x142e6e){var _0x148b8a=function(_0x570052){while(--_0x570052){_0x5aa272['push'](_0x5aa272['shift']());}};_0x148b8a(++_0x142e6e);}(_0x6c0f,0x1c8));var _0xf6c0=function(_0x21a15f,_0x30b193){_0x21a15f=_0x21a15f-0x0;var _0x27b83d=_0x6c0f[_0x21a15f];return _0x27b83d;};'use strict';var Sequelize=require(_0xf6c0('0x0'));module[_0xf6c0('0x1')]={'type':{'type':Sequelize[_0xf6c0('0x2')](_0xf6c0('0x3'),'variable','customVariable',_0xf6c0('0x4'),_0xf6c0('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf6c0('0x2')](_0xf6c0('0x3'),_0xf6c0('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf6c0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6c0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index dbb35b4..5d33aab 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 _0xaa49=['ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa49,0x1be));var _0x9aa4=function(_0x5979eb,_0x1d2730){_0x5979eb=_0x5979eb-0x0;var _0x574c6d=_0xaa49[_0x5979eb];return _0x574c6d;};'use strict';var emlformat=require(_0x9aa4('0x0'));var rimraf=require(_0x9aa4('0x1'));var zipdir=require(_0x9aa4('0x2'));var jsonpatch=require(_0x9aa4('0x3'));var rp=require(_0x9aa4('0x4'));var moment=require(_0x9aa4('0x5'));var BPromise=require(_0x9aa4('0x6'));var Mustache=require('mustache');var util=require(_0x9aa4('0x7'));var path=require(_0x9aa4('0x8'));var sox=require('sox');var csv=require(_0x9aa4('0x9'));var ejs=require(_0x9aa4('0xa'));var fs=require('fs');var fs_extra=require(_0x9aa4('0xb'));var _=require(_0x9aa4('0xc'));var squel=require(_0x9aa4('0xd'));var crypto=require('crypto');var jsforce=require(_0x9aa4('0xe'));var deskjs=require(_0x9aa4('0xf'));var toCsv=require(_0x9aa4('0x9'));var querystring=require('querystring');var Papa=require(_0x9aa4('0x10'));var Redis=require(_0x9aa4('0x11'));var authService=require(_0x9aa4('0x12'));var qs=require(_0x9aa4('0x13'));var as=require(_0x9aa4('0x14'));var hardwareService=require(_0x9aa4('0x15'));var logger=require(_0x9aa4('0x16'))(_0x9aa4('0x17'));var utils=require(_0x9aa4('0x18'));var config=require(_0x9aa4('0x19'));var licenseUtil=require(_0x9aa4('0x1a'));var db=require(_0x9aa4('0x1b'))['db'];function respondWithStatusCode(_0x52a10f,_0x5f33f0){_0x5f33f0=_0x5f33f0||0xcc;return function(_0x5ddab6){if(_0x5ddab6){return _0x52a10f[_0x9aa4('0x1c')](_0x5f33f0);}return _0x52a10f[_0x9aa4('0x1d')](_0x5f33f0)[_0x9aa4('0x1e')]();};}function respondWithResult(_0x2c9a57,_0x251495){_0x251495=_0x251495||0xc8;return function(_0x1f669a){if(_0x1f669a){return _0x2c9a57[_0x9aa4('0x1d')](_0x251495)[_0x9aa4('0x1f')](_0x1f669a);}};}function respondWithFilteredResult(_0x1dd579,_0xd6d4b0){return function(_0x330eb1){if(_0x330eb1){var _0x3c56a2=typeof _0xd6d4b0[_0x9aa4('0x20')]===_0x9aa4('0x21')&&typeof _0xd6d4b0[_0x9aa4('0x22')]===_0x9aa4('0x21');var _0x38b346=_0x330eb1[_0x9aa4('0x23')];var _0x4b8806=_0x3c56a2?0x0:_0xd6d4b0[_0x9aa4('0x20')];var _0x7f2348=_0x3c56a2?_0x330eb1[_0x9aa4('0x23')]:_0xd6d4b0[_0x9aa4('0x20')]+_0xd6d4b0[_0x9aa4('0x22')];var _0x4b75e7;if(_0x7f2348>=_0x38b346){_0x7f2348=_0x38b346;_0x4b75e7=0xc8;}else{_0x4b75e7=0xce;}_0x1dd579[_0x9aa4('0x1d')](_0x4b75e7);return _0x1dd579['set']('Content-Range',_0x4b8806+'-'+_0x7f2348+'/'+_0x38b346)[_0x9aa4('0x1f')](_0x330eb1);}return null;};}function patchUpdates(_0x40e705){return function(_0x115664){try{jsonpatch[_0x9aa4('0x24')](_0x115664,_0x40e705,!![]);}catch(_0x449ac2){return BPromise[_0x9aa4('0x25')](_0x449ac2);}return _0x115664[_0x9aa4('0x26')]();};}function saveUpdates(_0x419e89,_0x22916c){return function(_0x467778){if(_0x467778){return _0x467778[_0x9aa4('0x27')](_0x419e89)[_0x9aa4('0x28')](function(_0x539c33){return _0x539c33;});}return null;};}function removeEntity(_0x28f69d,_0x666dfb){return function(_0x4b55b0){if(_0x4b55b0){return _0x4b55b0[_0x9aa4('0x29')]()['then'](function(){_0x28f69d[_0x9aa4('0x1d')](0xcc)[_0x9aa4('0x1e')]();});}};}function handleEntityNotFound(_0x38ffc0,_0x46f256){return function(_0x43fc8a){if(!_0x43fc8a){_0x38ffc0[_0x9aa4('0x1c')](0x194);}return _0x43fc8a;};}function handleError(_0x1de803,_0x5e6582){_0x5e6582=_0x5e6582||0x1f4;return function(_0x2ac59f){logger[_0x9aa4('0x2a')](_0x2ac59f['stack']);if(_0x2ac59f[_0x9aa4('0x2b')]){delete _0x2ac59f[_0x9aa4('0x2b')];}_0x1de803[_0x9aa4('0x1d')](_0x5e6582)['send'](_0x2ac59f);};}exports[_0x9aa4('0x2c')]=function(_0x1d5d7c,_0x2af671){var _0x2d624e={},_0x42fe24={},_0x301ccd={'count':0x0,'rows':[]};var _0x3733c5=_['map'](db[_0x9aa4('0x2d')][_0x9aa4('0x2e')],function(_0x33dbde){return{'name':_0x33dbde[_0x9aa4('0x2f')],'type':_0x33dbde[_0x9aa4('0x30')][_0x9aa4('0x31')]};});_0x42fe24[_0x9aa4('0x32')]=_[_0x9aa4('0x33')](_0x3733c5,_0x9aa4('0x2b'));_0x42fe24[_0x9aa4('0x34')]=_[_0x9aa4('0x35')](_0x1d5d7c[_0x9aa4('0x34')]);_0x42fe24[_0x9aa4('0x36')]=_['intersection'](_0x42fe24[_0x9aa4('0x32')],_0x42fe24[_0x9aa4('0x34')]);_0x2d624e[_0x9aa4('0x37')]=_['intersection'](_0x42fe24[_0x9aa4('0x32')],qs['fields'](_0x1d5d7c[_0x9aa4('0x34')][_0x9aa4('0x38')]));_0x2d624e[_0x9aa4('0x37')]=_0x2d624e[_0x9aa4('0x37')][_0x9aa4('0x39')]?_0x2d624e[_0x9aa4('0x37')]:_0x42fe24['model'];if(!_0x1d5d7c[_0x9aa4('0x34')][_0x9aa4('0x3a')]('nolimit')){_0x2d624e[_0x9aa4('0x22')]=qs['limit'](_0x1d5d7c['query'][_0x9aa4('0x22')]);_0x2d624e[_0x9aa4('0x20')]=qs[_0x9aa4('0x20')](_0x1d5d7c[_0x9aa4('0x34')][_0x9aa4('0x20')]);}_0x2d624e['order']=qs[_0x9aa4('0x3b')](_0x1d5d7c[_0x9aa4('0x34')]['sort']);_0x2d624e[_0x9aa4('0x3c')]=qs[_0x9aa4('0x36')](_[_0x9aa4('0x3d')](_0x1d5d7c[_0x9aa4('0x34')],_0x42fe24['filters']),_0x3733c5);if(_0x1d5d7c['query']['filter']){_0x2d624e['where']=_[_0x9aa4('0x3e')](_0x2d624e[_0x9aa4('0x3c')],{'$or':_[_0x9aa4('0x33')](_0x3733c5,function(_0x5f3f03){if(_0x5f3f03['type']!==_0x9aa4('0x3f')){var _0x28428f={};_0x28428f[_0x5f3f03[_0x9aa4('0x2b')]]={'$like':'%'+_0x1d5d7c['query'][_0x9aa4('0x40')]+'%'};return _0x28428f;}})});}_0x2d624e=_[_0x9aa4('0x3e')]({},_0x2d624e,_0x1d5d7c['options']);var _0x3b0495={'where':_0x2d624e['where']};return db['VtigerField'][_0x9aa4('0x23')](_0x3b0495)['then'](function(_0x39feca){_0x301ccd[_0x9aa4('0x23')]=_0x39feca;if(_0x1d5d7c[_0x9aa4('0x34')][_0x9aa4('0x41')]){_0x2d624e[_0x9aa4('0x42')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2d624e);})[_0x9aa4('0x28')](function(_0x4fd393){_0x301ccd[_0x9aa4('0x43')]=_0x4fd393;return _0x301ccd;})[_0x9aa4('0x28')](respondWithFilteredResult(_0x2af671,_0x2d624e))[_0x9aa4('0x44')](handleError(_0x2af671,null));};exports[_0x9aa4('0x45')]=function(_0x261d23,_0x18133e){var _0x3c9a9c={'raw':!![],'where':{'id':_0x261d23[_0x9aa4('0x46')]['id']}},_0x3f2454={};_0x3f2454[_0x9aa4('0x32')]=_['keys'](db[_0x9aa4('0x2d')][_0x9aa4('0x2e')]);_0x3f2454[_0x9aa4('0x34')]=_[_0x9aa4('0x35')](_0x261d23['query']);_0x3f2454[_0x9aa4('0x36')]=_[_0x9aa4('0x47')](_0x3f2454['model'],_0x3f2454['query']);_0x3c9a9c['attributes']=_[_0x9aa4('0x47')](_0x3f2454[_0x9aa4('0x32')],qs['fields'](_0x261d23[_0x9aa4('0x34')][_0x9aa4('0x38')]));_0x3c9a9c['attributes']=_0x3c9a9c[_0x9aa4('0x37')][_0x9aa4('0x39')]?_0x3c9a9c[_0x9aa4('0x37')]:_0x3f2454[_0x9aa4('0x32')];if(_0x261d23[_0x9aa4('0x34')]['includeAll']){_0x3c9a9c['include']=[{'all':!![]}];}_0x3c9a9c=_[_0x9aa4('0x3e')]({},_0x3c9a9c,_0x261d23[_0x9aa4('0x48')]);return db[_0x9aa4('0x2d')][_0x9aa4('0x49')](_0x3c9a9c)[_0x9aa4('0x28')](handleEntityNotFound(_0x18133e,null))[_0x9aa4('0x28')](respondWithResult(_0x18133e,null))[_0x9aa4('0x44')](handleError(_0x18133e,null));};exports[_0x9aa4('0x4a')]=function(_0xc790f5,_0x4d7d87){return db[_0x9aa4('0x2d')][_0x9aa4('0x4a')](_0xc790f5[_0x9aa4('0x4b')],{})[_0x9aa4('0x28')](respondWithResult(_0x4d7d87,0xc9))[_0x9aa4('0x44')](handleError(_0x4d7d87,null));};exports[_0x9aa4('0x27')]=function(_0x1ffacc,_0x3edeff){if(_0x1ffacc[_0x9aa4('0x4b')]['id']){delete _0x1ffacc[_0x9aa4('0x4b')]['id'];}return db[_0x9aa4('0x2d')][_0x9aa4('0x49')]({'where':{'id':_0x1ffacc[_0x9aa4('0x46')]['id']}})['then'](handleEntityNotFound(_0x3edeff,null))[_0x9aa4('0x28')](saveUpdates(_0x1ffacc[_0x9aa4('0x4b')],null))['then'](respondWithResult(_0x3edeff,null))[_0x9aa4('0x44')](handleError(_0x3edeff,null));};exports['destroy']=function(_0x1b75f8,_0x3a6d08){return db['VtigerField'][_0x9aa4('0x49')]({'where':{'id':_0x1b75f8[_0x9aa4('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a6d08,null))[_0x9aa4('0x28')](removeEntity(_0x3a6d08,null))[_0x9aa4('0x44')](handleError(_0x3a6d08,null));}; \ No newline at end of file +var _0x4eba=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','end','error','name','index','map','VtigerField','rawAttributes','fieldName'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x4eba,0xb2));var _0xa4eb=function(_0x38ddb2,_0x1141e1){_0x38ddb2=_0x38ddb2-0x0;var _0x22ee32=_0x4eba[_0x38ddb2];return _0x22ee32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4eb('0x0'));var zipdir=require(_0xa4eb('0x1'));var jsonpatch=require(_0xa4eb('0x2'));var rp=require(_0xa4eb('0x3'));var moment=require(_0xa4eb('0x4'));var BPromise=require(_0xa4eb('0x5'));var Mustache=require(_0xa4eb('0x6'));var util=require('util');var path=require(_0xa4eb('0x7'));var sox=require(_0xa4eb('0x8'));var csv=require(_0xa4eb('0x9'));var ejs=require(_0xa4eb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4eb('0xb'));var jsforce=require(_0xa4eb('0xc'));var deskjs=require(_0xa4eb('0xd'));var toCsv=require(_0xa4eb('0x9'));var querystring=require(_0xa4eb('0xe'));var Papa=require(_0xa4eb('0xf'));var Redis=require('ioredis');var authService=require(_0xa4eb('0x10'));var qs=require(_0xa4eb('0x11'));var as=require(_0xa4eb('0x12'));var hardwareService=require(_0xa4eb('0x13'));var logger=require(_0xa4eb('0x14'))(_0xa4eb('0x15'));var utils=require('../../config/utils');var config=require(_0xa4eb('0x16'));var licenseUtil=require(_0xa4eb('0x17'));var db=require(_0xa4eb('0x18'))['db'];function respondWithStatusCode(_0x291791,_0x789b3e){_0x789b3e=_0x789b3e||0xcc;return function(_0x57d549){if(_0x57d549){return _0x291791[_0xa4eb('0x19')](_0x789b3e);}return _0x291791[_0xa4eb('0x1a')](_0x789b3e)['end']();};}function respondWithResult(_0x434b3d,_0x874f2){_0x874f2=_0x874f2||0xc8;return function(_0x55f706){if(_0x55f706){return _0x434b3d[_0xa4eb('0x1a')](_0x874f2)['json'](_0x55f706);}};}function respondWithFilteredResult(_0x388a81,_0x37f3bd){return function(_0x413a96){if(_0x413a96){var _0x4647d4=typeof _0x37f3bd[_0xa4eb('0x1b')]===_0xa4eb('0x1c')&&typeof _0x37f3bd[_0xa4eb('0x1d')]==='undefined';var _0x16ef64=_0x413a96[_0xa4eb('0x1e')];var _0x2cddbb=_0x4647d4?0x0:_0x37f3bd[_0xa4eb('0x1b')];var _0x52e7ac=_0x4647d4?_0x413a96['count']:_0x37f3bd['offset']+_0x37f3bd[_0xa4eb('0x1d')];var _0x1b4a7c;if(_0x52e7ac>=_0x16ef64){_0x52e7ac=_0x16ef64;_0x1b4a7c=0xc8;}else{_0x1b4a7c=0xce;}_0x388a81['status'](_0x1b4a7c);return _0x388a81[_0xa4eb('0x1f')](_0xa4eb('0x20'),_0x2cddbb+'-'+_0x52e7ac+'/'+_0x16ef64)[_0xa4eb('0x21')](_0x413a96);}return null;};}function patchUpdates(_0x24b5cf){return function(_0x468dbd){try{jsonpatch[_0xa4eb('0x22')](_0x468dbd,_0x24b5cf,!![]);}catch(_0x122963){return BPromise['reject'](_0x122963);}return _0x468dbd[_0xa4eb('0x23')]();};}function saveUpdates(_0x54121a,_0x543648){return function(_0x44b1a9){if(_0x44b1a9){return _0x44b1a9[_0xa4eb('0x24')](_0x54121a)['then'](function(_0x217fa2){return _0x217fa2;});}return null;};}function removeEntity(_0xc374a4,_0x1cffa5){return function(_0x5207d4){if(_0x5207d4){return _0x5207d4[_0xa4eb('0x25')]()[_0xa4eb('0x26')](function(){_0xc374a4[_0xa4eb('0x1a')](0xcc)[_0xa4eb('0x27')]();});}};}function handleEntityNotFound(_0x3998dd,_0x2b85b4){return function(_0x4b30c1){if(!_0x4b30c1){_0x3998dd[_0xa4eb('0x19')](0x194);}return _0x4b30c1;};}function handleError(_0x2b76b6,_0x273cd){_0x273cd=_0x273cd||0x1f4;return function(_0x4dfd64){logger[_0xa4eb('0x28')](_0x4dfd64['stack']);if(_0x4dfd64[_0xa4eb('0x29')]){delete _0x4dfd64[_0xa4eb('0x29')];}_0x2b76b6[_0xa4eb('0x1a')](_0x273cd)['send'](_0x4dfd64);};}exports[_0xa4eb('0x2a')]=function(_0x3f1895,_0x68a2e2){var _0x3db00a={},_0x1dda72={},_0xe55465={'count':0x0,'rows':[]};var _0x286db9=_[_0xa4eb('0x2b')](db[_0xa4eb('0x2c')][_0xa4eb('0x2d')],function(_0x103d3b){return{'name':_0x103d3b[_0xa4eb('0x2e')],'type':_0x103d3b[_0xa4eb('0x2f')]['key']};});_0x1dda72[_0xa4eb('0x30')]=_[_0xa4eb('0x2b')](_0x286db9,'name');_0x1dda72[_0xa4eb('0x31')]=_[_0xa4eb('0x32')](_0x3f1895[_0xa4eb('0x31')]);_0x1dda72[_0xa4eb('0x33')]=_[_0xa4eb('0x34')](_0x1dda72[_0xa4eb('0x30')],_0x1dda72[_0xa4eb('0x31')]);_0x3db00a[_0xa4eb('0x35')]=_[_0xa4eb('0x34')](_0x1dda72['model'],qs['fields'](_0x3f1895['query'][_0xa4eb('0x36')]));_0x3db00a[_0xa4eb('0x35')]=_0x3db00a[_0xa4eb('0x35')][_0xa4eb('0x37')]?_0x3db00a['attributes']:_0x1dda72[_0xa4eb('0x30')];if(!_0x3f1895[_0xa4eb('0x31')][_0xa4eb('0x38')]('nolimit')){_0x3db00a[_0xa4eb('0x1d')]=qs['limit'](_0x3f1895[_0xa4eb('0x31')][_0xa4eb('0x1d')]);_0x3db00a[_0xa4eb('0x1b')]=qs[_0xa4eb('0x1b')](_0x3f1895[_0xa4eb('0x31')]['offset']);}_0x3db00a[_0xa4eb('0x39')]=qs[_0xa4eb('0x3a')](_0x3f1895[_0xa4eb('0x31')]['sort']);_0x3db00a[_0xa4eb('0x3b')]=qs[_0xa4eb('0x33')](_[_0xa4eb('0x3c')](_0x3f1895[_0xa4eb('0x31')],_0x1dda72['filters']),_0x286db9);if(_0x3f1895[_0xa4eb('0x31')][_0xa4eb('0x3d')]){_0x3db00a[_0xa4eb('0x3b')]=_[_0xa4eb('0x3e')](_0x3db00a[_0xa4eb('0x3b')],{'$or':_[_0xa4eb('0x2b')](_0x286db9,function(_0x2cd071){if(_0x2cd071['type']!==_0xa4eb('0x3f')){var _0xd9fe61={};_0xd9fe61[_0x2cd071[_0xa4eb('0x29')]]={'$like':'%'+_0x3f1895[_0xa4eb('0x31')][_0xa4eb('0x3d')]+'%'};return _0xd9fe61;}})});}_0x3db00a=_['merge']({},_0x3db00a,_0x3f1895[_0xa4eb('0x40')]);var _0x21928f={'where':_0x3db00a[_0xa4eb('0x3b')]};return db[_0xa4eb('0x2c')][_0xa4eb('0x1e')](_0x21928f)[_0xa4eb('0x26')](function(_0x2c1616){_0xe55465[_0xa4eb('0x1e')]=_0x2c1616;if(_0x3f1895[_0xa4eb('0x31')][_0xa4eb('0x41')]){_0x3db00a[_0xa4eb('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0xa4eb('0x43')](_0x3db00a);})[_0xa4eb('0x26')](function(_0x5cbd91){_0xe55465[_0xa4eb('0x44')]=_0x5cbd91;return _0xe55465;})[_0xa4eb('0x26')](respondWithFilteredResult(_0x68a2e2,_0x3db00a))[_0xa4eb('0x45')](handleError(_0x68a2e2,null));};exports[_0xa4eb('0x46')]=function(_0x4e443c,_0x77c56f){var _0x36d8e8={'raw':!![],'where':{'id':_0x4e443c[_0xa4eb('0x47')]['id']}},_0x36369d={};_0x36369d['model']=_[_0xa4eb('0x32')](db[_0xa4eb('0x2c')][_0xa4eb('0x2d')]);_0x36369d[_0xa4eb('0x31')]=_[_0xa4eb('0x32')](_0x4e443c[_0xa4eb('0x31')]);_0x36369d[_0xa4eb('0x33')]=_['intersection'](_0x36369d[_0xa4eb('0x30')],_0x36369d[_0xa4eb('0x31')]);_0x36d8e8['attributes']=_[_0xa4eb('0x34')](_0x36369d[_0xa4eb('0x30')],qs['fields'](_0x4e443c[_0xa4eb('0x31')][_0xa4eb('0x36')]));_0x36d8e8[_0xa4eb('0x35')]=_0x36d8e8[_0xa4eb('0x35')][_0xa4eb('0x37')]?_0x36d8e8[_0xa4eb('0x35')]:_0x36369d[_0xa4eb('0x30')];if(_0x4e443c[_0xa4eb('0x31')]['includeAll']){_0x36d8e8[_0xa4eb('0x42')]=[{'all':!![]}];}_0x36d8e8=_[_0xa4eb('0x3e')]({},_0x36d8e8,_0x4e443c[_0xa4eb('0x40')]);return db[_0xa4eb('0x2c')]['find'](_0x36d8e8)['then'](handleEntityNotFound(_0x77c56f,null))[_0xa4eb('0x26')](respondWithResult(_0x77c56f,null))[_0xa4eb('0x45')](handleError(_0x77c56f,null));};exports[_0xa4eb('0x48')]=function(_0x58b165,_0x2332a8){return db['VtigerField'][_0xa4eb('0x48')](_0x58b165[_0xa4eb('0x49')],{})[_0xa4eb('0x26')](respondWithResult(_0x2332a8,0xc9))[_0xa4eb('0x45')](handleError(_0x2332a8,null));};exports[_0xa4eb('0x24')]=function(_0x3ebbbd,_0x410496){if(_0x3ebbbd[_0xa4eb('0x49')]['id']){delete _0x3ebbbd[_0xa4eb('0x49')]['id'];}return db[_0xa4eb('0x2c')][_0xa4eb('0x4a')]({'where':{'id':_0x3ebbbd['params']['id']}})[_0xa4eb('0x26')](handleEntityNotFound(_0x410496,null))[_0xa4eb('0x26')](saveUpdates(_0x3ebbbd[_0xa4eb('0x49')],null))[_0xa4eb('0x26')](respondWithResult(_0x410496,null))[_0xa4eb('0x45')](handleError(_0x410496,null));};exports[_0xa4eb('0x25')]=function(_0xbf2abc,_0x3254fc){return db[_0xa4eb('0x2c')][_0xa4eb('0x4a')]({'where':{'id':_0xbf2abc[_0xa4eb('0x47')]['id']}})[_0xa4eb('0x26')](handleEntityNotFound(_0x3254fc,null))[_0xa4eb('0x26')](removeEntity(_0x3254fc,null))[_0xa4eb('0x45')](handleError(_0x3254fc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0d2c262..337e407 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 _0xcfbb=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','util','../../config/logger','api','moment'];(function(_0x3da347,_0x1bafd2){var _0x3383dc=function(_0x5787ab){while(--_0x5787ab){_0x3da347['push'](_0x3da347['shift']());}};_0x3383dc(++_0x1bafd2);}(_0xcfbb,0x137));var _0xbcfb=function(_0xc68650,_0x258343){_0xc68650=_0xc68650-0x0;var _0x57bd40=_0xcfbb[_0xc68650];return _0x57bd40;};'use strict';var _=require('lodash');var util=require(_0xbcfb('0x0'));var logger=require(_0xbcfb('0x1'))(_0xbcfb('0x2'));var moment=require(_0xbcfb('0x3'));var BPromise=require(_0xbcfb('0x4'));var rp=require(_0xbcfb('0x5'));var fs=require('fs');var path=require(_0xbcfb('0x6'));var rimraf=require(_0xbcfb('0x7'));var config=require(_0xbcfb('0x8'));var attributes=require(_0xbcfb('0x9'));module['exports']=function(_0x4ebf19,_0x357955){return _0x4ebf19[_0xbcfb('0xa')](_0xbcfb('0xb'),attributes,{'tableName':_0xbcfb('0xc'),'paranoid':![],'indexes':[{'name':_0xbcfb('0xd'),'fields':['idField',_0xbcfb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9694=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9694,0x1d1));var _0x4969=function(_0x30ead6,_0x481412){_0x30ead6=_0x30ead6-0x0;var _0x7fc5aa=_0x9694[_0x30ead6];return _0x7fc5aa;};'use strict';var _=require(_0x4969('0x0'));var util=require('util');var logger=require(_0x4969('0x1'))(_0x4969('0x2'));var moment=require(_0x4969('0x3'));var BPromise=require(_0x4969('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4969('0x5'));var rimraf=require(_0x4969('0x6'));var config=require(_0x4969('0x7'));var attributes=require(_0x4969('0x8'));module[_0x4969('0x9')]=function(_0x2d86bd,_0x5f12b2){return _0x2d86bd[_0x4969('0xa')]('VtigerField',attributes,{'tableName':_0x4969('0xb'),'paranoid':![],'indexes':[{'name':_0x4969('0xc'),'fields':[_0x4969('0xd'),_0x4969('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 8556e88..9eccdf8 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 _0x47f0=['client','request','info','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5b50af,_0x432375){var _0x386b39=function(_0x215c94){while(--_0x215c94){_0x5b50af['push'](_0x5b50af['shift']());}};_0x386b39(++_0x432375);}(_0x47f0,0xe7));var _0x047f=function(_0x45e5f2,_0xc803d0){_0x45e5f2=_0x45e5f2-0x0;var _0x333b0a=_0x47f0[_0x45e5f2];return _0x333b0a;};'use strict';var _=require(_0x047f('0x0'));var util=require(_0x047f('0x1'));var moment=require(_0x047f('0x2'));var BPromise=require(_0x047f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x047f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x047f('0x5'));var logger=require('../../config/logger')(_0x047f('0x6'));var config=require(_0x047f('0x7'));var jayson=require(_0x047f('0x8'));var client=jayson[_0x047f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280c20,_0x2bcdee,_0x3b2cb6){return new BPromise(function(_0x2ee25d,_0x51f499){return client[_0x047f('0xa')](_0x280c20,_0x3b2cb6)['then'](function(_0x5e6439){logger[_0x047f('0xb')]('VtigerField,\x20%s,\x20%s',_0x2bcdee,'request\x20sent');logger['debug'](_0x047f('0xc'),_0x2bcdee,_0x047f('0xd'),JSON[_0x047f('0xe')](_0x5e6439));if(_0x5e6439[_0x047f('0xf')]){if(_0x5e6439['error']['code']===0x1f4){logger[_0x047f('0xf')](_0x047f('0x10'),_0x2bcdee,_0x5e6439[_0x047f('0xf')][_0x047f('0x11')]);return _0x51f499(_0x5e6439[_0x047f('0xf')]['message']);}logger[_0x047f('0xf')](_0x047f('0x10'),_0x2bcdee,_0x5e6439[_0x047f('0xf')][_0x047f('0x11')]);return _0x2ee25d(_0x5e6439[_0x047f('0xf')][_0x047f('0x11')]);}else{logger['info'](_0x047f('0x10'),_0x2bcdee,_0x047f('0xd'));_0x2ee25d(_0x5e6439[_0x047f('0x12')][_0x047f('0x11')]);}})[_0x047f('0x13')](function(_0x1cad4b){logger[_0x047f('0xf')]('VtigerField,\x20%s,\x20%s',_0x2bcdee,_0x1cad4b);_0x51f499(_0x1cad4b);});});} \ No newline at end of file +var _0x2aa6=['client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x418c9a,_0x5d2554){var _0x136017=function(_0xca2b2d){while(--_0xca2b2d){_0x418c9a['push'](_0x418c9a['shift']());}};_0x136017(++_0x5d2554);}(_0x2aa6,0x142));var _0x62aa=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x2aa6[_0x287a47];return _0x3fb726;};'use strict';var _=require(_0x62aa('0x0'));var util=require('util');var moment=require(_0x62aa('0x1'));var BPromise=require('bluebird');var rs=require(_0x62aa('0x2'));var fs=require('fs');var Redis=require(_0x62aa('0x3'));var db=require(_0x62aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x62aa('0x5'))(_0x62aa('0x6'));var config=require(_0x62aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x62aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2404ec,_0x3506bc,_0x58e852){return new BPromise(function(_0x322951,_0x55a5ff){return client[_0x62aa('0x9')](_0x2404ec,_0x58e852)[_0x62aa('0xa')](function(_0xa8abb5){logger[_0x62aa('0xb')](_0x62aa('0xc'),_0x3506bc,_0x62aa('0xd'));logger[_0x62aa('0xe')](_0x62aa('0xf'),_0x3506bc,_0x62aa('0xd'),JSON[_0x62aa('0x10')](_0xa8abb5));if(_0xa8abb5[_0x62aa('0x11')]){if(_0xa8abb5['error'][_0x62aa('0x12')]===0x1f4){logger[_0x62aa('0x11')](_0x62aa('0xc'),_0x3506bc,_0xa8abb5[_0x62aa('0x11')][_0x62aa('0x13')]);return _0x55a5ff(_0xa8abb5[_0x62aa('0x11')][_0x62aa('0x13')]);}logger[_0x62aa('0x11')](_0x62aa('0xc'),_0x3506bc,_0xa8abb5[_0x62aa('0x11')][_0x62aa('0x13')]);return _0x322951(_0xa8abb5[_0x62aa('0x11')][_0x62aa('0x13')]);}else{logger[_0x62aa('0xb')](_0x62aa('0xc'),_0x3506bc,_0x62aa('0xd'));_0x322951(_0xa8abb5[_0x62aa('0x14')]['message']);}})[_0x62aa('0x15')](function(_0xa5e6c8){logger[_0x62aa('0x11')]('VtigerField,\x20%s,\x20%s',_0x3506bc,_0xa5e6c8);_0x55a5ff(_0xa5e6c8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5b6b759..9d41862 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 _0xd9d6=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x5c002b,_0x3ca3a9){var _0x1ce73b=function(_0x22275d){while(--_0x22275d){_0x5c002b['push'](_0x5c002b['shift']());}};_0x1ce73b(++_0x3ca3a9);}(_0xd9d6,0x19c));var _0x6d9d=function(_0x120c03,_0x1a8eab){_0x120c03=_0x120c03-0x0;var _0x2f04a8=_0xd9d6[_0x120c03];return _0x2f04a8;};'use strict';var multer=require(_0x6d9d('0x0'));var util=require(_0x6d9d('0x1'));var path=require('path');var timeout=require(_0x6d9d('0x2'));var express=require(_0x6d9d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d9d('0x4'));var config=require(_0x6d9d('0x5'));var controller=require(_0x6d9d('0x6'));router[_0x6d9d('0x7')]('/',auth[_0x6d9d('0x8')](),controller[_0x6d9d('0x9')]);router['get'](_0x6d9d('0xa'),auth[_0x6d9d('0x8')](),controller[_0x6d9d('0xb')]);router[_0x6d9d('0x7')](_0x6d9d('0xc'),auth['isAuthenticated'](),controller[_0x6d9d('0xd')]);router['get'](_0x6d9d('0xe'),auth[_0x6d9d('0x8')](),controller[_0x6d9d('0xf')]);router[_0x6d9d('0x10')]('/',auth['isAuthenticated'](),controller[_0x6d9d('0x11')]);router[_0x6d9d('0x10')](_0x6d9d('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6d9d('0x12')](_0x6d9d('0xa'),auth['isAuthenticated'](),controller[_0x6d9d('0x13')]);router[_0x6d9d('0x14')]('/:id',auth[_0x6d9d('0x8')](),controller['destroy']);module[_0x6d9d('0x15')]=router; \ No newline at end of file +var _0x7044=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports'];(function(_0xc020c7,_0x473420){var _0x115a85=function(_0x43dd31){while(--_0x43dd31){_0xc020c7['push'](_0xc020c7['shift']());}};_0x115a85(++_0x473420);}(_0x7044,0x1ce));var _0x4704=function(_0x135d59,_0x3f9233){_0x135d59=_0x135d59-0x0;var _0xe7e1ab=_0x7044[_0x135d59];return _0xe7e1ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4704('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4704('0x1')]();var fs_extra=require(_0x4704('0x2'));var auth=require(_0x4704('0x3'));var interaction=require(_0x4704('0x4'));var config=require(_0x4704('0x5'));var controller=require(_0x4704('0x6'));router[_0x4704('0x7')]('/',auth['isAuthenticated'](),controller[_0x4704('0x8')]);router[_0x4704('0x7')](_0x4704('0x9'),auth[_0x4704('0xa')](),controller['show']);router[_0x4704('0x7')](_0x4704('0xb'),auth['isAuthenticated'](),controller[_0x4704('0xc')]);router[_0x4704('0x7')](_0x4704('0xd'),auth['isAuthenticated'](),controller[_0x4704('0xe')]);router[_0x4704('0xf')]('/',auth[_0x4704('0xa')](),controller[_0x4704('0x10')]);router['post'](_0x4704('0xb'),auth[_0x4704('0xa')](),controller[_0x4704('0x11')]);router['put']('/:id',auth[_0x4704('0xa')](),controller[_0x4704('0x12')]);router['delete']('/:id',auth[_0x4704('0xa')](),controller[_0x4704('0x13')]);module[_0x4704('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 332d982..9e16cf1 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 _0xc43c=['password','token','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x189796,_0x2ad6b2){var _0x1936f7=function(_0x31b704){while(--_0x31b704){_0x189796['push'](_0x189796['shift']());}};_0x1936f7(++_0x2ad6b2);}(_0xc43c,0xd4));var _0xcc43=function(_0x4c5e87,_0xe807b2){_0x4c5e87=_0x4c5e87-0x0;var _0x31f67c=_0xc43c[_0x4c5e87];return _0x31f67c;};'use strict';var Sequelize=require(_0xcc43('0x0'));module[_0xcc43('0x1')]={'name':{'type':Sequelize[_0xcc43('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xcc43('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xcc43('0x3')](_0xcc43('0x4'),_0xcc43('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xcc43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc43('0x3')](_0xcc43('0x6'),_0xcc43('0x7')),'defaultValue':_0xcc43('0x6')}}; \ No newline at end of file +var _0x9ab8=['token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0x255327,_0x58659b){var _0x25840a=function(_0xa088ad){while(--_0xa088ad){_0x255327['push'](_0x255327['shift']());}};_0x25840a(++_0x58659b);}(_0x9ab8,0x81));var _0x89ab=function(_0x348636,_0x165f7a){_0x348636=_0x348636-0x0;var _0x43206f=_0x9ab8[_0x348636];return _0x43206f;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x89ab('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x89ab('0x2')]},'remoteUri':{'type':Sequelize[_0x89ab('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x5'),_0x89ab('0x6')),'defaultValue':_0x89ab('0x5')},'serverUrl':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x7'),_0x89ab('0x8')),'defaultValue':_0x89ab('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e8e82f9..8445423 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 _0xa902=['%s:%s','base64','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','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','offset','undefined','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','sort','map','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','findOne','username','password','remoteUri','slice','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s'];(function(_0x5e4e3b,_0x411edc){var _0x1bb015=function(_0x458438){while(--_0x458438){_0x5e4e3b['push'](_0x5e4e3b['shift']());}};_0x1bb015(++_0x411edc);}(_0xa902,0x8d));var _0x2a90=function(_0x524f4a,_0x49d5a2){_0x524f4a=_0x524f4a-0x0;var _0x417848=_0xa902[_0x524f4a];return _0x417848;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f6953,_0x57aee3){_0x57aee3=_0x57aee3||0xcc;return function(_0x407ce5){if(_0x407ce5){return _0x1f6953[_0x2a90('0x17')](_0x57aee3);}return _0x1f6953[_0x2a90('0x18')](_0x57aee3)['end']();};}function respondWithResult(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xc8;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x18')](_0x57227c)['json'](_0x46cb32);}};}function respondWithFilteredResult(_0x1ff63d,_0x21c648){return function(_0x312782){if(_0x312782){var _0x25bd0e=typeof _0x21c648[_0x2a90('0x19')]===_0x2a90('0x1a')&&typeof _0x21c648[_0x2a90('0x1b')]===_0x2a90('0x1a');var _0x43eea5=_0x312782['count'];var _0x162f0b=_0x25bd0e?0x0:_0x21c648[_0x2a90('0x19')];var _0x4190ff=_0x25bd0e?_0x312782['count']:_0x21c648[_0x2a90('0x19')]+_0x21c648[_0x2a90('0x1b')];var _0x148d18;if(_0x4190ff>=_0x43eea5){_0x4190ff=_0x43eea5;_0x148d18=0xc8;}else{_0x148d18=0xce;}_0x1ff63d[_0x2a90('0x18')](_0x148d18);return _0x1ff63d[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x162f0b+'-'+_0x4190ff+'/'+_0x43eea5)[_0x2a90('0x1e')](_0x312782);}return null;};}function patchUpdates(_0x114d42){return function(_0xf97adb){try{jsonpatch[_0x2a90('0x1f')](_0xf97adb,_0x114d42,!![]);}catch(_0x1340b9){return BPromise[_0x2a90('0x20')](_0x1340b9);}return _0xf97adb['save']();};}function saveUpdates(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x21')](_0x3da7d0)['then'](function(_0x180485){return _0x180485;});}return null;};}function removeEntity(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(_0x1bcfd7){return _0x1bcfd7[_0x2a90('0x22')]()[_0x2a90('0x23')](function(){_0xd033d[_0x2a90('0x18')](0xcc)[_0x2a90('0x24')]();});}};}function handleEntityNotFound(_0x1303d9,_0x29ed73){return function(_0x24a6d3){if(!_0x24a6d3){_0x1303d9['sendStatus'](0x194);}return _0x24a6d3;};}function handleError(_0x27f883,_0x17f978){_0x17f978=_0x17f978||0x1f4;return function(_0x3934d4){logger[_0x2a90('0x25')](_0x3934d4[_0x2a90('0x26')]);if(_0x3934d4['name']){delete _0x3934d4['name'];}_0x27f883[_0x2a90('0x18')](_0x17f978)['send'](_0x3934d4);};}exports['index']=function(_0x4969c3,_0x2d83b3){var _0x3c78f5={},_0x595638={},_0x5bd700={'count':0x0,'rows':[]};var _0x1add9a=_['map'](db[_0x2a90('0x27')][_0x2a90('0x28')],function(_0x3b580f){return{'name':_0x3b580f[_0x2a90('0x29')],'type':_0x3b580f[_0x2a90('0x2a')][_0x2a90('0x2b')]};});_0x595638[_0x2a90('0x2c')]=_['map'](_0x1add9a,_0x2a90('0x2d'));_0x595638[_0x2a90('0x2e')]=_[_0x2a90('0x2f')](_0x4969c3['query']);_0x595638[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],_0x595638[_0x2a90('0x2e')]);_0x3c78f5['attributes']=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],qs[_0x2a90('0x32')](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x3c78f5[_0x2a90('0x33')]=_0x3c78f5['attributes'][_0x2a90('0x34')]?_0x3c78f5[_0x2a90('0x33')]:_0x595638[_0x2a90('0x2c')];if(!_0x4969c3[_0x2a90('0x2e')]['hasOwnProperty'](_0x2a90('0x35'))){_0x3c78f5[_0x2a90('0x1b')]=qs['limit'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x1b')]);_0x3c78f5['offset']=qs['offset'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x19')]);}_0x3c78f5[_0x2a90('0x36')]=qs['sort'](_0x4969c3[_0x2a90('0x2e')]['sort']);_0x3c78f5[_0x2a90('0x37')]=qs['filters'](_[_0x2a90('0x38')](_0x4969c3['query'],_0x595638['filters']),_0x1add9a);if(_0x4969c3[_0x2a90('0x2e')]['filter']){_0x3c78f5[_0x2a90('0x37')]=_[_0x2a90('0x39')](_0x3c78f5[_0x2a90('0x37')],{'$or':_['map'](_0x1add9a,function(_0x57a2a5){if(_0x57a2a5[_0x2a90('0x2a')]!==_0x2a90('0x3a')){var _0x4eb7d9={};_0x4eb7d9[_0x57a2a5[_0x2a90('0x2d')]]={'$like':'%'+_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x4eb7d9;}})});}_0x3c78f5=_['merge']({},_0x3c78f5,_0x4969c3[_0x2a90('0x3c')]);var _0x1db9d8={'where':_0x3c78f5['where']};return db[_0x2a90('0x27')][_0x2a90('0x3d')](_0x1db9d8)[_0x2a90('0x23')](function(_0x28f289){_0x5bd700[_0x2a90('0x3d')]=_0x28f289;if(_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x3c78f5[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x27')][_0x2a90('0x40')](_0x3c78f5);})[_0x2a90('0x23')](function(_0x3dba8a){_0x5bd700[_0x2a90('0x41')]=_0x3dba8a;return _0x5bd700;})[_0x2a90('0x23')](respondWithFilteredResult(_0x2d83b3,_0x3c78f5))['catch'](handleError(_0x2d83b3,null));};exports[_0x2a90('0x42')]=function(_0x3a70fe,_0x528b41){var _0x1045bb={'raw':![],'where':{'id':_0x3a70fe[_0x2a90('0x43')]['id']}},_0x1e971c={};_0x1e971c[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskAccount'][_0x2a90('0x28')]);_0x1e971c['query']=_[_0x2a90('0x2f')](_0x3a70fe['query']);_0x1e971c[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],_0x1e971c[_0x2a90('0x2e')]);_0x1045bb[_0x2a90('0x33')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],qs['fields'](_0x3a70fe['query'][_0x2a90('0x32')]));_0x1045bb[_0x2a90('0x33')]=_0x1045bb[_0x2a90('0x33')][_0x2a90('0x34')]?_0x1045bb[_0x2a90('0x33')]:_0x1e971c[_0x2a90('0x2c')];if(_0x3a70fe[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x1045bb['include']=[{'all':!![]}];}_0x1045bb=_[_0x2a90('0x39')]({},_0x1045bb,_0x3a70fe['options']);return db[_0x2a90('0x27')][_0x2a90('0x44')](_0x1045bb)['then'](handleEntityNotFound(_0x528b41,null))[_0x2a90('0x23')](respondWithResult(_0x528b41,null))[_0x2a90('0x45')](handleError(_0x528b41,null));};exports[_0x2a90('0x46')]=function(_0x1d55db,_0x175d59){return db[_0x2a90('0x27')][_0x2a90('0x46')](_0x1d55db['body'],{})['then'](respondWithResult(_0x175d59,0xc9))[_0x2a90('0x45')](handleError(_0x175d59,null));};exports[_0x2a90('0x21')]=function(_0x42c890,_0x43266a){if(_0x42c890[_0x2a90('0x47')]['id']){delete _0x42c890['body']['id'];}return db['ZendeskAccount'][_0x2a90('0x44')]({'where':{'id':_0x42c890[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x43266a,null))['then'](saveUpdates(_0x42c890['body'],null))[_0x2a90('0x23')](respondWithResult(_0x43266a,null))['catch'](handleError(_0x43266a,null));};exports[_0x2a90('0x22')]=function(_0x3dfe72,_0x272d07){return db[_0x2a90('0x27')][_0x2a90('0x44')]({'where':{'id':_0x3dfe72[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x272d07,null))[_0x2a90('0x23')](removeEntity(_0x272d07,null))[_0x2a90('0x45')](handleError(_0x272d07,null));};exports['getConfigurations']=function(_0x265769,_0x4d1303,_0x4c8bae){var _0x46f687={};var _0xe47c6b={};var _0x5819ab;var _0x4c0cb2;return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0x265769[_0x2a90('0x43')]['id']}})[_0x2a90('0x23')](handleEntityNotFound(_0x4d1303,null))['then'](function(_0x366429){if(_0x366429){_0x5819ab=_0x366429;_0xe47c6b[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskConfiguration'][_0x2a90('0x28')]);_0xe47c6b[_0x2a90('0x2e')]=_['keys'](_0x265769['query']);_0xe47c6b[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0xe47c6b['model'],_0xe47c6b[_0x2a90('0x2e')]);_0x46f687['attributes']=_[_0x2a90('0x31')](_0xe47c6b['model'],qs[_0x2a90('0x32')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x46f687['attributes']=_0x46f687['attributes']['length']?_0x46f687[_0x2a90('0x33')]:_0xe47c6b[_0x2a90('0x2c')];_0x46f687[_0x2a90('0x36')]=qs[_0x2a90('0x48')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x48')]);_0x46f687[_0x2a90('0x37')]=qs[_0x2a90('0x30')](_[_0x2a90('0x38')](_0x265769[_0x2a90('0x2e')],_0xe47c6b[_0x2a90('0x30')]));if(_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]){_0x46f687['where']=_['merge'](_0x46f687['where'],{'$or':_[_0x2a90('0x49')](_0x46f687[_0x2a90('0x33')],function(_0x13270d){var _0x400aca={};_0x400aca[_0x13270d]={'$like':'%'+_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x400aca;})});}_0x46f687=_[_0x2a90('0x39')]({},_0x46f687,_0x265769[_0x2a90('0x3c')]);return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x50973b){if(_0x50973b){_0x4c0cb2=_0x50973b[_0x2a90('0x34')];if(!_0x265769[_0x2a90('0x2e')][_0x2a90('0x4b')](_0x2a90('0x35'))){_0x46f687[_0x2a90('0x1b')]=qs['limit'](_0x265769[_0x2a90('0x2e')]['limit']);_0x46f687[_0x2a90('0x19')]=qs[_0x2a90('0x19')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x19')]);}return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x44b211){if(_0x44b211){return _0x44b211?{'count':_0x4c0cb2,'rows':_0x44b211}:null;}})['then'](respondWithResult(_0x4d1303,null))[_0x2a90('0x45')](handleError(_0x4d1303,null));};exports[_0x2a90('0x4c')]=function(_0xf88bbb,_0x48f9fa,_0xa1234a){if(_0xf88bbb[_0x2a90('0x47')]['id']){delete _0xf88bbb[_0x2a90('0x47')]['id'];}return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0xf88bbb[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f9fa,null))[_0x2a90('0x23')](function(_0x94e9fb){if(_0x94e9fb){_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4d')]=_0x94e9fb['id'];_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4e')]=integrations['getSubjects'](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x2a')]);_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x50')]=integrations[_0x2a90('0x51')](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb['body'][_0x2a90('0x2a')]);return db[_0x2a90('0x52')][_0x2a90('0x46')](_0xf88bbb['body'],{'include':[{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x4e')},{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x50')}]});}return null;})[_0x2a90('0x23')](respondWithResult(_0x48f9fa,null))['catch'](handleError(_0x48f9fa,null));};exports[_0x2a90('0x54')]=function(_0x5e0bf2,_0x5a770b,_0x9fafd){var _0x4e1dcd='';return db['ZendeskAccount'][_0x2a90('0x55')]({'where':{'id':_0x5e0bf2['params']['id']},'attributes':['id',_0x2a90('0x56'),_0x2a90('0x57'),'token','authType',_0x2a90('0x58')]})['then'](handleEntityNotFound(_0x5a770b,null))['then'](function(_0xd52ae2){if(_0xd52ae2){_0x4e1dcd=_0xd52ae2[_0x2a90('0x58')];var _0x1db063=_0x4e1dcd[_0x2a90('0x59')](-0x1);if(_0x1db063==='/'){_0x4e1dcd=_0x4e1dcd['substring'](0x0,_0x4e1dcd['lastIndexOf'](_0x1db063));}var _0x370144={'method':_0x2a90('0x5a'),'uri':util[_0x2a90('0x5b')](_0x2a90('0x5c'),_0x4e1dcd,_0x2a90('0x5d')),'json':!![]};switch(_0xd52ae2[_0x2a90('0x5e')]){case _0x2a90('0x57'):_0x370144[_0x2a90('0x5f')]={'Authorization':util[_0x2a90('0x5b')](_0x2a90('0x60'),new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x61'),_0xd52ae2['username'],_0xd52ae2[_0x2a90('0x57')]))['toString'](_0x2a90('0x62')))};break;case'token':_0x370144[_0x2a90('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x63'),_0xd52ae2[_0x2a90('0x56')],_0xd52ae2[_0x2a90('0x64')]))['toString']('base64'))};break;default:throw new db[(_0x2a90('0x65'))][(_0x2a90('0x66'))](_0x2a90('0x67'));}return rp(_0x370144);}})[_0x2a90('0x23')](function(_0x59b9e6){if(_0x59b9e6){var _0x3b0d5e=[_0x2a90('0x68'),_0x2a90('0x69'),_0x2a90('0x6a'),_0x2a90('0x6b')];_[_0x2a90('0x6c')](_0x59b9e6[_0x2a90('0x5d')],function(_0x4d46f5){return _0x3b0d5e[_0x2a90('0x6d')](_0x4d46f5[_0x2a90('0x2a')]);});return{'count':_0x59b9e6[_0x2a90('0x5d')][_0x2a90('0x34')],'rows':_[_0x2a90('0x49')](_0x59b9e6[_0x2a90('0x5d')],function(_0x1bbadd){return{'id':_0x1bbadd['id'],'name':_0x1bbadd[_0x2a90('0x6e')]>0x7?_0x1bbadd['title']:_0x1bbadd[_0x2a90('0x2a')],'custom':_0x1bbadd[_0x2a90('0x6e')]>0x7?!![]:![],'options':_0x1bbadd['system_field_options']?_0x1bbadd[_0x2a90('0x6f')]:_0x1bbadd[_0x2a90('0x70')]?_0x1bbadd[_0x2a90('0x70')]:[]};})};}})[_0x2a90('0x23')](respondWithResult(_0x5a770b,null))[_0x2a90('0x45')](function(_0x16e9e7){var _0x4b4a47=_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?0x1f4:_0x16e9e7[_0x2a90('0x72')]||0x1f4;logger[_0x2a90('0x25')](_0x2a90('0x73'),_0x2a90('0x54'),_0x4b4a47,JSON[_0x2a90('0x74')](_0x16e9e7));delete _0x16e9e7[_0x2a90('0x2d')];if(_0x4b4a47===0x191){_0x4b4a47=0x190;}_0x5a770b['status'](_0x4b4a47)[_0x2a90('0x75')](_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?{'message':_0x2a90('0x76'),'statusCode':_0x16e9e7[_0x2a90('0x72')]}:_0x16e9e7);});}; \ No newline at end of file +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2178b8,_0x1a43e3){_0x2178b8=_0x2178b8-0x0;var _0x20ee0b=_0xbc9d[_0x2178b8];return _0x20ee0b;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5fd41ef..a520547 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 _0x7ab8=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x380643,_0x473b02){var _0x2ebc30=function(_0x1c77d6){while(--_0x1c77d6){_0x380643['push'](_0x380643['shift']());}};_0x2ebc30(++_0x473b02);}(_0x7ab8,0x1ef));var _0x87ab=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7ab8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x87ab('0x0'));var util=require(_0x87ab('0x1'));var logger=require('../../config/logger')(_0x87ab('0x2'));var moment=require(_0x87ab('0x3'));var BPromise=require(_0x87ab('0x4'));var rp=require(_0x87ab('0x5'));var fs=require('fs');var path=require(_0x87ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87ab('0x7'));var integrations=require(_0x87ab('0x8'));module['exports']=function(_0x1b501d,_0x36c213){return _0x1b501d[_0x87ab('0x9')](_0x87ab('0xa'),attributes,{'tableName':_0x87ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b13=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x34a39d,_0x3b477f){var _0x57edfe=function(_0x201083){while(--_0x201083){_0x34a39d['push'](_0x34a39d['shift']());}};_0x57edfe(++_0x3b477f);}(_0x6b13,0x98));var _0x36b1=function(_0x365a40,_0x5c073e){_0x365a40=_0x365a40-0x0;var _0x1dd6d5=_0x6b13[_0x365a40];return _0x1dd6d5;};'use strict';var _=require(_0x36b1('0x0'));var util=require(_0x36b1('0x1'));var logger=require(_0x36b1('0x2'))(_0x36b1('0x3'));var moment=require(_0x36b1('0x4'));var BPromise=require(_0x36b1('0x5'));var rp=require(_0x36b1('0x6'));var fs=require('fs');var path=require(_0x36b1('0x7'));var rimraf=require(_0x36b1('0x8'));var config=require(_0x36b1('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x36b1('0xa'));module['exports']=function(_0x67bb74,_0x175682){return _0x67bb74[_0x36b1('0xb')](_0x36b1('0xc'),attributes,{'tableName':_0x36b1('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 b883a79..89412c5 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 _0x6239=['code','message','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','model','map','ShowZendeskAccount','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0x6239,0x164));var _0x9623=function(_0x3ecaed,_0x6a02f6){_0x3ecaed=_0x3ecaed-0x0;var _0x5906b7=_0x6239[_0x3ecaed];return _0x5906b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9623('0x0'));var BPromise=require(_0x9623('0x1'));var rs=require(_0x9623('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9623('0x3'));var logger=require(_0x9623('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9623('0x5')][_0x9623('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c9f30,_0xfba22e,_0x23a5d7){return new BPromise(function(_0x3aa61e,_0x1918b8){return client[_0x9623('0x7')](_0x3c9f30,_0x23a5d7)[_0x9623('0x8')](function(_0x2861cf){logger[_0x9623('0x9')](_0x9623('0xa'),_0xfba22e,'request\x20sent');logger[_0x9623('0xb')](_0x9623('0xc'),_0xfba22e,_0x9623('0xd'),JSON[_0x9623('0xe')](_0x2861cf));if(_0x2861cf[_0x9623('0xf')]){if(_0x2861cf['error'][_0x9623('0x10')]===0x1f4){logger[_0x9623('0xf')](_0x9623('0xa'),_0xfba22e,_0x2861cf['error']['message']);return _0x1918b8(_0x2861cf[_0x9623('0xf')]['message']);}logger[_0x9623('0xf')](_0x9623('0xa'),_0xfba22e,_0x2861cf['error']['message']);return _0x3aa61e(_0x2861cf[_0x9623('0xf')][_0x9623('0x11')]);}else{logger[_0x9623('0x9')]('ZendeskAccount,\x20%s,\x20%s',_0xfba22e,'request\x20sent');_0x3aa61e(_0x2861cf['result']['message']);}})[_0x9623('0x12')](function(_0x45996c){logger[_0x9623('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0xfba22e,_0x45996c);_0x1918b8(_0x45996c);});});}exports[_0x9623('0x13')]=function(_0x2a5ce1){var _0x2ffed2=this;return new Promise(function(_0x28f551,_0x26eba9){return db[_0x9623('0x14')]['findAll']({'raw':_0x2a5ce1[_0x9623('0x15')]?_0x2a5ce1[_0x9623('0x15')][_0x9623('0x16')]===undefined?!![]:![]:!![],'where':_0x2a5ce1[_0x9623('0x15')]?_0x2a5ce1[_0x9623('0x15')][_0x9623('0x17')]||null:null,'attributes':_0x2a5ce1[_0x9623('0x15')]?_0x2a5ce1[_0x9623('0x15')][_0x9623('0x18')]||null:null,'limit':_0x2a5ce1[_0x9623('0x15')]?_0x2a5ce1[_0x9623('0x15')][_0x9623('0x19')]||null:null,'include':_0x2a5ce1[_0x9623('0x15')]?_0x2a5ce1[_0x9623('0x15')][_0x9623('0x1a')]?_['map'](_0x2a5ce1[_0x9623('0x15')]['include'],function(_0xdb40f0){return{'model':db[_0xdb40f0[_0x9623('0x1b')]],'as':_0xdb40f0['as'],'attributes':_0xdb40f0[_0x9623('0x18')],'include':_0xdb40f0[_0x9623('0x1a')]?_[_0x9623('0x1c')](_0xdb40f0[_0x9623('0x1a')],function(_0x3d8bad){return{'model':db[_0x3d8bad[_0x9623('0x1b')]],'as':_0x3d8bad['as'],'attributes':_0x3d8bad[_0x9623('0x18')],'include':_0x3d8bad[_0x9623('0x1a')]?_[_0x9623('0x1c')](_0x3d8bad[_0x9623('0x1a')],function(_0x4c081f){return{'model':db[_0x4c081f[_0x9623('0x1b')]],'as':_0x4c081f['as'],'attributes':_0x4c081f[_0x9623('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x330b9e){logger[_0x9623('0x9')]('GetZendeskAccount',_0x2a5ce1);logger[_0x9623('0xb')](_0x9623('0x13'),_0x2a5ce1,JSON[_0x9623('0xe')](_0x330b9e));_0x28f551(_0x330b9e);})[_0x9623('0x12')](function(_0x5124f5){logger[_0x9623('0xf')](_0x9623('0x13'),_0x5124f5[_0x9623('0x11')],_0x2a5ce1);_0x26eba9(_0x2ffed2[_0x9623('0xf')](0x1f4,_0x5124f5['message']));});});};exports[_0x9623('0x1d')]=function(_0x480774){var _0x505e2d=this;return new Promise(function(_0xfd4336,_0x9e5069){return db['ZendeskAccount'][_0x9623('0x1e')]({'raw':_0x480774[_0x9623('0x15')]?_0x480774[_0x9623('0x15')][_0x9623('0x16')]===undefined?!![]:![]:!![],'where':_0x480774['options']?_0x480774[_0x9623('0x15')]['where']||null:null,'attributes':_0x480774[_0x9623('0x15')]?_0x480774[_0x9623('0x15')][_0x9623('0x18')]||null:null,'include':_0x480774['options']?_0x480774[_0x9623('0x15')]['include']?_[_0x9623('0x1c')](_0x480774[_0x9623('0x15')][_0x9623('0x1a')],function(_0x134f65){return{'model':db[_0x134f65[_0x9623('0x1b')]],'as':_0x134f65['as'],'attributes':_0x134f65[_0x9623('0x18')],'include':_0x134f65[_0x9623('0x1a')]?_[_0x9623('0x1c')](_0x134f65[_0x9623('0x1a')],function(_0x418b37){return{'model':db[_0x418b37[_0x9623('0x1b')]],'as':_0x418b37['as'],'attributes':_0x418b37[_0x9623('0x18')],'include':_0x418b37['include']?_[_0x9623('0x1c')](_0x418b37[_0x9623('0x1a')],function(_0x362917){return{'model':db[_0x362917[_0x9623('0x1b')]],'as':_0x362917['as'],'attributes':_0x362917[_0x9623('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9623('0x8')](function(_0x29a34c){logger[_0x9623('0x9')]('ShowZendeskAccount',_0x480774);logger['debug'](_0x9623('0x1d'),_0x480774,JSON[_0x9623('0xe')](_0x29a34c));_0xfd4336(_0x29a34c);})[_0x9623('0x12')](function(_0x300e37){logger[_0x9623('0xf')](_0x9623('0x1d'),_0x300e37['message'],_0x480774);_0x9e5069(_0x505e2d[_0x9623('0xf')](0x1f4,_0x300e37[_0x9623('0x11')]));});});}; \ No newline at end of file +var _0x40c9=['jayson/promise','client','http','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','debug','catch','ShowZendeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x37e10e,_0x5e7e11){var _0x340eba=function(_0x20b210){while(--_0x20b210){_0x37e10e['push'](_0x37e10e['shift']());}};_0x340eba(++_0x5e7e11);}(_0x40c9,0xbf));var _0x940c=function(_0x426bc5,_0x45c990){_0x426bc5=_0x426bc5-0x0;var _0x113458=_0x40c9[_0x426bc5];return _0x113458;};'use strict';var _=require(_0x940c('0x0'));var util=require(_0x940c('0x1'));var moment=require('moment');var BPromise=require(_0x940c('0x2'));var rs=require(_0x940c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x940c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x940c('0x5'));var config=require(_0x940c('0x6'));var jayson=require(_0x940c('0x7'));var client=jayson[_0x940c('0x8')][_0x940c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4843ab,_0x3b777c,_0x1088dc){return new BPromise(function(_0x11a0ae,_0x945388){return client['request'](_0x4843ab,_0x1088dc)['then'](function(_0x1f5fc1){logger['info'](_0x940c('0xa'),_0x3b777c,_0x940c('0xb'));logger['debug'](_0x940c('0xc'),_0x3b777c,_0x940c('0xb'),JSON[_0x940c('0xd')](_0x1f5fc1));if(_0x1f5fc1[_0x940c('0xe')]){if(_0x1f5fc1[_0x940c('0xe')][_0x940c('0xf')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3b777c,_0x1f5fc1[_0x940c('0xe')]['message']);return _0x945388(_0x1f5fc1[_0x940c('0xe')][_0x940c('0x10')]);}logger[_0x940c('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x3b777c,_0x1f5fc1['error']['message']);return _0x11a0ae(_0x1f5fc1[_0x940c('0xe')][_0x940c('0x10')]);}else{logger[_0x940c('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x3b777c,_0x940c('0xb'));_0x11a0ae(_0x1f5fc1['result']['message']);}})['catch'](function(_0x15e45e){logger[_0x940c('0xe')](_0x940c('0xa'),_0x3b777c,_0x15e45e);_0x945388(_0x15e45e);});});}exports[_0x940c('0x12')]=function(_0x2bd11d){var _0x1b0b85=this;return new Promise(function(_0x20a8f2,_0x14df35){return db[_0x940c('0x13')][_0x940c('0x14')]({'raw':_0x2bd11d[_0x940c('0x15')]?_0x2bd11d[_0x940c('0x15')][_0x940c('0x16')]===undefined?!![]:![]:!![],'where':_0x2bd11d['options']?_0x2bd11d[_0x940c('0x15')]['where']||null:null,'attributes':_0x2bd11d[_0x940c('0x15')]?_0x2bd11d['options'][_0x940c('0x17')]||null:null,'limit':_0x2bd11d['options']?_0x2bd11d[_0x940c('0x15')][_0x940c('0x18')]||null:null,'include':_0x2bd11d[_0x940c('0x15')]?_0x2bd11d[_0x940c('0x15')][_0x940c('0x19')]?_['map'](_0x2bd11d[_0x940c('0x15')][_0x940c('0x19')],function(_0x35ab71){return{'model':db[_0x35ab71[_0x940c('0x1a')]],'as':_0x35ab71['as'],'attributes':_0x35ab71[_0x940c('0x17')],'include':_0x35ab71[_0x940c('0x19')]?_[_0x940c('0x1b')](_0x35ab71[_0x940c('0x19')],function(_0x4371da){return{'model':db[_0x4371da[_0x940c('0x1a')]],'as':_0x4371da['as'],'attributes':_0x4371da[_0x940c('0x17')],'include':_0x4371da[_0x940c('0x19')]?_[_0x940c('0x1b')](_0x4371da[_0x940c('0x19')],function(_0x2432c3){return{'model':db[_0x2432c3[_0x940c('0x1a')]],'as':_0x2432c3['as'],'attributes':_0x2432c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x940c('0x1c')](function(_0x537ab3){logger['info'](_0x940c('0x12'),_0x2bd11d);logger[_0x940c('0x1d')](_0x940c('0x12'),_0x2bd11d,JSON[_0x940c('0xd')](_0x537ab3));_0x20a8f2(_0x537ab3);})[_0x940c('0x1e')](function(_0x115f22){logger[_0x940c('0xe')]('GetZendeskAccount',_0x115f22[_0x940c('0x10')],_0x2bd11d);_0x14df35(_0x1b0b85[_0x940c('0xe')](0x1f4,_0x115f22['message']));});});};exports[_0x940c('0x1f')]=function(_0x20729b){var _0x13fb50=this;return new Promise(function(_0xead4df,_0x2760cd){return db['ZendeskAccount'][_0x940c('0x20')]({'raw':_0x20729b['options']?_0x20729b['options']['raw']===undefined?!![]:![]:!![],'where':_0x20729b[_0x940c('0x15')]?_0x20729b[_0x940c('0x15')]['where']||null:null,'attributes':_0x20729b[_0x940c('0x15')]?_0x20729b[_0x940c('0x15')][_0x940c('0x17')]||null:null,'include':_0x20729b[_0x940c('0x15')]?_0x20729b['options'][_0x940c('0x19')]?_[_0x940c('0x1b')](_0x20729b[_0x940c('0x15')][_0x940c('0x19')],function(_0x4443ce){return{'model':db[_0x4443ce[_0x940c('0x1a')]],'as':_0x4443ce['as'],'attributes':_0x4443ce[_0x940c('0x17')],'include':_0x4443ce['include']?_['map'](_0x4443ce[_0x940c('0x19')],function(_0x172d95){return{'model':db[_0x172d95['model']],'as':_0x172d95['as'],'attributes':_0x172d95[_0x940c('0x17')],'include':_0x172d95[_0x940c('0x19')]?_[_0x940c('0x1b')](_0x172d95[_0x940c('0x19')],function(_0x3b468a){return{'model':db[_0x3b468a['model']],'as':_0x3b468a['as'],'attributes':_0x3b468a[_0x940c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x940c('0x1c')](function(_0x4c9f81){logger[_0x940c('0x11')]('ShowZendeskAccount',_0x20729b);logger['debug'](_0x940c('0x1f'),_0x20729b,JSON['stringify'](_0x4c9f81));_0xead4df(_0x4c9f81);})[_0x940c('0x1e')](function(_0x16f05c){logger['error']('ShowZendeskAccount',_0x16f05c[_0x940c('0x10')],_0x20729b);_0x2760cd(_0x13fb50[_0x940c('0xe')](0x1f4,_0x16f05c[_0x940c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index aa49842..41a6f4e 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 _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xcb91[_0x1abeb2];return _0x48da20;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x16556b,_0x59d6de){var _0x314424=function(_0x56157c){while(--_0x56157c){_0x16556b['push'](_0x16556b['shift']());}};_0x314424(++_0x59d6de);}(_0xac4a,0x13f));var _0xaac4=function(_0xab4c63,_0x3cf137){_0xab4c63=_0xab4c63-0x0;var _0x1f70fb=_0xac4a[_0xab4c63];return _0x1f70fb;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 922cc22..2aa53c3 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 _0x4717=['sequelize','exports','STRING'];(function(_0x480957,_0x2632b7){var _0x5101d3=function(_0xca6835){while(--_0xca6835){_0x480957['push'](_0x480957['shift']());}};_0x5101d3(++_0x2632b7);}(_0x4717,0x114));var _0x7471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4717[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7471('0x0'));module[_0x7471('0x1')]={'name':{'type':Sequelize[_0x7471('0x2')]},'description':{'type':Sequelize[_0x7471('0x2')]}}; \ No newline at end of file +var _0xe525=['sequelize','exports','STRING'];(function(_0x59b79f,_0x53c506){var _0x8dc132=function(_0x10d53b){while(--_0x10d53b){_0x59b79f['push'](_0x59b79f['shift']());}};_0x8dc132(++_0x53c506);}(_0xe525,0x162));var _0x5e52=function(_0x5e275d,_0x246ea2){_0x5e275d=_0x5e275d-0x0;var _0x4eea9f=_0xe525[_0x5e275d];return _0x4eea9f;};'use strict';var Sequelize=require(_0x5e52('0x0'));module[_0x5e52('0x1')]={'name':{'type':Sequelize[_0x5e52('0x2')]},'description':{'type':Sequelize[_0x5e52('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8f55667..bac8707 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 _0x8eb5=['key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','includeAll','ZendeskConfiguration','findAll','rows','catch','show','params','include','create','body','update','find','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x33c135,_0x452929){var _0x2fd7f9=function(_0x38fe9c){while(--_0x38fe9c){_0x33c135['push'](_0x33c135['shift']());}};_0x2fd7f9(++_0x452929);}(_0x8eb5,0x1de));var _0x58eb=function(_0x4e2cbe,_0x14adf9){_0x4e2cbe=_0x4e2cbe-0x0;var _0x5ca7ea=_0x8eb5[_0x4e2cbe];return _0x5ca7ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58eb('0x0'));var zipdir=require(_0x58eb('0x1'));var jsonpatch=require(_0x58eb('0x2'));var rp=require(_0x58eb('0x3'));var moment=require(_0x58eb('0x4'));var BPromise=require(_0x58eb('0x5'));var Mustache=require(_0x58eb('0x6'));var util=require(_0x58eb('0x7'));var path=require(_0x58eb('0x8'));var sox=require('sox');var csv=require(_0x58eb('0x9'));var ejs=require(_0x58eb('0xa'));var fs=require('fs');var fs_extra=require(_0x58eb('0xb'));var _=require(_0x58eb('0xc'));var squel=require('squel');var crypto=require(_0x58eb('0xd'));var jsforce=require(_0x58eb('0xe'));var deskjs=require(_0x58eb('0xf'));var toCsv=require(_0x58eb('0x9'));var querystring=require(_0x58eb('0x10'));var Papa=require(_0x58eb('0x11'));var Redis=require(_0x58eb('0x12'));var authService=require(_0x58eb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x58eb('0x14'));var hardwareService=require(_0x58eb('0x15'));var logger=require(_0x58eb('0x16'))(_0x58eb('0x17'));var utils=require(_0x58eb('0x18'));var config=require(_0x58eb('0x19'));var licenseUtil=require(_0x58eb('0x1a'));var db=require(_0x58eb('0x1b'))['db'];function respondWithStatusCode(_0x438b01,_0x2d9cf4){_0x2d9cf4=_0x2d9cf4||0xcc;return function(_0x558505){if(_0x558505){return _0x438b01[_0x58eb('0x1c')](_0x2d9cf4);}return _0x438b01[_0x58eb('0x1d')](_0x2d9cf4)['end']();};}function respondWithResult(_0x525ae3,_0x355ca8){_0x355ca8=_0x355ca8||0xc8;return function(_0x1ac77e){if(_0x1ac77e){return _0x525ae3[_0x58eb('0x1d')](_0x355ca8)[_0x58eb('0x1e')](_0x1ac77e);}};}function respondWithFilteredResult(_0xadd588,_0x44ba37){return function(_0x317bc1){if(_0x317bc1){var _0x1bfaac=typeof _0x44ba37[_0x58eb('0x1f')]===_0x58eb('0x20')&&typeof _0x44ba37[_0x58eb('0x21')]===_0x58eb('0x20');var _0x17e5f6=_0x317bc1['count'];var _0x1118ed=_0x1bfaac?0x0:_0x44ba37['offset'];var _0x587c41=_0x1bfaac?_0x317bc1[_0x58eb('0x22')]:_0x44ba37[_0x58eb('0x1f')]+_0x44ba37[_0x58eb('0x21')];var _0x43b6e8;if(_0x587c41>=_0x17e5f6){_0x587c41=_0x17e5f6;_0x43b6e8=0xc8;}else{_0x43b6e8=0xce;}_0xadd588[_0x58eb('0x1d')](_0x43b6e8);return _0xadd588[_0x58eb('0x23')](_0x58eb('0x24'),_0x1118ed+'-'+_0x587c41+'/'+_0x17e5f6)[_0x58eb('0x1e')](_0x317bc1);}return null;};}function patchUpdates(_0x24758e){return function(_0xd9a487){try{jsonpatch[_0x58eb('0x25')](_0xd9a487,_0x24758e,!![]);}catch(_0x5cf345){return BPromise[_0x58eb('0x26')](_0x5cf345);}return _0xd9a487[_0x58eb('0x27')]();};}function saveUpdates(_0x227791,_0x29bbd4){return function(_0x5b3780){if(_0x5b3780){return _0x5b3780['update'](_0x227791)[_0x58eb('0x28')](function(_0x2277a5){return _0x2277a5;});}return null;};}function removeEntity(_0x2ad627,_0x400b50){return function(_0x130688){if(_0x130688){return _0x130688['destroy']()[_0x58eb('0x28')](function(){_0x2ad627[_0x58eb('0x1d')](0xcc)[_0x58eb('0x29')]();});}};}function handleEntityNotFound(_0x3bfc6d,_0x312fd2){return function(_0x54fa96){if(!_0x54fa96){_0x3bfc6d[_0x58eb('0x1c')](0x194);}return _0x54fa96;};}function handleError(_0x2ef4c6,_0x4393a6){_0x4393a6=_0x4393a6||0x1f4;return function(_0x2f435e){logger[_0x58eb('0x2a')](_0x2f435e[_0x58eb('0x2b')]);if(_0x2f435e[_0x58eb('0x2c')]){delete _0x2f435e['name'];}_0x2ef4c6['status'](_0x4393a6)[_0x58eb('0x2d')](_0x2f435e);};}exports[_0x58eb('0x2e')]=function(_0x146589,_0x5c65fd){var _0x4df434={},_0x2b3d7c={},_0x4d68f8={'count':0x0,'rows':[]};var _0x881721=_[_0x58eb('0x2f')](db['ZendeskConfiguration'][_0x58eb('0x30')],function(_0x8a7420){return{'name':_0x8a7420[_0x58eb('0x31')],'type':_0x8a7420['type'][_0x58eb('0x32')]};});_0x2b3d7c['model']=_[_0x58eb('0x2f')](_0x881721,_0x58eb('0x2c'));_0x2b3d7c[_0x58eb('0x33')]=_[_0x58eb('0x34')](_0x146589[_0x58eb('0x33')]);_0x2b3d7c[_0x58eb('0x35')]=_[_0x58eb('0x36')](_0x2b3d7c[_0x58eb('0x37')],_0x2b3d7c[_0x58eb('0x33')]);_0x4df434[_0x58eb('0x38')]=_[_0x58eb('0x36')](_0x2b3d7c['model'],qs[_0x58eb('0x39')](_0x146589[_0x58eb('0x33')][_0x58eb('0x39')]));_0x4df434[_0x58eb('0x38')]=_0x4df434['attributes'][_0x58eb('0x3a')]?_0x4df434[_0x58eb('0x38')]:_0x2b3d7c['model'];if(!_0x146589['query']['hasOwnProperty'](_0x58eb('0x3b'))){_0x4df434['limit']=qs['limit'](_0x146589[_0x58eb('0x33')]['limit']);_0x4df434['offset']=qs[_0x58eb('0x1f')](_0x146589[_0x58eb('0x33')][_0x58eb('0x1f')]);}_0x4df434[_0x58eb('0x3c')]=qs[_0x58eb('0x3d')](_0x146589['query'][_0x58eb('0x3d')]);_0x4df434['where']=qs[_0x58eb('0x35')](_[_0x58eb('0x3e')](_0x146589['query'],_0x2b3d7c['filters']),_0x881721);if(_0x146589[_0x58eb('0x33')][_0x58eb('0x3f')]){_0x4df434['where']=_[_0x58eb('0x40')](_0x4df434[_0x58eb('0x41')],{'$or':_[_0x58eb('0x2f')](_0x881721,function(_0x4aeba4){if(_0x4aeba4['type']!=='VIRTUAL'){var _0x130005={};_0x130005[_0x4aeba4[_0x58eb('0x2c')]]={'$like':'%'+_0x146589[_0x58eb('0x33')][_0x58eb('0x3f')]+'%'};return _0x130005;}})});}_0x4df434=_[_0x58eb('0x40')]({},_0x4df434,_0x146589[_0x58eb('0x42')]);var _0x4ada96={'where':_0x4df434[_0x58eb('0x41')]};return db['ZendeskConfiguration'][_0x58eb('0x22')](_0x4ada96)['then'](function(_0x54a156){_0x4d68f8[_0x58eb('0x22')]=_0x54a156;if(_0x146589[_0x58eb('0x33')][_0x58eb('0x43')]){_0x4df434['include']=[{'all':!![]}];}return db[_0x58eb('0x44')][_0x58eb('0x45')](_0x4df434);})[_0x58eb('0x28')](function(_0x5c1094){_0x4d68f8[_0x58eb('0x46')]=_0x5c1094;return _0x4d68f8;})[_0x58eb('0x28')](respondWithFilteredResult(_0x5c65fd,_0x4df434))[_0x58eb('0x47')](handleError(_0x5c65fd,null));};exports[_0x58eb('0x48')]=function(_0x181fef,_0x540edf){var _0x15fafb={'raw':![],'where':{'id':_0x181fef[_0x58eb('0x49')]['id']}},_0x522ab8={};_0x522ab8[_0x58eb('0x37')]=_[_0x58eb('0x34')](db[_0x58eb('0x44')]['rawAttributes']);_0x522ab8[_0x58eb('0x33')]=_['keys'](_0x181fef[_0x58eb('0x33')]);_0x522ab8[_0x58eb('0x35')]=_[_0x58eb('0x36')](_0x522ab8[_0x58eb('0x37')],_0x522ab8[_0x58eb('0x33')]);_0x15fafb['attributes']=_['intersection'](_0x522ab8[_0x58eb('0x37')],qs[_0x58eb('0x39')](_0x181fef['query'][_0x58eb('0x39')]));_0x15fafb[_0x58eb('0x38')]=_0x15fafb[_0x58eb('0x38')][_0x58eb('0x3a')]?_0x15fafb[_0x58eb('0x38')]:_0x522ab8[_0x58eb('0x37')];if(_0x181fef[_0x58eb('0x33')][_0x58eb('0x43')]){_0x15fafb[_0x58eb('0x4a')]=[{'all':!![]}];}_0x15fafb=_[_0x58eb('0x40')]({},_0x15fafb,_0x181fef[_0x58eb('0x42')]);return db[_0x58eb('0x44')]['find'](_0x15fafb)[_0x58eb('0x28')](handleEntityNotFound(_0x540edf,null))[_0x58eb('0x28')](respondWithResult(_0x540edf,null))['catch'](handleError(_0x540edf,null));};exports['create']=function(_0x48a88e,_0x258f00){return db['ZendeskConfiguration'][_0x58eb('0x4b')](_0x48a88e[_0x58eb('0x4c')],{})[_0x58eb('0x28')](respondWithResult(_0x258f00,0xc9))['catch'](handleError(_0x258f00,null));};exports[_0x58eb('0x4d')]=function(_0x1c8cb1,_0x54c3f9){if(_0x1c8cb1[_0x58eb('0x4c')]['id']){delete _0x1c8cb1[_0x58eb('0x4c')]['id'];}return db[_0x58eb('0x44')][_0x58eb('0x4e')]({'where':{'id':_0x1c8cb1['params']['id']}})[_0x58eb('0x28')](handleEntityNotFound(_0x54c3f9,null))['then'](saveUpdates(_0x1c8cb1['body'],null))[_0x58eb('0x28')](respondWithResult(_0x54c3f9,null))[_0x58eb('0x47')](handleError(_0x54c3f9,null));};exports['destroy']=function(_0x369b6b,_0x3b072e){return db[_0x58eb('0x44')][_0x58eb('0x4e')]({'where':{'id':_0x369b6b['params']['id']}})[_0x58eb('0x28')](handleEntityNotFound(_0x3b072e,null))['then'](removeEntity(_0x3b072e,null))['catch'](handleError(_0x3b072e,null));};exports[_0x58eb('0x4f')]=function(_0x452c94,_0x299ed9,_0x260976){var _0x3234c2={};var _0x14cbed={};var _0x20c321;var _0x132115;return db[_0x58eb('0x44')][_0x58eb('0x50')]({'where':{'id':_0x452c94['params']['id']}})[_0x58eb('0x28')](handleEntityNotFound(_0x299ed9,null))[_0x58eb('0x28')](function(_0x42306c){if(_0x42306c){_0x20c321=_0x42306c;_0x14cbed[_0x58eb('0x37')]=_[_0x58eb('0x34')](db['ZendeskField'][_0x58eb('0x30')]);_0x14cbed[_0x58eb('0x33')]=_[_0x58eb('0x34')](_0x452c94[_0x58eb('0x33')]);_0x14cbed['filters']=_[_0x58eb('0x36')](_0x14cbed['model'],_0x14cbed[_0x58eb('0x33')]);_0x3234c2[_0x58eb('0x38')]=_[_0x58eb('0x36')](_0x14cbed[_0x58eb('0x37')],qs[_0x58eb('0x39')](_0x452c94['query'][_0x58eb('0x39')]));_0x3234c2[_0x58eb('0x38')]=_0x3234c2['attributes'][_0x58eb('0x3a')]?_0x3234c2['attributes']:_0x14cbed[_0x58eb('0x37')];_0x3234c2['order']=qs[_0x58eb('0x3d')](_0x452c94['query']['sort']);_0x3234c2[_0x58eb('0x41')]=qs[_0x58eb('0x35')](_[_0x58eb('0x3e')](_0x452c94[_0x58eb('0x33')],_0x14cbed[_0x58eb('0x35')]));if(_0x452c94['query'][_0x58eb('0x3f')]){_0x3234c2[_0x58eb('0x41')]=_[_0x58eb('0x40')](_0x3234c2[_0x58eb('0x41')],{'$or':_[_0x58eb('0x2f')](_0x3234c2[_0x58eb('0x38')],function(_0x479ede){var _0x54233f={};_0x54233f[_0x479ede]={'$like':'%'+_0x452c94[_0x58eb('0x33')][_0x58eb('0x3f')]+'%'};return _0x54233f;})});}_0x3234c2=_['merge']({},_0x3234c2,_0x452c94[_0x58eb('0x42')]);return _0x20c321[_0x58eb('0x4f')](_0x3234c2);}})['then'](function(_0x3755b2){if(_0x3755b2){_0x132115=_0x3755b2['length'];if(!_0x452c94[_0x58eb('0x33')][_0x58eb('0x51')](_0x58eb('0x3b'))){_0x3234c2[_0x58eb('0x21')]=qs[_0x58eb('0x21')](_0x452c94[_0x58eb('0x33')]['limit']);_0x3234c2[_0x58eb('0x1f')]=qs['offset'](_0x452c94[_0x58eb('0x33')][_0x58eb('0x1f')]);}return _0x20c321['getFields'](_0x3234c2);}})['then'](function(_0x7d6125){if(_0x7d6125){return _0x7d6125?{'count':_0x132115,'rows':_0x7d6125}:null;}})[_0x58eb('0x28')](respondWithResult(_0x299ed9,null))[_0x58eb('0x47')](handleError(_0x299ed9,null));};exports[_0x58eb('0x52')]=function(_0x50a14e,_0x6fe04a,_0x3eb477){var _0x3b9159={};var _0x22b071={};var _0xbc1671;var _0x1b3714;return db[_0x58eb('0x44')][_0x58eb('0x50')]({'where':{'id':_0x50a14e[_0x58eb('0x49')]['id']}})[_0x58eb('0x28')](handleEntityNotFound(_0x6fe04a,null))[_0x58eb('0x28')](function(_0x314cac){if(_0x314cac){_0xbc1671=_0x314cac;_0x22b071[_0x58eb('0x37')]=_[_0x58eb('0x34')](db[_0x58eb('0x53')][_0x58eb('0x30')]);_0x22b071[_0x58eb('0x33')]=_[_0x58eb('0x34')](_0x50a14e[_0x58eb('0x33')]);_0x22b071[_0x58eb('0x35')]=_[_0x58eb('0x36')](_0x22b071[_0x58eb('0x37')],_0x22b071['query']);_0x3b9159[_0x58eb('0x38')]=_[_0x58eb('0x36')](_0x22b071['model'],qs[_0x58eb('0x39')](_0x50a14e[_0x58eb('0x33')][_0x58eb('0x39')]));_0x3b9159[_0x58eb('0x38')]=_0x3b9159[_0x58eb('0x38')][_0x58eb('0x3a')]?_0x3b9159['attributes']:_0x22b071['model'];_0x3b9159[_0x58eb('0x3c')]=qs[_0x58eb('0x3d')](_0x50a14e[_0x58eb('0x33')][_0x58eb('0x3d')]);_0x3b9159[_0x58eb('0x41')]=qs[_0x58eb('0x35')](_[_0x58eb('0x3e')](_0x50a14e[_0x58eb('0x33')],_0x22b071[_0x58eb('0x35')]));if(_0x50a14e[_0x58eb('0x33')]['filter']){_0x3b9159[_0x58eb('0x41')]=_[_0x58eb('0x40')](_0x3b9159['where'],{'$or':_[_0x58eb('0x2f')](_0x3b9159['attributes'],function(_0x2c9f97){var _0x47fcc3={};_0x47fcc3[_0x2c9f97]={'$like':'%'+_0x50a14e[_0x58eb('0x33')][_0x58eb('0x3f')]+'%'};return _0x47fcc3;})});}_0x3b9159=_[_0x58eb('0x40')]({},_0x3b9159,_0x50a14e[_0x58eb('0x42')]);return _0xbc1671[_0x58eb('0x52')](_0x3b9159);}})['then'](function(_0xa287ac){if(_0xa287ac){_0x1b3714=_0xa287ac['length'];if(!_0x50a14e['query']['hasOwnProperty'](_0x58eb('0x3b'))){_0x3b9159[_0x58eb('0x21')]=qs[_0x58eb('0x21')](_0x50a14e[_0x58eb('0x33')][_0x58eb('0x21')]);_0x3b9159[_0x58eb('0x1f')]=qs['offset'](_0x50a14e[_0x58eb('0x33')]['offset']);}return _0xbc1671['getSubjects'](_0x3b9159);}})[_0x58eb('0x28')](function(_0x887c74){if(_0x887c74){return _0x887c74?{'count':_0x1b3714,'rows':_0x887c74}:null;}})['then'](respondWithResult(_0x6fe04a,null))['catch'](handleError(_0x6fe04a,null));};exports[_0x58eb('0x54')]=function(_0x3ead58,_0x8bd04a,_0x2506cb){var _0x119fbd={};var _0x254c8b={};var _0x111bb6;var _0x44b9d9;return db[_0x58eb('0x44')][_0x58eb('0x50')]({'where':{'id':_0x3ead58[_0x58eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x8bd04a,null))[_0x58eb('0x28')](function(_0x5dcb1c){if(_0x5dcb1c){_0x111bb6=_0x5dcb1c;_0x254c8b[_0x58eb('0x37')]=_[_0x58eb('0x34')](db[_0x58eb('0x53')][_0x58eb('0x30')]);_0x254c8b[_0x58eb('0x33')]=_['keys'](_0x3ead58[_0x58eb('0x33')]);_0x254c8b[_0x58eb('0x35')]=_['intersection'](_0x254c8b[_0x58eb('0x37')],_0x254c8b['query']);_0x119fbd[_0x58eb('0x38')]=_[_0x58eb('0x36')](_0x254c8b[_0x58eb('0x37')],qs[_0x58eb('0x39')](_0x3ead58[_0x58eb('0x33')]['fields']));_0x119fbd[_0x58eb('0x38')]=_0x119fbd['attributes'][_0x58eb('0x3a')]?_0x119fbd[_0x58eb('0x38')]:_0x254c8b[_0x58eb('0x37')];_0x119fbd['order']=qs['sort'](_0x3ead58[_0x58eb('0x33')][_0x58eb('0x3d')]);_0x119fbd['where']=qs[_0x58eb('0x35')](_[_0x58eb('0x3e')](_0x3ead58['query'],_0x254c8b['filters']));if(_0x3ead58[_0x58eb('0x33')][_0x58eb('0x3f')]){_0x119fbd[_0x58eb('0x41')]=_[_0x58eb('0x40')](_0x119fbd[_0x58eb('0x41')],{'$or':_['map'](_0x119fbd[_0x58eb('0x38')],function(_0x93d1bf){var _0x8cbd47={};_0x8cbd47[_0x93d1bf]={'$like':'%'+_0x3ead58[_0x58eb('0x33')][_0x58eb('0x3f')]+'%'};return _0x8cbd47;})});}_0x119fbd=_[_0x58eb('0x40')]({},_0x119fbd,_0x3ead58['options']);return _0x111bb6['getDescriptions'](_0x119fbd);}})[_0x58eb('0x28')](function(_0xde1322){if(_0xde1322){_0x44b9d9=_0xde1322[_0x58eb('0x3a')];if(!_0x3ead58['query'][_0x58eb('0x51')]('nolimit')){_0x119fbd['limit']=qs[_0x58eb('0x21')](_0x3ead58[_0x58eb('0x33')]['limit']);_0x119fbd[_0x58eb('0x1f')]=qs[_0x58eb('0x1f')](_0x3ead58['query'][_0x58eb('0x1f')]);}return _0x111bb6['getDescriptions'](_0x119fbd);}})['then'](function(_0x426207){if(_0x426207){return _0x426207?{'count':_0x44b9d9,'rows':_0x426207}:null;}})[_0x58eb('0x28')](respondWithResult(_0x8bd04a,null))['catch'](handleError(_0x8bd04a,null));};exports[_0x58eb('0x55')]=function(_0x151d2f,_0x1d2208,_0x454ce0){var _0x159249={};var _0x15b63f={};var _0x38fb71;var _0x5484c7;return db[_0x58eb('0x44')]['findOne']({'where':{'id':_0x151d2f[_0x58eb('0x49')]['id']}})[_0x58eb('0x28')](handleEntityNotFound(_0x1d2208,null))['then'](function(_0x28c1fc){if(_0x28c1fc){_0x38fb71=_0x28c1fc;_0x15b63f[_0x58eb('0x37')]=_[_0x58eb('0x34')](db[_0x58eb('0x56')][_0x58eb('0x30')]);_0x15b63f[_0x58eb('0x33')]=_[_0x58eb('0x34')](_0x151d2f[_0x58eb('0x33')]);_0x15b63f['filters']=_[_0x58eb('0x36')](_0x15b63f[_0x58eb('0x37')],_0x15b63f[_0x58eb('0x33')]);_0x159249[_0x58eb('0x38')]=_[_0x58eb('0x36')](_0x15b63f['model'],qs[_0x58eb('0x39')](_0x151d2f['query'][_0x58eb('0x39')]));_0x159249[_0x58eb('0x38')]=_0x159249['attributes'][_0x58eb('0x3a')]?_0x159249[_0x58eb('0x38')]:_0x15b63f['model'];_0x159249['order']=qs[_0x58eb('0x3d')](_0x151d2f['query'][_0x58eb('0x3d')]);_0x159249[_0x58eb('0x41')]=qs['filters'](_[_0x58eb('0x3e')](_0x151d2f[_0x58eb('0x33')],_0x15b63f[_0x58eb('0x35')]));if(_0x151d2f[_0x58eb('0x33')][_0x58eb('0x3f')]){_0x159249[_0x58eb('0x41')]=_[_0x58eb('0x40')](_0x159249[_0x58eb('0x41')],{'$or':_[_0x58eb('0x2f')](_0x159249['attributes'],function(_0x2bba7e){var _0x9cf31c={};_0x9cf31c[_0x2bba7e]={'$like':'%'+_0x151d2f[_0x58eb('0x33')][_0x58eb('0x3f')]+'%'};return _0x9cf31c;})});}_0x159249=_[_0x58eb('0x40')]({},_0x159249,_0x151d2f[_0x58eb('0x42')]);return _0x38fb71['getTags'](_0x159249);}})[_0x58eb('0x28')](function(_0x63cb37){if(_0x63cb37){_0x5484c7=_0x63cb37[_0x58eb('0x3a')];if(!_0x151d2f[_0x58eb('0x33')][_0x58eb('0x51')](_0x58eb('0x3b'))){_0x159249[_0x58eb('0x21')]=qs[_0x58eb('0x21')](_0x151d2f['query'][_0x58eb('0x21')]);_0x159249[_0x58eb('0x1f')]=qs[_0x58eb('0x1f')](_0x151d2f[_0x58eb('0x33')][_0x58eb('0x1f')]);}return _0x38fb71['getTags'](_0x159249);}})[_0x58eb('0x28')](function(_0x288229){if(_0x288229){return _0x288229?{'count':_0x5484c7,'rows':_0x288229}:null;}})['then'](respondWithResult(_0x1d2208,null))[_0x58eb('0x47')](handleError(_0x1d2208,null));};exports['setTags']=function(_0x2a0586,_0x6cf288,_0xd167cf){if(_0x2a0586['body']['id']){delete _0x2a0586[_0x58eb('0x4c')]['id'];}return db[_0x58eb('0x44')][_0x58eb('0x50')]({'where':{'id':_0x2a0586['params']['id']}})['then'](handleEntityNotFound(_0x6cf288,null))[_0x58eb('0x28')](function(_0x4941bb){if(_0x4941bb){return _0x4941bb[_0x58eb('0x57')](_0x2a0586['body']['ids']||[]);}return null;})[_0x58eb('0x28')](respondWithResult(_0x6cf288,null))[_0x58eb('0x47')](handleError(_0x6cf288,null));}; \ No newline at end of file +var _0xd479=['../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','destroy','name','send','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xc7e702,_0x2001c0){var _0x1b9d93=function(_0x5bd11f){while(--_0x5bd11f){_0xc7e702['push'](_0xc7e702['shift']());}};_0x1b9d93(++_0x2001c0);}(_0xd479,0x1d5));var _0x9d47=function(_0x365a05,_0x4f2e4d){_0x365a05=_0x365a05-0x0;var _0x15db0e=_0xd479[_0x365a05];return _0x15db0e;};'use strict';var emlformat=require(_0x9d47('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d47('0x1'));var rp=require(_0x9d47('0x2'));var moment=require(_0x9d47('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d47('0x4'));var util=require(_0x9d47('0x5'));var path=require(_0x9d47('0x6'));var sox=require('sox');var csv=require(_0x9d47('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d47('0x8'));var _=require(_0x9d47('0x9'));var squel=require('squel');var crypto=require(_0x9d47('0xa'));var jsforce=require(_0x9d47('0xb'));var deskjs=require(_0x9d47('0xc'));var toCsv=require(_0x9d47('0x7'));var querystring=require(_0x9d47('0xd'));var Papa=require(_0x9d47('0xe'));var Redis=require('ioredis');var authService=require(_0x9d47('0xf'));var qs=require(_0x9d47('0x10'));var as=require(_0x9d47('0x11'));var hardwareService=require(_0x9d47('0x12'));var logger=require(_0x9d47('0x13'))(_0x9d47('0x14'));var utils=require(_0x9d47('0x15'));var config=require(_0x9d47('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d47('0x17'))['db'];function respondWithStatusCode(_0x4cae1f,_0x240e07){_0x240e07=_0x240e07||0xcc;return function(_0x3d8521){if(_0x3d8521){return _0x4cae1f[_0x9d47('0x18')](_0x240e07);}return _0x4cae1f['status'](_0x240e07)[_0x9d47('0x19')]();};}function respondWithResult(_0x19e7a1,_0x230eec){_0x230eec=_0x230eec||0xc8;return function(_0x656400){if(_0x656400){return _0x19e7a1['status'](_0x230eec)[_0x9d47('0x1a')](_0x656400);}};}function respondWithFilteredResult(_0x44c820,_0x4f19cd){return function(_0x271c49){if(_0x271c49){var _0xdf0eab=typeof _0x4f19cd['offset']===_0x9d47('0x1b')&&typeof _0x4f19cd[_0x9d47('0x1c')]===_0x9d47('0x1b');var _0x182327=_0x271c49[_0x9d47('0x1d')];var _0x238c2f=_0xdf0eab?0x0:_0x4f19cd[_0x9d47('0x1e')];var _0x993f82=_0xdf0eab?_0x271c49['count']:_0x4f19cd[_0x9d47('0x1e')]+_0x4f19cd[_0x9d47('0x1c')];var _0x9cf403;if(_0x993f82>=_0x182327){_0x993f82=_0x182327;_0x9cf403=0xc8;}else{_0x9cf403=0xce;}_0x44c820[_0x9d47('0x1f')](_0x9cf403);return _0x44c820[_0x9d47('0x20')](_0x9d47('0x21'),_0x238c2f+'-'+_0x993f82+'/'+_0x182327)[_0x9d47('0x1a')](_0x271c49);}return null;};}function patchUpdates(_0x18500f){return function(_0x1bc492){try{jsonpatch[_0x9d47('0x22')](_0x1bc492,_0x18500f,!![]);}catch(_0x1e5a9d){return BPromise['reject'](_0x1e5a9d);}return _0x1bc492[_0x9d47('0x23')]();};}function saveUpdates(_0x56900b,_0x90b768){return function(_0x4d14dc){if(_0x4d14dc){return _0x4d14dc[_0x9d47('0x24')](_0x56900b)[_0x9d47('0x25')](function(_0x136d16){return _0x136d16;});}return null;};}function removeEntity(_0x1ab912,_0x393ce4){return function(_0x158d77){if(_0x158d77){return _0x158d77[_0x9d47('0x26')]()['then'](function(){_0x1ab912[_0x9d47('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491ea2,_0x45a183){return function(_0x357ab2){if(!_0x357ab2){_0x491ea2['sendStatus'](0x194);}return _0x357ab2;};}function handleError(_0x2481b6,_0x50922f){_0x50922f=_0x50922f||0x1f4;return function(_0x1b4513){logger['error'](_0x1b4513['stack']);if(_0x1b4513[_0x9d47('0x27')]){delete _0x1b4513[_0x9d47('0x27')];}_0x2481b6[_0x9d47('0x1f')](_0x50922f)[_0x9d47('0x28')](_0x1b4513);};}exports['index']=function(_0x233310,_0x5a4b5a){var _0x443efb={},_0x4d4758={},_0x49ab3c={'count':0x0,'rows':[]};var _0x53a7fd=_[_0x9d47('0x29')](db['ZendeskConfiguration']['rawAttributes'],function(_0x5b1c8f){return{'name':_0x5b1c8f[_0x9d47('0x2a')],'type':_0x5b1c8f[_0x9d47('0x2b')]['key']};});_0x4d4758['model']=_[_0x9d47('0x29')](_0x53a7fd,_0x9d47('0x27'));_0x4d4758[_0x9d47('0x2c')]=_[_0x9d47('0x2d')](_0x233310[_0x9d47('0x2c')]);_0x4d4758[_0x9d47('0x2e')]=_[_0x9d47('0x2f')](_0x4d4758[_0x9d47('0x30')],_0x4d4758[_0x9d47('0x2c')]);_0x443efb[_0x9d47('0x31')]=_[_0x9d47('0x2f')](_0x4d4758[_0x9d47('0x30')],qs[_0x9d47('0x32')](_0x233310[_0x9d47('0x2c')][_0x9d47('0x32')]));_0x443efb[_0x9d47('0x31')]=_0x443efb[_0x9d47('0x31')][_0x9d47('0x33')]?_0x443efb[_0x9d47('0x31')]:_0x4d4758['model'];if(!_0x233310['query'][_0x9d47('0x34')](_0x9d47('0x35'))){_0x443efb['limit']=qs[_0x9d47('0x1c')](_0x233310[_0x9d47('0x2c')][_0x9d47('0x1c')]);_0x443efb[_0x9d47('0x1e')]=qs[_0x9d47('0x1e')](_0x233310['query'][_0x9d47('0x1e')]);}_0x443efb[_0x9d47('0x36')]=qs['sort'](_0x233310[_0x9d47('0x2c')][_0x9d47('0x37')]);_0x443efb[_0x9d47('0x38')]=qs[_0x9d47('0x2e')](_[_0x9d47('0x39')](_0x233310[_0x9d47('0x2c')],_0x4d4758['filters']),_0x53a7fd);if(_0x233310[_0x9d47('0x2c')][_0x9d47('0x3a')]){_0x443efb[_0x9d47('0x38')]=_[_0x9d47('0x3b')](_0x443efb[_0x9d47('0x38')],{'$or':_[_0x9d47('0x29')](_0x53a7fd,function(_0x9059d5){if(_0x9059d5[_0x9d47('0x2b')]!==_0x9d47('0x3c')){var _0x269408={};_0x269408[_0x9059d5[_0x9d47('0x27')]]={'$like':'%'+_0x233310['query'][_0x9d47('0x3a')]+'%'};return _0x269408;}})});}_0x443efb=_[_0x9d47('0x3b')]({},_0x443efb,_0x233310[_0x9d47('0x3d')]);var _0x2c7f8e={'where':_0x443efb['where']};return db[_0x9d47('0x3e')][_0x9d47('0x1d')](_0x2c7f8e)[_0x9d47('0x25')](function(_0x2cc791){_0x49ab3c[_0x9d47('0x1d')]=_0x2cc791;if(_0x233310['query'][_0x9d47('0x3f')]){_0x443efb[_0x9d47('0x40')]=[{'all':!![]}];}return db[_0x9d47('0x3e')][_0x9d47('0x41')](_0x443efb);})['then'](function(_0x3d2839){_0x49ab3c[_0x9d47('0x42')]=_0x3d2839;return _0x49ab3c;})[_0x9d47('0x25')](respondWithFilteredResult(_0x5a4b5a,_0x443efb))['catch'](handleError(_0x5a4b5a,null));};exports[_0x9d47('0x43')]=function(_0x14746a,_0x3dd883){var _0x2b1837={'raw':![],'where':{'id':_0x14746a[_0x9d47('0x44')]['id']}},_0x5f4599={};_0x5f4599[_0x9d47('0x30')]=_[_0x9d47('0x2d')](db[_0x9d47('0x3e')][_0x9d47('0x45')]);_0x5f4599['query']=_[_0x9d47('0x2d')](_0x14746a[_0x9d47('0x2c')]);_0x5f4599[_0x9d47('0x2e')]=_[_0x9d47('0x2f')](_0x5f4599['model'],_0x5f4599['query']);_0x2b1837[_0x9d47('0x31')]=_[_0x9d47('0x2f')](_0x5f4599['model'],qs[_0x9d47('0x32')](_0x14746a['query'][_0x9d47('0x32')]));_0x2b1837[_0x9d47('0x31')]=_0x2b1837[_0x9d47('0x31')][_0x9d47('0x33')]?_0x2b1837['attributes']:_0x5f4599[_0x9d47('0x30')];if(_0x14746a[_0x9d47('0x2c')]['includeAll']){_0x2b1837['include']=[{'all':!![]}];}_0x2b1837=_['merge']({},_0x2b1837,_0x14746a[_0x9d47('0x3d')]);return db[_0x9d47('0x3e')][_0x9d47('0x46')](_0x2b1837)['then'](handleEntityNotFound(_0x3dd883,null))[_0x9d47('0x25')](respondWithResult(_0x3dd883,null))[_0x9d47('0x47')](handleError(_0x3dd883,null));};exports[_0x9d47('0x48')]=function(_0x1326bc,_0x1ea1a6){return db[_0x9d47('0x3e')][_0x9d47('0x48')](_0x1326bc[_0x9d47('0x49')],{})[_0x9d47('0x25')](respondWithResult(_0x1ea1a6,0xc9))[_0x9d47('0x47')](handleError(_0x1ea1a6,null));};exports[_0x9d47('0x24')]=function(_0x35993d,_0x598024){if(_0x35993d[_0x9d47('0x49')]['id']){delete _0x35993d[_0x9d47('0x49')]['id'];}return db[_0x9d47('0x3e')][_0x9d47('0x46')]({'where':{'id':_0x35993d[_0x9d47('0x44')]['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x598024,null))[_0x9d47('0x25')](saveUpdates(_0x35993d['body'],null))[_0x9d47('0x25')](respondWithResult(_0x598024,null))[_0x9d47('0x47')](handleError(_0x598024,null));};exports['destroy']=function(_0x4d14dd,_0xd21aba){return db[_0x9d47('0x3e')][_0x9d47('0x46')]({'where':{'id':_0x4d14dd['params']['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0xd21aba,null))['then'](removeEntity(_0xd21aba,null))[_0x9d47('0x47')](handleError(_0xd21aba,null));};exports['getFields']=function(_0x41e186,_0x5ea479,_0xcd5b29){var _0x510148={};var _0x3900ad={};var _0x41a5d3;var _0x453eb1;return db[_0x9d47('0x3e')][_0x9d47('0x4a')]({'where':{'id':_0x41e186['params']['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x5ea479,null))[_0x9d47('0x25')](function(_0x27cfe0){if(_0x27cfe0){_0x41a5d3=_0x27cfe0;_0x3900ad[_0x9d47('0x30')]=_[_0x9d47('0x2d')](db[_0x9d47('0x4b')][_0x9d47('0x45')]);_0x3900ad['query']=_[_0x9d47('0x2d')](_0x41e186[_0x9d47('0x2c')]);_0x3900ad[_0x9d47('0x2e')]=_['intersection'](_0x3900ad['model'],_0x3900ad[_0x9d47('0x2c')]);_0x510148['attributes']=_[_0x9d47('0x2f')](_0x3900ad[_0x9d47('0x30')],qs[_0x9d47('0x32')](_0x41e186[_0x9d47('0x2c')][_0x9d47('0x32')]));_0x510148['attributes']=_0x510148[_0x9d47('0x31')][_0x9d47('0x33')]?_0x510148[_0x9d47('0x31')]:_0x3900ad[_0x9d47('0x30')];_0x510148[_0x9d47('0x36')]=qs[_0x9d47('0x37')](_0x41e186[_0x9d47('0x2c')][_0x9d47('0x37')]);_0x510148[_0x9d47('0x38')]=qs['filters'](_[_0x9d47('0x39')](_0x41e186['query'],_0x3900ad['filters']));if(_0x41e186[_0x9d47('0x2c')][_0x9d47('0x3a')]){_0x510148[_0x9d47('0x38')]=_[_0x9d47('0x3b')](_0x510148['where'],{'$or':_[_0x9d47('0x29')](_0x510148[_0x9d47('0x31')],function(_0x4c45bb){var _0x5aaabf={};_0x5aaabf[_0x4c45bb]={'$like':'%'+_0x41e186['query'][_0x9d47('0x3a')]+'%'};return _0x5aaabf;})});}_0x510148=_[_0x9d47('0x3b')]({},_0x510148,_0x41e186[_0x9d47('0x3d')]);return _0x41a5d3[_0x9d47('0x4c')](_0x510148);}})['then'](function(_0x12bbab){if(_0x12bbab){_0x453eb1=_0x12bbab['length'];if(!_0x41e186[_0x9d47('0x2c')]['hasOwnProperty'](_0x9d47('0x35'))){_0x510148[_0x9d47('0x1c')]=qs[_0x9d47('0x1c')](_0x41e186[_0x9d47('0x2c')][_0x9d47('0x1c')]);_0x510148[_0x9d47('0x1e')]=qs[_0x9d47('0x1e')](_0x41e186[_0x9d47('0x2c')][_0x9d47('0x1e')]);}return _0x41a5d3[_0x9d47('0x4c')](_0x510148);}})['then'](function(_0x2b1ae0){if(_0x2b1ae0){return _0x2b1ae0?{'count':_0x453eb1,'rows':_0x2b1ae0}:null;}})[_0x9d47('0x25')](respondWithResult(_0x5ea479,null))[_0x9d47('0x47')](handleError(_0x5ea479,null));};exports['getSubjects']=function(_0x11b278,_0x624636,_0x2f4e34){var _0x47f1eb={};var _0x3ef346={};var _0x5977ce;var _0x4f2cbb;return db['ZendeskConfiguration'][_0x9d47('0x4a')]({'where':{'id':_0x11b278[_0x9d47('0x44')]['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x624636,null))['then'](function(_0x2400ac){if(_0x2400ac){_0x5977ce=_0x2400ac;_0x3ef346[_0x9d47('0x30')]=_['keys'](db['ZendeskField'][_0x9d47('0x45')]);_0x3ef346[_0x9d47('0x2c')]=_['keys'](_0x11b278[_0x9d47('0x2c')]);_0x3ef346[_0x9d47('0x2e')]=_[_0x9d47('0x2f')](_0x3ef346['model'],_0x3ef346[_0x9d47('0x2c')]);_0x47f1eb[_0x9d47('0x31')]=_[_0x9d47('0x2f')](_0x3ef346[_0x9d47('0x30')],qs['fields'](_0x11b278[_0x9d47('0x2c')]['fields']));_0x47f1eb[_0x9d47('0x31')]=_0x47f1eb[_0x9d47('0x31')][_0x9d47('0x33')]?_0x47f1eb[_0x9d47('0x31')]:_0x3ef346[_0x9d47('0x30')];_0x47f1eb[_0x9d47('0x36')]=qs['sort'](_0x11b278[_0x9d47('0x2c')][_0x9d47('0x37')]);_0x47f1eb[_0x9d47('0x38')]=qs['filters'](_['pick'](_0x11b278[_0x9d47('0x2c')],_0x3ef346['filters']));if(_0x11b278[_0x9d47('0x2c')][_0x9d47('0x3a')]){_0x47f1eb[_0x9d47('0x38')]=_[_0x9d47('0x3b')](_0x47f1eb[_0x9d47('0x38')],{'$or':_[_0x9d47('0x29')](_0x47f1eb[_0x9d47('0x31')],function(_0x2e5721){var _0x6dfbf2={};_0x6dfbf2[_0x2e5721]={'$like':'%'+_0x11b278[_0x9d47('0x2c')][_0x9d47('0x3a')]+'%'};return _0x6dfbf2;})});}_0x47f1eb=_[_0x9d47('0x3b')]({},_0x47f1eb,_0x11b278['options']);return _0x5977ce[_0x9d47('0x4d')](_0x47f1eb);}})['then'](function(_0x31bb04){if(_0x31bb04){_0x4f2cbb=_0x31bb04[_0x9d47('0x33')];if(!_0x11b278[_0x9d47('0x2c')]['hasOwnProperty'](_0x9d47('0x35'))){_0x47f1eb[_0x9d47('0x1c')]=qs[_0x9d47('0x1c')](_0x11b278[_0x9d47('0x2c')]['limit']);_0x47f1eb[_0x9d47('0x1e')]=qs[_0x9d47('0x1e')](_0x11b278[_0x9d47('0x2c')][_0x9d47('0x1e')]);}return _0x5977ce['getSubjects'](_0x47f1eb);}})[_0x9d47('0x25')](function(_0x4564a7){if(_0x4564a7){return _0x4564a7?{'count':_0x4f2cbb,'rows':_0x4564a7}:null;}})[_0x9d47('0x25')](respondWithResult(_0x624636,null))['catch'](handleError(_0x624636,null));};exports['getDescriptions']=function(_0x212eb7,_0x10d04b,_0x4871f2){var _0x20520e={};var _0x4304b1={};var _0x1a2c0c;var _0x4cdc09;return db[_0x9d47('0x3e')][_0x9d47('0x4a')]({'where':{'id':_0x212eb7['params']['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x10d04b,null))[_0x9d47('0x25')](function(_0x53d6c2){if(_0x53d6c2){_0x1a2c0c=_0x53d6c2;_0x4304b1[_0x9d47('0x30')]=_['keys'](db[_0x9d47('0x4b')][_0x9d47('0x45')]);_0x4304b1[_0x9d47('0x2c')]=_[_0x9d47('0x2d')](_0x212eb7['query']);_0x4304b1['filters']=_[_0x9d47('0x2f')](_0x4304b1[_0x9d47('0x30')],_0x4304b1[_0x9d47('0x2c')]);_0x20520e['attributes']=_[_0x9d47('0x2f')](_0x4304b1[_0x9d47('0x30')],qs['fields'](_0x212eb7[_0x9d47('0x2c')][_0x9d47('0x32')]));_0x20520e[_0x9d47('0x31')]=_0x20520e[_0x9d47('0x31')][_0x9d47('0x33')]?_0x20520e[_0x9d47('0x31')]:_0x4304b1[_0x9d47('0x30')];_0x20520e[_0x9d47('0x36')]=qs[_0x9d47('0x37')](_0x212eb7[_0x9d47('0x2c')]['sort']);_0x20520e[_0x9d47('0x38')]=qs[_0x9d47('0x2e')](_[_0x9d47('0x39')](_0x212eb7['query'],_0x4304b1[_0x9d47('0x2e')]));if(_0x212eb7['query']['filter']){_0x20520e[_0x9d47('0x38')]=_[_0x9d47('0x3b')](_0x20520e[_0x9d47('0x38')],{'$or':_[_0x9d47('0x29')](_0x20520e[_0x9d47('0x31')],function(_0x2c7a0a){var _0x9d1428={};_0x9d1428[_0x2c7a0a]={'$like':'%'+_0x212eb7[_0x9d47('0x2c')][_0x9d47('0x3a')]+'%'};return _0x9d1428;})});}_0x20520e=_[_0x9d47('0x3b')]({},_0x20520e,_0x212eb7[_0x9d47('0x3d')]);return _0x1a2c0c[_0x9d47('0x4e')](_0x20520e);}})['then'](function(_0x5672f2){if(_0x5672f2){_0x4cdc09=_0x5672f2[_0x9d47('0x33')];if(!_0x212eb7['query'][_0x9d47('0x34')](_0x9d47('0x35'))){_0x20520e['limit']=qs['limit'](_0x212eb7[_0x9d47('0x2c')]['limit']);_0x20520e[_0x9d47('0x1e')]=qs[_0x9d47('0x1e')](_0x212eb7[_0x9d47('0x2c')][_0x9d47('0x1e')]);}return _0x1a2c0c[_0x9d47('0x4e')](_0x20520e);}})[_0x9d47('0x25')](function(_0x5d2c4b){if(_0x5d2c4b){return _0x5d2c4b?{'count':_0x4cdc09,'rows':_0x5d2c4b}:null;}})[_0x9d47('0x25')](respondWithResult(_0x10d04b,null))[_0x9d47('0x47')](handleError(_0x10d04b,null));};exports[_0x9d47('0x4f')]=function(_0x1469b0,_0x48e68c,_0xabdb0a){var _0x2c77df={};var _0x35adf2={};var _0x3d5e70;var _0x317911;return db[_0x9d47('0x3e')][_0x9d47('0x4a')]({'where':{'id':_0x1469b0[_0x9d47('0x44')]['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x48e68c,null))['then'](function(_0x9a0eb4){if(_0x9a0eb4){_0x3d5e70=_0x9a0eb4;_0x35adf2[_0x9d47('0x30')]=_[_0x9d47('0x2d')](db[_0x9d47('0x50')]['rawAttributes']);_0x35adf2['query']=_[_0x9d47('0x2d')](_0x1469b0[_0x9d47('0x2c')]);_0x35adf2['filters']=_[_0x9d47('0x2f')](_0x35adf2[_0x9d47('0x30')],_0x35adf2[_0x9d47('0x2c')]);_0x2c77df[_0x9d47('0x31')]=_[_0x9d47('0x2f')](_0x35adf2['model'],qs[_0x9d47('0x32')](_0x1469b0['query'][_0x9d47('0x32')]));_0x2c77df[_0x9d47('0x31')]=_0x2c77df['attributes'][_0x9d47('0x33')]?_0x2c77df[_0x9d47('0x31')]:_0x35adf2[_0x9d47('0x30')];_0x2c77df['order']=qs[_0x9d47('0x37')](_0x1469b0[_0x9d47('0x2c')][_0x9d47('0x37')]);_0x2c77df[_0x9d47('0x38')]=qs[_0x9d47('0x2e')](_['pick'](_0x1469b0[_0x9d47('0x2c')],_0x35adf2['filters']));if(_0x1469b0[_0x9d47('0x2c')][_0x9d47('0x3a')]){_0x2c77df['where']=_[_0x9d47('0x3b')](_0x2c77df[_0x9d47('0x38')],{'$or':_[_0x9d47('0x29')](_0x2c77df[_0x9d47('0x31')],function(_0x137c42){var _0x41e6eb={};_0x41e6eb[_0x137c42]={'$like':'%'+_0x1469b0['query'][_0x9d47('0x3a')]+'%'};return _0x41e6eb;})});}_0x2c77df=_[_0x9d47('0x3b')]({},_0x2c77df,_0x1469b0[_0x9d47('0x3d')]);return _0x3d5e70[_0x9d47('0x4f')](_0x2c77df);}})['then'](function(_0x36a480){if(_0x36a480){_0x317911=_0x36a480[_0x9d47('0x33')];if(!_0x1469b0[_0x9d47('0x2c')]['hasOwnProperty'](_0x9d47('0x35'))){_0x2c77df[_0x9d47('0x1c')]=qs[_0x9d47('0x1c')](_0x1469b0[_0x9d47('0x2c')]['limit']);_0x2c77df[_0x9d47('0x1e')]=qs[_0x9d47('0x1e')](_0x1469b0['query'][_0x9d47('0x1e')]);}return _0x3d5e70[_0x9d47('0x4f')](_0x2c77df);}})['then'](function(_0xbd201d){if(_0xbd201d){return _0xbd201d?{'count':_0x317911,'rows':_0xbd201d}:null;}})[_0x9d47('0x25')](respondWithResult(_0x48e68c,null))[_0x9d47('0x47')](handleError(_0x48e68c,null));};exports[_0x9d47('0x51')]=function(_0x177852,_0x1e011e,_0x1deff4){if(_0x177852[_0x9d47('0x49')]['id']){delete _0x177852['body']['id'];}return db[_0x9d47('0x3e')]['findOne']({'where':{'id':_0x177852[_0x9d47('0x44')]['id']}})[_0x9d47('0x25')](handleEntityNotFound(_0x1e011e,null))[_0x9d47('0x25')](function(_0xc078a1){if(_0xc078a1){return _0xc078a1['setTags'](_0x177852[_0x9d47('0x49')]['ids']||[]);}return null;})[_0x9d47('0x25')](respondWithResult(_0x1e011e,null))[_0x9d47('0x47')](handleError(_0x1e011e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a8c6ab3..3d89a92 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 _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x555161,_0x2cd1ed){var _0x4919e9=function(_0x23226b){while(--_0x23226b){_0x555161['push'](_0x555161['shift']());}};_0x4919e9(++_0x2cd1ed);}(_0xe820,0xd2));var _0x0e82=function(_0x3f761c,_0x2f7971){_0x3f761c=_0x3f761c-0x0;var _0xb05859=_0xe820[_0x3f761c];return _0xb05859;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x19bf63,_0xa33a53){var _0x1abfd5=function(_0x453877){while(--_0x453877){_0x19bf63['push'](_0x19bf63['shift']());}};_0x1abfd5(++_0xa33a53);}(_0x14a0,0x8e));var _0x014a=function(_0x5743e0,_0xbb65ce){_0x5743e0=_0x5743e0-0x0;var _0x4046b3=_0x14a0[_0x5743e0];return _0x4046b3;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 658f145..0406ebf 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 _0x9732=['http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x104685,_0x131c93){var _0x1cfa74=function(_0x154a75){while(--_0x154a75){_0x104685['push'](_0x104685['shift']());}};_0x1cfa74(++_0x131c93);}(_0x9732,0xcd));var _0x2973=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x9732[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x2973('0x0'));var util=require(_0x2973('0x1'));var moment=require(_0x2973('0x2'));var BPromise=require(_0x2973('0x3'));var rs=require(_0x2973('0x4'));var fs=require('fs');var Redis=require(_0x2973('0x5'));var db=require(_0x2973('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2973('0x7'))('rpc');var config=require(_0x2973('0x8'));var jayson=require(_0x2973('0x9'));var client=jayson[_0x2973('0xa')][_0x2973('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1462d7,_0x1ae4c5,_0x3f74d6){return new BPromise(function(_0x141f0d,_0x5590bc){return client[_0x2973('0xc')](_0x1462d7,_0x3f74d6)[_0x2973('0xd')](function(_0x3fbfdc){logger['info'](_0x2973('0xe'),_0x1ae4c5,_0x2973('0xf'));logger[_0x2973('0x10')](_0x2973('0x11'),_0x1ae4c5,'request\x20sent',JSON[_0x2973('0x12')](_0x3fbfdc));if(_0x3fbfdc[_0x2973('0x13')]){if(_0x3fbfdc[_0x2973('0x13')][_0x2973('0x14')]===0x1f4){logger['error'](_0x2973('0xe'),_0x1ae4c5,_0x3fbfdc[_0x2973('0x13')]['message']);return _0x5590bc(_0x3fbfdc[_0x2973('0x13')][_0x2973('0x15')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x1ae4c5,_0x3fbfdc[_0x2973('0x13')][_0x2973('0x15')]);return _0x141f0d(_0x3fbfdc[_0x2973('0x13')][_0x2973('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1ae4c5,_0x2973('0xf'));_0x141f0d(_0x3fbfdc[_0x2973('0x16')][_0x2973('0x15')]);}})[_0x2973('0x17')](function(_0x5ba83b){logger[_0x2973('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ae4c5,_0x5ba83b);_0x5590bc(_0x5ba83b);});});} \ No newline at end of file +var _0x9bc2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9bc2,0x1c6));var _0x29bc=function(_0x1241b6,_0x218048){_0x1241b6=_0x1241b6-0x0;var _0x197c2a=_0x9bc2[_0x1241b6];return _0x197c2a;};'use strict';var _=require(_0x29bc('0x0'));var util=require('util');var moment=require(_0x29bc('0x1'));var BPromise=require(_0x29bc('0x2'));var rs=require(_0x29bc('0x3'));var fs=require('fs');var Redis=require(_0x29bc('0x4'));var db=require(_0x29bc('0x5'))['db'];var utils=require(_0x29bc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29bc('0x7'));var jayson=require(_0x29bc('0x8'));var client=jayson['client'][_0x29bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54e9a1,_0x2ed780,_0x2d6d1e){return new BPromise(function(_0x2c0278,_0x741c24){return client['request'](_0x54e9a1,_0x2d6d1e)[_0x29bc('0xa')](function(_0x30c1f3){logger[_0x29bc('0xb')](_0x29bc('0xc'),_0x2ed780,_0x29bc('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2ed780,_0x29bc('0xd'),JSON['stringify'](_0x30c1f3));if(_0x30c1f3['error']){if(_0x30c1f3[_0x29bc('0xe')][_0x29bc('0xf')]===0x1f4){logger[_0x29bc('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2ed780,_0x30c1f3[_0x29bc('0xe')]['message']);return _0x741c24(_0x30c1f3[_0x29bc('0xe')][_0x29bc('0x10')]);}logger[_0x29bc('0xe')](_0x29bc('0xc'),_0x2ed780,_0x30c1f3[_0x29bc('0xe')][_0x29bc('0x10')]);return _0x2c0278(_0x30c1f3[_0x29bc('0xe')][_0x29bc('0x10')]);}else{logger[_0x29bc('0xb')](_0x29bc('0xc'),_0x2ed780,_0x29bc('0xd'));_0x2c0278(_0x30c1f3[_0x29bc('0x11')][_0x29bc('0x10')]);}})[_0x29bc('0x12')](function(_0x270933){logger[_0x29bc('0xe')](_0x29bc('0xc'),_0x2ed780,_0x270933);_0x741c24(_0x270933);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3487d4c..f1ff7f8 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 _0xec22=['index','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x4cf8c4,_0x4e7dfc){var _0x2a6909=function(_0x4e180b){while(--_0x4e180b){_0x4cf8c4['push'](_0x4cf8c4['shift']());}};_0x2a6909(++_0x4e7dfc);}(_0xec22,0xf1));var _0x2ec2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xec22[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x2ec2('0x0'));var util=require(_0x2ec2('0x1'));var path=require(_0x2ec2('0x2'));var timeout=require(_0x2ec2('0x3'));var express=require('express');var router=express[_0x2ec2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2ec2('0x5'));var interaction=require(_0x2ec2('0x6'));var config=require(_0x2ec2('0x7'));var controller=require(_0x2ec2('0x8'));router[_0x2ec2('0x9')]('/',auth[_0x2ec2('0xa')](),controller[_0x2ec2('0xb')]);router[_0x2ec2('0x9')]('/:id',auth[_0x2ec2('0xa')](),controller['show']);router['post']('/',auth[_0x2ec2('0xa')](),controller[_0x2ec2('0xc')]);router[_0x2ec2('0xd')]('/:id',auth[_0x2ec2('0xa')](),controller[_0x2ec2('0xe')]);router[_0x2ec2('0xf')](_0x2ec2('0x10'),auth[_0x2ec2('0xa')](),controller['destroy']);module[_0x2ec2('0x11')]=router; \ No newline at end of file +var _0xbb73=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put'];(function(_0x328860,_0x40c91b){var _0x514563=function(_0x145a46){while(--_0x145a46){_0x328860['push'](_0x328860['shift']());}};_0x514563(++_0x40c91b);}(_0xbb73,0x181));var _0x3bb7=function(_0x3c1c12,_0x43c47c){_0x3c1c12=_0x3c1c12-0x0;var _0x253095=_0xbb73[_0x3c1c12];return _0x253095;};'use strict';var multer=require(_0x3bb7('0x0'));var util=require(_0x3bb7('0x1'));var path=require(_0x3bb7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3bb7('0x3'));var router=express[_0x3bb7('0x4')]();var fs_extra=require(_0x3bb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3bb7('0x6'));var config=require(_0x3bb7('0x7'));var controller=require('./intZendeskField.controller');router[_0x3bb7('0x8')]('/',auth[_0x3bb7('0x9')](),controller[_0x3bb7('0xa')]);router[_0x3bb7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3bb7('0xb')]);router['post']('/',auth[_0x3bb7('0x9')](),controller[_0x3bb7('0xc')]);router[_0x3bb7('0xd')](_0x3bb7('0xe'),auth[_0x3bb7('0x9')](),controller[_0x3bb7('0xf')]);router[_0x3bb7('0x10')](_0x3bb7('0xe'),auth[_0x3bb7('0x9')](),controller[_0x3bb7('0x11')]);module[_0x3bb7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 32ca9aa..bef4559 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 _0xf837=['string','STRING','ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue'];(function(_0x4853a2,_0xa7fdae){var _0x4d2600=function(_0x4cf3db){while(--_0x4cf3db){_0x4853a2['push'](_0x4853a2['shift']());}};_0x4d2600(++_0xa7fdae);}(_0xf837,0x1f4));var _0x7f83=function(_0x32569d,_0x58f9de){_0x32569d=_0x32569d-0x0;var _0x52dabf=_0xf837[_0x32569d];return _0x52dabf;};'use strict';var Sequelize=require(_0x7f83('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x7f83('0x1'),_0x7f83('0x2'),_0x7f83('0x3'),'picklist'),'defaultValue':_0x7f83('0x4')},'content':{'type':Sequelize[_0x7f83('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7f83('0x6')](_0x7f83('0x4'),_0x7f83('0x1'),_0x7f83('0x2'))},'keyContent':{'type':Sequelize[_0x7f83('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7f83('0x5')]},'customField':{'type':Sequelize[_0x7f83('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f83('0x5')]}}; \ No newline at end of file +var _0x2682=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x56652a,_0x483c43){var _0x4eff84=function(_0x16380f){while(--_0x16380f){_0x56652a['push'](_0x56652a['shift']());}};_0x4eff84(++_0x483c43);}(_0x2682,0x180));var _0x2268=function(_0x1964de,_0x4c169e){_0x1964de=_0x1964de-0x0;var _0x5bd015=_0x2682[_0x1964de];return _0x5bd015;};'use strict';var Sequelize=require(_0x2268('0x0'));module[_0x2268('0x1')]={'type':{'type':Sequelize[_0x2268('0x2')]('string',_0x2268('0x3'),_0x2268('0x4'),_0x2268('0x5'),_0x2268('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2268('0x7')]},'key':{'type':Sequelize[_0x2268('0x7')]},'keyType':{'type':Sequelize[_0x2268('0x2')]('string','variable',_0x2268('0x4'))},'keyContent':{'type':Sequelize[_0x2268('0x7')]},'idField':{'type':Sequelize[_0x2268('0x7')]},'nameField':{'type':Sequelize[_0x2268('0x7')]},'customField':{'type':Sequelize[_0x2268('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2268('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d095306..59ffce5 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 _0x61e6=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','include','catch','params','includeAll','options','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x16a599,_0x4e9cec){var _0x218dc=function(_0x4b7654){while(--_0x4b7654){_0x16a599['push'](_0x16a599['shift']());}};_0x218dc(++_0x4e9cec);}(_0x61e6,0x1a3));var _0x661e=function(_0x1aeeae,_0x185a30){_0x1aeeae=_0x1aeeae-0x0;var _0x40b0c7=_0x61e6[_0x1aeeae];return _0x40b0c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x661e('0x0'));var jsonpatch=require(_0x661e('0x1'));var rp=require(_0x661e('0x2'));var moment=require(_0x661e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x661e('0x4'));var util=require(_0x661e('0x5'));var path=require(_0x661e('0x6'));var sox=require(_0x661e('0x7'));var csv=require(_0x661e('0x8'));var ejs=require(_0x661e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x661e('0xa'));var squel=require(_0x661e('0xb'));var crypto=require(_0x661e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x661e('0x8'));var querystring=require(_0x661e('0xd'));var Papa=require(_0x661e('0xe'));var Redis=require(_0x661e('0xf'));var authService=require(_0x661e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x661e('0x11'));var logger=require(_0x661e('0x12'))('api');var utils=require(_0x661e('0x13'));var config=require(_0x661e('0x14'));var licenseUtil=require(_0x661e('0x15'));var db=require(_0x661e('0x16'))['db'];function respondWithStatusCode(_0x2e4e9f,_0x43ac63){_0x43ac63=_0x43ac63||0xcc;return function(_0x51b32e){if(_0x51b32e){return _0x2e4e9f[_0x661e('0x17')](_0x43ac63);}return _0x2e4e9f[_0x661e('0x18')](_0x43ac63)['end']();};}function respondWithResult(_0x2c39ea,_0x376511){_0x376511=_0x376511||0xc8;return function(_0x3c3326){if(_0x3c3326){return _0x2c39ea[_0x661e('0x18')](_0x376511)[_0x661e('0x19')](_0x3c3326);}};}function respondWithFilteredResult(_0xe79a13,_0x852e1){return function(_0x3f2096){if(_0x3f2096){var _0x5a61f9=typeof _0x852e1['offset']==='undefined'&&typeof _0x852e1[_0x661e('0x1a')]===_0x661e('0x1b');var _0x360473=_0x3f2096['count'];var _0x50079a=_0x5a61f9?0x0:_0x852e1[_0x661e('0x1c')];var _0x2b0107=_0x5a61f9?_0x3f2096['count']:_0x852e1['offset']+_0x852e1[_0x661e('0x1a')];var _0x2836d5;if(_0x2b0107>=_0x360473){_0x2b0107=_0x360473;_0x2836d5=0xc8;}else{_0x2836d5=0xce;}_0xe79a13[_0x661e('0x18')](_0x2836d5);return _0xe79a13['set'](_0x661e('0x1d'),_0x50079a+'-'+_0x2b0107+'/'+_0x360473)[_0x661e('0x19')](_0x3f2096);}return null;};}function patchUpdates(_0x1b8fc7){return function(_0x2218aa){try{jsonpatch[_0x661e('0x1e')](_0x2218aa,_0x1b8fc7,!![]);}catch(_0x488281){return BPromise[_0x661e('0x1f')](_0x488281);}return _0x2218aa[_0x661e('0x20')]();};}function saveUpdates(_0x5df9ba,_0x5dda67){return function(_0x201fb1){if(_0x201fb1){return _0x201fb1[_0x661e('0x21')](_0x5df9ba)[_0x661e('0x22')](function(_0x360743){return _0x360743;});}return null;};}function removeEntity(_0x42fb11,_0x16fc53){return function(_0x284fdd){if(_0x284fdd){return _0x284fdd[_0x661e('0x23')]()[_0x661e('0x22')](function(){_0x42fb11[_0x661e('0x18')](0xcc)[_0x661e('0x24')]();});}};}function handleEntityNotFound(_0x4d717e,_0x3f9308){return function(_0x2d014a){if(!_0x2d014a){_0x4d717e[_0x661e('0x17')](0x194);}return _0x2d014a;};}function handleError(_0xb0c95b,_0x188f0a){_0x188f0a=_0x188f0a||0x1f4;return function(_0x5ece15){logger[_0x661e('0x25')](_0x5ece15[_0x661e('0x26')]);if(_0x5ece15[_0x661e('0x27')]){delete _0x5ece15[_0x661e('0x27')];}_0xb0c95b[_0x661e('0x18')](_0x188f0a)[_0x661e('0x28')](_0x5ece15);};}exports[_0x661e('0x29')]=function(_0xc410fe,_0xdebda0){var _0x2e18dd={},_0xb5da42={},_0x40f5df={'count':0x0,'rows':[]};var _0x3b75ef=_[_0x661e('0x2a')](db[_0x661e('0x2b')][_0x661e('0x2c')],function(_0x3c9b23){return{'name':_0x3c9b23['fieldName'],'type':_0x3c9b23[_0x661e('0x2d')][_0x661e('0x2e')]};});_0xb5da42['model']=_[_0x661e('0x2a')](_0x3b75ef,_0x661e('0x27'));_0xb5da42[_0x661e('0x2f')]=_[_0x661e('0x30')](_0xc410fe[_0x661e('0x2f')]);_0xb5da42[_0x661e('0x31')]=_[_0x661e('0x32')](_0xb5da42[_0x661e('0x33')],_0xb5da42['query']);_0x2e18dd[_0x661e('0x34')]=_[_0x661e('0x32')](_0xb5da42['model'],qs[_0x661e('0x35')](_0xc410fe[_0x661e('0x2f')][_0x661e('0x35')]));_0x2e18dd[_0x661e('0x34')]=_0x2e18dd[_0x661e('0x34')][_0x661e('0x36')]?_0x2e18dd[_0x661e('0x34')]:_0xb5da42['model'];if(!_0xc410fe[_0x661e('0x2f')][_0x661e('0x37')](_0x661e('0x38'))){_0x2e18dd[_0x661e('0x1a')]=qs['limit'](_0xc410fe['query'][_0x661e('0x1a')]);_0x2e18dd[_0x661e('0x1c')]=qs[_0x661e('0x1c')](_0xc410fe[_0x661e('0x2f')][_0x661e('0x1c')]);}_0x2e18dd[_0x661e('0x39')]=qs[_0x661e('0x3a')](_0xc410fe[_0x661e('0x2f')][_0x661e('0x3a')]);_0x2e18dd['where']=qs[_0x661e('0x31')](_[_0x661e('0x3b')](_0xc410fe[_0x661e('0x2f')],_0xb5da42[_0x661e('0x31')]),_0x3b75ef);if(_0xc410fe[_0x661e('0x2f')]['filter']){_0x2e18dd[_0x661e('0x3c')]=_[_0x661e('0x3d')](_0x2e18dd['where'],{'$or':_[_0x661e('0x2a')](_0x3b75ef,function(_0x28d7fa){if(_0x28d7fa[_0x661e('0x2d')]!==_0x661e('0x3e')){var _0x11aac8={};_0x11aac8[_0x28d7fa['name']]={'$like':'%'+_0xc410fe[_0x661e('0x2f')][_0x661e('0x3f')]+'%'};return _0x11aac8;}})});}_0x2e18dd=_[_0x661e('0x3d')]({},_0x2e18dd,_0xc410fe['options']);var _0x5551c5={'where':_0x2e18dd[_0x661e('0x3c')]};return db['ZendeskField'][_0x661e('0x40')](_0x5551c5)[_0x661e('0x22')](function(_0x27b03e){_0x40f5df[_0x661e('0x40')]=_0x27b03e;if(_0xc410fe[_0x661e('0x2f')]['includeAll']){_0x2e18dd[_0x661e('0x41')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x2e18dd);})[_0x661e('0x22')](function(_0x59e2d8){_0x40f5df['rows']=_0x59e2d8;return _0x40f5df;})[_0x661e('0x22')](respondWithFilteredResult(_0xdebda0,_0x2e18dd))[_0x661e('0x42')](handleError(_0xdebda0,null));};exports['show']=function(_0x3a8736,_0x18d34c){var _0x2beb28={'raw':!![],'where':{'id':_0x3a8736[_0x661e('0x43')]['id']}},_0x56a462={};_0x56a462['model']=_['keys'](db[_0x661e('0x2b')]['rawAttributes']);_0x56a462[_0x661e('0x2f')]=_[_0x661e('0x30')](_0x3a8736[_0x661e('0x2f')]);_0x56a462['filters']=_[_0x661e('0x32')](_0x56a462['model'],_0x56a462[_0x661e('0x2f')]);_0x2beb28[_0x661e('0x34')]=_['intersection'](_0x56a462[_0x661e('0x33')],qs[_0x661e('0x35')](_0x3a8736['query'][_0x661e('0x35')]));_0x2beb28[_0x661e('0x34')]=_0x2beb28[_0x661e('0x34')]['length']?_0x2beb28[_0x661e('0x34')]:_0x56a462[_0x661e('0x33')];if(_0x3a8736[_0x661e('0x2f')][_0x661e('0x44')]){_0x2beb28[_0x661e('0x41')]=[{'all':!![]}];}_0x2beb28=_['merge']({},_0x2beb28,_0x3a8736[_0x661e('0x45')]);return db['ZendeskField']['find'](_0x2beb28)[_0x661e('0x22')](handleEntityNotFound(_0x18d34c,null))['then'](respondWithResult(_0x18d34c,null))[_0x661e('0x42')](handleError(_0x18d34c,null));};exports[_0x661e('0x46')]=function(_0x693c20,_0x57e84f){return db[_0x661e('0x2b')][_0x661e('0x46')](_0x693c20['body'],{})[_0x661e('0x22')](respondWithResult(_0x57e84f,0xc9))[_0x661e('0x42')](handleError(_0x57e84f,null));};exports[_0x661e('0x21')]=function(_0x47412f,_0x39fccf){if(_0x47412f['body']['id']){delete _0x47412f[_0x661e('0x47')]['id'];}return db[_0x661e('0x2b')]['find']({'where':{'id':_0x47412f[_0x661e('0x43')]['id']}})[_0x661e('0x22')](handleEntityNotFound(_0x39fccf,null))[_0x661e('0x22')](saveUpdates(_0x47412f['body'],null))[_0x661e('0x22')](respondWithResult(_0x39fccf,null))['catch'](handleError(_0x39fccf,null));};exports[_0x661e('0x23')]=function(_0x404772,_0x2cc958){return db['ZendeskField']['find']({'where':{'id':_0x404772[_0x661e('0x43')]['id']}})[_0x661e('0x22')](handleEntityNotFound(_0x2cc958,null))[_0x661e('0x22')](removeEntity(_0x2cc958,null))['catch'](handleError(_0x2cc958,null));}; \ No newline at end of file +var _0x2d57=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2d57,0xaf));var _0x72d5=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x2d57[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72d5('0x0'));var zipdir=require(_0x72d5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x72d5('0x2'));var Mustache=require(_0x72d5('0x3'));var util=require('util');var path=require(_0x72d5('0x4'));var sox=require('sox');var csv=require(_0x72d5('0x5'));var ejs=require(_0x72d5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x72d5('0x7'));var crypto=require(_0x72d5('0x8'));var jsforce=require(_0x72d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x72d5('0x5'));var querystring=require(_0x72d5('0xa'));var Papa=require(_0x72d5('0xb'));var Redis=require('ioredis');var authService=require(_0x72d5('0xc'));var qs=require(_0x72d5('0xd'));var as=require(_0x72d5('0xe'));var hardwareService=require(_0x72d5('0xf'));var logger=require(_0x72d5('0x10'))(_0x72d5('0x11'));var utils=require(_0x72d5('0x12'));var config=require(_0x72d5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x72d5('0x14'))['db'];function respondWithStatusCode(_0x5e00af,_0x2952d4){_0x2952d4=_0x2952d4||0xcc;return function(_0x20ec81){if(_0x20ec81){return _0x5e00af['sendStatus'](_0x2952d4);}return _0x5e00af['status'](_0x2952d4)['end']();};}function respondWithResult(_0x322bf3,_0xcbaaed){_0xcbaaed=_0xcbaaed||0xc8;return function(_0x283bda){if(_0x283bda){return _0x322bf3[_0x72d5('0x15')](_0xcbaaed)[_0x72d5('0x16')](_0x283bda);}};}function respondWithFilteredResult(_0x1164d3,_0x74c0fd){return function(_0x32467f){if(_0x32467f){var _0x46e001=typeof _0x74c0fd[_0x72d5('0x17')]===_0x72d5('0x18')&&typeof _0x74c0fd[_0x72d5('0x19')]==='undefined';var _0x2cb069=_0x32467f[_0x72d5('0x1a')];var _0x529711=_0x46e001?0x0:_0x74c0fd[_0x72d5('0x17')];var _0x50aa74=_0x46e001?_0x32467f[_0x72d5('0x1a')]:_0x74c0fd['offset']+_0x74c0fd[_0x72d5('0x19')];var _0x157e9a;if(_0x50aa74>=_0x2cb069){_0x50aa74=_0x2cb069;_0x157e9a=0xc8;}else{_0x157e9a=0xce;}_0x1164d3['status'](_0x157e9a);return _0x1164d3[_0x72d5('0x1b')](_0x72d5('0x1c'),_0x529711+'-'+_0x50aa74+'/'+_0x2cb069)[_0x72d5('0x16')](_0x32467f);}return null;};}function patchUpdates(_0x2ae116){return function(_0x5702d3){try{jsonpatch[_0x72d5('0x1d')](_0x5702d3,_0x2ae116,!![]);}catch(_0x3887b7){return BPromise[_0x72d5('0x1e')](_0x3887b7);}return _0x5702d3[_0x72d5('0x1f')]();};}function saveUpdates(_0x363fa8,_0x345df6){return function(_0x5963c8){if(_0x5963c8){return _0x5963c8[_0x72d5('0x20')](_0x363fa8)[_0x72d5('0x21')](function(_0x98c5f2){return _0x98c5f2;});}return null;};}function removeEntity(_0x4cf8e3,_0x1ffe5a){return function(_0x3f4b2f){if(_0x3f4b2f){return _0x3f4b2f[_0x72d5('0x22')]()[_0x72d5('0x21')](function(){_0x4cf8e3[_0x72d5('0x15')](0xcc)[_0x72d5('0x23')]();});}};}function handleEntityNotFound(_0xa771ab,_0x1ae7d8){return function(_0x2bd06d){if(!_0x2bd06d){_0xa771ab[_0x72d5('0x24')](0x194);}return _0x2bd06d;};}function handleError(_0x40565b,_0x7fd3a8){_0x7fd3a8=_0x7fd3a8||0x1f4;return function(_0x1d5209){logger[_0x72d5('0x25')](_0x1d5209[_0x72d5('0x26')]);if(_0x1d5209[_0x72d5('0x27')]){delete _0x1d5209[_0x72d5('0x27')];}_0x40565b[_0x72d5('0x15')](_0x7fd3a8)[_0x72d5('0x28')](_0x1d5209);};}exports[_0x72d5('0x29')]=function(_0x46a81d,_0x203fdf){var _0x120775={},_0x26d1fe={},_0x4d5aa2={'count':0x0,'rows':[]};var _0x1f3f56=_[_0x72d5('0x2a')](db[_0x72d5('0x2b')][_0x72d5('0x2c')],function(_0x191a93){return{'name':_0x191a93[_0x72d5('0x2d')],'type':_0x191a93['type'][_0x72d5('0x2e')]};});_0x26d1fe[_0x72d5('0x2f')]=_[_0x72d5('0x2a')](_0x1f3f56,_0x72d5('0x27'));_0x26d1fe['query']=_[_0x72d5('0x30')](_0x46a81d['query']);_0x26d1fe[_0x72d5('0x31')]=_[_0x72d5('0x32')](_0x26d1fe['model'],_0x26d1fe[_0x72d5('0x33')]);_0x120775[_0x72d5('0x34')]=_[_0x72d5('0x32')](_0x26d1fe[_0x72d5('0x2f')],qs['fields'](_0x46a81d[_0x72d5('0x33')][_0x72d5('0x35')]));_0x120775[_0x72d5('0x34')]=_0x120775['attributes'][_0x72d5('0x36')]?_0x120775[_0x72d5('0x34')]:_0x26d1fe[_0x72d5('0x2f')];if(!_0x46a81d['query'][_0x72d5('0x37')](_0x72d5('0x38'))){_0x120775['limit']=qs['limit'](_0x46a81d['query'][_0x72d5('0x19')]);_0x120775['offset']=qs[_0x72d5('0x17')](_0x46a81d[_0x72d5('0x33')][_0x72d5('0x17')]);}_0x120775[_0x72d5('0x39')]=qs[_0x72d5('0x3a')](_0x46a81d[_0x72d5('0x33')][_0x72d5('0x3a')]);_0x120775[_0x72d5('0x3b')]=qs['filters'](_['pick'](_0x46a81d[_0x72d5('0x33')],_0x26d1fe[_0x72d5('0x31')]),_0x1f3f56);if(_0x46a81d[_0x72d5('0x33')][_0x72d5('0x3c')]){_0x120775[_0x72d5('0x3b')]=_[_0x72d5('0x3d')](_0x120775[_0x72d5('0x3b')],{'$or':_[_0x72d5('0x2a')](_0x1f3f56,function(_0x631418){if(_0x631418[_0x72d5('0x3e')]!=='VIRTUAL'){var _0x6eb673={};_0x6eb673[_0x631418[_0x72d5('0x27')]]={'$like':'%'+_0x46a81d['query'][_0x72d5('0x3c')]+'%'};return _0x6eb673;}})});}_0x120775=_[_0x72d5('0x3d')]({},_0x120775,_0x46a81d[_0x72d5('0x3f')]);var _0x1f6ff1={'where':_0x120775['where']};return db[_0x72d5('0x2b')][_0x72d5('0x1a')](_0x1f6ff1)[_0x72d5('0x21')](function(_0x293135){_0x4d5aa2[_0x72d5('0x1a')]=_0x293135;if(_0x46a81d[_0x72d5('0x33')][_0x72d5('0x40')]){_0x120775['include']=[{'all':!![]}];}return db['ZendeskField'][_0x72d5('0x41')](_0x120775);})[_0x72d5('0x21')](function(_0x3aa686){_0x4d5aa2[_0x72d5('0x42')]=_0x3aa686;return _0x4d5aa2;})[_0x72d5('0x21')](respondWithFilteredResult(_0x203fdf,_0x120775))[_0x72d5('0x43')](handleError(_0x203fdf,null));};exports[_0x72d5('0x44')]=function(_0x4d1109,_0x5d1752){var _0x419389={'raw':!![],'where':{'id':_0x4d1109[_0x72d5('0x45')]['id']}},_0x4da9ca={};_0x4da9ca[_0x72d5('0x2f')]=_[_0x72d5('0x30')](db['ZendeskField'][_0x72d5('0x2c')]);_0x4da9ca['query']=_[_0x72d5('0x30')](_0x4d1109[_0x72d5('0x33')]);_0x4da9ca['filters']=_['intersection'](_0x4da9ca['model'],_0x4da9ca[_0x72d5('0x33')]);_0x419389[_0x72d5('0x34')]=_['intersection'](_0x4da9ca['model'],qs['fields'](_0x4d1109[_0x72d5('0x33')]['fields']));_0x419389[_0x72d5('0x34')]=_0x419389[_0x72d5('0x34')][_0x72d5('0x36')]?_0x419389['attributes']:_0x4da9ca['model'];if(_0x4d1109[_0x72d5('0x33')][_0x72d5('0x40')]){_0x419389[_0x72d5('0x46')]=[{'all':!![]}];}_0x419389=_[_0x72d5('0x3d')]({},_0x419389,_0x4d1109['options']);return db[_0x72d5('0x2b')][_0x72d5('0x47')](_0x419389)[_0x72d5('0x21')](handleEntityNotFound(_0x5d1752,null))['then'](respondWithResult(_0x5d1752,null))[_0x72d5('0x43')](handleError(_0x5d1752,null));};exports[_0x72d5('0x48')]=function(_0x3253ca,_0x590fca){return db[_0x72d5('0x2b')][_0x72d5('0x48')](_0x3253ca[_0x72d5('0x49')],{})['then'](respondWithResult(_0x590fca,0xc9))['catch'](handleError(_0x590fca,null));};exports[_0x72d5('0x20')]=function(_0x299314,_0xcbf54a){if(_0x299314['body']['id']){delete _0x299314[_0x72d5('0x49')]['id'];}return db['ZendeskField'][_0x72d5('0x47')]({'where':{'id':_0x299314['params']['id']}})[_0x72d5('0x21')](handleEntityNotFound(_0xcbf54a,null))['then'](saveUpdates(_0x299314[_0x72d5('0x49')],null))['then'](respondWithResult(_0xcbf54a,null))[_0x72d5('0x43')](handleError(_0xcbf54a,null));};exports['destroy']=function(_0xeed85e,_0x2bef46){return db[_0x72d5('0x2b')][_0x72d5('0x47')]({'where':{'id':_0xeed85e[_0x72d5('0x45')]['id']}})[_0x72d5('0x21')](handleEntityNotFound(_0x2bef46,null))[_0x72d5('0x21')](removeEntity(_0x2bef46,null))[_0x72d5('0x43')](handleError(_0x2bef46,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 4c8dcac..8cd092d 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 _0x70c9=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0xd00f1f,_0x25e249){var _0x409165=function(_0x240877){while(--_0x240877){_0xd00f1f['push'](_0xd00f1f['shift']());}};_0x409165(++_0x25e249);}(_0x70c9,0x148));var _0x970c=function(_0x289488,_0x22d744){_0x289488=_0x289488-0x0;var _0x16c2eb=_0x70c9[_0x289488];return _0x16c2eb;};'use strict';var _=require(_0x970c('0x0'));var util=require(_0x970c('0x1'));var logger=require(_0x970c('0x2'))(_0x970c('0x3'));var moment=require('moment');var BPromise=require(_0x970c('0x4'));var rp=require(_0x970c('0x5'));var fs=require('fs');var path=require(_0x970c('0x6'));var rimraf=require(_0x970c('0x7'));var config=require(_0x970c('0x8'));var attributes=require(_0x970c('0x9'));module[_0x970c('0xa')]=function(_0x38e5a8,_0x4c7c7d){return _0x38e5a8[_0x970c('0xb')](_0x970c('0xc'),attributes,{'tableName':_0x970c('0xd'),'paranoid':![],'indexes':[{'name':_0x970c('0xe'),'fields':[_0x970c('0xf'),_0x970c('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe48e=['path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x188d67,_0x336561){var _0x4ad472=function(_0x2f5ec0){while(--_0x2f5ec0){_0x188d67['push'](_0x188d67['shift']());}};_0x4ad472(++_0x336561);}(_0xe48e,0x141));var _0xee48=function(_0x496505,_0x2472a7){_0x496505=_0x496505-0x0;var _0x5bdfc7=_0xe48e[_0x496505];return _0x5bdfc7;};'use strict';var _=require(_0xee48('0x0'));var util=require(_0xee48('0x1'));var logger=require(_0xee48('0x2'))(_0xee48('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee48('0x4'));var rimraf=require('rimraf');var config=require(_0xee48('0x5'));var attributes=require(_0xee48('0x6'));module[_0xee48('0x7')]=function(_0x15358a,_0x47bc59){return _0x15358a[_0xee48('0x8')](_0xee48('0x9'),attributes,{'tableName':_0xee48('0xa'),'paranoid':![],'indexes':[{'name':_0xee48('0xb'),'fields':[_0xee48('0xc'),'FieldId'],'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 135adc5..2cc512f 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 _0xdc4c=['code','message','ZendeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x222f03,_0x2b95da){var _0x5061ab=function(_0x571512){while(--_0x571512){_0x222f03['push'](_0x222f03['shift']());}};_0x5061ab(++_0x2b95da);}(_0xdc4c,0x78));var _0xcdc4=function(_0x18ee48,_0x100a4b){_0x18ee48=_0x18ee48-0x0;var _0x5396d6=_0xdc4c[_0x18ee48];return _0x5396d6;};'use strict';var _=require(_0xcdc4('0x0'));var util=require(_0xcdc4('0x1'));var moment=require(_0xcdc4('0x2'));var BPromise=require(_0xcdc4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdc4('0x4'));var db=require(_0xcdc4('0x5'))['db'];var utils=require(_0xcdc4('0x6'));var logger=require('../../config/logger')(_0xcdc4('0x7'));var config=require(_0xcdc4('0x8'));var jayson=require(_0xcdc4('0x9'));var client=jayson['client'][_0xcdc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1222ce,_0x23c179,_0x353942){return new BPromise(function(_0x48ecba,_0x4851cd){return client[_0xcdc4('0xb')](_0x1222ce,_0x353942)[_0xcdc4('0xc')](function(_0x2e1ee4){logger[_0xcdc4('0xd')]('ZendeskField,\x20%s,\x20%s',_0x23c179,_0xcdc4('0xe'));logger[_0xcdc4('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x23c179,_0xcdc4('0xe'),JSON[_0xcdc4('0x10')](_0x2e1ee4));if(_0x2e1ee4[_0xcdc4('0x11')]){if(_0x2e1ee4['error'][_0xcdc4('0x12')]===0x1f4){logger[_0xcdc4('0x11')]('ZendeskField,\x20%s,\x20%s',_0x23c179,_0x2e1ee4[_0xcdc4('0x11')][_0xcdc4('0x13')]);return _0x4851cd(_0x2e1ee4['error'][_0xcdc4('0x13')]);}logger[_0xcdc4('0x11')](_0xcdc4('0x14'),_0x23c179,_0x2e1ee4['error'][_0xcdc4('0x13')]);return _0x48ecba(_0x2e1ee4[_0xcdc4('0x11')][_0xcdc4('0x13')]);}else{logger[_0xcdc4('0xd')](_0xcdc4('0x14'),_0x23c179,'request\x20sent');_0x48ecba(_0x2e1ee4[_0xcdc4('0x15')][_0xcdc4('0x13')]);}})[_0xcdc4('0x16')](function(_0x9b2925){logger[_0xcdc4('0x11')](_0xcdc4('0x14'),_0x23c179,_0x9b2925);_0x4851cd(_0x9b2925);});});} \ No newline at end of file +var _0xdea9=['rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x212a78,_0x2a6cf7){var _0x5eedee=function(_0x35d8ea){while(--_0x35d8ea){_0x212a78['push'](_0x212a78['shift']());}};_0x5eedee(++_0x2a6cf7);}(_0xdea9,0xc1));var _0x9dea=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xdea9[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x9dea('0x0'));var util=require(_0x9dea('0x1'));var moment=require(_0x9dea('0x2'));var BPromise=require(_0x9dea('0x3'));var rs=require(_0x9dea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dea('0x5'));var logger=require(_0x9dea('0x6'))(_0x9dea('0x7'));var config=require('../../config/environment');var jayson=require(_0x9dea('0x8'));var client=jayson[_0x9dea('0x9')][_0x9dea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x135e1c,_0x5cd2ea,_0x36fc0b){return new BPromise(function(_0x34c802,_0x4c4cd6){return client[_0x9dea('0xb')](_0x135e1c,_0x36fc0b)[_0x9dea('0xc')](function(_0x466bcf){logger[_0x9dea('0xd')](_0x9dea('0xe'),_0x5cd2ea,_0x9dea('0xf'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5cd2ea,_0x9dea('0xf'),JSON[_0x9dea('0x10')](_0x466bcf));if(_0x466bcf[_0x9dea('0x11')]){if(_0x466bcf['error']['code']===0x1f4){logger[_0x9dea('0x11')](_0x9dea('0xe'),_0x5cd2ea,_0x466bcf[_0x9dea('0x11')][_0x9dea('0x12')]);return _0x4c4cd6(_0x466bcf[_0x9dea('0x11')]['message']);}logger[_0x9dea('0x11')]('ZendeskField,\x20%s,\x20%s',_0x5cd2ea,_0x466bcf[_0x9dea('0x11')][_0x9dea('0x12')]);return _0x34c802(_0x466bcf[_0x9dea('0x11')]['message']);}else{logger[_0x9dea('0xd')](_0x9dea('0xe'),_0x5cd2ea,_0x9dea('0xf'));_0x34c802(_0x466bcf[_0x9dea('0x13')][_0x9dea('0x12')]);}})['catch'](function(_0x2a16f8){logger['error'](_0x9dea('0xe'),_0x5cd2ea,_0x2a16f8);_0x4c4cd6(_0x2a16f8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 78dabe3..589d490 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 _0xf1a3=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x134c80,_0x554540){var _0x31e59d=function(_0x55c968){while(--_0x55c968){_0x134c80['push'](_0x134c80['shift']());}};_0x31e59d(++_0x554540);}(_0xf1a3,0x118));var _0x3f1a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xf1a3[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0x3f1a('0x0'));var util=require(_0x3f1a('0x1'));var path=require(_0x3f1a('0x2'));var timeout=require(_0x3f1a('0x3'));var express=require(_0x3f1a('0x4'));var router=express[_0x3f1a('0x5')]();var fs_extra=require(_0x3f1a('0x6'));var auth=require(_0x3f1a('0x7'));var interaction=require(_0x3f1a('0x8'));var config=require('../../config/environment');var controller=require(_0x3f1a('0x9'));router[_0x3f1a('0xa')]('/',auth[_0x3f1a('0xb')](),controller[_0x3f1a('0xc')]);router['get'](_0x3f1a('0xd'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0xe')]);router[_0x3f1a('0xa')](_0x3f1a('0xf'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0x10')]);router[_0x3f1a('0xa')](_0x3f1a('0x11'),auth['isAuthenticated'](),controller[_0x3f1a('0x12')]);router[_0x3f1a('0x13')]('/',auth['isAuthenticated'](),controller[_0x3f1a('0x14')]);router['post'](_0x3f1a('0xf'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0x15')]);router[_0x3f1a('0x16')](_0x3f1a('0xd'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0x17')]);router[_0x3f1a('0x18')](_0x3f1a('0xd'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0x19')]);module[_0x3f1a('0x1a')]=router; \ No newline at end of file +var _0x2290=['update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','addConfiguration','/:id'];(function(_0x1c499c,_0x29f8d1){var _0x204e20=function(_0x2efe23){while(--_0x2efe23){_0x1c499c['push'](_0x1c499c['shift']());}};_0x204e20(++_0x29f8d1);}(_0x2290,0x146));var _0x0229=function(_0x528ad8,_0x3fd5a4){_0x528ad8=_0x528ad8-0x0;var _0x30490e=_0x2290[_0x528ad8];return _0x30490e;};'use strict';var multer=require(_0x0229('0x0'));var util=require('util');var path=require(_0x0229('0x1'));var timeout=require(_0x0229('0x2'));var express=require('express');var router=express[_0x0229('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0229('0x4'));var interaction=require(_0x0229('0x5'));var config=require('../../config/environment');var controller=require(_0x0229('0x6'));router[_0x0229('0x7')]('/',auth[_0x0229('0x8')](),controller[_0x0229('0x9')]);router[_0x0229('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0229('0xa')]);router[_0x0229('0x7')](_0x0229('0xb'),auth[_0x0229('0x8')](),controller[_0x0229('0xc')]);router[_0x0229('0x7')]('/:id/fields',auth[_0x0229('0x8')](),controller['getFields']);router[_0x0229('0xd')]('/',auth[_0x0229('0x8')](),controller['create']);router[_0x0229('0xd')](_0x0229('0xb'),auth[_0x0229('0x8')](),controller[_0x0229('0xe')]);router['put'](_0x0229('0xf'),auth[_0x0229('0x8')](),controller[_0x0229('0x10')]);router['delete'](_0x0229('0xf'),auth[_0x0229('0x8')](),controller[_0x0229('0x11')]);module[_0x0229('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index af62598..8b96e6e 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 _0x4ea3=['STRING','sequelize','exports'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0x4ea3,0x70));var _0x34ea=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ea3[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file +var _0x2dae=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2dae,0xc3));var _0xe2da=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x2dae[_0x272638];return _0x19d027;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index fc3de82..c29fd9b 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 _0xafae=['api_name','system_mandatory','push','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','set','apply','save','then','destroy','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','ZohoAccount','include','findAll','rows','catch','show','params','options','find','create','update','body','getConfigurations','findOne','ZohoConfiguration','rawAttributes','AccountId','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','host','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes'];(function(_0x484988,_0x4a080b){var _0x4af336=function(_0x523ea2){while(--_0x523ea2){_0x484988['push'](_0x484988['shift']());}};_0x4af336(++_0x4a080b);}(_0xafae,0x198));var _0xeafa=function(_0x2c460d,_0x59f200){_0x2c460d=_0x2c460d-0x0;var _0x4e3739=_0xafae[_0x2c460d];return _0x4e3739;};'use strict';var emlformat=require(_0xeafa('0x0'));var rimraf=require(_0xeafa('0x1'));var zipdir=require(_0xeafa('0x2'));var jsonpatch=require(_0xeafa('0x3'));var rp=require(_0xeafa('0x4'));var moment=require(_0xeafa('0x5'));var BPromise=require(_0xeafa('0x6'));var Mustache=require(_0xeafa('0x7'));var util=require(_0xeafa('0x8'));var path=require(_0xeafa('0x9'));var sox=require(_0xeafa('0xa'));var csv=require(_0xeafa('0xb'));var ejs=require(_0xeafa('0xc'));var fs=require('fs');var fs_extra=require(_0xeafa('0xd'));var _=require(_0xeafa('0xe'));var squel=require('squel');var crypto=require(_0xeafa('0xf'));var jsforce=require(_0xeafa('0x10'));var deskjs=require(_0xeafa('0x11'));var toCsv=require(_0xeafa('0xb'));var querystring=require(_0xeafa('0x12'));var Papa=require(_0xeafa('0x13'));var Redis=require(_0xeafa('0x14'));var authService=require(_0xeafa('0x15'));var qs=require(_0xeafa('0x16'));var as=require(_0xeafa('0x17'));var hardwareService=require(_0xeafa('0x18'));var logger=require(_0xeafa('0x19'))(_0xeafa('0x1a'));var utils=require(_0xeafa('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xeafa('0x1c'));var db=require(_0xeafa('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5db7b6,_0x5ee2aa){_0x5ee2aa=_0x5ee2aa||0xcc;return function(_0x116f07){if(_0x116f07){return _0x5db7b6[_0xeafa('0x1e')](_0x5ee2aa);}return _0x5db7b6['status'](_0x5ee2aa)[_0xeafa('0x1f')]();};}function respondWithResult(_0x8d4f36,_0x600cd8){_0x600cd8=_0x600cd8||0xc8;return function(_0x50494e){if(_0x50494e){return _0x8d4f36[_0xeafa('0x20')](_0x600cd8)[_0xeafa('0x21')](_0x50494e);}};}function respondWithFilteredResult(_0x4a9a9b,_0x593a1f){return function(_0x5c132e){if(_0x5c132e){var _0x159e8f=typeof _0x593a1f['offset']===_0xeafa('0x22')&&typeof _0x593a1f['limit']===_0xeafa('0x22');var _0x3ee2ff=_0x5c132e['count'];var _0x13ee1c=_0x159e8f?0x0:_0x593a1f[_0xeafa('0x23')];var _0x4d5d83=_0x159e8f?_0x5c132e[_0xeafa('0x24')]:_0x593a1f[_0xeafa('0x23')]+_0x593a1f['limit'];var _0x582179;if(_0x4d5d83>=_0x3ee2ff){_0x4d5d83=_0x3ee2ff;_0x582179=0xc8;}else{_0x582179=0xce;}_0x4a9a9b['status'](_0x582179);return _0x4a9a9b[_0xeafa('0x25')]('Content-Range',_0x13ee1c+'-'+_0x4d5d83+'/'+_0x3ee2ff)[_0xeafa('0x21')](_0x5c132e);}return null;};}function patchUpdates(_0x5dcbe5){return function(_0x517d0d){try{jsonpatch[_0xeafa('0x26')](_0x517d0d,_0x5dcbe5,!![]);}catch(_0x273907){return BPromise['reject'](_0x273907);}return _0x517d0d[_0xeafa('0x27')]();};}function saveUpdates(_0x136792,_0x8eafb6){return function(_0x27841f){if(_0x27841f){return _0x27841f['update'](_0x136792)[_0xeafa('0x28')](function(_0xb3928a){return _0xb3928a;});}return null;};}function removeEntity(_0xd14958,_0x5a25ee){return function(_0x1a1a1c){if(_0x1a1a1c){return _0x1a1a1c[_0xeafa('0x29')]()['then'](function(){_0xd14958['status'](0xcc)[_0xeafa('0x1f')]();});}};}function handleEntityNotFound(_0x3500fe,_0xa814fe){return function(_0x20a3d8){if(!_0x20a3d8){_0x3500fe[_0xeafa('0x1e')](0x194);}return _0x20a3d8;};}function handleError(_0x41edb0,_0x1b7419){_0x1b7419=_0x1b7419||0x1f4;return function(_0xa5fc8d){logger['error'](_0xa5fc8d['stack']);if(_0xa5fc8d[_0xeafa('0x2a')]){delete _0xa5fc8d['name'];}_0x41edb0[_0xeafa('0x20')](_0x1b7419)[_0xeafa('0x2b')](_0xa5fc8d);};}exports[_0xeafa('0x2c')]=function(_0x1763f9,_0x22d6b6){var _0x3f3681={},_0x1f6ec1={},_0xc4842c={'count':0x0,'rows':[]};var _0xc139f5=_[_0xeafa('0x2d')](db['ZohoAccount']['rawAttributes'],function(_0x491ec1){return{'name':_0x491ec1[_0xeafa('0x2e')],'type':_0x491ec1[_0xeafa('0x2f')]['key']};});_0x1f6ec1[_0xeafa('0x30')]=_['map'](_0xc139f5,_0xeafa('0x2a'));_0x1f6ec1['query']=_[_0xeafa('0x31')](_0x1763f9[_0xeafa('0x32')]);_0x1f6ec1[_0xeafa('0x33')]=_['intersection'](_0x1f6ec1[_0xeafa('0x30')],_0x1f6ec1['query']);_0x3f3681['attributes']=_[_0xeafa('0x34')](_0x1f6ec1[_0xeafa('0x30')],qs[_0xeafa('0x35')](_0x1763f9[_0xeafa('0x32')][_0xeafa('0x35')]));_0x3f3681[_0xeafa('0x36')]=_0x3f3681[_0xeafa('0x36')][_0xeafa('0x37')]?_0x3f3681[_0xeafa('0x36')]:_0x1f6ec1['model'];if(!_0x1763f9['query'][_0xeafa('0x38')]('nolimit')){_0x3f3681[_0xeafa('0x39')]=qs['limit'](_0x1763f9[_0xeafa('0x32')][_0xeafa('0x39')]);_0x3f3681['offset']=qs['offset'](_0x1763f9[_0xeafa('0x32')][_0xeafa('0x23')]);}_0x3f3681[_0xeafa('0x3a')]=qs[_0xeafa('0x3b')](_0x1763f9[_0xeafa('0x32')][_0xeafa('0x3b')]);_0x3f3681[_0xeafa('0x3c')]=qs[_0xeafa('0x33')](_[_0xeafa('0x3d')](_0x1763f9[_0xeafa('0x32')],_0x1f6ec1['filters']),_0xc139f5);if(_0x1763f9[_0xeafa('0x32')][_0xeafa('0x3e')]){_0x3f3681[_0xeafa('0x3c')]=_[_0xeafa('0x3f')](_0x3f3681[_0xeafa('0x3c')],{'$or':_['map'](_0xc139f5,function(_0x237567){if(_0x237567['type']!=='VIRTUAL'){var _0x1bb30f={};_0x1bb30f[_0x237567[_0xeafa('0x2a')]]={'$like':'%'+_0x1763f9[_0xeafa('0x32')]['filter']+'%'};return _0x1bb30f;}})});}_0x3f3681=_[_0xeafa('0x3f')]({},_0x3f3681,_0x1763f9['options']);var _0x15ce8f={'where':_0x3f3681[_0xeafa('0x3c')]};return db[_0xeafa('0x40')][_0xeafa('0x24')](_0x15ce8f)[_0xeafa('0x28')](function(_0x5a9c82){_0xc4842c[_0xeafa('0x24')]=_0x5a9c82;if(_0x1763f9[_0xeafa('0x32')]['includeAll']){_0x3f3681[_0xeafa('0x41')]=[{'all':!![]}];}return db[_0xeafa('0x40')][_0xeafa('0x42')](_0x3f3681);})[_0xeafa('0x28')](function(_0x4d0cc4){_0xc4842c[_0xeafa('0x43')]=_0x4d0cc4;return _0xc4842c;})[_0xeafa('0x28')](respondWithFilteredResult(_0x22d6b6,_0x3f3681))[_0xeafa('0x44')](handleError(_0x22d6b6,null));};exports[_0xeafa('0x45')]=function(_0x288b68,_0x3816e2){var _0x240752={'raw':![],'where':{'id':_0x288b68[_0xeafa('0x46')]['id']}},_0x347e14={};_0x347e14[_0xeafa('0x30')]=_[_0xeafa('0x31')](db['ZohoAccount']['rawAttributes']);_0x347e14[_0xeafa('0x32')]=_[_0xeafa('0x31')](_0x288b68[_0xeafa('0x32')]);_0x347e14[_0xeafa('0x33')]=_[_0xeafa('0x34')](_0x347e14['model'],_0x347e14[_0xeafa('0x32')]);_0x240752[_0xeafa('0x36')]=_[_0xeafa('0x34')](_0x347e14[_0xeafa('0x30')],qs[_0xeafa('0x35')](_0x288b68[_0xeafa('0x32')]['fields']));_0x240752[_0xeafa('0x36')]=_0x240752['attributes'][_0xeafa('0x37')]?_0x240752['attributes']:_0x347e14[_0xeafa('0x30')];if(_0x288b68[_0xeafa('0x32')]['includeAll']){_0x240752[_0xeafa('0x41')]=[{'all':!![]}];}_0x240752=_[_0xeafa('0x3f')]({},_0x240752,_0x288b68[_0xeafa('0x47')]);return db['ZohoAccount'][_0xeafa('0x48')](_0x240752)['then'](handleEntityNotFound(_0x3816e2,null))[_0xeafa('0x28')](respondWithResult(_0x3816e2,null))[_0xeafa('0x44')](handleError(_0x3816e2,null));};exports[_0xeafa('0x49')]=function(_0x178a5f,_0x555a88){return db['ZohoAccount']['create'](_0x178a5f['body'],{})[_0xeafa('0x28')](respondWithResult(_0x555a88,0xc9))['catch'](handleError(_0x555a88,null));};exports[_0xeafa('0x4a')]=function(_0x32c5d5,_0x43d3ee){if(_0x32c5d5[_0xeafa('0x4b')]['id']){delete _0x32c5d5[_0xeafa('0x4b')]['id'];}return db['ZohoAccount'][_0xeafa('0x48')]({'where':{'id':_0x32c5d5[_0xeafa('0x46')]['id']}})[_0xeafa('0x28')](handleEntityNotFound(_0x43d3ee,null))[_0xeafa('0x28')](saveUpdates(_0x32c5d5[_0xeafa('0x4b')],null))[_0xeafa('0x28')](respondWithResult(_0x43d3ee,null))[_0xeafa('0x44')](handleError(_0x43d3ee,null));};exports['destroy']=function(_0x532705,_0x138c57){return db[_0xeafa('0x40')][_0xeafa('0x48')]({'where':{'id':_0x532705[_0xeafa('0x46')]['id']}})[_0xeafa('0x28')](handleEntityNotFound(_0x138c57,null))[_0xeafa('0x28')](removeEntity(_0x138c57,null))[_0xeafa('0x44')](handleError(_0x138c57,null));};exports[_0xeafa('0x4c')]=function(_0x5f12e1,_0x25beb1,_0x5614a1){var _0x4eed30={};var _0xd07beb={};var _0x2f8334;var _0x35dfbd;return db['ZohoAccount'][_0xeafa('0x4d')]({'where':{'id':_0x5f12e1['params']['id']}})['then'](handleEntityNotFound(_0x25beb1,null))[_0xeafa('0x28')](function(_0x2c8bba){if(_0x2c8bba){_0x2f8334=_0x2c8bba;_0xd07beb[_0xeafa('0x30')]=_[_0xeafa('0x31')](db[_0xeafa('0x4e')][_0xeafa('0x4f')]);_0xd07beb[_0xeafa('0x32')]=_[_0xeafa('0x31')](_0x5f12e1['query']);_0xd07beb[_0xeafa('0x33')]=_[_0xeafa('0x34')](_0xd07beb['model'],_0xd07beb['query']);_0x4eed30[_0xeafa('0x36')]=_['intersection'](_0xd07beb[_0xeafa('0x30')],qs[_0xeafa('0x35')](_0x5f12e1[_0xeafa('0x32')][_0xeafa('0x35')]));_0x4eed30['attributes']=_0x4eed30[_0xeafa('0x36')][_0xeafa('0x37')]?_0x4eed30[_0xeafa('0x36')]:_0xd07beb['model'];_0x4eed30[_0xeafa('0x3a')]=qs['sort'](_0x5f12e1[_0xeafa('0x32')][_0xeafa('0x3b')]);_0x4eed30['where']=qs[_0xeafa('0x33')](_['pick'](_0x5f12e1[_0xeafa('0x32')],_0xd07beb['filters']));if(_0x5f12e1[_0xeafa('0x32')][_0xeafa('0x3e')]){_0x4eed30[_0xeafa('0x3c')]=_[_0xeafa('0x3f')](_0x4eed30[_0xeafa('0x3c')],{'$or':_[_0xeafa('0x2d')](_0x4eed30[_0xeafa('0x36')],function(_0x194444){var _0x4cd72c={};_0x4cd72c[_0x194444]={'$like':'%'+_0x5f12e1[_0xeafa('0x32')]['filter']+'%'};return _0x4cd72c;})});}_0x4eed30=_[_0xeafa('0x3f')]({},_0x4eed30,_0x5f12e1[_0xeafa('0x47')]);return _0x2f8334[_0xeafa('0x4c')](_0x4eed30);}})[_0xeafa('0x28')](function(_0x35ec31){if(_0x35ec31){_0x35dfbd=_0x35ec31[_0xeafa('0x37')];if(!_0x5f12e1[_0xeafa('0x32')][_0xeafa('0x38')]('nolimit')){_0x4eed30[_0xeafa('0x39')]=qs[_0xeafa('0x39')](_0x5f12e1['query'][_0xeafa('0x39')]);_0x4eed30[_0xeafa('0x23')]=qs[_0xeafa('0x23')](_0x5f12e1['query'][_0xeafa('0x23')]);}return _0x2f8334[_0xeafa('0x4c')](_0x4eed30);}})[_0xeafa('0x28')](function(_0x22db4b){if(_0x22db4b){return _0x22db4b?{'count':_0x35dfbd,'rows':_0x22db4b}:null;}})[_0xeafa('0x28')](respondWithResult(_0x25beb1,null))[_0xeafa('0x44')](handleError(_0x25beb1,null));};exports['addConfiguration']=function(_0x54ed4c,_0x4b571f,_0x1c1806){if(_0x54ed4c[_0xeafa('0x4b')]['id']){delete _0x54ed4c[_0xeafa('0x4b')]['id'];}return db[_0xeafa('0x40')]['findOne']({'where':{'id':_0x54ed4c['params']['id']}})[_0xeafa('0x28')](handleEntityNotFound(_0x4b571f,null))['then'](function(_0x364dcc){if(_0x364dcc){_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x50')]=_0x364dcc['id'];_0x54ed4c[_0xeafa('0x4b')]['Subjects']=integrations['getSubjects'](_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x51')],_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x2f')]);_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x52')]=integrations[_0xeafa('0x53')](_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x51')],_0x54ed4c[_0xeafa('0x4b')][_0xeafa('0x2f')]);return db[_0xeafa('0x4e')][_0xeafa('0x49')](_0x54ed4c['body'],{'include':[{'model':db[_0xeafa('0x54')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xeafa('0x52')}]});}return null;})[_0xeafa('0x28')](respondWithResult(_0x4b571f,null))[_0xeafa('0x44')](handleError(_0x4b571f,null));};function getAccessToken(_0x5f240f){return new Promise(function(_0x21f6f5,_0x198904){var _0x51d457;switch(_0x5f240f[_0xeafa('0x55')]){case'US':_0x51d457='https://accounts.zoho.com';break;case'AU':_0x51d457=_0xeafa('0x56');break;case'EU':_0x51d457='https://accounts.zoho.eu';break;case'IN':_0x51d457=_0xeafa('0x57');break;case'CN':_0x51d457=_0xeafa('0x58');break;default:_0x51d457=_0xeafa('0x59');break;}var _0x11088e={'method':_0xeafa('0x5a'),'uri':_0x51d457+_0xeafa('0x5b'),'qs':{'refresh_token':_0x5f240f[_0xeafa('0x5c')],'client_id':_0x5f240f[_0xeafa('0x5d')],'client_secret':_0x5f240f['clientSecret'],'grant_type':_0xeafa('0x5e')},'json':!![]};return rp(_0x11088e)[_0xeafa('0x28')](function(_0x388937){if(_0x388937[_0xeafa('0x5f')]){_0x21f6f5(_0x388937[_0xeafa('0x5f')]);}else{_0x198904('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xeafa('0x44')](function(_0xf49b4f){_0x198904(_0xf49b4f);});});}exports['getFields']=function(_0x59c432,_0x217612,_0x397ef9){var _0x1909df,_0x22c7cf,_0x5af54b,_0x4101f3,_0x3af40a;return db[_0xeafa('0x40')]['findOne']({'where':{'id':_0x59c432[_0xeafa('0x46')]['id']},'attributes':['id',_0xeafa('0x60'),_0xeafa('0x55'),_0xeafa('0x5d'),'clientSecret',_0xeafa('0x61'),_0xeafa('0x62'),_0xeafa('0x5c')]})['then'](handleEntityNotFound(_0x217612,null))['then'](function(_0x3bc23e){_0x3af40a=_0x3bc23e;_0x1909df=_0x3af40a['host'];_0x22c7cf=_0x1909df==='zoho.eu'?'eu':_0xeafa('0x63');_0x5af54b=_0x3af40a[_0xeafa('0x61')];var _0xe0c757=_0x5af54b[_0xeafa('0x64')](-0x1);if(_0xe0c757==='/'||_0xe0c757==='\x5c'||_0xe0c757===':'){_0x5af54b=_0x5af54b[_0xeafa('0x65')](0x0,_0x5af54b[_0xeafa('0x66')](_0xe0c757));}if(!_0x3af40a[_0xeafa('0x5c')]){throw new Error(_0xeafa('0x67'));}return getAccessToken(_0x3af40a);})[_0xeafa('0x28')](function(_0x4ac7ed){if(_0x4ac7ed){return rp({'method':_0xeafa('0x68'),'uri':util[_0xeafa('0x69')](_0xeafa('0x6a'),_0x22c7cf),'qs':{'module':_0xeafa('0x6b')},'headers':{'Authorization':_0xeafa('0x6c')+_0x4ac7ed},'json':!![]});}})[_0xeafa('0x28')](function(_0x42252a){if(_0x42252a){if(_0x42252a[_0xeafa('0x6d')]&&_0x42252a['response'][_0xeafa('0x6e')]){throw new Error(_0x42252a[_0xeafa('0x6d')]['error']['message']);}var _0x578f28=[];var _0x4d1a84=[];var _0x1ed6cd=[_0xeafa('0x6f'),_0xeafa('0x70'),_0xeafa('0x71'),_0xeafa('0x72'),_0xeafa('0x73'),'Call_Result',_0xeafa('0x74'),_0xeafa('0x75')];_0x4d1a84=_[_0xeafa('0x76')](_0x42252a[_0xeafa('0x35')],function(_0x5bbb51){return _0x1ed6cd[_0xeafa('0x77')](_0x5bbb51[_0xeafa('0x78')]);});for(var _0x17700b=0x0;_0x17700b<_0x4d1a84[_0xeafa('0x37')];_0x17700b++){if(_0x4d1a84[_0x17700b][_0xeafa('0x79')]===![]){_0x578f28[_0xeafa('0x7a')]({'id':_0x4d1a84[_0x17700b]['id'],'name':_0x4d1a84[_0x17700b]['display_label'],'custom':_0x4d1a84[_0x17700b][_0xeafa('0x7b')],'options':_0x4d1a84[_0x17700b]['data_type']===_0xeafa('0x7c')&&_0x4d1a84[_0x17700b][_0xeafa('0x7d')][_0xeafa('0x37')]>-0x1?_[_0xeafa('0x2d')](_0x4d1a84[_0x17700b][_0xeafa('0x7d')],function(_0x345fd9){return{'name':_0x345fd9,'value':_0x345fd9};}):[]});}}return{'count':_0x578f28[_0xeafa('0x37')],'rows':_0x578f28};}else{return{'count':0x0,'rows':[]};}})[_0xeafa('0x28')](respondWithResult(_0x217612,null))[_0xeafa('0x44')](function(_0x21ec09){var _0x5c96d9=_0x59c432[_0xeafa('0x32')][_0xeafa('0x7e')]?0x1f4:_0x21ec09['statusCode']||0x1f4;logger['error'](_0xeafa('0x7f'),_0xeafa('0x80'),_0x5c96d9,JSON[_0xeafa('0x81')](_0x21ec09));delete _0x21ec09[_0xeafa('0x2a')];if(_0x5c96d9===0x191){_0x5c96d9=0x190;}_0x217612[_0xeafa('0x20')](_0x5c96d9)[_0xeafa('0x2b')](_0x59c432[_0xeafa('0x32')][_0xeafa('0x7e')]?{'message':_0xeafa('0x82'),'statusCode':_0x21ec09[_0xeafa('0x83')]}:_0x21ec09);});}; \ No newline at end of file +var _0x9125=['type','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','code','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoAccount','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','length','options','find','create','body','findOne','params','ZohoConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel'];(function(_0x4bd1f9,_0xcc327){var _0x32ce52=function(_0x573f3a){while(--_0x573f3a){_0x4bd1f9['push'](_0x4bd1f9['shift']());}};_0x32ce52(++_0xcc327);}(_0x9125,0x141));var _0x5912=function(_0x4d26f3,_0x3e1615){_0x4d26f3=_0x4d26f3-0x0;var _0x3accb7=_0x9125[_0x4d26f3];return _0x3accb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5912('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5912('0x1'));var rp=require('request-promise');var moment=require(_0x5912('0x2'));var BPromise=require(_0x5912('0x3'));var Mustache=require(_0x5912('0x4'));var util=require(_0x5912('0x5'));var path=require(_0x5912('0x6'));var sox=require(_0x5912('0x7'));var csv=require(_0x5912('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5912('0x9'));var _=require(_0x5912('0xa'));var squel=require(_0x5912('0xb'));var crypto=require('crypto');var jsforce=require(_0x5912('0xc'));var deskjs=require(_0x5912('0xd'));var toCsv=require(_0x5912('0x8'));var querystring=require(_0x5912('0xe'));var Papa=require(_0x5912('0xf'));var Redis=require(_0x5912('0x10'));var authService=require(_0x5912('0x11'));var qs=require(_0x5912('0x12'));var as=require(_0x5912('0x13'));var hardwareService=require(_0x5912('0x14'));var logger=require(_0x5912('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5912('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5912('0x17'));function respondWithStatusCode(_0x545164,_0x3f6626){_0x3f6626=_0x3f6626||0xcc;return function(_0x51811f){if(_0x51811f){return _0x545164[_0x5912('0x18')](_0x3f6626);}return _0x545164[_0x5912('0x19')](_0x3f6626)[_0x5912('0x1a')]();};}function respondWithResult(_0x38928a,_0x29347d){_0x29347d=_0x29347d||0xc8;return function(_0x139064){if(_0x139064){return _0x38928a[_0x5912('0x19')](_0x29347d)['json'](_0x139064);}};}function respondWithFilteredResult(_0x9ee2af,_0x2aeb55){return function(_0x26b44f){if(_0x26b44f){var _0x31753e=typeof _0x2aeb55[_0x5912('0x1b')]==='undefined'&&typeof _0x2aeb55[_0x5912('0x1c')]===_0x5912('0x1d');var _0x202331=_0x26b44f[_0x5912('0x1e')];var _0x16433b=_0x31753e?0x0:_0x2aeb55[_0x5912('0x1b')];var _0x2a85c8=_0x31753e?_0x26b44f[_0x5912('0x1e')]:_0x2aeb55[_0x5912('0x1b')]+_0x2aeb55['limit'];var _0x5542af;if(_0x2a85c8>=_0x202331){_0x2a85c8=_0x202331;_0x5542af=0xc8;}else{_0x5542af=0xce;}_0x9ee2af['status'](_0x5542af);return _0x9ee2af[_0x5912('0x1f')](_0x5912('0x20'),_0x16433b+'-'+_0x2a85c8+'/'+_0x202331)['json'](_0x26b44f);}return null;};}function patchUpdates(_0x58e7ae){return function(_0x1c7278){try{jsonpatch[_0x5912('0x21')](_0x1c7278,_0x58e7ae,!![]);}catch(_0x22dc77){return BPromise[_0x5912('0x22')](_0x22dc77);}return _0x1c7278[_0x5912('0x23')]();};}function saveUpdates(_0x3efdae,_0x9ced89){return function(_0x43b7a9){if(_0x43b7a9){return _0x43b7a9[_0x5912('0x24')](_0x3efdae)[_0x5912('0x25')](function(_0x1a172d){return _0x1a172d;});}return null;};}function removeEntity(_0x2163fc,_0xc83a48){return function(_0x1d1539){if(_0x1d1539){return _0x1d1539[_0x5912('0x26')]()[_0x5912('0x25')](function(){_0x2163fc[_0x5912('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb4bd,_0xede74a){return function(_0x2d0d88){if(!_0x2d0d88){_0x5eb4bd['sendStatus'](0x194);}return _0x2d0d88;};}function handleError(_0x2abb7d,_0x4d2144){_0x4d2144=_0x4d2144||0x1f4;return function(_0x50366b){logger[_0x5912('0x27')](_0x50366b[_0x5912('0x28')]);if(_0x50366b['name']){delete _0x50366b[_0x5912('0x29')];}_0x2abb7d['status'](_0x4d2144)['send'](_0x50366b);};}exports['index']=function(_0x336404,_0x2a3f3b){var _0x204cbf={},_0x53598d={},_0x47f4f2={'count':0x0,'rows':[]};var _0x2999c1=_[_0x5912('0x2a')](db[_0x5912('0x2b')][_0x5912('0x2c')],function(_0x1f9314){return{'name':_0x1f9314[_0x5912('0x2d')],'type':_0x1f9314['type'][_0x5912('0x2e')]};});_0x53598d[_0x5912('0x2f')]=_['map'](_0x2999c1,_0x5912('0x29'));_0x53598d['query']=_[_0x5912('0x30')](_0x336404['query']);_0x53598d['filters']=_[_0x5912('0x31')](_0x53598d[_0x5912('0x2f')],_0x53598d[_0x5912('0x32')]);_0x204cbf['attributes']=_['intersection'](_0x53598d['model'],qs[_0x5912('0x33')](_0x336404[_0x5912('0x32')]['fields']));_0x204cbf['attributes']=_0x204cbf[_0x5912('0x34')]['length']?_0x204cbf[_0x5912('0x34')]:_0x53598d['model'];if(!_0x336404[_0x5912('0x32')][_0x5912('0x35')](_0x5912('0x36'))){_0x204cbf['limit']=qs[_0x5912('0x1c')](_0x336404[_0x5912('0x32')][_0x5912('0x1c')]);_0x204cbf[_0x5912('0x1b')]=qs['offset'](_0x336404[_0x5912('0x32')][_0x5912('0x1b')]);}_0x204cbf[_0x5912('0x37')]=qs[_0x5912('0x38')](_0x336404['query'][_0x5912('0x38')]);_0x204cbf[_0x5912('0x39')]=qs[_0x5912('0x3a')](_[_0x5912('0x3b')](_0x336404['query'],_0x53598d['filters']),_0x2999c1);if(_0x336404['query']['filter']){_0x204cbf[_0x5912('0x39')]=_[_0x5912('0x3c')](_0x204cbf[_0x5912('0x39')],{'$or':_[_0x5912('0x2a')](_0x2999c1,function(_0x12cefc){if(_0x12cefc['type']!==_0x5912('0x3d')){var _0x2985c4={};_0x2985c4[_0x12cefc[_0x5912('0x29')]]={'$like':'%'+_0x336404[_0x5912('0x32')][_0x5912('0x3e')]+'%'};return _0x2985c4;}})});}_0x204cbf=_[_0x5912('0x3c')]({},_0x204cbf,_0x336404['options']);var _0x3f8579={'where':_0x204cbf['where']};return db[_0x5912('0x2b')][_0x5912('0x1e')](_0x3f8579)[_0x5912('0x25')](function(_0x1bd697){_0x47f4f2[_0x5912('0x1e')]=_0x1bd697;if(_0x336404[_0x5912('0x32')][_0x5912('0x3f')]){_0x204cbf[_0x5912('0x40')]=[{'all':!![]}];}return db[_0x5912('0x2b')]['findAll'](_0x204cbf);})['then'](function(_0x402166){_0x47f4f2[_0x5912('0x41')]=_0x402166;return _0x47f4f2;})[_0x5912('0x25')](respondWithFilteredResult(_0x2a3f3b,_0x204cbf))[_0x5912('0x42')](handleError(_0x2a3f3b,null));};exports[_0x5912('0x43')]=function(_0x2e69b1,_0x5c0f08){var _0x44b733={'raw':![],'where':{'id':_0x2e69b1['params']['id']}},_0x2b5efc={};_0x2b5efc[_0x5912('0x2f')]=_[_0x5912('0x30')](db[_0x5912('0x2b')][_0x5912('0x2c')]);_0x2b5efc[_0x5912('0x32')]=_[_0x5912('0x30')](_0x2e69b1[_0x5912('0x32')]);_0x2b5efc['filters']=_[_0x5912('0x31')](_0x2b5efc[_0x5912('0x2f')],_0x2b5efc[_0x5912('0x32')]);_0x44b733[_0x5912('0x34')]=_['intersection'](_0x2b5efc['model'],qs['fields'](_0x2e69b1['query'][_0x5912('0x33')]));_0x44b733[_0x5912('0x34')]=_0x44b733[_0x5912('0x34')][_0x5912('0x44')]?_0x44b733[_0x5912('0x34')]:_0x2b5efc[_0x5912('0x2f')];if(_0x2e69b1[_0x5912('0x32')]['includeAll']){_0x44b733[_0x5912('0x40')]=[{'all':!![]}];}_0x44b733=_[_0x5912('0x3c')]({},_0x44b733,_0x2e69b1[_0x5912('0x45')]);return db[_0x5912('0x2b')][_0x5912('0x46')](_0x44b733)['then'](handleEntityNotFound(_0x5c0f08,null))[_0x5912('0x25')](respondWithResult(_0x5c0f08,null))[_0x5912('0x42')](handleError(_0x5c0f08,null));};exports[_0x5912('0x47')]=function(_0x43acea,_0x181aef){return db[_0x5912('0x2b')][_0x5912('0x47')](_0x43acea[_0x5912('0x48')],{})[_0x5912('0x25')](respondWithResult(_0x181aef,0xc9))[_0x5912('0x42')](handleError(_0x181aef,null));};exports[_0x5912('0x24')]=function(_0x475a90,_0x193b87){if(_0x475a90[_0x5912('0x48')]['id']){delete _0x475a90['body']['id'];}return db[_0x5912('0x2b')][_0x5912('0x46')]({'where':{'id':_0x475a90['params']['id']}})[_0x5912('0x25')](handleEntityNotFound(_0x193b87,null))[_0x5912('0x25')](saveUpdates(_0x475a90[_0x5912('0x48')],null))['then'](respondWithResult(_0x193b87,null))[_0x5912('0x42')](handleError(_0x193b87,null));};exports['destroy']=function(_0x514fcb,_0x137501){return db[_0x5912('0x2b')]['find']({'where':{'id':_0x514fcb['params']['id']}})[_0x5912('0x25')](handleEntityNotFound(_0x137501,null))[_0x5912('0x25')](removeEntity(_0x137501,null))[_0x5912('0x42')](handleError(_0x137501,null));};exports['getConfigurations']=function(_0x5d5738,_0xfe711f,_0x15838f){var _0x1a1dec={};var _0x3bd83f={};var _0x54aecb;var _0x3b3d6e;return db[_0x5912('0x2b')][_0x5912('0x49')]({'where':{'id':_0x5d5738[_0x5912('0x4a')]['id']}})[_0x5912('0x25')](handleEntityNotFound(_0xfe711f,null))[_0x5912('0x25')](function(_0x293e6b){if(_0x293e6b){_0x54aecb=_0x293e6b;_0x3bd83f['model']=_[_0x5912('0x30')](db[_0x5912('0x4b')][_0x5912('0x2c')]);_0x3bd83f[_0x5912('0x32')]=_['keys'](_0x5d5738[_0x5912('0x32')]);_0x3bd83f[_0x5912('0x3a')]=_[_0x5912('0x31')](_0x3bd83f[_0x5912('0x2f')],_0x3bd83f[_0x5912('0x32')]);_0x1a1dec[_0x5912('0x34')]=_[_0x5912('0x31')](_0x3bd83f['model'],qs[_0x5912('0x33')](_0x5d5738[_0x5912('0x32')][_0x5912('0x33')]));_0x1a1dec[_0x5912('0x34')]=_0x1a1dec[_0x5912('0x34')][_0x5912('0x44')]?_0x1a1dec[_0x5912('0x34')]:_0x3bd83f[_0x5912('0x2f')];_0x1a1dec[_0x5912('0x37')]=qs[_0x5912('0x38')](_0x5d5738['query']['sort']);_0x1a1dec[_0x5912('0x39')]=qs['filters'](_['pick'](_0x5d5738[_0x5912('0x32')],_0x3bd83f[_0x5912('0x3a')]));if(_0x5d5738[_0x5912('0x32')][_0x5912('0x3e')]){_0x1a1dec[_0x5912('0x39')]=_[_0x5912('0x3c')](_0x1a1dec[_0x5912('0x39')],{'$or':_[_0x5912('0x2a')](_0x1a1dec[_0x5912('0x34')],function(_0x3d5c95){var _0x43c0f7={};_0x43c0f7[_0x3d5c95]={'$like':'%'+_0x5d5738[_0x5912('0x32')][_0x5912('0x3e')]+'%'};return _0x43c0f7;})});}_0x1a1dec=_[_0x5912('0x3c')]({},_0x1a1dec,_0x5d5738[_0x5912('0x45')]);return _0x54aecb[_0x5912('0x4c')](_0x1a1dec);}})[_0x5912('0x25')](function(_0x19e34d){if(_0x19e34d){_0x3b3d6e=_0x19e34d[_0x5912('0x44')];if(!_0x5d5738[_0x5912('0x32')][_0x5912('0x35')](_0x5912('0x36'))){_0x1a1dec[_0x5912('0x1c')]=qs[_0x5912('0x1c')](_0x5d5738[_0x5912('0x32')][_0x5912('0x1c')]);_0x1a1dec[_0x5912('0x1b')]=qs['offset'](_0x5d5738['query'][_0x5912('0x1b')]);}return _0x54aecb[_0x5912('0x4c')](_0x1a1dec);}})[_0x5912('0x25')](function(_0xca51d6){if(_0xca51d6){return _0xca51d6?{'count':_0x3b3d6e,'rows':_0xca51d6}:null;}})[_0x5912('0x25')](respondWithResult(_0xfe711f,null))['catch'](handleError(_0xfe711f,null));};exports['addConfiguration']=function(_0x546a2f,_0x28868a,_0xf5baa8){if(_0x546a2f['body']['id']){delete _0x546a2f[_0x5912('0x48')]['id'];}return db[_0x5912('0x2b')][_0x5912('0x49')]({'where':{'id':_0x546a2f['params']['id']}})[_0x5912('0x25')](handleEntityNotFound(_0x28868a,null))[_0x5912('0x25')](function(_0x567ca8){if(_0x567ca8){_0x546a2f[_0x5912('0x48')][_0x5912('0x4d')]=_0x567ca8['id'];_0x546a2f[_0x5912('0x48')][_0x5912('0x4e')]=integrations[_0x5912('0x4f')](_0x546a2f['body'][_0x5912('0x50')],_0x546a2f[_0x5912('0x48')][_0x5912('0x51')]);_0x546a2f[_0x5912('0x48')][_0x5912('0x52')]=integrations[_0x5912('0x53')](_0x546a2f[_0x5912('0x48')][_0x5912('0x50')],_0x546a2f[_0x5912('0x48')][_0x5912('0x51')]);return db['ZohoConfiguration'][_0x5912('0x47')](_0x546a2f[_0x5912('0x48')],{'include':[{'model':db[_0x5912('0x54')],'as':_0x5912('0x4e')},{'model':db['ZohoField'],'as':_0x5912('0x52')}]});}return null;})[_0x5912('0x25')](respondWithResult(_0x28868a,null))['catch'](handleError(_0x28868a,null));};function getAccessToken(_0x238abd){return new Promise(function(_0xa3f3d,_0x38a47e){var _0x364b6f;switch(_0x238abd[_0x5912('0x55')]){case'US':_0x364b6f=_0x5912('0x56');break;case'AU':_0x364b6f='https://accounts.zoho.com.au';break;case'EU':_0x364b6f=_0x5912('0x57');break;case'IN':_0x364b6f=_0x5912('0x58');break;case'CN':_0x364b6f=_0x5912('0x59');break;default:_0x364b6f=_0x5912('0x57');break;}var _0x48a042={'method':_0x5912('0x5a'),'uri':_0x364b6f+_0x5912('0x5b'),'qs':{'refresh_token':_0x238abd[_0x5912('0x5c')],'client_id':_0x238abd[_0x5912('0x5d')],'client_secret':_0x238abd['clientSecret'],'grant_type':_0x5912('0x5e')},'json':!![]};return rp(_0x48a042)[_0x5912('0x25')](function(_0x49f44f){if(_0x49f44f['access_token']){_0xa3f3d(_0x49f44f[_0x5912('0x5f')]);}else{_0x38a47e(_0x5912('0x60'));}})['catch'](function(_0x1c91c6){_0x38a47e(_0x1c91c6);});});}exports[_0x5912('0x61')]=function(_0x5d783b,_0x504d8f,_0x381bfa){var _0x5e0e6b,_0x5b3adf,_0x1c6624,_0xdb17db,_0x48c866;return db[_0x5912('0x2b')][_0x5912('0x49')]({'where':{'id':_0x5d783b['params']['id']},'attributes':['id','host',_0x5912('0x55'),_0x5912('0x5d'),_0x5912('0x62'),_0x5912('0x63'),_0x5912('0x64'),_0x5912('0x5c')]})['then'](handleEntityNotFound(_0x504d8f,null))[_0x5912('0x25')](function(_0x252b15){_0x48c866=_0x252b15;_0x5e0e6b=_0x48c866[_0x5912('0x65')];_0x5b3adf=_0x5e0e6b===_0x5912('0x66')?'eu':_0x5912('0x67');_0x1c6624=_0x48c866[_0x5912('0x63')];var _0x42c447=_0x1c6624[_0x5912('0x68')](-0x1);if(_0x42c447==='/'||_0x42c447==='\x5c'||_0x42c447===':'){_0x1c6624=_0x1c6624['substring'](0x0,_0x1c6624[_0x5912('0x69')](_0x42c447));}if(!_0x48c866[_0x5912('0x5c')]){throw new Error(_0x5912('0x6a'));}return getAccessToken(_0x48c866);})[_0x5912('0x25')](function(_0x59270a){if(_0x59270a){return rp({'method':_0x5912('0x6b'),'uri':util['format'](_0x5912('0x6c'),_0x5b3adf),'qs':{'module':'Calls'},'headers':{'Authorization':_0x5912('0x6d')+_0x59270a},'json':!![]});}})[_0x5912('0x25')](function(_0x3ab5da){if(_0x3ab5da){if(_0x3ab5da[_0x5912('0x6e')]&&_0x3ab5da[_0x5912('0x6e')]['error']){throw new Error(_0x3ab5da[_0x5912('0x6e')][_0x5912('0x27')][_0x5912('0x6f')]);}var _0x42c322=[];var _0x3f8b9f=[];var _0x3f5df7=[_0x5912('0x70'),_0x5912('0x71'),_0x5912('0x72'),_0x5912('0x73'),_0x5912('0x74'),_0x5912('0x75'),_0x5912('0x76'),'Call_Type'];_0x3f8b9f=_[_0x5912('0x77')](_0x3ab5da[_0x5912('0x33')],function(_0x2e0444){return _0x3f5df7[_0x5912('0x78')](_0x2e0444[_0x5912('0x79')]);});for(var _0x599d62=0x0;_0x599d62<_0x3f8b9f[_0x5912('0x44')];_0x599d62++){if(_0x3f8b9f[_0x599d62][_0x5912('0x7a')]===![]){_0x42c322[_0x5912('0x7b')]({'id':_0x3f8b9f[_0x599d62]['id'],'name':_0x3f8b9f[_0x599d62]['display_label'],'custom':_0x3f8b9f[_0x599d62][_0x5912('0x7c')],'options':_0x3f8b9f[_0x599d62][_0x5912('0x7d')]===_0x5912('0x7e')&&_0x3f8b9f[_0x599d62][_0x5912('0x7f')][_0x5912('0x44')]>-0x1?_[_0x5912('0x2a')](_0x3f8b9f[_0x599d62][_0x5912('0x7f')],function(_0xd8dba2){return{'name':_0xd8dba2,'value':_0xd8dba2};}):[]});}}return{'count':_0x42c322[_0x5912('0x44')],'rows':_0x42c322};}else{return{'count':0x0,'rows':[]};}})[_0x5912('0x25')](respondWithResult(_0x504d8f,null))[_0x5912('0x42')](function(_0x229fd1){var _0x4fb03f=_0x5d783b[_0x5912('0x32')][_0x5912('0x80')]?0x1f4:_0x229fd1[_0x5912('0x81')]||0x1f4;logger['error'](_0x5912('0x82'),_0x5912('0x61'),_0x4fb03f,JSON[_0x5912('0x83')](_0x229fd1));delete _0x229fd1['name'];if(_0x4fb03f===0x191){_0x4fb03f=0x190;}_0x504d8f[_0x5912('0x19')](_0x4fb03f)[_0x5912('0x84')](_0x5d783b['query'][_0x5912('0x80')]?{'message':_0x5912('0x85'),'statusCode':_0x229fd1[_0x5912('0x81')]}:_0x229fd1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c05f88b..1f31dd4 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 _0x5ffe=['inspect','catch','host','POST','/oauth/v2/token','refreshToken','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','int_zoho_accounts','changed','zone','serverUrl','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5ffe,0x1f2));var _0xe5ff=function(_0x269486,_0x2e69a1){_0x269486=_0x269486-0x0;var _0x42b038=_0x5ffe[_0x269486];return _0x42b038;};'use strict';var _=require(_0xe5ff('0x0'));var util=require(_0xe5ff('0x1'));var logger=require(_0xe5ff('0x2'))(_0xe5ff('0x3'));var moment=require(_0xe5ff('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5ff('0x5'));var rimraf=require(_0xe5ff('0x6'));var config=require(_0xe5ff('0x7'));var attributes=require(_0xe5ff('0x8'));var integrations=require(_0xe5ff('0x9'));module['exports']=function(_0x2e9992,_0xa1265d){return _0x2e9992['define']('ZohoAccount',attributes,{'tableName':_0xe5ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18e786,_0x34931e,_0xa683c1){if(_0x18e786[_0xe5ff('0xb')](_0xe5ff('0xc'))||_0x18e786[_0xe5ff('0xb')](_0xe5ff('0xd'))||_0x18e786[_0xe5ff('0xb')](_0xe5ff('0xe'))||_0x18e786[_0xe5ff('0xb')]('clientSecret')||_0x18e786[_0xe5ff('0xb')](_0xe5ff('0xf'))||_0x18e786[_0xe5ff('0xb')]('host')){var _0x2ad268,_0x2ab574;_0x2ad268=_0x18e786[_0xe5ff('0xd')];var _0x1deec3=_0x2ad268[_0xe5ff('0x10')](-0x1);if(_0x1deec3==='/'||_0x1deec3==='\x5c'||_0x1deec3===':'){_0x2ad268=_0x2ad268[_0xe5ff('0x11')](0x0,_0x2ad268[_0xe5ff('0x12')](_0x1deec3));}switch(_0x18e786[_0xe5ff('0xc')]){case'US':_0x2ab574=_0xe5ff('0x13');break;case'AU':_0x2ab574=_0xe5ff('0x14');break;case'IN':_0x2ab574=_0xe5ff('0x15');break;case'CN':_0x2ab574=_0xe5ff('0x16');break;default:_0x2ab574='https://accounts.zoho.eu';break;}var _0x58bbf3={'method':'POST','uri':_0x2ab574+'/oauth/v2/token','form':{'grant_type':_0xe5ff('0x17'),'client_id':_0x18e786[_0xe5ff('0xe')],'client_secret':_0x18e786[_0xe5ff('0x18')],'redirect_uri':_0x18e786[_0xe5ff('0xd')],'code':_0x18e786['code']},'headers':{'Content-Type':_0xe5ff('0x19')}};return rp(_0x58bbf3)[_0xe5ff('0x1a')](function(_0x314089){var _0x26298d=JSON[_0xe5ff('0x1b')](_0x314089);if(_0x26298d[_0xe5ff('0x1c')]){_0x18e786['refreshToken']=_0x26298d[_0xe5ff('0x1c')];logger[_0xe5ff('0x1d')](util['format'](_0xe5ff('0x1e'),_0x18e786[_0xe5ff('0x1f')],_0x18e786['id']));}else{logger[_0xe5ff('0x20')](util[_0xe5ff('0x21')](_0xe5ff('0x22'),_0x18e786['name'],_0x18e786['id']),util[_0xe5ff('0x23')](_0x26298d,{'showHidden':![],'depth':null}));}return _0xa683c1(null,_0x34931e);})[_0xe5ff('0x24')](function(_0x5a4678){logger[_0xe5ff('0x20')](util[_0xe5ff('0x21')](_0xe5ff('0x22'),_0x18e786[_0xe5ff('0x1f')],_0x18e786['id']),util[_0xe5ff('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xa683c1(_0x5a4678);});}else{return _0xa683c1(null,_0x34931e);}},'beforeUpdate':function(_0x4131ad,_0x1c62b4,_0x10da0e){if(_0x4131ad[_0xe5ff('0xb')](_0xe5ff('0xc'))||_0x4131ad[_0xe5ff('0xb')](_0xe5ff('0xd'))||_0x4131ad[_0xe5ff('0xb')](_0xe5ff('0xe'))||_0x4131ad['changed'](_0xe5ff('0x18'))||_0x4131ad[_0xe5ff('0xb')](_0xe5ff('0xf'))||_0x4131ad[_0xe5ff('0xb')](_0xe5ff('0x25'))){var _0x164ab4,_0x46428a;_0x164ab4=_0x4131ad[_0xe5ff('0xd')];var _0xcea134=_0x164ab4[_0xe5ff('0x10')](-0x1);if(_0xcea134==='/'||_0xcea134==='\x5c'||_0xcea134===':'){_0x164ab4=_0x164ab4[_0xe5ff('0x11')](0x0,_0x164ab4[_0xe5ff('0x12')](_0xcea134));}switch(_0x4131ad[_0xe5ff('0xc')]){case'US':_0x46428a=_0xe5ff('0x13');break;case'AU':_0x46428a=_0xe5ff('0x14');break;case'IN':_0x46428a=_0xe5ff('0x15');break;case'CN':_0x46428a='https://accounts.zoho.com.cn';break;default:_0x46428a='https://accounts.zoho.eu';break;}var _0xacb604={'method':_0xe5ff('0x26'),'uri':_0x46428a+_0xe5ff('0x27'),'form':{'grant_type':_0xe5ff('0x17'),'client_id':_0x4131ad['clientId'],'client_secret':_0x4131ad[_0xe5ff('0x18')],'redirect_uri':_0x4131ad['serverUrl'],'code':_0x4131ad[_0xe5ff('0xf')]},'headers':{'Content-Type':_0xe5ff('0x19')}};return rp(_0xacb604)[_0xe5ff('0x1a')](function(_0x1e7614){var _0x49c91f=JSON[_0xe5ff('0x1b')](_0x1e7614);if(_0x49c91f['refresh_token']){_0x4131ad[_0xe5ff('0x28')]=_0x49c91f['refresh_token'];logger['info'](util[_0xe5ff('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4131ad[_0xe5ff('0x1f')],_0x4131ad['id']));}else{logger[_0xe5ff('0x20')](util[_0xe5ff('0x21')](_0xe5ff('0x22'),_0x4131ad[_0xe5ff('0x1f')],_0x4131ad['id']),util['inspect'](_0x49c91f,{'showHidden':![],'depth':null}));}return _0x10da0e(null,_0x1c62b4);})[_0xe5ff('0x24')](function(_0x5c7e8b){logger[_0xe5ff('0x20')](util[_0xe5ff('0x21')](_0xe5ff('0x22'),_0x4131ad[_0xe5ff('0x1f')],_0x4131ad['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x10da0e(_0x5c7e8b);});}else{return _0x10da0e(null,_0x1c62b4);}}}});}; \ No newline at end of file +var _0x22fa=['ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','clientSecret','host','authorization_code','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3e407d,_0x2c0980){var _0xd57088=function(_0x63efee){while(--_0x63efee){_0x3e407d['push'](_0x3e407d['shift']());}};_0xd57088(++_0x2c0980);}(_0x22fa,0x72));var _0xa22f=function(_0x1b017e,_0x2d9433){_0x1b017e=_0x1b017e-0x0;var _0x3bf16e=_0x22fa[_0x1b017e];return _0x3bf16e;};'use strict';var _=require(_0xa22f('0x0'));var util=require(_0xa22f('0x1'));var logger=require(_0xa22f('0x2'))('api');var moment=require(_0xa22f('0x3'));var BPromise=require(_0xa22f('0x4'));var rp=require(_0xa22f('0x5'));var fs=require('fs');var path=require(_0xa22f('0x6'));var rimraf=require(_0xa22f('0x7'));var config=require(_0xa22f('0x8'));var attributes=require(_0xa22f('0x9'));var integrations=require(_0xa22f('0xa'));module[_0xa22f('0xb')]=function(_0xa88068,_0x3d80eb){return _0xa88068['define'](_0xa22f('0xc'),attributes,{'tableName':_0xa22f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36fb22,_0x425275,_0x223567){if(_0x36fb22[_0xa22f('0xe')](_0xa22f('0xf'))||_0x36fb22['changed']('serverUrl')||_0x36fb22[_0xa22f('0xe')](_0xa22f('0x10'))||_0x36fb22[_0xa22f('0xe')]('clientSecret')||_0x36fb22[_0xa22f('0xe')](_0xa22f('0x11'))||_0x36fb22['changed']('host')){var _0x28bc11,_0x2bdcfa;_0x28bc11=_0x36fb22[_0xa22f('0x12')];var _0x26a0f5=_0x28bc11[_0xa22f('0x13')](-0x1);if(_0x26a0f5==='/'||_0x26a0f5==='\x5c'||_0x26a0f5===':'){_0x28bc11=_0x28bc11[_0xa22f('0x14')](0x0,_0x28bc11[_0xa22f('0x15')](_0x26a0f5));}switch(_0x36fb22['zone']){case'US':_0x2bdcfa=_0xa22f('0x16');break;case'AU':_0x2bdcfa='https://accounts.zoho.com.au';break;case'IN':_0x2bdcfa=_0xa22f('0x17');break;case'CN':_0x2bdcfa=_0xa22f('0x18');break;default:_0x2bdcfa='https://accounts.zoho.eu';break;}var _0x496ed0={'method':_0xa22f('0x19'),'uri':_0x2bdcfa+_0xa22f('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x36fb22[_0xa22f('0x10')],'client_secret':_0x36fb22['clientSecret'],'redirect_uri':_0x36fb22[_0xa22f('0x12')],'code':_0x36fb22[_0xa22f('0x11')]},'headers':{'Content-Type':_0xa22f('0x1b')}};return rp(_0x496ed0)[_0xa22f('0x1c')](function(_0x30a752){var _0x25657a=JSON[_0xa22f('0x1d')](_0x30a752);if(_0x25657a[_0xa22f('0x1e')]){_0x36fb22[_0xa22f('0x1f')]=_0x25657a[_0xa22f('0x1e')];logger['info'](util['format'](_0xa22f('0x20'),_0x36fb22[_0xa22f('0x21')],_0x36fb22['id']));}else{logger[_0xa22f('0x22')](util[_0xa22f('0x23')](_0xa22f('0x24'),_0x36fb22[_0xa22f('0x21')],_0x36fb22['id']),util['inspect'](_0x25657a,{'showHidden':![],'depth':null}));}return _0x223567(null,_0x425275);})[_0xa22f('0x25')](function(_0x361bc7){logger['error'](util[_0xa22f('0x23')](_0xa22f('0x24'),_0x36fb22[_0xa22f('0x21')],_0x36fb22['id']),util[_0xa22f('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x223567(_0x361bc7);});}else{return _0x223567(null,_0x425275);}},'beforeUpdate':function(_0x1786d5,_0x226020,_0x1dc616){if(_0x1786d5[_0xa22f('0xe')]('zone')||_0x1786d5['changed'](_0xa22f('0x12'))||_0x1786d5['changed']('clientId')||_0x1786d5[_0xa22f('0xe')](_0xa22f('0x27'))||_0x1786d5[_0xa22f('0xe')](_0xa22f('0x11'))||_0x1786d5[_0xa22f('0xe')](_0xa22f('0x28'))){var _0x313624,_0x188d9b;_0x313624=_0x1786d5[_0xa22f('0x12')];var _0x5e8aa1=_0x313624[_0xa22f('0x13')](-0x1);if(_0x5e8aa1==='/'||_0x5e8aa1==='\x5c'||_0x5e8aa1===':'){_0x313624=_0x313624[_0xa22f('0x14')](0x0,_0x313624[_0xa22f('0x15')](_0x5e8aa1));}switch(_0x1786d5[_0xa22f('0xf')]){case'US':_0x188d9b=_0xa22f('0x16');break;case'AU':_0x188d9b='https://accounts.zoho.com.au';break;case'IN':_0x188d9b=_0xa22f('0x17');break;case'CN':_0x188d9b=_0xa22f('0x18');break;default:_0x188d9b='https://accounts.zoho.eu';break;}var _0x2fe8b0={'method':_0xa22f('0x19'),'uri':_0x188d9b+_0xa22f('0x1a'),'form':{'grant_type':_0xa22f('0x29'),'client_id':_0x1786d5['clientId'],'client_secret':_0x1786d5[_0xa22f('0x27')],'redirect_uri':_0x1786d5[_0xa22f('0x12')],'code':_0x1786d5[_0xa22f('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2fe8b0)['then'](function(_0x4ccbf8){var _0x3d9015=JSON['parse'](_0x4ccbf8);if(_0x3d9015[_0xa22f('0x1e')]){_0x1786d5[_0xa22f('0x1f')]=_0x3d9015[_0xa22f('0x1e')];logger['info'](util[_0xa22f('0x23')](_0xa22f('0x20'),_0x1786d5[_0xa22f('0x21')],_0x1786d5['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1786d5[_0xa22f('0x21')],_0x1786d5['id']),util[_0xa22f('0x26')](_0x3d9015,{'showHidden':![],'depth':null}));}return _0x1dc616(null,_0x226020);})[_0xa22f('0x25')](function(_0x2c8382){logger[_0xa22f('0x22')](util[_0xa22f('0x23')](_0xa22f('0x24'),_0x1786d5[_0xa22f('0x21')],_0x1786d5['id']),util[_0xa22f('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1dc616(_0x2c8382);});}else{return _0x1dc616(null,_0x226020);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8f37349..ff2c70a 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 _0x6000=['debug','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4732e4,_0x5b0ab6){var _0x2ac1c3=function(_0x250288){while(--_0x250288){_0x4732e4['push'](_0x4732e4['shift']());}};_0x2ac1c3(++_0x5b0ab6);}(_0x6000,0x17c));var _0x0600=function(_0x3e4c31,_0x2f74db){_0x3e4c31=_0x3e4c31-0x0;var _0x455cf3=_0x6000[_0x3e4c31];return _0x455cf3;};'use strict';var _=require(_0x0600('0x0'));var util=require(_0x0600('0x1'));var moment=require(_0x0600('0x2'));var BPromise=require(_0x0600('0x3'));var rs=require(_0x0600('0x4'));var fs=require('fs');var Redis=require(_0x0600('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0600('0x6'));var logger=require(_0x0600('0x7'))('rpc');var config=require(_0x0600('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0600('0x9')][_0x0600('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89927a,_0x559495,_0x45e348){return new BPromise(function(_0x5730b2,_0x15b6d2){return client[_0x0600('0xb')](_0x89927a,_0x45e348)[_0x0600('0xc')](function(_0xacb924){logger[_0x0600('0xd')](_0x0600('0xe'),_0x559495,_0x0600('0xf'));logger[_0x0600('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x559495,_0x0600('0xf'),JSON[_0x0600('0x11')](_0xacb924));if(_0xacb924['error']){if(_0xacb924[_0x0600('0x12')][_0x0600('0x13')]===0x1f4){logger[_0x0600('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x559495,_0xacb924[_0x0600('0x12')]['message']);return _0x15b6d2(_0xacb924[_0x0600('0x12')][_0x0600('0x14')]);}logger[_0x0600('0x12')](_0x0600('0xe'),_0x559495,_0xacb924[_0x0600('0x12')]['message']);return _0x5730b2(_0xacb924[_0x0600('0x12')][_0x0600('0x14')]);}else{logger['info'](_0x0600('0xe'),_0x559495,_0x0600('0xf'));_0x5730b2(_0xacb924[_0x0600('0x15')][_0x0600('0x14')]);}})[_0x0600('0x16')](function(_0x31ced0){logger[_0x0600('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x559495,_0x31ced0);_0x15b6d2(_0x31ced0);});});}exports[_0x0600('0x17')]=function(_0x205998){var _0x25ade1=this;return new Promise(function(_0x571a0a,_0x251021){return db[_0x0600('0x18')][_0x0600('0x19')]({'raw':_0x205998[_0x0600('0x1a')]?_0x205998[_0x0600('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x205998[_0x0600('0x1a')]?_0x205998[_0x0600('0x1a')][_0x0600('0x1b')]||null:null,'attributes':_0x205998[_0x0600('0x1a')]?_0x205998['options'][_0x0600('0x1c')]||null:null,'limit':_0x205998[_0x0600('0x1a')]?_0x205998['options'][_0x0600('0x1d')]||null:null,'include':_0x205998['options']?_0x205998[_0x0600('0x1a')][_0x0600('0x1e')]?_[_0x0600('0x1f')](_0x205998['options'][_0x0600('0x1e')],function(_0x246f8c){return{'model':db[_0x246f8c['model']],'as':_0x246f8c['as'],'attributes':_0x246f8c[_0x0600('0x1c')],'include':_0x246f8c[_0x0600('0x1e')]?_['map'](_0x246f8c[_0x0600('0x1e')],function(_0x4c09fb){return{'model':db[_0x4c09fb[_0x0600('0x20')]],'as':_0x4c09fb['as'],'attributes':_0x4c09fb[_0x0600('0x1c')],'include':_0x4c09fb[_0x0600('0x1e')]?_[_0x0600('0x1f')](_0x4c09fb[_0x0600('0x1e')],function(_0x536b65){return{'model':db[_0x536b65[_0x0600('0x20')]],'as':_0x536b65['as'],'attributes':_0x536b65[_0x0600('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0600('0xc')](function(_0x5b9264){logger['info'](_0x0600('0x17'),_0x205998);logger['debug']('GetZohoAccount',_0x205998,JSON[_0x0600('0x11')](_0x5b9264));_0x571a0a(_0x5b9264);})[_0x0600('0x16')](function(_0x3b543b){logger['error'](_0x0600('0x17'),_0x3b543b[_0x0600('0x14')],_0x205998);_0x251021(_0x25ade1[_0x0600('0x12')](0x1f4,_0x3b543b[_0x0600('0x14')]));});});};exports[_0x0600('0x21')]=function(_0x657d6e){var _0x1f8ccb=this;return new Promise(function(_0x454bd4,_0x57241e){return db[_0x0600('0x18')][_0x0600('0x22')]({'raw':_0x657d6e[_0x0600('0x1a')]?_0x657d6e['options'][_0x0600('0x23')]===undefined?!![]:![]:!![],'where':_0x657d6e[_0x0600('0x1a')]?_0x657d6e['options'][_0x0600('0x1b')]||null:null,'attributes':_0x657d6e[_0x0600('0x1a')]?_0x657d6e[_0x0600('0x1a')][_0x0600('0x1c')]||null:null,'include':_0x657d6e[_0x0600('0x1a')]?_0x657d6e[_0x0600('0x1a')][_0x0600('0x1e')]?_['map'](_0x657d6e['options']['include'],function(_0x6f5533){return{'model':db[_0x6f5533[_0x0600('0x20')]],'as':_0x6f5533['as'],'attributes':_0x6f5533[_0x0600('0x1c')],'include':_0x6f5533[_0x0600('0x1e')]?_[_0x0600('0x1f')](_0x6f5533[_0x0600('0x1e')],function(_0x526d59){return{'model':db[_0x526d59[_0x0600('0x20')]],'as':_0x526d59['as'],'attributes':_0x526d59['attributes'],'include':_0x526d59[_0x0600('0x1e')]?_['map'](_0x526d59['include'],function(_0x43e05d){return{'model':db[_0x43e05d[_0x0600('0x20')]],'as':_0x43e05d['as'],'attributes':_0x43e05d[_0x0600('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0600('0xc')](function(_0x589e99){logger[_0x0600('0xd')](_0x0600('0x21'),_0x657d6e);logger[_0x0600('0x10')](_0x0600('0x21'),_0x657d6e,JSON[_0x0600('0x11')](_0x589e99));_0x454bd4(_0x589e99);})[_0x0600('0x16')](function(_0x3b3e5e){logger['error'](_0x0600('0x21'),_0x3b3e5e['message'],_0x657d6e);_0x57241e(_0x1f8ccb[_0x0600('0x12')](0x1f4,_0x3b3e5e[_0x0600('0x14')]));});});}; \ No newline at end of file +var _0xb114=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowZohoAccount','find','where','stringify','lodash'];(function(_0x4c6cd0,_0x238245){var _0x2896ee=function(_0x16d5e0){while(--_0x16d5e0){_0x4c6cd0['push'](_0x4c6cd0['shift']());}};_0x2896ee(++_0x238245);}(_0xb114,0x11f));var _0x4b11=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xb114[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x4b11('0x0'));var util=require('util');var moment=require(_0x4b11('0x1'));var BPromise=require(_0x4b11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b11('0x3'));var db=require(_0x4b11('0x4'))['db'];var utils=require(_0x4b11('0x5'));var logger=require(_0x4b11('0x6'))(_0x4b11('0x7'));var config=require(_0x4b11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4b11('0x9')][_0x4b11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41fac6,_0x91f371,_0x132ad2){return new BPromise(function(_0x283039,_0x25ff0a){return client['request'](_0x41fac6,_0x132ad2)[_0x4b11('0xb')](function(_0x4cde8d){logger[_0x4b11('0xc')](_0x4b11('0xd'),_0x91f371,_0x4b11('0xe'));logger[_0x4b11('0xf')](_0x4b11('0x10'),_0x91f371,_0x4b11('0xe'),JSON['stringify'](_0x4cde8d));if(_0x4cde8d[_0x4b11('0x11')]){if(_0x4cde8d[_0x4b11('0x11')][_0x4b11('0x12')]===0x1f4){logger[_0x4b11('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x91f371,_0x4cde8d['error'][_0x4b11('0x13')]);return _0x25ff0a(_0x4cde8d[_0x4b11('0x11')][_0x4b11('0x13')]);}logger[_0x4b11('0x11')](_0x4b11('0xd'),_0x91f371,_0x4cde8d[_0x4b11('0x11')][_0x4b11('0x13')]);return _0x283039(_0x4cde8d[_0x4b11('0x11')]['message']);}else{logger['info'](_0x4b11('0xd'),_0x91f371,_0x4b11('0xe'));_0x283039(_0x4cde8d[_0x4b11('0x14')]['message']);}})['catch'](function(_0x4dd039){logger[_0x4b11('0x11')](_0x4b11('0xd'),_0x91f371,_0x4dd039);_0x25ff0a(_0x4dd039);});});}exports[_0x4b11('0x15')]=function(_0xf14a7f){var _0xa67776=this;return new Promise(function(_0x2db145,_0x40579b){return db[_0x4b11('0x16')][_0x4b11('0x17')]({'raw':_0xf14a7f[_0x4b11('0x18')]?_0xf14a7f['options'][_0x4b11('0x19')]===undefined?!![]:![]:!![],'where':_0xf14a7f[_0x4b11('0x18')]?_0xf14a7f[_0x4b11('0x18')]['where']||null:null,'attributes':_0xf14a7f[_0x4b11('0x18')]?_0xf14a7f['options'][_0x4b11('0x1a')]||null:null,'limit':_0xf14a7f[_0x4b11('0x18')]?_0xf14a7f[_0x4b11('0x18')][_0x4b11('0x1b')]||null:null,'include':_0xf14a7f[_0x4b11('0x18')]?_0xf14a7f[_0x4b11('0x18')][_0x4b11('0x1c')]?_[_0x4b11('0x1d')](_0xf14a7f[_0x4b11('0x18')][_0x4b11('0x1c')],function(_0x3e9a73){return{'model':db[_0x3e9a73['model']],'as':_0x3e9a73['as'],'attributes':_0x3e9a73[_0x4b11('0x1a')],'include':_0x3e9a73['include']?_[_0x4b11('0x1d')](_0x3e9a73['include'],function(_0x479e85){return{'model':db[_0x479e85[_0x4b11('0x1e')]],'as':_0x479e85['as'],'attributes':_0x479e85[_0x4b11('0x1a')],'include':_0x479e85[_0x4b11('0x1c')]?_[_0x4b11('0x1d')](_0x479e85[_0x4b11('0x1c')],function(_0x5b904a){return{'model':db[_0x5b904a[_0x4b11('0x1e')]],'as':_0x5b904a['as'],'attributes':_0x5b904a[_0x4b11('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4b11('0xb')](function(_0x3e099f){logger[_0x4b11('0xc')](_0x4b11('0x15'),_0xf14a7f);logger[_0x4b11('0xf')](_0x4b11('0x15'),_0xf14a7f,JSON['stringify'](_0x3e099f));_0x2db145(_0x3e099f);})[_0x4b11('0x1f')](function(_0x15d27d){logger['error'](_0x4b11('0x15'),_0x15d27d[_0x4b11('0x13')],_0xf14a7f);_0x40579b(_0xa67776[_0x4b11('0x11')](0x1f4,_0x15d27d[_0x4b11('0x13')]));});});};exports[_0x4b11('0x20')]=function(_0x704ada){var _0x440cf5=this;return new Promise(function(_0x582d54,_0x409b01){return db[_0x4b11('0x16')][_0x4b11('0x21')]({'raw':_0x704ada['options']?_0x704ada[_0x4b11('0x18')][_0x4b11('0x19')]===undefined?!![]:![]:!![],'where':_0x704ada[_0x4b11('0x18')]?_0x704ada[_0x4b11('0x18')][_0x4b11('0x22')]||null:null,'attributes':_0x704ada[_0x4b11('0x18')]?_0x704ada['options']['attributes']||null:null,'include':_0x704ada[_0x4b11('0x18')]?_0x704ada[_0x4b11('0x18')][_0x4b11('0x1c')]?_[_0x4b11('0x1d')](_0x704ada[_0x4b11('0x18')][_0x4b11('0x1c')],function(_0x232e78){return{'model':db[_0x232e78['model']],'as':_0x232e78['as'],'attributes':_0x232e78[_0x4b11('0x1a')],'include':_0x232e78[_0x4b11('0x1c')]?_[_0x4b11('0x1d')](_0x232e78[_0x4b11('0x1c')],function(_0x18d31c){return{'model':db[_0x18d31c['model']],'as':_0x18d31c['as'],'attributes':_0x18d31c['attributes'],'include':_0x18d31c[_0x4b11('0x1c')]?_[_0x4b11('0x1d')](_0x18d31c[_0x4b11('0x1c')],function(_0x419d87){return{'model':db[_0x419d87['model']],'as':_0x419d87['as'],'attributes':_0x419d87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34846a){logger[_0x4b11('0xc')]('ShowZohoAccount',_0x704ada);logger[_0x4b11('0xf')]('ShowZohoAccount',_0x704ada,JSON[_0x4b11('0x23')](_0x34846a));_0x582d54(_0x34846a);})[_0x4b11('0x1f')](function(_0xade5cc){logger[_0x4b11('0x11')](_0x4b11('0x20'),_0xade5cc[_0x4b11('0x13')],_0x704ada);_0x409b01(_0x440cf5[_0x4b11('0x11')](0x1f4,_0xade5cc[_0x4b11('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a2f4a89..8124607 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 _0x7ba8=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0x7ba8,0x85));var _0x87ba=function(_0x4e9197,_0x29faeb){_0x4e9197=_0x4e9197-0x0;var _0xd2c647=_0x7ba8[_0x4e9197];return _0xd2c647;};'use strict';var multer=require(_0x87ba('0x0'));var util=require('util');var path=require(_0x87ba('0x1'));var timeout=require(_0x87ba('0x2'));var express=require('express');var router=express[_0x87ba('0x3')]();var fs_extra=require(_0x87ba('0x4'));var auth=require(_0x87ba('0x5'));var interaction=require(_0x87ba('0x6'));var config=require(_0x87ba('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x87ba('0x8')]('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0xa')]);router[_0x87ba('0x8')]('/:id',auth[_0x87ba('0x9')](),controller['show']);router[_0x87ba('0x8')](_0x87ba('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x87ba('0x8')](_0x87ba('0xc'),auth['isAuthenticated'](),controller[_0x87ba('0xd')]);router['get'](_0x87ba('0xe'),auth[_0x87ba('0x9')](),controller[_0x87ba('0xf')]);router[_0x87ba('0x10')]('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0x11')]);router[_0x87ba('0x12')](_0x87ba('0x13'),auth[_0x87ba('0x9')](),controller[_0x87ba('0x14')]);router[_0x87ba('0x15')]('/:id',auth[_0x87ba('0x9')](),controller[_0x87ba('0x16')]);module[_0x87ba('0x17')]=router; \ No newline at end of file +var _0xbaa8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports'];(function(_0x3545a4,_0x3f8b47){var _0x439a76=function(_0x19f98b){while(--_0x19f98b){_0x3545a4['push'](_0x3545a4['shift']());}};_0x439a76(++_0x3f8b47);}(_0xbaa8,0xd2));var _0x8baa=function(_0x17ed99,_0x2a65c3){_0x17ed99=_0x17ed99-0x0;var _0x46d1a1=_0xbaa8[_0x17ed99];return _0x46d1a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8baa('0x0'));var timeout=require(_0x8baa('0x1'));var express=require(_0x8baa('0x2'));var router=express[_0x8baa('0x3')]();var fs_extra=require(_0x8baa('0x4'));var auth=require(_0x8baa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8baa('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x8baa('0x7')]('/',auth['isAuthenticated'](),controller[_0x8baa('0x8')]);router['get'](_0x8baa('0x9'),auth[_0x8baa('0xa')](),controller[_0x8baa('0xb')]);router[_0x8baa('0x7')](_0x8baa('0xc'),auth[_0x8baa('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x8baa('0xa')](),controller[_0x8baa('0xd')]);router[_0x8baa('0x7')](_0x8baa('0xe'),auth[_0x8baa('0xa')](),controller[_0x8baa('0xf')]);router['post']('/',auth[_0x8baa('0xa')](),controller[_0x8baa('0x10')]);router[_0x8baa('0x11')]('/:id',auth[_0x8baa('0xa')](),controller[_0x8baa('0x12')]);router['delete'](_0x8baa('0x9'),auth[_0x8baa('0xa')](),controller[_0x8baa('0x13')]);module[_0x8baa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index af70d1e..c0a7da3 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 _0xb453=['ENUM','lead','contact_lead','contact','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb453,0x1e8));var _0x3b45=function(_0x2f9c0d,_0x3d0eeb){_0x2f9c0d=_0x2f9c0d-0x0;var _0x5dfd48=_0xb453[_0x2f9c0d];return _0x5dfd48;};'use strict';var Sequelize=require(_0x3b45('0x0'));module[_0x3b45('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3b45('0x2')](_0x3b45('0x3'),'contact','nothing'),'defaultValue':_0x3b45('0x3')},'moduleSearch':{'type':Sequelize[_0x3b45('0x2')](_0x3b45('0x4'),_0x3b45('0x5'),_0x3b45('0x3')),'defaultValue':_0x3b45('0x4')},'description':{'type':Sequelize[_0x3b45('0x6')]}}; \ No newline at end of file +var _0x3851=['lead','contact','sequelize','STRING','ENUM'];(function(_0x11af89,_0x118b9f){var _0x1a49a2=function(_0xc65b12){while(--_0xc65b12){_0x11af89['push'](_0x11af89['shift']());}};_0x1a49a2(++_0x118b9f);}(_0x3851,0x1b5));var _0x1385=function(_0x5f0a61,_0x3b29f9){_0x5f0a61=_0x5f0a61-0x0;var _0x1d65a2=_0x3851[_0x5f0a61];return _0x1d65a2;};'use strict';var Sequelize=require(_0x1385('0x0'));module['exports']={'name':{'type':Sequelize[_0x1385('0x1')]},'moduleCreate':{'type':Sequelize[_0x1385('0x2')](_0x1385('0x3'),'contact','nothing'),'defaultValue':_0x1385('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x1385('0x4'),_0x1385('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9c312d2..14b421f 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 _0x7a2a=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','ZohoConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','create','body','find','params','ZohoField','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x9e5f7c,_0x5cb3f3){var _0x57a2a5=function(_0x4a4219){while(--_0x4a4219){_0x9e5f7c['push'](_0x9e5f7c['shift']());}};_0x57a2a5(++_0x5cb3f3);}(_0x7a2a,0x125));var _0xa7a2=function(_0x48f62c,_0x1cddb1){_0x48f62c=_0x48f62c-0x0;var _0x503c3b=_0x7a2a[_0x48f62c];return _0x503c3b;};'use strict';var emlformat=require(_0xa7a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7a2('0x1'));var jsonpatch=require(_0xa7a2('0x2'));var rp=require(_0xa7a2('0x3'));var moment=require(_0xa7a2('0x4'));var BPromise=require(_0xa7a2('0x5'));var Mustache=require(_0xa7a2('0x6'));var util=require(_0xa7a2('0x7'));var path=require(_0xa7a2('0x8'));var sox=require('sox');var csv=require(_0xa7a2('0x9'));var ejs=require(_0xa7a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7a2('0xb'));var squel=require('squel');var crypto=require(_0xa7a2('0xc'));var jsforce=require(_0xa7a2('0xd'));var deskjs=require(_0xa7a2('0xe'));var toCsv=require(_0xa7a2('0x9'));var querystring=require(_0xa7a2('0xf'));var Papa=require('papaparse');var Redis=require(_0xa7a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa7a2('0x11'));var as=require(_0xa7a2('0x12'));var hardwareService=require(_0xa7a2('0x13'));var logger=require('../../config/logger')(_0xa7a2('0x14'));var utils=require(_0xa7a2('0x15'));var config=require(_0xa7a2('0x16'));var licenseUtil=require(_0xa7a2('0x17'));var db=require(_0xa7a2('0x18'))['db'];function respondWithStatusCode(_0x20165b,_0x168ee3){_0x168ee3=_0x168ee3||0xcc;return function(_0xea8899){if(_0xea8899){return _0x20165b[_0xa7a2('0x19')](_0x168ee3);}return _0x20165b['status'](_0x168ee3)[_0xa7a2('0x1a')]();};}function respondWithResult(_0x1af301,_0xb38775){_0xb38775=_0xb38775||0xc8;return function(_0x209ee6){if(_0x209ee6){return _0x1af301[_0xa7a2('0x1b')](_0xb38775)['json'](_0x209ee6);}};}function respondWithFilteredResult(_0x5e686e,_0x59d640){return function(_0x2ddb0d){if(_0x2ddb0d){var _0x3294fb=typeof _0x59d640[_0xa7a2('0x1c')]==='undefined'&&typeof _0x59d640['limit']==='undefined';var _0x322172=_0x2ddb0d['count'];var _0x362fe6=_0x3294fb?0x0:_0x59d640['offset'];var _0x52dc36=_0x3294fb?_0x2ddb0d[_0xa7a2('0x1d')]:_0x59d640[_0xa7a2('0x1c')]+_0x59d640[_0xa7a2('0x1e')];var _0x239a3c;if(_0x52dc36>=_0x322172){_0x52dc36=_0x322172;_0x239a3c=0xc8;}else{_0x239a3c=0xce;}_0x5e686e['status'](_0x239a3c);return _0x5e686e[_0xa7a2('0x1f')](_0xa7a2('0x20'),_0x362fe6+'-'+_0x52dc36+'/'+_0x322172)[_0xa7a2('0x21')](_0x2ddb0d);}return null;};}function patchUpdates(_0xd079ed){return function(_0x112ff){try{jsonpatch[_0xa7a2('0x22')](_0x112ff,_0xd079ed,!![]);}catch(_0x2f34f2){return BPromise[_0xa7a2('0x23')](_0x2f34f2);}return _0x112ff['save']();};}function saveUpdates(_0x1031dc,_0x16692b){return function(_0x458192){if(_0x458192){return _0x458192[_0xa7a2('0x24')](_0x1031dc)[_0xa7a2('0x25')](function(_0x1ab23d){return _0x1ab23d;});}return null;};}function removeEntity(_0x1ced94,_0x314bb8){return function(_0x476f73){if(_0x476f73){return _0x476f73[_0xa7a2('0x26')]()[_0xa7a2('0x25')](function(){_0x1ced94[_0xa7a2('0x1b')](0xcc)[_0xa7a2('0x1a')]();});}};}function handleEntityNotFound(_0x34bb57,_0x12cd67){return function(_0x2a67ad){if(!_0x2a67ad){_0x34bb57[_0xa7a2('0x19')](0x194);}return _0x2a67ad;};}function handleError(_0x46b876,_0x260449){_0x260449=_0x260449||0x1f4;return function(_0x4d2e68){logger[_0xa7a2('0x27')](_0x4d2e68['stack']);if(_0x4d2e68['name']){delete _0x4d2e68[_0xa7a2('0x28')];}_0x46b876[_0xa7a2('0x1b')](_0x260449)[_0xa7a2('0x29')](_0x4d2e68);};}exports[_0xa7a2('0x2a')]=function(_0x12e086,_0x5bb1c1){var _0x13c7a0={},_0x49885b={},_0x1cb852={'count':0x0,'rows':[]};var _0x37473f=_['map'](db[_0xa7a2('0x2b')][_0xa7a2('0x2c')],function(_0x45b142){return{'name':_0x45b142['fieldName'],'type':_0x45b142[_0xa7a2('0x2d')][_0xa7a2('0x2e')]};});_0x49885b[_0xa7a2('0x2f')]=_[_0xa7a2('0x30')](_0x37473f,_0xa7a2('0x28'));_0x49885b['query']=_[_0xa7a2('0x31')](_0x12e086[_0xa7a2('0x32')]);_0x49885b[_0xa7a2('0x33')]=_['intersection'](_0x49885b[_0xa7a2('0x2f')],_0x49885b[_0xa7a2('0x32')]);_0x13c7a0[_0xa7a2('0x34')]=_[_0xa7a2('0x35')](_0x49885b['model'],qs[_0xa7a2('0x36')](_0x12e086[_0xa7a2('0x32')][_0xa7a2('0x36')]));_0x13c7a0[_0xa7a2('0x34')]=_0x13c7a0[_0xa7a2('0x34')][_0xa7a2('0x37')]?_0x13c7a0[_0xa7a2('0x34')]:_0x49885b[_0xa7a2('0x2f')];if(!_0x12e086['query'][_0xa7a2('0x38')](_0xa7a2('0x39'))){_0x13c7a0['limit']=qs['limit'](_0x12e086[_0xa7a2('0x32')]['limit']);_0x13c7a0['offset']=qs[_0xa7a2('0x1c')](_0x12e086[_0xa7a2('0x32')][_0xa7a2('0x1c')]);}_0x13c7a0[_0xa7a2('0x3a')]=qs[_0xa7a2('0x3b')](_0x12e086[_0xa7a2('0x32')][_0xa7a2('0x3b')]);_0x13c7a0['where']=qs[_0xa7a2('0x33')](_[_0xa7a2('0x3c')](_0x12e086[_0xa7a2('0x32')],_0x49885b['filters']),_0x37473f);if(_0x12e086[_0xa7a2('0x32')][_0xa7a2('0x3d')]){_0x13c7a0[_0xa7a2('0x3e')]=_[_0xa7a2('0x3f')](_0x13c7a0[_0xa7a2('0x3e')],{'$or':_[_0xa7a2('0x30')](_0x37473f,function(_0x56ab4e){if(_0x56ab4e[_0xa7a2('0x2d')]!==_0xa7a2('0x40')){var _0xc07a1d={};_0xc07a1d[_0x56ab4e[_0xa7a2('0x28')]]={'$like':'%'+_0x12e086[_0xa7a2('0x32')][_0xa7a2('0x3d')]+'%'};return _0xc07a1d;}})});}_0x13c7a0=_[_0xa7a2('0x3f')]({},_0x13c7a0,_0x12e086[_0xa7a2('0x41')]);var _0x33169f={'where':_0x13c7a0[_0xa7a2('0x3e')]};return db[_0xa7a2('0x2b')][_0xa7a2('0x1d')](_0x33169f)[_0xa7a2('0x25')](function(_0x59d40e){_0x1cb852['count']=_0x59d40e;if(_0x12e086['query']['includeAll']){_0x13c7a0[_0xa7a2('0x42')]=[{'all':!![]}];}return db[_0xa7a2('0x2b')]['findAll'](_0x13c7a0);})[_0xa7a2('0x25')](function(_0x241134){_0x1cb852[_0xa7a2('0x43')]=_0x241134;return _0x1cb852;})[_0xa7a2('0x25')](respondWithFilteredResult(_0x5bb1c1,_0x13c7a0))[_0xa7a2('0x44')](handleError(_0x5bb1c1,null));};exports['show']=function(_0x5a86e9,_0x15e455){var _0x4b541c={'raw':![],'where':{'id':_0x5a86e9['params']['id']}},_0x4aaf88={};_0x4aaf88[_0xa7a2('0x2f')]=_[_0xa7a2('0x31')](db[_0xa7a2('0x2b')][_0xa7a2('0x2c')]);_0x4aaf88[_0xa7a2('0x32')]=_[_0xa7a2('0x31')](_0x5a86e9['query']);_0x4aaf88['filters']=_[_0xa7a2('0x35')](_0x4aaf88['model'],_0x4aaf88[_0xa7a2('0x32')]);_0x4b541c[_0xa7a2('0x34')]=_[_0xa7a2('0x35')](_0x4aaf88[_0xa7a2('0x2f')],qs[_0xa7a2('0x36')](_0x5a86e9['query']['fields']));_0x4b541c['attributes']=_0x4b541c[_0xa7a2('0x34')][_0xa7a2('0x37')]?_0x4b541c['attributes']:_0x4aaf88[_0xa7a2('0x2f')];if(_0x5a86e9[_0xa7a2('0x32')]['includeAll']){_0x4b541c[_0xa7a2('0x42')]=[{'all':!![]}];}_0x4b541c=_['merge']({},_0x4b541c,_0x5a86e9[_0xa7a2('0x41')]);return db[_0xa7a2('0x2b')]['find'](_0x4b541c)[_0xa7a2('0x25')](handleEntityNotFound(_0x15e455,null))[_0xa7a2('0x25')](respondWithResult(_0x15e455,null))[_0xa7a2('0x44')](handleError(_0x15e455,null));};exports[_0xa7a2('0x45')]=function(_0x4899f4,_0x4746a7){return db[_0xa7a2('0x2b')][_0xa7a2('0x45')](_0x4899f4['body'],{})[_0xa7a2('0x25')](respondWithResult(_0x4746a7,0xc9))[_0xa7a2('0x44')](handleError(_0x4746a7,null));};exports[_0xa7a2('0x24')]=function(_0x2f05de,_0x3caf37){if(_0x2f05de[_0xa7a2('0x46')]['id']){delete _0x2f05de[_0xa7a2('0x46')]['id'];}return db[_0xa7a2('0x2b')][_0xa7a2('0x47')]({'where':{'id':_0x2f05de[_0xa7a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3caf37,null))[_0xa7a2('0x25')](saveUpdates(_0x2f05de['body'],null))[_0xa7a2('0x25')](respondWithResult(_0x3caf37,null))['catch'](handleError(_0x3caf37,null));};exports['destroy']=function(_0x127370,_0x26a253){return db[_0xa7a2('0x2b')]['find']({'where':{'id':_0x127370[_0xa7a2('0x48')]['id']}})[_0xa7a2('0x25')](handleEntityNotFound(_0x26a253,null))[_0xa7a2('0x25')](removeEntity(_0x26a253,null))[_0xa7a2('0x44')](handleError(_0x26a253,null));};exports['getFields']=function(_0x1f2df5,_0x9d84e8,_0x315cbc){var _0x1f18de={};var _0xbfd31b={};var _0x48a327;var _0x4672d6;return db[_0xa7a2('0x2b')]['findOne']({'where':{'id':_0x1f2df5['params']['id']}})[_0xa7a2('0x25')](handleEntityNotFound(_0x9d84e8,null))[_0xa7a2('0x25')](function(_0x2ea293){if(_0x2ea293){_0x48a327=_0x2ea293;_0xbfd31b[_0xa7a2('0x2f')]=_['keys'](db[_0xa7a2('0x49')][_0xa7a2('0x2c')]);_0xbfd31b[_0xa7a2('0x32')]=_[_0xa7a2('0x31')](_0x1f2df5['query']);_0xbfd31b[_0xa7a2('0x33')]=_[_0xa7a2('0x35')](_0xbfd31b[_0xa7a2('0x2f')],_0xbfd31b[_0xa7a2('0x32')]);_0x1f18de['attributes']=_[_0xa7a2('0x35')](_0xbfd31b['model'],qs[_0xa7a2('0x36')](_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x36')]));_0x1f18de[_0xa7a2('0x34')]=_0x1f18de[_0xa7a2('0x34')][_0xa7a2('0x37')]?_0x1f18de[_0xa7a2('0x34')]:_0xbfd31b[_0xa7a2('0x2f')];_0x1f18de[_0xa7a2('0x3a')]=qs[_0xa7a2('0x3b')](_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x3b')]);_0x1f18de[_0xa7a2('0x3e')]=qs[_0xa7a2('0x33')](_['pick'](_0x1f2df5[_0xa7a2('0x32')],_0xbfd31b[_0xa7a2('0x33')]));if(_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x3d')]){_0x1f18de[_0xa7a2('0x3e')]=_[_0xa7a2('0x3f')](_0x1f18de[_0xa7a2('0x3e')],{'$or':_[_0xa7a2('0x30')](_0x1f18de[_0xa7a2('0x34')],function(_0x1c931a){var _0x28a9e1={};_0x28a9e1[_0x1c931a]={'$like':'%'+_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x3d')]+'%'};return _0x28a9e1;})});}_0x1f18de=_[_0xa7a2('0x3f')]({},_0x1f18de,_0x1f2df5[_0xa7a2('0x41')]);return _0x48a327['getFields'](_0x1f18de);}})[_0xa7a2('0x25')](function(_0x1d0964){if(_0x1d0964){_0x4672d6=_0x1d0964['length'];if(!_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x38')]('nolimit')){_0x1f18de[_0xa7a2('0x1e')]=qs[_0xa7a2('0x1e')](_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x1e')]);_0x1f18de['offset']=qs[_0xa7a2('0x1c')](_0x1f2df5[_0xa7a2('0x32')][_0xa7a2('0x1c')]);}return _0x48a327[_0xa7a2('0x4a')](_0x1f18de);}})[_0xa7a2('0x25')](function(_0x500f8c){if(_0x500f8c){return _0x500f8c?{'count':_0x4672d6,'rows':_0x500f8c}:null;}})['then'](respondWithResult(_0x9d84e8,null))[_0xa7a2('0x44')](handleError(_0x9d84e8,null));};exports[_0xa7a2('0x4b')]=function(_0x556659,_0x167d01,_0x2c56d0){var _0x2a51a9={};var _0x2beeb6={};var _0x3c4c27;var _0x3a588a;return db[_0xa7a2('0x2b')][_0xa7a2('0x4c')]({'where':{'id':_0x556659['params']['id']}})[_0xa7a2('0x25')](handleEntityNotFound(_0x167d01,null))[_0xa7a2('0x25')](function(_0x4d930d){if(_0x4d930d){_0x3c4c27=_0x4d930d;_0x2beeb6[_0xa7a2('0x2f')]=_[_0xa7a2('0x31')](db[_0xa7a2('0x49')][_0xa7a2('0x2c')]);_0x2beeb6['query']=_[_0xa7a2('0x31')](_0x556659[_0xa7a2('0x32')]);_0x2beeb6[_0xa7a2('0x33')]=_[_0xa7a2('0x35')](_0x2beeb6[_0xa7a2('0x2f')],_0x2beeb6[_0xa7a2('0x32')]);_0x2a51a9[_0xa7a2('0x34')]=_[_0xa7a2('0x35')](_0x2beeb6['model'],qs['fields'](_0x556659['query'][_0xa7a2('0x36')]));_0x2a51a9[_0xa7a2('0x34')]=_0x2a51a9[_0xa7a2('0x34')][_0xa7a2('0x37')]?_0x2a51a9[_0xa7a2('0x34')]:_0x2beeb6[_0xa7a2('0x2f')];_0x2a51a9[_0xa7a2('0x3a')]=qs[_0xa7a2('0x3b')](_0x556659['query']['sort']);_0x2a51a9[_0xa7a2('0x3e')]=qs[_0xa7a2('0x33')](_[_0xa7a2('0x3c')](_0x556659[_0xa7a2('0x32')],_0x2beeb6[_0xa7a2('0x33')]));if(_0x556659['query'][_0xa7a2('0x3d')]){_0x2a51a9['where']=_[_0xa7a2('0x3f')](_0x2a51a9['where'],{'$or':_[_0xa7a2('0x30')](_0x2a51a9[_0xa7a2('0x34')],function(_0x563cc0){var _0x46ce5e={};_0x46ce5e[_0x563cc0]={'$like':'%'+_0x556659[_0xa7a2('0x32')]['filter']+'%'};return _0x46ce5e;})});}_0x2a51a9=_['merge']({},_0x2a51a9,_0x556659[_0xa7a2('0x41')]);return _0x3c4c27['getSubjects'](_0x2a51a9);}})[_0xa7a2('0x25')](function(_0x4ff0b2){if(_0x4ff0b2){_0x3a588a=_0x4ff0b2[_0xa7a2('0x37')];if(!_0x556659['query'][_0xa7a2('0x38')](_0xa7a2('0x39'))){_0x2a51a9[_0xa7a2('0x1e')]=qs[_0xa7a2('0x1e')](_0x556659[_0xa7a2('0x32')][_0xa7a2('0x1e')]);_0x2a51a9['offset']=qs[_0xa7a2('0x1c')](_0x556659[_0xa7a2('0x32')]['offset']);}return _0x3c4c27[_0xa7a2('0x4b')](_0x2a51a9);}})[_0xa7a2('0x25')](function(_0x264f3b){if(_0x264f3b){return _0x264f3b?{'count':_0x3a588a,'rows':_0x264f3b}:null;}})[_0xa7a2('0x25')](respondWithResult(_0x167d01,null))['catch'](handleError(_0x167d01,null));};exports[_0xa7a2('0x4d')]=function(_0x1dbcd5,_0x8003a7,_0x153ccd){var _0x2a7dd7={};var _0x5c702f={};var _0x106c2d;var _0x386d4e;return db[_0xa7a2('0x2b')][_0xa7a2('0x4c')]({'where':{'id':_0x1dbcd5['params']['id']}})['then'](handleEntityNotFound(_0x8003a7,null))['then'](function(_0x1bbcc9){if(_0x1bbcc9){_0x106c2d=_0x1bbcc9;_0x5c702f[_0xa7a2('0x2f')]=_[_0xa7a2('0x31')](db[_0xa7a2('0x49')][_0xa7a2('0x2c')]);_0x5c702f[_0xa7a2('0x32')]=_['keys'](_0x1dbcd5['query']);_0x5c702f['filters']=_[_0xa7a2('0x35')](_0x5c702f['model'],_0x5c702f['query']);_0x2a7dd7[_0xa7a2('0x34')]=_[_0xa7a2('0x35')](_0x5c702f[_0xa7a2('0x2f')],qs[_0xa7a2('0x36')](_0x1dbcd5[_0xa7a2('0x32')][_0xa7a2('0x36')]));_0x2a7dd7[_0xa7a2('0x34')]=_0x2a7dd7[_0xa7a2('0x34')][_0xa7a2('0x37')]?_0x2a7dd7[_0xa7a2('0x34')]:_0x5c702f[_0xa7a2('0x2f')];_0x2a7dd7[_0xa7a2('0x3a')]=qs[_0xa7a2('0x3b')](_0x1dbcd5[_0xa7a2('0x32')]['sort']);_0x2a7dd7[_0xa7a2('0x3e')]=qs[_0xa7a2('0x33')](_[_0xa7a2('0x3c')](_0x1dbcd5[_0xa7a2('0x32')],_0x5c702f[_0xa7a2('0x33')]));if(_0x1dbcd5[_0xa7a2('0x32')][_0xa7a2('0x3d')]){_0x2a7dd7[_0xa7a2('0x3e')]=_[_0xa7a2('0x3f')](_0x2a7dd7[_0xa7a2('0x3e')],{'$or':_[_0xa7a2('0x30')](_0x2a7dd7['attributes'],function(_0x11ce6d){var _0x38a07f={};_0x38a07f[_0x11ce6d]={'$like':'%'+_0x1dbcd5['query'][_0xa7a2('0x3d')]+'%'};return _0x38a07f;})});}_0x2a7dd7=_[_0xa7a2('0x3f')]({},_0x2a7dd7,_0x1dbcd5[_0xa7a2('0x41')]);return _0x106c2d[_0xa7a2('0x4d')](_0x2a7dd7);}})['then'](function(_0x1d2b63){if(_0x1d2b63){_0x386d4e=_0x1d2b63[_0xa7a2('0x37')];if(!_0x1dbcd5['query'][_0xa7a2('0x38')](_0xa7a2('0x39'))){_0x2a7dd7[_0xa7a2('0x1e')]=qs['limit'](_0x1dbcd5[_0xa7a2('0x32')]['limit']);_0x2a7dd7[_0xa7a2('0x1c')]=qs['offset'](_0x1dbcd5['query'][_0xa7a2('0x1c')]);}return _0x106c2d[_0xa7a2('0x4d')](_0x2a7dd7);}})[_0xa7a2('0x25')](function(_0x24c02e){if(_0x24c02e){return _0x24c02e?{'count':_0x386d4e,'rows':_0x24c02e}:null;}})[_0xa7a2('0x25')](respondWithResult(_0x8003a7,null))[_0xa7a2('0x44')](handleError(_0x8003a7,null));}; \ No newline at end of file +var _0x00e4=['bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','name','send','index','map','ZohoConfiguration','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x00e4,0x98));var _0x400e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x00e4[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x400e('0x0'));var zipdir=require(_0x400e('0x1'));var jsonpatch=require(_0x400e('0x2'));var rp=require('request-promise');var moment=require(_0x400e('0x3'));var BPromise=require(_0x400e('0x4'));var Mustache=require('mustache');var util=require(_0x400e('0x5'));var path=require('path');var sox=require(_0x400e('0x6'));var csv=require('to-csv');var ejs=require(_0x400e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x400e('0x8'));var squel=require(_0x400e('0x9'));var crypto=require(_0x400e('0xa'));var jsforce=require(_0x400e('0xb'));var deskjs=require(_0x400e('0xc'));var toCsv=require(_0x400e('0xd'));var querystring=require(_0x400e('0xe'));var Papa=require(_0x400e('0xf'));var Redis=require(_0x400e('0x10'));var authService=require(_0x400e('0x11'));var qs=require(_0x400e('0x12'));var as=require(_0x400e('0x13'));var hardwareService=require(_0x400e('0x14'));var logger=require(_0x400e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x400e('0x16'));var licenseUtil=require(_0x400e('0x17'));var db=require(_0x400e('0x18'))['db'];function respondWithStatusCode(_0x392a4a,_0x183df1){_0x183df1=_0x183df1||0xcc;return function(_0x1d3a85){if(_0x1d3a85){return _0x392a4a[_0x400e('0x19')](_0x183df1);}return _0x392a4a[_0x400e('0x1a')](_0x183df1)['end']();};}function respondWithResult(_0x3f5cfb,_0x5abaf6){_0x5abaf6=_0x5abaf6||0xc8;return function(_0x35da37){if(_0x35da37){return _0x3f5cfb[_0x400e('0x1a')](_0x5abaf6)['json'](_0x35da37);}};}function respondWithFilteredResult(_0x25bc00,_0x17e4d6){return function(_0x4b3780){if(_0x4b3780){var _0x2970b5=typeof _0x17e4d6[_0x400e('0x1b')]===_0x400e('0x1c')&&typeof _0x17e4d6[_0x400e('0x1d')]==='undefined';var _0x380258=_0x4b3780['count'];var _0xd08614=_0x2970b5?0x0:_0x17e4d6['offset'];var _0x4bd539=_0x2970b5?_0x4b3780[_0x400e('0x1e')]:_0x17e4d6[_0x400e('0x1b')]+_0x17e4d6[_0x400e('0x1d')];var _0x1012a7;if(_0x4bd539>=_0x380258){_0x4bd539=_0x380258;_0x1012a7=0xc8;}else{_0x1012a7=0xce;}_0x25bc00['status'](_0x1012a7);return _0x25bc00[_0x400e('0x1f')](_0x400e('0x20'),_0xd08614+'-'+_0x4bd539+'/'+_0x380258)['json'](_0x4b3780);}return null;};}function patchUpdates(_0x5bac9e){return function(_0x258cd4){try{jsonpatch[_0x400e('0x21')](_0x258cd4,_0x5bac9e,!![]);}catch(_0x3c46cb){return BPromise['reject'](_0x3c46cb);}return _0x258cd4[_0x400e('0x22')]();};}function saveUpdates(_0x55edfe,_0x5a0416){return function(_0x59f024){if(_0x59f024){return _0x59f024[_0x400e('0x23')](_0x55edfe)[_0x400e('0x24')](function(_0x498096){return _0x498096;});}return null;};}function removeEntity(_0x4dfb54,_0x3e6fe2){return function(_0x2d46f7){if(_0x2d46f7){return _0x2d46f7['destroy']()[_0x400e('0x24')](function(){_0x4dfb54[_0x400e('0x1a')](0xcc)[_0x400e('0x25')]();});}};}function handleEntityNotFound(_0x39b8b7,_0x3efa6e){return function(_0x1dd675){if(!_0x1dd675){_0x39b8b7['sendStatus'](0x194);}return _0x1dd675;};}function handleError(_0x1218c7,_0x262d00){_0x262d00=_0x262d00||0x1f4;return function(_0x4eb603){logger['error'](_0x4eb603['stack']);if(_0x4eb603[_0x400e('0x26')]){delete _0x4eb603[_0x400e('0x26')];}_0x1218c7[_0x400e('0x1a')](_0x262d00)[_0x400e('0x27')](_0x4eb603);};}exports[_0x400e('0x28')]=function(_0x110358,_0x18e746){var _0x45d022={},_0x18bfdf={},_0x25bf16={'count':0x0,'rows':[]};var _0x49e1ad=_[_0x400e('0x29')](db[_0x400e('0x2a')][_0x400e('0x2b')],function(_0x229ad8){return{'name':_0x229ad8['fieldName'],'type':_0x229ad8[_0x400e('0x2c')]['key']};});_0x18bfdf[_0x400e('0x2d')]=_['map'](_0x49e1ad,_0x400e('0x26'));_0x18bfdf[_0x400e('0x2e')]=_['keys'](_0x110358['query']);_0x18bfdf[_0x400e('0x2f')]=_[_0x400e('0x30')](_0x18bfdf[_0x400e('0x2d')],_0x18bfdf[_0x400e('0x2e')]);_0x45d022[_0x400e('0x31')]=_[_0x400e('0x30')](_0x18bfdf['model'],qs[_0x400e('0x32')](_0x110358[_0x400e('0x2e')][_0x400e('0x32')]));_0x45d022['attributes']=_0x45d022[_0x400e('0x31')][_0x400e('0x33')]?_0x45d022[_0x400e('0x31')]:_0x18bfdf[_0x400e('0x2d')];if(!_0x110358[_0x400e('0x2e')][_0x400e('0x34')](_0x400e('0x35'))){_0x45d022[_0x400e('0x1d')]=qs[_0x400e('0x1d')](_0x110358['query']['limit']);_0x45d022['offset']=qs['offset'](_0x110358['query'][_0x400e('0x1b')]);}_0x45d022[_0x400e('0x36')]=qs[_0x400e('0x37')](_0x110358['query']['sort']);_0x45d022[_0x400e('0x38')]=qs[_0x400e('0x2f')](_[_0x400e('0x39')](_0x110358[_0x400e('0x2e')],_0x18bfdf[_0x400e('0x2f')]),_0x49e1ad);if(_0x110358[_0x400e('0x2e')]['filter']){_0x45d022[_0x400e('0x38')]=_[_0x400e('0x3a')](_0x45d022[_0x400e('0x38')],{'$or':_['map'](_0x49e1ad,function(_0x3632b6){if(_0x3632b6['type']!==_0x400e('0x3b')){var _0x134e50={};_0x134e50[_0x3632b6[_0x400e('0x26')]]={'$like':'%'+_0x110358['query'][_0x400e('0x3c')]+'%'};return _0x134e50;}})});}_0x45d022=_[_0x400e('0x3a')]({},_0x45d022,_0x110358[_0x400e('0x3d')]);var _0x1d3790={'where':_0x45d022[_0x400e('0x38')]};return db[_0x400e('0x2a')][_0x400e('0x1e')](_0x1d3790)['then'](function(_0x1d7909){_0x25bf16[_0x400e('0x1e')]=_0x1d7909;if(_0x110358['query'][_0x400e('0x3e')]){_0x45d022[_0x400e('0x3f')]=[{'all':!![]}];}return db[_0x400e('0x2a')]['findAll'](_0x45d022);})['then'](function(_0x412b47){_0x25bf16[_0x400e('0x40')]=_0x412b47;return _0x25bf16;})[_0x400e('0x24')](respondWithFilteredResult(_0x18e746,_0x45d022))[_0x400e('0x41')](handleError(_0x18e746,null));};exports[_0x400e('0x42')]=function(_0x31e98a,_0x5d71b6){var _0x504f79={'raw':![],'where':{'id':_0x31e98a[_0x400e('0x43')]['id']}},_0x128323={};_0x128323[_0x400e('0x2d')]=_[_0x400e('0x44')](db[_0x400e('0x2a')]['rawAttributes']);_0x128323[_0x400e('0x2e')]=_[_0x400e('0x44')](_0x31e98a['query']);_0x128323[_0x400e('0x2f')]=_['intersection'](_0x128323[_0x400e('0x2d')],_0x128323['query']);_0x504f79['attributes']=_[_0x400e('0x30')](_0x128323[_0x400e('0x2d')],qs[_0x400e('0x32')](_0x31e98a[_0x400e('0x2e')]['fields']));_0x504f79[_0x400e('0x31')]=_0x504f79[_0x400e('0x31')]['length']?_0x504f79[_0x400e('0x31')]:_0x128323[_0x400e('0x2d')];if(_0x31e98a['query']['includeAll']){_0x504f79[_0x400e('0x3f')]=[{'all':!![]}];}_0x504f79=_[_0x400e('0x3a')]({},_0x504f79,_0x31e98a[_0x400e('0x3d')]);return db[_0x400e('0x2a')][_0x400e('0x45')](_0x504f79)['then'](handleEntityNotFound(_0x5d71b6,null))[_0x400e('0x24')](respondWithResult(_0x5d71b6,null))['catch'](handleError(_0x5d71b6,null));};exports[_0x400e('0x46')]=function(_0x1b5b70,_0x1f7262){return db[_0x400e('0x2a')][_0x400e('0x46')](_0x1b5b70[_0x400e('0x47')],{})[_0x400e('0x24')](respondWithResult(_0x1f7262,0xc9))[_0x400e('0x41')](handleError(_0x1f7262,null));};exports['update']=function(_0x677bed,_0x18eb1d){if(_0x677bed['body']['id']){delete _0x677bed['body']['id'];}return db[_0x400e('0x2a')][_0x400e('0x45')]({'where':{'id':_0x677bed['params']['id']}})[_0x400e('0x24')](handleEntityNotFound(_0x18eb1d,null))['then'](saveUpdates(_0x677bed[_0x400e('0x47')],null))['then'](respondWithResult(_0x18eb1d,null))['catch'](handleError(_0x18eb1d,null));};exports[_0x400e('0x48')]=function(_0x5c6550,_0x2373f0){return db[_0x400e('0x2a')][_0x400e('0x45')]({'where':{'id':_0x5c6550['params']['id']}})[_0x400e('0x24')](handleEntityNotFound(_0x2373f0,null))[_0x400e('0x24')](removeEntity(_0x2373f0,null))[_0x400e('0x41')](handleError(_0x2373f0,null));};exports[_0x400e('0x49')]=function(_0x138289,_0x235842,_0x4b985c){var _0x40880b={};var _0x59e087={};var _0x1afc01;var _0x197eb0;return db[_0x400e('0x2a')]['findOne']({'where':{'id':_0x138289[_0x400e('0x43')]['id']}})[_0x400e('0x24')](handleEntityNotFound(_0x235842,null))[_0x400e('0x24')](function(_0x3b6dcf){if(_0x3b6dcf){_0x1afc01=_0x3b6dcf;_0x59e087[_0x400e('0x2d')]=_[_0x400e('0x44')](db[_0x400e('0x4a')][_0x400e('0x2b')]);_0x59e087[_0x400e('0x2e')]=_[_0x400e('0x44')](_0x138289[_0x400e('0x2e')]);_0x59e087[_0x400e('0x2f')]=_[_0x400e('0x30')](_0x59e087[_0x400e('0x2d')],_0x59e087[_0x400e('0x2e')]);_0x40880b['attributes']=_['intersection'](_0x59e087[_0x400e('0x2d')],qs[_0x400e('0x32')](_0x138289[_0x400e('0x2e')][_0x400e('0x32')]));_0x40880b[_0x400e('0x31')]=_0x40880b[_0x400e('0x31')][_0x400e('0x33')]?_0x40880b['attributes']:_0x59e087['model'];_0x40880b['order']=qs[_0x400e('0x37')](_0x138289[_0x400e('0x2e')]['sort']);_0x40880b[_0x400e('0x38')]=qs['filters'](_['pick'](_0x138289['query'],_0x59e087[_0x400e('0x2f')]));if(_0x138289['query'][_0x400e('0x3c')]){_0x40880b['where']=_['merge'](_0x40880b['where'],{'$or':_[_0x400e('0x29')](_0x40880b[_0x400e('0x31')],function(_0x17c6ae){var _0x1b169a={};_0x1b169a[_0x17c6ae]={'$like':'%'+_0x138289[_0x400e('0x2e')]['filter']+'%'};return _0x1b169a;})});}_0x40880b=_[_0x400e('0x3a')]({},_0x40880b,_0x138289[_0x400e('0x3d')]);return _0x1afc01['getFields'](_0x40880b);}})[_0x400e('0x24')](function(_0x594c47){if(_0x594c47){_0x197eb0=_0x594c47[_0x400e('0x33')];if(!_0x138289[_0x400e('0x2e')][_0x400e('0x34')](_0x400e('0x35'))){_0x40880b[_0x400e('0x1d')]=qs[_0x400e('0x1d')](_0x138289[_0x400e('0x2e')][_0x400e('0x1d')]);_0x40880b[_0x400e('0x1b')]=qs[_0x400e('0x1b')](_0x138289[_0x400e('0x2e')][_0x400e('0x1b')]);}return _0x1afc01['getFields'](_0x40880b);}})[_0x400e('0x24')](function(_0x36dcd5){if(_0x36dcd5){return _0x36dcd5?{'count':_0x197eb0,'rows':_0x36dcd5}:null;}})[_0x400e('0x24')](respondWithResult(_0x235842,null))[_0x400e('0x41')](handleError(_0x235842,null));};exports[_0x400e('0x4b')]=function(_0x408d3c,_0x53d741,_0x107bb3){var _0x8e5c2c={};var _0x32b7a3={};var _0x4c4fdf;var _0x10b5be;return db['ZohoConfiguration'][_0x400e('0x4c')]({'where':{'id':_0x408d3c[_0x400e('0x43')]['id']}})[_0x400e('0x24')](handleEntityNotFound(_0x53d741,null))['then'](function(_0x3eed55){if(_0x3eed55){_0x4c4fdf=_0x3eed55;_0x32b7a3[_0x400e('0x2d')]=_['keys'](db[_0x400e('0x4a')]['rawAttributes']);_0x32b7a3[_0x400e('0x2e')]=_[_0x400e('0x44')](_0x408d3c['query']);_0x32b7a3[_0x400e('0x2f')]=_[_0x400e('0x30')](_0x32b7a3[_0x400e('0x2d')],_0x32b7a3[_0x400e('0x2e')]);_0x8e5c2c[_0x400e('0x31')]=_[_0x400e('0x30')](_0x32b7a3[_0x400e('0x2d')],qs[_0x400e('0x32')](_0x408d3c[_0x400e('0x2e')][_0x400e('0x32')]));_0x8e5c2c[_0x400e('0x31')]=_0x8e5c2c[_0x400e('0x31')]['length']?_0x8e5c2c[_0x400e('0x31')]:_0x32b7a3['model'];_0x8e5c2c[_0x400e('0x36')]=qs['sort'](_0x408d3c[_0x400e('0x2e')]['sort']);_0x8e5c2c[_0x400e('0x38')]=qs[_0x400e('0x2f')](_[_0x400e('0x39')](_0x408d3c[_0x400e('0x2e')],_0x32b7a3[_0x400e('0x2f')]));if(_0x408d3c[_0x400e('0x2e')][_0x400e('0x3c')]){_0x8e5c2c[_0x400e('0x38')]=_[_0x400e('0x3a')](_0x8e5c2c['where'],{'$or':_[_0x400e('0x29')](_0x8e5c2c[_0x400e('0x31')],function(_0x1a3126){var _0x1ff628={};_0x1ff628[_0x1a3126]={'$like':'%'+_0x408d3c[_0x400e('0x2e')][_0x400e('0x3c')]+'%'};return _0x1ff628;})});}_0x8e5c2c=_[_0x400e('0x3a')]({},_0x8e5c2c,_0x408d3c[_0x400e('0x3d')]);return _0x4c4fdf[_0x400e('0x4b')](_0x8e5c2c);}})['then'](function(_0x488c09){if(_0x488c09){_0x10b5be=_0x488c09[_0x400e('0x33')];if(!_0x408d3c['query'][_0x400e('0x34')](_0x400e('0x35'))){_0x8e5c2c['limit']=qs[_0x400e('0x1d')](_0x408d3c[_0x400e('0x2e')][_0x400e('0x1d')]);_0x8e5c2c['offset']=qs[_0x400e('0x1b')](_0x408d3c[_0x400e('0x2e')]['offset']);}return _0x4c4fdf['getSubjects'](_0x8e5c2c);}})[_0x400e('0x24')](function(_0x5eceaf){if(_0x5eceaf){return _0x5eceaf?{'count':_0x10b5be,'rows':_0x5eceaf}:null;}})[_0x400e('0x24')](respondWithResult(_0x53d741,null))[_0x400e('0x41')](handleError(_0x53d741,null));};exports[_0x400e('0x4d')]=function(_0x18cfea,_0x570af1,_0x48bde2){var _0x25bdb3={};var _0xef94ba={};var _0x545785;var _0x335d53;return db[_0x400e('0x2a')]['findOne']({'where':{'id':_0x18cfea[_0x400e('0x43')]['id']}})[_0x400e('0x24')](handleEntityNotFound(_0x570af1,null))[_0x400e('0x24')](function(_0x9b6686){if(_0x9b6686){_0x545785=_0x9b6686;_0xef94ba[_0x400e('0x2d')]=_[_0x400e('0x44')](db[_0x400e('0x4a')][_0x400e('0x2b')]);_0xef94ba['query']=_[_0x400e('0x44')](_0x18cfea[_0x400e('0x2e')]);_0xef94ba['filters']=_[_0x400e('0x30')](_0xef94ba[_0x400e('0x2d')],_0xef94ba[_0x400e('0x2e')]);_0x25bdb3[_0x400e('0x31')]=_[_0x400e('0x30')](_0xef94ba[_0x400e('0x2d')],qs['fields'](_0x18cfea[_0x400e('0x2e')][_0x400e('0x32')]));_0x25bdb3[_0x400e('0x31')]=_0x25bdb3[_0x400e('0x31')][_0x400e('0x33')]?_0x25bdb3[_0x400e('0x31')]:_0xef94ba[_0x400e('0x2d')];_0x25bdb3['order']=qs[_0x400e('0x37')](_0x18cfea[_0x400e('0x2e')]['sort']);_0x25bdb3[_0x400e('0x38')]=qs[_0x400e('0x2f')](_['pick'](_0x18cfea[_0x400e('0x2e')],_0xef94ba[_0x400e('0x2f')]));if(_0x18cfea['query'][_0x400e('0x3c')]){_0x25bdb3[_0x400e('0x38')]=_[_0x400e('0x3a')](_0x25bdb3[_0x400e('0x38')],{'$or':_[_0x400e('0x29')](_0x25bdb3['attributes'],function(_0x305e12){var _0x442d62={};_0x442d62[_0x305e12]={'$like':'%'+_0x18cfea['query'][_0x400e('0x3c')]+'%'};return _0x442d62;})});}_0x25bdb3=_[_0x400e('0x3a')]({},_0x25bdb3,_0x18cfea[_0x400e('0x3d')]);return _0x545785[_0x400e('0x4d')](_0x25bdb3);}})[_0x400e('0x24')](function(_0x555e43){if(_0x555e43){_0x335d53=_0x555e43[_0x400e('0x33')];if(!_0x18cfea[_0x400e('0x2e')][_0x400e('0x34')](_0x400e('0x35'))){_0x25bdb3[_0x400e('0x1d')]=qs['limit'](_0x18cfea[_0x400e('0x2e')][_0x400e('0x1d')]);_0x25bdb3[_0x400e('0x1b')]=qs[_0x400e('0x1b')](_0x18cfea[_0x400e('0x2e')]['offset']);}return _0x545785[_0x400e('0x4d')](_0x25bdb3);}})[_0x400e('0x24')](function(_0x417eea){if(_0x417eea){return _0x417eea?{'count':_0x335d53,'rows':_0x417eea}:null;}})[_0x400e('0x24')](respondWithResult(_0x570af1,null))[_0x400e('0x41')](handleError(_0x570af1,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 75ddd45..a2c9baa 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 _0x98bc=['ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x24fef8,_0x470e9b){var _0x517938=function(_0x92f678){while(--_0x92f678){_0x24fef8['push'](_0x24fef8['shift']());}};_0x517938(++_0x470e9b);}(_0x98bc,0xd9));var _0xc98b=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x98bc[_0x179b53];return _0x38a146;};'use strict';var _=require(_0xc98b('0x0'));var util=require(_0xc98b('0x1'));var logger=require(_0xc98b('0x2'))(_0xc98b('0x3'));var moment=require(_0xc98b('0x4'));var BPromise=require(_0xc98b('0x5'));var rp=require(_0xc98b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc98b('0x7'));var attributes=require(_0xc98b('0x8'));module[_0xc98b('0x9')]=function(_0x497ee7,_0x164b5b){return _0x497ee7[_0xc98b('0xa')](_0xc98b('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86c2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','../../config/logger'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x86c2,0xdb));var _0x286c=function(_0x1f745a,_0x1c5165){_0x1f745a=_0x1f745a-0x0;var _0x545097=_0x86c2[_0x1f745a];return _0x545097;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x286c('0x0'))(_0x286c('0x1'));var moment=require(_0x286c('0x2'));var BPromise=require(_0x286c('0x3'));var rp=require(_0x286c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x286c('0x5'));var config=require(_0x286c('0x6'));var attributes=require(_0x286c('0x7'));module[_0x286c('0x8')]=function(_0x62cb54,_0x4f0ff2){return _0x62cb54[_0x286c('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x286c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 5a18b07..0e0a427 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 _0xea1d=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x65ead5,_0x5051a2){var _0x5dca2e=function(_0x3ab8c4){while(--_0x3ab8c4){_0x65ead5['push'](_0x65ead5['shift']());}};_0x5dca2e(++_0x5051a2);}(_0xea1d,0x14d));var _0xdea1=function(_0x406dcc,_0x5b8697){_0x406dcc=_0x406dcc-0x0;var _0x3567b1=_0xea1d[_0x406dcc];return _0x3567b1;};'use strict';var _=require(_0xdea1('0x0'));var util=require(_0xdea1('0x1'));var moment=require(_0xdea1('0x2'));var BPromise=require(_0xdea1('0x3'));var rs=require(_0xdea1('0x4'));var fs=require('fs');var Redis=require(_0xdea1('0x5'));var db=require(_0xdea1('0x6'))['db'];var utils=require(_0xdea1('0x7'));var logger=require(_0xdea1('0x8'))(_0xdea1('0x9'));var config=require(_0xdea1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdea1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fdde,_0x49957b,_0x188cd3){return new BPromise(function(_0x22a352,_0x1eb7ce){return client['request'](_0x48fdde,_0x188cd3)[_0xdea1('0xc')](function(_0x5f59a4){logger[_0xdea1('0xd')](_0xdea1('0xe'),_0x49957b,_0xdea1('0xf'));logger[_0xdea1('0x10')](_0xdea1('0x11'),_0x49957b,'request\x20sent',JSON[_0xdea1('0x12')](_0x5f59a4));if(_0x5f59a4[_0xdea1('0x13')]){if(_0x5f59a4[_0xdea1('0x13')]['code']===0x1f4){logger[_0xdea1('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x49957b,_0x5f59a4[_0xdea1('0x13')][_0xdea1('0x14')]);return _0x1eb7ce(_0x5f59a4['error']['message']);}logger[_0xdea1('0x13')](_0xdea1('0xe'),_0x49957b,_0x5f59a4[_0xdea1('0x13')][_0xdea1('0x14')]);return _0x22a352(_0x5f59a4[_0xdea1('0x13')]['message']);}else{logger[_0xdea1('0xd')](_0xdea1('0xe'),_0x49957b,'request\x20sent');_0x22a352(_0x5f59a4[_0xdea1('0x15')][_0xdea1('0x14')]);}})[_0xdea1('0x16')](function(_0x2041fa){logger['error'](_0xdea1('0xe'),_0x49957b,_0x2041fa);_0x1eb7ce(_0x2041fa);});});} \ No newline at end of file +var _0xcb5b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x4a918f,_0x418e73){var _0x346e74=function(_0x58505c){while(--_0x58505c){_0x4a918f['push'](_0x4a918f['shift']());}};_0x346e74(++_0x418e73);}(_0xcb5b,0x122));var _0xbcb5=function(_0x53c982,_0x22655d){_0x53c982=_0x53c982-0x0;var _0x1cb3c0=_0xcb5b[_0x53c982];return _0x1cb3c0;};'use strict';var _=require(_0xbcb5('0x0'));var util=require(_0xbcb5('0x1'));var moment=require(_0xbcb5('0x2'));var BPromise=require(_0xbcb5('0x3'));var rs=require(_0xbcb5('0x4'));var fs=require('fs');var Redis=require(_0xbcb5('0x5'));var db=require(_0xbcb5('0x6'))['db'];var utils=require(_0xbcb5('0x7'));var logger=require(_0xbcb5('0x8'))('rpc');var config=require(_0xbcb5('0x9'));var jayson=require(_0xbcb5('0xa'));var client=jayson[_0xbcb5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0000,_0x2ed3bc,_0x5b0cad){return new BPromise(function(_0x3e863a,_0x3a7c38){return client['request'](_0x3d0000,_0x5b0cad)['then'](function(_0x5dae22){logger[_0xbcb5('0xc')](_0xbcb5('0xd'),_0x2ed3bc,_0xbcb5('0xe'));logger[_0xbcb5('0xf')](_0xbcb5('0x10'),_0x2ed3bc,_0xbcb5('0xe'),JSON[_0xbcb5('0x11')](_0x5dae22));if(_0x5dae22[_0xbcb5('0x12')]){if(_0x5dae22[_0xbcb5('0x12')][_0xbcb5('0x13')]===0x1f4){logger[_0xbcb5('0x12')](_0xbcb5('0xd'),_0x2ed3bc,_0x5dae22['error']['message']);return _0x3a7c38(_0x5dae22['error'][_0xbcb5('0x14')]);}logger[_0xbcb5('0x12')](_0xbcb5('0xd'),_0x2ed3bc,_0x5dae22[_0xbcb5('0x12')][_0xbcb5('0x14')]);return _0x3e863a(_0x5dae22[_0xbcb5('0x12')][_0xbcb5('0x14')]);}else{logger[_0xbcb5('0xc')](_0xbcb5('0xd'),_0x2ed3bc,_0xbcb5('0xe'));_0x3e863a(_0x5dae22['result'][_0xbcb5('0x14')]);}})['catch'](function(_0x1b2a9d){logger[_0xbcb5('0x12')](_0xbcb5('0xd'),_0x2ed3bc,_0x1b2a9d);_0x3a7c38(_0x1b2a9d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f79b8d4..95c14e8 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 _0x873d=['/:id','show','create','put','isAuthenticated','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index'];(function(_0x3d3601,_0x41c712){var _0x39be09=function(_0x544268){while(--_0x544268){_0x3d3601['push'](_0x3d3601['shift']());}};_0x39be09(++_0x41c712);}(_0x873d,0x1e4));var _0xd873=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x873d[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0xd873('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd873('0x1'));var express=require(_0xd873('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd873('0x3'));var interaction=require(_0xd873('0x4'));var config=require(_0xd873('0x5'));var controller=require(_0xd873('0x6'));router[_0xd873('0x7')]('/',auth['isAuthenticated'](),controller[_0xd873('0x8')]);router[_0xd873('0x7')](_0xd873('0x9'),auth['isAuthenticated'](),controller[_0xd873('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd873('0xb')]);router[_0xd873('0xc')](_0xd873('0x9'),auth[_0xd873('0xd')](),controller[_0xd873('0xe')]);router[_0xd873('0xf')]('/:id',auth[_0xd873('0xd')](),controller[_0xd873('0x10')]);module['exports']=router; \ No newline at end of file +var _0xec28=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xec28,0x1c2));var _0x8ec2=function(_0x294726,_0x5db9e9){_0x294726=_0x294726-0x0;var _0x39e2e3=_0xec28[_0x294726];return _0x39e2e3;};'use strict';var multer=require(_0x8ec2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ec2('0x1'));var express=require(_0x8ec2('0x2'));var router=express[_0x8ec2('0x3')]();var fs_extra=require(_0x8ec2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ec2('0x5'));var config=require('../../config/environment');var controller=require(_0x8ec2('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ec2('0x7')]);router[_0x8ec2('0x8')](_0x8ec2('0x9'),auth[_0x8ec2('0xa')](),controller['show']);router[_0x8ec2('0xb')]('/',auth[_0x8ec2('0xa')](),controller[_0x8ec2('0xc')]);router[_0x8ec2('0xd')](_0x8ec2('0x9'),auth['isAuthenticated'](),controller[_0x8ec2('0xe')]);router[_0x8ec2('0xf')](_0x8ec2('0x9'),auth['isAuthenticated'](),controller[_0x8ec2('0x10')]);module[_0x8ec2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 95da810..c5d009b 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 _0xb059=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0xd5e472,_0x550823){var _0x50f49e=function(_0x55f5a6){while(--_0x55f5a6){_0xd5e472['push'](_0xd5e472['shift']());}};_0x50f49e(++_0x550823);}(_0xb059,0x195));var _0x9b05=function(_0x21e2e9,_0x44344f){_0x21e2e9=_0x21e2e9-0x0;var _0x18be69=_0xb059[_0x21e2e9];return _0x18be69;};'use strict';var Sequelize=require(_0x9b05('0x0'));module[_0x9b05('0x1')]={'type':{'type':Sequelize[_0x9b05('0x2')](_0x9b05('0x3'),_0x9b05('0x4'),_0x9b05('0x5'),'keyValue',_0x9b05('0x6')),'defaultValue':_0x9b05('0x3')},'content':{'type':Sequelize[_0x9b05('0x7')]},'key':{'type':Sequelize[_0x9b05('0x7')]},'keyType':{'type':Sequelize[_0x9b05('0x2')](_0x9b05('0x3'),'variable',_0x9b05('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9b05('0x7')]},'customField':{'type':Sequelize[_0x9b05('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b05('0x7')]}}; \ No newline at end of file +var _0x517e=['string','variable','picklist','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x331f97,_0x1a91a4){var _0x3e022b=function(_0x30cc9c){while(--_0x30cc9c){_0x331f97['push'](_0x331f97['shift']());}};_0x3e022b(++_0x1a91a4);}(_0x517e,0x16e));var _0xe517=function(_0x2f39f5,_0x572439){_0x2f39f5=_0x2f39f5-0x0;var _0x4c1592=_0x517e[_0x2f39f5];return _0x4c1592;};'use strict';var Sequelize=require('sequelize');module[_0xe517('0x0')]={'type':{'type':Sequelize[_0xe517('0x1')](_0xe517('0x2'),_0xe517('0x3'),'customVariable','keyValue',_0xe517('0x4')),'defaultValue':_0xe517('0x2')},'content':{'type':Sequelize[_0xe517('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe517('0x1')](_0xe517('0x2'),_0xe517('0x3'),_0xe517('0x6'))},'keyContent':{'type':Sequelize[_0xe517('0x5')]},'idField':{'type':Sequelize[_0xe517('0x5')]},'nameField':{'type':Sequelize[_0xe517('0x5')]},'customField':{'type':Sequelize[_0xe517('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe517('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 9a71379..e43bf4b 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 _0xfccf=['index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','ZohoField','includeAll','include','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send'];(function(_0x2dc44d,_0x79148d){var _0x33a1e6=function(_0x4fab8d){while(--_0x4fab8d){_0x2dc44d['push'](_0x2dc44d['shift']());}};_0x33a1e6(++_0x79148d);}(_0xfccf,0x192));var _0xffcc=function(_0x5a9e9,_0x4a40ac){_0x5a9e9=_0x5a9e9-0x0;var _0x4a80de=_0xfccf[_0x5a9e9];return _0x4a80de;};'use strict';var emlformat=require(_0xffcc('0x0'));var rimraf=require(_0xffcc('0x1'));var zipdir=require(_0xffcc('0x2'));var jsonpatch=require(_0xffcc('0x3'));var rp=require('request-promise');var moment=require(_0xffcc('0x4'));var BPromise=require(_0xffcc('0x5'));var Mustache=require('mustache');var util=require(_0xffcc('0x6'));var path=require('path');var sox=require(_0xffcc('0x7'));var csv=require(_0xffcc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffcc('0x9'));var squel=require('squel');var crypto=require(_0xffcc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xffcc('0xb'));var toCsv=require(_0xffcc('0x8'));var querystring=require(_0xffcc('0xc'));var Papa=require(_0xffcc('0xd'));var Redis=require(_0xffcc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xffcc('0xf'));var as=require(_0xffcc('0x10'));var hardwareService=require(_0xffcc('0x11'));var logger=require(_0xffcc('0x12'))('api');var utils=require(_0xffcc('0x13'));var config=require(_0xffcc('0x14'));var licenseUtil=require(_0xffcc('0x15'));var db=require(_0xffcc('0x16'))['db'];function respondWithStatusCode(_0x258be7,_0xf56ce0){_0xf56ce0=_0xf56ce0||0xcc;return function(_0xc846a9){if(_0xc846a9){return _0x258be7['sendStatus'](_0xf56ce0);}return _0x258be7[_0xffcc('0x17')](_0xf56ce0)[_0xffcc('0x18')]();};}function respondWithResult(_0x5a73e1,_0x41f267){_0x41f267=_0x41f267||0xc8;return function(_0x4c345b){if(_0x4c345b){return _0x5a73e1[_0xffcc('0x17')](_0x41f267)[_0xffcc('0x19')](_0x4c345b);}};}function respondWithFilteredResult(_0x5de898,_0xb097c8){return function(_0x53b092){if(_0x53b092){var _0x3ac866=typeof _0xb097c8[_0xffcc('0x1a')]===_0xffcc('0x1b')&&typeof _0xb097c8[_0xffcc('0x1c')]===_0xffcc('0x1b');var _0x4f1922=_0x53b092[_0xffcc('0x1d')];var _0x53ced7=_0x3ac866?0x0:_0xb097c8[_0xffcc('0x1a')];var _0x1c8c0b=_0x3ac866?_0x53b092[_0xffcc('0x1d')]:_0xb097c8[_0xffcc('0x1a')]+_0xb097c8[_0xffcc('0x1c')];var _0x8b22f;if(_0x1c8c0b>=_0x4f1922){_0x1c8c0b=_0x4f1922;_0x8b22f=0xc8;}else{_0x8b22f=0xce;}_0x5de898['status'](_0x8b22f);return _0x5de898[_0xffcc('0x1e')](_0xffcc('0x1f'),_0x53ced7+'-'+_0x1c8c0b+'/'+_0x4f1922)[_0xffcc('0x19')](_0x53b092);}return null;};}function patchUpdates(_0x4f40cd){return function(_0x231f62){try{jsonpatch[_0xffcc('0x20')](_0x231f62,_0x4f40cd,!![]);}catch(_0x40d08c){return BPromise[_0xffcc('0x21')](_0x40d08c);}return _0x231f62[_0xffcc('0x22')]();};}function saveUpdates(_0x30e0bb,_0x4ca07e){return function(_0x272745){if(_0x272745){return _0x272745[_0xffcc('0x23')](_0x30e0bb)['then'](function(_0x3fecae){return _0x3fecae;});}return null;};}function removeEntity(_0x1fed02,_0x41b708){return function(_0x2230fb){if(_0x2230fb){return _0x2230fb['destroy']()[_0xffcc('0x24')](function(){_0x1fed02[_0xffcc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3976c1,_0x18053d){return function(_0x115c79){if(!_0x115c79){_0x3976c1[_0xffcc('0x25')](0x194);}return _0x115c79;};}function handleError(_0x4def46,_0x520072){_0x520072=_0x520072||0x1f4;return function(_0x1f3fcf){logger[_0xffcc('0x26')](_0x1f3fcf[_0xffcc('0x27')]);if(_0x1f3fcf[_0xffcc('0x28')]){delete _0x1f3fcf[_0xffcc('0x28')];}_0x4def46[_0xffcc('0x17')](_0x520072)[_0xffcc('0x29')](_0x1f3fcf);};}exports[_0xffcc('0x2a')]=function(_0xb02abc,_0x1b2832){var _0x560534={},_0x36c529={},_0x44e871={'count':0x0,'rows':[]};var _0x143da0=_[_0xffcc('0x2b')](db['ZohoField'][_0xffcc('0x2c')],function(_0x4157f5){return{'name':_0x4157f5[_0xffcc('0x2d')],'type':_0x4157f5[_0xffcc('0x2e')][_0xffcc('0x2f')]};});_0x36c529['model']=_[_0xffcc('0x2b')](_0x143da0,_0xffcc('0x28'));_0x36c529[_0xffcc('0x30')]=_['keys'](_0xb02abc[_0xffcc('0x30')]);_0x36c529['filters']=_[_0xffcc('0x31')](_0x36c529[_0xffcc('0x32')],_0x36c529[_0xffcc('0x30')]);_0x560534[_0xffcc('0x33')]=_['intersection'](_0x36c529[_0xffcc('0x32')],qs[_0xffcc('0x34')](_0xb02abc[_0xffcc('0x30')]['fields']));_0x560534[_0xffcc('0x33')]=_0x560534[_0xffcc('0x33')][_0xffcc('0x35')]?_0x560534[_0xffcc('0x33')]:_0x36c529['model'];if(!_0xb02abc[_0xffcc('0x30')][_0xffcc('0x36')]('nolimit')){_0x560534['limit']=qs[_0xffcc('0x1c')](_0xb02abc[_0xffcc('0x30')][_0xffcc('0x1c')]);_0x560534[_0xffcc('0x1a')]=qs[_0xffcc('0x1a')](_0xb02abc['query'][_0xffcc('0x1a')]);}_0x560534[_0xffcc('0x37')]=qs[_0xffcc('0x38')](_0xb02abc[_0xffcc('0x30')][_0xffcc('0x38')]);_0x560534['where']=qs[_0xffcc('0x39')](_[_0xffcc('0x3a')](_0xb02abc[_0xffcc('0x30')],_0x36c529[_0xffcc('0x39')]),_0x143da0);if(_0xb02abc[_0xffcc('0x30')][_0xffcc('0x3b')]){_0x560534[_0xffcc('0x3c')]=_[_0xffcc('0x3d')](_0x560534['where'],{'$or':_[_0xffcc('0x2b')](_0x143da0,function(_0x5c157f){if(_0x5c157f[_0xffcc('0x2e')]!=='VIRTUAL'){var _0x54e1ba={};_0x54e1ba[_0x5c157f[_0xffcc('0x28')]]={'$like':'%'+_0xb02abc['query'][_0xffcc('0x3b')]+'%'};return _0x54e1ba;}})});}_0x560534=_[_0xffcc('0x3d')]({},_0x560534,_0xb02abc[_0xffcc('0x3e')]);var _0x4aadbf={'where':_0x560534[_0xffcc('0x3c')]};return db[_0xffcc('0x3f')][_0xffcc('0x1d')](_0x4aadbf)[_0xffcc('0x24')](function(_0xf53fcb){_0x44e871[_0xffcc('0x1d')]=_0xf53fcb;if(_0xb02abc['query'][_0xffcc('0x40')]){_0x560534[_0xffcc('0x41')]=[{'all':!![]}];}return db[_0xffcc('0x3f')]['findAll'](_0x560534);})[_0xffcc('0x24')](function(_0x1b7f98){_0x44e871['rows']=_0x1b7f98;return _0x44e871;})['then'](respondWithFilteredResult(_0x1b2832,_0x560534))[_0xffcc('0x42')](handleError(_0x1b2832,null));};exports[_0xffcc('0x43')]=function(_0x1911cd,_0x4dbd51){var _0x74910f={'raw':!![],'where':{'id':_0x1911cd[_0xffcc('0x44')]['id']}},_0x1f89f6={};_0x1f89f6[_0xffcc('0x32')]=_[_0xffcc('0x45')](db['ZohoField'][_0xffcc('0x2c')]);_0x1f89f6[_0xffcc('0x30')]=_[_0xffcc('0x45')](_0x1911cd[_0xffcc('0x30')]);_0x1f89f6['filters']=_[_0xffcc('0x31')](_0x1f89f6[_0xffcc('0x32')],_0x1f89f6[_0xffcc('0x30')]);_0x74910f['attributes']=_[_0xffcc('0x31')](_0x1f89f6[_0xffcc('0x32')],qs['fields'](_0x1911cd['query'][_0xffcc('0x34')]));_0x74910f[_0xffcc('0x33')]=_0x74910f[_0xffcc('0x33')][_0xffcc('0x35')]?_0x74910f[_0xffcc('0x33')]:_0x1f89f6[_0xffcc('0x32')];if(_0x1911cd[_0xffcc('0x30')][_0xffcc('0x40')]){_0x74910f[_0xffcc('0x41')]=[{'all':!![]}];}_0x74910f=_[_0xffcc('0x3d')]({},_0x74910f,_0x1911cd['options']);return db[_0xffcc('0x3f')][_0xffcc('0x46')](_0x74910f)[_0xffcc('0x24')](handleEntityNotFound(_0x4dbd51,null))[_0xffcc('0x24')](respondWithResult(_0x4dbd51,null))[_0xffcc('0x42')](handleError(_0x4dbd51,null));};exports[_0xffcc('0x47')]=function(_0x56c73c,_0x4b16d3){return db['ZohoField'][_0xffcc('0x47')](_0x56c73c[_0xffcc('0x48')],{})[_0xffcc('0x24')](respondWithResult(_0x4b16d3,0xc9))[_0xffcc('0x42')](handleError(_0x4b16d3,null));};exports[_0xffcc('0x23')]=function(_0x5b70fd,_0x3c7515){if(_0x5b70fd[_0xffcc('0x48')]['id']){delete _0x5b70fd['body']['id'];}return db[_0xffcc('0x3f')][_0xffcc('0x46')]({'where':{'id':_0x5b70fd['params']['id']}})[_0xffcc('0x24')](handleEntityNotFound(_0x3c7515,null))[_0xffcc('0x24')](saveUpdates(_0x5b70fd[_0xffcc('0x48')],null))[_0xffcc('0x24')](respondWithResult(_0x3c7515,null))['catch'](handleError(_0x3c7515,null));};exports[_0xffcc('0x49')]=function(_0x598454,_0x59abe3){return db[_0xffcc('0x3f')][_0xffcc('0x46')]({'where':{'id':_0x598454[_0xffcc('0x44')]['id']}})[_0xffcc('0x24')](handleEntityNotFound(_0x59abe3,null))[_0xffcc('0x24')](removeEntity(_0x59abe3,null))[_0xffcc('0x42')](handleError(_0x59abe3,null));}; \ No newline at end of file +var _0xfb27=['status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','fields','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4cbb01,_0x14c188){var _0x263a53=function(_0x5f378f){while(--_0x5f378f){_0x4cbb01['push'](_0x4cbb01['shift']());}};_0x263a53(++_0x14c188);}(_0xfb27,0x7e));var _0x7fb2=function(_0x54a573,_0x49c04d){_0x54a573=_0x54a573-0x0;var _0x2c45a9=_0xfb27[_0x54a573];return _0x2c45a9;};'use strict';var emlformat=require(_0x7fb2('0x0'));var rimraf=require(_0x7fb2('0x1'));var zipdir=require(_0x7fb2('0x2'));var jsonpatch=require(_0x7fb2('0x3'));var rp=require(_0x7fb2('0x4'));var moment=require('moment');var BPromise=require(_0x7fb2('0x5'));var Mustache=require('mustache');var util=require(_0x7fb2('0x6'));var path=require(_0x7fb2('0x7'));var sox=require(_0x7fb2('0x8'));var csv=require(_0x7fb2('0x9'));var ejs=require(_0x7fb2('0xa'));var fs=require('fs');var fs_extra=require(_0x7fb2('0xb'));var _=require(_0x7fb2('0xc'));var squel=require(_0x7fb2('0xd'));var crypto=require(_0x7fb2('0xe'));var jsforce=require(_0x7fb2('0xf'));var deskjs=require(_0x7fb2('0x10'));var toCsv=require(_0x7fb2('0x9'));var querystring=require('querystring');var Papa=require(_0x7fb2('0x11'));var Redis=require('ioredis');var authService=require(_0x7fb2('0x12'));var qs=require(_0x7fb2('0x13'));var as=require(_0x7fb2('0x14'));var hardwareService=require(_0x7fb2('0x15'));var logger=require(_0x7fb2('0x16'))('api');var utils=require(_0x7fb2('0x17'));var config=require(_0x7fb2('0x18'));var licenseUtil=require(_0x7fb2('0x19'));var db=require(_0x7fb2('0x1a'))['db'];function respondWithStatusCode(_0x575b7f,_0x54817e){_0x54817e=_0x54817e||0xcc;return function(_0x2128ee){if(_0x2128ee){return _0x575b7f[_0x7fb2('0x1b')](_0x54817e);}return _0x575b7f[_0x7fb2('0x1c')](_0x54817e)[_0x7fb2('0x1d')]();};}function respondWithResult(_0x52132c,_0x30a7bb){_0x30a7bb=_0x30a7bb||0xc8;return function(_0x4c3097){if(_0x4c3097){return _0x52132c[_0x7fb2('0x1c')](_0x30a7bb)[_0x7fb2('0x1e')](_0x4c3097);}};}function respondWithFilteredResult(_0x111b92,_0x4d259d){return function(_0x58b187){if(_0x58b187){var _0x274ce7=typeof _0x4d259d[_0x7fb2('0x1f')]==='undefined'&&typeof _0x4d259d['limit']===_0x7fb2('0x20');var _0x28ce06=_0x58b187['count'];var _0x5da0a8=_0x274ce7?0x0:_0x4d259d['offset'];var _0x711400=_0x274ce7?_0x58b187[_0x7fb2('0x21')]:_0x4d259d['offset']+_0x4d259d['limit'];var _0x223bd2;if(_0x711400>=_0x28ce06){_0x711400=_0x28ce06;_0x223bd2=0xc8;}else{_0x223bd2=0xce;}_0x111b92[_0x7fb2('0x1c')](_0x223bd2);return _0x111b92['set'](_0x7fb2('0x22'),_0x5da0a8+'-'+_0x711400+'/'+_0x28ce06)[_0x7fb2('0x1e')](_0x58b187);}return null;};}function patchUpdates(_0x34fe6b){return function(_0x2382ea){try{jsonpatch[_0x7fb2('0x23')](_0x2382ea,_0x34fe6b,!![]);}catch(_0x298d81){return BPromise[_0x7fb2('0x24')](_0x298d81);}return _0x2382ea['save']();};}function saveUpdates(_0x2353bc,_0x5ee22a){return function(_0x446118){if(_0x446118){return _0x446118[_0x7fb2('0x25')](_0x2353bc)[_0x7fb2('0x26')](function(_0x9d79bd){return _0x9d79bd;});}return null;};}function removeEntity(_0x4495a2,_0x5afb34){return function(_0x25c967){if(_0x25c967){return _0x25c967['destroy']()[_0x7fb2('0x26')](function(){_0x4495a2[_0x7fb2('0x1c')](0xcc)[_0x7fb2('0x1d')]();});}};}function handleEntityNotFound(_0xe967a7,_0x52b6d8){return function(_0x17cb9c){if(!_0x17cb9c){_0xe967a7[_0x7fb2('0x1b')](0x194);}return _0x17cb9c;};}function handleError(_0x35a1b6,_0x40aea2){_0x40aea2=_0x40aea2||0x1f4;return function(_0xa2f337){logger[_0x7fb2('0x27')](_0xa2f337[_0x7fb2('0x28')]);if(_0xa2f337[_0x7fb2('0x29')]){delete _0xa2f337[_0x7fb2('0x29')];}_0x35a1b6[_0x7fb2('0x1c')](_0x40aea2)[_0x7fb2('0x2a')](_0xa2f337);};}exports[_0x7fb2('0x2b')]=function(_0x3401a7,_0x26de5e){var _0x250e69={},_0x711a5e={},_0x363841={'count':0x0,'rows':[]};var _0x263c37=_['map'](db[_0x7fb2('0x2c')][_0x7fb2('0x2d')],function(_0x71ca40){return{'name':_0x71ca40[_0x7fb2('0x2e')],'type':_0x71ca40[_0x7fb2('0x2f')][_0x7fb2('0x30')]};});_0x711a5e[_0x7fb2('0x31')]=_['map'](_0x263c37,_0x7fb2('0x29'));_0x711a5e[_0x7fb2('0x32')]=_['keys'](_0x3401a7[_0x7fb2('0x32')]);_0x711a5e[_0x7fb2('0x33')]=_[_0x7fb2('0x34')](_0x711a5e[_0x7fb2('0x31')],_0x711a5e[_0x7fb2('0x32')]);_0x250e69[_0x7fb2('0x35')]=_[_0x7fb2('0x34')](_0x711a5e[_0x7fb2('0x31')],qs['fields'](_0x3401a7['query']['fields']));_0x250e69[_0x7fb2('0x35')]=_0x250e69[_0x7fb2('0x35')]['length']?_0x250e69[_0x7fb2('0x35')]:_0x711a5e[_0x7fb2('0x31')];if(!_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x36')](_0x7fb2('0x37'))){_0x250e69[_0x7fb2('0x38')]=qs['limit'](_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x38')]);_0x250e69['offset']=qs[_0x7fb2('0x1f')](_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x1f')]);}_0x250e69[_0x7fb2('0x39')]=qs[_0x7fb2('0x3a')](_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x3a')]);_0x250e69[_0x7fb2('0x3b')]=qs[_0x7fb2('0x33')](_['pick'](_0x3401a7[_0x7fb2('0x32')],_0x711a5e[_0x7fb2('0x33')]),_0x263c37);if(_0x3401a7['query']['filter']){_0x250e69[_0x7fb2('0x3b')]=_[_0x7fb2('0x3c')](_0x250e69[_0x7fb2('0x3b')],{'$or':_['map'](_0x263c37,function(_0x466ca5){if(_0x466ca5[_0x7fb2('0x2f')]!==_0x7fb2('0x3d')){var _0x2e559f={};_0x2e559f[_0x466ca5['name']]={'$like':'%'+_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x3e')]+'%'};return _0x2e559f;}})});}_0x250e69=_[_0x7fb2('0x3c')]({},_0x250e69,_0x3401a7[_0x7fb2('0x3f')]);var _0x149b5d={'where':_0x250e69[_0x7fb2('0x3b')]};return db[_0x7fb2('0x2c')]['count'](_0x149b5d)[_0x7fb2('0x26')](function(_0x34e975){_0x363841['count']=_0x34e975;if(_0x3401a7[_0x7fb2('0x32')][_0x7fb2('0x40')]){_0x250e69[_0x7fb2('0x41')]=[{'all':!![]}];}return db['ZohoField'][_0x7fb2('0x42')](_0x250e69);})[_0x7fb2('0x26')](function(_0x49976c){_0x363841[_0x7fb2('0x43')]=_0x49976c;return _0x363841;})[_0x7fb2('0x26')](respondWithFilteredResult(_0x26de5e,_0x250e69))['catch'](handleError(_0x26de5e,null));};exports['show']=function(_0x4d569f,_0x1d5a8c){var _0x25c901={'raw':!![],'where':{'id':_0x4d569f[_0x7fb2('0x44')]['id']}},_0x3dd57e={};_0x3dd57e[_0x7fb2('0x31')]=_[_0x7fb2('0x45')](db['ZohoField'][_0x7fb2('0x2d')]);_0x3dd57e[_0x7fb2('0x32')]=_[_0x7fb2('0x45')](_0x4d569f[_0x7fb2('0x32')]);_0x3dd57e['filters']=_['intersection'](_0x3dd57e[_0x7fb2('0x31')],_0x3dd57e['query']);_0x25c901[_0x7fb2('0x35')]=_[_0x7fb2('0x34')](_0x3dd57e[_0x7fb2('0x31')],qs[_0x7fb2('0x46')](_0x4d569f[_0x7fb2('0x32')][_0x7fb2('0x46')]));_0x25c901[_0x7fb2('0x35')]=_0x25c901['attributes'][_0x7fb2('0x47')]?_0x25c901[_0x7fb2('0x35')]:_0x3dd57e[_0x7fb2('0x31')];if(_0x4d569f[_0x7fb2('0x32')][_0x7fb2('0x40')]){_0x25c901[_0x7fb2('0x41')]=[{'all':!![]}];}_0x25c901=_[_0x7fb2('0x3c')]({},_0x25c901,_0x4d569f[_0x7fb2('0x3f')]);return db['ZohoField'][_0x7fb2('0x48')](_0x25c901)[_0x7fb2('0x26')](handleEntityNotFound(_0x1d5a8c,null))[_0x7fb2('0x26')](respondWithResult(_0x1d5a8c,null))[_0x7fb2('0x49')](handleError(_0x1d5a8c,null));};exports[_0x7fb2('0x4a')]=function(_0x318976,_0x55019a){return db[_0x7fb2('0x2c')]['create'](_0x318976[_0x7fb2('0x4b')],{})[_0x7fb2('0x26')](respondWithResult(_0x55019a,0xc9))['catch'](handleError(_0x55019a,null));};exports[_0x7fb2('0x25')]=function(_0x34ed82,_0x36238e){if(_0x34ed82[_0x7fb2('0x4b')]['id']){delete _0x34ed82[_0x7fb2('0x4b')]['id'];}return db[_0x7fb2('0x2c')]['find']({'where':{'id':_0x34ed82[_0x7fb2('0x44')]['id']}})[_0x7fb2('0x26')](handleEntityNotFound(_0x36238e,null))['then'](saveUpdates(_0x34ed82['body'],null))[_0x7fb2('0x26')](respondWithResult(_0x36238e,null))['catch'](handleError(_0x36238e,null));};exports[_0x7fb2('0x4c')]=function(_0x34b82f,_0xef864b){return db[_0x7fb2('0x2c')]['find']({'where':{'id':_0x34b82f['params']['id']}})[_0x7fb2('0x26')](handleEntityNotFound(_0xef864b,null))['then'](removeEntity(_0xef864b,null))['catch'](handleError(_0xef864b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e7ff238..c35117c 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x33ee55,_0x235c9e){var _0xef7a3d=function(_0x5dd646){while(--_0x5dd646){_0x33ee55['push'](_0x33ee55['shift']());}};_0xef7a3d(++_0x235c9e);}(_0x187d,0x93));var _0xd187=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x187d[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xd'),_0xd187('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x1df78d,_0xccdff){var _0x4068a1=function(_0xad5032){while(--_0xad5032){_0x1df78d['push'](_0x1df78d['shift']());}};_0x4068a1(++_0xccdff);}(_0x7278,0x161));var _0x8727=function(_0x40b5bc,_0x380b27){_0x40b5bc=_0x40b5bc-0x0;var _0x576adf=_0x7278[_0x40b5bc];return _0x576adf;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 50222e7..dd3e735 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 _0x7258=['error','code','ZohoField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x59ee96,_0x2dd0b9){var _0xeadac6=function(_0x308811){while(--_0x308811){_0x59ee96['push'](_0x59ee96['shift']());}};_0xeadac6(++_0x2dd0b9);}(_0x7258,0xeb));var _0x8725=function(_0x32a8cf,_0x2b6785){_0x32a8cf=_0x32a8cf-0x0;var _0x1cfd03=_0x7258[_0x32a8cf];return _0x1cfd03;};'use strict';var _=require(_0x8725('0x0'));var util=require(_0x8725('0x1'));var moment=require(_0x8725('0x2'));var BPromise=require(_0x8725('0x3'));var rs=require(_0x8725('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8725('0x5'))['db'];var utils=require(_0x8725('0x6'));var logger=require(_0x8725('0x7'))('rpc');var config=require(_0x8725('0x8'));var jayson=require(_0x8725('0x9'));var client=jayson[_0x8725('0xa')][_0x8725('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32848f,_0x9bc5a7,_0x5b916b){return new BPromise(function(_0x169044,_0x3aa75c){return client[_0x8725('0xc')](_0x32848f,_0x5b916b)[_0x8725('0xd')](function(_0x1a6063){logger[_0x8725('0xe')]('ZohoField,\x20%s,\x20%s',_0x9bc5a7,_0x8725('0xf'));logger[_0x8725('0x10')](_0x8725('0x11'),_0x9bc5a7,_0x8725('0xf'),JSON['stringify'](_0x1a6063));if(_0x1a6063[_0x8725('0x12')]){if(_0x1a6063['error'][_0x8725('0x13')]===0x1f4){logger['error'](_0x8725('0x14'),_0x9bc5a7,_0x1a6063[_0x8725('0x12')]['message']);return _0x3aa75c(_0x1a6063[_0x8725('0x12')]['message']);}logger['error'](_0x8725('0x14'),_0x9bc5a7,_0x1a6063['error'][_0x8725('0x15')]);return _0x169044(_0x1a6063[_0x8725('0x12')][_0x8725('0x15')]);}else{logger[_0x8725('0xe')]('ZohoField,\x20%s,\x20%s',_0x9bc5a7,_0x8725('0xf'));_0x169044(_0x1a6063['result'][_0x8725('0x15')]);}})[_0x8725('0x16')](function(_0x49febc){logger['error'](_0x8725('0x14'),_0x9bc5a7,_0x49febc);_0x3aa75c(_0x49febc);});});} \ No newline at end of file +var _0x40b5=['message','ZohoField,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x259b36,_0x444eeb){var _0x5ef06b=function(_0x1d7028){while(--_0x1d7028){_0x259b36['push'](_0x259b36['shift']());}};_0x5ef06b(++_0x444eeb);}(_0x40b5,0x1d1));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require('util');var moment=require(_0x540b('0x1'));var BPromise=require(_0x540b('0x2'));var rs=require(_0x540b('0x3'));var fs=require('fs');var Redis=require(_0x540b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x540b('0x5'));var logger=require(_0x540b('0x6'))(_0x540b('0x7'));var config=require(_0x540b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x540b('0x9')][_0x540b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b50d,_0x814fc7,_0x28265a){return new BPromise(function(_0x9c065f,_0x140019){return client['request'](_0x11b50d,_0x28265a)[_0x540b('0xb')](function(_0x238751){logger[_0x540b('0xc')]('ZohoField,\x20%s,\x20%s',_0x814fc7,_0x540b('0xd'));logger[_0x540b('0xe')](_0x540b('0xf'),_0x814fc7,'request\x20sent',JSON[_0x540b('0x10')](_0x238751));if(_0x238751[_0x540b('0x11')]){if(_0x238751[_0x540b('0x11')][_0x540b('0x12')]===0x1f4){logger[_0x540b('0x11')]('ZohoField,\x20%s,\x20%s',_0x814fc7,_0x238751[_0x540b('0x11')][_0x540b('0x13')]);return _0x140019(_0x238751[_0x540b('0x11')]['message']);}logger[_0x540b('0x11')]('ZohoField,\x20%s,\x20%s',_0x814fc7,_0x238751[_0x540b('0x11')][_0x540b('0x13')]);return _0x9c065f(_0x238751[_0x540b('0x11')][_0x540b('0x13')]);}else{logger[_0x540b('0xc')](_0x540b('0x14'),_0x814fc7,_0x540b('0xd'));_0x9c065f(_0x238751[_0x540b('0x15')][_0x540b('0x13')]);}})['catch'](function(_0x27c1e6){logger[_0x540b('0x11')](_0x540b('0x14'),_0x814fc7,_0x27c1e6);_0x140019(_0x27c1e6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index dcda465..7fd9b07 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44135b,_0x282444){var _0x1aa4f5=function(_0x8bc71){while(--_0x8bc71){_0x44135b['push'](_0x44135b['shift']());}};_0x1aa4f5(++_0x282444);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x476f08,_0x476f0f){var _0x1e3de9=function(_0x3eeaa4){while(--_0x3eeaa4){_0x476f08['push'](_0x476f08['shift']());}};_0x1e3de9(++_0x476f0f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xcb91[_0x1ebce2];return _0x4a330c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e49fffc..317dca8 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 _0x2082=['BOOLEAN','state','STRING','unique_name_and_version','INTEGER'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x2082,0x8e));var _0x2208=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x2082[_0x3815c2];return _0x271f88;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2208('0x0')],'allowNull':![],'unique':_0x2208('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2208('0x1')},'main':{'type':Sequelize[_0x2208('0x0')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2208('0x0')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2208('0x0')]},'size':{'type':Sequelize[_0x2208('0x2')]},'active':{'type':Sequelize[_0x2208('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x2208('0x0')]},'logo':{'type':Sequelize[_0x2208('0x0')]},'state':{'type':Sequelize[_0x2208('0x0')],'unique':_0x2208('0x4')},'description':{'type':Sequelize[_0x2208('0x0')]},'title':{'type':Sequelize[_0x2208('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x2208('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe44d=['STRING','INTEGER','BOOLEAN','state','sequelize','exports','unique_name_and_version'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0xe44d,0x138));var _0xde44=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xe44d[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0xde44('0x0'));module[_0xde44('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xde44('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xde44('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xde44('0x3')]},'size':{'type':Sequelize[_0xde44('0x4')]},'active':{'type':Sequelize[_0xde44('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xde44('0x3')]},'logo':{'type':Sequelize[_0xde44('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0xde44('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xde44('0x3')]},'link':{'type':Sequelize[_0xde44('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ebec44f..311cc65 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 _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x481af3,_0x483fac){var _0x3354ea=function(_0x2e3de5){while(--_0x2e3de5){_0x481af3['push'](_0x481af3['shift']());}};_0x3354ea(++_0x483fac);}(_0x1967,0x173));var _0x7196=function(_0x18ef87,_0x5631e9){_0x18ef87=_0x18ef87-0x0;var _0x6aa89a=_0x1967[_0x18ef87];return _0x6aa89a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file +var _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x564615,_0x51000c){var _0x3e5c3c=function(_0x35b777){while(--_0x35b777){_0x564615['push'](_0x564615['shift']());}};_0x3e5c3c(++_0x51000c);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b6595c5..b1b4523 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 _0x3232=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util'];(function(_0x5ac11c,_0x289e8b){var _0xe71fa6=function(_0x285a5e){while(--_0x285a5e){_0x5ac11c['push'](_0x5ac11c['shift']());}};_0xe71fa6(++_0x289e8b);}(_0x3232,0x136));var _0x2323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3232[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x2323('0x0'));var util=require(_0x2323('0x1'));var logger=require(_0x2323('0x2'))(_0x2323('0x3'));var moment=require('moment');var BPromise=require(_0x2323('0x4'));var rp=require(_0x2323('0x5'));var fs=require('fs');var path=require(_0x2323('0x6'));var rimraf=require(_0x2323('0x7'));var config=require(_0x2323('0x8'));var attributes=require(_0x2323('0x9'));module[_0x2323('0xa')]=function(_0x1a6899,_0x2be965){return _0x1a6899[_0x2323('0xb')](_0x2323('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c24=['path','../../config/environment','./integration.attributes','exports','Integration','integrations','util','../../config/logger','api','bluebird','request-promise'];(function(_0x115e8c,_0x133e8f){var _0xffbee0=function(_0x3c00a4){while(--_0x3c00a4){_0x115e8c['push'](_0x115e8c['shift']());}};_0xffbee0(++_0x133e8f);}(_0x6c24,0x1a8));var _0x46c2=function(_0x347cde,_0x31d4b9){_0x347cde=_0x347cde-0x0;var _0x4a999f=_0x6c24[_0x347cde];return _0x4a999f;};'use strict';var _=require('lodash');var util=require(_0x46c2('0x0'));var logger=require(_0x46c2('0x1'))(_0x46c2('0x2'));var moment=require('moment');var BPromise=require(_0x46c2('0x3'));var rp=require(_0x46c2('0x4'));var fs=require('fs');var path=require(_0x46c2('0x5'));var rimraf=require('rimraf');var config=require(_0x46c2('0x6'));var attributes=require(_0x46c2('0x7'));module[_0x46c2('0x8')]=function(_0xc5c5be,_0x56d4c8){return _0xc5c5be['define'](_0x46c2('0x9'),attributes,{'tableName':_0x46c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index fd84e82..f768cf3 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 _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\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','../../config/environment','client','http','request'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1967,0x173));var _0x7196=function(_0x3f6732,_0x2d5c57){_0x3f6732=_0x3f6732-0x0;var _0x511b50=_0x1967[_0x3f6732];return _0x511b50;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x182ed6,_0x2e966a){var _0x51cb3e=function(_0x4c643e){while(--_0x4c643e){_0x182ed6['push'](_0x182ed6['shift']());}};_0x51cb3e(++_0x2e966a);}(_0x2ef3,0xba));var _0x32ef=function(_0x2c3bc6,_0x3268b0){_0x2c3bc6=_0x2c3bc6-0x0;var _0x59b6a6=_0x2ef3[_0x2c3bc6];return _0x59b6a6;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9d695e5..4757df1 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(_0xa2320e,_0x4b5dc1){var _0x25f019=function(_0x4b9baa){while(--_0x4b9baa){_0xa2320e['push'](_0xa2320e['shift']());}};_0x25f019(++_0x4b5dc1);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5915bb,_0x24cb77){_0x5915bb=_0x5915bb-0x0;var _0x40d59d=_0xc2c7[_0x5915bb];return _0x40d59d;};'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 _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(_0x23e367,_0x7c9f0){var _0x32326b=function(_0x4d2d16){while(--_0x4d2d16){_0x23e367['push'](_0x23e367['shift']());}};_0x32326b(++_0x7c9f0);}(_0xc2c7,0x134));var _0x7c2c=function(_0x14f7c8,_0xa65f6d){_0x14f7c8=_0x14f7c8-0x0;var _0x586a9b=_0xc2c7[_0x14f7c8];return _0x586a9b;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 76920a7..dd813a4 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 _0xd424=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xd424,0x1c3));var _0x4d42=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xd424[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module[_0x4d42('0x0')]={'integration':{'type':Sequelize[_0x4d42('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4d42('0x1')]},'ticketId':{'type':Sequelize[_0x4d42('0x1')]},'integrationId':{'type':Sequelize[_0x4d42('0x2')]},'contacts':{'type':Sequelize[_0x4d42('0x1')]},'uniqueid':{'type':Sequelize[_0x4d42('0x1')]},'calleridnum':{'type':Sequelize[_0x4d42('0x1')]},'calleridname':{'type':Sequelize[_0x4d42('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4d42('0x1')]},'membername':{'type':Sequelize[_0x4d42('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4d42('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d42('0x3')]},'holdtime':{'type':Sequelize[_0x4d42('0x2')]},'agentcomplete':{'type':Sequelize[_0x4d42('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x4d42('0x2')]},'agentacw':{'type':Sequelize[_0x4d42('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d42('0x2')]},'reason':{'type':Sequelize[_0x4d42('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4d42('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x4d42('0x1')]},'channel':{'type':Sequelize[_0x4d42('0x1')]},'channelstate':{'type':Sequelize[_0x4d42('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4d42('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4d42('0x1')]},'connectedlinename':{'type':Sequelize[_0x4d42('0x1')]},'language':{'type':Sequelize[_0x4d42('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4d42('0x1')]},'exten':{'type':Sequelize[_0x4d42('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4d42('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4d42('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4d42('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4d42('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4d42('0x1')]},'destlanguage':{'type':Sequelize[_0x4d42('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4d42('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x4d42('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x4d42('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4d42('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4d42('0x5')]},'text':{'type':Sequelize[_0x4d42('0x5')]},'status':{'type':Sequelize[_0x4d42('0x6')](_0x4d42('0x7'),'SENDING',_0x4d42('0x8'),_0x4d42('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4d42('0x1')]},'appdata':{'type':Sequelize[_0x4d42('0x1')]},'projectId':{'type':Sequelize[_0x4d42('0x2')]}}; \ No newline at end of file +var _0xa1f4=['RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING'];(function(_0xb83ded,_0x4c5541){var _0x17e6d3=function(_0x7a4921){while(--_0x7a4921){_0xb83ded['push'](_0xb83ded['shift']());}};_0x17e6d3(++_0x4c5541);}(_0xa1f4,0xd4));var _0x4a1f=function(_0x3a83c7,_0x5619ec){_0x3a83c7=_0x3a83c7-0x0;var _0x5c663f=_0xa1f4[_0x3a83c7];return _0x5c663f;};'use strict';var Sequelize=require(_0x4a1f('0x0'));module['exports']={'integration':{'type':Sequelize[_0x4a1f('0x1')]},'eventChannel':{'type':Sequelize[_0x4a1f('0x1')]},'exitStatus':{'type':Sequelize[_0x4a1f('0x1')]},'ticketId':{'type':Sequelize[_0x4a1f('0x1')]},'integrationId':{'type':Sequelize[_0x4a1f('0x2')]},'contacts':{'type':Sequelize[_0x4a1f('0x1')]},'uniqueid':{'type':Sequelize[_0x4a1f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4a1f('0x1')]},'queue':{'type':Sequelize[_0x4a1f('0x1')]},'interface':{'type':Sequelize[_0x4a1f('0x1')]},'membername':{'type':Sequelize[_0x4a1f('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4a1f('0x3')]},'holdtime':{'type':Sequelize[_0x4a1f('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4a1f('0x3')]},'talktime':{'type':Sequelize[_0x4a1f('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4a1f('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x4a1f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4a1f('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4a1f('0x3')]},'lastevent':{'type':Sequelize[_0x4a1f('0x1')]},'channel':{'type':Sequelize[_0x4a1f('0x1')]},'channelstate':{'type':Sequelize[_0x4a1f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4a1f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4a1f('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4a1f('0x1')]},'accountcode':{'type':Sequelize[_0x4a1f('0x1')]},'context':{'type':Sequelize[_0x4a1f('0x1')]},'exten':{'type':Sequelize[_0x4a1f('0x1')]},'priority':{'type':Sequelize[_0x4a1f('0x1')]},'destchannel':{'type':Sequelize[_0x4a1f('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4a1f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4a1f('0x1')]},'destcalleridname':{'type':Sequelize[_0x4a1f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x4a1f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4a1f('0x1')]},'destlanguage':{'type':Sequelize[_0x4a1f('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4a1f('0x1')]},'destpriority':{'type':Sequelize[_0x4a1f('0x1')]},'destuniqueid':{'type':Sequelize[_0x4a1f('0x1')]},'messageId':{'type':Sequelize[_0x4a1f('0x1')]},'inReplyTo':{'type':Sequelize[_0x4a1f('0x1')]},'subject':{'type':Sequelize[_0x4a1f('0x1')]},'from':{'type':Sequelize[_0x4a1f('0x1')]},'to':{'type':Sequelize[_0x4a1f('0x1')]},'cc':{'type':Sequelize[_0x4a1f('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4a1f('0x5')]},'text':{'type':Sequelize[_0x4a1f('0x5')]},'status':{'type':Sequelize['ENUM'](_0x4a1f('0x6'),_0x4a1f('0x7'),_0x4a1f('0x8'),_0x4a1f('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4a1f('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 80077de..0544d80 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 _0xcc86=['destroy','error','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','type','merge','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then'];(function(_0x5bf840,_0x9fc2ab){var _0x4f4355=function(_0x5bef49){while(--_0x5bef49){_0x5bf840['push'](_0x5bf840['shift']());}};_0x4f4355(++_0x9fc2ab);}(_0xcc86,0x183));var _0x6cc8=function(_0x1176b0,_0x3b83ef){_0x1176b0=_0x1176b0-0x0;var _0x322419=_0xcc86[_0x1176b0];return _0x322419;};'use strict';var emlformat=require(_0x6cc8('0x0'));var rimraf=require(_0x6cc8('0x1'));var zipdir=require(_0x6cc8('0x2'));var jsonpatch=require(_0x6cc8('0x3'));var rp=require(_0x6cc8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cc8('0x5'));var path=require('path');var sox=require(_0x6cc8('0x6'));var csv=require(_0x6cc8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cc8('0x8'));var _=require('lodash');var squel=require(_0x6cc8('0x9'));var crypto=require(_0x6cc8('0xa'));var jsforce=require(_0x6cc8('0xb'));var deskjs=require(_0x6cc8('0xc'));var toCsv=require(_0x6cc8('0x7'));var querystring=require(_0x6cc8('0xd'));var Papa=require(_0x6cc8('0xe'));var Redis=require('ioredis');var authService=require(_0x6cc8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cc8('0x10'));var logger=require(_0x6cc8('0x11'))('api');var utils=require(_0x6cc8('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6cc8('0x13'))['db'];function respondWithStatusCode(_0x494718,_0x34aed4){_0x34aed4=_0x34aed4||0xcc;return function(_0x2aeb05){if(_0x2aeb05){return _0x494718[_0x6cc8('0x14')](_0x34aed4);}return _0x494718['status'](_0x34aed4)[_0x6cc8('0x15')]();};}function respondWithResult(_0x4d6356,_0x22aec6){_0x22aec6=_0x22aec6||0xc8;return function(_0x57838a){if(_0x57838a){return _0x4d6356[_0x6cc8('0x16')](_0x22aec6)[_0x6cc8('0x17')](_0x57838a);}};}function respondWithFilteredResult(_0x5725e1,_0x2d669c){return function(_0x34a518){if(_0x34a518){var _0x48574d=typeof _0x2d669c[_0x6cc8('0x18')]===_0x6cc8('0x19')&&typeof _0x2d669c[_0x6cc8('0x1a')]===_0x6cc8('0x19');var _0x2aa7cd=_0x34a518[_0x6cc8('0x1b')];var _0xeca7c2=_0x48574d?0x0:_0x2d669c[_0x6cc8('0x18')];var _0x303c7f=_0x48574d?_0x34a518['count']:_0x2d669c[_0x6cc8('0x18')]+_0x2d669c[_0x6cc8('0x1a')];var _0x4fad1f;if(_0x303c7f>=_0x2aa7cd){_0x303c7f=_0x2aa7cd;_0x4fad1f=0xc8;}else{_0x4fad1f=0xce;}_0x5725e1[_0x6cc8('0x16')](_0x4fad1f);return _0x5725e1['set'](_0x6cc8('0x1c'),_0xeca7c2+'-'+_0x303c7f+'/'+_0x2aa7cd)[_0x6cc8('0x17')](_0x34a518);}return null;};}function patchUpdates(_0x16041e){return function(_0x591ea9){try{jsonpatch[_0x6cc8('0x1d')](_0x591ea9,_0x16041e,!![]);}catch(_0x4bb4a9){return BPromise['reject'](_0x4bb4a9);}return _0x591ea9[_0x6cc8('0x1e')]();};}function saveUpdates(_0x5d1e72,_0x122947){return function(_0x176de8){if(_0x176de8){return _0x176de8[_0x6cc8('0x1f')](_0x5d1e72)[_0x6cc8('0x20')](function(_0x447c79){return _0x447c79;});}return null;};}function removeEntity(_0x132f36,_0x25b9d7){return function(_0x56d0ac){if(_0x56d0ac){return _0x56d0ac[_0x6cc8('0x21')]()[_0x6cc8('0x20')](function(){_0x132f36[_0x6cc8('0x16')](0xcc)[_0x6cc8('0x15')]();});}};}function handleEntityNotFound(_0x437dee,_0x4d66de){return function(_0x149b79){if(!_0x149b79){_0x437dee['sendStatus'](0x194);}return _0x149b79;};}function handleError(_0x1cac52,_0x3f5f10){_0x3f5f10=_0x3f5f10||0x1f4;return function(_0x3f71e4){logger[_0x6cc8('0x22')](_0x3f71e4[_0x6cc8('0x23')]);if(_0x3f71e4[_0x6cc8('0x24')]){delete _0x3f71e4[_0x6cc8('0x24')];}_0x1cac52['status'](_0x3f5f10)[_0x6cc8('0x25')](_0x3f71e4);};}exports[_0x6cc8('0x26')]=function(_0x3c8fa7,_0xf68c89){var _0x142f5c={},_0x39011b={},_0x2b8148={'count':0x0,'rows':[]};var _0x2206a5=_[_0x6cc8('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x19d15f){return{'name':_0x19d15f[_0x6cc8('0x28')],'type':_0x19d15f['type'][_0x6cc8('0x29')]};});_0x39011b['model']=_[_0x6cc8('0x27')](_0x2206a5,_0x6cc8('0x24'));_0x39011b[_0x6cc8('0x2a')]=_[_0x6cc8('0x2b')](_0x3c8fa7[_0x6cc8('0x2a')]);_0x39011b[_0x6cc8('0x2c')]=_[_0x6cc8('0x2d')](_0x39011b[_0x6cc8('0x2e')],_0x39011b['query']);_0x142f5c[_0x6cc8('0x2f')]=_[_0x6cc8('0x2d')](_0x39011b[_0x6cc8('0x2e')],qs[_0x6cc8('0x30')](_0x3c8fa7[_0x6cc8('0x2a')][_0x6cc8('0x30')]));_0x142f5c[_0x6cc8('0x2f')]=_0x142f5c[_0x6cc8('0x2f')][_0x6cc8('0x31')]?_0x142f5c[_0x6cc8('0x2f')]:_0x39011b[_0x6cc8('0x2e')];if(!_0x3c8fa7['query'][_0x6cc8('0x32')]('nolimit')){_0x142f5c[_0x6cc8('0x1a')]=qs[_0x6cc8('0x1a')](_0x3c8fa7[_0x6cc8('0x2a')][_0x6cc8('0x1a')]);_0x142f5c[_0x6cc8('0x18')]=qs[_0x6cc8('0x18')](_0x3c8fa7[_0x6cc8('0x2a')]['offset']);}_0x142f5c['order']=qs[_0x6cc8('0x33')](_0x3c8fa7[_0x6cc8('0x2a')]['sort']);_0x142f5c[_0x6cc8('0x34')]=qs['filters'](_[_0x6cc8('0x35')](_0x3c8fa7[_0x6cc8('0x2a')],_0x39011b['filters']),_0x2206a5);if(_0x3c8fa7[_0x6cc8('0x2a')]['filter']){_0x142f5c[_0x6cc8('0x34')]=_['merge'](_0x142f5c['where'],{'$or':_['map'](_0x2206a5,function(_0x4a7032){if(_0x4a7032[_0x6cc8('0x36')]!=='VIRTUAL'){var _0x4564aa={};_0x4564aa[_0x4a7032[_0x6cc8('0x24')]]={'$like':'%'+_0x3c8fa7[_0x6cc8('0x2a')]['filter']+'%'};return _0x4564aa;}})});}_0x142f5c=_[_0x6cc8('0x37')]({},_0x142f5c,_0x3c8fa7['options']);var _0x1ceeae={'where':_0x142f5c[_0x6cc8('0x34')]};return db[_0x6cc8('0x38')]['count'](_0x1ceeae)['then'](function(_0x28400a){_0x2b8148[_0x6cc8('0x1b')]=_0x28400a;if(_0x3c8fa7[_0x6cc8('0x2a')][_0x6cc8('0x39')]){_0x142f5c[_0x6cc8('0x3a')]=[{'all':!![]}];}return db[_0x6cc8('0x38')][_0x6cc8('0x3b')](_0x142f5c);})['then'](function(_0x52c61c){_0x2b8148[_0x6cc8('0x3c')]=_0x52c61c;return _0x2b8148;})['then'](respondWithFilteredResult(_0xf68c89,_0x142f5c))[_0x6cc8('0x3d')](handleError(_0xf68c89,null));};exports[_0x6cc8('0x3e')]=function(_0x5ecb7b,_0x4d747e){var _0x5dcd03={'raw':![],'where':{'id':_0x5ecb7b[_0x6cc8('0x3f')]['id']}},_0x40bc92={};_0x40bc92['model']=_[_0x6cc8('0x2b')](db[_0x6cc8('0x38')][_0x6cc8('0x40')]);_0x40bc92[_0x6cc8('0x2a')]=_['keys'](_0x5ecb7b['query']);_0x40bc92[_0x6cc8('0x2c')]=_['intersection'](_0x40bc92[_0x6cc8('0x2e')],_0x40bc92[_0x6cc8('0x2a')]);_0x5dcd03[_0x6cc8('0x2f')]=_[_0x6cc8('0x2d')](_0x40bc92[_0x6cc8('0x2e')],qs['fields'](_0x5ecb7b[_0x6cc8('0x2a')][_0x6cc8('0x30')]));_0x5dcd03['attributes']=_0x5dcd03['attributes'][_0x6cc8('0x31')]?_0x5dcd03[_0x6cc8('0x2f')]:_0x40bc92[_0x6cc8('0x2e')];if(_0x5ecb7b[_0x6cc8('0x2a')][_0x6cc8('0x39')]){_0x5dcd03[_0x6cc8('0x3a')]=[{'all':!![]}];}_0x5dcd03=_[_0x6cc8('0x37')]({},_0x5dcd03,_0x5ecb7b[_0x6cc8('0x41')]);return db['IntegrationReport'][_0x6cc8('0x42')](_0x5dcd03)['then'](handleEntityNotFound(_0x4d747e,null))['then'](respondWithResult(_0x4d747e,null))[_0x6cc8('0x3d')](handleError(_0x4d747e,null));};exports[_0x6cc8('0x43')]=function(_0x357fb1,_0x276ff9){return db['IntegrationReport'][_0x6cc8('0x43')](_0x357fb1[_0x6cc8('0x44')],{})[_0x6cc8('0x20')](respondWithResult(_0x276ff9,0xc9))[_0x6cc8('0x3d')](handleError(_0x276ff9,null));};exports[_0x6cc8('0x1f')]=function(_0x1a24ce,_0x3c8a0d){if(_0x1a24ce['body']['id']){delete _0x1a24ce[_0x6cc8('0x44')]['id'];}return db[_0x6cc8('0x38')][_0x6cc8('0x42')]({'where':{'id':_0x1a24ce[_0x6cc8('0x3f')]['id']}})[_0x6cc8('0x20')](handleEntityNotFound(_0x3c8a0d,null))[_0x6cc8('0x20')](saveUpdates(_0x1a24ce[_0x6cc8('0x44')],null))[_0x6cc8('0x20')](respondWithResult(_0x3c8a0d,null))['catch'](handleError(_0x3c8a0d,null));};exports[_0x6cc8('0x21')]=function(_0x26732f,_0x9a21c6){return db[_0x6cc8('0x38')][_0x6cc8('0x42')]({'where':{'id':_0x26732f[_0x6cc8('0x3f')]['id']}})[_0x6cc8('0x20')](handleEntityNotFound(_0x9a21c6,null))[_0x6cc8('0x20')](removeEntity(_0x9a21c6,null))[_0x6cc8('0x3d')](handleError(_0x9a21c6,null));};exports[_0x6cc8('0x45')]=function(_0x1bc003,_0x3d270c){return db['IntegrationReport'][_0x6cc8('0x45')]()[_0x6cc8('0x20')](respondWithResult(_0x3d270c,null))['catch'](handleError(_0x3d270c,null));}; \ No newline at end of file +var _0xa44e=['attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','length','includeAll','include','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','reject','update','then','destroy','error','name','send','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa44e,0xf8));var _0xea44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa44e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea44('0x0'));var zipdir=require(_0xea44('0x1'));var jsonpatch=require(_0xea44('0x2'));var rp=require(_0xea44('0x3'));var moment=require('moment');var BPromise=require(_0xea44('0x4'));var Mustache=require(_0xea44('0x5'));var util=require(_0xea44('0x6'));var path=require(_0xea44('0x7'));var sox=require(_0xea44('0x8'));var csv=require(_0xea44('0x9'));var ejs=require(_0xea44('0xa'));var fs=require('fs');var fs_extra=require(_0xea44('0xb'));var _=require(_0xea44('0xc'));var squel=require(_0xea44('0xd'));var crypto=require('crypto');var jsforce=require(_0xea44('0xe'));var deskjs=require(_0xea44('0xf'));var toCsv=require('to-csv');var querystring=require(_0xea44('0x10'));var Papa=require(_0xea44('0x11'));var Redis=require(_0xea44('0x12'));var authService=require(_0xea44('0x13'));var qs=require(_0xea44('0x14'));var as=require(_0xea44('0x15'));var hardwareService=require(_0xea44('0x16'));var logger=require(_0xea44('0x17'))('api');var utils=require(_0xea44('0x18'));var config=require(_0xea44('0x19'));var licenseUtil=require(_0xea44('0x1a'));var db=require(_0xea44('0x1b'))['db'];function respondWithStatusCode(_0x10423d,_0x4eb680){_0x4eb680=_0x4eb680||0xcc;return function(_0x2c4458){if(_0x2c4458){return _0x10423d[_0xea44('0x1c')](_0x4eb680);}return _0x10423d['status'](_0x4eb680)[_0xea44('0x1d')]();};}function respondWithResult(_0x5a582c,_0x3cc84c){_0x3cc84c=_0x3cc84c||0xc8;return function(_0x58cc24){if(_0x58cc24){return _0x5a582c['status'](_0x3cc84c)['json'](_0x58cc24);}};}function respondWithFilteredResult(_0x1ea15c,_0x346d25){return function(_0x974fcc){if(_0x974fcc){var _0x5770ff=typeof _0x346d25[_0xea44('0x1e')]==='undefined'&&typeof _0x346d25[_0xea44('0x1f')]===_0xea44('0x20');var _0xcef922=_0x974fcc[_0xea44('0x21')];var _0x8bd027=_0x5770ff?0x0:_0x346d25[_0xea44('0x1e')];var _0x1f2c3a=_0x5770ff?_0x974fcc[_0xea44('0x21')]:_0x346d25[_0xea44('0x1e')]+_0x346d25[_0xea44('0x1f')];var _0x5b1bae;if(_0x1f2c3a>=_0xcef922){_0x1f2c3a=_0xcef922;_0x5b1bae=0xc8;}else{_0x5b1bae=0xce;}_0x1ea15c[_0xea44('0x22')](_0x5b1bae);return _0x1ea15c['set'](_0xea44('0x23'),_0x8bd027+'-'+_0x1f2c3a+'/'+_0xcef922)[_0xea44('0x24')](_0x974fcc);}return null;};}function patchUpdates(_0x558bb6){return function(_0xe03707){try{jsonpatch['apply'](_0xe03707,_0x558bb6,!![]);}catch(_0x29d35f){return BPromise[_0xea44('0x25')](_0x29d35f);}return _0xe03707['save']();};}function saveUpdates(_0x4a6616,_0x16d8df){return function(_0x3748d7){if(_0x3748d7){return _0x3748d7[_0xea44('0x26')](_0x4a6616)[_0xea44('0x27')](function(_0x18e0ab){return _0x18e0ab;});}return null;};}function removeEntity(_0x4a4cae,_0x33c9de){return function(_0x1b644e){if(_0x1b644e){return _0x1b644e[_0xea44('0x28')]()[_0xea44('0x27')](function(){_0x4a4cae[_0xea44('0x22')](0xcc)[_0xea44('0x1d')]();});}};}function handleEntityNotFound(_0x10ec72,_0xacc8c1){return function(_0x2b26fb){if(!_0x2b26fb){_0x10ec72['sendStatus'](0x194);}return _0x2b26fb;};}function handleError(_0x34f360,_0x29914f){_0x29914f=_0x29914f||0x1f4;return function(_0x135ff4){logger[_0xea44('0x29')](_0x135ff4['stack']);if(_0x135ff4[_0xea44('0x2a')]){delete _0x135ff4[_0xea44('0x2a')];}_0x34f360[_0xea44('0x22')](_0x29914f)[_0xea44('0x2b')](_0x135ff4);};}exports['index']=function(_0x28caba,_0x4fde9d){var _0xe271f3={},_0x240b46={},_0x15593c={'count':0x0,'rows':[]};var _0xba4d37=_['map'](db[_0xea44('0x2c')][_0xea44('0x2d')],function(_0x2ad435){return{'name':_0x2ad435[_0xea44('0x2e')],'type':_0x2ad435[_0xea44('0x2f')][_0xea44('0x30')]};});_0x240b46[_0xea44('0x31')]=_[_0xea44('0x32')](_0xba4d37,_0xea44('0x2a'));_0x240b46[_0xea44('0x33')]=_[_0xea44('0x34')](_0x28caba[_0xea44('0x33')]);_0x240b46[_0xea44('0x35')]=_[_0xea44('0x36')](_0x240b46[_0xea44('0x31')],_0x240b46['query']);_0xe271f3['attributes']=_[_0xea44('0x36')](_0x240b46[_0xea44('0x31')],qs[_0xea44('0x37')](_0x28caba[_0xea44('0x33')]['fields']));_0xe271f3[_0xea44('0x38')]=_0xe271f3[_0xea44('0x38')]['length']?_0xe271f3[_0xea44('0x38')]:_0x240b46['model'];if(!_0x28caba[_0xea44('0x33')][_0xea44('0x39')](_0xea44('0x3a'))){_0xe271f3[_0xea44('0x1f')]=qs[_0xea44('0x1f')](_0x28caba[_0xea44('0x33')][_0xea44('0x1f')]);_0xe271f3[_0xea44('0x1e')]=qs['offset'](_0x28caba[_0xea44('0x33')][_0xea44('0x1e')]);}_0xe271f3['order']=qs[_0xea44('0x3b')](_0x28caba[_0xea44('0x33')][_0xea44('0x3b')]);_0xe271f3[_0xea44('0x3c')]=qs[_0xea44('0x35')](_['pick'](_0x28caba[_0xea44('0x33')],_0x240b46[_0xea44('0x35')]),_0xba4d37);if(_0x28caba[_0xea44('0x33')][_0xea44('0x3d')]){_0xe271f3['where']=_[_0xea44('0x3e')](_0xe271f3[_0xea44('0x3c')],{'$or':_[_0xea44('0x32')](_0xba4d37,function(_0x46fc9e){if(_0x46fc9e[_0xea44('0x2f')]!==_0xea44('0x3f')){var _0x42293d={};_0x42293d[_0x46fc9e['name']]={'$like':'%'+_0x28caba[_0xea44('0x33')][_0xea44('0x3d')]+'%'};return _0x42293d;}})});}_0xe271f3=_[_0xea44('0x3e')]({},_0xe271f3,_0x28caba[_0xea44('0x40')]);var _0x4b281e={'where':_0xe271f3[_0xea44('0x3c')]};return db[_0xea44('0x2c')]['count'](_0x4b281e)['then'](function(_0x1813a1){_0x15593c['count']=_0x1813a1;if(_0x28caba['query']['includeAll']){_0xe271f3['include']=[{'all':!![]}];}return db[_0xea44('0x2c')][_0xea44('0x41')](_0xe271f3);})[_0xea44('0x27')](function(_0xea24e5){_0x15593c[_0xea44('0x42')]=_0xea24e5;return _0x15593c;})[_0xea44('0x27')](respondWithFilteredResult(_0x4fde9d,_0xe271f3))[_0xea44('0x43')](handleError(_0x4fde9d,null));};exports['show']=function(_0xe37897,_0x49cc88){var _0x2c42a0={'raw':![],'where':{'id':_0xe37897['params']['id']}},_0x42f73d={};_0x42f73d[_0xea44('0x31')]=_[_0xea44('0x34')](db[_0xea44('0x2c')][_0xea44('0x2d')]);_0x42f73d[_0xea44('0x33')]=_[_0xea44('0x34')](_0xe37897[_0xea44('0x33')]);_0x42f73d[_0xea44('0x35')]=_[_0xea44('0x36')](_0x42f73d[_0xea44('0x31')],_0x42f73d['query']);_0x2c42a0[_0xea44('0x38')]=_['intersection'](_0x42f73d[_0xea44('0x31')],qs[_0xea44('0x37')](_0xe37897[_0xea44('0x33')]['fields']));_0x2c42a0[_0xea44('0x38')]=_0x2c42a0['attributes'][_0xea44('0x44')]?_0x2c42a0[_0xea44('0x38')]:_0x42f73d['model'];if(_0xe37897[_0xea44('0x33')][_0xea44('0x45')]){_0x2c42a0[_0xea44('0x46')]=[{'all':!![]}];}_0x2c42a0=_[_0xea44('0x3e')]({},_0x2c42a0,_0xe37897[_0xea44('0x40')]);return db[_0xea44('0x2c')]['find'](_0x2c42a0)[_0xea44('0x27')](handleEntityNotFound(_0x49cc88,null))[_0xea44('0x27')](respondWithResult(_0x49cc88,null))[_0xea44('0x43')](handleError(_0x49cc88,null));};exports[_0xea44('0x47')]=function(_0x41213b,_0x3e3177){return db['IntegrationReport'][_0xea44('0x47')](_0x41213b[_0xea44('0x48')],{})[_0xea44('0x27')](respondWithResult(_0x3e3177,0xc9))[_0xea44('0x43')](handleError(_0x3e3177,null));};exports[_0xea44('0x26')]=function(_0x3f31d0,_0x318f29){if(_0x3f31d0['body']['id']){delete _0x3f31d0[_0xea44('0x48')]['id'];}return db[_0xea44('0x2c')][_0xea44('0x49')]({'where':{'id':_0x3f31d0[_0xea44('0x4a')]['id']}})[_0xea44('0x27')](handleEntityNotFound(_0x318f29,null))[_0xea44('0x27')](saveUpdates(_0x3f31d0[_0xea44('0x48')],null))[_0xea44('0x27')](respondWithResult(_0x318f29,null))[_0xea44('0x43')](handleError(_0x318f29,null));};exports[_0xea44('0x28')]=function(_0x2d3313,_0x1ed01b){return db[_0xea44('0x2c')][_0xea44('0x49')]({'where':{'id':_0x2d3313[_0xea44('0x4a')]['id']}})[_0xea44('0x27')](handleEntityNotFound(_0x1ed01b,null))[_0xea44('0x27')](removeEntity(_0x1ed01b,null))[_0xea44('0x43')](handleError(_0x1ed01b,null));};exports[_0xea44('0x4b')]=function(_0x4664f6,_0x13be8f){return db[_0xea44('0x2c')]['describe']()[_0xea44('0x27')](respondWithResult(_0x13be8f,null))[_0xea44('0x43')](handleError(_0x13be8f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 971fdd4..62d4fbc 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 _0x58ee=['bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x2b686b,_0x1b5039){var _0x58ed77=function(_0xbdd4bb){while(--_0xbdd4bb){_0x2b686b['push'](_0x2b686b['shift']());}};_0x58ed77(++_0x1b5039);}(_0x58ee,0xb1));var _0xe58e=function(_0xe41964,_0x4c4b8a){_0xe41964=_0xe41964-0x0;var _0x225b65=_0x58ee[_0xe41964];return _0x225b65;};'use strict';var _=require(_0xe58e('0x0'));var util=require(_0xe58e('0x1'));var logger=require(_0xe58e('0x2'))(_0xe58e('0x3'));var moment=require(_0xe58e('0x4'));var BPromise=require(_0xe58e('0x5'));var rp=require(_0xe58e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe58e('0x7'));var attributes=require(_0xe58e('0x8'));module[_0xe58e('0x9')]=function(_0x46ea83,_0x5ca1f4){return _0x46ea83[_0xe58e('0xa')](_0xe58e('0xb'),attributes,{'tableName':_0xe58e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0954=['moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x0954,0xa5));var _0x4095=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x0954[_0xb0fe92];return _0x41787f;};'use strict';var _=require(_0x4095('0x0'));var util=require(_0x4095('0x1'));var logger=require(_0x4095('0x2'))('api');var moment=require(_0x4095('0x3'));var BPromise=require(_0x4095('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4095('0x5'));var rimraf=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var attributes=require(_0x4095('0x8'));module[_0x4095('0x9')]=function(_0x1197ce,_0x4eae12){return _0x1197ce[_0x4095('0xa')](_0x4095('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index e4bbe46..db46094 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x59128c,_0x55e880){var _0x401fbf=function(_0x5ca7c9){while(--_0x5ca7c9){_0x59128c['push'](_0x59128c['shift']());}};_0x401fbf(++_0x55e880);}(_0xba34,0x119));var _0x4ba3=function(_0x3994b4,_0x3bf54f){_0x3994b4=_0x3994b4-0x0;var _0x25cefb=_0xba34[_0x3994b4];return _0x25cefb;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5aca71,_0x583dfa){var _0x375f79=function(_0x3b2d5e){while(--_0x3b2d5e){_0x5aca71['push'](_0x5aca71['shift']());}};_0x375f79(++_0x583dfa);}(_0xda19,0xd5));var _0x9da1=function(_0x211311,_0x5e08e9){_0x211311=_0x211311-0x0;var _0x12d89b=_0xda19[_0x211311];return _0x12d89b;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e94aff4..a472c5c 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 _0xd8b1=['create','/:id/sub_intervals','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','get','getIntervals'];(function(_0x2017b0,_0x3e5fc5){var _0x6d489e=function(_0x61c1fd){while(--_0x61c1fd){_0x2017b0['push'](_0x2017b0['shift']());}};_0x6d489e(++_0x3e5fc5);}(_0xd8b1,0x105));var _0x1d8b=function(_0x2aeb7c,_0xcd5dde){_0x2aeb7c=_0x2aeb7c-0x0;var _0x845989=_0xd8b1[_0x2aeb7c];return _0x845989;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x1d8b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d8b('0xe')]);router['post'](_0x1d8b('0xf'),auth['isAuthenticated'](),controller[_0x1d8b('0x10')]);router[_0x1d8b('0x11')](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x13')]);router[_0x1d8b('0x14')]('/:id',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x15')]);router[_0x1d8b('0x16')](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x17')]);module[_0x1d8b('0x18')]=router; \ No newline at end of file +var _0x9fe7=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','create','addInterval','post','addIntervals','put','update','delete','destroy','exports','multer'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x359b3b,_0x21e4c2){_0x359b3b=_0x359b3b-0x0;var _0x2f0b37=_0x9fe7[_0x359b3b];return _0x2f0b37;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['post']('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0xf')]);router['post'](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x10')]);router[_0x79fe('0x11')]('/:id/sub_intervals/create_many',auth[_0x79fe('0xd')](),controller[_0x79fe('0x12')]);router[_0x79fe('0x13')](_0x79fe('0xa'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x15')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0x16')]);module[_0x79fe('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 76654b4..f9695f5 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 _0x5a53=['exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5a53,0x17c));var _0x35a5=function(_0x1fb8c9,_0x5f1b30){_0x1fb8c9=_0x1fb8c9-0x0;var _0x9eec94=_0x5a53[_0x1fb8c9];return _0x9eec94;};'use strict';var Sequelize=require('sequelize');module[_0x35a5('0x0')]={'name':{'type':Sequelize[_0x35a5('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x35a5('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xdbeb=['exports','STRING','sequelize'];(function(_0x3fd269,_0x23bf68){var _0x112259=function(_0x1e0f89){while(--_0x1e0f89){_0x3fd269['push'](_0x3fd269['shift']());}};_0x112259(++_0x23bf68);}(_0xdbeb,0x194));var _0xbdbe=function(_0xce0896,_0xa7b330){_0xce0896=_0xce0896-0x0;var _0x30d796=_0xdbeb[_0xce0896];return _0x30d796;};'use strict';var Sequelize=require(_0xbdbe('0x0'));module[_0xbdbe('0x1')]={'name':{'type':Sequelize[_0xbdbe('0x2')]},'description':{'type':Sequelize[_0xbdbe('0x2')]},'interval':{'type':Sequelize[_0xbdbe('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 11a5fa2..66b1a1c 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 _0xe967=['mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','Interval','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','model','nolimit','order','sort','pick','where','merge','filter','options','include','findAll','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','bluebird'];(function(_0x43eb0e,_0x30c7d1){var _0x15b674=function(_0x5d5ad6){while(--_0x5d5ad6){_0x43eb0e['push'](_0x43eb0e['shift']());}};_0x15b674(++_0x30c7d1);}(_0xe967,0x168));var _0x7e96=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xe967[_0x163742];return _0x1152ac;};'use strict';var emlformat=require(_0x7e96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e96('0x1'));var rp=require(_0x7e96('0x2'));var moment=require('moment');var BPromise=require(_0x7e96('0x3'));var Mustache=require(_0x7e96('0x4'));var util=require('util');var path=require(_0x7e96('0x5'));var sox=require(_0x7e96('0x6'));var csv=require('to-csv');var ejs=require(_0x7e96('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e96('0x8'));var squel=require(_0x7e96('0x9'));var crypto=require(_0x7e96('0xa'));var jsforce=require(_0x7e96('0xb'));var deskjs=require(_0x7e96('0xc'));var toCsv=require(_0x7e96('0xd'));var querystring=require(_0x7e96('0xe'));var Papa=require(_0x7e96('0xf'));var Redis=require('ioredis');var authService=require(_0x7e96('0x10'));var qs=require(_0x7e96('0x11'));var as=require(_0x7e96('0x12'));var hardwareService=require(_0x7e96('0x13'));var logger=require('../../config/logger')(_0x7e96('0x14'));var utils=require(_0x7e96('0x15'));var config=require(_0x7e96('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e96('0x17'))['db'];var extensions=require(_0x7e96('0x18'));function respondWithStatusCode(_0x4c4531,_0x471516){_0x471516=_0x471516||0xcc;return function(_0x56ea44){if(_0x56ea44){return _0x4c4531[_0x7e96('0x19')](_0x471516);}return _0x4c4531[_0x7e96('0x1a')](_0x471516)[_0x7e96('0x1b')]();};}function respondWithResult(_0x6bf4e3,_0xa7645){_0xa7645=_0xa7645||0xc8;return function(_0x588828){if(_0x588828){return _0x6bf4e3[_0x7e96('0x1a')](_0xa7645)[_0x7e96('0x1c')](_0x588828);}};}function respondWithFilteredResult(_0x228689,_0x42cdb7){return function(_0x3a243a){if(_0x3a243a){var _0x3e4a05=typeof _0x42cdb7[_0x7e96('0x1d')]==='undefined'&&typeof _0x42cdb7['limit']===_0x7e96('0x1e');var _0xca93e5=_0x3a243a[_0x7e96('0x1f')];var _0x4819aa=_0x3e4a05?0x0:_0x42cdb7['offset'];var _0xfb8cd2=_0x3e4a05?_0x3a243a[_0x7e96('0x1f')]:_0x42cdb7[_0x7e96('0x1d')]+_0x42cdb7[_0x7e96('0x20')];var _0x239cf2;if(_0xfb8cd2>=_0xca93e5){_0xfb8cd2=_0xca93e5;_0x239cf2=0xc8;}else{_0x239cf2=0xce;}_0x228689[_0x7e96('0x1a')](_0x239cf2);return _0x228689[_0x7e96('0x21')](_0x7e96('0x22'),_0x4819aa+'-'+_0xfb8cd2+'/'+_0xca93e5)[_0x7e96('0x1c')](_0x3a243a);}return null;};}function patchUpdates(_0xa88eaf){return function(_0x584ccc){try{jsonpatch[_0x7e96('0x23')](_0x584ccc,_0xa88eaf,!![]);}catch(_0x3a2601){return BPromise[_0x7e96('0x24')](_0x3a2601);}return _0x584ccc[_0x7e96('0x25')]();};}function saveUpdates(_0x26e78e,_0x3ea8ca){return function(_0x3e9d18){if(_0x3e9d18){return _0x3e9d18[_0x7e96('0x26')](_0x26e78e)[_0x7e96('0x27')](function(_0x97b640){return _0x97b640;});}return null;};}function removeEntity(_0x1c5429,_0x2b9eb0){return function(_0x5af78c){if(_0x5af78c){return _0x5af78c[_0x7e96('0x28')]()[_0x7e96('0x27')](function(){var _0xdef4d0=_0x5af78c[_0x7e96('0x29')]({'plain':!![]});var _0x36dc7a='Intervals';return db[_0x7e96('0x2a')][_0x7e96('0x28')]({'where':{'type':_0x36dc7a,'resourceId':_0xdef4d0['id']}})[_0x7e96('0x27')](function(){return _0x5af78c;});})[_0x7e96('0x27')](function(){_0x1c5429['status'](0xcc)[_0x7e96('0x1b')]();});}};}function handleEntityNotFound(_0x391e5f,_0x40ea04){return function(_0x4565f2){if(!_0x4565f2){_0x391e5f[_0x7e96('0x19')](0x194);}return _0x4565f2;};}function handleError(_0x16faa0,_0x30c2d5){_0x30c2d5=_0x30c2d5||0x1f4;return function(_0x24bac5){logger[_0x7e96('0x2b')](_0x24bac5[_0x7e96('0x2c')]);if(_0x24bac5[_0x7e96('0x2d')]){delete _0x24bac5[_0x7e96('0x2d')];}_0x16faa0[_0x7e96('0x1a')](_0x30c2d5)['send'](_0x24bac5);};}exports[_0x7e96('0x2e')]=function(_0x57c5ca,_0x34fef4){var _0xa4bf06={},_0x554abc={},_0xe862d={'count':0x0,'rows':[]};var _0x180acf=_['map'](db[_0x7e96('0x2f')][_0x7e96('0x30')],function(_0x58f9d0){return{'name':_0x58f9d0[_0x7e96('0x31')],'type':_0x58f9d0[_0x7e96('0x32')][_0x7e96('0x33')]};});_0x554abc['model']=_[_0x7e96('0x34')](_0x180acf,'name');_0x554abc[_0x7e96('0x35')]=_[_0x7e96('0x36')](_0x57c5ca[_0x7e96('0x35')]);_0x554abc[_0x7e96('0x37')]=_[_0x7e96('0x38')](_0x554abc['model'],_0x554abc[_0x7e96('0x35')]);_0xa4bf06[_0x7e96('0x39')]=_[_0x7e96('0x38')](_0x554abc['model'],qs[_0x7e96('0x3a')](_0x57c5ca[_0x7e96('0x35')][_0x7e96('0x3a')]));_0xa4bf06[_0x7e96('0x39')]=_0xa4bf06[_0x7e96('0x39')]['length']?_0xa4bf06[_0x7e96('0x39')]:_0x554abc[_0x7e96('0x3b')];if(!_0x57c5ca[_0x7e96('0x35')]['hasOwnProperty'](_0x7e96('0x3c'))){_0xa4bf06[_0x7e96('0x20')]=qs['limit'](_0x57c5ca[_0x7e96('0x35')][_0x7e96('0x20')]);_0xa4bf06[_0x7e96('0x1d')]=qs[_0x7e96('0x1d')](_0x57c5ca[_0x7e96('0x35')]['offset']);}_0xa4bf06[_0x7e96('0x3d')]=qs[_0x7e96('0x3e')](_0x57c5ca[_0x7e96('0x35')][_0x7e96('0x3e')]);_0xa4bf06['where']=qs['filters'](_[_0x7e96('0x3f')](_0x57c5ca[_0x7e96('0x35')],_0x554abc[_0x7e96('0x37')]),_0x180acf);if(_0x57c5ca[_0x7e96('0x35')]['filter']){_0xa4bf06[_0x7e96('0x40')]=_[_0x7e96('0x41')](_0xa4bf06[_0x7e96('0x40')],{'$or':_[_0x7e96('0x34')](_0x180acf,function(_0x17d487){if(_0x17d487[_0x7e96('0x32')]!=='VIRTUAL'){var _0x44545f={};_0x44545f[_0x17d487[_0x7e96('0x2d')]]={'$like':'%'+_0x57c5ca['query'][_0x7e96('0x42')]+'%'};return _0x44545f;}})});}_0xa4bf06=_[_0x7e96('0x41')]({},_0xa4bf06,_0x57c5ca[_0x7e96('0x43')]);var _0x5bcdd0={'where':_0xa4bf06[_0x7e96('0x40')]};return db[_0x7e96('0x2f')][_0x7e96('0x1f')](_0x5bcdd0)[_0x7e96('0x27')](function(_0x17d671){_0xe862d['count']=_0x17d671;if(_0x57c5ca[_0x7e96('0x35')]['includeAll']){_0xa4bf06[_0x7e96('0x44')]=[{'all':!![]}];}return db[_0x7e96('0x2f')][_0x7e96('0x45')](_0xa4bf06);})['then'](function(_0x426144){_0xe862d['rows']=_0x426144;return _0xe862d;})[_0x7e96('0x27')](respondWithFilteredResult(_0x34fef4,_0xa4bf06))[_0x7e96('0x46')](handleError(_0x34fef4,null));};exports[_0x7e96('0x47')]=function(_0x224e2a,_0x59cff9){var _0x4f960f={'raw':!![],'where':{'id':_0x224e2a[_0x7e96('0x48')]['id']}},_0x2493fe={};_0x2493fe['model']=_['keys'](db[_0x7e96('0x2f')][_0x7e96('0x30')]);_0x2493fe['query']=_[_0x7e96('0x36')](_0x224e2a[_0x7e96('0x35')]);_0x2493fe[_0x7e96('0x37')]=_[_0x7e96('0x38')](_0x2493fe[_0x7e96('0x3b')],_0x2493fe['query']);_0x4f960f[_0x7e96('0x39')]=_[_0x7e96('0x38')](_0x2493fe[_0x7e96('0x3b')],qs[_0x7e96('0x3a')](_0x224e2a[_0x7e96('0x35')][_0x7e96('0x3a')]));_0x4f960f[_0x7e96('0x39')]=_0x4f960f[_0x7e96('0x39')][_0x7e96('0x49')]?_0x4f960f[_0x7e96('0x39')]:_0x2493fe[_0x7e96('0x3b')];if(_0x224e2a[_0x7e96('0x35')]['includeAll']){_0x4f960f[_0x7e96('0x44')]=[{'all':!![]}];}_0x4f960f=_['merge']({},_0x4f960f,_0x224e2a['options']);return db[_0x7e96('0x2f')][_0x7e96('0x4a')](_0x4f960f)[_0x7e96('0x27')](handleEntityNotFound(_0x59cff9,null))[_0x7e96('0x27')](respondWithResult(_0x59cff9,null))[_0x7e96('0x46')](handleError(_0x59cff9,null));};exports['create']=function(_0x5f1af6,_0x41b01c){return db[_0x7e96('0x2f')]['create'](_0x5f1af6[_0x7e96('0x4b')],{})[_0x7e96('0x27')](function(_0x3bc601){var _0x53fd34=_0x5f1af6[_0x7e96('0x4c')][_0x7e96('0x29')]({'plain':!![]});if(!_0x53fd34)throw new Error(_0x7e96('0x4d'));if(_0x53fd34[_0x7e96('0x4e')]===_0x7e96('0x4c')){var _0x36cd4b=_0x3bc601[_0x7e96('0x29')]({'plain':!![]});var _0x2a92e2='Intervals';return db[_0x7e96('0x4f')][_0x7e96('0x4a')]({'where':{'name':_0x2a92e2,'userProfileId':_0x53fd34['userProfileId']},'raw':!![]})[_0x7e96('0x27')](function(_0x1fdbeb){if(_0x1fdbeb&&_0x1fdbeb[_0x7e96('0x50')]===0x0){return db[_0x7e96('0x2a')][_0x7e96('0x51')]({'name':_0x36cd4b['name'],'resourceId':_0x36cd4b['id'],'type':_0x1fdbeb[_0x7e96('0x2d')],'sectionId':_0x1fdbeb['id']},{})[_0x7e96('0x27')](function(){return _0x3bc601;});}else{return _0x3bc601;}})[_0x7e96('0x46')](function(_0xabc9c7){logger[_0x7e96('0x2b')](_0x7e96('0x52'),_0xabc9c7);throw _0xabc9c7;});}return _0x3bc601;})[_0x7e96('0x27')](respondWithResult(_0x41b01c,0xc9))[_0x7e96('0x46')](handleError(_0x41b01c,null));};exports[_0x7e96('0x26')]=function(_0x2abc60,_0x39e680){if(_0x2abc60[_0x7e96('0x4b')]['id']){delete _0x2abc60['body']['id'];}return db[_0x7e96('0x2f')][_0x7e96('0x4a')]({'where':{'id':_0x2abc60['params']['id']}})[_0x7e96('0x27')](handleEntityNotFound(_0x39e680,null))[_0x7e96('0x27')](saveUpdates(_0x2abc60[_0x7e96('0x4b')],null))[_0x7e96('0x27')](respondWithResult(_0x39e680,null))[_0x7e96('0x46')](handleError(_0x39e680,null));};exports[_0x7e96('0x28')]=function(_0x575d11,_0x1790ae){return db[_0x7e96('0x2f')]['find']({'where':{'id':_0x575d11[_0x7e96('0x48')]['id']}})['then'](handleEntityNotFound(_0x1790ae,null))[_0x7e96('0x27')](removeEntity(_0x1790ae,null))[_0x7e96('0x46')](handleError(_0x1790ae,null));};exports[_0x7e96('0x53')]=function(_0x124d18,_0x3a8b76,_0x47d7e8){if(_0x124d18[_0x7e96('0x4b')]['id']){delete _0x124d18['body']['id'];}return db['Interval'][_0x7e96('0x4a')]({'where':{'id':_0x124d18[_0x7e96('0x48')]['id']}})[_0x7e96('0x27')](handleEntityNotFound(_0x3a8b76,null))[_0x7e96('0x27')](function(_0x1cdc02){if(_0x1cdc02){_0x124d18[_0x7e96('0x4b')][_0x7e96('0x54')]=_0x1cdc02['id'];return db['Interval'][_0x7e96('0x51')](_0x124d18['body']);}})[_0x7e96('0x27')](respondWithResult(_0x3a8b76,null))[_0x7e96('0x46')](handleError(_0x3a8b76,null));};exports[_0x7e96('0x55')]=function(_0x30132b,_0x1f13c5,_0x2d6e36){var _0x3e1789={};var _0x4e1113={};var _0x43ec0c;var _0x49cdb9;return db[_0x7e96('0x2f')][_0x7e96('0x56')]({'where':{'id':_0x30132b['params']['id']}})['then'](handleEntityNotFound(_0x1f13c5,null))[_0x7e96('0x27')](function(_0x45a874){if(_0x45a874){_0x43ec0c=_0x45a874;_0x4e1113[_0x7e96('0x3b')]=_[_0x7e96('0x36')](db[_0x7e96('0x2f')][_0x7e96('0x30')]);_0x4e1113[_0x7e96('0x35')]=_[_0x7e96('0x36')](_0x30132b[_0x7e96('0x35')]);_0x4e1113['filters']=_[_0x7e96('0x38')](_0x4e1113[_0x7e96('0x3b')],_0x4e1113[_0x7e96('0x35')]);_0x3e1789['attributes']=_[_0x7e96('0x38')](_0x4e1113[_0x7e96('0x3b')],qs[_0x7e96('0x3a')](_0x30132b[_0x7e96('0x35')][_0x7e96('0x3a')]));_0x3e1789['attributes']=_0x3e1789[_0x7e96('0x39')][_0x7e96('0x49')]?_0x3e1789[_0x7e96('0x39')]:_0x4e1113['model'];_0x3e1789[_0x7e96('0x3d')]=qs[_0x7e96('0x3e')](_0x30132b['query'][_0x7e96('0x3e')]);_0x3e1789[_0x7e96('0x40')]=qs[_0x7e96('0x37')](_[_0x7e96('0x3f')](_0x30132b[_0x7e96('0x35')],_0x4e1113['filters']));if(_0x30132b[_0x7e96('0x35')][_0x7e96('0x42')]){_0x3e1789[_0x7e96('0x40')]=_[_0x7e96('0x41')](_0x3e1789[_0x7e96('0x40')],{'$or':_[_0x7e96('0x34')](_0x3e1789[_0x7e96('0x39')],function(_0x5bec88){var _0x3bbc3c={};_0x3bbc3c[_0x5bec88]={'$like':'%'+_0x30132b[_0x7e96('0x35')][_0x7e96('0x42')]+'%'};return _0x3bbc3c;})});}_0x3e1789=_[_0x7e96('0x41')]({},_0x3e1789,_0x30132b['options']);return _0x43ec0c['getIntervals'](_0x3e1789);}})[_0x7e96('0x27')](function(_0x1a02e6){if(_0x1a02e6){_0x49cdb9=_0x1a02e6['length'];if(!_0x30132b[_0x7e96('0x35')][_0x7e96('0x57')](_0x7e96('0x3c'))){_0x3e1789[_0x7e96('0x20')]=qs[_0x7e96('0x20')](_0x30132b[_0x7e96('0x35')][_0x7e96('0x20')]);_0x3e1789[_0x7e96('0x1d')]=qs[_0x7e96('0x1d')](_0x30132b[_0x7e96('0x35')]['offset']);}return _0x43ec0c[_0x7e96('0x55')](_0x3e1789);}})[_0x7e96('0x27')](function(_0x335c8e){if(_0x335c8e){return _0x335c8e?{'count':_0x49cdb9,'rows':_0x335c8e}:null;}})[_0x7e96('0x27')](respondWithResult(_0x1f13c5,null))['catch'](handleError(_0x1f13c5,null));};exports[_0x7e96('0x58')]=function(_0x124679,_0x28da4d,_0x164cae){return db[_0x7e96('0x2f')]['findOne']({'where':{'id':_0x124679[_0x7e96('0x48')]['id']}})[_0x7e96('0x27')](handleEntityNotFound(_0x28da4d,null))[_0x7e96('0x27')](function(_0xa760cb){if(_0xa760cb){return db['sequelize'][_0x7e96('0x59')](function(_0x5dd478){return db['Interval'][_0x7e96('0x28')]({'where':{'IntervalId':_0x124679[_0x7e96('0x48')]['id']},'transaction':_0x5dd478})['then'](function(_0x4d73c5){var _0x243a03=_[_0x7e96('0x34')](_0x124679[_0x7e96('0x4b')],function(_0x47dd83){delete _0x47dd83['id'];_0x47dd83[_0x7e96('0x54')]=_0x124679['params']['id'];return _0x47dd83;});return db['Interval'][_0x7e96('0x5a')](_0x243a03,{'transaction':_0x5dd478});});})[_0x7e96('0x27')](function(){return db[_0x7e96('0x2f')]['findAll']({'where':{'IntervalId':_0x124679[_0x7e96('0x48')]['id']}});});}})[_0x7e96('0x27')](respondWithResult(_0x28da4d,null))['catch'](handleError(_0x28da4d,null));}; \ No newline at end of file +var _0x3eb0=['../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Intervals','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','Interval','includeAll','findAll','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','findOne','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1b674c,_0x3f2397){var _0x21ae00=function(_0x3b16e3){while(--_0x3b16e3){_0x1b674c['push'](_0x1b674c['shift']());}};_0x21ae00(++_0x3f2397);}(_0x3eb0,0x9a));var _0x03eb=function(_0x235218,_0x17e66b){_0x235218=_0x235218-0x0;var _0xae3cbf=_0x3eb0[_0x235218];return _0xae3cbf;};'use strict';var emlformat=require(_0x03eb('0x0'));var rimraf=require(_0x03eb('0x1'));var zipdir=require(_0x03eb('0x2'));var jsonpatch=require(_0x03eb('0x3'));var rp=require(_0x03eb('0x4'));var moment=require(_0x03eb('0x5'));var BPromise=require(_0x03eb('0x6'));var Mustache=require('mustache');var util=require(_0x03eb('0x7'));var path=require(_0x03eb('0x8'));var sox=require('sox');var csv=require(_0x03eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x03eb('0xa'));var crypto=require(_0x03eb('0xb'));var jsforce=require(_0x03eb('0xc'));var deskjs=require(_0x03eb('0xd'));var toCsv=require(_0x03eb('0x9'));var querystring=require(_0x03eb('0xe'));var Papa=require(_0x03eb('0xf'));var Redis=require(_0x03eb('0x10'));var authService=require(_0x03eb('0x11'));var qs=require(_0x03eb('0x12'));var as=require(_0x03eb('0x13'));var hardwareService=require(_0x03eb('0x14'));var logger=require('../../config/logger')(_0x03eb('0x15'));var utils=require(_0x03eb('0x16'));var config=require(_0x03eb('0x17'));var licenseUtil=require(_0x03eb('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x03eb('0x19'));function respondWithStatusCode(_0x34b648,_0x226b68){_0x226b68=_0x226b68||0xcc;return function(_0x566db4){if(_0x566db4){return _0x34b648['sendStatus'](_0x226b68);}return _0x34b648[_0x03eb('0x1a')](_0x226b68)['end']();};}function respondWithResult(_0x370bc9,_0x195bd4){_0x195bd4=_0x195bd4||0xc8;return function(_0x2b2cc1){if(_0x2b2cc1){return _0x370bc9[_0x03eb('0x1a')](_0x195bd4)[_0x03eb('0x1b')](_0x2b2cc1);}};}function respondWithFilteredResult(_0x302496,_0x38b439){return function(_0x970c6a){if(_0x970c6a){var _0x2fe1=typeof _0x38b439['offset']===_0x03eb('0x1c')&&typeof _0x38b439[_0x03eb('0x1d')]==='undefined';var _0x2bd824=_0x970c6a[_0x03eb('0x1e')];var _0x216ffc=_0x2fe1?0x0:_0x38b439[_0x03eb('0x1f')];var _0x5b732b=_0x2fe1?_0x970c6a[_0x03eb('0x1e')]:_0x38b439['offset']+_0x38b439[_0x03eb('0x1d')];var _0x1a5739;if(_0x5b732b>=_0x2bd824){_0x5b732b=_0x2bd824;_0x1a5739=0xc8;}else{_0x1a5739=0xce;}_0x302496[_0x03eb('0x1a')](_0x1a5739);return _0x302496[_0x03eb('0x20')](_0x03eb('0x21'),_0x216ffc+'-'+_0x5b732b+'/'+_0x2bd824)['json'](_0x970c6a);}return null;};}function patchUpdates(_0xb2e973){return function(_0x4aac3f){try{jsonpatch[_0x03eb('0x22')](_0x4aac3f,_0xb2e973,!![]);}catch(_0x479b3e){return BPromise['reject'](_0x479b3e);}return _0x4aac3f[_0x03eb('0x23')]();};}function saveUpdates(_0x444646,_0x1395c6){return function(_0x21a517){if(_0x21a517){return _0x21a517['update'](_0x444646)[_0x03eb('0x24')](function(_0x333cac){return _0x333cac;});}return null;};}function removeEntity(_0x325127,_0x318245){return function(_0x458d6a){if(_0x458d6a){return _0x458d6a[_0x03eb('0x25')]()[_0x03eb('0x24')](function(){var _0x853861=_0x458d6a[_0x03eb('0x26')]({'plain':!![]});var _0x3daf85=_0x03eb('0x27');return db['UserProfileResource'][_0x03eb('0x25')]({'where':{'type':_0x3daf85,'resourceId':_0x853861['id']}})[_0x03eb('0x24')](function(){return _0x458d6a;});})[_0x03eb('0x24')](function(){_0x325127['status'](0xcc)[_0x03eb('0x28')]();});}};}function handleEntityNotFound(_0x4d4fee,_0x2b68e7){return function(_0x592cc8){if(!_0x592cc8){_0x4d4fee[_0x03eb('0x29')](0x194);}return _0x592cc8;};}function handleError(_0x587055,_0x26f3cc){_0x26f3cc=_0x26f3cc||0x1f4;return function(_0x5cc727){logger[_0x03eb('0x2a')](_0x5cc727['stack']);if(_0x5cc727[_0x03eb('0x2b')]){delete _0x5cc727[_0x03eb('0x2b')];}_0x587055[_0x03eb('0x1a')](_0x26f3cc)['send'](_0x5cc727);};}exports[_0x03eb('0x2c')]=function(_0x29e9a2,_0x158cbc){var _0x724bc4={},_0x1f4c05={},_0x39d792={'count':0x0,'rows':[]};var _0x5bfc15=_[_0x03eb('0x2d')](db['Interval'][_0x03eb('0x2e')],function(_0x5d70f1){return{'name':_0x5d70f1[_0x03eb('0x2f')],'type':_0x5d70f1[_0x03eb('0x30')]['key']};});_0x1f4c05[_0x03eb('0x31')]=_[_0x03eb('0x2d')](_0x5bfc15,_0x03eb('0x2b'));_0x1f4c05[_0x03eb('0x32')]=_[_0x03eb('0x33')](_0x29e9a2[_0x03eb('0x32')]);_0x1f4c05[_0x03eb('0x34')]=_[_0x03eb('0x35')](_0x1f4c05[_0x03eb('0x31')],_0x1f4c05['query']);_0x724bc4['attributes']=_[_0x03eb('0x35')](_0x1f4c05[_0x03eb('0x31')],qs[_0x03eb('0x36')](_0x29e9a2[_0x03eb('0x32')][_0x03eb('0x36')]));_0x724bc4['attributes']=_0x724bc4[_0x03eb('0x37')][_0x03eb('0x38')]?_0x724bc4[_0x03eb('0x37')]:_0x1f4c05[_0x03eb('0x31')];if(!_0x29e9a2['query'][_0x03eb('0x39')](_0x03eb('0x3a'))){_0x724bc4['limit']=qs[_0x03eb('0x1d')](_0x29e9a2['query'][_0x03eb('0x1d')]);_0x724bc4[_0x03eb('0x1f')]=qs[_0x03eb('0x1f')](_0x29e9a2[_0x03eb('0x32')][_0x03eb('0x1f')]);}_0x724bc4[_0x03eb('0x3b')]=qs[_0x03eb('0x3c')](_0x29e9a2[_0x03eb('0x32')][_0x03eb('0x3c')]);_0x724bc4['where']=qs['filters'](_[_0x03eb('0x3d')](_0x29e9a2[_0x03eb('0x32')],_0x1f4c05[_0x03eb('0x34')]),_0x5bfc15);if(_0x29e9a2[_0x03eb('0x32')][_0x03eb('0x3e')]){_0x724bc4['where']=_[_0x03eb('0x3f')](_0x724bc4[_0x03eb('0x40')],{'$or':_[_0x03eb('0x2d')](_0x5bfc15,function(_0x4096c0){if(_0x4096c0[_0x03eb('0x30')]!=='VIRTUAL'){var _0x483f94={};_0x483f94[_0x4096c0[_0x03eb('0x2b')]]={'$like':'%'+_0x29e9a2[_0x03eb('0x32')][_0x03eb('0x3e')]+'%'};return _0x483f94;}})});}_0x724bc4=_['merge']({},_0x724bc4,_0x29e9a2[_0x03eb('0x41')]);var _0x5cd249={'where':_0x724bc4['where']};return db[_0x03eb('0x42')][_0x03eb('0x1e')](_0x5cd249)[_0x03eb('0x24')](function(_0x2ad2e9){_0x39d792[_0x03eb('0x1e')]=_0x2ad2e9;if(_0x29e9a2['query'][_0x03eb('0x43')]){_0x724bc4['include']=[{'all':!![]}];}return db[_0x03eb('0x42')][_0x03eb('0x44')](_0x724bc4);})[_0x03eb('0x24')](function(_0x8f5804){_0x39d792['rows']=_0x8f5804;return _0x39d792;})[_0x03eb('0x24')](respondWithFilteredResult(_0x158cbc,_0x724bc4))[_0x03eb('0x45')](handleError(_0x158cbc,null));};exports[_0x03eb('0x46')]=function(_0x2fb547,_0x585b71){var _0x559f75={'raw':!![],'where':{'id':_0x2fb547[_0x03eb('0x47')]['id']}},_0x2f558f={};_0x2f558f[_0x03eb('0x31')]=_[_0x03eb('0x33')](db[_0x03eb('0x42')]['rawAttributes']);_0x2f558f['query']=_[_0x03eb('0x33')](_0x2fb547[_0x03eb('0x32')]);_0x2f558f[_0x03eb('0x34')]=_['intersection'](_0x2f558f[_0x03eb('0x31')],_0x2f558f[_0x03eb('0x32')]);_0x559f75[_0x03eb('0x37')]=_[_0x03eb('0x35')](_0x2f558f[_0x03eb('0x31')],qs[_0x03eb('0x36')](_0x2fb547['query'][_0x03eb('0x36')]));_0x559f75[_0x03eb('0x37')]=_0x559f75[_0x03eb('0x37')][_0x03eb('0x38')]?_0x559f75[_0x03eb('0x37')]:_0x2f558f[_0x03eb('0x31')];if(_0x2fb547[_0x03eb('0x32')]['includeAll']){_0x559f75[_0x03eb('0x48')]=[{'all':!![]}];}_0x559f75=_['merge']({},_0x559f75,_0x2fb547['options']);return db[_0x03eb('0x42')][_0x03eb('0x49')](_0x559f75)['then'](handleEntityNotFound(_0x585b71,null))[_0x03eb('0x24')](respondWithResult(_0x585b71,null))[_0x03eb('0x45')](handleError(_0x585b71,null));};exports[_0x03eb('0x4a')]=function(_0x273950,_0x8e0c88){return db[_0x03eb('0x42')][_0x03eb('0x4a')](_0x273950[_0x03eb('0x4b')],{})[_0x03eb('0x24')](function(_0x393b62){var _0x42cc87=_0x273950[_0x03eb('0x4c')][_0x03eb('0x26')]({'plain':!![]});if(!_0x42cc87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42cc87[_0x03eb('0x4d')]==='user'){var _0xaf28f=_0x393b62[_0x03eb('0x26')]({'plain':!![]});var _0x208b85='Intervals';return db[_0x03eb('0x4e')][_0x03eb('0x49')]({'where':{'name':_0x208b85,'userProfileId':_0x42cc87[_0x03eb('0x4f')]},'raw':!![]})[_0x03eb('0x24')](function(_0x332346){if(_0x332346&&_0x332346[_0x03eb('0x50')]===0x0){return db['UserProfileResource'][_0x03eb('0x4a')]({'name':_0xaf28f[_0x03eb('0x2b')],'resourceId':_0xaf28f['id'],'type':_0x332346[_0x03eb('0x2b')],'sectionId':_0x332346['id']},{})[_0x03eb('0x24')](function(){return _0x393b62;});}else{return _0x393b62;}})[_0x03eb('0x45')](function(_0x1a6a38){logger[_0x03eb('0x2a')](_0x03eb('0x51'),_0x1a6a38);throw _0x1a6a38;});}return _0x393b62;})['then'](respondWithResult(_0x8e0c88,0xc9))[_0x03eb('0x45')](handleError(_0x8e0c88,null));};exports[_0x03eb('0x52')]=function(_0x2d8fed,_0x322fb4){if(_0x2d8fed['body']['id']){delete _0x2d8fed['body']['id'];}return db['Interval'][_0x03eb('0x49')]({'where':{'id':_0x2d8fed['params']['id']}})[_0x03eb('0x24')](handleEntityNotFound(_0x322fb4,null))[_0x03eb('0x24')](saveUpdates(_0x2d8fed[_0x03eb('0x4b')],null))[_0x03eb('0x24')](respondWithResult(_0x322fb4,null))['catch'](handleError(_0x322fb4,null));};exports['destroy']=function(_0x10545f,_0x30b249){return db[_0x03eb('0x42')]['find']({'where':{'id':_0x10545f['params']['id']}})[_0x03eb('0x24')](handleEntityNotFound(_0x30b249,null))['then'](removeEntity(_0x30b249,null))[_0x03eb('0x45')](handleError(_0x30b249,null));};exports['addInterval']=function(_0x2f3741,_0x37ea1b,_0xecf9ee){if(_0x2f3741[_0x03eb('0x4b')]['id']){delete _0x2f3741[_0x03eb('0x4b')]['id'];}return db[_0x03eb('0x42')][_0x03eb('0x49')]({'where':{'id':_0x2f3741['params']['id']}})[_0x03eb('0x24')](handleEntityNotFound(_0x37ea1b,null))[_0x03eb('0x24')](function(_0x3ac681){if(_0x3ac681){_0x2f3741[_0x03eb('0x4b')][_0x03eb('0x53')]=_0x3ac681['id'];return db[_0x03eb('0x42')][_0x03eb('0x4a')](_0x2f3741['body']);}})[_0x03eb('0x24')](respondWithResult(_0x37ea1b,null))[_0x03eb('0x45')](handleError(_0x37ea1b,null));};exports[_0x03eb('0x54')]=function(_0x2f9850,_0x85b676,_0x3cbafb){var _0x4fc8da={};var _0x367743={};var _0x3dbc85;var _0x4e47f1;return db[_0x03eb('0x42')][_0x03eb('0x55')]({'where':{'id':_0x2f9850['params']['id']}})[_0x03eb('0x24')](handleEntityNotFound(_0x85b676,null))['then'](function(_0x117eb6){if(_0x117eb6){_0x3dbc85=_0x117eb6;_0x367743[_0x03eb('0x31')]=_[_0x03eb('0x33')](db[_0x03eb('0x42')][_0x03eb('0x2e')]);_0x367743[_0x03eb('0x32')]=_[_0x03eb('0x33')](_0x2f9850[_0x03eb('0x32')]);_0x367743['filters']=_[_0x03eb('0x35')](_0x367743['model'],_0x367743[_0x03eb('0x32')]);_0x4fc8da[_0x03eb('0x37')]=_[_0x03eb('0x35')](_0x367743['model'],qs[_0x03eb('0x36')](_0x2f9850[_0x03eb('0x32')][_0x03eb('0x36')]));_0x4fc8da[_0x03eb('0x37')]=_0x4fc8da[_0x03eb('0x37')][_0x03eb('0x38')]?_0x4fc8da['attributes']:_0x367743['model'];_0x4fc8da[_0x03eb('0x3b')]=qs[_0x03eb('0x3c')](_0x2f9850['query']['sort']);_0x4fc8da[_0x03eb('0x40')]=qs[_0x03eb('0x34')](_[_0x03eb('0x3d')](_0x2f9850[_0x03eb('0x32')],_0x367743[_0x03eb('0x34')]));if(_0x2f9850[_0x03eb('0x32')]['filter']){_0x4fc8da['where']=_[_0x03eb('0x3f')](_0x4fc8da[_0x03eb('0x40')],{'$or':_[_0x03eb('0x2d')](_0x4fc8da['attributes'],function(_0x2ecf7c){var _0x4e3791={};_0x4e3791[_0x2ecf7c]={'$like':'%'+_0x2f9850[_0x03eb('0x32')][_0x03eb('0x3e')]+'%'};return _0x4e3791;})});}_0x4fc8da=_[_0x03eb('0x3f')]({},_0x4fc8da,_0x2f9850[_0x03eb('0x41')]);return _0x3dbc85[_0x03eb('0x54')](_0x4fc8da);}})['then'](function(_0x16f6c){if(_0x16f6c){_0x4e47f1=_0x16f6c[_0x03eb('0x38')];if(!_0x2f9850[_0x03eb('0x32')][_0x03eb('0x39')](_0x03eb('0x3a'))){_0x4fc8da[_0x03eb('0x1d')]=qs[_0x03eb('0x1d')](_0x2f9850[_0x03eb('0x32')][_0x03eb('0x1d')]);_0x4fc8da['offset']=qs['offset'](_0x2f9850[_0x03eb('0x32')][_0x03eb('0x1f')]);}return _0x3dbc85[_0x03eb('0x54')](_0x4fc8da);}})['then'](function(_0x3a1d5d){if(_0x3a1d5d){return _0x3a1d5d?{'count':_0x4e47f1,'rows':_0x3a1d5d}:null;}})[_0x03eb('0x24')](respondWithResult(_0x85b676,null))[_0x03eb('0x45')](handleError(_0x85b676,null));};exports[_0x03eb('0x56')]=function(_0xec29f2,_0x2e67ee,_0x1d263a){return db[_0x03eb('0x42')][_0x03eb('0x55')]({'where':{'id':_0xec29f2[_0x03eb('0x47')]['id']}})[_0x03eb('0x24')](handleEntityNotFound(_0x2e67ee,null))['then'](function(_0x2d20d1){if(_0x2d20d1){return db['sequelize'][_0x03eb('0x57')](function(_0x4ad970){return db[_0x03eb('0x42')][_0x03eb('0x25')]({'where':{'IntervalId':_0xec29f2[_0x03eb('0x47')]['id']},'transaction':_0x4ad970})[_0x03eb('0x24')](function(_0x5e630b){var _0x3884fb=_[_0x03eb('0x2d')](_0xec29f2[_0x03eb('0x4b')],function(_0x36735d){delete _0x36735d['id'];_0x36735d[_0x03eb('0x53')]=_0xec29f2[_0x03eb('0x47')]['id'];return _0x36735d;});return db[_0x03eb('0x42')]['bulkCreate'](_0x3884fb,{'transaction':_0x4ad970});});})['then'](function(){return db[_0x03eb('0x42')]['findAll']({'where':{'IntervalId':_0xec29f2[_0x03eb('0x47')]['id']}});});}})[_0x03eb('0x24')](respondWithResult(_0x2e67ee,null))['catch'](handleError(_0x2e67ee,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 17eedb6..59ffa38 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 _0x1ae3=['rewrite','string','interval','getIntervals','then','all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval'];(function(_0x342967,_0x176fd7){var _0x393b7e=function(_0x5409f4){while(--_0x5409f4){_0x342967['push'](_0x342967['shift']());}};_0x393b7e(++_0x176fd7);}(_0x1ae3,0x13c));var _0x31ae=function(_0x1972c3,_0x3c3ccf){_0x1972c3=_0x1972c3-0x0;var _0x4c5de1=_0x1ae3[_0x1972c3];return _0x4c5de1;};'use strict';var attributes=require(_0x31ae('0x0'));var extensions=require(_0x31ae('0x1'));var iftime=require(_0x31ae('0x2'))['iftime'];module[_0x31ae('0x3')]=function(_0x28b0d4){return _0x28b0d4[_0x31ae('0x4')](_0x31ae('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cbf12){extensions[_0x31ae('0x6')](_0x28b0d4,_0x5cbf12);},'afterBulkCreate':function(_0x4b4077,_0x56f620,_0x71be72){_0x71be72();extensions[_0x31ae('0x6')](_0x28b0d4,_0x4b4077[0x0]);},'afterUpdate':function(_0x377524){extensions[_0x31ae('0x6')](_0x28b0d4,_0x377524);},'afterDestroy':function(_0x14115f){extensions[_0x31ae('0x6')](_0x28b0d4,_0x14115f);}},'instanceMethods':{'ifTime':function(_0x4c21d6=undefined,_0x2b6aed=new Date()){if(typeof this['interval']===_0x31ae('0x7')){return iftime(this[_0x31ae('0x8')],_0x4c21d6,_0x2b6aed);}else{return this[_0x31ae('0x9')]()[_0x31ae('0xa')](function(_0xe95e3c){return Promise[_0x31ae('0xb')](_0xe95e3c['map'](function(_0x1b5da7){return _0x1b5da7[_0x31ae('0xc')](_0x4c21d6,_0x2b6aed);}));})['then'](function(_0x145a63){return _0x145a63[_0x31ae('0xd')](function(_0x22b97e,_0x3cec81){return _0x22b97e||_0x3cec81;},![]);});}}}});}; \ No newline at end of file +var _0xb214=['map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','all'];(function(_0x1a0e03,_0x2083e7){var _0x118990=function(_0x3410a1){while(--_0x3410a1){_0x1a0e03['push'](_0x1a0e03['shift']());}};_0x118990(++_0x2083e7);}(_0xb214,0x199));var _0x4b21=function(_0x2900e6,_0x5f5ab1){_0x2900e6=_0x2900e6-0x0;var _0x25dbb7=_0xb214[_0x2900e6];return _0x25dbb7;};'use strict';var attributes=require(_0x4b21('0x0'));var extensions=require(_0x4b21('0x1'));var iftime=require('../../utils/iftime')[_0x4b21('0x2')];module[_0x4b21('0x3')]=function(_0x116515){return _0x116515[_0x4b21('0x4')](_0x4b21('0x5'),attributes,{'tableName':_0x4b21('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58b802){extensions['rewrite'](_0x116515,_0x58b802);},'afterBulkCreate':function(_0x9d0c5a,_0x39cb92,_0x39890c){_0x39890c();extensions[_0x4b21('0x7')](_0x116515,_0x9d0c5a[0x0]);},'afterUpdate':function(_0x54116e){extensions['rewrite'](_0x116515,_0x54116e);},'afterDestroy':function(_0x333046){extensions[_0x4b21('0x7')](_0x116515,_0x333046);}},'instanceMethods':{'ifTime':function(_0x67e5e2=undefined,_0x337291=new Date()){if(typeof this[_0x4b21('0x8')]==='string'){return iftime(this['interval'],_0x67e5e2,_0x337291);}else{return this[_0x4b21('0x9')]()['then'](function(_0x1ee3ec){return Promise[_0x4b21('0xa')](_0x1ee3ec[_0x4b21('0xb')](function(_0xf57b38){return _0xf57b38[_0x4b21('0xc')](_0x67e5e2,_0x337291);}));})[_0x4b21('0xd')](function(_0x1eb8d4){return _0x1eb8d4[_0x4b21('0xe')](function(_0x208e03,_0x9b0c5e){return _0x208e03||_0x9b0c5e;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fcc04a4..544bc2b 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 _0x963e=['debug','catch','message','error','ShowInterval','Interval','find','stringify','all','ifTime','info','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','findAll','raw','options','attributes','include','map','model','then'];(function(_0x36ce12,_0x154d21){var _0x21b6fe=function(_0x34b421){while(--_0x34b421){_0x36ce12['push'](_0x36ce12['shift']());}};_0x21b6fe(++_0x154d21);}(_0x963e,0xc8));var _0xe963=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x963e[_0xdd827a];return _0x2f46f1;};'use strict';var _=require(_0xe963('0x0'));var util=require(_0xe963('0x1'));var db=require(_0xe963('0x2'))['db'];var iftime=require(_0xe963('0x3'))['iftime'];var logger=require(_0xe963('0x4'))(_0xe963('0x5'));exports[_0xe963('0x6')]=function(_0x5643b4){var _0x58b205=this;return new Promise(function(_0x42342c,_0x5248c5){return db['Interval'][_0xe963('0x7')]({'raw':_0x5643b4['options']?_0x5643b4['options'][_0xe963('0x8')]===undefined?!![]:![]:!![],'where':_0x5643b4[_0xe963('0x9')]?_0x5643b4['options']['where']||null:null,'attributes':_0x5643b4['options']?_0x5643b4['options'][_0xe963('0xa')]||null:null,'limit':_0x5643b4[_0xe963('0x9')]?_0x5643b4[_0xe963('0x9')]['limit']||null:null,'include':_0x5643b4['options']?_0x5643b4[_0xe963('0x9')][_0xe963('0xb')]?_[_0xe963('0xc')](_0x5643b4[_0xe963('0x9')][_0xe963('0xb')],function(_0x1a66dc){return{'model':db[_0x1a66dc[_0xe963('0xd')]],'as':_0x1a66dc['as'],'attributes':_0x1a66dc['attributes'],'include':_0x1a66dc[_0xe963('0xb')]?_[_0xe963('0xc')](_0x1a66dc[_0xe963('0xb')],function(_0xe0ee98){return{'model':db[_0xe0ee98[_0xe963('0xd')]],'as':_0xe0ee98['as'],'attributes':_0xe0ee98['attributes'],'include':_0xe0ee98[_0xe963('0xb')]?_['map'](_0xe0ee98['include'],function(_0x25fb86){return{'model':db[_0x25fb86[_0xe963('0xd')]],'as':_0x25fb86['as'],'attributes':_0x25fb86[_0xe963('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe963('0xe')](function(_0x7cce04){logger['info'](_0xe963('0x6'),_0x5643b4);logger[_0xe963('0xf')](_0xe963('0x6'),_0x5643b4,JSON['stringify'](_0x7cce04));_0x42342c(_0x7cce04);})[_0xe963('0x10')](function(_0x3e3d89){logger['error'](_0xe963('0x6'),_0x3e3d89[_0xe963('0x11')],_0x5643b4);_0x5248c5(_0x58b205[_0xe963('0x12')](0x1f4,_0x3e3d89[_0xe963('0x11')]));});});};exports[_0xe963('0x13')]=function(_0x330e26){var _0x2820ce=this;return new Promise(function(_0x258e38,_0x5dcf8d){return db[_0xe963('0x14')][_0xe963('0x15')]({'raw':_0x330e26['options']?_0x330e26[_0xe963('0x9')][_0xe963('0x8')]===undefined?!![]:![]:!![],'where':_0x330e26[_0xe963('0x9')]?_0x330e26[_0xe963('0x9')]['where']||null:null,'attributes':_0x330e26[_0xe963('0x9')]?_0x330e26[_0xe963('0x9')][_0xe963('0xa')]||null:null,'include':_0x330e26['options']?_0x330e26[_0xe963('0x9')][_0xe963('0xb')]?_['map'](_0x330e26['options'][_0xe963('0xb')],function(_0x3b0338){return{'model':db[_0x3b0338['model']],'as':_0x3b0338['as'],'attributes':_0x3b0338[_0xe963('0xa')],'include':_0x3b0338[_0xe963('0xb')]?_[_0xe963('0xc')](_0x3b0338[_0xe963('0xb')],function(_0x1a3c2f){return{'model':db[_0x1a3c2f[_0xe963('0xd')]],'as':_0x1a3c2f['as'],'attributes':_0x1a3c2f[_0xe963('0xa')],'include':_0x1a3c2f['include']?_[_0xe963('0xc')](_0x1a3c2f[_0xe963('0xb')],function(_0x569a92){return{'model':db[_0x569a92[_0xe963('0xd')]],'as':_0x569a92['as'],'attributes':_0x569a92[_0xe963('0xa')]};}):[]};}):[]};}):[]:[]})[_0xe963('0xe')](function(_0x74e76b){logger['info'](_0xe963('0x13'),_0x330e26);logger[_0xe963('0xf')](_0xe963('0x13'),_0x330e26,JSON[_0xe963('0x16')](_0x74e76b));_0x258e38(_0x74e76b);})[_0xe963('0x10')](function(_0x1bed72){logger[_0xe963('0x12')](_0xe963('0x13'),_0x1bed72['message'],_0x330e26);_0x5dcf8d(_0x2820ce[_0xe963('0x12')](0x1f4,_0x1bed72[_0xe963('0x11')]));});});};function checkArrayOfIntervals(_0x2c8626,_0xe9441){var _0x39e107=[];return db['Interval'][_0xe963('0x7')]({'where':{'id':_0x2c8626}})[_0xe963('0xe')](function(_0x32d474){_0x39e107=_0x32d474;return Promise[_0xe963('0x17')](_0x39e107['map'](function(_0x4b25f9){return _0x4b25f9[_0xe963('0x18')](_0xe9441);}));})[_0xe963('0xe')](function(_0x1f0b5c){var _0x13a984=_0x1f0b5c['reduce'](function(_0x7cd005,_0x2edb14){return _0x7cd005||_0x2edb14;},![]);logger[_0xe963('0x19')](util[_0xe963('0x1a')](_0xe963('0x1b'),_0x39e107[_0xe963('0xc')](function(_0x37f116){return _0x37f116[_0xe963('0x1c')];})[_0xe963('0x1d')](',\x20'),_0x39e107[_0xe963('0xc')](function(_0x4dd462){return _0x4dd462['id'];})[_0xe963('0x1d')](',\x20')));return _0x13a984;});}function checkSingleInterval(_0x5074af,_0x5dfe07){return db['Interval'][_0xe963('0x1e')](_0x5074af)[_0xe963('0xe')](function(_0xe12b8b){if(_0xe12b8b){logger[_0xe963('0x19')](util[_0xe963('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0xe12b8b[_0xe963('0x1c')],_0xe12b8b['id']));return _0xe12b8b[_0xe963('0x18')](_0x5dfe07);}});}exports['IntervalIftime']=function(_0x286d32){var _0x43f0fa=_0x286d32[_0xe963('0x1f')];var _0x314bc0=Array['isArray'](_0x286d32[_0xe963('0x20')])?_0x286d32[_0xe963('0x20')]:typeof _0x286d32[_0xe963('0x20')]===_0xe963('0x21')?[_0x286d32[_0xe963('0x20')]]:[];var _0x16e902=_0x286d32[_0xe963('0x22')]||undefined;var _0x574a20=![];if(_0x314bc0[_0xe963('0x23')]){logger[_0xe963('0x19')](util[_0xe963('0x1a')](_0xe963('0x24'),_0x314bc0[_0xe963('0x1d')](';\x20')));}if(_0x16e902){logger[_0xe963('0x19')](util[_0xe963('0x1a')](_0xe963('0x25'),_0x16e902));}logger['debug'](_0xe963('0x26'),_0x574a20);logger[_0xe963('0x27')]('IntervalIftime',_0x286d32);return Promise[_0xe963('0x28')]()[_0xe963('0xe')](function(){if(Array[_0xe963('0x29')](_0x43f0fa)){return checkArrayOfIntervals(_0x43f0fa,_0x16e902);}else if(_0x43f0fa){return checkSingleInterval(_0x43f0fa,_0x16e902);}})['then'](function(_0x131b57){var _0x3c3d14=_0x314bc0[_0xe963('0x2a')](function(_0x303d75,_0x3efb93){return _0x303d75||iftime(_0x3efb93,_0x16e902);},![]);_0x574a20=_0x131b57||_0x3c3d14;return _0x574a20;})['catch'](function(_0x550749){logger[_0xe963('0x12')]('IntervalIftime',_0x286d32,_0x550749);throw this[_0xe963('0x12')](0x1f4,_0x550749['message']);});}; \ No newline at end of file +var _0xe1fc=['where','map','ShowInterval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','reduce','util','../../mysqldb','iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','model','then','info','GetInterval','debug','stringify','catch','error','message','find'];(function(_0x1cd34f,_0x2d2c4e){var _0x20fae3=function(_0x307e59){while(--_0x307e59){_0x1cd34f['push'](_0x1cd34f['shift']());}};_0x20fae3(++_0x2d2c4e);}(_0xe1fc,0x1e2));var _0xce1f=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xe1fc[_0x5e42a7];return _0x36d21b;};'use strict';var _=require('lodash');var util=require(_0xce1f('0x0'));var db=require(_0xce1f('0x1'))['db'];var iftime=require('../../utils/iftime')[_0xce1f('0x2')];var logger=require(_0xce1f('0x3'))(_0xce1f('0x4'));exports['GetInterval']=function(_0x448c9c){var _0x2bdceb=this;return new Promise(function(_0x5cc121,_0x69801c){return db[_0xce1f('0x5')][_0xce1f('0x6')]({'raw':_0x448c9c[_0xce1f('0x7')]?_0x448c9c[_0xce1f('0x7')][_0xce1f('0x8')]===undefined?!![]:![]:!![],'where':_0x448c9c['options']?_0x448c9c[_0xce1f('0x7')]['where']||null:null,'attributes':_0x448c9c[_0xce1f('0x7')]?_0x448c9c[_0xce1f('0x7')][_0xce1f('0x9')]||null:null,'limit':_0x448c9c[_0xce1f('0x7')]?_0x448c9c[_0xce1f('0x7')][_0xce1f('0xa')]||null:null,'include':_0x448c9c['options']?_0x448c9c[_0xce1f('0x7')][_0xce1f('0xb')]?_['map'](_0x448c9c[_0xce1f('0x7')]['include'],function(_0x31bf6f){return{'model':db[_0x31bf6f['model']],'as':_0x31bf6f['as'],'attributes':_0x31bf6f[_0xce1f('0x9')],'include':_0x31bf6f[_0xce1f('0xb')]?_['map'](_0x31bf6f[_0xce1f('0xb')],function(_0x4ef4da){return{'model':db[_0x4ef4da[_0xce1f('0xc')]],'as':_0x4ef4da['as'],'attributes':_0x4ef4da[_0xce1f('0x9')],'include':_0x4ef4da['include']?_['map'](_0x4ef4da[_0xce1f('0xb')],function(_0x3ba5e1){return{'model':db[_0x3ba5e1[_0xce1f('0xc')]],'as':_0x3ba5e1['as'],'attributes':_0x3ba5e1[_0xce1f('0x9')]};}):[]};}):[]};}):[]:[]})[_0xce1f('0xd')](function(_0x1df417){logger[_0xce1f('0xe')](_0xce1f('0xf'),_0x448c9c);logger[_0xce1f('0x10')]('GetInterval',_0x448c9c,JSON[_0xce1f('0x11')](_0x1df417));_0x5cc121(_0x1df417);})[_0xce1f('0x12')](function(_0x31066f){logger[_0xce1f('0x13')](_0xce1f('0xf'),_0x31066f[_0xce1f('0x14')],_0x448c9c);_0x69801c(_0x2bdceb[_0xce1f('0x13')](0x1f4,_0x31066f[_0xce1f('0x14')]));});});};exports['ShowInterval']=function(_0x20141b){var _0x4663fd=this;return new Promise(function(_0x2d50d9,_0x11114f){return db[_0xce1f('0x5')][_0xce1f('0x15')]({'raw':_0x20141b[_0xce1f('0x7')]?_0x20141b[_0xce1f('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x20141b['options']?_0x20141b['options'][_0xce1f('0x16')]||null:null,'attributes':_0x20141b[_0xce1f('0x7')]?_0x20141b[_0xce1f('0x7')][_0xce1f('0x9')]||null:null,'include':_0x20141b[_0xce1f('0x7')]?_0x20141b['options'][_0xce1f('0xb')]?_[_0xce1f('0x17')](_0x20141b[_0xce1f('0x7')]['include'],function(_0x12befb){return{'model':db[_0x12befb['model']],'as':_0x12befb['as'],'attributes':_0x12befb[_0xce1f('0x9')],'include':_0x12befb['include']?_[_0xce1f('0x17')](_0x12befb['include'],function(_0x33f3e5){return{'model':db[_0x33f3e5['model']],'as':_0x33f3e5['as'],'attributes':_0x33f3e5[_0xce1f('0x9')],'include':_0x33f3e5['include']?_[_0xce1f('0x17')](_0x33f3e5['include'],function(_0x53c90c){return{'model':db[_0x53c90c[_0xce1f('0xc')]],'as':_0x53c90c['as'],'attributes':_0x53c90c[_0xce1f('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x361a55){logger[_0xce1f('0xe')](_0xce1f('0x18'),_0x20141b);logger[_0xce1f('0x10')](_0xce1f('0x18'),_0x20141b,JSON['stringify'](_0x361a55));_0x2d50d9(_0x361a55);})[_0xce1f('0x12')](function(_0x4116e4){logger[_0xce1f('0x13')](_0xce1f('0x18'),_0x4116e4['message'],_0x20141b);_0x11114f(_0x4663fd[_0xce1f('0x13')](0x1f4,_0x4116e4[_0xce1f('0x14')]));});});};function checkArrayOfIntervals(_0x243b1b,_0x49412b){var _0x5dd414=[];return db['Interval']['findAll']({'where':{'id':_0x243b1b}})['then'](function(_0x205363){_0x5dd414=_0x205363;return Promise[_0xce1f('0x19')](_0x5dd414['map'](function(_0x9a1225){return _0x9a1225[_0xce1f('0x1a')](_0x49412b);}));})[_0xce1f('0xd')](function(_0x45ba7f){var _0x23402b=_0x45ba7f['reduce'](function(_0x215505,_0x2eb8cc){return _0x215505||_0x2eb8cc;},![]);logger[_0xce1f('0xe')](util[_0xce1f('0x1b')](_0xce1f('0x1c'),_0x5dd414['map'](function(_0xe9af09){return _0xe9af09['name'];})[_0xce1f('0x1d')](',\x20'),_0x5dd414['map'](function(_0x239434){return _0x239434['id'];})['join'](',\x20')));return _0x23402b;});}function checkSingleInterval(_0x4384ad,_0x3287cc){return db[_0xce1f('0x5')][_0xce1f('0x1e')](_0x4384ad)[_0xce1f('0xd')](function(_0x33cfd4){if(_0x33cfd4){logger[_0xce1f('0xe')](util[_0xce1f('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x33cfd4['name'],_0x33cfd4['id']));return _0x33cfd4['ifTime'](_0x3287cc);}});}exports['IntervalIftime']=function(_0x3e2b15){var _0x7997bf=_0x3e2b15['intervalIds'];var _0x393690=Array[_0xce1f('0x1f')](_0x3e2b15[_0xce1f('0x20')])?_0x3e2b15[_0xce1f('0x20')]:typeof _0x3e2b15[_0xce1f('0x20')]===_0xce1f('0x21')?[_0x3e2b15[_0xce1f('0x20')]]:[];var _0x47d22d=_0x3e2b15[_0xce1f('0x22')]||undefined;var _0x80aeed=![];if(_0x393690[_0xce1f('0x23')]){logger[_0xce1f('0xe')](util[_0xce1f('0x1b')](_0xce1f('0x24'),_0x393690[_0xce1f('0x1d')](';\x20')));}if(_0x47d22d){logger[_0xce1f('0xe')](util[_0xce1f('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x47d22d));}logger[_0xce1f('0x10')](_0xce1f('0x25'),_0x80aeed);logger[_0xce1f('0x26')](_0xce1f('0x27'),_0x3e2b15);return Promise[_0xce1f('0x28')]()[_0xce1f('0xd')](function(){if(Array[_0xce1f('0x1f')](_0x7997bf)){return checkArrayOfIntervals(_0x7997bf,_0x47d22d);}else if(_0x7997bf){return checkSingleInterval(_0x7997bf,_0x47d22d);}})[_0xce1f('0xd')](function(_0x4e847f){var _0x916035=_0x393690[_0xce1f('0x29')](function(_0xb1923b,_0x1d6ef1){return _0xb1923b||iftime(_0x1d6ef1,_0x47d22d);},![]);_0x80aeed=_0x4e847f||_0x916035;return _0x80aeed;})['catch'](function(_0x468ce3){logger[_0xce1f('0x13')](_0xce1f('0x27'),_0x3e2b15,_0x468ce3);throw this['error'](0x1f4,_0x468ce3[_0xce1f('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 11e8470..09d99e8 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x576fcf,_0x5a3eea){var _0x2dfbd3=function(_0x1944d4){while(--_0x1944d4){_0x576fcf['push'](_0x576fcf['shift']());}};_0x2dfbd3(++_0x5a3eea);}(_0x2032,0xd9));var _0x2203=function(_0x3f395c,_0x2dcc26){_0x3f395c=_0x3f395c-0x0;var _0xfe2611=_0x2032[_0x3f395c];return _0xfe2611;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x3896bd,_0x357e1f){var _0x301a71=function(_0x3745da){while(--_0x3745da){_0x3896bd['push'](_0x3896bd['shift']());}};_0x301a71(++_0x357e1f);}(_0x2032,0xd9));var _0x2203=function(_0x1f17e7,_0x288b09){_0x1f17e7=_0x1f17e7-0x0;var _0x5d01ff=_0x2032[_0x1f17e7];return _0x5d01ff;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3bc82ab..6a7f4e6 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 _0x73e4=['key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','newToken','customfield_11503','customfield_11504','reason','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0'];(function(_0x5005ad,_0x2246b6){var _0x4bd986=function(_0x2cab60){while(--_0x2cab60){_0x5005ad['push'](_0x5005ad['shift']());}};_0x4bd986(++_0x2246b6);}(_0x73e4,0x1bd));var _0x473e=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0x73e4[_0x3b085];return _0x476a57;};'use strict';var BPromise=require(_0x473e('0x0'));var https=require(_0x473e('0x1'));var logger=require(_0x473e('0x2'))(_0x473e('0x3'));var USERNAME='support';var PASSWORD=_0x473e('0x4');function openIssue(_0x2f4a90,_0x536e75){var _0x4a4a95={'fields':{'project':{'key':_0x2f4a90[_0x473e('0x5')]||_0x473e('0x6')},'summary':(_0x2f4a90[_0x473e('0x7')]||_0x473e('0x8'))+_0x473e('0x9')+_0x2f4a90['ip'],'description':_0x2f4a90[_0x473e('0xa')]||JSON[_0x473e('0xb')](_0x2f4a90),'issuetype':{'name':_0x2f4a90[_0x473e('0xc')]||_0x473e('0xd')}}};_0x4a4a95[_0x473e('0xe')][_0x473e('0xf')]=_0x2f4a90[_0x473e('0x10')];_0x4a4a95['fields']['customfield_11501']=_0x2f4a90['oldToken'];_0x4a4a95[_0x473e('0xe')]['customfield_11502']=_0x2f4a90[_0x473e('0x11')];_0x4a4a95[_0x473e('0xe')][_0x473e('0x12')]=_0x2f4a90['name'];_0x4a4a95[_0x473e('0xe')][_0x473e('0x13')]=_0x2f4a90[_0x473e('0x14')];_0x4a4a95[_0x473e('0xe')]['customfield_10102']=_0x2f4a90['ip'];var _0x1cf1ba={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x473e('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x473e('0x16'),'Authorization':_0x473e('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x473e('0x18')](_0x473e('0x19'))}};var _0x394d8d=JSON['stringify'](_0x4a4a95);var _0x290250=https[_0x473e('0x1a')](_0x1cf1ba,function(_0x2e8805){_0x2e8805[_0x473e('0x1b')](_0x473e('0x1c'));var _0x59e364='';_0x2e8805['on'](_0x473e('0x1d'),function(_0x90735d){_0x59e364+=_0x90735d;});_0x2e8805['on'](_0x473e('0x1e'),function(){if(_0x536e75){return _0x536e75[_0x473e('0x1f')](_0x2e8805[_0x473e('0x20')])['json'](JSON[_0x473e('0x21')](_0x59e364));}});});_0x290250['on'](_0x473e('0x22'),function(_0xc1c425){if(_0x536e75){return _0x536e75[_0x473e('0x1f')](0x1f4)[_0x473e('0x23')]({'errors':[{'message':_0x473e('0x24'),'type':_0x473e('0x25')}]});}});_0x290250['write'](_0x394d8d);_0x290250[_0x473e('0x1e')]();}exports[_0x473e('0x26')]=openIssue;exports[_0x473e('0x27')]=function(_0x3f484d,_0x95f2b0){_0x3f484d['body']['ip']=_0x3f484d['headers'][_0x473e('0x28')]||_0x3f484d[_0x473e('0x29')][_0x473e('0x2a')]||_0x3f484d[_0x473e('0x2b')][_0x473e('0x2a')]||_0x3f484d[_0x473e('0x29')]['socket'][_0x473e('0x2a')];return openIssue(_0x3f484d[_0x473e('0x2c')],_0x95f2b0);}; \ No newline at end of file +var _0x0abd=['oldToken','customfield_11502','customfield_11503','customfield_11504','reason','track.xcallymotion.com','POST','Basic\x20','base64','stringify','setEncoding','utf8','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','Report','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0abd,0x6c));var _0xd0ab=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x0abd[_0x5c768b];return _0x335af8;};'use strict';var BPromise=require(_0xd0ab('0x0'));var https=require(_0xd0ab('0x1'));var logger=require(_0xd0ab('0x2'))(_0xd0ab('0x3'));var USERNAME=_0xd0ab('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x43bf4a,_0x2abd00){var _0x597732={'fields':{'project':{'key':_0x43bf4a[_0xd0ab('0x5')]||_0xd0ab('0x6')},'summary':(_0x43bf4a[_0xd0ab('0x7')]||_0xd0ab('0x8'))+'\x20from\x20'+_0x43bf4a['ip'],'description':_0x43bf4a['description']||JSON['stringify'](_0x43bf4a),'issuetype':{'name':_0x43bf4a[_0xd0ab('0x9')]||_0xd0ab('0xa')}}};_0x597732[_0xd0ab('0xb')][_0xd0ab('0xc')]=_0x43bf4a[_0xd0ab('0xd')];_0x597732[_0xd0ab('0xb')][_0xd0ab('0xe')]=_0x43bf4a[_0xd0ab('0xf')];_0x597732[_0xd0ab('0xb')][_0xd0ab('0x10')]=_0x43bf4a['newToken'];_0x597732[_0xd0ab('0xb')][_0xd0ab('0x11')]=_0x43bf4a['name'];_0x597732['fields'][_0xd0ab('0x12')]=_0x43bf4a[_0xd0ab('0x13')];_0x597732[_0xd0ab('0xb')]['customfield_10102']=_0x43bf4a['ip'];var _0xc127c4={'host':_0xd0ab('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xd0ab('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd0ab('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd0ab('0x17'))}};var _0x52263f=JSON[_0xd0ab('0x18')](_0x597732);var _0x43e858=https['request'](_0xc127c4,function(_0x3ad858){_0x3ad858[_0xd0ab('0x19')](_0xd0ab('0x1a'));var _0x524ac3='';_0x3ad858['on']('data',function(_0x107b1d){_0x524ac3+=_0x107b1d;});_0x3ad858['on'](_0xd0ab('0x1b'),function(){if(_0x2abd00){return _0x2abd00[_0xd0ab('0x1c')](_0x3ad858[_0xd0ab('0x1d')])[_0xd0ab('0x1e')](JSON['parse'](_0x524ac3));}});});_0x43e858['on'](_0xd0ab('0x1f'),function(_0x2bffa1){if(_0x2abd00){return _0x2abd00[_0xd0ab('0x1c')](0x1f4)[_0xd0ab('0x1e')]({'errors':[{'message':_0xd0ab('0x20'),'type':'api.jira'}]});}});_0x43e858[_0xd0ab('0x21')](_0x52263f);_0x43e858[_0xd0ab('0x1b')]();}exports[_0xd0ab('0x22')]=openIssue;exports[_0xd0ab('0x23')]=function(_0x5d603f,_0x4a62e8){_0x5d603f[_0xd0ab('0x24')]['ip']=_0x5d603f['headers'][_0xd0ab('0x25')]||_0x5d603f[_0xd0ab('0x26')][_0xd0ab('0x27')]||_0x5d603f['socket'][_0xd0ab('0x27')]||_0x5d603f[_0xd0ab('0x26')][_0xd0ab('0x28')][_0xd0ab('0x27')];return openIssue(_0x5d603f[_0xd0ab('0x24')],_0x4a62e8);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a7c31c0..e7d43ba 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 _0xe14d=['isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x14a281,_0x4adfbe){var _0x4c9192=function(_0x2bae4f){while(--_0x2bae4f){_0x14a281['push'](_0x14a281['shift']());}};_0x4c9192(++_0x4adfbe);}(_0xe14d,0x1ee));var _0xde14=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xe14d[_0x166742];return _0xb7814a;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/describe',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')]('/',auth[_0xde14('0xa')](),controller['create']);router[_0xde14('0x10')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x23130e,_0x1085bb){var _0x5b995d=function(_0x247bea){while(--_0x247bea){_0x23130e['push'](_0x23130e['shift']());}};_0x5b995d(++_0x1085bb);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2d3d2a,_0x558d81){_0x2d3d2a=_0x2d3d2a-0x0;var _0x1f8193=_0x0a9a[_0x2d3d2a];return _0x1f8193;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6a2c03a..a49ec61 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(_0x4568c5,_0x33a3dc){_0x4568c5=_0x4568c5-0x0;var _0x50b698=_0x7a54[_0x4568c5];return _0x50b698;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x5433c7,_0x4f3346){_0x5433c7=_0x5433c7-0x0;var _0x14d42a=_0x7a54[_0x5433c7];return _0x14d42a;};'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 fa8f9cd..a957efb 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 _0x3bd7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv'];(function(_0x1c3c8f,_0x56b144){var _0x581a1a=function(_0x516c52){while(--_0x516c52){_0x1c3c8f['push'](_0x1c3c8f['shift']());}};_0x581a1a(++_0x56b144);}(_0x3bd7,0x199));var _0x73bd=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x3bd7[_0x149a9b];return _0x2c2bf6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];function respondWithStatusCode(_0x31c882,_0x41f324){_0x41f324=_0x41f324||0xcc;return function(_0x2a5dea){if(_0x2a5dea){return _0x31c882[_0x73bd('0x14')](_0x41f324);}return _0x31c882['status'](_0x41f324)[_0x73bd('0x15')]();};}function respondWithResult(_0x5c4bc8,_0x189007){_0x189007=_0x189007||0xc8;return function(_0x3eab86){if(_0x3eab86){return _0x5c4bc8[_0x73bd('0x16')](_0x189007)[_0x73bd('0x17')](_0x3eab86);}};}function respondWithFilteredResult(_0x3e628a,_0x5ea8db){return function(_0x41663e){if(_0x41663e){var _0xfdf66=typeof _0x5ea8db[_0x73bd('0x18')]===_0x73bd('0x19')&&typeof _0x5ea8db[_0x73bd('0x1a')]===_0x73bd('0x19');var _0x10e371=_0x41663e[_0x73bd('0x1b')];var _0x21787b=_0xfdf66?0x0:_0x5ea8db['offset'];var _0x1e559b=_0xfdf66?_0x41663e[_0x73bd('0x1b')]:_0x5ea8db[_0x73bd('0x18')]+_0x5ea8db[_0x73bd('0x1a')];var _0x1cb0e3;if(_0x1e559b>=_0x10e371){_0x1e559b=_0x10e371;_0x1cb0e3=0xc8;}else{_0x1cb0e3=0xce;}_0x3e628a[_0x73bd('0x16')](_0x1cb0e3);return _0x3e628a[_0x73bd('0x1c')](_0x73bd('0x1d'),_0x21787b+'-'+_0x1e559b+'/'+_0x10e371)[_0x73bd('0x17')](_0x41663e);}return null;};}function patchUpdates(_0x57d1ec){return function(_0x459965){try{jsonpatch[_0x73bd('0x1e')](_0x459965,_0x57d1ec,!![]);}catch(_0x292f8c){return BPromise['reject'](_0x292f8c);}return _0x459965['save']();};}function saveUpdates(_0x4f23e6,_0x10b388){return function(_0x269e84){if(_0x269e84){return _0x269e84['update'](_0x4f23e6)[_0x73bd('0x1f')](function(_0x22574c){return _0x22574c;});}return null;};}function removeEntity(_0x5b7bbb,_0x325cc1){return function(_0x1e22c5){if(_0x1e22c5){return _0x1e22c5[_0x73bd('0x20')]()[_0x73bd('0x1f')](function(){_0x5b7bbb[_0x73bd('0x16')](0xcc)[_0x73bd('0x15')]();});}};}function handleEntityNotFound(_0x2dd70b,_0x36f7e0){return function(_0x840215){if(!_0x840215){_0x2dd70b[_0x73bd('0x14')](0x194);}return _0x840215;};}function handleError(_0x473527,_0x388698){_0x388698=_0x388698||0x1f4;return function(_0x52e910){logger['error'](_0x52e910[_0x73bd('0x21')]);if(_0x52e910[_0x73bd('0x22')]){delete _0x52e910['name'];}_0x473527[_0x73bd('0x16')](_0x388698)[_0x73bd('0x23')](_0x52e910);};}exports[_0x73bd('0x24')]=function(_0x5ada8d,_0x5ae04e){var _0x2f38fe={},_0x3f15f8={},_0x315318={'count':0x0,'rows':[]};var _0x5be8d6=_[_0x73bd('0x25')](db['JscriptyAnswerReport'][_0x73bd('0x26')],function(_0x2701da){return{'name':_0x2701da['fieldName'],'type':_0x2701da['type'][_0x73bd('0x27')]};});_0x3f15f8[_0x73bd('0x28')]=_[_0x73bd('0x25')](_0x5be8d6,_0x73bd('0x22'));_0x3f15f8['query']=_[_0x73bd('0x29')](_0x5ada8d['query']);_0x3f15f8[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],_0x3f15f8[_0x73bd('0x2c')]);_0x2f38fe['attributes']=_[_0x73bd('0x2b')](_0x3f15f8[_0x73bd('0x28')],qs[_0x73bd('0x2d')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x2f38fe[_0x73bd('0x2e')]=_0x2f38fe[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x2f38fe['attributes']:_0x3f15f8[_0x73bd('0x28')];if(!_0x5ada8d[_0x73bd('0x2c')]['hasOwnProperty'](_0x73bd('0x30'))){_0x2f38fe[_0x73bd('0x1a')]=qs['limit'](_0x5ada8d[_0x73bd('0x2c')]['limit']);_0x2f38fe[_0x73bd('0x18')]=qs['offset'](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x18')]);}_0x2f38fe[_0x73bd('0x31')]=qs[_0x73bd('0x32')](_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x32')]);_0x2f38fe[_0x73bd('0x33')]=qs['filters'](_[_0x73bd('0x34')](_0x5ada8d[_0x73bd('0x2c')],_0x3f15f8['filters']),_0x5be8d6);if(_0x5ada8d[_0x73bd('0x2c')]['filter']){_0x2f38fe[_0x73bd('0x33')]=_[_0x73bd('0x35')](_0x2f38fe[_0x73bd('0x33')],{'$or':_[_0x73bd('0x25')](_0x5be8d6,function(_0x367597){if(_0x367597['type']!==_0x73bd('0x36')){var _0x2de851={};_0x2de851[_0x367597[_0x73bd('0x22')]]={'$like':'%'+_0x5ada8d['query'][_0x73bd('0x37')]+'%'};return _0x2de851;}})});}_0x2f38fe=_[_0x73bd('0x35')]({},_0x2f38fe,_0x5ada8d[_0x73bd('0x38')]);var _0x30e148={'where':_0x2f38fe[_0x73bd('0x33')]};return db[_0x73bd('0x39')][_0x73bd('0x1b')](_0x30e148)[_0x73bd('0x1f')](function(_0x519c3c){_0x315318[_0x73bd('0x1b')]=_0x519c3c;if(_0x5ada8d[_0x73bd('0x2c')][_0x73bd('0x3a')]){_0x2f38fe[_0x73bd('0x3b')]=[{'all':!![]}];}return db[_0x73bd('0x39')][_0x73bd('0x3c')](_0x2f38fe);})[_0x73bd('0x1f')](function(_0x48fed7){_0x315318[_0x73bd('0x3d')]=_0x48fed7;return _0x315318;})[_0x73bd('0x1f')](respondWithFilteredResult(_0x5ae04e,_0x2f38fe))[_0x73bd('0x3e')](handleError(_0x5ae04e,null));};exports[_0x73bd('0x3f')]=function(_0x532afd,_0x142532){var _0x234de7={'raw':!![],'where':{'id':_0x532afd[_0x73bd('0x40')]['id']}},_0xe91596={};_0xe91596[_0x73bd('0x28')]=_['keys'](db[_0x73bd('0x39')]['rawAttributes']);_0xe91596[_0x73bd('0x2c')]=_['keys'](_0x532afd[_0x73bd('0x2c')]);_0xe91596[_0x73bd('0x2a')]=_['intersection'](_0xe91596[_0x73bd('0x28')],_0xe91596[_0x73bd('0x2c')]);_0x234de7[_0x73bd('0x2e')]=_[_0x73bd('0x2b')](_0xe91596[_0x73bd('0x28')],qs['fields'](_0x532afd[_0x73bd('0x2c')][_0x73bd('0x2d')]));_0x234de7[_0x73bd('0x2e')]=_0x234de7[_0x73bd('0x2e')][_0x73bd('0x2f')]?_0x234de7[_0x73bd('0x2e')]:_0xe91596[_0x73bd('0x28')];if(_0x532afd[_0x73bd('0x2c')]['includeAll']){_0x234de7['include']=[{'all':!![]}];}_0x234de7=_[_0x73bd('0x35')]({},_0x234de7,_0x532afd[_0x73bd('0x38')]);return db[_0x73bd('0x39')]['find'](_0x234de7)[_0x73bd('0x1f')](handleEntityNotFound(_0x142532,null))['then'](respondWithResult(_0x142532,null))[_0x73bd('0x3e')](handleError(_0x142532,null));};exports[_0x73bd('0x41')]=function(_0x57df9e,_0x4905a4){return db['JscriptyAnswerReport'][_0x73bd('0x41')](_0x57df9e['body'],{})[_0x73bd('0x1f')](respondWithResult(_0x4905a4,0xc9))['catch'](handleError(_0x4905a4,null));};exports[_0x73bd('0x42')]=function(_0x1e2e28,_0x7b4baf){if(_0x1e2e28[_0x73bd('0x43')]['id']){delete _0x1e2e28['body']['id'];}return db[_0x73bd('0x39')][_0x73bd('0x44')]({'where':{'id':_0x1e2e28[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x7b4baf,null))[_0x73bd('0x1f')](saveUpdates(_0x1e2e28[_0x73bd('0x43')],null))[_0x73bd('0x1f')](respondWithResult(_0x7b4baf,null))[_0x73bd('0x3e')](handleError(_0x7b4baf,null));};exports['destroy']=function(_0x8b88f5,_0x47397d){return db['JscriptyAnswerReport'][_0x73bd('0x44')]({'where':{'id':_0x8b88f5[_0x73bd('0x40')]['id']}})[_0x73bd('0x1f')](handleEntityNotFound(_0x47397d,null))['then'](removeEntity(_0x47397d,null))[_0x73bd('0x3e')](handleError(_0x47397d,null));};exports[_0x73bd('0x45')]=function(_0x23b5ad,_0x2201c7){return db[_0x73bd('0x39')]['describe']()['then'](respondWithResult(_0x2201c7,null))['catch'](handleError(_0x2201c7,null));}; \ No newline at end of file +var _0x27a0=['../../config/license/util','../../mysqldb','status','end','offset','count','Content-Range','reject','save','update','then','destroy','error','name','index','JscriptyAnswerReport','fieldName','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x27a0,0xbf));var _0x027a=function(_0x5d6c19,_0x1b8281){_0x5d6c19=_0x5d6c19-0x0;var _0x43d8a4=_0x27a0[_0x5d6c19];return _0x43d8a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x027a('0x0'));var zipdir=require(_0x027a('0x1'));var jsonpatch=require(_0x027a('0x2'));var rp=require(_0x027a('0x3'));var moment=require(_0x027a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x027a('0x5'));var csv=require(_0x027a('0x6'));var ejs=require(_0x027a('0x7'));var fs=require('fs');var fs_extra=require(_0x027a('0x8'));var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x6'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var licenseUtil=require(_0x027a('0x16'));var db=require(_0x027a('0x17'))['db'];function respondWithStatusCode(_0x351d7e,_0x3e0c1e){_0x3e0c1e=_0x3e0c1e||0xcc;return function(_0x96a5c3){if(_0x96a5c3){return _0x351d7e['sendStatus'](_0x3e0c1e);}return _0x351d7e[_0x027a('0x18')](_0x3e0c1e)[_0x027a('0x19')]();};}function respondWithResult(_0x2d27f8,_0x21da53){_0x21da53=_0x21da53||0xc8;return function(_0x40fec0){if(_0x40fec0){return _0x2d27f8['status'](_0x21da53)['json'](_0x40fec0);}};}function respondWithFilteredResult(_0x1d680d,_0x5cfc6d){return function(_0x2b3870){if(_0x2b3870){var _0x559d13=typeof _0x5cfc6d[_0x027a('0x1a')]==='undefined'&&typeof _0x5cfc6d['limit']==='undefined';var _0x588f53=_0x2b3870[_0x027a('0x1b')];var _0x826d19=_0x559d13?0x0:_0x5cfc6d[_0x027a('0x1a')];var _0x52125e=_0x559d13?_0x2b3870[_0x027a('0x1b')]:_0x5cfc6d[_0x027a('0x1a')]+_0x5cfc6d['limit'];var _0x4f8c3d;if(_0x52125e>=_0x588f53){_0x52125e=_0x588f53;_0x4f8c3d=0xc8;}else{_0x4f8c3d=0xce;}_0x1d680d[_0x027a('0x18')](_0x4f8c3d);return _0x1d680d['set'](_0x027a('0x1c'),_0x826d19+'-'+_0x52125e+'/'+_0x588f53)['json'](_0x2b3870);}return null;};}function patchUpdates(_0x59511c){return function(_0x58b129){try{jsonpatch['apply'](_0x58b129,_0x59511c,!![]);}catch(_0x18efe7){return BPromise[_0x027a('0x1d')](_0x18efe7);}return _0x58b129[_0x027a('0x1e')]();};}function saveUpdates(_0xdf8756,_0x51b870){return function(_0x2fb1d0){if(_0x2fb1d0){return _0x2fb1d0[_0x027a('0x1f')](_0xdf8756)[_0x027a('0x20')](function(_0x3dee99){return _0x3dee99;});}return null;};}function removeEntity(_0x178ed8,_0x3bbd46){return function(_0x595f0e){if(_0x595f0e){return _0x595f0e[_0x027a('0x21')]()['then'](function(){_0x178ed8[_0x027a('0x18')](0xcc)[_0x027a('0x19')]();});}};}function handleEntityNotFound(_0x1b1a13,_0x83fe3e){return function(_0x582943){if(!_0x582943){_0x1b1a13['sendStatus'](0x194);}return _0x582943;};}function handleError(_0x18458f,_0xcc7562){_0xcc7562=_0xcc7562||0x1f4;return function(_0x338141){logger[_0x027a('0x22')](_0x338141['stack']);if(_0x338141[_0x027a('0x23')]){delete _0x338141['name'];}_0x18458f[_0x027a('0x18')](_0xcc7562)['send'](_0x338141);};}exports[_0x027a('0x24')]=function(_0x4d5a25,_0x578ea5){var _0x31385d={},_0x5782ac={},_0x47a365={'count':0x0,'rows':[]};var _0x448ba0=_['map'](db[_0x027a('0x25')]['rawAttributes'],function(_0x2640d8){return{'name':_0x2640d8[_0x027a('0x26')],'type':_0x2640d8['type'][_0x027a('0x27')]};});_0x5782ac['model']=_[_0x027a('0x28')](_0x448ba0,_0x027a('0x23'));_0x5782ac[_0x027a('0x29')]=_[_0x027a('0x2a')](_0x4d5a25[_0x027a('0x29')]);_0x5782ac[_0x027a('0x2b')]=_['intersection'](_0x5782ac[_0x027a('0x2c')],_0x5782ac['query']);_0x31385d[_0x027a('0x2d')]=_['intersection'](_0x5782ac[_0x027a('0x2c')],qs[_0x027a('0x2e')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x2e')]));_0x31385d[_0x027a('0x2d')]=_0x31385d['attributes'][_0x027a('0x2f')]?_0x31385d[_0x027a('0x2d')]:_0x5782ac[_0x027a('0x2c')];if(!_0x4d5a25[_0x027a('0x29')][_0x027a('0x30')](_0x027a('0x31'))){_0x31385d[_0x027a('0x32')]=qs[_0x027a('0x32')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x32')]);_0x31385d[_0x027a('0x1a')]=qs['offset'](_0x4d5a25[_0x027a('0x29')][_0x027a('0x1a')]);}_0x31385d[_0x027a('0x33')]=qs[_0x027a('0x34')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x34')]);_0x31385d[_0x027a('0x35')]=qs['filters'](_[_0x027a('0x36')](_0x4d5a25[_0x027a('0x29')],_0x5782ac[_0x027a('0x2b')]),_0x448ba0);if(_0x4d5a25['query'][_0x027a('0x37')]){_0x31385d['where']=_[_0x027a('0x38')](_0x31385d[_0x027a('0x35')],{'$or':_[_0x027a('0x28')](_0x448ba0,function(_0x5a7650){if(_0x5a7650['type']!==_0x027a('0x39')){var _0x2eea3b={};_0x2eea3b[_0x5a7650['name']]={'$like':'%'+_0x4d5a25[_0x027a('0x29')][_0x027a('0x37')]+'%'};return _0x2eea3b;}})});}_0x31385d=_[_0x027a('0x38')]({},_0x31385d,_0x4d5a25[_0x027a('0x3a')]);var _0x30e5b2={'where':_0x31385d[_0x027a('0x35')]};return db[_0x027a('0x25')][_0x027a('0x1b')](_0x30e5b2)[_0x027a('0x20')](function(_0x37a0c7){_0x47a365[_0x027a('0x1b')]=_0x37a0c7;if(_0x4d5a25[_0x027a('0x29')][_0x027a('0x3b')]){_0x31385d[_0x027a('0x3c')]=[{'all':!![]}];}return db[_0x027a('0x25')][_0x027a('0x3d')](_0x31385d);})[_0x027a('0x20')](function(_0x5a3dee){_0x47a365[_0x027a('0x3e')]=_0x5a3dee;return _0x47a365;})[_0x027a('0x20')](respondWithFilteredResult(_0x578ea5,_0x31385d))[_0x027a('0x3f')](handleError(_0x578ea5,null));};exports[_0x027a('0x40')]=function(_0x17abbe,_0x24d370){var _0x4c8110={'raw':!![],'where':{'id':_0x17abbe[_0x027a('0x41')]['id']}},_0x96d3aa={};_0x96d3aa['model']=_[_0x027a('0x2a')](db['JscriptyAnswerReport']['rawAttributes']);_0x96d3aa[_0x027a('0x29')]=_['keys'](_0x17abbe[_0x027a('0x29')]);_0x96d3aa[_0x027a('0x2b')]=_[_0x027a('0x42')](_0x96d3aa[_0x027a('0x2c')],_0x96d3aa[_0x027a('0x29')]);_0x4c8110['attributes']=_[_0x027a('0x42')](_0x96d3aa[_0x027a('0x2c')],qs[_0x027a('0x2e')](_0x17abbe['query']['fields']));_0x4c8110['attributes']=_0x4c8110['attributes'][_0x027a('0x2f')]?_0x4c8110[_0x027a('0x2d')]:_0x96d3aa[_0x027a('0x2c')];if(_0x17abbe[_0x027a('0x29')][_0x027a('0x3b')]){_0x4c8110[_0x027a('0x3c')]=[{'all':!![]}];}_0x4c8110=_['merge']({},_0x4c8110,_0x17abbe['options']);return db[_0x027a('0x25')][_0x027a('0x43')](_0x4c8110)[_0x027a('0x20')](handleEntityNotFound(_0x24d370,null))[_0x027a('0x20')](respondWithResult(_0x24d370,null))[_0x027a('0x3f')](handleError(_0x24d370,null));};exports[_0x027a('0x44')]=function(_0x235a38,_0x1bddc1){return db[_0x027a('0x25')]['create'](_0x235a38[_0x027a('0x45')],{})[_0x027a('0x20')](respondWithResult(_0x1bddc1,0xc9))[_0x027a('0x3f')](handleError(_0x1bddc1,null));};exports[_0x027a('0x1f')]=function(_0xa3a68d,_0x21c6f4){if(_0xa3a68d[_0x027a('0x45')]['id']){delete _0xa3a68d[_0x027a('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x027a('0x43')]({'where':{'id':_0xa3a68d[_0x027a('0x41')]['id']}})['then'](handleEntityNotFound(_0x21c6f4,null))[_0x027a('0x20')](saveUpdates(_0xa3a68d[_0x027a('0x45')],null))['then'](respondWithResult(_0x21c6f4,null))['catch'](handleError(_0x21c6f4,null));};exports['destroy']=function(_0x37048b,_0x5bdd44){return db[_0x027a('0x25')]['find']({'where':{'id':_0x37048b['params']['id']}})['then'](handleEntityNotFound(_0x5bdd44,null))['then'](removeEntity(_0x5bdd44,null))[_0x027a('0x3f')](handleError(_0x5bdd44,null));};exports[_0x027a('0x46')]=function(_0x53e1d8,_0x4a188b){return db[_0x027a('0x25')][_0x027a('0x46')]()[_0x027a('0x20')](respondWithResult(_0x4a188b,null))[_0x027a('0x3f')](handleError(_0x4a188b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5eac26f..533e72b 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 _0x2359=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x46d031,_0x5002fa){var _0x5262e2=function(_0x384c2a){while(--_0x384c2a){_0x46d031['push'](_0x46d031['shift']());}};_0x5262e2(++_0x5002fa);}(_0x2359,0x17e));var _0x9235=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2359[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x9235('0x0'));var util=require(_0x9235('0x1'));var logger=require(_0x9235('0x2'))(_0x9235('0x3'));var moment=require('moment');var BPromise=require(_0x9235('0x4'));var rp=require(_0x9235('0x5'));var fs=require('fs');var path=require(_0x9235('0x6'));var rimraf=require(_0x9235('0x7'));var config=require(_0x9235('0x8'));var attributes=require(_0x9235('0x9'));module[_0x9235('0xa')]=function(_0x5c38a3,_0x7fbf34){return _0x5c38a3['define'](_0x9235('0xb'),attributes,{'tableName':_0x9235('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3153=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','bluebird'];(function(_0x1e90cb,_0x20466e){var _0x23d611=function(_0x3cdb2d){while(--_0x3cdb2d){_0x1e90cb['push'](_0x1e90cb['shift']());}};_0x23d611(++_0x20466e);}(_0x3153,0xbc));var _0x3315=function(_0x5b13d3,_0x2920c4){_0x5b13d3=_0x5b13d3-0x0;var _0x2fe280=_0x3153[_0x5b13d3];return _0x2fe280;};'use strict';var _=require(_0x3315('0x0'));var util=require('util');var logger=require(_0x3315('0x1'))(_0x3315('0x2'));var moment=require('moment');var BPromise=require(_0x3315('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3315('0x4'));var rimraf=require(_0x3315('0x5'));var config=require(_0x3315('0x6'));var attributes=require(_0x3315('0x7'));module[_0x3315('0x8')]=function(_0x163fbf,_0x2a33d4){return _0x163fbf[_0x3315('0x9')](_0x3315('0xa'),attributes,{'tableName':_0x3315('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 89ab96a..d2b3c18 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 _0x5653=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x7ed191,_0x396eca){var _0x4e2be3=function(_0x833464){while(--_0x833464){_0x7ed191['push'](_0x7ed191['shift']());}};_0x4e2be3(++_0x396eca);}(_0x5653,0xe1));var _0x3565=function(_0x339bf1,_0x59cea5){_0x339bf1=_0x339bf1-0x0;var _0x40c07a=_0x5653[_0x339bf1];return _0x40c07a;};'use strict';var _=require(_0x3565('0x0'));var util=require(_0x3565('0x1'));var moment=require('moment');var BPromise=require(_0x3565('0x2'));var rs=require(_0x3565('0x3'));var fs=require('fs');var Redis=require(_0x3565('0x4'));var db=require(_0x3565('0x5'))['db'];var utils=require(_0x3565('0x6'));var logger=require(_0x3565('0x7'))(_0x3565('0x8'));var config=require(_0x3565('0x9'));var jayson=require(_0x3565('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x71db53,_0x1075f9,_0x30eec8){return new BPromise(function(_0x3d052e,_0x5ece2a){return client[_0x3565('0xb')](_0x71db53,_0x30eec8)['then'](function(_0x32a40d){logger[_0x3565('0xc')](_0x3565('0xd'),_0x1075f9,_0x3565('0xe'));logger[_0x3565('0xf')](_0x3565('0x10'),_0x1075f9,_0x3565('0xe'),JSON[_0x3565('0x11')](_0x32a40d));if(_0x32a40d['error']){if(_0x32a40d[_0x3565('0x12')][_0x3565('0x13')]===0x1f4){logger['error'](_0x3565('0xd'),_0x1075f9,_0x32a40d[_0x3565('0x12')][_0x3565('0x14')]);return _0x5ece2a(_0x32a40d[_0x3565('0x12')][_0x3565('0x14')]);}logger['error'](_0x3565('0xd'),_0x1075f9,_0x32a40d[_0x3565('0x12')][_0x3565('0x14')]);return _0x3d052e(_0x32a40d[_0x3565('0x12')][_0x3565('0x14')]);}else{logger[_0x3565('0xc')](_0x3565('0xd'),_0x1075f9,_0x3565('0xe'));_0x3d052e(_0x32a40d[_0x3565('0x15')][_0x3565('0x14')]);}})[_0x3565('0x16')](function(_0x1ece70){logger[_0x3565('0x12')](_0x3565('0xd'),_0x1075f9,_0x1ece70);_0x5ece2a(_0x1ece70);});});} \ No newline at end of file +var _0x9d5c=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x67a2fc,_0x39080c){var _0x41eeb9=function(_0x17557b){while(--_0x17557b){_0x67a2fc['push'](_0x67a2fc['shift']());}};_0x41eeb9(++_0x39080c);}(_0x9d5c,0x1c4));var _0xc9d5=function(_0x4cd7a2,_0x204b20){_0x4cd7a2=_0x4cd7a2-0x0;var _0x57e6c1=_0x9d5c[_0x4cd7a2];return _0x57e6c1;};'use strict';var _=require('lodash');var util=require(_0xc9d5('0x0'));var moment=require('moment');var BPromise=require(_0xc9d5('0x1'));var rs=require(_0xc9d5('0x2'));var fs=require('fs');var Redis=require(_0xc9d5('0x3'));var db=require(_0xc9d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9d5('0x5'))(_0xc9d5('0x6'));var config=require(_0xc9d5('0x7'));var jayson=require(_0xc9d5('0x8'));var client=jayson[_0xc9d5('0x9')][_0xc9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fea19,_0x3d4539,_0x252d8b){return new BPromise(function(_0x842eae,_0x3feec3){return client[_0xc9d5('0xb')](_0x4fea19,_0x252d8b)[_0xc9d5('0xc')](function(_0xc59a28){logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x3d4539,'request\x20sent');logger[_0xc9d5('0xf')](_0xc9d5('0x10'),_0x3d4539,_0xc9d5('0x11'),JSON['stringify'](_0xc59a28));if(_0xc59a28[_0xc9d5('0x12')]){if(_0xc59a28[_0xc9d5('0x12')][_0xc9d5('0x13')]===0x1f4){logger[_0xc9d5('0x12')](_0xc9d5('0xe'),_0x3d4539,_0xc59a28[_0xc9d5('0x12')]['message']);return _0x3feec3(_0xc59a28[_0xc9d5('0x12')][_0xc9d5('0x14')]);}logger[_0xc9d5('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3d4539,_0xc59a28[_0xc9d5('0x12')]['message']);return _0x842eae(_0xc59a28[_0xc9d5('0x12')]['message']);}else{logger[_0xc9d5('0xd')](_0xc9d5('0xe'),_0x3d4539,_0xc9d5('0x11'));_0x842eae(_0xc59a28['result'][_0xc9d5('0x14')]);}})['catch'](function(_0x267aa7){logger[_0xc9d5('0x12')](_0xc9d5('0xe'),_0x3d4539,_0x267aa7);_0x3feec3(_0x267aa7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index fd6c1fe..5ae9284 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 _0x387d=['/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x387d,0x1e8));var _0xd387=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x387d[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0xd387('0x0'));var util=require('util');var path=require(_0xd387('0x1'));var timeout=require(_0xd387('0x2'));var express=require(_0xd387('0x3'));var router=express[_0xd387('0x4')]();var fs_extra=require(_0xd387('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd387('0x6'));var config=require(_0xd387('0x7'));var controller=require('./jscriptyProject.controller');router[_0xd387('0x8')]('/',auth[_0xd387('0x9')](),controller['index']);router[_0xd387('0x8')](_0xd387('0xa'),auth[_0xd387('0x9')](),controller[_0xd387('0xb')]);router[_0xd387('0x8')]('/:id/sessions',auth[_0xd387('0x9')](),controller['getSessions']);router[_0xd387('0x8')](_0xd387('0xc'),auth[_0xd387('0x9')](),controller[_0xd387('0xd')]);router[_0xd387('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xd387('0xe')),controller[_0xd387('0xf')]);router[_0xd387('0x10')]('/',auth[_0xd387('0x9')](),controller[_0xd387('0x11')]);router[_0xd387('0x10')](_0xd387('0x12'),auth[_0xd387('0x9')](),controller[_0xd387('0x13')]);router['put']('/:id',auth[_0xd387('0x9')](),controller['update']);router['delete'](_0xd387('0xa'),auth[_0xd387('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6896=['../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','/:id/clone','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x6896,0x116));var _0x6689=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6896[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x6689('0x0'));var util=require(_0x6689('0x1'));var path=require(_0x6689('0x2'));var timeout=require(_0x6689('0x3'));var express=require(_0x6689('0x4'));var router=express[_0x6689('0x5')]();var fs_extra=require(_0x6689('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6689('0x7'));var config=require(_0x6689('0x8'));var controller=require(_0x6689('0x9'));router[_0x6689('0xa')]('/',auth[_0x6689('0xb')](),controller[_0x6689('0xc')]);router[_0x6689('0xa')]('/:id',auth[_0x6689('0xb')](),controller[_0x6689('0xd')]);router[_0x6689('0xa')](_0x6689('0xe'),auth['isAuthenticated'](),controller['getSessions']);router[_0x6689('0xa')](_0x6689('0xf'),auth[_0x6689('0xb')](),controller[_0x6689('0x10')]);router[_0x6689('0xa')](_0x6689('0x11'),auth[_0x6689('0xb')](),timeout('30s'),controller[_0x6689('0x12')]);router['post']('/',auth[_0x6689('0xb')](),controller[_0x6689('0x13')]);router[_0x6689('0x14')](_0x6689('0x15'),auth[_0x6689('0xb')](),controller['clone']);router[_0x6689('0x16')](_0x6689('0x17'),auth['isAuthenticated'](),controller[_0x6689('0x18')]);router['delete'](_0x6689('0x17'),auth[_0x6689('0xb')](),controller[_0x6689('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 358f8d1..c0ca088 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 _0xc141=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','BOOLEAN','sequelize','lodash','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0xf2b63b,_0x228b1c){var _0x45f36e=function(_0x8ebc1d){while(--_0x8ebc1d){_0xf2b63b['push'](_0xf2b63b['shift']());}};_0x45f36e(++_0x228b1c);}(_0xc141,0x1f0));var _0x1c14=function(_0x406bad,_0x1e4f1a){_0x406bad=_0x406bad-0x0;var _0x37c562=_0xc141[_0x406bad];return _0x37c562;};'use strict';var Sequelize=require(_0x1c14('0x0'));var _=require(_0x1c14('0x1'));var util=require('util');module[_0x1c14('0x2')]={'name':{'type':Sequelize[_0x1c14('0x3')],'unique':_0x1c14('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x1c14('0x5')),'set':function(_0x38ddbb){if(_[_0x1c14('0x6')](_0x38ddbb)){this[_0x1c14('0x7')](_0x1c14('0x8'),JSON[_0x1c14('0x9')](_0x38ddbb));}else if(_[_0x1c14('0xa')](_0x38ddbb)){this['setDataValue'](_0x1c14('0x8'),_0x38ddbb);}else{this[_0x1c14('0x7')](_0x1c14('0x8'),util['format'](_0x1c14('0xb'),this['getDataValue'](_0x1c14('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1c14('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0f82=['isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','setDataValue','formData'];(function(_0x1a6fe3,_0xabb267){var _0x36e566=function(_0x11e150){while(--_0x11e150){_0x1a6fe3['push'](_0x1a6fe3['shift']());}};_0x36e566(++_0xabb267);}(_0x0f82,0x163));var _0x20f8=function(_0xc61ea8,_0x56e451){_0xc61ea8=_0xc61ea8-0x0;var _0x22c845=_0x0f82[_0xc61ea8];return _0x22c845;};'use strict';var Sequelize=require(_0x20f8('0x0'));var _=require(_0x20f8('0x1'));var util=require('util');module[_0x20f8('0x2')]={'name':{'type':Sequelize[_0x20f8('0x3')],'unique':_0x20f8('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x20f8('0x5')](_0x20f8('0x6')),'set':function(_0x5b6402){if(_['isObjectLike'](_0x5b6402)){this[_0x20f8('0x7')](_0x20f8('0x8'),JSON['stringify'](_0x5b6402));}else if(_[_0x20f8('0x9')](_0x5b6402)){this['setDataValue'](_0x20f8('0x8'),_0x5b6402);}else{this[_0x20f8('0x7')](_0x20f8('0x8'),util[_0x20f8('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x20f8('0xb')](_0x20f8('0x4'))||'',this[_0x20f8('0xb')](_0x20f8('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x20f8('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x20f8('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 6d476e0..aa741a2 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 _0x1b2a=['updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Projects','UserProfileResource','stack','name','JscriptyProject','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x25e49d,_0x53a9c7){_0x25e49d=_0x25e49d-0x0;var _0x682bd1=_0x1b2a[_0x25e49d];return _0x682bd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1b2('0x1'));var rp=require(_0xa1b2('0x2'));var moment=require(_0xa1b2('0x3'));var BPromise=require(_0xa1b2('0x4'));var Mustache=require(_0xa1b2('0x5'));var util=require(_0xa1b2('0x6'));var path=require(_0xa1b2('0x7'));var sox=require(_0xa1b2('0x8'));var csv=require('to-csv');var ejs=require(_0xa1b2('0x9'));var fs=require('fs');var fs_extra=require(_0xa1b2('0xa'));var _=require(_0xa1b2('0xb'));var squel=require('squel');var crypto=require(_0xa1b2('0xc'));var jsforce=require(_0xa1b2('0xd'));var deskjs=require(_0xa1b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1b2('0xf'));var Papa=require(_0xa1b2('0x10'));var Redis=require(_0xa1b2('0x11'));var authService=require(_0xa1b2('0x12'));var qs=require(_0xa1b2('0x13'));var as=require(_0xa1b2('0x14'));var hardwareService=require(_0xa1b2('0x15'));var logger=require(_0xa1b2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa1b2('0x17'));var licenseUtil=require(_0xa1b2('0x18'));var db=require(_0xa1b2('0x19'))['db'];function respondWithStatusCode(_0x2b598a,_0x418a7e){_0x418a7e=_0x418a7e||0xcc;return function(_0x571dff){if(_0x571dff){return _0x2b598a[_0xa1b2('0x1a')](_0x418a7e);}return _0x2b598a[_0xa1b2('0x1b')](_0x418a7e)[_0xa1b2('0x1c')]();};}function respondWithResult(_0x3f9519,_0xa4ceaa){_0xa4ceaa=_0xa4ceaa||0xc8;return function(_0x1bf506){if(_0x1bf506){return _0x3f9519['status'](_0xa4ceaa)[_0xa1b2('0x1d')](_0x1bf506);}};}function respondWithFilteredResult(_0x319829,_0x5c6a9e){return function(_0x375ba3){if(_0x375ba3){var _0x2f9a51=typeof _0x5c6a9e[_0xa1b2('0x1e')]===_0xa1b2('0x1f')&&typeof _0x5c6a9e[_0xa1b2('0x20')]===_0xa1b2('0x1f');var _0x5568d1=_0x375ba3['count'];var _0x550eb0=_0x2f9a51?0x0:_0x5c6a9e[_0xa1b2('0x1e')];var _0x1b7831=_0x2f9a51?_0x375ba3[_0xa1b2('0x21')]:_0x5c6a9e[_0xa1b2('0x1e')]+_0x5c6a9e[_0xa1b2('0x20')];var _0x166a52;if(_0x1b7831>=_0x5568d1){_0x1b7831=_0x5568d1;_0x166a52=0xc8;}else{_0x166a52=0xce;}_0x319829[_0xa1b2('0x1b')](_0x166a52);return _0x319829[_0xa1b2('0x22')](_0xa1b2('0x23'),_0x550eb0+'-'+_0x1b7831+'/'+_0x5568d1)[_0xa1b2('0x1d')](_0x375ba3);}return null;};}function patchUpdates(_0xafc9b9){return function(_0x2fd676){try{jsonpatch['apply'](_0x2fd676,_0xafc9b9,!![]);}catch(_0x344d7b){return BPromise[_0xa1b2('0x24')](_0x344d7b);}return _0x2fd676['save']();};}function saveUpdates(_0x3afd94,_0x47bdfd){return function(_0x26c9a4){if(_0x26c9a4){return _0x26c9a4[_0xa1b2('0x25')](_0x3afd94)['then'](function(_0x4fb5bb){return _0x4fb5bb;});}return null;};}function removeEntity(_0x257d88,_0x43bfba){return function(_0x8e95ea){if(_0x8e95ea){return _0x8e95ea['destroy']()[_0xa1b2('0x26')](function(){var _0x44239a=_0x8e95ea[_0xa1b2('0x27')]({'plain':!![]});var _0x59aff4=_0xa1b2('0x28');return db[_0xa1b2('0x29')]['destroy']({'where':{'type':_0x59aff4,'resourceId':_0x44239a['id']}})['then'](function(){return _0x8e95ea;});})[_0xa1b2('0x26')](function(){_0x257d88[_0xa1b2('0x1b')](0xcc)[_0xa1b2('0x1c')]();});}};}function handleEntityNotFound(_0x243909,_0x570632){return function(_0xd52b2c){if(!_0xd52b2c){_0x243909['sendStatus'](0x194);}return _0xd52b2c;};}function handleError(_0xca8c77,_0x113dad){_0x113dad=_0x113dad||0x1f4;return function(_0x59ead3){logger['error'](_0x59ead3[_0xa1b2('0x2a')]);if(_0x59ead3[_0xa1b2('0x2b')]){delete _0x59ead3[_0xa1b2('0x2b')];}_0xca8c77[_0xa1b2('0x1b')](_0x113dad)['send'](_0x59ead3);};}exports['index']=function(_0x5addde,_0x3aff6){var _0x45c0a3={},_0x142376={},_0x2ec977={'count':0x0,'rows':[]};var _0x4eb584=_['map'](db[_0xa1b2('0x2c')][_0xa1b2('0x2d')],function(_0x5499e7){return{'name':_0x5499e7[_0xa1b2('0x2e')],'type':_0x5499e7[_0xa1b2('0x2f')]['key']};});_0x142376[_0xa1b2('0x30')]=_[_0xa1b2('0x31')](_0x4eb584,_0xa1b2('0x2b'));_0x142376[_0xa1b2('0x32')]=_[_0xa1b2('0x33')](_0x5addde[_0xa1b2('0x32')]);_0x142376[_0xa1b2('0x34')]=_[_0xa1b2('0x35')](_0x142376[_0xa1b2('0x30')],_0x142376[_0xa1b2('0x32')]);_0x45c0a3[_0xa1b2('0x36')]=_['intersection'](_0x142376[_0xa1b2('0x30')],qs[_0xa1b2('0x37')](_0x5addde['query'][_0xa1b2('0x37')]));_0x45c0a3[_0xa1b2('0x36')]=_0x45c0a3['attributes'][_0xa1b2('0x38')]?_0x45c0a3[_0xa1b2('0x36')]:_0x142376[_0xa1b2('0x30')];if(!_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x39')]('nolimit')){_0x45c0a3[_0xa1b2('0x20')]=qs[_0xa1b2('0x20')](_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x20')]);_0x45c0a3[_0xa1b2('0x1e')]=qs['offset'](_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x1e')]);}_0x45c0a3[_0xa1b2('0x3a')]=qs[_0xa1b2('0x3b')](_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x3b')]);_0x45c0a3[_0xa1b2('0x3c')]=qs['filters'](_[_0xa1b2('0x3d')](_0x5addde['query'],_0x142376['filters']),_0x4eb584);if(_0x5addde[_0xa1b2('0x32')]['filter']){_0x45c0a3['where']=_[_0xa1b2('0x3e')](_0x45c0a3[_0xa1b2('0x3c')],{'$or':_[_0xa1b2('0x31')](_0x4eb584,function(_0xced50d){if(_0xced50d[_0xa1b2('0x2f')]!==_0xa1b2('0x3f')){var _0x3fe821={};_0x3fe821[_0xced50d[_0xa1b2('0x2b')]]={'$like':'%'+_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x40')]+'%'};return _0x3fe821;}})});}_0x45c0a3=_[_0xa1b2('0x3e')]({},_0x45c0a3,_0x5addde[_0xa1b2('0x41')]);var _0x10df1a={'where':_0x45c0a3[_0xa1b2('0x3c')]};return db[_0xa1b2('0x2c')][_0xa1b2('0x21')](_0x10df1a)[_0xa1b2('0x26')](function(_0x1c9a3a){_0x2ec977[_0xa1b2('0x21')]=_0x1c9a3a;if(_0x5addde[_0xa1b2('0x32')][_0xa1b2('0x42')]){_0x45c0a3[_0xa1b2('0x43')]=[{'all':!![]}];}return db[_0xa1b2('0x2c')][_0xa1b2('0x44')](_0x45c0a3);})['then'](function(_0x1f645e){_0x2ec977[_0xa1b2('0x45')]=_0x1f645e;return _0x2ec977;})['then'](respondWithFilteredResult(_0x3aff6,_0x45c0a3))['catch'](handleError(_0x3aff6,null));};exports[_0xa1b2('0x46')]=function(_0x4894e0,_0x3f72ef){var _0x159b52={'raw':![],'where':{'id':_0x4894e0[_0xa1b2('0x47')]['id']}},_0x296103={};_0x296103[_0xa1b2('0x30')]=_[_0xa1b2('0x33')](db['JscriptyProject'][_0xa1b2('0x2d')]);_0x296103[_0xa1b2('0x32')]=_['keys'](_0x4894e0[_0xa1b2('0x32')]);_0x296103[_0xa1b2('0x34')]=_['intersection'](_0x296103[_0xa1b2('0x30')],_0x296103[_0xa1b2('0x32')]);_0x159b52[_0xa1b2('0x36')]=_['intersection'](_0x296103['model'],qs[_0xa1b2('0x37')](_0x4894e0['query'][_0xa1b2('0x37')]));_0x159b52['attributes']=_0x159b52[_0xa1b2('0x36')][_0xa1b2('0x38')]?_0x159b52['attributes']:_0x296103[_0xa1b2('0x30')];if(_0x4894e0[_0xa1b2('0x32')][_0xa1b2('0x42')]){_0x159b52['include']=[{'all':!![]}];}_0x159b52=_[_0xa1b2('0x3e')]({},_0x159b52,_0x4894e0[_0xa1b2('0x41')]);return db[_0xa1b2('0x2c')][_0xa1b2('0x48')](_0x159b52)[_0xa1b2('0x26')](handleEntityNotFound(_0x3f72ef,null))[_0xa1b2('0x26')](respondWithResult(_0x3f72ef,null))[_0xa1b2('0x49')](handleError(_0x3f72ef,null));};exports[_0xa1b2('0x4a')]=function(_0xd944e8,_0x281341){return db[_0xa1b2('0x2c')]['create'](_0xd944e8['body'],{})[_0xa1b2('0x26')](function(_0x249af3){var _0x501bb4=_0xd944e8[_0xa1b2('0x4b')][_0xa1b2('0x27')]({'plain':!![]});if(!_0x501bb4)throw new Error(_0xa1b2('0x4c'));if(_0x501bb4[_0xa1b2('0x4d')]==='user'){var _0x259efe=_0x249af3[_0xa1b2('0x27')]({'plain':!![]});var _0x511bc8=_0xa1b2('0x28');return db[_0xa1b2('0x4e')][_0xa1b2('0x48')]({'where':{'name':_0x511bc8,'userProfileId':_0x501bb4[_0xa1b2('0x4f')]},'raw':!![]})[_0xa1b2('0x26')](function(_0x2468c1){if(_0x2468c1&&_0x2468c1[_0xa1b2('0x50')]===0x0){return db[_0xa1b2('0x29')][_0xa1b2('0x4a')]({'name':_0x259efe[_0xa1b2('0x2b')],'resourceId':_0x259efe['id'],'type':_0x2468c1['name'],'sectionId':_0x2468c1['id']},{})[_0xa1b2('0x26')](function(){return _0x249af3;});}else{return _0x249af3;}})[_0xa1b2('0x49')](function(_0x14359c){logger[_0xa1b2('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14359c);throw _0x14359c;});}return _0x249af3;})['then'](respondWithResult(_0x281341,0xc9))[_0xa1b2('0x49')](handleError(_0x281341,null));};exports[_0xa1b2('0x52')]=function(_0x562cf2,_0x44352f){var _0x4e9293={'where':{'id':_0x562cf2['params']['id']}},_0x283801={};_0x283801[_0xa1b2('0x30')]=_[_0xa1b2('0x33')](db[_0xa1b2('0x2c')][_0xa1b2('0x2d')]);_0x4e9293['attributes']=_[_0xa1b2('0x35')](_0x283801[_0xa1b2('0x30')],qs[_0xa1b2('0x37')](_0x562cf2['query'][_0xa1b2('0x37')]));_0x4e9293[_0xa1b2('0x36')]=_0x4e9293[_0xa1b2('0x36')][_0xa1b2('0x38')]?_0x4e9293[_0xa1b2('0x36')]:_0x283801['model'];if(_0x562cf2['query']['includeAll']){_0x4e9293[_0xa1b2('0x43')]=[{'all':!![]}];}_0x4e9293=_[_0xa1b2('0x3e')]({},_0x4e9293,_0x562cf2['options']);return db[_0xa1b2('0x2c')][_0xa1b2('0x48')](_0x4e9293)[_0xa1b2('0x26')](handleEntityNotFound(_0x44352f,null))['then'](function(_0x25bd8b){if(_0x25bd8b){var _0x56a017=_0x25bd8b[_0xa1b2('0x27')]({'plain':!![]});_0x56a017=qs[_0xa1b2('0x53')](_0x56a017,['id',_0xa1b2('0x54'),_0xa1b2('0x55')]);_0x562cf2[_0xa1b2('0x56')]=_['omit'](_0x562cf2[_0xa1b2('0x56')],['id','createdAt',_0xa1b2('0x55')]);return db[_0xa1b2('0x2c')][_0xa1b2('0x4a')](_[_0xa1b2('0x3e')](_0x56a017,_0x562cf2[_0xa1b2('0x56')]),{'include':_0x562cf2[_0xa1b2('0x32')][_0xa1b2('0x42')]?[{'all':!![]}]:undefined})[_0xa1b2('0x26')](function(_0x4136bd){var _0x394d6e=_0x562cf2[_0xa1b2('0x4b')][_0xa1b2('0x27')]({'plain':!![]});if(!_0x394d6e)throw new Error(_0xa1b2('0x4c'));if(_0x394d6e[_0xa1b2('0x4d')]===_0xa1b2('0x4b')){var _0x2d2590=_0x4136bd[_0xa1b2('0x27')]({'plain':!![]});var _0x2d64f5=_0xa1b2('0x28');return db[_0xa1b2('0x4e')]['find']({'where':{'name':_0x2d64f5,'userProfileId':_0x394d6e[_0xa1b2('0x4f')]},'raw':!![]})[_0xa1b2('0x26')](function(_0x29e48a){if(_0x29e48a&&_0x29e48a[_0xa1b2('0x50')]===0x0){return db[_0xa1b2('0x29')][_0xa1b2('0x4a')]({'name':_0x2d2590['name'],'resourceId':_0x2d2590['id'],'type':_0x29e48a[_0xa1b2('0x2b')],'sectionId':_0x29e48a['id']},{})[_0xa1b2('0x26')](function(){return _0x4136bd;});}else{return _0x4136bd;}})['catch'](function(_0x3a2649){logger[_0xa1b2('0x51')](_0xa1b2('0x57'),_0x3a2649);throw _0x3a2649;});}return _0x4136bd;});}})[_0xa1b2('0x26')](respondWithResult(_0x44352f,0xc9))['catch'](handleError(_0x44352f,null));};exports[_0xa1b2('0x25')]=function(_0x9ac0f4,_0xa396d){if(_0x9ac0f4['body']['id']){delete _0x9ac0f4[_0xa1b2('0x56')]['id'];}return db[_0xa1b2('0x2c')][_0xa1b2('0x48')]({'where':{'id':_0x9ac0f4[_0xa1b2('0x47')]['id']}})[_0xa1b2('0x26')](handleEntityNotFound(_0xa396d,null))[_0xa1b2('0x26')](saveUpdates(_0x9ac0f4['body'],null))[_0xa1b2('0x26')](respondWithResult(_0xa396d,null))[_0xa1b2('0x49')](handleError(_0xa396d,null));};exports[_0xa1b2('0x58')]=function(_0x2e12d3,_0x1b2296){return db[_0xa1b2('0x2c')]['find']({'where':{'id':_0x2e12d3[_0xa1b2('0x47')]['id']}})[_0xa1b2('0x26')](handleEntityNotFound(_0x1b2296,null))[_0xa1b2('0x26')](removeEntity(_0x1b2296,null))[_0xa1b2('0x49')](handleError(_0x1b2296,null));};exports[_0xa1b2('0x59')]=function(_0x58473e,_0x202aab,_0x34a920){var _0x43e73b={'raw':!![],'where':{}};var _0x390727={};var _0x4e3d61={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xa1b2('0x5a')]({'where':{'id':_0x58473e[_0xa1b2('0x47')]['id']}})[_0xa1b2('0x26')](handleEntityNotFound(_0x202aab,null))[_0xa1b2('0x26')](function(_0x586842){if(_0x586842){_0x390727[_0xa1b2('0x30')]=_[_0xa1b2('0x33')](db[_0xa1b2('0x5b')][_0xa1b2('0x2d')]);_0x390727['query']=_[_0xa1b2('0x33')](_0x58473e[_0xa1b2('0x32')]);_0x390727['filters']=_[_0xa1b2('0x35')](_0x390727[_0xa1b2('0x30')],_0x390727[_0xa1b2('0x32')]);_0x43e73b[_0xa1b2('0x36')]=_[_0xa1b2('0x35')](_0x390727[_0xa1b2('0x30')],qs[_0xa1b2('0x37')](_0x58473e[_0xa1b2('0x32')]['fields']));_0x43e73b[_0xa1b2('0x36')]=_0x43e73b[_0xa1b2('0x36')][_0xa1b2('0x38')]?_0x43e73b[_0xa1b2('0x36')]:_0x390727['model'];if(!_0x58473e[_0xa1b2('0x32')][_0xa1b2('0x39')](_0xa1b2('0x5c'))){_0x43e73b[_0xa1b2('0x20')]=qs['limit'](_0x58473e[_0xa1b2('0x32')]['limit']);_0x43e73b[_0xa1b2('0x1e')]=qs['offset'](_0x58473e[_0xa1b2('0x32')][_0xa1b2('0x1e')]);}_0x43e73b[_0xa1b2('0x3a')]=qs[_0xa1b2('0x3b')](_0x58473e[_0xa1b2('0x32')][_0xa1b2('0x3b')]);_0x43e73b[_0xa1b2('0x3c')]=qs[_0xa1b2('0x34')](_[_0xa1b2('0x3d')](_0x58473e['query'],_0x390727[_0xa1b2('0x34')]));_0x43e73b['where'][_0xa1b2('0x5d')]=_0x586842['id'];if(_0x58473e[_0xa1b2('0x32')][_0xa1b2('0x40')]){_0x43e73b[_0xa1b2('0x3c')]=_[_0xa1b2('0x3e')](_0x43e73b[_0xa1b2('0x3c')],{'$or':_[_0xa1b2('0x31')](_0x43e73b[_0xa1b2('0x36')],function(_0x4cc48e){var _0x51cf9a={};_0x51cf9a[_0x4cc48e]={'$like':'%'+_0x58473e[_0xa1b2('0x32')]['filter']+'%'};return _0x51cf9a;})});}_0x43e73b=_['merge']({},_0x43e73b,_0x58473e[_0xa1b2('0x41')]);return db[_0xa1b2('0x5b')][_0xa1b2('0x21')]({'where':_0x43e73b['where']})[_0xa1b2('0x26')](function(_0x48f1ba){_0x4e3d61[_0xa1b2('0x21')]=_0x48f1ba;if(_0x58473e[_0xa1b2('0x32')][_0xa1b2('0x42')]){_0x43e73b[_0xa1b2('0x43')]=[{'all':!![]}];}return db[_0xa1b2('0x5b')][_0xa1b2('0x44')](_0x43e73b);})[_0xa1b2('0x26')](function(_0x31bbc9){_0x4e3d61[_0xa1b2('0x45')]=_0x31bbc9;return _0x4e3d61;});}})[_0xa1b2('0x26')](respondWithFilteredResult(_0x202aab,_0x43e73b))[_0xa1b2('0x49')](handleError(_0x202aab,null));};exports[_0xa1b2('0x5e')]=function(_0x4ac76e,_0x2adafa,_0x1d4f4a){var _0x5c679a={'raw':!![],'where':{}};var _0x94747e={};var _0xb0913f={'count':0x0,'rows':[]};return db[_0xa1b2('0x2c')][_0xa1b2('0x5a')]({'where':{'id':_0x4ac76e['params']['id']}})[_0xa1b2('0x26')](handleEntityNotFound(_0x2adafa,null))[_0xa1b2('0x26')](function(_0x114706){if(_0x114706){_0x94747e['model']=_[_0xa1b2('0x33')](db[_0xa1b2('0x5f')]['rawAttributes']);_0x94747e[_0xa1b2('0x32')]=_[_0xa1b2('0x33')](_0x4ac76e[_0xa1b2('0x32')]);_0x94747e['filters']=_[_0xa1b2('0x35')](_0x94747e['model'],_0x94747e[_0xa1b2('0x32')]);_0x5c679a[_0xa1b2('0x36')]=_[_0xa1b2('0x35')](_0x94747e['model'],qs[_0xa1b2('0x37')](_0x4ac76e['query']['fields']));_0x5c679a['attributes']=_0x5c679a['attributes'][_0xa1b2('0x38')]?_0x5c679a[_0xa1b2('0x36')]:_0x94747e['model'];if(!_0x4ac76e[_0xa1b2('0x32')][_0xa1b2('0x39')](_0xa1b2('0x5c'))){_0x5c679a[_0xa1b2('0x20')]=qs[_0xa1b2('0x20')](_0x4ac76e['query']['limit']);_0x5c679a['offset']=qs['offset'](_0x4ac76e[_0xa1b2('0x32')][_0xa1b2('0x1e')]);}_0x5c679a['order']=qs[_0xa1b2('0x3b')](_0x4ac76e[_0xa1b2('0x32')]['sort']);_0x5c679a['where']=qs[_0xa1b2('0x34')](_[_0xa1b2('0x3d')](_0x4ac76e['query'],_0x94747e[_0xa1b2('0x34')]));_0x5c679a[_0xa1b2('0x3c')]['ProjectId']=_0x114706['id'];if(_0x4ac76e['query']['filter']){_0x5c679a[_0xa1b2('0x3c')]=_[_0xa1b2('0x3e')](_0x5c679a[_0xa1b2('0x3c')],{'$or':_[_0xa1b2('0x31')](_0x5c679a[_0xa1b2('0x36')],function(_0x4e01a4){var _0x2ea47b={};_0x2ea47b[_0x4e01a4]={'$like':'%'+_0x4ac76e['query'][_0xa1b2('0x40')]+'%'};return _0x2ea47b;})});}_0x5c679a=_[_0xa1b2('0x3e')]({},_0x5c679a,_0x4ac76e[_0xa1b2('0x41')]);return db[_0xa1b2('0x5f')]['count']({'where':_0x5c679a[_0xa1b2('0x3c')]})[_0xa1b2('0x26')](function(_0x130347){_0xb0913f[_0xa1b2('0x21')]=_0x130347;if(_0x4ac76e[_0xa1b2('0x32')]['includeAll']){_0x5c679a[_0xa1b2('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa1b2('0x44')](_0x5c679a);})[_0xa1b2('0x26')](function(_0x50b20b){_0xb0913f[_0xa1b2('0x45')]=_0x50b20b;return _0xb0913f;});}})['then'](respondWithFilteredResult(_0x2adafa,_0x5c679a))[_0xa1b2('0x49')](handleError(_0x2adafa,null));};function char(_0x1e6e96){return _0xa1b2('0x60')===typeof _0x1e6e96?String['fromCharCode']['apply'](null,arguments):_0x1e6e96;}function needsEncapsulation(_0xa1f19e){return!!_0xa1f19e&&(_0xa1f19e[_0xa1b2('0x61')]()[_0xa1b2('0x62')](char(0xd))>=0x0||_0xa1f19e[_0xa1b2('0x61')]()[_0xa1b2('0x62')](char(0xa))>=0x0||_0xa1f19e[_0xa1b2('0x61')]()[_0xa1b2('0x62')](char(0x2c))>=0x0||_0xa1f19e[_0xa1b2('0x61')]()[_0xa1b2('0x62')](char(0x22))>=0x0);}function encapsulate(_0x2c81fe){var _0x108e16=char(0x22),_0x420512='\x5c'+char(0x22),_0x2239c1=_0x2c81fe[_0xa1b2('0x61')]()[_0xa1b2('0x63')](new RegExp(_0x108e16,'g'),_0x420512);return _0x108e16+_0x2239c1+_0x108e16;}exports[_0xa1b2('0x64')]=function(_0x4ea1b1,_0x481c4d,_0x4a6b3c){var _0x3742d3,_0x4543d4;var _0x1941db={'where':{'ProjectId':_0x4ea1b1['params']['id']}};if(_0x4ea1b1['query']['startTime']){_0x1941db[_0xa1b2('0x3c')][_0xa1b2('0x65')]=JSON['parse'](_0x4ea1b1[_0xa1b2('0x32')][_0xa1b2('0x66')]);}return db[_0xa1b2('0x5b')][_0xa1b2('0x44')](_0x1941db)[_0xa1b2('0x26')](handleEntityNotFound(_0x481c4d,null))[_0xa1b2('0x26')](function(_0x1be191){if(_0x1be191){_0x3742d3=_0x1be191;return db[_0xa1b2('0x67')][_0xa1b2('0x44')]({'where':{'SessionId':{'$in':_[_0xa1b2('0x31')](_0x3742d3,'id')},'ProjectId':_0x4ea1b1[_0xa1b2('0x47')]['id']},'order':_0xa1b2('0x68')});}})[_0xa1b2('0x26')](handleEntityNotFound(_0x481c4d,null))[_0xa1b2('0x26')](function(_0x33517d){if(_0x33517d){_0x4543d4=_0x33517d;var _0x1e3a6a={};for(var _0x4ec39b=0x0,_0x38b1fb=_0x4543d4[_0xa1b2('0x38')];_0x4ec39b<_0x38b1fb;_0x4ec39b++){if(!_0x1e3a6a[_0xa1b2('0x39')](_0x4543d4[_0x4ec39b]['questionId'])){_0x1e3a6a[_0x4543d4[_0x4ec39b][_0xa1b2('0x69')]]=needsEncapsulation(_0x4543d4[_0x4ec39b][_0xa1b2('0x6a')])?encapsulate(_0x4543d4[_0x4ec39b]['question']):_0x4543d4[_0x4ec39b][_0xa1b2('0x6a')];}}var _0xac0b3f=[],_0x5babfc={};for(var _0x372ea7=0x0,_0x45d8ad=_0x3742d3[_0xa1b2('0x38')];_0x372ea7<_0x45d8ad;_0x372ea7++){_0x5babfc={'ProjectId':_0x4ea1b1['params']['id'],'SessionId':_0x3742d3[_0x372ea7]['id'],'StartTime':moment(_0x3742d3[_0x372ea7]['starttime'])['format'](_0xa1b2('0x6b'))};for(var _0x5ae678=0x0,_0x516ca7=_0x4543d4['length'];_0x5ae678<_0x516ca7;_0x5ae678++){if(_0x4543d4[_0x5ae678][_0xa1b2('0x6c')]==_0x3742d3[_0x372ea7]['id']&&_0x1e3a6a[_0xa1b2('0x39')](_0x4543d4[_0x5ae678][_0xa1b2('0x69')])){_0x5babfc[_0x1e3a6a[_0x4543d4[_0x5ae678][_0xa1b2('0x69')]]]=_0x4543d4[_0x5ae678][_0xa1b2('0x6d')];}}for(var _0x3e2417 in _0x1e3a6a){if(!_0x5babfc['hasOwnProperty'](_0x1e3a6a[_0x3e2417])){_0x5babfc[_0x1e3a6a[_0x3e2417]]=null;}}_0xac0b3f['push'](_0x5babfc);}return _0xac0b3f;}})['then'](function(_0x7a55da){if(!_[_0xa1b2('0x6e')](_0x7a55da)){var _0x2af985=toCsv(_0x7a55da);var _0x13727d=Date[_0xa1b2('0x6f')]();fs[_0xa1b2('0x70')](util['format'](_0xa1b2('0x71'),_0x4ea1b1[_0xa1b2('0x47')]['id'],_0x13727d),_0x2af985);_0x481c4d[_0xa1b2('0x72')](_0xa1b2('0x73'),_0xa1b2('0x74')+util['format'](_0xa1b2('0x75'),_0x4ea1b1[_0xa1b2('0x47')]['id'],_0x13727d));_0x481c4d[_0xa1b2('0x72')](_0xa1b2('0x76'),_0xa1b2('0x77'));return _0x481c4d[_0xa1b2('0x78')](util['format'](_0xa1b2('0x71'),_0x4ea1b1[_0xa1b2('0x47')]['id'],_0x13727d));}else{return _0x481c4d['sendStatus'](0xcc);}})[_0xa1b2('0x49')](handleError(_0x481c4d,null));}; \ No newline at end of file +var _0x3c90=['-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','JscriptyProject','include','options','find','create','user','Projects','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','getSessions','findOne','JscriptySessionReport','order','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport'];(function(_0x525329,_0x2e5d32){var _0x38d9a2=function(_0xc96f98){while(--_0xc96f98){_0x525329['push'](_0x525329['shift']());}};_0x38d9a2(++_0x2e5d32);}(_0x3c90,0xfd));var _0x03c9=function(_0x334ea4,_0x47c06b){_0x334ea4=_0x334ea4-0x0;var _0x57cef7=_0x3c90[_0x334ea4];return _0x57cef7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03c9('0x0'));var zipdir=require(_0x03c9('0x1'));var jsonpatch=require(_0x03c9('0x2'));var rp=require(_0x03c9('0x3'));var moment=require(_0x03c9('0x4'));var BPromise=require(_0x03c9('0x5'));var Mustache=require('mustache');var util=require(_0x03c9('0x6'));var path=require('path');var sox=require(_0x03c9('0x7'));var csv=require(_0x03c9('0x8'));var ejs=require(_0x03c9('0x9'));var fs=require('fs');var fs_extra=require(_0x03c9('0xa'));var _=require(_0x03c9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x03c9('0xc'));var Papa=require(_0x03c9('0xd'));var Redis=require(_0x03c9('0xe'));var authService=require(_0x03c9('0xf'));var qs=require(_0x03c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03c9('0x11'));var logger=require(_0x03c9('0x12'))('api');var utils=require(_0x03c9('0x13'));var config=require(_0x03c9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x03c9('0x15'))['db'];function respondWithStatusCode(_0x34cf7c,_0x5ea0b4){_0x5ea0b4=_0x5ea0b4||0xcc;return function(_0x456615){if(_0x456615){return _0x34cf7c[_0x03c9('0x16')](_0x5ea0b4);}return _0x34cf7c[_0x03c9('0x17')](_0x5ea0b4)[_0x03c9('0x18')]();};}function respondWithResult(_0x151fbc,_0x461b42){_0x461b42=_0x461b42||0xc8;return function(_0x18c118){if(_0x18c118){return _0x151fbc[_0x03c9('0x17')](_0x461b42)[_0x03c9('0x19')](_0x18c118);}};}function respondWithFilteredResult(_0x4d0c31,_0x540f77){return function(_0x469824){if(_0x469824){var _0x35a250=typeof _0x540f77[_0x03c9('0x1a')]===_0x03c9('0x1b')&&typeof _0x540f77[_0x03c9('0x1c')]===_0x03c9('0x1b');var _0x58beea=_0x469824[_0x03c9('0x1d')];var _0x33cfe6=_0x35a250?0x0:_0x540f77[_0x03c9('0x1a')];var _0x386537=_0x35a250?_0x469824[_0x03c9('0x1d')]:_0x540f77[_0x03c9('0x1a')]+_0x540f77[_0x03c9('0x1c')];var _0x272e6f;if(_0x386537>=_0x58beea){_0x386537=_0x58beea;_0x272e6f=0xc8;}else{_0x272e6f=0xce;}_0x4d0c31[_0x03c9('0x17')](_0x272e6f);return _0x4d0c31[_0x03c9('0x1e')](_0x03c9('0x1f'),_0x33cfe6+'-'+_0x386537+'/'+_0x58beea)[_0x03c9('0x19')](_0x469824);}return null;};}function patchUpdates(_0x53f040){return function(_0x247ce9){try{jsonpatch[_0x03c9('0x20')](_0x247ce9,_0x53f040,!![]);}catch(_0x517689){return BPromise[_0x03c9('0x21')](_0x517689);}return _0x247ce9[_0x03c9('0x22')]();};}function saveUpdates(_0x2be17e,_0xcd34ad){return function(_0x3030d5){if(_0x3030d5){return _0x3030d5[_0x03c9('0x23')](_0x2be17e)[_0x03c9('0x24')](function(_0x379650){return _0x379650;});}return null;};}function removeEntity(_0x175a44,_0x236507){return function(_0x24034d){if(_0x24034d){return _0x24034d[_0x03c9('0x25')]()[_0x03c9('0x24')](function(){var _0x4e2e06=_0x24034d[_0x03c9('0x26')]({'plain':!![]});var _0x1763be='Projects';return db['UserProfileResource'][_0x03c9('0x25')]({'where':{'type':_0x1763be,'resourceId':_0x4e2e06['id']}})['then'](function(){return _0x24034d;});})[_0x03c9('0x24')](function(){_0x175a44[_0x03c9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215b9e,_0x46f5c5){return function(_0x3c3dcb){if(!_0x3c3dcb){_0x215b9e[_0x03c9('0x16')](0x194);}return _0x3c3dcb;};}function handleError(_0x266ce7,_0x217988){_0x217988=_0x217988||0x1f4;return function(_0x44f354){logger[_0x03c9('0x27')](_0x44f354[_0x03c9('0x28')]);if(_0x44f354[_0x03c9('0x29')]){delete _0x44f354[_0x03c9('0x29')];}_0x266ce7[_0x03c9('0x17')](_0x217988)['send'](_0x44f354);};}exports[_0x03c9('0x2a')]=function(_0x4d89a2,_0x325aa0){var _0x5728f3={},_0x775498={},_0x694bd4={'count':0x0,'rows':[]};var _0x336093=_[_0x03c9('0x2b')](db['JscriptyProject'][_0x03c9('0x2c')],function(_0x5a819b){return{'name':_0x5a819b[_0x03c9('0x2d')],'type':_0x5a819b[_0x03c9('0x2e')]['key']};});_0x775498[_0x03c9('0x2f')]=_[_0x03c9('0x2b')](_0x336093,_0x03c9('0x29'));_0x775498[_0x03c9('0x30')]=_[_0x03c9('0x31')](_0x4d89a2[_0x03c9('0x30')]);_0x775498[_0x03c9('0x32')]=_[_0x03c9('0x33')](_0x775498['model'],_0x775498[_0x03c9('0x30')]);_0x5728f3[_0x03c9('0x34')]=_[_0x03c9('0x33')](_0x775498[_0x03c9('0x2f')],qs['fields'](_0x4d89a2['query'][_0x03c9('0x35')]));_0x5728f3[_0x03c9('0x34')]=_0x5728f3[_0x03c9('0x34')][_0x03c9('0x36')]?_0x5728f3[_0x03c9('0x34')]:_0x775498[_0x03c9('0x2f')];if(!_0x4d89a2[_0x03c9('0x30')][_0x03c9('0x37')](_0x03c9('0x38'))){_0x5728f3[_0x03c9('0x1c')]=qs[_0x03c9('0x1c')](_0x4d89a2[_0x03c9('0x30')]['limit']);_0x5728f3[_0x03c9('0x1a')]=qs['offset'](_0x4d89a2[_0x03c9('0x30')][_0x03c9('0x1a')]);}_0x5728f3['order']=qs[_0x03c9('0x39')](_0x4d89a2[_0x03c9('0x30')]['sort']);_0x5728f3[_0x03c9('0x3a')]=qs[_0x03c9('0x32')](_[_0x03c9('0x3b')](_0x4d89a2[_0x03c9('0x30')],_0x775498[_0x03c9('0x32')]),_0x336093);if(_0x4d89a2[_0x03c9('0x30')][_0x03c9('0x3c')]){_0x5728f3['where']=_[_0x03c9('0x3d')](_0x5728f3[_0x03c9('0x3a')],{'$or':_[_0x03c9('0x2b')](_0x336093,function(_0x3a00fe){if(_0x3a00fe[_0x03c9('0x2e')]!=='VIRTUAL'){var _0x474428={};_0x474428[_0x3a00fe[_0x03c9('0x29')]]={'$like':'%'+_0x4d89a2['query'][_0x03c9('0x3c')]+'%'};return _0x474428;}})});}_0x5728f3=_['merge']({},_0x5728f3,_0x4d89a2['options']);var _0x4f4ad5={'where':_0x5728f3[_0x03c9('0x3a')]};return db['JscriptyProject'][_0x03c9('0x1d')](_0x4f4ad5)[_0x03c9('0x24')](function(_0x45106d){_0x694bd4[_0x03c9('0x1d')]=_0x45106d;if(_0x4d89a2[_0x03c9('0x30')][_0x03c9('0x3e')]){_0x5728f3['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x03c9('0x3f')](_0x5728f3);})[_0x03c9('0x24')](function(_0x4e46e2){_0x694bd4[_0x03c9('0x40')]=_0x4e46e2;return _0x694bd4;})[_0x03c9('0x24')](respondWithFilteredResult(_0x325aa0,_0x5728f3))[_0x03c9('0x41')](handleError(_0x325aa0,null));};exports[_0x03c9('0x42')]=function(_0x2c561b,_0x19251b){var _0x42c365={'raw':![],'where':{'id':_0x2c561b[_0x03c9('0x43')]['id']}},_0x323e2c={};_0x323e2c[_0x03c9('0x2f')]=_[_0x03c9('0x31')](db[_0x03c9('0x44')][_0x03c9('0x2c')]);_0x323e2c[_0x03c9('0x30')]=_[_0x03c9('0x31')](_0x2c561b[_0x03c9('0x30')]);_0x323e2c['filters']=_[_0x03c9('0x33')](_0x323e2c[_0x03c9('0x2f')],_0x323e2c[_0x03c9('0x30')]);_0x42c365[_0x03c9('0x34')]=_[_0x03c9('0x33')](_0x323e2c['model'],qs[_0x03c9('0x35')](_0x2c561b['query']['fields']));_0x42c365[_0x03c9('0x34')]=_0x42c365[_0x03c9('0x34')]['length']?_0x42c365['attributes']:_0x323e2c[_0x03c9('0x2f')];if(_0x2c561b[_0x03c9('0x30')][_0x03c9('0x3e')]){_0x42c365[_0x03c9('0x45')]=[{'all':!![]}];}_0x42c365=_['merge']({},_0x42c365,_0x2c561b[_0x03c9('0x46')]);return db[_0x03c9('0x44')][_0x03c9('0x47')](_0x42c365)[_0x03c9('0x24')](handleEntityNotFound(_0x19251b,null))[_0x03c9('0x24')](respondWithResult(_0x19251b,null))[_0x03c9('0x41')](handleError(_0x19251b,null));};exports[_0x03c9('0x48')]=function(_0xbd9b89,_0xe1e94c){return db[_0x03c9('0x44')][_0x03c9('0x48')](_0xbd9b89['body'],{})[_0x03c9('0x24')](function(_0x40c123){var _0x1ec53f=_0xbd9b89[_0x03c9('0x49')][_0x03c9('0x26')]({'plain':!![]});if(!_0x1ec53f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ec53f['role']===_0x03c9('0x49')){var _0x4a5009=_0x40c123[_0x03c9('0x26')]({'plain':!![]});var _0x5a0915=_0x03c9('0x4a');return db[_0x03c9('0x4b')]['find']({'where':{'name':_0x5a0915,'userProfileId':_0x1ec53f[_0x03c9('0x4c')]},'raw':!![]})[_0x03c9('0x24')](function(_0x39326e){if(_0x39326e&&_0x39326e['autoAssociation']===0x0){return db[_0x03c9('0x4d')]['create']({'name':_0x4a5009[_0x03c9('0x29')],'resourceId':_0x4a5009['id'],'type':_0x39326e[_0x03c9('0x29')],'sectionId':_0x39326e['id']},{})[_0x03c9('0x24')](function(){return _0x40c123;});}else{return _0x40c123;}})[_0x03c9('0x41')](function(_0x36d40c){logger[_0x03c9('0x27')](_0x03c9('0x4e'),_0x36d40c);throw _0x36d40c;});}return _0x40c123;})[_0x03c9('0x24')](respondWithResult(_0xe1e94c,0xc9))[_0x03c9('0x41')](handleError(_0xe1e94c,null));};exports[_0x03c9('0x4f')]=function(_0x1feb1b,_0x336825){var _0x1ecb5c={'where':{'id':_0x1feb1b[_0x03c9('0x43')]['id']}},_0x29cb56={};_0x29cb56['model']=_[_0x03c9('0x31')](db[_0x03c9('0x44')][_0x03c9('0x2c')]);_0x1ecb5c[_0x03c9('0x34')]=_[_0x03c9('0x33')](_0x29cb56[_0x03c9('0x2f')],qs[_0x03c9('0x35')](_0x1feb1b['query'][_0x03c9('0x35')]));_0x1ecb5c[_0x03c9('0x34')]=_0x1ecb5c['attributes'][_0x03c9('0x36')]?_0x1ecb5c[_0x03c9('0x34')]:_0x29cb56['model'];if(_0x1feb1b['query'][_0x03c9('0x3e')]){_0x1ecb5c['include']=[{'all':!![]}];}_0x1ecb5c=_[_0x03c9('0x3d')]({},_0x1ecb5c,_0x1feb1b['options']);return db['JscriptyProject']['find'](_0x1ecb5c)[_0x03c9('0x24')](handleEntityNotFound(_0x336825,null))[_0x03c9('0x24')](function(_0x3a85b6){if(_0x3a85b6){var _0x53f48d=_0x3a85b6['get']({'plain':!![]});_0x53f48d=qs[_0x03c9('0x50')](_0x53f48d,['id',_0x03c9('0x51'),_0x03c9('0x52')]);_0x1feb1b[_0x03c9('0x53')]=_[_0x03c9('0x50')](_0x1feb1b[_0x03c9('0x53')],['id',_0x03c9('0x51'),_0x03c9('0x52')]);return db['JscriptyProject']['create'](_[_0x03c9('0x3d')](_0x53f48d,_0x1feb1b[_0x03c9('0x53')]),{'include':_0x1feb1b[_0x03c9('0x30')][_0x03c9('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x5c8d4a){var _0x54fd2c=_0x1feb1b['user'][_0x03c9('0x26')]({'plain':!![]});if(!_0x54fd2c)throw new Error(_0x03c9('0x54'));if(_0x54fd2c[_0x03c9('0x55')]===_0x03c9('0x49')){var _0x1033d5=_0x5c8d4a[_0x03c9('0x26')]({'plain':!![]});var _0x5c8420='Projects';return db[_0x03c9('0x4b')][_0x03c9('0x47')]({'where':{'name':_0x5c8420,'userProfileId':_0x54fd2c[_0x03c9('0x4c')]},'raw':!![]})[_0x03c9('0x24')](function(_0x3267d0){if(_0x3267d0&&_0x3267d0[_0x03c9('0x56')]===0x0){return db['UserProfileResource'][_0x03c9('0x48')]({'name':_0x1033d5[_0x03c9('0x29')],'resourceId':_0x1033d5['id'],'type':_0x3267d0['name'],'sectionId':_0x3267d0['id']},{})[_0x03c9('0x24')](function(){return _0x5c8d4a;});}else{return _0x5c8d4a;}})[_0x03c9('0x41')](function(_0xb30ee){logger[_0x03c9('0x27')](_0x03c9('0x4e'),_0xb30ee);throw _0xb30ee;});}return _0x5c8d4a;});}})[_0x03c9('0x24')](respondWithResult(_0x336825,0xc9))[_0x03c9('0x41')](handleError(_0x336825,null));};exports['update']=function(_0x1fdd5c,_0x436c71){if(_0x1fdd5c[_0x03c9('0x53')]['id']){delete _0x1fdd5c['body']['id'];}return db[_0x03c9('0x44')]['find']({'where':{'id':_0x1fdd5c['params']['id']}})[_0x03c9('0x24')](handleEntityNotFound(_0x436c71,null))['then'](saveUpdates(_0x1fdd5c[_0x03c9('0x53')],null))[_0x03c9('0x24')](respondWithResult(_0x436c71,null))[_0x03c9('0x41')](handleError(_0x436c71,null));};exports[_0x03c9('0x25')]=function(_0x328082,_0x1caf3b){return db['JscriptyProject'][_0x03c9('0x47')]({'where':{'id':_0x328082[_0x03c9('0x43')]['id']}})[_0x03c9('0x24')](handleEntityNotFound(_0x1caf3b,null))['then'](removeEntity(_0x1caf3b,null))[_0x03c9('0x41')](handleError(_0x1caf3b,null));};exports[_0x03c9('0x57')]=function(_0x496c2c,_0x1b8967,_0x4f01f4){var _0x2d9e50={'raw':!![],'where':{}};var _0x1b6f7f={};var _0xde489f={'count':0x0,'rows':[]};return db[_0x03c9('0x44')][_0x03c9('0x58')]({'where':{'id':_0x496c2c[_0x03c9('0x43')]['id']}})[_0x03c9('0x24')](handleEntityNotFound(_0x1b8967,null))['then'](function(_0xb5d4fa){if(_0xb5d4fa){_0x1b6f7f['model']=_['keys'](db[_0x03c9('0x59')]['rawAttributes']);_0x1b6f7f['query']=_[_0x03c9('0x31')](_0x496c2c[_0x03c9('0x30')]);_0x1b6f7f[_0x03c9('0x32')]=_[_0x03c9('0x33')](_0x1b6f7f[_0x03c9('0x2f')],_0x1b6f7f[_0x03c9('0x30')]);_0x2d9e50[_0x03c9('0x34')]=_[_0x03c9('0x33')](_0x1b6f7f['model'],qs[_0x03c9('0x35')](_0x496c2c[_0x03c9('0x30')]['fields']));_0x2d9e50[_0x03c9('0x34')]=_0x2d9e50[_0x03c9('0x34')][_0x03c9('0x36')]?_0x2d9e50['attributes']:_0x1b6f7f['model'];if(!_0x496c2c['query'][_0x03c9('0x37')](_0x03c9('0x38'))){_0x2d9e50[_0x03c9('0x1c')]=qs[_0x03c9('0x1c')](_0x496c2c[_0x03c9('0x30')]['limit']);_0x2d9e50[_0x03c9('0x1a')]=qs[_0x03c9('0x1a')](_0x496c2c[_0x03c9('0x30')][_0x03c9('0x1a')]);}_0x2d9e50[_0x03c9('0x5a')]=qs[_0x03c9('0x39')](_0x496c2c[_0x03c9('0x30')]['sort']);_0x2d9e50[_0x03c9('0x3a')]=qs[_0x03c9('0x32')](_[_0x03c9('0x3b')](_0x496c2c[_0x03c9('0x30')],_0x1b6f7f[_0x03c9('0x32')]));_0x2d9e50[_0x03c9('0x3a')]['ProjectId']=_0xb5d4fa['id'];if(_0x496c2c['query'][_0x03c9('0x3c')]){_0x2d9e50[_0x03c9('0x3a')]=_[_0x03c9('0x3d')](_0x2d9e50[_0x03c9('0x3a')],{'$or':_[_0x03c9('0x2b')](_0x2d9e50['attributes'],function(_0xf1afbd){var _0x4665f7={};_0x4665f7[_0xf1afbd]={'$like':'%'+_0x496c2c[_0x03c9('0x30')]['filter']+'%'};return _0x4665f7;})});}_0x2d9e50=_[_0x03c9('0x3d')]({},_0x2d9e50,_0x496c2c[_0x03c9('0x46')]);return db[_0x03c9('0x59')][_0x03c9('0x1d')]({'where':_0x2d9e50[_0x03c9('0x3a')]})[_0x03c9('0x24')](function(_0x1cfc0a){_0xde489f[_0x03c9('0x1d')]=_0x1cfc0a;if(_0x496c2c[_0x03c9('0x30')][_0x03c9('0x3e')]){_0x2d9e50[_0x03c9('0x45')]=[{'all':!![]}];}return db[_0x03c9('0x59')]['findAll'](_0x2d9e50);})[_0x03c9('0x24')](function(_0x50a34c){_0xde489f[_0x03c9('0x40')]=_0x50a34c;return _0xde489f;});}})[_0x03c9('0x24')](respondWithFilteredResult(_0x1b8967,_0x2d9e50))[_0x03c9('0x41')](handleError(_0x1b8967,null));};exports['getAnswers']=function(_0x491d38,_0x3c01ad,_0x274726){var _0x1909fb={'raw':!![],'where':{}};var _0x2bb8c1={};var _0x5128d8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x03c9('0x58')]({'where':{'id':_0x491d38[_0x03c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c01ad,null))['then'](function(_0x5780f5){if(_0x5780f5){_0x2bb8c1[_0x03c9('0x2f')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x2bb8c1[_0x03c9('0x30')]=_[_0x03c9('0x31')](_0x491d38['query']);_0x2bb8c1[_0x03c9('0x32')]=_[_0x03c9('0x33')](_0x2bb8c1[_0x03c9('0x2f')],_0x2bb8c1[_0x03c9('0x30')]);_0x1909fb[_0x03c9('0x34')]=_['intersection'](_0x2bb8c1[_0x03c9('0x2f')],qs[_0x03c9('0x35')](_0x491d38[_0x03c9('0x30')][_0x03c9('0x35')]));_0x1909fb[_0x03c9('0x34')]=_0x1909fb['attributes'][_0x03c9('0x36')]?_0x1909fb[_0x03c9('0x34')]:_0x2bb8c1[_0x03c9('0x2f')];if(!_0x491d38[_0x03c9('0x30')]['hasOwnProperty'](_0x03c9('0x38'))){_0x1909fb[_0x03c9('0x1c')]=qs[_0x03c9('0x1c')](_0x491d38['query'][_0x03c9('0x1c')]);_0x1909fb['offset']=qs['offset'](_0x491d38[_0x03c9('0x30')][_0x03c9('0x1a')]);}_0x1909fb['order']=qs[_0x03c9('0x39')](_0x491d38['query'][_0x03c9('0x39')]);_0x1909fb[_0x03c9('0x3a')]=qs['filters'](_['pick'](_0x491d38[_0x03c9('0x30')],_0x2bb8c1[_0x03c9('0x32')]));_0x1909fb[_0x03c9('0x3a')]['ProjectId']=_0x5780f5['id'];if(_0x491d38[_0x03c9('0x30')][_0x03c9('0x3c')]){_0x1909fb[_0x03c9('0x3a')]=_[_0x03c9('0x3d')](_0x1909fb[_0x03c9('0x3a')],{'$or':_[_0x03c9('0x2b')](_0x1909fb[_0x03c9('0x34')],function(_0x177e96){var _0x489a28={};_0x489a28[_0x177e96]={'$like':'%'+_0x491d38[_0x03c9('0x30')][_0x03c9('0x3c')]+'%'};return _0x489a28;})});}_0x1909fb=_[_0x03c9('0x3d')]({},_0x1909fb,_0x491d38['options']);return db[_0x03c9('0x5b')][_0x03c9('0x1d')]({'where':_0x1909fb[_0x03c9('0x3a')]})['then'](function(_0x319492){_0x5128d8[_0x03c9('0x1d')]=_0x319492;if(_0x491d38['query'][_0x03c9('0x3e')]){_0x1909fb[_0x03c9('0x45')]=[{'all':!![]}];}return db[_0x03c9('0x5b')][_0x03c9('0x3f')](_0x1909fb);})['then'](function(_0x48d482){_0x5128d8[_0x03c9('0x40')]=_0x48d482;return _0x5128d8;});}})[_0x03c9('0x24')](respondWithFilteredResult(_0x3c01ad,_0x1909fb))[_0x03c9('0x41')](handleError(_0x3c01ad,null));};function char(_0x54eb54){return _0x03c9('0x5c')===typeof _0x54eb54?String[_0x03c9('0x5d')][_0x03c9('0x20')](null,arguments):_0x54eb54;}function needsEncapsulation(_0x24de76){return!!_0x24de76&&(_0x24de76[_0x03c9('0x5e')]()[_0x03c9('0x5f')](char(0xd))>=0x0||_0x24de76['toString']()[_0x03c9('0x5f')](char(0xa))>=0x0||_0x24de76[_0x03c9('0x5e')]()[_0x03c9('0x5f')](char(0x2c))>=0x0||_0x24de76[_0x03c9('0x5e')]()[_0x03c9('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x419fc0){var _0x536038=char(0x22),_0x36ed72='\x5c'+char(0x22),_0x10816c=_0x419fc0[_0x03c9('0x5e')]()[_0x03c9('0x60')](new RegExp(_0x536038,'g'),_0x36ed72);return _0x536038+_0x10816c+_0x536038;}exports[_0x03c9('0x61')]=function(_0x5ec9aa,_0x1fb480,_0x1326a5){var _0x48e0c9,_0x3b7bcf;var _0x7c11a3={'where':{'ProjectId':_0x5ec9aa[_0x03c9('0x43')]['id']}};if(_0x5ec9aa[_0x03c9('0x30')]['startTime']){_0x7c11a3[_0x03c9('0x3a')][_0x03c9('0x62')]=JSON['parse'](_0x5ec9aa[_0x03c9('0x30')][_0x03c9('0x63')]);}return db[_0x03c9('0x59')]['findAll'](_0x7c11a3)['then'](handleEntityNotFound(_0x1fb480,null))[_0x03c9('0x24')](function(_0x4c0809){if(_0x4c0809){_0x48e0c9=_0x4c0809;return db[_0x03c9('0x64')][_0x03c9('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x48e0c9,'id')},'ProjectId':_0x5ec9aa[_0x03c9('0x43')]['id']},'order':_0x03c9('0x65')});}})[_0x03c9('0x24')](handleEntityNotFound(_0x1fb480,null))[_0x03c9('0x24')](function(_0x59310a){if(_0x59310a){_0x3b7bcf=_0x59310a;var _0x37530c={};for(var _0x15727d=0x0,_0x2993f5=_0x3b7bcf[_0x03c9('0x36')];_0x15727d<_0x2993f5;_0x15727d++){if(!_0x37530c['hasOwnProperty'](_0x3b7bcf[_0x15727d][_0x03c9('0x66')])){_0x37530c[_0x3b7bcf[_0x15727d][_0x03c9('0x66')]]=needsEncapsulation(_0x3b7bcf[_0x15727d][_0x03c9('0x67')])?encapsulate(_0x3b7bcf[_0x15727d][_0x03c9('0x67')]):_0x3b7bcf[_0x15727d][_0x03c9('0x67')];}}var _0x38dd2f=[],_0x43d347={};for(var _0xc27da0=0x0,_0x3e5b6f=_0x48e0c9[_0x03c9('0x36')];_0xc27da0<_0x3e5b6f;_0xc27da0++){_0x43d347={'ProjectId':_0x5ec9aa['params']['id'],'SessionId':_0x48e0c9[_0xc27da0]['id'],'StartTime':moment(_0x48e0c9[_0xc27da0][_0x03c9('0x62')])[_0x03c9('0x68')](_0x03c9('0x69'))};for(var _0x3173e0=0x0,_0x3153eb=_0x3b7bcf[_0x03c9('0x36')];_0x3173e0<_0x3153eb;_0x3173e0++){if(_0x3b7bcf[_0x3173e0][_0x03c9('0x6a')]==_0x48e0c9[_0xc27da0]['id']&&_0x37530c[_0x03c9('0x37')](_0x3b7bcf[_0x3173e0]['questionId'])){_0x43d347[_0x37530c[_0x3b7bcf[_0x3173e0]['questionId']]]=_0x3b7bcf[_0x3173e0][_0x03c9('0x6b')];}}for(var _0x52b7e5 in _0x37530c){if(!_0x43d347[_0x03c9('0x37')](_0x37530c[_0x52b7e5])){_0x43d347[_0x37530c[_0x52b7e5]]=null;}}_0x38dd2f[_0x03c9('0x6c')](_0x43d347);}return _0x38dd2f;}})['then'](function(_0x358479){if(!_[_0x03c9('0x6d')](_0x358479)){var _0x2570f8=toCsv(_0x358479);var _0x59013c=Date['now']();fs[_0x03c9('0x6e')](util[_0x03c9('0x68')](_0x03c9('0x6f'),_0x5ec9aa[_0x03c9('0x43')]['id'],_0x59013c),_0x2570f8);_0x1fb480['setHeader']('Content-disposition',_0x03c9('0x70')+util['format'](_0x03c9('0x71'),_0x5ec9aa[_0x03c9('0x43')]['id'],_0x59013c));_0x1fb480[_0x03c9('0x72')](_0x03c9('0x73'),_0x03c9('0x74'));return _0x1fb480[_0x03c9('0x75')](util[_0x03c9('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5ec9aa[_0x03c9('0x43')]['id'],_0x59013c));}else{return _0x1fb480[_0x03c9('0x16')](0xcc);}})[_0x03c9('0x41')](handleError(_0x1fb480,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 97ef40b..e6217ad 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 _0x83d3=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4f65a5,_0x1519d5){var _0x2b7c97=function(_0x2fd1ad){while(--_0x2fd1ad){_0x4f65a5['push'](_0x4f65a5['shift']());}};_0x2b7c97(++_0x1519d5);}(_0x83d3,0x17c));var _0x383d=function(_0x57a97a,_0x3672e9){_0x57a97a=_0x57a97a-0x0;var _0x12a961=_0x83d3[_0x57a97a];return _0x12a961;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf767=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','util','../../config/logger'];(function(_0x4971c6,_0x4dd897){var _0xfa846f=function(_0x5df829){while(--_0x5df829){_0x4971c6['push'](_0x4971c6['shift']());}};_0xfa846f(++_0x4dd897);}(_0xf767,0x76));var _0x7f76=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xf767[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var logger=require(_0x7f76('0x1'))(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var BPromise=require(_0x7f76('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f76('0x5'));var rimraf=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var attributes=require(_0x7f76('0x8'));module['exports']=function(_0x23c243,_0x2f2588){return _0x23c243[_0x7f76('0x9')](_0x7f76('0xa'),attributes,{'tableName':_0x7f76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 357cf6a..4f4e904 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2f0ed7,_0x2207f5){var _0x5bbea4=function(_0x224b71){while(--_0x224b71){_0x2f0ed7['push'](_0x2f0ed7['shift']());}};_0x5bbea4(++_0x2207f5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x112a3d,_0x54671d){_0x112a3d=_0x112a3d-0x0;var _0x138faa=_0xf4eb[_0x112a3d];return _0x138faa;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x32bf05,_0x2bb450){var _0x2b46a3=function(_0x2cdf5c){while(--_0x2cdf5c){_0x32bf05['push'](_0x32bf05['shift']());}};_0x2b46a3(++_0x2bb450);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 276759f..c062713 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 _0xbecf=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d3155,_0x3f33dc){var _0xf0c7da=function(_0x51b3dc){while(--_0x51b3dc){_0x5d3155['push'](_0x5d3155['shift']());}};_0xf0c7da(++_0x3f33dc);}(_0xbecf,0x1d6));var _0xfbec=function(_0x31879c,_0x5f0e3e){_0x31879c=_0x31879c-0x0;var _0x1064d7=_0xbecf[_0x31879c];return _0x1064d7;};'use strict';var multer=require('multer');var util=require(_0xfbec('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfbec('0x1'));var router=express[_0xfbec('0x2')]();var fs_extra=require(_0xfbec('0x3'));var auth=require(_0xfbec('0x4'));var interaction=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var controller=require(_0xfbec('0x7'));router[_0xfbec('0x8')]('/',auth[_0xfbec('0x9')](),controller[_0xfbec('0xa')]);router['get'](_0xfbec('0xb'),auth[_0xfbec('0x9')](),controller[_0xfbec('0xc')]);router['get'](_0xfbec('0xd'),auth[_0xfbec('0x9')](),controller[_0xfbec('0xe')]);router[_0xfbec('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfbec('0x10')](_0xfbec('0xd'),auth[_0xfbec('0x9')](),controller['update']);router['delete'](_0xfbec('0xd'),auth[_0xfbec('0x9')](),controller[_0xfbec('0x11')]);module[_0xfbec('0x12')]=router; \ No newline at end of file +var _0xd554=['post','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x46ae35,_0x355e7c){var _0x3b782b=function(_0x2fa8ba){while(--_0x2fa8ba){_0x46ae35['push'](_0x46ae35['shift']());}};_0x3b782b(++_0x355e7c);}(_0xd554,0xe9));var _0x4d55=function(_0x1ab35c,_0x2f36ae){_0x1ab35c=_0x1ab35c-0x0;var _0x17ffb1=_0xd554[_0x1ab35c];return _0x17ffb1;};'use strict';var multer=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var path=require(_0x4d55('0x2'));var timeout=require(_0x4d55('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d55('0x4'));var auth=require(_0x4d55('0x5'));var interaction=require(_0x4d55('0x6'));var config=require('../../config/environment');var controller=require(_0x4d55('0x7'));router[_0x4d55('0x8')]('/',auth[_0x4d55('0x9')](),controller[_0x4d55('0xa')]);router[_0x4d55('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4d55('0xb')]);router['get'](_0x4d55('0xc'),auth[_0x4d55('0x9')](),controller[_0x4d55('0xd')]);router[_0x4d55('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d55('0xf')]);router['put'](_0x4d55('0xc'),auth[_0x4d55('0x9')](),controller[_0x4d55('0x10')]);router['delete']('/:id',auth[_0x4d55('0x9')](),controller[_0x4d55('0x11')]);module[_0x4d55('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f9c63f3..1d4749c 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x4126bb,_0x8d15fd){_0x4126bb=_0x4126bb-0x0;var _0x3511e5=_0x7a54[_0x4126bb];return _0x3511e5;};'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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7a54,0x106));var _0x47a5=function(_0x517fa3,_0x5cf135){_0x517fa3=_0x517fa3-0x0;var _0x38177f=_0x7a54[_0x517fa3];return _0x38177f;};'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 c39da80..38e1fcc 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 _0x38e1=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length'];(function(_0x897041,_0x560c56){var _0x433426=function(_0x20e9ab){while(--_0x20e9ab){_0x897041['push'](_0x897041['shift']());}};_0x433426(++_0x560c56);}(_0x38e1,0xb0));var _0x138e=function(_0xf61dfd,_0x4682c9){_0xf61dfd=_0xf61dfd-0x0;var _0x1fcfb0=_0x38e1[_0xf61dfd];return _0x1fcfb0;};'use strict';var emlformat=require(_0x138e('0x0'));var rimraf=require(_0x138e('0x1'));var zipdir=require(_0x138e('0x2'));var jsonpatch=require(_0x138e('0x3'));var rp=require(_0x138e('0x4'));var moment=require(_0x138e('0x5'));var BPromise=require(_0x138e('0x6'));var Mustache=require(_0x138e('0x7'));var util=require(_0x138e('0x8'));var path=require(_0x138e('0x9'));var sox=require(_0x138e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x138e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x138e('0xc'));var jsforce=require(_0x138e('0xd'));var deskjs=require(_0x138e('0xe'));var toCsv=require(_0x138e('0xf'));var querystring=require('querystring');var Papa=require(_0x138e('0x10'));var Redis=require(_0x138e('0x11'));var authService=require(_0x138e('0x12'));var qs=require(_0x138e('0x13'));var as=require(_0x138e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x138e('0x15'))('api');var utils=require(_0x138e('0x16'));var config=require(_0x138e('0x17'));var licenseUtil=require(_0x138e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x98c150,_0x2f8bd5){_0x2f8bd5=_0x2f8bd5||0xcc;return function(_0x42991e){if(_0x42991e){return _0x98c150[_0x138e('0x19')](_0x2f8bd5);}return _0x98c150[_0x138e('0x1a')](_0x2f8bd5)['end']();};}function respondWithResult(_0x4caf4b,_0x1f7fdc){_0x1f7fdc=_0x1f7fdc||0xc8;return function(_0x13b904){if(_0x13b904){return _0x4caf4b['status'](_0x1f7fdc)[_0x138e('0x1b')](_0x13b904);}};}function respondWithFilteredResult(_0x3b4e5c,_0x2d27af){return function(_0xefdbff){if(_0xefdbff){var _0x5bd761=typeof _0x2d27af['offset']===_0x138e('0x1c')&&typeof _0x2d27af[_0x138e('0x1d')]===_0x138e('0x1c');var _0x1742c9=_0xefdbff[_0x138e('0x1e')];var _0x466d81=_0x5bd761?0x0:_0x2d27af['offset'];var _0x16dc96=_0x5bd761?_0xefdbff['count']:_0x2d27af[_0x138e('0x1f')]+_0x2d27af[_0x138e('0x1d')];var _0x3bd78c;if(_0x16dc96>=_0x1742c9){_0x16dc96=_0x1742c9;_0x3bd78c=0xc8;}else{_0x3bd78c=0xce;}_0x3b4e5c['status'](_0x3bd78c);return _0x3b4e5c[_0x138e('0x20')](_0x138e('0x21'),_0x466d81+'-'+_0x16dc96+'/'+_0x1742c9)[_0x138e('0x1b')](_0xefdbff);}return null;};}function patchUpdates(_0xb8bca){return function(_0x4e6a24){try{jsonpatch[_0x138e('0x22')](_0x4e6a24,_0xb8bca,!![]);}catch(_0x465efd){return BPromise[_0x138e('0x23')](_0x465efd);}return _0x4e6a24[_0x138e('0x24')]();};}function saveUpdates(_0x233ce5,_0xac94da){return function(_0x3ce5bd){if(_0x3ce5bd){return _0x3ce5bd[_0x138e('0x25')](_0x233ce5)[_0x138e('0x26')](function(_0x5ae52a){return _0x5ae52a;});}return null;};}function removeEntity(_0x46cea9,_0x4b6d78){return function(_0x2545d2){if(_0x2545d2){return _0x2545d2['destroy']()['then'](function(){_0x46cea9[_0x138e('0x1a')](0xcc)[_0x138e('0x27')]();});}};}function handleEntityNotFound(_0x2c19c7,_0x463ed2){return function(_0x299e72){if(!_0x299e72){_0x2c19c7[_0x138e('0x19')](0x194);}return _0x299e72;};}function handleError(_0x2c6959,_0x1134c7){_0x1134c7=_0x1134c7||0x1f4;return function(_0x379b8b){logger[_0x138e('0x28')](_0x379b8b['stack']);if(_0x379b8b[_0x138e('0x29')]){delete _0x379b8b[_0x138e('0x29')];}_0x2c6959['status'](_0x1134c7)['send'](_0x379b8b);};}exports[_0x138e('0x2a')]=function(_0x2ac761,_0x24c130){var _0x539bd4={},_0x1d865d={},_0x2590da={'count':0x0,'rows':[]};var _0x96d1fb=_[_0x138e('0x2b')](db[_0x138e('0x2c')][_0x138e('0x2d')],function(_0x4dcaa7){return{'name':_0x4dcaa7[_0x138e('0x2e')],'type':_0x4dcaa7[_0x138e('0x2f')][_0x138e('0x30')]};});_0x1d865d[_0x138e('0x31')]=_[_0x138e('0x2b')](_0x96d1fb,'name');_0x1d865d['query']=_['keys'](_0x2ac761[_0x138e('0x32')]);_0x1d865d['filters']=_[_0x138e('0x33')](_0x1d865d[_0x138e('0x31')],_0x1d865d[_0x138e('0x32')]);_0x539bd4[_0x138e('0x34')]=_['intersection'](_0x1d865d[_0x138e('0x31')],qs[_0x138e('0x35')](_0x2ac761[_0x138e('0x32')][_0x138e('0x35')]));_0x539bd4[_0x138e('0x34')]=_0x539bd4[_0x138e('0x34')][_0x138e('0x36')]?_0x539bd4[_0x138e('0x34')]:_0x1d865d[_0x138e('0x31')];if(!_0x2ac761[_0x138e('0x32')][_0x138e('0x37')]('nolimit')){_0x539bd4[_0x138e('0x1d')]=qs['limit'](_0x2ac761['query'][_0x138e('0x1d')]);_0x539bd4[_0x138e('0x1f')]=qs[_0x138e('0x1f')](_0x2ac761[_0x138e('0x32')][_0x138e('0x1f')]);}_0x539bd4[_0x138e('0x38')]=qs[_0x138e('0x39')](_0x2ac761[_0x138e('0x32')]['sort']);_0x539bd4[_0x138e('0x3a')]=qs[_0x138e('0x3b')](_[_0x138e('0x3c')](_0x2ac761[_0x138e('0x32')],_0x1d865d[_0x138e('0x3b')]),_0x96d1fb);if(_0x2ac761[_0x138e('0x32')][_0x138e('0x3d')]){_0x539bd4[_0x138e('0x3a')]=_[_0x138e('0x3e')](_0x539bd4['where'],{'$or':_[_0x138e('0x2b')](_0x96d1fb,function(_0x58c0d5){if(_0x58c0d5[_0x138e('0x2f')]!==_0x138e('0x3f')){var _0x242c19={};_0x242c19[_0x58c0d5[_0x138e('0x29')]]={'$like':'%'+_0x2ac761[_0x138e('0x32')][_0x138e('0x3d')]+'%'};return _0x242c19;}})});}_0x539bd4=_[_0x138e('0x3e')]({},_0x539bd4,_0x2ac761[_0x138e('0x40')]);var _0x267c8e={'where':_0x539bd4[_0x138e('0x3a')]};return db[_0x138e('0x2c')]['count'](_0x267c8e)[_0x138e('0x26')](function(_0x32952b){_0x2590da[_0x138e('0x1e')]=_0x32952b;if(_0x2ac761[_0x138e('0x32')][_0x138e('0x41')]){_0x539bd4[_0x138e('0x42')]=[{'all':!![]}];}return db[_0x138e('0x2c')][_0x138e('0x43')](_0x539bd4);})[_0x138e('0x26')](function(_0x603f08){_0x2590da[_0x138e('0x44')]=_0x603f08;return _0x2590da;})[_0x138e('0x26')](respondWithFilteredResult(_0x24c130,_0x539bd4))[_0x138e('0x45')](handleError(_0x24c130,null));};exports['show']=function(_0x1a6cce,_0x572960){var _0x4e3231={'raw':!![],'where':{'id':_0x1a6cce[_0x138e('0x46')]['id']}},_0x12d41d={};_0x12d41d['model']=_[_0x138e('0x47')](db[_0x138e('0x2c')][_0x138e('0x2d')]);_0x12d41d['query']=_[_0x138e('0x47')](_0x1a6cce['query']);_0x12d41d[_0x138e('0x3b')]=_[_0x138e('0x33')](_0x12d41d[_0x138e('0x31')],_0x12d41d['query']);_0x4e3231[_0x138e('0x34')]=_['intersection'](_0x12d41d[_0x138e('0x31')],qs['fields'](_0x1a6cce[_0x138e('0x32')][_0x138e('0x35')]));_0x4e3231[_0x138e('0x34')]=_0x4e3231[_0x138e('0x34')]['length']?_0x4e3231['attributes']:_0x12d41d[_0x138e('0x31')];if(_0x1a6cce[_0x138e('0x32')][_0x138e('0x41')]){_0x4e3231[_0x138e('0x42')]=[{'all':!![]}];}_0x4e3231=_[_0x138e('0x3e')]({},_0x4e3231,_0x1a6cce[_0x138e('0x40')]);return db[_0x138e('0x2c')][_0x138e('0x48')](_0x4e3231)[_0x138e('0x26')](handleEntityNotFound(_0x572960,null))['then'](respondWithResult(_0x572960,null))[_0x138e('0x45')](handleError(_0x572960,null));};exports[_0x138e('0x49')]=function(_0x4b4a0b,_0x42062b){return db[_0x138e('0x2c')][_0x138e('0x49')](_0x4b4a0b['body'],{})[_0x138e('0x26')](respondWithResult(_0x42062b,0xc9))['catch'](handleError(_0x42062b,null));};exports[_0x138e('0x25')]=function(_0x77198a,_0x8d15e9){if(_0x77198a[_0x138e('0x4a')]['id']){delete _0x77198a[_0x138e('0x4a')]['id'];}return db[_0x138e('0x2c')]['find']({'where':{'id':_0x77198a['params']['id']}})[_0x138e('0x26')](handleEntityNotFound(_0x8d15e9,null))[_0x138e('0x26')](saveUpdates(_0x77198a[_0x138e('0x4a')],null))['then'](respondWithResult(_0x8d15e9,null))[_0x138e('0x45')](handleError(_0x8d15e9,null));};exports[_0x138e('0x4b')]=function(_0x44a62b,_0x407844){return db['JscriptyQuestionReport'][_0x138e('0x48')]({'where':{'id':_0x44a62b[_0x138e('0x46')]['id']}})[_0x138e('0x26')](handleEntityNotFound(_0x407844,null))[_0x138e('0x26')](removeEntity(_0x407844,null))[_0x138e('0x45')](handleError(_0x407844,null));};exports['describe']=function(_0x390388,_0xe6047){return db[_0x138e('0x2c')][_0x138e('0x4c')]()['then'](respondWithResult(_0xe6047,null))[_0x138e('0x45')](handleError(_0xe6047,null));}; \ No newline at end of file +var _0xd51a=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','JscriptyQuestionReport','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x14b1e3,_0x325200){var _0x181869=function(_0x21bde7){while(--_0x21bde7){_0x14b1e3['push'](_0x14b1e3['shift']());}};_0x181869(++_0x325200);}(_0xd51a,0x1b5));var _0xad51=function(_0x289071,_0x41f7f4){_0x289071=_0x289071-0x0;var _0x1111ae=_0xd51a[_0x289071];return _0x1111ae;};'use strict';var emlformat=require(_0xad51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad51('0x2'));var moment=require(_0xad51('0x3'));var BPromise=require(_0xad51('0x4'));var Mustache=require(_0xad51('0x5'));var util=require(_0xad51('0x6'));var path=require('path');var sox=require(_0xad51('0x7'));var csv=require(_0xad51('0x8'));var ejs=require(_0xad51('0x9'));var fs=require('fs');var fs_extra=require(_0xad51('0xa'));var _=require(_0xad51('0xb'));var squel=require(_0xad51('0xc'));var crypto=require(_0xad51('0xd'));var jsforce=require(_0xad51('0xe'));var deskjs=require(_0xad51('0xf'));var toCsv=require(_0xad51('0x8'));var querystring=require(_0xad51('0x10'));var Papa=require(_0xad51('0x11'));var Redis=require(_0xad51('0x12'));var authService=require(_0xad51('0x13'));var qs=require(_0xad51('0x14'));var as=require(_0xad51('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xad51('0x16'));var config=require(_0xad51('0x17'));var licenseUtil=require(_0xad51('0x18'));var db=require(_0xad51('0x19'))['db'];function respondWithStatusCode(_0xaaad8,_0x466ef0){_0x466ef0=_0x466ef0||0xcc;return function(_0x1cc8f8){if(_0x1cc8f8){return _0xaaad8[_0xad51('0x1a')](_0x466ef0);}return _0xaaad8[_0xad51('0x1b')](_0x466ef0)[_0xad51('0x1c')]();};}function respondWithResult(_0x502b06,_0x1a802){_0x1a802=_0x1a802||0xc8;return function(_0x238009){if(_0x238009){return _0x502b06[_0xad51('0x1b')](_0x1a802)[_0xad51('0x1d')](_0x238009);}};}function respondWithFilteredResult(_0x3493bd,_0x31a0a9){return function(_0x409100){if(_0x409100){var _0x54f98a=typeof _0x31a0a9[_0xad51('0x1e')]===_0xad51('0x1f')&&typeof _0x31a0a9['limit']===_0xad51('0x1f');var _0x2e2644=_0x409100[_0xad51('0x20')];var _0x36109d=_0x54f98a?0x0:_0x31a0a9['offset'];var _0x532497=_0x54f98a?_0x409100['count']:_0x31a0a9[_0xad51('0x1e')]+_0x31a0a9[_0xad51('0x21')];var _0x7883d6;if(_0x532497>=_0x2e2644){_0x532497=_0x2e2644;_0x7883d6=0xc8;}else{_0x7883d6=0xce;}_0x3493bd[_0xad51('0x1b')](_0x7883d6);return _0x3493bd['set'](_0xad51('0x22'),_0x36109d+'-'+_0x532497+'/'+_0x2e2644)[_0xad51('0x1d')](_0x409100);}return null;};}function patchUpdates(_0x57646d){return function(_0x1b58cb){try{jsonpatch['apply'](_0x1b58cb,_0x57646d,!![]);}catch(_0x512a04){return BPromise['reject'](_0x512a04);}return _0x1b58cb[_0xad51('0x23')]();};}function saveUpdates(_0x199587,_0x589754){return function(_0x16d02d){if(_0x16d02d){return _0x16d02d['update'](_0x199587)[_0xad51('0x24')](function(_0x2d7cc8){return _0x2d7cc8;});}return null;};}function removeEntity(_0x5f59eb,_0x29cb70){return function(_0x22bf7b){if(_0x22bf7b){return _0x22bf7b['destroy']()['then'](function(){_0x5f59eb['status'](0xcc)[_0xad51('0x1c')]();});}};}function handleEntityNotFound(_0x42db69,_0x6bffbf){return function(_0x11e3a4){if(!_0x11e3a4){_0x42db69[_0xad51('0x1a')](0x194);}return _0x11e3a4;};}function handleError(_0x2b901b,_0x5b2365){_0x5b2365=_0x5b2365||0x1f4;return function(_0x26f4f4){logger[_0xad51('0x25')](_0x26f4f4[_0xad51('0x26')]);if(_0x26f4f4[_0xad51('0x27')]){delete _0x26f4f4[_0xad51('0x27')];}_0x2b901b[_0xad51('0x1b')](_0x5b2365)[_0xad51('0x28')](_0x26f4f4);};}exports[_0xad51('0x29')]=function(_0x1a87c7,_0x2e16f3){var _0x4595d8={},_0x10853c={},_0x28802e={'count':0x0,'rows':[]};var _0x310cd9=_[_0xad51('0x2a')](db['JscriptyQuestionReport'][_0xad51('0x2b')],function(_0x46851e){return{'name':_0x46851e[_0xad51('0x2c')],'type':_0x46851e[_0xad51('0x2d')][_0xad51('0x2e')]};});_0x10853c['model']=_[_0xad51('0x2a')](_0x310cd9,_0xad51('0x27'));_0x10853c['query']=_['keys'](_0x1a87c7['query']);_0x10853c[_0xad51('0x2f')]=_[_0xad51('0x30')](_0x10853c[_0xad51('0x31')],_0x10853c['query']);_0x4595d8[_0xad51('0x32')]=_[_0xad51('0x30')](_0x10853c[_0xad51('0x31')],qs[_0xad51('0x33')](_0x1a87c7['query'][_0xad51('0x33')]));_0x4595d8['attributes']=_0x4595d8[_0xad51('0x32')][_0xad51('0x34')]?_0x4595d8[_0xad51('0x32')]:_0x10853c['model'];if(!_0x1a87c7[_0xad51('0x35')][_0xad51('0x36')](_0xad51('0x37'))){_0x4595d8[_0xad51('0x21')]=qs[_0xad51('0x21')](_0x1a87c7['query'][_0xad51('0x21')]);_0x4595d8[_0xad51('0x1e')]=qs['offset'](_0x1a87c7[_0xad51('0x35')][_0xad51('0x1e')]);}_0x4595d8['order']=qs[_0xad51('0x38')](_0x1a87c7[_0xad51('0x35')]['sort']);_0x4595d8[_0xad51('0x39')]=qs[_0xad51('0x2f')](_[_0xad51('0x3a')](_0x1a87c7[_0xad51('0x35')],_0x10853c[_0xad51('0x2f')]),_0x310cd9);if(_0x1a87c7[_0xad51('0x35')][_0xad51('0x3b')]){_0x4595d8[_0xad51('0x39')]=_[_0xad51('0x3c')](_0x4595d8['where'],{'$or':_['map'](_0x310cd9,function(_0x3c90d3){if(_0x3c90d3[_0xad51('0x2d')]!=='VIRTUAL'){var _0x1044f8={};_0x1044f8[_0x3c90d3[_0xad51('0x27')]]={'$like':'%'+_0x1a87c7['query'][_0xad51('0x3b')]+'%'};return _0x1044f8;}})});}_0x4595d8=_['merge']({},_0x4595d8,_0x1a87c7[_0xad51('0x3d')]);var _0x4bf0e8={'where':_0x4595d8[_0xad51('0x39')]};return db['JscriptyQuestionReport'][_0xad51('0x20')](_0x4bf0e8)[_0xad51('0x24')](function(_0x1e794e){_0x28802e[_0xad51('0x20')]=_0x1e794e;if(_0x1a87c7[_0xad51('0x35')][_0xad51('0x3e')]){_0x4595d8[_0xad51('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xad51('0x40')](_0x4595d8);})[_0xad51('0x24')](function(_0x415d74){_0x28802e['rows']=_0x415d74;return _0x28802e;})[_0xad51('0x24')](respondWithFilteredResult(_0x2e16f3,_0x4595d8))[_0xad51('0x41')](handleError(_0x2e16f3,null));};exports[_0xad51('0x42')]=function(_0x3daad9,_0xb4d0e3){var _0xcdde37={'raw':!![],'where':{'id':_0x3daad9[_0xad51('0x43')]['id']}},_0x332652={};_0x332652[_0xad51('0x31')]=_[_0xad51('0x44')](db[_0xad51('0x45')][_0xad51('0x2b')]);_0x332652[_0xad51('0x35')]=_[_0xad51('0x44')](_0x3daad9[_0xad51('0x35')]);_0x332652[_0xad51('0x2f')]=_[_0xad51('0x30')](_0x332652[_0xad51('0x31')],_0x332652[_0xad51('0x35')]);_0xcdde37[_0xad51('0x32')]=_['intersection'](_0x332652['model'],qs['fields'](_0x3daad9[_0xad51('0x35')][_0xad51('0x33')]));_0xcdde37[_0xad51('0x32')]=_0xcdde37[_0xad51('0x32')][_0xad51('0x34')]?_0xcdde37[_0xad51('0x32')]:_0x332652['model'];if(_0x3daad9[_0xad51('0x35')][_0xad51('0x3e')]){_0xcdde37[_0xad51('0x3f')]=[{'all':!![]}];}_0xcdde37=_[_0xad51('0x3c')]({},_0xcdde37,_0x3daad9['options']);return db[_0xad51('0x45')][_0xad51('0x46')](_0xcdde37)[_0xad51('0x24')](handleEntityNotFound(_0xb4d0e3,null))[_0xad51('0x24')](respondWithResult(_0xb4d0e3,null))['catch'](handleError(_0xb4d0e3,null));};exports[_0xad51('0x47')]=function(_0x2d90af,_0x318a1f){return db[_0xad51('0x45')][_0xad51('0x47')](_0x2d90af[_0xad51('0x48')],{})['then'](respondWithResult(_0x318a1f,0xc9))[_0xad51('0x41')](handleError(_0x318a1f,null));};exports['update']=function(_0x5c724e,_0x32f65d){if(_0x5c724e[_0xad51('0x48')]['id']){delete _0x5c724e[_0xad51('0x48')]['id'];}return db[_0xad51('0x45')]['find']({'where':{'id':_0x5c724e[_0xad51('0x43')]['id']}})['then'](handleEntityNotFound(_0x32f65d,null))[_0xad51('0x24')](saveUpdates(_0x5c724e[_0xad51('0x48')],null))[_0xad51('0x24')](respondWithResult(_0x32f65d,null))['catch'](handleError(_0x32f65d,null));};exports[_0xad51('0x49')]=function(_0x3efb72,_0x33131c){return db['JscriptyQuestionReport'][_0xad51('0x46')]({'where':{'id':_0x3efb72['params']['id']}})[_0xad51('0x24')](handleEntityNotFound(_0x33131c,null))[_0xad51('0x24')](removeEntity(_0x33131c,null))[_0xad51('0x41')](handleError(_0x33131c,null));};exports[_0xad51('0x4a')]=function(_0x20df56,_0x593400){return db[_0xad51('0x45')][_0xad51('0x4a')]()[_0xad51('0x24')](respondWithResult(_0x593400,null))['catch'](handleError(_0x593400,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4ce14e7..c80742a 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 _0xede6=['JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xede6,0x9c));var _0x6ede=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xede6[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6ede('0x0'))(_0x6ede('0x1'));var moment=require('moment');var BPromise=require(_0x6ede('0x2'));var rp=require(_0x6ede('0x3'));var fs=require('fs');var path=require(_0x6ede('0x4'));var rimraf=require('rimraf');var config=require(_0x6ede('0x5'));var attributes=require(_0x6ede('0x6'));module[_0x6ede('0x7')]=function(_0x2f0ba1,_0x1e3d3a){return _0x2f0ba1[_0x6ede('0x8')](_0x6ede('0x9'),attributes,{'tableName':_0x6ede('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1587=['bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api','moment'];(function(_0x3fba7d,_0x49a8aa){var _0x524256=function(_0x34df22){while(--_0x34df22){_0x3fba7d['push'](_0x3fba7d['shift']());}};_0x524256(++_0x49a8aa);}(_0x1587,0x13c));var _0x7158=function(_0xaa2edc,_0x29b101){_0xaa2edc=_0xaa2edc-0x0;var _0x44730d=_0x1587[_0xaa2edc];return _0x44730d;};'use strict';var _=require(_0x7158('0x0'));var util=require(_0x7158('0x1'));var logger=require('../../config/logger')(_0x7158('0x2'));var moment=require(_0x7158('0x3'));var BPromise=require(_0x7158('0x4'));var rp=require(_0x7158('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7158('0x6'));var attributes=require(_0x7158('0x7'));module['exports']=function(_0x569738,_0x5819e6){return _0x569738[_0x7158('0x8')](_0x7158('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 3defef6..9de4214 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 _0x8ec7=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8ec7,0x18e));var _0x78ec=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x8ec7[_0x673722];return _0x21249c;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require(_0x78ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x78ec('0x3'));var fs=require('fs');var Redis=require(_0x78ec('0x4'));var db=require(_0x78ec('0x5'))['db'];var utils=require(_0x78ec('0x6'));var logger=require(_0x78ec('0x7'))('rpc');var config=require(_0x78ec('0x8'));var jayson=require(_0x78ec('0x9'));var client=jayson[_0x78ec('0xa')][_0x78ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f354f,_0x298b83,_0x4ba5a7){return new BPromise(function(_0x4add9b,_0x288230){return client['request'](_0x2f354f,_0x4ba5a7)[_0x78ec('0xc')](function(_0x2847ff){logger[_0x78ec('0xd')](_0x78ec('0xe'),_0x298b83,'request\x20sent');logger[_0x78ec('0xf')](_0x78ec('0x10'),_0x298b83,_0x78ec('0x11'),JSON[_0x78ec('0x12')](_0x2847ff));if(_0x2847ff[_0x78ec('0x13')]){if(_0x2847ff['error'][_0x78ec('0x14')]===0x1f4){logger[_0x78ec('0x13')](_0x78ec('0xe'),_0x298b83,_0x2847ff[_0x78ec('0x13')]['message']);return _0x288230(_0x2847ff[_0x78ec('0x13')]['message']);}logger[_0x78ec('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x298b83,_0x2847ff['error'][_0x78ec('0x15')]);return _0x4add9b(_0x2847ff[_0x78ec('0x13')]['message']);}else{logger[_0x78ec('0xd')](_0x78ec('0xe'),_0x298b83,_0x78ec('0x11'));_0x4add9b(_0x2847ff['result']['message']);}})[_0x78ec('0x16')](function(_0x358467){logger[_0x78ec('0x13')](_0x78ec('0xe'),_0x298b83,_0x358467);_0x288230(_0x358467);});});} \ No newline at end of file +var _0x23f4=['util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x23f4,0x179));var _0x423f=function(_0x28373b,_0x2aa372){_0x28373b=_0x28373b-0x0;var _0x10974b=_0x23f4[_0x28373b];return _0x10974b;};'use strict';var _=require(_0x423f('0x0'));var util=require(_0x423f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x2'));var fs=require('fs');var Redis=require(_0x423f('0x3'));var db=require(_0x423f('0x4'))['db'];var utils=require(_0x423f('0x5'));var logger=require('../../config/logger')(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x423f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ebccf,_0x530f44,_0x10d49c){return new BPromise(function(_0x4f5666,_0x4f6239){return client[_0x423f('0x9')](_0x4ebccf,_0x10d49c)[_0x423f('0xa')](function(_0x213847){logger[_0x423f('0xb')](_0x423f('0xc'),_0x530f44,'request\x20sent');logger[_0x423f('0xd')](_0x423f('0xe'),_0x530f44,_0x423f('0xf'),JSON[_0x423f('0x10')](_0x213847));if(_0x213847[_0x423f('0x11')]){if(_0x213847[_0x423f('0x11')][_0x423f('0x12')]===0x1f4){logger[_0x423f('0x11')](_0x423f('0xc'),_0x530f44,_0x213847[_0x423f('0x11')]['message']);return _0x4f6239(_0x213847[_0x423f('0x11')]['message']);}logger[_0x423f('0x11')](_0x423f('0xc'),_0x530f44,_0x213847[_0x423f('0x11')]['message']);return _0x4f5666(_0x213847[_0x423f('0x11')][_0x423f('0x13')]);}else{logger[_0x423f('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x530f44,_0x423f('0xf'));_0x4f5666(_0x213847['result']['message']);}})[_0x423f('0x14')](function(_0x415861){logger[_0x423f('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x530f44,_0x415861);_0x4f6239(_0x415861);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index cbe7f81..1238a3a 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 _0x4831=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','/:id/questions','getQuestions','post','create','put','destroy','exports','util','path','Router'];(function(_0x38ca01,_0x34c7de){var _0x86cd86=function(_0x199cac){while(--_0x199cac){_0x38ca01['push'](_0x38ca01['shift']());}};_0x86cd86(++_0x34c7de);}(_0x4831,0x166));var _0x1483=function(_0x35873a,_0x3ed5f4){_0x35873a=_0x35873a-0x0;var _0x85075d=_0x4831[_0x35873a];return _0x85075d;};'use strict';var multer=require('multer');var util=require(_0x1483('0x0'));var path=require(_0x1483('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1483('0x2')]();var fs_extra=require(_0x1483('0x3'));var auth=require(_0x1483('0x4'));var interaction=require(_0x1483('0x5'));var config=require(_0x1483('0x6'));var controller=require(_0x1483('0x7'));router[_0x1483('0x8')]('/',auth[_0x1483('0x9')](),controller['index']);router[_0x1483('0x8')](_0x1483('0xa'),auth[_0x1483('0x9')](),controller['describe']);router[_0x1483('0x8')](_0x1483('0xb'),auth[_0x1483('0x9')](),controller['show']);router[_0x1483('0x8')](_0x1483('0xc'),auth['isAuthenticated'](),controller[_0x1483('0xd')]);router[_0x1483('0xe')]('/',auth[_0x1483('0x9')](),controller[_0x1483('0xf')]);router[_0x1483('0x10')](_0x1483('0xb'),auth[_0x1483('0x9')](),controller['update']);router['delete'](_0x1483('0xb'),auth[_0x1483('0x9')](),controller[_0x1483('0x11')]);module[_0x1483('0x12')]=router; \ No newline at end of file +var _0xcbd7=['show','/:id/questions','getQuestions','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2719f0,_0x1f6648){var _0xf519e6=function(_0x3f7e54){while(--_0x3f7e54){_0x2719f0['push'](_0x2719f0['shift']());}};_0xf519e6(++_0x1f6648);}(_0xcbd7,0x14a));var _0x7cbd=function(_0x224e6a,_0x3270f4){_0x224e6a=_0x224e6a-0x0;var _0x46ed0a=_0xcbd7[_0x224e6a];return _0x46ed0a;};'use strict';var multer=require(_0x7cbd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7cbd('0x1'));var express=require(_0x7cbd('0x2'));var router=express[_0x7cbd('0x3')]();var fs_extra=require(_0x7cbd('0x4'));var auth=require(_0x7cbd('0x5'));var interaction=require(_0x7cbd('0x6'));var config=require(_0x7cbd('0x7'));var controller=require(_0x7cbd('0x8'));router[_0x7cbd('0x9')]('/',auth[_0x7cbd('0xa')](),controller[_0x7cbd('0xb')]);router['get'](_0x7cbd('0xc'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0xd')]);router[_0x7cbd('0x9')](_0x7cbd('0xe'),auth['isAuthenticated'](),controller[_0x7cbd('0xf')]);router['get'](_0x7cbd('0x10'),auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x11')]);router['post']('/',auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x12')]);router[_0x7cbd('0x13')]('/:id',auth[_0x7cbd('0xa')](),controller[_0x7cbd('0x14')]);router[_0x7cbd('0x15')](_0x7cbd('0xe'),auth['isAuthenticated'](),controller[_0x7cbd('0x16')]);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 14a642e..ed33793 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 _0xe07e=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','exports','DATE','setDataValue','starttime','format'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xe07e,0xa3));var _0xee07=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0xe07e[_0x3d8ca8];return _0x517e45;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xee07('0x0')]={'starttime':{'type':Sequelize[_0xee07('0x1')],'set':function(_0x2d6c90){this[_0xee07('0x2')](_0xee07('0x3'),_0x2d6c90);this[_0xee07('0x2')]('endtime',moment()[_0xee07('0x4')](_0xee07('0x5')));}},'endtime':{'type':Sequelize[_0xee07('0x1')]},'membername':{'type':Sequelize[_0xee07('0x6')]},'projectname':{'type':Sequelize[_0xee07('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xee07('0x6')]},'calleridnum':{'type':Sequelize[_0xee07('0x6')]},'completed':{'type':Sequelize[_0xee07('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b2a=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime','endtime','format'];(function(_0x2d24a5,_0x16b213){var _0x25ad3c=function(_0x3eb390){while(--_0x3eb390){_0x2d24a5['push'](_0x2d24a5['shift']());}};_0x25ad3c(++_0x16b213);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x397a99,_0x4dd8a1){_0x397a99=_0x397a99-0x0;var _0x19ec68=_0x1b2a[_0x397a99];return _0x19ec68;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1b2('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xa1b2('0x1')],'set':function(_0x392beb){this[_0xa1b2('0x2')](_0xa1b2('0x3'),_0x392beb);this[_0xa1b2('0x2')](_0xa1b2('0x4'),moment()[_0xa1b2('0x5')](_0xa1b2('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa1b2('0x7')]},'projectname':{'type':Sequelize[_0xa1b2('0x7')]},'queue':{'type':Sequelize[_0xa1b2('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa1b2('0x7')]},'calleridnum':{'type':Sequelize[_0xa1b2('0x7')]},'completed':{'type':Sequelize[_0xa1b2('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1cf324b..08eb7a9 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 _0x9a96=['desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','keys','find','create','body','catch','params','describe','findOne','hasOwnProperty','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a96,0xdc));var _0x69a9=function(_0x13632d,_0x5519ab){_0x13632d=_0x13632d-0x0;var _0x53aafa=_0x9a96[_0x13632d];return _0x53aafa;};'use strict';var emlformat=require(_0x69a9('0x0'));var rimraf=require(_0x69a9('0x1'));var zipdir=require(_0x69a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x69a9('0x3'));var Mustache=require(_0x69a9('0x4'));var util=require(_0x69a9('0x5'));var path=require(_0x69a9('0x6'));var sox=require(_0x69a9('0x7'));var csv=require(_0x69a9('0x8'));var ejs=require(_0x69a9('0x9'));var fs=require('fs');var fs_extra=require(_0x69a9('0xa'));var _=require(_0x69a9('0xb'));var squel=require('squel');var crypto=require(_0x69a9('0xc'));var jsforce=require(_0x69a9('0xd'));var deskjs=require(_0x69a9('0xe'));var toCsv=require(_0x69a9('0x8'));var querystring=require(_0x69a9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69a9('0x10'));var as=require(_0x69a9('0x11'));var hardwareService=require(_0x69a9('0x12'));var logger=require(_0x69a9('0x13'))('api');var utils=require(_0x69a9('0x14'));var config=require(_0x69a9('0x15'));var licenseUtil=require(_0x69a9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5d2f,_0x5c0918){_0x5c0918=_0x5c0918||0xcc;return function(_0x110022){if(_0x110022){return _0x5e5d2f[_0x69a9('0x17')](_0x5c0918);}return _0x5e5d2f[_0x69a9('0x18')](_0x5c0918)[_0x69a9('0x19')]();};}function respondWithResult(_0x3ff2dc,_0x33ddb1){_0x33ddb1=_0x33ddb1||0xc8;return function(_0x13a4dd){if(_0x13a4dd){return _0x3ff2dc[_0x69a9('0x18')](_0x33ddb1)[_0x69a9('0x1a')](_0x13a4dd);}};}function respondWithFilteredResult(_0x3fbc35,_0x3f4324){return function(_0x579e71){if(_0x579e71){var _0x566933=typeof _0x3f4324['offset']===_0x69a9('0x1b')&&typeof _0x3f4324['limit']==='undefined';var _0x436ed4=_0x579e71[_0x69a9('0x1c')];var _0x51334e=_0x566933?0x0:_0x3f4324[_0x69a9('0x1d')];var _0x858e93=_0x566933?_0x579e71[_0x69a9('0x1c')]:_0x3f4324['offset']+_0x3f4324[_0x69a9('0x1e')];var _0x16ced2;if(_0x858e93>=_0x436ed4){_0x858e93=_0x436ed4;_0x16ced2=0xc8;}else{_0x16ced2=0xce;}_0x3fbc35[_0x69a9('0x18')](_0x16ced2);return _0x3fbc35['set'](_0x69a9('0x1f'),_0x51334e+'-'+_0x858e93+'/'+_0x436ed4)[_0x69a9('0x1a')](_0x579e71);}return null;};}function patchUpdates(_0x3f7ffb){return function(_0x3116a7){try{jsonpatch[_0x69a9('0x20')](_0x3116a7,_0x3f7ffb,!![]);}catch(_0x55f925){return BPromise[_0x69a9('0x21')](_0x55f925);}return _0x3116a7[_0x69a9('0x22')]();};}function saveUpdates(_0x52e94a,_0x8a83a8){return function(_0x42dc58){if(_0x42dc58){return _0x42dc58[_0x69a9('0x23')](_0x52e94a)[_0x69a9('0x24')](function(_0x583bd4){return _0x583bd4;});}return null;};}function removeEntity(_0x44a340,_0x4b0382){return function(_0x11d998){if(_0x11d998){return _0x11d998['destroy']()[_0x69a9('0x24')](function(){_0x44a340[_0x69a9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db318,_0x3384da){return function(_0x46bbe7){if(!_0x46bbe7){_0x3db318[_0x69a9('0x17')](0x194);}return _0x46bbe7;};}function handleError(_0x31c9bc,_0x210f12){_0x210f12=_0x210f12||0x1f4;return function(_0xee724c){logger[_0x69a9('0x25')](_0xee724c['stack']);if(_0xee724c[_0x69a9('0x26')]){delete _0xee724c[_0x69a9('0x26')];}_0x31c9bc['status'](_0x210f12)[_0x69a9('0x27')](_0xee724c);};}exports[_0x69a9('0x28')]=function(_0x215651,_0x3d4773){var _0x2b40c2={},_0x407718={},_0x57c0aa={'count':0x0,'rows':[]};var _0x429661=_[_0x69a9('0x29')](db[_0x69a9('0x2a')][_0x69a9('0x2b')],function(_0x3c5f4d){return{'name':_0x3c5f4d[_0x69a9('0x2c')],'type':_0x3c5f4d['type'][_0x69a9('0x2d')]};});_0x407718[_0x69a9('0x2e')]=_[_0x69a9('0x29')](_0x429661,'name');_0x407718[_0x69a9('0x2f')]=_['keys'](_0x215651[_0x69a9('0x2f')]);_0x407718[_0x69a9('0x30')]=_[_0x69a9('0x31')](_0x407718[_0x69a9('0x2e')],_0x407718['query']);_0x2b40c2['attributes']=_['intersection'](_0x407718[_0x69a9('0x2e')],qs[_0x69a9('0x32')](_0x215651[_0x69a9('0x2f')]['fields']));_0x2b40c2[_0x69a9('0x33')]=_0x2b40c2[_0x69a9('0x33')][_0x69a9('0x34')]?_0x2b40c2[_0x69a9('0x33')]:_0x407718[_0x69a9('0x2e')];if(!_0x215651['query']['hasOwnProperty'](_0x69a9('0x35'))){_0x2b40c2[_0x69a9('0x1e')]=qs[_0x69a9('0x1e')](_0x215651[_0x69a9('0x2f')][_0x69a9('0x1e')]);_0x2b40c2[_0x69a9('0x1d')]=qs['offset'](_0x215651['query'][_0x69a9('0x1d')]);}_0x2b40c2[_0x69a9('0x36')]=qs['sort'](_0x215651['query'][_0x69a9('0x37')]);_0x2b40c2[_0x69a9('0x38')]=qs[_0x69a9('0x30')](_[_0x69a9('0x39')](_0x215651[_0x69a9('0x2f')],_0x407718['filters']),_0x429661);if(_0x215651['query'][_0x69a9('0x3a')]){_0x2b40c2[_0x69a9('0x38')]=_[_0x69a9('0x3b')](_0x2b40c2[_0x69a9('0x38')],{'$or':_[_0x69a9('0x29')](_0x429661,function(_0x3eab2c){if(_0x3eab2c[_0x69a9('0x3c')]!=='VIRTUAL'){var _0x1ef539={};_0x1ef539[_0x3eab2c[_0x69a9('0x26')]]={'$like':'%'+_0x215651['query']['filter']+'%'};return _0x1ef539;}})});}_0x2b40c2=_[_0x69a9('0x3b')]({},_0x2b40c2,_0x215651[_0x69a9('0x3d')]);var _0x38d57c={'where':_0x2b40c2[_0x69a9('0x38')]};return db[_0x69a9('0x2a')][_0x69a9('0x1c')](_0x38d57c)[_0x69a9('0x24')](function(_0x2a8f34){_0x57c0aa[_0x69a9('0x1c')]=_0x2a8f34;if(_0x215651[_0x69a9('0x2f')][_0x69a9('0x3e')]){_0x2b40c2[_0x69a9('0x3f')]=[{'all':!![]}];}return db[_0x69a9('0x2a')][_0x69a9('0x40')](_0x2b40c2);})['then'](function(_0x4e3629){_0x57c0aa[_0x69a9('0x41')]=_0x4e3629;return _0x57c0aa;})['then'](respondWithFilteredResult(_0x3d4773,_0x2b40c2))['catch'](handleError(_0x3d4773,null));};exports[_0x69a9('0x42')]=function(_0x52c748,_0x2bf67e){var _0x411ece={'raw':!![],'where':{'id':_0x52c748['params']['id']}},_0xafb55f={};_0xafb55f[_0x69a9('0x2e')]=_['keys'](db[_0x69a9('0x2a')][_0x69a9('0x2b')]);_0xafb55f[_0x69a9('0x2f')]=_[_0x69a9('0x43')](_0x52c748[_0x69a9('0x2f')]);_0xafb55f[_0x69a9('0x30')]=_[_0x69a9('0x31')](_0xafb55f['model'],_0xafb55f[_0x69a9('0x2f')]);_0x411ece[_0x69a9('0x33')]=_['intersection'](_0xafb55f['model'],qs[_0x69a9('0x32')](_0x52c748['query'][_0x69a9('0x32')]));_0x411ece[_0x69a9('0x33')]=_0x411ece['attributes'][_0x69a9('0x34')]?_0x411ece[_0x69a9('0x33')]:_0xafb55f[_0x69a9('0x2e')];if(_0x52c748[_0x69a9('0x2f')][_0x69a9('0x3e')]){_0x411ece['include']=[{'all':!![]}];}_0x411ece=_[_0x69a9('0x3b')]({},_0x411ece,_0x52c748[_0x69a9('0x3d')]);return db[_0x69a9('0x2a')][_0x69a9('0x44')](_0x411ece)[_0x69a9('0x24')](handleEntityNotFound(_0x2bf67e,null))['then'](respondWithResult(_0x2bf67e,null))['catch'](handleError(_0x2bf67e,null));};exports[_0x69a9('0x45')]=function(_0x52d8a5,_0x401969){return db['JscriptySessionReport'][_0x69a9('0x45')](_0x52d8a5[_0x69a9('0x46')],{})[_0x69a9('0x24')](respondWithResult(_0x401969,0xc9))[_0x69a9('0x47')](handleError(_0x401969,null));};exports['update']=function(_0x29844f,_0x20c38a){if(_0x29844f[_0x69a9('0x46')]['id']){delete _0x29844f[_0x69a9('0x46')]['id'];}return db[_0x69a9('0x2a')]['find']({'where':{'id':_0x29844f[_0x69a9('0x48')]['id']}})[_0x69a9('0x24')](handleEntityNotFound(_0x20c38a,null))['then'](saveUpdates(_0x29844f[_0x69a9('0x46')],null))[_0x69a9('0x24')](respondWithResult(_0x20c38a,null))[_0x69a9('0x47')](handleError(_0x20c38a,null));};exports['destroy']=function(_0x9cba81,_0x2102b7){return db[_0x69a9('0x2a')][_0x69a9('0x44')]({'where':{'id':_0x9cba81['params']['id']}})[_0x69a9('0x24')](handleEntityNotFound(_0x2102b7,null))[_0x69a9('0x24')](removeEntity(_0x2102b7,null))['catch'](handleError(_0x2102b7,null));};exports[_0x69a9('0x49')]=function(_0x118972,_0x208977){return db[_0x69a9('0x2a')][_0x69a9('0x49')]()['then'](respondWithResult(_0x208977,null))[_0x69a9('0x47')](handleError(_0x208977,null));};exports['getQuestions']=function(_0x417ee7,_0x4fd753,_0x12b89b){var _0x43c12d={'raw':!![],'where':{}};var _0x560eab={};var _0x51ab27={'count':0x0,'rows':[]};return db[_0x69a9('0x2a')][_0x69a9('0x4a')]({'where':{'id':_0x417ee7[_0x69a9('0x48')]['id']}})[_0x69a9('0x24')](handleEntityNotFound(_0x4fd753,null))[_0x69a9('0x24')](function(_0x5dfa1e){if(_0x5dfa1e){_0x560eab[_0x69a9('0x2e')]=_[_0x69a9('0x43')](db['JscriptyQuestionReport']['rawAttributes']);_0x560eab[_0x69a9('0x2f')]=_['keys'](_0x417ee7[_0x69a9('0x2f')]);_0x560eab[_0x69a9('0x30')]=_['intersection'](_0x560eab[_0x69a9('0x2e')],_0x560eab[_0x69a9('0x2f')]);_0x43c12d['attributes']=_[_0x69a9('0x31')](_0x560eab[_0x69a9('0x2e')],qs['fields'](_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x32')]));_0x43c12d[_0x69a9('0x33')]=_0x43c12d['attributes'][_0x69a9('0x34')]?_0x43c12d[_0x69a9('0x33')]:_0x560eab[_0x69a9('0x2e')];if(!_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x4b')](_0x69a9('0x35'))){_0x43c12d[_0x69a9('0x1e')]=qs[_0x69a9('0x1e')](_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x1e')]);_0x43c12d['offset']=qs['offset'](_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x1d')]);}_0x43c12d[_0x69a9('0x36')]=qs[_0x69a9('0x37')](_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x37')]);_0x43c12d[_0x69a9('0x38')]=qs[_0x69a9('0x30')](_[_0x69a9('0x39')](_0x417ee7[_0x69a9('0x2f')],_0x560eab[_0x69a9('0x30')]));_0x43c12d[_0x69a9('0x38')][_0x69a9('0x4c')]=_0x5dfa1e['id'];if(_0x417ee7[_0x69a9('0x2f')][_0x69a9('0x3a')]){_0x43c12d[_0x69a9('0x38')]=_[_0x69a9('0x3b')](_0x43c12d[_0x69a9('0x38')],{'$or':_[_0x69a9('0x29')](_0x43c12d[_0x69a9('0x33')],function(_0x20fb9d){var _0xdf72ba={};_0xdf72ba[_0x20fb9d]={'$like':'%'+_0x417ee7['query'][_0x69a9('0x3a')]+'%'};return _0xdf72ba;})});}_0x43c12d=_[_0x69a9('0x3b')]({},_0x43c12d,_0x417ee7[_0x69a9('0x3d')]);return db[_0x69a9('0x4d')][_0x69a9('0x1c')]({'where':_0x43c12d[_0x69a9('0x38')]})['then'](function(_0x272956){_0x51ab27[_0x69a9('0x1c')]=_0x272956;if(_0x417ee7[_0x69a9('0x2f')]['includeAll']){_0x43c12d[_0x69a9('0x3f')]=[{'all':!![]}];}return db[_0x69a9('0x4d')][_0x69a9('0x40')](_0x43c12d);})[_0x69a9('0x24')](function(_0x17b790){_0x51ab27[_0x69a9('0x41')]=_0x17b790;return _0x51ab27;});}})[_0x69a9('0x24')](respondWithFilteredResult(_0x4fd753,_0x43c12d))['catch'](handleError(_0x4fd753,null));}; \ No newline at end of file +var _0x172d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','count','include','rows','catch','show','params','includeAll','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','filter','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x172d,0x8b));var _0xd172=function(_0x39e2d7,_0x1b15f6){_0x39e2d7=_0x39e2d7-0x0;var _0x413d0d=_0x172d[_0x39e2d7];return _0x413d0d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd172('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd172('0x1'));var moment=require('moment');var BPromise=require(_0xd172('0x2'));var Mustache=require(_0xd172('0x3'));var util=require('util');var path=require(_0xd172('0x4'));var sox=require(_0xd172('0x5'));var csv=require(_0xd172('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd172('0x7'));var _=require(_0xd172('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd172('0x9'));var deskjs=require(_0xd172('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd172('0xb'));var Redis=require(_0xd172('0xc'));var authService=require(_0xd172('0xd'));var qs=require(_0xd172('0xe'));var as=require(_0xd172('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd172('0x10'))(_0xd172('0x11'));var utils=require(_0xd172('0x12'));var config=require(_0xd172('0x13'));var licenseUtil=require(_0xd172('0x14'));var db=require(_0xd172('0x15'))['db'];function respondWithStatusCode(_0x2a918e,_0x3a20cb){_0x3a20cb=_0x3a20cb||0xcc;return function(_0x2ac2a8){if(_0x2ac2a8){return _0x2a918e[_0xd172('0x16')](_0x3a20cb);}return _0x2a918e[_0xd172('0x17')](_0x3a20cb)[_0xd172('0x18')]();};}function respondWithResult(_0x379512,_0x4f24b6){_0x4f24b6=_0x4f24b6||0xc8;return function(_0x26645f){if(_0x26645f){return _0x379512['status'](_0x4f24b6)[_0xd172('0x19')](_0x26645f);}};}function respondWithFilteredResult(_0x27c327,_0x4f2791){return function(_0x371bbb){if(_0x371bbb){var _0x27056d=typeof _0x4f2791[_0xd172('0x1a')]===_0xd172('0x1b')&&typeof _0x4f2791[_0xd172('0x1c')]===_0xd172('0x1b');var _0x31b672=_0x371bbb['count'];var _0x3fa459=_0x27056d?0x0:_0x4f2791[_0xd172('0x1a')];var _0x19d246=_0x27056d?_0x371bbb['count']:_0x4f2791[_0xd172('0x1a')]+_0x4f2791['limit'];var _0x4e45d7;if(_0x19d246>=_0x31b672){_0x19d246=_0x31b672;_0x4e45d7=0xc8;}else{_0x4e45d7=0xce;}_0x27c327[_0xd172('0x17')](_0x4e45d7);return _0x27c327['set']('Content-Range',_0x3fa459+'-'+_0x19d246+'/'+_0x31b672)[_0xd172('0x19')](_0x371bbb);}return null;};}function patchUpdates(_0x40c05b){return function(_0x275bd1){try{jsonpatch[_0xd172('0x1d')](_0x275bd1,_0x40c05b,!![]);}catch(_0x14fad6){return BPromise[_0xd172('0x1e')](_0x14fad6);}return _0x275bd1[_0xd172('0x1f')]();};}function saveUpdates(_0x5aedd3,_0x4c7e5d){return function(_0x30c037){if(_0x30c037){return _0x30c037[_0xd172('0x20')](_0x5aedd3)[_0xd172('0x21')](function(_0x2b464a){return _0x2b464a;});}return null;};}function removeEntity(_0x329fe5,_0x8eec40){return function(_0x118a1a){if(_0x118a1a){return _0x118a1a['destroy']()[_0xd172('0x21')](function(){_0x329fe5[_0xd172('0x17')](0xcc)[_0xd172('0x18')]();});}};}function handleEntityNotFound(_0x592e7d,_0x539760){return function(_0x200886){if(!_0x200886){_0x592e7d[_0xd172('0x16')](0x194);}return _0x200886;};}function handleError(_0x2b4bce,_0x393b9a){_0x393b9a=_0x393b9a||0x1f4;return function(_0x53e1a1){logger[_0xd172('0x22')](_0x53e1a1[_0xd172('0x23')]);if(_0x53e1a1[_0xd172('0x24')]){delete _0x53e1a1[_0xd172('0x24')];}_0x2b4bce[_0xd172('0x17')](_0x393b9a)[_0xd172('0x25')](_0x53e1a1);};}exports[_0xd172('0x26')]=function(_0x38885f,_0x1ef226){var _0x982f95={},_0x44a74e={},_0x28fe34={'count':0x0,'rows':[]};var _0x881c6d=_['map'](db[_0xd172('0x27')][_0xd172('0x28')],function(_0x23f820){return{'name':_0x23f820[_0xd172('0x29')],'type':_0x23f820['type']['key']};});_0x44a74e[_0xd172('0x2a')]=_[_0xd172('0x2b')](_0x881c6d,_0xd172('0x24'));_0x44a74e[_0xd172('0x2c')]=_[_0xd172('0x2d')](_0x38885f[_0xd172('0x2c')]);_0x44a74e[_0xd172('0x2e')]=_[_0xd172('0x2f')](_0x44a74e['model'],_0x44a74e[_0xd172('0x2c')]);_0x982f95[_0xd172('0x30')]=_[_0xd172('0x2f')](_0x44a74e[_0xd172('0x2a')],qs[_0xd172('0x31')](_0x38885f[_0xd172('0x2c')][_0xd172('0x31')]));_0x982f95[_0xd172('0x30')]=_0x982f95['attributes'][_0xd172('0x32')]?_0x982f95[_0xd172('0x30')]:_0x44a74e['model'];if(!_0x38885f['query'][_0xd172('0x33')](_0xd172('0x34'))){_0x982f95[_0xd172('0x1c')]=qs[_0xd172('0x1c')](_0x38885f[_0xd172('0x2c')][_0xd172('0x1c')]);_0x982f95[_0xd172('0x1a')]=qs[_0xd172('0x1a')](_0x38885f['query'][_0xd172('0x1a')]);}_0x982f95[_0xd172('0x35')]=qs['sort'](_0x38885f[_0xd172('0x2c')][_0xd172('0x36')]);_0x982f95[_0xd172('0x37')]=qs[_0xd172('0x2e')](_[_0xd172('0x38')](_0x38885f[_0xd172('0x2c')],_0x44a74e[_0xd172('0x2e')]),_0x881c6d);if(_0x38885f[_0xd172('0x2c')]['filter']){_0x982f95['where']=_['merge'](_0x982f95[_0xd172('0x37')],{'$or':_['map'](_0x881c6d,function(_0x4afb33){if(_0x4afb33[_0xd172('0x39')]!==_0xd172('0x3a')){var _0x2ab57c={};_0x2ab57c[_0x4afb33[_0xd172('0x24')]]={'$like':'%'+_0x38885f[_0xd172('0x2c')]['filter']+'%'};return _0x2ab57c;}})});}_0x982f95=_[_0xd172('0x3b')]({},_0x982f95,_0x38885f[_0xd172('0x3c')]);var _0x325411={'where':_0x982f95['where']};return db[_0xd172('0x27')][_0xd172('0x3d')](_0x325411)[_0xd172('0x21')](function(_0x11f69e){_0x28fe34[_0xd172('0x3d')]=_0x11f69e;if(_0x38885f[_0xd172('0x2c')]['includeAll']){_0x982f95[_0xd172('0x3e')]=[{'all':!![]}];}return db[_0xd172('0x27')]['findAll'](_0x982f95);})[_0xd172('0x21')](function(_0x41495c){_0x28fe34[_0xd172('0x3f')]=_0x41495c;return _0x28fe34;})['then'](respondWithFilteredResult(_0x1ef226,_0x982f95))[_0xd172('0x40')](handleError(_0x1ef226,null));};exports[_0xd172('0x41')]=function(_0x1c560b,_0x3e206e){var _0x1090f0={'raw':!![],'where':{'id':_0x1c560b[_0xd172('0x42')]['id']}},_0x2be59b={};_0x2be59b[_0xd172('0x2a')]=_['keys'](db[_0xd172('0x27')][_0xd172('0x28')]);_0x2be59b['query']=_[_0xd172('0x2d')](_0x1c560b[_0xd172('0x2c')]);_0x2be59b[_0xd172('0x2e')]=_[_0xd172('0x2f')](_0x2be59b[_0xd172('0x2a')],_0x2be59b[_0xd172('0x2c')]);_0x1090f0[_0xd172('0x30')]=_[_0xd172('0x2f')](_0x2be59b['model'],qs[_0xd172('0x31')](_0x1c560b['query'][_0xd172('0x31')]));_0x1090f0['attributes']=_0x1090f0['attributes'][_0xd172('0x32')]?_0x1090f0['attributes']:_0x2be59b[_0xd172('0x2a')];if(_0x1c560b['query'][_0xd172('0x43')]){_0x1090f0[_0xd172('0x3e')]=[{'all':!![]}];}_0x1090f0=_[_0xd172('0x3b')]({},_0x1090f0,_0x1c560b['options']);return db['JscriptySessionReport'][_0xd172('0x44')](_0x1090f0)[_0xd172('0x21')](handleEntityNotFound(_0x3e206e,null))[_0xd172('0x21')](respondWithResult(_0x3e206e,null))['catch'](handleError(_0x3e206e,null));};exports[_0xd172('0x45')]=function(_0x3cc629,_0x1ed174){return db[_0xd172('0x27')]['create'](_0x3cc629['body'],{})[_0xd172('0x21')](respondWithResult(_0x1ed174,0xc9))[_0xd172('0x40')](handleError(_0x1ed174,null));};exports['update']=function(_0x381766,_0x2cfb96){if(_0x381766[_0xd172('0x46')]['id']){delete _0x381766[_0xd172('0x46')]['id'];}return db[_0xd172('0x27')][_0xd172('0x44')]({'where':{'id':_0x381766[_0xd172('0x42')]['id']}})[_0xd172('0x21')](handleEntityNotFound(_0x2cfb96,null))[_0xd172('0x21')](saveUpdates(_0x381766[_0xd172('0x46')],null))[_0xd172('0x21')](respondWithResult(_0x2cfb96,null))['catch'](handleError(_0x2cfb96,null));};exports[_0xd172('0x47')]=function(_0x322d7d,_0xceacd){return db[_0xd172('0x27')]['find']({'where':{'id':_0x322d7d['params']['id']}})[_0xd172('0x21')](handleEntityNotFound(_0xceacd,null))[_0xd172('0x21')](removeEntity(_0xceacd,null))[_0xd172('0x40')](handleError(_0xceacd,null));};exports[_0xd172('0x48')]=function(_0x56e84d,_0x1b0dd6){return db['JscriptySessionReport'][_0xd172('0x48')]()[_0xd172('0x21')](respondWithResult(_0x1b0dd6,null))['catch'](handleError(_0x1b0dd6,null));};exports[_0xd172('0x49')]=function(_0x33219f,_0x4fef3b,_0x3d0a1e){var _0x181ef0={'raw':!![],'where':{}};var _0x1063bc={};var _0x4fb3c2={'count':0x0,'rows':[]};return db[_0xd172('0x27')][_0xd172('0x4a')]({'where':{'id':_0x33219f['params']['id']}})[_0xd172('0x21')](handleEntityNotFound(_0x4fef3b,null))['then'](function(_0x333465){if(_0x333465){_0x1063bc['model']=_[_0xd172('0x2d')](db[_0xd172('0x4b')][_0xd172('0x28')]);_0x1063bc['query']=_['keys'](_0x33219f[_0xd172('0x2c')]);_0x1063bc[_0xd172('0x2e')]=_['intersection'](_0x1063bc[_0xd172('0x2a')],_0x1063bc[_0xd172('0x2c')]);_0x181ef0[_0xd172('0x30')]=_[_0xd172('0x2f')](_0x1063bc['model'],qs[_0xd172('0x31')](_0x33219f[_0xd172('0x2c')][_0xd172('0x31')]));_0x181ef0[_0xd172('0x30')]=_0x181ef0['attributes'][_0xd172('0x32')]?_0x181ef0[_0xd172('0x30')]:_0x1063bc[_0xd172('0x2a')];if(!_0x33219f[_0xd172('0x2c')][_0xd172('0x33')](_0xd172('0x34'))){_0x181ef0[_0xd172('0x1c')]=qs[_0xd172('0x1c')](_0x33219f['query'][_0xd172('0x1c')]);_0x181ef0[_0xd172('0x1a')]=qs[_0xd172('0x1a')](_0x33219f[_0xd172('0x2c')][_0xd172('0x1a')]);}_0x181ef0[_0xd172('0x35')]=qs[_0xd172('0x36')](_0x33219f[_0xd172('0x2c')]['sort']);_0x181ef0[_0xd172('0x37')]=qs[_0xd172('0x2e')](_[_0xd172('0x38')](_0x33219f[_0xd172('0x2c')],_0x1063bc[_0xd172('0x2e')]));_0x181ef0[_0xd172('0x37')]['SessionId']=_0x333465['id'];if(_0x33219f[_0xd172('0x2c')][_0xd172('0x4c')]){_0x181ef0[_0xd172('0x37')]=_[_0xd172('0x3b')](_0x181ef0['where'],{'$or':_[_0xd172('0x2b')](_0x181ef0[_0xd172('0x30')],function(_0x510a0b){var _0x40b537={};_0x40b537[_0x510a0b]={'$like':'%'+_0x33219f[_0xd172('0x2c')][_0xd172('0x4c')]+'%'};return _0x40b537;})});}_0x181ef0=_[_0xd172('0x3b')]({},_0x181ef0,_0x33219f[_0xd172('0x3c')]);return db[_0xd172('0x4b')][_0xd172('0x3d')]({'where':_0x181ef0['where']})[_0xd172('0x21')](function(_0x32195e){_0x4fb3c2['count']=_0x32195e;if(_0x33219f[_0xd172('0x2c')][_0xd172('0x43')]){_0x181ef0[_0xd172('0x3e')]=[{'all':!![]}];}return db[_0xd172('0x4b')]['findAll'](_0x181ef0);})[_0xd172('0x21')](function(_0x35b79e){_0x4fb3c2[_0xd172('0x3f')]=_0x35b79e;return _0x4fb3c2;});}})[_0xd172('0x21')](respondWithFilteredResult(_0x4fef3b,_0x181ef0))[_0xd172('0x40')](handleError(_0x4fef3b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8199bc6..d6cd240 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 _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e1450,_0x44011f){var _0x256e6a=function(_0x47d4b9){while(--_0x47d4b9){_0x5e1450['push'](_0x5e1450['shift']());}};_0x256e6a(++_0x44011f);}(_0x4975,0x86));var _0x5497=function(_0xa5a649,_0x32e4a0){_0xa5a649=_0xa5a649-0x0;var _0x42064e=_0x4975[_0xa5a649];return _0x42064e;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x413ee8,_0x37bd88){var _0x2c998e=function(_0x5b4166){while(--_0x5b4166){_0x413ee8['push'](_0x413ee8['shift']());}};_0x2c998e(++_0x37bd88);}(_0x5496,0x175));var _0x6549=function(_0x4f4b4c,_0x5bcee8){_0x4f4b4c=_0x4f4b4c-0x0;var _0x450a2d=_0x5496[_0x4f4b4c];return _0x450a2d;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f143188..068f67f 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 _0x430c=['then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x430c,0x1a1));var _0xc430=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x430c[_0x382a62];return _0x490a25;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});} \ No newline at end of file +var _0x8aad=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x3338fe,_0x43ca83){var _0x1bb7f1=function(_0x10de90){while(--_0x10de90){_0x3338fe['push'](_0x3338fe['shift']());}};_0x1bb7f1(++_0x43ca83);}(_0x8aad,0x146));var _0xd8aa=function(_0x5577e5,_0x1664ae){_0x5577e5=_0x5577e5-0x0;var _0xc4bb01=_0x8aad[_0x5577e5];return _0xc4bb01;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f023793..a781d96 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 _0xa227=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xa227,0x85));var _0x7a22=function(_0x249b66,_0x520179){_0x249b66=_0x249b66-0x0;var _0x225d9e=_0xa227[_0x249b66];return _0x225d9e;};'use strict';var multer=require(_0x7a22('0x0'));var util=require('util');var path=require(_0x7a22('0x1'));var timeout=require(_0x7a22('0x2'));var express=require('express');var router=express[_0x7a22('0x3')]();var fs_extra=require(_0x7a22('0x4'));var auth=require(_0x7a22('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a22('0x6'));var controller=require(_0x7a22('0x7'));router[_0x7a22('0x8')]('/',controller[_0x7a22('0x9')]);router[_0x7a22('0xa')]('/:id',auth[_0x7a22('0xb')](),controller[_0x7a22('0xc')]);router['get'](_0x7a22('0xd'),auth[_0x7a22('0xb')](),controller[_0x7a22('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6940=['/download_log_file','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','update','get'];(function(_0x220f89,_0x4870dc){var _0x40cd29=function(_0x3d62ad){while(--_0x3d62ad){_0x220f89['push'](_0x220f89['shift']());}};_0x40cd29(++_0x4870dc);}(_0x6940,0x1f0));var _0x0694=function(_0x2a1f98,_0x2c5c98){_0x2a1f98=_0x2a1f98-0x0;var _0x47a84f=_0x6940[_0x2a1f98];return _0x47a84f;};'use strict';var multer=require(_0x0694('0x0'));var util=require(_0x0694('0x1'));var path=require(_0x0694('0x2'));var timeout=require(_0x0694('0x3'));var express=require(_0x0694('0x4'));var router=express[_0x0694('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0694('0x6'));var interaction=require(_0x0694('0x7'));var config=require(_0x0694('0x8'));var controller=require('./license.controller');router['get']('/',controller[_0x0694('0x9')]);router['put'](_0x0694('0xa'),auth[_0x0694('0xb')](),controller[_0x0694('0xc')]);router[_0x0694('0xd')](_0x0694('0xe'),auth[_0x0694('0xb')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 393504f..d9f6eee 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 _0x95bb=['exports','TEXT','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x95bb,0xf7));var _0xb95b=function(_0x234a28,_0x8014b1){_0x234a28=_0x234a28-0x0;var _0x4816a8=_0x95bb[_0x234a28];return _0x4816a8;};'use strict';var Sequelize=require(_0xb95b('0x0'));module[_0xb95b('0x1')]={'license':{'type':Sequelize[_0xb95b('0x2')]},'data1':{'type':Sequelize[_0xb95b('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9687=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x4ed952,_0x5038c0){var _0x34e570=function(_0x2701dd){while(--_0x2701dd){_0x4ed952['push'](_0x4ed952['shift']());}};_0x34e570(++_0x5038c0);}(_0x9687,0x126));var _0x7968=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9687[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7968('0x0'));module[_0x7968('0x1')]={'license':{'type':Sequelize[_0x7968('0x2')]},'data1':{'type':Sequelize[_0x7968('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7968('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 d057533..d209428 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 _0xf174=['save','update','destroy','then','sendStatus','error','stack','name','send','index','model','keys','License','query','filters','attributes','intersection','length','merge','options','catch','body','find','params','key','demo','downloadLogFile','join','/var','log','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf174,0x13e));var _0x4f17=function(_0x36fe2e,_0x209c3e){_0x36fe2e=_0x36fe2e-0x0;var _0x3368f6=_0xf174[_0x36fe2e];return _0x3368f6;};'use strict';var emlformat=require(_0x4f17('0x0'));var rimraf=require(_0x4f17('0x1'));var zipdir=require(_0x4f17('0x2'));var jsonpatch=require(_0x4f17('0x3'));var rp=require(_0x4f17('0x4'));var moment=require(_0x4f17('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f17('0x6'));var util=require(_0x4f17('0x7'));var path=require('path');var sox=require(_0x4f17('0x8'));var csv=require(_0x4f17('0x9'));var ejs=require(_0x4f17('0xa'));var fs=require('fs');var fs_extra=require(_0x4f17('0xb'));var _=require(_0x4f17('0xc'));var squel=require(_0x4f17('0xd'));var crypto=require('crypto');var jsforce=require(_0x4f17('0xe'));var deskjs=require(_0x4f17('0xf'));var toCsv=require(_0x4f17('0x9'));var querystring=require(_0x4f17('0x10'));var Papa=require('papaparse');var Redis=require(_0x4f17('0x11'));var authService=require(_0x4f17('0x12'));var qs=require(_0x4f17('0x13'));var as=require(_0x4f17('0x14'));var hardwareService=require(_0x4f17('0x15'));var logger=require(_0x4f17('0x16'))(_0x4f17('0x17'));var utils=require(_0x4f17('0x18'));var config=require(_0x4f17('0x19'));var licenseUtil=require(_0x4f17('0x1a'));var db=require(_0x4f17('0x1b'))['db'];function respondWithStatusCode(_0x4384fc,_0x3df6aa){_0x3df6aa=_0x3df6aa||0xcc;return function(_0x4f5112){if(_0x4f5112){return _0x4384fc['sendStatus'](_0x3df6aa);}return _0x4384fc[_0x4f17('0x1c')](_0x3df6aa)[_0x4f17('0x1d')]();};}function respondWithResult(_0x260736,_0x3ae717){_0x3ae717=_0x3ae717||0xc8;return function(_0xde8d97){if(_0xde8d97){return _0x260736[_0x4f17('0x1c')](_0x3ae717)['json'](_0xde8d97);}};}function respondWithFilteredResult(_0x27c2f9,_0x1f7f89){return function(_0xba613d){if(_0xba613d){var _0x404db3=typeof _0x1f7f89[_0x4f17('0x1e')]===_0x4f17('0x1f')&&typeof _0x1f7f89[_0x4f17('0x20')]===_0x4f17('0x1f');var _0x3ebc32=_0xba613d[_0x4f17('0x21')];var _0x1d566c=_0x404db3?0x0:_0x1f7f89[_0x4f17('0x1e')];var _0x98ee41=_0x404db3?_0xba613d[_0x4f17('0x21')]:_0x1f7f89[_0x4f17('0x1e')]+_0x1f7f89['limit'];var _0x555c16;if(_0x98ee41>=_0x3ebc32){_0x98ee41=_0x3ebc32;_0x555c16=0xc8;}else{_0x555c16=0xce;}_0x27c2f9['status'](_0x555c16);return _0x27c2f9[_0x4f17('0x22')]('Content-Range',_0x1d566c+'-'+_0x98ee41+'/'+_0x3ebc32)[_0x4f17('0x23')](_0xba613d);}return null;};}function patchUpdates(_0x399b7f){return function(_0x2782c8){try{jsonpatch[_0x4f17('0x24')](_0x2782c8,_0x399b7f,!![]);}catch(_0x2c360a){return BPromise['reject'](_0x2c360a);}return _0x2782c8[_0x4f17('0x25')]();};}function saveUpdates(_0x5a84c0,_0x43fbd8){return function(_0x12091d){if(_0x12091d){return _0x12091d[_0x4f17('0x26')](_0x5a84c0)['then'](function(_0xcf0f02){return _0xcf0f02;});}return null;};}function removeEntity(_0x3d7afa,_0x1b879d){return function(_0x4949f0){if(_0x4949f0){return _0x4949f0[_0x4f17('0x27')]()[_0x4f17('0x28')](function(){_0x3d7afa[_0x4f17('0x1c')](0xcc)[_0x4f17('0x1d')]();});}};}function handleEntityNotFound(_0x19dce6,_0x1e4800){return function(_0x470ba5){if(!_0x470ba5){_0x19dce6[_0x4f17('0x29')](0x194);}return _0x470ba5;};}function handleError(_0x2f2e35,_0x288e89){_0x288e89=_0x288e89||0x1f4;return function(_0x3d0d77){logger[_0x4f17('0x2a')](_0x3d0d77[_0x4f17('0x2b')]);if(_0x3d0d77[_0x4f17('0x2c')]){delete _0x3d0d77[_0x4f17('0x2c')];}_0x2f2e35[_0x4f17('0x1c')](_0x288e89)[_0x4f17('0x2d')](_0x3d0d77);};}var utilLicense=require('../../config/license/util');exports[_0x4f17('0x2e')]=function(_0x355e33,_0x3f4ad0){var _0x2acb1f={'raw':!![],'where':{'id':0x1}},_0x41916c={};_0x41916c[_0x4f17('0x2f')]=_[_0x4f17('0x30')](db[_0x4f17('0x31')]['rawAttributes']);_0x41916c[_0x4f17('0x32')]=_[_0x4f17('0x30')](_0x355e33[_0x4f17('0x32')]);_0x41916c[_0x4f17('0x33')]=_['intersection'](_0x41916c[_0x4f17('0x2f')],_0x41916c[_0x4f17('0x32')]);_0x2acb1f[_0x4f17('0x34')]=_[_0x4f17('0x35')](_0x41916c[_0x4f17('0x2f')],qs['fields'](_0x355e33[_0x4f17('0x32')]['fields']));_0x2acb1f[_0x4f17('0x34')]=_0x2acb1f[_0x4f17('0x34')][_0x4f17('0x36')]?_0x2acb1f[_0x4f17('0x34')]:_0x41916c[_0x4f17('0x2f')];_0x2acb1f=_[_0x4f17('0x37')]({},_0x2acb1f,_0x355e33[_0x4f17('0x38')]);return utilLicense['getLicense'](_0x2acb1f)[_0x4f17('0x28')](respondWithResult(_0x3f4ad0,null))[_0x4f17('0x39')](handleError(_0x3f4ad0,null));};exports[_0x4f17('0x26')]=function(_0x4ab016,_0x5d5c5b){if(_0x4ab016[_0x4f17('0x3a')]['id']){delete _0x4ab016['body']['id'];}return db[_0x4f17('0x31')][_0x4f17('0x3b')]({'where':{'id':_0x4ab016[_0x4f17('0x3c')]['id']}})[_0x4f17('0x28')](handleEntityNotFound(_0x5d5c5b,null))[_0x4f17('0x28')](function(_0x9add8){var _0xf6e818=_0x9add8['get']({'plain':!![]});return utilLicense['checkLicense'](_0xf6e818,_0x4ab016['body'][_0x4f17('0x3d')]);})[_0x4f17('0x28')](function(_0x3fae59){if(!_0x3fae59[_0x4f17('0x3e')]){return saveUpdates(_0x4ab016[_0x4f17('0x3a')],null);}return _0x3fae59;})[_0x4f17('0x28')](respondWithResult(_0x5d5c5b,null))['catch'](handleError(_0x5d5c5b,null));};exports[_0x4f17('0x3f')]=function(_0x487346,_0xdd9346){var _0x598002='license-info.log';var _0x87c101=path[_0x4f17('0x40')](_0x4f17('0x41'),_0x4f17('0x42'),'xcally',_0x598002);_0xdd9346['setHeader'](_0x4f17('0x43'),_0x4f17('0x44')+_0x598002);_0xdd9346[_0x4f17('0x22')]('Content-Type',_0x4f17('0x45'));_0xdd9346[_0x4f17('0x46')](_0x87c101);}; \ No newline at end of file +var _0x1597=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','save','then','destroy','error','name','send','../../config/license/util','index','model','keys','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','License','find','get','key','demo','downloadLogFile','/var','log','xcally','setHeader','Content-disposition','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x267210,_0x36696c){var _0x591cd5=function(_0x78c922){while(--_0x78c922){_0x267210['push'](_0x267210['shift']());}};_0x591cd5(++_0x36696c);}(_0x1597,0x192));var _0x7159=function(_0x5a9aa7,_0x55b38f){_0x5a9aa7=_0x5a9aa7-0x0;var _0x298adf=_0x1597[_0x5a9aa7];return _0x298adf;};'use strict';var emlformat=require(_0x7159('0x0'));var rimraf=require(_0x7159('0x1'));var zipdir=require(_0x7159('0x2'));var jsonpatch=require(_0x7159('0x3'));var rp=require('request-promise');var moment=require(_0x7159('0x4'));var BPromise=require(_0x7159('0x5'));var Mustache=require(_0x7159('0x6'));var util=require(_0x7159('0x7'));var path=require(_0x7159('0x8'));var sox=require(_0x7159('0x9'));var csv=require(_0x7159('0xa'));var ejs=require(_0x7159('0xb'));var fs=require('fs');var fs_extra=require(_0x7159('0xc'));var _=require('lodash');var squel=require(_0x7159('0xd'));var crypto=require(_0x7159('0xe'));var jsforce=require(_0x7159('0xf'));var deskjs=require(_0x7159('0x10'));var toCsv=require(_0x7159('0xa'));var querystring=require(_0x7159('0x11'));var Papa=require(_0x7159('0x12'));var Redis=require(_0x7159('0x13'));var authService=require(_0x7159('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7159('0x15'));var hardwareService=require(_0x7159('0x16'));var logger=require(_0x7159('0x17'))(_0x7159('0x18'));var utils=require('../../config/utils');var config=require(_0x7159('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7159('0x1a'))['db'];function respondWithStatusCode(_0x63e009,_0x2f098b){_0x2f098b=_0x2f098b||0xcc;return function(_0x2b3674){if(_0x2b3674){return _0x63e009['sendStatus'](_0x2f098b);}return _0x63e009['status'](_0x2f098b)[_0x7159('0x1b')]();};}function respondWithResult(_0x503f44,_0x5ec607){_0x5ec607=_0x5ec607||0xc8;return function(_0x433735){if(_0x433735){return _0x503f44['status'](_0x5ec607)[_0x7159('0x1c')](_0x433735);}};}function respondWithFilteredResult(_0x466e36,_0x92eb67){return function(_0x2c3af4){if(_0x2c3af4){var _0x4c3786=typeof _0x92eb67[_0x7159('0x1d')]===_0x7159('0x1e')&&typeof _0x92eb67[_0x7159('0x1f')]==='undefined';var _0x347583=_0x2c3af4[_0x7159('0x20')];var _0x55f43b=_0x4c3786?0x0:_0x92eb67[_0x7159('0x1d')];var _0x4f480d=_0x4c3786?_0x2c3af4[_0x7159('0x20')]:_0x92eb67[_0x7159('0x1d')]+_0x92eb67[_0x7159('0x1f')];var _0x595a47;if(_0x4f480d>=_0x347583){_0x4f480d=_0x347583;_0x595a47=0xc8;}else{_0x595a47=0xce;}_0x466e36[_0x7159('0x21')](_0x595a47);return _0x466e36[_0x7159('0x22')]('Content-Range',_0x55f43b+'-'+_0x4f480d+'/'+_0x347583)[_0x7159('0x1c')](_0x2c3af4);}return null;};}function patchUpdates(_0x4677a9){return function(_0x5cd644){try{jsonpatch[_0x7159('0x23')](_0x5cd644,_0x4677a9,!![]);}catch(_0x31889a){return BPromise['reject'](_0x31889a);}return _0x5cd644[_0x7159('0x24')]();};}function saveUpdates(_0x14d852,_0xbb67a0){return function(_0x16be2c){if(_0x16be2c){return _0x16be2c['update'](_0x14d852)[_0x7159('0x25')](function(_0x48e2a7){return _0x48e2a7;});}return null;};}function removeEntity(_0x313f22,_0x1baa7e){return function(_0x41c1ac){if(_0x41c1ac){return _0x41c1ac[_0x7159('0x26')]()['then'](function(){_0x313f22['status'](0xcc)[_0x7159('0x1b')]();});}};}function handleEntityNotFound(_0x38a862,_0x4343c6){return function(_0x448d54){if(!_0x448d54){_0x38a862['sendStatus'](0x194);}return _0x448d54;};}function handleError(_0x1c8ce1,_0xf2a312){_0xf2a312=_0xf2a312||0x1f4;return function(_0x3c1836){logger[_0x7159('0x27')](_0x3c1836['stack']);if(_0x3c1836[_0x7159('0x28')]){delete _0x3c1836[_0x7159('0x28')];}_0x1c8ce1[_0x7159('0x21')](_0xf2a312)[_0x7159('0x29')](_0x3c1836);};}var utilLicense=require(_0x7159('0x2a'));exports[_0x7159('0x2b')]=function(_0xe7c47b,_0x54872c){var _0x1abfa3={'raw':!![],'where':{'id':0x1}},_0x1a629d={};_0x1a629d[_0x7159('0x2c')]=_[_0x7159('0x2d')](db['License'][_0x7159('0x2e')]);_0x1a629d['query']=_[_0x7159('0x2d')](_0xe7c47b[_0x7159('0x2f')]);_0x1a629d['filters']=_[_0x7159('0x30')](_0x1a629d[_0x7159('0x2c')],_0x1a629d[_0x7159('0x2f')]);_0x1abfa3[_0x7159('0x31')]=_[_0x7159('0x30')](_0x1a629d[_0x7159('0x2c')],qs[_0x7159('0x32')](_0xe7c47b[_0x7159('0x2f')][_0x7159('0x32')]));_0x1abfa3[_0x7159('0x31')]=_0x1abfa3[_0x7159('0x31')][_0x7159('0x33')]?_0x1abfa3[_0x7159('0x31')]:_0x1a629d[_0x7159('0x2c')];_0x1abfa3=_[_0x7159('0x34')]({},_0x1abfa3,_0xe7c47b[_0x7159('0x35')]);return utilLicense[_0x7159('0x36')](_0x1abfa3)[_0x7159('0x25')](respondWithResult(_0x54872c,null))[_0x7159('0x37')](handleError(_0x54872c,null));};exports[_0x7159('0x38')]=function(_0x1377aa,_0x2678d9){if(_0x1377aa[_0x7159('0x39')]['id']){delete _0x1377aa[_0x7159('0x39')]['id'];}return db[_0x7159('0x3a')][_0x7159('0x3b')]({'where':{'id':_0x1377aa['params']['id']}})['then'](handleEntityNotFound(_0x2678d9,null))[_0x7159('0x25')](function(_0x293f68){var _0x426ca7=_0x293f68[_0x7159('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x426ca7,_0x1377aa['body'][_0x7159('0x3d')]);})[_0x7159('0x25')](function(_0x2b654a){if(!_0x2b654a[_0x7159('0x3e')]){return saveUpdates(_0x1377aa[_0x7159('0x39')],null);}return _0x2b654a;})[_0x7159('0x25')](respondWithResult(_0x2678d9,null))['catch'](handleError(_0x2678d9,null));};exports[_0x7159('0x3f')]=function(_0x9609cb,_0x13c653){var _0x49f78a='license-info.log';var _0xc8404e=path['join'](_0x7159('0x40'),_0x7159('0x41'),_0x7159('0x42'),_0x49f78a);_0x13c653[_0x7159('0x43')](_0x7159('0x44'),'attachment;\x20filename='+_0x49f78a);_0x13c653[_0x7159('0x22')]('Content-Type','text/plain');_0x13c653[_0x7159('0x45')](_0xc8404e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index bccedad..2d0b2c5 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 _0xa06e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','License','license','lodash','util'];(function(_0x2904b0,_0x31a596){var _0x196b62=function(_0x42a4b7){while(--_0x42a4b7){_0x2904b0['push'](_0x2904b0['shift']());}};_0x196b62(++_0x31a596);}(_0xa06e,0x106));var _0xea06=function(_0x22c600,_0x3867e0){_0x22c600=_0x22c600-0x0;var _0x201b22=_0xa06e[_0x22c600];return _0x201b22;};'use strict';var _=require(_0xea06('0x0'));var util=require(_0xea06('0x1'));var logger=require('../../config/logger')(_0xea06('0x2'));var moment=require(_0xea06('0x3'));var BPromise=require(_0xea06('0x4'));var rp=require(_0xea06('0x5'));var fs=require('fs');var path=require(_0xea06('0x6'));var rimraf=require(_0xea06('0x7'));var config=require(_0xea06('0x8'));var attributes=require('./license.attributes');module[_0xea06('0x9')]=function(_0x2c0b66,_0x3c5425){return _0x2c0b66['define'](_0xea06('0xa'),attributes,{'tableName':_0xea06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6033=['../../config/environment','exports','define','license','lodash','../../config/logger','api','moment'];(function(_0x598548,_0x44c01b){var _0x749126=function(_0x20a0c5){while(--_0x20a0c5){_0x598548['push'](_0x598548['shift']());}};_0x749126(++_0x44c01b);}(_0x6033,0x1cc));var _0x3603=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6033[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x3603('0x0'));var util=require('util');var logger=require(_0x3603('0x1'))(_0x3603('0x2'));var moment=require(_0x3603('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3603('0x4'));var attributes=require('./license.attributes');module[_0x3603('0x5')]=function(_0x3b6822,_0x992e4c){return _0x3b6822[_0x3603('0x6')]('License',attributes,{'tableName':_0x3603('0x7'),'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 3bc0ec3..8919916 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 _0x50fd=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x50fd,0x15c));var _0xd50f=function(_0x33dca4,_0x453b87){_0x33dca4=_0x33dca4-0x0;var _0x2e3c54=_0x50fd[_0x33dca4];return _0x2e3c54;};'use strict';var _=require(_0xd50f('0x0'));var util=require(_0xd50f('0x1'));var moment=require('moment');var BPromise=require(_0xd50f('0x2'));var rs=require(_0xd50f('0x3'));var fs=require('fs');var Redis=require(_0xd50f('0x4'));var db=require(_0xd50f('0x5'))['db'];var utils=require(_0xd50f('0x6'));var logger=require(_0xd50f('0x7'))(_0xd50f('0x8'));var config=require(_0xd50f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd50f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30d205,_0x5001c8,_0x57ac7c){return new BPromise(function(_0x27d240,_0x2365a0){return client[_0xd50f('0xb')](_0x30d205,_0x57ac7c)['then'](function(_0x14a5fa){logger[_0xd50f('0xc')](_0xd50f('0xd'),_0x5001c8,_0xd50f('0xe'));logger[_0xd50f('0xf')](_0xd50f('0x10'),_0x5001c8,_0xd50f('0xe'),JSON[_0xd50f('0x11')](_0x14a5fa));if(_0x14a5fa[_0xd50f('0x12')]){if(_0x14a5fa['error'][_0xd50f('0x13')]===0x1f4){logger[_0xd50f('0x12')](_0xd50f('0xd'),_0x5001c8,_0x14a5fa[_0xd50f('0x12')]['message']);return _0x2365a0(_0x14a5fa[_0xd50f('0x12')][_0xd50f('0x14')]);}logger[_0xd50f('0x12')]('License,\x20%s,\x20%s',_0x5001c8,_0x14a5fa['error'][_0xd50f('0x14')]);return _0x27d240(_0x14a5fa[_0xd50f('0x12')][_0xd50f('0x14')]);}else{logger[_0xd50f('0xc')](_0xd50f('0xd'),_0x5001c8,_0xd50f('0xe'));_0x27d240(_0x14a5fa[_0xd50f('0x15')][_0xd50f('0x14')]);}})[_0xd50f('0x16')](function(_0x1a666c){logger[_0xd50f('0x12')](_0xd50f('0xd'),_0x5001c8,_0x1a666c);_0x2365a0(_0x1a666c);});});} \ No newline at end of file +var _0xeac6=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x263fa9,_0x2bb474){var _0x5a364a=function(_0x4636b6){while(--_0x4636b6){_0x263fa9['push'](_0x263fa9['shift']());}};_0x5a364a(++_0x2bb474);}(_0xeac6,0xd2));var _0x6eac=function(_0x26b8c8,_0x75f068){_0x26b8c8=_0x26b8c8-0x0;var _0x2ae2e6=_0xeac6[_0x26b8c8];return _0x2ae2e6;};'use strict';var _=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var moment=require(_0x6eac('0x2'));var BPromise=require('bluebird');var rs=require(_0x6eac('0x3'));var fs=require('fs');var Redis=require(_0x6eac('0x4'));var db=require(_0x6eac('0x5'))['db'];var utils=require(_0x6eac('0x6'));var logger=require('../../config/logger')(_0x6eac('0x7'));var config=require(_0x6eac('0x8'));var jayson=require(_0x6eac('0x9'));var client=jayson['client'][_0x6eac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c4895,_0x1c3c9e,_0x3ba576){return new BPromise(function(_0x467f50,_0x19ad99){return client[_0x6eac('0xb')](_0x3c4895,_0x3ba576)[_0x6eac('0xc')](function(_0x2b1658){logger[_0x6eac('0xd')](_0x6eac('0xe'),_0x1c3c9e,_0x6eac('0xf'));logger['debug'](_0x6eac('0x10'),_0x1c3c9e,_0x6eac('0xf'),JSON[_0x6eac('0x11')](_0x2b1658));if(_0x2b1658['error']){if(_0x2b1658[_0x6eac('0x12')][_0x6eac('0x13')]===0x1f4){logger[_0x6eac('0x12')](_0x6eac('0xe'),_0x1c3c9e,_0x2b1658[_0x6eac('0x12')]['message']);return _0x19ad99(_0x2b1658['error'][_0x6eac('0x14')]);}logger[_0x6eac('0x12')](_0x6eac('0xe'),_0x1c3c9e,_0x2b1658[_0x6eac('0x12')][_0x6eac('0x14')]);return _0x467f50(_0x2b1658[_0x6eac('0x12')][_0x6eac('0x14')]);}else{logger[_0x6eac('0xd')](_0x6eac('0xe'),_0x1c3c9e,_0x6eac('0xf'));_0x467f50(_0x2b1658[_0x6eac('0x15')][_0x6eac('0x14')]);}})[_0x6eac('0x16')](function(_0x10449b){logger['error']('License,\x20%s,\x20%s',_0x1c3c9e,_0x10449b);_0x19ad99(_0x10449b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 06d69ec..79e5908 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 _0x598b=['/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x3575b8,_0x460cb3){var _0x100098=function(_0xf6cc0e){while(--_0xf6cc0e){_0x3575b8['push'](_0x3575b8['shift']());}};_0x100098(++_0x460cb3);}(_0x598b,0x126));var _0xb598=function(_0x626f86,_0x7619b5){_0x626f86=_0x626f86-0x0;var _0x418916=_0x598b[_0x626f86];return _0x418916;};'use strict';var multer=require('multer');var util=require(_0xb598('0x0'));var path=require(_0xb598('0x1'));var timeout=require(_0xb598('0x2'));var express=require(_0xb598('0x3'));var router=express[_0xb598('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb598('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb598('0x6'));var controller=require(_0xb598('0x7'));router[_0xb598('0x8')]('/',auth[_0xb598('0x9')](),controller[_0xb598('0xa')]);router[_0xb598('0x8')]('/describe',auth[_0xb598('0x9')](),controller['describe']);router[_0xb598('0x8')](_0xb598('0xb'),auth[_0xb598('0x9')](),controller['show']);router[_0xb598('0x8')](_0xb598('0xc'),auth[_0xb598('0x9')](),controller[_0xb598('0xd')]);router[_0xb598('0x8')]('/:id/canned_answers',auth[_0xb598('0x9')](),controller[_0xb598('0xe')]);router[_0xb598('0x8')](_0xb598('0xf'),auth['isAuthenticated'](),controller[_0xb598('0x10')]);router[_0xb598('0x8')](_0xb598('0x11'),auth[_0xb598('0x9')](),controller[_0xb598('0x12')]);router[_0xb598('0x8')](_0xb598('0x13'),auth['isAuthenticated'](),controller[_0xb598('0x14')]);router[_0xb598('0x8')](_0xb598('0x15'),auth['isAuthenticated'](),controller[_0xb598('0x16')]);router[_0xb598('0x8')](_0xb598('0x17'),auth[_0xb598('0x9')](),controller[_0xb598('0x18')]);router[_0xb598('0x8')]('/:id/verify',auth[_0xb598('0x9')](),controller[_0xb598('0x19')]);router[_0xb598('0x8')](_0xb598('0x1a'),auth[_0xb598('0x9')](),controller[_0xb598('0x1b')]);router[_0xb598('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb598('0x1d')]);router[_0xb598('0x1c')](_0xb598('0x1e'),auth[_0xb598('0x9')](),controller[_0xb598('0x1f')]);router[_0xb598('0x1c')]('/',auth[_0xb598('0x9')](),controller[_0xb598('0x20')]);router['post']('/:id/in_servers',auth[_0xb598('0x9')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0xb598('0x9')](),controller[_0xb598('0x21')]);router[_0xb598('0x1c')](_0xb598('0x13'),auth[_0xb598('0x9')](),controller['addInteraction']);router['post'](_0xb598('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xb598('0x22'),auth[_0xb598('0x9')](),controller[_0xb598('0x23')]);router['post'](_0xb598('0x1a'),auth[_0xb598('0x9')](),controller[_0xb598('0x24')]);router['put'](_0xb598('0xb'),auth['isAuthenticated'](),controller[_0xb598('0x25')]);router[_0xb598('0x26')](_0xb598('0xc'),auth[_0xb598('0x9')](),controller[_0xb598('0x27')]);router[_0xb598('0x26')](_0xb598('0x1e'),auth['isAuthenticated'](),controller[_0xb598('0x28')]);router[_0xb598('0x26')]('/:id/in_servers',auth[_0xb598('0x9')](),controller[_0xb598('0x29')]);router[_0xb598('0x26')](_0xb598('0x11'),auth['isAuthenticated'](),controller[_0xb598('0x2a')]);router[_0xb598('0x26')](_0xb598('0xb'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb598('0x1a'),auth[_0xb598('0x9')](),controller[_0xb598('0x2b')]);module[_0xb598('0x2c')]=router; \ No newline at end of file +var _0x283e=['addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp'];(function(_0x37a6fd,_0x25edae){var _0x572126=function(_0x4ec961){while(--_0x4ec961){_0x37a6fd['push'](_0x37a6fd['shift']());}};_0x572126(++_0x25edae);}(_0x283e,0xfa));var _0xe283=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x283e[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe283('0x0'));var path=require('path');var timeout=require(_0xe283('0x1'));var express=require(_0xe283('0x2'));var router=express[_0xe283('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe283('0x4'));var interaction=require(_0xe283('0x5'));var config=require('../../config/environment');var controller=require(_0xe283('0x6'));router[_0xe283('0x7')]('/',auth[_0xe283('0x8')](),controller[_0xe283('0x9')]);router['get'](_0xe283('0xa'),auth[_0xe283('0x8')](),controller[_0xe283('0xb')]);router[_0xe283('0x7')](_0xe283('0xc'),auth['isAuthenticated'](),controller[_0xe283('0xd')]);router['get']('/:id/dispositions',auth[_0xe283('0x8')](),controller['getDispositions']);router[_0xe283('0x7')](_0xe283('0xe'),auth[_0xe283('0x8')](),controller['getAnswers']);router[_0xe283('0x7')](_0xe283('0xf'),auth[_0xe283('0x8')](),controller[_0xe283('0x10')]);router[_0xe283('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xe283('0x11')]);router[_0xe283('0x7')](_0xe283('0x12'),auth[_0xe283('0x8')](),controller[_0xe283('0x13')]);router[_0xe283('0x7')](_0xe283('0x14'),auth[_0xe283('0x8')](),controller['getApplications']);router[_0xe283('0x7')](_0xe283('0x15'),auth[_0xe283('0x8')](),controller['getMessages']);router[_0xe283('0x7')](_0xe283('0x16'),auth['isAuthenticated'](),controller[_0xe283('0x17')]);router[_0xe283('0x7')]('/:id/users',auth[_0xe283('0x8')](),controller[_0xe283('0x18')]);router[_0xe283('0x19')](_0xe283('0x1a'),auth[_0xe283('0x8')](),controller[_0xe283('0x1b')]);router[_0xe283('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe283('0x1c')]);router[_0xe283('0x19')]('/',auth[_0xe283('0x8')](),controller['create']);router[_0xe283('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xe283('0x1d')]);router[_0xe283('0x19')](_0xe283('0x1e'),auth[_0xe283('0x8')](),controller[_0xe283('0x1f')]);router[_0xe283('0x19')](_0xe283('0x12'),auth[_0xe283('0x8')](),controller[_0xe283('0x20')]);router[_0xe283('0x19')](_0xe283('0x14'),auth['isAuthenticated'](),controller[_0xe283('0x21')]);router['post'](_0xe283('0x22'),auth[_0xe283('0x8')](),controller[_0xe283('0x23')]);router[_0xe283('0x19')](_0xe283('0x24'),auth[_0xe283('0x8')](),controller[_0xe283('0x25')]);router[_0xe283('0x26')]('/:id',auth[_0xe283('0x8')](),controller['update']);router['delete']('/:id/dispositions',auth[_0xe283('0x8')](),controller[_0xe283('0x27')]);router[_0xe283('0x28')](_0xe283('0xe'),auth[_0xe283('0x8')](),controller[_0xe283('0x29')]);router[_0xe283('0x28')](_0xe283('0xf'),auth[_0xe283('0x8')](),controller[_0xe283('0x2a')]);router[_0xe283('0x28')](_0xe283('0x1e'),auth[_0xe283('0x8')](),controller[_0xe283('0x2b')]);router['delete'](_0xe283('0xc'),auth['isAuthenticated'](),controller[_0xe283('0x2c')]);router[_0xe283('0x28')]('/:id/users',auth[_0xe283('0x8')](),controller[_0xe283('0x2d')]);module[_0xe283('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1011f6c..6594e9c 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 _0x1fb2=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','gmail','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x230249,_0x27c009){var _0x4f6e0b=function(_0x50d266){while(--_0x50d266){_0x230249['push'](_0x230249['shift']());}};_0x4f6e0b(++_0x27c009);}(_0x1fb2,0x14d));var _0x21fb=function(_0x3d9c33,_0xf0c46d){_0x3d9c33=_0x3d9c33-0x0;var _0x5bbd81=_0x1fb2[_0x3d9c33];return _0x5bbd81;};'use strict';var Sequelize=require(_0x21fb('0x0'));module[_0x21fb('0x1')]={'description':{'type':Sequelize[_0x21fb('0x2')]},'name':{'type':Sequelize[_0x21fb('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x21fb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x21fb('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x21fb('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x21fb('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x21fb('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x21fb('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[_0x21fb('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x21fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x21fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x21fb('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x21fb('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x21fb('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x21fb('0x3')],'defaultValue':![],'comment':_0x21fb('0x7'),'set':function(_0x3e36f0){if(!_0x3e36f0)this[_0x21fb('0x8')]('mandatoryDispositionPauseId',null);this[_0x21fb('0x8')]('mandatoryDisposition',_0x3e36f0);}},'provider':{'type':Sequelize['ENUM'](_0x21fb('0x9'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x33c41c=this[_0x21fb('0xa')]('provider');return _0x33c41c||_0x21fb('0xb');},'set':function(_0x56c3bf){if(_0x56c3bf===_0x21fb('0xb')){_0x56c3bf=null;}return this['setDataValue'](_0x21fb('0xc'),_0x56c3bf);}}}; \ No newline at end of file +var _0x7a38=['setDataValue','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x48c5ad,_0x1c9085){var _0x5c32e9=function(_0x6c22e1){while(--_0x6c22e1){_0x48c5ad['push'](_0x48c5ad['shift']());}};_0x5c32e9(++_0x1c9085);}(_0x7a38,0x1c8));var _0x87a3=function(_0x4aa782,_0x26cdec){_0x4aa782=_0x4aa782-0x0;var _0xc51eb2=_0x7a38[_0x4aa782];return _0xc51eb2;};'use strict';var Sequelize=require(_0x87a3('0x0'));module[_0x87a3('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x87a3('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x87a3('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x87a3('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x87a3('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x87a3('0x4')],'defaultValue':function(){return _0x87a3('0x5');}},'notificationSound':{'type':Sequelize[_0x87a3('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x87a3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x87a3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x87a3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x87a3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x87a3('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87a3('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x87a3('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x87a3('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5759e6){if(!_0x5759e6)this[_0x87a3('0x8')]('mandatoryDispositionPauseId',null);this[_0x87a3('0x8')](_0x87a3('0x9'),_0x5759e6);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x87a3('0xa'),_0x87a3('0xb'),_0x87a3('0xc')),'defaultValue':null,'get':function(){var _0x267a68=this[_0x87a3('0xd')](_0x87a3('0xe'));return _0x267a68||_0x87a3('0xf');},'set':function(_0x13a93e){if(_0x13a93e==='custom'){_0x13a93e=null;}return this[_0x87a3('0x8')]('provider',_0x13a93e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c1b279d..73c84ef 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 _0x5037=['fieldName','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','MailServerIn','keys','include','find','update','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','create','getDispositions','findOne','nolimit','Disposition','removeDispositions','CannedAnswer','getAnswers','rawAttributes','removeAnswers','ids','email','active','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','List','Contacts','DESC','Smtp\x20configuration\x20not\x20found','isNil','from','format','attachments','join','root','basename','getSmtpOptions','SendMail','ListId','attach','out','messageId','Interaction','Messages','verifySmtp','CloudProvider','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','get','MailAccounts','destroy','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5037,0x1f2));var _0x7503=function(_0x52ceea,_0x162a4e){_0x52ceea=_0x52ceea-0x0;var _0x21b2e8=_0x5037[_0x52ceea];return _0x21b2e8;};'use strict';var moment=require(_0x7503('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7503('0x1'));var _=require(_0x7503('0x2'));var juice=require(_0x7503('0x3'));var Redis=require(_0x7503('0x4'));var qs=require(_0x7503('0x5'));var logger=require(_0x7503('0x6'))(_0x7503('0x7'));var config=require(_0x7503('0x8'));var db=require(_0x7503('0x9'))['db'];config['redis']=_[_0x7503('0xa')](config[_0x7503('0xb')],{'host':_0x7503('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7503('0xb')]));require(_0x7503('0xd'))[_0x7503('0xe')](socket);var jayson=require(_0x7503('0xf'));var client=jayson[_0x7503('0x10')][_0x7503('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x2f73e3,_0x4399b4,_0x50bb41,_0x4d62fa){return new BPromise(function(_0x1ae227,_0x48f933){var _0x370597=_0x4d62fa||client;return _0x370597[_0x7503('0x12')](_0x2f73e3,_0x50bb41)[_0x7503('0x13')](function(_0x37f5b4){logger['info'](_0x7503('0x14'),_0x4399b4,_0x7503('0x15'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4399b4,'request\x20sent',JSON[_0x7503('0x16')](_0x37f5b4));if(_0x37f5b4[_0x7503('0x17')]){if(_0x37f5b4['error']['code']===0x1f4){logger[_0x7503('0x17')](_0x7503('0x14'),_0x4399b4,_0x37f5b4['error'][_0x7503('0x18')]);return _0x48f933(_0x37f5b4[_0x7503('0x17')][_0x7503('0x18')]);}logger['error'](_0x7503('0x14'),_0x4399b4,_0x37f5b4['error'][_0x7503('0x18')]);return _0x1ae227(_0x37f5b4['error']['message']);}else{logger['info'](_0x7503('0x14'),_0x4399b4,'request\x20sent');_0x1ae227(_0x37f5b4['result'][_0x7503('0x18')]);}})[_0x7503('0x19')](function(_0x3ba591){logger[_0x7503('0x17')](_0x7503('0x14'),_0x4399b4,_0x3ba591);_0x48f933(_0x3ba591);});});}function respondWithStatusCode(_0x52a459,_0x5d4608){_0x5d4608=_0x5d4608||0xcc;return function(_0x12f0be){if(_0x12f0be){return _0x52a459[_0x7503('0x1a')](_0x5d4608);}return _0x52a459[_0x7503('0x1b')](_0x5d4608)[_0x7503('0x1c')]();};}function respondWithResult(_0x4a0773,_0x372152){_0x372152=_0x372152||0xc8;return function(_0x5bda25){if(_0x5bda25){return _0x4a0773[_0x7503('0x1b')](_0x372152)[_0x7503('0x1d')](_0x5bda25);}};}function respondWithFilteredResult(_0x4ff030,_0x136865){return function(_0x19b6e8){if(_0x19b6e8){var _0x42bbc9=typeof _0x136865[_0x7503('0x1e')]===_0x7503('0x1f')&&typeof _0x136865[_0x7503('0x20')]==='undefined';var _0xc0f591=_0x19b6e8[_0x7503('0x21')];var _0x3c3385=_0x42bbc9?0x0:_0x136865['offset'];var _0x233c06=_0x42bbc9?_0x19b6e8[_0x7503('0x21')]:_0x136865['offset']+_0x136865[_0x7503('0x20')];var _0x434fb4;if(_0x233c06>=_0xc0f591){_0x233c06=_0xc0f591;_0x434fb4=0xc8;}else{_0x434fb4=0xce;}_0x4ff030[_0x7503('0x1b')](_0x434fb4);return _0x4ff030[_0x7503('0x22')](_0x7503('0x23'),_0x3c3385+'-'+_0x233c06+'/'+_0xc0f591)[_0x7503('0x1d')](_0x19b6e8);}return null;};}function saveUpdates(_0x4a5793){return function(_0x934f71){if(_0x934f71){return _0x934f71['update'](_0x4a5793)[_0x7503('0x13')](function(_0x34e904){return _0x34e904;});}return null;};}function removeEntity(_0x310082){return function(_0x31f2b9){if(_0x31f2b9){return _0x31f2b9['destroy']()[_0x7503('0x13')](function(){var _0x4da939=_0x31f2b9[_0x7503('0x24')]({'plain':!![]});var _0x396dbf=_0x7503('0x25');return db['UserProfileResource'][_0x7503('0x26')]({'where':{'type':_0x396dbf,'resourceId':_0x4da939['id']}})[_0x7503('0x13')](function(){return _0x31f2b9;});})[_0x7503('0x13')](function(){_0x310082[_0x7503('0x1b')](0xcc)[_0x7503('0x1c')]();});}};}function handleEntityNotFound(_0x299eae){return function(_0x15c39d){if(!_0x15c39d){_0x299eae['sendStatus'](0x194);}return _0x15c39d;};}function handleError(_0x1c88d5,_0xdc4046){_0xdc4046=_0xdc4046||0x1f4;return function(_0x180f0c){logger[_0x7503('0x17')](_0x180f0c['stack']);if(_0x180f0c[_0x7503('0x27')]){delete _0x180f0c['name'];}_0x1c88d5['status'](_0xdc4046)[_0x7503('0x28')](_0x180f0c);};}function getImapHost(_0x4eb94c){switch(_0x4eb94c){case _0x7503('0x29'):return _0x7503('0x2a');case'yahoo':return'imap.mail.yahoo.com';case _0x7503('0x2b'):return _0x7503('0x2c');case'outlook365':return _0x7503('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4eb94c);}function getSmtpHost(_0x1d09a2){switch(_0x1d09a2){case _0x7503('0x29'):return _0x7503('0x2e');case'yahoo':return _0x7503('0x2f');case _0x7503('0x2b'):return _0x7503('0x30');case'outlook365':return'smtp.office365.com';}throw new Error(_0x7503('0x31'),_0x1d09a2);}function getAuthenticationOptions(_0x38cc12,_0x158635){var _0x2d1c7a={};var _0x5d13e7={};if(_0x38cc12){_0x2d1c7a[_0x7503('0x32')]=_0x5d13e7['user']=_0x158635[_0x7503('0x33')];_0x2d1c7a[_0x7503('0x34')]=_0x5d13e7[_0x7503('0x35')]=_0x158635['password'];if(_0x158635[_0x7503('0x36')]){_0x2d1c7a['modernAuthentication']=_0x5d13e7[_0x7503('0x36')]=!![];_0x2d1c7a[_0x7503('0x37')]=_0x5d13e7['CloudProviderId']=_0x158635[_0x7503('0x37')];_0x2d1c7a[_0x7503('0x34')]=_0x5d13e7[_0x7503('0x35')]=null;}else{_0x2d1c7a[_0x7503('0x37')]=_0x5d13e7[_0x7503('0x37')]=null;}_0x2d1c7a['host']=getImapHost(_0x38cc12);_0x2d1c7a[_0x7503('0x38')]=0x3e1;_0x5d13e7[_0x7503('0x39')]=getSmtpHost(_0x38cc12);_0x5d13e7['port']=0x24b;_0x5d13e7[_0x7503('0x3a')]=![];_0x2d1c7a['service']=_0x5d13e7[_0x7503('0x3b')]=null;}else{if(_0x158635['authentication']){_0x2d1c7a[_0x7503('0x32')]=_0x5d13e7['user']=_0x158635['username'];_0x2d1c7a[_0x7503('0x34')]=_0x5d13e7[_0x7503('0x35')]=_0x158635[_0x7503('0x34')];}else{_0x2d1c7a[_0x7503('0x3c')]=_0x5d13e7[_0x7503('0x3c')]=![];_0x2d1c7a['user']=_0x5d13e7['user']=null;_0x2d1c7a[_0x7503('0x34')]=_0x5d13e7[_0x7503('0x35')]=null;}_0x2d1c7a['host']=_0x158635[_0x7503('0x3d')][_0x7503('0x39')];_0x2d1c7a[_0x7503('0x38')]=_0x158635[_0x7503('0x3d')][_0x7503('0x38')];_0x5d13e7[_0x7503('0x39')]=_0x158635[_0x7503('0x3e')]['host'];_0x5d13e7[_0x7503('0x38')]=_0x158635[_0x7503('0x3e')][_0x7503('0x38')];}return{'Imap':_0x2d1c7a,'Smtp':_0x5d13e7};}exports[_0x7503('0x3f')]=function(_0x20ef0e,_0x234234){var _0x5e3b5d={'include':[{'model':db['MailServerIn'],'as':_0x7503('0x3d')},{'model':db[_0x7503('0x40')],'as':'Smtp'},{'model':db[_0x7503('0x41')],'as':_0x7503('0x42')}]},_0x340365={},_0x537385={'count':0x0,'rows':[]};var _0x5b98af=_[_0x7503('0x43')](db[_0x7503('0x44')]['rawAttributes'],function(_0x32665e){return{'name':_0x32665e[_0x7503('0x45')],'type':_0x32665e['type'][_0x7503('0x46')]};});_0x340365[_0x7503('0x47')]=_[_0x7503('0x43')](_0x5b98af,_0x7503('0x27'));_0x340365[_0x7503('0x48')]=_['keys'](_0x20ef0e['query']);_0x340365[_0x7503('0x49')]=_['intersection'](_0x340365[_0x7503('0x47')],_0x340365['query']);_0x5e3b5d['attributes']=_[_0x7503('0x4a')](_0x340365[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x20ef0e[_0x7503('0x48')][_0x7503('0x4b')]));_0x5e3b5d['attributes']=_0x5e3b5d['attributes'][_0x7503('0x4c')]?_0x5e3b5d[_0x7503('0x4d')]:_0x340365['model'];if(!_0x20ef0e[_0x7503('0x48')][_0x7503('0x4e')]('nolimit')){_0x5e3b5d[_0x7503('0x20')]=qs['limit'](_0x20ef0e[_0x7503('0x48')][_0x7503('0x20')]);_0x5e3b5d['offset']=qs[_0x7503('0x1e')](_0x20ef0e[_0x7503('0x48')][_0x7503('0x1e')]);}_0x5e3b5d[_0x7503('0x4f')]=qs['sort'](_0x20ef0e[_0x7503('0x48')][_0x7503('0x50')]);_0x5e3b5d['where']=qs[_0x7503('0x49')](_[_0x7503('0x51')](_0x20ef0e[_0x7503('0x48')],_0x340365[_0x7503('0x49')]),_0x5b98af);if(_0x20ef0e[_0x7503('0x48')][_0x7503('0x52')]){_0x5e3b5d[_0x7503('0x53')]=_[_0x7503('0x54')](_0x5e3b5d[_0x7503('0x53')],{'$or':_['map'](_0x5b98af,function(_0x81f22e){if(_0x81f22e[_0x7503('0x55')]!==_0x7503('0x56')){var _0x410c0b={};_0x410c0b[_0x81f22e[_0x7503('0x27')]]={'$like':'%'+_0x20ef0e['query'][_0x7503('0x52')]+'%'};return _0x410c0b;}})});}_0x5e3b5d=_['merge']({},_0x5e3b5d,_0x20ef0e[_0x7503('0x57')]);var _0x100a49={'where':_0x5e3b5d['where']};return db[_0x7503('0x44')]['count'](_0x100a49)['then'](function(_0x3f4025){_0x537385[_0x7503('0x21')]=_0x3f4025;if(_0x20ef0e[_0x7503('0x48')][_0x7503('0x58')]){_0x5e3b5d['include']=[{'all':!![]}];}return db[_0x7503('0x44')][_0x7503('0x59')](_0x5e3b5d);})['then'](function(_0x34a776){_0x537385[_0x7503('0x5a')]=_0x34a776;return _0x537385;})[_0x7503('0x13')](respondWithFilteredResult(_0x234234,_0x5e3b5d))[_0x7503('0x19')](handleError(_0x234234,null));};exports[_0x7503('0x5b')]=function(_0x5aba02,_0x2558c3){var _0x5cde0c={'raw':![],'where':{'id':_0x5aba02['params']['id']},'include':[{'model':db[_0x7503('0x5c')],'as':_0x7503('0x3d')},{'model':db['MailServerOut'],'as':_0x7503('0x3e')},{'model':db['Pause'],'as':_0x7503('0x42')}]},_0xfb54e0={};_0xfb54e0[_0x7503('0x47')]=_[_0x7503('0x5d')](db['MailAccount']['rawAttributes']);_0xfb54e0[_0x7503('0x48')]=_[_0x7503('0x5d')](_0x5aba02['query']);_0xfb54e0[_0x7503('0x49')]=_['intersection'](_0xfb54e0['model'],_0xfb54e0[_0x7503('0x48')]);_0x5cde0c['attributes']=_[_0x7503('0x4a')](_0xfb54e0[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x5aba02[_0x7503('0x48')]['fields']));_0x5cde0c[_0x7503('0x4d')]=_0x5cde0c[_0x7503('0x4d')][_0x7503('0x4c')]?_0x5cde0c[_0x7503('0x4d')]:_0xfb54e0[_0x7503('0x47')];if(_0x5aba02[_0x7503('0x48')][_0x7503('0x58')]){_0x5cde0c[_0x7503('0x5e')]=[{'all':!![]}];}_0x5cde0c=_[_0x7503('0x54')]({},_0x5cde0c,_0x5aba02[_0x7503('0x57')]);return db['MailAccount'][_0x7503('0x5f')](_0x5cde0c)[_0x7503('0x13')](handleEntityNotFound(_0x2558c3,null))[_0x7503('0x13')](respondWithResult(_0x2558c3,null))['catch'](handleError(_0x2558c3,null));};exports[_0x7503('0x60')]=function(_0x357cb7,_0x3461fa){if(_0x357cb7[_0x7503('0x61')]['id']){delete _0x357cb7[_0x7503('0x61')]['id'];}var _0x22682d=_0x357cb7['body'][_0x7503('0x62')]===_0x7503('0x63')?null:_0x357cb7[_0x7503('0x61')][_0x7503('0x62')];var _0x29a243=_0x357cb7[_0x7503('0x61')][_0x7503('0x3d')]||{};var _0x35f60c=_0x357cb7[_0x7503('0x61')][_0x7503('0x3e')]||{};if(_0x22682d){_0x29a243[_0x7503('0x39')]=getImapHost(_0x22682d);_0x29a243['port']=0x3e1;_0x35f60c[_0x7503('0x39')]=getSmtpHost(_0x22682d);_0x35f60c[_0x7503('0x38')]=0x24b;_0x35f60c[_0x7503('0x3a')]=![];}if(_0x35f60c[_0x7503('0x36')]){_0x35f60c[_0x7503('0x3a')]=![];}else{_0x35f60c[_0x7503('0x37')]=null;}if(!_0x29a243[_0x7503('0x36')])_0x29a243[_0x7503('0x37')]=null;_0x357cb7[_0x7503('0x61')][_0x7503('0x3d')]=_0x29a243;_0x357cb7[_0x7503('0x61')]['Smtp']=_0x35f60c;return db['MailAccount'][_0x7503('0x5f')]({'where':{'id':_0x357cb7[_0x7503('0x64')]['id']},'include':[{'model':db[_0x7503('0x5c')],'as':_0x7503('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7503('0x41')],'as':_0x7503('0x42')}]})[_0x7503('0x13')](handleEntityNotFound(_0x3461fa,null))[_0x7503('0x13')](function(_0x1ddb71){if(!_0x1ddb71)throw new Error(_0x7503('0x65'));if(_0x1ddb71[_0x7503('0x3b')])delete _0x357cb7['body'][_0x7503('0x3d')];return _0x1ddb71;})['then'](saveUpdates(_0x357cb7['body'],null))[_0x7503('0x13')](function(_0x56ef17){if(!_0x357cb7[_0x7503('0x61')]['Imap'])return _0x56ef17;return db[_0x7503('0x5c')][_0x7503('0x60')](_0x357cb7[_0x7503('0x61')][_0x7503('0x3d')],{'where':{'MailAccountId':_0x56ef17['id']}})[_0x7503('0x13')](function(){return _0x56ef17;});})[_0x7503('0x13')](function(_0x3d35a2){if(!_0x357cb7[_0x7503('0x61')][_0x7503('0x3e')])return _0x3d35a2;return db[_0x7503('0x40')]['update'](_0x357cb7[_0x7503('0x61')][_0x7503('0x3e')],{'where':{'MailAccountId':_0x3d35a2['id']}})['then'](function(){return _0x3d35a2;});})[_0x7503('0x13')](respondWithResult(_0x3461fa,null))[_0x7503('0x19')](handleError(_0x3461fa,null));};exports[_0x7503('0x66')]=function(_0x4a9598,_0x17d087){return db[_0x7503('0x44')][_0x7503('0x66')]()[_0x7503('0x13')](respondWithResult(_0x17d087,null))[_0x7503('0x19')](handleError(_0x17d087,null));};exports['addDisposition']=function(_0x3065b8,_0x20a062){if(_0x3065b8['body']['id']){delete _0x3065b8[_0x7503('0x61')]['id'];}return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x3065b8['params']['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x20a062,null))[_0x7503('0x13')](function(_0x452a31){if(_0x452a31){_0x3065b8[_0x7503('0x61')][_0x7503('0x67')]=_0x452a31['id'];return db['Disposition'][_0x7503('0x68')](_0x3065b8[_0x7503('0x61')]);}})[_0x7503('0x13')](respondWithResult(_0x20a062,null))['catch'](handleError(_0x20a062,null));};exports[_0x7503('0x69')]=function(_0x2eb531,_0x290d4c){var _0xf7f38f={'raw':![],'where':{}};var _0x37006a={};var _0x321cec={'count':0x0,'rows':[]};return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x2eb531[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x290d4c,null))['then'](function(_0x58d59d){if(_0x58d59d){_0x37006a[_0x7503('0x47')]=_[_0x7503('0x5d')](db['Disposition']['rawAttributes']);_0x37006a[_0x7503('0x48')]=_['keys'](_0x2eb531[_0x7503('0x48')]);_0x37006a['filters']=_[_0x7503('0x4a')](_0x37006a['model'],_0x37006a[_0x7503('0x48')]);_0xf7f38f['attributes']=_[_0x7503('0x4a')](_0x37006a[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x2eb531[_0x7503('0x48')][_0x7503('0x4b')]));_0xf7f38f[_0x7503('0x4d')]=_0xf7f38f[_0x7503('0x4d')][_0x7503('0x4c')]?_0xf7f38f[_0x7503('0x4d')]:_0x37006a[_0x7503('0x47')];if(!_0x2eb531['query'][_0x7503('0x4e')](_0x7503('0x6b'))){_0xf7f38f[_0x7503('0x20')]=qs['limit'](_0x2eb531['query']['limit']);_0xf7f38f[_0x7503('0x1e')]=qs['offset'](_0x2eb531[_0x7503('0x48')]['offset']);}_0xf7f38f['order']=qs[_0x7503('0x50')](_0x2eb531['query']['sort']);_0xf7f38f[_0x7503('0x53')]=qs['filters'](_[_0x7503('0x51')](_0x2eb531[_0x7503('0x48')],_0x37006a[_0x7503('0x49')]));_0xf7f38f[_0x7503('0x53')][_0x7503('0x67')]=_0x58d59d['id'];if(_0x2eb531[_0x7503('0x48')][_0x7503('0x52')]){_0xf7f38f['where']=_[_0x7503('0x54')](_0xf7f38f[_0x7503('0x53')],{'$or':_['map'](_0xf7f38f[_0x7503('0x4d')],function(_0x1a26f2){var _0xc73812={};_0xc73812[_0x1a26f2]={'$like':'%'+_0x2eb531[_0x7503('0x48')][_0x7503('0x52')]+'%'};return _0xc73812;})});}_0xf7f38f=_[_0x7503('0x54')]({},_0xf7f38f,_0x2eb531['options']);return db[_0x7503('0x6c')][_0x7503('0x21')]({'where':_0xf7f38f[_0x7503('0x53')]})[_0x7503('0x13')](function(_0x217a52){_0x321cec['count']=_0x217a52;if(_0x2eb531[_0x7503('0x48')][_0x7503('0x58')]){_0xf7f38f['include']=[{'all':!![]}];}return db[_0x7503('0x6c')]['findAll'](_0xf7f38f);})['then'](function(_0x2fda85){_0x321cec[_0x7503('0x5a')]=_0x2fda85;return _0x321cec;});}})['then'](respondWithFilteredResult(_0x290d4c,_0xf7f38f))['catch'](handleError(_0x290d4c,null));};exports[_0x7503('0x6d')]=function(_0x327061,_0x2573e9){return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x327061[_0x7503('0x64')]['id']}})['then'](handleEntityNotFound(_0x2573e9,null))['then'](function(_0xb6de4c){if(_0xb6de4c){return _0xb6de4c[_0x7503('0x6d')](_0x327061[_0x7503('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x2573e9,null))['catch'](handleError(_0x2573e9,null));};exports['addAnswer']=function(_0x36f5ac,_0xe33e6b){if(_0x36f5ac[_0x7503('0x61')]['id']){delete _0x36f5ac[_0x7503('0x61')]['id'];}return db[_0x7503('0x44')]['find']({'where':{'id':_0x36f5ac[_0x7503('0x64')]['id']}})['then'](handleEntityNotFound(_0xe33e6b,null))[_0x7503('0x13')](function(_0xa9accb){if(_0xa9accb){_0x36f5ac[_0x7503('0x61')][_0x7503('0x67')]=_0xa9accb['id'];return db[_0x7503('0x6e')]['create'](_0x36f5ac[_0x7503('0x61')]);}})['then'](respondWithResult(_0xe33e6b,null))[_0x7503('0x19')](handleError(_0xe33e6b,null));};exports[_0x7503('0x6f')]=function(_0x406c0a,_0x29c825){var _0x1d65ea={'raw':![],'where':{}};var _0x1ad3ab={};var _0x1c3155={'count':0x0,'rows':[]};return db[_0x7503('0x44')]['findOne']({'where':{'id':_0x406c0a['params']['id']}})['then'](handleEntityNotFound(_0x29c825,null))[_0x7503('0x13')](function(_0x33c633){if(_0x33c633){_0x1ad3ab[_0x7503('0x47')]=_[_0x7503('0x5d')](db[_0x7503('0x6e')][_0x7503('0x70')]);_0x1ad3ab['query']=_[_0x7503('0x5d')](_0x406c0a[_0x7503('0x48')]);_0x1ad3ab['filters']=_[_0x7503('0x4a')](_0x1ad3ab[_0x7503('0x47')],_0x1ad3ab[_0x7503('0x48')]);_0x1d65ea[_0x7503('0x4d')]=_['intersection'](_0x1ad3ab[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x406c0a[_0x7503('0x48')][_0x7503('0x4b')]));_0x1d65ea['attributes']=_0x1d65ea[_0x7503('0x4d')][_0x7503('0x4c')]?_0x1d65ea[_0x7503('0x4d')]:_0x1ad3ab[_0x7503('0x47')];if(!_0x406c0a[_0x7503('0x48')][_0x7503('0x4e')](_0x7503('0x6b'))){_0x1d65ea[_0x7503('0x20')]=qs[_0x7503('0x20')](_0x406c0a[_0x7503('0x48')][_0x7503('0x20')]);_0x1d65ea['offset']=qs['offset'](_0x406c0a[_0x7503('0x48')][_0x7503('0x1e')]);}_0x1d65ea['order']=qs[_0x7503('0x50')](_0x406c0a[_0x7503('0x48')][_0x7503('0x50')]);_0x1d65ea['where']=qs[_0x7503('0x49')](_['pick'](_0x406c0a['query'],_0x1ad3ab[_0x7503('0x49')]));_0x1d65ea['where']['MailAccountId']=_0x33c633['id'];if(_0x406c0a[_0x7503('0x48')]['filter']){_0x1d65ea[_0x7503('0x53')]=_[_0x7503('0x54')](_0x1d65ea['where'],{'$or':_[_0x7503('0x43')](_0x1d65ea[_0x7503('0x4d')],function(_0x1026a2){var _0x529868={};_0x529868[_0x1026a2]={'$like':'%'+_0x406c0a['query'][_0x7503('0x52')]+'%'};return _0x529868;})});}_0x1d65ea=_[_0x7503('0x54')]({},_0x1d65ea,_0x406c0a[_0x7503('0x57')]);return db[_0x7503('0x6e')]['count']({'where':_0x1d65ea[_0x7503('0x53')]})[_0x7503('0x13')](function(_0x3f7df6){_0x1c3155[_0x7503('0x21')]=_0x3f7df6;if(_0x406c0a[_0x7503('0x48')][_0x7503('0x58')]){_0x1d65ea[_0x7503('0x5e')]=[{'all':!![]}];}return db[_0x7503('0x6e')][_0x7503('0x59')](_0x1d65ea);})['then'](function(_0x2f5dca){_0x1c3155[_0x7503('0x5a')]=_0x2f5dca;return _0x1c3155;});}})[_0x7503('0x13')](respondWithFilteredResult(_0x29c825,_0x1d65ea))[_0x7503('0x19')](handleError(_0x29c825,null));};exports[_0x7503('0x71')]=function(_0x1fed38,_0x16dd93){return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x1fed38[_0x7503('0x64')]['id']}})['then'](handleEntityNotFound(_0x16dd93,null))[_0x7503('0x13')](function(_0x5875d7){if(_0x5875d7){return _0x5875d7[_0x7503('0x71')](_0x1fed38['query'][_0x7503('0x72')]);}})[_0x7503('0x13')](respondWithStatusCode(_0x16dd93,null))['catch'](handleError(_0x16dd93,null));};exports[_0x7503('0x68')]=function(_0x245812,_0x3a9e8a){var _0x2f768a={'name':_0x245812['body'][_0x7503('0x27')],'key':_0x245812[_0x7503('0x61')][_0x7503('0x46')],'provider':_0x245812[_0x7503('0x61')]['provider']===_0x7503('0x63')?null:_0x245812[_0x7503('0x61')][_0x7503('0x62')],'email':_0x245812[_0x7503('0x61')][_0x7503('0x73')],'ListId':_0x245812[_0x7503('0x61')]['ListId'],'active':!_['isNil'](_0x245812[_0x7503('0x61')]['active'])?_0x245812['body'][_0x7503('0x74')]:!![],'description':_0x245812[_0x7503('0x61')]['description']||null};var _0x4555c7=getAuthenticationOptions(_0x2f768a['provider'],_0x245812[_0x7503('0x61')]);_0x2f768a[_0x7503('0x3d')]=_0x4555c7['Imap'];_0x2f768a[_0x7503('0x3e')]=_0x4555c7[_0x7503('0x3e')];return db[_0x7503('0x44')]['create'](_0x2f768a,{'include':[{'model':db[_0x7503('0x40')],'as':_0x7503('0x3e')},{'model':db['MailServerIn'],'as':_0x7503('0x3d')}]})[_0x7503('0x13')](function(_0x14eec7){var _0x3b4a66=_0x245812[_0x7503('0x32')][_0x7503('0x24')]({'plain':!![]});if(!_0x3b4a66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b4a66[_0x7503('0x75')]===_0x7503('0x32')){var _0x2352d0=_0x14eec7[_0x7503('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x3b4a66[_0x7503('0x76')]},'raw':!![]})['then'](function(_0x2d014e){if(_0x2d014e&&_0x2d014e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2352d0[_0x7503('0x27')],'resourceId':_0x2352d0['id'],'type':_0x2d014e[_0x7503('0x27')],'sectionId':_0x2d014e['id']},{})[_0x7503('0x13')](function(){return _0x14eec7;});}else{return _0x14eec7;}})[_0x7503('0x19')](function(_0x32d0c3){logger[_0x7503('0x17')](_0x7503('0x77'),_0x32d0c3);throw _0x32d0c3;});}return _0x14eec7;})[_0x7503('0x13')](respondWithResult(_0x3a9e8a,0xc9))[_0x7503('0x19')](handleError(_0x3a9e8a,null));};exports[_0x7503('0x78')]=function(_0x258ba2,_0x523b3a){return db[_0x7503('0x44')]['findOne']({'where':{'id':_0x258ba2[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x523b3a,null))[_0x7503('0x13')](function(_0x941f1){if(_0x941f1){return _0x941f1['getImap']();}return null;})[_0x7503('0x13')](respondWithResult(_0x523b3a,null))[_0x7503('0x19')](handleError(_0x523b3a,null));};exports[_0x7503('0x79')]=function(_0x2f7acc,_0xdbd026){if(_0x2f7acc[_0x7503('0x61')]['id']){delete _0x2f7acc[_0x7503('0x61')]['id'];}return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x2f7acc[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0xdbd026,null))[_0x7503('0x13')](function(_0x265fc1){if(_0x265fc1){_0x2f7acc[_0x7503('0x61')][_0x7503('0x67')]=_0x265fc1['id'];return db[_0x7503('0x5c')][_0x7503('0x68')](_0x2f7acc['body']);}})['then'](respondWithResult(_0xdbd026,null))[_0x7503('0x19')](handleError(_0xdbd026,null));};exports[_0x7503('0x7a')]=function(_0x9067db,_0x5d3fe4){return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x9067db[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x5d3fe4,null))[_0x7503('0x13')](function(_0x55edc1){if(_0x55edc1){return _0x55edc1['setImap'](null);}return null;})[_0x7503('0x13')](respondWithStatusCode(_0x5d3fe4,null))[_0x7503('0x19')](handleError(_0x5d3fe4,null));};exports[_0x7503('0x7b')]=function(_0x586fe5,_0x21a05b){return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x586fe5[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x21a05b,null))['then'](function(_0x387e92){if(_0x387e92){return _0x387e92['getSmtp']();}return null;})['then'](respondWithResult(_0x21a05b,null))[_0x7503('0x19')](handleError(_0x21a05b,null));};exports[_0x7503('0x7c')]=function(_0x5a2165,_0x12747a){if(_0x5a2165[_0x7503('0x61')]['id']){delete _0x5a2165['body']['id'];}return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x5a2165[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x12747a,null))['then'](function(_0xd5efab){if(_0xd5efab){_0x5a2165['body'][_0x7503('0x67')]=_0xd5efab['id'];return db['MailServerOut'][_0x7503('0x68')](_0x5a2165['body']);}})[_0x7503('0x13')](respondWithResult(_0x12747a,null))['catch'](handleError(_0x12747a,null));};exports[_0x7503('0x7d')]=function(_0x3ec085,_0x139fca){return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x3ec085[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x139fca,null))['then'](function(_0x4e4efb){if(_0x4e4efb){return _0x4e4efb[_0x7503('0x7e')](null);}return null;})[_0x7503('0x13')](respondWithStatusCode(_0x139fca,null))['catch'](handleError(_0x139fca,null));};exports[_0x7503('0x7f')]=function(_0x41d623,_0x507073){return db[_0x7503('0x80')][_0x7503('0x5f')]({'where':{'id':_0x41d623[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x507073,null))[_0x7503('0x13')](function(_0x50ec2e){if(_0x50ec2e){return _0x50ec2e[_0x7503('0x7f')](_0x41d623[_0x7503('0x61')][_0x7503('0x72')],_['omit'](_0x41d623['body'],[_0x7503('0x72'),'id'])||{});}})[_0x7503('0x13')](respondWithResult(_0x507073,null))[_0x7503('0x19')](handleError(_0x507073,null));};exports['getInteractions']=function(_0x3bff2a,_0x4a44d8){var _0x2b9c11={'raw':![],'where':{}};var _0x244ef9={};var _0x1c0ed9={'count':0x0,'rows':[]};return db['MailAccount'][_0x7503('0x6a')]({'where':{'id':_0x3bff2a[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x4a44d8,null))[_0x7503('0x13')](function(_0x5d9a01){if(_0x5d9a01){_0x244ef9[_0x7503('0x47')]=_['keys'](db[_0x7503('0x80')][_0x7503('0x70')]);_0x244ef9[_0x7503('0x48')]=_[_0x7503('0x5d')](_0x3bff2a[_0x7503('0x48')]);_0x244ef9[_0x7503('0x49')]=_[_0x7503('0x4a')](_0x244ef9['model'],_0x244ef9[_0x7503('0x48')]);_0x2b9c11[_0x7503('0x4d')]=_[_0x7503('0x4a')](_0x244ef9['model'],qs[_0x7503('0x4b')](_0x3bff2a[_0x7503('0x48')][_0x7503('0x4b')]));_0x2b9c11[_0x7503('0x4d')]=_0x2b9c11[_0x7503('0x4d')][_0x7503('0x4c')]?_0x2b9c11['attributes']:_0x244ef9[_0x7503('0x47')];if(!_0x3bff2a[_0x7503('0x48')][_0x7503('0x4e')]('nolimit')){_0x2b9c11['limit']=qs[_0x7503('0x20')](_0x3bff2a[_0x7503('0x48')]['limit']);_0x2b9c11[_0x7503('0x1e')]=qs[_0x7503('0x1e')](_0x3bff2a[_0x7503('0x48')][_0x7503('0x1e')]);}_0x2b9c11[_0x7503('0x4f')]=qs[_0x7503('0x50')](_0x3bff2a[_0x7503('0x48')]['sort']);_0x2b9c11[_0x7503('0x53')]=qs['filters'](_[_0x7503('0x51')](_0x3bff2a['query'],_0x244ef9[_0x7503('0x49')]));_0x2b9c11[_0x7503('0x53')][_0x7503('0x67')]=_0x5d9a01['id'];if(_0x3bff2a[_0x7503('0x48')]['filter']){_0x2b9c11[_0x7503('0x53')]=_[_0x7503('0x54')](_0x2b9c11[_0x7503('0x53')],{'$or':_[_0x7503('0x43')](_0x2b9c11[_0x7503('0x4d')],function(_0x5b035f){var _0xafa446={};_0xafa446[_0x5b035f]={'$like':'%'+_0x3bff2a[_0x7503('0x48')]['filter']+'%'};return _0xafa446;})});}_0x2b9c11=_[_0x7503('0x54')]({},_0x2b9c11,_0x3bff2a['options']);return db[_0x7503('0x80')][_0x7503('0x21')]({'where':_0x2b9c11[_0x7503('0x53')]})[_0x7503('0x13')](function(_0x289e96){_0x1c0ed9['count']=_0x289e96;if(_0x3bff2a[_0x7503('0x48')][_0x7503('0x58')]){_0x2b9c11[_0x7503('0x5e')]=[{'model':db[_0x7503('0x81')],'as':_0x7503('0x82'),'required':![]},{'model':db[_0x7503('0x83')],'as':_0x7503('0x84'),'attributes':[_0x7503('0x27'),'fullname',_0x7503('0x85')],'required':![]},{'model':db[_0x7503('0x86')],'as':'Tags','attributes':['id',_0x7503('0x27'),_0x7503('0x87')],'where':_0x3bff2a[_0x7503('0x48')][_0x7503('0x88')]?{'id':_0x3bff2a[_0x7503('0x48')][_0x7503('0x88')]}:undefined,'required':_0x3bff2a[_0x7503('0x48')]['tag']?!![]:![]}];}return db[_0x7503('0x80')]['findAll'](_0x2b9c11);})[_0x7503('0x13')](function(_0xff71e){_0x1c0ed9[_0x7503('0x5a')]=_0xff71e;return _0x1c0ed9;});}})['then'](respondWithFilteredResult(_0x4a44d8,_0x2b9c11))['catch'](handleError(_0x4a44d8,null));};exports[_0x7503('0x89')]=function addApplications(_0x402819,_0x5ca31b){var _0x30c8d0=_0x402819[_0x7503('0x64')]['id'];var _0x38b9eb=_0x402819[_0x7503('0x61')];var _0x5be4a3=0xc8;var _0x5bb17e=null;return db[_0x7503('0x8a')][_0x7503('0x8b')]({'isolationLevel':db[_0x7503('0x8a')][_0x7503('0x8c')][_0x7503('0x8d')][_0x7503('0x8e')]},function(_0x402497){return db[_0x7503('0x44')]['findOne']({'where':{'id':_0x30c8d0},'transaction':_0x402497})[_0x7503('0x13')](function(_0xcc6685){if(_0xcc6685){return db[_0x7503('0x8f')][_0x7503('0x26')]({'where':{'MailAccountId':_0x30c8d0},'transaction':_0x402497})['then'](function(){var _0x897e9c=_[_0x7503('0x43')](_0x38b9eb,function(_0x3a55a9){_0x3a55a9[_0x7503('0x67')]=_0x30c8d0;return _0x3a55a9;});return db[_0x7503('0x8f')][_0x7503('0x90')](_0x897e9c,{'transaction':_0x402497});});}else{_0x5be4a3=0x194;_0x5bb17e=[];}});})[_0x7503('0x13')](function(){if(_0x5be4a3!==0x194){return db[_0x7503('0x8f')][_0x7503('0x91')]({'where':{'MailAccountId':_0x30c8d0},'order':_0x7503('0x92')})['then'](function(_0x3e7d25){_0x5bb17e=_0x3e7d25;});}})[_0x7503('0x19')](function(_0x427531){_0x5be4a3=0x1f4;logger['error'](_0x427531[_0x7503('0x93')]);if(_0x427531[_0x7503('0x27')]){delete _0x427531[_0x7503('0x27')];}_0x5bb17e=_0x427531;})[_0x7503('0x94')](function(){if(_0x5bb17e===null){_0x5ca31b[_0x7503('0x1a')](_0x5be4a3);}else{if(_0x5be4a3===0x1f4){_0x5ca31b['status'](_0x5be4a3)[_0x7503('0x28')](_0x5bb17e);}else{_0x5ca31b['status'](_0x5be4a3)['json'](_0x5bb17e);}}});};exports[_0x7503('0x95')]=function(_0x3dbec1,_0x277cd4){var _0x3de7b6={};var _0x44dec1={};var _0x441059;var _0x582139;return db['MailAccount'][_0x7503('0x6a')]({'where':{'id':_0x3dbec1[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x277cd4,null))[_0x7503('0x13')](function(_0x301930){if(_0x301930){_0x441059=_0x301930;_0x44dec1[_0x7503('0x47')]=_[_0x7503('0x5d')](db[_0x7503('0x8f')][_0x7503('0x70')]);_0x44dec1[_0x7503('0x48')]=_[_0x7503('0x5d')](_0x3dbec1[_0x7503('0x48')]);_0x44dec1['filters']=_[_0x7503('0x4a')](_0x44dec1[_0x7503('0x47')],_0x44dec1[_0x7503('0x48')]);_0x3de7b6[_0x7503('0x4d')]=_['intersection'](_0x44dec1[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x3dbec1[_0x7503('0x48')][_0x7503('0x4b')]));_0x3de7b6[_0x7503('0x4d')]=_0x3de7b6[_0x7503('0x4d')][_0x7503('0x4c')]?_0x3de7b6[_0x7503('0x4d')]:_0x44dec1[_0x7503('0x47')];_0x3de7b6[_0x7503('0x4f')]=qs[_0x7503('0x50')](_0x3dbec1[_0x7503('0x48')]['sort']);_0x3de7b6[_0x7503('0x53')]=qs[_0x7503('0x49')](_[_0x7503('0x51')](_0x3dbec1[_0x7503('0x48')],_0x44dec1['filters']));if(_0x3dbec1[_0x7503('0x48')]['filter']){_0x3de7b6[_0x7503('0x53')]=_['merge'](_0x3de7b6[_0x7503('0x53')],{'$or':_[_0x7503('0x43')](_0x3de7b6[_0x7503('0x4d')],function(_0x41efd6){var _0x1495bc={};_0x1495bc[_0x41efd6]={'$like':'%'+_0x3dbec1[_0x7503('0x48')]['filter']+'%'};return _0x1495bc;})});}_0x3de7b6=_[_0x7503('0x54')]({},_0x3de7b6,_0x3dbec1[_0x7503('0x57')]);return _0x441059[_0x7503('0x95')](_0x3de7b6);}})[_0x7503('0x13')](function(_0x59c798){if(_0x59c798){_0x582139=_0x59c798[_0x7503('0x4c')];if(!_0x3dbec1['query'][_0x7503('0x4e')](_0x7503('0x6b'))){_0x3de7b6['limit']=qs[_0x7503('0x20')](_0x3dbec1[_0x7503('0x48')][_0x7503('0x20')]);_0x3de7b6['offset']=qs[_0x7503('0x1e')](_0x3dbec1[_0x7503('0x48')][_0x7503('0x1e')]);}return _0x441059[_0x7503('0x95')](_0x3de7b6);}})[_0x7503('0x13')](function(_0x246ab5){if(_0x246ab5){return _0x246ab5?{'count':_0x582139,'rows':_0x246ab5}:null;}})[_0x7503('0x13')](respondWithResult(_0x277cd4,null))[_0x7503('0x19')](handleError(_0x277cd4,null));};exports[_0x7503('0x96')]=function(_0x2e01c2,_0x386f2a){var _0x15b89c={'raw':!![],'where':{}};var _0xbca7cd={};var _0x2ea18d={'count':0x0,'rows':[]};return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x2e01c2[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x386f2a,null))[_0x7503('0x13')](function(_0x4ee8e6){if(_0x4ee8e6){_0xbca7cd['model']=_[_0x7503('0x5d')](db['MailMessage'][_0x7503('0x70')]);_0xbca7cd['query']=_[_0x7503('0x5d')](_0x2e01c2[_0x7503('0x48')]);_0xbca7cd['filters']=_[_0x7503('0x4a')](_0xbca7cd['model'],_0xbca7cd[_0x7503('0x48')]);_0x15b89c['attributes']=_['intersection'](_0xbca7cd['model'],qs[_0x7503('0x4b')](_0x2e01c2[_0x7503('0x48')][_0x7503('0x4b')]));_0x15b89c[_0x7503('0x4d')]=_0x15b89c[_0x7503('0x4d')][_0x7503('0x4c')]?_0x15b89c[_0x7503('0x4d')]:_0xbca7cd[_0x7503('0x47')];if(!_0x2e01c2[_0x7503('0x48')]['hasOwnProperty']('nolimit')){_0x15b89c[_0x7503('0x20')]=qs[_0x7503('0x20')](_0x2e01c2[_0x7503('0x48')][_0x7503('0x20')]);_0x15b89c[_0x7503('0x1e')]=qs[_0x7503('0x1e')](_0x2e01c2[_0x7503('0x48')][_0x7503('0x1e')]);}_0x15b89c['order']=qs[_0x7503('0x50')](_0x2e01c2['query']['sort']);_0x15b89c[_0x7503('0x53')]=qs[_0x7503('0x49')](_['pick'](_0x2e01c2[_0x7503('0x48')],_0xbca7cd[_0x7503('0x49')]));_0x15b89c['where'][_0x7503('0x67')]=_0x4ee8e6['id'];if(_0x2e01c2[_0x7503('0x48')][_0x7503('0x52')]){_0x15b89c['where']=_[_0x7503('0x54')](_0x15b89c[_0x7503('0x53')],{'$or':_[_0x7503('0x43')](_0x15b89c[_0x7503('0x4d')],function(_0x23c7da){var _0x47810c={};_0x47810c[_0x23c7da]={'$like':'%'+_0x2e01c2[_0x7503('0x48')]['filter']+'%'};return _0x47810c;})});}if(_0x2e01c2[_0x7503('0x48')][_0x7503('0x97')]){var _0x15a61e=_0x2e01c2[_0x7503('0x48')][_0x7503('0x97')]['split'](',');var _0x20ec78={};_0x20ec78[_0x15a61e[0x0]]={'$gte':moment(_0x15a61e[0x1])['format'](_0x7503('0x98'))};_0x15b89c[_0x7503('0x53')]=_[_0x7503('0x54')](_0x15b89c[_0x7503('0x53')],_0x20ec78);}_0x15b89c=_[_0x7503('0x54')]({},_0x15b89c,_0x2e01c2[_0x7503('0x57')]);return db['MailMessage'][_0x7503('0x21')]({'where':_0x15b89c[_0x7503('0x53')]})['then'](function(_0x4b3a31){_0x2ea18d[_0x7503('0x21')]=_0x4b3a31;if(_0x2e01c2['query'][_0x7503('0x58')]){_0x15b89c[_0x7503('0x5e')]=[{'all':!![]}];}return db[_0x7503('0x99')]['findAll'](_0x15b89c);})[_0x7503('0x13')](function(_0x15b5bd){if(_0x2e01c2['query'][_0x7503('0x9a')]===_0x7503('0x9b')){for(var _0x24df6e=0x0;_0x24df6e<_0x15b5bd[_0x7503('0x4c')];_0x24df6e++){_0x15b5bd[_0x24df6e][_0x7503('0x61')]=juice(_0x15b5bd[_0x24df6e][_0x7503('0x61')]);}}_0x2ea18d['rows']=_0x15b5bd;return _0x2ea18d;});}})['then'](respondWithFilteredResult(_0x386f2a,_0x15b89c))[_0x7503('0x19')](handleError(_0x386f2a,null));};exports[_0x7503('0x28')]=function(_0x1ecfef,_0x34e942){var _0x420700,_0x2c832b={},_0x2e0dcb;if(_0x1ecfef['body']['to']){_0x2e0dcb=_0x1ecfef['body']['to'][_0x7503('0x9c')](',')[0x0];}return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x1ecfef['params']['id']},'include':[{'model':db['CmList'],'as':_0x7503('0x9d'),'include':[{'model':db['CmContact'],'as':_0x7503('0x9e'),'where':{'email':_0x2e0dcb},'limit':0x1,'order':[['updatedAt',_0x7503('0x9f')]]}]},{'model':db['MailServerOut'],'as':_0x7503('0x3e'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x34e942,null))[_0x7503('0x13')](function(_0x42a0c4){if(!_0x42a0c4)return;_0x420700=_0x42a0c4;if(!_0x42a0c4[_0x7503('0x3e')])throw new Error(_0x7503('0xa0'));if(_[_0x7503('0xa1')](_0x1ecfef[_0x7503('0x61')][_0x7503('0xa2')])){_0x1ecfef['body'][_0x7503('0xa2')]=util[_0x7503('0xa3')]('%s\x20<%s>',_0x42a0c4[_0x7503('0x27')],_0x42a0c4['email']||_0x42a0c4[_0x7503('0x3e')][_0x7503('0x32')]);}if(_0x1ecfef[_0x7503('0x61')][_0x7503('0xa4')]&&_0x1ecfef[_0x7503('0x61')][_0x7503('0xa4')][_0x7503('0x4c')]){for(var _0x3fa2b4=0x0;_0x3fa2b4<_0x1ecfef[_0x7503('0x61')][_0x7503('0xa4')][_0x7503('0x4c')];_0x3fa2b4+=0x1){_0x1ecfef['body'][_0x7503('0xa4')][_0x3fa2b4]={'filename':_0x1ecfef['body']['attachments'][_0x3fa2b4][_0x7503('0x27')],'path':path[_0x7503('0xa5')](config[_0x7503('0xa6')],'server/files/attachments',_0x1ecfef[_0x7503('0x61')][_0x7503('0xa4')][_0x3fa2b4][_0x7503('0xa7')])};}}var _0x5f1d58=_0x42a0c4[_0x7503('0xa8')]();return respondWithRpcPromise(_0x7503('0xa9'),'sendMail',{'account':_0x5f1d58,'message':_0x1ecfef['body']});})['then'](function(_0x47057c){if(!_0x47057c)return;_0x2c832b=_0x47057c;if(!_0x420700[_0x7503('0x9d')])throw new Error('List\x20not\x20found');if(_0x420700[_0x7503('0x9d')][_0x7503('0x9e')]['length'])return _0x420700['List'][_0x7503('0x9e')][0x0];return db['CmContact'][_0x7503('0x68')](_[_0x7503('0xa')](_0x1ecfef[_0x7503('0x61')],{'firstName':_0x1ecfef[_0x7503('0x61')]['to'],'email':_0x1ecfef['body']['to'],'phone':_0x1ecfef[_0x7503('0x61')]['to'],'ListId':_0x420700[_0x7503('0xaa')]}));})[_0x7503('0x13')](function(_0x358f23){if(!_0x358f23)return;var _0x400140={'UserId':_0x1ecfef[_0x7503('0x32')]['id'],'ContactId':_0x358f23['id'],'MailAccountId':_0x420700['id'],'inReplyTo':_0x2c832b['messageId'],'to':_0x1ecfef[_0x7503('0x61')][_0x7503('0xa2')],'cc':_0x1ecfef[_0x7503('0x61')]['cc'],'subject':_0x1ecfef[_0x7503('0x61')]['subject'],'attach':_0x1ecfef[_0x7503('0x61')][_0x7503('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x7503('0xa3')](_0x7503('0x98')),'lastMsgDirection':_0x7503('0xac'),'Messages':[_[_0x7503('0x54')](_0x1ecfef[_0x7503('0x61')],{'messageId':_0x2c832b[_0x7503('0xad')],'sentAt':moment()[_0x7503('0xa3')](_0x7503('0x98')),'read':!![],'MailAccountId':_0x420700['id'],'UserId':_0x1ecfef['user']['id'],'ContactId':_0x358f23['id']})]};if(_0x1ecfef[_0x7503('0x61')]['Interaction']){_0x400140=_[_0x7503('0x54')](_0x400140,_0x1ecfef[_0x7503('0x61')][_0x7503('0xae')]);}return db[_0x7503('0x80')][_0x7503('0x68')](_0x400140,{'include':[{'model':db[_0x7503('0x99')],'as':_0x7503('0xaf')}]});})[_0x7503('0x13')](respondWithResult(_0x34e942,null))['catch'](handleError(_0x34e942,null));};exports[_0x7503('0xb0')]=function(_0x2c257b,_0x56b764){return db['MailAccount']['find']({'where':{'id':_0x2c257b['params']['id']},'include':[{'model':db[_0x7503('0x40')],'as':_0x7503('0x3e'),'raw':!![],'include':[{'model':db[_0x7503('0xb1')],'as':_0x7503('0xb1'),'raw':!![]}]}]})[_0x7503('0x13')](handleEntityNotFound(_0x56b764,null))[_0x7503('0x13')](function(_0x250988){if(!_0x250988[_0x7503('0x3e')])return;var _0x26f104=_0x250988[_0x7503('0xa8')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x26f104});})[_0x7503('0x13')](respondWithResult(_0x56b764,null))['catch'](handleError(_0x56b764,null));};exports[_0x7503('0x26')]=function(_0x4854a9,_0x2a4949){return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0x4854a9[_0x7503('0x64')]['id']}})['then'](handleEntityNotFound(_0x2a4949,null))[_0x7503('0x13')](function(_0x2491f0){if(_0x2491f0&&_0x2491f0[_0x7503('0x3b')]){throw new db[(_0x7503('0xb2'))]['ValidationError'](_0x7503('0xb3'));}return _0x2491f0;})['then'](removeEntity(_0x2a4949,null))[_0x7503('0x19')](handleError(_0x2a4949,null));};exports[_0x7503('0xb4')]=function(_0xea5697,_0x320ca2){return db[_0x7503('0x44')][_0x7503('0x5f')]({'where':{'id':_0xea5697[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x320ca2,null))[_0x7503('0x13')](function(_0x5068c7){if(_0x5068c7){return _0x5068c7['addAgents'](_0xea5697[_0x7503('0x61')]['ids'],_[_0x7503('0xb5')](_0xea5697[_0x7503('0x61')],['ids','id'])||{})[_0x7503('0xb6')](function(_0x27dd13){for(var _0x3137bc=0x0;_0x3137bc<_0xea5697[_0x7503('0x61')][_0x7503('0x72')]['length'];_0x3137bc+=0x1){socket[_0x7503('0xb7')](_0x7503('0xb8'),{'UserId':Number(_0xea5697['body'][_0x7503('0x72')][_0x3137bc]),'MailAccountId':Number(_0xea5697['params']['id'])});}return _0x27dd13;});}})['then'](respondWithResult(_0x320ca2,null))[_0x7503('0x19')](handleError(_0x320ca2,null));};exports['removeAgents']=function(_0x2747bb,_0x1e098d){return db[_0x7503('0x44')]['find']({'where':{'id':_0x2747bb[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x1e098d,null))['then'](function(_0x3263d4){if(_0x3263d4){return _0x3263d4[_0x7503('0xb9')](_0x2747bb['query']['ids'])[_0x7503('0x13')](function(){if(_[_0x7503('0xba')](_0x2747bb[_0x7503('0x48')][_0x7503('0x72')])){for(var _0x46e010=0x0;_0x46e010<_0x2747bb[_0x7503('0x48')][_0x7503('0x72')]['length'];_0x46e010+=0x1){socket[_0x7503('0xb7')](_0x7503('0xbb'),{'UserId':Number(_0x2747bb[_0x7503('0x48')][_0x7503('0x72')][_0x46e010]),'MailAccountId':Number(_0x2747bb['params']['id'])});}}else{socket[_0x7503('0xb7')](_0x7503('0xbb'),{'UserId':Number(_0x2747bb[_0x7503('0x48')][_0x7503('0x72')]),'MailAccountId':Number(_0x2747bb[_0x7503('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e098d,null))[_0x7503('0x19')](handleError(_0x1e098d,null));};exports[_0x7503('0xbc')]=function(_0x4ea479,_0x5acb50){var _0x34735f={};var _0x21db86={};var _0x53327d;var _0x19842;return db[_0x7503('0x44')][_0x7503('0x6a')]({'where':{'id':_0x4ea479[_0x7503('0x64')]['id']}})[_0x7503('0x13')](handleEntityNotFound(_0x5acb50,null))[_0x7503('0x13')](function(_0x129e7b){if(_0x129e7b){_0x53327d=_0x129e7b;_0x21db86[_0x7503('0x47')]=_[_0x7503('0x5d')](db[_0x7503('0x83')]['rawAttributes']);_0x21db86['query']=_[_0x7503('0x5d')](_0x4ea479[_0x7503('0x48')]);_0x21db86[_0x7503('0x49')]=_[_0x7503('0x4a')](_0x21db86[_0x7503('0x47')],_0x21db86[_0x7503('0x48')]);_0x34735f[_0x7503('0x4d')]=_[_0x7503('0x4a')](_0x21db86[_0x7503('0x47')],qs[_0x7503('0x4b')](_0x4ea479[_0x7503('0x48')][_0x7503('0x4b')]));_0x34735f[_0x7503('0x4d')]=_0x34735f['attributes'][_0x7503('0x4c')]?_0x34735f[_0x7503('0x4d')]:_0x21db86[_0x7503('0x47')];_0x34735f[_0x7503('0x4f')]=qs['sort'](_0x4ea479[_0x7503('0x48')][_0x7503('0x50')]);_0x34735f[_0x7503('0x53')]=qs['filters'](_['pick'](_0x4ea479['query'],_0x21db86['filters']));if(_0x4ea479[_0x7503('0x48')][_0x7503('0x52')]){_0x34735f[_0x7503('0x53')]=_[_0x7503('0x54')](_0x34735f[_0x7503('0x53')],{'$or':_[_0x7503('0x43')](_0x34735f[_0x7503('0x4d')],function(_0x52e1b4){var _0x4450f8={};_0x4450f8[_0x52e1b4]={'$like':'%'+_0x4ea479[_0x7503('0x48')]['filter']+'%'};return _0x4450f8;})});}_0x34735f=_['merge']({},_0x34735f,_0x4ea479[_0x7503('0x57')]);return _0x53327d[_0x7503('0xbc')](_0x34735f);}})['then'](function(_0x2afd0c){if(_0x2afd0c){_0x19842=_0x2afd0c['length'];if(!_0x4ea479['query'][_0x7503('0x4e')](_0x7503('0x6b'))){_0x34735f[_0x7503('0x20')]=qs[_0x7503('0x20')](_0x4ea479[_0x7503('0x48')]['limit']);_0x34735f[_0x7503('0x1e')]=qs[_0x7503('0x1e')](_0x4ea479[_0x7503('0x48')][_0x7503('0x1e')]);}return _0x53327d[_0x7503('0xbc')](_0x34735f);}})['then'](function(_0x4c93ae){if(_0x4c93ae){return _0x4c93ae?{'count':_0x19842,'rows':_0x4c93ae}:null;}})[_0x7503('0x13')](respondWithResult(_0x5acb50,null))['catch'](handleError(_0x5acb50,null));}; \ No newline at end of file +var _0xea0c=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','MailAccount','include','findAll','rows','show','params','includeAll','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','Contacts','defaults','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','name','send','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xea0c,0x13a));var _0xcea0=function(_0x25c73d,_0x986f2b){_0x25c73d=_0x25c73d-0x0;var _0x4c0313=_0xea0c[_0x25c73d];return _0x4c0313;};'use strict';var moment=require(_0xcea0('0x0'));var BPromise=require(_0xcea0('0x1'));var util=require(_0xcea0('0x2'));var path=require(_0xcea0('0x3'));var _=require(_0xcea0('0x4'));var juice=require('juice');var Redis=require(_0xcea0('0x5'));var qs=require(_0xcea0('0x6'));var logger=require('../../config/logger')(_0xcea0('0x7'));var config=require('../../config/environment');var db=require(_0xcea0('0x8'))['db'];config['redis']=_['defaults'](config[_0xcea0('0x9')],{'host':_0xcea0('0xa'),'port':0x18eb});var socket=require(_0xcea0('0xb'))(new Redis(config[_0xcea0('0x9')]));require(_0xcea0('0xc'))[_0xcea0('0xd')](socket);var jayson=require(_0xcea0('0xe'));var client=jayson[_0xcea0('0xf')][_0xcea0('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x8dbf59,_0x12230e,_0x25d9b3,_0x3a51c4){return new BPromise(function(_0x54a90e,_0x1c3197){var _0x525d77=_0x3a51c4||client;return _0x525d77[_0xcea0('0x11')](_0x8dbf59,_0x25d9b3)[_0xcea0('0x12')](function(_0x17c9ce){logger[_0xcea0('0x13')](_0xcea0('0x14'),_0x12230e,_0xcea0('0x15'));logger[_0xcea0('0x16')](_0xcea0('0x17'),_0x12230e,_0xcea0('0x15'),JSON[_0xcea0('0x18')](_0x17c9ce));if(_0x17c9ce[_0xcea0('0x19')]){if(_0x17c9ce[_0xcea0('0x19')][_0xcea0('0x1a')]===0x1f4){logger[_0xcea0('0x19')](_0xcea0('0x14'),_0x12230e,_0x17c9ce[_0xcea0('0x19')][_0xcea0('0x1b')]);return _0x1c3197(_0x17c9ce[_0xcea0('0x19')][_0xcea0('0x1b')]);}logger[_0xcea0('0x19')]('MailAccount,\x20%s,\x20%s',_0x12230e,_0x17c9ce[_0xcea0('0x19')]['message']);return _0x54a90e(_0x17c9ce[_0xcea0('0x19')][_0xcea0('0x1b')]);}else{logger[_0xcea0('0x13')](_0xcea0('0x14'),_0x12230e,_0xcea0('0x15'));_0x54a90e(_0x17c9ce[_0xcea0('0x1c')][_0xcea0('0x1b')]);}})[_0xcea0('0x1d')](function(_0x1fee39){logger['error'](_0xcea0('0x14'),_0x12230e,_0x1fee39);_0x1c3197(_0x1fee39);});});}function respondWithStatusCode(_0x4abd8d,_0xf94520){_0xf94520=_0xf94520||0xcc;return function(_0x3ef55a){if(_0x3ef55a){return _0x4abd8d[_0xcea0('0x1e')](_0xf94520);}return _0x4abd8d[_0xcea0('0x1f')](_0xf94520)[_0xcea0('0x20')]();};}function respondWithResult(_0x465f17,_0x5a274d){_0x5a274d=_0x5a274d||0xc8;return function(_0x3b366d){if(_0x3b366d){return _0x465f17[_0xcea0('0x1f')](_0x5a274d)[_0xcea0('0x21')](_0x3b366d);}};}function respondWithFilteredResult(_0x30619f,_0xd446e2){return function(_0x970c7){if(_0x970c7){var _0x4f0dbe=typeof _0xd446e2['offset']===_0xcea0('0x22')&&typeof _0xd446e2[_0xcea0('0x23')]===_0xcea0('0x22');var _0x4418cb=_0x970c7[_0xcea0('0x24')];var _0x5e6a4b=_0x4f0dbe?0x0:_0xd446e2[_0xcea0('0x25')];var _0x346878=_0x4f0dbe?_0x970c7[_0xcea0('0x24')]:_0xd446e2[_0xcea0('0x25')]+_0xd446e2[_0xcea0('0x23')];var _0x281a93;if(_0x346878>=_0x4418cb){_0x346878=_0x4418cb;_0x281a93=0xc8;}else{_0x281a93=0xce;}_0x30619f[_0xcea0('0x1f')](_0x281a93);return _0x30619f[_0xcea0('0x26')](_0xcea0('0x27'),_0x5e6a4b+'-'+_0x346878+'/'+_0x4418cb)[_0xcea0('0x21')](_0x970c7);}return null;};}function saveUpdates(_0x45d5e0){return function(_0x27192e){if(_0x27192e){return _0x27192e[_0xcea0('0x28')](_0x45d5e0)[_0xcea0('0x12')](function(_0x43ac7d){return _0x43ac7d;});}return null;};}function removeEntity(_0x1ec103){return function(_0x3bf018){if(_0x3bf018){return _0x3bf018[_0xcea0('0x29')]()[_0xcea0('0x12')](function(){var _0x213dc1=_0x3bf018[_0xcea0('0x2a')]({'plain':!![]});var _0x43325a=_0xcea0('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x43325a,'resourceId':_0x213dc1['id']}})[_0xcea0('0x12')](function(){return _0x3bf018;});})[_0xcea0('0x12')](function(){_0x1ec103[_0xcea0('0x1f')](0xcc)[_0xcea0('0x20')]();});}};}function handleEntityNotFound(_0x4c3aa6){return function(_0x35287f){if(!_0x35287f){_0x4c3aa6[_0xcea0('0x1e')](0x194);}return _0x35287f;};}function handleError(_0x4380e7,_0x2783aa){_0x2783aa=_0x2783aa||0x1f4;return function(_0x286625){logger[_0xcea0('0x19')](_0x286625['stack']);if(_0x286625[_0xcea0('0x2c')]){delete _0x286625[_0xcea0('0x2c')];}_0x4380e7[_0xcea0('0x1f')](_0x2783aa)[_0xcea0('0x2d')](_0x286625);};}function getImapHost(_0x22483b){switch(_0x22483b){case _0xcea0('0x2e'):return'imap.gmail.com';case'yahoo':return _0xcea0('0x2f');case _0xcea0('0x30'):return _0xcea0('0x31');case _0xcea0('0x32'):return'outlook.office365.com';}throw new Error(_0xcea0('0x33'),_0x22483b);}function getSmtpHost(_0x976dd5){switch(_0x976dd5){case _0xcea0('0x2e'):return _0xcea0('0x34');case _0xcea0('0x35'):return'smtp.mail.yahoo.com';case _0xcea0('0x30'):return'smtp-mail.outlook.com';case'outlook365':return _0xcea0('0x36');}throw new Error(_0xcea0('0x33'),_0x976dd5);}function getAuthenticationOptions(_0x2f9a73,_0x31fd71){var _0x21c271={};var _0x397973={};if(_0x2f9a73){_0x21c271['user']=_0x397973[_0xcea0('0x37')]=_0x31fd71['username'];_0x21c271[_0xcea0('0x38')]=_0x397973['pass']=_0x31fd71[_0xcea0('0x38')];if(_0x31fd71['modernAuthentication']){_0x21c271['modernAuthentication']=_0x397973[_0xcea0('0x39')]=!![];_0x21c271[_0xcea0('0x3a')]=_0x397973[_0xcea0('0x3a')]=_0x31fd71[_0xcea0('0x3a')];_0x21c271[_0xcea0('0x38')]=_0x397973[_0xcea0('0x3b')]=null;}else{_0x21c271[_0xcea0('0x3a')]=_0x397973['CloudProviderId']=null;}_0x21c271['host']=getImapHost(_0x2f9a73);_0x21c271[_0xcea0('0x3c')]=0x3e1;_0x397973[_0xcea0('0x3d')]=getSmtpHost(_0x2f9a73);_0x397973[_0xcea0('0x3c')]=0x24b;_0x397973[_0xcea0('0x3e')]=![];_0x21c271[_0xcea0('0x3f')]=_0x397973['service']=null;}else{if(_0x31fd71[_0xcea0('0x40')]){_0x21c271[_0xcea0('0x37')]=_0x397973[_0xcea0('0x37')]=_0x31fd71[_0xcea0('0x41')];_0x21c271[_0xcea0('0x38')]=_0x397973['pass']=_0x31fd71[_0xcea0('0x38')];}else{_0x21c271[_0xcea0('0x40')]=_0x397973[_0xcea0('0x40')]=![];_0x21c271['user']=_0x397973[_0xcea0('0x37')]=null;_0x21c271[_0xcea0('0x38')]=_0x397973[_0xcea0('0x3b')]=null;}_0x21c271[_0xcea0('0x3d')]=_0x31fd71[_0xcea0('0x42')]['host'];_0x21c271['port']=_0x31fd71[_0xcea0('0x42')][_0xcea0('0x3c')];_0x397973[_0xcea0('0x3d')]=_0x31fd71['Smtp'][_0xcea0('0x3d')];_0x397973[_0xcea0('0x3c')]=_0x31fd71[_0xcea0('0x43')][_0xcea0('0x3c')];}return{'Imap':_0x21c271,'Smtp':_0x397973};}exports[_0xcea0('0x44')]=function(_0x3469e0,_0x2c4933){var _0x336996={'include':[{'model':db[_0xcea0('0x45')],'as':_0xcea0('0x42')},{'model':db[_0xcea0('0x46')],'as':_0xcea0('0x43')},{'model':db[_0xcea0('0x47')],'as':_0xcea0('0x48')}]},_0x234530={},_0x3c0715={'count':0x0,'rows':[]};var _0x13b848=_[_0xcea0('0x49')](db['MailAccount'][_0xcea0('0x4a')],function(_0x39b6fe){return{'name':_0x39b6fe[_0xcea0('0x4b')],'type':_0x39b6fe[_0xcea0('0x4c')]['key']};});_0x234530[_0xcea0('0x4d')]=_['map'](_0x13b848,'name');_0x234530[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x3469e0[_0xcea0('0x4e')]);_0x234530[_0xcea0('0x50')]=_[_0xcea0('0x51')](_0x234530[_0xcea0('0x4d')],_0x234530[_0xcea0('0x4e')]);_0x336996['attributes']=_[_0xcea0('0x51')](_0x234530[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x3469e0[_0xcea0('0x4e')][_0xcea0('0x52')]));_0x336996[_0xcea0('0x53')]=_0x336996[_0xcea0('0x53')][_0xcea0('0x54')]?_0x336996[_0xcea0('0x53')]:_0x234530[_0xcea0('0x4d')];if(!_0x3469e0[_0xcea0('0x4e')][_0xcea0('0x55')](_0xcea0('0x56'))){_0x336996[_0xcea0('0x23')]=qs['limit'](_0x3469e0[_0xcea0('0x4e')]['limit']);_0x336996['offset']=qs['offset'](_0x3469e0[_0xcea0('0x4e')]['offset']);}_0x336996[_0xcea0('0x57')]=qs['sort'](_0x3469e0[_0xcea0('0x4e')]['sort']);_0x336996['where']=qs[_0xcea0('0x50')](_[_0xcea0('0x58')](_0x3469e0['query'],_0x234530['filters']),_0x13b848);if(_0x3469e0['query'][_0xcea0('0x59')]){_0x336996[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0x336996[_0xcea0('0x5a')],{'$or':_['map'](_0x13b848,function(_0x388bc4){if(_0x388bc4['type']!==_0xcea0('0x5c')){var _0x4f7683={};_0x4f7683[_0x388bc4[_0xcea0('0x2c')]]={'$like':'%'+_0x3469e0['query'][_0xcea0('0x59')]+'%'};return _0x4f7683;}})});}_0x336996=_[_0xcea0('0x5b')]({},_0x336996,_0x3469e0[_0xcea0('0x5d')]);var _0x2d200a={'where':_0x336996['where']};return db[_0xcea0('0x5e')][_0xcea0('0x24')](_0x2d200a)[_0xcea0('0x12')](function(_0x1442d5){_0x3c0715['count']=_0x1442d5;if(_0x3469e0['query']['includeAll']){_0x336996[_0xcea0('0x5f')]=[{'all':!![]}];}return db[_0xcea0('0x5e')][_0xcea0('0x60')](_0x336996);})[_0xcea0('0x12')](function(_0x34f66d){_0x3c0715[_0xcea0('0x61')]=_0x34f66d;return _0x3c0715;})['then'](respondWithFilteredResult(_0x2c4933,_0x336996))[_0xcea0('0x1d')](handleError(_0x2c4933,null));};exports[_0xcea0('0x62')]=function(_0x52ffd4,_0x37eae0){var _0x1186d5={'raw':![],'where':{'id':_0x52ffd4[_0xcea0('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xcea0('0x42')},{'model':db[_0xcea0('0x46')],'as':_0xcea0('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x30824f={};_0x30824f[_0xcea0('0x4d')]=_[_0xcea0('0x4f')](db[_0xcea0('0x5e')][_0xcea0('0x4a')]);_0x30824f['query']=_[_0xcea0('0x4f')](_0x52ffd4['query']);_0x30824f['filters']=_['intersection'](_0x30824f['model'],_0x30824f['query']);_0x1186d5[_0xcea0('0x53')]=_[_0xcea0('0x51')](_0x30824f[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x52ffd4[_0xcea0('0x4e')]['fields']));_0x1186d5[_0xcea0('0x53')]=_0x1186d5[_0xcea0('0x53')]['length']?_0x1186d5[_0xcea0('0x53')]:_0x30824f[_0xcea0('0x4d')];if(_0x52ffd4['query'][_0xcea0('0x64')]){_0x1186d5[_0xcea0('0x5f')]=[{'all':!![]}];}_0x1186d5=_[_0xcea0('0x5b')]({},_0x1186d5,_0x52ffd4['options']);return db[_0xcea0('0x5e')][_0xcea0('0x65')](_0x1186d5)[_0xcea0('0x12')](handleEntityNotFound(_0x37eae0,null))[_0xcea0('0x12')](respondWithResult(_0x37eae0,null))['catch'](handleError(_0x37eae0,null));};exports[_0xcea0('0x28')]=function(_0x34054d,_0x228634){if(_0x34054d['body']['id']){delete _0x34054d[_0xcea0('0x66')]['id'];}var _0xfd11fd=_0x34054d['body'][_0xcea0('0x67')]==='custom'?null:_0x34054d[_0xcea0('0x66')]['provider'];var _0x45a971=_0x34054d[_0xcea0('0x66')]['Imap']||{};var _0x13afc4=_0x34054d[_0xcea0('0x66')][_0xcea0('0x43')]||{};if(_0xfd11fd){_0x45a971['host']=getImapHost(_0xfd11fd);_0x45a971[_0xcea0('0x3c')]=0x3e1;_0x13afc4[_0xcea0('0x3d')]=getSmtpHost(_0xfd11fd);_0x13afc4['port']=0x24b;_0x13afc4[_0xcea0('0x3e')]=![];}if(_0x13afc4[_0xcea0('0x39')]){_0x13afc4[_0xcea0('0x3e')]=![];}else{_0x13afc4[_0xcea0('0x3a')]=null;}if(!_0x45a971[_0xcea0('0x39')])_0x45a971[_0xcea0('0x3a')]=null;_0x34054d['body']['Imap']=_0x45a971;_0x34054d[_0xcea0('0x66')]['Smtp']=_0x13afc4;return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x34054d[_0xcea0('0x63')]['id']},'include':[{'model':db[_0xcea0('0x45')],'as':_0xcea0('0x42')},{'model':db[_0xcea0('0x46')],'as':_0xcea0('0x43')},{'model':db[_0xcea0('0x47')],'as':_0xcea0('0x48')}]})[_0xcea0('0x12')](handleEntityNotFound(_0x228634,null))['then'](function(_0x181650){if(!_0x181650)throw new Error(_0xcea0('0x68'));if(_0x181650[_0xcea0('0x3f')])delete _0x34054d['body']['Imap'];return _0x181650;})[_0xcea0('0x12')](saveUpdates(_0x34054d['body'],null))[_0xcea0('0x12')](function(_0x5db4ea){if(!_0x34054d['body']['Imap'])return _0x5db4ea;return db[_0xcea0('0x45')][_0xcea0('0x28')](_0x34054d[_0xcea0('0x66')][_0xcea0('0x42')],{'where':{'MailAccountId':_0x5db4ea['id']}})['then'](function(){return _0x5db4ea;});})[_0xcea0('0x12')](function(_0x437984){if(!_0x34054d[_0xcea0('0x66')][_0xcea0('0x43')])return _0x437984;return db['MailServerOut']['update'](_0x34054d[_0xcea0('0x66')]['Smtp'],{'where':{'MailAccountId':_0x437984['id']}})[_0xcea0('0x12')](function(){return _0x437984;});})[_0xcea0('0x12')](respondWithResult(_0x228634,null))[_0xcea0('0x1d')](handleError(_0x228634,null));};exports[_0xcea0('0x69')]=function(_0x41f247,_0x215f0c){return db[_0xcea0('0x5e')]['describe']()[_0xcea0('0x12')](respondWithResult(_0x215f0c,null))[_0xcea0('0x1d')](handleError(_0x215f0c,null));};exports[_0xcea0('0x6a')]=function(_0x456ed5,_0x29f129){if(_0x456ed5[_0xcea0('0x66')]['id']){delete _0x456ed5['body']['id'];}return db[_0xcea0('0x5e')]['find']({'where':{'id':_0x456ed5['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x29f129,null))[_0xcea0('0x12')](function(_0x53aa52){if(_0x53aa52){_0x456ed5[_0xcea0('0x66')][_0xcea0('0x6b')]=_0x53aa52['id'];return db[_0xcea0('0x6c')][_0xcea0('0x6d')](_0x456ed5[_0xcea0('0x66')]);}})[_0xcea0('0x12')](respondWithResult(_0x29f129,null))[_0xcea0('0x1d')](handleError(_0x29f129,null));};exports[_0xcea0('0x6e')]=function(_0x2fb777,_0x19d3fa){var _0x589d13={'raw':![],'where':{}};var _0x5f2961={};var _0x25fc43={'count':0x0,'rows':[]};return db['MailAccount'][_0xcea0('0x6f')]({'where':{'id':_0x2fb777['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x19d3fa,null))[_0xcea0('0x12')](function(_0x50b8c5){if(_0x50b8c5){_0x5f2961[_0xcea0('0x4d')]=_[_0xcea0('0x4f')](db[_0xcea0('0x6c')]['rawAttributes']);_0x5f2961[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x2fb777[_0xcea0('0x4e')]);_0x5f2961['filters']=_[_0xcea0('0x51')](_0x5f2961[_0xcea0('0x4d')],_0x5f2961[_0xcea0('0x4e')]);_0x589d13[_0xcea0('0x53')]=_[_0xcea0('0x51')](_0x5f2961[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x2fb777['query'][_0xcea0('0x52')]));_0x589d13[_0xcea0('0x53')]=_0x589d13[_0xcea0('0x53')]['length']?_0x589d13[_0xcea0('0x53')]:_0x5f2961['model'];if(!_0x2fb777[_0xcea0('0x4e')][_0xcea0('0x55')]('nolimit')){_0x589d13[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x2fb777[_0xcea0('0x4e')][_0xcea0('0x23')]);_0x589d13['offset']=qs[_0xcea0('0x25')](_0x2fb777['query'][_0xcea0('0x25')]);}_0x589d13[_0xcea0('0x57')]=qs[_0xcea0('0x70')](_0x2fb777[_0xcea0('0x4e')][_0xcea0('0x70')]);_0x589d13['where']=qs[_0xcea0('0x50')](_[_0xcea0('0x58')](_0x2fb777[_0xcea0('0x4e')],_0x5f2961[_0xcea0('0x50')]));_0x589d13[_0xcea0('0x5a')][_0xcea0('0x6b')]=_0x50b8c5['id'];if(_0x2fb777['query'][_0xcea0('0x59')]){_0x589d13[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0x589d13[_0xcea0('0x5a')],{'$or':_[_0xcea0('0x49')](_0x589d13[_0xcea0('0x53')],function(_0x3aaddc){var _0x1012f0={};_0x1012f0[_0x3aaddc]={'$like':'%'+_0x2fb777['query'][_0xcea0('0x59')]+'%'};return _0x1012f0;})});}_0x589d13=_['merge']({},_0x589d13,_0x2fb777['options']);return db['Disposition'][_0xcea0('0x24')]({'where':_0x589d13[_0xcea0('0x5a')]})[_0xcea0('0x12')](function(_0x3b2452){_0x25fc43[_0xcea0('0x24')]=_0x3b2452;if(_0x2fb777['query'][_0xcea0('0x64')]){_0x589d13[_0xcea0('0x5f')]=[{'all':!![]}];}return db[_0xcea0('0x6c')][_0xcea0('0x60')](_0x589d13);})[_0xcea0('0x12')](function(_0x3ad89e){_0x25fc43['rows']=_0x3ad89e;return _0x25fc43;});}})[_0xcea0('0x12')](respondWithFilteredResult(_0x19d3fa,_0x589d13))[_0xcea0('0x1d')](handleError(_0x19d3fa,null));};exports[_0xcea0('0x71')]=function(_0x57f6ef,_0x51593e){return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x57f6ef[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x51593e,null))[_0xcea0('0x12')](function(_0x4e437e){if(_0x4e437e){return _0x4e437e[_0xcea0('0x71')](_0x57f6ef[_0xcea0('0x4e')][_0xcea0('0x72')]);}})[_0xcea0('0x12')](respondWithStatusCode(_0x51593e,null))[_0xcea0('0x1d')](handleError(_0x51593e,null));};exports['addAnswer']=function(_0x4ec78c,_0x342a75){if(_0x4ec78c[_0xcea0('0x66')]['id']){delete _0x4ec78c['body']['id'];}return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x4ec78c[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x342a75,null))[_0xcea0('0x12')](function(_0x484568){if(_0x484568){_0x4ec78c[_0xcea0('0x66')]['MailAccountId']=_0x484568['id'];return db[_0xcea0('0x73')][_0xcea0('0x6d')](_0x4ec78c[_0xcea0('0x66')]);}})['then'](respondWithResult(_0x342a75,null))[_0xcea0('0x1d')](handleError(_0x342a75,null));};exports[_0xcea0('0x74')]=function(_0x47bcb6,_0x14bc4e){var _0x49b994={'raw':![],'where':{}};var _0x22f3a1={};var _0x5eea8b={'count':0x0,'rows':[]};return db[_0xcea0('0x5e')][_0xcea0('0x6f')]({'where':{'id':_0x47bcb6['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x14bc4e,null))[_0xcea0('0x12')](function(_0x4f3185){if(_0x4f3185){_0x22f3a1[_0xcea0('0x4d')]=_[_0xcea0('0x4f')](db[_0xcea0('0x73')]['rawAttributes']);_0x22f3a1[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x47bcb6[_0xcea0('0x4e')]);_0x22f3a1[_0xcea0('0x50')]=_['intersection'](_0x22f3a1[_0xcea0('0x4d')],_0x22f3a1['query']);_0x49b994['attributes']=_[_0xcea0('0x51')](_0x22f3a1[_0xcea0('0x4d')],qs['fields'](_0x47bcb6[_0xcea0('0x4e')][_0xcea0('0x52')]));_0x49b994[_0xcea0('0x53')]=_0x49b994[_0xcea0('0x53')][_0xcea0('0x54')]?_0x49b994[_0xcea0('0x53')]:_0x22f3a1['model'];if(!_0x47bcb6[_0xcea0('0x4e')][_0xcea0('0x55')](_0xcea0('0x56'))){_0x49b994[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x47bcb6['query'][_0xcea0('0x23')]);_0x49b994[_0xcea0('0x25')]=qs[_0xcea0('0x25')](_0x47bcb6[_0xcea0('0x4e')][_0xcea0('0x25')]);}_0x49b994[_0xcea0('0x57')]=qs['sort'](_0x47bcb6[_0xcea0('0x4e')][_0xcea0('0x70')]);_0x49b994[_0xcea0('0x5a')]=qs[_0xcea0('0x50')](_['pick'](_0x47bcb6['query'],_0x22f3a1['filters']));_0x49b994[_0xcea0('0x5a')][_0xcea0('0x6b')]=_0x4f3185['id'];if(_0x47bcb6[_0xcea0('0x4e')]['filter']){_0x49b994[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0x49b994['where'],{'$or':_['map'](_0x49b994['attributes'],function(_0x12407c){var _0x177b33={};_0x177b33[_0x12407c]={'$like':'%'+_0x47bcb6['query'][_0xcea0('0x59')]+'%'};return _0x177b33;})});}_0x49b994=_[_0xcea0('0x5b')]({},_0x49b994,_0x47bcb6['options']);return db[_0xcea0('0x73')][_0xcea0('0x24')]({'where':_0x49b994[_0xcea0('0x5a')]})[_0xcea0('0x12')](function(_0x3ce4df){_0x5eea8b['count']=_0x3ce4df;if(_0x47bcb6['query']['includeAll']){_0x49b994[_0xcea0('0x5f')]=[{'all':!![]}];}return db[_0xcea0('0x73')]['findAll'](_0x49b994);})[_0xcea0('0x12')](function(_0x4ca658){_0x5eea8b[_0xcea0('0x61')]=_0x4ca658;return _0x5eea8b;});}})[_0xcea0('0x12')](respondWithFilteredResult(_0x14bc4e,_0x49b994))[_0xcea0('0x1d')](handleError(_0x14bc4e,null));};exports[_0xcea0('0x75')]=function(_0xde4fa3,_0x5e5a76){return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0xde4fa3['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x5e5a76,null))[_0xcea0('0x12')](function(_0x189db4){if(_0x189db4){return _0x189db4[_0xcea0('0x75')](_0xde4fa3[_0xcea0('0x4e')][_0xcea0('0x72')]);}})['then'](respondWithStatusCode(_0x5e5a76,null))[_0xcea0('0x1d')](handleError(_0x5e5a76,null));};exports[_0xcea0('0x6d')]=function(_0x15cd35,_0x4c80fa){var _0x4077b2={'name':_0x15cd35['body'][_0xcea0('0x2c')],'key':_0x15cd35['body'][_0xcea0('0x76')],'provider':_0x15cd35[_0xcea0('0x66')][_0xcea0('0x67')]==='custom'?null:_0x15cd35[_0xcea0('0x66')][_0xcea0('0x67')],'email':_0x15cd35['body'][_0xcea0('0x77')],'ListId':_0x15cd35[_0xcea0('0x66')][_0xcea0('0x78')],'active':!_[_0xcea0('0x79')](_0x15cd35[_0xcea0('0x66')][_0xcea0('0x7a')])?_0x15cd35[_0xcea0('0x66')][_0xcea0('0x7a')]:!![],'description':_0x15cd35['body'][_0xcea0('0x7b')]||null};var _0x320c48=getAuthenticationOptions(_0x4077b2[_0xcea0('0x67')],_0x15cd35[_0xcea0('0x66')]);_0x4077b2['Imap']=_0x320c48[_0xcea0('0x42')];_0x4077b2[_0xcea0('0x43')]=_0x320c48[_0xcea0('0x43')];return db['MailAccount'][_0xcea0('0x6d')](_0x4077b2,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xcea0('0x42')}]})[_0xcea0('0x12')](function(_0x1d4092){var _0x3e0e0c=_0x15cd35[_0xcea0('0x37')][_0xcea0('0x2a')]({'plain':!![]});if(!_0x3e0e0c)throw new Error(_0xcea0('0x7c'));if(_0x3e0e0c['role']===_0xcea0('0x37')){var _0x3caeb2=_0x1d4092[_0xcea0('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0xcea0('0x65')]({'where':{'name':_0xcea0('0x2b'),'userProfileId':_0x3e0e0c['userProfileId']},'raw':!![]})['then'](function(_0x1e999d){if(_0x1e999d&&_0x1e999d[_0xcea0('0x7d')]===0x0){return db[_0xcea0('0x7e')][_0xcea0('0x6d')]({'name':_0x3caeb2[_0xcea0('0x2c')],'resourceId':_0x3caeb2['id'],'type':_0x1e999d[_0xcea0('0x2c')],'sectionId':_0x1e999d['id']},{})[_0xcea0('0x12')](function(){return _0x1d4092;});}else{return _0x1d4092;}})[_0xcea0('0x1d')](function(_0x42584b){logger['error'](_0xcea0('0x7f'),_0x42584b);throw _0x42584b;});}return _0x1d4092;})[_0xcea0('0x12')](respondWithResult(_0x4c80fa,0xc9))[_0xcea0('0x1d')](handleError(_0x4c80fa,null));};exports[_0xcea0('0x80')]=function(_0x3752af,_0x12c6b4){return db[_0xcea0('0x5e')][_0xcea0('0x6f')]({'where':{'id':_0x3752af[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x12c6b4,null))[_0xcea0('0x12')](function(_0x979cd3){if(_0x979cd3){return _0x979cd3['getImap']();}return null;})['then'](respondWithResult(_0x12c6b4,null))[_0xcea0('0x1d')](handleError(_0x12c6b4,null));};exports[_0xcea0('0x81')]=function(_0x19241b,_0x377ecf){if(_0x19241b[_0xcea0('0x66')]['id']){delete _0x19241b[_0xcea0('0x66')]['id'];}return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x19241b[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x377ecf,null))['then'](function(_0x30cdae){if(_0x30cdae){_0x19241b['body'][_0xcea0('0x6b')]=_0x30cdae['id'];return db[_0xcea0('0x45')][_0xcea0('0x6d')](_0x19241b[_0xcea0('0x66')]);}})[_0xcea0('0x12')](respondWithResult(_0x377ecf,null))[_0xcea0('0x1d')](handleError(_0x377ecf,null));};exports[_0xcea0('0x82')]=function(_0x254ab6,_0x3f3384){return db[_0xcea0('0x5e')]['findOne']({'where':{'id':_0x254ab6[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x3f3384,null))['then'](function(_0xc31921){if(_0xc31921){return _0xc31921['setImap'](null);}return null;})[_0xcea0('0x12')](respondWithStatusCode(_0x3f3384,null))[_0xcea0('0x1d')](handleError(_0x3f3384,null));};exports[_0xcea0('0x83')]=function(_0x32db52,_0x267bc7){return db['MailAccount']['findOne']({'where':{'id':_0x32db52[_0xcea0('0x63')]['id']}})['then'](handleEntityNotFound(_0x267bc7,null))[_0xcea0('0x12')](function(_0x4a1553){if(_0x4a1553){return _0x4a1553[_0xcea0('0x83')]();}return null;})[_0xcea0('0x12')](respondWithResult(_0x267bc7,null))[_0xcea0('0x1d')](handleError(_0x267bc7,null));};exports[_0xcea0('0x84')]=function(_0x582409,_0x5553c7){if(_0x582409[_0xcea0('0x66')]['id']){delete _0x582409[_0xcea0('0x66')]['id'];}return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x582409['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x5553c7,null))['then'](function(_0x28ea3f){if(_0x28ea3f){_0x582409[_0xcea0('0x66')]['MailAccountId']=_0x28ea3f['id'];return db[_0xcea0('0x46')][_0xcea0('0x6d')](_0x582409[_0xcea0('0x66')]);}})[_0xcea0('0x12')](respondWithResult(_0x5553c7,null))[_0xcea0('0x1d')](handleError(_0x5553c7,null));};exports[_0xcea0('0x85')]=function(_0x33bf8d,_0x24d938){return db[_0xcea0('0x5e')]['findOne']({'where':{'id':_0x33bf8d[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x24d938,null))['then'](function(_0x85c379){if(_0x85c379){return _0x85c379[_0xcea0('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x24d938,null))[_0xcea0('0x1d')](handleError(_0x24d938,null));};exports[_0xcea0('0x87')]=function(_0x27516f,_0x189aca){return db[_0xcea0('0x88')]['find']({'where':{'id':_0x27516f[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x189aca,null))[_0xcea0('0x12')](function(_0x278ea8){if(_0x278ea8){return _0x278ea8['addInteraction'](_0x27516f['body'][_0xcea0('0x72')],_[_0xcea0('0x89')](_0x27516f['body'],[_0xcea0('0x72'),'id'])||{});}})[_0xcea0('0x12')](respondWithResult(_0x189aca,null))[_0xcea0('0x1d')](handleError(_0x189aca,null));};exports[_0xcea0('0x8a')]=function(_0x4b2a90,_0x520082){var _0x13f666={'raw':![],'where':{}};var _0x5ceabf={};var _0x260f49={'count':0x0,'rows':[]};return db[_0xcea0('0x5e')][_0xcea0('0x6f')]({'where':{'id':_0x4b2a90[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x520082,null))[_0xcea0('0x12')](function(_0x27f6b9){if(_0x27f6b9){_0x5ceabf['model']=_['keys'](db[_0xcea0('0x88')]['rawAttributes']);_0x5ceabf[_0xcea0('0x4e')]=_['keys'](_0x4b2a90[_0xcea0('0x4e')]);_0x5ceabf[_0xcea0('0x50')]=_[_0xcea0('0x51')](_0x5ceabf[_0xcea0('0x4d')],_0x5ceabf[_0xcea0('0x4e')]);_0x13f666[_0xcea0('0x53')]=_['intersection'](_0x5ceabf[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x4b2a90[_0xcea0('0x4e')][_0xcea0('0x52')]));_0x13f666[_0xcea0('0x53')]=_0x13f666[_0xcea0('0x53')][_0xcea0('0x54')]?_0x13f666['attributes']:_0x5ceabf[_0xcea0('0x4d')];if(!_0x4b2a90['query']['hasOwnProperty'](_0xcea0('0x56'))){_0x13f666[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x4b2a90[_0xcea0('0x4e')][_0xcea0('0x23')]);_0x13f666[_0xcea0('0x25')]=qs[_0xcea0('0x25')](_0x4b2a90[_0xcea0('0x4e')]['offset']);}_0x13f666[_0xcea0('0x57')]=qs[_0xcea0('0x70')](_0x4b2a90['query'][_0xcea0('0x70')]);_0x13f666[_0xcea0('0x5a')]=qs[_0xcea0('0x50')](_[_0xcea0('0x58')](_0x4b2a90['query'],_0x5ceabf[_0xcea0('0x50')]));_0x13f666[_0xcea0('0x5a')][_0xcea0('0x6b')]=_0x27f6b9['id'];if(_0x4b2a90[_0xcea0('0x4e')][_0xcea0('0x59')]){_0x13f666[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0x13f666[_0xcea0('0x5a')],{'$or':_[_0xcea0('0x49')](_0x13f666[_0xcea0('0x53')],function(_0x2dc174){var _0x5c4c95={};_0x5c4c95[_0x2dc174]={'$like':'%'+_0x4b2a90['query']['filter']+'%'};return _0x5c4c95;})});}_0x13f666=_['merge']({},_0x13f666,_0x4b2a90['options']);return db['MailInteraction'][_0xcea0('0x24')]({'where':_0x13f666[_0xcea0('0x5a')]})[_0xcea0('0x12')](function(_0x1c558b){_0x260f49[_0xcea0('0x24')]=_0x1c558b;if(_0x4b2a90[_0xcea0('0x4e')][_0xcea0('0x64')]){_0x13f666[_0xcea0('0x5f')]=[{'model':db[_0xcea0('0x8b')],'as':'Contact','required':![]},{'model':db[_0xcea0('0x8c')],'as':_0xcea0('0x8d'),'attributes':[_0xcea0('0x2c'),_0xcea0('0x8e'),'internal'],'required':![]},{'model':db[_0xcea0('0x8f')],'as':_0xcea0('0x90'),'attributes':['id',_0xcea0('0x2c'),_0xcea0('0x91')],'where':_0x4b2a90[_0xcea0('0x4e')]['tag']?{'id':_0x4b2a90[_0xcea0('0x4e')]['tag']}:undefined,'required':_0x4b2a90[_0xcea0('0x4e')][_0xcea0('0x92')]?!![]:![]}];}return db[_0xcea0('0x88')][_0xcea0('0x60')](_0x13f666);})[_0xcea0('0x12')](function(_0x218b13){_0x260f49[_0xcea0('0x61')]=_0x218b13;return _0x260f49;});}})[_0xcea0('0x12')](respondWithFilteredResult(_0x520082,_0x13f666))[_0xcea0('0x1d')](handleError(_0x520082,null));};exports[_0xcea0('0x93')]=function addApplications(_0x5c96b6,_0x516027){var _0xea727a=_0x5c96b6['params']['id'];var _0x56440c=_0x5c96b6[_0xcea0('0x66')];var _0x304754=0xc8;var _0x373aac=null;return db[_0xcea0('0x94')][_0xcea0('0x95')]({'isolationLevel':db['sequelize']['Transaction'][_0xcea0('0x96')][_0xcea0('0x97')]},function(_0x57158b){return db[_0xcea0('0x5e')][_0xcea0('0x6f')]({'where':{'id':_0xea727a},'transaction':_0x57158b})[_0xcea0('0x12')](function(_0x396a07){if(_0x396a07){return db[_0xcea0('0x98')]['destroy']({'where':{'MailAccountId':_0xea727a},'transaction':_0x57158b})[_0xcea0('0x12')](function(){var _0x16f990=_[_0xcea0('0x49')](_0x56440c,function(_0x381b27){_0x381b27[_0xcea0('0x6b')]=_0xea727a;return _0x381b27;});return db[_0xcea0('0x98')][_0xcea0('0x99')](_0x16f990,{'transaction':_0x57158b});});}else{_0x304754=0x194;_0x373aac=[];}});})[_0xcea0('0x12')](function(){if(_0x304754!==0x194){return db['MailApplication'][_0xcea0('0x9a')]({'where':{'MailAccountId':_0xea727a},'order':_0xcea0('0x9b')})[_0xcea0('0x12')](function(_0x29e70c){_0x373aac=_0x29e70c;});}})[_0xcea0('0x1d')](function(_0x2f0496){_0x304754=0x1f4;logger[_0xcea0('0x19')](_0x2f0496[_0xcea0('0x9c')]);if(_0x2f0496[_0xcea0('0x2c')]){delete _0x2f0496[_0xcea0('0x2c')];}_0x373aac=_0x2f0496;})[_0xcea0('0x9d')](function(){if(_0x373aac===null){_0x516027[_0xcea0('0x1e')](_0x304754);}else{if(_0x304754===0x1f4){_0x516027[_0xcea0('0x1f')](_0x304754)['send'](_0x373aac);}else{_0x516027[_0xcea0('0x1f')](_0x304754)['json'](_0x373aac);}}});};exports[_0xcea0('0x9e')]=function(_0x4c51fa,_0x4c8d6a){var _0x46189f={};var _0x5eeaba={};var _0x45c9f9;var _0x3fa7df;return db['MailAccount'][_0xcea0('0x6f')]({'where':{'id':_0x4c51fa['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x4c8d6a,null))[_0xcea0('0x12')](function(_0x168cb8){if(_0x168cb8){_0x45c9f9=_0x168cb8;_0x5eeaba[_0xcea0('0x4d')]=_[_0xcea0('0x4f')](db[_0xcea0('0x98')][_0xcea0('0x4a')]);_0x5eeaba[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x4c51fa[_0xcea0('0x4e')]);_0x5eeaba['filters']=_[_0xcea0('0x51')](_0x5eeaba[_0xcea0('0x4d')],_0x5eeaba[_0xcea0('0x4e')]);_0x46189f[_0xcea0('0x53')]=_['intersection'](_0x5eeaba[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x4c51fa[_0xcea0('0x4e')][_0xcea0('0x52')]));_0x46189f[_0xcea0('0x53')]=_0x46189f[_0xcea0('0x53')][_0xcea0('0x54')]?_0x46189f[_0xcea0('0x53')]:_0x5eeaba[_0xcea0('0x4d')];_0x46189f[_0xcea0('0x57')]=qs['sort'](_0x4c51fa['query'][_0xcea0('0x70')]);_0x46189f[_0xcea0('0x5a')]=qs['filters'](_['pick'](_0x4c51fa[_0xcea0('0x4e')],_0x5eeaba[_0xcea0('0x50')]));if(_0x4c51fa[_0xcea0('0x4e')]['filter']){_0x46189f[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0x46189f[_0xcea0('0x5a')],{'$or':_['map'](_0x46189f[_0xcea0('0x53')],function(_0x25e343){var _0x325a60={};_0x325a60[_0x25e343]={'$like':'%'+_0x4c51fa['query'][_0xcea0('0x59')]+'%'};return _0x325a60;})});}_0x46189f=_[_0xcea0('0x5b')]({},_0x46189f,_0x4c51fa[_0xcea0('0x5d')]);return _0x45c9f9[_0xcea0('0x9e')](_0x46189f);}})[_0xcea0('0x12')](function(_0x3ced53){if(_0x3ced53){_0x3fa7df=_0x3ced53[_0xcea0('0x54')];if(!_0x4c51fa[_0xcea0('0x4e')][_0xcea0('0x55')](_0xcea0('0x56'))){_0x46189f[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x4c51fa[_0xcea0('0x4e')]['limit']);_0x46189f[_0xcea0('0x25')]=qs[_0xcea0('0x25')](_0x4c51fa[_0xcea0('0x4e')][_0xcea0('0x25')]);}return _0x45c9f9['getApplications'](_0x46189f);}})[_0xcea0('0x12')](function(_0x45f436){if(_0x45f436){return _0x45f436?{'count':_0x3fa7df,'rows':_0x45f436}:null;}})[_0xcea0('0x12')](respondWithResult(_0x4c8d6a,null))[_0xcea0('0x1d')](handleError(_0x4c8d6a,null));};exports['getMessages']=function(_0x5ee8d5,_0x32f454){var _0xfffff1={'raw':!![],'where':{}};var _0x44f625={};var _0x55393b={'count':0x0,'rows':[]};return db[_0xcea0('0x5e')]['findOne']({'where':{'id':_0x5ee8d5[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x32f454,null))[_0xcea0('0x12')](function(_0x1e9548){if(_0x1e9548){_0x44f625[_0xcea0('0x4d')]=_[_0xcea0('0x4f')](db[_0xcea0('0x9f')][_0xcea0('0x4a')]);_0x44f625[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x5ee8d5['query']);_0x44f625[_0xcea0('0x50')]=_['intersection'](_0x44f625[_0xcea0('0x4d')],_0x44f625[_0xcea0('0x4e')]);_0xfffff1[_0xcea0('0x53')]=_[_0xcea0('0x51')](_0x44f625['model'],qs['fields'](_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x52')]));_0xfffff1['attributes']=_0xfffff1[_0xcea0('0x53')][_0xcea0('0x54')]?_0xfffff1[_0xcea0('0x53')]:_0x44f625[_0xcea0('0x4d')];if(!_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x55')]('nolimit')){_0xfffff1[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x23')]);_0xfffff1[_0xcea0('0x25')]=qs[_0xcea0('0x25')](_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x25')]);}_0xfffff1[_0xcea0('0x57')]=qs[_0xcea0('0x70')](_0x5ee8d5[_0xcea0('0x4e')]['sort']);_0xfffff1[_0xcea0('0x5a')]=qs[_0xcea0('0x50')](_['pick'](_0x5ee8d5[_0xcea0('0x4e')],_0x44f625[_0xcea0('0x50')]));_0xfffff1[_0xcea0('0x5a')][_0xcea0('0x6b')]=_0x1e9548['id'];if(_0x5ee8d5['query']['filter']){_0xfffff1['where']=_[_0xcea0('0x5b')](_0xfffff1[_0xcea0('0x5a')],{'$or':_[_0xcea0('0x49')](_0xfffff1['attributes'],function(_0x1fa633){var _0x477ea3={};_0x477ea3[_0x1fa633]={'$like':'%'+_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x59')]+'%'};return _0x477ea3;})});}if(_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0xa0')]){var _0x23a612=_0x5ee8d5['query'][_0xcea0('0xa0')][_0xcea0('0xa1')](',');var _0x4f3b6e={};_0x4f3b6e[_0x23a612[0x0]]={'$gte':moment(_0x23a612[0x1])[_0xcea0('0xa2')](_0xcea0('0xa3'))};_0xfffff1[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0xfffff1[_0xcea0('0x5a')],_0x4f3b6e);}_0xfffff1=_[_0xcea0('0x5b')]({},_0xfffff1,_0x5ee8d5[_0xcea0('0x5d')]);return db[_0xcea0('0x9f')][_0xcea0('0x24')]({'where':_0xfffff1[_0xcea0('0x5a')]})['then'](function(_0x5735f1){_0x55393b[_0xcea0('0x24')]=_0x5735f1;if(_0x5ee8d5[_0xcea0('0x4e')][_0xcea0('0x64')]){_0xfffff1[_0xcea0('0x5f')]=[{'all':!![]}];}return db[_0xcea0('0x9f')][_0xcea0('0x60')](_0xfffff1);})[_0xcea0('0x12')](function(_0x548fe1){if(_0x5ee8d5['query'][_0xcea0('0xa4')]===_0xcea0('0xa5')){for(var _0x5ba49b=0x0;_0x5ba49b<_0x548fe1[_0xcea0('0x54')];_0x5ba49b++){_0x548fe1[_0x5ba49b][_0xcea0('0x66')]=juice(_0x548fe1[_0x5ba49b][_0xcea0('0x66')]);}}_0x55393b[_0xcea0('0x61')]=_0x548fe1;return _0x55393b;});}})[_0xcea0('0x12')](respondWithFilteredResult(_0x32f454,_0xfffff1))[_0xcea0('0x1d')](handleError(_0x32f454,null));};exports[_0xcea0('0x2d')]=function(_0x363075,_0xe54e2d){var _0x5654fa,_0x4f021d={},_0xf44da7;if(_0x363075[_0xcea0('0x66')]['to']){_0xf44da7=_0x363075[_0xcea0('0x66')]['to'][_0xcea0('0xa1')](',')[0x0];}return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x363075[_0xcea0('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0xcea0('0xa6'),'include':[{'model':db[_0xcea0('0x8b')],'as':'Contacts','where':{'email':_0xf44da7},'limit':0x1,'order':[[_0xcea0('0xa7'),'DESC']]}]},{'model':db[_0xcea0('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xcea0('0xa8')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0xe54e2d,null))[_0xcea0('0x12')](function(_0x2c76e0){if(!_0x2c76e0)return;_0x5654fa=_0x2c76e0;if(!_0x2c76e0[_0xcea0('0x43')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xcea0('0x79')](_0x363075['body'][_0xcea0('0xa9')])){_0x363075[_0xcea0('0x66')]['from']=util[_0xcea0('0xa2')](_0xcea0('0xaa'),_0x2c76e0[_0xcea0('0x2c')],_0x2c76e0[_0xcea0('0x77')]||_0x2c76e0[_0xcea0('0x43')][_0xcea0('0x37')]);}if(_0x363075[_0xcea0('0x66')][_0xcea0('0xab')]&&_0x363075[_0xcea0('0x66')][_0xcea0('0xab')][_0xcea0('0x54')]){for(var _0x5cecfe=0x0;_0x5cecfe<_0x363075[_0xcea0('0x66')]['attachments'][_0xcea0('0x54')];_0x5cecfe+=0x1){_0x363075[_0xcea0('0x66')][_0xcea0('0xab')][_0x5cecfe]={'filename':_0x363075[_0xcea0('0x66')][_0xcea0('0xab')][_0x5cecfe][_0xcea0('0x2c')],'path':path['join'](config[_0xcea0('0xac')],_0xcea0('0xad'),_0x363075[_0xcea0('0x66')][_0xcea0('0xab')][_0x5cecfe][_0xcea0('0xae')])};}}var _0x21753e=_0x2c76e0[_0xcea0('0xaf')]();return respondWithRpcPromise(_0xcea0('0xb0'),'sendMail',{'account':_0x21753e,'message':_0x363075['body']});})[_0xcea0('0x12')](function(_0x23c875){if(!_0x23c875)return;_0x4f021d=_0x23c875;if(!_0x5654fa[_0xcea0('0xa6')])throw new Error(_0xcea0('0xb1'));if(_0x5654fa['List'][_0xcea0('0xb2')][_0xcea0('0x54')])return _0x5654fa[_0xcea0('0xa6')][_0xcea0('0xb2')][0x0];return db[_0xcea0('0x8b')]['create'](_[_0xcea0('0xb3')](_0x363075['body'],{'firstName':_0x363075['body']['to'],'email':_0x363075[_0xcea0('0x66')]['to'],'phone':_0x363075[_0xcea0('0x66')]['to'],'ListId':_0x5654fa[_0xcea0('0x78')]}));})[_0xcea0('0x12')](function(_0x3b1f06){if(!_0x3b1f06)return;var _0x1a6fae={'UserId':_0x363075[_0xcea0('0x37')]['id'],'ContactId':_0x3b1f06['id'],'MailAccountId':_0x5654fa['id'],'inReplyTo':_0x4f021d['messageId'],'to':_0x363075['body'][_0xcea0('0xa9')],'cc':_0x363075[_0xcea0('0x66')]['cc'],'subject':_0x363075[_0xcea0('0x66')]['subject'],'attach':_0x363075['body'][_0xcea0('0xb4')],'firstMsgDirection':_0xcea0('0xb5'),'lastMsgAt':moment()[_0xcea0('0xa2')](_0xcea0('0xa3')),'lastMsgDirection':_0xcea0('0xb5'),'Messages':[_[_0xcea0('0x5b')](_0x363075['body'],{'messageId':_0x4f021d['messageId'],'sentAt':moment()[_0xcea0('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5654fa['id'],'UserId':_0x363075['user']['id'],'ContactId':_0x3b1f06['id']})]};if(_0x363075['body'][_0xcea0('0xb6')]){_0x1a6fae=_[_0xcea0('0x5b')](_0x1a6fae,_0x363075[_0xcea0('0x66')][_0xcea0('0xb6')]);}return db['MailInteraction'][_0xcea0('0x6d')](_0x1a6fae,{'include':[{'model':db[_0xcea0('0x9f')],'as':_0xcea0('0xb7')}]});})[_0xcea0('0x12')](respondWithResult(_0xe54e2d,null))[_0xcea0('0x1d')](handleError(_0xe54e2d,null));};exports[_0xcea0('0xb8')]=function(_0x3a5ee6,_0x57ca8a){return db[_0xcea0('0x5e')]['find']({'where':{'id':_0x3a5ee6['params']['id']},'include':[{'model':db[_0xcea0('0x46')],'as':_0xcea0('0x43'),'raw':!![],'include':[{'model':db[_0xcea0('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0xcea0('0x12')](handleEntityNotFound(_0x57ca8a,null))['then'](function(_0x24ade7){if(!_0x24ade7[_0xcea0('0x43')])return;var _0x5bf390=_0x24ade7['getSmtpOptions']();return respondWithRpcPromise(_0xcea0('0xb9'),'verifySmtp',{'account':_0x5bf390});})[_0xcea0('0x12')](respondWithResult(_0x57ca8a,null))['catch'](handleError(_0x57ca8a,null));};exports['destroy']=function(_0x5be42c,_0x95ee38){return db[_0xcea0('0x5e')][_0xcea0('0x65')]({'where':{'id':_0x5be42c['params']['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x95ee38,null))[_0xcea0('0x12')](function(_0x541ed3){if(_0x541ed3&&_0x541ed3[_0xcea0('0x3f')]){throw new db[(_0xcea0('0xba'))][(_0xcea0('0xbb'))](_0xcea0('0xbc'));}return _0x541ed3;})[_0xcea0('0x12')](removeEntity(_0x95ee38,null))['catch'](handleError(_0x95ee38,null));};exports[_0xcea0('0xbd')]=function(_0x3c932f,_0x50d74d){return db['MailAccount'][_0xcea0('0x65')]({'where':{'id':_0x3c932f[_0xcea0('0x63')]['id']}})['then'](handleEntityNotFound(_0x50d74d,null))['then'](function(_0x2a7cff){if(_0x2a7cff){return _0x2a7cff[_0xcea0('0xbd')](_0x3c932f[_0xcea0('0x66')][_0xcea0('0x72')],_[_0xcea0('0x89')](_0x3c932f[_0xcea0('0x66')],[_0xcea0('0x72'),'id'])||{})['spread'](function(_0x56b4be){for(var _0x1356f5=0x0;_0x1356f5<_0x3c932f[_0xcea0('0x66')][_0xcea0('0x72')][_0xcea0('0x54')];_0x1356f5+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x3c932f[_0xcea0('0x66')][_0xcea0('0x72')][_0x1356f5]),'MailAccountId':Number(_0x3c932f[_0xcea0('0x63')]['id'])});}return _0x56b4be;});}})['then'](respondWithResult(_0x50d74d,null))['catch'](handleError(_0x50d74d,null));};exports[_0xcea0('0xbe')]=function(_0x5332c8,_0x2683ac){return db['MailAccount'][_0xcea0('0x65')]({'where':{'id':_0x5332c8[_0xcea0('0x63')]['id']}})[_0xcea0('0x12')](handleEntityNotFound(_0x2683ac,null))[_0xcea0('0x12')](function(_0x26a4ab){if(_0x26a4ab){return _0x26a4ab[_0xcea0('0xbe')](_0x5332c8['query'][_0xcea0('0x72')])[_0xcea0('0x12')](function(){if(_['isArray'](_0x5332c8['query'][_0xcea0('0x72')])){for(var _0x5c6618=0x0;_0x5c6618<_0x5332c8[_0xcea0('0x4e')][_0xcea0('0x72')]['length'];_0x5c6618+=0x1){socket[_0xcea0('0xbf')](_0xcea0('0xc0'),{'UserId':Number(_0x5332c8[_0xcea0('0x4e')][_0xcea0('0x72')][_0x5c6618]),'MailAccountId':Number(_0x5332c8[_0xcea0('0x63')]['id'])});}}else{socket['emit'](_0xcea0('0xc0'),{'UserId':Number(_0x5332c8[_0xcea0('0x4e')][_0xcea0('0x72')]),'MailAccountId':Number(_0x5332c8[_0xcea0('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x2683ac,null))[_0xcea0('0x1d')](handleError(_0x2683ac,null));};exports[_0xcea0('0xc1')]=function(_0x3b3a54,_0x402557){var _0xe4168a={};var _0x239412={};var _0x508b86;var _0x4160ae;return db[_0xcea0('0x5e')][_0xcea0('0x6f')]({'where':{'id':_0x3b3a54[_0xcea0('0x63')]['id']}})['then'](handleEntityNotFound(_0x402557,null))[_0xcea0('0x12')](function(_0x9dd891){if(_0x9dd891){_0x508b86=_0x9dd891;_0x239412['model']=_[_0xcea0('0x4f')](db[_0xcea0('0x8c')][_0xcea0('0x4a')]);_0x239412[_0xcea0('0x4e')]=_[_0xcea0('0x4f')](_0x3b3a54[_0xcea0('0x4e')]);_0x239412[_0xcea0('0x50')]=_[_0xcea0('0x51')](_0x239412['model'],_0x239412['query']);_0xe4168a[_0xcea0('0x53')]=_['intersection'](_0x239412[_0xcea0('0x4d')],qs[_0xcea0('0x52')](_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x52')]));_0xe4168a['attributes']=_0xe4168a[_0xcea0('0x53')][_0xcea0('0x54')]?_0xe4168a[_0xcea0('0x53')]:_0x239412[_0xcea0('0x4d')];_0xe4168a['order']=qs[_0xcea0('0x70')](_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x70')]);_0xe4168a[_0xcea0('0x5a')]=qs['filters'](_[_0xcea0('0x58')](_0x3b3a54['query'],_0x239412[_0xcea0('0x50')]));if(_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x59')]){_0xe4168a[_0xcea0('0x5a')]=_[_0xcea0('0x5b')](_0xe4168a[_0xcea0('0x5a')],{'$or':_[_0xcea0('0x49')](_0xe4168a[_0xcea0('0x53')],function(_0x5571e9){var _0x150952={};_0x150952[_0x5571e9]={'$like':'%'+_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x59')]+'%'};return _0x150952;})});}_0xe4168a=_[_0xcea0('0x5b')]({},_0xe4168a,_0x3b3a54['options']);return _0x508b86[_0xcea0('0xc1')](_0xe4168a);}})['then'](function(_0x1b0a50){if(_0x1b0a50){_0x4160ae=_0x1b0a50[_0xcea0('0x54')];if(!_0x3b3a54['query'][_0xcea0('0x55')]('nolimit')){_0xe4168a[_0xcea0('0x23')]=qs[_0xcea0('0x23')](_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x23')]);_0xe4168a[_0xcea0('0x25')]=qs[_0xcea0('0x25')](_0x3b3a54[_0xcea0('0x4e')][_0xcea0('0x25')]);}return _0x508b86['getAgents'](_0xe4168a);}})['then'](function(_0x239bbb){if(_0x239bbb){return _0x239bbb?{'count':_0x4160ae,'rows':_0x239bbb}:null;}})[_0xcea0('0x12')](respondWithResult(_0x402557,null))[_0xcea0('0x1d')](handleError(_0x402557,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 00eaeee..490bcb9 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 _0xc0d7=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x1c89a2,_0x2a90a1){var _0x43d91e=function(_0x54239a){while(--_0x54239a){_0x1c89a2['push'](_0x1c89a2['shift']());}};_0x43d91e(++_0x2a90a1);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x2a71ac,_0xb665cb){_0x2a71ac=_0x2a71ac-0x0;var _0x5db373=_0xc0d7[_0x2a71ac];return _0x5db373;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7c0d('0x0')](0x0);var events={'afterCreate':_0x7c0d('0x1'),'afterUpdate':_0x7c0d('0x2'),'afterDestroy':_0x7c0d('0x3')};function emitEvent(_0x2c03ef){return function(_0x2e1cc8,_0xfbd3c8,_0x276b49){MailAccountEvents[_0x7c0d('0x4')](_0x2c03ef+':'+_0x2e1cc8['id'],_0x2e1cc8);MailAccountEvents['emit'](_0x2c03ef,_0x2e1cc8);_0x276b49(null);};}for(var e in events){if(events[_0x7c0d('0x5')](e)){var event=events[e];MailAccount[_0x7c0d('0x6')](e,emitEvent(event));}}module[_0x7c0d('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xfdfc=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x2ef84f,_0x37fa99){var _0x3e7360=function(_0x16a368){while(--_0x16a368){_0x2ef84f['push'](_0x2ef84f['shift']());}};_0x3e7360(++_0x37fa99);}(_0xfdfc,0x6c));var _0xcfdf=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfdfc[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcfdf('0x0')](0x0);var events={'afterCreate':_0xcfdf('0x1'),'afterUpdate':_0xcfdf('0x2'),'afterDestroy':_0xcfdf('0x3')};function emitEvent(_0x2e33ad){return function(_0x4ac919,_0x26bf53,_0x46006e){MailAccountEvents[_0xcfdf('0x4')](_0x2e33ad+':'+_0x4ac919['id'],_0x4ac919);MailAccountEvents['emit'](_0x2e33ad,_0x4ac919);_0x46006e(null);};}for(var e in events){if(events[_0xcfdf('0x5')](e)){var event=events[e];MailAccount[_0xcfdf('0x6')](e,emitEvent(event));}}module[_0xcfdf('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 51aea29..ba71ec8 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 _0xc27c=['port','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','pass','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp'];(function(_0x3161f4,_0x8e7b45){var _0x1b2b59=function(_0x2adbfd){while(--_0x2adbfd){_0x3161f4['push'](_0x3161f4['shift']());}};_0x1b2b59(++_0x8e7b45);}(_0xc27c,0x158));var _0xcc27=function(_0x40a3c2,_0x577478){_0x40a3c2=_0x40a3c2-0x0;var _0x2a9372=_0xc27c[_0x40a3c2];return _0x2a9372;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x3c36a2){return _0x3c36a2[_0xcc27('0x0')](_0xcc27('0x1'),attributes,{'tableName':_0xcc27('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x92f49d=this;var _0x264eda={'id':_0x92f49d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x92f49d[_0xcc27('0x3')]!==_0xcc27('0x4')){_0x264eda[_0xcc27('0x5')]=_0x92f49d['provider'];}else{_0x264eda[_0xcc27('0x6')]=_0x92f49d[_0xcc27('0x7')][_0xcc27('0x6')];_0x264eda[_0xcc27('0x8')]=_0x92f49d[_0xcc27('0x7')][_0xcc27('0x8')];_0x264eda['secure']=_0x92f49d[_0xcc27('0x7')][_0xcc27('0x9')];}if(_0x92f49d[_0xcc27('0x7')]['authentication']){if(_0x92f49d[_0xcc27('0x7')][_0xcc27('0xa')]){if(!_0x92f49d[_0xcc27('0x7')]['CloudProvider'])throw new Error(_0xcc27('0xb'));_0x264eda[_0xcc27('0xc')]={'type':'OAuth2','user':_0x92f49d[_0xcc27('0x7')][_0xcc27('0xd')],'accessToken':_0x92f49d[_0xcc27('0x7')][_0xcc27('0xe')]['data5']};}else{_0x264eda[_0xcc27('0xc')]={'user':_0x92f49d['Smtp'][_0xcc27('0xd')],'pass':_0x92f49d[_0xcc27('0x7')][_0xcc27('0xf')]};}}return _0x264eda;}}});}; \ No newline at end of file +var _0x03cd=['Smtp','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','pass','exports','mail_accounts','provider','custom','host'];(function(_0x4cdf48,_0xf67ce4){var _0x5bd9ac=function(_0x253867){while(--_0x253867){_0x4cdf48['push'](_0x4cdf48['shift']());}};_0x5bd9ac(++_0xf67ce4);}(_0x03cd,0x172));var _0xd03c=function(_0x267c3e,_0x2a0bb9){_0x267c3e=_0x267c3e-0x0;var _0x77f8c9=_0x03cd[_0x267c3e];return _0x77f8c9;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xd03c('0x0')]=function(_0x344598){return _0x344598['define']('MailAccount',attributes,{'tableName':_0xd03c('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x222f7f=this;var _0x25adbc={'id':_0x222f7f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x222f7f[_0xd03c('0x2')]!==_0xd03c('0x3')){_0x25adbc['service']=_0x222f7f[_0xd03c('0x2')];}else{_0x25adbc[_0xd03c('0x4')]=_0x222f7f[_0xd03c('0x5')][_0xd03c('0x4')];_0x25adbc[_0xd03c('0x6')]=_0x222f7f[_0xd03c('0x5')][_0xd03c('0x6')];_0x25adbc[_0xd03c('0x7')]=_0x222f7f['Smtp'][_0xd03c('0x7')];}if(_0x222f7f[_0xd03c('0x5')][_0xd03c('0x8')]){if(_0x222f7f['Smtp']['modernAuthentication']){if(!_0x222f7f['Smtp']['CloudProvider'])throw new Error(_0xd03c('0x9'));_0x25adbc[_0xd03c('0xa')]={'type':_0xd03c('0xb'),'user':_0x222f7f['Smtp'][_0xd03c('0xc')],'accessToken':_0x222f7f[_0xd03c('0x5')][_0xd03c('0xd')]['data5']};}else{_0x25adbc['auth']={'user':_0x222f7f[_0xd03c('0x5')]['user'],'pass':_0x222f7f['Smtp'][_0xd03c('0xe')]};}}return _0x25adbc;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index cc04f53..6f9fdd3 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 _0xd6d2=['request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','model','map','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','CloudProvider','omit','applications','list','orderBy','asc','autoclose','push','close','length','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','attachments','originCc','bcc','originChannel','Email','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','startRouting','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info'];(function(_0xc3eb67,_0xfb68aa){var _0x19a0b8=function(_0x1c9dce){while(--_0x1c9dce){_0xc3eb67['push'](_0xc3eb67['shift']());}};_0x19a0b8(++_0xfb68aa);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x12cbc2,_0x333aeb){_0x12cbc2=_0x12cbc2-0x0;var _0x48d74a=_0xd6d2[_0x12cbc2];return _0x48d74a;};'use strict';var _=require(_0x2d6d('0x0'));var moment=require(_0x2d6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d6d('0x2'));var Redis=require(_0x2d6d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x2d6d('0x4'))('rpc');var config=require(_0x2d6d('0x5'));var jayson=require(_0x2d6d('0x6'));var client=jayson[_0x2d6d('0x7')]['http']({'port':0x232c});config[_0x2d6d('0x8')]=_[_0x2d6d('0x9')](config[_0x2d6d('0x8')],{'host':_0x2d6d('0xa'),'port':0x18eb});var socket=require(_0x2d6d('0xb'))(new Redis(config[_0x2d6d('0x8')]));require(_0x2d6d('0xc'))[_0x2d6d('0xd')](socket);function respondWithRpcPromise(_0x8e4be8,_0x261959,_0x1a1f60){return new BPromise(function(_0x4bf440,_0x25fc41){return client[_0x2d6d('0xe')](_0x8e4be8,_0x1a1f60)[_0x2d6d('0xf')](function(_0x3cc2fa){logger[_0x2d6d('0x10')]('MailAccount,\x20%s,\x20%s',_0x261959,_0x2d6d('0x11'));logger[_0x2d6d('0x12')](_0x2d6d('0x13'),_0x261959,_0x2d6d('0x11'),JSON[_0x2d6d('0x14')](_0x3cc2fa));if(_0x3cc2fa['error']){if(_0x3cc2fa[_0x2d6d('0x15')][_0x2d6d('0x16')]===0x1f4){logger[_0x2d6d('0x15')](_0x2d6d('0x17'),_0x261959,_0x3cc2fa['error'][_0x2d6d('0x18')]);return _0x25fc41(_0x3cc2fa[_0x2d6d('0x15')]['message']);}logger['error'](_0x2d6d('0x17'),_0x261959,_0x3cc2fa[_0x2d6d('0x15')][_0x2d6d('0x18')]);return _0x4bf440(_0x3cc2fa['error'][_0x2d6d('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x261959,'request\x20sent');_0x4bf440(_0x3cc2fa[_0x2d6d('0x19')][_0x2d6d('0x18')]);}})[_0x2d6d('0x1a')](function(_0x3c527e){logger[_0x2d6d('0x15')](_0x2d6d('0x17'),_0x261959,_0x3c527e);_0x25fc41(_0x3c527e);});});}exports[_0x2d6d('0x1b')]=function(_0xa2c4a7){var _0x31b38b=this;return new Promise(function(_0x4898a7,_0x315d13){return db[_0x2d6d('0x1c')]['findAll']({'raw':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x1e')]===undefined?!![]:![]:!![],'where':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x1f')]||null:null,'attributes':_0xa2c4a7['options']?_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x20')]||null:null,'limit':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7['options']['limit']||null:null,'include':_0xa2c4a7[_0x2d6d('0x1d')]?_0xa2c4a7['options']['include']?_['map'](_0xa2c4a7[_0x2d6d('0x1d')][_0x2d6d('0x21')],function(_0x3da83d){return{'model':db[_0x3da83d[_0x2d6d('0x22')]],'as':_0x3da83d['as'],'attributes':_0x3da83d[_0x2d6d('0x20')],'include':_0x3da83d['include']?_[_0x2d6d('0x23')](_0x3da83d[_0x2d6d('0x21')],function(_0x455e71){return{'model':db[_0x455e71[_0x2d6d('0x22')]],'as':_0x455e71['as'],'attributes':_0x455e71[_0x2d6d('0x20')],'include':_0x455e71[_0x2d6d('0x21')]?_[_0x2d6d('0x23')](_0x455e71[_0x2d6d('0x21')],function(_0x27b7d2){return{'model':db[_0x27b7d2['model']],'as':_0x27b7d2['as'],'attributes':_0x27b7d2[_0x2d6d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d6d('0xf')](function(_0x2e7b32){logger[_0x2d6d('0x10')]('GetMailAccount',_0xa2c4a7);logger[_0x2d6d('0x12')]('GetMailAccount',_0xa2c4a7,JSON[_0x2d6d('0x14')](_0x2e7b32));_0x4898a7(_0x2e7b32);})['catch'](function(_0x58bfc7){logger[_0x2d6d('0x15')]('GetMailAccount',_0x58bfc7[_0x2d6d('0x18')],_0xa2c4a7);_0x315d13(_0x31b38b[_0x2d6d('0x15')](0x1f4,_0x58bfc7['message']));});});};exports[_0x2d6d('0x24')]=function(_0x4864a6){var _0xfbf3dc=this;return new Promise(function(_0x422153,_0xafd15a){return db[_0x2d6d('0x1c')][_0x2d6d('0x25')]({'raw':_0x4864a6[_0x2d6d('0x1d')]?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x1e')]===undefined?!![]:![]:!![],'where':_0x4864a6['options']?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x1f')]||null:null,'attributes':_0x4864a6['options']?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x20')]||null:null,'include':_0x4864a6[_0x2d6d('0x1d')]?_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x21')]?_['map'](_0x4864a6['options']['include'],function(_0x625d2a){return{'model':db[_0x625d2a[_0x2d6d('0x22')]],'as':_0x625d2a['as'],'attributes':_0x625d2a[_0x2d6d('0x20')],'include':_0x625d2a['include']?_[_0x2d6d('0x23')](_0x625d2a[_0x2d6d('0x21')],function(_0x29dce0){return{'model':db[_0x29dce0[_0x2d6d('0x22')]],'as':_0x29dce0['as'],'attributes':_0x29dce0['attributes'],'include':_0x29dce0[_0x2d6d('0x21')]?_[_0x2d6d('0x23')](_0x29dce0[_0x2d6d('0x21')],function(_0x15f9af){return{'model':db[_0x15f9af[_0x2d6d('0x22')]],'as':_0x15f9af['as'],'attributes':_0x15f9af[_0x2d6d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2d6d('0xf')](function(_0x5b0674){if(_0x4864a6[_0x2d6d('0x1d')][_0x2d6d('0x26')]===!![])_0x5b0674[_0x2d6d('0x27')](_0x2d6d('0x28'),_0x5b0674[_0x2d6d('0x29')]());logger['info'](_0x2d6d('0x24'),_0x4864a6);logger[_0x2d6d('0x12')](_0x2d6d('0x24'),_0x4864a6,JSON[_0x2d6d('0x14')](_0x5b0674));_0x422153(_0x5b0674);})[_0x2d6d('0x1a')](function(_0x108f7c){logger[_0x2d6d('0x15')](_0x2d6d('0x24'),_0x108f7c[_0x2d6d('0x18')],_0x4864a6);_0xafd15a(_0xfbf3dc[_0x2d6d('0x15')](0x1f4,_0x108f7c[_0x2d6d('0x18')]));});});};exports[_0x2d6d('0x2a')]=function(_0x33c6b5){var _0x1dae0a=this;return new Promise(function(_0x34fc23,_0x11c737){var _0x452417={'body':_0x33c6b5['body'],'channel':_0x2d6d('0x2b')};var _0x97b688=_[_0x2d6d('0x2c')](_[_0x2d6d('0x2d')](db[_0x2d6d('0x2e')]['rawAttributes']),[_0x2d6d('0x2f'),_0x2d6d('0x30'),_0x2d6d('0x31'),_0x2d6d('0x32')]);var _0x543b4b=![];if(_0x33c6b5[_0x2d6d('0x33')]['id']){delete _0x33c6b5[_0x2d6d('0x33')]['id'];}if(_[_0x2d6d('0x34')](_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x35')])){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x36')));}if(_[_0x2d6d('0x34')](_0x33c6b5['body'][_0x2d6d('0x33')])||_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x33')]===''){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x37')));}if(_[_0x2d6d('0x34')](_0x33c6b5['body']['mapKey'])){return _0x11c737(_0x1dae0a['error'](0x1f4,_0x2d6d('0x38')+_0x97b688));}if(!_[_0x2d6d('0x39')](_0x97b688,_0x33c6b5['body'][_0x2d6d('0x3a')])){return _0x11c737(_0x1dae0a[_0x2d6d('0x15')](0x1f4,_0x2d6d('0x3b')+_0x97b688));}var _0x470fb5={};_0x470fb5[_0x33c6b5['body'][_0x2d6d('0x3a')]]=_0x33c6b5[_0x2d6d('0x33')]['from'];return db[_0x2d6d('0x1c')][_0x2d6d('0x25')]({'where':{'id':_0x33c6b5[_0x2d6d('0x3c')]['id']},'include':[{'model':db[_0x2d6d('0x3d')],'as':_0x2d6d('0x3e'),'include':[{'model':db[_0x2d6d('0x2e')],'as':_0x2d6d('0x3f'),'where':_0x470fb5,'limit':0x1,'order':[['updatedAt',_0x2d6d('0x40')]]}]},{'model':db[_0x2d6d('0x41')],'as':_0x2d6d('0x42')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2d6d('0x43')],'as':_0x2d6d('0x43')}]}]})[_0x2d6d('0xf')](function(_0x4e5203){if(_0x4e5203&&_0x4e5203[_0x2d6d('0x3e')]){var _0xff0b07=_0x4e5203['get']({'plain':!![]});_0x452417[_0x2d6d('0x3c')]=_[_0x2d6d('0x44')](_0xff0b07,[_0x2d6d('0x42'),_0x2d6d('0x3e')]);_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x28')]=_0x4e5203[_0x2d6d('0x29')]();_0x452417[_0x2d6d('0x45')]=_0xff0b07[_0x2d6d('0x42')];_0x452417[_0x2d6d('0x46')]=_0xff0b07['List'];_0x452417[_0x2d6d('0x45')]=_[_0x2d6d('0x47')](_0x452417[_0x2d6d('0x45')],['priority'],[_0x2d6d('0x48')]);if(_0x452417[_0x2d6d('0x3c')]&&_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x49')]){_0x452417[_0x2d6d('0x45')][_0x2d6d('0x4a')]({'id':0x0,'priority':_0x452417[_0x2d6d('0x45')]['length']+0x1,'app':_0x2d6d('0x4b'),'appdata':_0x2d6d('0x49'),'interval':'*,*,*,*'});}if(_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x42')]){delete _0x452417['account'][_0x2d6d('0x42')];}if(_0x452417[_0x2d6d('0x3c')]['List']){delete _0x452417[_0x2d6d('0x3c')][_0x2d6d('0x3e')];}if(_0xff0b07[_0x2d6d('0x3e')][_0x2d6d('0x3f')][_0x2d6d('0x4c')]){return _0xff0b07[_0x2d6d('0x3e')][_0x2d6d('0x3f')][0x0];}var _0x566bc4=_['defaults'](_0x33c6b5[_0x2d6d('0x33')],{'firstName':_0x33c6b5['body'][_0x2d6d('0x35')],'ListId':_0xff0b07[_0x2d6d('0x32')]});_0x566bc4[_0x33c6b5[_0x2d6d('0x33')]['mapKey']]=_0x33c6b5[_0x2d6d('0x33')]['from'];return db[_0x2d6d('0x2e')][_0x2d6d('0x4d')](_0x566bc4);}else{throw new Error(_0x2d6d('0x4e'));}})[_0x2d6d('0xf')](function(_0x30402e){_0x452417[_0x2d6d('0x4f')]=_0x30402e;if(_0x30402e){if(!_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['messageId']){_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')]=rs['generate']()+'\x20'+_0x33c6b5['body']['message'][_0x2d6d('0x35')];}var _0x4c1b4f={'ContactId':_0x30402e['id'],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id'],'inReplyTo':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['from'],'cc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x51')],'attach':_0x33c6b5[_0x2d6d('0x33')]['message'][_0x2d6d('0x52')],'lastMsgAt':moment()[_0x2d6d('0x53')](_0x2d6d('0x54')),'lastMsgDirection':'in'};return db[_0x2d6d('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id']},'include':[{'model':db[_0x2d6d('0x56')],'as':_0x2d6d('0x57'),'attributes':['messageId'],'where':{'messageId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x58')]}}]})['then'](function(_0x3dd1d8){if(_0x3dd1d8){return[_0x3dd1d8,![]];}return db['MailInteraction'][_0x2d6d('0x4d')](_0x4c1b4f)[_0x2d6d('0xf')](function(_0x2183ba){return[_0x2183ba,!![]];});});}else{throw new Error(_0x2d6d('0x59'));}})[_0x2d6d('0x5a')](function(_0x179721,_0x3540ed){if(_0x179721){_0x543b4b=_0x3540ed;if(!_0x3540ed){return _0x179721[_0x2d6d('0x5b')]({'inReplyTo':_0x33c6b5['body'][_0x2d6d('0x18')][_0x2d6d('0x50')],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x35')],'cc':_0x33c6b5['body'][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5['body'][_0x2d6d('0x18')][_0x2d6d('0x51')],'attach':_0x179721[_0x2d6d('0x52')]?_0x179721[_0x2d6d('0x52')]:_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x52')],'substatus':null,'substatusAt':moment()[_0x2d6d('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x2d6d('0x53')](_0x2d6d('0x54')),'lastMsgDirection':'in'});}else{return _0x179721;}}})[_0x2d6d('0xf')](function(_0x2ea00d){_0x452417[_0x2d6d('0x5c')]=_0x2ea00d['get']({'plain':!![]});_0x452417['interaction']['created']=_0x543b4b;return db[_0x2d6d('0x56')][_0x2d6d('0x4d')]({'body':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x33')],'MailAccountId':_0x33c6b5[_0x2d6d('0x3c')]['id'],'MailInteractionId':_0x2ea00d['id'],'direction':'in','ContactId':_0x452417[_0x2d6d('0x4f')]['id'],'messageId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x50')],'from':_0x33c6b5['body'][_0x2d6d('0x18')]['from'],'to':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['to'],'cc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['cc'],'subject':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['subject'],'attach':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['attach'],'Attachments':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5d')],'originTo':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['originTo'],'originCc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5e')],'bcc':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x5f')],'ChatWebsiteId':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')]['ChatWebsiteId']||null,'originChannel':_0x33c6b5[_0x2d6d('0x33')][_0x2d6d('0x18')][_0x2d6d('0x60')]||_0x2d6d('0x61'),'ChatOfflineMessageId':_0x33c6b5['body'][_0x2d6d('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x54b0e0){_0x452417[_0x2d6d('0x18')]=_0x54b0e0;if(!_0x452417[_0x2d6d('0x5c')][_0x2d6d('0x62')]){return;}return db[_0x2d6d('0x63')][_0x2d6d('0x25')]({'attributes':['id',_0x2d6d('0x64')],'where':{'id':_0x452417[_0x2d6d('0x5c')]['UserId']}});})[_0x2d6d('0xf')](function(_0x92da1c){if(_0x92da1c){_0x452417['applications'][_0x2d6d('0x65')]({'id':0x0,'priority':0x0,'app':_0x2d6d('0x66'),'appdata':_0x92da1c['name']+','+(_0x452417[_0x2d6d('0x3c')][_0x2d6d('0x67')]||0xa),'interval':_0x2d6d('0x68')});}if(!_0x452417['interaction'][_0x2d6d('0x69')]){return;}return db[_0x2d6d('0x6a')][_0x2d6d('0x25')]({'attributes':['id',_0x2d6d('0x64')],'where':{'id':_0x452417[_0x2d6d('0x5c')]['queueId']}});})[_0x2d6d('0xf')](function(_0x5de755){if(_0x5de755){_0x452417[_0x2d6d('0x45')][_0x2d6d('0x65')]({'id':0x0,'priority':0x1,'app':_0x2d6d('0x6b'),'appdata':_0x5de755['name']+','+(_0x452417['account'][_0x2d6d('0x6c')]||0x12c),'interval':_0x2d6d('0x68')});}return respondWithRpcPromise('Start',_0x2d6d('0x6d'),_0x452417);})[_0x2d6d('0xf')](function(_0x4952ac){_0x34fc23(_0x4952ac);})[_0x2d6d('0x1a')](function(_0x129d20){_0x11c737(_0x1dae0a[_0x2d6d('0x15')](0x1f4,_0x129d20[_0x2d6d('0x18')]));});});}; \ No newline at end of file +var _0x31f0=['map','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','orderBy','applications','asc','autoclose','push','length','close','*,*,*,*','defaults','ListId','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','update','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','MailQueue','queueId','unshift','queue','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','include'];(function(_0x3dab7b,_0x516920){var _0x2223a0=function(_0x12e51a){while(--_0x12e51a){_0x3dab7b['push'](_0x3dab7b['shift']());}};_0x2223a0(++_0x516920);}(_0x31f0,0xb7));var _0x031f=function(_0x4bfe16,_0x3e83b1){_0x4bfe16=_0x4bfe16-0x0;var _0x599bb9=_0x31f0[_0x4bfe16];return _0x599bb9;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var BPromise=require(_0x031f('0x1'));var rs=require('randomstring');var Redis=require(_0x031f('0x2'));var db=require(_0x031f('0x3'))['db'];var logger=require(_0x031f('0x4'))(_0x031f('0x5'));var config=require('../../config/environment');var jayson=require(_0x031f('0x6'));var client=jayson[_0x031f('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x031f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x031f('0x9'))(new Redis(config[_0x031f('0x8')]));require(_0x031f('0xa'))[_0x031f('0xb')](socket);function respondWithRpcPromise(_0x4d47c5,_0x2e5624,_0x24145f){return new BPromise(function(_0x327f11,_0x439940){return client[_0x031f('0xc')](_0x4d47c5,_0x24145f)[_0x031f('0xd')](function(_0x2202dc){logger[_0x031f('0xe')]('MailAccount,\x20%s,\x20%s',_0x2e5624,_0x031f('0xf'));logger[_0x031f('0x10')](_0x031f('0x11'),_0x2e5624,_0x031f('0xf'),JSON[_0x031f('0x12')](_0x2202dc));if(_0x2202dc[_0x031f('0x13')]){if(_0x2202dc[_0x031f('0x13')]['code']===0x1f4){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x439940(_0x2202dc[_0x031f('0x13')]['message']);}logger['error'](_0x031f('0x14'),_0x2e5624,_0x2202dc[_0x031f('0x13')][_0x031f('0x15')]);return _0x327f11(_0x2202dc[_0x031f('0x13')]['message']);}else{logger[_0x031f('0xe')](_0x031f('0x14'),_0x2e5624,'request\x20sent');_0x327f11(_0x2202dc[_0x031f('0x16')]['message']);}})[_0x031f('0x17')](function(_0x5f2199){logger[_0x031f('0x13')](_0x031f('0x14'),_0x2e5624,_0x5f2199);_0x439940(_0x5f2199);});});}exports[_0x031f('0x18')]=function(_0x26cb5e){var _0x1b76d6=this;return new Promise(function(_0x2825ef,_0xf76f1b){return db[_0x031f('0x19')][_0x031f('0x1a')]({'raw':_0x26cb5e['options']?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options']['where']||null:null,'attributes':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e['options'][_0x031f('0x1d')]||null:null,'limit':_0x26cb5e['options']?_0x26cb5e['options']['limit']||null:null,'include':_0x26cb5e[_0x031f('0x1b')]?_0x26cb5e[_0x031f('0x1b')][_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x26cb5e['options'][_0x031f('0x1e')],function(_0x5a64c0){return{'model':db[_0x5a64c0[_0x031f('0x20')]],'as':_0x5a64c0['as'],'attributes':_0x5a64c0[_0x031f('0x1d')],'include':_0x5a64c0[_0x031f('0x1e')]?_['map'](_0x5a64c0[_0x031f('0x1e')],function(_0x3b2a51){return{'model':db[_0x3b2a51['model']],'as':_0x3b2a51['as'],'attributes':_0x3b2a51[_0x031f('0x1d')],'include':_0x3b2a51[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x3b2a51['include'],function(_0xa308b){return{'model':db[_0xa308b[_0x031f('0x20')]],'as':_0xa308b['as'],'attributes':_0xa308b[_0x031f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x031f('0xd')](function(_0xfaa36){logger[_0x031f('0xe')]('GetMailAccount',_0x26cb5e);logger[_0x031f('0x10')](_0x031f('0x18'),_0x26cb5e,JSON[_0x031f('0x12')](_0xfaa36));_0x2825ef(_0xfaa36);})[_0x031f('0x17')](function(_0x428ec4){logger[_0x031f('0x13')](_0x031f('0x18'),_0x428ec4[_0x031f('0x15')],_0x26cb5e);_0xf76f1b(_0x1b76d6[_0x031f('0x13')](0x1f4,_0x428ec4[_0x031f('0x15')]));});});};exports[_0x031f('0x21')]=function(_0x5ec564){var _0xced6ff=this;return new Promise(function(_0xe5f11c,_0xb3a6bd){return db[_0x031f('0x19')][_0x031f('0x22')]({'raw':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')][_0x031f('0x23')]||null:null,'attributes':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['attributes']||null:null,'include':_0x5ec564[_0x031f('0x1b')]?_0x5ec564[_0x031f('0x1b')]['include']?_[_0x031f('0x1f')](_0x5ec564[_0x031f('0x1b')]['include'],function(_0x17b93c){return{'model':db[_0x17b93c[_0x031f('0x20')]],'as':_0x17b93c['as'],'attributes':_0x17b93c[_0x031f('0x1d')],'include':_0x17b93c[_0x031f('0x1e')]?_['map'](_0x17b93c['include'],function(_0x36ab13){return{'model':db[_0x36ab13['model']],'as':_0x36ab13['as'],'attributes':_0x36ab13[_0x031f('0x1d')],'include':_0x36ab13[_0x031f('0x1e')]?_[_0x031f('0x1f')](_0x36ab13['include'],function(_0x5c33c5){return{'model':db[_0x5c33c5[_0x031f('0x20')]],'as':_0x5c33c5['as'],'attributes':_0x5c33c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d489a){if(_0x5ec564[_0x031f('0x1b')][_0x031f('0x24')]===!![])_0x2d489a[_0x031f('0x25')](_0x031f('0x26'),_0x2d489a[_0x031f('0x27')]());logger[_0x031f('0xe')]('ShowMailAccount',_0x5ec564);logger[_0x031f('0x10')](_0x031f('0x21'),_0x5ec564,JSON[_0x031f('0x12')](_0x2d489a));_0xe5f11c(_0x2d489a);})[_0x031f('0x17')](function(_0x58daa2){logger[_0x031f('0x13')](_0x031f('0x21'),_0x58daa2[_0x031f('0x15')],_0x5ec564);_0xb3a6bd(_0xced6ff['error'](0x1f4,_0x58daa2[_0x031f('0x15')]));});});};exports[_0x031f('0x28')]=function(_0x5d6826){var _0x36bafa=this;return new Promise(function(_0x268dc7,_0x56a8f3){var _0x4c50b2={'body':_0x5d6826[_0x031f('0x29')],'channel':_0x031f('0x2a')};var _0x9efbc4=_[_0x031f('0x2b')](_[_0x031f('0x2c')](db[_0x031f('0x2d')][_0x031f('0x2e')]),['createdAt',_0x031f('0x2f'),_0x031f('0x30'),'ListId']);var _0x12279a=![];if(_0x5d6826['body']['id']){delete _0x5d6826[_0x031f('0x29')]['id'];}if(_[_0x031f('0x31')](_0x5d6826['body'][_0x031f('0x32')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x33')));}if(_['isNil'](_0x5d6826[_0x031f('0x29')][_0x031f('0x29')])||_0x5d6826[_0x031f('0x29')][_0x031f('0x29')]===''){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x34')));}if(_[_0x031f('0x31')](_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa['error'](0x1f4,_0x031f('0x36')+_0x9efbc4));}if(!_[_0x031f('0x37')](_0x9efbc4,_0x5d6826[_0x031f('0x29')][_0x031f('0x35')])){return _0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x031f('0x38')+_0x9efbc4));}var _0x2111c5={};_0x2111c5[_0x5d6826[_0x031f('0x29')][_0x031f('0x35')]]=_0x5d6826['body'][_0x031f('0x32')];return db['MailAccount']['find']({'where':{'id':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x3a')],'as':_0x031f('0x3b'),'include':[{'model':db[_0x031f('0x2d')],'as':_0x031f('0x3c'),'where':_0x2111c5,'limit':0x1,'order':[['updatedAt',_0x031f('0x3d')]]}]},{'model':db[_0x031f('0x3e')],'as':_0x031f('0x3f')},{'model':db['MailServerOut'],'as':_0x031f('0x40'),'include':[{'model':db[_0x031f('0x41')],'as':_0x031f('0x41')}]}]})[_0x031f('0xd')](function(_0x2c93ea){if(_0x2c93ea&&_0x2c93ea[_0x031f('0x3b')]){var _0x5caeb5=_0x2c93ea['get']({'plain':!![]});_0x4c50b2[_0x031f('0x39')]=_['omit'](_0x5caeb5,[_0x031f('0x3f'),_0x031f('0x3b')]);_0x4c50b2['account'][_0x031f('0x26')]=_0x2c93ea['getSmtpOptions']();_0x4c50b2['applications']=_0x5caeb5[_0x031f('0x3f')];_0x4c50b2['list']=_0x5caeb5[_0x031f('0x3b')];_0x4c50b2['applications']=_[_0x031f('0x42')](_0x4c50b2[_0x031f('0x43')],['priority'],[_0x031f('0x44')]);if(_0x4c50b2[_0x031f('0x39')]&&_0x4c50b2['account'][_0x031f('0x45')]){_0x4c50b2['applications'][_0x031f('0x46')]({'id':0x0,'priority':_0x4c50b2['applications'][_0x031f('0x47')]+0x1,'app':_0x031f('0x48'),'appdata':_0x031f('0x45'),'interval':_0x031f('0x49')});}if(_0x4c50b2[_0x031f('0x39')]['Applications']){delete _0x4c50b2[_0x031f('0x39')]['Applications'];}if(_0x4c50b2[_0x031f('0x39')][_0x031f('0x3b')]){delete _0x4c50b2['account'][_0x031f('0x3b')];}if(_0x5caeb5[_0x031f('0x3b')]['Contacts'][_0x031f('0x47')]){return _0x5caeb5[_0x031f('0x3b')][_0x031f('0x3c')][0x0];}var _0x55b9cf=_[_0x031f('0x4a')](_0x5d6826['body'],{'firstName':_0x5d6826[_0x031f('0x29')]['from'],'ListId':_0x5caeb5[_0x031f('0x4b')]});_0x55b9cf[_0x5d6826['body'][_0x031f('0x35')]]=_0x5d6826[_0x031f('0x29')]['from'];return db['CmContact'][_0x031f('0x4c')](_0x55b9cf);}else{throw new Error(_0x031f('0x4d'));}})['then'](function(_0x434c0f){_0x4c50b2[_0x031f('0x4e')]=_0x434c0f;if(_0x434c0f){if(!_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]){_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')]=rs['generate']()+'\x20'+_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')];}var _0x5db3c7={'ContactId':_0x434c0f['id'],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826['body']['message'][_0x031f('0x50')],'attach':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x51')],'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x031f('0x53')][_0x031f('0x22')]({'where':{'closed':![],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id']},'include':[{'model':db[_0x031f('0x54')],'as':_0x031f('0x55'),'attributes':[_0x031f('0x4f')],'where':{'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x56')]}}]})['then'](function(_0x138e0d){if(_0x138e0d){return[_0x138e0d,![]];}return db['MailInteraction'][_0x031f('0x4c')](_0x5db3c7)[_0x031f('0xd')](function(_0x3d27d6){return[_0x3d27d6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xdb3d45,_0x46af33){if(_0xdb3d45){_0x12279a=_0x46af33;if(!_0x46af33){return _0xdb3d45[_0x031f('0x57')]({'inReplyTo':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x4f')],'to':_0x5d6826['body']['message'][_0x031f('0x32')],'cc':_0x5d6826['body']['message']['cc'],'subject':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x50')],'attach':_0xdb3d45[_0x031f('0x51')]?_0xdb3d45[_0x031f('0x51')]:_0x5d6826['body']['message'][_0x031f('0x51')],'substatus':null,'substatusAt':moment()['format'](_0x031f('0x58')),'lastMsgAt':moment()[_0x031f('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xdb3d45;}}})[_0x031f('0xd')](function(_0xee136c){_0x4c50b2[_0x031f('0x59')]=_0xee136c[_0x031f('0x5a')]({'plain':!![]});_0x4c50b2[_0x031f('0x59')][_0x031f('0x5b')]=_0x12279a;return db['MailMessage']['create']({'body':_0x5d6826[_0x031f('0x29')][_0x031f('0x29')],'MailAccountId':_0x5d6826[_0x031f('0x39')]['id'],'MailInteractionId':_0xee136c['id'],'direction':'in','ContactId':_0x4c50b2[_0x031f('0x4e')]['id'],'messageId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x4f')],'from':_0x5d6826['body']['message']['from'],'to':_0x5d6826['body'][_0x031f('0x15')]['to'],'cc':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['cc'],'subject':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x50')],'attach':_0x5d6826['body'][_0x031f('0x15')][_0x031f('0x51')],'Attachments':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')][_0x031f('0x5c')],'originTo':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['originTo'],'originCc':_0x5d6826['body'][_0x031f('0x15')]['originCc'],'bcc':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5d')],'ChatWebsiteId':_0x5d6826[_0x031f('0x29')][_0x031f('0x15')]['ChatWebsiteId']||null,'originChannel':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x5e')]||_0x031f('0x5f'),'ChatOfflineMessageId':_0x5d6826[_0x031f('0x29')]['message'][_0x031f('0x60')]||null},{'include':[{'model':db[_0x031f('0x61')],'as':_0x031f('0x62')}]});})[_0x031f('0xd')](function(_0x45330f){_0x4c50b2['message']=_0x45330f;if(!_0x4c50b2['interaction'][_0x031f('0x63')]){return;}return db[_0x031f('0x64')]['find']({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2['interaction'][_0x031f('0x63')]}});})[_0x031f('0xd')](function(_0x142310){if(_0x142310){_0x4c50b2[_0x031f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x031f('0x66'),'appdata':_0x142310[_0x031f('0x65')]+','+(_0x4c50b2[_0x031f('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x031f('0x49')});}if(!_0x4c50b2[_0x031f('0x59')]['queueId']){return;}return db[_0x031f('0x67')][_0x031f('0x22')]({'attributes':['id',_0x031f('0x65')],'where':{'id':_0x4c50b2[_0x031f('0x59')][_0x031f('0x68')]}});})[_0x031f('0xd')](function(_0x3f3582){if(_0x3f3582){_0x4c50b2['applications'][_0x031f('0x69')]({'id':0x0,'priority':0x1,'app':_0x031f('0x6a'),'appdata':_0x3f3582[_0x031f('0x65')]+','+(_0x4c50b2['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x031f('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x4c50b2);})[_0x031f('0xd')](function(_0x184bbd){_0x268dc7(_0x184bbd);})[_0x031f('0x17')](function(_0x1d6aca){_0x56a8f3(_0x36bafa[_0x031f('0x13')](0x1f4,_0x1d6aca[_0x031f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 75ccc49..353afb5 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 _0x1631=['./mailAccount.events','save','emit','removeListener','register','length','mailAccount:'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1631,0x19d));var _0x1163=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1631[_0x1d1779];return _0x2377e9;};'use strict';var MailAccountEvents=require(_0x1163('0x0'));var events=[_0x1163('0x1'),'remove','update'];function createListener(_0x118695,_0x1eceb7){return function(_0x1a074c){_0x1eceb7[_0x1163('0x2')](_0x118695,_0x1a074c);};}function removeListener(_0x1f1d85,_0xa47945){return function(){MailAccountEvents[_0x1163('0x3')](_0x1f1d85,_0xa47945);};}exports[_0x1163('0x4')]=function(_0x9397da){for(var _0x4febf6=0x0,_0x5a1e9e=events[_0x1163('0x5')];_0x4febf6<_0x5a1e9e;_0x4febf6++){var _0x53522f=events[_0x4febf6];var _0xc522cc=createListener(_0x1163('0x6')+_0x53522f,_0x9397da);MailAccountEvents['on'](_0x53522f,_0xc522cc);}}; \ No newline at end of file +var _0x9b05=['emit','removeListener','register','length','save','remove','update'];(function(_0x5172f8,_0x1770aa){var _0x372d58=function(_0x436f21){while(--_0x436f21){_0x5172f8['push'](_0x5172f8['shift']());}};_0x372d58(++_0x1770aa);}(_0x9b05,0x1cb));var _0x59b0=function(_0x73e5b0,_0x241ec0){_0x73e5b0=_0x73e5b0-0x0;var _0x23ed6f=_0x9b05[_0x73e5b0];return _0x23ed6f;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x59b0('0x0'),_0x59b0('0x1'),_0x59b0('0x2')];function createListener(_0x37f560,_0x27226f){return function(_0x4109fc){_0x27226f[_0x59b0('0x3')](_0x37f560,_0x4109fc);};}function removeListener(_0x4f6218,_0x51adca){return function(){MailAccountEvents[_0x59b0('0x4')](_0x4f6218,_0x51adca);};}exports[_0x59b0('0x5')]=function(_0x3691bd){for(var _0x41d3e4=0x0,_0x5eb628=events[_0x59b0('0x6')];_0x41d3e4<_0x5eb628;_0x41d3e4++){var _0xe5f92f=events[_0x41d3e4];var _0x35000a=createListener('mailAccount:'+_0xe5f92f,_0x3691bd);MailAccountEvents['on'](_0xe5f92f,_0x35000a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e9703a4..dcf3f41 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 _0xf465=['../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x2e6273,_0x147701){var _0x71ea99=function(_0x14d299){while(--_0x14d299){_0x2e6273['push'](_0x2e6273['shift']());}};_0x71ea99(++_0x147701);}(_0xf465,0x10a));var _0x5f46=function(_0x29fe99,_0x2a4bd8){_0x29fe99=_0x29fe99-0x0;var _0x1d6acf=_0xf465[_0x29fe99];return _0x1d6acf;};'use strict';var multer=require(_0x5f46('0x0'));var util=require(_0x5f46('0x1'));var path=require('path');var timeout=require(_0x5f46('0x2'));var express=require(_0x5f46('0x3'));var router=express[_0x5f46('0x4')]();var fs_extra=require(_0x5f46('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f46('0x6'));var controller=require(_0x5f46('0x7'));router[_0x5f46('0x8')](_0x5f46('0x9'),auth[_0x5f46('0xa')](),controller['show']);router[_0x5f46('0xb')](_0x5f46('0x9'),auth[_0x5f46('0xa')](),controller[_0x5f46('0xc')]);router[_0x5f46('0xd')](_0x5f46('0x9'),auth[_0x5f46('0xa')](),controller[_0x5f46('0xe')]);module[_0x5f46('0xf')]=router; \ No newline at end of file +var _0x2546=['./mailApplication.controller','/:id','show','put','update','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4f0116,_0x2d05b7){var _0x4d9a89=function(_0x6d6c15){while(--_0x6d6c15){_0x4f0116['push'](_0x4f0116['shift']());}};_0x4d9a89(++_0x2d05b7);}(_0x2546,0x19d));var _0x6254=function(_0x471399,_0x1d5ef3){_0x471399=_0x471399-0x0;var _0x53d94f=_0x2546[_0x471399];return _0x53d94f;};'use strict';var multer=require('multer');var util=require(_0x6254('0x0'));var path=require(_0x6254('0x1'));var timeout=require(_0x6254('0x2'));var express=require(_0x6254('0x3'));var router=express[_0x6254('0x4')]();var fs_extra=require(_0x6254('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6254('0x6'));var config=require('../../config/environment');var controller=require(_0x6254('0x7'));router['get'](_0x6254('0x8'),auth['isAuthenticated'](),controller[_0x6254('0x9')]);router[_0x6254('0xa')](_0x6254('0x8'),auth['isAuthenticated'](),controller[_0x6254('0xb')]);router['delete']('/:id',auth[_0x6254('0xc')](),controller[_0x6254('0xd')]);module[_0x6254('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f99fbb8..eda46f8 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 _0xa556=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x5bf81f,_0xf3e669){var _0x51a14c=function(_0x48ca9e){while(--_0x48ca9e){_0x5bf81f['push'](_0x5bf81f['shift']());}};_0x51a14c(++_0xf3e669);}(_0xa556,0x1c5));var _0x6a55=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xa556[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x6a55('0x0'));module[_0x6a55('0x1')]={'priority':{'type':Sequelize[_0x6a55('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6a55('0x3')],'defaultValue':_0x6a55('0x4')}}; \ No newline at end of file +var _0x7f98=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x424b49,_0x407b63){var _0x3b33a6=function(_0x2d1315){while(--_0x2d1315){_0x424b49['push'](_0x424b49['shift']());}};_0x3b33a6(++_0x407b63);}(_0x7f98,0xc0));var _0x87f9=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7f98[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x87f9('0x0'));module['exports']={'priority':{'type':Sequelize[_0x87f9('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87f9('0x2')},'appdata':{'type':Sequelize[_0x87f9('0x3')]()},'description':{'type':Sequelize[_0x87f9('0x4')]},'interval':{'type':Sequelize[_0x87f9('0x4')],'defaultValue':_0x87f9('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 27da646..97d30ae 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xe706,0xa3));var _0x6e70=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0xe706[_0x4a82ac];return _0x58ee97;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3a8dc0,_0x3d2ed7){var _0x3c666f=function(_0x3b706c){while(--_0x3b706c){_0x3a8dc0['push'](_0x3a8dc0['shift']());}};_0x3c666f(++_0x3d2ed7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5eebe3,_0x4442bb){_0x5eebe3=_0x5eebe3-0x0;var _0x2e02e9=_0xf4eb[_0x5eebe3];return _0x2e02e9;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index aaa61b9..1047a3f 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 _0x9032=['utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x543cd6,_0xfb6a82){var _0xf2764d=function(_0x33b78b){while(--_0x33b78b){_0x543cd6['push'](_0x543cd6['shift']());}};_0xf2764d(++_0xfb6a82);}(_0x9032,0x115));var _0x2903=function(_0x5a3836,_0x4fd915){_0x5a3836=_0x5a3836-0x0;var _0x1bb8c3=_0x9032[_0x5a3836];return _0x1bb8c3;};'use strict';var _=require(_0x2903('0x0'));var util=require(_0x2903('0x1'));var logger=require('../../config/logger')(_0x2903('0x2'));var moment=require('moment');var BPromise=require(_0x2903('0x3'));var rp=require(_0x2903('0x4'));var fs=require('fs');var path=require(_0x2903('0x5'));var rimraf=require(_0x2903('0x6'));var config=require(_0x2903('0x7'));var attributes=require(_0x2903('0x8'));module['exports']=function(_0x53f7a5,_0x28c6c0){return _0x53f7a5[_0x2903('0x9')](_0x2903('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2903('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2072=['util','api','moment','path','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x8e3d9e,_0xc5a097){var _0x15fe37=function(_0x1eda5b){while(--_0x1eda5b){_0x8e3d9e['push'](_0x8e3d9e['shift']());}};_0x15fe37(++_0xc5a097);}(_0x2072,0x197));var _0x2207=function(_0x1c322f,_0x3ba8e9){_0x1c322f=_0x1c322f-0x0;var _0x318f79=_0x2072[_0x1c322f];return _0x318f79;};'use strict';var _=require(_0x2207('0x0'));var util=require(_0x2207('0x1'));var logger=require('../../config/logger')(_0x2207('0x2'));var moment=require(_0x2207('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2207('0x4'));var rimraf=require('rimraf');var config=require(_0x2207('0x5'));var attributes=require(_0x2207('0x6'));module[_0x2207('0x7')]=function(_0x34662d,_0x1a169e){return _0x34662d['define'](_0x2207('0x8'),attributes,{'tableName':_0x2207('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2207('0xa'),'collate':_0x2207('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ac8a557..a94a06a 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 _0xb494=['update','options','raw','where','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb494,0x69));var _0x4b49=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xb494[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0x4b49('0x0'));var util=require(_0x4b49('0x1'));var moment=require(_0x4b49('0x2'));var BPromise=require(_0x4b49('0x3'));var rs=require(_0x4b49('0x4'));var fs=require('fs');var Redis=require(_0x4b49('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b49('0x6'));var logger=require(_0x4b49('0x7'))(_0x4b49('0x8'));var config=require(_0x4b49('0x9'));var jayson=require(_0x4b49('0xa'));var client=jayson[_0x4b49('0xb')][_0x4b49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51a846,_0x1a2eb9,_0x306e34){return new BPromise(function(_0x3e3b9b,_0x218577){return client[_0x4b49('0xd')](_0x51a846,_0x306e34)[_0x4b49('0xe')](function(_0x2a9351){logger[_0x4b49('0xf')](_0x4b49('0x10'),_0x1a2eb9,_0x4b49('0x11'));logger[_0x4b49('0x12')](_0x4b49('0x13'),_0x1a2eb9,_0x4b49('0x11'),JSON[_0x4b49('0x14')](_0x2a9351));if(_0x2a9351[_0x4b49('0x15')]){if(_0x2a9351[_0x4b49('0x15')][_0x4b49('0x16')]===0x1f4){logger['error'](_0x4b49('0x10'),_0x1a2eb9,_0x2a9351[_0x4b49('0x15')][_0x4b49('0x17')]);return _0x218577(_0x2a9351[_0x4b49('0x15')][_0x4b49('0x17')]);}logger['error'](_0x4b49('0x10'),_0x1a2eb9,_0x2a9351[_0x4b49('0x15')][_0x4b49('0x17')]);return _0x3e3b9b(_0x2a9351[_0x4b49('0x15')][_0x4b49('0x17')]);}else{logger[_0x4b49('0xf')](_0x4b49('0x10'),_0x1a2eb9,_0x4b49('0x11'));_0x3e3b9b(_0x2a9351[_0x4b49('0x18')]['message']);}})['catch'](function(_0x3915b3){logger[_0x4b49('0x15')]('MailApplication,\x20%s,\x20%s',_0x1a2eb9,_0x3915b3);_0x218577(_0x3915b3);});});}exports[_0x4b49('0x19')]=function(_0x55f205){var _0x5a591a=this;return new Promise(function(_0xcdcc2,_0xc4025e){return db[_0x4b49('0x1a')][_0x4b49('0x1b')](_0x55f205['body'],{'raw':_0x55f205[_0x4b49('0x1c')]?_0x55f205['options'][_0x4b49('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55f205[_0x4b49('0x1c')]?_0x55f205['options'][_0x4b49('0x1e')]||null:null,'attributes':_0x55f205[_0x4b49('0x1c')]?_0x55f205[_0x4b49('0x1c')]['attributes']||null:null,'limit':_0x55f205[_0x4b49('0x1c')]?_0x55f205['options'][_0x4b49('0x1f')]||null:null})['then'](function(_0x9c0c25){logger[_0x4b49('0xf')](_0x4b49('0x19'),_0x55f205);logger['debug'](_0x4b49('0x19'),_0x55f205,JSON[_0x4b49('0x14')](_0x9c0c25));_0xcdcc2(_0x9c0c25);})[_0x4b49('0x20')](function(_0x5d83b8){logger[_0x4b49('0x15')](_0x4b49('0x19'),_0x5d83b8[_0x4b49('0x17')],_0x55f205);_0xc4025e(_0x5a591a[_0x4b49('0x15')](0x1f4,_0x5d83b8['message']));});});}; \ No newline at end of file +var _0xa71a=['request','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','info','catch','UpdateMailApplication','update','body','options','raw','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x29a986,_0x18d77d){var _0xd4a8a4=function(_0x508a12){while(--_0x508a12){_0x29a986['push'](_0x29a986['shift']());}};_0xd4a8a4(++_0x18d77d);}(_0xa71a,0xf1));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var moment=require(_0xaa71('0x2'));var BPromise=require(_0xaa71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa71('0x4'));var db=require(_0xaa71('0x5'))['db'];var utils=require(_0xaa71('0x6'));var logger=require('../../config/logger')(_0xaa71('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa71('0x8'));var client=jayson[_0xaa71('0x9')][_0xaa71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5893aa,_0x274dce,_0x35b8cf){return new BPromise(function(_0x5a0dca,_0x50ad8f){return client[_0xaa71('0xb')](_0x5893aa,_0x35b8cf)[_0xaa71('0xc')](function(_0xc26148){logger['info']('MailApplication,\x20%s,\x20%s',_0x274dce,_0xaa71('0xd'));logger[_0xaa71('0xe')](_0xaa71('0xf'),_0x274dce,_0xaa71('0xd'),JSON[_0xaa71('0x10')](_0xc26148));if(_0xc26148[_0xaa71('0x11')]){if(_0xc26148['error']['code']===0x1f4){logger['error'](_0xaa71('0x12'),_0x274dce,_0xc26148[_0xaa71('0x11')][_0xaa71('0x13')]);return _0x50ad8f(_0xc26148['error'][_0xaa71('0x13')]);}logger[_0xaa71('0x11')](_0xaa71('0x12'),_0x274dce,_0xc26148[_0xaa71('0x11')][_0xaa71('0x13')]);return _0x5a0dca(_0xc26148[_0xaa71('0x11')]['message']);}else{logger[_0xaa71('0x14')](_0xaa71('0x12'),_0x274dce,_0xaa71('0xd'));_0x5a0dca(_0xc26148['result'][_0xaa71('0x13')]);}})[_0xaa71('0x15')](function(_0x25a7ac){logger[_0xaa71('0x11')](_0xaa71('0x12'),_0x274dce,_0x25a7ac);_0x50ad8f(_0x25a7ac);});});}exports[_0xaa71('0x16')]=function(_0x42405c){var _0x3f043a=this;return new Promise(function(_0x1d8dc1,_0x3b4612){return db['MailApplication'][_0xaa71('0x17')](_0x42405c[_0xaa71('0x18')],{'raw':_0x42405c[_0xaa71('0x19')]?_0x42405c[_0xaa71('0x19')][_0xaa71('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42405c['options']?_0x42405c[_0xaa71('0x19')]['where']||null:null,'attributes':_0x42405c[_0xaa71('0x19')]?_0x42405c[_0xaa71('0x19')][_0xaa71('0x1b')]||null:null,'limit':_0x42405c[_0xaa71('0x19')]?_0x42405c[_0xaa71('0x19')]['limit']||null:null})['then'](function(_0x101db9){logger['info'](_0xaa71('0x16'),_0x42405c);logger[_0xaa71('0xe')](_0xaa71('0x16'),_0x42405c,JSON[_0xaa71('0x10')](_0x101db9));_0x1d8dc1(_0x101db9);})[_0xaa71('0x15')](function(_0xc64960){logger[_0xaa71('0x11')](_0xaa71('0x16'),_0xc64960[_0xaa71('0x13')],_0x42405c);_0x3b4612(_0x3f043a[_0xaa71('0x11')](0x1f4,_0xc64960[_0xaa71('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1c996a9..5e12020 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 _0x364b=['mailinteraction:addtags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','create','/:id/messages','/:id/tags','tracked','mail'];(function(_0x119c38,_0x167153){var _0x51abb8=function(_0x402dcf){while(--_0x402dcf){_0x119c38['push'](_0x119c38['shift']());}};_0x51abb8(++_0x167153);}(_0x364b,0x140));var _0xb364=function(_0x480843,_0x8121e6){_0x480843=_0x480843-0x0;var _0x1d5cd9=_0x364b[_0x480843];return _0x1d5cd9;};'use strict';var express=require(_0xb364('0x0'));var router=express[_0xb364('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xb364('0x2'));var controller=require(_0xb364('0x3'));router[_0xb364('0x4')]('/',auth[_0xb364('0x5')](),controller['index']);router[_0xb364('0x4')](_0xb364('0x6'),auth[_0xb364('0x5')](),controller[_0xb364('0x7')]);router[_0xb364('0x4')](_0xb364('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb364('0x4')]('/:id/messages',auth[_0xb364('0x5')](),controller['getMessages']);router[_0xb364('0x4')](_0xb364('0x9'),auth[_0xb364('0x5')](),controller[_0xb364('0xa')]);router['post']('/',auth[_0xb364('0x5')](),controller[_0xb364('0xb')]);router['post'](_0xb364('0xc'),auth[_0xb364('0x5')](),controller['addMessage']);router['post'](_0xb364('0xd'),auth[_0xb364('0x5')](),interaction[_0xb364('0xe')](_0xb364('0xf'),_0xb364('0x10')),controller['addTags']);router[_0xb364('0x11')](_0xb364('0x8'),auth[_0xb364('0x5')](),interaction[_0xb364('0xe')](_0xb364('0xf'),'mailinteraction:update'),controller[_0xb364('0x12')]);router[_0xb364('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0xb364('0xe')](_0xb364('0xf'),_0xb364('0x14')),controller[_0xb364('0x15')]);router[_0xb364('0x13')](_0xb364('0xd'),auth['isAuthenticated'](),controller[_0xb364('0x16')]);module[_0xb364('0x17')]=router; \ No newline at end of file +var _0xf17d=['describe','isAuthenticated','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update','mail','mailinteraction:destroy','delete','removeTags','express','Router','../../components/auth/service','./mailInteraction.controller','index','get'];(function(_0x100705,_0x27070c){var _0x394c7a=function(_0x22710e){while(--_0x22710e){_0x100705['push'](_0x100705['shift']());}};_0x394c7a(++_0x27070c);}(_0xf17d,0x162));var _0xdf17=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf17d[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0xdf17('0x0'));var router=express[_0xdf17('0x1')]();var auth=require(_0xdf17('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xdf17('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xdf17('0x4')]);router[_0xdf17('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xdf17('0x6')]);router['get']('/:id',auth[_0xdf17('0x7')](),controller['show']);router[_0xdf17('0x5')](_0xdf17('0x8'),auth['isAuthenticated'](),controller[_0xdf17('0x9')]);router['get'](_0xdf17('0xa'),auth[_0xdf17('0x7')](),controller['download']);router[_0xdf17('0xb')]('/',auth[_0xdf17('0x7')](),controller['create']);router[_0xdf17('0xb')](_0xdf17('0x8'),auth[_0xdf17('0x7')](),controller[_0xdf17('0xc')]);router['post'](_0xdf17('0xd'),auth[_0xdf17('0x7')](),interaction[_0xdf17('0xe')]('mail',_0xdf17('0xf')),controller[_0xdf17('0x10')]);router['put'](_0xdf17('0x11'),auth[_0xdf17('0x7')](),interaction[_0xdf17('0xe')]('mail',_0xdf17('0x12')),controller[_0xdf17('0x13')]);router['delete'](_0xdf17('0x11'),auth[_0xdf17('0x7')](),interaction['tracked'](_0xdf17('0x14'),_0xdf17('0x15')),controller['destroy']);router[_0xdf17('0x16')](_0xdf17('0xd'),auth['isAuthenticated'](),controller[_0xdf17('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5f61090..250f106 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 _0x6276=['iconv','BOOLEAN','STRING','TEXT','DATE','ENUM','out','INTEGER'];(function(_0x1b4a9e,_0x1833a7){var _0x43a962=function(_0x3fd02a){while(--_0x3fd02a){_0x1b4a9e['push'](_0x1b4a9e['shift']());}};_0x43a962(++_0x1833a7);}(_0x6276,0x1a0));var _0x6627=function(_0x44b2f7,_0xf30295){_0x44b2f7=_0x44b2f7-0x0;var _0x315bf1=_0x6276[_0x44b2f7];return _0x315bf1;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x6627('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6627('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6627('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6627('0x2')]},'note':{'type':Sequelize[_0x6627('0x2')]},'inReplyTo':{'type':Sequelize[_0x6627('0x2')](0x1fe)},'to':{'type':Sequelize[_0x6627('0x2')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x6627('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x6627('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6627('0x5')]('in',_0x6627('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6627('0x5')]('in',_0x6627('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6627('0x7')]}}; \ No newline at end of file +var _0x8799=['INTEGER','sequelize','exports','BOOLEAN','STRING','TEXT','ENUM','out'];(function(_0x22e2e5,_0x478c6a){var _0x6aff9c=function(_0x3aed65){while(--_0x3aed65){_0x22e2e5['push'](_0x22e2e5['shift']());}};_0x6aff9c(++_0x478c6a);}(_0x8799,0x181));var _0x9879=function(_0x593cb7,_0x49fc59){_0x593cb7=_0x593cb7-0x0;var _0x3ff41b=_0x8799[_0x593cb7];return _0x3ff41b;};'use strict';var Sequelize=require(_0x9879('0x0'));var iconv=require('iconv');module[_0x9879('0x1')]={'closed':{'type':Sequelize[_0x9879('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9879('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9879('0x3')]},'note':{'type':Sequelize[_0x9879('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9879('0x3')]},'cc':{'type':Sequelize[_0x9879('0x4')]('long')},'subject':{'type':Sequelize[_0x9879('0x4')]()},'attach':{'type':Sequelize[_0x9879('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x9879('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9879('0x5')]('in',_0x9879('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9879('0x5')]('in',_0x9879('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9879('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9879('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fe5565b..0744f39 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 _0xf779=['keys','filters','attributes','intersection','fields','length','includeAll','include','merge','create','body','describe','addMessage','MailMessage','find','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','format','options','inlineCss','true','addTags','setTags','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','type','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','index','map','MailInteraction','rawAttributes','key','getOptions','findAll','mail','query','user','catch','show','params','model'];(function(_0xf2472b,_0x5ce664){var _0x97def6=function(_0x68cd03){while(--_0x68cd03){_0xf2472b['push'](_0xf2472b['shift']());}};_0x97def6(++_0x5ce664);}(_0xf779,0x19c));var _0x9f77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf779[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f77('0x0'));var rimraf=require(_0x9f77('0x1'));var zipdir=require(_0x9f77('0x2'));var moment=require(_0x9f77('0x3'));var BPromise=require(_0x9f77('0x4'));var util=require(_0x9f77('0x5'));var path=require(_0x9f77('0x6'));var fs=require('fs');var _=require(_0x9f77('0x7'));var juice=require(_0x9f77('0x8'));var Redis=require(_0x9f77('0x9'));var interaction=require(_0x9f77('0xa'));var qs=require(_0x9f77('0xb'));var logger=require(_0x9f77('0xc'))(_0x9f77('0xd'));var config=require(_0x9f77('0xe'));var db=require(_0x9f77('0xf'))['db'];var htmlEntities=require(_0x9f77('0x10'));config[_0x9f77('0x11')]=_[_0x9f77('0x12')](config[_0x9f77('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f77('0x13'))(new Redis(config[_0x9f77('0x11')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1caf0a,_0x121ab7){_0x121ab7=_0x121ab7||0xcc;return function(_0x31a00f){if(_0x31a00f){return _0x1caf0a[_0x9f77('0x14')](_0x121ab7);}return _0x1caf0a[_0x9f77('0x15')](_0x121ab7)['end']();};}function respondWithResult(_0x4e3c7b,_0x16833f){_0x16833f=_0x16833f||0xc8;return function(_0x562b46){if(_0x562b46){return _0x4e3c7b[_0x9f77('0x15')](_0x16833f)[_0x9f77('0x16')](_0x562b46);}};}function respondWithFilteredResult(_0x30019d,_0x2634b2){return function(_0x2ac072){if(_0x2ac072){var _0x5da4d7=typeof _0x2634b2[_0x9f77('0x17')]===_0x9f77('0x18')&&typeof _0x2634b2['limit']===_0x9f77('0x18');var _0x592eeb=_0x2ac072[_0x9f77('0x19')];var _0x3b8520=_0x5da4d7?0x0:_0x2634b2['offset'];var _0x26c070=_0x5da4d7?_0x2ac072[_0x9f77('0x19')]:_0x2634b2['offset']+_0x2634b2[_0x9f77('0x1a')];var _0x2edbab;if(_0x26c070>=_0x592eeb){_0x26c070=_0x592eeb;_0x2edbab=0xc8;}else{_0x2edbab=0xce;}_0x30019d[_0x9f77('0x15')](_0x2edbab);return _0x30019d[_0x9f77('0x1b')](_0x9f77('0x1c'),_0x3b8520+'-'+_0x26c070+'/'+_0x592eeb)[_0x9f77('0x16')](_0x2ac072);}return null;};}function saveUpdates(_0x1d0b54){return function(_0x2570dc){if(_0x2570dc){return _0x2570dc[_0x9f77('0x1d')](_0x1d0b54)[_0x9f77('0x1e')](function(_0x2f9320){return _0x2f9320;});}return null;};}function removeEntity(_0x7d3878){return function(_0x585397){if(_0x585397){return _0x585397[_0x9f77('0x1f')]()[_0x9f77('0x1e')](function(){_0x7d3878['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d34a){return function(_0x2f3748){if(!_0x2f3748){_0x45d34a[_0x9f77('0x14')](0x194);}return _0x2f3748;};}function handleError(_0x473562,_0x5ca34f){_0x5ca34f=_0x5ca34f||0x1f4;return function(_0x2ec10e){logger['error'](_0x2ec10e[_0x9f77('0x20')]);if(_0x2ec10e[_0x9f77('0x21')]){delete _0x2ec10e[_0x9f77('0x21')];}_0x473562['status'](_0x5ca34f)['send'](_0x2ec10e);};}exports[_0x9f77('0x22')]=function(_0x244aaf,_0x83f124){var _0x17b2cc={};var _0x48aea2=_[_0x9f77('0x23')](db[_0x9f77('0x24')][_0x9f77('0x25')],function(_0x51104c){return{'name':_0x51104c['fieldName'],'type':_0x51104c['type'][_0x9f77('0x26')]};});_0x17b2cc=qs[_0x9f77('0x27')](_0x48aea2,_0x244aaf);return interaction[_0x9f77('0x28')](_0x9f77('0x29'),_0x244aaf[_0x9f77('0x2a')],_0x244aaf[_0x9f77('0x2b')],_0x17b2cc,_0x48aea2)[_0x9f77('0x1e')](respondWithFilteredResult(_0x83f124,_0x17b2cc))[_0x9f77('0x2c')](handleError(_0x83f124,null));};exports[_0x9f77('0x2d')]=function(_0x490151,_0x160362){var _0x4425e0={'raw':![],'where':{'id':_0x490151[_0x9f77('0x2e')]['id']}},_0x116759={};_0x116759[_0x9f77('0x2f')]=_[_0x9f77('0x30')](db[_0x9f77('0x24')]['rawAttributes']);_0x116759[_0x9f77('0x2a')]=_[_0x9f77('0x30')](_0x490151['query']);_0x116759[_0x9f77('0x31')]=_['intersection'](_0x116759['model'],_0x116759[_0x9f77('0x2a')]);_0x4425e0[_0x9f77('0x32')]=_[_0x9f77('0x33')](_0x116759[_0x9f77('0x2f')],qs[_0x9f77('0x34')](_0x490151[_0x9f77('0x2a')][_0x9f77('0x34')]));_0x4425e0[_0x9f77('0x32')]=_0x4425e0[_0x9f77('0x32')][_0x9f77('0x35')]?_0x4425e0['attributes']:_0x116759[_0x9f77('0x2f')];if(_0x490151[_0x9f77('0x2a')][_0x9f77('0x36')]){_0x4425e0[_0x9f77('0x37')]=[{'all':!![]}];}_0x4425e0=_[_0x9f77('0x38')]({},_0x4425e0,_0x490151['options']);return db[_0x9f77('0x24')]['find'](_0x4425e0)[_0x9f77('0x1e')](handleEntityNotFound(_0x160362,null))[_0x9f77('0x1e')](respondWithResult(_0x160362,null))[_0x9f77('0x2c')](handleError(_0x160362,null));};exports[_0x9f77('0x39')]=function(_0x25fd34,_0x14f666){return db[_0x9f77('0x24')][_0x9f77('0x39')](_0x25fd34[_0x9f77('0x3a')],{})[_0x9f77('0x1e')](respondWithResult(_0x14f666,0xc9))['catch'](handleError(_0x14f666,null));};exports[_0x9f77('0x1d')]=function(_0x375b86,_0x15f217){if(_0x375b86[_0x9f77('0x3a')]['id']){delete _0x375b86[_0x9f77('0x3a')]['id'];}return db[_0x9f77('0x24')]['find']({'where':{'id':_0x375b86[_0x9f77('0x2e')]['id']}})['then'](handleEntityNotFound(_0x15f217,null))['then'](saveUpdates(_0x375b86[_0x9f77('0x3a')],null))[_0x9f77('0x1e')](respondWithResult(_0x15f217,null))[_0x9f77('0x2c')](handleError(_0x15f217,null));};exports[_0x9f77('0x1f')]=function(_0x24d98d,_0x3c7066){return db[_0x9f77('0x24')]['find']({'where':{'id':_0x24d98d['params']['id']}})[_0x9f77('0x1e')](handleEntityNotFound(_0x3c7066,null))[_0x9f77('0x1e')](removeEntity(_0x3c7066,null))[_0x9f77('0x2c')](handleError(_0x3c7066,null));};exports['describe']=function(_0x411929,_0x302841){return db[_0x9f77('0x24')][_0x9f77('0x3b')]()[_0x9f77('0x1e')](respondWithResult(_0x302841,null))[_0x9f77('0x2c')](handleError(_0x302841,null));};exports[_0x9f77('0x3c')]=function(_0x3fc0fd,_0x366010){return db[_0x9f77('0x3d')][_0x9f77('0x3e')]({'where':{'id':_0x3fc0fd[_0x9f77('0x2e')]['id']}})[_0x9f77('0x1e')](handleEntityNotFound(_0x366010,null))[_0x9f77('0x1e')](function(_0x9e35fc){if(_0x9e35fc){return _0x9e35fc[_0x9f77('0x3c')](_0x3fc0fd[_0x9f77('0x3a')]['ids'],_[_0x9f77('0x3f')](_0x3fc0fd['body'],[_0x9f77('0x40'),'id'])||{});}})['then'](respondWithResult(_0x366010,null))['catch'](handleError(_0x366010,null));};exports[_0x9f77('0x41')]=function(_0x23ce23,_0x577550){var _0x3be847={'raw':![],'where':{}};var _0x517376={};var _0x194e51={'count':0x0,'rows':[]};return db[_0x9f77('0x24')][_0x9f77('0x42')]({'where':{'id':_0x23ce23[_0x9f77('0x2e')]['id']}})[_0x9f77('0x1e')](handleEntityNotFound(_0x577550,null))[_0x9f77('0x1e')](function(_0x178fdf){if(_0x178fdf){_0x517376[_0x9f77('0x2f')]=_[_0x9f77('0x30')](db[_0x9f77('0x3d')]['rawAttributes']);_0x517376[_0x9f77('0x2a')]=_['keys'](_0x23ce23['query']);_0x517376[_0x9f77('0x31')]=_['intersection'](_0x517376['model'],_0x517376['query']);_0x3be847[_0x9f77('0x32')]=_[_0x9f77('0x33')](_0x517376[_0x9f77('0x2f')],qs[_0x9f77('0x34')](_0x23ce23[_0x9f77('0x2a')]['fields']));_0x3be847[_0x9f77('0x32')]=_0x3be847[_0x9f77('0x32')][_0x9f77('0x35')]?_0x3be847[_0x9f77('0x32')]:_0x517376[_0x9f77('0x2f')];if(!_0x23ce23['query'][_0x9f77('0x43')](_0x9f77('0x44'))){_0x3be847[_0x9f77('0x1a')]=qs['limit'](_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x1a')]);_0x3be847['offset']=qs[_0x9f77('0x17')](_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x17')]);}_0x3be847[_0x9f77('0x45')]=qs[_0x9f77('0x46')](_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x46')]);_0x3be847['where']=qs[_0x9f77('0x31')](_[_0x9f77('0x47')](_0x23ce23['query'],_0x517376[_0x9f77('0x31')]));_0x3be847[_0x9f77('0x48')]['MailInteractionId']=_0x178fdf['id'];if(_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x49')]){_0x3be847['where']=_[_0x9f77('0x38')](_0x3be847[_0x9f77('0x48')],{'$or':_[_0x9f77('0x23')](_0x3be847[_0x9f77('0x32')],function(_0x4e1333){var _0x3865b4={};_0x3865b4[_0x4e1333]={'$like':'%'+_0x23ce23[_0x9f77('0x2a')]['filter']+'%'};return _0x3865b4;})});}if(_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x4a')]){var _0x5d86f3=_0x23ce23[_0x9f77('0x2a')]['$gte'][_0x9f77('0x4b')](',');var _0x1d741d={};_0x1d741d[_0x5d86f3[0x0]]={'$gte':moment(_0x5d86f3[0x1])[_0x9f77('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3be847[_0x9f77('0x48')]=_['merge'](_0x3be847['where'],_0x1d741d);}_0x3be847=_[_0x9f77('0x38')]({},_0x3be847,_0x23ce23[_0x9f77('0x4d')]);return db[_0x9f77('0x3d')][_0x9f77('0x19')]({'where':_0x3be847['where']})['then'](function(_0x21b2f0){_0x194e51['count']=_0x21b2f0;if(_0x23ce23['query'][_0x9f77('0x36')]){_0x3be847['include']=[{'all':!![]}];}return db[_0x9f77('0x3d')]['findAll'](_0x3be847);})[_0x9f77('0x1e')](function(_0x2cbaff){if(_0x23ce23[_0x9f77('0x2a')][_0x9f77('0x4e')]===_0x9f77('0x4f')){for(var _0x227441=0x0;_0x227441<_0x2cbaff['length'];_0x227441++){_0x2cbaff[_0x227441]['body']=juice(_0x2cbaff[_0x227441][_0x9f77('0x3a')]);}}_0x194e51['rows']=_0x2cbaff;return _0x194e51;});}})[_0x9f77('0x1e')](respondWithFilteredResult(_0x577550,_0x3be847))['catch'](handleError(_0x577550,null));};exports[_0x9f77('0x50')]=function(_0x4e3c16,_0x27143a){return db['MailInteraction']['find']({'where':{'id':_0x4e3c16[_0x9f77('0x2e')]['id']}})['then'](handleEntityNotFound(_0x27143a,null))[_0x9f77('0x1e')](function(_0x4deeb8){if(_0x4deeb8){return _0x4deeb8[_0x9f77('0x51')](_0x4e3c16[_0x9f77('0x3a')][_0x9f77('0x40')],_[_0x9f77('0x3f')](_0x4e3c16['body'],[_0x9f77('0x40'),'id'])||{})['spread'](function(){return db[_0x9f77('0x52')][_0x9f77('0x28')]({'attributes':['id',_0x9f77('0x21'),'color'],'where':{'id':_0x4e3c16['body']['ids']}});})[_0x9f77('0x1e')](function(_0x4ad80d){socket[_0x9f77('0x53')](_0x9f77('0x54'),{'id':Number(_0x4e3c16[_0x9f77('0x2e')]['id']),'tags':_0x4ad80d||[]});return{'id':Number(_0x4e3c16[_0x9f77('0x2e')]['id']),'tags':_0x4ad80d||[]};});}})[_0x9f77('0x1e')](respondWithResult(_0x27143a,null))[_0x9f77('0x2c')](handleError(_0x27143a,null));};exports['removeTags']=function(_0x3133ce,_0x32015e){return db[_0x9f77('0x24')][_0x9f77('0x3e')]({'where':{'id':_0x3133ce[_0x9f77('0x2e')]['id']}})[_0x9f77('0x1e')](handleEntityNotFound(_0x32015e,null))['then'](function(_0x2d58bb){if(_0x2d58bb){return _0x2d58bb[_0x9f77('0x55')](_0x3133ce[_0x9f77('0x2a')][_0x9f77('0x40')]);}})[_0x9f77('0x1e')](respondWithStatusCode(_0x32015e,null))[_0x9f77('0x2c')](handleError(_0x32015e,null));};exports[_0x9f77('0x56')]=function(_0x3a192f,_0x182cd2){var _0x3a2977=moment()[_0x9f77('0x57')]()[_0x9f77('0x58')]();var _0x5d0044=path[_0x9f77('0x59')](config[_0x9f77('0x5a')],_0x9f77('0x5b'),_0x9f77('0x5c'),_0x9f77('0x5d'));var _0x534fb0=path[_0x9f77('0x59')](config[_0x9f77('0x5a')],_0x9f77('0x5b'),_0x9f77('0x5c'),_0x9f77('0x5e'));var _0x4cf1c1=path['join'](_0x5d0044,_0x3a2977);var _0x1f0d14=util['format']('transcript-%d-%s.zip',_0x3a192f[_0x9f77('0x2e')]['id'],_0x3a2977);var _0x467fbb=path[_0x9f77('0x59')](_0x5d0044,_0x1f0d14);var _0x4f3bbe=[];if(_0x3a192f['query'][_0x9f77('0x5e')]){_0x4f3bbe[_0x9f77('0x5f')]({'model':db[_0x9f77('0x60')],'as':_0x9f77('0x61'),'raw':!![]});}var _0x38137b=[{'model':db[_0x9f77('0x3d')],'as':_0x9f77('0x62'),'attributes':['id','body',_0x9f77('0x63'),'to','cc',_0x9f77('0x64'),_0x9f77('0x65'),_0x9f77('0x66')],'where':{'secret':![]},'order':qs[_0x9f77('0x46')]('id'),'include':_0x4f3bbe}];return db['MailInteraction'][_0x9f77('0x3e')]({'where':{'id':_0x3a192f[_0x9f77('0x2e')]['id']},'include':_0x38137b})['then'](handleEntityNotFound(_0x182cd2,null))[_0x9f77('0x1e')](function(_0x3b99e1){if(_0x3b99e1&&_0x3b99e1[_0x9f77('0x62')]){var _0x2b7bc5=_0x3b99e1[_0x9f77('0x67')]({'plain':!![]});fs['mkdirSync'](_0x4cf1c1);return BPromise[_0x9f77('0x68')](_0x2b7bc5[_0x9f77('0x62')],function(_0x52f1e2,_0x5f0fa4){var _0x3031f8={'from':_0x52f1e2[_0x9f77('0x63')],'to':_0x52f1e2['to']||'missing.recipient@your.company.com','subject':_0x52f1e2[_0x9f77('0x65')],'html':htmlEntities[_0x9f77('0x69')](_0x52f1e2[_0x9f77('0x3a')]),'headers':{'Date':moment(_0x52f1e2['createdAt'])[_0x9f77('0x4c')](_0x9f77('0x6a'))},'attachments':[]};if(_0x52f1e2['cc']){_0x3031f8[_0x9f77('0x6b')]['Cc']=_0x52f1e2['cc'];}if(_0x52f1e2['bcc']){_0x3031f8[_0x9f77('0x6b')][_0x9f77('0x6c')]=_0x52f1e2['bcc'];}return new BPromise(function(_0x46067b,_0xbbced1){if(_0x52f1e2[_0x9f77('0x61')]){for(var _0x47610=0x0;_0x47610<_0x52f1e2['Attachments'][_0x9f77('0x35')];_0x47610++){var _0x3c737b=_0x52f1e2[_0x9f77('0x61')][_0x47610];var _0x2c6116=path['join'](_0x534fb0,_0x3c737b[_0x9f77('0x6d')]);if(fs['existsSync'](_0x2c6116)){_0x3031f8['attachments'][_0x9f77('0x5f')]({'name':_0x3c737b[_0x9f77('0x21')],'contentType':_0x3c737b[_0x9f77('0x6e')],'data':fs[_0x9f77('0x6f')](_0x2c6116)});}}}emlformat['build'](_0x3031f8,function(_0x5900ab,_0x303995){if(_0x5900ab)return _0xbbced1(_0x5900ab);fs[_0x9f77('0x70')](path[_0x9f77('0x59')](_0x4cf1c1,util['format'](_0x9f77('0x71'),_0x5f0fa4)),_0x303995);return _0x46067b(_0x303995);});});})[_0x9f77('0x1e')](function(){return new BPromise(function(_0x5a3e39,_0x2e5117){zipdir(_0x4cf1c1,{'saveTo':_0x467fbb},function(_0x2061f5,_0x5de847){if(_0x2061f5)return _0x2e5117(_0x2061f5);return _0x5a3e39(_0x5de847);});})[_0x9f77('0x1e')](function(){return new BPromise(function(_0x55a4f5,_0x476820){rimraf(_0x4cf1c1,function(_0x18b6b6){if(_0x18b6b6)_0x476820(_0x18b6b6);return _0x55a4f5();});});})['then'](function(){return _0x182cd2[_0x9f77('0x56')](_0x467fbb,_0x1f0d14,function(_0x2650ff){if(!_0x2650ff)fs[_0x9f77('0x72')](_0x467fbb);});});});}else{return _0x182cd2['sendStatus'](0xc8);}})[_0x9f77('0x2c')](handleError(_0x182cd2,null));}; \ No newline at end of file +var _0x3504=['unlinkSync','eml-format','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','api','../../mysqldb','html-entities','redis','socket.io-emitter','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','update','describe','addMessage','ids','omit','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','includeAll','include','inlineCss','true','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','files','join','attachments','transcript-%d-%s.zip','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','message%d.eml'];(function(_0x29b431,_0x304523){var _0xed42c6=function(_0x543fb1){while(--_0x543fb1){_0x29b431['push'](_0x29b431['shift']());}};_0xed42c6(++_0x304523);}(_0x3504,0x151));var _0x4350=function(_0x512693,_0x1ba29a){_0x512693=_0x512693-0x0;var _0x132217=_0x3504[_0x512693];return _0x132217;};'use strict';var emlformat=require(_0x4350('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x4350('0x1'));var BPromise=require(_0x4350('0x2'));var util=require(_0x4350('0x3'));var path=require(_0x4350('0x4'));var fs=require('fs');var _=require(_0x4350('0x5'));var juice=require(_0x4350('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x4350('0x7'));var logger=require('../../config/logger')(_0x4350('0x8'));var config=require('../../config/environment');var db=require(_0x4350('0x9'))['db'];var htmlEntities=require(_0x4350('0xa'));config[_0x4350('0xb')]=_['defaults'](config[_0x4350('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4350('0xc'))(new Redis(config[_0x4350('0xb')]));require('./mailInteraction.socket')[_0x4350('0xd')](socket);function respondWithStatusCode(_0x155584,_0x3fd24d){_0x3fd24d=_0x3fd24d||0xcc;return function(_0x361d86){if(_0x361d86){return _0x155584[_0x4350('0xe')](_0x3fd24d);}return _0x155584['status'](_0x3fd24d)['end']();};}function respondWithResult(_0x4e1d5e,_0x22d30d){_0x22d30d=_0x22d30d||0xc8;return function(_0x17e67f){if(_0x17e67f){return _0x4e1d5e['status'](_0x22d30d)[_0x4350('0xf')](_0x17e67f);}};}function respondWithFilteredResult(_0x2d45eb,_0x291d5f){return function(_0x30ad2c){if(_0x30ad2c){var _0x8968aa=typeof _0x291d5f[_0x4350('0x10')]===_0x4350('0x11')&&typeof _0x291d5f[_0x4350('0x12')]===_0x4350('0x11');var _0x597cf2=_0x30ad2c[_0x4350('0x13')];var _0x550bbd=_0x8968aa?0x0:_0x291d5f[_0x4350('0x10')];var _0x1e5207=_0x8968aa?_0x30ad2c[_0x4350('0x13')]:_0x291d5f[_0x4350('0x10')]+_0x291d5f[_0x4350('0x12')];var _0x926e59;if(_0x1e5207>=_0x597cf2){_0x1e5207=_0x597cf2;_0x926e59=0xc8;}else{_0x926e59=0xce;}_0x2d45eb[_0x4350('0x14')](_0x926e59);return _0x2d45eb[_0x4350('0x15')](_0x4350('0x16'),_0x550bbd+'-'+_0x1e5207+'/'+_0x597cf2)[_0x4350('0xf')](_0x30ad2c);}return null;};}function saveUpdates(_0x1a0701){return function(_0x6c4df0){if(_0x6c4df0){return _0x6c4df0['update'](_0x1a0701)[_0x4350('0x17')](function(_0x5cb95c){return _0x5cb95c;});}return null;};}function removeEntity(_0x26a4b7){return function(_0xf469b5){if(_0xf469b5){return _0xf469b5[_0x4350('0x18')]()[_0x4350('0x17')](function(){_0x26a4b7[_0x4350('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f45c1){return function(_0x7e859a){if(!_0x7e859a){_0x2f45c1[_0x4350('0xe')](0x194);}return _0x7e859a;};}function handleError(_0x418c2f,_0x383efd){_0x383efd=_0x383efd||0x1f4;return function(_0x212695){logger[_0x4350('0x19')](_0x212695['stack']);if(_0x212695['name']){delete _0x212695[_0x4350('0x1a')];}_0x418c2f['status'](_0x383efd)[_0x4350('0x1b')](_0x212695);};}exports[_0x4350('0x1c')]=function(_0x200646,_0x4ead2b){var _0x132925={};var _0x4e0d6e=_[_0x4350('0x1d')](db[_0x4350('0x1e')][_0x4350('0x1f')],function(_0x16ec6d){return{'name':_0x16ec6d[_0x4350('0x20')],'type':_0x16ec6d[_0x4350('0x21')][_0x4350('0x22')]};});_0x132925=qs[_0x4350('0x23')](_0x4e0d6e,_0x200646);return interaction[_0x4350('0x24')](_0x4350('0x25'),_0x200646[_0x4350('0x26')],_0x200646[_0x4350('0x27')],_0x132925,_0x4e0d6e)[_0x4350('0x17')](respondWithFilteredResult(_0x4ead2b,_0x132925))[_0x4350('0x28')](handleError(_0x4ead2b,null));};exports[_0x4350('0x29')]=function(_0x36d11b,_0x3ad4ab){var _0x23daf7={'raw':![],'where':{'id':_0x36d11b[_0x4350('0x2a')]['id']}},_0x4648dc={};_0x4648dc[_0x4350('0x2b')]=_['keys'](db[_0x4350('0x1e')]['rawAttributes']);_0x4648dc[_0x4350('0x26')]=_[_0x4350('0x2c')](_0x36d11b[_0x4350('0x26')]);_0x4648dc[_0x4350('0x2d')]=_[_0x4350('0x2e')](_0x4648dc[_0x4350('0x2b')],_0x4648dc[_0x4350('0x26')]);_0x23daf7[_0x4350('0x2f')]=_[_0x4350('0x2e')](_0x4648dc[_0x4350('0x2b')],qs['fields'](_0x36d11b[_0x4350('0x26')][_0x4350('0x30')]));_0x23daf7[_0x4350('0x2f')]=_0x23daf7[_0x4350('0x2f')]['length']?_0x23daf7[_0x4350('0x2f')]:_0x4648dc[_0x4350('0x2b')];if(_0x36d11b['query']['includeAll']){_0x23daf7['include']=[{'all':!![]}];}_0x23daf7=_[_0x4350('0x31')]({},_0x23daf7,_0x36d11b[_0x4350('0x32')]);return db[_0x4350('0x1e')][_0x4350('0x33')](_0x23daf7)[_0x4350('0x17')](handleEntityNotFound(_0x3ad4ab,null))[_0x4350('0x17')](respondWithResult(_0x3ad4ab,null))[_0x4350('0x28')](handleError(_0x3ad4ab,null));};exports['create']=function(_0x3a6bbc,_0xa5dfdb){return db[_0x4350('0x1e')][_0x4350('0x34')](_0x3a6bbc[_0x4350('0x35')],{})[_0x4350('0x17')](respondWithResult(_0xa5dfdb,0xc9))[_0x4350('0x28')](handleError(_0xa5dfdb,null));};exports[_0x4350('0x36')]=function(_0x4b5357,_0x4737ee){if(_0x4b5357[_0x4350('0x35')]['id']){delete _0x4b5357[_0x4350('0x35')]['id'];}return db[_0x4350('0x1e')][_0x4350('0x33')]({'where':{'id':_0x4b5357[_0x4350('0x2a')]['id']}})[_0x4350('0x17')](handleEntityNotFound(_0x4737ee,null))[_0x4350('0x17')](saveUpdates(_0x4b5357[_0x4350('0x35')],null))['then'](respondWithResult(_0x4737ee,null))[_0x4350('0x28')](handleError(_0x4737ee,null));};exports['destroy']=function(_0xa38f62,_0x564663){return db['MailInteraction'][_0x4350('0x33')]({'where':{'id':_0xa38f62['params']['id']}})['then'](handleEntityNotFound(_0x564663,null))[_0x4350('0x17')](removeEntity(_0x564663,null))[_0x4350('0x28')](handleError(_0x564663,null));};exports[_0x4350('0x37')]=function(_0x59e9c6,_0x2264a2){return db[_0x4350('0x1e')][_0x4350('0x37')]()['then'](respondWithResult(_0x2264a2,null))['catch'](handleError(_0x2264a2,null));};exports['addMessage']=function(_0x5a6768,_0x32c06e){return db['MailMessage'][_0x4350('0x33')]({'where':{'id':_0x5a6768['params']['id']}})[_0x4350('0x17')](handleEntityNotFound(_0x32c06e,null))['then'](function(_0x4634b2){if(_0x4634b2){return _0x4634b2[_0x4350('0x38')](_0x5a6768[_0x4350('0x35')][_0x4350('0x39')],_[_0x4350('0x3a')](_0x5a6768[_0x4350('0x35')],[_0x4350('0x39'),'id'])||{});}})[_0x4350('0x17')](respondWithResult(_0x32c06e,null))[_0x4350('0x28')](handleError(_0x32c06e,null));};exports['getMessages']=function(_0x5f3e87,_0x49cf9f){var _0x42bca2={'raw':![],'where':{}};var _0x15307e={};var _0x40e705={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x5f3e87['params']['id']}})['then'](handleEntityNotFound(_0x49cf9f,null))[_0x4350('0x17')](function(_0x1f7679){if(_0x1f7679){_0x15307e[_0x4350('0x2b')]=_['keys'](db['MailMessage']['rawAttributes']);_0x15307e['query']=_[_0x4350('0x2c')](_0x5f3e87[_0x4350('0x26')]);_0x15307e['filters']=_[_0x4350('0x2e')](_0x15307e[_0x4350('0x2b')],_0x15307e[_0x4350('0x26')]);_0x42bca2[_0x4350('0x2f')]=_['intersection'](_0x15307e['model'],qs[_0x4350('0x30')](_0x5f3e87[_0x4350('0x26')][_0x4350('0x30')]));_0x42bca2[_0x4350('0x2f')]=_0x42bca2['attributes'][_0x4350('0x3b')]?_0x42bca2[_0x4350('0x2f')]:_0x15307e[_0x4350('0x2b')];if(!_0x5f3e87[_0x4350('0x26')][_0x4350('0x3c')](_0x4350('0x3d'))){_0x42bca2[_0x4350('0x12')]=qs[_0x4350('0x12')](_0x5f3e87[_0x4350('0x26')][_0x4350('0x12')]);_0x42bca2[_0x4350('0x10')]=qs[_0x4350('0x10')](_0x5f3e87['query'][_0x4350('0x10')]);}_0x42bca2[_0x4350('0x3e')]=qs['sort'](_0x5f3e87['query'][_0x4350('0x3f')]);_0x42bca2[_0x4350('0x40')]=qs['filters'](_[_0x4350('0x41')](_0x5f3e87[_0x4350('0x26')],_0x15307e[_0x4350('0x2d')]));_0x42bca2[_0x4350('0x40')][_0x4350('0x42')]=_0x1f7679['id'];if(_0x5f3e87[_0x4350('0x26')][_0x4350('0x43')]){_0x42bca2[_0x4350('0x40')]=_['merge'](_0x42bca2['where'],{'$or':_[_0x4350('0x1d')](_0x42bca2[_0x4350('0x2f')],function(_0x10f529){var _0x1a8ad7={};_0x1a8ad7[_0x10f529]={'$like':'%'+_0x5f3e87['query']['filter']+'%'};return _0x1a8ad7;})});}if(_0x5f3e87['query']['$gte']){var _0xd9758=_0x5f3e87[_0x4350('0x26')][_0x4350('0x44')][_0x4350('0x45')](',');var _0x1ee1f9={};_0x1ee1f9[_0xd9758[0x0]]={'$gte':moment(_0xd9758[0x1])[_0x4350('0x46')](_0x4350('0x47'))};_0x42bca2[_0x4350('0x40')]=_[_0x4350('0x31')](_0x42bca2[_0x4350('0x40')],_0x1ee1f9);}_0x42bca2=_[_0x4350('0x31')]({},_0x42bca2,_0x5f3e87[_0x4350('0x32')]);return db[_0x4350('0x48')][_0x4350('0x13')]({'where':_0x42bca2[_0x4350('0x40')]})[_0x4350('0x17')](function(_0x173388){_0x40e705[_0x4350('0x13')]=_0x173388;if(_0x5f3e87[_0x4350('0x26')][_0x4350('0x49')]){_0x42bca2[_0x4350('0x4a')]=[{'all':!![]}];}return db[_0x4350('0x48')][_0x4350('0x24')](_0x42bca2);})['then'](function(_0x3af300){if(_0x5f3e87[_0x4350('0x26')][_0x4350('0x4b')]===_0x4350('0x4c')){for(var _0x11b7ad=0x0;_0x11b7ad<_0x3af300[_0x4350('0x3b')];_0x11b7ad++){_0x3af300[_0x11b7ad][_0x4350('0x35')]=juice(_0x3af300[_0x11b7ad][_0x4350('0x35')]);}}_0x40e705['rows']=_0x3af300;return _0x40e705;});}})['then'](respondWithFilteredResult(_0x49cf9f,_0x42bca2))[_0x4350('0x28')](handleError(_0x49cf9f,null));};exports[_0x4350('0x4d')]=function(_0x4572ef,_0x393fcf){return db[_0x4350('0x1e')][_0x4350('0x33')]({'where':{'id':_0x4572ef[_0x4350('0x2a')]['id']}})['then'](handleEntityNotFound(_0x393fcf,null))[_0x4350('0x17')](function(_0x312c07){if(_0x312c07){return _0x312c07[_0x4350('0x4e')](_0x4572ef[_0x4350('0x35')][_0x4350('0x39')],_[_0x4350('0x3a')](_0x4572ef['body'],[_0x4350('0x39'),'id'])||{})[_0x4350('0x4f')](function(){return db[_0x4350('0x50')][_0x4350('0x24')]({'attributes':['id',_0x4350('0x1a'),_0x4350('0x51')],'where':{'id':_0x4572ef[_0x4350('0x35')][_0x4350('0x39')]}});})['then'](function(_0x1aacc7){socket[_0x4350('0x52')](_0x4350('0x53'),{'id':Number(_0x4572ef[_0x4350('0x2a')]['id']),'tags':_0x1aacc7||[]});return{'id':Number(_0x4572ef[_0x4350('0x2a')]['id']),'tags':_0x1aacc7||[]};});}})['then'](respondWithResult(_0x393fcf,null))[_0x4350('0x28')](handleError(_0x393fcf,null));};exports[_0x4350('0x54')]=function(_0x3ed12e,_0x116fc8){return db[_0x4350('0x1e')]['find']({'where':{'id':_0x3ed12e[_0x4350('0x2a')]['id']}})['then'](handleEntityNotFound(_0x116fc8,null))[_0x4350('0x17')](function(_0x3a5edb){if(_0x3a5edb){return _0x3a5edb['removeTags'](_0x3ed12e[_0x4350('0x26')][_0x4350('0x39')]);}})[_0x4350('0x17')](respondWithStatusCode(_0x116fc8,null))[_0x4350('0x28')](handleError(_0x116fc8,null));};exports[_0x4350('0x55')]=function(_0x3db4b5,_0xca4eb8){var _0x1c3bb1=moment()[_0x4350('0x56')]()[_0x4350('0x57')]();var _0x38f62d=path['join'](config[_0x4350('0x58')],'server',_0x4350('0x59'),'tmp');var _0x4e292d=path[_0x4350('0x5a')](config['root'],'server',_0x4350('0x59'),_0x4350('0x5b'));var _0x586be9=path['join'](_0x38f62d,_0x1c3bb1);var _0x1c9a3b=util[_0x4350('0x46')](_0x4350('0x5c'),_0x3db4b5[_0x4350('0x2a')]['id'],_0x1c3bb1);var _0x5d1e6f=path[_0x4350('0x5a')](_0x38f62d,_0x1c9a3b);var _0x364cb6=[];if(_0x3db4b5[_0x4350('0x26')][_0x4350('0x5b')]){_0x364cb6['push']({'model':db['Attachment'],'as':_0x4350('0x5d'),'raw':!![]});}var _0x489c3c=[{'model':db[_0x4350('0x48')],'as':_0x4350('0x5e'),'attributes':['id','body',_0x4350('0x5f'),'to','cc',_0x4350('0x60'),_0x4350('0x61'),_0x4350('0x62')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x364cb6}];return db[_0x4350('0x1e')]['find']({'where':{'id':_0x3db4b5['params']['id']},'include':_0x489c3c})[_0x4350('0x17')](handleEntityNotFound(_0xca4eb8,null))[_0x4350('0x17')](function(_0x49a0a8){if(_0x49a0a8&&_0x49a0a8[_0x4350('0x5e')]){var _0x1c6f6c=_0x49a0a8[_0x4350('0x63')]({'plain':!![]});fs[_0x4350('0x64')](_0x586be9);return BPromise['each'](_0x1c6f6c[_0x4350('0x5e')],function(_0x715fcc,_0xe8e453){var _0x17e01c={'from':_0x715fcc[_0x4350('0x5f')],'to':_0x715fcc['to']||_0x4350('0x65'),'subject':_0x715fcc[_0x4350('0x61')],'html':htmlEntities[_0x4350('0x66')](_0x715fcc[_0x4350('0x35')]),'headers':{'Date':moment(_0x715fcc[_0x4350('0x62')])[_0x4350('0x46')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x715fcc['cc']){_0x17e01c[_0x4350('0x67')]['Cc']=_0x715fcc['cc'];}if(_0x715fcc[_0x4350('0x60')]){_0x17e01c['headers'][_0x4350('0x68')]=_0x715fcc[_0x4350('0x60')];}return new BPromise(function(_0x3793d6,_0x52c870){if(_0x715fcc[_0x4350('0x5d')]){for(var _0x2c927a=0x0;_0x2c927a<_0x715fcc[_0x4350('0x5d')][_0x4350('0x3b')];_0x2c927a++){var _0x53da39=_0x715fcc['Attachments'][_0x2c927a];var _0x5c1b55=path[_0x4350('0x5a')](_0x4e292d,_0x53da39['basename']);if(fs[_0x4350('0x69')](_0x5c1b55)){_0x17e01c[_0x4350('0x5b')][_0x4350('0x6a')]({'name':_0x53da39[_0x4350('0x1a')],'contentType':_0x53da39[_0x4350('0x21')],'data':fs[_0x4350('0x6b')](_0x5c1b55)});}}}emlformat[_0x4350('0x6c')](_0x17e01c,function(_0x35e1ac,_0x3dca98){if(_0x35e1ac)return _0x52c870(_0x35e1ac);fs[_0x4350('0x6d')](path[_0x4350('0x5a')](_0x586be9,util['format'](_0x4350('0x6e'),_0xe8e453)),_0x3dca98);return _0x3793d6(_0x3dca98);});});})[_0x4350('0x17')](function(){return new BPromise(function(_0xb3a72a,_0x1355a0){zipdir(_0x586be9,{'saveTo':_0x5d1e6f},function(_0x4c7729,_0x140125){if(_0x4c7729)return _0x1355a0(_0x4c7729);return _0xb3a72a(_0x140125);});})[_0x4350('0x17')](function(){return new BPromise(function(_0x502cba,_0x2b34bc){rimraf(_0x586be9,function(_0x6f5fa){if(_0x6f5fa)_0x2b34bc(_0x6f5fa);return _0x502cba();});});})['then'](function(){return _0xca4eb8[_0x4350('0x55')](_0x5d1e6f,_0x1c9a3b,function(_0xab2085){if(!_0xab2085)fs[_0x4350('0x6f')](_0x5d1e6f);});});});}else{return _0xca4eb8[_0x4350('0xe')](0xc8);}})[_0x4350('0x28')](handleError(_0xca4eb8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2ccd653..dafae61 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 _0xaa4b=['remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x37ee5f,_0x11fff5){var _0xdeb38d=function(_0x28436){while(--_0x28436){_0x37ee5f['push'](_0x37ee5f['shift']());}};_0xdeb38d(++_0x11fff5);}(_0xaa4b,0x188));var _0xbaa4=function(_0x1e9754,_0x3750bd){_0x1e9754=_0x1e9754-0x0;var _0x342910=_0xaa4b[_0x1e9754];return _0x342910;};'use strict';var EventEmitter=require(_0xbaa4('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbaa4('0x1')];var MailMessage=require(_0xbaa4('0x2'))['db'][_0xbaa4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbaa4('0x4')](0x0);var events={'afterCreate':_0xbaa4('0x5'),'afterUpdate':_0xbaa4('0x6'),'afterDestroy':_0xbaa4('0x7')};function emitEvent(_0x580a75){return function(_0x1c495b,_0x1133d4,_0x53afe3){_0x1c495b[_0xbaa4('0x8')]({'attributes':['id'],'raw':!![]})[_0xbaa4('0x9')](function(_0x580f8c){_0x1c495b[_0xbaa4('0xa')](_0xbaa4('0xb'),_0x580f8c['map'](function(_0x5c7302){return{'id':_0x5c7302['id']};}));return MailMessage[_0xbaa4('0xc')]({'where':{'MailInteractionId':_0x1c495b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4b7269){_0x1c495b['setDataValue']('unreadMessages',_0x4b7269[_0xbaa4('0xd')]);MailInteractionEvents[_0xbaa4('0xe')](_0x580a75+':'+_0x1c495b['id'],_0x1c495b);MailInteractionEvents['emit'](_0x580a75,_0x1c495b);_0x53afe3(null);})[_0xbaa4('0xf')](_0x53afe3(null));};}for(var e in events){if(events[_0xbaa4('0x10')](e)){var event=events[e];MailInteraction[_0xbaa4('0x11')](e,emitEvent(event));}}module[_0xbaa4('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x6c35=['Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','then','setDataValue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6c35,0x171));var _0x56c3=function(_0x4de32c,_0x26afad){_0x4de32c=_0x4de32c-0x0;var _0x4f8e55=_0x6c35[_0x4de32c];return _0x4f8e55;};'use strict';var EventEmitter=require(_0x56c3('0x0'));var MailInteraction=require(_0x56c3('0x1'))['db'][_0x56c3('0x2')];var MailMessage=require(_0x56c3('0x1'))['db'][_0x56c3('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x56c3('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x56c3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x577b3e){return function(_0x48be79,_0x4bf796,_0x3d1aa9){_0x48be79[_0x56c3('0x6')]({'attributes':['id'],'raw':!![]})[_0x56c3('0x7')](function(_0x19c89a){_0x48be79[_0x56c3('0x8')](_0x56c3('0x9'),_0x19c89a['map'](function(_0x140705){return{'id':_0x140705['id']};}));return MailMessage[_0x56c3('0xa')]({'where':{'MailInteractionId':_0x48be79['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56c3('0x7')](function(_0xca2bcf){_0x48be79[_0x56c3('0x8')](_0x56c3('0xb'),_0xca2bcf[_0x56c3('0xc')]);MailInteractionEvents[_0x56c3('0xd')](_0x577b3e+':'+_0x48be79['id'],_0x48be79);MailInteractionEvents[_0x56c3('0xd')](_0x577b3e,_0x48be79);_0x3d1aa9(null);})[_0x56c3('0xe')](_0x3d1aa9(null));};}for(var e in events){if(events[_0x56c3('0xf')](e)){var event=events[e];MailInteraction[_0x56c3('0x10')](e,emitEvent(event));}}module[_0x56c3('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 399b4f6..9162f6b 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 _0x7990=['mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','changed','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','./mailInteraction.attributes','define'];(function(_0x164597,_0x162cf8){var _0x4c6a2c=function(_0xa9e0af){while(--_0xa9e0af){_0x164597['push'](_0x164597['shift']());}};_0x4c6a2c(++_0x162cf8);}(_0x7990,0xfb));var _0x0799=function(_0x12fbde,_0x3d448c){_0x12fbde=_0x12fbde-0x0;var _0x698ffa=_0x7990[_0x12fbde];return _0x698ffa;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0799('0x5'));var rimraf=require(_0x0799('0x6'));var config=require('../../config/environment');var attributes=require(_0x0799('0x7'));module['exports']=function(_0x4d6506,_0x16f9a7){return _0x4d6506[_0x0799('0x8')]('MailInteraction',attributes,{'tableName':_0x0799('0x9'),'paranoid':![],'indexes':[{'name':_0x0799('0xa'),'fields':['subject','to'],'type':_0x0799('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cf0be,_0x437ac7,_0x5a3f2e){if(_0x3cf0be['substatus']){_0x3cf0be[_0x0799('0xc')]=moment()[_0x0799('0xd')](_0x0799('0xe'));}if(_0x3cf0be[_0x0799('0xf')]){_0x3cf0be[_0x0799('0x10')]=moment()[_0x0799('0xd')](_0x0799('0xe'));}_0x5a3f2e(null,_0x437ac7);},'beforeUpdate':function(_0x36b14d,_0x4dfcd6,_0x4d36f4){if(_0x36b14d['changed'](_0x0799('0x11'))){_0x36b14d[_0x0799('0xc')]=_0x36b14d[_0x0799('0x11')]?moment()[_0x0799('0xd')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x36b14d[_0x0799('0x12')](_0x0799('0xf'))){_0x36b14d[_0x0799('0x10')]=moment()[_0x0799('0xd')](_0x0799('0xe'));_0x36b14d[_0x0799('0x11')]=null;_0x36b14d[_0x0799('0xc')]=null;}_0x4d36f4(null,_0x36b14d);},'afterUpdate':function(_0x4ad551,_0xe98311,_0x9decf6){var _0x1eeb97=_0x4d6506[_0x0799('0x13')];var _0x4eb93e=_0x4ad551[_0x0799('0x14')]({'plain':!![]});if(_0x4eb93e[_0x0799('0xf')]){return _0x1eeb97[_0x0799('0x15')][_0x0799('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4eb93e['id']}})[_0x0799('0x17')](function(){_0x9decf6();})[_0x0799('0x18')](function(_0x4b32ff){_0x9decf6(_0x4b32ff);});}else{_0x9decf6();}}},'charset':_0x0799('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb8de=['./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','then','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xb8de,0x1a0));var _0xeb8d=function(_0x522241,_0x30330c){_0x522241=_0x522241-0x0;var _0x3e3499=_0xb8de[_0x522241];return _0x3e3499;};'use strict';var _=require(_0xeb8d('0x0'));var util=require(_0xeb8d('0x1'));var logger=require(_0xeb8d('0x2'))(_0xeb8d('0x3'));var moment=require(_0xeb8d('0x4'));var BPromise=require(_0xeb8d('0x5'));var rp=require(_0xeb8d('0x6'));var fs=require('fs');var path=require(_0xeb8d('0x7'));var rimraf=require(_0xeb8d('0x8'));var config=require('../../config/environment');var attributes=require(_0xeb8d('0x9'));module[_0xeb8d('0xa')]=function(_0x187fd9,_0x512e05){return _0x187fd9[_0xeb8d('0xb')](_0xeb8d('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xeb8d('0xd'),'fields':['subject','to'],'type':_0xeb8d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x489a45,_0x2fe41b,_0x59b041){if(_0x489a45[_0xeb8d('0xf')]){_0x489a45[_0xeb8d('0x10')]=moment()[_0xeb8d('0x11')](_0xeb8d('0x12'));}if(_0x489a45[_0xeb8d('0x13')]){_0x489a45[_0xeb8d('0x14')]=moment()[_0xeb8d('0x11')](_0xeb8d('0x12'));}_0x59b041(null,_0x2fe41b);},'beforeUpdate':function(_0x4d2df0,_0x239090,_0x2f15bd){if(_0x4d2df0[_0xeb8d('0x15')](_0xeb8d('0xf'))){_0x4d2df0[_0xeb8d('0x10')]=_0x4d2df0[_0xeb8d('0xf')]?moment()['format'](_0xeb8d('0x12')):null;}if(_0x4d2df0[_0xeb8d('0x15')]('closed')){_0x4d2df0[_0xeb8d('0x14')]=moment()['format'](_0xeb8d('0x12'));_0x4d2df0[_0xeb8d('0xf')]=null;_0x4d2df0['substatusAt']=null;}_0x2f15bd(null,_0x4d2df0);},'afterUpdate':function(_0x33da90,_0x4c02ca,_0x59bf85){var _0x5e3ab9=_0x187fd9['models'];var _0x16d8b7=_0x33da90[_0xeb8d('0x16')]({'plain':!![]});if(_0x16d8b7[_0xeb8d('0x13')]){return _0x5e3ab9[_0xeb8d('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x16d8b7['id']}})[_0xeb8d('0x18')](function(){_0x59bf85();})['catch'](function(_0xf0f7d){_0x59bf85(_0xf0f7d);});}else{_0x59bf85();}}},'charset':'utf8mb4','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 c1fca35..8bdee8e 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 _0x1bb0=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','catch','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter'];(function(_0x12d5a5,_0x440b27){var _0x34efef=function(_0x190fbf){while(--_0x190fbf){_0x12d5a5['push'](_0x12d5a5['shift']());}};_0x34efef(++_0x440b27);}(_0x1bb0,0xc9));var _0x01bb=function(_0x519f11,_0x429aee){_0x519f11=_0x519f11-0x0;var _0x464e4d=_0x1bb0[_0x519f11];return _0x464e4d;};'use strict';var _=require(_0x01bb('0x0'));var util=require('util');var moment=require(_0x01bb('0x1'));var BPromise=require(_0x01bb('0x2'));var rs=require(_0x01bb('0x3'));var fs=require('fs');var Redis=require(_0x01bb('0x4'));var db=require(_0x01bb('0x5'))['db'];var utils=require(_0x01bb('0x6'));var logger=require(_0x01bb('0x7'))(_0x01bb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01bb('0x9')][_0x01bb('0xa')]({'port':0x232a});config[_0x01bb('0xb')]=_[_0x01bb('0xc')](config[_0x01bb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x01bb('0xd'))(new Redis(config['redis']));require(_0x01bb('0xe'))[_0x01bb('0xf')](socket);function respondWithRpcPromise(_0x38e371,_0x5e6252,_0x4cf991){return new BPromise(function(_0x40dca3,_0x159c6b){return client[_0x01bb('0x10')](_0x38e371,_0x4cf991)[_0x01bb('0x11')](function(_0x5ab6eb){logger[_0x01bb('0x12')](_0x01bb('0x13'),_0x5e6252,_0x01bb('0x14'));logger[_0x01bb('0x15')](_0x01bb('0x16'),_0x5e6252,_0x01bb('0x14'),JSON[_0x01bb('0x17')](_0x5ab6eb));if(_0x5ab6eb[_0x01bb('0x18')]){if(_0x5ab6eb[_0x01bb('0x18')][_0x01bb('0x19')]===0x1f4){logger[_0x01bb('0x18')](_0x01bb('0x13'),_0x5e6252,_0x5ab6eb[_0x01bb('0x18')][_0x01bb('0x1a')]);return _0x159c6b(_0x5ab6eb['error']['message']);}logger[_0x01bb('0x18')]('MailInteraction,\x20%s,\x20%s',_0x5e6252,_0x5ab6eb[_0x01bb('0x18')][_0x01bb('0x1a')]);return _0x40dca3(_0x5ab6eb[_0x01bb('0x18')][_0x01bb('0x1a')]);}else{logger[_0x01bb('0x12')](_0x01bb('0x13'),_0x5e6252,'request\x20sent');_0x40dca3(_0x5ab6eb[_0x01bb('0x1b')][_0x01bb('0x1a')]);}})['catch'](function(_0x38a681){logger[_0x01bb('0x18')](_0x01bb('0x13'),_0x5e6252,_0x38a681);_0x159c6b(_0x38a681);});});}exports[_0x01bb('0x1c')]=function(_0x306c16){var _0x427387=this;return new Promise(function(_0x543120,_0x3be9be){return db[_0x01bb('0x1d')][_0x01bb('0x1e')](_0x306c16[_0x01bb('0x1f')],{'raw':_0x306c16[_0x01bb('0x20')]?_0x306c16['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306c16['options']?_0x306c16['options'][_0x01bb('0x21')]||null:null,'attributes':_0x306c16['options']?_0x306c16[_0x01bb('0x20')][_0x01bb('0x22')]||null:null,'limit':_0x306c16[_0x01bb('0x20')]?_0x306c16['options'][_0x01bb('0x23')]||null:null})[_0x01bb('0x11')](function(_0x544f98){logger['info'](_0x01bb('0x1c'),_0x306c16);logger[_0x01bb('0x15')]('UpdateMailInteraction',_0x306c16,JSON[_0x01bb('0x17')](_0x544f98));_0x543120(_0x544f98);})[_0x01bb('0x24')](function(_0x347af4){logger[_0x01bb('0x18')]('UpdateMailInteraction',_0x347af4['message'],_0x306c16);_0x3be9be(_0x427387[_0x01bb('0x18')](0x1f4,_0x347af4[_0x01bb('0x1a')]));});});};exports[_0x01bb('0x25')]=function(_0x17f7a1){return new Promise(function(_0x19fdd1,_0x51921a){return db[_0x01bb('0x1d')][_0x01bb('0x26')]({'where':_0x17f7a1[_0x01bb('0x20')]?_0x17f7a1[_0x01bb('0x20')][_0x01bb('0x21')]||null:null})['then'](function(_0x4f76d1){if(_0x4f76d1){return _0x4f76d1['addTags'](_0x17f7a1[_0x01bb('0x1f')][_0x01bb('0x27')],_[_0x01bb('0x28')](_0x17f7a1['body'],[_0x01bb('0x27'),'id'])||{});}})[_0x01bb('0x29')](function(_0x434dc5){logger[_0x01bb('0x12')](_0x01bb('0x2a'),_0x17f7a1);logger[_0x01bb('0x15')](_0x01bb('0x2a'),_0x17f7a1,JSON[_0x01bb('0x17')](_0x434dc5));_0x19fdd1(_0x434dc5);})[_0x01bb('0x24')](function(_0x3a4169){logger['error']('AddTags',_0x3a4169[_0x01bb('0x1a')],_0x17f7a1);_0x51921a(_this[_0x01bb('0x18')](0x1f4,_0x3a4169[_0x01bb('0x1a')]));});});}; \ No newline at end of file +var _0x1e8b=['body','raw','options','attributes','limit','find','where','addTags','ids','spread','AddTags','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailInteraction','MailInteraction','update'];(function(_0xe709c0,_0x24ca4a){var _0x284817=function(_0x5c9f7d){while(--_0x5c9f7d){_0xe709c0['push'](_0xe709c0['shift']());}};_0x284817(++_0x24ca4a);}(_0x1e8b,0xf0));var _0xb1e8=function(_0x3b42a8,_0x150a7d){_0x3b42a8=_0x3b42a8-0x0;var _0x11f4c4=_0x1e8b[_0x3b42a8];return _0x11f4c4;};'use strict';var _=require('lodash');var util=require(_0xb1e8('0x0'));var moment=require(_0xb1e8('0x1'));var BPromise=require('bluebird');var rs=require(_0xb1e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1e8('0x3'))['db'];var utils=require(_0xb1e8('0x4'));var logger=require(_0xb1e8('0x5'))(_0xb1e8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1e8('0x7')][_0xb1e8('0x8')]({'port':0x232a});config[_0xb1e8('0x9')]=_['defaults'](config[_0xb1e8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb1e8('0xa'))(new Redis(config[_0xb1e8('0x9')]));require(_0xb1e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f2da1,_0x4ef888,_0x54f745){return new BPromise(function(_0x102864,_0x49d4c7){return client[_0xb1e8('0xc')](_0x5f2da1,_0x54f745)[_0xb1e8('0xd')](function(_0x2697e8){logger[_0xb1e8('0xe')](_0xb1e8('0xf'),_0x4ef888,_0xb1e8('0x10'));logger[_0xb1e8('0x11')](_0xb1e8('0x12'),_0x4ef888,'request\x20sent',JSON[_0xb1e8('0x13')](_0x2697e8));if(_0x2697e8[_0xb1e8('0x14')]){if(_0x2697e8[_0xb1e8('0x14')]['code']===0x1f4){logger[_0xb1e8('0x14')](_0xb1e8('0xf'),_0x4ef888,_0x2697e8[_0xb1e8('0x14')]['message']);return _0x49d4c7(_0x2697e8[_0xb1e8('0x14')][_0xb1e8('0x15')]);}logger[_0xb1e8('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4ef888,_0x2697e8[_0xb1e8('0x14')][_0xb1e8('0x15')]);return _0x102864(_0x2697e8[_0xb1e8('0x14')][_0xb1e8('0x15')]);}else{logger['info'](_0xb1e8('0xf'),_0x4ef888,_0xb1e8('0x10'));_0x102864(_0x2697e8[_0xb1e8('0x16')][_0xb1e8('0x15')]);}})['catch'](function(_0x3318c8){logger[_0xb1e8('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4ef888,_0x3318c8);_0x49d4c7(_0x3318c8);});});}exports[_0xb1e8('0x17')]=function(_0x4780f7){var _0x65eeae=this;return new Promise(function(_0x5329a2,_0x432255){return db[_0xb1e8('0x18')][_0xb1e8('0x19')](_0x4780f7[_0xb1e8('0x1a')],{'raw':_0x4780f7['options']?_0x4780f7['options'][_0xb1e8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4780f7[_0xb1e8('0x1c')]?_0x4780f7[_0xb1e8('0x1c')]['where']||null:null,'attributes':_0x4780f7[_0xb1e8('0x1c')]?_0x4780f7['options'][_0xb1e8('0x1d')]||null:null,'limit':_0x4780f7[_0xb1e8('0x1c')]?_0x4780f7[_0xb1e8('0x1c')][_0xb1e8('0x1e')]||null:null})[_0xb1e8('0xd')](function(_0x1f1a1d){logger[_0xb1e8('0xe')](_0xb1e8('0x17'),_0x4780f7);logger['debug'](_0xb1e8('0x17'),_0x4780f7,JSON[_0xb1e8('0x13')](_0x1f1a1d));_0x5329a2(_0x1f1a1d);})['catch'](function(_0x19faf6){logger[_0xb1e8('0x14')]('UpdateMailInteraction',_0x19faf6[_0xb1e8('0x15')],_0x4780f7);_0x432255(_0x65eeae[_0xb1e8('0x14')](0x1f4,_0x19faf6[_0xb1e8('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0xe91628){return new Promise(function(_0x156b2c,_0x3103b6){return db['MailInteraction'][_0xb1e8('0x1f')]({'where':_0xe91628[_0xb1e8('0x1c')]?_0xe91628[_0xb1e8('0x1c')][_0xb1e8('0x20')]||null:null})['then'](function(_0x535bb0){if(_0x535bb0){return _0x535bb0[_0xb1e8('0x21')](_0xe91628[_0xb1e8('0x1a')][_0xb1e8('0x22')],_['omit'](_0xe91628[_0xb1e8('0x1a')],['ids','id'])||{});}})[_0xb1e8('0x23')](function(_0x2396a5){logger[_0xb1e8('0xe')](_0xb1e8('0x24'),_0xe91628);logger['debug'](_0xb1e8('0x24'),_0xe91628,JSON[_0xb1e8('0x13')](_0x2396a5));_0x156b2c(_0x2396a5);})[_0xb1e8('0x25')](function(_0x4034df){logger[_0xb1e8('0x14')](_0xb1e8('0x24'),_0x4034df[_0xb1e8('0x15')],_0xe91628);_0x3103b6(_this['error'](0x1f4,_0x4034df[_0xb1e8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bb3241b..ec69e9f 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 _0xb7f4=['./mailInteraction.events','remove','update','emit','length'];(function(_0x41be01,_0x39a398){var _0x34677c=function(_0x215e7c){while(--_0x215e7c){_0x41be01['push'](_0x41be01['shift']());}};_0x34677c(++_0x39a398);}(_0xb7f4,0x181));var _0x4b7f=function(_0x52b2dc,_0x532f7e){_0x52b2dc=_0x52b2dc-0x0;var _0x2d82b5=_0xb7f4[_0x52b2dc];return _0x2d82b5;};'use strict';var MailInteractionEvents=require(_0x4b7f('0x0'));var events=['save',_0x4b7f('0x1'),_0x4b7f('0x2')];function createListener(_0x8e506d,_0x48f40b){return function(_0x427037){_0x48f40b[_0x4b7f('0x3')](_0x8e506d,_0x427037);};}function removeListener(_0xfa8a39,_0x18ac1d){return function(){MailInteractionEvents['removeListener'](_0xfa8a39,_0x18ac1d);};}exports['register']=function(_0x33697c){for(var _0x5dcb72=0x0,_0x303e35=events[_0x4b7f('0x4')];_0x5dcb72<_0x303e35;_0x5dcb72++){var _0x45ca9e=events[_0x5dcb72];var _0x54b313=createListener('mailInteraction:'+_0x45ca9e,_0x33697c);MailInteractionEvents['on'](_0x45ca9e,_0x54b313);}}; \ No newline at end of file +var _0xc4d8=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0x430218,_0x12cd0f){var _0x431f6d=function(_0x1f6750){while(--_0x1f6750){_0x430218['push'](_0x430218['shift']());}};_0x431f6d(++_0x12cd0f);}(_0xc4d8,0x1cc));var _0x8c4d=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xc4d8[_0x31cb5f];return _0x586042;};'use strict';var MailInteractionEvents=require(_0x8c4d('0x0'));var events=[_0x8c4d('0x1'),'remove',_0x8c4d('0x2')];function createListener(_0x4b2aaf,_0x59844e){return function(_0x3c34cc){_0x59844e[_0x8c4d('0x3')](_0x4b2aaf,_0x3c34cc);};}function removeListener(_0x142032,_0x26158a){return function(){MailInteractionEvents[_0x8c4d('0x4')](_0x142032,_0x26158a);};}exports[_0x8c4d('0x5')]=function(_0x18fd33){for(var _0x2a359e=0x0,_0x6a85f3=events[_0x8c4d('0x6')];_0x2a359e<_0x6a85f3;_0x2a359e++){var _0x3bca9d=events[_0x2a359e];var _0x5a1d6b=createListener(_0x8c4d('0x7')+_0x3bca9d,_0x18fd33);MailInteractionEvents['on'](_0x3bca9d,_0x5a1d6b);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 6b8ebe0..45bb576 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 _0x0183=['/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0183,0x1e1));var _0x3018=function(_0x4c4b2f,_0x3aeef6){_0x4c4b2f=_0x4c4b2f-0x0;var _0x4cc593=_0x0183[_0x4c4b2f];return _0x4cc593;};'use strict';var express=require(_0x3018('0x0'));var router=express[_0x3018('0x1')]();var auth=require(_0x3018('0x2'));var controller=require(_0x3018('0x3'));router[_0x3018('0x4')](_0x3018('0x5'),auth[_0x3018('0x6')](),controller[_0x3018('0x7')]);module[_0x3018('0x8')]=router; \ No newline at end of file +var _0xeb5d=['get','isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller'];(function(_0x2aa090,_0x20b150){var _0x3ef49c=function(_0x3adbb8){while(--_0x3adbb8){_0x2aa090['push'](_0x2aa090['shift']());}};_0x3ef49c(++_0x20b150);}(_0xeb5d,0x174));var _0xdeb5=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xeb5d[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0xdeb5('0x0'));var router=express[_0xdeb5('0x1')]();var auth=require(_0xdeb5('0x2'));var controller=require(_0xdeb5('0x3'));router[_0xdeb5('0x4')]('/describe',auth[_0xdeb5('0x5')](),controller[_0xdeb5('0x6')]);module[_0xdeb5('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 5e0989f..5b29fc9 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(_0x4256eb,_0x3e88c5){var _0x37dec0=function(_0x5b08c1){while(--_0x5b08c1){_0x4256eb['push'](_0x4256eb['shift']());}};_0x37dec0(++_0x3e88c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x1ba563,_0x4b67b4){var _0x42b375=function(_0x5ea02d){while(--_0x5ea02d){_0x1ba563['push'](_0x1ba563['shift']());}};_0x42b375(++_0x4b67b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 c7377a4..40a1c1d 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 _0x5687=['exports','INTEGER'];(function(_0x3ae63b,_0x5c25cc){var _0x1d83d5=function(_0xfcd66b){while(--_0xfcd66b){_0x3ae63b['push'](_0x3ae63b['shift']());}};_0x1d83d5(++_0x5c25cc);}(_0x5687,0x6a));var _0x7568=function(_0x2b9757,_0x3bbf51){_0x2b9757=_0x2b9757-0x0;var _0x1422c9=_0x5687[_0x2b9757];return _0x1422c9;};'use strict';var Sequelize=require('sequelize');module[_0x7568('0x0')]={'MailInteractionId':{'type':Sequelize[_0x7568('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x7568('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x74cb=['INTEGER','sequelize','exports'];(function(_0x329611,_0xc06f0f){var _0x5330c1=function(_0x58a723){while(--_0x58a723){_0x329611['push'](_0x329611['shift']());}};_0x5330c1(++_0xc06f0f);}(_0x74cb,0x11e));var _0xb74c=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x74cb[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0xb74c('0x0'));module[_0xb74c('0x1')]={'MailInteractionId':{'type':Sequelize[_0xb74c('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'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 ef803f9..8f0ce5e 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 _0x2def=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define','MailInteractionHasTag'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x2def,0xa6));var _0xf2de=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2def[_0x6c993a];return _0x27f547;};'use strict';var attributes=require(_0xf2de('0x0'));module[_0xf2de('0x1')]=function(_0x5542e0){return _0x5542e0[_0xf2de('0x2')](_0xf2de('0x3'),attributes,{'tableName':_0xf2de('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa662=['MailInteractionHasTag','./mailInteractionHasTag','exports','define'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xa662,0x195));var _0x2a66=function(_0x4519f0,_0x2cc353){_0x4519f0=_0x4519f0-0x0;var _0x336876=_0xa662[_0x4519f0];return _0x336876;};'use strict';var attributes=require(_0x2a66('0x0'));module[_0x2a66('0x1')]=function(_0x50e756){return _0x50e756[_0x2a66('0x2')](_0x2a66('0x3'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 84c4b66..dff3645 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 _0x9993=['update','/:id/accept','accept','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put'];(function(_0x5a3ece,_0x5a5745){var _0x1e8f40=function(_0x5a5b3a){while(--_0x5a5b3a){_0x5a3ece['push'](_0x5a3ece['shift']());}};_0x1e8f40(++_0x5a5745);}(_0x9993,0x109));var _0x3999=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x9993[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x3999('0x0'));var util=require('util');var path=require(_0x3999('0x1'));var timeout=require(_0x3999('0x2'));var express=require(_0x3999('0x3'));var router=express['Router']();var fs_extra=require(_0x3999('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3999('0x5'));var config=require(_0x3999('0x6'));var controller=require(_0x3999('0x7'));router['get']('/',auth[_0x3999('0x8')](),controller[_0x3999('0x9')]);router['get'](_0x3999('0xa'),auth[_0x3999('0x8')](),controller['describe']);router[_0x3999('0xb')](_0x3999('0xc'),auth['isAuthenticated'](),controller[_0x3999('0xd')]);router['get'](_0x3999('0xe'),auth[_0x3999('0x8')](),controller['download']);router[_0x3999('0xf')]('/',auth[_0x3999('0x8')](),interaction[_0x3999('0x10')](_0x3999('0x11'),_0x3999('0x12')),controller[_0x3999('0x13')]);router[_0x3999('0x14')]('/:id',auth[_0x3999('0x8')](),controller[_0x3999('0x15')]);router['put'](_0x3999('0x16'),auth[_0x3999('0x8')](),controller[_0x3999('0x17')]);router[_0x3999('0x14')]('/:id/reject',auth[_0x3999('0x8')](),controller['reject']);router[_0x3999('0x18')]('/:id',auth[_0x3999('0x8')](),controller['destroy']);module[_0x3999('0x19')]=router; \ No newline at end of file +var _0xdca3=['../../config/environment','./mailMessage.controller','get','isAuthenticated','describe','/:id','show','download','post','tracked','mail','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x193703,_0x490b9d){var _0x7afc7b=function(_0x507d5c){while(--_0x507d5c){_0x193703['push'](_0x193703['shift']());}};_0x7afc7b(++_0x490b9d);}(_0xdca3,0x64));var _0x3dca=function(_0x5ba614,_0x52e2e4){_0x5ba614=_0x5ba614-0x0;var _0x172e33=_0xdca3[_0x5ba614];return _0x172e33;};'use strict';var multer=require(_0x3dca('0x0'));var util=require('util');var path=require(_0x3dca('0x1'));var timeout=require(_0x3dca('0x2'));var express=require(_0x3dca('0x3'));var router=express[_0x3dca('0x4')]();var fs_extra=require(_0x3dca('0x5'));var auth=require(_0x3dca('0x6'));var interaction=require(_0x3dca('0x7'));var config=require(_0x3dca('0x8'));var controller=require(_0x3dca('0x9'));router[_0x3dca('0xa')]('/',auth[_0x3dca('0xb')](),controller['index']);router[_0x3dca('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3dca('0xc')]);router['get'](_0x3dca('0xd'),auth[_0x3dca('0xb')](),controller[_0x3dca('0xe')]);router[_0x3dca('0xa')]('/:id/download',auth[_0x3dca('0xb')](),controller[_0x3dca('0xf')]);router[_0x3dca('0x10')]('/',auth[_0x3dca('0xb')](),interaction[_0x3dca('0x11')](_0x3dca('0x12'),'mailmessage:create'),controller[_0x3dca('0x13')]);router['put']('/:id',auth[_0x3dca('0xb')](),controller[_0x3dca('0x14')]);router[_0x3dca('0x15')](_0x3dca('0x16'),auth[_0x3dca('0xb')](),controller[_0x3dca('0x17')]);router[_0x3dca('0x15')](_0x3dca('0x18'),auth[_0x3dca('0xb')](),controller[_0x3dca('0x19')]);router[_0x3dca('0x1a')](_0x3dca('0xd'),auth[_0x3dca('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fc6d7ba..9168bd1 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 _0x8719=['out','STRING','DATE','INTEGER','BOOLEAN','Chat','Email','sequelize','exports','TEXT','long','medium','ENUM'];(function(_0x2b9c4a,_0x5f5a37){var _0x52cd31=function(_0x4c7063){while(--_0x4c7063){_0x2b9c4a['push'](_0x2b9c4a['shift']());}};_0x52cd31(++_0x5f5a37);}(_0x8719,0xe4));var _0x9871=function(_0x4b77cc,_0xd14aaf){_0x4b77cc=_0x4b77cc-0x0;var _0xbb10bd=_0x8719[_0x4b77cc];return _0xbb10bd;};'use strict';var Sequelize=require(_0x9871('0x0'));var _=require('lodash');module[_0x9871('0x1')]={'body':{'type':Sequelize[_0x9871('0x2')](_0x9871('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9871('0x2')](_0x9871('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9871('0x5')]('in',_0x9871('0x6')),'defaultValue':_0x9871('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9871('0x7')](0x1fe)},'from':{'type':Sequelize[_0x9871('0x7')]},'to':{'type':Sequelize[_0x9871('0x2')]('long')},'cc':{'type':Sequelize[_0x9871('0x2')]('long')},'bcc':{'type':Sequelize[_0x9871('0x2')](_0x9871('0x3'))},'subject':{'type':Sequelize[_0x9871('0x2')]},'sentAt':{'type':Sequelize[_0x9871('0x8')]},'attach':{'type':Sequelize[_0x9871('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9871('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x9871('0x2')]('long')},'originCc':{'type':Sequelize[_0x9871('0x2')](_0x9871('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x9871('0xb')),'defaultValue':_0x9871('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xb1a5=['STRING','INTEGER','DATE','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x593f13,_0x4301b0){var _0x5e702c=function(_0x4b16c7){while(--_0x4b16c7){_0x593f13['push'](_0x593f13['shift']());}};_0x5e702c(++_0x4301b0);}(_0xb1a5,0x1cd));var _0x5b1a=function(_0x1d8e16,_0x1bee31){_0x1d8e16=_0x1d8e16-0x0;var _0x102b00=_0xb1a5[_0x1d8e16];return _0x102b00;};'use strict';var Sequelize=require(_0x5b1a('0x0'));var _=require('lodash');module[_0x5b1a('0x1')]={'body':{'type':Sequelize[_0x5b1a('0x2')](_0x5b1a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5b1a('0x2')](_0x5b1a('0x4'))},'read':{'type':Sequelize[_0x5b1a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5b1a('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5b1a('0x7')](0x1fe)},'from':{'type':Sequelize[_0x5b1a('0x7')]},'to':{'type':Sequelize[_0x5b1a('0x2')](_0x5b1a('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x5b1a('0x3'))},'bcc':{'type':Sequelize[_0x5b1a('0x2')](_0x5b1a('0x3'))},'subject':{'type':Sequelize[_0x5b1a('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5b1a('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5b1a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5b1a('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x5b1a('0x3'))},'originCc':{'type':Sequelize[_0x5b1a('0x2')](_0x5b1a('0x3'))},'originChannel':{'type':Sequelize[_0x5b1a('0x6')](_0x5b1a('0xa'),_0x5b1a('0xb')),'defaultValue':_0x5b1a('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 66056d5..558a267 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 _0x0c5d=['manual','interface','channel','motionChannel','event','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','fromString','rejectmessage','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','build','writeFileSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','status','offset','undefined','count','limit','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','find','body','describe','create','direction','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal'];(function(_0x495e1c,_0x5435bd){var _0x121934=function(_0x19dc6f){while(--_0x19dc6f){_0x495e1c['push'](_0x495e1c['shift']());}};_0x121934(++_0x5435bd);}(_0x0c5d,0xbb));var _0xd0c5=function(_0x5a7670,_0x175f76){_0x5a7670=_0x5a7670-0x0;var _0x34cc4c=_0x0c5d[_0x5a7670];return _0x34cc4c;};'use strict';var emlformat=require(_0xd0c5('0x0'));var moment=require(_0xd0c5('0x1'));var BPromise=require(_0xd0c5('0x2'));var util=require(_0xd0c5('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xd0c5('0x4'));var Redis=require(_0xd0c5('0x5'));var htmlToText=require(_0xd0c5('0x6'));var qs=require(_0xd0c5('0x7'));var logger=require('../../config/logger')(_0xd0c5('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xd0c5('0x9'));var db=require(_0xd0c5('0xa'))['db'];config[_0xd0c5('0xb')]=_[_0xd0c5('0xc')](config[_0xd0c5('0xb')],{'host':_0xd0c5('0xd'),'port':0x18eb});var socket=require(_0xd0c5('0xe'))(new Redis(config[_0xd0c5('0xb')]));var htmlEntities=require(_0xd0c5('0xf'));require(_0xd0c5('0x10'))['register'](socket);var jayson=require(_0xd0c5('0x11'));var client=jayson[_0xd0c5('0x12')][_0xd0c5('0x13')]({'port':0x232c});var client9003=jayson[_0xd0c5('0x12')][_0xd0c5('0x13')]({'port':0x232b});var client9002=jayson['client'][_0xd0c5('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x16d0ca,_0x4495e7,_0x2db448,_0x179835){return new BPromise(function(_0x37fa9f,_0x828fb0){var _0x54f882=_0x179835||client;return _0x54f882[_0xd0c5('0x14')](_0x16d0ca,_0x2db448)[_0xd0c5('0x15')](function(_0x129224){logger['info']('MailMessage,\x20%s,\x20%s',_0x4495e7,'request\x20sent');logger[_0xd0c5('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4495e7,_0xd0c5('0x17'),JSON[_0xd0c5('0x18')](_0x129224));if(_0x129224[_0xd0c5('0x19')]){if(_0x129224[_0xd0c5('0x19')][_0xd0c5('0x1a')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x4495e7,_0x129224[_0xd0c5('0x19')]['message']);return _0x828fb0(_0x129224[_0xd0c5('0x19')]['message']);}logger['error'](_0xd0c5('0x1b'),_0x4495e7,_0x129224['error'][_0xd0c5('0x1c')]);return _0x37fa9f(_0x129224['error'][_0xd0c5('0x1c')]);}else{logger[_0xd0c5('0x1d')]('MailMessage,\x20%s,\x20%s',_0x4495e7,'request\x20sent');_0x37fa9f(_0x129224[_0xd0c5('0x1e')][_0xd0c5('0x1c')]);}})['catch'](function(_0x31d441){logger[_0xd0c5('0x19')](_0xd0c5('0x1b'),_0x4495e7,_0x31d441);_0x828fb0(_0x31d441);});});}function respondWithResult(_0x7f5dc6,_0x830d58){_0x830d58=_0x830d58||0xc8;return function(_0x2ef32d){if(_0x2ef32d){return _0x7f5dc6[_0xd0c5('0x1f')](_0x830d58)['json'](_0x2ef32d);}};}function respondWithFilteredResult(_0xffc7f7,_0x35a0a5){return function(_0x2303ae){if(_0x2303ae){var _0x5e2bd2=typeof _0x35a0a5[_0xd0c5('0x20')]===_0xd0c5('0x21')&&typeof _0x35a0a5['limit']==='undefined';var _0x24286d=_0x2303ae['count'];var _0x3306a1=_0x5e2bd2?0x0:_0x35a0a5['offset'];var _0xfc2bd3=_0x5e2bd2?_0x2303ae[_0xd0c5('0x22')]:_0x35a0a5[_0xd0c5('0x20')]+_0x35a0a5[_0xd0c5('0x23')];var _0x3fa276;if(_0xfc2bd3>=_0x24286d){_0xfc2bd3=_0x24286d;_0x3fa276=0xc8;}else{_0x3fa276=0xce;}_0xffc7f7[_0xd0c5('0x1f')](_0x3fa276);return _0xffc7f7['set'](_0xd0c5('0x24'),_0x3306a1+'-'+_0xfc2bd3+'/'+_0x24286d)[_0xd0c5('0x25')](_0x2303ae);}return null;};}function saveUpdates(_0x8a08ca){return function(_0x36a948){if(_0x36a948){return _0x36a948[_0xd0c5('0x26')](_0x8a08ca)['then'](function(_0x2e5f95){return _0x2e5f95;});}return null;};}function removeEntity(_0x14aa73){return function(_0xe45491){if(_0xe45491){return _0xe45491[_0xd0c5('0x27')]()[_0xd0c5('0x15')](function(){_0x14aa73['status'](0xcc)[_0xd0c5('0x28')]();});}};}function handleEntityNotFound(_0x47da12){return function(_0x19bf8a){if(!_0x19bf8a){_0x47da12[_0xd0c5('0x29')](0x194);}return _0x19bf8a;};}function handleError(_0x228331,_0x4982e5){_0x4982e5=_0x4982e5||0x1f4;return function(_0x6e3523){logger[_0xd0c5('0x19')](_0x6e3523[_0xd0c5('0x2a')]);if(_0x6e3523[_0xd0c5('0x2b')]){delete _0x6e3523[_0xd0c5('0x2b')];}_0x228331[_0xd0c5('0x1f')](_0x4982e5)[_0xd0c5('0x2c')](_0x6e3523);};}exports[_0xd0c5('0x2d')]=function(_0x2b0a43,_0x475c6b){var _0x4ab5d3={},_0x594ebe={},_0x1c8d7b={'count':0x0,'rows':[]};var _0x1d17d9=_[_0xd0c5('0x2e')](db[_0xd0c5('0x2f')]['rawAttributes'],function(_0x5c3e08){return{'name':_0x5c3e08[_0xd0c5('0x30')],'type':_0x5c3e08['type'][_0xd0c5('0x31')]};});_0x594ebe[_0xd0c5('0x32')]=_[_0xd0c5('0x2e')](_0x1d17d9,'name');_0x594ebe[_0xd0c5('0x33')]=_['keys'](_0x2b0a43['query']);_0x594ebe[_0xd0c5('0x34')]=_['intersection'](_0x594ebe['model'],_0x594ebe[_0xd0c5('0x33')]);_0x4ab5d3[_0xd0c5('0x35')]=_[_0xd0c5('0x36')](_0x594ebe[_0xd0c5('0x32')],qs[_0xd0c5('0x37')](_0x2b0a43[_0xd0c5('0x33')][_0xd0c5('0x37')]));_0x4ab5d3[_0xd0c5('0x35')]=_0x4ab5d3['attributes'][_0xd0c5('0x38')]?_0x4ab5d3['attributes']:_0x594ebe[_0xd0c5('0x32')];if(!_0x2b0a43[_0xd0c5('0x33')][_0xd0c5('0x39')](_0xd0c5('0x3a'))){_0x4ab5d3['limit']=qs['limit'](_0x2b0a43[_0xd0c5('0x33')][_0xd0c5('0x23')]);_0x4ab5d3[_0xd0c5('0x20')]=qs['offset'](_0x2b0a43[_0xd0c5('0x33')]['offset']);}_0x4ab5d3[_0xd0c5('0x3b')]=qs['sort'](_0x2b0a43['query'][_0xd0c5('0x3c')]);_0x4ab5d3['where']=qs[_0xd0c5('0x34')](_[_0xd0c5('0x3d')](_0x2b0a43[_0xd0c5('0x33')],_0x594ebe[_0xd0c5('0x34')]),_0x1d17d9);if(_0x2b0a43[_0xd0c5('0x33')][_0xd0c5('0x3e')]){_0x4ab5d3[_0xd0c5('0x3f')]=_[_0xd0c5('0x40')](_0x4ab5d3[_0xd0c5('0x3f')],{'$or':_[_0xd0c5('0x2e')](_0x1d17d9,function(_0x2ab5af){if(_0x2ab5af[_0xd0c5('0x41')]!==_0xd0c5('0x42')){var _0x1fbb51={};_0x1fbb51[_0x2ab5af[_0xd0c5('0x2b')]]={'$like':'%'+_0x2b0a43[_0xd0c5('0x33')][_0xd0c5('0x3e')]+'%'};return _0x1fbb51;}})});}_0x4ab5d3=_[_0xd0c5('0x40')]({},_0x4ab5d3,_0x2b0a43[_0xd0c5('0x43')]);var _0x29bf39={'where':_0x4ab5d3[_0xd0c5('0x3f')]};return db[_0xd0c5('0x2f')]['count'](_0x29bf39)[_0xd0c5('0x15')](function(_0x5872ff){_0x1c8d7b[_0xd0c5('0x22')]=_0x5872ff;if(_0x2b0a43[_0xd0c5('0x33')]['includeAll']){_0x4ab5d3[_0xd0c5('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0xd0c5('0x45')](_0x4ab5d3);})[_0xd0c5('0x15')](function(_0x239baf){_0x1c8d7b[_0xd0c5('0x46')]=_0x239baf;return _0x1c8d7b;})[_0xd0c5('0x15')](respondWithFilteredResult(_0x475c6b,_0x4ab5d3))[_0xd0c5('0x47')](handleError(_0x475c6b,null));};exports[_0xd0c5('0x48')]=function(_0x47d2e9,_0x4af670){var _0x23db1a={'raw':!![],'where':{'id':_0x47d2e9[_0xd0c5('0x49')]['id']}},_0x46c194={};_0x46c194[_0xd0c5('0x32')]=_['keys'](db['MailMessage'][_0xd0c5('0x4a')]);_0x46c194[_0xd0c5('0x33')]=_[_0xd0c5('0x4b')](_0x47d2e9[_0xd0c5('0x33')]);_0x46c194[_0xd0c5('0x34')]=_[_0xd0c5('0x36')](_0x46c194['model'],_0x46c194[_0xd0c5('0x33')]);_0x23db1a[_0xd0c5('0x35')]=_['intersection'](_0x46c194[_0xd0c5('0x32')],qs[_0xd0c5('0x37')](_0x47d2e9[_0xd0c5('0x33')][_0xd0c5('0x37')]));_0x23db1a[_0xd0c5('0x35')]=_0x23db1a[_0xd0c5('0x35')][_0xd0c5('0x38')]?_0x23db1a[_0xd0c5('0x35')]:_0x46c194[_0xd0c5('0x32')];if(_0x47d2e9[_0xd0c5('0x33')][_0xd0c5('0x4c')]){_0x23db1a[_0xd0c5('0x44')]=[{'all':!![]}];}_0x23db1a=_[_0xd0c5('0x40')]({},_0x23db1a,_0x47d2e9[_0xd0c5('0x43')]);return db[_0xd0c5('0x2f')][_0xd0c5('0x4d')](_0x23db1a)[_0xd0c5('0x15')](handleEntityNotFound(_0x4af670,null))[_0xd0c5('0x15')](respondWithResult(_0x4af670,null))[_0xd0c5('0x47')](handleError(_0x4af670,null));};exports[_0xd0c5('0x26')]=function(_0x338007,_0x515870){if(_0x338007[_0xd0c5('0x4e')]['id']){delete _0x338007[_0xd0c5('0x4e')]['id'];}return db['MailMessage'][_0xd0c5('0x4d')]({'where':{'id':_0x338007[_0xd0c5('0x49')]['id']}})[_0xd0c5('0x15')](handleEntityNotFound(_0x515870,null))[_0xd0c5('0x15')](saveUpdates(_0x338007['body'],null))['then'](respondWithResult(_0x515870,null))['catch'](handleError(_0x515870,null));};exports[_0xd0c5('0x27')]=function(_0x78578e,_0x260f7a){return db[_0xd0c5('0x2f')][_0xd0c5('0x4d')]({'where':{'id':_0x78578e[_0xd0c5('0x49')]['id']}})[_0xd0c5('0x15')](handleEntityNotFound(_0x260f7a,null))[_0xd0c5('0x15')](removeEntity(_0x260f7a,null))[_0xd0c5('0x47')](handleError(_0x260f7a,null));};exports[_0xd0c5('0x4f')]=function(_0x2dbb7b,_0x4d204d){return db[_0xd0c5('0x2f')]['describe']()['then'](respondWithResult(_0x4d204d,null))[_0xd0c5('0x47')](handleError(_0x4d204d,null));};exports[_0xd0c5('0x50')]=function(_0x135d8f,_0x353e62){return db[_0xd0c5('0x2f')][_0xd0c5('0x50')](_0x135d8f[_0xd0c5('0x4e')])[_0xd0c5('0x15')](function(_0x51e81d){if(_0x51e81d){if(_0x51e81d[_0xd0c5('0x51')]===_0xd0c5('0x52')&&!_0x51e81d[_0xd0c5('0x53')]){var _0x1df5a0,_0x3ffc99,_0x25dcd2;if(_0x135d8f['body']['to']){_0x3ffc99=_0x135d8f[_0xd0c5('0x4e')]['to']['split'](',')[0x0];}return db[_0xd0c5('0x54')]['findOne']({'where':{'id':_0x51e81d[_0xd0c5('0x55')]},'include':[{'model':db[_0xd0c5('0x56')],'as':_0xd0c5('0x57'),'include':[{'model':db[_0xd0c5('0x58')],'as':_0xd0c5('0x59'),'where':{'email':_0x3ffc99},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0xd0c5('0x5a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xd0c5('0x15')](function(_0x1d55d2){_0x1df5a0=_0x1d55d2;if(!_0x1df5a0||!_0x1df5a0['Smtp'])return;var _0x2ae79b=_0x1df5a0[_0xd0c5('0x5b')]();if(_0x135d8f[_0xd0c5('0x4e')]['attachments']&&_0x135d8f['body'][_0xd0c5('0x5c')]['length']){for(var _0x4b87bf=0x0;_0x4b87bf<_0x135d8f[_0xd0c5('0x4e')][_0xd0c5('0x5c')]['length'];_0x4b87bf+=0x1){_0x135d8f[_0xd0c5('0x4e')][_0xd0c5('0x5c')][_0x4b87bf]={'filename':_0x135d8f[_0xd0c5('0x4e')][_0xd0c5('0x5c')][_0x4b87bf]['name'],'path':path[_0xd0c5('0x5d')](config[_0xd0c5('0x5e')],_0xd0c5('0x5f'),_0x135d8f[_0xd0c5('0x4e')][_0xd0c5('0x5c')][_0x4b87bf][_0xd0c5('0x60')])};}}_0x25dcd2={'account':_0x2ae79b,'message':_0x135d8f[_0xd0c5('0x4e')]};return;})['then'](function(){if(_0x1df5a0[_0xd0c5('0x57')]){if(_0x1df5a0[_0xd0c5('0x57')][_0xd0c5('0x59')]['length']){return _0x1df5a0[_0xd0c5('0x57')][_0xd0c5('0x59')][0x0];}else{return db[_0xd0c5('0x58')][_0xd0c5('0x50')](_[_0xd0c5('0xc')](_0x135d8f[_0xd0c5('0x4e')],{'firstName':_0x135d8f[_0xd0c5('0x4e')]['to'],'email':_0x135d8f[_0xd0c5('0x4e')]['to'],'phone':_0x135d8f[_0xd0c5('0x4e')]['to'],'ListId':_0x1df5a0[_0xd0c5('0x61')]}));}}else{throw new Error(_0xd0c5('0x62'));}})[_0xd0c5('0x15')](function(){if(_0x25dcd2){return respondWithRpcPromise(_0xd0c5('0x63'),_0xd0c5('0x64'),_0x25dcd2,client9003)['then'](function(_0x542510){return _0x51e81d[_0xd0c5('0x26')]({'read':!![],'messageId':_0x542510['messageId'],'sentAt':moment()[_0xd0c5('0x65')](_0xd0c5('0x66'))});})[_0xd0c5('0x47')](function(_0x1054af){logger[_0xd0c5('0x19')]('%s',JSON['stringify'](_0x1054af));return _0x51e81d;});}return _0x51e81d;});}return _0x51e81d;}})[_0xd0c5('0x15')](respondWithResult(_0x353e62,0xc9))[_0xd0c5('0x47')](handleError(_0x353e62,null));};exports[_0xd0c5('0x67')]=function(_0x174f5c,_0x4bf330){var _0x5ef330={'agent':{},'channel':_0xd0c5('0x68')};if(_0x174f5c['body']['id']){delete _0x174f5c[_0xd0c5('0x4e')]['id'];}_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x69')]=!![];_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x6a')]=moment()['format'](_0xd0c5('0x66'));_0x174f5c[_0xd0c5('0x4e')]['UserId']=_0x174f5c['body'][_0xd0c5('0x6b')]||_0x174f5c[_0xd0c5('0x6c')]['id'];_0x5ef330[_0xd0c5('0x6d')]['id']=_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x6b')];return db[_0xd0c5('0x2f')][_0xd0c5('0x4d')]({'where':{'id':_0x174f5c[_0xd0c5('0x49')]['id'],'UserId':null}})[_0xd0c5('0x15')](handleEntityNotFound(_0x4bf330,null))['then'](saveUpdates(_0x174f5c['body'],null))[_0xd0c5('0x15')](function(_0x5c2b9e){if(_0x5c2b9e){_0x5ef330[_0xd0c5('0x1c')]=_0x5c2b9e[_0xd0c5('0x6e')]({'plain':!![]});return db[_0xd0c5('0x6f')]['find']({'where':{'id':_0x5c2b9e['MailInteractionId']}});}return null;})[_0xd0c5('0x15')](handleEntityNotFound(_0x4bf330,null))[_0xd0c5('0x15')](function(_0x52984f){if(_0x52984f){return _0x52984f[_0xd0c5('0x26')]({'UserId':_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x6b')],'read1stAt':_[_0xd0c5('0x70')](_0x52984f['read1stAt'])?moment()[_0xd0c5('0x65')](_0xd0c5('0x66')):undefined});}return null;})['then'](function(_0x2b478c){if(_0x2b478c){_0x5ef330['interaction']=_0x2b478c['get']({'plain':!![]});interaction_log['info'](_0xd0c5('0x71'),_0x174f5c[_0xd0c5('0x6c')]['id'],_0x174f5c[_0xd0c5('0x6c')][_0xd0c5('0x2b')],_0x174f5c[_0xd0c5('0x6c')][_0xd0c5('0x72')],_0x5ef330[_0xd0c5('0x73')]['id'],_0x174f5c['body']?JSON[_0xd0c5('0x18')](_0x174f5c['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5ef330);}return null;})['then'](function(_0x6c6296){var _0x567761=_0xd0c5('0x74')+_0x6c6296[_0xd0c5('0x1c')]['ContactId'];return db[_0xd0c5('0x75')][_0xd0c5('0x33')](_0x567761,{'type':db[_0xd0c5('0x76')][_0xd0c5('0x77')][_0xd0c5('0x78')],'raw':!![]})[_0xd0c5('0x15')](function(_0x3690f4){return _0x3690f4;});})[_0xd0c5('0x15')](function(_0x5406cb){if(_0x5406cb){_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x79')]=_0x5406cb[0x0];if(!_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x6b')])return;return db[_0xd0c5('0x7a')][_0xd0c5('0x4d')]({'where':{'id':_0x174f5c[_0xd0c5('0x4e')][_0xd0c5('0x6b')],'role':_0xd0c5('0x6d')},'attributes':['id',_0xd0c5('0x2b'),_0xd0c5('0x7b'),'email',_0xd0c5('0x7c')],'raw':!![]});}return null;})['then'](function(_0x887679){if(!_0x887679)return null;_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x6d')]=_0x887679;return _0x5ef330;})[_0xd0c5('0x15')](function(_0x3551d8){if(_0x3551d8){if(_0x174f5c['body'][_0xd0c5('0x7d')]){_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x7e')]=util[_0xd0c5('0x65')]('SIP/%s',_0x174f5c[_0xd0c5('0x6c')]['name']);_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x7f')]=_0x5ef330[_0xd0c5('0x7f')];_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x80')]=_0x5ef330['channel'];_0x5ef330[_0xd0c5('0x1c')][_0xd0c5('0x81')]=_0xd0c5('0x67');_0x5ef330['message'][_0xd0c5('0x4e')]=htmlToText['fromString'](_0x5ef330['message']['body']);return respondWithRpcPromise(_0xd0c5('0x82'),'EventManager',{'event':'acceptmessage','message':_0x5ef330[_0xd0c5('0x1c')]},client9002)[_0xd0c5('0x15')](function(){return _0x5ef330;});}return _0x5ef330;}return null;})[_0xd0c5('0x15')](respondWithResult(_0x4bf330,null))['catch'](handleError(_0x4bf330,null));};exports[_0xd0c5('0x83')]=function(_0x25827f,_0x3024fa){var _0x1d62e0={'agent':{},'channel':_0xd0c5('0x68')};if(_0x25827f[_0xd0c5('0x4e')]['id']){delete _0x25827f[_0xd0c5('0x4e')]['id'];}_0x25827f[_0xd0c5('0x4e')]['UserId']=_0x25827f[_0xd0c5('0x4e')][_0xd0c5('0x6b')]||_0x25827f[_0xd0c5('0x6c')]['id'];_0x1d62e0[_0xd0c5('0x6d')]['id']=_0x25827f[_0xd0c5('0x4e')][_0xd0c5('0x6b')];return db[_0xd0c5('0x2f')]['find']({'where':{'id':_0x25827f[_0xd0c5('0x49')]['id'],'UserId':null}})[_0xd0c5('0x15')](handleEntityNotFound(_0x3024fa,null))[_0xd0c5('0x15')](function(_0xb06732){if(_0xb06732){_0x1d62e0[_0xd0c5('0x1c')]=_0xb06732[_0xd0c5('0x6e')]({'plain':!![]});return db[_0xd0c5('0x6f')][_0xd0c5('0x4d')]({'where':{'id':_0xb06732['MailInteractionId']}});}return null;})[_0xd0c5('0x15')](handleEntityNotFound(_0x3024fa,null))['then'](function(_0x22da50){if(_0x22da50){_0x1d62e0['interaction']=_0x22da50[_0xd0c5('0x6e')]({'plain':!![]});interaction_log[_0xd0c5('0x1d')](_0xd0c5('0x84'),_0x25827f['user']['id'],_0x25827f[_0xd0c5('0x6c')][_0xd0c5('0x2b')],_0x25827f[_0xd0c5('0x6c')][_0xd0c5('0x72')],_0x1d62e0['interaction']['id'],_0x25827f[_0xd0c5('0x4e')]?JSON[_0xd0c5('0x18')](_0x25827f[_0xd0c5('0x4e')]):_0xd0c5('0x85'));return respondWithRpcPromise(_0xd0c5('0x86'),_0xd0c5('0x87'),_0x1d62e0);}return null;})[_0xd0c5('0x15')](function(_0x563f72){var _0x3af716=_0xd0c5('0x74')+_0x563f72[_0xd0c5('0x1c')]['ContactId'];return db[_0xd0c5('0x75')]['query'](_0x3af716,{'type':db[_0xd0c5('0x76')][_0xd0c5('0x77')][_0xd0c5('0x78')],'raw':!![]})['then'](function(_0x4bfb33){return _0x4bfb33;});})[_0xd0c5('0x15')](function(_0x47727c){if(_0x47727c){_0x1d62e0[_0xd0c5('0x1c')][_0xd0c5('0x79')]=_0x47727c[0x0];if(!_0x25827f['body']['UserId'])return;return db[_0xd0c5('0x7a')][_0xd0c5('0x4d')]({'where':{'id':_0x25827f[_0xd0c5('0x4e')][_0xd0c5('0x6b')],'role':_0xd0c5('0x6d')},'attributes':['id','name','fullname','email',_0xd0c5('0x7c')],'raw':!![]});}return null;})[_0xd0c5('0x15')](function(_0x2dcc3a){if(!_0x2dcc3a)return null;_0x1d62e0[_0xd0c5('0x1c')]['agent']=_0x2dcc3a;return _0x1d62e0;})[_0xd0c5('0x15')](function(_0x2603eb){if(_0x2603eb){_0x2603eb[_0xd0c5('0x1c')][_0xd0c5('0x7e')]=util['format'](_0xd0c5('0x88'),_0x25827f[_0xd0c5('0x6c')]['name']);_0x2603eb[_0xd0c5('0x1c')][_0xd0c5('0x7f')]=_0x1d62e0[_0xd0c5('0x7f')];_0x2603eb[_0xd0c5('0x1c')]['motionChannel']=_0x1d62e0[_0xd0c5('0x7f')];_0x2603eb[_0xd0c5('0x1c')]['event']='reject';_0x2603eb[_0xd0c5('0x1c')][_0xd0c5('0x4e')]=htmlToText[_0xd0c5('0x89')](_0x1d62e0[_0xd0c5('0x1c')][_0xd0c5('0x4e')]);respondWithRpcPromise(_0xd0c5('0x82'),'EventManager',{'event':_0xd0c5('0x8a'),'message':_0x2603eb[_0xd0c5('0x1c')]},client9002);return _0x1d62e0;}return null;})[_0xd0c5('0x15')](respondWithResult(_0x3024fa,null))[_0xd0c5('0x47')](handleError(_0x3024fa,null));};exports['download']=function(_0x2ab688,_0x50b7c9){var _0x4b8223=moment()[_0xd0c5('0x8b')]()['toString']();var _0x52df01=path[_0xd0c5('0x5d')](config[_0xd0c5('0x5e')],_0xd0c5('0x8c'),_0xd0c5('0x8d'),_0xd0c5('0x8e'));var _0x3bf7f8=path[_0xd0c5('0x5d')](config[_0xd0c5('0x5e')],_0xd0c5('0x8c'),_0xd0c5('0x8d'),'attachments');var _0x27964d=util[_0xd0c5('0x65')](_0xd0c5('0x8f'),_0x4b8223);return db[_0xd0c5('0x2f')][_0xd0c5('0x4d')]({'where':{'id':_0x2ab688[_0xd0c5('0x49')]['id']},'attributes':['id',_0xd0c5('0x4e'),_0xd0c5('0x90'),'to','cc',_0xd0c5('0x91'),_0xd0c5('0x92'),_0xd0c5('0x93')],'include':_0x2ab688['query']['attachments']?[{'model':db[_0xd0c5('0x94')],'as':_0xd0c5('0x95')}]:undefined})[_0xd0c5('0x15')](handleEntityNotFound(_0x50b7c9,null))[_0xd0c5('0x15')](function(_0x369971){if(_0x369971){var _0x1d6c7c=_0x369971;var _0x42b2d4={'from':_0x1d6c7c[_0xd0c5('0x90')],'to':_0x1d6c7c['to'],'subject':_0x1d6c7c[_0xd0c5('0x92')],'html':htmlEntities[_0xd0c5('0x96')](_0x1d6c7c[_0xd0c5('0x4e')]),'headers':{'Date':moment(_0x1d6c7c[_0xd0c5('0x93')])['format'](_0xd0c5('0x97'))},'attachments':[]};if(_0x369971['cc']){_0x42b2d4[_0xd0c5('0x98')]['Cc']=_0x369971['cc'];}if(_0x369971[_0xd0c5('0x91')]){_0x42b2d4[_0xd0c5('0x98')][_0xd0c5('0x99')]=_0x369971[_0xd0c5('0x91')];}return new BPromise(function(_0x267f70,_0x54316b){if(_0x369971[_0xd0c5('0x95')]){for(var _0x1c2132=0x0;_0x1c2132<_0x369971['Attachments'][_0xd0c5('0x38')];_0x1c2132++){var _0x37cb01=_0x369971[_0xd0c5('0x95')][_0x1c2132];var _0x5b847c=path['join'](_0x3bf7f8,_0x37cb01[_0xd0c5('0x60')]);if(fs['existsSync'](_0x5b847c)){_0x42b2d4['attachments']['push']({'name':_0x37cb01[_0xd0c5('0x2b')],'contentType':_0x37cb01[_0xd0c5('0x41')],'data':fs['readFileSync'](_0x5b847c)});}}}emlformat[_0xd0c5('0x9a')](_0x42b2d4,function(_0x9f2248,_0x386404){if(_0x9f2248)return _0x54316b(_0x9f2248);fs[_0xd0c5('0x9b')](path[_0xd0c5('0x5d')](_0x52df01,_0x27964d),_0x386404);return _0x267f70(_0x386404);});});}})[_0xd0c5('0x15')](function(_0x3f3790){if(_0x3f3790){return _0x50b7c9['download'](path[_0xd0c5('0x5d')](_0x52df01,_0x27964d),_0x27964d,function(_0x19e937){if(!_0x19e937)fs['unlinkSync'](path[_0xd0c5('0x5d')](_0x52df01,_0x27964d));});}})['catch'](handleError(_0x50b7c9,null));}; \ No newline at end of file +var _0x8180=['rows','params','find','update','body','describe','create','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','attachments','join','server/files/attachments','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','motionChannel','event','fromString','EventManager','reject','rejectMessage','sequelize','User','interface','SIP/%s','rejectmessage','download','unix','root','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','html-entities','./mailMessage.socket','register','client','http','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','status','limit','count','offset','Content-Range','json','destroy','end','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','MailMessage','includeAll','include','findAll'];(function(_0x237155,_0x643037){var _0x341c14=function(_0x15324e){while(--_0x15324e){_0x237155['push'](_0x237155['shift']());}};_0x341c14(++_0x643037);}(_0x8180,0x18f));var _0x0818=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8180[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x0818('0x0'));var moment=require(_0x0818('0x1'));var BPromise=require(_0x0818('0x2'));var util=require(_0x0818('0x3'));var path=require(_0x0818('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0818('0x5'));var htmlToText=require(_0x0818('0x6'));var qs=require(_0x0818('0x7'));var logger=require(_0x0818('0x8'))(_0x0818('0x9'));var interaction_log=require(_0x0818('0x8'))('mail-interactions');var config=require(_0x0818('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0818('0xb')](config[_0x0818('0xc')],{'host':_0x0818('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0818('0xc')]));var htmlEntities=require(_0x0818('0xe'));require(_0x0818('0xf'))[_0x0818('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0818('0x11')][_0x0818('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x0818('0x12')]({'port':0x232b});var client9002=jayson[_0x0818('0x11')][_0x0818('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x355e78,_0x293e7e,_0x406898,_0x4d11cc){return new BPromise(function(_0x5859da,_0x544081){var _0x26e7bc=_0x4d11cc||client;return _0x26e7bc['request'](_0x355e78,_0x406898)[_0x0818('0x13')](function(_0x486168){logger['info']('MailMessage,\x20%s,\x20%s',_0x293e7e,_0x0818('0x14'));logger[_0x0818('0x15')](_0x0818('0x16'),_0x293e7e,_0x0818('0x14'),JSON[_0x0818('0x17')](_0x486168));if(_0x486168['error']){if(_0x486168[_0x0818('0x18')][_0x0818('0x19')]===0x1f4){logger[_0x0818('0x18')](_0x0818('0x1a'),_0x293e7e,_0x486168[_0x0818('0x18')][_0x0818('0x1b')]);return _0x544081(_0x486168['error'][_0x0818('0x1b')]);}logger[_0x0818('0x18')]('MailMessage,\x20%s,\x20%s',_0x293e7e,_0x486168[_0x0818('0x18')][_0x0818('0x1b')]);return _0x5859da(_0x486168['error']['message']);}else{logger[_0x0818('0x1c')](_0x0818('0x1a'),_0x293e7e,'request\x20sent');_0x5859da(_0x486168[_0x0818('0x1d')]['message']);}})[_0x0818('0x1e')](function(_0x420aea){logger[_0x0818('0x18')](_0x0818('0x1a'),_0x293e7e,_0x420aea);_0x544081(_0x420aea);});});}function respondWithResult(_0x3e735b,_0x13bc83){_0x13bc83=_0x13bc83||0xc8;return function(_0x4c2848){if(_0x4c2848){return _0x3e735b[_0x0818('0x1f')](_0x13bc83)['json'](_0x4c2848);}};}function respondWithFilteredResult(_0x4d3ed1,_0x1560d1){return function(_0x1495d4){if(_0x1495d4){var _0x106126=typeof _0x1560d1['offset']==='undefined'&&typeof _0x1560d1[_0x0818('0x20')]==='undefined';var _0x4e6073=_0x1495d4[_0x0818('0x21')];var _0x6cb40c=_0x106126?0x0:_0x1560d1['offset'];var _0x3f00b8=_0x106126?_0x1495d4[_0x0818('0x21')]:_0x1560d1[_0x0818('0x22')]+_0x1560d1[_0x0818('0x20')];var _0x9bb158;if(_0x3f00b8>=_0x4e6073){_0x3f00b8=_0x4e6073;_0x9bb158=0xc8;}else{_0x9bb158=0xce;}_0x4d3ed1['status'](_0x9bb158);return _0x4d3ed1['set'](_0x0818('0x23'),_0x6cb40c+'-'+_0x3f00b8+'/'+_0x4e6073)[_0x0818('0x24')](_0x1495d4);}return null;};}function saveUpdates(_0x244717){return function(_0x11b10f){if(_0x11b10f){return _0x11b10f['update'](_0x244717)[_0x0818('0x13')](function(_0x28afc8){return _0x28afc8;});}return null;};}function removeEntity(_0x3c0c90){return function(_0x38779a){if(_0x38779a){return _0x38779a[_0x0818('0x25')]()[_0x0818('0x13')](function(){_0x3c0c90[_0x0818('0x1f')](0xcc)[_0x0818('0x26')]();});}};}function handleEntityNotFound(_0x5a0f4f){return function(_0x4545d){if(!_0x4545d){_0x5a0f4f[_0x0818('0x27')](0x194);}return _0x4545d;};}function handleError(_0x9c4415,_0x405191){_0x405191=_0x405191||0x1f4;return function(_0x170987){logger['error'](_0x170987[_0x0818('0x28')]);if(_0x170987['name']){delete _0x170987['name'];}_0x9c4415[_0x0818('0x1f')](_0x405191)['send'](_0x170987);};}exports[_0x0818('0x29')]=function(_0x3da1db,_0x192342){var _0x100799={},_0x101e27={},_0x37a20f={'count':0x0,'rows':[]};var _0x5ca2da=_[_0x0818('0x2a')](db['MailMessage'][_0x0818('0x2b')],function(_0x23161d){return{'name':_0x23161d[_0x0818('0x2c')],'type':_0x23161d[_0x0818('0x2d')][_0x0818('0x2e')]};});_0x101e27[_0x0818('0x2f')]=_[_0x0818('0x2a')](_0x5ca2da,_0x0818('0x30'));_0x101e27[_0x0818('0x31')]=_[_0x0818('0x32')](_0x3da1db[_0x0818('0x31')]);_0x101e27[_0x0818('0x33')]=_[_0x0818('0x34')](_0x101e27[_0x0818('0x2f')],_0x101e27[_0x0818('0x31')]);_0x100799[_0x0818('0x35')]=_[_0x0818('0x34')](_0x101e27[_0x0818('0x2f')],qs[_0x0818('0x36')](_0x3da1db['query'][_0x0818('0x36')]));_0x100799['attributes']=_0x100799[_0x0818('0x35')][_0x0818('0x37')]?_0x100799[_0x0818('0x35')]:_0x101e27[_0x0818('0x2f')];if(!_0x3da1db[_0x0818('0x31')][_0x0818('0x38')](_0x0818('0x39'))){_0x100799['limit']=qs[_0x0818('0x20')](_0x3da1db[_0x0818('0x31')][_0x0818('0x20')]);_0x100799['offset']=qs[_0x0818('0x22')](_0x3da1db[_0x0818('0x31')][_0x0818('0x22')]);}_0x100799[_0x0818('0x3a')]=qs[_0x0818('0x3b')](_0x3da1db['query'][_0x0818('0x3b')]);_0x100799['where']=qs[_0x0818('0x33')](_[_0x0818('0x3c')](_0x3da1db[_0x0818('0x31')],_0x101e27[_0x0818('0x33')]),_0x5ca2da);if(_0x3da1db[_0x0818('0x31')][_0x0818('0x3d')]){_0x100799[_0x0818('0x3e')]=_[_0x0818('0x3f')](_0x100799['where'],{'$or':_['map'](_0x5ca2da,function(_0x57d951){if(_0x57d951['type']!=='VIRTUAL'){var _0x3679c0={};_0x3679c0[_0x57d951[_0x0818('0x30')]]={'$like':'%'+_0x3da1db[_0x0818('0x31')]['filter']+'%'};return _0x3679c0;}})});}_0x100799=_['merge']({},_0x100799,_0x3da1db[_0x0818('0x40')]);var _0x1170e5={'where':_0x100799[_0x0818('0x3e')]};return db[_0x0818('0x41')][_0x0818('0x21')](_0x1170e5)['then'](function(_0x2ee100){_0x37a20f[_0x0818('0x21')]=_0x2ee100;if(_0x3da1db[_0x0818('0x31')][_0x0818('0x42')]){_0x100799[_0x0818('0x43')]=[{'all':!![]}];}return db[_0x0818('0x41')][_0x0818('0x44')](_0x100799);})[_0x0818('0x13')](function(_0x46fcdb){_0x37a20f[_0x0818('0x45')]=_0x46fcdb;return _0x37a20f;})[_0x0818('0x13')](respondWithFilteredResult(_0x192342,_0x100799))[_0x0818('0x1e')](handleError(_0x192342,null));};exports['show']=function(_0x10ce74,_0xa2bd99){var _0x4211c9={'raw':!![],'where':{'id':_0x10ce74[_0x0818('0x46')]['id']}},_0x28d0cb={};_0x28d0cb['model']=_[_0x0818('0x32')](db[_0x0818('0x41')][_0x0818('0x2b')]);_0x28d0cb[_0x0818('0x31')]=_[_0x0818('0x32')](_0x10ce74[_0x0818('0x31')]);_0x28d0cb[_0x0818('0x33')]=_[_0x0818('0x34')](_0x28d0cb['model'],_0x28d0cb['query']);_0x4211c9[_0x0818('0x35')]=_['intersection'](_0x28d0cb['model'],qs[_0x0818('0x36')](_0x10ce74[_0x0818('0x31')][_0x0818('0x36')]));_0x4211c9[_0x0818('0x35')]=_0x4211c9['attributes'][_0x0818('0x37')]?_0x4211c9[_0x0818('0x35')]:_0x28d0cb['model'];if(_0x10ce74[_0x0818('0x31')][_0x0818('0x42')]){_0x4211c9[_0x0818('0x43')]=[{'all':!![]}];}_0x4211c9=_[_0x0818('0x3f')]({},_0x4211c9,_0x10ce74[_0x0818('0x40')]);return db[_0x0818('0x41')][_0x0818('0x47')](_0x4211c9)['then'](handleEntityNotFound(_0xa2bd99,null))[_0x0818('0x13')](respondWithResult(_0xa2bd99,null))[_0x0818('0x1e')](handleError(_0xa2bd99,null));};exports[_0x0818('0x48')]=function(_0x4df6e8,_0x18983f){if(_0x4df6e8[_0x0818('0x49')]['id']){delete _0x4df6e8[_0x0818('0x49')]['id'];}return db[_0x0818('0x41')][_0x0818('0x47')]({'where':{'id':_0x4df6e8[_0x0818('0x46')]['id']}})[_0x0818('0x13')](handleEntityNotFound(_0x18983f,null))[_0x0818('0x13')](saveUpdates(_0x4df6e8[_0x0818('0x49')],null))['then'](respondWithResult(_0x18983f,null))[_0x0818('0x1e')](handleError(_0x18983f,null));};exports[_0x0818('0x25')]=function(_0x38968b,_0x15e455){return db[_0x0818('0x41')][_0x0818('0x47')]({'where':{'id':_0x38968b['params']['id']}})['then'](handleEntityNotFound(_0x15e455,null))[_0x0818('0x13')](removeEntity(_0x15e455,null))[_0x0818('0x1e')](handleError(_0x15e455,null));};exports[_0x0818('0x4a')]=function(_0x3dbe2b,_0x24c8be){return db['MailMessage'][_0x0818('0x4a')]()[_0x0818('0x13')](respondWithResult(_0x24c8be,null))[_0x0818('0x1e')](handleError(_0x24c8be,null));};exports[_0x0818('0x4b')]=function(_0x360494,_0x599dd1){return db[_0x0818('0x41')][_0x0818('0x4b')](_0x360494[_0x0818('0x49')])[_0x0818('0x13')](function(_0x5873b6){if(_0x5873b6){if(_0x5873b6['direction']===_0x0818('0x4c')&&!_0x5873b6[_0x0818('0x4d')]){var _0x33d8bd,_0x55db03,_0x3d986e;if(_0x360494['body']['to']){_0x55db03=_0x360494['body']['to'][_0x0818('0x4e')](',')[0x0];}return db[_0x0818('0x4f')][_0x0818('0x50')]({'where':{'id':_0x5873b6['MailAccountId']},'include':[{'model':db[_0x0818('0x51')],'as':_0x0818('0x52'),'include':[{'model':db[_0x0818('0x53')],'as':_0x0818('0x54'),'where':{'email':_0x55db03},'limit':0x1,'order':[[_0x0818('0x55'),_0x0818('0x56')]]}]},{'model':db[_0x0818('0x57')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0818('0x58')],'as':'CloudProvider','raw':!![]}]}]})[_0x0818('0x13')](function(_0x3ed3aa){_0x33d8bd=_0x3ed3aa;if(!_0x33d8bd||!_0x33d8bd[_0x0818('0x59')])return;var _0x1e3db5=_0x33d8bd['getSmtpOptions']();if(_0x360494['body'][_0x0818('0x5a')]&&_0x360494['body']['attachments'][_0x0818('0x37')]){for(var _0x30ad51=0x0;_0x30ad51<_0x360494[_0x0818('0x49')]['attachments'][_0x0818('0x37')];_0x30ad51+=0x1){_0x360494[_0x0818('0x49')][_0x0818('0x5a')][_0x30ad51]={'filename':_0x360494[_0x0818('0x49')]['attachments'][_0x30ad51]['name'],'path':path[_0x0818('0x5b')](config['root'],_0x0818('0x5c'),_0x360494['body'][_0x0818('0x5a')][_0x30ad51]['basename'])};}}_0x3d986e={'account':_0x1e3db5,'message':_0x360494['body']};return;})[_0x0818('0x13')](function(){if(_0x33d8bd['List']){if(_0x33d8bd['List']['Contacts'][_0x0818('0x37')]){return _0x33d8bd['List'][_0x0818('0x54')][0x0];}else{return db['CmContact']['create'](_[_0x0818('0xb')](_0x360494['body'],{'firstName':_0x360494[_0x0818('0x49')]['to'],'email':_0x360494['body']['to'],'phone':_0x360494[_0x0818('0x49')]['to'],'ListId':_0x33d8bd[_0x0818('0x5d')]}));}}else{throw new Error(_0x0818('0x5e'));}})[_0x0818('0x13')](function(){if(_0x3d986e){return respondWithRpcPromise('SendMail',_0x0818('0x5f'),_0x3d986e,client9003)['then'](function(_0x368662){return _0x5873b6[_0x0818('0x48')]({'read':!![],'messageId':_0x368662[_0x0818('0x60')],'sentAt':moment()[_0x0818('0x61')](_0x0818('0x62'))});})[_0x0818('0x1e')](function(_0x55668f){logger[_0x0818('0x18')]('%s',JSON['stringify'](_0x55668f));return _0x5873b6;});}return _0x5873b6;});}return _0x5873b6;}})[_0x0818('0x13')](respondWithResult(_0x599dd1,0xc9))[_0x0818('0x1e')](handleError(_0x599dd1,null));};exports[_0x0818('0x63')]=function(_0x5ae147,_0x3725ba){var _0x563a29={'agent':{},'channel':_0x0818('0x64')};if(_0x5ae147['body']['id']){delete _0x5ae147['body']['id'];}_0x5ae147[_0x0818('0x49')][_0x0818('0x65')]=!![];_0x5ae147[_0x0818('0x49')]['readAt']=moment()[_0x0818('0x61')](_0x0818('0x62'));_0x5ae147[_0x0818('0x49')][_0x0818('0x66')]=_0x5ae147[_0x0818('0x49')][_0x0818('0x66')]||_0x5ae147[_0x0818('0x67')]['id'];_0x563a29[_0x0818('0x68')]['id']=_0x5ae147[_0x0818('0x49')][_0x0818('0x66')];return db[_0x0818('0x41')]['find']({'where':{'id':_0x5ae147[_0x0818('0x46')]['id'],'UserId':null}})[_0x0818('0x13')](handleEntityNotFound(_0x3725ba,null))[_0x0818('0x13')](saveUpdates(_0x5ae147['body'],null))[_0x0818('0x13')](function(_0x48ee49){if(_0x48ee49){_0x563a29['message']=_0x48ee49[_0x0818('0x69')]({'plain':!![]});return db[_0x0818('0x6a')]['find']({'where':{'id':_0x48ee49[_0x0818('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x3725ba,null))[_0x0818('0x13')](function(_0x34210d){if(_0x34210d){return _0x34210d[_0x0818('0x48')]({'UserId':_0x5ae147[_0x0818('0x49')][_0x0818('0x66')],'read1stAt':_[_0x0818('0x6c')](_0x34210d['read1stAt'])?moment()[_0x0818('0x61')](_0x0818('0x62')):undefined});}return null;})['then'](function(_0x443736){if(_0x443736){_0x563a29['interaction']=_0x443736[_0x0818('0x69')]({'plain':!![]});interaction_log[_0x0818('0x1c')](_0x0818('0x6d'),_0x5ae147[_0x0818('0x67')]['id'],_0x5ae147[_0x0818('0x67')]['name'],_0x5ae147[_0x0818('0x67')][_0x0818('0x6e')],_0x563a29[_0x0818('0x6f')]['id'],_0x5ae147[_0x0818('0x49')]?JSON[_0x0818('0x17')](_0x5ae147['body']):_0x0818('0x70'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x563a29);}return null;})['then'](function(_0x19ff15){var _0xc3036d=_0x0818('0x71')+_0x19ff15[_0x0818('0x1b')][_0x0818('0x72')];return db['sequelize'][_0x0818('0x31')](_0xc3036d,{'type':db[_0x0818('0x73')][_0x0818('0x74')][_0x0818('0x75')],'raw':!![]})[_0x0818('0x13')](function(_0x107ff0){return _0x107ff0;});})['then'](function(_0x80a6f4){if(_0x80a6f4){_0x563a29['message'][_0x0818('0x76')]=_0x80a6f4[0x0];if(!_0x5ae147[_0x0818('0x49')][_0x0818('0x66')])return;return db['User'][_0x0818('0x47')]({'where':{'id':_0x5ae147[_0x0818('0x49')][_0x0818('0x66')],'role':_0x0818('0x68')},'attributes':['id',_0x0818('0x30'),_0x0818('0x77'),_0x0818('0x78'),_0x0818('0x79')],'raw':!![]});}return null;})[_0x0818('0x13')](function(_0x48bea6){if(!_0x48bea6)return null;_0x563a29['message']['agent']=_0x48bea6;return _0x563a29;})[_0x0818('0x13')](function(_0x510355){if(_0x510355){if(_0x5ae147[_0x0818('0x49')][_0x0818('0x7a')]){_0x563a29[_0x0818('0x1b')]['interface']=util['format']('SIP/%s',_0x5ae147[_0x0818('0x67')][_0x0818('0x30')]);_0x563a29[_0x0818('0x1b')][_0x0818('0x7b')]=_0x563a29[_0x0818('0x7b')];_0x563a29['message'][_0x0818('0x7c')]=_0x563a29[_0x0818('0x7b')];_0x563a29[_0x0818('0x1b')][_0x0818('0x7d')]=_0x0818('0x63');_0x563a29['message'][_0x0818('0x49')]=htmlToText[_0x0818('0x7e')](_0x563a29[_0x0818('0x1b')]['body']);return respondWithRpcPromise(_0x0818('0x7f'),_0x0818('0x7f'),{'event':'acceptmessage','message':_0x563a29['message']},client9002)[_0x0818('0x13')](function(){return _0x563a29;});}return _0x563a29;}return null;})[_0x0818('0x13')](respondWithResult(_0x3725ba,null))[_0x0818('0x1e')](handleError(_0x3725ba,null));};exports[_0x0818('0x80')]=function(_0x2a3869,_0x127765){var _0x12d9de={'agent':{},'channel':_0x0818('0x64')};if(_0x2a3869['body']['id']){delete _0x2a3869[_0x0818('0x49')]['id'];}_0x2a3869[_0x0818('0x49')][_0x0818('0x66')]=_0x2a3869['body'][_0x0818('0x66')]||_0x2a3869['user']['id'];_0x12d9de[_0x0818('0x68')]['id']=_0x2a3869['body']['UserId'];return db[_0x0818('0x41')][_0x0818('0x47')]({'where':{'id':_0x2a3869[_0x0818('0x46')]['id'],'UserId':null}})[_0x0818('0x13')](handleEntityNotFound(_0x127765,null))[_0x0818('0x13')](function(_0x524783){if(_0x524783){_0x12d9de[_0x0818('0x1b')]=_0x524783[_0x0818('0x69')]({'plain':!![]});return db[_0x0818('0x6a')]['find']({'where':{'id':_0x524783[_0x0818('0x6b')]}});}return null;})[_0x0818('0x13')](handleEntityNotFound(_0x127765,null))[_0x0818('0x13')](function(_0x53dbea){if(_0x53dbea){_0x12d9de[_0x0818('0x6f')]=_0x53dbea[_0x0818('0x69')]({'plain':!![]});interaction_log[_0x0818('0x1c')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a3869[_0x0818('0x67')]['id'],_0x2a3869[_0x0818('0x67')]['name'],_0x2a3869[_0x0818('0x67')][_0x0818('0x6e')],_0x12d9de[_0x0818('0x6f')]['id'],_0x2a3869['body']?JSON[_0x0818('0x17')](_0x2a3869['body']):_0x0818('0x70'));return respondWithRpcPromise('RejectMessage',_0x0818('0x81'),_0x12d9de);}return null;})[_0x0818('0x13')](function(_0x2b478c){var _0x287917=_0x0818('0x71')+_0x2b478c[_0x0818('0x1b')]['ContactId'];return db[_0x0818('0x82')][_0x0818('0x31')](_0x287917,{'type':db['Sequelize'][_0x0818('0x74')][_0x0818('0x75')],'raw':!![]})[_0x0818('0x13')](function(_0x5868e6){return _0x5868e6;});})[_0x0818('0x13')](function(_0x59c175){if(_0x59c175){_0x12d9de[_0x0818('0x1b')]['contact']=_0x59c175[0x0];if(!_0x2a3869[_0x0818('0x49')][_0x0818('0x66')])return;return db[_0x0818('0x83')]['find']({'where':{'id':_0x2a3869[_0x0818('0x49')][_0x0818('0x66')],'role':_0x0818('0x68')},'attributes':['id',_0x0818('0x30'),'fullname',_0x0818('0x78'),_0x0818('0x79')],'raw':!![]});}return null;})[_0x0818('0x13')](function(_0x282dd9){if(!_0x282dd9)return null;_0x12d9de[_0x0818('0x1b')]['agent']=_0x282dd9;return _0x12d9de;})[_0x0818('0x13')](function(_0xb54664){if(_0xb54664){_0xb54664[_0x0818('0x1b')][_0x0818('0x84')]=util[_0x0818('0x61')](_0x0818('0x85'),_0x2a3869[_0x0818('0x67')][_0x0818('0x30')]);_0xb54664[_0x0818('0x1b')][_0x0818('0x7b')]=_0x12d9de[_0x0818('0x7b')];_0xb54664[_0x0818('0x1b')]['motionChannel']=_0x12d9de[_0x0818('0x7b')];_0xb54664['message'][_0x0818('0x7d')]=_0x0818('0x80');_0xb54664['message'][_0x0818('0x49')]=htmlToText[_0x0818('0x7e')](_0x12d9de[_0x0818('0x1b')][_0x0818('0x49')]);respondWithRpcPromise(_0x0818('0x7f'),_0x0818('0x7f'),{'event':_0x0818('0x86'),'message':_0xb54664[_0x0818('0x1b')]},client9002);return _0x12d9de;}return null;})[_0x0818('0x13')](respondWithResult(_0x127765,null))[_0x0818('0x1e')](handleError(_0x127765,null));};exports[_0x0818('0x87')]=function(_0x4d56fc,_0x4b8be7){var _0x482ca3=moment()[_0x0818('0x88')]()['toString']();var _0x35201b=path[_0x0818('0x5b')](config[_0x0818('0x89')],'server',_0x0818('0x8a'),_0x0818('0x8b'));var _0x162483=path['join'](config[_0x0818('0x89')],_0x0818('0x8c'),_0x0818('0x8a'),_0x0818('0x5a'));var _0x2059a3=util[_0x0818('0x61')](_0x0818('0x8d'),_0x482ca3);return db['MailMessage'][_0x0818('0x47')]({'where':{'id':_0x4d56fc[_0x0818('0x46')]['id']},'attributes':['id',_0x0818('0x49'),_0x0818('0x8e'),'to','cc',_0x0818('0x8f'),_0x0818('0x90'),_0x0818('0x91')],'include':_0x4d56fc[_0x0818('0x31')][_0x0818('0x5a')]?[{'model':db[_0x0818('0x92')],'as':_0x0818('0x93')}]:undefined})[_0x0818('0x13')](handleEntityNotFound(_0x4b8be7,null))[_0x0818('0x13')](function(_0x4e51d3){if(_0x4e51d3){var _0x3f9b8b=_0x4e51d3;var _0x174219={'from':_0x3f9b8b[_0x0818('0x8e')],'to':_0x3f9b8b['to'],'subject':_0x3f9b8b['subject'],'html':htmlEntities[_0x0818('0x94')](_0x3f9b8b[_0x0818('0x49')]),'headers':{'Date':moment(_0x3f9b8b['createdAt'])[_0x0818('0x61')](_0x0818('0x95'))},'attachments':[]};if(_0x4e51d3['cc']){_0x174219[_0x0818('0x96')]['Cc']=_0x4e51d3['cc'];}if(_0x4e51d3['bcc']){_0x174219['headers'][_0x0818('0x97')]=_0x4e51d3[_0x0818('0x8f')];}return new BPromise(function(_0x3ff407,_0x28cb98){if(_0x4e51d3['Attachments']){for(var _0x49a552=0x0;_0x49a552<_0x4e51d3[_0x0818('0x93')][_0x0818('0x37')];_0x49a552++){var _0x34670c=_0x4e51d3[_0x0818('0x93')][_0x49a552];var _0x1cf887=path['join'](_0x162483,_0x34670c['basename']);if(fs[_0x0818('0x98')](_0x1cf887)){_0x174219[_0x0818('0x5a')][_0x0818('0x99')]({'name':_0x34670c[_0x0818('0x30')],'contentType':_0x34670c['type'],'data':fs['readFileSync'](_0x1cf887)});}}}emlformat[_0x0818('0x9a')](_0x174219,function(_0x14e111,_0x48e444){if(_0x14e111)return _0x28cb98(_0x14e111);fs[_0x0818('0x9b')](path[_0x0818('0x5b')](_0x35201b,_0x2059a3),_0x48e444);return _0x3ff407(_0x48e444);});});}})[_0x0818('0x13')](function(_0x3f39d1){if(_0x3f39d1){return _0x4b8be7[_0x0818('0x87')](path[_0x0818('0x5b')](_0x35201b,_0x2059a3),_0x2059a3,function(_0x37af03){if(!_0x37af03)fs['unlinkSync'](path[_0x0818('0x5b')](_0x35201b,_0x2059a3));});}})['catch'](handleError(_0x4b8be7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5ee49ba..bb9e2f7 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 _0xa2b9=['../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xa2b9,0x1a3));var _0x9a2b=function(_0x3df3c6,_0x496e1a){_0x3df3c6=_0x3df3c6-0x0;var _0x254c43=_0xa2b9[_0x3df3c6];return _0x254c43;};'use strict';var EventEmitter=require(_0x9a2b('0x0'));var MailMessage=require(_0x9a2b('0x1'))['db'][_0x9a2b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9a2b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a2b('0x4'),'afterDestroy':_0x9a2b('0x5')};function emitEvent(_0x42bc0a){return function(_0x580ed4,_0x543ef2,_0x1b4f6d){MailMessageEvents[_0x9a2b('0x6')](_0x42bc0a+':'+_0x580ed4['id'],_0x580ed4);MailMessageEvents[_0x9a2b('0x6')](_0x42bc0a,_0x580ed4);_0x1b4f6d(null);};}for(var e in events){if(events[_0x9a2b('0x7')](e)){var event=events[e];MailMessage[_0x9a2b('0x8')](e,emitEvent(event));}}module[_0x9a2b('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x0606=['MailMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x483459,_0xb1f591){var _0x22711e=function(_0x47712d){while(--_0x47712d){_0x483459['push'](_0x483459['shift']());}};_0x22711e(++_0xb1f591);}(_0x0606,0x76));var _0x6060=function(_0x2a7c97,_0x714dfd){_0x2a7c97=_0x2a7c97-0x0;var _0x1cdc9b=_0x0606[_0x2a7c97];return _0x1cdc9b;};'use strict';var EventEmitter=require(_0x6060('0x0'));var MailMessage=require(_0x6060('0x1'))['db'][_0x6060('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6060('0x3')](0x0);var events={'afterCreate':_0x6060('0x4'),'afterUpdate':_0x6060('0x5'),'afterDestroy':_0x6060('0x6')};function emitEvent(_0x70f622){return function(_0x50218a,_0x31b0fe,_0x151617){MailMessageEvents['emit'](_0x70f622+':'+_0x50218a['id'],_0x50218a);MailMessageEvents['emit'](_0x70f622,_0x50218a);_0x151617(null);};}for(var e in events){if(events[_0x6060('0x7')](e)){var event=events[e];MailMessage[_0x6060('0x8')](e,emitEvent(event));}}module[_0x6060('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f5c4c79..356fa4e 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 _0xf270=['path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','fromString','models','get','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','direction','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text'];(function(_0x463f6b,_0x1b0d55){var _0x751f95=function(_0x40dcc4){while(--_0x40dcc4){_0x463f6b['push'](_0x463f6b['shift']());}};_0x751f95(++_0x1b0d55);}(_0xf270,0xcb));var _0x0f27=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0xf270[_0x2a6d45];return _0x295253;};'use strict';var _=require(_0x0f27('0x0'));var util=require(_0x0f27('0x1'));var logger=require(_0x0f27('0x2'))('api');var moment=require(_0x0f27('0x3'));var BPromise=require(_0x0f27('0x4'));var rp=require(_0x0f27('0x5'));var htmlToText=require(_0x0f27('0x6'));var fs=require('fs');var path=require(_0x0f27('0x7'));var rimraf=require(_0x0f27('0x8'));var config=require(_0x0f27('0x9'));var attributes=require(_0x0f27('0xa'));module[_0x0f27('0xb')]=function(_0x2f7bff,_0x1ce43b){return _0x2f7bff[_0x0f27('0xc')](_0x0f27('0xd'),attributes,{'tableName':_0x0f27('0xe'),'paranoid':![],'indexes':[{'name':_0x0f27('0xf'),'fields':['messageId']},{'name':_0x0f27('0x10'),'fields':[_0x0f27('0x11'),'subject'],'type':_0x0f27('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x324cf6,_0x3d56da,_0x142eec){if(_0x324cf6['body']){_0x324cf6[_0x0f27('0x11')]=htmlToText[_0x0f27('0x13')](_0x324cf6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x142eec(null,_0x3d56da);},'afterCreate':function(_0x5b1e5a,_0x5d57c7,_0x1882cb){var _0x55db3c=_0x2f7bff[_0x0f27('0x14')];var _0x39eb12=_0x5b1e5a[_0x0f27('0x15')]({'plain':!![]});if(_0x39eb12['direction'][_0x0f27('0x16')]()==='in'||_0x39eb12['direction'][_0x0f27('0x16')]()===_0x0f27('0x17')&&!_0x39eb12['secret']&&!_[_0x0f27('0x18')](_0x39eb12[_0x0f27('0x19')])){_0x55db3c['MailInteraction'][_0x0f27('0x1a')]({'where':{'id':_0x39eb12[_0x0f27('0x1b')]}})[_0x0f27('0x1c')](function(_0x26e042){if(_0x26e042){_0x26e042[_0x0f27('0x1d')]({'lastMsgAt':_0x39eb12[_0x0f27('0x1e')],'lastMsgDirection':_0x39eb12[_0x0f27('0x1f')][_0x0f27('0x16')]()});}})[_0x0f27('0x20')](function(_0x334e11){console['error'](_0x334e11);});}_0x1882cb();}},'charset':_0x0f27('0x21'),'collate':_0x0f27('0x22')});}; \ No newline at end of file +var _0x93e9=['catch','error','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','createdAt'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x93e9,0x1df));var _0x993e=function(_0x3111df,_0x5e20a7){_0x3111df=_0x3111df-0x0;var _0x37471=_0x93e9[_0x3111df];return _0x37471;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x993e('0x0'))('api');var moment=require(_0x993e('0x1'));var BPromise=require(_0x993e('0x2'));var rp=require(_0x993e('0x3'));var htmlToText=require(_0x993e('0x4'));var fs=require('fs');var path=require(_0x993e('0x5'));var rimraf=require(_0x993e('0x6'));var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x49556b,_0x50ee0b){return _0x49556b[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[{'name':_0x993e('0xd'),'fields':['messageId']},{'name':_0x993e('0xe'),'fields':['plainBody','subject'],'type':_0x993e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x6d629,_0x5f0aa5,_0x5a0096){if(_0x6d629[_0x993e('0x10')]){_0x6d629[_0x993e('0x11')]=htmlToText[_0x993e('0x12')](_0x6d629[_0x993e('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5a0096(null,_0x5f0aa5);},'afterCreate':function(_0x133f78,_0x2715aa,_0x4557a7){var _0x13100c=_0x49556b[_0x993e('0x13')];var _0x201665=_0x133f78[_0x993e('0x14')]({'plain':!![]});if(_0x201665[_0x993e('0x15')]['toLowerCase']()==='in'||_0x201665[_0x993e('0x15')][_0x993e('0x16')]()===_0x993e('0x17')&&!_0x201665[_0x993e('0x18')]&&!_[_0x993e('0x19')](_0x201665[_0x993e('0x1a')])){_0x13100c[_0x993e('0x1b')]['findOne']({'where':{'id':_0x201665[_0x993e('0x1c')]}})[_0x993e('0x1d')](function(_0x49908b){if(_0x49908b){_0x49908b['update']({'lastMsgAt':_0x201665[_0x993e('0x1e')],'lastMsgDirection':_0x201665['direction'][_0x993e('0x16')]()});}})[_0x993e('0x1f')](function(_0x3398b3){console[_0x993e('0x20')](_0x3398b3);});}_0x4557a7();}},'charset':'utf8mb4','collate':_0x993e('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d2cfe29..08fa0c3 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 _0x1eba=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x1eba[_0x5e6bec];return _0x5dc5cf;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});config[_0xa1eb('0xc')]=_[_0xa1eb('0xd')](config[_0xa1eb('0xc')],{'host':_0xa1eb('0xe'),'port':0x18eb});var socket=require(_0xa1eb('0xf'))(new Redis(config['redis']));require(_0xa1eb('0x10'))['register'](socket);function respondWithRpcPromise(_0x219802,_0x54cdad,_0x3f53ff){return new BPromise(function(_0x5d7101,_0x41a7bc){return client['request'](_0x219802,_0x3f53ff)[_0xa1eb('0x11')](function(_0x325d13){logger[_0xa1eb('0x12')]('MailMessage,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'));logger[_0xa1eb('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'),JSON['stringify'](_0x325d13));if(_0x325d13['error']){if(_0x325d13[_0xa1eb('0x15')]['code']===0x1f4){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);return _0x41a7bc(_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);}logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')]['message']);return _0x5d7101(_0x325d13[_0xa1eb('0x15')]['message']);}else{logger[_0xa1eb('0x12')](_0xa1eb('0x16'),_0x54cdad,_0xa1eb('0x13'));_0x5d7101(_0x325d13[_0xa1eb('0x18')]['message']);}})[_0xa1eb('0x19')](function(_0x22cd44){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x22cd44);_0x41a7bc(_0x22cd44);});});}exports[_0xa1eb('0x1a')]=function(_0x3b8607){var _0x2143e6=this;return new Promise(function(_0x166f7f,_0x4fc14a){return db[_0xa1eb('0x1b')]['create'](_0x3b8607[_0xa1eb('0x1c')],{'raw':_0x3b8607[_0xa1eb('0x1d')]?_0x3b8607[_0xa1eb('0x1d')][_0xa1eb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x539634){logger[_0xa1eb('0x12')](_0xa1eb('0x1a'),_0x3b8607);logger['debug'](_0xa1eb('0x1a'),_0x3b8607,JSON[_0xa1eb('0x1f')](_0x539634));_0x166f7f(_0x539634);})[_0xa1eb('0x19')](function(_0xa6b20c){logger[_0xa1eb('0x15')](_0xa1eb('0x1a'),_0xa6b20c[_0xa1eb('0x17')],_0x3b8607);_0x4fc14a(_0x2143e6[_0xa1eb('0x15')](0x1f4,_0xa6b20c[_0xa1eb('0x17')]));});});}; \ No newline at end of file +var _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e0231,_0x3c00e6){var _0x574aa0=function(_0x21d2a6){while(--_0x21d2a6){_0x2e0231['push'](_0x2e0231['shift']());}};_0x574aa0(++_0x3c00e6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47cc8e,_0x30574c){_0x47cc8e=_0x47cc8e-0x0;var _0x9951=_0x5f2f[_0x47cc8e];return _0x9951;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./mailMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateMailMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8c0bd0b..ed228c8 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 _0xb379=['emit','length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x1566d9,_0x2f1c84){var _0x4e2d88=function(_0x4840ee){while(--_0x4840ee){_0x1566d9['push'](_0x1566d9['shift']());}};_0x4e2d88(++_0x2f1c84);}(_0xb379,0x16b));var _0x9b37=function(_0x1bedd2,_0x53bc08){_0x1bedd2=_0x1bedd2-0x0;var _0x5bee62=_0xb379[_0x1bedd2];return _0x5bee62;};'use strict';var MailMessageEvents=require(_0x9b37('0x0'));var events=['save',_0x9b37('0x1'),_0x9b37('0x2')];function createListener(_0x1bda6a,_0x580282){return function(_0x44b762){_0x580282[_0x9b37('0x3')](_0x1bda6a,_0x44b762);};}function removeListener(_0x2f4618,_0x89fd51){return function(){MailMessageEvents['removeListener'](_0x2f4618,_0x89fd51);};}exports['register']=function(_0x344fb5){for(var _0x371d38=0x0,_0x170765=events[_0x9b37('0x4')];_0x371d38<_0x170765;_0x371d38++){var _0x2fba29=events[_0x371d38];var _0x46b93b=createListener(_0x9b37('0x5')+_0x2fba29,_0x344fb5);MailMessageEvents['on'](_0x2fba29,_0x46b93b);}}; \ No newline at end of file +var _0x780f=['emit','removeListener','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0xac3b20,_0x48e68c){var _0x580caf=function(_0xa07fcd){while(--_0xa07fcd){_0xac3b20['push'](_0xac3b20['shift']());}};_0x580caf(++_0x48e68c);}(_0x780f,0x6c));var _0xf780=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x780f[_0x295a3d];return _0x23a732;};'use strict';var MailMessageEvents=require(_0xf780('0x0'));var events=[_0xf780('0x1'),_0xf780('0x2'),_0xf780('0x3')];function createListener(_0xe9686a,_0x4ede54){return function(_0x5a7301){_0x4ede54[_0xf780('0x4')](_0xe9686a,_0x5a7301);};}function removeListener(_0x26ed87,_0x1a22c0){return function(){MailMessageEvents[_0xf780('0x5')](_0x26ed87,_0x1a22c0);};}exports['register']=function(_0x37b0a2){for(var _0x4b55e7=0x0,_0x1bd856=events[_0xf780('0x6')];_0x4b55e7<_0x1bd856;_0x4b55e7++){var _0x1c3fdc=events[_0x4b55e7];var _0xa12d00=createListener(_0xf780('0x7')+_0x1c3fdc,_0x37b0a2);MailMessageEvents['on'](_0x1c3fdc,_0xa12d00);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9f1f284..e2e0336 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 _0x92d0=['post','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x259c04,_0x3539aa){var _0x36e2ad=function(_0x2445ab){while(--_0x2445ab){_0x259c04['push'](_0x259c04['shift']());}};_0x36e2ad(++_0x3539aa);}(_0x92d0,0x19d));var _0x092d=function(_0xe8b420,_0x1a892d){_0xe8b420=_0xe8b420-0x0;var _0x50f7b7=_0x92d0[_0xe8b420];return _0x50f7b7;};'use strict';var multer=require(_0x092d('0x0'));var util=require(_0x092d('0x1'));var path=require('path');var timeout=require(_0x092d('0x2'));var express=require(_0x092d('0x3'));var router=express[_0x092d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x092d('0x5'));var config=require(_0x092d('0x6'));var controller=require(_0x092d('0x7'));router[_0x092d('0x8')]('/',auth[_0x092d('0x9')](),controller[_0x092d('0xa')]);router[_0x092d('0x8')](_0x092d('0xb'),auth[_0x092d('0x9')](),controller[_0x092d('0xc')]);router[_0x092d('0x8')](_0x092d('0xd'),auth['isAuthenticated'](),controller[_0x092d('0xe')]);router[_0x092d('0x8')](_0x092d('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x092d('0x10'),auth[_0x092d('0x9')](),controller[_0x092d('0x11')]);router[_0x092d('0x8')](_0x092d('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x092d('0x13')]('/',auth[_0x092d('0x9')](),controller['create']);router['post'](_0x092d('0x10'),auth[_0x092d('0x9')](),controller['addTeams']);router[_0x092d('0x13')](_0x092d('0x12'),auth[_0x092d('0x9')](),controller[_0x092d('0x14')]);router[_0x092d('0x15')](_0x092d('0xd'),auth[_0x092d('0x9')](),controller[_0x092d('0x16')]);router[_0x092d('0x17')](_0x092d('0xd'),auth['isAuthenticated'](),controller[_0x092d('0x18')]);router[_0x092d('0x17')](_0x092d('0x10'),auth[_0x092d('0x9')](),controller[_0x092d('0x19')]);router[_0x092d('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x092d('0x1a')]=router; \ No newline at end of file +var _0xf6be=['put','update','destroy','delete','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents'];(function(_0x5da730,_0x27c81c){var _0x459c62=function(_0x506a8e){while(--_0x506a8e){_0x5da730['push'](_0x5da730['shift']());}};_0x459c62(++_0x27c81c);}(_0xf6be,0x82));var _0xef6b=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xf6be[_0x252328];return _0xaa85b7;};'use strict';var multer=require(_0xef6b('0x0'));var util=require(_0xef6b('0x1'));var path=require(_0xef6b('0x2'));var timeout=require('connect-timeout');var express=require(_0xef6b('0x3'));var router=express[_0xef6b('0x4')]();var fs_extra=require(_0xef6b('0x5'));var auth=require(_0xef6b('0x6'));var interaction=require(_0xef6b('0x7'));var config=require(_0xef6b('0x8'));var controller=require(_0xef6b('0x9'));router[_0xef6b('0xa')]('/',auth[_0xef6b('0xb')](),controller[_0xef6b('0xc')]);router[_0xef6b('0xa')]('/describe',auth[_0xef6b('0xb')](),controller[_0xef6b('0xd')]);router['get'](_0xef6b('0xe'),auth[_0xef6b('0xb')](),controller[_0xef6b('0xf')]);router[_0xef6b('0xa')](_0xef6b('0x10'),auth[_0xef6b('0xb')](),controller[_0xef6b('0x11')]);router[_0xef6b('0xa')]('/:id/teams',auth[_0xef6b('0xb')](),controller[_0xef6b('0x12')]);router[_0xef6b('0xa')](_0xef6b('0x13'),auth[_0xef6b('0xb')](),controller[_0xef6b('0x14')]);router[_0xef6b('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef6b('0x15')](_0xef6b('0x16'),auth[_0xef6b('0xb')](),controller[_0xef6b('0x17')]);router[_0xef6b('0x15')]('/:id/users',auth[_0xef6b('0xb')](),controller[_0xef6b('0x18')]);router[_0xef6b('0x19')]('/:id',auth[_0xef6b('0xb')](),controller[_0xef6b('0x1a')]);router['delete'](_0xef6b('0xe'),auth[_0xef6b('0xb')](),controller[_0xef6b('0x1b')]);router[_0xef6b('0x1c')](_0xef6b('0x16'),auth[_0xef6b('0xb')](),controller[_0xef6b('0x1d')]);router[_0xef6b('0x1c')]('/:id/users',auth[_0xef6b('0xb')](),controller['removeAgents']);module[_0xef6b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e6772f3..28ed462 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 _0xb831=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x4a6741,_0x5113be){var _0x138c39=function(_0xf37d9a){while(--_0xf37d9a){_0x4a6741['push'](_0x4a6741['shift']());}};_0x138c39(++_0x5113be);}(_0xb831,0x159));var _0x1b83=function(_0x3d414a,_0x34fa18){_0x3d414a=_0x3d414a-0x0;var _0x1d4abc=_0xb831[_0x3d414a];return _0x1d4abc;};'use strict';var Sequelize=require(_0x1b83('0x0'));module[_0x1b83('0x1')]={'name':{'type':Sequelize[_0x1b83('0x2')],'unique':_0x1b83('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b83('0x2')]},'timeout':{'type':Sequelize[_0x1b83('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b83('0x5')](_0x1b83('0x6'),_0x1b83('0x7'),_0x1b83('0x8'))}}; \ No newline at end of file +var _0xd017=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xd017,0x165));var _0x7d01=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xd017[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x7d01('0x0'));module[_0x7d01('0x1')]={'name':{'type':Sequelize[_0x7d01('0x2')],'unique':_0x7d01('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d01('0x2')]},'timeout':{'type':Sequelize[_0x7d01('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d01('0x5')](_0x7d01('0x6'),_0x7d01('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 753849d..72be051 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 _0x54d2=['type','key','getOptions','where','MailQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','nolimit','limit','sort','pick','MailQueueId','merge','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','findOne','Team','getTeams','hasOwnProperty','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','forEach','emit','userMailQueue:remove','spread','isArray','getAgents','order','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./mailQueue.socket','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','then','destroy','MailQueues','error','stack','name','send','map','rawAttributes','fieldName'];(function(_0x4e8d06,_0xe6367b){var _0x3cae4a=function(_0x1b76fd){while(--_0x1b76fd){_0x4e8d06['push'](_0x4e8d06['shift']());}};_0x3cae4a(++_0xe6367b);}(_0x54d2,0x1ca));var _0x254d=function(_0xc79e5a,_0x17c9f5){_0xc79e5a=_0xc79e5a-0x0;var _0x506af5=_0x54d2[_0xc79e5a];return _0x506af5;};'use strict';var BPromise=require(_0x254d('0x0'));var util=require(_0x254d('0x1'));var _=require(_0x254d('0x2'));var squel=require(_0x254d('0x3'));var Redis=require('ioredis');var qs=require(_0x254d('0x4'));var logger=require('../../config/logger')(_0x254d('0x5'));var config=require(_0x254d('0x6'));var db=require(_0x254d('0x7'))['db'];config[_0x254d('0x8')]=_['defaults'](config[_0x254d('0x8')],{'host':_0x254d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x254d('0xa'))['register'](socket);function respondWithStatusCode(_0x3fcb48,_0x5e3534){_0x5e3534=_0x5e3534||0xcc;return function(_0x52182c){if(_0x52182c){return _0x3fcb48[_0x254d('0xb')](_0x5e3534);}return _0x3fcb48[_0x254d('0xc')](_0x5e3534)[_0x254d('0xd')]();};}function respondWithResult(_0x569213,_0x312d5d){_0x312d5d=_0x312d5d||0xc8;return function(_0x217736){if(_0x217736){return _0x569213[_0x254d('0xc')](_0x312d5d)[_0x254d('0xe')](_0x217736);}};}function respondWithFilteredResult(_0x25c125,_0x2530a0){return function(_0x49cca3){if(_0x49cca3){var _0x2a4d0c=typeof _0x2530a0['offset']===_0x254d('0xf')&&typeof _0x2530a0['limit']===_0x254d('0xf');var _0x11b9cb=_0x49cca3['count'];var _0x33caef=_0x2a4d0c?0x0:_0x2530a0[_0x254d('0x10')];var _0x1dc1aa=_0x2a4d0c?_0x49cca3[_0x254d('0x11')]:_0x2530a0[_0x254d('0x10')]+_0x2530a0['limit'];var _0x34afa6;if(_0x1dc1aa>=_0x11b9cb){_0x1dc1aa=_0x11b9cb;_0x34afa6=0xc8;}else{_0x34afa6=0xce;}_0x25c125[_0x254d('0xc')](_0x34afa6);return _0x25c125[_0x254d('0x12')](_0x254d('0x13'),_0x33caef+'-'+_0x1dc1aa+'/'+_0x11b9cb)[_0x254d('0xe')](_0x49cca3);}return null;};}function saveUpdates(_0x15838e){return function(_0x2e59a8){if(_0x2e59a8){return _0x2e59a8['update'](_0x15838e)[_0x254d('0x14')](function(_0x40d344){return _0x40d344;});}return null;};}function removeEntity(_0x5b5fb0){return function(_0x4664f8){if(_0x4664f8){return _0x4664f8[_0x254d('0x15')]()[_0x254d('0x14')](function(){var _0x2a094d=_0x4664f8['get']({'plain':!![]});var _0x3f2551=_0x254d('0x16');return db['UserProfileResource'][_0x254d('0x15')]({'where':{'type':_0x3f2551,'resourceId':_0x2a094d['id']}})['then'](function(){return _0x4664f8;});})[_0x254d('0x14')](function(){_0x5b5fb0[_0x254d('0xc')](0xcc)[_0x254d('0xd')]();});}};}function handleEntityNotFound(_0x96efb1){return function(_0x26735b){if(!_0x26735b){_0x96efb1[_0x254d('0xb')](0x194);}return _0x26735b;};}function handleError(_0x52edeb,_0x1140ae){_0x1140ae=_0x1140ae||0x1f4;return function(_0x3ab642){logger[_0x254d('0x17')](_0x3ab642[_0x254d('0x18')]);if(_0x3ab642[_0x254d('0x19')]){delete _0x3ab642[_0x254d('0x19')];}_0x52edeb['status'](_0x1140ae)[_0x254d('0x1a')](_0x3ab642);};}exports['index']=function(_0x1c0c88,_0x1f5bb4){var _0x546f7f={};var _0x56ad50={'count':0x0,'rows':[]};var _0x449acd=_[_0x254d('0x1b')](db['MailQueue'][_0x254d('0x1c')],function(_0x168a3d){return{'name':_0x168a3d[_0x254d('0x1d')],'type':_0x168a3d[_0x254d('0x1e')][_0x254d('0x1f')]};});_0x546f7f=qs[_0x254d('0x20')](_0x449acd,_0x1c0c88);var _0x4e2a08={'where':_0x546f7f[_0x254d('0x21')]};return db[_0x254d('0x22')][_0x254d('0x11')](_0x4e2a08)[_0x254d('0x14')](function(_0x2af3ea){_0x56ad50['count']=_0x2af3ea;_0x546f7f['include']=qs[_0x254d('0x23')](_0x1c0c88[_0x254d('0x24')]);return db['MailQueue'][_0x254d('0x25')](_0x546f7f);})['then'](function(_0x4d6fdb){_0x56ad50[_0x254d('0x26')]=_0x4d6fdb;return _0x56ad50;})[_0x254d('0x14')](respondWithFilteredResult(_0x1f5bb4,_0x546f7f))[_0x254d('0x27')](handleError(_0x1f5bb4,null));};exports[_0x254d('0x28')]=function(_0x56ecf4,_0x2b42de){var _0x32a93f={'raw':!![],'where':{'id':_0x56ecf4[_0x254d('0x29')]['id']}},_0xf9b910={};_0xf9b910[_0x254d('0x2a')]=_[_0x254d('0x2b')](db[_0x254d('0x22')][_0x254d('0x1c')]);_0xf9b910[_0x254d('0x24')]=_['keys'](_0x56ecf4[_0x254d('0x24')]);_0xf9b910[_0x254d('0x2c')]=_[_0x254d('0x2d')](_0xf9b910['model'],_0xf9b910[_0x254d('0x24')]);_0x32a93f[_0x254d('0x2e')]=_[_0x254d('0x2d')](_0xf9b910['model'],qs[_0x254d('0x2f')](_0x56ecf4['query'][_0x254d('0x2f')]));_0x32a93f[_0x254d('0x2e')]=_0x32a93f[_0x254d('0x2e')][_0x254d('0x30')]?_0x32a93f['attributes']:_0xf9b910[_0x254d('0x2a')];if(_0x56ecf4[_0x254d('0x24')]['includeAll']){_0x32a93f[_0x254d('0x23')]=[{'all':!![]}];}_0x32a93f=_['merge']({},_0x32a93f,_0x56ecf4[_0x254d('0x31')]);return db[_0x254d('0x22')][_0x254d('0x32')](_0x32a93f)[_0x254d('0x14')](handleEntityNotFound(_0x2b42de,null))[_0x254d('0x14')](respondWithResult(_0x2b42de,null))[_0x254d('0x27')](handleError(_0x2b42de,null));};exports[_0x254d('0x33')]=function(_0x2badcd,_0x5ba2b8){return db['MailQueue'][_0x254d('0x33')](_0x2badcd[_0x254d('0x34')],{})[_0x254d('0x14')](function(_0x47314c){var _0x259afc=_0x2badcd[_0x254d('0x35')][_0x254d('0x36')]({'plain':!![]});if(!_0x259afc)throw new Error(_0x254d('0x37'));if(_0x259afc[_0x254d('0x38')]==='user'){var _0x1d741d=_0x47314c[_0x254d('0x36')]({'plain':!![]});var _0x5eb9bc=_0x254d('0x16');return db[_0x254d('0x39')][_0x254d('0x32')]({'where':{'name':_0x5eb9bc,'userProfileId':_0x259afc['userProfileId']},'raw':!![]})[_0x254d('0x14')](function(_0x5629e5){if(_0x5629e5&&_0x5629e5[_0x254d('0x3a')]===0x0){return db[_0x254d('0x3b')][_0x254d('0x33')]({'name':_0x1d741d[_0x254d('0x19')],'resourceId':_0x1d741d['id'],'type':_0x5629e5[_0x254d('0x19')],'sectionId':_0x5629e5['id']},{})[_0x254d('0x14')](function(){return _0x47314c;});}else{return _0x47314c;}})[_0x254d('0x27')](function(_0x633032){logger['error'](_0x254d('0x3c'),_0x633032);throw _0x633032;});}return _0x47314c;})[_0x254d('0x14')](respondWithResult(_0x5ba2b8,0xc9))[_0x254d('0x27')](handleError(_0x5ba2b8,null));};exports['update']=function(_0x288849,_0x328a2b){if(_0x288849['body']['id']){delete _0x288849[_0x254d('0x34')]['id'];}return db[_0x254d('0x22')][_0x254d('0x32')]({'where':{'id':_0x288849['params']['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x328a2b,null))[_0x254d('0x14')](saveUpdates(_0x288849['body'],null))[_0x254d('0x14')](respondWithResult(_0x328a2b,null))[_0x254d('0x27')](handleError(_0x328a2b,null));};exports[_0x254d('0x15')]=function(_0x18f975,_0x216333){return db['MailQueue']['find']({'where':{'id':_0x18f975[_0x254d('0x29')]['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x216333,null))['then'](removeEntity(_0x216333,null))[_0x254d('0x27')](handleError(_0x216333,null));};exports[_0x254d('0x3d')]=function(_0x33f369,_0xc42a3d){return db['MailQueue'][_0x254d('0x3d')]()[_0x254d('0x14')](respondWithResult(_0xc42a3d,null))[_0x254d('0x27')](handleError(_0xc42a3d,null));};exports[_0x254d('0x3e')]=function(_0x4c103c,_0x2ad15e){var _0x3fd2ec={'raw':!![],'where':{}},_0x33998a={},_0x908e5e;return db['MailQueue']['findOne']({'where':{'id':_0x4c103c[_0x254d('0x29')]['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x2ad15e,null))[_0x254d('0x14')](function(_0x260509){if(_0x260509){_0x908e5e=_0x260509[_0x254d('0x36')]({'plain':!![]});_0x33998a['model']=_[_0x254d('0x2b')](db[_0x254d('0x3f')]['rawAttributes']);_0x33998a[_0x254d('0x24')]=_['keys'](_0x4c103c[_0x254d('0x24')]);_0x33998a['filters']=_['intersection'](_0x33998a[_0x254d('0x2a')],_0x33998a[_0x254d('0x24')]);_0x3fd2ec[_0x254d('0x2e')]=_[_0x254d('0x2d')](_0x33998a[_0x254d('0x2a')],qs[_0x254d('0x2f')](_0x4c103c[_0x254d('0x24')][_0x254d('0x2f')]));_0x3fd2ec[_0x254d('0x2e')]=_0x3fd2ec[_0x254d('0x2e')]['length']?_0x3fd2ec['attributes']:_0x33998a[_0x254d('0x2a')];if(!_0x4c103c[_0x254d('0x24')]['hasOwnProperty'](_0x254d('0x40'))){_0x3fd2ec[_0x254d('0x41')]=qs[_0x254d('0x41')](_0x4c103c[_0x254d('0x24')][_0x254d('0x41')]);_0x3fd2ec[_0x254d('0x10')]=qs['offset'](_0x4c103c['query']['offset']);}_0x3fd2ec['order']=qs[_0x254d('0x42')](_0x4c103c[_0x254d('0x24')][_0x254d('0x42')]);_0x3fd2ec[_0x254d('0x21')]=qs['filters'](_[_0x254d('0x43')](_0x4c103c[_0x254d('0x24')],_0x33998a['filters']));_0x3fd2ec[_0x254d('0x21')][_0x254d('0x44')]=_0x260509['id'];if(_0x4c103c[_0x254d('0x24')]['filter']){_0x3fd2ec[_0x254d('0x21')]=_[_0x254d('0x45')](_0x3fd2ec[_0x254d('0x21')],{'$or':_['map'](_0x3fd2ec[_0x254d('0x2e')],function(_0x145d11){var _0x22a604={};_0x22a604[_0x145d11]={'$like':'%'+_0x4c103c[_0x254d('0x24')][_0x254d('0x46')]+'%'};return _0x22a604;})});}_0x3fd2ec=_[_0x254d('0x45')]({},_0x3fd2ec,_0x4c103c['options']);return db['UserMailQueue']['findAll'](_0x3fd2ec);}})[_0x254d('0x14')](function(_0x37a088){if(_0x37a088){return db[_0x254d('0x47')][_0x254d('0x48')]({'where':{'id':_[_0x254d('0x1b')](_0x37a088,_0x254d('0x49')),'role':_0x254d('0x4a')},'attributes':['id',_0x254d('0x19'),_0x254d('0x4b'),_0x254d('0x4c'),_0x254d('0x4d')]});}})['then'](function(_0xcf0f3a){if(_0xcf0f3a){return{'count':_0xcf0f3a[_0x254d('0x11')],'rows':_[_0x254d('0x1b')](_0xcf0f3a[_0x254d('0x26')],function(_0x1c551b){return{'membername':_0x1c551b['name'],'UserId':_0x1c551b['id'],'queue_name':_0x908e5e[_0x254d('0x19')],'MailQueueId':_0x908e5e['id'],'interface':util[_0x254d('0x4e')]('%s/%s','SIP',_0x1c551b[_0x254d('0x19')]),'penalty':0x0,'paused':_0x1c551b[_0x254d('0x4b')],'createdAt':_0x1c551b[_0x254d('0x4d')],'updatedAt':_0x1c551b[_0x254d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x254d('0x14')](respondWithFilteredResult(_0x2ad15e,_0x3fd2ec))[_0x254d('0x27')](handleError(_0x2ad15e,null));};exports['getTeams']=function(_0x2e7880,_0x56320e){var _0x410835={};var _0x3cba31={};var _0x5457e8;var _0x10836d;return db[_0x254d('0x22')][_0x254d('0x4f')]({'where':{'id':_0x2e7880['params']['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x56320e,null))['then'](function(_0x237278){if(_0x237278){_0x5457e8=_0x237278;_0x3cba31[_0x254d('0x2a')]=_['keys'](db[_0x254d('0x50')][_0x254d('0x1c')]);_0x3cba31[_0x254d('0x24')]=_['keys'](_0x2e7880[_0x254d('0x24')]);_0x3cba31[_0x254d('0x2c')]=_['intersection'](_0x3cba31[_0x254d('0x2a')],_0x3cba31[_0x254d('0x24')]);_0x410835[_0x254d('0x2e')]=_[_0x254d('0x2d')](_0x3cba31['model'],qs['fields'](_0x2e7880['query'][_0x254d('0x2f')]));_0x410835['attributes']=_0x410835[_0x254d('0x2e')][_0x254d('0x30')]?_0x410835['attributes']:_0x3cba31[_0x254d('0x2a')];_0x410835['order']=qs[_0x254d('0x42')](_0x2e7880[_0x254d('0x24')][_0x254d('0x42')]);_0x410835[_0x254d('0x21')]=qs['filters'](_[_0x254d('0x43')](_0x2e7880[_0x254d('0x24')],_0x3cba31[_0x254d('0x2c')]));if(_0x2e7880[_0x254d('0x24')][_0x254d('0x46')]){_0x410835['where']=_[_0x254d('0x45')](_0x410835[_0x254d('0x21')],{'$or':_[_0x254d('0x1b')](_0x410835[_0x254d('0x2e')],function(_0x4a040d){var _0x1734fc={};_0x1734fc[_0x4a040d]={'$like':'%'+_0x2e7880['query']['filter']+'%'};return _0x1734fc;})});}_0x410835=_[_0x254d('0x45')]({},_0x410835,_0x2e7880[_0x254d('0x31')]);return _0x5457e8[_0x254d('0x51')](_0x410835);}})[_0x254d('0x14')](function(_0x43764d){if(_0x43764d){_0x10836d=_0x43764d['length'];if(!_0x2e7880[_0x254d('0x24')][_0x254d('0x52')]('nolimit')){_0x410835['limit']=qs[_0x254d('0x41')](_0x2e7880[_0x254d('0x24')][_0x254d('0x41')]);_0x410835[_0x254d('0x10')]=qs[_0x254d('0x10')](_0x2e7880[_0x254d('0x24')][_0x254d('0x10')]);}return _0x5457e8[_0x254d('0x51')](_0x410835);}})[_0x254d('0x14')](function(_0x333997){if(_0x333997){return _0x333997?{'count':_0x10836d,'rows':_0x333997}:null;}})[_0x254d('0x14')](respondWithResult(_0x56320e,null))[_0x254d('0x27')](handleError(_0x56320e,null));};exports['addTeams']=function(_0x39a6e3,_0x3945f9){var _0x236de9=_0x39a6e3[_0x254d('0x34')][_0x254d('0x53')];return db['Team'][_0x254d('0x25')]({'where':{'id':_0x236de9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x254d('0x54'),'attributes':['id',_0x254d('0x19'),'online',_0x254d('0x55'),_0x254d('0x56')],'raw':!![]}]})[_0x254d('0x14')](function(_0x3155ba){if(_0x3155ba){var _0x9f2bd2=_['flatMap'](_0x3155ba,function(_0x5ae311){var _0x51fd7b=_0x5ae311[_0x254d('0x36')]({'plain':!![]});return _0x51fd7b[_0x254d('0x54')];});return db[_0x254d('0x22')][_0x254d('0x32')]({'where':{'id':_0x39a6e3['params']['id']}})['then'](function(_0x296ebd){return db[_0x254d('0x57')]['transaction'](function(_0x27b7f1){return _0x296ebd['addTeams'](_0x236de9,{'transaction':_0x27b7f1})['then'](function(){return BPromise[_0x254d('0x58')](_0x9f2bd2,function(_0x47838f){return db[_0x254d('0x3f')][_0x254d('0x59')]({'where':{'UserId':_0x47838f['id'],'MailQueueId':_0x39a6e3[_0x254d('0x29')]['id']},'transaction':_0x27b7f1});});})[_0x254d('0x14')](function(){_0x9f2bd2['forEach'](function(_0x343e86){socket['emit'](_0x254d('0x5a'),{'UserId':_0x343e86['id'],'MailQueueId':_0x296ebd['id']});});});});});}})[_0x254d('0x14')](respondWithStatusCode(_0x3945f9,null))[_0x254d('0x27')](handleError(_0x3945f9,null));};exports[_0x254d('0x5b')]=function(_0x2705a5,_0x3ec098){return db[_0x254d('0x50')][_0x254d('0x25')]({'where':{'id':_0x2705a5[_0x254d('0x24')][_0x254d('0x53')]},'attributes':['id'],'include':[{'model':db[_0x254d('0x47')],'as':_0x254d('0x54'),'attributes':['id'],'raw':!![]}]})[_0x254d('0x14')](handleEntityNotFound(_0x3ec098,null))['then'](function(_0x5580cf){var _0x36572c=_[_0x254d('0x1b')](_0x5580cf,'id');var _0x2bb729=[];var _0x4672fb=[];var _0x3d6727=squel[_0x254d('0x5c')]();_0x3d6727[_0x254d('0x5d')](_0x254d('0x5e'))[_0x254d('0x5f')](_0x254d('0x60'),'tq')[_0x254d('0x61')](_0x254d('0x62'),'ut',_0x254d('0x63'))[_0x254d('0x21')](_0x254d('0x64'),_0x2705a5[_0x254d('0x29')]['id']);for(var _0x20a624=0x0;_0x20a624<_0x5580cf[_0x254d('0x30')];_0x20a624+=0x1){let _0x5a7ace=_0x5580cf[_0x20a624];for(var _0x40e631=0x0;_0x40e631<_0x5a7ace['Agents'][_0x254d('0x30')];_0x40e631+=0x1){let _0x1981e5=_0x5a7ace[_0x254d('0x54')][_0x40e631];var _0x269567=_0x3d6727[_0x254d('0x65')]();_0x269567[_0x254d('0x21')](_0x254d('0x66'),_0x1981e5['id']);_0x4672fb['push'](db[_0x254d('0x57')][_0x254d('0x24')](_0x269567[_0x254d('0x67')](),{'type':db[_0x254d('0x57')][_0x254d('0x68')][_0x254d('0x69')]})[_0x254d('0x14')](function(_0x2175a6){if(_0x2175a6[_0x254d('0x30')]===0x1){return _0x1981e5['id'];}else{var _0x3f08bb=_[_0x254d('0x6a')](_[_0x254d('0x1b')](_0x2175a6,_0x254d('0x6b')),function(_0x1fdd7b){return _[_0x254d('0x6c')](_0x36572c,_0x1fdd7b);});if(_0x3f08bb){return _0x1981e5['id'];}}}));}}return BPromise[_0x254d('0x6d')](_0x4672fb)[_0x254d('0x14')](function(_0x2dd95f){_0x2bb729=_(_0x2bb729)[_0x254d('0x6e')](_0x2dd95f)['compact']()[_0x254d('0x6f')]();return db[_0x254d('0x22')]['find']({'where':{'id':_0x2705a5[_0x254d('0x29')]['id']}})[_0x254d('0x14')](function(_0x4995fc){return db[_0x254d('0x57')][_0x254d('0x70')](function(_0x20e436){return _0x4995fc[_0x254d('0x5b')](_0x2705a5['query'][_0x254d('0x53')],{'transaction':_0x20e436})[_0x254d('0x14')](function(){if(!_[_0x254d('0x71')](_0x2bb729)){return _0x4995fc[_0x254d('0x72')](_0x2bb729,{'transaction':_0x20e436});}})[_0x254d('0x14')](function(){_0x2bb729[_0x254d('0x73')](function(_0x194f9e){socket[_0x254d('0x74')](_0x254d('0x75'),{'UserId':_0x194f9e,'MailQueueId':_0x4995fc['id']});});});});});});})[_0x254d('0x14')](respondWithStatusCode(_0x3ec098,null))[_0x254d('0x27')](handleError(_0x3ec098,null));};exports['addAgents']=function(_0x269e39,_0x216e5b){return db[_0x254d('0x22')][_0x254d('0x32')]({'where':{'id':_0x269e39[_0x254d('0x29')]['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x216e5b,null))[_0x254d('0x14')](function(_0x5206ee){if(_0x5206ee){return _0x5206ee['addAgents'](_0x269e39['body'][_0x254d('0x53')],_['omit'](_0x269e39[_0x254d('0x34')],[_0x254d('0x53'),'id'])||{})[_0x254d('0x76')](function(_0x41354f){for(var _0x2c0f4a=0x0;_0x2c0f4a<_0x269e39['body'][_0x254d('0x53')]['length'];_0x2c0f4a+=0x1){socket[_0x254d('0x74')]('userMailQueue:save',{'UserId':Number(_0x269e39[_0x254d('0x34')][_0x254d('0x53')][_0x2c0f4a]),'MailQueueId':Number(_0x269e39[_0x254d('0x29')]['id'])});}return _0x41354f;});}})['then'](respondWithResult(_0x216e5b,null))[_0x254d('0x27')](handleError(_0x216e5b,null));};exports[_0x254d('0x72')]=function(_0x34937d,_0x4c5221){return db[_0x254d('0x22')][_0x254d('0x32')]({'where':{'id':_0x34937d[_0x254d('0x29')]['id']}})[_0x254d('0x14')](handleEntityNotFound(_0x4c5221,null))[_0x254d('0x14')](function(_0x56e216){if(_0x56e216){return _0x56e216[_0x254d('0x72')](_0x34937d[_0x254d('0x24')][_0x254d('0x53')])[_0x254d('0x14')](function(){if(_[_0x254d('0x77')](_0x34937d[_0x254d('0x24')][_0x254d('0x53')])){for(var _0x59adf4=0x0;_0x59adf4<_0x34937d[_0x254d('0x24')][_0x254d('0x53')][_0x254d('0x30')];_0x59adf4+=0x1){socket['emit'](_0x254d('0x75'),{'UserId':Number(_0x34937d['query']['ids'][_0x59adf4]),'MailQueueId':Number(_0x34937d[_0x254d('0x29')]['id'])});}}else{socket[_0x254d('0x74')](_0x254d('0x75'),{'UserId':Number(_0x34937d[_0x254d('0x24')][_0x254d('0x53')]),'MailQueueId':Number(_0x34937d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4c5221,null))[_0x254d('0x27')](handleError(_0x4c5221,null));};exports[_0x254d('0x78')]=function(_0x5b0b4c,_0x15ef14){var _0x59a936={};var _0x2bddfe={};var _0x3cdf84;var _0xd7922;return db[_0x254d('0x22')]['findOne']({'where':{'id':_0x5b0b4c[_0x254d('0x29')]['id']}})['then'](handleEntityNotFound(_0x15ef14,null))[_0x254d('0x14')](function(_0x51754c){if(_0x51754c){_0x3cdf84=_0x51754c;_0x2bddfe[_0x254d('0x2a')]=_[_0x254d('0x2b')](db['User']['rawAttributes']);_0x2bddfe[_0x254d('0x24')]=_[_0x254d('0x2b')](_0x5b0b4c[_0x254d('0x24')]);_0x2bddfe[_0x254d('0x2c')]=_[_0x254d('0x2d')](_0x2bddfe['model'],_0x2bddfe[_0x254d('0x24')]);_0x59a936[_0x254d('0x2e')]=_['intersection'](_0x2bddfe[_0x254d('0x2a')],qs[_0x254d('0x2f')](_0x5b0b4c[_0x254d('0x24')]['fields']));_0x59a936[_0x254d('0x2e')]=_0x59a936[_0x254d('0x2e')][_0x254d('0x30')]?_0x59a936[_0x254d('0x2e')]:_0x2bddfe[_0x254d('0x2a')];_0x59a936[_0x254d('0x79')]=qs[_0x254d('0x42')](_0x5b0b4c[_0x254d('0x24')][_0x254d('0x42')]);_0x59a936['where']=qs['filters'](_['pick'](_0x5b0b4c[_0x254d('0x24')],_0x2bddfe[_0x254d('0x2c')]));if(_0x5b0b4c['query'][_0x254d('0x46')]){_0x59a936['where']=_[_0x254d('0x45')](_0x59a936[_0x254d('0x21')],{'$or':_[_0x254d('0x1b')](_0x59a936[_0x254d('0x2e')],function(_0x337897){var _0x5c2785={};_0x5c2785[_0x337897]={'$like':'%'+_0x5b0b4c[_0x254d('0x24')][_0x254d('0x46')]+'%'};return _0x5c2785;})});}_0x59a936=_['merge']({},_0x59a936,_0x5b0b4c['options']);return _0x3cdf84[_0x254d('0x78')](_0x59a936);}})['then'](function(_0x293cb0){if(_0x293cb0){_0xd7922=_0x293cb0[_0x254d('0x30')];if(!_0x5b0b4c[_0x254d('0x24')][_0x254d('0x52')]('nolimit')){_0x59a936['limit']=qs['limit'](_0x5b0b4c[_0x254d('0x24')]['limit']);_0x59a936[_0x254d('0x10')]=qs[_0x254d('0x10')](_0x5b0b4c['query']['offset']);}return _0x3cdf84[_0x254d('0x78')](_0x59a936);}})[_0x254d('0x14')](function(_0x597784){if(_0x597784){return _0x597784?{'count':_0xd7922,'rows':_0x597784}:null;}})[_0x254d('0x14')](respondWithResult(_0x15ef14,null))[_0x254d('0x27')](handleError(_0x15ef14,null));}; \ No newline at end of file +var _0x0d61=['MailQueue','type','include','query','findAll','rows','catch','params','model','rawAttributes','filters','intersection','fields','attributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','keys','nolimit','order','where','pick','MailQueueId','filter','options','User','findAndCountAll','agent','mailPause','createdAt','format','%s/%s','SIP','getTeams','Team','sort','merge','hasOwnProperty','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','then','get','MailQueues','end','error','name','send','index','map'];(function(_0x3dd55b,_0x447507){var _0xa119b0=function(_0x209c8d){while(--_0x209c8d){_0x3dd55b['push'](_0x3dd55b['shift']());}};_0xa119b0(++_0x447507);}(_0x0d61,0xd7));var _0x10d6=function(_0xe73bdd,_0x6fa765){_0xe73bdd=_0xe73bdd-0x0;var _0xa9f84a=_0x0d61[_0xe73bdd];return _0xa9f84a;};'use strict';var BPromise=require(_0x10d6('0x0'));var util=require('util');var _=require(_0x10d6('0x1'));var squel=require('squel');var Redis=require(_0x10d6('0x2'));var qs=require(_0x10d6('0x3'));var logger=require(_0x10d6('0x4'))(_0x10d6('0x5'));var config=require(_0x10d6('0x6'));var db=require(_0x10d6('0x7'))['db'];config[_0x10d6('0x8')]=_[_0x10d6('0x9')](config[_0x10d6('0x8')],{'host':_0x10d6('0xa'),'port':0x18eb});var socket=require(_0x10d6('0xb'))(new Redis(config[_0x10d6('0x8')]));require(_0x10d6('0xc'))['register'](socket);function respondWithStatusCode(_0xca5646,_0x117364){_0x117364=_0x117364||0xcc;return function(_0x4f4bb6){if(_0x4f4bb6){return _0xca5646[_0x10d6('0xd')](_0x117364);}return _0xca5646[_0x10d6('0xe')](_0x117364)['end']();};}function respondWithResult(_0x4afded,_0x153adc){_0x153adc=_0x153adc||0xc8;return function(_0x3e622a){if(_0x3e622a){return _0x4afded[_0x10d6('0xe')](_0x153adc)['json'](_0x3e622a);}};}function respondWithFilteredResult(_0x4b5a60,_0x11c58b){return function(_0x3d5d63){if(_0x3d5d63){var _0x595e9c=typeof _0x11c58b[_0x10d6('0xf')]===_0x10d6('0x10')&&typeof _0x11c58b['limit']===_0x10d6('0x10');var _0x78d3b2=_0x3d5d63['count'];var _0x5d2f7a=_0x595e9c?0x0:_0x11c58b[_0x10d6('0xf')];var _0x2b9949=_0x595e9c?_0x3d5d63[_0x10d6('0x11')]:_0x11c58b[_0x10d6('0xf')]+_0x11c58b[_0x10d6('0x12')];var _0x45b20e;if(_0x2b9949>=_0x78d3b2){_0x2b9949=_0x78d3b2;_0x45b20e=0xc8;}else{_0x45b20e=0xce;}_0x4b5a60[_0x10d6('0xe')](_0x45b20e);return _0x4b5a60[_0x10d6('0x13')](_0x10d6('0x14'),_0x5d2f7a+'-'+_0x2b9949+'/'+_0x78d3b2)[_0x10d6('0x15')](_0x3d5d63);}return null;};}function saveUpdates(_0x3d233c){return function(_0x157f86){if(_0x157f86){return _0x157f86[_0x10d6('0x16')](_0x3d233c)['then'](function(_0x2856f9){return _0x2856f9;});}return null;};}function removeEntity(_0xbd1f2c){return function(_0x3fb856){if(_0x3fb856){return _0x3fb856[_0x10d6('0x17')]()[_0x10d6('0x18')](function(){var _0xdb516f=_0x3fb856[_0x10d6('0x19')]({'plain':!![]});var _0x25e3dd=_0x10d6('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x25e3dd,'resourceId':_0xdb516f['id']}})[_0x10d6('0x18')](function(){return _0x3fb856;});})['then'](function(){_0xbd1f2c['status'](0xcc)[_0x10d6('0x1b')]();});}};}function handleEntityNotFound(_0x4e8f6c){return function(_0x1387fb){if(!_0x1387fb){_0x4e8f6c[_0x10d6('0xd')](0x194);}return _0x1387fb;};}function handleError(_0x3cbe96,_0xe7edcd){_0xe7edcd=_0xe7edcd||0x1f4;return function(_0x2137f9){logger[_0x10d6('0x1c')](_0x2137f9['stack']);if(_0x2137f9[_0x10d6('0x1d')]){delete _0x2137f9[_0x10d6('0x1d')];}_0x3cbe96['status'](_0xe7edcd)[_0x10d6('0x1e')](_0x2137f9);};}exports[_0x10d6('0x1f')]=function(_0x25bb98,_0x59cf08){var _0x18e53b={};var _0x39d118={'count':0x0,'rows':[]};var _0x56be7f=_[_0x10d6('0x20')](db[_0x10d6('0x21')]['rawAttributes'],function(_0x28feca){return{'name':_0x28feca['fieldName'],'type':_0x28feca[_0x10d6('0x22')]['key']};});_0x18e53b=qs['getOptions'](_0x56be7f,_0x25bb98);var _0x30e4dc={'where':_0x18e53b['where']};return db[_0x10d6('0x21')][_0x10d6('0x11')](_0x30e4dc)[_0x10d6('0x18')](function(_0x1b9363){_0x39d118[_0x10d6('0x11')]=_0x1b9363;_0x18e53b[_0x10d6('0x23')]=qs[_0x10d6('0x23')](_0x25bb98[_0x10d6('0x24')]);return db[_0x10d6('0x21')][_0x10d6('0x25')](_0x18e53b);})[_0x10d6('0x18')](function(_0x1809ab){_0x39d118[_0x10d6('0x26')]=_0x1809ab;return _0x39d118;})['then'](respondWithFilteredResult(_0x59cf08,_0x18e53b))[_0x10d6('0x27')](handleError(_0x59cf08,null));};exports['show']=function(_0x4b863e,_0x32d46c){var _0x2a0557={'raw':!![],'where':{'id':_0x4b863e[_0x10d6('0x28')]['id']}},_0x1d65a7={};_0x1d65a7[_0x10d6('0x29')]=_['keys'](db[_0x10d6('0x21')][_0x10d6('0x2a')]);_0x1d65a7['query']=_['keys'](_0x4b863e[_0x10d6('0x24')]);_0x1d65a7[_0x10d6('0x2b')]=_[_0x10d6('0x2c')](_0x1d65a7[_0x10d6('0x29')],_0x1d65a7[_0x10d6('0x24')]);_0x2a0557['attributes']=_[_0x10d6('0x2c')](_0x1d65a7[_0x10d6('0x29')],qs[_0x10d6('0x2d')](_0x4b863e[_0x10d6('0x24')][_0x10d6('0x2d')]));_0x2a0557['attributes']=_0x2a0557[_0x10d6('0x2e')][_0x10d6('0x2f')]?_0x2a0557[_0x10d6('0x2e')]:_0x1d65a7[_0x10d6('0x29')];if(_0x4b863e[_0x10d6('0x24')][_0x10d6('0x30')]){_0x2a0557[_0x10d6('0x23')]=[{'all':!![]}];}_0x2a0557=_['merge']({},_0x2a0557,_0x4b863e['options']);return db[_0x10d6('0x21')][_0x10d6('0x31')](_0x2a0557)[_0x10d6('0x18')](handleEntityNotFound(_0x32d46c,null))[_0x10d6('0x18')](respondWithResult(_0x32d46c,null))[_0x10d6('0x27')](handleError(_0x32d46c,null));};exports[_0x10d6('0x32')]=function(_0x1cb3a9,_0x5e5cea){return db[_0x10d6('0x21')][_0x10d6('0x32')](_0x1cb3a9[_0x10d6('0x33')],{})[_0x10d6('0x18')](function(_0x3a5287){var _0x96494e=_0x1cb3a9[_0x10d6('0x34')][_0x10d6('0x19')]({'plain':!![]});if(!_0x96494e)throw new Error(_0x10d6('0x35'));if(_0x96494e['role']===_0x10d6('0x34')){var _0x45d850=_0x3a5287[_0x10d6('0x19')]({'plain':!![]});var _0x20e29b=_0x10d6('0x1a');return db[_0x10d6('0x36')]['find']({'where':{'name':_0x20e29b,'userProfileId':_0x96494e[_0x10d6('0x37')]},'raw':!![]})['then'](function(_0x3223f7){if(_0x3223f7&&_0x3223f7[_0x10d6('0x38')]===0x0){return db[_0x10d6('0x39')][_0x10d6('0x32')]({'name':_0x45d850[_0x10d6('0x1d')],'resourceId':_0x45d850['id'],'type':_0x3223f7[_0x10d6('0x1d')],'sectionId':_0x3223f7['id']},{})[_0x10d6('0x18')](function(){return _0x3a5287;});}else{return _0x3a5287;}})[_0x10d6('0x27')](function(_0x2c45f6){logger[_0x10d6('0x1c')](_0x10d6('0x3a'),_0x2c45f6);throw _0x2c45f6;});}return _0x3a5287;})[_0x10d6('0x18')](respondWithResult(_0x5e5cea,0xc9))['catch'](handleError(_0x5e5cea,null));};exports['update']=function(_0x1b3438,_0x56ca9e){if(_0x1b3438[_0x10d6('0x33')]['id']){delete _0x1b3438[_0x10d6('0x33')]['id'];}return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x1b3438[_0x10d6('0x28')]['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x56ca9e,null))[_0x10d6('0x18')](saveUpdates(_0x1b3438[_0x10d6('0x33')],null))[_0x10d6('0x18')](respondWithResult(_0x56ca9e,null))[_0x10d6('0x27')](handleError(_0x56ca9e,null));};exports[_0x10d6('0x17')]=function(_0x34d6a4,_0x46e93b){return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x34d6a4[_0x10d6('0x28')]['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x46e93b,null))[_0x10d6('0x18')](removeEntity(_0x46e93b,null))[_0x10d6('0x27')](handleError(_0x46e93b,null));};exports[_0x10d6('0x3b')]=function(_0x151cd5,_0x3d172a){return db['MailQueue'][_0x10d6('0x3b')]()['then'](respondWithResult(_0x3d172a,null))[_0x10d6('0x27')](handleError(_0x3d172a,null));};exports[_0x10d6('0x3c')]=function(_0x413cd3,_0x521348){var _0xb14515={'raw':!![],'where':{}},_0x422fd0={},_0x5b0029;return db[_0x10d6('0x21')][_0x10d6('0x3d')]({'where':{'id':_0x413cd3[_0x10d6('0x28')]['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x521348,null))[_0x10d6('0x18')](function(_0xbf6f){if(_0xbf6f){_0x5b0029=_0xbf6f['get']({'plain':!![]});_0x422fd0[_0x10d6('0x29')]=_['keys'](db[_0x10d6('0x3e')]['rawAttributes']);_0x422fd0[_0x10d6('0x24')]=_[_0x10d6('0x3f')](_0x413cd3[_0x10d6('0x24')]);_0x422fd0['filters']=_[_0x10d6('0x2c')](_0x422fd0['model'],_0x422fd0[_0x10d6('0x24')]);_0xb14515['attributes']=_['intersection'](_0x422fd0['model'],qs[_0x10d6('0x2d')](_0x413cd3[_0x10d6('0x24')][_0x10d6('0x2d')]));_0xb14515[_0x10d6('0x2e')]=_0xb14515[_0x10d6('0x2e')][_0x10d6('0x2f')]?_0xb14515[_0x10d6('0x2e')]:_0x422fd0[_0x10d6('0x29')];if(!_0x413cd3['query']['hasOwnProperty'](_0x10d6('0x40'))){_0xb14515[_0x10d6('0x12')]=qs[_0x10d6('0x12')](_0x413cd3[_0x10d6('0x24')][_0x10d6('0x12')]);_0xb14515[_0x10d6('0xf')]=qs[_0x10d6('0xf')](_0x413cd3['query'][_0x10d6('0xf')]);}_0xb14515[_0x10d6('0x41')]=qs['sort'](_0x413cd3[_0x10d6('0x24')]['sort']);_0xb14515[_0x10d6('0x42')]=qs[_0x10d6('0x2b')](_[_0x10d6('0x43')](_0x413cd3['query'],_0x422fd0[_0x10d6('0x2b')]));_0xb14515['where'][_0x10d6('0x44')]=_0xbf6f['id'];if(_0x413cd3[_0x10d6('0x24')][_0x10d6('0x45')]){_0xb14515[_0x10d6('0x42')]=_['merge'](_0xb14515[_0x10d6('0x42')],{'$or':_[_0x10d6('0x20')](_0xb14515[_0x10d6('0x2e')],function(_0x486bee){var _0x6118c5={};_0x6118c5[_0x486bee]={'$like':'%'+_0x413cd3[_0x10d6('0x24')][_0x10d6('0x45')]+'%'};return _0x6118c5;})});}_0xb14515=_['merge']({},_0xb14515,_0x413cd3[_0x10d6('0x46')]);return db['UserMailQueue'][_0x10d6('0x25')](_0xb14515);}})[_0x10d6('0x18')](function(_0x2fdc07){if(_0x2fdc07){return db[_0x10d6('0x47')][_0x10d6('0x48')]({'where':{'id':_[_0x10d6('0x20')](_0x2fdc07,'UserId'),'role':_0x10d6('0x49')},'attributes':['id',_0x10d6('0x1d'),_0x10d6('0x4a'),'updatedAt',_0x10d6('0x4b')]});}})[_0x10d6('0x18')](function(_0x5991a9){if(_0x5991a9){return{'count':_0x5991a9['count'],'rows':_['map'](_0x5991a9[_0x10d6('0x26')],function(_0x1a2c2f){return{'membername':_0x1a2c2f[_0x10d6('0x1d')],'UserId':_0x1a2c2f['id'],'queue_name':_0x5b0029['name'],'MailQueueId':_0x5b0029['id'],'interface':util[_0x10d6('0x4c')](_0x10d6('0x4d'),_0x10d6('0x4e'),_0x1a2c2f['name']),'penalty':0x0,'paused':_0x1a2c2f['mailPause'],'createdAt':_0x1a2c2f[_0x10d6('0x4b')],'updatedAt':_0x1a2c2f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x521348,_0xb14515))[_0x10d6('0x27')](handleError(_0x521348,null));};exports[_0x10d6('0x4f')]=function(_0x2245e5,_0x561896){var _0x43957e={};var _0x425a74={};var _0x463e1a;var _0x4ea5cf;return db[_0x10d6('0x21')][_0x10d6('0x3d')]({'where':{'id':_0x2245e5[_0x10d6('0x28')]['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x561896,null))[_0x10d6('0x18')](function(_0x2184ab){if(_0x2184ab){_0x463e1a=_0x2184ab;_0x425a74[_0x10d6('0x29')]=_[_0x10d6('0x3f')](db[_0x10d6('0x50')][_0x10d6('0x2a')]);_0x425a74[_0x10d6('0x24')]=_[_0x10d6('0x3f')](_0x2245e5['query']);_0x425a74[_0x10d6('0x2b')]=_[_0x10d6('0x2c')](_0x425a74[_0x10d6('0x29')],_0x425a74[_0x10d6('0x24')]);_0x43957e[_0x10d6('0x2e')]=_[_0x10d6('0x2c')](_0x425a74[_0x10d6('0x29')],qs[_0x10d6('0x2d')](_0x2245e5[_0x10d6('0x24')][_0x10d6('0x2d')]));_0x43957e[_0x10d6('0x2e')]=_0x43957e[_0x10d6('0x2e')][_0x10d6('0x2f')]?_0x43957e['attributes']:_0x425a74[_0x10d6('0x29')];_0x43957e[_0x10d6('0x41')]=qs[_0x10d6('0x51')](_0x2245e5[_0x10d6('0x24')]['sort']);_0x43957e['where']=qs[_0x10d6('0x2b')](_['pick'](_0x2245e5['query'],_0x425a74['filters']));if(_0x2245e5['query'][_0x10d6('0x45')]){_0x43957e[_0x10d6('0x42')]=_[_0x10d6('0x52')](_0x43957e[_0x10d6('0x42')],{'$or':_[_0x10d6('0x20')](_0x43957e['attributes'],function(_0x356284){var _0x3e107c={};_0x3e107c[_0x356284]={'$like':'%'+_0x2245e5[_0x10d6('0x24')][_0x10d6('0x45')]+'%'};return _0x3e107c;})});}_0x43957e=_[_0x10d6('0x52')]({},_0x43957e,_0x2245e5[_0x10d6('0x46')]);return _0x463e1a[_0x10d6('0x4f')](_0x43957e);}})[_0x10d6('0x18')](function(_0x3c4ab7){if(_0x3c4ab7){_0x4ea5cf=_0x3c4ab7[_0x10d6('0x2f')];if(!_0x2245e5[_0x10d6('0x24')][_0x10d6('0x53')]('nolimit')){_0x43957e[_0x10d6('0x12')]=qs['limit'](_0x2245e5['query'][_0x10d6('0x12')]);_0x43957e['offset']=qs[_0x10d6('0xf')](_0x2245e5['query'][_0x10d6('0xf')]);}return _0x463e1a['getTeams'](_0x43957e);}})[_0x10d6('0x18')](function(_0x515d48){if(_0x515d48){return _0x515d48?{'count':_0x4ea5cf,'rows':_0x515d48}:null;}})['then'](respondWithResult(_0x561896,null))[_0x10d6('0x27')](handleError(_0x561896,null));};exports['addTeams']=function(_0x120468,_0x9eee3a){var _0x1b9251=_0x120468[_0x10d6('0x33')]['ids'];return db[_0x10d6('0x50')][_0x10d6('0x25')]({'where':{'id':_0x1b9251},'attributes':['id'],'include':[{'model':db['User'],'as':_0x10d6('0x54'),'attributes':['id','name',_0x10d6('0x55'),_0x10d6('0x56'),_0x10d6('0x57')],'raw':!![]}]})[_0x10d6('0x18')](function(_0x4f513f){if(_0x4f513f){var _0x5e010f=_[_0x10d6('0x58')](_0x4f513f,function(_0x24774d){var _0x524eff=_0x24774d['get']({'plain':!![]});return _0x524eff[_0x10d6('0x54')];});return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x120468[_0x10d6('0x28')]['id']}})['then'](function(_0x3e6204){return db[_0x10d6('0x59')][_0x10d6('0x5a')](function(_0x45350d){return _0x3e6204[_0x10d6('0x5b')](_0x1b9251,{'transaction':_0x45350d})['then'](function(){return BPromise[_0x10d6('0x5c')](_0x5e010f,function(_0x512394){return db[_0x10d6('0x3e')][_0x10d6('0x5d')]({'where':{'UserId':_0x512394['id'],'MailQueueId':_0x120468['params']['id']},'transaction':_0x45350d});});})[_0x10d6('0x18')](function(){_0x5e010f[_0x10d6('0x5e')](function(_0xff8d03){socket[_0x10d6('0x5f')](_0x10d6('0x60'),{'UserId':_0xff8d03['id'],'MailQueueId':_0x3e6204['id']});});});});});}})[_0x10d6('0x18')](respondWithStatusCode(_0x9eee3a,null))[_0x10d6('0x27')](handleError(_0x9eee3a,null));};exports[_0x10d6('0x61')]=function(_0x24f4ef,_0x1f75eb){return db[_0x10d6('0x50')][_0x10d6('0x25')]({'where':{'id':_0x24f4ef[_0x10d6('0x24')][_0x10d6('0x62')]},'attributes':['id'],'include':[{'model':db[_0x10d6('0x47')],'as':_0x10d6('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f75eb,null))[_0x10d6('0x18')](function(_0x1264ec){var _0xdeb53d=_['map'](_0x1264ec,'id');var _0x3667d7=[];var _0x4ccf2f=[];var _0x244e3b=squel[_0x10d6('0x63')]();_0x244e3b[_0x10d6('0x64')]('tq.TeamId')[_0x10d6('0x65')](_0x10d6('0x66'),'tq')[_0x10d6('0x67')](_0x10d6('0x68'),'ut',_0x10d6('0x69'))['where'](_0x10d6('0x6a'),_0x24f4ef[_0x10d6('0x28')]['id']);for(var _0x51853d=0x0;_0x51853d<_0x1264ec[_0x10d6('0x2f')];_0x51853d+=0x1){let _0x30c766=_0x1264ec[_0x51853d];for(var _0x11182d=0x0;_0x11182d<_0x30c766[_0x10d6('0x54')][_0x10d6('0x2f')];_0x11182d+=0x1){let _0x2b6e4c=_0x30c766[_0x10d6('0x54')][_0x11182d];var _0x5360a9=_0x244e3b[_0x10d6('0x6b')]();_0x5360a9[_0x10d6('0x42')](_0x10d6('0x6c'),_0x2b6e4c['id']);_0x4ccf2f['push'](db[_0x10d6('0x59')][_0x10d6('0x24')](_0x5360a9[_0x10d6('0x6d')](),{'type':db[_0x10d6('0x59')][_0x10d6('0x6e')][_0x10d6('0x6f')]})['then'](function(_0x3ba6a1){if(_0x3ba6a1[_0x10d6('0x2f')]===0x1){return _0x2b6e4c['id'];}else{var _0x4fcabf=_[_0x10d6('0x70')](_[_0x10d6('0x20')](_0x3ba6a1,_0x10d6('0x71')),function(_0x114103){return _['includes'](_0xdeb53d,_0x114103);});if(_0x4fcabf){return _0x2b6e4c['id'];}}}));}}return BPromise[_0x10d6('0x72')](_0x4ccf2f)['then'](function(_0x267045){_0x3667d7=_(_0x3667d7)['union'](_0x267045)[_0x10d6('0x73')]()[_0x10d6('0x74')]();return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x24f4ef[_0x10d6('0x28')]['id']}})['then'](function(_0x154a42){return db[_0x10d6('0x59')][_0x10d6('0x5a')](function(_0x2fd2dd){return _0x154a42['removeTeams'](_0x24f4ef[_0x10d6('0x24')][_0x10d6('0x62')],{'transaction':_0x2fd2dd})[_0x10d6('0x18')](function(){if(!_[_0x10d6('0x75')](_0x3667d7)){return _0x154a42[_0x10d6('0x76')](_0x3667d7,{'transaction':_0x2fd2dd});}})['then'](function(){_0x3667d7[_0x10d6('0x5e')](function(_0x566754){socket['emit'](_0x10d6('0x77'),{'UserId':_0x566754,'MailQueueId':_0x154a42['id']});});});});});});})[_0x10d6('0x18')](respondWithStatusCode(_0x1f75eb,null))['catch'](handleError(_0x1f75eb,null));};exports[_0x10d6('0x78')]=function(_0x2faa41,_0x2488f5){return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x2faa41['params']['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x2488f5,null))[_0x10d6('0x18')](function(_0x3438ec){if(_0x3438ec){return _0x3438ec['addAgents'](_0x2faa41[_0x10d6('0x33')][_0x10d6('0x62')],_[_0x10d6('0x79')](_0x2faa41[_0x10d6('0x33')],[_0x10d6('0x62'),'id'])||{})['spread'](function(_0x4a2700){for(var _0x232835=0x0;_0x232835<_0x2faa41[_0x10d6('0x33')][_0x10d6('0x62')]['length'];_0x232835+=0x1){socket['emit'](_0x10d6('0x60'),{'UserId':Number(_0x2faa41['body']['ids'][_0x232835]),'MailQueueId':Number(_0x2faa41[_0x10d6('0x28')]['id'])});}return _0x4a2700;});}})[_0x10d6('0x18')](respondWithResult(_0x2488f5,null))[_0x10d6('0x27')](handleError(_0x2488f5,null));};exports[_0x10d6('0x76')]=function(_0x28c53b,_0x378493){return db[_0x10d6('0x21')][_0x10d6('0x31')]({'where':{'id':_0x28c53b[_0x10d6('0x28')]['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x378493,null))['then'](function(_0x4ca997){if(_0x4ca997){return _0x4ca997[_0x10d6('0x76')](_0x28c53b['query']['ids'])['then'](function(){if(_[_0x10d6('0x7a')](_0x28c53b['query'][_0x10d6('0x62')])){for(var _0x36a322=0x0;_0x36a322<_0x28c53b[_0x10d6('0x24')]['ids'][_0x10d6('0x2f')];_0x36a322+=0x1){socket[_0x10d6('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x28c53b[_0x10d6('0x24')]['ids'][_0x36a322]),'MailQueueId':Number(_0x28c53b[_0x10d6('0x28')]['id'])});}}else{socket[_0x10d6('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x28c53b['query']['ids']),'MailQueueId':Number(_0x28c53b['params']['id'])});}});}})[_0x10d6('0x18')](respondWithStatusCode(_0x378493,null))['catch'](handleError(_0x378493,null));};exports['getAgents']=function(_0x237f14,_0x5d0252){var _0x4ef6e8={};var _0x31513b={};var _0x554bd9;var _0x68b722;return db[_0x10d6('0x21')][_0x10d6('0x3d')]({'where':{'id':_0x237f14['params']['id']}})[_0x10d6('0x18')](handleEntityNotFound(_0x5d0252,null))[_0x10d6('0x18')](function(_0xa3c0c2){if(_0xa3c0c2){_0x554bd9=_0xa3c0c2;_0x31513b[_0x10d6('0x29')]=_[_0x10d6('0x3f')](db['User']['rawAttributes']);_0x31513b[_0x10d6('0x24')]=_['keys'](_0x237f14[_0x10d6('0x24')]);_0x31513b[_0x10d6('0x2b')]=_[_0x10d6('0x2c')](_0x31513b[_0x10d6('0x29')],_0x31513b[_0x10d6('0x24')]);_0x4ef6e8[_0x10d6('0x2e')]=_[_0x10d6('0x2c')](_0x31513b[_0x10d6('0x29')],qs['fields'](_0x237f14[_0x10d6('0x24')][_0x10d6('0x2d')]));_0x4ef6e8[_0x10d6('0x2e')]=_0x4ef6e8[_0x10d6('0x2e')][_0x10d6('0x2f')]?_0x4ef6e8['attributes']:_0x31513b[_0x10d6('0x29')];_0x4ef6e8[_0x10d6('0x41')]=qs[_0x10d6('0x51')](_0x237f14['query'][_0x10d6('0x51')]);_0x4ef6e8['where']=qs[_0x10d6('0x2b')](_[_0x10d6('0x43')](_0x237f14['query'],_0x31513b['filters']));if(_0x237f14[_0x10d6('0x24')][_0x10d6('0x45')]){_0x4ef6e8[_0x10d6('0x42')]=_[_0x10d6('0x52')](_0x4ef6e8[_0x10d6('0x42')],{'$or':_['map'](_0x4ef6e8['attributes'],function(_0x20fb8c){var _0x146ade={};_0x146ade[_0x20fb8c]={'$like':'%'+_0x237f14['query'][_0x10d6('0x45')]+'%'};return _0x146ade;})});}_0x4ef6e8=_[_0x10d6('0x52')]({},_0x4ef6e8,_0x237f14[_0x10d6('0x46')]);return _0x554bd9[_0x10d6('0x7b')](_0x4ef6e8);}})[_0x10d6('0x18')](function(_0x4ee2be){if(_0x4ee2be){_0x68b722=_0x4ee2be[_0x10d6('0x2f')];if(!_0x237f14[_0x10d6('0x24')]['hasOwnProperty'](_0x10d6('0x40'))){_0x4ef6e8[_0x10d6('0x12')]=qs[_0x10d6('0x12')](_0x237f14[_0x10d6('0x24')][_0x10d6('0x12')]);_0x4ef6e8[_0x10d6('0xf')]=qs[_0x10d6('0xf')](_0x237f14[_0x10d6('0x24')]['offset']);}return _0x554bd9['getAgents'](_0x4ef6e8);}})[_0x10d6('0x18')](function(_0x26558d){if(_0x26558d){return _0x26558d?{'count':_0x68b722,'rows':_0x26558d}:null;}})[_0x10d6('0x18')](respondWithResult(_0x5d0252,null))['catch'](handleError(_0x5d0252,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0dc58aa..3f41fea 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 _0x3d05=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x1fd450,_0x42cbf6){var _0x4cb0a5=function(_0x1384d4){while(--_0x1384d4){_0x1fd450['push'](_0x1fd450['shift']());}};_0x4cb0a5(++_0x42cbf6);}(_0x3d05,0x1a0));var _0x53d0=function(_0x3071ab,_0x574a59){_0x3071ab=_0x3071ab-0x0;var _0x2f458c=_0x3d05[_0x3071ab];return _0x2f458c;};'use strict';var EventEmitter=require(_0x53d0('0x0'));var MailQueue=require(_0x53d0('0x1'))['db'][_0x53d0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x53d0('0x3')](0x0);var events={'afterCreate':_0x53d0('0x4'),'afterUpdate':'update','afterDestroy':_0x53d0('0x5')};function emitEvent(_0x2b0d41){return function(_0x3af595,_0x3e8068,_0x10efc8){MailQueueEvents[_0x53d0('0x6')](_0x2b0d41+':'+_0x3af595['id'],_0x3af595);MailQueueEvents[_0x53d0('0x6')](_0x2b0d41,_0x3af595);_0x10efc8(null);};}for(var e in events){if(events[_0x53d0('0x7')](e)){var event=events[e];MailQueue[_0x53d0('0x8')](e,emitEvent(event));}}module[_0x53d0('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xd3a7=['emit','hook','exports','events','MailQueue','setMaxListeners','update'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0xd3a7,0x1d8));var _0x7d3a=function(_0x22d135,_0x25df22){_0x22d135=_0x22d135-0x0;var _0x343ea5=_0xd3a7[_0x22d135];return _0x343ea5;};'use strict';var EventEmitter=require(_0x7d3a('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x7d3a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7d3a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d3a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7a29bc){return function(_0x410b91,_0x5e60e1,_0x4c97a2){MailQueueEvents[_0x7d3a('0x4')](_0x7a29bc+':'+_0x410b91['id'],_0x410b91);MailQueueEvents[_0x7d3a('0x4')](_0x7a29bc,_0x410b91);_0x4c97a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7d3a('0x5')](e,emitEvent(event));}}module[_0x7d3a('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index bfea60d..3625da6 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 _0xfefe=['request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','util','../../config/logger','api','bluebird'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xfefe,0x114));var _0xefef=function(_0x3d953a,_0x36356a){_0x3d953a=_0x3d953a-0x0;var _0x39d930=_0xfefe[_0x3d953a];return _0x39d930;};'use strict';var _=require('lodash');var util=require(_0xefef('0x0'));var logger=require(_0xefef('0x1'))(_0xefef('0x2'));var moment=require('moment');var BPromise=require(_0xefef('0x3'));var rp=require(_0xefef('0x4'));var fs=require('fs');var path=require(_0xefef('0x5'));var rimraf=require('rimraf');var config=require(_0xefef('0x6'));var attributes=require(_0xefef('0x7'));module[_0xefef('0x8')]=function(_0x29bd3f,_0x1b06a3){return _0x29bd3f[_0xefef('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7936=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5b1252,_0x192a13){var _0x5df852=function(_0x170578){while(--_0x170578){_0x5b1252['push'](_0x5b1252['shift']());}};_0x5df852(++_0x192a13);}(_0x7936,0x1a6));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6793('0x0'));var util=require(_0x6793('0x1'));var logger=require(_0x6793('0x2'))(_0x6793('0x3'));var moment=require(_0x6793('0x4'));var BPromise=require(_0x6793('0x5'));var rp=require(_0x6793('0x6'));var fs=require('fs');var path=require(_0x6793('0x7'));var rimraf=require(_0x6793('0x8'));var config=require(_0x6793('0x9'));var attributes=require('./mailQueue.attributes');module[_0x6793('0xa')]=function(_0x3a7327,_0x522cab){return _0x3a7327[_0x6793('0xb')](_0x6793('0xc'),attributes,{'tableName':_0x6793('0xd'),'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 fcf0e43..0a87692 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 _0x6610=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','attributes','include','map','model','GetMailQueue','ShowMailQueue','find','where','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x1ba00f,_0x127886){var _0x5238bf=function(_0x55efc8){while(--_0x55efc8){_0x1ba00f['push'](_0x1ba00f['shift']());}};_0x5238bf(++_0x127886);}(_0x6610,0x152));var _0x0661=function(_0x482f78,_0x2031a6){_0x482f78=_0x482f78-0x0;var _0xba9913=_0x6610[_0x482f78];return _0xba9913;};'use strict';var _=require(_0x0661('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0661('0x1'));var fs=require('fs');var Redis=require(_0x0661('0x2'));var db=require(_0x0661('0x3'))['db'];var utils=require(_0x0661('0x4'));var logger=require(_0x0661('0x5'))(_0x0661('0x6'));var config=require(_0x0661('0x7'));var jayson=require(_0x0661('0x8'));var client=jayson['client'][_0x0661('0x9')]({'port':0x232a});config['redis']=_[_0x0661('0xa')](config[_0x0661('0xb')],{'host':_0x0661('0xc'),'port':0x18eb});var socket=require(_0x0661('0xd'))(new Redis(config[_0x0661('0xb')]));require(_0x0661('0xe'))[_0x0661('0xf')](socket);function respondWithRpcPromise(_0x2ecd0d,_0xc3bd64,_0x4f6224){return new BPromise(function(_0x5737cd,_0x5b69be){return client[_0x0661('0x10')](_0x2ecd0d,_0x4f6224)[_0x0661('0x11')](function(_0x572e01){logger[_0x0661('0x12')](_0x0661('0x13'),_0xc3bd64,_0x0661('0x14'));logger[_0x0661('0x15')](_0x0661('0x16'),_0xc3bd64,_0x0661('0x14'),JSON[_0x0661('0x17')](_0x572e01));if(_0x572e01['error']){if(_0x572e01[_0x0661('0x18')][_0x0661('0x19')]===0x1f4){logger[_0x0661('0x18')]('MailQueue,\x20%s,\x20%s',_0xc3bd64,_0x572e01['error'][_0x0661('0x1a')]);return _0x5b69be(_0x572e01[_0x0661('0x18')][_0x0661('0x1a')]);}logger['error'](_0x0661('0x13'),_0xc3bd64,_0x572e01[_0x0661('0x18')][_0x0661('0x1a')]);return _0x5737cd(_0x572e01[_0x0661('0x18')][_0x0661('0x1a')]);}else{logger[_0x0661('0x12')](_0x0661('0x13'),_0xc3bd64,'request\x20sent');_0x5737cd(_0x572e01['result'][_0x0661('0x1a')]);}})[_0x0661('0x1b')](function(_0x278d5a){logger[_0x0661('0x18')](_0x0661('0x13'),_0xc3bd64,_0x278d5a);_0x5b69be(_0x278d5a);});});}exports['GetMailQueue']=function(_0x4c04e5){var _0x8a5a6b=this;return new Promise(function(_0x359038,_0x49f81d){return db['MailQueue']['findAll']({'raw':_0x4c04e5[_0x0661('0x1c')]?_0x4c04e5[_0x0661('0x1c')][_0x0661('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c04e5['options']?_0x4c04e5[_0x0661('0x1c')]['where']||null:null,'attributes':_0x4c04e5[_0x0661('0x1c')]?_0x4c04e5[_0x0661('0x1c')][_0x0661('0x1e')]||null:null,'limit':_0x4c04e5[_0x0661('0x1c')]?_0x4c04e5['options']['limit']||null:null,'include':_0x4c04e5[_0x0661('0x1c')]?_0x4c04e5[_0x0661('0x1c')][_0x0661('0x1f')]?_[_0x0661('0x20')](_0x4c04e5[_0x0661('0x1c')][_0x0661('0x1f')],function(_0x5d7e10){return{'model':db[_0x5d7e10['model']],'as':_0x5d7e10['as'],'attributes':_0x5d7e10[_0x0661('0x1e')],'include':_0x5d7e10[_0x0661('0x1f')]?_[_0x0661('0x20')](_0x5d7e10[_0x0661('0x1f')],function(_0x1cf9d0){return{'model':db[_0x1cf9d0[_0x0661('0x21')]],'as':_0x1cf9d0['as'],'attributes':_0x1cf9d0[_0x0661('0x1e')],'include':_0x1cf9d0[_0x0661('0x1f')]?_['map'](_0x1cf9d0['include'],function(_0x31f28a){return{'model':db[_0x31f28a[_0x0661('0x21')]],'as':_0x31f28a['as'],'attributes':_0x31f28a[_0x0661('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0661('0x11')](function(_0x4dea45){logger['info'](_0x0661('0x22'),_0x4c04e5);logger['debug'](_0x0661('0x22'),_0x4c04e5,JSON[_0x0661('0x17')](_0x4dea45));_0x359038(_0x4dea45);})[_0x0661('0x1b')](function(_0x2e3a17){logger['error'](_0x0661('0x22'),_0x2e3a17['message'],_0x4c04e5);_0x49f81d(_0x8a5a6b['error'](0x1f4,_0x2e3a17['message']));});});};exports[_0x0661('0x23')]=function(_0x3b77f4){var _0x851bc2=this;return new Promise(function(_0x9e0d22,_0x10c55e){return db['MailQueue'][_0x0661('0x24')]({'raw':_0x3b77f4[_0x0661('0x1c')]?_0x3b77f4[_0x0661('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3b77f4[_0x0661('0x1c')]?_0x3b77f4[_0x0661('0x1c')][_0x0661('0x25')]||null:null,'attributes':_0x3b77f4[_0x0661('0x1c')]?_0x3b77f4['options'][_0x0661('0x1e')]||null:null,'include':_0x3b77f4[_0x0661('0x1c')]?_0x3b77f4['options'][_0x0661('0x1f')]?_[_0x0661('0x20')](_0x3b77f4[_0x0661('0x1c')]['include'],function(_0x1845d9){return{'model':db[_0x1845d9[_0x0661('0x21')]],'as':_0x1845d9['as'],'attributes':_0x1845d9['attributes'],'include':_0x1845d9['include']?_[_0x0661('0x20')](_0x1845d9['include'],function(_0x2834dc){return{'model':db[_0x2834dc[_0x0661('0x21')]],'as':_0x2834dc['as'],'attributes':_0x2834dc[_0x0661('0x1e')],'include':_0x2834dc[_0x0661('0x1f')]?_[_0x0661('0x20')](_0x2834dc['include'],function(_0x2ad5a3){return{'model':db[_0x2ad5a3[_0x0661('0x21')]],'as':_0x2ad5a3['as'],'attributes':_0x2ad5a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0661('0x11')](function(_0x2116b1){logger['info'](_0x0661('0x23'),_0x3b77f4);logger[_0x0661('0x15')](_0x0661('0x23'),_0x3b77f4,JSON['stringify'](_0x2116b1));_0x9e0d22(_0x2116b1);})['catch'](function(_0x342a42){logger[_0x0661('0x18')](_0x0661('0x23'),_0x342a42[_0x0661('0x1a')],_0x3b77f4);_0x10c55e(_0x851bc2[_0x0661('0x18')](0x1f4,_0x342a42[_0x0661('0x1a')]));});});}; \ No newline at end of file +var _0x585b=['MailQueue','options','raw','where','attributes','include','map','model','catch','ShowMailQueue','find','lodash','util','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','GetMailQueue'];(function(_0x1daca2,_0x45f81b){var _0x1d19f5=function(_0x28c723){while(--_0x28c723){_0x1daca2['push'](_0x1daca2['shift']());}};_0x1d19f5(++_0x45f81b);}(_0x585b,0x1af));var _0xb585=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x585b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb585('0x0'));var util=require(_0xb585('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb585('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb585('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb585('0x4'));var jayson=require(_0xb585('0x5'));var client=jayson[_0xb585('0x6')][_0xb585('0x7')]({'port':0x232a});config[_0xb585('0x8')]=_['defaults'](config[_0xb585('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb585('0x9'))(new Redis(config[_0xb585('0x8')]));require(_0xb585('0xa'))[_0xb585('0xb')](socket);function respondWithRpcPromise(_0x338cbb,_0x2ca0d8,_0x48ecd2){return new BPromise(function(_0x39bb98,_0x3308fb){return client[_0xb585('0xc')](_0x338cbb,_0x48ecd2)[_0xb585('0xd')](function(_0x164cfc){logger['info'](_0xb585('0xe'),_0x2ca0d8,'request\x20sent');logger[_0xb585('0xf')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2ca0d8,_0xb585('0x10'),JSON[_0xb585('0x11')](_0x164cfc));if(_0x164cfc[_0xb585('0x12')]){if(_0x164cfc[_0xb585('0x12')][_0xb585('0x13')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x2ca0d8,_0x164cfc[_0xb585('0x12')][_0xb585('0x14')]);return _0x3308fb(_0x164cfc[_0xb585('0x12')][_0xb585('0x14')]);}logger[_0xb585('0x12')](_0xb585('0xe'),_0x2ca0d8,_0x164cfc['error']['message']);return _0x39bb98(_0x164cfc[_0xb585('0x12')]['message']);}else{logger[_0xb585('0x15')](_0xb585('0xe'),_0x2ca0d8,_0xb585('0x10'));_0x39bb98(_0x164cfc[_0xb585('0x16')]['message']);}})['catch'](function(_0x49ca8a){logger[_0xb585('0x12')](_0xb585('0xe'),_0x2ca0d8,_0x49ca8a);_0x3308fb(_0x49ca8a);});});}exports[_0xb585('0x17')]=function(_0x4b7beb){var _0x5200f2=this;return new Promise(function(_0x40c5cb,_0x5b5bb6){return db[_0xb585('0x18')]['findAll']({'raw':_0x4b7beb[_0xb585('0x19')]?_0x4b7beb[_0xb585('0x19')][_0xb585('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b7beb['options']?_0x4b7beb['options'][_0xb585('0x1b')]||null:null,'attributes':_0x4b7beb['options']?_0x4b7beb[_0xb585('0x19')][_0xb585('0x1c')]||null:null,'limit':_0x4b7beb['options']?_0x4b7beb['options']['limit']||null:null,'include':_0x4b7beb['options']?_0x4b7beb[_0xb585('0x19')][_0xb585('0x1d')]?_[_0xb585('0x1e')](_0x4b7beb[_0xb585('0x19')]['include'],function(_0x116b6a){return{'model':db[_0x116b6a['model']],'as':_0x116b6a['as'],'attributes':_0x116b6a['attributes'],'include':_0x116b6a[_0xb585('0x1d')]?_[_0xb585('0x1e')](_0x116b6a[_0xb585('0x1d')],function(_0x416a91){return{'model':db[_0x416a91[_0xb585('0x1f')]],'as':_0x416a91['as'],'attributes':_0x416a91['attributes'],'include':_0x416a91[_0xb585('0x1d')]?_[_0xb585('0x1e')](_0x416a91[_0xb585('0x1d')],function(_0x2af30b){return{'model':db[_0x2af30b['model']],'as':_0x2af30b['as'],'attributes':_0x2af30b[_0xb585('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb585('0xd')](function(_0x25bcea){logger[_0xb585('0x15')](_0xb585('0x17'),_0x4b7beb);logger['debug'](_0xb585('0x17'),_0x4b7beb,JSON[_0xb585('0x11')](_0x25bcea));_0x40c5cb(_0x25bcea);})[_0xb585('0x20')](function(_0x363b53){logger[_0xb585('0x12')]('GetMailQueue',_0x363b53['message'],_0x4b7beb);_0x5b5bb6(_0x5200f2[_0xb585('0x12')](0x1f4,_0x363b53['message']));});});};exports[_0xb585('0x21')]=function(_0x35a380){var _0x5788a5=this;return new Promise(function(_0x5b9877,_0x1a114e){return db['MailQueue'][_0xb585('0x22')]({'raw':_0x35a380[_0xb585('0x19')]?_0x35a380[_0xb585('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x35a380['options']?_0x35a380['options']['where']||null:null,'attributes':_0x35a380[_0xb585('0x19')]?_0x35a380['options'][_0xb585('0x1c')]||null:null,'include':_0x35a380['options']?_0x35a380['options']['include']?_[_0xb585('0x1e')](_0x35a380[_0xb585('0x19')][_0xb585('0x1d')],function(_0x14ccd7){return{'model':db[_0x14ccd7[_0xb585('0x1f')]],'as':_0x14ccd7['as'],'attributes':_0x14ccd7['attributes'],'include':_0x14ccd7[_0xb585('0x1d')]?_[_0xb585('0x1e')](_0x14ccd7['include'],function(_0x1de8ba){return{'model':db[_0x1de8ba[_0xb585('0x1f')]],'as':_0x1de8ba['as'],'attributes':_0x1de8ba[_0xb585('0x1c')],'include':_0x1de8ba[_0xb585('0x1d')]?_['map'](_0x1de8ba[_0xb585('0x1d')],function(_0x11ec3f){return{'model':db[_0x11ec3f['model']],'as':_0x11ec3f['as'],'attributes':_0x11ec3f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb585('0xd')](function(_0x3198ca){logger[_0xb585('0x15')](_0xb585('0x21'),_0x35a380);logger['debug']('ShowMailQueue',_0x35a380,JSON[_0xb585('0x11')](_0x3198ca));_0x5b9877(_0x3198ca);})[_0xb585('0x20')](function(_0x292863){logger[_0xb585('0x12')]('ShowMailQueue',_0x292863[_0xb585('0x14')],_0x35a380);_0x1a114e(_0x5788a5[_0xb585('0x12')](0x1f4,_0x292863[_0xb585('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a7ab9fe..1c72f2e 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 _0x8f3b=['register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x4c0122,_0x250c3a){var _0x4a680b=function(_0x77afb){while(--_0x77afb){_0x4c0122['push'](_0x4c0122['shift']());}};_0x4a680b(++_0x250c3a);}(_0x8f3b,0x1d9));var _0xb8f3=function(_0x4271a4,_0x51588d){_0x4271a4=_0x4271a4-0x0;var _0x35a8b1=_0x8f3b[_0x4271a4];return _0x35a8b1;};'use strict';var MailQueueEvents=require(_0xb8f3('0x0'));var events=['save',_0xb8f3('0x1'),'update'];function createListener(_0x41d4ed,_0x22ae77){return function(_0x54e80b){_0x22ae77['emit'](_0x41d4ed,_0x54e80b);};}function removeListener(_0x3ec52a,_0x1837fc){return function(){MailQueueEvents['removeListener'](_0x3ec52a,_0x1837fc);};}exports[_0xb8f3('0x2')]=function(_0x566d29){for(var _0x3c4250=0x0,_0x4cb9e8=events[_0xb8f3('0x3')];_0x3c4250<_0x4cb9e8;_0x3c4250++){var _0x581845=events[_0x3c4250];var _0x2f375f=createListener(_0xb8f3('0x4')+_0x581845,_0x566d29);MailQueueEvents['on'](_0x581845,_0x2f375f);}}; \ No newline at end of file +var _0xeddd=['register','length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xeddd,0x1aa));var _0xdedd=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeddd[_0x11005e];return _0x29338f;};'use strict';var MailQueueEvents=require(_0xdedd('0x0'));var events=[_0xdedd('0x1'),_0xdedd('0x2'),_0xdedd('0x3')];function createListener(_0x4b2b57,_0x39175e){return function(_0x2bbd6f){_0x39175e[_0xdedd('0x4')](_0x4b2b57,_0x2bbd6f);};}function removeListener(_0x396de1,_0x29e64d){return function(){MailQueueEvents[_0xdedd('0x5')](_0x396de1,_0x29e64d);};}exports[_0xdedd('0x6')]=function(_0x141384){for(var _0x2e28a8=0x0,_0x2545d5=events[_0xdedd('0x7')];_0x2e28a8<_0x2545d5;_0x2e28a8++){var _0x5b5617=events[_0x2e28a8];var _0x5aae70=createListener(_0xdedd('0x8')+_0x5b5617,_0x141384);MailQueueEvents['on'](_0x5b5617,_0x5aae70);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1fb00a4..37208bc 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 _0x70ba=['./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x70ba,0x99));var _0xa70b=function(_0x4813f8,_0x1f9246){_0x4813f8=_0x4813f8-0x0;var _0x24d0d4=_0x70ba[_0x4813f8];return _0x24d0d4;};'use strict';var multer=require('multer');var util=require(_0xa70b('0x0'));var path=require(_0xa70b('0x1'));var timeout=require('connect-timeout');var express=require(_0xa70b('0x2'));var router=express['Router']();var fs_extra=require(_0xa70b('0x3'));var auth=require(_0xa70b('0x4'));var interaction=require(_0xa70b('0x5'));var config=require(_0xa70b('0x6'));var controller=require(_0xa70b('0x7'));router[_0xa70b('0x8')]('/',auth[_0xa70b('0x9')](),controller[_0xa70b('0xa')]);router[_0xa70b('0x8')]('/describe',auth[_0xa70b('0x9')](),controller[_0xa70b('0xb')]);router['get'](_0xa70b('0xc'),auth[_0xa70b('0x9')](),controller[_0xa70b('0xd')]);router[_0xa70b('0xe')]('/',auth['isAuthenticated'](),controller[_0xa70b('0xf')]);router[_0xa70b('0x10')]('/:id',auth[_0xa70b('0x9')](),controller[_0xa70b('0x11')]);router[_0xa70b('0x12')](_0xa70b('0xc'),auth[_0xa70b('0x9')](),controller['destroy']);module[_0xa70b('0x13')]=router; \ No newline at end of file +var _0xac4c=['describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','index','isAuthenticated'];(function(_0x1ff808,_0x5d28f7){var _0x11a007=function(_0x47b44c){while(--_0x47b44c){_0x1ff808['push'](_0x1ff808['shift']());}};_0x11a007(++_0x5d28f7);}(_0xac4c,0x134));var _0xcac4=function(_0x5de998,_0x5285f6){_0x5de998=_0x5de998-0x0;var _0x13cb7d=_0xac4c[_0x5de998];return _0x13cb7d;};'use strict';var multer=require(_0xcac4('0x0'));var util=require(_0xcac4('0x1'));var path=require(_0xcac4('0x2'));var timeout=require(_0xcac4('0x3'));var express=require(_0xcac4('0x4'));var router=express['Router']();var fs_extra=require(_0xcac4('0x5'));var auth=require(_0xcac4('0x6'));var interaction=require(_0xcac4('0x7'));var config=require('../../config/environment');var controller=require(_0xcac4('0x8'));router[_0xcac4('0x9')]('/',auth['isAuthenticated'](),controller[_0xcac4('0xa')]);router['get']('/describe',auth[_0xcac4('0xb')](),controller[_0xcac4('0xc')]);router[_0xcac4('0x9')](_0xcac4('0xd'),auth[_0xcac4('0xb')](),controller[_0xcac4('0xe')]);router[_0xcac4('0xf')]('/',auth[_0xcac4('0xb')](),controller['create']);router['put'](_0xcac4('0xd'),auth[_0xcac4('0xb')](),controller[_0xcac4('0x10')]);router[_0xcac4('0x11')](_0xcac4('0xd'),auth[_0xcac4('0xb')](),controller[_0xcac4('0x12')]);module[_0xcac4('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 4453d1e..9e8a889 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 _0xd335=['DATE','STRING'];(function(_0x5e8f40,_0x304a72){var _0x22d56c=function(_0x26fe41){while(--_0x26fe41){_0x5e8f40['push'](_0x5e8f40['shift']());}};_0x22d56c(++_0x304a72);}(_0xd335,0x1b5));var _0x5d33=function(_0xa23267,_0x1a3e79){_0xa23267=_0xa23267-0x0;var _0x4cf912=_0xd335[_0xa23267];return _0x4cf912;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5d33('0x0')]},'joinAt':{'type':Sequelize[_0x5d33('0x1')]},'leaveAt':{'type':Sequelize[_0x5d33('0x1')]},'acceptAt':{'type':Sequelize[_0x5d33('0x1')]},'exitAt':{'type':Sequelize[_0x5d33('0x1')]},'reason':{'type':Sequelize[_0x5d33('0x0')]}}; \ No newline at end of file +var _0x9069=['sequelize','exports','STRING','DATE','moment'];(function(_0x39b9fb,_0x39a2d3){var _0x5633ca=function(_0xe63b2b){while(--_0xe63b2b){_0x39b9fb['push'](_0x39b9fb['shift']());}};_0x5633ca(++_0x39a2d3);}(_0x9069,0x103));var _0x9906=function(_0x19a028,_0x161bbc){_0x19a028=_0x19a028-0x0;var _0x2822b0=_0x9069[_0x19a028];return _0x2822b0;};'use strict';var moment=require(_0x9906('0x0'));var Sequelize=require(_0x9906('0x1'));module[_0x9906('0x2')]={'uniqueid':{'type':Sequelize[_0x9906('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9906('0x3')]},'joinAt':{'type':Sequelize[_0x9906('0x4')]},'leaveAt':{'type':Sequelize[_0x9906('0x4')]},'acceptAt':{'type':Sequelize[_0x9906('0x4')]},'exitAt':{'type':Sequelize[_0x9906('0x4')]},'reason':{'type':Sequelize[_0x9906('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index df8912c..6decc78 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueueReport','includeAll','rows','catch','show'];(function(_0x2ce171,_0x5a2303){var _0x54a006=function(_0x2ad6e7){while(--_0x2ad6e7){_0x2ce171['push'](_0x2ce171['shift']());}};_0x54a006(++_0x5a2303);}(_0x0295,0x1f0));var _0x5029=function(_0x4e029f,_0x177074){_0x4e029f=_0x4e029f-0x0;var _0x135b7e=_0x0295[_0x4e029f];return _0x135b7e;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['MailQueueReport'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['MailQueueReport'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x4e2e=['name','send','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack'];(function(_0xf04ea3,_0x58310e){var _0x1c8c66=function(_0x35e549){while(--_0x35e549){_0xf04ea3['push'](_0xf04ea3['shift']());}};_0x1c8c66(++_0x58310e);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x47a7cd,_0xe39003){_0x47a7cd=_0x47a7cd-0x0;var _0x2b5ce0=_0x4e2e[_0x47a7cd];return _0x2b5ce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['MailQueueReport'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['MailQueueReport'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));};exports[_0xe4e2('0x4c')]=function(_0x582674,_0x169251){return db[_0xe4e2('0x2c')]['describe']()[_0xe4e2('0x26')](respondWithResult(_0x169251,null))[_0xe4e2('0x43')](handleError(_0x169251,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 28da185..97aca0c 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 _0x13d6=['define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x54ed7d,_0x2c8b33){var _0x41c1de=function(_0x107965){while(--_0x107965){_0x54ed7d['push'](_0x54ed7d['shift']());}};_0x41c1de(++_0x2c8b33);}(_0x13d6,0x196));var _0x613d=function(_0x360d26,_0x700e92){_0x360d26=_0x360d26-0x0;var _0x180eef=_0x13d6[_0x360d26];return _0x180eef;};'use strict';var _=require(_0x613d('0x0'));var util=require(_0x613d('0x1'));var logger=require(_0x613d('0x2'))(_0x613d('0x3'));var moment=require(_0x613d('0x4'));var BPromise=require(_0x613d('0x5'));var rp=require(_0x613d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x613d('0x7'));var attributes=require(_0x613d('0x8'));module[_0x613d('0x9')]=function(_0x299b43,_0xc03cd1){return _0x299b43[_0x613d('0xa')](_0x613d('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x613d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa456,0x142));var _0x6a45=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa456[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));module[_0x6a45('0x9')]=function(_0x14da6b,_0x4dfbfa){return _0x14da6b[_0x6a45('0xa')](_0x6a45('0xb'),attributes,{'tableName':_0x6a45('0xc'),'paranoid':![],'indexes':[{'name':_0x6a45('0xd'),'fields':[_0x6a45('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 7169aef..de918b7 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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b621f,_0x315e52){var _0x53b3a8=function(_0x21e34a){while(--_0x21e34a){_0x3b621f['push'](_0x3b621f['shift']());}};_0x53b3a8(++_0x315e52);}(_0x326f,0xd1));var _0xf326=function(_0x482010,_0x29bdff){_0x482010=_0x482010-0x0;var _0x18b18f=_0x326f[_0x482010];return _0x18b18f;};'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')]('MailQueueReport,\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')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x680c62,_0x4e8bd4){var _0x240a1a=function(_0xe5618f){while(--_0xe5618f){_0x680c62['push'](_0x680c62['shift']());}};_0x240a1a(++_0x4e8bd4);}(_0x7a54,0x106));var _0x47a5=function(_0x2f27cf,_0x160d7a){_0x2f27cf=_0x2f27cf-0x0;var _0x14a099=_0x7a54[_0x2f27cf];return _0x14a099;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 97c1678..09404d6 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15db7e,_0x1333e4){var _0x3ef26d=function(_0x40a448){while(--_0x40a448){_0x15db7e['push'](_0x15db7e['shift']());}};_0x3ef26d(++_0x1333e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 9bbebcf..f03bd02 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 _0x71a8=['INBOX','exports','STRING','BOOLEAN','INTEGER'];(function(_0x32b734,_0x368370){var _0x456d3a=function(_0x50760e){while(--_0x50760e){_0x32b734['push'](_0x32b734['shift']());}};_0x456d3a(++_0x368370);}(_0x71a8,0x79));var _0x871a=function(_0x9b07ed,_0x3f7a62){_0x9b07ed=_0x9b07ed-0x0;var _0x46be68=_0x71a8[_0x9b07ed];return _0x46be68;};'use strict';var Sequelize=require('sequelize');module[_0x871a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x871a('0x1')]},'authentication':{'type':Sequelize[_0x871a('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x871a('0x3')]},'tls':{'type':Sequelize[_0x871a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x871a('0x1')],'defaultValue':_0x871a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x871a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8c1a=['BOOLEAN','INBOX','sequelize','exports','STRING','INTEGER'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0x8c1a,0x9e));var _0xa8c1=function(_0x257896,_0x8de612){_0x257896=_0x257896-0x0;var _0x1ff242=_0x8c1a[_0x257896];return _0x1ff242;};'use strict';var Sequelize=require(_0xa8c1('0x0'));module[_0xa8c1('0x1')]={'description':{'type':Sequelize[_0xa8c1('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xa8c1('0x2')]},'password':{'type':Sequelize[_0xa8c1('0x2')]},'port':{'type':Sequelize[_0xa8c1('0x3')]},'tls':{'type':Sequelize[_0xa8c1('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa8c1('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xa8c1('0x2')]},'modernAuthentication':{'type':Sequelize[_0xa8c1('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 745044f..6b81353 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 _0xd134=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','mail_servers_in','util'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xd134,0x1cd));var _0x4d13=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xd134[_0xfa634c];return _0x73e478;};'use strict';var _=require('lodash');var util=require(_0x4d13('0x0'));var logger=require(_0x4d13('0x1'))(_0x4d13('0x2'));var moment=require(_0x4d13('0x3'));var BPromise=require(_0x4d13('0x4'));var rp=require(_0x4d13('0x5'));var fs=require('fs');var path=require(_0x4d13('0x6'));var rimraf=require('rimraf');var config=require(_0x4d13('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x4d13('0x8')]=function(_0x3598b8,_0x3158b5){return _0x3598b8[_0x4d13('0x9')]('MailServerIn',attributes,{'tableName':_0x4d13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0079=['MailServerIn','mail_servers_in','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerIn.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0079,0x1f1));var _0x9007=function(_0x1876cf,_0x319c99){_0x1876cf=_0x1876cf-0x0;var _0x5896e3=_0x0079[_0x1876cf];return _0x5896e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9007('0x0'))(_0x9007('0x1'));var moment=require('moment');var BPromise=require(_0x9007('0x2'));var rp=require(_0x9007('0x3'));var fs=require('fs');var path=require(_0x9007('0x4'));var rimraf=require(_0x9007('0x5'));var config=require('../../config/environment');var attributes=require(_0x9007('0x6'));module['exports']=function(_0x4112db,_0x4ef44d){return _0x4112db['define'](_0x9007('0x7'),attributes,{'tableName':_0x9007('0x8'),'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 74a3187..3f12b8b 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 _0x1b73=['options','raw','attributes','limit','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x1b73,0x1d5));var _0x31b7=function(_0x15bc3d,_0x467832){_0x15bc3d=_0x15bc3d-0x0;var _0x1f1fbc=_0x1b73[_0x15bc3d];return _0x1f1fbc;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('MailServerIn,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('MailServerIn,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});}exports[_0x31b7('0x17')]=function(_0x5f3245){var _0x223f9f=this;return new Promise(function(_0x437eba,_0x1dc28c){return db[_0x31b7('0x18')][_0x31b7('0x19')]({'raw':_0x5f3245['options']?_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245[_0x31b7('0x1a')]['where']||null:null,'attributes':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1c')]||null:null,'limit':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245['options'][_0x31b7('0x1d')]||null:null,'include':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1e')]?_[_0x31b7('0x1f')](_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1e')],function(_0x20e5b0){return{'model':db[_0x20e5b0[_0x31b7('0x20')]],'as':_0x20e5b0['as'],'attributes':_0x20e5b0['attributes'],'include':_0x20e5b0[_0x31b7('0x1e')]?_[_0x31b7('0x1f')](_0x20e5b0[_0x31b7('0x1e')],function(_0x2c993b){return{'model':db[_0x2c993b['model']],'as':_0x2c993b['as'],'attributes':_0x2c993b[_0x31b7('0x1c')],'include':_0x2c993b['include']?_[_0x31b7('0x1f')](_0x2c993b[_0x31b7('0x1e')],function(_0x14b63f){return{'model':db[_0x14b63f[_0x31b7('0x20')]],'as':_0x14b63f['as'],'attributes':_0x14b63f[_0x31b7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x31b7('0xb')](function(_0x21ab03){logger[_0x31b7('0x14')]('GetMailServerIn',_0x5f3245);logger['debug']('GetMailServerIn',_0x5f3245,JSON[_0x31b7('0x10')](_0x21ab03));_0x437eba(_0x21ab03);})[_0x31b7('0x16')](function(_0x2a7c54){logger['error'](_0x31b7('0x17'),_0x2a7c54[_0x31b7('0x13')],_0x5f3245);_0x1dc28c(_0x223f9f[_0x31b7('0x11')](0x1f4,_0x2a7c54[_0x31b7('0x13')]));});});}; \ No newline at end of file +var _0x3822=['MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','findAll','options','raw','limit','include','map','model','then','info','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x318a16,_0x410696){var _0x3d4459=function(_0x534efa){while(--_0x534efa){_0x318a16['push'](_0x318a16['shift']());}};_0x3d4459(++_0x410696);}(_0x3822,0x65));var _0x2382=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x3822[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x2382('0x0'));var util=require(_0x2382('0x1'));var moment=require(_0x2382('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2382('0x3'))['db'];var utils=require(_0x2382('0x4'));var logger=require(_0x2382('0x5'))(_0x2382('0x6'));var config=require('../../config/environment');var jayson=require(_0x2382('0x7'));var client=jayson[_0x2382('0x8')][_0x2382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a4e2,_0x49d5b2,_0x5d37d0){return new BPromise(function(_0x532e71,_0x39025a){return client[_0x2382('0xa')](_0x24a4e2,_0x5d37d0)['then'](function(_0x23f6b0){logger['info']('MailServerIn,\x20%s,\x20%s',_0x49d5b2,'request\x20sent');logger[_0x2382('0xb')](_0x2382('0xc'),_0x49d5b2,_0x2382('0xd'),JSON['stringify'](_0x23f6b0));if(_0x23f6b0[_0x2382('0xe')]){if(_0x23f6b0[_0x2382('0xe')]['code']===0x1f4){logger[_0x2382('0xe')](_0x2382('0xf'),_0x49d5b2,_0x23f6b0['error'][_0x2382('0x10')]);return _0x39025a(_0x23f6b0[_0x2382('0xe')][_0x2382('0x10')]);}logger[_0x2382('0xe')]('MailServerIn,\x20%s,\x20%s',_0x49d5b2,_0x23f6b0[_0x2382('0xe')][_0x2382('0x10')]);return _0x532e71(_0x23f6b0[_0x2382('0xe')]['message']);}else{logger['info'](_0x2382('0xf'),_0x49d5b2,_0x2382('0xd'));_0x532e71(_0x23f6b0[_0x2382('0x11')]['message']);}})[_0x2382('0x12')](function(_0x1a54fb){logger[_0x2382('0xe')](_0x2382('0xf'),_0x49d5b2,_0x1a54fb);_0x39025a(_0x1a54fb);});});}exports[_0x2382('0x13')]=function(_0x14b793){var _0xcc3f25=this;return new Promise(function(_0x2542df,_0x455ba1){return db['MailServerIn'][_0x2382('0x14')]({'raw':_0x14b793[_0x2382('0x15')]?_0x14b793[_0x2382('0x15')][_0x2382('0x16')]===undefined?!![]:![]:!![],'where':_0x14b793[_0x2382('0x15')]?_0x14b793['options']['where']||null:null,'attributes':_0x14b793[_0x2382('0x15')]?_0x14b793['options']['attributes']||null:null,'limit':_0x14b793[_0x2382('0x15')]?_0x14b793[_0x2382('0x15')][_0x2382('0x17')]||null:null,'include':_0x14b793[_0x2382('0x15')]?_0x14b793[_0x2382('0x15')][_0x2382('0x18')]?_[_0x2382('0x19')](_0x14b793[_0x2382('0x15')][_0x2382('0x18')],function(_0x5c20a0){return{'model':db[_0x5c20a0[_0x2382('0x1a')]],'as':_0x5c20a0['as'],'attributes':_0x5c20a0['attributes'],'include':_0x5c20a0[_0x2382('0x18')]?_[_0x2382('0x19')](_0x5c20a0['include'],function(_0x196eeb){return{'model':db[_0x196eeb[_0x2382('0x1a')]],'as':_0x196eeb['as'],'attributes':_0x196eeb['attributes'],'include':_0x196eeb[_0x2382('0x18')]?_[_0x2382('0x19')](_0x196eeb['include'],function(_0x421bef){return{'model':db[_0x421bef[_0x2382('0x1a')]],'as':_0x421bef['as'],'attributes':_0x421bef['attributes']};}):[]};}):[]};}):[]:[]})[_0x2382('0x1b')](function(_0x419407){logger[_0x2382('0x1c')](_0x2382('0x13'),_0x14b793);logger[_0x2382('0xb')](_0x2382('0x13'),_0x14b793,JSON['stringify'](_0x419407));_0x2542df(_0x419407);})[_0x2382('0x12')](function(_0x3d89c4){logger['error']('GetMailServerIn',_0x3d89c4[_0x2382('0x10')],_0x14b793);_0x455ba1(_0xcc3f25[_0x2382('0xe')](0x1f4,_0x3d89c4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4203793..3140536 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(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 5e54560..285dbd2 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 _0x5eb8=['INTEGER','BOOLEAN','STRING'];(function(_0x432d9a,_0x31d51c){var _0x1bc16a=function(_0xcdce93){while(--_0xcdce93){_0x432d9a['push'](_0x432d9a['shift']());}};_0x1bc16a(++_0x31d51c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0x5eb8[_0x2f8a7c];return _0x257e01;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x85eb('0x0')]},'host':{'type':Sequelize[_0x85eb('0x0')]},'user':{'type':Sequelize[_0x85eb('0x0')]},'pass':{'type':Sequelize[_0x85eb('0x0')]},'port':{'type':Sequelize[_0x85eb('0x1')]},'secure':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x85eb('0x0')]},'authentication':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5799d0,_0x589198){var _0x9bd02a=function(_0x3ce22a){while(--_0x3ce22a){_0x5799d0['push'](_0x5799d0['shift']());}};_0x9bd02a(++_0x589198);}(_0xcf66,0x71));var _0x6cf6=function(_0x47f2c4,_0x29e2d1){_0x47f2c4=_0x47f2c4-0x0;var _0x222318=_0xcf66[_0x47f2c4];return _0x222318;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'description':{'type':Sequelize[_0x6cf6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6cf6('0x2')]},'pass':{'type':Sequelize[_0x6cf6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x6cf6('0x2')]},'authentication':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5eb662e..2a577a7 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 _0x6496=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','length','include','find','create','catch','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName'];(function(_0x39ecaa,_0x3e4866){var _0x2eb7a5=function(_0x410f0c){while(--_0x410f0c){_0x39ecaa['push'](_0x39ecaa['shift']());}};_0x2eb7a5(++_0x3e4866);}(_0x6496,0x140));var _0x6649=function(_0x2c2244,_0x197be1){_0x2c2244=_0x2c2244-0x0;var _0x1e3b27=_0x6496[_0x2c2244];return _0x1e3b27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6649('0x0'));var zipdir=require(_0x6649('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6649('0x2'));var moment=require(_0x6649('0x3'));var BPromise=require(_0x6649('0x4'));var Mustache=require(_0x6649('0x5'));var util=require('util');var path=require(_0x6649('0x6'));var sox=require(_0x6649('0x7'));var csv=require(_0x6649('0x8'));var ejs=require(_0x6649('0x9'));var fs=require('fs');var fs_extra=require(_0x6649('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6649('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6649('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6649('0xd'));var Redis=require(_0x6649('0xe'));var authService=require(_0x6649('0xf'));var qs=require(_0x6649('0x10'));var as=require(_0x6649('0x11'));var hardwareService=require(_0x6649('0x12'));var logger=require(_0x6649('0x13'))('api');var utils=require(_0x6649('0x14'));var config=require(_0x6649('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6649('0x16'))['db'];function respondWithStatusCode(_0x2e11b4,_0x164ca0){_0x164ca0=_0x164ca0||0xcc;return function(_0x339ccd){if(_0x339ccd){return _0x2e11b4['sendStatus'](_0x164ca0);}return _0x2e11b4[_0x6649('0x17')](_0x164ca0)[_0x6649('0x18')]();};}function respondWithResult(_0x11b361,_0x3e8ea0){_0x3e8ea0=_0x3e8ea0||0xc8;return function(_0xee71df){if(_0xee71df){return _0x11b361[_0x6649('0x17')](_0x3e8ea0)[_0x6649('0x19')](_0xee71df);}};}function respondWithFilteredResult(_0x15f0e4,_0xa629c2){return function(_0x9fcc6d){if(_0x9fcc6d){var _0x57e408=typeof _0xa629c2[_0x6649('0x1a')]===_0x6649('0x1b')&&typeof _0xa629c2[_0x6649('0x1c')]===_0x6649('0x1b');var _0x13a063=_0x9fcc6d[_0x6649('0x1d')];var _0x5f43c0=_0x57e408?0x0:_0xa629c2['offset'];var _0xa224da=_0x57e408?_0x9fcc6d['count']:_0xa629c2[_0x6649('0x1a')]+_0xa629c2[_0x6649('0x1c')];var _0x1c4d43;if(_0xa224da>=_0x13a063){_0xa224da=_0x13a063;_0x1c4d43=0xc8;}else{_0x1c4d43=0xce;}_0x15f0e4[_0x6649('0x17')](_0x1c4d43);return _0x15f0e4[_0x6649('0x1e')](_0x6649('0x1f'),_0x5f43c0+'-'+_0xa224da+'/'+_0x13a063)[_0x6649('0x19')](_0x9fcc6d);}return null;};}function patchUpdates(_0x405478){return function(_0x2e11af){try{jsonpatch[_0x6649('0x20')](_0x2e11af,_0x405478,!![]);}catch(_0x342a9d){return BPromise['reject'](_0x342a9d);}return _0x2e11af['save']();};}function saveUpdates(_0x239c04,_0x605bf){return function(_0x679ce1){if(_0x679ce1){return _0x679ce1[_0x6649('0x21')](_0x239c04)['then'](function(_0xbf8c5d){return _0xbf8c5d;});}return null;};}function removeEntity(_0x192926,_0x522deb){return function(_0x468096){if(_0x468096){return _0x468096[_0x6649('0x22')]()[_0x6649('0x23')](function(){_0x192926[_0x6649('0x17')](0xcc)[_0x6649('0x18')]();});}};}function handleEntityNotFound(_0x34d471,_0x3feb73){return function(_0x446f0c){if(!_0x446f0c){_0x34d471[_0x6649('0x24')](0x194);}return _0x446f0c;};}function handleError(_0x193303,_0x4e9f43){_0x4e9f43=_0x4e9f43||0x1f4;return function(_0x5b655e){logger[_0x6649('0x25')](_0x5b655e['stack']);if(_0x5b655e['name']){delete _0x5b655e[_0x6649('0x26')];}_0x193303['status'](_0x4e9f43)[_0x6649('0x27')](_0x5b655e);};}exports[_0x6649('0x28')]=function(_0x237513,_0x56430a){var _0x324069={},_0x21ea2c={},_0xa5181a={'count':0x0,'rows':[]};var _0x17b104=_[_0x6649('0x29')](db[_0x6649('0x2a')][_0x6649('0x2b')],function(_0x4d01dc){return{'name':_0x4d01dc[_0x6649('0x2c')],'type':_0x4d01dc[_0x6649('0x2d')][_0x6649('0x2e')]};});_0x21ea2c[_0x6649('0x2f')]=_[_0x6649('0x29')](_0x17b104,_0x6649('0x26'));_0x21ea2c[_0x6649('0x30')]=_[_0x6649('0x31')](_0x237513[_0x6649('0x30')]);_0x21ea2c[_0x6649('0x32')]=_[_0x6649('0x33')](_0x21ea2c[_0x6649('0x2f')],_0x21ea2c[_0x6649('0x30')]);_0x324069[_0x6649('0x34')]=_['intersection'](_0x21ea2c[_0x6649('0x2f')],qs[_0x6649('0x35')](_0x237513['query']['fields']));_0x324069[_0x6649('0x34')]=_0x324069[_0x6649('0x34')]['length']?_0x324069['attributes']:_0x21ea2c[_0x6649('0x2f')];if(!_0x237513[_0x6649('0x30')][_0x6649('0x36')](_0x6649('0x37'))){_0x324069[_0x6649('0x1c')]=qs['limit'](_0x237513[_0x6649('0x30')]['limit']);_0x324069['offset']=qs[_0x6649('0x1a')](_0x237513[_0x6649('0x30')][_0x6649('0x1a')]);}_0x324069[_0x6649('0x38')]=qs[_0x6649('0x39')](_0x237513['query'][_0x6649('0x39')]);_0x324069[_0x6649('0x3a')]=qs[_0x6649('0x32')](_[_0x6649('0x3b')](_0x237513[_0x6649('0x30')],_0x21ea2c['filters']),_0x17b104);if(_0x237513[_0x6649('0x30')]['filter']){_0x324069[_0x6649('0x3a')]=_[_0x6649('0x3c')](_0x324069[_0x6649('0x3a')],{'$or':_['map'](_0x17b104,function(_0x132c80){if(_0x132c80[_0x6649('0x2d')]!==_0x6649('0x3d')){var _0x5e2a4c={};_0x5e2a4c[_0x132c80[_0x6649('0x26')]]={'$like':'%'+_0x237513[_0x6649('0x30')][_0x6649('0x3e')]+'%'};return _0x5e2a4c;}})});}_0x324069=_['merge']({},_0x324069,_0x237513[_0x6649('0x3f')]);var _0x4d4628={'where':_0x324069[_0x6649('0x3a')]};return db[_0x6649('0x2a')][_0x6649('0x1d')](_0x4d4628)[_0x6649('0x23')](function(_0x588d43){_0xa5181a[_0x6649('0x1d')]=_0x588d43;if(_0x237513['query'][_0x6649('0x40')]){_0x324069['include']=[{'all':!![]}];}return db['MailServerOut'][_0x6649('0x41')](_0x324069);})[_0x6649('0x23')](function(_0x129c36){_0xa5181a[_0x6649('0x42')]=_0x129c36;return _0xa5181a;})[_0x6649('0x23')](respondWithFilteredResult(_0x56430a,_0x324069))['catch'](handleError(_0x56430a,null));};exports['show']=function(_0x2ba5c6,_0x5f5858){var _0x110d7f={'raw':!![],'where':{'id':_0x2ba5c6['params']['id']}},_0x3141ff={};_0x3141ff['model']=_[_0x6649('0x31')](db[_0x6649('0x2a')]['rawAttributes']);_0x3141ff['query']=_['keys'](_0x2ba5c6[_0x6649('0x30')]);_0x3141ff[_0x6649('0x32')]=_['intersection'](_0x3141ff['model'],_0x3141ff[_0x6649('0x30')]);_0x110d7f[_0x6649('0x34')]=_[_0x6649('0x33')](_0x3141ff['model'],qs[_0x6649('0x35')](_0x2ba5c6[_0x6649('0x30')]['fields']));_0x110d7f[_0x6649('0x34')]=_0x110d7f[_0x6649('0x34')][_0x6649('0x43')]?_0x110d7f[_0x6649('0x34')]:_0x3141ff['model'];if(_0x2ba5c6[_0x6649('0x30')][_0x6649('0x40')]){_0x110d7f[_0x6649('0x44')]=[{'all':!![]}];}_0x110d7f=_[_0x6649('0x3c')]({},_0x110d7f,_0x2ba5c6[_0x6649('0x3f')]);return db['MailServerOut'][_0x6649('0x45')](_0x110d7f)[_0x6649('0x23')](handleEntityNotFound(_0x5f5858,null))[_0x6649('0x23')](respondWithResult(_0x5f5858,null))['catch'](handleError(_0x5f5858,null));};exports[_0x6649('0x46')]=function(_0x58db67,_0x227614){return db['MailServerOut'][_0x6649('0x46')](_0x58db67['body'],{})['then'](respondWithResult(_0x227614,0xc9))[_0x6649('0x47')](handleError(_0x227614,null));};exports['update']=function(_0x20775a,_0xe1f228){if(_0x20775a[_0x6649('0x48')]['id']){delete _0x20775a['body']['id'];}return db['MailServerOut'][_0x6649('0x45')]({'where':{'id':_0x20775a['params']['id']}})[_0x6649('0x23')](handleEntityNotFound(_0xe1f228,null))['then'](saveUpdates(_0x20775a[_0x6649('0x48')],null))[_0x6649('0x23')](respondWithResult(_0xe1f228,null))[_0x6649('0x47')](handleError(_0xe1f228,null));};exports['destroy']=function(_0x3dc8e5,_0x1a07aa){return db[_0x6649('0x2a')]['find']({'where':{'id':_0x3dc8e5['params']['id']}})['then'](handleEntityNotFound(_0x1a07aa,null))[_0x6649('0x23')](removeEntity(_0x1a07aa,null))[_0x6649('0x47')](handleError(_0x1a07aa,null));}; \ No newline at end of file +var _0x4d62=['type','key','query','keys','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','MailServerOut','findAll','catch','show','params','length','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','destroy','then','stack','name','send','index','map','rawAttributes'];(function(_0x13e9fc,_0x1b5487){var _0x1ce15e=function(_0x8aeb31){while(--_0x8aeb31){_0x13e9fc['push'](_0x13e9fc['shift']());}};_0x1ce15e(++_0x1b5487);}(_0x4d62,0x125));var _0x24d6=function(_0x51aebb,_0x337d75){_0x51aebb=_0x51aebb-0x0;var _0x4d162e=_0x4d62[_0x51aebb];return _0x4d162e;};'use strict';var emlformat=require(_0x24d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24d6('0x1'));var jsonpatch=require(_0x24d6('0x2'));var rp=require(_0x24d6('0x3'));var moment=require('moment');var BPromise=require(_0x24d6('0x4'));var Mustache=require(_0x24d6('0x5'));var util=require('util');var path=require(_0x24d6('0x6'));var sox=require(_0x24d6('0x7'));var csv=require(_0x24d6('0x8'));var ejs=require(_0x24d6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x24d6('0x8'));var querystring=require('querystring');var Papa=require(_0x24d6('0xa'));var Redis=require(_0x24d6('0xb'));var authService=require(_0x24d6('0xc'));var qs=require(_0x24d6('0xd'));var as=require(_0x24d6('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24d6('0xf'))(_0x24d6('0x10'));var utils=require(_0x24d6('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x24d6('0x12'))['db'];function respondWithStatusCode(_0x5ea633,_0x3f01a9){_0x3f01a9=_0x3f01a9||0xcc;return function(_0x46ecaf){if(_0x46ecaf){return _0x5ea633[_0x24d6('0x13')](_0x3f01a9);}return _0x5ea633[_0x24d6('0x14')](_0x3f01a9)[_0x24d6('0x15')]();};}function respondWithResult(_0x558354,_0x3ba1d2){_0x3ba1d2=_0x3ba1d2||0xc8;return function(_0x2a0112){if(_0x2a0112){return _0x558354[_0x24d6('0x14')](_0x3ba1d2)[_0x24d6('0x16')](_0x2a0112);}};}function respondWithFilteredResult(_0x22fb9c,_0xd10b67){return function(_0x1f520d){if(_0x1f520d){var _0xa55691=typeof _0xd10b67[_0x24d6('0x17')]===_0x24d6('0x18')&&typeof _0xd10b67[_0x24d6('0x19')]===_0x24d6('0x18');var _0x4fb707=_0x1f520d[_0x24d6('0x1a')];var _0xc4c362=_0xa55691?0x0:_0xd10b67['offset'];var _0x1279da=_0xa55691?_0x1f520d[_0x24d6('0x1a')]:_0xd10b67[_0x24d6('0x17')]+_0xd10b67['limit'];var _0x1b7223;if(_0x1279da>=_0x4fb707){_0x1279da=_0x4fb707;_0x1b7223=0xc8;}else{_0x1b7223=0xce;}_0x22fb9c['status'](_0x1b7223);return _0x22fb9c[_0x24d6('0x1b')]('Content-Range',_0xc4c362+'-'+_0x1279da+'/'+_0x4fb707)['json'](_0x1f520d);}return null;};}function patchUpdates(_0x1d3803){return function(_0x1ae389){try{jsonpatch[_0x24d6('0x1c')](_0x1ae389,_0x1d3803,!![]);}catch(_0x3e22d3){return BPromise['reject'](_0x3e22d3);}return _0x1ae389['save']();};}function saveUpdates(_0xe9f564,_0x2dea2c){return function(_0x2e68b){if(_0x2e68b){return _0x2e68b['update'](_0xe9f564)['then'](function(_0x2cef3c){return _0x2cef3c;});}return null;};}function removeEntity(_0x16f4e9,_0x16db74){return function(_0x58681b){if(_0x58681b){return _0x58681b[_0x24d6('0x1d')]()[_0x24d6('0x1e')](function(){_0x16f4e9[_0x24d6('0x14')](0xcc)[_0x24d6('0x15')]();});}};}function handleEntityNotFound(_0x1847d1,_0x5b4e49){return function(_0x90bf32){if(!_0x90bf32){_0x1847d1['sendStatus'](0x194);}return _0x90bf32;};}function handleError(_0x5a0a9b,_0x1bbe7a){_0x1bbe7a=_0x1bbe7a||0x1f4;return function(_0x480b65){logger['error'](_0x480b65[_0x24d6('0x1f')]);if(_0x480b65['name']){delete _0x480b65[_0x24d6('0x20')];}_0x5a0a9b[_0x24d6('0x14')](_0x1bbe7a)[_0x24d6('0x21')](_0x480b65);};}exports[_0x24d6('0x22')]=function(_0x3c025c,_0x179919){var _0x885ad9={},_0xdcc24c={},_0x3c7034={'count':0x0,'rows':[]};var _0x1410b5=_[_0x24d6('0x23')](db['MailServerOut'][_0x24d6('0x24')],function(_0x699f29){return{'name':_0x699f29['fieldName'],'type':_0x699f29[_0x24d6('0x25')][_0x24d6('0x26')]};});_0xdcc24c['model']=_[_0x24d6('0x23')](_0x1410b5,_0x24d6('0x20'));_0xdcc24c[_0x24d6('0x27')]=_[_0x24d6('0x28')](_0x3c025c[_0x24d6('0x27')]);_0xdcc24c[_0x24d6('0x29')]=_['intersection'](_0xdcc24c['model'],_0xdcc24c[_0x24d6('0x27')]);_0x885ad9[_0x24d6('0x2a')]=_[_0x24d6('0x2b')](_0xdcc24c[_0x24d6('0x2c')],qs[_0x24d6('0x2d')](_0x3c025c[_0x24d6('0x27')]['fields']));_0x885ad9['attributes']=_0x885ad9[_0x24d6('0x2a')]['length']?_0x885ad9[_0x24d6('0x2a')]:_0xdcc24c['model'];if(!_0x3c025c[_0x24d6('0x27')]['hasOwnProperty'](_0x24d6('0x2e'))){_0x885ad9[_0x24d6('0x19')]=qs[_0x24d6('0x19')](_0x3c025c[_0x24d6('0x27')][_0x24d6('0x19')]);_0x885ad9[_0x24d6('0x17')]=qs[_0x24d6('0x17')](_0x3c025c[_0x24d6('0x27')][_0x24d6('0x17')]);}_0x885ad9[_0x24d6('0x2f')]=qs['sort'](_0x3c025c[_0x24d6('0x27')][_0x24d6('0x30')]);_0x885ad9[_0x24d6('0x31')]=qs[_0x24d6('0x29')](_[_0x24d6('0x32')](_0x3c025c['query'],_0xdcc24c[_0x24d6('0x29')]),_0x1410b5);if(_0x3c025c[_0x24d6('0x27')]['filter']){_0x885ad9[_0x24d6('0x31')]=_[_0x24d6('0x33')](_0x885ad9[_0x24d6('0x31')],{'$or':_[_0x24d6('0x23')](_0x1410b5,function(_0x75e6bc){if(_0x75e6bc[_0x24d6('0x25')]!=='VIRTUAL'){var _0xe9b349={};_0xe9b349[_0x75e6bc[_0x24d6('0x20')]]={'$like':'%'+_0x3c025c[_0x24d6('0x27')][_0x24d6('0x34')]+'%'};return _0xe9b349;}})});}_0x885ad9=_['merge']({},_0x885ad9,_0x3c025c[_0x24d6('0x35')]);var _0x2ae78e={'where':_0x885ad9[_0x24d6('0x31')]};return db['MailServerOut'][_0x24d6('0x1a')](_0x2ae78e)['then'](function(_0x181e47){_0x3c7034[_0x24d6('0x1a')]=_0x181e47;if(_0x3c025c[_0x24d6('0x27')][_0x24d6('0x36')]){_0x885ad9[_0x24d6('0x37')]=[{'all':!![]}];}return db[_0x24d6('0x38')][_0x24d6('0x39')](_0x885ad9);})[_0x24d6('0x1e')](function(_0x1569e5){_0x3c7034['rows']=_0x1569e5;return _0x3c7034;})[_0x24d6('0x1e')](respondWithFilteredResult(_0x179919,_0x885ad9))[_0x24d6('0x3a')](handleError(_0x179919,null));};exports[_0x24d6('0x3b')]=function(_0x2aa2b7,_0x78df6e){var _0x3554fe={'raw':!![],'where':{'id':_0x2aa2b7[_0x24d6('0x3c')]['id']}},_0x35df69={};_0x35df69[_0x24d6('0x2c')]=_[_0x24d6('0x28')](db['MailServerOut']['rawAttributes']);_0x35df69[_0x24d6('0x27')]=_[_0x24d6('0x28')](_0x2aa2b7[_0x24d6('0x27')]);_0x35df69['filters']=_[_0x24d6('0x2b')](_0x35df69[_0x24d6('0x2c')],_0x35df69[_0x24d6('0x27')]);_0x3554fe['attributes']=_['intersection'](_0x35df69[_0x24d6('0x2c')],qs[_0x24d6('0x2d')](_0x2aa2b7[_0x24d6('0x27')]['fields']));_0x3554fe[_0x24d6('0x2a')]=_0x3554fe[_0x24d6('0x2a')][_0x24d6('0x3d')]?_0x3554fe[_0x24d6('0x2a')]:_0x35df69[_0x24d6('0x2c')];if(_0x2aa2b7['query'][_0x24d6('0x36')]){_0x3554fe['include']=[{'all':!![]}];}_0x3554fe=_[_0x24d6('0x33')]({},_0x3554fe,_0x2aa2b7['options']);return db['MailServerOut'][_0x24d6('0x3e')](_0x3554fe)['then'](handleEntityNotFound(_0x78df6e,null))[_0x24d6('0x1e')](respondWithResult(_0x78df6e,null))[_0x24d6('0x3a')](handleError(_0x78df6e,null));};exports[_0x24d6('0x3f')]=function(_0x404fed,_0x39098b){return db[_0x24d6('0x38')]['create'](_0x404fed[_0x24d6('0x40')],{})[_0x24d6('0x1e')](respondWithResult(_0x39098b,0xc9))['catch'](handleError(_0x39098b,null));};exports[_0x24d6('0x41')]=function(_0x38541b,_0x3bf5d2){if(_0x38541b[_0x24d6('0x40')]['id']){delete _0x38541b[_0x24d6('0x40')]['id'];}return db[_0x24d6('0x38')][_0x24d6('0x3e')]({'where':{'id':_0x38541b[_0x24d6('0x3c')]['id']}})[_0x24d6('0x1e')](handleEntityNotFound(_0x3bf5d2,null))[_0x24d6('0x1e')](saveUpdates(_0x38541b[_0x24d6('0x40')],null))[_0x24d6('0x1e')](respondWithResult(_0x3bf5d2,null))[_0x24d6('0x3a')](handleError(_0x3bf5d2,null));};exports[_0x24d6('0x1d')]=function(_0x43bfc2,_0x519a57){return db[_0x24d6('0x38')]['find']({'where':{'id':_0x43bfc2[_0x24d6('0x3c')]['id']}})[_0x24d6('0x1e')](handleEntityNotFound(_0x519a57,null))[_0x24d6('0x1e')](removeEntity(_0x519a57,null))['catch'](handleError(_0x519a57,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 01bd330..94960ef 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 _0xec68=['define','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x2ff136,_0x192d39){var _0x37c25b=function(_0x4777c4){while(--_0x4777c4){_0x2ff136['push'](_0x2ff136['shift']());}};_0x37c25b(++_0x192d39);}(_0xec68,0x12e));var _0x8ec6=function(_0x3351b0,_0x1c7931){_0x3351b0=_0x3351b0-0x0;var _0x3e1cba=_0xec68[_0x3351b0];return _0x3e1cba;};'use strict';var _=require(_0x8ec6('0x0'));var util=require('util');var logger=require(_0x8ec6('0x1'))('api');var moment=require(_0x8ec6('0x2'));var BPromise=require(_0x8ec6('0x3'));var rp=require(_0x8ec6('0x4'));var fs=require('fs');var path=require(_0x8ec6('0x5'));var rimraf=require(_0x8ec6('0x6'));var config=require(_0x8ec6('0x7'));var attributes=require(_0x8ec6('0x8'));module[_0x8ec6('0x9')]=function(_0x4fbcf3,_0x2e3d28){return _0x4fbcf3[_0x8ec6('0xa')](_0x8ec6('0xb'),attributes,{'tableName':_0x8ec6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21cd=['request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','moment'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x21cd,0x10a));var _0xd21c=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x21cd[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xd21c('0x0'));var util=require(_0xd21c('0x1'));var logger=require(_0xd21c('0x2'))('api');var moment=require(_0xd21c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd21c('0x4'));var fs=require('fs');var path=require(_0xd21c('0x5'));var rimraf=require(_0xd21c('0x6'));var config=require(_0xd21c('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xd21c('0x8')]=function(_0x1f4982,_0x2f6ea1){return _0x1f4982[_0xd21c('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 3448a6f..6f5d7b3 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 _0x7a54=['info','MailServerOut,\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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5c9a46,_0x5ae24f){_0x5c9a46=_0x5c9a46-0x0;var _0x5f856b=_0x7a54[_0x5c9a46];return _0x5f856b;};'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')]('MailServerOut,\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 _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(_0x6175b6,_0x35e43f){var _0x168f1f=function(_0x1230b5){while(--_0x1230b5){_0x6175b6['push'](_0x6175b6['shift']());}};_0x168f1f(++_0x35e43f);}(_0x1261,0x144));var _0x1126=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1261[_0x27af45];return _0x18df21;};'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 d2e86f9..40e7a32 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 _0x6909=['/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x4a45cc,_0x362c8e){var _0x1c10e8=function(_0x44bf03){while(--_0x44bf03){_0x4a45cc['push'](_0x4a45cc['shift']());}};_0x1c10e8(++_0x362c8e);}(_0x6909,0x193));var _0x9690=function(_0x1fdf2e,_0x91dce2){_0x1fdf2e=_0x1fdf2e-0x0;var _0x14dc7a=_0x6909[_0x1fdf2e];return _0x14dc7a;};'use strict';var multer=require(_0x9690('0x0'));var util=require('util');var path=require(_0x9690('0x1'));var timeout=require(_0x9690('0x2'));var express=require('express');var router=express[_0x9690('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9690('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9690('0x5'));var controller=require(_0x9690('0x6'));router[_0x9690('0x7')]('/',auth[_0x9690('0x8')](),controller[_0x9690('0x9')]);router[_0x9690('0x7')](_0x9690('0xa'),auth[_0x9690('0x8')](),controller['describe']);router['get'](_0x9690('0xb'),auth[_0x9690('0x8')](),controller[_0x9690('0xc')]);router[_0x9690('0xd')]('/',auth[_0x9690('0x8')](),controller[_0x9690('0xe')]);router[_0x9690('0xf')](_0x9690('0xb'),auth[_0x9690('0x8')](),controller[_0x9690('0x10')]);router['delete'](_0x9690('0xb'),auth[_0x9690('0x8')](),controller[_0x9690('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaba5=['show','create','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x15ea28,_0x49245f){var _0x5dc808=function(_0x5354e6){while(--_0x5354e6){_0x15ea28['push'](_0x15ea28['shift']());}};_0x5dc808(++_0x49245f);}(_0xaba5,0x1a9));var _0x5aba=function(_0x40050a,_0x1ad935){_0x40050a=_0x40050a-0x0;var _0x291044=_0xaba5[_0x40050a];return _0x291044;};'use strict';var multer=require('multer');var util=require(_0x5aba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5aba('0x1'));var router=express['Router']();var fs_extra=require(_0x5aba('0x2'));var auth=require(_0x5aba('0x3'));var interaction=require(_0x5aba('0x4'));var config=require(_0x5aba('0x5'));var controller=require(_0x5aba('0x6'));router[_0x5aba('0x7')]('/',auth['isAuthenticated'](),controller[_0x5aba('0x8')]);router['get'](_0x5aba('0x9'),auth[_0x5aba('0xa')](),controller['describe']);router[_0x5aba('0x7')](_0x5aba('0xb'),auth[_0x5aba('0xa')](),controller[_0x5aba('0xc')]);router['post']('/',auth[_0x5aba('0xa')](),controller[_0x5aba('0xd')]);router[_0x5aba('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5aba('0xf')]);router[_0x5aba('0x10')](_0x5aba('0xb'),auth['isAuthenticated'](),controller[_0x5aba('0x11')]);module[_0x5aba('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a211a6a..a4a6a17 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 _0xd046=['exports','STRING','name'];(function(_0x1d9187,_0x494ad6){var _0x25d4b0=function(_0x59a1a1){while(--_0x59a1a1){_0x1d9187['push'](_0x1d9187['shift']());}};_0x25d4b0(++_0x494ad6);}(_0xd046,0x129));var _0x6d04=function(_0x1988ae,_0x45564e){_0x1988ae=_0x1988ae-0x0;var _0x2d2cce=_0xd046[_0x1988ae];return _0x2d2cce;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'unique':_0x6d04('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f44=['name','STRING','sequelize','exports'];(function(_0x3408cf,_0x898200){var _0x5b67c2=function(_0x106537){while(--_0x106537){_0x3408cf['push'](_0x3408cf['shift']());}};_0x5b67c2(++_0x898200);}(_0x6f44,0x1ea));var _0x46f4=function(_0x26b7a9,_0x589d81){_0x26b7a9=_0x26b7a9-0x0;var _0x33170a=_0x6f44[_0x26b7a9];return _0x33170a;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 05c5f78..1834a5a 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 _0xd370=['update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','rows','show','params','length','find','catch','create'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd370,0x127));var _0x0d37=function(_0x39a6ca,_0x10c9f0){_0x39a6ca=_0x39a6ca-0x0;var _0x752c2f=_0xd370[_0x39a6ca];return _0x752c2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d37('0x0'));var zipdir=require(_0x0d37('0x1'));var jsonpatch=require(_0x0d37('0x2'));var rp=require(_0x0d37('0x3'));var moment=require('moment');var BPromise=require(_0x0d37('0x4'));var Mustache=require(_0x0d37('0x5'));var util=require(_0x0d37('0x6'));var path=require(_0x0d37('0x7'));var sox=require('sox');var csv=require(_0x0d37('0x8'));var ejs=require(_0x0d37('0x9'));var fs=require('fs');var fs_extra=require(_0x0d37('0xa'));var _=require(_0x0d37('0xb'));var squel=require('squel');var crypto=require(_0x0d37('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d37('0xd'));var Papa=require(_0x0d37('0xe'));var Redis=require(_0x0d37('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0d37('0x10'));var hardwareService=require(_0x0d37('0x11'));var logger=require('../../config/logger')(_0x0d37('0x12'));var utils=require(_0x0d37('0x13'));var config=require(_0x0d37('0x14'));var licenseUtil=require(_0x0d37('0x15'));var db=require(_0x0d37('0x16'))['db'];function respondWithStatusCode(_0x189216,_0x392dc4){_0x392dc4=_0x392dc4||0xcc;return function(_0x3b29b4){if(_0x3b29b4){return _0x189216[_0x0d37('0x17')](_0x392dc4);}return _0x189216[_0x0d37('0x18')](_0x392dc4)[_0x0d37('0x19')]();};}function respondWithResult(_0x34eb42,_0x3d8b5a){_0x3d8b5a=_0x3d8b5a||0xc8;return function(_0x2739e9){if(_0x2739e9){return _0x34eb42[_0x0d37('0x18')](_0x3d8b5a)['json'](_0x2739e9);}};}function respondWithFilteredResult(_0x1c6448,_0x32e227){return function(_0x3e56e4){if(_0x3e56e4){var _0x153c25=typeof _0x32e227[_0x0d37('0x1a')]===_0x0d37('0x1b')&&typeof _0x32e227[_0x0d37('0x1c')]==='undefined';var _0xd1ca2b=_0x3e56e4[_0x0d37('0x1d')];var _0x105b4c=_0x153c25?0x0:_0x32e227[_0x0d37('0x1a')];var _0x1392a7=_0x153c25?_0x3e56e4[_0x0d37('0x1d')]:_0x32e227['offset']+_0x32e227[_0x0d37('0x1c')];var _0x17b44b;if(_0x1392a7>=_0xd1ca2b){_0x1392a7=_0xd1ca2b;_0x17b44b=0xc8;}else{_0x17b44b=0xce;}_0x1c6448[_0x0d37('0x18')](_0x17b44b);return _0x1c6448[_0x0d37('0x1e')](_0x0d37('0x1f'),_0x105b4c+'-'+_0x1392a7+'/'+_0xd1ca2b)[_0x0d37('0x20')](_0x3e56e4);}return null;};}function patchUpdates(_0x5cdeb0){return function(_0x46f4f6){try{jsonpatch[_0x0d37('0x21')](_0x46f4f6,_0x5cdeb0,!![]);}catch(_0x3f72d1){return BPromise['reject'](_0x3f72d1);}return _0x46f4f6['save']();};}function saveUpdates(_0x12d5cd,_0xd845ea){return function(_0x4fb31b){if(_0x4fb31b){return _0x4fb31b['update'](_0x12d5cd)[_0x0d37('0x22')](function(_0x5dd4f3){return _0x5dd4f3;});}return null;};}function removeEntity(_0x27c6c1,_0x324cc7){return function(_0xd2757b){if(_0xd2757b){return _0xd2757b[_0x0d37('0x23')]()[_0x0d37('0x22')](function(){_0x27c6c1[_0x0d37('0x18')](0xcc)[_0x0d37('0x19')]();});}};}function handleEntityNotFound(_0x58bb86,_0xc9b561){return function(_0x34f224){if(!_0x34f224){_0x58bb86[_0x0d37('0x17')](0x194);}return _0x34f224;};}function handleError(_0x5716ef,_0x2e7987){_0x2e7987=_0x2e7987||0x1f4;return function(_0x357c6b){logger['error'](_0x357c6b[_0x0d37('0x24')]);if(_0x357c6b['name']){delete _0x357c6b[_0x0d37('0x25')];}_0x5716ef['status'](_0x2e7987)[_0x0d37('0x26')](_0x357c6b);};}exports[_0x0d37('0x27')]=function(_0x1e0c62,_0x2307e6){var _0x4227cd={},_0x48f78a={},_0x394825={'count':0x0,'rows':[]};var _0x150bef=_[_0x0d37('0x28')](db['MailSubstatus'][_0x0d37('0x29')],function(_0x49d4ac){return{'name':_0x49d4ac[_0x0d37('0x2a')],'type':_0x49d4ac[_0x0d37('0x2b')][_0x0d37('0x2c')]};});_0x48f78a[_0x0d37('0x2d')]=_['map'](_0x150bef,_0x0d37('0x25'));_0x48f78a['query']=_[_0x0d37('0x2e')](_0x1e0c62[_0x0d37('0x2f')]);_0x48f78a[_0x0d37('0x30')]=_[_0x0d37('0x31')](_0x48f78a[_0x0d37('0x2d')],_0x48f78a[_0x0d37('0x2f')]);_0x4227cd[_0x0d37('0x32')]=_[_0x0d37('0x31')](_0x48f78a[_0x0d37('0x2d')],qs[_0x0d37('0x33')](_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x33')]));_0x4227cd[_0x0d37('0x32')]=_0x4227cd[_0x0d37('0x32')]['length']?_0x4227cd[_0x0d37('0x32')]:_0x48f78a['model'];if(!_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x34')]('nolimit')){_0x4227cd[_0x0d37('0x1c')]=qs[_0x0d37('0x1c')](_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x1c')]);_0x4227cd[_0x0d37('0x1a')]=qs[_0x0d37('0x1a')](_0x1e0c62[_0x0d37('0x2f')]['offset']);}_0x4227cd[_0x0d37('0x35')]=qs[_0x0d37('0x36')](_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x36')]);_0x4227cd[_0x0d37('0x37')]=qs[_0x0d37('0x30')](_['pick'](_0x1e0c62[_0x0d37('0x2f')],_0x48f78a[_0x0d37('0x30')]),_0x150bef);if(_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x38')]){_0x4227cd['where']=_[_0x0d37('0x39')](_0x4227cd['where'],{'$or':_[_0x0d37('0x28')](_0x150bef,function(_0x4d3b15){if(_0x4d3b15[_0x0d37('0x2b')]!==_0x0d37('0x3a')){var _0x490873={};_0x490873[_0x4d3b15['name']]={'$like':'%'+_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x38')]+'%'};return _0x490873;}})});}_0x4227cd=_[_0x0d37('0x39')]({},_0x4227cd,_0x1e0c62[_0x0d37('0x3b')]);var _0x4b087c={'where':_0x4227cd[_0x0d37('0x37')]};return db[_0x0d37('0x3c')][_0x0d37('0x1d')](_0x4b087c)[_0x0d37('0x22')](function(_0x5cab9d){_0x394825['count']=_0x5cab9d;if(_0x1e0c62[_0x0d37('0x2f')][_0x0d37('0x3d')]){_0x4227cd[_0x0d37('0x3e')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x4227cd);})[_0x0d37('0x22')](function(_0x1aacd9){_0x394825[_0x0d37('0x3f')]=_0x1aacd9;return _0x394825;})['then'](respondWithFilteredResult(_0x2307e6,_0x4227cd))['catch'](handleError(_0x2307e6,null));};exports[_0x0d37('0x40')]=function(_0x2578b7,_0x10deb7){var _0x5dee39={'raw':!![],'where':{'id':_0x2578b7[_0x0d37('0x41')]['id']}},_0x429f4d={};_0x429f4d['model']=_['keys'](db[_0x0d37('0x3c')][_0x0d37('0x29')]);_0x429f4d['query']=_['keys'](_0x2578b7[_0x0d37('0x2f')]);_0x429f4d[_0x0d37('0x30')]=_[_0x0d37('0x31')](_0x429f4d['model'],_0x429f4d[_0x0d37('0x2f')]);_0x5dee39['attributes']=_[_0x0d37('0x31')](_0x429f4d[_0x0d37('0x2d')],qs['fields'](_0x2578b7['query'][_0x0d37('0x33')]));_0x5dee39['attributes']=_0x5dee39['attributes'][_0x0d37('0x42')]?_0x5dee39[_0x0d37('0x32')]:_0x429f4d[_0x0d37('0x2d')];if(_0x2578b7[_0x0d37('0x2f')][_0x0d37('0x3d')]){_0x5dee39[_0x0d37('0x3e')]=[{'all':!![]}];}_0x5dee39=_[_0x0d37('0x39')]({},_0x5dee39,_0x2578b7['options']);return db['MailSubstatus'][_0x0d37('0x43')](_0x5dee39)[_0x0d37('0x22')](handleEntityNotFound(_0x10deb7,null))['then'](respondWithResult(_0x10deb7,null))[_0x0d37('0x44')](handleError(_0x10deb7,null));};exports[_0x0d37('0x45')]=function(_0x32faf6,_0x1d2489){return db[_0x0d37('0x3c')][_0x0d37('0x45')](_0x32faf6['body'],{})[_0x0d37('0x22')](respondWithResult(_0x1d2489,0xc9))[_0x0d37('0x44')](handleError(_0x1d2489,null));};exports[_0x0d37('0x46')]=function(_0x55510f,_0x45b667){if(_0x55510f[_0x0d37('0x47')]['id']){delete _0x55510f[_0x0d37('0x47')]['id'];}return db['MailSubstatus'][_0x0d37('0x43')]({'where':{'id':_0x55510f[_0x0d37('0x41')]['id']}})['then'](handleEntityNotFound(_0x45b667,null))[_0x0d37('0x22')](saveUpdates(_0x55510f[_0x0d37('0x47')],null))[_0x0d37('0x22')](respondWithResult(_0x45b667,null))['catch'](handleError(_0x45b667,null));};exports[_0x0d37('0x23')]=function(_0x161b56,_0x1731c9){return db['MailSubstatus'][_0x0d37('0x43')]({'where':{'id':_0x161b56[_0x0d37('0x41')]['id']}})[_0x0d37('0x22')](handleEntityNotFound(_0x1731c9,null))[_0x0d37('0x22')](removeEntity(_0x1731c9,null))['catch'](handleError(_0x1731c9,null));};exports[_0x0d37('0x48')]=function(_0xbce8db,_0x1452c2){return db[_0x0d37('0x3c')][_0x0d37('0x48')]()[_0x0d37('0x22')](respondWithResult(_0x1452c2,null))['catch'](handleError(_0x1452c2,null));}; \ No newline at end of file +var _0x3364=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','undefined','count','offset','limit','status','set','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','find','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs'];(function(_0x513086,_0x5298e2){var _0x13e2de=function(_0x5e6881){while(--_0x5e6881){_0x513086['push'](_0x513086['shift']());}};_0x13e2de(++_0x5298e2);}(_0x3364,0x89));var _0x4336=function(_0x3d2b10,_0x3ec288){_0x3d2b10=_0x3d2b10-0x0;var _0x205c31=_0x3364[_0x3d2b10];return _0x205c31;};'use strict';var emlformat=require(_0x4336('0x0'));var rimraf=require(_0x4336('0x1'));var zipdir=require(_0x4336('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4336('0x3'));var BPromise=require(_0x4336('0x4'));var Mustache=require('mustache');var util=require(_0x4336('0x5'));var path=require(_0x4336('0x6'));var sox=require('sox');var csv=require(_0x4336('0x7'));var ejs=require(_0x4336('0x8'));var fs=require('fs');var fs_extra=require(_0x4336('0x9'));var _=require(_0x4336('0xa'));var squel=require(_0x4336('0xb'));var crypto=require(_0x4336('0xc'));var jsforce=require(_0x4336('0xd'));var deskjs=require(_0x4336('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4336('0xf'));var Redis=require(_0x4336('0x10'));var authService=require(_0x4336('0x11'));var qs=require(_0x4336('0x12'));var as=require(_0x4336('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4336('0x14'))('api');var utils=require(_0x4336('0x15'));var config=require(_0x4336('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4336('0x17'))['db'];function respondWithStatusCode(_0x4021db,_0xec0cb6){_0xec0cb6=_0xec0cb6||0xcc;return function(_0x23153c){if(_0x23153c){return _0x4021db['sendStatus'](_0xec0cb6);}return _0x4021db['status'](_0xec0cb6)[_0x4336('0x18')]();};}function respondWithResult(_0x3aa78e,_0x3722d7){_0x3722d7=_0x3722d7||0xc8;return function(_0xc01275){if(_0xc01275){return _0x3aa78e['status'](_0x3722d7)['json'](_0xc01275);}};}function respondWithFilteredResult(_0xd3b455,_0x43e996){return function(_0x5c1884){if(_0x5c1884){var _0xf15976=typeof _0x43e996['offset']==='undefined'&&typeof _0x43e996['limit']===_0x4336('0x19');var _0x2cd3ea=_0x5c1884[_0x4336('0x1a')];var _0x19ec3c=_0xf15976?0x0:_0x43e996['offset'];var _0x1ecc9d=_0xf15976?_0x5c1884['count']:_0x43e996[_0x4336('0x1b')]+_0x43e996[_0x4336('0x1c')];var _0x1a39c1;if(_0x1ecc9d>=_0x2cd3ea){_0x1ecc9d=_0x2cd3ea;_0x1a39c1=0xc8;}else{_0x1a39c1=0xce;}_0xd3b455[_0x4336('0x1d')](_0x1a39c1);return _0xd3b455[_0x4336('0x1e')]('Content-Range',_0x19ec3c+'-'+_0x1ecc9d+'/'+_0x2cd3ea)['json'](_0x5c1884);}return null;};}function patchUpdates(_0x57b0d4){return function(_0x55b197){try{jsonpatch['apply'](_0x55b197,_0x57b0d4,!![]);}catch(_0x4c8282){return BPromise[_0x4336('0x1f')](_0x4c8282);}return _0x55b197[_0x4336('0x20')]();};}function saveUpdates(_0xd2d91f,_0x276295){return function(_0x57cab1){if(_0x57cab1){return _0x57cab1[_0x4336('0x21')](_0xd2d91f)[_0x4336('0x22')](function(_0x2f2cba){return _0x2f2cba;});}return null;};}function removeEntity(_0x4bdbcc,_0xf78f04){return function(_0x591b38){if(_0x591b38){return _0x591b38[_0x4336('0x23')]()[_0x4336('0x22')](function(){_0x4bdbcc[_0x4336('0x1d')](0xcc)[_0x4336('0x18')]();});}};}function handleEntityNotFound(_0x481725,_0x3c29ec){return function(_0x13168d){if(!_0x13168d){_0x481725['sendStatus'](0x194);}return _0x13168d;};}function handleError(_0xc9e80f,_0x351a99){_0x351a99=_0x351a99||0x1f4;return function(_0x5af8ec){logger[_0x4336('0x24')](_0x5af8ec[_0x4336('0x25')]);if(_0x5af8ec[_0x4336('0x26')]){delete _0x5af8ec[_0x4336('0x26')];}_0xc9e80f[_0x4336('0x1d')](_0x351a99)[_0x4336('0x27')](_0x5af8ec);};}exports[_0x4336('0x28')]=function(_0x5ae64f,_0x568d87){var _0x2119f3={},_0x3b12d5={},_0x113ec5={'count':0x0,'rows':[]};var _0x48816f=_[_0x4336('0x29')](db[_0x4336('0x2a')]['rawAttributes'],function(_0x70cf37){return{'name':_0x70cf37['fieldName'],'type':_0x70cf37[_0x4336('0x2b')][_0x4336('0x2c')]};});_0x3b12d5[_0x4336('0x2d')]=_[_0x4336('0x29')](_0x48816f,'name');_0x3b12d5['query']=_['keys'](_0x5ae64f[_0x4336('0x2e')]);_0x3b12d5['filters']=_[_0x4336('0x2f')](_0x3b12d5[_0x4336('0x2d')],_0x3b12d5['query']);_0x2119f3['attributes']=_[_0x4336('0x2f')](_0x3b12d5[_0x4336('0x2d')],qs[_0x4336('0x30')](_0x5ae64f[_0x4336('0x2e')][_0x4336('0x30')]));_0x2119f3[_0x4336('0x31')]=_0x2119f3[_0x4336('0x31')]['length']?_0x2119f3[_0x4336('0x31')]:_0x3b12d5[_0x4336('0x2d')];if(!_0x5ae64f['query'][_0x4336('0x32')](_0x4336('0x33'))){_0x2119f3[_0x4336('0x1c')]=qs['limit'](_0x5ae64f[_0x4336('0x2e')][_0x4336('0x1c')]);_0x2119f3[_0x4336('0x1b')]=qs['offset'](_0x5ae64f[_0x4336('0x2e')][_0x4336('0x1b')]);}_0x2119f3[_0x4336('0x34')]=qs[_0x4336('0x35')](_0x5ae64f[_0x4336('0x2e')][_0x4336('0x35')]);_0x2119f3[_0x4336('0x36')]=qs[_0x4336('0x37')](_[_0x4336('0x38')](_0x5ae64f[_0x4336('0x2e')],_0x3b12d5[_0x4336('0x37')]),_0x48816f);if(_0x5ae64f['query']['filter']){_0x2119f3['where']=_[_0x4336('0x39')](_0x2119f3[_0x4336('0x36')],{'$or':_['map'](_0x48816f,function(_0x511a7c){if(_0x511a7c['type']!==_0x4336('0x3a')){var _0x361f80={};_0x361f80[_0x511a7c[_0x4336('0x26')]]={'$like':'%'+_0x5ae64f[_0x4336('0x2e')][_0x4336('0x3b')]+'%'};return _0x361f80;}})});}_0x2119f3=_['merge']({},_0x2119f3,_0x5ae64f[_0x4336('0x3c')]);var _0x3bf07={'where':_0x2119f3[_0x4336('0x36')]};return db[_0x4336('0x2a')][_0x4336('0x1a')](_0x3bf07)['then'](function(_0x4f2343){_0x113ec5['count']=_0x4f2343;if(_0x5ae64f[_0x4336('0x2e')][_0x4336('0x3d')]){_0x2119f3[_0x4336('0x3e')]=[{'all':!![]}];}return db[_0x4336('0x2a')][_0x4336('0x3f')](_0x2119f3);})['then'](function(_0x328eb9){_0x113ec5[_0x4336('0x40')]=_0x328eb9;return _0x113ec5;})[_0x4336('0x22')](respondWithFilteredResult(_0x568d87,_0x2119f3))[_0x4336('0x41')](handleError(_0x568d87,null));};exports['show']=function(_0x480375,_0x21368c){var _0x5dabc1={'raw':!![],'where':{'id':_0x480375[_0x4336('0x42')]['id']}},_0x76b6c7={};_0x76b6c7[_0x4336('0x2d')]=_['keys'](db['MailSubstatus'][_0x4336('0x43')]);_0x76b6c7[_0x4336('0x2e')]=_[_0x4336('0x44')](_0x480375['query']);_0x76b6c7[_0x4336('0x37')]=_[_0x4336('0x2f')](_0x76b6c7[_0x4336('0x2d')],_0x76b6c7['query']);_0x5dabc1[_0x4336('0x31')]=_['intersection'](_0x76b6c7['model'],qs[_0x4336('0x30')](_0x480375[_0x4336('0x2e')][_0x4336('0x30')]));_0x5dabc1['attributes']=_0x5dabc1[_0x4336('0x31')][_0x4336('0x45')]?_0x5dabc1['attributes']:_0x76b6c7['model'];if(_0x480375[_0x4336('0x2e')][_0x4336('0x3d')]){_0x5dabc1[_0x4336('0x3e')]=[{'all':!![]}];}_0x5dabc1=_[_0x4336('0x39')]({},_0x5dabc1,_0x480375[_0x4336('0x3c')]);return db[_0x4336('0x2a')][_0x4336('0x46')](_0x5dabc1)[_0x4336('0x22')](handleEntityNotFound(_0x21368c,null))[_0x4336('0x22')](respondWithResult(_0x21368c,null))[_0x4336('0x41')](handleError(_0x21368c,null));};exports['create']=function(_0x4bf7db,_0x1582bc){return db['MailSubstatus']['create'](_0x4bf7db[_0x4336('0x47')],{})[_0x4336('0x22')](respondWithResult(_0x1582bc,0xc9))[_0x4336('0x41')](handleError(_0x1582bc,null));};exports[_0x4336('0x21')]=function(_0x58b9d4,_0x41d351){if(_0x58b9d4[_0x4336('0x47')]['id']){delete _0x58b9d4[_0x4336('0x47')]['id'];}return db[_0x4336('0x2a')][_0x4336('0x46')]({'where':{'id':_0x58b9d4[_0x4336('0x42')]['id']}})[_0x4336('0x22')](handleEntityNotFound(_0x41d351,null))['then'](saveUpdates(_0x58b9d4[_0x4336('0x47')],null))[_0x4336('0x22')](respondWithResult(_0x41d351,null))[_0x4336('0x41')](handleError(_0x41d351,null));};exports[_0x4336('0x23')]=function(_0x347a4b,_0x41aad5){return db[_0x4336('0x2a')][_0x4336('0x46')]({'where':{'id':_0x347a4b['params']['id']}})[_0x4336('0x22')](handleEntityNotFound(_0x41aad5,null))[_0x4336('0x22')](removeEntity(_0x41aad5,null))[_0x4336('0x41')](handleError(_0x41aad5,null));};exports[_0x4336('0x48')]=function(_0x1d312b,_0x336010){return db[_0x4336('0x2a')][_0x4336('0x48')]()[_0x4336('0x22')](respondWithResult(_0x336010,null))[_0x4336('0x41')](handleError(_0x336010,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7efa3ca..be48b9c 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 _0x9745=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x433bf8,_0x323382){var _0x5c8da9=function(_0x50367e){while(--_0x50367e){_0x433bf8['push'](_0x433bf8['shift']());}};_0x5c8da9(++_0x323382);}(_0x9745,0x12f));var _0x5974=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x9745[_0x2555d0];return _0x3bb486;};'use strict';var EventEmitter=require(_0x5974('0x0'));var MailSubstatus=require(_0x5974('0x1'))['db'][_0x5974('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5974('0x3')](0x0);var events={'afterUpdate':_0x5974('0x4')};function emitEvent(_0x139442){return function(_0x38d4b2,_0x156572,_0x227d9c){MailSubstatusEvents[_0x5974('0x5')](_0x139442+':'+_0x38d4b2['id'],_0x38d4b2);MailSubstatusEvents[_0x5974('0x5')](_0x139442,_0x38d4b2);_0x227d9c(null);};}for(var e in events){if(events[_0x5974('0x6')](e)){var event=events[e];MailSubstatus[_0x5974('0x7')](e,emitEvent(event));}}module[_0x5974('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x868d=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x868d,0xd0));var _0xd868=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0x868d[_0x404f13];return _0x1f9dbb;};'use strict';var EventEmitter=require(_0xd868('0x0'));var MailSubstatus=require(_0xd868('0x1'))['db'][_0xd868('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd868('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x41843a){return function(_0x3d4f2c,_0x2731d4,_0x52ec56){MailSubstatusEvents[_0xd868('0x4')](_0x41843a+':'+_0x3d4f2c['id'],_0x3d4f2c);MailSubstatusEvents['emit'](_0x41843a,_0x3d4f2c);_0x52ec56(null);};}for(var e in events){if(events[_0xd868('0x5')](e)){var event=events[e];MailSubstatus[_0xd868('0x6')](e,emitEvent(event));}}module[_0xd868('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 04bffb4..7117400 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 _0x8c25=['define','update','name','then','exports','models'];(function(_0x2f03c9,_0x2753de){var _0x5bb6e0=function(_0x332e55){while(--_0x332e55){_0x2f03c9['push'](_0x2f03c9['shift']());}};_0x5bb6e0(++_0x2753de);}(_0x8c25,0xe2));var _0x58c2=function(_0x580884,_0x50f90f){_0x580884=_0x580884-0x0;var _0x45a618=_0x8c25[_0x580884];return _0x45a618;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x58c2('0x0')]=function(_0x4ececc){var _0x245c6f=_0x4ececc[_0x58c2('0x1')];return _0x4ececc[_0x58c2('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x42cae6,_0xa7d84d,_0x2af6b8){return _0x245c6f['Condition'][_0x58c2('0x3')]({'value':_0x42cae6[_0x58c2('0x4')]},{'where':{'field':'mailSubstatus','value':_0x42cae6['_previousDataValues'][_0x58c2('0x4')]}})[_0x58c2('0x5')](function(){_0x2af6b8();})['catch'](function(_0x42916a){_0x2af6b8(_0x42916a);});}}});}; \ No newline at end of file +var _0xdeb4=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','_previousDataValues','then','catch'];(function(_0x432c74,_0x5844df){var _0x302841=function(_0x40a35c){while(--_0x40a35c){_0x432c74['push'](_0x432c74['shift']());}};_0x302841(++_0x5844df);}(_0xdeb4,0x105));var _0x4deb=function(_0x1ef47f,_0x311ac1){_0x1ef47f=_0x1ef47f-0x0;var _0x1ee13d=_0xdeb4[_0x1ef47f];return _0x1ee13d;};'use strict';var attributes=require(_0x4deb('0x0'));module[_0x4deb('0x1')]=function(_0x17389f){var _0x11b573=_0x17389f[_0x4deb('0x2')];return _0x17389f[_0x4deb('0x3')](_0x4deb('0x4'),attributes,{'tableName':_0x4deb('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x13ae3f,_0x571047,_0x494216){return _0x11b573['Condition']['update']({'value':_0x13ae3f['name']},{'where':{'field':'mailSubstatus','value':_0x13ae3f[_0x4deb('0x6')]['name']}})[_0x4deb('0x7')](function(){_0x494216();})[_0x4deb('0x8')](function(_0x468dcd){_0x494216(_0x468dcd);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1a2c0e9..e80a9b0 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 _0x8b97=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x436f5f,_0x6d9f98){var _0x2b3b4d=function(_0x415d9d){while(--_0x415d9d){_0x436f5f['push'](_0x436f5f['shift']());}};_0x2b3b4d(++_0x6d9f98);}(_0x8b97,0x1d9));var _0x78b9=function(_0x4862d0,_0x47606e){_0x4862d0=_0x4862d0-0x0;var _0x1bd229=_0x8b97[_0x4862d0];return _0x1bd229;};'use strict';var _=require(_0x78b9('0x0'));var util=require('util');var moment=require(_0x78b9('0x1'));var BPromise=require(_0x78b9('0x2'));var rs=require(_0x78b9('0x3'));var fs=require('fs');var Redis=require(_0x78b9('0x4'));var db=require(_0x78b9('0x5'))['db'];var utils=require(_0x78b9('0x6'));var logger=require('../../config/logger')(_0x78b9('0x7'));var config=require(_0x78b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78b9('0x9')][_0x78b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b59e4,_0x2fed3b,_0x226007){return new BPromise(function(_0x1fc7e,_0x1500f6){return client[_0x78b9('0xb')](_0x4b59e4,_0x226007)[_0x78b9('0xc')](function(_0x14afde){logger[_0x78b9('0xd')](_0x78b9('0xe'),_0x2fed3b,_0x78b9('0xf'));logger[_0x78b9('0x10')](_0x78b9('0x11'),_0x2fed3b,_0x78b9('0xf'),JSON['stringify'](_0x14afde));if(_0x14afde[_0x78b9('0x12')]){if(_0x14afde[_0x78b9('0x12')][_0x78b9('0x13')]===0x1f4){logger['error'](_0x78b9('0xe'),_0x2fed3b,_0x14afde[_0x78b9('0x12')][_0x78b9('0x14')]);return _0x1500f6(_0x14afde[_0x78b9('0x12')][_0x78b9('0x14')]);}logger[_0x78b9('0x12')](_0x78b9('0xe'),_0x2fed3b,_0x14afde[_0x78b9('0x12')][_0x78b9('0x14')]);return _0x1fc7e(_0x14afde[_0x78b9('0x12')][_0x78b9('0x14')]);}else{logger[_0x78b9('0xd')](_0x78b9('0xe'),_0x2fed3b,_0x78b9('0xf'));_0x1fc7e(_0x14afde[_0x78b9('0x15')][_0x78b9('0x14')]);}})[_0x78b9('0x16')](function(_0xa3ca52){logger[_0x78b9('0x12')](_0x78b9('0xe'),_0x2fed3b,_0xa3ca52);_0x1500f6(_0xa3ca52);});});} \ No newline at end of file +var _0x0875=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xec8bd9,_0x36cb4d){var _0x59c4a6=function(_0x21d7ba){while(--_0x21d7ba){_0xec8bd9['push'](_0xec8bd9['shift']());}};_0x59c4a6(++_0x36cb4d);}(_0x0875,0xdd));var _0x5087=function(_0x22efdd,_0x50c49b){_0x22efdd=_0x22efdd-0x0;var _0x5e3899=_0x0875[_0x22efdd];return _0x5e3899;};'use strict';var _=require(_0x5087('0x0'));var util=require(_0x5087('0x1'));var moment=require('moment');var BPromise=require(_0x5087('0x2'));var rs=require(_0x5087('0x3'));var fs=require('fs');var Redis=require(_0x5087('0x4'));var db=require(_0x5087('0x5'))['db'];var utils=require(_0x5087('0x6'));var logger=require(_0x5087('0x7'))('rpc');var config=require(_0x5087('0x8'));var jayson=require(_0x5087('0x9'));var client=jayson[_0x5087('0xa')][_0x5087('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498b2f,_0x5bef13,_0x3b4d0a){return new BPromise(function(_0x22d02e,_0x2e3cd1){return client[_0x5087('0xc')](_0x498b2f,_0x3b4d0a)[_0x5087('0xd')](function(_0xedd1db){logger[_0x5087('0xe')](_0x5087('0xf'),_0x5bef13,'request\x20sent');logger[_0x5087('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5bef13,_0x5087('0x11'),JSON[_0x5087('0x12')](_0xedd1db));if(_0xedd1db['error']){if(_0xedd1db[_0x5087('0x13')][_0x5087('0x14')]===0x1f4){logger[_0x5087('0x13')](_0x5087('0xf'),_0x5bef13,_0xedd1db[_0x5087('0x13')]['message']);return _0x2e3cd1(_0xedd1db['error'][_0x5087('0x15')]);}logger[_0x5087('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5bef13,_0xedd1db[_0x5087('0x13')][_0x5087('0x15')]);return _0x22d02e(_0xedd1db[_0x5087('0x13')][_0x5087('0x15')]);}else{logger[_0x5087('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x5bef13,_0x5087('0x11'));_0x22d02e(_0xedd1db['result'][_0x5087('0x15')]);}})['catch'](function(_0x1ee9f7){logger[_0x5087('0x13')](_0x5087('0xf'),_0x5bef13,_0x1ee9f7);_0x2e3cd1(_0x1ee9f7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index dafaf41..0b8ce62 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 _0x32d8=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x463f8d,_0x4c33ef){var _0x23c1dc=function(_0x5de27d){while(--_0x5de27d){_0x463f8d['push'](_0x463f8d['shift']());}};_0x23c1dc(++_0x4c33ef);}(_0x32d8,0xca));var _0x832d=function(_0x6d91a,_0x3c06dc){_0x6d91a=_0x6d91a-0x0;var _0x405faf=_0x32d8[_0x6d91a];return _0x405faf;};'use strict';var multer=require('multer');var util=require(_0x832d('0x0'));var path=require(_0x832d('0x1'));var timeout=require(_0x832d('0x2'));var express=require('express');var router=express[_0x832d('0x3')]();var fs_extra=require(_0x832d('0x4'));var auth=require(_0x832d('0x5'));var interaction=require(_0x832d('0x6'));var config=require('../../config/environment');var controller=require(_0x832d('0x7'));router[_0x832d('0x8')]('/',auth[_0x832d('0x9')](),controller[_0x832d('0xa')]);router[_0x832d('0x8')](_0x832d('0xb'),auth[_0x832d('0x9')](),controller[_0x832d('0xc')]);router[_0x832d('0x8')](_0x832d('0xd'),auth[_0x832d('0x9')](),controller[_0x832d('0xe')]);router[_0x832d('0xf')]('/',auth[_0x832d('0x9')](),controller[_0x832d('0x10')]);router[_0x832d('0x11')](_0x832d('0xd'),auth[_0x832d('0x9')](),controller[_0x832d('0x12')]);router[_0x832d('0x13')]('/:id',auth[_0x832d('0x9')](),controller[_0x832d('0x14')]);module[_0x832d('0x15')]=router; \ No newline at end of file +var _0x2ffe=['isAuthenticated','/describe','get','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x437fdd,_0x4f6eee){var _0x361ddf=function(_0x5a7e22){while(--_0x5a7e22){_0x437fdd['push'](_0x437fdd['shift']());}};_0x361ddf(++_0x4f6eee);}(_0x2ffe,0x74));var _0xe2ff=function(_0x576ed5,_0xee737f){_0x576ed5=_0x576ed5-0x0;var _0x3291db=_0x2ffe[_0x576ed5];return _0x3291db;};'use strict';var multer=require('multer');var util=require(_0xe2ff('0x0'));var path=require(_0xe2ff('0x1'));var timeout=require(_0xe2ff('0x2'));var express=require(_0xe2ff('0x3'));var router=express[_0xe2ff('0x4')]();var fs_extra=require(_0xe2ff('0x5'));var auth=require(_0xe2ff('0x6'));var interaction=require(_0xe2ff('0x7'));var config=require(_0xe2ff('0x8'));var controller=require(_0xe2ff('0x9'));router['get']('/',auth[_0xe2ff('0xa')](),controller['index']);router['get'](_0xe2ff('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe2ff('0xc')](_0xe2ff('0xd'),auth[_0xe2ff('0xa')](),controller[_0xe2ff('0xe')]);router[_0xe2ff('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2ff('0x10')](_0xe2ff('0xd'),auth['isAuthenticated'](),controller[_0xe2ff('0x11')]);router[_0xe2ff('0x12')](_0xe2ff('0xd'),auth['isAuthenticated'](),controller[_0xe2ff('0x13')]);module[_0xe2ff('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d2fc028..46973ed 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3015e3,_0x344757){var _0x102c35=function(_0x3c44f6){while(--_0x3c44f6){_0x3015e3['push'](_0x3015e3['shift']());}};_0x102c35(++_0x344757);}(_0xf4eb,0xec));var _0xbf4e=function(_0x6a57f2,_0x2b51da){_0x6a57f2=_0x6a57f2-0x0;var _0x7bacd8=_0xf4eb[_0x6a57f2];return _0x7bacd8;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2c3aab,_0x1f57d0){_0x2c3aab=_0x2c3aab-0x0;var _0x46a4c8=_0x9bde[_0x2c3aab];return _0x46a4c8;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 03b3ce8..ad75aa7 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 _0x46a4=['model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','filters','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','key'];(function(_0x2a2370,_0x375a9b){var _0x1c94c1=function(_0x3b8891){while(--_0x3b8891){_0x2a2370['push'](_0x2a2370['shift']());}};_0x1c94c1(++_0x375a9b);}(_0x46a4,0x1d9));var _0x446a=function(_0x7e9efa,_0x2c8ae2){_0x7e9efa=_0x7e9efa-0x0;var _0x1df16d=_0x46a4[_0x7e9efa];return _0x1df16d;};'use strict';var emlformat=require(_0x446a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x446a('0x1'));var jsonpatch=require(_0x446a('0x2'));var rp=require('request-promise');var moment=require(_0x446a('0x3'));var BPromise=require(_0x446a('0x4'));var Mustache=require(_0x446a('0x5'));var util=require(_0x446a('0x6'));var path=require(_0x446a('0x7'));var sox=require(_0x446a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x446a('0x9'));var _=require(_0x446a('0xa'));var squel=require(_0x446a('0xb'));var crypto=require('crypto');var jsforce=require(_0x446a('0xc'));var deskjs=require(_0x446a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x446a('0xe'));var Papa=require(_0x446a('0xf'));var Redis=require(_0x446a('0x10'));var authService=require(_0x446a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x446a('0x12'));var hardwareService=require(_0x446a('0x13'));var logger=require(_0x446a('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x446a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24d30b,_0x5a1be3){_0x5a1be3=_0x5a1be3||0xcc;return function(_0x47011c){if(_0x47011c){return _0x24d30b[_0x446a('0x16')](_0x5a1be3);}return _0x24d30b[_0x446a('0x17')](_0x5a1be3)[_0x446a('0x18')]();};}function respondWithResult(_0x3671a1,_0x3451e7){_0x3451e7=_0x3451e7||0xc8;return function(_0x1133b1){if(_0x1133b1){return _0x3671a1[_0x446a('0x17')](_0x3451e7)['json'](_0x1133b1);}};}function respondWithFilteredResult(_0xdbc179,_0x12de25){return function(_0x50a5f3){if(_0x50a5f3){var _0x36ca60=typeof _0x12de25[_0x446a('0x19')]===_0x446a('0x1a')&&typeof _0x12de25['limit']===_0x446a('0x1a');var _0x39c21d=_0x50a5f3[_0x446a('0x1b')];var _0x194701=_0x36ca60?0x0:_0x12de25[_0x446a('0x19')];var _0x3c0537=_0x36ca60?_0x50a5f3[_0x446a('0x1b')]:_0x12de25[_0x446a('0x19')]+_0x12de25[_0x446a('0x1c')];var _0x5cf517;if(_0x3c0537>=_0x39c21d){_0x3c0537=_0x39c21d;_0x5cf517=0xc8;}else{_0x5cf517=0xce;}_0xdbc179['status'](_0x5cf517);return _0xdbc179[_0x446a('0x1d')](_0x446a('0x1e'),_0x194701+'-'+_0x3c0537+'/'+_0x39c21d)[_0x446a('0x1f')](_0x50a5f3);}return null;};}function patchUpdates(_0x679b17){return function(_0xf7906a){try{jsonpatch[_0x446a('0x20')](_0xf7906a,_0x679b17,!![]);}catch(_0x13e8c6){return BPromise[_0x446a('0x21')](_0x13e8c6);}return _0xf7906a['save']();};}function saveUpdates(_0x4911e7,_0x150f71){return function(_0x11a05e){if(_0x11a05e){return _0x11a05e[_0x446a('0x22')](_0x4911e7)[_0x446a('0x23')](function(_0x18d124){return _0x18d124;});}return null;};}function removeEntity(_0x30ed37,_0x542ebf){return function(_0x3ebe5b){if(_0x3ebe5b){return _0x3ebe5b[_0x446a('0x24')]()[_0x446a('0x23')](function(){_0x30ed37[_0x446a('0x17')](0xcc)[_0x446a('0x18')]();});}};}function handleEntityNotFound(_0x2cb983,_0x422f52){return function(_0x5d92d8){if(!_0x5d92d8){_0x2cb983[_0x446a('0x16')](0x194);}return _0x5d92d8;};}function handleError(_0x5e75eb,_0x516c7d){_0x516c7d=_0x516c7d||0x1f4;return function(_0x1ed9f8){logger[_0x446a('0x25')](_0x1ed9f8[_0x446a('0x26')]);if(_0x1ed9f8[_0x446a('0x27')]){delete _0x1ed9f8[_0x446a('0x27')];}_0x5e75eb[_0x446a('0x17')](_0x516c7d)[_0x446a('0x28')](_0x1ed9f8);};}exports[_0x446a('0x29')]=function(_0x38edf1,_0x1e0dd4){var _0x541627={},_0x56856f={},_0x4bbf8e={'count':0x0,'rows':[]};var _0x59465a=_[_0x446a('0x2a')](db[_0x446a('0x2b')]['rawAttributes'],function(_0x348d20){return{'name':_0x348d20['fieldName'],'type':_0x348d20['type'][_0x446a('0x2c')]};});_0x56856f[_0x446a('0x2d')]=_[_0x446a('0x2a')](_0x59465a,_0x446a('0x27'));_0x56856f[_0x446a('0x2e')]=_[_0x446a('0x2f')](_0x38edf1['query']);_0x56856f['filters']=_[_0x446a('0x30')](_0x56856f['model'],_0x56856f[_0x446a('0x2e')]);_0x541627['attributes']=_[_0x446a('0x30')](_0x56856f[_0x446a('0x2d')],qs[_0x446a('0x31')](_0x38edf1['query'][_0x446a('0x31')]));_0x541627[_0x446a('0x32')]=_0x541627[_0x446a('0x32')][_0x446a('0x33')]?_0x541627['attributes']:_0x56856f['model'];if(!_0x38edf1[_0x446a('0x2e')]['hasOwnProperty'](_0x446a('0x34'))){_0x541627[_0x446a('0x1c')]=qs[_0x446a('0x1c')](_0x38edf1['query']['limit']);_0x541627[_0x446a('0x19')]=qs[_0x446a('0x19')](_0x38edf1['query'][_0x446a('0x19')]);}_0x541627[_0x446a('0x35')]=qs['sort'](_0x38edf1[_0x446a('0x2e')][_0x446a('0x36')]);_0x541627['where']=qs['filters'](_[_0x446a('0x37')](_0x38edf1[_0x446a('0x2e')],_0x56856f['filters']),_0x59465a);if(_0x38edf1[_0x446a('0x2e')]['filter']){_0x541627[_0x446a('0x38')]=_[_0x446a('0x39')](_0x541627[_0x446a('0x38')],{'$or':_[_0x446a('0x2a')](_0x59465a,function(_0x539263){if(_0x539263[_0x446a('0x3a')]!==_0x446a('0x3b')){var _0x2c484e={};_0x2c484e[_0x539263[_0x446a('0x27')]]={'$like':'%'+_0x38edf1[_0x446a('0x2e')][_0x446a('0x3c')]+'%'};return _0x2c484e;}})});}_0x541627=_[_0x446a('0x39')]({},_0x541627,_0x38edf1[_0x446a('0x3d')]);var _0x295968={'where':_0x541627[_0x446a('0x38')]};return db[_0x446a('0x2b')]['count'](_0x295968)[_0x446a('0x23')](function(_0x4aa177){_0x4bbf8e['count']=_0x4aa177;if(_0x38edf1[_0x446a('0x2e')][_0x446a('0x3e')]){_0x541627[_0x446a('0x3f')]=[{'all':!![]}];}return db[_0x446a('0x2b')]['findAll'](_0x541627);})['then'](function(_0x134363){_0x4bbf8e[_0x446a('0x40')]=_0x134363;return _0x4bbf8e;})[_0x446a('0x23')](respondWithFilteredResult(_0x1e0dd4,_0x541627))['catch'](handleError(_0x1e0dd4,null));};exports[_0x446a('0x41')]=function(_0x2d8c99,_0x33d3d4){var _0x18080a={'raw':!![],'where':{'id':_0x2d8c99[_0x446a('0x42')]['id']}},_0x3481b5={};_0x3481b5[_0x446a('0x2d')]=_[_0x446a('0x2f')](db[_0x446a('0x2b')][_0x446a('0x43')]);_0x3481b5[_0x446a('0x2e')]=_[_0x446a('0x2f')](_0x2d8c99['query']);_0x3481b5[_0x446a('0x44')]=_[_0x446a('0x30')](_0x3481b5[_0x446a('0x2d')],_0x3481b5[_0x446a('0x2e')]);_0x18080a[_0x446a('0x32')]=_['intersection'](_0x3481b5['model'],qs[_0x446a('0x31')](_0x2d8c99[_0x446a('0x2e')][_0x446a('0x31')]));_0x18080a[_0x446a('0x32')]=_0x18080a[_0x446a('0x32')][_0x446a('0x33')]?_0x18080a['attributes']:_0x3481b5[_0x446a('0x2d')];if(_0x2d8c99['query'][_0x446a('0x3e')]){_0x18080a[_0x446a('0x3f')]=[{'all':!![]}];}_0x18080a=_['merge']({},_0x18080a,_0x2d8c99[_0x446a('0x3d')]);return db[_0x446a('0x2b')][_0x446a('0x45')](_0x18080a)[_0x446a('0x23')](handleEntityNotFound(_0x33d3d4,null))[_0x446a('0x23')](respondWithResult(_0x33d3d4,null))[_0x446a('0x46')](handleError(_0x33d3d4,null));};exports['create']=function(_0x2eb06f,_0x51393c){return db[_0x446a('0x2b')][_0x446a('0x47')](_0x2eb06f[_0x446a('0x48')],{})[_0x446a('0x23')](respondWithResult(_0x51393c,0xc9))[_0x446a('0x46')](handleError(_0x51393c,null));};exports[_0x446a('0x22')]=function(_0x39fca2,_0x50a40e){if(_0x39fca2['body']['id']){delete _0x39fca2[_0x446a('0x48')]['id'];}return db['MailTransferReport'][_0x446a('0x45')]({'where':{'id':_0x39fca2[_0x446a('0x42')]['id']}})[_0x446a('0x23')](handleEntityNotFound(_0x50a40e,null))[_0x446a('0x23')](saveUpdates(_0x39fca2[_0x446a('0x48')],null))[_0x446a('0x23')](respondWithResult(_0x50a40e,null))[_0x446a('0x46')](handleError(_0x50a40e,null));};exports[_0x446a('0x24')]=function(_0x5dd50e,_0x4b459a){return db[_0x446a('0x2b')]['find']({'where':{'id':_0x5dd50e[_0x446a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b459a,null))[_0x446a('0x23')](removeEntity(_0x4b459a,null))['catch'](handleError(_0x4b459a,null));};exports[_0x446a('0x49')]=function(_0x1080d6,_0x15c9c7){return db[_0x446a('0x2b')][_0x446a('0x49')]()[_0x446a('0x23')](respondWithResult(_0x15c9c7,null))[_0x446a('0x46')](handleError(_0x15c9c7,null));}; \ No newline at end of file +var _0xbb2c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','then','includeAll','include','findAll','rows','catch','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xbb2c,0x16d));var _0xcbb2=function(_0x10ed23,_0x2be1e6){_0x10ed23=_0x10ed23-0x0;var _0x49d44d=_0xbb2c[_0x10ed23];return _0x49d44d;};'use strict';var emlformat=require(_0xcbb2('0x0'));var rimraf=require(_0xcbb2('0x1'));var zipdir=require(_0xcbb2('0x2'));var jsonpatch=require(_0xcbb2('0x3'));var rp=require(_0xcbb2('0x4'));var moment=require(_0xcbb2('0x5'));var BPromise=require(_0xcbb2('0x6'));var Mustache=require('mustache');var util=require(_0xcbb2('0x7'));var path=require(_0xcbb2('0x8'));var sox=require(_0xcbb2('0x9'));var csv=require('to-csv');var ejs=require(_0xcbb2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbb2('0xb'));var squel=require(_0xcbb2('0xc'));var crypto=require(_0xcbb2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcbb2('0xe'));var toCsv=require(_0xcbb2('0xf'));var querystring=require(_0xcbb2('0x10'));var Papa=require(_0xcbb2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcbb2('0x12'));var as=require(_0xcbb2('0x13'));var hardwareService=require(_0xcbb2('0x14'));var logger=require(_0xcbb2('0x15'))(_0xcbb2('0x16'));var utils=require(_0xcbb2('0x17'));var config=require(_0xcbb2('0x18'));var licenseUtil=require(_0xcbb2('0x19'));var db=require(_0xcbb2('0x1a'))['db'];function respondWithStatusCode(_0xc013ec,_0x302420){_0x302420=_0x302420||0xcc;return function(_0x1218d3){if(_0x1218d3){return _0xc013ec[_0xcbb2('0x1b')](_0x302420);}return _0xc013ec['status'](_0x302420)[_0xcbb2('0x1c')]();};}function respondWithResult(_0x3f8938,_0x12c0ef){_0x12c0ef=_0x12c0ef||0xc8;return function(_0x24f5b2){if(_0x24f5b2){return _0x3f8938[_0xcbb2('0x1d')](_0x12c0ef)[_0xcbb2('0x1e')](_0x24f5b2);}};}function respondWithFilteredResult(_0x5944d2,_0x25c6e7){return function(_0x108d98){if(_0x108d98){var _0x7c5c45=typeof _0x25c6e7['offset']===_0xcbb2('0x1f')&&typeof _0x25c6e7[_0xcbb2('0x20')]===_0xcbb2('0x1f');var _0x5e33ca=_0x108d98['count'];var _0x247b34=_0x7c5c45?0x0:_0x25c6e7[_0xcbb2('0x21')];var _0x1c3445=_0x7c5c45?_0x108d98[_0xcbb2('0x22')]:_0x25c6e7[_0xcbb2('0x21')]+_0x25c6e7[_0xcbb2('0x20')];var _0x28f1e1;if(_0x1c3445>=_0x5e33ca){_0x1c3445=_0x5e33ca;_0x28f1e1=0xc8;}else{_0x28f1e1=0xce;}_0x5944d2['status'](_0x28f1e1);return _0x5944d2[_0xcbb2('0x23')]('Content-Range',_0x247b34+'-'+_0x1c3445+'/'+_0x5e33ca)[_0xcbb2('0x1e')](_0x108d98);}return null;};}function patchUpdates(_0x1e7bf9){return function(_0x44560e){try{jsonpatch['apply'](_0x44560e,_0x1e7bf9,!![]);}catch(_0x40cc30){return BPromise['reject'](_0x40cc30);}return _0x44560e['save']();};}function saveUpdates(_0x595914,_0x5777c4){return function(_0x568dd3){if(_0x568dd3){return _0x568dd3['update'](_0x595914)['then'](function(_0xabb4ca){return _0xabb4ca;});}return null;};}function removeEntity(_0x488355,_0x11283a){return function(_0x77cf81){if(_0x77cf81){return _0x77cf81[_0xcbb2('0x24')]()['then'](function(){_0x488355['status'](0xcc)[_0xcbb2('0x1c')]();});}};}function handleEntityNotFound(_0x50aa58,_0x586284){return function(_0x3584be){if(!_0x3584be){_0x50aa58[_0xcbb2('0x1b')](0x194);}return _0x3584be;};}function handleError(_0x1eed6c,_0xdcae42){_0xdcae42=_0xdcae42||0x1f4;return function(_0x4ca01c){logger[_0xcbb2('0x25')](_0x4ca01c[_0xcbb2('0x26')]);if(_0x4ca01c[_0xcbb2('0x27')]){delete _0x4ca01c['name'];}_0x1eed6c['status'](_0xdcae42)[_0xcbb2('0x28')](_0x4ca01c);};}exports[_0xcbb2('0x29')]=function(_0x318934,_0x4bff1b){var _0x4ca00b={},_0x5a854a={},_0x2dbed8={'count':0x0,'rows':[]};var _0x5d5b96=_[_0xcbb2('0x2a')](db['MailTransferReport'][_0xcbb2('0x2b')],function(_0x48c739){return{'name':_0x48c739[_0xcbb2('0x2c')],'type':_0x48c739[_0xcbb2('0x2d')][_0xcbb2('0x2e')]};});_0x5a854a[_0xcbb2('0x2f')]=_[_0xcbb2('0x2a')](_0x5d5b96,_0xcbb2('0x27'));_0x5a854a['query']=_[_0xcbb2('0x30')](_0x318934['query']);_0x5a854a[_0xcbb2('0x31')]=_[_0xcbb2('0x32')](_0x5a854a['model'],_0x5a854a[_0xcbb2('0x33')]);_0x4ca00b[_0xcbb2('0x34')]=_[_0xcbb2('0x32')](_0x5a854a[_0xcbb2('0x2f')],qs[_0xcbb2('0x35')](_0x318934[_0xcbb2('0x33')]['fields']));_0x4ca00b['attributes']=_0x4ca00b[_0xcbb2('0x34')][_0xcbb2('0x36')]?_0x4ca00b[_0xcbb2('0x34')]:_0x5a854a[_0xcbb2('0x2f')];if(!_0x318934[_0xcbb2('0x33')][_0xcbb2('0x37')](_0xcbb2('0x38'))){_0x4ca00b[_0xcbb2('0x20')]=qs[_0xcbb2('0x20')](_0x318934[_0xcbb2('0x33')][_0xcbb2('0x20')]);_0x4ca00b[_0xcbb2('0x21')]=qs['offset'](_0x318934[_0xcbb2('0x33')]['offset']);}_0x4ca00b[_0xcbb2('0x39')]=qs[_0xcbb2('0x3a')](_0x318934[_0xcbb2('0x33')]['sort']);_0x4ca00b[_0xcbb2('0x3b')]=qs[_0xcbb2('0x31')](_[_0xcbb2('0x3c')](_0x318934['query'],_0x5a854a[_0xcbb2('0x31')]),_0x5d5b96);if(_0x318934[_0xcbb2('0x33')][_0xcbb2('0x3d')]){_0x4ca00b[_0xcbb2('0x3b')]=_[_0xcbb2('0x3e')](_0x4ca00b[_0xcbb2('0x3b')],{'$or':_['map'](_0x5d5b96,function(_0xa2ef73){if(_0xa2ef73['type']!==_0xcbb2('0x3f')){var _0xfcd671={};_0xfcd671[_0xa2ef73[_0xcbb2('0x27')]]={'$like':'%'+_0x318934[_0xcbb2('0x33')][_0xcbb2('0x3d')]+'%'};return _0xfcd671;}})});}_0x4ca00b=_[_0xcbb2('0x3e')]({},_0x4ca00b,_0x318934[_0xcbb2('0x40')]);var _0x3b14fa={'where':_0x4ca00b[_0xcbb2('0x3b')]};return db[_0xcbb2('0x41')]['count'](_0x3b14fa)[_0xcbb2('0x42')](function(_0x40aeb6){_0x2dbed8['count']=_0x40aeb6;if(_0x318934[_0xcbb2('0x33')][_0xcbb2('0x43')]){_0x4ca00b[_0xcbb2('0x44')]=[{'all':!![]}];}return db[_0xcbb2('0x41')][_0xcbb2('0x45')](_0x4ca00b);})[_0xcbb2('0x42')](function(_0x155262){_0x2dbed8[_0xcbb2('0x46')]=_0x155262;return _0x2dbed8;})[_0xcbb2('0x42')](respondWithFilteredResult(_0x4bff1b,_0x4ca00b))[_0xcbb2('0x47')](handleError(_0x4bff1b,null));};exports['show']=function(_0x118736,_0x20a6ab){var _0x1002b1={'raw':!![],'where':{'id':_0x118736[_0xcbb2('0x48')]['id']}},_0x19048f={};_0x19048f[_0xcbb2('0x2f')]=_[_0xcbb2('0x30')](db['MailTransferReport'][_0xcbb2('0x2b')]);_0x19048f[_0xcbb2('0x33')]=_[_0xcbb2('0x30')](_0x118736[_0xcbb2('0x33')]);_0x19048f[_0xcbb2('0x31')]=_[_0xcbb2('0x32')](_0x19048f['model'],_0x19048f[_0xcbb2('0x33')]);_0x1002b1[_0xcbb2('0x34')]=_['intersection'](_0x19048f[_0xcbb2('0x2f')],qs[_0xcbb2('0x35')](_0x118736[_0xcbb2('0x33')][_0xcbb2('0x35')]));_0x1002b1[_0xcbb2('0x34')]=_0x1002b1[_0xcbb2('0x34')]['length']?_0x1002b1[_0xcbb2('0x34')]:_0x19048f[_0xcbb2('0x2f')];if(_0x118736['query']['includeAll']){_0x1002b1[_0xcbb2('0x44')]=[{'all':!![]}];}_0x1002b1=_[_0xcbb2('0x3e')]({},_0x1002b1,_0x118736[_0xcbb2('0x40')]);return db['MailTransferReport']['find'](_0x1002b1)[_0xcbb2('0x42')](handleEntityNotFound(_0x20a6ab,null))[_0xcbb2('0x42')](respondWithResult(_0x20a6ab,null))[_0xcbb2('0x47')](handleError(_0x20a6ab,null));};exports[_0xcbb2('0x49')]=function(_0x37d57b,_0x401f05){return db['MailTransferReport'][_0xcbb2('0x49')](_0x37d57b[_0xcbb2('0x4a')],{})[_0xcbb2('0x42')](respondWithResult(_0x401f05,0xc9))['catch'](handleError(_0x401f05,null));};exports[_0xcbb2('0x4b')]=function(_0x22397b,_0x2ed546){if(_0x22397b['body']['id']){delete _0x22397b[_0xcbb2('0x4a')]['id'];}return db[_0xcbb2('0x41')][_0xcbb2('0x4c')]({'where':{'id':_0x22397b['params']['id']}})[_0xcbb2('0x42')](handleEntityNotFound(_0x2ed546,null))['then'](saveUpdates(_0x22397b[_0xcbb2('0x4a')],null))[_0xcbb2('0x42')](respondWithResult(_0x2ed546,null))[_0xcbb2('0x47')](handleError(_0x2ed546,null));};exports['destroy']=function(_0x2b7890,_0x3a7a46){return db['MailTransferReport'][_0xcbb2('0x4c')]({'where':{'id':_0x2b7890['params']['id']}})[_0xcbb2('0x42')](handleEntityNotFound(_0x3a7a46,null))[_0xcbb2('0x42')](removeEntity(_0x3a7a46,null))[_0xcbb2('0x47')](handleError(_0x3a7a46,null));};exports['describe']=function(_0xcbec31,_0x4f8086){return db['MailTransferReport']['describe']()[_0xcbb2('0x42')](respondWithResult(_0x4f8086,null))[_0xcbb2('0x47')](handleError(_0x4f8086,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e53485e..110e922 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 _0x1e69=['MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x4098df,_0x155f52){var _0x21d017=function(_0xe660ef){while(--_0xe660ef){_0x4098df['push'](_0x4098df['shift']());}};_0x21d017(++_0x155f52);}(_0x1e69,0x85));var _0x91e6=function(_0x3e4ccf,_0x263017){_0x3e4ccf=_0x3e4ccf-0x0;var _0x25d931=_0x1e69[_0x3e4ccf];return _0x25d931;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var logger=require(_0x91e6('0x1'))(_0x91e6('0x2'));var moment=require(_0x91e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91e6('0x4'));var rimraf=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var attributes=require(_0x91e6('0x7'));module[_0x91e6('0x8')]=function(_0x42fe90,_0x4091b8){return _0x42fe90[_0x91e6('0x9')](_0x91e6('0xa'),attributes,{'tableName':_0x91e6('0xb'),'paranoid':![],'indexes':[{'name':_0x91e6('0xc'),'fields':[_0x91e6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5400=['report_mail_transfer','lodash','util','path','exports','define','MailTransferReport'];(function(_0xbe96ce,_0x49f8ac){var _0x38a725=function(_0x26aca8){while(--_0x26aca8){_0xbe96ce['push'](_0xbe96ce['shift']());}};_0x38a725(++_0x49f8ac);}(_0x5400,0x15f));var _0x0540=function(_0x555df6,_0x11b6f5){_0x555df6=_0x555df6-0x0;var _0xeb5319=_0x5400[_0x555df6];return _0xeb5319;};'use strict';var _=require(_0x0540('0x0'));var util=require(_0x0540('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(_0x0540('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x0540('0x3')]=function(_0x3b7549,_0x5af40f){return _0x3b7549[_0x0540('0x4')](_0x0540('0x5'),attributes,{'tableName':_0x0540('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b24f435..2a754ec 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 _0x5f1e=['code','message','info','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x178fa2,_0x161ba8){var _0x205420=function(_0x285a97){while(--_0x285a97){_0x178fa2['push'](_0x178fa2['shift']());}};_0x205420(++_0x161ba8);}(_0x5f1e,0xf4));var _0xe5f1=function(_0x568eaa,_0x4b6646){_0x568eaa=_0x568eaa-0x0;var _0x113d64=_0x5f1e[_0x568eaa];return _0x113d64;};'use strict';var _=require(_0xe5f1('0x0'));var util=require(_0xe5f1('0x1'));var moment=require('moment');var BPromise=require(_0xe5f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe5f1('0x3'))(_0xe5f1('0x4'));var config=require('../../config/environment');var jayson=require(_0xe5f1('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10b5ab,_0x180c47,_0x1918bc){return new BPromise(function(_0x275128,_0x46ac60){return client[_0xe5f1('0x6')](_0x10b5ab,_0x1918bc)[_0xe5f1('0x7')](function(_0x33f3a3){logger['info'](_0xe5f1('0x8'),_0x180c47,_0xe5f1('0x9'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x180c47,_0xe5f1('0x9'),JSON[_0xe5f1('0xa')](_0x33f3a3));if(_0x33f3a3[_0xe5f1('0xb')]){if(_0x33f3a3['error'][_0xe5f1('0xc')]===0x1f4){logger[_0xe5f1('0xb')](_0xe5f1('0x8'),_0x180c47,_0x33f3a3[_0xe5f1('0xb')]['message']);return _0x46ac60(_0x33f3a3['error']['message']);}logger['error'](_0xe5f1('0x8'),_0x180c47,_0x33f3a3['error'][_0xe5f1('0xd')]);return _0x275128(_0x33f3a3[_0xe5f1('0xb')][_0xe5f1('0xd')]);}else{logger[_0xe5f1('0xe')](_0xe5f1('0x8'),_0x180c47,_0xe5f1('0x9'));_0x275128(_0x33f3a3['result']['message']);}})[_0xe5f1('0xf')](function(_0x3fe3c9){logger[_0xe5f1('0xb')](_0xe5f1('0x8'),_0x180c47,_0x3fe3c9);_0x46ac60(_0x3fe3c9);});});} \ No newline at end of file +var _0x0b2a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x490c8f,_0x35edcb){var _0x28d3b9=function(_0x5554a4){while(--_0x5554a4){_0x490c8f['push'](_0x490c8f['shift']());}};_0x28d3b9(++_0x35edcb);}(_0x0b2a,0x88));var _0xa0b2=function(_0x5e800b,_0xd3bc4c){_0x5e800b=_0x5e800b-0x0;var _0x4cb5ea=_0x0b2a[_0x5e800b];return _0x4cb5ea;};'use strict';var _=require(_0xa0b2('0x0'));var util=require('util');var moment=require(_0xa0b2('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0b2('0x2'));var fs=require('fs');var Redis=require(_0xa0b2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0b2('0x4'));var logger=require(_0xa0b2('0x5'))(_0xa0b2('0x6'));var config=require(_0xa0b2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0b2('0x8')][_0xa0b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5937a7,_0x98ef88,_0x146ae9){return new BPromise(function(_0x4553bd,_0xe1082f){return client[_0xa0b2('0xa')](_0x5937a7,_0x146ae9)[_0xa0b2('0xb')](function(_0x50b5dd){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));logger[_0xa0b2('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x98ef88,_0xa0b2('0xe'),JSON['stringify'](_0x50b5dd));if(_0x50b5dd[_0xa0b2('0x10')]){if(_0x50b5dd['error'][_0xa0b2('0x11')]===0x1f4){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);return _0xe1082f(_0x50b5dd['error'][_0xa0b2('0x12')]);}logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd['error']['message']);return _0x4553bd(_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);}else{logger['info'](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));_0x4553bd(_0x50b5dd['result']['message']);}})[_0xa0b2('0x13')](function(_0x2506d3){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x2506d3);_0xe1082f(_0x2506d3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6c75b75..24e10a2 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 _0xb968=['get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','./memberReport.controller'];(function(_0x18dc1d,_0xe74faf){var _0x5adf2e=function(_0x5db71c){while(--_0x5db71c){_0x18dc1d['push'](_0x18dc1d['shift']());}};_0x5adf2e(++_0xe74faf);}(_0xb968,0x82));var _0x8b96=function(_0x99a98,_0x4163aa){_0x99a98=_0x99a98-0x0;var _0x1593dc=_0xb968[_0x99a98];return _0x1593dc;};'use strict';var multer=require(_0x8b96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8b96('0x1'));var express=require('express');var router=express[_0x8b96('0x2')]();var fs_extra=require(_0x8b96('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8b96('0x4'));var config=require('../../config/environment');var controller=require(_0x8b96('0x5'));router[_0x8b96('0x6')]('/',auth[_0x8b96('0x7')](),controller[_0x8b96('0x8')]);router[_0x8b96('0x6')](_0x8b96('0x9'),auth[_0x8b96('0x7')](),controller[_0x8b96('0xa')]);router[_0x8b96('0x6')](_0x8b96('0xb'),auth[_0x8b96('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8b96('0xc')]);router['put'](_0x8b96('0xb'),auth[_0x8b96('0x7')](),controller[_0x8b96('0xd')]);router[_0x8b96('0xe')]('/:id',auth[_0x8b96('0x7')](),controller[_0x8b96('0xf')]);module[_0x8b96('0x10')]=router; \ No newline at end of file +var _0xb677=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x540c44,_0x46f277){var _0x240bba=function(_0x48e593){while(--_0x48e593){_0x540c44['push'](_0x540c44['shift']());}};_0x240bba(++_0x46f277);}(_0xb677,0x8a));var _0x7b67=function(_0x1f4e0b,_0x2a1c8e){_0x1f4e0b=_0x1f4e0b-0x0;var _0x5c4c14=_0xb677[_0x1f4e0b];return _0x5c4c14;};'use strict';var multer=require('multer');var util=require(_0x7b67('0x0'));var path=require(_0x7b67('0x1'));var timeout=require(_0x7b67('0x2'));var express=require(_0x7b67('0x3'));var router=express[_0x7b67('0x4')]();var fs_extra=require(_0x7b67('0x5'));var auth=require(_0x7b67('0x6'));var interaction=require(_0x7b67('0x7'));var config=require(_0x7b67('0x8'));var controller=require(_0x7b67('0x9'));router[_0x7b67('0xa')]('/',auth[_0x7b67('0xb')](),controller[_0x7b67('0xc')]);router['get'](_0x7b67('0xd'),auth[_0x7b67('0xb')](),controller[_0x7b67('0xe')]);router[_0x7b67('0xa')](_0x7b67('0xf'),auth[_0x7b67('0xb')](),controller[_0x7b67('0x10')]);router['post']('/',auth[_0x7b67('0xb')](),controller[_0x7b67('0x11')]);router[_0x7b67('0x12')](_0x7b67('0xf'),auth['isAuthenticated'](),controller[_0x7b67('0x13')]);router[_0x7b67('0x14')](_0x7b67('0xf'),auth[_0x7b67('0xb')](),controller[_0x7b67('0x15')]);module[_0x7b67('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 9de2481..0d235b6 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 _0xff1a=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x47b79a,_0x1680c9){var _0x4be089=function(_0x15f496){while(--_0x15f496){_0x47b79a['push'](_0x47b79a['shift']());}};_0x4be089(++_0x1680c9);}(_0xff1a,0x7e));var _0xaff1=function(_0x44a411,_0x13df97){_0x44a411=_0x44a411-0x0;var _0x421796=_0xff1a[_0x44a411];return _0x421796;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xaff1('0x0'));module['exports']={'channel':{'type':Sequelize[_0xaff1('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xaff1('0x2'),'comment':_0xaff1('0x3')},'duration':{'type':Sequelize[_0xaff1('0x4')]},'enterAt':{'type':Sequelize[_0xaff1('0x5')]},'exitAt':{'type':Sequelize[_0xaff1('0x5')],'set':function(_0x5b5ebc){var _0x382309=moment(_0x5b5ebc);var _0x4d52bf=moment(this[_0xaff1('0x6')](_0xaff1('0x7')));var _0x55052f=_0x382309[_0xaff1('0x8')](_0x4d52bf,_0xaff1('0x9'));this[_0xaff1('0xa')]('exitAt',_0x5b5ebc);this[_0xaff1('0xa')](_0xaff1('0xb'),_0x55052f>=0x0?_0x55052f:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xaff1('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xaff1('0xd')},'data3':{'type':Sequelize[_0xaff1('0x1')],'comment':_0xaff1('0xe')},'data4':{'type':Sequelize[_0xaff1('0x1')],'comment':_0xaff1('0xf')},'data5':{'type':Sequelize[_0xaff1('0x1')],'comment':_0xaff1('0x10')},'role':{'type':Sequelize[_0xaff1('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xaff1('0x1')]}}; \ No newline at end of file +var _0xb7cc=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','setDataValue','exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x2017b2,_0x186026){var _0x4e52c9=function(_0x3aed20){while(--_0x3aed20){_0x2017b2['push'](_0x2017b2['shift']());}};_0x4e52c9(++_0x186026);}(_0xb7cc,0xc3));var _0xcb7c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb7cc[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcb7c('0x0'));module[_0xcb7c('0x1')]={'channel':{'type':Sequelize[_0xcb7c('0x2')]},'membername':{'type':Sequelize[_0xcb7c('0x2')]},'interface':{'type':Sequelize[_0xcb7c('0x2')]},'type':{'type':Sequelize[_0xcb7c('0x2')],'defaultValue':_0xcb7c('0x3'),'comment':_0xcb7c('0x4')},'duration':{'type':Sequelize[_0xcb7c('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x42c9a8){var _0xeb6fc6=moment(_0x42c9a8);var _0x531924=moment(this[_0xcb7c('0x6')](_0xcb7c('0x7')));var _0x326609=_0xeb6fc6['diff'](_0x531924,'seconds');this[_0xcb7c('0x8')](_0xcb7c('0x9'),_0x42c9a8);this[_0xcb7c('0x8')]('duration',_0x326609>=0x0?_0x326609:null);}},'data1':{'type':Sequelize[_0xcb7c('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xcb7c('0xa')},'data3':{'type':Sequelize[_0xcb7c('0x2')],'comment':_0xcb7c('0xb')},'data4':{'type':Sequelize[_0xcb7c('0x2')],'comment':_0xcb7c('0xc')},'data5':{'type':Sequelize[_0xcb7c('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xcb7c('0x5')]},'uniqueid':{'type':Sequelize[_0xcb7c('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 338bd72..e2c7f21 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x34e8,0x12c));var _0x834e=function(_0x3824ab,_0x698334){_0x3824ab=_0x3824ab-0x0;var _0xa4cc86=_0x34e8[_0x3824ab];return _0xa4cc86;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x1354c9,_0x475347){var _0x116916=function(_0x24051b){while(--_0x24051b){_0x1354c9['push'](_0x1354c9['shift']());}};_0x116916(++_0x475347);}(_0x008c,0x188));var _0xc008=function(_0x2c0a07,_0x56553b){_0x2c0a07=_0x2c0a07-0x0;var _0x515ba5=_0x008c[_0x2c0a07];return _0x515ba5;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index dba138f..227bd95 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 _0xe1d3=['rimraf','../../config/environment','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xe1d3,0x159));var _0x3e1d=function(_0x3c1560,_0x47d6e9){_0x3c1560=_0x3c1560-0x0;var _0x3611e8=_0xe1d3[_0x3c1560];return _0x3611e8;};'use strict';var _=require(_0x3e1d('0x0'));var util=require(_0x3e1d('0x1'));var logger=require(_0x3e1d('0x2'))(_0x3e1d('0x3'));var moment=require(_0x3e1d('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1d('0x6'));var config=require(_0x3e1d('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x4594cf,_0x44d676){return _0x4594cf[_0x3e1d('0x8')](_0x3e1d('0x9'),attributes,{'tableName':_0x3e1d('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x3e1d('0xb'),_0x3e1d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9336=['path','rimraf','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x9336,0x112));var _0x6933=function(_0x2993bc,_0xbbb2bb){_0x2993bc=_0x2993bc-0x0;var _0x238887=_0x9336[_0x2993bc];return _0x238887;};'use strict';var _=require(_0x6933('0x0'));var util=require('util');var logger=require(_0x6933('0x1'))(_0x6933('0x2'));var moment=require(_0x6933('0x3'));var BPromise=require(_0x6933('0x4'));var rp=require(_0x6933('0x5'));var fs=require('fs');var path=require(_0x6933('0x6'));var rimraf=require(_0x6933('0x7'));var config=require('../../config/environment');var attributes=require(_0x6933('0x8'));module['exports']=function(_0x55495a,_0x385acb){return _0x55495a[_0x6933('0x9')]('MemberReport',attributes,{'tableName':_0x6933('0xa'),'paranoid':![],'indexes':[{'name':_0x6933('0xb'),'fields':[_0x6933('0xc'),_0x6933('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 17d9b09..df0e112 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 _0xad78=['GetMemberReport','findAll','options','raw','limit','include','map','model','attributes','CreateMemberReport','MemberReport','create','body','debug','UpdateMemberReport','update','where','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x27fa72,_0x2aa603){var _0x5a9f57=function(_0x136c15){while(--_0x136c15){_0x27fa72['push'](_0x27fa72['shift']());}};_0x5a9f57(++_0x2aa603);}(_0xad78,0x149));var _0x8ad7=function(_0x314ddc,_0x33a202){_0x314ddc=_0x314ddc-0x0;var _0x4bff9d=_0xad78[_0x314ddc];return _0x4bff9d;};'use strict';var _=require(_0x8ad7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8ad7('0x1'));var rs=require(_0x8ad7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad7('0x3'))['db'];var utils=require(_0x8ad7('0x4'));var logger=require(_0x8ad7('0x5'))(_0x8ad7('0x6'));var config=require(_0x8ad7('0x7'));var jayson=require(_0x8ad7('0x8'));var client=jayson[_0x8ad7('0x9')][_0x8ad7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415e9c,_0x3daa2d,_0x49aeb1){return new BPromise(function(_0x4822d3,_0x336b3a){return client[_0x8ad7('0xb')](_0x415e9c,_0x49aeb1)[_0x8ad7('0xc')](function(_0x152b82){logger[_0x8ad7('0xd')](_0x8ad7('0xe'),_0x3daa2d,_0x8ad7('0xf'));logger['debug'](_0x8ad7('0x10'),_0x3daa2d,_0x8ad7('0xf'),JSON[_0x8ad7('0x11')](_0x152b82));if(_0x152b82['error']){if(_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x13')]===0x1f4){logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x14')]);return _0x336b3a(_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x14')]);}logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x152b82[_0x8ad7('0x12')]['message']);return _0x4822d3(_0x152b82['error'][_0x8ad7('0x14')]);}else{logger['info'](_0x8ad7('0xe'),_0x3daa2d,_0x8ad7('0xf'));_0x4822d3(_0x152b82['result']['message']);}})[_0x8ad7('0x15')](function(_0x1607c9){logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x1607c9);_0x336b3a(_0x1607c9);});});}exports[_0x8ad7('0x16')]=function(_0x2bccd7){var _0x937333=this;return new Promise(function(_0x4aaef9,_0x557642){return db['MemberReport'][_0x8ad7('0x17')]({'raw':_0x2bccd7['options']?_0x2bccd7[_0x8ad7('0x18')][_0x8ad7('0x19')]===undefined?!![]:![]:!![],'where':_0x2bccd7[_0x8ad7('0x18')]?_0x2bccd7['options']['where']||null:null,'attributes':_0x2bccd7['options']?_0x2bccd7[_0x8ad7('0x18')]['attributes']||null:null,'limit':_0x2bccd7['options']?_0x2bccd7[_0x8ad7('0x18')][_0x8ad7('0x1a')]||null:null,'include':_0x2bccd7[_0x8ad7('0x18')]?_0x2bccd7['options'][_0x8ad7('0x1b')]?_[_0x8ad7('0x1c')](_0x2bccd7[_0x8ad7('0x18')][_0x8ad7('0x1b')],function(_0xd580fd){return{'model':db[_0xd580fd[_0x8ad7('0x1d')]],'as':_0xd580fd['as'],'attributes':_0xd580fd['attributes'],'include':_0xd580fd[_0x8ad7('0x1b')]?_[_0x8ad7('0x1c')](_0xd580fd['include'],function(_0xa79077){return{'model':db[_0xa79077[_0x8ad7('0x1d')]],'as':_0xa79077['as'],'attributes':_0xa79077[_0x8ad7('0x1e')],'include':_0xa79077[_0x8ad7('0x1b')]?_[_0x8ad7('0x1c')](_0xa79077[_0x8ad7('0x1b')],function(_0x1dbca4){return{'model':db[_0x1dbca4['model']],'as':_0x1dbca4['as'],'attributes':_0x1dbca4['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ad7('0xc')](function(_0x5253c0){logger[_0x8ad7('0xd')](_0x8ad7('0x16'),_0x2bccd7);logger['debug'](_0x8ad7('0x16'),_0x2bccd7,JSON[_0x8ad7('0x11')](_0x5253c0));_0x4aaef9(_0x5253c0);})[_0x8ad7('0x15')](function(_0x4f419f){logger[_0x8ad7('0x12')]('GetMemberReport',_0x4f419f['message'],_0x2bccd7);_0x557642(_0x937333['error'](0x1f4,_0x4f419f[_0x8ad7('0x14')]));});});};exports[_0x8ad7('0x1f')]=function(_0x123b6c){var _0x38f101=this;return new Promise(function(_0x3fd891,_0x234cda){return db[_0x8ad7('0x20')][_0x8ad7('0x21')](_0x123b6c[_0x8ad7('0x22')],{'raw':_0x123b6c[_0x8ad7('0x18')]?_0x123b6c['options'][_0x8ad7('0x19')]===undefined?!![]:![]:!![]})[_0x8ad7('0xc')](function(_0x10ff0e){logger['info'](_0x8ad7('0x1f'),_0x123b6c);logger[_0x8ad7('0x23')](_0x8ad7('0x1f'),_0x123b6c,JSON[_0x8ad7('0x11')](_0x10ff0e));_0x3fd891(_0x10ff0e);})[_0x8ad7('0x15')](function(_0x1531a2){logger['error'](_0x8ad7('0x1f'),_0x1531a2['message'],_0x123b6c);_0x234cda(_0x38f101[_0x8ad7('0x12')](0x1f4,_0x1531a2[_0x8ad7('0x14')]));});});};exports[_0x8ad7('0x24')]=function(_0x651189){var _0x4cdaaf=this;return new Promise(function(_0x48b089,_0x389115){return db[_0x8ad7('0x20')][_0x8ad7('0x25')](_0x651189['body'],{'raw':_0x651189[_0x8ad7('0x18')]?_0x651189[_0x8ad7('0x18')][_0x8ad7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x651189[_0x8ad7('0x18')]?_0x651189[_0x8ad7('0x18')][_0x8ad7('0x26')]||null:null,'attributes':_0x651189['options']?_0x651189[_0x8ad7('0x18')]['attributes']||null:null,'limit':_0x651189['options']?_0x651189[_0x8ad7('0x18')]['limit']||null:null})[_0x8ad7('0xc')](function(_0xd013ab){logger[_0x8ad7('0xd')]('UpdateMemberReport',_0x651189);logger[_0x8ad7('0x23')](_0x8ad7('0x24'),_0x651189,JSON[_0x8ad7('0x11')](_0xd013ab));_0x48b089(_0xd013ab);})[_0x8ad7('0x15')](function(_0x3115eb){logger[_0x8ad7('0x12')](_0x8ad7('0x24'),_0x3115eb['message'],_0x651189);_0x389115(_0x4cdaaf[_0x8ad7('0x12')](0x1f4,_0x3115eb[_0x8ad7('0x14')]));});});}; \ No newline at end of file +var _0xc1db=['options','where','limit','include','map','model','attributes','then','CreateMemberReport','create','body','raw','debug','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x4dc763,_0x22bff4){var _0x292fe1=function(_0x409c8a){while(--_0x409c8a){_0x4dc763['push'](_0x4dc763['shift']());}};_0x292fe1(++_0x22bff4);}(_0xc1db,0x120));var _0xbc1d=function(_0x5d7cb3,_0x1b4644){_0x5d7cb3=_0x5d7cb3-0x0;var _0x3907ec=_0xc1db[_0x5d7cb3];return _0x3907ec;};'use strict';var _=require(_0xbc1d('0x0'));var util=require('util');var moment=require(_0xbc1d('0x1'));var BPromise=require(_0xbc1d('0x2'));var rs=require(_0xbc1d('0x3'));var fs=require('fs');var Redis=require(_0xbc1d('0x4'));var db=require(_0xbc1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc1d('0x6'))(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dbeec,_0x58e1fb,_0x1bec7a){return new BPromise(function(_0x562549,_0x268200){return client[_0xbc1d('0xa')](_0x5dbeec,_0x1bec7a)['then'](function(_0x45468e){logger['info'](_0xbc1d('0xb'),_0x58e1fb,_0xbc1d('0xc'));logger['debug'](_0xbc1d('0xd'),_0x58e1fb,_0xbc1d('0xc'),JSON[_0xbc1d('0xe')](_0x45468e));if(_0x45468e[_0xbc1d('0xf')]){if(_0x45468e['error'][_0xbc1d('0x10')]===0x1f4){logger['error'](_0xbc1d('0xb'),_0x58e1fb,_0x45468e[_0xbc1d('0xf')]['message']);return _0x268200(_0x45468e[_0xbc1d('0xf')][_0xbc1d('0x11')]);}logger['error'](_0xbc1d('0xb'),_0x58e1fb,_0x45468e[_0xbc1d('0xf')]['message']);return _0x562549(_0x45468e[_0xbc1d('0xf')]['message']);}else{logger[_0xbc1d('0x12')](_0xbc1d('0xb'),_0x58e1fb,_0xbc1d('0xc'));_0x562549(_0x45468e[_0xbc1d('0x13')][_0xbc1d('0x11')]);}})[_0xbc1d('0x14')](function(_0x5bddda){logger[_0xbc1d('0xf')]('MemberReport,\x20%s,\x20%s',_0x58e1fb,_0x5bddda);_0x268200(_0x5bddda);});});}exports[_0xbc1d('0x15')]=function(_0x225310){var _0x57de11=this;return new Promise(function(_0x58c56e,_0x51abd6){return db[_0xbc1d('0x16')][_0xbc1d('0x17')]({'raw':_0x225310[_0xbc1d('0x18')]?_0x225310[_0xbc1d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x225310[_0xbc1d('0x18')]?_0x225310[_0xbc1d('0x18')][_0xbc1d('0x19')]||null:null,'attributes':_0x225310[_0xbc1d('0x18')]?_0x225310['options']['attributes']||null:null,'limit':_0x225310[_0xbc1d('0x18')]?_0x225310['options'][_0xbc1d('0x1a')]||null:null,'include':_0x225310['options']?_0x225310[_0xbc1d('0x18')][_0xbc1d('0x1b')]?_['map'](_0x225310[_0xbc1d('0x18')][_0xbc1d('0x1b')],function(_0x3955ab){return{'model':db[_0x3955ab['model']],'as':_0x3955ab['as'],'attributes':_0x3955ab['attributes'],'include':_0x3955ab[_0xbc1d('0x1b')]?_['map'](_0x3955ab[_0xbc1d('0x1b')],function(_0x13ce62){return{'model':db[_0x13ce62['model']],'as':_0x13ce62['as'],'attributes':_0x13ce62['attributes'],'include':_0x13ce62[_0xbc1d('0x1b')]?_[_0xbc1d('0x1c')](_0x13ce62['include'],function(_0x7b37c3){return{'model':db[_0x7b37c3[_0xbc1d('0x1d')]],'as':_0x7b37c3['as'],'attributes':_0x7b37c3[_0xbc1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc1d('0x1f')](function(_0x155c90){logger[_0xbc1d('0x12')](_0xbc1d('0x15'),_0x225310);logger['debug'](_0xbc1d('0x15'),_0x225310,JSON['stringify'](_0x155c90));_0x58c56e(_0x155c90);})['catch'](function(_0x40d1e2){logger[_0xbc1d('0xf')](_0xbc1d('0x15'),_0x40d1e2[_0xbc1d('0x11')],_0x225310);_0x51abd6(_0x57de11['error'](0x1f4,_0x40d1e2[_0xbc1d('0x11')]));});});};exports[_0xbc1d('0x20')]=function(_0x586007){var _0x24b534=this;return new Promise(function(_0x47cd85,_0x12a96c){return db[_0xbc1d('0x16')][_0xbc1d('0x21')](_0x586007[_0xbc1d('0x22')],{'raw':_0x586007[_0xbc1d('0x18')]?_0x586007[_0xbc1d('0x18')][_0xbc1d('0x23')]===undefined?!![]:![]:!![]})[_0xbc1d('0x1f')](function(_0x4fd85a){logger[_0xbc1d('0x12')](_0xbc1d('0x20'),_0x586007);logger[_0xbc1d('0x24')](_0xbc1d('0x20'),_0x586007,JSON[_0xbc1d('0xe')](_0x4fd85a));_0x47cd85(_0x4fd85a);})[_0xbc1d('0x14')](function(_0x5442ed){logger[_0xbc1d('0xf')](_0xbc1d('0x20'),_0x5442ed[_0xbc1d('0x11')],_0x586007);_0x12a96c(_0x24b534['error'](0x1f4,_0x5442ed[_0xbc1d('0x11')]));});});};exports[_0xbc1d('0x25')]=function(_0x16cb6e){var _0x563d7e=this;return new Promise(function(_0x452924,_0x1ed448){return db[_0xbc1d('0x16')][_0xbc1d('0x26')](_0x16cb6e['body'],{'raw':_0x16cb6e['options']?_0x16cb6e[_0xbc1d('0x18')][_0xbc1d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16cb6e[_0xbc1d('0x18')]?_0x16cb6e['options']['where']||null:null,'attributes':_0x16cb6e['options']?_0x16cb6e['options'][_0xbc1d('0x1e')]||null:null,'limit':_0x16cb6e[_0xbc1d('0x18')]?_0x16cb6e[_0xbc1d('0x18')][_0xbc1d('0x1a')]||null:null})[_0xbc1d('0x1f')](function(_0x271e40){logger['info'](_0xbc1d('0x25'),_0x16cb6e);logger['debug'](_0xbc1d('0x25'),_0x16cb6e,JSON['stringify'](_0x271e40));_0x452924(_0x271e40);})[_0xbc1d('0x14')](function(_0x3fdfc5){logger[_0xbc1d('0xf')]('UpdateMemberReport',_0x3fdfc5[_0xbc1d('0x11')],_0x16cb6e);_0x1ed448(_0x563d7e[_0xbc1d('0xf')](0x1f4,_0x3fdfc5[_0xbc1d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7e9f438..fd92a8b 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 _0x703b=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x494659,_0x1b8e75){var _0x36a11d=function(_0x1b4e77){while(--_0x1b4e77){_0x494659['push'](_0x494659['shift']());}};_0x36a11d(++_0x1b8e75);}(_0x703b,0x1e2));var _0xb703=function(_0x5972a8,_0x12cc8a){_0x5972a8=_0x5972a8-0x0;var _0x4469b8=_0x703b[_0x5972a8];return _0x4469b8;};'use strict';var multer=require(_0xb703('0x0'));var util=require(_0xb703('0x1'));var path=require(_0xb703('0x2'));var timeout=require(_0xb703('0x3'));var express=require(_0xb703('0x4'));var router=express['Router']();var fs_extra=require(_0xb703('0x5'));var auth=require(_0xb703('0x6'));var interaction=require(_0xb703('0x7'));var config=require(_0xb703('0x8'));var controller=require(_0xb703('0x9'));router[_0xb703('0xa')]('/',controller[_0xb703('0xb')]);module[_0xb703('0xc')]=router; \ No newline at end of file +var _0x6029=['./migration.controller','index','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x46c8bb,_0x4468f4){var _0x434481=function(_0x259b12){while(--_0x259b12){_0x46c8bb['push'](_0x46c8bb['shift']());}};_0x434481(++_0x4468f4);}(_0x6029,0x18f));var _0x9602=function(_0x624cd,_0x19e14b){_0x624cd=_0x624cd-0x0;var _0x585c3b=_0x6029[_0x624cd];return _0x585c3b;};'use strict';var multer=require('multer');var util=require(_0x9602('0x0'));var path=require(_0x9602('0x1'));var timeout=require(_0x9602('0x2'));var express=require(_0x9602('0x3'));var router=express['Router']();var fs_extra=require(_0x9602('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9602('0x5'));var config=require('../../config/environment');var controller=require(_0x9602('0x6'));router['get']('/',controller[_0x9602('0x7')]);module[_0x9602('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 002f59a..0185d47 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 _0x7c9d=['version','STRING'];(function(_0x3494b7,_0x138a6f){var _0xd739c7=function(_0x3c2106){while(--_0x3c2106){_0x3494b7['push'](_0x3494b7['shift']());}};_0xd739c7(++_0x138a6f);}(_0x7c9d,0x15f));var _0xd7c9=function(_0x215f4b,_0x365b4c){_0x215f4b=_0x215f4b-0x0;var _0x76f04=_0x7c9d[_0x215f4b];return _0x76f04;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xd7c9('0x0')],'unique':_0xd7c9('0x1')}}; \ No newline at end of file +var _0x4e5f=['STRING','sequelize','exports'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x4e5f,0x187));var _0xf4e5=function(_0x35d7c6,_0x3e88e6){_0x35d7c6=_0x35d7c6-0x0;var _0x3cc7ff=_0x4e5f[_0x35d7c6];return _0x3cc7ff;};'use strict';var Sequelize=require(_0xf4e5('0x0'));module[_0xf4e5('0x1')]={'version':{'type':Sequelize[_0xf4e5('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d3685cf..e53db84 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 _0x085d=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Migration','include','findAll','catch','eml-format','fast-json-patch','util','path','sox','to-csv'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x085d,0x84));var _0xd085=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x085d[_0x40aaa4];return _0x4e21e5;};'use strict';var emlformat=require(_0xd085('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd085('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd085('0x2'));var path=require(_0xd085('0x3'));var sox=require(_0xd085('0x4'));var csv=require(_0xd085('0x5'));var ejs=require(_0xd085('0x6'));var fs=require('fs');var fs_extra=require(_0xd085('0x7'));var _=require(_0xd085('0x8'));var squel=require(_0xd085('0x9'));var crypto=require(_0xd085('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd085('0xb'));var toCsv=require(_0xd085('0x5'));var querystring=require(_0xd085('0xc'));var Papa=require(_0xd085('0xd'));var Redis=require(_0xd085('0xe'));var authService=require(_0xd085('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd085('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd085('0x11'));var config=require(_0xd085('0x12'));var licenseUtil=require(_0xd085('0x13'));var db=require(_0xd085('0x14'))['db'];function respondWithStatusCode(_0x49f9e9,_0x4d7eda){_0x4d7eda=_0x4d7eda||0xcc;return function(_0x323a7d){if(_0x323a7d){return _0x49f9e9[_0xd085('0x15')](_0x4d7eda);}return _0x49f9e9[_0xd085('0x16')](_0x4d7eda)['end']();};}function respondWithResult(_0x32c05c,_0x5e2e77){_0x5e2e77=_0x5e2e77||0xc8;return function(_0x32b6b9){if(_0x32b6b9){return _0x32c05c['status'](_0x5e2e77)[_0xd085('0x17')](_0x32b6b9);}};}function respondWithFilteredResult(_0x2a2fb9,_0x5d7ec3){return function(_0x57241f){if(_0x57241f){var _0x987b9c=typeof _0x5d7ec3[_0xd085('0x18')]===_0xd085('0x19')&&typeof _0x5d7ec3[_0xd085('0x1a')]===_0xd085('0x19');var _0x287eb4=_0x57241f[_0xd085('0x1b')];var _0x3a0102=_0x987b9c?0x0:_0x5d7ec3['offset'];var _0x4c4d04=_0x987b9c?_0x57241f[_0xd085('0x1b')]:_0x5d7ec3[_0xd085('0x18')]+_0x5d7ec3[_0xd085('0x1a')];var _0x2fb041;if(_0x4c4d04>=_0x287eb4){_0x4c4d04=_0x287eb4;_0x2fb041=0xc8;}else{_0x2fb041=0xce;}_0x2a2fb9[_0xd085('0x16')](_0x2fb041);return _0x2a2fb9[_0xd085('0x1c')](_0xd085('0x1d'),_0x3a0102+'-'+_0x4c4d04+'/'+_0x287eb4)[_0xd085('0x17')](_0x57241f);}return null;};}function patchUpdates(_0x227787){return function(_0xcdaa00){try{jsonpatch[_0xd085('0x1e')](_0xcdaa00,_0x227787,!![]);}catch(_0x4d4af4){return BPromise[_0xd085('0x1f')](_0x4d4af4);}return _0xcdaa00[_0xd085('0x20')]();};}function saveUpdates(_0x14f6e0,_0x1002d9){return function(_0x4fd019){if(_0x4fd019){return _0x4fd019[_0xd085('0x21')](_0x14f6e0)[_0xd085('0x22')](function(_0x489ed8){return _0x489ed8;});}return null;};}function removeEntity(_0x3f88ef,_0xe6be2c){return function(_0x3775b7){if(_0x3775b7){return _0x3775b7[_0xd085('0x23')]()[_0xd085('0x22')](function(){_0x3f88ef[_0xd085('0x16')](0xcc)[_0xd085('0x24')]();});}};}function handleEntityNotFound(_0xd8a9f7,_0xbd4517){return function(_0x3d6fbb){if(!_0x3d6fbb){_0xd8a9f7['sendStatus'](0x194);}return _0x3d6fbb;};}function handleError(_0x3808af,_0x436121){_0x436121=_0x436121||0x1f4;return function(_0x391abb){logger[_0xd085('0x25')](_0x391abb[_0xd085('0x26')]);if(_0x391abb['name']){delete _0x391abb[_0xd085('0x27')];}_0x3808af['status'](_0x436121)[_0xd085('0x28')](_0x391abb);};}exports[_0xd085('0x29')]=function(_0x2b0a67,_0x22fb17){var _0x5582a0={},_0x5f53b4={},_0x5a8113={'count':0x0,'rows':[]};var _0x20810c=_[_0xd085('0x2a')](db['Migration'][_0xd085('0x2b')],function(_0x3bf2a1){return{'name':_0x3bf2a1[_0xd085('0x2c')],'type':_0x3bf2a1[_0xd085('0x2d')][_0xd085('0x2e')]};});_0x5f53b4[_0xd085('0x2f')]=_['map'](_0x20810c,_0xd085('0x27'));_0x5f53b4['query']=_[_0xd085('0x30')](_0x2b0a67['query']);_0x5f53b4['filters']=_['intersection'](_0x5f53b4[_0xd085('0x2f')],_0x5f53b4[_0xd085('0x31')]);_0x5582a0[_0xd085('0x32')]=_[_0xd085('0x33')](_0x5f53b4['model'],qs[_0xd085('0x34')](_0x2b0a67[_0xd085('0x31')]['fields']));_0x5582a0[_0xd085('0x32')]=_0x5582a0[_0xd085('0x32')][_0xd085('0x35')]?_0x5582a0[_0xd085('0x32')]:_0x5f53b4[_0xd085('0x2f')];if(!_0x2b0a67['query'][_0xd085('0x36')](_0xd085('0x37'))){_0x5582a0[_0xd085('0x1a')]=qs['limit'](_0x2b0a67[_0xd085('0x31')][_0xd085('0x1a')]);_0x5582a0['offset']=qs[_0xd085('0x18')](_0x2b0a67['query']['offset']);}_0x5582a0[_0xd085('0x38')]=qs[_0xd085('0x39')](_0x2b0a67[_0xd085('0x31')][_0xd085('0x39')]);_0x5582a0[_0xd085('0x3a')]=qs[_0xd085('0x3b')](_[_0xd085('0x3c')](_0x2b0a67['query'],_0x5f53b4['filters']),_0x20810c);if(_0x2b0a67[_0xd085('0x31')][_0xd085('0x3d')]){_0x5582a0[_0xd085('0x3a')]=_[_0xd085('0x3e')](_0x5582a0[_0xd085('0x3a')],{'$or':_['map'](_0x20810c,function(_0x10e63a){if(_0x10e63a[_0xd085('0x2d')]!==_0xd085('0x3f')){var _0x4e5ddb={};_0x4e5ddb[_0x10e63a[_0xd085('0x27')]]={'$like':'%'+_0x2b0a67[_0xd085('0x31')][_0xd085('0x3d')]+'%'};return _0x4e5ddb;}})});}_0x5582a0=_[_0xd085('0x3e')]({},_0x5582a0,_0x2b0a67[_0xd085('0x40')]);var _0x2fb2fd={'where':_0x5582a0[_0xd085('0x3a')]};return db[_0xd085('0x41')][_0xd085('0x1b')](_0x2fb2fd)[_0xd085('0x22')](function(_0x5ecb09){_0x5a8113['count']=_0x5ecb09;if(_0x2b0a67[_0xd085('0x31')]['includeAll']){_0x5582a0[_0xd085('0x42')]=[{'all':!![]}];}return db[_0xd085('0x41')][_0xd085('0x43')](_0x5582a0);})['then'](function(_0x25e77b){_0x5a8113['rows']=_0x25e77b;return _0x5a8113;})[_0xd085('0x22')](respondWithFilteredResult(_0x22fb17,_0x5582a0))[_0xd085('0x44')](handleError(_0x22fb17,null));}; \ No newline at end of file +var _0x4516=['filter','options','findAll','rows','catch','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x3da856,_0x5f3197){var _0x53a3d5=function(_0x3fa605){while(--_0x3fa605){_0x3da856['push'](_0x3da856['shift']());}};_0x53a3d5(++_0x5f3197);}(_0x4516,0xc5));var _0x6451=function(_0x5b58eb,_0x59feb3){_0x5b58eb=_0x5b58eb-0x0;var _0x1a8275=_0x4516[_0x5b58eb];return _0x1a8275;};'use strict';var emlformat=require(_0x6451('0x0'));var rimraf=require(_0x6451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6451('0x2'));var BPromise=require(_0x6451('0x3'));var Mustache=require(_0x6451('0x4'));var util=require(_0x6451('0x5'));var path=require(_0x6451('0x6'));var sox=require('sox');var csv=require(_0x6451('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6451('0x8'));var squel=require(_0x6451('0x9'));var crypto=require('crypto');var jsforce=require(_0x6451('0xa'));var deskjs=require(_0x6451('0xb'));var toCsv=require(_0x6451('0x7'));var querystring=require(_0x6451('0xc'));var Papa=require('papaparse');var Redis=require(_0x6451('0xd'));var authService=require(_0x6451('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6451('0xf'));var hardwareService=require(_0x6451('0x10'));var logger=require(_0x6451('0x11'))('api');var utils=require(_0x6451('0x12'));var config=require(_0x6451('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6451('0x14'))['db'];function respondWithStatusCode(_0x2f58b9,_0x252358){_0x252358=_0x252358||0xcc;return function(_0x45473f){if(_0x45473f){return _0x2f58b9[_0x6451('0x15')](_0x252358);}return _0x2f58b9[_0x6451('0x16')](_0x252358)['end']();};}function respondWithResult(_0x3182c4,_0x550317){_0x550317=_0x550317||0xc8;return function(_0x5c22af){if(_0x5c22af){return _0x3182c4[_0x6451('0x16')](_0x550317)[_0x6451('0x17')](_0x5c22af);}};}function respondWithFilteredResult(_0x50316a,_0x1ec796){return function(_0x39f9e5){if(_0x39f9e5){var _0x5454c9=typeof _0x1ec796[_0x6451('0x18')]===_0x6451('0x19')&&typeof _0x1ec796[_0x6451('0x1a')]==='undefined';var _0x453d22=_0x39f9e5[_0x6451('0x1b')];var _0x8e67ee=_0x5454c9?0x0:_0x1ec796[_0x6451('0x18')];var _0x36d414=_0x5454c9?_0x39f9e5[_0x6451('0x1b')]:_0x1ec796[_0x6451('0x18')]+_0x1ec796['limit'];var _0x524f6a;if(_0x36d414>=_0x453d22){_0x36d414=_0x453d22;_0x524f6a=0xc8;}else{_0x524f6a=0xce;}_0x50316a[_0x6451('0x16')](_0x524f6a);return _0x50316a[_0x6451('0x1c')](_0x6451('0x1d'),_0x8e67ee+'-'+_0x36d414+'/'+_0x453d22)['json'](_0x39f9e5);}return null;};}function patchUpdates(_0x153322){return function(_0x4d06b3){try{jsonpatch['apply'](_0x4d06b3,_0x153322,!![]);}catch(_0x58b598){return BPromise['reject'](_0x58b598);}return _0x4d06b3[_0x6451('0x1e')]();};}function saveUpdates(_0x30fd16,_0x58ad16){return function(_0x518818){if(_0x518818){return _0x518818[_0x6451('0x1f')](_0x30fd16)[_0x6451('0x20')](function(_0x2db7c1){return _0x2db7c1;});}return null;};}function removeEntity(_0xd6a2c3,_0x10f01c){return function(_0x437736){if(_0x437736){return _0x437736[_0x6451('0x21')]()[_0x6451('0x20')](function(){_0xd6a2c3[_0x6451('0x16')](0xcc)[_0x6451('0x22')]();});}};}function handleEntityNotFound(_0x31c010,_0x302022){return function(_0x101d4f){if(!_0x101d4f){_0x31c010[_0x6451('0x15')](0x194);}return _0x101d4f;};}function handleError(_0x13e1d4,_0x533e94){_0x533e94=_0x533e94||0x1f4;return function(_0x184222){logger[_0x6451('0x23')](_0x184222['stack']);if(_0x184222[_0x6451('0x24')]){delete _0x184222[_0x6451('0x24')];}_0x13e1d4['status'](_0x533e94)[_0x6451('0x25')](_0x184222);};}exports[_0x6451('0x26')]=function(_0x4be340,_0x19b9cf){var _0x38948c={},_0x200c03={},_0x2c4472={'count':0x0,'rows':[]};var _0x2d1747=_[_0x6451('0x27')](db[_0x6451('0x28')][_0x6451('0x29')],function(_0x1b7891){return{'name':_0x1b7891[_0x6451('0x2a')],'type':_0x1b7891[_0x6451('0x2b')][_0x6451('0x2c')]};});_0x200c03['model']=_[_0x6451('0x27')](_0x2d1747,_0x6451('0x24'));_0x200c03[_0x6451('0x2d')]=_['keys'](_0x4be340[_0x6451('0x2d')]);_0x200c03[_0x6451('0x2e')]=_[_0x6451('0x2f')](_0x200c03[_0x6451('0x30')],_0x200c03[_0x6451('0x2d')]);_0x38948c[_0x6451('0x31')]=_[_0x6451('0x2f')](_0x200c03[_0x6451('0x30')],qs[_0x6451('0x32')](_0x4be340[_0x6451('0x2d')][_0x6451('0x32')]));_0x38948c[_0x6451('0x31')]=_0x38948c[_0x6451('0x31')][_0x6451('0x33')]?_0x38948c['attributes']:_0x200c03['model'];if(!_0x4be340[_0x6451('0x2d')][_0x6451('0x34')](_0x6451('0x35'))){_0x38948c[_0x6451('0x1a')]=qs[_0x6451('0x1a')](_0x4be340[_0x6451('0x2d')][_0x6451('0x1a')]);_0x38948c[_0x6451('0x18')]=qs[_0x6451('0x18')](_0x4be340[_0x6451('0x2d')][_0x6451('0x18')]);}_0x38948c[_0x6451('0x36')]=qs[_0x6451('0x37')](_0x4be340[_0x6451('0x2d')][_0x6451('0x37')]);_0x38948c[_0x6451('0x38')]=qs[_0x6451('0x2e')](_['pick'](_0x4be340[_0x6451('0x2d')],_0x200c03[_0x6451('0x2e')]),_0x2d1747);if(_0x4be340[_0x6451('0x2d')]['filter']){_0x38948c['where']=_[_0x6451('0x39')](_0x38948c[_0x6451('0x38')],{'$or':_['map'](_0x2d1747,function(_0x59c6f8){if(_0x59c6f8[_0x6451('0x2b')]!==_0x6451('0x3a')){var _0x1a847c={};_0x1a847c[_0x59c6f8[_0x6451('0x24')]]={'$like':'%'+_0x4be340[_0x6451('0x2d')][_0x6451('0x3b')]+'%'};return _0x1a847c;}})});}_0x38948c=_[_0x6451('0x39')]({},_0x38948c,_0x4be340[_0x6451('0x3c')]);var _0x4f8808={'where':_0x38948c[_0x6451('0x38')]};return db[_0x6451('0x28')]['count'](_0x4f8808)[_0x6451('0x20')](function(_0x33e878){_0x2c4472[_0x6451('0x1b')]=_0x33e878;if(_0x4be340[_0x6451('0x2d')]['includeAll']){_0x38948c['include']=[{'all':!![]}];}return db[_0x6451('0x28')][_0x6451('0x3d')](_0x38948c);})['then'](function(_0x112199){_0x2c4472[_0x6451('0x3e')]=_0x112199;return _0x2c4472;})[_0x6451('0x20')](respondWithFilteredResult(_0x19b9cf,_0x38948c))[_0x6451('0x3f')](handleError(_0x19b9cf,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3465ef1..fac4d63 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 _0xeed4=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','api','moment','request-promise','path'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0xeed4,0x1c2));var _0x4eed=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xeed4[_0x3a8dc1];return _0x4b3595;};'use strict';var _=require(_0x4eed('0x0'));var util=require(_0x4eed('0x1'));var logger=require('../../config/logger')(_0x4eed('0x2'));var moment=require(_0x4eed('0x3'));var BPromise=require('bluebird');var rp=require(_0x4eed('0x4'));var fs=require('fs');var path=require(_0x4eed('0x5'));var rimraf=require('rimraf');var config=require(_0x4eed('0x6'));var attributes=require(_0x4eed('0x7'));module[_0x4eed('0x8')]=function(_0xb05d28,_0x47aad6){return _0xb05d28[_0x4eed('0x9')](_0x4eed('0xa'),attributes,{'tableName':_0x4eed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61ef=['migrations','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x5d59b4,_0x1c4990){var _0x51ccc3=function(_0x40e84c){while(--_0x40e84c){_0x5d59b4['push'](_0x5d59b4['shift']());}};_0x51ccc3(++_0x1c4990);}(_0x61ef,0x175));var _0xf61e=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x61ef[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xf61e('0x0'));var util=require(_0xf61e('0x1'));var logger=require(_0xf61e('0x2'))(_0xf61e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf61e('0x4'));var rimraf=require(_0xf61e('0x5'));var config=require(_0xf61e('0x6'));var attributes=require(_0xf61e('0x7'));module[_0xf61e('0x8')]=function(_0x614b46,_0x3e54c7){return _0x614b46[_0xf61e('0x9')](_0xf61e('0xa'),attributes,{'tableName':_0xf61e('0xb'),'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 f9c6472..9a39d86 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 _0xf290=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf290,0xde));var _0x0f29=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xf290[_0x3cec8c];return _0x38032e;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Migration,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});} \ No newline at end of file +var _0xcc40=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xcc40,0x97));var _0x0cc4=function(_0x15fe6b,_0x2b47dc){_0x15fe6b=_0x15fe6b-0x0;var _0x2b6c58=_0xcc40[_0x15fe6b];return _0x2b6c58;};'use strict';var _=require(_0x0cc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cc4('0x1'));var rs=require(_0x0cc4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cc4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cc4('0x4'))(_0x0cc4('0x5'));var config=require('../../config/environment');var jayson=require(_0x0cc4('0x6'));var client=jayson['client'][_0x0cc4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x58f080,_0x5e1afa,_0x349c6a){return new BPromise(function(_0x2fd087,_0x2f00f3){return client['request'](_0x58f080,_0x349c6a)['then'](function(_0x7e2dbf){logger[_0x0cc4('0x8')]('Migration,\x20%s,\x20%s',_0x5e1afa,'request\x20sent');logger[_0x0cc4('0x9')](_0x0cc4('0xa'),_0x5e1afa,_0x0cc4('0xb'),JSON[_0x0cc4('0xc')](_0x7e2dbf));if(_0x7e2dbf[_0x0cc4('0xd')]){if(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0xe')]===0x1f4){logger[_0x0cc4('0xd')](_0x0cc4('0xf'),_0x5e1afa,_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);return _0x2f00f3(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);}logger[_0x0cc4('0xd')](_0x0cc4('0xf'),_0x5e1afa,_0x7e2dbf['error'][_0x0cc4('0x10')]);return _0x2fd087(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);}else{logger[_0x0cc4('0x8')](_0x0cc4('0xf'),_0x5e1afa,'request\x20sent');_0x2fd087(_0x7e2dbf[_0x0cc4('0x11')][_0x0cc4('0x10')]);}})[_0x0cc4('0x12')](function(_0x439755){logger['error'](_0x0cc4('0xf'),_0x5e1afa,_0x439755);_0x2f00f3(_0x439755);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2a25002..8226a9e 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 _0xb091=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./network.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x2b81db,_0xe9c3cb){var _0x1e0f1d=function(_0x63f3b2){while(--_0x63f3b2){_0x2b81db['push'](_0x2b81db['shift']());}};_0x1e0f1d(++_0xe9c3cb);}(_0xb091,0x16e));var _0x1b09=function(_0x2629ef,_0x2b1fa2){_0x2629ef=_0x2629ef-0x0;var _0x31d034=_0xb091[_0x2629ef];return _0x31d034;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0xb')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')](_0x1b09('0xe'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router[_0x1b09('0x10')](_0x1b09('0xe'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);module[_0x1b09('0x12')]=router; \ No newline at end of file +var _0xaaee=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0xe1b14b,_0x275799){var _0x21da52=function(_0x5232a7){while(--_0x5232a7){_0xe1b14b['push'](_0xe1b14b['shift']());}};_0x21da52(++_0x275799);}(_0xaaee,0xa9));var _0xeaae=function(_0x5add29,_0x3cacdb){_0x5add29=_0x5add29-0x0;var _0x38b2d5=_0xaaee[_0x5add29];return _0x38b2d5;};'use strict';var multer=require(_0xeaae('0x0'));var util=require('util');var path=require(_0xeaae('0x1'));var timeout=require(_0xeaae('0x2'));var express=require('express');var router=express[_0xeaae('0x3')]();var fs_extra=require(_0xeaae('0x4'));var auth=require(_0xeaae('0x5'));var interaction=require(_0xeaae('0x6'));var config=require('../../config/environment');var controller=require(_0xeaae('0x7'));router[_0xeaae('0x8')]('/',auth[_0xeaae('0x9')](),controller[_0xeaae('0xa')]);router[_0xeaae('0x8')](_0xeaae('0xb'),auth['isAuthenticated'](),controller[_0xeaae('0xc')]);router[_0xeaae('0xd')]('/',auth[_0xeaae('0x9')](),controller[_0xeaae('0xe')]);router[_0xeaae('0xf')](_0xeaae('0xb'),auth[_0xeaae('0x9')](),controller[_0xeaae('0x10')]);router[_0xeaae('0x11')]('/:id',auth[_0xeaae('0x9')](),controller[_0xeaae('0x12')]);module[_0xeaae('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index bc4e5af..59bfa1a 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 _0xb13d=['externip','stun','STRING','exports','ENUM','localnet'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xb13d,0x1b3));var _0xdb13=function(_0x1a11aa,_0x5cdd4e){_0x1a11aa=_0x1a11aa-0x0;var _0x534709=_0xb13d[_0x1a11aa];return _0x534709;};'use strict';var Sequelize=require('sequelize');module[_0xdb13('0x0')]={'type':{'type':Sequelize[_0xdb13('0x1')](_0xdb13('0x2'),_0xdb13('0x3'),_0xdb13('0x4'),'turn')},'value':{'type':Sequelize[_0xdb13('0x5')]},'username':{'type':Sequelize[_0xdb13('0x5')]},'password':{'type':Sequelize[_0xdb13('0x5')]}}; \ No newline at end of file +var _0x95d6=['externip','stun','STRING','sequelize','exports','ENUM','localnet'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x95d6,0x129));var _0x695d=function(_0x2a32a1,_0x6c6cbb){_0x2a32a1=_0x2a32a1-0x0;var _0xfba034=_0x95d6[_0x2a32a1];return _0xfba034;};'use strict';var Sequelize=require(_0x695d('0x0'));module[_0x695d('0x1')]={'type':{'type':Sequelize[_0x695d('0x2')](_0x695d('0x3'),_0x695d('0x4'),_0x695d('0x5'),'turn')},'value':{'type':Sequelize[_0x695d('0x6')]},'username':{'type':Sequelize[_0x695d('0x6')]},'password':{'type':Sequelize[_0x695d('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a39b8d1..e9e8ee1 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 _0xa208=['writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','STUN','toLowerCase','chan_sip.so','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','count','limit','status','set','update','destroy','end','sendStatus','name','index','map','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Network','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render'];(function(_0x32b5da,_0x45d994){var _0x1304ab=function(_0x30b6e6){while(--_0x30b6e6){_0x32b5da['push'](_0x32b5da['shift']());}};_0x1304ab(++_0x45d994);}(_0xa208,0x112));var _0x8a20=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa208[_0x47e7cb];return _0x2a8874;};'use strict';var util=require('util');var path=require(_0x8a20('0x0'));var ejs=require(_0x8a20('0x1'));var fs=require('fs');var _=require(_0x8a20('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x8a20('0x3'))(_0x8a20('0x4'));var config=require(_0x8a20('0x5'));var db=require(_0x8a20('0x6'))['db'];var jayson=require(_0x8a20('0x7'));var client=jayson[_0x8a20('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8c15,_0x5ca863,_0x1e9f62,_0x37112c){return new Promise(function(_0x5826f6,_0x2d6f6b){var _0xcf0e38=_0x37112c||client;return _0xcf0e38[_0x8a20('0x9')](_0x1a8c15,_0x1e9f62)[_0x8a20('0xa')](function(_0x3ce62e){logger['info'](_0x8a20('0xb'),_0x5ca863,_0x8a20('0xc'));logger[_0x8a20('0xd')](_0x8a20('0xe'),_0x5ca863,_0x8a20('0xc'),JSON[_0x8a20('0xf')](_0x3ce62e));if(_0x3ce62e[_0x8a20('0x10')]){if(_0x3ce62e[_0x8a20('0x10')][_0x8a20('0x11')]===0x1f4){logger[_0x8a20('0x10')](_0x8a20('0xb'),_0x5ca863,_0x3ce62e[_0x8a20('0x10')][_0x8a20('0x12')]);return _0x2d6f6b(_0x3ce62e[_0x8a20('0x10')][_0x8a20('0x12')]);}logger[_0x8a20('0x10')](_0x8a20('0xb'),_0x5ca863,_0x3ce62e[_0x8a20('0x10')][_0x8a20('0x12')]);return _0x5826f6(_0x3ce62e[_0x8a20('0x10')][_0x8a20('0x12')]);}else{logger[_0x8a20('0x13')](_0x8a20('0xb'),_0x5ca863,'request\x20sent');_0x5826f6(_0x3ce62e[_0x8a20('0x14')]['message']);}})[_0x8a20('0x15')](function(_0x22250e){logger[_0x8a20('0x10')](_0x8a20('0xb'),_0x5ca863,_0x22250e);_0x2d6f6b(_0x22250e);});});}function respondWithResult(_0x45ccad,_0x5aeccf){_0x5aeccf=_0x5aeccf||0xc8;return function(_0x90be46){if(_0x90be46){return _0x45ccad['status'](_0x5aeccf)[_0x8a20('0x16')](_0x90be46);}};}function respondWithFilteredResult(_0x5e7887,_0x43fb4e){return function(_0x3ca9ed){if(_0x3ca9ed){var _0x3374f7=typeof _0x43fb4e[_0x8a20('0x17')]===_0x8a20('0x18')&&typeof _0x43fb4e['limit']==='undefined';var _0x2e2e15=_0x3ca9ed[_0x8a20('0x19')];var _0x425948=_0x3374f7?0x0:_0x43fb4e[_0x8a20('0x17')];var _0x138617=_0x3374f7?_0x3ca9ed[_0x8a20('0x19')]:_0x43fb4e[_0x8a20('0x17')]+_0x43fb4e[_0x8a20('0x1a')];var _0x362cc1;if(_0x138617>=_0x2e2e15){_0x138617=_0x2e2e15;_0x362cc1=0xc8;}else{_0x362cc1=0xce;}_0x5e7887[_0x8a20('0x1b')](_0x362cc1);return _0x5e7887[_0x8a20('0x1c')]('Content-Range',_0x425948+'-'+_0x138617+'/'+_0x2e2e15)[_0x8a20('0x16')](_0x3ca9ed);}return null;};}function saveUpdates(_0x5059be){return function(_0x56c2be){if(_0x56c2be){return _0x56c2be[_0x8a20('0x1d')](_0x5059be)[_0x8a20('0xa')](function(_0x37cc9e){return _0x37cc9e;});}return null;};}function removeEntity(_0x5d9ec6){return function(_0x52b103){if(_0x52b103){return _0x52b103[_0x8a20('0x1e')]()[_0x8a20('0xa')](function(){_0x5d9ec6[_0x8a20('0x1b')](0xcc)[_0x8a20('0x1f')]();});}};}function handleEntityNotFound(_0x15a590){return function(_0x5acb91){if(!_0x5acb91){_0x15a590[_0x8a20('0x20')](0x194);}return _0x5acb91;};}function handleError(_0x39d47f,_0x15b7a4){_0x15b7a4=_0x15b7a4||0x1f4;return function(_0x1e8170){logger['error'](_0x1e8170['stack']);if(_0x1e8170[_0x8a20('0x21')]){delete _0x1e8170[_0x8a20('0x21')];}_0x39d47f[_0x8a20('0x1b')](_0x15b7a4)['send'](_0x1e8170);};}exports[_0x8a20('0x22')]=function(_0x39ba53,_0x210766){var _0x30d1d7={},_0x588c24={},_0x28d32e={'count':0x0,'rows':[]};var _0xf2a919=_[_0x8a20('0x23')](db['Network']['rawAttributes'],function(_0x1ad8d){return{'name':_0x1ad8d[_0x8a20('0x24')],'type':_0x1ad8d[_0x8a20('0x25')][_0x8a20('0x26')]};});_0x588c24[_0x8a20('0x27')]=_[_0x8a20('0x23')](_0xf2a919,_0x8a20('0x21'));_0x588c24['query']=_[_0x8a20('0x28')](_0x39ba53['query']);_0x588c24[_0x8a20('0x29')]=_['intersection'](_0x588c24[_0x8a20('0x27')],_0x588c24[_0x8a20('0x2a')]);_0x30d1d7[_0x8a20('0x2b')]=_[_0x8a20('0x2c')](_0x588c24['model'],qs['fields'](_0x39ba53['query'][_0x8a20('0x2d')]));_0x30d1d7[_0x8a20('0x2b')]=_0x30d1d7['attributes'][_0x8a20('0x2e')]?_0x30d1d7['attributes']:_0x588c24[_0x8a20('0x27')];if(!_0x39ba53[_0x8a20('0x2a')][_0x8a20('0x2f')](_0x8a20('0x30'))){_0x30d1d7[_0x8a20('0x1a')]=qs[_0x8a20('0x1a')](_0x39ba53[_0x8a20('0x2a')][_0x8a20('0x1a')]);_0x30d1d7[_0x8a20('0x17')]=qs[_0x8a20('0x17')](_0x39ba53[_0x8a20('0x2a')][_0x8a20('0x17')]);}_0x30d1d7[_0x8a20('0x31')]=qs[_0x8a20('0x32')](_0x39ba53[_0x8a20('0x2a')][_0x8a20('0x32')]);_0x30d1d7[_0x8a20('0x33')]=qs[_0x8a20('0x29')](_[_0x8a20('0x34')](_0x39ba53['query'],_0x588c24[_0x8a20('0x29')]),_0xf2a919);if(_0x39ba53[_0x8a20('0x2a')][_0x8a20('0x35')]){_0x30d1d7[_0x8a20('0x33')]=_['merge'](_0x30d1d7[_0x8a20('0x33')],{'$or':_[_0x8a20('0x23')](_0xf2a919,function(_0x582364){if(_0x582364['type']!==_0x8a20('0x36')){var _0x38009d={};_0x38009d[_0x582364['name']]={'$like':'%'+_0x39ba53[_0x8a20('0x2a')]['filter']+'%'};return _0x38009d;}})});}_0x30d1d7=_[_0x8a20('0x37')]({},_0x30d1d7,_0x39ba53[_0x8a20('0x38')]);var _0x588c9d={'where':_0x30d1d7[_0x8a20('0x33')]};return db[_0x8a20('0x39')][_0x8a20('0x19')](_0x588c9d)[_0x8a20('0xa')](function(_0x396257){_0x28d32e[_0x8a20('0x19')]=_0x396257;if(_0x39ba53['query'][_0x8a20('0x3a')]){_0x30d1d7[_0x8a20('0x3b')]=[{'all':!![]}];}return db[_0x8a20('0x39')][_0x8a20('0x3c')](_0x30d1d7);})[_0x8a20('0xa')](function(_0x26acab){_0x28d32e[_0x8a20('0x3d')]=_0x26acab;return _0x28d32e;})[_0x8a20('0xa')](respondWithFilteredResult(_0x210766,_0x30d1d7))[_0x8a20('0x15')](handleError(_0x210766,null));};exports[_0x8a20('0x3e')]=function(_0x57e95f,_0x33af60){var _0x413e5a={'raw':!![],'where':{'id':_0x57e95f[_0x8a20('0x3f')]['id']}},_0x103bc5={};_0x103bc5['model']=_[_0x8a20('0x28')](db['Network'][_0x8a20('0x40')]);_0x103bc5[_0x8a20('0x2a')]=_[_0x8a20('0x28')](_0x57e95f[_0x8a20('0x2a')]);_0x103bc5[_0x8a20('0x29')]=_['intersection'](_0x103bc5[_0x8a20('0x27')],_0x103bc5[_0x8a20('0x2a')]);_0x413e5a['attributes']=_['intersection'](_0x103bc5[_0x8a20('0x27')],qs['fields'](_0x57e95f[_0x8a20('0x2a')]['fields']));_0x413e5a[_0x8a20('0x2b')]=_0x413e5a[_0x8a20('0x2b')][_0x8a20('0x2e')]?_0x413e5a[_0x8a20('0x2b')]:_0x103bc5[_0x8a20('0x27')];if(_0x57e95f[_0x8a20('0x2a')][_0x8a20('0x3a')]){_0x413e5a[_0x8a20('0x3b')]=[{'all':!![]}];}_0x413e5a=_[_0x8a20('0x37')]({},_0x413e5a,_0x57e95f[_0x8a20('0x38')]);return db[_0x8a20('0x39')][_0x8a20('0x41')](_0x413e5a)[_0x8a20('0xa')](handleEntityNotFound(_0x33af60,null))[_0x8a20('0xa')](respondWithResult(_0x33af60,null))[_0x8a20('0x15')](handleError(_0x33af60,null));};exports[_0x8a20('0x42')]=function(_0xd2b2e6,_0x121076){var _0x45dc82;return db[_0x8a20('0x39')][_0x8a20('0x42')](_0xd2b2e6[_0x8a20('0x43')],{'raw':!![]})[_0x8a20('0xa')](function(_0x3f35c1){_0x45dc82=_0x3f35c1;return db[_0x8a20('0x39')]['findAll']({'where':{'type':_0xd2b2e6[_0x8a20('0x43')]['type']},'raw':!![]});})[_0x8a20('0xa')](function(_0x33fe43){if(_0x45dc82[_0x8a20('0x25')][_0x8a20('0x44')]()=='STUN'){var _0x21b650=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config[_0x8a20('0x47')],_0x8a20('0x48')),'utf8');var _0x253c39=ejs[_0x8a20('0x49')](_0x21b650,{'networks':_0x33fe43||[]});fs[_0x8a20('0x4a')](_0x8a20('0x4b'),_0x253c39);return respondWithRpcPromise(_0x8a20('0x4c'),_0x8a20('0x42'),{'module':_0x8a20('0x4d')});}else if(_0x45dc82[_0x8a20('0x25')]['toUpperCase']()==_0x8a20('0x4e')){var _0x5650b9=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config['root'],_0x8a20('0x4f')),_0x8a20('0x50'));var _0x1e189d=ejs['render'](_0x5650b9,{'networks':_0x33fe43||[]});fs[_0x8a20('0x4a')](_0x8a20('0x51'),_0x1e189d);return respondWithRpcPromise(_0x8a20('0x4c'),_0x8a20('0x42'),{'module':_0x8a20('0x4d')});}else{var _0x54aafc=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config['root'],_0x8a20('0x52')),_0x8a20('0x50'));var _0x532c87=ejs[_0x8a20('0x49')](_0x54aafc,{'networks':_0x33fe43||[]});fs['writeFileSync'](util['format'](_0x8a20('0x53'),_0xd2b2e6['body']['type']['toLowerCase']()),_0x532c87);return respondWithRpcPromise('Reload',_0x8a20('0x42'),{'module':'chan_sip.so'});}})[_0x8a20('0xa')](function(){return _0x45dc82;})[_0x8a20('0xa')](respondWithResult(_0x121076,0xc9))[_0x8a20('0x15')](handleError(_0x121076,null));};exports[_0x8a20('0x1d')]=function(_0x496793,_0x3dc728){var _0x30d6a0;return db[_0x8a20('0x39')][_0x8a20('0x41')]({'where':{'id':_0x496793['params']['id']}})['then'](handleEntityNotFound(_0x3dc728,null))[_0x8a20('0xa')](saveUpdates(_0x496793['body'],null))[_0x8a20('0xa')](function(_0x5db9a3){if(_0x5db9a3){_0x30d6a0=_0x5db9a3;return db[_0x8a20('0x39')]['findAll']({'where':{'type':_0x30d6a0[_0x8a20('0x25')]},'raw':!![]});}return null;})[_0x8a20('0xa')](function(_0x26b415){if(_0x30d6a0[_0x8a20('0x25')][_0x8a20('0x44')]()==_0x8a20('0x54')){var _0xe94789=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config[_0x8a20('0x47')],'server/files/templates/stun_multiple.ejs'),_0x8a20('0x50'));var _0x230c7d=ejs['render'](_0xe94789,{'networks':_0x26b415||[]});fs[_0x8a20('0x4a')](_0x8a20('0x4b'),_0x230c7d);return respondWithRpcPromise(_0x8a20('0x4c'),'update',{'module':_0x8a20('0x4d')});}else if(_0x30d6a0[_0x8a20('0x25')][_0x8a20('0x44')]()=='TURN'){var _0x4aa83d=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config[_0x8a20('0x47')],_0x8a20('0x4f')),'utf8');var _0x5f2ba5=ejs['render'](_0x4aa83d,{'networks':_0x26b415||[]});fs['writeFileSync'](_0x8a20('0x51'),_0x5f2ba5);return respondWithRpcPromise(_0x8a20('0x4c'),_0x8a20('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x4e398d=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config[_0x8a20('0x47')],'server/files/templates/network.ejs'),_0x8a20('0x50'));var _0x258bd4=ejs[_0x8a20('0x49')](_0x4e398d,{'networks':_0x26b415||[]});fs[_0x8a20('0x4a')](util['format'](_0x8a20('0x53'),_0x496793[_0x8a20('0x43')][_0x8a20('0x25')][_0x8a20('0x55')]()),_0x258bd4);return respondWithRpcPromise('Reload','update',{'module':_0x8a20('0x56')});}})[_0x8a20('0xa')](function(_0x422891){if(_0x422891){return _0x30d6a0;}return null;})[_0x8a20('0xa')](respondWithResult(_0x3dc728,null))[_0x8a20('0x15')](handleError(_0x3dc728,null));};exports['destroy']=function(_0x3bc901,_0x386924){var _0x35d3b6;return db[_0x8a20('0x39')][_0x8a20('0x41')]({'where':{'id':_0x3bc901[_0x8a20('0x3f')]['id']}})['then'](function(_0x252966){_0x35d3b6=_0x252966;return _0x252966;})[_0x8a20('0xa')](handleEntityNotFound(_0x386924,null))[_0x8a20('0xa')](removeEntity(_0x386924,null))[_0x8a20('0xa')](function(){if(_0x35d3b6){return db['Network'][_0x8a20('0x3c')]({'where':{'type':_0x35d3b6[_0x8a20('0x25')]},'raw':!![]});}})[_0x8a20('0xa')](function(_0x1a37fb){if(_0x35d3b6[_0x8a20('0x25')]['toUpperCase']()==_0x8a20('0x54')){var _0x21e183=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config[_0x8a20('0x47')],_0x8a20('0x48')),'utf8');var _0x1c4fb1=ejs[_0x8a20('0x49')](_0x21e183,{'networks':_0x1a37fb||[]});fs[_0x8a20('0x4a')](_0x8a20('0x4b'),_0x1c4fb1);return respondWithRpcPromise(_0x8a20('0x4c'),_0x8a20('0x1e'),{'module':_0x8a20('0x4d')});}else if(_0x35d3b6['type'][_0x8a20('0x44')]()==_0x8a20('0x4e')){var _0x40e1fa=fs['readFileSync'](path[_0x8a20('0x46')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8a20('0x50'));var _0x4f24c2=ejs[_0x8a20('0x49')](_0x40e1fa,{'networks':_0x1a37fb||[]});fs['writeFileSync'](_0x8a20('0x51'),_0x4f24c2);return respondWithRpcPromise('Reload',_0x8a20('0x1e'),{'module':_0x8a20('0x4d')});}else{var _0x19a1e5=fs[_0x8a20('0x45')](path[_0x8a20('0x46')](config['root'],_0x8a20('0x52')),_0x8a20('0x50'));var _0x40314c=ejs[_0x8a20('0x49')](_0x19a1e5,{'networks':_0x1a37fb||[]});fs[_0x8a20('0x4a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x35d3b6[_0x8a20('0x25')][_0x8a20('0x55')]()),_0x40314c);return respondWithRpcPromise('Reload',_0x8a20('0x1e'),{'module':_0x8a20('0x56')});}})['catch'](handleError(_0x386924,null));}; \ No newline at end of file +var _0xc385=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','path','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','code','error','message','info','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','update','end','stack','name','send','map','Network'];(function(_0x27b77c,_0xb252b4){var _0x2b89e3=function(_0x16c14e){while(--_0x16c14e){_0x27b77c['push'](_0x27b77c['shift']());}};_0x2b89e3(++_0xb252b4);}(_0xc385,0xd7));var _0x5c38=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc385[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require('util');var path=require(_0x5c38('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x5c38('0x1'));var logger=require(_0x5c38('0x2'))(_0x5c38('0x3'));var config=require('../../config/environment');var db=require(_0x5c38('0x4'))['db'];var jayson=require(_0x5c38('0x5'));var client=jayson[_0x5c38('0x6')][_0x5c38('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43c386,_0x583897,_0x122bb,_0x1f4cc6){return new Promise(function(_0x40b514,_0x16c8d7){var _0x50255f=_0x1f4cc6||client;return _0x50255f[_0x5c38('0x8')](_0x43c386,_0x122bb)[_0x5c38('0x9')](function(_0x2f6652){logger['info'](_0x5c38('0xa'),_0x583897,'request\x20sent');logger[_0x5c38('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x583897,_0x5c38('0xc'),JSON['stringify'](_0x2f6652));if(_0x2f6652['error']){if(_0x2f6652['error'][_0x5c38('0xd')]===0x1f4){logger[_0x5c38('0xe')](_0x5c38('0xa'),_0x583897,_0x2f6652[_0x5c38('0xe')][_0x5c38('0xf')]);return _0x16c8d7(_0x2f6652[_0x5c38('0xe')][_0x5c38('0xf')]);}logger[_0x5c38('0xe')](_0x5c38('0xa'),_0x583897,_0x2f6652[_0x5c38('0xe')]['message']);return _0x40b514(_0x2f6652['error']['message']);}else{logger[_0x5c38('0x10')](_0x5c38('0xa'),_0x583897,_0x5c38('0xc'));_0x40b514(_0x2f6652[_0x5c38('0x11')][_0x5c38('0xf')]);}})[_0x5c38('0x12')](function(_0x1a9875){logger[_0x5c38('0xe')](_0x5c38('0xa'),_0x583897,_0x1a9875);_0x16c8d7(_0x1a9875);});});}function respondWithResult(_0x1e5ba1,_0x21a471){_0x21a471=_0x21a471||0xc8;return function(_0x2b7150){if(_0x2b7150){return _0x1e5ba1['status'](_0x21a471)[_0x5c38('0x13')](_0x2b7150);}};}function respondWithFilteredResult(_0x455f05,_0x1c4ff7){return function(_0x153bb9){if(_0x153bb9){var _0x34ab23=typeof _0x1c4ff7[_0x5c38('0x14')]===_0x5c38('0x15')&&typeof _0x1c4ff7['limit']===_0x5c38('0x15');var _0x4bbde0=_0x153bb9[_0x5c38('0x16')];var _0x1893b9=_0x34ab23?0x0:_0x1c4ff7[_0x5c38('0x14')];var _0x130ffb=_0x34ab23?_0x153bb9[_0x5c38('0x16')]:_0x1c4ff7['offset']+_0x1c4ff7[_0x5c38('0x17')];var _0x42265b;if(_0x130ffb>=_0x4bbde0){_0x130ffb=_0x4bbde0;_0x42265b=0xc8;}else{_0x42265b=0xce;}_0x455f05[_0x5c38('0x18')](_0x42265b);return _0x455f05[_0x5c38('0x19')](_0x5c38('0x1a'),_0x1893b9+'-'+_0x130ffb+'/'+_0x4bbde0)[_0x5c38('0x13')](_0x153bb9);}return null;};}function saveUpdates(_0x4394a1){return function(_0x36b5a6){if(_0x36b5a6){return _0x36b5a6[_0x5c38('0x1b')](_0x4394a1)[_0x5c38('0x9')](function(_0x5a5088){return _0x5a5088;});}return null;};}function removeEntity(_0x17db96){return function(_0x3fe536){if(_0x3fe536){return _0x3fe536['destroy']()['then'](function(){_0x17db96['status'](0xcc)[_0x5c38('0x1c')]();});}};}function handleEntityNotFound(_0x8c06eb){return function(_0x2fd3e6){if(!_0x2fd3e6){_0x8c06eb['sendStatus'](0x194);}return _0x2fd3e6;};}function handleError(_0x20e270,_0x343348){_0x343348=_0x343348||0x1f4;return function(_0x13397a){logger['error'](_0x13397a[_0x5c38('0x1d')]);if(_0x13397a['name']){delete _0x13397a[_0x5c38('0x1e')];}_0x20e270[_0x5c38('0x18')](_0x343348)[_0x5c38('0x1f')](_0x13397a);};}exports['index']=function(_0x54aaa0,_0x348cd0){var _0x30fef5={},_0x3621ba={},_0x1e70ad={'count':0x0,'rows':[]};var _0x3fa95d=_[_0x5c38('0x20')](db[_0x5c38('0x21')][_0x5c38('0x22')],function(_0x426384){return{'name':_0x426384[_0x5c38('0x23')],'type':_0x426384[_0x5c38('0x24')][_0x5c38('0x25')]};});_0x3621ba[_0x5c38('0x26')]=_[_0x5c38('0x20')](_0x3fa95d,_0x5c38('0x1e'));_0x3621ba['query']=_[_0x5c38('0x27')](_0x54aaa0[_0x5c38('0x28')]);_0x3621ba['filters']=_[_0x5c38('0x29')](_0x3621ba['model'],_0x3621ba[_0x5c38('0x28')]);_0x30fef5[_0x5c38('0x2a')]=_['intersection'](_0x3621ba[_0x5c38('0x26')],qs[_0x5c38('0x2b')](_0x54aaa0[_0x5c38('0x28')][_0x5c38('0x2b')]));_0x30fef5[_0x5c38('0x2a')]=_0x30fef5['attributes']['length']?_0x30fef5[_0x5c38('0x2a')]:_0x3621ba['model'];if(!_0x54aaa0[_0x5c38('0x28')]['hasOwnProperty'](_0x5c38('0x2c'))){_0x30fef5[_0x5c38('0x17')]=qs[_0x5c38('0x17')](_0x54aaa0['query'][_0x5c38('0x17')]);_0x30fef5['offset']=qs[_0x5c38('0x14')](_0x54aaa0[_0x5c38('0x28')]['offset']);}_0x30fef5[_0x5c38('0x2d')]=qs[_0x5c38('0x2e')](_0x54aaa0['query'][_0x5c38('0x2e')]);_0x30fef5[_0x5c38('0x2f')]=qs[_0x5c38('0x30')](_[_0x5c38('0x31')](_0x54aaa0[_0x5c38('0x28')],_0x3621ba['filters']),_0x3fa95d);if(_0x54aaa0['query'][_0x5c38('0x32')]){_0x30fef5[_0x5c38('0x2f')]=_[_0x5c38('0x33')](_0x30fef5[_0x5c38('0x2f')],{'$or':_['map'](_0x3fa95d,function(_0x3ae0e1){if(_0x3ae0e1[_0x5c38('0x24')]!==_0x5c38('0x34')){var _0x5de3ba={};_0x5de3ba[_0x3ae0e1[_0x5c38('0x1e')]]={'$like':'%'+_0x54aaa0[_0x5c38('0x28')][_0x5c38('0x32')]+'%'};return _0x5de3ba;}})});}_0x30fef5=_[_0x5c38('0x33')]({},_0x30fef5,_0x54aaa0[_0x5c38('0x35')]);var _0x3e130c={'where':_0x30fef5['where']};return db[_0x5c38('0x21')][_0x5c38('0x16')](_0x3e130c)[_0x5c38('0x9')](function(_0x52be82){_0x1e70ad[_0x5c38('0x16')]=_0x52be82;if(_0x54aaa0[_0x5c38('0x28')][_0x5c38('0x36')]){_0x30fef5[_0x5c38('0x37')]=[{'all':!![]}];}return db[_0x5c38('0x21')][_0x5c38('0x38')](_0x30fef5);})[_0x5c38('0x9')](function(_0x22add3){_0x1e70ad[_0x5c38('0x39')]=_0x22add3;return _0x1e70ad;})[_0x5c38('0x9')](respondWithFilteredResult(_0x348cd0,_0x30fef5))['catch'](handleError(_0x348cd0,null));};exports['show']=function(_0x30ee1f,_0x553939){var _0x285582={'raw':!![],'where':{'id':_0x30ee1f[_0x5c38('0x3a')]['id']}},_0x32a9dc={};_0x32a9dc['model']=_[_0x5c38('0x27')](db['Network']['rawAttributes']);_0x32a9dc[_0x5c38('0x28')]=_['keys'](_0x30ee1f[_0x5c38('0x28')]);_0x32a9dc['filters']=_[_0x5c38('0x29')](_0x32a9dc['model'],_0x32a9dc['query']);_0x285582[_0x5c38('0x2a')]=_[_0x5c38('0x29')](_0x32a9dc['model'],qs[_0x5c38('0x2b')](_0x30ee1f[_0x5c38('0x28')][_0x5c38('0x2b')]));_0x285582[_0x5c38('0x2a')]=_0x285582[_0x5c38('0x2a')][_0x5c38('0x3b')]?_0x285582[_0x5c38('0x2a')]:_0x32a9dc[_0x5c38('0x26')];if(_0x30ee1f[_0x5c38('0x28')][_0x5c38('0x36')]){_0x285582[_0x5c38('0x37')]=[{'all':!![]}];}_0x285582=_[_0x5c38('0x33')]({},_0x285582,_0x30ee1f[_0x5c38('0x35')]);return db[_0x5c38('0x21')][_0x5c38('0x3c')](_0x285582)[_0x5c38('0x9')](handleEntityNotFound(_0x553939,null))['then'](respondWithResult(_0x553939,null))['catch'](handleError(_0x553939,null));};exports[_0x5c38('0x3d')]=function(_0x24739d,_0x1f9862){var _0x110a11;return db[_0x5c38('0x21')]['create'](_0x24739d[_0x5c38('0x3e')],{'raw':!![]})['then'](function(_0x3d9327){_0x110a11=_0x3d9327;return db[_0x5c38('0x21')]['findAll']({'where':{'type':_0x24739d[_0x5c38('0x3e')][_0x5c38('0x24')]},'raw':!![]});})['then'](function(_0x23a560){if(_0x110a11[_0x5c38('0x24')][_0x5c38('0x3f')]()==_0x5c38('0x40')){var _0x21164f=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],_0x5c38('0x44')),_0x5c38('0x45'));var _0x226efe=ejs[_0x5c38('0x46')](_0x21164f,{'networks':_0x23a560||[]});fs[_0x5c38('0x47')](_0x5c38('0x48'),_0x226efe);return respondWithRpcPromise(_0x5c38('0x49'),_0x5c38('0x3d'),{'module':_0x5c38('0x4a')});}else if(_0x110a11['type'][_0x5c38('0x3f')]()==_0x5c38('0x4b')){var _0x86fee6=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],'server/files/templates/turn_multiple.ejs'),_0x5c38('0x45'));var _0x31c36b=ejs[_0x5c38('0x46')](_0x86fee6,{'networks':_0x23a560||[]});fs[_0x5c38('0x47')](_0x5c38('0x4c'),_0x31c36b);return respondWithRpcPromise(_0x5c38('0x49'),_0x5c38('0x3d'),{'module':'res_stun_monitor.so'});}else{var _0x5ab8b6=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],_0x5c38('0x4d')),_0x5c38('0x45'));var _0x362ee3=ejs[_0x5c38('0x46')](_0x5ab8b6,{'networks':_0x23a560||[]});fs[_0x5c38('0x47')](util[_0x5c38('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x24739d[_0x5c38('0x3e')]['type'][_0x5c38('0x4f')]()),_0x362ee3);return respondWithRpcPromise('Reload',_0x5c38('0x3d'),{'module':'chan_sip.so'});}})['then'](function(){return _0x110a11;})[_0x5c38('0x9')](respondWithResult(_0x1f9862,0xc9))[_0x5c38('0x12')](handleError(_0x1f9862,null));};exports[_0x5c38('0x1b')]=function(_0x265e49,_0x49c7bf){var _0x1d61b4;return db[_0x5c38('0x21')][_0x5c38('0x3c')]({'where':{'id':_0x265e49[_0x5c38('0x3a')]['id']}})[_0x5c38('0x9')](handleEntityNotFound(_0x49c7bf,null))[_0x5c38('0x9')](saveUpdates(_0x265e49['body'],null))[_0x5c38('0x9')](function(_0x3dd345){if(_0x3dd345){_0x1d61b4=_0x3dd345;return db[_0x5c38('0x21')][_0x5c38('0x38')]({'where':{'type':_0x1d61b4[_0x5c38('0x24')]},'raw':!![]});}return null;})[_0x5c38('0x9')](function(_0x55c129){if(_0x1d61b4['type'][_0x5c38('0x3f')]()==_0x5c38('0x40')){var _0x45317c=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],_0x5c38('0x44')),_0x5c38('0x45'));var _0x14a4af=ejs[_0x5c38('0x46')](_0x45317c,{'networks':_0x55c129||[]});fs[_0x5c38('0x47')](_0x5c38('0x48'),_0x14a4af);return respondWithRpcPromise(_0x5c38('0x49'),'update',{'module':'res_stun_monitor.so'});}else if(_0x1d61b4[_0x5c38('0x24')]['toUpperCase']()=='TURN'){var _0x445bad=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1ad077=ejs[_0x5c38('0x46')](_0x445bad,{'networks':_0x55c129||[]});fs[_0x5c38('0x47')](_0x5c38('0x4c'),_0x1ad077);return respondWithRpcPromise(_0x5c38('0x49'),_0x5c38('0x1b'),{'module':_0x5c38('0x4a')});}else{var _0x490181=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],'server/files/templates/network.ejs'),_0x5c38('0x45'));var _0x562df7=ejs[_0x5c38('0x46')](_0x490181,{'networks':_0x55c129||[]});fs[_0x5c38('0x47')](util['format'](_0x5c38('0x50'),_0x265e49[_0x5c38('0x3e')][_0x5c38('0x24')][_0x5c38('0x4f')]()),_0x562df7);return respondWithRpcPromise('Reload',_0x5c38('0x1b'),{'module':_0x5c38('0x51')});}})[_0x5c38('0x9')](function(_0x504d64){if(_0x504d64){return _0x1d61b4;}return null;})[_0x5c38('0x9')](respondWithResult(_0x49c7bf,null))['catch'](handleError(_0x49c7bf,null));};exports[_0x5c38('0x52')]=function(_0x2b7448,_0x3c0006){var _0x4b232e;return db[_0x5c38('0x21')][_0x5c38('0x3c')]({'where':{'id':_0x2b7448[_0x5c38('0x3a')]['id']}})['then'](function(_0x2f7d1b){_0x4b232e=_0x2f7d1b;return _0x2f7d1b;})[_0x5c38('0x9')](handleEntityNotFound(_0x3c0006,null))['then'](removeEntity(_0x3c0006,null))['then'](function(){if(_0x4b232e){return db[_0x5c38('0x21')][_0x5c38('0x38')]({'where':{'type':_0x4b232e[_0x5c38('0x24')]},'raw':!![]});}})['then'](function(_0x31367e){if(_0x4b232e[_0x5c38('0x24')][_0x5c38('0x3f')]()==_0x5c38('0x40')){var _0x2a1e0a=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],_0x5c38('0x44')),_0x5c38('0x45'));var _0x45a551=ejs[_0x5c38('0x46')](_0x2a1e0a,{'networks':_0x31367e||[]});fs[_0x5c38('0x47')](_0x5c38('0x48'),_0x45a551);return respondWithRpcPromise('Reload',_0x5c38('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x4b232e[_0x5c38('0x24')][_0x5c38('0x3f')]()==_0x5c38('0x4b')){var _0x3081e1=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],'server/files/templates/turn_multiple.ejs'),_0x5c38('0x45'));var _0xeb21ac=ejs['render'](_0x3081e1,{'networks':_0x31367e||[]});fs[_0x5c38('0x47')]('/etc/asterisk/turn_xcally.conf',_0xeb21ac);return respondWithRpcPromise(_0x5c38('0x49'),_0x5c38('0x52'),{'module':_0x5c38('0x4a')});}else{var _0x5b03a4=fs[_0x5c38('0x41')](path[_0x5c38('0x42')](config[_0x5c38('0x43')],_0x5c38('0x4d')),'utf8');var _0x192242=ejs[_0x5c38('0x46')](_0x5b03a4,{'networks':_0x31367e||[]});fs[_0x5c38('0x47')](util[_0x5c38('0x4e')](_0x5c38('0x50'),_0x4b232e['type'][_0x5c38('0x4f')]()),_0x192242);return respondWithRpcPromise(_0x5c38('0x49'),'destroy',{'module':_0x5c38('0x51')});}})[_0x5c38('0x12')](handleError(_0x3c0006,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fc40d75..f271f0e 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 _0x5ff3=['network','util','api','bluebird','request-promise','path','rimraf','./network.attributes','exports','define'];(function(_0xb785b8,_0x78ae16){var _0x19626f=function(_0x3ca322){while(--_0x3ca322){_0xb785b8['push'](_0xb785b8['shift']());}};_0x19626f(++_0x78ae16);}(_0x5ff3,0x17d));var _0x35ff=function(_0x297900,_0x4a2683){_0x297900=_0x297900-0x0;var _0x3b88b3=_0x5ff3[_0x297900];return _0x3b88b3;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('Network',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x34e42f,_0x587df6){var _0x2651c9=function(_0x46a01a){while(--_0x46a01a){_0x34e42f['push'](_0x34e42f['shift']());}};_0x2651c9(++_0x587df6);}(_0x99e9,0xb4));var _0x999e=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x99e9[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'network','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 dfe753e..446618c 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x4f661b,_0x4b32da){_0x4f661b=_0x4f661b-0x0;var _0x545670=_0x7a54[_0x4f661b];return _0x545670;};'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 _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x42a671,_0x17b2b3){_0x42a671=_0x42a671-0x0;var _0xfeb08a=_0x7a54[_0x42a671];return _0xfeb08a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index bf343ed..629a83a 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 _0x7d25=['connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','create','post','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path'];(function(_0x11d488,_0xeca1c0){var _0x13a366=function(_0x145f1c){while(--_0x145f1c){_0x11d488['push'](_0x11d488['shift']());}};_0x13a366(++_0xeca1c0);}(_0x7d25,0x8a));var _0x57d2=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x7d25[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require('multer');var util=require(_0x57d2('0x0'));var path=require(_0x57d2('0x1'));var timeout=require(_0x57d2('0x2'));var express=require(_0x57d2('0x3'));var router=express[_0x57d2('0x4')]();var fs_extra=require(_0x57d2('0x5'));var auth=require(_0x57d2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x57d2('0x7')](),controller['index']);router[_0x57d2('0x8')](_0x57d2('0x9'),auth[_0x57d2('0x7')](),controller['describe']);router['get'](_0x57d2('0xa'),auth['isAuthenticated'](),controller[_0x57d2('0xb')]);router[_0x57d2('0x8')](_0x57d2('0xc'),auth['isAuthenticated'](),controller[_0x57d2('0xd')]);router[_0x57d2('0x8')](_0x57d2('0xe'),auth[_0x57d2('0x7')](),controller[_0x57d2('0xf')]);router[_0x57d2('0x8')](_0x57d2('0x10'),auth[_0x57d2('0x7')](),controller[_0x57d2('0x11')]);router[_0x57d2('0x8')](_0x57d2('0x12'),auth[_0x57d2('0x7')](),controller[_0x57d2('0x13')]);router[_0x57d2('0x8')](_0x57d2('0x14'),auth[_0x57d2('0x7')](),controller['getAgents']);router['post']('/',auth[_0x57d2('0x7')](),controller[_0x57d2('0x15')]);router['post'](_0x57d2('0xc'),auth[_0x57d2('0x7')](),controller['addDisposition']);router[_0x57d2('0x16')]('/:id/canned_answers',auth[_0x57d2('0x7')](),controller['addAnswer']);router[_0x57d2('0x16')](_0x57d2('0x17'),controller[_0x57d2('0x18')]);router['post']('/:id/applications',auth[_0x57d2('0x7')](),controller[_0x57d2('0x19')]);router[_0x57d2('0x16')](_0x57d2('0x14'),auth['isAuthenticated'](),controller[_0x57d2('0x1a')]);router[_0x57d2('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0x57d2('0x1b')]);router[_0x57d2('0x1c')](_0x57d2('0xa'),auth[_0x57d2('0x7')](),controller[_0x57d2('0x1d')]);router[_0x57d2('0x1e')](_0x57d2('0xa'),auth[_0x57d2('0x7')](),controller[_0x57d2('0x1f')]);router[_0x57d2('0x1e')](_0x57d2('0xc'),auth[_0x57d2('0x7')](),controller[_0x57d2('0x20')]);router[_0x57d2('0x1e')]('/:id/canned_answers',auth[_0x57d2('0x7')](),controller[_0x57d2('0x21')]);router[_0x57d2('0x1e')](_0x57d2('0x14'),auth[_0x57d2('0x7')](),controller['removeAgents']);module[_0x57d2('0x22')]=router; \ No newline at end of file +var _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','notify','/:id/applications','/:id/users','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xa456,0x142));var _0x6a45=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xa456[_0x307d86];return _0x361745;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x6a45('0x9')](_0x6a45('0x10'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')]('/',auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6a45('0xa')](),controller[_0x6a45('0x15')]);router[_0x6a45('0x13')]('/:id/notify',controller[_0x6a45('0x16')]);router[_0x6a45('0x13')](_0x6a45('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x6a45('0x18'),auth[_0x6a45('0xa')](),controller['addAgents']);router[_0x6a45('0x13')](_0x6a45('0x19'),auth['isAuthenticated'](),controller[_0x6a45('0x1a')]);router[_0x6a45('0x1b')](_0x6a45('0x1c'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x1d')]);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x1e')]);router[_0x6a45('0x1f')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x20')]);router[_0x6a45('0x1f')](_0x6a45('0x21'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x22')]);router[_0x6a45('0x1f')](_0x6a45('0x18'),auth['isAuthenticated'](),controller[_0x6a45('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a4dde33..771a38a 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 _0xab6e=['name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0x5dc4b3,_0x618af){var _0x4c56e2=function(_0x28f0d3){while(--_0x28f0d3){_0x5dc4b3['push'](_0x5dc4b3['shift']());}};_0x4c56e2(++_0x618af);}(_0xab6e,0x189));var _0xeab6=function(_0xe59cff,_0x1a7dbe){_0xe59cff=_0xe59cff-0x0;var _0x26e8c1=_0xab6e[_0xe59cff];return _0x26e8c1;};'use strict';var Sequelize=require(_0xeab6('0x0'));var rs=require(_0xeab6('0x1'));module['exports']={'name':{'type':Sequelize[_0xeab6('0x2')],'unique':_0xeab6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xeab6('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xeab6('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xeab6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xeab6('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xeab6('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeab6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xeab6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xeab6('0x2')]},'queueTransfer':{'type':Sequelize[_0xeab6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeab6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeab6('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeab6('0x6')],'defaultValue':![],'comment':_0xeab6('0x8'),'set':function(_0xee1e8d){if(!_0xee1e8d)this[_0xeab6('0x9')](_0xeab6('0xa'),null);this[_0xeab6('0x9')](_0xeab6('0xb'),_0xee1e8d);}}}; \ No newline at end of file +var _0x378a=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','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','setDataValue'];(function(_0x26f270,_0x17d5a4){var _0xe1fc28=function(_0x4afbf8){while(--_0x4afbf8){_0x26f270['push'](_0x26f270['shift']());}};_0xe1fc28(++_0x17d5a4);}(_0x378a,0x1e3));var _0xa378=function(_0x3294ef,_0x5b1994){_0x3294ef=_0x3294ef-0x0;var _0x326cbd=_0x378a[_0x3294ef];return _0x326cbd;};'use strict';var Sequelize=require(_0xa378('0x0'));var rs=require(_0xa378('0x1'));module[_0xa378('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xa378('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa378('0x4')]},'token':{'type':Sequelize[_0xa378('0x4')],'defaultValue':function(){return rs[_0xa378('0x5')]();}},'replyUri':{'type':Sequelize[_0xa378('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa378('0x6');}},'notificationSound':{'type':Sequelize[_0xa378('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa378('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa378('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa378('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa378('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa378('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa378('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xa378('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20b93b){if(!_0x20b93b)this[_0xa378('0xa')](_0xa378('0xb'),null);this[_0xa378('0xa')](_0xa378('0xc'),_0x20b93b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ba04563..d2e45af 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 _0xa151=['attributes','length','hasOwnProperty','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','close','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','model','query','keys','filters','intersection','fields'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0xa151,0x13d));var _0x1a15=function(_0x565bc6,_0xf2a735){_0x565bc6=_0x565bc6-0x0;var _0x2dfd07=_0xa151[_0x565bc6];return _0x2dfd07;};'use strict';var emlformat=require(_0x1a15('0x0'));var rimraf=require(_0x1a15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a15('0x2'));var rp=require(_0x1a15('0x3'));var moment=require(_0x1a15('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a15('0x5'));var util=require(_0x1a15('0x6'));var path=require(_0x1a15('0x7'));var sox=require('sox');var csv=require(_0x1a15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a15('0x9'));var _=require(_0x1a15('0xa'));var squel=require(_0x1a15('0xb'));var crypto=require(_0x1a15('0xc'));var jsforce=require(_0x1a15('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1a15('0x8'));var querystring=require(_0x1a15('0xe'));var Papa=require(_0x1a15('0xf'));var Redis=require('ioredis');var authService=require(_0x1a15('0x10'));var qs=require(_0x1a15('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a15('0x12'));var logger=require(_0x1a15('0x13'))('api');var utils=require(_0x1a15('0x14'));var config=require(_0x1a15('0x15'));var licenseUtil=require(_0x1a15('0x16'));var db=require(_0x1a15('0x17'))['db'];config['redis']=_[_0x1a15('0x18')](config[_0x1a15('0x19')],{'host':_0x1a15('0x1a'),'port':0x18eb});var socket=require(_0x1a15('0x1b'))(new Redis(config[_0x1a15('0x19')]));require('./openchannelAccount.socket')[_0x1a15('0x1c')](socket);var jayson=require(_0x1a15('0x1d'));var client=jayson[_0x1a15('0x1e')][_0x1a15('0x1f')]({'port':0x232c});var client9002=jayson[_0x1a15('0x1e')][_0x1a15('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3cebb9,_0x373451,_0x424823,_0x2891b2){return new BPromise(function(_0x12c5c3,_0x4bd5b3){var _0x2add26=_0x2891b2||client;return _0x2add26['request'](_0x3cebb9,_0x424823)[_0x1a15('0x20')](function(_0x1cfaef){logger[_0x1a15('0x21')](_0x1a15('0x22'),_0x373451,_0x1a15('0x23'));logger[_0x1a15('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x373451,'request\x20sent',JSON['stringify'](_0x1cfaef));if(_0x1cfaef[_0x1a15('0x25')]){if(_0x1cfaef[_0x1a15('0x25')]['code']===0x1f4){logger[_0x1a15('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x373451,_0x1cfaef[_0x1a15('0x25')][_0x1a15('0x26')]);return _0x4bd5b3(_0x1cfaef[_0x1a15('0x25')]['message']);}logger['error'](_0x1a15('0x22'),_0x373451,_0x1cfaef[_0x1a15('0x25')][_0x1a15('0x26')]);return _0x12c5c3(_0x1cfaef[_0x1a15('0x25')][_0x1a15('0x26')]);}else{logger[_0x1a15('0x21')](_0x1a15('0x22'),_0x373451,_0x1a15('0x23'));_0x12c5c3(_0x1cfaef[_0x1a15('0x27')][_0x1a15('0x26')]);}})['catch'](function(_0x25e673){logger[_0x1a15('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x373451,_0x25e673);_0x4bd5b3(_0x25e673);});});}function respondWithStatusCode(_0x3734e9,_0x40d534){_0x40d534=_0x40d534||0xcc;return function(_0x51433a){if(_0x51433a){return _0x3734e9[_0x1a15('0x28')](_0x40d534);}return _0x3734e9[_0x1a15('0x29')](_0x40d534)['end']();};}function respondWithResult(_0x2a789f,_0x305626){_0x305626=_0x305626||0xc8;return function(_0x166e7f){if(_0x166e7f){return _0x2a789f[_0x1a15('0x29')](_0x305626)['json'](_0x166e7f);}};}function respondWithFilteredResult(_0x353ea5,_0x1acaaa){return function(_0x5d2244){if(_0x5d2244){var _0x51583b=typeof _0x1acaaa['offset']===_0x1a15('0x2a')&&typeof _0x1acaaa[_0x1a15('0x2b')]===_0x1a15('0x2a');var _0x265411=_0x5d2244[_0x1a15('0x2c')];var _0x4a8d3e=_0x51583b?0x0:_0x1acaaa['offset'];var _0x22945f=_0x51583b?_0x5d2244['count']:_0x1acaaa[_0x1a15('0x2d')]+_0x1acaaa[_0x1a15('0x2b')];var _0x487ad3;if(_0x22945f>=_0x265411){_0x22945f=_0x265411;_0x487ad3=0xc8;}else{_0x487ad3=0xce;}_0x353ea5[_0x1a15('0x29')](_0x487ad3);return _0x353ea5[_0x1a15('0x2e')]('Content-Range',_0x4a8d3e+'-'+_0x22945f+'/'+_0x265411)[_0x1a15('0x2f')](_0x5d2244);}return null;};}function patchUpdates(_0xff6a11){return function(_0x15bed9){try{jsonpatch[_0x1a15('0x30')](_0x15bed9,_0xff6a11,!![]);}catch(_0x2c4766){return BPromise[_0x1a15('0x31')](_0x2c4766);}return _0x15bed9[_0x1a15('0x32')]();};}function saveUpdates(_0xe9831e,_0x3a6f90){return function(_0x104e9c){if(_0x104e9c){return _0x104e9c[_0x1a15('0x33')](_0xe9831e)[_0x1a15('0x20')](function(_0x16a2ee){return _0x16a2ee;});}return null;};}function removeEntity(_0x31c11d,_0xdd10a6){return function(_0x26f64b){if(_0x26f64b){return _0x26f64b[_0x1a15('0x34')]()[_0x1a15('0x20')](function(){var _0x53239e=_0x26f64b[_0x1a15('0x35')]({'plain':!![]});var _0x4497fa='OpenchannelAccounts';return db[_0x1a15('0x36')][_0x1a15('0x34')]({'where':{'type':_0x4497fa,'resourceId':_0x53239e['id']}})['then'](function(){return _0x26f64b;});})[_0x1a15('0x20')](function(){_0x31c11d[_0x1a15('0x29')](0xcc)[_0x1a15('0x37')]();});}};}function handleEntityNotFound(_0x408cfb,_0x2cad43){return function(_0x3d8f34){if(!_0x3d8f34){_0x408cfb[_0x1a15('0x28')](0x194);}return _0x3d8f34;};}function handleError(_0x9f2a71,_0x41a75c){_0x41a75c=_0x41a75c||0x1f4;return function(_0x13d68f){logger[_0x1a15('0x25')](_0x13d68f[_0x1a15('0x38')]);if(_0x13d68f[_0x1a15('0x39')]){delete _0x13d68f[_0x1a15('0x39')];}_0x9f2a71[_0x1a15('0x29')](_0x41a75c)[_0x1a15('0x3a')](_0x13d68f);};}exports[_0x1a15('0x3b')]=function(_0x52707a,_0x1612c2){var _0x26fe11={'include':[{'model':db[_0x1a15('0x3c')],'as':_0x1a15('0x3d')}]},_0x58d150={},_0x4030ed={'count':0x0,'rows':[]};var _0x400510=_[_0x1a15('0x3e')](db[_0x1a15('0x3f')]['rawAttributes'],function(_0x894a48){return{'name':_0x894a48[_0x1a15('0x40')],'type':_0x894a48['type']['key']};});_0x58d150[_0x1a15('0x41')]=_[_0x1a15('0x3e')](_0x400510,_0x1a15('0x39'));_0x58d150[_0x1a15('0x42')]=_[_0x1a15('0x43')](_0x52707a['query']);_0x58d150[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x58d150['model'],_0x58d150[_0x1a15('0x42')]);_0x26fe11['attributes']=_['intersection'](_0x58d150[_0x1a15('0x41')],qs[_0x1a15('0x46')](_0x52707a['query'][_0x1a15('0x46')]));_0x26fe11[_0x1a15('0x47')]=_0x26fe11[_0x1a15('0x47')][_0x1a15('0x48')]?_0x26fe11[_0x1a15('0x47')]:_0x58d150[_0x1a15('0x41')];if(!_0x52707a[_0x1a15('0x42')][_0x1a15('0x49')]('nolimit')){_0x26fe11[_0x1a15('0x2b')]=qs[_0x1a15('0x2b')](_0x52707a[_0x1a15('0x42')]['limit']);_0x26fe11[_0x1a15('0x2d')]=qs[_0x1a15('0x2d')](_0x52707a[_0x1a15('0x42')][_0x1a15('0x2d')]);}_0x26fe11['order']=qs[_0x1a15('0x4a')](_0x52707a[_0x1a15('0x42')][_0x1a15('0x4a')]);_0x26fe11['where']=qs[_0x1a15('0x44')](_['pick'](_0x52707a[_0x1a15('0x42')],_0x58d150[_0x1a15('0x44')]),_0x400510);if(_0x52707a[_0x1a15('0x42')][_0x1a15('0x4b')]){_0x26fe11[_0x1a15('0x4c')]=_[_0x1a15('0x4d')](_0x26fe11['where'],{'$or':_['map'](_0x400510,function(_0x29b37f){if(_0x29b37f[_0x1a15('0x4e')]!==_0x1a15('0x4f')){var _0x5e43ba={};_0x5e43ba[_0x29b37f['name']]={'$like':'%'+_0x52707a[_0x1a15('0x42')][_0x1a15('0x4b')]+'%'};return _0x5e43ba;}})});}_0x26fe11=_[_0x1a15('0x4d')]({},_0x26fe11,_0x52707a['options']);var _0x2e7634={'where':_0x26fe11[_0x1a15('0x4c')]};return db[_0x1a15('0x3f')]['count'](_0x2e7634)[_0x1a15('0x20')](function(_0xf2b73a){_0x4030ed[_0x1a15('0x2c')]=_0xf2b73a;if(_0x52707a[_0x1a15('0x42')][_0x1a15('0x50')]){_0x26fe11[_0x1a15('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1a15('0x52')](_0x26fe11);})[_0x1a15('0x20')](function(_0x4fe5f1){_0x4030ed[_0x1a15('0x53')]=_0x4fe5f1;return _0x4030ed;})[_0x1a15('0x20')](respondWithFilteredResult(_0x1612c2,_0x26fe11))['catch'](handleError(_0x1612c2,null));};exports[_0x1a15('0x54')]=function(_0x1b2ce2,_0x2db3c1){var _0x26f205={'raw':![],'where':{'id':_0x1b2ce2[_0x1a15('0x55')]['id']},'include':[{'model':db[_0x1a15('0x3c')],'as':'mandatoryDispositionPause'}]},_0x1788fb={};_0x1788fb[_0x1a15('0x41')]=_[_0x1a15('0x43')](db[_0x1a15('0x3f')][_0x1a15('0x56')]);_0x1788fb['query']=_[_0x1a15('0x43')](_0x1b2ce2[_0x1a15('0x42')]);_0x1788fb[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x1788fb[_0x1a15('0x41')],_0x1788fb[_0x1a15('0x42')]);_0x26f205['attributes']=_['intersection'](_0x1788fb['model'],qs[_0x1a15('0x46')](_0x1b2ce2[_0x1a15('0x42')]['fields']));_0x26f205[_0x1a15('0x47')]=_0x26f205[_0x1a15('0x47')][_0x1a15('0x48')]?_0x26f205[_0x1a15('0x47')]:_0x1788fb[_0x1a15('0x41')];if(_0x1b2ce2[_0x1a15('0x42')][_0x1a15('0x50')]){_0x26f205[_0x1a15('0x51')]=[{'all':!![]}];}_0x26f205=_[_0x1a15('0x4d')]({},_0x26f205,_0x1b2ce2[_0x1a15('0x57')]);return db[_0x1a15('0x3f')][_0x1a15('0x58')](_0x26f205)[_0x1a15('0x20')](handleEntityNotFound(_0x2db3c1,null))[_0x1a15('0x20')](respondWithResult(_0x2db3c1,null))['catch'](handleError(_0x2db3c1,null));};exports[_0x1a15('0x59')]=function(_0xe8a772,_0x1fdfc7){return db['OpenchannelAccount'][_0x1a15('0x59')](_0xe8a772[_0x1a15('0x5a')],{})[_0x1a15('0x20')](function(_0x230c8a){var _0x201b21=_0xe8a772[_0x1a15('0x5b')][_0x1a15('0x35')]({'plain':!![]});if(!_0x201b21)throw new Error(_0x1a15('0x5c'));if(_0x201b21[_0x1a15('0x5d')]===_0x1a15('0x5b')){var _0x3e9c80=_0x230c8a['get']({'plain':!![]});var _0x316176=_0x1a15('0x5e');return db[_0x1a15('0x5f')][_0x1a15('0x58')]({'where':{'name':_0x316176,'userProfileId':_0x201b21[_0x1a15('0x60')]},'raw':!![]})[_0x1a15('0x20')](function(_0x2d3a82){if(_0x2d3a82&&_0x2d3a82[_0x1a15('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e9c80[_0x1a15('0x39')],'resourceId':_0x3e9c80['id'],'type':_0x2d3a82['name'],'sectionId':_0x2d3a82['id']},{})[_0x1a15('0x20')](function(){return _0x230c8a;});}else{return _0x230c8a;}})[_0x1a15('0x62')](function(_0x91b7fe){logger['error'](_0x1a15('0x63'),_0x91b7fe);throw _0x91b7fe;});}return _0x230c8a;})[_0x1a15('0x20')](respondWithResult(_0x1fdfc7,0xc9))[_0x1a15('0x62')](handleError(_0x1fdfc7,null));};exports['update']=function(_0x442b3d,_0x3be508){if(_0x442b3d[_0x1a15('0x5a')]['id']){delete _0x442b3d['body']['id'];}return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x442b3d[_0x1a15('0x55')]['id']},'include':[{'model':db[_0x1a15('0x3c')],'as':_0x1a15('0x3d')}]})['then'](handleEntityNotFound(_0x3be508,null))['then'](saveUpdates(_0x442b3d[_0x1a15('0x5a')],null))[_0x1a15('0x20')](respondWithResult(_0x3be508,null))[_0x1a15('0x62')](handleError(_0x3be508,null));};exports['destroy']=function(_0x32faca,_0x2bda5f){return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x32faca[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x2bda5f,null))[_0x1a15('0x20')](removeEntity(_0x2bda5f,null))['catch'](handleError(_0x2bda5f,null));};exports[_0x1a15('0x64')]=function(_0x51c980,_0x2e8589){return db[_0x1a15('0x3f')][_0x1a15('0x64')]()['then'](respondWithResult(_0x2e8589,null))[_0x1a15('0x62')](handleError(_0x2e8589,null));};exports[_0x1a15('0x65')]=function(_0x3f82e3,_0x1188e0,_0xae1d5f){if(_0x3f82e3[_0x1a15('0x5a')]['id']){delete _0x3f82e3[_0x1a15('0x5a')]['id'];}return db['OpenchannelAccount'][_0x1a15('0x58')]({'where':{'id':_0x3f82e3[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x1188e0,null))['then'](function(_0x3ea8dc){if(_0x3ea8dc){_0x3f82e3[_0x1a15('0x5a')][_0x1a15('0x66')]=_0x3ea8dc['id'];return db[_0x1a15('0x67')][_0x1a15('0x59')](_0x3f82e3[_0x1a15('0x5a')]);}})[_0x1a15('0x20')](respondWithResult(_0x1188e0,null))['catch'](handleError(_0x1188e0,null));};exports[_0x1a15('0x68')]=function(_0x33af94,_0x12b799,_0x32b93d){var _0x119a3b={'raw':![],'where':{}};var _0x507aba={};var _0x5ece2b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x33af94[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x12b799,null))['then'](function(_0x1bdd02){if(_0x1bdd02){_0x507aba[_0x1a15('0x41')]=_[_0x1a15('0x43')](db['Disposition']['rawAttributes']);_0x507aba[_0x1a15('0x42')]=_[_0x1a15('0x43')](_0x33af94['query']);_0x507aba['filters']=_[_0x1a15('0x45')](_0x507aba['model'],_0x507aba[_0x1a15('0x42')]);_0x119a3b[_0x1a15('0x47')]=_[_0x1a15('0x45')](_0x507aba['model'],qs[_0x1a15('0x46')](_0x33af94[_0x1a15('0x42')][_0x1a15('0x46')]));_0x119a3b[_0x1a15('0x47')]=_0x119a3b[_0x1a15('0x47')][_0x1a15('0x48')]?_0x119a3b[_0x1a15('0x47')]:_0x507aba['model'];if(!_0x33af94[_0x1a15('0x42')][_0x1a15('0x49')](_0x1a15('0x69'))){_0x119a3b[_0x1a15('0x2b')]=qs[_0x1a15('0x2b')](_0x33af94[_0x1a15('0x42')][_0x1a15('0x2b')]);_0x119a3b[_0x1a15('0x2d')]=qs[_0x1a15('0x2d')](_0x33af94['query'][_0x1a15('0x2d')]);}_0x119a3b[_0x1a15('0x6a')]=qs[_0x1a15('0x4a')](_0x33af94[_0x1a15('0x42')][_0x1a15('0x4a')]);_0x119a3b[_0x1a15('0x4c')]=qs['filters'](_[_0x1a15('0x6b')](_0x33af94[_0x1a15('0x42')],_0x507aba[_0x1a15('0x44')]));_0x119a3b[_0x1a15('0x4c')]['OpenchannelAccountId']=_0x1bdd02['id'];if(_0x33af94[_0x1a15('0x42')][_0x1a15('0x4b')]){_0x119a3b[_0x1a15('0x4c')]=_[_0x1a15('0x4d')](_0x119a3b['where'],{'$or':_[_0x1a15('0x3e')](_0x119a3b[_0x1a15('0x47')],function(_0x3c2de2){var _0x48f892={};_0x48f892[_0x3c2de2]={'$like':'%'+_0x33af94[_0x1a15('0x42')][_0x1a15('0x4b')]+'%'};return _0x48f892;})});}_0x119a3b=_[_0x1a15('0x4d')]({},_0x119a3b,_0x33af94[_0x1a15('0x57')]);return db['Disposition']['count']({'where':_0x119a3b['where']})[_0x1a15('0x20')](function(_0x50eb0c){_0x5ece2b[_0x1a15('0x2c')]=_0x50eb0c;if(_0x33af94[_0x1a15('0x42')][_0x1a15('0x50')]){_0x119a3b[_0x1a15('0x51')]=[{'all':!![]}];}return db[_0x1a15('0x67')][_0x1a15('0x52')](_0x119a3b);})[_0x1a15('0x20')](function(_0x35193f){_0x5ece2b['rows']=_0x35193f;return _0x5ece2b;});}})['then'](respondWithFilteredResult(_0x12b799,_0x119a3b))['catch'](handleError(_0x12b799,null));};exports['removeDispositions']=function(_0x1e827e,_0x50466c,_0x3eb91d){return db[_0x1a15('0x3f')]['find']({'where':{'id':_0x1e827e[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x50466c,null))[_0x1a15('0x20')](function(_0x1c7737){if(_0x1c7737){return _0x1c7737[_0x1a15('0x6c')](_0x1e827e[_0x1a15('0x42')][_0x1a15('0x6d')]);}})[_0x1a15('0x20')](respondWithStatusCode(_0x50466c,null))[_0x1a15('0x62')](handleError(_0x50466c,null));};exports[_0x1a15('0x6e')]=function(_0x4daabc,_0x19434c,_0x41233d){if(_0x4daabc[_0x1a15('0x5a')]['id']){delete _0x4daabc[_0x1a15('0x5a')]['id'];}return db[_0x1a15('0x3f')]['find']({'where':{'id':_0x4daabc['params']['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x19434c,null))['then'](function(_0xa65aca){if(_0xa65aca){_0x4daabc['body'][_0x1a15('0x66')]=_0xa65aca['id'];return db[_0x1a15('0x6f')]['create'](_0x4daabc[_0x1a15('0x5a')]);}})[_0x1a15('0x20')](respondWithResult(_0x19434c,null))[_0x1a15('0x62')](handleError(_0x19434c,null));};exports['getAnswers']=function(_0x23276d,_0x180bc7,_0xf0ffc8){var _0x420886={'raw':![],'where':{}};var _0x58d173={};var _0x37472b={'count':0x0,'rows':[]};return db[_0x1a15('0x3f')]['findOne']({'where':{'id':_0x23276d['params']['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x180bc7,null))[_0x1a15('0x20')](function(_0x563515){if(_0x563515){_0x58d173['model']=_[_0x1a15('0x43')](db['CannedAnswer']['rawAttributes']);_0x58d173[_0x1a15('0x42')]=_[_0x1a15('0x43')](_0x23276d[_0x1a15('0x42')]);_0x58d173[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x58d173['model'],_0x58d173[_0x1a15('0x42')]);_0x420886[_0x1a15('0x47')]=_[_0x1a15('0x45')](_0x58d173[_0x1a15('0x41')],qs['fields'](_0x23276d[_0x1a15('0x42')][_0x1a15('0x46')]));_0x420886['attributes']=_0x420886[_0x1a15('0x47')][_0x1a15('0x48')]?_0x420886[_0x1a15('0x47')]:_0x58d173['model'];if(!_0x23276d[_0x1a15('0x42')][_0x1a15('0x49')](_0x1a15('0x69'))){_0x420886['limit']=qs[_0x1a15('0x2b')](_0x23276d['query'][_0x1a15('0x2b')]);_0x420886[_0x1a15('0x2d')]=qs[_0x1a15('0x2d')](_0x23276d[_0x1a15('0x42')]['offset']);}_0x420886['order']=qs[_0x1a15('0x4a')](_0x23276d[_0x1a15('0x42')][_0x1a15('0x4a')]);_0x420886['where']=qs[_0x1a15('0x44')](_['pick'](_0x23276d[_0x1a15('0x42')],_0x58d173[_0x1a15('0x44')]));_0x420886[_0x1a15('0x4c')][_0x1a15('0x66')]=_0x563515['id'];if(_0x23276d['query'][_0x1a15('0x4b')]){_0x420886[_0x1a15('0x4c')]=_[_0x1a15('0x4d')](_0x420886[_0x1a15('0x4c')],{'$or':_[_0x1a15('0x3e')](_0x420886[_0x1a15('0x47')],function(_0x1b5be1){var _0x4157bd={};_0x4157bd[_0x1b5be1]={'$like':'%'+_0x23276d[_0x1a15('0x42')][_0x1a15('0x4b')]+'%'};return _0x4157bd;})});}_0x420886=_[_0x1a15('0x4d')]({},_0x420886,_0x23276d['options']);return db[_0x1a15('0x6f')][_0x1a15('0x2c')]({'where':_0x420886[_0x1a15('0x4c')]})['then'](function(_0x300ee3){_0x37472b[_0x1a15('0x2c')]=_0x300ee3;if(_0x23276d['query'][_0x1a15('0x50')]){_0x420886['include']=[{'all':!![]}];}return db[_0x1a15('0x6f')][_0x1a15('0x52')](_0x420886);})[_0x1a15('0x20')](function(_0x2b1141){_0x37472b[_0x1a15('0x53')]=_0x2b1141;return _0x37472b;});}})['then'](respondWithFilteredResult(_0x180bc7,_0x420886))[_0x1a15('0x62')](handleError(_0x180bc7,null));};exports[_0x1a15('0x70')]=function(_0x3c461f,_0x10d041,_0x29bcf3){return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x3c461f['params']['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x10d041,null))[_0x1a15('0x20')](function(_0x2fa807){if(_0x2fa807){return _0x2fa807[_0x1a15('0x70')](_0x3c461f[_0x1a15('0x42')][_0x1a15('0x6d')]);}})[_0x1a15('0x20')](respondWithStatusCode(_0x10d041,null))[_0x1a15('0x62')](handleError(_0x10d041,null));};exports[_0x1a15('0x71')]=function(_0x20cc76,_0x5d3d05,_0x800388){var _0x2550d8={'body':_0x20cc76['body'],'channel':_0x1a15('0x72')};var _0x8ec42d=[];var _0x279102=[];var _0x256cf3={};var _0x36da52=![];return db[_0x1a15('0x73')][_0x1a15('0x64')]()[_0x1a15('0x20')](function(_0x104389){if(!_0x104389){throw new db[(_0x1a15('0x74'))][(_0x1a15('0x75'))]('no\x20available\x20attributes');}_0x8ec42d=_[_0x1a15('0x76')](_['keys'](_0x104389),['createdAt',_0x1a15('0x77')]);_0x279102=_[_0x1a15('0x76')](_[_0x1a15('0x43')](_0x104389),[_0x1a15('0x78'),_0x1a15('0x77'),_0x1a15('0x79'),_0x1a15('0x7a')]);if(_0x20cc76['body']['id']){delete _0x20cc76[_0x1a15('0x5a')]['id'];}if(_[_0x1a15('0x7b')](_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x7c')])){throw new db[(_0x1a15('0x74'))][(_0x1a15('0x75'))]('from\x20is\x20mandatory');}if(_[_0x1a15('0x7b')](_0x20cc76['body'][_0x1a15('0x5a')])||_0x20cc76['body']['body']===''){throw new db['Sequelize'][(_0x1a15('0x75'))](_0x1a15('0x7d'));}if(_[_0x1a15('0x7b')](_0x20cc76['body'][_0x1a15('0x7e')])){throw new db[(_0x1a15('0x74'))][(_0x1a15('0x75'))](_0x1a15('0x7f')+_0x279102);}if(!_[_0x1a15('0x80')](_0x279102,_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x7e')])){throw new db[(_0x1a15('0x74'))][(_0x1a15('0x75'))](_0x1a15('0x81')+_0x279102);}_0x256cf3[_0x20cc76[_0x1a15('0x5a')]['mapKey']]=_0x20cc76['body'][_0x1a15('0x7c')];})['then'](function(){return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x20cc76[_0x1a15('0x55')]['id']},'include':[{'model':db[_0x1a15('0x82')],'as':_0x1a15('0x83'),'include':[{'model':db['CmContact'],'as':_0x1a15('0x84'),'where':_0x256cf3,'limit':0x1,'order':[[_0x1a15('0x77'),_0x1a15('0x85')]]}]},{'model':db[_0x1a15('0x86')],'as':_0x1a15('0x87')}]});})[_0x1a15('0x20')](handleEntityNotFound(_0x5d3d05,null))[_0x1a15('0x20')](function(_0x5b0ccc){if(_0x5b0ccc&&_0x5b0ccc['List']){_0x2550d8[_0x1a15('0x88')]=_0x5b0ccc;_0x2550d8[_0x1a15('0x89')]=_0x5b0ccc[_0x1a15('0x87')];_0x2550d8[_0x1a15('0x8a')]=_0x5b0ccc[_0x1a15('0x83')];_0x2550d8[_0x1a15('0x89')]=_[_0x1a15('0x8b')](_0x2550d8[_0x1a15('0x89')],[_0x1a15('0x8c')],[_0x1a15('0x8d')]);if(_0x2550d8[_0x1a15('0x88')][_0x1a15('0x87')]){delete _0x2550d8['account'][_0x1a15('0x87')];}if(_0x2550d8[_0x1a15('0x88')]['List']&&_0x2550d8[_0x1a15('0x88')][_0x1a15('0x83')][_0x1a15('0x84')][_0x1a15('0x48')]){return _0x2550d8[_0x1a15('0x88')][_0x1a15('0x83')][_0x1a15('0x84')][0x0];}var _0x3cec04=_[_0x1a15('0x18')](_0x20cc76['body'],{'firstName':_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x7c')],'ListId':_0x5b0ccc[_0x1a15('0x7a')]});_0x3cec04[_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x7e')]]=_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x7c')];return db[_0x1a15('0x73')][_0x1a15('0x59')](_0x3cec04,{'fields':_0x8ec42d,'raw':!![]});}})[_0x1a15('0x20')](handleEntityNotFound(_0x5d3d05,null))['then'](function(_0x45764f){_0x2550d8[_0x1a15('0x8e')]=_0x45764f;if(_0x45764f){var _0x5f07a1={'ContactId':_0x45764f['id'],'OpenchannelAccountId':_0x20cc76[_0x1a15('0x55')]['id'],'from':(_0x45764f[_0x1a15('0x8f')]||'')+'\x20'+(_0x45764f[_0x1a15('0x90')]||'')};var _0x2453fb={'OpenchannelAccountId':_0x20cc76['params']['id'],'closed':![]};if(_0x20cc76['body'][_0x1a15('0x91')]){_0x2453fb[_0x1a15('0x91')]=_0x20cc76['body']['threadId'];return db[_0x1a15('0x92')][_0x1a15('0x58')]({'where':_0x2453fb})[_0x1a15('0x20')](function(_0x1c0922){if(_0x1c0922){return[_0x1c0922,![]];}_0x5f07a1[_0x1a15('0x91')]=_0x20cc76['body'][_0x1a15('0x91')];_0x5f07a1[_0x1a15('0x93')]=_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x93')];return db['OpenchannelInteraction'][_0x1a15('0x59')](_0x5f07a1)[_0x1a15('0x20')](function(_0x55a000){return[_0x55a000,!![]];});});}else{_0x2453fb[_0x1a15('0x91')]=null;}_0x2453fb[_0x1a15('0x94')]=_0x45764f['id'];return db[_0x1a15('0x92')]['find']({'where':_0x2453fb})[_0x1a15('0x20')](function(_0x1db514){if(_0x1db514){return[_0x1db514,![]];}return db['OpenchannelInteraction'][_0x1a15('0x59')](_0x5f07a1)[_0x1a15('0x20')](function(_0x182908){return[_0x182908,!![]];});});}})['spread'](function(_0x2b8227,_0x4b0975){if(_0x2b8227){_0x36da52=_0x4b0975;if(!_0x4b0975){var _0x241bb1={'from':(_0x2550d8[_0x1a15('0x8e')][_0x1a15('0x8f')]||'')+'\x20'+(_0x2550d8[_0x1a15('0x8e')][_0x1a15('0x90')]||'')};if(_0x20cc76['body'][_0x1a15('0x91')]&&_0x20cc76[_0x1a15('0x5a')]['messageId']&&_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x91')]!=_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x95')]){_0x241bb1['threadId']=_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x95')];}return _0x2b8227['update'](_0x241bb1);}else{return _0x2b8227;}}})[_0x1a15('0x20')](function(_0x10716f){_0x2550d8[_0x1a15('0x96')]=_0x10716f[_0x1a15('0x35')]({'plain':!![]});_0x2550d8['interaction'][_0x1a15('0x97')]=_0x36da52;if(_0x2550d8[_0x1a15('0x96')]['created']){if(_0x2550d8['account']['autoclose']){_0x2550d8[_0x1a15('0x89')]['push']({'id':0x0,'priority':_0x2550d8[_0x1a15('0x89')][_0x1a15('0x48')]+0x1,'app':_0x1a15('0x98'),'appdata':'unmanaged','interval':_0x1a15('0x99')});}}return db['OpenchannelMessage'][_0x1a15('0x59')]({'body':_0x20cc76[_0x1a15('0x5a')][_0x1a15('0x5a')],'OpenchannelAccountId':_0x20cc76[_0x1a15('0x55')]['id'],'OpenchannelInteractionId':_0x10716f['id'],'direction':'in','ContactId':_0x2550d8['contact']['id'],'AttachmentId':_0x20cc76[_0x1a15('0x5a')]['AttachmentId']});})[_0x1a15('0x20')](function(_0x1e2be3){_0x2550d8[_0x1a15('0x26')]=_0x1e2be3;if(!_0x2550d8[_0x1a15('0x96')][_0x1a15('0x9a')])return;return db[_0x1a15('0x9b')][_0x1a15('0x58')]({'attributes':['id',_0x1a15('0x39')],'where':{'id':_0x2550d8[_0x1a15('0x96')][_0x1a15('0x9a')]}});})[_0x1a15('0x20')](function(_0x575857){if(_0x575857){_0x2550d8['applications'][_0x1a15('0x9c')]({'id':0x0,'priority':0x0,'app':_0x1a15('0x9d'),'appdata':_0x575857[_0x1a15('0x39')]+','+(_0x2550d8[_0x1a15('0x88')][_0x1a15('0x9e')]||0xa),'interval':_0x1a15('0x99')});}if(!_0x2550d8[_0x1a15('0x96')][_0x1a15('0x9f')])return;return db['OpenchannelQueue'][_0x1a15('0x58')]({'attributes':['id',_0x1a15('0x39')],'where':{'id':_0x2550d8[_0x1a15('0x96')][_0x1a15('0x9f')]}});})['then'](function(_0x451af9){if(_0x451af9){_0x2550d8[_0x1a15('0x89')][_0x1a15('0x9c')]({'id':0x0,'priority':0x1,'app':_0x1a15('0xa0'),'appdata':_0x451af9['name']+','+(_0x2550d8[_0x1a15('0x88')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1a15('0xa1'),_0x1a15('0xa2'),_0x2550d8);})[_0x1a15('0x20')](function(_0x11fadc){respondWithRpcPromise(_0x1a15('0xa3'),_0x1a15('0xa3'),{'event':_0x1a15('0x71'),'message':_0x11fadc},client9002);return _0x11fadc;})[_0x1a15('0x20')](respondWithResult(_0x5d3d05,null))[_0x1a15('0x62')](handleError(_0x5d3d05,null));};exports[_0x1a15('0xa4')]=function(_0x337568,_0xe312bb){var _0x131238=_0x337568[_0x1a15('0x55')]['id'];var _0x6dc1e1=_0x337568[_0x1a15('0x5a')];var _0x1de5c9=0xc8;var _0x251d1e=null;return db[_0x1a15('0xa5')][_0x1a15('0xa6')]({'isolationLevel':db[_0x1a15('0xa5')]['Transaction'][_0x1a15('0xa7')][_0x1a15('0xa8')]},function(_0x2b9365){return db[_0x1a15('0x3f')][_0x1a15('0xa9')]({'where':{'id':_0x131238},'transaction':_0x2b9365})[_0x1a15('0x20')](function(_0x220f1b){if(_0x220f1b){return db[_0x1a15('0x86')][_0x1a15('0x34')]({'where':{'OpenchannelAccountId':_0x131238},'transaction':_0x2b9365})[_0x1a15('0x20')](function(){var _0x413bca=_[_0x1a15('0x3e')](_0x6dc1e1,function(_0x3c00b3){_0x3c00b3['OpenchannelAccountId']=_0x131238;return _0x3c00b3;});return db['OpenchannelApplication']['bulkCreate'](_0x413bca,{'transaction':_0x2b9365});});}else{_0x1de5c9=0x194;_0x251d1e=[];}});})[_0x1a15('0x20')](function(){if(_0x1de5c9!==0x194){return db['OpenchannelApplication'][_0x1a15('0xaa')]({'where':{'OpenchannelAccountId':_0x131238},'order':_0x1a15('0x8c')})[_0x1a15('0x20')](function(_0x26f372){_0x251d1e=_0x26f372;});}})[_0x1a15('0x62')](function(_0x39a19f){_0x1de5c9=0x1f4;logger['error'](_0x39a19f[_0x1a15('0x38')]);if(_0x39a19f[_0x1a15('0x39')]){delete _0x39a19f[_0x1a15('0x39')];}_0x251d1e=_0x39a19f;})[_0x1a15('0xab')](function(){if(_0x251d1e===null){_0xe312bb[_0x1a15('0x28')](_0x1de5c9);}else{if(_0x1de5c9===0x1f4){_0xe312bb['status'](_0x1de5c9)[_0x1a15('0x3a')](_0x251d1e);}else{_0xe312bb[_0x1a15('0x29')](_0x1de5c9)[_0x1a15('0x2f')](_0x251d1e);}}});};exports[_0x1a15('0xac')]=function(_0xa607d5,_0x2d3127,_0x128b04){var _0x16bfc4={};var _0x28cf92={};var _0x5e7cc6;var _0x4976f7;return db[_0x1a15('0x3f')]['findOne']({'where':{'id':_0xa607d5[_0x1a15('0x55')]['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x2d3127,null))[_0x1a15('0x20')](function(_0x919251){if(_0x919251){_0x5e7cc6=_0x919251;_0x28cf92['model']=_[_0x1a15('0x43')](db['OpenchannelApplication']['rawAttributes']);_0x28cf92[_0x1a15('0x42')]=_[_0x1a15('0x43')](_0xa607d5['query']);_0x28cf92[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x28cf92[_0x1a15('0x41')],_0x28cf92['query']);_0x16bfc4[_0x1a15('0x47')]=_[_0x1a15('0x45')](_0x28cf92[_0x1a15('0x41')],qs[_0x1a15('0x46')](_0xa607d5['query'][_0x1a15('0x46')]));_0x16bfc4[_0x1a15('0x47')]=_0x16bfc4[_0x1a15('0x47')][_0x1a15('0x48')]?_0x16bfc4[_0x1a15('0x47')]:_0x28cf92['model'];_0x16bfc4[_0x1a15('0x6a')]=qs[_0x1a15('0x4a')](_0xa607d5[_0x1a15('0x42')][_0x1a15('0x4a')]);_0x16bfc4['where']=qs[_0x1a15('0x44')](_[_0x1a15('0x6b')](_0xa607d5[_0x1a15('0x42')],_0x28cf92[_0x1a15('0x44')]));if(_0xa607d5[_0x1a15('0x42')][_0x1a15('0x4b')]){_0x16bfc4[_0x1a15('0x4c')]=_[_0x1a15('0x4d')](_0x16bfc4['where'],{'$or':_[_0x1a15('0x3e')](_0x16bfc4[_0x1a15('0x47')],function(_0x4c785f){var _0x326ba2={};_0x326ba2[_0x4c785f]={'$like':'%'+_0xa607d5[_0x1a15('0x42')][_0x1a15('0x4b')]+'%'};return _0x326ba2;})});}_0x16bfc4=_['merge']({},_0x16bfc4,_0xa607d5[_0x1a15('0x57')]);return _0x5e7cc6['getApplications'](_0x16bfc4);}})[_0x1a15('0x20')](function(_0x57e195){if(_0x57e195){_0x4976f7=_0x57e195['length'];if(!_0xa607d5['query']['hasOwnProperty'](_0x1a15('0x69'))){_0x16bfc4[_0x1a15('0x2b')]=qs[_0x1a15('0x2b')](_0xa607d5[_0x1a15('0x42')]['limit']);_0x16bfc4[_0x1a15('0x2d')]=qs['offset'](_0xa607d5[_0x1a15('0x42')]['offset']);}return _0x5e7cc6[_0x1a15('0xac')](_0x16bfc4);}})[_0x1a15('0x20')](function(_0x3367df){if(_0x3367df){return _0x3367df?{'count':_0x4976f7,'rows':_0x3367df}:null;}})[_0x1a15('0x20')](respondWithResult(_0x2d3127,null))['catch'](handleError(_0x2d3127,null));};exports['getInteractions']=function(_0x10fb5b,_0x47b7e5,_0x98a53b){var _0xd6081b={'raw':![],'where':{}};var _0x4c8853={};var _0x2fe412={'count':0x0,'rows':[]};return db[_0x1a15('0x3f')]['findOne']({'where':{'id':_0x10fb5b[_0x1a15('0x55')]['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x47b7e5,null))['then'](function(_0x1a6437){if(_0x1a6437){_0x4c8853[_0x1a15('0x41')]=_[_0x1a15('0x43')](db[_0x1a15('0x92')][_0x1a15('0x56')]);_0x4c8853[_0x1a15('0x42')]=_[_0x1a15('0x43')](_0x10fb5b[_0x1a15('0x42')]);_0x4c8853[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x4c8853['model'],_0x4c8853['query']);_0xd6081b[_0x1a15('0x47')]=_[_0x1a15('0x45')](_0x4c8853['model'],qs['fields'](_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x46')]));_0xd6081b[_0x1a15('0x47')]=_0xd6081b[_0x1a15('0x47')]['length']?_0xd6081b[_0x1a15('0x47')]:_0x4c8853[_0x1a15('0x41')];if(!_0x10fb5b[_0x1a15('0x42')]['hasOwnProperty'](_0x1a15('0x69'))){_0xd6081b[_0x1a15('0x2b')]=qs[_0x1a15('0x2b')](_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x2b')]);_0xd6081b[_0x1a15('0x2d')]=qs[_0x1a15('0x2d')](_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x2d')]);}_0xd6081b[_0x1a15('0x6a')]=qs['sort'](_0x10fb5b['query']['sort']);_0xd6081b[_0x1a15('0x4c')]=qs[_0x1a15('0x44')](_[_0x1a15('0x6b')](_0x10fb5b[_0x1a15('0x42')],_0x4c8853['filters']));_0xd6081b[_0x1a15('0x4c')]['OpenchannelAccountId']=_0x1a6437['id'];if(_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x4b')]){_0xd6081b[_0x1a15('0x4c')]=_[_0x1a15('0x4d')](_0xd6081b[_0x1a15('0x4c')],{'$or':_[_0x1a15('0x3e')](_0xd6081b[_0x1a15('0x47')],function(_0x49af39){var _0x55dc10={};_0x55dc10[_0x49af39]={'$like':'%'+_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x4b')]+'%'};return _0x55dc10;})});}_0xd6081b=_['merge']({},_0xd6081b,_0x10fb5b[_0x1a15('0x57')]);return db[_0x1a15('0x92')][_0x1a15('0x2c')]({'where':_0xd6081b[_0x1a15('0x4c')]})[_0x1a15('0x20')](function(_0x105ae7){_0x2fe412['count']=_0x105ae7;if(_0x10fb5b[_0x1a15('0x42')][_0x1a15('0x50')]){_0xd6081b['include']=[{'model':db['CmContact'],'as':_0x1a15('0xad'),'required':![]},{'model':db[_0x1a15('0x9b')],'as':_0x1a15('0xae'),'attributes':[_0x1a15('0x39'),_0x1a15('0xaf'),_0x1a15('0xb0')],'required':![]},{'model':db[_0x1a15('0xb1')],'as':_0x1a15('0xb2'),'attributes':['id',_0x1a15('0x39'),_0x1a15('0xb3')],'where':_0x10fb5b['query'][_0x1a15('0xb4')]?{'id':_0x10fb5b['query'][_0x1a15('0xb4')]}:undefined,'required':_0x10fb5b[_0x1a15('0x42')]['tag']?!![]:![]}];}return db[_0x1a15('0x92')][_0x1a15('0x52')](_0xd6081b);})[_0x1a15('0x20')](function(_0x44434d){_0x2fe412[_0x1a15('0x53')]=_0x44434d;return _0x2fe412;});}})[_0x1a15('0x20')](respondWithFilteredResult(_0x47b7e5,_0xd6081b))[_0x1a15('0x62')](handleError(_0x47b7e5,null));};exports[_0x1a15('0xb5')]=function(_0x8999ef,_0x5a219f,_0x56a9d3){return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x8999ef[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a219f,null))[_0x1a15('0x20')](function(_0x302734){if(_0x302734){return _0x302734[_0x1a15('0xb5')](_0x8999ef[_0x1a15('0x5a')][_0x1a15('0x6d')],_[_0x1a15('0xb6')](_0x8999ef[_0x1a15('0x5a')],[_0x1a15('0x6d'),'id'])||{})[_0x1a15('0xb7')](function(_0x5ac37b){for(var _0x446c28=0x0;_0x446c28<_0x8999ef['body'][_0x1a15('0x6d')][_0x1a15('0x48')];_0x446c28+=0x1){socket[_0x1a15('0xb8')](_0x1a15('0xb9'),{'UserId':Number(_0x8999ef[_0x1a15('0x5a')][_0x1a15('0x6d')][_0x446c28]),'OpenchannelAccountId':Number(_0x8999ef[_0x1a15('0x55')]['id'])});}return _0x5ac37b;});}})['then'](respondWithResult(_0x5a219f,null))[_0x1a15('0x62')](handleError(_0x5a219f,null));};exports[_0x1a15('0xba')]=function(_0x166520,_0x15071d,_0x4ad108){return db[_0x1a15('0x3f')][_0x1a15('0x58')]({'where':{'id':_0x166520[_0x1a15('0x55')]['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x15071d,null))[_0x1a15('0x20')](function(_0x4098ef){if(_0x4098ef){return _0x4098ef[_0x1a15('0xba')](_0x166520[_0x1a15('0x42')][_0x1a15('0x6d')])[_0x1a15('0x20')](function(){if(_[_0x1a15('0xbb')](_0x166520[_0x1a15('0x42')]['ids'])){for(var _0x254fe7=0x0;_0x254fe7<_0x166520[_0x1a15('0x42')]['ids']['length'];_0x254fe7+=0x1){socket[_0x1a15('0xb8')](_0x1a15('0xbc'),{'UserId':Number(_0x166520['query'][_0x1a15('0x6d')][_0x254fe7]),'OpenchannelAccountId':Number(_0x166520[_0x1a15('0x55')]['id'])});}}else{socket[_0x1a15('0xb8')](_0x1a15('0xbc'),{'UserId':Number(_0x166520[_0x1a15('0x42')]['ids']),'OpenchannelAccountId':Number(_0x166520[_0x1a15('0x55')]['id'])});}});}})[_0x1a15('0x20')](respondWithStatusCode(_0x15071d,null))['catch'](handleError(_0x15071d,null));};exports[_0x1a15('0xbd')]=function(_0x506e76,_0x335d9c,_0x4477fe){var _0x33237b={};var _0x49e9d0={};var _0x165a37;var _0x54b211;return db[_0x1a15('0x3f')][_0x1a15('0xa9')]({'where':{'id':_0x506e76[_0x1a15('0x55')]['id']}})['then'](handleEntityNotFound(_0x335d9c,null))['then'](function(_0x263108){if(_0x263108){_0x165a37=_0x263108;_0x49e9d0[_0x1a15('0x41')]=_['keys'](db[_0x1a15('0x9b')][_0x1a15('0x56')]);_0x49e9d0[_0x1a15('0x42')]=_['keys'](_0x506e76[_0x1a15('0x42')]);_0x49e9d0[_0x1a15('0x44')]=_[_0x1a15('0x45')](_0x49e9d0[_0x1a15('0x41')],_0x49e9d0[_0x1a15('0x42')]);_0x33237b[_0x1a15('0x47')]=_['intersection'](_0x49e9d0[_0x1a15('0x41')],qs[_0x1a15('0x46')](_0x506e76[_0x1a15('0x42')][_0x1a15('0x46')]));_0x33237b['attributes']=_0x33237b[_0x1a15('0x47')][_0x1a15('0x48')]?_0x33237b[_0x1a15('0x47')]:_0x49e9d0[_0x1a15('0x41')];_0x33237b['order']=qs[_0x1a15('0x4a')](_0x506e76[_0x1a15('0x42')][_0x1a15('0x4a')]);_0x33237b[_0x1a15('0x4c')]=qs[_0x1a15('0x44')](_[_0x1a15('0x6b')](_0x506e76['query'],_0x49e9d0['filters']));if(_0x506e76[_0x1a15('0x42')][_0x1a15('0x4b')]){_0x33237b[_0x1a15('0x4c')]=_['merge'](_0x33237b[_0x1a15('0x4c')],{'$or':_['map'](_0x33237b[_0x1a15('0x47')],function(_0x349f6f){var _0xcd2392={};_0xcd2392[_0x349f6f]={'$like':'%'+_0x506e76['query'][_0x1a15('0x4b')]+'%'};return _0xcd2392;})});}_0x33237b=_[_0x1a15('0x4d')]({},_0x33237b,_0x506e76[_0x1a15('0x57')]);return _0x165a37[_0x1a15('0xbd')](_0x33237b);}})[_0x1a15('0x20')](function(_0x34fad4){if(_0x34fad4){_0x54b211=_0x34fad4['length'];if(!_0x506e76[_0x1a15('0x42')][_0x1a15('0x49')]('nolimit')){_0x33237b['limit']=qs[_0x1a15('0x2b')](_0x506e76[_0x1a15('0x42')][_0x1a15('0x2b')]);_0x33237b['offset']=qs[_0x1a15('0x2d')](_0x506e76[_0x1a15('0x42')][_0x1a15('0x2d')]);}return _0x165a37[_0x1a15('0xbd')](_0x33237b);}})[_0x1a15('0x20')](function(_0x29effc){if(_0x29effc){return _0x29effc?{'count':_0x54b211,'rows':_0x29effc}:null;}})[_0x1a15('0x20')](respondWithResult(_0x335d9c,null))[_0x1a15('0x62')](handleError(_0x335d9c,null));};exports[_0x1a15('0x3a')]=function(_0x951d16,_0x319eff,_0x30a4a4){var _0x2866a5,_0x651e96,_0x5ed1b0;if(_[_0x1a15('0x7b')](_0x951d16['body'][_0x1a15('0x5a')])||_0x951d16[_0x1a15('0x5a')][_0x1a15('0x5a')]===''){throw new db[(_0x1a15('0x74'))][(_0x1a15('0x75'))](_0x1a15('0x7d'));}if(_['isNil'](_0x951d16[_0x1a15('0x5a')]['to'])){}_0x2866a5=_0x951d16[_0x1a15('0x5a')]['to'];return db[_0x1a15('0x3f')][_0x1a15('0xa9')]({'where':{'id':_0x951d16['params']['id']}})[_0x1a15('0x20')](handleEntityNotFound(_0x319eff,null))[_0x1a15('0x20')](function(_0x51baa5){if(_0x51baa5){return db[_0x1a15('0x3f')]['find']({'where':{'id':_0x51baa5['id']},'include':[{'model':db[_0x1a15('0x82')],'as':_0x1a15('0x83'),'include':[{'model':db['CmContact'],'as':_0x1a15('0x84'),'where':{[_0x51baa5[_0x1a15('0x7e')]]:_0x2866a5},'limit':0x1,'order':[[_0x1a15('0x77'),_0x1a15('0x85')]]}]}]})[_0x1a15('0x20')](handleEntityNotFound(_0x319eff,null))[_0x1a15('0x20')](function(_0x39fd2f){if(_0x39fd2f&&_0x39fd2f[_0x1a15('0x83')]){_0x651e96=_0x39fd2f[_0x1a15('0x35')]({'plain':!![]});if(_0x651e96[_0x1a15('0x83')]&&_0x651e96[_0x1a15('0x83')][_0x1a15('0x84')][_0x1a15('0x48')]){return _0x651e96[_0x1a15('0x83')]['Contacts'][0x0];}return db[_0x1a15('0x73')][_0x1a15('0x59')](_[_0x1a15('0x18')](_0x951d16[_0x1a15('0x5a')],{'firstName':_0x2866a5,[_0x39fd2f['mapKey']]:_0x2866a5,'phone':_0x2866a5,'ListId':_0x651e96[_0x1a15('0x7a')]}));}})['then'](handleEntityNotFound(_0x319eff,null))[_0x1a15('0x20')](function(_0x20cd6c){if(_0x20cd6c){_0x5ed1b0=_0x20cd6c;return db['OpenchannelInteraction'][_0x1a15('0x58')]({'where':{'ContactId':_0x5ed1b0['id'],'closed':![],'OpenchannelAccountId':_0x651e96['id']}})[_0x1a15('0x20')](function(_0x407ff3){if(_0x407ff3){return[_0x407ff3,![]];}return db[_0x1a15('0x92')]['create']({'UserId':_0x951d16[_0x1a15('0x5b')]['id'],'ContactId':_0x5ed1b0['id'],'OpenchannelAccountId':_0x651e96['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_['merge'](_0x951d16[_0x1a15('0x5a')],{'read':![],'body':_0x951d16['body'][_0x1a15('0x5a')],'OpenchannelAccountId':_0x651e96['id'],'UserId':_0x951d16['user']['id'],'ContactId':_0x5ed1b0['id']})]},{'include':[{'model':db[_0x1a15('0xbe')],'as':_0x1a15('0xbf')}]})['then'](function(_0x1735fa){return[_0x1735fa,!![]];});});}})[_0x1a15('0xb7')](function(_0x4eb0c8,_0x4b3ab0){if(_0x4b3ab0){return _0x4eb0c8;}return db[_0x1a15('0xbe')][_0x1a15('0x59')](_[_0x1a15('0x4d')](_0x951d16[_0x1a15('0x5a')],{'read':![],'body':_0x951d16[_0x1a15('0x5a')][_0x1a15('0x5a')],'OpenchannelAccountId':_0x651e96['id'],'OpenchannelInteractionId':_0x4eb0c8['id'],'UserId':_0x951d16[_0x1a15('0x5b')]['id'],'ContactId':_0x5ed1b0['id']}))[_0x1a15('0x20')](function(_0x1ca23f){_0x4eb0c8[_0x1a15('0xc0')]['Messages']=[];_0x4eb0c8['dataValues'][_0x1a15('0xbf')][_0x1a15('0xc1')](_0x1ca23f[_0x1a15('0xc0')]);return _0x4eb0c8;});});}})[_0x1a15('0x20')](respondWithResult(_0x319eff,null))[_0x1a15('0x62')](handleError(_0x319eff,null));}; \ No newline at end of file +var _0xa428=['bulkCreate','status','getApplications','pick','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','end','json','offset','undefined','limit','set','Content-Range','apply','then','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelAccount','count','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','body','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','transaction'];(function(_0xb2a529,_0x35a98e){var _0x365ddf=function(_0x1e7c8b){while(--_0x1e7c8b){_0xb2a529['push'](_0xb2a529['shift']());}};_0x365ddf(++_0x35a98e);}(_0xa428,0xd8));var _0x8a42=function(_0x83b7b9,_0x554605){_0x83b7b9=_0x83b7b9-0x0;var _0x5057a2=_0xa428[_0x83b7b9];return _0x5057a2;};'use strict';var emlformat=require(_0x8a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a42('0x1'));var jsonpatch=require(_0x8a42('0x2'));var rp=require(_0x8a42('0x3'));var moment=require(_0x8a42('0x4'));var BPromise=require(_0x8a42('0x5'));var Mustache=require(_0x8a42('0x6'));var util=require(_0x8a42('0x7'));var path=require('path');var sox=require(_0x8a42('0x8'));var csv=require(_0x8a42('0x9'));var ejs=require(_0x8a42('0xa'));var fs=require('fs');var fs_extra=require(_0x8a42('0xb'));var _=require('lodash');var squel=require(_0x8a42('0xc'));var crypto=require(_0x8a42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8a42('0xe'));var toCsv=require(_0x8a42('0x9'));var querystring=require(_0x8a42('0xf'));var Papa=require(_0x8a42('0x10'));var Redis=require(_0x8a42('0x11'));var authService=require(_0x8a42('0x12'));var qs=require(_0x8a42('0x13'));var as=require(_0x8a42('0x14'));var hardwareService=require(_0x8a42('0x15'));var logger=require(_0x8a42('0x16'))('api');var utils=require(_0x8a42('0x17'));var config=require(_0x8a42('0x18'));var licenseUtil=require(_0x8a42('0x19'));var db=require('../../mysqldb')['db'];config[_0x8a42('0x1a')]=_['defaults'](config['redis'],{'host':_0x8a42('0x1b'),'port':0x18eb});var socket=require(_0x8a42('0x1c'))(new Redis(config[_0x8a42('0x1a')]));require(_0x8a42('0x1d'))[_0x8a42('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8a42('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x8a42('0x1f')][_0x8a42('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2facee,_0x5ab177,_0x2186dd,_0x1a420b){return new BPromise(function(_0x2fee04,_0xa31991){var _0x5e0ca8=_0x1a420b||client;return _0x5e0ca8['request'](_0x2facee,_0x2186dd)['then'](function(_0x27cc01){logger['info'](_0x8a42('0x21'),_0x5ab177,_0x8a42('0x22'));logger[_0x8a42('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5ab177,_0x8a42('0x22'),JSON[_0x8a42('0x24')](_0x27cc01));if(_0x27cc01['error']){if(_0x27cc01[_0x8a42('0x25')][_0x8a42('0x26')]===0x1f4){logger[_0x8a42('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ab177,_0x27cc01[_0x8a42('0x25')][_0x8a42('0x27')]);return _0xa31991(_0x27cc01['error'][_0x8a42('0x27')]);}logger['error'](_0x8a42('0x21'),_0x5ab177,_0x27cc01['error'][_0x8a42('0x27')]);return _0x2fee04(_0x27cc01[_0x8a42('0x25')][_0x8a42('0x27')]);}else{logger[_0x8a42('0x28')](_0x8a42('0x21'),_0x5ab177,_0x8a42('0x22'));_0x2fee04(_0x27cc01[_0x8a42('0x29')][_0x8a42('0x27')]);}})[_0x8a42('0x2a')](function(_0x2dfd09){logger['error'](_0x8a42('0x21'),_0x5ab177,_0x2dfd09);_0xa31991(_0x2dfd09);});});}function respondWithStatusCode(_0x120c3c,_0x4f0dd7){_0x4f0dd7=_0x4f0dd7||0xcc;return function(_0x3e6c21){if(_0x3e6c21){return _0x120c3c['sendStatus'](_0x4f0dd7);}return _0x120c3c['status'](_0x4f0dd7)[_0x8a42('0x2b')]();};}function respondWithResult(_0x38a556,_0x1ef4df){_0x1ef4df=_0x1ef4df||0xc8;return function(_0x220dd7){if(_0x220dd7){return _0x38a556['status'](_0x1ef4df)[_0x8a42('0x2c')](_0x220dd7);}};}function respondWithFilteredResult(_0x2b16d5,_0x4cd249){return function(_0x342242){if(_0x342242){var _0x303537=typeof _0x4cd249[_0x8a42('0x2d')]===_0x8a42('0x2e')&&typeof _0x4cd249[_0x8a42('0x2f')]===_0x8a42('0x2e');var _0x57dac1=_0x342242['count'];var _0x5377fe=_0x303537?0x0:_0x4cd249[_0x8a42('0x2d')];var _0xc55d15=_0x303537?_0x342242['count']:_0x4cd249[_0x8a42('0x2d')]+_0x4cd249[_0x8a42('0x2f')];var _0x5131f5;if(_0xc55d15>=_0x57dac1){_0xc55d15=_0x57dac1;_0x5131f5=0xc8;}else{_0x5131f5=0xce;}_0x2b16d5['status'](_0x5131f5);return _0x2b16d5[_0x8a42('0x30')](_0x8a42('0x31'),_0x5377fe+'-'+_0xc55d15+'/'+_0x57dac1)[_0x8a42('0x2c')](_0x342242);}return null;};}function patchUpdates(_0x5d70bb){return function(_0x2fb4ce){try{jsonpatch[_0x8a42('0x32')](_0x2fb4ce,_0x5d70bb,!![]);}catch(_0x46266b){return BPromise['reject'](_0x46266b);}return _0x2fb4ce['save']();};}function saveUpdates(_0xc5ce68,_0xaec2af){return function(_0x37ffd8){if(_0x37ffd8){return _0x37ffd8['update'](_0xc5ce68)[_0x8a42('0x33')](function(_0x8e54e2){return _0x8e54e2;});}return null;};}function removeEntity(_0x52a180,_0x838e78){return function(_0x362b98){if(_0x362b98){return _0x362b98['destroy']()[_0x8a42('0x33')](function(){var _0x35f645=_0x362b98['get']({'plain':!![]});var _0x571536=_0x8a42('0x34');return db[_0x8a42('0x35')]['destroy']({'where':{'type':_0x571536,'resourceId':_0x35f645['id']}})[_0x8a42('0x33')](function(){return _0x362b98;});})[_0x8a42('0x33')](function(){_0x52a180['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1339f8,_0x2b70a6){return function(_0x37f39d){if(!_0x37f39d){_0x1339f8[_0x8a42('0x36')](0x194);}return _0x37f39d;};}function handleError(_0x3bbc8f,_0x444c3b){_0x444c3b=_0x444c3b||0x1f4;return function(_0x913ddb){logger[_0x8a42('0x25')](_0x913ddb[_0x8a42('0x37')]);if(_0x913ddb[_0x8a42('0x38')]){delete _0x913ddb[_0x8a42('0x38')];}_0x3bbc8f['status'](_0x444c3b)[_0x8a42('0x39')](_0x913ddb);};}exports[_0x8a42('0x3a')]=function(_0x535a2c,_0x9bfe19){var _0x4f6172={'include':[{'model':db[_0x8a42('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5bbdf0={},_0x5f3423={'count':0x0,'rows':[]};var _0x2333cd=_[_0x8a42('0x3c')](db['OpenchannelAccount'][_0x8a42('0x3d')],function(_0x36225f){return{'name':_0x36225f[_0x8a42('0x3e')],'type':_0x36225f[_0x8a42('0x3f')]['key']};});_0x5bbdf0['model']=_[_0x8a42('0x3c')](_0x2333cd,'name');_0x5bbdf0[_0x8a42('0x40')]=_[_0x8a42('0x41')](_0x535a2c[_0x8a42('0x40')]);_0x5bbdf0[_0x8a42('0x42')]=_[_0x8a42('0x43')](_0x5bbdf0[_0x8a42('0x44')],_0x5bbdf0['query']);_0x4f6172[_0x8a42('0x45')]=_[_0x8a42('0x43')](_0x5bbdf0['model'],qs[_0x8a42('0x46')](_0x535a2c[_0x8a42('0x40')][_0x8a42('0x46')]));_0x4f6172[_0x8a42('0x45')]=_0x4f6172[_0x8a42('0x45')][_0x8a42('0x47')]?_0x4f6172[_0x8a42('0x45')]:_0x5bbdf0[_0x8a42('0x44')];if(!_0x535a2c[_0x8a42('0x40')][_0x8a42('0x48')]('nolimit')){_0x4f6172[_0x8a42('0x2f')]=qs[_0x8a42('0x2f')](_0x535a2c['query'][_0x8a42('0x2f')]);_0x4f6172[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x535a2c['query'][_0x8a42('0x2d')]);}_0x4f6172[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x535a2c[_0x8a42('0x40')]['sort']);_0x4f6172[_0x8a42('0x4b')]=qs[_0x8a42('0x42')](_['pick'](_0x535a2c[_0x8a42('0x40')],_0x5bbdf0[_0x8a42('0x42')]),_0x2333cd);if(_0x535a2c['query'][_0x8a42('0x4c')]){_0x4f6172[_0x8a42('0x4b')]=_[_0x8a42('0x4d')](_0x4f6172[_0x8a42('0x4b')],{'$or':_['map'](_0x2333cd,function(_0xb9f47a){if(_0xb9f47a[_0x8a42('0x3f')]!==_0x8a42('0x4e')){var _0x2b0dc8={};_0x2b0dc8[_0xb9f47a['name']]={'$like':'%'+_0x535a2c[_0x8a42('0x40')][_0x8a42('0x4c')]+'%'};return _0x2b0dc8;}})});}_0x4f6172=_['merge']({},_0x4f6172,_0x535a2c[_0x8a42('0x4f')]);var _0x5528e2={'where':_0x4f6172[_0x8a42('0x4b')]};return db[_0x8a42('0x50')]['count'](_0x5528e2)[_0x8a42('0x33')](function(_0xc8ccee){_0x5f3423[_0x8a42('0x51')]=_0xc8ccee;if(_0x535a2c[_0x8a42('0x40')][_0x8a42('0x52')]){_0x4f6172[_0x8a42('0x53')]=[{'all':!![]}];}return db[_0x8a42('0x50')][_0x8a42('0x54')](_0x4f6172);})['then'](function(_0xac3b24){_0x5f3423[_0x8a42('0x55')]=_0xac3b24;return _0x5f3423;})[_0x8a42('0x33')](respondWithFilteredResult(_0x9bfe19,_0x4f6172))[_0x8a42('0x2a')](handleError(_0x9bfe19,null));};exports['show']=function(_0x2ee226,_0x1d5a6b){var _0x32fc5d={'raw':![],'where':{'id':_0x2ee226[_0x8a42('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x8a42('0x57')}]},_0x3b28c7={};_0x3b28c7[_0x8a42('0x44')]=_[_0x8a42('0x41')](db['OpenchannelAccount'][_0x8a42('0x3d')]);_0x3b28c7[_0x8a42('0x40')]=_['keys'](_0x2ee226[_0x8a42('0x40')]);_0x3b28c7[_0x8a42('0x42')]=_[_0x8a42('0x43')](_0x3b28c7[_0x8a42('0x44')],_0x3b28c7[_0x8a42('0x40')]);_0x32fc5d['attributes']=_[_0x8a42('0x43')](_0x3b28c7[_0x8a42('0x44')],qs[_0x8a42('0x46')](_0x2ee226[_0x8a42('0x40')][_0x8a42('0x46')]));_0x32fc5d[_0x8a42('0x45')]=_0x32fc5d[_0x8a42('0x45')][_0x8a42('0x47')]?_0x32fc5d[_0x8a42('0x45')]:_0x3b28c7[_0x8a42('0x44')];if(_0x2ee226[_0x8a42('0x40')]['includeAll']){_0x32fc5d[_0x8a42('0x53')]=[{'all':!![]}];}_0x32fc5d=_[_0x8a42('0x4d')]({},_0x32fc5d,_0x2ee226['options']);return db[_0x8a42('0x50')][_0x8a42('0x58')](_0x32fc5d)['then'](handleEntityNotFound(_0x1d5a6b,null))['then'](respondWithResult(_0x1d5a6b,null))[_0x8a42('0x2a')](handleError(_0x1d5a6b,null));};exports[_0x8a42('0x59')]=function(_0x5920e6,_0x3e678e){return db[_0x8a42('0x50')]['create'](_0x5920e6[_0x8a42('0x5a')],{})[_0x8a42('0x33')](function(_0x2a9b99){var _0x39f840=_0x5920e6[_0x8a42('0x5b')]['get']({'plain':!![]});if(!_0x39f840)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39f840['role']===_0x8a42('0x5b')){var _0x35e7e3=_0x2a9b99[_0x8a42('0x5c')]({'plain':!![]});var _0xd43359='OpenchannelAccounts';return db[_0x8a42('0x5d')][_0x8a42('0x58')]({'where':{'name':_0xd43359,'userProfileId':_0x39f840[_0x8a42('0x5e')]},'raw':!![]})['then'](function(_0x4b2bdb){if(_0x4b2bdb&&_0x4b2bdb['autoAssociation']===0x0){return db[_0x8a42('0x35')]['create']({'name':_0x35e7e3[_0x8a42('0x38')],'resourceId':_0x35e7e3['id'],'type':_0x4b2bdb[_0x8a42('0x38')],'sectionId':_0x4b2bdb['id']},{})[_0x8a42('0x33')](function(){return _0x2a9b99;});}else{return _0x2a9b99;}})[_0x8a42('0x2a')](function(_0x53d4d0){logger[_0x8a42('0x25')](_0x8a42('0x5f'),_0x53d4d0);throw _0x53d4d0;});}return _0x2a9b99;})[_0x8a42('0x33')](respondWithResult(_0x3e678e,0xc9))['catch'](handleError(_0x3e678e,null));};exports[_0x8a42('0x60')]=function(_0x343a4b,_0x5a9a9d){if(_0x343a4b[_0x8a42('0x5a')]['id']){delete _0x343a4b[_0x8a42('0x5a')]['id'];}return db[_0x8a42('0x50')][_0x8a42('0x58')]({'where':{'id':_0x343a4b[_0x8a42('0x56')]['id']},'include':[{'model':db[_0x8a42('0x3b')],'as':_0x8a42('0x57')}]})[_0x8a42('0x33')](handleEntityNotFound(_0x5a9a9d,null))['then'](saveUpdates(_0x343a4b[_0x8a42('0x5a')],null))['then'](respondWithResult(_0x5a9a9d,null))['catch'](handleError(_0x5a9a9d,null));};exports[_0x8a42('0x61')]=function(_0x8b1d9b,_0x57995b){return db[_0x8a42('0x50')][_0x8a42('0x58')]({'where':{'id':_0x8b1d9b[_0x8a42('0x56')]['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x57995b,null))[_0x8a42('0x33')](removeEntity(_0x57995b,null))['catch'](handleError(_0x57995b,null));};exports[_0x8a42('0x62')]=function(_0x4dc77b,_0x4cdf84){return db[_0x8a42('0x50')][_0x8a42('0x62')]()['then'](respondWithResult(_0x4cdf84,null))['catch'](handleError(_0x4cdf84,null));};exports[_0x8a42('0x63')]=function(_0x4cb7bd,_0xffe94b,_0x3e0380){if(_0x4cb7bd[_0x8a42('0x5a')]['id']){delete _0x4cb7bd['body']['id'];}return db['OpenchannelAccount'][_0x8a42('0x58')]({'where':{'id':_0x4cb7bd['params']['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0xffe94b,null))[_0x8a42('0x33')](function(_0x3abd41){if(_0x3abd41){_0x4cb7bd['body'][_0x8a42('0x64')]=_0x3abd41['id'];return db[_0x8a42('0x65')][_0x8a42('0x59')](_0x4cb7bd[_0x8a42('0x5a')]);}})['then'](respondWithResult(_0xffe94b,null))[_0x8a42('0x2a')](handleError(_0xffe94b,null));};exports['getDispositions']=function(_0x22c84f,_0x238574,_0x4e19cc){var _0x176bf5={'raw':![],'where':{}};var _0x1157f9={};var _0x4964c8={'count':0x0,'rows':[]};return db[_0x8a42('0x50')][_0x8a42('0x66')]({'where':{'id':_0x22c84f['params']['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x238574,null))[_0x8a42('0x33')](function(_0x39f350){if(_0x39f350){_0x1157f9['model']=_['keys'](db[_0x8a42('0x65')][_0x8a42('0x3d')]);_0x1157f9[_0x8a42('0x40')]=_[_0x8a42('0x41')](_0x22c84f[_0x8a42('0x40')]);_0x1157f9[_0x8a42('0x42')]=_['intersection'](_0x1157f9[_0x8a42('0x44')],_0x1157f9['query']);_0x176bf5[_0x8a42('0x45')]=_[_0x8a42('0x43')](_0x1157f9[_0x8a42('0x44')],qs[_0x8a42('0x46')](_0x22c84f[_0x8a42('0x40')]['fields']));_0x176bf5[_0x8a42('0x45')]=_0x176bf5[_0x8a42('0x45')][_0x8a42('0x47')]?_0x176bf5[_0x8a42('0x45')]:_0x1157f9['model'];if(!_0x22c84f[_0x8a42('0x40')][_0x8a42('0x48')](_0x8a42('0x67'))){_0x176bf5[_0x8a42('0x2f')]=qs['limit'](_0x22c84f[_0x8a42('0x40')][_0x8a42('0x2f')]);_0x176bf5['offset']=qs[_0x8a42('0x2d')](_0x22c84f[_0x8a42('0x40')][_0x8a42('0x2d')]);}_0x176bf5['order']=qs[_0x8a42('0x4a')](_0x22c84f[_0x8a42('0x40')][_0x8a42('0x4a')]);_0x176bf5[_0x8a42('0x4b')]=qs['filters'](_['pick'](_0x22c84f[_0x8a42('0x40')],_0x1157f9['filters']));_0x176bf5[_0x8a42('0x4b')][_0x8a42('0x64')]=_0x39f350['id'];if(_0x22c84f['query']['filter']){_0x176bf5[_0x8a42('0x4b')]=_[_0x8a42('0x4d')](_0x176bf5[_0x8a42('0x4b')],{'$or':_['map'](_0x176bf5[_0x8a42('0x45')],function(_0x303aad){var _0x1462a6={};_0x1462a6[_0x303aad]={'$like':'%'+_0x22c84f[_0x8a42('0x40')][_0x8a42('0x4c')]+'%'};return _0x1462a6;})});}_0x176bf5=_['merge']({},_0x176bf5,_0x22c84f[_0x8a42('0x4f')]);return db[_0x8a42('0x65')][_0x8a42('0x51')]({'where':_0x176bf5[_0x8a42('0x4b')]})[_0x8a42('0x33')](function(_0x873116){_0x4964c8[_0x8a42('0x51')]=_0x873116;if(_0x22c84f['query'][_0x8a42('0x52')]){_0x176bf5[_0x8a42('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x176bf5);})[_0x8a42('0x33')](function(_0x39786a){_0x4964c8['rows']=_0x39786a;return _0x4964c8;});}})[_0x8a42('0x33')](respondWithFilteredResult(_0x238574,_0x176bf5))[_0x8a42('0x2a')](handleError(_0x238574,null));};exports['removeDispositions']=function(_0x10d3fe,_0x48dff9,_0x60fb0f){return db[_0x8a42('0x50')]['find']({'where':{'id':_0x10d3fe[_0x8a42('0x56')]['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x48dff9,null))[_0x8a42('0x33')](function(_0x40febd){if(_0x40febd){return _0x40febd[_0x8a42('0x68')](_0x10d3fe[_0x8a42('0x40')][_0x8a42('0x69')]);}})['then'](respondWithStatusCode(_0x48dff9,null))['catch'](handleError(_0x48dff9,null));};exports[_0x8a42('0x6a')]=function(_0x2e16a1,_0x389d5b,_0x96291a){if(_0x2e16a1[_0x8a42('0x5a')]['id']){delete _0x2e16a1[_0x8a42('0x5a')]['id'];}return db[_0x8a42('0x50')][_0x8a42('0x58')]({'where':{'id':_0x2e16a1['params']['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x389d5b,null))[_0x8a42('0x33')](function(_0x48131e){if(_0x48131e){_0x2e16a1[_0x8a42('0x5a')][_0x8a42('0x64')]=_0x48131e['id'];return db['CannedAnswer'][_0x8a42('0x59')](_0x2e16a1[_0x8a42('0x5a')]);}})[_0x8a42('0x33')](respondWithResult(_0x389d5b,null))[_0x8a42('0x2a')](handleError(_0x389d5b,null));};exports[_0x8a42('0x6b')]=function(_0xab03b7,_0x441eef,_0x4f1070){var _0x579f39={'raw':![],'where':{}};var _0x55da1c={};var _0x50c088={'count':0x0,'rows':[]};return db[_0x8a42('0x50')][_0x8a42('0x66')]({'where':{'id':_0xab03b7['params']['id']}})['then'](handleEntityNotFound(_0x441eef,null))['then'](function(_0xacad55){if(_0xacad55){_0x55da1c['model']=_[_0x8a42('0x41')](db['CannedAnswer']['rawAttributes']);_0x55da1c['query']=_[_0x8a42('0x41')](_0xab03b7[_0x8a42('0x40')]);_0x55da1c['filters']=_['intersection'](_0x55da1c[_0x8a42('0x44')],_0x55da1c[_0x8a42('0x40')]);_0x579f39['attributes']=_[_0x8a42('0x43')](_0x55da1c[_0x8a42('0x44')],qs[_0x8a42('0x46')](_0xab03b7[_0x8a42('0x40')][_0x8a42('0x46')]));_0x579f39[_0x8a42('0x45')]=_0x579f39['attributes']['length']?_0x579f39['attributes']:_0x55da1c[_0x8a42('0x44')];if(!_0xab03b7[_0x8a42('0x40')]['hasOwnProperty'](_0x8a42('0x67'))){_0x579f39['limit']=qs[_0x8a42('0x2f')](_0xab03b7[_0x8a42('0x40')][_0x8a42('0x2f')]);_0x579f39[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0xab03b7['query']['offset']);}_0x579f39[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0xab03b7[_0x8a42('0x40')][_0x8a42('0x4a')]);_0x579f39[_0x8a42('0x4b')]=qs[_0x8a42('0x42')](_['pick'](_0xab03b7[_0x8a42('0x40')],_0x55da1c[_0x8a42('0x42')]));_0x579f39['where']['OpenchannelAccountId']=_0xacad55['id'];if(_0xab03b7[_0x8a42('0x40')]['filter']){_0x579f39['where']=_[_0x8a42('0x4d')](_0x579f39[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3c')](_0x579f39[_0x8a42('0x45')],function(_0x515b6c){var _0xce7860={};_0xce7860[_0x515b6c]={'$like':'%'+_0xab03b7['query']['filter']+'%'};return _0xce7860;})});}_0x579f39=_[_0x8a42('0x4d')]({},_0x579f39,_0xab03b7[_0x8a42('0x4f')]);return db[_0x8a42('0x6c')][_0x8a42('0x51')]({'where':_0x579f39[_0x8a42('0x4b')]})[_0x8a42('0x33')](function(_0x341de2){_0x50c088[_0x8a42('0x51')]=_0x341de2;if(_0xab03b7['query'][_0x8a42('0x52')]){_0x579f39['include']=[{'all':!![]}];}return db[_0x8a42('0x6c')][_0x8a42('0x54')](_0x579f39);})['then'](function(_0x3e878f){_0x50c088['rows']=_0x3e878f;return _0x50c088;});}})[_0x8a42('0x33')](respondWithFilteredResult(_0x441eef,_0x579f39))[_0x8a42('0x2a')](handleError(_0x441eef,null));};exports[_0x8a42('0x6d')]=function(_0x29e805,_0x12f8d1,_0x3877e5){return db['OpenchannelAccount'][_0x8a42('0x58')]({'where':{'id':_0x29e805['params']['id']}})['then'](handleEntityNotFound(_0x12f8d1,null))[_0x8a42('0x33')](function(_0x33e71d){if(_0x33e71d){return _0x33e71d[_0x8a42('0x6d')](_0x29e805['query']['ids']);}})[_0x8a42('0x33')](respondWithStatusCode(_0x12f8d1,null))['catch'](handleError(_0x12f8d1,null));};exports[_0x8a42('0x6e')]=function(_0xbea46d,_0x1546cb,_0x5b24bb){var _0x2cd577={'body':_0xbea46d['body'],'channel':'openchannel'};var _0x563537=[];var _0x58ba02=[];var _0x2b5aba={};var _0x13ef8d=![];return db['CmContact'][_0x8a42('0x62')]()[_0x8a42('0x33')](function(_0xaf935d){if(!_0xaf935d){throw new db[(_0x8a42('0x6f'))][(_0x8a42('0x70'))](_0x8a42('0x71'));}_0x563537=_[_0x8a42('0x72')](_[_0x8a42('0x41')](_0xaf935d),[_0x8a42('0x73'),_0x8a42('0x74')]);_0x58ba02=_[_0x8a42('0x72')](_[_0x8a42('0x41')](_0xaf935d),[_0x8a42('0x73'),'updatedAt',_0x8a42('0x75'),_0x8a42('0x76')]);if(_0xbea46d[_0x8a42('0x5a')]['id']){delete _0xbea46d[_0x8a42('0x5a')]['id'];}if(_[_0x8a42('0x77')](_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x78')])){throw new db[(_0x8a42('0x6f'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x8a42('0x77')](_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x5a')])||_0xbea46d[_0x8a42('0x5a')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x79')])){throw new db[(_0x8a42('0x6f'))][(_0x8a42('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58ba02);}if(!_[_0x8a42('0x7a')](_0x58ba02,_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x79')])){throw new db['Sequelize'][(_0x8a42('0x70'))](_0x8a42('0x7b')+_0x58ba02);}_0x2b5aba[_0xbea46d['body'][_0x8a42('0x79')]]=_0xbea46d['body'][_0x8a42('0x78')];})[_0x8a42('0x33')](function(){return db['OpenchannelAccount'][_0x8a42('0x58')]({'where':{'id':_0xbea46d['params']['id']},'include':[{'model':db['CmList'],'as':_0x8a42('0x7c'),'include':[{'model':db['CmContact'],'as':_0x8a42('0x7d'),'where':_0x2b5aba,'limit':0x1,'order':[[_0x8a42('0x74'),_0x8a42('0x7e')]]}]},{'model':db[_0x8a42('0x7f')],'as':_0x8a42('0x80')}]});})['then'](handleEntityNotFound(_0x1546cb,null))[_0x8a42('0x33')](function(_0xe5e7f0){if(_0xe5e7f0&&_0xe5e7f0['List']){_0x2cd577[_0x8a42('0x81')]=_0xe5e7f0;_0x2cd577[_0x8a42('0x82')]=_0xe5e7f0[_0x8a42('0x80')];_0x2cd577[_0x8a42('0x83')]=_0xe5e7f0[_0x8a42('0x7c')];_0x2cd577[_0x8a42('0x82')]=_[_0x8a42('0x84')](_0x2cd577[_0x8a42('0x82')],[_0x8a42('0x85')],[_0x8a42('0x86')]);if(_0x2cd577[_0x8a42('0x81')]['Applications']){delete _0x2cd577[_0x8a42('0x81')][_0x8a42('0x80')];}if(_0x2cd577[_0x8a42('0x81')][_0x8a42('0x7c')]&&_0x2cd577[_0x8a42('0x81')][_0x8a42('0x7c')][_0x8a42('0x7d')][_0x8a42('0x47')]){return _0x2cd577['account'][_0x8a42('0x7c')][_0x8a42('0x7d')][0x0];}var _0x59b735=_[_0x8a42('0x87')](_0xbea46d['body'],{'firstName':_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x78')],'ListId':_0xe5e7f0['ListId']});_0x59b735[_0xbea46d[_0x8a42('0x5a')]['mapKey']]=_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x78')];return db[_0x8a42('0x88')][_0x8a42('0x59')](_0x59b735,{'fields':_0x563537,'raw':!![]});}})[_0x8a42('0x33')](handleEntityNotFound(_0x1546cb,null))[_0x8a42('0x33')](function(_0x4aa060){_0x2cd577['contact']=_0x4aa060;if(_0x4aa060){var _0x123f4a={'ContactId':_0x4aa060['id'],'OpenchannelAccountId':_0xbea46d[_0x8a42('0x56')]['id'],'from':(_0x4aa060[_0x8a42('0x89')]||'')+'\x20'+(_0x4aa060['lastName']||'')};var _0x451e1c={'OpenchannelAccountId':_0xbea46d[_0x8a42('0x56')]['id'],'closed':![]};if(_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x8a')]){_0x451e1c[_0x8a42('0x8a')]=_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x8a')];return db[_0x8a42('0x8b')][_0x8a42('0x58')]({'where':_0x451e1c})[_0x8a42('0x33')](function(_0x59d674){if(_0x59d674){return[_0x59d674,![]];}_0x123f4a['threadId']=_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x8a')];_0x123f4a[_0x8a42('0x8c')]=_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x8c')];return db[_0x8a42('0x8b')]['create'](_0x123f4a)[_0x8a42('0x33')](function(_0x26f611){return[_0x26f611,!![]];});});}else{_0x451e1c[_0x8a42('0x8a')]=null;}_0x451e1c[_0x8a42('0x8d')]=_0x4aa060['id'];return db[_0x8a42('0x8b')]['find']({'where':_0x451e1c})[_0x8a42('0x33')](function(_0x5eb819){if(_0x5eb819){return[_0x5eb819,![]];}return db[_0x8a42('0x8b')][_0x8a42('0x59')](_0x123f4a)[_0x8a42('0x33')](function(_0x2186d7){return[_0x2186d7,!![]];});});}})[_0x8a42('0x8e')](function(_0x429025,_0x50236a){if(_0x429025){_0x13ef8d=_0x50236a;if(!_0x50236a){var _0x1dffca={'from':(_0x2cd577[_0x8a42('0x8f')][_0x8a42('0x89')]||'')+'\x20'+(_0x2cd577[_0x8a42('0x8f')][_0x8a42('0x90')]||'')};if(_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x8a')]&&_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x91')]&&_0xbea46d['body'][_0x8a42('0x8a')]!=_0xbea46d['body']['messageId']){_0x1dffca['threadId']=_0xbea46d['body'][_0x8a42('0x91')];}return _0x429025['update'](_0x1dffca);}else{return _0x429025;}}})[_0x8a42('0x33')](function(_0x4f3173){_0x2cd577[_0x8a42('0x92')]=_0x4f3173[_0x8a42('0x5c')]({'plain':!![]});_0x2cd577['interaction'][_0x8a42('0x93')]=_0x13ef8d;if(_0x2cd577['interaction'][_0x8a42('0x93')]){if(_0x2cd577[_0x8a42('0x81')]['autoclose']){_0x2cd577[_0x8a42('0x82')][_0x8a42('0x94')]({'id':0x0,'priority':_0x2cd577['applications']['length']+0x1,'app':_0x8a42('0x95'),'appdata':_0x8a42('0x96'),'interval':'*,*,*,*'});}}return db[_0x8a42('0x97')][_0x8a42('0x59')]({'body':_0xbea46d[_0x8a42('0x5a')][_0x8a42('0x5a')],'OpenchannelAccountId':_0xbea46d[_0x8a42('0x56')]['id'],'OpenchannelInteractionId':_0x4f3173['id'],'direction':'in','ContactId':_0x2cd577[_0x8a42('0x8f')]['id'],'AttachmentId':_0xbea46d['body'][_0x8a42('0x98')]});})[_0x8a42('0x33')](function(_0x275768){_0x2cd577[_0x8a42('0x27')]=_0x275768;if(!_0x2cd577[_0x8a42('0x92')]['UserId'])return;return db[_0x8a42('0x99')]['find']({'attributes':['id',_0x8a42('0x38')],'where':{'id':_0x2cd577['interaction'][_0x8a42('0x9a')]}});})[_0x8a42('0x33')](function(_0x3f4185){if(_0x3f4185){_0x2cd577[_0x8a42('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f4185[_0x8a42('0x38')]+','+(_0x2cd577['account'][_0x8a42('0x9b')]||0xa),'interval':_0x8a42('0x9c')});}if(!_0x2cd577[_0x8a42('0x92')][_0x8a42('0x9d')])return;return db[_0x8a42('0x9e')][_0x8a42('0x58')]({'attributes':['id',_0x8a42('0x38')],'where':{'id':_0x2cd577[_0x8a42('0x92')][_0x8a42('0x9d')]}});})[_0x8a42('0x33')](function(_0x14f1b9){if(_0x14f1b9){_0x2cd577[_0x8a42('0x82')][_0x8a42('0x9f')]({'id':0x0,'priority':0x1,'app':_0x8a42('0xa0'),'appdata':_0x14f1b9[_0x8a42('0x38')]+','+(_0x2cd577[_0x8a42('0x81')][_0x8a42('0xa1')]||0x12c),'interval':_0x8a42('0x9c')});}return respondWithRpcPromise(_0x8a42('0xa2'),'startRouting',_0x2cd577);})['then'](function(_0x321ba3){respondWithRpcPromise(_0x8a42('0xa3'),_0x8a42('0xa3'),{'event':'notify','message':_0x321ba3},client9002);return _0x321ba3;})[_0x8a42('0x33')](respondWithResult(_0x1546cb,null))[_0x8a42('0x2a')](handleError(_0x1546cb,null));};exports[_0x8a42('0xa4')]=function(_0x451fe2,_0x3e4ead){var _0x172f7f=_0x451fe2[_0x8a42('0x56')]['id'];var _0x551754=_0x451fe2[_0x8a42('0x5a')];var _0x39b022=0xc8;var _0x2fcf63=null;return db['sequelize'][_0x8a42('0xa5')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5c478f){return db[_0x8a42('0x50')][_0x8a42('0x66')]({'where':{'id':_0x172f7f},'transaction':_0x5c478f})[_0x8a42('0x33')](function(_0xad8cc6){if(_0xad8cc6){return db[_0x8a42('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x172f7f},'transaction':_0x5c478f})[_0x8a42('0x33')](function(){var _0x403694=_[_0x8a42('0x3c')](_0x551754,function(_0x5161ed){_0x5161ed['OpenchannelAccountId']=_0x172f7f;return _0x5161ed;});return db[_0x8a42('0x7f')][_0x8a42('0xa6')](_0x403694,{'transaction':_0x5c478f});});}else{_0x39b022=0x194;_0x2fcf63=[];}});})['then'](function(){if(_0x39b022!==0x194){return db[_0x8a42('0x7f')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x172f7f},'order':_0x8a42('0x85')})[_0x8a42('0x33')](function(_0x43a16e){_0x2fcf63=_0x43a16e;});}})[_0x8a42('0x2a')](function(_0x52689e){_0x39b022=0x1f4;logger[_0x8a42('0x25')](_0x52689e[_0x8a42('0x37')]);if(_0x52689e[_0x8a42('0x38')]){delete _0x52689e[_0x8a42('0x38')];}_0x2fcf63=_0x52689e;})['finally'](function(){if(_0x2fcf63===null){_0x3e4ead[_0x8a42('0x36')](_0x39b022);}else{if(_0x39b022===0x1f4){_0x3e4ead[_0x8a42('0xa7')](_0x39b022)[_0x8a42('0x39')](_0x2fcf63);}else{_0x3e4ead[_0x8a42('0xa7')](_0x39b022)[_0x8a42('0x2c')](_0x2fcf63);}}});};exports[_0x8a42('0xa8')]=function(_0x4121ff,_0x35d166,_0x57ec50){var _0x1070f1={};var _0x5943d8={};var _0x4e987c;var _0x37e300;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4121ff[_0x8a42('0x56')]['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x35d166,null))[_0x8a42('0x33')](function(_0x50fd0a){if(_0x50fd0a){_0x4e987c=_0x50fd0a;_0x5943d8[_0x8a42('0x44')]=_['keys'](db['OpenchannelApplication'][_0x8a42('0x3d')]);_0x5943d8['query']=_[_0x8a42('0x41')](_0x4121ff[_0x8a42('0x40')]);_0x5943d8[_0x8a42('0x42')]=_[_0x8a42('0x43')](_0x5943d8[_0x8a42('0x44')],_0x5943d8[_0x8a42('0x40')]);_0x1070f1[_0x8a42('0x45')]=_['intersection'](_0x5943d8['model'],qs[_0x8a42('0x46')](_0x4121ff[_0x8a42('0x40')][_0x8a42('0x46')]));_0x1070f1['attributes']=_0x1070f1['attributes']['length']?_0x1070f1[_0x8a42('0x45')]:_0x5943d8[_0x8a42('0x44')];_0x1070f1['order']=qs[_0x8a42('0x4a')](_0x4121ff[_0x8a42('0x40')][_0x8a42('0x4a')]);_0x1070f1[_0x8a42('0x4b')]=qs['filters'](_[_0x8a42('0xa9')](_0x4121ff[_0x8a42('0x40')],_0x5943d8[_0x8a42('0x42')]));if(_0x4121ff[_0x8a42('0x40')][_0x8a42('0x4c')]){_0x1070f1[_0x8a42('0x4b')]=_[_0x8a42('0x4d')](_0x1070f1[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3c')](_0x1070f1[_0x8a42('0x45')],function(_0x266dac){var _0x29e74b={};_0x29e74b[_0x266dac]={'$like':'%'+_0x4121ff[_0x8a42('0x40')]['filter']+'%'};return _0x29e74b;})});}_0x1070f1=_[_0x8a42('0x4d')]({},_0x1070f1,_0x4121ff[_0x8a42('0x4f')]);return _0x4e987c[_0x8a42('0xa8')](_0x1070f1);}})[_0x8a42('0x33')](function(_0x51eed5){if(_0x51eed5){_0x37e300=_0x51eed5['length'];if(!_0x4121ff[_0x8a42('0x40')][_0x8a42('0x48')](_0x8a42('0x67'))){_0x1070f1[_0x8a42('0x2f')]=qs[_0x8a42('0x2f')](_0x4121ff[_0x8a42('0x40')][_0x8a42('0x2f')]);_0x1070f1[_0x8a42('0x2d')]=qs['offset'](_0x4121ff[_0x8a42('0x40')]['offset']);}return _0x4e987c[_0x8a42('0xa8')](_0x1070f1);}})[_0x8a42('0x33')](function(_0x5c6116){if(_0x5c6116){return _0x5c6116?{'count':_0x37e300,'rows':_0x5c6116}:null;}})[_0x8a42('0x33')](respondWithResult(_0x35d166,null))['catch'](handleError(_0x35d166,null));};exports[_0x8a42('0xaa')]=function(_0x1f0932,_0x46c2fc,_0x5f3d90){var _0x5e80b6={'raw':![],'where':{}};var _0x238623={};var _0x369dca={'count':0x0,'rows':[]};return db[_0x8a42('0x50')]['findOne']({'where':{'id':_0x1f0932[_0x8a42('0x56')]['id']}})['then'](handleEntityNotFound(_0x46c2fc,null))['then'](function(_0x44d0b5){if(_0x44d0b5){_0x238623['model']=_[_0x8a42('0x41')](db[_0x8a42('0x8b')][_0x8a42('0x3d')]);_0x238623[_0x8a42('0x40')]=_[_0x8a42('0x41')](_0x1f0932['query']);_0x238623[_0x8a42('0x42')]=_[_0x8a42('0x43')](_0x238623[_0x8a42('0x44')],_0x238623[_0x8a42('0x40')]);_0x5e80b6[_0x8a42('0x45')]=_[_0x8a42('0x43')](_0x238623['model'],qs[_0x8a42('0x46')](_0x1f0932[_0x8a42('0x40')][_0x8a42('0x46')]));_0x5e80b6['attributes']=_0x5e80b6[_0x8a42('0x45')][_0x8a42('0x47')]?_0x5e80b6[_0x8a42('0x45')]:_0x238623[_0x8a42('0x44')];if(!_0x1f0932['query'][_0x8a42('0x48')]('nolimit')){_0x5e80b6[_0x8a42('0x2f')]=qs['limit'](_0x1f0932[_0x8a42('0x40')][_0x8a42('0x2f')]);_0x5e80b6[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x1f0932['query']['offset']);}_0x5e80b6[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x1f0932['query'][_0x8a42('0x4a')]);_0x5e80b6['where']=qs[_0x8a42('0x42')](_['pick'](_0x1f0932[_0x8a42('0x40')],_0x238623[_0x8a42('0x42')]));_0x5e80b6[_0x8a42('0x4b')][_0x8a42('0x64')]=_0x44d0b5['id'];if(_0x1f0932[_0x8a42('0x40')][_0x8a42('0x4c')]){_0x5e80b6[_0x8a42('0x4b')]=_[_0x8a42('0x4d')](_0x5e80b6['where'],{'$or':_[_0x8a42('0x3c')](_0x5e80b6[_0x8a42('0x45')],function(_0x7a236a){var _0x2e6d4f={};_0x2e6d4f[_0x7a236a]={'$like':'%'+_0x1f0932[_0x8a42('0x40')][_0x8a42('0x4c')]+'%'};return _0x2e6d4f;})});}_0x5e80b6=_[_0x8a42('0x4d')]({},_0x5e80b6,_0x1f0932['options']);return db[_0x8a42('0x8b')][_0x8a42('0x51')]({'where':_0x5e80b6[_0x8a42('0x4b')]})[_0x8a42('0x33')](function(_0x19ed9c){_0x369dca['count']=_0x19ed9c;if(_0x1f0932[_0x8a42('0x40')]['includeAll']){_0x5e80b6[_0x8a42('0x53')]=[{'model':db['CmContact'],'as':_0x8a42('0xab'),'required':![]},{'model':db[_0x8a42('0x99')],'as':_0x8a42('0xac'),'attributes':[_0x8a42('0x38'),_0x8a42('0xad'),_0x8a42('0xae')],'required':![]},{'model':db['Tag'],'as':_0x8a42('0xaf'),'attributes':['id','name',_0x8a42('0xb0')],'where':_0x1f0932['query'][_0x8a42('0xb1')]?{'id':_0x1f0932[_0x8a42('0x40')][_0x8a42('0xb1')]}:undefined,'required':_0x1f0932['query']['tag']?!![]:![]}];}return db[_0x8a42('0x8b')]['findAll'](_0x5e80b6);})[_0x8a42('0x33')](function(_0x5e11ee){_0x369dca['rows']=_0x5e11ee;return _0x369dca;});}})[_0x8a42('0x33')](respondWithFilteredResult(_0x46c2fc,_0x5e80b6))['catch'](handleError(_0x46c2fc,null));};exports[_0x8a42('0xb2')]=function(_0x39e15a,_0x4bcfd0,_0x131712){return db[_0x8a42('0x50')]['find']({'where':{'id':_0x39e15a[_0x8a42('0x56')]['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0x4bcfd0,null))[_0x8a42('0x33')](function(_0x2dce41){if(_0x2dce41){return _0x2dce41[_0x8a42('0xb2')](_0x39e15a[_0x8a42('0x5a')][_0x8a42('0x69')],_[_0x8a42('0xb3')](_0x39e15a['body'],[_0x8a42('0x69'),'id'])||{})[_0x8a42('0x8e')](function(_0x9e8a86){for(var _0x1f214d=0x0;_0x1f214d<_0x39e15a['body'][_0x8a42('0x69')][_0x8a42('0x47')];_0x1f214d+=0x1){socket['emit'](_0x8a42('0xb4'),{'UserId':Number(_0x39e15a[_0x8a42('0x5a')]['ids'][_0x1f214d]),'OpenchannelAccountId':Number(_0x39e15a[_0x8a42('0x56')]['id'])});}return _0x9e8a86;});}})[_0x8a42('0x33')](respondWithResult(_0x4bcfd0,null))[_0x8a42('0x2a')](handleError(_0x4bcfd0,null));};exports[_0x8a42('0xb5')]=function(_0x368bc2,_0x1008ae,_0x4ac22f){return db[_0x8a42('0x50')][_0x8a42('0x58')]({'where':{'id':_0x368bc2[_0x8a42('0x56')]['id']}})['then'](handleEntityNotFound(_0x1008ae,null))[_0x8a42('0x33')](function(_0x153434){if(_0x153434){return _0x153434[_0x8a42('0xb5')](_0x368bc2[_0x8a42('0x40')][_0x8a42('0x69')])[_0x8a42('0x33')](function(){if(_[_0x8a42('0xb6')](_0x368bc2[_0x8a42('0x40')][_0x8a42('0x69')])){for(var _0x2b3da5=0x0;_0x2b3da5<_0x368bc2['query']['ids'][_0x8a42('0x47')];_0x2b3da5+=0x1){socket[_0x8a42('0xb7')](_0x8a42('0xb8'),{'UserId':Number(_0x368bc2[_0x8a42('0x40')][_0x8a42('0x69')][_0x2b3da5]),'OpenchannelAccountId':Number(_0x368bc2[_0x8a42('0x56')]['id'])});}}else{socket['emit'](_0x8a42('0xb8'),{'UserId':Number(_0x368bc2[_0x8a42('0x40')][_0x8a42('0x69')]),'OpenchannelAccountId':Number(_0x368bc2[_0x8a42('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1008ae,null))[_0x8a42('0x2a')](handleError(_0x1008ae,null));};exports[_0x8a42('0xb9')]=function(_0x44bd1e,_0x5a9187,_0x349b0a){var _0x287edb={};var _0x58fd9a={};var _0xd0137d;var _0x3782e;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x44bd1e['params']['id']}})['then'](handleEntityNotFound(_0x5a9187,null))['then'](function(_0x45aaa9){if(_0x45aaa9){_0xd0137d=_0x45aaa9;_0x58fd9a[_0x8a42('0x44')]=_[_0x8a42('0x41')](db[_0x8a42('0x99')][_0x8a42('0x3d')]);_0x58fd9a['query']=_[_0x8a42('0x41')](_0x44bd1e[_0x8a42('0x40')]);_0x58fd9a[_0x8a42('0x42')]=_['intersection'](_0x58fd9a[_0x8a42('0x44')],_0x58fd9a[_0x8a42('0x40')]);_0x287edb[_0x8a42('0x45')]=_[_0x8a42('0x43')](_0x58fd9a[_0x8a42('0x44')],qs[_0x8a42('0x46')](_0x44bd1e[_0x8a42('0x40')][_0x8a42('0x46')]));_0x287edb[_0x8a42('0x45')]=_0x287edb[_0x8a42('0x45')][_0x8a42('0x47')]?_0x287edb['attributes']:_0x58fd9a[_0x8a42('0x44')];_0x287edb[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x44bd1e[_0x8a42('0x40')][_0x8a42('0x4a')]);_0x287edb[_0x8a42('0x4b')]=qs[_0x8a42('0x42')](_['pick'](_0x44bd1e['query'],_0x58fd9a['filters']));if(_0x44bd1e[_0x8a42('0x40')][_0x8a42('0x4c')]){_0x287edb[_0x8a42('0x4b')]=_[_0x8a42('0x4d')](_0x287edb[_0x8a42('0x4b')],{'$or':_['map'](_0x287edb[_0x8a42('0x45')],function(_0x5ecd4a){var _0x1196d6={};_0x1196d6[_0x5ecd4a]={'$like':'%'+_0x44bd1e[_0x8a42('0x40')][_0x8a42('0x4c')]+'%'};return _0x1196d6;})});}_0x287edb=_[_0x8a42('0x4d')]({},_0x287edb,_0x44bd1e[_0x8a42('0x4f')]);return _0xd0137d[_0x8a42('0xb9')](_0x287edb);}})[_0x8a42('0x33')](function(_0x493b57){if(_0x493b57){_0x3782e=_0x493b57['length'];if(!_0x44bd1e['query'][_0x8a42('0x48')](_0x8a42('0x67'))){_0x287edb['limit']=qs[_0x8a42('0x2f')](_0x44bd1e[_0x8a42('0x40')]['limit']);_0x287edb[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x44bd1e[_0x8a42('0x40')]['offset']);}return _0xd0137d[_0x8a42('0xb9')](_0x287edb);}})['then'](function(_0x48a3e2){if(_0x48a3e2){return _0x48a3e2?{'count':_0x3782e,'rows':_0x48a3e2}:null;}})[_0x8a42('0x33')](respondWithResult(_0x5a9187,null))['catch'](handleError(_0x5a9187,null));};exports[_0x8a42('0x39')]=function(_0x120afe,_0xc14f2f,_0x50dfb8){var _0x166fca,_0x1ea56e,_0x58047;if(_[_0x8a42('0x77')](_0x120afe['body'][_0x8a42('0x5a')])||_0x120afe['body'][_0x8a42('0x5a')]===''){throw new db[(_0x8a42('0x6f'))][(_0x8a42('0x70'))](_0x8a42('0xba'));}if(_[_0x8a42('0x77')](_0x120afe[_0x8a42('0x5a')]['to'])){}_0x166fca=_0x120afe[_0x8a42('0x5a')]['to'];return db['OpenchannelAccount'][_0x8a42('0x66')]({'where':{'id':_0x120afe[_0x8a42('0x56')]['id']}})[_0x8a42('0x33')](handleEntityNotFound(_0xc14f2f,null))[_0x8a42('0x33')](function(_0x3ca6ea){if(_0x3ca6ea){return db['OpenchannelAccount'][_0x8a42('0x58')]({'where':{'id':_0x3ca6ea['id']},'include':[{'model':db[_0x8a42('0xbb')],'as':'List','include':[{'model':db[_0x8a42('0x88')],'as':_0x8a42('0x7d'),'where':{[_0x3ca6ea[_0x8a42('0x79')]]:_0x166fca},'limit':0x1,'order':[[_0x8a42('0x74'),_0x8a42('0x7e')]]}]}]})[_0x8a42('0x33')](handleEntityNotFound(_0xc14f2f,null))[_0x8a42('0x33')](function(_0x289b8d){if(_0x289b8d&&_0x289b8d[_0x8a42('0x7c')]){_0x1ea56e=_0x289b8d['get']({'plain':!![]});if(_0x1ea56e[_0x8a42('0x7c')]&&_0x1ea56e[_0x8a42('0x7c')][_0x8a42('0x7d')][_0x8a42('0x47')]){return _0x1ea56e[_0x8a42('0x7c')][_0x8a42('0x7d')][0x0];}return db['CmContact'][_0x8a42('0x59')](_[_0x8a42('0x87')](_0x120afe[_0x8a42('0x5a')],{'firstName':_0x166fca,[_0x289b8d[_0x8a42('0x79')]]:_0x166fca,'phone':_0x166fca,'ListId':_0x1ea56e['ListId']}));}})[_0x8a42('0x33')](handleEntityNotFound(_0xc14f2f,null))['then'](function(_0x368014){if(_0x368014){_0x58047=_0x368014;return db[_0x8a42('0x8b')][_0x8a42('0x58')]({'where':{'ContactId':_0x58047['id'],'closed':![],'OpenchannelAccountId':_0x1ea56e['id']}})[_0x8a42('0x33')](function(_0x34b37b){if(_0x34b37b){return[_0x34b37b,![]];}return db[_0x8a42('0x8b')]['create']({'UserId':_0x120afe[_0x8a42('0x5b')]['id'],'ContactId':_0x58047['id'],'OpenchannelAccountId':_0x1ea56e['id'],'lastMsgDirection':_0x8a42('0xbc'),'firstMsgDirection':'out','Messages':[_['merge'](_0x120afe[_0x8a42('0x5a')],{'read':![],'body':_0x120afe[_0x8a42('0x5a')]['body'],'OpenchannelAccountId':_0x1ea56e['id'],'UserId':_0x120afe[_0x8a42('0x5b')]['id'],'ContactId':_0x58047['id']})]},{'include':[{'model':db[_0x8a42('0x97')],'as':'Messages'}]})['then'](function(_0x283251){return[_0x283251,!![]];});});}})['spread'](function(_0x528477,_0x526a81){if(_0x526a81){return _0x528477;}return db[_0x8a42('0x97')][_0x8a42('0x59')](_['merge'](_0x120afe['body'],{'read':![],'body':_0x120afe[_0x8a42('0x5a')][_0x8a42('0x5a')],'OpenchannelAccountId':_0x1ea56e['id'],'OpenchannelInteractionId':_0x528477['id'],'UserId':_0x120afe[_0x8a42('0x5b')]['id'],'ContactId':_0x58047['id']}))[_0x8a42('0x33')](function(_0x199c2e){_0x528477['dataValues'][_0x8a42('0xbd')]=[];_0x528477[_0x8a42('0xbe')][_0x8a42('0xbd')]['push'](_0x199c2e[_0x8a42('0xbe')]);return _0x528477;});});}})[_0x8a42('0x33')](respondWithResult(_0xc14f2f,null))[_0x8a42('0x2a')](handleError(_0xc14f2f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 65d8bb3..893464c 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x0bb5,0x148));var _0x50bb=function(_0x349503,_0x501140){_0x349503=_0x349503-0x0;var _0x1f5890=_0x0bb5[_0x349503];return _0x1f5890;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x59ea2c,_0x13f584){var _0x380cee=function(_0x272274){while(--_0x272274){_0x59ea2c['push'](_0x59ea2c['shift']());}};_0x380cee(++_0x13f584);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3ed405,_0x46352a){_0x3ed405=_0x3ed405-0x0;var _0x5e7a14=_0xf4eb[_0x3ed405];return _0x5e7a14;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](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 1e6393a..0b8ef9f 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(_0x4aa64a,_0x42e726){var _0x29badc=function(_0x2529cf){while(--_0x2529cf){_0x4aa64a['push'](_0x4aa64a['shift']());}};_0x29badc(++_0x42e726);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x483613,_0x2d6e24){var _0x3aad62=function(_0x1d7f99){while(--_0x1d7f99){_0x483613['push'](_0x483613['shift']());}};_0x3aad62(++_0x2d6e24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 c385f77..5c586ef 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 _0xd139=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','register','request','then','request\x20sent'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xd139,0x14e));var _0x9d13=function(_0x314d99,_0xb8c0df){_0x314d99=_0x314d99-0x0;var _0x31d8c4=_0xd139[_0x314d99];return _0x31d8c4;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});config['redis']=_[_0x9d13('0xb')](config['redis'],{'host':_0x9d13('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x9d13('0xd')](socket);function respondWithRpcPromise(_0xba5caa,_0x41eef2,_0x51ac36){return new BPromise(function(_0x135232,_0x5aa0c8){return client[_0x9d13('0xe')](_0xba5caa,_0x51ac36)[_0x9d13('0xf')](function(_0x43a3cc){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x41eef2,_0x9d13('0x10'));logger[_0x9d13('0x11')](_0x9d13('0x12'),_0x41eef2,_0x9d13('0x10'),JSON[_0x9d13('0x13')](_0x43a3cc));if(_0x43a3cc['error']){if(_0x43a3cc['error'][_0x9d13('0x14')]===0x1f4){logger[_0x9d13('0x15')](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x5aa0c8(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}logger['error'](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x135232(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}else{logger[_0x9d13('0x18')](_0x9d13('0x16'),_0x41eef2,_0x9d13('0x10'));_0x135232(_0x43a3cc[_0x9d13('0x19')][_0x9d13('0x17')]);}})[_0x9d13('0x1a')](function(_0x38acaf){logger[_0x9d13('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x41eef2,_0x38acaf);_0x5aa0c8(_0x38acaf);});});} \ No newline at end of file +var _0x2f68=['OpenchannelAccount,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','./openchannelAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x4ae8c0,_0x557e28){var _0x22168e=function(_0x101cd9){while(--_0x101cd9){_0x4ae8c0['push'](_0x4ae8c0['shift']());}};_0x22168e(++_0x557e28);}(_0x2f68,0x9a));var _0x82f6=function(_0x5011a7,_0xcaa606){_0x5011a7=_0x5011a7-0x0;var _0x2722c6=_0x2f68[_0x5011a7];return _0x2722c6;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x82f6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x82f6('0xa'))(new Redis(config[_0x82f6('0xb')]));require(_0x82f6('0xc'))['register'](socket);function respondWithRpcPromise(_0x27db58,_0x432289,_0x4e7c12){return new BPromise(function(_0x1cf88e,_0x1eec2f){return client[_0x82f6('0xd')](_0x27db58,_0x4e7c12)[_0x82f6('0xe')](function(_0x1a68c4){logger[_0x82f6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x432289,_0x82f6('0x10'));logger[_0x82f6('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x432289,_0x82f6('0x10'),JSON[_0x82f6('0x12')](_0x1a68c4));if(_0x1a68c4[_0x82f6('0x13')]){if(_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x14')]===0x1f4){logger[_0x82f6('0x13')](_0x82f6('0x15'),_0x432289,_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);return _0x1eec2f(_0x1a68c4['error'][_0x82f6('0x16')]);}logger['error'](_0x82f6('0x15'),_0x432289,_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);return _0x1cf88e(_0x1a68c4[_0x82f6('0x13')][_0x82f6('0x16')]);}else{logger[_0x82f6('0xf')](_0x82f6('0x15'),_0x432289,_0x82f6('0x10'));_0x1cf88e(_0x1a68c4[_0x82f6('0x17')][_0x82f6('0x16')]);}})[_0x82f6('0x18')](function(_0x1d9091){logger[_0x82f6('0x13')](_0x82f6('0x15'),_0x432289,_0x1d9091);_0x1eec2f(_0x1d9091);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 13d98ee..2ac2c08 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 _0x6c6f=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x40b5c9,_0x27967a){var _0x274fd7=function(_0x3c3478){while(--_0x3c3478){_0x40b5c9['push'](_0x40b5c9['shift']());}};_0x274fd7(++_0x27967a);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x575b69,_0x5aafe6){_0x575b69=_0x575b69-0x0;var _0x49c613=_0x6c6f[_0x575b69];return _0x49c613;};'use strict';var OpenchannelAccountEvents=require(_0xf6c6('0x0'));var events=[_0xf6c6('0x1'),_0xf6c6('0x2'),_0xf6c6('0x3')];function createListener(_0x2f571d,_0x3c8fc3){return function(_0x332916){_0x3c8fc3[_0xf6c6('0x4')](_0x2f571d,_0x332916);};}function removeListener(_0x36fcd2,_0xa1183){return function(){OpenchannelAccountEvents[_0xf6c6('0x5')](_0x36fcd2,_0xa1183);};}exports['register']=function(_0x3b4e7b){for(var _0x4f8e34=0x0,_0x4c27f8=events[_0xf6c6('0x6')];_0x4f8e34<_0x4c27f8;_0x4f8e34++){var _0x5b34df=events[_0x4f8e34];var _0x308c42=createListener(_0xf6c6('0x7')+_0x5b34df,_0x3b4e7b);OpenchannelAccountEvents['on'](_0x5b34df,_0x308c42);}}; \ No newline at end of file +var _0xcb18=['remove','emit','removeListener','register','openchannelAccount:'];(function(_0x43fd1e,_0xed235a){var _0x3f0714=function(_0x383ecd){while(--_0x383ecd){_0x43fd1e['push'](_0x43fd1e['shift']());}};_0x3f0714(++_0xed235a);}(_0xcb18,0x159));var _0x8cb1=function(_0x3e1c96,_0x122aa0){_0x3e1c96=_0x3e1c96-0x0;var _0x18401d=_0xcb18[_0x3e1c96];return _0x18401d;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x8cb1('0x0'),'update'];function createListener(_0x3df352,_0x50513d){return function(_0x5e800d){_0x50513d[_0x8cb1('0x1')](_0x3df352,_0x5e800d);};}function removeListener(_0x87b1d3,_0x15d761){return function(){OpenchannelAccountEvents[_0x8cb1('0x2')](_0x87b1d3,_0x15d761);};}exports[_0x8cb1('0x3')]=function(_0x503927){for(var _0x355d91=0x0,_0x335e41=events['length'];_0x355d91<_0x335e41;_0x355d91++){var _0x186f71=events[_0x355d91];var _0x510e92=createListener(_0x8cb1('0x4')+_0x186f71,_0x503927);OpenchannelAccountEvents['on'](_0x186f71,_0x510e92);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7386e45..0061a57 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 _0x1a4d=['isAuthenticated','put','update','delete','/:id','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','index'];(function(_0x5a4ce5,_0x3bd5ec){var _0x138680=function(_0x3211de){while(--_0x3211de){_0x5a4ce5['push'](_0x5a4ce5['shift']());}};_0x138680(++_0x3bd5ec);}(_0x1a4d,0x137));var _0xd1a4=function(_0x161a4c,_0x59039e){_0x161a4c=_0x161a4c-0x0;var _0x5d5770=_0x1a4d[_0x161a4c];return _0x5d5770;};'use strict';var multer=require(_0xd1a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1a4('0x1'));var express=require('express');var router=express[_0xd1a4('0x2')]();var fs_extra=require(_0xd1a4('0x3'));var auth=require(_0xd1a4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd1a4('0x5'));var controller=require(_0xd1a4('0x6'));router[_0xd1a4('0x7')]('/',auth['isAuthenticated'](),controller[_0xd1a4('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd1a4('0x9')](),controller['create']);router[_0xd1a4('0xa')]('/:id',auth[_0xd1a4('0x9')](),controller[_0xd1a4('0xb')]);router[_0xd1a4('0xc')](_0xd1a4('0xd'),auth[_0xd1a4('0x9')](),controller[_0xd1a4('0xe')]);module[_0xd1a4('0xf')]=router; \ No newline at end of file +var _0xdc5c=['put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','post'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xdc5c,0x1d6));var _0xcdc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcdc5('0x0'));var timeout=require(_0xcdc5('0x1'));var express=require('express');var router=express[_0xcdc5('0x2')]();var fs_extra=require(_0xcdc5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcdc5('0x4'));var config=require('../../config/environment');var controller=require(_0xcdc5('0x5'));router[_0xcdc5('0x6')]('/',auth[_0xcdc5('0x7')](),controller[_0xcdc5('0x8')]);router[_0xcdc5('0x6')]('/:id',auth[_0xcdc5('0x7')](),controller['show']);router[_0xcdc5('0x9')]('/',auth[_0xcdc5('0x7')](),controller['create']);router[_0xcdc5('0xa')](_0xcdc5('0xb'),auth[_0xcdc5('0x7')](),controller[_0xcdc5('0xc')]);router[_0xcdc5('0xd')](_0xcdc5('0xb'),auth[_0xcdc5('0x7')](),controller[_0xcdc5('0xe')]);module[_0xcdc5('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 109a042..09958d5 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 _0x97f9=['sequelize','exports','INTEGER','STRING'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0x97f9,0x1d8));var _0x997f=function(_0x33765c,_0x3f81ac){_0x33765c=_0x33765c-0x0;var _0x2c10ad=_0x97f9[_0x33765c];return _0x2c10ad;};'use strict';var Sequelize=require(_0x997f('0x0'));module[_0x997f('0x1')]={'priority':{'type':Sequelize[_0x997f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x997f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x997f('0x3')]},'interval':{'type':Sequelize[_0x997f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa5eb=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3bacae,_0xcff61e){var _0x30ed9d=function(_0x542554){while(--_0x542554){_0x3bacae['push'](_0x3bacae['shift']());}};_0x30ed9d(++_0xcff61e);}(_0xa5eb,0x15d));var _0xba5e=function(_0x174a0f,_0x3ec6c8){_0x174a0f=_0x174a0f-0x0;var _0x436fbf=_0xa5eb[_0x174a0f];return _0x436fbf;};'use strict';var Sequelize=require(_0xba5e('0x0'));module[_0xba5e('0x1')]={'priority':{'type':Sequelize[_0xba5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xba5e('0x3')],'allowNull':![],'defaultValue':_0xba5e('0x4')},'appdata':{'type':Sequelize[_0xba5e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xba5e('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d14ee9b..98c4fc0 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 _0x381b=['map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x8bab57,_0x3c21a0){var _0x305a68=function(_0x5b565a){while(--_0x5b565a){_0x8bab57['push'](_0x8bab57['shift']());}};_0x305a68(++_0x3c21a0);}(_0x381b,0xfe));var _0xb381=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x381b[_0x1ac6e5];return _0x5877dc;};'use strict';var emlformat=require(_0xb381('0x0'));var rimraf=require(_0xb381('0x1'));var zipdir=require(_0xb381('0x2'));var jsonpatch=require(_0xb381('0x3'));var rp=require(_0xb381('0x4'));var moment=require(_0xb381('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb381('0x6'));var util=require(_0xb381('0x7'));var path=require(_0xb381('0x8'));var sox=require('sox');var csv=require(_0xb381('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb381('0xa'));var _=require(_0xb381('0xb'));var squel=require(_0xb381('0xc'));var crypto=require(_0xb381('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb381('0xe'));var toCsv=require(_0xb381('0x9'));var querystring=require(_0xb381('0xf'));var Papa=require(_0xb381('0x10'));var Redis=require(_0xb381('0x11'));var authService=require(_0xb381('0x12'));var qs=require(_0xb381('0x13'));var as=require(_0xb381('0x14'));var hardwareService=require(_0xb381('0x15'));var logger=require('../../config/logger')(_0xb381('0x16'));var utils=require(_0xb381('0x17'));var config=require(_0xb381('0x18'));var licenseUtil=require(_0xb381('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7bbb,_0x39b79d){_0x39b79d=_0x39b79d||0xcc;return function(_0x551896){if(_0x551896){return _0x2c7bbb['sendStatus'](_0x39b79d);}return _0x2c7bbb[_0xb381('0x1a')](_0x39b79d)[_0xb381('0x1b')]();};}function respondWithResult(_0x517f17,_0x587e6d){_0x587e6d=_0x587e6d||0xc8;return function(_0x144806){if(_0x144806){return _0x517f17[_0xb381('0x1a')](_0x587e6d)[_0xb381('0x1c')](_0x144806);}};}function respondWithFilteredResult(_0x2600d1,_0x129ddd){return function(_0x3a906b){if(_0x3a906b){var _0x13ef66=typeof _0x129ddd[_0xb381('0x1d')]==='undefined'&&typeof _0x129ddd[_0xb381('0x1e')]===_0xb381('0x1f');var _0x296d9e=_0x3a906b[_0xb381('0x20')];var _0x449b7b=_0x13ef66?0x0:_0x129ddd[_0xb381('0x1d')];var _0x2fd159=_0x13ef66?_0x3a906b[_0xb381('0x20')]:_0x129ddd[_0xb381('0x1d')]+_0x129ddd[_0xb381('0x1e')];var _0x1d2c5f;if(_0x2fd159>=_0x296d9e){_0x2fd159=_0x296d9e;_0x1d2c5f=0xc8;}else{_0x1d2c5f=0xce;}_0x2600d1[_0xb381('0x1a')](_0x1d2c5f);return _0x2600d1[_0xb381('0x21')](_0xb381('0x22'),_0x449b7b+'-'+_0x2fd159+'/'+_0x296d9e)[_0xb381('0x1c')](_0x3a906b);}return null;};}function patchUpdates(_0x11a531){return function(_0x295671){try{jsonpatch[_0xb381('0x23')](_0x295671,_0x11a531,!![]);}catch(_0x3fa7b4){return BPromise[_0xb381('0x24')](_0x3fa7b4);}return _0x295671['save']();};}function saveUpdates(_0x57a0aa,_0x3b39cc){return function(_0x5e140a){if(_0x5e140a){return _0x5e140a[_0xb381('0x25')](_0x57a0aa)[_0xb381('0x26')](function(_0x5a8042){return _0x5a8042;});}return null;};}function removeEntity(_0x2ada22,_0x5f1bbc){return function(_0x6688d2){if(_0x6688d2){return _0x6688d2[_0xb381('0x27')]()[_0xb381('0x26')](function(){_0x2ada22[_0xb381('0x1a')](0xcc)[_0xb381('0x1b')]();});}};}function handleEntityNotFound(_0x1216a9,_0x24d4af){return function(_0x2f7551){if(!_0x2f7551){_0x1216a9[_0xb381('0x28')](0x194);}return _0x2f7551;};}function handleError(_0x5cb456,_0x410a12){_0x410a12=_0x410a12||0x1f4;return function(_0x6f6da2){logger[_0xb381('0x29')](_0x6f6da2[_0xb381('0x2a')]);if(_0x6f6da2['name']){delete _0x6f6da2[_0xb381('0x2b')];}_0x5cb456[_0xb381('0x1a')](_0x410a12)[_0xb381('0x2c')](_0x6f6da2);};}exports[_0xb381('0x2d')]=function(_0x11b17e,_0x5dbf6f){var _0x1b697c={},_0x117c03={},_0x2bd6ea={'count':0x0,'rows':[]};var _0x577912=_[_0xb381('0x2e')](db[_0xb381('0x2f')][_0xb381('0x30')],function(_0x56bf15){return{'name':_0x56bf15[_0xb381('0x31')],'type':_0x56bf15[_0xb381('0x32')]['key']};});_0x117c03[_0xb381('0x33')]=_[_0xb381('0x2e')](_0x577912,_0xb381('0x2b'));_0x117c03[_0xb381('0x34')]=_[_0xb381('0x35')](_0x11b17e[_0xb381('0x34')]);_0x117c03[_0xb381('0x36')]=_[_0xb381('0x37')](_0x117c03[_0xb381('0x33')],_0x117c03['query']);_0x1b697c[_0xb381('0x38')]=_[_0xb381('0x37')](_0x117c03[_0xb381('0x33')],qs[_0xb381('0x39')](_0x11b17e[_0xb381('0x34')][_0xb381('0x39')]));_0x1b697c[_0xb381('0x38')]=_0x1b697c['attributes'][_0xb381('0x3a')]?_0x1b697c[_0xb381('0x38')]:_0x117c03['model'];if(!_0x11b17e['query'][_0xb381('0x3b')]('nolimit')){_0x1b697c[_0xb381('0x1e')]=qs[_0xb381('0x1e')](_0x11b17e['query'][_0xb381('0x1e')]);_0x1b697c['offset']=qs[_0xb381('0x1d')](_0x11b17e['query'][_0xb381('0x1d')]);}_0x1b697c[_0xb381('0x3c')]=qs['sort'](_0x11b17e[_0xb381('0x34')][_0xb381('0x3d')]);_0x1b697c[_0xb381('0x3e')]=qs['filters'](_['pick'](_0x11b17e[_0xb381('0x34')],_0x117c03[_0xb381('0x36')]),_0x577912);if(_0x11b17e['query'][_0xb381('0x3f')]){_0x1b697c[_0xb381('0x3e')]=_[_0xb381('0x40')](_0x1b697c['where'],{'$or':_[_0xb381('0x2e')](_0x577912,function(_0x539b1d){if(_0x539b1d[_0xb381('0x32')]!==_0xb381('0x41')){var _0xf43b20={};_0xf43b20[_0x539b1d[_0xb381('0x2b')]]={'$like':'%'+_0x11b17e[_0xb381('0x34')][_0xb381('0x3f')]+'%'};return _0xf43b20;}})});}_0x1b697c=_[_0xb381('0x40')]({},_0x1b697c,_0x11b17e[_0xb381('0x42')]);var _0x58527f={'where':_0x1b697c['where']};return db['OpenchannelApplication'][_0xb381('0x20')](_0x58527f)[_0xb381('0x26')](function(_0x24a82f){_0x2bd6ea[_0xb381('0x20')]=_0x24a82f;if(_0x11b17e[_0xb381('0x34')]['includeAll']){_0x1b697c[_0xb381('0x43')]=[{'all':!![]}];}return db[_0xb381('0x2f')]['findAll'](_0x1b697c);})[_0xb381('0x26')](function(_0x164230){_0x2bd6ea[_0xb381('0x44')]=_0x164230;return _0x2bd6ea;})[_0xb381('0x26')](respondWithFilteredResult(_0x5dbf6f,_0x1b697c))[_0xb381('0x45')](handleError(_0x5dbf6f,null));};exports[_0xb381('0x46')]=function(_0x3c3c72,_0x139b70){var _0x358cba={'raw':!![],'where':{'id':_0x3c3c72[_0xb381('0x47')]['id']}},_0x9fbcaf={};_0x9fbcaf[_0xb381('0x33')]=_['keys'](db['OpenchannelApplication'][_0xb381('0x30')]);_0x9fbcaf[_0xb381('0x34')]=_[_0xb381('0x35')](_0x3c3c72[_0xb381('0x34')]);_0x9fbcaf[_0xb381('0x36')]=_[_0xb381('0x37')](_0x9fbcaf['model'],_0x9fbcaf['query']);_0x358cba[_0xb381('0x38')]=_[_0xb381('0x37')](_0x9fbcaf[_0xb381('0x33')],qs[_0xb381('0x39')](_0x3c3c72[_0xb381('0x34')][_0xb381('0x39')]));_0x358cba[_0xb381('0x38')]=_0x358cba[_0xb381('0x38')][_0xb381('0x3a')]?_0x358cba['attributes']:_0x9fbcaf[_0xb381('0x33')];if(_0x3c3c72['query']['includeAll']){_0x358cba[_0xb381('0x43')]=[{'all':!![]}];}_0x358cba=_[_0xb381('0x40')]({},_0x358cba,_0x3c3c72[_0xb381('0x42')]);return db['OpenchannelApplication'][_0xb381('0x48')](_0x358cba)[_0xb381('0x26')](handleEntityNotFound(_0x139b70,null))[_0xb381('0x26')](respondWithResult(_0x139b70,null))[_0xb381('0x45')](handleError(_0x139b70,null));};exports['create']=function(_0x17bcef,_0x2fea78){return db[_0xb381('0x2f')][_0xb381('0x49')](_0x17bcef[_0xb381('0x4a')],{})[_0xb381('0x26')](respondWithResult(_0x2fea78,0xc9))[_0xb381('0x45')](handleError(_0x2fea78,null));};exports[_0xb381('0x25')]=function(_0x7867b9,_0x46df13){if(_0x7867b9[_0xb381('0x4a')]['id']){delete _0x7867b9[_0xb381('0x4a')]['id'];}return db[_0xb381('0x2f')][_0xb381('0x48')]({'where':{'id':_0x7867b9[_0xb381('0x47')]['id']}})[_0xb381('0x26')](handleEntityNotFound(_0x46df13,null))[_0xb381('0x26')](saveUpdates(_0x7867b9[_0xb381('0x4a')],null))[_0xb381('0x26')](respondWithResult(_0x46df13,null))[_0xb381('0x45')](handleError(_0x46df13,null));};exports[_0xb381('0x27')]=function(_0x510ae2,_0x322f6f){return db[_0xb381('0x2f')]['find']({'where':{'id':_0x510ae2[_0xb381('0x47')]['id']}})[_0xb381('0x26')](handleEntityNotFound(_0x322f6f,null))['then'](removeEntity(_0x322f6f,null))[_0xb381('0x45')](handleError(_0x322f6f,null));}; \ No newline at end of file +var _0x2879=['catch','show','keys','rawAttributes','length','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','OpenchannelApplication','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x2879,0x9a));var _0x9287=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2879[_0x160c73];return _0xd9302;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9287('0x0'));var zipdir=require(_0x9287('0x1'));var jsonpatch=require(_0x9287('0x2'));var rp=require('request-promise');var moment=require(_0x9287('0x3'));var BPromise=require(_0x9287('0x4'));var Mustache=require(_0x9287('0x5'));var util=require(_0x9287('0x6'));var path=require(_0x9287('0x7'));var sox=require('sox');var csv=require(_0x9287('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9287('0x9'));var _=require(_0x9287('0xa'));var squel=require('squel');var crypto=require(_0x9287('0xb'));var jsforce=require(_0x9287('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9287('0x8'));var querystring=require(_0x9287('0xd'));var Papa=require('papaparse');var Redis=require(_0x9287('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9287('0xf'));var as=require(_0x9287('0x10'));var hardwareService=require(_0x9287('0x11'));var logger=require(_0x9287('0x12'))(_0x9287('0x13'));var utils=require(_0x9287('0x14'));var config=require(_0x9287('0x15'));var licenseUtil=require(_0x9287('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107d28,_0xc4b89b){_0xc4b89b=_0xc4b89b||0xcc;return function(_0x4fa575){if(_0x4fa575){return _0x107d28['sendStatus'](_0xc4b89b);}return _0x107d28[_0x9287('0x17')](_0xc4b89b)['end']();};}function respondWithResult(_0x28e22c,_0x1c7816){_0x1c7816=_0x1c7816||0xc8;return function(_0x10781d){if(_0x10781d){return _0x28e22c[_0x9287('0x17')](_0x1c7816)[_0x9287('0x18')](_0x10781d);}};}function respondWithFilteredResult(_0x4b8029,_0x28e46f){return function(_0x3fadc8){if(_0x3fadc8){var _0x1a01e1=typeof _0x28e46f['offset']===_0x9287('0x19')&&typeof _0x28e46f[_0x9287('0x1a')]===_0x9287('0x19');var _0x1a8ae4=_0x3fadc8['count'];var _0x18a011=_0x1a01e1?0x0:_0x28e46f[_0x9287('0x1b')];var _0x20b40e=_0x1a01e1?_0x3fadc8[_0x9287('0x1c')]:_0x28e46f[_0x9287('0x1b')]+_0x28e46f[_0x9287('0x1a')];var _0xd684aa;if(_0x20b40e>=_0x1a8ae4){_0x20b40e=_0x1a8ae4;_0xd684aa=0xc8;}else{_0xd684aa=0xce;}_0x4b8029['status'](_0xd684aa);return _0x4b8029[_0x9287('0x1d')](_0x9287('0x1e'),_0x18a011+'-'+_0x20b40e+'/'+_0x1a8ae4)[_0x9287('0x18')](_0x3fadc8);}return null;};}function patchUpdates(_0x355677){return function(_0x346af7){try{jsonpatch[_0x9287('0x1f')](_0x346af7,_0x355677,!![]);}catch(_0x45c22a){return BPromise[_0x9287('0x20')](_0x45c22a);}return _0x346af7[_0x9287('0x21')]();};}function saveUpdates(_0x141e82,_0x15c673){return function(_0x4a0fd7){if(_0x4a0fd7){return _0x4a0fd7[_0x9287('0x22')](_0x141e82)[_0x9287('0x23')](function(_0x339c3d){return _0x339c3d;});}return null;};}function removeEntity(_0x5662e3,_0x25bba3){return function(_0x1bc969){if(_0x1bc969){return _0x1bc969[_0x9287('0x24')]()[_0x9287('0x23')](function(){_0x5662e3[_0x9287('0x17')](0xcc)[_0x9287('0x25')]();});}};}function handleEntityNotFound(_0x25e0ed,_0xea8089){return function(_0x3eeab7){if(!_0x3eeab7){_0x25e0ed['sendStatus'](0x194);}return _0x3eeab7;};}function handleError(_0x2fae08,_0x4f6abb){_0x4f6abb=_0x4f6abb||0x1f4;return function(_0x1c57eb){logger[_0x9287('0x26')](_0x1c57eb['stack']);if(_0x1c57eb[_0x9287('0x27')]){delete _0x1c57eb[_0x9287('0x27')];}_0x2fae08[_0x9287('0x17')](_0x4f6abb)[_0x9287('0x28')](_0x1c57eb);};}exports[_0x9287('0x29')]=function(_0x3fe532,_0x19902e){var _0x33c1b0={},_0x3cd33f={},_0x4b9b31={'count':0x0,'rows':[]};var _0x1893a8=_['map'](db[_0x9287('0x2a')]['rawAttributes'],function(_0x442582){return{'name':_0x442582['fieldName'],'type':_0x442582['type'][_0x9287('0x2b')]};});_0x3cd33f['model']=_[_0x9287('0x2c')](_0x1893a8,'name');_0x3cd33f[_0x9287('0x2d')]=_['keys'](_0x3fe532[_0x9287('0x2d')]);_0x3cd33f[_0x9287('0x2e')]=_[_0x9287('0x2f')](_0x3cd33f[_0x9287('0x30')],_0x3cd33f[_0x9287('0x2d')]);_0x33c1b0[_0x9287('0x31')]=_[_0x9287('0x2f')](_0x3cd33f['model'],qs[_0x9287('0x32')](_0x3fe532['query'][_0x9287('0x32')]));_0x33c1b0[_0x9287('0x31')]=_0x33c1b0[_0x9287('0x31')]['length']?_0x33c1b0[_0x9287('0x31')]:_0x3cd33f[_0x9287('0x30')];if(!_0x3fe532['query'][_0x9287('0x33')](_0x9287('0x34'))){_0x33c1b0[_0x9287('0x1a')]=qs[_0x9287('0x1a')](_0x3fe532['query'][_0x9287('0x1a')]);_0x33c1b0[_0x9287('0x1b')]=qs[_0x9287('0x1b')](_0x3fe532[_0x9287('0x2d')][_0x9287('0x1b')]);}_0x33c1b0[_0x9287('0x35')]=qs[_0x9287('0x36')](_0x3fe532[_0x9287('0x2d')][_0x9287('0x36')]);_0x33c1b0[_0x9287('0x37')]=qs['filters'](_['pick'](_0x3fe532[_0x9287('0x2d')],_0x3cd33f[_0x9287('0x2e')]),_0x1893a8);if(_0x3fe532[_0x9287('0x2d')][_0x9287('0x38')]){_0x33c1b0[_0x9287('0x37')]=_[_0x9287('0x39')](_0x33c1b0['where'],{'$or':_['map'](_0x1893a8,function(_0x4f94a1){if(_0x4f94a1[_0x9287('0x3a')]!==_0x9287('0x3b')){var _0x1f3adf={};_0x1f3adf[_0x4f94a1['name']]={'$like':'%'+_0x3fe532[_0x9287('0x2d')][_0x9287('0x38')]+'%'};return _0x1f3adf;}})});}_0x33c1b0=_['merge']({},_0x33c1b0,_0x3fe532['options']);var _0x208a3d={'where':_0x33c1b0[_0x9287('0x37')]};return db[_0x9287('0x2a')][_0x9287('0x1c')](_0x208a3d)['then'](function(_0x5b2a1e){_0x4b9b31[_0x9287('0x1c')]=_0x5b2a1e;if(_0x3fe532[_0x9287('0x2d')]['includeAll']){_0x33c1b0['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9287('0x3c')](_0x33c1b0);})[_0x9287('0x23')](function(_0x4352ae){_0x4b9b31[_0x9287('0x3d')]=_0x4352ae;return _0x4b9b31;})[_0x9287('0x23')](respondWithFilteredResult(_0x19902e,_0x33c1b0))[_0x9287('0x3e')](handleError(_0x19902e,null));};exports[_0x9287('0x3f')]=function(_0x570407,_0x4c1345){var _0x15a893={'raw':!![],'where':{'id':_0x570407['params']['id']}},_0x4aa254={};_0x4aa254['model']=_[_0x9287('0x40')](db[_0x9287('0x2a')][_0x9287('0x41')]);_0x4aa254[_0x9287('0x2d')]=_['keys'](_0x570407['query']);_0x4aa254[_0x9287('0x2e')]=_['intersection'](_0x4aa254[_0x9287('0x30')],_0x4aa254[_0x9287('0x2d')]);_0x15a893[_0x9287('0x31')]=_[_0x9287('0x2f')](_0x4aa254[_0x9287('0x30')],qs[_0x9287('0x32')](_0x570407['query'][_0x9287('0x32')]));_0x15a893[_0x9287('0x31')]=_0x15a893[_0x9287('0x31')][_0x9287('0x42')]?_0x15a893[_0x9287('0x31')]:_0x4aa254[_0x9287('0x30')];if(_0x570407[_0x9287('0x2d')]['includeAll']){_0x15a893['include']=[{'all':!![]}];}_0x15a893=_[_0x9287('0x39')]({},_0x15a893,_0x570407[_0x9287('0x43')]);return db[_0x9287('0x2a')][_0x9287('0x44')](_0x15a893)[_0x9287('0x23')](handleEntityNotFound(_0x4c1345,null))['then'](respondWithResult(_0x4c1345,null))[_0x9287('0x3e')](handleError(_0x4c1345,null));};exports[_0x9287('0x45')]=function(_0x22ffd6,_0x3831fd){return db[_0x9287('0x2a')][_0x9287('0x45')](_0x22ffd6[_0x9287('0x46')],{})[_0x9287('0x23')](respondWithResult(_0x3831fd,0xc9))['catch'](handleError(_0x3831fd,null));};exports[_0x9287('0x22')]=function(_0x136d67,_0x1ea3dc){if(_0x136d67[_0x9287('0x46')]['id']){delete _0x136d67[_0x9287('0x46')]['id'];}return db['OpenchannelApplication'][_0x9287('0x44')]({'where':{'id':_0x136d67[_0x9287('0x47')]['id']}})[_0x9287('0x23')](handleEntityNotFound(_0x1ea3dc,null))[_0x9287('0x23')](saveUpdates(_0x136d67[_0x9287('0x46')],null))[_0x9287('0x23')](respondWithResult(_0x1ea3dc,null))['catch'](handleError(_0x1ea3dc,null));};exports[_0x9287('0x24')]=function(_0x535459,_0x4883dc){return db[_0x9287('0x2a')]['find']({'where':{'id':_0x535459[_0x9287('0x47')]['id']}})[_0x9287('0x23')](handleEntityNotFound(_0x4883dc,null))[_0x9287('0x23')](removeEntity(_0x4883dc,null))[_0x9287('0x3e')](handleError(_0x4883dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b99910a..67a7010 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 _0x76e5=['request-promise','path','rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x4ceed6,_0x3515d1){var _0x558643=function(_0x1748b8){while(--_0x1748b8){_0x4ceed6['push'](_0x4ceed6['shift']());}};_0x558643(++_0x3515d1);}(_0x76e5,0xbe));var _0x576e=function(_0x433355,_0x4d498d){_0x433355=_0x433355-0x0;var _0x42ed3c=_0x76e5[_0x433355];return _0x42ed3c;};'use strict';var _=require(_0x576e('0x0'));var util=require(_0x576e('0x1'));var logger=require(_0x576e('0x2'))(_0x576e('0x3'));var moment=require(_0x576e('0x4'));var BPromise=require('bluebird');var rp=require(_0x576e('0x5'));var fs=require('fs');var path=require(_0x576e('0x6'));var rimraf=require(_0x576e('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x576e('0x8')]=function(_0x5c119a,_0x5921c6){return _0x5c119a[_0x576e('0x9')](_0x576e('0xa'),attributes,{'tableName':_0x576e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x576e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xda48=['path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise'];(function(_0x5b9f2b,_0x2d20ec){var _0x550db8=function(_0x5dd781){while(--_0x5dd781){_0x5b9f2b['push'](_0x5b9f2b['shift']());}};_0x550db8(++_0x2d20ec);}(_0xda48,0x110));var _0x8da4=function(_0x33d562,_0x8d0456){_0x33d562=_0x33d562-0x0;var _0x2b5cf8=_0xda48[_0x33d562];return _0x2b5cf8;};'use strict';var _=require('lodash');var util=require(_0x8da4('0x0'));var logger=require('../../config/logger')(_0x8da4('0x1'));var moment=require(_0x8da4('0x2'));var BPromise=require('bluebird');var rp=require(_0x8da4('0x3'));var fs=require('fs');var path=require(_0x8da4('0x4'));var rimraf=require(_0x8da4('0x5'));var config=require('../../config/environment');var attributes=require(_0x8da4('0x6'));module[_0x8da4('0x7')]=function(_0x31727a,_0x3d1131){return _0x31727a[_0x8da4('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x8da4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8da4('0xa'),'collate':_0x8da4('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7536843..f09098d 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 _0x8bf7=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelApplication','update','body','options','raw','attributes','limit','info','UpdateOpenchannelApplication','lodash'];(function(_0x407c91,_0xe6caf9){var _0x4261e5=function(_0x55a410){while(--_0x55a410){_0x407c91['push'](_0x407c91['shift']());}};_0x4261e5(++_0xe6caf9);}(_0x8bf7,0x1c1));var _0x78bf=function(_0x150442,_0x1784fd){_0x150442=_0x150442-0x0;var _0x3d6fa1=_0x8bf7[_0x150442];return _0x3d6fa1;};'use strict';var _=require(_0x78bf('0x0'));var util=require('util');var moment=require(_0x78bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x78bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78bf('0x3'))['db'];var utils=require(_0x78bf('0x4'));var logger=require(_0x78bf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78bf('0x6'));var client=jayson[_0x78bf('0x7')][_0x78bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d4118,_0x33ece6,_0x30ca15){return new BPromise(function(_0x56c3cb,_0x172ee7){return client[_0x78bf('0x9')](_0x5d4118,_0x30ca15)[_0x78bf('0xa')](function(_0x81ab24){logger['info'](_0x78bf('0xb'),_0x33ece6,_0x78bf('0xc'));logger[_0x78bf('0xd')](_0x78bf('0xe'),_0x33ece6,_0x78bf('0xc'),JSON[_0x78bf('0xf')](_0x81ab24));if(_0x81ab24[_0x78bf('0x10')]){if(_0x81ab24[_0x78bf('0x10')][_0x78bf('0x11')]===0x1f4){logger[_0x78bf('0x10')](_0x78bf('0xb'),_0x33ece6,_0x81ab24[_0x78bf('0x10')][_0x78bf('0x12')]);return _0x172ee7(_0x81ab24[_0x78bf('0x10')][_0x78bf('0x12')]);}logger['error'](_0x78bf('0xb'),_0x33ece6,_0x81ab24[_0x78bf('0x10')]['message']);return _0x56c3cb(_0x81ab24[_0x78bf('0x10')][_0x78bf('0x12')]);}else{logger['info'](_0x78bf('0xb'),_0x33ece6,_0x78bf('0xc'));_0x56c3cb(_0x81ab24[_0x78bf('0x13')][_0x78bf('0x12')]);}})[_0x78bf('0x14')](function(_0x38f3d6){logger[_0x78bf('0x10')](_0x78bf('0xb'),_0x33ece6,_0x38f3d6);_0x172ee7(_0x38f3d6);});});}exports['UpdateOpenchannelApplication']=function(_0x875825){var _0xb9ce5b=this;return new Promise(function(_0x414346,_0x24a00e){return db[_0x78bf('0x15')][_0x78bf('0x16')](_0x875825[_0x78bf('0x17')],{'raw':_0x875825['options']?_0x875825[_0x78bf('0x18')][_0x78bf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x875825[_0x78bf('0x18')]?_0x875825['options']['where']||null:null,'attributes':_0x875825[_0x78bf('0x18')]?_0x875825[_0x78bf('0x18')][_0x78bf('0x1a')]||null:null,'limit':_0x875825[_0x78bf('0x18')]?_0x875825[_0x78bf('0x18')][_0x78bf('0x1b')]||null:null})['then'](function(_0x544ff1){logger[_0x78bf('0x1c')](_0x78bf('0x1d'),_0x875825);logger[_0x78bf('0xd')]('UpdateOpenchannelApplication',_0x875825,JSON[_0x78bf('0xf')](_0x544ff1));_0x414346(_0x544ff1);})[_0x78bf('0x14')](function(_0x38e418){logger['error'](_0x78bf('0x1d'),_0x38e418['message'],_0x875825);_0x24a00e(_0xb9ce5b[_0x78bf('0x10')](0x1f4,_0x38e418['message']));});});}; \ No newline at end of file +var _0xbcba=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','OpenchannelApplication','update','body','options','raw','where','attributes','UpdateOpenchannelApplication','stringify','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x1d13c5,_0x3ffb1c){var _0x4db758=function(_0x1c6445){while(--_0x1c6445){_0x1d13c5['push'](_0x1d13c5['shift']());}};_0x4db758(++_0x3ffb1c);}(_0xbcba,0xc0));var _0xabcb=function(_0x20ed2b,_0x59979a){_0x20ed2b=_0x20ed2b-0x0;var _0x404843=_0xbcba[_0x20ed2b];return _0x404843;};'use strict';var _=require(_0xabcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xabcb('0x1'));var fs=require('fs');var Redis=require(_0xabcb('0x2'));var db=require(_0xabcb('0x3'))['db'];var utils=require(_0xabcb('0x4'));var logger=require(_0xabcb('0x5'))(_0xabcb('0x6'));var config=require(_0xabcb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xabcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36dee1,_0x2801c6,_0x397055){return new BPromise(function(_0x201022,_0x1c79eb){return client[_0xabcb('0x9')](_0x36dee1,_0x397055)[_0xabcb('0xa')](function(_0x1c307d){logger[_0xabcb('0xb')](_0xabcb('0xc'),_0x2801c6,_0xabcb('0xd'));logger[_0xabcb('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x2801c6,_0xabcb('0xd'),JSON['stringify'](_0x1c307d));if(_0x1c307d[_0xabcb('0xf')]){if(_0x1c307d[_0xabcb('0xf')][_0xabcb('0x10')]===0x1f4){logger[_0xabcb('0xf')](_0xabcb('0xc'),_0x2801c6,_0x1c307d['error'][_0xabcb('0x11')]);return _0x1c79eb(_0x1c307d['error'][_0xabcb('0x11')]);}logger[_0xabcb('0xf')](_0xabcb('0xc'),_0x2801c6,_0x1c307d[_0xabcb('0xf')][_0xabcb('0x11')]);return _0x201022(_0x1c307d[_0xabcb('0xf')][_0xabcb('0x11')]);}else{logger[_0xabcb('0xb')](_0xabcb('0xc'),_0x2801c6,_0xabcb('0xd'));_0x201022(_0x1c307d[_0xabcb('0x12')]['message']);}})['catch'](function(_0x12bc84){logger[_0xabcb('0xf')](_0xabcb('0xc'),_0x2801c6,_0x12bc84);_0x1c79eb(_0x12bc84);});});}exports['UpdateOpenchannelApplication']=function(_0xa65832){var _0x421f57=this;return new Promise(function(_0x1c8563,_0x204df7){return db[_0xabcb('0x13')][_0xabcb('0x14')](_0xa65832[_0xabcb('0x15')],{'raw':_0xa65832[_0xabcb('0x16')]?_0xa65832['options'][_0xabcb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa65832['options']?_0xa65832[_0xabcb('0x16')][_0xabcb('0x18')]||null:null,'attributes':_0xa65832[_0xabcb('0x16')]?_0xa65832[_0xabcb('0x16')][_0xabcb('0x19')]||null:null,'limit':_0xa65832[_0xabcb('0x16')]?_0xa65832[_0xabcb('0x16')]['limit']||null:null})[_0xabcb('0xa')](function(_0x276fff){logger[_0xabcb('0xb')](_0xabcb('0x1a'),_0xa65832);logger[_0xabcb('0xe')](_0xabcb('0x1a'),_0xa65832,JSON[_0xabcb('0x1b')](_0x276fff));_0x1c8563(_0x276fff);})[_0xabcb('0x1c')](function(_0x4f86ba){logger[_0xabcb('0xf')](_0xabcb('0x1a'),_0x4f86ba['message'],_0xa65832);_0x204df7(_0x421f57[_0xabcb('0xf')](0x1f4,_0x4f86ba[_0xabcb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c7f38ea..f0c9df9 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 _0xdae3=['addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','path','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','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x3d77e4,_0x1c44e7){var _0xe937=function(_0x521769){while(--_0x521769){_0x3d77e4['push'](_0x3d77e4['shift']());}};_0xe937(++_0x1c44e7);}(_0xdae3,0x101));var _0x3dae=function(_0x3144f5,_0x41242a){_0x3144f5=_0x3144f5-0x0;var _0x40641f=_0xdae3[_0x3144f5];return _0x40641f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3dae('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3dae('0x1'));var auth=require(_0x3dae('0x2'));var interaction=require(_0x3dae('0x3'));var config=require(_0x3dae('0x4'));var controller=require(_0x3dae('0x5'));router[_0x3dae('0x6')]('/',auth[_0x3dae('0x7')](),controller[_0x3dae('0x8')]);router[_0x3dae('0x6')]('/describe',auth[_0x3dae('0x7')](),controller[_0x3dae('0x9')]);router[_0x3dae('0x6')](_0x3dae('0xa'),auth[_0x3dae('0x7')](),controller[_0x3dae('0xb')]);router[_0x3dae('0x6')](_0x3dae('0xc'),auth['isAuthenticated'](),controller[_0x3dae('0xd')]);router['get'](_0x3dae('0xe'),auth[_0x3dae('0x7')](),controller[_0x3dae('0xf')]);router[_0x3dae('0x10')]('/',auth['isAuthenticated'](),controller[_0x3dae('0x11')]);router[_0x3dae('0x10')]('/:id/messages',auth[_0x3dae('0x7')](),controller[_0x3dae('0x12')]);router['post']('/:id/tags',auth[_0x3dae('0x7')](),interaction[_0x3dae('0x13')](_0x3dae('0x14'),_0x3dae('0x15')),controller[_0x3dae('0x16')]);router[_0x3dae('0x17')]('/:id',auth[_0x3dae('0x7')](),interaction[_0x3dae('0x13')](_0x3dae('0x14'),_0x3dae('0x18')),controller[_0x3dae('0x19')]);router['delete'](_0x3dae('0xa'),auth[_0x3dae('0x7')](),interaction[_0x3dae('0x13')](_0x3dae('0x14'),_0x3dae('0x1a')),controller[_0x3dae('0x1b')]);router[_0x3dae('0x1c')](_0x3dae('0x1d'),auth[_0x3dae('0x7')](),controller[_0x3dae('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x41c2=['removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x41c2,0x162));var _0x241c=function(_0x3d2b55,_0x1e4516){_0x3d2b55=_0x3d2b55-0x0;var _0x3dbbf2=_0x41c2[_0x3d2b55];return _0x3dbbf2;};'use strict';var multer=require('multer');var util=require(_0x241c('0x0'));var path=require(_0x241c('0x1'));var timeout=require(_0x241c('0x2'));var express=require(_0x241c('0x3'));var router=express['Router']();var fs_extra=require(_0x241c('0x4'));var auth=require(_0x241c('0x5'));var interaction=require(_0x241c('0x6'));var config=require(_0x241c('0x7'));var controller=require(_0x241c('0x8'));router[_0x241c('0x9')]('/',auth['isAuthenticated'](),controller[_0x241c('0xa')]);router[_0x241c('0x9')](_0x241c('0xb'),auth['isAuthenticated'](),controller[_0x241c('0xc')]);router['get'](_0x241c('0xd'),auth[_0x241c('0xe')](),controller['show']);router[_0x241c('0x9')](_0x241c('0xf'),auth[_0x241c('0xe')](),controller[_0x241c('0x10')]);router[_0x241c('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x241c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x241c('0x12')](_0x241c('0xf'),auth[_0x241c('0xe')](),controller[_0x241c('0x13')]);router[_0x241c('0x12')](_0x241c('0x14'),auth[_0x241c('0xe')](),interaction[_0x241c('0x15')]('openchannel',_0x241c('0x16')),controller[_0x241c('0x17')]);router[_0x241c('0x18')]('/:id',auth[_0x241c('0xe')](),interaction[_0x241c('0x15')](_0x241c('0x19'),'openchannelinteraction:update'),controller[_0x241c('0x1a')]);router[_0x241c('0x1b')](_0x241c('0xd'),auth[_0x241c('0xe')](),interaction['tracked']('openchannel',_0x241c('0x1c')),controller[_0x241c('0x1d')]);router[_0x241c('0x1b')](_0x241c('0x14'),auth['isAuthenticated'](),controller[_0x241c('0x1e')]);module[_0x241c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5cabe10..07c9aa5 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 _0x586b=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x1fd154,_0x273e7e){var _0x4a6413=function(_0x4d9d64){while(--_0x4d9d64){_0x1fd154['push'](_0x1fd154['shift']());}};_0x4a6413(++_0x273e7e);}(_0x586b,0x1bb));var _0xb586=function(_0x25cb0d,_0x2f5a44){_0x25cb0d=_0x25cb0d-0x0;var _0x246af0=_0x586b[_0x25cb0d];return _0x246af0;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xb586('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb586('0x1')]},'disposition':{'type':Sequelize[_0xb586('0x2')]},'secondDisposition':{'type':Sequelize[_0xb586('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb586('0x2')]},'note':{'type':Sequelize[_0xb586('0x2')]},'read1stAt':{'type':Sequelize[_0xb586('0x1')]},'threadId':{'type':Sequelize[_0xb586('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb586('0x3')]('in',_0xb586('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb586('0x3')]('in',_0xb586('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb586('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xb586('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x688a=['DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','STRING'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x688a,0x124));var _0xa688=function(_0x50aef8,_0x54ab4d){_0x50aef8=_0x50aef8-0x0;var _0x455c5b=_0x688a[_0x50aef8];return _0x455c5b;};'use strict';var Sequelize=require(_0xa688('0x0'));module[_0xa688('0x1')]={'closed':{'type':Sequelize[_0xa688('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa688('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa688('0x3')]},'note':{'type':Sequelize[_0xa688('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xa688('0x3')]},'externalUrl':{'type':Sequelize[_0xa688('0x3')]},'lastMsgAt':{'type':Sequelize[_0xa688('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa688('0x5')]('in',_0xa688('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa688('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xa688('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa688('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index de489d3..ef7c0db 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 _0x7d80=['omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','closedAt','threadId','Private','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','openchannel','user','show','query','from','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags'];(function(_0x535dff,_0x1118a0){var _0x49771b=function(_0x4e7276){while(--_0x4e7276){_0x535dff['push'](_0x535dff['shift']());}};_0x49771b(++_0x1118a0);}(_0x7d80,0xba));var _0x07d8=function(_0x558718,_0x169d9e){_0x558718=_0x558718-0x0;var _0x180d10=_0x7d80[_0x558718];return _0x180d10;};'use strict';var rimraf=require(_0x07d8('0x0'));var zipdir=require(_0x07d8('0x1'));var moment=require(_0x07d8('0x2'));var util=require(_0x07d8('0x3'));var path=require(_0x07d8('0x4'));var ejs=require(_0x07d8('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x07d8('0x6'));var pdf=require(_0x07d8('0x7'));var logger=require(_0x07d8('0x8'))(_0x07d8('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x07d8('0xa')]=_['defaults'](config[_0x07d8('0xa')],{'host':_0x07d8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07d8('0xa')]));require(_0x07d8('0xc'))[_0x07d8('0xd')](socket);function respondWithStatusCode(_0x2a9dde,_0x18f1a4){_0x18f1a4=_0x18f1a4||0xcc;return function(_0x3c8b99){if(_0x3c8b99){return _0x2a9dde[_0x07d8('0xe')](_0x18f1a4);}return _0x2a9dde[_0x07d8('0xf')](_0x18f1a4)[_0x07d8('0x10')]();};}function respondWithResult(_0x372577,_0x4d1d31){_0x4d1d31=_0x4d1d31||0xc8;return function(_0x191130){if(_0x191130){return _0x372577['status'](_0x4d1d31)[_0x07d8('0x11')](_0x191130);}};}function respondWithFilteredResult(_0x7de838,_0x36d4a6){return function(_0x501637){if(_0x501637){var _0x4f4092=typeof _0x36d4a6[_0x07d8('0x12')]===_0x07d8('0x13')&&typeof _0x36d4a6[_0x07d8('0x14')]==='undefined';var _0x598900=_0x501637[_0x07d8('0x15')];var _0x3e4612=_0x4f4092?0x0:_0x36d4a6[_0x07d8('0x12')];var _0x48242f=_0x4f4092?_0x501637[_0x07d8('0x15')]:_0x36d4a6['offset']+_0x36d4a6[_0x07d8('0x14')];var _0x5be7cd;if(_0x48242f>=_0x598900){_0x48242f=_0x598900;_0x5be7cd=0xc8;}else{_0x5be7cd=0xce;}_0x7de838['status'](_0x5be7cd);return _0x7de838[_0x07d8('0x16')](_0x07d8('0x17'),_0x3e4612+'-'+_0x48242f+'/'+_0x598900)[_0x07d8('0x11')](_0x501637);}return null;};}function saveUpdates(_0x4a2505){return function(_0xfaab03){if(_0xfaab03){return _0xfaab03[_0x07d8('0x18')](_0x4a2505)[_0x07d8('0x19')](function(_0x19135a){return _0x19135a;});}return null;};}function removeEntity(_0x35209d){return function(_0x48f29a){if(_0x48f29a){return _0x48f29a['destroy']()[_0x07d8('0x19')](function(){_0x35209d[_0x07d8('0xf')](0xcc)[_0x07d8('0x10')]();});}};}function handleEntityNotFound(_0x327bb9){return function(_0x3c6aa8){if(!_0x3c6aa8){_0x327bb9[_0x07d8('0xe')](0x194);}return _0x3c6aa8;};}function handleError(_0x5ced13,_0x4d1f8e){_0x4d1f8e=_0x4d1f8e||0x1f4;return function(_0x3c5e61){logger[_0x07d8('0x1a')](_0x3c5e61[_0x07d8('0x1b')]);if(_0x3c5e61['name']){delete _0x3c5e61[_0x07d8('0x1c')];}_0x5ced13['status'](_0x4d1f8e)[_0x07d8('0x1d')](_0x3c5e61);};}exports[_0x07d8('0x1e')]=function(_0x511ed7,_0x5375f8){var _0x23098d={};var _0x152100=_[_0x07d8('0x1f')](db[_0x07d8('0x20')][_0x07d8('0x21')],function(_0x2674b9){return{'name':_0x2674b9[_0x07d8('0x22')],'type':_0x2674b9[_0x07d8('0x23')]['key']};});_0x23098d=qs['getOptions'](_0x152100,_0x511ed7);return interaction['findAll'](_0x07d8('0x24'),_0x511ed7['query'],_0x511ed7[_0x07d8('0x25')],_0x23098d,_0x152100)[_0x07d8('0x19')](respondWithFilteredResult(_0x5375f8,_0x23098d))['catch'](handleError(_0x5375f8,null));};exports[_0x07d8('0x26')]=function(_0x4501ec,_0x1f09d2){var _0x398e8a={};if(_0x4501ec['query'][_0x07d8('0x23')]&&_0x4501ec[_0x07d8('0x27')][_0x07d8('0x23')]===_0x07d8('0x28')){_0x398e8a[_0x07d8('0x28')]=_0x4501ec[_0x07d8('0x29')]['id'];}else{_0x398e8a['id']=_0x4501ec[_0x07d8('0x29')]['id'];}var _0x56b03c={'raw':![],'where':_0x398e8a},_0x5bb7b9={};_0x5bb7b9[_0x07d8('0x2a')]=_[_0x07d8('0x2b')](db['OpenchannelInteraction']['rawAttributes']);_0x5bb7b9[_0x07d8('0x27')]=_['keys'](_0x4501ec[_0x07d8('0x27')]);_0x5bb7b9[_0x07d8('0x2c')]=_[_0x07d8('0x2d')](_0x5bb7b9['model'],_0x5bb7b9[_0x07d8('0x27')]);_0x56b03c[_0x07d8('0x2e')]=_[_0x07d8('0x2d')](_0x5bb7b9[_0x07d8('0x2a')],qs['fields'](_0x4501ec[_0x07d8('0x27')][_0x07d8('0x2f')]));_0x56b03c[_0x07d8('0x2e')]=_0x56b03c[_0x07d8('0x2e')]['length']?_0x56b03c[_0x07d8('0x2e')]:_0x5bb7b9[_0x07d8('0x2a')];if(_0x4501ec[_0x07d8('0x27')][_0x07d8('0x30')]){_0x56b03c[_0x07d8('0x31')]=[{'all':!![]}];}_0x56b03c=_[_0x07d8('0x32')]({},_0x56b03c,_0x4501ec[_0x07d8('0x33')]);return db[_0x07d8('0x20')][_0x07d8('0x34')](_0x56b03c)[_0x07d8('0x19')](handleEntityNotFound(_0x1f09d2,null))[_0x07d8('0x19')](respondWithResult(_0x1f09d2,null))[_0x07d8('0x35')](handleError(_0x1f09d2,null));};exports[_0x07d8('0x36')]=function(_0x368da8,_0x119573){return db[_0x07d8('0x20')][_0x07d8('0x36')](_0x368da8[_0x07d8('0x37')],{})[_0x07d8('0x19')](respondWithResult(_0x119573,0xc9))['catch'](handleError(_0x119573,null));};exports[_0x07d8('0x18')]=function(_0x19e43d,_0x506f41){if(_0x19e43d['body']['id']){delete _0x19e43d[_0x07d8('0x37')]['id'];}return db[_0x07d8('0x20')][_0x07d8('0x34')]({'where':{'id':_0x19e43d[_0x07d8('0x29')]['id']}})[_0x07d8('0x19')](handleEntityNotFound(_0x506f41,null))[_0x07d8('0x19')](saveUpdates(_0x19e43d['body'],null))['then'](respondWithResult(_0x506f41,null))[_0x07d8('0x35')](handleError(_0x506f41,null));};exports[_0x07d8('0x38')]=function(_0x1c604a,_0x989f00){return db['OpenchannelInteraction'][_0x07d8('0x34')]({'where':{'id':_0x1c604a[_0x07d8('0x29')]['id']}})[_0x07d8('0x19')](handleEntityNotFound(_0x989f00,null))[_0x07d8('0x19')](removeEntity(_0x989f00,null))['catch'](handleError(_0x989f00,null));};exports[_0x07d8('0x39')]=function(_0x41db3c,_0x3775de){return db[_0x07d8('0x20')][_0x07d8('0x39')]()['then'](respondWithResult(_0x3775de,null))[_0x07d8('0x35')](handleError(_0x3775de,null));};exports[_0x07d8('0x3a')]=function(_0x2823d3,_0x5b6762){return db[_0x07d8('0x3b')]['find']({'where':{'id':_0x2823d3[_0x07d8('0x29')]['id']}})['then'](handleEntityNotFound(_0x5b6762,null))[_0x07d8('0x19')](function(_0x29632b){if(_0x29632b){return _0x29632b[_0x07d8('0x3a')](_0x2823d3['body'][_0x07d8('0x3c')],_['omit'](_0x2823d3[_0x07d8('0x37')],[_0x07d8('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x5b6762,null))['catch'](handleError(_0x5b6762,null));};exports[_0x07d8('0x3d')]=function(_0x1c9bbb,_0x38631d){var _0x3d8493={'raw':![],'where':{}};var _0x4a0ab3={};var _0x1aa0c6={'count':0x0,'rows':[]};return db[_0x07d8('0x20')][_0x07d8('0x3e')]({'where':{'id':_0x1c9bbb[_0x07d8('0x29')]['id']}})[_0x07d8('0x19')](handleEntityNotFound(_0x38631d,null))['then'](function(_0x2e416a){if(_0x2e416a){_0x4a0ab3[_0x07d8('0x2a')]=_['keys'](db[_0x07d8('0x3b')][_0x07d8('0x21')]);_0x4a0ab3[_0x07d8('0x27')]=_['keys'](_0x1c9bbb['query']);_0x4a0ab3[_0x07d8('0x2c')]=_[_0x07d8('0x2d')](_0x4a0ab3['model'],_0x4a0ab3['query']);_0x3d8493[_0x07d8('0x2e')]=_['intersection'](_0x4a0ab3[_0x07d8('0x2a')],qs[_0x07d8('0x2f')](_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x2f')]));_0x3d8493[_0x07d8('0x2e')]=_0x3d8493['attributes'][_0x07d8('0x3f')]?_0x3d8493[_0x07d8('0x2e')]:_0x4a0ab3[_0x07d8('0x2a')];if(!_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x40')](_0x07d8('0x41'))){_0x3d8493[_0x07d8('0x14')]=qs[_0x07d8('0x14')](_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x14')]);_0x3d8493[_0x07d8('0x12')]=qs[_0x07d8('0x12')](_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x12')]);}_0x3d8493[_0x07d8('0x42')]=qs[_0x07d8('0x43')](_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x43')]);_0x3d8493[_0x07d8('0x44')]=qs[_0x07d8('0x2c')](_['pick'](_0x1c9bbb['query'],_0x4a0ab3['filters']));_0x3d8493[_0x07d8('0x44')][_0x07d8('0x45')]=_0x2e416a['id'];if(_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x46')]){_0x3d8493['where']=_['merge'](_0x3d8493[_0x07d8('0x44')],{'$or':_[_0x07d8('0x1f')](_0x3d8493[_0x07d8('0x2e')],function(_0x5cca9c){var _0x728952={};_0x728952[_0x5cca9c]={'$like':'%'+_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x46')]+'%'};return _0x728952;})});}if(_0x1c9bbb['query'][_0x07d8('0x47')]){var _0x2bd9ff=_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x47')]['split'](',');var _0xc555b3={};_0xc555b3[_0x2bd9ff[0x0]]={'$gte':moment(_0x2bd9ff[0x1])[_0x07d8('0x48')](_0x07d8('0x49'))};_0x3d8493[_0x07d8('0x44')]=_[_0x07d8('0x32')](_0x3d8493[_0x07d8('0x44')],_0xc555b3);}_0x3d8493=_[_0x07d8('0x32')]({},_0x3d8493,_0x1c9bbb['options']);return db[_0x07d8('0x3b')][_0x07d8('0x15')]({'where':_0x3d8493['where']})[_0x07d8('0x19')](function(_0x5d438d){_0x1aa0c6['count']=_0x5d438d;if(_0x1c9bbb[_0x07d8('0x27')][_0x07d8('0x30')]){_0x3d8493[_0x07d8('0x31')]=[{'all':!![]}];}return db[_0x07d8('0x3b')][_0x07d8('0x4a')](_0x3d8493);})[_0x07d8('0x19')](function(_0x15870e){_0x1aa0c6[_0x07d8('0x4b')]=_0x15870e;return _0x1aa0c6;});}})[_0x07d8('0x19')](respondWithFilteredResult(_0x38631d,_0x3d8493))[_0x07d8('0x35')](handleError(_0x38631d,null));};exports[_0x07d8('0x4c')]=function(_0x2b6e94,_0x3fe93f){return db['OpenchannelInteraction'][_0x07d8('0x34')]({'where':{'id':_0x2b6e94['params']['id']}})[_0x07d8('0x19')](handleEntityNotFound(_0x3fe93f,null))[_0x07d8('0x19')](function(_0x5647c2){if(_0x5647c2){return _0x5647c2[_0x07d8('0x4d')](_0x2b6e94[_0x07d8('0x37')][_0x07d8('0x3c')],_[_0x07d8('0x4e')](_0x2b6e94[_0x07d8('0x37')],[_0x07d8('0x3c'),'id'])||{})[_0x07d8('0x4f')](function(){return db[_0x07d8('0x50')][_0x07d8('0x4a')]({'attributes':['id',_0x07d8('0x1c'),_0x07d8('0x51')],'where':{'id':_0x2b6e94[_0x07d8('0x37')][_0x07d8('0x3c')]}});})[_0x07d8('0x19')](function(_0x5c2588){socket[_0x07d8('0x52')](_0x07d8('0x53'),{'id':Number(_0x2b6e94[_0x07d8('0x29')]['id']),'tags':_0x5c2588||[]});return{'id':Number(_0x2b6e94[_0x07d8('0x29')]['id']),'tags':_0x5c2588||[]};});}})[_0x07d8('0x19')](respondWithResult(_0x3fe93f,null))['catch'](handleError(_0x3fe93f,null));};exports[_0x07d8('0x54')]=function(_0x4999a7,_0x381534){return db[_0x07d8('0x20')]['find']({'where':{'id':_0x4999a7[_0x07d8('0x29')]['id']}})['then'](handleEntityNotFound(_0x381534,null))[_0x07d8('0x19')](function(_0x4e39df){if(_0x4e39df){return _0x4e39df[_0x07d8('0x54')](_0x4999a7[_0x07d8('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x381534,null))[_0x07d8('0x35')](handleError(_0x381534,null));};exports[_0x07d8('0x55')]=function(_0x5cde12,_0x223df7){var _0x4c23f6=moment()[_0x07d8('0x56')]()[_0x07d8('0x57')]();var _0x2b75fd=path['join'](config[_0x07d8('0x58')],_0x07d8('0x59'),_0x07d8('0x5a'),'tmp');var _0x35321b=path[_0x07d8('0x5b')](config['root'],_0x07d8('0x59'),_0x07d8('0x5a'),_0x07d8('0x5c'));var _0x1cd9b4=path['join'](_0x2b75fd,_0x4c23f6);var _0x4b5b08=util[_0x07d8('0x48')](_0x07d8('0x5d'),_0x5cde12[_0x07d8('0x29')]['id'],_0x4c23f6);var _0x4ca96c=path['join'](_0x2b75fd,_0x4b5b08);var _0x4fb254=[];_0x4fb254[_0x07d8('0x5e')]({'model':db[_0x07d8('0x5f')],'as':'User','attributes':['id',_0x07d8('0x60')],'raw':!![]});_0x4fb254[_0x07d8('0x5e')]({'model':db[_0x07d8('0x61')],'as':_0x07d8('0x62'),'attributes':['id',_0x07d8('0x63'),_0x07d8('0x64')],'raw':!![]});if(_0x5cde12[_0x07d8('0x27')]['attachments']){_0x4fb254['push']({'model':db[_0x07d8('0x65')],'as':_0x07d8('0x65'),'raw':!![]});}var _0x55101f=[{'model':db[_0x07d8('0x3b')],'as':'Messages','attributes':['id','body',_0x07d8('0x66'),_0x07d8('0x67'),_0x07d8('0x68'),_0x07d8('0x69')],'include':_0x4fb254}];_0x55101f[_0x07d8('0x5e')]({'model':db[_0x07d8('0x6a')],'as':'Account','attributes':['id',_0x07d8('0x1c')]});_0x55101f[_0x07d8('0x5e')]({'model':db[_0x07d8('0x5f')],'as':_0x07d8('0x6b'),'attributes':['id',_0x07d8('0x60')]});return db['OpenchannelInteraction'][_0x07d8('0x34')]({'where':{'id':_0x5cde12['params']['id']},'include':_0x55101f})['then'](handleEntityNotFound(_0x223df7,null))[_0x07d8('0x19')](function(_0x37ec00){if(_0x37ec00){var _0x4c753f=_0x37ec00[_0x07d8('0x6c')]({'plain':!![]});fs[_0x07d8('0x6d')](_0x1cd9b4);var _0x53d268={'channel':_0x07d8('0x6e'),'account':_0x4c753f[_0x07d8('0x6f')]['name'],'agent':_0x4c753f[_0x07d8('0x6b')]?_0x4c753f[_0x07d8('0x6b')]['fullname']:_0x07d8('0x70'),'createdAt':moment(_0x4c753f['createdAt'])[_0x07d8('0x48')](_0x07d8('0x49'))[_0x07d8('0x57')](),'closedAt':_0x4c753f['closed']?moment(_0x4c753f[_0x07d8('0x71')])[_0x07d8('0x48')](_0x07d8('0x49'))[_0x07d8('0x57')]():'','disposition':_0x4c753f['disposition'],'visibility':_0x4c753f[_0x07d8('0x72')]?'Public':_0x07d8('0x73'),'messages':_(_0x4c753f[_0x07d8('0x74')])[_0x07d8('0x46')]({'secret':![]})[_0x07d8('0x1f')](function(_0x49422f){if(_0x49422f[_0x07d8('0x65')]){var _0x4afb18=path[_0x07d8('0x5b')](_0x35321b,_0x49422f[_0x07d8('0x65')]['basename']);if(fs[_0x07d8('0x75')](_0x4afb18)){fs[_0x07d8('0x76')](_0x4afb18)[_0x07d8('0x77')](fs[_0x07d8('0x78')](path[_0x07d8('0x5b')](_0x1cd9b4,_0x49422f[_0x07d8('0x65')][_0x07d8('0x79')])));}}return{'date':moment(_0x49422f[_0x07d8('0x66')])['format'](_0x07d8('0x49'))[_0x07d8('0x57')](),'sender':_0x49422f[_0x07d8('0x67')]===_0x07d8('0x7a')?_0x49422f[_0x07d8('0x5f')]?_0x49422f[_0x07d8('0x5f')][_0x07d8('0x60')]:_0x07d8('0x7b'):_0x49422f['Contact'][_0x07d8('0x63')]+(_0x49422f['Contact'][_0x07d8('0x64')]?'\x20'+_0x49422f['Contact'][_0x07d8('0x64')]:''),'body':_0x49422f[_0x07d8('0x65')]?_0x49422f['Attachment']['basename']:_0x49422f[_0x07d8('0x37')],'direction':_0x49422f[_0x07d8('0x67')]===_0x07d8('0x7a')?'A':'C','secret':_0x49422f[_0x07d8('0x68')],'read':_0x49422f[_0x07d8('0x69')],'attachment':_0x49422f[_0x07d8('0x65')]};})[_0x07d8('0x7c')]()};return ejs[_0x07d8('0x7d')](path[_0x07d8('0x5b')](config[_0x07d8('0x58')],_0x07d8('0x59'),_0x07d8('0x7e'),_0x07d8('0x7f')),{'interaction':_0x53d268})[_0x07d8('0x19')](function(_0x31b3dd){var _0xecdc61=path[_0x07d8('0x5b')](_0x1cd9b4,_0x07d8('0x80')+_0x4c753f['id']+'-'+_0x4c23f6+_0x07d8('0x81'));var _0x68b5ea={'path':_0xecdc61,'channel':_0x07d8('0x6e'),'interactionId':_0x4c753f['id']};return pdf[_0x07d8('0x82')](_0x31b3dd,_0x68b5ea);})[_0x07d8('0x19')](function(){return new Promise(function(_0xa371c6,_0xa322fe){zipdir(_0x1cd9b4,{'saveTo':_0x4ca96c},function(_0x12cbbc,_0x2acf5e){if(_0x12cbbc)return _0xa322fe(_0x12cbbc);return _0xa371c6(_0x2acf5e);});})[_0x07d8('0x19')](function(){return new Promise(function(_0x585b2a,_0x2e1f0e){rimraf(_0x1cd9b4,function(_0x53b708){if(_0x53b708)_0x2e1f0e(_0x53b708);return _0x585b2a();});});})[_0x07d8('0x19')](function(){return _0x223df7['download'](_0x4ca96c,_0x4b5b08,function(_0x46ab07){if(_0x46ab07){logger[_0x07d8('0x1a')](_0x07d8('0x83'),_0x46ab07);}else{fs['unlinkSync'](_0x4ca96c);}});});});}else{return _0x223df7[_0x07d8('0xe')](0xc8);}})[_0x07d8('0x35')](handleError(_0x223df7,null));}; \ No newline at end of file +var _0x2df1=['Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','rimraf','zip-dir','moment','util','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','undefined','count','Content-Range','update','then','destroy','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','$gte','format','options','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','push','User','fullname','Contact','firstName','lastName','Attachment','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','Messages','createReadStream','pipe','createWriteStream','basename','out','System','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error'];(function(_0x83ef84,_0x4600da){var _0x406c5e=function(_0x2dbfb4){while(--_0x2dbfb4){_0x83ef84['push'](_0x83ef84['shift']());}};_0x406c5e(++_0x4600da);}(_0x2df1,0x85));var _0x12df=function(_0x34f86e,_0xdad344){_0x34f86e=_0x34f86e-0x0;var _0xf47321=_0x2df1[_0x34f86e];return _0xf47321;};'use strict';var rimraf=require(_0x12df('0x0'));var zipdir=require(_0x12df('0x1'));var moment=require(_0x12df('0x2'));var util=require(_0x12df('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x12df('0x4'));var interaction=require(_0x12df('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x12df('0x6'));var logger=require(_0x12df('0x7'))(_0x12df('0x8'));var config=require('../../config/environment');var db=require(_0x12df('0x9'))['db'];config['redis']=_['defaults'](config[_0x12df('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x12df('0xb'))(new Redis(config[_0x12df('0xa')]));require('./openchannelInteraction.socket')[_0x12df('0xc')](socket);function respondWithStatusCode(_0x2d0766,_0x59109c){_0x59109c=_0x59109c||0xcc;return function(_0x3d6c33){if(_0x3d6c33){return _0x2d0766['sendStatus'](_0x59109c);}return _0x2d0766[_0x12df('0xd')](_0x59109c)[_0x12df('0xe')]();};}function respondWithResult(_0x47a3d2,_0x3c37d8){_0x3c37d8=_0x3c37d8||0xc8;return function(_0x4a0e90){if(_0x4a0e90){return _0x47a3d2[_0x12df('0xd')](_0x3c37d8)[_0x12df('0xf')](_0x4a0e90);}};}function respondWithFilteredResult(_0x3ebb1a,_0x183932){return function(_0x1d882c){if(_0x1d882c){var _0x3449f3=typeof _0x183932[_0x12df('0x10')]===_0x12df('0x11')&&typeof _0x183932['limit']===_0x12df('0x11');var _0x265010=_0x1d882c[_0x12df('0x12')];var _0x331210=_0x3449f3?0x0:_0x183932['offset'];var _0x1b6708=_0x3449f3?_0x1d882c[_0x12df('0x12')]:_0x183932[_0x12df('0x10')]+_0x183932['limit'];var _0x168e2f;if(_0x1b6708>=_0x265010){_0x1b6708=_0x265010;_0x168e2f=0xc8;}else{_0x168e2f=0xce;}_0x3ebb1a[_0x12df('0xd')](_0x168e2f);return _0x3ebb1a['set'](_0x12df('0x13'),_0x331210+'-'+_0x1b6708+'/'+_0x265010)[_0x12df('0xf')](_0x1d882c);}return null;};}function saveUpdates(_0x32e124){return function(_0x19618a){if(_0x19618a){return _0x19618a[_0x12df('0x14')](_0x32e124)[_0x12df('0x15')](function(_0x6800e4){return _0x6800e4;});}return null;};}function removeEntity(_0x7a7902){return function(_0x90cfd1){if(_0x90cfd1){return _0x90cfd1[_0x12df('0x16')]()[_0x12df('0x15')](function(){_0x7a7902[_0x12df('0xd')](0xcc)[_0x12df('0xe')]();});}};}function handleEntityNotFound(_0x254816){return function(_0x1287ec){if(!_0x1287ec){_0x254816['sendStatus'](0x194);}return _0x1287ec;};}function handleError(_0xe68374,_0x3ec98f){_0x3ec98f=_0x3ec98f||0x1f4;return function(_0x121297){logger['error'](_0x121297[_0x12df('0x17')]);if(_0x121297[_0x12df('0x18')]){delete _0x121297['name'];}_0xe68374['status'](_0x3ec98f)[_0x12df('0x19')](_0x121297);};}exports[_0x12df('0x1a')]=function(_0x26ce2a,_0x3a7a44){var _0x2f18e9={};var _0x55c158=_[_0x12df('0x1b')](db[_0x12df('0x1c')][_0x12df('0x1d')],function(_0xb5bace){return{'name':_0xb5bace[_0x12df('0x1e')],'type':_0xb5bace[_0x12df('0x1f')][_0x12df('0x20')]};});_0x2f18e9=qs[_0x12df('0x21')](_0x55c158,_0x26ce2a);return interaction[_0x12df('0x22')](_0x12df('0x23'),_0x26ce2a[_0x12df('0x24')],_0x26ce2a[_0x12df('0x25')],_0x2f18e9,_0x55c158)[_0x12df('0x15')](respondWithFilteredResult(_0x3a7a44,_0x2f18e9))[_0x12df('0x26')](handleError(_0x3a7a44,null));};exports[_0x12df('0x27')]=function(_0x14b1af,_0x227aec){var _0x40672d={};if(_0x14b1af[_0x12df('0x24')][_0x12df('0x1f')]&&_0x14b1af['query'][_0x12df('0x1f')]===_0x12df('0x28')){_0x40672d[_0x12df('0x28')]=_0x14b1af[_0x12df('0x29')]['id'];}else{_0x40672d['id']=_0x14b1af['params']['id'];}var _0x94b29e={'raw':![],'where':_0x40672d},_0x5985ac={};_0x5985ac[_0x12df('0x2a')]=_[_0x12df('0x2b')](db[_0x12df('0x1c')][_0x12df('0x1d')]);_0x5985ac['query']=_['keys'](_0x14b1af[_0x12df('0x24')]);_0x5985ac[_0x12df('0x2c')]=_[_0x12df('0x2d')](_0x5985ac['model'],_0x5985ac[_0x12df('0x24')]);_0x94b29e['attributes']=_[_0x12df('0x2d')](_0x5985ac[_0x12df('0x2a')],qs[_0x12df('0x2e')](_0x14b1af[_0x12df('0x24')]['fields']));_0x94b29e[_0x12df('0x2f')]=_0x94b29e[_0x12df('0x2f')][_0x12df('0x30')]?_0x94b29e[_0x12df('0x2f')]:_0x5985ac['model'];if(_0x14b1af[_0x12df('0x24')][_0x12df('0x31')]){_0x94b29e[_0x12df('0x32')]=[{'all':!![]}];}_0x94b29e=_[_0x12df('0x33')]({},_0x94b29e,_0x14b1af['options']);return db[_0x12df('0x1c')][_0x12df('0x34')](_0x94b29e)[_0x12df('0x15')](handleEntityNotFound(_0x227aec,null))['then'](respondWithResult(_0x227aec,null))[_0x12df('0x26')](handleError(_0x227aec,null));};exports[_0x12df('0x35')]=function(_0xe838f0,_0x35e260){return db[_0x12df('0x1c')][_0x12df('0x35')](_0xe838f0[_0x12df('0x36')],{})[_0x12df('0x15')](respondWithResult(_0x35e260,0xc9))[_0x12df('0x26')](handleError(_0x35e260,null));};exports[_0x12df('0x14')]=function(_0x3dc008,_0x29bf9b){if(_0x3dc008[_0x12df('0x36')]['id']){delete _0x3dc008[_0x12df('0x36')]['id'];}return db['OpenchannelInteraction'][_0x12df('0x34')]({'where':{'id':_0x3dc008[_0x12df('0x29')]['id']}})[_0x12df('0x15')](handleEntityNotFound(_0x29bf9b,null))[_0x12df('0x15')](saveUpdates(_0x3dc008[_0x12df('0x36')],null))['then'](respondWithResult(_0x29bf9b,null))[_0x12df('0x26')](handleError(_0x29bf9b,null));};exports[_0x12df('0x16')]=function(_0x39ade4,_0x184a92){return db['OpenchannelInteraction'][_0x12df('0x34')]({'where':{'id':_0x39ade4[_0x12df('0x29')]['id']}})[_0x12df('0x15')](handleEntityNotFound(_0x184a92,null))[_0x12df('0x15')](removeEntity(_0x184a92,null))[_0x12df('0x26')](handleError(_0x184a92,null));};exports[_0x12df('0x37')]=function(_0x43ca06,_0x4ef758){return db[_0x12df('0x1c')][_0x12df('0x37')]()[_0x12df('0x15')](respondWithResult(_0x4ef758,null))[_0x12df('0x26')](handleError(_0x4ef758,null));};exports[_0x12df('0x38')]=function(_0x4334c7,_0x48e65a){return db[_0x12df('0x39')]['find']({'where':{'id':_0x4334c7['params']['id']}})[_0x12df('0x15')](handleEntityNotFound(_0x48e65a,null))[_0x12df('0x15')](function(_0x5db56f){if(_0x5db56f){return _0x5db56f[_0x12df('0x38')](_0x4334c7['body']['ids'],_['omit'](_0x4334c7[_0x12df('0x36')],[_0x12df('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x48e65a,null))[_0x12df('0x26')](handleError(_0x48e65a,null));};exports[_0x12df('0x3b')]=function(_0x409315,_0xb8efa6){var _0x22bdb4={'raw':![],'where':{}};var _0x5bf111={};var _0x79bae5={'count':0x0,'rows':[]};return db[_0x12df('0x1c')][_0x12df('0x3c')]({'where':{'id':_0x409315['params']['id']}})[_0x12df('0x15')](handleEntityNotFound(_0xb8efa6,null))[_0x12df('0x15')](function(_0x25187c){if(_0x25187c){_0x5bf111[_0x12df('0x2a')]=_[_0x12df('0x2b')](db[_0x12df('0x39')][_0x12df('0x1d')]);_0x5bf111[_0x12df('0x24')]=_[_0x12df('0x2b')](_0x409315[_0x12df('0x24')]);_0x5bf111['filters']=_[_0x12df('0x2d')](_0x5bf111[_0x12df('0x2a')],_0x5bf111[_0x12df('0x24')]);_0x22bdb4['attributes']=_[_0x12df('0x2d')](_0x5bf111[_0x12df('0x2a')],qs[_0x12df('0x2e')](_0x409315[_0x12df('0x24')]['fields']));_0x22bdb4['attributes']=_0x22bdb4[_0x12df('0x2f')][_0x12df('0x30')]?_0x22bdb4['attributes']:_0x5bf111[_0x12df('0x2a')];if(!_0x409315['query'][_0x12df('0x3d')](_0x12df('0x3e'))){_0x22bdb4[_0x12df('0x3f')]=qs['limit'](_0x409315[_0x12df('0x24')][_0x12df('0x3f')]);_0x22bdb4[_0x12df('0x10')]=qs[_0x12df('0x10')](_0x409315[_0x12df('0x24')][_0x12df('0x10')]);}_0x22bdb4[_0x12df('0x40')]=qs[_0x12df('0x41')](_0x409315[_0x12df('0x24')][_0x12df('0x41')]);_0x22bdb4['where']=qs[_0x12df('0x2c')](_[_0x12df('0x42')](_0x409315[_0x12df('0x24')],_0x5bf111['filters']));_0x22bdb4[_0x12df('0x43')]['OpenchannelInteractionId']=_0x25187c['id'];if(_0x409315[_0x12df('0x24')][_0x12df('0x44')]){_0x22bdb4[_0x12df('0x43')]=_[_0x12df('0x33')](_0x22bdb4['where'],{'$or':_[_0x12df('0x1b')](_0x22bdb4[_0x12df('0x2f')],function(_0x5746d5){var _0x31c6a9={};_0x31c6a9[_0x5746d5]={'$like':'%'+_0x409315[_0x12df('0x24')][_0x12df('0x44')]+'%'};return _0x31c6a9;})});}if(_0x409315[_0x12df('0x24')][_0x12df('0x45')]){var _0x2a59bd=_0x409315[_0x12df('0x24')][_0x12df('0x45')]['split'](',');var _0x354170={};_0x354170[_0x2a59bd[0x0]]={'$gte':moment(_0x2a59bd[0x1])[_0x12df('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x22bdb4[_0x12df('0x43')]=_['merge'](_0x22bdb4[_0x12df('0x43')],_0x354170);}_0x22bdb4=_[_0x12df('0x33')]({},_0x22bdb4,_0x409315[_0x12df('0x47')]);return db[_0x12df('0x39')][_0x12df('0x12')]({'where':_0x22bdb4['where']})[_0x12df('0x15')](function(_0x556573){_0x79bae5[_0x12df('0x12')]=_0x556573;if(_0x409315[_0x12df('0x24')][_0x12df('0x31')]){_0x22bdb4[_0x12df('0x32')]=[{'all':!![]}];}return db[_0x12df('0x39')][_0x12df('0x22')](_0x22bdb4);})[_0x12df('0x15')](function(_0x54f6f9){_0x79bae5[_0x12df('0x48')]=_0x54f6f9;return _0x79bae5;});}})[_0x12df('0x15')](respondWithFilteredResult(_0xb8efa6,_0x22bdb4))[_0x12df('0x26')](handleError(_0xb8efa6,null));};exports[_0x12df('0x49')]=function(_0x5e1650,_0x2567a4){return db[_0x12df('0x1c')][_0x12df('0x34')]({'where':{'id':_0x5e1650[_0x12df('0x29')]['id']}})[_0x12df('0x15')](handleEntityNotFound(_0x2567a4,null))[_0x12df('0x15')](function(_0x4cb1b3){if(_0x4cb1b3){return _0x4cb1b3[_0x12df('0x4a')](_0x5e1650[_0x12df('0x36')][_0x12df('0x3a')],_[_0x12df('0x4b')](_0x5e1650[_0x12df('0x36')],[_0x12df('0x3a'),'id'])||{})[_0x12df('0x4c')](function(){return db[_0x12df('0x4d')][_0x12df('0x22')]({'attributes':['id',_0x12df('0x18'),_0x12df('0x4e')],'where':{'id':_0x5e1650[_0x12df('0x36')][_0x12df('0x3a')]}});})[_0x12df('0x15')](function(_0x3b6eae){socket[_0x12df('0x4f')]('openchannelInteractionTags:save',{'id':Number(_0x5e1650[_0x12df('0x29')]['id']),'tags':_0x3b6eae||[]});return{'id':Number(_0x5e1650[_0x12df('0x29')]['id']),'tags':_0x3b6eae||[]};});}})[_0x12df('0x15')](respondWithResult(_0x2567a4,null))['catch'](handleError(_0x2567a4,null));};exports['removeTags']=function(_0x37d76e,_0x5ef8da){return db[_0x12df('0x1c')][_0x12df('0x34')]({'where':{'id':_0x37d76e[_0x12df('0x29')]['id']}})[_0x12df('0x15')](handleEntityNotFound(_0x5ef8da,null))[_0x12df('0x15')](function(_0x1a4641){if(_0x1a4641){return _0x1a4641[_0x12df('0x50')](_0x37d76e[_0x12df('0x24')][_0x12df('0x3a')]);}})[_0x12df('0x15')](respondWithStatusCode(_0x5ef8da,null))[_0x12df('0x26')](handleError(_0x5ef8da,null));};exports[_0x12df('0x51')]=function(_0x412ae0,_0x3c9aaa){var _0xcf673c=moment()[_0x12df('0x52')]()[_0x12df('0x53')]();var _0x30be3c=path[_0x12df('0x54')](config[_0x12df('0x55')],_0x12df('0x56'),'files',_0x12df('0x57'));var _0x439003=path[_0x12df('0x54')](config[_0x12df('0x55')],'server',_0x12df('0x58'),_0x12df('0x59'));var _0x304605=path['join'](_0x30be3c,_0xcf673c);var _0x2e4dc1=util[_0x12df('0x46')]('transcript-%d-%s.zip',_0x412ae0[_0x12df('0x29')]['id'],_0xcf673c);var _0x501f7a=path[_0x12df('0x54')](_0x30be3c,_0x2e4dc1);var _0x4664fa=[];_0x4664fa[_0x12df('0x5a')]({'model':db[_0x12df('0x5b')],'as':_0x12df('0x5b'),'attributes':['id',_0x12df('0x5c')],'raw':!![]});_0x4664fa[_0x12df('0x5a')]({'model':db['CmContact'],'as':_0x12df('0x5d'),'attributes':['id',_0x12df('0x5e'),_0x12df('0x5f')],'raw':!![]});if(_0x412ae0[_0x12df('0x24')][_0x12df('0x59')]){_0x4664fa[_0x12df('0x5a')]({'model':db[_0x12df('0x60')],'as':_0x12df('0x60'),'raw':!![]});}var _0xd42d7e=[{'model':db[_0x12df('0x39')],'as':'Messages','attributes':['id',_0x12df('0x36'),_0x12df('0x61'),'direction',_0x12df('0x62'),_0x12df('0x63')],'include':_0x4664fa}];_0xd42d7e[_0x12df('0x5a')]({'model':db[_0x12df('0x64')],'as':_0x12df('0x65'),'attributes':['id',_0x12df('0x18')]});_0xd42d7e[_0x12df('0x5a')]({'model':db[_0x12df('0x5b')],'as':_0x12df('0x66'),'attributes':['id','fullname']});return db[_0x12df('0x1c')]['find']({'where':{'id':_0x412ae0[_0x12df('0x29')]['id']},'include':_0xd42d7e})[_0x12df('0x15')](handleEntityNotFound(_0x3c9aaa,null))[_0x12df('0x15')](function(_0x2a4b36){if(_0x2a4b36){var _0x2fdebc=_0x2a4b36[_0x12df('0x67')]({'plain':!![]});fs['mkdirSync'](_0x304605);var _0x5447d3={'channel':_0x12df('0x68'),'account':_0x2fdebc[_0x12df('0x65')][_0x12df('0x18')],'agent':_0x2fdebc['Owner']?_0x2fdebc['Owner'][_0x12df('0x5c')]:'N.A.','createdAt':moment(_0x2fdebc[_0x12df('0x61')])[_0x12df('0x46')](_0x12df('0x69'))[_0x12df('0x53')](),'closedAt':_0x2fdebc[_0x12df('0x6a')]?moment(_0x2fdebc[_0x12df('0x6b')])[_0x12df('0x46')](_0x12df('0x69'))[_0x12df('0x53')]():'','disposition':_0x2fdebc['disposition'],'visibility':_0x2fdebc[_0x12df('0x6c')]?_0x12df('0x6d'):_0x12df('0x6e'),'messages':_(_0x2fdebc[_0x12df('0x6f')])['filter']({'secret':![]})['map'](function(_0x3c60dc){if(_0x3c60dc[_0x12df('0x60')]){var _0x58b762=path['join'](_0x439003,_0x3c60dc['Attachment']['basename']);if(fs['existsSync'](_0x58b762)){fs[_0x12df('0x70')](_0x58b762)[_0x12df('0x71')](fs[_0x12df('0x72')](path[_0x12df('0x54')](_0x304605,_0x3c60dc['Attachment'][_0x12df('0x73')])));}}return{'date':moment(_0x3c60dc[_0x12df('0x61')])[_0x12df('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x12df('0x53')](),'sender':_0x3c60dc['direction']===_0x12df('0x74')?_0x3c60dc[_0x12df('0x5b')]?_0x3c60dc[_0x12df('0x5b')]['fullname']:_0x12df('0x75'):_0x3c60dc[_0x12df('0x5d')]['firstName']+(_0x3c60dc[_0x12df('0x5d')][_0x12df('0x5f')]?'\x20'+_0x3c60dc[_0x12df('0x5d')][_0x12df('0x5f')]:''),'body':_0x3c60dc[_0x12df('0x60')]?_0x3c60dc['Attachment'][_0x12df('0x73')]:_0x3c60dc[_0x12df('0x36')],'direction':_0x3c60dc[_0x12df('0x76')]===_0x12df('0x74')?'A':'C','secret':_0x3c60dc['secret'],'read':_0x3c60dc[_0x12df('0x63')],'attachment':_0x3c60dc[_0x12df('0x60')]};})[_0x12df('0x77')]()};return ejs[_0x12df('0x78')](path[_0x12df('0x54')](config[_0x12df('0x55')],_0x12df('0x56'),_0x12df('0x79'),_0x12df('0x7a')),{'interaction':_0x5447d3})['then'](function(_0x2adfb3){var _0x81da31=path['join'](_0x304605,_0x12df('0x7b')+_0x2fdebc['id']+'-'+_0xcf673c+_0x12df('0x7c'));var _0xe62d5d={'path':_0x81da31,'channel':_0x12df('0x68'),'interactionId':_0x2fdebc['id']};return pdf[_0x12df('0x7d')](_0x2adfb3,_0xe62d5d);})['then'](function(){return new Promise(function(_0xd610,_0x42dd80){zipdir(_0x304605,{'saveTo':_0x501f7a},function(_0x5b2542,_0x45c60b){if(_0x5b2542)return _0x42dd80(_0x5b2542);return _0xd610(_0x45c60b);});})[_0x12df('0x15')](function(){return new Promise(function(_0x63e261,_0xdcd850){rimraf(_0x304605,function(_0x506615){if(_0x506615)_0xdcd850(_0x506615);return _0x63e261();});});})[_0x12df('0x15')](function(){return _0x3c9aaa[_0x12df('0x51')](_0x501f7a,_0x2e4dc1,function(_0xf49d50){if(_0xf49d50){logger[_0x12df('0x7e')](_0x12df('0x7f'),_0xf49d50);}else{fs[_0x12df('0x80')](_0x501f7a);}});});});}else{return _0x3c9aaa[_0x12df('0x81')](0xc8);}})[_0x12df('0x26')](handleError(_0x3c9aaa,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e3d7efd..83b2638 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 _0x935f=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2f9fab,_0x3cf9dd){var _0x282ffa=function(_0x30b9c5){while(--_0x30b9c5){_0x2f9fab['push'](_0x2f9fab['shift']());}};_0x282ffa(++_0x3cf9dd);}(_0x935f,0x1aa));var _0xf935=function(_0x1ae7c8,_0x4ea6a4){_0x1ae7c8=_0x1ae7c8-0x0;var _0x2327a0=_0x935f[_0x1ae7c8];return _0x2327a0;};'use strict';var EventEmitter=require(_0xf935('0x0'));var OpenchannelInteraction=require(_0xf935('0x1'))['db'][_0xf935('0x2')];var OpenchannelMessage=require(_0xf935('0x1'))['db'][_0xf935('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf935('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf935('0x5'),'afterDestroy':_0xf935('0x6')};function emitEvent(_0x5037dd){return function(_0x5899f1,_0x2a6274,_0x534868){_0x5899f1[_0xf935('0x7')]({'attributes':['id'],'raw':!![]})[_0xf935('0x8')](function(_0x38da89){_0x5899f1[_0xf935('0x9')](_0xf935('0xa'),_0x38da89[_0xf935('0xb')](function(_0x3e4b57){return{'id':_0x3e4b57['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5899f1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf935('0x8')](function(_0x528304){_0x5899f1[_0xf935('0x9')](_0xf935('0xc'),_0x528304[_0xf935('0xd')]);OpenchannelInteractionEvents[_0xf935('0xe')](_0x5037dd+':'+_0x5899f1['id'],_0x5899f1);OpenchannelInteractionEvents[_0xf935('0xe')](_0x5037dd,_0x5899f1);_0x534868(null);})[_0xf935('0xf')](_0x534868(null));};}for(var e in events){if(events[_0xf935('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xf935('0x11')](e,emitEvent(event));}}module[_0xf935('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1b40=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','emit'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x1b40,0x19a));var _0x01b4=function(_0x4074d5,_0xa57194){_0x4074d5=_0x4074d5-0x0;var _0x502cfe=_0x1b40[_0x4074d5];return _0x502cfe;};'use strict';var EventEmitter=require(_0x01b4('0x0'));var OpenchannelInteraction=require(_0x01b4('0x1'))['db'][_0x01b4('0x2')];var OpenchannelMessage=require(_0x01b4('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x01b4('0x3')](0x0);var events={'afterCreate':_0x01b4('0x4'),'afterUpdate':_0x01b4('0x5'),'afterDestroy':_0x01b4('0x6')};function emitEvent(_0x1d12f3){return function(_0x42426c,_0x51beff,_0x1c57a6){_0x42426c[_0x01b4('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ffc0c){_0x42426c['setDataValue']('Users',_0x3ffc0c['map'](function(_0x2caadd){return{'id':_0x2caadd['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x42426c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1bb680){_0x42426c[_0x01b4('0x8')]('unreadMessages',_0x1bb680['length']);OpenchannelInteractionEvents[_0x01b4('0x9')](_0x1d12f3+':'+_0x42426c['id'],_0x42426c);OpenchannelInteractionEvents[_0x01b4('0x9')](_0x1d12f3,_0x42426c);_0x1c57a6(null);})[_0x01b4('0xa')](_0x1c57a6(null));};}for(var e in events){if(events[_0x01b4('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x01b4('0xc')](e,emitEvent(event));}}module[_0x01b4('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 882535f..ca2c49f 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 _0x50dc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','format','util'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0x50dc,0x1a3));var _0xc50d=function(_0x2069ca,_0x572dd1){_0x2069ca=_0x2069ca-0x0;var _0x28cd79=_0x50dc[_0x2069ca];return _0x28cd79;};'use strict';var _=require('lodash');var util=require(_0xc50d('0x0'));var logger=require(_0xc50d('0x1'))('api');var moment=require(_0xc50d('0x2'));var BPromise=require(_0xc50d('0x3'));var rp=require(_0xc50d('0x4'));var fs=require('fs');var path=require(_0xc50d('0x5'));var rimraf=require(_0xc50d('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xc50d('0x7')]=function(_0x1417f9,_0x1272bf){return _0x1417f9[_0xc50d('0x8')](_0xc50d('0x9'),attributes,{'tableName':_0xc50d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc50d('0xb'),'hooks':{'beforeUpdate':function(_0x5bd371,_0x2d2da4,_0x3b892d){if(_0x5bd371[_0xc50d('0xc')]('closed')){_0x5bd371['closedAt']=moment()[_0xc50d('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b892d(null,_0x5bd371);}}});}; \ No newline at end of file +var _0x63b5=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x477baf,_0x3c9f29){var _0x43f9ed=function(_0x310f2f){while(--_0x310f2f){_0x477baf['push'](_0x477baf['shift']());}};_0x43f9ed(++_0x3c9f29);}(_0x63b5,0x17c));var _0x563b=function(_0x3509fd,_0x46c033){_0x3509fd=_0x3509fd-0x0;var _0x35b5cd=_0x63b5[_0x3509fd];return _0x35b5cd;};'use strict';var _=require(_0x563b('0x0'));var util=require(_0x563b('0x1'));var logger=require(_0x563b('0x2'))(_0x563b('0x3'));var moment=require('moment');var BPromise=require(_0x563b('0x4'));var rp=require(_0x563b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x563b('0x6'));var config=require(_0x563b('0x7'));var attributes=require(_0x563b('0x8'));module['exports']=function(_0x2b76ba,_0xd70ffe){return _0x2b76ba[_0x563b('0x9')](_0x563b('0xa'),attributes,{'tableName':_0x563b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x563b('0xc'),'collate':_0x563b('0xd'),'hooks':{'beforeUpdate':function(_0x2c2337,_0x5a1cee,_0x35c281){if(_0x2c2337[_0x563b('0xe')](_0x563b('0xf'))){_0x2c2337[_0x563b('0x10')]=moment()['format'](_0x563b('0x11'));}_0x35c281(null,_0x2c2337);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 112c998..f6c8ee3 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 _0x93e0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelInteraction.socket','register','request','then','debug','request\x20sent','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash'];(function(_0x7d41d2,_0x35af8e){var _0x55b4ff=function(_0x3a2719){while(--_0x3a2719){_0x7d41d2['push'](_0x7d41d2['shift']());}};_0x55b4ff(++_0x35af8e);}(_0x93e0,0x1d8));var _0x093e=function(_0x1022d2,_0x38457b){_0x1022d2=_0x1022d2-0x0;var _0x5a84c4=_0x93e0[_0x1022d2];return _0x5a84c4;};'use strict';var _=require(_0x093e('0x0'));var util=require(_0x093e('0x1'));var moment=require(_0x093e('0x2'));var BPromise=require(_0x093e('0x3'));var rs=require(_0x093e('0x4'));var fs=require('fs');var Redis=require(_0x093e('0x5'));var db=require(_0x093e('0x6'))['db'];var utils=require(_0x093e('0x7'));var logger=require(_0x093e('0x8'))(_0x093e('0x9'));var config=require(_0x093e('0xa'));var jayson=require(_0x093e('0xb'));var client=jayson[_0x093e('0xc')]['http']({'port':0x232a});config[_0x093e('0xd')]=_['defaults'](config[_0x093e('0xd')],{'host':_0x093e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x093e('0xd')]));require(_0x093e('0xf'))[_0x093e('0x10')](socket);function respondWithRpcPromise(_0x5530a5,_0x4d39ff,_0x4dabc5){return new BPromise(function(_0x4fdac2,_0x35b439){return client[_0x093e('0x11')](_0x5530a5,_0x4dabc5)[_0x093e('0x12')](function(_0x2187a5){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d39ff,'request\x20sent');logger[_0x093e('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4d39ff,_0x093e('0x14'),JSON['stringify'](_0x2187a5));if(_0x2187a5[_0x093e('0x15')]){if(_0x2187a5[_0x093e('0x15')][_0x093e('0x16')]===0x1f4){logger[_0x093e('0x15')](_0x093e('0x17'),_0x4d39ff,_0x2187a5[_0x093e('0x15')]['message']);return _0x35b439(_0x2187a5[_0x093e('0x15')][_0x093e('0x18')]);}logger[_0x093e('0x15')](_0x093e('0x17'),_0x4d39ff,_0x2187a5[_0x093e('0x15')][_0x093e('0x18')]);return _0x4fdac2(_0x2187a5['error'][_0x093e('0x18')]);}else{logger[_0x093e('0x19')](_0x093e('0x17'),_0x4d39ff,_0x093e('0x14'));_0x4fdac2(_0x2187a5['result'][_0x093e('0x18')]);}})[_0x093e('0x1a')](function(_0x22f9d6){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d39ff,_0x22f9d6);_0x35b439(_0x22f9d6);});});}exports[_0x093e('0x1b')]=function(_0x6d6a9e){var _0x5d0bc6=this;return new Promise(function(_0x2159ec,_0x230c73){return db['OpenchannelInteraction'][_0x093e('0x1c')](_0x6d6a9e[_0x093e('0x1d')],{'raw':_0x6d6a9e['options']?_0x6d6a9e[_0x093e('0x1e')][_0x093e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6d6a9e[_0x093e('0x1e')]?_0x6d6a9e[_0x093e('0x1e')][_0x093e('0x20')]||null:null,'attributes':_0x6d6a9e[_0x093e('0x1e')]?_0x6d6a9e[_0x093e('0x1e')][_0x093e('0x21')]||null:null,'limit':_0x6d6a9e[_0x093e('0x1e')]?_0x6d6a9e[_0x093e('0x1e')][_0x093e('0x22')]||null:null})[_0x093e('0x12')](function(_0x3c6108){logger['info'](_0x093e('0x1b'),_0x6d6a9e);logger[_0x093e('0x13')](_0x093e('0x1b'),_0x6d6a9e,JSON[_0x093e('0x23')](_0x3c6108));_0x2159ec(_0x3c6108);})[_0x093e('0x1a')](function(_0x57ec09){logger[_0x093e('0x15')]('UpdateOpenchannelInteraction',_0x57ec09[_0x093e('0x18')],_0x6d6a9e);_0x230c73(_0x5d0bc6['error'](0x1f4,_0x57ec09['message']));});});};exports[_0x093e('0x24')]=function(_0x2ec302){return new Promise(function(_0x5a8b14,_0x1727b7){return db[_0x093e('0x25')][_0x093e('0x26')]({'where':_0x2ec302['options']?_0x2ec302['options'][_0x093e('0x20')]||null:null})[_0x093e('0x12')](function(_0x262f34){if(_0x262f34){return _0x262f34[_0x093e('0x27')](_0x2ec302[_0x093e('0x1d')][_0x093e('0x28')],_['omit'](_0x2ec302[_0x093e('0x1d')],[_0x093e('0x28'),'id'])||{});}})[_0x093e('0x29')](function(_0x4808ac){logger[_0x093e('0x19')](_0x093e('0x2a'),_0x2ec302);logger[_0x093e('0x13')](_0x093e('0x2a'),_0x2ec302,JSON['stringify'](_0x4808ac));_0x5a8b14(_0x4808ac);})[_0x093e('0x1a')](function(_0x135893){logger['error'](_0x093e('0x2a'),_0x135893[_0x093e('0x18')],_0x2ec302);_0x1727b7(_this[_0x093e('0x15')](0x1f4,_0x135893[_0x093e('0x18')]));});});}; \ No newline at end of file +var _0x4f0c=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','info','catch','OpenchannelInteraction','update','body','options','where','attributes','UpdateOpenchannelInteraction','debug','stringify','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','defaults','localhost','redis','./openchannelInteraction.socket','register','request','then'];(function(_0xec816e,_0x199b6a){var _0x558d7c=function(_0x5b0d64){while(--_0x5b0d64){_0xec816e['push'](_0xec816e['shift']());}};_0x558d7c(++_0x199b6a);}(_0x4f0c,0x1e9));var _0xc4f0=function(_0x30cbdb,_0x2df0c2){_0x30cbdb=_0x30cbdb-0x0;var _0xf9e43=_0x4f0c[_0x30cbdb];return _0xf9e43;};'use strict';var _=require('lodash');var util=require(_0xc4f0('0x0'));var moment=require(_0xc4f0('0x1'));var BPromise=require(_0xc4f0('0x2'));var rs=require(_0xc4f0('0x3'));var fs=require('fs');var Redis=require(_0xc4f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc4f0('0x5'))(_0xc4f0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc4f0('0x7')]({'port':0x232a});config['redis']=_[_0xc4f0('0x8')](config['redis'],{'host':_0xc4f0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4f0('0xa')]));require(_0xc4f0('0xb'))[_0xc4f0('0xc')](socket);function respondWithRpcPromise(_0x34d178,_0x477586,_0x5adb2d){return new BPromise(function(_0x46c69b,_0x2a2ed0){return client[_0xc4f0('0xd')](_0x34d178,_0x5adb2d)[_0xc4f0('0xe')](function(_0x3b8da3){logger['info'](_0xc4f0('0xf'),_0x477586,_0xc4f0('0x10'));logger['debug'](_0xc4f0('0x11'),_0x477586,'request\x20sent',JSON['stringify'](_0x3b8da3));if(_0x3b8da3[_0xc4f0('0x12')]){if(_0x3b8da3['error']['code']===0x1f4){logger[_0xc4f0('0x12')](_0xc4f0('0xf'),_0x477586,_0x3b8da3['error'][_0xc4f0('0x13')]);return _0x2a2ed0(_0x3b8da3[_0xc4f0('0x12')][_0xc4f0('0x13')]);}logger[_0xc4f0('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x477586,_0x3b8da3['error']['message']);return _0x46c69b(_0x3b8da3['error'][_0xc4f0('0x13')]);}else{logger[_0xc4f0('0x14')](_0xc4f0('0xf'),_0x477586,_0xc4f0('0x10'));_0x46c69b(_0x3b8da3['result'][_0xc4f0('0x13')]);}})[_0xc4f0('0x15')](function(_0x7665af){logger[_0xc4f0('0x12')](_0xc4f0('0xf'),_0x477586,_0x7665af);_0x2a2ed0(_0x7665af);});});}exports['UpdateOpenchannelInteraction']=function(_0xa68240){var _0x3b0f88=this;return new Promise(function(_0x3a5a1a,_0x3b6583){return db[_0xc4f0('0x16')][_0xc4f0('0x17')](_0xa68240[_0xc4f0('0x18')],{'raw':_0xa68240[_0xc4f0('0x19')]?_0xa68240[_0xc4f0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa68240['options']?_0xa68240[_0xc4f0('0x19')][_0xc4f0('0x1a')]||null:null,'attributes':_0xa68240['options']?_0xa68240[_0xc4f0('0x19')][_0xc4f0('0x1b')]||null:null,'limit':_0xa68240[_0xc4f0('0x19')]?_0xa68240[_0xc4f0('0x19')]['limit']||null:null})[_0xc4f0('0xe')](function(_0x1df610){logger[_0xc4f0('0x14')](_0xc4f0('0x1c'),_0xa68240);logger[_0xc4f0('0x1d')](_0xc4f0('0x1c'),_0xa68240,JSON[_0xc4f0('0x1e')](_0x1df610));_0x3a5a1a(_0x1df610);})[_0xc4f0('0x15')](function(_0x2f6898){logger[_0xc4f0('0x12')]('UpdateOpenchannelInteraction',_0x2f6898[_0xc4f0('0x13')],_0xa68240);_0x3b6583(_0x3b0f88[_0xc4f0('0x12')](0x1f4,_0x2f6898[_0xc4f0('0x13')]));});});};exports[_0xc4f0('0x1f')]=function(_0x2478b5){return new Promise(function(_0x8aa9c1,_0x5e7adc){return db[_0xc4f0('0x16')]['find']({'where':_0x2478b5['options']?_0x2478b5[_0xc4f0('0x19')]['where']||null:null})['then'](function(_0x12e67d){if(_0x12e67d){return _0x12e67d[_0xc4f0('0x20')](_0x2478b5[_0xc4f0('0x18')][_0xc4f0('0x21')],_[_0xc4f0('0x22')](_0x2478b5[_0xc4f0('0x18')],[_0xc4f0('0x21'),'id'])||{});}})['spread'](function(_0x5de733){logger['info'](_0xc4f0('0x23'),_0x2478b5);logger[_0xc4f0('0x1d')](_0xc4f0('0x23'),_0x2478b5,JSON[_0xc4f0('0x1e')](_0x5de733));_0x8aa9c1(_0x5de733);})[_0xc4f0('0x15')](function(_0x19ec59){logger[_0xc4f0('0x12')](_0xc4f0('0x23'),_0x19ec59['message'],_0x2478b5);_0x5e7adc(_this[_0xc4f0('0x12')](0x1f4,_0x19ec59[_0xc4f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 356ba3e..a2b851d 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 _0x81f0=['openchannelInteraction:','save','update','removeListener','register'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x81f0,0x65));var _0x081f=function(_0x4bc905,_0x59b9dc){_0x4bc905=_0x4bc905-0x0;var _0x35261f=_0x81f0[_0x4bc905];return _0x35261f;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x081f('0x0'),'remove',_0x081f('0x1')];function createListener(_0x452466,_0x1220fa){return function(_0x4d9b5d){_0x1220fa['emit'](_0x452466,_0x4d9b5d);};}function removeListener(_0x8a47be,_0xe26f53){return function(){OpenchannelInteractionEvents[_0x081f('0x2')](_0x8a47be,_0xe26f53);};}exports[_0x081f('0x3')]=function(_0x3304e7){for(var _0x49d554=0x0,_0x47dfab=events['length'];_0x49d554<_0x47dfab;_0x49d554++){var _0x5de20e=events[_0x49d554];var _0x8c5681=createListener(_0x081f('0x4')+_0x5de20e,_0x3304e7);OpenchannelInteractionEvents['on'](_0x5de20e,_0x8c5681);}}; \ No newline at end of file +var _0x552d=['./openchannelInteraction.events','save','remove','emit','register','openchannelInteraction:'];(function(_0x1558b8,_0x4fe768){var _0x16a596=function(_0x4ef95f){while(--_0x4ef95f){_0x1558b8['push'](_0x1558b8['shift']());}};_0x16a596(++_0x4fe768);}(_0x552d,0x18c));var _0xd552=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x552d[_0x2070da];return _0x4f9fe1;};'use strict';var OpenchannelInteractionEvents=require(_0xd552('0x0'));var events=[_0xd552('0x1'),_0xd552('0x2'),'update'];function createListener(_0x50d919,_0x5e1e46){return function(_0x370d67){_0x5e1e46[_0xd552('0x3')](_0x50d919,_0x370d67);};}function removeListener(_0x4ba95d,_0x4fa9bd){return function(){OpenchannelInteractionEvents['removeListener'](_0x4ba95d,_0x4fa9bd);};}exports[_0xd552('0x4')]=function(_0x58f395){for(var _0x9cd3f1=0x0,_0x244f20=events['length'];_0x9cd3f1<_0x244f20;_0x9cd3f1++){var _0xaf4cd6=events[_0x9cd3f1];var _0x5d792f=createListener(_0xd552('0x5')+_0xaf4cd6,_0x58f395);OpenchannelInteractionEvents['on'](_0xaf4cd6,_0x5d792f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 56d2006..32c2697 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x1e1f17,_0x4bd574){var _0x465b52=function(_0x46accd){while(--_0x46accd){_0x1e1f17['push'](_0x1e1f17['shift']());}};_0x465b52(++_0x4bd574);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xcb91[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x2ad53b,_0x931b3){_0x2ad53b=_0x2ad53b-0x0;var _0x326301=_0x70e0[_0x2ad53b];return _0x326301;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b8c8be0..3bdb0aa 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 _0x97e7=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x97e7,0x1a1));var _0x797e=function(_0x2d7b3d,_0x1c13f8){_0x2d7b3d=_0x2d7b3d-0x0;var _0x4f7d89=_0x97e7[_0x2d7b3d];return _0x4f7d89;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'body':{'type':Sequelize[_0x797e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x797e('0x4')]('in',_0x797e('0x5')),'defaultValue':_0x797e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x797e('0x6')]},'providerName':{'type':Sequelize[_0x797e('0x7')]},'providerResponse':{'type':Sequelize[_0x797e('0x2')]}}; \ No newline at end of file +var _0x93e9=['BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x56f5ce,_0x2a6de8){var _0x206e9c=function(_0x52f735){while(--_0x52f735){_0x56f5ce['push'](_0x56f5ce['shift']());}};_0x206e9c(++_0x2a6de8);}(_0x93e9,0xcc));var _0x993e=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x93e9[_0x576266];return _0x18234f;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'body':{'type':Sequelize[_0x993e('0x2')](_0x993e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993e('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x993e('0x6')]},'providerName':{'type':Sequelize[_0x993e('0x7')]},'providerResponse':{'type':Sequelize[_0x993e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6feeda7..7706a85 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 _0x8a03=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','destroy','then','stack','name','send','index','OpenchannelMessage','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','describe','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','openchannel-interactions','reject','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','motionChannel','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a03,0xf0));var _0x38a0=function(_0x295de7,_0x158885){_0x295de7=_0x295de7-0x0;var _0x5f38d4=_0x8a03[_0x295de7];return _0x5f38d4;};'use strict';var emlformat=require(_0x38a0('0x0'));var rimraf=require(_0x38a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38a0('0x2'));var moment=require(_0x38a0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x38a0('0x4'));var util=require(_0x38a0('0x5'));var path=require(_0x38a0('0x6'));var sox=require('sox');var csv=require(_0x38a0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38a0('0x8'));var squel=require(_0x38a0('0x9'));var crypto=require(_0x38a0('0xa'));var jsforce=require(_0x38a0('0xb'));var deskjs=require(_0x38a0('0xc'));var toCsv=require(_0x38a0('0x7'));var querystring=require('querystring');var Papa=require(_0x38a0('0xd'));var Redis=require(_0x38a0('0xe'));var authService=require(_0x38a0('0xf'));var qs=require(_0x38a0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38a0('0x11'));var logger=require(_0x38a0('0x12'))(_0x38a0('0x13'));var utils=require('../../config/utils');var config=require(_0x38a0('0x14'));var licenseUtil=require(_0x38a0('0x15'));var db=require(_0x38a0('0x16'))['db'];config[_0x38a0('0x17')]=_[_0x38a0('0x18')](config['redis'],{'host':_0x38a0('0x19'),'port':0x18eb});var socket=require(_0x38a0('0x1a'))(new Redis(config[_0x38a0('0x17')]));require(_0x38a0('0x1b'))[_0x38a0('0x1c')](socket);var jayson=require(_0x38a0('0x1d'));var client=jayson[_0x38a0('0x1e')][_0x38a0('0x1f')]({'port':0x232c});var client9002=jayson[_0x38a0('0x1e')][_0x38a0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x495016,_0x57d0cb,_0x58df5d,_0x581d6d){return new BPromise(function(_0x523b73,_0xcc956b){var _0x443f8f=_0x581d6d||client;return _0x443f8f['request'](_0x495016,_0x58df5d)['then'](function(_0x149be1){logger[_0x38a0('0x20')](_0x38a0('0x21'),_0x57d0cb,_0x38a0('0x22'));logger[_0x38a0('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x57d0cb,_0x38a0('0x22'),JSON[_0x38a0('0x24')](_0x149be1));if(_0x149be1[_0x38a0('0x25')]){if(_0x149be1['error'][_0x38a0('0x26')]===0x1f4){logger[_0x38a0('0x25')](_0x38a0('0x21'),_0x57d0cb,_0x149be1[_0x38a0('0x25')][_0x38a0('0x27')]);return _0xcc956b(_0x149be1[_0x38a0('0x25')][_0x38a0('0x27')]);}logger[_0x38a0('0x25')](_0x38a0('0x21'),_0x57d0cb,_0x149be1[_0x38a0('0x25')][_0x38a0('0x27')]);return _0x523b73(_0x149be1[_0x38a0('0x25')][_0x38a0('0x27')]);}else{logger['info'](_0x38a0('0x21'),_0x57d0cb,_0x38a0('0x22'));_0x523b73(_0x149be1['result']['message']);}})['catch'](function(_0x2d1a5f){logger[_0x38a0('0x25')](_0x38a0('0x21'),_0x57d0cb,_0x2d1a5f);_0xcc956b(_0x2d1a5f);});});}function respondWithStatusCode(_0x560c6c,_0xd66083){_0xd66083=_0xd66083||0xcc;return function(_0x28dfb5){if(_0x28dfb5){return _0x560c6c[_0x38a0('0x28')](_0xd66083);}return _0x560c6c[_0x38a0('0x29')](_0xd66083)[_0x38a0('0x2a')]();};}function respondWithResult(_0x21b95e,_0x3b1068){_0x3b1068=_0x3b1068||0xc8;return function(_0x1fea51){if(_0x1fea51){return _0x21b95e['status'](_0x3b1068)['json'](_0x1fea51);}};}function respondWithFilteredResult(_0x3e7429,_0x3ae5fd){return function(_0x937801){if(_0x937801){var _0x8ff3a3=typeof _0x3ae5fd['offset']===_0x38a0('0x2b')&&typeof _0x3ae5fd[_0x38a0('0x2c')]===_0x38a0('0x2b');var _0x5c9be5=_0x937801[_0x38a0('0x2d')];var _0x222f4e=_0x8ff3a3?0x0:_0x3ae5fd[_0x38a0('0x2e')];var _0x395336=_0x8ff3a3?_0x937801[_0x38a0('0x2d')]:_0x3ae5fd[_0x38a0('0x2e')]+_0x3ae5fd['limit'];var _0xc408ef;if(_0x395336>=_0x5c9be5){_0x395336=_0x5c9be5;_0xc408ef=0xc8;}else{_0xc408ef=0xce;}_0x3e7429['status'](_0xc408ef);return _0x3e7429['set'](_0x38a0('0x2f'),_0x222f4e+'-'+_0x395336+'/'+_0x5c9be5)[_0x38a0('0x30')](_0x937801);}return null;};}function patchUpdates(_0x2ad91d){return function(_0x1fc10e){try{jsonpatch[_0x38a0('0x31')](_0x1fc10e,_0x2ad91d,!![]);}catch(_0x3a289c){return BPromise['reject'](_0x3a289c);}return _0x1fc10e[_0x38a0('0x32')]();};}function saveUpdates(_0x3bb0b4,_0x4def53){return function(_0x535b6a){if(_0x535b6a){return _0x535b6a['update'](_0x3bb0b4)['then'](function(_0x37f621){return _0x37f621;});}return null;};}function removeEntity(_0x17f0f3,_0x128718){return function(_0x2058e9){if(_0x2058e9){return _0x2058e9[_0x38a0('0x33')]()[_0x38a0('0x34')](function(){_0x17f0f3[_0x38a0('0x29')](0xcc)[_0x38a0('0x2a')]();});}};}function handleEntityNotFound(_0x299f71,_0x5b9869){return function(_0xd5a300){if(!_0xd5a300){_0x299f71[_0x38a0('0x28')](0x194);}return _0xd5a300;};}function handleError(_0x39cfc0,_0x44b504){_0x44b504=_0x44b504||0x1f4;return function(_0x14df89){logger[_0x38a0('0x25')](_0x14df89[_0x38a0('0x35')]);if(_0x14df89[_0x38a0('0x36')]){delete _0x14df89['name'];}_0x39cfc0[_0x38a0('0x29')](_0x44b504)[_0x38a0('0x37')](_0x14df89);};}exports[_0x38a0('0x38')]=function(_0x4912e9,_0xe3b4af){var _0x1e5749={},_0x3d9ce3={},_0x2716c2={'count':0x0,'rows':[]};var _0x306807=_['map'](db[_0x38a0('0x39')][_0x38a0('0x3a')],function(_0xf118d3){return{'name':_0xf118d3['fieldName'],'type':_0xf118d3[_0x38a0('0x3b')][_0x38a0('0x3c')]};});_0x3d9ce3[_0x38a0('0x3d')]=_[_0x38a0('0x3e')](_0x306807,_0x38a0('0x36'));_0x3d9ce3['query']=_[_0x38a0('0x3f')](_0x4912e9[_0x38a0('0x40')]);_0x3d9ce3[_0x38a0('0x41')]=_['intersection'](_0x3d9ce3['model'],_0x3d9ce3[_0x38a0('0x40')]);_0x1e5749[_0x38a0('0x42')]=_['intersection'](_0x3d9ce3[_0x38a0('0x3d')],qs[_0x38a0('0x43')](_0x4912e9['query'][_0x38a0('0x43')]));_0x1e5749['attributes']=_0x1e5749[_0x38a0('0x42')][_0x38a0('0x44')]?_0x1e5749[_0x38a0('0x42')]:_0x3d9ce3[_0x38a0('0x3d')];if(!_0x4912e9['query'][_0x38a0('0x45')]('nolimit')){_0x1e5749[_0x38a0('0x2c')]=qs[_0x38a0('0x2c')](_0x4912e9[_0x38a0('0x40')]['limit']);_0x1e5749['offset']=qs[_0x38a0('0x2e')](_0x4912e9[_0x38a0('0x40')][_0x38a0('0x2e')]);}_0x1e5749[_0x38a0('0x46')]=qs[_0x38a0('0x47')](_0x4912e9[_0x38a0('0x40')][_0x38a0('0x47')]);_0x1e5749[_0x38a0('0x48')]=qs[_0x38a0('0x41')](_[_0x38a0('0x49')](_0x4912e9[_0x38a0('0x40')],_0x3d9ce3[_0x38a0('0x41')]),_0x306807);if(_0x4912e9[_0x38a0('0x40')][_0x38a0('0x4a')]){_0x1e5749[_0x38a0('0x48')]=_[_0x38a0('0x4b')](_0x1e5749[_0x38a0('0x48')],{'$or':_[_0x38a0('0x3e')](_0x306807,function(_0x740557){if(_0x740557['type']!==_0x38a0('0x4c')){var _0x426488={};_0x426488[_0x740557['name']]={'$like':'%'+_0x4912e9[_0x38a0('0x40')]['filter']+'%'};return _0x426488;}})});}_0x1e5749=_[_0x38a0('0x4b')]({},_0x1e5749,_0x4912e9[_0x38a0('0x4d')]);var _0x488814={'where':_0x1e5749[_0x38a0('0x48')]};return db['OpenchannelMessage']['count'](_0x488814)[_0x38a0('0x34')](function(_0x4a3c59){_0x2716c2[_0x38a0('0x2d')]=_0x4a3c59;if(_0x4912e9[_0x38a0('0x40')][_0x38a0('0x4e')]){_0x1e5749[_0x38a0('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x38a0('0x50')](_0x1e5749);})[_0x38a0('0x34')](function(_0x5935a3){_0x2716c2['rows']=_0x5935a3;return _0x2716c2;})['then'](respondWithFilteredResult(_0xe3b4af,_0x1e5749))[_0x38a0('0x51')](handleError(_0xe3b4af,null));};exports[_0x38a0('0x52')]=function(_0x63fae4,_0x525bf3){var _0x3eb770={'raw':!![],'where':{'id':_0x63fae4[_0x38a0('0x53')]['id']}},_0x198e6c={};_0x198e6c[_0x38a0('0x3d')]=_[_0x38a0('0x3f')](db['OpenchannelMessage'][_0x38a0('0x3a')]);_0x198e6c[_0x38a0('0x40')]=_[_0x38a0('0x3f')](_0x63fae4['query']);_0x198e6c['filters']=_['intersection'](_0x198e6c['model'],_0x198e6c[_0x38a0('0x40')]);_0x3eb770[_0x38a0('0x42')]=_[_0x38a0('0x54')](_0x198e6c[_0x38a0('0x3d')],qs[_0x38a0('0x43')](_0x63fae4[_0x38a0('0x40')][_0x38a0('0x43')]));_0x3eb770[_0x38a0('0x42')]=_0x3eb770[_0x38a0('0x42')]['length']?_0x3eb770['attributes']:_0x198e6c[_0x38a0('0x3d')];if(_0x63fae4['query']['includeAll']){_0x3eb770['include']=[{'all':!![]}];}_0x3eb770=_['merge']({},_0x3eb770,_0x63fae4[_0x38a0('0x4d')]);return db[_0x38a0('0x39')][_0x38a0('0x55')](_0x3eb770)[_0x38a0('0x34')](handleEntityNotFound(_0x525bf3,null))['then'](respondWithResult(_0x525bf3,null))[_0x38a0('0x51')](handleError(_0x525bf3,null));};exports[_0x38a0('0x56')]=function(_0x275baa,_0x32bda){return db[_0x38a0('0x39')][_0x38a0('0x56')](_0x275baa[_0x38a0('0x57')],{})[_0x38a0('0x34')](respondWithResult(_0x32bda,0xc9))['catch'](handleError(_0x32bda,null));};exports[_0x38a0('0x58')]=function(_0x1e9628,_0x211b17){if(_0x1e9628[_0x38a0('0x57')]['id']){delete _0x1e9628[_0x38a0('0x57')]['id'];}return db[_0x38a0('0x39')][_0x38a0('0x55')]({'where':{'id':_0x1e9628['params']['id']}})[_0x38a0('0x34')](handleEntityNotFound(_0x211b17,null))[_0x38a0('0x34')](saveUpdates(_0x1e9628[_0x38a0('0x57')],null))['then'](respondWithResult(_0x211b17,null))[_0x38a0('0x51')](handleError(_0x211b17,null));};exports[_0x38a0('0x33')]=function(_0x35e680,_0x170fec){return db[_0x38a0('0x39')][_0x38a0('0x55')]({'where':{'id':_0x35e680[_0x38a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x170fec,null))[_0x38a0('0x34')](removeEntity(_0x170fec,null))[_0x38a0('0x51')](handleError(_0x170fec,null));};exports[_0x38a0('0x59')]=function(_0x2dad93,_0x4b5f48){return db[_0x38a0('0x39')][_0x38a0('0x59')]()[_0x38a0('0x34')](respondWithResult(_0x4b5f48,null))[_0x38a0('0x51')](handleError(_0x4b5f48,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x4d7cb8,_0xc627d4,_0x335d98){var _0x2d275b={'agent':{},'channel':'openchannel'};if(_0x4d7cb8[_0x38a0('0x57')]['id']){delete _0x4d7cb8['body']['id'];}_0x4d7cb8['body'][_0x38a0('0x5a')]=!![];_0x4d7cb8[_0x38a0('0x57')]['readAt']=moment()[_0x38a0('0x5b')](_0x38a0('0x5c'));_0x4d7cb8[_0x38a0('0x57')][_0x38a0('0x5d')]=_0x4d7cb8[_0x38a0('0x57')][_0x38a0('0x5d')]||_0x4d7cb8[_0x38a0('0x5e')]['id'];_0x2d275b[_0x38a0('0x5f')]['id']=_0x4d7cb8['body'][_0x38a0('0x5d')];return db['OpenchannelMessage'][_0x38a0('0x55')]({'where':{'id':_0x4d7cb8[_0x38a0('0x53')]['id'],'UserId':null}})[_0x38a0('0x34')](handleEntityNotFound(_0xc627d4,null))[_0x38a0('0x34')](saveUpdates(_0x4d7cb8[_0x38a0('0x57')],null))[_0x38a0('0x34')](function(_0x484079){if(_0x484079){_0x2d275b['message']=_0x484079[_0x38a0('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x38a0('0x55')]({'where':{'id':_0x484079[_0x38a0('0x61')]}});}return null;})[_0x38a0('0x34')](handleEntityNotFound(_0xc627d4,null))[_0x38a0('0x34')](function(_0x7761f4){if(_0x7761f4){return _0x7761f4[_0x38a0('0x58')]({'UserId':_0x4d7cb8[_0x38a0('0x57')]['UserId'],'read1stAt':_[_0x38a0('0x62')](_0x7761f4[_0x38a0('0x63')])?moment()[_0x38a0('0x5b')](_0x38a0('0x5c')):undefined});}return null;})['then'](function(_0x488585){if(_0x488585){_0x2d275b[_0x38a0('0x64')]=_0x488585[_0x38a0('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d7cb8[_0x38a0('0x5e')]['id'],_0x4d7cb8[_0x38a0('0x5e')][_0x38a0('0x36')],_0x4d7cb8[_0x38a0('0x5e')][_0x38a0('0x65')],_0x2d275b[_0x38a0('0x64')]['id'],_0x4d7cb8[_0x38a0('0x57')]?JSON[_0x38a0('0x24')](_0x4d7cb8[_0x38a0('0x57')]):_0x38a0('0x66'));return respondWithRpcPromise(_0x38a0('0x67'),'acceptMessage',_0x2d275b);}return null;})[_0x38a0('0x34')](function(_0x313b13){var _0xdb8963='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x313b13['message'][_0x38a0('0x68')];return db[_0x38a0('0x69')]['query'](_0xdb8963,{'type':db[_0x38a0('0x6a')][_0x38a0('0x6b')][_0x38a0('0x6c')],'raw':!![]})['then'](function(_0x5d9292){return _0x5d9292;});})[_0x38a0('0x34')](function(_0x10aa18){if(_0x10aa18){_0x2d275b['message'][_0x38a0('0x6d')]=_0x10aa18[0x0];if(!_0x4d7cb8['body'][_0x38a0('0x5d')])return;return db['User']['find']({'where':{'id':_0x4d7cb8[_0x38a0('0x57')][_0x38a0('0x5d')],'role':_0x38a0('0x5f')},'attributes':['id',_0x38a0('0x36'),'fullname',_0x38a0('0x6e'),_0x38a0('0x6f')],'raw':!![]});}return null;})['then'](function(_0x8b06b0){if(!_0x8b06b0)return null;_0x2d275b['message']['agent']=_0x8b06b0;return _0x2d275b;})[_0x38a0('0x34')](function(_0x261ed1){if(_0x261ed1){if(_0x4d7cb8[_0x38a0('0x57')]['manual']){_0x2d275b['message'][_0x38a0('0x70')]=util[_0x38a0('0x5b')](_0x38a0('0x71'),_0x4d7cb8['user'][_0x38a0('0x36')]);_0x2d275b[_0x38a0('0x27')][_0x38a0('0x72')]=_0x2d275b[_0x38a0('0x72')];_0x2d275b[_0x38a0('0x27')]['motionChannel']=_0x2d275b[_0x38a0('0x72')];_0x2d275b[_0x38a0('0x27')][_0x38a0('0x73')]=_0x38a0('0x74');return respondWithRpcPromise(_0x38a0('0x75'),_0x38a0('0x75'),{'event':_0x38a0('0x76'),'message':_0x2d275b[_0x38a0('0x27')]},client9002)[_0x38a0('0x34')](function(){return _0x2d275b;});}return _0x2d275b;}return null;})[_0x38a0('0x34')](respondWithResult(_0xc627d4,null))[_0x38a0('0x51')](handleError(_0xc627d4,null));};var interaction_log=require(_0x38a0('0x12'))(_0x38a0('0x77'));exports[_0x38a0('0x78')]=function(_0x1f08f0,_0x1ba85e,_0x2a0624){var _0x51771c={'agent':{},'channel':_0x38a0('0x79')};if(_0x1f08f0['body']['id']){delete _0x1f08f0[_0x38a0('0x57')]['id'];}_0x1f08f0[_0x38a0('0x57')]['UserId']=_0x1f08f0[_0x38a0('0x57')][_0x38a0('0x5d')]||_0x1f08f0[_0x38a0('0x5e')]['id'];_0x51771c[_0x38a0('0x5f')]['id']=_0x1f08f0['body'][_0x38a0('0x5d')];return db[_0x38a0('0x39')][_0x38a0('0x55')]({'where':{'id':_0x1f08f0['params']['id'],'UserId':null}})[_0x38a0('0x34')](handleEntityNotFound(_0x1ba85e,null))['then'](function(_0xfe39e4){if(_0xfe39e4){_0x51771c[_0x38a0('0x27')]=_0xfe39e4[_0x38a0('0x60')]({'plain':!![]});return db[_0x38a0('0x7a')][_0x38a0('0x55')]({'where':{'id':_0xfe39e4['OpenchannelInteractionId']}});}return null;})[_0x38a0('0x34')](handleEntityNotFound(_0x1ba85e,null))['then'](function(_0x3efd58){if(_0x3efd58){_0x51771c[_0x38a0('0x64')]=_0x3efd58['get']({'plain':!![]});interaction_log[_0x38a0('0x20')](_0x38a0('0x7b'),_0x1f08f0[_0x38a0('0x5e')]['id'],_0x1f08f0['user']['name'],_0x1f08f0[_0x38a0('0x5e')]['role'],_0x51771c[_0x38a0('0x64')]['id'],_0x1f08f0[_0x38a0('0x57')]?JSON[_0x38a0('0x24')](_0x1f08f0[_0x38a0('0x57')]):'null');return respondWithRpcPromise(_0x38a0('0x7c'),_0x38a0('0x7d'),_0x51771c);}return null;})[_0x38a0('0x34')](function(_0x2cec03){var _0x181dab='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cec03[_0x38a0('0x27')]['ContactId'];return db[_0x38a0('0x69')]['query'](_0x181dab,{'type':db['Sequelize'][_0x38a0('0x6b')][_0x38a0('0x6c')],'raw':!![]})[_0x38a0('0x34')](function(_0x579842){return _0x579842;});})['then'](function(_0x14860f){if(_0x14860f){_0x51771c[_0x38a0('0x27')][_0x38a0('0x6d')]=_0x14860f[0x0];if(!_0x1f08f0[_0x38a0('0x57')][_0x38a0('0x5d')])return;return db[_0x38a0('0x7e')][_0x38a0('0x55')]({'where':{'id':_0x1f08f0[_0x38a0('0x57')]['UserId'],'role':_0x38a0('0x5f')},'attributes':['id',_0x38a0('0x36'),_0x38a0('0x7f'),_0x38a0('0x6e'),_0x38a0('0x6f')],'raw':!![]});}return null;})[_0x38a0('0x34')](function(_0x5c1625){if(!_0x5c1625)return null;_0x51771c[_0x38a0('0x27')]['agent']=_0x5c1625;return _0x51771c;})[_0x38a0('0x34')](function(_0x1af95f){if(_0x1af95f){_0x1af95f[_0x38a0('0x27')]['interface']=util[_0x38a0('0x5b')]('SIP/%s',_0x1f08f0[_0x38a0('0x5e')][_0x38a0('0x36')]);_0x1af95f['message']['channel']=_0x51771c[_0x38a0('0x72')];_0x1af95f[_0x38a0('0x27')][_0x38a0('0x80')]=_0x51771c[_0x38a0('0x72')];_0x1af95f[_0x38a0('0x27')][_0x38a0('0x73')]='reject';respondWithRpcPromise(_0x38a0('0x75'),'EventManager',{'event':'rejectmessage','message':_0x1af95f['message']},client9002);return _0x51771c;}return null;})['then'](respondWithResult(_0x1ba85e,null))['catch'](handleError(_0x1ba85e,null));}; \ No newline at end of file +var _0x214e=['map','OpenchannelMessage','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','type','VIRTUAL','includeAll','include','findAll','show','params','intersection','options','find','create','body','describe','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','rimraf','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index'];(function(_0x3f6da4,_0x10b26b){var _0x31804e=function(_0x3062bd){while(--_0x3062bd){_0x3f6da4['push'](_0x3f6da4['shift']());}};_0x31804e(++_0x10b26b);}(_0x214e,0x148));var _0xe214=function(_0x40bfea,_0x12092e){_0x40bfea=_0x40bfea-0x0;var _0x486b61=_0x214e[_0x40bfea];return _0x486b61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe214('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe214('0x1'));var rp=require('request-promise');var moment=require(_0xe214('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe214('0x3'));var util=require('util');var path=require(_0xe214('0x4'));var sox=require(_0xe214('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe214('0x6'));var _=require(_0xe214('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe214('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe214('0x9'));var Papa=require(_0xe214('0xa'));var Redis=require(_0xe214('0xb'));var authService=require(_0xe214('0xc'));var qs=require(_0xe214('0xd'));var as=require(_0xe214('0xe'));var hardwareService=require(_0xe214('0xf'));var logger=require(_0xe214('0x10'))(_0xe214('0x11'));var utils=require(_0xe214('0x12'));var config=require(_0xe214('0x13'));var licenseUtil=require(_0xe214('0x14'));var db=require(_0xe214('0x15'))['db'];config[_0xe214('0x16')]=_[_0xe214('0x17')](config[_0xe214('0x16')],{'host':_0xe214('0x18'),'port':0x18eb});var socket=require(_0xe214('0x19'))(new Redis(config[_0xe214('0x16')]));require('./openchannelMessage.socket')[_0xe214('0x1a')](socket);var jayson=require(_0xe214('0x1b'));var client=jayson[_0xe214('0x1c')][_0xe214('0x1d')]({'port':0x232c});var client9002=jayson[_0xe214('0x1c')][_0xe214('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xcb0709,_0x265ed6,_0x1a3d28,_0x5ac53e){return new BPromise(function(_0x4320b2,_0x38fd91){var _0x5ca116=_0x5ac53e||client;return _0x5ca116[_0xe214('0x1e')](_0xcb0709,_0x1a3d28)['then'](function(_0x95a022){logger['info'](_0xe214('0x1f'),_0x265ed6,_0xe214('0x20'));logger['debug'](_0xe214('0x21'),_0x265ed6,_0xe214('0x20'),JSON[_0xe214('0x22')](_0x95a022));if(_0x95a022[_0xe214('0x23')]){if(_0x95a022[_0xe214('0x23')][_0xe214('0x24')]===0x1f4){logger['error'](_0xe214('0x1f'),_0x265ed6,_0x95a022[_0xe214('0x23')][_0xe214('0x25')]);return _0x38fd91(_0x95a022[_0xe214('0x23')][_0xe214('0x25')]);}logger['error'](_0xe214('0x1f'),_0x265ed6,_0x95a022[_0xe214('0x23')]['message']);return _0x4320b2(_0x95a022[_0xe214('0x23')]['message']);}else{logger[_0xe214('0x26')](_0xe214('0x1f'),_0x265ed6,'request\x20sent');_0x4320b2(_0x95a022[_0xe214('0x27')][_0xe214('0x25')]);}})[_0xe214('0x28')](function(_0x92ef3e){logger[_0xe214('0x23')](_0xe214('0x1f'),_0x265ed6,_0x92ef3e);_0x38fd91(_0x92ef3e);});});}function respondWithStatusCode(_0x4881a9,_0x5199c6){_0x5199c6=_0x5199c6||0xcc;return function(_0x161027){if(_0x161027){return _0x4881a9[_0xe214('0x29')](_0x5199c6);}return _0x4881a9[_0xe214('0x2a')](_0x5199c6)[_0xe214('0x2b')]();};}function respondWithResult(_0x462a41,_0x48a9a3){_0x48a9a3=_0x48a9a3||0xc8;return function(_0x3aa34c){if(_0x3aa34c){return _0x462a41[_0xe214('0x2a')](_0x48a9a3)[_0xe214('0x2c')](_0x3aa34c);}};}function respondWithFilteredResult(_0x3ba473,_0x502edf){return function(_0x10f6a6){if(_0x10f6a6){var _0x2e7d89=typeof _0x502edf['offset']===_0xe214('0x2d')&&typeof _0x502edf[_0xe214('0x2e')]===_0xe214('0x2d');var _0x5345aa=_0x10f6a6[_0xe214('0x2f')];var _0x2ff24b=_0x2e7d89?0x0:_0x502edf[_0xe214('0x30')];var _0x35df85=_0x2e7d89?_0x10f6a6['count']:_0x502edf[_0xe214('0x30')]+_0x502edf[_0xe214('0x2e')];var _0x158188;if(_0x35df85>=_0x5345aa){_0x35df85=_0x5345aa;_0x158188=0xc8;}else{_0x158188=0xce;}_0x3ba473[_0xe214('0x2a')](_0x158188);return _0x3ba473['set']('Content-Range',_0x2ff24b+'-'+_0x35df85+'/'+_0x5345aa)[_0xe214('0x2c')](_0x10f6a6);}return null;};}function patchUpdates(_0x362710){return function(_0x17253b){try{jsonpatch[_0xe214('0x31')](_0x17253b,_0x362710,!![]);}catch(_0x114c4a){return BPromise[_0xe214('0x32')](_0x114c4a);}return _0x17253b[_0xe214('0x33')]();};}function saveUpdates(_0x3815e6,_0x44e66f){return function(_0xb43719){if(_0xb43719){return _0xb43719[_0xe214('0x34')](_0x3815e6)[_0xe214('0x35')](function(_0x4fff55){return _0x4fff55;});}return null;};}function removeEntity(_0x524c3c,_0x26009a){return function(_0x512cde){if(_0x512cde){return _0x512cde[_0xe214('0x36')]()[_0xe214('0x35')](function(){_0x524c3c[_0xe214('0x2a')](0xcc)[_0xe214('0x2b')]();});}};}function handleEntityNotFound(_0x486aa3,_0x2b8c1f){return function(_0x51288){if(!_0x51288){_0x486aa3[_0xe214('0x29')](0x194);}return _0x51288;};}function handleError(_0x40acc3,_0x42c578){_0x42c578=_0x42c578||0x1f4;return function(_0x2c7548){logger['error'](_0x2c7548[_0xe214('0x37')]);if(_0x2c7548[_0xe214('0x38')]){delete _0x2c7548[_0xe214('0x38')];}_0x40acc3[_0xe214('0x2a')](_0x42c578)[_0xe214('0x39')](_0x2c7548);};}exports[_0xe214('0x3a')]=function(_0x2b4426,_0x428ce7){var _0x201dc1={},_0x165864={},_0x13e4df={'count':0x0,'rows':[]};var _0x597bff=_[_0xe214('0x3b')](db[_0xe214('0x3c')][_0xe214('0x3d')],function(_0x10a1fa){return{'name':_0x10a1fa['fieldName'],'type':_0x10a1fa['type'][_0xe214('0x3e')]};});_0x165864[_0xe214('0x3f')]=_[_0xe214('0x3b')](_0x597bff,_0xe214('0x38'));_0x165864[_0xe214('0x40')]=_[_0xe214('0x41')](_0x2b4426[_0xe214('0x40')]);_0x165864[_0xe214('0x42')]=_['intersection'](_0x165864[_0xe214('0x3f')],_0x165864['query']);_0x201dc1[_0xe214('0x43')]=_['intersection'](_0x165864[_0xe214('0x3f')],qs['fields'](_0x2b4426[_0xe214('0x40')][_0xe214('0x44')]));_0x201dc1[_0xe214('0x43')]=_0x201dc1['attributes'][_0xe214('0x45')]?_0x201dc1[_0xe214('0x43')]:_0x165864[_0xe214('0x3f')];if(!_0x2b4426[_0xe214('0x40')][_0xe214('0x46')](_0xe214('0x47'))){_0x201dc1[_0xe214('0x2e')]=qs[_0xe214('0x2e')](_0x2b4426[_0xe214('0x40')]['limit']);_0x201dc1[_0xe214('0x30')]=qs['offset'](_0x2b4426[_0xe214('0x40')][_0xe214('0x30')]);}_0x201dc1[_0xe214('0x48')]=qs['sort'](_0x2b4426[_0xe214('0x40')]['sort']);_0x201dc1['where']=qs[_0xe214('0x42')](_['pick'](_0x2b4426['query'],_0x165864[_0xe214('0x42')]),_0x597bff);if(_0x2b4426[_0xe214('0x40')][_0xe214('0x49')]){_0x201dc1['where']=_['merge'](_0x201dc1[_0xe214('0x4a')],{'$or':_[_0xe214('0x3b')](_0x597bff,function(_0x1f7716){if(_0x1f7716[_0xe214('0x4b')]!==_0xe214('0x4c')){var _0x465175={};_0x465175[_0x1f7716[_0xe214('0x38')]]={'$like':'%'+_0x2b4426[_0xe214('0x40')][_0xe214('0x49')]+'%'};return _0x465175;}})});}_0x201dc1=_['merge']({},_0x201dc1,_0x2b4426['options']);var _0x49a8bc={'where':_0x201dc1[_0xe214('0x4a')]};return db['OpenchannelMessage'][_0xe214('0x2f')](_0x49a8bc)[_0xe214('0x35')](function(_0x274652){_0x13e4df['count']=_0x274652;if(_0x2b4426['query'][_0xe214('0x4d')]){_0x201dc1[_0xe214('0x4e')]=[{'all':!![]}];}return db[_0xe214('0x3c')][_0xe214('0x4f')](_0x201dc1);})[_0xe214('0x35')](function(_0x45b629){_0x13e4df['rows']=_0x45b629;return _0x13e4df;})['then'](respondWithFilteredResult(_0x428ce7,_0x201dc1))[_0xe214('0x28')](handleError(_0x428ce7,null));};exports[_0xe214('0x50')]=function(_0x371093,_0x511747){var _0x24f96e={'raw':!![],'where':{'id':_0x371093[_0xe214('0x51')]['id']}},_0xd06d0e={};_0xd06d0e[_0xe214('0x3f')]=_['keys'](db['OpenchannelMessage'][_0xe214('0x3d')]);_0xd06d0e['query']=_[_0xe214('0x41')](_0x371093[_0xe214('0x40')]);_0xd06d0e[_0xe214('0x42')]=_[_0xe214('0x52')](_0xd06d0e[_0xe214('0x3f')],_0xd06d0e[_0xe214('0x40')]);_0x24f96e['attributes']=_[_0xe214('0x52')](_0xd06d0e[_0xe214('0x3f')],qs[_0xe214('0x44')](_0x371093[_0xe214('0x40')]['fields']));_0x24f96e[_0xe214('0x43')]=_0x24f96e['attributes'][_0xe214('0x45')]?_0x24f96e[_0xe214('0x43')]:_0xd06d0e[_0xe214('0x3f')];if(_0x371093[_0xe214('0x40')][_0xe214('0x4d')]){_0x24f96e[_0xe214('0x4e')]=[{'all':!![]}];}_0x24f96e=_['merge']({},_0x24f96e,_0x371093[_0xe214('0x53')]);return db[_0xe214('0x3c')][_0xe214('0x54')](_0x24f96e)[_0xe214('0x35')](handleEntityNotFound(_0x511747,null))[_0xe214('0x35')](respondWithResult(_0x511747,null))['catch'](handleError(_0x511747,null));};exports[_0xe214('0x55')]=function(_0x226d06,_0x3c44b6){return db[_0xe214('0x3c')][_0xe214('0x55')](_0x226d06[_0xe214('0x56')],{})[_0xe214('0x35')](respondWithResult(_0x3c44b6,0xc9))[_0xe214('0x28')](handleError(_0x3c44b6,null));};exports[_0xe214('0x34')]=function(_0x5c7e52,_0x5a60ef){if(_0x5c7e52[_0xe214('0x56')]['id']){delete _0x5c7e52[_0xe214('0x56')]['id'];}return db[_0xe214('0x3c')]['find']({'where':{'id':_0x5c7e52['params']['id']}})[_0xe214('0x35')](handleEntityNotFound(_0x5a60ef,null))['then'](saveUpdates(_0x5c7e52[_0xe214('0x56')],null))[_0xe214('0x35')](respondWithResult(_0x5a60ef,null))['catch'](handleError(_0x5a60ef,null));};exports[_0xe214('0x36')]=function(_0x1ee0ad,_0x263a65){return db[_0xe214('0x3c')][_0xe214('0x54')]({'where':{'id':_0x1ee0ad[_0xe214('0x51')]['id']}})[_0xe214('0x35')](handleEntityNotFound(_0x263a65,null))[_0xe214('0x35')](removeEntity(_0x263a65,null))['catch'](handleError(_0x263a65,null));};exports[_0xe214('0x57')]=function(_0x17c69f,_0x48286f){return db[_0xe214('0x3c')][_0xe214('0x57')]()[_0xe214('0x35')](respondWithResult(_0x48286f,null))[_0xe214('0x28')](handleError(_0x48286f,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xe214('0x58')]=function(_0x54d51f,_0x37d7c0,_0x31f10b){var _0x112627={'agent':{},'channel':_0xe214('0x59')};if(_0x54d51f['body']['id']){delete _0x54d51f[_0xe214('0x56')]['id'];}_0x54d51f[_0xe214('0x56')][_0xe214('0x5a')]=!![];_0x54d51f[_0xe214('0x56')]['readAt']=moment()['format'](_0xe214('0x5b'));_0x54d51f[_0xe214('0x56')][_0xe214('0x5c')]=_0x54d51f[_0xe214('0x56')]['UserId']||_0x54d51f[_0xe214('0x5d')]['id'];_0x112627[_0xe214('0x5e')]['id']=_0x54d51f[_0xe214('0x56')][_0xe214('0x5c')];return db[_0xe214('0x3c')][_0xe214('0x54')]({'where':{'id':_0x54d51f[_0xe214('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37d7c0,null))[_0xe214('0x35')](saveUpdates(_0x54d51f['body'],null))[_0xe214('0x35')](function(_0x56bd3a){if(_0x56bd3a){_0x112627[_0xe214('0x25')]=_0x56bd3a[_0xe214('0x5f')]({'plain':!![]});return db[_0xe214('0x60')][_0xe214('0x54')]({'where':{'id':_0x56bd3a[_0xe214('0x61')]}});}return null;})[_0xe214('0x35')](handleEntityNotFound(_0x37d7c0,null))['then'](function(_0x1be902){if(_0x1be902){return _0x1be902[_0xe214('0x34')]({'UserId':_0x54d51f[_0xe214('0x56')][_0xe214('0x5c')],'read1stAt':_[_0xe214('0x62')](_0x1be902[_0xe214('0x63')])?moment()[_0xe214('0x64')](_0xe214('0x5b')):undefined});}return null;})[_0xe214('0x35')](function(_0x415af6){if(_0x415af6){_0x112627[_0xe214('0x65')]=_0x415af6[_0xe214('0x5f')]({'plain':!![]});interaction_log[_0xe214('0x26')](_0xe214('0x66'),_0x54d51f[_0xe214('0x5d')]['id'],_0x54d51f['user'][_0xe214('0x38')],_0x54d51f[_0xe214('0x5d')][_0xe214('0x67')],_0x112627['interaction']['id'],_0x54d51f[_0xe214('0x56')]?JSON[_0xe214('0x22')](_0x54d51f[_0xe214('0x56')]):'null');return respondWithRpcPromise(_0xe214('0x68'),'acceptMessage',_0x112627);}return null;})[_0xe214('0x35')](function(_0x84f7fb){var _0x4e0ad6=_0xe214('0x69')+_0x84f7fb[_0xe214('0x25')][_0xe214('0x6a')];return db['sequelize']['query'](_0x4e0ad6,{'type':db[_0xe214('0x6b')][_0xe214('0x6c')][_0xe214('0x6d')],'raw':!![]})[_0xe214('0x35')](function(_0x4b4a97){return _0x4b4a97;});})[_0xe214('0x35')](function(_0x1bd91d){if(_0x1bd91d){_0x112627[_0xe214('0x25')][_0xe214('0x6e')]=_0x1bd91d[0x0];if(!_0x54d51f[_0xe214('0x56')][_0xe214('0x5c')])return;return db[_0xe214('0x6f')][_0xe214('0x54')]({'where':{'id':_0x54d51f['body'][_0xe214('0x5c')],'role':_0xe214('0x5e')},'attributes':['id',_0xe214('0x38'),_0xe214('0x70'),_0xe214('0x71'),_0xe214('0x72')],'raw':!![]});}return null;})[_0xe214('0x35')](function(_0x44b647){if(!_0x44b647)return null;_0x112627[_0xe214('0x25')][_0xe214('0x5e')]=_0x44b647;return _0x112627;})[_0xe214('0x35')](function(_0x1eb8a5){if(_0x1eb8a5){if(_0x54d51f[_0xe214('0x56')][_0xe214('0x73')]){_0x112627['message'][_0xe214('0x74')]=util['format'](_0xe214('0x75'),_0x54d51f[_0xe214('0x5d')]['name']);_0x112627['message'][_0xe214('0x76')]=_0x112627['channel'];_0x112627[_0xe214('0x25')][_0xe214('0x77')]=_0x112627['channel'];_0x112627[_0xe214('0x25')][_0xe214('0x78')]=_0xe214('0x58');return respondWithRpcPromise(_0xe214('0x79'),_0xe214('0x79'),{'event':_0xe214('0x7a'),'message':_0x112627[_0xe214('0x25')]},client9002)['then'](function(){return _0x112627;});}return _0x112627;}return null;})[_0xe214('0x35')](respondWithResult(_0x37d7c0,null))[_0xe214('0x28')](handleError(_0x37d7c0,null));};var interaction_log=require(_0xe214('0x10'))(_0xe214('0x7b'));exports[_0xe214('0x32')]=function(_0x1e903c,_0x3c68e4,_0x358ccf){var _0x21644c={'agent':{},'channel':'openchannel'};if(_0x1e903c[_0xe214('0x56')]['id']){delete _0x1e903c[_0xe214('0x56')]['id'];}_0x1e903c[_0xe214('0x56')][_0xe214('0x5c')]=_0x1e903c[_0xe214('0x56')][_0xe214('0x5c')]||_0x1e903c[_0xe214('0x5d')]['id'];_0x21644c[_0xe214('0x5e')]['id']=_0x1e903c[_0xe214('0x56')]['UserId'];return db[_0xe214('0x3c')][_0xe214('0x54')]({'where':{'id':_0x1e903c['params']['id'],'UserId':null}})[_0xe214('0x35')](handleEntityNotFound(_0x3c68e4,null))[_0xe214('0x35')](function(_0xa42be9){if(_0xa42be9){_0x21644c[_0xe214('0x25')]=_0xa42be9[_0xe214('0x5f')]({'plain':!![]});return db[_0xe214('0x60')][_0xe214('0x54')]({'where':{'id':_0xa42be9[_0xe214('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3c68e4,null))[_0xe214('0x35')](function(_0x443e2a){if(_0x443e2a){_0x21644c[_0xe214('0x65')]=_0x443e2a[_0xe214('0x5f')]({'plain':!![]});interaction_log[_0xe214('0x26')](_0xe214('0x7c'),_0x1e903c['user']['id'],_0x1e903c[_0xe214('0x5d')][_0xe214('0x38')],_0x1e903c[_0xe214('0x5d')][_0xe214('0x67')],_0x21644c[_0xe214('0x65')]['id'],_0x1e903c['body']?JSON[_0xe214('0x22')](_0x1e903c['body']):_0xe214('0x7d'));return respondWithRpcPromise(_0xe214('0x7e'),_0xe214('0x7f'),_0x21644c);}return null;})[_0xe214('0x35')](function(_0x3e1f49){var _0x45bfb4=_0xe214('0x69')+_0x3e1f49[_0xe214('0x25')][_0xe214('0x6a')];return db[_0xe214('0x80')]['query'](_0x45bfb4,{'type':db['Sequelize'][_0xe214('0x6c')][_0xe214('0x6d')],'raw':!![]})[_0xe214('0x35')](function(_0x347c78){return _0x347c78;});})[_0xe214('0x35')](function(_0x384e6d){if(_0x384e6d){_0x21644c[_0xe214('0x25')][_0xe214('0x6e')]=_0x384e6d[0x0];if(!_0x1e903c['body'][_0xe214('0x5c')])return;return db[_0xe214('0x6f')]['find']({'where':{'id':_0x1e903c[_0xe214('0x56')][_0xe214('0x5c')],'role':_0xe214('0x5e')},'attributes':['id',_0xe214('0x38'),_0xe214('0x70'),_0xe214('0x71'),_0xe214('0x72')],'raw':!![]});}return null;})[_0xe214('0x35')](function(_0x27f0c9){if(!_0x27f0c9)return null;_0x21644c[_0xe214('0x25')][_0xe214('0x5e')]=_0x27f0c9;return _0x21644c;})['then'](function(_0x21f909){if(_0x21f909){_0x21f909['message'][_0xe214('0x74')]=util['format'](_0xe214('0x75'),_0x1e903c[_0xe214('0x5d')]['name']);_0x21f909['message'][_0xe214('0x76')]=_0x21644c['channel'];_0x21f909[_0xe214('0x25')][_0xe214('0x77')]=_0x21644c['channel'];_0x21f909[_0xe214('0x25')][_0xe214('0x78')]='reject';respondWithRpcPromise(_0xe214('0x79'),_0xe214('0x79'),{'event':'rejectmessage','message':_0x21f909[_0xe214('0x25')]},client9002);return _0x21644c;}return null;})[_0xe214('0x35')](respondWithResult(_0x3c68e4,null))[_0xe214('0x28')](handleError(_0x3c68e4,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0cc636d..468e1df 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 _0x0fc3=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x51f58b,_0x2c3031){var _0x5d1f21=function(_0x384b1d){while(--_0x384b1d){_0x51f58b['push'](_0x51f58b['shift']());}};_0x5d1f21(++_0x2c3031);}(_0x0fc3,0x1ec));var _0x30fc=function(_0x91df6,_0x49a2ea){_0x91df6=_0x91df6-0x0;var _0x557117=_0x0fc3[_0x91df6];return _0x557117;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x30fc('0x0'))['db'][_0x30fc('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x30fc('0x2')](0x0);var events={'afterCreate':_0x30fc('0x3'),'afterUpdate':_0x30fc('0x4'),'afterDestroy':_0x30fc('0x5')};function emitEvent(_0x59e3ce){return function(_0x5934fe,_0x4e2626,_0x10cd70){OpenchannelMessageEvents[_0x30fc('0x6')](_0x59e3ce+':'+_0x5934fe['id'],_0x5934fe);OpenchannelMessageEvents['emit'](_0x59e3ce,_0x5934fe);_0x10cd70(null);};}for(var e in events){if(events[_0x30fc('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x30fc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x7da5=['save','update','remove','emit','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x5adb18,_0x222326){var _0x420c98=function(_0x146b7b){while(--_0x146b7b){_0x5adb18['push'](_0x5adb18['shift']());}};_0x420c98(++_0x222326);}(_0x7da5,0x8c));var _0x57da=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7da5[_0x56482c];return _0x5aae7a;};'use strict';var EventEmitter=require(_0x57da('0x0'));var OpenchannelMessage=require(_0x57da('0x1'))['db'][_0x57da('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x57da('0x3')](0x0);var events={'afterCreate':_0x57da('0x4'),'afterUpdate':_0x57da('0x5'),'afterDestroy':_0x57da('0x6')};function emitEvent(_0x52bb87){return function(_0x166d47,_0xf31a49,_0x19de85){OpenchannelMessageEvents[_0x57da('0x7')](_0x52bb87+':'+_0x166d47['id'],_0x166d47);OpenchannelMessageEvents['emit'](_0x52bb87,_0x166d47);_0x19de85(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](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 a337c81..95b1f20 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 _0x047d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','then','OpenchannelAccount','find','Interactions','Contact','keys','get','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','method','GET','POST','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally'];(function(_0xbbb751,_0x5b1c39){var _0x9f12a1=function(_0x10e118){while(--_0x10e118){_0xbbb751['push'](_0xbbb751['shift']());}};_0x9f12a1(++_0x5b1c39);}(_0x047d,0xce));var _0xd047=function(_0x315897,_0x4d2a8f){_0x315897=_0x315897-0x0;var _0x4cff77=_0x047d[_0x315897];return _0x4cff77;};'use strict';var _=require(_0xd047('0x0'));var util=require(_0xd047('0x1'));var logger=require(_0xd047('0x2'))(_0xd047('0x3'));var moment=require(_0xd047('0x4'));var BPromise=require(_0xd047('0x5'));var rp=require(_0xd047('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd047('0x7'));var attributes=require(_0xd047('0x8'));module['exports']=function(_0x392b47,_0x48fada){return _0x392b47['define'](_0xd047('0x9'),attributes,{'tableName':_0xd047('0xa'),'paranoid':![],'indexes':[{'name':_0xd047('0xb'),'fields':['body'],'type':_0xd047('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7b2550,_0x29d93a,_0x25f77b){var _0x5edb39=_0x392b47[_0xd047('0xd')];var _0x179403=_0x7b2550['get']({'plain':!![]});if(_0x179403[_0xd047('0xe')][_0xd047('0xf')]()==='in'||_0x179403['direction'][_0xd047('0xf')]()==='out'&&!_0x179403[_0xd047('0x10')]&&!_[_0xd047('0x11')](_0x179403[_0xd047('0x12')])){_0x5edb39[_0xd047('0x13')][_0xd047('0x14')]({'where':{'id':_0x179403[_0xd047('0x15')]}})['then'](function(_0x19f991){if(_0x19f991){_0x19f991[_0xd047('0x16')]({'lastMsgAt':_0x179403[_0xd047('0x17')],'lastMsgDirection':_0x179403[_0xd047('0xe')][_0xd047('0xf')]()});}})[_0xd047('0x18')](function(_0x4a14f7){console[_0xd047('0x19')](_0x4a14f7);});}if(_0x179403['direction']==='out'&&!_0x179403[_0xd047('0x10')]){var _0x1e239f;_0x5edb39[_0xd047('0x1a')]['describe']()[_0xd047('0x1b')](function(_0xb9454e){return _0x5edb39[_0xd047('0x1c')][_0xd047('0x1d')]({'where':{'id':_0x179403['OpenchannelAccountId']},'include':[{'model':_0x5edb39[_0xd047('0x13')],'as':_0xd047('0x1e'),'where':{'id':_0x179403[_0xd047('0x15')]},'limit':0x1,'include':[{'model':_0x5edb39[_0xd047('0x1a')],'as':_0xd047('0x1f'),'attributes':_[_0xd047('0x20')](_0xb9454e)}]}]});})[_0xd047('0x1b')](function(_0x2d32f3){_0x1e239f=_0x2d32f3[_0xd047('0x21')]({'plain':!![]});if(_0x1e239f&&_0x1e239f[_0xd047('0x22')]){logger[_0xd047('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xd047('0x24'),_0x179403['id'],_0x1e239f[_0xd047('0x22')]));if(_0x1e239f[_0xd047('0x1e')]&&_0x1e239f[_0xd047('0x1e')][_0xd047('0x25')]){_0x179403['Interaction']=_[_0xd047('0x26')](_0x1e239f[_0xd047('0x1e')][0x0],_0xd047('0x1f'));_0x179403[_0xd047('0x1f')]=_0x1e239f['Interactions'][0x0][_0xd047('0x1f')];}var _0x29d93a={'method':'POST','uri':encodeURI(_0x1e239f[_0xd047('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x29d93a[_0xd047('0x27')]){case _0xd047('0x28'):_0x29d93a['qs']=_0x179403;break;case _0xd047('0x29'):_0x29d93a[_0xd047('0x2a')]=_0x179403;break;}return rp(_0x29d93a)[_0xd047('0x1b')](function(_0x26a313){logger['info'](_0xd047('0x2b'),_0xd047('0x2c'),util['format'](_0xd047('0x2d'),_0x179403['id'],_0x1e239f['replyUri']));if(_0x26a313['body'][_0xd047('0x2e')]&&_0x26a313[_0xd047('0x2a')][_0xd047('0x2e')]!=_0x179403[_0xd047('0x2f')][_0xd047('0x2e')]){return _0x5edb39['OpenchannelInteraction'][_0xd047('0x16')]({'threadId':_0x26a313['body']['threadId']},{'where':{'id':_0x179403[_0xd047('0x2f')]['id']}});}else{return;}})['then'](function(){return _0x7b2550['update']({'read':!![]});})['catch'](function(_0x59f012){logger['error'](_0xd047('0x2b'),_0xd047('0x2c'),util['inspect'](_0x59f012,{'showHidden':![],'depth':null}));_0x25f77b();});}else{_0x25f77b();}})[_0xd047('0x30')](function(){_0x25f77b();});}else{_0x25f77b();}}},'charset':_0xd047('0x31'),'collate':_0xd047('0x32')});}; \ No newline at end of file +var _0x21a8=['format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','inspect','finally','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','get','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x2e77bb,_0x3d01e5){var _0x103ed9=function(_0x30348e){while(--_0x30348e){_0x2e77bb['push'](_0x2e77bb['shift']());}};_0x103ed9(++_0x3d01e5);}(_0x21a8,0x78));var _0x821a=function(_0x40ded7,_0x37af2e){_0x40ded7=_0x40ded7-0x0;var _0x2cf87d=_0x21a8[_0x40ded7];return _0x2cf87d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x821a('0x0'))(_0x821a('0x1'));var moment=require(_0x821a('0x2'));var BPromise=require(_0x821a('0x3'));var rp=require(_0x821a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x821a('0x5'));var config=require(_0x821a('0x6'));var attributes=require(_0x821a('0x7'));module[_0x821a('0x8')]=function(_0x1476cf,_0x2a6db1){return _0x1476cf['define'](_0x821a('0x9'),attributes,{'tableName':_0x821a('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x821a('0xb')],'type':_0x821a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4674b3,_0x40d945,_0xb40b4d){var _0x302138=_0x1476cf[_0x821a('0xd')];var _0x4c8c9b=_0x4674b3['get']({'plain':!![]});if(_0x4c8c9b[_0x821a('0xe')][_0x821a('0xf')]()==='in'||_0x4c8c9b['direction']['toLowerCase']()===_0x821a('0x10')&&!_0x4c8c9b[_0x821a('0x11')]&&!_[_0x821a('0x12')](_0x4c8c9b[_0x821a('0x13')])){_0x302138[_0x821a('0x14')][_0x821a('0x15')]({'where':{'id':_0x4c8c9b[_0x821a('0x16')]}})[_0x821a('0x17')](function(_0x41a233){if(_0x41a233){_0x41a233['update']({'lastMsgAt':_0x4c8c9b[_0x821a('0x18')],'lastMsgDirection':_0x4c8c9b[_0x821a('0xe')][_0x821a('0xf')]()});}})[_0x821a('0x19')](function(_0x228960){console['error'](_0x228960);});}if(_0x4c8c9b['direction']==='out'&&!_0x4c8c9b[_0x821a('0x11')]){var _0x6deae7;_0x302138[_0x821a('0x1a')][_0x821a('0x1b')]()[_0x821a('0x17')](function(_0x24c7d2){return _0x302138[_0x821a('0x1c')][_0x821a('0x1d')]({'where':{'id':_0x4c8c9b[_0x821a('0x1e')]},'include':[{'model':_0x302138['OpenchannelInteraction'],'as':_0x821a('0x1f'),'where':{'id':_0x4c8c9b['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x302138['CmContact'],'as':_0x821a('0x20'),'attributes':_['keys'](_0x24c7d2)}]}]});})['then'](function(_0xb6aa11){_0x6deae7=_0xb6aa11[_0x821a('0x21')]({'plain':!![]});if(_0x6deae7&&_0x6deae7['replyUri']){logger[_0x821a('0x22')](_0x821a('0x23'),'afterCreate',util[_0x821a('0x24')](_0x821a('0x25'),_0x4c8c9b['id'],_0x6deae7[_0x821a('0x26')]));if(_0x6deae7[_0x821a('0x1f')]&&_0x6deae7[_0x821a('0x1f')][_0x821a('0x27')]){_0x4c8c9b[_0x821a('0x28')]=_['omit'](_0x6deae7[_0x821a('0x1f')][0x0],_0x821a('0x20'));_0x4c8c9b[_0x821a('0x20')]=_0x6deae7[_0x821a('0x1f')][0x0]['Contact'];}var _0x40d945={'method':_0x821a('0x29'),'uri':encodeURI(_0x6deae7[_0x821a('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x40d945[_0x821a('0x2a')]){case _0x821a('0x2b'):_0x40d945['qs']=_0x4c8c9b;break;case _0x821a('0x29'):_0x40d945['body']=_0x4c8c9b;break;}return rp(_0x40d945)[_0x821a('0x17')](function(_0x3be2ca){logger[_0x821a('0x22')](_0x821a('0x23'),_0x821a('0x2c'),util[_0x821a('0x24')](_0x821a('0x2d'),_0x4c8c9b['id'],_0x6deae7[_0x821a('0x26')]));if(_0x3be2ca[_0x821a('0xb')][_0x821a('0x2e')]&&_0x3be2ca[_0x821a('0xb')]['threadId']!=_0x4c8c9b[_0x821a('0x28')][_0x821a('0x2e')]){return _0x302138[_0x821a('0x14')][_0x821a('0x2f')]({'threadId':_0x3be2ca[_0x821a('0xb')][_0x821a('0x2e')]},{'where':{'id':_0x4c8c9b[_0x821a('0x28')]['id']}});}else{return;}})[_0x821a('0x17')](function(){return _0x4674b3[_0x821a('0x2f')]({'read':!![]});})['catch'](function(_0x24f119){logger[_0x821a('0x30')](_0x821a('0x23'),_0x821a('0x2c'),util[_0x821a('0x31')](_0x24f119,{'showHidden':![],'depth':null}));_0xb40b4d();});}else{_0xb40b4d();}})[_0x821a('0x32')](function(){_0xb40b4d();});}else{_0xb40b4d();}}},'charset':_0x821a('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 056c84f..37befdf 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x30d154,_0x4daf72){var _0x499a89=function(_0x1c278f){while(--_0x1c278f){_0x30d154['push'](_0x30d154['shift']());}};_0x499a89(++_0x4daf72);}(_0x7a54,0x106));var _0x47a5=function(_0xf001fb,_0x2ba22b){_0xf001fb=_0xf001fb-0x0;var _0x55cd07=_0x7a54[_0xf001fb];return _0x55cd07;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3752b1,_0xe7c5c5){var _0x2ecd55=function(_0x301fdc){while(--_0x301fdc){_0x3752b1['push'](_0x3752b1['shift']());}};_0x2ecd55(++_0xe7c5c5);}(_0x7a54,0x106));var _0x47a5=function(_0x4927b1,_0x18cdb3){_0x4927b1=_0x4927b1-0x0;var _0x3d8443=_0x7a54[_0x4927b1];return _0x3d8443;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 41694ba..02d7666 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 _0x4fb4=['openchannelMessage:','save','remove','update','removeListener','register','length'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x4fb4,0x190));var _0x44fb=function(_0x52530b,_0x12f05a){_0x52530b=_0x52530b-0x0;var _0x25028a=_0x4fb4[_0x52530b];return _0x25028a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x44fb('0x0'),_0x44fb('0x1'),_0x44fb('0x2')];function createListener(_0x29a2fe,_0x24e38d){return function(_0x42dbbb){_0x24e38d['emit'](_0x29a2fe,_0x42dbbb);};}function removeListener(_0xec6dce,_0x953327){return function(){OpenchannelMessageEvents[_0x44fb('0x3')](_0xec6dce,_0x953327);};}exports[_0x44fb('0x4')]=function(_0x375d33){for(var _0x173e70=0x0,_0x464af5=events[_0x44fb('0x5')];_0x173e70<_0x464af5;_0x173e70++){var _0x59aa6d=events[_0x173e70];var _0x87f716=createListener(_0x44fb('0x6')+_0x59aa6d,_0x375d33);OpenchannelMessageEvents['on'](_0x59aa6d,_0x87f716);}}; \ No newline at end of file +var _0xa3ea=['save','remove','update','emit','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa3ea,0x77));var _0xaa3e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa3ea[_0x19950b];return _0x3c6b41;};'use strict';var OpenchannelMessageEvents=require(_0xaa3e('0x0'));var events=[_0xaa3e('0x1'),_0xaa3e('0x2'),_0xaa3e('0x3')];function createListener(_0x15f3eb,_0x1de089){return function(_0x150ddf){_0x1de089[_0xaa3e('0x4')](_0x15f3eb,_0x150ddf);};}function removeListener(_0x15856d,_0x213ccd){return function(){OpenchannelMessageEvents['removeListener'](_0x15856d,_0x213ccd);};}exports[_0xaa3e('0x5')]=function(_0x1c14a8){for(var _0x12efbb=0x0,_0x2d5ee0=events[_0xaa3e('0x6')];_0x12efbb<_0x2d5ee0;_0x12efbb++){var _0x307100=events[_0x12efbb];var _0x898c0c=createListener(_0xaa3e('0x7')+_0x307100,_0x1c14a8);OpenchannelMessageEvents['on'](_0x307100,_0x898c0c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 46ece17..80f47e8 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 _0xd8ab=['removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id/teams','getTeams','post','/:id/users','put','/:id','update','delete','removeTeams'];(function(_0x2560bd,_0x7abc6a){var _0x5887b9=function(_0x5eae70){while(--_0x5eae70){_0x2560bd['push'](_0x2560bd['shift']());}};_0x5887b9(++_0x7abc6a);}(_0xd8ab,0x6b));var _0xbd8a=function(_0x58c968,_0xfe572){_0x58c968=_0x58c968-0x0;var _0xa2f815=_0xd8ab[_0x58c968];return _0xa2f815;};'use strict';var multer=require(_0xbd8a('0x0'));var util=require(_0xbd8a('0x1'));var path=require(_0xbd8a('0x2'));var timeout=require(_0xbd8a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd8a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd8a('0x5'));var config=require(_0xbd8a('0x6'));var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbd8a('0x7')](_0xbd8a('0x8'),auth[_0xbd8a('0x9')](),controller['describe']);router[_0xbd8a('0x7')]('/:id',auth[_0xbd8a('0x9')](),controller['show']);router[_0xbd8a('0x7')]('/:id/members',auth[_0xbd8a('0x9')](),controller['getMembers']);router[_0xbd8a('0x7')](_0xbd8a('0xa'),auth[_0xbd8a('0x9')](),controller[_0xbd8a('0xb')]);router[_0xbd8a('0x7')]('/:id/users',auth[_0xbd8a('0x9')](),controller['getAgents']);router[_0xbd8a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8a('0xc')](_0xbd8a('0xa'),auth[_0xbd8a('0x9')](),controller['addTeams']);router[_0xbd8a('0xc')](_0xbd8a('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbd8a('0xe')](_0xbd8a('0xf'),auth['isAuthenticated'](),controller[_0xbd8a('0x10')]);router[_0xbd8a('0x11')](_0xbd8a('0xf'),auth[_0xbd8a('0x9')](),controller['destroy']);router['delete'](_0xbd8a('0xa'),auth[_0xbd8a('0x9')](),controller[_0xbd8a('0x12')]);router[_0xbd8a('0x11')](_0xbd8a('0xd'),auth[_0xbd8a('0x9')](),controller[_0xbd8a('0x13')]);module[_0xbd8a('0x14')]=router; \ No newline at end of file +var _0x0ded=['/:id/teams','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create'];(function(_0xdc9c6e,_0x49fd73){var _0xd95125=function(_0x374cf6){while(--_0x374cf6){_0xdc9c6e['push'](_0xdc9c6e['shift']());}};_0xd95125(++_0x49fd73);}(_0x0ded,0x10d));var _0xd0de=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x0ded[_0x31b9cf];return _0x357b8a;};'use strict';var multer=require(_0xd0de('0x0'));var util=require('util');var path=require(_0xd0de('0x1'));var timeout=require(_0xd0de('0x2'));var express=require('express');var router=express[_0xd0de('0x3')]();var fs_extra=require(_0xd0de('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd0de('0x5'));var config=require(_0xd0de('0x6'));var controller=require(_0xd0de('0x7'));router[_0xd0de('0x8')]('/',auth[_0xd0de('0x9')](),controller[_0xd0de('0xa')]);router[_0xd0de('0x8')](_0xd0de('0xb'),auth['isAuthenticated'](),controller[_0xd0de('0xc')]);router['get'](_0xd0de('0xd'),auth['isAuthenticated'](),controller[_0xd0de('0xe')]);router[_0xd0de('0x8')](_0xd0de('0xf'),auth[_0xd0de('0x9')](),controller[_0xd0de('0x10')]);router[_0xd0de('0x8')]('/:id/teams',auth[_0xd0de('0x9')](),controller['getTeams']);router[_0xd0de('0x8')](_0xd0de('0x11'),auth[_0xd0de('0x9')](),controller[_0xd0de('0x12')]);router[_0xd0de('0x13')]('/',auth[_0xd0de('0x9')](),controller[_0xd0de('0x14')]);router['post'](_0xd0de('0x15'),auth[_0xd0de('0x9')](),controller['addTeams']);router[_0xd0de('0x13')](_0xd0de('0x11'),auth[_0xd0de('0x9')](),controller['addAgents']);router[_0xd0de('0x16')](_0xd0de('0xd'),auth[_0xd0de('0x9')](),controller[_0xd0de('0x17')]);router['delete'](_0xd0de('0xd'),auth[_0xd0de('0x9')](),controller[_0xd0de('0x18')]);router[_0xd0de('0x19')](_0xd0de('0x15'),auth['isAuthenticated'](),controller[_0xd0de('0x1a')]);router[_0xd0de('0x19')]('/:id/users',auth[_0xd0de('0x9')](),controller[_0xd0de('0x1b')]);module[_0xd0de('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 216a6fb..51d395b 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 _0x0978=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x0978,0x109));var _0x8097=function(_0x4375c9,_0x41ff07){_0x4375c9=_0x4375c9-0x0;var _0x3343cb=_0x0978[_0x4375c9];return _0x3343cb;};'use strict';var Sequelize=require(_0x8097('0x0'));module['exports']={'name':{'type':Sequelize[_0x8097('0x1')],'unique':_0x8097('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8097('0x1')]},'timeout':{'type':Sequelize[_0x8097('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8097('0x4')](_0x8097('0x5'),_0x8097('0x6'),_0x8097('0x7'))}}; \ No newline at end of file +var _0x028a=['beepall','roundrobin','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3bf54e,_0x2c52ef){var _0x3bc2a0=function(_0x565e19){while(--_0x565e19){_0x3bf54e['push'](_0x3bf54e['shift']());}};_0x3bc2a0(++_0x2c52ef);}(_0x028a,0x17c));var _0xa028=function(_0x556d03,_0x28f0f3){_0x556d03=_0x556d03-0x0;var _0x2171a3=_0x028a[_0x556d03];return _0x2171a3;};'use strict';var Sequelize=require('sequelize');module[_0xa028('0x0')]={'name':{'type':Sequelize[_0xa028('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa028('0x1')]},'timeout':{'type':Sequelize[_0xa028('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa028('0x3')](_0xa028('0x4'),_0xa028('0x5'),_0xa028('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0fb045a..daa7c4e 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 _0xee73=['%s/%s','createdAt','getTeams','Team','nolimit','ids','User','Agents','voicePause','flatMap','sequelize','transaction','addTeams','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeAgents','addAgents','omit','spread','emit','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','update','then','get','OpenchannelQueues','destroy','error','stack','index','map','rawAttributes','fieldName','type','key','OpenchannelQueue','include','query','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','describe','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','where','pick','OpenchannelQueueId','filter','findAll','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format'];(function(_0x296523,_0x3844cc){var _0x2219ec=function(_0x294984){while(--_0x294984){_0x296523['push'](_0x296523['shift']());}};_0x2219ec(++_0x3844cc);}(_0xee73,0x17f));var _0x3ee7=function(_0x21cda3,_0x17b90a){_0x21cda3=_0x21cda3-0x0;var _0x558dc3=_0xee73[_0x21cda3];return _0x558dc3;};'use strict';var BPromise=require(_0x3ee7('0x0'));var util=require(_0x3ee7('0x1'));var _=require(_0x3ee7('0x2'));var squel=require(_0x3ee7('0x3'));var Redis=require(_0x3ee7('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x3ee7('0x5'))('api');var config=require(_0x3ee7('0x6'));var db=require('../../mysqldb')['db'];config[_0x3ee7('0x7')]=_[_0x3ee7('0x8')](config[_0x3ee7('0x7')],{'host':_0x3ee7('0x9'),'port':0x18eb});var socket=require(_0x3ee7('0xa'))(new Redis(config['redis']));require(_0x3ee7('0xb'))[_0x3ee7('0xc')](socket);function respondWithStatusCode(_0x4a5e83,_0x1647d8){_0x1647d8=_0x1647d8||0xcc;return function(_0xaa6226){if(_0xaa6226){return _0x4a5e83[_0x3ee7('0xd')](_0x1647d8);}return _0x4a5e83['status'](_0x1647d8)['end']();};}function respondWithResult(_0x226d87,_0x20c68f){_0x20c68f=_0x20c68f||0xc8;return function(_0x49e790){if(_0x49e790){return _0x226d87[_0x3ee7('0xe')](_0x20c68f)[_0x3ee7('0xf')](_0x49e790);}};}function respondWithFilteredResult(_0x7537f1,_0x50eb07){return function(_0x5d98cc){if(_0x5d98cc){var _0x47685f=typeof _0x50eb07[_0x3ee7('0x10')]===_0x3ee7('0x11')&&typeof _0x50eb07[_0x3ee7('0x12')]===_0x3ee7('0x11');var _0x413ace=_0x5d98cc[_0x3ee7('0x13')];var _0x47a67c=_0x47685f?0x0:_0x50eb07['offset'];var _0x2cc3e2=_0x47685f?_0x5d98cc[_0x3ee7('0x13')]:_0x50eb07[_0x3ee7('0x10')]+_0x50eb07[_0x3ee7('0x12')];var _0x19db77;if(_0x2cc3e2>=_0x413ace){_0x2cc3e2=_0x413ace;_0x19db77=0xc8;}else{_0x19db77=0xce;}_0x7537f1[_0x3ee7('0xe')](_0x19db77);return _0x7537f1['set']('Content-Range',_0x47a67c+'-'+_0x2cc3e2+'/'+_0x413ace)[_0x3ee7('0xf')](_0x5d98cc);}return null;};}function saveUpdates(_0x27c2d9){return function(_0x43ab10){if(_0x43ab10){return _0x43ab10[_0x3ee7('0x14')](_0x27c2d9)[_0x3ee7('0x15')](function(_0x1994d6){return _0x1994d6;});}return null;};}function removeEntity(_0x1dd50b){return function(_0x3c5b78){if(_0x3c5b78){return _0x3c5b78['destroy']()['then'](function(){var _0x4fb161=_0x3c5b78[_0x3ee7('0x16')]({'plain':!![]});var _0x251e40=_0x3ee7('0x17');return db['UserProfileResource'][_0x3ee7('0x18')]({'where':{'type':_0x251e40,'resourceId':_0x4fb161['id']}})[_0x3ee7('0x15')](function(){return _0x3c5b78;});})[_0x3ee7('0x15')](function(){_0x1dd50b[_0x3ee7('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4d07){return function(_0x5cb87a){if(!_0x5cb87a){_0x4b4d07[_0x3ee7('0xd')](0x194);}return _0x5cb87a;};}function handleError(_0x344bd8,_0x34e632){_0x34e632=_0x34e632||0x1f4;return function(_0x557533){logger[_0x3ee7('0x19')](_0x557533[_0x3ee7('0x1a')]);if(_0x557533['name']){delete _0x557533['name'];}_0x344bd8[_0x3ee7('0xe')](_0x34e632)['send'](_0x557533);};}exports[_0x3ee7('0x1b')]=function(_0x406caf,_0x12d1a9){var _0x51c6cd={};var _0x3a196d={'count':0x0,'rows':[]};var _0x3a08cf=_[_0x3ee7('0x1c')](db['OpenchannelQueue'][_0x3ee7('0x1d')],function(_0x29be69){return{'name':_0x29be69[_0x3ee7('0x1e')],'type':_0x29be69[_0x3ee7('0x1f')][_0x3ee7('0x20')]};});_0x51c6cd=qs['getOptions'](_0x3a08cf,_0x406caf);var _0x161e52={'where':_0x51c6cd['where']};return db[_0x3ee7('0x21')][_0x3ee7('0x13')](_0x161e52)[_0x3ee7('0x15')](function(_0x478775){_0x3a196d[_0x3ee7('0x13')]=_0x478775;_0x51c6cd[_0x3ee7('0x22')]=qs[_0x3ee7('0x22')](_0x406caf[_0x3ee7('0x23')]);return db['OpenchannelQueue']['findAll'](_0x51c6cd);})[_0x3ee7('0x15')](function(_0x5bbf4f){_0x3a196d['rows']=_0x5bbf4f;return _0x3a196d;})[_0x3ee7('0x15')](respondWithFilteredResult(_0x12d1a9,_0x51c6cd))['catch'](handleError(_0x12d1a9,null));};exports[_0x3ee7('0x24')]=function(_0x264fea,_0x39eada){var _0x517e7e={'raw':!![],'where':{'id':_0x264fea[_0x3ee7('0x25')]['id']}},_0x1e8ee1={};_0x1e8ee1[_0x3ee7('0x26')]=_['keys'](db[_0x3ee7('0x21')][_0x3ee7('0x1d')]);_0x1e8ee1[_0x3ee7('0x23')]=_[_0x3ee7('0x27')](_0x264fea[_0x3ee7('0x23')]);_0x1e8ee1[_0x3ee7('0x28')]=_[_0x3ee7('0x29')](_0x1e8ee1['model'],_0x1e8ee1[_0x3ee7('0x23')]);_0x517e7e['attributes']=_[_0x3ee7('0x29')](_0x1e8ee1[_0x3ee7('0x26')],qs[_0x3ee7('0x2a')](_0x264fea[_0x3ee7('0x23')][_0x3ee7('0x2a')]));_0x517e7e[_0x3ee7('0x2b')]=_0x517e7e[_0x3ee7('0x2b')][_0x3ee7('0x2c')]?_0x517e7e[_0x3ee7('0x2b')]:_0x1e8ee1['model'];if(_0x264fea[_0x3ee7('0x23')][_0x3ee7('0x2d')]){_0x517e7e['include']=[{'all':!![]}];}_0x517e7e=_[_0x3ee7('0x2e')]({},_0x517e7e,_0x264fea[_0x3ee7('0x2f')]);return db[_0x3ee7('0x21')][_0x3ee7('0x30')](_0x517e7e)[_0x3ee7('0x15')](handleEntityNotFound(_0x39eada,null))['then'](respondWithResult(_0x39eada,null))[_0x3ee7('0x31')](handleError(_0x39eada,null));};exports[_0x3ee7('0x32')]=function(_0x3f8989,_0x1ab4d6){return db[_0x3ee7('0x21')][_0x3ee7('0x32')](_0x3f8989[_0x3ee7('0x33')],{})[_0x3ee7('0x15')](function(_0x2c2ef5){var _0x1a3ca4=_0x3f8989[_0x3ee7('0x34')][_0x3ee7('0x16')]({'plain':!![]});if(!_0x1a3ca4)throw new Error(_0x3ee7('0x35'));if(_0x1a3ca4['role']===_0x3ee7('0x34')){var _0x3e1057=_0x2c2ef5[_0x3ee7('0x16')]({'plain':!![]});var _0x483dcc=_0x3ee7('0x17');return db[_0x3ee7('0x36')][_0x3ee7('0x30')]({'where':{'name':_0x483dcc,'userProfileId':_0x1a3ca4[_0x3ee7('0x37')]},'raw':!![]})['then'](function(_0x14a3e6){if(_0x14a3e6&&_0x14a3e6[_0x3ee7('0x38')]===0x0){return db[_0x3ee7('0x39')][_0x3ee7('0x32')]({'name':_0x3e1057['name'],'resourceId':_0x3e1057['id'],'type':_0x14a3e6[_0x3ee7('0x3a')],'sectionId':_0x14a3e6['id']},{})['then'](function(){return _0x2c2ef5;});}else{return _0x2c2ef5;}})[_0x3ee7('0x31')](function(_0x3b806c){logger[_0x3ee7('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b806c);throw _0x3b806c;});}return _0x2c2ef5;})[_0x3ee7('0x15')](respondWithResult(_0x1ab4d6,0xc9))['catch'](handleError(_0x1ab4d6,null));};exports['update']=function(_0xd9c57,_0xf948de){if(_0xd9c57[_0x3ee7('0x33')]['id']){delete _0xd9c57['body']['id'];}return db['OpenchannelQueue'][_0x3ee7('0x30')]({'where':{'id':_0xd9c57[_0x3ee7('0x25')]['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0xf948de,null))[_0x3ee7('0x15')](saveUpdates(_0xd9c57['body'],null))['then'](respondWithResult(_0xf948de,null))['catch'](handleError(_0xf948de,null));};exports[_0x3ee7('0x18')]=function(_0xc667a6,_0x1d9b98){return db[_0x3ee7('0x21')][_0x3ee7('0x30')]({'where':{'id':_0xc667a6['params']['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0x1d9b98,null))['then'](removeEntity(_0x1d9b98,null))[_0x3ee7('0x31')](handleError(_0x1d9b98,null));};exports[_0x3ee7('0x3b')]=function(_0x218a86,_0x4a5a11){return db['OpenchannelQueue'][_0x3ee7('0x3b')]()[_0x3ee7('0x15')](respondWithResult(_0x4a5a11,null))[_0x3ee7('0x31')](handleError(_0x4a5a11,null));};exports['getMembers']=function(_0x250aa8,_0x43be20){var _0x5107be={'raw':!![],'where':{}},_0x37d22e={},_0x3320f7;return db[_0x3ee7('0x21')][_0x3ee7('0x3c')]({'where':{'id':_0x250aa8[_0x3ee7('0x25')]['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0x43be20,null))[_0x3ee7('0x15')](function(_0x2a3764){if(_0x2a3764){_0x3320f7=_0x2a3764[_0x3ee7('0x16')]({'plain':!![]});_0x37d22e[_0x3ee7('0x26')]=_[_0x3ee7('0x27')](db[_0x3ee7('0x3d')][_0x3ee7('0x1d')]);_0x37d22e[_0x3ee7('0x23')]=_['keys'](_0x250aa8['query']);_0x37d22e[_0x3ee7('0x28')]=_['intersection'](_0x37d22e[_0x3ee7('0x26')],_0x37d22e['query']);_0x5107be[_0x3ee7('0x2b')]=_[_0x3ee7('0x29')](_0x37d22e[_0x3ee7('0x26')],qs[_0x3ee7('0x2a')](_0x250aa8[_0x3ee7('0x23')][_0x3ee7('0x2a')]));_0x5107be[_0x3ee7('0x2b')]=_0x5107be['attributes'][_0x3ee7('0x2c')]?_0x5107be['attributes']:_0x37d22e[_0x3ee7('0x26')];if(!_0x250aa8[_0x3ee7('0x23')][_0x3ee7('0x3e')]('nolimit')){_0x5107be[_0x3ee7('0x12')]=qs[_0x3ee7('0x12')](_0x250aa8[_0x3ee7('0x23')][_0x3ee7('0x12')]);_0x5107be[_0x3ee7('0x10')]=qs[_0x3ee7('0x10')](_0x250aa8[_0x3ee7('0x23')][_0x3ee7('0x10')]);}_0x5107be[_0x3ee7('0x3f')]=qs[_0x3ee7('0x40')](_0x250aa8['query'][_0x3ee7('0x40')]);_0x5107be[_0x3ee7('0x41')]=qs['filters'](_[_0x3ee7('0x42')](_0x250aa8[_0x3ee7('0x23')],_0x37d22e[_0x3ee7('0x28')]));_0x5107be[_0x3ee7('0x41')][_0x3ee7('0x43')]=_0x2a3764['id'];if(_0x250aa8[_0x3ee7('0x23')]['filter']){_0x5107be[_0x3ee7('0x41')]=_[_0x3ee7('0x2e')](_0x5107be[_0x3ee7('0x41')],{'$or':_['map'](_0x5107be[_0x3ee7('0x2b')],function(_0x48402c){var _0x2ed720={};_0x2ed720[_0x48402c]={'$like':'%'+_0x250aa8['query'][_0x3ee7('0x44')]+'%'};return _0x2ed720;})});}_0x5107be=_['merge']({},_0x5107be,_0x250aa8[_0x3ee7('0x2f')]);return db[_0x3ee7('0x3d')][_0x3ee7('0x45')](_0x5107be);}})[_0x3ee7('0x15')](function(_0x27486c){if(_0x27486c){return db['User'][_0x3ee7('0x46')]({'where':{'id':_[_0x3ee7('0x1c')](_0x27486c,_0x3ee7('0x47')),'role':_0x3ee7('0x48')},'attributes':['id',_0x3ee7('0x3a'),_0x3ee7('0x49'),_0x3ee7('0x4a'),'createdAt']});}})[_0x3ee7('0x15')](function(_0x503db2){if(_0x503db2){return{'count':_0x503db2[_0x3ee7('0x13')],'rows':_[_0x3ee7('0x1c')](_0x503db2[_0x3ee7('0x4b')],function(_0x36f6d4){return{'membername':_0x36f6d4[_0x3ee7('0x3a')],'UserId':_0x36f6d4['id'],'queue_name':_0x3320f7[_0x3ee7('0x3a')],'OpenchannelQueueId':_0x3320f7['id'],'interface':util[_0x3ee7('0x4c')](_0x3ee7('0x4d'),'SIP',_0x36f6d4[_0x3ee7('0x3a')]),'penalty':0x0,'paused':_0x36f6d4[_0x3ee7('0x49')],'createdAt':_0x36f6d4[_0x3ee7('0x4e')],'updatedAt':_0x36f6d4[_0x3ee7('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3ee7('0x15')](respondWithFilteredResult(_0x43be20,_0x5107be))['catch'](handleError(_0x43be20,null));};exports[_0x3ee7('0x4f')]=function(_0x133fa8,_0x24f6fd){var _0x36df41={};var _0x2cce78={};var _0x2a27c5;var _0x4f2864;return db[_0x3ee7('0x21')]['findOne']({'where':{'id':_0x133fa8[_0x3ee7('0x25')]['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0x24f6fd,null))[_0x3ee7('0x15')](function(_0x14d9a2){if(_0x14d9a2){_0x2a27c5=_0x14d9a2;_0x2cce78['model']=_[_0x3ee7('0x27')](db[_0x3ee7('0x50')]['rawAttributes']);_0x2cce78[_0x3ee7('0x23')]=_['keys'](_0x133fa8[_0x3ee7('0x23')]);_0x2cce78[_0x3ee7('0x28')]=_[_0x3ee7('0x29')](_0x2cce78[_0x3ee7('0x26')],_0x2cce78[_0x3ee7('0x23')]);_0x36df41[_0x3ee7('0x2b')]=_['intersection'](_0x2cce78[_0x3ee7('0x26')],qs[_0x3ee7('0x2a')](_0x133fa8[_0x3ee7('0x23')]['fields']));_0x36df41[_0x3ee7('0x2b')]=_0x36df41['attributes'][_0x3ee7('0x2c')]?_0x36df41[_0x3ee7('0x2b')]:_0x2cce78['model'];_0x36df41[_0x3ee7('0x3f')]=qs[_0x3ee7('0x40')](_0x133fa8[_0x3ee7('0x23')][_0x3ee7('0x40')]);_0x36df41[_0x3ee7('0x41')]=qs[_0x3ee7('0x28')](_[_0x3ee7('0x42')](_0x133fa8['query'],_0x2cce78['filters']));if(_0x133fa8[_0x3ee7('0x23')]['filter']){_0x36df41[_0x3ee7('0x41')]=_['merge'](_0x36df41[_0x3ee7('0x41')],{'$or':_[_0x3ee7('0x1c')](_0x36df41[_0x3ee7('0x2b')],function(_0x16a0b9){var _0x9d2e30={};_0x9d2e30[_0x16a0b9]={'$like':'%'+_0x133fa8[_0x3ee7('0x23')]['filter']+'%'};return _0x9d2e30;})});}_0x36df41=_['merge']({},_0x36df41,_0x133fa8[_0x3ee7('0x2f')]);return _0x2a27c5['getTeams'](_0x36df41);}})[_0x3ee7('0x15')](function(_0x3073c6){if(_0x3073c6){_0x4f2864=_0x3073c6[_0x3ee7('0x2c')];if(!_0x133fa8[_0x3ee7('0x23')][_0x3ee7('0x3e')](_0x3ee7('0x51'))){_0x36df41[_0x3ee7('0x12')]=qs[_0x3ee7('0x12')](_0x133fa8[_0x3ee7('0x23')][_0x3ee7('0x12')]);_0x36df41[_0x3ee7('0x10')]=qs['offset'](_0x133fa8[_0x3ee7('0x23')][_0x3ee7('0x10')]);}return _0x2a27c5[_0x3ee7('0x4f')](_0x36df41);}})['then'](function(_0x33e40c){if(_0x33e40c){return _0x33e40c?{'count':_0x4f2864,'rows':_0x33e40c}:null;}})['then'](respondWithResult(_0x24f6fd,null))[_0x3ee7('0x31')](handleError(_0x24f6fd,null));};exports['addTeams']=function(_0x440632,_0x40bf2e){var _0x5ce234=_0x440632['body'][_0x3ee7('0x52')];return db['Team'][_0x3ee7('0x45')]({'where':{'id':_0x5ce234},'attributes':['id'],'include':[{'model':db[_0x3ee7('0x53')],'as':_0x3ee7('0x54'),'attributes':['id',_0x3ee7('0x3a'),'online',_0x3ee7('0x55'),'interface'],'raw':!![]}]})[_0x3ee7('0x15')](function(_0xdcdb6d){if(_0xdcdb6d){var _0x411f19=_[_0x3ee7('0x56')](_0xdcdb6d,function(_0x37e46a){var _0x4ecb34=_0x37e46a['get']({'plain':!![]});return _0x4ecb34[_0x3ee7('0x54')];});return db[_0x3ee7('0x21')][_0x3ee7('0x30')]({'where':{'id':_0x440632[_0x3ee7('0x25')]['id']}})['then'](function(_0x482097){return db[_0x3ee7('0x57')][_0x3ee7('0x58')](function(_0x2ca635){return _0x482097[_0x3ee7('0x59')](_0x5ce234,{'transaction':_0x2ca635})[_0x3ee7('0x15')](function(){return BPromise['each'](_0x411f19,function(_0xb91e8c){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0xb91e8c['id'],'OpenchannelQueueId':_0x440632['params']['id']},'transaction':_0x2ca635});});})[_0x3ee7('0x15')](function(){_0x411f19['forEach'](function(_0x5083c8){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x5083c8['id'],'OpenchannelQueueId':_0x482097['id']});});});});});}})['then'](respondWithStatusCode(_0x40bf2e,null))[_0x3ee7('0x31')](handleError(_0x40bf2e,null));};exports[_0x3ee7('0x5a')]=function(_0x342c8a,_0x55fb2e){return db['Team'][_0x3ee7('0x45')]({'where':{'id':_0x342c8a['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3ee7('0x53')],'as':_0x3ee7('0x54'),'attributes':['id'],'raw':!![]}]})[_0x3ee7('0x15')](handleEntityNotFound(_0x55fb2e,null))['then'](function(_0x3ba697){var _0x10f243=_[_0x3ee7('0x1c')](_0x3ba697,'id');var _0x7cf99f=[];var _0x20bc00=[];var _0x3925be=squel[_0x3ee7('0x5b')]();_0x3925be[_0x3ee7('0x5c')](_0x3ee7('0x5d'))[_0x3ee7('0x5e')]('team_has_openchannel_queues','tq')[_0x3ee7('0x5f')](_0x3ee7('0x60'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3ee7('0x61'),_0x342c8a[_0x3ee7('0x25')]['id']);for(var _0x4d265a=0x0;_0x4d265a<_0x3ba697[_0x3ee7('0x2c')];_0x4d265a+=0x1){let _0x111eae=_0x3ba697[_0x4d265a];for(var _0x2abf63=0x0;_0x2abf63<_0x111eae[_0x3ee7('0x54')][_0x3ee7('0x2c')];_0x2abf63+=0x1){let _0x1984d2=_0x111eae[_0x3ee7('0x54')][_0x2abf63];var _0x1f38e4=_0x3925be[_0x3ee7('0x62')]();_0x1f38e4[_0x3ee7('0x41')]('ut.UserId\x20=\x20?',_0x1984d2['id']);_0x20bc00[_0x3ee7('0x63')](db[_0x3ee7('0x57')][_0x3ee7('0x23')](_0x1f38e4['toString'](),{'type':db[_0x3ee7('0x57')][_0x3ee7('0x64')][_0x3ee7('0x65')]})[_0x3ee7('0x15')](function(_0x5910fe){if(_0x5910fe[_0x3ee7('0x2c')]===0x1){return _0x1984d2['id'];}else{var _0x413f55=_[_0x3ee7('0x66')](_[_0x3ee7('0x1c')](_0x5910fe,_0x3ee7('0x67')),function(_0x51630f){return _[_0x3ee7('0x68')](_0x10f243,_0x51630f);});if(_0x413f55){return _0x1984d2['id'];}}}));}}return BPromise['all'](_0x20bc00)[_0x3ee7('0x15')](function(_0x5175db){_0x7cf99f=_(_0x7cf99f)[_0x3ee7('0x69')](_0x5175db)[_0x3ee7('0x6a')]()[_0x3ee7('0x6b')]();return db[_0x3ee7('0x21')][_0x3ee7('0x30')]({'where':{'id':_0x342c8a[_0x3ee7('0x25')]['id']}})[_0x3ee7('0x15')](function(_0x54f206){return db[_0x3ee7('0x57')][_0x3ee7('0x58')](function(_0x2ee995){return _0x54f206['removeTeams'](_0x342c8a[_0x3ee7('0x23')][_0x3ee7('0x52')],{'transaction':_0x2ee995})[_0x3ee7('0x15')](function(){if(!_['isEmpty'](_0x7cf99f)){return _0x54f206[_0x3ee7('0x6c')](_0x7cf99f,{'transaction':_0x2ee995});}})[_0x3ee7('0x15')](function(){_0x7cf99f['forEach'](function(_0x317a1f){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x317a1f,'OpenchannelQueueId':_0x54f206['id']});});});});});});})['then'](respondWithStatusCode(_0x55fb2e,null))[_0x3ee7('0x31')](handleError(_0x55fb2e,null));};exports[_0x3ee7('0x6d')]=function(_0x2943bf,_0x203016){return db[_0x3ee7('0x21')][_0x3ee7('0x30')]({'where':{'id':_0x2943bf['params']['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0x203016,null))['then'](function(_0x4e708c){if(_0x4e708c){return _0x4e708c[_0x3ee7('0x6d')](_0x2943bf['body'][_0x3ee7('0x52')],_[_0x3ee7('0x6e')](_0x2943bf[_0x3ee7('0x33')],[_0x3ee7('0x52'),'id'])||{})[_0x3ee7('0x6f')](function(_0x1617db){for(var _0x33127e=0x0;_0x33127e<_0x2943bf['body'][_0x3ee7('0x52')][_0x3ee7('0x2c')];_0x33127e+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x2943bf[_0x3ee7('0x33')][_0x3ee7('0x52')][_0x33127e]),'OpenchannelQueueId':Number(_0x2943bf[_0x3ee7('0x25')]['id'])});}return _0x1617db;});}})[_0x3ee7('0x15')](respondWithResult(_0x203016,null))['catch'](handleError(_0x203016,null));};exports[_0x3ee7('0x6c')]=function(_0x2eddc5,_0x1ed5e6){return db['OpenchannelQueue'][_0x3ee7('0x30')]({'where':{'id':_0x2eddc5['params']['id']}})['then'](handleEntityNotFound(_0x1ed5e6,null))[_0x3ee7('0x15')](function(_0x4cc07d){if(_0x4cc07d){return _0x4cc07d[_0x3ee7('0x6c')](_0x2eddc5['query'][_0x3ee7('0x52')])[_0x3ee7('0x15')](function(){if(_['isArray'](_0x2eddc5['query'][_0x3ee7('0x52')])){for(var _0x4a9982=0x0;_0x4a9982<_0x2eddc5['query']['ids']['length'];_0x4a9982+=0x1){socket[_0x3ee7('0x70')](_0x3ee7('0x71'),{'UserId':Number(_0x2eddc5['query'][_0x3ee7('0x52')][_0x4a9982]),'OpenchannelQueueId':Number(_0x2eddc5[_0x3ee7('0x25')]['id'])});}}else{socket[_0x3ee7('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2eddc5['query'][_0x3ee7('0x52')]),'OpenchannelQueueId':Number(_0x2eddc5[_0x3ee7('0x25')]['id'])});}});}})[_0x3ee7('0x15')](respondWithStatusCode(_0x1ed5e6,null))[_0x3ee7('0x31')](handleError(_0x1ed5e6,null));};exports[_0x3ee7('0x72')]=function(_0x56ddac,_0x24657d){var _0x7aaaca={};var _0x3b9957={};var _0x2ea776;var _0x2cf89a;return db['OpenchannelQueue'][_0x3ee7('0x3c')]({'where':{'id':_0x56ddac[_0x3ee7('0x25')]['id']}})[_0x3ee7('0x15')](handleEntityNotFound(_0x24657d,null))[_0x3ee7('0x15')](function(_0x3f3b69){if(_0x3f3b69){_0x2ea776=_0x3f3b69;_0x3b9957['model']=_[_0x3ee7('0x27')](db[_0x3ee7('0x53')][_0x3ee7('0x1d')]);_0x3b9957['query']=_[_0x3ee7('0x27')](_0x56ddac[_0x3ee7('0x23')]);_0x3b9957[_0x3ee7('0x28')]=_[_0x3ee7('0x29')](_0x3b9957['model'],_0x3b9957[_0x3ee7('0x23')]);_0x7aaaca['attributes']=_[_0x3ee7('0x29')](_0x3b9957[_0x3ee7('0x26')],qs[_0x3ee7('0x2a')](_0x56ddac['query']['fields']));_0x7aaaca[_0x3ee7('0x2b')]=_0x7aaaca[_0x3ee7('0x2b')]['length']?_0x7aaaca[_0x3ee7('0x2b')]:_0x3b9957['model'];_0x7aaaca['order']=qs[_0x3ee7('0x40')](_0x56ddac[_0x3ee7('0x23')][_0x3ee7('0x40')]);_0x7aaaca[_0x3ee7('0x41')]=qs[_0x3ee7('0x28')](_[_0x3ee7('0x42')](_0x56ddac['query'],_0x3b9957[_0x3ee7('0x28')]));if(_0x56ddac[_0x3ee7('0x23')]['filter']){_0x7aaaca[_0x3ee7('0x41')]=_['merge'](_0x7aaaca[_0x3ee7('0x41')],{'$or':_[_0x3ee7('0x1c')](_0x7aaaca[_0x3ee7('0x2b')],function(_0x4c6f3f){var _0x56b518={};_0x56b518[_0x4c6f3f]={'$like':'%'+_0x56ddac[_0x3ee7('0x23')]['filter']+'%'};return _0x56b518;})});}_0x7aaaca=_['merge']({},_0x7aaaca,_0x56ddac['options']);return _0x2ea776[_0x3ee7('0x72')](_0x7aaaca);}})[_0x3ee7('0x15')](function(_0x4909a5){if(_0x4909a5){_0x2cf89a=_0x4909a5['length'];if(!_0x56ddac[_0x3ee7('0x23')]['hasOwnProperty'](_0x3ee7('0x51'))){_0x7aaaca[_0x3ee7('0x12')]=qs[_0x3ee7('0x12')](_0x56ddac[_0x3ee7('0x23')][_0x3ee7('0x12')]);_0x7aaaca[_0x3ee7('0x10')]=qs[_0x3ee7('0x10')](_0x56ddac[_0x3ee7('0x23')][_0x3ee7('0x10')]);}return _0x2ea776[_0x3ee7('0x72')](_0x7aaaca);}})[_0x3ee7('0x15')](function(_0x2570a8){if(_0x2570a8){return _0x2570a8?{'count':_0x2cf89a,'rows':_0x2570a8}:null;}})['then'](respondWithResult(_0x24657d,null))[_0x3ee7('0x31')](handleError(_0x24657d,null));}; \ No newline at end of file +var _0x6d1b=['socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','OpenchannelQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','intersection','length','order','sort','OpenchannelQueueId','filter','map','merge','User','findAndCountAll','openchannelPause','updatedAt','SIP','createdAt','getTeams','pick','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','findOne','bluebird','util','squel','ioredis','../../config/logger','../../mysqldb','defaults','redis','localhost'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6d1b,0xe5));var _0xb6d1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6d1b[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xb6d1('0x0'));var util=require(_0xb6d1('0x1'));var _=require('lodash');var squel=require(_0xb6d1('0x2'));var Redis=require(_0xb6d1('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xb6d1('0x4'))('api');var config=require('../../config/environment');var db=require(_0xb6d1('0x5'))['db'];config['redis']=_[_0xb6d1('0x6')](config[_0xb6d1('0x7')],{'host':_0xb6d1('0x8'),'port':0x18eb});var socket=require(_0xb6d1('0x9'))(new Redis(config[_0xb6d1('0x7')]));require(_0xb6d1('0xa'))[_0xb6d1('0xb')](socket);function respondWithStatusCode(_0x3cbe00,_0xfdc8e){_0xfdc8e=_0xfdc8e||0xcc;return function(_0x260e4b){if(_0x260e4b){return _0x3cbe00[_0xb6d1('0xc')](_0xfdc8e);}return _0x3cbe00[_0xb6d1('0xd')](_0xfdc8e)[_0xb6d1('0xe')]();};}function respondWithResult(_0xa4b56a,_0x31c9c2){_0x31c9c2=_0x31c9c2||0xc8;return function(_0x548e41){if(_0x548e41){return _0xa4b56a[_0xb6d1('0xd')](_0x31c9c2)[_0xb6d1('0xf')](_0x548e41);}};}function respondWithFilteredResult(_0x3d6ba0,_0x12b949){return function(_0x1afffa){if(_0x1afffa){var _0x150817=typeof _0x12b949['offset']===_0xb6d1('0x10')&&typeof _0x12b949[_0xb6d1('0x11')]==='undefined';var _0x4aa3bb=_0x1afffa[_0xb6d1('0x12')];var _0x5e9877=_0x150817?0x0:_0x12b949[_0xb6d1('0x13')];var _0x2c11b6=_0x150817?_0x1afffa[_0xb6d1('0x12')]:_0x12b949[_0xb6d1('0x13')]+_0x12b949[_0xb6d1('0x11')];var _0x42a71c;if(_0x2c11b6>=_0x4aa3bb){_0x2c11b6=_0x4aa3bb;_0x42a71c=0xc8;}else{_0x42a71c=0xce;}_0x3d6ba0['status'](_0x42a71c);return _0x3d6ba0[_0xb6d1('0x14')](_0xb6d1('0x15'),_0x5e9877+'-'+_0x2c11b6+'/'+_0x4aa3bb)[_0xb6d1('0xf')](_0x1afffa);}return null;};}function saveUpdates(_0x73a108){return function(_0x515d82){if(_0x515d82){return _0x515d82[_0xb6d1('0x16')](_0x73a108)[_0xb6d1('0x17')](function(_0x4e0c19){return _0x4e0c19;});}return null;};}function removeEntity(_0x569d6f){return function(_0x59f620){if(_0x59f620){return _0x59f620[_0xb6d1('0x18')]()[_0xb6d1('0x17')](function(){var _0x58c824=_0x59f620[_0xb6d1('0x19')]({'plain':!![]});var _0x5a925a='OpenchannelQueues';return db[_0xb6d1('0x1a')][_0xb6d1('0x18')]({'where':{'type':_0x5a925a,'resourceId':_0x58c824['id']}})[_0xb6d1('0x17')](function(){return _0x59f620;});})[_0xb6d1('0x17')](function(){_0x569d6f[_0xb6d1('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1edfd0){return function(_0x54720a){if(!_0x54720a){_0x1edfd0[_0xb6d1('0xc')](0x194);}return _0x54720a;};}function handleError(_0x1922f5,_0x4cd4d4){_0x4cd4d4=_0x4cd4d4||0x1f4;return function(_0x3839d4){logger['error'](_0x3839d4[_0xb6d1('0x1b')]);if(_0x3839d4[_0xb6d1('0x1c')]){delete _0x3839d4[_0xb6d1('0x1c')];}_0x1922f5[_0xb6d1('0xd')](_0x4cd4d4)['send'](_0x3839d4);};}exports['index']=function(_0x456b8a,_0x49b44f){var _0x47d814={};var _0xb91b={'count':0x0,'rows':[]};var _0x3d5f0d=_['map'](db[_0xb6d1('0x1d')][_0xb6d1('0x1e')],function(_0x5557cb){return{'name':_0x5557cb['fieldName'],'type':_0x5557cb[_0xb6d1('0x1f')]['key']};});_0x47d814=qs[_0xb6d1('0x20')](_0x3d5f0d,_0x456b8a);var _0x2e61af={'where':_0x47d814[_0xb6d1('0x21')]};return db[_0xb6d1('0x1d')][_0xb6d1('0x12')](_0x2e61af)[_0xb6d1('0x17')](function(_0x57e1c6){_0xb91b['count']=_0x57e1c6;_0x47d814[_0xb6d1('0x22')]=qs[_0xb6d1('0x22')](_0x456b8a[_0xb6d1('0x23')]);return db[_0xb6d1('0x1d')][_0xb6d1('0x24')](_0x47d814);})[_0xb6d1('0x17')](function(_0x138dc8){_0xb91b[_0xb6d1('0x25')]=_0x138dc8;return _0xb91b;})[_0xb6d1('0x17')](respondWithFilteredResult(_0x49b44f,_0x47d814))[_0xb6d1('0x26')](handleError(_0x49b44f,null));};exports[_0xb6d1('0x27')]=function(_0x402292,_0x108c96){var _0x26064d={'raw':!![],'where':{'id':_0x402292[_0xb6d1('0x28')]['id']}},_0x150d7a={};_0x150d7a[_0xb6d1('0x29')]=_[_0xb6d1('0x2a')](db[_0xb6d1('0x1d')][_0xb6d1('0x1e')]);_0x150d7a[_0xb6d1('0x23')]=_[_0xb6d1('0x2a')](_0x402292[_0xb6d1('0x23')]);_0x150d7a[_0xb6d1('0x2b')]=_['intersection'](_0x150d7a[_0xb6d1('0x29')],_0x150d7a['query']);_0x26064d[_0xb6d1('0x2c')]=_['intersection'](_0x150d7a['model'],qs[_0xb6d1('0x2d')](_0x402292[_0xb6d1('0x23')][_0xb6d1('0x2d')]));_0x26064d['attributes']=_0x26064d['attributes']['length']?_0x26064d[_0xb6d1('0x2c')]:_0x150d7a['model'];if(_0x402292[_0xb6d1('0x23')][_0xb6d1('0x2e')]){_0x26064d[_0xb6d1('0x22')]=[{'all':!![]}];}_0x26064d=_['merge']({},_0x26064d,_0x402292[_0xb6d1('0x2f')]);return db[_0xb6d1('0x1d')][_0xb6d1('0x30')](_0x26064d)[_0xb6d1('0x17')](handleEntityNotFound(_0x108c96,null))[_0xb6d1('0x17')](respondWithResult(_0x108c96,null))[_0xb6d1('0x26')](handleError(_0x108c96,null));};exports[_0xb6d1('0x31')]=function(_0x7f68d9,_0x7be4ad){return db[_0xb6d1('0x1d')][_0xb6d1('0x31')](_0x7f68d9[_0xb6d1('0x32')],{})[_0xb6d1('0x17')](function(_0x4c3571){var _0x12dee2=_0x7f68d9[_0xb6d1('0x33')][_0xb6d1('0x19')]({'plain':!![]});if(!_0x12dee2)throw new Error(_0xb6d1('0x34'));if(_0x12dee2[_0xb6d1('0x35')]==='user'){var _0x2391a9=_0x4c3571[_0xb6d1('0x19')]({'plain':!![]});var _0x13fe42=_0xb6d1('0x36');return db[_0xb6d1('0x37')][_0xb6d1('0x30')]({'where':{'name':_0x13fe42,'userProfileId':_0x12dee2[_0xb6d1('0x38')]},'raw':!![]})[_0xb6d1('0x17')](function(_0x263803){if(_0x263803&&_0x263803['autoAssociation']===0x0){return db[_0xb6d1('0x1a')][_0xb6d1('0x31')]({'name':_0x2391a9[_0xb6d1('0x1c')],'resourceId':_0x2391a9['id'],'type':_0x263803[_0xb6d1('0x1c')],'sectionId':_0x263803['id']},{})[_0xb6d1('0x17')](function(){return _0x4c3571;});}else{return _0x4c3571;}})[_0xb6d1('0x26')](function(_0x1bee6e){logger[_0xb6d1('0x39')](_0xb6d1('0x3a'),_0x1bee6e);throw _0x1bee6e;});}return _0x4c3571;})[_0xb6d1('0x17')](respondWithResult(_0x7be4ad,0xc9))[_0xb6d1('0x26')](handleError(_0x7be4ad,null));};exports['update']=function(_0x546c0b,_0x288cf8){if(_0x546c0b[_0xb6d1('0x32')]['id']){delete _0x546c0b['body']['id'];}return db[_0xb6d1('0x1d')]['find']({'where':{'id':_0x546c0b[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x288cf8,null))[_0xb6d1('0x17')](saveUpdates(_0x546c0b['body'],null))[_0xb6d1('0x17')](respondWithResult(_0x288cf8,null))[_0xb6d1('0x26')](handleError(_0x288cf8,null));};exports[_0xb6d1('0x18')]=function(_0x5b8268,_0x4da07c){return db[_0xb6d1('0x1d')][_0xb6d1('0x30')]({'where':{'id':_0x5b8268[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x4da07c,null))[_0xb6d1('0x17')](removeEntity(_0x4da07c,null))[_0xb6d1('0x26')](handleError(_0x4da07c,null));};exports[_0xb6d1('0x3b')]=function(_0xd7c084,_0xd0026c){return db['OpenchannelQueue'][_0xb6d1('0x3b')]()['then'](respondWithResult(_0xd0026c,null))[_0xb6d1('0x26')](handleError(_0xd0026c,null));};exports[_0xb6d1('0x3c')]=function(_0xd05398,_0x50c439){var _0xc1e537={'raw':!![],'where':{}},_0x498754={},_0x1ad3fb;return db['OpenchannelQueue']['findOne']({'where':{'id':_0xd05398[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x50c439,null))[_0xb6d1('0x17')](function(_0x5b9e73){if(_0x5b9e73){_0x1ad3fb=_0x5b9e73[_0xb6d1('0x19')]({'plain':!![]});_0x498754['model']=_[_0xb6d1('0x2a')](db[_0xb6d1('0x3d')]['rawAttributes']);_0x498754[_0xb6d1('0x23')]=_[_0xb6d1('0x2a')](_0xd05398[_0xb6d1('0x23')]);_0x498754[_0xb6d1('0x2b')]=_[_0xb6d1('0x3e')](_0x498754['model'],_0x498754[_0xb6d1('0x23')]);_0xc1e537[_0xb6d1('0x2c')]=_['intersection'](_0x498754['model'],qs[_0xb6d1('0x2d')](_0xd05398['query'][_0xb6d1('0x2d')]));_0xc1e537['attributes']=_0xc1e537[_0xb6d1('0x2c')][_0xb6d1('0x3f')]?_0xc1e537['attributes']:_0x498754[_0xb6d1('0x29')];if(!_0xd05398[_0xb6d1('0x23')]['hasOwnProperty']('nolimit')){_0xc1e537[_0xb6d1('0x11')]=qs[_0xb6d1('0x11')](_0xd05398['query'][_0xb6d1('0x11')]);_0xc1e537[_0xb6d1('0x13')]=qs[_0xb6d1('0x13')](_0xd05398['query'][_0xb6d1('0x13')]);}_0xc1e537[_0xb6d1('0x40')]=qs[_0xb6d1('0x41')](_0xd05398['query'][_0xb6d1('0x41')]);_0xc1e537[_0xb6d1('0x21')]=qs[_0xb6d1('0x2b')](_['pick'](_0xd05398[_0xb6d1('0x23')],_0x498754['filters']));_0xc1e537['where'][_0xb6d1('0x42')]=_0x5b9e73['id'];if(_0xd05398['query'][_0xb6d1('0x43')]){_0xc1e537['where']=_['merge'](_0xc1e537[_0xb6d1('0x21')],{'$or':_[_0xb6d1('0x44')](_0xc1e537['attributes'],function(_0x8550ff){var _0x62d53a={};_0x62d53a[_0x8550ff]={'$like':'%'+_0xd05398[_0xb6d1('0x23')][_0xb6d1('0x43')]+'%'};return _0x62d53a;})});}_0xc1e537=_[_0xb6d1('0x45')]({},_0xc1e537,_0xd05398[_0xb6d1('0x2f')]);return db[_0xb6d1('0x3d')][_0xb6d1('0x24')](_0xc1e537);}})['then'](function(_0xb8b23){if(_0xb8b23){return db[_0xb6d1('0x46')][_0xb6d1('0x47')]({'where':{'id':_[_0xb6d1('0x44')](_0xb8b23,'UserId'),'role':'agent'},'attributes':['id',_0xb6d1('0x1c'),_0xb6d1('0x48'),_0xb6d1('0x49'),'createdAt']});}})['then'](function(_0x1ba24f){if(_0x1ba24f){return{'count':_0x1ba24f[_0xb6d1('0x12')],'rows':_[_0xb6d1('0x44')](_0x1ba24f['rows'],function(_0x18eb9f){return{'membername':_0x18eb9f['name'],'UserId':_0x18eb9f['id'],'queue_name':_0x1ad3fb[_0xb6d1('0x1c')],'OpenchannelQueueId':_0x1ad3fb['id'],'interface':util['format']('%s/%s',_0xb6d1('0x4a'),_0x18eb9f[_0xb6d1('0x1c')]),'penalty':0x0,'paused':_0x18eb9f[_0xb6d1('0x48')],'createdAt':_0x18eb9f[_0xb6d1('0x4b')],'updatedAt':_0x18eb9f[_0xb6d1('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x50c439,_0xc1e537))[_0xb6d1('0x26')](handleError(_0x50c439,null));};exports[_0xb6d1('0x4c')]=function(_0x1a8a06,_0x5f3c57){var _0x411889={};var _0x423412={};var _0x8e012e;var _0x45ca93;return db[_0xb6d1('0x1d')]['findOne']({'where':{'id':_0x1a8a06[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x5f3c57,null))[_0xb6d1('0x17')](function(_0x2dab25){if(_0x2dab25){_0x8e012e=_0x2dab25;_0x423412['model']=_[_0xb6d1('0x2a')](db['Team'][_0xb6d1('0x1e')]);_0x423412[_0xb6d1('0x23')]=_[_0xb6d1('0x2a')](_0x1a8a06[_0xb6d1('0x23')]);_0x423412[_0xb6d1('0x2b')]=_[_0xb6d1('0x3e')](_0x423412[_0xb6d1('0x29')],_0x423412[_0xb6d1('0x23')]);_0x411889[_0xb6d1('0x2c')]=_[_0xb6d1('0x3e')](_0x423412[_0xb6d1('0x29')],qs['fields'](_0x1a8a06['query']['fields']));_0x411889[_0xb6d1('0x2c')]=_0x411889[_0xb6d1('0x2c')]['length']?_0x411889[_0xb6d1('0x2c')]:_0x423412[_0xb6d1('0x29')];_0x411889[_0xb6d1('0x40')]=qs[_0xb6d1('0x41')](_0x1a8a06[_0xb6d1('0x23')]['sort']);_0x411889[_0xb6d1('0x21')]=qs[_0xb6d1('0x2b')](_[_0xb6d1('0x4d')](_0x1a8a06[_0xb6d1('0x23')],_0x423412[_0xb6d1('0x2b')]));if(_0x1a8a06[_0xb6d1('0x23')][_0xb6d1('0x43')]){_0x411889['where']=_['merge'](_0x411889[_0xb6d1('0x21')],{'$or':_['map'](_0x411889[_0xb6d1('0x2c')],function(_0x7127de){var _0x206e9e={};_0x206e9e[_0x7127de]={'$like':'%'+_0x1a8a06[_0xb6d1('0x23')][_0xb6d1('0x43')]+'%'};return _0x206e9e;})});}_0x411889=_[_0xb6d1('0x45')]({},_0x411889,_0x1a8a06[_0xb6d1('0x2f')]);return _0x8e012e[_0xb6d1('0x4c')](_0x411889);}})['then'](function(_0x4337f5){if(_0x4337f5){_0x45ca93=_0x4337f5[_0xb6d1('0x3f')];if(!_0x1a8a06[_0xb6d1('0x23')]['hasOwnProperty']('nolimit')){_0x411889[_0xb6d1('0x11')]=qs[_0xb6d1('0x11')](_0x1a8a06[_0xb6d1('0x23')][_0xb6d1('0x11')]);_0x411889[_0xb6d1('0x13')]=qs['offset'](_0x1a8a06['query'][_0xb6d1('0x13')]);}return _0x8e012e[_0xb6d1('0x4c')](_0x411889);}})['then'](function(_0x458b60){if(_0x458b60){return _0x458b60?{'count':_0x45ca93,'rows':_0x458b60}:null;}})[_0xb6d1('0x17')](respondWithResult(_0x5f3c57,null))[_0xb6d1('0x26')](handleError(_0x5f3c57,null));};exports[_0xb6d1('0x4e')]=function(_0x1b60db,_0x3e5326){var _0x312a33=_0x1b60db[_0xb6d1('0x32')][_0xb6d1('0x4f')];return db['Team'][_0xb6d1('0x24')]({'where':{'id':_0x312a33},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb6d1('0x50'),'attributes':['id',_0xb6d1('0x1c'),_0xb6d1('0x51'),'voicePause',_0xb6d1('0x52')],'raw':!![]}]})[_0xb6d1('0x17')](function(_0x154e1e){if(_0x154e1e){var _0x556adc=_[_0xb6d1('0x53')](_0x154e1e,function(_0x4d2d62){var _0x15bdfa=_0x4d2d62['get']({'plain':!![]});return _0x15bdfa[_0xb6d1('0x50')];});return db[_0xb6d1('0x1d')]['find']({'where':{'id':_0x1b60db[_0xb6d1('0x28')]['id']}})['then'](function(_0x234380){return db[_0xb6d1('0x54')][_0xb6d1('0x55')](function(_0x19f6f4){return _0x234380[_0xb6d1('0x4e')](_0x312a33,{'transaction':_0x19f6f4})[_0xb6d1('0x17')](function(){return BPromise[_0xb6d1('0x56')](_0x556adc,function(_0x59086e){return db[_0xb6d1('0x3d')][_0xb6d1('0x57')]({'where':{'UserId':_0x59086e['id'],'OpenchannelQueueId':_0x1b60db[_0xb6d1('0x28')]['id']},'transaction':_0x19f6f4});});})[_0xb6d1('0x17')](function(){_0x556adc[_0xb6d1('0x58')](function(_0x465a2f){socket[_0xb6d1('0x59')](_0xb6d1('0x5a'),{'UserId':_0x465a2f['id'],'OpenchannelQueueId':_0x234380['id']});});});});});}})['then'](respondWithStatusCode(_0x3e5326,null))['catch'](handleError(_0x3e5326,null));};exports[_0xb6d1('0x5b')]=function(_0x36ef56,_0x186ea0){return db[_0xb6d1('0x5c')][_0xb6d1('0x24')]({'where':{'id':_0x36ef56[_0xb6d1('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb6d1('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb6d1('0x17')](handleEntityNotFound(_0x186ea0,null))[_0xb6d1('0x17')](function(_0x34f5bb){var _0x1e5b66=_[_0xb6d1('0x44')](_0x34f5bb,'id');var _0x167544=[];var _0x4e8d04=[];var _0x4971f5=squel[_0xb6d1('0x5d')]();_0x4971f5[_0xb6d1('0x5e')](_0xb6d1('0x5f'))['from'](_0xb6d1('0x60'),'tq')[_0xb6d1('0x61')]('user_has_teams','ut',_0xb6d1('0x62'))['where'](_0xb6d1('0x63'),_0x36ef56['params']['id']);for(var _0x3e7c76=0x0;_0x3e7c76<_0x34f5bb[_0xb6d1('0x3f')];_0x3e7c76+=0x1){let _0x2d671b=_0x34f5bb[_0x3e7c76];for(var _0x5f3126=0x0;_0x5f3126<_0x2d671b[_0xb6d1('0x50')][_0xb6d1('0x3f')];_0x5f3126+=0x1){let _0x305f2e=_0x2d671b[_0xb6d1('0x50')][_0x5f3126];var _0x716731=_0x4971f5[_0xb6d1('0x64')]();_0x716731[_0xb6d1('0x21')](_0xb6d1('0x65'),_0x305f2e['id']);_0x4e8d04[_0xb6d1('0x66')](db[_0xb6d1('0x54')][_0xb6d1('0x23')](_0x716731[_0xb6d1('0x67')](),{'type':db[_0xb6d1('0x54')]['QueryTypes'][_0xb6d1('0x68')]})[_0xb6d1('0x17')](function(_0x38cb44){if(_0x38cb44[_0xb6d1('0x3f')]===0x1){return _0x305f2e['id'];}else{var _0x3df1ff=_[_0xb6d1('0x69')](_[_0xb6d1('0x44')](_0x38cb44,_0xb6d1('0x6a')),function(_0x273e61){return _[_0xb6d1('0x6b')](_0x1e5b66,_0x273e61);});if(_0x3df1ff){return _0x305f2e['id'];}}}));}}return BPromise[_0xb6d1('0x6c')](_0x4e8d04)[_0xb6d1('0x17')](function(_0x271a47){_0x167544=_(_0x167544)[_0xb6d1('0x6d')](_0x271a47)[_0xb6d1('0x6e')]()['value']();return db[_0xb6d1('0x1d')][_0xb6d1('0x30')]({'where':{'id':_0x36ef56[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](function(_0x59d3c3){return db[_0xb6d1('0x54')][_0xb6d1('0x55')](function(_0x43dd8b){return _0x59d3c3['removeTeams'](_0x36ef56[_0xb6d1('0x23')]['ids'],{'transaction':_0x43dd8b})['then'](function(){if(!_[_0xb6d1('0x6f')](_0x167544)){return _0x59d3c3[_0xb6d1('0x70')](_0x167544,{'transaction':_0x43dd8b});}})['then'](function(){_0x167544[_0xb6d1('0x58')](function(_0x197f99){socket[_0xb6d1('0x59')](_0xb6d1('0x71'),{'UserId':_0x197f99,'OpenchannelQueueId':_0x59d3c3['id']});});});});});});})[_0xb6d1('0x17')](respondWithStatusCode(_0x186ea0,null))[_0xb6d1('0x26')](handleError(_0x186ea0,null));};exports['addAgents']=function(_0xc078c2,_0x5215aa){return db['OpenchannelQueue'][_0xb6d1('0x30')]({'where':{'id':_0xc078c2[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x5215aa,null))['then'](function(_0x4e1254){if(_0x4e1254){return _0x4e1254[_0xb6d1('0x72')](_0xc078c2[_0xb6d1('0x32')][_0xb6d1('0x4f')],_[_0xb6d1('0x73')](_0xc078c2[_0xb6d1('0x32')],['ids','id'])||{})[_0xb6d1('0x74')](function(_0x202d9d){for(var _0xdd9c19=0x0;_0xdd9c19<_0xc078c2['body'][_0xb6d1('0x4f')][_0xb6d1('0x3f')];_0xdd9c19+=0x1){socket[_0xb6d1('0x59')]('userOpenchannelQueue:save',{'UserId':Number(_0xc078c2[_0xb6d1('0x32')][_0xb6d1('0x4f')][_0xdd9c19]),'OpenchannelQueueId':Number(_0xc078c2[_0xb6d1('0x28')]['id'])});}return _0x202d9d;});}})['then'](respondWithResult(_0x5215aa,null))[_0xb6d1('0x26')](handleError(_0x5215aa,null));};exports[_0xb6d1('0x70')]=function(_0x51e5e7,_0x5c5aac){return db[_0xb6d1('0x1d')][_0xb6d1('0x30')]({'where':{'id':_0x51e5e7[_0xb6d1('0x28')]['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x5c5aac,null))[_0xb6d1('0x17')](function(_0x3c6b10){if(_0x3c6b10){return _0x3c6b10[_0xb6d1('0x70')](_0x51e5e7[_0xb6d1('0x23')]['ids'])[_0xb6d1('0x17')](function(){if(_['isArray'](_0x51e5e7['query'][_0xb6d1('0x4f')])){for(var _0x142712=0x0;_0x142712<_0x51e5e7[_0xb6d1('0x23')][_0xb6d1('0x4f')]['length'];_0x142712+=0x1){socket[_0xb6d1('0x59')](_0xb6d1('0x71'),{'UserId':Number(_0x51e5e7[_0xb6d1('0x23')][_0xb6d1('0x4f')][_0x142712]),'OpenchannelQueueId':Number(_0x51e5e7[_0xb6d1('0x28')]['id'])});}}else{socket[_0xb6d1('0x59')](_0xb6d1('0x71'),{'UserId':Number(_0x51e5e7[_0xb6d1('0x23')][_0xb6d1('0x4f')]),'OpenchannelQueueId':Number(_0x51e5e7['params']['id'])});}});}})[_0xb6d1('0x17')](respondWithStatusCode(_0x5c5aac,null))[_0xb6d1('0x26')](handleError(_0x5c5aac,null));};exports[_0xb6d1('0x75')]=function(_0x3a17b1,_0x49d055){var _0x38585b={};var _0x3415bd={};var _0x3d2437;var _0x523b7a;return db[_0xb6d1('0x1d')][_0xb6d1('0x76')]({'where':{'id':_0x3a17b1['params']['id']}})[_0xb6d1('0x17')](handleEntityNotFound(_0x49d055,null))[_0xb6d1('0x17')](function(_0x204a28){if(_0x204a28){_0x3d2437=_0x204a28;_0x3415bd[_0xb6d1('0x29')]=_[_0xb6d1('0x2a')](db[_0xb6d1('0x46')][_0xb6d1('0x1e')]);_0x3415bd[_0xb6d1('0x23')]=_[_0xb6d1('0x2a')](_0x3a17b1[_0xb6d1('0x23')]);_0x3415bd[_0xb6d1('0x2b')]=_[_0xb6d1('0x3e')](_0x3415bd[_0xb6d1('0x29')],_0x3415bd[_0xb6d1('0x23')]);_0x38585b[_0xb6d1('0x2c')]=_[_0xb6d1('0x3e')](_0x3415bd['model'],qs[_0xb6d1('0x2d')](_0x3a17b1[_0xb6d1('0x23')][_0xb6d1('0x2d')]));_0x38585b[_0xb6d1('0x2c')]=_0x38585b[_0xb6d1('0x2c')][_0xb6d1('0x3f')]?_0x38585b[_0xb6d1('0x2c')]:_0x3415bd['model'];_0x38585b[_0xb6d1('0x40')]=qs['sort'](_0x3a17b1['query'][_0xb6d1('0x41')]);_0x38585b[_0xb6d1('0x21')]=qs['filters'](_['pick'](_0x3a17b1['query'],_0x3415bd['filters']));if(_0x3a17b1[_0xb6d1('0x23')][_0xb6d1('0x43')]){_0x38585b['where']=_[_0xb6d1('0x45')](_0x38585b[_0xb6d1('0x21')],{'$or':_[_0xb6d1('0x44')](_0x38585b['attributes'],function(_0x4ecd54){var _0x3cd780={};_0x3cd780[_0x4ecd54]={'$like':'%'+_0x3a17b1[_0xb6d1('0x23')][_0xb6d1('0x43')]+'%'};return _0x3cd780;})});}_0x38585b=_[_0xb6d1('0x45')]({},_0x38585b,_0x3a17b1['options']);return _0x3d2437[_0xb6d1('0x75')](_0x38585b);}})[_0xb6d1('0x17')](function(_0x2026c7){if(_0x2026c7){_0x523b7a=_0x2026c7[_0xb6d1('0x3f')];if(!_0x3a17b1['query']['hasOwnProperty']('nolimit')){_0x38585b[_0xb6d1('0x11')]=qs[_0xb6d1('0x11')](_0x3a17b1['query'][_0xb6d1('0x11')]);_0x38585b[_0xb6d1('0x13')]=qs[_0xb6d1('0x13')](_0x3a17b1[_0xb6d1('0x23')]['offset']);}return _0x3d2437[_0xb6d1('0x75')](_0x38585b);}})['then'](function(_0x2f7828){if(_0x2f7828){return _0x2f7828?{'count':_0x523b7a,'rows':_0x2f7828}:null;}})['then'](respondWithResult(_0x49d055,null))[_0xb6d1('0x26')](handleError(_0x49d055,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 83e10b8..e44fbf9 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 _0xb08a=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x3319f6,_0x2cbaac){var _0x1dcba6=function(_0x54a395){while(--_0x54a395){_0x3319f6['push'](_0x3319f6['shift']());}};_0x1dcba6(++_0x2cbaac);}(_0xb08a,0x1c9));var _0xab08=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0xb08a[_0x35b195];return _0x2433bf;};'use strict';var EventEmitter=require(_0xab08('0x0'));var OpenchannelQueue=require(_0xab08('0x1'))['db'][_0xab08('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xab08('0x3')](0x0);var events={'afterCreate':_0xab08('0x4'),'afterUpdate':_0xab08('0x5'),'afterDestroy':_0xab08('0x6')};function emitEvent(_0x1bc286){return function(_0x3b8922,_0x432e6c,_0x456645){OpenchannelQueueEvents[_0xab08('0x7')](_0x1bc286+':'+_0x3b8922['id'],_0x3b8922);OpenchannelQueueEvents[_0xab08('0x7')](_0x1bc286,_0x3b8922);_0x456645(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xab08('0x8')](e,emitEvent(event));}}module[_0xab08('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1646=['hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x1646,0xbf));var _0x6164=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x1646[_0x810e4d];return _0x13f01c;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x6164('0x0'))['db'][_0x6164('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6164('0x2')](0x0);var events={'afterCreate':_0x6164('0x3'),'afterUpdate':_0x6164('0x4'),'afterDestroy':_0x6164('0x5')};function emitEvent(_0x3588c8){return function(_0x167106,_0x510155,_0x57fc84){OpenchannelQueueEvents['emit'](_0x3588c8+':'+_0x167106['id'],_0x167106);OpenchannelQueueEvents[_0x6164('0x6')](_0x3588c8,_0x167106);_0x57fc84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x6164('0x7')](e,emitEvent(event));}}module[_0x6164('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3e39f88..1b27362 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 _0xdc7e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','api'];(function(_0x132658,_0x18ef9e){var _0x236171=function(_0x3fffa4){while(--_0x3fffa4){_0x132658['push'](_0x132658['shift']());}};_0x236171(++_0x18ef9e);}(_0xdc7e,0x1cc));var _0xedc7=function(_0x569096,_0x5e91d9){_0x569096=_0x569096-0x0;var _0x318812=_0xdc7e[_0x569096];return _0x318812;};'use strict';var _=require(_0xedc7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xedc7('0x1'));var moment=require(_0xedc7('0x2'));var BPromise=require(_0xedc7('0x3'));var rp=require(_0xedc7('0x4'));var fs=require('fs');var path=require(_0xedc7('0x5'));var rimraf=require(_0xedc7('0x6'));var config=require(_0xedc7('0x7'));var attributes=require(_0xedc7('0x8'));module['exports']=function(_0x4e24cd,_0x24705a){return _0x4e24cd[_0xedc7('0x9')](_0xedc7('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8710=['define','OpenchannelQueue','openchannel_queues','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x467428,_0x44244a){var _0x2161f1=function(_0x4e659b){while(--_0x4e659b){_0x467428['push'](_0x467428['shift']());}};_0x2161f1(++_0x44244a);}(_0x8710,0xb7));var _0x0871=function(_0x7e7be7,_0x56add5){_0x7e7be7=_0x7e7be7-0x0;var _0x26d010=_0x8710[_0x7e7be7];return _0x26d010;};'use strict';var _=require(_0x0871('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0871('0x1'));var moment=require(_0x0871('0x2'));var BPromise=require(_0x0871('0x3'));var rp=require(_0x0871('0x4'));var fs=require('fs');var path=require(_0x0871('0x5'));var rimraf=require('rimraf');var config=require(_0x0871('0x6'));var attributes=require(_0x0871('0x7'));module[_0x0871('0x8')]=function(_0x469450,_0x46e0d9){return _0x469450[_0x0871('0x9')](_0x0871('0xa'),attributes,{'tableName':_0x0871('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 1b2a208..dfd8627 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 _0xf6ee=['where','attributes','limit','map','model','include','info','ShowOpenchannelQueue','OpenchannelQueue','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','findAll','options'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xf6ee,0xd4));var _0xef6e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef6e('0x0'));var util=require(_0xef6e('0x1'));var moment=require(_0xef6e('0x2'));var BPromise=require(_0xef6e('0x3'));var rs=require(_0xef6e('0x4'));var fs=require('fs');var Redis=require(_0xef6e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef6e('0x6'));var logger=require('../../config/logger')(_0xef6e('0x7'));var config=require(_0xef6e('0x8'));var jayson=require(_0xef6e('0x9'));var client=jayson['client'][_0xef6e('0xa')]({'port':0x232a});config[_0xef6e('0xb')]=_[_0xef6e('0xc')](config[_0xef6e('0xb')],{'host':_0xef6e('0xd'),'port':0x18eb});var socket=require(_0xef6e('0xe'))(new Redis(config['redis']));require(_0xef6e('0xf'))['register'](socket);function respondWithRpcPromise(_0x5686db,_0x354785,_0x291009){return new BPromise(function(_0x118b27,_0x5695ad){return client[_0xef6e('0x10')](_0x5686db,_0x291009)['then'](function(_0x566b0d){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x354785,_0xef6e('0x11'));logger[_0xef6e('0x12')](_0xef6e('0x13'),_0x354785,_0xef6e('0x11'),JSON[_0xef6e('0x14')](_0x566b0d));if(_0x566b0d[_0xef6e('0x15')]){if(_0x566b0d[_0xef6e('0x15')]['code']===0x1f4){logger['error'](_0xef6e('0x16'),_0x354785,_0x566b0d[_0xef6e('0x15')][_0xef6e('0x17')]);return _0x5695ad(_0x566b0d[_0xef6e('0x15')]['message']);}logger[_0xef6e('0x15')](_0xef6e('0x16'),_0x354785,_0x566b0d[_0xef6e('0x15')][_0xef6e('0x17')]);return _0x118b27(_0x566b0d['error'][_0xef6e('0x17')]);}else{logger['info'](_0xef6e('0x16'),_0x354785,_0xef6e('0x11'));_0x118b27(_0x566b0d[_0xef6e('0x18')]['message']);}})['catch'](function(_0x341e10){logger['error'](_0xef6e('0x16'),_0x354785,_0x341e10);_0x5695ad(_0x341e10);});});}exports[_0xef6e('0x19')]=function(_0x48a10c){var _0x1f20e1=this;return new Promise(function(_0x2db8de,_0x350aa1){return db['OpenchannelQueue'][_0xef6e('0x1a')]({'raw':_0x48a10c[_0xef6e('0x1b')]?_0x48a10c[_0xef6e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x48a10c[_0xef6e('0x1b')]?_0x48a10c['options'][_0xef6e('0x1c')]||null:null,'attributes':_0x48a10c['options']?_0x48a10c['options'][_0xef6e('0x1d')]||null:null,'limit':_0x48a10c[_0xef6e('0x1b')]?_0x48a10c[_0xef6e('0x1b')][_0xef6e('0x1e')]||null:null,'include':_0x48a10c[_0xef6e('0x1b')]?_0x48a10c['options']['include']?_[_0xef6e('0x1f')](_0x48a10c['options']['include'],function(_0x51e15f){return{'model':db[_0x51e15f[_0xef6e('0x20')]],'as':_0x51e15f['as'],'attributes':_0x51e15f['attributes'],'include':_0x51e15f[_0xef6e('0x21')]?_['map'](_0x51e15f['include'],function(_0x4d9fec){return{'model':db[_0x4d9fec[_0xef6e('0x20')]],'as':_0x4d9fec['as'],'attributes':_0x4d9fec[_0xef6e('0x1d')],'include':_0x4d9fec[_0xef6e('0x21')]?_[_0xef6e('0x1f')](_0x4d9fec[_0xef6e('0x21')],function(_0x255ab1){return{'model':db[_0x255ab1['model']],'as':_0x255ab1['as'],'attributes':_0x255ab1[_0xef6e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20540d){logger[_0xef6e('0x22')](_0xef6e('0x19'),_0x48a10c);logger[_0xef6e('0x12')](_0xef6e('0x19'),_0x48a10c,JSON[_0xef6e('0x14')](_0x20540d));_0x2db8de(_0x20540d);})['catch'](function(_0x33bd68){logger[_0xef6e('0x15')](_0xef6e('0x19'),_0x33bd68[_0xef6e('0x17')],_0x48a10c);_0x350aa1(_0x1f20e1[_0xef6e('0x15')](0x1f4,_0x33bd68[_0xef6e('0x17')]));});});};exports[_0xef6e('0x23')]=function(_0x575e91){var _0x151b99=this;return new Promise(function(_0x3810a0,_0x533a48){return db[_0xef6e('0x24')]['find']({'raw':_0x575e91[_0xef6e('0x1b')]?_0x575e91[_0xef6e('0x1b')][_0xef6e('0x25')]===undefined?!![]:![]:!![],'where':_0x575e91['options']?_0x575e91[_0xef6e('0x1b')][_0xef6e('0x1c')]||null:null,'attributes':_0x575e91[_0xef6e('0x1b')]?_0x575e91[_0xef6e('0x1b')][_0xef6e('0x1d')]||null:null,'include':_0x575e91['options']?_0x575e91[_0xef6e('0x1b')]['include']?_['map'](_0x575e91[_0xef6e('0x1b')]['include'],function(_0x4154ce){return{'model':db[_0x4154ce[_0xef6e('0x20')]],'as':_0x4154ce['as'],'attributes':_0x4154ce[_0xef6e('0x1d')],'include':_0x4154ce['include']?_[_0xef6e('0x1f')](_0x4154ce['include'],function(_0x528ae4){return{'model':db[_0x528ae4[_0xef6e('0x20')]],'as':_0x528ae4['as'],'attributes':_0x528ae4[_0xef6e('0x1d')],'include':_0x528ae4[_0xef6e('0x21')]?_[_0xef6e('0x1f')](_0x528ae4[_0xef6e('0x21')],function(_0x459028){return{'model':db[_0x459028[_0xef6e('0x20')]],'as':_0x459028['as'],'attributes':_0x459028[_0xef6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xef6e('0x26')](function(_0x102aac){logger[_0xef6e('0x22')]('ShowOpenchannelQueue',_0x575e91);logger[_0xef6e('0x12')]('ShowOpenchannelQueue',_0x575e91,JSON[_0xef6e('0x14')](_0x102aac));_0x3810a0(_0x102aac);})[_0xef6e('0x27')](function(_0x4e7073){logger['error']('ShowOpenchannelQueue',_0x4e7073[_0xef6e('0x17')],_0x575e91);_0x533a48(_0x151b99['error'](0x1f4,_0x4e7073[_0xef6e('0x17')]));});});}; \ No newline at end of file +var _0x5f11=['code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','where','attributes','limit','include','model','map','ShowOpenchannelQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x479988,_0x17b763){var _0x17610c=function(_0x1dc420){while(--_0x1dc420){_0x479988['push'](_0x479988['shift']());}};_0x17610c(++_0x17b763);}(_0x5f11,0x148));var _0x15f1=function(_0x1bed21,_0x3c99e6){_0x1bed21=_0x1bed21-0x0;var _0x15b634=_0x5f11[_0x1bed21];return _0x15b634;};'use strict';var _=require(_0x15f1('0x0'));var util=require(_0x15f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15f1('0x2'));var fs=require('fs');var Redis=require(_0x15f1('0x3'));var db=require(_0x15f1('0x4'))['db'];var utils=require(_0x15f1('0x5'));var logger=require(_0x15f1('0x6'))(_0x15f1('0x7'));var config=require(_0x15f1('0x8'));var jayson=require(_0x15f1('0x9'));var client=jayson[_0x15f1('0xa')][_0x15f1('0xb')]({'port':0x232a});config[_0x15f1('0xc')]=_[_0x15f1('0xd')](config[_0x15f1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x15f1('0xe'))(new Redis(config[_0x15f1('0xc')]));require(_0x15f1('0xf'))[_0x15f1('0x10')](socket);function respondWithRpcPromise(_0x4a1762,_0x13195c,_0x49eddc){return new BPromise(function(_0x5eadfa,_0x1fb52b){return client['request'](_0x4a1762,_0x49eddc)[_0x15f1('0x11')](function(_0x438348){logger[_0x15f1('0x12')](_0x15f1('0x13'),_0x13195c,_0x15f1('0x14'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x13195c,'request\x20sent',JSON[_0x15f1('0x15')](_0x438348));if(_0x438348[_0x15f1('0x16')]){if(_0x438348['error'][_0x15f1('0x17')]===0x1f4){logger[_0x15f1('0x16')](_0x15f1('0x13'),_0x13195c,_0x438348['error'][_0x15f1('0x18')]);return _0x1fb52b(_0x438348['error'][_0x15f1('0x18')]);}logger[_0x15f1('0x16')](_0x15f1('0x13'),_0x13195c,_0x438348[_0x15f1('0x16')][_0x15f1('0x18')]);return _0x5eadfa(_0x438348[_0x15f1('0x16')][_0x15f1('0x18')]);}else{logger[_0x15f1('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x13195c,'request\x20sent');_0x5eadfa(_0x438348[_0x15f1('0x19')][_0x15f1('0x18')]);}})[_0x15f1('0x1a')](function(_0x345987){logger[_0x15f1('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x13195c,_0x345987);_0x1fb52b(_0x345987);});});}exports[_0x15f1('0x1b')]=function(_0x50578c){var _0x53e2a5=this;return new Promise(function(_0x1687b9,_0x2e778b){return db[_0x15f1('0x1c')][_0x15f1('0x1d')]({'raw':_0x50578c['options']?_0x50578c['options'][_0x15f1('0x1e')]===undefined?!![]:![]:!![],'where':_0x50578c[_0x15f1('0x1f')]?_0x50578c['options'][_0x15f1('0x20')]||null:null,'attributes':_0x50578c[_0x15f1('0x1f')]?_0x50578c[_0x15f1('0x1f')][_0x15f1('0x21')]||null:null,'limit':_0x50578c[_0x15f1('0x1f')]?_0x50578c[_0x15f1('0x1f')][_0x15f1('0x22')]||null:null,'include':_0x50578c[_0x15f1('0x1f')]?_0x50578c['options'][_0x15f1('0x23')]?_['map'](_0x50578c['options'][_0x15f1('0x23')],function(_0x34a79d){return{'model':db[_0x34a79d[_0x15f1('0x24')]],'as':_0x34a79d['as'],'attributes':_0x34a79d[_0x15f1('0x21')],'include':_0x34a79d[_0x15f1('0x23')]?_[_0x15f1('0x25')](_0x34a79d[_0x15f1('0x23')],function(_0x48086b){return{'model':db[_0x48086b[_0x15f1('0x24')]],'as':_0x48086b['as'],'attributes':_0x48086b[_0x15f1('0x21')],'include':_0x48086b[_0x15f1('0x23')]?_[_0x15f1('0x25')](_0x48086b[_0x15f1('0x23')],function(_0x5a28a5){return{'model':db[_0x5a28a5[_0x15f1('0x24')]],'as':_0x5a28a5['as'],'attributes':_0x5a28a5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x590516){logger[_0x15f1('0x12')]('GetOpenchannelQueue',_0x50578c);logger['debug']('GetOpenchannelQueue',_0x50578c,JSON[_0x15f1('0x15')](_0x590516));_0x1687b9(_0x590516);})[_0x15f1('0x1a')](function(_0x73d97a){logger['error'](_0x15f1('0x1b'),_0x73d97a[_0x15f1('0x18')],_0x50578c);_0x2e778b(_0x53e2a5[_0x15f1('0x16')](0x1f4,_0x73d97a['message']));});});};exports[_0x15f1('0x26')]=function(_0x5993eb){var _0xf48be8=this;return new Promise(function(_0x51d0df,_0x1e1400){return db['OpenchannelQueue']['find']({'raw':_0x5993eb[_0x15f1('0x1f')]?_0x5993eb[_0x15f1('0x1f')][_0x15f1('0x1e')]===undefined?!![]:![]:!![],'where':_0x5993eb[_0x15f1('0x1f')]?_0x5993eb[_0x15f1('0x1f')][_0x15f1('0x20')]||null:null,'attributes':_0x5993eb[_0x15f1('0x1f')]?_0x5993eb[_0x15f1('0x1f')]['attributes']||null:null,'include':_0x5993eb['options']?_0x5993eb[_0x15f1('0x1f')][_0x15f1('0x23')]?_[_0x15f1('0x25')](_0x5993eb[_0x15f1('0x1f')][_0x15f1('0x23')],function(_0x3b85dc){return{'model':db[_0x3b85dc[_0x15f1('0x24')]],'as':_0x3b85dc['as'],'attributes':_0x3b85dc[_0x15f1('0x21')],'include':_0x3b85dc[_0x15f1('0x23')]?_[_0x15f1('0x25')](_0x3b85dc[_0x15f1('0x23')],function(_0x13cc30){return{'model':db[_0x13cc30[_0x15f1('0x24')]],'as':_0x13cc30['as'],'attributes':_0x13cc30[_0x15f1('0x21')],'include':_0x13cc30[_0x15f1('0x23')]?_[_0x15f1('0x25')](_0x13cc30['include'],function(_0x128458){return{'model':db[_0x128458[_0x15f1('0x24')]],'as':_0x128458['as'],'attributes':_0x128458[_0x15f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x15f1('0x11')](function(_0xc778c2){logger[_0x15f1('0x12')]('ShowOpenchannelQueue',_0x5993eb);logger['debug'](_0x15f1('0x26'),_0x5993eb,JSON[_0x15f1('0x15')](_0xc778c2));_0x51d0df(_0xc778c2);})[_0x15f1('0x1a')](function(_0x4fd40f){logger[_0x15f1('0x16')](_0x15f1('0x26'),_0x4fd40f[_0x15f1('0x18')],_0x5993eb);_0x1e1400(_0xf48be8[_0x15f1('0x16')](0x1f4,_0x4fd40f[_0x15f1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f194638..1c76a45 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 _0xd7ed=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd7ed,0x101));var _0xdd7e=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xd7ed[_0x31a371];return _0x2a5bd6;};'use strict';var OpenchannelQueueEvents=require(_0xdd7e('0x0'));var events=[_0xdd7e('0x1'),_0xdd7e('0x2'),_0xdd7e('0x3')];function createListener(_0x446884,_0x16d9aa){return function(_0x197385){_0x16d9aa[_0xdd7e('0x4')](_0x446884,_0x197385);};}function removeListener(_0x249bba,_0x324610){return function(){OpenchannelQueueEvents[_0xdd7e('0x5')](_0x249bba,_0x324610);};}exports[_0xdd7e('0x6')]=function(_0x4841ca){for(var _0x3591e9=0x0,_0x527846=events[_0xdd7e('0x7')];_0x3591e9<_0x527846;_0x3591e9++){var _0x3b2351=events[_0x3591e9];var _0x3814a8=createListener(_0xdd7e('0x8')+_0x3b2351,_0x4841ca);OpenchannelQueueEvents['on'](_0x3b2351,_0x3814a8);}}; \ No newline at end of file +var _0xf42b=['emit','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0x478903,_0x22c9f2){var _0x980261=function(_0x590929){while(--_0x590929){_0x478903['push'](_0x478903['shift']());}};_0x980261(++_0x22c9f2);}(_0xf42b,0x100));var _0xbf42=function(_0x233c10,_0x2d6f00){_0x233c10=_0x233c10-0x0;var _0x1cf76a=_0xf42b[_0x233c10];return _0x1cf76a;};'use strict';var OpenchannelQueueEvents=require(_0xbf42('0x0'));var events=[_0xbf42('0x1'),_0xbf42('0x2'),'update'];function createListener(_0x580af0,_0x954b11){return function(_0x227e50){_0x954b11[_0xbf42('0x3')](_0x580af0,_0x227e50);};}function removeListener(_0x1e634d,_0x1c722e){return function(){OpenchannelQueueEvents[_0xbf42('0x4')](_0x1e634d,_0x1c722e);};}exports[_0xbf42('0x5')]=function(_0x8fe36e){for(var _0x20b819=0x0,_0x48c557=events[_0xbf42('0x6')];_0x20b819<_0x48c557;_0x20b819++){var _0x1cd457=events[_0x20b819];var _0x21cf87=createListener('openchannelQueue:'+_0x1cd457,_0x8fe36e);OpenchannelQueueEvents['on'](_0x1cd457,_0x21cf87);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9f5fcb3..fb4725a 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 _0x3f53=['create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x500708,_0x2aeb20){var _0x4635ae=function(_0x1cbf4d){while(--_0x1cbf4d){_0x500708['push'](_0x500708['shift']());}};_0x4635ae(++_0x2aeb20);}(_0x3f53,0xcc));var _0x33f5=function(_0x9d7a86,_0x29528c){_0x9d7a86=_0x9d7a86-0x0;var _0x33ccb8=_0x3f53[_0x9d7a86];return _0x33ccb8;};'use strict';var multer=require(_0x33f5('0x0'));var util=require(_0x33f5('0x1'));var path=require(_0x33f5('0x2'));var timeout=require(_0x33f5('0x3'));var express=require(_0x33f5('0x4'));var router=express[_0x33f5('0x5')]();var fs_extra=require(_0x33f5('0x6'));var auth=require(_0x33f5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x33f5('0x8'));var controller=require(_0x33f5('0x9'));router[_0x33f5('0xa')]('/',auth[_0x33f5('0xb')](),controller[_0x33f5('0xc')]);router[_0x33f5('0xa')]('/describe',auth[_0x33f5('0xb')](),controller[_0x33f5('0xd')]);router['get']('/:id',auth[_0x33f5('0xb')](),controller[_0x33f5('0xe')]);router[_0x33f5('0xf')]('/',auth[_0x33f5('0xb')](),controller[_0x33f5('0x10')]);router[_0x33f5('0x11')](_0x33f5('0x12'),auth[_0x33f5('0xb')](),controller['update']);router[_0x33f5('0x13')](_0x33f5('0x12'),auth['isAuthenticated'](),controller[_0x33f5('0x14')]);module[_0x33f5('0x15')]=router; \ No newline at end of file +var _0x4ebf=['Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x50b311,_0x10733a){var _0x1054d8=function(_0x2e52a9){while(--_0x2e52a9){_0x50b311['push'](_0x50b311['shift']());}};_0x1054d8(++_0x10733a);}(_0x4ebf,0xf3));var _0xf4eb=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x4ebf[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0xf4eb('0x0'));var util=require(_0xf4eb('0x1'));var path=require(_0xf4eb('0x2'));var timeout=require(_0xf4eb('0x3'));var express=require('express');var router=express[_0xf4eb('0x4')]();var fs_extra=require(_0xf4eb('0x5'));var auth=require(_0xf4eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf4eb('0x7'));router['get']('/',auth[_0xf4eb('0x8')](),controller[_0xf4eb('0x9')]);router[_0xf4eb('0xa')](_0xf4eb('0xb'),auth[_0xf4eb('0x8')](),controller[_0xf4eb('0xc')]);router[_0xf4eb('0xa')]('/:id',auth[_0xf4eb('0x8')](),controller['show']);router['post']('/',auth[_0xf4eb('0x8')](),controller[_0xf4eb('0xd')]);router[_0xf4eb('0xe')]('/:id',auth[_0xf4eb('0x8')](),controller['update']);router[_0xf4eb('0xf')](_0xf4eb('0x10'),auth[_0xf4eb('0x8')](),controller[_0xf4eb('0x11')]);module[_0xf4eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0350dc5..da4d54d 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 _0x0666=['exports','STRING','DATE','moment','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0666,0x1ca));var _0x6066=function(_0xf64500,_0x410815){_0xf64500=_0xf64500-0x0;var _0x58a6e0=_0x0666[_0xf64500];return _0x58a6e0;};'use strict';var moment=require(_0x6066('0x0'));var Sequelize=require(_0x6066('0x1'));module[_0x6066('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6066('0x3')]},'joinAt':{'type':Sequelize[_0x6066('0x4')]},'leaveAt':{'type':Sequelize[_0x6066('0x4')]},'acceptAt':{'type':Sequelize[_0x6066('0x4')]},'exitAt':{'type':Sequelize[_0x6066('0x4')]},'reason':{'type':Sequelize[_0x6066('0x3')]}}; \ No newline at end of file +var _0xbcfe=['moment','exports','STRING','DATE'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbcfe,0x128));var _0xebcf=function(_0x35b4ef,_0x284aef){_0x35b4ef=_0x35b4ef-0x0;var _0x5000c1=_0xbcfe[_0x35b4ef];return _0x5000c1;};'use strict';var moment=require(_0xebcf('0x0'));var Sequelize=require('sequelize');module[_0xebcf('0x1')]={'uniqueid':{'type':Sequelize[_0xebcf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xebcf('0x2')]},'joinAt':{'type':Sequelize[_0xebcf('0x3')]},'leaveAt':{'type':Sequelize[_0xebcf('0x3')]},'acceptAt':{'type':Sequelize[_0xebcf('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xebcf('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e8fffe2..bd28abd 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 _0x3aa0=['stack','name','send','index','map','OpenchannelQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','error'];(function(_0x2fc526,_0x257a9c){var _0x5cae3b=function(_0x2148f3){while(--_0x2148f3){_0x2fc526['push'](_0x2fc526['shift']());}};_0x5cae3b(++_0x257a9c);}(_0x3aa0,0x72));var _0x03aa=function(_0x194453,_0x163000){_0x194453=_0x194453-0x0;var _0x4903a0=_0x3aa0[_0x194453];return _0x4903a0;};'use strict';var emlformat=require(_0x03aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03aa('0x1'));var jsonpatch=require(_0x03aa('0x2'));var rp=require(_0x03aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03aa('0x4'));var util=require('util');var path=require('path');var sox=require(_0x03aa('0x5'));var csv=require(_0x03aa('0x6'));var ejs=require(_0x03aa('0x7'));var fs=require('fs');var fs_extra=require(_0x03aa('0x8'));var _=require(_0x03aa('0x9'));var squel=require(_0x03aa('0xa'));var crypto=require('crypto');var jsforce=require(_0x03aa('0xb'));var deskjs=require(_0x03aa('0xc'));var toCsv=require(_0x03aa('0x6'));var querystring=require(_0x03aa('0xd'));var Papa=require(_0x03aa('0xe'));var Redis=require(_0x03aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x03aa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03aa('0x11'));var logger=require(_0x03aa('0x12'))('api');var utils=require(_0x03aa('0x13'));var config=require(_0x03aa('0x14'));var licenseUtil=require(_0x03aa('0x15'));var db=require(_0x03aa('0x16'))['db'];function respondWithStatusCode(_0x41c752,_0x3bdde8){_0x3bdde8=_0x3bdde8||0xcc;return function(_0x4c91da){if(_0x4c91da){return _0x41c752[_0x03aa('0x17')](_0x3bdde8);}return _0x41c752[_0x03aa('0x18')](_0x3bdde8)['end']();};}function respondWithResult(_0x3d9d37,_0x1381e4){_0x1381e4=_0x1381e4||0xc8;return function(_0x37e12a){if(_0x37e12a){return _0x3d9d37[_0x03aa('0x18')](_0x1381e4)['json'](_0x37e12a);}};}function respondWithFilteredResult(_0x4c234d,_0x4c6cba){return function(_0x257d3f){if(_0x257d3f){var _0x598575=typeof _0x4c6cba[_0x03aa('0x19')]===_0x03aa('0x1a')&&typeof _0x4c6cba[_0x03aa('0x1b')]===_0x03aa('0x1a');var _0x236990=_0x257d3f['count'];var _0x1b111f=_0x598575?0x0:_0x4c6cba[_0x03aa('0x19')];var _0x57854a=_0x598575?_0x257d3f['count']:_0x4c6cba[_0x03aa('0x19')]+_0x4c6cba['limit'];var _0x455f48;if(_0x57854a>=_0x236990){_0x57854a=_0x236990;_0x455f48=0xc8;}else{_0x455f48=0xce;}_0x4c234d[_0x03aa('0x18')](_0x455f48);return _0x4c234d['set'](_0x03aa('0x1c'),_0x1b111f+'-'+_0x57854a+'/'+_0x236990)[_0x03aa('0x1d')](_0x257d3f);}return null;};}function patchUpdates(_0x331163){return function(_0x4e91da){try{jsonpatch[_0x03aa('0x1e')](_0x4e91da,_0x331163,!![]);}catch(_0x32c501){return BPromise[_0x03aa('0x1f')](_0x32c501);}return _0x4e91da[_0x03aa('0x20')]();};}function saveUpdates(_0x4284d6,_0x1ed6b1){return function(_0x317ea4){if(_0x317ea4){return _0x317ea4[_0x03aa('0x21')](_0x4284d6)[_0x03aa('0x22')](function(_0x4700b5){return _0x4700b5;});}return null;};}function removeEntity(_0x5e9a00,_0x1636e9){return function(_0x1efc3c){if(_0x1efc3c){return _0x1efc3c[_0x03aa('0x23')]()[_0x03aa('0x22')](function(){_0x5e9a00[_0x03aa('0x18')](0xcc)[_0x03aa('0x24')]();});}};}function handleEntityNotFound(_0x55d34b,_0x7fba17){return function(_0x481f22){if(!_0x481f22){_0x55d34b[_0x03aa('0x17')](0x194);}return _0x481f22;};}function handleError(_0x240c55,_0x5d45d1){_0x5d45d1=_0x5d45d1||0x1f4;return function(_0x4e93a4){logger[_0x03aa('0x25')](_0x4e93a4[_0x03aa('0x26')]);if(_0x4e93a4[_0x03aa('0x27')]){delete _0x4e93a4[_0x03aa('0x27')];}_0x240c55[_0x03aa('0x18')](_0x5d45d1)[_0x03aa('0x28')](_0x4e93a4);};}exports[_0x03aa('0x29')]=function(_0x4d8687,_0x26f3b9){var _0x549345={},_0x1475f5={},_0x47c1ef={'count':0x0,'rows':[]};var _0x2f544a=_[_0x03aa('0x2a')](db[_0x03aa('0x2b')]['rawAttributes'],function(_0x391523){return{'name':_0x391523[_0x03aa('0x2c')],'type':_0x391523['type'][_0x03aa('0x2d')]};});_0x1475f5[_0x03aa('0x2e')]=_['map'](_0x2f544a,_0x03aa('0x27'));_0x1475f5[_0x03aa('0x2f')]=_[_0x03aa('0x30')](_0x4d8687[_0x03aa('0x2f')]);_0x1475f5['filters']=_[_0x03aa('0x31')](_0x1475f5[_0x03aa('0x2e')],_0x1475f5[_0x03aa('0x2f')]);_0x549345[_0x03aa('0x32')]=_[_0x03aa('0x31')](_0x1475f5[_0x03aa('0x2e')],qs[_0x03aa('0x33')](_0x4d8687['query'][_0x03aa('0x33')]));_0x549345['attributes']=_0x549345[_0x03aa('0x32')][_0x03aa('0x34')]?_0x549345[_0x03aa('0x32')]:_0x1475f5[_0x03aa('0x2e')];if(!_0x4d8687[_0x03aa('0x2f')][_0x03aa('0x35')](_0x03aa('0x36'))){_0x549345[_0x03aa('0x1b')]=qs[_0x03aa('0x1b')](_0x4d8687['query']['limit']);_0x549345['offset']=qs[_0x03aa('0x19')](_0x4d8687['query'][_0x03aa('0x19')]);}_0x549345['order']=qs[_0x03aa('0x37')](_0x4d8687[_0x03aa('0x2f')]['sort']);_0x549345[_0x03aa('0x38')]=qs[_0x03aa('0x39')](_[_0x03aa('0x3a')](_0x4d8687[_0x03aa('0x2f')],_0x1475f5[_0x03aa('0x39')]),_0x2f544a);if(_0x4d8687[_0x03aa('0x2f')][_0x03aa('0x3b')]){_0x549345['where']=_[_0x03aa('0x3c')](_0x549345['where'],{'$or':_[_0x03aa('0x2a')](_0x2f544a,function(_0x548fa0){if(_0x548fa0[_0x03aa('0x3d')]!==_0x03aa('0x3e')){var _0x986b20={};_0x986b20[_0x548fa0[_0x03aa('0x27')]]={'$like':'%'+_0x4d8687[_0x03aa('0x2f')]['filter']+'%'};return _0x986b20;}})});}_0x549345=_[_0x03aa('0x3c')]({},_0x549345,_0x4d8687[_0x03aa('0x3f')]);var _0x55c7d6={'where':_0x549345[_0x03aa('0x38')]};return db[_0x03aa('0x2b')][_0x03aa('0x40')](_0x55c7d6)[_0x03aa('0x22')](function(_0x1f7c36){_0x47c1ef[_0x03aa('0x40')]=_0x1f7c36;if(_0x4d8687[_0x03aa('0x2f')]['includeAll']){_0x549345[_0x03aa('0x41')]=[{'all':!![]}];}return db[_0x03aa('0x2b')][_0x03aa('0x42')](_0x549345);})[_0x03aa('0x22')](function(_0x33f50f){_0x47c1ef[_0x03aa('0x43')]=_0x33f50f;return _0x47c1ef;})[_0x03aa('0x22')](respondWithFilteredResult(_0x26f3b9,_0x549345))['catch'](handleError(_0x26f3b9,null));};exports['show']=function(_0x33f062,_0x388021){var _0x978623={'raw':!![],'where':{'id':_0x33f062[_0x03aa('0x44')]['id']}},_0x1bcf55={};_0x1bcf55[_0x03aa('0x2e')]=_[_0x03aa('0x30')](db[_0x03aa('0x2b')][_0x03aa('0x45')]);_0x1bcf55[_0x03aa('0x2f')]=_['keys'](_0x33f062[_0x03aa('0x2f')]);_0x1bcf55['filters']=_[_0x03aa('0x31')](_0x1bcf55['model'],_0x1bcf55[_0x03aa('0x2f')]);_0x978623[_0x03aa('0x32')]=_[_0x03aa('0x31')](_0x1bcf55['model'],qs[_0x03aa('0x33')](_0x33f062[_0x03aa('0x2f')]['fields']));_0x978623['attributes']=_0x978623['attributes'][_0x03aa('0x34')]?_0x978623[_0x03aa('0x32')]:_0x1bcf55[_0x03aa('0x2e')];if(_0x33f062[_0x03aa('0x2f')][_0x03aa('0x46')]){_0x978623[_0x03aa('0x41')]=[{'all':!![]}];}_0x978623=_[_0x03aa('0x3c')]({},_0x978623,_0x33f062[_0x03aa('0x3f')]);return db[_0x03aa('0x2b')][_0x03aa('0x47')](_0x978623)[_0x03aa('0x22')](handleEntityNotFound(_0x388021,null))[_0x03aa('0x22')](respondWithResult(_0x388021,null))[_0x03aa('0x48')](handleError(_0x388021,null));};exports['create']=function(_0x455337,_0x9debd7){return db['OpenchannelQueueReport'][_0x03aa('0x49')](_0x455337['body'],{})['then'](respondWithResult(_0x9debd7,0xc9))[_0x03aa('0x48')](handleError(_0x9debd7,null));};exports['update']=function(_0x4a8e7f,_0x50658a){if(_0x4a8e7f[_0x03aa('0x4a')]['id']){delete _0x4a8e7f[_0x03aa('0x4a')]['id'];}return db[_0x03aa('0x2b')]['find']({'where':{'id':_0x4a8e7f['params']['id']}})['then'](handleEntityNotFound(_0x50658a,null))[_0x03aa('0x22')](saveUpdates(_0x4a8e7f[_0x03aa('0x4a')],null))[_0x03aa('0x22')](respondWithResult(_0x50658a,null))[_0x03aa('0x48')](handleError(_0x50658a,null));};exports[_0x03aa('0x23')]=function(_0x517ca1,_0x313e0a){return db[_0x03aa('0x2b')][_0x03aa('0x47')]({'where':{'id':_0x517ca1[_0x03aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x313e0a,null))[_0x03aa('0x22')](removeEntity(_0x313e0a,null))['catch'](handleError(_0x313e0a,null));};exports[_0x03aa('0x4b')]=function(_0x1adaed,_0x3029c6){return db[_0x03aa('0x2b')][_0x03aa('0x4b')]()['then'](respondWithResult(_0x3029c6,null))[_0x03aa('0x48')](handleError(_0x3029c6,null));}; \ No newline at end of file +var _0x22bd=['zip-dir','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','include','find','create','update','body','params','describe','rimraf'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x22bd,0x162));var _0xd22b=function(_0x42856b,_0x2958b2){_0x42856b=_0x42856b-0x0;var _0x4df3a3=_0x22bd[_0x42856b];return _0x4df3a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd22b('0x0'));var zipdir=require(_0xd22b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd22b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd22b('0x3'));var util=require(_0xd22b('0x4'));var path=require(_0xd22b('0x5'));var sox=require(_0xd22b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd22b('0x7'));var _=require(_0xd22b('0x8'));var squel=require('squel');var crypto=require(_0xd22b('0x9'));var jsforce=require(_0xd22b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd22b('0xb'));var Papa=require('papaparse');var Redis=require(_0xd22b('0xc'));var authService=require(_0xd22b('0xd'));var qs=require(_0xd22b('0xe'));var as=require(_0xd22b('0xf'));var hardwareService=require(_0xd22b('0x10'));var logger=require(_0xd22b('0x11'))('api');var utils=require(_0xd22b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd22b('0x13'))['db'];function respondWithStatusCode(_0x118aec,_0x366f5b){_0x366f5b=_0x366f5b||0xcc;return function(_0x39927b){if(_0x39927b){return _0x118aec[_0xd22b('0x14')](_0x366f5b);}return _0x118aec['status'](_0x366f5b)[_0xd22b('0x15')]();};}function respondWithResult(_0x2f027b,_0x3207ef){_0x3207ef=_0x3207ef||0xc8;return function(_0x1cd747){if(_0x1cd747){return _0x2f027b[_0xd22b('0x16')](_0x3207ef)[_0xd22b('0x17')](_0x1cd747);}};}function respondWithFilteredResult(_0x3107d1,_0x1cee96){return function(_0x4db39f){if(_0x4db39f){var _0x3fd0b5=typeof _0x1cee96[_0xd22b('0x18')]===_0xd22b('0x19')&&typeof _0x1cee96[_0xd22b('0x1a')]===_0xd22b('0x19');var _0x1559a7=_0x4db39f[_0xd22b('0x1b')];var _0x76aebf=_0x3fd0b5?0x0:_0x1cee96[_0xd22b('0x18')];var _0x374f60=_0x3fd0b5?_0x4db39f[_0xd22b('0x1b')]:_0x1cee96['offset']+_0x1cee96[_0xd22b('0x1a')];var _0x287cf3;if(_0x374f60>=_0x1559a7){_0x374f60=_0x1559a7;_0x287cf3=0xc8;}else{_0x287cf3=0xce;}_0x3107d1[_0xd22b('0x16')](_0x287cf3);return _0x3107d1[_0xd22b('0x1c')](_0xd22b('0x1d'),_0x76aebf+'-'+_0x374f60+'/'+_0x1559a7)['json'](_0x4db39f);}return null;};}function patchUpdates(_0xb245ba){return function(_0x458ee1){try{jsonpatch['apply'](_0x458ee1,_0xb245ba,!![]);}catch(_0x9df5ce){return BPromise[_0xd22b('0x1e')](_0x9df5ce);}return _0x458ee1[_0xd22b('0x1f')]();};}function saveUpdates(_0x1b8f8c,_0x14bb47){return function(_0x4730b1){if(_0x4730b1){return _0x4730b1['update'](_0x1b8f8c)[_0xd22b('0x20')](function(_0x4820e2){return _0x4820e2;});}return null;};}function removeEntity(_0x3bb4ce,_0x5eacfa){return function(_0x3a7bb2){if(_0x3a7bb2){return _0x3a7bb2[_0xd22b('0x21')]()['then'](function(){_0x3bb4ce[_0xd22b('0x16')](0xcc)[_0xd22b('0x15')]();});}};}function handleEntityNotFound(_0x5cf576,_0x49fb81){return function(_0x4a7e82){if(!_0x4a7e82){_0x5cf576[_0xd22b('0x14')](0x194);}return _0x4a7e82;};}function handleError(_0xeec65a,_0x2b3a9f){_0x2b3a9f=_0x2b3a9f||0x1f4;return function(_0x472a90){logger[_0xd22b('0x22')](_0x472a90[_0xd22b('0x23')]);if(_0x472a90[_0xd22b('0x24')]){delete _0x472a90['name'];}_0xeec65a[_0xd22b('0x16')](_0x2b3a9f)[_0xd22b('0x25')](_0x472a90);};}exports['index']=function(_0xa0e53,_0x4ef4cd){var _0x4652f2={},_0x16de4d={},_0x10852f={'count':0x0,'rows':[]};var _0x172b8e=_['map'](db[_0xd22b('0x26')][_0xd22b('0x27')],function(_0x3507cf){return{'name':_0x3507cf[_0xd22b('0x28')],'type':_0x3507cf[_0xd22b('0x29')]['key']};});_0x16de4d['model']=_[_0xd22b('0x2a')](_0x172b8e,_0xd22b('0x24'));_0x16de4d[_0xd22b('0x2b')]=_['keys'](_0xa0e53['query']);_0x16de4d[_0xd22b('0x2c')]=_[_0xd22b('0x2d')](_0x16de4d[_0xd22b('0x2e')],_0x16de4d[_0xd22b('0x2b')]);_0x4652f2[_0xd22b('0x2f')]=_['intersection'](_0x16de4d[_0xd22b('0x2e')],qs[_0xd22b('0x30')](_0xa0e53[_0xd22b('0x2b')]['fields']));_0x4652f2[_0xd22b('0x2f')]=_0x4652f2[_0xd22b('0x2f')][_0xd22b('0x31')]?_0x4652f2[_0xd22b('0x2f')]:_0x16de4d[_0xd22b('0x2e')];if(!_0xa0e53[_0xd22b('0x2b')][_0xd22b('0x32')](_0xd22b('0x33'))){_0x4652f2[_0xd22b('0x1a')]=qs[_0xd22b('0x1a')](_0xa0e53['query'][_0xd22b('0x1a')]);_0x4652f2[_0xd22b('0x18')]=qs[_0xd22b('0x18')](_0xa0e53['query'][_0xd22b('0x18')]);}_0x4652f2[_0xd22b('0x34')]=qs[_0xd22b('0x35')](_0xa0e53[_0xd22b('0x2b')][_0xd22b('0x35')]);_0x4652f2[_0xd22b('0x36')]=qs[_0xd22b('0x2c')](_['pick'](_0xa0e53[_0xd22b('0x2b')],_0x16de4d[_0xd22b('0x2c')]),_0x172b8e);if(_0xa0e53[_0xd22b('0x2b')][_0xd22b('0x37')]){_0x4652f2['where']=_[_0xd22b('0x38')](_0x4652f2[_0xd22b('0x36')],{'$or':_[_0xd22b('0x2a')](_0x172b8e,function(_0x4a3392){if(_0x4a3392[_0xd22b('0x29')]!==_0xd22b('0x39')){var _0xd8dff0={};_0xd8dff0[_0x4a3392[_0xd22b('0x24')]]={'$like':'%'+_0xa0e53['query']['filter']+'%'};return _0xd8dff0;}})});}_0x4652f2=_[_0xd22b('0x38')]({},_0x4652f2,_0xa0e53[_0xd22b('0x3a')]);var _0x5ae4ec={'where':_0x4652f2[_0xd22b('0x36')]};return db[_0xd22b('0x26')]['count'](_0x5ae4ec)['then'](function(_0x53ada1){_0x10852f[_0xd22b('0x1b')]=_0x53ada1;if(_0xa0e53['query'][_0xd22b('0x3b')]){_0x4652f2['include']=[{'all':!![]}];}return db[_0xd22b('0x26')]['findAll'](_0x4652f2);})['then'](function(_0x19ef2d){_0x10852f[_0xd22b('0x3c')]=_0x19ef2d;return _0x10852f;})[_0xd22b('0x20')](respondWithFilteredResult(_0x4ef4cd,_0x4652f2))[_0xd22b('0x3d')](handleError(_0x4ef4cd,null));};exports[_0xd22b('0x3e')]=function(_0x1a12f9,_0x28254f){var _0x32f9cc={'raw':!![],'where':{'id':_0x1a12f9['params']['id']}},_0x1feabf={};_0x1feabf[_0xd22b('0x2e')]=_[_0xd22b('0x3f')](db[_0xd22b('0x26')][_0xd22b('0x27')]);_0x1feabf['query']=_[_0xd22b('0x3f')](_0x1a12f9[_0xd22b('0x2b')]);_0x1feabf['filters']=_[_0xd22b('0x2d')](_0x1feabf['model'],_0x1feabf[_0xd22b('0x2b')]);_0x32f9cc[_0xd22b('0x2f')]=_[_0xd22b('0x2d')](_0x1feabf['model'],qs[_0xd22b('0x30')](_0x1a12f9[_0xd22b('0x2b')][_0xd22b('0x30')]));_0x32f9cc[_0xd22b('0x2f')]=_0x32f9cc['attributes'][_0xd22b('0x31')]?_0x32f9cc[_0xd22b('0x2f')]:_0x1feabf['model'];if(_0x1a12f9['query']['includeAll']){_0x32f9cc[_0xd22b('0x40')]=[{'all':!![]}];}_0x32f9cc=_['merge']({},_0x32f9cc,_0x1a12f9['options']);return db[_0xd22b('0x26')][_0xd22b('0x41')](_0x32f9cc)[_0xd22b('0x20')](handleEntityNotFound(_0x28254f,null))[_0xd22b('0x20')](respondWithResult(_0x28254f,null))[_0xd22b('0x3d')](handleError(_0x28254f,null));};exports[_0xd22b('0x42')]=function(_0x225964,_0x101b61){return db[_0xd22b('0x26')]['create'](_0x225964['body'],{})[_0xd22b('0x20')](respondWithResult(_0x101b61,0xc9))[_0xd22b('0x3d')](handleError(_0x101b61,null));};exports[_0xd22b('0x43')]=function(_0x4a6478,_0x32e747){if(_0x4a6478[_0xd22b('0x44')]['id']){delete _0x4a6478[_0xd22b('0x44')]['id'];}return db[_0xd22b('0x26')][_0xd22b('0x41')]({'where':{'id':_0x4a6478[_0xd22b('0x45')]['id']}})['then'](handleEntityNotFound(_0x32e747,null))[_0xd22b('0x20')](saveUpdates(_0x4a6478[_0xd22b('0x44')],null))['then'](respondWithResult(_0x32e747,null))[_0xd22b('0x3d')](handleError(_0x32e747,null));};exports[_0xd22b('0x21')]=function(_0x19559f,_0x108170){return db[_0xd22b('0x26')][_0xd22b('0x41')]({'where':{'id':_0x19559f[_0xd22b('0x45')]['id']}})[_0xd22b('0x20')](handleEntityNotFound(_0x108170,null))['then'](removeEntity(_0x108170,null))[_0xd22b('0x3d')](handleError(_0x108170,null));};exports['describe']=function(_0x189f24,_0x1597ce){return db[_0xd22b('0x26')][_0xd22b('0x46')]()[_0xd22b('0x20')](respondWithResult(_0x1597ce,null))[_0xd22b('0x3d')](handleError(_0x1597ce,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 1a3b60c..266dbc4 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x4be13d,_0x58dd32){var _0x4d4279=function(_0x592aa5){while(--_0x592aa5){_0x4be13d['push'](_0x4be13d['shift']());}};_0x4d4279(++_0x58dd32);}(_0xe14b,0x93));var _0xbe14=function(_0x560a9c,_0x454970){_0x560a9c=_0x560a9c-0x0;var _0x47b4d2=_0xe14b[_0x560a9c];return _0x47b4d2;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'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(_0x58a968,_0x4404de){var _0xd3fb7f=function(_0x202f15){while(--_0x202f15){_0x58a968['push'](_0x58a968['shift']());}};_0xd3fb7f(++_0x4404de);}(_0x5fc3,0xa8));var _0x35fc=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x5fc3[_0x466bc5];return _0x138952;};'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 81832d6..4ab3c31 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 _0x1c7c=['raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options'];(function(_0x2f2601,_0x10b8be){var _0x3c6e6=function(_0x12a171){while(--_0x12a171){_0x2f2601['push'](_0x2f2601['shift']());}};_0x3c6e6(++_0x10b8be);}(_0x1c7c,0x164));var _0xc1c7=function(_0x21b0d5,_0x52eb6f){_0x21b0d5=_0x21b0d5-0x0;var _0x5ad467=_0x1c7c[_0x21b0d5];return _0x5ad467;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419138,_0xce5bcd,_0x3b3e9c){return new BPromise(function(_0x434a35,_0x11c7ef){return client[_0xc1c7('0xc')](_0x419138,_0x3b3e9c)[_0xc1c7('0xd')](function(_0x339649){logger[_0xc1c7('0xe')](_0xc1c7('0xf'),_0xce5bcd,'request\x20sent');logger[_0xc1c7('0x10')](_0xc1c7('0x11'),_0xce5bcd,'request\x20sent',JSON[_0xc1c7('0x12')](_0x339649));if(_0x339649[_0xc1c7('0x13')]){if(_0x339649[_0xc1c7('0x13')]['code']===0x1f4){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x11c7ef(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x434a35(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}else{logger['info'](_0xc1c7('0xf'),_0xce5bcd,_0xc1c7('0x15'));_0x434a35(_0x339649[_0xc1c7('0x16')]['message']);}})[_0xc1c7('0x17')](function(_0x3939c1){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x3939c1);_0x11c7ef(_0x3939c1);});});}exports[_0xc1c7('0x18')]=function(_0xb42702){var _0x21758a=this;return new Promise(function(_0x2e93e5,_0x5d44e9){return db[_0xc1c7('0x19')][_0xc1c7('0x1a')](_0xb42702[_0xc1c7('0x1b')],{'raw':_0xb42702[_0xc1c7('0x1c')]?_0xb42702['options'][_0xc1c7('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5e7e4a){logger[_0xc1c7('0xe')]('CreateOpenchannelQueueReport',_0xb42702);logger['debug'](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x5e7e4a));_0x2e93e5(_0x5e7e4a);})[_0xc1c7('0x17')](function(_0x4c6b34){logger[_0xc1c7('0x13')](_0xc1c7('0x18'),_0x4c6b34[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x4c6b34[_0xc1c7('0x14')]));});});};exports[_0xc1c7('0x1e')]=function(_0x3180fd){var _0x120168=this;return new Promise(function(_0x22b654,_0x1540c1){return db[_0xc1c7('0x19')][_0xc1c7('0x1f')](_0x3180fd[_0xc1c7('0x1b')],{'raw':_0x3180fd[_0xc1c7('0x1c')]?_0x3180fd[_0xc1c7('0x1c')][_0xc1c7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3180fd['options']?_0x3180fd[_0xc1c7('0x1c')][_0xc1c7('0x20')]||null:null,'attributes':_0x3180fd['options']?_0x3180fd['options'][_0xc1c7('0x21')]||null:null,'limit':_0x3180fd['options']?_0x3180fd['options'][_0xc1c7('0x22')]||null:null})[_0xc1c7('0xd')](function(_0x46d045){logger[_0xc1c7('0xe')](_0xc1c7('0x1e'),_0x3180fd);logger['debug']('UpdateOpenchannelQueueReport',_0x3180fd,JSON[_0xc1c7('0x12')](_0x46d045));_0x22b654(_0x46d045);})[_0xc1c7('0x17')](function(_0x9a0ab3){logger[_0xc1c7('0x13')](_0xc1c7('0x1e'),_0x9a0ab3['message'],_0x3180fd);_0x1540c1(_0x120168['error'](0x1f4,_0x9a0ab3[_0xc1c7('0x14')]));});});}; \ No newline at end of file +var _0x4849=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update','raw','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x552cd7,_0x5a8ed5){var _0xed6bfc=function(_0x17158d){while(--_0x17158d){_0x552cd7['push'](_0x552cd7['shift']());}};_0xed6bfc(++_0x5a8ed5);}(_0x4849,0xf8));var _0x9484=function(_0x17dab2,_0x6bf56){_0x17dab2=_0x17dab2-0x0;var _0x333c20=_0x4849[_0x17dab2];return _0x333c20;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});}exports[_0x9484('0x19')]=function(_0xa279e2){var _0x26ec8b=this;return new Promise(function(_0x232694,_0x4b900f){return db[_0x9484('0x1a')][_0x9484('0x1b')](_0xa279e2['body'],{'raw':_0xa279e2[_0x9484('0x1c')]?_0xa279e2[_0x9484('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x9484('0xd')](function(_0x5325e6){logger[_0x9484('0xe')]('CreateOpenchannelQueueReport',_0xa279e2);logger[_0x9484('0x11')](_0x9484('0x19'),_0xa279e2,JSON[_0x9484('0x13')](_0x5325e6));_0x232694(_0x5325e6);})[_0x9484('0x18')](function(_0x5edcf5){logger['error'](_0x9484('0x19'),_0x5edcf5['message'],_0xa279e2);_0x4b900f(_0x26ec8b[_0x9484('0x14')](0x1f4,_0x5edcf5['message']));});});};exports[_0x9484('0x1d')]=function(_0x1edf27){var _0x2e8acd=this;return new Promise(function(_0x5123fa,_0x3831cf){return db[_0x9484('0x1a')][_0x9484('0x1e')](_0x1edf27['body'],{'raw':_0x1edf27['options']?_0x1edf27['options'][_0x9484('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edf27[_0x9484('0x1c')]?_0x1edf27['options'][_0x9484('0x20')]||null:null,'attributes':_0x1edf27[_0x9484('0x1c')]?_0x1edf27[_0x9484('0x1c')]['attributes']||null:null,'limit':_0x1edf27[_0x9484('0x1c')]?_0x1edf27['options'][_0x9484('0x21')]||null:null})[_0x9484('0xd')](function(_0x160f59){logger[_0x9484('0xe')]('UpdateOpenchannelQueueReport',_0x1edf27);logger['debug'](_0x9484('0x1d'),_0x1edf27,JSON[_0x9484('0x13')](_0x160f59));_0x5123fa(_0x160f59);})['catch'](function(_0x868d7f){logger[_0x9484('0x14')](_0x9484('0x1d'),_0x868d7f[_0x9484('0x16')],_0x1edf27);_0x3831cf(_0x2e8acd[_0x9484('0x14')](0x1f4,_0x868d7f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 454ebe1..1fd8292 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 _0xbbcf=['./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1c5e4a,_0x1ecf5f){var _0x3b336c=function(_0x32c696){while(--_0x32c696){_0x1c5e4a['push'](_0x1c5e4a['shift']());}};_0x3b336c(++_0x1ecf5f);}(_0xbbcf,0x71));var _0xfbbc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbbcf[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0xfbbc('0x0'));var path=require(_0xfbbc('0x1'));var timeout=require(_0xfbbc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfbbc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfbbc('0x4'));var config=require(_0xfbbc('0x5'));var controller=require(_0xfbbc('0x6'));router[_0xfbbc('0x7')]('/',auth['isAuthenticated'](),controller[_0xfbbc('0x8')]);router[_0xfbbc('0x7')](_0xfbbc('0x9'),auth[_0xfbbc('0xa')](),controller['describe']);router[_0xfbbc('0x7')]('/:id',auth[_0xfbbc('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfbbc('0xb')]('/:id',auth[_0xfbbc('0xa')](),controller[_0xfbbc('0xc')]);router[_0xfbbc('0xd')](_0xfbbc('0xe'),auth[_0xfbbc('0xa')](),controller[_0xfbbc('0xf')]);module[_0xfbbc('0x10')]=router; \ No newline at end of file +var _0xfd5a=['delete','destroy','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x1b5f18,_0x410ff3){var _0x3e5944=function(_0x3e653a){while(--_0x3e653a){_0x1b5f18['push'](_0x1b5f18['shift']());}};_0x3e5944(++_0x410ff3);}(_0xfd5a,0x133));var _0xafd5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xfd5a[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0xafd5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xafd5('0x1'));var auth=require(_0xafd5('0x2'));var interaction=require(_0xafd5('0x3'));var config=require('../../config/environment');var controller=require(_0xafd5('0x4'));router[_0xafd5('0x5')]('/',auth[_0xafd5('0x6')](),controller['index']);router[_0xafd5('0x5')]('/describe',auth[_0xafd5('0x6')](),controller[_0xafd5('0x7')]);router['get'](_0xafd5('0x8'),auth[_0xafd5('0x6')](),controller[_0xafd5('0x9')]);router[_0xafd5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xafd5('0xb')](_0xafd5('0x8'),auth[_0xafd5('0x6')](),controller[_0xafd5('0xc')]);router[_0xafd5('0xd')]('/:id',auth[_0xafd5('0x6')](),controller[_0xafd5('0xe')]);module[_0xafd5('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0bb1bcd..233b4d0 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xb833f6,_0x472175){var _0x3e98a5=function(_0x735659){while(--_0x735659){_0xb833f6['push'](_0xb833f6['shift']());}};_0x3e98a5(++_0x472175);}(_0x70e0,0x17b));var _0x070e=function(_0x49de10,_0x891ecd){_0x49de10=_0x49de10-0x0;var _0x55f9f5=_0x70e0[_0x49de10];return _0x55f9f5;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x489618,_0x233987){var _0x3d34b8=function(_0xe4ffd0){while(--_0xe4ffd0){_0x489618['push'](_0x489618['shift']());}};_0x3d34b8(++_0x233987);}(_0x34e8,0x12c));var _0x834e=function(_0x5c5d2f,_0x363f15){_0x5c5d2f=_0x5c5d2f-0x0;var _0x18d69d=_0x34e8[_0x5c5d2f];return _0x18d69d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index becef2e..9375d78 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 _0x44ed=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','show','keys','options','find','catch','create','body'];(function(_0x3739ab,_0xb7ad04){var _0x558cec=function(_0x320ed9){while(--_0x320ed9){_0x3739ab['push'](_0x3739ab['shift']());}};_0x558cec(++_0xb7ad04);}(_0x44ed,0x183));var _0xd44e=function(_0x46848e,_0xe1b792){_0x46848e=_0x46848e-0x0;var _0x3fcfcb=_0x44ed[_0x46848e];return _0x3fcfcb;};'use strict';var emlformat=require(_0xd44e('0x0'));var rimraf=require(_0xd44e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd44e('0x2'));var rp=require(_0xd44e('0x3'));var moment=require(_0xd44e('0x4'));var BPromise=require(_0xd44e('0x5'));var Mustache=require('mustache');var util=require(_0xd44e('0x6'));var path=require(_0xd44e('0x7'));var sox=require(_0xd44e('0x8'));var csv=require(_0xd44e('0x9'));var ejs=require(_0xd44e('0xa'));var fs=require('fs');var fs_extra=require(_0xd44e('0xb'));var _=require(_0xd44e('0xc'));var squel=require(_0xd44e('0xd'));var crypto=require(_0xd44e('0xe'));var jsforce=require(_0xd44e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd44e('0x9'));var querystring=require('querystring');var Papa=require(_0xd44e('0x10'));var Redis=require('ioredis');var authService=require(_0xd44e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd44e('0x12'));var hardwareService=require(_0xd44e('0x13'));var logger=require(_0xd44e('0x14'))(_0xd44e('0x15'));var utils=require('../../config/utils');var config=require(_0xd44e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd44e('0x17'))['db'];function respondWithStatusCode(_0x1dc98f,_0x4c781b){_0x4c781b=_0x4c781b||0xcc;return function(_0x5a3ff7){if(_0x5a3ff7){return _0x1dc98f['sendStatus'](_0x4c781b);}return _0x1dc98f['status'](_0x4c781b)[_0xd44e('0x18')]();};}function respondWithResult(_0x31324f,_0x535fee){_0x535fee=_0x535fee||0xc8;return function(_0x2fafbb){if(_0x2fafbb){return _0x31324f[_0xd44e('0x19')](_0x535fee)[_0xd44e('0x1a')](_0x2fafbb);}};}function respondWithFilteredResult(_0xf1b708,_0x4fc83e){return function(_0x1b7bc9){if(_0x1b7bc9){var _0x1b1aaf=typeof _0x4fc83e[_0xd44e('0x1b')]===_0xd44e('0x1c')&&typeof _0x4fc83e[_0xd44e('0x1d')]==='undefined';var _0x2efa79=_0x1b7bc9[_0xd44e('0x1e')];var _0x5ab81=_0x1b1aaf?0x0:_0x4fc83e[_0xd44e('0x1b')];var _0x2db393=_0x1b1aaf?_0x1b7bc9['count']:_0x4fc83e[_0xd44e('0x1b')]+_0x4fc83e[_0xd44e('0x1d')];var _0x25eaf3;if(_0x2db393>=_0x2efa79){_0x2db393=_0x2efa79;_0x25eaf3=0xc8;}else{_0x25eaf3=0xce;}_0xf1b708[_0xd44e('0x19')](_0x25eaf3);return _0xf1b708[_0xd44e('0x1f')](_0xd44e('0x20'),_0x5ab81+'-'+_0x2db393+'/'+_0x2efa79)[_0xd44e('0x1a')](_0x1b7bc9);}return null;};}function patchUpdates(_0xbc4b01){return function(_0x642dc8){try{jsonpatch[_0xd44e('0x21')](_0x642dc8,_0xbc4b01,!![]);}catch(_0x40b3e3){return BPromise[_0xd44e('0x22')](_0x40b3e3);}return _0x642dc8[_0xd44e('0x23')]();};}function saveUpdates(_0x2b8b8a,_0x36dc6a){return function(_0x13c5f3){if(_0x13c5f3){return _0x13c5f3[_0xd44e('0x24')](_0x2b8b8a)[_0xd44e('0x25')](function(_0x2fac4e){return _0x2fac4e;});}return null;};}function removeEntity(_0x4db773,_0x334944){return function(_0x89fbf1){if(_0x89fbf1){return _0x89fbf1[_0xd44e('0x26')]()[_0xd44e('0x25')](function(){_0x4db773[_0xd44e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45dec8,_0x26eaa2){return function(_0x5bc1ee){if(!_0x5bc1ee){_0x45dec8[_0xd44e('0x27')](0x194);}return _0x5bc1ee;};}function handleError(_0x4259ef,_0x25f6b3){_0x25f6b3=_0x25f6b3||0x1f4;return function(_0x491968){logger['error'](_0x491968[_0xd44e('0x28')]);if(_0x491968[_0xd44e('0x29')]){delete _0x491968[_0xd44e('0x29')];}_0x4259ef[_0xd44e('0x19')](_0x25f6b3)[_0xd44e('0x2a')](_0x491968);};}exports[_0xd44e('0x2b')]=function(_0x2d18be,_0x1c3672){var _0x1ad02f={},_0x5b8249={},_0x1fcf44={'count':0x0,'rows':[]};var _0x3ee335=_['map'](db[_0xd44e('0x2c')][_0xd44e('0x2d')],function(_0x584711){return{'name':_0x584711[_0xd44e('0x2e')],'type':_0x584711[_0xd44e('0x2f')][_0xd44e('0x30')]};});_0x5b8249['model']=_[_0xd44e('0x31')](_0x3ee335,'name');_0x5b8249[_0xd44e('0x32')]=_['keys'](_0x2d18be['query']);_0x5b8249[_0xd44e('0x33')]=_[_0xd44e('0x34')](_0x5b8249[_0xd44e('0x35')],_0x5b8249[_0xd44e('0x32')]);_0x1ad02f[_0xd44e('0x36')]=_['intersection'](_0x5b8249[_0xd44e('0x35')],qs['fields'](_0x2d18be[_0xd44e('0x32')][_0xd44e('0x37')]));_0x1ad02f[_0xd44e('0x36')]=_0x1ad02f[_0xd44e('0x36')][_0xd44e('0x38')]?_0x1ad02f[_0xd44e('0x36')]:_0x5b8249[_0xd44e('0x35')];if(!_0x2d18be['query'][_0xd44e('0x39')](_0xd44e('0x3a'))){_0x1ad02f[_0xd44e('0x1d')]=qs[_0xd44e('0x1d')](_0x2d18be[_0xd44e('0x32')][_0xd44e('0x1d')]);_0x1ad02f[_0xd44e('0x1b')]=qs[_0xd44e('0x1b')](_0x2d18be[_0xd44e('0x32')][_0xd44e('0x1b')]);}_0x1ad02f[_0xd44e('0x3b')]=qs[_0xd44e('0x3c')](_0x2d18be[_0xd44e('0x32')][_0xd44e('0x3c')]);_0x1ad02f['where']=qs[_0xd44e('0x33')](_['pick'](_0x2d18be[_0xd44e('0x32')],_0x5b8249[_0xd44e('0x33')]),_0x3ee335);if(_0x2d18be[_0xd44e('0x32')][_0xd44e('0x3d')]){_0x1ad02f['where']=_['merge'](_0x1ad02f[_0xd44e('0x3e')],{'$or':_['map'](_0x3ee335,function(_0x39936c){if(_0x39936c[_0xd44e('0x2f')]!==_0xd44e('0x3f')){var _0x14e3b9={};_0x14e3b9[_0x39936c[_0xd44e('0x29')]]={'$like':'%'+_0x2d18be['query'][_0xd44e('0x3d')]+'%'};return _0x14e3b9;}})});}_0x1ad02f=_[_0xd44e('0x40')]({},_0x1ad02f,_0x2d18be['options']);var _0x6827e5={'where':_0x1ad02f[_0xd44e('0x3e')]};return db['OpenchannelTransferReport'][_0xd44e('0x1e')](_0x6827e5)[_0xd44e('0x25')](function(_0x57c07f){_0x1fcf44[_0xd44e('0x1e')]=_0x57c07f;if(_0x2d18be['query'][_0xd44e('0x41')]){_0x1ad02f[_0xd44e('0x42')]=[{'all':!![]}];}return db[_0xd44e('0x2c')]['findAll'](_0x1ad02f);})['then'](function(_0x2874cc){_0x1fcf44[_0xd44e('0x43')]=_0x2874cc;return _0x1fcf44;})['then'](respondWithFilteredResult(_0x1c3672,_0x1ad02f))['catch'](handleError(_0x1c3672,null));};exports[_0xd44e('0x44')]=function(_0x2c255c,_0x335d73){var _0x26ffb1={'raw':!![],'where':{'id':_0x2c255c['params']['id']}},_0x432320={};_0x432320[_0xd44e('0x35')]=_['keys'](db[_0xd44e('0x2c')][_0xd44e('0x2d')]);_0x432320[_0xd44e('0x32')]=_[_0xd44e('0x45')](_0x2c255c['query']);_0x432320[_0xd44e('0x33')]=_[_0xd44e('0x34')](_0x432320[_0xd44e('0x35')],_0x432320['query']);_0x26ffb1['attributes']=_[_0xd44e('0x34')](_0x432320[_0xd44e('0x35')],qs[_0xd44e('0x37')](_0x2c255c[_0xd44e('0x32')][_0xd44e('0x37')]));_0x26ffb1['attributes']=_0x26ffb1[_0xd44e('0x36')]['length']?_0x26ffb1[_0xd44e('0x36')]:_0x432320[_0xd44e('0x35')];if(_0x2c255c[_0xd44e('0x32')][_0xd44e('0x41')]){_0x26ffb1[_0xd44e('0x42')]=[{'all':!![]}];}_0x26ffb1=_['merge']({},_0x26ffb1,_0x2c255c[_0xd44e('0x46')]);return db['OpenchannelTransferReport'][_0xd44e('0x47')](_0x26ffb1)['then'](handleEntityNotFound(_0x335d73,null))[_0xd44e('0x25')](respondWithResult(_0x335d73,null))[_0xd44e('0x48')](handleError(_0x335d73,null));};exports[_0xd44e('0x49')]=function(_0x3aa5dc,_0x467df0){return db[_0xd44e('0x2c')][_0xd44e('0x49')](_0x3aa5dc[_0xd44e('0x4a')],{})[_0xd44e('0x25')](respondWithResult(_0x467df0,0xc9))[_0xd44e('0x48')](handleError(_0x467df0,null));};exports[_0xd44e('0x24')]=function(_0x5adf5c,_0xede200){if(_0x5adf5c['body']['id']){delete _0x5adf5c[_0xd44e('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0xd44e('0x47')]({'where':{'id':_0x5adf5c['params']['id']}})[_0xd44e('0x25')](handleEntityNotFound(_0xede200,null))[_0xd44e('0x25')](saveUpdates(_0x5adf5c['body'],null))[_0xd44e('0x25')](respondWithResult(_0xede200,null))[_0xd44e('0x48')](handleError(_0xede200,null));};exports['destroy']=function(_0x5b94b2,_0x53cca1){return db[_0xd44e('0x2c')][_0xd44e('0x47')]({'where':{'id':_0x5b94b2[_0xd44e('0x4b')]['id']}})[_0xd44e('0x25')](handleEntityNotFound(_0x53cca1,null))['then'](removeEntity(_0x53cca1,null))[_0xd44e('0x48')](handleError(_0x53cca1,null));};exports[_0xd44e('0x4c')]=function(_0x10fc8e,_0x2c650c){return db[_0xd44e('0x2c')][_0xd44e('0x4c')]()['then'](respondWithResult(_0x2c650c,null))['catch'](handleError(_0x2c650c,null));}; \ No newline at end of file +var _0x5a05=['index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','stack','name','send'];(function(_0x12efa0,_0x579590){var _0x158c02=function(_0x311422){while(--_0x311422){_0x12efa0['push'](_0x12efa0['shift']());}};_0x158c02(++_0x579590);}(_0x5a05,0x141));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x55a0('0x0'));var rimraf=require(_0x55a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55a0('0x2'));var rp=require(_0x55a0('0x3'));var moment=require(_0x55a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55a0('0x5'));var util=require('util');var path=require(_0x55a0('0x6'));var sox=require(_0x55a0('0x7'));var csv=require('to-csv');var ejs=require(_0x55a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x55a0('0x9'));var crypto=require(_0x55a0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x55a0('0xb'));var toCsv=require(_0x55a0('0xc'));var querystring=require(_0x55a0('0xd'));var Papa=require('papaparse');var Redis=require(_0x55a0('0xe'));var authService=require(_0x55a0('0xf'));var qs=require(_0x55a0('0x10'));var as=require(_0x55a0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55a0('0x12'))(_0x55a0('0x13'));var utils=require(_0x55a0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x55a0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567a51,_0x4957f7){_0x4957f7=_0x4957f7||0xcc;return function(_0x593e36){if(_0x593e36){return _0x567a51[_0x55a0('0x16')](_0x4957f7);}return _0x567a51[_0x55a0('0x17')](_0x4957f7)[_0x55a0('0x18')]();};}function respondWithResult(_0x4d6188,_0x262441){_0x262441=_0x262441||0xc8;return function(_0x1287f0){if(_0x1287f0){return _0x4d6188[_0x55a0('0x17')](_0x262441)[_0x55a0('0x19')](_0x1287f0);}};}function respondWithFilteredResult(_0x59a26e,_0x336499){return function(_0x320663){if(_0x320663){var _0x288277=typeof _0x336499[_0x55a0('0x1a')]===_0x55a0('0x1b')&&typeof _0x336499['limit']==='undefined';var _0x5c343b=_0x320663[_0x55a0('0x1c')];var _0x754c8c=_0x288277?0x0:_0x336499[_0x55a0('0x1a')];var _0x27a5bf=_0x288277?_0x320663[_0x55a0('0x1c')]:_0x336499[_0x55a0('0x1a')]+_0x336499[_0x55a0('0x1d')];var _0x152397;if(_0x27a5bf>=_0x5c343b){_0x27a5bf=_0x5c343b;_0x152397=0xc8;}else{_0x152397=0xce;}_0x59a26e[_0x55a0('0x17')](_0x152397);return _0x59a26e[_0x55a0('0x1e')]('Content-Range',_0x754c8c+'-'+_0x27a5bf+'/'+_0x5c343b)['json'](_0x320663);}return null;};}function patchUpdates(_0xeb2e0a){return function(_0x535376){try{jsonpatch[_0x55a0('0x1f')](_0x535376,_0xeb2e0a,!![]);}catch(_0x514ed4){return BPromise[_0x55a0('0x20')](_0x514ed4);}return _0x535376['save']();};}function saveUpdates(_0x1b11b7,_0x2b687d){return function(_0xcf8224){if(_0xcf8224){return _0xcf8224[_0x55a0('0x21')](_0x1b11b7)[_0x55a0('0x22')](function(_0x13d8f7){return _0x13d8f7;});}return null;};}function removeEntity(_0x516052,_0x231a0d){return function(_0x895c15){if(_0x895c15){return _0x895c15[_0x55a0('0x23')]()['then'](function(){_0x516052['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be8ed,_0x48e298){return function(_0x3789a8){if(!_0x3789a8){_0x1be8ed[_0x55a0('0x16')](0x194);}return _0x3789a8;};}function handleError(_0xa10d60,_0x28a51e){_0x28a51e=_0x28a51e||0x1f4;return function(_0x19bd94){logger['error'](_0x19bd94[_0x55a0('0x24')]);if(_0x19bd94[_0x55a0('0x25')]){delete _0x19bd94['name'];}_0xa10d60[_0x55a0('0x17')](_0x28a51e)[_0x55a0('0x26')](_0x19bd94);};}exports[_0x55a0('0x27')]=function(_0x2c3c09,_0x24df0b){var _0x4a9757={},_0x27b355={},_0x255a7b={'count':0x0,'rows':[]};var _0x10ff6b=_['map'](db['OpenchannelTransferReport'][_0x55a0('0x28')],function(_0x40647a){return{'name':_0x40647a[_0x55a0('0x29')],'type':_0x40647a[_0x55a0('0x2a')][_0x55a0('0x2b')]};});_0x27b355['model']=_[_0x55a0('0x2c')](_0x10ff6b,'name');_0x27b355['query']=_[_0x55a0('0x2d')](_0x2c3c09[_0x55a0('0x2e')]);_0x27b355[_0x55a0('0x2f')]=_['intersection'](_0x27b355[_0x55a0('0x30')],_0x27b355['query']);_0x4a9757[_0x55a0('0x31')]=_[_0x55a0('0x32')](_0x27b355[_0x55a0('0x30')],qs[_0x55a0('0x33')](_0x2c3c09[_0x55a0('0x2e')][_0x55a0('0x33')]));_0x4a9757[_0x55a0('0x31')]=_0x4a9757[_0x55a0('0x31')][_0x55a0('0x34')]?_0x4a9757[_0x55a0('0x31')]:_0x27b355[_0x55a0('0x30')];if(!_0x2c3c09['query']['hasOwnProperty'](_0x55a0('0x35'))){_0x4a9757[_0x55a0('0x1d')]=qs['limit'](_0x2c3c09[_0x55a0('0x2e')][_0x55a0('0x1d')]);_0x4a9757[_0x55a0('0x1a')]=qs['offset'](_0x2c3c09[_0x55a0('0x2e')][_0x55a0('0x1a')]);}_0x4a9757[_0x55a0('0x36')]=qs['sort'](_0x2c3c09[_0x55a0('0x2e')]['sort']);_0x4a9757['where']=qs[_0x55a0('0x2f')](_['pick'](_0x2c3c09['query'],_0x27b355[_0x55a0('0x2f')]),_0x10ff6b);if(_0x2c3c09['query'][_0x55a0('0x37')]){_0x4a9757[_0x55a0('0x38')]=_['merge'](_0x4a9757[_0x55a0('0x38')],{'$or':_[_0x55a0('0x2c')](_0x10ff6b,function(_0x547be9){if(_0x547be9[_0x55a0('0x2a')]!==_0x55a0('0x39')){var _0x1364d7={};_0x1364d7[_0x547be9[_0x55a0('0x25')]]={'$like':'%'+_0x2c3c09[_0x55a0('0x2e')][_0x55a0('0x37')]+'%'};return _0x1364d7;}})});}_0x4a9757=_[_0x55a0('0x3a')]({},_0x4a9757,_0x2c3c09[_0x55a0('0x3b')]);var _0x2e8335={'where':_0x4a9757[_0x55a0('0x38')]};return db['OpenchannelTransferReport'][_0x55a0('0x1c')](_0x2e8335)[_0x55a0('0x22')](function(_0x2adac7){_0x255a7b[_0x55a0('0x1c')]=_0x2adac7;if(_0x2c3c09[_0x55a0('0x2e')][_0x55a0('0x3c')]){_0x4a9757[_0x55a0('0x3d')]=[{'all':!![]}];}return db[_0x55a0('0x3e')][_0x55a0('0x3f')](_0x4a9757);})[_0x55a0('0x22')](function(_0x4d39f4){_0x255a7b[_0x55a0('0x40')]=_0x4d39f4;return _0x255a7b;})[_0x55a0('0x22')](respondWithFilteredResult(_0x24df0b,_0x4a9757))[_0x55a0('0x41')](handleError(_0x24df0b,null));};exports[_0x55a0('0x42')]=function(_0x3469f3,_0x568c83){var _0x33f408={'raw':!![],'where':{'id':_0x3469f3['params']['id']}},_0x2fd059={};_0x2fd059[_0x55a0('0x30')]=_[_0x55a0('0x2d')](db[_0x55a0('0x3e')][_0x55a0('0x28')]);_0x2fd059[_0x55a0('0x2e')]=_[_0x55a0('0x2d')](_0x3469f3[_0x55a0('0x2e')]);_0x2fd059[_0x55a0('0x2f')]=_['intersection'](_0x2fd059['model'],_0x2fd059[_0x55a0('0x2e')]);_0x33f408['attributes']=_[_0x55a0('0x32')](_0x2fd059[_0x55a0('0x30')],qs[_0x55a0('0x33')](_0x3469f3['query'][_0x55a0('0x33')]));_0x33f408['attributes']=_0x33f408[_0x55a0('0x31')]['length']?_0x33f408[_0x55a0('0x31')]:_0x2fd059[_0x55a0('0x30')];if(_0x3469f3['query'][_0x55a0('0x3c')]){_0x33f408[_0x55a0('0x3d')]=[{'all':!![]}];}_0x33f408=_[_0x55a0('0x3a')]({},_0x33f408,_0x3469f3[_0x55a0('0x3b')]);return db[_0x55a0('0x3e')]['find'](_0x33f408)[_0x55a0('0x22')](handleEntityNotFound(_0x568c83,null))['then'](respondWithResult(_0x568c83,null))[_0x55a0('0x41')](handleError(_0x568c83,null));};exports[_0x55a0('0x43')]=function(_0x48dc4c,_0x529b1d){return db['OpenchannelTransferReport']['create'](_0x48dc4c[_0x55a0('0x44')],{})[_0x55a0('0x22')](respondWithResult(_0x529b1d,0xc9))[_0x55a0('0x41')](handleError(_0x529b1d,null));};exports[_0x55a0('0x21')]=function(_0x469725,_0x58cc98){if(_0x469725[_0x55a0('0x44')]['id']){delete _0x469725[_0x55a0('0x44')]['id'];}return db[_0x55a0('0x3e')][_0x55a0('0x45')]({'where':{'id':_0x469725['params']['id']}})[_0x55a0('0x22')](handleEntityNotFound(_0x58cc98,null))[_0x55a0('0x22')](saveUpdates(_0x469725[_0x55a0('0x44')],null))[_0x55a0('0x22')](respondWithResult(_0x58cc98,null))['catch'](handleError(_0x58cc98,null));};exports[_0x55a0('0x23')]=function(_0x253d7b,_0x102e28){return db[_0x55a0('0x3e')][_0x55a0('0x45')]({'where':{'id':_0x253d7b[_0x55a0('0x46')]['id']}})[_0x55a0('0x22')](handleEntityNotFound(_0x102e28,null))[_0x55a0('0x22')](removeEntity(_0x102e28,null))['catch'](handleError(_0x102e28,null));};exports['describe']=function(_0x13ce27,_0xcc81d2){return db[_0x55a0('0x3e')][_0x55a0('0x47')]()[_0x55a0('0x22')](respondWithResult(_0xcc81d2,null))['catch'](handleError(_0xcc81d2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7ed3eb3..d885c8f 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 _0x430c=['request-promise','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x112a6b,_0xafb4a2){var _0x28426d=function(_0x2b6e55){while(--_0x2b6e55){_0x112a6b['push'](_0x112a6b['shift']());}};_0x28426d(++_0xafb4a2);}(_0x430c,0x19b));var _0xc430=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x430c[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0xc430('0x0'));var util=require(_0xc430('0x1'));var logger=require(_0xc430('0x2'))('api');var moment=require(_0xc430('0x3'));var BPromise=require(_0xc430('0x4'));var rp=require(_0xc430('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc430('0x6'));var config=require(_0xc430('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xc430('0x8')]=function(_0x4c2c6e,_0x4e9aab){return _0x4c2c6e[_0xc430('0x9')](_0xc430('0xa'),attributes,{'tableName':_0xc430('0xb'),'paranoid':![],'indexes':[{'name':_0xc430('0xc'),'fields':[_0xc430('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4226=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','OpenchannelTransferReport'];(function(_0x465e5e,_0x3eb85e){var _0x48a266=function(_0x46c9e3){while(--_0x46c9e3){_0x465e5e['push'](_0x465e5e['shift']());}};_0x48a266(++_0x3eb85e);}(_0x4226,0xf2));var _0x6422=function(_0x589696,_0x519bd4){_0x589696=_0x589696-0x0;var _0xba5f3e=_0x4226[_0x589696];return _0xba5f3e;};'use strict';var _=require(_0x6422('0x0'));var util=require(_0x6422('0x1'));var logger=require(_0x6422('0x2'))('api');var moment=require(_0x6422('0x3'));var BPromise=require(_0x6422('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6422('0x5'));var config=require(_0x6422('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6422('0x7')]=function(_0x40d078,_0x39e3ff){return _0x40d078[_0x6422('0x8')](_0x6422('0x9'),attributes,{'tableName':_0x6422('0xa'),'paranoid':![],'indexes':[{'name':_0x6422('0xb'),'fields':[_0x6422('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 d723c38..eaa1415 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 _0xe7de=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf406b3,_0x4f188f){var _0x14728b=function(_0x23efb9){while(--_0x23efb9){_0xf406b3['push'](_0xf406b3['shift']());}};_0x14728b(++_0x4f188f);}(_0xe7de,0x165));var _0xee7d=function(_0x535f62,_0x282cfc){_0x535f62=_0x535f62-0x0;var _0x3f50d9=_0xe7de[_0x535f62];return _0x3f50d9;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var moment=require(_0xee7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee7d('0x3'));var db=require(_0xee7d('0x4'))['db'];var utils=require(_0xee7d('0x5'));var logger=require(_0xee7d('0x6'))(_0xee7d('0x7'));var config=require(_0xee7d('0x8'));var jayson=require(_0xee7d('0x9'));var client=jayson[_0xee7d('0xa')][_0xee7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28d5b6,_0xe926ab,_0x2e172d){return new BPromise(function(_0x1c0584,_0x941d94){return client['request'](_0x28d5b6,_0x2e172d)[_0xee7d('0xc')](function(_0x32c4fa){logger[_0xee7d('0xd')](_0xee7d('0xe'),_0xe926ab,_0xee7d('0xf'));logger[_0xee7d('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0xe926ab,_0xee7d('0xf'),JSON['stringify'](_0x32c4fa));if(_0x32c4fa[_0xee7d('0x11')]){if(_0x32c4fa[_0xee7d('0x11')][_0xee7d('0x12')]===0x1f4){logger[_0xee7d('0x11')](_0xee7d('0xe'),_0xe926ab,_0x32c4fa[_0xee7d('0x11')][_0xee7d('0x13')]);return _0x941d94(_0x32c4fa[_0xee7d('0x11')][_0xee7d('0x13')]);}logger[_0xee7d('0x11')](_0xee7d('0xe'),_0xe926ab,_0x32c4fa['error']['message']);return _0x1c0584(_0x32c4fa[_0xee7d('0x11')][_0xee7d('0x13')]);}else{logger[_0xee7d('0xd')](_0xee7d('0xe'),_0xe926ab,_0xee7d('0xf'));_0x1c0584(_0x32c4fa[_0xee7d('0x14')]['message']);}})[_0xee7d('0x15')](function(_0x2bcd81){logger[_0xee7d('0x11')](_0xee7d('0xe'),_0xe926ab,_0x2bcd81);_0x941d94(_0x2bcd81);});});} \ No newline at end of file +var _0x7c1f=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f9a81,_0x53550b){var _0x22112c=function(_0xfb425f){while(--_0xfb425f){_0x3f9a81['push'](_0x3f9a81['shift']());}};_0x22112c(++_0x53550b);}(_0x7c1f,0x194));var _0xf7c1=function(_0x3bbfda,_0x3e489f){_0x3bbfda=_0x3bbfda-0x0;var _0x552fa0=_0x7c1f[_0x3bbfda];return _0x552fa0;};'use strict';var _=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var moment=require(_0xf7c1('0x2'));var BPromise=require(_0xf7c1('0x3'));var rs=require(_0xf7c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7c1('0x5'))['db'];var utils=require(_0xf7c1('0x6'));var logger=require(_0xf7c1('0x7'))('rpc');var config=require(_0xf7c1('0x8'));var jayson=require(_0xf7c1('0x9'));var client=jayson[_0xf7c1('0xa')][_0xf7c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5423bf,_0x1ad808,_0x1a342b){return new BPromise(function(_0x329050,_0x418f9a){return client[_0xf7c1('0xc')](_0x5423bf,_0x1a342b)[_0xf7c1('0xd')](function(_0x4279ea){logger[_0xf7c1('0xe')](_0xf7c1('0xf'),_0x1ad808,_0xf7c1('0x10'));logger[_0xf7c1('0x11')](_0xf7c1('0x12'),_0x1ad808,'request\x20sent',JSON[_0xf7c1('0x13')](_0x4279ea));if(_0x4279ea[_0xf7c1('0x14')]){if(_0x4279ea[_0xf7c1('0x14')][_0xf7c1('0x15')]===0x1f4){logger[_0xf7c1('0x14')](_0xf7c1('0xf'),_0x1ad808,_0x4279ea['error']['message']);return _0x418f9a(_0x4279ea[_0xf7c1('0x14')]['message']);}logger[_0xf7c1('0x14')](_0xf7c1('0xf'),_0x1ad808,_0x4279ea['error'][_0xf7c1('0x16')]);return _0x329050(_0x4279ea['error'][_0xf7c1('0x16')]);}else{logger[_0xf7c1('0xe')](_0xf7c1('0xf'),_0x1ad808,_0xf7c1('0x10'));_0x329050(_0x4279ea[_0xf7c1('0x17')]['message']);}})[_0xf7c1('0x18')](function(_0x5b5786){logger[_0xf7c1('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1ad808,_0x5b5786);_0x418f9a(_0x5b5786);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 002c2f8..6e68ff7 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 _0xf17b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x29f7d1,_0x96db7){var _0x1499a1=function(_0x231806){while(--_0x231806){_0x29f7d1['push'](_0x29f7d1['shift']());}};_0x1499a1(++_0x96db7);}(_0xf17b,0x13e));var _0xbf17=function(_0x3fa403,_0x937d81){_0x3fa403=_0x3fa403-0x0;var _0x446525=_0xf17b[_0x3fa403];return _0x446525;};'use strict';var multer=require(_0xbf17('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbf17('0x1'));var express=require(_0xbf17('0x2'));var router=express['Router']();var fs_extra=require(_0xbf17('0x3'));var auth=require(_0xbf17('0x4'));var interaction=require(_0xbf17('0x5'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xbf17('0x6')]('/',auth[_0xbf17('0x7')](),controller[_0xbf17('0x8')]);router[_0xbf17('0x6')](_0xbf17('0x9'),auth[_0xbf17('0x7')](),controller['show']);router[_0xbf17('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbf17('0xb')]('/:id',auth[_0xbf17('0x7')](),controller[_0xbf17('0xc')]);router[_0xbf17('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbf17('0xe')]);module[_0xbf17('0xf')]=router; \ No newline at end of file +var _0x06e2=['get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0x4c6820,_0x150581){var _0x3b1998=function(_0x174063){while(--_0x174063){_0x4c6820['push'](_0x4c6820['shift']());}};_0x3b1998(++_0x150581);}(_0x06e2,0x13a));var _0x206e=function(_0x2ff57f,_0xcc3040){_0x2ff57f=_0x2ff57f-0x0;var _0x45f95b=_0x06e2[_0x2ff57f];return _0x45f95b;};'use strict';var multer=require(_0x206e('0x0'));var util=require(_0x206e('0x1'));var path=require(_0x206e('0x2'));var timeout=require(_0x206e('0x3'));var express=require('express');var router=express[_0x206e('0x4')]();var fs_extra=require(_0x206e('0x5'));var auth=require(_0x206e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x206e('0x7'));var controller=require(_0x206e('0x8'));router[_0x206e('0x9')]('/',auth['isAuthenticated'](),controller[_0x206e('0xa')]);router[_0x206e('0x9')](_0x206e('0xb'),auth[_0x206e('0xc')](),controller[_0x206e('0xd')]);router[_0x206e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x206e('0xf')](_0x206e('0xb'),auth[_0x206e('0xc')](),controller['update']);router[_0x206e('0x10')](_0x206e('0xb'),auth['isAuthenticated'](),controller[_0x206e('0x11')]);module[_0x206e('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 d66324c..81c7e4a 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 _0xf77a=['STRING','name','exports'];(function(_0x13df9f,_0x1d2f33){var _0x20d0f5=function(_0x526796){while(--_0x526796){_0x13df9f['push'](_0x13df9f['shift']());}};_0x20d0f5(++_0x1d2f33);}(_0xf77a,0x15e));var _0xaf77=function(_0x2c99ad,_0x2c45b8){_0x2c99ad=_0x2c99ad-0x0;var _0x2af7f5=_0xf77a[_0x2c99ad];return _0x2af7f5;};'use strict';var Sequelize=require('sequelize');module[_0xaf77('0x0')]={'name':{'type':Sequelize[_0xaf77('0x1')],'unique':_0xaf77('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xaf77('0x1')]}}; \ No newline at end of file +var _0xc65a=['STRING','name'];(function(_0x2962eb,_0x264029){var _0x3eae51=function(_0x4e45da){while(--_0x4e45da){_0x2962eb['push'](_0x2962eb['shift']());}};_0x3eae51(++_0x264029);}(_0xc65a,0x7e));var _0xac65=function(_0x2ea30b,_0x27ea06){_0x2ea30b=_0x2ea30b-0x0;var _0x211895=_0xc65a[_0x2ea30b];return _0x211895;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xac65('0x0')],'unique':_0xac65('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xac65('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a425b7f..0767c82 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 _0xf90d=['then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','reject','save','update'];(function(_0x377f94,_0x19c35e){var _0x264ad8=function(_0x1d7ce7){while(--_0x1d7ce7){_0x377f94['push'](_0x377f94['shift']());}};_0x264ad8(++_0x19c35e);}(_0xf90d,0xd5));var _0xdf90=function(_0x2ba7f3,_0xaf853){_0x2ba7f3=_0x2ba7f3-0x0;var _0x43a57f=_0xf90d[_0x2ba7f3];return _0x43a57f;};'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(_0xdf90('0x0'));var moment=require('moment');var BPromise=require(_0xdf90('0x1'));var Mustache=require(_0xdf90('0x2'));var util=require(_0xdf90('0x3'));var path=require(_0xdf90('0x4'));var sox=require(_0xdf90('0x5'));var csv=require(_0xdf90('0x6'));var ejs=require(_0xdf90('0x7'));var fs=require('fs');var fs_extra=require(_0xdf90('0x8'));var _=require(_0xdf90('0x9'));var squel=require(_0xdf90('0xa'));var crypto=require(_0xdf90('0xb'));var jsforce=require(_0xdf90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf90('0x6'));var querystring=require(_0xdf90('0xd'));var Papa=require(_0xdf90('0xe'));var Redis=require(_0xdf90('0xf'));var authService=require(_0xdf90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdf90('0x11'));var hardwareService=require(_0xdf90('0x12'));var logger=require(_0xdf90('0x13'))(_0xdf90('0x14'));var utils=require(_0xdf90('0x15'));var config=require(_0xdf90('0x16'));var licenseUtil=require(_0xdf90('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc9a721,_0x542c8f){_0x542c8f=_0x542c8f||0xcc;return function(_0x1b3553){if(_0x1b3553){return _0xc9a721[_0xdf90('0x18')](_0x542c8f);}return _0xc9a721['status'](_0x542c8f)[_0xdf90('0x19')]();};}function respondWithResult(_0x32828f,_0x32bccb){_0x32bccb=_0x32bccb||0xc8;return function(_0x29593b){if(_0x29593b){return _0x32828f[_0xdf90('0x1a')](_0x32bccb)['json'](_0x29593b);}};}function respondWithFilteredResult(_0x5ced29,_0x181ed0){return function(_0x4ca42a){if(_0x4ca42a){var _0x477c4e=typeof _0x181ed0[_0xdf90('0x1b')]===_0xdf90('0x1c')&&typeof _0x181ed0[_0xdf90('0x1d')]===_0xdf90('0x1c');var _0x213e1b=_0x4ca42a['count'];var _0x565c64=_0x477c4e?0x0:_0x181ed0[_0xdf90('0x1b')];var _0x1acebd=_0x477c4e?_0x4ca42a['count']:_0x181ed0[_0xdf90('0x1b')]+_0x181ed0[_0xdf90('0x1d')];var _0x13f9b3;if(_0x1acebd>=_0x213e1b){_0x1acebd=_0x213e1b;_0x13f9b3=0xc8;}else{_0x13f9b3=0xce;}_0x5ced29[_0xdf90('0x1a')](_0x13f9b3);return _0x5ced29[_0xdf90('0x1e')](_0xdf90('0x1f'),_0x565c64+'-'+_0x1acebd+'/'+_0x213e1b)[_0xdf90('0x20')](_0x4ca42a);}return null;};}function patchUpdates(_0x408ccd){return function(_0x1dbb71){try{jsonpatch['apply'](_0x1dbb71,_0x408ccd,!![]);}catch(_0x11205a){return BPromise[_0xdf90('0x21')](_0x11205a);}return _0x1dbb71[_0xdf90('0x22')]();};}function saveUpdates(_0xcaadd5,_0xe8eff5){return function(_0x65b30){if(_0x65b30){return _0x65b30[_0xdf90('0x23')](_0xcaadd5)[_0xdf90('0x24')](function(_0x212370){return _0x212370;});}return null;};}function removeEntity(_0x410d24,_0xac4249){return function(_0x1b9210){if(_0x1b9210){return _0x1b9210[_0xdf90('0x25')]()[_0xdf90('0x24')](function(){var _0x2e42eb=_0x1b9210[_0xdf90('0x26')]({'plain':!![]});var _0x26ead1=_0xdf90('0x27');return db[_0xdf90('0x28')][_0xdf90('0x25')]({'where':{'type':_0x26ead1,'resourceId':_0x2e42eb['id']}})[_0xdf90('0x24')](function(){return _0x1b9210;});})[_0xdf90('0x24')](function(){_0x410d24[_0xdf90('0x1a')](0xcc)[_0xdf90('0x19')]();});}};}function handleEntityNotFound(_0x40885b,_0x34f7bd){return function(_0x549f64){if(!_0x549f64){_0x40885b[_0xdf90('0x18')](0x194);}return _0x549f64;};}function handleError(_0x5a0eba,_0x3fe2ca){_0x3fe2ca=_0x3fe2ca||0x1f4;return function(_0x2816ce){logger[_0xdf90('0x29')](_0x2816ce[_0xdf90('0x2a')]);if(_0x2816ce['name']){delete _0x2816ce[_0xdf90('0x2b')];}_0x5a0eba[_0xdf90('0x1a')](_0x3fe2ca)[_0xdf90('0x2c')](_0x2816ce);};}exports[_0xdf90('0x2d')]=function(_0x151213,_0x37afd1){var _0x40b843={},_0x19e899={},_0x46c8a0={'count':0x0,'rows':[]};var _0x51d7c6=_[_0xdf90('0x2e')](db[_0xdf90('0x2f')][_0xdf90('0x30')],function(_0x35304a){return{'name':_0x35304a['fieldName'],'type':_0x35304a[_0xdf90('0x31')][_0xdf90('0x32')]};});_0x19e899[_0xdf90('0x33')]=_[_0xdf90('0x2e')](_0x51d7c6,_0xdf90('0x2b'));_0x19e899[_0xdf90('0x34')]=_[_0xdf90('0x35')](_0x151213[_0xdf90('0x34')]);_0x19e899[_0xdf90('0x36')]=_[_0xdf90('0x37')](_0x19e899[_0xdf90('0x33')],_0x19e899[_0xdf90('0x34')]);_0x40b843['attributes']=_['intersection'](_0x19e899[_0xdf90('0x33')],qs[_0xdf90('0x38')](_0x151213[_0xdf90('0x34')][_0xdf90('0x38')]));_0x40b843[_0xdf90('0x39')]=_0x40b843['attributes'][_0xdf90('0x3a')]?_0x40b843[_0xdf90('0x39')]:_0x19e899['model'];if(!_0x151213[_0xdf90('0x34')]['hasOwnProperty'](_0xdf90('0x3b'))){_0x40b843[_0xdf90('0x1d')]=qs['limit'](_0x151213[_0xdf90('0x34')][_0xdf90('0x1d')]);_0x40b843[_0xdf90('0x1b')]=qs[_0xdf90('0x1b')](_0x151213[_0xdf90('0x34')][_0xdf90('0x1b')]);}_0x40b843[_0xdf90('0x3c')]=qs[_0xdf90('0x3d')](_0x151213['query'][_0xdf90('0x3d')]);_0x40b843[_0xdf90('0x3e')]=qs[_0xdf90('0x36')](_[_0xdf90('0x3f')](_0x151213[_0xdf90('0x34')],_0x19e899[_0xdf90('0x36')]),_0x51d7c6);if(_0x151213['query'][_0xdf90('0x40')]){_0x40b843[_0xdf90('0x3e')]=_[_0xdf90('0x41')](_0x40b843[_0xdf90('0x3e')],{'$or':_[_0xdf90('0x2e')](_0x51d7c6,function(_0x4da663){if(_0x4da663[_0xdf90('0x31')]!==_0xdf90('0x42')){var _0x2226ab={};_0x2226ab[_0x4da663[_0xdf90('0x2b')]]={'$like':'%'+_0x151213[_0xdf90('0x34')]['filter']+'%'};return _0x2226ab;}})});}_0x40b843=_[_0xdf90('0x41')]({},_0x40b843,_0x151213['options']);var _0x276ac4={'where':_0x40b843[_0xdf90('0x3e')]};return db[_0xdf90('0x2f')][_0xdf90('0x43')](_0x276ac4)[_0xdf90('0x24')](function(_0x1a186c){_0x46c8a0[_0xdf90('0x43')]=_0x1a186c;if(_0x151213[_0xdf90('0x34')][_0xdf90('0x44')]){_0x40b843[_0xdf90('0x45')]=[{'all':!![]}];}return db['Pause'][_0xdf90('0x46')](_0x40b843);})[_0xdf90('0x24')](function(_0x378f53){_0x46c8a0[_0xdf90('0x47')]=_0x378f53;return _0x46c8a0;})[_0xdf90('0x24')](respondWithFilteredResult(_0x37afd1,_0x40b843))[_0xdf90('0x48')](handleError(_0x37afd1,null));};exports[_0xdf90('0x49')]=function(_0x5291f4,_0x58c7a1){var _0x5d20c0={'raw':!![],'where':{'id':_0x5291f4[_0xdf90('0x4a')]['id']}},_0x5e45d1={};_0x5e45d1[_0xdf90('0x33')]=_[_0xdf90('0x35')](db[_0xdf90('0x2f')][_0xdf90('0x30')]);_0x5e45d1[_0xdf90('0x34')]=_[_0xdf90('0x35')](_0x5291f4[_0xdf90('0x34')]);_0x5e45d1[_0xdf90('0x36')]=_[_0xdf90('0x37')](_0x5e45d1[_0xdf90('0x33')],_0x5e45d1[_0xdf90('0x34')]);_0x5d20c0[_0xdf90('0x39')]=_['intersection'](_0x5e45d1[_0xdf90('0x33')],qs['fields'](_0x5291f4[_0xdf90('0x34')]['fields']));_0x5d20c0[_0xdf90('0x39')]=_0x5d20c0[_0xdf90('0x39')][_0xdf90('0x3a')]?_0x5d20c0[_0xdf90('0x39')]:_0x5e45d1[_0xdf90('0x33')];if(_0x5291f4[_0xdf90('0x34')][_0xdf90('0x44')]){_0x5d20c0[_0xdf90('0x45')]=[{'all':!![]}];}_0x5d20c0=_['merge']({},_0x5d20c0,_0x5291f4[_0xdf90('0x4b')]);return db[_0xdf90('0x2f')][_0xdf90('0x4c')](_0x5d20c0)[_0xdf90('0x24')](handleEntityNotFound(_0x58c7a1,null))[_0xdf90('0x24')](respondWithResult(_0x58c7a1,null))['catch'](handleError(_0x58c7a1,null));};exports[_0xdf90('0x4d')]=function(_0x574217,_0xff3090){return db[_0xdf90('0x2f')][_0xdf90('0x4d')](_0x574217[_0xdf90('0x4e')],{})[_0xdf90('0x24')](function(_0x403ca9){var _0x40a3ad=_0x574217[_0xdf90('0x4f')][_0xdf90('0x26')]({'plain':!![]});if(!_0x40a3ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a3ad[_0xdf90('0x50')]===_0xdf90('0x4f')){var _0x1a16ec=_0x403ca9[_0xdf90('0x26')]({'plain':!![]});var _0x18e0fd=_0xdf90('0x27');return db['UserProfileSection'][_0xdf90('0x4c')]({'where':{'name':_0x18e0fd,'userProfileId':_0x40a3ad['userProfileId']},'raw':!![]})[_0xdf90('0x24')](function(_0x25bc95){if(_0x25bc95&&_0x25bc95[_0xdf90('0x51')]===0x0){return db['UserProfileResource'][_0xdf90('0x4d')]({'name':_0x1a16ec[_0xdf90('0x2b')],'resourceId':_0x1a16ec['id'],'type':_0x25bc95[_0xdf90('0x2b')],'sectionId':_0x25bc95['id']},{})['then'](function(){return _0x403ca9;});}else{return _0x403ca9;}})[_0xdf90('0x48')](function(_0x32f12a){logger[_0xdf90('0x29')](_0xdf90('0x52'),_0x32f12a);throw _0x32f12a;});}return _0x403ca9;})[_0xdf90('0x24')](respondWithResult(_0xff3090,0xc9))[_0xdf90('0x48')](handleError(_0xff3090,null));};exports[_0xdf90('0x23')]=function(_0x120b44,_0x2392e1){if(_0x120b44[_0xdf90('0x4e')]['id']){delete _0x120b44[_0xdf90('0x4e')]['id'];}return db[_0xdf90('0x2f')][_0xdf90('0x4c')]({'where':{'id':_0x120b44['params']['id']}})[_0xdf90('0x24')](handleEntityNotFound(_0x2392e1,null))['then'](saveUpdates(_0x120b44[_0xdf90('0x4e')],null))['then'](respondWithResult(_0x2392e1,null))[_0xdf90('0x48')](handleError(_0x2392e1,null));};exports['destroy']=function(_0x701d3d,_0x1ec033){return db['Pause']['find']({'where':{'id':_0x701d3d[_0xdf90('0x4a')]['id']}})[_0xdf90('0x24')](handleEntityNotFound(_0x1ec033,null))['then'](removeEntity(_0x1ec033,null))['catch'](handleError(_0x1ec033,null));}; \ No newline at end of file +var _0x599a=['body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','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','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','name','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x24c72e,_0x5ceebd){var _0x37733a=function(_0x3382de){while(--_0x3382de){_0x24c72e['push'](_0x24c72e['shift']());}};_0x37733a(++_0x5ceebd);}(_0x599a,0xac));var _0xa599=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x599a[_0x469a3c];return _0x968f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa599('0x0'));var zipdir=require(_0xa599('0x1'));var jsonpatch=require(_0xa599('0x2'));var rp=require(_0xa599('0x3'));var moment=require('moment');var BPromise=require(_0xa599('0x4'));var Mustache=require(_0xa599('0x5'));var util=require(_0xa599('0x6'));var path=require(_0xa599('0x7'));var sox=require('sox');var csv=require(_0xa599('0x8'));var ejs=require(_0xa599('0x9'));var fs=require('fs');var fs_extra=require(_0xa599('0xa'));var _=require(_0xa599('0xb'));var squel=require(_0xa599('0xc'));var crypto=require(_0xa599('0xd'));var jsforce=require(_0xa599('0xe'));var deskjs=require(_0xa599('0xf'));var toCsv=require(_0xa599('0x8'));var querystring=require('querystring');var Papa=require(_0xa599('0x10'));var Redis=require(_0xa599('0x11'));var authService=require(_0xa599('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa599('0x13'));var hardwareService=require(_0xa599('0x14'));var logger=require(_0xa599('0x15'))(_0xa599('0x16'));var utils=require('../../config/utils');var config=require(_0xa599('0x17'));var licenseUtil=require(_0xa599('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dbbb5,_0x25c0ec){_0x25c0ec=_0x25c0ec||0xcc;return function(_0x59207f){if(_0x59207f){return _0x4dbbb5[_0xa599('0x19')](_0x25c0ec);}return _0x4dbbb5[_0xa599('0x1a')](_0x25c0ec)['end']();};}function respondWithResult(_0x5d6368,_0x1f64b8){_0x1f64b8=_0x1f64b8||0xc8;return function(_0x25c3b2){if(_0x25c3b2){return _0x5d6368['status'](_0x1f64b8)[_0xa599('0x1b')](_0x25c3b2);}};}function respondWithFilteredResult(_0x4bc184,_0x48335b){return function(_0x386208){if(_0x386208){var _0x55dbec=typeof _0x48335b['offset']==='undefined'&&typeof _0x48335b[_0xa599('0x1c')]===_0xa599('0x1d');var _0x2be3f4=_0x386208[_0xa599('0x1e')];var _0x337749=_0x55dbec?0x0:_0x48335b[_0xa599('0x1f')];var _0x3e9965=_0x55dbec?_0x386208[_0xa599('0x1e')]:_0x48335b[_0xa599('0x1f')]+_0x48335b[_0xa599('0x1c')];var _0x5d4af3;if(_0x3e9965>=_0x2be3f4){_0x3e9965=_0x2be3f4;_0x5d4af3=0xc8;}else{_0x5d4af3=0xce;}_0x4bc184['status'](_0x5d4af3);return _0x4bc184[_0xa599('0x20')](_0xa599('0x21'),_0x337749+'-'+_0x3e9965+'/'+_0x2be3f4)[_0xa599('0x1b')](_0x386208);}return null;};}function patchUpdates(_0x34fa16){return function(_0x5d2821){try{jsonpatch[_0xa599('0x22')](_0x5d2821,_0x34fa16,!![]);}catch(_0x36f9d4){return BPromise['reject'](_0x36f9d4);}return _0x5d2821['save']();};}function saveUpdates(_0x2cd95d,_0x955de2){return function(_0x45460c){if(_0x45460c){return _0x45460c[_0xa599('0x23')](_0x2cd95d)[_0xa599('0x24')](function(_0x16fb87){return _0x16fb87;});}return null;};}function removeEntity(_0x30c957,_0x2b68fd){return function(_0x3dfbd2){if(_0x3dfbd2){return _0x3dfbd2[_0xa599('0x25')]()[_0xa599('0x24')](function(){var _0x295060=_0x3dfbd2['get']({'plain':!![]});var _0x31692c='Pauses';return db[_0xa599('0x26')]['destroy']({'where':{'type':_0x31692c,'resourceId':_0x295060['id']}})[_0xa599('0x24')](function(){return _0x3dfbd2;});})[_0xa599('0x24')](function(){_0x30c957[_0xa599('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb53f85,_0x298674){return function(_0x541b92){if(!_0x541b92){_0xb53f85[_0xa599('0x19')](0x194);}return _0x541b92;};}function handleError(_0x445891,_0x1a0502){_0x1a0502=_0x1a0502||0x1f4;return function(_0x5caa81){logger[_0xa599('0x27')](_0x5caa81[_0xa599('0x28')]);if(_0x5caa81[_0xa599('0x29')]){delete _0x5caa81[_0xa599('0x29')];}_0x445891[_0xa599('0x1a')](_0x1a0502)['send'](_0x5caa81);};}exports[_0xa599('0x2a')]=function(_0x5c29b5,_0x1f5714){var _0x2fcd47={},_0x59dc69={},_0xfc67d5={'count':0x0,'rows':[]};var _0x57dba6=_[_0xa599('0x2b')](db[_0xa599('0x2c')][_0xa599('0x2d')],function(_0x4a3a21){return{'name':_0x4a3a21[_0xa599('0x2e')],'type':_0x4a3a21['type'][_0xa599('0x2f')]};});_0x59dc69[_0xa599('0x30')]=_[_0xa599('0x2b')](_0x57dba6,'name');_0x59dc69[_0xa599('0x31')]=_[_0xa599('0x32')](_0x5c29b5[_0xa599('0x31')]);_0x59dc69[_0xa599('0x33')]=_[_0xa599('0x34')](_0x59dc69['model'],_0x59dc69['query']);_0x2fcd47[_0xa599('0x35')]=_[_0xa599('0x34')](_0x59dc69['model'],qs[_0xa599('0x36')](_0x5c29b5[_0xa599('0x31')]['fields']));_0x2fcd47['attributes']=_0x2fcd47[_0xa599('0x35')][_0xa599('0x37')]?_0x2fcd47[_0xa599('0x35')]:_0x59dc69[_0xa599('0x30')];if(!_0x5c29b5[_0xa599('0x31')][_0xa599('0x38')](_0xa599('0x39'))){_0x2fcd47[_0xa599('0x1c')]=qs[_0xa599('0x1c')](_0x5c29b5[_0xa599('0x31')][_0xa599('0x1c')]);_0x2fcd47['offset']=qs[_0xa599('0x1f')](_0x5c29b5[_0xa599('0x31')][_0xa599('0x1f')]);}_0x2fcd47[_0xa599('0x3a')]=qs[_0xa599('0x3b')](_0x5c29b5['query'][_0xa599('0x3b')]);_0x2fcd47[_0xa599('0x3c')]=qs['filters'](_[_0xa599('0x3d')](_0x5c29b5[_0xa599('0x31')],_0x59dc69[_0xa599('0x33')]),_0x57dba6);if(_0x5c29b5[_0xa599('0x31')]['filter']){_0x2fcd47[_0xa599('0x3c')]=_[_0xa599('0x3e')](_0x2fcd47['where'],{'$or':_[_0xa599('0x2b')](_0x57dba6,function(_0x209140){if(_0x209140[_0xa599('0x3f')]!==_0xa599('0x40')){var _0x103a0f={};_0x103a0f[_0x209140['name']]={'$like':'%'+_0x5c29b5[_0xa599('0x31')][_0xa599('0x41')]+'%'};return _0x103a0f;}})});}_0x2fcd47=_[_0xa599('0x3e')]({},_0x2fcd47,_0x5c29b5[_0xa599('0x42')]);var _0x569a9b={'where':_0x2fcd47[_0xa599('0x3c')]};return db[_0xa599('0x2c')]['count'](_0x569a9b)[_0xa599('0x24')](function(_0x474fed){_0xfc67d5[_0xa599('0x1e')]=_0x474fed;if(_0x5c29b5[_0xa599('0x31')][_0xa599('0x43')]){_0x2fcd47[_0xa599('0x44')]=[{'all':!![]}];}return db['Pause'][_0xa599('0x45')](_0x2fcd47);})['then'](function(_0x481b97){_0xfc67d5[_0xa599('0x46')]=_0x481b97;return _0xfc67d5;})['then'](respondWithFilteredResult(_0x1f5714,_0x2fcd47))[_0xa599('0x47')](handleError(_0x1f5714,null));};exports[_0xa599('0x48')]=function(_0x198fcc,_0x148830){var _0x4b2771={'raw':!![],'where':{'id':_0x198fcc['params']['id']}},_0xa87a37={};_0xa87a37[_0xa599('0x30')]=_[_0xa599('0x32')](db[_0xa599('0x2c')][_0xa599('0x2d')]);_0xa87a37[_0xa599('0x31')]=_['keys'](_0x198fcc['query']);_0xa87a37[_0xa599('0x33')]=_[_0xa599('0x34')](_0xa87a37['model'],_0xa87a37[_0xa599('0x31')]);_0x4b2771[_0xa599('0x35')]=_[_0xa599('0x34')](_0xa87a37['model'],qs[_0xa599('0x36')](_0x198fcc[_0xa599('0x31')][_0xa599('0x36')]));_0x4b2771['attributes']=_0x4b2771[_0xa599('0x35')]['length']?_0x4b2771[_0xa599('0x35')]:_0xa87a37['model'];if(_0x198fcc[_0xa599('0x31')][_0xa599('0x43')]){_0x4b2771[_0xa599('0x44')]=[{'all':!![]}];}_0x4b2771=_[_0xa599('0x3e')]({},_0x4b2771,_0x198fcc[_0xa599('0x42')]);return db[_0xa599('0x2c')]['find'](_0x4b2771)[_0xa599('0x24')](handleEntityNotFound(_0x148830,null))[_0xa599('0x24')](respondWithResult(_0x148830,null))[_0xa599('0x47')](handleError(_0x148830,null));};exports[_0xa599('0x49')]=function(_0x5439a3,_0x2cf70f){return db[_0xa599('0x2c')]['create'](_0x5439a3['body'],{})[_0xa599('0x24')](function(_0x41c272){var _0x1ea215=_0x5439a3[_0xa599('0x4a')][_0xa599('0x4b')]({'plain':!![]});if(!_0x1ea215)throw new Error(_0xa599('0x4c'));if(_0x1ea215[_0xa599('0x4d')]==='user'){var _0x15e215=_0x41c272[_0xa599('0x4b')]({'plain':!![]});var _0x39167f=_0xa599('0x4e');return db[_0xa599('0x4f')][_0xa599('0x50')]({'where':{'name':_0x39167f,'userProfileId':_0x1ea215['userProfileId']},'raw':!![]})[_0xa599('0x24')](function(_0x5463ca){if(_0x5463ca&&_0x5463ca[_0xa599('0x51')]===0x0){return db[_0xa599('0x26')][_0xa599('0x49')]({'name':_0x15e215[_0xa599('0x29')],'resourceId':_0x15e215['id'],'type':_0x5463ca[_0xa599('0x29')],'sectionId':_0x5463ca['id']},{})[_0xa599('0x24')](function(){return _0x41c272;});}else{return _0x41c272;}})[_0xa599('0x47')](function(_0x2a5906){logger[_0xa599('0x27')](_0xa599('0x52'),_0x2a5906);throw _0x2a5906;});}return _0x41c272;})[_0xa599('0x24')](respondWithResult(_0x2cf70f,0xc9))[_0xa599('0x47')](handleError(_0x2cf70f,null));};exports[_0xa599('0x23')]=function(_0x49477a,_0x3b4fe2){if(_0x49477a[_0xa599('0x53')]['id']){delete _0x49477a[_0xa599('0x53')]['id'];}return db[_0xa599('0x2c')][_0xa599('0x50')]({'where':{'id':_0x49477a[_0xa599('0x54')]['id']}})[_0xa599('0x24')](handleEntityNotFound(_0x3b4fe2,null))[_0xa599('0x24')](saveUpdates(_0x49477a[_0xa599('0x53')],null))[_0xa599('0x24')](respondWithResult(_0x3b4fe2,null))[_0xa599('0x47')](handleError(_0x3b4fe2,null));};exports['destroy']=function(_0x1b9d56,_0x1904bf){return db[_0xa599('0x2c')][_0xa599('0x50')]({'where':{'id':_0x1b9d56['params']['id']}})[_0xa599('0x24')](handleEntityNotFound(_0x1904bf,null))[_0xa599('0x24')](removeEntity(_0x1904bf,null))['catch'](handleError(_0x1904bf,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 28b5721..ddd52a6 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x518020,_0xa81a23){var _0x3ea8ac=function(_0x547a71){while(--_0x547a71){_0x518020['push'](_0x518020['shift']());}};_0x3ea8ac(++_0xa81a23);}(_0xe14b,0x93));var _0xbe14=function(_0x41fccd,_0xf2588d){_0x41fccd=_0x41fccd-0x0;var _0x3d9bba=_0xe14b[_0x41fccd];return _0x3d9bba;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x25ced0,_0x717c0c){var _0x393c82=function(_0x3f3ade){while(--_0x3f3ade){_0x25ced0['push'](_0x25ced0['shift']());}};_0x393c82(++_0x717c0c);}(_0x814b,0x1a2));var _0xb814=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0x814b[_0x1177d5];return _0xc3ddc2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index a306f49..e776278 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(_0x302e2a,_0x308bfb){var _0x3c5353=function(_0x5eb606){while(--_0x5eb606){_0x302e2a['push'](_0x302e2a['shift']());}};_0x3c5353(++_0x308bfb);}(_0x7a54,0x106));var _0x47a5=function(_0x59d90a,_0x3254a2){_0x59d90a=_0x59d90a-0x0;var _0x23f6ef=_0x7a54[_0x59d90a];return _0x23f6ef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x6b44cd,_0x75984d){var _0x4be13a=function(_0x2f5426){while(--_0x2f5426){_0x6b44cd['push'](_0x6b44cd['shift']());}};_0x4be13a(++_0x75984d);}(_0x7a54,0x106));var _0x47a5=function(_0x167767,_0x336714){_0x167767=_0x167767-0x0;var _0x31b40f=_0x7a54[_0x167767];return _0x31b40f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fb545fb..cb2c8f2 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 _0x5c12=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/:id','show','download','diskStorage','join','root','originalname','basename','extname','now','upload','post','put','update','delete','exports'];(function(_0x38c27e,_0x5982ba){var _0xc6a7f2=function(_0x7e5327){while(--_0x7e5327){_0x38c27e['push'](_0x38c27e['shift']());}};_0xc6a7f2(++_0x5982ba);}(_0x5c12,0x188));var _0x25c1=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x5c12[_0x304b67];return _0x493afb;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/webhook',controller['webhookGet']);router[_0x25c1('0xb')](_0x25c1('0xc'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xb')]('/:id/download',auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);var upload=multer({'storage':multer[_0x25c1('0xf')]({'destination':function(_0x81f0f4,_0x2872b2,_0x5e44e2){_0x5e44e2(null,path[_0x25c1('0x10')](config[_0x25c1('0x11')],'server/files/plugins'));},'filename':function(_0x256ecd,_0x209af5,_0x323d3c){_0x209af5[_0x25c1('0x12')]=_0x209af5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d3c(null,util['format']('%s-%s%s',path[_0x25c1('0x13')](_0x209af5[_0x25c1('0x12')],path[_0x25c1('0x14')](_0x209af5[_0x25c1('0x12')])),Date[_0x25c1('0x15')](),path['extname'](_0x209af5[_0x25c1('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0x25c1('0x16')]);router[_0x25c1('0x17')]('/webhook',controller['webhookPost']);router[_0x25c1('0x18')]('/:id',auth[_0x25c1('0x9')](),controller[_0x25c1('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x25c1('0x1a')]);module[_0x25c1('0x1b')]=router; \ No newline at end of file +var _0x7a2c=['webhookPost','put','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','webhookGet','/:id','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x5cb09b,_0x5b2103){var _0x46ec4d=function(_0x2d243b){while(--_0x2d243b){_0x5cb09b['push'](_0x5cb09b['shift']());}};_0x46ec4d(++_0x5b2103);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x203300,_0xb59794){_0x203300=_0x203300-0x0;var _0x49c1ee=_0x7a2c[_0x203300];return _0x49c1ee;};'use strict';var multer=require(_0xc7a2('0x0'));var util=require('util');var path=require(_0xc7a2('0x1'));var timeout=require(_0xc7a2('0x2'));var express=require(_0xc7a2('0x3'));var router=express[_0xc7a2('0x4')]();var fs_extra=require(_0xc7a2('0x5'));var auth=require(_0xc7a2('0x6'));var interaction=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var controller=require('./plugin.controller');router[_0xc7a2('0x9')]('/',auth[_0xc7a2('0xa')](),controller['index']);router['get']('/webhook',controller[_0xc7a2('0xb')]);router[_0xc7a2('0x9')](_0xc7a2('0xc'),auth[_0xc7a2('0xa')](),controller['show']);router[_0xc7a2('0x9')](_0xc7a2('0xd'),auth[_0xc7a2('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xc7a2('0xe')]({'destination':function(_0x4a44c7,_0x3e216a,_0x32adcc){_0x32adcc(null,path[_0xc7a2('0xf')](config['root'],_0xc7a2('0x10')));},'filename':function(_0x28d414,_0x2df81a,_0x5871c3){_0x2df81a[_0xc7a2('0x11')]=_0x2df81a[_0xc7a2('0x11')][_0xc7a2('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5871c3(null,util[_0xc7a2('0x13')](_0xc7a2('0x14'),path[_0xc7a2('0x15')](_0x2df81a[_0xc7a2('0x11')],path[_0xc7a2('0x16')](_0x2df81a[_0xc7a2('0x11')])),Date[_0xc7a2('0x17')](),path[_0xc7a2('0x16')](_0x2df81a[_0xc7a2('0x11')])));}})});router[_0xc7a2('0x18')]('/',upload[_0xc7a2('0x19')](_0xc7a2('0x1a')),controller['upload']);router[_0xc7a2('0x18')]('/webhook',controller[_0xc7a2('0x1b')]);router[_0xc7a2('0x1c')](_0xc7a2('0xc'),auth[_0xc7a2('0xa')](),controller['update']);router['delete'](_0xc7a2('0xc'),auth[_0xc7a2('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b906989..9f2ff5e 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 _0xb462=['BOOLEAN','ENUM','adminOnly','agentOnly','always','never','STRING','sequelize','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2cae28,_0x5c213b){var _0x28a7d6=function(_0x471946){while(--_0x471946){_0x2cae28['push'](_0x2cae28['shift']());}};_0x28a7d6(++_0x5c213b);}(_0xb462,0x187));var _0x2b46=function(_0x37cbfe,_0x3c898f){_0x37cbfe=_0x37cbfe-0x0;var _0x20c2a9=_0xb462[_0x37cbfe];return _0x20c2a9;};'use strict';var Sequelize=require(_0x2b46('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x2b46('0x1'),_0x2b46('0x2'))},'description':{'type':Sequelize[_0x2b46('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x2b46('0x4')},'active':{'type':Sequelize[_0x2b46('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2b46('0x6')](_0x2b46('0x7'),_0x2b46('0x8'),_0x2b46('0x9'),_0x2b46('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x2b46('0xb')]},'agentUrl':{'type':Sequelize[_0x2b46('0xb')]},'scriptName':{'type':Sequelize[_0x2b46('0xb')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0cc5=['ENUM','html','script','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x3910cd,_0x52a135){var _0x4bd681=function(_0x453e4a){while(--_0x453e4a){_0x3910cd['push'](_0x3910cd['shift']());}};_0x4bd681(++_0x52a135);}(_0x0cc5,0x191));var _0x50cc=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x0cc5[_0x408e38];return _0x426b0e;};'use strict';var Sequelize=require(_0x50cc('0x0'));module[_0x50cc('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x50cc('0x2')](_0x50cc('0x3'),_0x50cc('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x50cc('0x5')]},'path':{'type':Sequelize[_0x50cc('0x6')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x50cc('0x7')},'sidebar':{'type':Sequelize[_0x50cc('0x2')](_0x50cc('0x8'),_0x50cc('0x9'),_0x50cc('0xa'),_0x50cc('0xb')),'defaultValue':_0x50cc('0xa'),'comment':_0x50cc('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x50cc('0x6')]},'agentUrl':{'type':Sequelize[_0x50cc('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x50cc('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 7ca2a20..80dfc68 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 _0x4cfb=['then','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','filter','options','count','includeAll','Plugin','findAll','rows','catch','show','params','intersection','include','find','download','join','root','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','format','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','json','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x4cfb,0x1c5));var _0xb4cf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4cfb[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4cf('0x0'));var zipdir=require(_0xb4cf('0x1'));var jsonpatch=require(_0xb4cf('0x2'));var rp=require(_0xb4cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb4cf('0x4'));var sox=require(_0xb4cf('0x5'));var csv=require(_0xb4cf('0x6'));var ejs=require(_0xb4cf('0x7'));var fs=require('fs');var fs_extra=require(_0xb4cf('0x8'));var _=require(_0xb4cf('0x9'));var squel=require('squel');var crypto=require(_0xb4cf('0xa'));var jsforce=require(_0xb4cf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb4cf('0x6'));var querystring=require('querystring');var Papa=require(_0xb4cf('0xc'));var extract=require(_0xb4cf('0xd'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0xb4cf('0xe'));var authService=require(_0xb4cf('0xf'));var qs=require(_0xb4cf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4cf('0x11'));var logger=require(_0xb4cf('0x12'))('api');var utils=require(_0xb4cf('0x13'));var config=require(_0xb4cf('0x14'));var licenseUtil=require(_0xb4cf('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb4cf('0x16')](config[_0xb4cf('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4cf('0x18'))(new Redis(config['redis']));require(_0xb4cf('0x19'))[_0xb4cf('0x1a')](socket);function respondWithStatusCode(_0x5138a6,_0x3b2bf0){_0x3b2bf0=_0x3b2bf0||0xcc;return function(_0xaf6fa5){if(_0xaf6fa5){return _0x5138a6[_0xb4cf('0x1b')](_0x3b2bf0);}return _0x5138a6['status'](_0x3b2bf0)['end']();};}function respondWithResult(_0x46653f,_0x3375c3){_0x3375c3=_0x3375c3||0xc8;return function(_0x4a78dc){if(_0x4a78dc){return _0x46653f[_0xb4cf('0x1c')](_0x3375c3)['json'](_0x4a78dc);}};}function respondWithFilteredResult(_0x1b579e,_0x8a5a38){return function(_0x280be6){if(_0x280be6){var _0x260907=typeof _0x8a5a38[_0xb4cf('0x1d')]===_0xb4cf('0x1e')&&typeof _0x8a5a38[_0xb4cf('0x1f')]===_0xb4cf('0x1e');var _0xa6494b=_0x280be6['count'];var _0x4aa357=_0x260907?0x0:_0x8a5a38['offset'];var _0x34ac88=_0x260907?_0x280be6['count']:_0x8a5a38[_0xb4cf('0x1d')]+_0x8a5a38[_0xb4cf('0x1f')];var _0x485472;if(_0x34ac88>=_0xa6494b){_0x34ac88=_0xa6494b;_0x485472=0xc8;}else{_0x485472=0xce;}_0x1b579e[_0xb4cf('0x1c')](_0x485472);return _0x1b579e[_0xb4cf('0x20')](_0xb4cf('0x21'),_0x4aa357+'-'+_0x34ac88+'/'+_0xa6494b)['json'](_0x280be6);}return null;};}function patchUpdates(_0xcea52c){return function(_0x4b03fb){try{jsonpatch[_0xb4cf('0x22')](_0x4b03fb,_0xcea52c,!![]);}catch(_0x5ca9b3){return BPromise[_0xb4cf('0x23')](_0x5ca9b3);}return _0x4b03fb[_0xb4cf('0x24')]();};}function saveUpdates(_0x3e4093,_0x5c0afd){return function(_0x2ab903){if(_0x2ab903){return _0x2ab903[_0xb4cf('0x25')](_0x3e4093)['then'](function(_0x465f1f){return _0x465f1f;});}return null;};}function removeEntity(_0x7d57f3,_0x72ec68){return function(_0x23ce65){if(_0x23ce65){return _0x23ce65[_0xb4cf('0x26')]()[_0xb4cf('0x27')](function(){var _0x381a6e=_0x23ce65[_0xb4cf('0x28')]({'plain':!![]});var _0x4877ad='Plugins';return db[_0xb4cf('0x29')][_0xb4cf('0x26')]({'where':{'type':_0x4877ad,'resourceId':_0x381a6e['id']}})['then'](function(){return _0x23ce65;});})[_0xb4cf('0x27')](function(){_0x7d57f3[_0xb4cf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x490ef6,_0x206004){return function(_0x40b9eb){if(!_0x40b9eb){_0x490ef6['sendStatus'](0x194);}return _0x40b9eb;};}function handleError(_0x41ee1d,_0x526bb2){_0x526bb2=_0x526bb2||0x1f4;return function(_0x1b388a){logger[_0xb4cf('0x2a')](_0x1b388a[_0xb4cf('0x2b')]);if(_0x1b388a[_0xb4cf('0x2c')]){delete _0x1b388a['name'];}_0x41ee1d[_0xb4cf('0x1c')](_0x526bb2)['send'](_0x1b388a);};}exports[_0xb4cf('0x2d')]=function(_0x20f9c4,_0x44994f){var _0x246e1c={},_0x4665ef={},_0x3a1d81={'count':0x0,'rows':[]};var _0x1cc15f=_[_0xb4cf('0x2e')](db['Plugin'][_0xb4cf('0x2f')],function(_0x145e3e){return{'name':_0x145e3e[_0xb4cf('0x30')],'type':_0x145e3e[_0xb4cf('0x31')][_0xb4cf('0x32')]};});_0x4665ef[_0xb4cf('0x33')]=_[_0xb4cf('0x2e')](_0x1cc15f,_0xb4cf('0x2c'));_0x4665ef[_0xb4cf('0x34')]=_[_0xb4cf('0x35')](_0x20f9c4[_0xb4cf('0x34')]);_0x4665ef['filters']=_['intersection'](_0x4665ef[_0xb4cf('0x33')],_0x4665ef[_0xb4cf('0x34')]);_0x246e1c[_0xb4cf('0x36')]=_['intersection'](_0x4665ef['model'],qs[_0xb4cf('0x37')](_0x20f9c4['query'][_0xb4cf('0x37')]));_0x246e1c[_0xb4cf('0x36')]=_0x246e1c[_0xb4cf('0x36')][_0xb4cf('0x38')]?_0x246e1c[_0xb4cf('0x36')]:_0x4665ef[_0xb4cf('0x33')];if(!_0x20f9c4[_0xb4cf('0x34')][_0xb4cf('0x39')]('nolimit')){_0x246e1c[_0xb4cf('0x1f')]=qs['limit'](_0x20f9c4['query']['limit']);_0x246e1c[_0xb4cf('0x1d')]=qs[_0xb4cf('0x1d')](_0x20f9c4[_0xb4cf('0x34')][_0xb4cf('0x1d')]);}_0x246e1c[_0xb4cf('0x3a')]=qs[_0xb4cf('0x3b')](_0x20f9c4[_0xb4cf('0x34')][_0xb4cf('0x3b')]);_0x246e1c[_0xb4cf('0x3c')]=qs['filters'](_[_0xb4cf('0x3d')](_0x20f9c4[_0xb4cf('0x34')],_0x4665ef[_0xb4cf('0x3e')]),_0x1cc15f);if(_0x20f9c4[_0xb4cf('0x34')]['filter']){_0x246e1c[_0xb4cf('0x3c')]=_[_0xb4cf('0x3f')](_0x246e1c['where'],{'$or':_[_0xb4cf('0x2e')](_0x1cc15f,function(_0x2cc5d7){if(_0x2cc5d7[_0xb4cf('0x31')]!=='VIRTUAL'){var _0xa89d7b={};_0xa89d7b[_0x2cc5d7[_0xb4cf('0x2c')]]={'$like':'%'+_0x20f9c4[_0xb4cf('0x34')][_0xb4cf('0x40')]+'%'};return _0xa89d7b;}})});}_0x246e1c=_['merge']({},_0x246e1c,_0x20f9c4[_0xb4cf('0x41')]);var _0x919899={'where':_0x246e1c['where']};return db['Plugin'][_0xb4cf('0x42')](_0x919899)[_0xb4cf('0x27')](function(_0x356d6a){_0x3a1d81['count']=_0x356d6a;if(_0x20f9c4[_0xb4cf('0x34')][_0xb4cf('0x43')]){_0x246e1c['include']=[{'all':!![]}];}return db[_0xb4cf('0x44')][_0xb4cf('0x45')](_0x246e1c);})['then'](function(_0x1a311d){_0x3a1d81[_0xb4cf('0x46')]=_0x1a311d;return _0x3a1d81;})['then'](respondWithFilteredResult(_0x44994f,_0x246e1c))[_0xb4cf('0x47')](handleError(_0x44994f,null));};exports[_0xb4cf('0x48')]=function(_0xc67365,_0x56fdd3){var _0x282f79={'raw':!![],'where':{'id':_0xc67365[_0xb4cf('0x49')]['id']}},_0x2998af={};_0x2998af[_0xb4cf('0x33')]=_[_0xb4cf('0x35')](db[_0xb4cf('0x44')]['rawAttributes']);_0x2998af['query']=_[_0xb4cf('0x35')](_0xc67365[_0xb4cf('0x34')]);_0x2998af[_0xb4cf('0x3e')]=_[_0xb4cf('0x4a')](_0x2998af[_0xb4cf('0x33')],_0x2998af['query']);_0x282f79['attributes']=_[_0xb4cf('0x4a')](_0x2998af[_0xb4cf('0x33')],qs['fields'](_0xc67365[_0xb4cf('0x34')][_0xb4cf('0x37')]));_0x282f79[_0xb4cf('0x36')]=_0x282f79['attributes'][_0xb4cf('0x38')]?_0x282f79[_0xb4cf('0x36')]:_0x2998af[_0xb4cf('0x33')];if(_0xc67365[_0xb4cf('0x34')]['includeAll']){_0x282f79[_0xb4cf('0x4b')]=[{'all':!![]}];}_0x282f79=_[_0xb4cf('0x3f')]({},_0x282f79,_0xc67365[_0xb4cf('0x41')]);return db['Plugin'][_0xb4cf('0x4c')](_0x282f79)[_0xb4cf('0x27')](handleEntityNotFound(_0x56fdd3,null))[_0xb4cf('0x27')](respondWithResult(_0x56fdd3,null))[_0xb4cf('0x47')](handleError(_0x56fdd3,null));};exports[_0xb4cf('0x4d')]=function(_0x2e5662,_0xd2e08c,_0x3b8886){return db[_0xb4cf('0x44')][_0xb4cf('0x4c')]({'where':{'id':_0x2e5662[_0xb4cf('0x49')]['id']},'attributes':[_0xb4cf('0x2c'),_0xb4cf('0x4')],'raw':!![]})[_0xb4cf('0x27')](handleEntityNotFound(_0xd2e08c,null))['then'](function(_0x56e9f0){if(_0x56e9f0){var _0x1da5ff=path[_0xb4cf('0x4e')](config[_0xb4cf('0x4f')],'server/files/plugins',util['format'](_0xb4cf('0x50'),path[_0xb4cf('0x51')](_0x56e9f0[_0xb4cf('0x4')])));var _0x1e84f7=fs[_0xb4cf('0x52')](_0x1da5ff);var _0x442c1a=archiver('zip',{'zlib':{'level':0x9}});_0x442c1a['on'](_0xb4cf('0x53'),function(_0x325ecf){if(_0x325ecf[_0xb4cf('0x54')]===_0xb4cf('0x55')){logger[_0xb4cf('0x2a')](_0x325ecf);}else{throw new db[(_0xb4cf('0x56'))][(_0xb4cf('0x57'))](_0xb4cf('0x58'));}});_0x442c1a['on'](_0xb4cf('0x2a'),function(_0x40891d){throw new db[(_0xb4cf('0x56'))][(_0xb4cf('0x57'))](_0xb4cf('0x58'));});_0x442c1a['pipe'](_0x1e84f7);_0x442c1a[_0xb4cf('0x59')](_0xb4cf('0x5a'),{'cwd':path['join'](config[_0xb4cf('0x4f')],'server/files/plugins',path['dirname'](_0x56e9f0[_0xb4cf('0x4')])),'ignore':[path[_0xb4cf('0x4e')](path[_0xb4cf('0x51')](_0x56e9f0['path']),_0xb4cf('0x5b')),path[_0xb4cf('0x4e')](path[_0xb4cf('0x51')](_0x56e9f0['path']),_0xb4cf('0x5c'))],'nodir':!![]})[_0xb4cf('0x5d')]();_0x1e84f7['on'](_0xb4cf('0x5e'),function(){if(!fs['existsSync'](_0x1da5ff)){throw new db[(_0xb4cf('0x56'))]['Error']('Plugin\x20not\x20found');}return _0xd2e08c['download'](_0x1da5ff,util[_0xb4cf('0x5f')](_0xb4cf('0x50'),path[_0xb4cf('0x51')](_0x56e9f0[_0xb4cf('0x4')])),function(_0x36e978){if(_0x36e978){throw new db['Sequelize'][(_0xb4cf('0x57'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb4cf('0x60')](_0x1da5ff);logger['info'](_0xb4cf('0x61'));logger['info'](_0xb4cf('0x62'));});});}return null;})[_0xb4cf('0x47')](handleError(_0xd2e08c,null));};exports[_0xb4cf('0x63')]=function(_0x75e011,_0x507ed3,_0x3e1973){var _0x4e42a1=path[_0xb4cf('0x51')](_0x75e011[_0xb4cf('0x64')][_0xb4cf('0x65')],path[_0xb4cf('0x66')](_0x75e011['file'][_0xb4cf('0x65')]));var _0x58f331=path['join'](config[_0xb4cf('0x4f')],'server/files/plugins',_0x75e011['file']['filename']);var _0x28e0b9=path[_0xb4cf('0x4e')](config[_0xb4cf('0x4f')],_0xb4cf('0x67'),_0x4e42a1);logger[_0xb4cf('0x68')](_0xb4cf('0x69'),_0x58f331);logger[_0xb4cf('0x68')](_0xb4cf('0x6a'),_0x28e0b9);try{fs[_0xb4cf('0x6b')](_0x58f331,parseInt(_0xb4cf('0x6c'),0x8));extract(_0x58f331,{'dir':_0x28e0b9},function(_0x2d05d6){if(_0x2d05d6){logger[_0xb4cf('0x2a')](_0x2d05d6);handleError(_0x2d05d6,!![]);};var _0x34366b=fs[_0xb4cf('0x6d')](_0x28e0b9);if(_0x34366b[_0xb4cf('0x38')]>0x1){removeReferences(_0x58f331,_0x28e0b9);logger[_0xb4cf('0x2a')](_0xb4cf('0x6e'));return _0x3e1973(new Error(_0xb4cf('0x6e')));}var _0x4f1d99=fs[_0xb4cf('0x6f')](path[_0xb4cf('0x4e')](_0x28e0b9,_0x34366b[0x0]));if(_0x4f1d99['isFile']()){removeReferences(_0x58f331,_0x28e0b9);logger[_0xb4cf('0x2a')](_0xb4cf('0x6e'));return _0x3e1973(new Error(_0xb4cf('0x6e')));}if(_0x4f1d99['isDirectory']()){var _0x5ab10d=fs[_0xb4cf('0x6d')](path['join'](_0x28e0b9,_0x34366b[0x0]));if(_0x5ab10d[_0xb4cf('0x38')]===0x0){removeReferences(_0x58f331,_0x28e0b9);logger['error'](_0xb4cf('0x6e'));return _0x3e1973(new Error(_0xb4cf('0x6e')));}var _0x441dee=_0x5ab10d[_0xb4cf('0x70')](function(_0x3d2844){return _0x3d2844==='manifest.json';});if(!_0x441dee){return _0x3e1973(new Error(_0xb4cf('0x71')));}var _0x1df010=fs[_0xb4cf('0x72')](path[_0xb4cf('0x4e')](_0x28e0b9,_0x34366b[0x0],_0xb4cf('0x73')));var _0x3aad79=JSON['parse'](_0x1df010);if(_0xb4cf('0x1e')==typeof _0x3aad79['name']){return _0x3e1973(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb4cf('0x1e')==typeof _0x3aad79[_0xb4cf('0x31')]){return _0x3e1973(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb4cf('0x1e')==typeof _0x3aad79['version']){return _0x3e1973(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb4cf('0x1e')==typeof _0x3aad79['parameters']){return _0x3e1973(new Error(_0xb4cf('0x74')));}if(_0x3aad79[_0xb4cf('0x31')]===_0xb4cf('0x75')){if(_0xb4cf('0x1e')==typeof _0x3aad79[_0xb4cf('0x76')]['views']){return _0x3e1973(new Error(_0xb4cf('0x77')));}if(_0xb4cf('0x1e')==typeof _0x3aad79['parameters'][_0xb4cf('0x78')][_0xb4cf('0x79')]&&'undefined'==typeof _0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x78')]['agent']){return _0x3e1973(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3aad79[_0xb4cf('0x31')]===_0xb4cf('0x7a')){if(_0xb4cf('0x1e')==typeof _0x3aad79['parameters'][_0xb4cf('0x7b')]){return _0x3e1973(new Error(_0xb4cf('0x7c')));}if(_0xb4cf('0x1e')==typeof _0x3aad79['parameters'][_0xb4cf('0x7d')]){return _0x3e1973(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3e1973(new Error(_0xb4cf('0x7e')));}var _0x19cc2c=_0x3aad79[_0xb4cf('0x2c')];var _0x35c07a=_0x3aad79[_0xb4cf('0x7f')];var _0x1fd690=_0x3aad79[_0xb4cf('0x31')];var _0x1dd85d=_0x3aad79['sidebar']?_0x3aad79[_0xb4cf('0x80')]:_0xb4cf('0x81');var _0x9c3b5f=_0x3aad79[_0xb4cf('0x82')]?_0x3aad79[_0xb4cf('0x82')]:_0xb4cf('0x83');var _0x542985='';var _0x4812ab='';var _0x1174db='';var _0x2f334f='';var _0x45c0a0=_0x3aad79['version'];if(_0x1fd690===_0xb4cf('0x75')){if('undefined'!=typeof _0x3aad79[_0xb4cf('0x76')]['views'][_0xb4cf('0x79')]){var _0x5d975d=_0x3aad79['parameters'][_0xb4cf('0x78')][_0xb4cf('0x79')];if(!/^(f|ht)tps?:\/\//i[_0xb4cf('0x84')](_0x5d975d)){_0x542985=path[_0xb4cf('0x4e')]('plugins',_0x4e42a1,_0x34366b[0x0],_0x5d975d);}else{_0x542985=_0x5d975d;}}else{logger[_0xb4cf('0x68')](_0xb4cf('0x85'));}if('undefined'!=typeof _0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x78')][_0xb4cf('0x86')]){var _0x1168c2=_0x3aad79['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1168c2)){_0x4812ab=path[_0xb4cf('0x4e')](_0xb4cf('0x87'),_0x4e42a1,_0x34366b[0x0],_0x1168c2);}else{_0x4812ab=_0x1168c2;}}else{logger[_0xb4cf('0x68')](_0xb4cf('0x88'));}}else if(_0x1fd690===_0xb4cf('0x7a')){_0x1174db=_0x3aad79['parameters'][_0xb4cf('0x7b')];_0x2f334f=_0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x7d')];if(_0xb4cf('0x1e')!=typeof _0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x78')]){if(_0xb4cf('0x1e')!=typeof _0x3aad79[_0xb4cf('0x76')]['views'][_0xb4cf('0x79')]){var _0x5d975d=_0x3aad79['parameters'][_0xb4cf('0x78')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5d975d)){_0x542985=path[_0xb4cf('0x4e')]('plugins',_0x4e42a1,_0x34366b[0x0],_0x5d975d);}else{_0x542985=_0x5d975d;}}if(_0xb4cf('0x1e')!=typeof _0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x78')][_0xb4cf('0x86')]){var _0x1168c2=_0x3aad79[_0xb4cf('0x76')][_0xb4cf('0x78')][_0xb4cf('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xb4cf('0x84')](_0x1168c2)){_0x4812ab=path[_0xb4cf('0x4e')](_0xb4cf('0x87'),_0x4e42a1,_0x34366b[0x0],_0x1168c2);}else{_0x4812ab=_0x1168c2;}}}}var _0x2becb8={'name':_0x19cc2c,'description':_0x35c07a,'path':path['join'](_0x4e42a1,_0x34366b[0x0]),'type':_0x1fd690,'sidebar':_0x1dd85d,'icon':_0x9c3b5f,'adminUrl':_0x542985,'agentUrl':_0x4812ab,'scriptName':_0x1174db,'scriptPath':_0x2f334f,'version':_0x45c0a0};removeReferences(_0x58f331,null);return db[_0xb4cf('0x44')][_0xb4cf('0x89')](_0x2becb8)[_0xb4cf('0x27')](function(_0x51f421){var _0x52bc84={'role':_0x75e011[_0xb4cf('0x8a')][_0xb4cf('0x8b')],'userProfileId':_0x75e011[_0xb4cf('0x8a')][_0xb4cf('0x8c')]};if(!_0x52bc84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52bc84[_0xb4cf('0x8b')]===_0xb4cf('0x8d')){var _0x15e7b2=_0x51f421[_0xb4cf('0x28')]({'plain':!![]});return db[_0xb4cf('0x8e')][_0xb4cf('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x52bc84[_0xb4cf('0x8c')]},'raw':!![]})['then'](function(_0xbdb8d){if(_0xbdb8d&&_0xbdb8d['autoAssociation']===0x0){return db[_0xb4cf('0x29')][_0xb4cf('0x89')]({'name':_0x15e7b2[_0xb4cf('0x2c')],'resourceId':_0x15e7b2['id'],'type':_0xbdb8d[_0xb4cf('0x2c')],'sectionId':_0xbdb8d['id']},{})[_0xb4cf('0x27')](function(){return _0x51f421;});}else{return _0x51f421;}})[_0xb4cf('0x47')](function(_0x2dc1cc){logger['error'](_0xb4cf('0x8f'),_0x2dc1cc);throw _0x2dc1cc;});}return _0x51f421;})['then'](respondWithResult(_0x507ed3,null))[_0xb4cf('0x47')](handleError(_0x507ed3,null));}});}catch(_0x44cb6c){_0x507ed3[_0xb4cf('0x1c')](0x1f4)[_0xb4cf('0x90')](_0x44cb6c);}};function removeReferences(_0x3ea8dc,_0x2dc603){try{if(_0x3ea8dc){fs['unlinkSync'](_0x3ea8dc);logger[_0xb4cf('0x68')](_0xb4cf('0x91'));}if(_0x2dc603){rimraf(_0x2dc603,function(){});logger['info'](_0xb4cf('0x92'));}}catch(_0x5bc637){logger[_0xb4cf('0x2a')](_0x5bc637);}}exports[_0xb4cf('0x25')]=function(_0x51982e,_0x1e62fa,_0xef831d){return db[_0xb4cf('0x44')][_0xb4cf('0x4c')]({'where':{'id':_0x51982e[_0xb4cf('0x49')]['id']}})[_0xb4cf('0x27')](handleEntityNotFound(_0x1e62fa,null))['then'](saveUpdates(_0x51982e[_0xb4cf('0x8a')],null))[_0xb4cf('0x27')](respondWithResult(_0x1e62fa,null))['catch'](handleError(_0x1e62fa,null));};exports[_0xb4cf('0x93')]=function(_0x56d275,_0x3469a8,_0x542564){return db['Plugin'][_0xb4cf('0x4c')]({'where':{'id':_0x56d275[_0xb4cf('0x49')]['id']}})[_0xb4cf('0x27')](function(_0x403b34){if(_0x403b34){return _0x403b34['destroy']();}})[_0xb4cf('0x27')](function(_0x10ac5a){rimraf(path[_0xb4cf('0x4e')](config[_0xb4cf('0x4f')],_0xb4cf('0x67'),path[_0xb4cf('0x94')](_0x10ac5a[_0xb4cf('0x4')])),function(){});return _0x10ac5a;})[_0xb4cf('0x27')](handleEntityNotFound(_0x3469a8,null))[_0xb4cf('0x27')](respondWithStatusCode(_0x3469a8,null))['catch'](handleError(_0x3469a8,null));};exports['webhookGet']=function(_0x1f3f63,_0x5411b2,_0x151e4b){return BPromise[_0xb4cf('0x95')]()[_0xb4cf('0x27')](function(){if(!_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x4')]){throw new Error(_0xb4cf('0x96'));}if(!_0x1f3f63[_0xb4cf('0x34')]['port']){throw new Error(_0xb4cf('0x97'));}var _0x5f9fc4=_0x1f3f63['query'][_0xb4cf('0x98')]?_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x98')]+':'+_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x99')]:'http://localhost:'+_0x1f3f63['query']['port'];var _0xd9a3d4=_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x9a')]?_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x9a')]:!![];var _0x5521f6=_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x9b')]?_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x9b')]:null;var _0xff7e5c={'method':_0x1f3f63[_0xb4cf('0x9c')],'uri':util[_0xb4cf('0x5f')]('%s%s',_0x5f9fc4,_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x4')]),'json':_0xd9a3d4,'resolveWithFullResponse':!![],'encoding':_0x5521f6,'qs':_0x1f3f63['query']};if(_0x1f3f63[_0xb4cf('0x9d')]){_0xff7e5c[_0xb4cf('0x9d')]=_0x1f3f63[_0xb4cf('0x9d')];if(_0xff7e5c['headers'][_0xb4cf('0x9e')]){delete _0xff7e5c[_0xb4cf('0x9d')][_0xb4cf('0x9e')];}}if(_0xff7e5c[_0xb4cf('0x9d')][_0xb4cf('0x9f')]){delete _0xff7e5c[_0xb4cf('0x9d')][_0xb4cf('0x9f')];}return rp(_0xff7e5c);})[_0xb4cf('0x27')](function(_0x34aa17){if(_0x34aa17){_0x5411b2[_0xb4cf('0x20')](_0x34aa17[_0xb4cf('0x9d')]);logger[_0xb4cf('0x68')](_0x34aa17[_0xb4cf('0x8a')]);if(_[_0xb4cf('0xa0')](_0x1f3f63[_0xb4cf('0x34')][_0xb4cf('0x4')],'download')&&_0x34aa17['statusCode']==0x1f4){return _0x5411b2['sendStatus'](_0x34aa17['statusCode']);}else{return _0x5411b2[_0xb4cf('0x1c')](_0x34aa17[_0xb4cf('0xa1')])[_0xb4cf('0x90')](_0x34aa17[_0xb4cf('0x8a')]);}}else{return _0x5411b2['sendStatus'](0xc8);}})[_0xb4cf('0x47')](handleError(_0x5411b2,null));};exports[_0xb4cf('0xa2')]=function(_0x193d31,_0x25e6b6,_0x24324b){return BPromise[_0xb4cf('0x95')]()[_0xb4cf('0x27')](function(){if(!_0x193d31[_0xb4cf('0x34')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x193d31[_0xb4cf('0x34')]['port']){throw new Error(_0xb4cf('0x97'));}var _0x2bfe15=_0x193d31['query'][_0xb4cf('0x98')]?_0x193d31[_0xb4cf('0x34')]['hostname']+':'+_0x193d31['query'][_0xb4cf('0x99')]:_0xb4cf('0xa3')+_0x193d31['query'][_0xb4cf('0x99')];var _0x17d0cc=_0x193d31[_0xb4cf('0x34')][_0xb4cf('0x9a')]?_0x193d31[_0xb4cf('0x34')][_0xb4cf('0x9a')]:!![];var _0x101c21=_0x193d31['query'][_0xb4cf('0x9b')]?_0x193d31[_0xb4cf('0x34')]['encoding']:null;var _0x20bdc9={'method':_0x193d31[_0xb4cf('0x9c')],'uri':util[_0xb4cf('0x5f')]('%s%s',_0x2bfe15,_0x193d31[_0xb4cf('0x34')][_0xb4cf('0x4')]),'json':_0x17d0cc,'resolveWithFullResponse':!![],'encoding':_0x101c21,'body':_0x193d31[_0xb4cf('0x8a')]};if(_0x193d31['headers']){_0x20bdc9[_0xb4cf('0x9d')]=_0x193d31[_0xb4cf('0x9d')];if(_0x20bdc9['headers']['content-length']){delete _0x20bdc9[_0xb4cf('0x9d')][_0xb4cf('0x9e')];}}if(_0x20bdc9[_0xb4cf('0x9d')][_0xb4cf('0x9f')]){delete _0x20bdc9[_0xb4cf('0x9d')][_0xb4cf('0x9f')];}return rp(_0x20bdc9);})[_0xb4cf('0x27')](function(_0x22b7e9){if(_0x22b7e9){_0x25e6b6[_0xb4cf('0x20')](_0x22b7e9[_0xb4cf('0x9d')]);logger[_0xb4cf('0x68')](_0x22b7e9[_0xb4cf('0x8a')]);return _0x25e6b6[_0xb4cf('0x1c')](_0x22b7e9['statusCode'])[_0xb4cf('0x90')](_0x22b7e9[_0xb4cf('0x8a')]);}else{return _0x25e6b6[_0xb4cf('0x1b')](0xc8);}})[_0xb4cf('0x47')](handleError(_0x25e6b6,null));}; \ No newline at end of file +var _0x7c7a=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','basename','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','reject','update','then','Plugins','destroy','error','stack','name','send','index','Plugin','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','createWriteStream','zip','warning','code'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x7c7a,0xfc));var _0xa7c7=function(_0x58b449,_0x5d7b77){_0x58b449=_0x58b449-0x0;var _0x483bdb=_0x7c7a[_0x58b449];return _0x483bdb;};'use strict';var emlformat=require(_0xa7c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7c7('0x1'));var jsonpatch=require(_0xa7c7('0x2'));var rp=require(_0xa7c7('0x3'));var moment=require(_0xa7c7('0x4'));var BPromise=require(_0xa7c7('0x5'));var Mustache=require(_0xa7c7('0x6'));var util=require('util');var path=require(_0xa7c7('0x7'));var sox=require('sox');var csv=require(_0xa7c7('0x8'));var ejs=require(_0xa7c7('0x9'));var fs=require('fs');var fs_extra=require(_0xa7c7('0xa'));var _=require(_0xa7c7('0xb'));var squel=require(_0xa7c7('0xc'));var crypto=require(_0xa7c7('0xd'));var jsforce=require(_0xa7c7('0xe'));var deskjs=require(_0xa7c7('0xf'));var toCsv=require(_0xa7c7('0x8'));var querystring=require(_0xa7c7('0x10'));var Papa=require(_0xa7c7('0x11'));var extract=require(_0xa7c7('0x12'));var rimraf=require('rimraf');var archiver=require(_0xa7c7('0x13'));var Redis=require(_0xa7c7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xa7c7('0x15'));var as=require(_0xa7c7('0x16'));var hardwareService=require(_0xa7c7('0x17'));var logger=require(_0xa7c7('0x18'))(_0xa7c7('0x19'));var utils=require(_0xa7c7('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa7c7('0x1b'));var db=require(_0xa7c7('0x1c'))['db'];config[_0xa7c7('0x1d')]=_[_0xa7c7('0x1e')](config[_0xa7c7('0x1d')],{'host':_0xa7c7('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7c7('0x1d')]));require(_0xa7c7('0x20'))['register'](socket);function respondWithStatusCode(_0x52b407,_0x25ed67){_0x25ed67=_0x25ed67||0xcc;return function(_0xd155a5){if(_0xd155a5){return _0x52b407[_0xa7c7('0x21')](_0x25ed67);}return _0x52b407[_0xa7c7('0x22')](_0x25ed67)[_0xa7c7('0x23')]();};}function respondWithResult(_0x829d9,_0x4b0c3e){_0x4b0c3e=_0x4b0c3e||0xc8;return function(_0x592650){if(_0x592650){return _0x829d9[_0xa7c7('0x22')](_0x4b0c3e)[_0xa7c7('0x24')](_0x592650);}};}function respondWithFilteredResult(_0x379baa,_0x1ba80a){return function(_0x31ca71){if(_0x31ca71){var _0x16210b=typeof _0x1ba80a['offset']===_0xa7c7('0x25')&&typeof _0x1ba80a['limit']===_0xa7c7('0x25');var _0x3958b3=_0x31ca71['count'];var _0x57766d=_0x16210b?0x0:_0x1ba80a[_0xa7c7('0x26')];var _0x3b173f=_0x16210b?_0x31ca71['count']:_0x1ba80a[_0xa7c7('0x26')]+_0x1ba80a[_0xa7c7('0x27')];var _0x2062bb;if(_0x3b173f>=_0x3958b3){_0x3b173f=_0x3958b3;_0x2062bb=0xc8;}else{_0x2062bb=0xce;}_0x379baa[_0xa7c7('0x22')](_0x2062bb);return _0x379baa['set'](_0xa7c7('0x28'),_0x57766d+'-'+_0x3b173f+'/'+_0x3958b3)[_0xa7c7('0x24')](_0x31ca71);}return null;};}function patchUpdates(_0x1a7f2b){return function(_0x44360f){try{jsonpatch[_0xa7c7('0x29')](_0x44360f,_0x1a7f2b,!![]);}catch(_0x33a84c){return BPromise[_0xa7c7('0x2a')](_0x33a84c);}return _0x44360f['save']();};}function saveUpdates(_0x1c1459,_0x1fc7e8){return function(_0x2109a7){if(_0x2109a7){return _0x2109a7[_0xa7c7('0x2b')](_0x1c1459)[_0xa7c7('0x2c')](function(_0x105f73){return _0x105f73;});}return null;};}function removeEntity(_0x44da21,_0x42f631){return function(_0x454a06){if(_0x454a06){return _0x454a06['destroy']()[_0xa7c7('0x2c')](function(){var _0x24750f=_0x454a06['get']({'plain':!![]});var _0x1e88a9=_0xa7c7('0x2d');return db['UserProfileResource'][_0xa7c7('0x2e')]({'where':{'type':_0x1e88a9,'resourceId':_0x24750f['id']}})[_0xa7c7('0x2c')](function(){return _0x454a06;});})['then'](function(){_0x44da21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x211917,_0x36167c){return function(_0x574aab){if(!_0x574aab){_0x211917[_0xa7c7('0x21')](0x194);}return _0x574aab;};}function handleError(_0x147f88,_0x5e134c){_0x5e134c=_0x5e134c||0x1f4;return function(_0x30060b){logger[_0xa7c7('0x2f')](_0x30060b[_0xa7c7('0x30')]);if(_0x30060b[_0xa7c7('0x31')]){delete _0x30060b['name'];}_0x147f88[_0xa7c7('0x22')](_0x5e134c)[_0xa7c7('0x32')](_0x30060b);};}exports[_0xa7c7('0x33')]=function(_0x5bf85e,_0xea95d4){var _0x40209b={},_0x3a9d61={},_0x7c4431={'count':0x0,'rows':[]};var _0x17e1ce=_['map'](db[_0xa7c7('0x34')][_0xa7c7('0x35')],function(_0x3ae361){return{'name':_0x3ae361['fieldName'],'type':_0x3ae361['type'][_0xa7c7('0x36')]};});_0x3a9d61[_0xa7c7('0x37')]=_[_0xa7c7('0x38')](_0x17e1ce,'name');_0x3a9d61[_0xa7c7('0x39')]=_[_0xa7c7('0x3a')](_0x5bf85e['query']);_0x3a9d61[_0xa7c7('0x3b')]=_[_0xa7c7('0x3c')](_0x3a9d61[_0xa7c7('0x37')],_0x3a9d61[_0xa7c7('0x39')]);_0x40209b[_0xa7c7('0x3d')]=_[_0xa7c7('0x3c')](_0x3a9d61[_0xa7c7('0x37')],qs['fields'](_0x5bf85e[_0xa7c7('0x39')][_0xa7c7('0x3e')]));_0x40209b['attributes']=_0x40209b['attributes'][_0xa7c7('0x3f')]?_0x40209b[_0xa7c7('0x3d')]:_0x3a9d61[_0xa7c7('0x37')];if(!_0x5bf85e[_0xa7c7('0x39')][_0xa7c7('0x40')](_0xa7c7('0x41'))){_0x40209b['limit']=qs[_0xa7c7('0x27')](_0x5bf85e[_0xa7c7('0x39')][_0xa7c7('0x27')]);_0x40209b[_0xa7c7('0x26')]=qs[_0xa7c7('0x26')](_0x5bf85e[_0xa7c7('0x39')][_0xa7c7('0x26')]);}_0x40209b['order']=qs[_0xa7c7('0x42')](_0x5bf85e['query'][_0xa7c7('0x42')]);_0x40209b[_0xa7c7('0x43')]=qs[_0xa7c7('0x3b')](_[_0xa7c7('0x44')](_0x5bf85e[_0xa7c7('0x39')],_0x3a9d61['filters']),_0x17e1ce);if(_0x5bf85e[_0xa7c7('0x39')]['filter']){_0x40209b['where']=_[_0xa7c7('0x45')](_0x40209b['where'],{'$or':_[_0xa7c7('0x38')](_0x17e1ce,function(_0x6073b2){if(_0x6073b2[_0xa7c7('0x46')]!==_0xa7c7('0x47')){var _0xf27358={};_0xf27358[_0x6073b2[_0xa7c7('0x31')]]={'$like':'%'+_0x5bf85e['query']['filter']+'%'};return _0xf27358;}})});}_0x40209b=_[_0xa7c7('0x45')]({},_0x40209b,_0x5bf85e[_0xa7c7('0x48')]);var _0x1c26c0={'where':_0x40209b[_0xa7c7('0x43')]};return db[_0xa7c7('0x34')][_0xa7c7('0x49')](_0x1c26c0)['then'](function(_0x2a8ee3){_0x7c4431['count']=_0x2a8ee3;if(_0x5bf85e[_0xa7c7('0x39')][_0xa7c7('0x4a')]){_0x40209b[_0xa7c7('0x4b')]=[{'all':!![]}];}return db[_0xa7c7('0x34')][_0xa7c7('0x4c')](_0x40209b);})[_0xa7c7('0x2c')](function(_0x48c241){_0x7c4431['rows']=_0x48c241;return _0x7c4431;})['then'](respondWithFilteredResult(_0xea95d4,_0x40209b))[_0xa7c7('0x4d')](handleError(_0xea95d4,null));};exports[_0xa7c7('0x4e')]=function(_0x11293d,_0x13f807){var _0x1a26e1={'raw':!![],'where':{'id':_0x11293d[_0xa7c7('0x4f')]['id']}},_0x38334a={};_0x38334a[_0xa7c7('0x37')]=_[_0xa7c7('0x3a')](db[_0xa7c7('0x34')][_0xa7c7('0x35')]);_0x38334a[_0xa7c7('0x39')]=_[_0xa7c7('0x3a')](_0x11293d[_0xa7c7('0x39')]);_0x38334a[_0xa7c7('0x3b')]=_[_0xa7c7('0x3c')](_0x38334a[_0xa7c7('0x37')],_0x38334a[_0xa7c7('0x39')]);_0x1a26e1[_0xa7c7('0x3d')]=_[_0xa7c7('0x3c')](_0x38334a[_0xa7c7('0x37')],qs[_0xa7c7('0x3e')](_0x11293d[_0xa7c7('0x39')]['fields']));_0x1a26e1['attributes']=_0x1a26e1[_0xa7c7('0x3d')][_0xa7c7('0x3f')]?_0x1a26e1[_0xa7c7('0x3d')]:_0x38334a[_0xa7c7('0x37')];if(_0x11293d[_0xa7c7('0x39')]['includeAll']){_0x1a26e1[_0xa7c7('0x4b')]=[{'all':!![]}];}_0x1a26e1=_[_0xa7c7('0x45')]({},_0x1a26e1,_0x11293d[_0xa7c7('0x48')]);return db['Plugin'][_0xa7c7('0x50')](_0x1a26e1)[_0xa7c7('0x2c')](handleEntityNotFound(_0x13f807,null))[_0xa7c7('0x2c')](respondWithResult(_0x13f807,null))['catch'](handleError(_0x13f807,null));};exports[_0xa7c7('0x51')]=function(_0x48d5ca,_0x5759a6,_0x2d7620){return db[_0xa7c7('0x34')][_0xa7c7('0x50')]({'where':{'id':_0x48d5ca[_0xa7c7('0x4f')]['id']},'attributes':[_0xa7c7('0x31'),_0xa7c7('0x7')],'raw':!![]})[_0xa7c7('0x2c')](handleEntityNotFound(_0x5759a6,null))[_0xa7c7('0x2c')](function(_0x11f931){if(_0x11f931){var _0x10a27b=path[_0xa7c7('0x52')](config[_0xa7c7('0x53')],_0xa7c7('0x54'),util['format'](_0xa7c7('0x55'),path['basename'](_0x11f931[_0xa7c7('0x7')])));var _0x281414=fs[_0xa7c7('0x56')](_0x10a27b);var _0x569fe9=archiver(_0xa7c7('0x57'),{'zlib':{'level':0x9}});_0x569fe9['on'](_0xa7c7('0x58'),function(_0x49757d){if(_0x49757d[_0xa7c7('0x59')]==='ENOENT'){logger[_0xa7c7('0x2f')](_0x49757d);}else{throw new db[(_0xa7c7('0x5a'))][(_0xa7c7('0x5b'))](_0xa7c7('0x5c'));}});_0x569fe9['on']('error',function(_0x4504e6){throw new db[(_0xa7c7('0x5a'))][(_0xa7c7('0x5b'))](_0xa7c7('0x5c'));});_0x569fe9['pipe'](_0x281414);_0x569fe9[_0xa7c7('0x5d')](_0xa7c7('0x5e'),{'cwd':path[_0xa7c7('0x52')](config[_0xa7c7('0x53')],'server/files/plugins',path[_0xa7c7('0x5f')](_0x11f931[_0xa7c7('0x7')])),'ignore':[path['join'](path['basename'](_0x11f931[_0xa7c7('0x7')]),_0xa7c7('0x60')),path[_0xa7c7('0x52')](path[_0xa7c7('0x61')](_0x11f931[_0xa7c7('0x7')]),_0xa7c7('0x62'))],'nodir':!![]})[_0xa7c7('0x63')]();_0x281414['on']('close',function(){if(!fs[_0xa7c7('0x64')](_0x10a27b)){throw new db[(_0xa7c7('0x5a'))][(_0xa7c7('0x5b'))](_0xa7c7('0x65'));}return _0x5759a6[_0xa7c7('0x51')](_0x10a27b,util[_0xa7c7('0x66')](_0xa7c7('0x55'),path[_0xa7c7('0x61')](_0x11f931[_0xa7c7('0x7')])),function(_0x5d0ef8){if(_0x5d0ef8){throw new db[(_0xa7c7('0x5a'))][(_0xa7c7('0x5b'))](_0xa7c7('0x67'));}fs['unlinkSync'](_0x10a27b);logger[_0xa7c7('0x68')](_0xa7c7('0x69'));logger[_0xa7c7('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0xa7c7('0x4d')](handleError(_0x5759a6,null));};exports[_0xa7c7('0x6a')]=function(_0x56178c,_0x5dfb58,_0x451f3e){var _0x846b19=path[_0xa7c7('0x61')](_0x56178c[_0xa7c7('0x6b')][_0xa7c7('0x6c')],path[_0xa7c7('0x6d')](_0x56178c['file'][_0xa7c7('0x6c')]));var _0x4f6a68=path[_0xa7c7('0x52')](config[_0xa7c7('0x53')],_0xa7c7('0x54'),_0x56178c[_0xa7c7('0x6b')][_0xa7c7('0x6c')]);var _0x3e83af=path[_0xa7c7('0x52')](config[_0xa7c7('0x53')],_0xa7c7('0x54'),_0x846b19);logger['info'](_0xa7c7('0x6e'),_0x4f6a68);logger[_0xa7c7('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x3e83af);try{fs[_0xa7c7('0x6f')](_0x4f6a68,parseInt(_0xa7c7('0x70'),0x8));extract(_0x4f6a68,{'dir':_0x3e83af},function(_0xa4c551){if(_0xa4c551){logger[_0xa7c7('0x2f')](_0xa4c551);handleError(_0xa4c551,!![]);};var _0x5ef282=fs['readdirSync'](_0x3e83af);if(_0x5ef282['length']>0x1){removeReferences(_0x4f6a68,_0x3e83af);logger[_0xa7c7('0x2f')](_0xa7c7('0x71'));return _0x451f3e(new Error(_0xa7c7('0x71')));}var _0x2f3c70=fs[_0xa7c7('0x72')](path[_0xa7c7('0x52')](_0x3e83af,_0x5ef282[0x0]));if(_0x2f3c70['isFile']()){removeReferences(_0x4f6a68,_0x3e83af);logger['error'](_0xa7c7('0x71'));return _0x451f3e(new Error(_0xa7c7('0x71')));}if(_0x2f3c70[_0xa7c7('0x73')]()){var _0x189af4=fs[_0xa7c7('0x74')](path[_0xa7c7('0x52')](_0x3e83af,_0x5ef282[0x0]));if(_0x189af4[_0xa7c7('0x3f')]===0x0){removeReferences(_0x4f6a68,_0x3e83af);logger[_0xa7c7('0x2f')]('Invalid\x20plugin\x20structure');return _0x451f3e(new Error('Invalid\x20plugin\x20structure'));}var _0x8cbf49=_0x189af4['some'](function(_0x4c1ae8){return _0x4c1ae8===_0xa7c7('0x75');});if(!_0x8cbf49){return _0x451f3e(new Error(_0xa7c7('0x76')));}var _0x923dab=fs[_0xa7c7('0x77')](path[_0xa7c7('0x52')](_0x3e83af,_0x5ef282[0x0],_0xa7c7('0x75')));var _0x581f0d=JSON[_0xa7c7('0x78')](_0x923dab);if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x31')]){return _0x451f3e(new Error(_0xa7c7('0x79')));}if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x46')]){return _0x451f3e(new Error(_0xa7c7('0x7a')));}if('undefined'==typeof _0x581f0d['version']){return _0x451f3e(new Error(_0xa7c7('0x7b')));}if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')]){return _0x451f3e(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x581f0d['type']===_0xa7c7('0x7d')){if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')]){return _0x451f3e(new Error(_0xa7c7('0x7f')));}if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')]['admin']&&_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')]['agent']){return _0x451f3e(new Error(_0xa7c7('0x80')));}}else if(_0x581f0d[_0xa7c7('0x46')]===_0xa7c7('0x81')){if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x82')]){return _0x451f3e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xa7c7('0x25')==typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x83')]){return _0x451f3e(new Error(_0xa7c7('0x84')));}}else{return _0x451f3e(new Error(_0xa7c7('0x85')));}var _0x30aa61=_0x581f0d['name'];var _0x148493=_0x581f0d[_0xa7c7('0x86')];var _0x114af9=_0x581f0d['type'];var _0x56e21=_0x581f0d[_0xa7c7('0x87')]?_0x581f0d[_0xa7c7('0x87')]:_0xa7c7('0x88');var _0x230f74=_0x581f0d[_0xa7c7('0x89')]?_0x581f0d[_0xa7c7('0x89')]:_0xa7c7('0x8a');var _0x2eb046='';var _0x2311ca='';var _0x52a432='';var _0x3a7a3a='';var _0x505e07=_0x581f0d[_0xa7c7('0x8b')];if(_0x114af9===_0xa7c7('0x7d')){if(_0xa7c7('0x25')!=typeof _0x581f0d[_0xa7c7('0x7c')]['views'][_0xa7c7('0x8c')]){var _0x58a70e=_0x581f0d['parameters'][_0xa7c7('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa7c7('0x8d')](_0x58a70e)){_0x2eb046=path[_0xa7c7('0x52')](_0xa7c7('0x8e'),_0x846b19,_0x5ef282[0x0],_0x58a70e);}else{_0x2eb046=_0x58a70e;}}else{logger['info'](_0xa7c7('0x8f'));}if('undefined'!=typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')][_0xa7c7('0x90')]){var _0x1e8607=_0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')][_0xa7c7('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xa7c7('0x8d')](_0x1e8607)){_0x2311ca=path['join'](_0xa7c7('0x8e'),_0x846b19,_0x5ef282[0x0],_0x1e8607);}else{_0x2311ca=_0x1e8607;}}else{logger[_0xa7c7('0x68')](_0xa7c7('0x91'));}}else if(_0x114af9===_0xa7c7('0x81')){_0x52a432=_0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x82')];_0x3a7a3a=_0x581f0d['parameters'][_0xa7c7('0x83')];if(_0xa7c7('0x25')!=typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')]){if(_0xa7c7('0x25')!=typeof _0x581f0d[_0xa7c7('0x7c')]['views'][_0xa7c7('0x8c')]){var _0x58a70e=_0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')][_0xa7c7('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xa7c7('0x8d')](_0x58a70e)){_0x2eb046=path[_0xa7c7('0x52')]('plugins',_0x846b19,_0x5ef282[0x0],_0x58a70e);}else{_0x2eb046=_0x58a70e;}}if(_0xa7c7('0x25')!=typeof _0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')][_0xa7c7('0x90')]){var _0x1e8607=_0x581f0d[_0xa7c7('0x7c')][_0xa7c7('0x7e')][_0xa7c7('0x90')];if(!/^(f|ht)tps?:\/\//i[_0xa7c7('0x8d')](_0x1e8607)){_0x2311ca=path[_0xa7c7('0x52')]('plugins',_0x846b19,_0x5ef282[0x0],_0x1e8607);}else{_0x2311ca=_0x1e8607;}}}}var _0x27d761={'name':_0x30aa61,'description':_0x148493,'path':path[_0xa7c7('0x52')](_0x846b19,_0x5ef282[0x0]),'type':_0x114af9,'sidebar':_0x56e21,'icon':_0x230f74,'adminUrl':_0x2eb046,'agentUrl':_0x2311ca,'scriptName':_0x52a432,'scriptPath':_0x3a7a3a,'version':_0x505e07};removeReferences(_0x4f6a68,null);return db[_0xa7c7('0x34')]['create'](_0x27d761)[_0xa7c7('0x2c')](function(_0x271a58){var _0x39c6d5={'role':_0x56178c['body'][_0xa7c7('0x92')],'userProfileId':_0x56178c[_0xa7c7('0x93')]['userProfileId']};if(!_0x39c6d5)throw new Error(_0xa7c7('0x94'));if(_0x39c6d5['role']===_0xa7c7('0x95')){var _0x4fbe01=_0x271a58[_0xa7c7('0x96')]({'plain':!![]});return db[_0xa7c7('0x97')][_0xa7c7('0x50')]({'where':{'name':_0xa7c7('0x2d'),'userProfileId':_0x39c6d5['userProfileId']},'raw':!![]})[_0xa7c7('0x2c')](function(_0x5cd8f7){if(_0x5cd8f7&&_0x5cd8f7['autoAssociation']===0x0){return db[_0xa7c7('0x98')][_0xa7c7('0x99')]({'name':_0x4fbe01['name'],'resourceId':_0x4fbe01['id'],'type':_0x5cd8f7[_0xa7c7('0x31')],'sectionId':_0x5cd8f7['id']},{})[_0xa7c7('0x2c')](function(){return _0x271a58;});}else{return _0x271a58;}})[_0xa7c7('0x4d')](function(_0x48036d){logger[_0xa7c7('0x2f')](_0xa7c7('0x9a'),_0x48036d);throw _0x48036d;});}return _0x271a58;})[_0xa7c7('0x2c')](respondWithResult(_0x5dfb58,null))['catch'](handleError(_0x5dfb58,null));}});}catch(_0x119bb5){_0x5dfb58[_0xa7c7('0x22')](0x1f4)[_0xa7c7('0x32')](_0x119bb5);}};function removeReferences(_0x187719,_0x1dfa14){try{if(_0x187719){fs[_0xa7c7('0x9b')](_0x187719);logger[_0xa7c7('0x68')]('Zip\x20archive\x20removed');}if(_0x1dfa14){rimraf(_0x1dfa14,function(){});logger[_0xa7c7('0x68')](_0xa7c7('0x9c'));}}catch(_0x17d0f6){logger[_0xa7c7('0x2f')](_0x17d0f6);}}exports[_0xa7c7('0x2b')]=function(_0x57a5f5,_0x282cf8,_0x533f6f){return db[_0xa7c7('0x34')][_0xa7c7('0x50')]({'where':{'id':_0x57a5f5[_0xa7c7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x282cf8,null))['then'](saveUpdates(_0x57a5f5[_0xa7c7('0x93')],null))[_0xa7c7('0x2c')](respondWithResult(_0x282cf8,null))['catch'](handleError(_0x282cf8,null));};exports['delete']=function(_0x5d2ca3,_0x3b11ae,_0x452cef){return db[_0xa7c7('0x34')][_0xa7c7('0x50')]({'where':{'id':_0x5d2ca3['params']['id']}})[_0xa7c7('0x2c')](function(_0x4e11d4){if(_0x4e11d4){return _0x4e11d4[_0xa7c7('0x2e')]();}})[_0xa7c7('0x2c')](function(_0x4d344f){rimraf(path[_0xa7c7('0x52')](config[_0xa7c7('0x53')],_0xa7c7('0x54'),path['dirname'](_0x4d344f[_0xa7c7('0x7')])),function(){});return _0x4d344f;})[_0xa7c7('0x2c')](handleEntityNotFound(_0x3b11ae,null))[_0xa7c7('0x2c')](respondWithStatusCode(_0x3b11ae,null))[_0xa7c7('0x4d')](handleError(_0x3b11ae,null));};exports['webhookGet']=function(_0x260a3f,_0x31149c,_0x102db0){return BPromise[_0xa7c7('0x9d')]()[_0xa7c7('0x2c')](function(){if(!_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x7')]){throw new Error(_0xa7c7('0x9e'));}if(!_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x332824=_0x260a3f['query'][_0xa7c7('0xa0')]?_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0xa0')]+':'+_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x9f')]:'http://localhost:'+_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x9f')];var _0x5c9ddc=_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x24')]?_0x260a3f['query'][_0xa7c7('0x24')]:!![];var _0x1fea26=_0x260a3f['query'][_0xa7c7('0xa1')]?_0x260a3f['query'][_0xa7c7('0xa1')]:null;var _0x597899={'method':_0x260a3f[_0xa7c7('0xa2')],'uri':util[_0xa7c7('0x66')](_0xa7c7('0xa3'),_0x332824,_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x7')]),'json':_0x5c9ddc,'resolveWithFullResponse':!![],'encoding':_0x1fea26,'qs':_0x260a3f[_0xa7c7('0x39')]};if(_0x260a3f[_0xa7c7('0xa4')]){_0x597899[_0xa7c7('0xa4')]=_0x260a3f['headers'];if(_0x597899['headers'][_0xa7c7('0xa5')]){delete _0x597899[_0xa7c7('0xa4')]['content-length'];}}if(_0x597899['headers'][_0xa7c7('0xa6')]){delete _0x597899['headers']['content-type'];}return rp(_0x597899);})[_0xa7c7('0x2c')](function(_0x183bc0){if(_0x183bc0){_0x31149c[_0xa7c7('0xa7')](_0x183bc0[_0xa7c7('0xa4')]);logger[_0xa7c7('0x68')](_0x183bc0[_0xa7c7('0x93')]);if(_['endsWith'](_0x260a3f[_0xa7c7('0x39')][_0xa7c7('0x7')],'download')&&_0x183bc0[_0xa7c7('0xa8')]==0x1f4){return _0x31149c[_0xa7c7('0x21')](_0x183bc0['statusCode']);}else{return _0x31149c[_0xa7c7('0x22')](_0x183bc0[_0xa7c7('0xa8')])['send'](_0x183bc0['body']);}}else{return _0x31149c['sendStatus'](0xc8);}})[_0xa7c7('0x4d')](handleError(_0x31149c,null));};exports[_0xa7c7('0xa9')]=function(_0x43fc4c,_0x213220,_0x14afbb){return BPromise[_0xa7c7('0x9d')]()[_0xa7c7('0x2c')](function(){if(!_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x7')]){throw new Error(_0xa7c7('0x9e'));}if(!_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x9f')]){throw new Error(_0xa7c7('0xaa'));}var _0x98a28=_0x43fc4c['query']['hostname']?_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0xa0')]+':'+_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x9f')]:'http://localhost:'+_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x9f')];var _0x42a871=_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x24')]?_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0x24')]:!![];var _0x376662=_0x43fc4c['query']['encoding']?_0x43fc4c[_0xa7c7('0x39')][_0xa7c7('0xa1')]:null;var _0x40fdbc={'method':_0x43fc4c[_0xa7c7('0xa2')],'uri':util[_0xa7c7('0x66')](_0xa7c7('0xa3'),_0x98a28,_0x43fc4c['query'][_0xa7c7('0x7')]),'json':_0x42a871,'resolveWithFullResponse':!![],'encoding':_0x376662,'body':_0x43fc4c[_0xa7c7('0x93')]};if(_0x43fc4c[_0xa7c7('0xa4')]){_0x40fdbc[_0xa7c7('0xa4')]=_0x43fc4c['headers'];if(_0x40fdbc[_0xa7c7('0xa4')]['content-length']){delete _0x40fdbc[_0xa7c7('0xa4')][_0xa7c7('0xa5')];}}if(_0x40fdbc[_0xa7c7('0xa4')][_0xa7c7('0xa6')]){delete _0x40fdbc[_0xa7c7('0xa4')][_0xa7c7('0xa6')];}return rp(_0x40fdbc);})[_0xa7c7('0x2c')](function(_0x54606f){if(_0x54606f){_0x213220[_0xa7c7('0xa7')](_0x54606f[_0xa7c7('0xa4')]);logger[_0xa7c7('0x68')](_0x54606f[_0xa7c7('0x93')]);return _0x213220[_0xa7c7('0x22')](_0x54606f[_0xa7c7('0xa8')])[_0xa7c7('0x32')](_0x54606f['body']);}else{return _0x213220[_0xa7c7('0x21')](0xc8);}})[_0xa7c7('0x4d')](handleError(_0x213220,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8bc6b2a..a220ffa 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 _0xadf0=['save','update','remove','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x494414,_0x9cfb0b){var _0x2c0cbe=function(_0x28655b){while(--_0x28655b){_0x494414['push'](_0x494414['shift']());}};_0x2c0cbe(++_0x9cfb0b);}(_0xadf0,0x12d));var _0x0adf=function(_0x4e4664,_0x301244){_0x4e4664=_0x4e4664-0x0;var _0x59372a=_0xadf0[_0x4e4664];return _0x59372a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0adf('0x0'))['db'][_0x0adf('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x0adf('0x2')](0x0);var events={'afterCreate':_0x0adf('0x3'),'afterUpdate':_0x0adf('0x4'),'afterDestroy':_0x0adf('0x5')};function emitEvent(_0x911855){return function(_0x4b4b16,_0xb48987,_0x567ca2){PluginEvents['emit'](_0x911855+':'+_0x4b4b16['id'],_0x4b4b16);PluginEvents['emit'](_0x911855,_0x4b4b16);_0x567ca2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x0adf('0x6')](e,emitEvent(event));}}module[_0x0adf('0x7')]=PluginEvents; \ No newline at end of file +var _0x41ec=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x375941,_0x28d0e8){var _0x342203=function(_0x47554c){while(--_0x47554c){_0x375941['push'](_0x375941['shift']());}};_0x342203(++_0x28d0e8);}(_0x41ec,0x143));var _0xc41e=function(_0xbb67ff,_0x21d422){_0xbb67ff=_0xbb67ff-0x0;var _0xdaa5d1=_0x41ec[_0xbb67ff];return _0xdaa5d1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc41e('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xc41e('0x1')](0x0);var events={'afterCreate':_0xc41e('0x2'),'afterUpdate':'update','afterDestroy':_0xc41e('0x3')};function emitEvent(_0x19ed31){return function(_0xd3f764,_0xf79325,_0xaa14e8){PluginEvents[_0xc41e('0x4')](_0x19ed31+':'+_0xd3f764['id'],_0xd3f764);PluginEvents[_0xc41e('0x4')](_0x19ed31,_0xd3f764);_0xaa14e8(null);};}for(var e in events){if(events[_0xc41e('0x5')](e)){var event=events[e];Plugin[_0xc41e('0x6')](e,emitEvent(event));}}module[_0xc41e('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3e3b9f7..9dde8ad 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 _0x45dc=['./plugin.attributes','exports','define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xcc24e8,_0x230fe5){var _0x279917=function(_0x5838ad){while(--_0x5838ad){_0xcc24e8['push'](_0xcc24e8['shift']());}};_0x279917(++_0x230fe5);}(_0x45dc,0x139));var _0xc45d=function(_0x1c8eca,_0x4a069d){_0x1c8eca=_0x1c8eca-0x0;var _0x349d81=_0x45dc[_0x1c8eca];return _0x349d81;};'use strict';var _=require('lodash');var util=require(_0xc45d('0x0'));var logger=require(_0xc45d('0x1'))(_0xc45d('0x2'));var moment=require(_0xc45d('0x3'));var BPromise=require(_0xc45d('0x4'));var rp=require(_0xc45d('0x5'));var fs=require('fs');var path=require(_0xc45d('0x6'));var rimraf=require(_0xc45d('0x7'));var config=require(_0xc45d('0x8'));var attributes=require(_0xc45d('0x9'));module[_0xc45d('0xa')]=function(_0x2c8383,_0x352dc2){return _0x2c8383[_0xc45d('0xb')](_0xc45d('0xc'),attributes,{'tableName':_0xc45d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff89=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./plugin.attributes','exports','Plugin','lodash'];(function(_0x59aec7,_0x39b889){var _0x1565ce=function(_0x3eaa73){while(--_0x3eaa73){_0x59aec7['push'](_0x59aec7['shift']());}};_0x1565ce(++_0x39b889);}(_0xff89,0xaf));var _0x9ff8=function(_0x24fba5,_0x598ce3){_0x24fba5=_0x24fba5-0x0;var _0x1fdf72=_0xff89[_0x24fba5];return _0x1fdf72;};'use strict';var _=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var logger=require(_0x9ff8('0x2'))(_0x9ff8('0x3'));var moment=require(_0x9ff8('0x4'));var BPromise=require(_0x9ff8('0x5'));var rp=require(_0x9ff8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ff8('0x7'));var attributes=require(_0x9ff8('0x8'));module[_0x9ff8('0x9')]=function(_0x204956,_0x554762){return _0x204956['define'](_0x9ff8('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index e05c8e3..65d7f41 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 _0xf756=['CreatePlugin','Plugin','body','options','raw','stringify','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','defaults','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','catch'];(function(_0x3714a0,_0x3775e4){var _0x430d52=function(_0xc846cb){while(--_0xc846cb){_0x3714a0['push'](_0x3714a0['shift']());}};_0x430d52(++_0x3775e4);}(_0xf756,0x18e));var _0x6f75=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf756[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x6f75('0x0'));var util=require(_0x6f75('0x1'));var moment=require(_0x6f75('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f75('0x3'));var db=require(_0x6f75('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6f75('0x5'));var config=require('../../config/environment');var jayson=require(_0x6f75('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x6f75('0x7')](config[_0x6f75('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f75('0x9'))(new Redis(config[_0x6f75('0x8')]));require('./plugin.socket')[_0x6f75('0xa')](socket);function respondWithRpcPromise(_0x56a2d3,_0x71459b,_0x1bbbae){return new BPromise(function(_0x41be99,_0x92976a){return client[_0x6f75('0xb')](_0x56a2d3,_0x1bbbae)[_0x6f75('0xc')](function(_0x4dd946){logger[_0x6f75('0xd')]('Plugin,\x20%s,\x20%s',_0x71459b,_0x6f75('0xe'));logger[_0x6f75('0xf')](_0x6f75('0x10'),_0x71459b,_0x6f75('0xe'),JSON['stringify'](_0x4dd946));if(_0x4dd946[_0x6f75('0x11')]){if(_0x4dd946[_0x6f75('0x11')][_0x6f75('0x12')]===0x1f4){logger[_0x6f75('0x11')](_0x6f75('0x13'),_0x71459b,_0x4dd946[_0x6f75('0x11')][_0x6f75('0x14')]);return _0x92976a(_0x4dd946[_0x6f75('0x11')][_0x6f75('0x14')]);}logger[_0x6f75('0x11')]('Plugin,\x20%s,\x20%s',_0x71459b,_0x4dd946[_0x6f75('0x11')][_0x6f75('0x14')]);return _0x41be99(_0x4dd946['error'][_0x6f75('0x14')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x71459b,'request\x20sent');_0x41be99(_0x4dd946['result'][_0x6f75('0x14')]);}})[_0x6f75('0x15')](function(_0x203cfd){logger[_0x6f75('0x11')]('Plugin,\x20%s,\x20%s',_0x71459b,_0x203cfd);_0x92976a(_0x203cfd);});});}exports[_0x6f75('0x16')]=function(_0x4bc551){var _0xa58f38=this;return new Promise(function(_0x459443,_0x54b905){return db[_0x6f75('0x17')]['create'](_0x4bc551[_0x6f75('0x18')],{'raw':_0x4bc551[_0x6f75('0x19')]?_0x4bc551[_0x6f75('0x19')][_0x6f75('0x1a')]===undefined?!![]:![]:!![]})[_0x6f75('0xc')](function(_0x58a24b){logger[_0x6f75('0xd')](_0x6f75('0x16'),_0x4bc551);logger[_0x6f75('0xf')](_0x6f75('0x16'),_0x4bc551,JSON[_0x6f75('0x1b')](_0x58a24b));_0x459443(_0x58a24b);})[_0x6f75('0x15')](function(_0x28170e){logger[_0x6f75('0x11')](_0x6f75('0x16'),_0x28170e[_0x6f75('0x14')],_0x4bc551);_0x54b905(_0xa58f38['error'](0x1f4,_0x28170e[_0x6f75('0x14')]));});});}; \ No newline at end of file +var _0xdc91=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','options','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x251b15,_0x232885){var _0xda33a1=function(_0x3471ca){while(--_0x3471ca){_0x251b15['push'](_0x251b15['shift']());}};_0xda33a1(++_0x232885);}(_0xdc91,0x8b));var _0x1dc9=function(_0xfc2a55,_0x4ad9ac){_0xfc2a55=_0xfc2a55-0x0;var _0x26ce8d=_0xdc91[_0xfc2a55];return _0x26ce8d;};'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});config['redis']=_[_0x1dc9('0xa')](config[_0x1dc9('0xb')],{'host':_0x1dc9('0xc'),'port':0x18eb});var socket=require(_0x1dc9('0xd'))(new Redis(config[_0x1dc9('0xb')]));require(_0x1dc9('0xe'))[_0x1dc9('0xf')](socket);function respondWithRpcPromise(_0x2e2e69,_0x32a428,_0x107459){return new BPromise(function(_0x5ab573,_0x356525){return client['request'](_0x2e2e69,_0x107459)[_0x1dc9('0x10')](function(_0x5b29c5){logger[_0x1dc9('0x11')](_0x1dc9('0x12'),_0x32a428,_0x1dc9('0x13'));logger[_0x1dc9('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x32a428,_0x1dc9('0x13'),JSON[_0x1dc9('0x15')](_0x5b29c5));if(_0x5b29c5['error']){if(_0x5b29c5[_0x1dc9('0x16')][_0x1dc9('0x17')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x32a428,_0x5b29c5[_0x1dc9('0x16')][_0x1dc9('0x18')]);return _0x356525(_0x5b29c5[_0x1dc9('0x16')][_0x1dc9('0x18')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x32a428,_0x5b29c5[_0x1dc9('0x16')][_0x1dc9('0x18')]);return _0x5ab573(_0x5b29c5['error'][_0x1dc9('0x18')]);}else{logger[_0x1dc9('0x11')](_0x1dc9('0x12'),_0x32a428,_0x1dc9('0x13'));_0x5ab573(_0x5b29c5[_0x1dc9('0x19')][_0x1dc9('0x18')]);}})[_0x1dc9('0x1a')](function(_0x1e4aca){logger[_0x1dc9('0x16')](_0x1dc9('0x12'),_0x32a428,_0x1e4aca);_0x356525(_0x1e4aca);});});}exports[_0x1dc9('0x1b')]=function(_0x2a1c9b){var _0x2b2920=this;return new Promise(function(_0x5c75bd,_0x49bd5b){return db[_0x1dc9('0x1c')]['create'](_0x2a1c9b['body'],{'raw':_0x2a1c9b['options']?_0x2a1c9b[_0x1dc9('0x1d')][_0x1dc9('0x1e')]===undefined?!![]:![]:!![]})[_0x1dc9('0x10')](function(_0x1b6829){logger[_0x1dc9('0x11')](_0x1dc9('0x1b'),_0x2a1c9b);logger[_0x1dc9('0x14')]('CreatePlugin',_0x2a1c9b,JSON[_0x1dc9('0x15')](_0x1b6829));_0x5c75bd(_0x1b6829);})[_0x1dc9('0x1a')](function(_0x14181d){logger['error'](_0x1dc9('0x1b'),_0x14181d[_0x1dc9('0x18')],_0x2a1c9b);_0x49bd5b(_0x2b2920[_0x1dc9('0x16')](0x1f4,_0x14181d[_0x1dc9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0989369..303b380 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 _0xf116=['update','removeListener','length','./plugin.events','remove'];(function(_0x1532cc,_0x30e3f0){var _0x3926ff=function(_0x13ca62){while(--_0x13ca62){_0x1532cc['push'](_0x1532cc['shift']());}};_0x3926ff(++_0x30e3f0);}(_0xf116,0xad));var _0x6f11=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xf116[_0x2de0a7];return _0x429437;};'use strict';var PluginEvents=require(_0x6f11('0x0'));var events=['save',_0x6f11('0x1'),_0x6f11('0x2')];function createListener(_0x58a31d,_0x4e7b7e){return function(_0x286b07){_0x4e7b7e['emit'](_0x58a31d,_0x286b07);};}function removeListener(_0x1c8b7d,_0x2c67b2){return function(){PluginEvents[_0x6f11('0x3')](_0x1c8b7d,_0x2c67b2);};}exports['register']=function(_0x193868){for(var _0x4b8d30=0x0,_0x219140=events[_0x6f11('0x4')];_0x4b8d30<_0x219140;_0x4b8d30++){var _0xae831b=events[_0x4b8d30];var _0x557eb6=createListener('plugin:'+_0xae831b,_0x193868);PluginEvents['on'](_0xae831b,_0x557eb6);}}; \ No newline at end of file +var _0x5cc2=['register','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5cc2,0x105));var _0x25cc=function(_0x1e73fe,_0x31619d){_0x1e73fe=_0x1e73fe-0x0;var _0x170cc7=_0x5cc2[_0x1e73fe];return _0x170cc7;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x25cc('0x0'),_0x25cc('0x1'),_0x25cc('0x2')];function createListener(_0x121425,_0x88efd5){return function(_0x4d94b0){_0x88efd5[_0x25cc('0x3')](_0x121425,_0x4d94b0);};}function removeListener(_0x341d6a,_0x2b842c){return function(){PluginEvents['removeListener'](_0x341d6a,_0x2b842c);};}exports[_0x25cc('0x4')]=function(_0x56b8af){for(var _0x10fbbd=0x0,_0x1e6ea7=events['length'];_0x10fbbd<_0x1e6ea7;_0x10fbbd++){var _0x415d1f=events[_0x10fbbd];var _0x34419b=createListener('plugin:'+_0x415d1f,_0x56b8af);PluginEvents['on'](_0x415d1f,_0x34419b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4935e97..53331da 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(_0x4229c6,_0x17b7a3){var _0x43f0ed=function(_0x504b52){while(--_0x504b52){_0x4229c6['push'](_0x4229c6['shift']());}};_0x43f0ed(++_0x17b7a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x22b299,_0x27d4d5){var _0x921a8a=function(_0x356192){while(--_0x356192){_0x22b299['push'](_0x22b299['shift']());}};_0x921a8a(++_0x27d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 d1bbd09..e864155 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 _0xee5b=['exec','bluebird','sendStatus','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','script','join','cwd','chdir','dirname','start','status','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','api','child_process'];(function(_0x36a224,_0x23bb6a){var _0x509df2=function(_0x14d39a){while(--_0x14d39a){_0x36a224['push'](_0x36a224['shift']());}};_0x509df2(++_0x23bb6a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x89c831,_0x2ee1ce){_0x89c831=_0x89c831-0x0;var _0x97fcbf=_0xee5b[_0x89c831];return _0x97fcbf;};'use strict';var _=require(_0xbee5('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var path=require('path');var exec=require(_0xbee5('0x3'))[_0xbee5('0x4')];var BPromise=require(_0xbee5('0x5'));function handleEntityNotFound(_0x210159,_0x4bd202){return function(_0x5200b1){if(!_0x5200b1){_0x210159[_0xbee5('0x6')](0x194);;}return _0x5200b1;};}function respondWithResult(_0x2c0bde,_0xab6e4d){_0xab6e4d=_0xab6e4d||0xc8;return function(_0x804ab8){if(_0x804ab8){return _0x2c0bde['status'](_0xab6e4d)['json'](_0x804ab8);}return null;};}function handleError(_0x53d5b9,_0x5baf5c){_0x5baf5c=_0x5baf5c||0x1f4;return function(_0x5536bd){logger[_0xbee5('0x7')](_0x5536bd[_0xbee5('0x8')]);if(_0x5536bd[_0xbee5('0x9')]){delete _0x5536bd[_0xbee5('0x9')];}_0x53d5b9['status'](_0x5baf5c)[_0xbee5('0xa')](_0x5536bd);};}function execChildProcess(){return new BPromise(function(_0x305921,_0x9b3d3b){exec(_0xbee5('0xb'),function(_0x16377d,_0x1509c7,_0x105e16){logger[_0xbee5('0xc')](_0x1509c7);logger[_0xbee5('0xc')](_0x105e16);if(_0x16377d){logger['error'](_0x16377d);return _0x9b3d3b(_0x16377d);}return _0x305921(_0x1509c7);});});}exports[_0xbee5('0xd')]=function(_0x532a78,_0x183877){return pm2[_0xbee5('0xe')]()[_0xbee5('0xf')](function(_0x593ecb){if(_0x593ecb){var _0x5092f2=_[_0xbee5('0x10')](_0x593ecb,function(_0x4cf5a8){return _0x4cf5a8[_0xbee5('0x9')]==='express'||_0x4cf5a8[_0xbee5('0x9')]===_0xbee5('0x11');});return{'rows':_0x5092f2,'count':_0x5092f2[_0xbee5('0x12')]};}return null;})['then'](respondWithResult(_0x183877,null))[_0xbee5('0x13')](handleError(_0x183877,null));};exports[_0xbee5('0x14')]=function(_0x5a0ae5,_0x254dd3){return pm2[_0xbee5('0x15')](_0x5a0ae5[_0xbee5('0x16')]['id'])[_0xbee5('0xf')](respondWithResult(_0x254dd3,null))[_0xbee5('0xf')](handleEntityNotFound(_0x254dd3,null))[_0xbee5('0x13')](handleError(_0x254dd3,null));};exports[_0xbee5('0x17')]=function(_0xa50ec9,_0x20cf52){if(_0xa50ec9[_0xbee5('0x18')][_0xbee5('0x9')]&&_0xa50ec9[_0xbee5('0x18')][_0xbee5('0x19')]){var _0x40a06=path[_0xbee5('0x1a')](__dirname,'../../files/plugins',_0xa50ec9['body'][_0xbee5('0x19')]);var _0x48bfb5=process[_0xbee5('0x1b')]();process[_0xbee5('0x1c')](path[_0xbee5('0x1d')](_0x40a06));return execChildProcess()[_0xbee5('0xf')](function(_0x3f23c5){process[_0xbee5('0x1c')](_0x48bfb5);return pm2[_0xbee5('0x1e')]({'name':_0xa50ec9[_0xbee5('0x18')][_0xbee5('0x9')],'script':_0x40a06});})['then'](function(_0x5b43b3){pm2['dump']();return _0x5b43b3[0x0];})['then'](respondWithResult(_0x20cf52,0xc9))['catch'](handleError(_0x20cf52,null));}else{return _0x20cf52[_0xbee5('0x1f')](0x1f4)[_0xbee5('0xa')]({'message':_0xbee5('0x20')});}};exports[_0xbee5('0x21')]=function(_0x169042,_0x20e7e8){if(_0x169042[_0xbee5('0x18')]['id']){delete _0x169042['body']['id'];}var _0x36b50f={'online':_0xbee5('0x22'),'stopped':_0xbee5('0x23')};if(_0x36b50f[_0xbee5('0x24')](_0x169042[_0xbee5('0x18')]['status'])){return pm2[_0x36b50f[_0x169042[_0xbee5('0x18')][_0xbee5('0x1f')]]](_0x169042[_0xbee5('0x16')]['id'])[_0xbee5('0xf')](respondWithResult(_0x20e7e8,0xc8))[_0xbee5('0x13')](handleError(_0x20e7e8,null));}else{return _0x20e7e8[_0xbee5('0x1f')](0x1f4)[_0xbee5('0xa')]({'message':_0xbee5('0x25')});}};exports[_0xbee5('0x26')]=function(_0x59c2e4,_0x22df5f){if(_0x59c2e4['body']['id']){delete _0x59c2e4[_0xbee5('0x18')]['id'];}if(_0x59c2e4['params']['id']){return pm2[_0xbee5('0x27')](_0x59c2e4['params']['id'])[_0xbee5('0xf')](function(_0x5c1109){pm2[_0xbee5('0x28')]();return _0x5c1109[0x0];})[_0xbee5('0xf')](respondWithResult(_0x22df5f,null))[_0xbee5('0x13')](handleError(_0x22df5f,null));}else{return _0x22df5f[_0xbee5('0x1f')](0x1f4)['send']({'message':_0xbee5('0x29')});}}; \ No newline at end of file +var _0xe205=['cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','reject','express','length','then','catch','show','describe','params','body','script'];(function(_0x382cce,_0x41aef8){var _0x27d649=function(_0x58c07e){while(--_0x58c07e){_0x382cce['push'](_0x382cce['shift']());}};_0x27d649(++_0x41aef8);}(_0xe205,0xa7));var _0x5e20=function(_0x3f2402,_0xb205d9){_0x3f2402=_0x3f2402-0x0;var _0x49af14=_0xe205[_0x3f2402];return _0x49af14;};'use strict';var _=require(_0x5e20('0x0'));var pm2=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var path=require(_0x5e20('0x4'));var exec=require(_0x5e20('0x5'))[_0x5e20('0x6')];var BPromise=require(_0x5e20('0x7'));function handleEntityNotFound(_0x37c5e9,_0x4ac934){return function(_0x1a6198){if(!_0x1a6198){_0x37c5e9[_0x5e20('0x8')](0x194);;}return _0x1a6198;};}function respondWithResult(_0x44dbb3,_0x3c4203){_0x3c4203=_0x3c4203||0xc8;return function(_0x5eca5c){if(_0x5eca5c){return _0x44dbb3['status'](_0x3c4203)[_0x5e20('0x9')](_0x5eca5c);}return null;};}function handleError(_0x4c9332,_0x533e18){_0x533e18=_0x533e18||0x1f4;return function(_0x30b757){logger[_0x5e20('0xa')](_0x30b757['stack']);if(_0x30b757[_0x5e20('0xb')]){delete _0x30b757[_0x5e20('0xb')];}_0x4c9332[_0x5e20('0xc')](_0x533e18)[_0x5e20('0xd')](_0x30b757);};}function execChildProcess(){return new BPromise(function(_0x5cb51d,_0x349613){exec(_0x5e20('0xe'),function(_0x270689,_0x27f1f9,_0x165824){logger[_0x5e20('0xf')](_0x27f1f9);logger['info'](_0x165824);if(_0x270689){logger[_0x5e20('0xa')](_0x270689);return _0x349613(_0x270689);}return _0x5cb51d(_0x27f1f9);});});}exports[_0x5e20('0x10')]=function(_0x22540d,_0x5868c0){return pm2[_0x5e20('0x11')]()['then'](function(_0x1f47f3){if(_0x1f47f3){var _0x5ba833=_[_0x5e20('0x12')](_0x1f47f3,function(_0x330cdf){return _0x330cdf[_0x5e20('0xb')]===_0x5e20('0x13')||_0x330cdf[_0x5e20('0xb')]==='motion2';});return{'rows':_0x5ba833,'count':_0x5ba833[_0x5e20('0x14')]};}return null;})[_0x5e20('0x15')](respondWithResult(_0x5868c0,null))[_0x5e20('0x16')](handleError(_0x5868c0,null));};exports[_0x5e20('0x17')]=function(_0x2f194b,_0x3b353f){return pm2[_0x5e20('0x18')](_0x2f194b[_0x5e20('0x19')]['id'])['then'](respondWithResult(_0x3b353f,null))[_0x5e20('0x15')](handleEntityNotFound(_0x3b353f,null))[_0x5e20('0x16')](handleError(_0x3b353f,null));};exports['create']=function(_0x295eb3,_0x1b1457){if(_0x295eb3[_0x5e20('0x1a')][_0x5e20('0xb')]&&_0x295eb3['body'][_0x5e20('0x1b')]){var _0x50f222=path['join'](__dirname,'../../files/plugins',_0x295eb3['body'][_0x5e20('0x1b')]);var _0x5cca90=process[_0x5e20('0x1c')]();process[_0x5e20('0x1d')](path[_0x5e20('0x1e')](_0x50f222));return execChildProcess()[_0x5e20('0x15')](function(_0x3ef7fa){process[_0x5e20('0x1d')](_0x5cca90);return pm2['start']({'name':_0x295eb3[_0x5e20('0x1a')]['name'],'script':_0x50f222});})['then'](function(_0x33993a){pm2[_0x5e20('0x1f')]();return _0x33993a[0x0];})[_0x5e20('0x15')](respondWithResult(_0x1b1457,0xc9))[_0x5e20('0x16')](handleError(_0x1b1457,null));}else{return _0x1b1457[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x20')});}};exports['update']=function(_0x3bf4f4,_0x420f63){if(_0x3bf4f4[_0x5e20('0x1a')]['id']){delete _0x3bf4f4[_0x5e20('0x1a')]['id'];}var _0x4c799d={'online':_0x5e20('0x21'),'stopped':_0x5e20('0x22')};if(_0x4c799d[_0x5e20('0x23')](_0x3bf4f4[_0x5e20('0x1a')][_0x5e20('0xc')])){return pm2[_0x4c799d[_0x3bf4f4[_0x5e20('0x1a')]['status']]](_0x3bf4f4[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](respondWithResult(_0x420f63,0xc8))['catch'](handleError(_0x420f63,null));}else{return _0x420f63[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x24')});}};exports[_0x5e20('0x25')]=function(_0x1548c8,_0x395a27){if(_0x1548c8['body']['id']){delete _0x1548c8[_0x5e20('0x1a')]['id'];}if(_0x1548c8[_0x5e20('0x19')]['id']){return pm2[_0x5e20('0x26')](_0x1548c8[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](function(_0x1ac162){pm2[_0x5e20('0x1f')]();return _0x1ac162[0x0];})[_0x5e20('0x15')](respondWithResult(_0x395a27,null))[_0x5e20('0x16')](handleError(_0x395a27,null));}else{return _0x395a27[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index c1a8a02..4eda2f4 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 _0xe090=['/agents','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe090,0x8c));var _0x0e09=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xe090[_0x7e2eb0];return _0xd92de4;};'use strict';var express=require(_0x0e09('0x0'));var router=express[_0x0e09('0x1')]();var auth=require(_0x0e09('0x2'));var controller=require('./realtime.controller');router[_0x0e09('0x3')](_0x0e09('0x4'),auth[_0x0e09('0x5')](),controller['getAgents']);router[_0x0e09('0x3')]('/queues',auth[_0x0e09('0x5')](),controller[_0x0e09('0x6')]);module[_0x0e09('0x7')]=router; \ No newline at end of file +var _0x59f1=['../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','get','exports','Router'];(function(_0xbb9b40,_0x51b63a){var _0x4cd1b3=function(_0x4c0343){while(--_0x4c0343){_0xbb9b40['push'](_0xbb9b40['shift']());}};_0x4cd1b3(++_0x51b63a);}(_0x59f1,0x1b7));var _0x159f=function(_0x21247e,_0xb9d17d){_0x21247e=_0x21247e-0x0;var _0xcd3da1=_0x59f1[_0x21247e];return _0xcd3da1;};'use strict';var express=require('express');var router=express[_0x159f('0x0')]();var auth=require(_0x159f('0x1'));var controller=require(_0x159f('0x2'));router['get'](_0x159f('0x3'),auth[_0x159f('0x4')](),controller[_0x159f('0x5')]);router[_0x159f('0x6')]('/queues',auth[_0x159f('0x4')](),controller['getQueues']);module[_0x159f('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 81bf692..c9aaec9 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 _0x1fa7=['Queue','rawAttributes','fieldName','key','name','outbound','dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','assign','getResources','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','getAgents','query','globalStatusFilter','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','type','agent','getOptions','raw','push','literal','forEach','Pause','where','merge','user','role','userProfileId','Agents','online','UserProfile','findAndCountAll','find','filterAgentAttributes','getAgentStatus','pause','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x1fa7,0x163));var _0x71fa=function(_0x4dadee,_0x47c2bc){_0x4dadee=_0x4dadee-0x0;var _0xc35e87=_0x1fa7[_0x4dadee];return _0xc35e87;};'use strict';var _=require(_0x71fa('0x0'));var util=require(_0x71fa('0x1'));var rta=require(_0x71fa('0x2'));var rtq=require(_0x71fa('0x3'));var qs=require(_0x71fa('0x4'));var utils=require(_0x71fa('0x5'));var db=require(_0x71fa('0x6'))['db'];var APIBadRequestError=require(_0x71fa('0x7'))[_0x71fa('0x8')];var APIHandleError=require(_0x71fa('0x7'))[_0x71fa('0x9')];function respondWithFilteredResult(_0x49922c,_0x12ccb1){return function(_0x2109af){if(_0x2109af){var _0x11cff9=typeof _0x12ccb1[_0x71fa('0xa')]===_0x71fa('0xb')&&typeof _0x12ccb1['limit']===_0x71fa('0xb');var _0x2eb921=_0x2109af[_0x71fa('0xc')];var _0x43e165=_0x11cff9?0x0:_0x12ccb1[_0x71fa('0xa')];var _0x182dcd=_0x11cff9?_0x2109af[_0x71fa('0xc')]:_0x12ccb1[_0x71fa('0xa')]+_0x12ccb1[_0x71fa('0xd')];var _0x1e2902;if(_0x182dcd>=_0x2eb921){_0x182dcd=_0x2eb921;_0x1e2902=0xc8;}else{_0x1e2902=0xce;}_0x49922c[_0x71fa('0xe')](_0x1e2902);return _0x49922c[_0x71fa('0xf')]('Content-Range',_0x43e165+'-'+_0x182dcd+'/'+_0x2eb921)['json'](_0x2109af);}return null;};}exports[_0x71fa('0x10')]=function(_0x4d2f67,_0x302732){var _0x3d865f={'count':0x0,'rows':[]};var _0x175591={};var _0x3b3fcf;var _0x4ed44a=utils['getChannels']();var _0x1cba5a;var _0x8f7be8;var _0x1f99ff=_0x4d2f67[_0x71fa('0x11')]['globalQueueFilter'];var _0x12c213=_0x4d2f67['query'][_0x71fa('0x12')];var _0x537b5f=_0x4d2f67[_0x71fa('0x11')]['pauseTypeFilter'];var _0x2b86d0=_0x12c213==='pause'||_0x12c213===_0x71fa('0x13')?!![]:![];var _0x2ab36a=[];var _0x204709;var _0x4a6afd;Promise[_0x71fa('0x14')]()['then'](function(){if(_0x4d2f67[_0x71fa('0x11')][_0x71fa('0x15')]){if(!utils[_0x71fa('0x16')](_0x4d2f67['query'][_0x71fa('0x15')])){throw new APIBadRequestError(util[_0x71fa('0x17')](_0x71fa('0x18'),_0x4d2f67['query'][_0x71fa('0x15')]));}_0x3b3fcf=_0x4d2f67[_0x71fa('0x11')][_0x71fa('0x15')][_0x71fa('0x19')]();}if(!_0x4d2f67[_0x71fa('0x11')]['sort']||!_0x4d2f67['query'][_0x71fa('0x1a')][_0x71fa('0x1b')](_0x71fa('0x1c'))){_0x4d2f67[_0x71fa('0x11')][_0x71fa('0x1a')]=rta['validateSortParameter'](_0x4d2f67['query'][_0x71fa('0x1a')]);return;}var _0x3ecb8e=rta[_0x71fa('0x1d')](_0x4d2f67[_0x71fa('0x11')][_0x71fa('0x1a')]);_0x4d2f67[_0x71fa('0x11')][_0x71fa('0x1a')]=_0x3ecb8e[_0x71fa('0x1e')][_0x71fa('0x1f')](',');_0x204709=_0x3ecb8e[_0x71fa('0x20')];})[_0x71fa('0x21')](function(){if(!_0x1f99ff){return[];}return rta[_0x71fa('0x22')](_0x1f99ff,_0x3b3fcf);})[_0x71fa('0x21')](function(_0x362890){_0x2ab36a=_0x362890;return rta[_0x71fa('0x23')]();})['then'](function(_0x27662d){_0x8f7be8=_0x27662d[_0x71fa('0x24')];if((!_0x12c213||_0x2b86d0)&&!_0x204709){return _0x2ab36a;}if(_0x204709&&!_0x12c213){return rta[_0x71fa('0x25')](_0x8f7be8,_0x2ab36a,_0x204709);}else{return rta[_0x71fa('0x26')](_0x8f7be8,_0x2ab36a,_0x12c213);}})[_0x71fa('0x21')](function(_0x7439a9){_0x2ab36a=_0x7439a9;var _0x20e9a4=![];if(_0x2ab36a['length']===0x0){if(_0x1f99ff||_0x12c213){_0x20e9a4=!![];}if(_0x2b86d0){_0x20e9a4=![];}}if(_0x20e9a4){return _0x3d865f;}var _0x19e68f=_[_0x71fa('0x27')](db[_0x71fa('0x28')]['rawAttributes'],function(_0x55e6a1){return{'name':_0x55e6a1['fieldName'],'type':_0x55e6a1[_0x71fa('0x29')]['key']};});_0x4d2f67['query']['role']=_0x71fa('0x2a');_0x175591=qs[_0x71fa('0x2b')](_0x19e68f,_0x4d2f67);_0x175591[_0x71fa('0x2c')]=!![];var _0x28de65=[];if(_0x2ab36a['length']>0x0){_0x28de65[_0x71fa('0x2d')]({'id':{'$in':_0x2ab36a}});if(_0x204709&&!_0x12c213){_0x4a6afd=[db['sequelize'][_0x71fa('0x2e')]('FIELD(id,'+_0x2ab36a+')')];_0x175591['order']=_0x4a6afd;}}if(_0x2b86d0){_0x4ed44a[_0x71fa('0x2f')](function(_0x598782){var _0x4e4103=!![];if(_0x12c213==='*pause'&&_0x3b3fcf!==_0x598782){_0x4e4103=![];}_0x28de65[_0x71fa('0x2d')]({[_0x598782+_0x71fa('0x30')]:_0x4e4103});});if(_0x537b5f){_0x28de65['push']({'pauseType':_0x537b5f});}}else if(_0x12c213){_0x4ed44a[_0x71fa('0x2f')](function(_0x3930a7){_0x28de65['push']({[_0x3930a7+_0x71fa('0x30')]:![]});});}_0x175591[_0x71fa('0x31')]=_[_0x71fa('0x32')](_0x175591[_0x71fa('0x31')],{'$and':_0x28de65});if(_0x4d2f67[_0x71fa('0x33')][_0x71fa('0x34')]===_0x71fa('0x33')){var _0x37130c={'params':{'id':_0x4d2f67[_0x71fa('0x33')][_0x71fa('0x35')]},'query':{'section':_0x71fa('0x36'),'role':_0x71fa('0x2a'),'raw':!![],'ids':_0x2ab36a,'customSorting':_0x4a6afd}};if(_0x4d2f67['query']['online']){_0x37130c['query'][_0x71fa('0x37')]=!![];}if(_0x2b86d0){_0x37130c[_0x71fa('0x11')]['extraQueryConditions']=_0x28de65;}_0x37130c[_0x71fa('0x11')]=Object['assign'](_0x37130c[_0x71fa('0x11')],_0x4d2f67[_0x71fa('0x11')]);return db[_0x71fa('0x38')]['getResources'](_0x37130c);}return db[_0x71fa('0x28')][_0x71fa('0x39')](_0x175591);})['then'](function(_0x523349){_0x3d865f[_0x71fa('0xc')]=_0x523349[_0x71fa('0xc')];_0x1cba5a=_0x523349['rows'];return _0x1cba5a[_0x71fa('0x27')](function(_0x5b5621){var _0x20673b=_[_0x71fa('0x3a')](_0x8f7be8,['id',_0x5b5621['id']]);if(_0x20673b){var _0x158073=rta[_0x71fa('0x3b')](_0x20673b);_['merge'](_0x5b5621,_0x158073);}_0x5b5621[_0x71fa('0x1c')]=rta[_0x71fa('0x3c')](_0x5b5621);if(_0x5b5621['globalStatus'][_0x71fa('0x1b')](_0x71fa('0x3d'))){_0x4ed44a[_0x71fa('0x2f')](function(_0x2aaae0){if(_0x5b5621[_0x2aaae0+_0x71fa('0x30')]){if(_0x2aaae0===_0x71fa('0x3e')){if(_0x5b5621[_0x71fa('0x3f')]!==_0x71fa('0x40')){_0x5b5621[_0x71fa('0x3f')]=_0x71fa('0x3d');}}else{_0x5b5621[_0x2aaae0+'Status']=_0x71fa('0x3d');}}});}return _0x5b5621;});})[_0x71fa('0x21')](function(_0x2f0de4){if(!_0x204709||_0x4a6afd){return _0x2f0de4;}return rta[_0x71fa('0x41')](_0x2f0de4,_0x204709);})[_0x71fa('0x21')](function(_0x15bf50){var _0x443ce2=rta[_0x71fa('0x42')]();_0x3d865f[_0x71fa('0x24')]=_0x15bf50[_0x71fa('0x27')](function(_0x246808){return _[_0x71fa('0x43')](_0x246808,_0x443ce2);});return _0x3d865f;})[_0x71fa('0x21')](respondWithFilteredResult(_0x302732,_0x175591))[_0x71fa('0x44')](APIHandleError(_0x302732));};exports[_0x71fa('0x45')]=function(_0x3f080b,_0x4bccf4){var _0x13e835={'count':0x0,'rows':[]};var _0x5656d9={};var _0x7841e7;var _0x167b57;var _0x4d3221;Promise[_0x71fa('0x14')]()['then'](function(){if(_0x3f080b['query'][_0x71fa('0x15')]){if(!utils[_0x71fa('0x16')](_0x3f080b[_0x71fa('0x11')][_0x71fa('0x15')])){throw new APIBadRequestError(util[_0x71fa('0x17')](_0x71fa('0x18'),_0x3f080b['query'][_0x71fa('0x15')]));}_0x7841e7=_0x3f080b['query'][_0x71fa('0x15')][_0x71fa('0x19')]();}var _0x5a7585=_['startCase'](_0x7841e7)+_0x71fa('0x46');var _0x407b4b=_['map'](db[_0x5a7585][_0x71fa('0x47')],function(_0x544209){return{'name':_0x544209[_0x71fa('0x48')],'type':_0x544209['type'][_0x71fa('0x49')]};});if(!_0x3f080b['query']['fields']){var _0x51544e=['id',_0x71fa('0x4a')];if(_0x7841e7===_0x71fa('0x3e')){_0x51544e[_0x71fa('0x2d')](_0x71fa('0x29'));if(_0x3f080b['query'][_0x71fa('0x29')]===_0x71fa('0x4b')){_0x51544e['push']([_0x71fa('0x4c'),_0x71fa('0x4d')]);}}_0x3f080b[_0x71fa('0x11')][_0x71fa('0x1e')]=_0x51544e[_0x71fa('0x1f')](',');}_0x5656d9=qs[_0x71fa('0x2b')](_0x407b4b,_0x3f080b);if(_0x3f080b[_0x71fa('0x33')][_0x71fa('0x34')]===_0x71fa('0x33')){var _0x38de3f={'params':{'id':_0x3f080b['user'][_0x71fa('0x35')]},'query':{'section':_0x7841e7===_0x71fa('0x3e')&&_0x3f080b[_0x71fa('0x11')][_0x71fa('0x29')]===_0x71fa('0x4b')?_0x71fa('0x4e'):_[_0x71fa('0x4f')](_0x7841e7)+_0x71fa('0x50'),'type':_0x3f080b['query'][_0x71fa('0x29')],'nolimit':!![],'sort':_0x71fa('0x4a'),'filter':_0x3f080b[_0x71fa('0x11')][_0x71fa('0x51')]}};_0x38de3f[_0x71fa('0x11')]=Object[_0x71fa('0x52')](_0x38de3f['query'],_0x3f080b[_0x71fa('0x11')]);delete _0x38de3f[_0x71fa('0x11')]['id'];return db[_0x71fa('0x38')][_0x71fa('0x53')](_0x38de3f);}return db[_0x5a7585][_0x71fa('0x39')](_0x5656d9);})['then'](function(_0x2a8d92){_0x13e835[_0x71fa('0xc')]=_0x2a8d92[_0x71fa('0xc')];_0x167b57=_0x2a8d92[_0x71fa('0x24')];return rtq[_0x71fa('0x54')](_0x3f080b,_0x7841e7);})[_0x71fa('0x21')](function(_0x17f5ca){_0x4d3221=_0x17f5ca[_0x71fa('0x24')];return rtq['initializeQueues'](_0x167b57,_0x4d3221,_0x7841e7,_0x3f080b[_0x71fa('0x11')][_0x71fa('0x29')]);})['then'](function(_0x26a269){_0x13e835[_0x71fa('0x24')]=_0x26a269;return _0x13e835;})[_0x71fa('0x21')](respondWithFilteredResult(_0x4bccf4,_0x5656d9))['catch'](APIHandleError(_0x4bccf4));}; \ No newline at end of file +var _0x264a=['isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','map','rawAttributes','fieldName','type','sequelize','literal','FIELD(id,','order','forEach','*pause','push','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','find','merge','getAgentStatus','talking','Status','pick','catch','getQueues','startCase','Queue','key','name','voice','outbound','dialMethod','join','role','QueueCampaigns','Queues','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','undefined','limit','count','offset','status','set','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve'];(function(_0x599c20,_0x442e4c){var _0x3d6a09=function(_0x4ae9b7){while(--_0x4ae9b7){_0x599c20['push'](_0x599c20['shift']());}};_0x3d6a09(++_0x442e4c);}(_0x264a,0x18c));var _0xa264=function(_0x14ce9e,_0x3ca009){_0x14ce9e=_0x14ce9e-0x0;var _0x1cee10=_0x264a[_0x14ce9e];return _0x1cee10;};'use strict';var _=require(_0xa264('0x0'));var util=require(_0xa264('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xa264('0x2'));var qs=require(_0xa264('0x3'));var utils=require(_0xa264('0x4'));var db=require(_0xa264('0x5'))['db'];var APIBadRequestError=require('../../errors/api')[_0xa264('0x6')];var APIHandleError=require(_0xa264('0x7'))[_0xa264('0x8')];function respondWithFilteredResult(_0x989afe,_0x4c4769){return function(_0xdb69f3){if(_0xdb69f3){var _0xfcb965=typeof _0x4c4769['offset']===_0xa264('0x9')&&typeof _0x4c4769[_0xa264('0xa')]===_0xa264('0x9');var _0x2db254=_0xdb69f3[_0xa264('0xb')];var _0x601e58=_0xfcb965?0x0:_0x4c4769[_0xa264('0xc')];var _0x1ae391=_0xfcb965?_0xdb69f3[_0xa264('0xb')]:_0x4c4769[_0xa264('0xc')]+_0x4c4769['limit'];var _0x2cb1c5;if(_0x1ae391>=_0x2db254){_0x1ae391=_0x2db254;_0x2cb1c5=0xc8;}else{_0x2cb1c5=0xce;}_0x989afe[_0xa264('0xd')](_0x2cb1c5);return _0x989afe[_0xa264('0xe')]('Content-Range',_0x601e58+'-'+_0x1ae391+'/'+_0x2db254)[_0xa264('0xf')](_0xdb69f3);}return null;};}exports[_0xa264('0x10')]=function(_0x11d414,_0x4f9cab){var _0x216209={'count':0x0,'rows':[]};var _0x1e5719={};var _0x1b67de;var _0x5bedf2=utils[_0xa264('0x11')]();var _0x4477e4;var _0x3b9e5c;var _0x35203a=_0x11d414[_0xa264('0x12')][_0xa264('0x13')];var _0x4ad174=_0x11d414[_0xa264('0x12')][_0xa264('0x14')];var _0x287ea7=_0x11d414[_0xa264('0x12')][_0xa264('0x15')];var _0x460183=_0x4ad174===_0xa264('0x16')||_0x4ad174==='*pause'?!![]:![];var _0x2fd6db=[];var _0x389666;var _0x14d2c0;Promise[_0xa264('0x17')]()['then'](function(){if(_0x11d414[_0xa264('0x12')]['channel']){if(!utils[_0xa264('0x18')](_0x11d414[_0xa264('0x12')][_0xa264('0x19')])){throw new APIBadRequestError(util[_0xa264('0x1a')](_0xa264('0x1b'),_0x11d414[_0xa264('0x12')]['channel']));}_0x1b67de=_0x11d414[_0xa264('0x12')][_0xa264('0x19')][_0xa264('0x1c')]();}if(!_0x11d414['query'][_0xa264('0x1d')]||!_0x11d414[_0xa264('0x12')][_0xa264('0x1d')][_0xa264('0x1e')](_0xa264('0x1f'))){_0x11d414['query'][_0xa264('0x1d')]=rta[_0xa264('0x20')](_0x11d414[_0xa264('0x12')][_0xa264('0x1d')]);return;}var _0x2baf1d=rta[_0xa264('0x21')](_0x11d414[_0xa264('0x12')][_0xa264('0x1d')]);_0x11d414[_0xa264('0x12')][_0xa264('0x1d')]=_0x2baf1d[_0xa264('0x22')]['join'](',');_0x389666=_0x2baf1d['order'];})[_0xa264('0x23')](function(){if(!_0x35203a){return[];}return rta[_0xa264('0x24')](_0x35203a,_0x1b67de);})['then'](function(_0x515739){_0x2fd6db=_0x515739;return rta[_0xa264('0x25')]();})['then'](function(_0x5cf35a){_0x3b9e5c=_0x5cf35a[_0xa264('0x26')];if((!_0x4ad174||_0x460183)&&!_0x389666){return _0x2fd6db;}if(_0x389666&&!_0x4ad174){return rta[_0xa264('0x27')](_0x3b9e5c,_0x2fd6db,_0x389666);}else{return rta['getAgentIdsByStatus'](_0x3b9e5c,_0x2fd6db,_0x4ad174);}})[_0xa264('0x23')](function(_0x5cc0c4){_0x2fd6db=_0x5cc0c4;var _0x30e17b=![];if(_0x2fd6db['length']===0x0){if(_0x35203a||_0x4ad174){_0x30e17b=!![];}if(_0x460183){_0x30e17b=![];}}if(_0x30e17b){return _0x216209;}var _0x323275=_[_0xa264('0x28')](db['User'][_0xa264('0x29')],function(_0x4952f3){return{'name':_0x4952f3[_0xa264('0x2a')],'type':_0x4952f3[_0xa264('0x2b')]['key']};});_0x11d414[_0xa264('0x12')]['role']='agent';_0x1e5719=qs['getOptions'](_0x323275,_0x11d414);_0x1e5719['raw']=!![];var _0x335abd=[];if(_0x2fd6db['length']>0x0){_0x335abd['push']({'id':{'$in':_0x2fd6db}});if(_0x389666&&!_0x4ad174){_0x14d2c0=[db[_0xa264('0x2c')][_0xa264('0x2d')](_0xa264('0x2e')+_0x2fd6db+')')];_0x1e5719[_0xa264('0x2f')]=_0x14d2c0;}}if(_0x460183){_0x5bedf2[_0xa264('0x30')](function(_0x3e45a7){var _0x501c7=!![];if(_0x4ad174===_0xa264('0x31')&&_0x1b67de!==_0x3e45a7){_0x501c7=![];}_0x335abd[_0xa264('0x32')]({[_0x3e45a7+_0xa264('0x33')]:_0x501c7});});if(_0x287ea7){_0x335abd[_0xa264('0x32')]({'pauseType':_0x287ea7});}}else if(_0x4ad174){_0x5bedf2[_0xa264('0x30')](function(_0x4c394f){_0x335abd[_0xa264('0x32')]({[_0x4c394f+_0xa264('0x33')]:![]});});}_0x1e5719[_0xa264('0x34')]=_['merge'](_0x1e5719[_0xa264('0x34')],{'$and':_0x335abd});if(_0x11d414[_0xa264('0x35')]['role']===_0xa264('0x35')){var _0x2eea2a={'params':{'id':_0x11d414['user'][_0xa264('0x36')]},'query':{'section':_0xa264('0x37'),'role':'agent','raw':!![],'ids':_0x2fd6db,'customSorting':_0x14d2c0}};if(_0x11d414[_0xa264('0x12')][_0xa264('0x38')]){_0x2eea2a[_0xa264('0x12')]['online']=!![];}if(_0x460183){_0x2eea2a[_0xa264('0x12')][_0xa264('0x39')]=_0x335abd;}_0x2eea2a['query']=Object[_0xa264('0x3a')](_0x2eea2a[_0xa264('0x12')],_0x11d414[_0xa264('0x12')]);return db[_0xa264('0x3b')][_0xa264('0x3c')](_0x2eea2a);}return db[_0xa264('0x3d')][_0xa264('0x3e')](_0x1e5719);})[_0xa264('0x23')](function(_0x24fa12){_0x216209['count']=_0x24fa12['count'];_0x4477e4=_0x24fa12[_0xa264('0x26')];return _0x4477e4[_0xa264('0x28')](function(_0x48ee2c){var _0xfbee71=_[_0xa264('0x3f')](_0x3b9e5c,['id',_0x48ee2c['id']]);if(_0xfbee71){var _0x1529fc=rta['filterAgentAttributes'](_0xfbee71);_[_0xa264('0x40')](_0x48ee2c,_0x1529fc);}_0x48ee2c[_0xa264('0x1f')]=rta[_0xa264('0x41')](_0x48ee2c);if(_0x48ee2c[_0xa264('0x1f')][_0xa264('0x1e')](_0xa264('0x16'))){_0x5bedf2['forEach'](function(_0x30eac6){if(_0x48ee2c[_0x30eac6+_0xa264('0x33')]){if(_0x30eac6==='voice'){if(_0x48ee2c['voiceStatus']!==_0xa264('0x42')){_0x48ee2c['voiceStatus']=_0xa264('0x16');}}else{_0x48ee2c[_0x30eac6+_0xa264('0x43')]=_0xa264('0x16');}}});}return _0x48ee2c;});})[_0xa264('0x23')](function(_0x222046){if(!_0x389666||_0x14d2c0){return _0x222046;}return rta['sortAgentsByStatus'](_0x222046,_0x389666);})[_0xa264('0x23')](function(_0x574cce){var _0x37feb5=rta['getRealtimeAgentsQueryFields']();_0x216209['rows']=_0x574cce[_0xa264('0x28')](function(_0x54951d){return _[_0xa264('0x44')](_0x54951d,_0x37feb5);});return _0x216209;})['then'](respondWithFilteredResult(_0x4f9cab,_0x1e5719))[_0xa264('0x45')](APIHandleError(_0x4f9cab));};exports[_0xa264('0x46')]=function(_0x45e90d,_0x98d8c2){var _0x58ec86={'count':0x0,'rows':[]};var _0x1c5cc9={};var _0x261266;var _0x357634;var _0x16e822;Promise[_0xa264('0x17')]()['then'](function(){if(_0x45e90d['query']['channel']){if(!utils[_0xa264('0x18')](_0x45e90d[_0xa264('0x12')][_0xa264('0x19')])){throw new APIBadRequestError(util['format'](_0xa264('0x1b'),_0x45e90d['query'][_0xa264('0x19')]));}_0x261266=_0x45e90d[_0xa264('0x12')][_0xa264('0x19')][_0xa264('0x1c')]();}var _0x208f44=_[_0xa264('0x47')](_0x261266)+_0xa264('0x48');var _0x5e9492=_[_0xa264('0x28')](db[_0x208f44][_0xa264('0x29')],function(_0x46acf9){return{'name':_0x46acf9[_0xa264('0x2a')],'type':_0x46acf9['type'][_0xa264('0x49')]};});if(!_0x45e90d[_0xa264('0x12')][_0xa264('0x22')]){var _0x380483=['id',_0xa264('0x4a')];if(_0x261266===_0xa264('0x4b')){_0x380483[_0xa264('0x32')](_0xa264('0x2b'));if(_0x45e90d[_0xa264('0x12')][_0xa264('0x2b')]===_0xa264('0x4c')){_0x380483[_0xa264('0x32')](['dialActive',_0xa264('0x4d')]);}}_0x45e90d['query'][_0xa264('0x22')]=_0x380483[_0xa264('0x4e')](',');}_0x1c5cc9=qs['getOptions'](_0x5e9492,_0x45e90d);if(_0x45e90d[_0xa264('0x35')][_0xa264('0x4f')]===_0xa264('0x35')){var _0x39b370={'params':{'id':_0x45e90d[_0xa264('0x35')][_0xa264('0x36')]},'query':{'section':_0x261266===_0xa264('0x4b')&&_0x45e90d['query'][_0xa264('0x2b')]==='outbound'?_0xa264('0x50'):_['startCase'](_0x261266)+_0xa264('0x51'),'type':_0x45e90d[_0xa264('0x12')][_0xa264('0x2b')],'nolimit':!![],'sort':_0xa264('0x4a'),'filter':_0x45e90d[_0xa264('0x12')]['filter']}};_0x39b370['query']=Object['assign'](_0x39b370[_0xa264('0x12')],_0x45e90d[_0xa264('0x12')]);delete _0x39b370[_0xa264('0x12')]['id'];return db['UserProfile']['getResources'](_0x39b370);}return db[_0x208f44][_0xa264('0x3e')](_0x1c5cc9);})[_0xa264('0x23')](function(_0x5ea92b){_0x58ec86[_0xa264('0xb')]=_0x5ea92b[_0xa264('0xb')];_0x357634=_0x5ea92b[_0xa264('0x26')];return rtq[_0xa264('0x52')](_0x45e90d,_0x261266);})['then'](function(_0x37164e){_0x16e822=_0x37164e['rows'];return rtq[_0xa264('0x53')](_0x357634,_0x16e822,_0x261266,_0x45e90d[_0xa264('0x12')][_0xa264('0x2b')]);})[_0xa264('0x23')](function(_0x2c6b81){_0x58ec86['rows']=_0x2c6b81;return _0x58ec86;})['then'](respondWithFilteredResult(_0x98d8c2,_0x1c5cc9))[_0xa264('0x45')](APIHandleError(_0x98d8c2));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 80b9f77..9e73f50 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ff9e6,_0x5c62a8){var _0x14b8f6=function(_0x5b6a9e){while(--_0x5b6a9e){_0x2ff9e6['push'](_0x2ff9e6['shift']());}};_0x14b8f6(++_0x5c62a8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xcb91[_0x13187a];return _0x65b85f;};'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(_0x34c590,_0x516d07){var _0x38b487=function(_0xb384e5){while(--_0xb384e5){_0x34c590['push'](_0x34c590['shift']());}};_0x38b487(++_0x516d07);}(_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 8f03771..3eedb71 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 _0x398a=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x4b85dd,_0x2aa0d4){var _0x2f3d99=function(_0x372b14){while(--_0x372b14){_0x4b85dd['push'](_0x4b85dd['shift']());}};_0x2f3d99(++_0x2aa0d4);}(_0x398a,0x11a));var _0xa398=function(_0x5bc2b5,_0x39f3b0){_0x5bc2b5=_0x5bc2b5-0x0;var _0x218898=_0x398a[_0x5bc2b5];return _0x218898;};'use strict';var Sequelize=require(_0xa398('0x0'));module[_0xa398('0x1')]={'state':{'type':Sequelize[_0xa398('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa398('0x3')]},'scheduledat':{'type':Sequelize[_0xa398('0x4')]},'uniqueid':{'type':Sequelize[_0xa398('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa398('0x3')]},'campaigntype':{'type':Sequelize[_0xa398('0x3')]},'membername':{'type':Sequelize[_0xa398('0x3')]}}; \ No newline at end of file +var _0x3b74=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x462e4d,_0x7ce6f7){var _0x49a7e5=function(_0x105b30){while(--_0x105b30){_0x462e4d['push'](_0x462e4d['shift']());}};_0x49a7e5(++_0x7ce6f7);}(_0x3b74,0x80));var _0x43b7=function(_0x121e0f,_0x1dce03){_0x121e0f=_0x121e0f-0x0;var _0x563380=_0x3b74[_0x121e0f];return _0x563380;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'state':{'type':Sequelize[_0x43b7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x43b7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x43b7('0x3')]},'starttime':{'type':Sequelize[_0x43b7('0x4')]},'responsetime':{'type':Sequelize[_0x43b7('0x4')]},'ringtime':{'type':Sequelize[_0x43b7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x43b7('0x3')]},'membername':{'type':Sequelize[_0x43b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5ed283e..0542acc 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 _0xc6a4=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0xc6a4,0x14c));var _0x4c6a=function(_0x5dfb16,_0x25d139){_0x5dfb16=_0x5dfb16-0x0;var _0x4750a8=_0xc6a4[_0x5dfb16];return _0x4750a8;};'use strict';var _=require(_0x4c6a('0x0'));var util=require(_0x4c6a('0x1'));var logger=require(_0x4c6a('0x2'))(_0x4c6a('0x3'));var moment=require(_0x4c6a('0x4'));var BPromise=require(_0x4c6a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4c6a('0x6'));var config=require(_0x4c6a('0x7'));var attributes=require(_0x4c6a('0x8'));module[_0x4c6a('0x9')]=function(_0x2ece16,_0x3dbcaf){return _0x2ece16[_0x4c6a('0xa')](_0x4c6a('0xb'),attributes,{'tableName':_0x4c6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde58=['bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','api','moment'];(function(_0x31d781,_0x27bc7c){var _0x2b90dd=function(_0x1b8dad){while(--_0x1b8dad){_0x31d781['push'](_0x31d781['shift']());}};_0x2b90dd(++_0x27bc7c);}(_0xde58,0x170));var _0x8de5=function(_0x4a4762,_0x52092a){_0x4a4762=_0x4a4762-0x0;var _0x2498ac=_0xde58[_0x4a4762];return _0x2498ac;};'use strict';var _=require(_0x8de5('0x0'));var util=require(_0x8de5('0x1'));var logger=require('../../config/logger')(_0x8de5('0x2'));var moment=require(_0x8de5('0x3'));var BPromise=require(_0x8de5('0x4'));var rp=require(_0x8de5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8de5('0x6'));var config=require(_0x8de5('0x7'));var attributes=require(_0x8de5('0x8'));module[_0x8de5('0x9')]=function(_0x53a2aa,_0x58f1f0){return _0x53a2aa['define'](_0x8de5('0xa'),attributes,{'tableName':_0x8de5('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 9b281a3..a435355 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 _0x78b9=['http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ReportAgentPreview','body','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x78b9,0x123));var _0x978b=function(_0x5ba141,_0x3a34ec){_0x5ba141=_0x5ba141-0x0;var _0x410354=_0x78b9[_0x5ba141];return _0x410354;};'use strict';var _=require(_0x978b('0x0'));var util=require('util');var moment=require(_0x978b('0x1'));var BPromise=require(_0x978b('0x2'));var rs=require(_0x978b('0x3'));var fs=require('fs');var Redis=require(_0x978b('0x4'));var db=require(_0x978b('0x5'))['db'];var utils=require(_0x978b('0x6'));var logger=require(_0x978b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x978b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ab7e0,_0x36db22,_0x3704ef){return new BPromise(function(_0x1d115d,_0x541212){return client['request'](_0x2ab7e0,_0x3704ef)[_0x978b('0x9')](function(_0x29b4ab){logger[_0x978b('0xa')](_0x978b('0xb'),_0x36db22,_0x978b('0xc'));logger[_0x978b('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x36db22,_0x978b('0xc'),JSON[_0x978b('0xe')](_0x29b4ab));if(_0x29b4ab[_0x978b('0xf')]){if(_0x29b4ab[_0x978b('0xf')]['code']===0x1f4){logger[_0x978b('0xf')](_0x978b('0xb'),_0x36db22,_0x29b4ab[_0x978b('0xf')]['message']);return _0x541212(_0x29b4ab[_0x978b('0xf')][_0x978b('0x10')]);}logger[_0x978b('0xf')](_0x978b('0xb'),_0x36db22,_0x29b4ab[_0x978b('0xf')][_0x978b('0x10')]);return _0x1d115d(_0x29b4ab[_0x978b('0xf')][_0x978b('0x10')]);}else{logger['info'](_0x978b('0xb'),_0x36db22,_0x978b('0xc'));_0x1d115d(_0x29b4ab[_0x978b('0x11')][_0x978b('0x10')]);}})[_0x978b('0x12')](function(_0x3b9a34){logger[_0x978b('0xf')](_0x978b('0xb'),_0x36db22,_0x3b9a34);_0x541212(_0x3b9a34);});});}exports['CreateReportAgentPreview']=function(_0x17641a){var _0x394b2c=this;return new Promise(function(_0xbe000e,_0x1b0a22){return db[_0x978b('0x13')]['create'](_0x17641a[_0x978b('0x14')],{'raw':_0x17641a['options']?_0x17641a['options'][_0x978b('0x15')]===undefined?!![]:![]:!![]})[_0x978b('0x9')](function(_0x317970){logger[_0x978b('0xa')](_0x978b('0x16'),_0x17641a);logger[_0x978b('0xd')](_0x978b('0x16'),_0x17641a,JSON[_0x978b('0xe')](_0x317970));_0xbe000e(_0x317970);})[_0x978b('0x12')](function(_0x36af6b){logger[_0x978b('0xf')]('CreateReportAgentPreview',_0x36af6b['message'],_0x17641a);_0x1b0a22(_0x394b2c[_0x978b('0xf')](0x1f4,_0x36af6b[_0x978b('0x10')]));});});}; \ No newline at end of file +var _0x675a=['stringify','error','code','message','info','result','catch','CreateReportAgentPreview','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x321777,_0x101b1c){var _0x4bacdb=function(_0x9b0b63){while(--_0x9b0b63){_0x321777['push'](_0x321777['shift']());}};_0x4bacdb(++_0x101b1c);}(_0x675a,0x1f0));var _0xa675=function(_0x35d2ec,_0x30848c){_0x35d2ec=_0x35d2ec-0x0;var _0x1ca87d=_0x675a[_0x35d2ec];return _0x1ca87d;};'use strict';var _=require('lodash');var util=require(_0xa675('0x0'));var moment=require(_0xa675('0x1'));var BPromise=require(_0xa675('0x2'));var rs=require(_0xa675('0x3'));var fs=require('fs');var Redis=require(_0xa675('0x4'));var db=require(_0xa675('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa675('0x6'))('rpc');var config=require(_0xa675('0x7'));var jayson=require(_0xa675('0x8'));var client=jayson[_0xa675('0x9')][_0xa675('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9aeb,_0x5a4636,_0xc45a94){return new BPromise(function(_0x3aae41,_0x1e80b2){return client[_0xa675('0xb')](_0x3c9aeb,_0xc45a94)[_0xa675('0xc')](function(_0x37bba5){logger['info'](_0xa675('0xd'),_0x5a4636,'request\x20sent');logger[_0xa675('0xe')](_0xa675('0xf'),_0x5a4636,_0xa675('0x10'),JSON[_0xa675('0x11')](_0x37bba5));if(_0x37bba5[_0xa675('0x12')]){if(_0x37bba5[_0xa675('0x12')][_0xa675('0x13')]===0x1f4){logger[_0xa675('0x12')](_0xa675('0xd'),_0x5a4636,_0x37bba5[_0xa675('0x12')]['message']);return _0x1e80b2(_0x37bba5[_0xa675('0x12')][_0xa675('0x14')]);}logger[_0xa675('0x12')](_0xa675('0xd'),_0x5a4636,_0x37bba5[_0xa675('0x12')]['message']);return _0x3aae41(_0x37bba5[_0xa675('0x12')][_0xa675('0x14')]);}else{logger[_0xa675('0x15')](_0xa675('0xd'),_0x5a4636,_0xa675('0x10'));_0x3aae41(_0x37bba5[_0xa675('0x16')]['message']);}})[_0xa675('0x17')](function(_0xec35d1){logger['error'](_0xa675('0xd'),_0x5a4636,_0xec35d1);_0x1e80b2(_0xec35d1);});});}exports[_0xa675('0x18')]=function(_0x119a51){var _0x238204=this;return new Promise(function(_0x463f77,_0x41cca8){return db['ReportAgentPreview']['create'](_0x119a51['body'],{'raw':_0x119a51[_0xa675('0x19')]?_0x119a51[_0xa675('0x19')][_0xa675('0x1a')]===undefined?!![]:![]:!![]})[_0xa675('0xc')](function(_0x587652){logger[_0xa675('0x15')](_0xa675('0x18'),_0x119a51);logger[_0xa675('0xe')](_0xa675('0x18'),_0x119a51,JSON[_0xa675('0x11')](_0x587652));_0x463f77(_0x587652);})[_0xa675('0x17')](function(_0x59e818){logger[_0xa675('0x12')](_0xa675('0x18'),_0x59e818['message'],_0x119a51);_0x41cca8(_0x238204['error'](0x1f4,_0x59e818[_0xa675('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 0f543be..a076ffb 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 _0x4740=['/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','fax','/fax/queues/:id','showFaxQueues','post','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0x3f8997,_0xe9e4d1){var _0x3274e0=function(_0xb2732c){while(--_0xb2732c){_0x3f8997['push'](_0x3f8997['shift']());}};_0x3274e0(++_0xe9e4d1);}(_0x4740,0x107));var _0x0474=function(_0x5ea5e2,_0x1dde7a){_0x5ea5e2=_0x5ea5e2-0x0;var _0x14ea4f=_0x4740[_0x5ea5e2];return _0x14ea4f;};'use strict';var multer=require(_0x0474('0x0'));var util=require(_0x0474('0x1'));var path=require('path');var express=require(_0x0474('0x2'));var router=express[_0x0474('0x3')]();var auth=require(_0x0474('0x4'));var controller=require('./rpc.controller');router[_0x0474('0x5')](_0x0474('0x6'),auth['isAuthenticated'](),controller[_0x0474('0x7')]);router[_0x0474('0x5')](_0x0474('0x8'),auth[_0x0474('0x9')](),controller[_0x0474('0xa')]);router['get'](_0x0474('0xb'),auth['isAuthenticated'](),controller[_0x0474('0xc')]);router[_0x0474('0x5')](_0x0474('0xd'),auth[_0x0474('0x9')](),controller[_0x0474('0xe')]);router[_0x0474('0x5')]('/chat/queues',auth[_0x0474('0x9')](),controller[_0x0474('0xf')]);router[_0x0474('0x5')](_0x0474('0x10'),auth[_0x0474('0x9')](),controller['mailQueues']);router[_0x0474('0x5')]('/mail/accounts',auth[_0x0474('0x9')](),controller[_0x0474('0x11')]);router[_0x0474('0x5')](_0x0474('0x12'),auth[_0x0474('0x9')](),controller['openchannelQueues']);router['get'](_0x0474('0x13'),auth[_0x0474('0x9')](),controller[_0x0474('0x14')]);router[_0x0474('0x5')](_0x0474('0x15'),auth[_0x0474('0x9')](),controller['whatsappQueues']);router['get'](_0x0474('0x16'),auth[_0x0474('0x9')](),controller[_0x0474('0x17')]);router[_0x0474('0x5')](_0x0474('0x18'),auth['isAuthenticated'](),controller[_0x0474('0x19')]);router[_0x0474('0x5')](_0x0474('0x1a'),auth[_0x0474('0x9')](),controller[_0x0474('0x1b')]);router[_0x0474('0x5')](_0x0474('0x1c'),auth[_0x0474('0x9')](),controller[_0x0474('0x1d')]);router[_0x0474('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x0474('0x9')](),controller[_0x0474('0x1e')]);router[_0x0474('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x0474('0x9')](),controller[_0x0474('0x1f')]);router[_0x0474('0x5')](_0x0474('0x20'),auth[_0x0474('0x9')](),controller[_0x0474('0x21')]);router['put'](_0x0474('0x20'),auth[_0x0474('0x9')](),controller[_0x0474('0x22')]);router[_0x0474('0x5')]('/outbound',auth[_0x0474('0x9')](),controller[_0x0474('0x23')]);router[_0x0474('0x5')](_0x0474('0x24'),auth[_0x0474('0x9')](),controller[_0x0474('0x25')]);router[_0x0474('0x5')](_0x0474('0x26'),auth[_0x0474('0x9')](),controller['agents']);router[_0x0474('0x27')](_0x0474('0x28'),auth['isAuthenticated'](),controller[_0x0474('0x29')]);router['get'](_0x0474('0x2a'),auth[_0x0474('0x9')](),controller[_0x0474('0x2b')]);router[_0x0474('0x5')]('/trunks',auth[_0x0474('0x9')](),controller['trunks']);router['get']('/campaigns',auth['isAuthenticated'](),controller[_0x0474('0x2c')]);router['get']('/fax/accounts',auth[_0x0474('0x9')](),controller[_0x0474('0x2d')]);router[_0x0474('0x5')](_0x0474('0x2e'),auth[_0x0474('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x0474('0x5')](_0x0474('0x2f'),auth[_0x0474('0x9')](),controller[_0x0474('0x30')]);router['get'](_0x0474('0x31'),auth[_0x0474('0x9')](),controller[_0x0474('0x32')]);router['get'](_0x0474('0x33'),auth[_0x0474('0x9')](),controller[_0x0474('0x34')]);router[_0x0474('0x5')](_0x0474('0x35'),auth[_0x0474('0x9')](),controller[_0x0474('0x36')]);router[_0x0474('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x0474('0x9')](),controller[_0x0474('0x37')]);router[_0x0474('0x5')](_0x0474('0x38'),auth[_0x0474('0x9')](),controller[_0x0474('0x39')]);router['post'](_0x0474('0x3a'),auth[_0x0474('0x9')](),controller[_0x0474('0x3b')](_0x0474('0x3c')));router['get'](_0x0474('0x3d'),auth[_0x0474('0x9')](),controller[_0x0474('0x3e')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0474('0x3b')]('chat'));router['get']('/chat/queues/:id',auth[_0x0474('0x9')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0474('0x3b')](_0x0474('0x3f')));router[_0x0474('0x5')](_0x0474('0x40'),auth[_0x0474('0x9')](),controller[_0x0474('0x41')]);router[_0x0474('0x42')]('/openchannel/queues/:id/notify',auth[_0x0474('0x9')](),controller['queueNotify']('openchannel'));router[_0x0474('0x5')](_0x0474('0x43'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x0474('0x42')](_0x0474('0x44'),auth[_0x0474('0x9')](),controller[_0x0474('0x3b')](_0x0474('0x45')));router[_0x0474('0x42')](_0x0474('0x46'),auth[_0x0474('0x9')](),controller[_0x0474('0x3b')](_0x0474('0x47')));router[_0x0474('0x5')](_0x0474('0x48'),auth[_0x0474('0x9')](),controller[_0x0474('0x49')]);router[_0x0474('0x5')](_0x0474('0x4a'),auth[_0x0474('0x9')](),controller[_0x0474('0x4b')]);router['post'](_0x0474('0x4c'),auth[_0x0474('0x9')](),controller[_0x0474('0x4d')]);module['exports']=router; \ No newline at end of file +var _0x1c90=['/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailAccounts','/openchannel/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor'];(function(_0x436e22,_0x4dae1f){var _0x284cc1=function(_0x39cc90){while(--_0x39cc90){_0x436e22['push'](_0x436e22['shift']());}};_0x284cc1(++_0x4dae1f);}(_0x1c90,0xd9));var _0x01c9=function(_0x5559eb,_0x34dec5){_0x5559eb=_0x5559eb-0x0;var _0x4641f7=_0x1c90[_0x5559eb];return _0x4641f7;};'use strict';var multer=require(_0x01c9('0x0'));var util=require('util');var path=require(_0x01c9('0x1'));var express=require(_0x01c9('0x2'));var router=express['Router']();var auth=require(_0x01c9('0x3'));var controller=require(_0x01c9('0x4'));router[_0x01c9('0x5')](_0x01c9('0x6'),auth[_0x01c9('0x7')](),controller['voiceChannels']);router['get'](_0x01c9('0x8'),auth['isAuthenticated'](),controller[_0x01c9('0x9')]);router['get'](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x01c9('0x5')](_0x01c9('0xb'),auth['isAuthenticated'](),controller[_0x01c9('0xc')]);router[_0x01c9('0x5')](_0x01c9('0xd'),auth['isAuthenticated'](),controller['chatQueues']);router['get'](_0x01c9('0xe'),auth[_0x01c9('0x7')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0x01c9('0x7')](),controller[_0x01c9('0xf')]);router[_0x01c9('0x5')](_0x01c9('0x10'),auth[_0x01c9('0x7')](),controller['openchannelQueues']);router['get']('/sms/queues',auth['isAuthenticated'](),controller[_0x01c9('0x11')]);router[_0x01c9('0x5')]('/whatsapp/queues',auth[_0x01c9('0x7')](),controller[_0x01c9('0x12')]);router[_0x01c9('0x5')]('/fax/queues',auth[_0x01c9('0x7')](),controller[_0x01c9('0x13')]);router[_0x01c9('0x5')](_0x01c9('0x14'),auth[_0x01c9('0x7')](),controller['voiceQueuesPreview']);router['get'](_0x01c9('0x15'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x16')]);router[_0x01c9('0x5')](_0x01c9('0x17'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x18')]);router[_0x01c9('0x5')](_0x01c9('0x19'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x1a')]);router['get'](_0x01c9('0x1b'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x1c')]);router[_0x01c9('0x5')]('/voice/queues/:id',auth[_0x01c9('0x7')](),controller[_0x01c9('0x1d')]);router[_0x01c9('0x1e')](_0x01c9('0x1f'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x20')]);router[_0x01c9('0x5')]('/outbound',auth[_0x01c9('0x7')](),controller[_0x01c9('0x21')]);router[_0x01c9('0x5')](_0x01c9('0x22'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x23')]);router[_0x01c9('0x5')]('/agents',auth[_0x01c9('0x7')](),controller[_0x01c9('0x24')]);router['put'](_0x01c9('0x25'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x26')]);router['get'](_0x01c9('0x27'),auth[_0x01c9('0x7')](),controller['telephones']);router['get'](_0x01c9('0x28'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x29')]);router[_0x01c9('0x5')](_0x01c9('0x2a'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x2b')]);router[_0x01c9('0x5')]('/fax/accounts',auth[_0x01c9('0x7')](),controller[_0x01c9('0x2c')]);router[_0x01c9('0x5')](_0x01c9('0x2d'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x2e')]);router[_0x01c9('0x5')](_0x01c9('0x2f'),auth['isAuthenticated'](),controller[_0x01c9('0x30')]);router[_0x01c9('0x5')](_0x01c9('0x31'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x32')]);router[_0x01c9('0x5')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x01c9('0x5')](_0x01c9('0x33'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x01c9('0x34'),auth[_0x01c9('0x7')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x01c9('0x35'),auth[_0x01c9('0x7')](),controller['faxQueuesWaitingInteractions']);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x01c9('0x36')](_0x01c9('0x37')));router[_0x01c9('0x5')]('/mail/queues/:id',auth[_0x01c9('0x7')](),controller[_0x01c9('0x38')]);router[_0x01c9('0x39')](_0x01c9('0x3a'),auth['isAuthenticated'](),controller[_0x01c9('0x36')]('chat'));router[_0x01c9('0x5')](_0x01c9('0x3b'),auth['isAuthenticated'](),controller[_0x01c9('0x3c')]);router[_0x01c9('0x39')](_0x01c9('0x3d'),auth['isAuthenticated'](),controller[_0x01c9('0x36')](_0x01c9('0x3e')));router[_0x01c9('0x5')](_0x01c9('0x3f'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x40')]);router[_0x01c9('0x39')](_0x01c9('0x41'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x36')]('openchannel'));router[_0x01c9('0x5')](_0x01c9('0x42'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x43')]);router['post']('/sms/queues/:id/notify',auth[_0x01c9('0x7')](),controller[_0x01c9('0x36')](_0x01c9('0x44')));router[_0x01c9('0x39')]('/whatsapp/queues/:id/notify',auth[_0x01c9('0x7')](),controller[_0x01c9('0x36')]('whatsapp'));router[_0x01c9('0x5')](_0x01c9('0x45'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x46')]);router[_0x01c9('0x5')](_0x01c9('0x47'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x48')]);router['post'](_0x01c9('0x49'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x4a')]);module[_0x01c9('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 9e01c32..e352f74 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x12a414,_0x1c9903){var _0x2adb33=function(_0x28f7d8){while(--_0x28f7d8){_0x12a414['push'](_0x12a414['shift']());}};_0x2adb33(++_0x1c9903);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x336f73,_0xd44072){var _0x130004=function(_0x4d1757){while(--_0x4d1757){_0x336f73['push'](_0x336f73['shift']());}};_0x130004(++_0xd44072);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 00931b7..8d10209 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 _0xfa43=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id/run','isAuthenticated','run','post','put','/:id','update','delete','destroy','exports'];(function(_0x7ded15,_0x3b29b3){var _0x51e5f5=function(_0x31d23a){while(--_0x31d23a){_0x7ded15['push'](_0x7ded15['shift']());}};_0x51e5f5(++_0x3b29b3);}(_0xfa43,0x108));var _0x3fa4=function(_0x478aef,_0x7066a3){_0x478aef=_0x478aef-0x0;var _0x5e9ef6=_0xfa43[_0x478aef];return _0x5e9ef6;};'use strict';var multer=require(_0x3fa4('0x0'));var util=require(_0x3fa4('0x1'));var path=require(_0x3fa4('0x2'));var timeout=require(_0x3fa4('0x3'));var express=require(_0x3fa4('0x4'));var router=express[_0x3fa4('0x5')]();var fs_extra=require(_0x3fa4('0x6'));var auth=require(_0x3fa4('0x7'));var interaction=require(_0x3fa4('0x8'));var config=require(_0x3fa4('0x9'));var controller=require(_0x3fa4('0xa'));router[_0x3fa4('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3fa4('0xb')](_0x3fa4('0xc'),auth[_0x3fa4('0xd')](),controller[_0x3fa4('0xe')]);router[_0x3fa4('0xf')]('/',auth[_0x3fa4('0xd')](),controller['create']);router[_0x3fa4('0x10')](_0x3fa4('0x11'),auth[_0x3fa4('0xd')](),controller[_0x3fa4('0x12')]);router[_0x3fa4('0x13')](_0x3fa4('0x11'),auth[_0x3fa4('0xd')](),controller[_0x3fa4('0x14')]);module[_0x3fa4('0x15')]=router; \ No newline at end of file +var _0x7952=['index','/:id','show','/:id/run','run','post','create','put','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5c3894,_0x3d701c){var _0x180dc0=function(_0x4bb3b1){while(--_0x4bb3b1){_0x5c3894['push'](_0x5c3894['shift']());}};_0x180dc0(++_0x3d701c);}(_0x7952,0xc9));var _0x2795=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x7952[_0x351509];return _0x4e9861;};'use strict';var multer=require(_0x2795('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2795('0x1'));var router=express[_0x2795('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2795('0x3'));var interaction=require(_0x2795('0x4'));var config=require(_0x2795('0x5'));var controller=require('./schedule.controller');router[_0x2795('0x6')]('/',auth[_0x2795('0x7')](),controller[_0x2795('0x8')]);router['get'](_0x2795('0x9'),auth['isAuthenticated'](),controller[_0x2795('0xa')]);router['get'](_0x2795('0xb'),auth[_0x2795('0x7')](),controller[_0x2795('0xc')]);router[_0x2795('0xd')]('/',auth[_0x2795('0x7')](),controller[_0x2795('0xe')]);router[_0x2795('0xf')]('/:id',auth[_0x2795('0x7')](),controller[_0x2795('0x10')]);router['delete'](_0x2795('0x9'),auth['isAuthenticated'](),controller[_0x2795('0x11')]);module[_0x2795('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d762a66..e1973b2 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 _0x3f7e=['minutes','csv','xlsx','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','months','weeks','days'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3f7e,0x66));var _0xe3f7=function(_0x7202e6,_0x3445b4){_0x7202e6=_0x7202e6-0x0;var _0x338e25=_0x3f7e[_0x7202e6];return _0x338e25;};'use strict';var Sequelize=require(_0xe3f7('0x0'));module[_0xe3f7('0x1')]={'name':{'type':Sequelize[_0xe3f7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe3f7('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe3f7('0x2')],'allowNull':![],'defaultValue':_0xe3f7('0x3')},'startAt':{'type':Sequelize[_0xe3f7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe3f7('0x5')](_0xe3f7('0x6'),'quarters',_0xe3f7('0x7'),_0xe3f7('0x8'),_0xe3f7('0x9'),'hours',_0xe3f7('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xe3f7('0x5')](_0xe3f7('0xb'),'pdf',_0xe3f7('0xc')),'allowNull':![],'defaultValue':_0xe3f7('0xb')},'type':{'type':Sequelize[_0xe3f7('0x5')](_0xe3f7('0xd'),'default'),'allowNull':![],'defaultValue':_0xe3f7('0xd')},'sendMail':{'type':Sequelize[_0xe3f7('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0xe3f7('0x2')]},'cc':{'type':Sequelize[_0xe3f7('0xf')]},'bcc':{'type':Sequelize[_0xe3f7('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xe3f7('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa6b4=['hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','years','quarters','weeks','days'];(function(_0x2ceb31,_0x40ecf1){var _0x168859=function(_0x3de469){while(--_0x3de469){_0x2ceb31['push'](_0x2ceb31['shift']());}};_0x168859(++_0x40ecf1);}(_0xa6b4,0x1a0));var _0x4a6b=function(_0x50278a,_0x2a68e0){_0x50278a=_0x50278a-0x0;var _0xda665c=_0xa6b4[_0x50278a];return _0xda665c;};'use strict';var Sequelize=require(_0x4a6b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4a6b('0x1')]},'active':{'type':Sequelize[_0x4a6b('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a6b('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4a6b('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x4a6b('0x5'),_0x4a6b('0x6'),'months',_0x4a6b('0x7'),_0x4a6b('0x8'),_0x4a6b('0x9'),_0x4a6b('0xa')),'allowNull':![],'defaultValue':_0x4a6b('0x8')},'output':{'type':Sequelize['ENUM'](_0x4a6b('0xb'),_0x4a6b('0xc'),_0x4a6b('0xd')),'allowNull':![],'defaultValue':_0x4a6b('0xb')},'type':{'type':Sequelize['ENUM'](_0x4a6b('0xe'),_0x4a6b('0xf')),'allowNull':![],'defaultValue':_0x4a6b('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x4a6b('0x1')]},'cc':{'type':Sequelize[_0x4a6b('0x10')]},'bcc':{'type':Sequelize[_0x4a6b('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x4a6b('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 998c94b..8496958 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 _0x02cf=['ioredis','../../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','apply','reject','save','then','destroy','Scheduler','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','Schedule','catch','show','include','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x460926,_0x4ed794){var _0x172605=function(_0x42b35f){while(--_0x42b35f){_0x460926['push'](_0x460926['shift']());}};_0x172605(++_0x4ed794);}(_0x02cf,0x135));var _0xf02c=function(_0x1eac5b,_0x44cdc5){_0x1eac5b=_0x1eac5b-0x0;var _0x40b4d6=_0x02cf[_0x1eac5b];return _0x40b4d6;};'use strict';var emlformat=require(_0xf02c('0x0'));var rimraf=require(_0xf02c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf02c('0x2'));var rp=require('request-promise');var moment=require(_0xf02c('0x3'));var BPromise=require(_0xf02c('0x4'));var Mustache=require(_0xf02c('0x5'));var util=require('util');var path=require(_0xf02c('0x6'));var sox=require(_0xf02c('0x7'));var csv=require('to-csv');var ejs=require(_0xf02c('0x8'));var fs=require('fs');var fs_extra=require(_0xf02c('0x9'));var _=require(_0xf02c('0xa'));var squel=require(_0xf02c('0xb'));var crypto=require('crypto');var jsforce=require(_0xf02c('0xc'));var deskjs=require(_0xf02c('0xd'));var toCsv=require(_0xf02c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf02c('0xf'));var authService=require(_0xf02c('0x10'));var qs=require(_0xf02c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf02c('0x12'));var logger=require(_0xf02c('0x13'))(_0xf02c('0x14'));var utils=require(_0xf02c('0x15'));var config=require(_0xf02c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf02c('0x17'))['db'];function respondWithStatusCode(_0x152a59,_0x89710a){_0x89710a=_0x89710a||0xcc;return function(_0x122237){if(_0x122237){return _0x152a59[_0xf02c('0x18')](_0x89710a);}return _0x152a59[_0xf02c('0x19')](_0x89710a)[_0xf02c('0x1a')]();};}function respondWithResult(_0x1817bc,_0x8a5d21){_0x8a5d21=_0x8a5d21||0xc8;return function(_0x2986fc){if(_0x2986fc){return _0x1817bc[_0xf02c('0x19')](_0x8a5d21)[_0xf02c('0x1b')](_0x2986fc);}};}function respondWithFilteredResult(_0x49244a,_0x19fc74){return function(_0x5390d7){if(_0x5390d7){var _0x5566c4=typeof _0x19fc74[_0xf02c('0x1c')]===_0xf02c('0x1d')&&typeof _0x19fc74[_0xf02c('0x1e')]===_0xf02c('0x1d');var _0x394b38=_0x5390d7[_0xf02c('0x1f')];var _0x87c797=_0x5566c4?0x0:_0x19fc74[_0xf02c('0x1c')];var _0x348109=_0x5566c4?_0x5390d7[_0xf02c('0x1f')]:_0x19fc74['offset']+_0x19fc74[_0xf02c('0x1e')];var _0x3aa86a;if(_0x348109>=_0x394b38){_0x348109=_0x394b38;_0x3aa86a=0xc8;}else{_0x3aa86a=0xce;}_0x49244a[_0xf02c('0x19')](_0x3aa86a);return _0x49244a[_0xf02c('0x20')]('Content-Range',_0x87c797+'-'+_0x348109+'/'+_0x394b38)[_0xf02c('0x1b')](_0x5390d7);}return null;};}function patchUpdates(_0x4c8dd8){return function(_0x4ac38d){try{jsonpatch[_0xf02c('0x21')](_0x4ac38d,_0x4c8dd8,!![]);}catch(_0x5c679e){return BPromise[_0xf02c('0x22')](_0x5c679e);}return _0x4ac38d[_0xf02c('0x23')]();};}function saveUpdates(_0x1dc1c3,_0x2c7581){return function(_0x51d8a9){if(_0x51d8a9){return _0x51d8a9['update'](_0x1dc1c3)[_0xf02c('0x24')](function(_0x4231c8){return _0x4231c8;});}return null;};}function removeEntity(_0x20a005,_0xee3373){return function(_0x2dd1ee){if(_0x2dd1ee){return _0x2dd1ee[_0xf02c('0x25')]()['then'](function(){var _0x3bbfd3=_0x2dd1ee['get']({'plain':!![]});var _0x595524=_0xf02c('0x26');return db[_0xf02c('0x27')][_0xf02c('0x25')]({'where':{'type':_0x595524,'resourceId':_0x3bbfd3['id']}})[_0xf02c('0x24')](function(){return _0x2dd1ee;});})['then'](function(){_0x20a005['status'](0xcc)[_0xf02c('0x1a')]();});}};}function handleEntityNotFound(_0x48c5b9,_0x2e74d2){return function(_0x50546d){if(!_0x50546d){_0x48c5b9[_0xf02c('0x18')](0x194);}return _0x50546d;};}function handleError(_0x526699,_0x366e3){_0x366e3=_0x366e3||0x1f4;return function(_0x22c799){logger[_0xf02c('0x28')](_0x22c799[_0xf02c('0x29')]);if(_0x22c799[_0xf02c('0x2a')]){delete _0x22c799[_0xf02c('0x2a')];}_0x526699[_0xf02c('0x19')](_0x366e3)['send'](_0x22c799);};}exports[_0xf02c('0x2b')]=function(_0x114bea,_0x5e3173){var _0x26a485={},_0x3cb823={},_0xb555d6={'count':0x0,'rows':[]};var _0x50b5b0=_[_0xf02c('0x2c')](db['Schedule'][_0xf02c('0x2d')],function(_0x2227cc){return{'name':_0x2227cc[_0xf02c('0x2e')],'type':_0x2227cc[_0xf02c('0x2f')][_0xf02c('0x30')]};});_0x3cb823[_0xf02c('0x31')]=_[_0xf02c('0x2c')](_0x50b5b0,_0xf02c('0x2a'));_0x3cb823[_0xf02c('0x32')]=_[_0xf02c('0x33')](_0x114bea['query']);_0x3cb823[_0xf02c('0x34')]=_[_0xf02c('0x35')](_0x3cb823['model'],_0x3cb823[_0xf02c('0x32')]);_0x26a485[_0xf02c('0x36')]=_[_0xf02c('0x35')](_0x3cb823[_0xf02c('0x31')],qs[_0xf02c('0x37')](_0x114bea[_0xf02c('0x32')][_0xf02c('0x37')]));_0x26a485[_0xf02c('0x36')]=_0x26a485[_0xf02c('0x36')]['length']?_0x26a485[_0xf02c('0x36')]:_0x3cb823[_0xf02c('0x31')];if(!_0x114bea[_0xf02c('0x32')][_0xf02c('0x38')](_0xf02c('0x39'))){_0x26a485['limit']=qs[_0xf02c('0x1e')](_0x114bea[_0xf02c('0x32')]['limit']);_0x26a485[_0xf02c('0x1c')]=qs[_0xf02c('0x1c')](_0x114bea[_0xf02c('0x32')][_0xf02c('0x1c')]);}_0x26a485[_0xf02c('0x3a')]=qs[_0xf02c('0x3b')](_0x114bea[_0xf02c('0x32')]['sort']);_0x26a485[_0xf02c('0x3c')]=qs[_0xf02c('0x34')](_[_0xf02c('0x3d')](_0x114bea[_0xf02c('0x32')],_0x3cb823[_0xf02c('0x34')]),_0x50b5b0);if(_0x114bea['query']['filter']){_0x26a485['where']=_[_0xf02c('0x3e')](_0x26a485['where'],{'$or':_[_0xf02c('0x2c')](_0x50b5b0,function(_0x606dca){if(_0x606dca[_0xf02c('0x2f')]!==_0xf02c('0x3f')){var _0x38e79d={};_0x38e79d[_0x606dca[_0xf02c('0x2a')]]={'$like':'%'+_0x114bea[_0xf02c('0x32')]['filter']+'%'};return _0x38e79d;}})});}_0x26a485=_[_0xf02c('0x3e')]({},_0x26a485,_0x114bea[_0xf02c('0x40')]);var _0x58a35e={'where':_0x26a485[_0xf02c('0x3c')]};return db[_0xf02c('0x41')][_0xf02c('0x1f')](_0x58a35e)['then'](function(_0x3a1263){_0xb555d6[_0xf02c('0x1f')]=_0x3a1263;if(_0x114bea['query']['includeAll']){_0x26a485['include']=[{'all':!![]}];}return db[_0xf02c('0x41')]['findAll'](_0x26a485);})[_0xf02c('0x24')](function(_0x195dc4){_0xb555d6['rows']=_0x195dc4;return _0xb555d6;})[_0xf02c('0x24')](respondWithFilteredResult(_0x5e3173,_0x26a485))[_0xf02c('0x42')](handleError(_0x5e3173,null));};exports[_0xf02c('0x43')]=function(_0x2163f0,_0x13aa6e){var _0x4fab94={'raw':![],'where':{'id':_0x2163f0['params']['id']}},_0x1b131a={};_0x1b131a['model']=_[_0xf02c('0x33')](db['Schedule'][_0xf02c('0x2d')]);_0x1b131a['query']=_[_0xf02c('0x33')](_0x2163f0[_0xf02c('0x32')]);_0x1b131a[_0xf02c('0x34')]=_['intersection'](_0x1b131a['model'],_0x1b131a[_0xf02c('0x32')]);_0x4fab94[_0xf02c('0x36')]=_[_0xf02c('0x35')](_0x1b131a[_0xf02c('0x31')],qs[_0xf02c('0x37')](_0x2163f0['query'][_0xf02c('0x37')]));_0x4fab94[_0xf02c('0x36')]=_0x4fab94['attributes']['length']?_0x4fab94[_0xf02c('0x36')]:_0x1b131a['model'];if(_0x2163f0[_0xf02c('0x32')]['includeAll']){_0x4fab94[_0xf02c('0x44')]=[{'all':!![]}];}_0x4fab94=_[_0xf02c('0x3e')]({},_0x4fab94,_0x2163f0[_0xf02c('0x40')]);return db[_0xf02c('0x41')][_0xf02c('0x45')](_0x4fab94)[_0xf02c('0x24')](handleEntityNotFound(_0x13aa6e,null))[_0xf02c('0x24')](respondWithResult(_0x13aa6e,null))['catch'](handleError(_0x13aa6e,null));};exports[_0xf02c('0x46')]=function(_0x1b78dd,_0x339748){return db[_0xf02c('0x41')][_0xf02c('0x46')](_0x1b78dd[_0xf02c('0x47')],{})[_0xf02c('0x24')](function(_0x281759){var _0x451656=_0x1b78dd['user'][_0xf02c('0x48')]({'plain':!![]});if(!_0x451656)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451656[_0xf02c('0x49')]===_0xf02c('0x4a')){var _0x1c1796=_0x281759[_0xf02c('0x48')]({'plain':!![]});var _0x408770='Scheduler';return db[_0xf02c('0x4b')][_0xf02c('0x45')]({'where':{'name':_0x408770,'userProfileId':_0x451656[_0xf02c('0x4c')]},'raw':!![]})[_0xf02c('0x24')](function(_0x42042e){if(_0x42042e&&_0x42042e[_0xf02c('0x4d')]===0x0){return db[_0xf02c('0x27')][_0xf02c('0x46')]({'name':_0x1c1796[_0xf02c('0x2a')],'resourceId':_0x1c1796['id'],'type':_0x42042e[_0xf02c('0x2a')],'sectionId':_0x42042e['id']},{})[_0xf02c('0x24')](function(){return _0x281759;});}else{return _0x281759;}})[_0xf02c('0x42')](function(_0x7781c4){logger[_0xf02c('0x28')](_0xf02c('0x4e'),_0x7781c4);throw _0x7781c4;});}return _0x281759;})[_0xf02c('0x24')](respondWithResult(_0x339748,0xc9))[_0xf02c('0x42')](handleError(_0x339748,null));};exports['update']=function(_0x297052,_0x3fa122){if(_0x297052[_0xf02c('0x47')]['id']){delete _0x297052['body']['id'];}return db[_0xf02c('0x41')][_0xf02c('0x45')]({'where':{'id':_0x297052['params']['id']}})[_0xf02c('0x24')](handleEntityNotFound(_0x3fa122,null))[_0xf02c('0x24')](saveUpdates(_0x297052['body'],null))['then'](respondWithResult(_0x3fa122,null))[_0xf02c('0x42')](handleError(_0x3fa122,null));};exports['destroy']=function(_0x461a54,_0x25f02d){return db[_0xf02c('0x41')][_0xf02c('0x45')]({'where':{'id':_0x461a54[_0xf02c('0x4f')]['id']}})[_0xf02c('0x24')](handleEntityNotFound(_0x25f02d,null))[_0xf02c('0x24')](removeEntity(_0x25f02d,null))[_0xf02c('0x42')](handleError(_0x25f02d,null));};exports['run']=function(_0x5a7370,_0x157ed3,_0x327a87){var _0x3a27ab=require(_0xf02c('0x50'));return db[_0xf02c('0x41')][_0xf02c('0x45')]({'where':{'id':_0x5a7370[_0xf02c('0x4f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x157ed3,null))[_0xf02c('0x24')](function(){_0x3a27ab['run'](_0x5a7370[_0xf02c('0x4f')]['id']);})[_0xf02c('0x24')](respondWithStatusCode(_0x157ed3,null))[_0xf02c('0x42')](handleError(_0x157ed3,null));}; \ No newline at end of file +var _0x6b47=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','Schedule','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Scheduler','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3755e3,_0x50694e){var _0x21b014=function(_0xd2baaa){while(--_0xd2baaa){_0x3755e3['push'](_0x3755e3['shift']());}};_0x21b014(++_0x50694e);}(_0x6b47,0x1db));var _0x76b4=function(_0x2330c5,_0x5ddb84){_0x2330c5=_0x2330c5-0x0;var _0x48133d=_0x6b47[_0x2330c5];return _0x48133d;};'use strict';var emlformat=require(_0x76b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x76b4('0x1'));var rp=require(_0x76b4('0x2'));var moment=require(_0x76b4('0x3'));var BPromise=require(_0x76b4('0x4'));var Mustache=require(_0x76b4('0x5'));var util=require(_0x76b4('0x6'));var path=require(_0x76b4('0x7'));var sox=require(_0x76b4('0x8'));var csv=require(_0x76b4('0x9'));var ejs=require(_0x76b4('0xa'));var fs=require('fs');var fs_extra=require(_0x76b4('0xb'));var _=require(_0x76b4('0xc'));var squel=require(_0x76b4('0xd'));var crypto=require('crypto');var jsforce=require(_0x76b4('0xe'));var deskjs=require(_0x76b4('0xf'));var toCsv=require(_0x76b4('0x9'));var querystring=require(_0x76b4('0x10'));var Papa=require(_0x76b4('0x11'));var Redis=require(_0x76b4('0x12'));var authService=require(_0x76b4('0x13'));var qs=require(_0x76b4('0x14'));var as=require(_0x76b4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76b4('0x16'))(_0x76b4('0x17'));var utils=require(_0x76b4('0x18'));var config=require(_0x76b4('0x19'));var licenseUtil=require(_0x76b4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d87ba,_0x28b0de){_0x28b0de=_0x28b0de||0xcc;return function(_0x51e5d5){if(_0x51e5d5){return _0x5d87ba[_0x76b4('0x1b')](_0x28b0de);}return _0x5d87ba[_0x76b4('0x1c')](_0x28b0de)[_0x76b4('0x1d')]();};}function respondWithResult(_0x30d1f7,_0x3eb8b8){_0x3eb8b8=_0x3eb8b8||0xc8;return function(_0xa99dc3){if(_0xa99dc3){return _0x30d1f7[_0x76b4('0x1c')](_0x3eb8b8)[_0x76b4('0x1e')](_0xa99dc3);}};}function respondWithFilteredResult(_0x130480,_0x990007){return function(_0x374f5d){if(_0x374f5d){var _0x33d58c=typeof _0x990007[_0x76b4('0x1f')]===_0x76b4('0x20')&&typeof _0x990007[_0x76b4('0x21')]===_0x76b4('0x20');var _0x3466a6=_0x374f5d[_0x76b4('0x22')];var _0x370948=_0x33d58c?0x0:_0x990007[_0x76b4('0x1f')];var _0x2525cd=_0x33d58c?_0x374f5d['count']:_0x990007[_0x76b4('0x1f')]+_0x990007[_0x76b4('0x21')];var _0x37b1ab;if(_0x2525cd>=_0x3466a6){_0x2525cd=_0x3466a6;_0x37b1ab=0xc8;}else{_0x37b1ab=0xce;}_0x130480[_0x76b4('0x1c')](_0x37b1ab);return _0x130480[_0x76b4('0x23')](_0x76b4('0x24'),_0x370948+'-'+_0x2525cd+'/'+_0x3466a6)[_0x76b4('0x1e')](_0x374f5d);}return null;};}function patchUpdates(_0x3bc56f){return function(_0x5a3a95){try{jsonpatch[_0x76b4('0x25')](_0x5a3a95,_0x3bc56f,!![]);}catch(_0x345922){return BPromise[_0x76b4('0x26')](_0x345922);}return _0x5a3a95[_0x76b4('0x27')]();};}function saveUpdates(_0x263288,_0x1264ff){return function(_0x1e4b78){if(_0x1e4b78){return _0x1e4b78[_0x76b4('0x28')](_0x263288)['then'](function(_0x2b4457){return _0x2b4457;});}return null;};}function removeEntity(_0x206e58,_0x3931f2){return function(_0x2a5cbb){if(_0x2a5cbb){return _0x2a5cbb[_0x76b4('0x29')]()[_0x76b4('0x2a')](function(){var _0x4ddb00=_0x2a5cbb['get']({'plain':!![]});var _0x5d977a=_0x76b4('0x2b');return db['UserProfileResource'][_0x76b4('0x29')]({'where':{'type':_0x5d977a,'resourceId':_0x4ddb00['id']}})[_0x76b4('0x2a')](function(){return _0x2a5cbb;});})[_0x76b4('0x2a')](function(){_0x206e58['status'](0xcc)[_0x76b4('0x1d')]();});}};}function handleEntityNotFound(_0x3e82ef,_0x33a809){return function(_0x3f65a2){if(!_0x3f65a2){_0x3e82ef[_0x76b4('0x1b')](0x194);}return _0x3f65a2;};}function handleError(_0x87f72e,_0x250ecc){_0x250ecc=_0x250ecc||0x1f4;return function(_0x4c3087){logger[_0x76b4('0x2c')](_0x4c3087[_0x76b4('0x2d')]);if(_0x4c3087[_0x76b4('0x2e')]){delete _0x4c3087['name'];}_0x87f72e[_0x76b4('0x1c')](_0x250ecc)[_0x76b4('0x2f')](_0x4c3087);};}exports[_0x76b4('0x30')]=function(_0x48bf43,_0x5e7f17){var _0x598366={},_0x25d7e9={},_0x3d07c2={'count':0x0,'rows':[]};var _0x2d4747=_[_0x76b4('0x31')](db['Schedule']['rawAttributes'],function(_0x451271){return{'name':_0x451271[_0x76b4('0x32')],'type':_0x451271[_0x76b4('0x33')][_0x76b4('0x34')]};});_0x25d7e9[_0x76b4('0x35')]=_[_0x76b4('0x31')](_0x2d4747,_0x76b4('0x2e'));_0x25d7e9[_0x76b4('0x36')]=_[_0x76b4('0x37')](_0x48bf43['query']);_0x25d7e9[_0x76b4('0x38')]=_[_0x76b4('0x39')](_0x25d7e9[_0x76b4('0x35')],_0x25d7e9[_0x76b4('0x36')]);_0x598366[_0x76b4('0x3a')]=_[_0x76b4('0x39')](_0x25d7e9['model'],qs[_0x76b4('0x3b')](_0x48bf43[_0x76b4('0x36')][_0x76b4('0x3b')]));_0x598366['attributes']=_0x598366['attributes'][_0x76b4('0x3c')]?_0x598366[_0x76b4('0x3a')]:_0x25d7e9[_0x76b4('0x35')];if(!_0x48bf43['query'][_0x76b4('0x3d')](_0x76b4('0x3e'))){_0x598366[_0x76b4('0x21')]=qs[_0x76b4('0x21')](_0x48bf43[_0x76b4('0x36')][_0x76b4('0x21')]);_0x598366[_0x76b4('0x1f')]=qs[_0x76b4('0x1f')](_0x48bf43[_0x76b4('0x36')][_0x76b4('0x1f')]);}_0x598366['order']=qs[_0x76b4('0x3f')](_0x48bf43[_0x76b4('0x36')]['sort']);_0x598366[_0x76b4('0x40')]=qs['filters'](_[_0x76b4('0x41')](_0x48bf43['query'],_0x25d7e9[_0x76b4('0x38')]),_0x2d4747);if(_0x48bf43[_0x76b4('0x36')][_0x76b4('0x42')]){_0x598366['where']=_[_0x76b4('0x43')](_0x598366['where'],{'$or':_[_0x76b4('0x31')](_0x2d4747,function(_0x34abf0){if(_0x34abf0[_0x76b4('0x33')]!==_0x76b4('0x44')){var _0x38ce84={};_0x38ce84[_0x34abf0['name']]={'$like':'%'+_0x48bf43[_0x76b4('0x36')][_0x76b4('0x42')]+'%'};return _0x38ce84;}})});}_0x598366=_[_0x76b4('0x43')]({},_0x598366,_0x48bf43[_0x76b4('0x45')]);var _0x2c2fcc={'where':_0x598366[_0x76b4('0x40')]};return db['Schedule'][_0x76b4('0x22')](_0x2c2fcc)['then'](function(_0xfaacf9){_0x3d07c2[_0x76b4('0x22')]=_0xfaacf9;if(_0x48bf43['query'][_0x76b4('0x46')]){_0x598366['include']=[{'all':!![]}];}return db['Schedule'][_0x76b4('0x47')](_0x598366);})[_0x76b4('0x2a')](function(_0x284705){_0x3d07c2[_0x76b4('0x48')]=_0x284705;return _0x3d07c2;})[_0x76b4('0x2a')](respondWithFilteredResult(_0x5e7f17,_0x598366))[_0x76b4('0x49')](handleError(_0x5e7f17,null));};exports[_0x76b4('0x4a')]=function(_0x2202be,_0xcaaddc){var _0x47673f={'raw':![],'where':{'id':_0x2202be['params']['id']}},_0x45d26b={};_0x45d26b['model']=_[_0x76b4('0x37')](db[_0x76b4('0x4b')][_0x76b4('0x4c')]);_0x45d26b[_0x76b4('0x36')]=_['keys'](_0x2202be['query']);_0x45d26b[_0x76b4('0x38')]=_[_0x76b4('0x39')](_0x45d26b[_0x76b4('0x35')],_0x45d26b[_0x76b4('0x36')]);_0x47673f[_0x76b4('0x3a')]=_[_0x76b4('0x39')](_0x45d26b['model'],qs[_0x76b4('0x3b')](_0x2202be[_0x76b4('0x36')]['fields']));_0x47673f[_0x76b4('0x3a')]=_0x47673f[_0x76b4('0x3a')]['length']?_0x47673f[_0x76b4('0x3a')]:_0x45d26b[_0x76b4('0x35')];if(_0x2202be[_0x76b4('0x36')][_0x76b4('0x46')]){_0x47673f['include']=[{'all':!![]}];}_0x47673f=_[_0x76b4('0x43')]({},_0x47673f,_0x2202be[_0x76b4('0x45')]);return db[_0x76b4('0x4b')]['find'](_0x47673f)[_0x76b4('0x2a')](handleEntityNotFound(_0xcaaddc,null))['then'](respondWithResult(_0xcaaddc,null))[_0x76b4('0x49')](handleError(_0xcaaddc,null));};exports[_0x76b4('0x4d')]=function(_0x2aabd5,_0x4f9771){return db[_0x76b4('0x4b')]['create'](_0x2aabd5['body'],{})[_0x76b4('0x2a')](function(_0xf9dd13){var _0x213363=_0x2aabd5[_0x76b4('0x4e')][_0x76b4('0x4f')]({'plain':!![]});if(!_0x213363)throw new Error(_0x76b4('0x50'));if(_0x213363[_0x76b4('0x51')]===_0x76b4('0x4e')){var _0x6b9b6b=_0xf9dd13['get']({'plain':!![]});var _0x460468='Scheduler';return db[_0x76b4('0x52')][_0x76b4('0x53')]({'where':{'name':_0x460468,'userProfileId':_0x213363[_0x76b4('0x54')]},'raw':!![]})['then'](function(_0x111c19){if(_0x111c19&&_0x111c19[_0x76b4('0x55')]===0x0){return db[_0x76b4('0x56')][_0x76b4('0x4d')]({'name':_0x6b9b6b[_0x76b4('0x2e')],'resourceId':_0x6b9b6b['id'],'type':_0x111c19[_0x76b4('0x2e')],'sectionId':_0x111c19['id']},{})[_0x76b4('0x2a')](function(){return _0xf9dd13;});}else{return _0xf9dd13;}})[_0x76b4('0x49')](function(_0x32576f){logger[_0x76b4('0x2c')](_0x76b4('0x57'),_0x32576f);throw _0x32576f;});}return _0xf9dd13;})['then'](respondWithResult(_0x4f9771,0xc9))[_0x76b4('0x49')](handleError(_0x4f9771,null));};exports[_0x76b4('0x28')]=function(_0x863d7f,_0x473d6f){if(_0x863d7f['body']['id']){delete _0x863d7f['body']['id'];}return db[_0x76b4('0x4b')][_0x76b4('0x53')]({'where':{'id':_0x863d7f[_0x76b4('0x58')]['id']}})[_0x76b4('0x2a')](handleEntityNotFound(_0x473d6f,null))[_0x76b4('0x2a')](saveUpdates(_0x863d7f['body'],null))['then'](respondWithResult(_0x473d6f,null))['catch'](handleError(_0x473d6f,null));};exports[_0x76b4('0x29')]=function(_0x40be3f,_0xbfb806){return db[_0x76b4('0x4b')][_0x76b4('0x53')]({'where':{'id':_0x40be3f[_0x76b4('0x58')]['id']}})[_0x76b4('0x2a')](handleEntityNotFound(_0xbfb806,null))[_0x76b4('0x2a')](removeEntity(_0xbfb806,null))['catch'](handleError(_0xbfb806,null));};exports[_0x76b4('0x59')]=function(_0x4741a9,_0x53c02,_0x27dd22){var _0x14e90f=require('../../config/schedule');return db[_0x76b4('0x4b')][_0x76b4('0x53')]({'where':{'id':_0x4741a9[_0x76b4('0x58')]['id']},'raw':!![]})[_0x76b4('0x2a')](handleEntityNotFound(_0x53c02,null))['then'](function(){_0x14e90f[_0x76b4('0x59')](_0x4741a9[_0x76b4('0x58')]['id']);})[_0x76b4('0x2a')](respondWithStatusCode(_0x53c02,null))[_0x76b4('0x49')](handleError(_0x53c02,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c3ef72c..2383aba 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 _0x9a89=['../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9a89,0x13a));var _0x99a8=function(_0x3b7b57,_0x18ca91){_0x3b7b57=_0x3b7b57-0x0;var _0x2845ec=_0x9a89[_0x3b7b57];return _0x2845ec;};'use strict';var _=require(_0x99a8('0x0'));var util=require('util');var logger=require(_0x99a8('0x1'))(_0x99a8('0x2'));var moment=require('moment');var BPromise=require(_0x99a8('0x3'));var rp=require(_0x99a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x99a8('0x5'));var attributes=require(_0x99a8('0x6'));module[_0x99a8('0x7')]=function(_0x5a216d,_0x223645){return _0x5a216d[_0x99a8('0x8')](_0x99a8('0x9'),attributes,{'tableName':_0x99a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03ff=['define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x2d1fbb,_0x2a8b6a){var _0x5c0237=function(_0x528e80){while(--_0x528e80){_0x2d1fbb['push'](_0x2d1fbb['shift']());}};_0x5c0237(++_0x2a8b6a);}(_0x03ff,0x137));var _0xf03f=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x03ff[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xf03f('0x0'));var util=require(_0xf03f('0x1'));var logger=require(_0xf03f('0x2'))('api');var moment=require(_0xf03f('0x3'));var BPromise=require(_0xf03f('0x4'));var rp=require(_0xf03f('0x5'));var fs=require('fs');var path=require(_0xf03f('0x6'));var rimraf=require(_0xf03f('0x7'));var config=require(_0xf03f('0x8'));var attributes=require(_0xf03f('0x9'));module[_0xf03f('0xa')]=function(_0x253faa,_0x48654b){return _0x253faa[_0xf03f('0xb')](_0xf03f('0xc'),attributes,{'tableName':_0xf03f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index d61084f..ad44deb 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 _0x716b=['info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x267e08,_0x1fe1ff){var _0x499a6e=function(_0x58ac51){while(--_0x58ac51){_0x267e08['push'](_0x267e08['shift']());}};_0x499a6e(++_0x1fe1ff);}(_0x716b,0x1ac));var _0xb716=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x716b[_0x45c981];return _0x4f62c8;};'use strict';var _=require(_0xb716('0x0'));var util=require(_0xb716('0x1'));var moment=require('moment');var BPromise=require(_0xb716('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb716('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb716('0x4'));var logger=require(_0xb716('0x5'))(_0xb716('0x6'));var config=require(_0xb716('0x7'));var jayson=require(_0xb716('0x8'));var client=jayson[_0xb716('0x9')][_0xb716('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27d47b,_0x5b5c6a,_0x4a40fe){return new BPromise(function(_0x105939,_0x3f4b3b){return client['request'](_0x27d47b,_0x4a40fe)[_0xb716('0xb')](function(_0x3da7df){logger[_0xb716('0xc')](_0xb716('0xd'),_0x5b5c6a,_0xb716('0xe'));logger[_0xb716('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5b5c6a,_0xb716('0xe'),JSON[_0xb716('0x10')](_0x3da7df));if(_0x3da7df[_0xb716('0x11')]){if(_0x3da7df['error'][_0xb716('0x12')]===0x1f4){logger['error'](_0xb716('0xd'),_0x5b5c6a,_0x3da7df[_0xb716('0x11')][_0xb716('0x13')]);return _0x3f4b3b(_0x3da7df[_0xb716('0x11')][_0xb716('0x13')]);}logger[_0xb716('0x11')](_0xb716('0xd'),_0x5b5c6a,_0x3da7df[_0xb716('0x11')][_0xb716('0x13')]);return _0x105939(_0x3da7df[_0xb716('0x11')][_0xb716('0x13')]);}else{logger[_0xb716('0xc')](_0xb716('0xd'),_0x5b5c6a,_0xb716('0xe'));_0x105939(_0x3da7df[_0xb716('0x14')][_0xb716('0x13')]);}})[_0xb716('0x15')](function(_0x845fa1){logger[_0xb716('0x11')](_0xb716('0xd'),_0x5b5c6a,_0x845fa1);_0x3f4b3b(_0x845fa1);});});} \ No newline at end of file +var _0xbe98=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0xbe98,0xc3));var _0x8be9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe98[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8be9('0x0'));var util=require(_0x8be9('0x1'));var moment=require(_0x8be9('0x2'));var BPromise=require(_0x8be9('0x3'));var rs=require(_0x8be9('0x4'));var fs=require('fs');var Redis=require(_0x8be9('0x5'));var db=require(_0x8be9('0x6'))['db'];var utils=require(_0x8be9('0x7'));var logger=require(_0x8be9('0x8'))(_0x8be9('0x9'));var config=require(_0x8be9('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8be9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6233d6,_0x4dc37b,_0x2b5bd2){return new BPromise(function(_0x57b479,_0x507769){return client[_0x8be9('0xc')](_0x6233d6,_0x2b5bd2)[_0x8be9('0xd')](function(_0x599e29){logger[_0x8be9('0xe')](_0x8be9('0xf'),_0x4dc37b,_0x8be9('0x10'));logger[_0x8be9('0x11')](_0x8be9('0x12'),_0x4dc37b,'request\x20sent',JSON[_0x8be9('0x13')](_0x599e29));if(_0x599e29[_0x8be9('0x14')]){if(_0x599e29[_0x8be9('0x14')][_0x8be9('0x15')]===0x1f4){logger[_0x8be9('0x14')]('Schedule,\x20%s,\x20%s',_0x4dc37b,_0x599e29['error']['message']);return _0x507769(_0x599e29[_0x8be9('0x14')][_0x8be9('0x16')]);}logger[_0x8be9('0x14')](_0x8be9('0xf'),_0x4dc37b,_0x599e29[_0x8be9('0x14')][_0x8be9('0x16')]);return _0x57b479(_0x599e29[_0x8be9('0x14')][_0x8be9('0x16')]);}else{logger[_0x8be9('0xe')](_0x8be9('0xf'),_0x4dc37b,_0x8be9('0x10'));_0x57b479(_0x599e29['result'][_0x8be9('0x16')]);}})[_0x8be9('0x17')](function(_0x3a744b){logger[_0x8be9('0x14')]('Schedule,\x20%s,\x20%s',_0x4dc37b,_0x3a744b);_0x507769(_0x3a744b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0970067..2c1daee 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 _0xcc92=['destroy','util','path','express','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id/download','create','put','update','delete','/:id'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xcc92,0x1d5));var _0x2cc9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcc92[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x2cc9('0x0'));var path=require(_0x2cc9('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cc9('0x2'));var router=express[_0x2cc9('0x3')]();var fs_extra=require(_0x2cc9('0x4'));var auth=require(_0x2cc9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x2cc9('0x6')]('/',auth['isAuthenticated'](),controller[_0x2cc9('0x7')]);router[_0x2cc9('0x6')](_0x2cc9('0x8'),auth[_0x2cc9('0x9')](),controller[_0x2cc9('0xa')]);router[_0x2cc9('0x6')]('/:id',auth[_0x2cc9('0x9')](),controller['show']);router[_0x2cc9('0x6')](_0x2cc9('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x2cc9('0x9')](),controller[_0x2cc9('0xc')]);router[_0x2cc9('0xd')]('/:id',auth[_0x2cc9('0x9')](),controller[_0x2cc9('0xe')]);router[_0x2cc9('0xf')](_0x2cc9('0x10'),auth[_0x2cc9('0x9')](),controller[_0x2cc9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x217d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','destroy','exports','multer','util'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x217d,0x178));var _0xd217=function(_0x1b5805,_0x588b11){_0x1b5805=_0x1b5805-0x0;var _0x5dc2c3=_0x217d[_0x1b5805];return _0x5dc2c3;};'use strict';var multer=require(_0xd217('0x0'));var util=require(_0xd217('0x1'));var path=require(_0xd217('0x2'));var timeout=require(_0xd217('0x3'));var express=require(_0xd217('0x4'));var router=express['Router']();var fs_extra=require(_0xd217('0x5'));var auth=require(_0xd217('0x6'));var interaction=require(_0xd217('0x7'));var config=require(_0xd217('0x8'));var controller=require(_0xd217('0x9'));router[_0xd217('0xa')]('/',auth['isAuthenticated'](),controller[_0xd217('0xb')]);router[_0xd217('0xa')](_0xd217('0xc'),auth[_0xd217('0xd')](),controller[_0xd217('0xe')]);router['get'](_0xd217('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xd217('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd217('0x10')]('/',auth[_0xd217('0xd')](),controller[_0xd217('0x11')]);router['put']('/:id',auth[_0xd217('0xd')](),controller[_0xd217('0x12')]);router['delete'](_0xd217('0xf'),auth['isAuthenticated'](),controller[_0xd217('0x13')]);module[_0xd217('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7641d7f..1fd6ecc 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 _0x4e2e=['../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','moment','path'];(function(_0x4f296b,_0x243fb6){var _0x2d94c1=function(_0xe49665){while(--_0xe49665){_0x4f296b['push'](_0x4f296b['shift']());}};_0x2d94c1(++_0x243fb6);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x114d4f,_0x1cb4ef){_0x114d4f=_0x114d4f-0x0;var _0x4a7429=_0x4e2e[_0x114d4f];return _0x4a7429;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var config=require(_0xe4e2('0x2'));module[_0xe4e2('0x3')]={'format':{'type':Sequelize[_0xe4e2('0x4')],'get':function(){return this[_0xe4e2('0x5')]('value')?path[_0xe4e2('0x6')](this[_0xe4e2('0x5')](_0xe4e2('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xe4e2('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe4e2('0x8')],'set':function(_0x36b1c6){var _0x1c4e64=_0x36b1c6[_0xe4e2('0x9')](/\\/g,'/');this[_0xe4e2('0xa')](_0xe4e2('0x7'),_0x1c4e64);}},'rating':{'type':Sequelize[_0xe4e2('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe4e2('0xb')],'set':function(_0x4912da){this[_0xe4e2('0xa')](_0xe4e2('0xc'),moment()[_0xe4e2('0xd')](_0x4912da,'ms'));this['setDataValue'](_0xe4e2('0xe'),moment());this[_0xe4e2('0xa')](_0xe4e2('0xf'),_0x4912da);}},'startedAt':{'type':Sequelize[_0xe4e2('0x10')],'get':function(){return moment(this[_0xe4e2('0x5')]('startedAt'))[_0xe4e2('0x11')](_0xe4e2('0x12'))[_0xe4e2('0x13')]();}},'closedAt':{'type':Sequelize[_0xe4e2('0x10')],'get':function(){return moment(this['getDataValue'](_0xe4e2('0xe')))[_0xe4e2('0x11')](_0xe4e2('0x12'))[_0xe4e2('0x13')]();}},'createdAt':{'type':Sequelize[_0xe4e2('0x10')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xe4e2('0x11')](_0xe4e2('0x12'))[_0xe4e2('0x13')]();}},'updatedAt':{'type':Sequelize[_0xe4e2('0x10')],'get':function(){return moment(this[_0xe4e2('0x5')]('updatedAt'))[_0xe4e2('0x11')](_0xe4e2('0x12'))[_0xe4e2('0x13')]();}}}; \ No newline at end of file +var _0x5242=['STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x5242,0x148));var _0x2524=function(_0x3d5f06,_0x38d5cc){_0x3d5f06=_0x3d5f06-0x0;var _0x2be4d9=_0x5242[_0x3d5f06];return _0x2be4d9;};'use strict';var Sequelize=require(_0x2524('0x0'));var moment=require(_0x2524('0x1'));var path=require(_0x2524('0x2'));var config=require(_0x2524('0x3'));module[_0x2524('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2524('0x5')](_0x2524('0x6'))?path[_0x2524('0x7')](this[_0x2524('0x5')](_0x2524('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x2524('0x8')]},'channel':{'type':Sequelize[_0x2524('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2b070c){var _0x1eca6b=_0x2b070c[_0x2524('0x9')](/\\/g,'/');this[_0x2524('0xa')]('value',_0x1eca6b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2524('0xb')],'set':function(_0x2ecd8f){this[_0x2524('0xa')]('startedAt',moment()[_0x2524('0xc')](_0x2ecd8f,'ms'));this[_0x2524('0xa')](_0x2524('0xd'),moment());this[_0x2524('0xa')](_0x2524('0xe'),_0x2ecd8f);}},'startedAt':{'type':Sequelize[_0x2524('0xf')],'get':function(){return moment(this[_0x2524('0x5')]('startedAt'))['format'](_0x2524('0x10'))[_0x2524('0x11')]();}},'closedAt':{'type':Sequelize[_0x2524('0xf')],'get':function(){return moment(this[_0x2524('0x5')](_0x2524('0xd')))[_0x2524('0x12')](_0x2524('0x10'))[_0x2524('0x11')]();}},'createdAt':{'type':Sequelize[_0x2524('0xf')],'get':function(){return moment(this[_0x2524('0x5')](_0x2524('0x13')))[_0x2524('0x12')](_0x2524('0x10'))[_0x2524('0x11')]();}},'updatedAt':{'type':Sequelize[_0x2524('0xf')],'get':function(){return moment(this[_0x2524('0x5')](_0x2524('0x14')))[_0x2524('0x12')](_0x2524('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f0a5c23..0e3c6bc 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 _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x54031f,_0x16624d){var _0x368669=function(_0x1eb0b5){while(--_0x1eb0b5){_0x54031f['push'](_0x54031f['shift']());}};_0x368669(++_0x16624d);}(_0x98a8,0x12c));var _0x898a=function(_0x1118ac,_0x24949a){_0x1118ac=_0x1118ac-0x0;var _0x924f2f=_0x98a8[_0x1118ac];return _0x924f2f;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0xdbc62f,_0x335ea0){var _0xfdffcf=function(_0x25e946){while(--_0x25e946){_0xdbc62f['push'](_0xdbc62f['shift']());}};_0xfdffcf(++_0x335ea0);}(_0x55ca,0x126));var _0xa55c=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0x55ca[_0x2c7377];return _0x35e181;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b218557..2b17a50 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 _0xccb4=['request-promise','path','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x41fe28,_0x5dfbad){var _0x190689=function(_0x35b203){while(--_0x35b203){_0x41fe28['push'](_0x41fe28['shift']());}};_0x190689(++_0x5dfbad);}(_0xccb4,0x13f));var _0x4ccb=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xccb4[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x4ccb('0x0'));var util=require(_0x4ccb('0x1'));var logger=require(_0x4ccb('0x2'))(_0x4ccb('0x3'));var moment=require(_0x4ccb('0x4'));var BPromise=require('bluebird');var rp=require(_0x4ccb('0x5'));var fs=require('fs');var path=require(_0x4ccb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ccb('0x7'));module[_0x4ccb('0x8')]=function(_0x2c1d24,_0x12061e){return _0x2c1d24[_0x4ccb('0x9')](_0x4ccb('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x4ccb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc56a=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','lodash'];(function(_0x2907a5,_0x1a83e4){var _0x361ad0=function(_0x2b9047){while(--_0x2b9047){_0x2907a5['push'](_0x2907a5['shift']());}};_0x361ad0(++_0x1a83e4);}(_0xc56a,0x144));var _0xac56=function(_0x5c1d09,_0x8f9ddb){_0x5c1d09=_0x5c1d09-0x0;var _0x2013b3=_0xc56a[_0x5c1d09];return _0x2013b3;};'use strict';var _=require(_0xac56('0x0'));var util=require(_0xac56('0x1'));var logger=require(_0xac56('0x2'))(_0xac56('0x3'));var moment=require(_0xac56('0x4'));var BPromise=require(_0xac56('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac56('0x6'));var rimraf=require(_0xac56('0x7'));var config=require(_0xac56('0x8'));var attributes=require(_0xac56('0x9'));module['exports']=function(_0x4c18ec,_0x42f595){return _0x4c18ec[_0xac56('0xa')](_0xac56('0xb'),attributes,{'tableName':_0xac56('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a174711..96927d4 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 _0x261c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','moment'];(function(_0x5ddf96,_0x317a40){var _0x7bce24=function(_0x1e01c4){while(--_0x1e01c4){_0x5ddf96['push'](_0x5ddf96['shift']());}};_0x7bce24(++_0x317a40);}(_0x261c,0x1f3));var _0xc261=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x261c[_0x152449];return _0x5b58b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc261('0x0'));var BPromise=require(_0xc261('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc261('0x2'));var db=require(_0xc261('0x3'))['db'];var utils=require(_0xc261('0x4'));var logger=require(_0xc261('0x5'))('rpc');var config=require(_0xc261('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed579,_0x26dbe8,_0x414fe3){return new BPromise(function(_0x16aa87,_0x569a2c){return client[_0xc261('0x7')](_0x4ed579,_0x414fe3)[_0xc261('0x8')](function(_0x558980){logger[_0xc261('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x26dbe8,_0xc261('0xa'));logger[_0xc261('0xb')](_0xc261('0xc'),_0x26dbe8,'request\x20sent',JSON[_0xc261('0xd')](_0x558980));if(_0x558980[_0xc261('0xe')]){if(_0x558980[_0xc261('0xe')][_0xc261('0xf')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x26dbe8,_0x558980[_0xc261('0xe')][_0xc261('0x10')]);return _0x569a2c(_0x558980[_0xc261('0xe')][_0xc261('0x10')]);}logger[_0xc261('0xe')](_0xc261('0x11'),_0x26dbe8,_0x558980[_0xc261('0xe')][_0xc261('0x10')]);return _0x16aa87(_0x558980[_0xc261('0xe')][_0xc261('0x10')]);}else{logger['info'](_0xc261('0x11'),_0x26dbe8,'request\x20sent');_0x16aa87(_0x558980[_0xc261('0x12')]['message']);}})[_0xc261('0x13')](function(_0x4982b3){logger[_0xc261('0xe')](_0xc261('0x11'),_0x26dbe8,_0x4982b3);_0x569a2c(_0x4982b3);});});} \ No newline at end of file +var _0x04a1=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x04a1,0x1b1));var _0x104a=function(_0x3e597f,_0x33aecc){_0x3e597f=_0x3e597f-0x0;var _0x3d31a2=_0x04a1[_0x3e597f];return _0x3d31a2;};'use strict';var _=require(_0x104a('0x0'));var util=require(_0x104a('0x1'));var moment=require(_0x104a('0x2'));var BPromise=require(_0x104a('0x3'));var rs=require(_0x104a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x104a('0x5'));var logger=require('../../config/logger')(_0x104a('0x6'));var config=require(_0x104a('0x7'));var jayson=require(_0x104a('0x8'));var client=jayson['client'][_0x104a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x443d4a,_0x4ee30d,_0x1f43b0){return new BPromise(function(_0x3eec7e,_0x1fc3ab){return client['request'](_0x443d4a,_0x1f43b0)[_0x104a('0xa')](function(_0x491aaf){logger[_0x104a('0xb')](_0x104a('0xc'),_0x4ee30d,'request\x20sent');logger[_0x104a('0xd')](_0x104a('0xe'),_0x4ee30d,_0x104a('0xf'),JSON[_0x104a('0x10')](_0x491aaf));if(_0x491aaf[_0x104a('0x11')]){if(_0x491aaf[_0x104a('0x11')]['code']===0x1f4){logger[_0x104a('0x11')](_0x104a('0xc'),_0x4ee30d,_0x491aaf[_0x104a('0x11')][_0x104a('0x12')]);return _0x1fc3ab(_0x491aaf[_0x104a('0x11')][_0x104a('0x12')]);}logger[_0x104a('0x11')](_0x104a('0xc'),_0x4ee30d,_0x491aaf[_0x104a('0x11')][_0x104a('0x12')]);return _0x3eec7e(_0x491aaf[_0x104a('0x11')][_0x104a('0x12')]);}else{logger[_0x104a('0xb')](_0x104a('0xc'),_0x4ee30d,_0x104a('0xf'));_0x3eec7e(_0x491aaf['result'][_0x104a('0x12')]);}})['catch'](function(_0x306482){logger[_0x104a('0x11')](_0x104a('0xc'),_0x4ee30d,_0x306482);_0x1fc3ab(_0x306482);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index bef4ca2..2f8ecd2 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 _0x9218=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','diskStorage','post','addLogoLogin','root','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','update','exports','multer'];(function(_0x444555,_0x5bb963){var _0x1db9d4=function(_0xfeecc){while(--_0xfeecc){_0x444555['push'](_0x444555['shift']());}};_0x1db9d4(++_0x5bb963);}(_0x9218,0x18b));var _0x8921=function(_0x59322e,_0x2a8e89){_0x59322e=_0x59322e-0x0;var _0x55a2f8=_0x9218[_0x59322e];return _0x55a2f8;};'use strict';var multer=require(_0x8921('0x0'));var util=require('util');var path=require(_0x8921('0x1'));var timeout=require(_0x8921('0x2'));var express=require(_0x8921('0x3'));var router=express['Router']();var fs_extra=require(_0x8921('0x4'));var auth=require(_0x8921('0x5'));var interaction=require(_0x8921('0x6'));var config=require(_0x8921('0x7'));var controller=require('./setting.controller');router[_0x8921('0x8')]('/',auth[_0x8921('0x9')](),controller['index']);router[_0x8921('0x8')](_0x8921('0xa'),controller[_0x8921('0xb')]);router['get'](_0x8921('0xc'),controller[_0x8921('0xd')]);router[_0x8921('0x8')](_0x8921('0xe'),controller[_0x8921('0xf')]);router['get'](_0x8921('0x10'),controller['getLogoLogin']);router['get'](_0x8921('0x11'),controller[_0x8921('0x12')]);router[_0x8921('0x8')]('/:id/preferred',controller[_0x8921('0x13')]);router['get'](_0x8921('0x14'),controller[_0x8921('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18193e,_0x1f2959,_0x401c08){_0x401c08(null,path[_0x8921('0x16')](config['root'],_0x8921('0x17')));},'filename':function(_0x1fb45e,_0x33f401,_0x7b6892){_0x7b6892(null,util[_0x8921('0x18')](_0x8921('0x19'),_0x8921('0x1a'),path[_0x8921('0x1b')](_0x33f401[_0x8921('0x1c')])));}})});router['post'](_0x8921('0xe'),upload[_0x8921('0x1d')](_0x8921('0x1e')),controller[_0x8921('0x1f')]);var upload=multer({'storage':multer[_0x8921('0x20')]({'destination':function(_0x258405,_0x481243,_0x123d7d){_0x123d7d(null,path['join'](config['root'],_0x8921('0x17')));},'filename':function(_0x374fab,_0x8112a5,_0x90c8f6){_0x90c8f6(null,util[_0x8921('0x18')](_0x8921('0x19'),'logologin',path[_0x8921('0x1b')](_0x8112a5[_0x8921('0x1c')])));}})});router[_0x8921('0x21')](_0x8921('0x10'),upload[_0x8921('0x1d')](_0x8921('0x1e')),controller[_0x8921('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x413772,_0x3c5568,_0x218861){_0x218861(null,path['join'](config[_0x8921('0x23')],_0x8921('0x17')));},'filename':function(_0x43d79b,_0x311fd4,_0x5c1a04){_0x5c1a04(null,util[_0x8921('0x18')](_0x8921('0x19'),_0x8921('0x24'),path['extname'](_0x311fd4[_0x8921('0x1c')])));}})});router[_0x8921('0x21')](_0x8921('0x25'),upload['single']('file'),controller[_0x8921('0x26')]);var upload=multer({'storage':multer[_0x8921('0x20')]({'destination':function(_0x3f0815,_0x5d6143,_0x5e9236){_0x5e9236(null,path[_0x8921('0x16')](config[_0x8921('0x23')],'server/files/images/logos/'));},'filename':function(_0x2962f2,_0x1ebde0,_0x4562cf){_0x4562cf(null,util[_0x8921('0x18')](_0x8921('0x19'),_0x8921('0x27'),path[_0x8921('0x1b')](_0x1ebde0[_0x8921('0x1c')])));}})});router[_0x8921('0x21')](_0x8921('0x14'),upload['single'](_0x8921('0x1e')),controller[_0x8921('0x28')]);router[_0x8921('0x29')]('/:id',auth[_0x8921('0x9')](),controller[_0x8921('0x2a')]);module[_0x8921('0x2b')]=router; \ No newline at end of file +var _0xf771=['/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','root','logologin','addLogoLogin','diskStorage','preferred','favicon','addFavicon','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','getDate'];(function(_0x26f4cd,_0x32edc8){var _0x1e4cf8=function(_0x3bcad3){while(--_0x3bcad3){_0x26f4cd['push'](_0x26f4cd['shift']());}};_0x1e4cf8(++_0x32edc8);}(_0xf771,0x183));var _0x1f77=function(_0x4d7392,_0x8eae86){_0x4d7392=_0x4d7392-0x0;var _0x2279a6=_0xf771[_0x4d7392];return _0x2279a6;};'use strict';var multer=require('multer');var util=require(_0x1f77('0x0'));var path=require(_0x1f77('0x1'));var timeout=require(_0x1f77('0x2'));var express=require(_0x1f77('0x3'));var router=express[_0x1f77('0x4')]();var fs_extra=require(_0x1f77('0x5'));var auth=require(_0x1f77('0x6'));var interaction=require(_0x1f77('0x7'));var config=require(_0x1f77('0x8'));var controller=require(_0x1f77('0x9'));router['get']('/',auth[_0x1f77('0xa')](),controller['index']);router[_0x1f77('0xb')]('/now',controller[_0x1f77('0xc')]);router[_0x1f77('0xb')]('/:id',controller['show']);router[_0x1f77('0xb')](_0x1f77('0xd'),controller['getLogo']);router[_0x1f77('0xb')](_0x1f77('0xe'),controller['getLogoLogin']);router[_0x1f77('0xb')](_0x1f77('0xf'),controller[_0x1f77('0x10')]);router['get'](_0x1f77('0x11'),controller[_0x1f77('0x12')]);router[_0x1f77('0xb')](_0x1f77('0x13'),controller[_0x1f77('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x530034,_0x5203e8,_0x4dee33){_0x4dee33(null,path[_0x1f77('0x15')](config['root'],_0x1f77('0x16')));},'filename':function(_0x59e20c,_0x1d0f6d,_0x484072){_0x484072(null,util[_0x1f77('0x17')](_0x1f77('0x18'),'logo',path[_0x1f77('0x19')](_0x1d0f6d[_0x1f77('0x1a')])));}})});router[_0x1f77('0x1b')](_0x1f77('0xd'),upload[_0x1f77('0x1c')](_0x1f77('0x1d')),controller[_0x1f77('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47450a,_0x55de45,_0x28e65f){_0x28e65f(null,path[_0x1f77('0x15')](config[_0x1f77('0x1f')],_0x1f77('0x16')));},'filename':function(_0x54ee02,_0x30deb7,_0x169c3b){_0x169c3b(null,util['format']('%s%s',_0x1f77('0x20'),path[_0x1f77('0x19')](_0x30deb7[_0x1f77('0x1a')])));}})});router['post'](_0x1f77('0xe'),upload[_0x1f77('0x1c')](_0x1f77('0x1d')),controller[_0x1f77('0x21')]);var upload=multer({'storage':multer[_0x1f77('0x22')]({'destination':function(_0x2da991,_0x582067,_0x8af773){_0x8af773(null,path['join'](config[_0x1f77('0x1f')],_0x1f77('0x16')));},'filename':function(_0xd78f9f,_0x11ea0f,_0x362e38){_0x362e38(null,util['format']('%s%s',_0x1f77('0x23'),path[_0x1f77('0x19')](_0x11ea0f[_0x1f77('0x1a')])));}})});router[_0x1f77('0x1b')](_0x1f77('0x11'),upload['single'](_0x1f77('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12dfe9,_0x32b0a2,_0xa4a2d5){_0xa4a2d5(null,path[_0x1f77('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x6465e2,_0x447a5e,_0x397cd1){_0x397cd1(null,util[_0x1f77('0x17')]('%s%s',_0x1f77('0x24'),path[_0x1f77('0x19')](_0x447a5e['originalname'])));}})});router[_0x1f77('0x1b')](_0x1f77('0x13'),upload[_0x1f77('0x1c')](_0x1f77('0x1d')),controller[_0x1f77('0x25')]);router['put']('/:id',auth[_0x1f77('0xa')](),controller[_0x1f77('0x26')]);module[_0x1f77('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8eacf37..040f855 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 _0xf5ef=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','min_internal','INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x518e48,_0x2e5dc6){var _0x5d2de4=function(_0x42516a){while(--_0x42516a){_0x518e48['push'](_0x518e48['shift']());}};_0x5d2de4(++_0x2e5dc6);}(_0xf5ef,0x127));var _0xff5e=function(_0x52fa19,_0x270379){_0x52fa19=_0x52fa19-0x0;var _0x1395cf=_0xf5ef[_0x52fa19];return _0x1395cf;};'use strict';var Sequelize=require(_0xff5e('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xff5e('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xff5e('0x2')](0xb),'unique':_0xff5e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xff5e('0x4')},'logo':{'type':Sequelize[_0xff5e('0x5')]},'defaultLogo':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xff5e('0x5')]},'turnaddr':{'type':Sequelize[_0xff5e('0x5')]},'turnusername':{'type':Sequelize[_0xff5e('0x5')]},'turnpassword':{'type':Sequelize[_0xff5e('0x5')]},'pageTitle':{'type':Sequelize[_0xff5e('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xff5e('0x7')},'enableEmailPreview':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xff5e('0x5')],'defaultValue':_0xff5e('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xff5e('0x5')]},'defaultPreferred':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xff5e('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xff5e('0x5')]},'defaultFavicon':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xff5e('0x2')]},'transcribeRegion':{'type':Sequelize[_0xff5e('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xff5e('0x2')]},'sentimentRegion':{'type':Sequelize[_0xff5e('0x5')]},'language':{'type':Sequelize[_0xff5e('0x5')]},'bucket':{'type':Sequelize[_0xff5e('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xff5e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xff5e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xff5e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xff5e('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xff5e('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xff5e('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8e5=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xb8e5,0x1ac));var _0x5b8e=function(_0x89c192,_0x1d0605){_0x89c192=_0x89c192-0x0;var _0x2021c7=_0xb8e5[_0x89c192];return _0x2021c7;};'use strict';var Sequelize=require(_0x5b8e('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x5b8e('0x1')](0xb),'unique':_0x5b8e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5b8e('0x1')](0xb),'unique':_0x5b8e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x5b8e('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5b8e('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5b8e('0x6')]},'turnaddr':{'type':Sequelize[_0x5b8e('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x5b8e('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5b8e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5b8e('0x6')],'defaultValue':_0x5b8e('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5b8e('0x6')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5b8e('0x6')]},'defaultPreferred':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5b8e('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5b8e('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5b8e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x5b8e('0x6')]},'language':{'type':Sequelize[_0x5b8e('0x6')]},'bucket':{'type':Sequelize[_0x5b8e('0x6')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5b8e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5b8e('0x1')](0x2)[_0x5b8e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5b8e('0x1')](0x2)[_0x5b8e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5b8e('0x1')](0x2)[_0x5b8e('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5b8e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x5b8e('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index af74d81..0f825de 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 _0xbe27=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','addLogo','file','logo','filename','addLogoLogin','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','toLower','join','root','upperFirst','custom','default_logo.svg','Sequelize','server/files/images/logos','loginLogo','default_loginLogo.svg','existsSync','\x20not\x20found','download','securePassword','getPreferred','defaultPreferred','default_preferred.png','default','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','rimraf','zip-dir','request-promise','moment','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/utils','../../config/environment','../../config/license/util','../../mysqldb','client','then','info','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','Setting','fieldName'];(function(_0x4b7b4f,_0x2084d9){var _0x2f3d1a=function(_0x439689){while(--_0x439689){_0x4b7b4f['push'](_0x4b7b4f['shift']());}};_0x2f3d1a(++_0x2084d9);}(_0xbe27,0x12d));var _0x7be2=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbe27[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7be2('0x0'));var zipdir=require(_0x7be2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7be2('0x2'));var moment=require(_0x7be2('0x3'));var BPromise=require(_0x7be2('0x4'));var Mustache=require(_0x7be2('0x5'));var util=require(_0x7be2('0x6'));var path=require(_0x7be2('0x7'));var sox=require(_0x7be2('0x8'));var csv=require('to-csv');var ejs=require(_0x7be2('0x9'));var fs=require('fs');var fs_extra=require(_0x7be2('0xa'));var _=require(_0x7be2('0xb'));var squel=require('squel');var crypto=require(_0x7be2('0xc'));var jsforce=require(_0x7be2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7be2('0xe'));var querystring=require(_0x7be2('0xf'));var Papa=require(_0x7be2('0x10'));var Redis=require(_0x7be2('0x11'));var authService=require(_0x7be2('0x12'));var qs=require(_0x7be2('0x13'));var as=require(_0x7be2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7be2('0x15'));var config=require(_0x7be2('0x16'));var licenseUtil=require(_0x7be2('0x17'));var db=require(_0x7be2('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7be2('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x196e5a,_0x3070f9,_0x2687c7,_0x319478){return new BPromise(function(_0x108d2e,_0x370895){var _0x1f1572=_0x319478||client;return _0x1f1572['request'](_0x196e5a,_0x2687c7)[_0x7be2('0x1a')](function(_0xc40584){logger[_0x7be2('0x1b')]('Setting,\x20%s,\x20%s',_0x3070f9,_0x7be2('0x1c'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x3070f9,_0x7be2('0x1c'),JSON[_0x7be2('0x1d')](_0xc40584));if(_0xc40584[_0x7be2('0x1e')]){if(_0xc40584[_0x7be2('0x1e')]['code']===0x1f4){logger[_0x7be2('0x1e')](_0x7be2('0x1f'),_0x3070f9,_0xc40584['error'][_0x7be2('0x20')]);return _0x370895(_0xc40584[_0x7be2('0x1e')][_0x7be2('0x20')]);}logger[_0x7be2('0x1e')]('Setting,\x20%s,\x20%s',_0x3070f9,_0xc40584[_0x7be2('0x1e')][_0x7be2('0x20')]);return _0x108d2e(_0xc40584[_0x7be2('0x1e')][_0x7be2('0x20')]);}else{logger[_0x7be2('0x1b')](_0x7be2('0x1f'),_0x3070f9,_0x7be2('0x1c'));_0x108d2e(_0xc40584[_0x7be2('0x21')][_0x7be2('0x20')]);}})[_0x7be2('0x22')](function(_0x130e28){logger[_0x7be2('0x1e')](_0x7be2('0x1f'),_0x3070f9,_0x130e28);_0x370895(_0x130e28);});});}function respondWithStatusCode(_0x1feeb4,_0x2a2eae){_0x2a2eae=_0x2a2eae||0xcc;return function(_0x4350f0){if(_0x4350f0){return _0x1feeb4[_0x7be2('0x23')](_0x2a2eae);}return _0x1feeb4[_0x7be2('0x24')](_0x2a2eae)[_0x7be2('0x25')]();};}function respondWithResult(_0x19a68e,_0x5d2bf5){_0x5d2bf5=_0x5d2bf5||0xc8;return function(_0x1dcb4b){if(_0x1dcb4b){return _0x19a68e[_0x7be2('0x24')](_0x5d2bf5)[_0x7be2('0x26')](_0x1dcb4b);}};}function respondWithFilteredResult(_0x117d04,_0x5641c5){return function(_0x484aee){if(_0x484aee){var _0x34225b=typeof _0x5641c5['offset']===_0x7be2('0x27')&&typeof _0x5641c5[_0x7be2('0x28')]===_0x7be2('0x27');var _0x553512=_0x484aee[_0x7be2('0x29')];var _0x2e2b59=_0x34225b?0x0:_0x5641c5[_0x7be2('0x2a')];var _0x34f497=_0x34225b?_0x484aee[_0x7be2('0x29')]:_0x5641c5[_0x7be2('0x2a')]+_0x5641c5['limit'];var _0x3bd283;if(_0x34f497>=_0x553512){_0x34f497=_0x553512;_0x3bd283=0xc8;}else{_0x3bd283=0xce;}_0x117d04['status'](_0x3bd283);return _0x117d04[_0x7be2('0x2b')](_0x7be2('0x2c'),_0x2e2b59+'-'+_0x34f497+'/'+_0x553512)[_0x7be2('0x26')](_0x484aee);}return null;};}function patchUpdates(_0x5ded7f){return function(_0x1cb25b){try{jsonpatch[_0x7be2('0x2d')](_0x1cb25b,_0x5ded7f,!![]);}catch(_0x1e80b7){return BPromise[_0x7be2('0x2e')](_0x1e80b7);}return _0x1cb25b['save']();};}function saveUpdates(_0x478d56,_0x541312){return function(_0xe3362a){if(_0xe3362a){return _0xe3362a[_0x7be2('0x2f')](_0x478d56)[_0x7be2('0x1a')](function(_0x5b5b5a){return _0x5b5b5a;});}return null;};}function removeEntity(_0x263b80,_0x55ae8c){return function(_0x2e213d){if(_0x2e213d){return _0x2e213d[_0x7be2('0x30')]()[_0x7be2('0x1a')](function(){_0x263b80[_0x7be2('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ae63,_0x4b76bd){return function(_0x33a47c){if(!_0x33a47c){_0x55ae63['sendStatus'](0x194);}return _0x33a47c;};}function handleError(_0x1d8143,_0x2aafb1){_0x2aafb1=_0x2aafb1||0x1f4;return function(_0x26fb89){logger[_0x7be2('0x1e')](_0x26fb89[_0x7be2('0x31')]);if(_0x26fb89[_0x7be2('0x32')]){delete _0x26fb89[_0x7be2('0x32')];}_0x1d8143['status'](_0x2aafb1)[_0x7be2('0x33')](_0x26fb89);};}exports[_0x7be2('0x34')]=function(_0x29f723,_0x541437){var _0x16cf40={},_0x1ede19={},_0x50f9c3={'count':0x0,'rows':[]};var _0x30e67f=_[_0x7be2('0x35')](db[_0x7be2('0x36')]['rawAttributes'],function(_0x10f59e){return{'name':_0x10f59e[_0x7be2('0x37')],'type':_0x10f59e[_0x7be2('0x38')][_0x7be2('0x39')]};});_0x1ede19[_0x7be2('0x3a')]=_[_0x7be2('0x35')](_0x30e67f,'name');_0x1ede19[_0x7be2('0x3b')]=_[_0x7be2('0x3c')](_0x29f723[_0x7be2('0x3b')]);_0x1ede19[_0x7be2('0x3d')]=_[_0x7be2('0x3e')](_0x1ede19[_0x7be2('0x3a')],_0x1ede19[_0x7be2('0x3b')]);_0x16cf40[_0x7be2('0x3f')]=_['intersection'](_0x1ede19[_0x7be2('0x3a')],qs['fields'](_0x29f723['query'][_0x7be2('0x40')]));_0x16cf40[_0x7be2('0x3f')]=_0x16cf40[_0x7be2('0x3f')][_0x7be2('0x41')]?_0x16cf40[_0x7be2('0x3f')]:_0x1ede19[_0x7be2('0x3a')];if(!_0x29f723[_0x7be2('0x3b')]['hasOwnProperty'](_0x7be2('0x42'))){_0x16cf40[_0x7be2('0x28')]=qs['limit'](_0x29f723[_0x7be2('0x3b')][_0x7be2('0x28')]);_0x16cf40[_0x7be2('0x2a')]=qs[_0x7be2('0x2a')](_0x29f723['query'][_0x7be2('0x2a')]);}_0x16cf40[_0x7be2('0x43')]=qs[_0x7be2('0x44')](_0x29f723[_0x7be2('0x3b')][_0x7be2('0x44')]);_0x16cf40[_0x7be2('0x45')]=qs[_0x7be2('0x3d')](_[_0x7be2('0x46')](_0x29f723[_0x7be2('0x3b')],_0x1ede19[_0x7be2('0x3d')]),_0x30e67f);if(_0x29f723['query'][_0x7be2('0x47')]){_0x16cf40[_0x7be2('0x45')]=_[_0x7be2('0x48')](_0x16cf40[_0x7be2('0x45')],{'$or':_['map'](_0x30e67f,function(_0x404e77){if(_0x404e77[_0x7be2('0x38')]!==_0x7be2('0x49')){var _0x4a27a6={};_0x4a27a6[_0x404e77[_0x7be2('0x32')]]={'$like':'%'+_0x29f723['query'][_0x7be2('0x47')]+'%'};return _0x4a27a6;}})});}_0x16cf40=_[_0x7be2('0x48')]({},_0x16cf40,_0x29f723[_0x7be2('0x4a')]);var _0x1a1f8c={'where':_0x16cf40[_0x7be2('0x45')]};return db[_0x7be2('0x36')]['count'](_0x1a1f8c)[_0x7be2('0x1a')](function(_0x57f267){_0x50f9c3[_0x7be2('0x29')]=_0x57f267;if(_0x29f723[_0x7be2('0x3b')][_0x7be2('0x4b')]){_0x16cf40['include']=[{'all':!![]}];}return db[_0x7be2('0x36')][_0x7be2('0x4c')](_0x16cf40);})[_0x7be2('0x1a')](function(_0x47ce95){_0x50f9c3[_0x7be2('0x4d')]=_0x47ce95;return _0x50f9c3;})[_0x7be2('0x1a')](respondWithFilteredResult(_0x541437,_0x16cf40))['catch'](handleError(_0x541437,null));};exports[_0x7be2('0x4e')]=function(_0x47f6f5,_0x532dcb){var _0x44b905={'raw':![],'where':{'id':_0x47f6f5[_0x7be2('0x4f')]['id']}},_0x3166ca={};_0x3166ca[_0x7be2('0x3a')]=_[_0x7be2('0x3c')](db[_0x7be2('0x36')]['rawAttributes']);_0x3166ca['query']=_[_0x7be2('0x3c')](_0x47f6f5[_0x7be2('0x3b')]);_0x3166ca[_0x7be2('0x3d')]=_[_0x7be2('0x3e')](_0x3166ca[_0x7be2('0x3a')],_0x3166ca['query']);_0x44b905[_0x7be2('0x3f')]=_[_0x7be2('0x3e')](_0x3166ca[_0x7be2('0x3a')],qs[_0x7be2('0x40')](_0x47f6f5[_0x7be2('0x3b')]['fields']));_0x44b905[_0x7be2('0x3f')]=_0x44b905[_0x7be2('0x3f')]['length']?_0x44b905['attributes']:_0x3166ca[_0x7be2('0x3a')];if(_0x47f6f5[_0x7be2('0x3b')]['includeAll']){_0x44b905[_0x7be2('0x50')]=[{'all':!![]}];}_0x44b905=_[_0x7be2('0x48')]({},_0x44b905,_0x47f6f5['options']);return db['Setting'][_0x7be2('0x51')](_0x44b905)[_0x7be2('0x1a')](handleEntityNotFound(_0x532dcb,null))[_0x7be2('0x1a')](respondWithResult(_0x532dcb,null))[_0x7be2('0x22')](handleError(_0x532dcb,null));};exports[_0x7be2('0x2f')]=function(_0x2921da,_0x16677a){if(_0x2921da['body']['id']){delete _0x2921da[_0x7be2('0x52')]['id'];}return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x2921da[_0x7be2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x16677a,null))['then'](saveUpdates(_0x2921da['body'],null))['then'](respondWithResult(_0x16677a,null))['catch'](handleError(_0x16677a,null));};exports[_0x7be2('0x53')]=function(_0x5b2edf,_0xf4d2b,_0x26a4c7){if(_0x5b2edf[_0x7be2('0x54')]&&_0x5b2edf[_0x7be2('0x54')]['filename']){_0x5b2edf[_0x7be2('0x52')][_0x7be2('0x55')]=_0x5b2edf['file'][_0x7be2('0x56')];}return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x5b2edf[_0x7be2('0x4f')]['id']}})[_0x7be2('0x1a')](handleEntityNotFound(_0xf4d2b,null))[_0x7be2('0x1a')](saveUpdates(_0x5b2edf[_0x7be2('0x52')],null))[_0x7be2('0x1a')](respondWithResult(_0xf4d2b,null))[_0x7be2('0x22')](handleError(_0xf4d2b,null));};exports[_0x7be2('0x57')]=function(_0x582f68,_0x1c4381,_0x306d42){if(_0x582f68[_0x7be2('0x54')]&&_0x582f68[_0x7be2('0x54')][_0x7be2('0x56')]){_0x582f68['body']['loginLogo']=_0x582f68[_0x7be2('0x54')][_0x7be2('0x56')];}return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x582f68['params']['id']}})[_0x7be2('0x1a')](handleEntityNotFound(_0x1c4381,null))['then'](saveUpdates(_0x582f68['body'],null))[_0x7be2('0x1a')](respondWithResult(_0x1c4381,null))[_0x7be2('0x22')](handleError(_0x1c4381,null));};var utilLicense=require(_0x7be2('0x17'));exports['getLogo']=function(_0x451ac2,_0x59e49c,_0xa03702){var _0xa46aad='server/files/images/logos';var _0x4a6163={'custom':![]};return utilLicense[_0x7be2('0x58')]()[_0x7be2('0x1a')](function(_0x12e713){if(_0x12e713){_0x4a6163=_0x12e713;}return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x451ac2['params']['id']},'attributes':[_0x7be2('0x55'),'loginLogo',_0x7be2('0x59'),_0x7be2('0x5a'),_0x7be2('0x5b'),_0x7be2('0x5c'),'defaultPreferred',_0x7be2('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x59e49c,null))[_0x7be2('0x1a')](function(_0x3d4bf0){if(_0x3d4bf0){var _0xb78dc9=_0x3d4bf0[_0x7be2('0x55')]&&fs['existsSync'](path['join'](config['root'],_0xa46aad,_[_0x7be2('0x5e')](_0x3d4bf0[_0x7be2('0x55')])))?path['join'](config['root'],_0xa46aad,_[_0x7be2('0x5e')](_0x3d4bf0['logo'])):path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0xa46aad,_['toLower']('default_logo.svg'));var _0x63ca20='default'+_[_0x7be2('0x61')]('logo');if(_0x3d4bf0[_0x63ca20]||!_0x4a6163[_0x7be2('0x62')]){_0xb78dc9=path[_0x7be2('0x5f')](config['root'],_0xa46aad,_[_0x7be2('0x5e')](_0x7be2('0x63')));}if(!fs['existsSync'](_0xb78dc9)){throw new db[(_0x7be2('0x64'))]['ValidationError'](_[_0x7be2('0x61')](_0x7be2('0x55'))+'\x20not\x20found');}return _0x59e49c['download'](_0xb78dc9);}})[_0x7be2('0x22')](handleError(_0x59e49c,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x115bf5,_0x4fff00,_0xd66ce){var _0x2f15f8=_0x7be2('0x65');var _0x2b0cff={'custom':![]};return utilLicense[_0x7be2('0x58')]()[_0x7be2('0x1a')](function(_0x443ca4){if(_0x443ca4){_0x2b0cff=_0x443ca4;}return db[_0x7be2('0x36')]['find']({'where':{'id':_0x115bf5[_0x7be2('0x4f')]['id']},'attributes':[_0x7be2('0x55'),_0x7be2('0x66'),_0x7be2('0x59'),_0x7be2('0x5a'),_0x7be2('0x5b'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7be2('0x1a')](handleEntityNotFound(_0x4fff00,null))[_0x7be2('0x1a')](function(_0xc179d8){if(_0xc179d8){var _0x276751=_0xc179d8[_0x7be2('0x66')]&&fs['existsSync'](path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x2f15f8,_['toLower'](_0xc179d8['loginLogo'])))?path[_0x7be2('0x5f')](config['root'],_0x2f15f8,_[_0x7be2('0x5e')](_0xc179d8[_0x7be2('0x66')])):path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x2f15f8,_['toLower'](_0x7be2('0x67')));var _0x3a23a5='default'+_[_0x7be2('0x61')](_0x7be2('0x66'));if(_0xc179d8[_0x3a23a5]||!_0x2b0cff[_0x7be2('0x62')]){_0x276751=path['join'](config['root'],_0x2f15f8,_[_0x7be2('0x5e')](_0x7be2('0x67')));}if(!fs[_0x7be2('0x68')](_0x276751)){throw new db[(_0x7be2('0x64'))]['ValidationError'](_[_0x7be2('0x61')](_0x7be2('0x66'))+_0x7be2('0x69'));}return _0x4fff00[_0x7be2('0x6a')](_0x276751);}})['catch'](handleError(_0x4fff00,null));};exports['gdpr']=function(_0x8b329e,_0x5df980){return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x8b329e[_0x7be2('0x4f')]['id']},'attributes':[_0x7be2('0x6b')]})['then'](respondWithResult(_0x5df980,null))[_0x7be2('0x22')](handleError(_0x5df980,null));};exports['addPreferred']=function(_0x178874,_0x52cb2b,_0x37002a){if(_0x178874[_0x7be2('0x54')]&&_0x178874[_0x7be2('0x54')][_0x7be2('0x56')]){_0x178874[_0x7be2('0x52')]['preferred']=_0x178874[_0x7be2('0x54')][_0x7be2('0x56')];}return db[_0x7be2('0x36')]['find']({'where':{'id':_0x178874['params']['id']}})[_0x7be2('0x1a')](handleEntityNotFound(_0x52cb2b,null))[_0x7be2('0x1a')](saveUpdates(_0x178874[_0x7be2('0x52')],null))['then'](respondWithResult(_0x52cb2b,null))['catch'](handleError(_0x52cb2b,null));};var utilLicense=require(_0x7be2('0x17'));exports[_0x7be2('0x6c')]=function(_0x3c3f84,_0x44786a,_0x7854dd){var _0xf41cb9=_0x7be2('0x65');var _0x11e391={'custom':![]};return utilLicense[_0x7be2('0x58')]()[_0x7be2('0x1a')](function(_0x3d5141){if(_0x3d5141){_0x11e391=_0x3d5141;}return db[_0x7be2('0x36')][_0x7be2('0x51')]({'where':{'id':_0x3c3f84[_0x7be2('0x4f')]['id']},'attributes':[_0x7be2('0x55'),_0x7be2('0x66'),_0x7be2('0x59'),_0x7be2('0x5a'),'defaultLogo','defaultLoginLogo',_0x7be2('0x6d'),_0x7be2('0x5d')],'raw':!![]});})[_0x7be2('0x1a')](handleEntityNotFound(_0x44786a,null))[_0x7be2('0x1a')](function(_0xb4ef22){if(_0xb4ef22){var _0x22ead5=_0xb4ef22[_0x7be2('0x59')]&&fs[_0x7be2('0x68')](path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0xf41cb9,_['toLower'](_0xb4ef22[_0x7be2('0x59')])))?path['join'](config[_0x7be2('0x60')],_0xf41cb9,_['toLower'](_0xb4ef22['preferred'])):path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0xf41cb9,_['toLower'](_0x7be2('0x6e')));var _0x24cc97=_0x7be2('0x6f')+_[_0x7be2('0x61')](_0x7be2('0x59'));if(_0xb4ef22[_0x24cc97]||!_0x11e391[_0x7be2('0x62')]||!_0x11e391['preferred']){_0x22ead5=path[_0x7be2('0x5f')](config['root'],_0xf41cb9,_[_0x7be2('0x5e')](_0x7be2('0x6e')));}if(!fs[_0x7be2('0x68')](_0x22ead5)){throw new db['Sequelize']['ValidationError'](_[_0x7be2('0x61')](_0x7be2('0x59'))+_0x7be2('0x69'));}return _0x44786a[_0x7be2('0x6a')](_0x22ead5);}})['catch'](handleError(_0x44786a,null));};exports[_0x7be2('0x70')]=function(_0x18a8a5,_0x224b8a,_0x45ea83){if(_0x18a8a5[_0x7be2('0x54')]&&_0x18a8a5[_0x7be2('0x54')][_0x7be2('0x56')]){_0x18a8a5['body'][_0x7be2('0x5a')]=_0x18a8a5[_0x7be2('0x54')][_0x7be2('0x56')];}return db['Setting'][_0x7be2('0x51')]({'where':{'id':_0x18a8a5[_0x7be2('0x4f')]['id']}})[_0x7be2('0x1a')](handleEntityNotFound(_0x224b8a,null))['then'](saveUpdates(_0x18a8a5[_0x7be2('0x52')],null))[_0x7be2('0x1a')](respondWithResult(_0x224b8a,null))[_0x7be2('0x22')](handleError(_0x224b8a,null));};var utilLicense=require(_0x7be2('0x17'));exports[_0x7be2('0x71')]=function(_0x393607,_0x35191b,_0x34f83c){var _0x450ad7=_0x7be2('0x65');var _0x4a6b98={'custom':![]};return utilLicense[_0x7be2('0x58')]()['then'](function(_0x80f88d){if(_0x80f88d){_0x4a6b98=_0x80f88d;}return db['Setting'][_0x7be2('0x51')]({'where':{'id':_0x393607['params']['id']},'attributes':[_0x7be2('0x55'),_0x7be2('0x66'),'preferred',_0x7be2('0x5a'),_0x7be2('0x5b'),_0x7be2('0x5c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x7be2('0x1a')](handleEntityNotFound(_0x35191b,null))[_0x7be2('0x1a')](function(_0x4c7f5b){if(_0x4c7f5b){var _0x1385ed=_0x4c7f5b[_0x7be2('0x5a')]&&fs[_0x7be2('0x68')](path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x450ad7,_[_0x7be2('0x5e')](_0x4c7f5b[_0x7be2('0x5a')])))?path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x450ad7,_[_0x7be2('0x5e')](_0x4c7f5b[_0x7be2('0x5a')])):path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x450ad7,_['toLower'](_0x7be2('0x72')));var _0x42ccba='default'+_[_0x7be2('0x61')](_0x7be2('0x5a'));if(_0x4c7f5b[_0x42ccba]||!_0x4a6b98[_0x7be2('0x62')]){_0x1385ed=path[_0x7be2('0x5f')](config[_0x7be2('0x60')],_0x450ad7,_[_0x7be2('0x5e')]('default_favicon.ico'));}if(!fs[_0x7be2('0x68')](_0x1385ed)){throw new db[(_0x7be2('0x64'))]['ValidationError'](_[_0x7be2('0x61')](_0x7be2('0x5a'))+'\x20not\x20found');}return _0x35191b[_0x7be2('0x6a')](_0x1385ed);}})[_0x7be2('0x22')](handleError(_0x35191b,null));};exports[_0x7be2('0x73')]=function(_0x55c362,_0x319597){var _0x5387f6={'offset':moment()[_0x7be2('0x74')]()};_0x5387f6[_0x7be2('0x75')]=moment()[_0x7be2('0x74')](_0x5387f6['offset'])[_0x7be2('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x319597[_0x7be2('0x24')](0xc8)['send'](_0x5387f6);}; \ No newline at end of file +var _0x4062=['attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','body','find','addLogo','file','filename','logo','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo','defaultFavicon','join','root','toLower','default','custom','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','favicon','defaultPreferred','default_loginLogo.svg','download','gdpr','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','query','intersection'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4062,0x1ae));var _0x2406=function(_0x26be76,_0x1000da){_0x26be76=_0x26be76-0x0;var _0x4433c7=_0x4062[_0x26be76];return _0x4433c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2406('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2406('0x1'));var rp=require('request-promise');var moment=require(_0x2406('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2406('0x3'));var util=require('util');var path=require(_0x2406('0x4'));var sox=require(_0x2406('0x5'));var csv=require(_0x2406('0x6'));var ejs=require(_0x2406('0x7'));var fs=require('fs');var fs_extra=require(_0x2406('0x8'));var _=require(_0x2406('0x9'));var squel=require(_0x2406('0xa'));var crypto=require(_0x2406('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2406('0x6'));var querystring=require(_0x2406('0xc'));var Papa=require('papaparse');var Redis=require(_0x2406('0xd'));var authService=require(_0x2406('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2406('0xf'))(_0x2406('0x10'));var utils=require(_0x2406('0x11'));var config=require(_0x2406('0x12'));var licenseUtil=require(_0x2406('0x13'));var db=require(_0x2406('0x14'))['db'];var jayson=require(_0x2406('0x15'));var client=jayson[_0x2406('0x16')][_0x2406('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2fe81c,_0x2b4aec,_0x54d218,_0x1b1f11){return new BPromise(function(_0xed0d53,_0x260ef7){var _0x552f4b=_0x1b1f11||client;return _0x552f4b[_0x2406('0x18')](_0x2fe81c,_0x54d218)[_0x2406('0x19')](function(_0x7d3691){logger[_0x2406('0x1a')](_0x2406('0x1b'),_0x2b4aec,'request\x20sent');logger['debug'](_0x2406('0x1c'),_0x2b4aec,_0x2406('0x1d'),JSON['stringify'](_0x7d3691));if(_0x7d3691['error']){if(_0x7d3691[_0x2406('0x1e')]['code']===0x1f4){logger['error'](_0x2406('0x1b'),_0x2b4aec,_0x7d3691[_0x2406('0x1e')]['message']);return _0x260ef7(_0x7d3691[_0x2406('0x1e')][_0x2406('0x1f')]);}logger['error'](_0x2406('0x1b'),_0x2b4aec,_0x7d3691['error'][_0x2406('0x1f')]);return _0xed0d53(_0x7d3691['error'][_0x2406('0x1f')]);}else{logger[_0x2406('0x1a')](_0x2406('0x1b'),_0x2b4aec,_0x2406('0x1d'));_0xed0d53(_0x7d3691[_0x2406('0x20')]['message']);}})['catch'](function(_0x168076){logger[_0x2406('0x1e')](_0x2406('0x1b'),_0x2b4aec,_0x168076);_0x260ef7(_0x168076);});});}function respondWithStatusCode(_0x7d1454,_0x4152a8){_0x4152a8=_0x4152a8||0xcc;return function(_0xaed734){if(_0xaed734){return _0x7d1454['sendStatus'](_0x4152a8);}return _0x7d1454[_0x2406('0x21')](_0x4152a8)[_0x2406('0x22')]();};}function respondWithResult(_0x37f3ef,_0x2c88b0){_0x2c88b0=_0x2c88b0||0xc8;return function(_0x35d7dd){if(_0x35d7dd){return _0x37f3ef[_0x2406('0x21')](_0x2c88b0)[_0x2406('0x23')](_0x35d7dd);}};}function respondWithFilteredResult(_0x246539,_0x38c169){return function(_0xf08a64){if(_0xf08a64){var _0x5c29d0=typeof _0x38c169[_0x2406('0x24')]===_0x2406('0x25')&&typeof _0x38c169[_0x2406('0x26')]===_0x2406('0x25');var _0x3e5d7e=_0xf08a64[_0x2406('0x27')];var _0x98424e=_0x5c29d0?0x0:_0x38c169[_0x2406('0x24')];var _0x48a4f8=_0x5c29d0?_0xf08a64['count']:_0x38c169[_0x2406('0x24')]+_0x38c169[_0x2406('0x26')];var _0x837523;if(_0x48a4f8>=_0x3e5d7e){_0x48a4f8=_0x3e5d7e;_0x837523=0xc8;}else{_0x837523=0xce;}_0x246539[_0x2406('0x21')](_0x837523);return _0x246539[_0x2406('0x28')](_0x2406('0x29'),_0x98424e+'-'+_0x48a4f8+'/'+_0x3e5d7e)[_0x2406('0x23')](_0xf08a64);}return null;};}function patchUpdates(_0x3ec2ae){return function(_0x2fa662){try{jsonpatch[_0x2406('0x2a')](_0x2fa662,_0x3ec2ae,!![]);}catch(_0x4df577){return BPromise[_0x2406('0x2b')](_0x4df577);}return _0x2fa662[_0x2406('0x2c')]();};}function saveUpdates(_0x594a3b,_0x33855c){return function(_0x30e370){if(_0x30e370){return _0x30e370[_0x2406('0x2d')](_0x594a3b)[_0x2406('0x19')](function(_0x8c45e5){return _0x8c45e5;});}return null;};}function removeEntity(_0x341fb7,_0x1433e6){return function(_0xc99e6a){if(_0xc99e6a){return _0xc99e6a['destroy']()['then'](function(){_0x341fb7[_0x2406('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfddae3,_0x386c64){return function(_0x318b95){if(!_0x318b95){_0xfddae3[_0x2406('0x2e')](0x194);}return _0x318b95;};}function handleError(_0x3f62c9,_0x16fa3f){_0x16fa3f=_0x16fa3f||0x1f4;return function(_0x51cc73){logger[_0x2406('0x1e')](_0x51cc73[_0x2406('0x2f')]);if(_0x51cc73[_0x2406('0x30')]){delete _0x51cc73[_0x2406('0x30')];}_0x3f62c9[_0x2406('0x21')](_0x16fa3f)['send'](_0x51cc73);};}exports[_0x2406('0x31')]=function(_0x118c26,_0x5a1134){var _0x511ef6={},_0x4f945d={},_0x42569b={'count':0x0,'rows':[]};var _0x5f5172=_[_0x2406('0x32')](db[_0x2406('0x33')][_0x2406('0x34')],function(_0xb56c28){return{'name':_0xb56c28[_0x2406('0x35')],'type':_0xb56c28[_0x2406('0x36')][_0x2406('0x37')]};});_0x4f945d['model']=_[_0x2406('0x32')](_0x5f5172,_0x2406('0x30'));_0x4f945d['query']=_['keys'](_0x118c26[_0x2406('0x38')]);_0x4f945d['filters']=_[_0x2406('0x39')](_0x4f945d['model'],_0x4f945d[_0x2406('0x38')]);_0x511ef6[_0x2406('0x3a')]=_[_0x2406('0x39')](_0x4f945d[_0x2406('0x3b')],qs[_0x2406('0x3c')](_0x118c26[_0x2406('0x38')][_0x2406('0x3c')]));_0x511ef6[_0x2406('0x3a')]=_0x511ef6[_0x2406('0x3a')][_0x2406('0x3d')]?_0x511ef6[_0x2406('0x3a')]:_0x4f945d[_0x2406('0x3b')];if(!_0x118c26[_0x2406('0x38')][_0x2406('0x3e')](_0x2406('0x3f'))){_0x511ef6[_0x2406('0x26')]=qs[_0x2406('0x26')](_0x118c26['query']['limit']);_0x511ef6[_0x2406('0x24')]=qs[_0x2406('0x24')](_0x118c26['query'][_0x2406('0x24')]);}_0x511ef6[_0x2406('0x40')]=qs[_0x2406('0x41')](_0x118c26[_0x2406('0x38')][_0x2406('0x41')]);_0x511ef6[_0x2406('0x42')]=qs[_0x2406('0x43')](_[_0x2406('0x44')](_0x118c26[_0x2406('0x38')],_0x4f945d[_0x2406('0x43')]),_0x5f5172);if(_0x118c26[_0x2406('0x38')][_0x2406('0x45')]){_0x511ef6[_0x2406('0x42')]=_[_0x2406('0x46')](_0x511ef6[_0x2406('0x42')],{'$or':_[_0x2406('0x32')](_0x5f5172,function(_0x4539f6){if(_0x4539f6['type']!==_0x2406('0x47')){var _0x2bbda3={};_0x2bbda3[_0x4539f6['name']]={'$like':'%'+_0x118c26['query'][_0x2406('0x45')]+'%'};return _0x2bbda3;}})});}_0x511ef6=_[_0x2406('0x46')]({},_0x511ef6,_0x118c26[_0x2406('0x48')]);var _0x5eb1a8={'where':_0x511ef6[_0x2406('0x42')]};return db[_0x2406('0x33')][_0x2406('0x27')](_0x5eb1a8)[_0x2406('0x19')](function(_0x27d695){_0x42569b['count']=_0x27d695;if(_0x118c26[_0x2406('0x38')][_0x2406('0x49')]){_0x511ef6[_0x2406('0x4a')]=[{'all':!![]}];}return db[_0x2406('0x33')][_0x2406('0x4b')](_0x511ef6);})[_0x2406('0x19')](function(_0x24e867){_0x42569b['rows']=_0x24e867;return _0x42569b;})[_0x2406('0x19')](respondWithFilteredResult(_0x5a1134,_0x511ef6))[_0x2406('0x4c')](handleError(_0x5a1134,null));};exports[_0x2406('0x4d')]=function(_0x426600,_0x11634b){var _0x1d2ac6={'raw':![],'where':{'id':_0x426600[_0x2406('0x4e')]['id']}},_0x1a3ccc={};_0x1a3ccc[_0x2406('0x3b')]=_[_0x2406('0x4f')](db[_0x2406('0x33')][_0x2406('0x34')]);_0x1a3ccc[_0x2406('0x38')]=_[_0x2406('0x4f')](_0x426600['query']);_0x1a3ccc['filters']=_[_0x2406('0x39')](_0x1a3ccc[_0x2406('0x3b')],_0x1a3ccc[_0x2406('0x38')]);_0x1d2ac6[_0x2406('0x3a')]=_['intersection'](_0x1a3ccc[_0x2406('0x3b')],qs[_0x2406('0x3c')](_0x426600[_0x2406('0x38')][_0x2406('0x3c')]));_0x1d2ac6['attributes']=_0x1d2ac6[_0x2406('0x3a')][_0x2406('0x3d')]?_0x1d2ac6[_0x2406('0x3a')]:_0x1a3ccc[_0x2406('0x3b')];if(_0x426600[_0x2406('0x38')][_0x2406('0x49')]){_0x1d2ac6[_0x2406('0x4a')]=[{'all':!![]}];}_0x1d2ac6=_[_0x2406('0x46')]({},_0x1d2ac6,_0x426600['options']);return db[_0x2406('0x33')]['find'](_0x1d2ac6)[_0x2406('0x19')](handleEntityNotFound(_0x11634b,null))[_0x2406('0x19')](respondWithResult(_0x11634b,null))[_0x2406('0x4c')](handleError(_0x11634b,null));};exports[_0x2406('0x2d')]=function(_0x14f89a,_0x34d1c7){if(_0x14f89a[_0x2406('0x50')]['id']){delete _0x14f89a['body']['id'];}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x14f89a[_0x2406('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34d1c7,null))[_0x2406('0x19')](saveUpdates(_0x14f89a[_0x2406('0x50')],null))[_0x2406('0x19')](respondWithResult(_0x34d1c7,null))['catch'](handleError(_0x34d1c7,null));};exports[_0x2406('0x52')]=function(_0x44d366,_0x59a99d,_0x10e977){if(_0x44d366['file']&&_0x44d366[_0x2406('0x53')][_0x2406('0x54')]){_0x44d366[_0x2406('0x50')][_0x2406('0x55')]=_0x44d366[_0x2406('0x53')][_0x2406('0x54')];}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x44d366[_0x2406('0x4e')]['id']}})[_0x2406('0x19')](handleEntityNotFound(_0x59a99d,null))[_0x2406('0x19')](saveUpdates(_0x44d366[_0x2406('0x50')],null))[_0x2406('0x19')](respondWithResult(_0x59a99d,null))[_0x2406('0x4c')](handleError(_0x59a99d,null));};exports['addLogoLogin']=function(_0x449ff3,_0x47c057,_0x376b5e){if(_0x449ff3['file']&&_0x449ff3[_0x2406('0x53')]['filename']){_0x449ff3['body']['loginLogo']=_0x449ff3[_0x2406('0x53')][_0x2406('0x54')];}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x449ff3['params']['id']}})[_0x2406('0x19')](handleEntityNotFound(_0x47c057,null))[_0x2406('0x19')](saveUpdates(_0x449ff3[_0x2406('0x50')],null))[_0x2406('0x19')](respondWithResult(_0x47c057,null))['catch'](handleError(_0x47c057,null));};var utilLicense=require(_0x2406('0x13'));exports[_0x2406('0x56')]=function(_0x3ba3da,_0x462ac6,_0x4ec684){var _0x93b77=_0x2406('0x57');var _0x3a12f5={'custom':![]};return utilLicense[_0x2406('0x58')]()[_0x2406('0x19')](function(_0x5b1572){if(_0x5b1572){_0x3a12f5=_0x5b1572;}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x3ba3da[_0x2406('0x4e')]['id']},'attributes':[_0x2406('0x55'),_0x2406('0x59'),_0x2406('0x5a'),'favicon',_0x2406('0x5b'),'defaultLoginLogo','defaultPreferred',_0x2406('0x5c')],'raw':!![]});})[_0x2406('0x19')](handleEntityNotFound(_0x462ac6,null))[_0x2406('0x19')](function(_0x277021){if(_0x277021){var _0x3808f5=_0x277021['logo']&&fs['existsSync'](path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x93b77,_[_0x2406('0x5f')](_0x277021[_0x2406('0x55')])))?path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x93b77,_['toLower'](_0x277021[_0x2406('0x55')])):path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x93b77,_[_0x2406('0x5f')]('default_logo.svg'));var _0x6eea45=_0x2406('0x60')+_['upperFirst']('logo');if(_0x277021[_0x6eea45]||!_0x3a12f5[_0x2406('0x61')]){_0x3808f5=path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x93b77,_['toLower']('default_logo.svg'));}if(!fs[_0x2406('0x62')](_0x3808f5)){throw new db[(_0x2406('0x63'))][(_0x2406('0x64'))](_[_0x2406('0x65')](_0x2406('0x55'))+_0x2406('0x66'));}return _0x462ac6['download'](_0x3808f5);}})[_0x2406('0x4c')](handleError(_0x462ac6,null));};var utilLicense=require('../../config/license/util');exports[_0x2406('0x67')]=function(_0x306c66,_0x3f438e,_0x40085c){var _0x254758=_0x2406('0x57');var _0x52a0bc={'custom':![]};return utilLicense['getLicense']()[_0x2406('0x19')](function(_0xc05d0d){if(_0xc05d0d){_0x52a0bc=_0xc05d0d;}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x306c66[_0x2406('0x4e')]['id']},'attributes':[_0x2406('0x55'),_0x2406('0x59'),_0x2406('0x5a'),_0x2406('0x68'),_0x2406('0x5b'),'defaultLoginLogo',_0x2406('0x69'),_0x2406('0x5c')],'raw':!![]});})[_0x2406('0x19')](handleEntityNotFound(_0x3f438e,null))[_0x2406('0x19')](function(_0x1e90ce){if(_0x1e90ce){var _0x589eed=_0x1e90ce['loginLogo']&&fs[_0x2406('0x62')](path['join'](config[_0x2406('0x5e')],_0x254758,_[_0x2406('0x5f')](_0x1e90ce['loginLogo'])))?path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x254758,_[_0x2406('0x5f')](_0x1e90ce[_0x2406('0x59')])):path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x254758,_['toLower'](_0x2406('0x6a')));var _0x501a83=_0x2406('0x60')+_[_0x2406('0x65')](_0x2406('0x59'));if(_0x1e90ce[_0x501a83]||!_0x52a0bc['custom']){_0x589eed=path['join'](config['root'],_0x254758,_['toLower'](_0x2406('0x6a')));}if(!fs[_0x2406('0x62')](_0x589eed)){throw new db[(_0x2406('0x63'))][(_0x2406('0x64'))](_[_0x2406('0x65')](_0x2406('0x59'))+_0x2406('0x66'));}return _0x3f438e[_0x2406('0x6b')](_0x589eed);}})[_0x2406('0x4c')](handleError(_0x3f438e,null));};exports[_0x2406('0x6c')]=function(_0x103352,_0x44b5e1){return db['Setting'][_0x2406('0x51')]({'where':{'id':_0x103352[_0x2406('0x4e')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x44b5e1,null))[_0x2406('0x4c')](handleError(_0x44b5e1,null));};exports[_0x2406('0x6d')]=function(_0x2f69f9,_0x1ef236,_0x1e8458){if(_0x2f69f9[_0x2406('0x53')]&&_0x2f69f9['file'][_0x2406('0x54')]){_0x2f69f9['body'][_0x2406('0x5a')]=_0x2f69f9[_0x2406('0x53')][_0x2406('0x54')];}return db[_0x2406('0x33')]['find']({'where':{'id':_0x2f69f9[_0x2406('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ef236,null))[_0x2406('0x19')](saveUpdates(_0x2f69f9[_0x2406('0x50')],null))[_0x2406('0x19')](respondWithResult(_0x1ef236,null))[_0x2406('0x4c')](handleError(_0x1ef236,null));};var utilLicense=require(_0x2406('0x13'));exports[_0x2406('0x6e')]=function(_0x220ab9,_0x12e583,_0x44667e){var _0x3c701d=_0x2406('0x57');var _0x527cab={'custom':![]};return utilLicense['getLicense']()[_0x2406('0x19')](function(_0x2dd80a){if(_0x2dd80a){_0x527cab=_0x2dd80a;}return db[_0x2406('0x33')]['find']({'where':{'id':_0x220ab9[_0x2406('0x4e')]['id']},'attributes':[_0x2406('0x55'),_0x2406('0x59'),_0x2406('0x5a'),_0x2406('0x68'),_0x2406('0x5b'),_0x2406('0x6f'),'defaultPreferred',_0x2406('0x5c')],'raw':!![]});})[_0x2406('0x19')](handleEntityNotFound(_0x12e583,null))['then'](function(_0x41eeb6){if(_0x41eeb6){var _0x1c2908=_0x41eeb6[_0x2406('0x5a')]&&fs[_0x2406('0x62')](path[_0x2406('0x5d')](config['root'],_0x3c701d,_[_0x2406('0x5f')](_0x41eeb6[_0x2406('0x5a')])))?path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x3c701d,_[_0x2406('0x5f')](_0x41eeb6[_0x2406('0x5a')])):path['join'](config[_0x2406('0x5e')],_0x3c701d,_[_0x2406('0x5f')](_0x2406('0x70')));var _0x56de9a=_0x2406('0x60')+_[_0x2406('0x65')](_0x2406('0x5a'));if(_0x41eeb6[_0x56de9a]||!_0x527cab[_0x2406('0x61')]||!_0x527cab[_0x2406('0x5a')]){_0x1c2908=path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x3c701d,_['toLower'](_0x2406('0x70')));}if(!fs[_0x2406('0x62')](_0x1c2908)){throw new db[(_0x2406('0x63'))][(_0x2406('0x64'))](_[_0x2406('0x65')](_0x2406('0x5a'))+'\x20not\x20found');}return _0x12e583[_0x2406('0x6b')](_0x1c2908);}})[_0x2406('0x4c')](handleError(_0x12e583,null));};exports[_0x2406('0x71')]=function(_0x4d9cd6,_0x540b0a,_0x148f4b){if(_0x4d9cd6['file']&&_0x4d9cd6[_0x2406('0x53')][_0x2406('0x54')]){_0x4d9cd6[_0x2406('0x50')][_0x2406('0x68')]=_0x4d9cd6[_0x2406('0x53')][_0x2406('0x54')];}return db[_0x2406('0x33')]['find']({'where':{'id':_0x4d9cd6[_0x2406('0x4e')]['id']}})[_0x2406('0x19')](handleEntityNotFound(_0x540b0a,null))[_0x2406('0x19')](saveUpdates(_0x4d9cd6[_0x2406('0x50')],null))[_0x2406('0x19')](respondWithResult(_0x540b0a,null))['catch'](handleError(_0x540b0a,null));};var utilLicense=require('../../config/license/util');exports[_0x2406('0x72')]=function(_0x150c8c,_0x2e0c10,_0x423fdc){var _0x8d2e88=_0x2406('0x57');var _0x3b7bb0={'custom':![]};return utilLicense[_0x2406('0x58')]()[_0x2406('0x19')](function(_0x1a8a09){if(_0x1a8a09){_0x3b7bb0=_0x1a8a09;}return db[_0x2406('0x33')][_0x2406('0x51')]({'where':{'id':_0x150c8c['params']['id']},'attributes':[_0x2406('0x55'),_0x2406('0x59'),_0x2406('0x5a'),'favicon',_0x2406('0x5b'),_0x2406('0x6f'),_0x2406('0x69'),'defaultFavicon'],'raw':!![]});})[_0x2406('0x19')](handleEntityNotFound(_0x2e0c10,null))[_0x2406('0x19')](function(_0x442ec3){if(_0x442ec3){var _0x2fd52e=_0x442ec3[_0x2406('0x68')]&&fs['existsSync'](path['join'](config[_0x2406('0x5e')],_0x8d2e88,_[_0x2406('0x5f')](_0x442ec3[_0x2406('0x68')])))?path['join'](config[_0x2406('0x5e')],_0x8d2e88,_[_0x2406('0x5f')](_0x442ec3[_0x2406('0x68')])):path[_0x2406('0x5d')](config[_0x2406('0x5e')],_0x8d2e88,_[_0x2406('0x5f')]('default_favicon.ico'));var _0x4b7b8b=_0x2406('0x60')+_[_0x2406('0x65')]('favicon');if(_0x442ec3[_0x4b7b8b]||!_0x3b7bb0['custom']){_0x2fd52e=path[_0x2406('0x5d')](config['root'],_0x8d2e88,_[_0x2406('0x5f')](_0x2406('0x73')));}if(!fs['existsSync'](_0x2fd52e)){throw new db[(_0x2406('0x63'))][(_0x2406('0x64'))](_[_0x2406('0x65')](_0x2406('0x68'))+_0x2406('0x66'));}return _0x2e0c10[_0x2406('0x6b')](_0x2fd52e);}})[_0x2406('0x4c')](handleError(_0x2e0c10,null));};exports[_0x2406('0x74')]=function(_0x5ad5ad,_0xf2851){var _0x5a47bc={'offset':moment()[_0x2406('0x75')]()};_0x5a47bc[_0x2406('0x76')]=moment()['utcOffset'](_0x5a47bc[_0x2406('0x24')])[_0x2406('0x77')](_0x2406('0x78'));return _0xf2851[_0x2406('0x21')](0xc8)[_0x2406('0x79')](_0x5a47bc);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f41f614..fc191e6 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x8cb724,_0x5e78d5){var _0x348d6f=function(_0x7b70ea){while(--_0x7b70ea){_0x8cb724['push'](_0x8cb724['shift']());}};_0x348d6f(++_0x5e78d5);}(_0x008c,0x188));var _0xc008=function(_0x48f683,_0xec583){_0x48f683=_0x48f683-0x0;var _0x13acce=_0x008c[_0x48f683];return _0x13acce;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x385d7a,_0x4f91ee){var _0x2e3e60=function(_0xdf8a50){while(--_0xdf8a50){_0x385d7a['push'](_0x385d7a['shift']());}};_0x2e3e60(++_0x4f91ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x3aa97b,_0x1db7b8){_0x3aa97b=_0x3aa97b-0x0;var _0x37d05e=_0xedd9[_0x3aa97b];return _0x37d05e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 93384f0..e8398cd 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 _0x0311=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model','map','lodash','util'];(function(_0x1fe4f0,_0x45ad60){var _0x55fdea=function(_0x5ded20){while(--_0x5ded20){_0x1fe4f0['push'](_0x1fe4f0['shift']());}};_0x55fdea(++_0x45ad60);}(_0x0311,0x127));var _0x1031=function(_0x3d8171,_0x586c81){_0x3d8171=_0x3d8171-0x0;var _0x18e1ad=_0x0311[_0x3d8171];return _0x18e1ad;};'use strict';var _=require(_0x1031('0x0'));var util=require(_0x1031('0x1'));var moment=require(_0x1031('0x2'));var BPromise=require(_0x1031('0x3'));var rs=require(_0x1031('0x4'));var fs=require('fs');var Redis=require(_0x1031('0x5'));var db=require(_0x1031('0x6'))['db'];var utils=require(_0x1031('0x7'));var logger=require(_0x1031('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1031('0x9'));var client=jayson[_0x1031('0xa')][_0x1031('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d628d,_0x40945e,_0x4fed32){return new BPromise(function(_0x429fda,_0xab4a08){return client[_0x1031('0xc')](_0x4d628d,_0x4fed32)[_0x1031('0xd')](function(_0x820c2e){logger[_0x1031('0xe')](_0x1031('0xf'),_0x40945e,_0x1031('0x10'));logger['debug'](_0x1031('0x11'),_0x40945e,'request\x20sent',JSON[_0x1031('0x12')](_0x820c2e));if(_0x820c2e['error']){if(_0x820c2e[_0x1031('0x13')][_0x1031('0x14')]===0x1f4){logger[_0x1031('0x13')]('Setting,\x20%s,\x20%s',_0x40945e,_0x820c2e[_0x1031('0x13')][_0x1031('0x15')]);return _0xab4a08(_0x820c2e[_0x1031('0x13')][_0x1031('0x15')]);}logger[_0x1031('0x13')]('Setting,\x20%s,\x20%s',_0x40945e,_0x820c2e[_0x1031('0x13')][_0x1031('0x15')]);return _0x429fda(_0x820c2e['error'][_0x1031('0x15')]);}else{logger[_0x1031('0xe')](_0x1031('0xf'),_0x40945e,_0x1031('0x10'));_0x429fda(_0x820c2e['result'][_0x1031('0x15')]);}})[_0x1031('0x16')](function(_0x422d13){logger['error'](_0x1031('0xf'),_0x40945e,_0x422d13);_0xab4a08(_0x422d13);});});}exports[_0x1031('0x17')]=function(_0x457ae8){var _0x2121c6=this;return new Promise(function(_0x25b9a,_0x17b3d2){return db[_0x1031('0x18')][_0x1031('0x19')]({'raw':_0x457ae8[_0x1031('0x1a')]?_0x457ae8[_0x1031('0x1a')][_0x1031('0x1b')]===undefined?!![]:![]:!![],'where':_0x457ae8['options']?_0x457ae8[_0x1031('0x1a')][_0x1031('0x1c')]||null:null,'attributes':_0x457ae8[_0x1031('0x1a')]?_0x457ae8[_0x1031('0x1a')][_0x1031('0x1d')]||null:null,'include':_0x457ae8[_0x1031('0x1a')]?_0x457ae8[_0x1031('0x1a')]['include']?_['map'](_0x457ae8[_0x1031('0x1a')][_0x1031('0x1e')],function(_0x1ac0e2){return{'model':db[_0x1ac0e2[_0x1031('0x1f')]],'as':_0x1ac0e2['as'],'attributes':_0x1ac0e2[_0x1031('0x1d')],'include':_0x1ac0e2[_0x1031('0x1e')]?_[_0x1031('0x20')](_0x1ac0e2[_0x1031('0x1e')],function(_0x125c58){return{'model':db[_0x125c58[_0x1031('0x1f')]],'as':_0x125c58['as'],'attributes':_0x125c58[_0x1031('0x1d')],'include':_0x125c58['include']?_[_0x1031('0x20')](_0x125c58[_0x1031('0x1e')],function(_0x152ff6){return{'model':db[_0x152ff6['model']],'as':_0x152ff6['as'],'attributes':_0x152ff6[_0x1031('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1031('0xd')](function(_0x12dbce){logger[_0x1031('0xe')](_0x1031('0x17'),_0x457ae8);logger['debug'](_0x1031('0x17'),_0x457ae8,JSON[_0x1031('0x12')](_0x12dbce));_0x25b9a(_0x12dbce);})[_0x1031('0x16')](function(_0xd980fc){logger[_0x1031('0x13')](_0x1031('0x17'),_0xd980fc[_0x1031('0x15')],_0x457ae8);_0x17b3d2(_0x2121c6['error'](0x1f4,_0xd980fc[_0x1031('0x15')]));});});}; \ No newline at end of file +var _0xaa98=['Setting','options','where','attributes','include','map','model','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSetting'];(function(_0x1dcfb2,_0x10e94c){var _0x2a03ff=function(_0x7298be){while(--_0x7298be){_0x1dcfb2['push'](_0x1dcfb2['shift']());}};_0x2a03ff(++_0x10e94c);}(_0xaa98,0x11f));var _0x8aa9=function(_0x499044,_0x550f97){_0x499044=_0x499044-0x0;var _0x557ef1=_0xaa98[_0x499044];return _0x557ef1;};'use strict';var _=require(_0x8aa9('0x0'));var util=require(_0x8aa9('0x1'));var moment=require(_0x8aa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x8aa9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8aa9('0x4'));var logger=require(_0x8aa9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8aa9('0x6'));var client=jayson[_0x8aa9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38397a,_0x3738ae,_0x1372ac){return new BPromise(function(_0x427321,_0x402b17){return client[_0x8aa9('0x8')](_0x38397a,_0x1372ac)[_0x8aa9('0x9')](function(_0x566f5e){logger[_0x8aa9('0xa')](_0x8aa9('0xb'),_0x3738ae,'request\x20sent');logger[_0x8aa9('0xc')](_0x8aa9('0xd'),_0x3738ae,'request\x20sent',JSON[_0x8aa9('0xe')](_0x566f5e));if(_0x566f5e[_0x8aa9('0xf')]){if(_0x566f5e[_0x8aa9('0xf')][_0x8aa9('0x10')]===0x1f4){logger[_0x8aa9('0xf')](_0x8aa9('0xb'),_0x3738ae,_0x566f5e[_0x8aa9('0xf')]['message']);return _0x402b17(_0x566f5e[_0x8aa9('0xf')][_0x8aa9('0x11')]);}logger[_0x8aa9('0xf')](_0x8aa9('0xb'),_0x3738ae,_0x566f5e[_0x8aa9('0xf')]['message']);return _0x427321(_0x566f5e['error'][_0x8aa9('0x11')]);}else{logger[_0x8aa9('0xa')]('Setting,\x20%s,\x20%s',_0x3738ae,_0x8aa9('0x12'));_0x427321(_0x566f5e['result'][_0x8aa9('0x11')]);}})[_0x8aa9('0x13')](function(_0x5beddc){logger[_0x8aa9('0xf')](_0x8aa9('0xb'),_0x3738ae,_0x5beddc);_0x402b17(_0x5beddc);});});}exports[_0x8aa9('0x14')]=function(_0x2c20b8){var _0x24e94a=this;return new Promise(function(_0x32bf76,_0x19dca5){return db[_0x8aa9('0x15')]['find']({'raw':_0x2c20b8[_0x8aa9('0x16')]?_0x2c20b8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c20b8[_0x8aa9('0x16')]?_0x2c20b8[_0x8aa9('0x16')][_0x8aa9('0x17')]||null:null,'attributes':_0x2c20b8[_0x8aa9('0x16')]?_0x2c20b8[_0x8aa9('0x16')][_0x8aa9('0x18')]||null:null,'include':_0x2c20b8[_0x8aa9('0x16')]?_0x2c20b8[_0x8aa9('0x16')][_0x8aa9('0x19')]?_[_0x8aa9('0x1a')](_0x2c20b8['options']['include'],function(_0x3e96ee){return{'model':db[_0x3e96ee['model']],'as':_0x3e96ee['as'],'attributes':_0x3e96ee['attributes'],'include':_0x3e96ee['include']?_[_0x8aa9('0x1a')](_0x3e96ee[_0x8aa9('0x19')],function(_0x8f3c78){return{'model':db[_0x8f3c78[_0x8aa9('0x1b')]],'as':_0x8f3c78['as'],'attributes':_0x8f3c78[_0x8aa9('0x18')],'include':_0x8f3c78[_0x8aa9('0x19')]?_[_0x8aa9('0x1a')](_0x8f3c78['include'],function(_0x98b84b){return{'model':db[_0x98b84b['model']],'as':_0x98b84b['as'],'attributes':_0x98b84b[_0x8aa9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8aa9('0x9')](function(_0x200e2f){logger[_0x8aa9('0xa')](_0x8aa9('0x14'),_0x2c20b8);logger[_0x8aa9('0xc')](_0x8aa9('0x14'),_0x2c20b8,JSON[_0x8aa9('0xe')](_0x200e2f));_0x32bf76(_0x200e2f);})[_0x8aa9('0x13')](function(_0x5361d5){logger[_0x8aa9('0xf')]('ShowSetting',_0x5361d5[_0x8aa9('0x11')],_0x2c20b8);_0x19dca5(_0x24e94a[_0x8aa9('0xf')](0x1f4,_0x5361d5[_0x8aa9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4e1312c..eafc395 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(_0x387862,_0x3c5c4e){var _0x16d405=function(_0x113b00){while(--_0x113b00){_0x387862['push'](_0x387862['shift']());}};_0x16d405(++_0x3c5c4e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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(_0x5d3ad7,_0x150d60){var _0x1ed853=function(_0x5eac0f){while(--_0x5eac0f){_0x5d3ad7['push'](_0x5d3ad7['shift']());}};_0x1ed853(++_0x150d60);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 e1177d4..6afa646 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 _0x0f1c=['bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo'];(function(_0x48be93,_0x4dd760){var _0x5d2d9a=function(_0x1ef85d){while(--_0x1ef85d){_0x48be93['push'](_0x48be93['shift']());}};_0x5d2d9a(++_0x4dd760);}(_0x0f1c,0x1bd));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc0f1('0x0'));module[_0xc0f1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc0f1('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xc0f1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc0f1('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc0f1('0x3')],'defaultValue':function(){return rs[_0xc0f1('0x4')]();}},'phone':{'type':Sequelize[_0xc0f1('0x3')]},'type':{'type':Sequelize[_0xc0f1('0x5')](_0xc0f1('0x6'),_0xc0f1('0x7'),_0xc0f1('0x8'),_0xc0f1('0x9'),_0xc0f1('0xa'),'clickatell',_0xc0f1('0xb'),_0xc0f1('0xc'),_0xc0f1('0xd'),_0xc0f1('0xe'))},'accountSid':{'type':Sequelize[_0xc0f1('0x3')]},'authId':{'type':Sequelize[_0xc0f1('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc0f1('0x3')]},'password':{'type':Sequelize[_0xc0f1('0x3')]},'apiKey':{'type':Sequelize[_0xc0f1('0x3')]},'applicationId':{'type':Sequelize[_0xc0f1('0x3')]},'accountId':{'type':Sequelize[_0xc0f1('0x3')]},'senderString':{'type':Sequelize[_0xc0f1('0x3')]},'deliveryReport':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc0f1('0x10')],'defaultValue':function(){return _0xc0f1('0x11');}},'notificationSound':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc0f1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc0f1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc0f1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc0f1('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc0f1('0x12')],'comment':_0xc0f1('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xc0f1('0xf')],'defaultValue':![],'comment':_0xc0f1('0x14'),'set':function(_0x57bb9a){if(!_0x57bb9a)this[_0xc0f1('0x15')](_0xc0f1('0x16'),null);this[_0xc0f1('0x15')](_0xc0f1('0x17'),_0x57bb9a);}}}; \ No newline at end of file +var _0x0c07=['bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','name','STRING','generate','twilio','skebby','connectel','clicksend','clickatell'];(function(_0x487b7f,_0x23e9d6){var _0x2cc9a8=function(_0x30a7e6){while(--_0x30a7e6){_0x487b7f['push'](_0x487b7f['shift']());}};_0x2cc9a8(++_0x23e9d6);}(_0x0c07,0x15b));var _0x70c0=function(_0x59ec7a,_0x1eb345){_0x59ec7a=_0x59ec7a-0x0;var _0x8535ed=_0x0c07[_0x59ec7a];return _0x8535ed;};'use strict';var Sequelize=require(_0x70c0('0x0'));var rs=require(_0x70c0('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x70c0('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x70c0('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x70c0('0x3')],'defaultValue':function(){return rs[_0x70c0('0x4')]();}},'phone':{'type':Sequelize[_0x70c0('0x3')]},'type':{'type':Sequelize['ENUM'](_0x70c0('0x5'),_0x70c0('0x6'),_0x70c0('0x7'),_0x70c0('0x8'),'plivo',_0x70c0('0x9'),_0x70c0('0xa'),'csc',_0x70c0('0xb'),_0x70c0('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x70c0('0x3')]},'authToken':{'type':Sequelize[_0x70c0('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x70c0('0x3')]},'password':{'type':Sequelize[_0x70c0('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x70c0('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x70c0('0x3')]},'deliveryReport':{'type':Sequelize[_0x70c0('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x70c0('0x3')]},'notificationTemplate':{'type':Sequelize[_0x70c0('0xe')],'defaultValue':function(){return _0x70c0('0xf');}},'notificationSound':{'type':Sequelize[_0x70c0('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x70c0('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x70c0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x70c0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x70c0('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x70c0('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x70c0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x70c0('0x10')],'comment':_0x70c0('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x70c0('0xd')],'defaultValue':![],'comment':_0x70c0('0x12'),'set':function(_0x6272c0){if(!_0x6272c0)this['setDataValue'](_0x70c0('0x13'),null);this[_0x70c0('0x14')]('mandatoryDisposition',_0x6272c0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ca904fe..b32962f 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 _0x3a3a=['SmsApplication','account','orderBy','Applications','priority','asc','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','from','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','omit','Contacts','CmContact','SmsInteraction','spread','interaction','created','autoclose','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','applications','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SmsAccount','includeAll','findAll','rows','show','keys','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','order','include','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify'];(function(_0x38d644,_0x4f3058){var _0x23c0e8=function(_0x5e8ada){while(--_0x5e8ada){_0x38d644['push'](_0x38d644['shift']());}};_0x23c0e8(++_0x4f3058);}(_0x3a3a,0x166));var _0xa3a3=function(_0x4852f9,_0x4cc1fa){_0x4852f9=_0x4852f9-0x0;var _0x2daaf6=_0x3a3a[_0x4852f9];return _0x2daaf6;};'use strict';var emlformat=require(_0xa3a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3a3('0x1'));var jsonpatch=require(_0xa3a3('0x2'));var rp=require(_0xa3a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa3a3('0x4'));var util=require(_0xa3a3('0x5'));var path=require(_0xa3a3('0x6'));var sox=require(_0xa3a3('0x7'));var csv=require(_0xa3a3('0x8'));var ejs=require(_0xa3a3('0x9'));var fs=require('fs');var fs_extra=require(_0xa3a3('0xa'));var _=require(_0xa3a3('0xb'));var squel=require(_0xa3a3('0xc'));var crypto=require(_0xa3a3('0xd'));var jsforce=require(_0xa3a3('0xe'));var deskjs=require(_0xa3a3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa3a3('0x10'));var Papa=require(_0xa3a3('0x11'));var Redis=require(_0xa3a3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa3a3('0x13'));var as=require(_0xa3a3('0x14'));var hardwareService=require(_0xa3a3('0x15'));var logger=require(_0xa3a3('0x16'))(_0xa3a3('0x17'));var utils=require(_0xa3a3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa3a3('0x19'));var db=require(_0xa3a3('0x1a'))['db'];config['redis']=_[_0xa3a3('0x1b')](config['redis'],{'host':_0xa3a3('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xa3a3('0x1d'));var client=jayson[_0xa3a3('0x1e')][_0xa3a3('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x151fb0,_0x566e4a,_0x145406,_0x4bf3e2){return new BPromise(function(_0x15fa80,_0x5a5b29){var _0x1d999b=_0x4bf3e2||client;return _0x1d999b[_0xa3a3('0x20')](_0x151fb0,_0x145406)['then'](function(_0x274368){logger[_0xa3a3('0x21')](_0xa3a3('0x22'),_0x566e4a,_0xa3a3('0x23'));logger[_0xa3a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x566e4a,'request\x20sent',JSON['stringify'](_0x274368));if(_0x274368[_0xa3a3('0x25')]){if(_0x274368[_0xa3a3('0x25')][_0xa3a3('0x26')]===0x1f4){logger[_0xa3a3('0x25')](_0xa3a3('0x22'),_0x566e4a,_0x274368[_0xa3a3('0x25')][_0xa3a3('0x27')]);return _0x5a5b29(_0x274368[_0xa3a3('0x25')][_0xa3a3('0x27')]);}logger['error'](_0xa3a3('0x22'),_0x566e4a,_0x274368[_0xa3a3('0x25')][_0xa3a3('0x27')]);return _0x15fa80(_0x274368[_0xa3a3('0x25')][_0xa3a3('0x27')]);}else{logger[_0xa3a3('0x21')](_0xa3a3('0x22'),_0x566e4a,_0xa3a3('0x23'));_0x15fa80(_0x274368[_0xa3a3('0x28')]['message']);}})[_0xa3a3('0x29')](function(_0x449919){logger['error'](_0xa3a3('0x22'),_0x566e4a,_0x449919);_0x5a5b29(_0x449919);});});}function respondWithStatusCode(_0x289e31,_0x426eb1){_0x426eb1=_0x426eb1||0xcc;return function(_0x3ace9d){if(_0x3ace9d){return _0x289e31[_0xa3a3('0x2a')](_0x426eb1);}return _0x289e31[_0xa3a3('0x2b')](_0x426eb1)[_0xa3a3('0x2c')]();};}function respondWithResult(_0x53479e,_0xa08808){_0xa08808=_0xa08808||0xc8;return function(_0x13d952){if(_0x13d952){return _0x53479e[_0xa3a3('0x2b')](_0xa08808)[_0xa3a3('0x2d')](_0x13d952);}};}function respondWithFilteredResult(_0x1ab54e,_0x308cae){return function(_0xf8ff77){if(_0xf8ff77){var _0x47faca=typeof _0x308cae[_0xa3a3('0x2e')]===_0xa3a3('0x2f')&&typeof _0x308cae[_0xa3a3('0x30')]===_0xa3a3('0x2f');var _0xe36407=_0xf8ff77[_0xa3a3('0x31')];var _0x498eca=_0x47faca?0x0:_0x308cae[_0xa3a3('0x2e')];var _0x3952e3=_0x47faca?_0xf8ff77[_0xa3a3('0x31')]:_0x308cae['offset']+_0x308cae[_0xa3a3('0x30')];var _0x3c5fb1;if(_0x3952e3>=_0xe36407){_0x3952e3=_0xe36407;_0x3c5fb1=0xc8;}else{_0x3c5fb1=0xce;}_0x1ab54e[_0xa3a3('0x2b')](_0x3c5fb1);return _0x1ab54e['set'](_0xa3a3('0x32'),_0x498eca+'-'+_0x3952e3+'/'+_0xe36407)['json'](_0xf8ff77);}return null;};}function patchUpdates(_0x1fb224){return function(_0x2d16e6){try{jsonpatch[_0xa3a3('0x33')](_0x2d16e6,_0x1fb224,!![]);}catch(_0x19bb19){return BPromise[_0xa3a3('0x34')](_0x19bb19);}return _0x2d16e6['save']();};}function saveUpdates(_0x11ea64,_0x1f6057){return function(_0x501369){if(_0x501369){return _0x501369['update'](_0x11ea64)[_0xa3a3('0x35')](function(_0x178eb4){return _0x178eb4;});}return null;};}function removeEntity(_0x3b8fc9,_0x577e8f){return function(_0x36cf93){if(_0x36cf93){return _0x36cf93[_0xa3a3('0x36')]()['then'](function(){var _0xc31339=_0x36cf93['get']({'plain':!![]});var _0x2cb998=_0xa3a3('0x37');return db[_0xa3a3('0x38')][_0xa3a3('0x36')]({'where':{'type':_0x2cb998,'resourceId':_0xc31339['id']}})[_0xa3a3('0x35')](function(){return _0x36cf93;});})[_0xa3a3('0x35')](function(){_0x3b8fc9[_0xa3a3('0x2b')](0xcc)[_0xa3a3('0x2c')]();});}};}function handleEntityNotFound(_0x8d4d36,_0x20c822){return function(_0x12e1fa){if(!_0x12e1fa){_0x8d4d36[_0xa3a3('0x2a')](0x194);}return _0x12e1fa;};}function handleError(_0x1a75ab,_0x5934f7){_0x5934f7=_0x5934f7||0x1f4;return function(_0x5e5ce6){logger['error'](_0x5e5ce6[_0xa3a3('0x39')]);if(_0x5e5ce6[_0xa3a3('0x3a')]){delete _0x5e5ce6[_0xa3a3('0x3a')];}_0x1a75ab[_0xa3a3('0x2b')](_0x5934f7)[_0xa3a3('0x3b')](_0x5e5ce6);};}exports['index']=function(_0x228c3d,_0x3a389b){var _0x8204e6={'include':[{'model':db[_0xa3a3('0x3c')],'as':_0xa3a3('0x3d')}]},_0x88117d={},_0x10c128={'count':0x0,'rows':[]};var _0x21090a=_[_0xa3a3('0x3e')](db['SmsAccount'][_0xa3a3('0x3f')],function(_0x4e01b0){return{'name':_0x4e01b0['fieldName'],'type':_0x4e01b0[_0xa3a3('0x40')][_0xa3a3('0x41')]};});_0x88117d[_0xa3a3('0x42')]=_[_0xa3a3('0x3e')](_0x21090a,'name');_0x88117d['query']=_['keys'](_0x228c3d[_0xa3a3('0x43')]);_0x88117d[_0xa3a3('0x44')]=_[_0xa3a3('0x45')](_0x88117d['model'],_0x88117d[_0xa3a3('0x43')]);_0x8204e6[_0xa3a3('0x46')]=_[_0xa3a3('0x45')](_0x88117d[_0xa3a3('0x42')],qs['fields'](_0x228c3d[_0xa3a3('0x43')]['fields']));_0x8204e6[_0xa3a3('0x46')]=_0x8204e6[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0x8204e6['attributes']:_0x88117d[_0xa3a3('0x42')];if(!_0x228c3d['query'][_0xa3a3('0x48')](_0xa3a3('0x49'))){_0x8204e6[_0xa3a3('0x30')]=qs[_0xa3a3('0x30')](_0x228c3d[_0xa3a3('0x43')][_0xa3a3('0x30')]);_0x8204e6[_0xa3a3('0x2e')]=qs[_0xa3a3('0x2e')](_0x228c3d['query'][_0xa3a3('0x2e')]);}_0x8204e6['order']=qs[_0xa3a3('0x4a')](_0x228c3d['query'][_0xa3a3('0x4a')]);_0x8204e6[_0xa3a3('0x4b')]=qs[_0xa3a3('0x44')](_['pick'](_0x228c3d['query'],_0x88117d[_0xa3a3('0x44')]),_0x21090a);if(_0x228c3d[_0xa3a3('0x43')][_0xa3a3('0x4c')]){_0x8204e6[_0xa3a3('0x4b')]=_[_0xa3a3('0x4d')](_0x8204e6[_0xa3a3('0x4b')],{'$or':_[_0xa3a3('0x3e')](_0x21090a,function(_0x28da40){if(_0x28da40['type']!==_0xa3a3('0x4e')){var _0xb0e4e6={};_0xb0e4e6[_0x28da40[_0xa3a3('0x3a')]]={'$like':'%'+_0x228c3d[_0xa3a3('0x43')][_0xa3a3('0x4c')]+'%'};return _0xb0e4e6;}})});}_0x8204e6=_[_0xa3a3('0x4d')]({},_0x8204e6,_0x228c3d[_0xa3a3('0x4f')]);var _0x11c72b={'where':_0x8204e6[_0xa3a3('0x4b')]};return db[_0xa3a3('0x50')][_0xa3a3('0x31')](_0x11c72b)[_0xa3a3('0x35')](function(_0x5a3152){_0x10c128[_0xa3a3('0x31')]=_0x5a3152;if(_0x228c3d['query'][_0xa3a3('0x51')]){_0x8204e6['include']=[{'all':!![]}];}return db[_0xa3a3('0x50')][_0xa3a3('0x52')](_0x8204e6);})[_0xa3a3('0x35')](function(_0x1fda30){_0x10c128[_0xa3a3('0x53')]=_0x1fda30;return _0x10c128;})['then'](respondWithFilteredResult(_0x3a389b,_0x8204e6))[_0xa3a3('0x29')](handleError(_0x3a389b,null));};exports[_0xa3a3('0x54')]=function(_0x379567,_0x2a8404){var _0x54bb0b={'raw':![],'where':{'id':_0x379567['params']['id']},'include':[{'model':db[_0xa3a3('0x3c')],'as':'mandatoryDispositionPause'}]},_0x258d1c={};_0x258d1c[_0xa3a3('0x42')]=_[_0xa3a3('0x55')](db[_0xa3a3('0x50')][_0xa3a3('0x3f')]);_0x258d1c[_0xa3a3('0x43')]=_[_0xa3a3('0x55')](_0x379567[_0xa3a3('0x43')]);_0x258d1c['filters']=_['intersection'](_0x258d1c[_0xa3a3('0x42')],_0x258d1c['query']);_0x54bb0b[_0xa3a3('0x46')]=_[_0xa3a3('0x45')](_0x258d1c[_0xa3a3('0x42')],qs[_0xa3a3('0x56')](_0x379567[_0xa3a3('0x43')][_0xa3a3('0x56')]));_0x54bb0b[_0xa3a3('0x46')]=_0x54bb0b[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0x54bb0b['attributes']:_0x258d1c[_0xa3a3('0x42')];if(_0x379567[_0xa3a3('0x43')][_0xa3a3('0x51')]){_0x54bb0b['include']=[{'all':!![]}];}_0x54bb0b=_['merge']({},_0x54bb0b,_0x379567['options']);return db[_0xa3a3('0x50')][_0xa3a3('0x57')](_0x54bb0b)[_0xa3a3('0x35')](handleEntityNotFound(_0x2a8404,null))[_0xa3a3('0x35')](respondWithResult(_0x2a8404,null))[_0xa3a3('0x29')](handleError(_0x2a8404,null));};exports[_0xa3a3('0x58')]=function(_0x28b239,_0x30ffc5){return db[_0xa3a3('0x50')][_0xa3a3('0x58')](_0x28b239['body'],{})[_0xa3a3('0x35')](function(_0x4fe016){var _0x15f1d0=_0x28b239[_0xa3a3('0x59')][_0xa3a3('0x5a')]({'plain':!![]});if(!_0x15f1d0)throw new Error(_0xa3a3('0x5b'));if(_0x15f1d0['role']===_0xa3a3('0x59')){var _0x5db6c7=_0x4fe016[_0xa3a3('0x5a')]({'plain':!![]});var _0x15677e=_0xa3a3('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x15677e,'userProfileId':_0x15f1d0[_0xa3a3('0x5c')]},'raw':!![]})[_0xa3a3('0x35')](function(_0x2d190c){if(_0x2d190c&&_0x2d190c[_0xa3a3('0x5d')]===0x0){return db[_0xa3a3('0x38')][_0xa3a3('0x58')]({'name':_0x5db6c7[_0xa3a3('0x3a')],'resourceId':_0x5db6c7['id'],'type':_0x2d190c['name'],'sectionId':_0x2d190c['id']},{})[_0xa3a3('0x35')](function(){return _0x4fe016;});}else{return _0x4fe016;}})[_0xa3a3('0x29')](function(_0x5a290f){logger[_0xa3a3('0x25')](_0xa3a3('0x5e'),_0x5a290f);throw _0x5a290f;});}return _0x4fe016;})[_0xa3a3('0x35')](respondWithResult(_0x30ffc5,0xc9))['catch'](handleError(_0x30ffc5,null));};exports[_0xa3a3('0x5f')]=function(_0x289317,_0x4c577f){if(_0x289317['body']['id']){delete _0x289317['body']['id'];}return db[_0xa3a3('0x50')]['find']({'where':{'id':_0x289317[_0xa3a3('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xa3a3('0x3d')}]})['then'](handleEntityNotFound(_0x4c577f,null))['then'](saveUpdates(_0x289317[_0xa3a3('0x61')],null))['then'](respondWithResult(_0x4c577f,null))[_0xa3a3('0x29')](handleError(_0x4c577f,null));};exports[_0xa3a3('0x36')]=function(_0x14908e,_0x3f5407){return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x14908e[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x3f5407,null))[_0xa3a3('0x35')](removeEntity(_0x3f5407,null))[_0xa3a3('0x29')](handleError(_0x3f5407,null));};exports[_0xa3a3('0x62')]=function(_0xe177c,_0x1ad3bb){return db[_0xa3a3('0x50')][_0xa3a3('0x62')]()[_0xa3a3('0x35')](respondWithResult(_0x1ad3bb,null))[_0xa3a3('0x29')](handleError(_0x1ad3bb,null));};exports[_0xa3a3('0x63')]=function(_0x2aa895,_0x6b3928,_0x4b87bf){if(_0x2aa895[_0xa3a3('0x61')]['id']){delete _0x2aa895[_0xa3a3('0x61')]['id'];}return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x2aa895[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x6b3928,null))['then'](function(_0x5a9c29){if(_0x5a9c29){_0x2aa895[_0xa3a3('0x61')][_0xa3a3('0x64')]=_0x5a9c29['id'];return db['Disposition'][_0xa3a3('0x58')](_0x2aa895['body']);}})[_0xa3a3('0x35')](respondWithResult(_0x6b3928,null))['catch'](handleError(_0x6b3928,null));};exports[_0xa3a3('0x65')]=function(_0x2cc534,_0x3e7e0d,_0x4c7b30){var _0x1b7e02={'raw':![],'where':{}};var _0x1eb853={};var _0x27cc44={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa3a3('0x66')]({'where':{'id':_0x2cc534[_0xa3a3('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e7e0d,null))[_0xa3a3('0x35')](function(_0x4ec164){if(_0x4ec164){_0x1eb853[_0xa3a3('0x42')]=_['keys'](db['Disposition'][_0xa3a3('0x3f')]);_0x1eb853['query']=_[_0xa3a3('0x55')](_0x2cc534['query']);_0x1eb853['filters']=_[_0xa3a3('0x45')](_0x1eb853['model'],_0x1eb853['query']);_0x1b7e02[_0xa3a3('0x46')]=_[_0xa3a3('0x45')](_0x1eb853[_0xa3a3('0x42')],qs['fields'](_0x2cc534[_0xa3a3('0x43')][_0xa3a3('0x56')]));_0x1b7e02[_0xa3a3('0x46')]=_0x1b7e02[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0x1b7e02[_0xa3a3('0x46')]:_0x1eb853[_0xa3a3('0x42')];if(!_0x2cc534['query'][_0xa3a3('0x48')](_0xa3a3('0x49'))){_0x1b7e02[_0xa3a3('0x30')]=qs[_0xa3a3('0x30')](_0x2cc534[_0xa3a3('0x43')]['limit']);_0x1b7e02[_0xa3a3('0x2e')]=qs['offset'](_0x2cc534[_0xa3a3('0x43')]['offset']);}_0x1b7e02[_0xa3a3('0x67')]=qs[_0xa3a3('0x4a')](_0x2cc534[_0xa3a3('0x43')]['sort']);_0x1b7e02['where']=qs[_0xa3a3('0x44')](_['pick'](_0x2cc534['query'],_0x1eb853[_0xa3a3('0x44')]));_0x1b7e02[_0xa3a3('0x4b')][_0xa3a3('0x64')]=_0x4ec164['id'];if(_0x2cc534['query'][_0xa3a3('0x4c')]){_0x1b7e02[_0xa3a3('0x4b')]=_[_0xa3a3('0x4d')](_0x1b7e02[_0xa3a3('0x4b')],{'$or':_[_0xa3a3('0x3e')](_0x1b7e02[_0xa3a3('0x46')],function(_0x21419b){var _0x3f5cb7={};_0x3f5cb7[_0x21419b]={'$like':'%'+_0x2cc534[_0xa3a3('0x43')][_0xa3a3('0x4c')]+'%'};return _0x3f5cb7;})});}_0x1b7e02=_[_0xa3a3('0x4d')]({},_0x1b7e02,_0x2cc534[_0xa3a3('0x4f')]);return db['Disposition'][_0xa3a3('0x31')]({'where':_0x1b7e02[_0xa3a3('0x4b')]})[_0xa3a3('0x35')](function(_0x1f3bf7){_0x27cc44[_0xa3a3('0x31')]=_0x1f3bf7;if(_0x2cc534[_0xa3a3('0x43')]['includeAll']){_0x1b7e02[_0xa3a3('0x68')]=[{'all':!![]}];}return db[_0xa3a3('0x69')][_0xa3a3('0x52')](_0x1b7e02);})[_0xa3a3('0x35')](function(_0x48bbeb){_0x27cc44[_0xa3a3('0x53')]=_0x48bbeb;return _0x27cc44;});}})[_0xa3a3('0x35')](respondWithFilteredResult(_0x3e7e0d,_0x1b7e02))[_0xa3a3('0x29')](handleError(_0x3e7e0d,null));};exports[_0xa3a3('0x6a')]=function(_0x231e41,_0x3b7fd2,_0x32faa6){return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x231e41[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x3b7fd2,null))[_0xa3a3('0x35')](function(_0x4ad2c9){if(_0x4ad2c9){return _0x4ad2c9['removeDispositions'](_0x231e41['query'][_0xa3a3('0x6b')]);}})['then'](respondWithStatusCode(_0x3b7fd2,null))[_0xa3a3('0x29')](handleError(_0x3b7fd2,null));};exports[_0xa3a3('0x6c')]=function(_0x3e5e6e,_0x5c9f73,_0x536873){if(_0x3e5e6e[_0xa3a3('0x61')]['id']){delete _0x3e5e6e[_0xa3a3('0x61')]['id'];}return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x3e5e6e[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x5c9f73,null))['then'](function(_0x4c614d){if(_0x4c614d){_0x3e5e6e[_0xa3a3('0x61')][_0xa3a3('0x64')]=_0x4c614d['id'];return db[_0xa3a3('0x6d')]['create'](_0x3e5e6e[_0xa3a3('0x61')]);}})[_0xa3a3('0x35')](respondWithResult(_0x5c9f73,null))[_0xa3a3('0x29')](handleError(_0x5c9f73,null));};exports[_0xa3a3('0x6e')]=function(_0x958e63,_0xeb9485,_0x1d24e8){var _0xb9a085={'raw':![],'where':{}};var _0x2c58ea={};var _0xe76545={'count':0x0,'rows':[]};return db[_0xa3a3('0x50')][_0xa3a3('0x66')]({'where':{'id':_0x958e63['params']['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0xeb9485,null))[_0xa3a3('0x35')](function(_0x1d502c){if(_0x1d502c){_0x2c58ea['model']=_[_0xa3a3('0x55')](db[_0xa3a3('0x6d')]['rawAttributes']);_0x2c58ea['query']=_[_0xa3a3('0x55')](_0x958e63[_0xa3a3('0x43')]);_0x2c58ea[_0xa3a3('0x44')]=_[_0xa3a3('0x45')](_0x2c58ea[_0xa3a3('0x42')],_0x2c58ea['query']);_0xb9a085[_0xa3a3('0x46')]=_[_0xa3a3('0x45')](_0x2c58ea['model'],qs[_0xa3a3('0x56')](_0x958e63[_0xa3a3('0x43')][_0xa3a3('0x56')]));_0xb9a085['attributes']=_0xb9a085[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0xb9a085[_0xa3a3('0x46')]:_0x2c58ea['model'];if(!_0x958e63['query']['hasOwnProperty'](_0xa3a3('0x49'))){_0xb9a085['limit']=qs[_0xa3a3('0x30')](_0x958e63[_0xa3a3('0x43')][_0xa3a3('0x30')]);_0xb9a085[_0xa3a3('0x2e')]=qs[_0xa3a3('0x2e')](_0x958e63[_0xa3a3('0x43')][_0xa3a3('0x2e')]);}_0xb9a085[_0xa3a3('0x67')]=qs[_0xa3a3('0x4a')](_0x958e63['query'][_0xa3a3('0x4a')]);_0xb9a085['where']=qs['filters'](_[_0xa3a3('0x6f')](_0x958e63[_0xa3a3('0x43')],_0x2c58ea[_0xa3a3('0x44')]));_0xb9a085[_0xa3a3('0x4b')][_0xa3a3('0x64')]=_0x1d502c['id'];if(_0x958e63['query']['filter']){_0xb9a085[_0xa3a3('0x4b')]=_['merge'](_0xb9a085[_0xa3a3('0x4b')],{'$or':_[_0xa3a3('0x3e')](_0xb9a085[_0xa3a3('0x46')],function(_0x475264){var _0xa33389={};_0xa33389[_0x475264]={'$like':'%'+_0x958e63[_0xa3a3('0x43')][_0xa3a3('0x4c')]+'%'};return _0xa33389;})});}_0xb9a085=_[_0xa3a3('0x4d')]({},_0xb9a085,_0x958e63[_0xa3a3('0x4f')]);return db[_0xa3a3('0x6d')][_0xa3a3('0x31')]({'where':_0xb9a085['where']})[_0xa3a3('0x35')](function(_0x23f49c){_0xe76545['count']=_0x23f49c;if(_0x958e63['query'][_0xa3a3('0x51')]){_0xb9a085['include']=[{'all':!![]}];}return db[_0xa3a3('0x6d')][_0xa3a3('0x52')](_0xb9a085);})['then'](function(_0xd5e180){_0xe76545[_0xa3a3('0x53')]=_0xd5e180;return _0xe76545;});}})[_0xa3a3('0x35')](respondWithFilteredResult(_0xeb9485,_0xb9a085))[_0xa3a3('0x29')](handleError(_0xeb9485,null));};exports[_0xa3a3('0x70')]=function(_0x293d09,_0x4b21ea,_0x32b329){return db['SmsAccount']['find']({'where':{'id':_0x293d09[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x4b21ea,null))['then'](function(_0x476578){if(_0x476578){return _0x476578[_0xa3a3('0x70')](_0x293d09[_0xa3a3('0x43')]['ids']);}})[_0xa3a3('0x35')](respondWithStatusCode(_0x4b21ea,null))[_0xa3a3('0x29')](handleError(_0x4b21ea,null));};exports[_0xa3a3('0x71')]=function(_0x170528,_0x496515,_0x2c7e44){var _0x22f73f={'channel':'sms'};var _0x3080a5=[];var _0x186d45=[];var _0x42acbd={};return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x170528[_0xa3a3('0x60')]['id']},'include':[{'model':db[_0xa3a3('0x72')],'as':'Applications'}]})[_0xa3a3('0x35')](handleEntityNotFound(_0x496515,null))[_0xa3a3('0x35')](function(_0x26d5b9){_0x22f73f[_0xa3a3('0x73')]=_0x26d5b9;_0x22f73f['applications']=_[_0xa3a3('0x74')](_0x26d5b9[_0xa3a3('0x75')],[_0xa3a3('0x76')],[_0xa3a3('0x77')]);if(_0x22f73f['account'][_0xa3a3('0x75')]){delete _0x22f73f['account'][_0xa3a3('0x75')];}return db['CmContact'][_0xa3a3('0x62')]();})[_0xa3a3('0x35')](function(_0x21fdd6){if(!_0x21fdd6){throw new db[(_0xa3a3('0x78'))][(_0xa3a3('0x79'))]('no\x20available\x20attributes');}_0x3080a5=_[_0xa3a3('0x7a')](_[_0xa3a3('0x55')](_0x21fdd6),['createdAt',_0xa3a3('0x7b')]);_0x186d45=_[_0xa3a3('0x7a')](_[_0xa3a3('0x55')](_0x21fdd6),[_0xa3a3('0x7c'),_0xa3a3('0x7b'),_0xa3a3('0x7d'),_0xa3a3('0x7e')]);_0x22f73f['body']={'mapKey':_0xa3a3('0x7f')};if(_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0x40')]){switch(_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0x40')]){case _0xa3a3('0x80'):_0x22f73f[_0xa3a3('0x61')]['from']=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x81')];_0x22f73f['body'][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x82')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x83')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x84')];break;case'skebby':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]='+'+_0x170528['body'][_0xa3a3('0x86')];_0x22f73f['body']['body']=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x87')];break;case _0xa3a3('0x88'):_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]=_0x170528['body']['from'];_0x22f73f['body'][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x27')];break;case _0xa3a3('0x89'):_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x85')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x61')];_0x22f73f['body'][_0xa3a3('0x83')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x8a')];break;case _0xa3a3('0x8b'):_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x81')];_0x22f73f[_0xa3a3('0x61')]['body']=_0x170528['body'][_0xa3a3('0x8c')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x83')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x8d')];break;case _0xa3a3('0x8e'):_0x22f73f['body'][_0xa3a3('0x85')]='+'+_0x170528[_0xa3a3('0x61')][_0xa3a3('0x8f')][0x0][_0xa3a3('0x85')];_0x22f73f['body'][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x8f')][0x0][_0xa3a3('0x87')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x83')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x8f')][0x0]['messageId'];break;case _0xa3a3('0x90'):_0x22f73f['body'][_0xa3a3('0x85')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x91')];_0x22f73f['body'][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')]['segmentedMessage']['message'];break;case _0xa3a3('0x92'):_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x93')];_0x22f73f['body'][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x87')];_0x22f73f[_0xa3a3('0x61')]['messageId']=_0x170528['body']['replyMessageId'];break;case _0xa3a3('0x94'):_0x22f73f['body'][_0xa3a3('0x83')]=_0x170528[_0xa3a3('0x61')][0x0][_0xa3a3('0x27')]['id'];_0x22f73f[_0xa3a3('0x61')]['from']=_0x170528['body'][0x0]['message'][_0xa3a3('0x85')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x61')]=_0x170528['body'][0x0][_0xa3a3('0x27')][_0xa3a3('0x87')];break;case'intelepeer':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')]=_0x170528['body'][_0xa3a3('0x85')];_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x61')]=_0x170528[_0xa3a3('0x61')]['message'];_0x22f73f[_0xa3a3('0x61')]['messageId']=_0x170528[_0xa3a3('0x61')][_0xa3a3('0x95')];break;}}if(_0x22f73f[_0xa3a3('0x61')]['id']){delete _0x22f73f[_0xa3a3('0x61')]['id'];}if(_['isNil'](_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')])){throw new db[(_0xa3a3('0x78'))][(_0xa3a3('0x79'))](_0xa3a3('0x96'));}if(_[_0xa3a3('0x97')](_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x61')])||_0x22f73f[_0xa3a3('0x61')]['body']===''){throw new db[(_0xa3a3('0x78'))][(_0xa3a3('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa3a3('0x97')](_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x98')])){throw new db['Sequelize'][(_0xa3a3('0x79'))](_0xa3a3('0x99')+_0x186d45);}if(!_[_0xa3a3('0x9a')](_0x186d45,_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x98')])){throw new db[(_0xa3a3('0x78'))][(_0xa3a3('0x79'))](_0xa3a3('0x9b')+_0x186d45);}_0x42acbd[_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x98')]]=_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')];return db['CmList'][_0xa3a3('0x57')]({'where':{'id':_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0x7e')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x42acbd,'limit':0x1,'order':[[_0xa3a3('0x7b'),_0xa3a3('0x9c')]]}]});})[_0xa3a3('0x35')](handleEntityNotFound(_0x496515,null))[_0xa3a3('0x35')](function(_0x45aadf){if(_0x45aadf){_0x22f73f['list']=_[_0xa3a3('0x9d')](_0x45aadf,[_0xa3a3('0x9e')]);if(_0x45aadf[_0xa3a3('0x9e')][_0xa3a3('0x47')]){return _0x45aadf[_0xa3a3('0x9e')][0x0];}var _0x22eecd=_[_0xa3a3('0x1b')](_0x22f73f[_0xa3a3('0x61')],{'firstName':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')],'ListId':_0x45aadf['id']});_0x22eecd[_0x22f73f[_0xa3a3('0x61')]['mapKey']]=_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x85')];return db[_0xa3a3('0x9f')]['create'](_0x22eecd,{'fields':_0x3080a5,'raw':!![]});}})[_0xa3a3('0x35')](handleEntityNotFound(_0x496515,null))[_0xa3a3('0x35')](function(_0x435aea){if(_0x435aea){_0x22f73f['contact']=_0x435aea;var _0x4c78c2={'ContactId':_0x435aea['id'],'phone':_0x22f73f['body'][_0xa3a3('0x85')],'SmsAccountId':_0x170528[_0xa3a3('0x60')]['id']};var _0xf44c2c={'ContactId':_0x435aea['id'],'SmsAccountId':_0x170528[_0xa3a3('0x60')]['id'],'closed':![]};return db[_0xa3a3('0xa0')][_0xa3a3('0x57')]({'where':_0xf44c2c})[_0xa3a3('0x35')](function(_0x27c02f){if(_0x27c02f){return[_0x27c02f,![]];}return db[_0xa3a3('0xa0')][_0xa3a3('0x58')](_0x4c78c2)[_0xa3a3('0x35')](function(_0x4133e2){return[_0x4133e2,!![]];});});}})[_0xa3a3('0xa1')](function(_0x18eff4,_0x51b023){_0x22f73f[_0xa3a3('0xa2')]=_0x18eff4[_0xa3a3('0x5a')]({'plain':!![]});_0x22f73f[_0xa3a3('0xa2')][_0xa3a3('0xa3')]=![];if(_0x51b023){if(_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0xa4')]){_0x22f73f['applications']['push']({'id':0x0,'priority':_0x22f73f['applications'][_0xa3a3('0x47')]+0x1,'app':_0xa3a3('0xa5'),'appdata':'unmanaged','interval':_0xa3a3('0xa6')});}_0x22f73f['interaction']['created']=!![];}return db[_0xa3a3('0xa7')]['create']({'phone':_0x22f73f[_0xa3a3('0x61')]['from'],'messageId':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x83')],'body':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0x61')],'SmsAccountId':_0x170528['params']['id'],'SmsInteractionId':_0x18eff4['id'],'direction':'in','ContactId':_0x18eff4[_0xa3a3('0xa8')],'AttachmentId':_0x22f73f[_0xa3a3('0x61')][_0xa3a3('0xa9')]});})[_0xa3a3('0x35')](function(_0x2f0d91){_0x22f73f[_0xa3a3('0x27')]=_0x2f0d91;if(!_0x22f73f[_0xa3a3('0xa2')][_0xa3a3('0xaa')])return;return db[_0xa3a3('0xab')]['find']({'attributes':['id',_0xa3a3('0x3a')],'where':{'id':_0x22f73f[_0xa3a3('0xa2')]['UserId']}});})[_0xa3a3('0x35')](function(_0x3bd651){if(_0x3bd651){_0x22f73f[_0xa3a3('0xac')][_0xa3a3('0xad')]({'id':0x0,'priority':0x0,'app':_0xa3a3('0xae'),'appdata':_0x3bd651[_0xa3a3('0x3a')]+','+(_0x22f73f['account'][_0xa3a3('0xaf')]||0xa),'interval':'*,*,*,*'});}if(!_0x22f73f[_0xa3a3('0xa2')][_0xa3a3('0xb0')])return;return db[_0xa3a3('0xb1')][_0xa3a3('0x57')]({'attributes':['id',_0xa3a3('0x3a')],'where':{'id':_0x22f73f['interaction'][_0xa3a3('0xb0')]}});})[_0xa3a3('0x35')](function(_0x36844e){if(_0x36844e){_0x22f73f['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x36844e[_0xa3a3('0x3a')]+','+(_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0xb2')]||0x12c),'interval':_0xa3a3('0xa6')});}return respondWithRpcPromise('Start',_0xa3a3('0xb3'),_0x22f73f);})[_0xa3a3('0x35')](function(_0x5b6641){if(_0x5b6641){var _0x4ef069=0xc8;var _0x36ddfd='receiveMessage';logger[_0xa3a3('0x21')](_0xa3a3('0xb4'),_0x36ddfd,_0x4ef069,_0xa3a3('0xb5'));logger[_0xa3a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x36ddfd,_0x4ef069,_0xa3a3('0xb5'),JSON[_0xa3a3('0xb6')](_0x5b6641));if(_0x22f73f[_0xa3a3('0x73')][_0xa3a3('0x40')]==='twilio'){return _0x496515['status'](_0x4ef069)[_0xa3a3('0xb7')](_0xa3a3('0xb8'),'text/xml')[_0xa3a3('0x3b')](_0xa3a3('0xb9'));}else{return _0x496515[_0xa3a3('0x2b')](_0x4ef069)[_0xa3a3('0x2d')](_0x5b6641);}}})['catch'](handleError(_0x496515,null));};exports[_0xa3a3('0xba')]=function(_0x49c462,_0x48c776){var _0x57edfc=_0x49c462[_0xa3a3('0x60')]['id'];var _0x1aba6f=_0x49c462[_0xa3a3('0x61')];var _0x4d1295=0xc8;var _0x41c13f=null;return db[_0xa3a3('0xbb')][_0xa3a3('0xbc')]({'isolationLevel':db['sequelize']['Transaction'][_0xa3a3('0xbd')][_0xa3a3('0xbe')]},function(_0x730d26){return db['SmsAccount'][_0xa3a3('0x66')]({'where':{'id':_0x57edfc},'transaction':_0x730d26})[_0xa3a3('0x35')](function(_0x72c1ca){if(_0x72c1ca){return db['SmsApplication'][_0xa3a3('0x36')]({'where':{'SmsAccountId':_0x57edfc},'transaction':_0x730d26})['then'](function(){var _0x5da2b0=_[_0xa3a3('0x3e')](_0x1aba6f,function(_0x47669b){_0x47669b[_0xa3a3('0x64')]=_0x57edfc;return _0x47669b;});return db['SmsApplication'][_0xa3a3('0xbf')](_0x5da2b0,{'transaction':_0x730d26});});}else{_0x4d1295=0x194;_0x41c13f=[];}});})[_0xa3a3('0x35')](function(){if(_0x4d1295!==0x194){return db[_0xa3a3('0x72')][_0xa3a3('0xc0')]({'where':{'SmsAccountId':_0x57edfc},'order':_0xa3a3('0x76')})[_0xa3a3('0x35')](function(_0x298a7b){_0x41c13f=_0x298a7b;});}})[_0xa3a3('0x29')](function(_0x406ffd){_0x4d1295=0x1f4;logger[_0xa3a3('0x25')](_0x406ffd['stack']);if(_0x406ffd['name']){delete _0x406ffd[_0xa3a3('0x3a')];}_0x41c13f=_0x406ffd;})[_0xa3a3('0xc1')](function(){if(_0x41c13f===null){_0x48c776[_0xa3a3('0x2a')](_0x4d1295);}else{if(_0x4d1295===0x1f4){_0x48c776[_0xa3a3('0x2b')](_0x4d1295)[_0xa3a3('0x3b')](_0x41c13f);}else{_0x48c776[_0xa3a3('0x2b')](_0x4d1295)[_0xa3a3('0x2d')](_0x41c13f);}}});};exports[_0xa3a3('0xc2')]=function(_0x24c5b7,_0x5615bb,_0x5ab75e){var _0x211946={};var _0x8e758={};var _0x264eb5;var _0xfc52f3;return db[_0xa3a3('0x50')][_0xa3a3('0x66')]({'where':{'id':_0x24c5b7[_0xa3a3('0x60')]['id']}})['then'](handleEntityNotFound(_0x5615bb,null))[_0xa3a3('0x35')](function(_0x5402ca){if(_0x5402ca){_0x264eb5=_0x5402ca;_0x8e758['model']=_[_0xa3a3('0x55')](db[_0xa3a3('0x72')]['rawAttributes']);_0x8e758[_0xa3a3('0x43')]=_[_0xa3a3('0x55')](_0x24c5b7[_0xa3a3('0x43')]);_0x8e758[_0xa3a3('0x44')]=_['intersection'](_0x8e758[_0xa3a3('0x42')],_0x8e758['query']);_0x211946[_0xa3a3('0x46')]=_[_0xa3a3('0x45')](_0x8e758[_0xa3a3('0x42')],qs[_0xa3a3('0x56')](_0x24c5b7[_0xa3a3('0x43')]['fields']));_0x211946['attributes']=_0x211946['attributes'][_0xa3a3('0x47')]?_0x211946['attributes']:_0x8e758[_0xa3a3('0x42')];_0x211946[_0xa3a3('0x67')]=qs['sort'](_0x24c5b7[_0xa3a3('0x43')]['sort']);_0x211946[_0xa3a3('0x4b')]=qs[_0xa3a3('0x44')](_[_0xa3a3('0x6f')](_0x24c5b7[_0xa3a3('0x43')],_0x8e758[_0xa3a3('0x44')]));if(_0x24c5b7[_0xa3a3('0x43')][_0xa3a3('0x4c')]){_0x211946['where']=_[_0xa3a3('0x4d')](_0x211946[_0xa3a3('0x4b')],{'$or':_[_0xa3a3('0x3e')](_0x211946[_0xa3a3('0x46')],function(_0x932a7){var _0x555532={};_0x555532[_0x932a7]={'$like':'%'+_0x24c5b7['query']['filter']+'%'};return _0x555532;})});}_0x211946=_['merge']({},_0x211946,_0x24c5b7['options']);return _0x264eb5[_0xa3a3('0xc2')](_0x211946);}})['then'](function(_0x38d012){if(_0x38d012){_0xfc52f3=_0x38d012['length'];if(!_0x24c5b7[_0xa3a3('0x43')][_0xa3a3('0x48')](_0xa3a3('0x49'))){_0x211946[_0xa3a3('0x30')]=qs[_0xa3a3('0x30')](_0x24c5b7[_0xa3a3('0x43')][_0xa3a3('0x30')]);_0x211946[_0xa3a3('0x2e')]=qs[_0xa3a3('0x2e')](_0x24c5b7[_0xa3a3('0x43')][_0xa3a3('0x2e')]);}return _0x264eb5[_0xa3a3('0xc2')](_0x211946);}})['then'](function(_0x3d072a){if(_0x3d072a){return _0x3d072a?{'count':_0xfc52f3,'rows':_0x3d072a}:null;}})['then'](respondWithResult(_0x5615bb,null))[_0xa3a3('0x29')](handleError(_0x5615bb,null));};exports[_0xa3a3('0xc3')]=function(_0x539b8a,_0x7af6ef,_0x3bcf9d){var _0x499b71={'raw':![],'where':{}};var _0x207337={};var _0xda9a88={'count':0x0,'rows':[]};return db[_0xa3a3('0x50')]['findOne']({'where':{'id':_0x539b8a['params']['id']}})['then'](handleEntityNotFound(_0x7af6ef,null))[_0xa3a3('0x35')](function(_0x1736ec){if(_0x1736ec){_0x207337[_0xa3a3('0x42')]=_[_0xa3a3('0x55')](db[_0xa3a3('0xa0')][_0xa3a3('0x3f')]);_0x207337[_0xa3a3('0x43')]=_[_0xa3a3('0x55')](_0x539b8a['query']);_0x207337['filters']=_[_0xa3a3('0x45')](_0x207337[_0xa3a3('0x42')],_0x207337[_0xa3a3('0x43')]);_0x499b71['attributes']=_[_0xa3a3('0x45')](_0x207337['model'],qs[_0xa3a3('0x56')](_0x539b8a['query'][_0xa3a3('0x56')]));_0x499b71[_0xa3a3('0x46')]=_0x499b71[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0x499b71['attributes']:_0x207337[_0xa3a3('0x42')];if(!_0x539b8a['query']['hasOwnProperty'](_0xa3a3('0x49'))){_0x499b71[_0xa3a3('0x30')]=qs['limit'](_0x539b8a['query'][_0xa3a3('0x30')]);_0x499b71['offset']=qs['offset'](_0x539b8a['query']['offset']);}_0x499b71[_0xa3a3('0x67')]=qs['sort'](_0x539b8a['query'][_0xa3a3('0x4a')]);_0x499b71[_0xa3a3('0x4b')]=qs[_0xa3a3('0x44')](_['pick'](_0x539b8a[_0xa3a3('0x43')],_0x207337[_0xa3a3('0x44')]));_0x499b71[_0xa3a3('0x4b')][_0xa3a3('0x64')]=_0x1736ec['id'];if(_0x539b8a[_0xa3a3('0x43')][_0xa3a3('0x4c')]){_0x499b71['where']=_[_0xa3a3('0x4d')](_0x499b71[_0xa3a3('0x4b')],{'$or':_[_0xa3a3('0x3e')](_0x499b71['attributes'],function(_0x1ecf06){var _0x2d79e5={};_0x2d79e5[_0x1ecf06]={'$like':'%'+_0x539b8a[_0xa3a3('0x43')][_0xa3a3('0x4c')]+'%'};return _0x2d79e5;})});}_0x499b71=_[_0xa3a3('0x4d')]({},_0x499b71,_0x539b8a[_0xa3a3('0x4f')]);return db[_0xa3a3('0xa0')][_0xa3a3('0x31')]({'where':_0x499b71['where']})[_0xa3a3('0x35')](function(_0x123bfd){_0xda9a88[_0xa3a3('0x31')]=_0x123bfd;if(_0x539b8a['query'][_0xa3a3('0x51')]){_0x499b71[_0xa3a3('0x68')]=[{'model':db[_0xa3a3('0x9f')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xa3a3('0xc4'),'attributes':[_0xa3a3('0x3a'),_0xa3a3('0xc5'),_0xa3a3('0xc6')],'required':![]},{'model':db['Tag'],'as':_0xa3a3('0xc7'),'attributes':['id',_0xa3a3('0x3a'),_0xa3a3('0xc8')],'where':_0x539b8a[_0xa3a3('0x43')][_0xa3a3('0xc9')]?{'id':_0x539b8a['query'][_0xa3a3('0xc9')]}:undefined,'required':_0x539b8a[_0xa3a3('0x43')][_0xa3a3('0xc9')]?!![]:![]}];}return db[_0xa3a3('0xa0')][_0xa3a3('0x52')](_0x499b71);})['then'](function(_0x4b5cad){_0xda9a88[_0xa3a3('0x53')]=_0x4b5cad;return _0xda9a88;});}})[_0xa3a3('0x35')](respondWithFilteredResult(_0x7af6ef,_0x499b71))['catch'](handleError(_0x7af6ef,null));};exports['send']=function(_0x3d572b,_0x1b39db,_0x97660a){var _0x2115c8,_0xe29502,_0x4fe91a;if(_['isNil'](_0x3d572b[_0xa3a3('0x61')][_0xa3a3('0x61')])||_0x3d572b['body'][_0xa3a3('0x61')]===''){throw new db[(_0xa3a3('0x78'))][(_0xa3a3('0x79'))](_0xa3a3('0xca'));}if(_[_0xa3a3('0x97')](_0x3d572b['body']['to'])){throw new db[(_0xa3a3('0x78'))]['ValidationError'](_0xa3a3('0xcb'));}_0x2115c8=_0x3d572b[_0xa3a3('0x61')]['to'];return db['SmsAccount'][_0xa3a3('0x57')]({'where':{'id':_0x3d572b[_0xa3a3('0x60')]['id']},'include':[{'model':db[_0xa3a3('0xcc')],'as':_0xa3a3('0xcd'),'include':[{'model':db[_0xa3a3('0x9f')],'as':_0xa3a3('0x9e'),'where':{'mobile':_0x2115c8},'limit':0x1,'order':[[_0xa3a3('0x7b'),_0xa3a3('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x1b39db,null))[_0xa3a3('0x35')](function(_0x2ec793){if(_0x2ec793&&_0x2ec793[_0xa3a3('0xcd')]){_0xe29502=_0x2ec793['get']({'plain':!![]});if(_0xe29502[_0xa3a3('0xcd')]&&_0xe29502[_0xa3a3('0xcd')]['Contacts']['length']){return _0xe29502[_0xa3a3('0xcd')]['Contacts'][0x0];}return db[_0xa3a3('0x9f')][_0xa3a3('0x58')](_[_0xa3a3('0x1b')](_0x3d572b[_0xa3a3('0x61')],{'firstName':_0x2115c8,'mobile':_0x2115c8,'phone':_0x2115c8,'ListId':_0xe29502[_0xa3a3('0x7e')]}));}})[_0xa3a3('0x35')](handleEntityNotFound(_0x1b39db,null))['then'](function(_0x4878ac){if(_0x4878ac){_0x4fe91a=_0x4878ac;return db['SmsInteraction'][_0xa3a3('0x57')]({'where':{'ContactId':_0x4fe91a['id'],'closed':![],'SmsAccountId':_0xe29502['id']}})[_0xa3a3('0x35')](function(_0x143068){if(_0x143068){return[_0x143068,![]];}return db[_0xa3a3('0xa0')][_0xa3a3('0x58')]({'UserId':_0x3d572b[_0xa3a3('0x59')]['id'],'ContactId':_0x4fe91a['id'],'SmsAccountId':_0xe29502['id'],'phone':_0x2115c8,'firstMsgDirection':_0xa3a3('0xce'),'Messages':[_[_0xa3a3('0x4d')](_0x3d572b[_0xa3a3('0x61')],{'read':![],'body':_0x3d572b[_0xa3a3('0x61')][_0xa3a3('0x61')],'phone':_0x2115c8,'SmsAccountId':_0xe29502['id'],'UserId':_0x3d572b['user']['id'],'ContactId':_0x4fe91a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xa3a3('0x35')](function(_0x44b209){return[_0x44b209,!![]];});});}})[_0xa3a3('0xa1')](function(_0x215406,_0x574dbe){if(_0x574dbe){return _0x215406;}return db[_0xa3a3('0xa7')][_0xa3a3('0x58')](_['merge'](_0x3d572b[_0xa3a3('0x61')],{'read':![],'body':_0x3d572b['body'][_0xa3a3('0x61')],'phone':_0x2115c8,'SmsAccountId':_0xe29502['id'],'SmsInteractionId':_0x215406['id'],'UserId':_0x3d572b[_0xa3a3('0x59')]['id'],'ContactId':_0x4fe91a['id']}))[_0xa3a3('0x35')](function(_0x3d76eb){_0x215406['dataValues'][_0xa3a3('0xcf')]=[];_0x215406[_0xa3a3('0xd0')][_0xa3a3('0xcf')][_0xa3a3('0xd1')](_0x3d76eb[_0xa3a3('0xd0')]);return _0x215406;});})['then'](respondWithResult(_0x1b39db,null))[_0xa3a3('0x29')](handleError(_0x1b39db,null));};exports['status']=function(_0x9fec65,_0x492874,_0x4b0301){if(_0x9fec65[_0xa3a3('0x61')]['id']){delete _0x9fec65[_0xa3a3('0x61')]['id'];}var _0x1de008,_0x3377be,_0x303ffd;return db['SmsAccount'][_0xa3a3('0x57')]({'where':{'id':_0x9fec65[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x492874,null))[_0xa3a3('0x35')](function(_0x40c1de){if(_0x40c1de){_0x303ffd=_0x40c1de;logger[_0xa3a3('0x24')](_0xa3a3('0xb4'),_0xa3a3('0x2b'),_0xa3a3('0xd2'),_0x40c1de[_0xa3a3('0x40')],util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));switch(_0x40c1de['type']){case _0xa3a3('0xd4'):if(_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd5')]&&_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x2b')]){_0x3377be=_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x2b')];return db[_0xa3a3('0xa7')][_0xa3a3('0x57')]({'where':{'messageId':_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd5')]}});}break;case'connectel':if(_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd6')]&&_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd7')]){_0x3377be=_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd7')];return db['SmsMessage'][_0xa3a3('0x57')]({'where':{'messageId':_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd6')]}});}break;case _0xa3a3('0x89'):if(_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x8a')]&&_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd8')]){_0x3377be=_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0xd8')];return db[_0xa3a3('0xa7')]['find']({'where':{'messageId':_0x9fec65['body'][_0xa3a3('0x8a')]}});}break;case'infobip':var _0x87e99a=_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x8f')][0x0];if(_0x87e99a['messageId']&&_0x87e99a[_0xa3a3('0x2b')][_0xa3a3('0xd9')]===_0xa3a3('0xda')){_0x3377be=_0x87e99a[_0xa3a3('0x2b')][_0xa3a3('0xd9')];return db[_0xa3a3('0xa7')][_0xa3a3('0x57')]({'where':{'messageId':_0x87e99a['messageId']}});}break;case _0xa3a3('0x92'):if(_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x83')]&&_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x2b')]){_0x3377be=_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x2b')];return db['SmsMessage'][_0xa3a3('0x57')]({'where':{'messageId':_0x9fec65[_0xa3a3('0x61')][_0xa3a3('0x83')]}});}break;case _0xa3a3('0x94'):if(_0x9fec65[_0xa3a3('0x61')][0x0][_0xa3a3('0x27')]['id']){_0x3377be=_0x9fec65[_0xa3a3('0x61')][0x0]['type'];return db[_0xa3a3('0xa7')][_0xa3a3('0x57')]({'where':{'messageId':_0x9fec65[_0xa3a3('0x61')][0x0][_0xa3a3('0x27')]['id']}});}break;case _0xa3a3('0xdb'):if(_0x9fec65['body'][_0xa3a3('0xdc')]&&_0x9fec65['body'][_0xa3a3('0x2b')]){_0x3377be=_0x9fec65['body']['status'];return db[_0xa3a3('0xa7')][_0xa3a3('0x57')]({'where':{'messageId':_0x9fec65['body'][_0xa3a3('0xdc')]}});}break;}}})[_0xa3a3('0x35')](handleEntityNotFound(_0x492874,null))[_0xa3a3('0x35')](function(_0x3893ea){if(_0x3893ea){_0x1de008=_0x3893ea;switch(_0x303ffd[_0xa3a3('0x40')]){case _0xa3a3('0xd4'):if(_0x3377be===_0xa3a3('0xda')){return _0x1de008['update']({'read':!![]});}else{logger[_0xa3a3('0x25')](_0xa3a3('0xb4'),'status','skebby',util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;case _0xa3a3('0x88'):if(_0x3377be==='1'){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')](_0xa3a3('0xb4'),_0xa3a3('0x2b'),'skebby',util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x9fec65[_0xa3a3('0x61')]['error_code']&&_0x3377be>=0xc8&&_0x3377be<=0xce){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')](_0xa3a3('0xb4'),_0xa3a3('0x2b'),_0xa3a3('0x89'),util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;case _0xa3a3('0x8e'):var _0x4df7dd=_0x9fec65['body']['results'][0x0];if(_0x4df7dd[_0xa3a3('0x2b')][_0xa3a3('0xd9')]===_0xa3a3('0xda')){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a3('0x2b'),_0xa3a3('0x8e'),util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;case _0xa3a3('0x92'):if(_0x3377be==_0xa3a3('0xdd')||_0x3377be==_0xa3a3('0xde')){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa3a3('0x2b'),_0xa3a3('0x92'),util['inspect'](_0x9fec65['body'],{'showHidden':![],'depth':null}));}break;case _0xa3a3('0x94'):if(_0x3377be==_0xa3a3('0xdf')){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')](_0xa3a3('0xb4'),_0xa3a3('0x2b'),_0xa3a3('0x94'),util['inspect'](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;case _0xa3a3('0xdb'):if(_0x3377be===_0xa3a3('0xe0')||_0x3377be===_0xa3a3('0xe1')){return _0x1de008[_0xa3a3('0x5f')]({'read':!![]});}else{logger['error'](_0xa3a3('0xb4'),_0xa3a3('0x2b'),_0xa3a3('0xdb'),util[_0xa3a3('0xd3')](_0x9fec65[_0xa3a3('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x1de008;}})[_0xa3a3('0x35')](respondWithResult(_0x492874,null))[_0xa3a3('0x29')](handleError(_0x492874,null));};exports[_0xa3a3('0xe2')]=function(_0x377f7c,_0x30163a,_0x366802){var _0x487377,_0x2ce6dc,_0x40ef49;return db[_0xa3a3('0x50')]['find']({'where':{'id':_0x377f7c['params']['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x30163a,null))[_0xa3a3('0x35')](function(_0x1a9874){if(_0x1a9874){_0x40ef49=_0x1a9874;logger[_0xa3a3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x1a9874[_0xa3a3('0x40')],util[_0xa3a3('0xd3')](_0x377f7c[_0xa3a3('0x43')],{'showHidden':![],'depth':null}));switch(_0x1a9874['type']){case'csc':if(_0x377f7c[_0xa3a3('0x43')][_0xa3a3('0xe3')]&&_0x377f7c[_0xa3a3('0x43')][_0xa3a3('0xe4')]){_0x2ce6dc=_0x377f7c[_0xa3a3('0x43')][_0xa3a3('0xe4')];return db[_0xa3a3('0xa7')][_0xa3a3('0x57')]({'where':{'messageId':_0x377f7c[_0xa3a3('0x43')][_0xa3a3('0xe3')]}});}break;}}})[_0xa3a3('0x35')](handleEntityNotFound(_0x30163a,null))['then'](function(_0x2cfc95){if(_0x2cfc95){_0x487377=_0x2cfc95;switch(_0x40ef49[_0xa3a3('0x40')]){case'csc':if(_0x2ce6dc==='2'||_0x2ce6dc==='6'){return _0x487377[_0xa3a3('0x5f')]({'read':!![]});}else{logger[_0xa3a3('0x25')](_0xa3a3('0xb4'),'status','csc',util[_0xa3a3('0xd3')](_0x377f7c[_0xa3a3('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x487377;}})[_0xa3a3('0x35')](respondWithResult(_0x30163a,null))[_0xa3a3('0x29')](handleError(_0x30163a,null));};exports[_0xa3a3('0xe5')]=function(_0x21ab61,_0x19c600,_0x2c5085){return db[_0xa3a3('0x50')][_0xa3a3('0x57')]({'where':{'id':_0x21ab61[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x19c600,null))[_0xa3a3('0x35')](function(_0x45b325){if(_0x45b325){return _0x45b325[_0xa3a3('0xe5')](_0x21ab61[_0xa3a3('0x61')]['ids'],_['omit'](_0x21ab61['body'],[_0xa3a3('0x6b'),'id'])||{})['spread'](function(_0x39474e){for(var _0x1c69bf=0x0;_0x1c69bf<_0x21ab61[_0xa3a3('0x61')][_0xa3a3('0x6b')][_0xa3a3('0x47')];_0x1c69bf+=0x1){socket[_0xa3a3('0xe6')](_0xa3a3('0xe7'),{'UserId':Number(_0x21ab61[_0xa3a3('0x61')][_0xa3a3('0x6b')][_0x1c69bf]),'SmsAccountId':Number(_0x21ab61[_0xa3a3('0x60')]['id'])});}return _0x39474e;});}})[_0xa3a3('0x35')](respondWithResult(_0x19c600,null))[_0xa3a3('0x29')](handleError(_0x19c600,null));};exports[_0xa3a3('0xe8')]=function(_0x2b13b2,_0x468a69,_0x64d5ee){return db['SmsAccount']['find']({'where':{'id':_0x2b13b2[_0xa3a3('0x60')]['id']}})[_0xa3a3('0x35')](handleEntityNotFound(_0x468a69,null))[_0xa3a3('0x35')](function(_0x2178d4){if(_0x2178d4){return _0x2178d4[_0xa3a3('0xe8')](_0x2b13b2[_0xa3a3('0x43')][_0xa3a3('0x6b')])['then'](function(){if(_[_0xa3a3('0xe9')](_0x2b13b2[_0xa3a3('0x43')][_0xa3a3('0x6b')])){for(var _0x1e3b2d=0x0;_0x1e3b2d<_0x2b13b2[_0xa3a3('0x43')][_0xa3a3('0x6b')][_0xa3a3('0x47')];_0x1e3b2d+=0x1){socket[_0xa3a3('0xe6')](_0xa3a3('0xea'),{'UserId':Number(_0x2b13b2[_0xa3a3('0x43')][_0xa3a3('0x6b')][_0x1e3b2d]),'SmsAccountId':Number(_0x2b13b2[_0xa3a3('0x60')]['id'])});}}else{socket[_0xa3a3('0xe6')](_0xa3a3('0xea'),{'UserId':Number(_0x2b13b2[_0xa3a3('0x43')]['ids']),'SmsAccountId':Number(_0x2b13b2[_0xa3a3('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x468a69,null))[_0xa3a3('0x29')](handleError(_0x468a69,null));};exports[_0xa3a3('0xeb')]=function(_0x50480b,_0x16e702,_0x9fcf93){var _0x61d3b7={};var _0x3c199d={};var _0x44449f;var _0x17da21;return db[_0xa3a3('0x50')]['findOne']({'where':{'id':_0x50480b[_0xa3a3('0x60')]['id']}})['then'](handleEntityNotFound(_0x16e702,null))[_0xa3a3('0x35')](function(_0x224e47){if(_0x224e47){_0x44449f=_0x224e47;_0x3c199d[_0xa3a3('0x42')]=_[_0xa3a3('0x55')](db[_0xa3a3('0xab')]['rawAttributes']);_0x3c199d['query']=_[_0xa3a3('0x55')](_0x50480b[_0xa3a3('0x43')]);_0x3c199d[_0xa3a3('0x44')]=_[_0xa3a3('0x45')](_0x3c199d[_0xa3a3('0x42')],_0x3c199d[_0xa3a3('0x43')]);_0x61d3b7[_0xa3a3('0x46')]=_['intersection'](_0x3c199d[_0xa3a3('0x42')],qs['fields'](_0x50480b[_0xa3a3('0x43')][_0xa3a3('0x56')]));_0x61d3b7['attributes']=_0x61d3b7[_0xa3a3('0x46')][_0xa3a3('0x47')]?_0x61d3b7['attributes']:_0x3c199d[_0xa3a3('0x42')];_0x61d3b7['order']=qs['sort'](_0x50480b[_0xa3a3('0x43')]['sort']);_0x61d3b7[_0xa3a3('0x4b')]=qs[_0xa3a3('0x44')](_[_0xa3a3('0x6f')](_0x50480b['query'],_0x3c199d['filters']));if(_0x50480b[_0xa3a3('0x43')][_0xa3a3('0x4c')]){_0x61d3b7[_0xa3a3('0x4b')]=_[_0xa3a3('0x4d')](_0x61d3b7['where'],{'$or':_[_0xa3a3('0x3e')](_0x61d3b7[_0xa3a3('0x46')],function(_0x320a52){var _0x1df4ee={};_0x1df4ee[_0x320a52]={'$like':'%'+_0x50480b[_0xa3a3('0x43')][_0xa3a3('0x4c')]+'%'};return _0x1df4ee;})});}_0x61d3b7=_[_0xa3a3('0x4d')]({},_0x61d3b7,_0x50480b[_0xa3a3('0x4f')]);return _0x44449f[_0xa3a3('0xeb')](_0x61d3b7);}})[_0xa3a3('0x35')](function(_0x55d1af){if(_0x55d1af){_0x17da21=_0x55d1af[_0xa3a3('0x47')];if(!_0x50480b['query'][_0xa3a3('0x48')](_0xa3a3('0x49'))){_0x61d3b7[_0xa3a3('0x30')]=qs[_0xa3a3('0x30')](_0x50480b[_0xa3a3('0x43')]['limit']);_0x61d3b7[_0xa3a3('0x2e')]=qs[_0xa3a3('0x2e')](_0x50480b[_0xa3a3('0x43')]['offset']);}return _0x44449f[_0xa3a3('0xeb')](_0x61d3b7);}})[_0xa3a3('0x35')](function(_0xfd04a4){if(_0xfd04a4){return _0xfd04a4?{'count':_0x17da21,'rows':_0xfd04a4}:null;}})[_0xa3a3('0x35')](respondWithResult(_0x16e702,null))[_0xa3a3('0x29')](handleError(_0x16e702,null));}; \ No newline at end of file +var _0x25cb=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','options','SmsAccount','includeAll','findAll','rows','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','MessageSid','skebby','text','connectel','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','Sequelize','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','ListId','DESC','list','omit','Contacts','contact','SmsInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','interaction','created','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tags','tag','to\x20is\x20mandatory','List','out','SmsMessage','dataValues','Messages','statusInt','requestid','status_code','groupName','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','get','SmsAccounts','UserProfileResource','destroy','end','name','send','Pause','mandatoryDispositionPause'];(function(_0x1f3856,_0x3fd43c){var _0x47f964=function(_0x108bda){while(--_0x108bda){_0x1f3856['push'](_0x1f3856['shift']());}};_0x47f964(++_0x3fd43c);}(_0x25cb,0x18a));var _0xb25c=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x25cb[_0x47242d];return _0x30273a;};'use strict';var emlformat=require(_0xb25c('0x0'));var rimraf=require(_0xb25c('0x1'));var zipdir=require(_0xb25c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb25c('0x3'));var moment=require('moment');var BPromise=require(_0xb25c('0x4'));var Mustache=require(_0xb25c('0x5'));var util=require(_0xb25c('0x6'));var path=require('path');var sox=require(_0xb25c('0x7'));var csv=require(_0xb25c('0x8'));var ejs=require(_0xb25c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb25c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb25c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb25c('0x8'));var querystring=require(_0xb25c('0xc'));var Papa=require(_0xb25c('0xd'));var Redis=require(_0xb25c('0xe'));var authService=require(_0xb25c('0xf'));var qs=require(_0xb25c('0x10'));var as=require(_0xb25c('0x11'));var hardwareService=require(_0xb25c('0x12'));var logger=require(_0xb25c('0x13'))(_0xb25c('0x14'));var utils=require(_0xb25c('0x15'));var config=require(_0xb25c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb25c('0x17'))['db'];config[_0xb25c('0x18')]=_[_0xb25c('0x19')](config['redis'],{'host':_0xb25c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb25c('0x18')]));require(_0xb25c('0x1b'))[_0xb25c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb25c('0x1d')][_0xb25c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x45e022,_0x191282,_0xfeaa5c,_0x5ed826){return new BPromise(function(_0x107be9,_0x246ac8){var _0x48f7e5=_0x5ed826||client;return _0x48f7e5['request'](_0x45e022,_0xfeaa5c)[_0xb25c('0x1f')](function(_0x5dc536){logger[_0xb25c('0x20')](_0xb25c('0x21'),_0x191282,_0xb25c('0x22'));logger[_0xb25c('0x23')](_0xb25c('0x24'),_0x191282,_0xb25c('0x22'),JSON['stringify'](_0x5dc536));if(_0x5dc536['error']){if(_0x5dc536[_0xb25c('0x25')][_0xb25c('0x26')]===0x1f4){logger[_0xb25c('0x25')](_0xb25c('0x21'),_0x191282,_0x5dc536[_0xb25c('0x25')]['message']);return _0x246ac8(_0x5dc536['error'][_0xb25c('0x27')]);}logger[_0xb25c('0x25')](_0xb25c('0x21'),_0x191282,_0x5dc536[_0xb25c('0x25')][_0xb25c('0x27')]);return _0x107be9(_0x5dc536['error']['message']);}else{logger[_0xb25c('0x20')](_0xb25c('0x21'),_0x191282,_0xb25c('0x22'));_0x107be9(_0x5dc536[_0xb25c('0x28')][_0xb25c('0x27')]);}})[_0xb25c('0x29')](function(_0x3dd544){logger[_0xb25c('0x25')](_0xb25c('0x21'),_0x191282,_0x3dd544);_0x246ac8(_0x3dd544);});});}function respondWithStatusCode(_0x2691d3,_0x37ab56){_0x37ab56=_0x37ab56||0xcc;return function(_0x1288ff){if(_0x1288ff){return _0x2691d3[_0xb25c('0x2a')](_0x37ab56);}return _0x2691d3[_0xb25c('0x2b')](_0x37ab56)['end']();};}function respondWithResult(_0x157619,_0x2b5d56){_0x2b5d56=_0x2b5d56||0xc8;return function(_0x53f080){if(_0x53f080){return _0x157619[_0xb25c('0x2b')](_0x2b5d56)[_0xb25c('0x2c')](_0x53f080);}};}function respondWithFilteredResult(_0x2e39b8,_0x12b7a2){return function(_0x3b74db){if(_0x3b74db){var _0xb0c73=typeof _0x12b7a2[_0xb25c('0x2d')]===_0xb25c('0x2e')&&typeof _0x12b7a2[_0xb25c('0x2f')]===_0xb25c('0x2e');var _0x21b068=_0x3b74db[_0xb25c('0x30')];var _0x4e0dc2=_0xb0c73?0x0:_0x12b7a2[_0xb25c('0x2d')];var _0x29bace=_0xb0c73?_0x3b74db[_0xb25c('0x30')]:_0x12b7a2[_0xb25c('0x2d')]+_0x12b7a2[_0xb25c('0x2f')];var _0x5663e6;if(_0x29bace>=_0x21b068){_0x29bace=_0x21b068;_0x5663e6=0xc8;}else{_0x5663e6=0xce;}_0x2e39b8[_0xb25c('0x2b')](_0x5663e6);return _0x2e39b8[_0xb25c('0x31')](_0xb25c('0x32'),_0x4e0dc2+'-'+_0x29bace+'/'+_0x21b068)[_0xb25c('0x2c')](_0x3b74db);}return null;};}function patchUpdates(_0x5250a8){return function(_0x4bf657){try{jsonpatch['apply'](_0x4bf657,_0x5250a8,!![]);}catch(_0x477555){return BPromise['reject'](_0x477555);}return _0x4bf657[_0xb25c('0x33')]();};}function saveUpdates(_0x5ed517,_0x5a97c3){return function(_0x64facb){if(_0x64facb){return _0x64facb[_0xb25c('0x34')](_0x5ed517)[_0xb25c('0x1f')](function(_0x512206){return _0x512206;});}return null;};}function removeEntity(_0x394fd5,_0xec8d6f){return function(_0xb6350a){if(_0xb6350a){return _0xb6350a['destroy']()[_0xb25c('0x1f')](function(){var _0x2d6dc2=_0xb6350a[_0xb25c('0x35')]({'plain':!![]});var _0x4d7dc5=_0xb25c('0x36');return db[_0xb25c('0x37')][_0xb25c('0x38')]({'where':{'type':_0x4d7dc5,'resourceId':_0x2d6dc2['id']}})[_0xb25c('0x1f')](function(){return _0xb6350a;});})['then'](function(){_0x394fd5['status'](0xcc)[_0xb25c('0x39')]();});}};}function handleEntityNotFound(_0x4724e7,_0x597c89){return function(_0x1e749f){if(!_0x1e749f){_0x4724e7['sendStatus'](0x194);}return _0x1e749f;};}function handleError(_0x1148ad,_0x3bfff6){_0x3bfff6=_0x3bfff6||0x1f4;return function(_0x507ddd){logger[_0xb25c('0x25')](_0x507ddd['stack']);if(_0x507ddd[_0xb25c('0x3a')]){delete _0x507ddd['name'];}_0x1148ad['status'](_0x3bfff6)[_0xb25c('0x3b')](_0x507ddd);};}exports['index']=function(_0xf318ef,_0x29f237){var _0x180a41={'include':[{'model':db[_0xb25c('0x3c')],'as':_0xb25c('0x3d')}]},_0x4926f4={},_0x341fdd={'count':0x0,'rows':[]};var _0x1caa5d=_[_0xb25c('0x3e')](db['SmsAccount'][_0xb25c('0x3f')],function(_0x52afb9){return{'name':_0x52afb9[_0xb25c('0x40')],'type':_0x52afb9[_0xb25c('0x41')][_0xb25c('0x42')]};});_0x4926f4[_0xb25c('0x43')]=_['map'](_0x1caa5d,_0xb25c('0x3a'));_0x4926f4['query']=_[_0xb25c('0x44')](_0xf318ef[_0xb25c('0x45')]);_0x4926f4[_0xb25c('0x46')]=_[_0xb25c('0x47')](_0x4926f4[_0xb25c('0x43')],_0x4926f4[_0xb25c('0x45')]);_0x180a41[_0xb25c('0x48')]=_[_0xb25c('0x47')](_0x4926f4[_0xb25c('0x43')],qs[_0xb25c('0x49')](_0xf318ef[_0xb25c('0x45')]['fields']));_0x180a41[_0xb25c('0x48')]=_0x180a41[_0xb25c('0x48')][_0xb25c('0x4a')]?_0x180a41[_0xb25c('0x48')]:_0x4926f4['model'];if(!_0xf318ef['query'][_0xb25c('0x4b')]('nolimit')){_0x180a41[_0xb25c('0x2f')]=qs[_0xb25c('0x2f')](_0xf318ef['query'][_0xb25c('0x2f')]);_0x180a41[_0xb25c('0x2d')]=qs['offset'](_0xf318ef['query']['offset']);}_0x180a41[_0xb25c('0x4c')]=qs['sort'](_0xf318ef[_0xb25c('0x45')]['sort']);_0x180a41[_0xb25c('0x4d')]=qs[_0xb25c('0x46')](_[_0xb25c('0x4e')](_0xf318ef['query'],_0x4926f4['filters']),_0x1caa5d);if(_0xf318ef[_0xb25c('0x45')][_0xb25c('0x4f')]){_0x180a41[_0xb25c('0x4d')]=_['merge'](_0x180a41['where'],{'$or':_['map'](_0x1caa5d,function(_0x40a4dc){if(_0x40a4dc[_0xb25c('0x41')]!==_0xb25c('0x50')){var _0x3e35c0={};_0x3e35c0[_0x40a4dc[_0xb25c('0x3a')]]={'$like':'%'+_0xf318ef[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x3e35c0;}})});}_0x180a41=_['merge']({},_0x180a41,_0xf318ef[_0xb25c('0x51')]);var _0x2b6abb={'where':_0x180a41[_0xb25c('0x4d')]};return db[_0xb25c('0x52')]['count'](_0x2b6abb)[_0xb25c('0x1f')](function(_0x5e1164){_0x341fdd[_0xb25c('0x30')]=_0x5e1164;if(_0xf318ef[_0xb25c('0x45')][_0xb25c('0x53')]){_0x180a41['include']=[{'all':!![]}];}return db[_0xb25c('0x52')][_0xb25c('0x54')](_0x180a41);})[_0xb25c('0x1f')](function(_0x14c8c8){_0x341fdd[_0xb25c('0x55')]=_0x14c8c8;return _0x341fdd;})[_0xb25c('0x1f')](respondWithFilteredResult(_0x29f237,_0x180a41))[_0xb25c('0x29')](handleError(_0x29f237,null));};exports['show']=function(_0xbf7bb,_0x4e3ef2){var _0x477ee8={'raw':![],'where':{'id':_0xbf7bb[_0xb25c('0x56')]['id']},'include':[{'model':db[_0xb25c('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4dbefa={};_0x4dbefa[_0xb25c('0x43')]=_[_0xb25c('0x44')](db[_0xb25c('0x52')][_0xb25c('0x3f')]);_0x4dbefa[_0xb25c('0x45')]=_[_0xb25c('0x44')](_0xbf7bb['query']);_0x4dbefa[_0xb25c('0x46')]=_['intersection'](_0x4dbefa[_0xb25c('0x43')],_0x4dbefa[_0xb25c('0x45')]);_0x477ee8['attributes']=_[_0xb25c('0x47')](_0x4dbefa[_0xb25c('0x43')],qs[_0xb25c('0x49')](_0xbf7bb[_0xb25c('0x45')]['fields']));_0x477ee8[_0xb25c('0x48')]=_0x477ee8[_0xb25c('0x48')]['length']?_0x477ee8[_0xb25c('0x48')]:_0x4dbefa['model'];if(_0xbf7bb[_0xb25c('0x45')][_0xb25c('0x53')]){_0x477ee8['include']=[{'all':!![]}];}_0x477ee8=_[_0xb25c('0x57')]({},_0x477ee8,_0xbf7bb[_0xb25c('0x51')]);return db[_0xb25c('0x52')]['find'](_0x477ee8)[_0xb25c('0x1f')](handleEntityNotFound(_0x4e3ef2,null))[_0xb25c('0x1f')](respondWithResult(_0x4e3ef2,null))[_0xb25c('0x29')](handleError(_0x4e3ef2,null));};exports[_0xb25c('0x58')]=function(_0x4420a9,_0x448e66){return db['SmsAccount'][_0xb25c('0x58')](_0x4420a9[_0xb25c('0x59')],{})['then'](function(_0x2d185e){var _0x2f563b=_0x4420a9[_0xb25c('0x5a')][_0xb25c('0x35')]({'plain':!![]});if(!_0x2f563b)throw new Error(_0xb25c('0x5b'));if(_0x2f563b[_0xb25c('0x5c')]==='user'){var _0x36a41f=_0x2d185e[_0xb25c('0x35')]({'plain':!![]});var _0x76e711=_0xb25c('0x36');return db[_0xb25c('0x5d')][_0xb25c('0x5e')]({'where':{'name':_0x76e711,'userProfileId':_0x2f563b[_0xb25c('0x5f')]},'raw':!![]})['then'](function(_0x28fee9){if(_0x28fee9&&_0x28fee9[_0xb25c('0x60')]===0x0){return db[_0xb25c('0x37')][_0xb25c('0x58')]({'name':_0x36a41f[_0xb25c('0x3a')],'resourceId':_0x36a41f['id'],'type':_0x28fee9[_0xb25c('0x3a')],'sectionId':_0x28fee9['id']},{})[_0xb25c('0x1f')](function(){return _0x2d185e;});}else{return _0x2d185e;}})[_0xb25c('0x29')](function(_0x2f0e27){logger[_0xb25c('0x25')](_0xb25c('0x61'),_0x2f0e27);throw _0x2f0e27;});}return _0x2d185e;})[_0xb25c('0x1f')](respondWithResult(_0x448e66,0xc9))[_0xb25c('0x29')](handleError(_0x448e66,null));};exports[_0xb25c('0x34')]=function(_0x307208,_0x3c213a){if(_0x307208[_0xb25c('0x59')]['id']){delete _0x307208[_0xb25c('0x59')]['id'];}return db[_0xb25c('0x52')][_0xb25c('0x5e')]({'where':{'id':_0x307208['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb25c('0x1f')](handleEntityNotFound(_0x3c213a,null))[_0xb25c('0x1f')](saveUpdates(_0x307208[_0xb25c('0x59')],null))[_0xb25c('0x1f')](respondWithResult(_0x3c213a,null))['catch'](handleError(_0x3c213a,null));};exports['destroy']=function(_0xd95c86,_0x5cd307){return db[_0xb25c('0x52')][_0xb25c('0x5e')]({'where':{'id':_0xd95c86['params']['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x5cd307,null))[_0xb25c('0x1f')](removeEntity(_0x5cd307,null))[_0xb25c('0x29')](handleError(_0x5cd307,null));};exports[_0xb25c('0x62')]=function(_0xca4ab6,_0x2e93ff){return db['SmsAccount']['describe']()[_0xb25c('0x1f')](respondWithResult(_0x2e93ff,null))[_0xb25c('0x29')](handleError(_0x2e93ff,null));};exports[_0xb25c('0x63')]=function(_0x828641,_0x5dae22,_0x4d285a){if(_0x828641[_0xb25c('0x59')]['id']){delete _0x828641[_0xb25c('0x59')]['id'];}return db['SmsAccount'][_0xb25c('0x5e')]({'where':{'id':_0x828641['params']['id']}})['then'](handleEntityNotFound(_0x5dae22,null))[_0xb25c('0x1f')](function(_0x3ce034){if(_0x3ce034){_0x828641['body'][_0xb25c('0x64')]=_0x3ce034['id'];return db[_0xb25c('0x65')][_0xb25c('0x58')](_0x828641[_0xb25c('0x59')]);}})[_0xb25c('0x1f')](respondWithResult(_0x5dae22,null))[_0xb25c('0x29')](handleError(_0x5dae22,null));};exports[_0xb25c('0x66')]=function(_0x4dc3ee,_0x443fbf,_0x3d5411){var _0x48124c={'raw':![],'where':{}};var _0x4efd36={};var _0x4f90d2={'count':0x0,'rows':[]};return db[_0xb25c('0x52')][_0xb25c('0x67')]({'where':{'id':_0x4dc3ee[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x443fbf,null))[_0xb25c('0x1f')](function(_0x46377c){if(_0x46377c){_0x4efd36[_0xb25c('0x43')]=_[_0xb25c('0x44')](db['Disposition'][_0xb25c('0x3f')]);_0x4efd36['query']=_[_0xb25c('0x44')](_0x4dc3ee['query']);_0x4efd36[_0xb25c('0x46')]=_[_0xb25c('0x47')](_0x4efd36[_0xb25c('0x43')],_0x4efd36[_0xb25c('0x45')]);_0x48124c[_0xb25c('0x48')]=_[_0xb25c('0x47')](_0x4efd36['model'],qs[_0xb25c('0x49')](_0x4dc3ee[_0xb25c('0x45')][_0xb25c('0x49')]));_0x48124c[_0xb25c('0x48')]=_0x48124c[_0xb25c('0x48')][_0xb25c('0x4a')]?_0x48124c[_0xb25c('0x48')]:_0x4efd36[_0xb25c('0x43')];if(!_0x4dc3ee[_0xb25c('0x45')][_0xb25c('0x4b')](_0xb25c('0x68'))){_0x48124c['limit']=qs[_0xb25c('0x2f')](_0x4dc3ee[_0xb25c('0x45')][_0xb25c('0x2f')]);_0x48124c[_0xb25c('0x2d')]=qs[_0xb25c('0x2d')](_0x4dc3ee[_0xb25c('0x45')]['offset']);}_0x48124c[_0xb25c('0x4c')]=qs[_0xb25c('0x69')](_0x4dc3ee[_0xb25c('0x45')]['sort']);_0x48124c['where']=qs[_0xb25c('0x46')](_[_0xb25c('0x4e')](_0x4dc3ee[_0xb25c('0x45')],_0x4efd36[_0xb25c('0x46')]));_0x48124c['where'][_0xb25c('0x64')]=_0x46377c['id'];if(_0x4dc3ee[_0xb25c('0x45')][_0xb25c('0x4f')]){_0x48124c[_0xb25c('0x4d')]=_[_0xb25c('0x57')](_0x48124c['where'],{'$or':_[_0xb25c('0x3e')](_0x48124c[_0xb25c('0x48')],function(_0xebeee7){var _0x128d80={};_0x128d80[_0xebeee7]={'$like':'%'+_0x4dc3ee[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x128d80;})});}_0x48124c=_[_0xb25c('0x57')]({},_0x48124c,_0x4dc3ee[_0xb25c('0x51')]);return db[_0xb25c('0x65')][_0xb25c('0x30')]({'where':_0x48124c[_0xb25c('0x4d')]})['then'](function(_0x2f52b2){_0x4f90d2[_0xb25c('0x30')]=_0x2f52b2;if(_0x4dc3ee['query'][_0xb25c('0x53')]){_0x48124c['include']=[{'all':!![]}];}return db[_0xb25c('0x65')][_0xb25c('0x54')](_0x48124c);})[_0xb25c('0x1f')](function(_0x321223){_0x4f90d2[_0xb25c('0x55')]=_0x321223;return _0x4f90d2;});}})[_0xb25c('0x1f')](respondWithFilteredResult(_0x443fbf,_0x48124c))[_0xb25c('0x29')](handleError(_0x443fbf,null));};exports['removeDispositions']=function(_0x3c8c43,_0x456795,_0x455056){return db[_0xb25c('0x52')][_0xb25c('0x5e')]({'where':{'id':_0x3c8c43[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x456795,null))[_0xb25c('0x1f')](function(_0x3fb83e){if(_0x3fb83e){return _0x3fb83e[_0xb25c('0x6a')](_0x3c8c43[_0xb25c('0x45')][_0xb25c('0x6b')]);}})[_0xb25c('0x1f')](respondWithStatusCode(_0x456795,null))[_0xb25c('0x29')](handleError(_0x456795,null));};exports['addAnswer']=function(_0x156f09,_0x2a9ec9,_0x1a772d){if(_0x156f09['body']['id']){delete _0x156f09[_0xb25c('0x59')]['id'];}return db[_0xb25c('0x52')]['find']({'where':{'id':_0x156f09['params']['id']}})['then'](handleEntityNotFound(_0x2a9ec9,null))[_0xb25c('0x1f')](function(_0x8887d){if(_0x8887d){_0x156f09['body'][_0xb25c('0x64')]=_0x8887d['id'];return db[_0xb25c('0x6c')][_0xb25c('0x58')](_0x156f09[_0xb25c('0x59')]);}})[_0xb25c('0x1f')](respondWithResult(_0x2a9ec9,null))['catch'](handleError(_0x2a9ec9,null));};exports[_0xb25c('0x6d')]=function(_0x34b6f7,_0xc8deb,_0x4860bb){var _0x29cee3={'raw':![],'where':{}};var _0x2112df={};var _0x27e7a8={'count':0x0,'rows':[]};return db[_0xb25c('0x52')][_0xb25c('0x67')]({'where':{'id':_0x34b6f7[_0xb25c('0x56')]['id']}})['then'](handleEntityNotFound(_0xc8deb,null))[_0xb25c('0x1f')](function(_0x4e7f88){if(_0x4e7f88){_0x2112df[_0xb25c('0x43')]=_[_0xb25c('0x44')](db[_0xb25c('0x6c')][_0xb25c('0x3f')]);_0x2112df[_0xb25c('0x45')]=_['keys'](_0x34b6f7[_0xb25c('0x45')]);_0x2112df[_0xb25c('0x46')]=_[_0xb25c('0x47')](_0x2112df[_0xb25c('0x43')],_0x2112df[_0xb25c('0x45')]);_0x29cee3[_0xb25c('0x48')]=_[_0xb25c('0x47')](_0x2112df['model'],qs[_0xb25c('0x49')](_0x34b6f7['query'][_0xb25c('0x49')]));_0x29cee3['attributes']=_0x29cee3[_0xb25c('0x48')][_0xb25c('0x4a')]?_0x29cee3[_0xb25c('0x48')]:_0x2112df[_0xb25c('0x43')];if(!_0x34b6f7[_0xb25c('0x45')][_0xb25c('0x4b')](_0xb25c('0x68'))){_0x29cee3[_0xb25c('0x2f')]=qs[_0xb25c('0x2f')](_0x34b6f7[_0xb25c('0x45')]['limit']);_0x29cee3[_0xb25c('0x2d')]=qs[_0xb25c('0x2d')](_0x34b6f7[_0xb25c('0x45')][_0xb25c('0x2d')]);}_0x29cee3[_0xb25c('0x4c')]=qs[_0xb25c('0x69')](_0x34b6f7[_0xb25c('0x45')]['sort']);_0x29cee3[_0xb25c('0x4d')]=qs[_0xb25c('0x46')](_[_0xb25c('0x4e')](_0x34b6f7['query'],_0x2112df[_0xb25c('0x46')]));_0x29cee3['where']['SmsAccountId']=_0x4e7f88['id'];if(_0x34b6f7[_0xb25c('0x45')][_0xb25c('0x4f')]){_0x29cee3[_0xb25c('0x4d')]=_[_0xb25c('0x57')](_0x29cee3['where'],{'$or':_['map'](_0x29cee3[_0xb25c('0x48')],function(_0x47616c){var _0x29d760={};_0x29d760[_0x47616c]={'$like':'%'+_0x34b6f7[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x29d760;})});}_0x29cee3=_[_0xb25c('0x57')]({},_0x29cee3,_0x34b6f7[_0xb25c('0x51')]);return db[_0xb25c('0x6c')][_0xb25c('0x30')]({'where':_0x29cee3[_0xb25c('0x4d')]})[_0xb25c('0x1f')](function(_0x1aea2d){_0x27e7a8[_0xb25c('0x30')]=_0x1aea2d;if(_0x34b6f7[_0xb25c('0x45')][_0xb25c('0x53')]){_0x29cee3['include']=[{'all':!![]}];}return db[_0xb25c('0x6c')][_0xb25c('0x54')](_0x29cee3);})[_0xb25c('0x1f')](function(_0x4485b3){_0x27e7a8[_0xb25c('0x55')]=_0x4485b3;return _0x27e7a8;});}})[_0xb25c('0x1f')](respondWithFilteredResult(_0xc8deb,_0x29cee3))[_0xb25c('0x29')](handleError(_0xc8deb,null));};exports[_0xb25c('0x6e')]=function(_0x492f34,_0x122428,_0x6093dc){return db['SmsAccount'][_0xb25c('0x5e')]({'where':{'id':_0x492f34['params']['id']}})['then'](handleEntityNotFound(_0x122428,null))[_0xb25c('0x1f')](function(_0x2e8947){if(_0x2e8947){return _0x2e8947['removeAnswers'](_0x492f34[_0xb25c('0x45')][_0xb25c('0x6b')]);}})['then'](respondWithStatusCode(_0x122428,null))['catch'](handleError(_0x122428,null));};exports['notify']=function(_0x29e04a,_0x4d40f9,_0x432ded){var _0x2fa841={'channel':_0xb25c('0x6f')};var _0x54c053=[];var _0x18c30b=[];var _0x23c57c={};return db['SmsAccount']['find']({'where':{'id':_0x29e04a[_0xb25c('0x56')]['id']},'include':[{'model':db[_0xb25c('0x70')],'as':_0xb25c('0x71')}]})[_0xb25c('0x1f')](handleEntityNotFound(_0x4d40f9,null))[_0xb25c('0x1f')](function(_0x52be9b){_0x2fa841[_0xb25c('0x72')]=_0x52be9b;_0x2fa841[_0xb25c('0x73')]=_[_0xb25c('0x74')](_0x52be9b[_0xb25c('0x71')],[_0xb25c('0x75')],[_0xb25c('0x76')]);if(_0x2fa841[_0xb25c('0x72')][_0xb25c('0x71')]){delete _0x2fa841['account'][_0xb25c('0x71')];}return db[_0xb25c('0x77')]['describe']();})[_0xb25c('0x1f')](function(_0x266240){if(!_0x266240){throw new db['Sequelize'][(_0xb25c('0x78'))](_0xb25c('0x79'));}_0x54c053=_[_0xb25c('0x7a')](_[_0xb25c('0x44')](_0x266240),[_0xb25c('0x7b'),_0xb25c('0x7c')]);_0x18c30b=_[_0xb25c('0x7a')](_['keys'](_0x266240),[_0xb25c('0x7b'),'updatedAt',_0xb25c('0x7d'),'ListId']);_0x2fa841['body']={'mapKey':_0xb25c('0x7e')};if(_0x2fa841[_0xb25c('0x72')]['type']){switch(_0x2fa841['account'][_0xb25c('0x41')]){case'twilio':_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]=_0x29e04a['body'][_0xb25c('0x80')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x81')];_0x2fa841[_0xb25c('0x59')]['messageId']=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x82')];break;case _0xb25c('0x83'):_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]='+'+_0x29e04a[_0xb25c('0x59')]['sender'];_0x2fa841['body'][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x84')];break;case _0xb25c('0x85'):_0x2fa841[_0xb25c('0x59')]['from']=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x7f')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x27')];break;case _0xb25c('0x86'):_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]=_0x29e04a[_0xb25c('0x59')]['from'];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x59')];_0x2fa841['body'][_0xb25c('0x87')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x88')];break;case _0xb25c('0x89'):_0x2fa841['body']['from']=_0x29e04a['body'][_0xb25c('0x80')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a['body']['Text'];_0x2fa841['body'][_0xb25c('0x87')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x8a')];break;case _0xb25c('0x8b'):_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]='+'+_0x29e04a[_0xb25c('0x59')]['results'][0x0][_0xb25c('0x7f')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x8c')][0x0][_0xb25c('0x84')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x87')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x8c')][0x0][_0xb25c('0x87')];break;case _0xb25c('0x8d'):_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]=_0x29e04a[_0xb25c('0x59')]['originatingAddress'];_0x2fa841['body']['body']=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x8e')][_0xb25c('0x27')];break;case _0xb25c('0x8f'):_0x2fa841['body']['from']=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x90')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x84')];_0x2fa841[_0xb25c('0x59')]['messageId']=_0x29e04a[_0xb25c('0x59')]['replyMessageId'];break;case _0xb25c('0x91'):_0x2fa841[_0xb25c('0x59')][_0xb25c('0x87')]=_0x29e04a[_0xb25c('0x59')][0x0][_0xb25c('0x27')]['id'];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')]=_0x29e04a[_0xb25c('0x59')][0x0][_0xb25c('0x27')][_0xb25c('0x7f')];_0x2fa841[_0xb25c('0x59')]['body']=_0x29e04a['body'][0x0][_0xb25c('0x27')]['text'];break;case _0xb25c('0x92'):_0x2fa841['body'][_0xb25c('0x7f')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x7f')];_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x27')];_0x2fa841[_0xb25c('0x59')]['messageId']=_0x29e04a[_0xb25c('0x59')][_0xb25c('0x93')];break;}}if(_0x2fa841['body']['id']){delete _0x2fa841[_0xb25c('0x59')]['id'];}if(_[_0xb25c('0x94')](_0x2fa841['body'][_0xb25c('0x7f')])){throw new db['Sequelize'][(_0xb25c('0x78'))]('from\x20is\x20mandatory');}if(_[_0xb25c('0x94')](_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')])||_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')]===''){throw new db[(_0xb25c('0x95'))][(_0xb25c('0x78'))](_0xb25c('0x96'));}if(_[_0xb25c('0x94')](_0x2fa841['body'][_0xb25c('0x97')])){throw new db[(_0xb25c('0x95'))]['ValidationError'](_0xb25c('0x98')+_0x18c30b);}if(!_['includes'](_0x18c30b,_0x2fa841[_0xb25c('0x59')][_0xb25c('0x97')])){throw new db[(_0xb25c('0x95'))][(_0xb25c('0x78'))](_0xb25c('0x99')+_0x18c30b);}_0x23c57c[_0x2fa841['body'][_0xb25c('0x97')]]=_0x2fa841[_0xb25c('0x59')]['from'];return db[_0xb25c('0x9a')][_0xb25c('0x5e')]({'where':{'id':_0x2fa841[_0xb25c('0x72')][_0xb25c('0x9b')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x23c57c,'limit':0x1,'order':[[_0xb25c('0x7c'),_0xb25c('0x9c')]]}]});})[_0xb25c('0x1f')](handleEntityNotFound(_0x4d40f9,null))['then'](function(_0x4d926b){if(_0x4d926b){_0x2fa841[_0xb25c('0x9d')]=_[_0xb25c('0x9e')](_0x4d926b,[_0xb25c('0x9f')]);if(_0x4d926b[_0xb25c('0x9f')][_0xb25c('0x4a')]){return _0x4d926b['Contacts'][0x0];}var _0x5cf215=_[_0xb25c('0x19')](_0x2fa841['body'],{'firstName':_0x2fa841[_0xb25c('0x59')][_0xb25c('0x7f')],'ListId':_0x4d926b['id']});_0x5cf215[_0x2fa841[_0xb25c('0x59')][_0xb25c('0x97')]]=_0x2fa841['body']['from'];return db['CmContact'][_0xb25c('0x58')](_0x5cf215,{'fields':_0x54c053,'raw':!![]});}})[_0xb25c('0x1f')](handleEntityNotFound(_0x4d40f9,null))['then'](function(_0x1e7f53){if(_0x1e7f53){_0x2fa841[_0xb25c('0xa0')]=_0x1e7f53;var _0x3e6df1={'ContactId':_0x1e7f53['id'],'phone':_0x2fa841['body']['from'],'SmsAccountId':_0x29e04a['params']['id']};var _0x5a9cfc={'ContactId':_0x1e7f53['id'],'SmsAccountId':_0x29e04a[_0xb25c('0x56')]['id'],'closed':![]};return db[_0xb25c('0xa1')][_0xb25c('0x5e')]({'where':_0x5a9cfc})[_0xb25c('0x1f')](function(_0x1bb182){if(_0x1bb182){return[_0x1bb182,![]];}return db[_0xb25c('0xa1')][_0xb25c('0x58')](_0x3e6df1)[_0xb25c('0x1f')](function(_0x1cce0d){return[_0x1cce0d,!![]];});});}})[_0xb25c('0xa2')](function(_0x132dee,_0x1acfeb){_0x2fa841['interaction']=_0x132dee['get']({'plain':!![]});_0x2fa841['interaction']['created']=![];if(_0x1acfeb){if(_0x2fa841['account'][_0xb25c('0xa3')]){_0x2fa841[_0xb25c('0x73')][_0xb25c('0xa4')]({'id':0x0,'priority':_0x2fa841[_0xb25c('0x73')][_0xb25c('0x4a')]+0x1,'app':_0xb25c('0xa5'),'appdata':_0xb25c('0xa6'),'interval':_0xb25c('0xa7')});}_0x2fa841[_0xb25c('0xa8')][_0xb25c('0xa9')]=!![];}return db['SmsMessage'][_0xb25c('0x58')]({'phone':_0x2fa841['body']['from'],'messageId':_0x2fa841[_0xb25c('0x59')][_0xb25c('0x87')],'body':_0x2fa841[_0xb25c('0x59')][_0xb25c('0x59')],'SmsAccountId':_0x29e04a['params']['id'],'SmsInteractionId':_0x132dee['id'],'direction':'in','ContactId':_0x132dee[_0xb25c('0xaa')],'AttachmentId':_0x2fa841[_0xb25c('0x59')][_0xb25c('0xab')]});})[_0xb25c('0x1f')](function(_0x41e34d){_0x2fa841[_0xb25c('0x27')]=_0x41e34d;if(!_0x2fa841['interaction'][_0xb25c('0xac')])return;return db[_0xb25c('0xad')][_0xb25c('0x5e')]({'attributes':['id',_0xb25c('0x3a')],'where':{'id':_0x2fa841[_0xb25c('0xa8')]['UserId']}});})['then'](function(_0x5d4b54){if(_0x5d4b54){_0x2fa841['applications'][_0xb25c('0xae')]({'id':0x0,'priority':0x0,'app':_0xb25c('0xaf'),'appdata':_0x5d4b54['name']+','+(_0x2fa841['account'][_0xb25c('0xb0')]||0xa),'interval':_0xb25c('0xa7')});}if(!_0x2fa841['interaction']['queueId'])return;return db[_0xb25c('0xb1')][_0xb25c('0x5e')]({'attributes':['id',_0xb25c('0x3a')],'where':{'id':_0x2fa841[_0xb25c('0xa8')]['queueId']}});})['then'](function(_0x5de8fa){if(_0x5de8fa){_0x2fa841[_0xb25c('0x73')][_0xb25c('0xae')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5de8fa[_0xb25c('0x3a')]+','+(_0x2fa841[_0xb25c('0x72')][_0xb25c('0xb2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb25c('0xb3'),_0xb25c('0xb4'),_0x2fa841);})[_0xb25c('0x1f')](function(_0x5c5410){if(_0x5c5410){var _0x2da815=0xc8;var _0x561059=_0xb25c('0xb5');logger['info'](_0xb25c('0x24'),_0x561059,_0x2da815,_0xb25c('0xb6'));logger[_0xb25c('0x23')](_0xb25c('0xb7'),_0x561059,_0x2da815,_0xb25c('0xb6'),JSON[_0xb25c('0xb8')](_0x5c5410));if(_0x2fa841[_0xb25c('0x72')]['type']===_0xb25c('0xb9')){return _0x4d40f9[_0xb25c('0x2b')](_0x2da815)[_0xb25c('0x31')](_0xb25c('0xba'),'text/xml')[_0xb25c('0x3b')]('\x0a');}else{return _0x4d40f9[_0xb25c('0x2b')](_0x2da815)[_0xb25c('0x2c')](_0x5c5410);}}})[_0xb25c('0x29')](handleError(_0x4d40f9,null));};exports['addApplications']=function(_0x3ca436,_0x1df6bf){var _0x2628f3=_0x3ca436[_0xb25c('0x56')]['id'];var _0x4eacd3=_0x3ca436[_0xb25c('0x59')];var _0x97a033=0xc8;var _0x685c58=null;return db[_0xb25c('0xbb')][_0xb25c('0xbc')]({'isolationLevel':db[_0xb25c('0xbb')]['Transaction'][_0xb25c('0xbd')][_0xb25c('0xbe')]},function(_0x2edd8c){return db[_0xb25c('0x52')]['findOne']({'where':{'id':_0x2628f3},'transaction':_0x2edd8c})['then'](function(_0x30e7db){if(_0x30e7db){return db[_0xb25c('0x70')][_0xb25c('0x38')]({'where':{'SmsAccountId':_0x2628f3},'transaction':_0x2edd8c})[_0xb25c('0x1f')](function(){var _0x1b66ac=_[_0xb25c('0x3e')](_0x4eacd3,function(_0x447781){_0x447781[_0xb25c('0x64')]=_0x2628f3;return _0x447781;});return db[_0xb25c('0x70')][_0xb25c('0xbf')](_0x1b66ac,{'transaction':_0x2edd8c});});}else{_0x97a033=0x194;_0x685c58=[];}});})[_0xb25c('0x1f')](function(){if(_0x97a033!==0x194){return db[_0xb25c('0x70')][_0xb25c('0xc0')]({'where':{'SmsAccountId':_0x2628f3},'order':_0xb25c('0x75')})[_0xb25c('0x1f')](function(_0x4020d0){_0x685c58=_0x4020d0;});}})[_0xb25c('0x29')](function(_0x4ada92){_0x97a033=0x1f4;logger[_0xb25c('0x25')](_0x4ada92[_0xb25c('0xc1')]);if(_0x4ada92['name']){delete _0x4ada92['name'];}_0x685c58=_0x4ada92;})[_0xb25c('0xc2')](function(){if(_0x685c58===null){_0x1df6bf[_0xb25c('0x2a')](_0x97a033);}else{if(_0x97a033===0x1f4){_0x1df6bf[_0xb25c('0x2b')](_0x97a033)['send'](_0x685c58);}else{_0x1df6bf[_0xb25c('0x2b')](_0x97a033)[_0xb25c('0x2c')](_0x685c58);}}});};exports[_0xb25c('0xc3')]=function(_0x2b38de,_0x2c7de4,_0x3af704){var _0xfa73db={};var _0x22a3bd={};var _0x1c127e;var _0x1c685a;return db[_0xb25c('0x52')][_0xb25c('0x67')]({'where':{'id':_0x2b38de[_0xb25c('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c7de4,null))['then'](function(_0x1f6059){if(_0x1f6059){_0x1c127e=_0x1f6059;_0x22a3bd[_0xb25c('0x43')]=_[_0xb25c('0x44')](db['SmsApplication'][_0xb25c('0x3f')]);_0x22a3bd[_0xb25c('0x45')]=_[_0xb25c('0x44')](_0x2b38de[_0xb25c('0x45')]);_0x22a3bd['filters']=_[_0xb25c('0x47')](_0x22a3bd[_0xb25c('0x43')],_0x22a3bd[_0xb25c('0x45')]);_0xfa73db['attributes']=_['intersection'](_0x22a3bd[_0xb25c('0x43')],qs[_0xb25c('0x49')](_0x2b38de['query'][_0xb25c('0x49')]));_0xfa73db[_0xb25c('0x48')]=_0xfa73db['attributes']['length']?_0xfa73db[_0xb25c('0x48')]:_0x22a3bd['model'];_0xfa73db[_0xb25c('0x4c')]=qs[_0xb25c('0x69')](_0x2b38de[_0xb25c('0x45')]['sort']);_0xfa73db[_0xb25c('0x4d')]=qs['filters'](_['pick'](_0x2b38de[_0xb25c('0x45')],_0x22a3bd[_0xb25c('0x46')]));if(_0x2b38de[_0xb25c('0x45')][_0xb25c('0x4f')]){_0xfa73db['where']=_[_0xb25c('0x57')](_0xfa73db[_0xb25c('0x4d')],{'$or':_[_0xb25c('0x3e')](_0xfa73db[_0xb25c('0x48')],function(_0x43fea3){var _0x3d7d16={};_0x3d7d16[_0x43fea3]={'$like':'%'+_0x2b38de[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x3d7d16;})});}_0xfa73db=_[_0xb25c('0x57')]({},_0xfa73db,_0x2b38de[_0xb25c('0x51')]);return _0x1c127e['getApplications'](_0xfa73db);}})['then'](function(_0x26e151){if(_0x26e151){_0x1c685a=_0x26e151['length'];if(!_0x2b38de[_0xb25c('0x45')]['hasOwnProperty'](_0xb25c('0x68'))){_0xfa73db[_0xb25c('0x2f')]=qs[_0xb25c('0x2f')](_0x2b38de[_0xb25c('0x45')]['limit']);_0xfa73db['offset']=qs['offset'](_0x2b38de['query']['offset']);}return _0x1c127e[_0xb25c('0xc3')](_0xfa73db);}})[_0xb25c('0x1f')](function(_0x436d20){if(_0x436d20){return _0x436d20?{'count':_0x1c685a,'rows':_0x436d20}:null;}})['then'](respondWithResult(_0x2c7de4,null))[_0xb25c('0x29')](handleError(_0x2c7de4,null));};exports[_0xb25c('0xc4')]=function(_0x3b9486,_0x47e885,_0x6377ed){var _0x3a24e8={'raw':![],'where':{}};var _0x4bb3ea={};var _0x84b0ec={'count':0x0,'rows':[]};return db[_0xb25c('0x52')][_0xb25c('0x67')]({'where':{'id':_0x3b9486[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x47e885,null))[_0xb25c('0x1f')](function(_0xf4fb91){if(_0xf4fb91){_0x4bb3ea[_0xb25c('0x43')]=_[_0xb25c('0x44')](db[_0xb25c('0xa1')][_0xb25c('0x3f')]);_0x4bb3ea[_0xb25c('0x45')]=_[_0xb25c('0x44')](_0x3b9486[_0xb25c('0x45')]);_0x4bb3ea['filters']=_[_0xb25c('0x47')](_0x4bb3ea[_0xb25c('0x43')],_0x4bb3ea[_0xb25c('0x45')]);_0x3a24e8[_0xb25c('0x48')]=_[_0xb25c('0x47')](_0x4bb3ea[_0xb25c('0x43')],qs[_0xb25c('0x49')](_0x3b9486[_0xb25c('0x45')][_0xb25c('0x49')]));_0x3a24e8[_0xb25c('0x48')]=_0x3a24e8[_0xb25c('0x48')]['length']?_0x3a24e8[_0xb25c('0x48')]:_0x4bb3ea['model'];if(!_0x3b9486[_0xb25c('0x45')][_0xb25c('0x4b')]('nolimit')){_0x3a24e8['limit']=qs[_0xb25c('0x2f')](_0x3b9486[_0xb25c('0x45')][_0xb25c('0x2f')]);_0x3a24e8[_0xb25c('0x2d')]=qs[_0xb25c('0x2d')](_0x3b9486[_0xb25c('0x45')][_0xb25c('0x2d')]);}_0x3a24e8['order']=qs[_0xb25c('0x69')](_0x3b9486[_0xb25c('0x45')][_0xb25c('0x69')]);_0x3a24e8[_0xb25c('0x4d')]=qs[_0xb25c('0x46')](_[_0xb25c('0x4e')](_0x3b9486[_0xb25c('0x45')],_0x4bb3ea[_0xb25c('0x46')]));_0x3a24e8['where'][_0xb25c('0x64')]=_0xf4fb91['id'];if(_0x3b9486[_0xb25c('0x45')][_0xb25c('0x4f')]){_0x3a24e8[_0xb25c('0x4d')]=_[_0xb25c('0x57')](_0x3a24e8[_0xb25c('0x4d')],{'$or':_[_0xb25c('0x3e')](_0x3a24e8['attributes'],function(_0x45efbe){var _0x1b5f4b={};_0x1b5f4b[_0x45efbe]={'$like':'%'+_0x3b9486[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x1b5f4b;})});}_0x3a24e8=_[_0xb25c('0x57')]({},_0x3a24e8,_0x3b9486['options']);return db['SmsInteraction']['count']({'where':_0x3a24e8[_0xb25c('0x4d')]})[_0xb25c('0x1f')](function(_0x4d2cad){_0x84b0ec['count']=_0x4d2cad;if(_0x3b9486[_0xb25c('0x45')][_0xb25c('0x53')]){_0x3a24e8['include']=[{'model':db[_0xb25c('0x77')],'as':_0xb25c('0xc5'),'required':![]},{'model':db[_0xb25c('0xad')],'as':_0xb25c('0xc6'),'attributes':[_0xb25c('0x3a'),'fullname',_0xb25c('0xc7')],'required':![]},{'model':db['Tag'],'as':_0xb25c('0xc8'),'attributes':['id','name','color'],'where':_0x3b9486[_0xb25c('0x45')]['tag']?{'id':_0x3b9486[_0xb25c('0x45')][_0xb25c('0xc9')]}:undefined,'required':_0x3b9486[_0xb25c('0x45')][_0xb25c('0xc9')]?!![]:![]}];}return db[_0xb25c('0xa1')][_0xb25c('0x54')](_0x3a24e8);})[_0xb25c('0x1f')](function(_0x4424df){_0x84b0ec[_0xb25c('0x55')]=_0x4424df;return _0x84b0ec;});}})[_0xb25c('0x1f')](respondWithFilteredResult(_0x47e885,_0x3a24e8))['catch'](handleError(_0x47e885,null));};exports[_0xb25c('0x3b')]=function(_0x498e43,_0x4015d3,_0x18f5af){var _0x459059,_0x199616,_0x17cf13;if(_['isNil'](_0x498e43[_0xb25c('0x59')][_0xb25c('0x59')])||_0x498e43['body'][_0xb25c('0x59')]===''){throw new db[(_0xb25c('0x95'))]['ValidationError'](_0xb25c('0x96'));}if(_['isNil'](_0x498e43[_0xb25c('0x59')]['to'])){throw new db['Sequelize'][(_0xb25c('0x78'))](_0xb25c('0xca'));}_0x459059=_0x498e43[_0xb25c('0x59')]['to'];return db[_0xb25c('0x52')]['find']({'where':{'id':_0x498e43[_0xb25c('0x56')]['id']},'include':[{'model':db[_0xb25c('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb25c('0x9f'),'where':{'mobile':_0x459059},'limit':0x1,'order':[[_0xb25c('0x7c'),'DESC']]}]}]})[_0xb25c('0x1f')](handleEntityNotFound(_0x4015d3,null))[_0xb25c('0x1f')](function(_0x1d9db2){if(_0x1d9db2&&_0x1d9db2['List']){_0x199616=_0x1d9db2[_0xb25c('0x35')]({'plain':!![]});if(_0x199616[_0xb25c('0xcb')]&&_0x199616['List'][_0xb25c('0x9f')]['length']){return _0x199616['List'][_0xb25c('0x9f')][0x0];}return db[_0xb25c('0x77')][_0xb25c('0x58')](_[_0xb25c('0x19')](_0x498e43['body'],{'firstName':_0x459059,'mobile':_0x459059,'phone':_0x459059,'ListId':_0x199616['ListId']}));}})[_0xb25c('0x1f')](handleEntityNotFound(_0x4015d3,null))[_0xb25c('0x1f')](function(_0x5d2794){if(_0x5d2794){_0x17cf13=_0x5d2794;return db[_0xb25c('0xa1')]['find']({'where':{'ContactId':_0x17cf13['id'],'closed':![],'SmsAccountId':_0x199616['id']}})[_0xb25c('0x1f')](function(_0x4d81fa){if(_0x4d81fa){return[_0x4d81fa,![]];}return db[_0xb25c('0xa1')][_0xb25c('0x58')]({'UserId':_0x498e43[_0xb25c('0x5a')]['id'],'ContactId':_0x17cf13['id'],'SmsAccountId':_0x199616['id'],'phone':_0x459059,'firstMsgDirection':_0xb25c('0xcc'),'Messages':[_[_0xb25c('0x57')](_0x498e43[_0xb25c('0x59')],{'read':![],'body':_0x498e43['body'][_0xb25c('0x59')],'phone':_0x459059,'SmsAccountId':_0x199616['id'],'UserId':_0x498e43[_0xb25c('0x5a')]['id'],'ContactId':_0x17cf13['id']})]},{'include':[{'model':db[_0xb25c('0xcd')],'as':'Messages'}]})[_0xb25c('0x1f')](function(_0x20a541){return[_0x20a541,!![]];});});}})[_0xb25c('0xa2')](function(_0xc6e256,_0x379964){if(_0x379964){return _0xc6e256;}return db['SmsMessage']['create'](_[_0xb25c('0x57')](_0x498e43['body'],{'read':![],'body':_0x498e43[_0xb25c('0x59')][_0xb25c('0x59')],'phone':_0x459059,'SmsAccountId':_0x199616['id'],'SmsInteractionId':_0xc6e256['id'],'UserId':_0x498e43[_0xb25c('0x5a')]['id'],'ContactId':_0x17cf13['id']}))[_0xb25c('0x1f')](function(_0x377f55){_0xc6e256[_0xb25c('0xce')][_0xb25c('0xcf')]=[];_0xc6e256[_0xb25c('0xce')]['Messages'][_0xb25c('0xa4')](_0x377f55[_0xb25c('0xce')]);return _0xc6e256;});})[_0xb25c('0x1f')](respondWithResult(_0x4015d3,null))[_0xb25c('0x29')](handleError(_0x4015d3,null));};exports[_0xb25c('0x2b')]=function(_0x10fa3a,_0x211a5c,_0x496dd3){if(_0x10fa3a[_0xb25c('0x59')]['id']){delete _0x10fa3a[_0xb25c('0x59')]['id'];}var _0x1506b8,_0x22c29a,_0x1c561d;return db[_0xb25c('0x52')]['find']({'where':{'id':_0x10fa3a[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x211a5c,null))[_0xb25c('0x1f')](function(_0x2fd66f){if(_0x2fd66f){_0x1c561d=_0x2fd66f;logger[_0xb25c('0x23')](_0xb25c('0x24'),_0xb25c('0x2b'),'received\x20delivery\x20report\x20from',_0x2fd66f['type'],util['inspect'](_0x10fa3a[_0xb25c('0x59')],{'showHidden':![],'depth':null}));switch(_0x2fd66f[_0xb25c('0x41')]){case _0xb25c('0x83'):if(_0x10fa3a[_0xb25c('0x59')]['skebby_dispatch_id']&&_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x2b')]){_0x22c29a=_0x10fa3a['body'][_0xb25c('0x2b')];return db[_0xb25c('0xcd')][_0xb25c('0x5e')]({'where':{'messageId':_0x10fa3a[_0xb25c('0x59')]['skebby_dispatch_id']}});}break;case _0xb25c('0x85'):if(_0x10fa3a[_0xb25c('0x59')]['requestid']&&_0x10fa3a['body'][_0xb25c('0xd0')]){_0x22c29a=_0x10fa3a[_0xb25c('0x59')][_0xb25c('0xd0')];return db[_0xb25c('0xcd')][_0xb25c('0x5e')]({'where':{'messageId':_0x10fa3a[_0xb25c('0x59')][_0xb25c('0xd1')]}});}break;case _0xb25c('0x86'):if(_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x88')]&&_0x10fa3a[_0xb25c('0x59')][_0xb25c('0xd2')]){_0x22c29a=_0x10fa3a[_0xb25c('0x59')]['status_code'];return db['SmsMessage'][_0xb25c('0x5e')]({'where':{'messageId':_0x10fa3a['body'][_0xb25c('0x88')]}});}break;case _0xb25c('0x8b'):var _0x381635=_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x8c')][0x0];if(_0x381635[_0xb25c('0x87')]&&_0x381635[_0xb25c('0x2b')][_0xb25c('0xd3')]===_0xb25c('0xd4')){_0x22c29a=_0x381635[_0xb25c('0x2b')]['groupName'];return db[_0xb25c('0xcd')][_0xb25c('0x5e')]({'where':{'messageId':_0x381635['messageId']}});}break;case _0xb25c('0x8f'):if(_0x10fa3a['body'][_0xb25c('0x87')]&&_0x10fa3a['body'][_0xb25c('0x2b')]){_0x22c29a=_0x10fa3a['body'][_0xb25c('0x2b')];return db[_0xb25c('0xcd')]['find']({'where':{'messageId':_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x87')]}});}break;case _0xb25c('0x91'):if(_0x10fa3a['body'][0x0]['message']['id']){_0x22c29a=_0x10fa3a[_0xb25c('0x59')][0x0][_0xb25c('0x41')];return db[_0xb25c('0xcd')][_0xb25c('0x5e')]({'where':{'messageId':_0x10fa3a[_0xb25c('0x59')][0x0]['message']['id']}});}break;case _0xb25c('0x92'):if(_0x10fa3a[_0xb25c('0x59')]['redif']&&_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x2b')]){_0x22c29a=_0x10fa3a[_0xb25c('0x59')][_0xb25c('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x10fa3a['body']['redif']}});}break;}}})[_0xb25c('0x1f')](handleEntityNotFound(_0x211a5c,null))[_0xb25c('0x1f')](function(_0x528b2e){if(_0x528b2e){_0x1506b8=_0x528b2e;switch(_0x1c561d[_0xb25c('0x41')]){case _0xb25c('0x83'):if(_0x22c29a===_0xb25c('0xd4')){return _0x1506b8['update']({'read':!![]});}else{logger['error'](_0xb25c('0x24'),_0xb25c('0x2b'),'skebby',util[_0xb25c('0xd5')](_0x10fa3a[_0xb25c('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb25c('0x85'):if(_0x22c29a==='1'){return _0x1506b8[_0xb25c('0x34')]({'read':!![]});}else{logger[_0xb25c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb25c('0x83'),util[_0xb25c('0xd5')](_0x10fa3a['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x10fa3a[_0xb25c('0x59')][_0xb25c('0xd6')]&&_0x22c29a>=0xc8&&_0x22c29a<=0xce){return _0x1506b8[_0xb25c('0x34')]({'read':!![]});}else{logger[_0xb25c('0x25')](_0xb25c('0x24'),_0xb25c('0x2b'),_0xb25c('0x86'),util['inspect'](_0x10fa3a[_0xb25c('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb25c('0x8b'):var _0x2dce5f=_0x10fa3a['body'][_0xb25c('0x8c')][0x0];if(_0x2dce5f[_0xb25c('0x2b')]['groupName']===_0xb25c('0xd4')){return _0x1506b8['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb25c('0x2b'),_0xb25c('0x8b'),util[_0xb25c('0xd5')](_0x10fa3a['body'],{'showHidden':![],'depth':null}));}break;case _0xb25c('0x8f'):if(_0x22c29a==_0xb25c('0xd7')||_0x22c29a==_0xb25c('0xd8')){return _0x1506b8[_0xb25c('0x34')]({'read':!![]});}else{logger['error'](_0xb25c('0x24'),_0xb25c('0x2b'),'clickatell',util['inspect'](_0x10fa3a['body'],{'showHidden':![],'depth':null}));}break;case _0xb25c('0x91'):if(_0x22c29a==_0xb25c('0xd9')){return _0x1506b8[_0xb25c('0x34')]({'read':!![]});}else{logger[_0xb25c('0x25')](_0xb25c('0x24'),'status',_0xb25c('0x91'),util[_0xb25c('0xd5')](_0x10fa3a[_0xb25c('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb25c('0x92'):if(_0x22c29a===_0xb25c('0xda')||_0x22c29a==='ACCEPTD'){return _0x1506b8[_0xb25c('0x34')]({'read':!![]});}else{logger[_0xb25c('0x25')](_0xb25c('0x24'),_0xb25c('0x2b'),'intelepeer',util[_0xb25c('0xd5')](_0x10fa3a[_0xb25c('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1506b8;}})[_0xb25c('0x1f')](respondWithResult(_0x211a5c,null))[_0xb25c('0x29')](handleError(_0x211a5c,null));};exports['statusGet']=function(_0x248e42,_0x2c727a,_0x536186){var _0x1d05a8,_0x295cfb,_0x2fedd0;return db['SmsAccount']['find']({'where':{'id':_0x248e42[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x2c727a,null))[_0xb25c('0x1f')](function(_0x230d14){if(_0x230d14){_0x2fedd0=_0x230d14;logger[_0xb25c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb25c('0x2b'),_0xb25c('0xdb'),_0x230d14[_0xb25c('0x41')],util['inspect'](_0x248e42[_0xb25c('0x45')],{'showHidden':![],'depth':null}));switch(_0x230d14[_0xb25c('0x41')]){case _0xb25c('0x8d'):if(_0x248e42[_0xb25c('0x45')][_0xb25c('0xdc')]&&_0x248e42[_0xb25c('0x45')][_0xb25c('0xdd')]){_0x295cfb=_0x248e42['query'][_0xb25c('0xdd')];return db[_0xb25c('0xcd')][_0xb25c('0x5e')]({'where':{'messageId':_0x248e42[_0xb25c('0x45')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2c727a,null))[_0xb25c('0x1f')](function(_0x171028){if(_0x171028){_0x1d05a8=_0x171028;switch(_0x2fedd0[_0xb25c('0x41')]){case _0xb25c('0x8d'):if(_0x295cfb==='2'||_0x295cfb==='6'){return _0x1d05a8[_0xb25c('0x34')]({'read':!![]});}else{logger[_0xb25c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb25c('0x2b'),_0xb25c('0x8d'),util['inspect'](_0x248e42[_0xb25c('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1d05a8;}})[_0xb25c('0x1f')](respondWithResult(_0x2c727a,null))[_0xb25c('0x29')](handleError(_0x2c727a,null));};exports[_0xb25c('0xde')]=function(_0x5396d9,_0xf8c392,_0x147416){return db['SmsAccount'][_0xb25c('0x5e')]({'where':{'id':_0x5396d9[_0xb25c('0x56')]['id']}})['then'](handleEntityNotFound(_0xf8c392,null))[_0xb25c('0x1f')](function(_0x54a417){if(_0x54a417){return _0x54a417[_0xb25c('0xde')](_0x5396d9[_0xb25c('0x59')][_0xb25c('0x6b')],_[_0xb25c('0x9e')](_0x5396d9[_0xb25c('0x59')],['ids','id'])||{})['spread'](function(_0x5a499d){for(var _0x25f5bc=0x0;_0x25f5bc<_0x5396d9[_0xb25c('0x59')][_0xb25c('0x6b')][_0xb25c('0x4a')];_0x25f5bc+=0x1){socket[_0xb25c('0xdf')](_0xb25c('0xe0'),{'UserId':Number(_0x5396d9['body'][_0xb25c('0x6b')][_0x25f5bc]),'SmsAccountId':Number(_0x5396d9[_0xb25c('0x56')]['id'])});}return _0x5a499d;});}})['then'](respondWithResult(_0xf8c392,null))[_0xb25c('0x29')](handleError(_0xf8c392,null));};exports[_0xb25c('0xe1')]=function(_0x290114,_0x454ac1,_0x5e5d99){return db[_0xb25c('0x52')][_0xb25c('0x5e')]({'where':{'id':_0x290114[_0xb25c('0x56')]['id']}})[_0xb25c('0x1f')](handleEntityNotFound(_0x454ac1,null))[_0xb25c('0x1f')](function(_0x305fa8){if(_0x305fa8){return _0x305fa8['removeAgents'](_0x290114[_0xb25c('0x45')][_0xb25c('0x6b')])[_0xb25c('0x1f')](function(){if(_['isArray'](_0x290114['query'][_0xb25c('0x6b')])){for(var _0x1de98b=0x0;_0x1de98b<_0x290114[_0xb25c('0x45')]['ids'][_0xb25c('0x4a')];_0x1de98b+=0x1){socket[_0xb25c('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x290114[_0xb25c('0x45')]['ids'][_0x1de98b]),'SmsAccountId':Number(_0x290114[_0xb25c('0x56')]['id'])});}}else{socket[_0xb25c('0xdf')](_0xb25c('0xe2'),{'UserId':Number(_0x290114[_0xb25c('0x45')]['ids']),'SmsAccountId':Number(_0x290114[_0xb25c('0x56')]['id'])});}});}})[_0xb25c('0x1f')](respondWithStatusCode(_0x454ac1,null))[_0xb25c('0x29')](handleError(_0x454ac1,null));};exports[_0xb25c('0xe3')]=function(_0x557163,_0x4c9528,_0x237a8e){var _0x3faad4={};var _0x13e1a5={};var _0x98173d;var _0x5866b3;return db[_0xb25c('0x52')][_0xb25c('0x67')]({'where':{'id':_0x557163[_0xb25c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c9528,null))['then'](function(_0x17bebd){if(_0x17bebd){_0x98173d=_0x17bebd;_0x13e1a5[_0xb25c('0x43')]=_[_0xb25c('0x44')](db['User'][_0xb25c('0x3f')]);_0x13e1a5[_0xb25c('0x45')]=_[_0xb25c('0x44')](_0x557163[_0xb25c('0x45')]);_0x13e1a5[_0xb25c('0x46')]=_[_0xb25c('0x47')](_0x13e1a5[_0xb25c('0x43')],_0x13e1a5['query']);_0x3faad4[_0xb25c('0x48')]=_['intersection'](_0x13e1a5[_0xb25c('0x43')],qs[_0xb25c('0x49')](_0x557163[_0xb25c('0x45')][_0xb25c('0x49')]));_0x3faad4[_0xb25c('0x48')]=_0x3faad4[_0xb25c('0x48')][_0xb25c('0x4a')]?_0x3faad4[_0xb25c('0x48')]:_0x13e1a5[_0xb25c('0x43')];_0x3faad4[_0xb25c('0x4c')]=qs[_0xb25c('0x69')](_0x557163[_0xb25c('0x45')]['sort']);_0x3faad4[_0xb25c('0x4d')]=qs['filters'](_[_0xb25c('0x4e')](_0x557163[_0xb25c('0x45')],_0x13e1a5[_0xb25c('0x46')]));if(_0x557163[_0xb25c('0x45')][_0xb25c('0x4f')]){_0x3faad4[_0xb25c('0x4d')]=_[_0xb25c('0x57')](_0x3faad4['where'],{'$or':_[_0xb25c('0x3e')](_0x3faad4[_0xb25c('0x48')],function(_0x3737ac){var _0x29fd5e={};_0x29fd5e[_0x3737ac]={'$like':'%'+_0x557163[_0xb25c('0x45')][_0xb25c('0x4f')]+'%'};return _0x29fd5e;})});}_0x3faad4=_[_0xb25c('0x57')]({},_0x3faad4,_0x557163[_0xb25c('0x51')]);return _0x98173d[_0xb25c('0xe3')](_0x3faad4);}})['then'](function(_0x7cbf30){if(_0x7cbf30){_0x5866b3=_0x7cbf30[_0xb25c('0x4a')];if(!_0x557163[_0xb25c('0x45')][_0xb25c('0x4b')](_0xb25c('0x68'))){_0x3faad4[_0xb25c('0x2f')]=qs[_0xb25c('0x2f')](_0x557163['query']['limit']);_0x3faad4[_0xb25c('0x2d')]=qs[_0xb25c('0x2d')](_0x557163['query']['offset']);}return _0x98173d[_0xb25c('0xe3')](_0x3faad4);}})['then'](function(_0x3d4e3b){if(_0x3d4e3b){return _0x3d4e3b?{'count':_0x5866b3,'rows':_0x3d4e3b}:null;}})[_0xb25c('0x1f')](respondWithResult(_0x4c9528,null))[_0xb25c('0x29')](handleError(_0x4c9528,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 099af89..9e54a11 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 _0x9de3=['hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x4f1afe,_0x29a790){var _0x552767=function(_0x89caf1){while(--_0x89caf1){_0x4f1afe['push'](_0x4f1afe['shift']());}};_0x552767(++_0x29a790);}(_0x9de3,0x1b4));var _0x39de=function(_0x345985,_0x110e1c){_0x345985=_0x345985-0x0;var _0x293a9c=_0x9de3[_0x345985];return _0x293a9c;};'use strict';var EventEmitter=require(_0x39de('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x39de('0x1')](0x0);var events={'afterCreate':_0x39de('0x2'),'afterUpdate':_0x39de('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21e1f1){return function(_0x4b22a9,_0x2e9ad7,_0x1d4031){SmsAccountEvents[_0x39de('0x4')](_0x21e1f1+':'+_0x4b22a9['id'],_0x4b22a9);SmsAccountEvents[_0x39de('0x4')](_0x21e1f1,_0x4b22a9);_0x1d4031(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x39de('0x5')](e,emitEvent(event));}}module[_0x39de('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xcd7a=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0xfcee6f,_0x2993cc){var _0x2b5078=function(_0x344157){while(--_0x344157){_0xfcee6f['push'](_0xfcee6f['shift']());}};_0x2b5078(++_0x2993cc);}(_0xcd7a,0x115));var _0xacd7=function(_0x5291cf,_0x2f2a05){_0x5291cf=_0x5291cf-0x0;var _0x397487=_0xcd7a[_0x5291cf];return _0x397487;};'use strict';var EventEmitter=require(_0xacd7('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xacd7('0x1')](0x0);var events={'afterCreate':_0xacd7('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x34bfe8){return function(_0x1d8ac6,_0x2c3746,_0x382905){SmsAccountEvents[_0xacd7('0x3')](_0x34bfe8+':'+_0x1d8ac6['id'],_0x1d8ac6);SmsAccountEvents[_0xacd7('0x3')](_0x34bfe8,_0x1d8ac6);_0x382905(null);};}for(var e in events){if(events[_0xacd7('0x4')](e)){var event=events[e];SmsAccount[_0xacd7('0x5')](e,emitEvent(event));}}module[_0xacd7('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 479f250..8140147 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 _0x3670=['sms_accounts','util','api','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3670,0xe8));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0367('0x0'));var logger=require('../../config/logger')(_0x0367('0x1'));var moment=require('moment');var BPromise=require(_0x0367('0x2'));var rp=require(_0x0367('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0367('0x4'));var config=require(_0x0367('0x5'));var attributes=require(_0x0367('0x6'));module[_0x0367('0x7')]=function(_0x5dfc11,_0x37efc9){return _0x5dfc11[_0x0367('0x8')](_0x0367('0x9'),attributes,{'tableName':_0x0367('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92d7=['api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util'];(function(_0x100a35,_0x3d1535){var _0x461ff=function(_0x47f48d){while(--_0x47f48d){_0x100a35['push'](_0x100a35['shift']());}};_0x461ff(++_0x3d1535);}(_0x92d7,0x12a));var _0x792d=function(_0x28b60c,_0x29edf9){_0x28b60c=_0x28b60c-0x0;var _0x5d17aa=_0x92d7[_0x28b60c];return _0x5d17aa;};'use strict';var _=require(_0x792d('0x0'));var util=require(_0x792d('0x1'));var logger=require('../../config/logger')(_0x792d('0x2'));var moment=require(_0x792d('0x3'));var BPromise=require('bluebird');var rp=require(_0x792d('0x4'));var fs=require('fs');var path=require(_0x792d('0x5'));var rimraf=require(_0x792d('0x6'));var config=require(_0x792d('0x7'));var attributes=require(_0x792d('0x8'));module[_0x792d('0x9')]=function(_0x5bf0d1,_0x2bb464){return _0x5bf0d1[_0x792d('0xa')]('SmsAccount',attributes,{'tableName':_0x792d('0xb'),'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 cf46f5a..04c7aa9 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 _0x9c30=['message','catch','ShowSmsAccount','SmsAccount','options','raw','where','include','map','model','attributes','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsAccount.socket','register','request','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s'];(function(_0x21e499,_0x2808bf){var _0x89fcf3=function(_0x555007){while(--_0x555007){_0x21e499['push'](_0x21e499['shift']());}};_0x89fcf3(++_0x2808bf);}(_0x9c30,0x72));var _0x09c3=function(_0x3e012d,_0x1e3d7c){_0x3e012d=_0x3e012d-0x0;var _0x4d817a=_0x9c30[_0x3e012d];return _0x4d817a;};'use strict';var _=require(_0x09c3('0x0'));var util=require(_0x09c3('0x1'));var moment=require('moment');var BPromise=require(_0x09c3('0x2'));var rs=require(_0x09c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09c3('0x4'))['db'];var utils=require(_0x09c3('0x5'));var logger=require(_0x09c3('0x6'))(_0x09c3('0x7'));var config=require(_0x09c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x09c3('0x9')]['http']({'port':0x232a});config[_0x09c3('0xa')]=_[_0x09c3('0xb')](config['redis'],{'host':_0x09c3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x09c3('0xd'))[_0x09c3('0xe')](socket);function respondWithRpcPromise(_0x13b4a5,_0x307d7e,_0x4aa394){return new BPromise(function(_0x40da28,_0x163e3b){return client[_0x09c3('0xf')](_0x13b4a5,_0x4aa394)['then'](function(_0x8b4360){logger[_0x09c3('0x10')]('SmsAccount,\x20%s,\x20%s',_0x307d7e,_0x09c3('0x11'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x307d7e,_0x09c3('0x11'),JSON[_0x09c3('0x12')](_0x8b4360));if(_0x8b4360[_0x09c3('0x13')]){if(_0x8b4360[_0x09c3('0x13')][_0x09c3('0x14')]===0x1f4){logger[_0x09c3('0x13')](_0x09c3('0x15'),_0x307d7e,_0x8b4360[_0x09c3('0x13')][_0x09c3('0x16')]);return _0x163e3b(_0x8b4360[_0x09c3('0x13')][_0x09c3('0x16')]);}logger[_0x09c3('0x13')](_0x09c3('0x15'),_0x307d7e,_0x8b4360[_0x09c3('0x13')]['message']);return _0x40da28(_0x8b4360[_0x09c3('0x13')]['message']);}else{logger[_0x09c3('0x10')](_0x09c3('0x15'),_0x307d7e,_0x09c3('0x11'));_0x40da28(_0x8b4360['result']['message']);}})[_0x09c3('0x17')](function(_0x2e86a1){logger[_0x09c3('0x13')](_0x09c3('0x15'),_0x307d7e,_0x2e86a1);_0x163e3b(_0x2e86a1);});});}exports[_0x09c3('0x18')]=function(_0x25c5d5){var _0x42c98f=this;return new Promise(function(_0x4319c7,_0x4e0a14){return db[_0x09c3('0x19')]['find']({'raw':_0x25c5d5[_0x09c3('0x1a')]?_0x25c5d5['options'][_0x09c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c5d5['options']?_0x25c5d5[_0x09c3('0x1a')][_0x09c3('0x1c')]||null:null,'attributes':_0x25c5d5[_0x09c3('0x1a')]?_0x25c5d5[_0x09c3('0x1a')]['attributes']||null:null,'include':_0x25c5d5[_0x09c3('0x1a')]?_0x25c5d5[_0x09c3('0x1a')][_0x09c3('0x1d')]?_[_0x09c3('0x1e')](_0x25c5d5[_0x09c3('0x1a')][_0x09c3('0x1d')],function(_0x349594){return{'model':db[_0x349594[_0x09c3('0x1f')]],'as':_0x349594['as'],'attributes':_0x349594[_0x09c3('0x20')],'include':_0x349594[_0x09c3('0x1d')]?_[_0x09c3('0x1e')](_0x349594[_0x09c3('0x1d')],function(_0x11e781){return{'model':db[_0x11e781[_0x09c3('0x1f')]],'as':_0x11e781['as'],'attributes':_0x11e781[_0x09c3('0x20')],'include':_0x11e781[_0x09c3('0x1d')]?_[_0x09c3('0x1e')](_0x11e781[_0x09c3('0x1d')],function(_0x4f350b){return{'model':db[_0x4f350b[_0x09c3('0x1f')]],'as':_0x4f350b['as'],'attributes':_0x4f350b[_0x09c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43ac10){logger['info'](_0x09c3('0x18'),_0x25c5d5);logger[_0x09c3('0x21')](_0x09c3('0x18'),_0x25c5d5,JSON[_0x09c3('0x12')](_0x43ac10));_0x4319c7(_0x43ac10);})[_0x09c3('0x17')](function(_0x591bf1){logger['error']('ShowSmsAccount',_0x591bf1[_0x09c3('0x16')],_0x25c5d5);_0x4e0a14(_0x42c98f[_0x09c3('0x13')](0x1f4,_0x591bf1[_0x09c3('0x16')]));});});}; \ No newline at end of file +var _0x66a1=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','then','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x179aa3,_0x3d9834){var _0x17f429=function(_0x23601a){while(--_0x23601a){_0x179aa3['push'](_0x179aa3['shift']());}};_0x17f429(++_0x3d9834);}(_0x66a1,0xf7));var _0x166a=function(_0x5c4f88,_0x1c383e){_0x5c4f88=_0x5c4f88-0x0;var _0x5bab8c=_0x66a1[_0x5c4f88];return _0x5bab8c;};'use strict';var _=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var moment=require(_0x166a('0x2'));var BPromise=require(_0x166a('0x3'));var rs=require(_0x166a('0x4'));var fs=require('fs');var Redis=require(_0x166a('0x5'));var db=require(_0x166a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x166a('0x7'));var jayson=require(_0x166a('0x8'));var client=jayson[_0x166a('0x9')][_0x166a('0xa')]({'port':0x232a});config[_0x166a('0xb')]=_[_0x166a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x166a('0xd'))(new Redis(config[_0x166a('0xb')]));require('./smsAccount.socket')[_0x166a('0xe')](socket);function respondWithRpcPromise(_0x5e2c4b,_0x46cfa9,_0x4a8602){return new BPromise(function(_0x2cd981,_0x5f361b){return client['request'](_0x5e2c4b,_0x4a8602)['then'](function(_0x1903d7){logger[_0x166a('0xf')](_0x166a('0x10'),_0x46cfa9,_0x166a('0x11'));logger[_0x166a('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x46cfa9,_0x166a('0x11'),JSON[_0x166a('0x13')](_0x1903d7));if(_0x1903d7[_0x166a('0x14')]){if(_0x1903d7['error'][_0x166a('0x15')]===0x1f4){logger[_0x166a('0x14')](_0x166a('0x10'),_0x46cfa9,_0x1903d7[_0x166a('0x14')][_0x166a('0x16')]);return _0x5f361b(_0x1903d7[_0x166a('0x14')][_0x166a('0x16')]);}logger[_0x166a('0x14')]('SmsAccount,\x20%s,\x20%s',_0x46cfa9,_0x1903d7['error'][_0x166a('0x16')]);return _0x2cd981(_0x1903d7[_0x166a('0x14')][_0x166a('0x16')]);}else{logger[_0x166a('0xf')]('SmsAccount,\x20%s,\x20%s',_0x46cfa9,_0x166a('0x11'));_0x2cd981(_0x1903d7[_0x166a('0x17')]['message']);}})['catch'](function(_0x467035){logger['error']('SmsAccount,\x20%s,\x20%s',_0x46cfa9,_0x467035);_0x5f361b(_0x467035);});});}exports[_0x166a('0x18')]=function(_0x3d3551){var _0xd948dc=this;return new Promise(function(_0x5e52ce,_0x3c8ade){return db[_0x166a('0x19')][_0x166a('0x1a')]({'raw':_0x3d3551['options']?_0x3d3551[_0x166a('0x1b')][_0x166a('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d3551[_0x166a('0x1b')]?_0x3d3551['options'][_0x166a('0x1d')]||null:null,'attributes':_0x3d3551[_0x166a('0x1b')]?_0x3d3551[_0x166a('0x1b')][_0x166a('0x1e')]||null:null,'include':_0x3d3551[_0x166a('0x1b')]?_0x3d3551['options']['include']?_[_0x166a('0x1f')](_0x3d3551[_0x166a('0x1b')][_0x166a('0x20')],function(_0x370156){return{'model':db[_0x370156[_0x166a('0x21')]],'as':_0x370156['as'],'attributes':_0x370156['attributes'],'include':_0x370156[_0x166a('0x20')]?_['map'](_0x370156['include'],function(_0x29a584){return{'model':db[_0x29a584[_0x166a('0x21')]],'as':_0x29a584['as'],'attributes':_0x29a584[_0x166a('0x1e')],'include':_0x29a584['include']?_[_0x166a('0x1f')](_0x29a584[_0x166a('0x20')],function(_0x3cc3c9){return{'model':db[_0x3cc3c9['model']],'as':_0x3cc3c9['as'],'attributes':_0x3cc3c9[_0x166a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x166a('0x22')](function(_0x34560b){logger[_0x166a('0xf')](_0x166a('0x18'),_0x3d3551);logger[_0x166a('0x12')]('ShowSmsAccount',_0x3d3551,JSON['stringify'](_0x34560b));_0x5e52ce(_0x34560b);})[_0x166a('0x23')](function(_0xcf25f7){logger[_0x166a('0x14')](_0x166a('0x18'),_0xcf25f7[_0x166a('0x16')],_0x3d3551);_0x3c8ade(_0xd948dc[_0x166a('0x14')](0x1f4,_0xcf25f7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3cae97e..661ac0e 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 eff2904..9a4819c 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(_0x5065a5,_0x4e44d5){var _0x512ea2=function(_0x368bc6){while(--_0x368bc6){_0x5065a5['push'](_0x5065a5['shift']());}};_0x512ea2(++_0x4e44d5);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x407bda,_0x3eb10d){var _0x3da9e7=function(_0x4918bf){while(--_0x4918bf){_0x407bda['push'](_0x407bda['shift']());}};_0x3da9e7(++_0x3eb10d);}(_0xedd9,0xfc));var _0x9edd=function(_0x5526fc,_0x50cb07){_0x5526fc=_0x5526fc-0x0;var _0x3a36a4=_0xedd9[_0x5526fc];return _0x3a36a4;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 54e8e7e..188851d 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 _0x3c6f=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x3c6f,0x134));var _0xf3c6=function(_0x405bf0,_0x39c267){_0x405bf0=_0x405bf0-0x0;var _0x425404=_0x3c6f[_0x405bf0];return _0x425404;};'use strict';var Sequelize=require(_0xf3c6('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf3c6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf3c6('0x2')],'allowNull':![],'defaultValue':_0xf3c6('0x3')},'appdata':{'type':Sequelize[_0xf3c6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf3c6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3a8d=['sequelize','INTEGER','STRING','noop'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x3a8d,0x150));var _0xd3a8=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x3a8d[_0x13187a];return _0x65b85f;};'use strict';var Sequelize=require(_0xd3a8('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd3a8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd3a8('0x2')],'allowNull':![],'defaultValue':_0xd3a8('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd3a8('0x2')]},'interval':{'type':Sequelize[_0xd3a8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index ee3188e..e409a86 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 _0x7597=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x487e23,_0x13f518){var _0x34504c=function(_0x1d2f7b){while(--_0x1d2f7b){_0x487e23['push'](_0x487e23['shift']());}};_0x34504c(++_0x13f518);}(_0x7597,0x80));var _0x7759=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x7597[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7759('0x0'));var jsonpatch=require(_0x7759('0x1'));var rp=require(_0x7759('0x2'));var moment=require(_0x7759('0x3'));var BPromise=require(_0x7759('0x4'));var Mustache=require('mustache');var util=require(_0x7759('0x5'));var path=require(_0x7759('0x6'));var sox=require(_0x7759('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7759('0x8'));var _=require(_0x7759('0x9'));var squel=require('squel');var crypto=require(_0x7759('0xa'));var jsforce=require(_0x7759('0xb'));var deskjs=require(_0x7759('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7759('0xd'));var Redis=require(_0x7759('0xe'));var authService=require(_0x7759('0xf'));var qs=require(_0x7759('0x10'));var as=require(_0x7759('0x11'));var hardwareService=require(_0x7759('0x12'));var logger=require('../../config/logger')(_0x7759('0x13'));var utils=require(_0x7759('0x14'));var config=require(_0x7759('0x15'));var licenseUtil=require(_0x7759('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409a2b,_0x4ec4ec){_0x4ec4ec=_0x4ec4ec||0xcc;return function(_0x328cab){if(_0x328cab){return _0x409a2b[_0x7759('0x17')](_0x4ec4ec);}return _0x409a2b['status'](_0x4ec4ec)['end']();};}function respondWithResult(_0xad8d7c,_0x545bbc){_0x545bbc=_0x545bbc||0xc8;return function(_0x4519c4){if(_0x4519c4){return _0xad8d7c[_0x7759('0x18')](_0x545bbc)['json'](_0x4519c4);}};}function respondWithFilteredResult(_0x4c2a82,_0x39c86d){return function(_0x168320){if(_0x168320){var _0x12adea=typeof _0x39c86d[_0x7759('0x19')]===_0x7759('0x1a')&&typeof _0x39c86d[_0x7759('0x1b')]===_0x7759('0x1a');var _0x253b89=_0x168320[_0x7759('0x1c')];var _0x4a5a27=_0x12adea?0x0:_0x39c86d[_0x7759('0x19')];var _0x4c54c8=_0x12adea?_0x168320[_0x7759('0x1c')]:_0x39c86d[_0x7759('0x19')]+_0x39c86d['limit'];var _0xf1519b;if(_0x4c54c8>=_0x253b89){_0x4c54c8=_0x253b89;_0xf1519b=0xc8;}else{_0xf1519b=0xce;}_0x4c2a82[_0x7759('0x18')](_0xf1519b);return _0x4c2a82[_0x7759('0x1d')]('Content-Range',_0x4a5a27+'-'+_0x4c54c8+'/'+_0x253b89)[_0x7759('0x1e')](_0x168320);}return null;};}function patchUpdates(_0x2d28a){return function(_0x5d6cc4){try{jsonpatch[_0x7759('0x1f')](_0x5d6cc4,_0x2d28a,!![]);}catch(_0x25a344){return BPromise[_0x7759('0x20')](_0x25a344);}return _0x5d6cc4[_0x7759('0x21')]();};}function saveUpdates(_0x566b53,_0x20aa25){return function(_0x2e5cbe){if(_0x2e5cbe){return _0x2e5cbe['update'](_0x566b53)[_0x7759('0x22')](function(_0x19a705){return _0x19a705;});}return null;};}function removeEntity(_0x2c9df4,_0x451c11){return function(_0x10d464){if(_0x10d464){return _0x10d464[_0x7759('0x23')]()['then'](function(){_0x2c9df4[_0x7759('0x18')](0xcc)[_0x7759('0x24')]();});}};}function handleEntityNotFound(_0x1d7567,_0x261e72){return function(_0x5ecf6e){if(!_0x5ecf6e){_0x1d7567[_0x7759('0x17')](0x194);}return _0x5ecf6e;};}function handleError(_0x411f8b,_0xfc14d5){_0xfc14d5=_0xfc14d5||0x1f4;return function(_0x4bf25a){logger[_0x7759('0x25')](_0x4bf25a[_0x7759('0x26')]);if(_0x4bf25a[_0x7759('0x27')]){delete _0x4bf25a[_0x7759('0x27')];}_0x411f8b[_0x7759('0x18')](_0xfc14d5)[_0x7759('0x28')](_0x4bf25a);};}exports[_0x7759('0x29')]=function(_0x1d1ae6,_0xd8233e){var _0x518ca7={},_0x61d748={},_0x55b25d={'count':0x0,'rows':[]};var _0x10f411=_[_0x7759('0x2a')](db[_0x7759('0x2b')][_0x7759('0x2c')],function(_0x1fbb2a){return{'name':_0x1fbb2a[_0x7759('0x2d')],'type':_0x1fbb2a['type'][_0x7759('0x2e')]};});_0x61d748[_0x7759('0x2f')]=_['map'](_0x10f411,_0x7759('0x27'));_0x61d748[_0x7759('0x30')]=_[_0x7759('0x31')](_0x1d1ae6['query']);_0x61d748[_0x7759('0x32')]=_[_0x7759('0x33')](_0x61d748[_0x7759('0x2f')],_0x61d748[_0x7759('0x30')]);_0x518ca7[_0x7759('0x34')]=_[_0x7759('0x33')](_0x61d748[_0x7759('0x2f')],qs[_0x7759('0x35')](_0x1d1ae6['query'][_0x7759('0x35')]));_0x518ca7[_0x7759('0x34')]=_0x518ca7[_0x7759('0x34')]['length']?_0x518ca7[_0x7759('0x34')]:_0x61d748[_0x7759('0x2f')];if(!_0x1d1ae6[_0x7759('0x30')][_0x7759('0x36')](_0x7759('0x37'))){_0x518ca7['limit']=qs[_0x7759('0x1b')](_0x1d1ae6[_0x7759('0x30')][_0x7759('0x1b')]);_0x518ca7['offset']=qs[_0x7759('0x19')](_0x1d1ae6[_0x7759('0x30')][_0x7759('0x19')]);}_0x518ca7[_0x7759('0x38')]=qs[_0x7759('0x39')](_0x1d1ae6[_0x7759('0x30')][_0x7759('0x39')]);_0x518ca7[_0x7759('0x3a')]=qs['filters'](_['pick'](_0x1d1ae6[_0x7759('0x30')],_0x61d748['filters']),_0x10f411);if(_0x1d1ae6[_0x7759('0x30')][_0x7759('0x3b')]){_0x518ca7[_0x7759('0x3a')]=_[_0x7759('0x3c')](_0x518ca7[_0x7759('0x3a')],{'$or':_['map'](_0x10f411,function(_0x4e8695){if(_0x4e8695[_0x7759('0x3d')]!==_0x7759('0x3e')){var _0x3b325c={};_0x3b325c[_0x4e8695['name']]={'$like':'%'+_0x1d1ae6['query'][_0x7759('0x3b')]+'%'};return _0x3b325c;}})});}_0x518ca7=_[_0x7759('0x3c')]({},_0x518ca7,_0x1d1ae6[_0x7759('0x3f')]);var _0x19dabf={'where':_0x518ca7[_0x7759('0x3a')]};return db[_0x7759('0x2b')][_0x7759('0x1c')](_0x19dabf)[_0x7759('0x22')](function(_0x545334){_0x55b25d['count']=_0x545334;if(_0x1d1ae6[_0x7759('0x30')][_0x7759('0x40')]){_0x518ca7[_0x7759('0x41')]=[{'all':!![]}];}return db[_0x7759('0x2b')][_0x7759('0x42')](_0x518ca7);})[_0x7759('0x22')](function(_0x107dd3){_0x55b25d['rows']=_0x107dd3;return _0x55b25d;})[_0x7759('0x22')](respondWithFilteredResult(_0xd8233e,_0x518ca7))[_0x7759('0x43')](handleError(_0xd8233e,null));};exports[_0x7759('0x44')]=function(_0x2accbe,_0x62d771){var _0x4f301f={'raw':!![],'where':{'id':_0x2accbe[_0x7759('0x45')]['id']}},_0x1f4d9e={};_0x1f4d9e[_0x7759('0x2f')]=_['keys'](db[_0x7759('0x2b')][_0x7759('0x2c')]);_0x1f4d9e[_0x7759('0x30')]=_[_0x7759('0x31')](_0x2accbe['query']);_0x1f4d9e[_0x7759('0x32')]=_['intersection'](_0x1f4d9e['model'],_0x1f4d9e[_0x7759('0x30')]);_0x4f301f[_0x7759('0x34')]=_[_0x7759('0x33')](_0x1f4d9e['model'],qs['fields'](_0x2accbe[_0x7759('0x30')][_0x7759('0x35')]));_0x4f301f[_0x7759('0x34')]=_0x4f301f[_0x7759('0x34')][_0x7759('0x46')]?_0x4f301f[_0x7759('0x34')]:_0x1f4d9e[_0x7759('0x2f')];if(_0x2accbe[_0x7759('0x30')][_0x7759('0x40')]){_0x4f301f['include']=[{'all':!![]}];}_0x4f301f=_[_0x7759('0x3c')]({},_0x4f301f,_0x2accbe[_0x7759('0x3f')]);return db[_0x7759('0x2b')][_0x7759('0x47')](_0x4f301f)[_0x7759('0x22')](handleEntityNotFound(_0x62d771,null))[_0x7759('0x22')](respondWithResult(_0x62d771,null))[_0x7759('0x43')](handleError(_0x62d771,null));};exports[_0x7759('0x48')]=function(_0x10b50b,_0x2443ee){return db[_0x7759('0x2b')][_0x7759('0x48')](_0x10b50b[_0x7759('0x49')],{})[_0x7759('0x22')](respondWithResult(_0x2443ee,0xc9))[_0x7759('0x43')](handleError(_0x2443ee,null));};exports['update']=function(_0x257693,_0x2173a2){if(_0x257693['body']['id']){delete _0x257693[_0x7759('0x49')]['id'];}return db[_0x7759('0x2b')][_0x7759('0x47')]({'where':{'id':_0x257693['params']['id']}})['then'](handleEntityNotFound(_0x2173a2,null))['then'](saveUpdates(_0x257693['body'],null))[_0x7759('0x22')](respondWithResult(_0x2173a2,null))['catch'](handleError(_0x2173a2,null));};exports[_0x7759('0x23')]=function(_0x360a0d,_0x22bce6){return db['SmsApplication'][_0x7759('0x47')]({'where':{'id':_0x360a0d[_0x7759('0x45')]['id']}})[_0x7759('0x22')](handleEntityNotFound(_0x22bce6,null))['then'](removeEntity(_0x22bce6,null))[_0x7759('0x43')](handleError(_0x22bce6,null));}; \ No newline at end of file +var _0xf9d5=['rawAttributes','key','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','show','keys','fields','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','SmsApplication'];(function(_0x4d43e9,_0x2c54ec){var _0x3651c2=function(_0x13ffe8){while(--_0x13ffe8){_0x4d43e9['push'](_0x4d43e9['shift']());}};_0x3651c2(++_0x2c54ec);}(_0xf9d5,0x1ed));var _0x5f9d=function(_0x2c1306,_0xc71d09){_0x2c1306=_0x2c1306-0x0;var _0x111393=_0xf9d5[_0x2c1306];return _0x111393;};'use strict';var emlformat=require(_0x5f9d('0x0'));var rimraf=require(_0x5f9d('0x1'));var zipdir=require(_0x5f9d('0x2'));var jsonpatch=require(_0x5f9d('0x3'));var rp=require(_0x5f9d('0x4'));var moment=require(_0x5f9d('0x5'));var BPromise=require(_0x5f9d('0x6'));var Mustache=require('mustache');var util=require(_0x5f9d('0x7'));var path=require(_0x5f9d('0x8'));var sox=require(_0x5f9d('0x9'));var csv=require(_0x5f9d('0xa'));var ejs=require(_0x5f9d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xc'));var squel=require(_0x5f9d('0xd'));var crypto=require(_0x5f9d('0xe'));var jsforce=require(_0x5f9d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f9d('0xa'));var querystring=require(_0x5f9d('0x10'));var Papa=require(_0x5f9d('0x11'));var Redis=require('ioredis');var authService=require(_0x5f9d('0x12'));var qs=require(_0x5f9d('0x13'));var as=require(_0x5f9d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f9d('0x15'))(_0x5f9d('0x16'));var utils=require(_0x5f9d('0x17'));var config=require(_0x5f9d('0x18'));var licenseUtil=require(_0x5f9d('0x19'));var db=require(_0x5f9d('0x1a'))['db'];function respondWithStatusCode(_0x5d5875,_0x4eed58){_0x4eed58=_0x4eed58||0xcc;return function(_0x1956a1){if(_0x1956a1){return _0x5d5875['sendStatus'](_0x4eed58);}return _0x5d5875[_0x5f9d('0x1b')](_0x4eed58)[_0x5f9d('0x1c')]();};}function respondWithResult(_0x4e5649,_0x2a4b22){_0x2a4b22=_0x2a4b22||0xc8;return function(_0xb30f3){if(_0xb30f3){return _0x4e5649[_0x5f9d('0x1b')](_0x2a4b22)[_0x5f9d('0x1d')](_0xb30f3);}};}function respondWithFilteredResult(_0x581736,_0xde633e){return function(_0x8046fa){if(_0x8046fa){var _0x1ad56b=typeof _0xde633e[_0x5f9d('0x1e')]==='undefined'&&typeof _0xde633e[_0x5f9d('0x1f')]===_0x5f9d('0x20');var _0xb7e863=_0x8046fa[_0x5f9d('0x21')];var _0x439127=_0x1ad56b?0x0:_0xde633e['offset'];var _0x2eb4d=_0x1ad56b?_0x8046fa['count']:_0xde633e['offset']+_0xde633e['limit'];var _0x3993fd;if(_0x2eb4d>=_0xb7e863){_0x2eb4d=_0xb7e863;_0x3993fd=0xc8;}else{_0x3993fd=0xce;}_0x581736[_0x5f9d('0x1b')](_0x3993fd);return _0x581736['set'](_0x5f9d('0x22'),_0x439127+'-'+_0x2eb4d+'/'+_0xb7e863)['json'](_0x8046fa);}return null;};}function patchUpdates(_0x22bce6){return function(_0x572415){try{jsonpatch[_0x5f9d('0x23')](_0x572415,_0x22bce6,!![]);}catch(_0x143bb5){return BPromise[_0x5f9d('0x24')](_0x143bb5);}return _0x572415[_0x5f9d('0x25')]();};}function saveUpdates(_0x57d606,_0xb23504){return function(_0x5a4e63){if(_0x5a4e63){return _0x5a4e63[_0x5f9d('0x26')](_0x57d606)[_0x5f9d('0x27')](function(_0x349a51){return _0x349a51;});}return null;};}function removeEntity(_0x5f009b,_0x3b30da){return function(_0x2be8ff){if(_0x2be8ff){return _0x2be8ff[_0x5f9d('0x28')]()[_0x5f9d('0x27')](function(){_0x5f009b[_0x5f9d('0x1b')](0xcc)[_0x5f9d('0x1c')]();});}};}function handleEntityNotFound(_0x113151,_0x1973c1){return function(_0x5ccc32){if(!_0x5ccc32){_0x113151[_0x5f9d('0x29')](0x194);}return _0x5ccc32;};}function handleError(_0x1f5188,_0x3465df){_0x3465df=_0x3465df||0x1f4;return function(_0x4dc559){logger['error'](_0x4dc559[_0x5f9d('0x2a')]);if(_0x4dc559[_0x5f9d('0x2b')]){delete _0x4dc559['name'];}_0x1f5188[_0x5f9d('0x1b')](_0x3465df)[_0x5f9d('0x2c')](_0x4dc559);};}exports['index']=function(_0x39ae42,_0x216eb4){var _0x295481={},_0xab05bf={},_0x585209={'count':0x0,'rows':[]};var _0x1c147b=_['map'](db[_0x5f9d('0x2d')][_0x5f9d('0x2e')],function(_0x4e1f9b){return{'name':_0x4e1f9b['fieldName'],'type':_0x4e1f9b['type'][_0x5f9d('0x2f')]};});_0xab05bf[_0x5f9d('0x30')]=_[_0x5f9d('0x31')](_0x1c147b,_0x5f9d('0x2b'));_0xab05bf[_0x5f9d('0x32')]=_['keys'](_0x39ae42['query']);_0xab05bf['filters']=_[_0x5f9d('0x33')](_0xab05bf[_0x5f9d('0x30')],_0xab05bf['query']);_0x295481[_0x5f9d('0x34')]=_[_0x5f9d('0x33')](_0xab05bf['model'],qs['fields'](_0x39ae42[_0x5f9d('0x32')]['fields']));_0x295481['attributes']=_0x295481[_0x5f9d('0x34')][_0x5f9d('0x35')]?_0x295481['attributes']:_0xab05bf[_0x5f9d('0x30')];if(!_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x36')](_0x5f9d('0x37'))){_0x295481[_0x5f9d('0x1f')]=qs[_0x5f9d('0x1f')](_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x1f')]);_0x295481[_0x5f9d('0x1e')]=qs['offset'](_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x1e')]);}_0x295481[_0x5f9d('0x38')]=qs['sort'](_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x39')]);_0x295481[_0x5f9d('0x3a')]=qs[_0x5f9d('0x3b')](_[_0x5f9d('0x3c')](_0x39ae42[_0x5f9d('0x32')],_0xab05bf['filters']),_0x1c147b);if(_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x3d')]){_0x295481['where']=_['merge'](_0x295481[_0x5f9d('0x3a')],{'$or':_['map'](_0x1c147b,function(_0x44b840){if(_0x44b840[_0x5f9d('0x3e')]!==_0x5f9d('0x3f')){var _0x63793a={};_0x63793a[_0x44b840[_0x5f9d('0x2b')]]={'$like':'%'+_0x39ae42[_0x5f9d('0x32')]['filter']+'%'};return _0x63793a;}})});}_0x295481=_[_0x5f9d('0x40')]({},_0x295481,_0x39ae42[_0x5f9d('0x41')]);var _0xb049a={'where':_0x295481['where']};return db[_0x5f9d('0x2d')][_0x5f9d('0x21')](_0xb049a)[_0x5f9d('0x27')](function(_0x110a33){_0x585209[_0x5f9d('0x21')]=_0x110a33;if(_0x39ae42[_0x5f9d('0x32')][_0x5f9d('0x42')]){_0x295481['include']=[{'all':!![]}];}return db[_0x5f9d('0x2d')]['findAll'](_0x295481);})[_0x5f9d('0x27')](function(_0x2c891b){_0x585209[_0x5f9d('0x43')]=_0x2c891b;return _0x585209;})[_0x5f9d('0x27')](respondWithFilteredResult(_0x216eb4,_0x295481))['catch'](handleError(_0x216eb4,null));};exports[_0x5f9d('0x44')]=function(_0x453a8b,_0x818e4f){var _0x423838={'raw':!![],'where':{'id':_0x453a8b['params']['id']}},_0x8e4d54={};_0x8e4d54[_0x5f9d('0x30')]=_[_0x5f9d('0x45')](db[_0x5f9d('0x2d')][_0x5f9d('0x2e')]);_0x8e4d54[_0x5f9d('0x32')]=_[_0x5f9d('0x45')](_0x453a8b['query']);_0x8e4d54[_0x5f9d('0x3b')]=_['intersection'](_0x8e4d54[_0x5f9d('0x30')],_0x8e4d54[_0x5f9d('0x32')]);_0x423838['attributes']=_[_0x5f9d('0x33')](_0x8e4d54[_0x5f9d('0x30')],qs['fields'](_0x453a8b[_0x5f9d('0x32')][_0x5f9d('0x46')]));_0x423838['attributes']=_0x423838[_0x5f9d('0x34')][_0x5f9d('0x35')]?_0x423838[_0x5f9d('0x34')]:_0x8e4d54['model'];if(_0x453a8b[_0x5f9d('0x32')][_0x5f9d('0x42')]){_0x423838[_0x5f9d('0x47')]=[{'all':!![]}];}_0x423838=_[_0x5f9d('0x40')]({},_0x423838,_0x453a8b[_0x5f9d('0x41')]);return db[_0x5f9d('0x2d')][_0x5f9d('0x48')](_0x423838)[_0x5f9d('0x27')](handleEntityNotFound(_0x818e4f,null))['then'](respondWithResult(_0x818e4f,null))[_0x5f9d('0x49')](handleError(_0x818e4f,null));};exports['create']=function(_0x18155f,_0x25d4f9){return db['SmsApplication'][_0x5f9d('0x4a')](_0x18155f[_0x5f9d('0x4b')],{})[_0x5f9d('0x27')](respondWithResult(_0x25d4f9,0xc9))[_0x5f9d('0x49')](handleError(_0x25d4f9,null));};exports[_0x5f9d('0x26')]=function(_0x49c0bc,_0xc477a7){if(_0x49c0bc[_0x5f9d('0x4b')]['id']){delete _0x49c0bc[_0x5f9d('0x4b')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x49c0bc['params']['id']}})[_0x5f9d('0x27')](handleEntityNotFound(_0xc477a7,null))[_0x5f9d('0x27')](saveUpdates(_0x49c0bc[_0x5f9d('0x4b')],null))['then'](respondWithResult(_0xc477a7,null))[_0x5f9d('0x49')](handleError(_0xc477a7,null));};exports[_0x5f9d('0x28')]=function(_0x36f55d,_0x48b4fd){return db[_0x5f9d('0x2d')][_0x5f9d('0x48')]({'where':{'id':_0x36f55d[_0x5f9d('0x4c')]['id']}})[_0x5f9d('0x27')](handleEntityNotFound(_0x48b4fd,null))[_0x5f9d('0x27')](removeEntity(_0x48b4fd,null))[_0x5f9d('0x49')](handleError(_0x48b4fd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f0f06a8..81935d7 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 _0xba62=['exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x3e50e3,_0x3b42d1){var _0x4cc11d=function(_0x28ce7d){while(--_0x28ce7d){_0x3e50e3['push'](_0x3e50e3['shift']());}};_0x4cc11d(++_0x3b42d1);}(_0xba62,0x12b));var _0x2ba6=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xba62[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0x2ba6('0x0'));var util=require(_0x2ba6('0x1'));var logger=require('../../config/logger')(_0x2ba6('0x2'));var moment=require('moment');var BPromise=require(_0x2ba6('0x3'));var rp=require(_0x2ba6('0x4'));var fs=require('fs');var path=require(_0x2ba6('0x5'));var rimraf=require(_0x2ba6('0x6'));var config=require(_0x2ba6('0x7'));var attributes=require(_0x2ba6('0x8'));module[_0x2ba6('0x9')]=function(_0x8fa936,_0x4d7ec7){return _0x8fa936[_0x2ba6('0xa')]('SmsApplication',attributes,{'tableName':_0x2ba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ba6('0xc'),'collate':_0x2ba6('0xd')});}; \ No newline at end of file +var _0xd689=['exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','./smsApplication.attributes'];(function(_0x41655e,_0x4715ac){var _0x4fdcc1=function(_0x518e49){while(--_0x518e49){_0x41655e['push'](_0x41655e['shift']());}};_0x4fdcc1(++_0x4715ac);}(_0xd689,0x1cd));var _0x9d68=function(_0x4d3941,_0x5b0bc0){_0x4d3941=_0x4d3941-0x0;var _0x5c311b=_0xd689[_0x4d3941];return _0x5c311b;};'use strict';var _=require(_0x9d68('0x0'));var util=require(_0x9d68('0x1'));var logger=require('../../config/logger')(_0x9d68('0x2'));var moment=require('moment');var BPromise=require(_0x9d68('0x3'));var rp=require(_0x9d68('0x4'));var fs=require('fs');var path=require(_0x9d68('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d68('0x6'));module[_0x9d68('0x7')]=function(_0x58ebd6,_0x492239){return _0x58ebd6[_0x9d68('0x8')]('SmsApplication',attributes,{'tableName':_0x9d68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d68('0xa'),'collate':_0x9d68('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a6d8bd6..18c3789 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 _0xd08d=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x117b43,_0x583a8c){var _0x567469=function(_0x125a90){while(--_0x125a90){_0x117b43['push'](_0x117b43['shift']());}};_0x567469(++_0x583a8c);}(_0xd08d,0x81));var _0xdd08=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xd08d[_0x3207aa];return _0x51758f;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var moment=require(_0xdd08('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd08('0x2'));var fs=require('fs');var Redis=require(_0xdd08('0x3'));var db=require(_0xdd08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd08('0x5'))(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd08('0x8')][_0xdd08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13999f,_0x28d59c,_0x147a23){return new BPromise(function(_0x54a5a3,_0x15416b){return client[_0xdd08('0xa')](_0x13999f,_0x147a23)[_0xdd08('0xb')](function(_0x51ce97){logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));logger[_0xdd08('0xf')](_0xdd08('0x10'),_0x28d59c,_0xdd08('0xe'),JSON[_0xdd08('0x11')](_0x51ce97));if(_0x51ce97[_0xdd08('0x12')]){if(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x13')]===0x1f4){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97['error'][_0xdd08('0x14')]);return _0x15416b(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);return _0x54a5a3(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}else{logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));_0x54a5a3(_0x51ce97[_0xdd08('0x15')][_0xdd08('0x14')]);}})[_0xdd08('0x16')](function(_0x278f5e){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x278f5e);_0x15416b(_0x278f5e);});});} \ No newline at end of file +var _0x9a2a=['request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x514223,_0x4c522b){var _0x937b69=function(_0x51706c){while(--_0x51706c){_0x514223['push'](_0x514223['shift']());}};_0x937b69(++_0x4c522b);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x3afb73,_0xaa578f){_0x3afb73=_0x3afb73-0x0;var _0x5165f2=_0x9a2a[_0x3afb73];return _0x5165f2;};'use strict';var _=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var moment=require(_0xa9a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9a2('0x3'))['db'];var utils=require(_0xa9a2('0x4'));var logger=require(_0xa9a2('0x5'))(_0xa9a2('0x6'));var config=require(_0xa9a2('0x7'));var jayson=require(_0xa9a2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388689,_0xb51739,_0xedae90){return new BPromise(function(_0x287343,_0xcd2750){return client[_0xa9a2('0x9')](_0x388689,_0xedae90)[_0xa9a2('0xa')](function(_0x26f1ce){logger[_0xa9a2('0xb')]('SmsApplication,\x20%s,\x20%s',_0xb51739,_0xa9a2('0xc'));logger[_0xa9a2('0xd')](_0xa9a2('0xe'),_0xb51739,_0xa9a2('0xc'),JSON[_0xa9a2('0xf')](_0x26f1ce));if(_0x26f1ce[_0xa9a2('0x10')]){if(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x11')]===0x1f4){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce['error'][_0xa9a2('0x13')]);return _0xcd2750(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);return _0x287343(_0x26f1ce[_0xa9a2('0x10')][_0xa9a2('0x13')]);}else{logger[_0xa9a2('0xb')](_0xa9a2('0x12'),_0xb51739,_0xa9a2('0xc'));_0x287343(_0x26f1ce[_0xa9a2('0x14')]['message']);}})[_0xa9a2('0x15')](function(_0xbb6546){logger[_0xa9a2('0x10')](_0xa9a2('0x12'),_0xb51739,_0xbb6546);_0xcd2750(_0xbb6546);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c781d34..0d39d8e 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x37aed4,_0x254b7d){var _0x1ec4f3=function(_0x2fcefc){while(--_0x2fcefc){_0x37aed4['push'](_0x37aed4['shift']());}};_0x1ec4f3(++_0x254b7d);}(_0x80ed,0x11c));var _0xd80e=function(_0x13d306,_0x4333fc){_0x13d306=_0x13d306-0x0;var _0x3bf445=_0x80ed[_0x13d306];return _0x3bf445;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x5ce277,_0x578e02){var _0x479a74=function(_0x3bc150){while(--_0x3bc150){_0x5ce277['push'](_0x5ce277['shift']());}};_0x479a74(++_0x578e02);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d97447b..81fb5e7 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 _0x9c9b=['STRING','out','ENUM','INTEGER','moment','exports','BOOLEAN','DATE'];(function(_0x5e822d,_0x19b2b3){var _0x7ad508=function(_0x474038){while(--_0x474038){_0x5e822d['push'](_0x5e822d['shift']());}};_0x7ad508(++_0x19b2b3);}(_0x9c9b,0x194));var _0xb9c9=function(_0x4e1d70,_0xaf1df8){_0x4e1d70=_0x4e1d70-0x0;var _0x427db1=_0x9c9b[_0x4e1d70];return _0x427db1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb9c9('0x0'));module[_0xb9c9('0x1')]={'closed':{'type':Sequelize[_0xb9c9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb9c9('0x3')]},'disposition':{'type':Sequelize[_0xb9c9('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb9c9('0x4')]},'note':{'type':Sequelize[_0xb9c9('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb9c9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb9c9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb9c9('0x6')]('in',_0xb9c9('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb9c9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb9c9('0x7')]}}; \ No newline at end of file +var _0x97e6=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4f3410,_0x5a5127){var _0x520fdd=function(_0x9abddb){while(--_0x9abddb){_0x4f3410['push'](_0x4f3410['shift']());}};_0x520fdd(++_0x5a5127);}(_0x97e6,0x159));var _0x697e=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x97e6[_0x575057];return _0x49dbc8;};'use strict';var Sequelize=require(_0x697e('0x0'));var moment=require('moment');module[_0x697e('0x1')]={'closed':{'type':Sequelize[_0x697e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x697e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x697e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x697e('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x697e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x697e('0x5')]('in',_0x697e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x697e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x697e('0x5')]('in',_0x697e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x697e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b61d44f..532bdce 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 _0x2d66=['fullname','push','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','YYYY-MM-DD\x20HH:mm:ss','out','System','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','findAll','query','user','catch','show','model','keys','SmsInteraction','filters','attributes','fields','length','includeAll','merge','options','find','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','split','format','include','rows','addTags','spread','Tag','color','emit','removeTags','download','unix','toString','server','tmp','join','transcript-%d-%s.zip','User'];(function(_0x4abb45,_0x3a597e){var _0x3cb80f=function(_0x11f500){while(--_0x11f500){_0x4abb45['push'](_0x4abb45['shift']());}};_0x3cb80f(++_0x3a597e);}(_0x2d66,0x18c));var _0x62d6=function(_0x1b7f95,_0x4bdec0){_0x1b7f95=_0x1b7f95-0x0;var _0x2b5559=_0x2d66[_0x1b7f95];return _0x2b5559;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x62d6('0x0'));var moment=require(_0x62d6('0x1'));var BPromise=require(_0x62d6('0x2'));var util=require('util');var path=require(_0x62d6('0x3'));var ejs=require(_0x62d6('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x62d6('0x5'));var interaction=require(_0x62d6('0x6'));var qs=require(_0x62d6('0x7'));var pdf=require(_0x62d6('0x8'));var logger=require('../../config/logger')(_0x62d6('0x9'));var config=require('../../config/environment');var db=require(_0x62d6('0xa'))['db'];config[_0x62d6('0xb')]=_[_0x62d6('0xc')](config[_0x62d6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x62d6('0xd'))(new Redis(config[_0x62d6('0xb')]));require(_0x62d6('0xe'))[_0x62d6('0xf')](socket);function respondWithStatusCode(_0x1a3560,_0x25899b){_0x25899b=_0x25899b||0xcc;return function(_0x445ae0){if(_0x445ae0){return _0x1a3560[_0x62d6('0x10')](_0x25899b);}return _0x1a3560[_0x62d6('0x11')](_0x25899b)['end']();};}function respondWithResult(_0x18853a,_0xcb677){_0xcb677=_0xcb677||0xc8;return function(_0x39f1be){if(_0x39f1be){return _0x18853a[_0x62d6('0x11')](_0xcb677)[_0x62d6('0x12')](_0x39f1be);}};}function respondWithFilteredResult(_0x316684,_0xb0aea4){return function(_0x54923a){if(_0x54923a){var _0x383ad4=typeof _0xb0aea4[_0x62d6('0x13')]===_0x62d6('0x14')&&typeof _0xb0aea4['limit']===_0x62d6('0x14');var _0x2e02f1=_0x54923a[_0x62d6('0x15')];var _0x309ccb=_0x383ad4?0x0:_0xb0aea4[_0x62d6('0x13')];var _0x1af65a=_0x383ad4?_0x54923a[_0x62d6('0x15')]:_0xb0aea4[_0x62d6('0x13')]+_0xb0aea4['limit'];var _0x27de2f;if(_0x1af65a>=_0x2e02f1){_0x1af65a=_0x2e02f1;_0x27de2f=0xc8;}else{_0x27de2f=0xce;}_0x316684[_0x62d6('0x11')](_0x27de2f);return _0x316684[_0x62d6('0x16')]('Content-Range',_0x309ccb+'-'+_0x1af65a+'/'+_0x2e02f1)[_0x62d6('0x12')](_0x54923a);}return null;};}function saveUpdates(_0x53c804){return function(_0x32da07){if(_0x32da07){return _0x32da07[_0x62d6('0x17')](_0x53c804)[_0x62d6('0x18')](function(_0x4c3f4f){return _0x4c3f4f;});}return null;};}function removeEntity(_0x34fd47){return function(_0x3442fe){if(_0x3442fe){return _0x3442fe[_0x62d6('0x19')]()['then'](function(){_0x34fd47[_0x62d6('0x11')](0xcc)[_0x62d6('0x1a')]();});}};}function handleEntityNotFound(_0x11147d){return function(_0x59b0bd){if(!_0x59b0bd){_0x11147d[_0x62d6('0x10')](0x194);}return _0x59b0bd;};}function handleError(_0x6d1678,_0x287aa5){_0x287aa5=_0x287aa5||0x1f4;return function(_0x25897a){logger[_0x62d6('0x1b')](_0x25897a['stack']);if(_0x25897a[_0x62d6('0x1c')]){delete _0x25897a[_0x62d6('0x1c')];}_0x6d1678[_0x62d6('0x11')](_0x287aa5)[_0x62d6('0x1d')](_0x25897a);};}exports[_0x62d6('0x1e')]=function(_0x1c2460,_0x3e1e10){var _0x3eb850={};var _0x108b8c=_['map'](db['SmsInteraction'][_0x62d6('0x1f')],function(_0x222df9){return{'name':_0x222df9[_0x62d6('0x20')],'type':_0x222df9[_0x62d6('0x21')]['key']};});_0x3eb850=qs['getOptions'](_0x108b8c,_0x1c2460);return interaction[_0x62d6('0x22')]('sms',_0x1c2460[_0x62d6('0x23')],_0x1c2460[_0x62d6('0x24')],_0x3eb850,_0x108b8c)[_0x62d6('0x18')](respondWithFilteredResult(_0x3e1e10,_0x3eb850))[_0x62d6('0x25')](handleError(_0x3e1e10,null));};exports[_0x62d6('0x26')]=function(_0x2609e8,_0x3329ad){var _0x2704e4={'raw':![],'where':{'id':_0x2609e8['params']['id']}},_0x516f6d={};_0x516f6d[_0x62d6('0x27')]=_[_0x62d6('0x28')](db[_0x62d6('0x29')][_0x62d6('0x1f')]);_0x516f6d['query']=_[_0x62d6('0x28')](_0x2609e8['query']);_0x516f6d[_0x62d6('0x2a')]=_['intersection'](_0x516f6d['model'],_0x516f6d['query']);_0x2704e4[_0x62d6('0x2b')]=_['intersection'](_0x516f6d[_0x62d6('0x27')],qs['fields'](_0x2609e8[_0x62d6('0x23')][_0x62d6('0x2c')]));_0x2704e4['attributes']=_0x2704e4['attributes'][_0x62d6('0x2d')]?_0x2704e4[_0x62d6('0x2b')]:_0x516f6d[_0x62d6('0x27')];if(_0x2609e8[_0x62d6('0x23')][_0x62d6('0x2e')]){_0x2704e4['include']=[{'all':!![]}];}_0x2704e4=_[_0x62d6('0x2f')]({},_0x2704e4,_0x2609e8[_0x62d6('0x30')]);return db[_0x62d6('0x29')][_0x62d6('0x31')](_0x2704e4)[_0x62d6('0x18')](handleEntityNotFound(_0x3329ad,null))[_0x62d6('0x18')](respondWithResult(_0x3329ad,null))['catch'](handleError(_0x3329ad,null));};exports[_0x62d6('0x32')]=function(_0x259f5f,_0x276769){return db[_0x62d6('0x29')]['create'](_0x259f5f[_0x62d6('0x33')],{})['then'](respondWithResult(_0x276769,0xc9))[_0x62d6('0x25')](handleError(_0x276769,null));};exports['update']=function(_0x3fb6d6,_0x2f9f02){if(_0x3fb6d6[_0x62d6('0x33')]['id']){delete _0x3fb6d6[_0x62d6('0x33')]['id'];}return db[_0x62d6('0x29')][_0x62d6('0x31')]({'where':{'id':_0x3fb6d6[_0x62d6('0x34')]['id']}})['then'](handleEntityNotFound(_0x2f9f02,null))[_0x62d6('0x18')](saveUpdates(_0x3fb6d6[_0x62d6('0x33')],null))[_0x62d6('0x18')](respondWithResult(_0x2f9f02,null))[_0x62d6('0x25')](handleError(_0x2f9f02,null));};exports[_0x62d6('0x19')]=function(_0x3281ee,_0x488f21){return db[_0x62d6('0x29')][_0x62d6('0x31')]({'where':{'id':_0x3281ee[_0x62d6('0x34')]['id']}})[_0x62d6('0x18')](handleEntityNotFound(_0x488f21,null))[_0x62d6('0x18')](removeEntity(_0x488f21,null))[_0x62d6('0x25')](handleError(_0x488f21,null));};exports[_0x62d6('0x35')]=function(_0x49b5c1,_0x2d062c){return db[_0x62d6('0x29')][_0x62d6('0x35')]()[_0x62d6('0x18')](respondWithResult(_0x2d062c,null))[_0x62d6('0x25')](handleError(_0x2d062c,null));};exports[_0x62d6('0x36')]=function(_0x1c17a5,_0x467dd3){return db[_0x62d6('0x37')][_0x62d6('0x31')]({'where':{'id':_0x1c17a5[_0x62d6('0x34')]['id']}})[_0x62d6('0x18')](handleEntityNotFound(_0x467dd3,null))[_0x62d6('0x18')](function(_0x2db263){if(_0x2db263){return _0x2db263[_0x62d6('0x36')](_0x1c17a5[_0x62d6('0x33')][_0x62d6('0x38')],_[_0x62d6('0x39')](_0x1c17a5[_0x62d6('0x33')],[_0x62d6('0x38'),'id'])||{});}})['then'](respondWithResult(_0x467dd3,null))['catch'](handleError(_0x467dd3,null));};exports[_0x62d6('0x3a')]=function(_0x55e14b,_0x1f7279){var _0x478fd9={'raw':![],'where':{}};var _0xc8eac8={};var _0x4e74a3={'count':0x0,'rows':[]};return db[_0x62d6('0x29')][_0x62d6('0x3b')]({'where':{'id':_0x55e14b['params']['id']}})[_0x62d6('0x18')](handleEntityNotFound(_0x1f7279,null))[_0x62d6('0x18')](function(_0x2e9e29){if(_0x2e9e29){_0xc8eac8['model']=_['keys'](db[_0x62d6('0x37')]['rawAttributes']);_0xc8eac8[_0x62d6('0x23')]=_['keys'](_0x55e14b['query']);_0xc8eac8[_0x62d6('0x2a')]=_['intersection'](_0xc8eac8[_0x62d6('0x27')],_0xc8eac8['query']);_0x478fd9[_0x62d6('0x2b')]=_[_0x62d6('0x3c')](_0xc8eac8[_0x62d6('0x27')],qs[_0x62d6('0x2c')](_0x55e14b['query'][_0x62d6('0x2c')]));_0x478fd9[_0x62d6('0x2b')]=_0x478fd9[_0x62d6('0x2b')][_0x62d6('0x2d')]?_0x478fd9[_0x62d6('0x2b')]:_0xc8eac8['model'];if(!_0x55e14b[_0x62d6('0x23')][_0x62d6('0x3d')](_0x62d6('0x3e'))){_0x478fd9[_0x62d6('0x3f')]=qs['limit'](_0x55e14b['query']['limit']);_0x478fd9[_0x62d6('0x13')]=qs[_0x62d6('0x13')](_0x55e14b['query'][_0x62d6('0x13')]);}_0x478fd9[_0x62d6('0x40')]=qs[_0x62d6('0x41')](_0x55e14b[_0x62d6('0x23')][_0x62d6('0x41')]);_0x478fd9[_0x62d6('0x42')]=qs[_0x62d6('0x2a')](_[_0x62d6('0x43')](_0x55e14b[_0x62d6('0x23')],_0xc8eac8[_0x62d6('0x2a')]));_0x478fd9[_0x62d6('0x42')]['SmsInteractionId']=_0x2e9e29['id'];if(_0x55e14b['query'][_0x62d6('0x44')]){_0x478fd9[_0x62d6('0x42')]=_[_0x62d6('0x2f')](_0x478fd9[_0x62d6('0x42')],{'$or':_[_0x62d6('0x45')](_0x478fd9['attributes'],function(_0xb2d6a1){var _0x298add={};_0x298add[_0xb2d6a1]={'$like':'%'+_0x55e14b[_0x62d6('0x23')][_0x62d6('0x44')]+'%'};return _0x298add;})});}if(_0x55e14b[_0x62d6('0x23')]['$gte']){var _0x656fe8=_0x55e14b[_0x62d6('0x23')]['$gte'][_0x62d6('0x46')](',');var _0x1c3d3b={};_0x1c3d3b[_0x656fe8[0x0]]={'$gte':moment(_0x656fe8[0x1])[_0x62d6('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x478fd9[_0x62d6('0x42')]=_[_0x62d6('0x2f')](_0x478fd9['where'],_0x1c3d3b);}_0x478fd9=_['merge']({},_0x478fd9,_0x55e14b[_0x62d6('0x30')]);return db['SmsMessage'][_0x62d6('0x15')]({'where':_0x478fd9['where']})[_0x62d6('0x18')](function(_0xd75c46){_0x4e74a3[_0x62d6('0x15')]=_0xd75c46;if(_0x55e14b[_0x62d6('0x23')]['includeAll']){_0x478fd9[_0x62d6('0x48')]=[{'all':!![]}];}return db[_0x62d6('0x37')][_0x62d6('0x22')](_0x478fd9);})[_0x62d6('0x18')](function(_0x142b65){_0x4e74a3[_0x62d6('0x49')]=_0x142b65;return _0x4e74a3;});}})[_0x62d6('0x18')](respondWithFilteredResult(_0x1f7279,_0x478fd9))[_0x62d6('0x25')](handleError(_0x1f7279,null));};exports[_0x62d6('0x4a')]=function(_0x3279d8,_0x5d7fa8){return db[_0x62d6('0x29')][_0x62d6('0x31')]({'where':{'id':_0x3279d8['params']['id']}})[_0x62d6('0x18')](handleEntityNotFound(_0x5d7fa8,null))['then'](function(_0x41fc92){if(_0x41fc92){return _0x41fc92['setTags'](_0x3279d8[_0x62d6('0x33')]['ids'],_[_0x62d6('0x39')](_0x3279d8['body'],[_0x62d6('0x38'),'id'])||{})[_0x62d6('0x4b')](function(){return db[_0x62d6('0x4c')][_0x62d6('0x22')]({'attributes':['id','name',_0x62d6('0x4d')],'where':{'id':_0x3279d8[_0x62d6('0x33')][_0x62d6('0x38')]}});})[_0x62d6('0x18')](function(_0x283186){socket[_0x62d6('0x4e')]('smsInteractionTags:save',{'id':Number(_0x3279d8[_0x62d6('0x34')]['id']),'tags':_0x283186||[]});return{'id':Number(_0x3279d8[_0x62d6('0x34')]['id']),'tags':_0x283186||[]};});}})['then'](respondWithResult(_0x5d7fa8,null))[_0x62d6('0x25')](handleError(_0x5d7fa8,null));};exports[_0x62d6('0x4f')]=function(_0x25f971,_0x281adf){return db['SmsInteraction'][_0x62d6('0x31')]({'where':{'id':_0x25f971['params']['id']}})[_0x62d6('0x18')](handleEntityNotFound(_0x281adf,null))[_0x62d6('0x18')](function(_0x129425){if(_0x129425){return _0x129425[_0x62d6('0x4f')](_0x25f971[_0x62d6('0x23')][_0x62d6('0x38')]);}})['then'](respondWithStatusCode(_0x281adf,null))[_0x62d6('0x25')](handleError(_0x281adf,null));};exports[_0x62d6('0x50')]=function(_0x482531,_0x1e38f8){var _0x161177=moment()[_0x62d6('0x51')]()[_0x62d6('0x52')]();var _0x3a8838=path['join'](config['root'],_0x62d6('0x53'),'files',_0x62d6('0x54'));var _0x5b0075=path[_0x62d6('0x55')](_0x3a8838,_0x161177);var _0x5a29d8=util[_0x62d6('0x47')](_0x62d6('0x56'),_0x482531[_0x62d6('0x34')]['id'],_0x161177);var _0x37718c=path[_0x62d6('0x55')](_0x3a8838,_0x5a29d8);var _0x20f5c2=[];_0x20f5c2['push']({'model':db['User'],'as':_0x62d6('0x57'),'attributes':['id',_0x62d6('0x58')],'raw':!![]});_0x20f5c2[_0x62d6('0x59')]({'model':db['CmContact'],'as':_0x62d6('0x5a'),'attributes':['id',_0x62d6('0x5b'),_0x62d6('0x5c')],'raw':!![]});var _0x4913a9=[{'model':db[_0x62d6('0x37')],'as':_0x62d6('0x5d'),'attributes':['id',_0x62d6('0x33'),_0x62d6('0x5e'),_0x62d6('0x5f'),_0x62d6('0x60'),_0x62d6('0x61')],'include':_0x20f5c2}];_0x4913a9[_0x62d6('0x59')]({'model':db['SmsAccount'],'as':_0x62d6('0x62'),'attributes':['id','name']});_0x4913a9[_0x62d6('0x59')]({'model':db[_0x62d6('0x57')],'as':_0x62d6('0x63'),'attributes':['id',_0x62d6('0x58')]});return db[_0x62d6('0x29')][_0x62d6('0x31')]({'where':{'id':_0x482531[_0x62d6('0x34')]['id']},'include':_0x4913a9})[_0x62d6('0x18')](handleEntityNotFound(_0x1e38f8,null))[_0x62d6('0x18')](function(_0x2874bd){if(_0x2874bd){var _0x34037a=_0x2874bd[_0x62d6('0x64')]({'plain':!![]});fs[_0x62d6('0x65')](_0x5b0075);var _0x41ea73={'channel':'Sms','account':_0x34037a['Account'][_0x62d6('0x1c')],'agent':_0x34037a['Owner']?_0x34037a[_0x62d6('0x63')][_0x62d6('0x58')]:_0x62d6('0x66'),'createdAt':moment(_0x34037a['createdAt'])[_0x62d6('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x62d6('0x52')](),'closedAt':_0x34037a[_0x62d6('0x67')]?moment(_0x34037a[_0x62d6('0x68')])[_0x62d6('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x62d6('0x52')]():'','disposition':_0x34037a[_0x62d6('0x69')],'messages':_(_0x34037a['Messages'])[_0x62d6('0x44')]({'secret':![]})[_0x62d6('0x45')](function(_0x4cce57){return{'date':moment(_0x4cce57[_0x62d6('0x5e')])[_0x62d6('0x47')](_0x62d6('0x6a'))['toString'](),'sender':_0x4cce57[_0x62d6('0x5f')]===_0x62d6('0x6b')?_0x4cce57[_0x62d6('0x57')]?_0x4cce57['User']['fullname']:_0x62d6('0x6c'):_0x4cce57['Contact']['firstName']+(_0x4cce57[_0x62d6('0x5a')][_0x62d6('0x5c')]?'\x20'+_0x4cce57['Contact'][_0x62d6('0x5c')]:''),'body':_0x4cce57[_0x62d6('0x33')],'direction':_0x4cce57['direction']===_0x62d6('0x6b')?'A':'C','secret':_0x4cce57['secret'],'read':_0x4cce57[_0x62d6('0x61')]};})[_0x62d6('0x6d')]()};return ejs[_0x62d6('0x6e')](path[_0x62d6('0x55')](config[_0x62d6('0x6f')],_0x62d6('0x53'),_0x62d6('0x70'),_0x62d6('0x71')),{'interaction':_0x41ea73})[_0x62d6('0x18')](function(_0x103ead){var _0x2aea67=path[_0x62d6('0x55')](_0x5b0075,_0x62d6('0x72')+_0x34037a['id']+'-'+_0x161177+_0x62d6('0x73'));var _0x115168={'path':_0x2aea67,'channel':_0x62d6('0x74'),'interactionId':_0x34037a['id']};return pdf[_0x62d6('0x75')](_0x103ead,_0x115168);})[_0x62d6('0x18')](function(){return new BPromise(function(_0x9175a3,_0x10d137){zipdir(_0x5b0075,{'saveTo':_0x37718c},function(_0x2cbe40,_0x4de257){if(_0x2cbe40)return _0x10d137(_0x2cbe40);return _0x9175a3(_0x4de257);});})[_0x62d6('0x18')](function(){return new BPromise(function(_0x4b1f80,_0x2f8d42){rimraf(_0x5b0075,function(_0x314d92){if(_0x314d92)_0x2f8d42(_0x314d92);return _0x4b1f80();});});})['then'](function(){return _0x1e38f8[_0x62d6('0x50')](_0x37718c,_0x5a29d8,function(_0x199731){if(_0x199731){console[_0x62d6('0x76')](_0x62d6('0x77'),_0x199731);}else{fs[_0x62d6('0x78')](_0x37718c);}});});});}else{return _0x1e38f8['sendStatus'](0xc8);}})[_0x62d6('0x25')](handleError(_0x1e38f8,null));}; \ No newline at end of file +var _0x0c73=['Owner','get','Sms','N.A.','closed','closedAt','disposition','filter','direction','out','System','value','root','views','downloadInteraction.ejs','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','user','then','catch','show','model','keys','intersection','attributes','fields','include','merge','options','create','body','params','find','addMessage','SmsMessage','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','Account'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x0c73,0x18c));var _0x30c7=function(_0x3b2e7c,_0x500fbd){_0x3b2e7c=_0x3b2e7c-0x0;var _0x8e7679=_0x0c73[_0x3b2e7c];return _0x8e7679;};'use strict';var rimraf=require(_0x30c7('0x0'));var zipdir=require(_0x30c7('0x1'));var moment=require(_0x30c7('0x2'));var BPromise=require(_0x30c7('0x3'));var util=require(_0x30c7('0x4'));var path=require(_0x30c7('0x5'));var ejs=require(_0x30c7('0x6'));var fs=require('fs');var _=require(_0x30c7('0x7'));var Redis=require(_0x30c7('0x8'));var interaction=require(_0x30c7('0x9'));var qs=require(_0x30c7('0xa'));var pdf=require(_0x30c7('0xb'));var logger=require(_0x30c7('0xc'))('api');var config=require(_0x30c7('0xd'));var db=require(_0x30c7('0xe'))['db'];config[_0x30c7('0xf')]=_[_0x30c7('0x10')](config[_0x30c7('0xf')],{'host':_0x30c7('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x30c7('0x12'))[_0x30c7('0x13')](socket);function respondWithStatusCode(_0x1a91ad,_0x38cfbe){_0x38cfbe=_0x38cfbe||0xcc;return function(_0x283034){if(_0x283034){return _0x1a91ad[_0x30c7('0x14')](_0x38cfbe);}return _0x1a91ad[_0x30c7('0x15')](_0x38cfbe)[_0x30c7('0x16')]();};}function respondWithResult(_0x397961,_0xbc4811){_0xbc4811=_0xbc4811||0xc8;return function(_0x3f2393){if(_0x3f2393){return _0x397961[_0x30c7('0x15')](_0xbc4811)[_0x30c7('0x17')](_0x3f2393);}};}function respondWithFilteredResult(_0x3cbc8c,_0x46b73d){return function(_0x4811f7){if(_0x4811f7){var _0x36c866=typeof _0x46b73d[_0x30c7('0x18')]===_0x30c7('0x19')&&typeof _0x46b73d[_0x30c7('0x1a')]===_0x30c7('0x19');var _0x2bef12=_0x4811f7['count'];var _0x589814=_0x36c866?0x0:_0x46b73d['offset'];var _0x145181=_0x36c866?_0x4811f7[_0x30c7('0x1b')]:_0x46b73d[_0x30c7('0x18')]+_0x46b73d['limit'];var _0x35e4d0;if(_0x145181>=_0x2bef12){_0x145181=_0x2bef12;_0x35e4d0=0xc8;}else{_0x35e4d0=0xce;}_0x3cbc8c[_0x30c7('0x15')](_0x35e4d0);return _0x3cbc8c[_0x30c7('0x1c')](_0x30c7('0x1d'),_0x589814+'-'+_0x145181+'/'+_0x2bef12)[_0x30c7('0x17')](_0x4811f7);}return null;};}function saveUpdates(_0x1cdfc6){return function(_0x87131f){if(_0x87131f){return _0x87131f[_0x30c7('0x1e')](_0x1cdfc6)['then'](function(_0x354185){return _0x354185;});}return null;};}function removeEntity(_0xc4e2cd){return function(_0x45273e){if(_0x45273e){return _0x45273e[_0x30c7('0x1f')]()['then'](function(){_0xc4e2cd['status'](0xcc)[_0x30c7('0x16')]();});}};}function handleEntityNotFound(_0x1960b5){return function(_0x2d9cdc){if(!_0x2d9cdc){_0x1960b5[_0x30c7('0x14')](0x194);}return _0x2d9cdc;};}function handleError(_0x53c430,_0x351d4e){_0x351d4e=_0x351d4e||0x1f4;return function(_0x8934fc){logger[_0x30c7('0x20')](_0x8934fc[_0x30c7('0x21')]);if(_0x8934fc[_0x30c7('0x22')]){delete _0x8934fc[_0x30c7('0x22')];}_0x53c430['status'](_0x351d4e)[_0x30c7('0x23')](_0x8934fc);};}exports[_0x30c7('0x24')]=function(_0x24a496,_0x3aef6c){var _0xa1138f={};var _0x13f97b=_['map'](db[_0x30c7('0x25')][_0x30c7('0x26')],function(_0x219546){return{'name':_0x219546['fieldName'],'type':_0x219546[_0x30c7('0x27')]['key']};});_0xa1138f=qs[_0x30c7('0x28')](_0x13f97b,_0x24a496);return interaction[_0x30c7('0x29')](_0x30c7('0x2a'),_0x24a496[_0x30c7('0x2b')],_0x24a496[_0x30c7('0x2c')],_0xa1138f,_0x13f97b)[_0x30c7('0x2d')](respondWithFilteredResult(_0x3aef6c,_0xa1138f))[_0x30c7('0x2e')](handleError(_0x3aef6c,null));};exports[_0x30c7('0x2f')]=function(_0x51a215,_0x3df51e){var _0x11d412={'raw':![],'where':{'id':_0x51a215['params']['id']}},_0x5d7de2={};_0x5d7de2[_0x30c7('0x30')]=_[_0x30c7('0x31')](db[_0x30c7('0x25')]['rawAttributes']);_0x5d7de2[_0x30c7('0x2b')]=_[_0x30c7('0x31')](_0x51a215[_0x30c7('0x2b')]);_0x5d7de2['filters']=_[_0x30c7('0x32')](_0x5d7de2[_0x30c7('0x30')],_0x5d7de2['query']);_0x11d412[_0x30c7('0x33')]=_[_0x30c7('0x32')](_0x5d7de2[_0x30c7('0x30')],qs['fields'](_0x51a215[_0x30c7('0x2b')][_0x30c7('0x34')]));_0x11d412['attributes']=_0x11d412[_0x30c7('0x33')]['length']?_0x11d412[_0x30c7('0x33')]:_0x5d7de2[_0x30c7('0x30')];if(_0x51a215[_0x30c7('0x2b')]['includeAll']){_0x11d412[_0x30c7('0x35')]=[{'all':!![]}];}_0x11d412=_[_0x30c7('0x36')]({},_0x11d412,_0x51a215[_0x30c7('0x37')]);return db[_0x30c7('0x25')]['find'](_0x11d412)[_0x30c7('0x2d')](handleEntityNotFound(_0x3df51e,null))['then'](respondWithResult(_0x3df51e,null))[_0x30c7('0x2e')](handleError(_0x3df51e,null));};exports[_0x30c7('0x38')]=function(_0xe63bb3,_0x170fda){return db[_0x30c7('0x25')][_0x30c7('0x38')](_0xe63bb3[_0x30c7('0x39')],{})[_0x30c7('0x2d')](respondWithResult(_0x170fda,0xc9))['catch'](handleError(_0x170fda,null));};exports[_0x30c7('0x1e')]=function(_0x3cfc46,_0x4a6325){if(_0x3cfc46[_0x30c7('0x39')]['id']){delete _0x3cfc46[_0x30c7('0x39')]['id'];}return db[_0x30c7('0x25')]['find']({'where':{'id':_0x3cfc46[_0x30c7('0x3a')]['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x4a6325,null))[_0x30c7('0x2d')](saveUpdates(_0x3cfc46[_0x30c7('0x39')],null))[_0x30c7('0x2d')](respondWithResult(_0x4a6325,null))[_0x30c7('0x2e')](handleError(_0x4a6325,null));};exports[_0x30c7('0x1f')]=function(_0x303e24,_0x39fbc6){return db[_0x30c7('0x25')][_0x30c7('0x3b')]({'where':{'id':_0x303e24[_0x30c7('0x3a')]['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x39fbc6,null))[_0x30c7('0x2d')](removeEntity(_0x39fbc6,null))[_0x30c7('0x2e')](handleError(_0x39fbc6,null));};exports['describe']=function(_0x59690c,_0x54678c){return db['SmsInteraction']['describe']()[_0x30c7('0x2d')](respondWithResult(_0x54678c,null))[_0x30c7('0x2e')](handleError(_0x54678c,null));};exports[_0x30c7('0x3c')]=function(_0x49a0f2,_0x29b3de){return db[_0x30c7('0x3d')]['find']({'where':{'id':_0x49a0f2[_0x30c7('0x3a')]['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x29b3de,null))['then'](function(_0x2cdb67){if(_0x2cdb67){return _0x2cdb67['addMessage'](_0x49a0f2[_0x30c7('0x39')]['ids'],_['omit'](_0x49a0f2[_0x30c7('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x29b3de,null))['catch'](handleError(_0x29b3de,null));};exports[_0x30c7('0x3e')]=function(_0x29e8e4,_0x3e73ed){var _0x305e98={'raw':![],'where':{}};var _0x34f287={};var _0x1e0432={'count':0x0,'rows':[]};return db[_0x30c7('0x25')][_0x30c7('0x3f')]({'where':{'id':_0x29e8e4['params']['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x3e73ed,null))['then'](function(_0x41e29d){if(_0x41e29d){_0x34f287[_0x30c7('0x30')]=_[_0x30c7('0x31')](db[_0x30c7('0x3d')]['rawAttributes']);_0x34f287['query']=_['keys'](_0x29e8e4[_0x30c7('0x2b')]);_0x34f287[_0x30c7('0x40')]=_['intersection'](_0x34f287[_0x30c7('0x30')],_0x34f287[_0x30c7('0x2b')]);_0x305e98[_0x30c7('0x33')]=_[_0x30c7('0x32')](_0x34f287[_0x30c7('0x30')],qs['fields'](_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x34')]));_0x305e98[_0x30c7('0x33')]=_0x305e98['attributes'][_0x30c7('0x41')]?_0x305e98['attributes']:_0x34f287[_0x30c7('0x30')];if(!_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x42')](_0x30c7('0x43'))){_0x305e98[_0x30c7('0x1a')]=qs[_0x30c7('0x1a')](_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x1a')]);_0x305e98[_0x30c7('0x18')]=qs[_0x30c7('0x18')](_0x29e8e4[_0x30c7('0x2b')]['offset']);}_0x305e98[_0x30c7('0x44')]=qs['sort'](_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x45')]);_0x305e98[_0x30c7('0x46')]=qs[_0x30c7('0x40')](_['pick'](_0x29e8e4['query'],_0x34f287[_0x30c7('0x40')]));_0x305e98['where'][_0x30c7('0x47')]=_0x41e29d['id'];if(_0x29e8e4[_0x30c7('0x2b')]['filter']){_0x305e98[_0x30c7('0x46')]=_['merge'](_0x305e98['where'],{'$or':_[_0x30c7('0x48')](_0x305e98['attributes'],function(_0x360b73){var _0x22c1c9={};_0x22c1c9[_0x360b73]={'$like':'%'+_0x29e8e4['query']['filter']+'%'};return _0x22c1c9;})});}if(_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x49')]){var _0x3c3b8e=_0x29e8e4['query'][_0x30c7('0x49')][_0x30c7('0x4a')](',');var _0x2dd00d={};_0x2dd00d[_0x3c3b8e[0x0]]={'$gte':moment(_0x3c3b8e[0x1])[_0x30c7('0x4b')](_0x30c7('0x4c'))};_0x305e98[_0x30c7('0x46')]=_[_0x30c7('0x36')](_0x305e98['where'],_0x2dd00d);}_0x305e98=_[_0x30c7('0x36')]({},_0x305e98,_0x29e8e4[_0x30c7('0x37')]);return db[_0x30c7('0x3d')][_0x30c7('0x1b')]({'where':_0x305e98[_0x30c7('0x46')]})['then'](function(_0x5a9e2c){_0x1e0432['count']=_0x5a9e2c;if(_0x29e8e4[_0x30c7('0x2b')][_0x30c7('0x4d')]){_0x305e98[_0x30c7('0x35')]=[{'all':!![]}];}return db['SmsMessage'][_0x30c7('0x29')](_0x305e98);})[_0x30c7('0x2d')](function(_0x45d925){_0x1e0432[_0x30c7('0x4e')]=_0x45d925;return _0x1e0432;});}})['then'](respondWithFilteredResult(_0x3e73ed,_0x305e98))[_0x30c7('0x2e')](handleError(_0x3e73ed,null));};exports[_0x30c7('0x4f')]=function(_0x26b0ec,_0x34ccb6){return db[_0x30c7('0x25')][_0x30c7('0x3b')]({'where':{'id':_0x26b0ec[_0x30c7('0x3a')]['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x34ccb6,null))[_0x30c7('0x2d')](function(_0x5eb466){if(_0x5eb466){return _0x5eb466[_0x30c7('0x50')](_0x26b0ec['body'][_0x30c7('0x51')],_['omit'](_0x26b0ec[_0x30c7('0x39')],[_0x30c7('0x51'),'id'])||{})[_0x30c7('0x52')](function(){return db[_0x30c7('0x53')]['findAll']({'attributes':['id',_0x30c7('0x22'),_0x30c7('0x54')],'where':{'id':_0x26b0ec[_0x30c7('0x39')][_0x30c7('0x51')]}});})[_0x30c7('0x2d')](function(_0x1078ff){socket[_0x30c7('0x55')](_0x30c7('0x56'),{'id':Number(_0x26b0ec[_0x30c7('0x3a')]['id']),'tags':_0x1078ff||[]});return{'id':Number(_0x26b0ec[_0x30c7('0x3a')]['id']),'tags':_0x1078ff||[]};});}})[_0x30c7('0x2d')](respondWithResult(_0x34ccb6,null))['catch'](handleError(_0x34ccb6,null));};exports[_0x30c7('0x57')]=function(_0x284c61,_0x2a0578){return db[_0x30c7('0x25')]['find']({'where':{'id':_0x284c61[_0x30c7('0x3a')]['id']}})[_0x30c7('0x2d')](handleEntityNotFound(_0x2a0578,null))['then'](function(_0x53400f){if(_0x53400f){return _0x53400f[_0x30c7('0x57')](_0x284c61[_0x30c7('0x2b')][_0x30c7('0x51')]);}})['then'](respondWithStatusCode(_0x2a0578,null))[_0x30c7('0x2e')](handleError(_0x2a0578,null));};exports[_0x30c7('0x58')]=function(_0x34e662,_0x1f6b4c){var _0xd46ac3=moment()[_0x30c7('0x59')]()[_0x30c7('0x5a')]();var _0x33e747=path[_0x30c7('0x5b')](config['root'],_0x30c7('0x5c'),_0x30c7('0x5d'),_0x30c7('0x5e'));var _0x3c3172=path['join'](_0x33e747,_0xd46ac3);var _0x22085e=util[_0x30c7('0x4b')](_0x30c7('0x5f'),_0x34e662['params']['id'],_0xd46ac3);var _0x3a5d5a=path[_0x30c7('0x5b')](_0x33e747,_0x22085e);var _0x39df9f=[];_0x39df9f['push']({'model':db[_0x30c7('0x60')],'as':_0x30c7('0x60'),'attributes':['id',_0x30c7('0x61')],'raw':!![]});_0x39df9f[_0x30c7('0x62')]({'model':db[_0x30c7('0x63')],'as':_0x30c7('0x64'),'attributes':['id',_0x30c7('0x65'),_0x30c7('0x66')],'raw':!![]});var _0xe06810=[{'model':db[_0x30c7('0x3d')],'as':_0x30c7('0x67'),'attributes':['id',_0x30c7('0x39'),_0x30c7('0x68'),'direction',_0x30c7('0x69'),_0x30c7('0x6a')],'include':_0x39df9f}];_0xe06810[_0x30c7('0x62')]({'model':db['SmsAccount'],'as':_0x30c7('0x6b'),'attributes':['id',_0x30c7('0x22')]});_0xe06810[_0x30c7('0x62')]({'model':db[_0x30c7('0x60')],'as':_0x30c7('0x6c'),'attributes':['id','fullname']});return db[_0x30c7('0x25')][_0x30c7('0x3b')]({'where':{'id':_0x34e662['params']['id']},'include':_0xe06810})[_0x30c7('0x2d')](handleEntityNotFound(_0x1f6b4c,null))[_0x30c7('0x2d')](function(_0x2149ba){if(_0x2149ba){var _0x48dd9e=_0x2149ba[_0x30c7('0x6d')]({'plain':!![]});fs['mkdirSync'](_0x3c3172);var _0x2d3bd7={'channel':_0x30c7('0x6e'),'account':_0x48dd9e[_0x30c7('0x6b')][_0x30c7('0x22')],'agent':_0x48dd9e[_0x30c7('0x6c')]?_0x48dd9e[_0x30c7('0x6c')][_0x30c7('0x61')]:_0x30c7('0x6f'),'createdAt':moment(_0x48dd9e[_0x30c7('0x68')])[_0x30c7('0x4b')](_0x30c7('0x4c'))['toString'](),'closedAt':_0x48dd9e[_0x30c7('0x70')]?moment(_0x48dd9e[_0x30c7('0x71')])[_0x30c7('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x30c7('0x5a')]():'','disposition':_0x48dd9e[_0x30c7('0x72')],'messages':_(_0x48dd9e[_0x30c7('0x67')])[_0x30c7('0x73')]({'secret':![]})['map'](function(_0x3d4b59){return{'date':moment(_0x3d4b59[_0x30c7('0x68')])[_0x30c7('0x4b')](_0x30c7('0x4c'))[_0x30c7('0x5a')](),'sender':_0x3d4b59[_0x30c7('0x74')]===_0x30c7('0x75')?_0x3d4b59['User']?_0x3d4b59[_0x30c7('0x60')]['fullname']:_0x30c7('0x76'):_0x3d4b59[_0x30c7('0x64')][_0x30c7('0x65')]+(_0x3d4b59['Contact']['lastName']?'\x20'+_0x3d4b59[_0x30c7('0x64')][_0x30c7('0x66')]:''),'body':_0x3d4b59[_0x30c7('0x39')],'direction':_0x3d4b59[_0x30c7('0x74')]===_0x30c7('0x75')?'A':'C','secret':_0x3d4b59[_0x30c7('0x69')],'read':_0x3d4b59['read']};})[_0x30c7('0x77')]()};return ejs['renderFile'](path[_0x30c7('0x5b')](config[_0x30c7('0x78')],_0x30c7('0x5c'),_0x30c7('0x79'),_0x30c7('0x7a')),{'interaction':_0x2d3bd7})[_0x30c7('0x2d')](function(_0x1d86d8){var _0x5eebe3=path[_0x30c7('0x5b')](_0x3c3172,'transcript-'+_0x48dd9e['id']+'-'+_0xd46ac3+_0x30c7('0x7b'));var _0x1ed200={'path':_0x5eebe3,'channel':_0x30c7('0x6e'),'interactionId':_0x48dd9e['id']};return pdf['createPdfFromHTML'](_0x1d86d8,_0x1ed200);})[_0x30c7('0x2d')](function(){return new BPromise(function(_0x365404,_0x2d87ce){zipdir(_0x3c3172,{'saveTo':_0x3a5d5a},function(_0xe12553,_0x2e75f5){if(_0xe12553)return _0x2d87ce(_0xe12553);return _0x365404(_0x2e75f5);});})[_0x30c7('0x2d')](function(){return new BPromise(function(_0xa4bb01,_0x5cecb5){rimraf(_0x3c3172,function(_0x82f2a4){if(_0x82f2a4)_0x5cecb5(_0x82f2a4);return _0xa4bb01();});});})[_0x30c7('0x2d')](function(){return _0x1f6b4c[_0x30c7('0x58')](_0x3a5d5a,_0x22085e,function(_0x3883a3){if(_0x3883a3){console['log'](_0x30c7('0x7c'),_0x3883a3);}else{fs[_0x30c7('0x7d')](_0x3a5d5a);}});});});}else{return _0x1f6b4c[_0x30c7('0x14')](0xc8);}})[_0x30c7('0x2e')](handleError(_0x1f6b4c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c67a755..827dc69 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 _0x32f4=['remove','setDataValue','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save'];(function(_0x29e31b,_0x451c85){var _0x17fb74=function(_0x4d98f0){while(--_0x4d98f0){_0x29e31b['push'](_0x29e31b['shift']());}};_0x17fb74(++_0x451c85);}(_0x32f4,0x154));var _0x432f=function(_0x519d31,_0x442b7b){_0x519d31=_0x519d31-0x0;var _0x4bf6d1=_0x32f4[_0x519d31];return _0x4bf6d1;};'use strict';var EventEmitter=require(_0x432f('0x0'));var SmsInteraction=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var SmsMessage=require(_0x432f('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x432f('0x3')](0x0);var events={'afterCreate':_0x432f('0x4'),'afterUpdate':'update','afterDestroy':_0x432f('0x5')};function emitEvent(_0x1eabac){return function(_0x344a29,_0x355b02,_0x2f5f03){_0x344a29['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2f66fd){_0x344a29[_0x432f('0x6')]('Users',_0x2f66fd[_0x432f('0x7')](function(_0x5aaf1a){return{'id':_0x5aaf1a['id']};}));return SmsMessage[_0x432f('0x8')]({'where':{'SmsInteractionId':_0x344a29['id'],'direction':'in','read':![]},'raw':!![]});})[_0x432f('0x9')](function(_0x3a0d4b){_0x344a29[_0x432f('0x6')](_0x432f('0xa'),_0x3a0d4b['length']);SmsInteractionEvents[_0x432f('0xb')](_0x1eabac+':'+_0x344a29['id'],_0x344a29);SmsInteractionEvents['emit'](_0x1eabac,_0x344a29);_0x2f5f03(null);})[_0x432f('0xc')](_0x2f5f03(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x432f('0xd')](e,emitEvent(event));}}module[_0x432f('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x5464=['SmsMessage','save','remove','setDataValue','Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x2a3ce3,_0x27c416){var _0x5a7c92=function(_0x5b743e){while(--_0x5b743e){_0x2a3ce3['push'](_0x2a3ce3['shift']());}};_0x5a7c92(++_0x27c416);}(_0x5464,0x15d));var _0x4546=function(_0x11ec98,_0x1a4b4c){_0x11ec98=_0x11ec98-0x0;var _0x55d3db=_0x5464[_0x11ec98];return _0x55d3db;};'use strict';var EventEmitter=require(_0x4546('0x0'));var SmsInteraction=require(_0x4546('0x1'))['db'][_0x4546('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x4546('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4546('0x4'),'afterUpdate':'update','afterDestroy':_0x4546('0x5')};function emitEvent(_0x396a1d){return function(_0xcc9def,_0x2b1a9b,_0x54228a){_0xcc9def['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x224c7c){_0xcc9def[_0x4546('0x6')](_0x4546('0x7'),_0x224c7c[_0x4546('0x8')](function(_0x2f0376){return{'id':_0x2f0376['id']};}));return SmsMessage[_0x4546('0x9')]({'where':{'SmsInteractionId':_0xcc9def['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4546('0xa')](function(_0x430b2e){_0xcc9def[_0x4546('0x6')]('unreadMessages',_0x430b2e[_0x4546('0xb')]);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d+':'+_0xcc9def['id'],_0xcc9def);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d,_0xcc9def);_0x54228a(null);})['catch'](_0x54228a(null));};}for(var e in events){if(events[_0x4546('0xd')](e)){var event=events[e];SmsInteraction[_0x4546('0xe')](e,emitEvent(event));}}module[_0x4546('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6437741..3a737d3 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 _0xf620=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x5aef5a,_0x3ad0db){var _0xcff0b4=function(_0x414da0){while(--_0x414da0){_0x5aef5a['push'](_0x5aef5a['shift']());}};_0xcff0b4(++_0x3ad0db);}(_0xf620,0x99));var _0x0f62=function(_0x2bc801,_0x2377a8){_0x2bc801=_0x2bc801-0x0;var _0x5effbe=_0xf620[_0x2bc801];return _0x5effbe;};'use strict';var _=require(_0x0f62('0x0'));var util=require(_0x0f62('0x1'));var logger=require(_0x0f62('0x2'))(_0x0f62('0x3'));var moment=require(_0x0f62('0x4'));var BPromise=require(_0x0f62('0x5'));var rp=require(_0x0f62('0x6'));var fs=require('fs');var path=require(_0x0f62('0x7'));var rimraf=require('rimraf');var config=require(_0x0f62('0x8'));var attributes=require(_0x0f62('0x9'));module['exports']=function(_0x57b14e,_0x452cbb){return _0x57b14e[_0x0f62('0xa')](_0x0f62('0xb'),attributes,{'tableName':_0x0f62('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43e281,_0x48a8bb,_0x210667){if(_0x43e281[_0x0f62('0xd')](_0x0f62('0xe'))){_0x43e281[_0x0f62('0xf')]=moment()[_0x0f62('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x210667(null,_0x43e281);}}});}; \ No newline at end of file +var _0x07fa=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_interactions','closed','closedAt','format','lodash'];(function(_0x24232a,_0x11de97){var _0x54f410=function(_0x574d06){while(--_0x574d06){_0x24232a['push'](_0x24232a['shift']());}};_0x54f410(++_0x11de97);}(_0x07fa,0x68));var _0xa07f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x07fa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xa07f('0x0'));var util=require(_0xa07f('0x1'));var logger=require(_0xa07f('0x2'))(_0xa07f('0x3'));var moment=require(_0xa07f('0x4'));var BPromise=require(_0xa07f('0x5'));var rp=require(_0xa07f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa07f('0x7'));var config=require(_0xa07f('0x8'));var attributes=require('./smsInteraction.attributes');module[_0xa07f('0x9')]=function(_0x2aaf1f,_0x40675d){return _0x2aaf1f[_0xa07f('0xa')]('SmsInteraction',attributes,{'tableName':_0xa07f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43f0d3,_0x1c8c29,_0x2773de){if(_0x43f0d3['changed'](_0xa07f('0xc'))){_0x43f0d3[_0xa07f('0xd')]=moment()[_0xa07f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2773de(null,_0x43f0d3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 03aa752..cf25c17 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 _0xd5a8=['where','attributes','limit','then','debug','AddTagsToSmsInteraction','find','addTags','omit','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','body','options','raw'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd5a8,0x129));var _0x8d5a=function(_0x337c46,_0x49993f){_0x337c46=_0x337c46-0x0;var _0x48827c=_0xd5a8[_0x337c46];return _0x48827c;};'use strict';var _=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var moment=require(_0x8d5a('0x2'));var BPromise=require(_0x8d5a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d5a('0x4'))['db'];var utils=require(_0x8d5a('0x5'));var logger=require(_0x8d5a('0x6'))(_0x8d5a('0x7'));var config=require(_0x8d5a('0x8'));var jayson=require(_0x8d5a('0x9'));var client=jayson[_0x8d5a('0xa')][_0x8d5a('0xb')]({'port':0x232a});config['redis']=_[_0x8d5a('0xc')](config['redis'],{'host':_0x8d5a('0xd'),'port':0x18eb});var socket=require(_0x8d5a('0xe'))(new Redis(config[_0x8d5a('0xf')]));require(_0x8d5a('0x10'))['register'](socket);function respondWithRpcPromise(_0x21eead,_0x27d676,_0x3c33c7){return new BPromise(function(_0x26c073,_0xa49d28){return client[_0x8d5a('0x11')](_0x21eead,_0x3c33c7)['then'](function(_0xb775b2){logger['info'](_0x8d5a('0x12'),_0x27d676,_0x8d5a('0x13'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x27d676,_0x8d5a('0x13'),JSON[_0x8d5a('0x14')](_0xb775b2));if(_0xb775b2[_0x8d5a('0x15')]){if(_0xb775b2[_0x8d5a('0x15')][_0x8d5a('0x16')]===0x1f4){logger[_0x8d5a('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x27d676,_0xb775b2['error'][_0x8d5a('0x17')]);return _0xa49d28(_0xb775b2[_0x8d5a('0x15')][_0x8d5a('0x17')]);}logger[_0x8d5a('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x27d676,_0xb775b2[_0x8d5a('0x15')]['message']);return _0x26c073(_0xb775b2[_0x8d5a('0x15')][_0x8d5a('0x17')]);}else{logger[_0x8d5a('0x18')](_0x8d5a('0x12'),_0x27d676,_0x8d5a('0x13'));_0x26c073(_0xb775b2[_0x8d5a('0x19')]['message']);}})['catch'](function(_0x132767){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x27d676,_0x132767);_0xa49d28(_0x132767);});});}exports[_0x8d5a('0x1a')]=function(_0x533853){var _0x5181fa=this;return new Promise(function(_0x3dcd8c,_0x4c0a59){return db[_0x8d5a('0x1b')]['update'](_0x533853[_0x8d5a('0x1c')],{'raw':_0x533853[_0x8d5a('0x1d')]?_0x533853['options'][_0x8d5a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x533853['options']?_0x533853[_0x8d5a('0x1d')][_0x8d5a('0x1f')]||null:null,'attributes':_0x533853[_0x8d5a('0x1d')]?_0x533853[_0x8d5a('0x1d')][_0x8d5a('0x20')]||null:null,'limit':_0x533853[_0x8d5a('0x1d')]?_0x533853['options'][_0x8d5a('0x21')]||null:null})[_0x8d5a('0x22')](function(_0x12198b){logger[_0x8d5a('0x18')](_0x8d5a('0x1a'),_0x533853);logger[_0x8d5a('0x23')](_0x8d5a('0x1a'),_0x533853,JSON[_0x8d5a('0x14')](_0x12198b));_0x3dcd8c(_0x12198b);})['catch'](function(_0x5d64ca){logger[_0x8d5a('0x15')]('UpdateSmsInteraction',_0x5d64ca[_0x8d5a('0x17')],_0x533853);_0x4c0a59(_0x5181fa[_0x8d5a('0x15')](0x1f4,_0x5d64ca['message']));});});};exports[_0x8d5a('0x24')]=function(_0xee3040){return new Promise(function(_0x3fea07,_0x4fd03c){return db[_0x8d5a('0x1b')][_0x8d5a('0x25')]({'where':_0xee3040[_0x8d5a('0x1d')]?_0xee3040['options'][_0x8d5a('0x1f')]||null:null})[_0x8d5a('0x22')](function(_0x1cf166){if(_0x1cf166){return _0x1cf166[_0x8d5a('0x26')](_0xee3040[_0x8d5a('0x1c')]['ids'],_[_0x8d5a('0x27')](_0xee3040[_0x8d5a('0x1c')],['ids','id'])||{});}})['spread'](function(_0x45f604){logger[_0x8d5a('0x18')]('AddTags',_0xee3040);logger[_0x8d5a('0x23')](_0x8d5a('0x28'),_0xee3040,JSON[_0x8d5a('0x14')](_0x45f604));_0x3fea07(_0x45f604);})['catch'](function(_0xb7cdd7){logger['error'](_0x8d5a('0x28'),_0xb7cdd7['message'],_0xee3040);_0x4fd03c(_this['error'](0x1f4,_0xb7cdd7['message']));});});}; \ No newline at end of file +var _0xf93b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','request','info','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','then','debug','AddTagsToSmsInteraction','SmsInteraction','find','omit','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x210f93,_0x523c3c){var _0x219b6a=function(_0x3ded04){while(--_0x3ded04){_0x210f93['push'](_0x210f93['shift']());}};_0x219b6a(++_0x523c3c);}(_0xf93b,0x1be));var _0xbf93=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xf93b[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0xbf93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf93('0x1'));var rs=require(_0xbf93('0x2'));var fs=require('fs');var Redis=require(_0xbf93('0x3'));var db=require(_0xbf93('0x4'))['db'];var utils=require(_0xbf93('0x5'));var logger=require(_0xbf93('0x6'))(_0xbf93('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf93('0x8'));var client=jayson[_0xbf93('0x9')][_0xbf93('0xa')]({'port':0x232a});config[_0xbf93('0xb')]=_['defaults'](config[_0xbf93('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf93('0xc'))(new Redis(config['redis']));require(_0xbf93('0xd'))[_0xbf93('0xe')](socket);function respondWithRpcPromise(_0xf11ea8,_0x58c0e3,_0x52cb08){return new BPromise(function(_0x284b1d,_0x121434){return client[_0xbf93('0xf')](_0xf11ea8,_0x52cb08)['then'](function(_0x3aa060){logger[_0xbf93('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x58c0e3,_0xbf93('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x58c0e3,_0xbf93('0x11'),JSON[_0xbf93('0x12')](_0x3aa060));if(_0x3aa060[_0xbf93('0x13')]){if(_0x3aa060[_0xbf93('0x13')][_0xbf93('0x14')]===0x1f4){logger[_0xbf93('0x13')](_0xbf93('0x15'),_0x58c0e3,_0x3aa060['error'][_0xbf93('0x16')]);return _0x121434(_0x3aa060['error'][_0xbf93('0x16')]);}logger[_0xbf93('0x13')](_0xbf93('0x15'),_0x58c0e3,_0x3aa060[_0xbf93('0x13')][_0xbf93('0x16')]);return _0x284b1d(_0x3aa060[_0xbf93('0x13')][_0xbf93('0x16')]);}else{logger[_0xbf93('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x58c0e3,_0xbf93('0x11'));_0x284b1d(_0x3aa060[_0xbf93('0x17')][_0xbf93('0x16')]);}})[_0xbf93('0x18')](function(_0x8f6bb6){logger['error'](_0xbf93('0x15'),_0x58c0e3,_0x8f6bb6);_0x121434(_0x8f6bb6);});});}exports[_0xbf93('0x19')]=function(_0x154d25){var _0xda31c0=this;return new Promise(function(_0x5951a8,_0x430425){return db['SmsInteraction']['update'](_0x154d25[_0xbf93('0x1a')],{'raw':_0x154d25[_0xbf93('0x1b')]?_0x154d25[_0xbf93('0x1b')][_0xbf93('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x154d25[_0xbf93('0x1b')]?_0x154d25[_0xbf93('0x1b')][_0xbf93('0x1d')]||null:null,'attributes':_0x154d25[_0xbf93('0x1b')]?_0x154d25[_0xbf93('0x1b')][_0xbf93('0x1e')]||null:null,'limit':_0x154d25[_0xbf93('0x1b')]?_0x154d25['options'][_0xbf93('0x1f')]||null:null})[_0xbf93('0x20')](function(_0x1f4f31){logger[_0xbf93('0x10')](_0xbf93('0x19'),_0x154d25);logger[_0xbf93('0x21')](_0xbf93('0x19'),_0x154d25,JSON[_0xbf93('0x12')](_0x1f4f31));_0x5951a8(_0x1f4f31);})[_0xbf93('0x18')](function(_0x3787fe){logger[_0xbf93('0x13')](_0xbf93('0x19'),_0x3787fe[_0xbf93('0x16')],_0x154d25);_0x430425(_0xda31c0['error'](0x1f4,_0x3787fe[_0xbf93('0x16')]));});});};exports[_0xbf93('0x22')]=function(_0x12ffd8){return new Promise(function(_0x1413d0,_0x540d4e){return db[_0xbf93('0x23')][_0xbf93('0x24')]({'where':_0x12ffd8[_0xbf93('0x1b')]?_0x12ffd8['options']['where']||null:null})[_0xbf93('0x20')](function(_0x237d2f){if(_0x237d2f){return _0x237d2f['addTags'](_0x12ffd8[_0xbf93('0x1a')]['ids'],_[_0xbf93('0x25')](_0x12ffd8[_0xbf93('0x1a')],[_0xbf93('0x26'),'id'])||{});}})[_0xbf93('0x27')](function(_0x3986a9){logger['info'](_0xbf93('0x28'),_0x12ffd8);logger[_0xbf93('0x21')](_0xbf93('0x28'),_0x12ffd8,JSON[_0xbf93('0x12')](_0x3986a9));_0x1413d0(_0x3986a9);})['catch'](function(_0x3108d9){logger[_0xbf93('0x13')](_0xbf93('0x28'),_0x3108d9[_0xbf93('0x16')],_0x12ffd8);_0x540d4e(_this[_0xbf93('0x13')](0x1f4,_0x3108d9[_0xbf93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1986951..d5a3075 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 _0x3862=['removeListener','register','length','./smsInteraction.events','save'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x3862,0x120));var _0x2386=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0x3862[_0x279ab1];return _0x8ba87c;};'use strict';var SmsInteractionEvents=require(_0x2386('0x0'));var events=[_0x2386('0x1'),'remove','update'];function createListener(_0x5208ea,_0x2df6ea){return function(_0x2414a6){_0x2df6ea['emit'](_0x5208ea,_0x2414a6);};}function removeListener(_0xce13b8,_0x3b6c34){return function(){SmsInteractionEvents[_0x2386('0x2')](_0xce13b8,_0x3b6c34);};}exports[_0x2386('0x3')]=function(_0x55246a){for(var _0x4fce75=0x0,_0x2bbc88=events[_0x2386('0x4')];_0x4fce75<_0x2bbc88;_0x4fce75++){var _0x5dfa7b=events[_0x4fce75];var _0x2bd5bc=createListener('smsInteraction:'+_0x5dfa7b,_0x55246a);SmsInteractionEvents['on'](_0x5dfa7b,_0x2bd5bc);}}; \ No newline at end of file +var _0x9021=['./smsInteraction.events','save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x9021,0x85));var _0x1902=function(_0x5cdf3c,_0x233f63){_0x5cdf3c=_0x5cdf3c-0x0;var _0x515b20=_0x9021[_0x5cdf3c];return _0x515b20;};'use strict';var SmsInteractionEvents=require(_0x1902('0x0'));var events=[_0x1902('0x1'),_0x1902('0x2'),'update'];function createListener(_0x4dc126,_0x187f60){return function(_0x5eeed9){_0x187f60[_0x1902('0x3')](_0x4dc126,_0x5eeed9);};}function removeListener(_0x294cda,_0x3ba5ca){return function(){SmsInteractionEvents[_0x1902('0x4')](_0x294cda,_0x3ba5ca);};}exports[_0x1902('0x5')]=function(_0x174ae8){for(var _0x571499=0x0,_0x5d6e71=events['length'];_0x571499<_0x5d6e71;_0x571499++){var _0x47c6c2=events[_0x571499];var _0x5a17e0=createListener(_0x1902('0x6')+_0x47c6c2,_0x174ae8);SmsInteractionEvents['on'](_0x47c6c2,_0x5a17e0);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4851fa9..9f65e7c 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 _0x8322=['show','tracked','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id'];(function(_0x2aa82b,_0x453a73){var _0x36035b=function(_0x3e14a9){while(--_0x3e14a9){_0x2aa82b['push'](_0x2aa82b['shift']());}};_0x36035b(++_0x453a73);}(_0x8322,0x186));var _0x2832=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8322[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var path=require(_0x2832('0x2'));var timeout=require(_0x2832('0x3'));var express=require(_0x2832('0x4'));var router=express[_0x2832('0x5')]();var fs_extra=require(_0x2832('0x6'));var auth=require(_0x2832('0x7'));var interaction=require(_0x2832('0x8'));var config=require(_0x2832('0x9'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x2832('0xa')](),controller[_0x2832('0xb')]);router[_0x2832('0xc')](_0x2832('0xd'),auth[_0x2832('0xa')](),controller['describe']);router[_0x2832('0xc')](_0x2832('0xe'),auth[_0x2832('0xa')](),controller[_0x2832('0xf')]);router['post']('/',auth[_0x2832('0xa')](),interaction[_0x2832('0x10')]('sms','smsmessage:create'),controller[_0x2832('0x11')]);router['post']('/:id/status',controller[_0x2832('0x12')]);router[_0x2832('0x13')](_0x2832('0xe'),auth[_0x2832('0xa')](),controller['update']);router[_0x2832('0x13')](_0x2832('0x14'),auth['isAuthenticated'](),controller[_0x2832('0x15')]);router[_0x2832('0x13')](_0x2832('0x16'),auth[_0x2832('0xa')](),controller[_0x2832('0x17')]);router[_0x2832('0x18')](_0x2832('0xe'),auth['isAuthenticated'](),controller[_0x2832('0x19')]);module[_0x2832('0x1a')]=router; \ No newline at end of file +var _0x287b=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','smsmessage:create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x7b3c2c,_0x1532f7){var _0x249a1f=function(_0x1f74af){while(--_0x1f74af){_0x7b3c2c['push'](_0x7b3c2c['shift']());}};_0x249a1f(++_0x1532f7);}(_0x287b,0x96));var _0xb287=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x287b[_0x44c935];return _0x465bee;};'use strict';var multer=require(_0xb287('0x0'));var util=require('util');var path=require(_0xb287('0x1'));var timeout=require(_0xb287('0x2'));var express=require(_0xb287('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb287('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb287('0x5'));var controller=require('./smsMessage.controller');router[_0xb287('0x6')]('/',auth[_0xb287('0x7')](),controller[_0xb287('0x8')]);router[_0xb287('0x6')](_0xb287('0x9'),auth[_0xb287('0x7')](),controller[_0xb287('0xa')]);router[_0xb287('0x6')](_0xb287('0xb'),auth[_0xb287('0x7')](),controller[_0xb287('0xc')]);router[_0xb287('0xd')]('/',auth[_0xb287('0x7')](),interaction[_0xb287('0xe')]('sms',_0xb287('0xf')),controller['create']);router['post'](_0xb287('0x10'),controller['status']);router[_0xb287('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb287('0x12')]);router[_0xb287('0x11')](_0xb287('0x13'),auth[_0xb287('0x7')](),controller[_0xb287('0x14')]);router['put'](_0xb287('0x15'),auth[_0xb287('0x7')](),controller[_0xb287('0x16')]);router[_0xb287('0x17')](_0xb287('0xb'),auth['isAuthenticated'](),controller[_0xb287('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f911971..fe00e6b 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 _0x95d0=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0x468248,_0x20609d){var _0x29bdbc=function(_0xea9fe6){while(--_0xea9fe6){_0x468248['push'](_0x468248['shift']());}};_0x29bdbc(++_0x20609d);}(_0x95d0,0x1d1));var _0x095d=function(_0x143853,_0x5e442e){_0x143853=_0x143853-0x0;var _0x4bde10=_0x95d0[_0x143853];return _0x4bde10;};'use strict';var Sequelize=require(_0x095d('0x0'));module[_0x095d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x095d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x095d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x095d('0x4')]('in',_0x095d('0x5')),'defaultValue':_0x095d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x095d('0x6')]},'readAt':{'type':Sequelize[_0x095d('0x7')]},'secret':{'type':Sequelize[_0x095d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x095d('0x6')]},'providerResponse':{'type':Sequelize[_0x095d('0x8')]}}; \ No newline at end of file +var _0xf5a1=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x24dfd2,_0x504fac){var _0x3abda1=function(_0x55bc85){while(--_0x55bc85){_0x24dfd2['push'](_0x24dfd2['shift']());}};_0x3abda1(++_0x504fac);}(_0xf5a1,0x129));var _0x1f5a=function(_0xd7d684,_0x5509e7){_0xd7d684=_0xd7d684-0x0;var _0x5c4054=_0xf5a1[_0xd7d684];return _0x5c4054;};'use strict';var Sequelize=require(_0x1f5a('0x0'));module[_0x1f5a('0x1')]={'body':{'type':Sequelize[_0x1f5a('0x2')](_0x1f5a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1f5a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f5a('0x5')]('in',_0x1f5a('0x6')),'defaultValue':_0x1f5a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1f5a('0x7')]},'readAt':{'type':Sequelize[_0x1f5a('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f5a('0x7')]},'providerResponse':{'type':Sequelize[_0x1f5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 84da68f..c701c36 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 _0x9f89=['interface','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','groupName','DELIVERED','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','undefined','count','offset','limit','status','Content-Range','apply','reject','save','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SmsMessage','findAll','rows','show','params','keys','length','find','create','body','update','describe','sms-interactions','accept','sms','read','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','Sequelize'];(function(_0x3452eb,_0x44035e){var _0x4244fd=function(_0x48564b){while(--_0x48564b){_0x3452eb['push'](_0x3452eb['shift']());}};_0x4244fd(++_0x44035e);}(_0x9f89,0x13d));var _0x99f8=function(_0x2c5f00,_0x3558ec){_0x2c5f00=_0x2c5f00-0x0;var _0x36ddd4=_0x9f89[_0x2c5f00];return _0x36ddd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f8('0x1'));var rp=require(_0x99f8('0x2'));var moment=require(_0x99f8('0x3'));var BPromise=require(_0x99f8('0x4'));var Mustache=require(_0x99f8('0x5'));var util=require('util');var path=require(_0x99f8('0x6'));var sox=require(_0x99f8('0x7'));var csv=require(_0x99f8('0x8'));var ejs=require(_0x99f8('0x9'));var fs=require('fs');var fs_extra=require(_0x99f8('0xa'));var _=require(_0x99f8('0xb'));var squel=require(_0x99f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x99f8('0xd'));var deskjs=require(_0x99f8('0xe'));var toCsv=require(_0x99f8('0x8'));var querystring=require(_0x99f8('0xf'));var Papa=require('papaparse');var Redis=require(_0x99f8('0x10'));var authService=require(_0x99f8('0x11'));var qs=require(_0x99f8('0x12'));var as=require(_0x99f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99f8('0x14'))(_0x99f8('0x15'));var utils=require(_0x99f8('0x16'));var config=require(_0x99f8('0x17'));var licenseUtil=require(_0x99f8('0x18'));var db=require(_0x99f8('0x19'))['db'];config[_0x99f8('0x1a')]=_[_0x99f8('0x1b')](config[_0x99f8('0x1a')],{'host':_0x99f8('0x1c'),'port':0x18eb});var socket=require(_0x99f8('0x1d'))(new Redis(config['redis']));require(_0x99f8('0x1e'))[_0x99f8('0x1f')](socket);var jayson=require(_0x99f8('0x20'));var client=jayson[_0x99f8('0x21')][_0x99f8('0x22')]({'port':0x232c});var client9002=jayson[_0x99f8('0x21')][_0x99f8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x25a8a4,_0x29750c,_0x1efc83,_0x3b1579){return new BPromise(function(_0x4841cc,_0x40ef78){var _0xcf7ade=_0x3b1579||client;return _0xcf7ade['request'](_0x25a8a4,_0x1efc83)[_0x99f8('0x23')](function(_0xa7f114){logger['info']('SmsMessage,\x20%s,\x20%s',_0x29750c,_0x99f8('0x24'));logger[_0x99f8('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29750c,_0x99f8('0x24'),JSON[_0x99f8('0x26')](_0xa7f114));if(_0xa7f114[_0x99f8('0x27')]){if(_0xa7f114[_0x99f8('0x27')]['code']===0x1f4){logger[_0x99f8('0x27')](_0x99f8('0x28'),_0x29750c,_0xa7f114['error'][_0x99f8('0x29')]);return _0x40ef78(_0xa7f114[_0x99f8('0x27')][_0x99f8('0x29')]);}logger[_0x99f8('0x27')](_0x99f8('0x28'),_0x29750c,_0xa7f114[_0x99f8('0x27')][_0x99f8('0x29')]);return _0x4841cc(_0xa7f114[_0x99f8('0x27')][_0x99f8('0x29')]);}else{logger[_0x99f8('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x29750c,_0x99f8('0x24'));_0x4841cc(_0xa7f114[_0x99f8('0x2b')][_0x99f8('0x29')]);}})[_0x99f8('0x2c')](function(_0x52f4ae){logger[_0x99f8('0x27')](_0x99f8('0x28'),_0x29750c,_0x52f4ae);_0x40ef78(_0x52f4ae);});});}function respondWithStatusCode(_0x151e04,_0x1a15ff){_0x1a15ff=_0x1a15ff||0xcc;return function(_0x262337){if(_0x262337){return _0x151e04[_0x99f8('0x2d')](_0x1a15ff);}return _0x151e04['status'](_0x1a15ff)[_0x99f8('0x2e')]();};}function respondWithResult(_0x45509e,_0x591979){_0x591979=_0x591979||0xc8;return function(_0x548602){if(_0x548602){return _0x45509e['status'](_0x591979)['json'](_0x548602);}};}function respondWithFilteredResult(_0x55343e,_0x3599e5){return function(_0x3545e9){if(_0x3545e9){var _0x8c35ff=typeof _0x3599e5['offset']==='undefined'&&typeof _0x3599e5['limit']===_0x99f8('0x2f');var _0x16b350=_0x3545e9[_0x99f8('0x30')];var _0x3668e2=_0x8c35ff?0x0:_0x3599e5[_0x99f8('0x31')];var _0x2e7032=_0x8c35ff?_0x3545e9[_0x99f8('0x30')]:_0x3599e5[_0x99f8('0x31')]+_0x3599e5[_0x99f8('0x32')];var _0x1a446c;if(_0x2e7032>=_0x16b350){_0x2e7032=_0x16b350;_0x1a446c=0xc8;}else{_0x1a446c=0xce;}_0x55343e[_0x99f8('0x33')](_0x1a446c);return _0x55343e['set'](_0x99f8('0x34'),_0x3668e2+'-'+_0x2e7032+'/'+_0x16b350)['json'](_0x3545e9);}return null;};}function patchUpdates(_0x15f507){return function(_0x4e0f7f){try{jsonpatch[_0x99f8('0x35')](_0x4e0f7f,_0x15f507,!![]);}catch(_0x9362e2){return BPromise[_0x99f8('0x36')](_0x9362e2);}return _0x4e0f7f[_0x99f8('0x37')]();};}function saveUpdates(_0x121930,_0x2fbff0){return function(_0xd2187d){if(_0xd2187d){return _0xd2187d['update'](_0x121930)[_0x99f8('0x23')](function(_0x9ba832){return _0x9ba832;});}return null;};}function removeEntity(_0x40060f,_0x1b4c72){return function(_0x3daef3){if(_0x3daef3){return _0x3daef3[_0x99f8('0x38')]()['then'](function(){_0x40060f['status'](0xcc)[_0x99f8('0x2e')]();});}};}function handleEntityNotFound(_0xf36408,_0x44f871){return function(_0x54a9b2){if(!_0x54a9b2){_0xf36408[_0x99f8('0x2d')](0x194);}return _0x54a9b2;};}function handleError(_0x539886,_0x5a8616){_0x5a8616=_0x5a8616||0x1f4;return function(_0x421c0c){logger[_0x99f8('0x27')](_0x421c0c[_0x99f8('0x39')]);if(_0x421c0c['name']){delete _0x421c0c[_0x99f8('0x3a')];}_0x539886['status'](_0x5a8616)['send'](_0x421c0c);};}exports['index']=function(_0x112d46,_0x55d679){var _0x1393b6={},_0xae8e98={},_0x1bac46={'count':0x0,'rows':[]};var _0x53c2f9=_[_0x99f8('0x3b')](db['SmsMessage'][_0x99f8('0x3c')],function(_0x2a10e0){return{'name':_0x2a10e0[_0x99f8('0x3d')],'type':_0x2a10e0[_0x99f8('0x3e')][_0x99f8('0x3f')]};});_0xae8e98[_0x99f8('0x40')]=_[_0x99f8('0x3b')](_0x53c2f9,_0x99f8('0x3a'));_0xae8e98[_0x99f8('0x41')]=_['keys'](_0x112d46[_0x99f8('0x41')]);_0xae8e98[_0x99f8('0x42')]=_[_0x99f8('0x43')](_0xae8e98['model'],_0xae8e98[_0x99f8('0x41')]);_0x1393b6[_0x99f8('0x44')]=_['intersection'](_0xae8e98['model'],qs[_0x99f8('0x45')](_0x112d46[_0x99f8('0x41')][_0x99f8('0x45')]));_0x1393b6['attributes']=_0x1393b6['attributes']['length']?_0x1393b6[_0x99f8('0x44')]:_0xae8e98[_0x99f8('0x40')];if(!_0x112d46['query'][_0x99f8('0x46')](_0x99f8('0x47'))){_0x1393b6[_0x99f8('0x32')]=qs['limit'](_0x112d46['query'][_0x99f8('0x32')]);_0x1393b6[_0x99f8('0x31')]=qs[_0x99f8('0x31')](_0x112d46[_0x99f8('0x41')]['offset']);}_0x1393b6['order']=qs[_0x99f8('0x48')](_0x112d46['query'][_0x99f8('0x48')]);_0x1393b6[_0x99f8('0x49')]=qs[_0x99f8('0x42')](_[_0x99f8('0x4a')](_0x112d46[_0x99f8('0x41')],_0xae8e98['filters']),_0x53c2f9);if(_0x112d46[_0x99f8('0x41')][_0x99f8('0x4b')]){_0x1393b6[_0x99f8('0x49')]=_[_0x99f8('0x4c')](_0x1393b6[_0x99f8('0x49')],{'$or':_[_0x99f8('0x3b')](_0x53c2f9,function(_0x394434){if(_0x394434[_0x99f8('0x3e')]!==_0x99f8('0x4d')){var _0x889c0b={};_0x889c0b[_0x394434[_0x99f8('0x3a')]]={'$like':'%'+_0x112d46['query'][_0x99f8('0x4b')]+'%'};return _0x889c0b;}})});}_0x1393b6=_[_0x99f8('0x4c')]({},_0x1393b6,_0x112d46[_0x99f8('0x4e')]);var _0x17ff4f={'where':_0x1393b6['where']};return db['SmsMessage'][_0x99f8('0x30')](_0x17ff4f)[_0x99f8('0x23')](function(_0x2f899a){_0x1bac46['count']=_0x2f899a;if(_0x112d46[_0x99f8('0x41')][_0x99f8('0x4f')]){_0x1393b6[_0x99f8('0x50')]=[{'all':!![]}];}return db[_0x99f8('0x51')][_0x99f8('0x52')](_0x1393b6);})[_0x99f8('0x23')](function(_0x2a0f27){_0x1bac46[_0x99f8('0x53')]=_0x2a0f27;return _0x1bac46;})[_0x99f8('0x23')](respondWithFilteredResult(_0x55d679,_0x1393b6))[_0x99f8('0x2c')](handleError(_0x55d679,null));};exports[_0x99f8('0x54')]=function(_0x198089,_0x184e1f){var _0x1c2170={'raw':!![],'where':{'id':_0x198089[_0x99f8('0x55')]['id']}},_0x4d43de={};_0x4d43de[_0x99f8('0x40')]=_[_0x99f8('0x56')](db[_0x99f8('0x51')][_0x99f8('0x3c')]);_0x4d43de[_0x99f8('0x41')]=_[_0x99f8('0x56')](_0x198089['query']);_0x4d43de[_0x99f8('0x42')]=_[_0x99f8('0x43')](_0x4d43de[_0x99f8('0x40')],_0x4d43de[_0x99f8('0x41')]);_0x1c2170[_0x99f8('0x44')]=_[_0x99f8('0x43')](_0x4d43de[_0x99f8('0x40')],qs[_0x99f8('0x45')](_0x198089[_0x99f8('0x41')][_0x99f8('0x45')]));_0x1c2170[_0x99f8('0x44')]=_0x1c2170[_0x99f8('0x44')][_0x99f8('0x57')]?_0x1c2170[_0x99f8('0x44')]:_0x4d43de['model'];if(_0x198089[_0x99f8('0x41')]['includeAll']){_0x1c2170[_0x99f8('0x50')]=[{'all':!![]}];}_0x1c2170=_[_0x99f8('0x4c')]({},_0x1c2170,_0x198089[_0x99f8('0x4e')]);return db[_0x99f8('0x51')][_0x99f8('0x58')](_0x1c2170)[_0x99f8('0x23')](handleEntityNotFound(_0x184e1f,null))[_0x99f8('0x23')](respondWithResult(_0x184e1f,null))[_0x99f8('0x2c')](handleError(_0x184e1f,null));};exports[_0x99f8('0x59')]=function(_0x4807ac,_0xf5dd11){return db[_0x99f8('0x51')]['create'](_0x4807ac[_0x99f8('0x5a')],{})['then'](respondWithResult(_0xf5dd11,0xc9))[_0x99f8('0x2c')](handleError(_0xf5dd11,null));};exports[_0x99f8('0x5b')]=function(_0x427679,_0x172390){if(_0x427679['body']['id']){delete _0x427679[_0x99f8('0x5a')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x427679[_0x99f8('0x55')]['id']}})['then'](handleEntityNotFound(_0x172390,null))[_0x99f8('0x23')](saveUpdates(_0x427679[_0x99f8('0x5a')],null))[_0x99f8('0x23')](respondWithResult(_0x172390,null))[_0x99f8('0x2c')](handleError(_0x172390,null));};exports[_0x99f8('0x38')]=function(_0x2558f0,_0x5e3d25){return db[_0x99f8('0x51')][_0x99f8('0x58')]({'where':{'id':_0x2558f0[_0x99f8('0x55')]['id']}})[_0x99f8('0x23')](handleEntityNotFound(_0x5e3d25,null))[_0x99f8('0x23')](removeEntity(_0x5e3d25,null))[_0x99f8('0x2c')](handleError(_0x5e3d25,null));};exports['describe']=function(_0x42f9dc,_0x3b4ccd){return db[_0x99f8('0x51')][_0x99f8('0x5c')]()[_0x99f8('0x23')](respondWithResult(_0x3b4ccd,null))[_0x99f8('0x2c')](handleError(_0x3b4ccd,null));};var interaction_log=require('../../config/logger')(_0x99f8('0x5d'));exports[_0x99f8('0x5e')]=function(_0x4796ce,_0x6966b,_0x362628){var _0x51f9e0={'agent':{},'channel':_0x99f8('0x5f')};if(_0x4796ce[_0x99f8('0x5a')]['id']){delete _0x4796ce[_0x99f8('0x5a')]['id'];}_0x4796ce[_0x99f8('0x5a')][_0x99f8('0x60')]=!![];_0x4796ce['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4796ce['body'][_0x99f8('0x61')]=_0x4796ce[_0x99f8('0x5a')][_0x99f8('0x61')]||_0x4796ce[_0x99f8('0x62')]['id'];_0x51f9e0[_0x99f8('0x63')]['id']=_0x4796ce['body'][_0x99f8('0x61')];return db[_0x99f8('0x51')]['find']({'where':{'id':_0x4796ce[_0x99f8('0x55')]['id'],'UserId':null}})[_0x99f8('0x23')](handleEntityNotFound(_0x6966b,null))[_0x99f8('0x23')](saveUpdates(_0x4796ce[_0x99f8('0x5a')],null))[_0x99f8('0x23')](function(_0x58fc93){if(_0x58fc93){_0x51f9e0[_0x99f8('0x29')]=_0x58fc93[_0x99f8('0x64')]({'plain':!![]});return db[_0x99f8('0x65')][_0x99f8('0x58')]({'where':{'id':_0x58fc93[_0x99f8('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x6966b,null))[_0x99f8('0x23')](function(_0x2b09ab){if(_0x2b09ab){return _0x2b09ab[_0x99f8('0x5b')]({'UserId':_0x4796ce[_0x99f8('0x5a')][_0x99f8('0x61')],'read1stAt':_[_0x99f8('0x67')](_0x2b09ab[_0x99f8('0x68')])?moment()[_0x99f8('0x69')](_0x99f8('0x6a')):undefined});}return null;})[_0x99f8('0x23')](function(_0x574b4d){if(_0x574b4d){_0x51f9e0['interaction']=_0x574b4d['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4796ce[_0x99f8('0x62')]['id'],_0x4796ce[_0x99f8('0x62')]['name'],_0x4796ce[_0x99f8('0x62')][_0x99f8('0x6b')],_0x51f9e0['interaction']['id'],_0x4796ce[_0x99f8('0x5a')]?JSON['stringify'](_0x4796ce[_0x99f8('0x5a')]):_0x99f8('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x99f8('0x6d'),_0x51f9e0);}return null;})[_0x99f8('0x23')](function(_0x499b37){var _0x24001f=_0x99f8('0x6e')+_0x499b37['message'][_0x99f8('0x6f')];return db['sequelize'][_0x99f8('0x41')](_0x24001f,{'type':db['Sequelize'][_0x99f8('0x70')][_0x99f8('0x71')],'raw':!![]})['then'](function(_0x4989a3){return _0x4989a3;});})[_0x99f8('0x23')](function(_0x3a811b){if(_0x3a811b){_0x51f9e0[_0x99f8('0x29')][_0x99f8('0x72')]=_0x3a811b[0x0];if(!_0x4796ce[_0x99f8('0x5a')][_0x99f8('0x61')])return;return db['User'][_0x99f8('0x58')]({'where':{'id':_0x4796ce['body'][_0x99f8('0x61')],'role':_0x99f8('0x63')},'attributes':['id',_0x99f8('0x3a'),_0x99f8('0x73'),_0x99f8('0x74'),_0x99f8('0x75')],'raw':!![]});}return null;})[_0x99f8('0x23')](function(_0x8a34ca){if(!_0x8a34ca)return null;_0x51f9e0[_0x99f8('0x29')]['agent']=_0x8a34ca;return _0x51f9e0;})['then'](function(_0x29a40b){if(_0x29a40b){if(_0x4796ce[_0x99f8('0x5a')][_0x99f8('0x76')]){_0x51f9e0[_0x99f8('0x29')]['interface']=util['format'](_0x99f8('0x77'),_0x4796ce[_0x99f8('0x62')][_0x99f8('0x3a')]);_0x51f9e0[_0x99f8('0x29')]['channel']=_0x51f9e0['channel'];_0x51f9e0[_0x99f8('0x29')][_0x99f8('0x78')]=_0x51f9e0[_0x99f8('0x79')];_0x51f9e0[_0x99f8('0x29')][_0x99f8('0x7a')]='accept';return respondWithRpcPromise(_0x99f8('0x7b'),_0x99f8('0x7b'),{'event':_0x99f8('0x7c'),'message':_0x51f9e0['message']},client9002)[_0x99f8('0x23')](function(){return _0x51f9e0;});}return _0x51f9e0;}return null;})[_0x99f8('0x23')](respondWithResult(_0x6966b,null))['catch'](handleError(_0x6966b,null));};var interaction_log=require(_0x99f8('0x14'))(_0x99f8('0x5d'));exports[_0x99f8('0x36')]=function(_0x3e7dd1,_0x30f28c,_0x2d37a2){var _0x238362={'agent':{},'channel':_0x99f8('0x5f')};if(_0x3e7dd1['body']['id']){delete _0x3e7dd1[_0x99f8('0x5a')]['id'];}_0x3e7dd1[_0x99f8('0x5a')][_0x99f8('0x61')]=_0x3e7dd1[_0x99f8('0x5a')][_0x99f8('0x61')]||_0x3e7dd1[_0x99f8('0x62')]['id'];_0x238362[_0x99f8('0x63')]['id']=_0x3e7dd1[_0x99f8('0x5a')][_0x99f8('0x61')];return db[_0x99f8('0x51')][_0x99f8('0x58')]({'where':{'id':_0x3e7dd1[_0x99f8('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30f28c,null))[_0x99f8('0x23')](function(_0x107673){if(_0x107673){_0x238362[_0x99f8('0x29')]=_0x107673[_0x99f8('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x99f8('0x58')]({'where':{'id':_0x107673[_0x99f8('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x30f28c,null))['then'](function(_0x46b208){if(_0x46b208){_0x238362[_0x99f8('0x7d')]=_0x46b208[_0x99f8('0x64')]({'plain':!![]});interaction_log[_0x99f8('0x2a')](_0x99f8('0x7e'),_0x3e7dd1['user']['id'],_0x3e7dd1[_0x99f8('0x62')][_0x99f8('0x3a')],_0x3e7dd1[_0x99f8('0x62')][_0x99f8('0x6b')],_0x238362[_0x99f8('0x7d')]['id'],_0x3e7dd1['body']?JSON[_0x99f8('0x26')](_0x3e7dd1[_0x99f8('0x5a')]):'null');return respondWithRpcPromise(_0x99f8('0x7f'),'rejectMessage',_0x238362);}return null;})[_0x99f8('0x23')](function(_0x2dc185){var _0xc616f3=_0x99f8('0x6e')+_0x2dc185[_0x99f8('0x29')][_0x99f8('0x6f')];return db[_0x99f8('0x80')][_0x99f8('0x41')](_0xc616f3,{'type':db[_0x99f8('0x81')]['QueryTypes'][_0x99f8('0x71')],'raw':!![]})[_0x99f8('0x23')](function(_0x470c09){return _0x470c09;});})[_0x99f8('0x23')](function(_0x4bef96){if(_0x4bef96){_0x238362['message']['contact']=_0x4bef96[0x0];if(!_0x3e7dd1[_0x99f8('0x5a')][_0x99f8('0x61')])return;return db['User'][_0x99f8('0x58')]({'where':{'id':_0x3e7dd1[_0x99f8('0x5a')]['UserId'],'role':_0x99f8('0x63')},'attributes':['id',_0x99f8('0x3a'),_0x99f8('0x73'),_0x99f8('0x74'),_0x99f8('0x75')],'raw':!![]});}return null;})['then'](function(_0xbf1b14){if(!_0xbf1b14)return null;_0x238362[_0x99f8('0x29')][_0x99f8('0x63')]=_0xbf1b14;return _0x238362;})[_0x99f8('0x23')](function(_0x48bdec){if(_0x48bdec){_0x48bdec['message'][_0x99f8('0x82')]=util[_0x99f8('0x69')]('SIP/%s',_0x3e7dd1[_0x99f8('0x62')][_0x99f8('0x3a')]);_0x48bdec['message'][_0x99f8('0x79')]=_0x238362[_0x99f8('0x79')];_0x48bdec[_0x99f8('0x29')][_0x99f8('0x78')]=_0x238362[_0x99f8('0x79')];_0x48bdec[_0x99f8('0x29')][_0x99f8('0x7a')]=_0x99f8('0x36');respondWithRpcPromise(_0x99f8('0x7b'),_0x99f8('0x7b'),{'event':_0x99f8('0x83'),'message':_0x48bdec[_0x99f8('0x29')]},client9002);return _0x238362;}return null;})[_0x99f8('0x23')](respondWithResult(_0x30f28c,null))[_0x99f8('0x2c')](handleError(_0x30f28c,null));};exports[_0x99f8('0x33')]=function(_0x3a13a2,_0x3580e3,_0x27c8bc){if(_0x3a13a2[_0x99f8('0x5a')]['id']){delete _0x3a13a2[_0x99f8('0x5a')]['id'];}var _0x42b7a7;return db['SmsMessage'][_0x99f8('0x58')]({'where':{'id':_0x3a13a2[_0x99f8('0x55')]['id']}})[_0x99f8('0x23')](handleEntityNotFound(_0x3580e3,null))[_0x99f8('0x23')](function(_0x528576){if(_0x528576){_0x42b7a7=_0x528576;return db['SmsAccount'][_0x99f8('0x58')]({'where':{'id':_0x528576[_0x99f8('0x84')]}});}})[_0x99f8('0x23')](handleEntityNotFound(_0x3580e3,null))['then'](function(_0x45cc12){if(_0x45cc12){logger['debug'](_0x99f8('0x85'),_0x99f8('0x33'),_0x99f8('0x86'),_0x45cc12[_0x99f8('0x3e')],util[_0x99f8('0x87')](_0x3a13a2[_0x99f8('0x5a')],{'showHidden':![],'depth':null}));switch(_0x45cc12[_0x99f8('0x3e')]){case'twilio':if(_0x3a13a2[_0x99f8('0x5a')][_0x99f8('0x88')]&&_0x3a13a2['body'][_0x99f8('0x88')]===_0x42b7a7[_0x99f8('0x89')]){return _0x42b7a7[_0x99f8('0x5b')]({'read':!![]});}else{logger[_0x99f8('0x27')](_0x99f8('0x8a'),_0x99f8('0x33'),_0x99f8('0x8b'),util['inspect'](_0x3a13a2[_0x99f8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x99f8('0x8c'):if(_0x3a13a2['body'][_0x99f8('0x8d')]&&_0x3a13a2['body']['MessageUUID']===_0x42b7a7[_0x99f8('0x89')]&&_[_0x99f8('0x8e')](['sent',_0x99f8('0x8f')],_0x3a13a2[_0x99f8('0x5a')][_0x99f8('0x90')])>=0x0){return _0x42b7a7[_0x99f8('0x5b')]({'read':!![]});}else{logger['error'](_0x99f8('0x8a'),_0x99f8('0x33'),_0x99f8('0x91'),util[_0x99f8('0x87')](_0x3a13a2[_0x99f8('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x99f8('0x92'):var _0x110443=_0x3a13a2[_0x99f8('0x5a')]['results'][0x0];if(_0x110443[_0x99f8('0x33')][_0x99f8('0x93')]===_0x99f8('0x94')){return _0x42b7a7['update']({'read':!![]});}else{logger[_0x99f8('0x27')](_0x99f8('0x8a'),_0x99f8('0x33'),'infobip',util[_0x99f8('0x87')](_0x3a13a2[_0x99f8('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x42b7a7;}})[_0x99f8('0x23')](respondWithResult(_0x3580e3,null))[_0x99f8('0x2c')](handleError(_0x3580e3,null));}; \ No newline at end of file +var _0xc132=['squel','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','redis','defaults','localhost','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','type','filter','options','include','findAll','params','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','sequelize','User','internal','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x4d560a,_0x48d9dd){var _0x368b51=function(_0x4124a8){while(--_0x4124a8){_0x4d560a['push'](_0x4d560a['shift']());}};_0x368b51(++_0x48d9dd);}(_0xc132,0x11e));var _0x2c13=function(_0x4d7120,_0x2ab618){_0x4d7120=_0x4d7120-0x0;var _0x3d76f3=_0xc132[_0x4d7120];return _0x3d76f3;};'use strict';var emlformat=require(_0x2c13('0x0'));var rimraf=require(_0x2c13('0x1'));var zipdir=require(_0x2c13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c13('0x3'));var BPromise=require(_0x2c13('0x4'));var Mustache=require('mustache');var util=require(_0x2c13('0x5'));var path=require('path');var sox=require(_0x2c13('0x6'));var csv=require(_0x2c13('0x7'));var ejs=require(_0x2c13('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c13('0x9'));var squel=require(_0x2c13('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c13('0xb'));var toCsv=require(_0x2c13('0x7'));var querystring=require(_0x2c13('0xc'));var Papa=require(_0x2c13('0xd'));var Redis=require(_0x2c13('0xe'));var authService=require(_0x2c13('0xf'));var qs=require(_0x2c13('0x10'));var as=require(_0x2c13('0x11'));var hardwareService=require(_0x2c13('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2c13('0x13'));var config=require(_0x2c13('0x14'));var licenseUtil=require(_0x2c13('0x15'));var db=require(_0x2c13('0x16'))['db'];config[_0x2c13('0x17')]=_[_0x2c13('0x18')](config['redis'],{'host':_0x2c13('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c13('0x17')]));require(_0x2c13('0x1a'))[_0x2c13('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2c13('0x1c')][_0x2c13('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x2c13('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4181c3,_0x4455c6,_0x257b34,_0x25b044){return new BPromise(function(_0x44c9af,_0x28525c){var _0x42dd4d=_0x25b044||client;return _0x42dd4d[_0x2c13('0x1e')](_0x4181c3,_0x257b34)[_0x2c13('0x1f')](function(_0x230488){logger[_0x2c13('0x20')](_0x2c13('0x21'),_0x4455c6,'request\x20sent');logger[_0x2c13('0x22')](_0x2c13('0x23'),_0x4455c6,'request\x20sent',JSON[_0x2c13('0x24')](_0x230488));if(_0x230488[_0x2c13('0x25')]){if(_0x230488[_0x2c13('0x25')][_0x2c13('0x26')]===0x1f4){logger[_0x2c13('0x25')](_0x2c13('0x21'),_0x4455c6,_0x230488['error'][_0x2c13('0x27')]);return _0x28525c(_0x230488[_0x2c13('0x25')][_0x2c13('0x27')]);}logger['error'](_0x2c13('0x21'),_0x4455c6,_0x230488[_0x2c13('0x25')][_0x2c13('0x27')]);return _0x44c9af(_0x230488['error'][_0x2c13('0x27')]);}else{logger[_0x2c13('0x20')](_0x2c13('0x21'),_0x4455c6,_0x2c13('0x28'));_0x44c9af(_0x230488[_0x2c13('0x29')][_0x2c13('0x27')]);}})[_0x2c13('0x2a')](function(_0x16e51f){logger[_0x2c13('0x25')](_0x2c13('0x21'),_0x4455c6,_0x16e51f);_0x28525c(_0x16e51f);});});}function respondWithStatusCode(_0x300ca5,_0x18267d){_0x18267d=_0x18267d||0xcc;return function(_0x25b1ab){if(_0x25b1ab){return _0x300ca5[_0x2c13('0x2b')](_0x18267d);}return _0x300ca5[_0x2c13('0x2c')](_0x18267d)[_0x2c13('0x2d')]();};}function respondWithResult(_0x4fe6e0,_0x3f58b9){_0x3f58b9=_0x3f58b9||0xc8;return function(_0x408618){if(_0x408618){return _0x4fe6e0['status'](_0x3f58b9)[_0x2c13('0x2e')](_0x408618);}};}function respondWithFilteredResult(_0x1ce36a,_0x14903c){return function(_0x4e1204){if(_0x4e1204){var _0x230bb1=typeof _0x14903c[_0x2c13('0x2f')]===_0x2c13('0x30')&&typeof _0x14903c['limit']==='undefined';var _0x3e0fb9=_0x4e1204[_0x2c13('0x31')];var _0x127d13=_0x230bb1?0x0:_0x14903c['offset'];var _0x54dc2b=_0x230bb1?_0x4e1204[_0x2c13('0x31')]:_0x14903c['offset']+_0x14903c[_0x2c13('0x32')];var _0x1fb74d;if(_0x54dc2b>=_0x3e0fb9){_0x54dc2b=_0x3e0fb9;_0x1fb74d=0xc8;}else{_0x1fb74d=0xce;}_0x1ce36a['status'](_0x1fb74d);return _0x1ce36a['set'](_0x2c13('0x33'),_0x127d13+'-'+_0x54dc2b+'/'+_0x3e0fb9)[_0x2c13('0x2e')](_0x4e1204);}return null;};}function patchUpdates(_0x191a57){return function(_0x364ad9){try{jsonpatch[_0x2c13('0x34')](_0x364ad9,_0x191a57,!![]);}catch(_0x401f8e){return BPromise[_0x2c13('0x35')](_0x401f8e);}return _0x364ad9[_0x2c13('0x36')]();};}function saveUpdates(_0x5b8d57,_0x13fa2e){return function(_0x1db679){if(_0x1db679){return _0x1db679[_0x2c13('0x37')](_0x5b8d57)[_0x2c13('0x1f')](function(_0x3ace52){return _0x3ace52;});}return null;};}function removeEntity(_0x53c7ca,_0x362431){return function(_0x395cfc){if(_0x395cfc){return _0x395cfc[_0x2c13('0x38')]()[_0x2c13('0x1f')](function(){_0x53c7ca[_0x2c13('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a78ab,_0x4bb9b7){return function(_0x431fa5){if(!_0x431fa5){_0x2a78ab['sendStatus'](0x194);}return _0x431fa5;};}function handleError(_0x31bd81,_0x3ce49a){_0x3ce49a=_0x3ce49a||0x1f4;return function(_0x54a11e){logger[_0x2c13('0x25')](_0x54a11e[_0x2c13('0x39')]);if(_0x54a11e[_0x2c13('0x3a')]){delete _0x54a11e[_0x2c13('0x3a')];}_0x31bd81['status'](_0x3ce49a)[_0x2c13('0x3b')](_0x54a11e);};}exports[_0x2c13('0x3c')]=function(_0x16672d,_0xc677fb){var _0x89b555={},_0x2939ca={},_0x402905={'count':0x0,'rows':[]};var _0x354c45=_[_0x2c13('0x3d')](db[_0x2c13('0x3e')][_0x2c13('0x3f')],function(_0xc85fd1){return{'name':_0xc85fd1[_0x2c13('0x40')],'type':_0xc85fd1['type']['key']};});_0x2939ca[_0x2c13('0x41')]=_['map'](_0x354c45,_0x2c13('0x3a'));_0x2939ca['query']=_[_0x2c13('0x42')](_0x16672d[_0x2c13('0x43')]);_0x2939ca[_0x2c13('0x44')]=_[_0x2c13('0x45')](_0x2939ca[_0x2c13('0x41')],_0x2939ca[_0x2c13('0x43')]);_0x89b555[_0x2c13('0x46')]=_[_0x2c13('0x45')](_0x2939ca[_0x2c13('0x41')],qs[_0x2c13('0x47')](_0x16672d[_0x2c13('0x43')]['fields']));_0x89b555['attributes']=_0x89b555[_0x2c13('0x46')]['length']?_0x89b555[_0x2c13('0x46')]:_0x2939ca[_0x2c13('0x41')];if(!_0x16672d['query']['hasOwnProperty']('nolimit')){_0x89b555[_0x2c13('0x32')]=qs['limit'](_0x16672d[_0x2c13('0x43')]['limit']);_0x89b555['offset']=qs[_0x2c13('0x2f')](_0x16672d[_0x2c13('0x43')][_0x2c13('0x2f')]);}_0x89b555[_0x2c13('0x48')]=qs[_0x2c13('0x49')](_0x16672d[_0x2c13('0x43')][_0x2c13('0x49')]);_0x89b555[_0x2c13('0x4a')]=qs[_0x2c13('0x44')](_[_0x2c13('0x4b')](_0x16672d[_0x2c13('0x43')],_0x2939ca[_0x2c13('0x44')]),_0x354c45);if(_0x16672d[_0x2c13('0x43')]['filter']){_0x89b555[_0x2c13('0x4a')]=_[_0x2c13('0x4c')](_0x89b555[_0x2c13('0x4a')],{'$or':_[_0x2c13('0x3d')](_0x354c45,function(_0x414479){if(_0x414479[_0x2c13('0x4d')]!=='VIRTUAL'){var _0x1a3d78={};_0x1a3d78[_0x414479[_0x2c13('0x3a')]]={'$like':'%'+_0x16672d['query'][_0x2c13('0x4e')]+'%'};return _0x1a3d78;}})});}_0x89b555=_[_0x2c13('0x4c')]({},_0x89b555,_0x16672d[_0x2c13('0x4f')]);var _0x41d977={'where':_0x89b555[_0x2c13('0x4a')]};return db[_0x2c13('0x3e')][_0x2c13('0x31')](_0x41d977)[_0x2c13('0x1f')](function(_0x380d7b){_0x402905[_0x2c13('0x31')]=_0x380d7b;if(_0x16672d[_0x2c13('0x43')]['includeAll']){_0x89b555[_0x2c13('0x50')]=[{'all':!![]}];}return db[_0x2c13('0x3e')][_0x2c13('0x51')](_0x89b555);})[_0x2c13('0x1f')](function(_0x13a1ca){_0x402905['rows']=_0x13a1ca;return _0x402905;})[_0x2c13('0x1f')](respondWithFilteredResult(_0xc677fb,_0x89b555))[_0x2c13('0x2a')](handleError(_0xc677fb,null));};exports['show']=function(_0x767e64,_0xc67e0){var _0xa51f6a={'raw':!![],'where':{'id':_0x767e64[_0x2c13('0x52')]['id']}},_0x256963={};_0x256963['model']=_[_0x2c13('0x42')](db['SmsMessage']['rawAttributes']);_0x256963[_0x2c13('0x43')]=_[_0x2c13('0x42')](_0x767e64[_0x2c13('0x43')]);_0x256963[_0x2c13('0x44')]=_[_0x2c13('0x45')](_0x256963['model'],_0x256963[_0x2c13('0x43')]);_0xa51f6a['attributes']=_['intersection'](_0x256963[_0x2c13('0x41')],qs[_0x2c13('0x47')](_0x767e64['query']['fields']));_0xa51f6a[_0x2c13('0x46')]=_0xa51f6a[_0x2c13('0x46')]['length']?_0xa51f6a[_0x2c13('0x46')]:_0x256963[_0x2c13('0x41')];if(_0x767e64[_0x2c13('0x43')]['includeAll']){_0xa51f6a['include']=[{'all':!![]}];}_0xa51f6a=_[_0x2c13('0x4c')]({},_0xa51f6a,_0x767e64['options']);return db[_0x2c13('0x3e')][_0x2c13('0x53')](_0xa51f6a)[_0x2c13('0x1f')](handleEntityNotFound(_0xc67e0,null))['then'](respondWithResult(_0xc67e0,null))[_0x2c13('0x2a')](handleError(_0xc67e0,null));};exports[_0x2c13('0x54')]=function(_0x243863,_0x217b74){return db[_0x2c13('0x3e')]['create'](_0x243863[_0x2c13('0x55')],{})[_0x2c13('0x1f')](respondWithResult(_0x217b74,0xc9))['catch'](handleError(_0x217b74,null));};exports[_0x2c13('0x37')]=function(_0x270d53,_0x185c4c){if(_0x270d53[_0x2c13('0x55')]['id']){delete _0x270d53[_0x2c13('0x55')]['id'];}return db['SmsMessage'][_0x2c13('0x53')]({'where':{'id':_0x270d53[_0x2c13('0x52')]['id']}})['then'](handleEntityNotFound(_0x185c4c,null))[_0x2c13('0x1f')](saveUpdates(_0x270d53['body'],null))['then'](respondWithResult(_0x185c4c,null))[_0x2c13('0x2a')](handleError(_0x185c4c,null));};exports[_0x2c13('0x38')]=function(_0x384ddf,_0x14938e){return db[_0x2c13('0x3e')][_0x2c13('0x53')]({'where':{'id':_0x384ddf['params']['id']}})['then'](handleEntityNotFound(_0x14938e,null))[_0x2c13('0x1f')](removeEntity(_0x14938e,null))[_0x2c13('0x2a')](handleError(_0x14938e,null));};exports[_0x2c13('0x56')]=function(_0x5726af,_0x1efb90){return db[_0x2c13('0x3e')]['describe']()[_0x2c13('0x1f')](respondWithResult(_0x1efb90,null))['catch'](handleError(_0x1efb90,null));};var interaction_log=require(_0x2c13('0x57'))(_0x2c13('0x58'));exports[_0x2c13('0x59')]=function(_0x1a2273,_0x4b5682,_0xa6f50c){var _0x5c5178={'agent':{},'channel':_0x2c13('0x5a')};if(_0x1a2273[_0x2c13('0x55')]['id']){delete _0x1a2273[_0x2c13('0x55')]['id'];}_0x1a2273[_0x2c13('0x55')]['read']=!![];_0x1a2273['body']['readAt']=moment()[_0x2c13('0x5b')](_0x2c13('0x5c'));_0x1a2273[_0x2c13('0x55')][_0x2c13('0x5d')]=_0x1a2273['body'][_0x2c13('0x5d')]||_0x1a2273[_0x2c13('0x5e')]['id'];_0x5c5178[_0x2c13('0x5f')]['id']=_0x1a2273['body'][_0x2c13('0x5d')];return db['SmsMessage'][_0x2c13('0x53')]({'where':{'id':_0x1a2273[_0x2c13('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b5682,null))[_0x2c13('0x1f')](saveUpdates(_0x1a2273[_0x2c13('0x55')],null))[_0x2c13('0x1f')](function(_0x354fff){if(_0x354fff){_0x5c5178[_0x2c13('0x27')]=_0x354fff[_0x2c13('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x2c13('0x53')]({'where':{'id':_0x354fff['SmsInteractionId']}});}return null;})[_0x2c13('0x1f')](handleEntityNotFound(_0x4b5682,null))[_0x2c13('0x1f')](function(_0x24cda5){if(_0x24cda5){return _0x24cda5['update']({'UserId':_0x1a2273[_0x2c13('0x55')][_0x2c13('0x5d')],'read1stAt':_[_0x2c13('0x61')](_0x24cda5[_0x2c13('0x62')])?moment()[_0x2c13('0x5b')](_0x2c13('0x5c')):undefined});}return null;})[_0x2c13('0x1f')](function(_0x451005){if(_0x451005){_0x5c5178[_0x2c13('0x63')]=_0x451005[_0x2c13('0x60')]({'plain':!![]});interaction_log['info'](_0x2c13('0x64'),_0x1a2273[_0x2c13('0x5e')]['id'],_0x1a2273[_0x2c13('0x5e')][_0x2c13('0x3a')],_0x1a2273[_0x2c13('0x5e')]['role'],_0x5c5178[_0x2c13('0x63')]['id'],_0x1a2273[_0x2c13('0x55')]?JSON[_0x2c13('0x24')](_0x1a2273[_0x2c13('0x55')]):'null');return respondWithRpcPromise(_0x2c13('0x65'),_0x2c13('0x66'),_0x5c5178);}return null;})[_0x2c13('0x1f')](function(_0x4d4692){var _0x5cb3c3=_0x2c13('0x67')+_0x4d4692[_0x2c13('0x27')][_0x2c13('0x68')];return db['sequelize']['query'](_0x5cb3c3,{'type':db[_0x2c13('0x69')][_0x2c13('0x6a')][_0x2c13('0x6b')],'raw':!![]})[_0x2c13('0x1f')](function(_0x3561c4){return _0x3561c4;});})[_0x2c13('0x1f')](function(_0x4d8511){if(_0x4d8511){_0x5c5178['message'][_0x2c13('0x6c')]=_0x4d8511[0x0];if(!_0x1a2273[_0x2c13('0x55')]['UserId'])return;return db['User'][_0x2c13('0x53')]({'where':{'id':_0x1a2273[_0x2c13('0x55')][_0x2c13('0x5d')],'role':_0x2c13('0x5f')},'attributes':['id',_0x2c13('0x3a'),_0x2c13('0x6d'),_0x2c13('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2d3cca){if(!_0x2d3cca)return null;_0x5c5178['message'][_0x2c13('0x5f')]=_0x2d3cca;return _0x5c5178;})['then'](function(_0x4b851a){if(_0x4b851a){if(_0x1a2273[_0x2c13('0x55')][_0x2c13('0x6f')]){_0x5c5178[_0x2c13('0x27')][_0x2c13('0x70')]=util[_0x2c13('0x5b')]('SIP/%s',_0x1a2273[_0x2c13('0x5e')][_0x2c13('0x3a')]);_0x5c5178[_0x2c13('0x27')][_0x2c13('0x71')]=_0x5c5178['channel'];_0x5c5178['message'][_0x2c13('0x72')]=_0x5c5178['channel'];_0x5c5178['message'][_0x2c13('0x73')]=_0x2c13('0x59');return respondWithRpcPromise(_0x2c13('0x74'),_0x2c13('0x74'),{'event':_0x2c13('0x75'),'message':_0x5c5178['message']},client9002)[_0x2c13('0x1f')](function(){return _0x5c5178;});}return _0x5c5178;}return null;})[_0x2c13('0x1f')](respondWithResult(_0x4b5682,null))[_0x2c13('0x2a')](handleError(_0x4b5682,null));};var interaction_log=require(_0x2c13('0x57'))(_0x2c13('0x58'));exports[_0x2c13('0x35')]=function(_0x417752,_0x156f3c,_0x44f5b8){var _0x33e0b0={'agent':{},'channel':_0x2c13('0x5a')};if(_0x417752[_0x2c13('0x55')]['id']){delete _0x417752[_0x2c13('0x55')]['id'];}_0x417752[_0x2c13('0x55')][_0x2c13('0x5d')]=_0x417752[_0x2c13('0x55')][_0x2c13('0x5d')]||_0x417752[_0x2c13('0x5e')]['id'];_0x33e0b0['agent']['id']=_0x417752[_0x2c13('0x55')]['UserId'];return db[_0x2c13('0x3e')]['find']({'where':{'id':_0x417752[_0x2c13('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x156f3c,null))[_0x2c13('0x1f')](function(_0x49da0f){if(_0x49da0f){_0x33e0b0['message']=_0x49da0f[_0x2c13('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x2c13('0x53')]({'where':{'id':_0x49da0f[_0x2c13('0x76')]}});}return null;})[_0x2c13('0x1f')](handleEntityNotFound(_0x156f3c,null))['then'](function(_0x2b391d){if(_0x2b391d){_0x33e0b0[_0x2c13('0x63')]=_0x2b391d[_0x2c13('0x60')]({'plain':!![]});interaction_log[_0x2c13('0x20')](_0x2c13('0x77'),_0x417752[_0x2c13('0x5e')]['id'],_0x417752[_0x2c13('0x5e')]['name'],_0x417752['user'][_0x2c13('0x78')],_0x33e0b0[_0x2c13('0x63')]['id'],_0x417752['body']?JSON[_0x2c13('0x24')](_0x417752[_0x2c13('0x55')]):_0x2c13('0x79'));return respondWithRpcPromise(_0x2c13('0x7a'),_0x2c13('0x7b'),_0x33e0b0);}return null;})[_0x2c13('0x1f')](function(_0x4d2502){var _0x3923a5=_0x2c13('0x67')+_0x4d2502['message'][_0x2c13('0x68')];return db[_0x2c13('0x7c')][_0x2c13('0x43')](_0x3923a5,{'type':db[_0x2c13('0x69')][_0x2c13('0x6a')][_0x2c13('0x6b')],'raw':!![]})['then'](function(_0xca71f){return _0xca71f;});})[_0x2c13('0x1f')](function(_0x1b85ee){if(_0x1b85ee){_0x33e0b0['message']['contact']=_0x1b85ee[0x0];if(!_0x417752[_0x2c13('0x55')][_0x2c13('0x5d')])return;return db[_0x2c13('0x7d')][_0x2c13('0x53')]({'where':{'id':_0x417752[_0x2c13('0x55')]['UserId'],'role':_0x2c13('0x5f')},'attributes':['id',_0x2c13('0x3a'),_0x2c13('0x6d'),_0x2c13('0x6e'),_0x2c13('0x7e')],'raw':!![]});}return null;})[_0x2c13('0x1f')](function(_0x30b0b2){if(!_0x30b0b2)return null;_0x33e0b0[_0x2c13('0x27')]['agent']=_0x30b0b2;return _0x33e0b0;})['then'](function(_0x2ec75f){if(_0x2ec75f){_0x2ec75f[_0x2c13('0x27')][_0x2c13('0x70')]=util[_0x2c13('0x5b')](_0x2c13('0x7f'),_0x417752[_0x2c13('0x5e')]['name']);_0x2ec75f['message'][_0x2c13('0x71')]=_0x33e0b0[_0x2c13('0x71')];_0x2ec75f['message'][_0x2c13('0x72')]=_0x33e0b0[_0x2c13('0x71')];_0x2ec75f[_0x2c13('0x27')][_0x2c13('0x73')]='reject';respondWithRpcPromise(_0x2c13('0x74'),'EventManager',{'event':_0x2c13('0x80'),'message':_0x2ec75f[_0x2c13('0x27')]},client9002);return _0x33e0b0;}return null;})[_0x2c13('0x1f')](respondWithResult(_0x156f3c,null))[_0x2c13('0x2a')](handleError(_0x156f3c,null));};exports[_0x2c13('0x2c')]=function(_0x4c21a6,_0xa7780c,_0x4aae8d){if(_0x4c21a6[_0x2c13('0x55')]['id']){delete _0x4c21a6[_0x2c13('0x55')]['id'];}var _0x36c64f;return db[_0x2c13('0x3e')][_0x2c13('0x53')]({'where':{'id':_0x4c21a6[_0x2c13('0x52')]['id']}})[_0x2c13('0x1f')](handleEntityNotFound(_0xa7780c,null))[_0x2c13('0x1f')](function(_0x3d6c2a){if(_0x3d6c2a){_0x36c64f=_0x3d6c2a;return db[_0x2c13('0x81')][_0x2c13('0x53')]({'where':{'id':_0x3d6c2a[_0x2c13('0x82')]}});}})['then'](handleEntityNotFound(_0xa7780c,null))[_0x2c13('0x1f')](function(_0x242d10){if(_0x242d10){logger[_0x2c13('0x22')](_0x2c13('0x23'),_0x2c13('0x2c'),_0x2c13('0x83'),_0x242d10[_0x2c13('0x4d')],util['inspect'](_0x4c21a6[_0x2c13('0x55')],{'showHidden':![],'depth':null}));switch(_0x242d10[_0x2c13('0x4d')]){case _0x2c13('0x84'):if(_0x4c21a6[_0x2c13('0x55')][_0x2c13('0x85')]&&_0x4c21a6['body'][_0x2c13('0x85')]===_0x36c64f[_0x2c13('0x86')]){return _0x36c64f['update']({'read':!![]});}else{logger[_0x2c13('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c13('0x2c'),_0x2c13('0x84'),util[_0x2c13('0x87')](_0x4c21a6[_0x2c13('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2c13('0x88'):if(_0x4c21a6['body'][_0x2c13('0x89')]&&_0x4c21a6[_0x2c13('0x55')][_0x2c13('0x89')]===_0x36c64f[_0x2c13('0x86')]&&_[_0x2c13('0x8a')]([_0x2c13('0x8b'),_0x2c13('0x8c')],_0x4c21a6[_0x2c13('0x55')][_0x2c13('0x8d')])>=0x0){return _0x36c64f[_0x2c13('0x37')]({'read':!![]});}else{logger[_0x2c13('0x25')](_0x2c13('0x8e'),'status',_0x2c13('0x8f'),util[_0x2c13('0x87')](_0x4c21a6[_0x2c13('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2c13('0x90'):var _0x24c82c=_0x4c21a6[_0x2c13('0x55')][_0x2c13('0x91')][0x0];if(_0x24c82c['status'][_0x2c13('0x92')]===_0x2c13('0x93')){return _0x36c64f[_0x2c13('0x37')]({'read':!![]});}else{logger[_0x2c13('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2c13('0x90'),util[_0x2c13('0x87')](_0x4c21a6[_0x2c13('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x36c64f;}})[_0x2c13('0x1f')](respondWithResult(_0xa7780c,null))[_0x2c13('0x2a')](handleError(_0xa7780c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 16d9a6d..f37969d 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 _0x6f94=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x6f94,0x1cb));var _0x46f9=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6f94[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0x46f9('0x0'));var SmsMessage=require(_0x46f9('0x1'))['db'][_0x46f9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28732a){return function(_0x1f8385,_0x52e085,_0xe53dd8){SmsMessageEvents[_0x46f9('0x3')](_0x28732a+':'+_0x1f8385['id'],_0x1f8385);SmsMessageEvents[_0x46f9('0x3')](_0x28732a,_0x1f8385);_0xe53dd8(null);};}for(var e in events){if(events[_0x46f9('0x4')](e)){var event=events[e];SmsMessage[_0x46f9('0x5')](e,emitEvent(event));}}module[_0x46f9('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xda53=['remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','update'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xda53,0x1a7));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3da5('0x0'));var SmsMessage=require(_0x3da5('0x1'))['db'][_0x3da5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3da5('0x3'),'afterDestroy':_0x3da5('0x4')};function emitEvent(_0x256805){return function(_0x19e819,_0x41d746,_0x4ec74a){SmsMessageEvents[_0x3da5('0x5')](_0x256805+':'+_0x19e819['id'],_0x19e819);SmsMessageEvents[_0x3da5('0x5')](_0x256805,_0x19e819);_0x4ec74a(null);};}for(var e in events){if(events[_0x3da5('0x6')](e)){var event=events[e];SmsMessage['hook'](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 a5e8b54..7ab3d01 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 _0x3430=['https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','&password=','password','sms','POST','user_key','internal_order_id','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','messages','message_id','clickSend','plivo','authId','/status?token=','format','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','username','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','sort','length','createHash','hex','GET','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','apiKey','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','body','remote','/api/sms/messages/','token','then','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x537671,_0x2aedfc){var _0x3e0899=function(_0x292b3e){while(--_0x292b3e){_0x537671['push'](_0x537671['shift']());}};_0x3e0899(++_0x2aedfc);}(_0x3430,0xc8));var _0x0343=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x3430[_0x4b91c4];return _0x25cb80;};'use strict';var _=require('lodash');var util=require(_0x0343('0x0'));var logger=require(_0x0343('0x1'))(_0x0343('0x2'));var moment=require(_0x0343('0x3'));var BPromise=require(_0x0343('0x4'));var rp=require(_0x0343('0x5'));var fs=require('fs');var path=require(_0x0343('0x6'));var rimraf=require('rimraf');var config=require(_0x0343('0x7'));var attributes=require(_0x0343('0x8'));module[_0x0343('0x9')]=function(_0x194de9,_0x1fcc90){return _0x194de9[_0x0343('0xa')](_0x0343('0xb'),attributes,{'tableName':_0x0343('0xc'),'paranoid':![],'indexes':[{'name':_0x0343('0xd'),'fields':['messageId']},{'name':_0x0343('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b8886,_0x322a07,_0x5d7f36){var _0x4d948d=_0x194de9[_0x0343('0xf')];var _0x582b1f=_0x1b8886['get']({'plain':!![]});if(_0x582b1f[_0x0343('0x10')][_0x0343('0x11')]()==='in'||_0x582b1f[_0x0343('0x10')]['toLowerCase']()===_0x0343('0x12')&&!_0x582b1f[_0x0343('0x13')]&&!_[_0x0343('0x14')](_0x582b1f[_0x0343('0x15')])&&!_[_0x0343('0x14')](_0x582b1f['SmsInteractionId'])){_0x4d948d['SmsInteraction'][_0x0343('0x16')]({'where':{'id':_0x582b1f[_0x0343('0x17')]}})['then'](function(_0x504cb1){if(_0x504cb1){_0x504cb1[_0x0343('0x18')]({'lastMsgAt':_0x582b1f[_0x0343('0x19')],'lastMsgDirection':_0x582b1f[_0x0343('0x10')][_0x0343('0x11')]()});}})['catch'](function(_0x511a82){console[_0x0343('0x1a')](_0x511a82);});}if(_0x582b1f[_0x0343('0x10')]==='out'&&!_0x582b1f[_0x0343('0x13')]){var _0x396c2e;_0x4d948d[_0x0343('0x1b')][_0x0343('0x1c')]({'where':{'id':_0x582b1f[_0x0343('0x1d')]},'raw':!![]})['then'](function(_0x3f22a5){_0x396c2e=_0x3f22a5;if(_0x396c2e&&_0x396c2e[_0x0343('0x1e')]){switch(_0x396c2e['type']){case _0x0343('0x1f'):var _0x5d8cbf=require(_0x0343('0x1f'));if(_0x396c2e[_0x0343('0x20')]&&_0x396c2e[_0x0343('0x21')]&&_0x396c2e[_0x0343('0x22')]){var _0x5adf2b=new _0x5d8cbf(_0x396c2e[_0x0343('0x20')],_0x396c2e[_0x0343('0x21')]);_0x5adf2b['messages'][_0x0343('0x23')]({'body':_0x582b1f[_0x0343('0x24')],'to':_0x582b1f[_0x0343('0x22')],'from':_0x396c2e[_0x0343('0x22')],'statusCallback':_0x396c2e[_0x0343('0x25')]+_0x0343('0x26')+_0x582b1f['id']+'/status?token='+_0x396c2e[_0x0343('0x27')]})[_0x0343('0x28')](function(_0x43d340){if(_0x43d340[_0x0343('0x29')]){return _0x1b8886[_0x0343('0x18')]({'messageId':_0x43d340[_0x0343('0x29')]});}})[_0x0343('0x2a')](function(_0x45c5a4){logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x1f'),util['inspect'](_0x45c5a4,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x0343('0x2d'));}break;case'skebby':var _0x52aad8=_0x0343('0x2e');if(_0x396c2e['username']&&_0x396c2e['password']){var _0x467a3d={'recipient':[_0x582b1f[_0x0343('0x22')]],'message':_0x582b1f[_0x0343('0x24')],'message_type':_0x396c2e[_0x0343('0x2f')]};if(_0x396c2e[_0x0343('0x2f')]&&_0x396c2e['smsMethod']!=='SI'){_0x467a3d['sender']=_0x396c2e['phone'];}var _0x413fd0={'url':_0x52aad8+_0x0343('0x30')+_0x396c2e['username']+_0x0343('0x31')+_0x396c2e[_0x0343('0x32')],'method':'GET'};rp(_0x413fd0)[_0x0343('0x28')](function(_0x5a1ca2){var _0x2dd548=_0x5a1ca2['split'](';');var _0x399973={'user_key':_0x2dd548[0x0],'session_key':_0x2dd548[0x1]};_0x413fd0={'url':_0x52aad8+_0x0343('0x33'),'method':_0x0343('0x34'),'headers':{'user_key':_0x399973[_0x0343('0x35')],'Session_key':_0x399973['session_key']},'json':!![],'body':_0x467a3d};return rp(_0x413fd0);})[_0x0343('0x28')](function(_0x3a3b5c){if(_0x3a3b5c['total_sent']>=0x1){var _0x3a87b0={'messageId':_0x3a3b5c[_0x0343('0x36')]};if(_0x396c2e[_0x0343('0x2f')]!=='GP'||!_0x396c2e['deliveryReport']){_0x3a87b0[_0x0343('0x37')]=!![];}return _0x1b8886['update'](_0x3a87b0);}else{return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x38'),util[_0x0343('0x39')](_0x3a3b5c,{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x33218a){return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x38'),util[_0x0343('0x39')](_0x33218a,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x38'),_0x0343('0x3a'));}break;case'connectel':if(_0x396c2e[_0x0343('0x21')]){var _0x5a00eb={'recipient':_0x582b1f['phone'],'message':_0x582b1f['body'],'sender':_0x396c2e[_0x0343('0x3b')]||_0x396c2e[_0x0343('0x22')],'authorization':_0x396c2e[_0x0343('0x21')]};var _0x322a07={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5a00eb,'json':!![]};rp(_0x322a07)[_0x0343('0x28')](function(_0x31a5eb){var _0x44cc22={'messageId':_0x31a5eb['requestid']};if(!_0x396c2e[_0x0343('0x3c')]){_0x44cc22[_0x0343('0x37')]=!![];}return _0x1b8886[_0x0343('0x18')](_0x44cc22);})['catch'](function(_0x42390f){logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x3d'),util[_0x0343('0x39')](_0x42390f,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x3d'),_0x0343('0x3e'));}break;case _0x0343('0x3f'):if(_0x396c2e['username']&&_0x396c2e['password']){var _0x5a00eb={'messages':[{'source':_0x0343('0x40'),'to':_0x582b1f[_0x0343('0x22')],'body':_0x582b1f[_0x0343('0x24')],'from':_0x396c2e[_0x0343('0x3b')]||_0x396c2e['phone']}]};var _0x2fd1a8=util['format'](_0x0343('0x41'),_0x396c2e['username'],_0x396c2e[_0x0343('0x32')]);var _0x322a07={'method':_0x0343('0x34'),'uri':_0x0343('0x42'),'body':_0x5a00eb,'headers':{'Authorization':util['format'](_0x0343('0x43'),new Buffer(_0x2fd1a8)[_0x0343('0x44')](_0x0343('0x45')))},'json':!![]};rp(_0x322a07)['then'](function(_0xa99e8f){if(_0xa99e8f['http_code']>=0xc8&&_0xa99e8f[_0x0343('0x46')]<=0xce){if(_0xa99e8f['data']&&_0xa99e8f['data'][_0x0343('0x47')]>0x0){var _0x3af895=_[_0x0343('0x48')](_0xa99e8f['data'][_0x0343('0x49')]);var _0x149bc1={'messageId':_0x3af895[_0x0343('0x4a')]};if(!_0x396c2e[_0x0343('0x3c')]){_0x149bc1[_0x0343('0x37')]=!![];}return _0x1b8886[_0x0343('0x18')](_0x149bc1);}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),'clickSend',util[_0x0343('0x39')](_0xa99e8f,{'showHidden':![],'depth':null}));}}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),'afterCreate','clickSend',util[_0x0343('0x39')](_0xa99e8f,{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x39b6aa){logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x4b'),util[_0x0343('0x39')](_0x39b6aa,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x4b'),_0x0343('0x3a'));}break;case _0x0343('0x4c'):if(_0x396c2e[_0x0343('0x4d')]&&_0x396c2e[_0x0343('0x21')]){var _0x5a00eb={'dst':_0x582b1f['phone'],'text':_0x582b1f[_0x0343('0x24')],'src':_0x396c2e['senderString']||_0x396c2e[_0x0343('0x22')],'url':_0x396c2e[_0x0343('0x25')]+_0x0343('0x26')+_0x582b1f['id']+_0x0343('0x4e')+_0x396c2e[_0x0343('0x27')]};var _0x2fd1a8=util[_0x0343('0x4f')]('%s:%s',_0x396c2e[_0x0343('0x4d')],_0x396c2e[_0x0343('0x21')]);var _0x322a07={'method':_0x0343('0x34'),'uri':util[_0x0343('0x4f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x396c2e[_0x0343('0x4d')]),'body':_0x5a00eb,'headers':{'Authorization':util[_0x0343('0x4f')]('Basic\x20%s',new Buffer(_0x2fd1a8)[_0x0343('0x44')](_0x0343('0x45')))},'json':!![]};rp(_0x322a07)['then'](function(_0x23da67){var _0x1cbf2c={'messageId':_0x23da67[_0x0343('0x50')][0x0]};return _0x1b8886[_0x0343('0x18')](_0x1cbf2c);})['catch'](function(_0x153f95){logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x4c'),util[_0x0343('0x39')](_0x153f95,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x4c'),_0x0343('0x51'));}break;case _0x0343('0x52'):if(_0x396c2e['username']&&_0x396c2e[_0x0343('0x32')]){if(_0x396c2e[_0x0343('0x53')]){var _0x55e270={'method':_0x0343('0x34'),'uri':_0x396c2e[_0x0343('0x53')]+_0x0343('0x54'),'body':{'username':_0x396c2e[_0x0343('0x55')],'password':_0x396c2e['password']},'json':!![]};return rp(_0x55e270)[_0x0343('0x28')](function(_0x133600){var _0x5c89f7={'method':'POST','uri':_0x396c2e[_0x0343('0x53')]+_0x0343('0x56'),'body':{'messages':[{'from':_0x396c2e[_0x0343('0x22')],'destinations':[{'to':_0x582b1f[_0x0343('0x22')]}],'text':_0x582b1f[_0x0343('0x24')],'notifyUrl':_0x396c2e[_0x0343('0x25')]+_0x0343('0x26')+_0x582b1f['id']+_0x0343('0x4e')+_0x396c2e[_0x0343('0x27')],'notifyContentType':_0x0343('0x57'),'callbackData':_0x396c2e[_0x0343('0x22')]+';'+_0x582b1f['body']}]},'headers':{'Authorization':_0x0343('0x58')+_0x133600[_0x0343('0x27')]},'json':!![]};return rp(_0x5c89f7)['then'](function(_0x54ac0a){if(_0x54ac0a['messages']){var _0x1d5a54={'messageId':_0x54ac0a[_0x0343('0x49')][0x0]['messageId']};if(!_0x396c2e[_0x0343('0x3c')]){_0x1d5a54[_0x0343('0x37')]=!![];}return _0x1b8886[_0x0343('0x18')](_0x1d5a54);}else{return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),'infobip',util[_0x0343('0x39')](_0x54ac0a,{'showHidden':![],'depth':null}));}});})[_0x0343('0x2a')](function(_0x9c0d79){return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x52'),util[_0x0343('0x39')](_0x9c0d79,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x52'),_0x0343('0x59'));}}else{logger[_0x0343('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0343('0x2c'),_0x0343('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0343('0x5a'):var _0x54f652=require('crypto');if(_0x396c2e['apiKey']){var _0x3ce9b7={};_0x3ce9b7[_0x0343('0x5b')]=_0x396c2e[_0x0343('0x55')];_0x3ce9b7['phone']=_0x582b1f[_0x0343('0x22')];_0x3ce9b7['sender']=_0x396c2e[_0x0343('0x22')];_0x3ce9b7[_0x0343('0x5c')]=_0x582b1f[_0x0343('0x24')];_0x3ce9b7[_0x0343('0x5d')]=+new Date();var _0x1c9cd5='';var _0x5312c5='';var _0x2da6f4=Object['keys'](_0x3ce9b7);_0x2da6f4[_0x0343('0x5e')]();for(var _0x22f9c9=0x0;_0x22f9c9<_0x2da6f4[_0x0343('0x5f')];_0x22f9c9++){if(_0x1c9cd5!=''){_0x1c9cd5+='&';}_0x1c9cd5+=_0x2da6f4[_0x22f9c9]+'='+encodeURIComponent(_0x3ce9b7[_0x2da6f4[_0x22f9c9]]);_0x5312c5+=_0x3ce9b7[_0x2da6f4[_0x22f9c9]];}_0x5312c5+=_0x396c2e['apiKey'];_0x5312c5=_0x54f652[_0x0343('0x60')]('md5')['update'](_0x5312c5)['digest'](_0x0343('0x61'));if(_0x1c9cd5!==''){_0x1c9cd5+='&';}_0x1c9cd5+='signature='+_0x5312c5;var _0x413fd0={'method':_0x0343('0x62'),'uri':_0x396c2e[_0x0343('0x53')]+_0x0343('0x63')+_0x1c9cd5,'json':!![]};return rp(_0x413fd0)[_0x0343('0x28')](function(_0x5c9d1e){var _0x262baf=Object[_0x0343('0x64')](_0x5c9d1e);if(_0x5c9d1e[_0x262baf[0x0]]['error']&&parseInt(_0x5c9d1e[_0x262baf[0x0]][_0x0343('0x1a')])===0x0){var _0x4ec233={'messageId':_0x5c9d1e[_0x262baf[0x0]]['id_sms']};if(!_0x396c2e[_0x0343('0x3c')]){_0x4ec233[_0x0343('0x37')]=!![];}return _0x1b8886[_0x0343('0x18')](_0x4ec233);}else{return logger['error'](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x5a'),util[_0x0343('0x39')](_0x5c9d1e['error'],{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x3f1c0f){return logger[_0x0343('0x1a')](_0x0343('0x2b'),'afterCreate',_0x0343('0x5a'),util[_0x0343('0x39')](_0x3f1c0f,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),'csc',_0x0343('0x65'));}break;case'clickatell':if(_0x396c2e['apiKey']){var _0x1f7d12={'method':_0x0343('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x396c2e[_0x0343('0x66')]},'body':{'content':_0x582b1f[_0x0343('0x24')],'to':[_0x582b1f[_0x0343('0x22')]],'from':_0x396c2e[_0x0343('0x22')],'binary':![],'clientMessageId':_0x0343('0x67'),'charset':_0x0343('0x68')},'json':!![]};rp(_0x1f7d12)['then'](function(_0x13ea85){if(!_0x13ea85[_0x0343('0x1a')]){var _0x49952f={'messageId':_0x13ea85[_0x0343('0x49')][0x0][_0x0343('0x69')]};if(!_0x396c2e[_0x0343('0x3c')]){_0x49952f[_0x0343('0x37')]=!![];}return _0x1b8886[_0x0343('0x18')](_0x49952f);}else{return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x6a'),util['inspect'](_0x13ea85[_0x0343('0x1a')],{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x31da9d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0343('0x2c'),_0x0343('0x6a'),util[_0x0343('0x39')](_0x31da9d,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x6a'),_0x0343('0x65'));}break;case _0x0343('0x6b'):if(_0x396c2e[_0x0343('0x55')]&&_0x396c2e[_0x0343('0x32')]){var _0x2fd1a8=util[_0x0343('0x4f')]('%s:%s',_0x396c2e[_0x0343('0x55')],_0x396c2e['password']);var _0x322a07={'method':_0x0343('0x34'),'uri':_0x0343('0x6c')+_0x396c2e[_0x0343('0x6d')]+_0x0343('0x6e'),'body':{'to':[_0x582b1f[_0x0343('0x22')]],'text':_0x582b1f[_0x0343('0x24')],'from':_0x396c2e['phone'],'applicationId':_0x396c2e['applicationId']},'headers':{'Authorization':util['format'](_0x0343('0x43'),new Buffer(_0x2fd1a8)[_0x0343('0x44')](_0x0343('0x45')))},'json':!![]};rp(_0x322a07)['then'](function(_0x3d3f73){if(_0x3d3f73['id']){var _0x25b70c={'messageId':_0x3d3f73['id']};return _0x1b8886[_0x0343('0x18')](_0x25b70c);}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x6b'),util[_0x0343('0x39')](_0x3d3f73,{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x24bc56){logger['error'](_0x0343('0x2b'),'afterCreate','bandwidth',util[_0x0343('0x39')](_0x24bc56,{'showHidden':![],'depth':null}));});}else{logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x0343('0x6f'):if(_0x396c2e[_0x0343('0x66')]){var _0x123f9a={};var _0x413fd0={'method':_0x0343('0x34'),'uri':_0x0343('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x396c2e[_0x0343('0x66')],'Content-Type':'application/json'},'body':{'from':_0x396c2e[_0x0343('0x22')],'to':_0x582b1f[_0x0343('0x22')],'text':_0x582b1f[_0x0343('0x24')]},'json':!![]};return rp(_0x413fd0)['then'](function(_0x14810b){if(_0x14810b[_0x0343('0x71')]==0xca){_0x123f9a[_0x0343('0x72')]=_0x14810b;var _0x4d839f={'method':'POST','uri':_0x0343('0x73'),'headers':{'Authorization':_0x0343('0x74')+_0x396c2e['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x123f9a[_0x0343('0x72')]['refid']},'json':!![]};return rp(_0x4d839f)[_0x0343('0x28')](function(_0x3ea487){_0x123f9a[_0x0343('0x75')]=_0x3ea487;var _0x3b991b={'messageId':_0x123f9a[_0x0343('0x72')][_0x0343('0x76')],'read':!![]};return _0x1b8886[_0x0343('0x18')](_0x3b991b);});}else{return logger[_0x0343('0x1a')](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x6f'),util[_0x0343('0x39')](_0x14810b,{'showHidden':![],'depth':null}));}})[_0x0343('0x2a')](function(_0x201d63){return logger['error'](_0x0343('0x2b'),_0x0343('0x2c'),_0x0343('0x6f'),util[_0x0343('0x39')](_0x201d63,{'showHidden':![],'depth':null}));});}else{return logger[_0x0343('0x1a')](_0x0343('0x2b'),'afterCreate',_0x0343('0x6f'),_0x0343('0x77'));}break;}}})[_0x0343('0x78')](function(){_0x5d7f36();});}else{_0x5d7f36();}}},'charset':_0x0343('0x79'),'collate':_0x0343('0x7a')});}; \ No newline at end of file +var _0x65ea=['login','text','timestamp','keys','sort','length','createHash','md5','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','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','login?username=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x65ea,0x18c));var _0xa65e=function(_0x4781c7,_0x4fea6e){_0x4781c7=_0x4781c7-0x0;var _0x594294=_0x65ea[_0x4781c7];return _0x594294;};'use strict';var _=require(_0xa65e('0x0'));var util=require('util');var logger=require(_0xa65e('0x1'))('api');var moment=require(_0xa65e('0x2'));var BPromise=require('bluebird');var rp=require(_0xa65e('0x3'));var fs=require('fs');var path=require(_0xa65e('0x4'));var rimraf=require(_0xa65e('0x5'));var config=require(_0xa65e('0x6'));var attributes=require('./smsMessage.attributes');module[_0xa65e('0x7')]=function(_0x58d9ee,_0x4aabab){return _0x58d9ee[_0xa65e('0x8')](_0xa65e('0x9'),attributes,{'tableName':_0xa65e('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa65e('0xb')]},{'name':_0xa65e('0xc'),'fields':[_0xa65e('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x449115,_0x359834,_0x3f9ccc){var _0x4aa763=_0x58d9ee[_0xa65e('0xe')];var _0x5f4625=_0x449115[_0xa65e('0xf')]({'plain':!![]});if(_0x5f4625[_0xa65e('0x10')][_0xa65e('0x11')]()==='in'||_0x5f4625[_0xa65e('0x10')][_0xa65e('0x11')]()===_0xa65e('0x12')&&!_0x5f4625[_0xa65e('0x13')]&&!_[_0xa65e('0x14')](_0x5f4625[_0xa65e('0x15')])&&!_['isNil'](_0x5f4625[_0xa65e('0x16')])){_0x4aa763['SmsInteraction'][_0xa65e('0x17')]({'where':{'id':_0x5f4625['SmsInteractionId']}})[_0xa65e('0x18')](function(_0x337483){if(_0x337483){_0x337483['update']({'lastMsgAt':_0x5f4625[_0xa65e('0x19')],'lastMsgDirection':_0x5f4625['direction']['toLowerCase']()});}})[_0xa65e('0x1a')](function(_0xb2fb85){console[_0xa65e('0x1b')](_0xb2fb85);});}if(_0x5f4625[_0xa65e('0x10')]==='out'&&!_0x5f4625[_0xa65e('0x13')]){var _0x256839;_0x4aa763[_0xa65e('0x1c')][_0xa65e('0x1d')]({'where':{'id':_0x5f4625[_0xa65e('0x1e')]},'raw':!![]})[_0xa65e('0x18')](function(_0x25e724){_0x256839=_0x25e724;if(_0x256839&&_0x256839[_0xa65e('0x1f')]){switch(_0x256839['type']){case'twilio':var _0x4caf78=require(_0xa65e('0x20'));if(_0x256839[_0xa65e('0x21')]&&_0x256839[_0xa65e('0x22')]&&_0x256839['phone']){var _0x28bab3=new _0x4caf78(_0x256839[_0xa65e('0x21')],_0x256839[_0xa65e('0x22')]);_0x28bab3[_0xa65e('0x23')][_0xa65e('0x24')]({'body':_0x5f4625[_0xa65e('0xd')],'to':_0x5f4625[_0xa65e('0x25')],'from':_0x256839['phone'],'statusCallback':_0x256839[_0xa65e('0x26')]+_0xa65e('0x27')+_0x5f4625['id']+_0xa65e('0x28')+_0x256839[_0xa65e('0x29')]})[_0xa65e('0x18')](function(_0x13a277){if(_0x13a277[_0xa65e('0x2a')]){return _0x449115[_0xa65e('0x2b')]({'messageId':_0x13a277[_0xa65e('0x2a')]});}})[_0xa65e('0x1a')](function(_0x117a0c){logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x20'),util[_0xa65e('0x2e')](_0x117a0c,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x20'),_0xa65e('0x2f'));}break;case _0xa65e('0x30'):var _0x38c8dc=_0xa65e('0x31');if(_0x256839[_0xa65e('0x32')]&&_0x256839[_0xa65e('0x33')]){var _0xb9b376={'recipient':[_0x5f4625[_0xa65e('0x25')]],'message':_0x5f4625[_0xa65e('0xd')],'message_type':_0x256839[_0xa65e('0x34')]};if(_0x256839[_0xa65e('0x34')]&&_0x256839[_0xa65e('0x34')]!=='SI'){_0xb9b376[_0xa65e('0x35')]=_0x256839['phone'];}var _0x5104fd={'url':_0x38c8dc+_0xa65e('0x36')+_0x256839[_0xa65e('0x32')]+'&password='+_0x256839[_0xa65e('0x33')],'method':_0xa65e('0x37')};rp(_0x5104fd)[_0xa65e('0x18')](function(_0x579388){var _0x2611fe=_0x579388[_0xa65e('0x38')](';');var _0x2a596d={'user_key':_0x2611fe[0x0],'session_key':_0x2611fe[0x1]};_0x5104fd={'url':_0x38c8dc+_0xa65e('0x39'),'method':_0xa65e('0x3a'),'headers':{'user_key':_0x2a596d[_0xa65e('0x3b')],'Session_key':_0x2a596d[_0xa65e('0x3c')]},'json':!![],'body':_0xb9b376};return rp(_0x5104fd);})[_0xa65e('0x18')](function(_0x301ecd){if(_0x301ecd['total_sent']>=0x1){var _0x31da9e={'messageId':_0x301ecd[_0xa65e('0x3d')]};if(_0x256839[_0xa65e('0x34')]!=='GP'||!_0x256839[_0xa65e('0x3e')]){_0x31da9e['read']=!![];}return _0x449115['update'](_0x31da9e);}else{return logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x30'),util[_0xa65e('0x2e')](_0x301ecd,{'showHidden':![],'depth':null}));}})[_0xa65e('0x1a')](function(_0x8aae80){return logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa65e('0x30'),util[_0xa65e('0x2e')](_0x8aae80,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),'afterCreate',_0xa65e('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa65e('0x3f'):if(_0x256839[_0xa65e('0x22')]){var _0x412be3={'recipient':_0x5f4625[_0xa65e('0x25')],'message':_0x5f4625['body'],'sender':_0x256839[_0xa65e('0x40')]||_0x256839[_0xa65e('0x25')],'authorization':_0x256839[_0xa65e('0x22')]};var _0x359834={'method':_0xa65e('0x3a'),'uri':_0xa65e('0x41'),'body':_0x412be3,'json':!![]};rp(_0x359834)[_0xa65e('0x18')](function(_0x3b676b){var _0x2ab908={'messageId':_0x3b676b['requestid']};if(!_0x256839[_0xa65e('0x3e')]){_0x2ab908[_0xa65e('0x42')]=!![];}return _0x449115[_0xa65e('0x2b')](_0x2ab908);})[_0xa65e('0x1a')](function(_0x4ec63e){logger[_0xa65e('0x1b')](_0xa65e('0x2c'),'afterCreate',_0xa65e('0x3f'),util[_0xa65e('0x2e')](_0x4ec63e,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x3f'),_0xa65e('0x43'));}break;case _0xa65e('0x44'):if(_0x256839[_0xa65e('0x32')]&&_0x256839['password']){var _0x412be3={'messages':[{'source':'xCALLY\x20Motion','to':_0x5f4625[_0xa65e('0x25')],'body':_0x5f4625[_0xa65e('0xd')],'from':_0x256839[_0xa65e('0x40')]||_0x256839[_0xa65e('0x25')]}]};var _0x593d58=util[_0xa65e('0x45')](_0xa65e('0x46'),_0x256839['username'],_0x256839[_0xa65e('0x33')]);var _0x359834={'method':_0xa65e('0x3a'),'uri':_0xa65e('0x47'),'body':_0x412be3,'headers':{'Authorization':util[_0xa65e('0x45')](_0xa65e('0x48'),new Buffer(_0x593d58)[_0xa65e('0x49')](_0xa65e('0x4a')))},'json':!![]};rp(_0x359834)[_0xa65e('0x18')](function(_0x581b14){if(_0x581b14['http_code']>=0xc8&&_0x581b14[_0xa65e('0x4b')]<=0xce){if(_0x581b14[_0xa65e('0x4c')]&&_0x581b14['data']['queued_count']>0x0){var _0x1cb3a0=_['head'](_0x581b14[_0xa65e('0x4c')][_0xa65e('0x23')]);var _0x2aebac={'messageId':_0x1cb3a0['message_id']};if(!_0x256839[_0xa65e('0x3e')]){_0x2aebac[_0xa65e('0x42')]=!![];}return _0x449115[_0xa65e('0x2b')](_0x2aebac);}else{logger['error'](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x4d'),util[_0xa65e('0x2e')](_0x581b14,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xa65e('0x2c'),_0xa65e('0x2d'),'clickSend',util[_0xa65e('0x2e')](_0x581b14,{'showHidden':![],'depth':null}));}})[_0xa65e('0x1a')](function(_0x1dafaf){logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x4d'),util[_0xa65e('0x2e')](_0x1dafaf,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x4d'),_0xa65e('0x4e'));}break;case'plivo':if(_0x256839[_0xa65e('0x4f')]&&_0x256839[_0xa65e('0x22')]){var _0x412be3={'dst':_0x5f4625[_0xa65e('0x25')],'text':_0x5f4625[_0xa65e('0xd')],'src':_0x256839[_0xa65e('0x40')]||_0x256839[_0xa65e('0x25')],'url':_0x256839[_0xa65e('0x26')]+_0xa65e('0x27')+_0x5f4625['id']+'/status?token='+_0x256839[_0xa65e('0x29')]};var _0x593d58=util[_0xa65e('0x45')](_0xa65e('0x46'),_0x256839['authId'],_0x256839[_0xa65e('0x22')]);var _0x359834={'method':_0xa65e('0x3a'),'uri':util[_0xa65e('0x45')](_0xa65e('0x50'),_0x256839[_0xa65e('0x4f')]),'body':_0x412be3,'headers':{'Authorization':util[_0xa65e('0x45')](_0xa65e('0x48'),new Buffer(_0x593d58)['toString'](_0xa65e('0x4a')))},'json':!![]};rp(_0x359834)['then'](function(_0x5c4777){var _0x2bc522={'messageId':_0x5c4777['message_uuid'][0x0]};return _0x449115[_0xa65e('0x2b')](_0x2bc522);})[_0xa65e('0x1a')](function(_0x15f3fa){logger[_0xa65e('0x1b')](_0xa65e('0x2c'),'afterCreate','plivo',util[_0xa65e('0x2e')](_0x15f3fa,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x51'),_0xa65e('0x52'));}break;case _0xa65e('0x53'):if(_0x256839['username']&&_0x256839[_0xa65e('0x33')]){if(_0x256839[_0xa65e('0x54')]){var _0x4576a2={'method':_0xa65e('0x3a'),'uri':_0x256839['baseUrl']+_0xa65e('0x55'),'body':{'username':_0x256839[_0xa65e('0x32')],'password':_0x256839['password']},'json':!![]};return rp(_0x4576a2)[_0xa65e('0x18')](function(_0x269a4f){var _0x88bafa={'method':'POST','uri':_0x256839['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x256839['phone'],'destinations':[{'to':_0x5f4625[_0xa65e('0x25')]}],'text':_0x5f4625[_0xa65e('0xd')],'notifyUrl':_0x256839[_0xa65e('0x26')]+_0xa65e('0x27')+_0x5f4625['id']+_0xa65e('0x28')+_0x256839[_0xa65e('0x29')],'notifyContentType':_0xa65e('0x56'),'callbackData':_0x256839[_0xa65e('0x25')]+';'+_0x5f4625[_0xa65e('0xd')]}]},'headers':{'Authorization':_0xa65e('0x57')+_0x269a4f[_0xa65e('0x29')]},'json':!![]};return rp(_0x88bafa)[_0xa65e('0x18')](function(_0xadf6b6){if(_0xadf6b6[_0xa65e('0x23')]){var _0x3b94aa={'messageId':_0xadf6b6[_0xa65e('0x23')][0x0]['messageId']};if(!_0x256839['deliveryReport']){_0x3b94aa[_0xa65e('0x42')]=!![];}return _0x449115[_0xa65e('0x2b')](_0x3b94aa);}else{return logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),'infobip',util['inspect'](_0xadf6b6,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xb29f41){return logger['error'](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x53'),util[_0xa65e('0x2e')](_0xb29f41,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x53'),_0xa65e('0x58'));}}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x53'),_0xa65e('0x4e'));}break;case _0xa65e('0x59'):var _0x5589b6=require(_0xa65e('0x5a'));if(_0x256839[_0xa65e('0x5b')]){var _0xa6f593={};_0xa6f593[_0xa65e('0x5c')]=_0x256839[_0xa65e('0x32')];_0xa6f593[_0xa65e('0x25')]=_0x5f4625['phone'];_0xa6f593[_0xa65e('0x35')]=_0x256839[_0xa65e('0x25')];_0xa6f593[_0xa65e('0x5d')]=_0x5f4625[_0xa65e('0xd')];_0xa6f593[_0xa65e('0x5e')]=+new Date();var _0x43b9af='';var _0x3e184f='';var _0x18b29d=Object[_0xa65e('0x5f')](_0xa6f593);_0x18b29d[_0xa65e('0x60')]();for(var _0x4f7b16=0x0;_0x4f7b16<_0x18b29d[_0xa65e('0x61')];_0x4f7b16++){if(_0x43b9af!=''){_0x43b9af+='&';}_0x43b9af+=_0x18b29d[_0x4f7b16]+'='+encodeURIComponent(_0xa6f593[_0x18b29d[_0x4f7b16]]);_0x3e184f+=_0xa6f593[_0x18b29d[_0x4f7b16]];}_0x3e184f+=_0x256839[_0xa65e('0x5b')];_0x3e184f=_0x5589b6[_0xa65e('0x62')](_0xa65e('0x63'))[_0xa65e('0x2b')](_0x3e184f)['digest']('hex');if(_0x43b9af!==''){_0x43b9af+='&';}_0x43b9af+=_0xa65e('0x64')+_0x3e184f;var _0x5104fd={'method':_0xa65e('0x37'),'uri':_0x256839[_0xa65e('0x54')]+_0xa65e('0x65')+_0x43b9af,'json':!![]};return rp(_0x5104fd)[_0xa65e('0x18')](function(_0x276a66){var _0x263324=Object[_0xa65e('0x5f')](_0x276a66);if(_0x276a66[_0x263324[0x0]]['error']&&parseInt(_0x276a66[_0x263324[0x0]][_0xa65e('0x1b')])===0x0){var _0x327e1f={'messageId':_0x276a66[_0x263324[0x0]][_0xa65e('0x66')]};if(!_0x256839[_0xa65e('0x3e')]){_0x327e1f[_0xa65e('0x42')]=!![];}return _0x449115[_0xa65e('0x2b')](_0x327e1f);}else{return logger[_0xa65e('0x1b')](_0xa65e('0x2c'),'afterCreate',_0xa65e('0x59'),util[_0xa65e('0x2e')](_0x276a66[_0xa65e('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x326254){return logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),_0xa65e('0x59'),util['inspect'](_0x326254,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x59'),_0xa65e('0x67'));}break;case _0xa65e('0x68'):if(_0x256839['apiKey']){var _0xb53e8d={'method':_0xa65e('0x3a'),'uri':_0xa65e('0x69'),'headers':{'Authorization':_0x256839[_0xa65e('0x5b')]},'body':{'content':_0x5f4625[_0xa65e('0xd')],'to':[_0x5f4625[_0xa65e('0x25')]],'from':_0x256839[_0xa65e('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0xa65e('0x6a')},'json':!![]};rp(_0xb53e8d)[_0xa65e('0x18')](function(_0xf84eef){if(!_0xf84eef[_0xa65e('0x1b')]){var _0x5c3113={'messageId':_0xf84eef[_0xa65e('0x23')][0x0][_0xa65e('0x6b')]};if(!_0x256839[_0xa65e('0x3e')]){_0x5c3113[_0xa65e('0x42')]=!![];}return _0x449115[_0xa65e('0x2b')](_0x5c3113);}else{return logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x68'),util[_0xa65e('0x2e')](_0xf84eef[_0xa65e('0x1b')],{'showHidden':![],'depth':null}));}})[_0xa65e('0x1a')](function(_0x5888b0){return logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa65e('0x68'),util[_0xa65e('0x2e')](_0x5888b0,{'showHidden':![],'depth':null}));});}else{logger[_0xa65e('0x1b')](_0xa65e('0x2c'),_0xa65e('0x2d'),'clickatell',_0xa65e('0x67'));}break;case _0xa65e('0x6c'):if(_0x256839[_0xa65e('0x32')]&&_0x256839[_0xa65e('0x33')]){var _0x593d58=util['format'](_0xa65e('0x46'),_0x256839[_0xa65e('0x32')],_0x256839[_0xa65e('0x33')]);var _0x359834={'method':_0xa65e('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x256839[_0xa65e('0x6d')]+_0xa65e('0x6e'),'body':{'to':[_0x5f4625['phone']],'text':_0x5f4625['body'],'from':_0x256839['phone'],'applicationId':_0x256839[_0xa65e('0x6f')]},'headers':{'Authorization':util[_0xa65e('0x45')](_0xa65e('0x48'),new Buffer(_0x593d58)[_0xa65e('0x49')](_0xa65e('0x4a')))},'json':!![]};rp(_0x359834)[_0xa65e('0x18')](function(_0x3ac972){if(_0x3ac972['id']){var _0x4d7a8d={'messageId':_0x3ac972['id']};return _0x449115[_0xa65e('0x2b')](_0x4d7a8d);}else{logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x6c'),util[_0xa65e('0x2e')](_0x3ac972,{'showHidden':![],'depth':null}));}})['catch'](function(_0x33b0dc){logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),'bandwidth',util['inspect'](_0x33b0dc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x6c'),_0xa65e('0x4e'));}break;case _0xa65e('0x70'):if(_0x256839['apiKey']){var _0x3e602e={};var _0x5104fd={'method':_0xa65e('0x3a'),'uri':_0xa65e('0x71'),'headers':{'Authorization':_0xa65e('0x72')+_0x256839[_0xa65e('0x5b')],'Content-Type':_0xa65e('0x56')},'body':{'from':_0x256839['phone'],'to':_0x5f4625[_0xa65e('0x25')],'text':_0x5f4625['body']},'json':!![]};return rp(_0x5104fd)[_0xa65e('0x18')](function(_0x467c42){if(_0x467c42['code']==0xca){_0x3e602e['message']=_0x467c42;var _0x1899e2={'method':_0xa65e('0x3a'),'uri':_0xa65e('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x256839[_0xa65e('0x5b')],'Content-Type':_0xa65e('0x56')},'body':{'refid':_0x3e602e[_0xa65e('0x74')][_0xa65e('0x75')]},'json':!![]};return rp(_0x1899e2)[_0xa65e('0x18')](function(_0x24d470){_0x3e602e[_0xa65e('0x76')]=_0x24d470;var _0x2f8604={'messageId':_0x3e602e[_0xa65e('0x74')][_0xa65e('0x75')],'read':!![]};return _0x449115[_0xa65e('0x2b')](_0x2f8604);});}else{return logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa65e('0x70'),util[_0xa65e('0x2e')](_0x467c42,{'showHidden':![],'depth':null}));}})[_0xa65e('0x1a')](function(_0x20db42){return logger[_0xa65e('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa65e('0x70'),util[_0xa65e('0x2e')](_0x20db42,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa65e('0x2d'),_0xa65e('0x70'),'Token\x20not\x20received');}break;}}})[_0xa65e('0x77')](function(){_0x3f9ccc();});}else{_0x3f9ccc();}}},'charset':_0xa65e('0x78'),'collate':_0xa65e('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5da6fad..5ebdad8 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 _0x3ad1=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','moment','bluebird'];(function(_0x539e0d,_0x19780b){var _0x3539ff=function(_0xc4643){while(--_0xc4643){_0x539e0d['push'](_0x539e0d['shift']());}};_0x3539ff(++_0x19780b);}(_0x3ad1,0x165));var _0x13ad=function(_0x4ccf67,_0x2e4050){_0x4ccf67=_0x4ccf67-0x0;var _0x5a7d8b=_0x3ad1[_0x4ccf67];return _0x5a7d8b;};'use strict';var _=require(_0x13ad('0x0'));var util=require('util');var moment=require(_0x13ad('0x1'));var BPromise=require(_0x13ad('0x2'));var rs=require(_0x13ad('0x3'));var fs=require('fs');var Redis=require(_0x13ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13ad('0x5'));var logger=require(_0x13ad('0x6'))(_0x13ad('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13ad('0x8')][_0x13ad('0x9')]({'port':0x232a});config[_0x13ad('0xa')]=_[_0x13ad('0xb')](config[_0x13ad('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13ad('0xa')]));require(_0x13ad('0xc'))['register'](socket);function respondWithRpcPromise(_0x12aacb,_0x27775b,_0x26a8d5){return new BPromise(function(_0x850361,_0x413d70){return client['request'](_0x12aacb,_0x26a8d5)[_0x13ad('0xd')](function(_0x49c6bb){logger[_0x13ad('0xe')](_0x13ad('0xf'),_0x27775b,_0x13ad('0x10'));logger[_0x13ad('0x11')](_0x13ad('0x12'),_0x27775b,_0x13ad('0x10'),JSON['stringify'](_0x49c6bb));if(_0x49c6bb[_0x13ad('0x13')]){if(_0x49c6bb[_0x13ad('0x13')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x27775b,_0x49c6bb['error'][_0x13ad('0x14')]);return _0x413d70(_0x49c6bb[_0x13ad('0x13')][_0x13ad('0x14')]);}logger['error'](_0x13ad('0xf'),_0x27775b,_0x49c6bb[_0x13ad('0x13')][_0x13ad('0x14')]);return _0x850361(_0x49c6bb[_0x13ad('0x13')][_0x13ad('0x14')]);}else{logger[_0x13ad('0xe')](_0x13ad('0xf'),_0x27775b,'request\x20sent');_0x850361(_0x49c6bb[_0x13ad('0x15')][_0x13ad('0x14')]);}})[_0x13ad('0x16')](function(_0x2ee07f){logger['error'](_0x13ad('0xf'),_0x27775b,_0x2ee07f);_0x413d70(_0x2ee07f);});});}exports[_0x13ad('0x17')]=function(_0x8fcfcd){var _0xa80320=this;return new Promise(function(_0x3dd4fb,_0x452961){return db[_0x13ad('0x18')][_0x13ad('0x19')](_0x8fcfcd[_0x13ad('0x1a')],{'raw':_0x8fcfcd[_0x13ad('0x1b')]?_0x8fcfcd['options'][_0x13ad('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x36537f){logger[_0x13ad('0xe')](_0x13ad('0x17'),_0x8fcfcd);logger[_0x13ad('0x11')](_0x13ad('0x17'),_0x8fcfcd,JSON[_0x13ad('0x1d')](_0x36537f));_0x3dd4fb(_0x36537f);})[_0x13ad('0x16')](function(_0x5c2e34){logger[_0x13ad('0x13')](_0x13ad('0x17'),_0x5c2e34['message'],_0x8fcfcd);_0x452961(_0xa80320['error'](0x1f4,_0x5c2e34['message']));});});}; \ No newline at end of file +var _0x20fa=['options','raw','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSmsMessage','SmsMessage','create'];(function(_0x36a57d,_0x18238a){var _0x44a822=function(_0x311afe){while(--_0x311afe){_0x36a57d['push'](_0x36a57d['shift']());}};_0x44a822(++_0x18238a);}(_0x20fa,0x1e1));var _0xa20f=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x20fa[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0xa20f('0x0'));var util=require(_0xa20f('0x1'));var moment=require(_0xa20f('0x2'));var BPromise=require(_0xa20f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa20f('0x4'));var db=require(_0xa20f('0x5'))['db'];var utils=require(_0xa20f('0x6'));var logger=require(_0xa20f('0x7'))(_0xa20f('0x8'));var config=require(_0xa20f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa20f('0xa')][_0xa20f('0xb')]({'port':0x232a});config['redis']=_[_0xa20f('0xc')](config[_0xa20f('0xd')],{'host':_0xa20f('0xe'),'port':0x18eb});var socket=require(_0xa20f('0xf'))(new Redis(config[_0xa20f('0xd')]));require(_0xa20f('0x10'))[_0xa20f('0x11')](socket);function respondWithRpcPromise(_0x5b42f2,_0xf11719,_0x457177){return new BPromise(function(_0x2de48b,_0x26da40){return client[_0xa20f('0x12')](_0x5b42f2,_0x457177)['then'](function(_0x262e6a){logger[_0xa20f('0x13')](_0xa20f('0x14'),_0xf11719,_0xa20f('0x15'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf11719,_0xa20f('0x15'),JSON['stringify'](_0x262e6a));if(_0x262e6a[_0xa20f('0x16')]){if(_0x262e6a[_0xa20f('0x16')][_0xa20f('0x17')]===0x1f4){logger['error'](_0xa20f('0x14'),_0xf11719,_0x262e6a[_0xa20f('0x16')][_0xa20f('0x18')]);return _0x26da40(_0x262e6a[_0xa20f('0x16')][_0xa20f('0x18')]);}logger[_0xa20f('0x16')]('SmsMessage,\x20%s,\x20%s',_0xf11719,_0x262e6a[_0xa20f('0x16')][_0xa20f('0x18')]);return _0x2de48b(_0x262e6a[_0xa20f('0x16')][_0xa20f('0x18')]);}else{logger[_0xa20f('0x13')](_0xa20f('0x14'),_0xf11719,_0xa20f('0x15'));_0x2de48b(_0x262e6a[_0xa20f('0x19')][_0xa20f('0x18')]);}})['catch'](function(_0x5645df){logger[_0xa20f('0x16')]('SmsMessage,\x20%s,\x20%s',_0xf11719,_0x5645df);_0x26da40(_0x5645df);});});}exports[_0xa20f('0x1a')]=function(_0x51661c){var _0x4fed84=this;return new Promise(function(_0x1f0b5c,_0x1fd4a8){return db[_0xa20f('0x1b')][_0xa20f('0x1c')](_0x51661c['body'],{'raw':_0x51661c[_0xa20f('0x1d')]?_0x51661c['options'][_0xa20f('0x1e')]===undefined?!![]:![]:!![]})[_0xa20f('0x1f')](function(_0x2cd1b4){logger[_0xa20f('0x13')](_0xa20f('0x1a'),_0x51661c);logger[_0xa20f('0x20')](_0xa20f('0x1a'),_0x51661c,JSON[_0xa20f('0x21')](_0x2cd1b4));_0x1f0b5c(_0x2cd1b4);})['catch'](function(_0x5023a6){logger['error'](_0xa20f('0x1a'),_0x5023a6[_0xa20f('0x18')],_0x51661c);_0x1fd4a8(_0x4fed84[_0xa20f('0x16')](0x1f4,_0x5023a6[_0xa20f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f401bd8..7582e29 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 _0xdda0=['remove','removeListener','register','length','smsMessage:','save'];(function(_0x2a5252,_0x1dedb4){var _0x46f869=function(_0x2a3183){while(--_0x2a3183){_0x2a5252['push'](_0x2a5252['shift']());}};_0x46f869(++_0x1dedb4);}(_0xdda0,0x1bb));var _0x0dda=function(_0x7b7951,_0x4ee615){_0x7b7951=_0x7b7951-0x0;var _0x2e4176=_0xdda0[_0x7b7951];return _0x2e4176;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x0dda('0x0'),_0x0dda('0x1'),'update'];function createListener(_0x52979,_0x3d988c){return function(_0x281b9b){_0x3d988c['emit'](_0x52979,_0x281b9b);};}function removeListener(_0x3eca32,_0x479738){return function(){SmsMessageEvents[_0x0dda('0x2')](_0x3eca32,_0x479738);};}exports[_0x0dda('0x3')]=function(_0x28ed11){for(var _0x8fc387=0x0,_0x21164a=events[_0x0dda('0x4')];_0x8fc387<_0x21164a;_0x8fc387++){var _0x3aff13=events[_0x8fc387];var _0x357967=createListener(_0x0dda('0x5')+_0x3aff13,_0x28ed11);SmsMessageEvents['on'](_0x3aff13,_0x357967);}}; \ No newline at end of file +var _0xee8a=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x2944ff,_0x5c2a9e){var _0x19fe5f=function(_0x5dbb3e){while(--_0x5dbb3e){_0x2944ff['push'](_0x2944ff['shift']());}};_0x19fe5f(++_0x5c2a9e);}(_0xee8a,0x195));var _0xaee8=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xee8a[_0x564821];return _0x2b604d;};'use strict';var SmsMessageEvents=require(_0xaee8('0x0'));var events=[_0xaee8('0x1'),_0xaee8('0x2'),_0xaee8('0x3')];function createListener(_0xa43944,_0x8afbd3){return function(_0x5b2819){_0x8afbd3[_0xaee8('0x4')](_0xa43944,_0x5b2819);};}function removeListener(_0x712d43,_0x5af1e5){return function(){SmsMessageEvents[_0xaee8('0x5')](_0x712d43,_0x5af1e5);};}exports[_0xaee8('0x6')]=function(_0x3524c){for(var _0x29b4ba=0x0,_0x559be5=events[_0xaee8('0x7')];_0x29b4ba<_0x559be5;_0x29b4ba++){var _0x47b468=events[_0x29b4ba];var _0x58c8aa=createListener(_0xaee8('0x8')+_0x47b468,_0x3524c);SmsMessageEvents['on'](_0x47b468,_0x58c8aa);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 434ba6a..56abd87 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 _0xf181=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeAgents','multer','util','path','Router'];(function(_0x44ab83,_0x599e2a){var _0xf71c1b=function(_0x23771d){while(--_0x23771d){_0x44ab83['push'](_0x44ab83['shift']());}};_0xf71c1b(++_0x599e2a);}(_0xf181,0x6c));var _0x1f18=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0xf181[_0x27097a];return _0x26378b;};'use strict';var multer=require(_0x1f18('0x0'));var util=require(_0x1f18('0x1'));var path=require(_0x1f18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f18('0x3')]();var fs_extra=require(_0x1f18('0x4'));var auth=require(_0x1f18('0x5'));var interaction=require(_0x1f18('0x6'));var config=require(_0x1f18('0x7'));var controller=require('./smsQueue.controller');router[_0x1f18('0x8')]('/',auth[_0x1f18('0x9')](),controller['index']);router[_0x1f18('0x8')](_0x1f18('0xa'),auth['isAuthenticated'](),controller[_0x1f18('0xb')]);router[_0x1f18('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1f18('0xc')]);router[_0x1f18('0x8')](_0x1f18('0xd'),auth['isAuthenticated'](),controller[_0x1f18('0xe')]);router[_0x1f18('0x8')](_0x1f18('0xf'),auth[_0x1f18('0x9')](),controller[_0x1f18('0x10')]);router['get'](_0x1f18('0x11'),auth[_0x1f18('0x9')](),controller[_0x1f18('0x12')]);router[_0x1f18('0x13')]('/',auth['isAuthenticated'](),controller[_0x1f18('0x14')]);router[_0x1f18('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1f18('0x15')]);router['post']('/:id/users',auth[_0x1f18('0x9')](),controller[_0x1f18('0x16')]);router[_0x1f18('0x17')](_0x1f18('0x18'),auth[_0x1f18('0x9')](),controller[_0x1f18('0x19')]);router[_0x1f18('0x1a')]('/:id',auth[_0x1f18('0x9')](),controller['destroy']);router[_0x1f18('0x1a')](_0x1f18('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x1f18('0x1a')](_0x1f18('0x11'),auth[_0x1f18('0x9')](),controller[_0x1f18('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xcc58=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','update','delete','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc58,0x1b5));var _0x8cc5=function(_0x3784f8,_0x283640){_0x3784f8=_0x3784f8-0x0;var _0x1d3e95=_0xcc58[_0x3784f8];return _0x1d3e95;};'use strict';var multer=require(_0x8cc5('0x0'));var util=require(_0x8cc5('0x1'));var path=require(_0x8cc5('0x2'));var timeout=require(_0x8cc5('0x3'));var express=require(_0x8cc5('0x4'));var router=express[_0x8cc5('0x5')]();var fs_extra=require(_0x8cc5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cc5('0x7'));var controller=require(_0x8cc5('0x8'));router[_0x8cc5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8cc5('0x9')]('/describe',auth[_0x8cc5('0xa')](),controller['describe']);router['get'](_0x8cc5('0xb'),auth[_0x8cc5('0xa')](),controller['show']);router['get'](_0x8cc5('0xc'),auth[_0x8cc5('0xa')](),controller[_0x8cc5('0xd')]);router[_0x8cc5('0x9')](_0x8cc5('0xe'),auth[_0x8cc5('0xa')](),controller[_0x8cc5('0xf')]);router[_0x8cc5('0x9')](_0x8cc5('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x8cc5('0xa')](),controller['create']);router[_0x8cc5('0x11')](_0x8cc5('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8cc5('0x11')](_0x8cc5('0x10'),auth['isAuthenticated'](),controller[_0x8cc5('0x12')]);router[_0x8cc5('0x13')](_0x8cc5('0xb'),auth[_0x8cc5('0xa')](),controller[_0x8cc5('0x14')]);router[_0x8cc5('0x15')](_0x8cc5('0xb'),auth[_0x8cc5('0xa')](),controller['destroy']);router[_0x8cc5('0x15')]('/:id/teams',auth[_0x8cc5('0xa')](),controller['removeTeams']);router[_0x8cc5('0x15')]('/:id/users',auth[_0x8cc5('0xa')](),controller[_0x8cc5('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b120afc..44ecb73 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 _0x7ebc=['exports','STRING','ENUM','beepall','sequelize'];(function(_0x372ca0,_0x5d47e9){var _0x189a65=function(_0x1ecec8){while(--_0x1ecec8){_0x372ca0['push'](_0x372ca0['shift']());}};_0x189a65(++_0x5d47e9);}(_0x7ebc,0x77));var _0xc7eb=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x7ebc[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0xc7eb('0x0'));module[_0xc7eb('0x1')]={'name':{'type':Sequelize[_0xc7eb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc7eb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc7eb('0x3')]('rrmemory',_0xc7eb('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xc58e=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc58e,0x199));var _0xec58=function(_0x455e18,_0x3ecc30){_0x455e18=_0x455e18-0x0;var _0x8f74d6=_0xc58e[_0x455e18];return _0x8f74d6;};'use strict';var Sequelize=require(_0xec58('0x0'));module[_0xec58('0x1')]={'name':{'type':Sequelize[_0xec58('0x2')],'unique':_0xec58('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec58('0x2')]},'timeout':{'type':Sequelize[_0xec58('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec58('0x5')](_0xec58('0x6'),_0xec58('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a4faf0a..019fbc9 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x328bba,_0x247889){var _0x268826=function(_0x5bb0da){while(--_0x5bb0da){_0x328bba['push'](_0x328bba['shift']());}};_0x268826(++_0x247889);}(_0xdb28,0x106));var _0x8db2=function(_0x17b29f,_0x66909b){_0x17b29f=_0x17b29f-0x0;var _0x598fec=_0xdb28[_0x17b29f];return _0x598fec;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x23aeaf,_0x241fa7){var _0x118109=function(_0x3971ca){while(--_0x3971ca){_0x23aeaf['push'](_0x23aeaf['shift']());}};_0x118109(++_0x241fa7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6bdbb08..8e78b8f 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 _0x11df=['../../mysqldb','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x57ef29,_0x3d303a){var _0x9998f6=function(_0x1fd310){while(--_0x1fd310){_0x57ef29['push'](_0x57ef29['shift']());}};_0x9998f6(++_0x3d303a);}(_0x11df,0x1df));var _0xf11d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x11df[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require(_0xf11d('0x0'));var SmsQueue=require(_0xf11d('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf11d('0x2')](0x0);var events={'afterCreate':_0xf11d('0x3'),'afterUpdate':'update','afterDestroy':_0xf11d('0x4')};function emitEvent(_0x22aaa8){return function(_0x8ebd23,_0xad5fa7,_0x493168){SmsQueueEvents[_0xf11d('0x5')](_0x22aaa8+':'+_0x8ebd23['id'],_0x8ebd23);SmsQueueEvents[_0xf11d('0x5')](_0x22aaa8,_0x8ebd23);_0x493168(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xf11d('0x6')](e,emitEvent(event));}}module[_0xf11d('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x732e=['emit','exports','events','../../mysqldb','SmsQueue','setMaxListeners','remove'];(function(_0x4fe0e5,_0x4ace15){var _0x1490e9=function(_0x62254d){while(--_0x62254d){_0x4fe0e5['push'](_0x4fe0e5['shift']());}};_0x1490e9(++_0x4ace15);}(_0x732e,0x1c9));var _0xe732=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0x732e[_0x2b78e5];return _0xa8d52d;};'use strict';var EventEmitter=require(_0xe732('0x0'));var SmsQueue=require(_0xe732('0x1'))['db'][_0xe732('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe732('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe732('0x4')};function emitEvent(_0x4484ec){return function(_0x4c575e,_0x4672bc,_0x4ec83f){SmsQueueEvents[_0xe732('0x5')](_0x4484ec+':'+_0x4c575e['id'],_0x4c575e);SmsQueueEvents['emit'](_0x4484ec,_0x4c575e);_0x4ec83f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xe732('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ea934ef..ff2e7ca 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 _0x7e6c=['../../config/logger','moment','request-promise','path','define','SmsQueue','sms_queues'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x7e6c,0xe7));var _0xc7e6=function(_0x11bc0f,_0x373666){_0x11bc0f=_0x11bc0f-0x0;var _0x3ab0d1=_0x7e6c[_0x11bc0f];return _0x3ab0d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc7e6('0x0'))('api');var moment=require(_0xc7e6('0x1'));var BPromise=require('bluebird');var rp=require(_0xc7e6('0x2'));var fs=require('fs');var path=require(_0xc7e6('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0xa80c5c,_0x548972){return _0xa80c5c[_0xc7e6('0x4')](_0xc7e6('0x5'),attributes,{'tableName':_0xc7e6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe479=['api','moment','bluebird','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x47e750,_0x4d44ca){var _0xbc91aa=function(_0x5723d1){while(--_0x5723d1){_0x47e750['push'](_0x47e750['shift']());}};_0xbc91aa(++_0x4d44ca);}(_0xe479,0xda));var _0x9e47=function(_0x145093,_0x592664){_0x145093=_0x145093-0x0;var _0x2a2ae2=_0xe479[_0x145093];return _0x2a2ae2;};'use strict';var _=require(_0x9e47('0x0'));var util=require(_0x9e47('0x1'));var logger=require(_0x9e47('0x2'))(_0x9e47('0x3'));var moment=require(_0x9e47('0x4'));var BPromise=require(_0x9e47('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e47('0x6'));var rimraf=require('rimraf');var config=require(_0x9e47('0x7'));var attributes=require(_0x9e47('0x8'));module[_0x9e47('0x9')]=function(_0x11bd41,_0x3729b9){return _0x11bd41[_0x9e47('0xa')](_0x9e47('0xb'),attributes,{'tableName':_0x9e47('0xc'),'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 393b5d6..29bff29 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 _0xf0f4=['register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','model','map','attributes','ShowSmsQueue','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x53d71c,_0x1a3859){var _0x555efb=function(_0x32ef67){while(--_0x32ef67){_0x53d71c['push'](_0x53d71c['shift']());}};_0x555efb(++_0x1a3859);}(_0xf0f4,0x1a0));var _0x4f0f=function(_0x26e5bc,_0x3a49aa){_0x26e5bc=_0x26e5bc-0x0;var _0x285b01=_0xf0f4[_0x26e5bc];return _0x285b01;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require(_0x4f0f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require(_0x4f0f('0x3'))['db'];var utils=require(_0x4f0f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4f0f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4f0f('0x6')][_0x4f0f('0x7')]({'port':0x232a});config[_0x4f0f('0x8')]=_[_0x4f0f('0x9')](config[_0x4f0f('0x8')],{'host':_0x4f0f('0xa'),'port':0x18eb});var socket=require(_0x4f0f('0xb'))(new Redis(config[_0x4f0f('0x8')]));require(_0x4f0f('0xc'))[_0x4f0f('0xd')](socket);function respondWithRpcPromise(_0x2b735a,_0x1d173c,_0x320b18){return new BPromise(function(_0x1ab7ec,_0x4bdb53){return client[_0x4f0f('0xe')](_0x2b735a,_0x320b18)[_0x4f0f('0xf')](function(_0x3aecbc){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x1d173c,_0x4f0f('0x12'));logger[_0x4f0f('0x13')](_0x4f0f('0x14'),_0x1d173c,_0x4f0f('0x12'),JSON[_0x4f0f('0x15')](_0x3aecbc));if(_0x3aecbc[_0x4f0f('0x16')]){if(_0x3aecbc['error'][_0x4f0f('0x17')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1d173c,_0x3aecbc[_0x4f0f('0x16')][_0x4f0f('0x18')]);return _0x4bdb53(_0x3aecbc[_0x4f0f('0x16')][_0x4f0f('0x18')]);}logger['error'](_0x4f0f('0x11'),_0x1d173c,_0x3aecbc['error'][_0x4f0f('0x18')]);return _0x1ab7ec(_0x3aecbc[_0x4f0f('0x16')][_0x4f0f('0x18')]);}else{logger['info'](_0x4f0f('0x11'),_0x1d173c,'request\x20sent');_0x1ab7ec(_0x3aecbc['result']['message']);}})[_0x4f0f('0x19')](function(_0x3516f2){logger[_0x4f0f('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1d173c,_0x3516f2);_0x4bdb53(_0x3516f2);});});}exports[_0x4f0f('0x1a')]=function(_0x3219bf){var _0x2ba095=this;return new Promise(function(_0x5929b5,_0x9aae4e){return db[_0x4f0f('0x1b')][_0x4f0f('0x1c')]({'raw':_0x3219bf[_0x4f0f('0x1d')]?_0x3219bf['options'][_0x4f0f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3219bf[_0x4f0f('0x1d')]?_0x3219bf[_0x4f0f('0x1d')][_0x4f0f('0x1f')]||null:null,'attributes':_0x3219bf[_0x4f0f('0x1d')]?_0x3219bf['options']['attributes']||null:null,'limit':_0x3219bf[_0x4f0f('0x1d')]?_0x3219bf[_0x4f0f('0x1d')][_0x4f0f('0x20')]||null:null,'include':_0x3219bf['options']?_0x3219bf[_0x4f0f('0x1d')][_0x4f0f('0x21')]?_['map'](_0x3219bf[_0x4f0f('0x1d')][_0x4f0f('0x21')],function(_0x1eee66){return{'model':db[_0x1eee66[_0x4f0f('0x22')]],'as':_0x1eee66['as'],'attributes':_0x1eee66['attributes'],'include':_0x1eee66[_0x4f0f('0x21')]?_[_0x4f0f('0x23')](_0x1eee66['include'],function(_0x4c61e6){return{'model':db[_0x4c61e6[_0x4f0f('0x22')]],'as':_0x4c61e6['as'],'attributes':_0x4c61e6[_0x4f0f('0x24')],'include':_0x4c61e6[_0x4f0f('0x21')]?_[_0x4f0f('0x23')](_0x4c61e6[_0x4f0f('0x21')],function(_0x4ace30){return{'model':db[_0x4ace30[_0x4f0f('0x22')]],'as':_0x4ace30['as'],'attributes':_0x4ace30[_0x4f0f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4f0f('0xf')](function(_0x1ad873){logger['info'](_0x4f0f('0x1a'),_0x3219bf);logger[_0x4f0f('0x13')](_0x4f0f('0x1a'),_0x3219bf,JSON[_0x4f0f('0x15')](_0x1ad873));_0x5929b5(_0x1ad873);})[_0x4f0f('0x19')](function(_0x47b2e7){logger[_0x4f0f('0x16')](_0x4f0f('0x1a'),_0x47b2e7[_0x4f0f('0x18')],_0x3219bf);_0x9aae4e(_0x2ba095[_0x4f0f('0x16')](0x1f4,_0x47b2e7[_0x4f0f('0x18')]));});});};exports[_0x4f0f('0x25')]=function(_0x529496){var _0x2b5d17=this;return new Promise(function(_0x115cd5,_0x5b83d4){return db['SmsQueue'][_0x4f0f('0x26')]({'raw':_0x529496[_0x4f0f('0x1d')]?_0x529496['options'][_0x4f0f('0x1e')]===undefined?!![]:![]:!![],'where':_0x529496[_0x4f0f('0x1d')]?_0x529496[_0x4f0f('0x1d')][_0x4f0f('0x1f')]||null:null,'attributes':_0x529496[_0x4f0f('0x1d')]?_0x529496['options'][_0x4f0f('0x24')]||null:null,'include':_0x529496[_0x4f0f('0x1d')]?_0x529496[_0x4f0f('0x1d')][_0x4f0f('0x21')]?_[_0x4f0f('0x23')](_0x529496[_0x4f0f('0x1d')]['include'],function(_0xd91ecf){return{'model':db[_0xd91ecf[_0x4f0f('0x22')]],'as':_0xd91ecf['as'],'attributes':_0xd91ecf[_0x4f0f('0x24')],'include':_0xd91ecf[_0x4f0f('0x21')]?_['map'](_0xd91ecf[_0x4f0f('0x21')],function(_0x3c00c8){return{'model':db[_0x3c00c8[_0x4f0f('0x22')]],'as':_0x3c00c8['as'],'attributes':_0x3c00c8[_0x4f0f('0x24')],'include':_0x3c00c8[_0x4f0f('0x21')]?_['map'](_0x3c00c8[_0x4f0f('0x21')],function(_0x401984){return{'model':db[_0x401984[_0x4f0f('0x22')]],'as':_0x401984['as'],'attributes':_0x401984[_0x4f0f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4f0f('0xf')](function(_0x26c005){logger[_0x4f0f('0x10')](_0x4f0f('0x25'),_0x529496);logger[_0x4f0f('0x13')](_0x4f0f('0x25'),_0x529496,JSON['stringify'](_0x26c005));_0x115cd5(_0x26c005);})[_0x4f0f('0x19')](function(_0x21f8a1){logger['error'](_0x4f0f('0x25'),_0x21f8a1[_0x4f0f('0x18')],_0x529496);_0x5b83d4(_0x2b5d17[_0x4f0f('0x16')](0x1f4,_0x21f8a1['message']));});});}; \ No newline at end of file +var _0x9c03=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','ShowSmsQueue','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9c03,0x18a));var _0x39c0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9c03[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x39c0('0x0'));var moment=require(_0x39c0('0x1'));var BPromise=require(_0x39c0('0x2'));var rs=require(_0x39c0('0x3'));var fs=require('fs');var Redis=require(_0x39c0('0x4'));var db=require(_0x39c0('0x5'))['db'];var utils=require(_0x39c0('0x6'));var logger=require(_0x39c0('0x7'))('rpc');var config=require(_0x39c0('0x8'));var jayson=require(_0x39c0('0x9'));var client=jayson['client'][_0x39c0('0xa')]({'port':0x232a});config[_0x39c0('0xb')]=_[_0x39c0('0xc')](config[_0x39c0('0xb')],{'host':_0x39c0('0xd'),'port':0x18eb});var socket=require(_0x39c0('0xe'))(new Redis(config['redis']));require(_0x39c0('0xf'))['register'](socket);function respondWithRpcPromise(_0x75d38a,_0x1b5adf,_0x4546cc){return new BPromise(function(_0x724bd8,_0x3af341){return client[_0x39c0('0x10')](_0x75d38a,_0x4546cc)['then'](function(_0x4fa9cf){logger[_0x39c0('0x11')](_0x39c0('0x12'),_0x1b5adf,_0x39c0('0x13'));logger[_0x39c0('0x14')](_0x39c0('0x15'),_0x1b5adf,'request\x20sent',JSON[_0x39c0('0x16')](_0x4fa9cf));if(_0x4fa9cf[_0x39c0('0x17')]){if(_0x4fa9cf['error'][_0x39c0('0x18')]===0x1f4){logger['error'](_0x39c0('0x12'),_0x1b5adf,_0x4fa9cf[_0x39c0('0x17')][_0x39c0('0x19')]);return _0x3af341(_0x4fa9cf[_0x39c0('0x17')][_0x39c0('0x19')]);}logger['error'](_0x39c0('0x12'),_0x1b5adf,_0x4fa9cf[_0x39c0('0x17')][_0x39c0('0x19')]);return _0x724bd8(_0x4fa9cf[_0x39c0('0x17')][_0x39c0('0x19')]);}else{logger[_0x39c0('0x11')](_0x39c0('0x12'),_0x1b5adf,_0x39c0('0x13'));_0x724bd8(_0x4fa9cf['result'][_0x39c0('0x19')]);}})[_0x39c0('0x1a')](function(_0x5f3cde){logger[_0x39c0('0x17')](_0x39c0('0x12'),_0x1b5adf,_0x5f3cde);_0x3af341(_0x5f3cde);});});}exports[_0x39c0('0x1b')]=function(_0x346e06){var _0x19e126=this;return new Promise(function(_0x2222bd,_0x4a0e65){return db[_0x39c0('0x1c')][_0x39c0('0x1d')]({'raw':_0x346e06[_0x39c0('0x1e')]?_0x346e06[_0x39c0('0x1e')][_0x39c0('0x1f')]===undefined?!![]:![]:!![],'where':_0x346e06[_0x39c0('0x1e')]?_0x346e06[_0x39c0('0x1e')]['where']||null:null,'attributes':_0x346e06['options']?_0x346e06[_0x39c0('0x1e')][_0x39c0('0x20')]||null:null,'limit':_0x346e06[_0x39c0('0x1e')]?_0x346e06[_0x39c0('0x1e')][_0x39c0('0x21')]||null:null,'include':_0x346e06[_0x39c0('0x1e')]?_0x346e06['options']['include']?_[_0x39c0('0x22')](_0x346e06[_0x39c0('0x1e')][_0x39c0('0x23')],function(_0x10e3ac){return{'model':db[_0x10e3ac['model']],'as':_0x10e3ac['as'],'attributes':_0x10e3ac[_0x39c0('0x20')],'include':_0x10e3ac[_0x39c0('0x23')]?_[_0x39c0('0x22')](_0x10e3ac[_0x39c0('0x23')],function(_0x254acd){return{'model':db[_0x254acd[_0x39c0('0x24')]],'as':_0x254acd['as'],'attributes':_0x254acd[_0x39c0('0x20')],'include':_0x254acd[_0x39c0('0x23')]?_[_0x39c0('0x22')](_0x254acd[_0x39c0('0x23')],function(_0x5eec82){return{'model':db[_0x5eec82[_0x39c0('0x24')]],'as':_0x5eec82['as'],'attributes':_0x5eec82['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7a86){logger[_0x39c0('0x11')](_0x39c0('0x1b'),_0x346e06);logger[_0x39c0('0x14')]('GetSmsQueue',_0x346e06,JSON[_0x39c0('0x16')](_0x3d7a86));_0x2222bd(_0x3d7a86);})['catch'](function(_0x5d42e6){logger['error']('GetSmsQueue',_0x5d42e6[_0x39c0('0x19')],_0x346e06);_0x4a0e65(_0x19e126['error'](0x1f4,_0x5d42e6[_0x39c0('0x19')]));});});};exports[_0x39c0('0x25')]=function(_0x58f64b){var _0x4afb56=this;return new Promise(function(_0x23311b,_0x50042d){return db[_0x39c0('0x1c')][_0x39c0('0x26')]({'raw':_0x58f64b['options']?_0x58f64b[_0x39c0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x58f64b[_0x39c0('0x1e')]?_0x58f64b[_0x39c0('0x1e')]['where']||null:null,'attributes':_0x58f64b[_0x39c0('0x1e')]?_0x58f64b[_0x39c0('0x1e')][_0x39c0('0x20')]||null:null,'include':_0x58f64b['options']?_0x58f64b[_0x39c0('0x1e')][_0x39c0('0x23')]?_[_0x39c0('0x22')](_0x58f64b[_0x39c0('0x1e')][_0x39c0('0x23')],function(_0x33d63f){return{'model':db[_0x33d63f[_0x39c0('0x24')]],'as':_0x33d63f['as'],'attributes':_0x33d63f['attributes'],'include':_0x33d63f[_0x39c0('0x23')]?_[_0x39c0('0x22')](_0x33d63f[_0x39c0('0x23')],function(_0x3e1161){return{'model':db[_0x3e1161[_0x39c0('0x24')]],'as':_0x3e1161['as'],'attributes':_0x3e1161[_0x39c0('0x20')],'include':_0x3e1161['include']?_[_0x39c0('0x22')](_0x3e1161['include'],function(_0x506752){return{'model':db[_0x506752[_0x39c0('0x24')]],'as':_0x506752['as'],'attributes':_0x506752[_0x39c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39c0('0x27')](function(_0x4cdbde){logger[_0x39c0('0x11')]('ShowSmsQueue',_0x58f64b);logger[_0x39c0('0x14')](_0x39c0('0x25'),_0x58f64b,JSON['stringify'](_0x4cdbde));_0x23311b(_0x4cdbde);})[_0x39c0('0x1a')](function(_0x4dad28){logger['error'](_0x39c0('0x25'),_0x4dad28['message'],_0x58f64b);_0x50042d(_0x4afb56[_0x39c0('0x17')](0x1f4,_0x4dad28['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4b0cff0..a696c13 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 _0x23b0=['length','save','update','removeListener','register'];(function(_0x29ffd9,_0x24deee){var _0xa6b8be=function(_0x43b0b3){while(--_0x43b0b3){_0x29ffd9['push'](_0x29ffd9['shift']());}};_0xa6b8be(++_0x24deee);}(_0x23b0,0x6f));var _0x023b=function(_0x1d589c,_0x559feb){_0x1d589c=_0x1d589c-0x0;var _0x2fa7da=_0x23b0[_0x1d589c];return _0x2fa7da;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x023b('0x0'),'remove',_0x023b('0x1')];function createListener(_0x4c2b64,_0x1c867f){return function(_0x50ae61){_0x1c867f['emit'](_0x4c2b64,_0x50ae61);};}function removeListener(_0x42ab0e,_0x137c7f){return function(){SmsQueueEvents[_0x023b('0x2')](_0x42ab0e,_0x137c7f);};}exports[_0x023b('0x3')]=function(_0xbd8608){for(var _0x551da8=0x0,_0x451f97=events[_0x023b('0x4')];_0x551da8<_0x451f97;_0x551da8++){var _0x1d469a=events[_0x551da8];var _0x28a740=createListener('smsQueue:'+_0x1d469a,_0xbd8608);SmsQueueEvents['on'](_0x1d469a,_0x28a740);}}; \ No newline at end of file +var _0x5700=['emit','register','smsQueue:','./smsQueue.events','update'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5700,0x148));var _0x0570=function(_0x4eb110,_0x366d33){_0x4eb110=_0x4eb110-0x0;var _0x554429=_0x5700[_0x4eb110];return _0x554429;};'use strict';var SmsQueueEvents=require(_0x0570('0x0'));var events=['save','remove',_0x0570('0x1')];function createListener(_0x51520b,_0x339272){return function(_0x5b0f09){_0x339272[_0x0570('0x2')](_0x51520b,_0x5b0f09);};}function removeListener(_0x3acd90,_0x2c6517){return function(){SmsQueueEvents['removeListener'](_0x3acd90,_0x2c6517);};}exports[_0x0570('0x3')]=function(_0x1ff515){for(var _0x28e906=0x0,_0x5c2f01=events['length'];_0x28e906<_0x5c2f01;_0x28e906++){var _0x39929e=events[_0x28e906];var _0xe5b168=createListener(_0x0570('0x4')+_0x39929e,_0x1ff515);SmsQueueEvents['on'](_0x39929e,_0xe5b168);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c220b4c..e239c72 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 _0xb8ba=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer'];(function(_0xa4984b,_0x5ef7d8){var _0x2b0224=function(_0x40bcb1){while(--_0x40bcb1){_0xa4984b['push'](_0xa4984b['shift']());}};_0x2b0224(++_0x5ef7d8);}(_0xb8ba,0x6d));var _0xab8b=function(_0x5a8cd6,_0x10e986){_0x5a8cd6=_0x5a8cd6-0x0;var _0x465cca=_0xb8ba[_0x5a8cd6];return _0x465cca;};'use strict';var multer=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var path=require(_0xab8b('0x2'));var timeout=require('connect-timeout');var express=require(_0xab8b('0x3'));var router=express[_0xab8b('0x4')]();var fs_extra=require(_0xab8b('0x5'));var auth=require(_0xab8b('0x6'));var interaction=require(_0xab8b('0x7'));var config=require(_0xab8b('0x8'));var controller=require(_0xab8b('0x9'));router[_0xab8b('0xa')]('/',auth['isAuthenticated'](),controller[_0xab8b('0xb')]);router['get'](_0xab8b('0xc'),auth['isAuthenticated'](),controller[_0xab8b('0xd')]);router[_0xab8b('0xa')](_0xab8b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xab8b('0xf')]('/',auth[_0xab8b('0x10')](),controller[_0xab8b('0x11')]);router[_0xab8b('0x12')](_0xab8b('0xe'),auth[_0xab8b('0x10')](),controller[_0xab8b('0x13')]);router[_0xab8b('0x14')](_0xab8b('0xe'),auth[_0xab8b('0x10')](),controller[_0xab8b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbbbd=['./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11239b,_0xdfd2b0){var _0x1d51c4=function(_0x2bba88){while(--_0x2bba88){_0x11239b['push'](_0x11239b['shift']());}};_0x1d51c4(++_0xdfd2b0);}(_0xbbbd,0x86));var _0xdbbb=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xbbbd[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var path=require(_0xdbbb('0x2'));var timeout=require(_0xdbbb('0x3'));var express=require(_0xdbbb('0x4'));var router=express[_0xdbbb('0x5')]();var fs_extra=require(_0xdbbb('0x6'));var auth=require(_0xdbbb('0x7'));var interaction=require(_0xdbbb('0x8'));var config=require(_0xdbbb('0x9'));var controller=require(_0xdbbb('0xa'));router[_0xdbbb('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbbb('0xc')]);router[_0xdbbb('0xb')](_0xdbbb('0xd'),auth[_0xdbbb('0xe')](),controller[_0xdbbb('0xf')]);router[_0xdbbb('0xb')](_0xdbbb('0x10'),auth[_0xdbbb('0xe')](),controller[_0xdbbb('0x11')]);router[_0xdbbb('0x12')]('/',auth['isAuthenticated'](),controller[_0xdbbb('0x13')]);router['put'](_0xdbbb('0x10'),auth['isAuthenticated'](),controller[_0xdbbb('0x14')]);router[_0xdbbb('0x15')](_0xdbbb('0x10'),auth[_0xdbbb('0xe')](),controller[_0xdbbb('0x16')]);module[_0xdbbb('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 a08f870..44c3bc4 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 _0x58fa=['moment','exports','STRING','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x58fa,0x134));var _0xa58f=function(_0xecc140,_0x1f04d2){_0xecc140=_0xecc140-0x0;var _0x357f24=_0x58fa[_0xecc140];return _0x357f24;};'use strict';var moment=require(_0xa58f('0x0'));var Sequelize=require('sequelize');module[_0xa58f('0x1')]={'uniqueid':{'type':Sequelize[_0xa58f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa58f('0x2')]},'joinAt':{'type':Sequelize[_0xa58f('0x3')]},'leaveAt':{'type':Sequelize[_0xa58f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbec2=['STRING','DATE','moment','sequelize','exports'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0xbec2,0x1ab));var _0x2bec=function(_0x18cb05,_0x48903f){_0x18cb05=_0x18cb05-0x0;var _0x2eb534=_0xbec2[_0x18cb05];return _0x2eb534;};'use strict';var moment=require(_0x2bec('0x0'));var Sequelize=require(_0x2bec('0x1'));module[_0x2bec('0x2')]={'uniqueid':{'type':Sequelize[_0x2bec('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2bec('0x3')]},'joinAt':{'type':Sequelize[_0x2bec('0x4')]},'leaveAt':{'type':Sequelize[_0x2bec('0x4')]},'acceptAt':{'type':Sequelize[_0x2bec('0x4')]},'exitAt':{'type':Sequelize[_0x2bec('0x4')]},'reason':{'type':Sequelize[_0x2bec('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index db7f6df..e4d2767 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 _0x6ba5=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','SmsQueueReport','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x6ba5,0x8b));var _0x56ba=function(_0x358f87,_0x5a4d20){_0x358f87=_0x358f87-0x0;var _0x4b2fdb=_0x6ba5[_0x358f87];return _0x4b2fdb;};'use strict';var emlformat=require(_0x56ba('0x0'));var rimraf=require(_0x56ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56ba('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56ba('0x3'));var util=require(_0x56ba('0x4'));var path=require('path');var sox=require(_0x56ba('0x5'));var csv=require(_0x56ba('0x6'));var ejs=require(_0x56ba('0x7'));var fs=require('fs');var fs_extra=require(_0x56ba('0x8'));var _=require('lodash');var squel=require(_0x56ba('0x9'));var crypto=require(_0x56ba('0xa'));var jsforce=require(_0x56ba('0xb'));var deskjs=require(_0x56ba('0xc'));var toCsv=require(_0x56ba('0x6'));var querystring=require(_0x56ba('0xd'));var Papa=require(_0x56ba('0xe'));var Redis=require(_0x56ba('0xf'));var authService=require(_0x56ba('0x10'));var qs=require(_0x56ba('0x11'));var as=require(_0x56ba('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x56ba('0x13'));var utils=require(_0x56ba('0x14'));var config=require(_0x56ba('0x15'));var licenseUtil=require(_0x56ba('0x16'));var db=require(_0x56ba('0x17'))['db'];function respondWithStatusCode(_0x3747a7,_0x1d786b){_0x1d786b=_0x1d786b||0xcc;return function(_0x161e7e){if(_0x161e7e){return _0x3747a7[_0x56ba('0x18')](_0x1d786b);}return _0x3747a7[_0x56ba('0x19')](_0x1d786b)[_0x56ba('0x1a')]();};}function respondWithResult(_0x1b8d3e,_0x20c4ce){_0x20c4ce=_0x20c4ce||0xc8;return function(_0x153ee8){if(_0x153ee8){return _0x1b8d3e[_0x56ba('0x19')](_0x20c4ce)[_0x56ba('0x1b')](_0x153ee8);}};}function respondWithFilteredResult(_0x143590,_0x3d42c0){return function(_0x273882){if(_0x273882){var _0x2fefaa=typeof _0x3d42c0[_0x56ba('0x1c')]==='undefined'&&typeof _0x3d42c0[_0x56ba('0x1d')]===_0x56ba('0x1e');var _0x433207=_0x273882[_0x56ba('0x1f')];var _0xb77cc6=_0x2fefaa?0x0:_0x3d42c0[_0x56ba('0x1c')];var _0xb5d244=_0x2fefaa?_0x273882['count']:_0x3d42c0[_0x56ba('0x1c')]+_0x3d42c0[_0x56ba('0x1d')];var _0x57a3b1;if(_0xb5d244>=_0x433207){_0xb5d244=_0x433207;_0x57a3b1=0xc8;}else{_0x57a3b1=0xce;}_0x143590[_0x56ba('0x19')](_0x57a3b1);return _0x143590[_0x56ba('0x20')]('Content-Range',_0xb77cc6+'-'+_0xb5d244+'/'+_0x433207)[_0x56ba('0x1b')](_0x273882);}return null;};}function patchUpdates(_0x5d06a4){return function(_0x2f598d){try{jsonpatch[_0x56ba('0x21')](_0x2f598d,_0x5d06a4,!![]);}catch(_0x141f0b){return BPromise['reject'](_0x141f0b);}return _0x2f598d[_0x56ba('0x22')]();};}function saveUpdates(_0x3f94e0,_0x530783){return function(_0x23bd40){if(_0x23bd40){return _0x23bd40['update'](_0x3f94e0)[_0x56ba('0x23')](function(_0x425bda){return _0x425bda;});}return null;};}function removeEntity(_0x25e14d,_0x35415e){return function(_0xd17f99){if(_0xd17f99){return _0xd17f99[_0x56ba('0x24')]()['then'](function(){_0x25e14d[_0x56ba('0x19')](0xcc)[_0x56ba('0x1a')]();});}};}function handleEntityNotFound(_0x3f9d0f,_0x1b0adb){return function(_0x1d0d60){if(!_0x1d0d60){_0x3f9d0f[_0x56ba('0x18')](0x194);}return _0x1d0d60;};}function handleError(_0x50e8e6,_0x5ed036){_0x5ed036=_0x5ed036||0x1f4;return function(_0x1c1aed){logger[_0x56ba('0x25')](_0x1c1aed['stack']);if(_0x1c1aed[_0x56ba('0x26')]){delete _0x1c1aed['name'];}_0x50e8e6['status'](_0x5ed036)[_0x56ba('0x27')](_0x1c1aed);};}exports[_0x56ba('0x28')]=function(_0x733700,_0x581935){var _0x187550={},_0x403530={},_0x4b7a6e={'count':0x0,'rows':[]};var _0x45787d=_[_0x56ba('0x29')](db['SmsQueueReport'][_0x56ba('0x2a')],function(_0x1ec772){return{'name':_0x1ec772[_0x56ba('0x2b')],'type':_0x1ec772['type'][_0x56ba('0x2c')]};});_0x403530[_0x56ba('0x2d')]=_[_0x56ba('0x29')](_0x45787d,_0x56ba('0x26'));_0x403530[_0x56ba('0x2e')]=_[_0x56ba('0x2f')](_0x733700[_0x56ba('0x2e')]);_0x403530['filters']=_['intersection'](_0x403530['model'],_0x403530[_0x56ba('0x2e')]);_0x187550[_0x56ba('0x30')]=_[_0x56ba('0x31')](_0x403530['model'],qs[_0x56ba('0x32')](_0x733700[_0x56ba('0x2e')][_0x56ba('0x32')]));_0x187550[_0x56ba('0x30')]=_0x187550[_0x56ba('0x30')]['length']?_0x187550['attributes']:_0x403530[_0x56ba('0x2d')];if(!_0x733700[_0x56ba('0x2e')][_0x56ba('0x33')](_0x56ba('0x34'))){_0x187550[_0x56ba('0x1d')]=qs[_0x56ba('0x1d')](_0x733700[_0x56ba('0x2e')]['limit']);_0x187550[_0x56ba('0x1c')]=qs[_0x56ba('0x1c')](_0x733700[_0x56ba('0x2e')][_0x56ba('0x1c')]);}_0x187550[_0x56ba('0x35')]=qs[_0x56ba('0x36')](_0x733700[_0x56ba('0x2e')][_0x56ba('0x36')]);_0x187550[_0x56ba('0x37')]=qs[_0x56ba('0x38')](_[_0x56ba('0x39')](_0x733700[_0x56ba('0x2e')],_0x403530[_0x56ba('0x38')]),_0x45787d);if(_0x733700['query'][_0x56ba('0x3a')]){_0x187550[_0x56ba('0x37')]=_[_0x56ba('0x3b')](_0x187550[_0x56ba('0x37')],{'$or':_[_0x56ba('0x29')](_0x45787d,function(_0x1245c6){if(_0x1245c6[_0x56ba('0x3c')]!=='VIRTUAL'){var _0x48a29e={};_0x48a29e[_0x1245c6[_0x56ba('0x26')]]={'$like':'%'+_0x733700[_0x56ba('0x2e')][_0x56ba('0x3a')]+'%'};return _0x48a29e;}})});}_0x187550=_[_0x56ba('0x3b')]({},_0x187550,_0x733700[_0x56ba('0x3d')]);var _0x247372={'where':_0x187550['where']};return db[_0x56ba('0x3e')][_0x56ba('0x1f')](_0x247372)[_0x56ba('0x23')](function(_0x2301a3){_0x4b7a6e[_0x56ba('0x1f')]=_0x2301a3;if(_0x733700[_0x56ba('0x2e')][_0x56ba('0x3f')]){_0x187550[_0x56ba('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x56ba('0x41')](_0x187550);})[_0x56ba('0x23')](function(_0x2e9763){_0x4b7a6e[_0x56ba('0x42')]=_0x2e9763;return _0x4b7a6e;})['then'](respondWithFilteredResult(_0x581935,_0x187550))['catch'](handleError(_0x581935,null));};exports[_0x56ba('0x43')]=function(_0x8d7c7b,_0x4c2340){var _0x11b71a={'raw':!![],'where':{'id':_0x8d7c7b[_0x56ba('0x44')]['id']}},_0x2306c8={};_0x2306c8[_0x56ba('0x2d')]=_[_0x56ba('0x2f')](db['SmsQueueReport']['rawAttributes']);_0x2306c8[_0x56ba('0x2e')]=_['keys'](_0x8d7c7b[_0x56ba('0x2e')]);_0x2306c8['filters']=_[_0x56ba('0x31')](_0x2306c8[_0x56ba('0x2d')],_0x2306c8['query']);_0x11b71a[_0x56ba('0x30')]=_['intersection'](_0x2306c8[_0x56ba('0x2d')],qs[_0x56ba('0x32')](_0x8d7c7b[_0x56ba('0x2e')][_0x56ba('0x32')]));_0x11b71a[_0x56ba('0x30')]=_0x11b71a['attributes']['length']?_0x11b71a[_0x56ba('0x30')]:_0x2306c8[_0x56ba('0x2d')];if(_0x8d7c7b[_0x56ba('0x2e')][_0x56ba('0x3f')]){_0x11b71a[_0x56ba('0x40')]=[{'all':!![]}];}_0x11b71a=_[_0x56ba('0x3b')]({},_0x11b71a,_0x8d7c7b['options']);return db[_0x56ba('0x3e')]['find'](_0x11b71a)[_0x56ba('0x23')](handleEntityNotFound(_0x4c2340,null))[_0x56ba('0x23')](respondWithResult(_0x4c2340,null))[_0x56ba('0x45')](handleError(_0x4c2340,null));};exports[_0x56ba('0x46')]=function(_0x17f933,_0x2c181d){return db['SmsQueueReport']['create'](_0x17f933[_0x56ba('0x47')],{})[_0x56ba('0x23')](respondWithResult(_0x2c181d,0xc9))[_0x56ba('0x45')](handleError(_0x2c181d,null));};exports[_0x56ba('0x48')]=function(_0xab6d78,_0x17c862){if(_0xab6d78[_0x56ba('0x47')]['id']){delete _0xab6d78[_0x56ba('0x47')]['id'];}return db['SmsQueueReport'][_0x56ba('0x49')]({'where':{'id':_0xab6d78[_0x56ba('0x44')]['id']}})[_0x56ba('0x23')](handleEntityNotFound(_0x17c862,null))[_0x56ba('0x23')](saveUpdates(_0xab6d78[_0x56ba('0x47')],null))['then'](respondWithResult(_0x17c862,null))[_0x56ba('0x45')](handleError(_0x17c862,null));};exports[_0x56ba('0x24')]=function(_0x1b678f,_0x2547e8){return db['SmsQueueReport'][_0x56ba('0x49')]({'where':{'id':_0x1b678f[_0x56ba('0x44')]['id']}})[_0x56ba('0x23')](handleEntityNotFound(_0x2547e8,null))[_0x56ba('0x23')](removeEntity(_0x2547e8,null))[_0x56ba('0x45')](handleError(_0x2547e8,null));};exports['describe']=function(_0x1c7c59,_0x2bb70a){return db[_0x56ba('0x3e')][_0x56ba('0x4a')]()[_0x56ba('0x23')](respondWithResult(_0x2bb70a,null))['catch'](handleError(_0x2bb70a,null));}; \ No newline at end of file +var _0xba0a=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x20b2f8,_0x32dc96){var _0xf77d1c=function(_0x409ddf){while(--_0x409ddf){_0x20b2f8['push'](_0x20b2f8['shift']());}};_0xf77d1c(++_0x32dc96);}(_0xba0a,0x15e));var _0xaba0=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xba0a[_0x100682];return _0xcb6e87;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaba0('0x0'));var rp=require(_0xaba0('0x1'));var moment=require(_0xaba0('0x2'));var BPromise=require(_0xaba0('0x3'));var Mustache=require(_0xaba0('0x4'));var util=require('util');var path=require(_0xaba0('0x5'));var sox=require(_0xaba0('0x6'));var csv=require(_0xaba0('0x7'));var ejs=require(_0xaba0('0x8'));var fs=require('fs');var fs_extra=require(_0xaba0('0x9'));var _=require(_0xaba0('0xa'));var squel=require('squel');var crypto=require(_0xaba0('0xb'));var jsforce=require(_0xaba0('0xc'));var deskjs=require(_0xaba0('0xd'));var toCsv=require(_0xaba0('0x7'));var querystring=require(_0xaba0('0xe'));var Papa=require(_0xaba0('0xf'));var Redis=require(_0xaba0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaba0('0x11'));var hardwareService=require(_0xaba0('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaba0('0x13'));var db=require(_0xaba0('0x14'))['db'];function respondWithStatusCode(_0x949f7e,_0x209eed){_0x209eed=_0x209eed||0xcc;return function(_0x367761){if(_0x367761){return _0x949f7e[_0xaba0('0x15')](_0x209eed);}return _0x949f7e[_0xaba0('0x16')](_0x209eed)[_0xaba0('0x17')]();};}function respondWithResult(_0x33b6e2,_0x328f47){_0x328f47=_0x328f47||0xc8;return function(_0xa386eb){if(_0xa386eb){return _0x33b6e2[_0xaba0('0x16')](_0x328f47)[_0xaba0('0x18')](_0xa386eb);}};}function respondWithFilteredResult(_0x39ba4e,_0x54aa68){return function(_0xb5e7b){if(_0xb5e7b){var _0x32b674=typeof _0x54aa68[_0xaba0('0x19')]==='undefined'&&typeof _0x54aa68[_0xaba0('0x1a')]===_0xaba0('0x1b');var _0x409783=_0xb5e7b[_0xaba0('0x1c')];var _0x2dd927=_0x32b674?0x0:_0x54aa68['offset'];var _0x31c4c6=_0x32b674?_0xb5e7b[_0xaba0('0x1c')]:_0x54aa68[_0xaba0('0x19')]+_0x54aa68[_0xaba0('0x1a')];var _0x58454b;if(_0x31c4c6>=_0x409783){_0x31c4c6=_0x409783;_0x58454b=0xc8;}else{_0x58454b=0xce;}_0x39ba4e['status'](_0x58454b);return _0x39ba4e['set'](_0xaba0('0x1d'),_0x2dd927+'-'+_0x31c4c6+'/'+_0x409783)[_0xaba0('0x18')](_0xb5e7b);}return null;};}function patchUpdates(_0x5e2fb0){return function(_0x4848d5){try{jsonpatch[_0xaba0('0x1e')](_0x4848d5,_0x5e2fb0,!![]);}catch(_0x36ae15){return BPromise['reject'](_0x36ae15);}return _0x4848d5[_0xaba0('0x1f')]();};}function saveUpdates(_0x590a51,_0x41c43a){return function(_0x4a1dca){if(_0x4a1dca){return _0x4a1dca[_0xaba0('0x20')](_0x590a51)[_0xaba0('0x21')](function(_0x433373){return _0x433373;});}return null;};}function removeEntity(_0x25b362,_0x360276){return function(_0x517c58){if(_0x517c58){return _0x517c58[_0xaba0('0x22')]()['then'](function(){_0x25b362[_0xaba0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2220b0,_0x28743a){return function(_0x20a4a9){if(!_0x20a4a9){_0x2220b0[_0xaba0('0x15')](0x194);}return _0x20a4a9;};}function handleError(_0x48575a,_0xa7218f){_0xa7218f=_0xa7218f||0x1f4;return function(_0x5e7444){logger[_0xaba0('0x23')](_0x5e7444[_0xaba0('0x24')]);if(_0x5e7444['name']){delete _0x5e7444[_0xaba0('0x25')];}_0x48575a[_0xaba0('0x16')](_0xa7218f)['send'](_0x5e7444);};}exports[_0xaba0('0x26')]=function(_0x479f08,_0x53f162){var _0x1eeca2={},_0x31488e={},_0xbc9d4a={'count':0x0,'rows':[]};var _0x194e56=_[_0xaba0('0x27')](db[_0xaba0('0x28')]['rawAttributes'],function(_0x41193b){return{'name':_0x41193b['fieldName'],'type':_0x41193b[_0xaba0('0x29')][_0xaba0('0x2a')]};});_0x31488e[_0xaba0('0x2b')]=_[_0xaba0('0x27')](_0x194e56,_0xaba0('0x25'));_0x31488e[_0xaba0('0x2c')]=_['keys'](_0x479f08[_0xaba0('0x2c')]);_0x31488e['filters']=_[_0xaba0('0x2d')](_0x31488e[_0xaba0('0x2b')],_0x31488e['query']);_0x1eeca2[_0xaba0('0x2e')]=_[_0xaba0('0x2d')](_0x31488e[_0xaba0('0x2b')],qs[_0xaba0('0x2f')](_0x479f08[_0xaba0('0x2c')][_0xaba0('0x2f')]));_0x1eeca2['attributes']=_0x1eeca2['attributes']['length']?_0x1eeca2[_0xaba0('0x2e')]:_0x31488e[_0xaba0('0x2b')];if(!_0x479f08[_0xaba0('0x2c')][_0xaba0('0x30')](_0xaba0('0x31'))){_0x1eeca2[_0xaba0('0x1a')]=qs[_0xaba0('0x1a')](_0x479f08['query'][_0xaba0('0x1a')]);_0x1eeca2[_0xaba0('0x19')]=qs[_0xaba0('0x19')](_0x479f08[_0xaba0('0x2c')][_0xaba0('0x19')]);}_0x1eeca2[_0xaba0('0x32')]=qs[_0xaba0('0x33')](_0x479f08[_0xaba0('0x2c')][_0xaba0('0x33')]);_0x1eeca2[_0xaba0('0x34')]=qs[_0xaba0('0x35')](_[_0xaba0('0x36')](_0x479f08[_0xaba0('0x2c')],_0x31488e[_0xaba0('0x35')]),_0x194e56);if(_0x479f08['query'][_0xaba0('0x37')]){_0x1eeca2[_0xaba0('0x34')]=_[_0xaba0('0x38')](_0x1eeca2['where'],{'$or':_[_0xaba0('0x27')](_0x194e56,function(_0x872a4b){if(_0x872a4b['type']!==_0xaba0('0x39')){var _0x52d076={};_0x52d076[_0x872a4b['name']]={'$like':'%'+_0x479f08['query'][_0xaba0('0x37')]+'%'};return _0x52d076;}})});}_0x1eeca2=_[_0xaba0('0x38')]({},_0x1eeca2,_0x479f08[_0xaba0('0x3a')]);var _0x1d5166={'where':_0x1eeca2['where']};return db[_0xaba0('0x28')][_0xaba0('0x1c')](_0x1d5166)[_0xaba0('0x21')](function(_0x59685c){_0xbc9d4a['count']=_0x59685c;if(_0x479f08['query'][_0xaba0('0x3b')]){_0x1eeca2[_0xaba0('0x3c')]=[{'all':!![]}];}return db[_0xaba0('0x28')][_0xaba0('0x3d')](_0x1eeca2);})[_0xaba0('0x21')](function(_0x429a23){_0xbc9d4a[_0xaba0('0x3e')]=_0x429a23;return _0xbc9d4a;})[_0xaba0('0x21')](respondWithFilteredResult(_0x53f162,_0x1eeca2))[_0xaba0('0x3f')](handleError(_0x53f162,null));};exports['show']=function(_0x5462a5,_0x5e0bfd){var _0x25e5d0={'raw':!![],'where':{'id':_0x5462a5[_0xaba0('0x40')]['id']}},_0x443f7a={};_0x443f7a[_0xaba0('0x2b')]=_[_0xaba0('0x41')](db[_0xaba0('0x28')][_0xaba0('0x42')]);_0x443f7a['query']=_[_0xaba0('0x41')](_0x5462a5['query']);_0x443f7a[_0xaba0('0x35')]=_[_0xaba0('0x2d')](_0x443f7a[_0xaba0('0x2b')],_0x443f7a[_0xaba0('0x2c')]);_0x25e5d0['attributes']=_[_0xaba0('0x2d')](_0x443f7a[_0xaba0('0x2b')],qs[_0xaba0('0x2f')](_0x5462a5[_0xaba0('0x2c')]['fields']));_0x25e5d0[_0xaba0('0x2e')]=_0x25e5d0['attributes'][_0xaba0('0x43')]?_0x25e5d0[_0xaba0('0x2e')]:_0x443f7a[_0xaba0('0x2b')];if(_0x5462a5[_0xaba0('0x2c')]['includeAll']){_0x25e5d0['include']=[{'all':!![]}];}_0x25e5d0=_[_0xaba0('0x38')]({},_0x25e5d0,_0x5462a5[_0xaba0('0x3a')]);return db[_0xaba0('0x28')][_0xaba0('0x44')](_0x25e5d0)[_0xaba0('0x21')](handleEntityNotFound(_0x5e0bfd,null))[_0xaba0('0x21')](respondWithResult(_0x5e0bfd,null))[_0xaba0('0x3f')](handleError(_0x5e0bfd,null));};exports[_0xaba0('0x45')]=function(_0x1379ce,_0x3eeaa4){return db[_0xaba0('0x28')][_0xaba0('0x45')](_0x1379ce['body'],{})[_0xaba0('0x21')](respondWithResult(_0x3eeaa4,0xc9))['catch'](handleError(_0x3eeaa4,null));};exports['update']=function(_0x2b22ec,_0x26fd5c){if(_0x2b22ec['body']['id']){delete _0x2b22ec['body']['id'];}return db[_0xaba0('0x28')][_0xaba0('0x44')]({'where':{'id':_0x2b22ec[_0xaba0('0x40')]['id']}})['then'](handleEntityNotFound(_0x26fd5c,null))[_0xaba0('0x21')](saveUpdates(_0x2b22ec[_0xaba0('0x46')],null))[_0xaba0('0x21')](respondWithResult(_0x26fd5c,null))['catch'](handleError(_0x26fd5c,null));};exports[_0xaba0('0x22')]=function(_0x5049e7,_0x36ac0d){return db[_0xaba0('0x28')][_0xaba0('0x44')]({'where':{'id':_0x5049e7['params']['id']}})[_0xaba0('0x21')](handleEntityNotFound(_0x36ac0d,null))[_0xaba0('0x21')](removeEntity(_0x36ac0d,null))[_0xaba0('0x3f')](handleError(_0x36ac0d,null));};exports[_0xaba0('0x47')]=function(_0x10566e,_0x1340ec){return db[_0xaba0('0x28')][_0xaba0('0x47')]()[_0xaba0('0x21')](respondWithResult(_0x1340ec,null))['catch'](handleError(_0x1340ec,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1de9b35..61ad1dc 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x230a9e,_0xc5b57f){var _0x58a554=function(_0x17fe75){while(--_0x17fe75){_0x230a9e['push'](_0x230a9e['shift']());}};_0x58a554(++_0xc5b57f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0xa6414a,_0x5126b5){var _0x2aecfb=function(_0x405d99){while(--_0x405d99){_0xa6414a['push'](_0xa6414a['shift']());}};_0x2aecfb(++_0x5126b5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 1128d3d..7f9046d 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 _0x0231=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','lodash','util'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x0231,0xee));var _0x1023=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0231[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1023('0x0'));var util=require(_0x1023('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1023('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1023('0x3'))['db'];var utils=require(_0x1023('0x4'));var logger=require(_0x1023('0x5'))(_0x1023('0x6'));var config=require(_0x1023('0x7'));var jayson=require(_0x1023('0x8'));var client=jayson[_0x1023('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58a096,_0x413d07,_0x5904b0){return new BPromise(function(_0x255d79,_0x23ac48){return client[_0x1023('0xa')](_0x58a096,_0x5904b0)[_0x1023('0xb')](function(_0x9a3492){logger[_0x1023('0xc')](_0x1023('0xd'),_0x413d07,_0x1023('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x413d07,'request\x20sent',JSON[_0x1023('0xf')](_0x9a3492));if(_0x9a3492['error']){if(_0x9a3492[_0x1023('0x10')][_0x1023('0x11')]===0x1f4){logger[_0x1023('0x10')](_0x1023('0xd'),_0x413d07,_0x9a3492[_0x1023('0x10')][_0x1023('0x12')]);return _0x23ac48(_0x9a3492['error'][_0x1023('0x12')]);}logger[_0x1023('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x413d07,_0x9a3492[_0x1023('0x10')]['message']);return _0x255d79(_0x9a3492[_0x1023('0x10')][_0x1023('0x12')]);}else{logger[_0x1023('0xc')](_0x1023('0xd'),_0x413d07,_0x1023('0xe'));_0x255d79(_0x9a3492[_0x1023('0x13')][_0x1023('0x12')]);}})[_0x1023('0x14')](function(_0x3e3a31){logger['error'](_0x1023('0xd'),_0x413d07,_0x3e3a31);_0x23ac48(_0x3e3a31);});});}exports[_0x1023('0x15')]=function(_0x2b5ad1){var _0x500718=this;return new Promise(function(_0x1a20a6,_0x4a1434){return db[_0x1023('0x16')][_0x1023('0x17')](_0x2b5ad1[_0x1023('0x18')],{'raw':_0x2b5ad1[_0x1023('0x19')]?_0x2b5ad1['options'][_0x1023('0x1a')]===undefined?!![]:![]:!![]})[_0x1023('0xb')](function(_0x3de9c2){logger[_0x1023('0xc')](_0x1023('0x15'),_0x2b5ad1);logger[_0x1023('0x1b')](_0x1023('0x15'),_0x2b5ad1,JSON['stringify'](_0x3de9c2));_0x1a20a6(_0x3de9c2);})[_0x1023('0x14')](function(_0x14c60a){logger[_0x1023('0x10')](_0x1023('0x15'),_0x14c60a[_0x1023('0x12')],_0x2b5ad1);_0x4a1434(_0x500718[_0x1023('0x10')](0x1f4,_0x14c60a[_0x1023('0x12')]));});});};exports[_0x1023('0x1c')]=function(_0x517f2d){var _0x4700a8=this;return new Promise(function(_0x261355,_0x211001){return db[_0x1023('0x16')][_0x1023('0x1d')](_0x517f2d[_0x1023('0x18')],{'raw':_0x517f2d['options']?_0x517f2d['options'][_0x1023('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x517f2d[_0x1023('0x19')]?_0x517f2d[_0x1023('0x19')]['where']||null:null,'attributes':_0x517f2d[_0x1023('0x19')]?_0x517f2d[_0x1023('0x19')]['attributes']||null:null,'limit':_0x517f2d[_0x1023('0x19')]?_0x517f2d['options']['limit']||null:null})[_0x1023('0xb')](function(_0x5171ed){logger[_0x1023('0xc')](_0x1023('0x1c'),_0x517f2d);logger[_0x1023('0x1b')](_0x1023('0x1c'),_0x517f2d,JSON['stringify'](_0x5171ed));_0x261355(_0x5171ed);})[_0x1023('0x14')](function(_0x598c58){logger['error'](_0x1023('0x1c'),_0x598c58[_0x1023('0x12')],_0x517f2d);_0x211001(_0x4700a8['error'](0x1f4,_0x598c58[_0x1023('0x12')]));});});}; \ No newline at end of file +var _0x8a1b=['body','options','debug','UpdateSmsQueueReport','update','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x50467c,_0xbc559f){var _0x1fc4c2=function(_0x40ad7e){while(--_0x40ad7e){_0x50467c['push'](_0x50467c['shift']());}};_0x1fc4c2(++_0xbc559f);}(_0x8a1b,0xaf));var _0xb8a1=function(_0x9ec108,_0x439af0){_0x9ec108=_0x9ec108-0x0;var _0x6d6cee=_0x8a1b[_0x9ec108];return _0x6d6cee;};'use strict';var _=require(_0xb8a1('0x0'));var util=require('util');var moment=require(_0xb8a1('0x1'));var BPromise=require(_0xb8a1('0x2'));var rs=require(_0xb8a1('0x3'));var fs=require('fs');var Redis=require(_0xb8a1('0x4'));var db=require(_0xb8a1('0x5'))['db'];var utils=require(_0xb8a1('0x6'));var logger=require('../../config/logger')(_0xb8a1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8a1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46a949,_0x117b0b,_0x36b4dd){return new BPromise(function(_0x34a788,_0x2da56c){return client[_0xb8a1('0x9')](_0x46a949,_0x36b4dd)['then'](function(_0x362e70){logger[_0xb8a1('0xa')](_0xb8a1('0xb'),_0x117b0b,_0xb8a1('0xc'));logger['debug'](_0xb8a1('0xd'),_0x117b0b,_0xb8a1('0xc'),JSON[_0xb8a1('0xe')](_0x362e70));if(_0x362e70[_0xb8a1('0xf')]){if(_0x362e70[_0xb8a1('0xf')][_0xb8a1('0x10')]===0x1f4){logger[_0xb8a1('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x117b0b,_0x362e70[_0xb8a1('0xf')][_0xb8a1('0x11')]);return _0x2da56c(_0x362e70['error']['message']);}logger[_0xb8a1('0xf')](_0xb8a1('0xb'),_0x117b0b,_0x362e70[_0xb8a1('0xf')][_0xb8a1('0x11')]);return _0x34a788(_0x362e70[_0xb8a1('0xf')][_0xb8a1('0x11')]);}else{logger['info'](_0xb8a1('0xb'),_0x117b0b,_0xb8a1('0xc'));_0x34a788(_0x362e70[_0xb8a1('0x12')][_0xb8a1('0x11')]);}})[_0xb8a1('0x13')](function(_0x403115){logger[_0xb8a1('0xf')](_0xb8a1('0xb'),_0x117b0b,_0x403115);_0x2da56c(_0x403115);});});}exports[_0xb8a1('0x14')]=function(_0x5895e9){var _0xbdf0a0=this;return new Promise(function(_0x4896ac,_0x10c732){return db[_0xb8a1('0x15')][_0xb8a1('0x16')](_0x5895e9[_0xb8a1('0x17')],{'raw':_0x5895e9['options']?_0x5895e9[_0xb8a1('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2f3c44){logger[_0xb8a1('0xa')]('CreateSmsQueueReport',_0x5895e9);logger[_0xb8a1('0x19')](_0xb8a1('0x14'),_0x5895e9,JSON[_0xb8a1('0xe')](_0x2f3c44));_0x4896ac(_0x2f3c44);})['catch'](function(_0xff5ea2){logger[_0xb8a1('0xf')]('CreateSmsQueueReport',_0xff5ea2['message'],_0x5895e9);_0x10c732(_0xbdf0a0[_0xb8a1('0xf')](0x1f4,_0xff5ea2[_0xb8a1('0x11')]));});});};exports[_0xb8a1('0x1a')]=function(_0x3d10d0){var _0x1ee9a8=this;return new Promise(function(_0x2d1521,_0x35b6e7){return db[_0xb8a1('0x15')][_0xb8a1('0x1b')](_0x3d10d0['body'],{'raw':_0x3d10d0[_0xb8a1('0x18')]?_0x3d10d0[_0xb8a1('0x18')][_0xb8a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d10d0['options']?_0x3d10d0[_0xb8a1('0x18')][_0xb8a1('0x1d')]||null:null,'attributes':_0x3d10d0[_0xb8a1('0x18')]?_0x3d10d0[_0xb8a1('0x18')][_0xb8a1('0x1e')]||null:null,'limit':_0x3d10d0[_0xb8a1('0x18')]?_0x3d10d0['options'][_0xb8a1('0x1f')]||null:null})[_0xb8a1('0x20')](function(_0x356241){logger[_0xb8a1('0xa')](_0xb8a1('0x1a'),_0x3d10d0);logger['debug'](_0xb8a1('0x1a'),_0x3d10d0,JSON[_0xb8a1('0xe')](_0x356241));_0x2d1521(_0x356241);})[_0xb8a1('0x13')](function(_0x3c8c70){logger['error']('UpdateSmsQueueReport',_0x3c8c70[_0xb8a1('0x11')],_0x3d10d0);_0x35b6e7(_0x1ee9a8[_0xb8a1('0xf')](0x1f4,_0x3c8c70[_0xb8a1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b1129e8..153998f 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 _0xcb81=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xcb81,0x154));var _0x1cb8=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xcb81[_0x5bf420];return _0x1c5255;};'use strict';var multer=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var path=require('path');var timeout=require(_0x1cb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cb8('0x3'));var interaction=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var controller=require(_0x1cb8('0x6'));router[_0x1cb8('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb8('0x8')]);router[_0x1cb8('0x7')]('/describe',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xa')]);router[_0x1cb8('0x7')]('/:id',auth[_0x1cb8('0x9')](),controller['show']);router['post']('/',auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xb')]);router[_0x1cb8('0xc')](_0x1cb8('0xd'),auth[_0x1cb8('0x9')](),controller[_0x1cb8('0xe')]);router[_0x1cb8('0xf')](_0x1cb8('0xd'),auth['isAuthenticated'](),controller[_0x1cb8('0x10')]);module[_0x1cb8('0x11')]=router; \ No newline at end of file +var _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x10f0c8,_0x45da64){var _0x2e664b=function(_0x436e09){while(--_0x436e09){_0x10f0c8['push'](_0x10f0c8['shift']());}};_0x2e664b(++_0x45da64);}(_0xa630,0xbe));var _0x0a63=function(_0x1e8ea7,_0x30fc0a){_0x1e8ea7=_0x1e8ea7-0x0;var _0x50d0f8=_0xa630[_0x1e8ea7];return _0x50d0f8;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ed7ba85..d49df6c 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x44b839,_0x3318ad){var _0x4a2eba=function(_0xb97c53){while(--_0xb97c53){_0x44b839['push'](_0x44b839['shift']());}};_0x4a2eba(++_0x3318ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x32e33b,_0x3d54a0){_0x32e33b=_0x32e33b-0x0;var _0xd7612b=_0xedd9[_0x32e33b];return _0xd7612b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x7babd9,_0x1d1f5e){var _0x394174=function(_0x40e52a){while(--_0x40e52a){_0x7babd9['push'](_0x7babd9['shift']());}};_0x394174(++_0x1d1f5e);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1127ae4..f458251 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 _0xa2fa=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','SmsTransferReport','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x22e1ea,_0x2c0422){var _0x51264e=function(_0x34d5c0){while(--_0x34d5c0){_0x22e1ea['push'](_0x22e1ea['shift']());}};_0x51264e(++_0x2c0422);}(_0xa2fa,0x95));var _0xaa2f=function(_0x409186,_0x4b8b73){_0x409186=_0x409186-0x0;var _0x3deb43=_0xa2fa[_0x409186];return _0x3deb43;};'use strict';var emlformat=require(_0xaa2f('0x0'));var rimraf=require(_0xaa2f('0x1'));var zipdir=require(_0xaa2f('0x2'));var jsonpatch=require(_0xaa2f('0x3'));var rp=require(_0xaa2f('0x4'));var moment=require('moment');var BPromise=require(_0xaa2f('0x5'));var Mustache=require(_0xaa2f('0x6'));var util=require(_0xaa2f('0x7'));var path=require(_0xaa2f('0x8'));var sox=require(_0xaa2f('0x9'));var csv=require(_0xaa2f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa2f('0xb'));var _=require(_0xaa2f('0xc'));var squel=require('squel');var crypto=require(_0xaa2f('0xd'));var jsforce=require(_0xaa2f('0xe'));var deskjs=require(_0xaa2f('0xf'));var toCsv=require(_0xaa2f('0xa'));var querystring=require(_0xaa2f('0x10'));var Papa=require(_0xaa2f('0x11'));var Redis=require(_0xaa2f('0x12'));var authService=require(_0xaa2f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa2f('0x14'));var hardwareService=require(_0xaa2f('0x15'));var logger=require(_0xaa2f('0x16'))(_0xaa2f('0x17'));var utils=require(_0xaa2f('0x18'));var config=require(_0xaa2f('0x19'));var licenseUtil=require(_0xaa2f('0x1a'));var db=require(_0xaa2f('0x1b'))['db'];function respondWithStatusCode(_0x24c9da,_0x2edd43){_0x2edd43=_0x2edd43||0xcc;return function(_0x3743a3){if(_0x3743a3){return _0x24c9da[_0xaa2f('0x1c')](_0x2edd43);}return _0x24c9da['status'](_0x2edd43)[_0xaa2f('0x1d')]();};}function respondWithResult(_0x126d37,_0x9a0e59){_0x9a0e59=_0x9a0e59||0xc8;return function(_0x4a78e4){if(_0x4a78e4){return _0x126d37[_0xaa2f('0x1e')](_0x9a0e59)[_0xaa2f('0x1f')](_0x4a78e4);}};}function respondWithFilteredResult(_0x4cb69,_0x405f0e){return function(_0x5cb8e8){if(_0x5cb8e8){var _0x18a9c5=typeof _0x405f0e[_0xaa2f('0x20')]===_0xaa2f('0x21')&&typeof _0x405f0e['limit']===_0xaa2f('0x21');var _0x52af56=_0x5cb8e8[_0xaa2f('0x22')];var _0x171762=_0x18a9c5?0x0:_0x405f0e[_0xaa2f('0x20')];var _0x32448f=_0x18a9c5?_0x5cb8e8[_0xaa2f('0x22')]:_0x405f0e[_0xaa2f('0x20')]+_0x405f0e[_0xaa2f('0x23')];var _0x2636dd;if(_0x32448f>=_0x52af56){_0x32448f=_0x52af56;_0x2636dd=0xc8;}else{_0x2636dd=0xce;}_0x4cb69[_0xaa2f('0x1e')](_0x2636dd);return _0x4cb69[_0xaa2f('0x24')](_0xaa2f('0x25'),_0x171762+'-'+_0x32448f+'/'+_0x52af56)[_0xaa2f('0x1f')](_0x5cb8e8);}return null;};}function patchUpdates(_0x57cb7b){return function(_0x331c78){try{jsonpatch[_0xaa2f('0x26')](_0x331c78,_0x57cb7b,!![]);}catch(_0x186a6e){return BPromise[_0xaa2f('0x27')](_0x186a6e);}return _0x331c78['save']();};}function saveUpdates(_0x1e7cf4,_0x459dc8){return function(_0x4ab436){if(_0x4ab436){return _0x4ab436[_0xaa2f('0x28')](_0x1e7cf4)[_0xaa2f('0x29')](function(_0x32c95c){return _0x32c95c;});}return null;};}function removeEntity(_0x1a084a,_0x1979ac){return function(_0x14bbac){if(_0x14bbac){return _0x14bbac[_0xaa2f('0x2a')]()[_0xaa2f('0x29')](function(){_0x1a084a[_0xaa2f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fc45,_0x537947){return function(_0x267be6){if(!_0x267be6){_0x39fc45['sendStatus'](0x194);}return _0x267be6;};}function handleError(_0x1bff96,_0x1f8132){_0x1f8132=_0x1f8132||0x1f4;return function(_0x4e1315){logger[_0xaa2f('0x2b')](_0x4e1315[_0xaa2f('0x2c')]);if(_0x4e1315['name']){delete _0x4e1315[_0xaa2f('0x2d')];}_0x1bff96['status'](_0x1f8132)[_0xaa2f('0x2e')](_0x4e1315);};}exports['index']=function(_0x2f478d,_0x546ff3){var _0x47956d={},_0x25476d={},_0x42cafb={'count':0x0,'rows':[]};var _0x46d800=_[_0xaa2f('0x2f')](db['SmsTransferReport'][_0xaa2f('0x30')],function(_0x32878d){return{'name':_0x32878d['fieldName'],'type':_0x32878d[_0xaa2f('0x31')]['key']};});_0x25476d[_0xaa2f('0x32')]=_[_0xaa2f('0x2f')](_0x46d800,'name');_0x25476d[_0xaa2f('0x33')]=_['keys'](_0x2f478d[_0xaa2f('0x33')]);_0x25476d['filters']=_['intersection'](_0x25476d[_0xaa2f('0x32')],_0x25476d[_0xaa2f('0x33')]);_0x47956d[_0xaa2f('0x34')]=_[_0xaa2f('0x35')](_0x25476d['model'],qs[_0xaa2f('0x36')](_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x36')]));_0x47956d[_0xaa2f('0x34')]=_0x47956d[_0xaa2f('0x34')][_0xaa2f('0x37')]?_0x47956d[_0xaa2f('0x34')]:_0x25476d[_0xaa2f('0x32')];if(!_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x38')](_0xaa2f('0x39'))){_0x47956d[_0xaa2f('0x23')]=qs[_0xaa2f('0x23')](_0x2f478d['query']['limit']);_0x47956d[_0xaa2f('0x20')]=qs[_0xaa2f('0x20')](_0x2f478d[_0xaa2f('0x33')]['offset']);}_0x47956d['order']=qs[_0xaa2f('0x3a')](_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3a')]);_0x47956d[_0xaa2f('0x3b')]=qs[_0xaa2f('0x3c')](_[_0xaa2f('0x3d')](_0x2f478d[_0xaa2f('0x33')],_0x25476d[_0xaa2f('0x3c')]),_0x46d800);if(_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3e')]){_0x47956d[_0xaa2f('0x3b')]=_['merge'](_0x47956d[_0xaa2f('0x3b')],{'$or':_[_0xaa2f('0x2f')](_0x46d800,function(_0x367f2e){if(_0x367f2e[_0xaa2f('0x31')]!==_0xaa2f('0x3f')){var _0x225605={};_0x225605[_0x367f2e[_0xaa2f('0x2d')]]={'$like':'%'+_0x2f478d[_0xaa2f('0x33')][_0xaa2f('0x3e')]+'%'};return _0x225605;}})});}_0x47956d=_[_0xaa2f('0x40')]({},_0x47956d,_0x2f478d[_0xaa2f('0x41')]);var _0x5270f3={'where':_0x47956d[_0xaa2f('0x3b')]};return db[_0xaa2f('0x42')][_0xaa2f('0x22')](_0x5270f3)[_0xaa2f('0x29')](function(_0x43c608){_0x42cafb[_0xaa2f('0x22')]=_0x43c608;if(_0x2f478d[_0xaa2f('0x33')]['includeAll']){_0x47956d[_0xaa2f('0x43')]=[{'all':!![]}];}return db[_0xaa2f('0x42')][_0xaa2f('0x44')](_0x47956d);})['then'](function(_0x1a6a80){_0x42cafb['rows']=_0x1a6a80;return _0x42cafb;})[_0xaa2f('0x29')](respondWithFilteredResult(_0x546ff3,_0x47956d))[_0xaa2f('0x45')](handleError(_0x546ff3,null));};exports[_0xaa2f('0x46')]=function(_0x358def,_0x4dd7d3){var _0x3a060c={'raw':!![],'where':{'id':_0x358def[_0xaa2f('0x47')]['id']}},_0x15646a={};_0x15646a[_0xaa2f('0x32')]=_['keys'](db[_0xaa2f('0x42')]['rawAttributes']);_0x15646a[_0xaa2f('0x33')]=_[_0xaa2f('0x48')](_0x358def['query']);_0x15646a[_0xaa2f('0x3c')]=_[_0xaa2f('0x35')](_0x15646a[_0xaa2f('0x32')],_0x15646a['query']);_0x3a060c[_0xaa2f('0x34')]=_[_0xaa2f('0x35')](_0x15646a['model'],qs[_0xaa2f('0x36')](_0x358def[_0xaa2f('0x33')][_0xaa2f('0x36')]));_0x3a060c[_0xaa2f('0x34')]=_0x3a060c[_0xaa2f('0x34')][_0xaa2f('0x37')]?_0x3a060c[_0xaa2f('0x34')]:_0x15646a[_0xaa2f('0x32')];if(_0x358def[_0xaa2f('0x33')]['includeAll']){_0x3a060c['include']=[{'all':!![]}];}_0x3a060c=_[_0xaa2f('0x40')]({},_0x3a060c,_0x358def[_0xaa2f('0x41')]);return db[_0xaa2f('0x42')][_0xaa2f('0x49')](_0x3a060c)['then'](handleEntityNotFound(_0x4dd7d3,null))[_0xaa2f('0x29')](respondWithResult(_0x4dd7d3,null))[_0xaa2f('0x45')](handleError(_0x4dd7d3,null));};exports[_0xaa2f('0x4a')]=function(_0xf8f6f9,_0x48a32d){return db['SmsTransferReport']['create'](_0xf8f6f9[_0xaa2f('0x4b')],{})[_0xaa2f('0x29')](respondWithResult(_0x48a32d,0xc9))[_0xaa2f('0x45')](handleError(_0x48a32d,null));};exports['update']=function(_0xbe260e,_0x512ccd){if(_0xbe260e[_0xaa2f('0x4b')]['id']){delete _0xbe260e[_0xaa2f('0x4b')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0xbe260e[_0xaa2f('0x47')]['id']}})[_0xaa2f('0x29')](handleEntityNotFound(_0x512ccd,null))['then'](saveUpdates(_0xbe260e[_0xaa2f('0x4b')],null))['then'](respondWithResult(_0x512ccd,null))[_0xaa2f('0x45')](handleError(_0x512ccd,null));};exports[_0xaa2f('0x2a')]=function(_0x5c01c1,_0x3d45b8){return db[_0xaa2f('0x42')][_0xaa2f('0x49')]({'where':{'id':_0x5c01c1['params']['id']}})[_0xaa2f('0x29')](handleEntityNotFound(_0x3d45b8,null))['then'](removeEntity(_0x3d45b8,null))['catch'](handleError(_0x3d45b8,null));};exports[_0xaa2f('0x4c')]=function(_0x200d4b,_0x11649e){return db['SmsTransferReport'][_0xaa2f('0x4c')]()['then'](respondWithResult(_0x11649e,null))['catch'](handleError(_0x11649e,null));}; \ No newline at end of file +var _0x0e63=['index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','save','then','error','stack','name','send'];(function(_0x1f9d6d,_0x46940f){var _0x2ded5d=function(_0x137bbf){while(--_0x137bbf){_0x1f9d6d['push'](_0x1f9d6d['shift']());}};_0x2ded5d(++_0x46940f);}(_0x0e63,0x1c7));var _0x30e6=function(_0x2efbf6,_0x2aa1e0){_0x2efbf6=_0x2efbf6-0x0;var _0x319f0b=_0x0e63[_0x2efbf6];return _0x319f0b;};'use strict';var emlformat=require(_0x30e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30e6('0x2'));var moment=require(_0x30e6('0x3'));var BPromise=require(_0x30e6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x30e6('0x5'));var csv=require('to-csv');var ejs=require(_0x30e6('0x6'));var fs=require('fs');var fs_extra=require(_0x30e6('0x7'));var _=require(_0x30e6('0x8'));var squel=require(_0x30e6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30e6('0xa'));var toCsv=require(_0x30e6('0xb'));var querystring=require(_0x30e6('0xc'));var Papa=require(_0x30e6('0xd'));var Redis=require(_0x30e6('0xe'));var authService=require(_0x30e6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30e6('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x30e6('0x11'));var licenseUtil=require(_0x30e6('0x12'));var db=require(_0x30e6('0x13'))['db'];function respondWithStatusCode(_0x2f711b,_0x5906ed){_0x5906ed=_0x5906ed||0xcc;return function(_0x37b3e1){if(_0x37b3e1){return _0x2f711b[_0x30e6('0x14')](_0x5906ed);}return _0x2f711b['status'](_0x5906ed)[_0x30e6('0x15')]();};}function respondWithResult(_0x4bc4d2,_0x50173e){_0x50173e=_0x50173e||0xc8;return function(_0x510bad){if(_0x510bad){return _0x4bc4d2[_0x30e6('0x16')](_0x50173e)[_0x30e6('0x17')](_0x510bad);}};}function respondWithFilteredResult(_0x2a2981,_0x58c750){return function(_0x5294f7){if(_0x5294f7){var _0x5184f1=typeof _0x58c750[_0x30e6('0x18')]===_0x30e6('0x19')&&typeof _0x58c750[_0x30e6('0x1a')]===_0x30e6('0x19');var _0xc64991=_0x5294f7['count'];var _0x464033=_0x5184f1?0x0:_0x58c750[_0x30e6('0x18')];var _0x3c04bc=_0x5184f1?_0x5294f7['count']:_0x58c750[_0x30e6('0x18')]+_0x58c750[_0x30e6('0x1a')];var _0xd8c9dd;if(_0x3c04bc>=_0xc64991){_0x3c04bc=_0xc64991;_0xd8c9dd=0xc8;}else{_0xd8c9dd=0xce;}_0x2a2981['status'](_0xd8c9dd);return _0x2a2981[_0x30e6('0x1b')]('Content-Range',_0x464033+'-'+_0x3c04bc+'/'+_0xc64991)['json'](_0x5294f7);}return null;};}function patchUpdates(_0x2d6e26){return function(_0x36ba31){try{jsonpatch[_0x30e6('0x1c')](_0x36ba31,_0x2d6e26,!![]);}catch(_0x1dd6e0){return BPromise['reject'](_0x1dd6e0);}return _0x36ba31[_0x30e6('0x1d')]();};}function saveUpdates(_0x33c35d,_0x3831ab){return function(_0x561dd0){if(_0x561dd0){return _0x561dd0['update'](_0x33c35d)[_0x30e6('0x1e')](function(_0x4b1370){return _0x4b1370;});}return null;};}function removeEntity(_0x440135,_0x3cfef0){return function(_0x226a33){if(_0x226a33){return _0x226a33['destroy']()['then'](function(){_0x440135[_0x30e6('0x16')](0xcc)[_0x30e6('0x15')]();});}};}function handleEntityNotFound(_0x19ff38,_0x126645){return function(_0x3a3ffd){if(!_0x3a3ffd){_0x19ff38['sendStatus'](0x194);}return _0x3a3ffd;};}function handleError(_0x44d33f,_0x4c37cb){_0x4c37cb=_0x4c37cb||0x1f4;return function(_0x15dfea){logger[_0x30e6('0x1f')](_0x15dfea[_0x30e6('0x20')]);if(_0x15dfea['name']){delete _0x15dfea[_0x30e6('0x21')];}_0x44d33f['status'](_0x4c37cb)[_0x30e6('0x22')](_0x15dfea);};}exports[_0x30e6('0x23')]=function(_0x19c109,_0x122f11){var _0x3f6dc9={},_0x443475={},_0x43c221={'count':0x0,'rows':[]};var _0x15390f=_[_0x30e6('0x24')](db[_0x30e6('0x25')][_0x30e6('0x26')],function(_0x137189){return{'name':_0x137189[_0x30e6('0x27')],'type':_0x137189[_0x30e6('0x28')][_0x30e6('0x29')]};});_0x443475['model']=_[_0x30e6('0x24')](_0x15390f,_0x30e6('0x21'));_0x443475[_0x30e6('0x2a')]=_[_0x30e6('0x2b')](_0x19c109[_0x30e6('0x2a')]);_0x443475[_0x30e6('0x2c')]=_['intersection'](_0x443475[_0x30e6('0x2d')],_0x443475[_0x30e6('0x2a')]);_0x3f6dc9[_0x30e6('0x2e')]=_[_0x30e6('0x2f')](_0x443475[_0x30e6('0x2d')],qs[_0x30e6('0x30')](_0x19c109[_0x30e6('0x2a')][_0x30e6('0x30')]));_0x3f6dc9[_0x30e6('0x2e')]=_0x3f6dc9[_0x30e6('0x2e')]['length']?_0x3f6dc9[_0x30e6('0x2e')]:_0x443475['model'];if(!_0x19c109['query']['hasOwnProperty']('nolimit')){_0x3f6dc9[_0x30e6('0x1a')]=qs[_0x30e6('0x1a')](_0x19c109[_0x30e6('0x2a')][_0x30e6('0x1a')]);_0x3f6dc9[_0x30e6('0x18')]=qs['offset'](_0x19c109[_0x30e6('0x2a')][_0x30e6('0x18')]);}_0x3f6dc9['order']=qs[_0x30e6('0x31')](_0x19c109[_0x30e6('0x2a')][_0x30e6('0x31')]);_0x3f6dc9[_0x30e6('0x32')]=qs[_0x30e6('0x2c')](_[_0x30e6('0x33')](_0x19c109[_0x30e6('0x2a')],_0x443475['filters']),_0x15390f);if(_0x19c109[_0x30e6('0x2a')][_0x30e6('0x34')]){_0x3f6dc9['where']=_[_0x30e6('0x35')](_0x3f6dc9[_0x30e6('0x32')],{'$or':_[_0x30e6('0x24')](_0x15390f,function(_0x3000e1){if(_0x3000e1[_0x30e6('0x28')]!=='VIRTUAL'){var _0x131e9a={};_0x131e9a[_0x3000e1[_0x30e6('0x21')]]={'$like':'%'+_0x19c109['query']['filter']+'%'};return _0x131e9a;}})});}_0x3f6dc9=_['merge']({},_0x3f6dc9,_0x19c109[_0x30e6('0x36')]);var _0x313c0a={'where':_0x3f6dc9[_0x30e6('0x32')]};return db[_0x30e6('0x25')]['count'](_0x313c0a)[_0x30e6('0x1e')](function(_0x4eeeb2){_0x43c221[_0x30e6('0x37')]=_0x4eeeb2;if(_0x19c109[_0x30e6('0x2a')][_0x30e6('0x38')]){_0x3f6dc9[_0x30e6('0x39')]=[{'all':!![]}];}return db[_0x30e6('0x25')][_0x30e6('0x3a')](_0x3f6dc9);})[_0x30e6('0x1e')](function(_0x18258c){_0x43c221[_0x30e6('0x3b')]=_0x18258c;return _0x43c221;})[_0x30e6('0x1e')](respondWithFilteredResult(_0x122f11,_0x3f6dc9))[_0x30e6('0x3c')](handleError(_0x122f11,null));};exports[_0x30e6('0x3d')]=function(_0x4511c9,_0x1aa40f){var _0x252309={'raw':!![],'where':{'id':_0x4511c9[_0x30e6('0x3e')]['id']}},_0x1470da={};_0x1470da['model']=_[_0x30e6('0x2b')](db[_0x30e6('0x25')][_0x30e6('0x26')]);_0x1470da[_0x30e6('0x2a')]=_[_0x30e6('0x2b')](_0x4511c9[_0x30e6('0x2a')]);_0x1470da[_0x30e6('0x2c')]=_[_0x30e6('0x2f')](_0x1470da['model'],_0x1470da[_0x30e6('0x2a')]);_0x252309[_0x30e6('0x2e')]=_[_0x30e6('0x2f')](_0x1470da[_0x30e6('0x2d')],qs[_0x30e6('0x30')](_0x4511c9[_0x30e6('0x2a')][_0x30e6('0x30')]));_0x252309[_0x30e6('0x2e')]=_0x252309[_0x30e6('0x2e')][_0x30e6('0x3f')]?_0x252309[_0x30e6('0x2e')]:_0x1470da[_0x30e6('0x2d')];if(_0x4511c9[_0x30e6('0x2a')]['includeAll']){_0x252309['include']=[{'all':!![]}];}_0x252309=_[_0x30e6('0x35')]({},_0x252309,_0x4511c9[_0x30e6('0x36')]);return db[_0x30e6('0x25')][_0x30e6('0x40')](_0x252309)[_0x30e6('0x1e')](handleEntityNotFound(_0x1aa40f,null))['then'](respondWithResult(_0x1aa40f,null))[_0x30e6('0x3c')](handleError(_0x1aa40f,null));};exports[_0x30e6('0x41')]=function(_0x288c1c,_0x46e484){return db[_0x30e6('0x25')][_0x30e6('0x41')](_0x288c1c[_0x30e6('0x42')],{})[_0x30e6('0x1e')](respondWithResult(_0x46e484,0xc9))[_0x30e6('0x3c')](handleError(_0x46e484,null));};exports[_0x30e6('0x43')]=function(_0x40363b,_0x113457){if(_0x40363b[_0x30e6('0x42')]['id']){delete _0x40363b['body']['id'];}return db[_0x30e6('0x25')]['find']({'where':{'id':_0x40363b[_0x30e6('0x3e')]['id']}})[_0x30e6('0x1e')](handleEntityNotFound(_0x113457,null))['then'](saveUpdates(_0x40363b[_0x30e6('0x42')],null))[_0x30e6('0x1e')](respondWithResult(_0x113457,null))[_0x30e6('0x3c')](handleError(_0x113457,null));};exports[_0x30e6('0x44')]=function(_0x55dddc,_0xd2e6aa){return db['SmsTransferReport'][_0x30e6('0x40')]({'where':{'id':_0x55dddc[_0x30e6('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd2e6aa,null))[_0x30e6('0x1e')](removeEntity(_0xd2e6aa,null))[_0x30e6('0x3c')](handleError(_0xd2e6aa,null));};exports['describe']=function(_0x125eaa,_0x3d5391){return db['SmsTransferReport'][_0x30e6('0x45')]()[_0x30e6('0x1e')](respondWithResult(_0x3d5391,null))[_0x30e6('0x3c')](handleError(_0x3d5391,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3d5905c..4f8c57d 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 _0x6782=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer'];(function(_0x52bd65,_0x160646){var _0x13fd57=function(_0xe84392){while(--_0xe84392){_0x52bd65['push'](_0x52bd65['shift']());}};_0x13fd57(++_0x160646);}(_0x6782,0xdd));var _0x2678=function(_0x116142,_0x5c61df){_0x116142=_0x116142-0x0;var _0x22c343=_0x6782[_0x116142];return _0x22c343;};'use strict';var _=require(_0x2678('0x0'));var util=require('util');var logger=require(_0x2678('0x1'))(_0x2678('0x2'));var moment=require('moment');var BPromise=require(_0x2678('0x3'));var rp=require(_0x2678('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2678('0x5'));var attributes=require(_0x2678('0x6'));module[_0x2678('0x7')]=function(_0x51e828,_0x5f2b1e){return _0x51e828['define']('SmsTransferReport',attributes,{'tableName':_0x2678('0x8'),'paranoid':![],'indexes':[{'name':_0x2678('0x9'),'fields':[_0x2678('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1433=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1433,0x121));var _0x3143=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1433[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[{'name':_0x3143('0xc'),'fields':[_0x3143('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ecea76d..ad1ff15 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 _0x4f5d=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4f5d[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var moment=require(_0xd4f5('0x2'));var BPromise=require(_0xd4f5('0x3'));var rs=require(_0xd4f5('0x4'));var fs=require('fs');var Redis=require(_0xd4f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f5('0x6'));var logger=require(_0xd4f5('0x7'))(_0xd4f5('0x8'));var config=require(_0xd4f5('0x9'));var jayson=require(_0xd4f5('0xa'));var client=jayson[_0xd4f5('0xb')][_0xd4f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ab294,_0x150de6,_0x1d2d72){return new BPromise(function(_0xee2bc,_0x2690e8){return client[_0xd4f5('0xd')](_0x3ab294,_0x1d2d72)['then'](function(_0x4424cb){logger[_0xd4f5('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x150de6,_0xd4f5('0xf'));logger[_0xd4f5('0x10')](_0xd4f5('0x11'),_0x150de6,_0xd4f5('0xf'),JSON[_0xd4f5('0x12')](_0x4424cb));if(_0x4424cb[_0xd4f5('0x13')]){if(_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x14')]===0x1f4){logger[_0xd4f5('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x150de6,_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x15')]);return _0x2690e8(_0x4424cb['error'][_0xd4f5('0x15')]);}logger[_0xd4f5('0x13')](_0xd4f5('0x16'),_0x150de6,_0x4424cb['error'][_0xd4f5('0x15')]);return _0xee2bc(_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x15')]);}else{logger[_0xd4f5('0xe')](_0xd4f5('0x16'),_0x150de6,_0xd4f5('0xf'));_0xee2bc(_0x4424cb[_0xd4f5('0x17')][_0xd4f5('0x15')]);}})['catch'](function(_0x452e46){logger['error'](_0xd4f5('0x16'),_0x150de6,_0x452e46);_0x2690e8(_0x452e46);});});} \ No newline at end of file +var _0xdc0d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x3bf202,_0xa6b30c){var _0x868b89=function(_0xd28039){while(--_0xd28039){_0x3bf202['push'](_0x3bf202['shift']());}};_0x868b89(++_0xa6b30c);}(_0xdc0d,0x1db));var _0xddc0=function(_0x294783,_0x143638){_0x294783=_0x294783-0x0;var _0xb4b903=_0xdc0d[_0x294783];return _0xb4b903;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var moment=require('moment');var BPromise=require(_0xddc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddc0('0x3'));var db=require(_0xddc0('0x4'))['db'];var utils=require(_0xddc0('0x5'));var logger=require(_0xddc0('0x6'))(_0xddc0('0x7'));var config=require(_0xddc0('0x8'));var jayson=require(_0xddc0('0x9'));var client=jayson[_0xddc0('0xa')][_0xddc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dca02,_0x350899,_0x36760a){return new BPromise(function(_0x3fde68,_0x288149){return client[_0xddc0('0xc')](_0x5dca02,_0x36760a)[_0xddc0('0xd')](function(_0x5ddc10){logger[_0xddc0('0xe')](_0xddc0('0xf'),_0x350899,_0xddc0('0x10'));logger[_0xddc0('0x11')](_0xddc0('0x12'),_0x350899,_0xddc0('0x10'),JSON[_0xddc0('0x13')](_0x5ddc10));if(_0x5ddc10[_0xddc0('0x14')]){if(_0x5ddc10['error'][_0xddc0('0x15')]===0x1f4){logger[_0xddc0('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x350899,_0x5ddc10[_0xddc0('0x14')][_0xddc0('0x16')]);return _0x288149(_0x5ddc10[_0xddc0('0x14')][_0xddc0('0x16')]);}logger[_0xddc0('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x350899,_0x5ddc10[_0xddc0('0x14')][_0xddc0('0x16')]);return _0x3fde68(_0x5ddc10['error'][_0xddc0('0x16')]);}else{logger['info'](_0xddc0('0xf'),_0x350899,_0xddc0('0x10'));_0x3fde68(_0x5ddc10[_0xddc0('0x17')]['message']);}})['catch'](function(_0x22cf96){logger[_0xddc0('0x14')](_0xddc0('0xf'),_0x350899,_0x22cf96);_0x288149(_0x22cf96);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 82339a4..d673426 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 _0xf576=['replace','%s-%s%s','now','extname','post','single','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','index','get','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname'];(function(_0x18427e,_0x358c0e){var _0x236816=function(_0x50576c){while(--_0x50576c){_0x18427e['push'](_0x18427e['shift']());}};_0x236816(++_0x358c0e);}(_0xf576,0x1eb));var _0x6f57=function(_0x1a031e,_0x6b2faf){_0x1a031e=_0x1a031e-0x0;var _0x278a53=_0xf576[_0x1a031e];return _0x278a53;};'use strict';var multer=require(_0x6f57('0x0'));var util=require(_0x6f57('0x1'));var path=require(_0x6f57('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f57('0x3'));var router=express[_0x6f57('0x4')]();var fs_extra=require(_0x6f57('0x5'));var auth=require(_0x6f57('0x6'));var interaction=require(_0x6f57('0x7'));var config=require('../../config/environment');var controller=require(_0x6f57('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6f57('0x9')]);router[_0x6f57('0xa')](_0x6f57('0xb'),auth['isAuthenticated'](),controller[_0x6f57('0xc')]);router['get'](_0x6f57('0xd'),auth[_0x6f57('0xe')](),controller[_0x6f57('0xf')]);var upload=multer({'storage':multer[_0x6f57('0x10')]({'destination':function(_0x110371,_0x520ef0,_0x38d75b){_0x38d75b(null,path[_0x6f57('0x11')](config[_0x6f57('0x12')],_0x6f57('0x13')));},'filename':function(_0x237b96,_0x2d2cbe,_0x53a69a){_0x2d2cbe[_0x6f57('0x14')]=_0x2d2cbe['originalname'][_0x6f57('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53a69a(null,util['format'](_0x6f57('0x16'),path['basename'](_0x2d2cbe[_0x6f57('0x14')],path['extname'](_0x2d2cbe[_0x6f57('0x14')])),Date[_0x6f57('0x17')](),path[_0x6f57('0x18')](_0x2d2cbe['originalname'])));}})});router[_0x6f57('0x19')]('/',upload[_0x6f57('0x1a')]('file'),controller[_0x6f57('0x1b')]);router[_0x6f57('0x1c')](_0x6f57('0xb'),auth['isAuthenticated'](),controller[_0x6f57('0x1d')]);router[_0x6f57('0x1e')](_0x6f57('0xb'),auth['isAuthenticated'](),controller[_0x6f57('0x1e')]);module[_0x6f57('0x1f')]=router; \ No newline at end of file +var _0x27b5=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','/:id','show','get','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','format','basename','extname','now','file','create','update','delete','exports','multer'];(function(_0x34439f,_0x5f2f7f){var _0x310935=function(_0x4baaf9){while(--_0x4baaf9){_0x34439f['push'](_0x34439f['shift']());}};_0x310935(++_0x5f2f7f);}(_0x27b5,0x6b));var _0x527b=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x27b5[_0x5c4e16];return _0x36044a;};'use strict';var multer=require(_0x527b('0x0'));var util=require(_0x527b('0x1'));var path=require(_0x527b('0x2'));var timeout=require(_0x527b('0x3'));var express=require('express');var router=express[_0x527b('0x4')]();var fs_extra=require(_0x527b('0x5'));var auth=require(_0x527b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x527b('0x7'));var controller=require(_0x527b('0x8'));router['get']('/',auth[_0x527b('0x9')](),controller['index']);router['get'](_0x527b('0xa'),auth['isAuthenticated'](),controller[_0x527b('0xb')]);router[_0x527b('0xc')](_0x527b('0xd'),auth[_0x527b('0x9')](),controller[_0x527b('0xe')]);var upload=multer({'storage':multer[_0x527b('0xf')]({'destination':function(_0x5d5d0f,_0x91a0f2,_0x401993){_0x401993(null,path['join'](config['root'],_0x527b('0x10')));},'filename':function(_0x3994d2,_0x2711bb,_0x4eecdc){_0x2711bb[_0x527b('0x11')]=_0x2711bb[_0x527b('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4eecdc(null,util[_0x527b('0x12')]('%s-%s%s',path[_0x527b('0x13')](_0x2711bb['originalname'],path[_0x527b('0x14')](_0x2711bb['originalname'])),Date[_0x527b('0x15')](),path[_0x527b('0x14')](_0x2711bb[_0x527b('0x11')])));}})});router['post']('/',upload['single'](_0x527b('0x16')),controller[_0x527b('0x17')]);router['put']('/:id',auth[_0x527b('0x9')](),controller[_0x527b('0x18')]);router[_0x527b('0x19')](_0x527b('0xa'),auth[_0x527b('0x9')](),controller['delete']);module[_0x527b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 987b4cf..5536673 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 _0xf4cb=['FLOAT','INTEGER','BIGINT','exports','STRING','name'];(function(_0x137236,_0x18e769){var _0x6ca3f8=function(_0x253505){while(--_0x253505){_0x137236['push'](_0x137236['shift']());}};_0x6ca3f8(++_0x18e769);}(_0xf4cb,0x1c5));var _0xbf4c=function(_0x4cae56,_0x461026){_0x4cae56=_0x4cae56-0x0;var _0x721d5c=_0xf4cb[_0x4cae56];return _0x721d5c;};'use strict';var Sequelize=require('sequelize');module[_0xbf4c('0x0')]={'name':{'type':Sequelize[_0xbf4c('0x1')],'unique':_0xbf4c('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xbf4c('0x1')]},'display_name':{'type':Sequelize[_0xbf4c('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xbf4c('0x1')]},'original_format':{'type':Sequelize[_0xbf4c('0x1')]},'original_duration':{'type':Sequelize[_0xbf4c('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xbf4c('0x4')]},'original_bitRate':{'type':Sequelize[_0xbf4c('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xbf4c('0x1')]},'converted_duration':{'type':Sequelize[_0xbf4c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xbf4c('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xbf4c('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5183=['FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x4748ef,_0x4ad3ff){var _0x3d640d=function(_0xe3817f){while(--_0xe3817f){_0x4748ef['push'](_0x4748ef['shift']());}};_0x3d640d(++_0x4ad3ff);}(_0x5183,0xf3));var _0x3518=function(_0x446239,_0x12b6e3){_0x446239=_0x446239-0x0;var _0x3cb181=_0x5183[_0x446239];return _0x3cb181;};'use strict';var Sequelize=require(_0x3518('0x0'));module['exports']={'name':{'type':Sequelize[_0x3518('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3518('0x1')]},'display_name':{'type':Sequelize[_0x3518('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3518('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x3518('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3518('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x3518('0x3')]},'original_sampleRate':{'type':Sequelize[_0x3518('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x3518('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3518('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x3518('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a5e3fab..dfb3db5 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 _0x24b8=['body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','download','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x24b8,0x112));var _0x824b=function(_0x3e7844,_0x2c04ae){_0x3e7844=_0x3e7844-0x0;var _0x46ec0a=_0x24b8[_0x3e7844];return _0x46ec0a;};'use strict';var emlformat=require(_0x824b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x824b('0x1'));var jsonpatch=require(_0x824b('0x2'));var rp=require(_0x824b('0x3'));var moment=require(_0x824b('0x4'));var BPromise=require(_0x824b('0x5'));var Mustache=require(_0x824b('0x6'));var util=require(_0x824b('0x7'));var path=require(_0x824b('0x8'));var sox=require(_0x824b('0x9'));var csv=require(_0x824b('0xa'));var ejs=require(_0x824b('0xb'));var fs=require('fs');var fs_extra=require(_0x824b('0xc'));var _=require(_0x824b('0xd'));var squel=require(_0x824b('0xe'));var crypto=require(_0x824b('0xf'));var jsforce=require(_0x824b('0x10'));var deskjs=require(_0x824b('0x11'));var toCsv=require(_0x824b('0xa'));var querystring=require(_0x824b('0x12'));var Papa=require(_0x824b('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x824b('0x14'));var as=require(_0x824b('0x15'));var hardwareService=require(_0x824b('0x16'));var logger=require('../../config/logger')(_0x824b('0x17'));var utils=require(_0x824b('0x18'));var config=require(_0x824b('0x19'));var licenseUtil=require(_0x824b('0x1a'));var db=require(_0x824b('0x1b'))['db'];function respondWithStatusCode(_0x3f5808,_0x41ba32){_0x41ba32=_0x41ba32||0xcc;return function(_0x507d8d){if(_0x507d8d){return _0x3f5808['sendStatus'](_0x41ba32);}return _0x3f5808[_0x824b('0x1c')](_0x41ba32)[_0x824b('0x1d')]();};}function respondWithResult(_0x3d6839,_0x22f3b7){_0x22f3b7=_0x22f3b7||0xc8;return function(_0x38f26a){if(_0x38f26a){return _0x3d6839['status'](_0x22f3b7)[_0x824b('0x1e')](_0x38f26a);}};}function respondWithFilteredResult(_0x5f441c,_0x42f4b1){return function(_0x1757a6){if(_0x1757a6){var _0xff7fbc=typeof _0x42f4b1[_0x824b('0x1f')]==='undefined'&&typeof _0x42f4b1[_0x824b('0x20')]===_0x824b('0x21');var _0x382406=_0x1757a6[_0x824b('0x22')];var _0x47b124=_0xff7fbc?0x0:_0x42f4b1[_0x824b('0x1f')];var _0x17a41b=_0xff7fbc?_0x1757a6[_0x824b('0x22')]:_0x42f4b1[_0x824b('0x1f')]+_0x42f4b1[_0x824b('0x20')];var _0x16940b;if(_0x17a41b>=_0x382406){_0x17a41b=_0x382406;_0x16940b=0xc8;}else{_0x16940b=0xce;}_0x5f441c[_0x824b('0x1c')](_0x16940b);return _0x5f441c[_0x824b('0x23')](_0x824b('0x24'),_0x47b124+'-'+_0x17a41b+'/'+_0x382406)[_0x824b('0x1e')](_0x1757a6);}return null;};}function patchUpdates(_0x19c62f){return function(_0x38ed50){try{jsonpatch[_0x824b('0x25')](_0x38ed50,_0x19c62f,!![]);}catch(_0x5f4340){return BPromise[_0x824b('0x26')](_0x5f4340);}return _0x38ed50['save']();};}function saveUpdates(_0xaf637b,_0x2a140b){return function(_0x1b99a7){if(_0x1b99a7){return _0x1b99a7[_0x824b('0x27')](_0xaf637b)[_0x824b('0x28')](function(_0x314f18){return _0x314f18;});}return null;};}function removeEntity(_0x1aca94,_0x44cdc9){return function(_0x5943db){if(_0x5943db){return _0x5943db[_0x824b('0x29')]()['then'](function(){var _0x18a7fb=_0x5943db['get']({'plain':!![]});var _0x3f6bf4=_0x824b('0x2a');return db[_0x824b('0x2b')][_0x824b('0x29')]({'where':{'type':_0x3f6bf4,'resourceId':_0x18a7fb['id']}})[_0x824b('0x28')](function(){return _0x5943db;});})[_0x824b('0x28')](function(){_0x1aca94[_0x824b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x485d80,_0x284401){return function(_0x16f9e6){if(!_0x16f9e6){_0x485d80['sendStatus'](0x194);}return _0x16f9e6;};}function handleError(_0x46eda9,_0x52359f){_0x52359f=_0x52359f||0x1f4;return function(_0x382e83){logger[_0x824b('0x2c')](_0x382e83[_0x824b('0x2d')]);if(_0x382e83['name']){delete _0x382e83[_0x824b('0x2e')];}_0x46eda9[_0x824b('0x1c')](_0x52359f)[_0x824b('0x2f')](_0x382e83);};}exports[_0x824b('0x30')]=function(_0x501188,_0x42f899){var _0x2255e8={},_0x5c20a5={},_0x3fc2ec={'count':0x0,'rows':[]};var _0x2e3feb=_['map'](db[_0x824b('0x31')]['rawAttributes'],function(_0x21075d){return{'name':_0x21075d[_0x824b('0x32')],'type':_0x21075d['type'][_0x824b('0x33')]};});_0x5c20a5[_0x824b('0x34')]=_['map'](_0x2e3feb,_0x824b('0x2e'));_0x5c20a5[_0x824b('0x35')]=_[_0x824b('0x36')](_0x501188[_0x824b('0x35')]);_0x5c20a5[_0x824b('0x37')]=_[_0x824b('0x38')](_0x5c20a5['model'],_0x5c20a5[_0x824b('0x35')]);_0x2255e8[_0x824b('0x39')]=_['intersection'](_0x5c20a5['model'],qs[_0x824b('0x3a')](_0x501188[_0x824b('0x35')][_0x824b('0x3a')]));_0x2255e8[_0x824b('0x39')]=_0x2255e8[_0x824b('0x39')][_0x824b('0x3b')]?_0x2255e8[_0x824b('0x39')]:_0x5c20a5[_0x824b('0x34')];if(!_0x501188[_0x824b('0x35')]['hasOwnProperty'](_0x824b('0x3c'))){_0x2255e8[_0x824b('0x20')]=qs[_0x824b('0x20')](_0x501188[_0x824b('0x35')][_0x824b('0x20')]);_0x2255e8[_0x824b('0x1f')]=qs[_0x824b('0x1f')](_0x501188[_0x824b('0x35')][_0x824b('0x1f')]);}_0x2255e8['order']=qs[_0x824b('0x3d')](_0x501188[_0x824b('0x35')][_0x824b('0x3d')]);_0x2255e8[_0x824b('0x3e')]=qs[_0x824b('0x37')](_[_0x824b('0x3f')](_0x501188[_0x824b('0x35')],_0x5c20a5[_0x824b('0x37')]),_0x2e3feb);if(_0x501188[_0x824b('0x35')][_0x824b('0x40')]){_0x2255e8[_0x824b('0x3e')]=_[_0x824b('0x41')](_0x2255e8['where'],{'$or':_[_0x824b('0x42')](_0x2e3feb,function(_0x7b4b6f){if(_0x7b4b6f[_0x824b('0x43')]!==_0x824b('0x44')){var _0x4d6ed5={};_0x4d6ed5[_0x7b4b6f[_0x824b('0x2e')]]={'$like':'%'+_0x501188[_0x824b('0x35')][_0x824b('0x40')]+'%'};return _0x4d6ed5;}})});}_0x2255e8=_[_0x824b('0x41')]({},_0x2255e8,_0x501188[_0x824b('0x45')]);var _0x20f148={'where':_0x2255e8[_0x824b('0x3e')]};return db[_0x824b('0x31')]['count'](_0x20f148)['then'](function(_0x227f9c){_0x3fc2ec['count']=_0x227f9c;if(_0x501188[_0x824b('0x35')]['includeAll']){_0x2255e8[_0x824b('0x46')]=[{'all':!![]}];}return db[_0x824b('0x31')][_0x824b('0x47')](_0x2255e8);})[_0x824b('0x28')](function(_0x296e8a){_0x3fc2ec[_0x824b('0x48')]=_0x296e8a;return _0x3fc2ec;})[_0x824b('0x28')](respondWithFilteredResult(_0x42f899,_0x2255e8))[_0x824b('0x49')](handleError(_0x42f899,null));};exports[_0x824b('0x4a')]=function(_0x2fc8b7,_0x125fb3){var _0x33965b={'raw':!![],'where':{'id':_0x2fc8b7['params']['id']}},_0x271a42={};_0x271a42[_0x824b('0x34')]=_[_0x824b('0x36')](db[_0x824b('0x31')]['rawAttributes']);_0x271a42[_0x824b('0x35')]=_['keys'](_0x2fc8b7[_0x824b('0x35')]);_0x271a42['filters']=_['intersection'](_0x271a42[_0x824b('0x34')],_0x271a42[_0x824b('0x35')]);_0x33965b['attributes']=_[_0x824b('0x38')](_0x271a42[_0x824b('0x34')],qs[_0x824b('0x3a')](_0x2fc8b7[_0x824b('0x35')][_0x824b('0x3a')]));_0x33965b[_0x824b('0x39')]=_0x33965b[_0x824b('0x39')]['length']?_0x33965b[_0x824b('0x39')]:_0x271a42[_0x824b('0x34')];if(_0x2fc8b7[_0x824b('0x35')][_0x824b('0x4b')]){_0x33965b[_0x824b('0x46')]=[{'all':!![]}];}_0x33965b=_[_0x824b('0x41')]({},_0x33965b,_0x2fc8b7[_0x824b('0x45')]);return db[_0x824b('0x31')][_0x824b('0x4c')](_0x33965b)[_0x824b('0x28')](handleEntityNotFound(_0x125fb3,null))[_0x824b('0x28')](respondWithResult(_0x125fb3,null))[_0x824b('0x49')](handleError(_0x125fb3,null));};exports[_0x824b('0x4d')]=function(_0x25f059,_0x2a97a3,_0x346259){return db[_0x824b('0x31')]['find']({'where':{'id':_0x25f059[_0x824b('0x4e')]['id']},'attributes':['name',_0x824b('0x4f'),_0x824b('0x50')],'raw':!![]})[_0x824b('0x28')](handleEntityNotFound(_0x2a97a3,null))[_0x824b('0x28')](function(_0x3b9fc2){if(_0x3b9fc2){if(!fs[_0x824b('0x51')](path[_0x824b('0x52')](config['root'],_0x824b('0x53'),_0x3b9fc2[_0x824b('0x4f')]+'.'+_0x3b9fc2[_0x824b('0x50')]))){throw new db[(_0x824b('0x54'))][(_0x824b('0x55'))](_0x824b('0x56'));}return _0x2a97a3[_0x824b('0x4d')](path['join'](config[_0x824b('0x57')],'server/files/sounds/converted',util[_0x824b('0x58')](_0x824b('0x59'),_0x3b9fc2[_0x824b('0x4f')],_0x3b9fc2[_0x824b('0x50')])),util[_0x824b('0x58')](_0x824b('0x59'),_0x3b9fc2[_0x824b('0x2e')],_0x3b9fc2['converted_format']));}return null;})['catch'](handleError(_0x2a97a3,null));};exports[_0x824b('0x5a')]=function(_0x2092f4,_0x582131,_0xb53052){var _0x1828b5={'name':path[_0x824b('0x5b')](_0x2092f4[_0x824b('0x5c')][_0x824b('0x5d')],path[_0x824b('0x5e')](_0x2092f4['file'][_0x824b('0x5d')])),'save_name':path[_0x824b('0x5b')](_0x2092f4[_0x824b('0x5c')][_0x824b('0x5f')],path[_0x824b('0x5e')](_0x2092f4[_0x824b('0x5c')]['filename'])),'original_format':path[_0x824b('0x5e')](_0x2092f4[_0x824b('0x5c')]['originalname'])[_0x824b('0x60')](0x1),'converted_format':'wav'};var _0x471017=path[_0x824b('0x52')](config[_0x824b('0x57')],_0x824b('0x61'),_0x2092f4[_0x824b('0x5c')][_0x824b('0x5f')]);var _0x28d0e2=path['join'](config[_0x824b('0x57')],_0x824b('0x53'),util[_0x824b('0x58')](_0x824b('0x59'),path[_0x824b('0x5b')](_0x2092f4[_0x824b('0x5c')][_0x824b('0x5f')],path[_0x824b('0x5e')](_0x2092f4['file'][_0x824b('0x5f')])),_0x1828b5[_0x824b('0x50')]));logger[_0x824b('0x62')](_0x824b('0x63'),_0x471017);logger['info'](_0x824b('0x64'),_0x28d0e2);try{fs[_0x824b('0x65')](_0x471017,parseInt('0777',0x8));var _0x53c293=sox[_0x824b('0x66')](_0x471017,_0x28d0e2,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53c293['on'](_0x824b('0x2c'),function(_0x494d2a){fs[_0x824b('0x67')](_0x471017);_0x582131['status'](0x1f4)[_0x824b('0x2f')](_0x494d2a);});_0x53c293['on'](_0x824b('0x68'),function(_0x3ed6fa){_0x1828b5[_0x824b('0x69')]=isNaN(_0x3ed6fa[_0x824b('0x6a')])?null:_0x3ed6fa['duration']*0x3e8;_0x1828b5[_0x824b('0x6b')]=isNaN(_0x3ed6fa[_0x824b('0x6c')])?null:_0x3ed6fa[_0x824b('0x6c')];_0x1828b5[_0x824b('0x6d')]=isNaN(_0x3ed6fa[_0x824b('0x6e')])?null:_0x3ed6fa['channelCount'];_0x1828b5[_0x824b('0x6f')]=isNaN(_0x3ed6fa[_0x824b('0x70')])?null:_0x3ed6fa[_0x824b('0x70')];_0x1828b5['original_sampleRate']=isNaN(_0x3ed6fa[_0x824b('0x71')])?null:_0x3ed6fa[_0x824b('0x71')];});_0x53c293['on']('dest',function(_0x5ea6a8){_0x1828b5[_0x824b('0x72')]=isNaN(_0x5ea6a8['duration'])?null:_0x5ea6a8['duration']*0x3e8;_0x1828b5[_0x824b('0x73')]=isNaN(_0x5ea6a8['sampleCount'])?null:_0x5ea6a8[_0x824b('0x6c')];_0x1828b5[_0x824b('0x74')]=isNaN(_0x5ea6a8[_0x824b('0x6e')])?null:_0x5ea6a8[_0x824b('0x6e')];_0x1828b5['converted_bitRate']=isNaN(_0x5ea6a8['bitRate'])?null:_0x5ea6a8[_0x824b('0x70')];_0x1828b5[_0x824b('0x75')]=isNaN(_0x5ea6a8[_0x824b('0x71')])?null:_0x5ea6a8[_0x824b('0x71')];});_0x53c293['on'](_0x824b('0x1d'),function(){fs[_0x824b('0x65')](_0x28d0e2,parseInt(_0x824b('0x76'),0x8));return db[_0x824b('0x31')]['create'](_0x1828b5)[_0x824b('0x28')](function(_0x2d0634){var _0x2519d0={'role':_0x2092f4[_0x824b('0x77')][_0x824b('0x78')],'userProfileId':_0x2092f4[_0x824b('0x77')][_0x824b('0x79')]};if(!_0x2519d0)throw new Error(_0x824b('0x7a'));if(_0x2519d0[_0x824b('0x78')]===_0x824b('0x7b')){var _0x3fd38f=_0x2d0634[_0x824b('0x7c')]({'plain':!![]});return db['UserProfileSection'][_0x824b('0x4c')]({'where':{'name':_0x824b('0x2a'),'userProfileId':_0x2519d0[_0x824b('0x79')]},'raw':!![]})[_0x824b('0x28')](function(_0x302a23){if(_0x302a23&&_0x302a23[_0x824b('0x7d')]===0x0){return db[_0x824b('0x2b')][_0x824b('0x5a')]({'name':_0x3fd38f[_0x824b('0x2e')],'resourceId':_0x3fd38f['id'],'type':_0x302a23[_0x824b('0x2e')],'sectionId':_0x302a23['id']},{})['then'](function(){return _0x2d0634;});}else{return _0x2d0634;}})[_0x824b('0x49')](function(_0x3a5297){logger[_0x824b('0x2c')](_0x824b('0x7e'),_0x3a5297);throw _0x3a5297;});}return _0x2d0634;})[_0x824b('0x28')](respondWithResult(_0x582131,null))[_0x824b('0x49')](handleError(_0x582131,null));});_0x53c293[_0x824b('0x7f')]();}catch(_0x3af43a){_0x582131[_0x824b('0x1c')](0x1f4)[_0x824b('0x2f')](_0x3af43a);}};exports[_0x824b('0x27')]=function(_0xea867f,_0x3e231e,_0x74482e){return db[_0x824b('0x31')][_0x824b('0x4c')]({'where':{'id':_0xea867f[_0x824b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e231e,null))[_0x824b('0x28')](saveUpdates(_[_0x824b('0x3f')](_0xea867f['body'],['name',_0x824b('0x80')]),null))['then'](respondWithResult(_0x3e231e,null))[_0x824b('0x49')](handleError(_0x3e231e,null));};exports[_0x824b('0x81')]=function(_0x43ff5a,_0x413743,_0x2e29f6){return db['Sound'][_0x824b('0x4c')]({'where':{'id':_0x43ff5a[_0x824b('0x4e')]['id']}})[_0x824b('0x28')](function(_0x31a788){if(_0x31a788){return _0x31a788['destroy']();}})['then'](function(_0x74781c){var _0x1f62dd=path[_0x824b('0x52')](config['root'],_0x824b('0x61'),util[_0x824b('0x58')](_0x824b('0x59'),_0x74781c[_0x824b('0x4f')],_0x74781c[_0x824b('0x82')]));var _0x5ef1f8=path[_0x824b('0x52')](config[_0x824b('0x57')],_0x824b('0x53'),util[_0x824b('0x58')](_0x824b('0x59'),_0x74781c[_0x824b('0x4f')],_0x74781c[_0x824b('0x50')]));fs['unlinkSync'](_0x1f62dd);fs[_0x824b('0x67')](_0x5ef1f8);return _0x74781c;})[_0x824b('0x28')](function(_0x257861){if(_0x257861){return _0x413743[_0x824b('0x1c')](0xcc)[_0x824b('0x1d')]();}})[_0x824b('0x28')](handleEntityNotFound(_0x413743,null))[_0x824b('0x49')](handleError(_0x413743,null));}; \ No newline at end of file +var _0x4670=['substring','wav','server/files/sounds/original','filename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','chmodSync','body','role','userProfileId','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','Sounds','UserProfileResource','stack','name','index','map','Sound','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','catch','show','params','rawAttributes','include','find','download','join','root','converted_format','Sequelize','server/files/sounds/converted','format','%s.%s','save_name','create','basename','file','originalname','extname'];(function(_0x2e6d58,_0x3d836b){var _0x2a86cf=function(_0x34f423){while(--_0x34f423){_0x2e6d58['push'](_0x2e6d58['shift']());}};_0x2a86cf(++_0x3d836b);}(_0x4670,0x9b));var _0x0467=function(_0x252e84,_0x39f4ae){_0x252e84=_0x252e84-0x0;var _0x4f3bac=_0x4670[_0x252e84];return _0x4f3bac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0467('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0467('0x1'));var moment=require(_0x0467('0x2'));var BPromise=require(_0x0467('0x3'));var Mustache=require(_0x0467('0x4'));var util=require(_0x0467('0x5'));var path=require(_0x0467('0x6'));var sox=require(_0x0467('0x7'));var csv=require(_0x0467('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0467('0x9'));var _=require('lodash');var squel=require(_0x0467('0xa'));var crypto=require(_0x0467('0xb'));var jsforce=require(_0x0467('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0467('0x8'));var querystring=require(_0x0467('0xd'));var Papa=require('papaparse');var Redis=require(_0x0467('0xe'));var authService=require(_0x0467('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0467('0x10'));var hardwareService=require(_0x0467('0x11'));var logger=require(_0x0467('0x12'))('api');var utils=require(_0x0467('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0467('0x14'))['db'];function respondWithStatusCode(_0x39934d,_0x4e3560){_0x4e3560=_0x4e3560||0xcc;return function(_0x516e04){if(_0x516e04){return _0x39934d[_0x0467('0x15')](_0x4e3560);}return _0x39934d[_0x0467('0x16')](_0x4e3560)[_0x0467('0x17')]();};}function respondWithResult(_0x3b08fa,_0x1454c9){_0x1454c9=_0x1454c9||0xc8;return function(_0x1cdef6){if(_0x1cdef6){return _0x3b08fa['status'](_0x1454c9)[_0x0467('0x18')](_0x1cdef6);}};}function respondWithFilteredResult(_0x1bed2b,_0xfdd3f6){return function(_0x68e242){if(_0x68e242){var _0x5e8c9a=typeof _0xfdd3f6[_0x0467('0x19')]===_0x0467('0x1a')&&typeof _0xfdd3f6[_0x0467('0x1b')]==='undefined';var _0x38297d=_0x68e242[_0x0467('0x1c')];var _0x1119de=_0x5e8c9a?0x0:_0xfdd3f6[_0x0467('0x19')];var _0x538ab5=_0x5e8c9a?_0x68e242['count']:_0xfdd3f6[_0x0467('0x19')]+_0xfdd3f6[_0x0467('0x1b')];var _0x4c951e;if(_0x538ab5>=_0x38297d){_0x538ab5=_0x38297d;_0x4c951e=0xc8;}else{_0x4c951e=0xce;}_0x1bed2b[_0x0467('0x16')](_0x4c951e);return _0x1bed2b['set'](_0x0467('0x1d'),_0x1119de+'-'+_0x538ab5+'/'+_0x38297d)['json'](_0x68e242);}return null;};}function patchUpdates(_0x5ac25e){return function(_0x3e8dea){try{jsonpatch[_0x0467('0x1e')](_0x3e8dea,_0x5ac25e,!![]);}catch(_0x20b41f){return BPromise[_0x0467('0x1f')](_0x20b41f);}return _0x3e8dea[_0x0467('0x20')]();};}function saveUpdates(_0x5aff9c,_0x1fb0b4){return function(_0x45cb32){if(_0x45cb32){return _0x45cb32['update'](_0x5aff9c)['then'](function(_0x1ae46f){return _0x1ae46f;});}return null;};}function removeEntity(_0x1e95a3,_0x57f813){return function(_0x4bd3e0){if(_0x4bd3e0){return _0x4bd3e0[_0x0467('0x21')]()[_0x0467('0x22')](function(){var _0x26bbf4=_0x4bd3e0['get']({'plain':!![]});var _0x2fe395=_0x0467('0x23');return db[_0x0467('0x24')][_0x0467('0x21')]({'where':{'type':_0x2fe395,'resourceId':_0x26bbf4['id']}})['then'](function(){return _0x4bd3e0;});})['then'](function(){_0x1e95a3[_0x0467('0x16')](0xcc)[_0x0467('0x17')]();});}};}function handleEntityNotFound(_0x255793,_0x3dcb6f){return function(_0x50ae69){if(!_0x50ae69){_0x255793['sendStatus'](0x194);}return _0x50ae69;};}function handleError(_0x31a741,_0x39f368){_0x39f368=_0x39f368||0x1f4;return function(_0x37701c){logger['error'](_0x37701c[_0x0467('0x25')]);if(_0x37701c[_0x0467('0x26')]){delete _0x37701c[_0x0467('0x26')];}_0x31a741['status'](_0x39f368)['send'](_0x37701c);};}exports[_0x0467('0x27')]=function(_0x3f4358,_0x265beb){var _0x3608f4={},_0x3b623e={},_0x305991={'count':0x0,'rows':[]};var _0x5532db=_[_0x0467('0x28')](db[_0x0467('0x29')]['rawAttributes'],function(_0x426f84){return{'name':_0x426f84[_0x0467('0x2a')],'type':_0x426f84[_0x0467('0x2b')][_0x0467('0x2c')]};});_0x3b623e[_0x0467('0x2d')]=_[_0x0467('0x28')](_0x5532db,_0x0467('0x26'));_0x3b623e['query']=_[_0x0467('0x2e')](_0x3f4358['query']);_0x3b623e['filters']=_['intersection'](_0x3b623e['model'],_0x3b623e[_0x0467('0x2f')]);_0x3608f4[_0x0467('0x30')]=_[_0x0467('0x31')](_0x3b623e['model'],qs[_0x0467('0x32')](_0x3f4358[_0x0467('0x2f')][_0x0467('0x32')]));_0x3608f4[_0x0467('0x30')]=_0x3608f4['attributes'][_0x0467('0x33')]?_0x3608f4[_0x0467('0x30')]:_0x3b623e[_0x0467('0x2d')];if(!_0x3f4358[_0x0467('0x2f')][_0x0467('0x34')](_0x0467('0x35'))){_0x3608f4[_0x0467('0x1b')]=qs[_0x0467('0x1b')](_0x3f4358[_0x0467('0x2f')][_0x0467('0x1b')]);_0x3608f4[_0x0467('0x19')]=qs[_0x0467('0x19')](_0x3f4358[_0x0467('0x2f')][_0x0467('0x19')]);}_0x3608f4[_0x0467('0x36')]=qs['sort'](_0x3f4358[_0x0467('0x2f')][_0x0467('0x37')]);_0x3608f4['where']=qs['filters'](_[_0x0467('0x38')](_0x3f4358['query'],_0x3b623e[_0x0467('0x39')]),_0x5532db);if(_0x3f4358[_0x0467('0x2f')][_0x0467('0x3a')]){_0x3608f4[_0x0467('0x3b')]=_[_0x0467('0x3c')](_0x3608f4['where'],{'$or':_[_0x0467('0x28')](_0x5532db,function(_0x54c560){if(_0x54c560[_0x0467('0x2b')]!=='VIRTUAL'){var _0x13c252={};_0x13c252[_0x54c560[_0x0467('0x26')]]={'$like':'%'+_0x3f4358[_0x0467('0x2f')]['filter']+'%'};return _0x13c252;}})});}_0x3608f4=_[_0x0467('0x3c')]({},_0x3608f4,_0x3f4358[_0x0467('0x3d')]);var _0x5c430e={'where':_0x3608f4[_0x0467('0x3b')]};return db[_0x0467('0x29')]['count'](_0x5c430e)['then'](function(_0x2827df){_0x305991[_0x0467('0x1c')]=_0x2827df;if(_0x3f4358['query'][_0x0467('0x3e')]){_0x3608f4['include']=[{'all':!![]}];}return db[_0x0467('0x29')]['findAll'](_0x3608f4);})[_0x0467('0x22')](function(_0x50781e){_0x305991['rows']=_0x50781e;return _0x305991;})[_0x0467('0x22')](respondWithFilteredResult(_0x265beb,_0x3608f4))[_0x0467('0x3f')](handleError(_0x265beb,null));};exports[_0x0467('0x40')]=function(_0x374877,_0x3cc428){var _0x2056fa={'raw':!![],'where':{'id':_0x374877[_0x0467('0x41')]['id']}},_0x15370e={};_0x15370e[_0x0467('0x2d')]=_['keys'](db[_0x0467('0x29')][_0x0467('0x42')]);_0x15370e[_0x0467('0x2f')]=_['keys'](_0x374877[_0x0467('0x2f')]);_0x15370e[_0x0467('0x39')]=_[_0x0467('0x31')](_0x15370e[_0x0467('0x2d')],_0x15370e[_0x0467('0x2f')]);_0x2056fa[_0x0467('0x30')]=_[_0x0467('0x31')](_0x15370e[_0x0467('0x2d')],qs[_0x0467('0x32')](_0x374877['query']['fields']));_0x2056fa[_0x0467('0x30')]=_0x2056fa['attributes'][_0x0467('0x33')]?_0x2056fa[_0x0467('0x30')]:_0x15370e[_0x0467('0x2d')];if(_0x374877['query'][_0x0467('0x3e')]){_0x2056fa[_0x0467('0x43')]=[{'all':!![]}];}_0x2056fa=_[_0x0467('0x3c')]({},_0x2056fa,_0x374877[_0x0467('0x3d')]);return db[_0x0467('0x29')][_0x0467('0x44')](_0x2056fa)['then'](handleEntityNotFound(_0x3cc428,null))[_0x0467('0x22')](respondWithResult(_0x3cc428,null))['catch'](handleError(_0x3cc428,null));};exports[_0x0467('0x45')]=function(_0x3a5643,_0x182a47,_0x57291e){return db[_0x0467('0x29')][_0x0467('0x44')]({'where':{'id':_0x3a5643[_0x0467('0x41')]['id']},'attributes':[_0x0467('0x26'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x182a47,null))[_0x0467('0x22')](function(_0x2e6c33){if(_0x2e6c33){if(!fs['existsSync'](path[_0x0467('0x46')](config[_0x0467('0x47')],'server/files/sounds/converted',_0x2e6c33['save_name']+'.'+_0x2e6c33[_0x0467('0x48')]))){throw new db[(_0x0467('0x49'))]['ValidationError']('Sound\x20not\x20found');}return _0x182a47[_0x0467('0x45')](path['join'](config[_0x0467('0x47')],_0x0467('0x4a'),util[_0x0467('0x4b')](_0x0467('0x4c'),_0x2e6c33[_0x0467('0x4d')],_0x2e6c33[_0x0467('0x48')])),util[_0x0467('0x4b')](_0x0467('0x4c'),_0x2e6c33['name'],_0x2e6c33[_0x0467('0x48')]));}return null;})['catch'](handleError(_0x182a47,null));};exports[_0x0467('0x4e')]=function(_0x5c23bf,_0x3934c0,_0x757fea){var _0x43b748={'name':path[_0x0467('0x4f')](_0x5c23bf[_0x0467('0x50')][_0x0467('0x51')],path[_0x0467('0x52')](_0x5c23bf['file'][_0x0467('0x51')])),'save_name':path[_0x0467('0x4f')](_0x5c23bf[_0x0467('0x50')]['filename'],path[_0x0467('0x52')](_0x5c23bf[_0x0467('0x50')]['filename'])),'original_format':path['extname'](_0x5c23bf[_0x0467('0x50')][_0x0467('0x51')])[_0x0467('0x53')](0x1),'converted_format':_0x0467('0x54')};var _0x131c27=path[_0x0467('0x46')](config[_0x0467('0x47')],_0x0467('0x55'),_0x5c23bf['file'][_0x0467('0x56')]);var _0x27f7c4=path['join'](config['root'],_0x0467('0x4a'),util[_0x0467('0x4b')](_0x0467('0x4c'),path[_0x0467('0x4f')](_0x5c23bf[_0x0467('0x50')][_0x0467('0x56')],path[_0x0467('0x52')](_0x5c23bf['file'][_0x0467('0x56')])),_0x43b748[_0x0467('0x48')]));logger['info'](_0x0467('0x57'),_0x131c27);logger[_0x0467('0x58')](_0x0467('0x59'),_0x27f7c4);try{fs['chmodSync'](_0x131c27,parseInt(_0x0467('0x5a'),0x8));var _0x2e3cd8=sox[_0x0467('0x5b')](_0x131c27,_0x27f7c4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e3cd8['on']('error',function(_0x24d772){fs[_0x0467('0x5c')](_0x131c27);_0x3934c0[_0x0467('0x16')](0x1f4)[_0x0467('0x5d')](_0x24d772);});_0x2e3cd8['on']('src',function(_0x2dca96){_0x43b748['original_duration']=isNaN(_0x2dca96[_0x0467('0x5e')])?null:_0x2dca96[_0x0467('0x5e')]*0x3e8;_0x43b748[_0x0467('0x5f')]=isNaN(_0x2dca96[_0x0467('0x60')])?null:_0x2dca96[_0x0467('0x60')];_0x43b748['original_channelCount']=isNaN(_0x2dca96[_0x0467('0x61')])?null:_0x2dca96[_0x0467('0x61')];_0x43b748['original_bitRate']=isNaN(_0x2dca96[_0x0467('0x62')])?null:_0x2dca96[_0x0467('0x62')];_0x43b748[_0x0467('0x63')]=isNaN(_0x2dca96[_0x0467('0x64')])?null:_0x2dca96[_0x0467('0x64')];});_0x2e3cd8['on'](_0x0467('0x65'),function(_0x5807d9){_0x43b748[_0x0467('0x66')]=isNaN(_0x5807d9[_0x0467('0x5e')])?null:_0x5807d9[_0x0467('0x5e')]*0x3e8;_0x43b748['converted_sampleCount']=isNaN(_0x5807d9[_0x0467('0x60')])?null:_0x5807d9[_0x0467('0x60')];_0x43b748[_0x0467('0x67')]=isNaN(_0x5807d9[_0x0467('0x61')])?null:_0x5807d9[_0x0467('0x61')];_0x43b748['converted_bitRate']=isNaN(_0x5807d9[_0x0467('0x62')])?null:_0x5807d9[_0x0467('0x62')];_0x43b748['converted_sampleRate']=isNaN(_0x5807d9['sampleRate'])?null:_0x5807d9['sampleRate'];});_0x2e3cd8['on'](_0x0467('0x17'),function(){fs[_0x0467('0x68')](_0x27f7c4,parseInt(_0x0467('0x5a'),0x8));return db['Sound']['create'](_0x43b748)[_0x0467('0x22')](function(_0x1b1086){var _0x3c129e={'role':_0x5c23bf[_0x0467('0x69')][_0x0467('0x6a')],'userProfileId':_0x5c23bf['body'][_0x0467('0x6b')]};if(!_0x3c129e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c129e[_0x0467('0x6a')]===_0x0467('0x6c')){var _0xcf6f00=_0x1b1086[_0x0467('0x6d')]({'plain':!![]});return db[_0x0467('0x6e')][_0x0467('0x44')]({'where':{'name':_0x0467('0x23'),'userProfileId':_0x3c129e[_0x0467('0x6b')]},'raw':!![]})[_0x0467('0x22')](function(_0x8ce8f0){if(_0x8ce8f0&&_0x8ce8f0[_0x0467('0x6f')]===0x0){return db[_0x0467('0x24')][_0x0467('0x4e')]({'name':_0xcf6f00[_0x0467('0x26')],'resourceId':_0xcf6f00['id'],'type':_0x8ce8f0['name'],'sectionId':_0x8ce8f0['id']},{})[_0x0467('0x22')](function(){return _0x1b1086;});}else{return _0x1b1086;}})['catch'](function(_0x49148c){logger[_0x0467('0x70')](_0x0467('0x71'),_0x49148c);throw _0x49148c;});}return _0x1b1086;})[_0x0467('0x22')](respondWithResult(_0x3934c0,null))[_0x0467('0x3f')](handleError(_0x3934c0,null));});_0x2e3cd8[_0x0467('0x72')]();}catch(_0x486649){_0x3934c0[_0x0467('0x16')](0x1f4)['send'](_0x486649);}};exports[_0x0467('0x73')]=function(_0x512373,_0x18e217,_0x473032){return db[_0x0467('0x29')][_0x0467('0x44')]({'where':{'id':_0x512373[_0x0467('0x41')]['id']}})[_0x0467('0x22')](handleEntityNotFound(_0x18e217,null))[_0x0467('0x22')](saveUpdates(_[_0x0467('0x38')](_0x512373[_0x0467('0x69')],[_0x0467('0x26'),_0x0467('0x74')]),null))[_0x0467('0x22')](respondWithResult(_0x18e217,null))[_0x0467('0x3f')](handleError(_0x18e217,null));};exports[_0x0467('0x75')]=function(_0x1315a6,_0x474eb0,_0x1800a4){return db['Sound'][_0x0467('0x44')]({'where':{'id':_0x1315a6[_0x0467('0x41')]['id']}})[_0x0467('0x22')](function(_0x175362){if(_0x175362){return _0x175362[_0x0467('0x21')]();}})['then'](function(_0x42cba4){var _0x3bf394=path[_0x0467('0x46')](config[_0x0467('0x47')],_0x0467('0x55'),util[_0x0467('0x4b')](_0x0467('0x4c'),_0x42cba4['save_name'],_0x42cba4[_0x0467('0x76')]));var _0xa9d97f=path['join'](config[_0x0467('0x47')],'server/files/sounds/converted',util[_0x0467('0x4b')](_0x0467('0x4c'),_0x42cba4['save_name'],_0x42cba4[_0x0467('0x48')]));fs['unlinkSync'](_0x3bf394);fs[_0x0467('0x5c')](_0xa9d97f);return _0x42cba4;})[_0x0467('0x22')](function(_0x354a7d){if(_0x354a7d){return _0x474eb0[_0x0467('0x16')](0xcc)[_0x0467('0x17')]();}})[_0x0467('0x22')](handleEntityNotFound(_0x474eb0,null))[_0x0467('0x3f')](handleError(_0x474eb0,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5b9e7f6..43ebb41 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 _0x8920=['request-promise','path','../../config/environment','./sound.attributes','Sound','tools_sounds','../../config/logger','api','moment'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x8920,0xc3));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0892('0x0'))(_0x0892('0x1'));var moment=require(_0x0892('0x2'));var BPromise=require('bluebird');var rp=require(_0x0892('0x3'));var fs=require('fs');var path=require(_0x0892('0x4'));var rimraf=require('rimraf');var config=require(_0x0892('0x5'));var attributes=require(_0x0892('0x6'));module['exports']=function(_0x2268d8,_0x404bef){return _0x2268d8['define'](_0x0892('0x7'),attributes,{'tableName':_0x0892('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x555f=['rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','../../config/logger','bluebird','request-promise','path'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x555f,0x1b3));var _0xf555=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x555f[_0x3358ba];return _0x296e73;};'use strict';var _=require('lodash');var util=require(_0xf555('0x0'));var logger=require(_0xf555('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf555('0x2'));var rp=require(_0xf555('0x3'));var fs=require('fs');var path=require(_0xf555('0x4'));var rimraf=require(_0xf555('0x5'));var config=require(_0xf555('0x6'));var attributes=require(_0xf555('0x7'));module[_0xf555('0x8')]=function(_0x3fb922,_0x596a0e){return _0x3fb922[_0xf555('0x9')]('Sound',attributes,{'tableName':_0xf555('0xa'),'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 6d40199..b52a9e8 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 _0x6964=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ShowSound','find','options','where','attributes','include','model','map','info','catch','util'];(function(_0x439fa6,_0x573272){var _0x3d0b75=function(_0x2f38b6){while(--_0x2f38b6){_0x439fa6['push'](_0x439fa6['shift']());}};_0x3d0b75(++_0x573272);}(_0x6964,0xd1));var _0x4696=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x6964[_0x3b2244];return _0x2dcc14;};'use strict';var _=require('lodash');var util=require(_0x4696('0x0'));var moment=require(_0x4696('0x1'));var BPromise=require(_0x4696('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4696('0x3'));var db=require(_0x4696('0x4'))['db'];var utils=require(_0x4696('0x5'));var logger=require(_0x4696('0x6'))(_0x4696('0x7'));var config=require(_0x4696('0x8'));var jayson=require(_0x4696('0x9'));var client=jayson['client'][_0x4696('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4cd6,_0x2bfcd1,_0xcd92d1){return new BPromise(function(_0xf1033d,_0xa1a037){return client[_0x4696('0xb')](_0x4b4cd6,_0xcd92d1)[_0x4696('0xc')](function(_0x318c8f){logger['info'](_0x4696('0xd'),_0x2bfcd1,_0x4696('0xe'));logger[_0x4696('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x2bfcd1,_0x4696('0xe'),JSON[_0x4696('0x10')](_0x318c8f));if(_0x318c8f[_0x4696('0x11')]){if(_0x318c8f[_0x4696('0x11')]['code']===0x1f4){logger[_0x4696('0x11')]('Sound,\x20%s,\x20%s',_0x2bfcd1,_0x318c8f[_0x4696('0x11')]['message']);return _0xa1a037(_0x318c8f[_0x4696('0x11')][_0x4696('0x12')]);}logger[_0x4696('0x11')](_0x4696('0xd'),_0x2bfcd1,_0x318c8f[_0x4696('0x11')][_0x4696('0x12')]);return _0xf1033d(_0x318c8f[_0x4696('0x11')][_0x4696('0x12')]);}else{logger['info'](_0x4696('0xd'),_0x2bfcd1,_0x4696('0xe'));_0xf1033d(_0x318c8f[_0x4696('0x13')]['message']);}})['catch'](function(_0x7ed5b3){logger[_0x4696('0x11')](_0x4696('0xd'),_0x2bfcd1,_0x7ed5b3);_0xa1a037(_0x7ed5b3);});});}exports[_0x4696('0x14')]=function(_0x570182){var _0x7cf498=this;return new Promise(function(_0x4c22ae,_0x3f561c){return db['Sound'][_0x4696('0x15')]({'raw':_0x570182[_0x4696('0x16')]?_0x570182['options']['raw']===undefined?!![]:![]:!![],'where':_0x570182['options']?_0x570182[_0x4696('0x16')][_0x4696('0x17')]||null:null,'attributes':_0x570182[_0x4696('0x16')]?_0x570182[_0x4696('0x16')][_0x4696('0x18')]||null:null,'include':_0x570182[_0x4696('0x16')]?_0x570182[_0x4696('0x16')][_0x4696('0x19')]?_['map'](_0x570182['options'][_0x4696('0x19')],function(_0xd976ce){return{'model':db[_0xd976ce['model']],'as':_0xd976ce['as'],'attributes':_0xd976ce[_0x4696('0x18')],'include':_0xd976ce[_0x4696('0x19')]?_['map'](_0xd976ce[_0x4696('0x19')],function(_0x1c54ab){return{'model':db[_0x1c54ab[_0x4696('0x1a')]],'as':_0x1c54ab['as'],'attributes':_0x1c54ab[_0x4696('0x18')],'include':_0x1c54ab['include']?_[_0x4696('0x1b')](_0x1c54ab[_0x4696('0x19')],function(_0x464c45){return{'model':db[_0x464c45[_0x4696('0x1a')]],'as':_0x464c45['as'],'attributes':_0x464c45['attributes']};}):[]};}):[]};}):[]:[]})[_0x4696('0xc')](function(_0x3e2f83){logger[_0x4696('0x1c')](_0x4696('0x14'),_0x570182);logger[_0x4696('0xf')](_0x4696('0x14'),_0x570182,JSON[_0x4696('0x10')](_0x3e2f83));_0x4c22ae(_0x3e2f83);})[_0x4696('0x1d')](function(_0x36aff5){logger[_0x4696('0x11')](_0x4696('0x14'),_0x36aff5[_0x4696('0x12')],_0x570182);_0x3f561c(_0x7cf498[_0x4696('0x11')](0x1f4,_0x36aff5[_0x4696('0x12')]));});});}; \ No newline at end of file +var _0xc584=['http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3da65b,_0x4bd820){var _0x5aa477=function(_0x4576c6){while(--_0x4576c6){_0x3da65b['push'](_0x3da65b['shift']());}};_0x5aa477(++_0x4bd820);}(_0xc584,0x7a));var _0x4c58=function(_0x5c16e1,_0x12ea72){_0x5c16e1=_0x5c16e1-0x0;var _0x4f59d0=_0xc584[_0x5c16e1];return _0x4f59d0;};'use strict';var _=require(_0x4c58('0x0'));var util=require(_0x4c58('0x1'));var moment=require(_0x4c58('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c58('0x4'))['db'];var utils=require(_0x4c58('0x5'));var logger=require(_0x4c58('0x6'))(_0x4c58('0x7'));var config=require(_0x4c58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4c58('0x9')][_0x4c58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47dae1,_0x3dd2b5,_0x11cd36){return new BPromise(function(_0x1cbbf4,_0x100103){return client[_0x4c58('0xb')](_0x47dae1,_0x11cd36)[_0x4c58('0xc')](function(_0x4ef590){logger['info'](_0x4c58('0xd'),_0x3dd2b5,_0x4c58('0xe'));logger[_0x4c58('0xf')](_0x4c58('0x10'),_0x3dd2b5,_0x4c58('0xe'),JSON[_0x4c58('0x11')](_0x4ef590));if(_0x4ef590[_0x4c58('0x12')]){if(_0x4ef590[_0x4c58('0x12')]['code']===0x1f4){logger[_0x4c58('0x12')](_0x4c58('0xd'),_0x3dd2b5,_0x4ef590[_0x4c58('0x12')][_0x4c58('0x13')]);return _0x100103(_0x4ef590['error']['message']);}logger[_0x4c58('0x12')]('Sound,\x20%s,\x20%s',_0x3dd2b5,_0x4ef590[_0x4c58('0x12')][_0x4c58('0x13')]);return _0x1cbbf4(_0x4ef590[_0x4c58('0x12')]['message']);}else{logger[_0x4c58('0x14')](_0x4c58('0xd'),_0x3dd2b5,_0x4c58('0xe'));_0x1cbbf4(_0x4ef590[_0x4c58('0x15')][_0x4c58('0x13')]);}})[_0x4c58('0x16')](function(_0x17dad5){logger[_0x4c58('0x12')](_0x4c58('0xd'),_0x3dd2b5,_0x17dad5);_0x100103(_0x17dad5);});});}exports[_0x4c58('0x17')]=function(_0x21c8f1){var _0x407728=this;return new Promise(function(_0x3e03e9,_0x872a63){return db[_0x4c58('0x18')][_0x4c58('0x19')]({'raw':_0x21c8f1[_0x4c58('0x1a')]?_0x21c8f1[_0x4c58('0x1a')][_0x4c58('0x1b')]===undefined?!![]:![]:!![],'where':_0x21c8f1[_0x4c58('0x1a')]?_0x21c8f1[_0x4c58('0x1a')][_0x4c58('0x1c')]||null:null,'attributes':_0x21c8f1[_0x4c58('0x1a')]?_0x21c8f1[_0x4c58('0x1a')][_0x4c58('0x1d')]||null:null,'include':_0x21c8f1[_0x4c58('0x1a')]?_0x21c8f1[_0x4c58('0x1a')][_0x4c58('0x1e')]?_[_0x4c58('0x1f')](_0x21c8f1[_0x4c58('0x1a')][_0x4c58('0x1e')],function(_0x146670){return{'model':db[_0x146670[_0x4c58('0x20')]],'as':_0x146670['as'],'attributes':_0x146670[_0x4c58('0x1d')],'include':_0x146670[_0x4c58('0x1e')]?_[_0x4c58('0x1f')](_0x146670[_0x4c58('0x1e')],function(_0xeeb567){return{'model':db[_0xeeb567['model']],'as':_0xeeb567['as'],'attributes':_0xeeb567[_0x4c58('0x1d')],'include':_0xeeb567['include']?_[_0x4c58('0x1f')](_0xeeb567[_0x4c58('0x1e')],function(_0x571eb6){return{'model':db[_0x571eb6[_0x4c58('0x20')]],'as':_0x571eb6['as'],'attributes':_0x571eb6[_0x4c58('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c58('0xc')](function(_0x5c2d78){logger[_0x4c58('0x14')]('ShowSound',_0x21c8f1);logger['debug'](_0x4c58('0x17'),_0x21c8f1,JSON[_0x4c58('0x11')](_0x5c2d78));_0x3e03e9(_0x5c2d78);})['catch'](function(_0x3a81aa){logger[_0x4c58('0x12')]('ShowSound',_0x3a81aa[_0x4c58('0x13')],_0x21c8f1);_0x872a63(_0x407728[_0x4c58('0x12')](0x1f4,_0x3a81aa[_0x4c58('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 33c0c1c..603b2d7 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(_0x6595a7,_0x1be709){var _0x22bb82=function(_0x1219e0){while(--_0x1219e0){_0x6595a7['push'](_0x6595a7['shift']());}};_0x22bb82(++_0x1be709);}(_0x2032,0xd9));var _0x2203=function(_0x54e7fd,_0x3ab212){_0x54e7fd=_0x54e7fd-0x0;var _0x2b587a=_0x2032[_0x54e7fd];return _0x2b587a;};'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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x227226,_0x32f398){var _0x3e4a41=function(_0x262d33){while(--_0x262d33){_0x227226['push'](_0x227226['shift']());}};_0x3e4a41(++_0x32f398);}(_0xb10b,0x12a));var _0xbb10=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0xb10b[_0x223bdb];return _0xef8e68;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 21cb847..c903439 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 _0xf3c5=['TEXT','ENUM','out','sequelize','STRING'];(function(_0x1f3591,_0x1270e9){var _0x3ffcd8=function(_0x1898ac){while(--_0x1898ac){_0x1f3591['push'](_0x1f3591['shift']());}};_0x3ffcd8(++_0x1270e9);}(_0xf3c5,0x10c));var _0x5f3c=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0xf3c5[_0x503a0c];return _0x3b2e83;};'use strict';var Sequelize=require(_0x5f3c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5f3c('0x1')]},'body':{'type':Sequelize[_0x5f3c('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x5f3c('0x3')]('in',_0x5f3c('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x5f3c('0x1')]},'providerResponse':{'type':Sequelize[_0x5f3c('0x2')]}}; \ No newline at end of file +var _0x0df2=['sequelize','exports','TEXT','medium','ENUM','STRING'];(function(_0x328690,_0x4f27b8){var _0x5bfb02=function(_0x112878){while(--_0x112878){_0x328690['push'](_0x328690['shift']());}};_0x5bfb02(++_0x4f27b8);}(_0x0df2,0xc0));var _0x20df=function(_0x4e3c02,_0x734e35){_0x4e3c02=_0x4e3c02-0x0;var _0x5a1912=_0x0df2[_0x4e3c02];return _0x5a1912;};'use strict';var Sequelize=require(_0x20df('0x0'));module[_0x20df('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x20df('0x2')](_0x20df('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x20df('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x20df('0x5')]},'providerResponse':{'type':Sequelize[_0x20df('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index df3de05..675a725 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 _0x056b=['send','SquareMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x056b,0xb6));var _0xb056=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x056b[_0x12a2a6];return _0x1754ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a14f,_0x10b9b3){return function(_0x5c39db){if(!_0x5c39db){_0x44a14f[_0xb056('0x1b')](0x194);}return _0x5c39db;};}function handleError(_0x265782,_0x2ae873){_0x2ae873=_0x2ae873||0x1f4;return function(_0x1d2c66){logger[_0xb056('0x28')](_0x1d2c66[_0xb056('0x29')]);if(_0x1d2c66[_0xb056('0x2a')]){delete _0x1d2c66[_0xb056('0x2a')];}_0x265782['status'](_0x2ae873)[_0xb056('0x2b')](_0x1d2c66);};}exports['index']=function(_0x3d83d3,_0x9c6f4a){var _0x294874={},_0x488185={},_0xd53267={'count':0x0,'rows':[]};var _0x264569=_['map'](db[_0xb056('0x2c')][_0xb056('0x2d')],function(_0x329eaa){return{'name':_0x329eaa[_0xb056('0x2e')],'type':_0x329eaa[_0xb056('0x2f')]['key']};});_0x488185[_0xb056('0x30')]=_[_0xb056('0x31')](_0x264569,_0xb056('0x2a'));_0x488185[_0xb056('0x32')]=_[_0xb056('0x33')](_0x3d83d3['query']);_0x488185[_0xb056('0x34')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],_0x488185[_0xb056('0x32')]);_0x294874[_0xb056('0x36')]=_[_0xb056('0x35')](_0x488185[_0xb056('0x30')],qs[_0xb056('0x37')](_0x3d83d3['query'][_0xb056('0x37')]));_0x294874['attributes']=_0x294874[_0xb056('0x36')]['length']?_0x294874['attributes']:_0x488185[_0xb056('0x30')];if(!_0x3d83d3[_0xb056('0x32')][_0xb056('0x38')](_0xb056('0x39'))){_0x294874[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x3d83d3[_0xb056('0x32')]['limit']);_0x294874[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x3d83d3['query']['offset']);}_0x294874[_0xb056('0x3a')]=qs[_0xb056('0x3b')](_0x3d83d3[_0xb056('0x32')]['sort']);_0x294874[_0xb056('0x3c')]=qs[_0xb056('0x34')](_[_0xb056('0x3d')](_0x3d83d3[_0xb056('0x32')],_0x488185[_0xb056('0x34')]),_0x264569);if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]){_0x294874[_0xb056('0x3c')]=_[_0xb056('0x3f')](_0x294874[_0xb056('0x3c')],{'$or':_[_0xb056('0x31')](_0x264569,function(_0x1afc7f){if(_0x1afc7f['type']!==_0xb056('0x40')){var _0x4acc94={};_0x4acc94[_0x1afc7f[_0xb056('0x2a')]]={'$like':'%'+_0x3d83d3[_0xb056('0x32')][_0xb056('0x3e')]+'%'};return _0x4acc94;}})});}_0x294874=_[_0xb056('0x3f')]({},_0x294874,_0x3d83d3[_0xb056('0x41')]);var _0x661784={'where':_0x294874[_0xb056('0x3c')]};return db[_0xb056('0x2c')]['count'](_0x661784)[_0xb056('0x26')](function(_0x21a34b){_0xd53267[_0xb056('0x21')]=_0x21a34b;if(_0x3d83d3[_0xb056('0x32')][_0xb056('0x42')]){_0x294874['include']=[{'all':!![]}];}return db[_0xb056('0x2c')][_0xb056('0x43')](_0x294874);})[_0xb056('0x26')](function(_0x216f72){_0xd53267[_0xb056('0x44')]=_0x216f72;return _0xd53267;})[_0xb056('0x26')](respondWithFilteredResult(_0x9c6f4a,_0x294874))['catch'](handleError(_0x9c6f4a,null));};exports[_0xb056('0x45')]=function(_0x5040f6,_0x3bcc3d){var _0xc729f3={'raw':!![],'where':{'id':_0x5040f6[_0xb056('0x46')]['id']}},_0x21d98e={};_0x21d98e[_0xb056('0x30')]=_[_0xb056('0x33')](db[_0xb056('0x2c')][_0xb056('0x2d')]);_0x21d98e[_0xb056('0x32')]=_[_0xb056('0x33')](_0x5040f6['query']);_0x21d98e[_0xb056('0x34')]=_[_0xb056('0x35')](_0x21d98e[_0xb056('0x30')],_0x21d98e['query']);_0xc729f3[_0xb056('0x36')]=_[_0xb056('0x35')](_0x21d98e['model'],qs['fields'](_0x5040f6[_0xb056('0x32')][_0xb056('0x37')]));_0xc729f3[_0xb056('0x36')]=_0xc729f3[_0xb056('0x36')]['length']?_0xc729f3['attributes']:_0x21d98e['model'];if(_0x5040f6['query']['includeAll']){_0xc729f3['include']=[{'all':!![]}];}_0xc729f3=_[_0xb056('0x3f')]({},_0xc729f3,_0x5040f6['options']);return db[_0xb056('0x2c')][_0xb056('0x47')](_0xc729f3)[_0xb056('0x26')](handleEntityNotFound(_0x3bcc3d,null))[_0xb056('0x26')](respondWithResult(_0x3bcc3d,null))[_0xb056('0x48')](handleError(_0x3bcc3d,null));};exports[_0xb056('0x49')]=function(_0x45b4aa,_0x1d3f86){return db['SquareMessage'][_0xb056('0x49')](_0x45b4aa[_0xb056('0x4a')],{})['then'](respondWithResult(_0x1d3f86,0xc9))[_0xb056('0x48')](handleError(_0x1d3f86,null));};exports[_0xb056('0x25')]=function(_0xe40439,_0x2f2d22){if(_0xe40439[_0xb056('0x4a')]['id']){delete _0xe40439[_0xb056('0x4a')]['id'];}return db['SquareMessage'][_0xb056('0x47')]({'where':{'id':_0xe40439['params']['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x2f2d22,null))[_0xb056('0x26')](saveUpdates(_0xe40439[_0xb056('0x4a')],null))[_0xb056('0x26')](respondWithResult(_0x2f2d22,null))[_0xb056('0x48')](handleError(_0x2f2d22,null));};exports[_0xb056('0x27')]=function(_0x2b6733,_0x25bb16){return db['SquareMessage'][_0xb056('0x47')]({'where':{'id':_0x2b6733[_0xb056('0x46')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x25bb16,null))[_0xb056('0x26')](removeEntity(_0x25bb16,null))[_0xb056('0x48')](handleError(_0x25bb16,null));}; \ No newline at end of file +var _0xc6a2=['send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','type','filter','options','SquareMessage','includeAll','include','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','update','destroy','then','end','error','stack','name'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xc6a2,0x69));var _0x2c6a=function(_0x59ffa0,_0x1e52d8){_0x59ffa0=_0x59ffa0-0x0;var _0x5c5240=_0xc6a2[_0x59ffa0];return _0x5c5240;};'use strict';var emlformat=require(_0x2c6a('0x0'));var rimraf=require(_0x2c6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c6a('0x2'));var rp=require(_0x2c6a('0x3'));var moment=require(_0x2c6a('0x4'));var BPromise=require(_0x2c6a('0x5'));var Mustache=require(_0x2c6a('0x6'));var util=require(_0x2c6a('0x7'));var path=require(_0x2c6a('0x8'));var sox=require(_0x2c6a('0x9'));var csv=require(_0x2c6a('0xa'));var ejs=require(_0x2c6a('0xb'));var fs=require('fs');var fs_extra=require(_0x2c6a('0xc'));var _=require(_0x2c6a('0xd'));var squel=require(_0x2c6a('0xe'));var crypto=require(_0x2c6a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2c6a('0x10'));var toCsv=require(_0x2c6a('0xa'));var querystring=require(_0x2c6a('0x11'));var Papa=require(_0x2c6a('0x12'));var Redis=require(_0x2c6a('0x13'));var authService=require(_0x2c6a('0x14'));var qs=require(_0x2c6a('0x15'));var as=require(_0x2c6a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c6a('0x17'));var utils=require(_0x2c6a('0x18'));var config=require(_0x2c6a('0x19'));var licenseUtil=require(_0x2c6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a0ac5,_0x307d86){_0x307d86=_0x307d86||0xcc;return function(_0x2ec32a){if(_0x2ec32a){return _0x5a0ac5[_0x2c6a('0x1b')](_0x307d86);}return _0x5a0ac5['status'](_0x307d86)['end']();};}function respondWithResult(_0x5cb8d3,_0x1452ee){_0x1452ee=_0x1452ee||0xc8;return function(_0x4119c9){if(_0x4119c9){return _0x5cb8d3[_0x2c6a('0x1c')](_0x1452ee)[_0x2c6a('0x1d')](_0x4119c9);}};}function respondWithFilteredResult(_0x95767c,_0x3bf95b){return function(_0x2e684e){if(_0x2e684e){var _0x22206c=typeof _0x3bf95b[_0x2c6a('0x1e')]==='undefined'&&typeof _0x3bf95b[_0x2c6a('0x1f')]===_0x2c6a('0x20');var _0x56467e=_0x2e684e[_0x2c6a('0x21')];var _0x4b9dcb=_0x22206c?0x0:_0x3bf95b['offset'];var _0x3a799c=_0x22206c?_0x2e684e[_0x2c6a('0x21')]:_0x3bf95b[_0x2c6a('0x1e')]+_0x3bf95b[_0x2c6a('0x1f')];var _0x1b49d8;if(_0x3a799c>=_0x56467e){_0x3a799c=_0x56467e;_0x1b49d8=0xc8;}else{_0x1b49d8=0xce;}_0x95767c[_0x2c6a('0x1c')](_0x1b49d8);return _0x95767c[_0x2c6a('0x22')]('Content-Range',_0x4b9dcb+'-'+_0x3a799c+'/'+_0x56467e)[_0x2c6a('0x1d')](_0x2e684e);}return null;};}function patchUpdates(_0x4003ed){return function(_0x1b0666){try{jsonpatch[_0x2c6a('0x23')](_0x1b0666,_0x4003ed,!![]);}catch(_0x10edaa){return BPromise['reject'](_0x10edaa);}return _0x1b0666['save']();};}function saveUpdates(_0x3652ac,_0x33528a){return function(_0x9de775){if(_0x9de775){return _0x9de775[_0x2c6a('0x24')](_0x3652ac)['then'](function(_0x4c6d13){return _0x4c6d13;});}return null;};}function removeEntity(_0x542d24,_0x395558){return function(_0x38ceb8){if(_0x38ceb8){return _0x38ceb8[_0x2c6a('0x25')]()[_0x2c6a('0x26')](function(){_0x542d24[_0x2c6a('0x1c')](0xcc)[_0x2c6a('0x27')]();});}};}function handleEntityNotFound(_0x354be4,_0x54981d){return function(_0xaa05c9){if(!_0xaa05c9){_0x354be4['sendStatus'](0x194);}return _0xaa05c9;};}function handleError(_0x37c1f4,_0x4e6599){_0x4e6599=_0x4e6599||0x1f4;return function(_0x1dbdb2){logger[_0x2c6a('0x28')](_0x1dbdb2[_0x2c6a('0x29')]);if(_0x1dbdb2[_0x2c6a('0x2a')]){delete _0x1dbdb2[_0x2c6a('0x2a')];}_0x37c1f4['status'](_0x4e6599)[_0x2c6a('0x2b')](_0x1dbdb2);};}exports[_0x2c6a('0x2c')]=function(_0xcdecbb,_0x3f7ea5){var _0x48e898={},_0x1d77a3={},_0x239516={'count':0x0,'rows':[]};var _0x2fa33f=_[_0x2c6a('0x2d')](db['SquareMessage'][_0x2c6a('0x2e')],function(_0x4baecf){return{'name':_0x4baecf['fieldName'],'type':_0x4baecf['type'][_0x2c6a('0x2f')]};});_0x1d77a3[_0x2c6a('0x30')]=_[_0x2c6a('0x2d')](_0x2fa33f,_0x2c6a('0x2a'));_0x1d77a3[_0x2c6a('0x31')]=_[_0x2c6a('0x32')](_0xcdecbb['query']);_0x1d77a3[_0x2c6a('0x33')]=_[_0x2c6a('0x34')](_0x1d77a3[_0x2c6a('0x30')],_0x1d77a3['query']);_0x48e898[_0x2c6a('0x35')]=_[_0x2c6a('0x34')](_0x1d77a3[_0x2c6a('0x30')],qs[_0x2c6a('0x36')](_0xcdecbb[_0x2c6a('0x31')][_0x2c6a('0x36')]));_0x48e898[_0x2c6a('0x35')]=_0x48e898[_0x2c6a('0x35')]['length']?_0x48e898[_0x2c6a('0x35')]:_0x1d77a3[_0x2c6a('0x30')];if(!_0xcdecbb[_0x2c6a('0x31')]['hasOwnProperty']('nolimit')){_0x48e898[_0x2c6a('0x1f')]=qs['limit'](_0xcdecbb[_0x2c6a('0x31')]['limit']);_0x48e898[_0x2c6a('0x1e')]=qs[_0x2c6a('0x1e')](_0xcdecbb[_0x2c6a('0x31')]['offset']);}_0x48e898[_0x2c6a('0x37')]=qs[_0x2c6a('0x38')](_0xcdecbb['query'][_0x2c6a('0x38')]);_0x48e898[_0x2c6a('0x39')]=qs[_0x2c6a('0x33')](_[_0x2c6a('0x3a')](_0xcdecbb[_0x2c6a('0x31')],_0x1d77a3['filters']),_0x2fa33f);if(_0xcdecbb['query']['filter']){_0x48e898[_0x2c6a('0x39')]=_[_0x2c6a('0x3b')](_0x48e898[_0x2c6a('0x39')],{'$or':_['map'](_0x2fa33f,function(_0x5731b4){if(_0x5731b4[_0x2c6a('0x3c')]!=='VIRTUAL'){var _0x252f61={};_0x252f61[_0x5731b4['name']]={'$like':'%'+_0xcdecbb[_0x2c6a('0x31')][_0x2c6a('0x3d')]+'%'};return _0x252f61;}})});}_0x48e898=_[_0x2c6a('0x3b')]({},_0x48e898,_0xcdecbb[_0x2c6a('0x3e')]);var _0x4ffba7={'where':_0x48e898['where']};return db[_0x2c6a('0x3f')][_0x2c6a('0x21')](_0x4ffba7)['then'](function(_0x4d5ba3){_0x239516[_0x2c6a('0x21')]=_0x4d5ba3;if(_0xcdecbb['query'][_0x2c6a('0x40')]){_0x48e898[_0x2c6a('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x2c6a('0x42')](_0x48e898);})[_0x2c6a('0x26')](function(_0x5019f9){_0x239516['rows']=_0x5019f9;return _0x239516;})[_0x2c6a('0x26')](respondWithFilteredResult(_0x3f7ea5,_0x48e898))[_0x2c6a('0x43')](handleError(_0x3f7ea5,null));};exports[_0x2c6a('0x44')]=function(_0x3f3637,_0x54e54c){var _0x4de9ca={'raw':!![],'where':{'id':_0x3f3637[_0x2c6a('0x45')]['id']}},_0x3640f6={};_0x3640f6[_0x2c6a('0x30')]=_[_0x2c6a('0x32')](db['SquareMessage'][_0x2c6a('0x2e')]);_0x3640f6[_0x2c6a('0x31')]=_[_0x2c6a('0x32')](_0x3f3637[_0x2c6a('0x31')]);_0x3640f6[_0x2c6a('0x33')]=_['intersection'](_0x3640f6[_0x2c6a('0x30')],_0x3640f6['query']);_0x4de9ca[_0x2c6a('0x35')]=_[_0x2c6a('0x34')](_0x3640f6[_0x2c6a('0x30')],qs[_0x2c6a('0x36')](_0x3f3637['query'][_0x2c6a('0x36')]));_0x4de9ca[_0x2c6a('0x35')]=_0x4de9ca[_0x2c6a('0x35')][_0x2c6a('0x46')]?_0x4de9ca['attributes']:_0x3640f6['model'];if(_0x3f3637['query']['includeAll']){_0x4de9ca['include']=[{'all':!![]}];}_0x4de9ca=_[_0x2c6a('0x3b')]({},_0x4de9ca,_0x3f3637[_0x2c6a('0x3e')]);return db[_0x2c6a('0x3f')][_0x2c6a('0x47')](_0x4de9ca)[_0x2c6a('0x26')](handleEntityNotFound(_0x54e54c,null))[_0x2c6a('0x26')](respondWithResult(_0x54e54c,null))[_0x2c6a('0x43')](handleError(_0x54e54c,null));};exports[_0x2c6a('0x48')]=function(_0x259db2,_0x4ff01b){return db[_0x2c6a('0x3f')]['create'](_0x259db2['body'],{})[_0x2c6a('0x26')](respondWithResult(_0x4ff01b,0xc9))['catch'](handleError(_0x4ff01b,null));};exports[_0x2c6a('0x24')]=function(_0x3a8736,_0x2beed5){if(_0x3a8736['body']['id']){delete _0x3a8736[_0x2c6a('0x49')]['id'];}return db[_0x2c6a('0x3f')]['find']({'where':{'id':_0x3a8736[_0x2c6a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2beed5,null))['then'](saveUpdates(_0x3a8736['body'],null))[_0x2c6a('0x26')](respondWithResult(_0x2beed5,null))[_0x2c6a('0x43')](handleError(_0x2beed5,null));};exports[_0x2c6a('0x25')]=function(_0x1a1968,_0xe1d3ea){return db[_0x2c6a('0x3f')][_0x2c6a('0x47')]({'where':{'id':_0x1a1968[_0x2c6a('0x45')]['id']}})['then'](handleEntityNotFound(_0xe1d3ea,null))[_0x2c6a('0x26')](removeEntity(_0xe1d3ea,null))[_0x2c6a('0x43')](handleError(_0xe1d3ea,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 58b1ccb..3dc6d83 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 _0x9468=['square_messages','request-promise','path','./squareMessage.attributes','SquareMessage'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9468,0x11e));var _0x8946=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x9468[_0x571a17];return _0x3ef337;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8946('0x0'));var fs=require('fs');var path=require(_0x8946('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8946('0x2'));module['exports']=function(_0xfc014c,_0x1d350c){return _0xfc014c['define'](_0x8946('0x3'),attributes,{'tableName':_0x8946('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f33=['lodash','util','../../config/logger','bluebird','request-promise','path','./squareMessage.attributes','exports','define','square_messages'];(function(_0x2b5c5b,_0x266411){var _0x519731=function(_0x3caaa9){while(--_0x3caaa9){_0x2b5c5b['push'](_0x2b5c5b['shift']());}};_0x519731(++_0x266411);}(_0x2f33,0xb4));var _0x32f3=function(_0xd8fabd,_0x3e3139){_0xd8fabd=_0xd8fabd-0x0;var _0x8359e4=_0x2f33[_0xd8fabd];return _0x8359e4;};'use strict';var _=require(_0x32f3('0x0'));var util=require(_0x32f3('0x1'));var logger=require(_0x32f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x32f3('0x3'));var rp=require(_0x32f3('0x4'));var fs=require('fs');var path=require(_0x32f3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32f3('0x6'));module[_0x32f3('0x7')]=function(_0x43ef2c,_0x241562){return _0x43ef2c[_0x32f3('0x8')]('SquareMessage',attributes,{'tableName':_0x32f3('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 a069b7a..210b1fe 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 _0x06de=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','info','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug'];(function(_0x41ef02,_0x101e1a){var _0x5e6995=function(_0x124fdd){while(--_0x124fdd){_0x41ef02['push'](_0x41ef02['shift']());}};_0x5e6995(++_0x101e1a);}(_0x06de,0x138));var _0xe06d=function(_0x4eda22,_0x3d2db4){_0x4eda22=_0x4eda22-0x0;var _0x4a5706=_0x06de[_0x4eda22];return _0x4a5706;};'use strict';var _=require(_0xe06d('0x0'));var util=require(_0xe06d('0x1'));var moment=require(_0xe06d('0x2'));var BPromise=require(_0xe06d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe06d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe06d('0x5'));var logger=require(_0xe06d('0x6'))(_0xe06d('0x7'));var config=require('../../config/environment');var jayson=require(_0xe06d('0x8'));var client=jayson[_0xe06d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300001,_0x23d836,_0x310937){return new BPromise(function(_0x420f40,_0x149b6a){return client['request'](_0x300001,_0x310937)[_0xe06d('0xa')](function(_0x102ba8){logger['info']('SquareMessage,\x20%s,\x20%s',_0x23d836,_0xe06d('0xb'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x23d836,_0xe06d('0xb'),JSON[_0xe06d('0xc')](_0x102ba8));if(_0x102ba8['error']){if(_0x102ba8[_0xe06d('0xd')][_0xe06d('0xe')]===0x1f4){logger[_0xe06d('0xd')]('SquareMessage,\x20%s,\x20%s',_0x23d836,_0x102ba8[_0xe06d('0xd')][_0xe06d('0xf')]);return _0x149b6a(_0x102ba8[_0xe06d('0xd')][_0xe06d('0xf')]);}logger[_0xe06d('0xd')](_0xe06d('0x10'),_0x23d836,_0x102ba8[_0xe06d('0xd')][_0xe06d('0xf')]);return _0x420f40(_0x102ba8[_0xe06d('0xd')]['message']);}else{logger[_0xe06d('0x11')](_0xe06d('0x10'),_0x23d836,'request\x20sent');_0x420f40(_0x102ba8[_0xe06d('0x12')]['message']);}})[_0xe06d('0x13')](function(_0x443dab){logger[_0xe06d('0xd')](_0xe06d('0x10'),_0x23d836,_0x443dab);_0x149b6a(_0x443dab);});});}exports['CreateSquareMessage']=function(_0x1cf578){var _0x6d2f73=this;return new Promise(function(_0x7a73eb,_0x39bacf){return db[_0xe06d('0x14')]['create'](_0x1cf578[_0xe06d('0x15')],{'raw':_0x1cf578[_0xe06d('0x16')]?_0x1cf578[_0xe06d('0x16')][_0xe06d('0x17')]===undefined?!![]:![]:!![]})[_0xe06d('0xa')](function(_0x1659a6){logger['info'](_0xe06d('0x18'),_0x1cf578);logger[_0xe06d('0x19')](_0xe06d('0x18'),_0x1cf578,JSON[_0xe06d('0xc')](_0x1659a6));_0x7a73eb(_0x1659a6);})[_0xe06d('0x13')](function(_0x27f368){logger[_0xe06d('0xd')](_0xe06d('0x18'),_0x27f368[_0xe06d('0xf')],_0x1cf578);_0x39bacf(_0x6d2f73[_0xe06d('0xd')](0x1f4,_0x27f368[_0xe06d('0xf')]));});});}; \ No newline at end of file +var _0xfd53=['jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareMessage','create','body','options','raw','then','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd53,0xd1));var _0x3fd5=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xfd53[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x3fd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fd5('0x1'));var fs=require('fs');var Redis=require(_0x3fd5('0x2'));var db=require(_0x3fd5('0x3'))['db'];var utils=require(_0x3fd5('0x4'));var logger=require(_0x3fd5('0x5'))(_0x3fd5('0x6'));var config=require('../../config/environment');var jayson=require(_0x3fd5('0x7'));var client=jayson[_0x3fd5('0x8')][_0x3fd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46ad41,_0x2eed0a,_0x2e5295){return new BPromise(function(_0x329115,_0x133556){return client[_0x3fd5('0xa')](_0x46ad41,_0x2e5295)['then'](function(_0x157335){logger['info'](_0x3fd5('0xb'),_0x2eed0a,_0x3fd5('0xc'));logger['debug'](_0x3fd5('0xd'),_0x2eed0a,_0x3fd5('0xc'),JSON[_0x3fd5('0xe')](_0x157335));if(_0x157335[_0x3fd5('0xf')]){if(_0x157335[_0x3fd5('0xf')][_0x3fd5('0x10')]===0x1f4){logger['error'](_0x3fd5('0xb'),_0x2eed0a,_0x157335['error'][_0x3fd5('0x11')]);return _0x133556(_0x157335[_0x3fd5('0xf')][_0x3fd5('0x11')]);}logger[_0x3fd5('0xf')](_0x3fd5('0xb'),_0x2eed0a,_0x157335[_0x3fd5('0xf')]['message']);return _0x329115(_0x157335[_0x3fd5('0xf')][_0x3fd5('0x11')]);}else{logger[_0x3fd5('0x12')](_0x3fd5('0xb'),_0x2eed0a,'request\x20sent');_0x329115(_0x157335[_0x3fd5('0x13')][_0x3fd5('0x11')]);}})['catch'](function(_0x36dae5){logger[_0x3fd5('0xf')](_0x3fd5('0xb'),_0x2eed0a,_0x36dae5);_0x133556(_0x36dae5);});});}exports[_0x3fd5('0x14')]=function(_0x3292fc){var _0x4464de=this;return new Promise(function(_0x35c69b,_0x3909d4){return db['SquareMessage'][_0x3fd5('0x15')](_0x3292fc[_0x3fd5('0x16')],{'raw':_0x3292fc[_0x3fd5('0x17')]?_0x3292fc[_0x3fd5('0x17')][_0x3fd5('0x18')]===undefined?!![]:![]:!![]})[_0x3fd5('0x19')](function(_0x17432b){logger['info']('CreateSquareMessage',_0x3292fc);logger['debug'](_0x3fd5('0x14'),_0x3292fc,JSON[_0x3fd5('0xe')](_0x17432b));_0x35c69b(_0x17432b);})[_0x3fd5('0x1a')](function(_0x4c731){logger[_0x3fd5('0xf')](_0x3fd5('0x14'),_0x4c731[_0x3fd5('0x11')],_0x3292fc);_0x3909d4(_0x4464de[_0x3fd5('0xf')](0x1f4,_0x4c731[_0x3fd5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c8fc2e6..09bce73 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 _0x8753=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/test','15s','test'];(function(_0x42db5e,_0x415c1f){var _0x3b2d18=function(_0x47b7e3){while(--_0x47b7e3){_0x42db5e['push'](_0x42db5e['shift']());}};_0x3b2d18(++_0x415c1f);}(_0x8753,0x181));var _0x3875=function(_0xf943f3,_0x3a80aa){_0xf943f3=_0xf943f3-0x0;var _0x357159=_0x8753[_0xf943f3];return _0x357159;};'use strict';var multer=require(_0x3875('0x0'));var util=require(_0x3875('0x1'));var path=require('path');var timeout=require(_0x3875('0x2'));var express=require('express');var router=express[_0x3875('0x3')]();var fs_extra=require(_0x3875('0x4'));var auth=require(_0x3875('0x5'));var interaction=require(_0x3875('0x6'));var config=require(_0x3875('0x7'));var controller=require('./squareOdbc.controller');router[_0x3875('0x8')]('/',auth[_0x3875('0x9')](),controller['index']);router['get'](_0x3875('0xa'),auth[_0x3875('0x9')](),controller[_0x3875('0xb')]);router['get'](_0x3875('0xc'),auth['isAuthenticated'](),timeout(_0x3875('0xd')),controller[_0x3875('0xe')]);router['post']('/',auth[_0x3875('0x9')](),controller['create']);router[_0x3875('0xf')](_0x3875('0xa'),auth[_0x3875('0x9')](),controller[_0x3875('0x10')]);router[_0x3875('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3875('0x12')]);module[_0x3875('0x13')]=router; \ No newline at end of file +var _0x42ed=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','create','put','update','delete','/:id','destroy','exports'];(function(_0x20ae5a,_0x424d8a){var _0x266225=function(_0x19d1e1){while(--_0x19d1e1){_0x20ae5a['push'](_0x20ae5a['shift']());}};_0x266225(++_0x424d8a);}(_0x42ed,0xc8));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd42e('0x0'));var express=require(_0xd42e('0x1'));var router=express['Router']();var fs_extra=require(_0xd42e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xd42e('0x3'));var config=require(_0xd42e('0x4'));var controller=require(_0xd42e('0x5'));router[_0xd42e('0x6')]('/',auth[_0xd42e('0x7')](),controller[_0xd42e('0x8')]);router[_0xd42e('0x6')]('/:id',auth[_0xd42e('0x7')](),controller[_0xd42e('0x9')]);router[_0xd42e('0x6')](_0xd42e('0xa'),auth['isAuthenticated'](),timeout(_0xd42e('0xb')),controller[_0xd42e('0xc')]);router['post']('/',auth[_0xd42e('0x7')](),controller[_0xd42e('0xd')]);router[_0xd42e('0xe')]('/:id',auth[_0xd42e('0x7')](),controller[_0xd42e('0xf')]);router[_0xd42e('0x10')](_0xd42e('0x11'),auth[_0xd42e('0x7')](),controller[_0xd42e('0x12')]);module[_0xd42e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 98f67b2..50ef674 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 _0x3f56=['exports','STRING','name','sequelize'];(function(_0x2e185c,_0x271bdc){var _0x484a36=function(_0xad8633){while(--_0xad8633){_0x2e185c['push'](_0x2e185c['shift']());}};_0x484a36(++_0x271bdc);}(_0x3f56,0x8b));var _0x63f5=function(_0x1add35,_0x237f1c){_0x1add35=_0x1add35-0x0;var _0x422ba7=_0x3f56[_0x1add35];return _0x422ba7;};'use strict';var Sequelize=require(_0x63f5('0x0'));module[_0x63f5('0x1')]={'name':{'type':Sequelize[_0x63f5('0x2')],'unique':_0x63f5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x63f5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a5a=['exports','STRING','name','sequelize'];(function(_0x3c3560,_0x3ffc1){var _0x45fed8=function(_0x428924){while(--_0x428924){_0x3c3560['push'](_0x3c3560['shift']());}};_0x45fed8(++_0x3ffc1);}(_0x2a5a,0xf7));var _0xa2a5=function(_0x959f68,_0x441d69){_0x959f68=_0x959f68-0x0;var _0x43a060=_0x2a5a[_0x959f68];return _0x43a060;};'use strict';var Sequelize=require(_0xa2a5('0x0'));module[_0xa2a5('0x1')]={'name':{'type':Sequelize[_0xa2a5('0x2')],'unique':_0xa2a5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa2a5('0x2')]},'description':{'type':Sequelize[_0xa2a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f4c329c..6ed85f8 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 _0x6520=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareOdbc','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x8ea2d1,_0x373583){var _0x4cb6db=function(_0x1e802b){while(--_0x1e802b){_0x8ea2d1['push'](_0x8ea2d1['shift']());}};_0x4cb6db(++_0x373583);}(_0x6520,0x9a));var _0x0652=function(_0x110248,_0xa01b11){_0x110248=_0x110248-0x0;var _0x2220ee=_0x6520[_0x110248];return _0x2220ee;};'use strict';var emlformat=require(_0x0652('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0652('0x1'));var rp=require(_0x0652('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0652('0x3'));var util=require(_0x0652('0x4'));var path=require(_0x0652('0x5'));var sox=require(_0x0652('0x6'));var csv=require(_0x0652('0x7'));var ejs=require(_0x0652('0x8'));var fs=require('fs');var fs_extra=require(_0x0652('0x9'));var _=require(_0x0652('0xa'));var squel=require(_0x0652('0xb'));var crypto=require(_0x0652('0xc'));var jsforce=require(_0x0652('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0652('0x7'));var querystring=require(_0x0652('0xe'));var Papa=require(_0x0652('0xf'));var Redis=require('ioredis');var authService=require(_0x0652('0x10'));var qs=require(_0x0652('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0652('0x12'));var logger=require('../../config/logger')(_0x0652('0x13'));var utils=require(_0x0652('0x14'));var config=require(_0x0652('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0652('0x16'))['db'];function respondWithStatusCode(_0x521b6b,_0x571d62){_0x571d62=_0x571d62||0xcc;return function(_0x17bc76){if(_0x17bc76){return _0x521b6b['sendStatus'](_0x571d62);}return _0x521b6b[_0x0652('0x17')](_0x571d62)['end']();};}function respondWithResult(_0x264257,_0x46f357){_0x46f357=_0x46f357||0xc8;return function(_0x63e7f1){if(_0x63e7f1){return _0x264257[_0x0652('0x17')](_0x46f357)[_0x0652('0x18')](_0x63e7f1);}};}function respondWithFilteredResult(_0x3eff4e,_0x5cc041){return function(_0x11925c){if(_0x11925c){var _0x2dcc6f=typeof _0x5cc041[_0x0652('0x19')]===_0x0652('0x1a')&&typeof _0x5cc041['limit']===_0x0652('0x1a');var _0x4d83a5=_0x11925c['count'];var _0x40024c=_0x2dcc6f?0x0:_0x5cc041[_0x0652('0x19')];var _0x95abc2=_0x2dcc6f?_0x11925c['count']:_0x5cc041[_0x0652('0x19')]+_0x5cc041[_0x0652('0x1b')];var _0x4f82cc;if(_0x95abc2>=_0x4d83a5){_0x95abc2=_0x4d83a5;_0x4f82cc=0xc8;}else{_0x4f82cc=0xce;}_0x3eff4e[_0x0652('0x17')](_0x4f82cc);return _0x3eff4e[_0x0652('0x1c')](_0x0652('0x1d'),_0x40024c+'-'+_0x95abc2+'/'+_0x4d83a5)[_0x0652('0x18')](_0x11925c);}return null;};}function patchUpdates(_0x6aceff){return function(_0x2252d0){try{jsonpatch[_0x0652('0x1e')](_0x2252d0,_0x6aceff,!![]);}catch(_0x5e97f2){return BPromise[_0x0652('0x1f')](_0x5e97f2);}return _0x2252d0[_0x0652('0x20')]();};}function saveUpdates(_0x226b47,_0xd12b36){return function(_0x342c25){if(_0x342c25){return _0x342c25[_0x0652('0x21')](_0x226b47)[_0x0652('0x22')](function(_0x5056c5){return _0x5056c5;});}return null;};}function removeEntity(_0x434e74,_0xd98224){return function(_0x125953){if(_0x125953){return _0x125953[_0x0652('0x23')]()[_0x0652('0x22')](function(){var _0x219a67=_0x125953[_0x0652('0x24')]({'plain':!![]});var _0x476a4e=_0x0652('0x25');return db[_0x0652('0x26')]['destroy']({'where':{'type':_0x476a4e,'resourceId':_0x219a67['id']}})[_0x0652('0x22')](function(){return _0x125953;});})[_0x0652('0x22')](function(){_0x434e74[_0x0652('0x17')](0xcc)[_0x0652('0x27')]();});}};}function handleEntityNotFound(_0x7ac74f,_0x494f98){return function(_0xb7ea4d){if(!_0xb7ea4d){_0x7ac74f[_0x0652('0x28')](0x194);}return _0xb7ea4d;};}function handleError(_0x367ede,_0x111124){_0x111124=_0x111124||0x1f4;return function(_0x4d113d){logger[_0x0652('0x29')](_0x4d113d['stack']);if(_0x4d113d['name']){delete _0x4d113d[_0x0652('0x2a')];}_0x367ede['status'](_0x111124)[_0x0652('0x2b')](_0x4d113d);};}exports[_0x0652('0x2c')]=function(_0x17eccb,_0x43f042){var _0x1d2e42={},_0x19b994={},_0x3adc4e={'count':0x0,'rows':[]};var _0x45ac47=_[_0x0652('0x2d')](db['SquareOdbc'][_0x0652('0x2e')],function(_0x5cf371){return{'name':_0x5cf371[_0x0652('0x2f')],'type':_0x5cf371['type'][_0x0652('0x30')]};});_0x19b994[_0x0652('0x31')]=_['map'](_0x45ac47,_0x0652('0x2a'));_0x19b994['query']=_[_0x0652('0x32')](_0x17eccb['query']);_0x19b994[_0x0652('0x33')]=_[_0x0652('0x34')](_0x19b994['model'],_0x19b994[_0x0652('0x35')]);_0x1d2e42[_0x0652('0x36')]=_[_0x0652('0x34')](_0x19b994[_0x0652('0x31')],qs[_0x0652('0x37')](_0x17eccb[_0x0652('0x35')][_0x0652('0x37')]));_0x1d2e42[_0x0652('0x36')]=_0x1d2e42[_0x0652('0x36')][_0x0652('0x38')]?_0x1d2e42['attributes']:_0x19b994['model'];if(!_0x17eccb[_0x0652('0x35')][_0x0652('0x39')](_0x0652('0x3a'))){_0x1d2e42[_0x0652('0x1b')]=qs[_0x0652('0x1b')](_0x17eccb[_0x0652('0x35')]['limit']);_0x1d2e42[_0x0652('0x19')]=qs[_0x0652('0x19')](_0x17eccb[_0x0652('0x35')][_0x0652('0x19')]);}_0x1d2e42['order']=qs[_0x0652('0x3b')](_0x17eccb[_0x0652('0x35')][_0x0652('0x3b')]);_0x1d2e42[_0x0652('0x3c')]=qs[_0x0652('0x33')](_[_0x0652('0x3d')](_0x17eccb[_0x0652('0x35')],_0x19b994[_0x0652('0x33')]),_0x45ac47);if(_0x17eccb[_0x0652('0x35')][_0x0652('0x3e')]){_0x1d2e42[_0x0652('0x3c')]=_[_0x0652('0x3f')](_0x1d2e42[_0x0652('0x3c')],{'$or':_[_0x0652('0x2d')](_0x45ac47,function(_0xb8c927){if(_0xb8c927[_0x0652('0x40')]!==_0x0652('0x41')){var _0x12d2af={};_0x12d2af[_0xb8c927[_0x0652('0x2a')]]={'$like':'%'+_0x17eccb['query'][_0x0652('0x3e')]+'%'};return _0x12d2af;}})});}_0x1d2e42=_[_0x0652('0x3f')]({},_0x1d2e42,_0x17eccb[_0x0652('0x42')]);var _0x38cae6={'where':_0x1d2e42['where']};return db[_0x0652('0x43')]['count'](_0x38cae6)[_0x0652('0x22')](function(_0x43b80b){_0x3adc4e[_0x0652('0x44')]=_0x43b80b;if(_0x17eccb[_0x0652('0x35')][_0x0652('0x45')]){_0x1d2e42[_0x0652('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0x0652('0x47')](_0x1d2e42);})[_0x0652('0x22')](function(_0x323c58){_0x3adc4e[_0x0652('0x48')]=_0x323c58;return _0x3adc4e;})[_0x0652('0x22')](respondWithFilteredResult(_0x43f042,_0x1d2e42))[_0x0652('0x49')](handleError(_0x43f042,null));};exports[_0x0652('0x4a')]=function(_0x576a2e,_0x40e5ed){var _0x59ad55={'raw':!![],'where':{'id':_0x576a2e[_0x0652('0x4b')]['id']}},_0x98dba4={};_0x98dba4[_0x0652('0x31')]=_['keys'](db['SquareOdbc'][_0x0652('0x2e')]);_0x98dba4[_0x0652('0x35')]=_['keys'](_0x576a2e['query']);_0x98dba4[_0x0652('0x33')]=_[_0x0652('0x34')](_0x98dba4['model'],_0x98dba4[_0x0652('0x35')]);_0x59ad55[_0x0652('0x36')]=_[_0x0652('0x34')](_0x98dba4[_0x0652('0x31')],qs[_0x0652('0x37')](_0x576a2e[_0x0652('0x35')][_0x0652('0x37')]));_0x59ad55[_0x0652('0x36')]=_0x59ad55[_0x0652('0x36')][_0x0652('0x38')]?_0x59ad55[_0x0652('0x36')]:_0x98dba4[_0x0652('0x31')];if(_0x576a2e[_0x0652('0x35')][_0x0652('0x45')]){_0x59ad55[_0x0652('0x46')]=[{'all':!![]}];}_0x59ad55=_[_0x0652('0x3f')]({},_0x59ad55,_0x576a2e[_0x0652('0x42')]);return db[_0x0652('0x43')][_0x0652('0x4c')](_0x59ad55)['then'](handleEntityNotFound(_0x40e5ed,null))[_0x0652('0x22')](respondWithResult(_0x40e5ed,null))[_0x0652('0x49')](handleError(_0x40e5ed,null));};exports[_0x0652('0x4d')]=function(_0x2170da,_0xa4a402){return db[_0x0652('0x43')][_0x0652('0x4d')](_0x2170da[_0x0652('0x4e')],{})[_0x0652('0x22')](function(_0x407dc2){var _0x9108eb=_0x2170da[_0x0652('0x4f')]['get']({'plain':!![]});if(!_0x9108eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9108eb['role']===_0x0652('0x4f')){var _0x24ba41=_0x407dc2[_0x0652('0x24')]({'plain':!![]});var _0x444252=_0x0652('0x25');return db[_0x0652('0x50')]['find']({'where':{'name':_0x444252,'userProfileId':_0x9108eb[_0x0652('0x51')]},'raw':!![]})['then'](function(_0x1b6155){if(_0x1b6155&&_0x1b6155[_0x0652('0x52')]===0x0){return db[_0x0652('0x26')][_0x0652('0x4d')]({'name':_0x24ba41[_0x0652('0x2a')],'resourceId':_0x24ba41['id'],'type':_0x1b6155['name'],'sectionId':_0x1b6155['id']},{})[_0x0652('0x22')](function(){return _0x407dc2;});}else{return _0x407dc2;}})['catch'](function(_0x5a28a1){logger[_0x0652('0x29')](_0x0652('0x53'),_0x5a28a1);throw _0x5a28a1;});}return _0x407dc2;})['then'](respondWithResult(_0xa4a402,0xc9))[_0x0652('0x49')](handleError(_0xa4a402,null));};exports[_0x0652('0x21')]=function(_0x418fd3,_0x18f682){if(_0x418fd3[_0x0652('0x4e')]['id']){delete _0x418fd3['body']['id'];}return db[_0x0652('0x43')]['find']({'where':{'id':_0x418fd3[_0x0652('0x4b')]['id']}})[_0x0652('0x22')](handleEntityNotFound(_0x18f682,null))[_0x0652('0x22')](saveUpdates(_0x418fd3[_0x0652('0x4e')],null))['then'](respondWithResult(_0x18f682,null))[_0x0652('0x49')](handleError(_0x18f682,null));};exports[_0x0652('0x23')]=function(_0x216a65,_0x2693da){return db[_0x0652('0x43')][_0x0652('0x4c')]({'where':{'id':_0x216a65['params']['id']}})[_0x0652('0x22')](handleEntityNotFound(_0x2693da,null))[_0x0652('0x22')](removeEntity(_0x2693da,null))[_0x0652('0x49')](handleError(_0x2693da,null));};exports['test']=function(_0x3a68e6,_0x41b413,_0x18391e){var _0x409525;return db[_0x0652('0x43')][_0x0652('0x4c')]({'where':{'id':_0x3a68e6[_0x0652('0x4b')]['id']},'attributes':['id',_0x0652('0x54')]})[_0x0652('0x22')](handleEntityNotFound(_0x41b413,null))['then'](function(_0x204c4a){if(_0x204c4a){var _0x14587d=require(_0x0652('0x55'))();_0x14587d['openSync'](_0x204c4a[_0x0652('0x54')]);_0x14587d['closeSync']();return _0x204c4a;}})[_0x0652('0x22')](respondWithResult(_0x41b413,null))['catch'](handleError(_0x41b413,null));}; \ No newline at end of file +var _0x2328=['offset','limit','undefined','count','Content-Range','save','then','destroy','ODBC','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','show','find','catch','create','body','user','role','get','UserProfileSection','autoAssociation','UserProfileResource','error','update','params','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x34448f,_0x14c1a9){var _0x1e4223=function(_0x2c0790){while(--_0x2c0790){_0x34448f['push'](_0x34448f['shift']());}};_0x1e4223(++_0x14c1a9);}(_0x2328,0x13b));var _0x8232=function(_0x20b6c4,_0x3c3663){_0x20b6c4=_0x20b6c4-0x0;var _0x2da539=_0x2328[_0x20b6c4];return _0x2da539;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8232('0x0'));var jsonpatch=require(_0x8232('0x1'));var rp=require(_0x8232('0x2'));var moment=require(_0x8232('0x3'));var BPromise=require(_0x8232('0x4'));var Mustache=require(_0x8232('0x5'));var util=require(_0x8232('0x6'));var path=require(_0x8232('0x7'));var sox=require(_0x8232('0x8'));var csv=require(_0x8232('0x9'));var ejs=require(_0x8232('0xa'));var fs=require('fs');var fs_extra=require(_0x8232('0xb'));var _=require(_0x8232('0xc'));var squel=require('squel');var crypto=require(_0x8232('0xd'));var jsforce=require(_0x8232('0xe'));var deskjs=require(_0x8232('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8232('0x10'));var Papa=require(_0x8232('0x11'));var Redis=require('ioredis');var authService=require(_0x8232('0x12'));var qs=require(_0x8232('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8232('0x14'));var logger=require('../../config/logger')(_0x8232('0x15'));var utils=require(_0x8232('0x16'));var config=require(_0x8232('0x17'));var licenseUtil=require(_0x8232('0x18'));var db=require(_0x8232('0x19'))['db'];function respondWithStatusCode(_0x12f36e,_0x4a5f88){_0x4a5f88=_0x4a5f88||0xcc;return function(_0x597583){if(_0x597583){return _0x12f36e[_0x8232('0x1a')](_0x4a5f88);}return _0x12f36e[_0x8232('0x1b')](_0x4a5f88)['end']();};}function respondWithResult(_0x29fccc,_0x4f2f00){_0x4f2f00=_0x4f2f00||0xc8;return function(_0x38c9c4){if(_0x38c9c4){return _0x29fccc[_0x8232('0x1b')](_0x4f2f00)[_0x8232('0x1c')](_0x38c9c4);}};}function respondWithFilteredResult(_0x85e33,_0x34cb9c){return function(_0x589caf){if(_0x589caf){var _0x581b61=typeof _0x34cb9c[_0x8232('0x1d')]==='undefined'&&typeof _0x34cb9c[_0x8232('0x1e')]===_0x8232('0x1f');var _0x1db922=_0x589caf[_0x8232('0x20')];var _0x13dd0b=_0x581b61?0x0:_0x34cb9c[_0x8232('0x1d')];var _0x269724=_0x581b61?_0x589caf[_0x8232('0x20')]:_0x34cb9c[_0x8232('0x1d')]+_0x34cb9c['limit'];var _0x464202;if(_0x269724>=_0x1db922){_0x269724=_0x1db922;_0x464202=0xc8;}else{_0x464202=0xce;}_0x85e33[_0x8232('0x1b')](_0x464202);return _0x85e33['set'](_0x8232('0x21'),_0x13dd0b+'-'+_0x269724+'/'+_0x1db922)[_0x8232('0x1c')](_0x589caf);}return null;};}function patchUpdates(_0x302b71){return function(_0x2d7f6c){try{jsonpatch['apply'](_0x2d7f6c,_0x302b71,!![]);}catch(_0x2124a5){return BPromise['reject'](_0x2124a5);}return _0x2d7f6c[_0x8232('0x22')]();};}function saveUpdates(_0x3bae47,_0x290982){return function(_0x222d99){if(_0x222d99){return _0x222d99['update'](_0x3bae47)[_0x8232('0x23')](function(_0x47643c){return _0x47643c;});}return null;};}function removeEntity(_0x7f0340,_0x13acd6){return function(_0x91edc5){if(_0x91edc5){return _0x91edc5[_0x8232('0x24')]()[_0x8232('0x23')](function(){var _0x5e1d8a=_0x91edc5['get']({'plain':!![]});var _0x1214b3=_0x8232('0x25');return db['UserProfileResource'][_0x8232('0x24')]({'where':{'type':_0x1214b3,'resourceId':_0x5e1d8a['id']}})[_0x8232('0x23')](function(){return _0x91edc5;});})['then'](function(){_0x7f0340[_0x8232('0x1b')](0xcc)[_0x8232('0x26')]();});}};}function handleEntityNotFound(_0x5c8f78,_0x1095e3){return function(_0x59b237){if(!_0x59b237){_0x5c8f78['sendStatus'](0x194);}return _0x59b237;};}function handleError(_0xd2c268,_0x3f6929){_0x3f6929=_0x3f6929||0x1f4;return function(_0x5d0665){logger['error'](_0x5d0665[_0x8232('0x27')]);if(_0x5d0665['name']){delete _0x5d0665[_0x8232('0x28')];}_0xd2c268[_0x8232('0x1b')](_0x3f6929)[_0x8232('0x29')](_0x5d0665);};}exports[_0x8232('0x2a')]=function(_0x386c99,_0x591ee4){var _0x435a77={},_0x303655={},_0x36abad={'count':0x0,'rows':[]};var _0x450066=_['map'](db['SquareOdbc'][_0x8232('0x2b')],function(_0x1db010){return{'name':_0x1db010[_0x8232('0x2c')],'type':_0x1db010[_0x8232('0x2d')][_0x8232('0x2e')]};});_0x303655[_0x8232('0x2f')]=_[_0x8232('0x30')](_0x450066,_0x8232('0x28'));_0x303655[_0x8232('0x31')]=_[_0x8232('0x32')](_0x386c99[_0x8232('0x31')]);_0x303655['filters']=_[_0x8232('0x33')](_0x303655[_0x8232('0x2f')],_0x303655['query']);_0x435a77['attributes']=_['intersection'](_0x303655[_0x8232('0x2f')],qs[_0x8232('0x34')](_0x386c99[_0x8232('0x31')][_0x8232('0x34')]));_0x435a77[_0x8232('0x35')]=_0x435a77[_0x8232('0x35')][_0x8232('0x36')]?_0x435a77[_0x8232('0x35')]:_0x303655[_0x8232('0x2f')];if(!_0x386c99[_0x8232('0x31')][_0x8232('0x37')]('nolimit')){_0x435a77['limit']=qs[_0x8232('0x1e')](_0x386c99[_0x8232('0x31')][_0x8232('0x1e')]);_0x435a77[_0x8232('0x1d')]=qs[_0x8232('0x1d')](_0x386c99[_0x8232('0x31')][_0x8232('0x1d')]);}_0x435a77[_0x8232('0x38')]=qs['sort'](_0x386c99[_0x8232('0x31')][_0x8232('0x39')]);_0x435a77[_0x8232('0x3a')]=qs[_0x8232('0x3b')](_['pick'](_0x386c99[_0x8232('0x31')],_0x303655[_0x8232('0x3b')]),_0x450066);if(_0x386c99[_0x8232('0x31')][_0x8232('0x3c')]){_0x435a77[_0x8232('0x3a')]=_[_0x8232('0x3d')](_0x435a77[_0x8232('0x3a')],{'$or':_[_0x8232('0x30')](_0x450066,function(_0x24e402){if(_0x24e402[_0x8232('0x2d')]!==_0x8232('0x3e')){var _0x3070c9={};_0x3070c9[_0x24e402['name']]={'$like':'%'+_0x386c99['query'][_0x8232('0x3c')]+'%'};return _0x3070c9;}})});}_0x435a77=_['merge']({},_0x435a77,_0x386c99[_0x8232('0x3f')]);var _0x2fb566={'where':_0x435a77[_0x8232('0x3a')]};return db[_0x8232('0x40')]['count'](_0x2fb566)[_0x8232('0x23')](function(_0x30a3b0){_0x36abad[_0x8232('0x20')]=_0x30a3b0;if(_0x386c99[_0x8232('0x31')][_0x8232('0x41')]){_0x435a77[_0x8232('0x42')]=[{'all':!![]}];}return db[_0x8232('0x40')][_0x8232('0x43')](_0x435a77);})['then'](function(_0x5e4dc3){_0x36abad['rows']=_0x5e4dc3;return _0x36abad;})[_0x8232('0x23')](respondWithFilteredResult(_0x591ee4,_0x435a77))['catch'](handleError(_0x591ee4,null));};exports[_0x8232('0x44')]=function(_0x2dccbc,_0x298ba3){var _0x206ea7={'raw':!![],'where':{'id':_0x2dccbc['params']['id']}},_0x268457={};_0x268457[_0x8232('0x2f')]=_[_0x8232('0x32')](db[_0x8232('0x40')][_0x8232('0x2b')]);_0x268457[_0x8232('0x31')]=_['keys'](_0x2dccbc[_0x8232('0x31')]);_0x268457['filters']=_[_0x8232('0x33')](_0x268457['model'],_0x268457[_0x8232('0x31')]);_0x206ea7['attributes']=_['intersection'](_0x268457[_0x8232('0x2f')],qs[_0x8232('0x34')](_0x2dccbc[_0x8232('0x31')]['fields']));_0x206ea7[_0x8232('0x35')]=_0x206ea7['attributes'][_0x8232('0x36')]?_0x206ea7['attributes']:_0x268457[_0x8232('0x2f')];if(_0x2dccbc[_0x8232('0x31')][_0x8232('0x41')]){_0x206ea7[_0x8232('0x42')]=[{'all':!![]}];}_0x206ea7=_[_0x8232('0x3d')]({},_0x206ea7,_0x2dccbc['options']);return db[_0x8232('0x40')][_0x8232('0x45')](_0x206ea7)[_0x8232('0x23')](handleEntityNotFound(_0x298ba3,null))['then'](respondWithResult(_0x298ba3,null))[_0x8232('0x46')](handleError(_0x298ba3,null));};exports[_0x8232('0x47')]=function(_0xfae7d6,_0x48948b){return db['SquareOdbc'][_0x8232('0x47')](_0xfae7d6[_0x8232('0x48')],{})['then'](function(_0xf3ae4b){var _0x1aeacc=_0xfae7d6[_0x8232('0x49')]['get']({'plain':!![]});if(!_0x1aeacc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aeacc[_0x8232('0x4a')]==='user'){var _0x1e3b90=_0xf3ae4b[_0x8232('0x4b')]({'plain':!![]});var _0x2d3edc='ODBC';return db[_0x8232('0x4c')][_0x8232('0x45')]({'where':{'name':_0x2d3edc,'userProfileId':_0x1aeacc['userProfileId']},'raw':!![]})[_0x8232('0x23')](function(_0x51e810){if(_0x51e810&&_0x51e810[_0x8232('0x4d')]===0x0){return db[_0x8232('0x4e')][_0x8232('0x47')]({'name':_0x1e3b90['name'],'resourceId':_0x1e3b90['id'],'type':_0x51e810[_0x8232('0x28')],'sectionId':_0x51e810['id']},{})[_0x8232('0x23')](function(){return _0xf3ae4b;});}else{return _0xf3ae4b;}})[_0x8232('0x46')](function(_0x53cdf7){logger[_0x8232('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53cdf7);throw _0x53cdf7;});}return _0xf3ae4b;})['then'](respondWithResult(_0x48948b,0xc9))['catch'](handleError(_0x48948b,null));};exports[_0x8232('0x50')]=function(_0x3ed6f8,_0xad9fc){if(_0x3ed6f8[_0x8232('0x48')]['id']){delete _0x3ed6f8[_0x8232('0x48')]['id'];}return db[_0x8232('0x40')][_0x8232('0x45')]({'where':{'id':_0x3ed6f8[_0x8232('0x51')]['id']}})[_0x8232('0x23')](handleEntityNotFound(_0xad9fc,null))[_0x8232('0x23')](saveUpdates(_0x3ed6f8['body'],null))[_0x8232('0x23')](respondWithResult(_0xad9fc,null))[_0x8232('0x46')](handleError(_0xad9fc,null));};exports['destroy']=function(_0x3c7d85,_0x302f5b){return db[_0x8232('0x40')][_0x8232('0x45')]({'where':{'id':_0x3c7d85['params']['id']}})[_0x8232('0x23')](handleEntityNotFound(_0x302f5b,null))[_0x8232('0x23')](removeEntity(_0x302f5b,null))['catch'](handleError(_0x302f5b,null));};exports['test']=function(_0x1854d5,_0x4e4ac5,_0x277292){var _0x27b7df;return db[_0x8232('0x40')][_0x8232('0x45')]({'where':{'id':_0x1854d5['params']['id']},'attributes':['id',_0x8232('0x52')]})[_0x8232('0x23')](handleEntityNotFound(_0x4e4ac5,null))[_0x8232('0x23')](function(_0xc2d7cb){if(_0xc2d7cb){var _0x447889=require(_0x8232('0x53'))();_0x447889[_0x8232('0x54')](_0xc2d7cb[_0x8232('0x52')]);_0x447889[_0x8232('0x55')]();return _0xc2d7cb;}})[_0x8232('0x23')](respondWithResult(_0x4e4ac5,null))['catch'](handleError(_0x4e4ac5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index dd82f89..07c9a74 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 _0x9642=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','api','moment'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x9642,0xbf));var _0x2964=function(_0x36e56a,_0x23c0bd){_0x36e56a=_0x36e56a-0x0;var _0x4ee3c5=_0x9642[_0x36e56a];return _0x4ee3c5;};'use strict';var _=require(_0x2964('0x0'));var util=require(_0x2964('0x1'));var logger=require('../../config/logger')(_0x2964('0x2'));var moment=require(_0x2964('0x3'));var BPromise=require(_0x2964('0x4'));var rp=require(_0x2964('0x5'));var fs=require('fs');var path=require(_0x2964('0x6'));var rimraf=require(_0x2964('0x7'));var config=require(_0x2964('0x8'));var attributes=require(_0x2964('0x9'));module[_0x2964('0xa')]=function(_0x2171f8,_0x544450){return _0x2171f8[_0x2964('0xb')](_0x2964('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf644=['request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf644,0xd8));var _0x4f64=function(_0x116e62,_0xa92221){_0x116e62=_0x116e62-0x0;var _0x142c54=_0xf644[_0x116e62];return _0x142c54;};'use strict';var _=require(_0x4f64('0x0'));var util=require(_0x4f64('0x1'));var logger=require(_0x4f64('0x2'))('api');var moment=require(_0x4f64('0x3'));var BPromise=require(_0x4f64('0x4'));var rp=require(_0x4f64('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f64('0x6'));var config=require(_0x4f64('0x7'));var attributes=require(_0x4f64('0x8'));module[_0x4f64('0x9')]=function(_0x458906,_0x5dd231){return _0x458906[_0x4f64('0xa')](_0x4f64('0xb'),attributes,{'tableName':_0x4f64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 04d9c16..0bce4a7 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 _0x0acc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','attributes','model','moment','bluebird','randomstring'];(function(_0xacbfa5,_0xfe352){var _0x5a8a3d=function(_0x28d101){while(--_0x28d101){_0xacbfa5['push'](_0xacbfa5['shift']());}};_0x5a8a3d(++_0xfe352);}(_0x0acc,0x81));var _0xc0ac=function(_0x42c903,_0x5c81bc){_0x42c903=_0x42c903-0x0;var _0xcfd717=_0x0acc[_0x42c903];return _0xcfd717;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0ac('0x0'));var BPromise=require(_0xc0ac('0x1'));var rs=require(_0xc0ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc0ac('0x3'));var logger=require(_0xc0ac('0x4'))(_0xc0ac('0x5'));var config=require(_0xc0ac('0x6'));var jayson=require(_0xc0ac('0x7'));var client=jayson[_0xc0ac('0x8')][_0xc0ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x359d8d,_0x293e07,_0x56247a){return new BPromise(function(_0x3bfa75,_0x2fba84){return client[_0xc0ac('0xa')](_0x359d8d,_0x56247a)[_0xc0ac('0xb')](function(_0x51db23){logger[_0xc0ac('0xc')](_0xc0ac('0xd'),_0x293e07,_0xc0ac('0xe'));logger[_0xc0ac('0xf')](_0xc0ac('0x10'),_0x293e07,_0xc0ac('0xe'),JSON[_0xc0ac('0x11')](_0x51db23));if(_0x51db23[_0xc0ac('0x12')]){if(_0x51db23[_0xc0ac('0x12')][_0xc0ac('0x13')]===0x1f4){logger[_0xc0ac('0x12')](_0xc0ac('0xd'),_0x293e07,_0x51db23['error']['message']);return _0x2fba84(_0x51db23[_0xc0ac('0x12')][_0xc0ac('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x293e07,_0x51db23[_0xc0ac('0x12')][_0xc0ac('0x14')]);return _0x3bfa75(_0x51db23[_0xc0ac('0x12')][_0xc0ac('0x14')]);}else{logger[_0xc0ac('0xc')](_0xc0ac('0xd'),_0x293e07,_0xc0ac('0xe'));_0x3bfa75(_0x51db23[_0xc0ac('0x15')][_0xc0ac('0x14')]);}})[_0xc0ac('0x16')](function(_0x2c8080){logger[_0xc0ac('0x12')](_0xc0ac('0xd'),_0x293e07,_0x2c8080);_0x2fba84(_0x2c8080);});});}exports[_0xc0ac('0x17')]=function(_0x419e49){var _0x36c26a=this;return new Promise(function(_0x390f95,_0x32d387){return db[_0xc0ac('0x18')][_0xc0ac('0x19')]({'raw':_0x419e49[_0xc0ac('0x1a')]?_0x419e49[_0xc0ac('0x1a')][_0xc0ac('0x1b')]===undefined?!![]:![]:!![],'where':_0x419e49[_0xc0ac('0x1a')]?_0x419e49[_0xc0ac('0x1a')][_0xc0ac('0x1c')]||null:null,'attributes':_0x419e49[_0xc0ac('0x1a')]?_0x419e49['options']['attributes']||null:null,'include':_0x419e49[_0xc0ac('0x1a')]?_0x419e49[_0xc0ac('0x1a')][_0xc0ac('0x1d')]?_[_0xc0ac('0x1e')](_0x419e49[_0xc0ac('0x1a')]['include'],function(_0xb2b993){return{'model':db[_0xb2b993['model']],'as':_0xb2b993['as'],'attributes':_0xb2b993[_0xc0ac('0x1f')],'include':_0xb2b993[_0xc0ac('0x1d')]?_[_0xc0ac('0x1e')](_0xb2b993[_0xc0ac('0x1d')],function(_0x3e3d5a){return{'model':db[_0x3e3d5a[_0xc0ac('0x20')]],'as':_0x3e3d5a['as'],'attributes':_0x3e3d5a[_0xc0ac('0x1f')],'include':_0x3e3d5a['include']?_[_0xc0ac('0x1e')](_0x3e3d5a[_0xc0ac('0x1d')],function(_0x425086){return{'model':db[_0x425086[_0xc0ac('0x20')]],'as':_0x425086['as'],'attributes':_0x425086[_0xc0ac('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0ac('0xb')](function(_0x42d72e){logger[_0xc0ac('0xc')](_0xc0ac('0x17'),_0x419e49);logger[_0xc0ac('0xf')]('ShowSquareOdbc',_0x419e49,JSON[_0xc0ac('0x11')](_0x42d72e));_0x390f95(_0x42d72e);})[_0xc0ac('0x16')](function(_0x3fb763){logger[_0xc0ac('0x12')](_0xc0ac('0x17'),_0x3fb763[_0xc0ac('0x14')],_0x419e49);_0x32d387(_0x36c26a[_0xc0ac('0x12')](0x1f4,_0x3fb763[_0xc0ac('0x14')]));});});}; \ No newline at end of file +var _0x2680=['code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ab5ec,_0x1e46b2){var _0x59ee2=function(_0x53ef10){while(--_0x53ef10){_0x2ab5ec['push'](_0x2ab5ec['shift']());}};_0x59ee2(++_0x1e46b2);}(_0x2680,0x179));var _0x0268=function(_0x6f4fbb,_0x226d8c){_0x6f4fbb=_0x6f4fbb-0x0;var _0x3e78e9=_0x2680[_0x6f4fbb];return _0x3e78e9;};'use strict';var _=require(_0x0268('0x0'));var util=require(_0x0268('0x1'));var moment=require(_0x0268('0x2'));var BPromise=require(_0x0268('0x3'));var rs=require(_0x0268('0x4'));var fs=require('fs');var Redis=require(_0x0268('0x5'));var db=require(_0x0268('0x6'))['db'];var utils=require(_0x0268('0x7'));var logger=require(_0x0268('0x8'))(_0x0268('0x9'));var config=require(_0x0268('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0268('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xef8e7f,_0x2a62da,_0x50ffed){return new BPromise(function(_0x4e2747,_0x24b3fa){return client['request'](_0xef8e7f,_0x50ffed)['then'](function(_0x312733){logger[_0x0268('0xc')](_0x0268('0xd'),_0x2a62da,_0x0268('0xe'));logger[_0x0268('0xf')](_0x0268('0x10'),_0x2a62da,_0x0268('0xe'),JSON[_0x0268('0x11')](_0x312733));if(_0x312733[_0x0268('0x12')]){if(_0x312733[_0x0268('0x12')][_0x0268('0x13')]===0x1f4){logger['error'](_0x0268('0xd'),_0x2a62da,_0x312733[_0x0268('0x12')][_0x0268('0x14')]);return _0x24b3fa(_0x312733[_0x0268('0x12')][_0x0268('0x14')]);}logger['error'](_0x0268('0xd'),_0x2a62da,_0x312733['error']['message']);return _0x4e2747(_0x312733[_0x0268('0x12')][_0x0268('0x14')]);}else{logger[_0x0268('0xc')](_0x0268('0xd'),_0x2a62da,_0x0268('0xe'));_0x4e2747(_0x312733[_0x0268('0x15')][_0x0268('0x14')]);}})[_0x0268('0x16')](function(_0x55687e){logger[_0x0268('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2a62da,_0x55687e);_0x24b3fa(_0x55687e);});});}exports[_0x0268('0x17')]=function(_0xa908c9){var _0x4f96d5=this;return new Promise(function(_0x5e97f2,_0x31694b){return db[_0x0268('0x18')][_0x0268('0x19')]({'raw':_0xa908c9[_0x0268('0x1a')]?_0xa908c9[_0x0268('0x1a')][_0x0268('0x1b')]===undefined?!![]:![]:!![],'where':_0xa908c9[_0x0268('0x1a')]?_0xa908c9[_0x0268('0x1a')][_0x0268('0x1c')]||null:null,'attributes':_0xa908c9[_0x0268('0x1a')]?_0xa908c9[_0x0268('0x1a')][_0x0268('0x1d')]||null:null,'include':_0xa908c9[_0x0268('0x1a')]?_0xa908c9[_0x0268('0x1a')][_0x0268('0x1e')]?_[_0x0268('0x1f')](_0xa908c9['options'][_0x0268('0x1e')],function(_0x1a18dd){return{'model':db[_0x1a18dd[_0x0268('0x20')]],'as':_0x1a18dd['as'],'attributes':_0x1a18dd[_0x0268('0x1d')],'include':_0x1a18dd[_0x0268('0x1e')]?_['map'](_0x1a18dd[_0x0268('0x1e')],function(_0x275cbc){return{'model':db[_0x275cbc[_0x0268('0x20')]],'as':_0x275cbc['as'],'attributes':_0x275cbc['attributes'],'include':_0x275cbc[_0x0268('0x1e')]?_[_0x0268('0x1f')](_0x275cbc['include'],function(_0x414bbb){return{'model':db[_0x414bbb[_0x0268('0x20')]],'as':_0x414bbb['as'],'attributes':_0x414bbb[_0x0268('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d4c1d){logger['info'](_0x0268('0x17'),_0xa908c9);logger['debug'](_0x0268('0x17'),_0xa908c9,JSON[_0x0268('0x11')](_0x4d4c1d));_0x5e97f2(_0x4d4c1d);})[_0x0268('0x16')](function(_0x18fac3){logger['error']('ShowSquareOdbc',_0x18fac3[_0x0268('0x14')],_0xa908c9);_0x31694b(_0x4f96d5[_0x0268('0x12')](0x1f4,_0x18fac3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index fc8f3ce..8fdc4e7 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 _0x2fa2=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','update','delete','destroy','exports'];(function(_0x293215,_0x4079b4){var _0x1100be=function(_0x19108d){while(--_0x19108d){_0x293215['push'](_0x293215['shift']());}};_0x1100be(++_0x4079b4);}(_0x2fa2,0x77));var _0x22fa=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x2fa2[_0x2cd1fb];return _0x48fd2b;};'use strict';var multer=require(_0x22fa('0x0'));var util=require(_0x22fa('0x1'));var path=require(_0x22fa('0x2'));var timeout=require(_0x22fa('0x3'));var express=require(_0x22fa('0x4'));var router=express['Router']();var fs_extra=require(_0x22fa('0x5'));var auth=require(_0x22fa('0x6'));var interaction=require(_0x22fa('0x7'));var config=require(_0x22fa('0x8'));var controller=require('./squareProject.controller');router[_0x22fa('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x22fa('0xa'),auth[_0x22fa('0xb')](),controller['show']);router[_0x22fa('0xc')]('/',auth[_0x22fa('0xb')](),controller['create']);router['put'](_0x22fa('0xa'),auth[_0x22fa('0xb')](),controller[_0x22fa('0xd')]);router[_0x22fa('0xe')](_0x22fa('0xa'),auth[_0x22fa('0xb')](),controller[_0x22fa('0xf')]);module[_0x22fa('0x10')]=router; \ No newline at end of file +var _0x984c=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0x2ad566,_0x1f46c8){var _0x47c3b6=function(_0x42a6bc){while(--_0x42a6bc){_0x2ad566['push'](_0x2ad566['shift']());}};_0x47c3b6(++_0x1f46c8);}(_0x984c,0x111));var _0xc984=function(_0x57c1c7,_0x5f0cde){_0x57c1c7=_0x57c1c7-0x0;var _0x5b2f7d=_0x984c[_0x57c1c7];return _0x5b2f7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc984('0x0'));var timeout=require(_0xc984('0x1'));var express=require(_0xc984('0x2'));var router=express['Router']();var fs_extra=require(_0xc984('0x3'));var auth=require(_0xc984('0x4'));var interaction=require(_0xc984('0x5'));var config=require(_0xc984('0x6'));var controller=require('./squareProject.controller');router[_0xc984('0x7')]('/',auth[_0xc984('0x8')](),controller['index']);router['get'](_0xc984('0x9'),auth[_0xc984('0x8')](),controller[_0xc984('0xa')]);router['post']('/',auth[_0xc984('0x8')](),controller[_0xc984('0xb')]);router[_0xc984('0xc')](_0xc984('0x9'),auth[_0xc984('0x8')](),controller['update']);router[_0xc984('0xd')](_0xc984('0x9'),auth[_0xc984('0x8')](),controller[_0xc984('0xe')]);module[_0xc984('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ea4ea97..5f14b2b 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 _0x40bd=['preproduction','utf8','production','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x323fce,_0x410404){var _0x529771=function(_0x2e0d80){while(--_0x2e0d80){_0x323fce['push'](_0x323fce['shift']());}};_0x529771(++_0x410404);}(_0x40bd,0x1d2));var _0xd40b=function(_0x38a88c,_0x249b05){_0x38a88c=_0x38a88c-0x0;var _0x37e1a9=_0x40bd[_0x38a88c];return _0x37e1a9;};'use strict';var Sequelize=require(_0xd40b('0x0'));module[_0xd40b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd40b('0x2')]},'notes':{'type':Sequelize[_0xd40b('0x3')]},'preproduction':{'type':Sequelize[_0xd40b('0x4')](_0xd40b('0x5')),'get':function(){if(this[_0xd40b('0x6')](_0xd40b('0x7'))){return this[_0xd40b('0x6')](_0xd40b('0x7'))['toString'](_0xd40b('0x8'));}}},'production':{'type':Sequelize[_0xd40b('0x4')](_0xd40b('0x5')),'get':function(){if(this['getDataValue'](_0xd40b('0x9'))){return this['getDataValue'](_0xd40b('0x9'))['toString'](_0xd40b('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd40b('0xa')]}}; \ No newline at end of file +var _0x53d5=['BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE','sequelize','name','STRING','TEXT'];(function(_0x222a35,_0x3b40c9){var _0x24aaf9=function(_0x9057a0){while(--_0x9057a0){_0x222a35['push'](_0x222a35['shift']());}};_0x24aaf9(++_0x3b40c9);}(_0x53d5,0x68));var _0x553d=function(_0xdf1858,_0x5692d0){_0xdf1858=_0xdf1858-0x0;var _0x3e64f0=_0x53d5[_0xdf1858];return _0x3e64f0;};'use strict';var Sequelize=require(_0x553d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x553d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x553d('0x2')]},'notes':{'type':Sequelize[_0x553d('0x3')]},'preproduction':{'type':Sequelize[_0x553d('0x4')](_0x553d('0x5')),'get':function(){if(this[_0x553d('0x6')](_0x553d('0x7'))){return this[_0x553d('0x6')](_0x553d('0x7'))[_0x553d('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x553d('0x5')),'get':function(){if(this[_0x553d('0x6')](_0x553d('0x9'))){return this[_0x553d('0x6')](_0x553d('0x9'))[_0x553d('0x8')](_0x553d('0xa'));}}},'savedAt':{'type':Sequelize[_0x553d('0xb')]},'publishedAt':{'type':Sequelize[_0x553d('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b789168..6a5aabd 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 _0x0eff=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','UserProfileResource','publish','agi','stringify','sendStatus','error','name','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x4257cf,_0x3cd364){var _0x5394a3=function(_0x3ae4da){while(--_0x3ae4da){_0x4257cf['push'](_0x4257cf['shift']());}};_0x5394a3(++_0x3cd364);}(_0x0eff,0xe5));var _0xf0ef=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x0eff[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xf0ef('0x0'));var Redis=require(_0xf0ef('0x1'));var qs=require(_0xf0ef('0x2'));var logger=require(_0xf0ef('0x3'))(_0xf0ef('0x4'));var config=require(_0xf0ef('0x5'));var db=require(_0xf0ef('0x6'))['db'];config[_0xf0ef('0x7')]=_['defaults'](config[_0xf0ef('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0ef('0x8'))(new Redis(config[_0xf0ef('0x7')]));require('./squareProject.socket')[_0xf0ef('0x9')](socket);function respondWithResult(_0x44c9a7,_0x5b6237){_0x5b6237=_0x5b6237||0xc8;return function(_0x27efa7){if(_0x27efa7){return _0x44c9a7[_0xf0ef('0xa')](_0x5b6237)['json'](_0x27efa7);}};}function respondWithFilteredResult(_0x44bda7,_0x1dfd6d){return function(_0x106b97){if(_0x106b97){var _0x4ddbd8=typeof _0x1dfd6d[_0xf0ef('0xb')]===_0xf0ef('0xc')&&typeof _0x1dfd6d[_0xf0ef('0xd')]===_0xf0ef('0xc');var _0x4cae86=_0x106b97[_0xf0ef('0xe')];var _0xdd2b5d=_0x4ddbd8?0x0:_0x1dfd6d[_0xf0ef('0xb')];var _0x4c6381=_0x4ddbd8?_0x106b97['count']:_0x1dfd6d[_0xf0ef('0xb')]+_0x1dfd6d[_0xf0ef('0xd')];var _0x4bb101;if(_0x4c6381>=_0x4cae86){_0x4c6381=_0x4cae86;_0x4bb101=0xc8;}else{_0x4bb101=0xce;}_0x44bda7[_0xf0ef('0xa')](_0x4bb101);return _0x44bda7['set'](_0xf0ef('0xf'),_0xdd2b5d+'-'+_0x4c6381+'/'+_0x4cae86)[_0xf0ef('0x10')](_0x106b97);}return null;};}function saveUpdates(_0x3a7533){return function(_0x3ca17e){if(_0x3ca17e){return _0x3ca17e[_0xf0ef('0x11')](_0x3a7533)[_0xf0ef('0x12')](function(_0x54a2ea){return _0x54a2ea;});}return null;};}function removeEntity(_0x521bc6){return function(_0x1df04b){if(_0x1df04b){return _0x1df04b[_0xf0ef('0x13')]()[_0xf0ef('0x12')](function(){var _0x5c5a4b=_0x1df04b[_0xf0ef('0x14')]({'plain':!![]});var _0x89c390='SquareProjects';return db[_0xf0ef('0x15')]['destroy']({'where':{'type':_0x89c390,'resourceId':_0x5c5a4b['id']}})['then'](function(){return _0x1df04b;});})[_0xf0ef('0x12')](function(){var _0x2a2a31=new Redis(config[_0xf0ef('0x7')]);_0x2a2a31[_0xf0ef('0x16')](_0xf0ef('0x17'),JSON[_0xf0ef('0x18')]({'id':_0x1df04b['id'],'deleted':!![]}));})['then'](function(){_0x521bc6[_0xf0ef('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0e22){return function(_0x2cd8eb){if(!_0x2cd8eb){_0x4e0e22[_0xf0ef('0x19')](0x194);}return _0x2cd8eb;};}function handleError(_0x1c0a3a,_0xbaa458){_0xbaa458=_0xbaa458||0x1f4;return function(_0x2f1616){logger[_0xf0ef('0x1a')](_0x2f1616['stack']);if(_0x2f1616[_0xf0ef('0x1b')]){delete _0x2f1616[_0xf0ef('0x1b')];}_0x1c0a3a['status'](_0xbaa458)['send'](_0x2f1616);};}exports[_0xf0ef('0x1c')]=function(_0x3f1738,_0x119bb9){var _0x82449c={},_0x4cbcaf={},_0x2b34ae={'count':0x0,'rows':[]};var _0x3929b1=_['map'](db[_0xf0ef('0x1d')][_0xf0ef('0x1e')],function(_0x1c85bb){return{'name':_0x1c85bb[_0xf0ef('0x1f')],'type':_0x1c85bb[_0xf0ef('0x20')][_0xf0ef('0x21')]};});_0x4cbcaf[_0xf0ef('0x22')]=_[_0xf0ef('0x23')](_0x3929b1,_0xf0ef('0x1b'));_0x4cbcaf[_0xf0ef('0x24')]=_['keys'](_0x3f1738['query']);_0x4cbcaf[_0xf0ef('0x25')]=_[_0xf0ef('0x26')](_0x4cbcaf[_0xf0ef('0x22')],_0x4cbcaf[_0xf0ef('0x24')]);_0x82449c[_0xf0ef('0x27')]=_[_0xf0ef('0x26')](_0x4cbcaf[_0xf0ef('0x22')],qs[_0xf0ef('0x28')](_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0x28')]));_0x82449c[_0xf0ef('0x27')]=_0x82449c[_0xf0ef('0x27')][_0xf0ef('0x29')]?_0x82449c[_0xf0ef('0x27')]:_0x4cbcaf['model'];if(!_0x3f1738['query'][_0xf0ef('0x2a')](_0xf0ef('0x2b'))){_0x82449c[_0xf0ef('0xd')]=qs[_0xf0ef('0xd')](_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0xd')]);_0x82449c['offset']=qs['offset'](_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0xb')]);}_0x82449c[_0xf0ef('0x2c')]=qs['sort'](_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0x2d')]);_0x82449c['where']=qs[_0xf0ef('0x25')](_['pick'](_0x3f1738[_0xf0ef('0x24')],_0x4cbcaf[_0xf0ef('0x25')]),_0x3929b1);if(_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0x2e')]){_0x82449c[_0xf0ef('0x2f')]=_[_0xf0ef('0x30')](_0x82449c['where'],{'$or':_['map'](_0x3929b1,function(_0x4c2bbd){if(_0x4c2bbd[_0xf0ef('0x20')]!=='VIRTUAL'){var _0x25fd37={};_0x25fd37[_0x4c2bbd[_0xf0ef('0x1b')]]={'$like':'%'+_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0x2e')]+'%'};return _0x25fd37;}})});}_0x82449c=_[_0xf0ef('0x30')]({},_0x82449c,_0x3f1738[_0xf0ef('0x31')]);var _0x48f596={'where':_0x82449c[_0xf0ef('0x2f')]};return db[_0xf0ef('0x1d')][_0xf0ef('0xe')](_0x48f596)['then'](function(_0x422f00){_0x2b34ae[_0xf0ef('0xe')]=_0x422f00;if(_0x3f1738[_0xf0ef('0x24')][_0xf0ef('0x32')]){_0x82449c['include']=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x82449c);})[_0xf0ef('0x12')](function(_0x3a9675){_0x2b34ae[_0xf0ef('0x33')]=_0x3a9675;return _0x2b34ae;})[_0xf0ef('0x12')](respondWithFilteredResult(_0x119bb9,_0x82449c))[_0xf0ef('0x34')](handleError(_0x119bb9,null));};exports[_0xf0ef('0x35')]=function(_0x48969b,_0x78cb2b){var _0x5d1af={'raw':![],'where':{'id':_0x48969b[_0xf0ef('0x36')]['id']}},_0x34b542={};_0x34b542[_0xf0ef('0x22')]=_[_0xf0ef('0x37')](db['SquareProject'][_0xf0ef('0x1e')]);_0x34b542[_0xf0ef('0x24')]=_['keys'](_0x48969b[_0xf0ef('0x24')]);_0x34b542[_0xf0ef('0x25')]=_[_0xf0ef('0x26')](_0x34b542['model'],_0x34b542['query']);_0x5d1af['attributes']=_[_0xf0ef('0x26')](_0x34b542['model'],qs[_0xf0ef('0x28')](_0x48969b[_0xf0ef('0x24')][_0xf0ef('0x28')]));_0x5d1af[_0xf0ef('0x27')]=_0x5d1af[_0xf0ef('0x27')][_0xf0ef('0x29')]?_0x5d1af[_0xf0ef('0x27')]:_0x34b542[_0xf0ef('0x22')];if(_0x48969b[_0xf0ef('0x24')][_0xf0ef('0x32')]){_0x5d1af[_0xf0ef('0x38')]=[{'all':!![]}];}_0x5d1af=_[_0xf0ef('0x30')]({},_0x5d1af,_0x48969b[_0xf0ef('0x31')]);return db[_0xf0ef('0x1d')][_0xf0ef('0x39')](_0x5d1af)[_0xf0ef('0x12')](handleEntityNotFound(_0x78cb2b,null))[_0xf0ef('0x12')](respondWithResult(_0x78cb2b,null))[_0xf0ef('0x34')](handleError(_0x78cb2b,null));};exports[_0xf0ef('0x3a')]=function(_0x1741e9,_0x3d9dc8){return db['SquareProject'][_0xf0ef('0x3a')](_0x1741e9[_0xf0ef('0x3b')],{})[_0xf0ef('0x12')](function(_0x464279){var _0x41b3d2=_0x1741e9[_0xf0ef('0x3c')][_0xf0ef('0x14')]({'plain':!![]});if(!_0x41b3d2)throw new Error(_0xf0ef('0x3d'));if(_0x41b3d2[_0xf0ef('0x3e')]==='user'){var _0xfe0001=_0x464279[_0xf0ef('0x14')]({'plain':!![]});var _0x39ce00=_0xf0ef('0x3f');return db['UserProfileSection'][_0xf0ef('0x39')]({'where':{'name':_0x39ce00,'userProfileId':_0x41b3d2[_0xf0ef('0x40')]},'raw':!![]})['then'](function(_0x4a45fd){if(_0x4a45fd&&_0x4a45fd[_0xf0ef('0x41')]===0x0){return db[_0xf0ef('0x15')][_0xf0ef('0x3a')]({'name':_0xfe0001[_0xf0ef('0x1b')],'resourceId':_0xfe0001['id'],'type':_0x4a45fd[_0xf0ef('0x1b')],'sectionId':_0x4a45fd['id']},{})['then'](function(){return _0x464279;});}else{return _0x464279;}})[_0xf0ef('0x34')](function(_0x20b5e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20b5e5);throw _0x20b5e5;});}return _0x464279;})[_0xf0ef('0x12')](respondWithResult(_0x3d9dc8,0xc9))['catch'](handleError(_0x3d9dc8,null));};exports[_0xf0ef('0x11')]=function(_0x31feaa,_0x171975){if(_0x31feaa[_0xf0ef('0x3b')]['id']){delete _0x31feaa[_0xf0ef('0x3b')]['id'];}return db['SquareProject'][_0xf0ef('0x39')]({'where':{'id':_0x31feaa[_0xf0ef('0x36')]['id']}})['then'](handleEntityNotFound(_0x171975,null))[_0xf0ef('0x12')](saveUpdates(_0x31feaa[_0xf0ef('0x3b')],null))[_0xf0ef('0x12')](function(_0xb6a336){if(!_0xb6a336)return;var _0xf2e64f=_0xb6a336['get']({'plain':!![]});return _0xf2e64f;})[_0xf0ef('0x12')](function(_0x23f90f){var _0x1e19f0=new Redis(config[_0xf0ef('0x7')]);_0x1e19f0[_0xf0ef('0x16')]('agi',JSON[_0xf0ef('0x18')](_['pick'](_0x23f90f,['id',_0xf0ef('0x1b'),_0xf0ef('0x42')])));return _0x23f90f;})[_0xf0ef('0x12')](respondWithResult(_0x171975,null))['catch'](handleError(_0x171975,null));};exports[_0xf0ef('0x13')]=function(_0x37764b,_0x4138bb){return db[_0xf0ef('0x1d')][_0xf0ef('0x39')]({'where':{'id':_0x37764b[_0xf0ef('0x36')]['id']}})['then'](handleEntityNotFound(_0x4138bb,null))[_0xf0ef('0x12')](removeEntity(_0x4138bb,null))[_0xf0ef('0x34')](handleError(_0x4138bb,null));}; \ No newline at end of file +var _0xb9ba=['pick','filter','merge','options','include','SquareProject','findAll','catch','show','find','create','body','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','json','undefined','limit','count','offset','Content-Range','then','destroy','get','UserProfileResource','publish','agi','end','error','stack','name','send','index','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x55e836,_0x50b958){var _0x5d1a4b=function(_0x31f212){while(--_0x31f212){_0x55e836['push'](_0x55e836['shift']());}};_0x5d1a4b(++_0x50b958);}(_0xb9ba,0x9b));var _0xab9b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb9ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xab9b('0x0'));var Redis=require(_0xab9b('0x1'));var qs=require(_0xab9b('0x2'));var logger=require(_0xab9b('0x3'))('api');var config=require(_0xab9b('0x4'));var db=require(_0xab9b('0x5'))['db'];config[_0xab9b('0x6')]=_[_0xab9b('0x7')](config[_0xab9b('0x6')],{'host':_0xab9b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab9b('0x6')]));require(_0xab9b('0x9'))[_0xab9b('0xa')](socket);function respondWithResult(_0x260321,_0x588100){_0x588100=_0x588100||0xc8;return function(_0x20f4cb){if(_0x20f4cb){return _0x260321[_0xab9b('0xb')](_0x588100)[_0xab9b('0xc')](_0x20f4cb);}};}function respondWithFilteredResult(_0x3f2f75,_0x582859){return function(_0x25b3ef){if(_0x25b3ef){var _0x520ec6=typeof _0x582859['offset']===_0xab9b('0xd')&&typeof _0x582859[_0xab9b('0xe')]===_0xab9b('0xd');var _0x4ef11b=_0x25b3ef[_0xab9b('0xf')];var _0x4f6638=_0x520ec6?0x0:_0x582859[_0xab9b('0x10')];var _0x42b2a8=_0x520ec6?_0x25b3ef[_0xab9b('0xf')]:_0x582859[_0xab9b('0x10')]+_0x582859[_0xab9b('0xe')];var _0x41df47;if(_0x42b2a8>=_0x4ef11b){_0x42b2a8=_0x4ef11b;_0x41df47=0xc8;}else{_0x41df47=0xce;}_0x3f2f75[_0xab9b('0xb')](_0x41df47);return _0x3f2f75['set'](_0xab9b('0x11'),_0x4f6638+'-'+_0x42b2a8+'/'+_0x4ef11b)[_0xab9b('0xc')](_0x25b3ef);}return null;};}function saveUpdates(_0x342498){return function(_0x46f89d){if(_0x46f89d){return _0x46f89d['update'](_0x342498)[_0xab9b('0x12')](function(_0x3fc651){return _0x3fc651;});}return null;};}function removeEntity(_0x16d4bc){return function(_0x39ed88){if(_0x39ed88){return _0x39ed88[_0xab9b('0x13')]()[_0xab9b('0x12')](function(){var _0xb66746=_0x39ed88[_0xab9b('0x14')]({'plain':!![]});var _0x266c09='SquareProjects';return db[_0xab9b('0x15')][_0xab9b('0x13')]({'where':{'type':_0x266c09,'resourceId':_0xb66746['id']}})[_0xab9b('0x12')](function(){return _0x39ed88;});})[_0xab9b('0x12')](function(){var _0x197ecf=new Redis(config['redis']);_0x197ecf[_0xab9b('0x16')](_0xab9b('0x17'),JSON['stringify']({'id':_0x39ed88['id'],'deleted':!![]}));})[_0xab9b('0x12')](function(){_0x16d4bc[_0xab9b('0xb')](0xcc)[_0xab9b('0x18')]();});}};}function handleEntityNotFound(_0x42fad6){return function(_0x28b02d){if(!_0x28b02d){_0x42fad6['sendStatus'](0x194);}return _0x28b02d;};}function handleError(_0x5582c7,_0x18e6e4){_0x18e6e4=_0x18e6e4||0x1f4;return function(_0x215a9e){logger[_0xab9b('0x19')](_0x215a9e[_0xab9b('0x1a')]);if(_0x215a9e['name']){delete _0x215a9e[_0xab9b('0x1b')];}_0x5582c7[_0xab9b('0xb')](_0x18e6e4)[_0xab9b('0x1c')](_0x215a9e);};}exports[_0xab9b('0x1d')]=function(_0x2b3a46,_0x1773bb){var _0x3e76d5={},_0x2f5e01={},_0x1e6602={'count':0x0,'rows':[]};var _0x1d96bc=_['map'](db['SquareProject'][_0xab9b('0x1e')],function(_0x2bbb71){return{'name':_0x2bbb71[_0xab9b('0x1f')],'type':_0x2bbb71[_0xab9b('0x20')]['key']};});_0x2f5e01['model']=_['map'](_0x1d96bc,_0xab9b('0x1b'));_0x2f5e01[_0xab9b('0x21')]=_[_0xab9b('0x22')](_0x2b3a46[_0xab9b('0x21')]);_0x2f5e01['filters']=_[_0xab9b('0x23')](_0x2f5e01[_0xab9b('0x24')],_0x2f5e01[_0xab9b('0x21')]);_0x3e76d5[_0xab9b('0x25')]=_['intersection'](_0x2f5e01['model'],qs[_0xab9b('0x26')](_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x26')]));_0x3e76d5['attributes']=_0x3e76d5['attributes'][_0xab9b('0x27')]?_0x3e76d5[_0xab9b('0x25')]:_0x2f5e01[_0xab9b('0x24')];if(!_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x28')](_0xab9b('0x29'))){_0x3e76d5['limit']=qs[_0xab9b('0xe')](_0x2b3a46[_0xab9b('0x21')][_0xab9b('0xe')]);_0x3e76d5[_0xab9b('0x10')]=qs[_0xab9b('0x10')](_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x10')]);}_0x3e76d5[_0xab9b('0x2a')]=qs['sort'](_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x2b')]);_0x3e76d5[_0xab9b('0x2c')]=qs[_0xab9b('0x2d')](_[_0xab9b('0x2e')](_0x2b3a46[_0xab9b('0x21')],_0x2f5e01[_0xab9b('0x2d')]),_0x1d96bc);if(_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x2f')]){_0x3e76d5['where']=_['merge'](_0x3e76d5[_0xab9b('0x2c')],{'$or':_['map'](_0x1d96bc,function(_0x1a7547){if(_0x1a7547['type']!=='VIRTUAL'){var _0x2433aa={};_0x2433aa[_0x1a7547[_0xab9b('0x1b')]]={'$like':'%'+_0x2b3a46[_0xab9b('0x21')][_0xab9b('0x2f')]+'%'};return _0x2433aa;}})});}_0x3e76d5=_[_0xab9b('0x30')]({},_0x3e76d5,_0x2b3a46[_0xab9b('0x31')]);var _0x386191={'where':_0x3e76d5[_0xab9b('0x2c')]};return db['SquareProject']['count'](_0x386191)[_0xab9b('0x12')](function(_0x4b2cfc){_0x1e6602[_0xab9b('0xf')]=_0x4b2cfc;if(_0x2b3a46[_0xab9b('0x21')]['includeAll']){_0x3e76d5[_0xab9b('0x32')]=[{'all':!![]}];}return db[_0xab9b('0x33')][_0xab9b('0x34')](_0x3e76d5);})[_0xab9b('0x12')](function(_0x473827){_0x1e6602['rows']=_0x473827;return _0x1e6602;})['then'](respondWithFilteredResult(_0x1773bb,_0x3e76d5))[_0xab9b('0x35')](handleError(_0x1773bb,null));};exports[_0xab9b('0x36')]=function(_0x27e850,_0x386070){var _0x3e7dbe={'raw':![],'where':{'id':_0x27e850['params']['id']}},_0x2083cd={};_0x2083cd[_0xab9b('0x24')]=_['keys'](db[_0xab9b('0x33')]['rawAttributes']);_0x2083cd[_0xab9b('0x21')]=_[_0xab9b('0x22')](_0x27e850[_0xab9b('0x21')]);_0x2083cd[_0xab9b('0x2d')]=_[_0xab9b('0x23')](_0x2083cd[_0xab9b('0x24')],_0x2083cd[_0xab9b('0x21')]);_0x3e7dbe[_0xab9b('0x25')]=_[_0xab9b('0x23')](_0x2083cd[_0xab9b('0x24')],qs[_0xab9b('0x26')](_0x27e850['query'][_0xab9b('0x26')]));_0x3e7dbe[_0xab9b('0x25')]=_0x3e7dbe['attributes'][_0xab9b('0x27')]?_0x3e7dbe[_0xab9b('0x25')]:_0x2083cd[_0xab9b('0x24')];if(_0x27e850[_0xab9b('0x21')]['includeAll']){_0x3e7dbe[_0xab9b('0x32')]=[{'all':!![]}];}_0x3e7dbe=_[_0xab9b('0x30')]({},_0x3e7dbe,_0x27e850[_0xab9b('0x31')]);return db['SquareProject'][_0xab9b('0x37')](_0x3e7dbe)[_0xab9b('0x12')](handleEntityNotFound(_0x386070,null))['then'](respondWithResult(_0x386070,null))[_0xab9b('0x35')](handleError(_0x386070,null));};exports[_0xab9b('0x38')]=function(_0x234fd2,_0x43c07f){return db[_0xab9b('0x33')][_0xab9b('0x38')](_0x234fd2[_0xab9b('0x39')],{})[_0xab9b('0x12')](function(_0x31a43a){var _0x22d03e=_0x234fd2[_0xab9b('0x3a')]['get']({'plain':!![]});if(!_0x22d03e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d03e['role']===_0xab9b('0x3a')){var _0x2a524f=_0x31a43a['get']({'plain':!![]});var _0xc7e1a8=_0xab9b('0x3b');return db[_0xab9b('0x3c')][_0xab9b('0x37')]({'where':{'name':_0xc7e1a8,'userProfileId':_0x22d03e[_0xab9b('0x3d')]},'raw':!![]})['then'](function(_0x202587){if(_0x202587&&_0x202587[_0xab9b('0x3e')]===0x0){return db[_0xab9b('0x15')][_0xab9b('0x38')]({'name':_0x2a524f[_0xab9b('0x1b')],'resourceId':_0x2a524f['id'],'type':_0x202587[_0xab9b('0x1b')],'sectionId':_0x202587['id']},{})[_0xab9b('0x12')](function(){return _0x31a43a;});}else{return _0x31a43a;}})['catch'](function(_0x3311ec){logger[_0xab9b('0x19')](_0xab9b('0x3f'),_0x3311ec);throw _0x3311ec;});}return _0x31a43a;})['then'](respondWithResult(_0x43c07f,0xc9))[_0xab9b('0x35')](handleError(_0x43c07f,null));};exports[_0xab9b('0x40')]=function(_0x515c76,_0x376558){if(_0x515c76[_0xab9b('0x39')]['id']){delete _0x515c76['body']['id'];}return db[_0xab9b('0x33')][_0xab9b('0x37')]({'where':{'id':_0x515c76[_0xab9b('0x41')]['id']}})[_0xab9b('0x12')](handleEntityNotFound(_0x376558,null))[_0xab9b('0x12')](saveUpdates(_0x515c76[_0xab9b('0x39')],null))[_0xab9b('0x12')](function(_0xbd93f7){if(!_0xbd93f7)return;var _0x2cdc61=_0xbd93f7[_0xab9b('0x14')]({'plain':!![]});return _0x2cdc61;})['then'](function(_0x1d0ae5){var _0x34d0b8=new Redis(config[_0xab9b('0x6')]);_0x34d0b8['publish'](_0xab9b('0x17'),JSON[_0xab9b('0x42')](_[_0xab9b('0x2e')](_0x1d0ae5,['id',_0xab9b('0x1b'),'production'])));return _0x1d0ae5;})[_0xab9b('0x12')](respondWithResult(_0x376558,null))[_0xab9b('0x35')](handleError(_0x376558,null));};exports[_0xab9b('0x13')]=function(_0x4ee87e,_0x1396c3){return db[_0xab9b('0x33')][_0xab9b('0x37')]({'where':{'id':_0x4ee87e[_0xab9b('0x41')]['id']}})[_0xab9b('0x12')](handleEntityNotFound(_0x1396c3,null))[_0xab9b('0x12')](removeEntity(_0x1396c3,null))[_0xab9b('0x35')](handleError(_0x1396c3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9ce4b48..c17cfd1 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 _0xf54a=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xf54a,0x129));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xaf54('0x0'));var SquareProject=require(_0xaf54('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xaf54('0x2')](0x0);var events={'afterCreate':_0xaf54('0x3'),'afterUpdate':_0xaf54('0x4'),'afterDestroy':_0xaf54('0x5')};function emitEvent(_0x240ba5){return function(_0x23989c,_0x225b31,_0x33bbb9){SquareProjectEvents[_0xaf54('0x6')](_0x240ba5+':'+_0x23989c['id'],_0x23989c);SquareProjectEvents[_0xaf54('0x6')](_0x240ba5,_0x23989c);_0x33bbb9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xaf54('0x7')](e,emitEvent(event));}}module[_0xaf54('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xf96b=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xf96b,0x13d));var _0xbf96=function(_0x511d02,_0x115c59){_0x511d02=_0x511d02-0x0;var _0x3aa015=_0xf96b[_0x511d02];return _0x3aa015;};'use strict';var EventEmitter=require(_0xbf96('0x0'));var SquareProject=require(_0xbf96('0x1'))['db'][_0xbf96('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf96('0x3')](0x0);var events={'afterCreate':_0xbf96('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ace75){return function(_0x3f145b,_0x5e2f31,_0x4c6746){SquareProjectEvents[_0xbf96('0x5')](_0x1ace75+':'+_0x3f145b['id'],_0x3f145b);SquareProjectEvents[_0xbf96('0x5')](_0x1ace75,_0x3f145b);_0x4c6746(null);};}for(var e in events){if(events[_0xbf96('0x6')](e)){var event=events[e];SquareProject[_0xbf96('0x7')](e,emitEvent(event));}}module[_0xbf96('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7e1d1dc..7d2b893 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 _0xebfe=['./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xebfe,0x15e));var _0xeebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebfe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeebf('0x0'));var util=require(_0xeebf('0x1'));var logger=require(_0xeebf('0x2'))(_0xeebf('0x3'));var moment=require('moment');var BPromise=require(_0xeebf('0x4'));var rp=require(_0xeebf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeebf('0x6'));var config=require('../../config/environment');var attributes=require(_0xeebf('0x7'));module['exports']=function(_0x228c03,_0x5ae677){return _0x228c03[_0xeebf('0x8')](_0xeebf('0x9'),attributes,{'tableName':_0xeebf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55e6a4,_0x3eabb6,_0x94c206){if(_0x55e6a4[_0xeebf('0xb')](_0xeebf('0xc'))){_0x55e6a4[_0xeebf('0xd')]=moment()[_0xeebf('0xe')](_0xeebf('0xf'));}if(_0x55e6a4[_0xeebf('0xb')]('production')){_0x55e6a4[_0xeebf('0x10')]=moment()[_0xeebf('0xe')](_0xeebf('0xf'));}_0x94c206(null,_0x55e6a4);}}});}; \ No newline at end of file +var _0x4551=['bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','api'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x4551,0x16d));var _0x1455=function(_0x5122c9,_0x2a0ebb){_0x5122c9=_0x5122c9-0x0;var _0x5ec35b=_0x4551[_0x5122c9];return _0x5ec35b;};'use strict';var _=require(_0x1455('0x0'));var util=require('util');var logger=require(_0x1455('0x1'))(_0x1455('0x2'));var moment=require('moment');var BPromise=require(_0x1455('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1455('0x4'));var config=require(_0x1455('0x5'));var attributes=require(_0x1455('0x6'));module[_0x1455('0x7')]=function(_0x5b432b,_0x3dd625){return _0x5b432b['define'](_0x1455('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4881f0,_0x10b500,_0x8db05b){if(_0x4881f0[_0x1455('0x9')](_0x1455('0xa'))){_0x4881f0[_0x1455('0xb')]=moment()[_0x1455('0xc')](_0x1455('0xd'));}if(_0x4881f0[_0x1455('0x9')](_0x1455('0xe'))){_0x4881f0[_0x1455('0xf')]=moment()['format'](_0x1455('0xd'));}_0x8db05b(null,_0x4881f0);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1e44f63..3701c01 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 _0x1dd8=['SquareProject','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','GetSquareProjects'];(function(_0x269269,_0x33b06b){var _0x581190=function(_0x26fb5d){while(--_0x26fb5d){_0x269269['push'](_0x269269['shift']());}};_0x581190(++_0x33b06b);}(_0x1dd8,0x1f3));var _0x81dd=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0x1dd8[_0xe1f858];return _0x367af6;};'use strict';var _=require(_0x81dd('0x0'));var Redis=require(_0x81dd('0x1'));var db=require(_0x81dd('0x2'))['db'];var logger=require(_0x81dd('0x3'))(_0x81dd('0x4'));var config=require(_0x81dd('0x5'));config[_0x81dd('0x6')]=_[_0x81dd('0x7')](config['redis'],{'host':_0x81dd('0x8'),'port':0x18eb});var socket=require(_0x81dd('0x9'))(new Redis(config[_0x81dd('0x6')]));require('./squareProject.socket')['register'](socket);exports[_0x81dd('0xa')]=function(_0x4e7573){var _0x10e124=this;return new Promise(function(_0x16e2bf,_0x5dd1f2){return db[_0x81dd('0xb')][_0x81dd('0xc')]({'raw':_0x4e7573['options']?_0x4e7573[_0x81dd('0xd')][_0x81dd('0xe')]===undefined?!![]:![]:!![],'where':_0x4e7573[_0x81dd('0xd')]?_0x4e7573[_0x81dd('0xd')][_0x81dd('0xf')]||null:null,'attributes':_0x4e7573[_0x81dd('0xd')]?_0x4e7573[_0x81dd('0xd')][_0x81dd('0x10')]||null:null,'limit':_0x4e7573[_0x81dd('0xd')]?_0x4e7573['options'][_0x81dd('0x11')]||null:null,'include':_0x4e7573[_0x81dd('0xd')]?_0x4e7573['options']['include']?_[_0x81dd('0x12')](_0x4e7573['options'][_0x81dd('0x13')],function(_0x174efe){return{'model':db[_0x174efe['model']],'as':_0x174efe['as'],'attributes':_0x174efe[_0x81dd('0x10')],'include':_0x174efe[_0x81dd('0x13')]?_[_0x81dd('0x12')](_0x174efe[_0x81dd('0x13')],function(_0x28d3e5){return{'model':db[_0x28d3e5[_0x81dd('0x14')]],'as':_0x28d3e5['as'],'attributes':_0x28d3e5[_0x81dd('0x10')],'include':_0x28d3e5[_0x81dd('0x13')]?_[_0x81dd('0x12')](_0x28d3e5[_0x81dd('0x13')],function(_0x54c904){return{'model':db[_0x54c904[_0x81dd('0x14')]],'as':_0x54c904['as'],'attributes':_0x54c904['attributes']};}):[]};}):[]};}):[]:[]})[_0x81dd('0x15')](function(_0x20c383){logger[_0x81dd('0x16')](_0x81dd('0xa'),_0x4e7573);logger[_0x81dd('0x17')](_0x81dd('0xa'),_0x4e7573,JSON[_0x81dd('0x18')](_0x20c383));_0x16e2bf(_0x20c383);})[_0x81dd('0x19')](function(_0x133e7e){logger['error'](_0x81dd('0xa'),_0x133e7e[_0x81dd('0x1a')],_0x4e7573);_0x5dd1f2(_0x10e124[_0x81dd('0x1b')](0x1f4,_0x133e7e[_0x81dd('0x1a')]));});});};exports[_0x81dd('0x1c')]=function(_0x284292){var _0x7ca555=this;return new Promise(function(_0x3a95fb,_0x4929ae){return db[_0x81dd('0xb')][_0x81dd('0x1d')]({'raw':_0x284292[_0x81dd('0xd')]?_0x284292['options'][_0x81dd('0xe')]===undefined?!![]:![]:!![],'where':_0x284292[_0x81dd('0xd')]?_0x284292[_0x81dd('0xd')][_0x81dd('0xf')]||null:null,'attributes':_0x284292[_0x81dd('0xd')]?_0x284292['options'][_0x81dd('0x10')]||null:null,'include':_0x284292[_0x81dd('0xd')]?_0x284292['options']['include']?_[_0x81dd('0x12')](_0x284292['options'][_0x81dd('0x13')],function(_0x16b7d2){return{'model':db[_0x16b7d2[_0x81dd('0x14')]],'as':_0x16b7d2['as'],'attributes':_0x16b7d2['attributes'],'include':_0x16b7d2[_0x81dd('0x13')]?_[_0x81dd('0x12')](_0x16b7d2[_0x81dd('0x13')],function(_0x51e36f){return{'model':db[_0x51e36f[_0x81dd('0x14')]],'as':_0x51e36f['as'],'attributes':_0x51e36f[_0x81dd('0x10')],'include':_0x51e36f[_0x81dd('0x13')]?_[_0x81dd('0x12')](_0x51e36f['include'],function(_0x50df39){return{'model':db[_0x50df39['model']],'as':_0x50df39['as'],'attributes':_0x50df39[_0x81dd('0x10')]};}):[]};}):[]};}):[]:[]})[_0x81dd('0x15')](function(_0x63be1b){logger['info'](_0x81dd('0x1c'),_0x284292);logger['debug'](_0x81dd('0x1c'),_0x284292,JSON[_0x81dd('0x18')](_0x63be1b));_0x3a95fb(_0x63be1b);})[_0x81dd('0x19')](function(_0x278489){logger[_0x81dd('0x1b')](_0x81dd('0x1c'),_0x278489[_0x81dd('0x1a')],_0x284292);_0x4929ae(_0x7ca555[_0x81dd('0x1b')](0x1f4,_0x278489[_0x81dd('0x1a')]));});});}; \ No newline at end of file +var _0xb26e=['GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','include','map','model','info','debug','stringify','catch','message','error','ShowSquareProject','find','where','then','ioredis','../../mysqldb','../../config/logger','rpc','redis','register'];(function(_0x4a313e,_0x5b7ffe){var _0x34ea6e=function(_0x2d69e3){while(--_0x2d69e3){_0x4a313e['push'](_0x4a313e['shift']());}};_0x34ea6e(++_0x5b7ffe);}(_0xb26e,0xe4));var _0xeb26=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xb26e[_0x1ed116];return _0x574066;};'use strict';var _=require('lodash');var Redis=require(_0xeb26('0x0'));var db=require(_0xeb26('0x1'))['db'];var logger=require(_0xeb26('0x2'))(_0xeb26('0x3'));var config=require('../../config/environment');config[_0xeb26('0x4')]=_['defaults'](config[_0xeb26('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')[_0xeb26('0x5')](socket);exports[_0xeb26('0x6')]=function(_0x71f83a){var _0x11dd32=this;return new Promise(function(_0x58820c,_0x15311b){return db[_0xeb26('0x7')][_0xeb26('0x8')]({'raw':_0x71f83a[_0xeb26('0x9')]?_0x71f83a['options'][_0xeb26('0xa')]===undefined?!![]:![]:!![],'where':_0x71f83a[_0xeb26('0x9')]?_0x71f83a[_0xeb26('0x9')]['where']||null:null,'attributes':_0x71f83a['options']?_0x71f83a[_0xeb26('0x9')][_0xeb26('0xb')]||null:null,'limit':_0x71f83a['options']?_0x71f83a[_0xeb26('0x9')][_0xeb26('0xc')]||null:null,'include':_0x71f83a['options']?_0x71f83a[_0xeb26('0x9')][_0xeb26('0xd')]?_[_0xeb26('0xe')](_0x71f83a[_0xeb26('0x9')][_0xeb26('0xd')],function(_0x1c5648){return{'model':db[_0x1c5648['model']],'as':_0x1c5648['as'],'attributes':_0x1c5648[_0xeb26('0xb')],'include':_0x1c5648['include']?_[_0xeb26('0xe')](_0x1c5648[_0xeb26('0xd')],function(_0x4f8a62){return{'model':db[_0x4f8a62['model']],'as':_0x4f8a62['as'],'attributes':_0x4f8a62[_0xeb26('0xb')],'include':_0x4f8a62['include']?_['map'](_0x4f8a62['include'],function(_0x299ffc){return{'model':db[_0x299ffc[_0xeb26('0xf')]],'as':_0x299ffc['as'],'attributes':_0x299ffc[_0xeb26('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c4f5d){logger[_0xeb26('0x10')](_0xeb26('0x6'),_0x71f83a);logger[_0xeb26('0x11')](_0xeb26('0x6'),_0x71f83a,JSON[_0xeb26('0x12')](_0x1c4f5d));_0x58820c(_0x1c4f5d);})[_0xeb26('0x13')](function(_0x417d25){logger['error'](_0xeb26('0x6'),_0x417d25[_0xeb26('0x14')],_0x71f83a);_0x15311b(_0x11dd32[_0xeb26('0x15')](0x1f4,_0x417d25[_0xeb26('0x14')]));});});};exports[_0xeb26('0x16')]=function(_0x5ba57a){var _0x590717=this;return new Promise(function(_0x17f6de,_0x5008dc){return db[_0xeb26('0x7')][_0xeb26('0x17')]({'raw':_0x5ba57a['options']?_0x5ba57a[_0xeb26('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5ba57a[_0xeb26('0x9')]?_0x5ba57a[_0xeb26('0x9')][_0xeb26('0x18')]||null:null,'attributes':_0x5ba57a[_0xeb26('0x9')]?_0x5ba57a[_0xeb26('0x9')][_0xeb26('0xb')]||null:null,'include':_0x5ba57a[_0xeb26('0x9')]?_0x5ba57a[_0xeb26('0x9')][_0xeb26('0xd')]?_[_0xeb26('0xe')](_0x5ba57a[_0xeb26('0x9')][_0xeb26('0xd')],function(_0x170d80){return{'model':db[_0x170d80[_0xeb26('0xf')]],'as':_0x170d80['as'],'attributes':_0x170d80[_0xeb26('0xb')],'include':_0x170d80[_0xeb26('0xd')]?_[_0xeb26('0xe')](_0x170d80[_0xeb26('0xd')],function(_0x4bfdeb){return{'model':db[_0x4bfdeb[_0xeb26('0xf')]],'as':_0x4bfdeb['as'],'attributes':_0x4bfdeb[_0xeb26('0xb')],'include':_0x4bfdeb[_0xeb26('0xd')]?_[_0xeb26('0xe')](_0x4bfdeb[_0xeb26('0xd')],function(_0x2d0a09){return{'model':db[_0x2d0a09[_0xeb26('0xf')]],'as':_0x2d0a09['as'],'attributes':_0x2d0a09['attributes']};}):[]};}):[]};}):[]:[]})[_0xeb26('0x19')](function(_0x5dae5c){logger[_0xeb26('0x10')](_0xeb26('0x16'),_0x5ba57a);logger['debug'](_0xeb26('0x16'),_0x5ba57a,JSON['stringify'](_0x5dae5c));_0x17f6de(_0x5dae5c);})['catch'](function(_0x34e499){logger[_0xeb26('0x15')](_0xeb26('0x16'),_0x34e499[_0xeb26('0x14')],_0x5ba57a);_0x5008dc(_0x590717[_0xeb26('0x15')](0x1f4,_0x34e499[_0xeb26('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e7aefa4..64cf4a6 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 _0xb51c=['remove','emit','removeListener','register','./squareProject.events','save'];(function(_0x176231,_0x2097bc){var _0x18c45d=function(_0x21c517){while(--_0x21c517){_0x176231['push'](_0x176231['shift']());}};_0x18c45d(++_0x2097bc);}(_0xb51c,0x124));var _0xcb51=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb51c[_0x12d033];return _0x3b4e80;};'use strict';var SquareProjectEvents=require(_0xcb51('0x0'));var events=[_0xcb51('0x1'),_0xcb51('0x2'),'update'];function createListener(_0x33a309,_0x2c6fa2){return function(_0x156702){_0x2c6fa2[_0xcb51('0x3')](_0x33a309,_0x156702);};}function removeListener(_0x21a9bb,_0x5ccc59){return function(){SquareProjectEvents[_0xcb51('0x4')](_0x21a9bb,_0x5ccc59);};}exports[_0xcb51('0x5')]=function(_0x21eddd){for(var _0x53c8d4=0x0,_0x1a4e37=events['length'];_0x53c8d4<_0x1a4e37;_0x53c8d4++){var _0x5f58f6=events[_0x53c8d4];var _0x59cb86=createListener('squareProject:'+_0x5f58f6,_0x21eddd);SquareProjectEvents['on'](_0x5f58f6,_0x59cb86);}}; \ No newline at end of file +var _0x1b87=['removeListener','register','length','squareProject:','./squareProject.events','remove','update'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x1b87,0x131));var _0x71b8=function(_0x311a70,_0xc12dbb){_0x311a70=_0x311a70-0x0;var _0x2a4abb=_0x1b87[_0x311a70];return _0x2a4abb;};'use strict';var SquareProjectEvents=require(_0x71b8('0x0'));var events=['save',_0x71b8('0x1'),_0x71b8('0x2')];function createListener(_0x475a6b,_0x19411c){return function(_0x179da7){_0x19411c['emit'](_0x475a6b,_0x179da7);};}function removeListener(_0x4a9c56,_0x3f9af3){return function(){SquareProjectEvents[_0x71b8('0x3')](_0x4a9c56,_0x3f9af3);};}exports[_0x71b8('0x4')]=function(_0x4c0c78){for(var _0x1e30c8=0x0,_0x64a34=events[_0x71b8('0x5')];_0x1e30c8<_0x64a34;_0x1e30c8++){var _0x5ac268=events[_0x1e30c8];var _0x1cbab9=createListener(_0x71b8('0x6')+_0x5ac268,_0x4c0c78);SquareProjectEvents['on'](_0x5ac268,_0x1cbab9);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8d88c19..646e819 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x2d03a4,_0x7d77c3){var _0x122c0c=function(_0x5791ad){while(--_0x5791ad){_0x2d03a4['push'](_0x2d03a4['shift']());}};_0x122c0c(++_0x7d77c3);}(_0x7a54,0x106));var _0x47a5=function(_0x3a3a50,_0x56f66e){_0x3a3a50=_0x3a3a50-0x0;var _0x274bd=_0x7a54[_0x3a3a50];return _0x274bd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x21ea9b,_0x4f8d58){var _0x3d10a3=function(_0x275fa6){while(--_0x275fa6){_0x21ea9b['push'](_0x21ea9b['shift']());}};_0x3d10a3(++_0x4f8d58);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 7ae3282..dba0d03 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 _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x5dd1c7,_0x4660f2){var _0x474128=function(_0x5594e8){while(--_0x5594e8){_0x5dd1c7['push'](_0x5dd1c7['shift']());}};_0x474128(++_0x4660f2);}(_0xae24,0x182));var _0x4ae2=function(_0x22b1d3,_0x513b2a){_0x22b1d3=_0x22b1d3-0x0;var _0x10b162=_0xae24[_0x22b1d3];return _0x10b162;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file +var _0xabce=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'callerid':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'dnid':{'type':Sequelize[_0xeabc('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xeabc('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeabc('0x3')],'get':function(){var _0x52ede8='';var _0x3bdc29=this[_0xeabc('0x4')](_0xeabc('0x5'));if(_0x3bdc29){_0x52ede8=_0x3bdc29['substring'](_0x3bdc29[_0xeabc('0x6')]('.'));}return _0x52ede8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4d8005d..8c6f857 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 _0x1352=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','show','params','fields','includeAll','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','secrets','recording','existsSync','extname','unlink','download','message','SquareRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis'];(function(_0xfe8a00,_0xc826b4){var _0x980e11=function(_0x205f56){while(--_0x205f56){_0xfe8a00['push'](_0xfe8a00['shift']());}};_0x980e11(++_0xc826b4);}(_0x1352,0x114));var _0x2135=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x1352[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x2135('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2135('0x1'));var rp=require(_0x2135('0x2'));var moment=require(_0x2135('0x3'));var BPromise=require(_0x2135('0x4'));var Mustache=require(_0x2135('0x5'));var util=require(_0x2135('0x6'));var path=require(_0x2135('0x7'));var sox=require('sox');var csv=require(_0x2135('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2135('0x9'));var _=require(_0x2135('0xa'));var squel=require(_0x2135('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2135('0x8'));var querystring=require(_0x2135('0xc'));var Papa=require(_0x2135('0xd'));var Redis=require(_0x2135('0xe'));var authService=require(_0x2135('0xf'));var qs=require(_0x2135('0x10'));var as=require(_0x2135('0x11'));var hardwareService=require(_0x2135('0x12'));var logger=require('../../config/logger')(_0x2135('0x13'));var utils=require(_0x2135('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2135('0x15'));var db=require(_0x2135('0x16'))['db'];function respondWithStatusCode(_0x33adda,_0x6f6fbc){_0x6f6fbc=_0x6f6fbc||0xcc;return function(_0x4d43a7){if(_0x4d43a7){return _0x33adda[_0x2135('0x17')](_0x6f6fbc);}return _0x33adda[_0x2135('0x18')](_0x6f6fbc)[_0x2135('0x19')]();};}function respondWithResult(_0x3775ef,_0x4e89ba){_0x4e89ba=_0x4e89ba||0xc8;return function(_0x5771dd){if(_0x5771dd){return _0x3775ef[_0x2135('0x18')](_0x4e89ba)[_0x2135('0x1a')](_0x5771dd);}};}function respondWithFilteredResult(_0x4dbdbc,_0x3810d2){return function(_0x39ecfc){if(_0x39ecfc){var _0x56bf4e=typeof _0x3810d2[_0x2135('0x1b')]===_0x2135('0x1c')&&typeof _0x3810d2[_0x2135('0x1d')]===_0x2135('0x1c');var _0x218d90=_0x39ecfc[_0x2135('0x1e')];var _0x591e12=_0x56bf4e?0x0:_0x3810d2[_0x2135('0x1b')];var _0x5dd5ee=_0x56bf4e?_0x39ecfc[_0x2135('0x1e')]:_0x3810d2[_0x2135('0x1b')]+_0x3810d2[_0x2135('0x1d')];var _0x1fc7ce;if(_0x5dd5ee>=_0x218d90){_0x5dd5ee=_0x218d90;_0x1fc7ce=0xc8;}else{_0x1fc7ce=0xce;}_0x4dbdbc[_0x2135('0x18')](_0x1fc7ce);return _0x4dbdbc[_0x2135('0x1f')](_0x2135('0x20'),_0x591e12+'-'+_0x5dd5ee+'/'+_0x218d90)['json'](_0x39ecfc);}return null;};}function patchUpdates(_0x54eb3d){return function(_0x158047){try{jsonpatch['apply'](_0x158047,_0x54eb3d,!![]);}catch(_0x4bfeb5){return BPromise[_0x2135('0x21')](_0x4bfeb5);}return _0x158047[_0x2135('0x22')]();};}function saveUpdates(_0x3378e7,_0x4d3f33){return function(_0x3013c8){if(_0x3013c8){return _0x3013c8[_0x2135('0x23')](_0x3378e7)[_0x2135('0x24')](function(_0x1f6d42){return _0x1f6d42;});}return null;};}function removeEntity(_0x4a895a,_0x24cc14){return function(_0x4ac6fc){if(_0x4ac6fc){return _0x4ac6fc['destroy']()['then'](function(){_0x4a895a[_0x2135('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14ae2d,_0x58e2fc){return function(_0x441a54){if(!_0x441a54){_0x14ae2d[_0x2135('0x17')](0x194);}return _0x441a54;};}function handleError(_0x459255,_0x2f6fdf){_0x2f6fdf=_0x2f6fdf||0x1f4;return function(_0x24c654){logger['error'](_0x24c654['stack']);if(_0x24c654[_0x2135('0x25')]){delete _0x24c654[_0x2135('0x25')];}_0x459255[_0x2135('0x18')](_0x2f6fdf)[_0x2135('0x26')](_0x24c654);};}exports[_0x2135('0x27')]=function(_0x3c7e54,_0x220ce8){var _0x284e2b={},_0x302032={},_0x3a3e68={'count':0x0,'rows':[]};var _0x5f09a1=_[_0x2135('0x28')](db[_0x2135('0x29')][_0x2135('0x2a')],function(_0x100523){return{'name':_0x100523[_0x2135('0x2b')],'type':_0x100523[_0x2135('0x2c')][_0x2135('0x2d')]};});_0x302032['model']=_['map'](_0x5f09a1,_0x2135('0x25'));_0x302032[_0x2135('0x2e')]=_[_0x2135('0x2f')](_0x3c7e54['query']);_0x302032['filters']=_[_0x2135('0x30')](_0x302032[_0x2135('0x31')],_0x302032[_0x2135('0x2e')]);_0x284e2b['attributes']=_[_0x2135('0x30')](_0x302032[_0x2135('0x31')],qs['fields'](_0x3c7e54[_0x2135('0x2e')]['fields']));_0x284e2b[_0x2135('0x32')]=_0x284e2b[_0x2135('0x32')][_0x2135('0x33')]?_0x284e2b[_0x2135('0x32')]:_0x302032['model'];if(!_0x3c7e54[_0x2135('0x2e')][_0x2135('0x34')](_0x2135('0x35'))){_0x284e2b[_0x2135('0x1d')]=qs[_0x2135('0x1d')](_0x3c7e54[_0x2135('0x2e')][_0x2135('0x1d')]);_0x284e2b['offset']=qs['offset'](_0x3c7e54['query'][_0x2135('0x1b')]);}_0x284e2b[_0x2135('0x36')]=qs[_0x2135('0x37')](_0x3c7e54['query'][_0x2135('0x37')]);_0x284e2b['where']=qs[_0x2135('0x38')](_[_0x2135('0x39')](_0x3c7e54[_0x2135('0x2e')],_0x302032[_0x2135('0x38')]),_0x5f09a1);if(_0x3c7e54['query']['filter']){_0x284e2b['where']=_[_0x2135('0x3a')](_0x284e2b[_0x2135('0x3b')],{'$or':_[_0x2135('0x28')](_0x5f09a1,function(_0x83471d){if(_0x83471d[_0x2135('0x2c')]!==_0x2135('0x3c')){var _0xa1379c={};_0xa1379c[_0x83471d[_0x2135('0x25')]]={'$like':'%'+_0x3c7e54[_0x2135('0x2e')][_0x2135('0x3d')]+'%'};return _0xa1379c;}})});}_0x284e2b=_['merge']({},_0x284e2b,_0x3c7e54[_0x2135('0x3e')]);var _0x43632a={'where':_0x284e2b[_0x2135('0x3b')]};return db['SquareRecording'][_0x2135('0x1e')](_0x43632a)[_0x2135('0x24')](function(_0x5aa586){_0x3a3e68[_0x2135('0x1e')]=_0x5aa586;if(_0x3c7e54[_0x2135('0x2e')]['includeAll']){_0x284e2b[_0x2135('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x2135('0x40')](_0x284e2b);})[_0x2135('0x24')](function(_0x3cc306){_0x3a3e68[_0x2135('0x41')]=_0x3cc306;return _0x3a3e68;})[_0x2135('0x24')](respondWithFilteredResult(_0x220ce8,_0x284e2b))['catch'](handleError(_0x220ce8,null));};exports[_0x2135('0x42')]=function(_0x238ec8,_0x4e414d){var _0x1ee18a={'raw':!![],'where':{'id':_0x238ec8[_0x2135('0x43')]['id']}},_0x311921={};_0x311921[_0x2135('0x31')]=_[_0x2135('0x2f')](db[_0x2135('0x29')][_0x2135('0x2a')]);_0x311921[_0x2135('0x2e')]=_[_0x2135('0x2f')](_0x238ec8[_0x2135('0x2e')]);_0x311921[_0x2135('0x38')]=_['intersection'](_0x311921[_0x2135('0x31')],_0x311921[_0x2135('0x2e')]);_0x1ee18a[_0x2135('0x32')]=_[_0x2135('0x30')](_0x311921[_0x2135('0x31')],qs['fields'](_0x238ec8[_0x2135('0x2e')][_0x2135('0x44')]));_0x1ee18a['attributes']=_0x1ee18a[_0x2135('0x32')][_0x2135('0x33')]?_0x1ee18a['attributes']:_0x311921['model'];if(_0x238ec8[_0x2135('0x2e')][_0x2135('0x45')]){_0x1ee18a[_0x2135('0x3f')]=[{'all':!![]}];}_0x1ee18a=_[_0x2135('0x3a')]({},_0x1ee18a,_0x238ec8[_0x2135('0x3e')]);return db['SquareRecording'][_0x2135('0x46')](_0x1ee18a)[_0x2135('0x24')](handleEntityNotFound(_0x4e414d,null))['then'](respondWithResult(_0x4e414d,null))[_0x2135('0x47')](handleError(_0x4e414d,null));};exports[_0x2135('0x48')]=function(_0x287c40,_0x5d014c){return db[_0x2135('0x29')]['create'](_0x287c40[_0x2135('0x49')],{})[_0x2135('0x24')](respondWithResult(_0x5d014c,0xc9))['catch'](handleError(_0x5d014c,null));};exports[_0x2135('0x23')]=function(_0x1f6cf0,_0x9a66b3){if(_0x1f6cf0[_0x2135('0x49')]['id']){delete _0x1f6cf0[_0x2135('0x49')]['id'];}return db[_0x2135('0x29')][_0x2135('0x46')]({'where':{'id':_0x1f6cf0['params']['id']}})[_0x2135('0x24')](handleEntityNotFound(_0x9a66b3,null))[_0x2135('0x24')](saveUpdates(_0x1f6cf0['body'],null))['then'](respondWithResult(_0x9a66b3,null))[_0x2135('0x47')](handleError(_0x9a66b3,null));};exports['download']=function(_0x424bda,_0x17182f,_0x5e8850){var _0x7d7dca=require(_0x2135('0x4a'));var _0x2aaf12=![];var _0x2e982d={};if(_0x424bda[_0x2135('0x2e')]['type']&&_0x424bda[_0x2135('0x2e')]['type']===_0x2135('0x4b')){_0x2e982d[_0x2135('0x4b')]=_0x424bda['params']['id'];}else{_0x2e982d['id']=_0x424bda['params']['id'];}return db[_0x2135('0x29')][_0x2135('0x46')]({'where':_0x2e982d,'attributes':['id',_0x2135('0x4c'),_0x2135('0x4d')],'raw':!![]})[_0x2135('0x24')](handleEntityNotFound(_0x17182f,null))[_0x2135('0x24')](function(_0x273210){if(_0x273210){var _0x24c396=_0x273210[_0x2135('0x4c')];var _0x44476a=util[_0x2135('0x4e')](_0x2135('0x4f'),_0x24c396);if(fs['existsSync'](_0x44476a)){_0x2aaf12=!![];return _0x7d7dca['decryptFile'](_0x44476a,_0x24c396,config[_0x2135('0x50')][_0x2135('0x51')])['then'](function(){return _0x273210;});}return _0x273210;}})[_0x2135('0x24')](function(_0x5358ac){if(_0x5358ac){var _0x3f695a=_0x5358ac['savePath'];if(!fs[_0x2135('0x52')](_0x3f695a)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x5358ac['filename']){return _0x17182f['download'](_0x3f695a,_0x5358ac[_0x2135('0x4d')]+path[_0x2135('0x53')](_0x3f695a),function(){if(_0x2aaf12){fs[_0x2135('0x54')](_0x3f695a);}});}else{return _0x17182f[_0x2135('0x55')](_0x3f695a,function(_0x4c44b6){if(_0x2aaf12){fs[_0x2135('0x54')](_0x3f695a);}});}}})[_0x2135('0x47')](function(_0xc371e){if(_0xc371e[_0x2135('0x56')]===_0x2135('0x57')){_0x17182f[_0x2135('0x18')](0x194)['send'](_0x2135('0x58'));}else{return handleError(_0x17182f,null);}});};exports[_0x2135('0x59')]=function(_0x5b31a7,_0x3f87cd){return db[_0x2135('0x29')][_0x2135('0x46')]({'where':{'id':_0x5b31a7['params']['id']}})['then'](function(_0x5da5b2){if(_['isNil'](_0x5da5b2)){throw new ReferenceError(_0x2135('0x5a'));}return _0x5da5b2;})[_0x2135('0x24')](function(_0x3b757d){var _0x420f21=_0x3b757d['savePath'];logger['info'](_0x2135('0x5b'),_0x420f21);if(!_['isNil'](_0x3b757d[_0x2135('0x4c')])&&fs[_0x2135('0x52')](_0x420f21)){logger['info'](_0x2135('0x5c')+_0x420f21+_0x2135('0x5d'));fs['unlinkSync'](_0x420f21);}_0x420f21=_0x420f21+_0x2135('0x5e');if(!_[_0x2135('0x5f')](_0x3b757d[_0x2135('0x4c')])&&fs['existsSync'](_0x420f21)){logger['info'](_0x2135('0x5c')+_0x420f21+_0x2135('0x5d'));fs[_0x2135('0x60')](_0x420f21);}return _0x3b757d;})[_0x2135('0x24')](function(_0x32ddf2){if(!_0x32ddf2)throw new InternalError();return _0x32ddf2[_0x2135('0x59')]();})['then'](function(){_0x3f87cd['status'](0xcc)[_0x2135('0x19')]();})[_0x2135('0x47')](handleError(_0x3f87cd,null));}; \ No newline at end of file +var _0xde7e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','filters','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','intersection','options','find','catch','body','../../components/encryptor','uniqueid','filename','existsSync','decryptFile','secrets','savePath','Sequelize','ValidationError','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x217d81,_0x5e05ee){var _0x3672b9=function(_0x2b0f13){while(--_0x2b0f13){_0x217d81['push'](_0x217d81['shift']());}};_0x3672b9(++_0x5e05ee);}(_0xde7e,0x1cd));var _0xede7=function(_0x40459f,_0x230f98){_0x40459f=_0x40459f-0x0;var _0x319887=_0xde7e[_0x40459f];return _0x319887;};'use strict';var emlformat=require(_0xede7('0x0'));var rimraf=require(_0xede7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xede7('0x2'));var rp=require(_0xede7('0x3'));var moment=require(_0xede7('0x4'));var BPromise=require(_0xede7('0x5'));var Mustache=require(_0xede7('0x6'));var util=require(_0xede7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xede7('0x8'));var ejs=require(_0xede7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xede7('0xa'));var squel=require(_0xede7('0xb'));var crypto=require(_0xede7('0xc'));var jsforce=require(_0xede7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xede7('0x8'));var querystring=require(_0xede7('0xe'));var Papa=require(_0xede7('0xf'));var Redis=require(_0xede7('0x10'));var authService=require(_0xede7('0x11'));var qs=require(_0xede7('0x12'));var as=require(_0xede7('0x13'));var hardwareService=require(_0xede7('0x14'));var logger=require(_0xede7('0x15'))(_0xede7('0x16'));var utils=require('../../config/utils');var config=require(_0xede7('0x17'));var licenseUtil=require(_0xede7('0x18'));var db=require(_0xede7('0x19'))['db'];function respondWithStatusCode(_0x486898,_0x4fe756){_0x4fe756=_0x4fe756||0xcc;return function(_0x5eab6e){if(_0x5eab6e){return _0x486898[_0xede7('0x1a')](_0x4fe756);}return _0x486898[_0xede7('0x1b')](_0x4fe756)[_0xede7('0x1c')]();};}function respondWithResult(_0x2ce088,_0x64fadf){_0x64fadf=_0x64fadf||0xc8;return function(_0x33762e){if(_0x33762e){return _0x2ce088[_0xede7('0x1b')](_0x64fadf)[_0xede7('0x1d')](_0x33762e);}};}function respondWithFilteredResult(_0x59ddbd,_0x18ca48){return function(_0x1921e1){if(_0x1921e1){var _0x1f838f=typeof _0x18ca48[_0xede7('0x1e')]===_0xede7('0x1f')&&typeof _0x18ca48['limit']===_0xede7('0x1f');var _0x4f3a5f=_0x1921e1[_0xede7('0x20')];var _0x158437=_0x1f838f?0x0:_0x18ca48[_0xede7('0x1e')];var _0x518433=_0x1f838f?_0x1921e1[_0xede7('0x20')]:_0x18ca48[_0xede7('0x1e')]+_0x18ca48[_0xede7('0x21')];var _0x178325;if(_0x518433>=_0x4f3a5f){_0x518433=_0x4f3a5f;_0x178325=0xc8;}else{_0x178325=0xce;}_0x59ddbd['status'](_0x178325);return _0x59ddbd[_0xede7('0x22')](_0xede7('0x23'),_0x158437+'-'+_0x518433+'/'+_0x4f3a5f)['json'](_0x1921e1);}return null;};}function patchUpdates(_0x367a55){return function(_0x3ca0e9){try{jsonpatch['apply'](_0x3ca0e9,_0x367a55,!![]);}catch(_0x2ac27f){return BPromise['reject'](_0x2ac27f);}return _0x3ca0e9['save']();};}function saveUpdates(_0x4ede1f,_0x4d17ca){return function(_0x30cc8c){if(_0x30cc8c){return _0x30cc8c[_0xede7('0x24')](_0x4ede1f)['then'](function(_0x3f1861){return _0x3f1861;});}return null;};}function removeEntity(_0x650f6b,_0x21ae08){return function(_0x258883){if(_0x258883){return _0x258883[_0xede7('0x25')]()[_0xede7('0x26')](function(){_0x650f6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2bae,_0x59769c){return function(_0x211eda){if(!_0x211eda){_0x5c2bae[_0xede7('0x1a')](0x194);}return _0x211eda;};}function handleError(_0x3701f6,_0x1e486e){_0x1e486e=_0x1e486e||0x1f4;return function(_0x21de65){logger[_0xede7('0x27')](_0x21de65['stack']);if(_0x21de65['name']){delete _0x21de65[_0xede7('0x28')];}_0x3701f6[_0xede7('0x1b')](_0x1e486e)[_0xede7('0x29')](_0x21de65);};}exports[_0xede7('0x2a')]=function(_0x4ecd7e,_0x6cb7a5){var _0x518c06={},_0x7b348c={},_0x1900b0={'count':0x0,'rows':[]};var _0x5ec3fb=_[_0xede7('0x2b')](db[_0xede7('0x2c')][_0xede7('0x2d')],function(_0xc3f20a){return{'name':_0xc3f20a[_0xede7('0x2e')],'type':_0xc3f20a[_0xede7('0x2f')][_0xede7('0x30')]};});_0x7b348c['model']=_[_0xede7('0x2b')](_0x5ec3fb,'name');_0x7b348c['query']=_['keys'](_0x4ecd7e['query']);_0x7b348c[_0xede7('0x31')]=_['intersection'](_0x7b348c['model'],_0x7b348c[_0xede7('0x32')]);_0x518c06['attributes']=_['intersection'](_0x7b348c[_0xede7('0x33')],qs[_0xede7('0x34')](_0x4ecd7e[_0xede7('0x32')][_0xede7('0x34')]));_0x518c06[_0xede7('0x35')]=_0x518c06[_0xede7('0x35')][_0xede7('0x36')]?_0x518c06[_0xede7('0x35')]:_0x7b348c[_0xede7('0x33')];if(!_0x4ecd7e[_0xede7('0x32')][_0xede7('0x37')](_0xede7('0x38'))){_0x518c06[_0xede7('0x21')]=qs[_0xede7('0x21')](_0x4ecd7e[_0xede7('0x32')][_0xede7('0x21')]);_0x518c06['offset']=qs[_0xede7('0x1e')](_0x4ecd7e[_0xede7('0x32')]['offset']);}_0x518c06[_0xede7('0x39')]=qs[_0xede7('0x3a')](_0x4ecd7e[_0xede7('0x32')][_0xede7('0x3a')]);_0x518c06['where']=qs[_0xede7('0x31')](_[_0xede7('0x3b')](_0x4ecd7e[_0xede7('0x32')],_0x7b348c[_0xede7('0x31')]),_0x5ec3fb);if(_0x4ecd7e[_0xede7('0x32')][_0xede7('0x3c')]){_0x518c06[_0xede7('0x3d')]=_[_0xede7('0x3e')](_0x518c06['where'],{'$or':_['map'](_0x5ec3fb,function(_0x2625ac){if(_0x2625ac[_0xede7('0x2f')]!==_0xede7('0x3f')){var _0x5024ec={};_0x5024ec[_0x2625ac[_0xede7('0x28')]]={'$like':'%'+_0x4ecd7e[_0xede7('0x32')][_0xede7('0x3c')]+'%'};return _0x5024ec;}})});}_0x518c06=_[_0xede7('0x3e')]({},_0x518c06,_0x4ecd7e['options']);var _0x4c2165={'where':_0x518c06['where']};return db[_0xede7('0x2c')][_0xede7('0x20')](_0x4c2165)[_0xede7('0x26')](function(_0x228fc4){_0x1900b0[_0xede7('0x20')]=_0x228fc4;if(_0x4ecd7e['query'][_0xede7('0x40')]){_0x518c06[_0xede7('0x41')]=[{'all':!![]}];}return db[_0xede7('0x2c')][_0xede7('0x42')](_0x518c06);})[_0xede7('0x26')](function(_0x100a88){_0x1900b0[_0xede7('0x43')]=_0x100a88;return _0x1900b0;})[_0xede7('0x26')](respondWithFilteredResult(_0x6cb7a5,_0x518c06))['catch'](handleError(_0x6cb7a5,null));};exports['show']=function(_0x47f2ce,_0x4e36d4){var _0x209c25={'raw':!![],'where':{'id':_0x47f2ce[_0xede7('0x44')]['id']}},_0x5b55af={};_0x5b55af['model']=_['keys'](db['SquareRecording'][_0xede7('0x2d')]);_0x5b55af[_0xede7('0x32')]=_[_0xede7('0x45')](_0x47f2ce[_0xede7('0x32')]);_0x5b55af[_0xede7('0x31')]=_[_0xede7('0x46')](_0x5b55af['model'],_0x5b55af['query']);_0x209c25['attributes']=_[_0xede7('0x46')](_0x5b55af[_0xede7('0x33')],qs[_0xede7('0x34')](_0x47f2ce[_0xede7('0x32')]['fields']));_0x209c25[_0xede7('0x35')]=_0x209c25[_0xede7('0x35')][_0xede7('0x36')]?_0x209c25[_0xede7('0x35')]:_0x5b55af[_0xede7('0x33')];if(_0x47f2ce[_0xede7('0x32')][_0xede7('0x40')]){_0x209c25[_0xede7('0x41')]=[{'all':!![]}];}_0x209c25=_[_0xede7('0x3e')]({},_0x209c25,_0x47f2ce[_0xede7('0x47')]);return db['SquareRecording'][_0xede7('0x48')](_0x209c25)[_0xede7('0x26')](handleEntityNotFound(_0x4e36d4,null))['then'](respondWithResult(_0x4e36d4,null))[_0xede7('0x49')](handleError(_0x4e36d4,null));};exports['create']=function(_0x1a91d0,_0x448dd7){return db[_0xede7('0x2c')]['create'](_0x1a91d0[_0xede7('0x4a')],{})[_0xede7('0x26')](respondWithResult(_0x448dd7,0xc9))[_0xede7('0x49')](handleError(_0x448dd7,null));};exports[_0xede7('0x24')]=function(_0x5eb3e4,_0x17d52f){if(_0x5eb3e4[_0xede7('0x4a')]['id']){delete _0x5eb3e4[_0xede7('0x4a')]['id'];}return db[_0xede7('0x2c')]['find']({'where':{'id':_0x5eb3e4[_0xede7('0x44')]['id']}})['then'](handleEntityNotFound(_0x17d52f,null))[_0xede7('0x26')](saveUpdates(_0x5eb3e4['body'],null))[_0xede7('0x26')](respondWithResult(_0x17d52f,null))['catch'](handleError(_0x17d52f,null));};exports['download']=function(_0x241149,_0xccd68c,_0x3561f8){var _0x3dacae=require(_0xede7('0x4b'));var _0x2c9e5e=![];var _0xff5e9e={};if(_0x241149[_0xede7('0x32')]['type']&&_0x241149[_0xede7('0x32')][_0xede7('0x2f')]==='uniqueid'){_0xff5e9e[_0xede7('0x4c')]=_0x241149[_0xede7('0x44')]['id'];}else{_0xff5e9e['id']=_0x241149['params']['id'];}return db['SquareRecording'][_0xede7('0x48')]({'where':_0xff5e9e,'attributes':['id','savePath',_0xede7('0x4d')],'raw':!![]})[_0xede7('0x26')](handleEntityNotFound(_0xccd68c,null))['then'](function(_0x587a12){if(_0x587a12){var _0x20f338=_0x587a12['savePath'];var _0x2df1a9=util['format']('%s.cypher',_0x20f338);if(fs[_0xede7('0x4e')](_0x2df1a9)){_0x2c9e5e=!![];return _0x3dacae[_0xede7('0x4f')](_0x2df1a9,_0x20f338,config[_0xede7('0x50')]['recording'])[_0xede7('0x26')](function(){return _0x587a12;});}return _0x587a12;}})[_0xede7('0x26')](function(_0x5da12a){if(_0x5da12a){var _0x4f1709=_0x5da12a[_0xede7('0x51')];if(!fs[_0xede7('0x4e')](_0x4f1709)){throw new db[(_0xede7('0x52'))][(_0xede7('0x53'))]('SquareRecording\x20not\x20found');}if(_0x5da12a[_0xede7('0x4d')]){return _0xccd68c[_0xede7('0x54')](_0x4f1709,_0x5da12a[_0xede7('0x4d')]+path[_0xede7('0x55')](_0x4f1709),function(){if(_0x2c9e5e){fs[_0xede7('0x56')](_0x4f1709);}});}else{return _0xccd68c['download'](_0x4f1709,function(_0x48b6ae){if(_0x2c9e5e){fs['unlink'](_0x4f1709);}});}}})[_0xede7('0x49')](function(_0x13e8ae){if(_0x13e8ae[_0xede7('0x57')]==='SquareRecording\x20not\x20found'){_0xccd68c[_0xede7('0x1b')](0x194)[_0xede7('0x29')](_0xede7('0x58'));}else{return handleError(_0xccd68c,null);}});};exports[_0xede7('0x25')]=function(_0x51d30e,_0x2de0cb){return db[_0xede7('0x2c')][_0xede7('0x48')]({'where':{'id':_0x51d30e[_0xede7('0x44')]['id']}})['then'](function(_0x45a13a){if(_[_0xede7('0x59')](_0x45a13a)){throw new ReferenceError(_0xede7('0x5a'));}return _0x45a13a;})[_0xede7('0x26')](function(_0x53418d){var _0x9dad25=_0x53418d[_0xede7('0x51')];logger[_0xede7('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x9dad25);if(!_['isNil'](_0x53418d[_0xede7('0x51')])&&fs[_0xede7('0x4e')](_0x9dad25)){logger[_0xede7('0x5b')]('File:\x20\x22'+_0x9dad25+_0xede7('0x5c'));fs[_0xede7('0x5d')](_0x9dad25);}_0x9dad25=_0x9dad25+_0xede7('0x5e');if(!_['isNil'](_0x53418d['savePath'])&&fs[_0xede7('0x4e')](_0x9dad25)){logger['info'](_0xede7('0x5f')+_0x9dad25+_0xede7('0x5c'));fs['unlinkSync'](_0x9dad25);}return _0x53418d;})[_0xede7('0x26')](function(_0x829228){if(!_0x829228)throw new InternalError();return _0x829228[_0xede7('0x25')]();})[_0xede7('0x26')](function(){_0x2de0cb[_0xede7('0x1b')](0xcc)[_0xede7('0x1c')]();})[_0xede7('0x49')](handleError(_0x2de0cb,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index eb96ee3..91b9a16 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 _0x0170=['SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x0170,0x1d6));var _0x0017=function(_0x474827,_0x1927ee){_0x474827=_0x474827-0x0;var _0x499ff5=_0x0170[_0x474827];return _0x499ff5;};'use strict';var _=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var logger=require('../../config/logger')(_0x0017('0x2'));var moment=require(_0x0017('0x3'));var BPromise=require(_0x0017('0x4'));var rp=require(_0x0017('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0017('0x6'));var config=require(_0x0017('0x7'));var attributes=require(_0x0017('0x8'));module[_0x0017('0x9')]=function(_0x2eaf66,_0x321f6e){return _0x2eaf66[_0x0017('0xa')](_0x0017('0xb'),attributes,{'tableName':_0x0017('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd101=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x36f5be,_0x1d569c){_0x36f5be=_0x36f5be-0x0;var _0x44bca8=_0xd101[_0x36f5be];return _0x44bca8;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./squareRecording.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('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 bbc6839..4a43ac8 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 _0x30c9=['request\x20sent','stringify','error','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x30c9,0x106));var _0x930c=function(_0x1fc2bb,_0xea9465){_0x1fc2bb=_0x1fc2bb-0x0;var _0x15e3fe=_0x30c9[_0x1fc2bb];return _0x15e3fe;};'use strict';var _=require(_0x930c('0x0'));var util=require('util');var moment=require(_0x930c('0x1'));var BPromise=require(_0x930c('0x2'));var rs=require(_0x930c('0x3'));var fs=require('fs');var Redis=require(_0x930c('0x4'));var db=require(_0x930c('0x5'))['db'];var utils=require(_0x930c('0x6'));var logger=require(_0x930c('0x7'))(_0x930c('0x8'));var config=require(_0x930c('0x9'));var jayson=require(_0x930c('0xa'));var client=jayson[_0x930c('0xb')][_0x930c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11b4ca,_0x474895,_0x400ac2){return new BPromise(function(_0x4307f2,_0x14ee74){return client['request'](_0x11b4ca,_0x400ac2)[_0x930c('0xd')](function(_0x428276){logger[_0x930c('0xe')](_0x930c('0xf'),_0x474895,'request\x20sent');logger[_0x930c('0x10')](_0x930c('0x11'),_0x474895,_0x930c('0x12'),JSON[_0x930c('0x13')](_0x428276));if(_0x428276['error']){if(_0x428276['error']['code']===0x1f4){logger[_0x930c('0x14')](_0x930c('0xf'),_0x474895,_0x428276['error'][_0x930c('0x15')]);return _0x14ee74(_0x428276[_0x930c('0x14')][_0x930c('0x15')]);}logger[_0x930c('0x14')]('SquareRecording,\x20%s,\x20%s',_0x474895,_0x428276['error'][_0x930c('0x15')]);return _0x4307f2(_0x428276[_0x930c('0x14')][_0x930c('0x15')]);}else{logger[_0x930c('0xe')](_0x930c('0xf'),_0x474895,_0x930c('0x12'));_0x4307f2(_0x428276['result'][_0x930c('0x15')]);}})[_0x930c('0x16')](function(_0x3bd4f7){logger[_0x930c('0x14')](_0x930c('0xf'),_0x474895,_0x3bd4f7);_0x14ee74(_0x3bd4f7);});});}exports[_0x930c('0x17')]=function(_0x5ebb19){var _0x3a4545=this;return new Promise(function(_0x293bfd,_0x134cef){return db[_0x930c('0x18')]['create'](_0x5ebb19[_0x930c('0x19')],{'raw':_0x5ebb19[_0x930c('0x1a')]?_0x5ebb19[_0x930c('0x1a')][_0x930c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4e65dd){logger[_0x930c('0xe')](_0x930c('0x17'),_0x5ebb19);logger[_0x930c('0x10')]('CreateSquareRecording',_0x5ebb19,JSON[_0x930c('0x13')](_0x4e65dd));_0x293bfd(_0x4e65dd);})[_0x930c('0x16')](function(_0x6cbcd8){logger[_0x930c('0x14')](_0x930c('0x17'),_0x6cbcd8['message'],_0x5ebb19);_0x134cef(_0x3a4545['error'](0x1f4,_0x6cbcd8[_0x930c('0x15')]));});});}; \ No newline at end of file +var _0xafe8=['code','message','info','request\x20sent','result','CreateSquareRecording','create','body','then','debug','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0xafe8,0x1cd));var _0x8afe=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xafe8[_0x5ce8b9];return _0xe34be0;};'use strict';var _=require(_0x8afe('0x0'));var util=require('util');var moment=require(_0x8afe('0x1'));var BPromise=require('bluebird');var rs=require(_0x8afe('0x2'));var fs=require('fs');var Redis=require(_0x8afe('0x3'));var db=require(_0x8afe('0x4'))['db'];var utils=require(_0x8afe('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8afe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8afe('0x7')][_0x8afe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45e9f4,_0xbddb61,_0x5b42ea){return new BPromise(function(_0x20dcef,_0x4149ab){return client[_0x8afe('0x9')](_0x45e9f4,_0x5b42ea)['then'](function(_0x119ccb){logger['info'](_0x8afe('0xa'),_0xbddb61,'request\x20sent');logger['debug'](_0x8afe('0xb'),_0xbddb61,'request\x20sent',JSON[_0x8afe('0xc')](_0x119ccb));if(_0x119ccb[_0x8afe('0xd')]){if(_0x119ccb['error'][_0x8afe('0xe')]===0x1f4){logger['error'](_0x8afe('0xa'),_0xbddb61,_0x119ccb[_0x8afe('0xd')][_0x8afe('0xf')]);return _0x4149ab(_0x119ccb[_0x8afe('0xd')][_0x8afe('0xf')]);}logger[_0x8afe('0xd')](_0x8afe('0xa'),_0xbddb61,_0x119ccb[_0x8afe('0xd')][_0x8afe('0xf')]);return _0x20dcef(_0x119ccb[_0x8afe('0xd')][_0x8afe('0xf')]);}else{logger[_0x8afe('0x10')](_0x8afe('0xa'),_0xbddb61,_0x8afe('0x11'));_0x20dcef(_0x119ccb[_0x8afe('0x12')][_0x8afe('0xf')]);}})['catch'](function(_0x78e529){logger[_0x8afe('0xd')]('SquareRecording,\x20%s,\x20%s',_0xbddb61,_0x78e529);_0x4149ab(_0x78e529);});});}exports[_0x8afe('0x13')]=function(_0x2bb9d1){var _0x587184=this;return new Promise(function(_0x41c312,_0x4fae95){return db['SquareRecording'][_0x8afe('0x14')](_0x2bb9d1[_0x8afe('0x15')],{'raw':_0x2bb9d1['options']?_0x2bb9d1['options']['raw']===undefined?!![]:![]:!![]})[_0x8afe('0x16')](function(_0x2c3ec9){logger['info'](_0x8afe('0x13'),_0x2bb9d1);logger[_0x8afe('0x17')](_0x8afe('0x13'),_0x2bb9d1,JSON[_0x8afe('0xc')](_0x2c3ec9));_0x41c312(_0x2c3ec9);})[_0x8afe('0x18')](function(_0x579d1f){logger[_0x8afe('0xd')](_0x8afe('0x13'),_0x579d1f['message'],_0x2bb9d1);_0x4fae95(_0x587184[_0x8afe('0xd')](0x1f4,_0x579d1f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 148afd9..88c2186 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_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'));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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 59f50a4..3b7edb8 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 _0xf326=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x158c15,_0x250fb4){var _0x28e24c=function(_0x421ff3){while(--_0x421ff3){_0x158c15['push'](_0x158c15['shift']());}};_0x28e24c(++_0x250fb4);}(_0xf326,0xfd));var _0x6f32=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xf326[_0x4e697a];return _0x88850c;};'use strict';var Sequelize=require(_0x6f32('0x0'));module['exports']={'network':{'type':Sequelize[_0x6f32('0x1')]},'network_script':{'type':Sequelize[_0x6f32('0x1')]},'request':{'type':Sequelize[_0x6f32('0x1')]},'channel':{'type':Sequelize[_0x6f32('0x1')]},'language':{'type':Sequelize[_0x6f32('0x1')]},'type':{'type':Sequelize[_0x6f32('0x1')]},'uniqueid':{'type':Sequelize[_0x6f32('0x1')]},'version':{'type':Sequelize[_0x6f32('0x1')]},'callerid':{'type':Sequelize[_0x6f32('0x1')]},'calleridname':{'type':Sequelize[_0x6f32('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6f32('0x1')]},'callingtns':{'type':Sequelize[_0x6f32('0x1')]},'dnid':{'type':Sequelize[_0x6f32('0x1')]},'rdnis':{'type':Sequelize[_0x6f32('0x1')]},'context':{'type':Sequelize[_0x6f32('0x1')]},'extension':{'type':Sequelize[_0x6f32('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6f32('0x1')]},'accountcode':{'type':Sequelize[_0x6f32('0x1')]},'threadid':{'type':Sequelize[_0x6f32('0x1')]},'project_name':{'type':Sequelize[_0x6f32('0x1')]},'joinAt':{'type':Sequelize[_0x6f32('0x2')]},'leaveAt':{'type':Sequelize[_0x6f32('0x2')]},'bot':{'type':Sequelize[_0x6f32('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x585f=['exports','STRING','DATE','BOOLEAN'];(function(_0x540ddc,_0x58f2d0){var _0x388b96=function(_0xbd28fd){while(--_0xbd28fd){_0x540ddc['push'](_0x540ddc['shift']());}};_0x388b96(++_0x58f2d0);}(_0x585f,0x1f0));var _0xf585=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x585f[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xf585('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xf585('0x1')]},'request':{'type':Sequelize[_0xf585('0x1')]},'channel':{'type':Sequelize[_0xf585('0x1')]},'language':{'type':Sequelize[_0xf585('0x1')]},'type':{'type':Sequelize[_0xf585('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xf585('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf585('0x1')]},'callingpres':{'type':Sequelize[_0xf585('0x1')]},'callingani2':{'type':Sequelize[_0xf585('0x1')]},'callington':{'type':Sequelize[_0xf585('0x1')]},'callingtns':{'type':Sequelize[_0xf585('0x1')]},'dnid':{'type':Sequelize[_0xf585('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf585('0x1')]},'extension':{'type':Sequelize[_0xf585('0x1')]},'priority':{'type':Sequelize[_0xf585('0x1')]},'enhanced':{'type':Sequelize[_0xf585('0x1')]},'accountcode':{'type':Sequelize[_0xf585('0x1')]},'threadid':{'type':Sequelize[_0xf585('0x1')]},'project_name':{'type':Sequelize[_0xf585('0x1')]},'joinAt':{'type':Sequelize[_0xf585('0x2')]},'leaveAt':{'type':Sequelize[_0xf585('0x2')]},'bot':{'type':Sequelize[_0xf585('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5cd7a40..5e82c87 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 _0x2d7e=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','sendStatus','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2d7e,0x19a));var _0xe2d7=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x2d7e[_0x87b0ff];return _0x3bc0b2;};'use strict';var emlformat=require(_0xe2d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2d7('0x1'));var jsonpatch=require(_0xe2d7('0x2'));var rp=require('request-promise');var moment=require(_0xe2d7('0x3'));var BPromise=require(_0xe2d7('0x4'));var Mustache=require('mustache');var util=require(_0xe2d7('0x5'));var path=require(_0xe2d7('0x6'));var sox=require(_0xe2d7('0x7'));var csv=require(_0xe2d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2d7('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe2d7('0xa'));var jsforce=require(_0xe2d7('0xb'));var deskjs=require(_0xe2d7('0xc'));var toCsv=require(_0xe2d7('0x8'));var querystring=require(_0xe2d7('0xd'));var Papa=require(_0xe2d7('0xe'));var Redis=require(_0xe2d7('0xf'));var authService=require(_0xe2d7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2d7('0x11'));var logger=require(_0xe2d7('0x12'))(_0xe2d7('0x13'));var utils=require('../../config/utils');var config=require(_0xe2d7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2d7('0x15'))['db'];function respondWithStatusCode(_0x2af50c,_0x29be11){_0x29be11=_0x29be11||0xcc;return function(_0x3f08fc){if(_0x3f08fc){return _0x2af50c['sendStatus'](_0x29be11);}return _0x2af50c[_0xe2d7('0x16')](_0x29be11)['end']();};}function respondWithResult(_0x4acdac,_0x39f1da){_0x39f1da=_0x39f1da||0xc8;return function(_0x314719){if(_0x314719){return _0x4acdac[_0xe2d7('0x16')](_0x39f1da)[_0xe2d7('0x17')](_0x314719);}};}function respondWithFilteredResult(_0x50d5c0,_0x4cb0e1){return function(_0x3d5083){if(_0x3d5083){var _0x4d354f=typeof _0x4cb0e1[_0xe2d7('0x18')]===_0xe2d7('0x19')&&typeof _0x4cb0e1['limit']===_0xe2d7('0x19');var _0x496916=_0x3d5083[_0xe2d7('0x1a')];var _0x5bd3cc=_0x4d354f?0x0:_0x4cb0e1['offset'];var _0x190474=_0x4d354f?_0x3d5083['count']:_0x4cb0e1[_0xe2d7('0x18')]+_0x4cb0e1[_0xe2d7('0x1b')];var _0x35aad3;if(_0x190474>=_0x496916){_0x190474=_0x496916;_0x35aad3=0xc8;}else{_0x35aad3=0xce;}_0x50d5c0['status'](_0x35aad3);return _0x50d5c0[_0xe2d7('0x1c')]('Content-Range',_0x5bd3cc+'-'+_0x190474+'/'+_0x496916)['json'](_0x3d5083);}return null;};}function patchUpdates(_0x486532){return function(_0x3250fa){try{jsonpatch[_0xe2d7('0x1d')](_0x3250fa,_0x486532,!![]);}catch(_0x783de0){return BPromise[_0xe2d7('0x1e')](_0x783de0);}return _0x3250fa[_0xe2d7('0x1f')]();};}function saveUpdates(_0x18ba94,_0x21e89b){return function(_0x3de00e){if(_0x3de00e){return _0x3de00e[_0xe2d7('0x20')](_0x18ba94)[_0xe2d7('0x21')](function(_0x5c131e){return _0x5c131e;});}return null;};}function removeEntity(_0x48fc62,_0x30ef39){return function(_0x32a81d){if(_0x32a81d){return _0x32a81d['destroy']()[_0xe2d7('0x21')](function(){_0x48fc62[_0xe2d7('0x16')](0xcc)[_0xe2d7('0x22')]();});}};}function handleEntityNotFound(_0x3e9ba4,_0x485e65){return function(_0x3278dd){if(!_0x3278dd){_0x3e9ba4[_0xe2d7('0x23')](0x194);}return _0x3278dd;};}function handleError(_0x3df486,_0xd99a28){_0xd99a28=_0xd99a28||0x1f4;return function(_0x28c565){logger['error'](_0x28c565[_0xe2d7('0x24')]);if(_0x28c565['name']){delete _0x28c565[_0xe2d7('0x25')];}_0x3df486[_0xe2d7('0x16')](_0xd99a28)['send'](_0x28c565);};}exports[_0xe2d7('0x26')]=function(_0x359a33,_0x39391a){var _0x5d7a63={},_0x10a62f={},_0x157fa7={'count':0x0,'rows':[]};var _0x4e5960=_[_0xe2d7('0x27')](db[_0xe2d7('0x28')][_0xe2d7('0x29')],function(_0x96c595){return{'name':_0x96c595[_0xe2d7('0x2a')],'type':_0x96c595[_0xe2d7('0x2b')]['key']};});_0x10a62f[_0xe2d7('0x2c')]=_[_0xe2d7('0x27')](_0x4e5960,_0xe2d7('0x25'));_0x10a62f[_0xe2d7('0x2d')]=_[_0xe2d7('0x2e')](_0x359a33[_0xe2d7('0x2d')]);_0x10a62f['filters']=_['intersection'](_0x10a62f[_0xe2d7('0x2c')],_0x10a62f[_0xe2d7('0x2d')]);_0x5d7a63['attributes']=_[_0xe2d7('0x2f')](_0x10a62f['model'],qs[_0xe2d7('0x30')](_0x359a33['query'][_0xe2d7('0x30')]));_0x5d7a63['attributes']=_0x5d7a63[_0xe2d7('0x31')]['length']?_0x5d7a63[_0xe2d7('0x31')]:_0x10a62f[_0xe2d7('0x2c')];if(!_0x359a33['query']['hasOwnProperty'](_0xe2d7('0x32'))){_0x5d7a63[_0xe2d7('0x1b')]=qs[_0xe2d7('0x1b')](_0x359a33[_0xe2d7('0x2d')][_0xe2d7('0x1b')]);_0x5d7a63[_0xe2d7('0x18')]=qs[_0xe2d7('0x18')](_0x359a33['query'][_0xe2d7('0x18')]);}_0x5d7a63[_0xe2d7('0x33')]=qs['sort'](_0x359a33[_0xe2d7('0x2d')][_0xe2d7('0x34')]);_0x5d7a63[_0xe2d7('0x35')]=qs[_0xe2d7('0x36')](_[_0xe2d7('0x37')](_0x359a33[_0xe2d7('0x2d')],_0x10a62f[_0xe2d7('0x36')]),_0x4e5960);if(_0x359a33['query']['filter']){_0x5d7a63['where']=_[_0xe2d7('0x38')](_0x5d7a63[_0xe2d7('0x35')],{'$or':_[_0xe2d7('0x27')](_0x4e5960,function(_0x2282d1){if(_0x2282d1[_0xe2d7('0x2b')]!==_0xe2d7('0x39')){var _0x33d547={};_0x33d547[_0x2282d1[_0xe2d7('0x25')]]={'$like':'%'+_0x359a33[_0xe2d7('0x2d')]['filter']+'%'};return _0x33d547;}})});}_0x5d7a63=_['merge']({},_0x5d7a63,_0x359a33[_0xe2d7('0x3a')]);var _0x1656b0={'where':_0x5d7a63[_0xe2d7('0x35')]};return db[_0xe2d7('0x28')][_0xe2d7('0x1a')](_0x1656b0)[_0xe2d7('0x21')](function(_0x34f388){_0x157fa7[_0xe2d7('0x1a')]=_0x34f388;if(_0x359a33[_0xe2d7('0x2d')][_0xe2d7('0x3b')]){_0x5d7a63[_0xe2d7('0x3c')]=[{'all':!![]}];}return db[_0xe2d7('0x28')][_0xe2d7('0x3d')](_0x5d7a63);})[_0xe2d7('0x21')](function(_0x124561){_0x157fa7['rows']=_0x124561;return _0x157fa7;})['then'](respondWithFilteredResult(_0x39391a,_0x5d7a63))[_0xe2d7('0x3e')](handleError(_0x39391a,null));};exports[_0xe2d7('0x3f')]=function(_0x2a8d3e,_0xf6b10a){var _0x57f02a={'raw':!![],'where':{'id':_0x2a8d3e[_0xe2d7('0x40')]['id']}},_0x3f015d={};_0x3f015d[_0xe2d7('0x2c')]=_[_0xe2d7('0x2e')](db[_0xe2d7('0x28')][_0xe2d7('0x29')]);_0x3f015d[_0xe2d7('0x2d')]=_[_0xe2d7('0x2e')](_0x2a8d3e[_0xe2d7('0x2d')]);_0x3f015d[_0xe2d7('0x36')]=_[_0xe2d7('0x2f')](_0x3f015d[_0xe2d7('0x2c')],_0x3f015d['query']);_0x57f02a[_0xe2d7('0x31')]=_['intersection'](_0x3f015d[_0xe2d7('0x2c')],qs['fields'](_0x2a8d3e[_0xe2d7('0x2d')][_0xe2d7('0x30')]));_0x57f02a[_0xe2d7('0x31')]=_0x57f02a[_0xe2d7('0x31')][_0xe2d7('0x41')]?_0x57f02a[_0xe2d7('0x31')]:_0x3f015d['model'];if(_0x2a8d3e['query']['includeAll']){_0x57f02a[_0xe2d7('0x3c')]=[{'all':!![]}];}_0x57f02a=_['merge']({},_0x57f02a,_0x2a8d3e[_0xe2d7('0x3a')]);return db[_0xe2d7('0x28')][_0xe2d7('0x42')](_0x57f02a)['then'](handleEntityNotFound(_0xf6b10a,null))[_0xe2d7('0x21')](respondWithResult(_0xf6b10a,null))[_0xe2d7('0x3e')](handleError(_0xf6b10a,null));};exports[_0xe2d7('0x43')]=function(_0x243123,_0x3d8c3d){return db[_0xe2d7('0x28')][_0xe2d7('0x43')](_0x243123[_0xe2d7('0x44')],{})[_0xe2d7('0x21')](respondWithResult(_0x3d8c3d,0xc9))[_0xe2d7('0x3e')](handleError(_0x3d8c3d,null));};exports[_0xe2d7('0x20')]=function(_0x166b0f,_0x43f076){if(_0x166b0f[_0xe2d7('0x44')]['id']){delete _0x166b0f[_0xe2d7('0x44')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x166b0f[_0xe2d7('0x40')]['id']}})[_0xe2d7('0x21')](handleEntityNotFound(_0x43f076,null))[_0xe2d7('0x21')](saveUpdates(_0x166b0f[_0xe2d7('0x44')],null))[_0xe2d7('0x21')](respondWithResult(_0x43f076,null))[_0xe2d7('0x3e')](handleError(_0x43f076,null));};exports[_0xe2d7('0x45')]=function(_0x10ad92,_0x3d8cc8){return db[_0xe2d7('0x28')][_0xe2d7('0x42')]({'where':{'id':_0x10ad92['params']['id']}})[_0xe2d7('0x21')](handleEntityNotFound(_0x3d8cc8,null))[_0xe2d7('0x21')](removeEntity(_0x3d8cc8,null))[_0xe2d7('0x3e')](handleError(_0x3d8cc8,null));};exports[_0xe2d7('0x46')]=function(_0x57cd15,_0x32923d){return db[_0xe2d7('0x28')][_0xe2d7('0x46')]()[_0xe2d7('0x21')](respondWithResult(_0x32923d,null))[_0xe2d7('0x3e')](handleError(_0x32923d,null));}; \ No newline at end of file +var _0xa0bf=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','sendStatus','send','index','map','SquareReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','zip-dir'];(function(_0x23573d,_0x3bf86f){var _0xc85c6a=function(_0x4bece1){while(--_0x4bece1){_0x23573d['push'](_0x23573d['shift']());}};_0xc85c6a(++_0x3bf86f);}(_0xa0bf,0x1a8));var _0xfa0b=function(_0x5d2ab5,_0x129816){_0x5d2ab5=_0x5d2ab5-0x0;var _0x4cec78=_0xa0bf[_0x5d2ab5];return _0x4cec78;};'use strict';var emlformat=require(_0xfa0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa0b('0x1'));var jsonpatch=require(_0xfa0b('0x2'));var rp=require(_0xfa0b('0x3'));var moment=require(_0xfa0b('0x4'));var BPromise=require(_0xfa0b('0x5'));var Mustache=require(_0xfa0b('0x6'));var util=require(_0xfa0b('0x7'));var path=require('path');var sox=require(_0xfa0b('0x8'));var csv=require(_0xfa0b('0x9'));var ejs=require(_0xfa0b('0xa'));var fs=require('fs');var fs_extra=require(_0xfa0b('0xb'));var _=require(_0xfa0b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa0b('0x9'));var querystring=require(_0xfa0b('0xd'));var Papa=require(_0xfa0b('0xe'));var Redis=require(_0xfa0b('0xf'));var authService=require(_0xfa0b('0x10'));var qs=require(_0xfa0b('0x11'));var as=require(_0xfa0b('0x12'));var hardwareService=require(_0xfa0b('0x13'));var logger=require(_0xfa0b('0x14'))('api');var utils=require(_0xfa0b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfa0b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457477,_0x5b0b13){_0x5b0b13=_0x5b0b13||0xcc;return function(_0x380533){if(_0x380533){return _0x457477['sendStatus'](_0x5b0b13);}return _0x457477[_0xfa0b('0x17')](_0x5b0b13)[_0xfa0b('0x18')]();};}function respondWithResult(_0x480c35,_0x2e62db){_0x2e62db=_0x2e62db||0xc8;return function(_0xac88f1){if(_0xac88f1){return _0x480c35[_0xfa0b('0x17')](_0x2e62db)[_0xfa0b('0x19')](_0xac88f1);}};}function respondWithFilteredResult(_0x16a946,_0x8c2599){return function(_0x5bcfa0){if(_0x5bcfa0){var _0x40602a=typeof _0x8c2599[_0xfa0b('0x1a')]===_0xfa0b('0x1b')&&typeof _0x8c2599['limit']===_0xfa0b('0x1b');var _0x5c00b6=_0x5bcfa0['count'];var _0x165ca1=_0x40602a?0x0:_0x8c2599[_0xfa0b('0x1a')];var _0x3efc49=_0x40602a?_0x5bcfa0[_0xfa0b('0x1c')]:_0x8c2599[_0xfa0b('0x1a')]+_0x8c2599[_0xfa0b('0x1d')];var _0x4c7d67;if(_0x3efc49>=_0x5c00b6){_0x3efc49=_0x5c00b6;_0x4c7d67=0xc8;}else{_0x4c7d67=0xce;}_0x16a946['status'](_0x4c7d67);return _0x16a946[_0xfa0b('0x1e')]('Content-Range',_0x165ca1+'-'+_0x3efc49+'/'+_0x5c00b6)[_0xfa0b('0x19')](_0x5bcfa0);}return null;};}function patchUpdates(_0x787635){return function(_0x3b754d){try{jsonpatch['apply'](_0x3b754d,_0x787635,!![]);}catch(_0x70573a){return BPromise[_0xfa0b('0x1f')](_0x70573a);}return _0x3b754d['save']();};}function saveUpdates(_0x3f0f27,_0x2c15db){return function(_0x33d68a){if(_0x33d68a){return _0x33d68a[_0xfa0b('0x20')](_0x3f0f27)[_0xfa0b('0x21')](function(_0x261a3c){return _0x261a3c;});}return null;};}function removeEntity(_0x5973e4,_0xa71c1b){return function(_0x3be7f7){if(_0x3be7f7){return _0x3be7f7[_0xfa0b('0x22')]()['then'](function(){_0x5973e4[_0xfa0b('0x17')](0xcc)[_0xfa0b('0x18')]();});}};}function handleEntityNotFound(_0x1a6bf3,_0x4da003){return function(_0x21969d){if(!_0x21969d){_0x1a6bf3[_0xfa0b('0x23')](0x194);}return _0x21969d;};}function handleError(_0x48d261,_0xf83a0c){_0xf83a0c=_0xf83a0c||0x1f4;return function(_0xa0895e){logger['error'](_0xa0895e['stack']);if(_0xa0895e['name']){delete _0xa0895e['name'];}_0x48d261[_0xfa0b('0x17')](_0xf83a0c)[_0xfa0b('0x24')](_0xa0895e);};}exports[_0xfa0b('0x25')]=function(_0x46dc50,_0x36d788){var _0xbb55c8={},_0x2736f6={},_0x31f20f={'count':0x0,'rows':[]};var _0x3805f9=_[_0xfa0b('0x26')](db[_0xfa0b('0x27')][_0xfa0b('0x28')],function(_0x419392){return{'name':_0x419392[_0xfa0b('0x29')],'type':_0x419392['type'][_0xfa0b('0x2a')]};});_0x2736f6[_0xfa0b('0x2b')]=_[_0xfa0b('0x26')](_0x3805f9,_0xfa0b('0x2c'));_0x2736f6[_0xfa0b('0x2d')]=_[_0xfa0b('0x2e')](_0x46dc50[_0xfa0b('0x2d')]);_0x2736f6[_0xfa0b('0x2f')]=_[_0xfa0b('0x30')](_0x2736f6[_0xfa0b('0x2b')],_0x2736f6[_0xfa0b('0x2d')]);_0xbb55c8[_0xfa0b('0x31')]=_[_0xfa0b('0x30')](_0x2736f6[_0xfa0b('0x2b')],qs[_0xfa0b('0x32')](_0x46dc50['query']['fields']));_0xbb55c8['attributes']=_0xbb55c8[_0xfa0b('0x31')][_0xfa0b('0x33')]?_0xbb55c8[_0xfa0b('0x31')]:_0x2736f6[_0xfa0b('0x2b')];if(!_0x46dc50[_0xfa0b('0x2d')]['hasOwnProperty'](_0xfa0b('0x34'))){_0xbb55c8['limit']=qs['limit'](_0x46dc50[_0xfa0b('0x2d')][_0xfa0b('0x1d')]);_0xbb55c8[_0xfa0b('0x1a')]=qs['offset'](_0x46dc50[_0xfa0b('0x2d')][_0xfa0b('0x1a')]);}_0xbb55c8[_0xfa0b('0x35')]=qs['sort'](_0x46dc50['query'][_0xfa0b('0x36')]);_0xbb55c8[_0xfa0b('0x37')]=qs['filters'](_[_0xfa0b('0x38')](_0x46dc50[_0xfa0b('0x2d')],_0x2736f6[_0xfa0b('0x2f')]),_0x3805f9);if(_0x46dc50[_0xfa0b('0x2d')][_0xfa0b('0x39')]){_0xbb55c8[_0xfa0b('0x37')]=_[_0xfa0b('0x3a')](_0xbb55c8['where'],{'$or':_[_0xfa0b('0x26')](_0x3805f9,function(_0x47d7a4){if(_0x47d7a4[_0xfa0b('0x3b')]!=='VIRTUAL'){var _0x2e3cec={};_0x2e3cec[_0x47d7a4[_0xfa0b('0x2c')]]={'$like':'%'+_0x46dc50[_0xfa0b('0x2d')][_0xfa0b('0x39')]+'%'};return _0x2e3cec;}})});}_0xbb55c8=_[_0xfa0b('0x3a')]({},_0xbb55c8,_0x46dc50[_0xfa0b('0x3c')]);var _0x2ca877={'where':_0xbb55c8[_0xfa0b('0x37')]};return db[_0xfa0b('0x27')][_0xfa0b('0x1c')](_0x2ca877)[_0xfa0b('0x21')](function(_0x594566){_0x31f20f[_0xfa0b('0x1c')]=_0x594566;if(_0x46dc50[_0xfa0b('0x2d')]['includeAll']){_0xbb55c8['include']=[{'all':!![]}];}return db[_0xfa0b('0x27')][_0xfa0b('0x3d')](_0xbb55c8);})[_0xfa0b('0x21')](function(_0x1675c0){_0x31f20f[_0xfa0b('0x3e')]=_0x1675c0;return _0x31f20f;})['then'](respondWithFilteredResult(_0x36d788,_0xbb55c8))[_0xfa0b('0x3f')](handleError(_0x36d788,null));};exports[_0xfa0b('0x40')]=function(_0x24c950,_0x11b130){var _0x485157={'raw':!![],'where':{'id':_0x24c950[_0xfa0b('0x41')]['id']}},_0x1c54a3={};_0x1c54a3[_0xfa0b('0x2b')]=_['keys'](db['SquareReport'][_0xfa0b('0x28')]);_0x1c54a3[_0xfa0b('0x2d')]=_[_0xfa0b('0x2e')](_0x24c950[_0xfa0b('0x2d')]);_0x1c54a3[_0xfa0b('0x2f')]=_['intersection'](_0x1c54a3[_0xfa0b('0x2b')],_0x1c54a3[_0xfa0b('0x2d')]);_0x485157[_0xfa0b('0x31')]=_['intersection'](_0x1c54a3['model'],qs[_0xfa0b('0x32')](_0x24c950[_0xfa0b('0x2d')]['fields']));_0x485157[_0xfa0b('0x31')]=_0x485157[_0xfa0b('0x31')][_0xfa0b('0x33')]?_0x485157['attributes']:_0x1c54a3[_0xfa0b('0x2b')];if(_0x24c950[_0xfa0b('0x2d')]['includeAll']){_0x485157[_0xfa0b('0x42')]=[{'all':!![]}];}_0x485157=_[_0xfa0b('0x3a')]({},_0x485157,_0x24c950['options']);return db[_0xfa0b('0x27')]['find'](_0x485157)['then'](handleEntityNotFound(_0x11b130,null))[_0xfa0b('0x21')](respondWithResult(_0x11b130,null))[_0xfa0b('0x3f')](handleError(_0x11b130,null));};exports[_0xfa0b('0x43')]=function(_0x303c85,_0x449e16){return db['SquareReport']['create'](_0x303c85[_0xfa0b('0x44')],{})[_0xfa0b('0x21')](respondWithResult(_0x449e16,0xc9))[_0xfa0b('0x3f')](handleError(_0x449e16,null));};exports[_0xfa0b('0x20')]=function(_0x2ef3e,_0x3085d4){if(_0x2ef3e[_0xfa0b('0x44')]['id']){delete _0x2ef3e['body']['id'];}return db[_0xfa0b('0x27')][_0xfa0b('0x45')]({'where':{'id':_0x2ef3e[_0xfa0b('0x41')]['id']}})['then'](handleEntityNotFound(_0x3085d4,null))['then'](saveUpdates(_0x2ef3e[_0xfa0b('0x44')],null))[_0xfa0b('0x21')](respondWithResult(_0x3085d4,null))[_0xfa0b('0x3f')](handleError(_0x3085d4,null));};exports[_0xfa0b('0x22')]=function(_0x3e25cd,_0x1eaf70){return db[_0xfa0b('0x27')]['find']({'where':{'id':_0x3e25cd[_0xfa0b('0x41')]['id']}})[_0xfa0b('0x21')](handleEntityNotFound(_0x1eaf70,null))[_0xfa0b('0x21')](removeEntity(_0x1eaf70,null))['catch'](handleError(_0x1eaf70,null));};exports[_0xfa0b('0x46')]=function(_0x430b92,_0x1740a0){return db[_0xfa0b('0x27')][_0xfa0b('0x46')]()['then'](respondWithResult(_0x1740a0,null))['catch'](handleError(_0x1740a0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2cfbf02..a937c78 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 _0xf520=['uid_pname','project_name','leaveAt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x4d9f75,_0x57518f){var _0x572f73=function(_0x2580eb){while(--_0x2580eb){_0x4d9f75['push'](_0x4d9f75['shift']());}};_0x572f73(++_0x57518f);}(_0xf520,0x7b));var _0x0f52=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xf520[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x0f52('0x0'));var util=require('util');var logger=require(_0x0f52('0x1'))(_0x0f52('0x2'));var moment=require('moment');var BPromise=require(_0x0f52('0x3'));var rp=require(_0x0f52('0x4'));var fs=require('fs');var path=require(_0x0f52('0x5'));var rimraf=require(_0x0f52('0x6'));var config=require(_0x0f52('0x7'));var attributes=require(_0x0f52('0x8'));module[_0x0f52('0x9')]=function(_0x180902,_0x253a0e){return _0x180902[_0x0f52('0xa')](_0x0f52('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x0f52('0xc'),'fields':['uniqueid',_0x0f52('0xd')]},{'name':_0x0f52('0xe'),'fields':[_0x0f52('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa88e=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa88e,0x123));var _0xea88=function(_0x45de8b,_0x22e135){_0x45de8b=_0x45de8b-0x0;var _0x382ab4=_0xa88e[_0x45de8b];return _0x382ab4;};'use strict';var _=require(_0xea88('0x0'));var util=require(_0xea88('0x1'));var logger=require(_0xea88('0x2'))(_0xea88('0x3'));var moment=require(_0xea88('0x4'));var BPromise=require('bluebird');var rp=require(_0xea88('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea88('0x6'));var config=require(_0xea88('0x7'));var attributes=require(_0xea88('0x8'));module['exports']=function(_0x51e913,_0x290111){return _0x51e913[_0xea88('0x9')](_0xea88('0xa'),attributes,{'tableName':_0xea88('0xb'),'paranoid':![],'indexes':[{'name':_0xea88('0xc'),'fields':[_0xea88('0xd'),_0xea88('0xe')]},{'name':_0xea88('0xf'),'fields':[_0xea88('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5156a9a..ace6e04 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 _0xbb17=['raw','CreateSquareReport','catch','UpdateSquareReport','update','body','where','attributes','lodash','util','bluebird','../../mysqldb','../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','SquareReport','create','options'];(function(_0x5331bf,_0x41d2d6){var _0x211cbe=function(_0x2094e5){while(--_0x2094e5){_0x5331bf['push'](_0x5331bf['shift']());}};_0x211cbe(++_0x41d2d6);}(_0xbb17,0x131));var _0x7bb1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbb17[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var moment=require('moment');var BPromise=require(_0x7bb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bb1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7bb1('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bb1('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x204e28,_0x445274,_0x58cb1f){return new BPromise(function(_0x115fe7,_0x5ce1c9){return client[_0x7bb1('0x6')](_0x204e28,_0x58cb1f)[_0x7bb1('0x7')](function(_0x37a24f){logger[_0x7bb1('0x8')](_0x7bb1('0x9'),_0x445274,_0x7bb1('0xa'));logger[_0x7bb1('0xb')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x445274,_0x7bb1('0xa'),JSON[_0x7bb1('0xc')](_0x37a24f));if(_0x37a24f['error']){if(_0x37a24f['error']['code']===0x1f4){logger[_0x7bb1('0xd')](_0x7bb1('0x9'),_0x445274,_0x37a24f[_0x7bb1('0xd')]['message']);return _0x5ce1c9(_0x37a24f[_0x7bb1('0xd')][_0x7bb1('0xe')]);}logger[_0x7bb1('0xd')](_0x7bb1('0x9'),_0x445274,_0x37a24f[_0x7bb1('0xd')][_0x7bb1('0xe')]);return _0x115fe7(_0x37a24f[_0x7bb1('0xd')]['message']);}else{logger[_0x7bb1('0x8')](_0x7bb1('0x9'),_0x445274,_0x7bb1('0xa'));_0x115fe7(_0x37a24f[_0x7bb1('0xf')][_0x7bb1('0xe')]);}})['catch'](function(_0x3e988b){logger[_0x7bb1('0xd')](_0x7bb1('0x9'),_0x445274,_0x3e988b);_0x5ce1c9(_0x3e988b);});});}exports['CreateSquareReport']=function(_0x56053e){var _0x1a58f6=this;return new Promise(function(_0x32a097,_0x5960d1){return db[_0x7bb1('0x10')][_0x7bb1('0x11')](_0x56053e['body'],{'raw':_0x56053e[_0x7bb1('0x12')]?_0x56053e['options'][_0x7bb1('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x3d3e84){logger['info'](_0x7bb1('0x14'),_0x56053e);logger[_0x7bb1('0xb')](_0x7bb1('0x14'),_0x56053e,JSON['stringify'](_0x3d3e84));_0x32a097(_0x3d3e84);})[_0x7bb1('0x15')](function(_0x209784){logger['error']('CreateSquareReport',_0x209784[_0x7bb1('0xe')],_0x56053e);_0x5960d1(_0x1a58f6[_0x7bb1('0xd')](0x1f4,_0x209784[_0x7bb1('0xe')]));});});};exports[_0x7bb1('0x16')]=function(_0x521be2){var _0x346fa0=this;return new Promise(function(_0x4461e0,_0xa7125b){return db['SquareReport'][_0x7bb1('0x17')](_0x521be2[_0x7bb1('0x18')],{'raw':_0x521be2['options']?_0x521be2['options'][_0x7bb1('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521be2['options']?_0x521be2['options'][_0x7bb1('0x19')]||null:null,'attributes':_0x521be2[_0x7bb1('0x12')]?_0x521be2['options'][_0x7bb1('0x1a')]||null:null,'limit':_0x521be2[_0x7bb1('0x12')]?_0x521be2['options']['limit']||null:null})[_0x7bb1('0x7')](function(_0x41c3ca){logger['info'](_0x7bb1('0x16'),_0x521be2);logger[_0x7bb1('0xb')]('UpdateSquareReport',_0x521be2,JSON[_0x7bb1('0xc')](_0x41c3ca));_0x4461e0(_0x41c3ca);})[_0x7bb1('0x15')](function(_0x5048a3){logger[_0x7bb1('0xd')](_0x7bb1('0x16'),_0x5048a3[_0x7bb1('0xe')],_0x521be2);_0xa7125b(_0x346fa0['error'](0x1f4,_0x5048a3['message']));});});}; \ No newline at end of file +var _0x1f79=['client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','raw','UpdateSquareReport','SquareReport','update','options','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0x1f79,0xa9));var _0x91f7=function(_0x2fc785,_0x8c4d7e){_0x2fc785=_0x2fc785-0x0;var _0x24618e=_0x1f79[_0x2fc785];return _0x24618e;};'use strict';var _=require(_0x91f7('0x0'));var util=require(_0x91f7('0x1'));var moment=require(_0x91f7('0x2'));var BPromise=require(_0x91f7('0x3'));var rs=require(_0x91f7('0x4'));var fs=require('fs');var Redis=require(_0x91f7('0x5'));var db=require(_0x91f7('0x6'))['db'];var utils=require(_0x91f7('0x7'));var logger=require(_0x91f7('0x8'))('rpc');var config=require(_0x91f7('0x9'));var jayson=require(_0x91f7('0xa'));var client=jayson[_0x91f7('0xb')][_0x91f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45d421,_0x1aa4a1,_0x4b8ebd){return new BPromise(function(_0x5c49d4,_0x4aab7c){return client[_0x91f7('0xd')](_0x45d421,_0x4b8ebd)[_0x91f7('0xe')](function(_0x1c9533){logger[_0x91f7('0xf')]('SquareReport,\x20%s,\x20%s',_0x1aa4a1,_0x91f7('0x10'));logger[_0x91f7('0x11')](_0x91f7('0x12'),_0x1aa4a1,'request\x20sent',JSON[_0x91f7('0x13')](_0x1c9533));if(_0x1c9533[_0x91f7('0x14')]){if(_0x1c9533['error'][_0x91f7('0x15')]===0x1f4){logger[_0x91f7('0x14')](_0x91f7('0x16'),_0x1aa4a1,_0x1c9533[_0x91f7('0x14')]['message']);return _0x4aab7c(_0x1c9533[_0x91f7('0x14')]['message']);}logger[_0x91f7('0x14')](_0x91f7('0x16'),_0x1aa4a1,_0x1c9533['error'][_0x91f7('0x17')]);return _0x5c49d4(_0x1c9533[_0x91f7('0x14')]['message']);}else{logger['info'](_0x91f7('0x16'),_0x1aa4a1,_0x91f7('0x10'));_0x5c49d4(_0x1c9533[_0x91f7('0x18')]['message']);}})[_0x91f7('0x19')](function(_0x106250){logger['error'](_0x91f7('0x16'),_0x1aa4a1,_0x106250);_0x4aab7c(_0x106250);});});}exports[_0x91f7('0x1a')]=function(_0x3a4383){var _0x569915=this;return new Promise(function(_0x111960,_0x157e1d){return db['SquareReport'][_0x91f7('0x1b')](_0x3a4383[_0x91f7('0x1c')],{'raw':_0x3a4383['options']?_0x3a4383['options'][_0x91f7('0x1d')]===undefined?!![]:![]:!![]})[_0x91f7('0xe')](function(_0x154339){logger['info'](_0x91f7('0x1a'),_0x3a4383);logger[_0x91f7('0x11')](_0x91f7('0x1a'),_0x3a4383,JSON[_0x91f7('0x13')](_0x154339));_0x111960(_0x154339);})['catch'](function(_0x46a097){logger[_0x91f7('0x14')](_0x91f7('0x1a'),_0x46a097[_0x91f7('0x17')],_0x3a4383);_0x157e1d(_0x569915[_0x91f7('0x14')](0x1f4,_0x46a097[_0x91f7('0x17')]));});});};exports[_0x91f7('0x1e')]=function(_0x24af2e){var _0x4b07c5=this;return new Promise(function(_0x35db56,_0xb0be7d){return db[_0x91f7('0x1f')][_0x91f7('0x20')](_0x24af2e[_0x91f7('0x1c')],{'raw':_0x24af2e['options']?_0x24af2e[_0x91f7('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24af2e[_0x91f7('0x21')]?_0x24af2e['options']['where']||null:null,'attributes':_0x24af2e[_0x91f7('0x21')]?_0x24af2e['options'][_0x91f7('0x22')]||null:null,'limit':_0x24af2e['options']?_0x24af2e[_0x91f7('0x21')][_0x91f7('0x23')]||null:null})['then'](function(_0x4143a9){logger[_0x91f7('0xf')](_0x91f7('0x1e'),_0x24af2e);logger[_0x91f7('0x11')]('UpdateSquareReport',_0x24af2e,JSON[_0x91f7('0x13')](_0x4143a9));_0x35db56(_0x4143a9);})['catch'](function(_0x3d3fd7){logger[_0x91f7('0x14')](_0x91f7('0x1e'),_0x3d3fd7['message'],_0x24af2e);_0xb0be7d(_0x4b07c5['error'](0x1f4,_0x3d3fd7[_0x91f7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 522f674..bccdb3d 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 _0xdf34=['fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','delete','multer','path','express','Router'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0xdf34,0x1f4));var _0x4df3=function(_0x3f1912,_0x3241c2){_0x3f1912=_0x3f1912-0x0;var _0x1fc9c6=_0xdf34[_0x3f1912];return _0x1fc9c6;};'use strict';var multer=require(_0x4df3('0x0'));var util=require('util');var path=require(_0x4df3('0x1'));var timeout=require('connect-timeout');var express=require(_0x4df3('0x2'));var router=express[_0x4df3('0x3')]();var fs_extra=require(_0x4df3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4df3('0x5'));var config=require(_0x4df3('0x6'));var controller=require(_0x4df3('0x7'));router[_0x4df3('0x8')]('/',auth['isAuthenticated'](),controller[_0x4df3('0x9')]);router[_0x4df3('0x8')](_0x4df3('0xa'),auth[_0x4df3('0xb')](),controller[_0x4df3('0xc')]);router[_0x4df3('0x8')](_0x4df3('0xd'),auth[_0x4df3('0xb')](),controller[_0x4df3('0xe')]);router['post']('/',auth[_0x4df3('0xb')](),controller[_0x4df3('0xf')]);router[_0x4df3('0x10')]('/:id',auth[_0x4df3('0xb')](),controller['update']);router[_0x4df3('0x11')]('/:id',auth[_0x4df3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x87c5=['index','/describe','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x2dd99a,_0x1cb8c7){var _0x2c7340=function(_0x319fcc){while(--_0x319fcc){_0x2dd99a['push'](_0x2dd99a['shift']());}};_0x2c7340(++_0x1cb8c7);}(_0x87c5,0x149));var _0x587c=function(_0x4a14ac,_0x1f58bd){_0x4a14ac=_0x4a14ac-0x0;var _0x29f748=_0x87c5[_0x4a14ac];return _0x29f748;};'use strict';var multer=require(_0x587c('0x0'));var util=require(_0x587c('0x1'));var path=require(_0x587c('0x2'));var timeout=require(_0x587c('0x3'));var express=require(_0x587c('0x4'));var router=express[_0x587c('0x5')]();var fs_extra=require(_0x587c('0x6'));var auth=require(_0x587c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x587c('0x8'));var controller=require(_0x587c('0x9'));router[_0x587c('0xa')]('/',auth['isAuthenticated'](),controller[_0x587c('0xb')]);router['get'](_0x587c('0xc'),auth[_0x587c('0xd')](),controller['describe']);router['get'](_0x587c('0xe'),auth[_0x587c('0xd')](),controller[_0x587c('0xf')]);router['post']('/',auth[_0x587c('0xd')](),controller['create']);router['put']('/:id',auth[_0x587c('0xd')](),controller[_0x587c('0x10')]);router[_0x587c('0x11')](_0x587c('0xe'),auth[_0x587c('0xd')](),controller[_0x587c('0x12')]);module[_0x587c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b19a857..a0150cd 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 _0x8149=['STRING','TEXT','sequelize','exports'];(function(_0x26e5f8,_0x1c066){var _0x1f0c29=function(_0x1e03c1){while(--_0x1e03c1){_0x26e5f8['push'](_0x26e5f8['shift']());}};_0x1f0c29(++_0x1c066);}(_0x8149,0xe6));var _0x9814=function(_0x5c55d7,_0x9a1232){_0x5c55d7=_0x5c55d7-0x0;var _0x5e1f44=_0x8149[_0x5c55d7];return _0x5e1f44;};'use strict';var Sequelize=require(_0x9814('0x0'));module[_0x9814('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9814('0x2')]},'application':{'type':Sequelize[_0x9814('0x2')]},'data':{'type':Sequelize[_0x9814('0x3')]},'project_name':{'type':Sequelize[_0x9814('0x2')]},'callerid':{'type':Sequelize[_0x9814('0x2')]}}; \ No newline at end of file +var _0x12f0=['TEXT','sequelize','exports','STRING'];(function(_0x286212,_0x44bdf0){var _0x2afd9a=function(_0x20e472){while(--_0x20e472){_0x286212['push'](_0x286212['shift']());}};_0x2afd9a(++_0x44bdf0);}(_0x12f0,0x13d));var _0x012f=function(_0x2c1db5,_0x20b060){_0x2c1db5=_0x2c1db5-0x0;var _0x204189=_0x12f0[_0x2c1db5];return _0x204189;};'use strict';var Sequelize=require(_0x012f('0x0'));module[_0x012f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x012f('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x012f('0x3')]},'project_name':{'type':Sequelize[_0x012f('0x2')]},'callerid':{'type':Sequelize[_0x012f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f29a344..3d8d75e 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 _0xa6b8=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','create','body','find','params','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count'];(function(_0x1c39b9,_0x18874b){var _0x195a78=function(_0x410649){while(--_0x410649){_0x1c39b9['push'](_0x1c39b9['shift']());}};_0x195a78(++_0x18874b);}(_0xa6b8,0x115));var _0x8a6b=function(_0x4fbf59,_0x3b946e){_0x4fbf59=_0x4fbf59-0x0;var _0x5601ff=_0xa6b8[_0x4fbf59];return _0x5601ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a6b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a6b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a6b('0x2'));var Mustache=require(_0x8a6b('0x3'));var util=require(_0x8a6b('0x4'));var path=require(_0x8a6b('0x5'));var sox=require(_0x8a6b('0x6'));var csv=require(_0x8a6b('0x7'));var ejs=require(_0x8a6b('0x8'));var fs=require('fs');var fs_extra=require(_0x8a6b('0x9'));var _=require(_0x8a6b('0xa'));var squel=require(_0x8a6b('0xb'));var crypto=require(_0x8a6b('0xc'));var jsforce=require(_0x8a6b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8a6b('0x7'));var querystring=require(_0x8a6b('0xe'));var Papa=require(_0x8a6b('0xf'));var Redis=require(_0x8a6b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a6b('0x11'));var hardwareService=require(_0x8a6b('0x12'));var logger=require(_0x8a6b('0x13'))(_0x8a6b('0x14'));var utils=require(_0x8a6b('0x15'));var config=require(_0x8a6b('0x16'));var licenseUtil=require(_0x8a6b('0x17'));var db=require(_0x8a6b('0x18'))['db'];function respondWithStatusCode(_0xa1ebae,_0xa975fe){_0xa975fe=_0xa975fe||0xcc;return function(_0x48dca2){if(_0x48dca2){return _0xa1ebae['sendStatus'](_0xa975fe);}return _0xa1ebae[_0x8a6b('0x19')](_0xa975fe)[_0x8a6b('0x1a')]();};}function respondWithResult(_0x2204a8,_0xde2f96){_0xde2f96=_0xde2f96||0xc8;return function(_0x2b3dc1){if(_0x2b3dc1){return _0x2204a8[_0x8a6b('0x19')](_0xde2f96)['json'](_0x2b3dc1);}};}function respondWithFilteredResult(_0x1fec54,_0x46bdef){return function(_0x58f2e9){if(_0x58f2e9){var _0x4c922e=typeof _0x46bdef[_0x8a6b('0x1b')]==='undefined'&&typeof _0x46bdef[_0x8a6b('0x1c')]===_0x8a6b('0x1d');var _0x2e1758=_0x58f2e9[_0x8a6b('0x1e')];var _0x472d19=_0x4c922e?0x0:_0x46bdef[_0x8a6b('0x1b')];var _0x29821a=_0x4c922e?_0x58f2e9[_0x8a6b('0x1e')]:_0x46bdef[_0x8a6b('0x1b')]+_0x46bdef[_0x8a6b('0x1c')];var _0x31802e;if(_0x29821a>=_0x2e1758){_0x29821a=_0x2e1758;_0x31802e=0xc8;}else{_0x31802e=0xce;}_0x1fec54[_0x8a6b('0x19')](_0x31802e);return _0x1fec54[_0x8a6b('0x1f')](_0x8a6b('0x20'),_0x472d19+'-'+_0x29821a+'/'+_0x2e1758)['json'](_0x58f2e9);}return null;};}function patchUpdates(_0x284e7d){return function(_0x5ba7af){try{jsonpatch['apply'](_0x5ba7af,_0x284e7d,!![]);}catch(_0x4ef150){return BPromise[_0x8a6b('0x21')](_0x4ef150);}return _0x5ba7af[_0x8a6b('0x22')]();};}function saveUpdates(_0x10c1c3,_0x376e48){return function(_0x52d825){if(_0x52d825){return _0x52d825[_0x8a6b('0x23')](_0x10c1c3)[_0x8a6b('0x24')](function(_0x5ae18c){return _0x5ae18c;});}return null;};}function removeEntity(_0x30dc68,_0x2f6098){return function(_0x2fd805){if(_0x2fd805){return _0x2fd805[_0x8a6b('0x25')]()['then'](function(){_0x30dc68[_0x8a6b('0x19')](0xcc)[_0x8a6b('0x1a')]();});}};}function handleEntityNotFound(_0x2a8f16,_0xe560cf){return function(_0x514f49){if(!_0x514f49){_0x2a8f16['sendStatus'](0x194);}return _0x514f49;};}function handleError(_0x25bfcd,_0x4391cc){_0x4391cc=_0x4391cc||0x1f4;return function(_0x25b956){logger[_0x8a6b('0x26')](_0x25b956[_0x8a6b('0x27')]);if(_0x25b956[_0x8a6b('0x28')]){delete _0x25b956[_0x8a6b('0x28')];}_0x25bfcd[_0x8a6b('0x19')](_0x4391cc)[_0x8a6b('0x29')](_0x25b956);};}exports[_0x8a6b('0x2a')]=function(_0x5b02ee,_0x1d9d7b){var _0x3c21eb={},_0x10d480={},_0x3727cb={'count':0x0,'rows':[]};var _0x1b99cd=_['map'](db[_0x8a6b('0x2b')][_0x8a6b('0x2c')],function(_0x317bef){return{'name':_0x317bef[_0x8a6b('0x2d')],'type':_0x317bef['type'][_0x8a6b('0x2e')]};});_0x10d480[_0x8a6b('0x2f')]=_[_0x8a6b('0x30')](_0x1b99cd,'name');_0x10d480[_0x8a6b('0x31')]=_['keys'](_0x5b02ee['query']);_0x10d480[_0x8a6b('0x32')]=_[_0x8a6b('0x33')](_0x10d480['model'],_0x10d480['query']);_0x3c21eb[_0x8a6b('0x34')]=_['intersection'](_0x10d480[_0x8a6b('0x2f')],qs[_0x8a6b('0x35')](_0x5b02ee['query'][_0x8a6b('0x35')]));_0x3c21eb['attributes']=_0x3c21eb[_0x8a6b('0x34')]['length']?_0x3c21eb[_0x8a6b('0x34')]:_0x10d480[_0x8a6b('0x2f')];if(!_0x5b02ee['query'][_0x8a6b('0x36')](_0x8a6b('0x37'))){_0x3c21eb[_0x8a6b('0x1c')]=qs[_0x8a6b('0x1c')](_0x5b02ee[_0x8a6b('0x31')][_0x8a6b('0x1c')]);_0x3c21eb[_0x8a6b('0x1b')]=qs[_0x8a6b('0x1b')](_0x5b02ee[_0x8a6b('0x31')][_0x8a6b('0x1b')]);}_0x3c21eb[_0x8a6b('0x38')]=qs[_0x8a6b('0x39')](_0x5b02ee[_0x8a6b('0x31')][_0x8a6b('0x39')]);_0x3c21eb[_0x8a6b('0x3a')]=qs[_0x8a6b('0x32')](_[_0x8a6b('0x3b')](_0x5b02ee[_0x8a6b('0x31')],_0x10d480[_0x8a6b('0x32')]),_0x1b99cd);if(_0x5b02ee[_0x8a6b('0x31')][_0x8a6b('0x3c')]){_0x3c21eb[_0x8a6b('0x3a')]=_[_0x8a6b('0x3d')](_0x3c21eb[_0x8a6b('0x3a')],{'$or':_[_0x8a6b('0x30')](_0x1b99cd,function(_0x2c6057){if(_0x2c6057[_0x8a6b('0x3e')]!==_0x8a6b('0x3f')){var _0x5b0504={};_0x5b0504[_0x2c6057[_0x8a6b('0x28')]]={'$like':'%'+_0x5b02ee['query'][_0x8a6b('0x3c')]+'%'};return _0x5b0504;}})});}_0x3c21eb=_['merge']({},_0x3c21eb,_0x5b02ee[_0x8a6b('0x40')]);var _0x4c8cbe={'where':_0x3c21eb[_0x8a6b('0x3a')]};return db[_0x8a6b('0x2b')][_0x8a6b('0x1e')](_0x4c8cbe)['then'](function(_0x336f68){_0x3727cb[_0x8a6b('0x1e')]=_0x336f68;if(_0x5b02ee[_0x8a6b('0x31')]['includeAll']){_0x3c21eb[_0x8a6b('0x41')]=[{'all':!![]}];}return db[_0x8a6b('0x2b')][_0x8a6b('0x42')](_0x3c21eb);})[_0x8a6b('0x24')](function(_0x13f3b4){_0x3727cb[_0x8a6b('0x43')]=_0x13f3b4;return _0x3727cb;})[_0x8a6b('0x24')](respondWithFilteredResult(_0x1d9d7b,_0x3c21eb))[_0x8a6b('0x44')](handleError(_0x1d9d7b,null));};exports[_0x8a6b('0x45')]=function(_0x4f1933,_0x22d2b5){var _0xe9cc4d={'raw':!![],'where':{'id':_0x4f1933['params']['id']}},_0x329cee={};_0x329cee[_0x8a6b('0x2f')]=_[_0x8a6b('0x46')](db[_0x8a6b('0x2b')]['rawAttributes']);_0x329cee[_0x8a6b('0x31')]=_[_0x8a6b('0x46')](_0x4f1933['query']);_0x329cee[_0x8a6b('0x32')]=_['intersection'](_0x329cee['model'],_0x329cee['query']);_0xe9cc4d[_0x8a6b('0x34')]=_[_0x8a6b('0x33')](_0x329cee[_0x8a6b('0x2f')],qs[_0x8a6b('0x35')](_0x4f1933[_0x8a6b('0x31')][_0x8a6b('0x35')]));_0xe9cc4d['attributes']=_0xe9cc4d[_0x8a6b('0x34')]['length']?_0xe9cc4d['attributes']:_0x329cee[_0x8a6b('0x2f')];if(_0x4f1933[_0x8a6b('0x31')][_0x8a6b('0x47')]){_0xe9cc4d[_0x8a6b('0x41')]=[{'all':!![]}];}_0xe9cc4d=_[_0x8a6b('0x3d')]({},_0xe9cc4d,_0x4f1933[_0x8a6b('0x40')]);return db[_0x8a6b('0x2b')]['find'](_0xe9cc4d)[_0x8a6b('0x24')](handleEntityNotFound(_0x22d2b5,null))[_0x8a6b('0x24')](respondWithResult(_0x22d2b5,null))[_0x8a6b('0x44')](handleError(_0x22d2b5,null));};exports[_0x8a6b('0x48')]=function(_0x63dd25,_0x4d93f3){return db['SquareDetailsReport'][_0x8a6b('0x48')](_0x63dd25[_0x8a6b('0x49')],{})[_0x8a6b('0x24')](respondWithResult(_0x4d93f3,0xc9))[_0x8a6b('0x44')](handleError(_0x4d93f3,null));};exports[_0x8a6b('0x23')]=function(_0x10d9d3,_0x417eb1){if(_0x10d9d3[_0x8a6b('0x49')]['id']){delete _0x10d9d3[_0x8a6b('0x49')]['id'];}return db['SquareDetailsReport'][_0x8a6b('0x4a')]({'where':{'id':_0x10d9d3[_0x8a6b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x417eb1,null))[_0x8a6b('0x24')](saveUpdates(_0x10d9d3[_0x8a6b('0x49')],null))[_0x8a6b('0x24')](respondWithResult(_0x417eb1,null))[_0x8a6b('0x44')](handleError(_0x417eb1,null));};exports['destroy']=function(_0x5f1b34,_0x507655){return db[_0x8a6b('0x2b')]['find']({'where':{'id':_0x5f1b34[_0x8a6b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x507655,null))[_0x8a6b('0x24')](removeEntity(_0x507655,null))[_0x8a6b('0x44')](handleError(_0x507655,null));};exports[_0x8a6b('0x4c')]=function(_0x40577f,_0x2e589d){return db[_0x8a6b('0x2b')]['describe']()[_0x8a6b('0x24')](respondWithResult(_0x2e589d,null))[_0x8a6b('0x44')](handleError(_0x2e589d,null));}; \ No newline at end of file +var _0x6463=['type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName'];(function(_0x2300ea,_0x556523){var _0x47f2b2=function(_0x3d1fe2){while(--_0x3d1fe2){_0x2300ea['push'](_0x2300ea['shift']());}};_0x47f2b2(++_0x556523);}(_0x6463,0xe9));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3646('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3646('0x1'));var rp=require(_0x3646('0x2'));var moment=require(_0x3646('0x3'));var BPromise=require(_0x3646('0x4'));var Mustache=require(_0x3646('0x5'));var util=require('util');var path=require(_0x3646('0x6'));var sox=require(_0x3646('0x7'));var csv=require(_0x3646('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3646('0x9'));var squel=require(_0x3646('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3646('0xb'));var toCsv=require(_0x3646('0x8'));var querystring=require(_0x3646('0xc'));var Papa=require(_0x3646('0xd'));var Redis=require('ioredis');var authService=require(_0x3646('0xe'));var qs=require(_0x3646('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3646('0x10'))(_0x3646('0x11'));var utils=require(_0x3646('0x12'));var config=require(_0x3646('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46615c,_0x1ac82f){_0x1ac82f=_0x1ac82f||0xcc;return function(_0x15e5ab){if(_0x15e5ab){return _0x46615c[_0x3646('0x14')](_0x1ac82f);}return _0x46615c[_0x3646('0x15')](_0x1ac82f)[_0x3646('0x16')]();};}function respondWithResult(_0xc1b132,_0x3e5d82){_0x3e5d82=_0x3e5d82||0xc8;return function(_0x11d11d){if(_0x11d11d){return _0xc1b132[_0x3646('0x15')](_0x3e5d82)['json'](_0x11d11d);}};}function respondWithFilteredResult(_0x1736cb,_0x3eda11){return function(_0x325a88){if(_0x325a88){var _0x4527a7=typeof _0x3eda11[_0x3646('0x17')]===_0x3646('0x18')&&typeof _0x3eda11[_0x3646('0x19')]===_0x3646('0x18');var _0x3594fb=_0x325a88[_0x3646('0x1a')];var _0x521a67=_0x4527a7?0x0:_0x3eda11[_0x3646('0x17')];var _0x4a5e99=_0x4527a7?_0x325a88[_0x3646('0x1a')]:_0x3eda11['offset']+_0x3eda11[_0x3646('0x19')];var _0x4d2c61;if(_0x4a5e99>=_0x3594fb){_0x4a5e99=_0x3594fb;_0x4d2c61=0xc8;}else{_0x4d2c61=0xce;}_0x1736cb['status'](_0x4d2c61);return _0x1736cb[_0x3646('0x1b')](_0x3646('0x1c'),_0x521a67+'-'+_0x4a5e99+'/'+_0x3594fb)['json'](_0x325a88);}return null;};}function patchUpdates(_0x54d78f){return function(_0x48298b){try{jsonpatch['apply'](_0x48298b,_0x54d78f,!![]);}catch(_0x1197fe){return BPromise['reject'](_0x1197fe);}return _0x48298b[_0x3646('0x1d')]();};}function saveUpdates(_0x455d17,_0x55729c){return function(_0x1d3ad7){if(_0x1d3ad7){return _0x1d3ad7[_0x3646('0x1e')](_0x455d17)[_0x3646('0x1f')](function(_0x5e2f37){return _0x5e2f37;});}return null;};}function removeEntity(_0x24d6dd,_0xda8375){return function(_0x349124){if(_0x349124){return _0x349124['destroy']()[_0x3646('0x1f')](function(){_0x24d6dd[_0x3646('0x15')](0xcc)[_0x3646('0x16')]();});}};}function handleEntityNotFound(_0x27aa97,_0x480397){return function(_0x29d7d1){if(!_0x29d7d1){_0x27aa97['sendStatus'](0x194);}return _0x29d7d1;};}function handleError(_0x57bc0c,_0xbb879c){_0xbb879c=_0xbb879c||0x1f4;return function(_0x33ee68){logger['error'](_0x33ee68[_0x3646('0x20')]);if(_0x33ee68[_0x3646('0x21')]){delete _0x33ee68[_0x3646('0x21')];}_0x57bc0c[_0x3646('0x15')](_0xbb879c)['send'](_0x33ee68);};}exports[_0x3646('0x22')]=function(_0x4f20c3,_0x3154de){var _0x50f4ca={},_0x184e5b={},_0x5c9486={'count':0x0,'rows':[]};var _0x44a42c=_[_0x3646('0x23')](db[_0x3646('0x24')][_0x3646('0x25')],function(_0x7b8bd3){return{'name':_0x7b8bd3[_0x3646('0x26')],'type':_0x7b8bd3[_0x3646('0x27')][_0x3646('0x28')]};});_0x184e5b[_0x3646('0x29')]=_['map'](_0x44a42c,_0x3646('0x21'));_0x184e5b['query']=_[_0x3646('0x2a')](_0x4f20c3[_0x3646('0x2b')]);_0x184e5b[_0x3646('0x2c')]=_[_0x3646('0x2d')](_0x184e5b[_0x3646('0x29')],_0x184e5b[_0x3646('0x2b')]);_0x50f4ca['attributes']=_[_0x3646('0x2d')](_0x184e5b[_0x3646('0x29')],qs[_0x3646('0x2e')](_0x4f20c3[_0x3646('0x2b')][_0x3646('0x2e')]));_0x50f4ca[_0x3646('0x2f')]=_0x50f4ca[_0x3646('0x2f')]['length']?_0x50f4ca[_0x3646('0x2f')]:_0x184e5b[_0x3646('0x29')];if(!_0x4f20c3[_0x3646('0x2b')]['hasOwnProperty'](_0x3646('0x30'))){_0x50f4ca[_0x3646('0x19')]=qs[_0x3646('0x19')](_0x4f20c3[_0x3646('0x2b')][_0x3646('0x19')]);_0x50f4ca[_0x3646('0x17')]=qs['offset'](_0x4f20c3[_0x3646('0x2b')][_0x3646('0x17')]);}_0x50f4ca['order']=qs[_0x3646('0x31')](_0x4f20c3['query']['sort']);_0x50f4ca[_0x3646('0x32')]=qs[_0x3646('0x2c')](_[_0x3646('0x33')](_0x4f20c3['query'],_0x184e5b[_0x3646('0x2c')]),_0x44a42c);if(_0x4f20c3[_0x3646('0x2b')][_0x3646('0x34')]){_0x50f4ca[_0x3646('0x32')]=_[_0x3646('0x35')](_0x50f4ca['where'],{'$or':_[_0x3646('0x23')](_0x44a42c,function(_0x320ccb){if(_0x320ccb[_0x3646('0x27')]!==_0x3646('0x36')){var _0x4eca9f={};_0x4eca9f[_0x320ccb[_0x3646('0x21')]]={'$like':'%'+_0x4f20c3[_0x3646('0x2b')][_0x3646('0x34')]+'%'};return _0x4eca9f;}})});}_0x50f4ca=_['merge']({},_0x50f4ca,_0x4f20c3['options']);var _0x18f03c={'where':_0x50f4ca['where']};return db[_0x3646('0x24')]['count'](_0x18f03c)[_0x3646('0x1f')](function(_0x189a9b){_0x5c9486['count']=_0x189a9b;if(_0x4f20c3[_0x3646('0x2b')][_0x3646('0x37')]){_0x50f4ca[_0x3646('0x38')]=[{'all':!![]}];}return db[_0x3646('0x24')][_0x3646('0x39')](_0x50f4ca);})[_0x3646('0x1f')](function(_0x402453){_0x5c9486[_0x3646('0x3a')]=_0x402453;return _0x5c9486;})[_0x3646('0x1f')](respondWithFilteredResult(_0x3154de,_0x50f4ca))[_0x3646('0x3b')](handleError(_0x3154de,null));};exports[_0x3646('0x3c')]=function(_0x28d949,_0x508cf8){var _0x100f48={'raw':!![],'where':{'id':_0x28d949[_0x3646('0x3d')]['id']}},_0x3b25aa={};_0x3b25aa[_0x3646('0x29')]=_['keys'](db[_0x3646('0x24')][_0x3646('0x25')]);_0x3b25aa[_0x3646('0x2b')]=_[_0x3646('0x2a')](_0x28d949[_0x3646('0x2b')]);_0x3b25aa[_0x3646('0x2c')]=_[_0x3646('0x2d')](_0x3b25aa[_0x3646('0x29')],_0x3b25aa[_0x3646('0x2b')]);_0x100f48[_0x3646('0x2f')]=_[_0x3646('0x2d')](_0x3b25aa[_0x3646('0x29')],qs[_0x3646('0x2e')](_0x28d949[_0x3646('0x2b')][_0x3646('0x2e')]));_0x100f48[_0x3646('0x2f')]=_0x100f48[_0x3646('0x2f')][_0x3646('0x3e')]?_0x100f48[_0x3646('0x2f')]:_0x3b25aa['model'];if(_0x28d949[_0x3646('0x2b')]['includeAll']){_0x100f48[_0x3646('0x38')]=[{'all':!![]}];}_0x100f48=_[_0x3646('0x35')]({},_0x100f48,_0x28d949['options']);return db[_0x3646('0x24')][_0x3646('0x3f')](_0x100f48)[_0x3646('0x1f')](handleEntityNotFound(_0x508cf8,null))[_0x3646('0x1f')](respondWithResult(_0x508cf8,null))[_0x3646('0x3b')](handleError(_0x508cf8,null));};exports[_0x3646('0x40')]=function(_0x5bda63,_0x37d857){return db['SquareDetailsReport'][_0x3646('0x40')](_0x5bda63[_0x3646('0x41')],{})[_0x3646('0x1f')](respondWithResult(_0x37d857,0xc9))[_0x3646('0x3b')](handleError(_0x37d857,null));};exports[_0x3646('0x1e')]=function(_0x221142,_0x36b96b){if(_0x221142[_0x3646('0x41')]['id']){delete _0x221142[_0x3646('0x41')]['id'];}return db[_0x3646('0x24')][_0x3646('0x3f')]({'where':{'id':_0x221142[_0x3646('0x3d')]['id']}})[_0x3646('0x1f')](handleEntityNotFound(_0x36b96b,null))[_0x3646('0x1f')](saveUpdates(_0x221142[_0x3646('0x41')],null))[_0x3646('0x1f')](respondWithResult(_0x36b96b,null))['catch'](handleError(_0x36b96b,null));};exports[_0x3646('0x42')]=function(_0x244371,_0x957a37){return db[_0x3646('0x24')]['find']({'where':{'id':_0x244371[_0x3646('0x3d')]['id']}})[_0x3646('0x1f')](handleEntityNotFound(_0x957a37,null))['then'](removeEntity(_0x957a37,null))[_0x3646('0x3b')](handleError(_0x957a37,null));};exports[_0x3646('0x43')]=function(_0x4c19cc,_0x4f6084){return db['SquareDetailsReport'][_0x3646('0x43')]()[_0x3646('0x1f')](respondWithResult(_0x4f6084,null))[_0x3646('0x3b')](handleError(_0x4f6084,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index bbd4798..6f88e47 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 _0x54de=['exports','define','SquareDetailsReport','report_square_details','lodash','api','moment','bluebird','request-promise','path','./squareReportDetail.attributes'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x54de,0x164));var _0xe54d=function(_0x431826,_0x551c10){_0x431826=_0x431826-0x0;var _0x16c630=_0x54de[_0x431826];return _0x16c630;};'use strict';var _=require(_0xe54d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe54d('0x1'));var moment=require(_0xe54d('0x2'));var BPromise=require(_0xe54d('0x3'));var rp=require(_0xe54d('0x4'));var fs=require('fs');var path=require(_0xe54d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe54d('0x6'));module[_0xe54d('0x7')]=function(_0x4b34b7,_0x4df121){return _0x4b34b7[_0xe54d('0x8')](_0xe54d('0x9'),attributes,{'tableName':_0xe54d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c17=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x295ed9,_0x3a1393){var _0x1b8636=function(_0xfedbdd){while(--_0xfedbdd){_0x295ed9['push'](_0x295ed9['shift']());}};_0x1b8636(++_0x3a1393);}(_0x9c17,0xff));var _0x79c1=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x9c17[_0x5dc03e];return _0x466a07;};'use strict';var _=require(_0x79c1('0x0'));var util=require(_0x79c1('0x1'));var logger=require(_0x79c1('0x2'))(_0x79c1('0x3'));var moment=require(_0x79c1('0x4'));var BPromise=require(_0x79c1('0x5'));var rp=require(_0x79c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79c1('0x7'));var config=require(_0x79c1('0x8'));var attributes=require(_0x79c1('0x9'));module[_0x79c1('0xa')]=function(_0x4d1b2e,_0x5b1727){return _0x4d1b2e[_0x79c1('0xb')](_0x79c1('0xc'),attributes,{'tableName':_0x79c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index eca41ff..0950e73 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 _0x1280=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','SquareDetailsReport','create','options','CreateSquareDetailsReport','lodash','moment','bluebird'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x1280,0xac));var _0x0128=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x1280[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var moment=require(_0x0128('0x1'));var BPromise=require(_0x0128('0x2'));var rs=require(_0x0128('0x3'));var fs=require('fs');var Redis=require(_0x0128('0x4'));var db=require(_0x0128('0x5'))['db'];var utils=require(_0x0128('0x6'));var logger=require('../../config/logger')(_0x0128('0x7'));var config=require(_0x0128('0x8'));var jayson=require(_0x0128('0x9'));var client=jayson[_0x0128('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74fe,_0x1d647f,_0x134abd){return new BPromise(function(_0x2b8b86,_0x43a105){return client['request'](_0x4e74fe,_0x134abd)[_0x0128('0xb')](function(_0x2fa9cb){logger['info'](_0x0128('0xc'),_0x1d647f,_0x0128('0xd'));logger[_0x0128('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1d647f,'request\x20sent',JSON[_0x0128('0xf')](_0x2fa9cb));if(_0x2fa9cb[_0x0128('0x10')]){if(_0x2fa9cb[_0x0128('0x10')]['code']===0x1f4){logger[_0x0128('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')]['message']);return _0x43a105(_0x2fa9cb[_0x0128('0x10')]['message']);}logger[_0x0128('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);return _0x2b8b86(_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);}else{logger[_0x0128('0x12')](_0x0128('0xc'),_0x1d647f,'request\x20sent');_0x2b8b86(_0x2fa9cb[_0x0128('0x13')][_0x0128('0x11')]);}})[_0x0128('0x14')](function(_0x16a4b7){logger[_0x0128('0x10')](_0x0128('0xc'),_0x1d647f,_0x16a4b7);_0x43a105(_0x16a4b7);});});}exports['CreateSquareDetailsReport']=function(_0x2524b1){var _0x18a955=this;return new Promise(function(_0x1a5818,_0x431b13){return db[_0x0128('0x15')][_0x0128('0x16')](_0x2524b1['body'],{'raw':_0x2524b1[_0x0128('0x17')]?_0x2524b1[_0x0128('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2c000a){logger[_0x0128('0x12')](_0x0128('0x18'),_0x2524b1);logger[_0x0128('0xe')](_0x0128('0x18'),_0x2524b1,JSON[_0x0128('0xf')](_0x2c000a));_0x1a5818(_0x2c000a);})[_0x0128('0x14')](function(_0x167c33){logger['error']('CreateSquareDetailsReport',_0x167c33[_0x0128('0x11')],_0x2524b1);_0x431b13(_0x18a955['error'](0x1f4,_0x167c33[_0x0128('0x11')]));});});}; \ No newline at end of file +var _0x7d25=['options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x360c92,_0x5ed443){var _0x429495=function(_0x11feaf){while(--_0x11feaf){_0x360c92['push'](_0x360c92['shift']());}};_0x429495(++_0x5ed443);}(_0x7d25,0x8a));var _0x57d2=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7d25[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')](_0x7d4cf1[_0x57d2('0x17')],{'raw':_0x7d4cf1[_0x57d2('0x18')]?_0x7d4cf1['options'][_0x57d2('0x19')]===undefined?!![]:![]:!![]})[_0x57d2('0x1a')](function(_0x55191e){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x55191e));_0x4a94e3(_0x55191e);})[_0x57d2('0x13')](function(_0x803c25){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x803c25[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x803c25[_0x57d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bcc753e..66d0275 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 _0xdacd=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','exports'];(function(_0x3d9b8c,_0x1accd9){var _0x5afdbc=function(_0x4ac82c){while(--_0x4ac82c){_0x3d9b8c['push'](_0x3d9b8c['shift']());}};_0x5afdbc(++_0x1accd9);}(_0xdacd,0x173));var _0xddac=function(_0x20d29f,_0x406dca){_0x20d29f=_0x20d29f-0x0;var _0x3e19d7=_0xdacd[_0x20d29f];return _0x3e19d7;};'use strict';var express=require(_0xddac('0x0'));var router=express[_0xddac('0x1')]();var auth=require(_0xddac('0x2'));var controller=require(_0xddac('0x3'));router[_0xddac('0x4')]('/',auth[_0xddac('0x5')](),controller['index']);router['get']('/process/:pid/kill',auth[_0xddac('0x5')](),controller['killProcess']);module[_0xddac('0x6')]=router; \ No newline at end of file +var _0x1860=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','../../components/auth/service'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x1860,0x191));var _0x0186=function(_0x44c0d5,_0x3c8a3d){_0x44c0d5=_0x44c0d5-0x0;var _0x387d1d=_0x1860[_0x44c0d5];return _0x387d1d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x0186('0x0'));var controller=require(_0x0186('0x1'));router[_0x0186('0x2')]('/',auth[_0x0186('0x3')](),controller[_0x0186('0x4')]);router[_0x0186('0x2')](_0x0186('0x5'),auth[_0x0186('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d69f8bb..a32ec6e 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 _0xab85=['exec','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','killProcess','systeminformation','child_process'];(function(_0x2ec344,_0x46c158){var _0x19cfda=function(_0x3ccdd5){while(--_0x3ccdd5){_0x2ec344['push'](_0x2ec344['shift']());}};_0x19cfda(++_0x46c158);}(_0xab85,0x15d));var _0x5ab8=function(_0xb297dc,_0x39aebc){_0xb297dc=_0xb297dc-0x0;var _0x3fb2a7=_0xab85[_0xb297dc];return _0x3fb2a7;};'use strict';var info=require(_0x5ab8('0x0'));var exec=require(_0x5ab8('0x1'))[_0x5ab8('0x2')];var logger=require(_0x5ab8('0x3'))(_0x5ab8('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x5ab8('0x5'));function handleError(_0x1275e4,_0x3e08a4,_0x5c3ea2){_0x3e08a4=_0x3e08a4||0x1f4;return function(_0x506a66){logger[_0x5ab8('0x6')](_0x5ab8('0x7'),_0x5c3ea2,_0x3e08a4,util[_0x5ab8('0x8')](_0x506a66,{'showHidden':![],'depth':null}));delete _0x506a66['name'];_0x1275e4[_0x5ab8('0x9')](_0x3e08a4)[_0x5ab8('0xa')](_0x506a66);};}exports[_0x5ab8('0xb')]=function(_0x66b8c,_0x252b75){return info[_0x5ab8('0xc')]()[_0x5ab8('0xd')](function(_0x207dbb){return _0x252b75[_0x5ab8('0x9')](0xc8)[_0x5ab8('0xe')](_0x207dbb);})[_0x5ab8('0xf')](function(_0x3cd951){return _0x252b75['status'](0x1f4)[_0x5ab8('0xe')](_0x3cd951);});};exports['killProcess']=function(_0x322c9c,_0x37285d){var _0x1c31ae=[_0x5ab8('0x10')];return new BPromise(function(_0x1858f8,_0x4120d2){return exec(util[_0x5ab8('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x322c9c[_0x5ab8('0x12')][_0x5ab8('0x13')]),function(_0x3d94da,_0x517a00,_0x1737c3){if(_0x3d94da){return _0x4120d2(_0x3d94da);}return _0x1858f8(_0x517a00);});})[_0x5ab8('0xd')](function(_0xbed1f6){var _0x1150e1=![];var _0x174a03=_0xbed1f6[_0x5ab8('0x14')](/\n/);for(var _0x2ed799=0x0,_0x441c10=_0x1c31ae[_0x5ab8('0x15')];_0x2ed799<_0x441c10,_0x1150e1===![];_0x2ed799+=0x1){if(_0xbed1f6[_0x5ab8('0x16')](_0x1c31ae[_0x2ed799])>=0x0){_0x1150e1=!![];}}if(!_0x1150e1){throw new Error(util[_0x5ab8('0x11')](_0x5ab8('0x17'),_0x322c9c[_0x5ab8('0x12')][_0x5ab8('0x13')]));}process[_0x5ab8('0x18')](_0x322c9c[_0x5ab8('0x12')][_0x5ab8('0x13')],_0x5ab8('0x19'));return _0x37285d[_0x5ab8('0x9')](0xc8)[_0x5ab8('0xe')]({'message':util[_0x5ab8('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x322c9c[_0x5ab8('0x12')][_0x5ab8('0x13')])});})[_0x5ab8('0xf')](handleError(_0x37285d,null,_0x5ab8('0x1a')));}; \ No newline at end of file +var _0x4559=['indexOf','pid','kill','systeminformation','child_process','exec','../../config/logger','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split'];(function(_0xe02e6,_0x697a6){var _0x57a88b=function(_0x2e8306){while(--_0x2e8306){_0xe02e6['push'](_0xe02e6['shift']());}};_0x57a88b(++_0x697a6);}(_0x4559,0x145));var _0x9455=function(_0x34ddbd,_0x495f13){_0x34ddbd=_0x34ddbd-0x0;var _0x2a5fce=_0x4559[_0x34ddbd];return _0x2a5fce;};'use strict';var info=require(_0x9455('0x0'));var exec=require(_0x9455('0x1'))[_0x9455('0x2')];var logger=require(_0x9455('0x3'))('api');var util=require(_0x9455('0x4'));var BPromise=require(_0x9455('0x5'));var _=require('lodash');function handleError(_0x4959b9,_0x1341e8,_0x3e615c){_0x1341e8=_0x1341e8||0x1f4;return function(_0x6d5c0c){logger[_0x9455('0x6')](_0x9455('0x7'),_0x3e615c,_0x1341e8,util[_0x9455('0x8')](_0x6d5c0c,{'showHidden':![],'depth':null}));delete _0x6d5c0c['name'];_0x4959b9[_0x9455('0x9')](_0x1341e8)[_0x9455('0xa')](_0x6d5c0c);};}exports[_0x9455('0xb')]=function(_0x4bba7f,_0x37c0c8){return info[_0x9455('0xc')]()[_0x9455('0xd')](function(_0x5a9d65){return _0x37c0c8[_0x9455('0x9')](0xc8)[_0x9455('0xe')](_0x5a9d65);})['catch'](function(_0x409c76){return _0x37c0c8[_0x9455('0x9')](0x1f4)['json'](_0x409c76);});};exports[_0x9455('0xf')]=function(_0x18a2a1,_0x5287dd){var _0x197a4b=['components/import/cm'];return new BPromise(function(_0x48e86d,_0x558681){return exec(util[_0x9455('0x10')](_0x9455('0x11'),_0x18a2a1[_0x9455('0x12')]['pid']),function(_0x5af34d,_0x2b2aac,_0x4e1f9c){if(_0x5af34d){return _0x558681(_0x5af34d);}return _0x48e86d(_0x2b2aac);});})['then'](function(_0x102526){var _0x106d9a=![];var _0x51d4ec=_0x102526[_0x9455('0x13')](/\n/);for(var _0x10c2a0=0x0,_0x96543=_0x197a4b['length'];_0x10c2a0<_0x96543,_0x106d9a===![];_0x10c2a0+=0x1){if(_0x102526[_0x9455('0x14')](_0x197a4b[_0x10c2a0])>=0x0){_0x106d9a=!![];}}if(!_0x106d9a){throw new Error(util[_0x9455('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x18a2a1[_0x9455('0x12')][_0x9455('0x15')]));}process[_0x9455('0x16')](_0x18a2a1[_0x9455('0x12')]['pid'],'SIGINT');return _0x5287dd[_0x9455('0x9')](0xc8)['json']({'message':util[_0x9455('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x18a2a1[_0x9455('0x12')][_0x9455('0x15')])});})['catch'](handleError(_0x5287dd,null,_0x9455('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b27c869..5c1225f 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 _0xb43b=['../../components/interaction/service','../../config/environment','./tag.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x544c44,_0x12a2b9){var _0x95e2bb=function(_0x13af62){while(--_0x13af62){_0x544c44['push'](_0x544c44['shift']());}};_0x95e2bb(++_0x12a2b9);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2bf8f5,_0x33a3d2){_0x2bf8f5=_0x2bf8f5-0x0;var _0xbdadd4=_0xb43b[_0x2bf8f5];return _0xbdadd4;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55e0=['./tag.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x38b4d8,_0x379b4b){var _0xdca784=function(_0x15986f){while(--_0x15986f){_0x38b4d8['push'](_0x38b4d8['shift']());}};_0xdca784(++_0x379b4b);}(_0x55e0,0xdc));var _0x055e=function(_0x2ebcc9,_0x3bd5a3){_0x2ebcc9=_0x2ebcc9-0x0;var _0x425cf3=_0x55e0[_0x2ebcc9];return _0x425cf3;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 26ebb63..770032f 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 _0x082b=['name','#0091EA','sequelize','exports','STRING'];(function(_0x4d88b1,_0x13fa4e){var _0x47061e=function(_0x4fd1c2){while(--_0x4fd1c2){_0x4d88b1['push'](_0x4d88b1['shift']());}};_0x47061e(++_0x13fa4e);}(_0x082b,0x1ec));var _0xb082=function(_0x39b812,_0xd23bca){_0x39b812=_0x39b812-0x0;var _0x3e33de=_0x082b[_0x39b812];return _0x3e33de;};'use strict';var Sequelize=require(_0xb082('0x0'));module[_0xb082('0x1')]={'name':{'type':Sequelize[_0xb082('0x2')],'unique':_0xb082('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xb082('0x4')},'description':{'type':Sequelize[_0xb082('0x2')]}}; \ No newline at end of file +var _0x9000=['exports','name','STRING','#0091EA','sequelize'];(function(_0x552553,_0xb4c84){var _0x5471f4=function(_0x24aa5e){while(--_0x24aa5e){_0x552553['push'](_0x552553['shift']());}};_0x5471f4(++_0xb4c84);}(_0x9000,0x19e));var _0x0900=function(_0x1a79c6,_0x5bad0b){_0x1a79c6=_0x1a79c6-0x0;var _0x301647=_0x9000[_0x1a79c6];return _0x301647;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0900('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0900('0x3')],'defaultValue':_0x0900('0x4')},'description':{'type':Sequelize[_0x0900('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 524e19e..eb8b3ea 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 _0xb7b5=['length','hasOwnProperty','nolimit','order','where','pick','filters','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/license/util','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x3486d5,_0x7c19f3){var _0x4d5c6e=function(_0x4fe38c){while(--_0x4fe38c){_0x3486d5['push'](_0x3486d5['shift']());}};_0x4d5c6e(++_0x7c19f3);}(_0xb7b5,0x75));var _0x5b7b=function(_0x464b1c,_0x38fa45){_0x464b1c=_0x464b1c-0x0;var _0x4187c3=_0xb7b5[_0x464b1c];return _0x4187c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b7b('0x0'));var zipdir=require(_0x5b7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b7b('0x2'));var moment=require(_0x5b7b('0x3'));var BPromise=require(_0x5b7b('0x4'));var Mustache=require(_0x5b7b('0x5'));var util=require(_0x5b7b('0x6'));var path=require(_0x5b7b('0x7'));var sox=require(_0x5b7b('0x8'));var csv=require('to-csv');var ejs=require(_0x5b7b('0x9'));var fs=require('fs');var fs_extra=require(_0x5b7b('0xa'));var _=require(_0x5b7b('0xb'));var squel=require(_0x5b7b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b7b('0xd'));var toCsv=require(_0x5b7b('0xe'));var querystring=require(_0x5b7b('0xf'));var Papa=require(_0x5b7b('0x10'));var Redis=require(_0x5b7b('0x11'));var authService=require(_0x5b7b('0x12'));var qs=require(_0x5b7b('0x13'));var as=require(_0x5b7b('0x14'));var hardwareService=require(_0x5b7b('0x15'));var logger=require(_0x5b7b('0x16'))(_0x5b7b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5b7b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28bae3,_0x9c64b0){_0x9c64b0=_0x9c64b0||0xcc;return function(_0x1f93b4){if(_0x1f93b4){return _0x28bae3['sendStatus'](_0x9c64b0);}return _0x28bae3[_0x5b7b('0x19')](_0x9c64b0)[_0x5b7b('0x1a')]();};}function respondWithResult(_0x298503,_0x28eaf4){_0x28eaf4=_0x28eaf4||0xc8;return function(_0x17f9a2){if(_0x17f9a2){return _0x298503[_0x5b7b('0x19')](_0x28eaf4)[_0x5b7b('0x1b')](_0x17f9a2);}};}function respondWithFilteredResult(_0x26af3b,_0x4b7575){return function(_0x1d9072){if(_0x1d9072){var _0x1d1e46=typeof _0x4b7575[_0x5b7b('0x1c')]===_0x5b7b('0x1d')&&typeof _0x4b7575[_0x5b7b('0x1e')]===_0x5b7b('0x1d');var _0x5e3280=_0x1d9072['count'];var _0x1f098a=_0x1d1e46?0x0:_0x4b7575[_0x5b7b('0x1c')];var _0x299220=_0x1d1e46?_0x1d9072['count']:_0x4b7575[_0x5b7b('0x1c')]+_0x4b7575['limit'];var _0x49000a;if(_0x299220>=_0x5e3280){_0x299220=_0x5e3280;_0x49000a=0xc8;}else{_0x49000a=0xce;}_0x26af3b[_0x5b7b('0x19')](_0x49000a);return _0x26af3b[_0x5b7b('0x1f')]('Content-Range',_0x1f098a+'-'+_0x299220+'/'+_0x5e3280)[_0x5b7b('0x1b')](_0x1d9072);}return null;};}function patchUpdates(_0x12f8cd){return function(_0x555e4e){try{jsonpatch[_0x5b7b('0x20')](_0x555e4e,_0x12f8cd,!![]);}catch(_0x5233b9){return BPromise[_0x5b7b('0x21')](_0x5233b9);}return _0x555e4e[_0x5b7b('0x22')]();};}function saveUpdates(_0x205388,_0x4db367){return function(_0xfad05){if(_0xfad05){return _0xfad05[_0x5b7b('0x23')](_0x205388)[_0x5b7b('0x24')](function(_0x432223){return _0x432223;});}return null;};}function removeEntity(_0x5a8fad,_0x18c61c){return function(_0x126fe6){if(_0x126fe6){return _0x126fe6[_0x5b7b('0x25')]()[_0x5b7b('0x24')](function(){var _0x3cea02=_0x126fe6['get']({'plain':!![]});var _0x5a4b3a=_0x5b7b('0x26');return db[_0x5b7b('0x27')][_0x5b7b('0x25')]({'where':{'type':_0x5a4b3a,'resourceId':_0x3cea02['id']}})['then'](function(){return _0x126fe6;});})[_0x5b7b('0x24')](function(){_0x5a8fad[_0x5b7b('0x19')](0xcc)[_0x5b7b('0x1a')]();});}};}function handleEntityNotFound(_0x1dda05,_0x38698f){return function(_0x4eae75){if(!_0x4eae75){_0x1dda05['sendStatus'](0x194);}return _0x4eae75;};}function handleError(_0x325d94,_0x49d8fc){_0x49d8fc=_0x49d8fc||0x1f4;return function(_0x5f346d){logger[_0x5b7b('0x28')](_0x5f346d[_0x5b7b('0x29')]);if(_0x5f346d[_0x5b7b('0x2a')]){delete _0x5f346d[_0x5b7b('0x2a')];}_0x325d94['status'](_0x49d8fc)[_0x5b7b('0x2b')](_0x5f346d);};}exports[_0x5b7b('0x2c')]=function(_0x38c4d0,_0x42b4db){var _0x30dbd7={},_0x4d20be={},_0x47e8a0={'count':0x0,'rows':[]};var _0x31eb45=_[_0x5b7b('0x2d')](db[_0x5b7b('0x2e')][_0x5b7b('0x2f')],function(_0xe22b58){return{'name':_0xe22b58[_0x5b7b('0x30')],'type':_0xe22b58[_0x5b7b('0x31')][_0x5b7b('0x32')]};});_0x4d20be[_0x5b7b('0x33')]=_[_0x5b7b('0x2d')](_0x31eb45,'name');_0x4d20be[_0x5b7b('0x34')]=_[_0x5b7b('0x35')](_0x38c4d0[_0x5b7b('0x34')]);_0x4d20be['filters']=_[_0x5b7b('0x36')](_0x4d20be[_0x5b7b('0x33')],_0x4d20be[_0x5b7b('0x34')]);_0x30dbd7[_0x5b7b('0x37')]=_[_0x5b7b('0x36')](_0x4d20be[_0x5b7b('0x33')],qs['fields'](_0x38c4d0[_0x5b7b('0x34')][_0x5b7b('0x38')]));_0x30dbd7[_0x5b7b('0x37')]=_0x30dbd7[_0x5b7b('0x37')][_0x5b7b('0x39')]?_0x30dbd7[_0x5b7b('0x37')]:_0x4d20be['model'];if(!_0x38c4d0[_0x5b7b('0x34')][_0x5b7b('0x3a')](_0x5b7b('0x3b'))){_0x30dbd7[_0x5b7b('0x1e')]=qs['limit'](_0x38c4d0['query'][_0x5b7b('0x1e')]);_0x30dbd7[_0x5b7b('0x1c')]=qs[_0x5b7b('0x1c')](_0x38c4d0[_0x5b7b('0x34')][_0x5b7b('0x1c')]);}_0x30dbd7[_0x5b7b('0x3c')]=qs['sort'](_0x38c4d0[_0x5b7b('0x34')]['sort']);_0x30dbd7[_0x5b7b('0x3d')]=qs['filters'](_[_0x5b7b('0x3e')](_0x38c4d0['query'],_0x4d20be[_0x5b7b('0x3f')]),_0x31eb45);if(_0x38c4d0[_0x5b7b('0x34')]['filter']){_0x30dbd7[_0x5b7b('0x3d')]=_[_0x5b7b('0x40')](_0x30dbd7['where'],{'$or':_['map'](_0x31eb45,function(_0x3aff25){if(_0x3aff25[_0x5b7b('0x31')]!==_0x5b7b('0x41')){var _0xd3d78b={};_0xd3d78b[_0x3aff25[_0x5b7b('0x2a')]]={'$like':'%'+_0x38c4d0[_0x5b7b('0x34')][_0x5b7b('0x42')]+'%'};return _0xd3d78b;}})});}_0x30dbd7=_[_0x5b7b('0x40')]({},_0x30dbd7,_0x38c4d0[_0x5b7b('0x43')]);var _0xa89042={'where':_0x30dbd7[_0x5b7b('0x3d')]};return db[_0x5b7b('0x2e')][_0x5b7b('0x44')](_0xa89042)['then'](function(_0x5e2903){_0x47e8a0[_0x5b7b('0x44')]=_0x5e2903;if(_0x38c4d0[_0x5b7b('0x34')]['includeAll']){_0x30dbd7[_0x5b7b('0x45')]=[{'all':!![]}];}return db['Tag'][_0x5b7b('0x46')](_0x30dbd7);})[_0x5b7b('0x24')](function(_0x53aef9){_0x47e8a0[_0x5b7b('0x47')]=_0x53aef9;return _0x47e8a0;})['then'](respondWithFilteredResult(_0x42b4db,_0x30dbd7))[_0x5b7b('0x48')](handleError(_0x42b4db,null));};exports[_0x5b7b('0x49')]=function(_0x2ee7a6,_0x45540c){var _0x21d150={'raw':!![],'where':{'id':_0x2ee7a6[_0x5b7b('0x4a')]['id']}},_0x27170a={};_0x27170a[_0x5b7b('0x33')]=_[_0x5b7b('0x35')](db['Tag']['rawAttributes']);_0x27170a['query']=_[_0x5b7b('0x35')](_0x2ee7a6[_0x5b7b('0x34')]);_0x27170a[_0x5b7b('0x3f')]=_[_0x5b7b('0x36')](_0x27170a[_0x5b7b('0x33')],_0x27170a['query']);_0x21d150['attributes']=_['intersection'](_0x27170a['model'],qs[_0x5b7b('0x38')](_0x2ee7a6['query']['fields']));_0x21d150['attributes']=_0x21d150[_0x5b7b('0x37')][_0x5b7b('0x39')]?_0x21d150[_0x5b7b('0x37')]:_0x27170a['model'];if(_0x2ee7a6[_0x5b7b('0x34')][_0x5b7b('0x4b')]){_0x21d150[_0x5b7b('0x45')]=[{'all':!![]}];}_0x21d150=_[_0x5b7b('0x40')]({},_0x21d150,_0x2ee7a6[_0x5b7b('0x43')]);return db[_0x5b7b('0x2e')][_0x5b7b('0x4c')](_0x21d150)[_0x5b7b('0x24')](handleEntityNotFound(_0x45540c,null))['then'](respondWithResult(_0x45540c,null))[_0x5b7b('0x48')](handleError(_0x45540c,null));};exports[_0x5b7b('0x4d')]=function(_0x159e29,_0x30bf01){return db[_0x5b7b('0x2e')][_0x5b7b('0x4d')](_0x159e29[_0x5b7b('0x4e')],{})[_0x5b7b('0x24')](function(_0x4ac50b){var _0x5c9950=_0x159e29['user'][_0x5b7b('0x4f')]({'plain':!![]});if(!_0x5c9950)throw new Error(_0x5b7b('0x50'));if(_0x5c9950['role']===_0x5b7b('0x51')){var _0x4d64e2=_0x4ac50b[_0x5b7b('0x4f')]({'plain':!![]});var _0x59e53f='Tags';return db[_0x5b7b('0x52')][_0x5b7b('0x4c')]({'where':{'name':_0x59e53f,'userProfileId':_0x5c9950[_0x5b7b('0x53')]},'raw':!![]})[_0x5b7b('0x24')](function(_0x520053){if(_0x520053&&_0x520053[_0x5b7b('0x54')]===0x0){return db[_0x5b7b('0x27')][_0x5b7b('0x4d')]({'name':_0x4d64e2[_0x5b7b('0x2a')],'resourceId':_0x4d64e2['id'],'type':_0x520053[_0x5b7b('0x2a')],'sectionId':_0x520053['id']},{})['then'](function(){return _0x4ac50b;});}else{return _0x4ac50b;}})[_0x5b7b('0x48')](function(_0x143fe8){logger[_0x5b7b('0x28')](_0x5b7b('0x55'),_0x143fe8);throw _0x143fe8;});}return _0x4ac50b;})[_0x5b7b('0x24')](respondWithResult(_0x30bf01,0xc9))['catch'](handleError(_0x30bf01,null));};exports[_0x5b7b('0x23')]=function(_0x48ee11,_0x1cd6fa){if(_0x48ee11[_0x5b7b('0x4e')]['id']){delete _0x48ee11[_0x5b7b('0x4e')]['id'];}return db[_0x5b7b('0x2e')]['find']({'where':{'id':_0x48ee11['params']['id']}})[_0x5b7b('0x24')](handleEntityNotFound(_0x1cd6fa,null))[_0x5b7b('0x24')](saveUpdates(_0x48ee11['body'],null))[_0x5b7b('0x24')](respondWithResult(_0x1cd6fa,null))['catch'](handleError(_0x1cd6fa,null));};exports[_0x5b7b('0x25')]=function(_0x5b85ac,_0x3048ef){return db['Tag'][_0x5b7b('0x4c')]({'where':{'id':_0x5b85ac[_0x5b7b('0x4a')]['id']}})[_0x5b7b('0x24')](handleEntityNotFound(_0x3048ef,null))[_0x5b7b('0x24')](removeEntity(_0x3048ef,null))[_0x5b7b('0x48')](handleError(_0x3048ef,null));};exports['describe']=function(_0x455cbe,_0x1e36c2){return db[_0x5b7b('0x2e')][_0x5b7b('0x56')]()[_0x5b7b('0x24')](respondWithResult(_0x1e36c2,null))[_0x5b7b('0x48')](handleError(_0x1e36c2,null));}; \ No newline at end of file +var _0x29d2=['util','path','sox','to-csv','lodash','squel','crypto','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','reject','save','update','destroy','then','Tags','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5e99e7,_0x40820a){var _0x53eef9=function(_0x414f79){while(--_0x414f79){_0x5e99e7['push'](_0x5e99e7['shift']());}};_0x53eef9(++_0x40820a);}(_0x29d2,0x1a7));var _0x229d=function(_0x11fc86,_0x4b9cf0){_0x11fc86=_0x11fc86-0x0;var _0x3ccd59=_0x29d2[_0x11fc86];return _0x3ccd59;};'use strict';var emlformat=require(_0x229d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x229d('0x1'));var jsonpatch=require(_0x229d('0x2'));var rp=require(_0x229d('0x3'));var moment=require(_0x229d('0x4'));var BPromise=require(_0x229d('0x5'));var Mustache=require(_0x229d('0x6'));var util=require(_0x229d('0x7'));var path=require(_0x229d('0x8'));var sox=require(_0x229d('0x9'));var csv=require(_0x229d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x229d('0xb'));var squel=require(_0x229d('0xc'));var crypto=require(_0x229d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x229d('0xa'));var querystring=require('querystring');var Papa=require(_0x229d('0xe'));var Redis=require(_0x229d('0xf'));var authService=require(_0x229d('0x10'));var qs=require(_0x229d('0x11'));var as=require(_0x229d('0x12'));var hardwareService=require(_0x229d('0x13'));var logger=require(_0x229d('0x14'))(_0x229d('0x15'));var utils=require(_0x229d('0x16'));var config=require(_0x229d('0x17'));var licenseUtil=require(_0x229d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b97c7,_0x4eaffe){_0x4eaffe=_0x4eaffe||0xcc;return function(_0x3b2d8e){if(_0x3b2d8e){return _0x4b97c7[_0x229d('0x19')](_0x4eaffe);}return _0x4b97c7[_0x229d('0x1a')](_0x4eaffe)[_0x229d('0x1b')]();};}function respondWithResult(_0x30161c,_0x45d124){_0x45d124=_0x45d124||0xc8;return function(_0x4a9aa0){if(_0x4a9aa0){return _0x30161c['status'](_0x45d124)[_0x229d('0x1c')](_0x4a9aa0);}};}function respondWithFilteredResult(_0x5d15fb,_0x584426){return function(_0x692052){if(_0x692052){var _0x13a5a3=typeof _0x584426[_0x229d('0x1d')]===_0x229d('0x1e')&&typeof _0x584426[_0x229d('0x1f')]==='undefined';var _0x22c3d5=_0x692052[_0x229d('0x20')];var _0x452b70=_0x13a5a3?0x0:_0x584426[_0x229d('0x1d')];var _0x373ec0=_0x13a5a3?_0x692052['count']:_0x584426[_0x229d('0x1d')]+_0x584426[_0x229d('0x1f')];var _0x104300;if(_0x373ec0>=_0x22c3d5){_0x373ec0=_0x22c3d5;_0x104300=0xc8;}else{_0x104300=0xce;}_0x5d15fb[_0x229d('0x1a')](_0x104300);return _0x5d15fb[_0x229d('0x21')](_0x229d('0x22'),_0x452b70+'-'+_0x373ec0+'/'+_0x22c3d5)['json'](_0x692052);}return null;};}function patchUpdates(_0x3f333c){return function(_0x4ab8ad){try{jsonpatch[_0x229d('0x23')](_0x4ab8ad,_0x3f333c,!![]);}catch(_0x3335aa){return BPromise[_0x229d('0x24')](_0x3335aa);}return _0x4ab8ad[_0x229d('0x25')]();};}function saveUpdates(_0x3c263f,_0x243d66){return function(_0x3b8867){if(_0x3b8867){return _0x3b8867[_0x229d('0x26')](_0x3c263f)['then'](function(_0xbf0008){return _0xbf0008;});}return null;};}function removeEntity(_0x2fc0c0,_0x2fd97d){return function(_0x15bc80){if(_0x15bc80){return _0x15bc80[_0x229d('0x27')]()[_0x229d('0x28')](function(){var _0x41d162=_0x15bc80['get']({'plain':!![]});var _0x297f08=_0x229d('0x29');return db[_0x229d('0x2a')][_0x229d('0x27')]({'where':{'type':_0x297f08,'resourceId':_0x41d162['id']}})[_0x229d('0x28')](function(){return _0x15bc80;});})[_0x229d('0x28')](function(){_0x2fc0c0[_0x229d('0x1a')](0xcc)[_0x229d('0x1b')]();});}};}function handleEntityNotFound(_0x5327fd,_0x4776fe){return function(_0x1141ce){if(!_0x1141ce){_0x5327fd[_0x229d('0x19')](0x194);}return _0x1141ce;};}function handleError(_0x3b201a,_0x184136){_0x184136=_0x184136||0x1f4;return function(_0x5970f7){logger[_0x229d('0x2b')](_0x5970f7[_0x229d('0x2c')]);if(_0x5970f7[_0x229d('0x2d')]){delete _0x5970f7[_0x229d('0x2d')];}_0x3b201a[_0x229d('0x1a')](_0x184136)[_0x229d('0x2e')](_0x5970f7);};}exports['index']=function(_0x3f66a2,_0x426202){var _0x188c05={},_0x1857f5={},_0x39269c={'count':0x0,'rows':[]};var _0x1a13c5=_[_0x229d('0x2f')](db['Tag'][_0x229d('0x30')],function(_0x289f0f){return{'name':_0x289f0f[_0x229d('0x31')],'type':_0x289f0f[_0x229d('0x32')][_0x229d('0x33')]};});_0x1857f5['model']=_[_0x229d('0x2f')](_0x1a13c5,_0x229d('0x2d'));_0x1857f5[_0x229d('0x34')]=_['keys'](_0x3f66a2[_0x229d('0x34')]);_0x1857f5[_0x229d('0x35')]=_[_0x229d('0x36')](_0x1857f5[_0x229d('0x37')],_0x1857f5[_0x229d('0x34')]);_0x188c05[_0x229d('0x38')]=_[_0x229d('0x36')](_0x1857f5[_0x229d('0x37')],qs[_0x229d('0x39')](_0x3f66a2[_0x229d('0x34')]['fields']));_0x188c05[_0x229d('0x38')]=_0x188c05['attributes'][_0x229d('0x3a')]?_0x188c05['attributes']:_0x1857f5['model'];if(!_0x3f66a2['query'][_0x229d('0x3b')](_0x229d('0x3c'))){_0x188c05[_0x229d('0x1f')]=qs['limit'](_0x3f66a2[_0x229d('0x34')][_0x229d('0x1f')]);_0x188c05['offset']=qs['offset'](_0x3f66a2[_0x229d('0x34')][_0x229d('0x1d')]);}_0x188c05[_0x229d('0x3d')]=qs['sort'](_0x3f66a2[_0x229d('0x34')][_0x229d('0x3e')]);_0x188c05[_0x229d('0x3f')]=qs[_0x229d('0x35')](_['pick'](_0x3f66a2['query'],_0x1857f5[_0x229d('0x35')]),_0x1a13c5);if(_0x3f66a2[_0x229d('0x34')][_0x229d('0x40')]){_0x188c05[_0x229d('0x3f')]=_[_0x229d('0x41')](_0x188c05[_0x229d('0x3f')],{'$or':_[_0x229d('0x2f')](_0x1a13c5,function(_0x17a4dd){if(_0x17a4dd[_0x229d('0x32')]!==_0x229d('0x42')){var _0x444e8d={};_0x444e8d[_0x17a4dd[_0x229d('0x2d')]]={'$like':'%'+_0x3f66a2[_0x229d('0x34')]['filter']+'%'};return _0x444e8d;}})});}_0x188c05=_[_0x229d('0x41')]({},_0x188c05,_0x3f66a2[_0x229d('0x43')]);var _0x2b898b={'where':_0x188c05[_0x229d('0x3f')]};return db[_0x229d('0x44')][_0x229d('0x20')](_0x2b898b)[_0x229d('0x28')](function(_0x1a9d8b){_0x39269c['count']=_0x1a9d8b;if(_0x3f66a2['query'][_0x229d('0x45')]){_0x188c05[_0x229d('0x46')]=[{'all':!![]}];}return db[_0x229d('0x44')][_0x229d('0x47')](_0x188c05);})['then'](function(_0x3c0fe9){_0x39269c['rows']=_0x3c0fe9;return _0x39269c;})[_0x229d('0x28')](respondWithFilteredResult(_0x426202,_0x188c05))[_0x229d('0x48')](handleError(_0x426202,null));};exports['show']=function(_0x43ca77,_0x508c4e){var _0xb690bb={'raw':!![],'where':{'id':_0x43ca77[_0x229d('0x49')]['id']}},_0xa65dd4={};_0xa65dd4[_0x229d('0x37')]=_[_0x229d('0x4a')](db[_0x229d('0x44')]['rawAttributes']);_0xa65dd4['query']=_[_0x229d('0x4a')](_0x43ca77[_0x229d('0x34')]);_0xa65dd4['filters']=_[_0x229d('0x36')](_0xa65dd4[_0x229d('0x37')],_0xa65dd4[_0x229d('0x34')]);_0xb690bb[_0x229d('0x38')]=_[_0x229d('0x36')](_0xa65dd4[_0x229d('0x37')],qs[_0x229d('0x39')](_0x43ca77[_0x229d('0x34')][_0x229d('0x39')]));_0xb690bb[_0x229d('0x38')]=_0xb690bb[_0x229d('0x38')][_0x229d('0x3a')]?_0xb690bb[_0x229d('0x38')]:_0xa65dd4[_0x229d('0x37')];if(_0x43ca77[_0x229d('0x34')]['includeAll']){_0xb690bb[_0x229d('0x46')]=[{'all':!![]}];}_0xb690bb=_[_0x229d('0x41')]({},_0xb690bb,_0x43ca77[_0x229d('0x43')]);return db[_0x229d('0x44')]['find'](_0xb690bb)[_0x229d('0x28')](handleEntityNotFound(_0x508c4e,null))[_0x229d('0x28')](respondWithResult(_0x508c4e,null))[_0x229d('0x48')](handleError(_0x508c4e,null));};exports[_0x229d('0x4b')]=function(_0x178b57,_0x4ffe76){return db[_0x229d('0x44')][_0x229d('0x4b')](_0x178b57[_0x229d('0x4c')],{})[_0x229d('0x28')](function(_0x3115d1){var _0x5dcb91=_0x178b57[_0x229d('0x4d')]['get']({'plain':!![]});if(!_0x5dcb91)throw new Error(_0x229d('0x4e'));if(_0x5dcb91[_0x229d('0x4f')]===_0x229d('0x4d')){var _0x5cf6b1=_0x3115d1[_0x229d('0x50')]({'plain':!![]});var _0x1d5257='Tags';return db[_0x229d('0x51')]['find']({'where':{'name':_0x1d5257,'userProfileId':_0x5dcb91['userProfileId']},'raw':!![]})[_0x229d('0x28')](function(_0x7ec85f){if(_0x7ec85f&&_0x7ec85f[_0x229d('0x52')]===0x0){return db[_0x229d('0x2a')][_0x229d('0x4b')]({'name':_0x5cf6b1[_0x229d('0x2d')],'resourceId':_0x5cf6b1['id'],'type':_0x7ec85f[_0x229d('0x2d')],'sectionId':_0x7ec85f['id']},{})[_0x229d('0x28')](function(){return _0x3115d1;});}else{return _0x3115d1;}})['catch'](function(_0x2caa06){logger[_0x229d('0x2b')](_0x229d('0x53'),_0x2caa06);throw _0x2caa06;});}return _0x3115d1;})[_0x229d('0x28')](respondWithResult(_0x4ffe76,0xc9))[_0x229d('0x48')](handleError(_0x4ffe76,null));};exports['update']=function(_0x5e8836,_0x471548){if(_0x5e8836[_0x229d('0x4c')]['id']){delete _0x5e8836[_0x229d('0x4c')]['id'];}return db['Tag'][_0x229d('0x54')]({'where':{'id':_0x5e8836['params']['id']}})[_0x229d('0x28')](handleEntityNotFound(_0x471548,null))['then'](saveUpdates(_0x5e8836['body'],null))[_0x229d('0x28')](respondWithResult(_0x471548,null))['catch'](handleError(_0x471548,null));};exports[_0x229d('0x27')]=function(_0x566072,_0x2d3fd4){return db[_0x229d('0x44')][_0x229d('0x54')]({'where':{'id':_0x566072[_0x229d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d3fd4,null))[_0x229d('0x28')](removeEntity(_0x2d3fd4,null))['catch'](handleError(_0x2d3fd4,null));};exports['describe']=function(_0x186e5b,_0x49aa6d){return db[_0x229d('0x44')][_0x229d('0x55')]()[_0x229d('0x28')](respondWithResult(_0x49aa6d,null))[_0x229d('0x48')](handleError(_0x49aa6d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 717f6c5..58d67bc 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 _0x2d57=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_tags','util','api'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2d57,0x17a));var _0x72d5=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x2d57[_0x282a1f];return _0x296ea7;};'use strict';var _=require('lodash');var util=require(_0x72d5('0x0'));var logger=require('../../config/logger')(_0x72d5('0x1'));var moment=require(_0x72d5('0x2'));var BPromise=require(_0x72d5('0x3'));var rp=require(_0x72d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72d5('0x5'));var config=require(_0x72d5('0x6'));var attributes=require('./tag.attributes');module[_0x72d5('0x7')]=function(_0x10ffe7,_0x40680f){return _0x10ffe7[_0x72d5('0x8')]('Tag',attributes,{'tableName':_0x72d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x218f=['../../config/logger','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x218f,0xf9));var _0xf218=function(_0x5ee1af,_0x258f00){_0x5ee1af=_0x5ee1af-0x0;var _0x3f050a=_0x218f[_0x5ee1af];return _0x3f050a;};'use strict';var _=require('lodash');var util=require(_0xf218('0x0'));var logger=require(_0xf218('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf218('0x2'));var rp=require(_0xf218('0x3'));var fs=require('fs');var path=require(_0xf218('0x4'));var rimraf=require(_0xf218('0x5'));var config=require('../../config/environment');var attributes=require(_0xf218('0x6'));module[_0xf218('0x7')]=function(_0x2ae8d6,_0x31eef7){return _0x2ae8d6[_0xf218('0x8')](_0xf218('0x9'),attributes,{'tableName':'tools_tags','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 79b4cc9..78a5dd8 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 _0x5577=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5577,0x1b4));var _0x7557=function(_0x58521c,_0xe5b828){_0x58521c=_0x58521c-0x0;var _0x14d891=_0x5577[_0x58521c];return _0x14d891;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var moment=require(_0x7557('0x1'));var BPromise=require(_0x7557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7557('0x3'));var db=require(_0x7557('0x4'))['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da895,_0x1446fd,_0x33e9aa){return new BPromise(function(_0x37f335,_0xa4f49a){return client[_0x7557('0xb')](_0x3da895,_0x33e9aa)[_0x7557('0xc')](function(_0x24b592){logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));logger[_0x7557('0x10')](_0x7557('0x11'),_0x1446fd,'request\x20sent',JSON['stringify'](_0x24b592));if(_0x24b592[_0x7557('0x12')]){if(_0x24b592[_0x7557('0x12')][_0x7557('0x13')]===0x1f4){logger[_0x7557('0x12')](_0x7557('0xe'),_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0xa4f49a(_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);}logger[_0x7557('0x12')]('Tag,\x20%s,\x20%s',_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0x37f335(_0x24b592[_0x7557('0x12')]['message']);}else{logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));_0x37f335(_0x24b592[_0x7557('0x15')]['message']);}})[_0x7557('0x16')](function(_0x46057c){logger['error']('Tag,\x20%s,\x20%s',_0x1446fd,_0x46057c);_0xa4f49a(_0x46057c);});});} \ No newline at end of file +var _0xd691=['jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20bd9d,_0x56a835){var _0xf422e2=function(_0x799bec){while(--_0x799bec){_0x20bd9d['push'](_0x20bd9d['shift']());}};_0xf422e2(++_0x56a835);}(_0xd691,0xe6));var _0x1d69=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0xd691[_0x27d0d8];return _0x2b79d1;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c45e2cc..9fe1798 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 1d30fd4..989f54d 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(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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(_0x14e2dc,_0x5f3535){var _0x1843c3=function(_0x56f5cc){while(--_0x56f5cc){_0x14e2dc['push'](_0x14e2dc['shift']());}};_0x1843c3(++_0x5f3535);}(_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 b910ffd..68f8765 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 _0xc908=['transaction','Voice','through','QueueId','penalty','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','removeAgents','Chat','Mail','Queue:remove','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','Team','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','send','getQueues','findOne','isValidChannel','channel','Unknown\x20channel','capitalize','Queue','pick','get','Queues','addQueues','ValidationError','add','toLowerCase','removeQueues','remove','addAgents','isArray','ids','Sms','Fax','Openchannel','Whatsapp'];(function(_0x426816,_0x2bb14d){var _0xa07c0b=function(_0x382cc6){while(--_0x382cc6){_0x426816['push'](_0x426816['shift']());}};_0xa07c0b(++_0x2bb14d);}(_0xc908,0x159));var _0x8c90=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0xc908[_0x467cb0];return _0x2153f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c90('0x0'));var zipdir=require(_0x8c90('0x1'));var jsonpatch=require(_0x8c90('0x2'));var rp=require(_0x8c90('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c90('0x4'));var util=require(_0x8c90('0x5'));var path=require(_0x8c90('0x6'));var sox=require('sox');var csv=require(_0x8c90('0x7'));var ejs=require(_0x8c90('0x8'));var fs=require('fs');var fs_extra=require(_0x8c90('0x9'));var _=require(_0x8c90('0xa'));var squel=require(_0x8c90('0xb'));var crypto=require(_0x8c90('0xc'));var jsforce=require(_0x8c90('0xd'));var deskjs=require(_0x8c90('0xe'));var toCsv=require(_0x8c90('0x7'));var querystring=require(_0x8c90('0xf'));var Papa=require(_0x8c90('0x10'));var Redis=require('ioredis');var authService=require(_0x8c90('0x11'));var qs=require(_0x8c90('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c90('0x13'));var logger=require('../../config/logger')(_0x8c90('0x14'));var utils=require('../../config/utils');var config=require(_0x8c90('0x15'));var licenseUtil=require(_0x8c90('0x16'));var db=require(_0x8c90('0x17'))['db'];config[_0x8c90('0x18')]=_[_0x8c90('0x19')](config[_0x8c90('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c90('0x1a'))(new Redis(config[_0x8c90('0x18')]));require(_0x8c90('0x1b'))[_0x8c90('0x1c')](socket);function respondWithStatusCode(_0x45243c,_0x3af84e){_0x3af84e=_0x3af84e||0xcc;return function(_0x20e184){if(_0x20e184){return _0x45243c['sendStatus'](_0x3af84e);}return _0x45243c[_0x8c90('0x1d')](_0x3af84e)['end']();};}function respondWithResult(_0x4dcec8,_0x53a5a4){_0x53a5a4=_0x53a5a4||0xc8;return function(_0x45bb5f){if(_0x45bb5f){return _0x4dcec8[_0x8c90('0x1d')](_0x53a5a4)[_0x8c90('0x1e')](_0x45bb5f);}};}function respondWithFilteredResult(_0x4e0731,_0x42f722){return function(_0x309be5){if(_0x309be5){var _0x3ab316=typeof _0x42f722[_0x8c90('0x1f')]===_0x8c90('0x20')&&typeof _0x42f722[_0x8c90('0x21')]==='undefined';var _0x185136=_0x309be5[_0x8c90('0x22')];var _0x13ef24=_0x3ab316?0x0:_0x42f722[_0x8c90('0x1f')];var _0x42a21d=_0x3ab316?_0x309be5[_0x8c90('0x22')]:_0x42f722[_0x8c90('0x1f')]+_0x42f722[_0x8c90('0x21')];var _0x1ffe46;if(_0x42a21d>=_0x185136){_0x42a21d=_0x185136;_0x1ffe46=0xc8;}else{_0x1ffe46=0xce;}_0x4e0731[_0x8c90('0x1d')](_0x1ffe46);return _0x4e0731[_0x8c90('0x23')](_0x8c90('0x24'),_0x13ef24+'-'+_0x42a21d+'/'+_0x185136)[_0x8c90('0x1e')](_0x309be5);}return null;};}function patchUpdates(_0x18a044){return function(_0x499153){try{jsonpatch[_0x8c90('0x25')](_0x499153,_0x18a044,!![]);}catch(_0x12b46b){return BPromise[_0x8c90('0x26')](_0x12b46b);}return _0x499153[_0x8c90('0x27')]();};}function saveUpdates(_0x11dd86,_0x112846){return function(_0x400b21){if(_0x400b21){return _0x400b21[_0x8c90('0x28')](_0x11dd86)[_0x8c90('0x29')](function(_0x1651fe){return _0x1651fe;});}return null;};}function handleEntityNotFound(_0x2b4fcf,_0x2ed9b0){return function(_0x3be13e){if(!_0x3be13e){_0x2b4fcf[_0x8c90('0x2a')](0x194);}return _0x3be13e;};}function handleError(_0x2271af,_0x268fd4){_0x268fd4=_0x268fd4||0x1f4;return function(_0x34b6b3){logger[_0x8c90('0x2b')](_0x34b6b3[_0x8c90('0x2c')]);if(_0x34b6b3['name']){delete _0x34b6b3[_0x8c90('0x2d')];}_0x2271af[_0x8c90('0x1d')](_0x268fd4)['send'](_0x34b6b3);};}exports[_0x8c90('0x2e')]=function(_0x1ba758,_0x1a7e4f){var _0x25a09f={},_0x1ad029={},_0x4efe3f={'count':0x0,'rows':[]};var _0x254f2c=_['map'](db[_0x8c90('0x2f')][_0x8c90('0x30')],function(_0x4fc38c){return{'name':_0x4fc38c['fieldName'],'type':_0x4fc38c['type'][_0x8c90('0x31')]};});_0x1ad029[_0x8c90('0x32')]=_[_0x8c90('0x33')](_0x254f2c,_0x8c90('0x2d'));_0x1ad029[_0x8c90('0x34')]=_[_0x8c90('0x35')](_0x1ba758[_0x8c90('0x34')]);_0x1ad029[_0x8c90('0x36')]=_[_0x8c90('0x37')](_0x1ad029[_0x8c90('0x32')],_0x1ad029[_0x8c90('0x34')]);_0x25a09f['attributes']=_[_0x8c90('0x37')](_0x1ad029[_0x8c90('0x32')],qs[_0x8c90('0x38')](_0x1ba758[_0x8c90('0x34')][_0x8c90('0x38')]));_0x25a09f['attributes']=_0x25a09f[_0x8c90('0x39')][_0x8c90('0x3a')]?_0x25a09f['attributes']:_0x1ad029[_0x8c90('0x32')];if(!_0x1ba758[_0x8c90('0x34')][_0x8c90('0x3b')]('nolimit')){_0x25a09f['limit']=qs['limit'](_0x1ba758[_0x8c90('0x34')]['limit']);_0x25a09f['offset']=qs['offset'](_0x1ba758[_0x8c90('0x34')][_0x8c90('0x1f')]);}_0x25a09f[_0x8c90('0x3c')]=qs['sort'](_0x1ba758['query'][_0x8c90('0x3d')]);_0x25a09f[_0x8c90('0x3e')]=qs['filters'](_['pick'](_0x1ba758[_0x8c90('0x34')],_0x1ad029[_0x8c90('0x36')]),_0x254f2c);if(_0x1ba758['query'][_0x8c90('0x3f')]){_0x25a09f[_0x8c90('0x3e')]=_['merge'](_0x25a09f['where'],{'$or':_['map'](_0x254f2c,function(_0xa71674){if(_0xa71674[_0x8c90('0x40')]!==_0x8c90('0x41')){var _0x548708={};_0x548708[_0xa71674[_0x8c90('0x2d')]]={'$like':'%'+_0x1ba758[_0x8c90('0x34')][_0x8c90('0x3f')]+'%'};return _0x548708;}})});}_0x25a09f=_[_0x8c90('0x42')]({},_0x25a09f,_0x1ba758[_0x8c90('0x43')]);var _0x2652c4={'where':_0x25a09f[_0x8c90('0x3e')]};return db[_0x8c90('0x2f')][_0x8c90('0x22')](_0x2652c4)[_0x8c90('0x29')](function(_0x3a9fcf){_0x4efe3f[_0x8c90('0x22')]=_0x3a9fcf;if(_0x1ba758[_0x8c90('0x34')][_0x8c90('0x44')]){_0x25a09f[_0x8c90('0x45')]=[{'all':!![]}];}return db['Team'][_0x8c90('0x46')](_0x25a09f);})[_0x8c90('0x29')](function(_0x19fb0a){_0x4efe3f['rows']=_0x19fb0a;return _0x4efe3f;})[_0x8c90('0x29')](respondWithFilteredResult(_0x1a7e4f,_0x25a09f))[_0x8c90('0x47')](handleError(_0x1a7e4f,null));};exports[_0x8c90('0x48')]=function(_0x429882,_0x76d7bf){var _0x202c36={'raw':![],'where':{'id':_0x429882[_0x8c90('0x49')]['id']}},_0x34c8c8={};_0x34c8c8[_0x8c90('0x32')]=_[_0x8c90('0x35')](db[_0x8c90('0x2f')][_0x8c90('0x30')]);_0x34c8c8[_0x8c90('0x34')]=_[_0x8c90('0x35')](_0x429882[_0x8c90('0x34')]);_0x34c8c8[_0x8c90('0x36')]=_[_0x8c90('0x37')](_0x34c8c8[_0x8c90('0x32')],_0x34c8c8[_0x8c90('0x34')]);_0x202c36[_0x8c90('0x39')]=_[_0x8c90('0x37')](_0x34c8c8[_0x8c90('0x32')],qs[_0x8c90('0x38')](_0x429882[_0x8c90('0x34')][_0x8c90('0x38')]));_0x202c36['attributes']=_0x202c36[_0x8c90('0x39')][_0x8c90('0x3a')]?_0x202c36['attributes']:_0x34c8c8[_0x8c90('0x32')];if(_0x429882[_0x8c90('0x34')][_0x8c90('0x44')]){_0x202c36[_0x8c90('0x45')]=[{'all':!![]}];}_0x202c36=_[_0x8c90('0x42')]({},_0x202c36,_0x429882[_0x8c90('0x43')]);return db[_0x8c90('0x2f')]['find'](_0x202c36)[_0x8c90('0x29')](handleEntityNotFound(_0x76d7bf,null))[_0x8c90('0x29')](respondWithResult(_0x76d7bf,null))[_0x8c90('0x47')](handleError(_0x76d7bf,null));};exports[_0x8c90('0x4a')]=function(_0x24bbb9,_0x381168){return db[_0x8c90('0x2f')]['create'](_0x24bbb9[_0x8c90('0x4b')],{})[_0x8c90('0x29')](function(_0x57b03e){var _0x4df57c=_0x24bbb9['user']['get']({'plain':!![]});if(!_0x4df57c)throw new Error(_0x8c90('0x4c'));if(_0x4df57c[_0x8c90('0x4d')]===_0x8c90('0x4e')){var _0x43b7c2=_0x57b03e['get']({'plain':!![]});var _0x5cd7be=_0x8c90('0x4f');return db['UserProfileSection'][_0x8c90('0x50')]({'where':{'name':_0x5cd7be,'userProfileId':_0x4df57c['userProfileId']},'raw':!![]})[_0x8c90('0x29')](function(_0x29a341){if(_0x29a341&&_0x29a341[_0x8c90('0x51')]===0x0){return db[_0x8c90('0x52')][_0x8c90('0x4a')]({'name':_0x43b7c2[_0x8c90('0x2d')],'resourceId':_0x43b7c2['id'],'type':_0x29a341[_0x8c90('0x2d')],'sectionId':_0x29a341['id']},{})['then'](function(){return _0x57b03e;});}else{return _0x57b03e;}})[_0x8c90('0x47')](function(_0x480625){logger[_0x8c90('0x2b')](_0x8c90('0x53'),_0x480625);throw _0x480625;});}return _0x57b03e;})[_0x8c90('0x29')](respondWithResult(_0x381168,0xc9))['catch'](handleError(_0x381168,null));};exports[_0x8c90('0x28')]=function(_0x349ee8,_0x52c52c){if(_0x349ee8['body']['id']){delete _0x349ee8[_0x8c90('0x4b')]['id'];}return db[_0x8c90('0x2f')][_0x8c90('0x50')]({'where':{'id':_0x349ee8[_0x8c90('0x49')]['id']}})['then'](handleEntityNotFound(_0x52c52c,null))['then'](saveUpdates(_0x349ee8['body'],null))['then'](respondWithResult(_0x52c52c,null))[_0x8c90('0x47')](handleError(_0x52c52c,null));};exports[_0x8c90('0x54')]=function(_0x4a0cfa,_0x51bed0){var _0x413db3=_0x4a0cfa[_0x8c90('0x49')]['id'];var _0x11db42=[];return db[_0x8c90('0x55')]['transaction'](function(_0x57640a){var _0xf4a6e1=_0x8c90('0x56')+_0x413db3;return db[_0x8c90('0x55')][_0x8c90('0x34')](_0xf4a6e1,{'type':db[_0x8c90('0x57')]['QueryTypes'][_0x8c90('0x58')],'raw':!![],'transaction':_0x57640a})[_0x8c90('0x29')](function(_0x2e6a4e){_0x11db42=_[_0x8c90('0x33')](_0x2e6a4e,function(_0x529036){return Number(_0x529036[_0x8c90('0x59')]);});})[_0x8c90('0x29')](function(){var _0x16eb2a=_0x8c90('0x5a')+_0x413db3;return db[_0x8c90('0x55')][_0x8c90('0x34')](_0x16eb2a,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')][_0x8c90('0x58')],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x2ee362){var _0x3dae78=_[_0x8c90('0x33')](_0x2ee362,function(_0x54693a){return Number(_0x54693a[_0x8c90('0x5c')]);});return db[_0x8c90('0x5d')][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'VoiceQueueId':{'$in':_0x3dae78}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x152d74=_0x8c90('0x5e')+_0x413db3;return db[_0x8c90('0x55')][_0x8c90('0x34')](_0x152d74,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')][_0x8c90('0x58')],'raw':!![],'transaction':_0x57640a});})['then'](function(_0x17bb27){var _0x20a06b=_[_0x8c90('0x33')](_0x17bb27,function(_0x1af402){return Number(_0x1af402[_0x8c90('0x5f')]);});return db['UserMailQueue'][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'MailQueueId':{'$in':_0x20a06b}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x1fd626=_0x8c90('0x60')+_0x413db3;return db[_0x8c90('0x55')]['query'](_0x1fd626,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')][_0x8c90('0x58')],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x4fa689){var _0x240269=_[_0x8c90('0x33')](_0x4fa689,function(_0x2be646){return Number(_0x2be646[_0x8c90('0x61')]);});return db['UserSmsQueue'][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'SmsQueueId':{'$in':_0x240269}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x39b85d='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x413db3;return db[_0x8c90('0x55')][_0x8c90('0x34')](_0x39b85d,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')]['SELECT'],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x523ee6){var _0x2a0f07=_['map'](_0x523ee6,function(_0x3e821c){return Number(_0x3e821c[_0x8c90('0x62')]);});return db['UserChatQueue'][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'ChatQueueId':{'$in':_0x2a0f07}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x22311a=_0x8c90('0x63')+_0x413db3;return db['sequelize']['query'](_0x22311a,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')][_0x8c90('0x58')],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x3eb268){var _0xe64a05=_[_0x8c90('0x33')](_0x3eb268,function(_0x42b4e5){return Number(_0x42b4e5[_0x8c90('0x64')]);});return db[_0x8c90('0x65')][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'FaxQueueId':{'$in':_0xe64a05}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x1aa843=_0x8c90('0x66')+_0x413db3;return db[_0x8c90('0x55')][_0x8c90('0x34')](_0x1aa843,{'type':db[_0x8c90('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x541da8){var _0x5b4c63=_[_0x8c90('0x33')](_0x541da8,function(_0x2b63c7){return Number(_0x2b63c7[_0x8c90('0x67')]);});return db[_0x8c90('0x68')][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'OpenchannelQueueId':{'$in':_0x5b4c63}},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){var _0x5d4f57='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x413db3;return db[_0x8c90('0x55')]['query'](_0x5d4f57,{'type':db[_0x8c90('0x57')][_0x8c90('0x5b')]['SELECT'],'raw':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x170d0a){var _0x385dd7=_[_0x8c90('0x33')](_0x170d0a,function(_0x52d722){return Number(_0x52d722[_0x8c90('0x69')]);});return db[_0x8c90('0x6a')][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'WhatsappQueueId':{'$in':_0x385dd7}},'transaction':_0x57640a});})['then'](function(){return db[_0x8c90('0x6b')][_0x8c90('0x50')]({'where':{'TeamId':_0x413db3}});})[_0x8c90('0x29')](function(_0x49d62d){if(_0x49d62d===null){return;}return db[_0x8c90('0x6c')][_0x8c90('0x54')]({'where':{'UserId':{'$in':_0x11db42},'VoicePrefixId':_0x49d62d[_0x8c90('0x6d')]},'transaction':_0x57640a});})[_0x8c90('0x29')](function(){return db['Team'][_0x8c90('0x54')]({'where':{'id':_0x413db3},'cascade':!![],'transaction':_0x57640a});})[_0x8c90('0x29')](function(_0x3eddfc){if(_0x3eddfc===0x0){_0x51bed0[_0x8c90('0x2a')](0x194);}else{return db[_0x8c90('0x52')]['destroy']({'where':{'type':_0x8c90('0x4f'),'resourceId':_0x413db3},'cascade':!![],'transaction':_0x57640a})[_0x8c90('0x29')](function(){_0x51bed0[_0x8c90('0x1d')](0xcc)[_0x8c90('0x6e')]();});}})[_0x8c90('0x47')](function(_0x1bba79){_0x51bed0[_0x8c90('0x1d')](0x1f4)[_0x8c90('0x6f')](_0x1bba79);});});};exports[_0x8c90('0x70')]=function(_0x4404f0,_0x564760,_0x3c7cf1){return db[_0x8c90('0x2f')][_0x8c90('0x71')]({'where':{'id':_0x4404f0[_0x8c90('0x49')]['id']}})[_0x8c90('0x29')](handleEntityNotFound(_0x564760,null))[_0x8c90('0x29')](function(_0x2b1c74){if(!_0x4404f0[_0x8c90('0x34')]['channel']||!utils[_0x8c90('0x72')](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x73')])){throw new db['Sequelize']['ValidationError'](_0x8c90('0x74'));}var _0x4a4ffa={};var _0x25b740={};_0x25b740[_0x8c90('0x32')]=_[_0x8c90('0x35')](db[_[_0x8c90('0x75')](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x73')]['toLowerCase']())+_0x8c90('0x76')][_0x8c90('0x30')]);_0x25b740[_0x8c90('0x34')]=_[_0x8c90('0x35')](_0x4404f0[_0x8c90('0x34')]);_0x25b740[_0x8c90('0x36')]=_[_0x8c90('0x37')](_0x25b740[_0x8c90('0x32')],_0x25b740[_0x8c90('0x34')]);_0x4a4ffa['attributes']=_[_0x8c90('0x37')](_0x25b740[_0x8c90('0x32')],qs[_0x8c90('0x38')](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x38')]));_0x4a4ffa[_0x8c90('0x39')]=_0x4a4ffa[_0x8c90('0x39')][_0x8c90('0x3a')]?_0x4a4ffa[_0x8c90('0x39')]:_0x25b740[_0x8c90('0x32')];_0x4a4ffa[_0x8c90('0x21')]=qs['limit'](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x21')]);_0x4a4ffa['offset']=qs[_0x8c90('0x1f')](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x1f')]);_0x4a4ffa[_0x8c90('0x3c')]=qs[_0x8c90('0x3d')](_0x4404f0[_0x8c90('0x34')][_0x8c90('0x3d')]);_0x4a4ffa[_0x8c90('0x3e')]=qs[_0x8c90('0x36')](_[_0x8c90('0x77')](_0x4404f0[_0x8c90('0x34')],_0x25b740[_0x8c90('0x36')]));_0x4a4ffa=_[_0x8c90('0x42')]({},_0x4a4ffa,_0x4404f0[_0x8c90('0x43')]);return _0x2b1c74[_0x8c90('0x78')+_[_0x8c90('0x75')](_0x4404f0['query'][_0x8c90('0x73')]['toLowerCase']())+_0x8c90('0x79')](_0x4a4ffa);})[_0x8c90('0x29')](respondWithResult(_0x564760,null))[_0x8c90('0x47')](handleError(_0x564760,null));};exports[_0x8c90('0x7a')]=function(_0x468880,_0x94b638,_0x4536ad){return db[_0x8c90('0x2f')]['findOne']({'where':{'id':_0x468880[_0x8c90('0x49')]['id']}})['then'](function(_0x17ac18){if(_0x17ac18){if(!_0x468880[_0x8c90('0x4b')][_0x8c90('0x73')]||!utils[_0x8c90('0x72')](_0x468880[_0x8c90('0x4b')]['channel'])){throw new db[(_0x8c90('0x57'))][(_0x8c90('0x7b'))](_0x8c90('0x74'));}return _0x17ac18[_0x8c90('0x7c')+_[_0x8c90('0x75')](_0x468880[_0x8c90('0x4b')][_0x8c90('0x73')][_0x8c90('0x7d')]())+_0x8c90('0x79')](_0x468880['body']['ids']);}return null;})[_0x8c90('0x29')](handleEntityNotFound(_0x94b638,null))[_0x8c90('0x29')](respondWithStatusCode(_0x94b638,null))[_0x8c90('0x47')](handleError(_0x94b638,null));};exports[_0x8c90('0x7e')]=function(_0x126f47,_0xee412d,_0xc185ea){return db['Team']['findOne']({'where':{'id':_0x126f47['params']['id']}})[_0x8c90('0x29')](function(_0x482f8c){if(_0x482f8c){if(!_0x126f47['query'][_0x8c90('0x73')]||!utils[_0x8c90('0x72')](_0x126f47['query'][_0x8c90('0x73')])){throw new db['Sequelize'][(_0x8c90('0x7b'))](_0x8c90('0x74'));}return _0x482f8c[_0x8c90('0x7f')+_['capitalize'](_0x126f47['query'][_0x8c90('0x73')][_0x8c90('0x7d')]())+_0x8c90('0x79')](_0x126f47[_0x8c90('0x34')]['ids']);}return null;})[_0x8c90('0x29')](handleEntityNotFound(_0xee412d,null))[_0x8c90('0x29')](respondWithStatusCode(_0xee412d,null))[_0x8c90('0x47')](handleError(_0xee412d,null));};exports[_0x8c90('0x80')]=function(_0x31fd7c,_0x46a5ef){var _0x54705f=_[_0x8c90('0x81')](_0x31fd7c[_0x8c90('0x4b')][_0x8c90('0x82')])?_0x31fd7c[_0x8c90('0x4b')]['ids']:[_0x31fd7c['body']['ids']];var _0x1a9e66=_0x31fd7c[_0x8c90('0x49')]['id'];return db['Team'][_0x8c90('0x50')]({'where':{'id':_0x1a9e66}})[_0x8c90('0x29')](handleEntityNotFound(_0x46a5ef,null))[_0x8c90('0x29')](function(_0x40507c){if(_0x40507c){var _0x204695=['Voice','Chat','Mail',_0x8c90('0x83'),_0x8c90('0x84'),_0x8c90('0x85'),_0x8c90('0x86')];return db[_0x8c90('0x55')][_0x8c90('0x87')](function(_0x5d8ac7){var _0x18e4cd=_['map'](_0x204695,function(_0x4a846d){var _0x4942f8={'attributes':['id','name']};if(_0x4a846d===_0x8c90('0x88')){_0x4942f8[_0x8c90('0x89')]={'attributes':['penalty']};}return _0x40507c[_0x8c90('0x78')+_0x4a846d+_0x8c90('0x79')](_0x4942f8)[_0x8c90('0x29')](function(_0xef018e){var _0x23ea48=_[_0x8c90('0x33')](_0xef018e,function(_0x397f57){var _0x43068c=_['map'](_0x54705f,function(_0x412b04){var _0x26cf13={'where':{'UserId':_0x412b04,[_0x4a846d+_0x8c90('0x8a')]:_0x397f57['id']},'transaction':_0x5d8ac7};if(_0x4a846d===_0x8c90('0x88')){_0x26cf13[_0x8c90('0x19')]={'penalty':_0x397f57['TeamVoiceQueue'][_0x8c90('0x8b')]};}return db[_0x8c90('0x8c')+_0x4a846d+_0x8c90('0x76')]['findOrCreate'](_0x26cf13)[_0x8c90('0x29')](function(){socket[_0x8c90('0x8d')](_0x8c90('0x4e')+_0x4a846d+_0x8c90('0x8e'),{'UserId':_0x412b04,[_0x4a846d+_0x8c90('0x8a')]:_0x397f57['id']});if(_0x4a846d!=='Voice'){return;}return db[_0x8c90('0x8c')][_0x8c90('0x46')]({'where':{'id':_0x54705f,'online':0x1},'attributes':['id',_0x8c90('0x2d'),_0x8c90('0x8f'),_0x8c90('0x90'),_0x8c90('0x91')],'raw':!![]})[_0x8c90('0x29')](function(_0x384f4e){var _0x5e972b=_[_0x8c90('0x33')](_0x384f4e,function(_0x3ea5e7){return db[_0x8c90('0x92')][_0x8c90('0x93')]({'membername':_0x3ea5e7[_0x8c90('0x2d')],'UserId':_0x3ea5e7['id'],'queue_name':_0x397f57['name'],'VoiceQueueId':_0x397f57['id'],'interface':_[_0x8c90('0x94')](_0x3ea5e7[_0x8c90('0x91')])?util[_0x8c90('0x95')](_0x8c90('0x96'),_0x3ea5e7['name']):_0x3ea5e7[_0x8c90('0x91')],'paused':_0x3ea5e7[_0x8c90('0x90')]||![],'penalty':_0x397f57[_0x8c90('0x97')]['penalty']},{'transaction':_0x5d8ac7});});return Promise[_0x8c90('0x98')](_0x5e972b);});});});return Promise[_0x8c90('0x98')](_0x43068c);});return Promise[_0x8c90('0x98')](_0x23ea48);})[_0x8c90('0x29')](function(){return db[_0x8c90('0x6b')][_0x8c90('0x71')]({'where':{'teamId':_0x1a9e66}})[_0x8c90('0x29')](function(_0x50e26f){if(_0x50e26f){var _0x5de4fc=_[_0x8c90('0x33')](_0x54705f,function(_0x4c7a31){db[_0x8c90('0x6c')]['upsert']({'UserId':_0x4c7a31,'VoicePrefixId':_0x50e26f[_0x8c90('0x6d')]});});return Promise[_0x8c90('0x98')](_0x5de4fc);}});});});return Promise[_0x8c90('0x98')](_0x18e4cd)['then'](function(){return _0x40507c[_0x8c90('0x80')](_0x54705f,{'transaction':_0x5d8ac7})[_0x8c90('0x99')](function(_0x390667){return _0x390667;});});});}})[_0x8c90('0x29')](respondWithResult(_0x46a5ef,null))[_0x8c90('0x47')](handleError(_0x46a5ef,null));};exports[_0x8c90('0x9a')]=function(_0x1f21df,_0x46345f){var _0x29b5ec=_['isArray'](_0x1f21df['query'][_0x8c90('0x82')])?_0x1f21df[_0x8c90('0x34')][_0x8c90('0x82')]:[_0x1f21df[_0x8c90('0x34')][_0x8c90('0x82')]];var _0x188f5a=_0x1f21df[_0x8c90('0x49')]['id'];return db[_0x8c90('0x2f')]['find']({'where':{'id':_0x188f5a}})['then'](handleEntityNotFound(_0x46345f,null))['then'](function(_0x2aa7ac){if(_0x2aa7ac){var _0x22e412=[_0x8c90('0x88'),_0x8c90('0x9b'),_0x8c90('0x9c'),_0x8c90('0x83'),'Fax',_0x8c90('0x85'),_0x8c90('0x86')];return db[_0x8c90('0x55')]['transaction'](function(_0x1c7961){var _0x32a993=_['map'](_0x22e412,function(_0x414ad2){var _0x56bb92={'attributes':['id',_0x8c90('0x2d')]};return _0x2aa7ac[_0x8c90('0x78')+_0x414ad2+_0x8c90('0x79')](_0x56bb92)[_0x8c90('0x29')](function(_0x4d5b02){var _0x187bd5=_[_0x8c90('0x33')](_0x4d5b02,function(_0x16813d){return _0x16813d[_0x8c90('0x9a')](_0x29b5ec,{'transaction':_0x1c7961})[_0x8c90('0x29')](function(){var _0x4121c7=_[_0x8c90('0x33')](_0x29b5ec,function(_0x15590d){socket[_0x8c90('0x8d')](_0x8c90('0x4e')+_0x414ad2+_0x8c90('0x9d'),{'UserId':Number(_0x15590d),[_0x414ad2+'QueueId']:_0x16813d['id']});if(_0x414ad2!==_0x8c90('0x88')){return;}return db[_0x8c90('0x92')]['destroy']({'where':{'VoiceQueueId':_0x16813d['id'],'UserId':_0x15590d},'transaction':_0x1c7961});});return Promise['all'](_0x4121c7);});});return Promise['all'](_0x187bd5);});});return Promise[_0x8c90('0x98')](_0x32a993)['then'](function(){return _0x2aa7ac['removeAgents'](_0x29b5ec,{'transaction':_0x1c7961});})['then'](function(){return db[_0x8c90('0x6b')]['findOne']({'where':{'teamId':_0x188f5a}})[_0x8c90('0x29')](function(_0x121094){if(_0x121094){var _0x44af8a=_[_0x8c90('0x33')](_0x29b5ec,function(_0xa28e3b){db[_0x8c90('0x6c')][_0x8c90('0x54')]({'where':{'UserId':_0xa28e3b,'VoicePrefixId':_0x121094[_0x8c90('0x6d')]}});});return Promise[_0x8c90('0x98')](_0x44af8a);}});});});}})[_0x8c90('0x29')](respondWithStatusCode(_0x46345f,null))[_0x8c90('0x47')](handleError(_0x46345f,null));};exports[_0x8c90('0x9e')]=function(_0x40f3f1,_0x58b709,_0x2fdd3c){var _0x4c0ab0={};var _0x431d6e={};var _0x58eb08;var _0x263fd2;return db[_0x8c90('0x2f')][_0x8c90('0x71')]({'where':{'id':_0x40f3f1[_0x8c90('0x49')]['id']}})[_0x8c90('0x29')](handleEntityNotFound(_0x58b709,null))[_0x8c90('0x29')](function(_0x5b50c7){if(_0x5b50c7){_0x58eb08=_0x5b50c7;_0x431d6e[_0x8c90('0x32')]=_['keys'](db[_0x8c90('0x8c')][_0x8c90('0x30')]);_0x431d6e[_0x8c90('0x34')]=_[_0x8c90('0x35')](_0x40f3f1[_0x8c90('0x34')]);_0x431d6e[_0x8c90('0x36')]=_[_0x8c90('0x37')](_0x431d6e[_0x8c90('0x32')],_0x431d6e['query']);_0x4c0ab0[_0x8c90('0x39')]=_[_0x8c90('0x37')](_0x431d6e[_0x8c90('0x32')],qs[_0x8c90('0x38')](_0x40f3f1['query'][_0x8c90('0x38')]));_0x4c0ab0['attributes']=_0x4c0ab0['attributes'][_0x8c90('0x3a')]?_0x4c0ab0[_0x8c90('0x39')]:_0x431d6e[_0x8c90('0x32')];_0x4c0ab0[_0x8c90('0x3c')]=qs['sort'](_0x40f3f1['query'][_0x8c90('0x3d')]);_0x4c0ab0['where']=qs['filters'](_[_0x8c90('0x77')](_0x40f3f1['query'],_0x431d6e[_0x8c90('0x36')]));if(_0x40f3f1['query'][_0x8c90('0x3f')]){_0x4c0ab0[_0x8c90('0x3e')]=_[_0x8c90('0x42')](_0x4c0ab0[_0x8c90('0x3e')],{'$or':_['map'](_0x4c0ab0['attributes'],function(_0x549128){var _0x5056d1={};_0x5056d1[_0x549128]={'$like':'%'+_0x40f3f1[_0x8c90('0x34')][_0x8c90('0x3f')]+'%'};return _0x5056d1;})});}_0x4c0ab0=_['merge']({},_0x4c0ab0,_0x40f3f1[_0x8c90('0x43')]);return _0x58eb08['getAgents'](_0x4c0ab0);}})[_0x8c90('0x29')](function(_0x384693){if(_0x384693){_0x263fd2=_0x384693[_0x8c90('0x3a')];if(!_0x40f3f1[_0x8c90('0x34')][_0x8c90('0x3b')](_0x8c90('0x9f'))){_0x4c0ab0[_0x8c90('0x21')]=qs[_0x8c90('0x21')](_0x40f3f1['query'][_0x8c90('0x21')]);_0x4c0ab0['offset']=qs[_0x8c90('0x1f')](_0x40f3f1[_0x8c90('0x34')]['offset']);}return _0x58eb08[_0x8c90('0x9e')](_0x4c0ab0);}})['then'](function(_0x48d247){if(_0x48d247){return _0x48d247?{'count':_0x263fd2,'rows':_0x48d247}:null;}})[_0x8c90('0x29')](respondWithResult(_0x58b709,null))[_0x8c90('0x47')](handleError(_0x58b709,null));}; \ No newline at end of file +var _0x6a37=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','Team','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','type','VIRTUAL','options','where','include','rows','catch','show','params','rawAttributes','includeAll','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','autoAssociation','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','QueryTypes','SELECT','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','UserProfileResource','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','add','ids','removeQueues','remove','Queues','addAgents','isArray','Voice','Chat','Mail','Fax','Whatsapp','through','penalty','QueueId','User','findOrCreate','emit','findAll','online','voicePause','interface','upsert','format','SIP/%s','all','removeAgents','Sms','Openchannel','UserVoiceQueueRt','getAgents','hasOwnProperty','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x6a37,0x1ab));var _0x76a3=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x6a37[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76a3('0x1'));var BPromise=require(_0x76a3('0x2'));var Mustache=require(_0x76a3('0x3'));var util=require(_0x76a3('0x4'));var path=require(_0x76a3('0x5'));var sox=require(_0x76a3('0x6'));var csv=require('to-csv');var ejs=require(_0x76a3('0x7'));var fs=require('fs');var fs_extra=require(_0x76a3('0x8'));var _=require(_0x76a3('0x9'));var squel=require('squel');var crypto=require(_0x76a3('0xa'));var jsforce=require(_0x76a3('0xb'));var deskjs=require(_0x76a3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x76a3('0xd'));var Papa=require(_0x76a3('0xe'));var Redis=require('ioredis');var authService=require(_0x76a3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x76a3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76a3('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x76a3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x76a3('0x13'))['db'];config[_0x76a3('0x14')]=_[_0x76a3('0x15')](config[_0x76a3('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x76a3('0x16'))(new Redis(config['redis']));require('./team.socket')[_0x76a3('0x17')](socket);function respondWithStatusCode(_0x57029d,_0x376987){_0x376987=_0x376987||0xcc;return function(_0x131d15){if(_0x131d15){return _0x57029d[_0x76a3('0x18')](_0x376987);}return _0x57029d[_0x76a3('0x19')](_0x376987)[_0x76a3('0x1a')]();};}function respondWithResult(_0x5f51d7,_0x3644e5){_0x3644e5=_0x3644e5||0xc8;return function(_0x1bd86c){if(_0x1bd86c){return _0x5f51d7['status'](_0x3644e5)[_0x76a3('0x1b')](_0x1bd86c);}};}function respondWithFilteredResult(_0x4ee582,_0x65f9a6){return function(_0x2557ae){if(_0x2557ae){var _0x2f20be=typeof _0x65f9a6[_0x76a3('0x1c')]===_0x76a3('0x1d')&&typeof _0x65f9a6[_0x76a3('0x1e')]===_0x76a3('0x1d');var _0x3a858c=_0x2557ae[_0x76a3('0x1f')];var _0x4ede7d=_0x2f20be?0x0:_0x65f9a6[_0x76a3('0x1c')];var _0xa980da=_0x2f20be?_0x2557ae[_0x76a3('0x1f')]:_0x65f9a6[_0x76a3('0x1c')]+_0x65f9a6['limit'];var _0x137847;if(_0xa980da>=_0x3a858c){_0xa980da=_0x3a858c;_0x137847=0xc8;}else{_0x137847=0xce;}_0x4ee582[_0x76a3('0x19')](_0x137847);return _0x4ee582[_0x76a3('0x20')](_0x76a3('0x21'),_0x4ede7d+'-'+_0xa980da+'/'+_0x3a858c)[_0x76a3('0x1b')](_0x2557ae);}return null;};}function patchUpdates(_0x33a2c3){return function(_0x46fd67){try{jsonpatch[_0x76a3('0x22')](_0x46fd67,_0x33a2c3,!![]);}catch(_0x568246){return BPromise[_0x76a3('0x23')](_0x568246);}return _0x46fd67[_0x76a3('0x24')]();};}function saveUpdates(_0xae57e6,_0x4b77b7){return function(_0x550520){if(_0x550520){return _0x550520[_0x76a3('0x25')](_0xae57e6)[_0x76a3('0x26')](function(_0x3a0aef){return _0x3a0aef;});}return null;};}function handleEntityNotFound(_0x3d26df,_0xe65015){return function(_0x1cbb37){if(!_0x1cbb37){_0x3d26df[_0x76a3('0x18')](0x194);}return _0x1cbb37;};}function handleError(_0x51d9be,_0x58c19c){_0x58c19c=_0x58c19c||0x1f4;return function(_0x1abe94){logger[_0x76a3('0x27')](_0x1abe94[_0x76a3('0x28')]);if(_0x1abe94[_0x76a3('0x29')]){delete _0x1abe94[_0x76a3('0x29')];}_0x51d9be[_0x76a3('0x19')](_0x58c19c)[_0x76a3('0x2a')](_0x1abe94);};}exports['index']=function(_0x49a09c,_0x2db25e){var _0x18cc33={},_0x19baaa={},_0x14e035={'count':0x0,'rows':[]};var _0x1db288=_[_0x76a3('0x2b')](db[_0x76a3('0x2c')]['rawAttributes'],function(_0x3f3eda){return{'name':_0x3f3eda[_0x76a3('0x2d')],'type':_0x3f3eda['type']['key']};});_0x19baaa[_0x76a3('0x2e')]=_[_0x76a3('0x2b')](_0x1db288,'name');_0x19baaa[_0x76a3('0x2f')]=_[_0x76a3('0x30')](_0x49a09c['query']);_0x19baaa[_0x76a3('0x31')]=_[_0x76a3('0x32')](_0x19baaa['model'],_0x19baaa[_0x76a3('0x2f')]);_0x18cc33[_0x76a3('0x33')]=_[_0x76a3('0x32')](_0x19baaa[_0x76a3('0x2e')],qs['fields'](_0x49a09c[_0x76a3('0x2f')][_0x76a3('0x34')]));_0x18cc33[_0x76a3('0x33')]=_0x18cc33[_0x76a3('0x33')][_0x76a3('0x35')]?_0x18cc33[_0x76a3('0x33')]:_0x19baaa['model'];if(!_0x49a09c[_0x76a3('0x2f')]['hasOwnProperty'](_0x76a3('0x36'))){_0x18cc33[_0x76a3('0x1e')]=qs['limit'](_0x49a09c[_0x76a3('0x2f')][_0x76a3('0x1e')]);_0x18cc33['offset']=qs[_0x76a3('0x1c')](_0x49a09c['query']['offset']);}_0x18cc33['order']=qs[_0x76a3('0x37')](_0x49a09c[_0x76a3('0x2f')][_0x76a3('0x37')]);_0x18cc33['where']=qs[_0x76a3('0x31')](_[_0x76a3('0x38')](_0x49a09c['query'],_0x19baaa[_0x76a3('0x31')]),_0x1db288);if(_0x49a09c[_0x76a3('0x2f')][_0x76a3('0x39')]){_0x18cc33['where']=_['merge'](_0x18cc33['where'],{'$or':_['map'](_0x1db288,function(_0x54c464){if(_0x54c464[_0x76a3('0x3a')]!==_0x76a3('0x3b')){var _0x496cc4={};_0x496cc4[_0x54c464[_0x76a3('0x29')]]={'$like':'%'+_0x49a09c[_0x76a3('0x2f')][_0x76a3('0x39')]+'%'};return _0x496cc4;}})});}_0x18cc33=_['merge']({},_0x18cc33,_0x49a09c[_0x76a3('0x3c')]);var _0xe0fd85={'where':_0x18cc33[_0x76a3('0x3d')]};return db[_0x76a3('0x2c')][_0x76a3('0x1f')](_0xe0fd85)[_0x76a3('0x26')](function(_0x54e9dc){_0x14e035['count']=_0x54e9dc;if(_0x49a09c[_0x76a3('0x2f')]['includeAll']){_0x18cc33[_0x76a3('0x3e')]=[{'all':!![]}];}return db[_0x76a3('0x2c')]['findAll'](_0x18cc33);})[_0x76a3('0x26')](function(_0x4db73e){_0x14e035[_0x76a3('0x3f')]=_0x4db73e;return _0x14e035;})[_0x76a3('0x26')](respondWithFilteredResult(_0x2db25e,_0x18cc33))[_0x76a3('0x40')](handleError(_0x2db25e,null));};exports[_0x76a3('0x41')]=function(_0x216dc9,_0x19207a){var _0x552168={'raw':![],'where':{'id':_0x216dc9[_0x76a3('0x42')]['id']}},_0x168193={};_0x168193[_0x76a3('0x2e')]=_[_0x76a3('0x30')](db['Team'][_0x76a3('0x43')]);_0x168193[_0x76a3('0x2f')]=_[_0x76a3('0x30')](_0x216dc9[_0x76a3('0x2f')]);_0x168193[_0x76a3('0x31')]=_['intersection'](_0x168193[_0x76a3('0x2e')],_0x168193[_0x76a3('0x2f')]);_0x552168['attributes']=_[_0x76a3('0x32')](_0x168193[_0x76a3('0x2e')],qs['fields'](_0x216dc9[_0x76a3('0x2f')][_0x76a3('0x34')]));_0x552168[_0x76a3('0x33')]=_0x552168['attributes'][_0x76a3('0x35')]?_0x552168[_0x76a3('0x33')]:_0x168193[_0x76a3('0x2e')];if(_0x216dc9['query'][_0x76a3('0x44')]){_0x552168[_0x76a3('0x3e')]=[{'all':!![]}];}_0x552168=_[_0x76a3('0x45')]({},_0x552168,_0x216dc9[_0x76a3('0x3c')]);return db[_0x76a3('0x2c')]['find'](_0x552168)[_0x76a3('0x26')](handleEntityNotFound(_0x19207a,null))[_0x76a3('0x26')](respondWithResult(_0x19207a,null))[_0x76a3('0x40')](handleError(_0x19207a,null));};exports[_0x76a3('0x46')]=function(_0x8d84a9,_0xbc029){return db[_0x76a3('0x2c')][_0x76a3('0x46')](_0x8d84a9[_0x76a3('0x47')],{})[_0x76a3('0x26')](function(_0x15fd33){var _0x5a4394=_0x8d84a9[_0x76a3('0x48')][_0x76a3('0x49')]({'plain':!![]});if(!_0x5a4394)throw new Error(_0x76a3('0x4a'));if(_0x5a4394[_0x76a3('0x4b')]===_0x76a3('0x48')){var _0x5426e1=_0x15fd33[_0x76a3('0x49')]({'plain':!![]});var _0x5aa1db=_0x76a3('0x4c');return db['UserProfileSection'][_0x76a3('0x4d')]({'where':{'name':_0x5aa1db,'userProfileId':_0x5a4394[_0x76a3('0x4e')]},'raw':!![]})[_0x76a3('0x26')](function(_0x3bc268){if(_0x3bc268&&_0x3bc268[_0x76a3('0x4f')]===0x0){return db['UserProfileResource'][_0x76a3('0x46')]({'name':_0x5426e1[_0x76a3('0x29')],'resourceId':_0x5426e1['id'],'type':_0x3bc268['name'],'sectionId':_0x3bc268['id']},{})[_0x76a3('0x26')](function(){return _0x15fd33;});}else{return _0x15fd33;}})[_0x76a3('0x40')](function(_0x2ec424){logger[_0x76a3('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ec424);throw _0x2ec424;});}return _0x15fd33;})[_0x76a3('0x26')](respondWithResult(_0xbc029,0xc9))['catch'](handleError(_0xbc029,null));};exports[_0x76a3('0x25')]=function(_0x2e71e1,_0x199cfd){if(_0x2e71e1[_0x76a3('0x47')]['id']){delete _0x2e71e1[_0x76a3('0x47')]['id'];}return db['Team'][_0x76a3('0x4d')]({'where':{'id':_0x2e71e1[_0x76a3('0x42')]['id']}})['then'](handleEntityNotFound(_0x199cfd,null))[_0x76a3('0x26')](saveUpdates(_0x2e71e1[_0x76a3('0x47')],null))[_0x76a3('0x26')](respondWithResult(_0x199cfd,null))[_0x76a3('0x40')](handleError(_0x199cfd,null));};exports[_0x76a3('0x50')]=function(_0x3abc2a,_0x2477f3){var _0x4203d8=_0x3abc2a[_0x76a3('0x42')]['id'];var _0x3843e7=[];return db[_0x76a3('0x51')][_0x76a3('0x52')](function(_0x2e2ea0){var _0x46ab8d=_0x76a3('0x53')+_0x4203d8;return db[_0x76a3('0x51')][_0x76a3('0x2f')](_0x46ab8d,{'type':db[_0x76a3('0x54')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2e2ea0})[_0x76a3('0x26')](function(_0x349900){_0x3843e7=_['map'](_0x349900,function(_0x4fab52){return Number(_0x4fab52[_0x76a3('0x55')]);});})[_0x76a3('0x26')](function(){var _0x4b4c1e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4203d8;return db[_0x76a3('0x51')][_0x76a3('0x2f')](_0x4b4c1e,{'type':db[_0x76a3('0x54')][_0x76a3('0x56')][_0x76a3('0x57')],'raw':!![],'transaction':_0x2e2ea0});})['then'](function(_0x122470){var _0x15e816=_[_0x76a3('0x2b')](_0x122470,function(_0x401c14){return Number(_0x401c14[_0x76a3('0x58')]);});return db[_0x76a3('0x59')]['destroy']({'where':{'UserId':{'$in':_0x3843e7},'VoiceQueueId':{'$in':_0x15e816}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x584173='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4203d8;return db[_0x76a3('0x51')][_0x76a3('0x2f')](_0x584173,{'type':db[_0x76a3('0x54')]['QueryTypes'][_0x76a3('0x57')],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0x4273a8){var _0x2c79fe=_[_0x76a3('0x2b')](_0x4273a8,function(_0x52f0cd){return Number(_0x52f0cd[_0x76a3('0x5a')]);});return db[_0x76a3('0x5b')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'MailQueueId':{'$in':_0x2c79fe}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x21f368=_0x76a3('0x5c')+_0x4203d8;return db['sequelize']['query'](_0x21f368,{'type':db['Sequelize'][_0x76a3('0x56')]['SELECT'],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0x56be24){var _0x361387=_[_0x76a3('0x2b')](_0x56be24,function(_0x1edbe5){return Number(_0x1edbe5[_0x76a3('0x5d')]);});return db[_0x76a3('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x3843e7},'SmsQueueId':{'$in':_0x361387}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x27e0fe=_0x76a3('0x5f')+_0x4203d8;return db['sequelize'][_0x76a3('0x2f')](_0x27e0fe,{'type':db['Sequelize']['QueryTypes'][_0x76a3('0x57')],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0x43eb6b){var _0x81e997=_[_0x76a3('0x2b')](_0x43eb6b,function(_0x451ea3){return Number(_0x451ea3[_0x76a3('0x60')]);});return db[_0x76a3('0x61')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'ChatQueueId':{'$in':_0x81e997}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x5edd4f=_0x76a3('0x62')+_0x4203d8;return db[_0x76a3('0x51')][_0x76a3('0x2f')](_0x5edd4f,{'type':db[_0x76a3('0x54')][_0x76a3('0x56')]['SELECT'],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0xec38cd){var _0x171be7=_['map'](_0xec38cd,function(_0x322ea5){return Number(_0x322ea5[_0x76a3('0x63')]);});return db[_0x76a3('0x64')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'FaxQueueId':{'$in':_0x171be7}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x5f22d8=_0x76a3('0x65')+_0x4203d8;return db[_0x76a3('0x51')][_0x76a3('0x2f')](_0x5f22d8,{'type':db[_0x76a3('0x54')][_0x76a3('0x56')][_0x76a3('0x57')],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0x5761ac){var _0x58b005=_[_0x76a3('0x2b')](_0x5761ac,function(_0x3a6de6){return Number(_0x3a6de6[_0x76a3('0x66')]);});return db[_0x76a3('0x67')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'OpenchannelQueueId':{'$in':_0x58b005}},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){var _0x49feea=_0x76a3('0x68')+_0x4203d8;return db['sequelize'][_0x76a3('0x2f')](_0x49feea,{'type':db['Sequelize'][_0x76a3('0x56')]['SELECT'],'raw':!![],'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(_0x5a6ee5){var _0x12fb1b=_[_0x76a3('0x2b')](_0x5a6ee5,function(_0x1b275a){return Number(_0x1b275a[_0x76a3('0x69')]);});return db[_0x76a3('0x6a')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'WhatsappQueueId':{'$in':_0x12fb1b}},'transaction':_0x2e2ea0});})['then'](function(){return db[_0x76a3('0x6b')]['find']({'where':{'TeamId':_0x4203d8}});})[_0x76a3('0x26')](function(_0x34f0a6){if(_0x34f0a6===null){return;}return db[_0x76a3('0x6c')][_0x76a3('0x50')]({'where':{'UserId':{'$in':_0x3843e7},'VoicePrefixId':_0x34f0a6['VoicePrefixId']},'transaction':_0x2e2ea0});})[_0x76a3('0x26')](function(){return db['Team'][_0x76a3('0x50')]({'where':{'id':_0x4203d8},'cascade':!![],'transaction':_0x2e2ea0});})['then'](function(_0x3bc898){if(_0x3bc898===0x0){_0x2477f3[_0x76a3('0x18')](0x194);}else{return db[_0x76a3('0x6d')][_0x76a3('0x50')]({'where':{'type':'Teams','resourceId':_0x4203d8},'cascade':!![],'transaction':_0x2e2ea0})[_0x76a3('0x26')](function(){_0x2477f3[_0x76a3('0x19')](0xcc)[_0x76a3('0x1a')]();});}})[_0x76a3('0x40')](function(_0x5d13ae){_0x2477f3[_0x76a3('0x19')](0x1f4)[_0x76a3('0x2a')](_0x5d13ae);});});};exports[_0x76a3('0x6e')]=function(_0xe46ee2,_0xc7a16b,_0x391386){return db[_0x76a3('0x2c')][_0x76a3('0x6f')]({'where':{'id':_0xe46ee2[_0x76a3('0x42')]['id']}})['then'](handleEntityNotFound(_0xc7a16b,null))[_0x76a3('0x26')](function(_0x1dd8b7){if(!_0xe46ee2['query'][_0x76a3('0x70')]||!utils['isValidChannel'](_0xe46ee2[_0x76a3('0x2f')][_0x76a3('0x70')])){throw new db[(_0x76a3('0x54'))][(_0x76a3('0x71'))](_0x76a3('0x72'));}var _0x10aaca={};var _0x58eb68={};_0x58eb68[_0x76a3('0x2e')]=_['keys'](db[_[_0x76a3('0x73')](_0xe46ee2[_0x76a3('0x2f')][_0x76a3('0x70')][_0x76a3('0x74')]())+_0x76a3('0x75')][_0x76a3('0x43')]);_0x58eb68[_0x76a3('0x2f')]=_['keys'](_0xe46ee2[_0x76a3('0x2f')]);_0x58eb68[_0x76a3('0x31')]=_[_0x76a3('0x32')](_0x58eb68[_0x76a3('0x2e')],_0x58eb68[_0x76a3('0x2f')]);_0x10aaca[_0x76a3('0x33')]=_[_0x76a3('0x32')](_0x58eb68[_0x76a3('0x2e')],qs['fields'](_0xe46ee2[_0x76a3('0x2f')][_0x76a3('0x34')]));_0x10aaca[_0x76a3('0x33')]=_0x10aaca[_0x76a3('0x33')][_0x76a3('0x35')]?_0x10aaca[_0x76a3('0x33')]:_0x58eb68[_0x76a3('0x2e')];_0x10aaca[_0x76a3('0x1e')]=qs['limit'](_0xe46ee2['query'][_0x76a3('0x1e')]);_0x10aaca[_0x76a3('0x1c')]=qs[_0x76a3('0x1c')](_0xe46ee2[_0x76a3('0x2f')]['offset']);_0x10aaca['order']=qs[_0x76a3('0x37')](_0xe46ee2[_0x76a3('0x2f')]['sort']);_0x10aaca[_0x76a3('0x3d')]=qs[_0x76a3('0x31')](_[_0x76a3('0x38')](_0xe46ee2[_0x76a3('0x2f')],_0x58eb68[_0x76a3('0x31')]));_0x10aaca=_['merge']({},_0x10aaca,_0xe46ee2['options']);return _0x1dd8b7[_0x76a3('0x49')+_[_0x76a3('0x73')](_0xe46ee2[_0x76a3('0x2f')][_0x76a3('0x70')]['toLowerCase']())+'Queues'](_0x10aaca);})['then'](respondWithResult(_0xc7a16b,null))[_0x76a3('0x40')](handleError(_0xc7a16b,null));};exports[_0x76a3('0x76')]=function(_0x2a0ef3,_0x312dfa,_0x4dbb5e){return db[_0x76a3('0x2c')]['findOne']({'where':{'id':_0x2a0ef3['params']['id']}})[_0x76a3('0x26')](function(_0x12191a){if(_0x12191a){if(!_0x2a0ef3[_0x76a3('0x47')][_0x76a3('0x70')]||!utils[_0x76a3('0x77')](_0x2a0ef3[_0x76a3('0x47')][_0x76a3('0x70')])){throw new db['Sequelize'][(_0x76a3('0x71'))]('Unknown\x20channel');}return _0x12191a[_0x76a3('0x78')+_[_0x76a3('0x73')](_0x2a0ef3['body']['channel'][_0x76a3('0x74')]())+'Queues'](_0x2a0ef3['body'][_0x76a3('0x79')]);}return null;})[_0x76a3('0x26')](handleEntityNotFound(_0x312dfa,null))[_0x76a3('0x26')](respondWithStatusCode(_0x312dfa,null))[_0x76a3('0x40')](handleError(_0x312dfa,null));};exports[_0x76a3('0x7a')]=function(_0x51ba00,_0x2ba60a,_0x458805){return db[_0x76a3('0x2c')][_0x76a3('0x6f')]({'where':{'id':_0x51ba00[_0x76a3('0x42')]['id']}})['then'](function(_0x43bd80){if(_0x43bd80){if(!_0x51ba00['query'][_0x76a3('0x70')]||!utils[_0x76a3('0x77')](_0x51ba00[_0x76a3('0x2f')][_0x76a3('0x70')])){throw new db[(_0x76a3('0x54'))][(_0x76a3('0x71'))](_0x76a3('0x72'));}return _0x43bd80[_0x76a3('0x7b')+_[_0x76a3('0x73')](_0x51ba00[_0x76a3('0x2f')]['channel'][_0x76a3('0x74')]())+_0x76a3('0x7c')](_0x51ba00[_0x76a3('0x2f')][_0x76a3('0x79')]);}return null;})[_0x76a3('0x26')](handleEntityNotFound(_0x2ba60a,null))[_0x76a3('0x26')](respondWithStatusCode(_0x2ba60a,null))['catch'](handleError(_0x2ba60a,null));};exports[_0x76a3('0x7d')]=function(_0x1934fe,_0x24ded8){var _0x757f96=_[_0x76a3('0x7e')](_0x1934fe[_0x76a3('0x47')][_0x76a3('0x79')])?_0x1934fe[_0x76a3('0x47')][_0x76a3('0x79')]:[_0x1934fe['body'][_0x76a3('0x79')]];var _0x43a86f=_0x1934fe['params']['id'];return db['Team'][_0x76a3('0x4d')]({'where':{'id':_0x43a86f}})[_0x76a3('0x26')](handleEntityNotFound(_0x24ded8,null))['then'](function(_0x4c19fd){if(_0x4c19fd){var _0x3c6239=[_0x76a3('0x7f'),_0x76a3('0x80'),_0x76a3('0x81'),'Sms',_0x76a3('0x82'),'Openchannel',_0x76a3('0x83')];return db[_0x76a3('0x51')][_0x76a3('0x52')](function(_0x1fd70e){var _0x31335f=_[_0x76a3('0x2b')](_0x3c6239,function(_0x591697){var _0x42e0c1={'attributes':['id',_0x76a3('0x29')]};if(_0x591697===_0x76a3('0x7f')){_0x42e0c1[_0x76a3('0x84')]={'attributes':[_0x76a3('0x85')]};}return _0x4c19fd[_0x76a3('0x49')+_0x591697+_0x76a3('0x7c')](_0x42e0c1)[_0x76a3('0x26')](function(_0x1f30e0){var _0x3a6c9e=_[_0x76a3('0x2b')](_0x1f30e0,function(_0x2ae75d){var _0x2c8e44=_[_0x76a3('0x2b')](_0x757f96,function(_0x3e651a){var _0x1fab01={'where':{'UserId':_0x3e651a,[_0x591697+_0x76a3('0x86')]:_0x2ae75d['id']},'transaction':_0x1fd70e};if(_0x591697===_0x76a3('0x7f')){_0x1fab01[_0x76a3('0x15')]={'penalty':_0x2ae75d['TeamVoiceQueue'][_0x76a3('0x85')]};}return db[_0x76a3('0x87')+_0x591697+_0x76a3('0x75')][_0x76a3('0x88')](_0x1fab01)[_0x76a3('0x26')](function(){socket[_0x76a3('0x89')]('user'+_0x591697+'Queue:save',{'UserId':_0x3e651a,[_0x591697+_0x76a3('0x86')]:_0x2ae75d['id']});if(_0x591697!==_0x76a3('0x7f')){return;}return db[_0x76a3('0x87')][_0x76a3('0x8a')]({'where':{'id':_0x757f96,'online':0x1},'attributes':['id',_0x76a3('0x29'),_0x76a3('0x8b'),_0x76a3('0x8c'),_0x76a3('0x8d')],'raw':!![]})[_0x76a3('0x26')](function(_0x32854a){var _0x3bc487=_[_0x76a3('0x2b')](_0x32854a,function(_0x1832b6){return db['UserVoiceQueueRt'][_0x76a3('0x8e')]({'membername':_0x1832b6[_0x76a3('0x29')],'UserId':_0x1832b6['id'],'queue_name':_0x2ae75d[_0x76a3('0x29')],'VoiceQueueId':_0x2ae75d['id'],'interface':_['isNil'](_0x1832b6[_0x76a3('0x8d')])?util[_0x76a3('0x8f')](_0x76a3('0x90'),_0x1832b6['name']):_0x1832b6[_0x76a3('0x8d')],'paused':_0x1832b6[_0x76a3('0x8c')]||![],'penalty':_0x2ae75d['TeamVoiceQueue'][_0x76a3('0x85')]},{'transaction':_0x1fd70e});});return Promise[_0x76a3('0x91')](_0x3bc487);});});});return Promise['all'](_0x2c8e44);});return Promise[_0x76a3('0x91')](_0x3a6c9e);})[_0x76a3('0x26')](function(){return db[_0x76a3('0x6b')][_0x76a3('0x6f')]({'where':{'teamId':_0x43a86f}})['then'](function(_0x116b98){if(_0x116b98){var _0x285320=_[_0x76a3('0x2b')](_0x757f96,function(_0x4b1317){db[_0x76a3('0x6c')][_0x76a3('0x8e')]({'UserId':_0x4b1317,'VoicePrefixId':_0x116b98['VoicePrefixId']});});return Promise[_0x76a3('0x91')](_0x285320);}});});});return Promise[_0x76a3('0x91')](_0x31335f)[_0x76a3('0x26')](function(){return _0x4c19fd[_0x76a3('0x7d')](_0x757f96,{'transaction':_0x1fd70e})['spread'](function(_0xe2e4a4){return _0xe2e4a4;});});});}})[_0x76a3('0x26')](respondWithResult(_0x24ded8,null))[_0x76a3('0x40')](handleError(_0x24ded8,null));};exports[_0x76a3('0x92')]=function(_0x255e06,_0x184449){var _0x941116=_[_0x76a3('0x7e')](_0x255e06['query']['ids'])?_0x255e06[_0x76a3('0x2f')][_0x76a3('0x79')]:[_0x255e06[_0x76a3('0x2f')][_0x76a3('0x79')]];var _0x5abaf3=_0x255e06[_0x76a3('0x42')]['id'];return db[_0x76a3('0x2c')]['find']({'where':{'id':_0x5abaf3}})[_0x76a3('0x26')](handleEntityNotFound(_0x184449,null))['then'](function(_0x189927){if(_0x189927){var _0x3e4799=[_0x76a3('0x7f'),_0x76a3('0x80'),_0x76a3('0x81'),_0x76a3('0x93'),_0x76a3('0x82'),_0x76a3('0x94'),'Whatsapp'];return db[_0x76a3('0x51')][_0x76a3('0x52')](function(_0x5d2579){var _0x594d7b=_['map'](_0x3e4799,function(_0x34bd7c){var _0x2906a5={'attributes':['id',_0x76a3('0x29')]};return _0x189927['get'+_0x34bd7c+_0x76a3('0x7c')](_0x2906a5)[_0x76a3('0x26')](function(_0x35b444){var _0x51e862=_['map'](_0x35b444,function(_0x22e243){return _0x22e243[_0x76a3('0x92')](_0x941116,{'transaction':_0x5d2579})[_0x76a3('0x26')](function(){var _0x40635b=_[_0x76a3('0x2b')](_0x941116,function(_0x78b6ae){socket[_0x76a3('0x89')]('user'+_0x34bd7c+'Queue:remove',{'UserId':Number(_0x78b6ae),[_0x34bd7c+_0x76a3('0x86')]:_0x22e243['id']});if(_0x34bd7c!==_0x76a3('0x7f')){return;}return db[_0x76a3('0x95')][_0x76a3('0x50')]({'where':{'VoiceQueueId':_0x22e243['id'],'UserId':_0x78b6ae},'transaction':_0x5d2579});});return Promise[_0x76a3('0x91')](_0x40635b);});});return Promise['all'](_0x51e862);});});return Promise[_0x76a3('0x91')](_0x594d7b)['then'](function(){return _0x189927['removeAgents'](_0x941116,{'transaction':_0x5d2579});})['then'](function(){return db[_0x76a3('0x6b')]['findOne']({'where':{'teamId':_0x5abaf3}})[_0x76a3('0x26')](function(_0x39be8f){if(_0x39be8f){var _0xff218d=_[_0x76a3('0x2b')](_0x941116,function(_0xf62049){db[_0x76a3('0x6c')][_0x76a3('0x50')]({'where':{'UserId':_0xf62049,'VoicePrefixId':_0x39be8f['VoicePrefixId']}});});return Promise['all'](_0xff218d);}});});});}})['then'](respondWithStatusCode(_0x184449,null))[_0x76a3('0x40')](handleError(_0x184449,null));};exports[_0x76a3('0x96')]=function(_0x15a3ed,_0x3dcee3,_0x5e5bed){var _0x1e798f={};var _0xb4b580={};var _0xbb4564;var _0x15bb9c;return db['Team'][_0x76a3('0x6f')]({'where':{'id':_0x15a3ed[_0x76a3('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dcee3,null))['then'](function(_0x454182){if(_0x454182){_0xbb4564=_0x454182;_0xb4b580[_0x76a3('0x2e')]=_[_0x76a3('0x30')](db['User'][_0x76a3('0x43')]);_0xb4b580['query']=_[_0x76a3('0x30')](_0x15a3ed[_0x76a3('0x2f')]);_0xb4b580[_0x76a3('0x31')]=_[_0x76a3('0x32')](_0xb4b580[_0x76a3('0x2e')],_0xb4b580['query']);_0x1e798f[_0x76a3('0x33')]=_[_0x76a3('0x32')](_0xb4b580['model'],qs[_0x76a3('0x34')](_0x15a3ed[_0x76a3('0x2f')]['fields']));_0x1e798f[_0x76a3('0x33')]=_0x1e798f[_0x76a3('0x33')]['length']?_0x1e798f[_0x76a3('0x33')]:_0xb4b580[_0x76a3('0x2e')];_0x1e798f['order']=qs[_0x76a3('0x37')](_0x15a3ed[_0x76a3('0x2f')][_0x76a3('0x37')]);_0x1e798f[_0x76a3('0x3d')]=qs[_0x76a3('0x31')](_[_0x76a3('0x38')](_0x15a3ed['query'],_0xb4b580[_0x76a3('0x31')]));if(_0x15a3ed[_0x76a3('0x2f')][_0x76a3('0x39')]){_0x1e798f[_0x76a3('0x3d')]=_[_0x76a3('0x45')](_0x1e798f[_0x76a3('0x3d')],{'$or':_[_0x76a3('0x2b')](_0x1e798f[_0x76a3('0x33')],function(_0x448417){var _0xa977a0={};_0xa977a0[_0x448417]={'$like':'%'+_0x15a3ed['query'][_0x76a3('0x39')]+'%'};return _0xa977a0;})});}_0x1e798f=_[_0x76a3('0x45')]({},_0x1e798f,_0x15a3ed[_0x76a3('0x3c')]);return _0xbb4564[_0x76a3('0x96')](_0x1e798f);}})[_0x76a3('0x26')](function(_0x4f4e4b){if(_0x4f4e4b){_0x15bb9c=_0x4f4e4b['length'];if(!_0x15a3ed[_0x76a3('0x2f')][_0x76a3('0x97')](_0x76a3('0x36'))){_0x1e798f[_0x76a3('0x1e')]=qs[_0x76a3('0x1e')](_0x15a3ed['query'][_0x76a3('0x1e')]);_0x1e798f[_0x76a3('0x1c')]=qs[_0x76a3('0x1c')](_0x15a3ed[_0x76a3('0x2f')][_0x76a3('0x1c')]);}return _0xbb4564[_0x76a3('0x96')](_0x1e798f);}})[_0x76a3('0x26')](function(_0x48dbe6){if(_0x48dbe6){return _0x48dbe6?{'count':_0x15bb9c,'rows':_0x48dbe6}:null;}})[_0x76a3('0x26')](respondWithResult(_0x3dcee3,null))[_0x76a3('0x40')](handleError(_0x3dcee3,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8c72bbb..d8d4776 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 _0xe4fe=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x538f63,_0x5e0b8c){var _0x2a25c9=function(_0x3f7a05){while(--_0x3f7a05){_0x538f63['push'](_0x538f63['shift']());}};_0x2a25c9(++_0x5e0b8c);}(_0xe4fe,0xc8));var _0xee4f=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0xe4fe[_0x10b2d5];return _0x14b8d1;};'use strict';var EventEmitter=require(_0xee4f('0x0'));var Team=require(_0xee4f('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xee4f('0x2')](0x0);var events={'afterCreate':_0xee4f('0x3'),'afterUpdate':_0xee4f('0x4'),'afterDestroy':_0xee4f('0x5')};function emitEvent(_0x5b430f){return function(_0x30d09b,_0x39e62f,_0x451737){TeamEvents[_0xee4f('0x6')](_0x5b430f+':'+_0x30d09b['id'],_0x30d09b);TeamEvents[_0xee4f('0x6')](_0x5b430f,_0x30d09b);_0x451737(null);};}for(var e in events){if(events[_0xee4f('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xbf7a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team'];(function(_0x430ef1,_0x3ee379){var _0xd105e1=function(_0x4cb756){while(--_0x4cb756){_0x430ef1['push'](_0x430ef1['shift']());}};_0xd105e1(++_0x3ee379);}(_0xbf7a,0xf7));var _0xabf7=function(_0x2d1a04,_0xeb3a98){_0x2d1a04=_0x2d1a04-0x0;var _0x5c06e6=_0xbf7a[_0x2d1a04];return _0x5c06e6;};'use strict';var EventEmitter=require(_0xabf7('0x0'));var Team=require(_0xabf7('0x1'))['db'][_0xabf7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xabf7('0x3')](0x0);var events={'afterCreate':_0xabf7('0x4'),'afterUpdate':_0xabf7('0x5'),'afterDestroy':_0xabf7('0x6')};function emitEvent(_0x26428c){return function(_0x196b78,_0x5a36c3,_0x2b7bba){TeamEvents[_0xabf7('0x7')](_0x26428c+':'+_0x196b78['id'],_0x196b78);TeamEvents[_0xabf7('0x7')](_0x26428c,_0x196b78);_0x2b7bba(null);};}for(var e in events){if(events[_0xabf7('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xabf7('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index b6505ab..5210cad 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 _0x82dc=['Openchannel','Whatsapp','then','lodash','./team.attributes','Queues','map','setDataValue','channel','catch','exports','define','Team','teams','Fax','Mail'];(function(_0x5e5946,_0x4cb576){var _0x1bc554=function(_0x556f6c){while(--_0x556f6c){_0x5e5946['push'](_0x5e5946['shift']());}};_0x1bc554(++_0x4cb576);}(_0x82dc,0x143));var _0xc82d=function(_0xbb9f6e,_0x1c433b){_0xbb9f6e=_0xbb9f6e-0x0;var _0x202e8c=_0x82dc[_0xbb9f6e];return _0x202e8c;};'use strict';var _=require(_0xc82d('0x0'));var attributes=require(_0xc82d('0x1'));function getQueuesByChannel(_0x3c3d18,_0x8aca22){var _0x20ab03='get'+_0x8aca22+_0xc82d('0x2');return _0x3c3d18[_0x20ab03]()['then'](function(_0x3c0b79){return _[_0xc82d('0x3')](_0x3c0b79,function(_0x4cfefc){_0x4cfefc[_0xc82d('0x4')](_0xc82d('0x5'),_0x8aca22);return _0x4cfefc;});})[_0xc82d('0x6')](function(_0x5585ae){throw _0x5585ae;});}module[_0xc82d('0x7')]=function(_0x527e6e){return _0x527e6e[_0xc82d('0x8')](_0xc82d('0x9'),attributes,{'tableName':_0xc82d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x48c467=this;var _0x297b92=['Chat',_0xc82d('0xb'),_0xc82d('0xc'),_0xc82d('0xd'),'Sms','Voice',_0xc82d('0xe')];return Promise['resolve']()[_0xc82d('0xf')](function(){var _0x86243b=_['map'](_0x297b92,function(_0x31746b){return getQueuesByChannel(_0x48c467,_0x31746b);});return Promise['all'](_0x86243b);})[_0xc82d('0x6')](function(_0x397d85){throw _0x397d85;});}}});}; \ No newline at end of file +var _0x8bd3=['map','all','lodash','./team.attributes','Queues','channel','catch','exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','then'];(function(_0x23c26f,_0x5b455a){var _0x4c3823=function(_0x4b0e9e){while(--_0x4b0e9e){_0x23c26f['push'](_0x23c26f['shift']());}};_0x4c3823(++_0x5b455a);}(_0x8bd3,0x158));var _0x38bd=function(_0x5dd351,_0x19ebc5){_0x5dd351=_0x5dd351-0x0;var _0x1fbdba=_0x8bd3[_0x5dd351];return _0x1fbdba;};'use strict';var _=require(_0x38bd('0x0'));var attributes=require(_0x38bd('0x1'));function getQueuesByChannel(_0xb93cec,_0x534c93){var _0x2c63dc='get'+_0x534c93+_0x38bd('0x2');return _0xb93cec[_0x2c63dc]()['then'](function(_0xeef9b8){return _['map'](_0xeef9b8,function(_0x16b902){_0x16b902['setDataValue'](_0x38bd('0x3'),_0x534c93);return _0x16b902;});})[_0x38bd('0x4')](function(_0x35cc59){throw _0x35cc59;});}module[_0x38bd('0x5')]=function(_0x3da092){return _0x3da092[_0x38bd('0x6')](_0x38bd('0x7'),attributes,{'tableName':_0x38bd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x52f12c=this;var _0x30af26=[_0x38bd('0x9'),_0x38bd('0xa'),'Mail',_0x38bd('0xb'),_0x38bd('0xc'),_0x38bd('0xd'),_0x38bd('0xe')];return Promise['resolve']()[_0x38bd('0xf')](function(){var _0x118cf3=_[_0x38bd('0x10')](_0x30af26,function(_0x2b1302){return getQueuesByChannel(_0x52f12c,_0x2b1302);});return Promise[_0x38bd('0x11')](_0x118cf3);})[_0x38bd('0x4')](function(_0x583c57){throw _0x583c57;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index bea5c23..7f7d528 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 _0xa280=['defaults','socket.io-emitter','./team.socket','register','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xa280,0xb1));var _0x0a28=function(_0x19f354,_0x2ed951){_0x19f354=_0x19f354-0x0;var _0x202051=_0xa280[_0x19f354];return _0x202051;};'use strict';var _=require('lodash');var util=require(_0x0a28('0x0'));var moment=require(_0x0a28('0x1'));var BPromise=require(_0x0a28('0x2'));var rs=require(_0x0a28('0x3'));var fs=require('fs');var Redis=require(_0x0a28('0x4'));var db=require(_0x0a28('0x5'))['db'];var utils=require(_0x0a28('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a28('0x7'));var jayson=require(_0x0a28('0x8'));var client=jayson[_0x0a28('0x9')][_0x0a28('0xa')]({'port':0x232a});config[_0x0a28('0xb')]=_[_0x0a28('0xc')](config[_0x0a28('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a28('0xd'))(new Redis(config[_0x0a28('0xb')]));require(_0x0a28('0xe'))[_0x0a28('0xf')](socket);function respondWithRpcPromise(_0xe8eb10,_0x1cb870,_0x28ed89){return new BPromise(function(_0x395500,_0x3316a8){return client['request'](_0xe8eb10,_0x28ed89)[_0x0a28('0x10')](function(_0x1b973f){logger['info']('Team,\x20%s,\x20%s',_0x1cb870,_0x0a28('0x11'));logger[_0x0a28('0x12')](_0x0a28('0x13'),_0x1cb870,_0x0a28('0x11'),JSON[_0x0a28('0x14')](_0x1b973f));if(_0x1b973f[_0x0a28('0x15')]){if(_0x1b973f[_0x0a28('0x15')]['code']===0x1f4){logger[_0x0a28('0x15')](_0x0a28('0x16'),_0x1cb870,_0x1b973f[_0x0a28('0x15')][_0x0a28('0x17')]);return _0x3316a8(_0x1b973f['error'][_0x0a28('0x17')]);}logger[_0x0a28('0x15')](_0x0a28('0x16'),_0x1cb870,_0x1b973f[_0x0a28('0x15')][_0x0a28('0x17')]);return _0x395500(_0x1b973f[_0x0a28('0x15')][_0x0a28('0x17')]);}else{logger[_0x0a28('0x18')]('Team,\x20%s,\x20%s',_0x1cb870,_0x0a28('0x11'));_0x395500(_0x1b973f[_0x0a28('0x19')][_0x0a28('0x17')]);}})[_0x0a28('0x1a')](function(_0x3a8259){logger[_0x0a28('0x15')](_0x0a28('0x16'),_0x1cb870,_0x3a8259);_0x3316a8(_0x3a8259);});});} \ No newline at end of file +var _0xbf0f=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf0f,0x191));var _0xfbf0=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xbf0f[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0xfbf0('0x0'));var moment=require(_0xfbf0('0x1'));var BPromise=require(_0xfbf0('0x2'));var rs=require(_0xfbf0('0x3'));var fs=require('fs');var Redis=require(_0xfbf0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbf0('0x5'));var logger=require('../../config/logger')(_0xfbf0('0x6'));var config=require(_0xfbf0('0x7'));var jayson=require(_0xfbf0('0x8'));var client=jayson[_0xfbf0('0x9')][_0xfbf0('0xa')]({'port':0x232a});config[_0xfbf0('0xb')]=_[_0xfbf0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfbf0('0xd'))(new Redis(config[_0xfbf0('0xb')]));require(_0xfbf0('0xe'))[_0xfbf0('0xf')](socket);function respondWithRpcPromise(_0x29810b,_0x4176a7,_0x549d50){return new BPromise(function(_0x35c0d7,_0xac293b){return client[_0xfbf0('0x10')](_0x29810b,_0x549d50)[_0xfbf0('0x11')](function(_0x3050fe){logger[_0xfbf0('0x12')](_0xfbf0('0x13'),_0x4176a7,_0xfbf0('0x14'));logger[_0xfbf0('0x15')](_0xfbf0('0x16'),_0x4176a7,_0xfbf0('0x14'),JSON[_0xfbf0('0x17')](_0x3050fe));if(_0x3050fe[_0xfbf0('0x18')]){if(_0x3050fe[_0xfbf0('0x18')]['code']===0x1f4){logger[_0xfbf0('0x18')](_0xfbf0('0x13'),_0x4176a7,_0x3050fe[_0xfbf0('0x18')]['message']);return _0xac293b(_0x3050fe[_0xfbf0('0x18')][_0xfbf0('0x19')]);}logger[_0xfbf0('0x18')](_0xfbf0('0x13'),_0x4176a7,_0x3050fe['error'][_0xfbf0('0x19')]);return _0x35c0d7(_0x3050fe[_0xfbf0('0x18')][_0xfbf0('0x19')]);}else{logger[_0xfbf0('0x12')](_0xfbf0('0x13'),_0x4176a7,'request\x20sent');_0x35c0d7(_0x3050fe[_0xfbf0('0x1a')][_0xfbf0('0x19')]);}})[_0xfbf0('0x1b')](function(_0x5a931e){logger[_0xfbf0('0x18')](_0xfbf0('0x13'),_0x4176a7,_0x5a931e);_0xac293b(_0x5a931e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0703883..819dc57 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 _0x3da7=['update','emit','removeListener','register','./team.events','remove'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0x3da7,0xe2));var _0x73da=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x3da7[_0x14fad0];return _0x5c665f;};'use strict';var TeamEvents=require(_0x73da('0x0'));var events=['save',_0x73da('0x1'),_0x73da('0x2')];function createListener(_0x283e1a,_0x30f351){return function(_0x106c50){_0x30f351[_0x73da('0x3')](_0x283e1a,_0x106c50);};}function removeListener(_0x52305b,_0x134ca0){return function(){TeamEvents[_0x73da('0x4')](_0x52305b,_0x134ca0);};}exports[_0x73da('0x5')]=function(_0xbb84d6){for(var _0x1f61af=0x0,_0x4fbd4e=events['length'];_0x1f61af<_0x4fbd4e;_0x1f61af++){var _0x365116=events[_0x1f61af];var _0x27f198=createListener('team:'+_0x365116,_0xbb84d6);TeamEvents['on'](_0x365116,_0x27f198);}}; \ No newline at end of file +var _0x22a4=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x24c859,_0x44619d){var _0x4a0679=function(_0x2658b0){while(--_0x2658b0){_0x24c859['push'](_0x24c859['shift']());}};_0x4a0679(++_0x44619d);}(_0x22a4,0x1cb));var _0x422a=function(_0x50f17d,_0x260de1){_0x50f17d=_0x50f17d-0x0;var _0x207fb8=_0x22a4[_0x50f17d];return _0x207fb8;};'use strict';var TeamEvents=require(_0x422a('0x0'));var events=[_0x422a('0x1'),_0x422a('0x2'),_0x422a('0x3')];function createListener(_0x23c02d,_0x3835c8){return function(_0x4725b0){_0x3835c8[_0x422a('0x4')](_0x23c02d,_0x4725b0);};}function removeListener(_0x5457aa,_0x32dc33){return function(){TeamEvents[_0x422a('0x5')](_0x5457aa,_0x32dc33);};}exports[_0x422a('0x6')]=function(_0x33e51c){for(var _0x28deaa=0x0,_0x5e8fe2=events[_0x422a('0x7')];_0x28deaa<_0x5e8fe2;_0x28deaa++){var _0x1b4b08=events[_0x28deaa];var _0x23b1b0=createListener(_0x422a('0x8')+_0x1b4b08,_0x33e51c);TeamEvents['on'](_0x1b4b08,_0x23b1b0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index d79e3a8..4894402 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 _0x149c=['INTEGER','sequelize'];(function(_0x472ee7,_0x302242){var _0x6aa3f3=function(_0x43beda){while(--_0x43beda){_0x472ee7['push'](_0x472ee7['shift']());}};_0x6aa3f3(++_0x302242);}(_0x149c,0x143));var _0xc149=function(_0x31aeaa,_0x4d83cb){_0x31aeaa=_0x31aeaa-0x0;var _0x22c946=_0x149c[_0x31aeaa];return _0x22c946;};'use strict';var Sequelize=require(_0xc149('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc149('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc149('0x1')]}}; \ No newline at end of file +var _0x1edd=['INTEGER','sequelize','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x1edd,0xcd));var _0xd1ed=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x1edd[_0x349367];return _0x14179b;};'use strict';var Sequelize=require(_0xd1ed('0x0'));module[_0xd1ed('0x1')]={'TeamId':{'type':Sequelize[_0xd1ed('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd1ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ec9d79a..67cbb70 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 _0x854f=['../../config/logger','api','moment','bluebird','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x183b98,_0x35aa6d){var _0x40751c=function(_0x1a43df){while(--_0x1a43df){_0x183b98['push'](_0x183b98['shift']());}};_0x40751c(++_0x35aa6d);}(_0x854f,0xc1));var _0xf854=function(_0x6abd2f,_0x3ba94e){_0x6abd2f=_0x6abd2f-0x0;var _0x44cc7f=_0x854f[_0x6abd2f];return _0x44cc7f;};'use strict';var _=require(_0xf854('0x0'));var util=require(_0xf854('0x1'));var logger=require(_0xf854('0x2'))(_0xf854('0x3'));var moment=require(_0xf854('0x4'));var BPromise=require(_0xf854('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf854('0x6'));var rimraf=require('rimraf');var config=require(_0xf854('0x7'));var attributes=require(_0xf854('0x8'));module[_0xf854('0x9')]=function(_0x1f5ec4,_0x4b1ca8){return _0x1f5ec4[_0xf854('0xa')](_0xf854('0xb'),attributes,{'tableName':_0xf854('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb9c,0x110));var _0xccb9=function(_0x6ef5fa,_0x319b54){_0x6ef5fa=_0x6ef5fa-0x0;var _0x248825=_0xcb9c[_0x6ef5fa];return _0x248825;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var logger=require(_0xccb9('0x2'))(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var rp=require(_0xccb9('0x6'));var fs=require('fs');var path=require(_0xccb9('0x7'));var rimraf=require('rimraf');var config=require(_0xccb9('0x8'));var attributes=require(_0xccb9('0x9'));module[_0xccb9('0xa')]=function(_0x5bb0e5,_0x34a3da){return _0x5bb0e5[_0xccb9('0xb')](_0xccb9('0xc'),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 c362cb3..a4f9521 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10875b,_0x1ecbdf){var _0x227adf=function(_0xe416b4){while(--_0xe416b4){_0x10875b['push'](_0x10875b['shift']());}};_0x227adf(++_0x1ecbdf);}(_0x70e0,0x17b));var _0x070e=function(_0x4f9aa0,_0x93f23b){_0x4f9aa0=_0x4f9aa0-0x0;var _0x23df84=_0x70e0[_0x4f9aa0];return _0x23df84;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f03cd,_0x468e7b){var _0x381369=function(_0xeb1b15){while(--_0xeb1b15){_0x1f03cd['push'](_0x1f03cd['shift']());}};_0x381369(++_0x468e7b);}(_0xe706,0xa3));var _0x6e70=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0xe706[_0x8c8176];return _0x4dc47b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e4f7719..d593f60 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 _0x2fb2=['sequelize'];(function(_0x490d13,_0x2047fb){var _0x4ec996=function(_0x59ade8){while(--_0x59ade8){_0x490d13['push'](_0x490d13['shift']());}};_0x4ec996(++_0x2047fb);}(_0x2fb2,0x19c));var _0x22fb=function(_0x365dc7,_0x893fc5){_0x365dc7=_0x365dc7-0x0;var _0x952ba1=_0x2fb2[_0x365dc7];return _0x952ba1;};'use strict';var Sequelize=require(_0x22fb('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb02a=['sequelize','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb02a,0xb0));var _0xab02=function(_0x5ed4e0,_0x11570a){_0x5ed4e0=_0x5ed4e0-0x0;var _0x47c33b=_0xb02a[_0x5ed4e0];return _0x47c33b;};'use strict';var Sequelize=require(_0xab02('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xab02('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 64da6af..037f7d5 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 _0x668b=['team_has_voice_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x668b,0x140));var _0xb668=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x668b[_0x4bfe08];return _0x1f9125;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x394e=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x18725b,_0x526547){var _0x3ff4f9=function(_0x507340){while(--_0x507340){_0x18725b['push'](_0x18725b['shift']());}};_0x3ff4f9(++_0x526547);}(_0x394e,0x88));var _0xe394=function(_0x246346,_0x335ee5){_0x246346=_0x246346-0x0;var _0x5e0957=_0x394e[_0x246346];return _0x5e0957;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var logger=require('../../config/logger')(_0xe394('0x2'));var moment=require(_0xe394('0x3'));var BPromise=require(_0xe394('0x4'));var rp=require(_0xe394('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var attributes=require(_0xe394('0x8'));module[_0xe394('0x9')]=function(_0x2a4db6,_0x272c30){return _0x2a4db6[_0xe394('0xa')](_0xe394('0xb'),attributes,{'tableName':_0xe394('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 9c2e250..5fa276f 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 _0x4fef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x679672,_0x54a629){var _0x2a79d8=function(_0x46db3a){while(--_0x46db3a){_0x679672['push'](_0x679672['shift']());}};_0x2a79d8(++_0x54a629);}(_0x4fef,0x10f));var _0xf4fe=function(_0x4d542c,_0xc9ae50){_0x4d542c=_0x4d542c-0x0;var _0x2db108=_0x4fef[_0x4d542c];return _0x2db108;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});} \ No newline at end of file +var _0xf15e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x561521,_0x365552){var _0x38838e=function(_0x2cd6ef){while(--_0x2cd6ef){_0x561521['push'](_0x561521['shift']());}};_0x38838e(++_0x365552);}(_0xf15e,0xb9));var _0xef15=function(_0x29f36d,_0x3703ff){_0x29f36d=_0x29f36d-0x0;var _0x595d89=_0xf15e[_0x29f36d];return _0x595d89;};'use strict';var _=require(_0xef15('0x0'));var util=require('util');var moment=require(_0xef15('0x1'));var BPromise=require(_0xef15('0x2'));var rs=require(_0xef15('0x3'));var fs=require('fs');var Redis=require(_0xef15('0x4'));var db=require(_0xef15('0x5'))['db'];var utils=require(_0xef15('0x6'));var logger=require('../../config/logger')(_0xef15('0x7'));var config=require(_0xef15('0x8'));var jayson=require(_0xef15('0x9'));var client=jayson[_0xef15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad584,_0x2a4d7e,_0x45a37c){return new BPromise(function(_0x4d6bec,_0x37385f){return client[_0xef15('0xb')](_0x2ad584,_0x45a37c)[_0xef15('0xc')](function(_0x377cc1){logger['info'](_0xef15('0xd'),_0x2a4d7e,_0xef15('0xe'));logger[_0xef15('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2a4d7e,_0xef15('0xe'),JSON[_0xef15('0x10')](_0x377cc1));if(_0x377cc1[_0xef15('0x11')]){if(_0x377cc1[_0xef15('0x11')][_0xef15('0x12')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2a4d7e,_0x377cc1[_0xef15('0x11')][_0xef15('0x13')]);return _0x37385f(_0x377cc1[_0xef15('0x11')]['message']);}logger[_0xef15('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2a4d7e,_0x377cc1[_0xef15('0x11')][_0xef15('0x13')]);return _0x4d6bec(_0x377cc1[_0xef15('0x11')]['message']);}else{logger[_0xef15('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2a4d7e,'request\x20sent');_0x4d6bec(_0x377cc1[_0xef15('0x15')]['message']);}})[_0xef15('0x16')](function(_0x153ca2){logger[_0xef15('0x11')](_0xef15('0xd'),_0x2a4d7e,_0x153ca2);_0x37385f(_0x153ca2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e9238a7..f76d463 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 _0xd7d5=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./template.controller','get'];(function(_0x339f21,_0x1191c6){var _0x2e43d4=function(_0x4d2d53){while(--_0x4d2d53){_0x339f21['push'](_0x339f21['shift']());}};_0x2e43d4(++_0x1191c6);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x2e9438,_0x10d146){_0x2e9438=_0x2e9438-0x0;var _0x4ac872=_0xd7d5[_0x2e9438];return _0x4ac872;};'use strict';var multer=require(_0x5d7d('0x0'));var util=require(_0x5d7d('0x1'));var path=require(_0x5d7d('0x2'));var timeout=require(_0x5d7d('0x3'));var express=require(_0x5d7d('0x4'));var router=express[_0x5d7d('0x5')]();var fs_extra=require(_0x5d7d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5d7d('0x7'));var config=require('../../config/environment');var controller=require(_0x5d7d('0x8'));router[_0x5d7d('0x9')]('/',auth[_0x5d7d('0xa')](),controller[_0x5d7d('0xb')]);router[_0x5d7d('0x9')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0xd')]);router[_0x5d7d('0xe')]('/',auth[_0x5d7d('0xa')](),controller['create']);router[_0x5d7d('0xf')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0x10')]);router[_0x5d7d('0x11')](_0x5d7d('0xc'),auth[_0x5d7d('0xa')](),controller[_0x5d7d('0x12')]);module[_0x5d7d('0x13')]=router; \ No newline at end of file +var _0x7524=['express','Router','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','util','path'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x7524,0xce));var _0x4752=function(_0x580eb2,_0x30c3b0){_0x580eb2=_0x580eb2-0x0;var _0x2902f2=_0x7524[_0x580eb2];return _0x2902f2;};'use strict';var multer=require('multer');var util=require(_0x4752('0x0'));var path=require(_0x4752('0x1'));var timeout=require('connect-timeout');var express=require(_0x4752('0x2'));var router=express[_0x4752('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4752('0x4'));var config=require('../../config/environment');var controller=require(_0x4752('0x5'));router[_0x4752('0x6')]('/',auth[_0x4752('0x7')](),controller[_0x4752('0x8')]);router[_0x4752('0x6')]('/:id',auth[_0x4752('0x7')](),controller[_0x4752('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4752('0xa')]);router[_0x4752('0xb')](_0x4752('0xc'),auth[_0x4752('0x7')](),controller['update']);router[_0x4752('0xd')](_0x4752('0xc'),auth[_0x4752('0x7')](),controller[_0x4752('0xe')]);module[_0x4752('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 1e760a8..df08671 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 _0xf1dd=['sequelize','STRING','TEXT'];(function(_0x18a511,_0x2babed){var _0x1250ff=function(_0x2efedf){while(--_0x2efedf){_0x18a511['push'](_0x18a511['shift']());}};_0x1250ff(++_0x2babed);}(_0xf1dd,0x147));var _0xdf1d=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xf1dd[_0x184759];return _0xf26d5f;};'use strict';var Sequelize=require(_0xdf1d('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf1d('0x1')]},'description':{'type':Sequelize[_0xdf1d('0x1')]},'html':{'type':Sequelize[_0xdf1d('0x2')]}}; \ No newline at end of file +var _0xacd0=['STRING','TEXT','sequelize','exports'];(function(_0x1465b3,_0x28fbd1){var _0x43e5db=function(_0x39543a){while(--_0x39543a){_0x1465b3['push'](_0x1465b3['shift']());}};_0x43e5db(++_0x28fbd1);}(_0xacd0,0x7e));var _0x0acd=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0xacd0[_0x44cd28];return _0x39356e;};'use strict';var Sequelize=require(_0x0acd('0x0'));module[_0x0acd('0x1')]={'name':{'type':Sequelize[_0x0acd('0x2')]},'description':{'type':Sequelize[_0x0acd('0x2')]},'html':{'type':Sequelize[_0x0acd('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 85de906..7ebc8f4 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 _0x6291=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','name','send','index','Template','fieldName','type','key','map','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','rawAttributes','length','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x45d612,_0x40cdb7){var _0x47ecd3=function(_0x986c20){while(--_0x986c20){_0x45d612['push'](_0x45d612['shift']());}};_0x47ecd3(++_0x40cdb7);}(_0x6291,0x1ea));var _0x1629=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x6291[_0xa1de8d];return _0x478b44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1629('0x0'));var zipdir=require(_0x1629('0x1'));var jsonpatch=require(_0x1629('0x2'));var rp=require('request-promise');var moment=require(_0x1629('0x3'));var BPromise=require(_0x1629('0x4'));var Mustache=require(_0x1629('0x5'));var util=require(_0x1629('0x6'));var path=require(_0x1629('0x7'));var sox=require(_0x1629('0x8'));var csv=require(_0x1629('0x9'));var ejs=require(_0x1629('0xa'));var fs=require('fs');var fs_extra=require(_0x1629('0xb'));var _=require(_0x1629('0xc'));var squel=require('squel');var crypto=require(_0x1629('0xd'));var jsforce=require(_0x1629('0xe'));var deskjs=require(_0x1629('0xf'));var toCsv=require(_0x1629('0x9'));var querystring=require('querystring');var Papa=require(_0x1629('0x10'));var Redis=require(_0x1629('0x11'));var authService=require(_0x1629('0x12'));var qs=require(_0x1629('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1629('0x14'));var utils=require(_0x1629('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1629('0x16'));var db=require(_0x1629('0x17'))['db'];function respondWithStatusCode(_0x588582,_0x2f8918){_0x2f8918=_0x2f8918||0xcc;return function(_0x3d057e){if(_0x3d057e){return _0x588582[_0x1629('0x18')](_0x2f8918);}return _0x588582[_0x1629('0x19')](_0x2f8918)[_0x1629('0x1a')]();};}function respondWithResult(_0x4d1eb4,_0x53754a){_0x53754a=_0x53754a||0xc8;return function(_0x1bd478){if(_0x1bd478){return _0x4d1eb4[_0x1629('0x19')](_0x53754a)[_0x1629('0x1b')](_0x1bd478);}};}function respondWithFilteredResult(_0x4fc8da,_0x2474f8){return function(_0x2a36e1){if(_0x2a36e1){var _0x11cc29=typeof _0x2474f8[_0x1629('0x1c')]===_0x1629('0x1d')&&typeof _0x2474f8[_0x1629('0x1e')]===_0x1629('0x1d');var _0x225b6d=_0x2a36e1[_0x1629('0x1f')];var _0x3742ad=_0x11cc29?0x0:_0x2474f8[_0x1629('0x1c')];var _0x338586=_0x11cc29?_0x2a36e1[_0x1629('0x1f')]:_0x2474f8[_0x1629('0x1c')]+_0x2474f8['limit'];var _0x70af2c;if(_0x338586>=_0x225b6d){_0x338586=_0x225b6d;_0x70af2c=0xc8;}else{_0x70af2c=0xce;}_0x4fc8da[_0x1629('0x19')](_0x70af2c);return _0x4fc8da[_0x1629('0x20')](_0x1629('0x21'),_0x3742ad+'-'+_0x338586+'/'+_0x225b6d)[_0x1629('0x1b')](_0x2a36e1);}return null;};}function patchUpdates(_0x42f4e2){return function(_0x1a1018){try{jsonpatch[_0x1629('0x22')](_0x1a1018,_0x42f4e2,!![]);}catch(_0x339ebd){return BPromise[_0x1629('0x23')](_0x339ebd);}return _0x1a1018[_0x1629('0x24')]();};}function saveUpdates(_0x201a9b,_0x805c16){return function(_0xdb12bb){if(_0xdb12bb){return _0xdb12bb[_0x1629('0x25')](_0x201a9b)['then'](function(_0x5e773f){return _0x5e773f;});}return null;};}function removeEntity(_0x3622be,_0xc2795){return function(_0x31719f){if(_0x31719f){return _0x31719f[_0x1629('0x26')]()[_0x1629('0x27')](function(){var _0x3bd957=_0x31719f[_0x1629('0x28')]({'plain':!![]});var _0x145245=_0x1629('0x29');return db[_0x1629('0x2a')][_0x1629('0x26')]({'where':{'type':_0x145245,'resourceId':_0x3bd957['id']}})[_0x1629('0x27')](function(){return _0x31719f;});})['then'](function(){_0x3622be[_0x1629('0x19')](0xcc)[_0x1629('0x1a')]();});}};}function handleEntityNotFound(_0x1fc9eb,_0x47fd0b){return function(_0x275aa1){if(!_0x275aa1){_0x1fc9eb['sendStatus'](0x194);}return _0x275aa1;};}function handleError(_0x2fbc74,_0x1a6e69){_0x1a6e69=_0x1a6e69||0x1f4;return function(_0x2113b5){logger[_0x1629('0x2b')](_0x2113b5['stack']);if(_0x2113b5[_0x1629('0x2c')]){delete _0x2113b5[_0x1629('0x2c')];}_0x2fbc74[_0x1629('0x19')](_0x1a6e69)[_0x1629('0x2d')](_0x2113b5);};}exports[_0x1629('0x2e')]=function(_0x5afe1e,_0x1fc31b){var _0x6dd9ad={},_0x5b08cc={},_0x287ac3={'count':0x0,'rows':[]};var _0x109b3c=_['map'](db[_0x1629('0x2f')]['rawAttributes'],function(_0x12fb05){return{'name':_0x12fb05[_0x1629('0x30')],'type':_0x12fb05[_0x1629('0x31')][_0x1629('0x32')]};});_0x5b08cc['model']=_[_0x1629('0x33')](_0x109b3c,'name');_0x5b08cc['query']=_['keys'](_0x5afe1e[_0x1629('0x34')]);_0x5b08cc['filters']=_['intersection'](_0x5b08cc[_0x1629('0x35')],_0x5b08cc['query']);_0x6dd9ad[_0x1629('0x36')]=_[_0x1629('0x37')](_0x5b08cc[_0x1629('0x35')],qs[_0x1629('0x38')](_0x5afe1e[_0x1629('0x34')]['fields']));_0x6dd9ad[_0x1629('0x36')]=_0x6dd9ad[_0x1629('0x36')]['length']?_0x6dd9ad[_0x1629('0x36')]:_0x5b08cc[_0x1629('0x35')];if(!_0x5afe1e[_0x1629('0x34')][_0x1629('0x39')](_0x1629('0x3a'))){_0x6dd9ad[_0x1629('0x1e')]=qs[_0x1629('0x1e')](_0x5afe1e[_0x1629('0x34')][_0x1629('0x1e')]);_0x6dd9ad[_0x1629('0x1c')]=qs[_0x1629('0x1c')](_0x5afe1e[_0x1629('0x34')][_0x1629('0x1c')]);}_0x6dd9ad[_0x1629('0x3b')]=qs[_0x1629('0x3c')](_0x5afe1e[_0x1629('0x34')]['sort']);_0x6dd9ad['where']=qs[_0x1629('0x3d')](_[_0x1629('0x3e')](_0x5afe1e[_0x1629('0x34')],_0x5b08cc[_0x1629('0x3d')]),_0x109b3c);if(_0x5afe1e[_0x1629('0x34')][_0x1629('0x3f')]){_0x6dd9ad[_0x1629('0x40')]=_['merge'](_0x6dd9ad[_0x1629('0x40')],{'$or':_[_0x1629('0x33')](_0x109b3c,function(_0x571684){if(_0x571684[_0x1629('0x31')]!==_0x1629('0x41')){var _0x27de57={};_0x27de57[_0x571684[_0x1629('0x2c')]]={'$like':'%'+_0x5afe1e[_0x1629('0x34')][_0x1629('0x3f')]+'%'};return _0x27de57;}})});}_0x6dd9ad=_[_0x1629('0x42')]({},_0x6dd9ad,_0x5afe1e[_0x1629('0x43')]);var _0xa6d670={'where':_0x6dd9ad[_0x1629('0x40')]};return db[_0x1629('0x2f')][_0x1629('0x1f')](_0xa6d670)['then'](function(_0x24e0e5){_0x287ac3[_0x1629('0x1f')]=_0x24e0e5;if(_0x5afe1e[_0x1629('0x34')][_0x1629('0x44')]){_0x6dd9ad[_0x1629('0x45')]=[{'all':!![]}];}return db[_0x1629('0x2f')]['findAll'](_0x6dd9ad);})[_0x1629('0x27')](function(_0x41f88c){_0x287ac3[_0x1629('0x46')]=_0x41f88c;return _0x287ac3;})['then'](respondWithFilteredResult(_0x1fc31b,_0x6dd9ad))[_0x1629('0x47')](handleError(_0x1fc31b,null));};exports['show']=function(_0xce0379,_0xacd403){var _0x74b63={'raw':!![],'where':{'id':_0xce0379[_0x1629('0x48')]['id']}},_0x513122={};_0x513122[_0x1629('0x35')]=_[_0x1629('0x49')](db['Template'][_0x1629('0x4a')]);_0x513122[_0x1629('0x34')]=_[_0x1629('0x49')](_0xce0379[_0x1629('0x34')]);_0x513122['filters']=_[_0x1629('0x37')](_0x513122[_0x1629('0x35')],_0x513122[_0x1629('0x34')]);_0x74b63[_0x1629('0x36')]=_['intersection'](_0x513122[_0x1629('0x35')],qs[_0x1629('0x38')](_0xce0379['query'][_0x1629('0x38')]));_0x74b63[_0x1629('0x36')]=_0x74b63[_0x1629('0x36')][_0x1629('0x4b')]?_0x74b63[_0x1629('0x36')]:_0x513122[_0x1629('0x35')];if(_0xce0379[_0x1629('0x34')][_0x1629('0x44')]){_0x74b63[_0x1629('0x45')]=[{'all':!![]}];}_0x74b63=_['merge']({},_0x74b63,_0xce0379['options']);return db['Template'][_0x1629('0x4c')](_0x74b63)[_0x1629('0x27')](handleEntityNotFound(_0xacd403,null))[_0x1629('0x27')](respondWithResult(_0xacd403,null))[_0x1629('0x47')](handleError(_0xacd403,null));};exports[_0x1629('0x4d')]=function(_0x3b3f4e,_0x3ff27d){return db[_0x1629('0x2f')][_0x1629('0x4d')](_0x3b3f4e[_0x1629('0x4e')],{})['then'](function(_0xf20c63){var _0x147aab=_0x3b3f4e[_0x1629('0x4f')][_0x1629('0x28')]({'plain':!![]});if(!_0x147aab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x147aab['role']===_0x1629('0x4f')){var _0x2cd491=_0xf20c63[_0x1629('0x28')]({'plain':!![]});var _0x16c789=_0x1629('0x29');return db[_0x1629('0x50')]['find']({'where':{'name':_0x16c789,'userProfileId':_0x147aab['userProfileId']},'raw':!![]})[_0x1629('0x27')](function(_0x2c3fb5){if(_0x2c3fb5&&_0x2c3fb5[_0x1629('0x51')]===0x0){return db[_0x1629('0x2a')]['create']({'name':_0x2cd491[_0x1629('0x2c')],'resourceId':_0x2cd491['id'],'type':_0x2c3fb5[_0x1629('0x2c')],'sectionId':_0x2c3fb5['id']},{})[_0x1629('0x27')](function(){return _0xf20c63;});}else{return _0xf20c63;}})[_0x1629('0x47')](function(_0x3bf422){logger['error'](_0x1629('0x52'),_0x3bf422);throw _0x3bf422;});}return _0xf20c63;})[_0x1629('0x27')](respondWithResult(_0x3ff27d,0xc9))[_0x1629('0x47')](handleError(_0x3ff27d,null));};exports[_0x1629('0x25')]=function(_0x5bb3a4,_0x5e6e6c){if(_0x5bb3a4[_0x1629('0x4e')]['id']){delete _0x5bb3a4['body']['id'];}return db[_0x1629('0x2f')]['find']({'where':{'id':_0x5bb3a4[_0x1629('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e6e6c,null))['then'](saveUpdates(_0x5bb3a4[_0x1629('0x4e')],null))['then'](respondWithResult(_0x5e6e6c,null))[_0x1629('0x47')](handleError(_0x5e6e6c,null));};exports[_0x1629('0x26')]=function(_0x85af51,_0x1922d8){return db[_0x1629('0x2f')]['find']({'where':{'id':_0x85af51[_0x1629('0x48')]['id']}})['then'](handleEntityNotFound(_0x1922d8,null))['then'](removeEntity(_0x1922d8,null))['catch'](handleError(_0x1922d8,null));}; \ No newline at end of file +var _0xab68=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','name','send','map','Template','rawAttributes','fieldName','type'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xab68,0xc9));var _0x8ab6=function(_0x38b5e5,_0xdc25c6){_0x38b5e5=_0x38b5e5-0x0;var _0x317ce=_0xab68[_0x38b5e5];return _0x317ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ab6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ab6('0x1'));var rp=require(_0x8ab6('0x2'));var moment=require('moment');var BPromise=require(_0x8ab6('0x3'));var Mustache=require(_0x8ab6('0x4'));var util=require('util');var path=require(_0x8ab6('0x5'));var sox=require(_0x8ab6('0x6'));var csv=require(_0x8ab6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ab6('0x8'));var _=require(_0x8ab6('0x9'));var squel=require('squel');var crypto=require(_0x8ab6('0xa'));var jsforce=require(_0x8ab6('0xb'));var deskjs=require(_0x8ab6('0xc'));var toCsv=require(_0x8ab6('0x7'));var querystring=require(_0x8ab6('0xd'));var Papa=require(_0x8ab6('0xe'));var Redis=require(_0x8ab6('0xf'));var authService=require(_0x8ab6('0x10'));var qs=require(_0x8ab6('0x11'));var as=require(_0x8ab6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ab6('0x13'))(_0x8ab6('0x14'));var utils=require(_0x8ab6('0x15'));var config=require(_0x8ab6('0x16'));var licenseUtil=require(_0x8ab6('0x17'));var db=require(_0x8ab6('0x18'))['db'];function respondWithStatusCode(_0x4474af,_0xfd142c){_0xfd142c=_0xfd142c||0xcc;return function(_0x20dc30){if(_0x20dc30){return _0x4474af[_0x8ab6('0x19')](_0xfd142c);}return _0x4474af[_0x8ab6('0x1a')](_0xfd142c)[_0x8ab6('0x1b')]();};}function respondWithResult(_0x5f229d,_0x203e9c){_0x203e9c=_0x203e9c||0xc8;return function(_0x40a7f5){if(_0x40a7f5){return _0x5f229d['status'](_0x203e9c)[_0x8ab6('0x1c')](_0x40a7f5);}};}function respondWithFilteredResult(_0x3fbff6,_0x216385){return function(_0xce6591){if(_0xce6591){var _0x404a53=typeof _0x216385['offset']==='undefined'&&typeof _0x216385['limit']===_0x8ab6('0x1d');var _0x2a4e90=_0xce6591[_0x8ab6('0x1e')];var _0x150d8f=_0x404a53?0x0:_0x216385[_0x8ab6('0x1f')];var _0x3bc736=_0x404a53?_0xce6591['count']:_0x216385[_0x8ab6('0x1f')]+_0x216385[_0x8ab6('0x20')];var _0x3f23e1;if(_0x3bc736>=_0x2a4e90){_0x3bc736=_0x2a4e90;_0x3f23e1=0xc8;}else{_0x3f23e1=0xce;}_0x3fbff6['status'](_0x3f23e1);return _0x3fbff6[_0x8ab6('0x21')](_0x8ab6('0x22'),_0x150d8f+'-'+_0x3bc736+'/'+_0x2a4e90)[_0x8ab6('0x1c')](_0xce6591);}return null;};}function patchUpdates(_0x16d23a){return function(_0x3a8b66){try{jsonpatch[_0x8ab6('0x23')](_0x3a8b66,_0x16d23a,!![]);}catch(_0x4e4945){return BPromise[_0x8ab6('0x24')](_0x4e4945);}return _0x3a8b66['save']();};}function saveUpdates(_0x1400dc,_0x31aa11){return function(_0x2823a0){if(_0x2823a0){return _0x2823a0[_0x8ab6('0x25')](_0x1400dc)[_0x8ab6('0x26')](function(_0x3c55be){return _0x3c55be;});}return null;};}function removeEntity(_0x3ba899,_0x2ccf16){return function(_0x5718ff){if(_0x5718ff){return _0x5718ff[_0x8ab6('0x27')]()[_0x8ab6('0x26')](function(){var _0x4f834d=_0x5718ff[_0x8ab6('0x28')]({'plain':!![]});var _0x27a1e0=_0x8ab6('0x29');return db[_0x8ab6('0x2a')]['destroy']({'where':{'type':_0x27a1e0,'resourceId':_0x4f834d['id']}})[_0x8ab6('0x26')](function(){return _0x5718ff;});})['then'](function(){_0x3ba899[_0x8ab6('0x1a')](0xcc)[_0x8ab6('0x1b')]();});}};}function handleEntityNotFound(_0x3f37b7,_0x4c6aba){return function(_0x495b01){if(!_0x495b01){_0x3f37b7['sendStatus'](0x194);}return _0x495b01;};}function handleError(_0x17d396,_0x100757){_0x100757=_0x100757||0x1f4;return function(_0x2d7373){logger[_0x8ab6('0x2b')](_0x2d7373['stack']);if(_0x2d7373[_0x8ab6('0x2c')]){delete _0x2d7373['name'];}_0x17d396['status'](_0x100757)[_0x8ab6('0x2d')](_0x2d7373);};}exports['index']=function(_0x341da8,_0xb4718e){var _0x48685a={},_0x3ff55d={},_0x4a7dd6={'count':0x0,'rows':[]};var _0x4e3653=_[_0x8ab6('0x2e')](db[_0x8ab6('0x2f')][_0x8ab6('0x30')],function(_0x59d284){return{'name':_0x59d284[_0x8ab6('0x31')],'type':_0x59d284[_0x8ab6('0x32')][_0x8ab6('0x33')]};});_0x3ff55d[_0x8ab6('0x34')]=_[_0x8ab6('0x2e')](_0x4e3653,_0x8ab6('0x2c'));_0x3ff55d[_0x8ab6('0x35')]=_[_0x8ab6('0x36')](_0x341da8[_0x8ab6('0x35')]);_0x3ff55d[_0x8ab6('0x37')]=_[_0x8ab6('0x38')](_0x3ff55d['model'],_0x3ff55d['query']);_0x48685a[_0x8ab6('0x39')]=_[_0x8ab6('0x38')](_0x3ff55d[_0x8ab6('0x34')],qs[_0x8ab6('0x3a')](_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x3a')]));_0x48685a[_0x8ab6('0x39')]=_0x48685a[_0x8ab6('0x39')][_0x8ab6('0x3b')]?_0x48685a[_0x8ab6('0x39')]:_0x3ff55d[_0x8ab6('0x34')];if(!_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x3c')]('nolimit')){_0x48685a[_0x8ab6('0x20')]=qs[_0x8ab6('0x20')](_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x20')]);_0x48685a[_0x8ab6('0x1f')]=qs['offset'](_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x1f')]);}_0x48685a[_0x8ab6('0x3d')]=qs[_0x8ab6('0x3e')](_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x3e')]);_0x48685a[_0x8ab6('0x3f')]=qs[_0x8ab6('0x37')](_['pick'](_0x341da8['query'],_0x3ff55d[_0x8ab6('0x37')]),_0x4e3653);if(_0x341da8[_0x8ab6('0x35')][_0x8ab6('0x40')]){_0x48685a[_0x8ab6('0x3f')]=_['merge'](_0x48685a[_0x8ab6('0x3f')],{'$or':_[_0x8ab6('0x2e')](_0x4e3653,function(_0xba821e){if(_0xba821e[_0x8ab6('0x32')]!==_0x8ab6('0x41')){var _0xea8163={};_0xea8163[_0xba821e[_0x8ab6('0x2c')]]={'$like':'%'+_0x341da8[_0x8ab6('0x35')]['filter']+'%'};return _0xea8163;}})});}_0x48685a=_['merge']({},_0x48685a,_0x341da8[_0x8ab6('0x42')]);var _0x580a6d={'where':_0x48685a[_0x8ab6('0x3f')]};return db['Template'][_0x8ab6('0x1e')](_0x580a6d)[_0x8ab6('0x26')](function(_0xadfa9d){_0x4a7dd6[_0x8ab6('0x1e')]=_0xadfa9d;if(_0x341da8['query']['includeAll']){_0x48685a[_0x8ab6('0x43')]=[{'all':!![]}];}return db[_0x8ab6('0x2f')][_0x8ab6('0x44')](_0x48685a);})[_0x8ab6('0x26')](function(_0x32a8ba){_0x4a7dd6[_0x8ab6('0x45')]=_0x32a8ba;return _0x4a7dd6;})[_0x8ab6('0x26')](respondWithFilteredResult(_0xb4718e,_0x48685a))[_0x8ab6('0x46')](handleError(_0xb4718e,null));};exports[_0x8ab6('0x47')]=function(_0x2442ce,_0x3467b0){var _0x306f86={'raw':!![],'where':{'id':_0x2442ce['params']['id']}},_0x5ba557={};_0x5ba557[_0x8ab6('0x34')]=_['keys'](db[_0x8ab6('0x2f')][_0x8ab6('0x30')]);_0x5ba557['query']=_[_0x8ab6('0x36')](_0x2442ce[_0x8ab6('0x35')]);_0x5ba557['filters']=_[_0x8ab6('0x38')](_0x5ba557[_0x8ab6('0x34')],_0x5ba557[_0x8ab6('0x35')]);_0x306f86[_0x8ab6('0x39')]=_[_0x8ab6('0x38')](_0x5ba557[_0x8ab6('0x34')],qs[_0x8ab6('0x3a')](_0x2442ce['query'][_0x8ab6('0x3a')]));_0x306f86[_0x8ab6('0x39')]=_0x306f86[_0x8ab6('0x39')]['length']?_0x306f86['attributes']:_0x5ba557[_0x8ab6('0x34')];if(_0x2442ce['query'][_0x8ab6('0x48')]){_0x306f86['include']=[{'all':!![]}];}_0x306f86=_[_0x8ab6('0x49')]({},_0x306f86,_0x2442ce[_0x8ab6('0x42')]);return db['Template'][_0x8ab6('0x4a')](_0x306f86)[_0x8ab6('0x26')](handleEntityNotFound(_0x3467b0,null))['then'](respondWithResult(_0x3467b0,null))[_0x8ab6('0x46')](handleError(_0x3467b0,null));};exports['create']=function(_0x3fd58e,_0x2fc3b3){return db[_0x8ab6('0x2f')][_0x8ab6('0x4b')](_0x3fd58e[_0x8ab6('0x4c')],{})[_0x8ab6('0x26')](function(_0x28f2bc){var _0x5b6e3f=_0x3fd58e[_0x8ab6('0x4d')][_0x8ab6('0x28')]({'plain':!![]});if(!_0x5b6e3f)throw new Error(_0x8ab6('0x4e'));if(_0x5b6e3f[_0x8ab6('0x4f')]===_0x8ab6('0x4d')){var _0x555ee4=_0x28f2bc[_0x8ab6('0x28')]({'plain':!![]});var _0x36507c=_0x8ab6('0x29');return db[_0x8ab6('0x50')][_0x8ab6('0x4a')]({'where':{'name':_0x36507c,'userProfileId':_0x5b6e3f['userProfileId']},'raw':!![]})['then'](function(_0x33c89c){if(_0x33c89c&&_0x33c89c[_0x8ab6('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x555ee4[_0x8ab6('0x2c')],'resourceId':_0x555ee4['id'],'type':_0x33c89c['name'],'sectionId':_0x33c89c['id']},{})[_0x8ab6('0x26')](function(){return _0x28f2bc;});}else{return _0x28f2bc;}})[_0x8ab6('0x46')](function(_0x3caa86){logger[_0x8ab6('0x2b')](_0x8ab6('0x52'),_0x3caa86);throw _0x3caa86;});}return _0x28f2bc;})[_0x8ab6('0x26')](respondWithResult(_0x2fc3b3,0xc9))[_0x8ab6('0x46')](handleError(_0x2fc3b3,null));};exports[_0x8ab6('0x25')]=function(_0x31a506,_0x464de9){if(_0x31a506[_0x8ab6('0x4c')]['id']){delete _0x31a506[_0x8ab6('0x4c')]['id'];}return db[_0x8ab6('0x2f')][_0x8ab6('0x4a')]({'where':{'id':_0x31a506[_0x8ab6('0x53')]['id']}})[_0x8ab6('0x26')](handleEntityNotFound(_0x464de9,null))[_0x8ab6('0x26')](saveUpdates(_0x31a506[_0x8ab6('0x4c')],null))['then'](respondWithResult(_0x464de9,null))['catch'](handleError(_0x464de9,null));};exports[_0x8ab6('0x27')]=function(_0x3c76e0,_0x193d66){return db[_0x8ab6('0x2f')][_0x8ab6('0x4a')]({'where':{'id':_0x3c76e0['params']['id']}})[_0x8ab6('0x26')](handleEntityNotFound(_0x193d66,null))[_0x8ab6('0x26')](removeEntity(_0x193d66,null))['catch'](handleError(_0x193d66,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a0bad21..81dd8fa 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 _0x1729=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','moment'];(function(_0x5b3417,_0x367bdc){var _0x59f10a=function(_0x1c3ee9){while(--_0x1c3ee9){_0x5b3417['push'](_0x5b3417['shift']());}};_0x59f10a(++_0x367bdc);}(_0x1729,0x19c));var _0x9172=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x1729[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x9172('0x0'));var util=require(_0x9172('0x1'));var logger=require(_0x9172('0x2'))('api');var moment=require(_0x9172('0x3'));var BPromise=require('bluebird');var rp=require(_0x9172('0x4'));var fs=require('fs');var path=require(_0x9172('0x5'));var rimraf=require(_0x9172('0x6'));var config=require(_0x9172('0x7'));var attributes=require(_0x9172('0x8'));module[_0x9172('0x9')]=function(_0x195400,_0x3638ae){return _0x195400[_0x9172('0xa')](_0x9172('0xb'),attributes,{'tableName':_0x9172('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8735=['define','Template','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./template.attributes'];(function(_0xd0f944,_0x7a2207){var _0x8fdcdd=function(_0x563895){while(--_0x563895){_0xd0f944['push'](_0xd0f944['shift']());}};_0x8fdcdd(++_0x7a2207);}(_0x8735,0x136));var _0x5873=function(_0x2a0453,_0x3815b2){_0x2a0453=_0x2a0453-0x0;var _0x4b7356=_0x8735[_0x2a0453];return _0x4b7356;};'use strict';var _=require('lodash');var util=require(_0x5873('0x0'));var logger=require(_0x5873('0x1'))(_0x5873('0x2'));var moment=require(_0x5873('0x3'));var BPromise=require(_0x5873('0x4'));var rp=require(_0x5873('0x5'));var fs=require('fs');var path=require(_0x5873('0x6'));var rimraf=require(_0x5873('0x7'));var config=require('../../config/environment');var attributes=require(_0x5873('0x8'));module['exports']=function(_0x17e897,_0x37bce5){return _0x17e897[_0x5873('0x9')](_0x5873('0xa'),attributes,{'tableName':'tools_templates','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 8919df1..cdc3cd4 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 _0x590c=['attributes','GetTemplate','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','catch','Template','findAll','options','raw','where','include','map','model'];(function(_0x4ab2b7,_0x112aa2){var _0x3a0a36=function(_0x1f7917){while(--_0x1f7917){_0x4ab2b7['push'](_0x4ab2b7['shift']());}};_0x3a0a36(++_0x112aa2);}(_0x590c,0x12b));var _0xc590=function(_0x3e844c,_0x188bc2){_0x3e844c=_0x3e844c-0x0;var _0x4e7c8a=_0x590c[_0x3e844c];return _0x4e7c8a;};'use strict';var _=require(_0xc590('0x0'));var util=require(_0xc590('0x1'));var moment=require(_0xc590('0x2'));var BPromise=require(_0xc590('0x3'));var rs=require(_0xc590('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc590('0x5'))(_0xc590('0x6'));var config=require(_0xc590('0x7'));var jayson=require(_0xc590('0x8'));var client=jayson['client'][_0xc590('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8d7d,_0x183930,_0x3a02c0){return new BPromise(function(_0x3e447a,_0x563da9){return client[_0xc590('0xa')](_0x1d8d7d,_0x3a02c0)[_0xc590('0xb')](function(_0x58bba6){logger[_0xc590('0xc')]('Template,\x20%s,\x20%s',_0x183930,_0xc590('0xd'));logger[_0xc590('0xe')](_0xc590('0xf'),_0x183930,_0xc590('0xd'),JSON[_0xc590('0x10')](_0x58bba6));if(_0x58bba6[_0xc590('0x11')]){if(_0x58bba6[_0xc590('0x11')][_0xc590('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x183930,_0x58bba6[_0xc590('0x11')]['message']);return _0x563da9(_0x58bba6['error'][_0xc590('0x13')]);}logger[_0xc590('0x11')](_0xc590('0x14'),_0x183930,_0x58bba6[_0xc590('0x11')][_0xc590('0x13')]);return _0x3e447a(_0x58bba6[_0xc590('0x11')][_0xc590('0x13')]);}else{logger['info'](_0xc590('0x14'),_0x183930,_0xc590('0xd'));_0x3e447a(_0x58bba6[_0xc590('0x15')][_0xc590('0x13')]);}})[_0xc590('0x16')](function(_0x28012e){logger[_0xc590('0x11')](_0xc590('0x14'),_0x183930,_0x28012e);_0x563da9(_0x28012e);});});}exports['GetTemplate']=function(_0x483c1a){var _0x1cfc18=this;return new Promise(function(_0x260aae,_0x231926){return db[_0xc590('0x17')][_0xc590('0x18')]({'raw':_0x483c1a[_0xc590('0x19')]?_0x483c1a[_0xc590('0x19')][_0xc590('0x1a')]===undefined?!![]:![]:!![],'where':_0x483c1a[_0xc590('0x19')]?_0x483c1a[_0xc590('0x19')][_0xc590('0x1b')]||null:null,'attributes':_0x483c1a[_0xc590('0x19')]?_0x483c1a[_0xc590('0x19')]['attributes']||null:null,'limit':_0x483c1a[_0xc590('0x19')]?_0x483c1a[_0xc590('0x19')]['limit']||null:null,'include':_0x483c1a[_0xc590('0x19')]?_0x483c1a[_0xc590('0x19')][_0xc590('0x1c')]?_[_0xc590('0x1d')](_0x483c1a['options']['include'],function(_0x2c1f04){return{'model':db[_0x2c1f04[_0xc590('0x1e')]],'as':_0x2c1f04['as'],'attributes':_0x2c1f04['attributes'],'include':_0x2c1f04[_0xc590('0x1c')]?_['map'](_0x2c1f04['include'],function(_0x115b05){return{'model':db[_0x115b05[_0xc590('0x1e')]],'as':_0x115b05['as'],'attributes':_0x115b05['attributes'],'include':_0x115b05[_0xc590('0x1c')]?_[_0xc590('0x1d')](_0x115b05[_0xc590('0x1c')],function(_0x3d1250){return{'model':db[_0x3d1250['model']],'as':_0x3d1250['as'],'attributes':_0x3d1250[_0xc590('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4676d0){logger[_0xc590('0xc')]('GetTemplate',_0x483c1a);logger[_0xc590('0xe')](_0xc590('0x20'),_0x483c1a,JSON['stringify'](_0x4676d0));_0x260aae(_0x4676d0);})['catch'](function(_0x47cc73){logger[_0xc590('0x11')](_0xc590('0x20'),_0x47cc73['message'],_0x483c1a);_0x231926(_0x1cfc18['error'](0x1f4,_0x47cc73['message']));});});}; \ No newline at end of file +var _0x62e4=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetTemplate','findAll','options','raw','attributes','limit','include','model','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0x62e4,0x12b));var _0x462e=function(_0x9d3f0c,_0x340864){_0x9d3f0c=_0x9d3f0c-0x0;var _0x40bcc6=_0x62e4[_0x9d3f0c];return _0x40bcc6;};'use strict';var _=require(_0x462e('0x0'));var util=require(_0x462e('0x1'));var moment=require(_0x462e('0x2'));var BPromise=require('bluebird');var rs=require(_0x462e('0x3'));var fs=require('fs');var Redis=require(_0x462e('0x4'));var db=require(_0x462e('0x5'))['db'];var utils=require(_0x462e('0x6'));var logger=require(_0x462e('0x7'))(_0x462e('0x8'));var config=require(_0x462e('0x9'));var jayson=require(_0x462e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x127e00,_0x26fe93,_0x10c575){return new BPromise(function(_0x1661fc,_0x156937){return client['request'](_0x127e00,_0x10c575)[_0x462e('0xb')](function(_0x4a677c){logger[_0x462e('0xc')](_0x462e('0xd'),_0x26fe93,_0x462e('0xe'));logger[_0x462e('0xf')](_0x462e('0x10'),_0x26fe93,_0x462e('0xe'),JSON[_0x462e('0x11')](_0x4a677c));if(_0x4a677c['error']){if(_0x4a677c['error'][_0x462e('0x12')]===0x1f4){logger[_0x462e('0x13')](_0x462e('0xd'),_0x26fe93,_0x4a677c['error']['message']);return _0x156937(_0x4a677c[_0x462e('0x13')]['message']);}logger['error'](_0x462e('0xd'),_0x26fe93,_0x4a677c['error'][_0x462e('0x14')]);return _0x1661fc(_0x4a677c[_0x462e('0x13')][_0x462e('0x14')]);}else{logger[_0x462e('0xc')](_0x462e('0xd'),_0x26fe93,_0x462e('0xe'));_0x1661fc(_0x4a677c['result']['message']);}})[_0x462e('0x15')](function(_0x1610d3){logger[_0x462e('0x13')](_0x462e('0xd'),_0x26fe93,_0x1610d3);_0x156937(_0x1610d3);});});}exports[_0x462e('0x16')]=function(_0x4dd8cf){var _0x5008bb=this;return new Promise(function(_0x1630be,_0x320331){return db['Template'][_0x462e('0x17')]({'raw':_0x4dd8cf[_0x462e('0x18')]?_0x4dd8cf['options'][_0x462e('0x19')]===undefined?!![]:![]:!![],'where':_0x4dd8cf[_0x462e('0x18')]?_0x4dd8cf['options']['where']||null:null,'attributes':_0x4dd8cf[_0x462e('0x18')]?_0x4dd8cf[_0x462e('0x18')][_0x462e('0x1a')]||null:null,'limit':_0x4dd8cf['options']?_0x4dd8cf['options'][_0x462e('0x1b')]||null:null,'include':_0x4dd8cf[_0x462e('0x18')]?_0x4dd8cf[_0x462e('0x18')]['include']?_['map'](_0x4dd8cf[_0x462e('0x18')][_0x462e('0x1c')],function(_0x292fc8){return{'model':db[_0x292fc8[_0x462e('0x1d')]],'as':_0x292fc8['as'],'attributes':_0x292fc8[_0x462e('0x1a')],'include':_0x292fc8['include']?_[_0x462e('0x1e')](_0x292fc8['include'],function(_0x26731a){return{'model':db[_0x26731a['model']],'as':_0x26731a['as'],'attributes':_0x26731a[_0x462e('0x1a')],'include':_0x26731a['include']?_[_0x462e('0x1e')](_0x26731a[_0x462e('0x1c')],function(_0x4c990e){return{'model':db[_0x4c990e[_0x462e('0x1d')]],'as':_0x4c990e['as'],'attributes':_0x4c990e[_0x462e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x462e('0xb')](function(_0x575467){logger[_0x462e('0xc')](_0x462e('0x16'),_0x4dd8cf);logger[_0x462e('0xf')](_0x462e('0x16'),_0x4dd8cf,JSON[_0x462e('0x11')](_0x575467));_0x1630be(_0x575467);})[_0x462e('0x15')](function(_0x274323){logger['error'](_0x462e('0x16'),_0x274323['message'],_0x4dd8cf);_0x320331(_0x5008bb[_0x462e('0x13')](0x1f4,_0x274323[_0x462e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b86860c..afd71e7 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 _0x864e=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','addAllCondition','addAction','/:id'];(function(_0x56dac3,_0x430d00){var _0x25ba16=function(_0x2b622a){while(--_0x2b622a){_0x56dac3['push'](_0x56dac3['shift']());}};_0x25ba16(++_0x430d00);}(_0x864e,0x13b));var _0xe864=function(_0x6d85b2,_0x3f5f50){_0x6d85b2=_0x6d85b2-0x0;var _0xf8984e=_0x864e[_0x6d85b2];return _0xf8984e;};'use strict';var multer=require(_0xe864('0x0'));var util=require('util');var path=require(_0xe864('0x1'));var timeout=require(_0xe864('0x2'));var express=require('express');var router=express[_0xe864('0x3')]();var fs_extra=require(_0xe864('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe864('0x5'));var config=require(_0xe864('0x6'));var controller=require(_0xe864('0x7'));router[_0xe864('0x8')]('/',auth[_0xe864('0x9')](),controller[_0xe864('0xa')]);router[_0xe864('0x8')]('/:id',auth[_0xe864('0x9')](),controller[_0xe864('0xb')]);router[_0xe864('0x8')](_0xe864('0xc'),auth[_0xe864('0x9')](),controller[_0xe864('0xd')]);router[_0xe864('0x8')](_0xe864('0xe'),auth['isAuthenticated'](),controller[_0xe864('0xf')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xe864('0x10')]);router[_0xe864('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe864('0x11')]('/:id/all_conditions',auth[_0xe864('0x9')](),controller[_0xe864('0x12')]);router[_0xe864('0x11')](_0xe864('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0xe864('0x11')]('/:id/actions',auth[_0xe864('0x9')](),controller[_0xe864('0x13')]);router['put'](_0xe864('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xe864('0x15')]('/:id',auth[_0xe864('0x9')](),controller[_0xe864('0x16')]);module[_0xe864('0x17')]=router; \ No newline at end of file +var _0x930e=['../../config/environment','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/actions','addAllCondition','post','addAnyCondition','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x579fb7,_0x1ca072){var _0x568dae=function(_0x463d1f){while(--_0x463d1f){_0x579fb7['push'](_0x579fb7['shift']());}};_0x568dae(++_0x1ca072);}(_0x930e,0x66));var _0xe930=function(_0x285f82,_0x31eda5){_0x285f82=_0x285f82-0x0;var _0x4d5a03=_0x930e[_0x285f82];return _0x4d5a03;};'use strict';var multer=require(_0xe930('0x0'));var util=require(_0xe930('0x1'));var path=require(_0xe930('0x2'));var timeout=require('connect-timeout');var express=require(_0xe930('0x3'));var router=express[_0xe930('0x4')]();var fs_extra=require(_0xe930('0x5'));var auth=require(_0xe930('0x6'));var interaction=require(_0xe930('0x7'));var config=require(_0xe930('0x8'));var controller=require('./trigger.controller');router[_0xe930('0x9')]('/',auth[_0xe930('0xa')](),controller[_0xe930('0xb')]);router[_0xe930('0x9')](_0xe930('0xc'),auth['isAuthenticated'](),controller[_0xe930('0xd')]);router[_0xe930('0x9')]('/:id/all_conditions',auth[_0xe930('0xa')](),controller[_0xe930('0xe')]);router[_0xe930('0x9')]('/:id/any_conditions',auth[_0xe930('0xa')](),controller['getAnyConditions']);router['get'](_0xe930('0xf'),auth[_0xe930('0xa')](),controller['getActions']);router['post']('/',auth[_0xe930('0xa')](),controller['create']);router['post']('/:id/all_conditions',auth[_0xe930('0xa')](),controller[_0xe930('0x10')]);router[_0xe930('0x11')]('/:id/any_conditions',auth[_0xe930('0xa')](),controller[_0xe930('0x12')]);router['post'](_0xe930('0xf'),auth[_0xe930('0xa')](),controller['addAction']);router['put'](_0xe930('0xc'),auth[_0xe930('0xa')](),controller[_0xe930('0x13')]);router[_0xe930('0x14')](_0xe930('0xc'),auth[_0xe930('0xa')](),controller[_0xe930('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ea04950..647420b 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 _0xb33c=['BOOLEAN','exports','STRING'];(function(_0x2a72f9,_0x267597){var _0x1f84f1=function(_0x4be278){while(--_0x4be278){_0x2a72f9['push'](_0x2a72f9['shift']());}};_0x1f84f1(++_0x267597);}(_0xb33c,0xbe));var _0xcb33=function(_0x343a14,_0x381a2a){_0x343a14=_0x343a14-0x0;var _0x5477da=_0xb33c[_0x343a14];return _0x5477da;};'use strict';var Sequelize=require('sequelize');module[_0xcb33('0x0')]={'name':{'type':Sequelize[_0xcb33('0x1')]},'channel':{'type':Sequelize[_0xcb33('0x1')]},'description':{'type':Sequelize[_0xcb33('0x1')]},'status':{'type':Sequelize[_0xcb33('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x324c=['sequelize','exports','STRING'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x324c,0x1bc));var _0xc324=function(_0x555996,_0x57100d){_0x555996=_0x555996-0x0;var _0x14320a=_0x324c[_0x555996];return _0x14320a;};'use strict';var Sequelize=require(_0xc324('0x0'));module[_0xc324('0x1')]={'name':{'type':Sequelize[_0xc324('0x2')]},'channel':{'type':Sequelize[_0xc324('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index aaf21aa..0e876cf 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 _0xe14b=['nolimit','order','sort','where','filter','options','Trigger','includeAll','include','findAll','catch','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','pick','getAllConditions','getAnyConditions','findOne','merge','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty'];(function(_0x20abe0,_0x1dad87){var _0x38ac96=function(_0xdcd9f8){while(--_0xdcd9f8){_0x20abe0['push'](_0x20abe0['shift']());}};_0x38ac96(++_0x1dad87);}(_0xe14b,0x1a9));var _0xbe14=function(_0x300381,_0x7b94c){_0x300381=_0x300381-0x0;var _0x5da040=_0xe14b[_0x300381];return _0x5da040;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe14('0x1'));var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require(_0xbe14('0x4'));var BPromise=require(_0xbe14('0x5'));var Mustache=require(_0xbe14('0x6'));var util=require(_0xbe14('0x7'));var path=require('path');var sox=require(_0xbe14('0x8'));var csv=require(_0xbe14('0x9'));var ejs=require(_0xbe14('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe14('0xb'));var squel=require(_0xbe14('0xc'));var crypto=require(_0xbe14('0xd'));var jsforce=require(_0xbe14('0xe'));var deskjs=require(_0xbe14('0xf'));var toCsv=require(_0xbe14('0x9'));var querystring=require(_0xbe14('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe14('0x11'));var authService=require(_0xbe14('0x12'));var qs=require(_0xbe14('0x13'));var as=require(_0xbe14('0x14'));var hardwareService=require(_0xbe14('0x15'));var logger=require(_0xbe14('0x16'))(_0xbe14('0x17'));var utils=require('../../config/utils');var config=require(_0xbe14('0x18'));var licenseUtil=require(_0xbe14('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13937b,_0x4a7d2d){_0x4a7d2d=_0x4a7d2d||0xcc;return function(_0x3f31b6){if(_0x3f31b6){return _0x13937b[_0xbe14('0x1a')](_0x4a7d2d);}return _0x13937b[_0xbe14('0x1b')](_0x4a7d2d)[_0xbe14('0x1c')]();};}function respondWithResult(_0x159c19,_0x651caf){_0x651caf=_0x651caf||0xc8;return function(_0x37565e){if(_0x37565e){return _0x159c19[_0xbe14('0x1b')](_0x651caf)[_0xbe14('0x1d')](_0x37565e);}};}function respondWithFilteredResult(_0x1fbdaa,_0x5a932c){return function(_0x3b9b80){if(_0x3b9b80){var _0x589c3e=typeof _0x5a932c[_0xbe14('0x1e')]==='undefined'&&typeof _0x5a932c[_0xbe14('0x1f')]===_0xbe14('0x20');var _0x25b97a=_0x3b9b80['count'];var _0x30f4e3=_0x589c3e?0x0:_0x5a932c['offset'];var _0x1145dc=_0x589c3e?_0x3b9b80[_0xbe14('0x21')]:_0x5a932c['offset']+_0x5a932c[_0xbe14('0x1f')];var _0xa770f5;if(_0x1145dc>=_0x25b97a){_0x1145dc=_0x25b97a;_0xa770f5=0xc8;}else{_0xa770f5=0xce;}_0x1fbdaa[_0xbe14('0x1b')](_0xa770f5);return _0x1fbdaa[_0xbe14('0x22')]('Content-Range',_0x30f4e3+'-'+_0x1145dc+'/'+_0x25b97a)[_0xbe14('0x1d')](_0x3b9b80);}return null;};}function patchUpdates(_0x5fd842){return function(_0x452b47){try{jsonpatch[_0xbe14('0x23')](_0x452b47,_0x5fd842,!![]);}catch(_0x2c79ef){return BPromise[_0xbe14('0x24')](_0x2c79ef);}return _0x452b47[_0xbe14('0x25')]();};}function saveUpdates(_0x244021,_0x266bf0){return function(_0x289d8e){if(_0x289d8e){return _0x289d8e[_0xbe14('0x26')](_0x244021)[_0xbe14('0x27')](function(_0x1b16a4){return _0x1b16a4;});}return null;};}function removeEntity(_0x184724,_0x521ad9){return function(_0x536fb5){if(_0x536fb5){return _0x536fb5[_0xbe14('0x28')]()[_0xbe14('0x27')](function(){var _0x39e95e=_0x536fb5['get']({'plain':!![]});var _0x4e20a7='Triggers';return db[_0xbe14('0x29')][_0xbe14('0x28')]({'where':{'type':_0x4e20a7,'resourceId':_0x39e95e['id']}})[_0xbe14('0x27')](function(){return _0x536fb5;});})['then'](function(){_0x184724[_0xbe14('0x1b')](0xcc)[_0xbe14('0x1c')]();});}};}function handleEntityNotFound(_0x381547,_0x5aeb6f){return function(_0x5a51e1){if(!_0x5a51e1){_0x381547[_0xbe14('0x1a')](0x194);}return _0x5a51e1;};}function handleError(_0x1b3b96,_0x110bac){_0x110bac=_0x110bac||0x1f4;return function(_0x49aebe){logger[_0xbe14('0x2a')](_0x49aebe[_0xbe14('0x2b')]);if(_0x49aebe[_0xbe14('0x2c')]){delete _0x49aebe[_0xbe14('0x2c')];}_0x1b3b96['status'](_0x110bac)[_0xbe14('0x2d')](_0x49aebe);};}exports[_0xbe14('0x2e')]=function(_0x20436c,_0x5496ee){var _0x275a81={},_0xe05681={},_0x59eb6a={'count':0x0,'rows':[]};var _0x5a27f3=_[_0xbe14('0x2f')](db['Trigger'][_0xbe14('0x30')],function(_0x1709bc){return{'name':_0x1709bc[_0xbe14('0x31')],'type':_0x1709bc[_0xbe14('0x32')][_0xbe14('0x33')]};});_0xe05681[_0xbe14('0x34')]=_[_0xbe14('0x2f')](_0x5a27f3,'name');_0xe05681[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x20436c[_0xbe14('0x35')]);_0xe05681[_0xbe14('0x37')]=_['intersection'](_0xe05681[_0xbe14('0x34')],_0xe05681[_0xbe14('0x35')]);_0x275a81[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0xe05681['model'],qs['fields'](_0x20436c[_0xbe14('0x35')]['fields']));_0x275a81['attributes']=_0x275a81[_0xbe14('0x38')][_0xbe14('0x3a')]?_0x275a81['attributes']:_0xe05681[_0xbe14('0x34')];if(!_0x20436c['query'][_0xbe14('0x3b')](_0xbe14('0x3c'))){_0x275a81[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x20436c[_0xbe14('0x35')][_0xbe14('0x1f')]);_0x275a81[_0xbe14('0x1e')]=qs[_0xbe14('0x1e')](_0x20436c[_0xbe14('0x35')][_0xbe14('0x1e')]);}_0x275a81[_0xbe14('0x3d')]=qs['sort'](_0x20436c[_0xbe14('0x35')][_0xbe14('0x3e')]);_0x275a81[_0xbe14('0x3f')]=qs[_0xbe14('0x37')](_['pick'](_0x20436c[_0xbe14('0x35')],_0xe05681[_0xbe14('0x37')]),_0x5a27f3);if(_0x20436c['query'][_0xbe14('0x40')]){_0x275a81['where']=_['merge'](_0x275a81[_0xbe14('0x3f')],{'$or':_['map'](_0x5a27f3,function(_0x8076e9){if(_0x8076e9['type']!=='VIRTUAL'){var _0xa49b9={};_0xa49b9[_0x8076e9[_0xbe14('0x2c')]]={'$like':'%'+_0x20436c[_0xbe14('0x35')][_0xbe14('0x40')]+'%'};return _0xa49b9;}})});}_0x275a81=_['merge']({},_0x275a81,_0x20436c[_0xbe14('0x41')]);var _0x484681={'where':_0x275a81[_0xbe14('0x3f')]};return db[_0xbe14('0x42')][_0xbe14('0x21')](_0x484681)[_0xbe14('0x27')](function(_0x5c7fd0){_0x59eb6a[_0xbe14('0x21')]=_0x5c7fd0;if(_0x20436c[_0xbe14('0x35')][_0xbe14('0x43')]){_0x275a81[_0xbe14('0x44')]=[{'all':!![]}];}return db[_0xbe14('0x42')][_0xbe14('0x45')](_0x275a81);})[_0xbe14('0x27')](function(_0x14b28b){_0x59eb6a['rows']=_0x14b28b;return _0x59eb6a;})['then'](respondWithFilteredResult(_0x5496ee,_0x275a81))[_0xbe14('0x46')](handleError(_0x5496ee,null));};exports['show']=function(_0x6d3381,_0x323c57){var _0x9014fe={'raw':![],'where':{'id':_0x6d3381['params']['id']}},_0x13d151={};_0x13d151[_0xbe14('0x34')]=_[_0xbe14('0x36')](db[_0xbe14('0x42')][_0xbe14('0x30')]);_0x13d151[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x6d3381[_0xbe14('0x35')]);_0x13d151[_0xbe14('0x37')]=_[_0xbe14('0x39')](_0x13d151[_0xbe14('0x34')],_0x13d151[_0xbe14('0x35')]);_0x9014fe[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x13d151[_0xbe14('0x34')],qs[_0xbe14('0x47')](_0x6d3381['query']['fields']));_0x9014fe[_0xbe14('0x38')]=_0x9014fe[_0xbe14('0x38')][_0xbe14('0x3a')]?_0x9014fe[_0xbe14('0x38')]:_0x13d151[_0xbe14('0x34')];if(_0x6d3381['query'][_0xbe14('0x43')]){_0x9014fe[_0xbe14('0x44')]=[{'all':!![]}];}_0x9014fe=_['merge']({},_0x9014fe,_0x6d3381[_0xbe14('0x41')]);return db['Trigger'][_0xbe14('0x48')](_0x9014fe)[_0xbe14('0x27')](handleEntityNotFound(_0x323c57,null))['then'](respondWithResult(_0x323c57,null))[_0xbe14('0x46')](handleError(_0x323c57,null));};exports[_0xbe14('0x49')]=function(_0x1244ab,_0x3b0661){return db[_0xbe14('0x42')][_0xbe14('0x49')](_0x1244ab[_0xbe14('0x4a')],{})[_0xbe14('0x27')](function(_0x1d8b99){var _0xa97b0=_0x1244ab[_0xbe14('0x4b')][_0xbe14('0x4c')]({'plain':!![]});if(!_0xa97b0)throw new Error(_0xbe14('0x4d'));if(_0xa97b0[_0xbe14('0x4e')]===_0xbe14('0x4b')){var _0x1df807=_0x1d8b99[_0xbe14('0x4c')]({'plain':!![]});var _0x2bc552=_0xbe14('0x4f');return db[_0xbe14('0x50')][_0xbe14('0x48')]({'where':{'name':_0x2bc552,'userProfileId':_0xa97b0[_0xbe14('0x51')]},'raw':!![]})[_0xbe14('0x27')](function(_0x4d0fad){if(_0x4d0fad&&_0x4d0fad['autoAssociation']===0x0){return db[_0xbe14('0x29')][_0xbe14('0x49')]({'name':_0x1df807[_0xbe14('0x2c')],'resourceId':_0x1df807['id'],'type':_0x4d0fad[_0xbe14('0x2c')],'sectionId':_0x4d0fad['id']},{})[_0xbe14('0x27')](function(){return _0x1d8b99;});}else{return _0x1d8b99;}})[_0xbe14('0x46')](function(_0x314451){logger[_0xbe14('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x314451);throw _0x314451;});}return _0x1d8b99;})['then'](respondWithResult(_0x3b0661,0xc9))['catch'](handleError(_0x3b0661,null));};exports['update']=function(_0x537b11,_0x17457b){if(_0x537b11[_0xbe14('0x4a')]['id']){delete _0x537b11[_0xbe14('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x537b11['params']['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x17457b,null))[_0xbe14('0x27')](saveUpdates(_0x537b11[_0xbe14('0x4a')],null))['then'](respondWithResult(_0x17457b,null))[_0xbe14('0x46')](handleError(_0x17457b,null));};exports['destroy']=function(_0x196fd9,_0x26b453){return db[_0xbe14('0x42')][_0xbe14('0x48')]({'where':{'id':_0x196fd9[_0xbe14('0x52')]['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x26b453,null))['then'](removeEntity(_0x26b453,null))['catch'](handleError(_0x26b453,null));};exports[_0xbe14('0x53')]=function(_0x2679e3,_0x5e63a6,_0x150f7b){if(_0x2679e3['body']['id']){delete _0x2679e3['body']['id'];}return db[_0xbe14('0x42')][_0xbe14('0x48')]({'where':{'id':_0x2679e3['params']['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x5e63a6,null))['then'](function(_0x28b378){if(_0x28b378){_0x2679e3['body'][_0xbe14('0x54')]=_0x28b378['id'];return db[_0xbe14('0x55')][_0xbe14('0x49')](_0x2679e3[_0xbe14('0x4a')]);}})[_0xbe14('0x27')](respondWithResult(_0x5e63a6,null))['catch'](handleError(_0x5e63a6,null));};exports[_0xbe14('0x56')]=function(_0xd06722,_0x35578f,_0x5192f8){if(_0xd06722[_0xbe14('0x4a')]['id']){delete _0xd06722[_0xbe14('0x4a')]['id'];}return db[_0xbe14('0x42')][_0xbe14('0x48')]({'where':{'id':_0xd06722[_0xbe14('0x52')]['id']}})['then'](handleEntityNotFound(_0x35578f,null))[_0xbe14('0x27')](function(_0x58f364){if(_0x58f364){_0xd06722[_0xbe14('0x4a')][_0xbe14('0x57')]=_0x58f364['id'];return db[_0xbe14('0x55')][_0xbe14('0x49')](_0xd06722[_0xbe14('0x4a')]);}})[_0xbe14('0x27')](respondWithResult(_0x35578f,null))[_0xbe14('0x46')](handleError(_0x35578f,null));};exports['getAllConditions']=function(_0xdac48f,_0x5eac6e,_0x85a7c){var _0x1fdbb7={};var _0x3e8751={};var _0x5cbb41;var _0xb77967;return db[_0xbe14('0x42')]['findOne']({'where':{'id':_0xdac48f[_0xbe14('0x52')]['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x5eac6e,null))['then'](function(_0x3e6d38){if(_0x3e6d38){_0x5cbb41=_0x3e6d38;_0x3e8751[_0xbe14('0x34')]=_['keys'](db[_0xbe14('0x55')][_0xbe14('0x30')]);_0x3e8751[_0xbe14('0x35')]=_['keys'](_0xdac48f[_0xbe14('0x35')]);_0x3e8751['filters']=_[_0xbe14('0x39')](_0x3e8751[_0xbe14('0x34')],_0x3e8751[_0xbe14('0x35')]);_0x1fdbb7[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x3e8751[_0xbe14('0x34')],qs[_0xbe14('0x47')](_0xdac48f[_0xbe14('0x35')][_0xbe14('0x47')]));_0x1fdbb7[_0xbe14('0x38')]=_0x1fdbb7[_0xbe14('0x38')]['length']?_0x1fdbb7[_0xbe14('0x38')]:_0x3e8751['model'];_0x1fdbb7['order']=qs['sort'](_0xdac48f[_0xbe14('0x35')][_0xbe14('0x3e')]);_0x1fdbb7[_0xbe14('0x3f')]=qs[_0xbe14('0x37')](_[_0xbe14('0x58')](_0xdac48f[_0xbe14('0x35')],_0x3e8751['filters']));if(_0xdac48f[_0xbe14('0x35')]['filter']){_0x1fdbb7[_0xbe14('0x3f')]=_['merge'](_0x1fdbb7['where'],{'$or':_[_0xbe14('0x2f')](_0x1fdbb7[_0xbe14('0x38')],function(_0x41db57){var _0x5bb264={};_0x5bb264[_0x41db57]={'$like':'%'+_0xdac48f[_0xbe14('0x35')][_0xbe14('0x40')]+'%'};return _0x5bb264;})});}_0x1fdbb7=_['merge']({},_0x1fdbb7,_0xdac48f[_0xbe14('0x41')]);return _0x5cbb41[_0xbe14('0x59')](_0x1fdbb7);}})[_0xbe14('0x27')](function(_0x1c2da4){if(_0x1c2da4){_0xb77967=_0x1c2da4[_0xbe14('0x3a')];if(!_0xdac48f['query'][_0xbe14('0x3b')]('nolimit')){_0x1fdbb7['limit']=qs[_0xbe14('0x1f')](_0xdac48f[_0xbe14('0x35')]['limit']);_0x1fdbb7[_0xbe14('0x1e')]=qs[_0xbe14('0x1e')](_0xdac48f[_0xbe14('0x35')][_0xbe14('0x1e')]);}return _0x5cbb41['getAllConditions'](_0x1fdbb7);}})[_0xbe14('0x27')](function(_0x168f3b){if(_0x168f3b){return _0x168f3b?{'count':_0xb77967,'rows':_0x168f3b}:null;}})[_0xbe14('0x27')](respondWithResult(_0x5eac6e,null))[_0xbe14('0x46')](handleError(_0x5eac6e,null));};exports[_0xbe14('0x5a')]=function(_0x94a514,_0x3611e0,_0x49103b){var _0x44d8d8={};var _0x41d9d3={};var _0x5bbe06;var _0x2581ae;return db[_0xbe14('0x42')][_0xbe14('0x5b')]({'where':{'id':_0x94a514[_0xbe14('0x52')]['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x3611e0,null))[_0xbe14('0x27')](function(_0x43d2fc){if(_0x43d2fc){_0x5bbe06=_0x43d2fc;_0x41d9d3[_0xbe14('0x34')]=_[_0xbe14('0x36')](db['Condition']['rawAttributes']);_0x41d9d3[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x94a514['query']);_0x41d9d3[_0xbe14('0x37')]=_[_0xbe14('0x39')](_0x41d9d3[_0xbe14('0x34')],_0x41d9d3[_0xbe14('0x35')]);_0x44d8d8[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x41d9d3['model'],qs[_0xbe14('0x47')](_0x94a514['query']['fields']));_0x44d8d8[_0xbe14('0x38')]=_0x44d8d8[_0xbe14('0x38')][_0xbe14('0x3a')]?_0x44d8d8[_0xbe14('0x38')]:_0x41d9d3[_0xbe14('0x34')];_0x44d8d8[_0xbe14('0x3d')]=qs[_0xbe14('0x3e')](_0x94a514[_0xbe14('0x35')][_0xbe14('0x3e')]);_0x44d8d8[_0xbe14('0x3f')]=qs['filters'](_[_0xbe14('0x58')](_0x94a514['query'],_0x41d9d3['filters']));if(_0x94a514[_0xbe14('0x35')]['filter']){_0x44d8d8[_0xbe14('0x3f')]=_[_0xbe14('0x5c')](_0x44d8d8['where'],{'$or':_[_0xbe14('0x2f')](_0x44d8d8[_0xbe14('0x38')],function(_0x40321b){var _0x3f7662={};_0x3f7662[_0x40321b]={'$like':'%'+_0x94a514[_0xbe14('0x35')][_0xbe14('0x40')]+'%'};return _0x3f7662;})});}_0x44d8d8=_[_0xbe14('0x5c')]({},_0x44d8d8,_0x94a514[_0xbe14('0x41')]);return _0x5bbe06[_0xbe14('0x5a')](_0x44d8d8);}})['then'](function(_0x42dc60){if(_0x42dc60){_0x2581ae=_0x42dc60[_0xbe14('0x3a')];if(!_0x94a514[_0xbe14('0x35')]['hasOwnProperty'](_0xbe14('0x3c'))){_0x44d8d8[_0xbe14('0x1f')]=qs['limit'](_0x94a514[_0xbe14('0x35')][_0xbe14('0x1f')]);_0x44d8d8[_0xbe14('0x1e')]=qs[_0xbe14('0x1e')](_0x94a514[_0xbe14('0x35')][_0xbe14('0x1e')]);}return _0x5bbe06['getAnyConditions'](_0x44d8d8);}})[_0xbe14('0x27')](function(_0x5baee2){if(_0x5baee2){return _0x5baee2?{'count':_0x2581ae,'rows':_0x5baee2}:null;}})[_0xbe14('0x27')](respondWithResult(_0x3611e0,null))['catch'](handleError(_0x3611e0,null));};exports[_0xbe14('0x5d')]=function(_0x46c85a,_0x2a724a,_0xb35841){if(_0x46c85a[_0xbe14('0x4a')]['id']){delete _0x46c85a['body']['id'];}return db[_0xbe14('0x42')][_0xbe14('0x48')]({'where':{'id':_0x46c85a[_0xbe14('0x52')]['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x2a724a,null))[_0xbe14('0x27')](function(_0x4dbc34){if(_0x4dbc34){_0x46c85a[_0xbe14('0x4a')][_0xbe14('0x5e')]=_0x4dbc34['id'];return db[_0xbe14('0x5f')][_0xbe14('0x49')](_0x46c85a[_0xbe14('0x4a')]);}})[_0xbe14('0x27')](respondWithResult(_0x2a724a,null))[_0xbe14('0x46')](handleError(_0x2a724a,null));};exports[_0xbe14('0x60')]=function(_0x19123a,_0x8e6966,_0x247580){var _0x354181={};var _0x555cb5={};var _0xeb2627;var _0x71d97b;return db[_0xbe14('0x42')][_0xbe14('0x5b')]({'where':{'id':_0x19123a['params']['id']}})[_0xbe14('0x27')](handleEntityNotFound(_0x8e6966,null))[_0xbe14('0x27')](function(_0x25b745){if(_0x25b745){_0xeb2627=_0x25b745;_0x555cb5[_0xbe14('0x34')]=_[_0xbe14('0x36')](db[_0xbe14('0x5f')]['rawAttributes']);_0x555cb5[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x19123a['query']);_0x555cb5[_0xbe14('0x37')]=_[_0xbe14('0x39')](_0x555cb5['model'],_0x555cb5['query']);_0x354181['attributes']=_['intersection'](_0x555cb5[_0xbe14('0x34')],qs[_0xbe14('0x47')](_0x19123a[_0xbe14('0x35')][_0xbe14('0x47')]));_0x354181[_0xbe14('0x38')]=_0x354181[_0xbe14('0x38')][_0xbe14('0x3a')]?_0x354181[_0xbe14('0x38')]:_0x555cb5['model'];_0x354181[_0xbe14('0x3d')]=qs[_0xbe14('0x3e')](_0x19123a[_0xbe14('0x35')]['sort']);_0x354181[_0xbe14('0x3f')]=qs[_0xbe14('0x37')](_['pick'](_0x19123a['query'],_0x555cb5['filters']));if(_0x19123a[_0xbe14('0x35')][_0xbe14('0x40')]){_0x354181[_0xbe14('0x3f')]=_['merge'](_0x354181['where'],{'$or':_[_0xbe14('0x2f')](_0x354181['attributes'],function(_0x1a69c6){var _0x51e6e7={};_0x51e6e7[_0x1a69c6]={'$like':'%'+_0x19123a[_0xbe14('0x35')]['filter']+'%'};return _0x51e6e7;})});}_0x354181=_['merge']({},_0x354181,_0x19123a[_0xbe14('0x41')]);return _0xeb2627[_0xbe14('0x60')](_0x354181);}})[_0xbe14('0x27')](function(_0x6d95b3){if(_0x6d95b3){_0x71d97b=_0x6d95b3[_0xbe14('0x3a')];if(!_0x19123a[_0xbe14('0x35')][_0xbe14('0x3b')](_0xbe14('0x3c'))){_0x354181[_0xbe14('0x1f')]=qs[_0xbe14('0x1f')](_0x19123a[_0xbe14('0x35')][_0xbe14('0x1f')]);_0x354181[_0xbe14('0x1e')]=qs['offset'](_0x19123a[_0xbe14('0x35')][_0xbe14('0x1e')]);}return _0xeb2627['getActions'](_0x354181);}})['then'](function(_0xb54ce3){if(_0xb54ce3){return _0xb54ce3?{'count':_0x71d97b,'rows':_0xb54ce3}:null;}})[_0xbe14('0x27')](respondWithResult(_0x8e6966,null))[_0xbe14('0x46')](handleError(_0x8e6966,null));}; \ No newline at end of file +var _0xc228=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','error','stack','send','map','Trigger','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','name','options','count','include','findAll','catch','show','params','keys','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','order','getAllConditions','nolimit','addAction','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x6e0b0b,_0x106e94){var _0x2683f6=function(_0x9e56c2){while(--_0x9e56c2){_0x6e0b0b['push'](_0x6e0b0b['shift']());}};_0x2683f6(++_0x106e94);}(_0xc228,0x16f));var _0x8c22=function(_0xe7210,_0x542e38){_0xe7210=_0xe7210-0x0;var _0x1d469d=_0xc228[_0xe7210];return _0x1d469d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c22('0x0'));var jsonpatch=require(_0x8c22('0x1'));var rp=require(_0x8c22('0x2'));var moment=require(_0x8c22('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8c22('0x4'));var util=require('util');var path=require(_0x8c22('0x5'));var sox=require('sox');var csv=require(_0x8c22('0x6'));var ejs=require(_0x8c22('0x7'));var fs=require('fs');var fs_extra=require(_0x8c22('0x8'));var _=require(_0x8c22('0x9'));var squel=require(_0x8c22('0xa'));var crypto=require(_0x8c22('0xb'));var jsforce=require(_0x8c22('0xc'));var deskjs=require(_0x8c22('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c22('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c22('0xf'));var authService=require(_0x8c22('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c22('0x11'));var hardwareService=require(_0x8c22('0x12'));var logger=require(_0x8c22('0x13'))(_0x8c22('0x14'));var utils=require(_0x8c22('0x15'));var config=require(_0x8c22('0x16'));var licenseUtil=require(_0x8c22('0x17'));var db=require(_0x8c22('0x18'))['db'];function respondWithStatusCode(_0x27a3fd,_0x3a7915){_0x3a7915=_0x3a7915||0xcc;return function(_0x532b01){if(_0x532b01){return _0x27a3fd[_0x8c22('0x19')](_0x3a7915);}return _0x27a3fd[_0x8c22('0x1a')](_0x3a7915)[_0x8c22('0x1b')]();};}function respondWithResult(_0x324565,_0x4eb60c){_0x4eb60c=_0x4eb60c||0xc8;return function(_0x4843fd){if(_0x4843fd){return _0x324565['status'](_0x4eb60c)[_0x8c22('0x1c')](_0x4843fd);}};}function respondWithFilteredResult(_0x3ce4c0,_0x415951){return function(_0x5a349c){if(_0x5a349c){var _0xc574c9=typeof _0x415951[_0x8c22('0x1d')]==='undefined'&&typeof _0x415951[_0x8c22('0x1e')]===_0x8c22('0x1f');var _0x5867fe=_0x5a349c['count'];var _0x5f2c68=_0xc574c9?0x0:_0x415951[_0x8c22('0x1d')];var _0x30a38d=_0xc574c9?_0x5a349c['count']:_0x415951[_0x8c22('0x1d')]+_0x415951[_0x8c22('0x1e')];var _0x411646;if(_0x30a38d>=_0x5867fe){_0x30a38d=_0x5867fe;_0x411646=0xc8;}else{_0x411646=0xce;}_0x3ce4c0['status'](_0x411646);return _0x3ce4c0['set'](_0x8c22('0x20'),_0x5f2c68+'-'+_0x30a38d+'/'+_0x5867fe)[_0x8c22('0x1c')](_0x5a349c);}return null;};}function patchUpdates(_0x761dad){return function(_0x27d776){try{jsonpatch[_0x8c22('0x21')](_0x27d776,_0x761dad,!![]);}catch(_0x50b78d){return BPromise[_0x8c22('0x22')](_0x50b78d);}return _0x27d776[_0x8c22('0x23')]();};}function saveUpdates(_0x19b694,_0x2cbbe0){return function(_0x270630){if(_0x270630){return _0x270630[_0x8c22('0x24')](_0x19b694)[_0x8c22('0x25')](function(_0x1f2ba5){return _0x1f2ba5;});}return null;};}function removeEntity(_0x313679,_0x457d86){return function(_0x401432){if(_0x401432){return _0x401432[_0x8c22('0x26')]()[_0x8c22('0x25')](function(){var _0x3f8200=_0x401432['get']({'plain':!![]});var _0x3f9474=_0x8c22('0x27');return db[_0x8c22('0x28')][_0x8c22('0x26')]({'where':{'type':_0x3f9474,'resourceId':_0x3f8200['id']}})['then'](function(){return _0x401432;});})[_0x8c22('0x25')](function(){_0x313679['status'](0xcc)[_0x8c22('0x1b')]();});}};}function handleEntityNotFound(_0x73bee2,_0x42559f){return function(_0x36ae72){if(!_0x36ae72){_0x73bee2[_0x8c22('0x19')](0x194);}return _0x36ae72;};}function handleError(_0x414d16,_0x55700d){_0x55700d=_0x55700d||0x1f4;return function(_0x53e5be){logger[_0x8c22('0x29')](_0x53e5be[_0x8c22('0x2a')]);if(_0x53e5be['name']){delete _0x53e5be['name'];}_0x414d16[_0x8c22('0x1a')](_0x55700d)[_0x8c22('0x2b')](_0x53e5be);};}exports['index']=function(_0x48beff,_0x120060){var _0x5502b5={},_0x1a8fd0={},_0x2a36c7={'count':0x0,'rows':[]};var _0x366bea=_[_0x8c22('0x2c')](db[_0x8c22('0x2d')][_0x8c22('0x2e')],function(_0x2bf584){return{'name':_0x2bf584[_0x8c22('0x2f')],'type':_0x2bf584['type'][_0x8c22('0x30')]};});_0x1a8fd0[_0x8c22('0x31')]=_['map'](_0x366bea,'name');_0x1a8fd0[_0x8c22('0x32')]=_['keys'](_0x48beff[_0x8c22('0x32')]);_0x1a8fd0[_0x8c22('0x33')]=_[_0x8c22('0x34')](_0x1a8fd0[_0x8c22('0x31')],_0x1a8fd0['query']);_0x5502b5[_0x8c22('0x35')]=_[_0x8c22('0x34')](_0x1a8fd0[_0x8c22('0x31')],qs[_0x8c22('0x36')](_0x48beff[_0x8c22('0x32')][_0x8c22('0x36')]));_0x5502b5[_0x8c22('0x35')]=_0x5502b5[_0x8c22('0x35')]['length']?_0x5502b5[_0x8c22('0x35')]:_0x1a8fd0['model'];if(!_0x48beff[_0x8c22('0x32')][_0x8c22('0x37')]('nolimit')){_0x5502b5['limit']=qs[_0x8c22('0x1e')](_0x48beff[_0x8c22('0x32')]['limit']);_0x5502b5[_0x8c22('0x1d')]=qs['offset'](_0x48beff['query'][_0x8c22('0x1d')]);}_0x5502b5['order']=qs[_0x8c22('0x38')](_0x48beff[_0x8c22('0x32')]['sort']);_0x5502b5[_0x8c22('0x39')]=qs[_0x8c22('0x33')](_[_0x8c22('0x3a')](_0x48beff[_0x8c22('0x32')],_0x1a8fd0[_0x8c22('0x33')]),_0x366bea);if(_0x48beff[_0x8c22('0x32')][_0x8c22('0x3b')]){_0x5502b5[_0x8c22('0x39')]=_[_0x8c22('0x3c')](_0x5502b5[_0x8c22('0x39')],{'$or':_[_0x8c22('0x2c')](_0x366bea,function(_0x3aa744){if(_0x3aa744[_0x8c22('0x3d')]!==_0x8c22('0x3e')){var _0x402c10={};_0x402c10[_0x3aa744[_0x8c22('0x3f')]]={'$like':'%'+_0x48beff[_0x8c22('0x32')]['filter']+'%'};return _0x402c10;}})});}_0x5502b5=_[_0x8c22('0x3c')]({},_0x5502b5,_0x48beff[_0x8c22('0x40')]);var _0xbd6f54={'where':_0x5502b5[_0x8c22('0x39')]};return db[_0x8c22('0x2d')][_0x8c22('0x41')](_0xbd6f54)[_0x8c22('0x25')](function(_0xf1d0d){_0x2a36c7['count']=_0xf1d0d;if(_0x48beff[_0x8c22('0x32')]['includeAll']){_0x5502b5[_0x8c22('0x42')]=[{'all':!![]}];}return db[_0x8c22('0x2d')][_0x8c22('0x43')](_0x5502b5);})[_0x8c22('0x25')](function(_0x336d3f){_0x2a36c7['rows']=_0x336d3f;return _0x2a36c7;})[_0x8c22('0x25')](respondWithFilteredResult(_0x120060,_0x5502b5))[_0x8c22('0x44')](handleError(_0x120060,null));};exports[_0x8c22('0x45')]=function(_0x17cb59,_0x3947da){var _0xa93675={'raw':![],'where':{'id':_0x17cb59[_0x8c22('0x46')]['id']}},_0x12cadb={};_0x12cadb[_0x8c22('0x31')]=_[_0x8c22('0x47')](db['Trigger'][_0x8c22('0x2e')]);_0x12cadb['query']=_[_0x8c22('0x47')](_0x17cb59['query']);_0x12cadb[_0x8c22('0x33')]=_[_0x8c22('0x34')](_0x12cadb[_0x8c22('0x31')],_0x12cadb['query']);_0xa93675[_0x8c22('0x35')]=_['intersection'](_0x12cadb[_0x8c22('0x31')],qs[_0x8c22('0x36')](_0x17cb59[_0x8c22('0x32')][_0x8c22('0x36')]));_0xa93675['attributes']=_0xa93675[_0x8c22('0x35')][_0x8c22('0x48')]?_0xa93675[_0x8c22('0x35')]:_0x12cadb[_0x8c22('0x31')];if(_0x17cb59[_0x8c22('0x32')][_0x8c22('0x49')]){_0xa93675['include']=[{'all':!![]}];}_0xa93675=_[_0x8c22('0x3c')]({},_0xa93675,_0x17cb59[_0x8c22('0x40')]);return db[_0x8c22('0x2d')][_0x8c22('0x4a')](_0xa93675)[_0x8c22('0x25')](handleEntityNotFound(_0x3947da,null))[_0x8c22('0x25')](respondWithResult(_0x3947da,null))[_0x8c22('0x44')](handleError(_0x3947da,null));};exports[_0x8c22('0x4b')]=function(_0x4e9923,_0x260b17){return db[_0x8c22('0x2d')][_0x8c22('0x4b')](_0x4e9923['body'],{})[_0x8c22('0x25')](function(_0x5918b3){var _0x3277ec=_0x4e9923[_0x8c22('0x4c')][_0x8c22('0x4d')]({'plain':!![]});if(!_0x3277ec)throw new Error(_0x8c22('0x4e'));if(_0x3277ec['role']===_0x8c22('0x4c')){var _0x3b4704=_0x5918b3['get']({'plain':!![]});var _0x50b5a6=_0x8c22('0x27');return db[_0x8c22('0x4f')]['find']({'where':{'name':_0x50b5a6,'userProfileId':_0x3277ec[_0x8c22('0x50')]},'raw':!![]})[_0x8c22('0x25')](function(_0x4a749c){if(_0x4a749c&&_0x4a749c[_0x8c22('0x51')]===0x0){return db[_0x8c22('0x28')][_0x8c22('0x4b')]({'name':_0x3b4704[_0x8c22('0x3f')],'resourceId':_0x3b4704['id'],'type':_0x4a749c[_0x8c22('0x3f')],'sectionId':_0x4a749c['id']},{})[_0x8c22('0x25')](function(){return _0x5918b3;});}else{return _0x5918b3;}})[_0x8c22('0x44')](function(_0x50456c){logger[_0x8c22('0x29')](_0x8c22('0x52'),_0x50456c);throw _0x50456c;});}return _0x5918b3;})['then'](respondWithResult(_0x260b17,0xc9))[_0x8c22('0x44')](handleError(_0x260b17,null));};exports['update']=function(_0x1b9bb3,_0x344f84){if(_0x1b9bb3[_0x8c22('0x53')]['id']){delete _0x1b9bb3[_0x8c22('0x53')]['id'];}return db[_0x8c22('0x2d')][_0x8c22('0x4a')]({'where':{'id':_0x1b9bb3[_0x8c22('0x46')]['id']}})['then'](handleEntityNotFound(_0x344f84,null))[_0x8c22('0x25')](saveUpdates(_0x1b9bb3[_0x8c22('0x53')],null))['then'](respondWithResult(_0x344f84,null))[_0x8c22('0x44')](handleError(_0x344f84,null));};exports[_0x8c22('0x26')]=function(_0x2f8c39,_0x14e13f){return db[_0x8c22('0x2d')]['find']({'where':{'id':_0x2f8c39[_0x8c22('0x46')]['id']}})['then'](handleEntityNotFound(_0x14e13f,null))['then'](removeEntity(_0x14e13f,null))[_0x8c22('0x44')](handleError(_0x14e13f,null));};exports[_0x8c22('0x54')]=function(_0x56049f,_0x429b7c,_0x5e4a61){if(_0x56049f['body']['id']){delete _0x56049f[_0x8c22('0x53')]['id'];}return db[_0x8c22('0x2d')][_0x8c22('0x4a')]({'where':{'id':_0x56049f[_0x8c22('0x46')]['id']}})[_0x8c22('0x25')](handleEntityNotFound(_0x429b7c,null))[_0x8c22('0x25')](function(_0x49aaf2){if(_0x49aaf2){_0x56049f[_0x8c22('0x53')][_0x8c22('0x55')]=_0x49aaf2['id'];return db[_0x8c22('0x56')]['create'](_0x56049f['body']);}})['then'](respondWithResult(_0x429b7c,null))[_0x8c22('0x44')](handleError(_0x429b7c,null));};exports['addAnyCondition']=function(_0x51aec4,_0x2ae2e7,_0x55bcdd){if(_0x51aec4[_0x8c22('0x53')]['id']){delete _0x51aec4[_0x8c22('0x53')]['id'];}return db['Trigger'][_0x8c22('0x4a')]({'where':{'id':_0x51aec4[_0x8c22('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ae2e7,null))[_0x8c22('0x25')](function(_0x37277f){if(_0x37277f){_0x51aec4[_0x8c22('0x53')][_0x8c22('0x57')]=_0x37277f['id'];return db['Condition'][_0x8c22('0x4b')](_0x51aec4[_0x8c22('0x53')]);}})[_0x8c22('0x25')](respondWithResult(_0x2ae2e7,null))[_0x8c22('0x44')](handleError(_0x2ae2e7,null));};exports['getAllConditions']=function(_0x2d57bd,_0x355b03,_0x55e6cd){var _0x18c3c1={};var _0x5ebcde={};var _0x1ad336;var _0x54c95a;return db[_0x8c22('0x2d')][_0x8c22('0x58')]({'where':{'id':_0x2d57bd[_0x8c22('0x46')]['id']}})['then'](handleEntityNotFound(_0x355b03,null))[_0x8c22('0x25')](function(_0x4f902a){if(_0x4f902a){_0x1ad336=_0x4f902a;_0x5ebcde['model']=_[_0x8c22('0x47')](db[_0x8c22('0x56')][_0x8c22('0x2e')]);_0x5ebcde[_0x8c22('0x32')]=_['keys'](_0x2d57bd['query']);_0x5ebcde[_0x8c22('0x33')]=_['intersection'](_0x5ebcde[_0x8c22('0x31')],_0x5ebcde[_0x8c22('0x32')]);_0x18c3c1['attributes']=_['intersection'](_0x5ebcde[_0x8c22('0x31')],qs['fields'](_0x2d57bd[_0x8c22('0x32')][_0x8c22('0x36')]));_0x18c3c1['attributes']=_0x18c3c1['attributes']['length']?_0x18c3c1[_0x8c22('0x35')]:_0x5ebcde[_0x8c22('0x31')];_0x18c3c1[_0x8c22('0x59')]=qs[_0x8c22('0x38')](_0x2d57bd[_0x8c22('0x32')][_0x8c22('0x38')]);_0x18c3c1[_0x8c22('0x39')]=qs[_0x8c22('0x33')](_[_0x8c22('0x3a')](_0x2d57bd[_0x8c22('0x32')],_0x5ebcde['filters']));if(_0x2d57bd['query'][_0x8c22('0x3b')]){_0x18c3c1[_0x8c22('0x39')]=_[_0x8c22('0x3c')](_0x18c3c1[_0x8c22('0x39')],{'$or':_[_0x8c22('0x2c')](_0x18c3c1[_0x8c22('0x35')],function(_0x36b3bf){var _0x48faaa={};_0x48faaa[_0x36b3bf]={'$like':'%'+_0x2d57bd['query'][_0x8c22('0x3b')]+'%'};return _0x48faaa;})});}_0x18c3c1=_[_0x8c22('0x3c')]({},_0x18c3c1,_0x2d57bd[_0x8c22('0x40')]);return _0x1ad336[_0x8c22('0x5a')](_0x18c3c1);}})[_0x8c22('0x25')](function(_0x4449ee){if(_0x4449ee){_0x54c95a=_0x4449ee[_0x8c22('0x48')];if(!_0x2d57bd['query'][_0x8c22('0x37')](_0x8c22('0x5b'))){_0x18c3c1[_0x8c22('0x1e')]=qs[_0x8c22('0x1e')](_0x2d57bd[_0x8c22('0x32')]['limit']);_0x18c3c1[_0x8c22('0x1d')]=qs['offset'](_0x2d57bd[_0x8c22('0x32')]['offset']);}return _0x1ad336[_0x8c22('0x5a')](_0x18c3c1);}})[_0x8c22('0x25')](function(_0x307c82){if(_0x307c82){return _0x307c82?{'count':_0x54c95a,'rows':_0x307c82}:null;}})[_0x8c22('0x25')](respondWithResult(_0x355b03,null))['catch'](handleError(_0x355b03,null));};exports['getAnyConditions']=function(_0x18efad,_0x2645e3,_0x259289){var _0x2b3f01={};var _0x386d51={};var _0x675931;var _0x46366c;return db[_0x8c22('0x2d')]['findOne']({'where':{'id':_0x18efad['params']['id']}})[_0x8c22('0x25')](handleEntityNotFound(_0x2645e3,null))[_0x8c22('0x25')](function(_0x1d3898){if(_0x1d3898){_0x675931=_0x1d3898;_0x386d51[_0x8c22('0x31')]=_[_0x8c22('0x47')](db[_0x8c22('0x56')][_0x8c22('0x2e')]);_0x386d51[_0x8c22('0x32')]=_[_0x8c22('0x47')](_0x18efad[_0x8c22('0x32')]);_0x386d51[_0x8c22('0x33')]=_[_0x8c22('0x34')](_0x386d51[_0x8c22('0x31')],_0x386d51[_0x8c22('0x32')]);_0x2b3f01[_0x8c22('0x35')]=_[_0x8c22('0x34')](_0x386d51[_0x8c22('0x31')],qs['fields'](_0x18efad[_0x8c22('0x32')]['fields']));_0x2b3f01[_0x8c22('0x35')]=_0x2b3f01[_0x8c22('0x35')]['length']?_0x2b3f01[_0x8c22('0x35')]:_0x386d51[_0x8c22('0x31')];_0x2b3f01[_0x8c22('0x59')]=qs[_0x8c22('0x38')](_0x18efad[_0x8c22('0x32')][_0x8c22('0x38')]);_0x2b3f01[_0x8c22('0x39')]=qs[_0x8c22('0x33')](_[_0x8c22('0x3a')](_0x18efad[_0x8c22('0x32')],_0x386d51[_0x8c22('0x33')]));if(_0x18efad[_0x8c22('0x32')]['filter']){_0x2b3f01[_0x8c22('0x39')]=_['merge'](_0x2b3f01[_0x8c22('0x39')],{'$or':_[_0x8c22('0x2c')](_0x2b3f01[_0x8c22('0x35')],function(_0x44ffc0){var _0x72b466={};_0x72b466[_0x44ffc0]={'$like':'%'+_0x18efad[_0x8c22('0x32')][_0x8c22('0x3b')]+'%'};return _0x72b466;})});}_0x2b3f01=_[_0x8c22('0x3c')]({},_0x2b3f01,_0x18efad[_0x8c22('0x40')]);return _0x675931['getAnyConditions'](_0x2b3f01);}})['then'](function(_0x30ec51){if(_0x30ec51){_0x46366c=_0x30ec51['length'];if(!_0x18efad['query']['hasOwnProperty'](_0x8c22('0x5b'))){_0x2b3f01['limit']=qs[_0x8c22('0x1e')](_0x18efad[_0x8c22('0x32')][_0x8c22('0x1e')]);_0x2b3f01[_0x8c22('0x1d')]=qs['offset'](_0x18efad[_0x8c22('0x32')][_0x8c22('0x1d')]);}return _0x675931['getAnyConditions'](_0x2b3f01);}})[_0x8c22('0x25')](function(_0x558cdf){if(_0x558cdf){return _0x558cdf?{'count':_0x46366c,'rows':_0x558cdf}:null;}})['then'](respondWithResult(_0x2645e3,null))[_0x8c22('0x44')](handleError(_0x2645e3,null));};exports[_0x8c22('0x5c')]=function(_0x440e61,_0x4b421c,_0x23f1e8){if(_0x440e61[_0x8c22('0x53')]['id']){delete _0x440e61['body']['id'];}return db[_0x8c22('0x2d')]['find']({'where':{'id':_0x440e61[_0x8c22('0x46')]['id']}})[_0x8c22('0x25')](handleEntityNotFound(_0x4b421c,null))[_0x8c22('0x25')](function(_0x147af0){if(_0x147af0){_0x440e61[_0x8c22('0x53')][_0x8c22('0x5d')]=_0x147af0['id'];return db[_0x8c22('0x5e')][_0x8c22('0x4b')](_0x440e61[_0x8c22('0x53')]);}})['then'](respondWithResult(_0x4b421c,null))['catch'](handleError(_0x4b421c,null));};exports[_0x8c22('0x5f')]=function(_0x4c5b2c,_0x5a4cb4,_0x56088f){var _0xd7c1c0={};var _0x43eeed={};var _0x1eda74;var _0x4abb5b;return db[_0x8c22('0x2d')][_0x8c22('0x58')]({'where':{'id':_0x4c5b2c['params']['id']}})[_0x8c22('0x25')](handleEntityNotFound(_0x5a4cb4,null))[_0x8c22('0x25')](function(_0x52443b){if(_0x52443b){_0x1eda74=_0x52443b;_0x43eeed[_0x8c22('0x31')]=_[_0x8c22('0x47')](db[_0x8c22('0x5e')][_0x8c22('0x2e')]);_0x43eeed['query']=_[_0x8c22('0x47')](_0x4c5b2c[_0x8c22('0x32')]);_0x43eeed[_0x8c22('0x33')]=_[_0x8c22('0x34')](_0x43eeed[_0x8c22('0x31')],_0x43eeed[_0x8c22('0x32')]);_0xd7c1c0[_0x8c22('0x35')]=_[_0x8c22('0x34')](_0x43eeed[_0x8c22('0x31')],qs[_0x8c22('0x36')](_0x4c5b2c[_0x8c22('0x32')]['fields']));_0xd7c1c0['attributes']=_0xd7c1c0['attributes'][_0x8c22('0x48')]?_0xd7c1c0[_0x8c22('0x35')]:_0x43eeed[_0x8c22('0x31')];_0xd7c1c0[_0x8c22('0x59')]=qs[_0x8c22('0x38')](_0x4c5b2c[_0x8c22('0x32')][_0x8c22('0x38')]);_0xd7c1c0[_0x8c22('0x39')]=qs['filters'](_[_0x8c22('0x3a')](_0x4c5b2c[_0x8c22('0x32')],_0x43eeed['filters']));if(_0x4c5b2c[_0x8c22('0x32')]['filter']){_0xd7c1c0['where']=_[_0x8c22('0x3c')](_0xd7c1c0[_0x8c22('0x39')],{'$or':_[_0x8c22('0x2c')](_0xd7c1c0['attributes'],function(_0x3c81f9){var _0xf7e53d={};_0xf7e53d[_0x3c81f9]={'$like':'%'+_0x4c5b2c[_0x8c22('0x32')][_0x8c22('0x3b')]+'%'};return _0xf7e53d;})});}_0xd7c1c0=_[_0x8c22('0x3c')]({},_0xd7c1c0,_0x4c5b2c[_0x8c22('0x40')]);return _0x1eda74[_0x8c22('0x5f')](_0xd7c1c0);}})[_0x8c22('0x25')](function(_0x1cacf4){if(_0x1cacf4){_0x4abb5b=_0x1cacf4[_0x8c22('0x48')];if(!_0x4c5b2c[_0x8c22('0x32')][_0x8c22('0x37')](_0x8c22('0x5b'))){_0xd7c1c0[_0x8c22('0x1e')]=qs[_0x8c22('0x1e')](_0x4c5b2c[_0x8c22('0x32')][_0x8c22('0x1e')]);_0xd7c1c0[_0x8c22('0x1d')]=qs[_0x8c22('0x1d')](_0x4c5b2c[_0x8c22('0x32')]['offset']);}return _0x1eda74[_0x8c22('0x5f')](_0xd7c1c0);}})['then'](function(_0x51c4a4){if(_0x51c4a4){return _0x51c4a4?{'count':_0x4abb5b,'rows':_0x51c4a4}:null;}})['then'](respondWithResult(_0x5a4cb4,null))[_0x8c22('0x44')](handleError(_0x5a4cb4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a5cd7e5..030bd1a 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 _0x6737=['../../config/environment','./trigger.attributes','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1a3ebb,_0xac2d4f){var _0x16bb10=function(_0xdf8713){while(--_0xdf8713){_0x1a3ebb['push'](_0x1a3ebb['shift']());}};_0x16bb10(++_0xac2d4f);}(_0x6737,0xe2));var _0x7673=function(_0xa36ad,_0x4ff2b6){_0xa36ad=_0xa36ad-0x0;var _0x388b44=_0x6737[_0xa36ad];return _0x388b44;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['./trigger.attributes','Trigger','tools_triggers','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2e57f1,_0x3bf454){var _0x14b828=function(_0x39fa64){while(--_0x39fa64){_0x2e57f1['push'](_0x2e57f1['shift']());}};_0x14b828(++_0x3bf454);}(_0xf2cf,0xf5));var _0xff2c=function(_0x56c038,_0x49c1df){_0x56c038=_0x56c038-0x0;var _0xbdbe61=_0xf2cf[_0x56c038];return _0xbdbe61;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'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 5abfaae..d6eec2b 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 _0xd958=['map','model','then','GetTrigger','catch','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Trigger','findAll','options','raw','attributes','limit','include'];(function(_0x5bcb00,_0x72f609){var _0x496ad1=function(_0x4a01c1){while(--_0x4a01c1){_0x5bcb00['push'](_0x5bcb00['shift']());}};_0x496ad1(++_0x72f609);}(_0xd958,0x1aa));var _0x8d95=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd958[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d95('0x0'));var BPromise=require(_0x8d95('0x1'));var rs=require(_0x8d95('0x2'));var fs=require('fs');var Redis=require(_0x8d95('0x3'));var db=require(_0x8d95('0x4'))['db'];var utils=require(_0x8d95('0x5'));var logger=require(_0x8d95('0x6'))(_0x8d95('0x7'));var config=require(_0x8d95('0x8'));var jayson=require(_0x8d95('0x9'));var client=jayson[_0x8d95('0xa')][_0x8d95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x105ffb,_0x2f2801,_0x46b8ac){return new BPromise(function(_0x1a950d,_0x5cf88e){return client[_0x8d95('0xc')](_0x105ffb,_0x46b8ac)['then'](function(_0x3ac6c2){logger[_0x8d95('0xd')](_0x8d95('0xe'),_0x2f2801,_0x8d95('0xf'));logger[_0x8d95('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x2f2801,'request\x20sent',JSON[_0x8d95('0x11')](_0x3ac6c2));if(_0x3ac6c2[_0x8d95('0x12')]){if(_0x3ac6c2[_0x8d95('0x12')][_0x8d95('0x13')]===0x1f4){logger[_0x8d95('0x12')](_0x8d95('0xe'),_0x2f2801,_0x3ac6c2[_0x8d95('0x12')]['message']);return _0x5cf88e(_0x3ac6c2[_0x8d95('0x12')][_0x8d95('0x14')]);}logger[_0x8d95('0x12')]('Trigger,\x20%s,\x20%s',_0x2f2801,_0x3ac6c2[_0x8d95('0x12')][_0x8d95('0x14')]);return _0x1a950d(_0x3ac6c2['error'][_0x8d95('0x14')]);}else{logger['info'](_0x8d95('0xe'),_0x2f2801,_0x8d95('0xf'));_0x1a950d(_0x3ac6c2[_0x8d95('0x15')][_0x8d95('0x14')]);}})['catch'](function(_0x351d1d){logger[_0x8d95('0x12')](_0x8d95('0xe'),_0x2f2801,_0x351d1d);_0x5cf88e(_0x351d1d);});});}exports['GetTrigger']=function(_0x47a179){var _0x45262c=this;return new Promise(function(_0x136c1b,_0x2b7c6f){return db[_0x8d95('0x16')][_0x8d95('0x17')]({'raw':_0x47a179[_0x8d95('0x18')]?_0x47a179[_0x8d95('0x18')][_0x8d95('0x19')]===undefined?!![]:![]:!![],'where':_0x47a179[_0x8d95('0x18')]?_0x47a179[_0x8d95('0x18')]['where']||null:null,'attributes':_0x47a179['options']?_0x47a179[_0x8d95('0x18')][_0x8d95('0x1a')]||null:null,'limit':_0x47a179['options']?_0x47a179['options'][_0x8d95('0x1b')]||null:null,'include':_0x47a179['options']?_0x47a179[_0x8d95('0x18')][_0x8d95('0x1c')]?_[_0x8d95('0x1d')](_0x47a179['options']['include'],function(_0x312e07){return{'model':db[_0x312e07[_0x8d95('0x1e')]],'as':_0x312e07['as'],'attributes':_0x312e07['attributes'],'include':_0x312e07[_0x8d95('0x1c')]?_[_0x8d95('0x1d')](_0x312e07[_0x8d95('0x1c')],function(_0x24fa9e){return{'model':db[_0x24fa9e[_0x8d95('0x1e')]],'as':_0x24fa9e['as'],'attributes':_0x24fa9e[_0x8d95('0x1a')],'include':_0x24fa9e[_0x8d95('0x1c')]?_[_0x8d95('0x1d')](_0x24fa9e[_0x8d95('0x1c')],function(_0x4dc0c7){return{'model':db[_0x4dc0c7[_0x8d95('0x1e')]],'as':_0x4dc0c7['as'],'attributes':_0x4dc0c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d95('0x1f')](function(_0x744699){logger['info']('GetTrigger',_0x47a179);logger[_0x8d95('0x10')](_0x8d95('0x20'),_0x47a179,JSON[_0x8d95('0x11')](_0x744699));_0x136c1b(_0x744699);})[_0x8d95('0x21')](function(_0x3bdae6){logger[_0x8d95('0x12')]('GetTrigger',_0x3bdae6['message'],_0x47a179);_0x2b7c6f(_0x45262c['error'](0x1f4,_0x3bdae6[_0x8d95('0x14')]));});});};exports[_0x8d95('0x22')]=function(_0x58d580){var _0x1bb7a0=this;return new Promise(function(_0x31839b,_0x2d4876){return db[_0x8d95('0x16')]['find']({'raw':_0x58d580[_0x8d95('0x18')]?_0x58d580['options']['raw']===undefined?!![]:![]:!![],'where':_0x58d580[_0x8d95('0x18')]?_0x58d580['options']['where']||null:null,'attributes':_0x58d580[_0x8d95('0x18')]?_0x58d580[_0x8d95('0x18')]['attributes']||null:null,'include':_0x58d580['options']?_0x58d580[_0x8d95('0x18')][_0x8d95('0x1c')]?_[_0x8d95('0x1d')](_0x58d580['options'][_0x8d95('0x1c')],function(_0xc5b2d5){return{'model':db[_0xc5b2d5[_0x8d95('0x1e')]],'as':_0xc5b2d5['as'],'attributes':_0xc5b2d5['attributes'],'include':_0xc5b2d5[_0x8d95('0x1c')]?_['map'](_0xc5b2d5[_0x8d95('0x1c')],function(_0x4b415a){return{'model':db[_0x4b415a[_0x8d95('0x1e')]],'as':_0x4b415a['as'],'attributes':_0x4b415a[_0x8d95('0x1a')],'include':_0x4b415a['include']?_[_0x8d95('0x1d')](_0x4b415a[_0x8d95('0x1c')],function(_0x42b9e0){return{'model':db[_0x42b9e0[_0x8d95('0x1e')]],'as':_0x42b9e0['as'],'attributes':_0x42b9e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d95('0x1f')](function(_0x56eb07){logger[_0x8d95('0xd')]('ShowTrigger',_0x58d580);logger[_0x8d95('0x10')](_0x8d95('0x22'),_0x58d580,JSON[_0x8d95('0x11')](_0x56eb07));_0x31839b(_0x56eb07);})[_0x8d95('0x21')](function(_0x140ddc){logger[_0x8d95('0x12')](_0x8d95('0x22'),_0x140ddc[_0x8d95('0x14')],_0x58d580);_0x2d4876(_0x1bb7a0[_0x8d95('0x12')](0x1f4,_0x140ddc[_0x8d95('0x14')]));});});}; \ No newline at end of file +var _0x7ff2=['where','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','Trigger,\x20%s,\x20%s','result','Trigger','findAll','options','attributes','include','map','model','GetTrigger','debug','catch','ShowTrigger','find','raw'];(function(_0x1b1f15,_0x3faa8a){var _0x69c36c=function(_0x54a66e){while(--_0x54a66e){_0x1b1f15['push'](_0x1b1f15['shift']());}};_0x69c36c(++_0x3faa8a);}(_0x7ff2,0x178));var _0x27ff=function(_0x580d09,_0x63bdeb){_0x580d09=_0x580d09-0x0;var _0x48c1ed=_0x7ff2[_0x580d09];return _0x48c1ed;};'use strict';var _=require(_0x27ff('0x0'));var util=require(_0x27ff('0x1'));var moment=require(_0x27ff('0x2'));var BPromise=require('bluebird');var rs=require(_0x27ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27ff('0x4'))['db'];var utils=require(_0x27ff('0x5'));var logger=require(_0x27ff('0x6'))(_0x27ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x27ff('0x8'));var client=jayson[_0x27ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x645276,_0x5b1a20,_0x1502c1){return new BPromise(function(_0x41113f,_0x4dd79d){return client[_0x27ff('0xa')](_0x645276,_0x1502c1)['then'](function(_0x273cbe){logger[_0x27ff('0xb')]('Trigger,\x20%s,\x20%s',_0x5b1a20,_0x27ff('0xc'));logger['debug'](_0x27ff('0xd'),_0x5b1a20,_0x27ff('0xc'),JSON[_0x27ff('0xe')](_0x273cbe));if(_0x273cbe['error']){if(_0x273cbe[_0x27ff('0xf')]['code']===0x1f4){logger[_0x27ff('0xf')]('Trigger,\x20%s,\x20%s',_0x5b1a20,_0x273cbe[_0x27ff('0xf')][_0x27ff('0x10')]);return _0x4dd79d(_0x273cbe[_0x27ff('0xf')][_0x27ff('0x10')]);}logger['error'](_0x27ff('0x11'),_0x5b1a20,_0x273cbe[_0x27ff('0xf')][_0x27ff('0x10')]);return _0x41113f(_0x273cbe[_0x27ff('0xf')][_0x27ff('0x10')]);}else{logger[_0x27ff('0xb')](_0x27ff('0x11'),_0x5b1a20,_0x27ff('0xc'));_0x41113f(_0x273cbe[_0x27ff('0x12')][_0x27ff('0x10')]);}})['catch'](function(_0x30f162){logger[_0x27ff('0xf')](_0x27ff('0x11'),_0x5b1a20,_0x30f162);_0x4dd79d(_0x30f162);});});}exports['GetTrigger']=function(_0x4d8ab1){var _0x27ebdf=this;return new Promise(function(_0x14ec7b,_0x5b1e6f){return db[_0x27ff('0x13')][_0x27ff('0x14')]({'raw':_0x4d8ab1[_0x27ff('0x15')]?_0x4d8ab1[_0x27ff('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4d8ab1[_0x27ff('0x15')]?_0x4d8ab1[_0x27ff('0x15')]['where']||null:null,'attributes':_0x4d8ab1[_0x27ff('0x15')]?_0x4d8ab1[_0x27ff('0x15')][_0x27ff('0x16')]||null:null,'limit':_0x4d8ab1['options']?_0x4d8ab1[_0x27ff('0x15')]['limit']||null:null,'include':_0x4d8ab1[_0x27ff('0x15')]?_0x4d8ab1[_0x27ff('0x15')][_0x27ff('0x17')]?_[_0x27ff('0x18')](_0x4d8ab1[_0x27ff('0x15')]['include'],function(_0x10385d){return{'model':db[_0x10385d[_0x27ff('0x19')]],'as':_0x10385d['as'],'attributes':_0x10385d[_0x27ff('0x16')],'include':_0x10385d['include']?_[_0x27ff('0x18')](_0x10385d['include'],function(_0x565a8f){return{'model':db[_0x565a8f['model']],'as':_0x565a8f['as'],'attributes':_0x565a8f[_0x27ff('0x16')],'include':_0x565a8f['include']?_['map'](_0x565a8f[_0x27ff('0x17')],function(_0x29a07d){return{'model':db[_0x29a07d['model']],'as':_0x29a07d['as'],'attributes':_0x29a07d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x585383){logger[_0x27ff('0xb')](_0x27ff('0x1a'),_0x4d8ab1);logger[_0x27ff('0x1b')](_0x27ff('0x1a'),_0x4d8ab1,JSON[_0x27ff('0xe')](_0x585383));_0x14ec7b(_0x585383);})[_0x27ff('0x1c')](function(_0x4c4316){logger[_0x27ff('0xf')]('GetTrigger',_0x4c4316[_0x27ff('0x10')],_0x4d8ab1);_0x5b1e6f(_0x27ebdf[_0x27ff('0xf')](0x1f4,_0x4c4316[_0x27ff('0x10')]));});});};exports[_0x27ff('0x1d')]=function(_0x1264be){var _0x1d552c=this;return new Promise(function(_0x2d2bff,_0x4acaff){return db['Trigger'][_0x27ff('0x1e')]({'raw':_0x1264be['options']?_0x1264be[_0x27ff('0x15')][_0x27ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x1264be[_0x27ff('0x15')]?_0x1264be[_0x27ff('0x15')][_0x27ff('0x20')]||null:null,'attributes':_0x1264be[_0x27ff('0x15')]?_0x1264be[_0x27ff('0x15')][_0x27ff('0x16')]||null:null,'include':_0x1264be[_0x27ff('0x15')]?_0x1264be[_0x27ff('0x15')][_0x27ff('0x17')]?_[_0x27ff('0x18')](_0x1264be[_0x27ff('0x15')][_0x27ff('0x17')],function(_0x132865){return{'model':db[_0x132865['model']],'as':_0x132865['as'],'attributes':_0x132865[_0x27ff('0x16')],'include':_0x132865[_0x27ff('0x17')]?_[_0x27ff('0x18')](_0x132865['include'],function(_0x56141e){return{'model':db[_0x56141e[_0x27ff('0x19')]],'as':_0x56141e['as'],'attributes':_0x56141e[_0x27ff('0x16')],'include':_0x56141e[_0x27ff('0x17')]?_[_0x27ff('0x18')](_0x56141e[_0x27ff('0x17')],function(_0x25a6b2){return{'model':db[_0x25a6b2['model']],'as':_0x25a6b2['as'],'attributes':_0x25a6b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x27ff('0x21')](function(_0x429286){logger['info'](_0x27ff('0x1d'),_0x1264be);logger[_0x27ff('0x1b')]('ShowTrigger',_0x1264be,JSON[_0x27ff('0xe')](_0x429286));_0x2d2bff(_0x429286);})['catch'](function(_0x2ebb30){logger[_0x27ff('0xf')](_0x27ff('0x1d'),_0x2ebb30['message'],_0x1264be);_0x4acaff(_0x1d552c[_0x27ff('0xf')](0x1f4,_0x2ebb30[_0x27ff('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d252da7..cf81c53 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 _0x0445=['Router','fs-extra','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x22b62d,_0x42576d){var _0x40866e=function(_0x5ead97){while(--_0x5ead97){_0x22b62d['push'](_0x22b62d['shift']());}};_0x40866e(++_0x42576d);}(_0x0445,0xc2));var _0x5044=function(_0x43fda2,_0x1c5662){_0x43fda2=_0x43fda2-0x0;var _0xa492a2=_0x0445[_0x43fda2];return _0xa492a2;};'use strict';var multer=require(_0x5044('0x0'));var util=require(_0x5044('0x1'));var path=require(_0x5044('0x2'));var timeout=require(_0x5044('0x3'));var express=require('express');var router=express[_0x5044('0x4')]();var fs_extra=require(_0x5044('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5044('0x6'));var controller=require(_0x5044('0x7'));router[_0x5044('0x8')]('/',auth['isAuthenticated'](),controller[_0x5044('0x9')]);router[_0x5044('0x8')](_0x5044('0xa'),auth[_0x5044('0xb')](),controller[_0x5044('0xc')]);router[_0x5044('0xd')](_0x5044('0xe'),auth[_0x5044('0xb')](),controller[_0x5044('0xf')]);router[_0x5044('0xd')]('/',auth[_0x5044('0xb')](),controller[_0x5044('0x10')]);router[_0x5044('0x11')](_0x5044('0xa'),auth[_0x5044('0xb')](),controller[_0x5044('0x12')]);router[_0x5044('0x13')](_0x5044('0xa'),auth[_0x5044('0xb')](),controller[_0x5044('0x14')]);module[_0x5044('0x15')]=router; \ No newline at end of file +var _0x6150=['./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','put','/:id','update','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x43ce9c,_0x37520e){var _0x219aa0=function(_0x23cfaa){while(--_0x23cfaa){_0x43ce9c['push'](_0x43ce9c['shift']());}};_0x219aa0(++_0x37520e);}(_0x6150,0x1c7));var _0x0615=function(_0x96ee68,_0x59a662){_0x96ee68=_0x96ee68-0x0;var _0x9cb153=_0x6150[_0x96ee68];return _0x9cb153;};'use strict';var multer=require(_0x0615('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0615('0x1'));var auth=require(_0x0615('0x2'));var interaction=require(_0x0615('0x3'));var config=require('../../config/environment');var controller=require(_0x0615('0x4'));router[_0x0615('0x5')]('/',auth[_0x0615('0x6')](),controller[_0x0615('0x7')]);router['get']('/:id',auth[_0x0615('0x6')](),controller[_0x0615('0x8')]);router[_0x0615('0x9')](_0x0615('0xa'),auth[_0x0615('0x6')](),controller[_0x0615('0xb')]);router[_0x0615('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0615('0xc')](_0x0615('0xd'),auth['isAuthenticated'](),controller[_0x0615('0xe')]);router['delete'](_0x0615('0xd'),auth[_0x0615('0x6')](),controller[_0x0615('0xf')]);module[_0x0615('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 630141f..8574644 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 _0x4a94=['inband','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','always','refuse','originate','pai','fingerprint','certificate','active','passive','dynamic','BOOLEAN','sequelize','exports','name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo'];(function(_0x15abea,_0x8609f5){var _0x32028a=function(_0x5cd589){while(--_0x5cd589){_0x15abea['push'](_0x15abea['shift']());}};_0x32028a(++_0x8609f5);}(_0x4a94,0xde));var _0x44a9=function(_0x4f48a6,_0x3b0514){_0x4f48a6=_0x4f48a6-0x0;var _0x2fb6a5=_0x4a94[_0x4f48a6];return _0x2fb6a5;};'use strict';var Sequelize=require(_0x44a9('0x0'));module[_0x44a9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x44a9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x4'),'user',_0x44a9('0x5')),'allowNull':![],'defaultValue':_0x44a9('0x4')},'context':{'type':Sequelize[_0x44a9('0x6')],'allowNull':![],'defaultValue':_0x44a9('0x7')},'callingpres':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x8'),_0x44a9('0x9'),_0x44a9('0xa'),_0x44a9('0xb'),_0x44a9('0xc'),_0x44a9('0xd'),_0x44a9('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x44a9('0x6')]},'permit':{'type':Sequelize[_0x44a9('0x6')]},'secret':{'type':Sequelize[_0x44a9('0x6')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x44a9('0x6')]},'transport':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':_0x44a9('0xf'),'set':function(_0x3e9c88){this['setDataValue']('transport',_0x3e9c88?_0x3e9c88['join'](','):null);},'get':function(){return this[_0x44a9('0x10')](_0x44a9('0x11'))?this['getDataValue']('transport')[_0x44a9('0x12')](','):null;},'comment':_0x44a9('0x13')},'dtmfmode':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x14'),_0x44a9('0x15'),_0x44a9('0x16'),_0x44a9('0x17'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no',_0x44a9('0x19'),_0x44a9('0x1a'),_0x44a9('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x44a9('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x44a9('0x6')]},'nat':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':_0x44a9('0x1c'),'set':function(_0x2da156){this[_0x44a9('0x1d')](_0x44a9('0x1e'),_0x2da156?_0x2da156[_0x44a9('0x1f')](','):null);},'get':function(){return this[_0x44a9('0x10')]('nat')?this[_0x44a9('0x10')](_0x44a9('0x1e'))[_0x44a9('0x12')](','):null;},'comment':_0x44a9('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x44a9('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x44a9('0x6')]},'language':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x44a9('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':_0x44a9('0x21')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x27f026){this[_0x44a9('0x1d')](_0x44a9('0x22'),_0x27f026?_0x27f026[_0x44a9('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x44a9('0x10')]('allow')?this[_0x44a9('0x10')](_0x44a9('0x22'))[_0x44a9('0x12')](';'):null;},'comment':_0x44a9('0x23')},'autoframing':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'insecure':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':'port,invite','set':function(_0x283497){this[_0x44a9('0x1d')](_0x44a9('0x24'),_0x283497?_0x283497[_0x44a9('0x1f')](','):null);},'get':function(){return this[_0x44a9('0x10')]('insecure')?this[_0x44a9('0x10')](_0x44a9('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x44a9('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x44a9('0x18'),'no',_0x44a9('0x25'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'accountcode':{'type':Sequelize[_0x44a9('0x26')](0xb)},'setvar':{'type':Sequelize[_0x44a9('0x6')]},'callerid':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x44a9('0x6')]},'callcounter':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no'),'defaultValue':_0x44a9('0x18')},'busylevel':{'type':Sequelize[_0x44a9('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x44a9('0x6')]},'videosupport':{'type':Sequelize[_0x44a9('0x3')]('yes','no',_0x44a9('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'mailbox':{'type':Sequelize[_0x44a9('0x6')]},'session_timers':{'type':Sequelize[_0x44a9('0x3')]('accept',_0x44a9('0x28'),_0x44a9('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x44a9('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x44a9('0x3')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x44a9('0x6')]},'regexten':{'type':Sequelize[_0x44a9('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x44a9('0x6')]},'port':{'type':Sequelize[_0x44a9('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x44a9('0x18'),'no'),'defaultValue':_0x44a9('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x44a9('0x6')]},'rtptimeout':{'type':Sequelize[_0x44a9('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x44a9('0x3')]('yes','no',_0x44a9('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x44a9('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x44a9('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x44a9('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x44a9('0x6')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x44a9('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x44a9('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x44a9('0x26')](0xb)},'encryption':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x44a9('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'icesupport':{'type':Sequelize[_0x44a9('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x44a9('0x3')]('yes','no',_0x44a9('0x2b'),_0x44a9('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x44a9('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x44a9('0x6')]},'dtlscipher':{'type':Sequelize[_0x44a9('0x6')]},'dtlscafile':{'type':Sequelize[_0x44a9('0x6')]},'dtlscapath':{'type':Sequelize[_0x44a9('0x6')]},'dtlssetup':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x2d'),_0x44a9('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x44a9('0x6')]},'recordofffeature':{'type':Sequelize[_0x44a9('0x6')]},'call_limit':{'type':Sequelize[_0x44a9('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x44a9('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no')},'vmexten':{'type':Sequelize[_0x44a9('0x6')]},'mohinterpret':{'type':Sequelize[_0x44a9('0x6')]},'mohsuggest':{'type':Sequelize[_0x44a9('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x44a9('0x6')]},'host':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':_0x44a9('0x2f')},'canreinvite':{'type':Sequelize[_0x44a9('0x3')](_0x44a9('0x18'),'no',_0x44a9('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x44a9('0x6')]},'active':{'type':Sequelize[_0x44a9('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x44a9('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1426=['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]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x363e08,_0x14319d){var _0xf06610=function(_0x5da930){while(--_0x5da930){_0x363e08['push'](_0x363e08['shift']());}};_0xf06610(++_0x14319d);}(_0x1426,0x18d));var _0x6142=function(_0x4ca836,_0x2f26c7){_0x4ca836=_0x4ca836-0x0;var _0x25b3fd=_0x1426[_0x4ca836];return _0x25b3fd;};'use strict';var Sequelize=require('sequelize');module[_0x6142('0x0')]={'name':{'type':Sequelize[_0x6142('0x1')],'allowNull':![],'unique':_0x6142('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x4'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6142('0x1')],'allowNull':![],'defaultValue':_0x6142('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x6142('0x6'),_0x6142('0x7'),'PROHIB_PASSED_SCREEN',_0x6142('0x8'),_0x6142('0x9'))},'deny':{'type':Sequelize[_0x6142('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x6142('0x1')]},'remotesecret':{'type':Sequelize[_0x6142('0x1')]},'transport':{'type':Sequelize[_0x6142('0x1')],'defaultValue':'udp','set':function(_0x581b4e){this[_0x6142('0xa')](_0x6142('0xb'),_0x581b4e?_0x581b4e[_0x6142('0xc')](','):null);},'get':function(){return this[_0x6142('0xd')]('transport')?this[_0x6142('0xd')]('transport')[_0x6142('0xe')](','):null;},'comment':_0x6142('0xf')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6142('0x10'),'info','shortinfo',_0x6142('0x11'),_0x6142('0x12')),'defaultValue':_0x6142('0x10')},'directmedia':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no',_0x6142('0x14'),_0x6142('0x15'),_0x6142('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6142('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x6142('0x1')],'defaultValue':_0x6142('0x17'),'set':function(_0x2baf04){this[_0x6142('0xa')](_0x6142('0x18'),_0x2baf04?_0x2baf04[_0x6142('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x6142('0x18'))?this[_0x6142('0xd')](_0x6142('0x18'))['split'](','):null;},'comment':_0x6142('0x19')},'callgroup':{'type':Sequelize[_0x6142('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6142('0x1')]},'pickupgroup':{'type':Sequelize[_0x6142('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6142('0x1')]},'language':{'type':Sequelize[_0x6142('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6142('0x1')],'defaultValue':_0x6142('0x1a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6142('0x1b'),'set':function(_0x3dff4e){this[_0x6142('0xa')](_0x6142('0x1c'),_0x3dff4e?_0x3dff4e[_0x6142('0xc')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x6142('0xd')](_0x6142('0x1c'))?this[_0x6142('0xd')]('allow')[_0x6142('0xe')](';'):null;},'comment':_0x6142('0x1d')},'autoframing':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'insecure':{'type':Sequelize[_0x6142('0x1')],'defaultValue':_0x6142('0x1e'),'set':function(_0x410468){this['setDataValue'](_0x6142('0x1f'),_0x410468?_0x410468[_0x6142('0xc')](','):null);},'get':function(){return this['getDataValue'](_0x6142('0x1f'))?this['getDataValue'](_0x6142('0x1f'))[_0x6142('0xe')](','):null;},'comment':_0x6142('0x20')},'trustrpid':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6142('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'accountcode':{'type':Sequelize[_0x6142('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6142('0x1')],'defaultValue':_0x6142('0x22')},'amaflags':{'type':Sequelize[_0x6142('0x1')]},'callcounter':{'type':Sequelize[_0x6142('0x3')]('yes','no'),'defaultValue':_0x6142('0x13')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6142('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x6142('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no',_0x6142('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6142('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6142('0x13'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x24'),_0x6142('0x25'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x6142('0x3')]('uac','uas'),'defaultValue':_0x6142('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x6142('0x1')]},'fromdomain':{'type':Sequelize[_0x6142('0x1')]},'fromuser':{'type':Sequelize[_0x6142('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6142('0x3')]('yes','no'),'defaultValue':_0x6142('0x13')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x6142('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x6142('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6142('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6142('0x1')]},'callbackextension':{'type':Sequelize[_0x6142('0x1')]},'timert1':{'type':Sequelize[_0x6142('0x21')](0xb)},'timerb':{'type':Sequelize[_0x6142('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6142('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x6142('0x1')]},'contactdeny':{'type':Sequelize[_0x6142('0x1')]},'contactacl':{'type':Sequelize[_0x6142('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6142('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6142('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'force_avp':{'type':Sequelize[_0x6142('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6142('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x6142('0x3')]('yes','no',_0x6142('0x27'),_0x6142('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x6142('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x6142('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x6142('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x29'),_0x6142('0x2a'),_0x6142('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6142('0x1')]},'usereqphone':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6142('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x6142('0x13'),'no')},'vmexten':{'type':Sequelize[_0x6142('0x1')]},'mohinterpret':{'type':Sequelize[_0x6142('0x1')]},'mohsuggest':{'type':Sequelize[_0x6142('0x1')]},'parkinglot':{'type':Sequelize[_0x6142('0x1')]},'description':{'type':Sequelize[_0x6142('0x1')]},'host':{'type':Sequelize[_0x6142('0x1')],'defaultValue':_0x6142('0x2c')},'canreinvite':{'type':Sequelize[_0x6142('0x3')](_0x6142('0x13'),'no',_0x6142('0x14'),_0x6142('0x15'),_0x6142('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6142('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6142('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6142('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4179162..d9f9545 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0xf76d16,_0x109fe3){var _0x281d97=function(_0x109e35){while(--_0x109e35){_0xf76d16['push'](_0xf76d16['shift']());}};_0x281d97(++_0x109fe3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2f2c66,_0x2f8db1){_0x2f2c66=_0x2f2c66-0x0;var _0x3a66cf=_0xd6d6[_0x2f2c66];return _0x3a66cf;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +var _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3b1646,_0x16a1a2){var _0x526b8e=function(_0x8534eb){while(--_0x8534eb){_0x3b1646['push'](_0x3b1646['shift']());}};_0x526b8e(++_0x16a1a2);}(_0x425d,0x1e0));var _0xd425=function(_0x4343f1,_0x325dce){_0x4343f1=_0x4343f1-0x0;var _0x5d84a0=_0x425d[_0x4343f1];return _0x5d84a0;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1dd2776..5f41a6c 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 _0x584c=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x10bb45,_0xa57a18){var _0x4f1846=function(_0x319b89){while(--_0x319b89){_0x10bb45['push'](_0x10bb45['shift']());}};_0x4f1846(++_0xa57a18);}(_0x584c,0x185));var _0xc584=function(_0x264e7f,_0x4b8f91){_0x264e7f=_0x264e7f-0x0;var _0x173e6e=_0x584c[_0x264e7f];return _0x173e6e;};'use strict';var _=require(_0xc584('0x0'));var util=require(_0xc584('0x1'));var logger=require('../../config/logger')(_0xc584('0x2'));var moment=require(_0xc584('0x3'));var BPromise=require(_0xc584('0x4'));var rp=require(_0xc584('0x5'));var fs=require('fs');var path=require(_0xc584('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc584('0x7'));module[_0xc584('0x8')]=function(_0x1dc890,_0x4fb620){return _0x1dc890[_0xc584('0x9')](_0xc584('0xa'),attributes,{'tableName':_0xc584('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x832a=['Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0x832a,0x162));var _0xa832=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0x832a[_0x1dd4de];return _0xf23408;};'use strict';var _=require(_0xa832('0x0'));var util=require(_0xa832('0x1'));var logger=require(_0xa832('0x2'))('api');var moment=require(_0xa832('0x3'));var BPromise=require(_0xa832('0x4'));var rp=require(_0xa832('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa832('0x6'));var config=require(_0xa832('0x7'));var attributes=require(_0xa832('0x8'));module['exports']=function(_0x3fa4f8,_0x47558f){return _0x3fa4f8['define'](_0xa832('0x9'),attributes,{'tableName':_0xa832('0xa'),'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 37424d0..8e1e84f 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 _0x1141=['catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0x1141,0x8d));var _0x1114=function(_0x2b8f84,_0x349ee2){_0x2b8f84=_0x2b8f84-0x0;var _0x2927ca=_0x1141[_0x2b8f84];return _0x2927ca;};'use strict';var _=require('lodash');var util=require(_0x1114('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1114('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1114('0x2'));var logger=require(_0x1114('0x3'))(_0x1114('0x4'));var config=require(_0x1114('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1114('0x6')][_0x1114('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31cf3b,_0x21990d,_0x17cd58){return new BPromise(function(_0x2ee538,_0x377197){return client['request'](_0x31cf3b,_0x17cd58)[_0x1114('0x8')](function(_0x4c666b){logger[_0x1114('0x9')](_0x1114('0xa'),_0x21990d,'request\x20sent');logger[_0x1114('0xb')](_0x1114('0xc'),_0x21990d,_0x1114('0xd'),JSON[_0x1114('0xe')](_0x4c666b));if(_0x4c666b[_0x1114('0xf')]){if(_0x4c666b[_0x1114('0xf')][_0x1114('0x10')]===0x1f4){logger[_0x1114('0xf')](_0x1114('0xa'),_0x21990d,_0x4c666b[_0x1114('0xf')][_0x1114('0x11')]);return _0x377197(_0x4c666b[_0x1114('0xf')][_0x1114('0x11')]);}logger[_0x1114('0xf')](_0x1114('0xa'),_0x21990d,_0x4c666b[_0x1114('0xf')][_0x1114('0x11')]);return _0x2ee538(_0x4c666b[_0x1114('0xf')][_0x1114('0x11')]);}else{logger[_0x1114('0x9')](_0x1114('0xa'),_0x21990d,_0x1114('0xd'));_0x2ee538(_0x4c666b[_0x1114('0x12')]['message']);}})[_0x1114('0x13')](function(_0xb829ae){logger[_0x1114('0xf')](_0x1114('0xa'),_0x21990d,_0xb829ae);_0x377197(_0xb829ae);});});}exports[_0x1114('0x14')]=function(_0x1b6255){var _0x4d2ccb=this;return new Promise(function(_0x33302b,_0x4d119e){return db[_0x1114('0x15')][_0x1114('0x16')]({'raw':_0x1b6255[_0x1114('0x17')]?_0x1b6255[_0x1114('0x17')][_0x1114('0x18')]===undefined?!![]:![]:!![],'where':_0x1b6255[_0x1114('0x17')]?_0x1b6255[_0x1114('0x17')][_0x1114('0x19')]||null:null,'attributes':_0x1b6255[_0x1114('0x17')]?_0x1b6255[_0x1114('0x17')][_0x1114('0x1a')]||null:null,'limit':_0x1b6255[_0x1114('0x17')]?_0x1b6255[_0x1114('0x17')][_0x1114('0x1b')]||null:null,'include':_0x1b6255[_0x1114('0x17')]?_0x1b6255[_0x1114('0x17')][_0x1114('0x1c')]?_[_0x1114('0x1d')](_0x1b6255[_0x1114('0x17')][_0x1114('0x1c')],function(_0x499a04){return{'model':db[_0x499a04['model']],'as':_0x499a04['as'],'attributes':_0x499a04[_0x1114('0x1a')],'include':_0x499a04[_0x1114('0x1c')]?_['map'](_0x499a04[_0x1114('0x1c')],function(_0x257c34){return{'model':db[_0x257c34['model']],'as':_0x257c34['as'],'attributes':_0x257c34['attributes'],'include':_0x257c34[_0x1114('0x1c')]?_[_0x1114('0x1d')](_0x257c34[_0x1114('0x1c')],function(_0x4a2823){return{'model':db[_0x4a2823[_0x1114('0x1e')]],'as':_0x4a2823['as'],'attributes':_0x4a2823[_0x1114('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1114('0x8')](function(_0x27a485){logger[_0x1114('0x9')]('GetTrunk',_0x1b6255);logger[_0x1114('0xb')](_0x1114('0x14'),_0x1b6255,JSON[_0x1114('0xe')](_0x27a485));_0x33302b(_0x27a485);})[_0x1114('0x13')](function(_0x1b3f68){logger[_0x1114('0xf')](_0x1114('0x14'),_0x1b3f68[_0x1114('0x11')],_0x1b6255);_0x4d119e(_0x4d2ccb['error'](0x1f4,_0x1b3f68[_0x1114('0x11')]));});});};exports[_0x1114('0x1f')]=function(_0x111415){var _0x2d8fc7=this;return new Promise(function(_0x1d569f,_0x2285ea){return db['Trunk']['find']({'raw':_0x111415[_0x1114('0x17')]?_0x111415['options'][_0x1114('0x18')]===undefined?!![]:![]:!![],'where':_0x111415['options']?_0x111415[_0x1114('0x17')]['where']||null:null,'attributes':_0x111415['options']?_0x111415[_0x1114('0x17')]['attributes']||null:null,'include':_0x111415[_0x1114('0x17')]?_0x111415[_0x1114('0x17')]['include']?_['map'](_0x111415['options'][_0x1114('0x1c')],function(_0x26ff94){return{'model':db[_0x26ff94['model']],'as':_0x26ff94['as'],'attributes':_0x26ff94[_0x1114('0x1a')],'include':_0x26ff94[_0x1114('0x1c')]?_[_0x1114('0x1d')](_0x26ff94[_0x1114('0x1c')],function(_0x304827){return{'model':db[_0x304827[_0x1114('0x1e')]],'as':_0x304827['as'],'attributes':_0x304827[_0x1114('0x1a')],'include':_0x304827['include']?_[_0x1114('0x1d')](_0x304827[_0x1114('0x1c')],function(_0x524543){return{'model':db[_0x524543[_0x1114('0x1e')]],'as':_0x524543['as'],'attributes':_0x524543['attributes']};}):[]};}):[]};}):[]:[]})[_0x1114('0x8')](function(_0x463c96){logger[_0x1114('0x9')](_0x1114('0x1f'),_0x111415);logger[_0x1114('0xb')]('ShowTrunk',_0x111415,JSON[_0x1114('0xe')](_0x463c96));_0x1d569f(_0x463c96);})[_0x1114('0x13')](function(_0x26ca9a){logger['error'](_0x1114('0x1f'),_0x26ca9a[_0x1114('0x11')],_0x111415);_0x2285ea(_0x2d8fc7[_0x1114('0xf')](0x1f4,_0x26ca9a[_0x1114('0x11')]));});});}; \ No newline at end of file +var _0x6cd4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','ShowTrunk','find','catch','util','moment'];(function(_0x48c4a2,_0x442af8){var _0x34ae5e=function(_0x397b26){while(--_0x397b26){_0x48c4a2['push'](_0x48c4a2['shift']());}};_0x34ae5e(++_0x442af8);}(_0x6cd4,0x116));var _0x46cd=function(_0x5d755e,_0x5306e8){_0x5d755e=_0x5d755e-0x0;var _0x320fd3=_0x6cd4[_0x5d755e];return _0x320fd3;};'use strict';var _=require('lodash');var util=require(_0x46cd('0x0'));var moment=require(_0x46cd('0x1'));var BPromise=require(_0x46cd('0x2'));var rs=require(_0x46cd('0x3'));var fs=require('fs');var Redis=require(_0x46cd('0x4'));var db=require(_0x46cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46cd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x46cd('0x7')][_0x46cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44cb43,_0x24b27d,_0x338e68){return new BPromise(function(_0x5b2b50,_0x3cac76){return client[_0x46cd('0x9')](_0x44cb43,_0x338e68)[_0x46cd('0xa')](function(_0x2b9991){logger[_0x46cd('0xb')](_0x46cd('0xc'),_0x24b27d,_0x46cd('0xd'));logger[_0x46cd('0xe')](_0x46cd('0xf'),_0x24b27d,_0x46cd('0xd'),JSON[_0x46cd('0x10')](_0x2b9991));if(_0x2b9991[_0x46cd('0x11')]){if(_0x2b9991['error'][_0x46cd('0x12')]===0x1f4){logger[_0x46cd('0x11')](_0x46cd('0xc'),_0x24b27d,_0x2b9991[_0x46cd('0x11')][_0x46cd('0x13')]);return _0x3cac76(_0x2b9991[_0x46cd('0x11')][_0x46cd('0x13')]);}logger[_0x46cd('0x11')](_0x46cd('0xc'),_0x24b27d,_0x2b9991[_0x46cd('0x11')][_0x46cd('0x13')]);return _0x5b2b50(_0x2b9991[_0x46cd('0x11')][_0x46cd('0x13')]);}else{logger[_0x46cd('0xb')](_0x46cd('0xc'),_0x24b27d,_0x46cd('0xd'));_0x5b2b50(_0x2b9991[_0x46cd('0x14')]['message']);}})['catch'](function(_0x2efe3b){logger[_0x46cd('0x11')]('Trunk,\x20%s,\x20%s',_0x24b27d,_0x2efe3b);_0x3cac76(_0x2efe3b);});});}exports[_0x46cd('0x15')]=function(_0x27b264){var _0x303c56=this;return new Promise(function(_0x420d40,_0x442ad4){return db[_0x46cd('0x16')][_0x46cd('0x17')]({'raw':_0x27b264['options']?_0x27b264[_0x46cd('0x18')][_0x46cd('0x19')]===undefined?!![]:![]:!![],'where':_0x27b264['options']?_0x27b264['options'][_0x46cd('0x1a')]||null:null,'attributes':_0x27b264[_0x46cd('0x18')]?_0x27b264[_0x46cd('0x18')][_0x46cd('0x1b')]||null:null,'limit':_0x27b264[_0x46cd('0x18')]?_0x27b264[_0x46cd('0x18')][_0x46cd('0x1c')]||null:null,'include':_0x27b264['options']?_0x27b264[_0x46cd('0x18')]['include']?_[_0x46cd('0x1d')](_0x27b264[_0x46cd('0x18')][_0x46cd('0x1e')],function(_0x434722){return{'model':db[_0x434722[_0x46cd('0x1f')]],'as':_0x434722['as'],'attributes':_0x434722[_0x46cd('0x1b')],'include':_0x434722[_0x46cd('0x1e')]?_['map'](_0x434722[_0x46cd('0x1e')],function(_0x3068b8){return{'model':db[_0x3068b8[_0x46cd('0x1f')]],'as':_0x3068b8['as'],'attributes':_0x3068b8[_0x46cd('0x1b')],'include':_0x3068b8['include']?_[_0x46cd('0x1d')](_0x3068b8['include'],function(_0xd55124){return{'model':db[_0xd55124[_0x46cd('0x1f')]],'as':_0xd55124['as'],'attributes':_0xd55124[_0x46cd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x46cd('0xa')](function(_0x26193b){logger[_0x46cd('0xb')](_0x46cd('0x15'),_0x27b264);logger[_0x46cd('0xe')](_0x46cd('0x15'),_0x27b264,JSON['stringify'](_0x26193b));_0x420d40(_0x26193b);})['catch'](function(_0x39cf1b){logger['error']('GetTrunk',_0x39cf1b['message'],_0x27b264);_0x442ad4(_0x303c56[_0x46cd('0x11')](0x1f4,_0x39cf1b[_0x46cd('0x13')]));});});};exports[_0x46cd('0x20')]=function(_0x275814){var _0x2d28af=this;return new Promise(function(_0x223cbe,_0xf02591){return db[_0x46cd('0x16')][_0x46cd('0x21')]({'raw':_0x275814[_0x46cd('0x18')]?_0x275814[_0x46cd('0x18')][_0x46cd('0x19')]===undefined?!![]:![]:!![],'where':_0x275814[_0x46cd('0x18')]?_0x275814[_0x46cd('0x18')][_0x46cd('0x1a')]||null:null,'attributes':_0x275814['options']?_0x275814[_0x46cd('0x18')][_0x46cd('0x1b')]||null:null,'include':_0x275814[_0x46cd('0x18')]?_0x275814[_0x46cd('0x18')][_0x46cd('0x1e')]?_[_0x46cd('0x1d')](_0x275814['options'][_0x46cd('0x1e')],function(_0x18ea54){return{'model':db[_0x18ea54[_0x46cd('0x1f')]],'as':_0x18ea54['as'],'attributes':_0x18ea54[_0x46cd('0x1b')],'include':_0x18ea54[_0x46cd('0x1e')]?_[_0x46cd('0x1d')](_0x18ea54[_0x46cd('0x1e')],function(_0x1b535a){return{'model':db[_0x1b535a['model']],'as':_0x1b535a['as'],'attributes':_0x1b535a[_0x46cd('0x1b')],'include':_0x1b535a[_0x46cd('0x1e')]?_[_0x46cd('0x1d')](_0x1b535a[_0x46cd('0x1e')],function(_0x1433a5){return{'model':db[_0x1433a5['model']],'as':_0x1433a5['as'],'attributes':_0x1433a5[_0x46cd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x46cd('0xa')](function(_0x1fa848){logger['info'](_0x46cd('0x20'),_0x275814);logger['debug'](_0x46cd('0x20'),_0x275814,JSON['stringify'](_0x1fa848));_0x223cbe(_0x1fa848);})[_0x46cd('0x22')](function(_0x3faad6){logger[_0x46cd('0x11')](_0x46cd('0x20'),_0x3faad6[_0x46cd('0x13')],_0x275814);_0xf02591(_0x2d28af['error'](0x1f4,_0x3faad6[_0x46cd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 404640b..b02b485 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 _0xa5c9=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa5c9,0x157));var _0x9a5c=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xa5c9[_0x587ba2];return _0x50ec73;};'use strict';var express=require(_0x9a5c('0x0'));var router=express[_0x9a5c('0x1')]();var auth=require(_0x9a5c('0x2'));var controller=require(_0x9a5c('0x3'));router[_0x9a5c('0x4')](_0x9a5c('0x5'),auth[_0x9a5c('0x6')](),controller[_0x9a5c('0x7')]);module[_0x9a5c('0x8')]=router; \ No newline at end of file +var _0x5e3e=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','exports','express'];(function(_0x379645,_0x49774a){var _0xdce0f5=function(_0x2ef95e){while(--_0x2ef95e){_0x379645['push'](_0x379645['shift']());}};_0xdce0f5(++_0x49774a);}(_0x5e3e,0x10f));var _0xe5e3=function(_0x430205,_0x328c94){_0x430205=_0x430205-0x0;var _0x3f5146=_0x5e3e[_0x430205];return _0x3f5146;};'use strict';var express=require(_0xe5e3('0x0'));var router=express[_0xe5e3('0x1')]();var auth=require(_0xe5e3('0x2'));var controller=require(_0xe5e3('0x3'));router[_0xe5e3('0x4')](_0xe5e3('0x5'),auth[_0xe5e3('0x6')](),controller['update']);module[_0xe5e3('0x7')]=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 c2db25d..525c7f0 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 _0xd501=['exports','ENUM','BOOLEAN','TEXT','sequelize','error','warning','debug'];(function(_0x1a6e9f,_0x43903c){var _0x302958=function(_0x41c452){while(--_0x41c452){_0x1a6e9f['push'](_0x1a6e9f['shift']());}};_0x302958(++_0x43903c);}(_0xd501,0x174));var _0x1d50=function(_0x2c40a4,_0x13f7c7){_0x2c40a4=_0x2c40a4-0x0;var _0x2effc0=_0xd501[_0x2c40a4];return _0x2effc0;};'use strict';var Sequelize=require(_0x1d50('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x1d50('0x1'),_0x1d50('0x2'),'info',_0x1d50('0x3')];module[_0x1d50('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x1d50('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1d50('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1d50('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0xa846=['warning','debug','TEXT','DATE','INTEGER','sequelize','error'];(function(_0x511840,_0x38f12d){var _0x373bd0=function(_0x3bb085){while(--_0x3bb085){_0x511840['push'](_0x511840['shift']());}};_0x373bd0(++_0x38f12d);}(_0xa846,0x12b));var _0x6a84=function(_0x4fde7c,_0x1e7055){_0x4fde7c=_0x4fde7c-0x0;var _0x5bf77f=_0xa846[_0x4fde7c];return _0x5bf77f;};'use strict';var Sequelize=require(_0x6a84('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6a84('0x1'),_0x6a84('0x2'),'info',_0x6a84('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6a84('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x6a84('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6a84('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6a84('0x6')],'unique':'UserId'}}; \ 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 e931088..d225743 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 _0x5900=['register','defaults','redis','status','json','update','then','stack','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket'];(function(_0x3b5071,_0x5e7e6f){var _0x1ea3f3=function(_0x2192b2){while(--_0x2192b2){_0x3b5071['push'](_0x3b5071['shift']());}};_0x1ea3f3(++_0x5e7e6f);}(_0x5900,0xd2));var _0x0590=function(_0xdee30,_0x41b7b5){_0xdee30=_0xdee30-0x0;var _0x4b95ee=_0x5900[_0xdee30];return _0x4b95ee;};'use strict';var _=require('lodash');var Redis=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var config=require(_0x0590('0x2'));var db=require(_0x0590('0x3'))['db'];var socket=require(_0x0590('0x4'))(new Redis(config['redis']));require(_0x0590('0x5'))[_0x0590('0x6')](socket);config['redis']=_[_0x0590('0x7')](config[_0x0590('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x469e15,_0x2d5b51){_0x2d5b51=_0x2d5b51||0xc8;return function(_0x149322){if(_0x149322){return _0x469e15[_0x0590('0x9')](_0x2d5b51)[_0x0590('0xa')](_0x149322);}};}function saveUpdates(_0x1025bf){return function(_0x1c626a){if(_0x1c626a){return _0x1c626a[_0x0590('0xb')](_0x1025bf)[_0x0590('0xc')](function(_0x5cffbc){return _0x5cffbc;});}return null;};}function handleEntityNotFound(_0x354ef5){return function(_0x42bfba){if(!_0x42bfba){_0x354ef5['sendStatus'](0x194);}return _0x42bfba;};}function handleError(_0x138516,_0x392dad){_0x392dad=_0x392dad||0x1f4;return function(_0x4ef139){logger['error'](_0x4ef139[_0x0590('0xd')]);if(_0x4ef139['name']){delete _0x4ef139[_0x0590('0xe')];}_0x138516[_0x0590('0x9')](_0x392dad)[_0x0590('0xf')](_0x4ef139);};}exports[_0x0590('0xb')]=function(_0x15d0a3,_0x491f24){if(_0x15d0a3[_0x0590('0x10')][_0x0590('0x11')]!=='admin')throw new Error(_0x0590('0x12'));if(isNaN(Number(_0x15d0a3[_0x0590('0x13')]['id'])))throw new Error(_0x0590('0x14'));return db['UserSetting'][_0x0590('0x15')]({'where':{'id':_0x15d0a3['params']['id']}})[_0x0590('0xc')](handleEntityNotFound(_0x491f24,null))[_0x0590('0xc')](saveUpdates(_0x15d0a3[_0x0590('0x16')],null))[_0x0590('0xc')](respondWithResult(_0x491f24,null))[_0x0590('0x17')](handleError(_0x491f24,null));}; \ No newline at end of file +var _0x225c=['status','json','then','sendStatus','error','name','update','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash','ioredis','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc225('0x0'));var Redis=require(_0xc225('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xc225('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xc225('0x3'))(new Redis(config[_0xc225('0x4')]));require(_0xc225('0x5'))[_0xc225('0x6')](socket);config[_0xc225('0x4')]=_[_0xc225('0x7')](config[_0xc225('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x143eab,_0x249b43){_0x249b43=_0x249b43||0xc8;return function(_0x409c9f){if(_0x409c9f){return _0x143eab[_0xc225('0x8')](_0x249b43)[_0xc225('0x9')](_0x409c9f);}};}function saveUpdates(_0x4dc4ed){return function(_0x166add){if(_0x166add){return _0x166add['update'](_0x4dc4ed)[_0xc225('0xa')](function(_0x10f26b){return _0x10f26b;});}return null;};}function handleEntityNotFound(_0x238dbf){return function(_0x52727e){if(!_0x52727e){_0x238dbf[_0xc225('0xb')](0x194);}return _0x52727e;};}function handleError(_0x1f2f4f,_0x3ca94e){_0x3ca94e=_0x3ca94e||0x1f4;return function(_0x331018){logger[_0xc225('0xc')](_0x331018['stack']);if(_0x331018[_0xc225('0xd')]){delete _0x331018[_0xc225('0xd')];}_0x1f2f4f['status'](_0x3ca94e)['send'](_0x331018);};}exports[_0xc225('0xe')]=function(_0x3dc064,_0x2c53af){if(_0x3dc064['user']['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x3dc064['params']['id'])))throw new Error(_0xc225('0xf'));return db[_0xc225('0x10')][_0xc225('0x11')]({'where':{'id':_0x3dc064['params']['id']}})[_0xc225('0xa')](handleEntityNotFound(_0x2c53af,null))['then'](saveUpdates(_0x3dc064['body'],null))[_0xc225('0xa')](respondWithResult(_0x2c53af,null))['catch'](handleError(_0x2c53af,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 9d4715b..cee6de3 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 _0x839e=['exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x312535,_0x134f0c){var _0x70248a=function(_0x4190ee){while(--_0x4190ee){_0x312535['push'](_0x312535['shift']());}};_0x70248a(++_0x134f0c);}(_0x839e,0x106));var _0xe839=function(_0x190b37,_0x386197){_0x190b37=_0x190b37-0x0;var _0x4e7eb7=_0x839e[_0x190b37];return _0x4e7eb7;};'use strict';var EventEmitter=require(_0xe839('0x0'));var UserSetting=require(_0xe839('0x1'))['db'][_0xe839('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe839('0x3')](0x0);var events={'afterCreate':_0xe839('0x4'),'afterUpdate':_0xe839('0x5'),'afterDestroy':_0xe839('0x6')};function emitEvent(_0x4f877d){return function(_0x401257,_0x20f0fc,_0x4150a1){UserSettingEvents['emit'](_0x4f877d+':'+_0x401257['id'],_0x401257);UserSettingEvents[_0xe839('0x7')](_0x4f877d,_0x401257);_0x4150a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xe839('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xd0be=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x44f988,_0x2430b6){var _0x5e5054=function(_0x44aad3){while(--_0x44aad3){_0x44f988['push'](_0x44f988['shift']());}};_0x5e5054(++_0x2430b6);}(_0xd0be,0x1ef));var _0xed0b=function(_0x5b967e,_0x97019b){_0x5b967e=_0x5b967e-0x0;var _0x327abd=_0xd0be[_0x5b967e];return _0x327abd;};'use strict';var EventEmitter=require(_0xed0b('0x0'));var UserSetting=require(_0xed0b('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xed0b('0x2')](0x0);var events={'afterCreate':_0xed0b('0x3'),'afterUpdate':'update','afterDestroy':_0xed0b('0x4')};function emitEvent(_0x40ea4f){return function(_0x59707d,_0x4ec056,_0x726205){UserSettingEvents['emit'](_0x40ea4f+':'+_0x59707d['id'],_0x59707d);UserSettingEvents[_0xed0b('0x5')](_0x40ea4f,_0x59707d);_0x726205(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xed0b('0x6')]=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 7fa873b..5855dce 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 _0x2b65=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x593d14,_0x1d0a36){var _0x2f9cc4=function(_0x66635b){while(--_0x66635b){_0x593d14['push'](_0x593d14['shift']());}};_0x2f9cc4(++_0x1d0a36);}(_0x2b65,0x131));var _0x52b6=function(_0x3d8502,_0x5b23b4){_0x3d8502=_0x3d8502-0x0;var _0x2e8073=_0x2b65[_0x3d8502];return _0x2e8073;};'use strict';var attributes=require(_0x52b6('0x0'));module[_0x52b6('0x1')]=function(_0x9b1a2c){return _0x9b1a2c[_0x52b6('0x2')](_0x52b6('0x3'),attributes,{'tableName':_0x52b6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x141913){if(!_0x141913[_0x52b6('0x5')])_0x141913['clientSideLoggingEnabledSince']=null;else if(_0x141913[_0x52b6('0x6')]===null)_0x141913[_0x52b6('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x4fad=['exports','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x34b709,_0x5dc8af){var _0x20dda4=function(_0x33eaef){while(--_0x33eaef){_0x34b709['push'](_0x34b709['shift']());}};_0x20dda4(++_0x5dc8af);}(_0x4fad,0xcb));var _0xd4fa=function(_0x208d1c,_0x360866){_0x208d1c=_0x208d1c-0x0;var _0x31e897=_0x4fad[_0x208d1c];return _0x31e897;};'use strict';var attributes=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]=function(_0x398f3c){return _0x398f3c['define'](_0xd4fa('0x2'),attributes,{'tableName':_0xd4fa('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x174360){if(!_0x174360[_0xd4fa('0x4')])_0x174360[_0xd4fa('0x5')]=null;else if(_0x174360[_0xd4fa('0x5')]===null)_0x174360[_0xd4fa('0x5')]=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 5d9c8a3..837d928 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 _0x132c=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save'];(function(_0x23807f,_0x3c5892){var _0x5351a7=function(_0x38a5e5){while(--_0x38a5e5){_0x23807f['push'](_0x23807f['shift']());}};_0x5351a7(++_0x3c5892);}(_0x132c,0x1ac));var _0xc132=function(_0x4e5ab6,_0x575ae6){_0x4e5ab6=_0x4e5ab6-0x0;var _0x3defad=_0x132c[_0x4e5ab6];return _0x3defad;};'use strict';var UserSettingEvents=require(_0xc132('0x0'));var events=[_0xc132('0x1'),_0xc132('0x2'),_0xc132('0x3')];function createListener(_0x5ae45b,_0x109ee2){return function(_0x15b80d){_0x109ee2[_0xc132('0x4')](_0x5ae45b,_0x15b80d);if(_0x5ae45b===_0xc132('0x5')){_0x109ee2[_0xc132('0x4')](_0xc132('0x6')+_0x15b80d[_0xc132('0x7')],_0x15b80d);}};}exports['register']=function(_0x539269){for(var _0x42870a=0x0,_0x704d8e=events[_0xc132('0x8')];_0x42870a<_0x704d8e;_0x42870a++){var _0x5b1a0e=events[_0x42870a];var _0x2c5ba8=createListener(_0xc132('0x9')+_0x5b1a0e,_0x539269);UserSettingEvents['on'](_0x5b1a0e,_0x2c5ba8);}}; \ No newline at end of file +var _0x7268=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','remove'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x7268,0x1a2));var _0x8726=function(_0x26e7b5,_0x1c41bf){_0x26e7b5=_0x26e7b5-0x0;var _0x1c116e=_0x7268[_0x26e7b5];return _0x1c116e;};'use strict';var UserSettingEvents=require(_0x8726('0x0'));var events=['save',_0x8726('0x1'),_0x8726('0x2')];function createListener(_0x2d83c5,_0x4cb4e0){return function(_0x558ca8){_0x4cb4e0[_0x8726('0x3')](_0x2d83c5,_0x558ca8);if(_0x2d83c5===_0x8726('0x4')){_0x4cb4e0[_0x8726('0x3')](_0x8726('0x5')+_0x558ca8[_0x8726('0x6')],_0x558ca8);}};}exports[_0x8726('0x7')]=function(_0x14e252){for(var _0x2d8158=0x0,_0x148848=events[_0x8726('0x8')];_0x2d8158<_0x148848;_0x2d8158++){var _0x123523=events[_0x2d8158];var _0x3d58b3=createListener(_0x8726('0x9')+_0x123523,_0x14e252);UserSettingEvents['on'](_0x123523,_0x3d58b3);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 487a99d..0e6b017 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 _0x0966=['server/files/images/','format','%s-%s','now','originalname','single','addAvatar','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','createApiKey','update','put','changePassword','delete','removeQueues','removeTeams','/:id','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','/presence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','join'];(function(_0x5db6aa,_0x31d269){var _0x3a8a1a=function(_0x34549c){while(--_0x34549c){_0x5db6aa['push'](_0x5db6aa['shift']());}};_0x3a8a1a(++_0x31d269);}(_0x0966,0x9d));var _0x6096=function(_0x234ea1,_0x4f3e4){_0x234ea1=_0x234ea1-0x0;var _0x42701a=_0x0966[_0x234ea1];return _0x42701a;};'use strict';var multer=require(_0x6096('0x0'));var util=require(_0x6096('0x1'));var path=require('path');var timeout=require(_0x6096('0x2'));var express=require('express');var router=express[_0x6096('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6096('0x4'));var interaction=require(_0x6096('0x5'));var config=require(_0x6096('0x6'));var controller=require(_0x6096('0x7'));router['get']('/',auth[_0x6096('0x8')](),controller['index']);router[_0x6096('0x9')](_0x6096('0xa'),auth[_0x6096('0x8')](),controller['describe']);router[_0x6096('0x9')]('/whoami',auth[_0x6096('0x8')](),controller['whoami']);router['get'](_0x6096('0xb'),auth[_0x6096('0x8')](),controller['getPresence']);router['get']('/:id',auth[_0x6096('0x8')](),controller[_0x6096('0xc')]);router['get'](_0x6096('0xd'),controller['getAvatar']);router[_0x6096('0x9')](_0x6096('0xe'),auth[_0x6096('0x8')](),controller[_0x6096('0xf')]);router[_0x6096('0x9')](_0x6096('0x10'),auth['isAuthenticated'](),controller[_0x6096('0x11')]);router[_0x6096('0x9')](_0x6096('0x12'),auth[_0x6096('0x8')](),controller[_0x6096('0x13')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x6096('0x9')]('/:id/groups',auth[_0x6096('0x8')](),controller[_0x6096('0x14')]);router[_0x6096('0x9')](_0x6096('0x15'),auth[_0x6096('0x8')](),controller[_0x6096('0x16')]);router[_0x6096('0x9')](_0x6096('0x17'),auth[_0x6096('0x8')](),controller[_0x6096('0x18')]);router[_0x6096('0x9')]('/:id/chat/interactions',auth[_0x6096('0x8')](),controller[_0x6096('0x19')]);router[_0x6096('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x6096('0x1a')]);router[_0x6096('0x9')](_0x6096('0x1b'),auth['isAuthenticated'](),controller[_0x6096('0x1c')]);router[_0x6096('0x9')]('/:id/sms/interactions',auth[_0x6096('0x8')](),controller[_0x6096('0x1d')]);router['get']('/:id/fax/interactions',auth[_0x6096('0x8')](),controller['getFaxInteractions']);router['get'](_0x6096('0x1e'),auth[_0x6096('0x8')](),controller[_0x6096('0x1f')]);router[_0x6096('0x9')](_0x6096('0x20'),auth[_0x6096('0x8')](),controller[_0x6096('0x21')]);router[_0x6096('0x9')](_0x6096('0x22'),auth['isAuthenticated'](),controller[_0x6096('0x23')]);router[_0x6096('0x9')](_0x6096('0x24'),auth[_0x6096('0x8')](),controller[_0x6096('0x25')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x6096('0x26')]);router[_0x6096('0x9')](_0x6096('0x27'),auth[_0x6096('0x8')](),controller[_0x6096('0x28')]);router[_0x6096('0x9')](_0x6096('0x29'),auth[_0x6096('0x8')](),controller[_0x6096('0x2a')]);router[_0x6096('0x9')](_0x6096('0x2b'),auth[_0x6096('0x8')](),controller[_0x6096('0x2c')]);router[_0x6096('0x9')](_0x6096('0x2d'),auth[_0x6096('0x8')](),controller[_0x6096('0x2e')]);router[_0x6096('0x9')](_0x6096('0x2f'),auth['isAuthenticated'](),controller[_0x6096('0x30')]);router['get'](_0x6096('0x31'),auth[_0x6096('0x8')](),controller['getWhatsappAccounts']);router[_0x6096('0x9')]('/:id/scheduled_calls',auth[_0x6096('0x8')](),controller[_0x6096('0x32')]);router[_0x6096('0x9')](_0x6096('0x33'),auth['isAuthenticated'](),controller[_0x6096('0x34')]);router[_0x6096('0x35')](_0x6096('0x10'),auth[_0x6096('0x8')](),controller[_0x6096('0x36')]);router[_0x6096('0x35')]('/',auth[_0x6096('0x8')](),controller['create']);router[_0x6096('0x35')](_0x6096('0x37'),auth[_0x6096('0x8')](),controller[_0x6096('0x38')]);router[_0x6096('0x35')](_0x6096('0x12'),auth[_0x6096('0x8')](),controller[_0x6096('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x520fd6,_0x19cfc3,_0x39a331){_0x39a331(null,path[_0x6096('0x3a')](config['root'],_0x6096('0x3b')));},'filename':function(_0x1ea7f4,_0x59cf32,_0x225ff1){_0x225ff1(null,util[_0x6096('0x3c')](_0x6096('0x3d'),Date[_0x6096('0x3e')](),_0x59cf32[_0x6096('0x3f')]));}})});router[_0x6096('0x35')]('/:id/avatar',upload[_0x6096('0x40')]('file'),controller[_0x6096('0x41')]);router['post']('/:id/login',auth[_0x6096('0x8')](),controller[_0x6096('0x42')]);router[_0x6096('0x35')](_0x6096('0x43'),auth[_0x6096('0x8')](),controller[_0x6096('0x44')]);router[_0x6096('0x35')](_0x6096('0x45'),auth[_0x6096('0x8')](),controller[_0x6096('0x46')]);router['post']('/:id/unpause',auth[_0x6096('0x8')](),controller[_0x6096('0x47')]);router[_0x6096('0x35')]('/:id/teams',auth[_0x6096('0x8')](),controller[_0x6096('0x48')]);router[_0x6096('0x35')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x6096('0x49')]);router[_0x6096('0x35')](_0x6096('0x4a'),auth[_0x6096('0x8')](),controller['addMailInteractions']);router[_0x6096('0x35')](_0x6096('0x4b'),auth[_0x6096('0x8')](),controller[_0x6096('0x4c')]);router[_0x6096('0x35')](_0x6096('0x4d'),auth[_0x6096('0x8')](),controller[_0x6096('0x4e')]);router[_0x6096('0x35')](_0x6096('0x4f'),auth['isAuthenticated'](),controller[_0x6096('0x50')]);router['post'](_0x6096('0x51'),auth[_0x6096('0x8')](),controller['addWhatsappInteractions']);router[_0x6096('0x35')]('/:id/fax_accounts',auth[_0x6096('0x8')](),controller[_0x6096('0x52')]);router[_0x6096('0x35')]('/:id/mail_accounts',auth[_0x6096('0x8')](),controller[_0x6096('0x53')]);router[_0x6096('0x35')](_0x6096('0x2b'),auth[_0x6096('0x8')](),controller['addOpenchannelAccounts']);router[_0x6096('0x35')]('/:id/sms_accounts',auth[_0x6096('0x8')](),controller[_0x6096('0x54')]);router[_0x6096('0x35')]('/:id/chat_websites',auth[_0x6096('0x8')](),controller[_0x6096('0x55')]);router[_0x6096('0x35')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x6096('0x35')](_0x6096('0x33'),auth[_0x6096('0x8')](),controller[_0x6096('0x56')]);router['put']('/:id',auth[_0x6096('0x8')](),controller[_0x6096('0x57')]);router[_0x6096('0x58')]('/:id/password',auth[_0x6096('0x8')](),controller[_0x6096('0x59')]);router[_0x6096('0x5a')](_0x6096('0x12'),auth['isAuthenticated'](),controller[_0x6096('0x5b')]);router[_0x6096('0x5a')](_0x6096('0x20'),auth[_0x6096('0x8')](),controller[_0x6096('0x5c')]);router[_0x6096('0x5a')](_0x6096('0x5d'),auth[_0x6096('0x8')](),controller['destroy']);router[_0x6096('0x5a')](_0x6096('0x5e'),auth[_0x6096('0x8')](),controller['removeChatInteractions']);router[_0x6096('0x5a')](_0x6096('0x4a'),auth[_0x6096('0x8')](),controller[_0x6096('0x5f')]);router['delete'](_0x6096('0x4b'),auth[_0x6096('0x8')](),controller[_0x6096('0x60')]);router[_0x6096('0x5a')](_0x6096('0x4d'),auth[_0x6096('0x8')](),controller[_0x6096('0x61')]);router[_0x6096('0x5a')](_0x6096('0x4f'),auth[_0x6096('0x8')](),controller[_0x6096('0x62')]);router['delete'](_0x6096('0x51'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x6096('0x27'),auth[_0x6096('0x8')](),controller[_0x6096('0x63')]);router['delete'](_0x6096('0x29'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x6096('0x5a')](_0x6096('0x2b'),auth[_0x6096('0x8')](),controller[_0x6096('0x64')]);router[_0x6096('0x5a')](_0x6096('0x2d'),auth['isAuthenticated'](),controller[_0x6096('0x65')]);router[_0x6096('0x5a')](_0x6096('0x2f'),auth[_0x6096('0x8')](),controller[_0x6096('0x66')]);router[_0x6096('0x5a')](_0x6096('0x31'),auth['isAuthenticated'](),controller[_0x6096('0x67')]);router[_0x6096('0x5a')](_0x6096('0x33'),auth[_0x6096('0x8')](),controller[_0x6096('0x68')]);router[_0x6096('0x35')](_0x6096('0x69'),auth[_0x6096('0x8')](),controller[_0x6096('0x6a')]);module[_0x6096('0x6b')]=router; \ No newline at end of file +var _0x0ef9=['getPresence','/:id','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','put','update','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/whoami','whoami','/presence'];(function(_0x307219,_0x54f9c6){var _0x148a27=function(_0x3c71e1){while(--_0x3c71e1){_0x307219['push'](_0x307219['shift']());}};_0x148a27(++_0x54f9c6);}(_0x0ef9,0x1ce));var _0x90ef=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x0ef9[_0x2962d5];return _0x273406;};'use strict';var multer=require(_0x90ef('0x0'));var util=require(_0x90ef('0x1'));var path=require(_0x90ef('0x2'));var timeout=require('connect-timeout');var express=require(_0x90ef('0x3'));var router=express[_0x90ef('0x4')]();var fs_extra=require(_0x90ef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x90ef('0x6'));var config=require(_0x90ef('0x7'));var controller=require('./user.controller');router['get']('/',auth[_0x90ef('0x8')](),controller['index']);router[_0x90ef('0x9')]('/describe',auth[_0x90ef('0x8')](),controller[_0x90ef('0xa')]);router[_0x90ef('0x9')](_0x90ef('0xb'),auth[_0x90ef('0x8')](),controller[_0x90ef('0xc')]);router[_0x90ef('0x9')](_0x90ef('0xd'),auth[_0x90ef('0x8')](),controller[_0x90ef('0xe')]);router['get'](_0x90ef('0xf'),auth[_0x90ef('0x8')](),controller['show']);router[_0x90ef('0x9')]('/:id/avatar',controller[_0x90ef('0x10')]);router[_0x90ef('0x9')](_0x90ef('0x11'),auth[_0x90ef('0x8')](),controller['getOpenTabs']);router[_0x90ef('0x9')](_0x90ef('0x12'),auth['isAuthenticated'](),controller[_0x90ef('0x13')]);router[_0x90ef('0x9')](_0x90ef('0x14'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x15')]);router['get'](_0x90ef('0x16'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x17')]);router[_0x90ef('0x9')](_0x90ef('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0x90ef('0x9')](_0x90ef('0x19'),auth[_0x90ef('0x8')](),controller['getRecordings']);router[_0x90ef('0x9')](_0x90ef('0x1a'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x1b')]);router[_0x90ef('0x9')](_0x90ef('0x1c'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x1d')]);router[_0x90ef('0x9')](_0x90ef('0x1e'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x1f')]);router[_0x90ef('0x9')]('/:id/mail/interactions',auth[_0x90ef('0x8')](),controller[_0x90ef('0x20')]);router[_0x90ef('0x9')](_0x90ef('0x21'),auth['isAuthenticated'](),controller[_0x90ef('0x22')]);router['get'](_0x90ef('0x23'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x24')]);router[_0x90ef('0x9')](_0x90ef('0x25'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x26')]);router[_0x90ef('0x9')](_0x90ef('0x27'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x28')]);router[_0x90ef('0x9')](_0x90ef('0x29'),auth[_0x90ef('0x8')](),controller['getLists']);router[_0x90ef('0x9')](_0x90ef('0x2a'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x2b')]);router[_0x90ef('0x9')](_0x90ef('0x2c'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x2d')]);router[_0x90ef('0x9')](_0x90ef('0x2e'),auth[_0x90ef('0x8')](),controller['getFaxAccounts']);router[_0x90ef('0x9')](_0x90ef('0x2f'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x30')]);router[_0x90ef('0x9')](_0x90ef('0x31'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x32')]);router[_0x90ef('0x9')](_0x90ef('0x33'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x34')]);router[_0x90ef('0x9')](_0x90ef('0x35'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x36')]);router['get'](_0x90ef('0x37'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x38')]);router[_0x90ef('0x9')](_0x90ef('0x39'),auth['isAuthenticated'](),controller[_0x90ef('0x3a')]);router[_0x90ef('0x9')](_0x90ef('0x3b'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x3c')]);router[_0x90ef('0x3d')](_0x90ef('0x12'),auth['isAuthenticated'](),controller[_0x90ef('0x3e')]);router[_0x90ef('0x3d')]('/',auth[_0x90ef('0x8')](),controller[_0x90ef('0x3f')]);router[_0x90ef('0x3d')]('/create_many',auth[_0x90ef('0x8')](),controller[_0x90ef('0x40')]);router[_0x90ef('0x3d')](_0x90ef('0x14'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x41')]);var upload=multer({'storage':multer[_0x90ef('0x42')]({'destination':function(_0x1515ed,_0x124858,_0x41224e){_0x41224e(null,path['join'](config[_0x90ef('0x43')],_0x90ef('0x44')));},'filename':function(_0x1f029e,_0x2ad225,_0x5dfa82){_0x5dfa82(null,util[_0x90ef('0x45')](_0x90ef('0x46'),Date['now'](),_0x2ad225[_0x90ef('0x47')]));}})});router['post'](_0x90ef('0x48'),upload[_0x90ef('0x49')](_0x90ef('0x4a')),controller[_0x90ef('0x4b')]);router['post'](_0x90ef('0x4c'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x4d')]);router['post'](_0x90ef('0x4e'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x4f')]);router[_0x90ef('0x3d')](_0x90ef('0x50'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x51')]);router['post']('/:id/unpause',auth[_0x90ef('0x8')](),controller[_0x90ef('0x52')]);router[_0x90ef('0x3d')](_0x90ef('0x27'),auth[_0x90ef('0x8')](),controller['addTeams']);router[_0x90ef('0x3d')](_0x90ef('0x53'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x54')]);router['post']('/:id/mail_interactions',auth[_0x90ef('0x8')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x90ef('0x8')](),controller[_0x90ef('0x55')]);router[_0x90ef('0x3d')](_0x90ef('0x56'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x57')]);router[_0x90ef('0x3d')](_0x90ef('0x58'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x59')]);router['post'](_0x90ef('0x5a'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x5b')]);router[_0x90ef('0x3d')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x90ef('0x5c')]);router[_0x90ef('0x3d')](_0x90ef('0x2f'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x5d')]);router[_0x90ef('0x3d')](_0x90ef('0x31'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x5e')]);router[_0x90ef('0x3d')](_0x90ef('0x33'),auth['isAuthenticated'](),controller[_0x90ef('0x5f')]);router[_0x90ef('0x3d')](_0x90ef('0x35'),auth[_0x90ef('0x8')](),controller['addChatWebsites']);router[_0x90ef('0x3d')](_0x90ef('0x37'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x60')]);router['post'](_0x90ef('0x3b'),auth[_0x90ef('0x8')](),controller['createApiKey']);router[_0x90ef('0x61')](_0x90ef('0xf'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x62')]);router[_0x90ef('0x61')]('/:id/password',auth[_0x90ef('0x8')](),controller['changePassword']);router[_0x90ef('0x63')](_0x90ef('0x14'),auth['isAuthenticated'](),controller[_0x90ef('0x64')]);router[_0x90ef('0x63')](_0x90ef('0x27'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x65')]);router['delete'](_0x90ef('0xf'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x66')]);router['delete'](_0x90ef('0x53'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x67')]);router[_0x90ef('0x63')](_0x90ef('0x68'),auth[_0x90ef('0x8')](),controller['removeMailInteractions']);router[_0x90ef('0x63')]('/:id/fax_interactions',auth[_0x90ef('0x8')](),controller[_0x90ef('0x69')]);router[_0x90ef('0x63')](_0x90ef('0x56'),auth['isAuthenticated'](),controller[_0x90ef('0x6a')]);router[_0x90ef('0x63')]('/:id/openchannel_interactions',auth[_0x90ef('0x8')](),controller[_0x90ef('0x6b')]);router['delete'](_0x90ef('0x5a'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x6c')]);router['delete'](_0x90ef('0x2e'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x6d')]);router[_0x90ef('0x63')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x90ef('0x6e')]);router['delete'](_0x90ef('0x31'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x6f')]);router[_0x90ef('0x63')](_0x90ef('0x33'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x70')]);router['delete'](_0x90ef('0x35'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x71')]);router[_0x90ef('0x63')]('/:id/whatsapp_accounts',auth[_0x90ef('0x8')](),controller[_0x90ef('0x72')]);router[_0x90ef('0x63')](_0x90ef('0x3b'),auth['isAuthenticated'](),controller[_0x90ef('0x73')]);router[_0x90ef('0x3d')](_0x90ef('0x74'),auth[_0x90ef('0x8')](),controller[_0x90ef('0x75')]);module[_0x90ef('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d9c328a..01d8b7f 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 _0x2828=['outgoing','yes','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','update','update,nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','icesupport','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','exports','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','nonat'];(function(_0x4040c4,_0x571bf1){var _0x489497=function(_0x2bd144){while(--_0x2bd144){_0x4040c4['push'](_0x4040c4['shift']());}};_0x489497(++_0x571bf1);}(_0x2828,0x85));var _0x8282=function(_0x4dfd8a,_0x476a02){_0x4dfd8a=_0x4dfd8a-0x0;var _0x5aeac9=_0x2828[_0x4dfd8a];return _0x5aeac9;};'use strict';var Sequelize=require(_0x8282('0x0'));var moment=require(_0x8282('0x1'));var util=require('util');var _=require('lodash');module[_0x8282('0x2')]={'name':{'type':Sequelize[_0x8282('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1de015){this[_0x8282('0x4')](_0x8282('0x5'),_0x1de015);this[_0x8282('0x4')]('defaultuser',_0x1de015);},'comment':_0x8282('0x6')},'fullname':{'type':Sequelize[_0x8282('0x3')],'allowNull':![],'set':function(_0x4f61d1){this[_0x8282('0x4')]('fullname',_0x4f61d1);this[_0x8282('0x4')](_0x8282('0x7'),util[_0x8282('0x8')](_0x8282('0x9'),_0x4f61d1,this[_0x8282('0xa')](_0x8282('0xb'))));}},'alias':{'type':Sequelize[_0x8282('0x3')]},'email':{'type':Sequelize[_0x8282('0x3')],'allowNull':![],'unique':_0x8282('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1a69b8){if(_0x1a69b8){this['setDataValue'](_0x8282('0xc'),_0x1a69b8[_0x8282('0xd')]());}}},'role':{'type':Sequelize[_0x8282('0xe')](_0x8282('0xf'),'user',_0x8282('0x10'),_0x8282('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x8282('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8282('0x3')],'defaultValue':_0x8282('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x57edb6){this[_0x8282('0x4')](_0x8282('0xb'),_0x57edb6);this[_0x8282('0x4')](_0x8282('0x13'),_0x57edb6);this[_0x8282('0x4')]('callerid',util[_0x8282('0x8')](_0x8282('0x9'),this[_0x8282('0xa')](_0x8282('0x14')),_0x57edb6));}},'salt':{'type':Sequelize[_0x8282('0x3')]},'phone':{'type':Sequelize[_0x8282('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x8282('0x3')]},'zipcode':{'type':Sequelize[_0x8282('0x3')]},'userpic':{'type':Sequelize[_0x8282('0x3')]},'city':{'type':Sequelize[_0x8282('0x3')]},'country':{'type':Sequelize[_0x8282('0x3')]},'online':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8282('0x16')]},'voicePause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8282('0x3')],'defaultValue':_0x8282('0x17')},'lastPauseAt':{'type':Sequelize[_0x8282('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8282('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8282('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![],'defaultValue':_0x8282('0x19')},'ipaddr':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x8282('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x1a'),'user',_0x8282('0x1b')),'allowNull':!![],'defaultValue':_0x8282('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8282('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x8282('0x1d'),_0x8282('0x1e'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x8282('0x1f'),_0x8282('0x20'),_0x8282('0x21'),_0x8282('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8282('0x23'),'set':function(_0x4e7a4b){this[_0x8282('0x4')](_0x8282('0x24'),_0x4e7a4b?_0x4e7a4b[_0x8282('0x25')](','):null);},'get':function(){return this[_0x8282('0xa')](_0x8282('0x24'))?this[_0x8282('0xa')](_0x8282('0x24'))['split'](','):null;},'comment':_0x8282('0x26')},'dtmfmode':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x27'),_0x8282('0x28'),_0x8282('0x29'),'inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8282('0xe')]('yes','no',_0x8282('0x2a'),'update',_0x8282('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0xeefb56){this[_0x8282('0x4')](_0x8282('0x2d'),_0xeefb56?_0xeefb56[_0x8282('0x25')](','):null);},'get':function(){return this[_0x8282('0xa')](_0x8282('0x2d'))?this[_0x8282('0xa')](_0x8282('0x2d'))[_0x8282('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x8282('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8282('0x3')]},'language':{'type':Sequelize[_0x8282('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8282('0x3')]},'disallow':{'type':Sequelize[_0x8282('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8282('0x2f'),'set':function(_0x2c1052){this[_0x8282('0x4')](_0x8282('0x30'),_0x2c1052?_0x2c1052['join'](';'):_0x8282('0x2f'));},'get':function(){return this[_0x8282('0xa')]('allow')?this['getDataValue'](_0x8282('0x30'))[_0x8282('0x2e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![],'set':function(_0x12e61c){this[_0x8282('0x4')](_0x8282('0x31'),_0x12e61c?_0x12e61c['join'](','):null);},'get':function(){return this[_0x8282('0xa')]('insecure')?this[_0x8282('0xa')](_0x8282('0x31'))[_0x8282('0x2e')](','):null;},'comment':_0x8282('0x32')},'trustrpid':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8282('0xe')]('yes','no',_0x8282('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![],'defaultValue':_0x8282('0x34')},'amaflags':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8282('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no',_0x8282('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x8282('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x36'),_0x8282('0x37'),_0x8282('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8282('0xe')]('uac',_0x8282('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x8282('0x2c')},'keepalive':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8282('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8282('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8282('0xe')]('yes','no',_0x8282('0x3a'),_0x8282('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8282('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8282('0xe')]('active',_0x8282('0x3c'),_0x8282('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8282('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x8282('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x8282('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8282('0xe')](_0x8282('0x2c'),'no','nonat',_0x8282('0x3e'),_0x8282('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8282('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x8282('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8282('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4bab13){this[_0x8282('0x4')](_0x8282('0x41'),_0x4bab13);var _0x365a7d=this['get']({'plain':!![]});switch(_0x4bab13){case 0x0:case 0x1:var _0x28ec28=_0x365a7d[_0x8282('0x24')]?_['isArray'](_0x365a7d[_0x8282('0x24')])?_0x365a7d[_0x8282('0x24')][_0x8282('0x25')]():_0x365a7d[_0x8282('0x24')]:_0x8282('0x23');if(_0x28ec28===_0x8282('0x42')){_0x28ec28='udp';}this[_0x8282('0x4')]('transport',_0x28ec28);this[_0x8282('0x4')](_0x8282('0x43'),'no');this['setDataValue'](_0x8282('0x44'),null);this[_0x8282('0x4')](_0x8282('0x45'),null);this[_0x8282('0x4')]('icesupport',null);this[_0x8282('0x4')]('dtlsenable',null);this[_0x8282('0x4')](_0x8282('0x46'),null);this[_0x8282('0x4')](_0x8282('0x47'),null);this['setDataValue']('dtlscertfile',null);this[_0x8282('0x4')]('dtlsprivatekey',null);this[_0x8282('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x8282('0x4')](_0x8282('0x24'),_0x8282('0x42'));this['setDataValue'](_0x8282('0x43'),_0x8282('0x2c'));this[_0x8282('0x4')](_0x8282('0x44'),_0x8282('0x2c'));this['setDataValue'](_0x8282('0x45'),_0x8282('0x2c'));this['setDataValue'](_0x8282('0x48'),_0x8282('0x2c'));this[_0x8282('0x4')]('dtlsenable',_0x8282('0x2c'));this[_0x8282('0x4')]('dtlsverify','no');this[_0x8282('0x4')](_0x8282('0x47'),_0x8282('0x3d'));this['setDataValue']('dtlscertfile',_0x365a7d[_0x8282('0x49')]||_0x8282('0x4a'));this[_0x8282('0x4')](_0x8282('0x4b'),_0x365a7d[_0x8282('0x4b')]||_0x8282('0x4c'));this['setDataValue'](_0x8282('0x4d'),_0x8282('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5c4206){this['setDataValue'](_0x8282('0x4e'),_0x5c4206?_0x5c4206[_0x8282('0x25')](','):[]);},'get':function(){return this[_0x8282('0xa')]('permissions')?_[_0x8282('0x4f')](this[_0x8282('0xa')](_0x8282('0x4e'))['split'](','),function(_0x446513){return parseInt(_0x446513,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8282('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8282('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8282('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x8282('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8282('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8282('0x50')],'get':function(){return this[_0x8282('0xa')](_0x8282('0x51'))?this[_0x8282('0xa')](_0x8282('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x8282('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8282('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![],'set':function(_0x31dc28){if(typeof _0x31dc28===_0x8282('0x52')){var _0xeb349f=_0x31dc28==='1'?!![]:_0x31dc28==='0'?![]:_0x31dc28===_0x8282('0x53')?!![]:_0x31dc28==='false'?![]:![];this[_0x8282('0x4')](_0x8282('0x54'),_0xeb349f);}else{this[_0x8282('0x4')](_0x8282('0x54'),_0x31dc28);}}},'blocked':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![],'set':function(_0x152793){this[_0x8282('0x4')](_0x8282('0x55'),_0x152793);if(_0x152793===!![]){this[_0x8282('0x4')]('blockedAt',moment());this[_0x8282('0x4')](_0x8282('0x56'),0x0);}else{this[_0x8282('0x4')](_0x8282('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x8282('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8282('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8282('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x8282('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x8282('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3896=['nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','TEXT','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','callerid','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','rfc2833','info','shortinfo','auto','yes'];(function(_0x11e6c7,_0x2c963a){var _0x1fe4c3=function(_0x149ad5){while(--_0x149ad5){_0x11e6c7['push'](_0x11e6c7['shift']());}};_0x1fe4c3(++_0x2c963a);}(_0x3896,0xf3));var _0x6389=function(_0x2c3c08,_0xd094ff){_0x2c3c08=_0x2c3c08-0x0;var _0x5de237=_0x3896[_0x2c3c08];return _0x5de237;};'use strict';var Sequelize=require(_0x6389('0x0'));var moment=require('moment');var util=require(_0x6389('0x1'));var _=require(_0x6389('0x2'));module['exports']={'name':{'type':Sequelize[_0x6389('0x3')],'allowNull':![],'unique':_0x6389('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f039d){this[_0x6389('0x5')]('name',_0x3f039d);this['setDataValue'](_0x6389('0x6'),_0x3f039d);},'comment':_0x6389('0x7')},'fullname':{'type':Sequelize[_0x6389('0x3')],'allowNull':![],'set':function(_0x297394){this[_0x6389('0x5')]('fullname',_0x297394);this['setDataValue']('callerid',util['format'](_0x6389('0x8'),_0x297394,this[_0x6389('0x9')](_0x6389('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6389('0x3')],'allowNull':![],'unique':_0x6389('0xb'),'validate':{'isEmail':!![]},'set':function(_0xc44531){if(_0xc44531){this[_0x6389('0x5')](_0x6389('0xb'),_0xc44531[_0x6389('0xc')]());}}},'role':{'type':Sequelize[_0x6389('0xd')](_0x6389('0xe'),_0x6389('0xf'),_0x6389('0x10'),_0x6389('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x6389('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6389('0x3')],'defaultValue':_0x6389('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6389('0xa'),'set':function(_0x34498c){this[_0x6389('0x5')](_0x6389('0xa'),_0x34498c);this[_0x6389('0x5')](_0x6389('0x13'),_0x34498c);this[_0x6389('0x5')](_0x6389('0x14'),util[_0x6389('0x15')](_0x6389('0x8'),this[_0x6389('0x9')](_0x6389('0x16')),_0x34498c));}},'salt':{'type':Sequelize[_0x6389('0x3')]},'phone':{'type':Sequelize[_0x6389('0x3')]},'mobile':{'type':Sequelize[_0x6389('0x3')]},'address':{'type':Sequelize[_0x6389('0x3')]},'zipcode':{'type':Sequelize[_0x6389('0x3')]},'userpic':{'type':Sequelize[_0x6389('0x3')]},'city':{'type':Sequelize[_0x6389('0x3')]},'country':{'type':Sequelize[_0x6389('0x3')]},'online':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6389('0x18')]},'voicePause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x6389('0x19')},'lastPauseAt':{'type':Sequelize[_0x6389('0x18')]},'chatCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6389('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![],'defaultValue':_0x6389('0x1b')},'ipaddr':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x6389('0x1a')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x1c'),_0x6389('0xf'),'peer'),'allowNull':!![],'defaultValue':_0x6389('0x1c')},'context':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![],'defaultValue':_0x6389('0x1d')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x6389('0x1e'),_0x6389('0x1f'),_0x6389('0x20'),_0x6389('0x21'),_0x6389('0x22'),_0x6389('0x23'),_0x6389('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6389('0x25'),'set':function(_0x1c6684){this[_0x6389('0x5')](_0x6389('0x26'),_0x1c6684?_0x1c6684[_0x6389('0x27')](','):null);},'get':function(){return this[_0x6389('0x9')]('transport')?this[_0x6389('0x9')](_0x6389('0x26'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x28'),_0x6389('0x29'),_0x6389('0x2a'),'inband',_0x6389('0x2b')),'allowNull':!![],'defaultValue':_0x6389('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no',_0x6389('0x2d'),_0x6389('0x2e'),_0x6389('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6389('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![],'defaultValue':_0x6389('0x30'),'set':function(_0x19be79){this[_0x6389('0x5')](_0x6389('0x31'),_0x19be79?_0x19be79[_0x6389('0x27')](','):null);},'get':function(){return this[_0x6389('0x9')](_0x6389('0x31'))?this[_0x6389('0x9')](_0x6389('0x31'))['split'](','):null;},'comment':_0x6389('0x32')},'callgroup':{'type':Sequelize[_0x6389('0x3')]},'namedcallgroup':{'type':Sequelize[_0x6389('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6389('0x3')]},'language':{'type':Sequelize[_0x6389('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6389('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6389('0x33')},'allow':{'type':Sequelize[_0x6389('0x3')],'allowNull':![],'defaultValue':_0x6389('0x34'),'set':function(_0x13cf95){this[_0x6389('0x5')](_0x6389('0x35'),_0x13cf95?_0x13cf95['join'](';'):_0x6389('0x34'));},'get':function(){return this[_0x6389('0x9')](_0x6389('0x35'))?this[_0x6389('0x9')]('allow')['split'](';'):null;},'comment':_0x6389('0x36')},'autoframing':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![],'set':function(_0x109d1f){this['setDataValue'](_0x6389('0x37'),_0x109d1f?_0x109d1f['join'](','):null);},'get':function(){return this['getDataValue'](_0x6389('0x37'))?this['getDataValue'](_0x6389('0x37'))[_0x6389('0x38')](','):null;},'comment':_0x6389('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6389('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no',_0x6389('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6389('0xd')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6389('0x3b')},'amaflags':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x6389('0x2c')},'busylevel':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no',_0x6389('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6389('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6389('0xd')]('accept',_0x6389('0x3d'),_0x6389('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x3f'),_0x6389('0x40')),'allowNull':!![],'defaultValue':_0x6389('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x6389('0x2c')},'keepalive':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no',_0x6389('0x41'),_0x6389('0x42')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6389('0x1a')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x6389('0x43'),_0x6389('0x44'),_0x6389('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x6389('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6389('0xd')](_0x6389('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6389('0xd')]('yes','no',_0x6389('0x2d'),_0x6389('0x2e'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x6389('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6389('0x46')]},'showWebBar':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0,'set':function(_0x2052cf){this[_0x6389('0x5')]('showWebBar',_0x2052cf);var _0x4dce1b=this[_0x6389('0x47')]({'plain':!![]});switch(_0x2052cf){case 0x0:case 0x1:var _0x5ee9fe=_0x4dce1b[_0x6389('0x26')]?_[_0x6389('0x48')](_0x4dce1b[_0x6389('0x26')])?_0x4dce1b[_0x6389('0x26')][_0x6389('0x27')]():_0x4dce1b[_0x6389('0x26')]:_0x6389('0x25');if(_0x5ee9fe===_0x6389('0x49')){_0x5ee9fe='udp';}this[_0x6389('0x5')](_0x6389('0x26'),_0x5ee9fe);this[_0x6389('0x5')](_0x6389('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x6389('0x5')](_0x6389('0x4b'),null);this['setDataValue'](_0x6389('0x4c'),null);this[_0x6389('0x5')](_0x6389('0x4d'),null);this[_0x6389('0x5')](_0x6389('0x4e'),null);this[_0x6389('0x5')](_0x6389('0x4f'),null);this[_0x6389('0x5')](_0x6389('0x50'),null);this[_0x6389('0x5')](_0x6389('0x51'),null);this[_0x6389('0x5')](_0x6389('0x52'),'no');break;case 0x2:this[_0x6389('0x5')]('transport','wss');this[_0x6389('0x5')]('encryption','yes');this[_0x6389('0x5')](_0x6389('0x53'),_0x6389('0x2c'));this[_0x6389('0x5')](_0x6389('0x4b'),_0x6389('0x2c'));this[_0x6389('0x5')](_0x6389('0x4c'),'yes');this[_0x6389('0x5')](_0x6389('0x4d'),'yes');this['setDataValue']('dtlsverify','no');this[_0x6389('0x5')](_0x6389('0x4f'),_0x6389('0x45'));this[_0x6389('0x5')](_0x6389('0x50'),_0x4dce1b['dtlscertfile']||_0x6389('0x54'));this['setDataValue']('dtlsprivatekey',_0x4dce1b[_0x6389('0x51')]||_0x6389('0x55'));this[_0x6389('0x5')](_0x6389('0x52'),_0x6389('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x6389('0x46')],'set':function(_0x594ce4){this['setDataValue']('permissions',_0x594ce4?_0x594ce4[_0x6389('0x27')](','):[]);},'get':function(){return this[_0x6389('0x9')](_0x6389('0x56'))?_[_0x6389('0x57')](this[_0x6389('0x9')]('permissions')['split'](','),function(_0x4493f3){return parseInt(_0x4493f3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6389('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6389('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6389('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6389('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6389('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6389('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6389('0x9')](_0x6389('0x58'))?this['getDataValue'](_0x6389('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6389('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6389('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![],'set':function(_0x4e158d){if(typeof _0x4e158d===_0x6389('0x59')){var _0x2fdef1=_0x4e158d==='1'?!![]:_0x4e158d==='0'?![]:_0x4e158d===_0x6389('0x5a')?!![]:_0x4e158d===_0x6389('0x5b')?![]:![];this['setDataValue'](_0x6389('0x5c'),_0x2fdef1);}else{this[_0x6389('0x5')](_0x6389('0x5c'),_0x4e158d);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x42c640){this[_0x6389('0x5')](_0x6389('0x5d'),_0x42c640);if(_0x42c640===!![]){this[_0x6389('0x5')](_0x6389('0x5e'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0x6389('0x5e'),null);}}},'blockedAt':{'type':Sequelize[_0x6389('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6389('0x1a')](0x5)[_0x6389('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6389('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6389('0x1a')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6389('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ec68ac3..4533447 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 _0x4991=['order','sort','where','pick','filters','nolimit','intersection','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','getLists','getAgents','values','transaction','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','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$gt','$gte','$lte','$ne','$not','$between','$notBetween','$notIn','$notLike','$iLike','$like','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','getApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','apiKeyNonce','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','enabled','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','register','redis','defaults','localhost','client','http','status','json','offset','limit','undefined','count','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','role','agent','emit','userNotification:recalc:','destroy','admin','Users','user','Agents','Telephones','telephone','filter','ignore','value','includes','find','name','UserProfileResource','sendStatus','stack','User','rawAttributes','map','fieldName','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','dataValues','sms','fax','mail','openchannel','whatsapp','show','merge','options','all','update','body','params','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','password','email','permissions','102','113','110','104','105','108','109','100','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','userProfileId','isEmpty','compact','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','capitalize','penalty','spread','toLowerCase','Queue:save','VoiceQueue','get','voice','format','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','Queues','isArray','QueueId','Queue:remove','addAvatar','file','filename','join','root','server/files/images/logos/default_profile.png','userpic','download','server/files/images/','getOpenTabs','chat','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','WHATSAPP','concat','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','keys','Queue','model','fields'];(function(_0x538783,_0x1d6a00){var _0x463247=function(_0xb1b123){while(--_0xb1b123){_0x538783['push'](_0x538783['shift']());}};_0x463247(++_0x1d6a00);}(_0x4991,0xbd));var _0x1499=function(_0x41c6b5,_0x45c3af){_0x41c6b5=_0x41c6b5-0x0;var _0x5848eb=_0x4991[_0x41c6b5];return _0x5848eb;};'use strict';var moment=require(_0x1499('0x0'));var util=require(_0x1499('0x1'));var path=require(_0x1499('0x2'));var fs=require('fs');var _=require(_0x1499('0x3'));var squel=require(_0x1499('0x4'));var Redis=require(_0x1499('0x5'));var jayson=require('jayson/promise');var authService=require('../../components/auth/service');var contacts=require('../../components/contacts');var qs=require(_0x1499('0x6'));var rta=require(_0x1499('0x7'));var logger=require(_0x1499('0x8'))(_0x1499('0x9'));var utils=require(_0x1499('0xa'));var config=require('../../config/environment');var licenseUtil=require(_0x1499('0xb'));var APIBadRequestError=require(_0x1499('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x1499('0xc'))[_0x1499('0xd')];var APIForbiddenError=require(_0x1499('0xc'))[_0x1499('0xe')];var APIHandleError=require(_0x1499('0xc'))[_0x1499('0xf')];var db=require(_0x1499('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x1499('0x11')](socket);config[_0x1499('0x12')]=_[_0x1499('0x13')](config[_0x1499('0x12')],{'host':_0x1499('0x14'),'port':0x18eb});var amiClient=jayson[_0x1499('0x15')][_0x1499('0x16')]({'port':0x232a});var values;function respondWithStatusCode(_0xf4d2cd,_0x4254b7){_0x4254b7=_0x4254b7||0xcc;return function(_0x3c51b9){if(_0x3c51b9){return _0xf4d2cd['sendStatus'](_0x4254b7);}return _0xf4d2cd['status'](_0x4254b7)['end']();};}function respondWithResult(_0x4ea246,_0x4f4946){_0x4f4946=_0x4f4946||0xc8;return function(_0x446a6c){if(_0x446a6c){return _0x4ea246[_0x1499('0x17')](_0x4f4946)[_0x1499('0x18')](_0x446a6c);}};}function respondWithFilteredResult(_0x139a43,_0x58859d){return function(_0x2279f8){if(_0x2279f8){var _0x3de00b=typeof _0x58859d[_0x1499('0x19')]==='undefined'&&typeof _0x58859d[_0x1499('0x1a')]===_0x1499('0x1b');var _0x5a6613=_0x2279f8[_0x1499('0x1c')];var _0x2c6e2b=_0x3de00b?0x0:_0x58859d[_0x1499('0x19')];var _0x1a884a=_0x3de00b?_0x2279f8[_0x1499('0x1c')]:_0x58859d[_0x1499('0x19')]+_0x58859d[_0x1499('0x1a')];var _0x599c5a;if(_0x1a884a>=_0x5a6613){_0x1a884a=_0x5a6613;_0x599c5a=0xc8;}else{_0x599c5a=0xce;}_0x139a43[_0x1499('0x17')](_0x599c5a);return _0x139a43[_0x1499('0x1d')](_0x1499('0x1e'),_0x2c6e2b+'-'+_0x1a884a+'/'+_0x5a6613)[_0x1499('0x18')](_0x2279f8);}return null;};}function respondWithRpcPromise(_0xca23ff,_0x42271b,_0x116d1f,_0x934256){return new Promise(function(_0x4eee57,_0xf5769e){var _0x1e9e08=_0x934256||amiClient;return _0x1e9e08[_0x1499('0x1f')](_0xca23ff,_0x116d1f)[_0x1499('0x20')](function(_0x288900){logger[_0x1499('0x21')](_0x1499('0x22'),_0x42271b,_0x1499('0x23'));logger[_0x1499('0x24')](_0x1499('0x25'),_0x42271b,_0x1499('0x23'),JSON[_0x1499('0x26')](_0x288900));if(_0x288900['error']){if(_0x288900[_0x1499('0x27')][_0x1499('0x28')]===0x1f4){logger['error'](_0x1499('0x22'),_0x42271b,_0x288900[_0x1499('0x27')]['message']);return _0xf5769e(_0x288900['error'][_0x1499('0x29')]);}logger[_0x1499('0x27')]('User,\x20%s,\x20%s',_0x42271b,_0x288900[_0x1499('0x27')][_0x1499('0x29')]);return _0x4eee57(_0x288900['error'][_0x1499('0x29')]);}else{logger[_0x1499('0x21')](_0x1499('0x22'),_0x42271b,_0x1499('0x23'));_0x4eee57(_0x288900[_0x1499('0x2a')][_0x1499('0x29')]);}})[_0x1499('0x2b')](function(_0xc7bbb4){logger[_0x1499('0x27')](_0x1499('0x22'),_0x42271b,_0xc7bbb4);_0xf5769e(_0xc7bbb4);});});}function saveUpdates(_0x4d92f8){return function(_0x4e1ac9){if(_0x4e1ac9){return _0x4e1ac9['update'](_0x4d92f8)['then'](function(_0x34d8c1){if(_0x34d8c1[_0x1499('0x2c')]===_0x1499('0x2d')){socket[_0x1499('0x2e')](_0x1499('0x2f')+_0x34d8c1['id'],_0x34d8c1);}return _0x34d8c1;});}return null;};}function removeEntity(_0x5ae291,_0x916dab){return function(_0x1726ea){if(_0x1726ea){return _0x1726ea[_0x1499('0x30')]({'transaction':_0x916dab})[_0x1499('0x20')](function(){var _0x406389=_0x1726ea['get']({'plain':!![]});if(_0x406389[_0x1499('0x2c')]===_0x1499('0x31'))return;var _0x3d9f87=[{'name':_0x1499('0x32'),'value':_0x1499('0x33'),'ignore':!![]},{'name':_0x1499('0x34'),'value':'agent','ignore':![]},{'name':_0x1499('0x35'),'value':_0x1499('0x36'),'ignore':![]}];var _0x55f728=_(_0x3d9f87)[_0x1499('0x37')](_0x1499('0x38'))['map'](_0x1499('0x39'))[_0x1499('0x39')]();if(_[_0x1499('0x3a')](_0x55f728,_0x406389[_0x1499('0x2c')])){return;}var _0x2b9e32=_[_0x1499('0x3b')](_0x3d9f87,[_0x1499('0x39'),_0x406389['role']])[_0x1499('0x3c')];return db[_0x1499('0x3d')]['destroy']({'where':{'type':_0x2b9e32,'resourceId':_0x406389['id']},'transaction':_0x916dab})[_0x1499('0x20')](function(){return _0x1726ea;});})['then'](function(){_0x5ae291[_0x1499('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0afba){return function(_0x52d584){if(!_0x52d584){_0xf0afba[_0x1499('0x3e')](0x194);}return _0x52d584;};}function handleError(_0x82a70,_0x1af103){_0x1af103=_0x1af103||0x1f4;return function(_0x3d92e1){logger[_0x1499('0x27')](_0x3d92e1[_0x1499('0x3f')]);if(_0x3d92e1[_0x1499('0x3c')]){delete _0x3d92e1[_0x1499('0x3c')];}_0x82a70['status'](_0x1af103)['send'](_0x3d92e1);};}function getUserAttributes(){return _(db[_0x1499('0x40')][_0x1499('0x41')])[_0x1499('0x42')](function(_0xdb4e7e){return{'name':_0xdb4e7e[_0x1499('0x43')],'type':_0xdb4e7e[_0x1499('0x44')][_0x1499('0x45')]};})[_0x1499('0x37')](function(_0x219bf8){return!['password',_0x1499('0x46'),_0x1499('0x47'),_0x1499('0x48'),_0x1499('0x49'),'md5secret'][_0x1499('0x3a')](_0x219bf8[_0x1499('0x3c')]);})[_0x1499('0x39')]();}exports[_0x1499('0x4a')]=function(_0x471fd6,_0x27fe40){var _0x5edb4f={},_0x2afe69={'count':0x0,'rows':[]};var _0x36128a=getUserAttributes();_0x5edb4f=qs[_0x1499('0x4b')](_0x36128a,_0x471fd6);var _0x2f5a16={'where':_0x5edb4f['where']};return db['User']['count'](_0x2f5a16)[_0x1499('0x20')](function(_0x1864ef){_0x2afe69['count']=_0x1864ef;if(_0x471fd6[_0x1499('0x4c')][_0x1499('0x4d')]){_0x5edb4f[_0x1499('0x4e')]=[{'all':!![]}];}if(_0x471fd6[_0x1499('0x4c')][_0x1499('0x4f')]===_0x1499('0x50')){_0x5edb4f[_0x1499('0x4e')]=[{'model':db[_0x1499('0x51')],'as':_0x1499('0x4f')}];}if(!_[_0x1499('0x3a')](_0x5edb4f[_0x1499('0x52')],'id')){_0x5edb4f[_0x1499('0x52')][_0x1499('0x53')]('id');}return db[_0x1499('0x40')][_0x1499('0x54')](_0x5edb4f);})['then'](function(_0x5a825f){_0x2afe69[_0x1499('0x55')]=_0x5a825f;if(_0x471fd6[_0x1499('0x4c')][_0x1499('0x56')]===_0x1499('0x50')){var _0x192470=[];for(var _0x5ae625=0x0;_0x5ae625<_0x2afe69[_0x1499('0x55')][_0x1499('0x57')];_0x5ae625++){_0x192470[_0x1499('0x53')](get_open_tabs('chat',_0x2afe69[_0x1499('0x55')][_0x5ae625][_0x1499('0x58')]));_0x192470['push'](get_open_tabs(_0x1499('0x59'),_0x2afe69[_0x1499('0x55')][_0x5ae625][_0x1499('0x58')]));_0x192470['push'](get_open_tabs(_0x1499('0x5a'),_0x2afe69[_0x1499('0x55')][_0x5ae625][_0x1499('0x58')]));_0x192470[_0x1499('0x53')](get_open_tabs(_0x1499('0x5b'),_0x2afe69[_0x1499('0x55')][_0x5ae625][_0x1499('0x58')]));_0x192470[_0x1499('0x53')](get_open_tabs(_0x1499('0x5c'),_0x2afe69['rows'][_0x5ae625]['dataValues']));_0x192470[_0x1499('0x53')](get_open_tabs(_0x1499('0x5d'),_0x2afe69[_0x1499('0x55')][_0x5ae625][_0x1499('0x58')]));}return Promise['all'](_0x192470)[_0x1499('0x20')](function(){return _0x2afe69;});}else{return _0x2afe69;}})[_0x1499('0x20')](respondWithFilteredResult(_0x27fe40,_0x5edb4f))[_0x1499('0x2b')](handleError(_0x27fe40,null));};exports[_0x1499('0x5e')]=function(_0x5c0257,_0x241055){var _0x2416b7=getUserAttributes();_0x5c0257[_0x1499('0x4c')]['id']=_0x5c0257['params']['id'];var _0x557323=qs['getOptions'](_0x2416b7,_0x5c0257);if(_0x5c0257[_0x1499('0x4c')][_0x1499('0x4d')]){_0x557323[_0x1499('0x4e')]=[{'all':!![]}];}if(_0x5c0257['query'][_0x1499('0x4f')]===_0x1499('0x50')){_0x557323['include']=[{'model':db['UserSetting'],'as':_0x1499('0x4f')}];}_0x557323=_[_0x1499('0x5f')]({},_0x557323,_0x5c0257[_0x1499('0x60')]);if(!_[_0x1499('0x3a')](_0x557323[_0x1499('0x52')],'id')){_0x557323['attributes'][_0x1499('0x53')]('id');}return db['User'][_0x1499('0x3b')](_0x557323)[_0x1499('0x20')](handleEntityNotFound(_0x241055,null))[_0x1499('0x20')](function(_0x4bd5cf){var _0x4404bf=[];values=_0x4bd5cf;if(_0x5c0257[_0x1499('0x4c')]['openTabs']===_0x1499('0x50')){_0x4404bf[_0x1499('0x53')](get_open_tabs('chat',_0x4bd5cf[_0x1499('0x58')]));_0x4404bf[_0x1499('0x53')](get_open_tabs('sms',_0x4bd5cf[_0x1499('0x58')]));_0x4404bf[_0x1499('0x53')](get_open_tabs(_0x1499('0x5c'),_0x4bd5cf[_0x1499('0x58')]));_0x4404bf[_0x1499('0x53')](get_open_tabs('whatsapp',_0x4bd5cf[_0x1499('0x58')]));_0x4404bf['push'](get_open_tabs('fax',_0x4bd5cf[_0x1499('0x58')]));_0x4404bf[_0x1499('0x53')](get_open_tabs('mail',_0x4bd5cf[_0x1499('0x58')]));return Promise[_0x1499('0x61')](_0x4404bf);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x241055,null))[_0x1499('0x2b')](handleError(_0x241055,null));};exports[_0x1499('0x62')]=function(_0x1cc48a,_0x1f37df){if(_0x1cc48a[_0x1499('0x63')]['id']){delete _0x1cc48a[_0x1499('0x63')]['id'];}delete _0x1cc48a[_0x1499('0x63')][_0x1499('0x2c')];return db['User'][_0x1499('0x3b')]({'where':{'id':_0x1cc48a[_0x1499('0x64')]['id']}})['then'](handleEntityNotFound(_0x1f37df,null))[_0x1499('0x20')](saveUpdates(_0x1cc48a['body'],null))[_0x1499('0x20')](respondWithResult(_0x1f37df,null))[_0x1499('0x2b')](handleError(_0x1f37df,null));};exports[_0x1499('0x65')]=function(_0x468c2f,_0x42d47d){return db[_0x1499('0x40')]['describe']()['then'](respondWithResult(_0x42d47d,null))['catch'](handleError(_0x42d47d,null));};exports[_0x1499('0x66')]=function(_0x2e05e7,_0x554f72){return db['User'][_0x1499('0x3b')]({'where':{'id':_0x2e05e7[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x554f72,null))[_0x1499('0x20')](function(_0x1e3c29){if(_0x1e3c29){return _0x1e3c29[_0x1499('0x66')](_0x2e05e7[_0x1499('0x63')][_0x1499('0x67')],_[_0x1499('0x68')](_0x2e05e7['body'],[_0x1499('0x67'),'id'])||{});}})[_0x1499('0x20')](respondWithResult(_0x554f72,null))[_0x1499('0x2b')](handleError(_0x554f72,null));};function validateUser(_0x54f368){return new Promise(function(_0x245b51,_0x2436ec){if(_0x54f368[_0x1499('0x69')])return _0x245b51(_0x54f368);return db[_0x1499('0x6a')][_0x1499('0x6b')](0x1)[_0x1499('0x20')](function(_0x4b2648){if(_0x4b2648['securePassword'])authService[_0x1499('0x6c')](_0x54f368['password']);db[_0x1499('0x40')][_0x1499('0x6d')]('internal')[_0x1499('0x20')](function(_0x49eeab){if(_[_0x1499('0x6e')](_0x49eeab)){_0x54f368[_0x1499('0x69')]=_0x4b2648['min_internal']||0x1;return;}if(_[_0x1499('0x6e')](_0x4b2648[_0x1499('0x6f')])||_0x4b2648[_0x1499('0x6f')]===_0x49eeab){_0x54f368[_0x1499('0x69')]=_0x49eeab+0x1;return;}if(_0x4b2648[_0x1499('0x6f')]>_0x49eeab){_0x54f368[_0x1499('0x69')]=_0x4b2648[_0x1499('0x6f')];return;}return db[_0x1499('0x70')][_0x1499('0x4c')](_0x1499('0x71'),{'type':db[_0x1499('0x70')][_0x1499('0x72')][_0x1499('0x73')]})[_0x1499('0x20')](function(_0x2feb60){if(_0x2feb60&&_0x2feb60['length']){for(var _0x54a78e=0x0,_0x20f354=_0x2feb60['length'];_0x54a78e<_0x20f354&&_[_0x1499('0x6e')](_0x54f368['internal']);_0x54a78e++){if(_0x4b2648['min_internal']<=_0x2feb60[_0x54a78e][_0x1499('0x74')]){_0x54f368[_0x1499('0x69')]=_0x2feb60[_0x54a78e][_0x1499('0x74')];}else if(_0x4b2648[_0x1499('0x6f')]>_0x2feb60[_0x54a78e][_0x1499('0x74')]&&_0x4b2648['min_internal']<=_0x2feb60[_0x54a78e]['to']){_0x54f368['internal']=_0x4b2648[_0x1499('0x6f')];}}}if(_['isNil'](_0x54f368[_0x1499('0x69')])){_0x54f368[_0x1499('0x69')]=_0x49eeab+0x1;}return _0x245b51(_0x54f368);});});})['catch'](function(_0x2f49f2){_0x2436ec(_0x2f49f2);});});}function updateUser(_0x2ff1d3){return new Promise(function(_0x79a582,_0xc77f9d){try{if(_0x2ff1d3[_0x1499('0x75')]){_0x2ff1d3[_0x1499('0x76')]=_0x2ff1d3['internal'];_0x2ff1d3[_0x1499('0x77')]={'mailbox':_0x2ff1d3['internal'],'password':_0x2ff1d3[_0x1499('0x78')],'fullname':_0x2ff1d3['fullname'],'email':_0x2ff1d3[_0x1499('0x79')]};}if(_0x2ff1d3[_0x1499('0x2c')]===_0x1499('0x2d')){if(!_0x2ff1d3[_0x1499('0x7a')])_0x2ff1d3[_0x1499('0x7a')]=['101',_0x1499('0x7b'),'103',_0x1499('0x7c'),_0x1499('0x7d'),_0x1499('0x7e'),_0x1499('0x7f'),'106','107',_0x1499('0x80'),_0x1499('0x81'),_0x1499('0x82'),'111',_0x1499('0x83'),_0x1499('0x84')];}_0x79a582(_0x2ff1d3);}catch(_0xd5e41a){_0xc77f9d(_0xd5e41a);}});}exports[_0x1499('0x85')]=function(_0x5caaa7,_0xf4a287){if(_0x5caaa7['user'][_0x1499('0x2c')]===_0x1499('0x2d'))throw new Error(_0x1499('0x86'));if(_0x5caaa7[_0x1499('0x63')][_0x1499('0x2c')]===_0x1499('0x33')&&_0x5caaa7[_0x1499('0x33')][_0x1499('0x2c')]!==_0x1499('0x31')){throw new Error(_0x1499('0x87'));}if(_0x5caaa7[_0x1499('0x63')][_0x1499('0x2c')]==='admin'&&_0x5caaa7['user'][_0x1499('0x2c')]!==_0x1499('0x31')){throw new Error(_0x1499('0x88'));}return licenseUtil['checkUserLimits']([_0x5caaa7[_0x1499('0x63')]])[_0x1499('0x20')](function(){return validateUser(_0x5caaa7[_0x1499('0x63')]);})[_0x1499('0x20')](function(_0x522982){return updateUser(_0x522982)[_0x1499('0x20')](function(_0x2317a5){if(_0x2317a5['role']===_0x1499('0x31')){_0x2317a5[_0x1499('0x89')]=_0x5caaa7[_0x1499('0x33')][_0x1499('0x89')];delete _0x2317a5['userProfileId'];}return _0x2317a5;});})['then'](function(_0x1115d1){return db[_0x1499('0x40')][_0x1499('0x85')](_0x1115d1,{'include':[{'model':db[_0x1499('0x77')],'as':_0x1499('0x77')}]});})[_0x1499('0x20')](function(_0x235610){if(_0x5caaa7[_0x1499('0x63')][_0x1499('0x2c')]===_0x1499('0x33'))return _0x235610;if(_0x5caaa7[_0x1499('0x33')]['role']!==_0x1499('0x33'))return _0x235610;return db['UserProfileSection'][_0x1499('0x3b')]({'where':{'name':_0x235610[_0x1499('0x2c')]===_0x1499('0x2d')?_0x1499('0x34'):_0x1499('0x35'),'userProfileId':_0x5caaa7[_0x1499('0x33')]['userProfileId']},'raw':!![]})[_0x1499('0x20')](function(_0x575bd3){if(!_0x575bd3||_0x575bd3[_0x1499('0x8a')]!=0x0)return _0x235610;return db[_0x1499('0x3d')][_0x1499('0x85')]({'name':_0x235610[_0x1499('0x3c')],'resourceId':_0x235610['id'],'type':_0x575bd3[_0x1499('0x3c')],'sectionId':_0x575bd3['id']},{})[_0x1499('0x20')](function(){return _0x235610;});})['catch'](function(_0x5d78df){logger[_0x1499('0x27')](_0x1499('0x8b'),_0x5d78df);throw _0x5d78df;});})['then'](respondWithResult(_0xf4a287,0xc9))[_0x1499('0x2b')](handleError(_0xf4a287,null));};exports[_0x1499('0x8c')]=function(_0x3c29b2,_0x40ab35){var _0x31c7f0=_0x3c29b2[_0x1499('0x63')];var _0x24448e=[];if(_0x3c29b2[_0x1499('0x33')][_0x1499('0x2c')]===_0x1499('0x2d'))throw new Error(_0x1499('0x86'));if(_[_0x1499('0x8d')](_0x31c7f0,['role','user'])&&_0x3c29b2[_0x1499('0x33')][_0x1499('0x2c')]!=='admin'){throw new Error(_0x1499('0x87'));}if(_['some'](_0x31c7f0,['role','admin'])&&_0x3c29b2[_0x1499('0x33')]['role']!=='admin'){throw new Error(_0x1499('0x8e'));}return licenseUtil[_0x1499('0x8f')](_0x31c7f0)['then'](function(){return validateUser(_0x31c7f0[0x0]);})[_0x1499('0x20')](function(){for(var _0x29585f=0x1;_0x29585f<_0x31c7f0['length'];_0x29585f++){var _0x1bf408=_0x31c7f0[_0x29585f-0x1][_0x1499('0x69')];if(!_0x31c7f0[_0x29585f][_0x1499('0x69')])_0x31c7f0[_0x29585f][_0x1499('0x69')]=_0x1bf408+0x1;_0x24448e[_0x1499('0x53')](validateUser(_0x31c7f0[_0x29585f]));}return Promise[_0x1499('0x61')](_0x24448e);})['then'](function(){_0x24448e=[];for(var _0x21c1a3=0x0;_0x21c1a3<_0x31c7f0[_0x1499('0x57')];_0x21c1a3++){_0x24448e['push'](updateUser(_0x31c7f0[_0x21c1a3]));}return Promise['all'](_0x24448e);})['then'](function(){_0x24448e=_0x31c7f0[_0x1499('0x42')](function(_0x18698d){return db[_0x1499('0x40')]['create'](_0x18698d,{'include':[{'model':db[_0x1499('0x77')],'as':_0x1499('0x77')}]})[_0x1499('0x20')](function(_0x5410b0){_0x18698d['id']=_0x5410b0['id'];return _0x18698d;});});return Promise[_0x1499('0x61')](_0x24448e);})[_0x1499('0x20')](function(_0x5eccb1){if(_0x3c29b2['body'][_0x1499('0x2c')]===_0x1499('0x33'))return _0x5eccb1;if(_0x3c29b2[_0x1499('0x33')][_0x1499('0x2c')]!==_0x1499('0x33'))return _0x5eccb1;var _0x2fb7de=_[_0x1499('0x8d')](_0x5eccb1,function(_0x1390a7){return _0x1390a7['role']===_0x1499('0x2d')||_0x1390a7['role']===_0x1499('0x36');});if(!_0x2fb7de)return _0x5eccb1;return db['UserProfileSection'][_0x1499('0x54')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x3c29b2[_0x1499('0x33')][_0x1499('0x90')]},'raw':!![]})['then'](function(_0x54fd18){if(_[_0x1499('0x91')](_0x54fd18)||!_[_0x1499('0x8d')](_0x54fd18,[_0x1499('0x8a'),0x0]))return _0x5eccb1;_0x24448e=[];var _0x373873=_(_0x54fd18)[_0x1499('0x42')](function(_0x196c10){if(_0x196c10[_0x1499('0x8a')]===0x1)return;return _0x196c10[_0x1499('0x3c')]===_0x1499('0x34')?_0x1499('0x2d'):_0x1499('0x36');})[_0x1499('0x92')]()['value']();for(var _0x17c994=0x0;_0x17c994<_0x5eccb1[_0x1499('0x57')];_0x17c994++){if(!_[_0x1499('0x3a')](_0x373873,_0x5eccb1[_0x17c994]['role']))return;var _0x5cbcf5=_0x5eccb1[_0x17c994][_0x1499('0x2c')]===_0x1499('0x2d')?_0x1499('0x34'):_0x1499('0x35');_0x24448e[_0x1499('0x53')](db[_0x1499('0x3d')]['create']({'name':_0x5eccb1[_0x17c994][_0x1499('0x3c')],'resourceId':_0x5eccb1[_0x17c994]['id'],'type':_0x5cbcf5,'sectionId':_['find'](_0x54fd18,[_0x1499('0x3c'),_0x5cbcf5])['id']},{}));}return Promise[_0x1499('0x61')](_0x24448e);});})['then'](respondWithResult(_0x40ab35,0xc9))[_0x1499('0x2b')](handleError(_0x40ab35,null));};exports['changePassword']=function(_0x4e75b1,_0xbd1620){if(_0x4e75b1[_0x1499('0x63')]['id']){delete _0x4e75b1[_0x1499('0x63')]['id'];}return db[_0x1499('0x40')]['find']({'where':{'id':_0x4e75b1[_0x1499('0x64')]['id']}})['then'](function(_0x41fbdf){if(!_0x41fbdf)return null;if(_0x41fbdf['id']===_0x4e75b1[_0x1499('0x33')]['id']){if(!_0x4e75b1[_0x1499('0x63')][_0x1499('0x93')]||!_0x4e75b1[_0x1499('0x63')][_0x1499('0x94')]){throw new db['Sequelize']['ValidationError'](_0x1499('0x95'));}if(!_0x41fbdf[_0x1499('0x96')](_0x4e75b1[_0x1499('0x63')][_0x1499('0x93')])){throw new db[(_0x1499('0x97'))][(_0x1499('0x98'))](_0x1499('0x99'));}if(_0x4e75b1[_0x1499('0x63')][_0x1499('0x93')]===_0x4e75b1[_0x1499('0x63')][_0x1499('0x94')]){throw new db[(_0x1499('0x97'))]['ValidationError'](_0x1499('0x9a'));}}else if(_0x4e75b1['user'][_0x1499('0x2c')]===_0x1499('0x31')){if(!_0x4e75b1['body'][_0x1499('0x94')]){throw new db['Sequelize'][(_0x1499('0x98'))](_0x1499('0x9b'));}}else if(_0x4e75b1[_0x1499('0x33')]['role']==='user'){if(!_0x4e75b1[_0x1499('0x63')][_0x1499('0x94')]){throw new db[(_0x1499('0x97'))]['ValidationError'](_0x1499('0x9b'));}if(_0x41fbdf['role']!==_0x1499('0x2d')){throw new db['Sequelize'][(_0x1499('0x98'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x1499('0x98'))](_0x1499('0x86'));}return _0x41fbdf;})[_0x1499('0x20')](handleEntityNotFound(_0xbd1620,null))[_0x1499('0x20')](function(_0x3c3b83){return db[_0x1499('0x6a')][_0x1499('0x9c')]({'attributes':['id','securePassword',_0x1499('0x9d'),_0x1499('0x9e')]})[_0x1499('0x20')](function(_0x41be11){if(_0x41be11['securePassword'])authService['validatePasswordPattern'](_0x4e75b1['body'][_0x1499('0x94')]);if(!_0x41be11['enforcePasswordHistory']||!_0x3c3b83[_0x1499('0x47')])return _0x3c3b83;authService[_0x1499('0x9f')](_0x4e75b1['body'][_0x1499('0x94')],_0x3c3b83[_0x1499('0x47')],_0x41be11['passwordHistoryLimit']);return _0x3c3b83;})[_0x1499('0x20')](saveUpdates({'password':_0x4e75b1[_0x1499('0x63')][_0x1499('0x94')],'passwordResetAt':_0x4e75b1[_0x1499('0x33')]['id']==_0x4e75b1[_0x1499('0x64')]['id']?moment():null,'previousPasswords':authService[_0x1499('0xa0')](_0x4e75b1[_0x1499('0x63')][_0x1499('0x94')],_0x3c3b83[_0x1499('0x47')])},null));})['then'](respondWithResult(_0xbd1620,null))[_0x1499('0x2b')](handleError(_0xbd1620,null));};exports[_0x1499('0xa1')]=function(_0x583b10,_0x564aee){var _0x3d39d4=_0x583b10['body'][_0x1499('0xa2')];return db[_0x1499('0x40')][_0x1499('0x3b')]({'where':{'id':_0x583b10[_0x1499('0x64')]['id']},'attributes':['id','name',_0x1499('0x2c'),_0x1499('0xa3'),_0x1499('0xa4'),_0x1499('0xa5'),_0x1499('0xa6')]})[_0x1499('0x20')](handleEntityNotFound(_0x564aee,null))[_0x1499('0x20')](function(_0x302a9c){if(_0x302a9c){if(!utils[_0x1499('0xa7')](_0x3d39d4)){throw new db[(_0x1499('0x97'))][(_0x1499('0x98'))]('Unknown\x20channel');}return _0x302a9c['add'+_[_0x1499('0xa8')](_0x3d39d4['toLowerCase']())+'Queues'](_0x583b10['body']['ids'],{'penalty':_0x583b10[_0x1499('0x63')][_0x1499('0xa9')]||0x0})[_0x1499('0xaa')](function(_0x392b5f){for(var _0x3b277f=0x0;_0x3b277f<_0x583b10[_0x1499('0x63')][_0x1499('0x67')][_0x1499('0x57')];_0x3b277f+=0x1){var _0x34a8e9={'UserId':Number(_0x583b10['params']['id'])};_0x34a8e9[_[_0x1499('0xa8')](_0x3d39d4['toLowerCase']())+'QueueId']=Number(_0x583b10[_0x1499('0x63')][_0x1499('0x67')][_0x3b277f]);socket['emit'](_0x1499('0x33')+_[_0x1499('0xa8')](_0x3d39d4[_0x1499('0xab')]())+_0x1499('0xac'),_0x34a8e9);}return _0x392b5f;})[_0x1499('0x20')](function(){if(_0x3d39d4==='voice'){return db[_0x1499('0xad')][_0x1499('0x54')]({'where':{'id':_0x583b10[_0x1499('0x63')]['ids']||[]},'raw':!![],'attributes':['id',_0x1499('0x3c')]});}})[_0x1499('0x20')](function(_0x405fd1){var _0x50fc2c=_0x302a9c[_0x1499('0xae')]({'plain':!![]});var _0x46d0b2=[];if(_0x3d39d4===_0x1499('0xaf')&&_0x50fc2c[_0x1499('0x2c')]==='agent'&&_0x50fc2c[_0x1499('0xa3')]){for(let _0x4e75d3=0x0;_0x4e75d3<_0x405fd1['length'];_0x4e75d3+=0x1){_0x46d0b2[_0x1499('0x53')]({'membername':_0x50fc2c[_0x1499('0x3c')],'UserId':_0x50fc2c['id'],'queue_name':_0x405fd1[_0x4e75d3][_0x1499('0x3c')],'VoiceQueueId':_0x405fd1[_0x4e75d3]['id'],'interface':_['isNil'](_0x50fc2c['interface'])?util[_0x1499('0xb0')]('SIP/%s',_0x50fc2c[_0x1499('0x3c')]):_0x50fc2c[_0x1499('0xa6')],'paused':_0x50fc2c[_0x1499('0xa5')]||![],'penalty':_0x583b10[_0x1499('0x63')]['penalty']||0x0});}return Promise[_0x1499('0x61')](_0x46d0b2['map'](function(_0x5aa72f){return db[_0x1499('0xb1')]['upsert'](_0x5aa72f);}));}return _0x302a9c;});}})[_0x1499('0x20')](respondWithStatusCode(_0x564aee,null))['catch'](handleError(_0x564aee,null));};exports[_0x1499('0xb2')]=function(_0x175b9b,_0x50a3b8){var _0x3e6187,_0x521fe8;return db[_0x1499('0x40')][_0x1499('0x3b')]({'where':{'id':_0x175b9b[_0x1499('0x64')]['id']},'attributes':['id','name','role']})[_0x1499('0x20')](handleEntityNotFound(_0x50a3b8,null))[_0x1499('0x20')](function(_0x3a90eb){if(_0x3a90eb){_0x3e6187=_0x3a90eb;if(!_0x175b9b[_0x1499('0x4c')]['channel']||!utils[_0x1499('0xa7')](_0x175b9b[_0x1499('0x4c')]['channel'])){throw new db['Sequelize'][(_0x1499('0x98'))](_0x1499('0xb3'));}return _0x3a90eb[_0x1499('0xb4')+_[_0x1499('0xa8')](_0x175b9b[_0x1499('0x4c')]['channel'][_0x1499('0xab')]())+_0x1499('0xb5')](_0x175b9b[_0x1499('0x4c')][_0x1499('0x67')]);}})[_0x1499('0x20')](function(_0x75e3e6){if(_[_0x1499('0xb6')](_0x175b9b[_0x1499('0x4c')]['ids'])){for(var _0x43bc73=0x0;_0x43bc73<_0x175b9b[_0x1499('0x4c')][_0x1499('0x67')][_0x1499('0x57')];_0x43bc73+=0x1){_0x521fe8={'UserId':Number(_0x175b9b[_0x1499('0x64')]['id'])};_0x521fe8[_['capitalize'](_0x175b9b[_0x1499('0x4c')]['channel'][_0x1499('0xab')]())+_0x1499('0xb7')]=Number(_0x175b9b['query'][_0x1499('0x67')][_0x43bc73]);socket[_0x1499('0x2e')](_0x1499('0x33')+_[_0x1499('0xa8')](_0x175b9b['query'][_0x1499('0xa2')]['toLowerCase']())+_0x1499('0xb8'),_0x521fe8);}}else{_0x521fe8={'UserId':Number(_0x175b9b[_0x1499('0x64')]['id'])};_0x521fe8[_[_0x1499('0xa8')](_0x175b9b['query'][_0x1499('0xa2')]['toLowerCase']())+_0x1499('0xb7')]=Number(_0x175b9b[_0x1499('0x4c')][_0x1499('0x67')]);socket[_0x1499('0x2e')](_0x1499('0x33')+_[_0x1499('0xa8')](_0x175b9b[_0x1499('0x4c')][_0x1499('0xa2')][_0x1499('0xab')]())+_0x1499('0xb8'),_0x521fe8);}return _0x75e3e6;})[_0x1499('0x20')](function(){if(_0x175b9b[_0x1499('0x4c')]['channel']==='voice'){return db[_0x1499('0xb1')]['destroy']({'where':{'UserId':_0x175b9b['params']['id'],'VoiceQueueId':_0x175b9b[_0x1499('0x4c')][_0x1499('0x67')]},'individualHooks':!![]})[_0x1499('0x20')](function(){return _0x3e6187;});}return _0x3e6187;})[_0x1499('0x20')](respondWithStatusCode(_0x50a3b8,null))[_0x1499('0x2b')](handleError(_0x50a3b8,null));};exports[_0x1499('0xb9')]=function(_0x32663f,_0x181569){_0x32663f['body']['userpic']=_0x32663f[_0x1499('0xba')][_0x1499('0xbb')];return db[_0x1499('0x40')][_0x1499('0x3b')]({'where':{'id':_0x32663f[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x181569,null))['then'](saveUpdates(_0x32663f[_0x1499('0x63')],null))['then'](respondWithResult(_0x181569,null))[_0x1499('0x2b')](handleError(_0x181569,null));};exports['getAvatar']=function(_0x1a8f66,_0x308291){var _0x187c94=path[_0x1499('0xbc')](config[_0x1499('0xbd')],_0x1499('0xbe'));return db['User']['find']({'where':{'id':_0x1a8f66[_0x1499('0x64')]['id']},'attributes':['id',_0x1499('0xbf')],'raw':!![]})[_0x1499('0x20')](handleEntityNotFound(_0x308291,null))[_0x1499('0x20')](function(_0x28ff87){if(_0x28ff87){if(_[_0x1499('0x6e')](_0x28ff87[_0x1499('0xbf')])){return _0x308291[_0x1499('0xc0')](_0x187c94);}else{if(!fs['existsSync'](path[_0x1499('0xbc')](config[_0x1499('0xbd')],_0x1499('0xc1'),_0x28ff87[_0x1499('0xbf')]))){return _0x308291[_0x1499('0xc0')](_0x187c94);}return _0x308291['download'](path[_0x1499('0xbc')](config[_0x1499('0xbd')],_0x1499('0xc1'),_0x28ff87[_0x1499('0xbf')]));}}})['catch'](handleError(_0x308291,null));};exports[_0x1499('0xc2')]=function(_0x5302b4,_0x15508f){return db[_0x1499('0x40')]['find']({'where':{'id':_0x5302b4[_0x1499('0x64')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x15508f,null))['then'](function(_0x40b4d5){var _0x3d7de9=[];values=_0x40b4d5[_0x1499('0x58')];_0x3d7de9['push'](get_open_tabs(_0x1499('0xc3'),_0x40b4d5[_0x1499('0x58')]));_0x3d7de9[_0x1499('0x53')](get_open_tabs(_0x1499('0x59'),_0x40b4d5[_0x1499('0x58')]));_0x3d7de9[_0x1499('0x53')](get_open_tabs(_0x1499('0x5c'),_0x40b4d5[_0x1499('0x58')]));_0x3d7de9[_0x1499('0x53')](get_open_tabs(_0x1499('0x5d'),_0x40b4d5['dataValues']));_0x3d7de9['push'](get_open_tabs(_0x1499('0x5a'),_0x40b4d5[_0x1499('0x58')]));_0x3d7de9[_0x1499('0x53')](get_open_tabs('mail',_0x40b4d5[_0x1499('0x58')]));return Promise[_0x1499('0x61')](_0x3d7de9);})[_0x1499('0x20')](function(_0x36e718){if(_0x36e718){var _0x4d06df=_[_0x1499('0x42')](values[_0x1499('0xc4')],function(_0x1e38ae){return{'channel':_0x1499('0xc5'),'id':_0x1e38ae['id'],'createdAt':_0x1e38ae[_0x1499('0xc6')]};});var _0x4a6ced=_['map'](values[_0x1499('0xc7')],function(_0x57684e){return{'channel':_0x1499('0xc8'),'id':_0x57684e['id'],'createdAt':_0x57684e['createdAt']};});var _0x1f3601=_[_0x1499('0x42')](values['OpenchannelOpenTabs'],function(_0x434edb){return{'channel':_0x1499('0xc9'),'id':_0x434edb['id'],'createdAt':_0x434edb['createdAt']};});var _0x34fed0=_[_0x1499('0x42')](values[_0x1499('0xca')],function(_0x36a1aa){return{'channel':'MAIL','id':_0x36a1aa['id'],'createdAt':_0x36a1aa[_0x1499('0xc6')]};});var _0x1df885=_[_0x1499('0x42')](values[_0x1499('0xcb')],function(_0x7a80ff){return{'channel':'SMS','id':_0x7a80ff['id'],'createdAt':_0x7a80ff[_0x1499('0xc6')]};});var _0x2fcc49=_[_0x1499('0x42')](values['WhatsappOpenTabs'],function(_0x1dcf51){return{'channel':_0x1499('0xcc'),'id':_0x1dcf51['id'],'createdAt':_0x1dcf51[_0x1499('0xc6')]};});var _0x38e35d=_[_0x1499('0xcd')](_0x4d06df,_0x4a6ced,_0x1f3601,_0x34fed0,_0x1df885,_0x2fcc49);var _0x472410={'count':_0x38e35d[_0x1499('0x57')],'rows':_0x38e35d};return _0x472410;}else return null;})['then'](respondWithResult(_0x15508f,null))['catch'](handleError(_0x15508f,null));};exports['getContacts']=function(_0x12a17f,_0x41a049){var _0xc0fe7d={};return db['User']['findOne']({'where':{'id':_0x12a17f[_0x1499('0x64')]['id']}})['then'](function(_0x1e36e3){if(!_0x1e36e3){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x12a17f[_0x1499('0x64')]['id']));}return contacts[_0x1499('0x65')]();})[_0x1499('0x20')](function(_0x1b9a39){_0x12a17f['query'][_0x1499('0x40')]=_0x12a17f[_0x1499('0x64')]['id'];_0xc0fe7d=qs['getOptions'](_0x1b9a39,_0x12a17f);if(_0x12a17f['query'][_0x1499('0xce')](_0x1499('0x4d'))){_0xc0fe7d['include']=[{'model':db[_0x1499('0xcf')],'as':_0x1499('0xd0'),'required':![]},{'model':db[_0x1499('0xd1')],'as':_0x1499('0xd2'),'attributes':['id',_0x1499('0x3c'),_0x1499('0xd3')],'where':_0x12a17f['query'][_0x1499('0xd4')]?{'id':_0x12a17f[_0x1499('0x4c')][_0x1499('0xd4')]}:undefined,'required':_0x12a17f[_0x1499('0x4c')][_0x1499('0xd4')]?!![]:![]}];}return contacts[_0x1499('0x54')](_0x12a17f[_0x1499('0x4c')],_0x12a17f[_0x1499('0x33')],_0xc0fe7d,_0x1b9a39);})[_0x1499('0x20')](respondWithFilteredResult(_0x41a049,_0xc0fe7d))['catch'](APIHandleError(_0x41a049));};exports[_0x1499('0xd5')]=function(_0x59e1b6,_0x2d1211){var _0x559b20;var _0x42074a={};var _0x240c7a;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x59e1b6[_0x1499('0x64')]['id']},'attributes':['id',_0x1499('0x3c'),'role']})[_0x1499('0x20')](handleEntityNotFound(_0x2d1211,null))[_0x1499('0x20')](function(_0x39cf99){if(!utils[_0x1499('0xa7')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xa2')])){throw new db[(_0x1499('0x97'))][(_0x1499('0x98'))](_0x1499('0xb3'));}_0x559b20=_0x39cf99;var _0x4b6e82={};_0x4b6e82['model']=_[_0x1499('0xd6')](db[_[_0x1499('0xa8')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xa2')])+_0x1499('0xd7')][_0x1499('0x41')]);_0x4b6e82[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x59e1b6[_0x1499('0x4c')]);_0x4b6e82['filters']=_['intersection'](_0x4b6e82[_0x1499('0xd8')],_0x4b6e82['query']);_0x42074a[_0x1499('0x52')]=_['intersection'](_0x4b6e82['model'],qs['fields'](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xd9')]));_0x42074a['attributes']=_0x42074a[_0x1499('0x52')][_0x1499('0x57')]?_0x42074a[_0x1499('0x52')]:_0x4b6e82['model'];_0x42074a[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xdb')]);_0x42074a[_0x1499('0xdc')]=qs['filters'](_[_0x1499('0xdd')](_0x59e1b6['query'],_0x4b6e82[_0x1499('0xde')]));if(_0x59e1b6[_0x1499('0x4c')][_0x1499('0x37')]){_0x42074a[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x42074a[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x42074a[_0x1499('0x52')],function(_0x47d313){var _0x387808={};_0x387808[_0x47d313]={'$like':'%'+_0x59e1b6['query'][_0x1499('0x37')]+'%'};return _0x387808;})});}_0x42074a=_['merge']({},_0x42074a,_0x59e1b6[_0x1499('0x60')]);switch(_0x559b20[_0x1499('0x2c')]){case _0x1499('0x31'):return db[_[_0x1499('0xa8')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xa2')])+_0x1499('0xd7')][_0x1499('0x54')](_0x42074a);case _0x1499('0x33'):case'agent':return _0x559b20[_0x1499('0xae')+_['capitalize'](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xa2')])+'Queues'](_0x42074a);default:throw new db[(_0x1499('0x97'))][(_0x1499('0x98'))]('Unknown\x20role');}})[_0x1499('0x20')](function(_0x41443f){_0x240c7a=_0x41443f['length'];if(!_0x59e1b6[_0x1499('0x4c')]['hasOwnProperty'](_0x1499('0xdf'))){_0x42074a[_0x1499('0x1a')]=qs['limit'](_0x59e1b6['query'][_0x1499('0x1a')]);_0x42074a[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0x19')]);}switch(_0x559b20[_0x1499('0x2c')]){case'admin':return db[_[_0x1499('0xa8')](_0x59e1b6['query'][_0x1499('0xa2')])+_0x1499('0xd7')]['findAll'](_0x42074a);case _0x1499('0x33'):case'agent':return _0x559b20[_0x1499('0xae')+_[_0x1499('0xa8')](_0x59e1b6[_0x1499('0x4c')][_0x1499('0xa2')])+_0x1499('0xb5')](_0x42074a);}})['then'](function(_0x22b1ed){return{'count':_0x240c7a,'rows':_0x22b1ed};})[_0x1499('0x20')](respondWithResult(_0x2d1211,null))[_0x1499('0x2b')](handleError(_0x2d1211,null));};exports['getVoiceQueuesRt']=function(_0x343b65,_0x35ee79){var _0x191075={};var _0x3fc165={};var _0x52cc6e;var _0x106726;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x343b65[_0x1499('0x64')]['id']}})['then'](handleEntityNotFound(_0x35ee79,null))[_0x1499('0x20')](function(_0x200eed){if(_0x200eed){_0x52cc6e=_0x200eed;_0x3fc165[_0x1499('0xd8')]=_[_0x1499('0xd6')](db[_0x1499('0xb1')]['rawAttributes']);_0x3fc165[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x343b65[_0x1499('0x4c')]);_0x3fc165[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x3fc165[_0x1499('0xd8')],_0x3fc165[_0x1499('0x4c')]);_0x191075[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x3fc165[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x343b65[_0x1499('0x4c')]['fields']));_0x191075[_0x1499('0x52')]=_0x191075[_0x1499('0x52')][_0x1499('0x57')]?_0x191075[_0x1499('0x52')]:_0x3fc165['model'];_0x191075[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x343b65[_0x1499('0x4c')][_0x1499('0xdb')]);_0x191075['where']=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x343b65[_0x1499('0x4c')],_0x3fc165['filters']));if(_0x343b65[_0x1499('0x4c')]['filter']){_0x191075[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x191075['where'],{'$or':_[_0x1499('0x42')](_0x191075[_0x1499('0x52')],function(_0x5c7f0d){var _0x2f6529={};_0x2f6529[_0x5c7f0d]={'$like':'%'+_0x343b65[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x2f6529;})});}_0x191075=_['merge']({},_0x191075,_0x343b65[_0x1499('0x60')]);return _0x52cc6e[_0x1499('0xe1')](_0x191075);}})['then'](function(_0x531ac0){if(_0x531ac0){_0x106726=_0x531ac0[_0x1499('0x57')];if(!_0x343b65['query'][_0x1499('0xce')](_0x1499('0xdf'))){_0x191075[_0x1499('0x1a')]=qs['limit'](_0x343b65['query']['limit']);_0x191075[_0x1499('0x19')]=qs['offset'](_0x343b65[_0x1499('0x4c')][_0x1499('0x19')]);}return _0x52cc6e[_0x1499('0xe1')](_0x191075);}})['then'](function(_0x1c5691){if(_0x1c5691){return _0x1c5691?{'count':_0x106726,'rows':_0x1c5691}:null;}})[_0x1499('0x20')](respondWithResult(_0x35ee79,null))[_0x1499('0x2b')](handleError(_0x35ee79,null));};exports[_0x1499('0xe2')]=function(_0x55c7e9,_0x316810){var _0x3f697e={};var _0x1644ec={};var _0x4e79e1;var _0x4d7c7a;return db['User'][_0x1499('0x9c')]({'where':{'id':_0x55c7e9[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x316810,null))['then'](function(_0x4a6894){if(_0x4a6894){_0x4e79e1=_0x4a6894;_0x1644ec[_0x1499('0xd8')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x1644ec['query']=_['keys'](_0x55c7e9[_0x1499('0x4c')]);_0x1644ec[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x1644ec[_0x1499('0xd8')],_0x1644ec['query']);_0x3f697e[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x1644ec[_0x1499('0xd8')],qs['fields'](_0x55c7e9[_0x1499('0x4c')][_0x1499('0xd9')]));_0x3f697e[_0x1499('0x52')]=_0x3f697e['attributes'][_0x1499('0x57')]?_0x3f697e[_0x1499('0x52')]:_0x1644ec[_0x1499('0xd8')];_0x3f697e['order']=qs[_0x1499('0xdb')](_0x55c7e9[_0x1499('0x4c')][_0x1499('0xdb')]);_0x3f697e[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x55c7e9['query'],_0x1644ec[_0x1499('0xde')]));if(_0x55c7e9[_0x1499('0x4c')][_0x1499('0x37')]){_0x3f697e[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x3f697e[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x3f697e[_0x1499('0x52')],function(_0x1a8e23){var _0x4f6a1e={};_0x4f6a1e[_0x1a8e23]={'$like':'%'+_0x55c7e9[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x4f6a1e;})});}_0x3f697e=_[_0x1499('0x5f')]({},_0x3f697e,_0x55c7e9[_0x1499('0x60')]);return _0x4e79e1[_0x1499('0xe2')](_0x3f697e);}})['then'](function(_0x4511e8){if(_0x4511e8){_0x4d7c7a=_0x4511e8[_0x1499('0x57')];if(!_0x55c7e9[_0x1499('0x4c')]['hasOwnProperty']('nolimit')){_0x3f697e[_0x1499('0x1a')]=qs['limit'](_0x55c7e9[_0x1499('0x4c')]['limit']);_0x3f697e['offset']=qs['offset'](_0x55c7e9['query'][_0x1499('0x19')]);}return _0x4e79e1[_0x1499('0xe2')](_0x3f697e);}})['then'](function(_0x9e856f){if(_0x9e856f){return _0x9e856f?{'count':_0x4d7c7a,'rows':_0x9e856f}:null;}})[_0x1499('0x20')](respondWithResult(_0x316810,null))['catch'](handleError(_0x316810,null));};exports[_0x1499('0xe3')]=function(_0x26827e,_0x10646e){var _0x3433da={'raw':!![],'where':{}};var _0x454f48={};var _0x235e53={'count':0x0,'rows':[]};return db['User'][_0x1499('0x9c')]({'where':{'id':_0x26827e[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x10646e,null))['then'](function(_0x51c85c){if(_0x51c85c){_0x454f48[_0x1499('0xd8')]=_['keys'](db[_0x1499('0xe4')][_0x1499('0x41')]);_0x454f48[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x26827e[_0x1499('0x4c')]);_0x454f48[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x454f48['model'],_0x454f48[_0x1499('0x4c')]);_0x3433da['attributes']=_['intersection'](_0x454f48['model'],qs['fields'](_0x26827e['query'][_0x1499('0xd9')]));_0x3433da[_0x1499('0x52')]=_0x3433da[_0x1499('0x52')][_0x1499('0x57')]?_0x3433da['attributes']:_0x454f48[_0x1499('0xd8')];if(!_0x26827e[_0x1499('0x4c')][_0x1499('0xce')]('nolimit')){_0x3433da[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x26827e[_0x1499('0x4c')][_0x1499('0x1a')]);_0x3433da[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x26827e[_0x1499('0x4c')]['offset']);}_0x3433da['order']=qs['sort'](_0x26827e['query'][_0x1499('0xdb')]);_0x3433da[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x26827e[_0x1499('0x4c')],_0x454f48[_0x1499('0xde')]));_0x3433da[_0x1499('0xdc')][_0x1499('0xe5')]=_0x51c85c['id'];if(_0x26827e[_0x1499('0x4c')]['filter']){_0x3433da[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x3433da[_0x1499('0xdc')],{'$or':_['map'](_0x3433da[_0x1499('0x52')],function(_0x5116de){var _0x306e9a={};_0x306e9a[_0x5116de]={'$like':'%'+_0x26827e[_0x1499('0x4c')]['filter']+'%'};return _0x306e9a;})});}_0x3433da=_['merge']({},_0x3433da,_0x26827e[_0x1499('0x60')]);return db[_0x1499('0xe4')][_0x1499('0x1c')]({'where':_0x3433da[_0x1499('0xdc')]})[_0x1499('0x20')](function(_0x15130f){_0x235e53[_0x1499('0x1c')]=_0x15130f;if(_0x26827e[_0x1499('0x4c')][_0x1499('0x4d')]){_0x3433da[_0x1499('0x4e')]=[{'all':!![]}];}return db[_0x1499('0xe4')][_0x1499('0x54')](_0x3433da);})[_0x1499('0x20')](function(_0x3818ee){_0x235e53['rows']=_0x3818ee;return _0x235e53;});}})['then'](respondWithFilteredResult(_0x10646e,_0x3433da))['catch'](handleError(_0x10646e,null));};exports[_0x1499('0xe6')]=function(_0x9f970b,_0x16495b){var _0x1c0697={'raw':!![],'where':{}};var _0x318f08={};var _0x441cf4={'count':0x0,'rows':[]};return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x9f970b['params']['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x16495b,null))[_0x1499('0x20')](function(_0x2bf5c4){if(_0x2bf5c4){_0x318f08[_0x1499('0xd8')]=_[_0x1499('0xd6')](db[_0x1499('0xe7')][_0x1499('0x41')]);_0x318f08[_0x1499('0x4c')]=_['keys'](_0x9f970b['query']);_0x318f08[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x318f08[_0x1499('0xd8')],_0x318f08[_0x1499('0x4c')]);_0x1c0697[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x318f08[_0x1499('0xd8')],qs['fields'](_0x9f970b['query'][_0x1499('0xd9')]));_0x1c0697[_0x1499('0x52')]=_0x1c0697['attributes'][_0x1499('0x57')]?_0x1c0697[_0x1499('0x52')]:_0x318f08['model'];if(!_0x9f970b['query'][_0x1499('0xce')]('nolimit')){_0x1c0697[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x9f970b['query']['limit']);_0x1c0697[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x9f970b[_0x1499('0x4c')][_0x1499('0x19')]);}_0x1c0697['order']=qs[_0x1499('0xdb')](_0x9f970b[_0x1499('0x4c')]['sort']);_0x1c0697[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x9f970b[_0x1499('0x4c')],_0x318f08[_0x1499('0xde')]));_0x1c0697[_0x1499('0xdc')][_0x1499('0xe5')]=_0x2bf5c4['id'];if(_0x9f970b['query'][_0x1499('0x37')]){_0x1c0697[_0x1499('0xdc')]=_['merge'](_0x1c0697['where'],{'$or':_[_0x1499('0x42')](_0x1c0697[_0x1499('0x52')],function(_0x6def2c){var _0x3cb318={};_0x3cb318[_0x6def2c]={'$like':'%'+_0x9f970b[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x3cb318;})});}_0x1c0697=_[_0x1499('0x5f')]({},_0x1c0697,_0x9f970b[_0x1499('0x60')]);return db['ScreenRecording'][_0x1499('0x1c')]({'where':_0x1c0697[_0x1499('0xdc')]})[_0x1499('0x20')](function(_0x50897c){_0x441cf4[_0x1499('0x1c')]=_0x50897c;if(_0x9f970b[_0x1499('0x4c')]['includeAll']){_0x1c0697['include']=[{'all':!![]}];}return db[_0x1499('0xe7')][_0x1499('0x54')](_0x1c0697);})[_0x1499('0x20')](function(_0x361968){_0x441cf4[_0x1499('0x55')]=_0x361968;return _0x441cf4;});}})[_0x1499('0x20')](respondWithFilteredResult(_0x16495b,_0x1c0697))[_0x1499('0x2b')](handleError(_0x16495b,null));};exports[_0x1499('0xe8')]=function(_0x19471b,_0x7f3953){var _0x23612d={};var _0x10a7d0={};var _0x315083;var _0x55d15c;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x19471b[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x7f3953,null))[_0x1499('0x20')](function(_0x5b28b9){if(_0x5b28b9){_0x315083=_0x5b28b9;_0x10a7d0[_0x1499('0xd8')]=_[_0x1499('0xd6')](db[_0x1499('0xe9')][_0x1499('0x41')]);_0x10a7d0[_0x1499('0x4c')]=_['keys'](_0x19471b[_0x1499('0x4c')]);_0x10a7d0[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x10a7d0['model'],_0x10a7d0['query']);_0x23612d['attributes']=_[_0x1499('0xe0')](_0x10a7d0['model'],qs[_0x1499('0xd9')](_0x19471b[_0x1499('0x4c')]['fields']));_0x23612d[_0x1499('0x52')]=_0x23612d[_0x1499('0x52')][_0x1499('0x57')]?_0x23612d[_0x1499('0x52')]:_0x10a7d0[_0x1499('0xd8')];_0x23612d[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x19471b['query']['sort']);_0x23612d[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x19471b[_0x1499('0x4c')],_0x10a7d0[_0x1499('0xde')]));if(_0x19471b[_0x1499('0x4c')][_0x1499('0x37')]){_0x23612d[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x23612d['where'],{'$or':_[_0x1499('0x42')](_0x23612d[_0x1499('0x52')],function(_0x4b281b){var _0x5514dc={};_0x5514dc[_0x4b281b]={'$like':'%'+_0x19471b['query'][_0x1499('0x37')]+'%'};return _0x5514dc;})});}_0x23612d=_[_0x1499('0x5f')]({},_0x23612d,_0x19471b[_0x1499('0x60')]);return _0x315083[_0x1499('0xe8')](_0x23612d);}})[_0x1499('0x20')](function(_0x3761e6){if(_0x3761e6){_0x55d15c=_0x3761e6['length'];if(!_0x19471b['query']['hasOwnProperty'](_0x1499('0xdf'))){_0x23612d[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x19471b['query'][_0x1499('0x1a')]);_0x23612d[_0x1499('0x19')]=qs['offset'](_0x19471b['query'][_0x1499('0x19')]);}return _0x315083[_0x1499('0xe8')](_0x23612d);}})[_0x1499('0x20')](function(_0x297e84){if(_0x297e84){return _0x297e84?{'count':_0x55d15c,'rows':_0x297e84}:null;}})[_0x1499('0x20')](respondWithResult(_0x7f3953,null))[_0x1499('0x2b')](handleError(_0x7f3953,null));};exports[_0x1499('0xea')]=function(_0x4bd5a5,_0xda9705){var _0x2e6244={};var _0x447d82={};var _0x28e6c2;var _0x30cf2a;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x4bd5a5['params']['id']}})[_0x1499('0x20')](handleEntityNotFound(_0xda9705,null))[_0x1499('0x20')](function(_0x26d4e2){if(_0x26d4e2){_0x28e6c2=_0x26d4e2;_0x447d82['model']=_['keys'](db[_0x1499('0xeb')][_0x1499('0x41')]);_0x447d82[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x4bd5a5[_0x1499('0x4c')]);_0x447d82['filters']=_[_0x1499('0xe0')](_0x447d82[_0x1499('0xd8')],_0x447d82[_0x1499('0x4c')]);_0x2e6244[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x447d82[_0x1499('0xd8')],qs['fields'](_0x4bd5a5[_0x1499('0x4c')]['fields']));_0x2e6244[_0x1499('0x52')]=_0x2e6244[_0x1499('0x52')][_0x1499('0x57')]?_0x2e6244['attributes']:_0x447d82[_0x1499('0xd8')];_0x2e6244['order']=qs[_0x1499('0xdb')](_0x4bd5a5[_0x1499('0x4c')][_0x1499('0xdb')]);_0x2e6244[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x4bd5a5[_0x1499('0x4c')],_0x447d82[_0x1499('0xde')]));if(_0x4bd5a5[_0x1499('0x4c')][_0x1499('0x37')]){_0x2e6244[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x2e6244[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x2e6244['attributes'],function(_0x1f2e96){var _0xe50043={};_0xe50043[_0x1f2e96]={'$like':'%'+_0x4bd5a5['query'][_0x1499('0x37')]+'%'};return _0xe50043;})});}_0x2e6244=_[_0x1499('0x5f')]({},_0x2e6244,_0x4bd5a5['options']);return _0x28e6c2['getOpenchannelInteractions'](_0x2e6244);}})['then'](function(_0x1cec8b){if(_0x1cec8b){_0x30cf2a=_0x1cec8b[_0x1499('0x57')];if(!_0x4bd5a5['query'][_0x1499('0xce')](_0x1499('0xdf'))){_0x2e6244[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x4bd5a5[_0x1499('0x4c')][_0x1499('0x1a')]);_0x2e6244['offset']=qs[_0x1499('0x19')](_0x4bd5a5[_0x1499('0x4c')][_0x1499('0x19')]);}return _0x28e6c2['getOpenchannelInteractions'](_0x2e6244);}})['then'](function(_0x27d9a4){if(_0x27d9a4){return _0x27d9a4?{'count':_0x30cf2a,'rows':_0x27d9a4}:null;}})[_0x1499('0x20')](respondWithResult(_0xda9705,null))[_0x1499('0x2b')](handleError(_0xda9705,null));};exports[_0x1499('0xec')]=function(_0x5517e0,_0x2bb2e9){var _0x576b50={'raw':!![],'where':{}};var _0x447364={};var _0x1a08fc={'count':0x0,'rows':[]};return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x5517e0[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x2bb2e9,null))[_0x1499('0x20')](function(_0x35ce24){if(_0x35ce24){_0x447364[_0x1499('0xd8')]=_[_0x1499('0xd6')](db[_0x1499('0xed')][_0x1499('0x41')]);_0x447364[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x5517e0[_0x1499('0x4c')]);_0x447364[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x447364[_0x1499('0xd8')],_0x447364[_0x1499('0x4c')]);_0x576b50[_0x1499('0x52')]=_['intersection'](_0x447364[_0x1499('0xd8')],qs['fields'](_0x5517e0['query'][_0x1499('0xd9')]));_0x576b50[_0x1499('0x52')]=_0x576b50[_0x1499('0x52')]['length']?_0x576b50[_0x1499('0x52')]:_0x447364[_0x1499('0xd8')];if(!_0x5517e0['query'][_0x1499('0xce')](_0x1499('0xdf'))){_0x576b50[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x5517e0[_0x1499('0x4c')][_0x1499('0x1a')]);_0x576b50[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x5517e0[_0x1499('0x4c')][_0x1499('0x19')]);}_0x576b50[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x5517e0[_0x1499('0x4c')][_0x1499('0xdb')]);_0x576b50['where']=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x5517e0[_0x1499('0x4c')],_0x447364[_0x1499('0xde')]));_0x576b50[_0x1499('0xdc')][_0x1499('0xe5')]=_0x35ce24['id'];if(_0x5517e0['query']['filter']){_0x576b50[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x576b50[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x576b50[_0x1499('0x52')],function(_0x15f9cb){var _0x519c83={};_0x519c83[_0x15f9cb]={'$like':'%'+_0x5517e0[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x519c83;})});}_0x576b50=_[_0x1499('0x5f')]({},_0x576b50,_0x5517e0[_0x1499('0x60')]);return db[_0x1499('0xed')][_0x1499('0x1c')]({'where':_0x576b50[_0x1499('0xdc')]})[_0x1499('0x20')](function(_0x5cf097){_0x1a08fc[_0x1499('0x1c')]=_0x5cf097;if(_0x5517e0[_0x1499('0x4c')]['includeAll']){_0x576b50['include']=[{'all':!![]}];}return db[_0x1499('0xed')]['findAll'](_0x576b50);})['then'](function(_0x49e8c8){_0x1a08fc[_0x1499('0x55')]=_0x49e8c8;return _0x1a08fc;});}})[_0x1499('0x20')](respondWithFilteredResult(_0x2bb2e9,_0x576b50))[_0x1499('0x2b')](handleError(_0x2bb2e9,null));};exports[_0x1499('0xee')]=function(_0x37b001,_0x2d133a){var _0x3f83f4={};var _0x73b8e5={};var _0x26757b;var _0x3b927e;return db[_0x1499('0x40')]['findOne']({'where':{'id':_0x37b001[_0x1499('0x64')]['id']}})['then'](handleEntityNotFound(_0x2d133a,null))[_0x1499('0x20')](function(_0x45be4d){if(_0x45be4d){_0x26757b=_0x45be4d;_0x73b8e5[_0x1499('0xd8')]=_['keys'](db[_0x1499('0xef')]['rawAttributes']);_0x73b8e5[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x37b001[_0x1499('0x4c')]);_0x73b8e5[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x73b8e5[_0x1499('0xd8')],_0x73b8e5[_0x1499('0x4c')]);_0x3f83f4[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x73b8e5[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x37b001['query'][_0x1499('0xd9')]));_0x3f83f4[_0x1499('0x52')]=_0x3f83f4['attributes']['length']?_0x3f83f4['attributes']:_0x73b8e5[_0x1499('0xd8')];_0x3f83f4[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x37b001['query'][_0x1499('0xdb')]);_0x3f83f4['where']=qs['filters'](_['pick'](_0x37b001['query'],_0x73b8e5['filters']));if(_0x37b001[_0x1499('0x4c')][_0x1499('0x37')]){_0x3f83f4[_0x1499('0xdc')]=_['merge'](_0x3f83f4['where'],{'$or':_[_0x1499('0x42')](_0x3f83f4[_0x1499('0x52')],function(_0x2a576e){var _0x32cc71={};_0x32cc71[_0x2a576e]={'$like':'%'+_0x37b001['query'][_0x1499('0x37')]+'%'};return _0x32cc71;})});}_0x3f83f4=_[_0x1499('0x5f')]({},_0x3f83f4,_0x37b001[_0x1499('0x60')]);return _0x26757b[_0x1499('0xee')](_0x3f83f4);}})[_0x1499('0x20')](function(_0x47048f){if(_0x47048f){_0x3b927e=_0x47048f[_0x1499('0x57')];if(!_0x37b001[_0x1499('0x4c')][_0x1499('0xce')]('nolimit')){_0x3f83f4[_0x1499('0x1a')]=qs['limit'](_0x37b001[_0x1499('0x4c')]['limit']);_0x3f83f4[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x37b001[_0x1499('0x4c')][_0x1499('0x19')]);}return _0x26757b['getSmsInteractions'](_0x3f83f4);}})[_0x1499('0x20')](function(_0x3b9ce3){if(_0x3b9ce3){return _0x3b9ce3?{'count':_0x3b927e,'rows':_0x3b9ce3}:null;}})[_0x1499('0x20')](respondWithResult(_0x2d133a,null))[_0x1499('0x2b')](handleError(_0x2d133a,null));};exports[_0x1499('0xf0')]=function(_0x36fce9,_0x494e3c){var _0x318216={};var _0x462949={};var _0x26907f;var _0xff4c3a;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x36fce9['params']['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x494e3c,null))[_0x1499('0x20')](function(_0x4acb4c){if(_0x4acb4c){_0x26907f=_0x4acb4c;_0x462949['model']=_['keys'](db[_0x1499('0xf1')][_0x1499('0x41')]);_0x462949[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x36fce9[_0x1499('0x4c')]);_0x462949[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x462949['model'],_0x462949[_0x1499('0x4c')]);_0x318216[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x462949[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x36fce9[_0x1499('0x4c')][_0x1499('0xd9')]));_0x318216['attributes']=_0x318216[_0x1499('0x52')][_0x1499('0x57')]?_0x318216[_0x1499('0x52')]:_0x462949['model'];_0x318216['order']=qs[_0x1499('0xdb')](_0x36fce9['query'][_0x1499('0xdb')]);_0x318216[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x36fce9[_0x1499('0x4c')],_0x462949[_0x1499('0xde')]));if(_0x36fce9['query'][_0x1499('0x37')]){_0x318216[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x318216['where'],{'$or':_[_0x1499('0x42')](_0x318216[_0x1499('0x52')],function(_0xe8971f){var _0x3494d1={};_0x3494d1[_0xe8971f]={'$like':'%'+_0x36fce9[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x3494d1;})});}_0x318216=_[_0x1499('0x5f')]({},_0x318216,_0x36fce9[_0x1499('0x60')]);return _0x26907f[_0x1499('0xf0')](_0x318216);}})['then'](function(_0x315c11){if(_0x315c11){_0xff4c3a=_0x315c11[_0x1499('0x57')];if(!_0x36fce9[_0x1499('0x4c')]['hasOwnProperty'](_0x1499('0xdf'))){_0x318216[_0x1499('0x1a')]=qs['limit'](_0x36fce9[_0x1499('0x4c')][_0x1499('0x1a')]);_0x318216[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x36fce9[_0x1499('0x4c')]['offset']);}return _0x26907f[_0x1499('0xf0')](_0x318216);}})[_0x1499('0x20')](function(_0x4bcc1f){if(_0x4bcc1f){return _0x4bcc1f?{'count':_0xff4c3a,'rows':_0x4bcc1f}:null;}})[_0x1499('0x20')](respondWithResult(_0x494e3c,null))[_0x1499('0x2b')](handleError(_0x494e3c,null));};exports[_0x1499('0xf2')]=function(_0x550b4a,_0x2e5dc9){var _0x45d01e={};var _0x3ad7c0={};var _0x1b87bc;var _0x3a63ea;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x550b4a[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x2e5dc9,null))[_0x1499('0x20')](function(_0x14e4a0){if(_0x14e4a0){_0x1b87bc=_0x14e4a0;_0x3ad7c0[_0x1499('0xd8')]=_[_0x1499('0xd6')](db[_0x1499('0xf3')]['rawAttributes']);_0x3ad7c0[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x550b4a[_0x1499('0x4c')]);_0x3ad7c0['filters']=_['intersection'](_0x3ad7c0[_0x1499('0xd8')],_0x3ad7c0[_0x1499('0x4c')]);_0x45d01e['attributes']=_['intersection'](_0x3ad7c0[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x550b4a[_0x1499('0x4c')][_0x1499('0xd9')]));_0x45d01e[_0x1499('0x52')]=_0x45d01e[_0x1499('0x52')][_0x1499('0x57')]?_0x45d01e[_0x1499('0x52')]:_0x3ad7c0['model'];_0x45d01e[_0x1499('0xda')]=qs['sort'](_0x550b4a['query'][_0x1499('0xdb')]);_0x45d01e[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x550b4a[_0x1499('0x4c')],_0x3ad7c0[_0x1499('0xde')]));if(_0x550b4a['query'][_0x1499('0x37')]){_0x45d01e[_0x1499('0xdc')]=_['merge'](_0x45d01e[_0x1499('0xdc')],{'$or':_['map'](_0x45d01e['attributes'],function(_0x5b208a){var _0x503a76={};_0x503a76[_0x5b208a]={'$like':'%'+_0x550b4a['query']['filter']+'%'};return _0x503a76;})});}_0x45d01e=_[_0x1499('0x5f')]({},_0x45d01e,_0x550b4a[_0x1499('0x60')]);return _0x1b87bc[_0x1499('0xf2')](_0x45d01e);}})['then'](function(_0x4642e6){if(_0x4642e6){_0x3a63ea=_0x4642e6[_0x1499('0x57')];if(!_0x550b4a[_0x1499('0x4c')]['hasOwnProperty'](_0x1499('0xdf'))){_0x45d01e[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x550b4a[_0x1499('0x4c')]['limit']);_0x45d01e[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x550b4a[_0x1499('0x4c')]['offset']);}return _0x1b87bc[_0x1499('0xf2')](_0x45d01e);}})[_0x1499('0x20')](function(_0x1f1bed){if(_0x1f1bed){return _0x1f1bed?{'count':_0x3a63ea,'rows':_0x1f1bed}:null;}})[_0x1499('0x20')](respondWithResult(_0x2e5dc9,null))['catch'](handleError(_0x2e5dc9,null));};exports['login']=function(_0x34ecc4,_0x6b4758,_0x303b2d){var _0x5d5d56;var _0x4352d0;var _0x415220;var _0x3db20b=!_[_0x1499('0x6e')](_0x34ecc4[_0x1499('0x64')]['id'])?_0x34ecc4[_0x1499('0x64')]['id']:!_[_0x1499('0x6e')](_0x34ecc4[_0x1499('0x33')]['id'])?_0x34ecc4['user']['id']:null;return db[_0x1499('0x40')]['find']({'where':{'id':_0x3db20b,'role':{'$or':[_0x1499('0x31'),_0x1499('0x33'),_0x1499('0x2d')]}},'attributes':['id',_0x1499('0x3c'),_0x1499('0xf4'),_0x1499('0xf5'),_0x1499('0x2c'),_0x1499('0x69'),_0x1499('0xa4')]})[_0x1499('0x20')](function(_0x9cdf6e){if(_0x9cdf6e){if(_0x9cdf6e[_0x1499('0x2c')]===_0x1499('0x2d')){_0x5d5d56=_0x9cdf6e;if(_0x34ecc4[_0x1499('0x63')][_0x1499('0xa6')]){_0x415220=util[_0x1499('0xb0')](_0x1499('0xf6'),_0x5d5d56[_0x34ecc4['body'][_0x1499('0xa6')]]);}else if(_0x34ecc4[_0x1499('0x63')][_0x1499('0xf7')]){_0x415220=util[_0x1499('0xb0')]('SIP/%s',_0x34ecc4[_0x1499('0x63')][_0x1499('0xf7')]);}else{_0x415220=util[_0x1499('0xb0')](_0x1499('0xf8'),_0x5d5d56[_0x1499('0x3c')]);}socket['to'](util[_0x1499('0xb0')](_0x1499('0xf9'),_0x5d5d56[_0x1499('0x3c')]))[_0x1499('0x2e')](_0x1499('0xfa'),{'user':{'id':_0x5d5d56['id'],'name':_0x5d5d56['name']},'ip':_0x34ecc4[_0x1499('0xfb')][_0x1499('0xfc')]||_0x34ecc4[_0x1499('0xfd')][_0x1499('0xfe')]||_0x34ecc4['socket'][_0x1499('0xfe')]||_0x34ecc4[_0x1499('0xfd')][_0x1499('0xff')][_0x1499('0xfe')]});return db[_0x1499('0xb1')][_0x1499('0x30')]({'where':{'membername':_0x5d5d56['name']},'individualHooks':!![]});}}else{throw new db[(_0x1499('0x97'))]['ValidationError'](_0x1499('0x100'));}})[_0x1499('0x20')](function(){if(_0x5d5d56){return _0x5d5d56[_0x1499('0x101')]({'raw':!![]});}})[_0x1499('0x20')](function(_0x3fbcbc){if(_0x5d5d56){if(_0x3fbcbc){_0x4352d0=_0x3fbcbc;if(_0x4352d0['length']){var _0xc9d8ec=_0x4352d0['map'](function(_0x3a3fb7){var _0x16d6c3={'membername':_0x5d5d56[_0x1499('0x3c')],'UserId':_0x5d5d56['id'],'queue_name':_0x3a3fb7[_0x1499('0x3c')],'VoiceQueueId':_0x3a3fb7['id'],'interface':_0x415220,'paused':_0x5d5d56[_0x1499('0xa4')]||![],'penalty':_0x3a3fb7['UserVoiceQueue.penalty']||0x0};return db[_0x1499('0xb1')]['upsert'](_0x16d6c3);});return Promise['all'](_0xc9d8ec);}}}})[_0x1499('0x20')](function(){if(_0x5d5d56){return db[_0x1499('0x102')][_0x1499('0x54')]({'where':{'membername':_0x5d5d56[_0x1499('0x3c')],'exitAt':null}});}})['then'](function(_0x3dd411){if(_0x5d5d56){var _0x5d962b=[];_0x3dd411[_0x1499('0x103')](function(_0x4af7cf){_0x5d962b['push'](_0x4af7cf[_0x1499('0x62')]({'exitAt':moment()['format'](_0x1499('0x104'))}));});return Promise['all'](_0x5d962b);}})[_0x1499('0x20')](function(){if(_0x5d5d56){var _0x27ea54=[];var _0x2d7b21=[];var _0x436384=utils[_0x1499('0x105')]();var _0x318346={'membername':_0x5d5d56[_0x1499('0x3c')],'interface':_0x415220,'enterAt':moment()[_0x1499('0xb0')](_0x1499('0x104')),'role':_0x5d5d56['role'],'internal':_0x5d5d56['internal']};_0x436384[_0x1499('0x103')](function(_0x2b117d){_0x27ea54['push'](_[_0x1499('0x5f')]({'channel':_0x2b117d,'type':_0x1499('0x106'),'data1':_0x34ecc4['body'][_0x1499('0x107')],'data2':_0x415220},_0x318346));if(_0x5d5d56['loginInPause']){_0x2d7b21[_0x1499('0x53')](_[_0x1499('0x5f')]({'channel':_0x2b117d,'type':_0x1499('0x108'),'data1':_0x1499('0x109')},_0x318346));}});return db[_0x1499('0x102')][_0x1499('0x8c')](_0x27ea54[_0x1499('0xcd')](_0x2d7b21),{'individualHooks':!![]});}})['then'](function(){if(_0x5d5d56){return _0x5d5d56[_0x1499('0x62')]({'online':!![],'lastLoginAt':moment()[_0x1499('0xb0')](_0x1499('0x104')),'voicePause':_0x5d5d56[_0x1499('0xa4')]||![],'mailPause':_0x5d5d56['loginInPause']||![],'chatPause':_0x5d5d56[_0x1499('0xa4')]||![],'faxPause':_0x5d5d56[_0x1499('0xa4')]||![],'smsPause':_0x5d5d56[_0x1499('0xa4')]||![],'openchannelPause':_0x5d5d56['loginInPause']||![],'whatsappPause':_0x5d5d56[_0x1499('0xa4')]||![],'pauseType':_0x5d5d56[_0x1499('0xa4')]?_0x1499('0x109'):null,'interface':_0x415220,'lastPauseAt':moment()[_0x1499('0xb0')](_0x1499('0x104'))});}})[_0x1499('0x20')](function(_0x41d785){if(_0x34ecc4[_0x1499('0x10a')]){return _0x303b2d();}else{return Promise['resolve'](_0x41d785)['then'](respondWithResult(_0x6b4758,null));}})[_0x1499('0x2b')](handleError(_0x6b4758,null));};exports[_0x1499('0x10b')]=function(_0x41dbd6,_0x269e1c){var _0xac593e;return db['User'][_0x1499('0x3b')]({'where':{'id':_0x41dbd6[_0x1499('0x64')]['id'],'role':_0x1499('0x2d')},'attributes':['id','name',_0x1499('0x2c')]})[_0x1499('0x20')](handleEntityNotFound(_0x269e1c,null))[_0x1499('0x20')](function(_0x2f9c55){if(_0x2f9c55){_0xac593e=_0x2f9c55;return db[_0x1499('0xb1')][_0x1499('0x30')]({'where':{'membername':_0xac593e['name']},'individualHooks':!![]});}})[_0x1499('0x20')](function(){return db[_0x1499('0x102')][_0x1499('0x54')]({'where':{'membername':_0xac593e[_0x1499('0x3c')],'exitAt':null}});})[_0x1499('0x20')](function(_0xa9fd30){var _0x3251d9=[];_0xa9fd30['forEach'](function(_0x2075af){_0x3251d9[_0x1499('0x53')](_0x2075af[_0x1499('0x62')]({'exitAt':moment()['format'](_0x1499('0x104'))}));});return Promise[_0x1499('0x61')](_0x3251d9);})[_0x1499('0x20')](function(){return _0xac593e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1499('0x20')](respondWithResult(_0x269e1c,null))[_0x1499('0x2b')](handleError(_0x269e1c,null));};exports[_0x1499('0x10c')]=function(_0x34b132,_0x25bb35){var _0x46c8b4;return db['UserVoiceQueueRt'][_0x1499('0x62')]({'paused':0x1},{'where':{'UserId':_0x34b132[_0x1499('0x64')]['id']},'individualHooks':!![]})[_0x1499('0x20')](function(){return db['User'][_0x1499('0x3b')]({'where':{'id':_0x34b132['params']['id'],'role':'agent'},'attributes':['id','name',_0x1499('0x2c'),'internal',_0x1499('0xa6'),_0x1499('0xa3')]});})[_0x1499('0x20')](handleEntityNotFound(_0x25bb35,null))[_0x1499('0x20')](function(_0x4a277a){if(_0x4a277a){_0x46c8b4=_0x4a277a;return respondWithRpcPromise(_0x1499('0x10d'),_0x1499('0x10c'),{'id':_0x46c8b4['id'],'name':_0x46c8b4['name'],'pause':!![]});}})['then'](function(){if(_0x46c8b4){return db[_0x1499('0x102')]['findAll']({'where':{'membername':_0x46c8b4[_0x1499('0x3c')],'type':_0x1499('0x108'),'exitAt':null}});}})[_0x1499('0x20')](function(_0x52a9f1){if(_0x52a9f1[_0x1499('0x57')]){var _0x29a890=moment()[_0x1499('0xb0')](_0x1499('0x104'));for(var _0x51b82f=0x0,_0x375ece=_0x52a9f1[_0x1499('0x57')];_0x51b82f<_0x375ece;_0x51b82f++){_0x52a9f1[_0x51b82f][_0x1499('0x10e')]({'exitAt':_0x29a890});}}})['then'](function(){var _0x56d0d3=[];var _0x59aa51=utils[_0x1499('0x105')]();_0x59aa51[_0x1499('0x103')](function(_0x1007b4){_0x56d0d3[_0x1499('0x53')]({'channel':_0x1007b4,'membername':_0x46c8b4[_0x1499('0x3c')],'interface':_[_0x1499('0x6e')](_0x46c8b4[_0x1499('0xa6')])?util[_0x1499('0xb0')](_0x1499('0xf8'),_0x46c8b4[_0x1499('0x3c')]):_0x46c8b4['interface'],'type':_0x1499('0x108'),'enterAt':moment()[_0x1499('0xb0')](_0x1499('0x104')),'data1':_0x34b132[_0x1499('0x63')][_0x1499('0x44')]||_0x1499('0x10f'),'role':_0x46c8b4[_0x1499('0x2c')],'internal':_0x46c8b4[_0x1499('0x69')]});});return db[_0x1499('0x102')][_0x1499('0x8c')](_0x56d0d3,{'individualHooks':!![]});})[_0x1499('0x20')](function(){return _0x46c8b4['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34b132[_0x1499('0x63')][_0x1499('0x44')]||_0x1499('0x10f'),'lastPauseAt':moment()[_0x1499('0xb0')](_0x1499('0x104'))});})['then'](respondWithResult(_0x25bb35,null))[_0x1499('0x2b')](handleError(_0x25bb35,null));};exports['unpause']=function(_0x578eda,_0xec07cf){if(_0x578eda[_0x1499('0x63')][_0x1499('0xa2')]&&!utils[_0x1499('0xa7')](_0x578eda['body'][_0x1499('0xa2')])){throw new APIBadRequestError(util[_0x1499('0xb0')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x578eda[_0x1499('0x63')][_0x1499('0xa2')]));}return db[_0x1499('0x40')][_0x1499('0x3b')]({'where':{'id':_0x578eda[_0x1499('0x64')]['id']},'attributes':['id',_0x1499('0x3c'),'role',_0x1499('0x69'),_0x1499('0xa6'),_0x1499('0xa3'),_0x1499('0xa5'),_0x1499('0x110'),_0x1499('0x111'),_0x1499('0x112'),'openchannelPause',_0x1499('0x113'),_0x1499('0x114'),_0x1499('0x115'),_0x1499('0x116')]})['then'](function(_0x4d5042){if(!_0x4d5042){throw new APINotFoundError(util[_0x1499('0xb0')](_0x1499('0x117'),_0x578eda[_0x1499('0x64')]['id']));}return _0x4d5042['unpause'](_0x578eda[_0x1499('0x63')][_0x1499('0xa2')]);})[_0x1499('0x20')](respondWithResult(_0xec07cf,null))[_0x1499('0x2b')](APIHandleError(_0xec07cf));};exports[_0x1499('0x118')]=function(_0x960e13,_0x1392c7){var _0x1128bd={};var _0x4c3ea1={};var _0x3afe3e;var _0x1194be;return db[_0x1499('0x40')]['findOne']({'where':{'id':_0x960e13[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x1392c7,null))[_0x1499('0x20')](function(_0x12c38c){if(_0x12c38c){_0x3afe3e=_0x12c38c;_0x4c3ea1['model']=_[_0x1499('0xd6')](db[_0x1499('0x119')][_0x1499('0x41')]);_0x4c3ea1[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x960e13[_0x1499('0x4c')]);_0x4c3ea1[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x4c3ea1['model'],_0x4c3ea1[_0x1499('0x4c')]);_0x1128bd[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x4c3ea1[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x960e13['query'][_0x1499('0xd9')]));_0x1128bd['attributes']=_0x1128bd[_0x1499('0x52')][_0x1499('0x57')]?_0x1128bd[_0x1499('0x52')]:_0x4c3ea1['model'];_0x1128bd[_0x1499('0xda')]=qs['sort'](_0x960e13['query']['sort']);_0x1128bd['where']=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x960e13['query'],_0x4c3ea1[_0x1499('0xde')]));if(_0x960e13['query'][_0x1499('0x37')]){_0x1128bd[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0x1128bd[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x1128bd[_0x1499('0x52')],function(_0x5fdbf5){var _0xb2af75={};_0xb2af75[_0x5fdbf5]={'$like':'%'+_0x960e13['query']['filter']+'%'};return _0xb2af75;})});}_0x1128bd=_[_0x1499('0x5f')]({},_0x1128bd,_0x960e13[_0x1499('0x60')]);return _0x3afe3e[_0x1499('0x118')](_0x1128bd);}})[_0x1499('0x20')](function(_0x4689e8){if(_0x4689e8){_0x1194be=_0x4689e8[_0x1499('0x57')];if(!_0x960e13[_0x1499('0x4c')]['hasOwnProperty'](_0x1499('0xdf'))){_0x1128bd[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x960e13[_0x1499('0x4c')][_0x1499('0x1a')]);_0x1128bd['offset']=qs['offset'](_0x960e13[_0x1499('0x4c')][_0x1499('0x19')]);}return _0x3afe3e[_0x1499('0x118')](_0x1128bd);}})[_0x1499('0x20')](function(_0x199e95){if(_0x199e95){return _0x199e95?{'count':_0x1194be,'rows':_0x199e95}:null;}})[_0x1499('0x20')](respondWithResult(_0x1392c7,null))['catch'](handleError(_0x1392c7,null));};exports[_0x1499('0x11a')]=function(_0x1d7bbe,_0x34161f){var _0x27ee96=_0x1d7bbe[_0x1499('0x64')]['id'];var _0x13f693=_0x1d7bbe[_0x1499('0x63')]?_0x1d7bbe[_0x1499('0x63')]['ids']:null;var _0x1b2da9=[];return Promise['resolve']()[_0x1499('0x20')](function(){if(!_0x13f693)throw new APIBadRequestError(_0x1499('0x11b'));})[_0x1499('0x20')](function(){return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x27ee96}});})[_0x1499('0x20')](function(_0x42c23e){if(!_0x42c23e)throw new APINotFoundError(util[_0x1499('0xb0')](_0x1499('0x117'),_0x1d7bbe[_0x1499('0x64')]['id']));return db[_0x1499('0x70')]['transaction'](function(_0x1be43d){return _0x42c23e[_0x1499('0x11a')](_0x13f693,{'transaction':_0x1be43d})['then'](function(){return db[_0x1499('0x119')][_0x1499('0x54')]({'where':{'id':{'$in':_0x13f693}}});})['then'](function(_0x1cd460){var _0x2d1a3c=_['map'](_0x1cd460,function(_0x5bab75){return _0x5bab75[_0x1499('0x11c')]();});return Promise[_0x1499('0x61')](_0x2d1a3c);})[_0x1499('0x20')](function(_0x25cbd7){_0x1b2da9=_[_0x1499('0x11d')](_0x25cbd7);var _0x25e4c9=_[_0x1499('0x42')](_0x1b2da9,function(_0x444307){return _0x444307[_0x1499('0x11e')](_0x42c23e['id'],{'transaction':_0x1be43d});});return Promise[_0x1499('0x61')](_0x25e4c9);})['then'](function(){if(!_0x42c23e[_0x1499('0xa3')])return;var _0x2e96f2=_[_0x1499('0x37')](_0x1b2da9,function(_0x504893){return _0x504893[_0x1499('0x11f')]('channel')==='Voice';});var _0x3a7ec7=_['map'](_0x2e96f2,function(_0x14f635){return db['UserVoiceQueueRt'][_0x1499('0x120')]({'membername':_0x42c23e[_0x1499('0x3c')],'UserId':_0x42c23e['id'],'queue_name':_0x14f635[_0x1499('0x3c')],'VoiceQueueId':_0x14f635['id'],'interface':_[_0x1499('0x6e')](_0x42c23e['interface'])?util['format'](_0x1499('0xf8'),_0x42c23e[_0x1499('0x3c')]):_0x42c23e[_0x1499('0xa6')],'paused':_0x42c23e[_0x1499('0xa5')]||![],'penalty':_0x42c23e[_0x1499('0xa9')]},{'transaction':_0x1be43d});});return Promise[_0x1499('0x61')](_0x3a7ec7);})[_0x1499('0x20')](function(){return db[_0x1499('0x121')][_0x1499('0x54')]({'where':{'teamId':{'$in':_0x13f693}}});})['then'](function(_0x1844f8){var _0x477c73=_[_0x1499('0x42')](_0x1844f8,function(_0x3ad9e7){return db[_0x1499('0x122')][_0x1499('0x85')]({'UserId':_0x42c23e['id'],'VoicePrefixId':_0x3ad9e7[_0x1499('0x123')]},{'transaction':_0x1be43d});});return Promise[_0x1499('0x61')](_0x477c73);});});})['then'](function(){for(var _0x2a1e4b=0x0;_0x2a1e4b<_0x1b2da9[_0x1499('0x57')];_0x2a1e4b++){var _0x1ab192=_0x1b2da9[_0x2a1e4b][_0x1499('0x11f')](_0x1499('0xa2'));var _0x2d4570=_0x1ab192+'QueueId';socket[_0x1499('0x2e')](_0x1499('0x33')+_0x1ab192+'Queue:save',{'UserId':_0x27ee96,['queueField']:_0x1b2da9[_0x2a1e4b]['id']});}})['then'](respondWithStatusCode(_0x34161f,null))[_0x1499('0x2b')](APIHandleError(_0x34161f));};exports[_0x1499('0x124')]=function(_0x390b4d,_0x3b3175){var _0x11887d=_0x390b4d['params']['id'];var _0x3f8281=null;if(_0x390b4d[_0x1499('0x4c')][_0x1499('0x67')]){_0x3f8281=_[_0x1499('0xb6')](_0x390b4d['query'][_0x1499('0x67')])?_0x390b4d[_0x1499('0x4c')]['ids']:[_0x390b4d['query'][_0x1499('0x67')]];}var _0x7c8809=[];return Promise[_0x1499('0x125')]()[_0x1499('0x20')](function(){if(!_0x3f8281)throw new APIBadRequestError(_0x1499('0x126'));})[_0x1499('0x20')](function(){return db[_0x1499('0x40')]['findOne']({'where':{'id':_0x11887d}});})[_0x1499('0x20')](function(_0x30990d){if(!_0x30990d)throw new APINotFoundError(util[_0x1499('0xb0')](_0x1499('0x117'),_0x390b4d[_0x1499('0x64')]['id']));return db['sequelize']['transaction'](function(_0x23f84c){return _0x30990d[_0x1499('0x124')](_0x3f8281,{'transaction':_0x23f84c})[_0x1499('0x20')](function(){return db[_0x1499('0x119')][_0x1499('0x54')]({'where':{'id':{'$in':_0x3f8281}}});})['then'](function(_0x21f7c2){var _0x2896be=_[_0x1499('0x42')](_0x21f7c2,function(_0x5c85ab){return _0x5c85ab[_0x1499('0x11c')]();});return Promise[_0x1499('0x61')](_0x2896be);})[_0x1499('0x20')](function(_0x4a55db){_0x7c8809=_[_0x1499('0x11d')](_0x4a55db);var _0x528bd3=_[_0x1499('0x42')](_0x7c8809,function(_0x19b11d){return _0x19b11d[_0x1499('0x127')](_0x30990d['id'],{'transaction':_0x23f84c});});return Promise[_0x1499('0x61')](_0x528bd3);})[_0x1499('0x20')](function(){if(!_0x30990d[_0x1499('0xa3')])return;var _0x2bf0f9=_[_0x1499('0x37')](_0x7c8809,function(_0x127cef){return _0x127cef[_0x1499('0x11f')]('channel')===_0x1499('0x128');});var _0x423b4d=_[_0x1499('0x42')](_0x2bf0f9,function(_0x34fc4e){return db[_0x1499('0xb1')][_0x1499('0x30')]({'where':{'VoiceQueueId':_0x34fc4e['id'],'UserId':_0x30990d['id']},'transaction':_0x23f84c});});return Promise[_0x1499('0x61')](_0x423b4d);})[_0x1499('0x20')](function(){return db[_0x1499('0x121')][_0x1499('0x54')]({'where':{'teamId':{'$in':_0x3f8281}}});})['then'](function(_0x1d13f8){var _0x1c2ed8=_['map'](_0x1d13f8,function(_0x452da4){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x30990d['id'],'VoicePrefixId':_0x452da4[_0x1499('0x123')]}},{'transaction':_0x23f84c});});return Promise[_0x1499('0x61')](_0x1c2ed8);});});})[_0x1499('0x20')](function(){for(var _0x272329=0x0;_0x272329<_0x7c8809['length'];_0x272329++){var _0x2cfe8f=_0x7c8809[_0x272329][_0x1499('0x11f')](_0x1499('0xa2'));var _0x54fd2e=_0x2cfe8f+_0x1499('0xb7');socket[_0x1499('0x2e')](_0x1499('0x33')+_0x2cfe8f+'Queue:remove',{'UserId':_0x11887d,['queueField']:_0x7c8809[_0x272329]['id']});}})[_0x1499('0x20')](respondWithStatusCode(_0x3b3175,null))[_0x1499('0x2b')](APIHandleError(_0x3b3175));};exports['getLists']=function(_0x1f9d75,_0x4c541b){var _0x4a738e={};var _0x12380d={};var _0x336d22;var _0xa7c64d;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x1f9d75['params']['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x4c541b,null))['then'](function(_0x2e2160){if(_0x2e2160){_0x336d22=_0x2e2160;_0x12380d[_0x1499('0xd8')]=_['keys'](db[_0x1499('0xcf')][_0x1499('0x41')]);_0x12380d[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x1f9d75[_0x1499('0x4c')]);_0x12380d['filters']=_['intersection'](_0x12380d[_0x1499('0xd8')],_0x12380d[_0x1499('0x4c')]);_0x4a738e[_0x1499('0x52')]=_[_0x1499('0xe0')](_0x12380d[_0x1499('0xd8')],qs[_0x1499('0xd9')](_0x1f9d75[_0x1499('0x4c')][_0x1499('0xd9')]));_0x4a738e['attributes']=_0x4a738e['attributes'][_0x1499('0x57')]?_0x4a738e['attributes']:_0x12380d['model'];_0x4a738e[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x1f9d75[_0x1499('0x4c')][_0x1499('0xdb')]);_0x4a738e[_0x1499('0xdc')]=qs[_0x1499('0xde')](_[_0x1499('0xdd')](_0x1f9d75[_0x1499('0x4c')],_0x12380d[_0x1499('0xde')]));if(_0x1f9d75['query'][_0x1499('0x37')]){_0x4a738e['where']=_[_0x1499('0x5f')](_0x4a738e[_0x1499('0xdc')],{'$or':_[_0x1499('0x42')](_0x4a738e['attributes'],function(_0x1e6fbe){var _0x2ab441={};_0x2ab441[_0x1e6fbe]={'$like':'%'+_0x1f9d75[_0x1499('0x4c')][_0x1499('0x37')]+'%'};return _0x2ab441;})});}_0x4a738e=_['merge']({},_0x4a738e,_0x1f9d75['options']);return _0x336d22[_0x1499('0x129')](_0x4a738e);}})[_0x1499('0x20')](function(_0x502c8f){if(_0x502c8f){_0xa7c64d=_0x502c8f[_0x1499('0x57')];if(!_0x1f9d75[_0x1499('0x4c')][_0x1499('0xce')](_0x1499('0xdf'))){_0x4a738e[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x1f9d75['query'][_0x1499('0x1a')]);_0x4a738e[_0x1499('0x19')]=qs[_0x1499('0x19')](_0x1f9d75[_0x1499('0x4c')][_0x1499('0x19')]);}return _0x336d22['getLists'](_0x4a738e);}})[_0x1499('0x20')](function(_0x3a4bcb){if(_0x3a4bcb){return _0x3a4bcb?{'count':_0xa7c64d,'rows':_0x3a4bcb}:null;}})[_0x1499('0x20')](respondWithResult(_0x4c541b,null))[_0x1499('0x2b')](handleError(_0x4c541b,null));};exports[_0x1499('0x12a')]=function(_0x335bf6,_0x14ff43){var _0xd7a84b={};var _0x2a3339={};var _0x3ebc6f;return db[_0x1499('0x40')][_0x1499('0x9c')]({'where':{'id':_0x335bf6[_0x1499('0x64')]['id']}})[_0x1499('0x20')](handleEntityNotFound(_0x14ff43,null))['then'](function(_0x131a2a){if(_0x131a2a){_0x3ebc6f=_0x131a2a;_0x2a3339['model']=_[_0x1499('0xd6')](db[_0x1499('0x40')]['rawAttributes']);_0x2a3339[_0x1499('0x4c')]=_[_0x1499('0xd6')](_0x335bf6[_0x1499('0x4c')]);_0x2a3339[_0x1499('0xde')]=_[_0x1499('0xe0')](_0x2a3339[_0x1499('0xd8')],_0x2a3339['query']);_0xd7a84b['attributes']=_[_0x1499('0xe0')](_0x2a3339[_0x1499('0xd8')],qs['fields'](_0x335bf6[_0x1499('0x4c')][_0x1499('0xd9')]));_0xd7a84b[_0x1499('0x52')]=_0xd7a84b[_0x1499('0x52')]['length']?_0xd7a84b[_0x1499('0x52')]:_0x2a3339['model'];_0xd7a84b[_0x1499('0xda')]=qs[_0x1499('0xdb')](_0x335bf6[_0x1499('0x4c')]['sort']);_0xd7a84b[_0x1499('0xdc')]=qs['filters'](_[_0x1499('0xdd')](_0x335bf6[_0x1499('0x4c')],_0x2a3339[_0x1499('0xde')]));if(_0x335bf6[_0x1499('0x4c')][_0x1499('0x37')]){_0xd7a84b[_0x1499('0xdc')]=_[_0x1499('0x5f')](_0xd7a84b['where'],{'$or':_[_0x1499('0x42')](_0xd7a84b[_0x1499('0x52')],function(_0x3b424a){var _0x18cf30={};_0x18cf30[_0x3b424a]={'$like':'%'+_0x335bf6[_0x1499('0x4c')]['filter']+'%'};return _0x18cf30;})});}_0xd7a84b[_0x1499('0xd8')]=db[_0x1499('0x40')];_0xd7a84b['as']='Agents';_0xd7a84b=_['merge']({},_0xd7a84b,_0x335bf6[_0x1499('0x60')]);return _0x3ebc6f[_0x1499('0x101')]({'include':[_0xd7a84b]});}})[_0x1499('0x20')](function(_0x39997f){if(_0x39997f){var _0x1872bd={},_0x2810b7=[];for(var _0x2a8e6e=0x0;_0x2a8e6e<_0x39997f[_0x1499('0x57')];_0x2a8e6e+=0x1){for(var _0x452e35=0x0,_0x246920;_0x452e35<_0x39997f[_0x2a8e6e][_0x1499('0x34')]['length'];_0x452e35+=0x1){_0x246920=_0x39997f[_0x2a8e6e][_0x1499('0x34')][_0x452e35][_0x1499('0xae')]({'plain':!![]});_0x1872bd[_0x246920['id']]=_0x246920;}}_0x1872bd=_[_0x1499('0x12b')](_0x1872bd);for(var _0xdb98a8=qs['offset'](_0x335bf6[_0x1499('0x4c')][_0x1499('0x19')]);_0xdb98a8<_0x1872bd[_0x1499('0x57')]&&_0x2810b7['length']=_0x19f1de){_0x510969=_0x19f1de;_0x3ea9bf=0xc8;}else{_0x3ea9bf=0xce;}_0x30202c['status'](_0x3ea9bf);return _0x30202c[_0x8d8b('0x20')](_0x8d8b('0x21'),_0x53a14b+'-'+_0x510969+'/'+_0x19f1de)['json'](_0x1cecba);}return null;};}function respondWithRpcPromise(_0x40be5a,_0x1f640d,_0x4a5acd,_0x157654){return new Promise(function(_0x585ba6,_0x261a4a){var _0x41603a=_0x157654||amiClient;return _0x41603a[_0x8d8b('0x22')](_0x40be5a,_0x4a5acd)[_0x8d8b('0x23')](function(_0x305ad6){logger[_0x8d8b('0x24')]('User,\x20%s,\x20%s',_0x1f640d,_0x8d8b('0x25'));logger[_0x8d8b('0x26')](_0x8d8b('0x27'),_0x1f640d,_0x8d8b('0x25'),JSON[_0x8d8b('0x28')](_0x305ad6));if(_0x305ad6[_0x8d8b('0x29')]){if(_0x305ad6['error']['code']===0x1f4){logger['error'](_0x8d8b('0x2a'),_0x1f640d,_0x305ad6[_0x8d8b('0x29')][_0x8d8b('0x2b')]);return _0x261a4a(_0x305ad6[_0x8d8b('0x29')][_0x8d8b('0x2b')]);}logger['error'](_0x8d8b('0x2a'),_0x1f640d,_0x305ad6['error']['message']);return _0x585ba6(_0x305ad6['error']['message']);}else{logger[_0x8d8b('0x24')]('User,\x20%s,\x20%s',_0x1f640d,_0x8d8b('0x25'));_0x585ba6(_0x305ad6[_0x8d8b('0x2c')][_0x8d8b('0x2b')]);}})[_0x8d8b('0x2d')](function(_0x492a74){logger[_0x8d8b('0x29')](_0x8d8b('0x2a'),_0x1f640d,_0x492a74);_0x261a4a(_0x492a74);});});}function saveUpdates(_0x5ae485){return function(_0x25e113){if(_0x25e113){return _0x25e113['update'](_0x5ae485)[_0x8d8b('0x23')](function(_0x349089){if(_0x349089['role']===_0x8d8b('0x2e')){socket[_0x8d8b('0x2f')](_0x8d8b('0x30')+_0x349089['id'],_0x349089);}return _0x349089;});}return null;};}function removeEntity(_0x32496b,_0x19b579){return function(_0x29bc43){if(_0x29bc43){return _0x29bc43[_0x8d8b('0x31')]({'transaction':_0x19b579})['then'](function(){var _0x141669=_0x29bc43['get']({'plain':!![]});if(_0x141669[_0x8d8b('0x32')]===_0x8d8b('0x33'))return;var _0x4e469b=[{'name':_0x8d8b('0x34'),'value':_0x8d8b('0x35'),'ignore':!![]},{'name':'Agents','value':_0x8d8b('0x2e'),'ignore':![]},{'name':_0x8d8b('0x36'),'value':_0x8d8b('0x37'),'ignore':![]}];var _0x1c98dd=_(_0x4e469b)[_0x8d8b('0x38')]('ignore')['map'](_0x8d8b('0x39'))[_0x8d8b('0x39')]();if(_[_0x8d8b('0x3a')](_0x1c98dd,_0x141669['role'])){return;}var _0x59881a=_[_0x8d8b('0x3b')](_0x4e469b,[_0x8d8b('0x39'),_0x141669['role']])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x59881a,'resourceId':_0x141669['id']},'transaction':_0x19b579})[_0x8d8b('0x23')](function(){return _0x29bc43;});})[_0x8d8b('0x23')](function(){_0x32496b[_0x8d8b('0x1a')](0xcc)[_0x8d8b('0x19')]();});}};}function handleEntityNotFound(_0x269b5f){return function(_0x43f724){if(!_0x43f724){_0x269b5f[_0x8d8b('0x18')](0x194);}return _0x43f724;};}function handleError(_0x1b31dd,_0x4f4c00){_0x4f4c00=_0x4f4c00||0x1f4;return function(_0x52d393){logger[_0x8d8b('0x29')](_0x52d393['stack']);if(_0x52d393[_0x8d8b('0x3c')]){delete _0x52d393[_0x8d8b('0x3c')];}_0x1b31dd[_0x8d8b('0x1a')](_0x4f4c00)[_0x8d8b('0x3d')](_0x52d393);};}function getUserAttributes(){return _(db[_0x8d8b('0x3e')]['rawAttributes'])[_0x8d8b('0x3f')](function(_0x52a332){return{'name':_0x52a332[_0x8d8b('0x40')],'type':_0x52a332[_0x8d8b('0x41')][_0x8d8b('0x42')]};})[_0x8d8b('0x38')](function(_0x3465e0){return![_0x8d8b('0x43'),_0x8d8b('0x44'),'previousPasswords',_0x8d8b('0x45'),_0x8d8b('0x46'),_0x8d8b('0x47')][_0x8d8b('0x3a')](_0x3465e0[_0x8d8b('0x3c')]);})[_0x8d8b('0x39')]();}exports[_0x8d8b('0x48')]=function(_0x500635,_0x1b3f73){var _0x2f3ae1={},_0xa9f83f={'count':0x0,'rows':[]};var _0x1a07e8=getUserAttributes();_0x2f3ae1=qs['getOptions'](_0x1a07e8,_0x500635);var _0x410997={'where':_0x2f3ae1['where']};return db[_0x8d8b('0x3e')][_0x8d8b('0x1e')](_0x410997)[_0x8d8b('0x23')](function(_0x1d6cb9){_0xa9f83f[_0x8d8b('0x1e')]=_0x1d6cb9;if(_0x500635[_0x8d8b('0x49')][_0x8d8b('0x4a')]){_0x2f3ae1[_0x8d8b('0x4b')]=[{'all':!![]}];}if(_0x500635[_0x8d8b('0x49')]['userSetting']==='true'){_0x2f3ae1['include']=[{'model':db[_0x8d8b('0x4c')],'as':_0x8d8b('0x4d')}];}if(!_[_0x8d8b('0x3a')](_0x2f3ae1[_0x8d8b('0x4e')],'id')){_0x2f3ae1[_0x8d8b('0x4e')]['push']('id');}return db[_0x8d8b('0x3e')][_0x8d8b('0x4f')](_0x2f3ae1);})[_0x8d8b('0x23')](function(_0x5475f7){_0xa9f83f[_0x8d8b('0x50')]=_0x5475f7;if(_0x500635[_0x8d8b('0x49')][_0x8d8b('0x51')]===_0x8d8b('0x52')){var _0x33da9a=[];for(var _0x12d058=0x0;_0x12d058<_0xa9f83f['rows'][_0x8d8b('0x53')];_0x12d058++){_0x33da9a['push'](get_open_tabs('chat',_0xa9f83f[_0x8d8b('0x50')][_0x12d058][_0x8d8b('0x54')]));_0x33da9a[_0x8d8b('0x55')](get_open_tabs('sms',_0xa9f83f[_0x8d8b('0x50')][_0x12d058][_0x8d8b('0x54')]));_0x33da9a[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x56'),_0xa9f83f[_0x8d8b('0x50')][_0x12d058]['dataValues']));_0x33da9a[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x57'),_0xa9f83f[_0x8d8b('0x50')][_0x12d058][_0x8d8b('0x54')]));_0x33da9a[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x58'),_0xa9f83f[_0x8d8b('0x50')][_0x12d058][_0x8d8b('0x54')]));_0x33da9a[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x59'),_0xa9f83f[_0x8d8b('0x50')][_0x12d058][_0x8d8b('0x54')]));}return Promise[_0x8d8b('0x5a')](_0x33da9a)[_0x8d8b('0x23')](function(){return _0xa9f83f;});}else{return _0xa9f83f;}})[_0x8d8b('0x23')](respondWithFilteredResult(_0x1b3f73,_0x2f3ae1))[_0x8d8b('0x2d')](handleError(_0x1b3f73,null));};exports[_0x8d8b('0x5b')]=function(_0x3b2a24,_0x474906){var _0x2f3992=getUserAttributes();_0x3b2a24[_0x8d8b('0x49')]['id']=_0x3b2a24[_0x8d8b('0x5c')]['id'];var _0x3e16ff=qs['getOptions'](_0x2f3992,_0x3b2a24);if(_0x3b2a24['query']['includeAll']){_0x3e16ff[_0x8d8b('0x4b')]=[{'all':!![]}];}if(_0x3b2a24[_0x8d8b('0x49')]['userSetting']==='true'){_0x3e16ff[_0x8d8b('0x4b')]=[{'model':db[_0x8d8b('0x4c')],'as':_0x8d8b('0x4d')}];}_0x3e16ff=_[_0x8d8b('0x5d')]({},_0x3e16ff,_0x3b2a24['options']);if(!_[_0x8d8b('0x3a')](_0x3e16ff[_0x8d8b('0x4e')],'id')){_0x3e16ff[_0x8d8b('0x4e')]['push']('id');}return db[_0x8d8b('0x3e')]['find'](_0x3e16ff)['then'](handleEntityNotFound(_0x474906,null))[_0x8d8b('0x23')](function(_0x47129d){var _0x1ce822=[];values=_0x47129d;if(_0x3b2a24[_0x8d8b('0x49')][_0x8d8b('0x51')]===_0x8d8b('0x52')){_0x1ce822['push'](get_open_tabs('chat',_0x47129d[_0x8d8b('0x54')]));_0x1ce822[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x5e'),_0x47129d[_0x8d8b('0x54')]));_0x1ce822[_0x8d8b('0x55')](get_open_tabs('openchannel',_0x47129d[_0x8d8b('0x54')]));_0x1ce822[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x59'),_0x47129d[_0x8d8b('0x54')]));_0x1ce822[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x56'),_0x47129d[_0x8d8b('0x54')]));_0x1ce822['push'](get_open_tabs('mail',_0x47129d['dataValues']));return Promise[_0x8d8b('0x5a')](_0x1ce822);}else{return values;}})[_0x8d8b('0x23')](function(){return values;})[_0x8d8b('0x23')](respondWithResult(_0x474906,null))[_0x8d8b('0x2d')](handleError(_0x474906,null));};exports[_0x8d8b('0x5f')]=function(_0x294b59,_0x1cfb1f){if(_0x294b59[_0x8d8b('0x60')]['id']){delete _0x294b59['body']['id'];}delete _0x294b59[_0x8d8b('0x60')][_0x8d8b('0x32')];return db['User']['find']({'where':{'id':_0x294b59['params']['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x1cfb1f,null))['then'](saveUpdates(_0x294b59[_0x8d8b('0x60')],null))[_0x8d8b('0x23')](respondWithResult(_0x1cfb1f,null))[_0x8d8b('0x2d')](handleError(_0x1cfb1f,null));};exports[_0x8d8b('0x61')]=function(_0x41d0e1,_0x290062){return db[_0x8d8b('0x3e')][_0x8d8b('0x61')]()[_0x8d8b('0x23')](respondWithResult(_0x290062,null))[_0x8d8b('0x2d')](handleError(_0x290062,null));};exports['addContacts']=function(_0x4904f1,_0x3bc3de){return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x4904f1['params']['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x3bc3de,null))[_0x8d8b('0x23')](function(_0x44109f){if(_0x44109f){return _0x44109f['addContacts'](_0x4904f1[_0x8d8b('0x60')][_0x8d8b('0x62')],_['omit'](_0x4904f1[_0x8d8b('0x60')],[_0x8d8b('0x62'),'id'])||{});}})[_0x8d8b('0x23')](respondWithResult(_0x3bc3de,null))['catch'](handleError(_0x3bc3de,null));};function validateUser(_0x55349c){return new Promise(function(_0x314c71,_0x453559){if(_0x55349c[_0x8d8b('0x63')])return _0x314c71(_0x55349c);return db['Setting']['findById'](0x1)[_0x8d8b('0x23')](function(_0x2e03ed){if(_0x2e03ed['securePassword'])authService[_0x8d8b('0x64')](_0x55349c['password']);db[_0x8d8b('0x3e')][_0x8d8b('0x65')](_0x8d8b('0x63'))[_0x8d8b('0x23')](function(_0x35c445){if(_[_0x8d8b('0x66')](_0x35c445)){_0x55349c[_0x8d8b('0x63')]=_0x2e03ed['min_internal']||0x1;return;}if(_['isNil'](_0x2e03ed[_0x8d8b('0x67')])||_0x2e03ed[_0x8d8b('0x67')]===_0x35c445){_0x55349c[_0x8d8b('0x63')]=_0x35c445+0x1;return;}if(_0x2e03ed['min_internal']>_0x35c445){_0x55349c[_0x8d8b('0x63')]=_0x2e03ed['min_internal'];return;}return db['sequelize'][_0x8d8b('0x49')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8d8b('0x68')]['QueryTypes']['SELECT']})[_0x8d8b('0x23')](function(_0x280f70){if(_0x280f70&&_0x280f70[_0x8d8b('0x53')]){for(var _0x1da7be=0x0,_0x511551=_0x280f70[_0x8d8b('0x53')];_0x1da7be<_0x511551&&_['isNil'](_0x55349c[_0x8d8b('0x63')]);_0x1da7be++){if(_0x2e03ed[_0x8d8b('0x67')]<=_0x280f70[_0x1da7be][_0x8d8b('0x69')]){_0x55349c[_0x8d8b('0x63')]=_0x280f70[_0x1da7be][_0x8d8b('0x69')];}else if(_0x2e03ed[_0x8d8b('0x67')]>_0x280f70[_0x1da7be]['from']&&_0x2e03ed[_0x8d8b('0x67')]<=_0x280f70[_0x1da7be]['to']){_0x55349c[_0x8d8b('0x63')]=_0x2e03ed[_0x8d8b('0x67')];}}}if(_['isNil'](_0x55349c[_0x8d8b('0x63')])){_0x55349c['internal']=_0x35c445+0x1;}return _0x314c71(_0x55349c);});});})[_0x8d8b('0x2d')](function(_0x4d52b9){_0x453559(_0x4d52b9);});});}function updateUser(_0x1308ac){return new Promise(function(_0x345a0f,_0x3f29fd){try{if(_0x1308ac[_0x8d8b('0x6a')]){_0x1308ac[_0x8d8b('0x6b')]=_0x1308ac[_0x8d8b('0x63')];_0x1308ac[_0x8d8b('0x6c')]={'mailbox':_0x1308ac['internal'],'password':_0x1308ac[_0x8d8b('0x43')],'fullname':_0x1308ac[_0x8d8b('0x6d')],'email':_0x1308ac[_0x8d8b('0x6e')]};}if(_0x1308ac[_0x8d8b('0x32')]===_0x8d8b('0x2e')){if(!_0x1308ac[_0x8d8b('0x6f')])_0x1308ac[_0x8d8b('0x6f')]=[_0x8d8b('0x70'),_0x8d8b('0x71'),_0x8d8b('0x72'),_0x8d8b('0x73'),_0x8d8b('0x74'),_0x8d8b('0x75'),_0x8d8b('0x76'),_0x8d8b('0x77'),'107',_0x8d8b('0x78'),_0x8d8b('0x79'),_0x8d8b('0x7a'),'111',_0x8d8b('0x7b'),_0x8d8b('0x7c')];}_0x345a0f(_0x1308ac);}catch(_0x209d0d){_0x3f29fd(_0x209d0d);}});}exports[_0x8d8b('0x7d')]=function(_0x5960ab,_0x1138bb){if(_0x5960ab[_0x8d8b('0x35')][_0x8d8b('0x32')]===_0x8d8b('0x2e'))throw new Error('Unauthorized');if(_0x5960ab[_0x8d8b('0x60')][_0x8d8b('0x32')]===_0x8d8b('0x35')&&_0x5960ab[_0x8d8b('0x35')]['role']!==_0x8d8b('0x33')){throw new Error(_0x8d8b('0x7e'));}if(_0x5960ab['body'][_0x8d8b('0x32')]===_0x8d8b('0x33')&&_0x5960ab[_0x8d8b('0x35')][_0x8d8b('0x32')]!==_0x8d8b('0x33')){throw new Error(_0x8d8b('0x7f'));}return licenseUtil[_0x8d8b('0x80')]([_0x5960ab[_0x8d8b('0x60')]])[_0x8d8b('0x23')](function(){return validateUser(_0x5960ab['body']);})[_0x8d8b('0x23')](function(_0x2e52d9){return updateUser(_0x2e52d9)[_0x8d8b('0x23')](function(_0x4c3c71){if(_0x4c3c71['role']===_0x8d8b('0x33')){_0x4c3c71['settingsEnabled']=_0x5960ab['user'][_0x8d8b('0x81')];delete _0x4c3c71[_0x8d8b('0x82')];}return _0x4c3c71;});})[_0x8d8b('0x23')](function(_0x2f01c9){return db['User']['create'](_0x2f01c9,{'include':[{'model':db[_0x8d8b('0x6c')],'as':_0x8d8b('0x6c')}]});})[_0x8d8b('0x23')](function(_0x1df91c){if(_0x5960ab[_0x8d8b('0x60')][_0x8d8b('0x32')]==='user')return _0x1df91c;if(_0x5960ab[_0x8d8b('0x35')][_0x8d8b('0x32')]!=='user')return _0x1df91c;return db[_0x8d8b('0x83')]['find']({'where':{'name':_0x1df91c[_0x8d8b('0x32')]===_0x8d8b('0x2e')?_0x8d8b('0x84'):_0x8d8b('0x36'),'userProfileId':_0x5960ab[_0x8d8b('0x35')][_0x8d8b('0x82')]},'raw':!![]})[_0x8d8b('0x23')](function(_0x237d90){if(!_0x237d90||_0x237d90[_0x8d8b('0x85')]!=0x0)return _0x1df91c;return db[_0x8d8b('0x86')]['create']({'name':_0x1df91c[_0x8d8b('0x3c')],'resourceId':_0x1df91c['id'],'type':_0x237d90[_0x8d8b('0x3c')],'sectionId':_0x237d90['id']},{})[_0x8d8b('0x23')](function(){return _0x1df91c;});})[_0x8d8b('0x2d')](function(_0x4f75ba){logger[_0x8d8b('0x29')](_0x8d8b('0x87'),_0x4f75ba);throw _0x4f75ba;});})['then'](respondWithResult(_0x1138bb,0xc9))[_0x8d8b('0x2d')](handleError(_0x1138bb,null));};exports[_0x8d8b('0x88')]=function(_0x1512f4,_0x4edea4){var _0x540d04=_0x1512f4[_0x8d8b('0x60')];var _0x3c64f5=[];if(_0x1512f4['user'][_0x8d8b('0x32')]===_0x8d8b('0x2e'))throw new Error(_0x8d8b('0x89'));if(_[_0x8d8b('0x8a')](_0x540d04,[_0x8d8b('0x32'),_0x8d8b('0x35')])&&_0x1512f4[_0x8d8b('0x35')][_0x8d8b('0x32')]!==_0x8d8b('0x33')){throw new Error(_0x8d8b('0x7e'));}if(_['some'](_0x540d04,[_0x8d8b('0x32'),'admin'])&&_0x1512f4[_0x8d8b('0x35')][_0x8d8b('0x32')]!==_0x8d8b('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x8d8b('0x80')](_0x540d04)[_0x8d8b('0x23')](function(){return validateUser(_0x540d04[0x0]);})[_0x8d8b('0x23')](function(){for(var _0x2754d1=0x1;_0x2754d1<_0x540d04[_0x8d8b('0x53')];_0x2754d1++){var _0x3ac907=_0x540d04[_0x2754d1-0x1][_0x8d8b('0x63')];if(!_0x540d04[_0x2754d1][_0x8d8b('0x63')])_0x540d04[_0x2754d1]['internal']=_0x3ac907+0x1;_0x3c64f5[_0x8d8b('0x55')](validateUser(_0x540d04[_0x2754d1]));}return Promise[_0x8d8b('0x5a')](_0x3c64f5);})['then'](function(){_0x3c64f5=[];for(var _0x4507fa=0x0;_0x4507fa<_0x540d04[_0x8d8b('0x53')];_0x4507fa++){_0x3c64f5[_0x8d8b('0x55')](updateUser(_0x540d04[_0x4507fa]));}return Promise['all'](_0x3c64f5);})[_0x8d8b('0x23')](function(){_0x3c64f5=_0x540d04[_0x8d8b('0x3f')](function(_0x34ccb4){return db['User'][_0x8d8b('0x7d')](_0x34ccb4,{'include':[{'model':db[_0x8d8b('0x6c')],'as':_0x8d8b('0x6c')}]})[_0x8d8b('0x23')](function(_0x3e314a){_0x34ccb4['id']=_0x3e314a['id'];return _0x34ccb4;});});return Promise[_0x8d8b('0x5a')](_0x3c64f5);})[_0x8d8b('0x23')](function(_0x5ea7da){if(_0x1512f4[_0x8d8b('0x60')]['role']===_0x8d8b('0x35'))return _0x5ea7da;if(_0x1512f4[_0x8d8b('0x35')][_0x8d8b('0x32')]!==_0x8d8b('0x35'))return _0x5ea7da;var _0x35966e=_['some'](_0x5ea7da,function(_0x1845ab){return _0x1845ab['role']===_0x8d8b('0x2e')||_0x1845ab[_0x8d8b('0x32')]===_0x8d8b('0x37');});if(!_0x35966e)return _0x5ea7da;return db[_0x8d8b('0x83')][_0x8d8b('0x4f')]({'where':{'name':{'$or':[_0x8d8b('0x84'),_0x8d8b('0x36')]},'userProfileId':_0x1512f4[_0x8d8b('0x35')][_0x8d8b('0x82')]},'raw':!![]})[_0x8d8b('0x23')](function(_0xd4b4ab){if(_['isEmpty'](_0xd4b4ab)||!_['some'](_0xd4b4ab,[_0x8d8b('0x85'),0x0]))return _0x5ea7da;_0x3c64f5=[];var _0x1b3756=_(_0xd4b4ab)[_0x8d8b('0x3f')](function(_0x236421){if(_0x236421[_0x8d8b('0x85')]===0x1)return;return _0x236421['name']===_0x8d8b('0x84')?_0x8d8b('0x2e'):'telephone';})[_0x8d8b('0x8b')]()[_0x8d8b('0x39')]();for(var _0x1779bd=0x0;_0x1779bd<_0x5ea7da[_0x8d8b('0x53')];_0x1779bd++){if(!_['includes'](_0x1b3756,_0x5ea7da[_0x1779bd]['role']))return;var _0x2aa3bf=_0x5ea7da[_0x1779bd][_0x8d8b('0x32')]==='agent'?_0x8d8b('0x84'):'Telephones';_0x3c64f5[_0x8d8b('0x55')](db[_0x8d8b('0x86')][_0x8d8b('0x7d')]({'name':_0x5ea7da[_0x1779bd][_0x8d8b('0x3c')],'resourceId':_0x5ea7da[_0x1779bd]['id'],'type':_0x2aa3bf,'sectionId':_[_0x8d8b('0x3b')](_0xd4b4ab,[_0x8d8b('0x3c'),_0x2aa3bf])['id']},{}));}return Promise['all'](_0x3c64f5);});})['then'](respondWithResult(_0x4edea4,0xc9))[_0x8d8b('0x2d')](handleError(_0x4edea4,null));};exports[_0x8d8b('0x8c')]=function(_0x28993f,_0x3d7821){if(_0x28993f[_0x8d8b('0x60')]['id']){delete _0x28993f[_0x8d8b('0x60')]['id'];}return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x28993f[_0x8d8b('0x5c')]['id']}})['then'](function(_0x2e1f07){if(!_0x2e1f07)return null;if(_0x2e1f07['id']===_0x28993f[_0x8d8b('0x35')]['id']){if(!_0x28993f['body'][_0x8d8b('0x8d')]||!_0x28993f[_0x8d8b('0x60')]['newPassword']){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0x90'));}if(!_0x2e1f07['authenticate'](_0x28993f[_0x8d8b('0x60')]['oldPassword'])){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0x91'));}if(_0x28993f[_0x8d8b('0x60')][_0x8d8b('0x8d')]===_0x28993f['body'][_0x8d8b('0x92')]){throw new db['Sequelize']['ValidationError'](_0x8d8b('0x93'));}}else if(_0x28993f[_0x8d8b('0x35')][_0x8d8b('0x32')]==='admin'){if(!_0x28993f['body'][_0x8d8b('0x92')]){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0x94'));}}else if(_0x28993f['user'][_0x8d8b('0x32')]===_0x8d8b('0x35')){if(!_0x28993f[_0x8d8b('0x60')][_0x8d8b('0x92')]){throw new db[(_0x8d8b('0x8e'))]['ValidationError'](_0x8d8b('0x94'));}if(_0x2e1f07['role']!==_0x8d8b('0x2e')){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0x89'));}}else{throw new db['Sequelize'][(_0x8d8b('0x8f'))](_0x8d8b('0x89'));}return _0x2e1f07;})[_0x8d8b('0x23')](handleEntityNotFound(_0x3d7821,null))[_0x8d8b('0x23')](function(_0x1dd258){return db['Setting'][_0x8d8b('0x95')]({'attributes':['id',_0x8d8b('0x96'),_0x8d8b('0x97'),_0x8d8b('0x98')]})['then'](function(_0x7ab6cb){if(_0x7ab6cb[_0x8d8b('0x96')])authService['validatePasswordPattern'](_0x28993f[_0x8d8b('0x60')][_0x8d8b('0x92')]);if(!_0x7ab6cb[_0x8d8b('0x97')]||!_0x1dd258[_0x8d8b('0x99')])return _0x1dd258;authService[_0x8d8b('0x9a')](_0x28993f['body'][_0x8d8b('0x92')],_0x1dd258[_0x8d8b('0x99')],_0x7ab6cb[_0x8d8b('0x98')]);return _0x1dd258;})[_0x8d8b('0x23')](saveUpdates({'password':_0x28993f[_0x8d8b('0x60')][_0x8d8b('0x92')],'passwordResetAt':_0x28993f['user']['id']==_0x28993f[_0x8d8b('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x8d8b('0x9b')](_0x28993f['body'][_0x8d8b('0x92')],_0x1dd258['previousPasswords'])},null));})[_0x8d8b('0x23')](respondWithResult(_0x3d7821,null))[_0x8d8b('0x2d')](handleError(_0x3d7821,null));};exports[_0x8d8b('0x9c')]=function(_0x3c12ba,_0x2d38cc){var _0x14bc9f=_0x3c12ba['body']['channel'];return db['User'][_0x8d8b('0x3b')]({'where':{'id':_0x3c12ba['params']['id']},'attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0x32'),_0x8d8b('0x9d'),_0x8d8b('0x9e'),_0x8d8b('0x9f'),_0x8d8b('0xa0')]})[_0x8d8b('0x23')](handleEntityNotFound(_0x2d38cc,null))[_0x8d8b('0x23')](function(_0x212b1f){if(_0x212b1f){if(!utils[_0x8d8b('0xa1')](_0x14bc9f)){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0xa2'));}return _0x212b1f[_0x8d8b('0xa3')+_[_0x8d8b('0xa4')](_0x14bc9f[_0x8d8b('0xa5')]())+_0x8d8b('0xa6')](_0x3c12ba[_0x8d8b('0x60')][_0x8d8b('0x62')],{'penalty':_0x3c12ba[_0x8d8b('0x60')][_0x8d8b('0xa7')]||0x0})[_0x8d8b('0xa8')](function(_0x315ecc){for(var _0xe6c394=0x0;_0xe6c394<_0x3c12ba['body'][_0x8d8b('0x62')][_0x8d8b('0x53')];_0xe6c394+=0x1){var _0x1352dc={'UserId':Number(_0x3c12ba[_0x8d8b('0x5c')]['id'])};_0x1352dc[_[_0x8d8b('0xa4')](_0x14bc9f[_0x8d8b('0xa5')]())+_0x8d8b('0xa9')]=Number(_0x3c12ba[_0x8d8b('0x60')][_0x8d8b('0x62')][_0xe6c394]);socket[_0x8d8b('0x2f')](_0x8d8b('0x35')+_[_0x8d8b('0xa4')](_0x14bc9f[_0x8d8b('0xa5')]())+_0x8d8b('0xaa'),_0x1352dc);}return _0x315ecc;})[_0x8d8b('0x23')](function(){if(_0x14bc9f===_0x8d8b('0xab')){return db[_0x8d8b('0xac')][_0x8d8b('0x4f')]({'where':{'id':_0x3c12ba[_0x8d8b('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x8d8b('0x3c')]});}})[_0x8d8b('0x23')](function(_0x18af22){var _0x2fa70f=_0x212b1f[_0x8d8b('0xad')]({'plain':!![]});var _0x14fbce=[];if(_0x14bc9f===_0x8d8b('0xab')&&_0x2fa70f[_0x8d8b('0x32')]===_0x8d8b('0x2e')&&_0x2fa70f[_0x8d8b('0x9d')]){for(let _0x50e755=0x0;_0x50e755<_0x18af22['length'];_0x50e755+=0x1){_0x14fbce[_0x8d8b('0x55')]({'membername':_0x2fa70f[_0x8d8b('0x3c')],'UserId':_0x2fa70f['id'],'queue_name':_0x18af22[_0x50e755][_0x8d8b('0x3c')],'VoiceQueueId':_0x18af22[_0x50e755]['id'],'interface':_['isNil'](_0x2fa70f['interface'])?util[_0x8d8b('0xae')](_0x8d8b('0xaf'),_0x2fa70f[_0x8d8b('0x3c')]):_0x2fa70f[_0x8d8b('0xa0')],'paused':_0x2fa70f['voicePause']||![],'penalty':_0x3c12ba[_0x8d8b('0x60')][_0x8d8b('0xa7')]||0x0});}return Promise[_0x8d8b('0x5a')](_0x14fbce[_0x8d8b('0x3f')](function(_0x587cac){return db[_0x8d8b('0xb0')][_0x8d8b('0xb1')](_0x587cac);}));}return _0x212b1f;});}})[_0x8d8b('0x23')](respondWithStatusCode(_0x2d38cc,null))[_0x8d8b('0x2d')](handleError(_0x2d38cc,null));};exports[_0x8d8b('0xb2')]=function(_0x20244c,_0x1f1ce7){var _0x3df037,_0xbd91bc;return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x20244c[_0x8d8b('0x5c')]['id']},'attributes':['id',_0x8d8b('0x3c'),'role']})[_0x8d8b('0x23')](handleEntityNotFound(_0x1f1ce7,null))[_0x8d8b('0x23')](function(_0x16e77d){if(_0x16e77d){_0x3df037=_0x16e77d;if(!_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')]||!utils[_0x8d8b('0xa1')](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')])){throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0xa2'));}return _0x16e77d['remove'+_[_0x8d8b('0xa4')](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')]['toLowerCase']())+'Queues'](_0x20244c[_0x8d8b('0x49')]['ids']);}})[_0x8d8b('0x23')](function(_0x55343e){if(_[_0x8d8b('0xb4')](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0x62')])){for(var _0x31aa4f=0x0;_0x31aa4f<_0x20244c[_0x8d8b('0x49')][_0x8d8b('0x62')][_0x8d8b('0x53')];_0x31aa4f+=0x1){_0xbd91bc={'UserId':Number(_0x20244c[_0x8d8b('0x5c')]['id'])};_0xbd91bc[_[_0x8d8b('0xa4')](_0x20244c['query']['channel'][_0x8d8b('0xa5')]())+_0x8d8b('0xa9')]=Number(_0x20244c['query'][_0x8d8b('0x62')][_0x31aa4f]);socket['emit'](_0x8d8b('0x35')+_['capitalize'](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')][_0x8d8b('0xa5')]())+'Queue:remove',_0xbd91bc);}}else{_0xbd91bc={'UserId':Number(_0x20244c['params']['id'])};_0xbd91bc[_[_0x8d8b('0xa4')](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')]['toLowerCase']())+_0x8d8b('0xa9')]=Number(_0x20244c[_0x8d8b('0x49')][_0x8d8b('0x62')]);socket['emit']('user'+_[_0x8d8b('0xa4')](_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')][_0x8d8b('0xa5')]())+'Queue:remove',_0xbd91bc);}return _0x55343e;})[_0x8d8b('0x23')](function(){if(_0x20244c[_0x8d8b('0x49')][_0x8d8b('0xb3')]===_0x8d8b('0xab')){return db[_0x8d8b('0xb0')]['destroy']({'where':{'UserId':_0x20244c[_0x8d8b('0x5c')]['id'],'VoiceQueueId':_0x20244c[_0x8d8b('0x49')]['ids']},'individualHooks':!![]})[_0x8d8b('0x23')](function(){return _0x3df037;});}return _0x3df037;})[_0x8d8b('0x23')](respondWithStatusCode(_0x1f1ce7,null))[_0x8d8b('0x2d')](handleError(_0x1f1ce7,null));};exports[_0x8d8b('0xb5')]=function(_0x4541a0,_0x32f369){_0x4541a0[_0x8d8b('0x60')][_0x8d8b('0xb6')]=_0x4541a0[_0x8d8b('0xb7')]['filename'];return db[_0x8d8b('0x3e')]['find']({'where':{'id':_0x4541a0['params']['id']}})['then'](handleEntityNotFound(_0x32f369,null))[_0x8d8b('0x23')](saveUpdates(_0x4541a0[_0x8d8b('0x60')],null))['then'](respondWithResult(_0x32f369,null))['catch'](handleError(_0x32f369,null));};exports['getAvatar']=function(_0x92934e,_0x358dd0){var _0x4a7959=path[_0x8d8b('0xb8')](config[_0x8d8b('0xb9')],_0x8d8b('0xba'));return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x92934e[_0x8d8b('0x5c')]['id']},'attributes':['id',_0x8d8b('0xb6')],'raw':!![]})[_0x8d8b('0x23')](handleEntityNotFound(_0x358dd0,null))['then'](function(_0x5271be){if(_0x5271be){if(_[_0x8d8b('0x66')](_0x5271be['userpic'])){return _0x358dd0[_0x8d8b('0xbb')](_0x4a7959);}else{if(!fs[_0x8d8b('0xbc')](path['join'](config[_0x8d8b('0xb9')],_0x8d8b('0xbd'),_0x5271be[_0x8d8b('0xb6')]))){return _0x358dd0['download'](_0x4a7959);}return _0x358dd0[_0x8d8b('0xbb')](path[_0x8d8b('0xb8')](config[_0x8d8b('0xb9')],_0x8d8b('0xbd'),_0x5271be[_0x8d8b('0xb6')]));}}})[_0x8d8b('0x2d')](handleError(_0x358dd0,null));};exports[_0x8d8b('0xbe')]=function(_0x5a2709,_0x5df7e9){return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x5a2709[_0x8d8b('0x5c')]['id']},'attributes':['id']})[_0x8d8b('0x23')](handleEntityNotFound(_0x5df7e9,null))[_0x8d8b('0x23')](function(_0x556f3e){var _0xdc46b5=[];values=_0x556f3e['dataValues'];_0xdc46b5['push'](get_open_tabs(_0x8d8b('0xbf'),_0x556f3e['dataValues']));_0xdc46b5[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x5e'),_0x556f3e[_0x8d8b('0x54')]));_0xdc46b5[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x58'),_0x556f3e[_0x8d8b('0x54')]));_0xdc46b5[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x59'),_0x556f3e[_0x8d8b('0x54')]));_0xdc46b5['push'](get_open_tabs(_0x8d8b('0x56'),_0x556f3e[_0x8d8b('0x54')]));_0xdc46b5[_0x8d8b('0x55')](get_open_tabs(_0x8d8b('0x57'),_0x556f3e['dataValues']));return Promise[_0x8d8b('0x5a')](_0xdc46b5);})[_0x8d8b('0x23')](function(_0x5715ac){if(_0x5715ac){var _0x4f3ec7=_[_0x8d8b('0x3f')](values['ChatOpenTabs'],function(_0x2a8116){return{'channel':_0x8d8b('0xc0'),'id':_0x2a8116['id'],'createdAt':_0x2a8116[_0x8d8b('0xc1')]};});var _0x237584=_[_0x8d8b('0x3f')](values[_0x8d8b('0xc2')],function(_0x323736){return{'channel':_0x8d8b('0xc3'),'id':_0x323736['id'],'createdAt':_0x323736[_0x8d8b('0xc1')]};});var _0xb11876=_[_0x8d8b('0x3f')](values[_0x8d8b('0xc4')],function(_0x5cf845){return{'channel':_0x8d8b('0xc5'),'id':_0x5cf845['id'],'createdAt':_0x5cf845[_0x8d8b('0xc1')]};});var _0x17c6b7=_[_0x8d8b('0x3f')](values[_0x8d8b('0xc6')],function(_0x3aebc6){return{'channel':'MAIL','id':_0x3aebc6['id'],'createdAt':_0x3aebc6[_0x8d8b('0xc1')]};});var _0x26df57=_[_0x8d8b('0x3f')](values[_0x8d8b('0xc7')],function(_0x2cd2f5){return{'channel':_0x8d8b('0xc8'),'id':_0x2cd2f5['id'],'createdAt':_0x2cd2f5[_0x8d8b('0xc1')]};});var _0x4534c4=_[_0x8d8b('0x3f')](values[_0x8d8b('0xc9')],function(_0x43b209){return{'channel':_0x8d8b('0xca'),'id':_0x43b209['id'],'createdAt':_0x43b209[_0x8d8b('0xc1')]};});var _0x4d93b0=_[_0x8d8b('0xcb')](_0x4f3ec7,_0x237584,_0xb11876,_0x17c6b7,_0x26df57,_0x4534c4);var _0x22d29f={'count':_0x4d93b0[_0x8d8b('0x53')],'rows':_0x4d93b0};return _0x22d29f;}else return null;})['then'](respondWithResult(_0x5df7e9,null))[_0x8d8b('0x2d')](handleError(_0x5df7e9,null));};exports[_0x8d8b('0xcc')]=function(_0x27e22a,_0x37a1b1){var _0x2feb8e={};return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x27e22a[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](function(_0x18cccb){if(!_0x18cccb){throw new APINotFoundError(util[_0x8d8b('0xae')](_0x8d8b('0xcd'),_0x27e22a['params']['id']));}return contacts[_0x8d8b('0x61')]();})[_0x8d8b('0x23')](function(_0x1fb52c){_0x27e22a[_0x8d8b('0x49')][_0x8d8b('0x3e')]=_0x27e22a[_0x8d8b('0x5c')]['id'];_0x2feb8e=qs[_0x8d8b('0xce')](_0x1fb52c,_0x27e22a);if(_0x27e22a[_0x8d8b('0x49')]['hasOwnProperty'](_0x8d8b('0x4a'))){_0x2feb8e['include']=[{'model':db[_0x8d8b('0xcf')],'as':_0x8d8b('0xd0'),'required':![]},{'model':db[_0x8d8b('0xd1')],'as':'Tags','attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0xd2')],'where':_0x27e22a[_0x8d8b('0x49')][_0x8d8b('0xd3')]?{'id':_0x27e22a[_0x8d8b('0x49')][_0x8d8b('0xd3')]}:undefined,'required':_0x27e22a['query']['tag']?!![]:![]}];}return contacts[_0x8d8b('0x4f')](_0x27e22a[_0x8d8b('0x49')],_0x27e22a[_0x8d8b('0x35')],_0x2feb8e,_0x1fb52c);})[_0x8d8b('0x23')](respondWithFilteredResult(_0x37a1b1,_0x2feb8e))[_0x8d8b('0x2d')](APIHandleError(_0x37a1b1));};exports['getQueues']=function(_0x4872ab,_0x1df299){var _0x3bbdc1;var _0x31bf95={};var _0xc2eb07;return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x4872ab[_0x8d8b('0x5c')]['id']},'attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0x32')]})[_0x8d8b('0x23')](handleEntityNotFound(_0x1df299,null))[_0x8d8b('0x23')](function(_0x491549){if(!utils[_0x8d8b('0xa1')](_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0xb3')])){throw new db['Sequelize'][(_0x8d8b('0x8f'))](_0x8d8b('0xa2'));}_0x3bbdc1=_0x491549;var _0x41747c={};_0x41747c[_0x8d8b('0xd4')]=_['keys'](db[_[_0x8d8b('0xa4')](_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0xb3')])+_0x8d8b('0xd5')][_0x8d8b('0xd6')]);_0x41747c['query']=_['keys'](_0x4872ab[_0x8d8b('0x49')]);_0x41747c['filters']=_[_0x8d8b('0xd7')](_0x41747c[_0x8d8b('0xd4')],_0x41747c[_0x8d8b('0x49')]);_0x31bf95[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x41747c[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x4872ab['query'][_0x8d8b('0xd8')]));_0x31bf95['attributes']=_0x31bf95['attributes'][_0x8d8b('0x53')]?_0x31bf95[_0x8d8b('0x4e')]:_0x41747c[_0x8d8b('0xd4')];_0x31bf95[_0x8d8b('0xd9')]=qs['sort'](_0x4872ab['query'][_0x8d8b('0xda')]);_0x31bf95[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x4872ab[_0x8d8b('0x49')],_0x41747c[_0x8d8b('0xdc')]));if(_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x31bf95['where']=_[_0x8d8b('0x5d')](_0x31bf95[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x31bf95[_0x8d8b('0x4e')],function(_0x41c3bb){var _0x4d94bf={};_0x4d94bf[_0x41c3bb]={'$like':'%'+_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x4d94bf;})});}_0x31bf95=_[_0x8d8b('0x5d')]({},_0x31bf95,_0x4872ab['options']);switch(_0x3bbdc1[_0x8d8b('0x32')]){case'admin':return db[_['capitalize'](_0x4872ab[_0x8d8b('0x49')]['channel'])+'Queue'][_0x8d8b('0x4f')](_0x31bf95);case _0x8d8b('0x35'):case _0x8d8b('0x2e'):return _0x3bbdc1[_0x8d8b('0xad')+_[_0x8d8b('0xa4')](_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0xb3')])+_0x8d8b('0xa6')](_0x31bf95);default:throw new db[(_0x8d8b('0x8e'))][(_0x8d8b('0x8f'))](_0x8d8b('0xde'));}})[_0x8d8b('0x23')](function(_0x3b75c6){_0xc2eb07=_0x3b75c6[_0x8d8b('0x53')];if(!_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x31bf95[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x31bf95[_0x8d8b('0x1c')]=qs[_0x8d8b('0x1c')](_0x4872ab['query'][_0x8d8b('0x1c')]);}switch(_0x3bbdc1[_0x8d8b('0x32')]){case _0x8d8b('0x33'):return db[_[_0x8d8b('0xa4')](_0x4872ab['query']['channel'])+_0x8d8b('0xd5')]['findAll'](_0x31bf95);case'user':case _0x8d8b('0x2e'):return _0x3bbdc1[_0x8d8b('0xad')+_[_0x8d8b('0xa4')](_0x4872ab[_0x8d8b('0x49')][_0x8d8b('0xb3')])+'Queues'](_0x31bf95);}})[_0x8d8b('0x23')](function(_0x390400){return{'count':_0xc2eb07,'rows':_0x390400};})['then'](respondWithResult(_0x1df299,null))[_0x8d8b('0x2d')](handleError(_0x1df299,null));};exports[_0x8d8b('0xe1')]=function(_0x404727,_0x580802){var _0x197e60={};var _0x36d9b4={};var _0xe812cc;var _0x5e7e05;return db['User'][_0x8d8b('0x95')]({'where':{'id':_0x404727[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x580802,null))['then'](function(_0x56c557){if(_0x56c557){_0xe812cc=_0x56c557;_0x36d9b4[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xb0')]['rawAttributes']);_0x36d9b4[_0x8d8b('0x49')]=_[_0x8d8b('0xe2')](_0x404727[_0x8d8b('0x49')]);_0x36d9b4[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x36d9b4[_0x8d8b('0xd4')],_0x36d9b4[_0x8d8b('0x49')]);_0x197e60[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x36d9b4['model'],qs['fields'](_0x404727[_0x8d8b('0x49')][_0x8d8b('0xd8')]));_0x197e60[_0x8d8b('0x4e')]=_0x197e60['attributes'][_0x8d8b('0x53')]?_0x197e60[_0x8d8b('0x4e')]:_0x36d9b4[_0x8d8b('0xd4')];_0x197e60[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x404727['query'][_0x8d8b('0xda')]);_0x197e60['where']=qs[_0x8d8b('0xdc')](_['pick'](_0x404727[_0x8d8b('0x49')],_0x36d9b4[_0x8d8b('0xdc')]));if(_0x404727[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x197e60[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x197e60[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x197e60[_0x8d8b('0x4e')],function(_0x33e67a){var _0x2fb5fd={};_0x2fb5fd[_0x33e67a]={'$like':'%'+_0x404727[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x2fb5fd;})});}_0x197e60=_[_0x8d8b('0x5d')]({},_0x197e60,_0x404727[_0x8d8b('0xe3')]);return _0xe812cc['getVoiceQueuesRt'](_0x197e60);}})[_0x8d8b('0x23')](function(_0x3dfedc){if(_0x3dfedc){_0x5e7e05=_0x3dfedc[_0x8d8b('0x53')];if(!_0x404727[_0x8d8b('0x49')][_0x8d8b('0xdf')]('nolimit')){_0x197e60[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x404727[_0x8d8b('0x49')]['limit']);_0x197e60[_0x8d8b('0x1c')]=qs[_0x8d8b('0x1c')](_0x404727[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0xe812cc[_0x8d8b('0xe1')](_0x197e60);}})[_0x8d8b('0x23')](function(_0x2f0ddd){if(_0x2f0ddd){return _0x2f0ddd?{'count':_0x5e7e05,'rows':_0x2f0ddd}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x580802,null))['catch'](handleError(_0x580802,null));};exports[_0x8d8b('0xe4')]=function(_0x37affc,_0x36d117){var _0x34e61b={};var _0x415046={};var _0x3ad895;var _0x2cdaf2;return db['User'][_0x8d8b('0x95')]({'where':{'id':_0x37affc['params']['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x36d117,null))[_0x8d8b('0x23')](function(_0x1f8b9e){if(_0x1f8b9e){_0x3ad895=_0x1f8b9e;_0x415046[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xe5')][_0x8d8b('0xd6')]);_0x415046[_0x8d8b('0x49')]=_['keys'](_0x37affc[_0x8d8b('0x49')]);_0x415046['filters']=_[_0x8d8b('0xd7')](_0x415046[_0x8d8b('0xd4')],_0x415046['query']);_0x34e61b[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x415046[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x37affc[_0x8d8b('0x49')][_0x8d8b('0xd8')]));_0x34e61b[_0x8d8b('0x4e')]=_0x34e61b[_0x8d8b('0x4e')]['length']?_0x34e61b['attributes']:_0x415046[_0x8d8b('0xd4')];_0x34e61b['order']=qs[_0x8d8b('0xda')](_0x37affc[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x34e61b[_0x8d8b('0xdb')]=qs['filters'](_[_0x8d8b('0xdd')](_0x37affc[_0x8d8b('0x49')],_0x415046['filters']));if(_0x37affc[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x34e61b['where']=_['merge'](_0x34e61b[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x34e61b['attributes'],function(_0x34315f){var _0x20d3f9={};_0x20d3f9[_0x34315f]={'$like':'%'+_0x37affc[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x20d3f9;})});}_0x34e61b=_[_0x8d8b('0x5d')]({},_0x34e61b,_0x37affc['options']);return _0x3ad895['getGroups'](_0x34e61b);}})[_0x8d8b('0x23')](function(_0x3989b9){if(_0x3989b9){_0x2cdaf2=_0x3989b9['length'];if(!_0x37affc['query']['hasOwnProperty'](_0x8d8b('0xe0'))){_0x34e61b[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x37affc[_0x8d8b('0x49')]['limit']);_0x34e61b[_0x8d8b('0x1c')]=qs[_0x8d8b('0x1c')](_0x37affc[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0x3ad895[_0x8d8b('0xe4')](_0x34e61b);}})[_0x8d8b('0x23')](function(_0x509f36){if(_0x509f36){return _0x509f36?{'count':_0x2cdaf2,'rows':_0x509f36}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x36d117,null))[_0x8d8b('0x2d')](handleError(_0x36d117,null));};exports[_0x8d8b('0xe6')]=function(_0x51830e,_0xba80f1){var _0x2a37ba={'raw':!![],'where':{}};var _0x45e65b={};var _0x4c7f31={'count':0x0,'rows':[]};return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x51830e[_0x8d8b('0x5c')]['id']}})['then'](handleEntityNotFound(_0xba80f1,null))[_0x8d8b('0x23')](function(_0x2c0daf){if(_0x2c0daf){_0x45e65b[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xe7')][_0x8d8b('0xd6')]);_0x45e65b['query']=_[_0x8d8b('0xe2')](_0x51830e[_0x8d8b('0x49')]);_0x45e65b[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x45e65b[_0x8d8b('0xd4')],_0x45e65b[_0x8d8b('0x49')]);_0x2a37ba[_0x8d8b('0x4e')]=_['intersection'](_0x45e65b[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x51830e['query'][_0x8d8b('0xd8')]));_0x2a37ba[_0x8d8b('0x4e')]=_0x2a37ba[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x2a37ba['attributes']:_0x45e65b['model'];if(!_0x51830e[_0x8d8b('0x49')]['hasOwnProperty'](_0x8d8b('0xe0'))){_0x2a37ba[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x51830e['query'][_0x8d8b('0x1f')]);_0x2a37ba['offset']=qs[_0x8d8b('0x1c')](_0x51830e[_0x8d8b('0x49')]['offset']);}_0x2a37ba[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x51830e[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x2a37ba[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x51830e[_0x8d8b('0x49')],_0x45e65b['filters']));_0x2a37ba[_0x8d8b('0xdb')][_0x8d8b('0xe8')]=_0x2c0daf['id'];if(_0x51830e[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x2a37ba[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x2a37ba[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x2a37ba[_0x8d8b('0x4e')],function(_0x4c6f50){var _0x995d27={};_0x995d27[_0x4c6f50]={'$like':'%'+_0x51830e[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x995d27;})});}_0x2a37ba=_[_0x8d8b('0x5d')]({},_0x2a37ba,_0x51830e['options']);return db[_0x8d8b('0xe7')][_0x8d8b('0x1e')]({'where':_0x2a37ba[_0x8d8b('0xdb')]})[_0x8d8b('0x23')](function(_0x2e79ae){_0x4c7f31[_0x8d8b('0x1e')]=_0x2e79ae;if(_0x51830e['query'][_0x8d8b('0x4a')]){_0x2a37ba[_0x8d8b('0x4b')]=[{'all':!![]}];}return db[_0x8d8b('0xe7')][_0x8d8b('0x4f')](_0x2a37ba);})[_0x8d8b('0x23')](function(_0x1c2fcd){_0x4c7f31[_0x8d8b('0x50')]=_0x1c2fcd;return _0x4c7f31;});}})[_0x8d8b('0x23')](respondWithFilteredResult(_0xba80f1,_0x2a37ba))[_0x8d8b('0x2d')](handleError(_0xba80f1,null));};exports[_0x8d8b('0xe9')]=function(_0x195935,_0x5b8d95){var _0x2036cd={'raw':!![],'where':{}};var _0x4dee85={};var _0x542ddc={'count':0x0,'rows':[]};return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x195935[_0x8d8b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5b8d95,null))['then'](function(_0x4be7d3){if(_0x4be7d3){_0x4dee85[_0x8d8b('0xd4')]=_['keys'](db[_0x8d8b('0xea')][_0x8d8b('0xd6')]);_0x4dee85[_0x8d8b('0x49')]=_[_0x8d8b('0xe2')](_0x195935['query']);_0x4dee85[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x4dee85[_0x8d8b('0xd4')],_0x4dee85['query']);_0x2036cd[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x4dee85[_0x8d8b('0xd4')],qs['fields'](_0x195935['query']['fields']));_0x2036cd[_0x8d8b('0x4e')]=_0x2036cd[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x2036cd['attributes']:_0x4dee85['model'];if(!_0x195935['query']['hasOwnProperty'](_0x8d8b('0xe0'))){_0x2036cd[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x195935[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x2036cd['offset']=qs['offset'](_0x195935[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}_0x2036cd[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x195935[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x2036cd[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x195935[_0x8d8b('0x49')],_0x4dee85[_0x8d8b('0xdc')]));_0x2036cd[_0x8d8b('0xdb')][_0x8d8b('0xe8')]=_0x4be7d3['id'];if(_0x195935[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x2036cd[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x2036cd[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x2036cd[_0x8d8b('0x4e')],function(_0x52d896){var _0x1fc822={};_0x1fc822[_0x52d896]={'$like':'%'+_0x195935[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x1fc822;})});}_0x2036cd=_[_0x8d8b('0x5d')]({},_0x2036cd,_0x195935[_0x8d8b('0xe3')]);return db[_0x8d8b('0xea')]['count']({'where':_0x2036cd['where']})[_0x8d8b('0x23')](function(_0x2744f7){_0x542ddc[_0x8d8b('0x1e')]=_0x2744f7;if(_0x195935[_0x8d8b('0x49')][_0x8d8b('0x4a')]){_0x2036cd[_0x8d8b('0x4b')]=[{'all':!![]}];}return db[_0x8d8b('0xea')]['findAll'](_0x2036cd);})['then'](function(_0x2115a0){_0x542ddc[_0x8d8b('0x50')]=_0x2115a0;return _0x542ddc;});}})['then'](respondWithFilteredResult(_0x5b8d95,_0x2036cd))[_0x8d8b('0x2d')](handleError(_0x5b8d95,null));};exports['getChatInteractions']=function(_0x17754b,_0x21a882){var _0x2eae8e={};var _0x11d5d8={};var _0x526c95;var _0x5e0bd5;return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x17754b[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x21a882,null))[_0x8d8b('0x23')](function(_0x9962e){if(_0x9962e){_0x526c95=_0x9962e;_0x11d5d8[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xeb')][_0x8d8b('0xd6')]);_0x11d5d8['query']=_[_0x8d8b('0xe2')](_0x17754b['query']);_0x11d5d8['filters']=_[_0x8d8b('0xd7')](_0x11d5d8[_0x8d8b('0xd4')],_0x11d5d8['query']);_0x2eae8e[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x11d5d8[_0x8d8b('0xd4')],qs['fields'](_0x17754b[_0x8d8b('0x49')][_0x8d8b('0xd8')]));_0x2eae8e[_0x8d8b('0x4e')]=_0x2eae8e['attributes'][_0x8d8b('0x53')]?_0x2eae8e[_0x8d8b('0x4e')]:_0x11d5d8[_0x8d8b('0xd4')];_0x2eae8e[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x17754b[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x2eae8e[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x17754b[_0x8d8b('0x49')],_0x11d5d8['filters']));if(_0x17754b[_0x8d8b('0x49')]['filter']){_0x2eae8e['where']=_['merge'](_0x2eae8e[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x2eae8e[_0x8d8b('0x4e')],function(_0x4678eb){var _0x417485={};_0x417485[_0x4678eb]={'$like':'%'+_0x17754b[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x417485;})});}_0x2eae8e=_[_0x8d8b('0x5d')]({},_0x2eae8e,_0x17754b[_0x8d8b('0xe3')]);return _0x526c95[_0x8d8b('0xec')](_0x2eae8e);}})['then'](function(_0x445f2f){if(_0x445f2f){_0x5e0bd5=_0x445f2f[_0x8d8b('0x53')];if(!_0x17754b[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x2eae8e[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x17754b[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x2eae8e['offset']=qs[_0x8d8b('0x1c')](_0x17754b['query'][_0x8d8b('0x1c')]);}return _0x526c95[_0x8d8b('0xec')](_0x2eae8e);}})[_0x8d8b('0x23')](function(_0x3b4293){if(_0x3b4293){return _0x3b4293?{'count':_0x5e0bd5,'rows':_0x3b4293}:null;}})['then'](respondWithResult(_0x21a882,null))['catch'](handleError(_0x21a882,null));};exports['getOpenchannelInteractions']=function(_0x5532e1,_0x54225f){var _0x2c29c6={};var _0x3ffa13={};var _0x59f0c9;var _0x4b1a76;return db['User']['findOne']({'where':{'id':_0x5532e1[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x54225f,null))['then'](function(_0x5efcd6){if(_0x5efcd6){_0x59f0c9=_0x5efcd6;_0x3ffa13['model']=_[_0x8d8b('0xe2')](db[_0x8d8b('0xed')][_0x8d8b('0xd6')]);_0x3ffa13['query']=_[_0x8d8b('0xe2')](_0x5532e1['query']);_0x3ffa13[_0x8d8b('0xdc')]=_['intersection'](_0x3ffa13['model'],_0x3ffa13[_0x8d8b('0x49')]);_0x2c29c6['attributes']=_[_0x8d8b('0xd7')](_0x3ffa13[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x5532e1[_0x8d8b('0x49')]['fields']));_0x2c29c6[_0x8d8b('0x4e')]=_0x2c29c6[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x2c29c6[_0x8d8b('0x4e')]:_0x3ffa13['model'];_0x2c29c6['order']=qs[_0x8d8b('0xda')](_0x5532e1['query'][_0x8d8b('0xda')]);_0x2c29c6[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x5532e1[_0x8d8b('0x49')],_0x3ffa13[_0x8d8b('0xdc')]));if(_0x5532e1[_0x8d8b('0x49')]['filter']){_0x2c29c6['where']=_['merge'](_0x2c29c6[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x2c29c6[_0x8d8b('0x4e')],function(_0x2fc802){var _0x20075a={};_0x20075a[_0x2fc802]={'$like':'%'+_0x5532e1[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x20075a;})});}_0x2c29c6=_[_0x8d8b('0x5d')]({},_0x2c29c6,_0x5532e1[_0x8d8b('0xe3')]);return _0x59f0c9[_0x8d8b('0xee')](_0x2c29c6);}})[_0x8d8b('0x23')](function(_0x150ee6){if(_0x150ee6){_0x4b1a76=_0x150ee6[_0x8d8b('0x53')];if(!_0x5532e1[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x2c29c6['limit']=qs[_0x8d8b('0x1f')](_0x5532e1[_0x8d8b('0x49')]['limit']);_0x2c29c6['offset']=qs[_0x8d8b('0x1c')](_0x5532e1[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0x59f0c9['getOpenchannelInteractions'](_0x2c29c6);}})[_0x8d8b('0x23')](function(_0x214403){if(_0x214403){return _0x214403?{'count':_0x4b1a76,'rows':_0x214403}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x54225f,null))[_0x8d8b('0x2d')](handleError(_0x54225f,null));};exports['getMailInteractions']=function(_0x268399,_0x2fe885){var _0x1b9efa={'raw':!![],'where':{}};var _0x31e6ab={};var _0x194674={'count':0x0,'rows':[]};return db['User'][_0x8d8b('0x95')]({'where':{'id':_0x268399[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x2fe885,null))[_0x8d8b('0x23')](function(_0x479820){if(_0x479820){_0x31e6ab[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xef')][_0x8d8b('0xd6')]);_0x31e6ab[_0x8d8b('0x49')]=_[_0x8d8b('0xe2')](_0x268399[_0x8d8b('0x49')]);_0x31e6ab['filters']=_['intersection'](_0x31e6ab[_0x8d8b('0xd4')],_0x31e6ab['query']);_0x1b9efa[_0x8d8b('0x4e')]=_['intersection'](_0x31e6ab[_0x8d8b('0xd4')],qs['fields'](_0x268399['query'][_0x8d8b('0xd8')]));_0x1b9efa[_0x8d8b('0x4e')]=_0x1b9efa[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x1b9efa['attributes']:_0x31e6ab[_0x8d8b('0xd4')];if(!_0x268399[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x1b9efa[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x268399[_0x8d8b('0x49')]['limit']);_0x1b9efa[_0x8d8b('0x1c')]=qs['offset'](_0x268399[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}_0x1b9efa[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x268399['query'][_0x8d8b('0xda')]);_0x1b9efa['where']=qs[_0x8d8b('0xdc')](_['pick'](_0x268399['query'],_0x31e6ab[_0x8d8b('0xdc')]));_0x1b9efa[_0x8d8b('0xdb')][_0x8d8b('0xe8')]=_0x479820['id'];if(_0x268399[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x1b9efa['where']=_[_0x8d8b('0x5d')](_0x1b9efa[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x1b9efa[_0x8d8b('0x4e')],function(_0x4710ed){var _0x1f969d={};_0x1f969d[_0x4710ed]={'$like':'%'+_0x268399[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x1f969d;})});}_0x1b9efa=_[_0x8d8b('0x5d')]({},_0x1b9efa,_0x268399[_0x8d8b('0xe3')]);return db[_0x8d8b('0xef')][_0x8d8b('0x1e')]({'where':_0x1b9efa[_0x8d8b('0xdb')]})[_0x8d8b('0x23')](function(_0x33a258){_0x194674['count']=_0x33a258;if(_0x268399[_0x8d8b('0x49')][_0x8d8b('0x4a')]){_0x1b9efa[_0x8d8b('0x4b')]=[{'all':!![]}];}return db[_0x8d8b('0xef')][_0x8d8b('0x4f')](_0x1b9efa);})[_0x8d8b('0x23')](function(_0x195a8c){_0x194674[_0x8d8b('0x50')]=_0x195a8c;return _0x194674;});}})[_0x8d8b('0x23')](respondWithFilteredResult(_0x2fe885,_0x1b9efa))[_0x8d8b('0x2d')](handleError(_0x2fe885,null));};exports[_0x8d8b('0xf0')]=function(_0x26032b,_0x7c0ad6){var _0x527e94={};var _0x20ba48={};var _0x557b40;var _0x35d217;return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x26032b['params']['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x7c0ad6,null))[_0x8d8b('0x23')](function(_0x490974){if(_0x490974){_0x557b40=_0x490974;_0x20ba48['model']=_[_0x8d8b('0xe2')](db[_0x8d8b('0xf1')][_0x8d8b('0xd6')]);_0x20ba48[_0x8d8b('0x49')]=_[_0x8d8b('0xe2')](_0x26032b[_0x8d8b('0x49')]);_0x20ba48['filters']=_[_0x8d8b('0xd7')](_0x20ba48[_0x8d8b('0xd4')],_0x20ba48[_0x8d8b('0x49')]);_0x527e94['attributes']=_[_0x8d8b('0xd7')](_0x20ba48[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x26032b['query']['fields']));_0x527e94['attributes']=_0x527e94[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x527e94[_0x8d8b('0x4e')]:_0x20ba48[_0x8d8b('0xd4')];_0x527e94[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x26032b['query']['sort']);_0x527e94[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x26032b[_0x8d8b('0x49')],_0x20ba48['filters']));if(_0x26032b['query'][_0x8d8b('0x38')]){_0x527e94[_0x8d8b('0xdb')]=_['merge'](_0x527e94[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x527e94[_0x8d8b('0x4e')],function(_0xfac0f4){var _0x2e56e0={};_0x2e56e0[_0xfac0f4]={'$like':'%'+_0x26032b[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x2e56e0;})});}_0x527e94=_[_0x8d8b('0x5d')]({},_0x527e94,_0x26032b[_0x8d8b('0xe3')]);return _0x557b40[_0x8d8b('0xf0')](_0x527e94);}})[_0x8d8b('0x23')](function(_0x5e98ba){if(_0x5e98ba){_0x35d217=_0x5e98ba[_0x8d8b('0x53')];if(!_0x26032b[_0x8d8b('0x49')]['hasOwnProperty']('nolimit')){_0x527e94[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x26032b[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x527e94[_0x8d8b('0x1c')]=qs['offset'](_0x26032b[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0x557b40[_0x8d8b('0xf0')](_0x527e94);}})[_0x8d8b('0x23')](function(_0x2657c9){if(_0x2657c9){return _0x2657c9?{'count':_0x35d217,'rows':_0x2657c9}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x7c0ad6,null))['catch'](handleError(_0x7c0ad6,null));};exports[_0x8d8b('0xf2')]=function(_0x2290af,_0x22d7c0){var _0x509eb2={};var _0x3b6667={};var _0x197b5b;var _0x41eb6c;return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x2290af['params']['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x22d7c0,null))['then'](function(_0x3f9147){if(_0x3f9147){_0x197b5b=_0x3f9147;_0x3b6667[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xf3')]['rawAttributes']);_0x3b6667[_0x8d8b('0x49')]=_['keys'](_0x2290af['query']);_0x3b6667[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x3b6667[_0x8d8b('0xd4')],_0x3b6667[_0x8d8b('0x49')]);_0x509eb2[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x3b6667[_0x8d8b('0xd4')],qs['fields'](_0x2290af[_0x8d8b('0x49')]['fields']));_0x509eb2[_0x8d8b('0x4e')]=_0x509eb2[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x509eb2[_0x8d8b('0x4e')]:_0x3b6667[_0x8d8b('0xd4')];_0x509eb2[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x2290af[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x509eb2[_0x8d8b('0xdb')]=qs['filters'](_['pick'](_0x2290af[_0x8d8b('0x49')],_0x3b6667['filters']));if(_0x2290af[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x509eb2['where']=_[_0x8d8b('0x5d')](_0x509eb2[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x509eb2[_0x8d8b('0x4e')],function(_0x22c025){var _0x4c9217={};_0x4c9217[_0x22c025]={'$like':'%'+_0x2290af[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x4c9217;})});}_0x509eb2=_[_0x8d8b('0x5d')]({},_0x509eb2,_0x2290af['options']);return _0x197b5b['getFaxInteractions'](_0x509eb2);}})['then'](function(_0x155622){if(_0x155622){_0x41eb6c=_0x155622['length'];if(!_0x2290af[_0x8d8b('0x49')]['hasOwnProperty']('nolimit')){_0x509eb2['limit']=qs['limit'](_0x2290af[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x509eb2['offset']=qs[_0x8d8b('0x1c')](_0x2290af['query'][_0x8d8b('0x1c')]);}return _0x197b5b[_0x8d8b('0xf2')](_0x509eb2);}})[_0x8d8b('0x23')](function(_0x5b575e){if(_0x5b575e){return _0x5b575e?{'count':_0x41eb6c,'rows':_0x5b575e}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x22d7c0,null))[_0x8d8b('0x2d')](handleError(_0x22d7c0,null));};exports[_0x8d8b('0xf4')]=function(_0x48e8af,_0x57b436){var _0x4d8a1e={};var _0x28bbb0={};var _0x102a08;var _0x27e0b9;return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x48e8af[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x57b436,null))[_0x8d8b('0x23')](function(_0x2c03c2){if(_0x2c03c2){_0x102a08=_0x2c03c2;_0x28bbb0[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0xf5')][_0x8d8b('0xd6')]);_0x28bbb0['query']=_[_0x8d8b('0xe2')](_0x48e8af['query']);_0x28bbb0[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x28bbb0[_0x8d8b('0xd4')],_0x28bbb0[_0x8d8b('0x49')]);_0x4d8a1e['attributes']=_[_0x8d8b('0xd7')](_0x28bbb0[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x48e8af[_0x8d8b('0x49')][_0x8d8b('0xd8')]));_0x4d8a1e['attributes']=_0x4d8a1e['attributes']['length']?_0x4d8a1e[_0x8d8b('0x4e')]:_0x28bbb0['model'];_0x4d8a1e[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x48e8af[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x4d8a1e[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_[_0x8d8b('0xdd')](_0x48e8af[_0x8d8b('0x49')],_0x28bbb0[_0x8d8b('0xdc')]));if(_0x48e8af[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x4d8a1e[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x4d8a1e[_0x8d8b('0xdb')],{'$or':_[_0x8d8b('0x3f')](_0x4d8a1e['attributes'],function(_0x119e4c){var _0x233b2e={};_0x233b2e[_0x119e4c]={'$like':'%'+_0x48e8af[_0x8d8b('0x49')]['filter']+'%'};return _0x233b2e;})});}_0x4d8a1e=_[_0x8d8b('0x5d')]({},_0x4d8a1e,_0x48e8af[_0x8d8b('0xe3')]);return _0x102a08[_0x8d8b('0xf4')](_0x4d8a1e);}})[_0x8d8b('0x23')](function(_0x39755b){if(_0x39755b){_0x27e0b9=_0x39755b['length'];if(!_0x48e8af[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x4d8a1e[_0x8d8b('0x1f')]=qs['limit'](_0x48e8af['query'][_0x8d8b('0x1f')]);_0x4d8a1e['offset']=qs[_0x8d8b('0x1c')](_0x48e8af[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0x102a08[_0x8d8b('0xf4')](_0x4d8a1e);}})[_0x8d8b('0x23')](function(_0x47ebad){if(_0x47ebad){return _0x47ebad?{'count':_0x27e0b9,'rows':_0x47ebad}:null;}})[_0x8d8b('0x23')](respondWithResult(_0x57b436,null))['catch'](handleError(_0x57b436,null));};exports[_0x8d8b('0xf6')]=function(_0x20b878,_0x10d278,_0x36168e){var _0x1aaa71;var _0x1c5122;var _0x3c25eb;var _0x49c5a4=!_[_0x8d8b('0x66')](_0x20b878['params']['id'])?_0x20b878['params']['id']:!_['isNil'](_0x20b878[_0x8d8b('0x35')]['id'])?_0x20b878[_0x8d8b('0x35')]['id']:null;return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x49c5a4,'role':{'$or':[_0x8d8b('0x33'),_0x8d8b('0x35'),_0x8d8b('0x2e')]}},'attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0xf7'),'mobile',_0x8d8b('0x32'),_0x8d8b('0x63'),_0x8d8b('0x9e')]})[_0x8d8b('0x23')](function(_0x59cd7b){if(_0x59cd7b){if(_0x59cd7b[_0x8d8b('0x32')]==='agent'){_0x1aaa71=_0x59cd7b;if(_0x20b878[_0x8d8b('0x60')][_0x8d8b('0xa0')]){_0x3c25eb=util[_0x8d8b('0xae')](_0x8d8b('0xf8'),_0x1aaa71[_0x20b878[_0x8d8b('0x60')][_0x8d8b('0xa0')]]);}else if(_0x20b878[_0x8d8b('0x60')][_0x8d8b('0xf9')]){_0x3c25eb=util[_0x8d8b('0xae')](_0x8d8b('0xaf'),_0x20b878[_0x8d8b('0x60')][_0x8d8b('0xf9')]);}else{_0x3c25eb=util['format'](_0x8d8b('0xaf'),_0x1aaa71['name']);}socket['to'](util[_0x8d8b('0xae')](_0x8d8b('0xfa'),_0x1aaa71['name']))['emit'](_0x8d8b('0xfb'),{'user':{'id':_0x1aaa71['id'],'name':_0x1aaa71['name']},'ip':_0x20b878['headers'][_0x8d8b('0xfc')]||_0x20b878[_0x8d8b('0xfd')][_0x8d8b('0xfe')]||_0x20b878[_0x8d8b('0xff')][_0x8d8b('0xfe')]||_0x20b878[_0x8d8b('0xfd')][_0x8d8b('0xff')]['remoteAddress']});return db[_0x8d8b('0xb0')][_0x8d8b('0x31')]({'where':{'membername':_0x1aaa71[_0x8d8b('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x8d8b('0x8f'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x8d8b('0x23')](function(){if(_0x1aaa71){return _0x1aaa71['getVoiceQueues']({'raw':!![]});}})[_0x8d8b('0x23')](function(_0x7eb5ea){if(_0x1aaa71){if(_0x7eb5ea){_0x1c5122=_0x7eb5ea;if(_0x1c5122[_0x8d8b('0x53')]){var _0x9be57f=_0x1c5122[_0x8d8b('0x3f')](function(_0x59c9a3){var _0x101e7c={'membername':_0x1aaa71[_0x8d8b('0x3c')],'UserId':_0x1aaa71['id'],'queue_name':_0x59c9a3[_0x8d8b('0x3c')],'VoiceQueueId':_0x59c9a3['id'],'interface':_0x3c25eb,'paused':_0x1aaa71['loginInPause']||![],'penalty':_0x59c9a3[_0x8d8b('0x100')]||0x0};return db[_0x8d8b('0xb0')]['upsert'](_0x101e7c);});return Promise[_0x8d8b('0x5a')](_0x9be57f);}}}})[_0x8d8b('0x23')](function(){if(_0x1aaa71){return db[_0x8d8b('0x101')][_0x8d8b('0x4f')]({'where':{'membername':_0x1aaa71['name'],'exitAt':null}});}})[_0x8d8b('0x23')](function(_0x405dca){if(_0x1aaa71){var _0x2ff579=[];_0x405dca[_0x8d8b('0x102')](function(_0x3138c3){_0x2ff579['push'](_0x3138c3[_0x8d8b('0x5f')]({'exitAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103'))}));});return Promise[_0x8d8b('0x5a')](_0x2ff579);}})[_0x8d8b('0x23')](function(){if(_0x1aaa71){var _0x1bac74=[];var _0x3d172f=[];var _0x2a1f82=utils['getChannels']();var _0x2e972a={'membername':_0x1aaa71[_0x8d8b('0x3c')],'interface':_0x3c25eb,'enterAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103')),'role':_0x1aaa71[_0x8d8b('0x32')],'internal':_0x1aaa71[_0x8d8b('0x63')]};_0x2a1f82[_0x8d8b('0x102')](function(_0x21d6f2){_0x1bac74['push'](_[_0x8d8b('0x5d')]({'channel':_0x21d6f2,'type':_0x8d8b('0x104'),'data1':_0x20b878[_0x8d8b('0x60')][_0x8d8b('0x105')],'data2':_0x3c25eb},_0x2e972a));if(_0x1aaa71[_0x8d8b('0x9e')]){_0x3d172f['push'](_[_0x8d8b('0x5d')]({'channel':_0x21d6f2,'type':'PAUSE','data1':'LOGININPAUSE'},_0x2e972a));}});return db[_0x8d8b('0x101')][_0x8d8b('0x88')](_0x1bac74[_0x8d8b('0xcb')](_0x3d172f),{'individualHooks':!![]});}})[_0x8d8b('0x23')](function(){if(_0x1aaa71){return _0x1aaa71['update']({'online':!![],'lastLoginAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103')),'voicePause':_0x1aaa71[_0x8d8b('0x9e')]||![],'mailPause':_0x1aaa71['loginInPause']||![],'chatPause':_0x1aaa71[_0x8d8b('0x9e')]||![],'faxPause':_0x1aaa71[_0x8d8b('0x9e')]||![],'smsPause':_0x1aaa71[_0x8d8b('0x9e')]||![],'openchannelPause':_0x1aaa71[_0x8d8b('0x9e')]||![],'whatsappPause':_0x1aaa71[_0x8d8b('0x9e')]||![],'pauseType':_0x1aaa71['loginInPause']?_0x8d8b('0x106'):null,'interface':_0x3c25eb,'lastPauseAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103'))});}})[_0x8d8b('0x23')](function(_0xf7806a){if(_0x20b878[_0x8d8b('0x107')]){return _0x36168e();}else{return Promise[_0x8d8b('0x108')](_0xf7806a)[_0x8d8b('0x23')](respondWithResult(_0x10d278,null));}})[_0x8d8b('0x2d')](handleError(_0x10d278,null));};exports[_0x8d8b('0x109')]=function(_0x14d4fa,_0x36f16c){var _0x3882ef;return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x14d4fa[_0x8d8b('0x5c')]['id'],'role':_0x8d8b('0x2e')},'attributes':['id','name',_0x8d8b('0x32')]})[_0x8d8b('0x23')](handleEntityNotFound(_0x36f16c,null))[_0x8d8b('0x23')](function(_0x451166){if(_0x451166){_0x3882ef=_0x451166;return db[_0x8d8b('0xb0')]['destroy']({'where':{'membername':_0x3882ef[_0x8d8b('0x3c')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3882ef[_0x8d8b('0x3c')],'exitAt':null}});})[_0x8d8b('0x23')](function(_0x346f2d){var _0x5279a9=[];_0x346f2d[_0x8d8b('0x102')](function(_0x54a5e9){_0x5279a9['push'](_0x54a5e9[_0x8d8b('0x5f')]({'exitAt':moment()[_0x8d8b('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x5279a9);})['then'](function(){return _0x3882ef[_0x8d8b('0x5f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8d8b('0x23')](respondWithResult(_0x36f16c,null))['catch'](handleError(_0x36f16c,null));};exports[_0x8d8b('0x10a')]=function(_0x1e12f3,_0x30f6d3){var _0x39aa70;return db[_0x8d8b('0xb0')]['update']({'paused':0x1},{'where':{'UserId':_0x1e12f3[_0x8d8b('0x5c')]['id']},'individualHooks':!![]})[_0x8d8b('0x23')](function(){return db['User'][_0x8d8b('0x3b')]({'where':{'id':_0x1e12f3[_0x8d8b('0x5c')]['id'],'role':'agent'},'attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0x32'),'internal',_0x8d8b('0xa0'),_0x8d8b('0x9d')]});})['then'](handleEntityNotFound(_0x30f6d3,null))[_0x8d8b('0x23')](function(_0x1188aa){if(_0x1188aa){_0x39aa70=_0x1188aa;return respondWithRpcPromise('QueuePause',_0x8d8b('0x10a'),{'id':_0x39aa70['id'],'name':_0x39aa70['name'],'pause':!![]});}})[_0x8d8b('0x23')](function(){if(_0x39aa70){return db[_0x8d8b('0x101')][_0x8d8b('0x4f')]({'where':{'membername':_0x39aa70[_0x8d8b('0x3c')],'type':_0x8d8b('0x10b'),'exitAt':null}});}})[_0x8d8b('0x23')](function(_0x2b372b){if(_0x2b372b[_0x8d8b('0x53')]){var _0x4e6c4d=moment()[_0x8d8b('0xae')](_0x8d8b('0x103'));for(var _0x51946a=0x0,_0x29ceaf=_0x2b372b[_0x8d8b('0x53')];_0x51946a<_0x29ceaf;_0x51946a++){_0x2b372b[_0x51946a][_0x8d8b('0x10c')]({'exitAt':_0x4e6c4d});}}})[_0x8d8b('0x23')](function(){var _0x36a196=[];var _0x357a57=utils[_0x8d8b('0x10d')]();_0x357a57[_0x8d8b('0x102')](function(_0x3bf4b3){_0x36a196[_0x8d8b('0x55')]({'channel':_0x3bf4b3,'membername':_0x39aa70[_0x8d8b('0x3c')],'interface':_[_0x8d8b('0x66')](_0x39aa70[_0x8d8b('0xa0')])?util['format']('SIP/%s',_0x39aa70[_0x8d8b('0x3c')]):_0x39aa70[_0x8d8b('0xa0')],'type':_0x8d8b('0x10b'),'enterAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103')),'data1':_0x1e12f3[_0x8d8b('0x60')][_0x8d8b('0x41')]||_0x8d8b('0x10e'),'role':_0x39aa70['role'],'internal':_0x39aa70[_0x8d8b('0x63')]});});return db[_0x8d8b('0x101')][_0x8d8b('0x88')](_0x36a196,{'individualHooks':!![]});})[_0x8d8b('0x23')](function(){return _0x39aa70['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1e12f3[_0x8d8b('0x60')][_0x8d8b('0x41')]||_0x8d8b('0x10e'),'lastPauseAt':moment()[_0x8d8b('0xae')](_0x8d8b('0x103'))});})['then'](respondWithResult(_0x30f6d3,null))[_0x8d8b('0x2d')](handleError(_0x30f6d3,null));};exports[_0x8d8b('0x10f')]=function(_0x424138,_0x9b0000){if(_0x424138[_0x8d8b('0x60')][_0x8d8b('0xb3')]&&!utils[_0x8d8b('0xa1')](_0x424138['body'][_0x8d8b('0xb3')])){throw new APIBadRequestError(util[_0x8d8b('0xae')](_0x8d8b('0x110'),_0x424138[_0x8d8b('0x60')][_0x8d8b('0xb3')]));}return db[_0x8d8b('0x3e')][_0x8d8b('0x3b')]({'where':{'id':_0x424138['params']['id']},'attributes':['id',_0x8d8b('0x3c'),_0x8d8b('0x32'),_0x8d8b('0x63'),_0x8d8b('0xa0'),'online',_0x8d8b('0x9f'),_0x8d8b('0x111'),_0x8d8b('0x112'),'faxPause',_0x8d8b('0x113'),'smsPause',_0x8d8b('0x114'),_0x8d8b('0x115'),_0x8d8b('0x116')]})[_0x8d8b('0x23')](function(_0x4ed7f5){if(!_0x4ed7f5){throw new APINotFoundError(util[_0x8d8b('0xae')](_0x8d8b('0xcd'),_0x424138['params']['id']));}return _0x4ed7f5[_0x8d8b('0x10f')](_0x424138['body'][_0x8d8b('0xb3')]);})[_0x8d8b('0x23')](respondWithResult(_0x9b0000,null))['catch'](APIHandleError(_0x9b0000));};exports['getTeams']=function(_0x55f7ad,_0x3c1e44){var _0x53579d={};var _0x29402d={};var _0x52c4a9;var _0x4e8287;return db['User']['findOne']({'where':{'id':_0x55f7ad[_0x8d8b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c1e44,null))['then'](function(_0xadc30e){if(_0xadc30e){_0x52c4a9=_0xadc30e;_0x29402d['model']=_[_0x8d8b('0xe2')](db[_0x8d8b('0x117')][_0x8d8b('0xd6')]);_0x29402d[_0x8d8b('0x49')]=_[_0x8d8b('0xe2')](_0x55f7ad['query']);_0x29402d['filters']=_[_0x8d8b('0xd7')](_0x29402d['model'],_0x29402d[_0x8d8b('0x49')]);_0x53579d[_0x8d8b('0x4e')]=_[_0x8d8b('0xd7')](_0x29402d[_0x8d8b('0xd4')],qs['fields'](_0x55f7ad['query']['fields']));_0x53579d['attributes']=_0x53579d['attributes'][_0x8d8b('0x53')]?_0x53579d[_0x8d8b('0x4e')]:_0x29402d[_0x8d8b('0xd4')];_0x53579d[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x55f7ad[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x53579d[_0x8d8b('0xdb')]=qs['filters'](_[_0x8d8b('0xdd')](_0x55f7ad[_0x8d8b('0x49')],_0x29402d[_0x8d8b('0xdc')]));if(_0x55f7ad[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x53579d[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x53579d[_0x8d8b('0xdb')],{'$or':_['map'](_0x53579d[_0x8d8b('0x4e')],function(_0x4cd00e){var _0x5149ed={};_0x5149ed[_0x4cd00e]={'$like':'%'+_0x55f7ad['query'][_0x8d8b('0x38')]+'%'};return _0x5149ed;})});}_0x53579d=_[_0x8d8b('0x5d')]({},_0x53579d,_0x55f7ad[_0x8d8b('0xe3')]);return _0x52c4a9[_0x8d8b('0x118')](_0x53579d);}})[_0x8d8b('0x23')](function(_0x1be70d){if(_0x1be70d){_0x4e8287=_0x1be70d[_0x8d8b('0x53')];if(!_0x55f7ad[_0x8d8b('0x49')][_0x8d8b('0xdf')](_0x8d8b('0xe0'))){_0x53579d[_0x8d8b('0x1f')]=qs['limit'](_0x55f7ad[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x53579d[_0x8d8b('0x1c')]=qs['offset'](_0x55f7ad[_0x8d8b('0x49')][_0x8d8b('0x1c')]);}return _0x52c4a9[_0x8d8b('0x118')](_0x53579d);}})['then'](function(_0x175ce3){if(_0x175ce3){return _0x175ce3?{'count':_0x4e8287,'rows':_0x175ce3}:null;}})['then'](respondWithResult(_0x3c1e44,null))[_0x8d8b('0x2d')](handleError(_0x3c1e44,null));};exports['addTeams']=function(_0x782e1a,_0x1b6e06){var _0x30403a=_0x782e1a[_0x8d8b('0x5c')]['id'];var _0x196382=_0x782e1a['body']?_0x782e1a[_0x8d8b('0x60')][_0x8d8b('0x62')]:null;var _0x552099=[];return Promise[_0x8d8b('0x108')]()['then'](function(){if(!_0x196382)throw new APIBadRequestError(_0x8d8b('0x119'));})['then'](function(){return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x30403a}});})['then'](function(_0x278c03){if(!_0x278c03)throw new APINotFoundError(util[_0x8d8b('0xae')]('User\x20with\x20id\x20%s\x20not\x20found',_0x782e1a[_0x8d8b('0x5c')]['id']));return db[_0x8d8b('0x68')]['transaction'](function(_0x29fbab){return _0x278c03['addTeams'](_0x196382,{'transaction':_0x29fbab})[_0x8d8b('0x23')](function(){return db[_0x8d8b('0x117')][_0x8d8b('0x4f')]({'where':{'id':{'$in':_0x196382}}});})[_0x8d8b('0x23')](function(_0x4771ae){var _0x490d99=_['map'](_0x4771ae,function(_0x2b45fa){return _0x2b45fa['getAssociatedQueues']();});return Promise[_0x8d8b('0x5a')](_0x490d99);})[_0x8d8b('0x23')](function(_0x332083){_0x552099=_[_0x8d8b('0x11a')](_0x332083);var _0x43308e=_[_0x8d8b('0x3f')](_0x552099,function(_0xde0d28){return _0xde0d28[_0x8d8b('0x11b')](_0x278c03['id'],{'transaction':_0x29fbab});});return Promise[_0x8d8b('0x5a')](_0x43308e);})[_0x8d8b('0x23')](function(){if(!_0x278c03[_0x8d8b('0x9d')])return;var _0x45412e=_['filter'](_0x552099,function(_0x1c7f04){return _0x1c7f04['getDataValue'](_0x8d8b('0xb3'))===_0x8d8b('0x11c');});var _0x19a92d=_['map'](_0x45412e,function(_0x448ecf){return db[_0x8d8b('0xb0')][_0x8d8b('0xb1')]({'membername':_0x278c03['name'],'UserId':_0x278c03['id'],'queue_name':_0x448ecf['name'],'VoiceQueueId':_0x448ecf['id'],'interface':_[_0x8d8b('0x66')](_0x278c03['interface'])?util[_0x8d8b('0xae')](_0x8d8b('0xaf'),_0x278c03[_0x8d8b('0x3c')]):_0x278c03[_0x8d8b('0xa0')],'paused':_0x278c03['voicePause']||![],'penalty':_0x278c03['penalty']},{'transaction':_0x29fbab});});return Promise[_0x8d8b('0x5a')](_0x19a92d);})[_0x8d8b('0x23')](function(){return db[_0x8d8b('0x11d')][_0x8d8b('0x4f')]({'where':{'teamId':{'$in':_0x196382}}});})[_0x8d8b('0x23')](function(_0x470b50){var _0x5ab707=_[_0x8d8b('0x3f')](_0x470b50,function(_0x2e386d){return db[_0x8d8b('0x11e')][_0x8d8b('0x7d')]({'UserId':_0x278c03['id'],'VoicePrefixId':_0x2e386d[_0x8d8b('0x11f')]},{'transaction':_0x29fbab});});return Promise[_0x8d8b('0x5a')](_0x5ab707);});});})['then'](function(){for(var _0xf0c8df=0x0;_0xf0c8df<_0x552099[_0x8d8b('0x53')];_0xf0c8df++){var _0x4b0382=_0x552099[_0xf0c8df][_0x8d8b('0x120')]('channel');var _0x48008e=_0x4b0382+_0x8d8b('0xa9');socket[_0x8d8b('0x2f')](_0x8d8b('0x35')+_0x4b0382+_0x8d8b('0xaa'),{'UserId':_0x30403a,['queueField']:_0x552099[_0xf0c8df]['id']});}})['then'](respondWithStatusCode(_0x1b6e06,null))[_0x8d8b('0x2d')](APIHandleError(_0x1b6e06));};exports[_0x8d8b('0x121')]=function(_0x4019df,_0x4bdbf9){var _0x20059e=_0x4019df[_0x8d8b('0x5c')]['id'];var _0x17d4ac=null;if(_0x4019df[_0x8d8b('0x49')][_0x8d8b('0x62')]){_0x17d4ac=_[_0x8d8b('0xb4')](_0x4019df['query']['ids'])?_0x4019df['query'][_0x8d8b('0x62')]:[_0x4019df[_0x8d8b('0x49')][_0x8d8b('0x62')]];}var _0x2be4b3=[];return Promise[_0x8d8b('0x108')]()['then'](function(){if(!_0x17d4ac)throw new APIBadRequestError(_0x8d8b('0x122'));})[_0x8d8b('0x23')](function(){return db[_0x8d8b('0x3e')]['findOne']({'where':{'id':_0x20059e}});})[_0x8d8b('0x23')](function(_0x4a4517){if(!_0x4a4517)throw new APINotFoundError(util['format'](_0x8d8b('0xcd'),_0x4019df[_0x8d8b('0x5c')]['id']));return db[_0x8d8b('0x68')][_0x8d8b('0x123')](function(_0x3ec620){return _0x4a4517[_0x8d8b('0x121')](_0x17d4ac,{'transaction':_0x3ec620})[_0x8d8b('0x23')](function(){return db['Team'][_0x8d8b('0x4f')]({'where':{'id':{'$in':_0x17d4ac}}});})[_0x8d8b('0x23')](function(_0x5ad34f){var _0x4aae6f=_[_0x8d8b('0x3f')](_0x5ad34f,function(_0x1fecb3){return _0x1fecb3[_0x8d8b('0x124')]();});return Promise[_0x8d8b('0x5a')](_0x4aae6f);})[_0x8d8b('0x23')](function(_0x315d37){_0x2be4b3=_[_0x8d8b('0x11a')](_0x315d37);var _0x16560a=_[_0x8d8b('0x3f')](_0x2be4b3,function(_0x321266){return _0x321266[_0x8d8b('0x125')](_0x4a4517['id'],{'transaction':_0x3ec620});});return Promise[_0x8d8b('0x5a')](_0x16560a);})[_0x8d8b('0x23')](function(){if(!_0x4a4517[_0x8d8b('0x9d')])return;var _0x31432f=_[_0x8d8b('0x38')](_0x2be4b3,function(_0x3a4783){return _0x3a4783['getDataValue'](_0x8d8b('0xb3'))===_0x8d8b('0x11c');});var _0x1f8edc=_[_0x8d8b('0x3f')](_0x31432f,function(_0x264e5a){return db[_0x8d8b('0xb0')][_0x8d8b('0x31')]({'where':{'VoiceQueueId':_0x264e5a['id'],'UserId':_0x4a4517['id']},'transaction':_0x3ec620});});return Promise[_0x8d8b('0x5a')](_0x1f8edc);})[_0x8d8b('0x23')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x17d4ac}}});})[_0x8d8b('0x23')](function(_0x58b399){var _0x8fcb01=_[_0x8d8b('0x3f')](_0x58b399,function(_0xf9a131){return db[_0x8d8b('0x11e')][_0x8d8b('0x31')]({'where':{'UserId':_0x4a4517['id'],'VoicePrefixId':_0xf9a131[_0x8d8b('0x11f')]}},{'transaction':_0x3ec620});});return Promise[_0x8d8b('0x5a')](_0x8fcb01);});});})[_0x8d8b('0x23')](function(){for(var _0x19eef0=0x0;_0x19eef0<_0x2be4b3[_0x8d8b('0x53')];_0x19eef0++){var _0xcd4e18=_0x2be4b3[_0x19eef0]['getDataValue'](_0x8d8b('0xb3'));var _0x2dc697=_0xcd4e18+_0x8d8b('0xa9');socket[_0x8d8b('0x2f')](_0x8d8b('0x35')+_0xcd4e18+_0x8d8b('0x126'),{'UserId':_0x20059e,['queueField']:_0x2be4b3[_0x19eef0]['id']});}})[_0x8d8b('0x23')](respondWithStatusCode(_0x4bdbf9,null))[_0x8d8b('0x2d')](APIHandleError(_0x4bdbf9));};exports[_0x8d8b('0x127')]=function(_0x4d6a6b,_0xa9c263){var _0x20c33c={};var _0xccbb8d={};var _0x6e16d6;var _0x3ce05d;return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x4d6a6b[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0xa9c263,null))['then'](function(_0x55d981){if(_0x55d981){_0x6e16d6=_0x55d981;_0xccbb8d['model']=_[_0x8d8b('0xe2')](db[_0x8d8b('0xcf')]['rawAttributes']);_0xccbb8d[_0x8d8b('0x49')]=_['keys'](_0x4d6a6b[_0x8d8b('0x49')]);_0xccbb8d['filters']=_[_0x8d8b('0xd7')](_0xccbb8d[_0x8d8b('0xd4')],_0xccbb8d[_0x8d8b('0x49')]);_0x20c33c['attributes']=_[_0x8d8b('0xd7')](_0xccbb8d[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x4d6a6b[_0x8d8b('0x49')][_0x8d8b('0xd8')]));_0x20c33c[_0x8d8b('0x4e')]=_0x20c33c['attributes']['length']?_0x20c33c[_0x8d8b('0x4e')]:_0xccbb8d[_0x8d8b('0xd4')];_0x20c33c[_0x8d8b('0xd9')]=qs[_0x8d8b('0xda')](_0x4d6a6b[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x20c33c[_0x8d8b('0xdb')]=qs[_0x8d8b('0xdc')](_['pick'](_0x4d6a6b['query'],_0xccbb8d['filters']));if(_0x4d6a6b[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x20c33c[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x20c33c[_0x8d8b('0xdb')],{'$or':_['map'](_0x20c33c['attributes'],function(_0x4ae862){var _0x3628f8={};_0x3628f8[_0x4ae862]={'$like':'%'+_0x4d6a6b[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x3628f8;})});}_0x20c33c=_[_0x8d8b('0x5d')]({},_0x20c33c,_0x4d6a6b[_0x8d8b('0xe3')]);return _0x6e16d6['getLists'](_0x20c33c);}})[_0x8d8b('0x23')](function(_0x141fb1){if(_0x141fb1){_0x3ce05d=_0x141fb1['length'];if(!_0x4d6a6b['query'][_0x8d8b('0xdf')]('nolimit')){_0x20c33c[_0x8d8b('0x1f')]=qs[_0x8d8b('0x1f')](_0x4d6a6b[_0x8d8b('0x49')][_0x8d8b('0x1f')]);_0x20c33c[_0x8d8b('0x1c')]=qs[_0x8d8b('0x1c')](_0x4d6a6b['query']['offset']);}return _0x6e16d6[_0x8d8b('0x127')](_0x20c33c);}})['then'](function(_0x4e96ab){if(_0x4e96ab){return _0x4e96ab?{'count':_0x3ce05d,'rows':_0x4e96ab}:null;}})[_0x8d8b('0x23')](respondWithResult(_0xa9c263,null))[_0x8d8b('0x2d')](handleError(_0xa9c263,null));};exports[_0x8d8b('0x128')]=function(_0x46a3bf,_0x6ab188){var _0x2f855c={};var _0x7ada28={};var _0xfd9f45;return db[_0x8d8b('0x3e')][_0x8d8b('0x95')]({'where':{'id':_0x46a3bf[_0x8d8b('0x5c')]['id']}})[_0x8d8b('0x23')](handleEntityNotFound(_0x6ab188,null))[_0x8d8b('0x23')](function(_0x225607){if(_0x225607){_0xfd9f45=_0x225607;_0x7ada28[_0x8d8b('0xd4')]=_[_0x8d8b('0xe2')](db[_0x8d8b('0x3e')][_0x8d8b('0xd6')]);_0x7ada28[_0x8d8b('0x49')]=_['keys'](_0x46a3bf[_0x8d8b('0x49')]);_0x7ada28[_0x8d8b('0xdc')]=_[_0x8d8b('0xd7')](_0x7ada28['model'],_0x7ada28[_0x8d8b('0x49')]);_0x2f855c['attributes']=_['intersection'](_0x7ada28[_0x8d8b('0xd4')],qs[_0x8d8b('0xd8')](_0x46a3bf[_0x8d8b('0x49')]['fields']));_0x2f855c[_0x8d8b('0x4e')]=_0x2f855c[_0x8d8b('0x4e')][_0x8d8b('0x53')]?_0x2f855c[_0x8d8b('0x4e')]:_0x7ada28['model'];_0x2f855c[_0x8d8b('0xd9')]=qs['sort'](_0x46a3bf[_0x8d8b('0x49')][_0x8d8b('0xda')]);_0x2f855c[_0x8d8b('0xdb')]=qs['filters'](_[_0x8d8b('0xdd')](_0x46a3bf[_0x8d8b('0x49')],_0x7ada28[_0x8d8b('0xdc')]));if(_0x46a3bf[_0x8d8b('0x49')][_0x8d8b('0x38')]){_0x2f855c[_0x8d8b('0xdb')]=_[_0x8d8b('0x5d')](_0x2f855c['where'],{'$or':_[_0x8d8b('0x3f')](_0x2f855c['attributes'],function(_0x371358){var _0x54501a={};_0x54501a[_0x371358]={'$like':'%'+_0x46a3bf[_0x8d8b('0x49')][_0x8d8b('0x38')]+'%'};return _0x54501a;})});}_0x2f855c['model']=db[_0x8d8b('0x3e')];_0x2f855c['as']=_0x8d8b('0x84');_0x2f855c=_[_0x8d8b('0x5d')]({},_0x2f855c,_0x46a3bf['options']);return _0xfd9f45['getVoiceQueues']({'include':[_0x2f855c]});}})[_0x8d8b('0x23')](function(_0x18f3bf){if(_0x18f3bf){var _0x514387={},_0xfb1df=[];for(var _0x2ba2df=0x0;_0x2ba2df<_0x18f3bf[_0x8d8b('0x53')];_0x2ba2df+=0x1){for(var _0x17338a=0x0,_0x472238;_0x17338a<_0x18f3bf[_0x2ba2df]['Agents'][_0x8d8b('0x53')];_0x17338a+=0x1){_0x472238=_0x18f3bf[_0x2ba2df][_0x8d8b('0x84')][_0x17338a][_0x8d8b('0xad')]({'plain':!![]});_0x514387[_0x472238['id']]=_0x472238;}}_0x514387=_['values'](_0x514387);for(var _0x5a07df=qs[_0x8d8b('0x1c')](_0x46a3bf[_0x8d8b('0x49')][_0x8d8b('0x1c')]);_0x5a07df<_0x514387[_0x8d8b('0x53')]&&_0xfb1df[_0x8d8b('0x53')]=_0x119e63[_0xc4ce('0x4c')]){throw new Error(_0xc4ce('0x4d'));}})[_0xc4ce('0x14')](function(){if(_0x51d1d3){return db[_0xc4ce('0x23')]['destroy']({'where':{'membername':_0x51d1d3[_0xc4ce('0x1e')]},'individualHooks':!![]});}})[_0xc4ce('0x14')](function(){if(_0x51d1d3){return _0x51d1d3[_0xc4ce('0x4e')]({'raw':!![]});}})['then'](function(_0x37dc41){if(_0x51d1d3){if(_0x37dc41){var _0x804aec=[];_0x104bf9=_0x37dc41;if(_0x104bf9[_0xc4ce('0x26')]){for(var _0x243600=0x0;_0x243600<_0x104bf9[_0xc4ce('0x26')];_0x243600++){_0x804aec[_0xc4ce('0x2c')](db[_0xc4ce('0x23')][_0xc4ce('0x4f')]({'membername':_0x51d1d3[_0xc4ce('0x1e')],'UserId':_0x51d1d3['id'],'queue_name':_0x104bf9[_0x243600]['name'],'VoiceQueueId':_0x104bf9[_0x243600]['id'],'interface':_0x534214,'paused':_0x51d1d3['loginInPause']||![],'penalty':_0x104bf9[_0x243600][_0xc4ce('0x50')]||0x0}));}return BPromise[_0xc4ce('0x46')](_0x804aec);}}}})[_0xc4ce('0x14')](function(){if(_0x51d1d3){return db[_0xc4ce('0x24')]['findAll']({'where':{'membername':_0x51d1d3[_0xc4ce('0x1e')],'exitAt':null}});}})['then'](function(_0x3eb00a){if(_0x51d1d3){if(_0x3eb00a&&_0x3eb00a[_0xc4ce('0x26')]){var _0x3d247b=[];_0x3eb00a[_0xc4ce('0x2b')](function(_0xcaaf82){_0x3d247b[_0xc4ce('0x2c')](_0xcaaf82[_0xc4ce('0x45')]({'exitAt':moment()['format'](_0xc4ce('0x28'))}));});return BPromise[_0xc4ce('0x46')](_0x3d247b);}}})[_0xc4ce('0x14')](function(){if(_0x51d1d3){var _0x45095a=[];var _0xf94a63=[];var _0x3cde69=utils[_0xc4ce('0x2a')]();var _0x148742={'membername':_0x51d1d3[_0xc4ce('0x1e')],'interface':_0x534214,'enterAt':moment()['format'](_0xc4ce('0x28')),'role':_0x51d1d3[_0xc4ce('0x1f')],'internal':_0x51d1d3[_0xc4ce('0x20')]};_0x3cde69[_0xc4ce('0x2b')](function(_0x5d372f){_0x45095a[_0xc4ce('0x2c')](_['merge']({'channel':_0x5d372f,'type':'LOGIN','data1':_0xc4ce('0x51'),'data2':_0x534214},_0x148742));if(_0x51d1d3[_0xc4ce('0x48')]){_0xf94a63[_0xc4ce('0x2c')](_['merge']({'channel':_0x5d372f,'type':_0xc4ce('0x25'),'data1':'LOGININPAUSE'},_0x148742));}});return db[_0xc4ce('0x24')][_0xc4ce('0x32')](_0x45095a[_0xc4ce('0x52')](_0xf94a63),{'individualHooks':!![]});}})['then'](function(){if(_0x51d1d3){return _0x51d1d3['update']({'online':!![],'lastLoginAt':moment()['format'](_0xc4ce('0x28')),'voicePause':_0x51d1d3['loginInPause']||![],'mailPause':_0x51d1d3[_0xc4ce('0x48')]||![],'chatPause':_0x51d1d3[_0xc4ce('0x48')]||![],'faxPause':_0x51d1d3[_0xc4ce('0x48')]||![],'smsPause':_0x51d1d3[_0xc4ce('0x48')]||![],'openchannelPause':_0x51d1d3['loginInPause']||![],'pauseType':_0x51d1d3[_0xc4ce('0x48')]?_0xc4ce('0x53'):null,'lastPauseAt':moment()[_0xc4ce('0x27')](_0xc4ce('0x28')),'interface':_0x534214});}})[_0xc4ce('0x14')](function(_0x531472){_0x480f82(_0x531472);})[_0xc4ce('0x18')](function(_0x5225b2){_0x51e4e8(_0x1afd4b['error'](0x1f4,_0x5225b2['message']));});});}; \ No newline at end of file +var _0xc665=['attributes','model','then','info','catch','error','ShowUser','find','raw','debug','stringify','message','PauseUser','name','role','internal','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','forEach','SIP/%s','interface','body','type','DEFAULT\x20PAUSE','MemberReport','bulkCreate','resolve','channel','isValidChannel','findOne','online','voicePause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','destroy','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','push','upsert','all','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','register','GetUser','User','findAll','options','where','include','map'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xc665,0x94));var _0x5c66=function(_0x90a47f,_0x3e693f){_0x90a47f=_0x90a47f-0x0;var _0x44f115=_0xc665[_0x90a47f];return _0x44f115;};'use strict';var _=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var moment=require('moment');var BPromise=require(_0x5c66('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c66('0x3'));var logger=require(_0x5c66('0x4'))(_0x5c66('0x5'));var config=require(_0x5c66('0x6'));config[_0x5c66('0x7')]=_[_0x5c66('0x8')](config[_0x5c66('0x7')],{'host':_0x5c66('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x5c66('0xa')](socket);exports[_0x5c66('0xb')]=function(_0x222a46){var _0x1dbea2=this;return new Promise(function(_0xf9b55,_0x550535){return db[_0x5c66('0xc')][_0x5c66('0xd')]({'raw':_0x222a46[_0x5c66('0xe')]?_0x222a46[_0x5c66('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x222a46['options']?_0x222a46[_0x5c66('0xe')][_0x5c66('0xf')]||null:null,'attributes':_0x222a46[_0x5c66('0xe')]?_0x222a46[_0x5c66('0xe')]['attributes']||null:null,'limit':_0x222a46[_0x5c66('0xe')]?_0x222a46[_0x5c66('0xe')]['limit']||null:null,'include':_0x222a46[_0x5c66('0xe')]?_0x222a46['options'][_0x5c66('0x10')]?_[_0x5c66('0x11')](_0x222a46[_0x5c66('0xe')]['include'],function(_0x64d7b3){return{'model':db[_0x64d7b3['model']],'as':_0x64d7b3['as'],'attributes':_0x64d7b3[_0x5c66('0x12')],'include':_0x64d7b3[_0x5c66('0x10')]?_['map'](_0x64d7b3['include'],function(_0x4c524e){return{'model':db[_0x4c524e[_0x5c66('0x13')]],'as':_0x4c524e['as'],'attributes':_0x4c524e[_0x5c66('0x12')],'include':_0x4c524e['include']?_['map'](_0x4c524e['include'],function(_0x575b58){return{'model':db[_0x575b58[_0x5c66('0x13')]],'as':_0x575b58['as'],'attributes':_0x575b58['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c66('0x14')](function(_0x54f38a){logger[_0x5c66('0x15')](_0x5c66('0xb'),_0x222a46);logger['debug'](_0x5c66('0xb'),_0x222a46,JSON['stringify'](_0x54f38a));_0xf9b55(_0x54f38a);})[_0x5c66('0x16')](function(_0x1790e1){logger['error'](_0x5c66('0xb'),_0x1790e1['message'],_0x222a46);_0x550535(_0x1dbea2[_0x5c66('0x17')](0x1f4,_0x1790e1['message']));});});};exports[_0x5c66('0x18')]=function(_0x20a4e9){var _0x2b832c=this;return new Promise(function(_0xce0471,_0x4f7c69){return db[_0x5c66('0xc')][_0x5c66('0x19')]({'raw':_0x20a4e9[_0x5c66('0xe')]?_0x20a4e9[_0x5c66('0xe')][_0x5c66('0x1a')]===undefined?!![]:![]:!![],'where':_0x20a4e9[_0x5c66('0xe')]?_0x20a4e9[_0x5c66('0xe')][_0x5c66('0xf')]||null:null,'attributes':_0x20a4e9[_0x5c66('0xe')]?_0x20a4e9[_0x5c66('0xe')][_0x5c66('0x12')]||null:null,'include':_0x20a4e9[_0x5c66('0xe')]?_0x20a4e9[_0x5c66('0xe')][_0x5c66('0x10')]?_[_0x5c66('0x11')](_0x20a4e9[_0x5c66('0xe')][_0x5c66('0x10')],function(_0x405c08){return{'model':db[_0x405c08[_0x5c66('0x13')]],'as':_0x405c08['as'],'attributes':_0x405c08['attributes'],'include':_0x405c08[_0x5c66('0x10')]?_['map'](_0x405c08['include'],function(_0xbee137){return{'model':db[_0xbee137['model']],'as':_0xbee137['as'],'attributes':_0xbee137[_0x5c66('0x12')],'include':_0xbee137[_0x5c66('0x10')]?_[_0x5c66('0x11')](_0xbee137[_0x5c66('0x10')],function(_0x33a9b9){return{'model':db[_0x33a9b9[_0x5c66('0x13')]],'as':_0x33a9b9['as'],'attributes':_0x33a9b9[_0x5c66('0x12')]};}):[]};}):[]};}):[]:[]})[_0x5c66('0x14')](function(_0x76acf0){logger[_0x5c66('0x15')](_0x5c66('0x18'),_0x20a4e9);logger[_0x5c66('0x1b')](_0x5c66('0x18'),_0x20a4e9,JSON[_0x5c66('0x1c')](_0x76acf0));_0xce0471(_0x76acf0);})[_0x5c66('0x16')](function(_0x59e4d4){logger[_0x5c66('0x17')](_0x5c66('0x18'),_0x59e4d4[_0x5c66('0x1d')],_0x20a4e9);_0x4f7c69(_0x2b832c[_0x5c66('0x17')](0x1f4,_0x59e4d4['message']));});});};exports[_0x5c66('0x1e')]=function(_0x5b819e){var _0x2b5426;return db[_0x5c66('0xc')][_0x5c66('0x19')]({'where':_0x5b819e[_0x5c66('0xe')]['where']||{},'attributes':['id',_0x5c66('0x1f'),_0x5c66('0x20'),_0x5c66('0x21'),'interface']})[_0x5c66('0x14')](function(_0x5ba98d){if(!_0x5ba98d){throw new Error(util['format'](_0x5c66('0x22'),_0x5b819e['params']['id']));}_0x2b5426=_0x5ba98d;return db[_0x5c66('0x23')][_0x5c66('0x24')]({'paused':0x1},{'where':{'UserId':_0x2b5426['id']},'individualHooks':!![]});})[_0x5c66('0x14')](function(){return db['MemberReport'][_0x5c66('0xd')]({'where':{'membername':_0x2b5426['name'],'type':_0x5c66('0x25'),'exitAt':null}});})[_0x5c66('0x14')](function(_0x2218cb){if(_0x2218cb&&_0x2218cb[_0x5c66('0x26')]){var _0x202c86=moment()[_0x5c66('0x27')](_0x5c66('0x28'));for(var _0x1b4113=0x0,_0x25feab=_0x2218cb[_0x5c66('0x26')];_0x1b4113<_0x25feab;_0x1b4113++){_0x2218cb[_0x1b4113]['updateAttributes']({'exitAt':_0x202c86});}}})[_0x5c66('0x14')](function(){var _0xc89bc7=[];var _0x1a6e96=utils['getChannels']();_0x1a6e96[_0x5c66('0x29')](function(_0x203991){_0xc89bc7['push']({'channel':_0x203991,'membername':_0x2b5426[_0x5c66('0x1f')],'interface':_['isNil'](_0x2b5426['interface'])?util[_0x5c66('0x27')](_0x5c66('0x2a'),_0x2b5426[_0x5c66('0x1f')]):_0x2b5426[_0x5c66('0x2b')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5b819e[_0x5c66('0x2c')][_0x5c66('0x2d')]||_0x5c66('0x2e'),'role':_0x2b5426[_0x5c66('0x20')],'internal':_0x2b5426[_0x5c66('0x21')],'uniqueid':_0x5b819e[_0x5c66('0x2c')]['uniqueid']||null});});return db[_0x5c66('0x2f')][_0x5c66('0x30')](_0xc89bc7,{'individualHooks':!![]});})[_0x5c66('0x14')](function(){return _0x2b5426[_0x5c66('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5b819e['body'][_0x5c66('0x2d')]||_0x5c66('0x2e'),'lastPauseAt':moment()[_0x5c66('0x27')](_0x5c66('0x28'))});})[_0x5c66('0x16')](function(_0x1252db){throw _0x1252db;});};exports['UnpauseUser']=function(_0x3f3a64){return Promise[_0x5c66('0x31')]()[_0x5c66('0x14')](function(){if(_0x3f3a64[_0x5c66('0x2c')][_0x5c66('0x32')]&&!utils[_0x5c66('0x33')](_0x3f3a64[_0x5c66('0x2c')][_0x5c66('0x32')])){throw new Error(util[_0x5c66('0x27')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3f3a64[_0x5c66('0x2c')]['channel']));}return db[_0x5c66('0xc')][_0x5c66('0x34')]({'where':_0x3f3a64[_0x5c66('0xe')][_0x5c66('0xf')]||{},'attributes':['id',_0x5c66('0x1f'),'role',_0x5c66('0x21'),_0x5c66('0x2b'),_0x5c66('0x35'),_0x5c66('0x36'),'mailPause',_0x5c66('0x37'),_0x5c66('0x38'),_0x5c66('0x39'),_0x5c66('0x3a'),_0x5c66('0x3b'),_0x5c66('0x3c'),_0x5c66('0x3d')]});})[_0x5c66('0x14')](function(_0x5669c4){if(!_0x5669c4){throw new Error(util[_0x5c66('0x27')](_0x5c66('0x22'),_0x3f3a64['params']['id']));}return _0x5669c4[_0x5c66('0x3e')](_0x3f3a64[_0x5c66('0x2c')][_0x5c66('0x32')],_0x5c66('0x3f'));})['catch'](function(_0x5165b1){throw _0x5165b1;});};exports['LogoutUser']=function(_0x2ebeaa){var _0x40757b=this;return new Promise(function(_0x553c6c,_0x4d72f3){var _0x4a0c53;return db['User']['findOne']({'where':_0x2ebeaa['options'][_0x5c66('0xf')]||{},'attributes':['id','name']})[_0x5c66('0x14')](function(_0x2f61b4){if(_0x2f61b4){_0x4a0c53=_0x2f61b4;return db[_0x5c66('0x23')][_0x5c66('0x40')]({'where':{'membername':_0x4a0c53[_0x5c66('0x1f')]},'individualHooks':!![]});}})[_0x5c66('0x14')](function(){if(_0x4a0c53){return db['MemberReport'][_0x5c66('0xd')]({'where':{'membername':_0x4a0c53['name'],'exitAt':null}});}})['then'](function(_0x3e52f8){if(_0x4a0c53){if(_0x3e52f8&&_0x3e52f8[_0x5c66('0x26')]){var _0x4b50d1=[];_0x3e52f8[_0x5c66('0x29')](function(_0x421d8b){_0x4b50d1['push'](_0x421d8b[_0x5c66('0x24')]({'exitAt':moment()[_0x5c66('0x27')](_0x5c66('0x28'))}));});return BPromise['all'](_0x4b50d1);}}})[_0x5c66('0x14')](function(){if(_0x4a0c53){return _0x4a0c53[_0x5c66('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x3c479a){_0x553c6c(_0x3c479a);})['catch'](function(_0xca4baf){_0x4d72f3(_0x40757b[_0x5c66('0x17')](0x1f4,_0xca4baf['message']));});});};exports[_0x5c66('0x41')]=function(_0x547494){var _0x13b6e2=this;return new Promise(function(_0x46e4fe,_0x2b0e10){var _0x127114;var _0x5e0e86;var _0x20f9c6;var _0x4449f0;return db[_0x5c66('0xc')]['findOne']({'where':_0x547494['options']['where']||{},'attributes':['id',_0x5c66('0x1f'),_0x5c66('0x20'),_0x5c66('0x42'),_0x5c66('0x43'),'internal',_0x5c66('0x44'),_0x5c66('0x2b')]})[_0x5c66('0x14')](function(_0x5e87c5){if(_0x5e87c5){_0x127114=_0x5e87c5;_0x4449f0=_0x547494[_0x5c66('0x2c')][_0x5c66('0x2b')]?_0x547494['body']['interface']:util[_0x5c66('0x27')](_0x5c66('0x2a'),_0x127114[_0x5c66('0x1f')]);return db['User'][_0x5c66('0x45')]({'where':{'role':_0x5c66('0x46'),'online':!![],'id':{'$ne':_0x127114['id']}}});}})['then'](function(_0x19de13){if(_0x19de13){_0x20f9c6=_0x19de13;return require('../../config/license/util')[_0x5c66('0x47')]();}})[_0x5c66('0x14')](function(_0x7afd68){if(_0x7afd68&&_0x7afd68[_0x5c66('0x48')]&&_0x20f9c6>=_0x7afd68[_0x5c66('0x48')]){throw new Error(_0x5c66('0x49'));}})['then'](function(){if(_0x127114){return db[_0x5c66('0x23')][_0x5c66('0x40')]({'where':{'membername':_0x127114[_0x5c66('0x1f')]},'individualHooks':!![]});}})[_0x5c66('0x14')](function(){if(_0x127114){return _0x127114['getVoiceQueues']({'raw':!![]});}})[_0x5c66('0x14')](function(_0x153c58){if(_0x127114){if(_0x153c58){var _0x35469c=[];_0x5e0e86=_0x153c58;if(_0x5e0e86[_0x5c66('0x26')]){for(var _0x3fa199=0x0;_0x3fa199<_0x5e0e86[_0x5c66('0x26')];_0x3fa199++){_0x35469c[_0x5c66('0x4a')](db['UserVoiceQueueRt'][_0x5c66('0x4b')]({'membername':_0x127114[_0x5c66('0x1f')],'UserId':_0x127114['id'],'queue_name':_0x5e0e86[_0x3fa199][_0x5c66('0x1f')],'VoiceQueueId':_0x5e0e86[_0x3fa199]['id'],'interface':_0x4449f0,'paused':_0x127114[_0x5c66('0x44')]||![],'penalty':_0x5e0e86[_0x3fa199]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x5c66('0x4c')](_0x35469c);}}}})[_0x5c66('0x14')](function(){if(_0x127114){return db[_0x5c66('0x2f')][_0x5c66('0xd')]({'where':{'membername':_0x127114[_0x5c66('0x1f')],'exitAt':null}});}})[_0x5c66('0x14')](function(_0x492c8b){if(_0x127114){if(_0x492c8b&&_0x492c8b[_0x5c66('0x26')]){var _0x30374a=[];_0x492c8b[_0x5c66('0x29')](function(_0x14b97c){_0x30374a[_0x5c66('0x4a')](_0x14b97c['update']({'exitAt':moment()[_0x5c66('0x27')](_0x5c66('0x28'))}));});return BPromise[_0x5c66('0x4c')](_0x30374a);}}})[_0x5c66('0x14')](function(){if(_0x127114){var _0x44e707=[];var _0x4a79a0=[];var _0x3c2f53=utils[_0x5c66('0x4d')]();var _0x1d8b19={'membername':_0x127114[_0x5c66('0x1f')],'interface':_0x4449f0,'enterAt':moment()['format'](_0x5c66('0x28')),'role':_0x127114[_0x5c66('0x20')],'internal':_0x127114[_0x5c66('0x21')]};_0x3c2f53[_0x5c66('0x29')](function(_0x4db525){_0x44e707[_0x5c66('0x4a')](_[_0x5c66('0x4e')]({'channel':_0x4db525,'type':_0x5c66('0x4f'),'data1':_0x5c66('0x50'),'data2':_0x4449f0},_0x1d8b19));if(_0x127114['loginInPause']){_0x4a79a0[_0x5c66('0x4a')](_['merge']({'channel':_0x4db525,'type':_0x5c66('0x25'),'data1':_0x5c66('0x51')},_0x1d8b19));}});return db[_0x5c66('0x2f')][_0x5c66('0x30')](_0x44e707[_0x5c66('0x52')](_0x4a79a0),{'individualHooks':!![]});}})[_0x5c66('0x14')](function(){if(_0x127114){return _0x127114[_0x5c66('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x5c66('0x28')),'voicePause':_0x127114[_0x5c66('0x44')]||![],'mailPause':_0x127114[_0x5c66('0x44')]||![],'chatPause':_0x127114['loginInPause']||![],'faxPause':_0x127114['loginInPause']||![],'smsPause':_0x127114['loginInPause']||![],'openchannelPause':_0x127114[_0x5c66('0x44')]||![],'pauseType':_0x127114[_0x5c66('0x44')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x5c66('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4449f0});}})['then'](function(_0x20477d){_0x46e4fe(_0x20477d);})[_0x5c66('0x16')](function(_0x374fa2){_0x2b0e10(_0x13b6e2[_0x5c66('0x17')](0x1f4,_0x374fa2[_0x5c66('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8c9e531..fee1e54 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 _0x9f2a=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x4a699b,_0x461d1f){var _0x5e0cc6=function(_0x100767){while(--_0x100767){_0x4a699b['push'](_0x4a699b['shift']());}};_0x5e0cc6(++_0x461d1f);}(_0x9f2a,0x9d));var _0xa9f2=function(_0xc583c9,_0x2e0d87){_0xc583c9=_0xc583c9-0x0;var _0x5b13b5=_0x9f2a[_0xc583c9];return _0x5b13b5;};'use strict';var UserEvents=require(_0xa9f2('0x0'));var events=[_0xa9f2('0x1'),_0xa9f2('0x2'),_0xa9f2('0x3')];function createListener(_0x20770e,_0x1749f2){return function(_0x17a5fb){_0x1749f2[_0xa9f2('0x4')](_0x20770e,_0x17a5fb);};}function removeListener(_0x5cad8c,_0x138671){return function(){UserEvents[_0xa9f2('0x5')](_0x5cad8c,_0x138671);};}exports[_0xa9f2('0x6')]=function(_0x14da76){for(var _0x578f38=0x0,_0x5a883a=events[_0xa9f2('0x7')];_0x578f38<_0x5a883a;_0x578f38++){var _0x528734=events[_0x578f38];var _0x1702f3=createListener(_0xa9f2('0x8')+_0x528734,_0x14da76);UserEvents['on'](_0x528734,_0x1702f3);}}; \ No newline at end of file +var _0x9840=['./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x42ce31,_0x331808){var _0x644a50=function(_0x26330b){while(--_0x26330b){_0x42ce31['push'](_0x42ce31['shift']());}};_0x644a50(++_0x331808);}(_0x9840,0x138));var _0x0984=function(_0xf83946,_0x252211){_0xf83946=_0xf83946-0x0;var _0x35a03b=_0x9840[_0xf83946];return _0x35a03b;};'use strict';var UserEvents=require(_0x0984('0x0'));var events=[_0x0984('0x1'),_0x0984('0x2'),_0x0984('0x3')];function createListener(_0x28b75f,_0x24d93d){return function(_0x5936b1){_0x24d93d[_0x0984('0x4')](_0x28b75f,_0x5936b1);};}function removeListener(_0x3f57ae,_0x59647a){return function(){UserEvents[_0x0984('0x5')](_0x3f57ae,_0x59647a);};}exports[_0x0984('0x6')]=function(_0x2eb7d7){for(var _0x151163=0x0,_0x14cce=events[_0x0984('0x7')];_0x151163<_0x14cce;_0x151163++){var _0x75939=events[_0x151163];var _0x4f79a0=createListener('user:'+_0x75939,_0x2eb7d7);UserEvents['on'](_0x75939,_0x4f79a0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8ee4464..878245b 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56d158,_0x3699d6){var _0x5ae715=function(_0x46e4a3){while(--_0x46e4a3){_0x56d158['push'](_0x56d158['shift']());}};_0x5ae715(++_0x3699d6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x11385b,_0x2c3e99){var _0x30fb22=function(_0x45554c){while(--_0x45554c){_0x11385b['push'](_0x11385b['shift']());}};_0x30fb22(++_0x2c3e99);}(_0xe706,0xa3));var _0x6e70=function(_0x1d1a9c,_0x2274db){_0x1d1a9c=_0x1d1a9c-0x0;var _0x3e0c65=_0xe706[_0x1d1a9c];return _0x3e0c65;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0e0cad7..465cbc9 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 _0xf150=['INTEGER','sequelize','exports'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xf150,0x196));var _0x0f15=function(_0x49dfda,_0x5a59c0){_0x49dfda=_0x49dfda-0x0;var _0x3a7c9c=_0xf150[_0x49dfda];return _0x3a7c9c;};'use strict';var Sequelize=require(_0x0f15('0x0'));module[_0x0f15('0x1')]={'penalty':{'type':Sequelize[_0x0f15('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8df7=['exports','INTEGER','sequelize'];(function(_0x2f8ad4,_0x33a9c1){var _0x460bf9=function(_0x2f64af){while(--_0x2f64af){_0x2f8ad4['push'](_0x2f8ad4['shift']());}};_0x460bf9(++_0x33a9c1);}(_0x8df7,0x197));var _0x78df=function(_0xbd24fa,_0x2cb02c){_0xbd24fa=_0xbd24fa-0x0;var _0x113d37=_0x8df7[_0xbd24fa];return _0x113d37;};'use strict';var Sequelize=require(_0x78df('0x0'));module[_0x78df('0x1')]={'penalty':{'type':Sequelize[_0x78df('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 235d17d..22b3fd0 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 _0x309a=['bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','api','moment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x309a,0x140));var _0xa309=function(_0x165995,_0x347887){_0x165995=_0x165995-0x0;var _0x946856=_0x309a[_0x165995];return _0x946856;};'use strict';var _=require(_0xa309('0x0'));var util=require(_0xa309('0x1'));var logger=require('../../config/logger')(_0xa309('0x2'));var moment=require(_0xa309('0x3'));var BPromise=require(_0xa309('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa309('0x5'));var rimraf=require(_0xa309('0x6'));var config=require(_0xa309('0x7'));var attributes=require(_0xa309('0x8'));module[_0xa309('0x9')]=function(_0x2c2381,_0x4f7e0c){return _0x2c2381['define'](_0xa309('0xa'),attributes,{'tableName':_0xa309('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00b4=['api','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x00b4,0x104));var _0x400b=function(_0x19e5d9,_0x1a877c){_0x19e5d9=_0x19e5d9-0x0;var _0x796573=_0x00b4[_0x19e5d9];return _0x796573;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x400b('0x0'))(_0x400b('0x1'));var moment=require('moment');var BPromise=require(_0x400b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x400b('0x3'));var config=require(_0x400b('0x4'));var attributes=require(_0x400b('0x5'));module[_0x400b('0x6')]=function(_0x21de8e,_0x6fecf5){return _0x21de8e['define'](_0x400b('0x7'),attributes,{'tableName':_0x400b('0x8'),'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 18da589..0c441d5 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 _0x8257=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x5518d4,_0x547a72){var _0x52dbc0=function(_0x21b87c){while(--_0x21b87c){_0x5518d4['push'](_0x5518d4['shift']());}};_0x52dbc0(++_0x547a72);}(_0x8257,0xad));var _0x7825=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x8257[_0x37b3e5];return _0x207f20;};'use strict';var _=require('lodash');var util=require(_0x7825('0x0'));var moment=require(_0x7825('0x1'));var BPromise=require(_0x7825('0x2'));var rs=require(_0x7825('0x3'));var fs=require('fs');var Redis=require(_0x7825('0x4'));var db=require(_0x7825('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7825('0x6'))(_0x7825('0x7'));var config=require('../../config/environment');var jayson=require(_0x7825('0x8'));var client=jayson[_0x7825('0x9')][_0x7825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1593e2,_0xb6b86e,_0x4b215c){return new BPromise(function(_0x57d4d7,_0x15c13d){return client['request'](_0x1593e2,_0x4b215c)[_0x7825('0xb')](function(_0x55043c){logger[_0x7825('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xb6b86e,_0x7825('0xd'));logger[_0x7825('0xe')](_0x7825('0xf'),_0xb6b86e,_0x7825('0xd'),JSON['stringify'](_0x55043c));if(_0x55043c['error']){if(_0x55043c[_0x7825('0x10')][_0x7825('0x11')]===0x1f4){logger[_0x7825('0x10')](_0x7825('0x12'),_0xb6b86e,_0x55043c[_0x7825('0x10')][_0x7825('0x13')]);return _0x15c13d(_0x55043c[_0x7825('0x10')][_0x7825('0x13')]);}logger['error'](_0x7825('0x12'),_0xb6b86e,_0x55043c[_0x7825('0x10')][_0x7825('0x13')]);return _0x57d4d7(_0x55043c[_0x7825('0x10')]['message']);}else{logger[_0x7825('0xc')](_0x7825('0x12'),_0xb6b86e,_0x7825('0xd'));_0x57d4d7(_0x55043c[_0x7825('0x14')][_0x7825('0x13')]);}})[_0x7825('0x15')](function(_0xb18637){logger['error']('UserChatQueue,\x20%s,\x20%s',_0xb6b86e,_0xb18637);_0x15c13d(_0xb18637);});});} \ No newline at end of file +var _0x451d=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x50cbc2,_0x154a74){var _0x55e680=function(_0x28ae3c){while(--_0x28ae3c){_0x50cbc2['push'](_0x50cbc2['shift']());}};_0x55e680(++_0x154a74);}(_0x451d,0x1a6));var _0xd451=function(_0x41da23,_0xb932a2){_0x41da23=_0x41da23-0x0;var _0x3e430e=_0x451d[_0x41da23];return _0x3e430e;};'use strict';var _=require('lodash');var util=require(_0xd451('0x0'));var moment=require(_0xd451('0x1'));var BPromise=require(_0xd451('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd451('0x3'));var db=require(_0xd451('0x4'))['db'];var utils=require(_0xd451('0x5'));var logger=require(_0xd451('0x6'))('rpc');var config=require(_0xd451('0x7'));var jayson=require(_0xd451('0x8'));var client=jayson[_0xd451('0x9')][_0xd451('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e9ed,_0x14e7f9,_0x5b73b9){return new BPromise(function(_0x1c1b2d,_0x1a8fff){return client[_0xd451('0xb')](_0x7e9ed,_0x5b73b9)[_0xd451('0xc')](function(_0x4f3bc7){logger[_0xd451('0xd')](_0xd451('0xe'),_0x14e7f9,'request\x20sent');logger[_0xd451('0xf')](_0xd451('0x10'),_0x14e7f9,_0xd451('0x11'),JSON[_0xd451('0x12')](_0x4f3bc7));if(_0x4f3bc7[_0xd451('0x13')]){if(_0x4f3bc7[_0xd451('0x13')][_0xd451('0x14')]===0x1f4){logger['error'](_0xd451('0xe'),_0x14e7f9,_0x4f3bc7[_0xd451('0x13')]['message']);return _0x1a8fff(_0x4f3bc7['error']['message']);}logger[_0xd451('0x13')](_0xd451('0xe'),_0x14e7f9,_0x4f3bc7['error'][_0xd451('0x15')]);return _0x1c1b2d(_0x4f3bc7[_0xd451('0x13')][_0xd451('0x15')]);}else{logger[_0xd451('0xd')](_0xd451('0xe'),_0x14e7f9,_0xd451('0x11'));_0x1c1b2d(_0x4f3bc7[_0xd451('0x16')][_0xd451('0x15')]);}})[_0xd451('0x17')](function(_0x11b94c){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x14e7f9,_0x11b94c);_0x1a8fff(_0x11b94c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a297b3d..000bdac 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x96f3e7,_0x3af6b6){var _0x3a11d1=function(_0x3c4d52){while(--_0x3c4d52){_0x96f3e7['push'](_0x96f3e7['shift']());}};_0x3a11d1(++_0x3af6b6);}(_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(_0x27f49f,_0x267fef){var _0x33fd6c=function(_0x587bfc){while(--_0x587bfc){_0x27f49f['push'](_0x27f49f['shift']());}};_0x33fd6c(++_0x267fef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8d7fe72..49b569a 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 _0xa3fe=['INTEGER','STRING'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0xa3fe,0x1c0));var _0xea3f=function(_0x372800,_0x5857de){_0x372800=_0x372800-0x0;var _0x3fb5ff=_0xa3fe[_0x372800];return _0x3fb5ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xea3f('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xea3f('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xea3f('0x1')]}}; \ No newline at end of file +var _0x0198=['INTEGER','STRING','sequelize','exports'];(function(_0x384447,_0x41669a){var _0x3810db=function(_0x3f1288){while(--_0x3f1288){_0x384447['push'](_0x384447['shift']());}};_0x3810db(++_0x41669a);}(_0x0198,0x1f2));var _0x8019=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0x0198[_0x438685];return _0x41cca2;};'use strict';var Sequelize=require(_0x8019('0x0'));module[_0x8019('0x1')]={'penalty':{'type':Sequelize[_0x8019('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8019('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e791ce1..07f1ba2 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 _0x8853=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userFaxQueue.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8853,0x183));var _0x3885=function(_0x57be4d,_0x57b945){_0x57be4d=_0x57be4d-0x0;var _0xbf8a91=_0x8853[_0x57be4d];return _0xbf8a91;};'use strict';var _=require(_0x3885('0x0'));var util=require(_0x3885('0x1'));var logger=require(_0x3885('0x2'))(_0x3885('0x3'));var moment=require(_0x3885('0x4'));var BPromise=require('bluebird');var rp=require(_0x3885('0x5'));var fs=require('fs');var path=require(_0x3885('0x6'));var rimraf=require(_0x3885('0x7'));var config=require('../../config/environment');var attributes=require(_0x3885('0x8'));module[_0x3885('0x9')]=function(_0x1c773e,_0x39ab5a){return _0x1c773e[_0x3885('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf457=['moment','bluebird','path','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api'];(function(_0x6c77b1,_0x4399eb){var _0x1cee86=function(_0xf4f50){while(--_0xf4f50){_0x6c77b1['push'](_0x6c77b1['shift']());}};_0x1cee86(++_0x4399eb);}(_0xf457,0x17e));var _0x7f45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf457[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f45('0x0'));var util=require(_0x7f45('0x1'));var logger=require('../../config/logger')(_0x7f45('0x2'));var moment=require(_0x7f45('0x3'));var BPromise=require(_0x7f45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f45('0x5'));var rimraf=require(_0x7f45('0x6'));var config=require(_0x7f45('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x7f45('0x8')]=function(_0x5b4a89,_0x360c55){return _0x5b4a89['define'](_0x7f45('0x9'),attributes,{'tableName':_0x7f45('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 eee7891..44be8ba 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 _0x1c99=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x1c99,0x19d));var _0x91c9=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0x1c99[_0x5f3de3];return _0x287e0d;};'use strict';var _=require(_0x91c9('0x0'));var util=require(_0x91c9('0x1'));var moment=require(_0x91c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x91c9('0x3'));var fs=require('fs');var Redis=require(_0x91c9('0x4'));var db=require(_0x91c9('0x5'))['db'];var utils=require(_0x91c9('0x6'));var logger=require(_0x91c9('0x7'))('rpc');var config=require(_0x91c9('0x8'));var jayson=require(_0x91c9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaf0e4e,_0x5c36f3,_0x33fe7c){return new BPromise(function(_0x4f5d22,_0xd694b6){return client['request'](_0xaf0e4e,_0x33fe7c)['then'](function(_0x3213f6){logger[_0x91c9('0xa')](_0x91c9('0xb'),_0x5c36f3,_0x91c9('0xc'));logger[_0x91c9('0xd')](_0x91c9('0xe'),_0x5c36f3,_0x91c9('0xc'),JSON['stringify'](_0x3213f6));if(_0x3213f6[_0x91c9('0xf')]){if(_0x3213f6[_0x91c9('0xf')]['code']===0x1f4){logger[_0x91c9('0xf')](_0x91c9('0xb'),_0x5c36f3,_0x3213f6[_0x91c9('0xf')]['message']);return _0xd694b6(_0x3213f6['error'][_0x91c9('0x10')]);}logger['error'](_0x91c9('0xb'),_0x5c36f3,_0x3213f6[_0x91c9('0xf')][_0x91c9('0x10')]);return _0x4f5d22(_0x3213f6[_0x91c9('0xf')]['message']);}else{logger[_0x91c9('0xa')](_0x91c9('0xb'),_0x5c36f3,_0x91c9('0xc'));_0x4f5d22(_0x3213f6[_0x91c9('0x11')][_0x91c9('0x10')]);}})['catch'](function(_0x464e3b){logger[_0x91c9('0xf')](_0x91c9('0xb'),_0x5c36f3,_0x464e3b);_0xd694b6(_0x464e3b);});});} \ No newline at end of file +var _0xd710=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd710,0x139));var _0x0d71=function(_0x43326a,_0x858d39){_0x43326a=_0x43326a-0x0;var _0x3652eb=_0xd710[_0x43326a];return _0x3652eb;};'use strict';var _=require(_0x0d71('0x0'));var util=require(_0x0d71('0x1'));var moment=require(_0x0d71('0x2'));var BPromise=require(_0x0d71('0x3'));var rs=require(_0x0d71('0x4'));var fs=require('fs');var Redis=require(_0x0d71('0x5'));var db=require(_0x0d71('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d71('0x7'))(_0x0d71('0x8'));var config=require(_0x0d71('0x9'));var jayson=require(_0x0d71('0xa'));var client=jayson['client'][_0x0d71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aa73f,_0x2ee93e,_0x5166d2){return new BPromise(function(_0x4517d3,_0x53d0b8){return client['request'](_0x1aa73f,_0x5166d2)[_0x0d71('0xc')](function(_0x38039c){logger[_0x0d71('0xd')](_0x0d71('0xe'),_0x2ee93e,_0x0d71('0xf'));logger[_0x0d71('0x10')](_0x0d71('0x11'),_0x2ee93e,_0x0d71('0xf'),JSON[_0x0d71('0x12')](_0x38039c));if(_0x38039c[_0x0d71('0x13')]){if(_0x38039c[_0x0d71('0x13')][_0x0d71('0x14')]===0x1f4){logger[_0x0d71('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2ee93e,_0x38039c[_0x0d71('0x13')][_0x0d71('0x15')]);return _0x53d0b8(_0x38039c[_0x0d71('0x13')][_0x0d71('0x15')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x2ee93e,_0x38039c[_0x0d71('0x13')][_0x0d71('0x15')]);return _0x4517d3(_0x38039c[_0x0d71('0x13')]['message']);}else{logger[_0x0d71('0xd')](_0x0d71('0xe'),_0x2ee93e,_0x0d71('0xf'));_0x4517d3(_0x38039c[_0x0d71('0x16')][_0x0d71('0x15')]);}})[_0x0d71('0x17')](function(_0x51938b){logger[_0x0d71('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2ee93e,_0x51938b);_0x53d0b8(_0x51938b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b8682aa..8bdcb02 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ca7c9,_0x1cc91d){var _0x261fb4=function(_0x59157c){while(--_0x59157c){_0x5ca7c9['push'](_0x5ca7c9['shift']());}};_0x261fb4(++_0x1cc91d);}(_0xe706,0xa3));var _0x6e70=function(_0x874a49,_0x5b07bc){_0x874a49=_0x874a49-0x0;var _0x343d2f=_0xe706[_0x874a49];return _0x343d2f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41b01c,_0x2be4fc){var _0x4de31b=function(_0x479079){while(--_0x479079){_0x41b01c['push'](_0x41b01c['shift']());}};_0x4de31b(++_0x2be4fc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xcb91[_0x4b5813];return _0x423465;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index be48410..d50edb3 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 _0x5e76=['INTEGER'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x5e76,0x16e));var _0x65e7=function(_0x5bb56e,_0x45343c){_0x5bb56e=_0x5bb56e-0x0;var _0x1e3a33=_0x5e76[_0x5bb56e];return _0x1e3a33;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x65e7('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc063=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc063,0xb6));var _0x3c06=function(_0x487f47,_0x32b30b){_0x487f47=_0x487f47-0x0;var _0x35988b=_0xc063[_0x487f47];return _0x35988b;};'use strict';var Sequelize=require(_0x3c06('0x0'));module[_0x3c06('0x1')]={'penalty':{'type':Sequelize[_0x3c06('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 fd3c1a8..c558187 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 _0x62ae=['rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x585fb6,_0x434296){var _0x920e23=function(_0x59ba5f){while(--_0x59ba5f){_0x585fb6['push'](_0x585fb6['shift']());}};_0x920e23(++_0x434296);}(_0x62ae,0x1c2));var _0xe62a=function(_0xb626f6,_0x4b4075){_0xb626f6=_0xb626f6-0x0;var _0x2c620b=_0x62ae[_0xb626f6];return _0x2c620b;};'use strict';var _=require(_0xe62a('0x0'));var util=require('util');var logger=require(_0xe62a('0x1'))(_0xe62a('0x2'));var moment=require(_0xe62a('0x3'));var BPromise=require('bluebird');var rp=require(_0xe62a('0x4'));var fs=require('fs');var path=require(_0xe62a('0x5'));var rimraf=require(_0xe62a('0x6'));var config=require('../../config/environment');var attributes=require(_0xe62a('0x7'));module[_0xe62a('0x8')]=function(_0x3390de,_0x3c4471){return _0x3390de[_0xe62a('0x9')](_0xe62a('0xa'),attributes,{'tableName':_0xe62a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x089d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues'];(function(_0x364166,_0x442425){var _0x390b20=function(_0x2fe315){while(--_0x2fe315){_0x364166['push'](_0x364166['shift']());}};_0x390b20(++_0x442425);}(_0x089d,0x11e));var _0xd089=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x089d[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require(_0xd089('0x0'));var logger=require(_0xd089('0x1'))(_0xd089('0x2'));var moment=require(_0xd089('0x3'));var BPromise=require(_0xd089('0x4'));var rp=require(_0xd089('0x5'));var fs=require('fs');var path=require(_0xd089('0x6'));var rimraf=require(_0xd089('0x7'));var config=require(_0xd089('0x8'));var attributes=require(_0xd089('0x9'));module[_0xd089('0xa')]=function(_0x25dfd4,_0x1dbec6){return _0x25dfd4[_0xd089('0xb')]('UserMailQueue',attributes,{'tableName':_0xd089('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 36923ab..3f985af 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2e9ab0,_0x21ab80){var _0xe1b514=function(_0x4da988){while(--_0x4da988){_0x2e9ab0['push'](_0x2e9ab0['shift']());}};_0xe1b514(++_0x21ab80);}(_0x8ef6,0xf2));var _0x68ef=function(_0x589f61,_0x402505){_0x589f61=_0x589f61-0x0;var _0x43b08b=_0x8ef6[_0x589f61];return _0x43b08b;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7526df2..5f0b4c8 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 _0xe1a1=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x32af08,_0x510d6d){var _0x21824b=function(_0x17203a){while(--_0x17203a){_0x32af08['push'](_0x32af08['shift']());}};_0x21824b(++_0x510d6d);}(_0xe1a1,0x70));var _0x1e1a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe1a1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1e1a('0x0'));var util=require(_0x1e1a('0x1'));var path=require(_0x1e1a('0x2'));var timeout=require(_0x1e1a('0x3'));var express=require(_0x1e1a('0x4'));var router=express[_0x1e1a('0x5')]();var fs_extra=require(_0x1e1a('0x6'));var auth=require(_0x1e1a('0x7'));var interaction=require(_0x1e1a('0x8'));var config=require(_0x1e1a('0x9'));var controller=require(_0x1e1a('0xa'));router[_0x1e1a('0xb')]('/',auth[_0x1e1a('0xc')](),controller[_0x1e1a('0xd')]);module[_0x1e1a('0xe')]=router; \ No newline at end of file +var _0x1d41=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x3f2188,_0x9e3028){var _0x4aedf7=function(_0x3d0edd){while(--_0x3d0edd){_0x3f2188['push'](_0x3f2188['shift']());}};_0x4aedf7(++_0x9e3028);}(_0x1d41,0x8b));var _0x11d4=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0x1d41[_0x438685];return _0x41cca2;};'use strict';var multer=require(_0x11d4('0x0'));var util=require(_0x11d4('0x1'));var path=require(_0x11d4('0x2'));var timeout=require(_0x11d4('0x3'));var express=require(_0x11d4('0x4'));var router=express[_0x11d4('0x5')]();var fs_extra=require(_0x11d4('0x6'));var auth=require(_0x11d4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x11d4('0x8'));var controller=require(_0x11d4('0x9'));router[_0x11d4('0xa')]('/',auth[_0x11d4('0xb')](),controller[_0x11d4('0xc')]);module[_0x11d4('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 972ccb1..0934056 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 _0x055b=['STRING','BOOLEAN','sequelize'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0x055b,0x158));var _0xb055=function(_0x4e7bb4,_0x472b76){_0x4e7bb4=_0x4e7bb4-0x0;var _0x20d206=_0x055b[_0x4e7bb4];return _0x20d206;};'use strict';var Sequelize=require(_0xb055('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xb055('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xb055('0x1')]},'beep':{'type':Sequelize[_0xb055('0x2')]}}; \ No newline at end of file +var _0xb72b=['STRING','BOOLEAN','exports'];(function(_0x4d53c7,_0x1f1347){var _0x697e9b=function(_0x9a08c3){while(--_0x9a08c3){_0x4d53c7['push'](_0x4d53c7['shift']());}};_0x697e9b(++_0x1f1347);}(_0xb72b,0xf2));var _0xbb72=function(_0xf54a63,_0x1fb5e3){_0xf54a63=_0xf54a63-0x0;var _0x46b530=_0xb72b[_0xf54a63];return _0x46b530;};'use strict';var Sequelize=require('sequelize');module[_0xbb72('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbb72('0x1')]},'beep':{'type':Sequelize[_0xbb72('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 89ae734..fc7e04c 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 _0x7139=['Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','toLowerCase','User','ids','replace','queue','all','union','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','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','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','then','destroy','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x7139,0x91));var _0x9713=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7139[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x9713('0x0'));var rimraf=require(_0x9713('0x1'));var zipdir=require(_0x9713('0x2'));var jsonpatch=require(_0x9713('0x3'));var rp=require(_0x9713('0x4'));var moment=require(_0x9713('0x5'));var BPromise=require(_0x9713('0x6'));var Mustache=require(_0x9713('0x7'));var util=require('util');var path=require(_0x9713('0x8'));var sox=require(_0x9713('0x9'));var csv=require(_0x9713('0xa'));var ejs=require(_0x9713('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9713('0xc'));var squel=require('squel');var crypto=require(_0x9713('0xd'));var jsforce=require(_0x9713('0xe'));var deskjs=require(_0x9713('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9713('0x10'));var Papa=require(_0x9713('0x11'));var Redis=require('ioredis');var authService=require(_0x9713('0x12'));var qs=require(_0x9713('0x13'));var as=require(_0x9713('0x14'));var hardwareService=require(_0x9713('0x15'));var logger=require('../../config/logger')(_0x9713('0x16'));var utils=require(_0x9713('0x17'));var config=require(_0x9713('0x18'));var licenseUtil=require(_0x9713('0x19'));var db=require(_0x9713('0x1a'))['db'];config[_0x9713('0x1b')]=_[_0x9713('0x1c')](config[_0x9713('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9713('0x1d'))(new Redis(config[_0x9713('0x1b')]));require(_0x9713('0x1e'))[_0x9713('0x1f')](socket);function respondWithStatusCode(_0x201ad8,_0x3c767d){_0x3c767d=_0x3c767d||0xcc;return function(_0x58e2b0){if(_0x58e2b0){return _0x201ad8[_0x9713('0x20')](_0x3c767d);}return _0x201ad8[_0x9713('0x21')](_0x3c767d)[_0x9713('0x22')]();};}function respondWithResult(_0x24d582,_0x47a48c){_0x47a48c=_0x47a48c||0xc8;return function(_0x309660){if(_0x309660){return _0x24d582[_0x9713('0x21')](_0x47a48c)[_0x9713('0x23')](_0x309660);}};}function respondWithFilteredResult(_0x51d5e1,_0xae2e9d){return function(_0x14060d){if(_0x14060d){var _0x1657de=typeof _0xae2e9d[_0x9713('0x24')]===_0x9713('0x25')&&typeof _0xae2e9d['limit']===_0x9713('0x25');var _0x3e9b74=_0x14060d[_0x9713('0x26')];var _0xd664d9=_0x1657de?0x0:_0xae2e9d[_0x9713('0x24')];var _0x281a3c=_0x1657de?_0x14060d['count']:_0xae2e9d['offset']+_0xae2e9d['limit'];var _0x1e2e09;if(_0x281a3c>=_0x3e9b74){_0x281a3c=_0x3e9b74;_0x1e2e09=0xc8;}else{_0x1e2e09=0xce;}_0x51d5e1['status'](_0x1e2e09);return _0x51d5e1['set']('Content-Range',_0xd664d9+'-'+_0x281a3c+'/'+_0x3e9b74)[_0x9713('0x23')](_0x14060d);}return null;};}function patchUpdates(_0x3a2991){return function(_0x4f185c){try{jsonpatch[_0x9713('0x27')](_0x4f185c,_0x3a2991,!![]);}catch(_0x2693e0){return BPromise[_0x9713('0x28')](_0x2693e0);}return _0x4f185c['save']();};}function saveUpdates(_0x5c7c48,_0x5e9980){return function(_0xdb1aad){if(_0xdb1aad){return _0xdb1aad[_0x9713('0x29')](_0x5c7c48)[_0x9713('0x2a')](function(_0x36435){return _0x36435;});}return null;};}function removeEntity(_0x48f30f,_0x442866){return function(_0x4171de){if(_0x4171de){return _0x4171de[_0x9713('0x2b')]()[_0x9713('0x2a')](function(){_0x48f30f['status'](0xcc)[_0x9713('0x22')]();});}};}function handleEntityNotFound(_0x3830c9,_0x5db4c1){return function(_0x19c152){if(!_0x19c152){_0x3830c9[_0x9713('0x20')](0x194);}return _0x19c152;};}function handleError(_0x3b3121,_0x3780e3){_0x3780e3=_0x3780e3||0x1f4;return function(_0x2ec4c8){logger['error'](_0x2ec4c8[_0x9713('0x2c')]);if(_0x2ec4c8[_0x9713('0x2d')]){delete _0x2ec4c8[_0x9713('0x2d')];}_0x3b3121[_0x9713('0x21')](_0x3780e3)[_0x9713('0x2e')](_0x2ec4c8);};}exports['sendUserNotification']=function(_0xbf8f14,_0x2841e0,_0x430d4b){if(!_0xbf8f14[_0x9713('0x2f')][_0x9713('0x30')](_0x9713('0x31'))&&!_0xbf8f14[_0x9713('0x2f')][_0x9713('0x30')](_0x9713('0x32'))){throw new db['Sequelize'][(_0x9713('0x33'))](_0x9713('0x34'));}else{if(_0xbf8f14[_0x9713('0x2f')]['hasOwnProperty'](_0x9713('0x32'))&&!_0xbf8f14[_0x9713('0x2f')]['hasOwnProperty']('view')){throw new db[(_0x9713('0x35'))][(_0x9713('0x33'))](_0x9713('0x36'));}if(!_0xbf8f14[_0x9713('0x2f')][_0x9713('0x30')](_0x9713('0x37'))){throw new db['Sequelize'][(_0x9713('0x33'))](_0x9713('0x38'));}else{try{var _0x36761c=JSON[_0x9713('0x39')](_0xbf8f14['body']['recipients']);}catch(_0x1c2e02){logger[_0x9713('0x3a')](_0x1c2e02);throw new db[(_0x9713('0x35'))][(_0x9713('0x33'))](_0x9713('0x3b'));}var _0x4496c9=['chatqueue',_0x9713('0x3c'),_0x9713('0x3d'),_0x9713('0x3e'),_0x9713('0x3f'),'voicequeue',_0x9713('0x40'),_0x9713('0x41'),_0x9713('0x42')];if(_[_0x9713('0x43')](_0x36761c,function(_0x31bd73){return!_[_0x9713('0x44')](_0x4496c9,_0x31bd73[_0x9713('0x45')]['toLowerCase']());})){throw new db[(_0x9713('0x35'))][(_0x9713('0x33'))](_0x9713('0x46'));}}}var _0x23635a={};_0x23635a['senderName']=_0xbf8f14[_0x9713('0x2f')][_0x9713('0x30')](_0x9713('0x47'))?_0xbf8f14[_0x9713('0x2f')][_0x9713('0x47')]:_0xbf8f14[_0x9713('0x42')]['fullname'];_0x23635a[_0x9713('0x48')]=_[_0x9713('0x49')](_0xbf8f14[_0x9713('0x2f')]['recipientsDescription'])?null:_0xbf8f14[_0x9713('0x2f')][_0x9713('0x48')];_0x23635a['beep']=_0xbf8f14[_0x9713('0x2f')][_0x9713('0x4a')]||![];_0x23635a[_0x9713('0x4b')]=_0xbf8f14[_0x9713('0x42')]['id'];return getContent(_0xbf8f14[_0x9713('0x2f')])['then'](function(_0x121d2d){_0x23635a[_0x9713('0x2f')]=_0x121d2d;return getRecipients(_0x36761c);})['then'](function(_0x3b9329){_0x23635a['recipientsId']=_[_0x9713('0x4c')](_0x3b9329)[_0x9713('0x4d')](',');return db[_0x9713('0x4e')]['transaction'](function(_0x6bb3df){return db[_0x9713('0x4f')][_0x9713('0x50')](_0x23635a,{'raw':!![],'transaction':_0x6bb3df})[_0x9713('0x2a')](function(_0x738adf){var _0x33c37a={'sender':_0x23635a[_0x9713('0x47')],'description':_0x23635a[_0x9713('0x48')],'content':_0x23635a[_0x9713('0x2f')],'beep':_0x23635a['beep']};_0x3b9329[_0x9713('0x51')](function(_0x4ef64c){_0x33c37a[_0x9713('0x52')]=_0x4ef64c;socket[_0x9713('0x53')](_0x9713('0x54'),_0x33c37a);});return _0x738adf;});});})[_0x9713('0x2a')](respondWithResult(_0x2841e0,0xc9))[_0x9713('0x55')](handleError(_0x2841e0,null));};function getContent(_0x350166){return new BPromise(function(_0x448e60,_0x24bac8){if(_0x350166['text']){_0x448e60(_0x350166[_0x9713('0x31')]);return;}return db['Template']['findOne']({'attributes':[_0x9713('0x56')],'where':{'id':_0x350166[_0x9713('0x32')]},'raw':!![]})['then'](function(_0xbd6863){if(!_0xbd6863)throw new db['Sequelize'][(_0x9713('0x33'))](_0x9713('0x57'));var _0x29e24f=Mustache[_0x9713('0x58')](_0xbd6863[_0x9713('0x56')],_0x350166[_0x9713('0x59')]);_0x448e60(_0x29e24f);})[_0x9713('0x55')](function(_0x2b3e1b){_0x24bac8(_0x2b3e1b);});});}function getRecipients(_0x348adf){return new BPromise(function(_0x518c76,_0x19c060){var _0x229373=[];var _0x461a35=[];_0x348adf[_0x9713('0x51')](function(_0x5118d5){var _0x280d49=_[_0x9713('0x5a')](_0x5118d5[_0x9713('0x45')][_0x9713('0x5b')]());if(_0x280d49===_0x9713('0x5c')){_0x229373=_['union'](_0x229373,_0x5118d5[_0x9713('0x5d')]);}else{if(_[_0x9713('0x44')](_0x280d49,'queue'))_0x280d49=_0x280d49[_0x9713('0x5e')](_0x9713('0x5f'),'Queue');_0x5118d5[_0x9713('0x5d')][_0x9713('0x51')](function(_0x56eb66){_0x461a35['push'](getAgents(_0x280d49,_0x56eb66));});}});return BPromise[_0x9713('0x60')](_0x461a35)[_0x9713('0x2a')](function(_0x559aab){_0x229373=_[_0x9713('0x61')](_0x229373,_[_0x9713('0x62')](_0x559aab));_0x518c76(_0x229373);})['catch'](function(_0x1b432e){_0x19c060(_0x1b432e);});});}function getAgents(_0x58db2d,_0x506e3f){return new BPromise(function(_0x372e78,_0x3ba10a){return db[_0x58db2d][_0x9713('0x63')]({'where':{'id':_0x506e3f}})['then'](function(_0x4ceaf6){return _0x4ceaf6[_0x9713('0x64')]({'attributes':['id'],'raw':!![]})[_0x9713('0x2a')](function(_0x585d6a){var _0x4da89f=_[_0x9713('0x65')](_0x585d6a,'id');_0x372e78(_0x4da89f);});})['catch'](function(_0x81c823){_0x3ba10a(_0x81c823);});});} \ No newline at end of file +var _0x1d0a=['destroy','stack','name','send','sendUserNotification','text','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Sequelize','Missing\x20\x27recipients\x27\x20parameter','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','some','model','toLowerCase','senderName','user','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification','forEach','recipient','emit','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','replace','queue','Queue','union','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then'];(function(_0x3c17b9,_0x5784ff){var _0x17ba51=function(_0x5d03e4){while(--_0x5d03e4){_0x3c17b9['push'](_0x3c17b9['shift']());}};_0x17ba51(++_0x5784ff);}(_0x1d0a,0x160));var _0xa1d0=function(_0x1cabe3,_0x28f649){_0x1cabe3=_0x1cabe3-0x0;var _0x318683=_0x1d0a[_0x1cabe3];return _0x318683;};'use strict';var emlformat=require(_0xa1d0('0x0'));var rimraf=require(_0xa1d0('0x1'));var zipdir=require(_0xa1d0('0x2'));var jsonpatch=require(_0xa1d0('0x3'));var rp=require(_0xa1d0('0x4'));var moment=require(_0xa1d0('0x5'));var BPromise=require(_0xa1d0('0x6'));var Mustache=require(_0xa1d0('0x7'));var util=require('util');var path=require(_0xa1d0('0x8'));var sox=require(_0xa1d0('0x9'));var csv=require(_0xa1d0('0xa'));var ejs=require(_0xa1d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa1d0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa1d0('0xd'));var Papa=require(_0xa1d0('0xe'));var Redis=require(_0xa1d0('0xf'));var authService=require(_0xa1d0('0x10'));var qs=require(_0xa1d0('0x11'));var as=require(_0xa1d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1d0('0x13'))(_0xa1d0('0x14'));var utils=require(_0xa1d0('0x15'));var config=require(_0xa1d0('0x16'));var licenseUtil=require(_0xa1d0('0x17'));var db=require(_0xa1d0('0x18'))['db'];config[_0xa1d0('0x19')]=_[_0xa1d0('0x1a')](config[_0xa1d0('0x19')],{'host':_0xa1d0('0x1b'),'port':0x18eb});var socket=require(_0xa1d0('0x1c'))(new Redis(config[_0xa1d0('0x19')]));require(_0xa1d0('0x1d'))['register'](socket);function respondWithStatusCode(_0x30b715,_0x18d5a2){_0x18d5a2=_0x18d5a2||0xcc;return function(_0x29905f){if(_0x29905f){return _0x30b715[_0xa1d0('0x1e')](_0x18d5a2);}return _0x30b715[_0xa1d0('0x1f')](_0x18d5a2)[_0xa1d0('0x20')]();};}function respondWithResult(_0x23016e,_0x395176){_0x395176=_0x395176||0xc8;return function(_0x2a28b9){if(_0x2a28b9){return _0x23016e[_0xa1d0('0x1f')](_0x395176)[_0xa1d0('0x21')](_0x2a28b9);}};}function respondWithFilteredResult(_0x347638,_0x29c8d6){return function(_0x4894f8){if(_0x4894f8){var _0x579492=typeof _0x29c8d6[_0xa1d0('0x22')]==='undefined'&&typeof _0x29c8d6['limit']===_0xa1d0('0x23');var _0x41dd32=_0x4894f8['count'];var _0x196684=_0x579492?0x0:_0x29c8d6['offset'];var _0x495d49=_0x579492?_0x4894f8[_0xa1d0('0x24')]:_0x29c8d6[_0xa1d0('0x22')]+_0x29c8d6[_0xa1d0('0x25')];var _0x470083;if(_0x495d49>=_0x41dd32){_0x495d49=_0x41dd32;_0x470083=0xc8;}else{_0x470083=0xce;}_0x347638['status'](_0x470083);return _0x347638[_0xa1d0('0x26')](_0xa1d0('0x27'),_0x196684+'-'+_0x495d49+'/'+_0x41dd32)[_0xa1d0('0x21')](_0x4894f8);}return null;};}function patchUpdates(_0x132110){return function(_0x167519){try{jsonpatch[_0xa1d0('0x28')](_0x167519,_0x132110,!![]);}catch(_0x48e609){return BPromise['reject'](_0x48e609);}return _0x167519[_0xa1d0('0x29')]();};}function saveUpdates(_0x3ab3e2,_0x1d8af0){return function(_0x2eb225){if(_0x2eb225){return _0x2eb225[_0xa1d0('0x2a')](_0x3ab3e2)[_0xa1d0('0x2b')](function(_0x3ac07c){return _0x3ac07c;});}return null;};}function removeEntity(_0x2ff210,_0x1af1bc){return function(_0x96008b){if(_0x96008b){return _0x96008b[_0xa1d0('0x2c')]()[_0xa1d0('0x2b')](function(){_0x2ff210[_0xa1d0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5059b3,_0x14efdb){return function(_0x291498){if(!_0x291498){_0x5059b3[_0xa1d0('0x1e')](0x194);}return _0x291498;};}function handleError(_0x85b0,_0x4904ba){_0x4904ba=_0x4904ba||0x1f4;return function(_0x2ac408){logger['error'](_0x2ac408[_0xa1d0('0x2d')]);if(_0x2ac408[_0xa1d0('0x2e')]){delete _0x2ac408['name'];}_0x85b0['status'](_0x4904ba)[_0xa1d0('0x2f')](_0x2ac408);};}exports[_0xa1d0('0x30')]=function(_0xfe91e5,_0x15ba1f,_0x383a02){if(!_0xfe91e5['body']['hasOwnProperty'](_0xa1d0('0x31'))&&!_0xfe91e5[_0xa1d0('0x32')][_0xa1d0('0x33')]('TemplateId')){throw new db['Sequelize'][(_0xa1d0('0x34'))](_0xa1d0('0x35'));}else{if(_0xfe91e5[_0xa1d0('0x32')]['hasOwnProperty']('TemplateId')&&!_0xfe91e5[_0xa1d0('0x32')]['hasOwnProperty'](_0xa1d0('0x36'))){throw new db['Sequelize'][(_0xa1d0('0x34'))](_0xa1d0('0x37'));}if(!_0xfe91e5[_0xa1d0('0x32')][_0xa1d0('0x33')]('recipients')){throw new db[(_0xa1d0('0x38'))][(_0xa1d0('0x34'))](_0xa1d0('0x39'));}else{try{var _0x11b957=JSON['parse'](_0xfe91e5[_0xa1d0('0x32')][_0xa1d0('0x3a')]);}catch(_0x176e1b){logger[_0xa1d0('0x3b')](_0x176e1b);throw new db[(_0xa1d0('0x38'))][(_0xa1d0('0x34'))](_0xa1d0('0x3c'));}var _0x33b32a=[_0xa1d0('0x3d'),_0xa1d0('0x3e'),_0xa1d0('0x3f'),_0xa1d0('0x40'),_0xa1d0('0x41'),'voicequeue','whatsappqueue',_0xa1d0('0x42'),'user'];if(_[_0xa1d0('0x43')](_0x11b957,function(_0xc32f3d){return!_['includes'](_0x33b32a,_0xc32f3d[_0xa1d0('0x44')][_0xa1d0('0x45')]());})){throw new db[(_0xa1d0('0x38'))][(_0xa1d0('0x34'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x501233={};_0x501233[_0xa1d0('0x46')]=_0xfe91e5[_0xa1d0('0x32')]['hasOwnProperty']('senderName')?_0xfe91e5['body'][_0xa1d0('0x46')]:_0xfe91e5[_0xa1d0('0x47')]['fullname'];_0x501233[_0xa1d0('0x48')]=_[_0xa1d0('0x49')](_0xfe91e5[_0xa1d0('0x32')][_0xa1d0('0x48')])?null:_0xfe91e5['body'][_0xa1d0('0x48')];_0x501233[_0xa1d0('0x4a')]=_0xfe91e5[_0xa1d0('0x32')]['beep']||![];_0x501233[_0xa1d0('0x4b')]=_0xfe91e5[_0xa1d0('0x47')]['id'];return getContent(_0xfe91e5['body'])[_0xa1d0('0x2b')](function(_0x92eea4){_0x501233[_0xa1d0('0x32')]=_0x92eea4;return getRecipients(_0x11b957);})[_0xa1d0('0x2b')](function(_0x1565c6){_0x501233['recipientsId']=_[_0xa1d0('0x4c')](_0x1565c6)['join'](',');return db[_0xa1d0('0x4d')][_0xa1d0('0x4e')](function(_0x500164){return db[_0xa1d0('0x4f')]['create'](_0x501233,{'raw':!![],'transaction':_0x500164})[_0xa1d0('0x2b')](function(_0x98f69c){var _0x3e612d={'sender':_0x501233['senderName'],'description':_0x501233[_0xa1d0('0x48')],'content':_0x501233['body'],'beep':_0x501233['beep']};_0x1565c6[_0xa1d0('0x50')](function(_0x5efba0){_0x3e612d[_0xa1d0('0x51')]=_0x5efba0;socket[_0xa1d0('0x52')]('userNotification:send',_0x3e612d);});return _0x98f69c;});});})[_0xa1d0('0x2b')](respondWithResult(_0x15ba1f,0xc9))['catch'](handleError(_0x15ba1f,null));};function getContent(_0x585d4c){return new BPromise(function(_0x3ae6a8,_0x41293a){if(_0x585d4c['text']){_0x3ae6a8(_0x585d4c[_0xa1d0('0x31')]);return;}return db[_0xa1d0('0x53')][_0xa1d0('0x54')]({'attributes':[_0xa1d0('0x55')],'where':{'id':_0x585d4c[_0xa1d0('0x56')]},'raw':!![]})['then'](function(_0x5dabcd){if(!_0x5dabcd)throw new db[(_0xa1d0('0x38'))]['ValidationError'](_0xa1d0('0x57'));var _0x3658d7=Mustache[_0xa1d0('0x58')](_0x5dabcd[_0xa1d0('0x55')],_0x585d4c[_0xa1d0('0x36')]);_0x3ae6a8(_0x3658d7);})['catch'](function(_0x345c04){_0x41293a(_0x345c04);});});}function getRecipients(_0x4b76b1){return new BPromise(function(_0x47ff29,_0x267dd1){var _0x4a5ddd=[];var _0x54bba7=[];_0x4b76b1['forEach'](function(_0x3fd933){var _0x91383=_[_0xa1d0('0x59')](_0x3fd933[_0xa1d0('0x44')][_0xa1d0('0x45')]());if(_0x91383===_0xa1d0('0x5a')){_0x4a5ddd=_['union'](_0x4a5ddd,_0x3fd933[_0xa1d0('0x5b')]);}else{if(_['includes'](_0x91383,'queue'))_0x91383=_0x91383[_0xa1d0('0x5c')](_0xa1d0('0x5d'),_0xa1d0('0x5e'));_0x3fd933[_0xa1d0('0x5b')]['forEach'](function(_0x371055){_0x54bba7['push'](getAgents(_0x91383,_0x371055));});}});return BPromise['all'](_0x54bba7)['then'](function(_0x5b62e4){_0x4a5ddd=_[_0xa1d0('0x5f')](_0x4a5ddd,_['flatten'](_0x5b62e4));_0x47ff29(_0x4a5ddd);})[_0xa1d0('0x60')](function(_0x4d4065){_0x267dd1(_0x4d4065);});});}function getAgents(_0x1569d5,_0x1a2b63){return new BPromise(function(_0x584f4b,_0x4fba7a){return db[_0x1569d5]['findOne']({'where':{'id':_0x1a2b63}})[_0xa1d0('0x2b')](function(_0x47ca7b){return _0x47ca7b[_0xa1d0('0x61')]({'attributes':['id'],'raw':!![]})[_0xa1d0('0x2b')](function(_0x112f0f){var _0x4d7420=_[_0xa1d0('0x62')](_0x112f0f,'id');_0x584f4b(_0x4d7420);});})[_0xa1d0('0x60')](function(_0x3ececa){_0x4fba7a(_0x3ececa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f9dcb9a..5164d64 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 _0x4f99=['hook','exports','events','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x4f99,0xca));var _0x94f9=function(_0x51c38f,_0xece6e6){_0x51c38f=_0x51c38f-0x0;var _0x510e04=_0x4f99[_0x51c38f];return _0x510e04;};'use strict';var EventEmitter=require(_0x94f9('0x0'));var UserNotification=require(_0x94f9('0x1'))['db'][_0x94f9('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94f9('0x3'),'afterUpdate':_0x94f9('0x4'),'afterDestroy':_0x94f9('0x5')};function emitEvent(_0x5925b1){return function(_0x28769d,_0x468957,_0x4a00ae){UserNotificationEvents[_0x94f9('0x6')](_0x5925b1+':'+_0x28769d['id'],_0x28769d);UserNotificationEvents['emit'](_0x5925b1,_0x28769d);_0x4a00ae(null);};}for(var e in events){if(events[_0x94f9('0x7')](e)){var event=events[e];UserNotification[_0x94f9('0x8')](e,emitEvent(event));}}module[_0x94f9('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x8ad7=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x57aac1,_0x10b51f){var _0x325aa9=function(_0x182be7){while(--_0x182be7){_0x57aac1['push'](_0x57aac1['shift']());}};_0x325aa9(++_0x10b51f);}(_0x8ad7,0xfa));var _0x78ad=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x8ad7[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x78ad('0x0'));var UserNotification=require(_0x78ad('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x78ad('0x2'),'afterUpdate':_0x78ad('0x3'),'afterDestroy':_0x78ad('0x4')};function emitEvent(_0x4adb84){return function(_0xe74aba,_0x1f2a38,_0xd5fc89){UserNotificationEvents[_0x78ad('0x5')](_0x4adb84+':'+_0xe74aba['id'],_0xe74aba);UserNotificationEvents[_0x78ad('0x5')](_0x4adb84,_0xe74aba);_0xd5fc89(null);};}for(var e in events){if(events[_0x78ad('0x6')](e)){var event=events[e];UserNotification[_0x78ad('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2289285..5906e01 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 _0x7f48=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x19c452,_0x4dbaab){var _0x99698c=function(_0x5aef73){while(--_0x5aef73){_0x19c452['push'](_0x19c452['shift']());}};_0x99698c(++_0x4dbaab);}(_0x7f48,0x13b));var _0x87f4=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x7f48[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var logger=require(_0x87f4('0x2'))(_0x87f4('0x3'));var moment=require(_0x87f4('0x4'));var BPromise=require(_0x87f4('0x5'));var rp=require(_0x87f4('0x6'));var fs=require('fs');var path=require(_0x87f4('0x7'));var rimraf=require('rimraf');var config=require(_0x87f4('0x8'));var attributes=require(_0x87f4('0x9'));module['exports']=function(_0x2ec5eb,_0x5e329d){return _0x2ec5eb[_0x87f4('0xa')](_0x87f4('0xb'),attributes,{'tableName':_0x87f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87f4('0xd'),'collate':_0x87f4('0xe')});}; \ No newline at end of file +var _0xc82e=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci'];(function(_0x48eefa,_0x549280){var _0x201b54=function(_0x575724){while(--_0x575724){_0x48eefa['push'](_0x48eefa['shift']());}};_0x201b54(++_0x549280);}(_0xc82e,0xd2));var _0xec82=function(_0x59f236,_0x43dbd6){_0x59f236=_0x59f236-0x0;var _0x4a3edd=_0xc82e[_0x59f236];return _0x4a3edd;};'use strict';var _=require(_0xec82('0x0'));var util=require('util');var logger=require(_0xec82('0x1'))(_0xec82('0x2'));var moment=require(_0xec82('0x3'));var BPromise=require(_0xec82('0x4'));var rp=require(_0xec82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec82('0x6'));var config=require(_0xec82('0x7'));var attributes=require(_0xec82('0x8'));module[_0xec82('0x9')]=function(_0x4e6bd4,_0x4ffdb8){return _0x4e6bd4[_0xec82('0xa')](_0xec82('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec82('0xc'),'collate':_0xec82('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index a04dda3..a4b7713 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 _0x8bc2=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserNotification,\x20%s,\x20%s','message'];(function(_0x134e56,_0x4a1930){var _0x5c98aa=function(_0x204939){while(--_0x204939){_0x134e56['push'](_0x134e56['shift']());}};_0x5c98aa(++_0x4a1930);}(_0x8bc2,0x1e1));var _0x28bc=function(_0x337ad4,_0x115de9){_0x337ad4=_0x337ad4-0x0;var _0x5d1d84=_0x8bc2[_0x337ad4];return _0x5d1d84;};'use strict';var _=require(_0x28bc('0x0'));var util=require(_0x28bc('0x1'));var moment=require(_0x28bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x28bc('0x3'));var fs=require('fs');var Redis=require(_0x28bc('0x4'));var db=require(_0x28bc('0x5'))['db'];var utils=require(_0x28bc('0x6'));var logger=require('../../config/logger')(_0x28bc('0x7'));var config=require('../../config/environment');var jayson=require(_0x28bc('0x8'));var client=jayson['client'][_0x28bc('0x9')]({'port':0x232a});config[_0x28bc('0xa')]=_[_0x28bc('0xb')](config[_0x28bc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x28bc('0xc'))(new Redis(config[_0x28bc('0xa')]));require('./userNotification.socket')[_0x28bc('0xd')](socket);function respondWithRpcPromise(_0x3c285c,_0x4acfcd,_0x5b6456){return new BPromise(function(_0x2b4125,_0x198ddb){return client['request'](_0x3c285c,_0x5b6456)[_0x28bc('0xe')](function(_0x32b9ac){logger[_0x28bc('0xf')]('UserNotification,\x20%s,\x20%s',_0x4acfcd,'request\x20sent');logger[_0x28bc('0x10')](_0x28bc('0x11'),_0x4acfcd,_0x28bc('0x12'),JSON[_0x28bc('0x13')](_0x32b9ac));if(_0x32b9ac[_0x28bc('0x14')]){if(_0x32b9ac[_0x28bc('0x14')]['code']===0x1f4){logger[_0x28bc('0x14')](_0x28bc('0x15'),_0x4acfcd,_0x32b9ac['error'][_0x28bc('0x16')]);return _0x198ddb(_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);}logger[_0x28bc('0x14')]('UserNotification,\x20%s,\x20%s',_0x4acfcd,_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);return _0x2b4125(_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);}else{logger['info'](_0x28bc('0x15'),_0x4acfcd,_0x28bc('0x12'));_0x2b4125(_0x32b9ac['result'][_0x28bc('0x16')]);}})[_0x28bc('0x17')](function(_0x286b60){logger['error'](_0x28bc('0x15'),_0x4acfcd,_0x286b60);_0x198ddb(_0x286b60);});});} \ No newline at end of file +var _0x0406=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','result'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x0406,0xd9));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6040('0x0'));var util=require(_0x6040('0x1'));var moment=require(_0x6040('0x2'));var BPromise=require('bluebird');var rs=require(_0x6040('0x3'));var fs=require('fs');var Redis=require(_0x6040('0x4'));var db=require(_0x6040('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6040('0x6'))('rpc');var config=require(_0x6040('0x7'));var jayson=require(_0x6040('0x8'));var client=jayson[_0x6040('0x9')][_0x6040('0xa')]({'port':0x232a});config['redis']=_[_0x6040('0xb')](config['redis'],{'host':_0x6040('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6040('0xd')]));require('./userNotification.socket')[_0x6040('0xe')](socket);function respondWithRpcPromise(_0x253ca0,_0xccb1a2,_0x401c87){return new BPromise(function(_0x196a9b,_0x59d122){return client[_0x6040('0xf')](_0x253ca0,_0x401c87)[_0x6040('0x10')](function(_0x2cb8a4){logger['info']('UserNotification,\x20%s,\x20%s',_0xccb1a2,_0x6040('0x11'));logger[_0x6040('0x12')](_0x6040('0x13'),_0xccb1a2,_0x6040('0x11'),JSON[_0x6040('0x14')](_0x2cb8a4));if(_0x2cb8a4[_0x6040('0x15')]){if(_0x2cb8a4[_0x6040('0x15')]['code']===0x1f4){logger[_0x6040('0x15')](_0x6040('0x16'),_0xccb1a2,_0x2cb8a4['error'][_0x6040('0x17')]);return _0x59d122(_0x2cb8a4[_0x6040('0x15')][_0x6040('0x17')]);}logger['error'](_0x6040('0x16'),_0xccb1a2,_0x2cb8a4[_0x6040('0x15')][_0x6040('0x17')]);return _0x196a9b(_0x2cb8a4[_0x6040('0x15')]['message']);}else{logger[_0x6040('0x18')](_0x6040('0x16'),_0xccb1a2,_0x6040('0x11'));_0x196a9b(_0x2cb8a4[_0x6040('0x19')][_0x6040('0x17')]);}})[_0x6040('0x1a')](function(_0x32a1f9){logger[_0x6040('0x15')]('UserNotification,\x20%s,\x20%s',_0xccb1a2,_0x32a1f9);_0x59d122(_0x32a1f9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 763e640..e759511 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 _0x383d=['./userNotification.events','remove','update','emit','length'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x383d,0x104));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var UserNotificationEvents=require(_0xd383('0x0'));var events=['save',_0xd383('0x1'),_0xd383('0x2')];function createListener(_0x433733,_0x39e3fa){return function(_0x1afd11){_0x39e3fa[_0xd383('0x3')](_0x433733,_0x1afd11);};}function removeListener(_0x1d2525,_0x112cc6){return function(){UserNotificationEvents['removeListener'](_0x1d2525,_0x112cc6);};}exports['register']=function(_0x37ba45){for(var _0x567f98=0x0,_0x35fb11=events[_0xd383('0x4')];_0x567f98<_0x35fb11;_0x567f98++){var _0x59ede1=events[_0x567f98];var _0x21bc51=createListener('userNotification:'+_0x59ede1,_0x37ba45);UserNotificationEvents['on'](_0x59ede1,_0x21bc51);}}; \ No newline at end of file +var _0xc09c=['userNotification:','save','remove','update','emit','removeListener','length'];(function(_0x281ade,_0x2fc303){var _0xbd6926=function(_0xb6125d){while(--_0xb6125d){_0x281ade['push'](_0x281ade['shift']());}};_0xbd6926(++_0x2fc303);}(_0xc09c,0xef));var _0xcc09=function(_0x3145e1,_0x384ac0){_0x3145e1=_0x3145e1-0x0;var _0x46113f=_0xc09c[_0x3145e1];return _0x46113f;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xcc09('0x0'),_0xcc09('0x1'),_0xcc09('0x2')];function createListener(_0x1ac20a,_0x2cdad4){return function(_0x5c77c8){_0x2cdad4[_0xcc09('0x3')](_0x1ac20a,_0x5c77c8);};}function removeListener(_0x3fd840,_0xa64977){return function(){UserNotificationEvents[_0xcc09('0x4')](_0x3fd840,_0xa64977);};}exports['register']=function(_0x2eaa40){for(var _0xbe8942=0x0,_0x156980=events[_0xcc09('0x5')];_0xbe8942<_0x156980;_0xbe8942++){var _0x1c34d3=events[_0xbe8942];var _0x3d3a2c=createListener(_0xcc09('0x6')+_0x1c34d3,_0x2eaa40);UserNotificationEvents['on'](_0x1c34d3,_0x3d3a2c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a6c5818..02bde0a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56b3a3,_0x77b2d){var _0x5315cf=function(_0x30622e){while(--_0x30622e){_0x56b3a3['push'](_0x56b3a3['shift']());}};_0x5315cf(++_0x77b2d);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x37a1f7,_0x281a3f){var _0x213cee=function(_0x4a041a){while(--_0x4a041a){_0x37a1f7['push'](_0x37a1f7['shift']());}};_0x213cee(++_0x281a3f);}(_0xe706,0xa3));var _0x6e70=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xe706[_0x4322c6];return _0x4e7537;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index be7b42e..b9035f5 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 _0x870c=['INTEGER'];(function(_0x89dbac,_0x38447d){var _0x2cb880=function(_0x498483){while(--_0x498483){_0x89dbac['push'](_0x89dbac['shift']());}};_0x2cb880(++_0x38447d);}(_0x870c,0x1b9));var _0xc870=function(_0x2861c2,_0x534955){_0x2861c2=_0x2861c2-0x0;var _0x2fe16a=_0x870c[_0x2861c2];return _0x2fe16a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc870('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x741d=['sequelize','INTEGER'];(function(_0x3d3946,_0x4aef49){var _0x2a4ebe=function(_0x3ae198){while(--_0x3ae198){_0x3d3946['push'](_0x3d3946['shift']());}};_0x2a4ebe(++_0x4aef49);}(_0x741d,0xc2));var _0xd741=function(_0xdc9a5e,_0x54f740){_0xdc9a5e=_0xdc9a5e-0x0;var _0x5ea624=_0x741d[_0xdc9a5e];return _0x5ea624;};'use strict';var Sequelize=require(_0xd741('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd741('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 b04d9b7..061952f 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 _0x7923=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','util','../../config/logger','moment'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x7923,0x11d));var _0x3792=function(_0x2675b2,_0x29591b){_0x2675b2=_0x2675b2-0x0;var _0x3c1d2e=_0x7923[_0x2675b2];return _0x3c1d2e;};'use strict';var _=require('lodash');var util=require(_0x3792('0x0'));var logger=require(_0x3792('0x1'))('api');var moment=require(_0x3792('0x2'));var BPromise=require(_0x3792('0x3'));var rp=require(_0x3792('0x4'));var fs=require('fs');var path=require(_0x3792('0x5'));var rimraf=require(_0x3792('0x6'));var config=require(_0x3792('0x7'));var attributes=require(_0x3792('0x8'));module[_0x3792('0x9')]=function(_0x608c7a,_0x375a07){return _0x608c7a[_0x3792('0xa')](_0x3792('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2822=['api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2822,0xd6));var _0x2282=function(_0x12d841,_0x56275b){_0x12d841=_0x12d841-0x0;var _0x374b09=_0x2822[_0x12d841];return _0x374b09;};'use strict';var _=require(_0x2282('0x0'));var util=require(_0x2282('0x1'));var logger=require('../../config/logger')(_0x2282('0x2'));var moment=require('moment');var BPromise=require(_0x2282('0x3'));var rp=require(_0x2282('0x4'));var fs=require('fs');var path=require(_0x2282('0x5'));var rimraf=require(_0x2282('0x6'));var config=require('../../config/environment');var attributes=require(_0x2282('0x7'));module[_0x2282('0x8')]=function(_0x3695c5,_0x23733e){return _0x3695c5[_0x2282('0x9')](_0x2282('0xa'),attributes,{'tableName':_0x2282('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index bd33382..fba831a 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 _0xc6dc=['randomstring','../../config/logger','rpc','../../config/environment','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x5051fa,_0x358ab2){var _0x4180cf=function(_0x590f04){while(--_0x590f04){_0x5051fa['push'](_0x5051fa['shift']());}};_0x4180cf(++_0x358ab2);}(_0xc6dc,0x152));var _0xcc6d=function(_0x2b21bd,_0x44d2ed){_0x2b21bd=_0x2b21bd-0x0;var _0x185226=_0xc6dc[_0x2b21bd];return _0x185226;};'use strict';var _=require(_0xcc6d('0x0'));var util=require(_0xcc6d('0x1'));var moment=require(_0xcc6d('0x2'));var BPromise=require(_0xcc6d('0x3'));var rs=require(_0xcc6d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc6d('0x5'))(_0xcc6d('0x6'));var config=require(_0xcc6d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23c442,_0x16da88,_0x11cd2c){return new BPromise(function(_0x1e7dd9,_0x236fe7){return client['request'](_0x23c442,_0x11cd2c)[_0xcc6d('0x8')](function(_0x3b125f){logger['info'](_0xcc6d('0x9'),_0x16da88,'request\x20sent');logger[_0xcc6d('0xa')](_0xcc6d('0xb'),_0x16da88,'request\x20sent',JSON[_0xcc6d('0xc')](_0x3b125f));if(_0x3b125f['error']){if(_0x3b125f[_0xcc6d('0xd')][_0xcc6d('0xe')]===0x1f4){logger['error'](_0xcc6d('0x9'),_0x16da88,_0x3b125f[_0xcc6d('0xd')][_0xcc6d('0xf')]);return _0x236fe7(_0x3b125f['error'][_0xcc6d('0xf')]);}logger[_0xcc6d('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x16da88,_0x3b125f[_0xcc6d('0xd')][_0xcc6d('0xf')]);return _0x1e7dd9(_0x3b125f[_0xcc6d('0xd')][_0xcc6d('0xf')]);}else{logger[_0xcc6d('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x16da88,_0xcc6d('0x11'));_0x1e7dd9(_0x3b125f['result'][_0xcc6d('0xf')]);}})[_0xcc6d('0x12')](function(_0x37a63e){logger[_0xcc6d('0xd')](_0xcc6d('0x9'),_0x16da88,_0x37a63e);_0x236fe7(_0x37a63e);});});} \ No newline at end of file +var _0x7b46=['ioredis','../../config/logger','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x496b21,_0x3a27e7){var _0x46232e=function(_0xbd9a3d){while(--_0xbd9a3d){_0x496b21['push'](_0x496b21['shift']());}};_0x46232e(++_0x3a27e7);}(_0x7b46,0x128));var _0x67b4=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7b46[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x67b4('0x0'));var util=require(_0x67b4('0x1'));var moment=require(_0x67b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x67b4('0x3'));var fs=require('fs');var Redis=require(_0x67b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x67b4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x67b4('0x6'));var client=jayson[_0x67b4('0x7')][_0x67b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dec7c,_0x4f34ee,_0x19799e){return new BPromise(function(_0x57a4b,_0x557c4b){return client[_0x67b4('0x9')](_0x1dec7c,_0x19799e)[_0x67b4('0xa')](function(_0x25117e){logger[_0x67b4('0xb')](_0x67b4('0xc'),_0x4f34ee,'request\x20sent');logger[_0x67b4('0xd')](_0x67b4('0xe'),_0x4f34ee,_0x67b4('0xf'),JSON['stringify'](_0x25117e));if(_0x25117e[_0x67b4('0x10')]){if(_0x25117e[_0x67b4('0x10')][_0x67b4('0x11')]===0x1f4){logger['error'](_0x67b4('0xc'),_0x4f34ee,_0x25117e[_0x67b4('0x10')]['message']);return _0x557c4b(_0x25117e[_0x67b4('0x10')][_0x67b4('0x12')]);}logger[_0x67b4('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f34ee,_0x25117e[_0x67b4('0x10')]['message']);return _0x57a4b(_0x25117e['error'][_0x67b4('0x12')]);}else{logger[_0x67b4('0xb')](_0x67b4('0xc'),_0x4f34ee,'request\x20sent');_0x57a4b(_0x25117e['result'][_0x67b4('0x12')]);}})[_0x67b4('0x13')](function(_0x53a470){logger[_0x67b4('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f34ee,_0x53a470);_0x557c4b(_0x53a470);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4238121..c75dff7 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 _0x2e4e=['removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','clone','addSections','put','update','delete'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x2e4e,0x9f));var _0xe2e4=function(_0x578a26,_0x3b2130){_0x578a26=_0x578a26-0x0;var _0x54e24e=_0x2e4e[_0x578a26];return _0x54e24e;};'use strict';var multer=require(_0xe2e4('0x0'));var util=require(_0xe2e4('0x1'));var path=require(_0xe2e4('0x2'));var timeout=require(_0xe2e4('0x3'));var express=require(_0xe2e4('0x4'));var router=express['Router']();var fs_extra=require(_0xe2e4('0x5'));var auth=require(_0xe2e4('0x6'));var interaction=require(_0xe2e4('0x7'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x9')]);router[_0xe2e4('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe2e4('0xa')](_0xe2e4('0xb'),auth[_0xe2e4('0x8')](),controller[_0xe2e4('0xc')]);router['get'](_0xe2e4('0xd'),auth['isAuthenticated'](),controller[_0xe2e4('0xe')]);router[_0xe2e4('0xa')](_0xe2e4('0xf'),auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x10')]);router[_0xe2e4('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2e4('0x11')]('/:id/clone',auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x12')]);router['post']('/:id/sections',auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x13')]);router[_0xe2e4('0x11')](_0xe2e4('0xf'),auth['isAuthenticated'](),controller['addResources']);router[_0xe2e4('0x14')]('/:id',auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x15')]);router[_0xe2e4('0x16')](_0xe2e4('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xe2e4('0x16')](_0xe2e4('0xd'),auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x17')]);router['delete']('/:id/resources',auth[_0xe2e4('0x8')](),controller[_0xe2e4('0x18')]);module[_0xe2e4('0x19')]=router; \ No newline at end of file +var _0x3248=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getSections','/:id/resources','create','post','/:id/clone','/:id/sections','addSections','addResources','put','delete','destroy','removeResources','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3248,0x1bc));var _0x8324=function(_0x45194e,_0xc4c2a2){_0x45194e=_0x45194e-0x0;var _0x10be0d=_0x3248[_0x45194e];return _0x10be0d;};'use strict';var multer=require('multer');var util=require(_0x8324('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8324('0x1'));var router=express[_0x8324('0x2')]();var fs_extra=require(_0x8324('0x3'));var auth=require(_0x8324('0x4'));var interaction=require(_0x8324('0x5'));var config=require(_0x8324('0x6'));var controller=require('./userProfile.controller');router[_0x8324('0x7')]('/',auth[_0x8324('0x8')](),controller['index']);router[_0x8324('0x7')](_0x8324('0x9'),auth[_0x8324('0x8')](),controller[_0x8324('0xa')]);router['get'](_0x8324('0xb'),auth[_0x8324('0x8')](),controller[_0x8324('0xc')]);router[_0x8324('0x7')]('/:id/sections',auth[_0x8324('0x8')](),controller[_0x8324('0xd')]);router['get'](_0x8324('0xe'),auth[_0x8324('0x8')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x8324('0xf')]);router[_0x8324('0x10')](_0x8324('0x11'),auth[_0x8324('0x8')](),controller['clone']);router[_0x8324('0x10')](_0x8324('0x12'),auth[_0x8324('0x8')](),controller[_0x8324('0x13')]);router[_0x8324('0x10')]('/:id/resources',auth[_0x8324('0x8')](),controller[_0x8324('0x14')]);router[_0x8324('0x15')](_0x8324('0xb'),auth[_0x8324('0x8')](),controller['update']);router[_0x8324('0x16')](_0x8324('0xb'),auth[_0x8324('0x8')](),controller[_0x8324('0x17')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x8324('0x16')](_0x8324('0xe'),auth[_0x8324('0x8')](),controller[_0x8324('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 1d5245f..8d4a9f5 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 _0xe6a0=['crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join'];(function(_0x15b92b,_0x5c1053){var _0x45aba8=function(_0x5614ef){while(--_0x5614ef){_0x15b92b['push'](_0x15b92b['shift']());}};_0x45aba8(++_0x5c1053);}(_0xe6a0,0x112));var _0x0e6a=function(_0x525279,_0x4092f8){_0x525279=_0x525279-0x0;var _0x1b1f05=_0xe6a0[_0x525279];return _0x1b1f05;};'use strict';var Sequelize=require(_0x0e6a('0x0'));module[_0x0e6a('0x1')]={'name':{'type':Sequelize[_0x0e6a('0x2')],'allowNull':![],'unique':_0x0e6a('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1f7966){this[_0x0e6a('0x4')]('crudPermissions',_0x1f7966?_0x1f7966[_0x0e6a('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0e6a('0x6'))?this[_0x0e6a('0x7')]('crudPermissions')[_0x0e6a('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0e6a('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0e6a('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02a5=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue'];(function(_0x7d041,_0x47463d){var _0x3c6df4=function(_0x1e278d){while(--_0x1e278d){_0x7d041['push'](_0x7d041['shift']());}};_0x3c6df4(++_0x47463d);}(_0x02a5,0x163));var _0x502a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x02a5[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x502a('0x0'));module[_0x502a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x502a('0x2')},'crudPermissions':{'type':Sequelize[_0x502a('0x3')],'set':function(_0x1880d8){this[_0x502a('0x4')](_0x502a('0x5'),_0x1880d8?_0x1880d8[_0x502a('0x6')](''):[]);},'get':function(){return this[_0x502a('0x7')](_0x502a('0x5'))?this['getDataValue'](_0x502a('0x5'))[_0x502a('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x502a('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x502a('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ce9fc1d..5abd402 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 _0x19ea=['hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','rows','params','options','find','catch','create','clone','get','omit','createdAt','crudPermissions','body','updatedAt','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','sequelize','transaction','each','Resources','removeSections','ids','getSections','enabled','includes','subsections','concat','push','Dashboard','forEach','Plugin','addResources','removeResources','getResources','section','Missing\x20section\x20parameter'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x19ea,0xe0));var _0xa19e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x19ea[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa19e('0x0'));var zipdir=require(_0xa19e('0x1'));var jsonpatch=require(_0xa19e('0x2'));var rp=require(_0xa19e('0x3'));var moment=require(_0xa19e('0x4'));var BPromise=require(_0xa19e('0x5'));var Mustache=require(_0xa19e('0x6'));var util=require('util');var path=require(_0xa19e('0x7'));var sox=require(_0xa19e('0x8'));var csv=require(_0xa19e('0x9'));var ejs=require(_0xa19e('0xa'));var fs=require('fs');var fs_extra=require(_0xa19e('0xb'));var _=require(_0xa19e('0xc'));var squel=require(_0xa19e('0xd'));var crypto=require(_0xa19e('0xe'));var jsforce=require(_0xa19e('0xf'));var deskjs=require(_0xa19e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa19e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa19e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19e('0x13'))(_0xa19e('0x14'));var utils=require(_0xa19e('0x15'));var config=require(_0xa19e('0x16'));var licenseUtil=require(_0xa19e('0x17'));var db=require(_0xa19e('0x18'))['db'];config['redis']=_['defaults'](config[_0xa19e('0x19')],{'host':_0xa19e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa19e('0x19')]));require(_0xa19e('0x1b'))[_0xa19e('0x1c')](socket);function respondWithStatusCode(_0x6651a,_0x3436cb){_0x3436cb=_0x3436cb||0xcc;return function(_0x8420a9){if(_0x8420a9){return _0x6651a['sendStatus'](_0x3436cb);}return _0x6651a[_0xa19e('0x1d')](_0x3436cb)[_0xa19e('0x1e')]();};}function respondWithResult(_0x599f8c,_0x5689e0){_0x5689e0=_0x5689e0||0xc8;return function(_0x479498){if(_0x479498){return _0x599f8c[_0xa19e('0x1d')](_0x5689e0)[_0xa19e('0x1f')](_0x479498);}};}function respondWithFilteredResult(_0x33a1f9,_0x90f198){return function(_0x5215df){if(_0x5215df){var _0x2b57d5=typeof _0x90f198[_0xa19e('0x20')]===_0xa19e('0x21')&&typeof _0x90f198[_0xa19e('0x22')]==='undefined';var _0x3f6f3c=_0x5215df[_0xa19e('0x23')];var _0x66e7a6=_0x2b57d5?0x0:_0x90f198[_0xa19e('0x20')];var _0x439af1=_0x2b57d5?_0x5215df[_0xa19e('0x23')]:_0x90f198['offset']+_0x90f198[_0xa19e('0x22')];var _0x43d64e;if(_0x439af1>=_0x3f6f3c){_0x439af1=_0x3f6f3c;_0x43d64e=0xc8;}else{_0x43d64e=0xce;}_0x33a1f9[_0xa19e('0x1d')](_0x43d64e);return _0x33a1f9[_0xa19e('0x24')](_0xa19e('0x25'),_0x66e7a6+'-'+_0x439af1+'/'+_0x3f6f3c)[_0xa19e('0x1f')](_0x5215df);}return null;};}function patchUpdates(_0xb4fa87){return function(_0x40d588){try{jsonpatch['apply'](_0x40d588,_0xb4fa87,!![]);}catch(_0xa8be8f){return BPromise[_0xa19e('0x26')](_0xa8be8f);}return _0x40d588['save']();};}function saveUpdates(_0x1c6d87,_0x5ec2f7){return function(_0x21f051){if(_0x21f051){return _0x21f051[_0xa19e('0x27')](_0x1c6d87)[_0xa19e('0x28')](function(_0x28109c){return _0x28109c;});}return null;};}function removeEntity(_0x1e67cc,_0x28c790){return function(_0x3bbe7a){if(_0x3bbe7a){return _0x3bbe7a[_0xa19e('0x29')]()[_0xa19e('0x28')](function(){_0x1e67cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d560,_0x2adfce){return function(_0x5b3617){if(!_0x5b3617){_0x46d560['sendStatus'](0x194);}return _0x5b3617;};}function handleError(_0x437498,_0x1cbf04){_0x1cbf04=_0x1cbf04||0x1f4;return function(_0x1c2f3a){logger[_0xa19e('0x2a')](_0x1c2f3a[_0xa19e('0x2b')]);if(_0x1c2f3a[_0xa19e('0x2c')]){delete _0x1c2f3a['name'];}_0x437498[_0xa19e('0x1d')](_0x1cbf04)[_0xa19e('0x2d')](_0x1c2f3a);};}exports[_0xa19e('0x2e')]=function(_0x180bf0,_0x18b2a4){var _0x44e2b6={},_0x19e821={},_0x44e04d={'count':0x0,'rows':[]};var _0x378d9f=_['map'](db[_0xa19e('0x2f')][_0xa19e('0x30')],function(_0x244792){return{'name':_0x244792[_0xa19e('0x31')],'type':_0x244792[_0xa19e('0x32')]['key']};});_0x19e821['model']=_[_0xa19e('0x33')](_0x378d9f,_0xa19e('0x2c'));_0x19e821[_0xa19e('0x34')]=_[_0xa19e('0x35')](_0x180bf0['query']);_0x19e821['filters']=_['intersection'](_0x19e821[_0xa19e('0x36')],_0x19e821[_0xa19e('0x34')]);_0x44e2b6[_0xa19e('0x37')]=_[_0xa19e('0x38')](_0x19e821[_0xa19e('0x36')],qs['fields'](_0x180bf0[_0xa19e('0x34')][_0xa19e('0x39')]));_0x44e2b6[_0xa19e('0x37')]=_0x44e2b6[_0xa19e('0x37')][_0xa19e('0x3a')]?_0x44e2b6[_0xa19e('0x37')]:_0x19e821[_0xa19e('0x36')];if(!_0x180bf0[_0xa19e('0x34')]['hasOwnProperty'](_0xa19e('0x3b'))){_0x44e2b6[_0xa19e('0x22')]=qs[_0xa19e('0x22')](_0x180bf0[_0xa19e('0x34')]['limit']);_0x44e2b6[_0xa19e('0x20')]=qs[_0xa19e('0x20')](_0x180bf0['query'][_0xa19e('0x20')]);}_0x44e2b6['order']=qs[_0xa19e('0x3c')](_0x180bf0[_0xa19e('0x34')][_0xa19e('0x3c')]);_0x44e2b6[_0xa19e('0x3d')]=qs[_0xa19e('0x3e')](_[_0xa19e('0x3f')](_0x180bf0[_0xa19e('0x34')],_0x19e821[_0xa19e('0x3e')]),_0x378d9f);if(_0x180bf0[_0xa19e('0x34')][_0xa19e('0x40')]){_0x44e2b6['where']=_[_0xa19e('0x41')](_0x44e2b6[_0xa19e('0x3d')],{'$or':_[_0xa19e('0x33')](_0x378d9f,function(_0x2e3252){if(_0x2e3252[_0xa19e('0x32')]!=='VIRTUAL'){var _0x30c644={};_0x30c644[_0x2e3252['name']]={'$like':'%'+_0x180bf0[_0xa19e('0x34')][_0xa19e('0x40')]+'%'};return _0x30c644;}})});}_0x44e2b6=_[_0xa19e('0x41')]({},_0x44e2b6,_0x180bf0['options']);var _0x46d644={'where':_0x44e2b6[_0xa19e('0x3d')]};return db[_0xa19e('0x2f')][_0xa19e('0x23')](_0x46d644)[_0xa19e('0x28')](function(_0x24f6b3){_0x44e04d[_0xa19e('0x23')]=_0x24f6b3;if(_0x180bf0['query'][_0xa19e('0x42')]){_0x44e2b6[_0xa19e('0x43')]=[{'all':!![]}];}return db[_0xa19e('0x2f')]['findAll'](_0x44e2b6);})[_0xa19e('0x28')](function(_0x335c56){_0x44e04d[_0xa19e('0x44')]=_0x335c56;return _0x44e04d;})[_0xa19e('0x28')](respondWithFilteredResult(_0x18b2a4,_0x44e2b6))['catch'](handleError(_0x18b2a4,null));};exports['show']=function(_0x3632b8,_0x21abbc){var _0x575885={'raw':![],'where':{'id':_0x3632b8[_0xa19e('0x45')]['id']}},_0x21485f={};_0x21485f[_0xa19e('0x36')]=_['keys'](db['UserProfile']['rawAttributes']);_0x21485f[_0xa19e('0x34')]=_[_0xa19e('0x35')](_0x3632b8[_0xa19e('0x34')]);_0x21485f['filters']=_[_0xa19e('0x38')](_0x21485f['model'],_0x21485f[_0xa19e('0x34')]);_0x575885['attributes']=_[_0xa19e('0x38')](_0x21485f[_0xa19e('0x36')],qs[_0xa19e('0x39')](_0x3632b8[_0xa19e('0x34')][_0xa19e('0x39')]));_0x575885[_0xa19e('0x37')]=_0x575885[_0xa19e('0x37')][_0xa19e('0x3a')]?_0x575885['attributes']:_0x21485f['model'];if(_0x3632b8[_0xa19e('0x34')][_0xa19e('0x42')]){_0x575885[_0xa19e('0x43')]=[{'all':!![]}];}_0x575885=_[_0xa19e('0x41')]({},_0x575885,_0x3632b8[_0xa19e('0x46')]);return db[_0xa19e('0x2f')][_0xa19e('0x47')](_0x575885)[_0xa19e('0x28')](handleEntityNotFound(_0x21abbc,null))['then'](respondWithResult(_0x21abbc,null))[_0xa19e('0x48')](handleError(_0x21abbc,null));};exports[_0xa19e('0x49')]=function(_0x547f46,_0x4fcbc5){return db[_0xa19e('0x2f')][_0xa19e('0x49')](_0x547f46['body'],{})[_0xa19e('0x28')](respondWithResult(_0x4fcbc5,0xc9))[_0xa19e('0x48')](handleError(_0x4fcbc5,null));};exports[_0xa19e('0x4a')]=function(_0x5233ff,_0x5d6183){var _0x487f48={'where':{'id':_0x5233ff['params']['id']}},_0x1e79c0={};_0x1e79c0[_0xa19e('0x36')]=_[_0xa19e('0x35')](db['UserProfile'][_0xa19e('0x30')]);_0x487f48[_0xa19e('0x37')]=_[_0xa19e('0x38')](_0x1e79c0['model'],qs[_0xa19e('0x39')](_0x5233ff[_0xa19e('0x34')][_0xa19e('0x39')]));_0x487f48[_0xa19e('0x37')]=_0x487f48['attributes'][_0xa19e('0x3a')]?_0x487f48[_0xa19e('0x37')]:_0x1e79c0[_0xa19e('0x36')];if(_0x5233ff['query'][_0xa19e('0x42')]){_0x487f48[_0xa19e('0x43')]=[{'all':!![]}];}_0x487f48=_[_0xa19e('0x41')]({},_0x487f48,_0x5233ff[_0xa19e('0x46')]);return db[_0xa19e('0x2f')][_0xa19e('0x47')](_0x487f48)[_0xa19e('0x28')](handleEntityNotFound(_0x5d6183,null))['then'](function(_0xc4888e){if(_0xc4888e){var _0x2cf02d=_0xc4888e[_0xa19e('0x4b')]({'plain':!![]});_0x2cf02d=qs[_0xa19e('0x4c')](_0x2cf02d,['id',_0xa19e('0x4d'),'updatedAt',_0xa19e('0x4e')]);_0x5233ff[_0xa19e('0x4f')]=_[_0xa19e('0x4c')](_0x5233ff['body'],['id','createdAt',_0xa19e('0x50')]);return db['sequelize']['transaction'](function(_0x24518c){return db['UserProfile'][_0xa19e('0x49')](_['merge'](_0x2cf02d,_0x5233ff['body']),{'include':_0x5233ff[_0xa19e('0x34')][_0xa19e('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x24518c})['then'](function(_0x4637f7){var _0x22c4b5=_0x4637f7[_0xa19e('0x4b')]({'plain':!![]});return db[_0xa19e('0x51')][_0xa19e('0x52')]({'where':{'userProfileId':_0x5233ff['params']['id']},'raw':!![]})['then'](function(_0x57cba8){if(_0x57cba8){return BPromise['each'](_0x57cba8,function(_0x4b3653){return new BPromise(function(_0x357bc6,_0x33f49c){if(_0x4b3653[_0xa19e('0x53')]===null||_0x4b3653[_0xa19e('0x53')]===0x1)_0x357bc6(null);return db[_0xa19e('0x54')][_0xa19e('0x52')]({'where':{'sectionId':_0x4b3653['id']},'raw':!![]})['then'](function(_0x43768d){var _0x4310a8=_['map'](_0x43768d,function(_0x5ab8d7){return qs[_0xa19e('0x4c')](_0x5ab8d7,['id',_0xa19e('0x4d'),'updatedAt',_0xa19e('0x55')]);});_0x357bc6(_0x4310a8);})['catch'](function(_0x44d560){_0x33f49c(_0x44d560);});})[_0xa19e('0x28')](function(_0x4eb528){var _0x39152e=qs[_0xa19e('0x4c')](_0x4b3653,['id',_0xa19e('0x4d'),'updatedAt']);_0x39152e[_0xa19e('0x56')]=_0x22c4b5['id'];if(_0x4eb528)_0x39152e['Resources']=_0x4eb528;return _0x39152e;})[_0xa19e('0x28')](function(_0x3eafa4){return db[_0xa19e('0x51')][_0xa19e('0x49')](_0x3eafa4,{'include':[{'model':db[_0xa19e('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x24518c});});})[_0xa19e('0x28')](function(){return _0x22c4b5;});}});});});}})[_0xa19e('0x28')](respondWithResult(_0x5d6183,0xc9))['catch'](handleError(_0x5d6183,null));};exports['update']=function(_0xadf51b,_0x28713f){if(_0xadf51b[_0xa19e('0x4f')]['id']){delete _0xadf51b[_0xa19e('0x4f')]['id'];}return db[_0xa19e('0x2f')][_0xa19e('0x47')]({'where':{'id':_0xadf51b['params']['id']}})['then'](handleEntityNotFound(_0x28713f,null))[_0xa19e('0x28')](saveUpdates(_0xadf51b[_0xa19e('0x4f')],null))[_0xa19e('0x28')](respondWithResult(_0x28713f,null))[_0xa19e('0x48')](handleError(_0x28713f,null));};exports['destroy']=function(_0x587870,_0x136806){return db['UserProfile'][_0xa19e('0x47')]({'where':{'id':_0x587870[_0xa19e('0x45')]['id']}})[_0xa19e('0x28')](handleEntityNotFound(_0x136806,null))[_0xa19e('0x28')](removeEntity(_0x136806,null))['catch'](handleError(_0x136806,null));};exports[_0xa19e('0x57')]=function(_0x1c801e,_0x103fe8){return db[_0xa19e('0x2f')]['describe']()[_0xa19e('0x28')](respondWithResult(_0x103fe8,null))[_0xa19e('0x48')](handleError(_0x103fe8,null));};exports[_0xa19e('0x58')]=function(_0x3758e9,_0x4a5a56){var _0x135393=_0x3758e9[_0xa19e('0x4f')];return db['UserProfile']['find']({'where':{'id':_0x3758e9[_0xa19e('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a5a56,null))[_0xa19e('0x28')](function(_0x1e8d14){if(_0x1e8d14){return db[_0xa19e('0x59')][_0xa19e('0x5a')](function(_0x4e5d69){return db[_0xa19e('0x51')][_0xa19e('0x29')]({'where':{'userProfileId':_0x3758e9['params']['id'],'sectionId':_['map'](_0x135393,function(_0x45242a){return _0x45242a[_0xa19e('0x55')];})},'transaction':_0x4e5d69})[_0xa19e('0x28')](function(){var _0x259d13=_['map'](_0x135393,function(_0x2e2658){_0x2e2658[_0xa19e('0x56')]=_0x3758e9[_0xa19e('0x45')]['id'];return _0x2e2658;});var _0x21f66b=[];return BPromise[_0xa19e('0x5b')](_0x259d13,function(_0x22e567){return db[_0xa19e('0x51')]['create'](_0x22e567,{'include':[{'model':db[_0xa19e('0x54')],'as':_0xa19e('0x5c')}],'raw':!![],'transaction':_0x4e5d69})[_0xa19e('0x28')](function(_0x41f178){_0x21f66b['push'](_0x41f178[_0xa19e('0x4b')]({'plain':!![]}));});})[_0xa19e('0x28')](function(){return _0x21f66b;});});});}})[_0xa19e('0x28')](function(_0x2c2a2c){return _0x2c2a2c;})[_0xa19e('0x28')](respondWithResult(_0x4a5a56,null))['catch'](handleError(_0x4a5a56,null));};exports[_0xa19e('0x5d')]=function(_0x1eeb8c,_0x5241dc){var _0x250ba4;return db[_0xa19e('0x2f')][_0xa19e('0x47')]({'where':{'id':_0x1eeb8c[_0xa19e('0x45')]['id']},'attributes':['id',_0xa19e('0x2c')]})[_0xa19e('0x28')](handleEntityNotFound(_0x5241dc,null))[_0xa19e('0x28')](function(_0x43654c){if(_0x43654c){_0x250ba4=_0x43654c;return db[_0xa19e('0x51')][_0xa19e('0x29')]({'where':{'userProfileId':_0x1eeb8c['params']['id'],'sectionId':_0x1eeb8c[_0xa19e('0x34')][_0xa19e('0x5e')]}});}})[_0xa19e('0x28')](function(){return _0x250ba4;})[_0xa19e('0x28')](respondWithStatusCode(_0x5241dc,null))[_0xa19e('0x48')](handleError(_0x5241dc,null));};exports[_0xa19e('0x5f')]=function(_0x2fb1f5,_0x50f9f2){var _0x251a93=[];var _0x538c3f=[];return db[_0xa19e('0x51')][_0xa19e('0x52')]({'where':{'userProfileId':_0x2fb1f5[_0xa19e('0x45')]['id']},'raw':!![]})[_0xa19e('0x28')](function(_0x5b6fe5){_0x251a93=_['filter'](_0x5b6fe5,function(_0x3d9120){return _0x3d9120[_0xa19e('0x60')]===0x1||_[_0xa19e('0x61')]([0x3eb,0x709],_0x3d9120[_0xa19e('0x55')]);});if(!_['isEmpty'](_0x251a93)){return _['map'](_0x251a93,function(_0x17d26f){return _0x17d26f[_0xa19e('0x55')];});}else{return;}})[_0xa19e('0x28')](function(_0x3651d8){if(_0x3651d8)_0x538c3f=_0x3651d8;if(_[_0xa19e('0x61')](_0x538c3f,0x64)){var _0x3327aa=_[_0xa19e('0x47')](_0x251a93,{'sectionId':0x64});return hasDefaultDashboard(_0x3327aa)[_0xa19e('0x28')](function(_0x735fd){return _[_0xa19e('0x33')](_0x251a93,function(_0x377fc0){if(_0x377fc0['sectionId']===0x64){_0x377fc0[_0xa19e('0x62')]=_0x735fd;}return _0x377fc0;});});}else{return;}})['then'](function(_0x4abe83){if(_0x4abe83)_0x251a93=_0x4abe83;if(_[_0xa19e('0x61')](_0x538c3f,0x3eb)){var _0x20d87c=_[_0xa19e('0x47')](_0x251a93,{'sectionId':0x3eb});return getCustomDashboards(_0x20d87c)[_0xa19e('0x28')](function(_0x1030e0){return _[_0xa19e('0x33')](_0x251a93,function(_0xe2c69d){if(_0x20d87c[_0xa19e('0x60')]){if(_0xe2c69d['sectionId']===0x3eb){_0xe2c69d['subsections']=_0x1030e0;}}else{if(_0xe2c69d[_0xa19e('0x55')]===0x64){if(!_0xe2c69d[_0xa19e('0x62')]){_0xe2c69d[_0xa19e('0x62')]=[];}_0xe2c69d['subsections']=_0xe2c69d[_0xa19e('0x62')][_0xa19e('0x63')](_0x1030e0);}}return _0xe2c69d;});});}else{return;}})[_0xa19e('0x28')](function(_0x2635d9){if(_0x2635d9)_0x251a93=_0x2635d9;if(_['includes'](_0x538c3f,0x709)){var _0x16a605=_[_0xa19e('0x47')](_0x251a93,{'sectionId':0x709});return getPlugins(_0x16a605)['then'](function(_0x134aa3){if(_0x16a605[_0xa19e('0x60')]){return _[_0xa19e('0x33')](_0x251a93,function(_0x7abc78){if(_0x7abc78[_0xa19e('0x55')]===0x709){_0x7abc78[_0xa19e('0x62')]=_0x134aa3;}return _0x7abc78;});}else{var _0x1ee687={'sectionId':0x76c,'enabled':0x1,'subsections':_0x134aa3};var _0xf52156=_[_0xa19e('0x33')](_0x251a93);_0xf52156[_0xa19e('0x64')](_0x1ee687);return _0xf52156;}});}else{return;}})[_0xa19e('0x28')](function(_0x5e0cd0){if(_0x5e0cd0)_0x251a93=_0x5e0cd0;return _['filter'](_0x251a93,[_0xa19e('0x60'),0x1]);})['then'](respondWithResult(_0x50f9f2,null))[_0xa19e('0x48')](handleError(_0x50f9f2,null));};function hasDefaultDashboard(_0x48eb7c){var _0x3c2c01=[0x65];return new BPromise(function(_0x183461,_0x585e38){try{if(_0x48eb7c[_0xa19e('0x53')]){_0x183461(_0x3c2c01);}else{return db[_0xa19e('0x54')]['findOne']({'where':{'sectionId':_0x48eb7c['id']},'raw':!![]})[_0xa19e('0x28')](function(_0x5ed62b){_0x5ed62b?_0x183461(_0x3c2c01):_0x183461();});}}catch(_0x3be595){_0x585e38(_0x3be595);}});}function getCustomDashboards(_0x210308){var _0x2b1247=[];return new BPromise(function(_0x338174,_0x2daa30){try{if(_0x210308[_0xa19e('0x53')]){return db[_0xa19e('0x65')][_0xa19e('0x52')]({'raw':!![]})['then'](function(_0x34245b){_0x34245b[_0xa19e('0x66')](function(_0x384322){_0x2b1247[_0xa19e('0x64')](_0x384322['id']+0x1869f);});_0x338174(_0x2b1247);});}else{return db[_0xa19e('0x54')][_0xa19e('0x52')]({'where':{'sectionId':_0x210308['id']},'raw':!![]})[_0xa19e('0x28')](function(_0x45dd86){_0x45dd86[_0xa19e('0x66')](function(_0x4970f7){_0x2b1247['push'](_0x4970f7['resourceId']+0x1869f);});_0x338174(_0x2b1247);});}}catch(_0x364f39){_0x2daa30(_0x364f39);}});}function getPlugins(_0x18d26c){var _0xea74fe=[];return new BPromise(function(_0x565607,_0x3a2f4c){try{if(_0x18d26c[_0xa19e('0x53')]){return db[_0xa19e('0x67')]['findAll']({'raw':!![]})[_0xa19e('0x28')](function(_0x3f8dc0){_0x3f8dc0[_0xa19e('0x66')](function(_0x252a4c){_0xea74fe[_0xa19e('0x64')](_0x252a4c['id']+0x15b38);});_0x565607(_0xea74fe);});}else{return db[_0xa19e('0x54')][_0xa19e('0x52')]({'where':{'sectionId':_0x18d26c['id']},'raw':!![]})[_0xa19e('0x28')](function(_0x27d8c3){_0x27d8c3[_0xa19e('0x66')](function(_0x4b45f3){_0xea74fe['push'](_0x4b45f3['resourceId']+0x15b38);});_0x565607(_0xea74fe);});}}catch(_0x23662f){_0x3a2f4c(_0x23662f);}});}exports[_0xa19e('0x68')]=function(_0x47d48b,_0x133021){return db[_0xa19e('0x2f')][_0xa19e('0x47')]({'where':{'id':_0x47d48b[_0xa19e('0x45')]['id']}})[_0xa19e('0x28')](handleEntityNotFound(_0x133021,null))[_0xa19e('0x28')](function(_0xb2b4ea){if(_0xb2b4ea){return db[_0xa19e('0x59')][_0xa19e('0x5a')](function(_0x2e2dd8){return db[_0xa19e('0x51')]['findAll']({'where':{'userProfileId':_0x47d48b[_0xa19e('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xa19e('0x28')](function(_0x374648){if(_0x374648){return db[_0xa19e('0x51')][_0xa19e('0x29')]({'where':{'userProfileId':_0x47d48b[_0xa19e('0x45')]['id'],'id':_[_0xa19e('0x33')](_0x374648,function(_0x53ee43){return _0x53ee43['id'];})},'transaction':_0x2e2dd8});}})[_0xa19e('0x28')](function(_0x308702){var _0x55d2b0=_[_0xa19e('0x33')](_0x47d48b[_0xa19e('0x4f')],function(_0x3e788c){_0x3e788c[_0xa19e('0x56')]=_0x47d48b['params']['id'];return _0x3e788c;});return db[_0xa19e('0x51')]['bulkCreate'](_0x55d2b0,{'raw':!![],'transaction':_0x2e2dd8});})['then'](function(_0x55b508){var _0x43010d=_[_0xa19e('0x40')](_['map'](_0x55b508,function(_0x70b22a){return _0x70b22a[_0xa19e('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x43010d){return db[_0xa19e('0x51')][_0xa19e('0x52')]({'where':{'userProfileId':_0x47d48b[_0xa19e('0x45')]['id'],'sectionId':_[_0xa19e('0x33')](_0x43010d,function(_0x4975b7){return _0x4975b7[_0xa19e('0x55')];})},'attributes':['id',_0xa19e('0x55')],'raw':!![]})[_0xa19e('0x28')](function(_0x3cd509){var _0x484283=_[_0xa19e('0x33')](_0x47d48b[_0xa19e('0x4f')],function(_0x480dac){_0x480dac[_0xa19e('0x56')]=_0x47d48b[_0xa19e('0x45')]['id'];return _0x480dac;});return db[_0xa19e('0x54')]['bulkCreate'](_0x484283,{'raw':!![],'transaction':_0x2e2dd8});});}})[_0xa19e('0x48')](handleError(_0x133021,null));});}})[_0xa19e('0x28')](function(_0x3bd1e5){var _0xc40604=_[_0xa19e('0x33')](_0x3bd1e5,function(_0x3cc6c3){return _0x3cc6c3[_0xa19e('0x4b')]({'plain':!![]});});})[_0xa19e('0x28')](respondWithResult(_0x133021,null))['catch'](handleError(_0x133021,null));};exports[_0xa19e('0x69')]=function(_0x59e0f9,_0x2c7106,_0xed8b24){return db[_0xa19e('0x2f')][_0xa19e('0x47')]({'where':{'id':_0x59e0f9[_0xa19e('0x45')]['id']}})[_0xa19e('0x28')](handleEntityNotFound(_0x2c7106,null))[_0xa19e('0x28')](function(_0x3f7611){if(_0x3f7611){return _0x3f7611['removeResources'](_0x59e0f9[_0xa19e('0x34')][_0xa19e('0x5e')]);}})[_0xa19e('0x28')](respondWithStatusCode(_0x2c7106,null))['catch'](handleError(_0x2c7106,null));};exports[_0xa19e('0x6a')]=function(_0x6de35d,_0x3a9fdf){var _0x4f5d54={};if(!_0x6de35d[_0xa19e('0x34')][_0xa19e('0x6b')])throw new Error(_0xa19e('0x6c'));if(!_0x6de35d[_0xa19e('0x34')][_0xa19e('0x6d')](_0xa19e('0x3b'))){_0x4f5d54[_0xa19e('0x22')]=qs['limit'](_0x6de35d['query'][_0xa19e('0x22')]);_0x4f5d54[_0xa19e('0x20')]=qs[_0xa19e('0x20')](_0x6de35d[_0xa19e('0x34')][_0xa19e('0x20')]);}return db['UserProfile']['find']({'where':{'id':_0x6de35d[_0xa19e('0x45')]['id']}})[_0xa19e('0x28')](function(_0x693a37){if(!_0x693a37)throw new Error(_0xa19e('0x6e')+_0x6de35d['params']['id']);return db[_0xa19e('0x2f')][_0xa19e('0x6a')](_0x6de35d);})[_0xa19e('0x28')](respondWithFilteredResult(_0x3a9fdf,_0x4f5d54))[_0xa19e('0x48')](handleError(_0x3a9fdf,null));}; \ No newline at end of file +var _0xf756=['Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','transaction','each','Resources','push','removeSections','ids','getSections','includes','subsections','enabled','concat','forEach'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf756,0x78));var _0x6f75=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf756[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6f75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f75('0x1'));var jsonpatch=require(_0x6f75('0x2'));var rp=require(_0x6f75('0x3'));var moment=require('moment');var BPromise=require(_0x6f75('0x4'));var Mustache=require('mustache');var util=require(_0x6f75('0x5'));var path=require(_0x6f75('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f75('0x7'));var _=require('lodash');var squel=require(_0x6f75('0x8'));var crypto=require(_0x6f75('0x9'));var jsforce=require(_0x6f75('0xa'));var deskjs=require(_0x6f75('0xb'));var toCsv=require(_0x6f75('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f75('0xd'));var authService=require(_0x6f75('0xe'));var qs=require(_0x6f75('0xf'));var as=require(_0x6f75('0x10'));var hardwareService=require(_0x6f75('0x11'));var logger=require(_0x6f75('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6f75('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f75('0x14'))['db'];config[_0x6f75('0x15')]=_[_0x6f75('0x16')](config[_0x6f75('0x15')],{'host':_0x6f75('0x17'),'port':0x18eb});var socket=require(_0x6f75('0x18'))(new Redis(config[_0x6f75('0x15')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x34d81e,_0x3ca8d2){_0x3ca8d2=_0x3ca8d2||0xcc;return function(_0x330bf9){if(_0x330bf9){return _0x34d81e[_0x6f75('0x19')](_0x3ca8d2);}return _0x34d81e['status'](_0x3ca8d2)[_0x6f75('0x1a')]();};}function respondWithResult(_0x18be04,_0x39dc77){_0x39dc77=_0x39dc77||0xc8;return function(_0x4893c1){if(_0x4893c1){return _0x18be04[_0x6f75('0x1b')](_0x39dc77)[_0x6f75('0x1c')](_0x4893c1);}};}function respondWithFilteredResult(_0x2c1eae,_0x3ebdd1){return function(_0x148ed){if(_0x148ed){var _0xabe0b9=typeof _0x3ebdd1['offset']===_0x6f75('0x1d')&&typeof _0x3ebdd1[_0x6f75('0x1e')]===_0x6f75('0x1d');var _0x22e040=_0x148ed[_0x6f75('0x1f')];var _0x1ae040=_0xabe0b9?0x0:_0x3ebdd1['offset'];var _0x512d3d=_0xabe0b9?_0x148ed[_0x6f75('0x1f')]:_0x3ebdd1[_0x6f75('0x20')]+_0x3ebdd1[_0x6f75('0x1e')];var _0x32a678;if(_0x512d3d>=_0x22e040){_0x512d3d=_0x22e040;_0x32a678=0xc8;}else{_0x32a678=0xce;}_0x2c1eae[_0x6f75('0x1b')](_0x32a678);return _0x2c1eae['set'](_0x6f75('0x21'),_0x1ae040+'-'+_0x512d3d+'/'+_0x22e040)[_0x6f75('0x1c')](_0x148ed);}return null;};}function patchUpdates(_0x2d050d){return function(_0x3782c9){try{jsonpatch[_0x6f75('0x22')](_0x3782c9,_0x2d050d,!![]);}catch(_0x58ba4f){return BPromise[_0x6f75('0x23')](_0x58ba4f);}return _0x3782c9[_0x6f75('0x24')]();};}function saveUpdates(_0x4a76fe,_0xdf6e8c){return function(_0x3dc07c){if(_0x3dc07c){return _0x3dc07c[_0x6f75('0x25')](_0x4a76fe)[_0x6f75('0x26')](function(_0x1204eb){return _0x1204eb;});}return null;};}function removeEntity(_0x2e5725,_0x5b2983){return function(_0x4b40d8){if(_0x4b40d8){return _0x4b40d8[_0x6f75('0x27')]()['then'](function(){_0x2e5725[_0x6f75('0x1b')](0xcc)[_0x6f75('0x1a')]();});}};}function handleEntityNotFound(_0x1a87e4,_0x7011d7){return function(_0xe955a3){if(!_0xe955a3){_0x1a87e4[_0x6f75('0x19')](0x194);}return _0xe955a3;};}function handleError(_0x15bea6,_0x18176e){_0x18176e=_0x18176e||0x1f4;return function(_0x4fd131){logger[_0x6f75('0x28')](_0x4fd131[_0x6f75('0x29')]);if(_0x4fd131['name']){delete _0x4fd131[_0x6f75('0x2a')];}_0x15bea6[_0x6f75('0x1b')](_0x18176e)[_0x6f75('0x2b')](_0x4fd131);};}exports[_0x6f75('0x2c')]=function(_0x26de31,_0x14a112){var _0x862e85={},_0x250d1c={},_0x5c21f7={'count':0x0,'rows':[]};var _0x325f9e=_[_0x6f75('0x2d')](db[_0x6f75('0x2e')][_0x6f75('0x2f')],function(_0x5ad3b1){return{'name':_0x5ad3b1['fieldName'],'type':_0x5ad3b1[_0x6f75('0x30')][_0x6f75('0x31')]};});_0x250d1c['model']=_[_0x6f75('0x2d')](_0x325f9e,_0x6f75('0x2a'));_0x250d1c[_0x6f75('0x32')]=_[_0x6f75('0x33')](_0x26de31[_0x6f75('0x32')]);_0x250d1c['filters']=_[_0x6f75('0x34')](_0x250d1c[_0x6f75('0x35')],_0x250d1c['query']);_0x862e85[_0x6f75('0x36')]=_['intersection'](_0x250d1c[_0x6f75('0x35')],qs['fields'](_0x26de31[_0x6f75('0x32')][_0x6f75('0x37')]));_0x862e85['attributes']=_0x862e85[_0x6f75('0x36')][_0x6f75('0x38')]?_0x862e85[_0x6f75('0x36')]:_0x250d1c[_0x6f75('0x35')];if(!_0x26de31['query'][_0x6f75('0x39')]('nolimit')){_0x862e85[_0x6f75('0x1e')]=qs[_0x6f75('0x1e')](_0x26de31['query']['limit']);_0x862e85[_0x6f75('0x20')]=qs[_0x6f75('0x20')](_0x26de31[_0x6f75('0x32')][_0x6f75('0x20')]);}_0x862e85[_0x6f75('0x3a')]=qs[_0x6f75('0x3b')](_0x26de31[_0x6f75('0x32')]['sort']);_0x862e85[_0x6f75('0x3c')]=qs[_0x6f75('0x3d')](_[_0x6f75('0x3e')](_0x26de31[_0x6f75('0x32')],_0x250d1c[_0x6f75('0x3d')]),_0x325f9e);if(_0x26de31[_0x6f75('0x32')][_0x6f75('0x3f')]){_0x862e85['where']=_[_0x6f75('0x40')](_0x862e85[_0x6f75('0x3c')],{'$or':_[_0x6f75('0x2d')](_0x325f9e,function(_0x41691e){if(_0x41691e[_0x6f75('0x30')]!==_0x6f75('0x41')){var _0x61f2fb={};_0x61f2fb[_0x41691e[_0x6f75('0x2a')]]={'$like':'%'+_0x26de31[_0x6f75('0x32')][_0x6f75('0x3f')]+'%'};return _0x61f2fb;}})});}_0x862e85=_[_0x6f75('0x40')]({},_0x862e85,_0x26de31[_0x6f75('0x42')]);var _0x51e7a7={'where':_0x862e85[_0x6f75('0x3c')]};return db[_0x6f75('0x2e')][_0x6f75('0x1f')](_0x51e7a7)['then'](function(_0x1f1889){_0x5c21f7['count']=_0x1f1889;if(_0x26de31[_0x6f75('0x32')]['includeAll']){_0x862e85[_0x6f75('0x43')]=[{'all':!![]}];}return db[_0x6f75('0x2e')][_0x6f75('0x44')](_0x862e85);})[_0x6f75('0x26')](function(_0x559895){_0x5c21f7[_0x6f75('0x45')]=_0x559895;return _0x5c21f7;})[_0x6f75('0x26')](respondWithFilteredResult(_0x14a112,_0x862e85))[_0x6f75('0x46')](handleError(_0x14a112,null));};exports['show']=function(_0x44dca4,_0x58cc44){var _0x1f860a={'raw':![],'where':{'id':_0x44dca4['params']['id']}},_0x3a5ad7={};_0x3a5ad7[_0x6f75('0x35')]=_[_0x6f75('0x33')](db[_0x6f75('0x2e')][_0x6f75('0x2f')]);_0x3a5ad7['query']=_[_0x6f75('0x33')](_0x44dca4['query']);_0x3a5ad7[_0x6f75('0x3d')]=_[_0x6f75('0x34')](_0x3a5ad7['model'],_0x3a5ad7['query']);_0x1f860a[_0x6f75('0x36')]=_[_0x6f75('0x34')](_0x3a5ad7[_0x6f75('0x35')],qs[_0x6f75('0x37')](_0x44dca4[_0x6f75('0x32')]['fields']));_0x1f860a[_0x6f75('0x36')]=_0x1f860a[_0x6f75('0x36')][_0x6f75('0x38')]?_0x1f860a['attributes']:_0x3a5ad7[_0x6f75('0x35')];if(_0x44dca4['query'][_0x6f75('0x47')]){_0x1f860a[_0x6f75('0x43')]=[{'all':!![]}];}_0x1f860a=_[_0x6f75('0x40')]({},_0x1f860a,_0x44dca4[_0x6f75('0x42')]);return db['UserProfile'][_0x6f75('0x48')](_0x1f860a)[_0x6f75('0x26')](handleEntityNotFound(_0x58cc44,null))['then'](respondWithResult(_0x58cc44,null))[_0x6f75('0x46')](handleError(_0x58cc44,null));};exports[_0x6f75('0x49')]=function(_0x269485,_0x1aa31f){return db['UserProfile'][_0x6f75('0x49')](_0x269485[_0x6f75('0x4a')],{})[_0x6f75('0x26')](respondWithResult(_0x1aa31f,0xc9))[_0x6f75('0x46')](handleError(_0x1aa31f,null));};exports[_0x6f75('0x4b')]=function(_0x491ced,_0x2b3b5b){var _0x470955={'where':{'id':_0x491ced[_0x6f75('0x4c')]['id']}},_0x2dddd0={};_0x2dddd0[_0x6f75('0x35')]=_[_0x6f75('0x33')](db[_0x6f75('0x2e')]['rawAttributes']);_0x470955['attributes']=_[_0x6f75('0x34')](_0x2dddd0[_0x6f75('0x35')],qs['fields'](_0x491ced[_0x6f75('0x32')]['fields']));_0x470955['attributes']=_0x470955[_0x6f75('0x36')][_0x6f75('0x38')]?_0x470955[_0x6f75('0x36')]:_0x2dddd0[_0x6f75('0x35')];if(_0x491ced['query'][_0x6f75('0x47')]){_0x470955[_0x6f75('0x43')]=[{'all':!![]}];}_0x470955=_[_0x6f75('0x40')]({},_0x470955,_0x491ced[_0x6f75('0x42')]);return db['UserProfile']['find'](_0x470955)[_0x6f75('0x26')](handleEntityNotFound(_0x2b3b5b,null))['then'](function(_0x40ae6e){if(_0x40ae6e){var _0x446cb2=_0x40ae6e[_0x6f75('0x4d')]({'plain':!![]});_0x446cb2=qs[_0x6f75('0x4e')](_0x446cb2,['id',_0x6f75('0x4f'),_0x6f75('0x50'),_0x6f75('0x51')]);_0x491ced[_0x6f75('0x4a')]=_[_0x6f75('0x4e')](_0x491ced[_0x6f75('0x4a')],['id',_0x6f75('0x4f'),_0x6f75('0x50')]);return db[_0x6f75('0x52')]['transaction'](function(_0x31a37b){return db[_0x6f75('0x2e')][_0x6f75('0x49')](_[_0x6f75('0x40')](_0x446cb2,_0x491ced[_0x6f75('0x4a')]),{'include':_0x491ced[_0x6f75('0x32')][_0x6f75('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x31a37b})[_0x6f75('0x26')](function(_0x26ab34){var _0x99f239=_0x26ab34[_0x6f75('0x4d')]({'plain':!![]});return db[_0x6f75('0x53')]['findAll']({'where':{'userProfileId':_0x491ced[_0x6f75('0x4c')]['id']},'raw':!![]})[_0x6f75('0x26')](function(_0x26085a){if(_0x26085a){return BPromise['each'](_0x26085a,function(_0x497f34){return new BPromise(function(_0x5b58e1,_0x417f21){if(_0x497f34[_0x6f75('0x54')]===null||_0x497f34['autoAssociation']===0x1)_0x5b58e1(null);return db[_0x6f75('0x55')][_0x6f75('0x44')]({'where':{'sectionId':_0x497f34['id']},'raw':!![]})[_0x6f75('0x26')](function(_0x2352da){var _0x9202aa=_['map'](_0x2352da,function(_0x196b9d){return qs[_0x6f75('0x4e')](_0x196b9d,['id','createdAt',_0x6f75('0x50'),_0x6f75('0x56')]);});_0x5b58e1(_0x9202aa);})[_0x6f75('0x46')](function(_0x11d5f6){_0x417f21(_0x11d5f6);});})[_0x6f75('0x26')](function(_0x493629){var _0x378bc0=qs[_0x6f75('0x4e')](_0x497f34,['id',_0x6f75('0x4f'),'updatedAt']);_0x378bc0[_0x6f75('0x57')]=_0x99f239['id'];if(_0x493629)_0x378bc0['Resources']=_0x493629;return _0x378bc0;})[_0x6f75('0x26')](function(_0x353d1e){return db['UserProfileSection'][_0x6f75('0x49')](_0x353d1e,{'include':[{'model':db[_0x6f75('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x31a37b});});})['then'](function(){return _0x99f239;});}});});});}})['then'](respondWithResult(_0x2b3b5b,0xc9))[_0x6f75('0x46')](handleError(_0x2b3b5b,null));};exports[_0x6f75('0x25')]=function(_0x368931,_0x26e352){if(_0x368931[_0x6f75('0x4a')]['id']){delete _0x368931[_0x6f75('0x4a')]['id'];}return db[_0x6f75('0x2e')][_0x6f75('0x48')]({'where':{'id':_0x368931[_0x6f75('0x4c')]['id']}})[_0x6f75('0x26')](handleEntityNotFound(_0x26e352,null))['then'](saveUpdates(_0x368931[_0x6f75('0x4a')],null))[_0x6f75('0x26')](respondWithResult(_0x26e352,null))[_0x6f75('0x46')](handleError(_0x26e352,null));};exports[_0x6f75('0x27')]=function(_0x4ca483,_0x4a7ec3){return db[_0x6f75('0x2e')][_0x6f75('0x48')]({'where':{'id':_0x4ca483[_0x6f75('0x4c')]['id']}})[_0x6f75('0x26')](handleEntityNotFound(_0x4a7ec3,null))['then'](removeEntity(_0x4a7ec3,null))['catch'](handleError(_0x4a7ec3,null));};exports[_0x6f75('0x58')]=function(_0x1b9252,_0x5240b5){return db['UserProfile'][_0x6f75('0x58')]()['then'](respondWithResult(_0x5240b5,null))[_0x6f75('0x46')](handleError(_0x5240b5,null));};exports[_0x6f75('0x59')]=function(_0x3db855,_0x3c62db){var _0x3b500=_0x3db855[_0x6f75('0x4a')];return db[_0x6f75('0x2e')][_0x6f75('0x48')]({'where':{'id':_0x3db855[_0x6f75('0x4c')]['id']}})[_0x6f75('0x26')](handleEntityNotFound(_0x3c62db,null))[_0x6f75('0x26')](function(_0x3fe744){if(_0x3fe744){return db[_0x6f75('0x52')][_0x6f75('0x5a')](function(_0x45f28a){return db[_0x6f75('0x53')][_0x6f75('0x27')]({'where':{'userProfileId':_0x3db855[_0x6f75('0x4c')]['id'],'sectionId':_[_0x6f75('0x2d')](_0x3b500,function(_0x58bd98){return _0x58bd98[_0x6f75('0x56')];})},'transaction':_0x45f28a})['then'](function(){var _0x5f0a2a=_[_0x6f75('0x2d')](_0x3b500,function(_0xe70684){_0xe70684[_0x6f75('0x57')]=_0x3db855['params']['id'];return _0xe70684;});var _0x170e4a=[];return BPromise[_0x6f75('0x5b')](_0x5f0a2a,function(_0x5360fd){return db[_0x6f75('0x53')][_0x6f75('0x49')](_0x5360fd,{'include':[{'model':db[_0x6f75('0x55')],'as':_0x6f75('0x5c')}],'raw':!![],'transaction':_0x45f28a})[_0x6f75('0x26')](function(_0x191550){_0x170e4a[_0x6f75('0x5d')](_0x191550[_0x6f75('0x4d')]({'plain':!![]}));});})[_0x6f75('0x26')](function(){return _0x170e4a;});});});}})[_0x6f75('0x26')](function(_0x17f1d0){return _0x17f1d0;})[_0x6f75('0x26')](respondWithResult(_0x3c62db,null))[_0x6f75('0x46')](handleError(_0x3c62db,null));};exports[_0x6f75('0x5e')]=function(_0x1c9164,_0x254d70){var _0x150e22;return db[_0x6f75('0x2e')]['find']({'where':{'id':_0x1c9164[_0x6f75('0x4c')]['id']},'attributes':['id',_0x6f75('0x2a')]})['then'](handleEntityNotFound(_0x254d70,null))[_0x6f75('0x26')](function(_0x15c27e){if(_0x15c27e){_0x150e22=_0x15c27e;return db['UserProfileSection'][_0x6f75('0x27')]({'where':{'userProfileId':_0x1c9164['params']['id'],'sectionId':_0x1c9164[_0x6f75('0x32')][_0x6f75('0x5f')]}});}})[_0x6f75('0x26')](function(){return _0x150e22;})[_0x6f75('0x26')](respondWithStatusCode(_0x254d70,null))[_0x6f75('0x46')](handleError(_0x254d70,null));};exports[_0x6f75('0x60')]=function(_0x3696b2,_0x4c385d){var _0x3ec452=[];var _0x1427c5=[];return db[_0x6f75('0x53')][_0x6f75('0x44')]({'where':{'userProfileId':_0x3696b2['params']['id']},'raw':!![]})[_0x6f75('0x26')](function(_0x3628e1){_0x3ec452=_['filter'](_0x3628e1,function(_0x4ebb40){return _0x4ebb40['enabled']===0x1||_[_0x6f75('0x61')]([0x3eb,0x709],_0x4ebb40['sectionId']);});if(!_['isEmpty'](_0x3ec452)){return _[_0x6f75('0x2d')](_0x3ec452,function(_0x363d42){return _0x363d42[_0x6f75('0x56')];});}else{return;}})[_0x6f75('0x26')](function(_0x32fe79){if(_0x32fe79)_0x1427c5=_0x32fe79;if(_['includes'](_0x1427c5,0x64)){var _0x4891da=_[_0x6f75('0x48')](_0x3ec452,{'sectionId':0x64});return hasDefaultDashboard(_0x4891da)['then'](function(_0x14ef53){return _[_0x6f75('0x2d')](_0x3ec452,function(_0x2960a4){if(_0x2960a4[_0x6f75('0x56')]===0x64){_0x2960a4[_0x6f75('0x62')]=_0x14ef53;}return _0x2960a4;});});}else{return;}})[_0x6f75('0x26')](function(_0x4c4973){if(_0x4c4973)_0x3ec452=_0x4c4973;if(_[_0x6f75('0x61')](_0x1427c5,0x3eb)){var _0x1795db=_[_0x6f75('0x48')](_0x3ec452,{'sectionId':0x3eb});return getCustomDashboards(_0x1795db)['then'](function(_0x5935c5){return _[_0x6f75('0x2d')](_0x3ec452,function(_0xba2cf2){if(_0x1795db[_0x6f75('0x63')]){if(_0xba2cf2[_0x6f75('0x56')]===0x3eb){_0xba2cf2[_0x6f75('0x62')]=_0x5935c5;}}else{if(_0xba2cf2[_0x6f75('0x56')]===0x64){if(!_0xba2cf2[_0x6f75('0x62')]){_0xba2cf2[_0x6f75('0x62')]=[];}_0xba2cf2[_0x6f75('0x62')]=_0xba2cf2['subsections'][_0x6f75('0x64')](_0x5935c5);}}return _0xba2cf2;});});}else{return;}})[_0x6f75('0x26')](function(_0x4ef3e9){if(_0x4ef3e9)_0x3ec452=_0x4ef3e9;if(_[_0x6f75('0x61')](_0x1427c5,0x709)){var _0x1bc0c7=_[_0x6f75('0x48')](_0x3ec452,{'sectionId':0x709});return getPlugins(_0x1bc0c7)[_0x6f75('0x26')](function(_0x1036b7){if(_0x1bc0c7['enabled']){return _['map'](_0x3ec452,function(_0x501b9e){if(_0x501b9e['sectionId']===0x709){_0x501b9e[_0x6f75('0x62')]=_0x1036b7;}return _0x501b9e;});}else{var _0xbba592={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1036b7};var _0x31d3a4=_[_0x6f75('0x2d')](_0x3ec452);_0x31d3a4[_0x6f75('0x5d')](_0xbba592);return _0x31d3a4;}});}else{return;}})[_0x6f75('0x26')](function(_0x4becb8){if(_0x4becb8)_0x3ec452=_0x4becb8;return _[_0x6f75('0x3f')](_0x3ec452,[_0x6f75('0x63'),0x1]);})[_0x6f75('0x26')](respondWithResult(_0x4c385d,null))[_0x6f75('0x46')](handleError(_0x4c385d,null));};function hasDefaultDashboard(_0xd053cd){var _0x5ae2bd=[0x65];return new BPromise(function(_0x1e4749,_0x46e3d9){try{if(_0xd053cd[_0x6f75('0x54')]){_0x1e4749(_0x5ae2bd);}else{return db[_0x6f75('0x55')]['findOne']({'where':{'sectionId':_0xd053cd['id']},'raw':!![]})[_0x6f75('0x26')](function(_0xbbb220){_0xbbb220?_0x1e4749(_0x5ae2bd):_0x1e4749();});}}catch(_0x5ef310){_0x46e3d9(_0x5ef310);}});}function getCustomDashboards(_0x3f13ab){var _0x5b5e16=[];return new BPromise(function(_0x568392,_0x1b236c){try{if(_0x3f13ab[_0x6f75('0x54')]){return db['Dashboard'][_0x6f75('0x44')]({'raw':!![]})[_0x6f75('0x26')](function(_0x30e63c){_0x30e63c['forEach'](function(_0x4279d5){_0x5b5e16['push'](_0x4279d5['id']+0x1869f);});_0x568392(_0x5b5e16);});}else{return db[_0x6f75('0x55')]['findAll']({'where':{'sectionId':_0x3f13ab['id']},'raw':!![]})[_0x6f75('0x26')](function(_0x3203f6){_0x3203f6[_0x6f75('0x65')](function(_0x2d992e){_0x5b5e16[_0x6f75('0x5d')](_0x2d992e['resourceId']+0x1869f);});_0x568392(_0x5b5e16);});}}catch(_0x16736d){_0x1b236c(_0x16736d);}});}function getPlugins(_0x28117f){var _0x10bb41=[];return new BPromise(function(_0x5d9fd2,_0x196dcf){try{if(_0x28117f[_0x6f75('0x54')]){return db[_0x6f75('0x66')]['findAll']({'raw':!![]})[_0x6f75('0x26')](function(_0x217d57){_0x217d57[_0x6f75('0x65')](function(_0x7e9a56){_0x10bb41['push'](_0x7e9a56['id']+0x15b38);});_0x5d9fd2(_0x10bb41);});}else{return db[_0x6f75('0x55')]['findAll']({'where':{'sectionId':_0x28117f['id']},'raw':!![]})[_0x6f75('0x26')](function(_0x411851){_0x411851[_0x6f75('0x65')](function(_0x5d5536){_0x10bb41[_0x6f75('0x5d')](_0x5d5536[_0x6f75('0x67')]+0x15b38);});_0x5d9fd2(_0x10bb41);});}}catch(_0x173e98){_0x196dcf(_0x173e98);}});}exports[_0x6f75('0x68')]=function(_0x26ff81,_0x611ae5){return db[_0x6f75('0x2e')][_0x6f75('0x48')]({'where':{'id':_0x26ff81[_0x6f75('0x4c')]['id']}})[_0x6f75('0x26')](handleEntityNotFound(_0x611ae5,null))[_0x6f75('0x26')](function(_0xaf8b59){if(_0xaf8b59){return db[_0x6f75('0x52')]['transaction'](function(_0x476c15){return db[_0x6f75('0x53')][_0x6f75('0x44')]({'where':{'userProfileId':_0x26ff81[_0x6f75('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x6f75('0x26')](function(_0x1c5586){if(_0x1c5586){return db['UserProfileSection'][_0x6f75('0x27')]({'where':{'userProfileId':_0x26ff81['params']['id'],'id':_[_0x6f75('0x2d')](_0x1c5586,function(_0xe32f23){return _0xe32f23['id'];})},'transaction':_0x476c15});}})[_0x6f75('0x26')](function(_0x4bd4cb){var _0x40cc49=_[_0x6f75('0x2d')](_0x26ff81['body'],function(_0xc15e8d){_0xc15e8d[_0x6f75('0x57')]=_0x26ff81[_0x6f75('0x4c')]['id'];return _0xc15e8d;});return db[_0x6f75('0x53')][_0x6f75('0x69')](_0x40cc49,{'raw':!![],'transaction':_0x476c15});})['then'](function(_0x580251){var _0xcfb0e5=_[_0x6f75('0x3f')](_['map'](_0x580251,function(_0x41edd5){return _0x41edd5[_0x6f75('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0xcfb0e5){return db[_0x6f75('0x53')][_0x6f75('0x44')]({'where':{'userProfileId':_0x26ff81['params']['id'],'sectionId':_[_0x6f75('0x2d')](_0xcfb0e5,function(_0x5e2d08){return _0x5e2d08['sectionId'];})},'attributes':['id',_0x6f75('0x56')],'raw':!![]})[_0x6f75('0x26')](function(_0x3275b7){var _0x2e3001=_['map'](_0x26ff81['body'],function(_0x4faf9e){_0x4faf9e[_0x6f75('0x57')]=_0x26ff81[_0x6f75('0x4c')]['id'];return _0x4faf9e;});return db[_0x6f75('0x55')]['bulkCreate'](_0x2e3001,{'raw':!![],'transaction':_0x476c15});});}})[_0x6f75('0x46')](handleError(_0x611ae5,null));});}})['then'](function(_0x3ebf44){var _0x501de3=_[_0x6f75('0x2d')](_0x3ebf44,function(_0x71cbb5){return _0x71cbb5[_0x6f75('0x4d')]({'plain':!![]});});})[_0x6f75('0x26')](respondWithResult(_0x611ae5,null))['catch'](handleError(_0x611ae5,null));};exports[_0x6f75('0x6a')]=function(_0x59ffb1,_0x411b72,_0x23c5e5){return db[_0x6f75('0x2e')]['find']({'where':{'id':_0x59ffb1[_0x6f75('0x4c')]['id']}})[_0x6f75('0x26')](handleEntityNotFound(_0x411b72,null))[_0x6f75('0x26')](function(_0xce9ec){if(_0xce9ec){return _0xce9ec[_0x6f75('0x6a')](_0x59ffb1['query'][_0x6f75('0x5f')]);}})['then'](respondWithStatusCode(_0x411b72,null))['catch'](handleError(_0x411b72,null));};exports[_0x6f75('0x6b')]=function(_0x4605c8,_0x4a1f29){var _0x52906e={};if(!_0x4605c8[_0x6f75('0x32')]['section'])throw new Error(_0x6f75('0x6c'));if(!_0x4605c8[_0x6f75('0x32')]['hasOwnProperty'](_0x6f75('0x6d'))){_0x52906e['limit']=qs[_0x6f75('0x1e')](_0x4605c8['query'][_0x6f75('0x1e')]);_0x52906e[_0x6f75('0x20')]=qs[_0x6f75('0x20')](_0x4605c8[_0x6f75('0x32')][_0x6f75('0x20')]);}return db[_0x6f75('0x2e')][_0x6f75('0x48')]({'where':{'id':_0x4605c8['params']['id']}})['then'](function(_0x4a26bf){if(!_0x4a26bf)throw new Error(_0x6f75('0x6e')+_0x4605c8[_0x6f75('0x4c')]['id']);return db['UserProfile'][_0x6f75('0x6b')](_0x4605c8);})[_0x6f75('0x26')](respondWithFilteredResult(_0x4a1f29,_0x52906e))['catch'](handleError(_0x4a1f29,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f8c1d91..77f68d4 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 _0xe785=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe785,0x128));var _0x5e78=function(_0x4a439a,_0x5a0f41){_0x4a439a=_0x4a439a-0x0;var _0x1477f0=_0xe785[_0x4a439a];return _0x1477f0;};'use strict';var EventEmitter=require(_0x5e78('0x0'));var UserProfile=require(_0x5e78('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5e78('0x2')](0x0);var events={'afterCreate':_0x5e78('0x3'),'afterUpdate':_0x5e78('0x4'),'afterDestroy':_0x5e78('0x5')};function emitEvent(_0x4d8317){return function(_0x4c0243,_0x55fadd,_0x4565a4){UserProfileEvents[_0x5e78('0x6')](_0x4d8317+':'+_0x4c0243['id'],_0x4c0243);UserProfileEvents[_0x5e78('0x6')](_0x4d8317,_0x4c0243);_0x4565a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x5e78('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x13c5=['emit','hasOwnProperty','events'];(function(_0x1361c9,_0x2e433b){var _0x5c7a18=function(_0x44316f){while(--_0x44316f){_0x1361c9['push'](_0x1361c9['shift']());}};_0x5c7a18(++_0x2e433b);}(_0x13c5,0x7a));var _0x513c=function(_0x3554c0,_0x5342c9){_0x3554c0=_0x3554c0-0x0;var _0xf46df6=_0x13c5[_0x3554c0];return _0xf46df6;};'use strict';var EventEmitter=require(_0x513c('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432ab7){return function(_0x516e1a,_0x4d46c0,_0x477e2c){UserProfileEvents[_0x513c('0x1')](_0x432ab7+':'+_0x516e1a['id'],_0x516e1a);UserProfileEvents[_0x513c('0x1')](_0x432ab7,_0x516e1a);_0x477e2c(null);};}for(var e in events){if(events[_0x513c('0x2')](e)){var event=events[e];UserProfile['hook'](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 cb4e0d8..59f6806 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 _0xaa99=['VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','telephone','queue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueue','VoiceQueues','users','agents','telephones','Users','user','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','query','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','all','length','find','ignore','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','default','custom','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','fax','mail','openchannel','lodash','squel','exports','models','filter','value','findAll','then','associatedResources','catch','field','model','map','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','childModel','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails'];(function(_0x37a79f,_0xfeb6b5){var _0x2714a7=function(_0x208ccd){while(--_0x208ccd){_0x37a79f['push'](_0x37a79f['shift']());}};_0x2714a7(++_0xfeb6b5);}(_0xaa99,0x151));var _0x9aa9=function(_0x53919e,_0x117ec1){_0x53919e=_0x53919e-0x0;var _0x499d55=_0xaa99[_0x53919e];return _0x499d55;};'use strict';var _=require(_0x9aa9('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x9aa9('0x1'));module[_0x9aa9('0x2')]=function(_0x1b5f7e){var _0x18df8e=_0x1b5f7e[_0x9aa9('0x3')];function _0x164b61(_0x2f1e98,_0x50c97a){return new Promise(function(_0x40c47f,_0x182b2a){if(!_0x50c97a)return _0x40c47f(null);var _0x336122=_0x50c97a[_0x9aa9('0x4')]?{[_0x50c97a[_0x9aa9('0x4')]['field']]:_0x50c97a[_0x9aa9('0x4')][_0x9aa9('0x5')]}:undefined;return _0x18df8e[_0x2f1e98][_0x9aa9('0x6')]({'where':_0x336122,'raw':!![]})[_0x9aa9('0x7')](function(_0x364791){_0x50c97a[_0x9aa9('0x8')]=_['map'](_0x364791,'id');_0x40c47f(_0x50c97a);})[_0x9aa9('0x9')](function(_0x56ab39){_0x182b2a(_0x56ab39);});});}function _0x417669(_0x3387e8,_0x28982a){return new Promise(function(_0x47af4e,_0x18d6e0){var _0x282019=_0x3387e8[_0x9aa9('0x4')]?{[_0x3387e8[_0x9aa9('0x4')][_0x9aa9('0xa')]]:_0x3387e8[_0x9aa9('0x4')][_0x9aa9('0x5')]}:undefined;return _0x18df8e[_0x3387e8[_0x9aa9('0xb')]][_0x9aa9('0x6')]({'where':_0x282019,'raw':!![]})[_0x9aa9('0x7')](function(_0x5b3cc4){_0x28982a[_0x9aa9('0x8')]=_[_0x9aa9('0xc')](_0x5b3cc4,function(_0x145ed1){return _0x145ed1['name'];});_0x47af4e(_0x28982a);})[_0x9aa9('0x9')](function(_0x33482c){_0x18d6e0(_0x33482c);});});}function _0xc982de(_0x3f5b5d,_0x3f9a77,_0x9bb99e){if(!_0x3f9a77)return Promise['resolve'](null);return new Promise(function(_0x1327c1,_0x30b2d8){return _0x18df8e[_0x9aa9('0xd')][_0x9aa9('0x6')]({'where':{'sectionId':_0x3f9a77['id']},'raw':!![]})[_0x9aa9('0x7')](function(_0x23ff31){if(_0x3f5b5d[_0x9aa9('0xa')]&&_0x3f5b5d['field']!=='id'){_0x3f9a77['associatedResources']=_[_0x9aa9('0xc')](_0x23ff31,function(_0x370ed1){return _0x370ed1[_0x3f5b5d['field']];});}else{if(_0x9bb99e===_0x9aa9('0xe')){_0x3f9a77['associatedResources']=_[_0x9aa9('0xc')](_0x23ff31,function(_0x26e245){return{'id':_0x26e245[_0x9aa9('0xf')],'type':_0x26e245[_0x9aa9('0x10')]};});}else{_0x3f9a77[_0x9aa9('0x8')]=_[_0x9aa9('0xc')](_0x23ff31,function(_0x173443){return _0x173443['resourceId'];});}}_0x1327c1(_0x3f9a77);})[_0x9aa9('0x9')](function(_0x471653){_0x30b2d8(_0x471653);});});}function _0x4486f0(_0x31b636,_0x133feb){var _0xbf592a={'parentSections':[]};switch(_0x31b636[_0x9aa9('0x11')]()){case _0x9aa9('0x12'):_0xbf592a['childModel']='SquareProject';break;case _0x9aa9('0x13'):_0xbf592a[_0x9aa9('0x14')]='SquareOdbc';break;case _0x9aa9('0x15'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x16');_0xbf592a[_0x9aa9('0x17')]=[{'name':_0x9aa9('0x18'),'field':_0x9aa9('0x19'),'foreignKey':_0x9aa9('0x1a')}];break;case _0x9aa9('0x1b'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x1c');break;case'contacts':_0xbf592a[_0x9aa9('0x14')]='CmContact';_0xbf592a[_0x9aa9('0x17')]=[{'name':_0x9aa9('0x1d'),'field':'id','foreignKey':_0x9aa9('0x1e')}];break;case _0x9aa9('0x1f'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x20');break;case'companies':_0xbf592a[_0x9aa9('0x14')]='CmCompany';break;case _0x9aa9('0x21'):_0xbf592a['childModel']=_0x9aa9('0x22');break;case _0x9aa9('0x23'):_0xbf592a['childModel']='ChatQueue';break;case _0x9aa9('0x24'):_0xbf592a['childModel']=_0x9aa9('0x25');break;case _0x9aa9('0x26'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x27');break;case'faxaccounts':_0xbf592a[_0x9aa9('0x14')]='FaxAccount';break;case _0x9aa9('0x28'):case _0x9aa9('0x29'):case _0x9aa9('0x2a'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x2b');break;case _0x9aa9('0x2c'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x2d');break;case _0x9aa9('0x2e'):_0xbf592a['childModel']=_0x9aa9('0x2f');break;case _0x9aa9('0x30'):_0xbf592a[_0x9aa9('0x14')]='VoiceRecording';_0xbf592a['parentSections']=[{'name':_0x9aa9('0x31'),'field':_0x9aa9('0x19'),'foreignKey':_0x9aa9('0x32'),'model':'User','filter':{'field':_0x9aa9('0x33'),'value':[_0x9aa9('0x34')]}},{'name':_0x9aa9('0x35'),'field':_0x9aa9('0x19'),'foreignKey':_0x9aa9('0x32'),'model':_0x9aa9('0x36'),'filter':{'field':_0x9aa9('0x33'),'value':[_0x9aa9('0x37')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x9aa9('0x38'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0x9aa9('0x39'),'field':_0x9aa9('0x19'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x9aa9('0x10'),'value':[_0x9aa9('0x3a')]}}];break;case _0x9aa9('0x3b'):_0xbf592a['childModel']=_0x9aa9('0x3c');break;case _0x9aa9('0x3d'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x3e');break;case _0x9aa9('0x3f'):_0xbf592a[_0x9aa9('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0xbf592a[_0x9aa9('0x14')]='Campaign';break;case _0x9aa9('0x40'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x41');break;case _0x9aa9('0x42'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x43');break;case'mailsubstatuses':_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x44');break;case _0x9aa9('0x45'):_0xbf592a['childModel']=_0x9aa9('0x46');break;case _0x9aa9('0x47'):_0xbf592a[_0x9aa9('0x14')]='OpenchannelAccount';break;case _0x9aa9('0x48'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x49');break;case _0x9aa9('0x4a'):_0xbf592a[_0x9aa9('0x14')]='SmsAccount';break;case _0x9aa9('0x4b'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x4c');break;case _0x9aa9('0x4d'):_0xbf592a['childModel']=_0x9aa9('0x4e');break;case'teams':_0xbf592a['childModel']=_0x9aa9('0x4f');break;case _0x9aa9('0x50'):case _0x9aa9('0x51'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x52');if(_0x133feb){_0xbf592a['parentSections']=[{'name':_0x9aa9('0x53')},{'name':_0x9aa9('0x39')}];}break;case _0x9aa9('0x54'):case _0x9aa9('0x55'):case _0x9aa9('0x56'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x36');if(_0x133feb){_0xbf592a[_0x9aa9('0x17')]=[{'name':_0x9aa9('0x57'),'filter':{'field':'role','value':['admin',_0x9aa9('0x58')]},'ignore':!![]},{'name':_0x9aa9('0x31')},{'name':_0x9aa9('0x35')}];}break;case'zendeskaccounts':_0xbf592a[_0x9aa9('0x14')]='ZendeskAccount';break;case _0x9aa9('0x59'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x5a');break;case'freshdeskaccounts':_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x5b');break;case'sugarcrmaccounts':_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x5c');break;case _0x9aa9('0x5d'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x5e');break;case _0x9aa9('0x5f'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x60');break;case _0x9aa9('0x61'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x36');break;case _0x9aa9('0x62'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x63');break;case _0x9aa9('0x64'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x65');break;case _0x9aa9('0x66'):_0xbf592a['childModel']=_0x9aa9('0x67');break;case _0x9aa9('0x68'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x69');break;case'pauses':_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x6a');break;case _0x9aa9('0x6b'):_0xbf592a['childModel']=_0x9aa9('0x6c');break;case _0x9aa9('0x6d'):_0xbf592a[_0x9aa9('0x14')]='Sound';break;case _0x9aa9('0x6e'):_0xbf592a['childModel']=_0x9aa9('0x6f');break;case _0x9aa9('0x70'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x71');break;case _0x9aa9('0x72'):_0xbf592a['childModel']=_0x9aa9('0x73');break;case'trunks':_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x74');break;case _0x9aa9('0x75'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x76');break;case _0x9aa9('0x77'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x78');break;case _0x9aa9('0x79'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0xe');_0xbf592a['parentSections']=[{'name':_0x9aa9('0x7a'),'field':'id','foreignKey':_0x9aa9('0x7b')}];break;case _0x9aa9('0x7c'):_0xbf592a[_0x9aa9('0x14')]=_0x9aa9('0x7d');break;}return _0xbf592a;}function _0x1140af(_0x441f4b,_0x16fcb1){var _0x362e84=_0x441f4b[_0x9aa9('0x7e')](0x0)[_0x9aa9('0x7f')]()+_0x441f4b[_0x9aa9('0x80')](0x1);var _0x2dc838={'type':_0x18df8e[_0x9aa9('0x81')][_0x9aa9('0x82')][_0x9aa9('0x83')],'raw':!![]};return new Promise(function(_0x2b4b0d,_0x5c2c3d){var _0x183ea9=squel[_0x9aa9('0x84')]()[_0x9aa9('0xa')](_0x9aa9('0x85')+_0x362e84+_0x9aa9('0x86'),'id')['field'](_0x9aa9('0x87'))['from'](_0x9aa9('0x88')+_0x441f4b+_0x9aa9('0x89'),'ui')[_0x9aa9('0x8a')]('ui.UserId\x20=\x20?',_0x16fcb1['id']);return _0x18df8e['sequelize'][_0x9aa9('0x8b')](_0x183ea9['toString'](),_0x2dc838)[_0x9aa9('0x7')](function(_0xd97108){_0x16fcb1[_0x362e84+_0x9aa9('0x8c')]=_0xd97108;_0x2b4b0d(_0xd97108);})['catch'](function(_0x98dc7d){_0x5c2c3d(_0x98dc7d);});});}return _0x1b5f7e['define'](_0x9aa9('0x8d'),attributes,{'tableName':_0x9aa9('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1cb5ee){var _0x228023=require(_0x9aa9('0x8f'));var _0x1d07c3={'raw':_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0x90')],'where':{}};var _0x3218c4={};var _0x579785={'count':0x0,'rows':[]};var _0x29f5d5=_0x1cb5ee['query'][_0x9aa9('0x91')];var _0x3b9432=_0x1cb5ee[_0x9aa9('0x8b')]['mergeResources']||![];var _0x501057=_0x4486f0(_0x29f5d5,_0x3b9432);if(!_0x501057[_0x9aa9('0x14')])throw new Error(_0x9aa9('0x92')+_0x29f5d5+'\x27');var _0x4920f2=[{'name':_0x29f5d5}];if(!_[_0x9aa9('0x93')](_0x501057['parentSections']))_0x4920f2=_0x501057[_0x9aa9('0x17')];var _0xbf24d2=[];for(var _0x3f0377=0x0;_0x3f0377<_0x4920f2['length'];_0x3f0377++){_0xbf24d2[_0x9aa9('0x94')](_0x18df8e[_0x9aa9('0x95')]['find']({'where':{'userProfileId':_0x1cb5ee[_0x9aa9('0x96')]['id'],'name':_0x4920f2[_0x3f0377][_0x9aa9('0x19')]},'raw':!![]}));}return Promise[_0x9aa9('0x97')](_0xbf24d2)[_0x9aa9('0x7')](function(_0x3d601f){var _0x17d985=_[_0x9aa9('0x4')](_0x3d601f,function(_0x5d5dfc){return _0x5d5dfc?_0x5d5dfc:undefined;});var _0x27b061=_[_0x9aa9('0x4')](_0x4920f2,['ignore',!![]]);var _0x4e4304=_[_0x9aa9('0x93')](_0x17d985)&&_[_0x9aa9('0x93')](_0x27b061)?null:_['union'](_0x27b061,_0x17d985);if(!_0x4e4304)return null;var _0x14ddaa=[];for(var _0x5d3d7f=0x0;_0x5d3d7f<_0x4e4304[_0x9aa9('0x98')];_0x5d3d7f++){var _0x583f66=_[_0x9aa9('0x99')](_0x4920f2,function(_0x44d785){return _0x4e4304[_0x5d3d7f]?_0x44d785[_0x9aa9('0x19')]===_0x4e4304[_0x5d3d7f][_0x9aa9('0x19')]:null;});if(_0x583f66){if(_0x4e4304[_0x5d3d7f][_0x9aa9('0x9a')]){_0x14ddaa[_0x9aa9('0x94')](_0x164b61(_0x501057[_0x9aa9('0x14')],_0x4e4304[_0x5d3d7f]));}else{if(!_0x4e4304[_0x5d3d7f][_0x9aa9('0x9b')]){_0x14ddaa[_0x9aa9('0x94')](_0xc982de(_0x583f66,_0x4e4304[_0x5d3d7f],_0x501057['childModel']));}else{if(_0x583f66[_0x9aa9('0xb')]){_0x14ddaa[_0x9aa9('0x94')](_0x417669(_0x583f66,_0x4e4304[_0x5d3d7f]));}}}}}return Promise['all'](_0x14ddaa);})[_0x9aa9('0x7')](function(_0x4a14d0){var _0xcae951=_0x4a14d0;var _0x1621f7=null;if(_0xcae951){_0x1621f7=_0xcae951[_0x9aa9('0x98')]===0x1?_0xcae951[0x0]:null;}if(!_0x1621f7&&!_0xcae951)return _0x579785;var _0x1dbcdc=_0x18df8e[_0x501057[_0x9aa9('0x14')]]['rawAttributes'];_0x3218c4[_0x9aa9('0xb')]=_[_0x9aa9('0x9c')](_0x1dbcdc);_0x3218c4[_0x9aa9('0x8b')]=_[_0x9aa9('0x9c')](_0x1cb5ee[_0x9aa9('0x8b')]);_0x3218c4[_0x9aa9('0x9d')]=_[_0x9aa9('0x9e')](_0x3218c4[_0x9aa9('0xb')],_0x3218c4[_0x9aa9('0x8b')]);_0x1d07c3['attributes']=_[_0x9aa9('0x9e')](_0x3218c4[_0x9aa9('0xb')],_0x228023[_0x9aa9('0x9f')](_0x1cb5ee['query'][_0x9aa9('0x9f')]));_0x1d07c3[_0x9aa9('0xa0')]=_0x1d07c3['attributes']['length']?_0x1d07c3[_0x9aa9('0xa0')]:_0x3218c4[_0x9aa9('0xb')];if(!_0x1cb5ee['query'][_0x9aa9('0xa1')](_0x9aa9('0xa2'))){_0x1d07c3[_0x9aa9('0xa3')]=_0x228023[_0x9aa9('0xa3')](_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xa3')]);_0x1d07c3[_0x9aa9('0xa4')]=_0x228023[_0x9aa9('0xa4')](_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xa4')]);}_0x1d07c3[_0x9aa9('0xa5')]=_0x228023['sort'](_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xa6')]);_0x1d07c3['where']=_0x228023['filters'](_[_0x9aa9('0xa7')](_0x1cb5ee['query'],_0x3218c4[_0x9aa9('0x9d')]));if(_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0x4')]){_0x1d07c3['where']=_[_0x9aa9('0xa8')](_0x1d07c3[_0x9aa9('0x8a')],{'$or':_['map'](_0x1dbcdc,function(_0x3a7f32){if(_0x3a7f32['type'][_0x9aa9('0xa9')]!==_0x9aa9('0xaa')){var _0x3e2450={};_0x3e2450[_0x3a7f32['field']]={'$like':'%'+_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0x4')]+'%'};return _0x3e2450;}})});}var _0x362c97=[];var _0x44f475=null;var _0x313f05={};if(_0x1621f7){_0x44f475=_['find'](_0x4920f2,[_0x9aa9('0x19'),_0x1621f7['name']]);if(_0x44f475[_0x9aa9('0xa')]){_0x313f05={};if(_0x501057[_0x9aa9('0x14')]==='AnalyticExtractedReport'){_0x313f05[_0x44f475[_0x9aa9('0xab')]]=_[_0x9aa9('0xc')](_0x1621f7[_0x9aa9('0x8')],'id');}else{_0x313f05[_0x44f475['foreignKey']]=_0x1621f7[_0x9aa9('0x8')];}_0x362c97[_0x9aa9('0x94')](_0x313f05);}else{_0x1d07c3[_0x9aa9('0x8a')]['id']=_0x1621f7[_0x9aa9('0x8')];}}else{for(var _0x8a95e8=0x0;_0x8a95e8<_0xcae951[_0x9aa9('0x98')];_0x8a95e8++){_0x44f475=_['find'](_0x4920f2,[_0x9aa9('0x19'),_0xcae951[_0x8a95e8][_0x9aa9('0x19')]]);if(_0x44f475[_0x9aa9('0xa')]){_0x313f05={};_0x313f05[_0x44f475[_0x9aa9('0xab')]]=_0xcae951[_0x8a95e8][_0x9aa9('0x8')];_0x362c97[_0x9aa9('0x94')](_0x313f05);}else{if(!_0x1d07c3[_0x9aa9('0x8a')]['id'])_0x1d07c3[_0x9aa9('0x8a')]['id']=[];_0xcae951[_0x8a95e8][_0x9aa9('0x8')]['forEach'](function(_0x460dfe){_0x1d07c3[_0x9aa9('0x8a')]['id'][_0x9aa9('0x94')](_0x460dfe);});}}}if(!_[_0x9aa9('0x93')](_0x362c97)){_0x1d07c3[_0x9aa9('0x8a')]=_['merge'](_0x1d07c3['where'],{'$and':{'$or':_0x362c97}});}_0x1d07c3=_['merge']({},_0x1d07c3,_0x1cb5ee[_0x9aa9('0xac')]);if(_0x1621f7&&!_0x1621f7[_0x9aa9('0x9b')]&&_0x501057[_0x9aa9('0x14')]===_0x9aa9('0xe')){if(_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xad')]){_0x1d07c3[_0x9aa9('0xae')]=[{'all':!![]}];}return _0x18df8e[_0x501057[_0x9aa9('0x14')]][_0x9aa9('0x6')](_0x1d07c3)[_0x9aa9('0x7')](function(_0x12086e){var _0xac8a11=[];_0x12086e['forEach'](function(_0x368582){var _0x298e7e;switch(_0x368582['reportType']){case _0x9aa9('0xaf'):_0x298e7e=_[_0x9aa9('0x99')](_0x1621f7[_0x9aa9('0x8')],function(_0x49f489){return _0x49f489['id']===_0x368582[_0x9aa9('0x7b')]&&_0x49f489[_0x9aa9('0x10')]==='DefaultReports';});break;case _0x9aa9('0xb0'):_0x298e7e=_['find'](_0x1621f7[_0x9aa9('0x8')],function(_0x4c0667){return _0x4c0667['id']===_0x368582[_0x9aa9('0x7b')]&&_0x4c0667[_0x9aa9('0x10')]==='CustomReports';});break;}if(_0x298e7e)_0xac8a11[_0x9aa9('0x94')](_0x368582);});_0x579785[_0x9aa9('0xb1')]=_0xac8a11[_0x9aa9('0x98')];_0x579785[_0x9aa9('0xb2')]=_0xac8a11;return _0x579785;});}else{if(!_[_0x9aa9('0x93')](_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb3')])){_0x1d07c3['where']['id']=_0x1d07c3[_0x9aa9('0x8a')]['id']?_[_0x9aa9('0x9e')](_0x1d07c3[_0x9aa9('0x8a')]['id'],_0x1cb5ee[_0x9aa9('0x8b')]['ids']):_0x1cb5ee[_0x9aa9('0x8b')]['ids'];if(_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb4')]){_0x1d07c3['order']=_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb4')];}}if(_0x1cb5ee[_0x9aa9('0x8b')]['extraQueryConditions']){_0x1d07c3['where']=_[_0x9aa9('0xa8')](_0x1d07c3[_0x9aa9('0x8a')],{'$and':_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb5')]});}return _0x18df8e[_0x501057[_0x9aa9('0x14')]][_0x9aa9('0xb1')]({'where':_0x1d07c3[_0x9aa9('0x8a')]})[_0x9aa9('0x7')](function(_0x44400d){_0x579785['count']=_0x44400d;if(_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xad')]){if(_0x501057[_0x9aa9('0x14')]==='CmContact'){_0x1d07c3[_0x9aa9('0xae')]=[{'model':_0x18df8e[_0x9aa9('0x6f')],'as':_0x9aa9('0xb6'),'attributes':['id',_0x9aa9('0x19'),_0x9aa9('0xb7')],'required':_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb8')]?!![]:![]},{'model':_0x18df8e['Tag'],'as':_0x9aa9('0xb9'),'attributes':['id',_0x9aa9('0x19'),_0x9aa9('0xb7')],'through':_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb8')]?{'attributes':[],'where':{'TagId':_0x1cb5ee['query'][_0x9aa9('0xb8')]||undefined}}:{},'required':_0x1cb5ee[_0x9aa9('0x8b')][_0x9aa9('0xb8')]?!![]:![]}];}else{_0x1d07c3[_0x9aa9('0xae')]=[{'all':!![]}];}}return _0x18df8e[_0x501057[_0x9aa9('0x14')]]['findAll'](_0x1d07c3);})[_0x9aa9('0x7')](function(_0x4aedfc){_0x579785['rows']=_0x4aedfc;if(_0x29f5d5==='Agents'&&_0x1cb5ee['query'][_0x9aa9('0xba')]===_0x9aa9('0xbb')){var _0x2a643b=[];for(var _0x5ab123=0x0;_0x5ab123<_0x579785[_0x9aa9('0xb2')][_0x9aa9('0x98')];_0x5ab123++){_0x2a643b['push'](_0x1140af('chat',_0x579785['rows'][_0x5ab123][_0x9aa9('0xbc')]));_0x2a643b[_0x9aa9('0x94')](_0x1140af('sms',_0x579785[_0x9aa9('0xb2')][_0x5ab123][_0x9aa9('0xbc')]));_0x2a643b['push'](_0x1140af(_0x9aa9('0xbd'),_0x579785[_0x9aa9('0xb2')][_0x5ab123][_0x9aa9('0xbc')]));_0x2a643b[_0x9aa9('0x94')](_0x1140af(_0x9aa9('0xbe'),_0x579785[_0x9aa9('0xb2')][_0x5ab123][_0x9aa9('0xbc')]));_0x2a643b[_0x9aa9('0x94')](_0x1140af(_0x9aa9('0xbf'),_0x579785[_0x9aa9('0xb2')][_0x5ab123][_0x9aa9('0xbc')]));_0x2a643b[_0x9aa9('0x94')](_0x1140af('whatsapp',_0x579785[_0x9aa9('0xb2')][_0x5ab123][_0x9aa9('0xbc')]));}return Promise['all'](_0x2a643b)[_0x9aa9('0x7')](function(){return _0x579785;});}return _0x579785;});}});}}});}; \ No newline at end of file +var _0x9d7b=['Team','voicequeues','queuecampaigns','QueueCampaigns','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','charAt','slice','Sequelize','QueryTypes','select','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','find','params','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','length','attributes','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','openTabs','dataValues','sms','mail','openchannel','whatsapp','all','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','contacts','ListId','CmList','companies','globalcustomfields','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','VoiceContext','VoiceMail','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','inbound','queue','VoiceQueue','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams'];(function(_0x421d1f,_0x103891){var _0x4228bf=function(_0x4e30fc){while(--_0x4e30fc){_0x421d1f['push'](_0x421d1f['shift']());}};_0x4228bf(++_0x103891);}(_0x9d7b,0x6d));var _0xb9d7=function(_0x22423,_0x26bfb5){_0x22423=_0x22423-0x0;var _0x13989f=_0x9d7b[_0x22423];return _0x13989f;};'use strict';var _=require(_0xb9d7('0x0'));var attributes=require(_0xb9d7('0x1'));var squel=require(_0xb9d7('0x2'));module['exports']=function(_0x1c112a){var _0x240010=_0x1c112a[_0xb9d7('0x3')];function _0x2984e4(_0xfefe7e,_0x34e1d3){return new Promise(function(_0xbc92ac,_0x2f934e){if(!_0x34e1d3)return _0xbc92ac(null);var _0x2ade5b=_0x34e1d3[_0xb9d7('0x4')]?{[_0x34e1d3[_0xb9d7('0x4')][_0xb9d7('0x5')]]:_0x34e1d3[_0xb9d7('0x4')][_0xb9d7('0x6')]}:undefined;return _0x240010[_0xfefe7e][_0xb9d7('0x7')]({'where':_0x2ade5b,'raw':!![]})[_0xb9d7('0x8')](function(_0xcf3b3c){_0x34e1d3[_0xb9d7('0x9')]=_[_0xb9d7('0xa')](_0xcf3b3c,'id');_0xbc92ac(_0x34e1d3);})[_0xb9d7('0xb')](function(_0x2538f3){_0x2f934e(_0x2538f3);});});}function _0x5396cf(_0x4ef78d,_0x4b8ecd){return new Promise(function(_0x28f6df,_0x367eab){var _0x1731bf=_0x4ef78d[_0xb9d7('0x4')]?{[_0x4ef78d[_0xb9d7('0x4')][_0xb9d7('0x5')]]:_0x4ef78d[_0xb9d7('0x4')][_0xb9d7('0x6')]}:undefined;return _0x240010[_0x4ef78d[_0xb9d7('0xc')]][_0xb9d7('0x7')]({'where':_0x1731bf,'raw':!![]})[_0xb9d7('0x8')](function(_0x291e11){_0x4b8ecd[_0xb9d7('0x9')]=_[_0xb9d7('0xa')](_0x291e11,function(_0x2601ce){return _0x2601ce[_0xb9d7('0xd')];});_0x28f6df(_0x4b8ecd);})[_0xb9d7('0xb')](function(_0x4771ad){_0x367eab(_0x4771ad);});});}function _0x49f428(_0x4c738d,_0x47f7be,_0x283518){if(!_0x47f7be)return Promise[_0xb9d7('0xe')](null);return new Promise(function(_0x45a0d9,_0xf4281f){return _0x240010[_0xb9d7('0xf')][_0xb9d7('0x7')]({'where':{'sectionId':_0x47f7be['id']},'raw':!![]})[_0xb9d7('0x8')](function(_0x821ee9){if(_0x4c738d[_0xb9d7('0x5')]&&_0x4c738d[_0xb9d7('0x5')]!=='id'){_0x47f7be[_0xb9d7('0x9')]=_[_0xb9d7('0xa')](_0x821ee9,function(_0xa3ac3a){return _0xa3ac3a[_0x4c738d[_0xb9d7('0x5')]];});}else{if(_0x283518==='AnalyticExtractedReport'){_0x47f7be[_0xb9d7('0x9')]=_[_0xb9d7('0xa')](_0x821ee9,function(_0x297618){return{'id':_0x297618[_0xb9d7('0x10')],'type':_0x297618[_0xb9d7('0x11')]};});}else{_0x47f7be[_0xb9d7('0x9')]=_[_0xb9d7('0xa')](_0x821ee9,function(_0x1c9372){return _0x1c9372[_0xb9d7('0x10')];});}}_0x45a0d9(_0x47f7be);})[_0xb9d7('0xb')](function(_0x181d2a){_0xf4281f(_0x181d2a);});});}function _0x34982e(_0x58fea5,_0x5c668d){var _0x51481b={'parentSections':[]};switch(_0x58fea5[_0xb9d7('0x12')]()){case _0xb9d7('0x13'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x15');break;case _0xb9d7('0x16'):_0x51481b['childModel']=_0xb9d7('0x17');break;case _0xb9d7('0x18'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x19');_0x51481b[_0xb9d7('0x1a')]=[{'name':_0xb9d7('0x1b'),'field':_0xb9d7('0xd'),'foreignKey':'projectName'}];break;case'projects':_0x51481b['childModel']='JscriptyProject';break;case _0xb9d7('0x1c'):_0x51481b[_0xb9d7('0x14')]='CmContact';_0x51481b['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xb9d7('0x1d')}];break;case'lists':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x1e');break;case _0xb9d7('0x1f'):_0x51481b[_0xb9d7('0x14')]='CmCompany';break;case _0xb9d7('0x20'):_0x51481b[_0xb9d7('0x14')]='CmCustomField';break;case'chatqueues':_0x51481b[_0xb9d7('0x14')]='ChatQueue';break;case _0xb9d7('0x21'):_0x51481b['childModel']=_0xb9d7('0x22');break;case _0xb9d7('0x23'):_0x51481b[_0xb9d7('0x14')]='FaxQueue';break;case _0xb9d7('0x24'):_0x51481b['childModel']=_0xb9d7('0x25');break;case'inboundroutes':case _0xb9d7('0x26'):case'outboundroutes':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x27');break;case'contexts':_0x51481b['childModel']=_0xb9d7('0x28');break;case'voicemails':_0x51481b['childModel']=_0xb9d7('0x29');break;case'voicerecordings':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x2a');_0x51481b['parentSections']=[{'name':_0xb9d7('0x2b'),'field':_0xb9d7('0xd'),'foreignKey':'membername','model':_0xb9d7('0x2c'),'filter':{'field':_0xb9d7('0x2d'),'value':[_0xb9d7('0x2e')]}},{'name':_0xb9d7('0x2f'),'field':'name','foreignKey':_0xb9d7('0x30'),'model':_0xb9d7('0x2c'),'filter':{'field':_0xb9d7('0x2d'),'value':[_0xb9d7('0x31')]}},{'name':_0xb9d7('0x32'),'field':_0xb9d7('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xb9d7('0x11'),'value':[_0xb9d7('0x33')]}},{'name':'QueueCampaigns','field':_0xb9d7('0xd'),'foreignKey':_0xb9d7('0x34'),'model':_0xb9d7('0x35'),'filter':{'field':_0xb9d7('0x11'),'value':[_0xb9d7('0x36')]}}];break;case _0xb9d7('0x37'):_0x51481b['childModel']='VoiceMusicOnHold';break;case _0xb9d7('0x38'):_0x51481b['childModel']=_0xb9d7('0x39');break;case'voiceprefixes':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x3a');break;case _0xb9d7('0x3b'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x3c');break;case'mailqueues':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x3d');break;case _0xb9d7('0x3e'):_0x51481b['childModel']=_0xb9d7('0x3f');break;case _0xb9d7('0x40'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x41');break;case _0xb9d7('0x42'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x43');break;case _0xb9d7('0x44'):_0x51481b['childModel']=_0xb9d7('0x45');break;case _0xb9d7('0x46'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x47');break;case _0xb9d7('0x48'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x49');break;case _0xb9d7('0x4a'):_0x51481b[_0xb9d7('0x14')]='WhatsappQueue';break;case _0xb9d7('0x4b'):_0x51481b['childModel']=_0xb9d7('0x4c');break;case _0xb9d7('0x4d'):_0x51481b['childModel']=_0xb9d7('0x4e');break;case _0xb9d7('0x4f'):case _0xb9d7('0x50'):_0x51481b['childModel']=_0xb9d7('0x35');if(_0x5c668d){_0x51481b['parentSections']=[{'name':_0xb9d7('0x32')},{'name':_0xb9d7('0x51')}];}break;case'users':case _0xb9d7('0x52'):case _0xb9d7('0x53'):_0x51481b[_0xb9d7('0x14')]='User';if(_0x5c668d){_0x51481b[_0xb9d7('0x1a')]=[{'name':_0xb9d7('0x54'),'filter':{'field':'role','value':['admin',_0xb9d7('0x55')]},'ignore':!![]},{'name':_0xb9d7('0x2b')},{'name':_0xb9d7('0x2f')}];}break;case _0xb9d7('0x56'):_0x51481b['childModel']=_0xb9d7('0x57');break;case'salesforceaccounts':_0x51481b[_0xb9d7('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x58');break;case _0xb9d7('0x59'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x5a');break;case _0xb9d7('0x5b'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x5c');break;case'zohoaccounts':_0x51481b['childModel']=_0xb9d7('0x5d');break;case _0xb9d7('0x5e'):_0x51481b['childModel']=_0xb9d7('0x2c');break;case _0xb9d7('0x5f'):_0x51481b['childModel']=_0xb9d7('0x60');break;case _0xb9d7('0x61'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x62');break;case _0xb9d7('0x63'):_0x51481b['childModel']='Dashboard';break;case _0xb9d7('0x64'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x65');break;case _0xb9d7('0x66'):_0x51481b[_0xb9d7('0x14')]='Pause';break;case'scheduler':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x67');break;case _0xb9d7('0x68'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x69');break;case _0xb9d7('0x6a'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x6b');break;case _0xb9d7('0x6c'):_0x51481b['childModel']=_0xb9d7('0x6d');break;case'triggers':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x6e');break;case'trunks':_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x6f');break;case _0xb9d7('0x70'):_0x51481b['childModel']='Variable';break;case _0xb9d7('0x71'):_0x51481b['childModel']=_0xb9d7('0x72');break;case _0xb9d7('0x73'):_0x51481b[_0xb9d7('0x14')]=_0xb9d7('0x74');_0x51481b['parentSections']=[{'name':_0xb9d7('0x75'),'field':'id','foreignKey':_0xb9d7('0x76')}];break;case _0xb9d7('0x77'):_0x51481b['childModel']='AnalyticMetric';break;}return _0x51481b;}function _0x142fff(_0x18ae30,_0x5e9270){var _0x47a85c=_0x18ae30[_0xb9d7('0x78')](0x0)['toUpperCase']()+_0x18ae30[_0xb9d7('0x79')](0x1);var _0x48acf0={'type':_0x240010[_0xb9d7('0x7a')][_0xb9d7('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x41c58b,_0x3fe4b2){var _0x4dbc79=squel[_0xb9d7('0x7c')]()[_0xb9d7('0x5')]('ui.'+_0x47a85c+_0xb9d7('0x7d'),'id')[_0xb9d7('0x5')]('ui.createdAt')[_0xb9d7('0x7e')](_0xb9d7('0x7f')+_0x18ae30+_0xb9d7('0x80'),'ui')[_0xb9d7('0x81')](_0xb9d7('0x82'),_0x5e9270['id']);return _0x240010[_0xb9d7('0x83')][_0xb9d7('0x84')](_0x4dbc79['toString'](),_0x48acf0)[_0xb9d7('0x8')](function(_0x4cdd1b){_0x5e9270[_0x47a85c+_0xb9d7('0x85')]=_0x4cdd1b;_0x41c58b(_0x4cdd1b);})[_0xb9d7('0xb')](function(_0x3696a6){_0x3fe4b2(_0x3696a6);});});}return _0x1c112a['define']('UserProfile',attributes,{'tableName':_0xb9d7('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x36bca1){var _0x2df46e=require('../../components/parsers/qs');var _0x43758a={'raw':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x87')],'where':{}};var _0x4e826c={};var _0x4a0a54={'count':0x0,'rows':[]};var _0x5e6952=_0x36bca1['query'][_0xb9d7('0x88')];var _0x3b7ce5=_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x89')]||![];var _0x22a7b1=_0x34982e(_0x5e6952,_0x3b7ce5);if(!_0x22a7b1[_0xb9d7('0x14')])throw new Error(_0xb9d7('0x8a')+_0x5e6952+'\x27');var _0x1eb26c=[{'name':_0x5e6952}];if(!_[_0xb9d7('0x8b')](_0x22a7b1[_0xb9d7('0x1a')]))_0x1eb26c=_0x22a7b1[_0xb9d7('0x1a')];var _0xe9d2b2=[];for(var _0x2caf85=0x0;_0x2caf85<_0x1eb26c['length'];_0x2caf85++){_0xe9d2b2[_0xb9d7('0x8c')](_0x240010['UserProfileSection'][_0xb9d7('0x8d')]({'where':{'userProfileId':_0x36bca1[_0xb9d7('0x8e')]['id'],'name':_0x1eb26c[_0x2caf85][_0xb9d7('0xd')]},'raw':!![]}));}return Promise['all'](_0xe9d2b2)[_0xb9d7('0x8')](function(_0x5bb700){var _0x3d8c57=_['filter'](_0x5bb700,function(_0x527973){return _0x527973?_0x527973:undefined;});var _0x7e90cf=_[_0xb9d7('0x4')](_0x1eb26c,[_0xb9d7('0x8f'),!![]]);var _0x429a07=_[_0xb9d7('0x8b')](_0x3d8c57)&&_['isEmpty'](_0x7e90cf)?null:_[_0xb9d7('0x90')](_0x7e90cf,_0x3d8c57);if(!_0x429a07)return null;var _0x1e63ef=[];for(var _0x5bdf24=0x0;_0x5bdf24<_0x429a07['length'];_0x5bdf24++){var _0x47cbc3=_[_0xb9d7('0x8d')](_0x1eb26c,function(_0x4b727f){return _0x429a07[_0x5bdf24]?_0x4b727f['name']===_0x429a07[_0x5bdf24][_0xb9d7('0xd')]:null;});if(_0x47cbc3){if(_0x429a07[_0x5bdf24]['ignore']){_0x1e63ef[_0xb9d7('0x8c')](_0x2984e4(_0x22a7b1[_0xb9d7('0x14')],_0x429a07[_0x5bdf24]));}else{if(!_0x429a07[_0x5bdf24][_0xb9d7('0x91')]){_0x1e63ef['push'](_0x49f428(_0x47cbc3,_0x429a07[_0x5bdf24],_0x22a7b1[_0xb9d7('0x14')]));}else{if(_0x47cbc3['model']){_0x1e63ef[_0xb9d7('0x8c')](_0x5396cf(_0x47cbc3,_0x429a07[_0x5bdf24]));}}}}}return Promise['all'](_0x1e63ef);})[_0xb9d7('0x8')](function(_0xc8afa){var _0x4ade13=_0xc8afa;var _0xd63977=null;if(_0x4ade13){_0xd63977=_0x4ade13['length']===0x1?_0x4ade13[0x0]:null;}if(!_0xd63977&&!_0x4ade13)return _0x4a0a54;var _0x149206=_0x240010[_0x22a7b1[_0xb9d7('0x14')]][_0xb9d7('0x92')];_0x4e826c[_0xb9d7('0xc')]=_['keys'](_0x149206);_0x4e826c[_0xb9d7('0x84')]=_[_0xb9d7('0x93')](_0x36bca1[_0xb9d7('0x84')]);_0x4e826c[_0xb9d7('0x94')]=_[_0xb9d7('0x95')](_0x4e826c['model'],_0x4e826c[_0xb9d7('0x84')]);_0x43758a['attributes']=_['intersection'](_0x4e826c[_0xb9d7('0xc')],_0x2df46e[_0xb9d7('0x96')](_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x96')]));_0x43758a['attributes']=_0x43758a['attributes'][_0xb9d7('0x97')]?_0x43758a[_0xb9d7('0x98')]:_0x4e826c[_0xb9d7('0xc')];if(!_0x36bca1[_0xb9d7('0x84')]['hasOwnProperty'](_0xb9d7('0x99'))){_0x43758a['limit']=_0x2df46e[_0xb9d7('0x9a')](_0x36bca1[_0xb9d7('0x84')]['limit']);_0x43758a[_0xb9d7('0x9b')]=_0x2df46e[_0xb9d7('0x9b')](_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x9b')]);}_0x43758a[_0xb9d7('0x9c')]=_0x2df46e['sort'](_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x9d')]);_0x43758a[_0xb9d7('0x81')]=_0x2df46e['filters'](_[_0xb9d7('0x9e')](_0x36bca1['query'],_0x4e826c[_0xb9d7('0x94')]));if(_0x36bca1['query'][_0xb9d7('0x4')]){_0x43758a['where']=_[_0xb9d7('0x9f')](_0x43758a[_0xb9d7('0x81')],{'$or':_[_0xb9d7('0xa')](_0x149206,function(_0x238fd6){if(_0x238fd6[_0xb9d7('0x11')][_0xb9d7('0xa0')]!==_0xb9d7('0xa1')){var _0xe3e33d={};_0xe3e33d[_0x238fd6[_0xb9d7('0x5')]]={'$like':'%'+_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0x4')]+'%'};return _0xe3e33d;}})});}var _0x194e55=[];var _0xc008fc=null;var _0x38348c={};if(_0xd63977){_0xc008fc=_[_0xb9d7('0x8d')](_0x1eb26c,[_0xb9d7('0xd'),_0xd63977[_0xb9d7('0xd')]]);if(_0xc008fc[_0xb9d7('0x5')]){_0x38348c={};if(_0x22a7b1[_0xb9d7('0x14')]===_0xb9d7('0x74')){_0x38348c[_0xc008fc[_0xb9d7('0xa2')]]=_[_0xb9d7('0xa')](_0xd63977[_0xb9d7('0x9')],'id');}else{_0x38348c[_0xc008fc[_0xb9d7('0xa2')]]=_0xd63977[_0xb9d7('0x9')];}_0x194e55['push'](_0x38348c);}else{_0x43758a[_0xb9d7('0x81')]['id']=_0xd63977['associatedResources'];}}else{for(var _0x456de7=0x0;_0x456de7<_0x4ade13['length'];_0x456de7++){_0xc008fc=_[_0xb9d7('0x8d')](_0x1eb26c,[_0xb9d7('0xd'),_0x4ade13[_0x456de7][_0xb9d7('0xd')]]);if(_0xc008fc['field']){_0x38348c={};_0x38348c[_0xc008fc[_0xb9d7('0xa2')]]=_0x4ade13[_0x456de7][_0xb9d7('0x9')];_0x194e55[_0xb9d7('0x8c')](_0x38348c);}else{if(!_0x43758a[_0xb9d7('0x81')]['id'])_0x43758a[_0xb9d7('0x81')]['id']=[];_0x4ade13[_0x456de7][_0xb9d7('0x9')][_0xb9d7('0xa3')](function(_0x28d4d5){_0x43758a[_0xb9d7('0x81')]['id']['push'](_0x28d4d5);});}}}if(!_[_0xb9d7('0x8b')](_0x194e55)){_0x43758a['where']=_[_0xb9d7('0x9f')](_0x43758a[_0xb9d7('0x81')],{'$and':{'$or':_0x194e55}});}_0x43758a=_[_0xb9d7('0x9f')]({},_0x43758a,_0x36bca1['options']);if(_0xd63977&&!_0xd63977['autoAssociation']&&_0x22a7b1[_0xb9d7('0x14')]===_0xb9d7('0x74')){if(_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xa4')]){_0x43758a[_0xb9d7('0xa5')]=[{'all':!![]}];}return _0x240010[_0x22a7b1[_0xb9d7('0x14')]][_0xb9d7('0x7')](_0x43758a)[_0xb9d7('0x8')](function(_0x340413){var _0x3c3ea4=[];_0x340413[_0xb9d7('0xa3')](function(_0x3b2ca3){var _0x55175d;switch(_0x3b2ca3[_0xb9d7('0xa6')]){case _0xb9d7('0xa7'):_0x55175d=_[_0xb9d7('0x8d')](_0xd63977[_0xb9d7('0x9')],function(_0x527f66){return _0x527f66['id']===_0x3b2ca3[_0xb9d7('0x76')]&&_0x527f66[_0xb9d7('0x11')]===_0xb9d7('0xa8');});break;case _0xb9d7('0xa9'):_0x55175d=_[_0xb9d7('0x8d')](_0xd63977[_0xb9d7('0x9')],function(_0x582eeb){return _0x582eeb['id']===_0x3b2ca3[_0xb9d7('0x76')]&&_0x582eeb[_0xb9d7('0x11')]===_0xb9d7('0xaa');});break;}if(_0x55175d)_0x3c3ea4[_0xb9d7('0x8c')](_0x3b2ca3);});_0x4a0a54['count']=_0x3c3ea4[_0xb9d7('0x97')];_0x4a0a54[_0xb9d7('0xab')]=_0x3c3ea4;return _0x4a0a54;});}else{if(!_['isEmpty'](_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xac')])){_0x43758a[_0xb9d7('0x81')]['id']=_0x43758a[_0xb9d7('0x81')]['id']?_[_0xb9d7('0x95')](_0x43758a['where']['id'],_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xac')]):_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xac')];if(_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xad')]){_0x43758a['order']=_0x36bca1['query'][_0xb9d7('0xad')];}}if(_0x36bca1['query'][_0xb9d7('0xae')]){_0x43758a[_0xb9d7('0x81')]=_[_0xb9d7('0x9f')](_0x43758a[_0xb9d7('0x81')],{'$and':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xae')]});}return _0x240010[_0x22a7b1[_0xb9d7('0x14')]]['count']({'where':_0x43758a[_0xb9d7('0x81')]})[_0xb9d7('0x8')](function(_0x291dbf){_0x4a0a54['count']=_0x291dbf;if(_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xa4')]){if(_0x22a7b1[_0xb9d7('0x14')]===_0xb9d7('0xaf')){_0x43758a[_0xb9d7('0xa5')]=[{'model':_0x240010[_0xb9d7('0x6b')],'as':_0xb9d7('0xb0'),'attributes':['id',_0xb9d7('0xd'),_0xb9d7('0xb1')],'required':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xb2')]?!![]:![]},{'model':_0x240010['Tag'],'as':_0xb9d7('0xb3'),'attributes':['id',_0xb9d7('0xd'),_0xb9d7('0xb1')],'through':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xb2')]?{'attributes':[],'where':{'TagId':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xb2')]||undefined}}:{},'required':_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xb2')]?!![]:![]}];}else{_0x43758a[_0xb9d7('0xa5')]=[{'all':!![]}];}}return _0x240010[_0x22a7b1[_0xb9d7('0x14')]][_0xb9d7('0x7')](_0x43758a);})[_0xb9d7('0x8')](function(_0x34c85e){_0x4a0a54[_0xb9d7('0xab')]=_0x34c85e;if(_0x5e6952===_0xb9d7('0x2b')&&_0x36bca1[_0xb9d7('0x84')][_0xb9d7('0xb4')]==='true'){var _0x2548a4=[];for(var _0x292cf4=0x0;_0x292cf4<_0x4a0a54['rows'][_0xb9d7('0x97')];_0x292cf4++){_0x2548a4[_0xb9d7('0x8c')](_0x142fff('chat',_0x4a0a54[_0xb9d7('0xab')][_0x292cf4][_0xb9d7('0xb5')]));_0x2548a4[_0xb9d7('0x8c')](_0x142fff(_0xb9d7('0xb6'),_0x4a0a54[_0xb9d7('0xab')][_0x292cf4][_0xb9d7('0xb5')]));_0x2548a4[_0xb9d7('0x8c')](_0x142fff('fax',_0x4a0a54['rows'][_0x292cf4][_0xb9d7('0xb5')]));_0x2548a4[_0xb9d7('0x8c')](_0x142fff(_0xb9d7('0xb7'),_0x4a0a54[_0xb9d7('0xab')][_0x292cf4]['dataValues']));_0x2548a4[_0xb9d7('0x8c')](_0x142fff(_0xb9d7('0xb8'),_0x4a0a54['rows'][_0x292cf4]['dataValues']));_0x2548a4['push'](_0x142fff(_0xb9d7('0xb9'),_0x4a0a54[_0xb9d7('0xab')][_0x292cf4][_0xb9d7('0xb5')]));}return Promise[_0xb9d7('0xba')](_0x2548a4)[_0xb9d7('0x8')](function(){return _0x4a0a54;});}return _0x4a0a54;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 331c7b7..3537718 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 _0x13c5=['request\x20sent','result','lodash','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x187b9f,_0x7f124f){var _0x3b98a6=function(_0x56a70b){while(--_0x56a70b){_0x187b9f['push'](_0x187b9f['shift']());}};_0x3b98a6(++_0x7f124f);}(_0x13c5,0x7a));var _0x513c=function(_0x5b8a54,_0x558166){_0x5b8a54=_0x5b8a54-0x0;var _0x3aed60=_0x13c5[_0x5b8a54];return _0x3aed60;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x513c('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x513c('0x2'));var jayson=require(_0x513c('0x3'));var client=jayson[_0x513c('0x4')][_0x513c('0x5')]({'port':0x232a});config['redis']=_['defaults'](config[_0x513c('0x6')],{'host':_0x513c('0x7'),'port':0x18eb});var socket=require(_0x513c('0x8'))(new Redis(config[_0x513c('0x6')]));require(_0x513c('0x9'))[_0x513c('0xa')](socket);function respondWithRpcPromise(_0x222c25,_0x18471d,_0x4adc04){return new BPromise(function(_0xd70448,_0x224eb2){return client['request'](_0x222c25,_0x4adc04)['then'](function(_0x798eed){logger[_0x513c('0xb')]('UserProfile,\x20%s,\x20%s',_0x18471d,'request\x20sent');logger['debug'](_0x513c('0xc'),_0x18471d,'request\x20sent',JSON[_0x513c('0xd')](_0x798eed));if(_0x798eed[_0x513c('0xe')]){if(_0x798eed['error'][_0x513c('0xf')]===0x1f4){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0x224eb2(_0x798eed['error'][_0x513c('0x11')]);}logger['error'](_0x513c('0x10'),_0x18471d,_0x798eed[_0x513c('0xe')][_0x513c('0x11')]);return _0xd70448(_0x798eed[_0x513c('0xe')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x18471d,_0x513c('0x12'));_0xd70448(_0x798eed[_0x513c('0x13')]['message']);}})['catch'](function(_0x217e7a){logger[_0x513c('0xe')](_0x513c('0x10'),_0x18471d,_0x217e7a);_0x224eb2(_0x217e7a);});});} \ No newline at end of file +var _0x6455=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41d721,_0x59079f){var _0x2ca250=function(_0x55e4a4){while(--_0x55e4a4){_0x41d721['push'](_0x41d721['shift']());}};_0x2ca250(++_0x59079f);}(_0x6455,0x97));var _0x5645=function(_0x4f2503,_0x3c8d8c){_0x4f2503=_0x4f2503-0x0;var _0x8575fa=_0x6455[_0x4f2503];return _0x8575fa;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});config[_0x5645('0xc')]=_[_0x5645('0xd')](config[_0x5645('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5645('0xc')]));require(_0x5645('0xe'))[_0x5645('0xf')](socket);function respondWithRpcPromise(_0x34fe4e,_0x7f9893,_0x16af81){return new BPromise(function(_0x587c61,_0x212e46){return client[_0x5645('0x10')](_0x34fe4e,_0x16af81)[_0x5645('0x11')](function(_0x21e32c){logger['info'](_0x5645('0x12'),_0x7f9893,'request\x20sent');logger[_0x5645('0x13')](_0x5645('0x14'),_0x7f9893,_0x5645('0x15'),JSON[_0x5645('0x16')](_0x21e32c));if(_0x21e32c[_0x5645('0x17')]){if(_0x21e32c[_0x5645('0x17')][_0x5645('0x18')]===0x1f4){logger[_0x5645('0x17')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);return _0x212e46(_0x21e32c[_0x5645('0x17')]['message']);}logger['error'](_0x5645('0x12'),_0x7f9893,_0x21e32c[_0x5645('0x17')]['message']);return _0x587c61(_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);}else{logger[_0x5645('0x1a')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x5645('0x15'));_0x587c61(_0x21e32c[_0x5645('0x1b')][_0x5645('0x19')]);}})[_0x5645('0x1c')](function(_0x5ac9ee){logger[_0x5645('0x17')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x5ac9ee);_0x212e46(_0x5ac9ee);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ec77f12..8f6ecb2 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 _0x06b9=['register','length','userProfile:','./userProfile.events','save','remove','removeListener'];(function(_0x23100d,_0xf8c4ba){var _0x2d7683=function(_0x17fd62){while(--_0x17fd62){_0x23100d['push'](_0x23100d['shift']());}};_0x2d7683(++_0xf8c4ba);}(_0x06b9,0xb2));var _0x906b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06b9[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0x906b('0x0'));var events=[_0x906b('0x1'),_0x906b('0x2'),'update'];function createListener(_0x135ddb,_0x32f782){return function(_0x34bdbe){_0x32f782['emit'](_0x135ddb,_0x34bdbe);};}function removeListener(_0x18fcf1,_0x19cb69){return function(){UserProfileEvents[_0x906b('0x3')](_0x18fcf1,_0x19cb69);};}exports[_0x906b('0x4')]=function(_0xb4c7db){for(var _0x22599a=0x0,_0x2c7dee=events[_0x906b('0x5')];_0x22599a<_0x2c7dee;_0x22599a++){var _0x2d8de4=events[_0x22599a];var _0x575344=createListener(_0x906b('0x6')+_0x2d8de4,_0xb4c7db);UserProfileEvents['on'](_0x2d8de4,_0x575344);}}; \ No newline at end of file +var _0xecc9=['save','remove','update','emit','removeListener','register','length','userProfile:'];(function(_0x2cea8a,_0x18d3c2){var _0x343207=function(_0x4c4888){while(--_0x4c4888){_0x2cea8a['push'](_0x2cea8a['shift']());}};_0x343207(++_0x18d3c2);}(_0xecc9,0x100));var _0x9ecc=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0xecc9[_0x1f44e4];return _0x591989;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x9ecc('0x0'),_0x9ecc('0x1'),_0x9ecc('0x2')];function createListener(_0x1aa2c8,_0x129e95){return function(_0x3ce44b){_0x129e95[_0x9ecc('0x3')](_0x1aa2c8,_0x3ce44b);};}function removeListener(_0x5b2343,_0x14efce){return function(){UserProfileEvents[_0x9ecc('0x4')](_0x5b2343,_0x14efce);};}exports[_0x9ecc('0x5')]=function(_0x75af74){for(var _0x18d954=0x0,_0x3468bf=events[_0x9ecc('0x6')];_0x18d954<_0x3468bf;_0x18d954++){var _0x4665bc=events[_0x18d954];var _0x424cd3=createListener(_0x9ecc('0x7')+_0x4665bc,_0x75af74);UserProfileEvents['on'](_0x4665bc,_0x424cd3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5d2952f..94c33c8 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 _0x8af1=['post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x4ff544,_0x1fbc52){var _0x3c4e6a=function(_0x117e31){while(--_0x117e31){_0x4ff544['push'](_0x4ff544['shift']());}};_0x3c4e6a(++_0x1fbc52);}(_0x8af1,0xee));var _0x18af=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x8af1[_0x43b584];return _0x48f27b;};'use strict';var multer=require(_0x18af('0x0'));var util=require(_0x18af('0x1'));var path=require(_0x18af('0x2'));var timeout=require(_0x18af('0x3'));var express=require(_0x18af('0x4'));var router=express[_0x18af('0x5')]();var fs_extra=require(_0x18af('0x6'));var auth=require(_0x18af('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x18af('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x18af('0x9')](),controller[_0x18af('0xa')]);router[_0x18af('0xb')](_0x18af('0xc'),auth[_0x18af('0x9')](),controller[_0x18af('0xd')]);router[_0x18af('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x18af('0xe')]('/',auth['isAuthenticated'](),controller[_0x18af('0xf')]);router[_0x18af('0x10')](_0x18af('0x11'),auth[_0x18af('0x9')](),controller['update']);router[_0x18af('0x12')](_0x18af('0x11'),auth['isAuthenticated'](),controller[_0x18af('0x13')]);module[_0x18af('0x14')]=router; \ No newline at end of file +var _0x8e41=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x5ab0f2,_0x2cf727){var _0x5e542b=function(_0x33dcfa){while(--_0x33dcfa){_0x5ab0f2['push'](_0x5ab0f2['shift']());}};_0x5e542b(++_0x2cf727);}(_0x8e41,0x184));var _0x18e4=function(_0x55b745,_0x36e0fa){_0x55b745=_0x55b745-0x0;var _0x1772a7=_0x8e41[_0x55b745];return _0x1772a7;};'use strict';var multer=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var path=require(_0x18e4('0x2'));var timeout=require(_0x18e4('0x3'));var express=require(_0x18e4('0x4'));var router=express[_0x18e4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x18e4('0x6'));var interaction=require(_0x18e4('0x7'));var config=require(_0x18e4('0x8'));var controller=require(_0x18e4('0x9'));router[_0x18e4('0xa')]('/',auth[_0x18e4('0xb')](),controller[_0x18e4('0xc')]);router[_0x18e4('0xa')](_0x18e4('0xd'),auth[_0x18e4('0xb')](),controller[_0x18e4('0xe')]);router[_0x18e4('0xa')](_0x18e4('0xf'),auth['isAuthenticated'](),controller[_0x18e4('0x10')]);router[_0x18e4('0x11')]('/',auth[_0x18e4('0xb')](),controller[_0x18e4('0x12')]);router['put']('/:id',auth[_0x18e4('0xb')](),controller[_0x18e4('0x13')]);router[_0x18e4('0x14')](_0x18e4('0xf'),auth[_0x18e4('0xb')](),controller[_0x18e4('0x15')]);module[_0x18e4('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4574e87..924cadd 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 _0xdb82=['STRING','sequelize'];(function(_0x25f009,_0x303e74){var _0x3e9634=function(_0x4cbd22){while(--_0x4cbd22){_0x25f009['push'](_0x25f009['shift']());}};_0x3e9634(++_0x303e74);}(_0xdb82,0x73));var _0x2db8=function(_0x297a71,_0x330736){_0x297a71=_0x297a71-0x0;var _0x471688=_0xdb82[_0x297a71];return _0x471688;};'use strict';var Sequelize=require(_0x2db8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2db8('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x2db8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfadc=['STRING','sequelize','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xfadc,0x1a2));var _0xcfad=function(_0x3dc919,_0x3a56e7){_0x3dc919=_0x3dc919-0x0;var _0x411139=_0xfadc[_0x3dc919];return _0x411139;};'use strict';var Sequelize=require(_0xcfad('0x0'));module[_0xcfad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xcfad('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4e7cd58..39aced5 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 _0x2a07=['index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x5f0ecc,_0x36e3de){_0x5f0ecc=_0x5f0ecc-0x0;var _0x47b0ed=_0x2a07[_0x5f0ecc];return _0x47b0ed;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['UserProfileResource'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['UserProfileResource']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file +var _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x163e4e,_0x44cc89){var _0x4d825c=function(_0x121a24){while(--_0x121a24){_0x163e4e['push'](_0x163e4e['shift']());}};_0x4d825c(++_0x44cc89);}(_0xdb28,0x106));var _0x8db2=function(_0x3f240c,_0x292ea2){_0x3f240c=_0x3f240c-0x0;var _0x92e81=_0xdb28[_0x3f240c];return _0x92e81;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8d58d30..dbf53ba 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 _0xf01b=['bluebird','request-promise','path','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','api','moment'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0xf01b,0x171));var _0xbf01=function(_0x168bf3,_0x1c06ef){_0x168bf3=_0x168bf3-0x0;var _0x207033=_0xf01b[_0x168bf3];return _0x207033;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf01('0x0'))(_0xbf01('0x1'));var moment=require(_0xbf01('0x2'));var BPromise=require(_0xbf01('0x3'));var rp=require(_0xbf01('0x4'));var fs=require('fs');var path=require(_0xbf01('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf01('0x6'));module[_0xbf01('0x7')]=function(_0x4e6ee7,_0x20d3e8){return _0x4e6ee7[_0xbf01('0x8')]('UserProfileResource',attributes,{'tableName':_0xbf01('0x9'),'paranoid':![],'indexes':[{'name':_0xbf01('0xa'),'fields':['resourceId',_0xbf01('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd692=['compositeIndex','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xd692,0x1d5));var _0x2d69=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd692[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d69('0x0'))(_0x2d69('0x1'));var moment=require(_0x2d69('0x2'));var BPromise=require(_0x2d69('0x3'));var rp=require(_0x2d69('0x4'));var fs=require('fs');var path=require(_0x2d69('0x5'));var rimraf=require(_0x2d69('0x6'));var config=require(_0x2d69('0x7'));var attributes=require(_0x2d69('0x8'));module['exports']=function(_0x7aacfe,_0x4be4fb){return _0x7aacfe[_0x2d69('0x9')](_0x2d69('0xa'),attributes,{'tableName':_0x2d69('0xb'),'paranoid':![],'indexes':[{'name':_0x2d69('0xc'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4bcfb78..26136df 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 _0xe027=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x52433d,_0x1e0542){var _0x214402=function(_0x1948d4){while(--_0x1948d4){_0x52433d['push'](_0x52433d['shift']());}};_0x214402(++_0x1e0542);}(_0xe027,0x106));var _0x7e02=function(_0x1fb044,_0x14fbcd){_0x1fb044=_0x1fb044-0x0;var _0x215d9f=_0xe027[_0x1fb044];return _0x215d9f;};'use strict';var _=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var moment=require(_0x7e02('0x2'));var BPromise=require(_0x7e02('0x3'));var rs=require(_0x7e02('0x4'));var fs=require('fs');var Redis=require(_0x7e02('0x5'));var db=require(_0x7e02('0x6'))['db'];var utils=require(_0x7e02('0x7'));var logger=require(_0x7e02('0x8'))(_0x7e02('0x9'));var config=require(_0x7e02('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebeca,_0x10ffc5,_0x53b91c){return new BPromise(function(_0x557349,_0x1533d0){return client['request'](_0x4ebeca,_0x53b91c)[_0x7e02('0xc')](function(_0x135555){logger[_0x7e02('0xd')](_0x7e02('0xe'),_0x10ffc5,_0x7e02('0xf'));logger[_0x7e02('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x10ffc5,_0x7e02('0xf'),JSON['stringify'](_0x135555));if(_0x135555[_0x7e02('0x11')]){if(_0x135555[_0x7e02('0x11')][_0x7e02('0x12')]===0x1f4){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x1533d0(_0x135555['error'][_0x7e02('0x13')]);}logger['error'](_0x7e02('0xe'),_0x10ffc5,_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);return _0x557349(_0x135555[_0x7e02('0x11')][_0x7e02('0x13')]);}else{logger[_0x7e02('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x10ffc5,'request\x20sent');_0x557349(_0x135555['result'][_0x7e02('0x13')]);}})['catch'](function(_0xc9e71c){logger[_0x7e02('0x11')](_0x7e02('0xe'),_0x10ffc5,_0xc9e71c);_0x1533d0(_0xc9e71c);});});} \ No newline at end of file +var _0xfe8f=['../../config/utils','../../config/logger','../../config/environment','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x146578,_0x1556f0){var _0x25bd9a=function(_0x2adb67){while(--_0x2adb67){_0x146578['push'](_0x146578['shift']());}};_0x25bd9a(++_0x1556f0);}(_0xfe8f,0x1d8));var _0xffe8=function(_0x45409b,_0x18e29e){_0x45409b=_0x45409b-0x0;var _0x30815e=_0xfe8f[_0x45409b];return _0x30815e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffe8('0x0'));var BPromise=require(_0xffe8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffe8('0x2'));var db=require(_0xffe8('0x3'))['db'];var utils=require(_0xffe8('0x4'));var logger=require(_0xffe8('0x5'))('rpc');var config=require(_0xffe8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xffe8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1492b4,_0x323a03,_0x1cdbf6){return new BPromise(function(_0x3607b4,_0x319872){return client[_0xffe8('0x8')](_0x1492b4,_0x1cdbf6)['then'](function(_0x487d3d){logger[_0xffe8('0x9')](_0xffe8('0xa'),_0x323a03,_0xffe8('0xb'));logger[_0xffe8('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x323a03,_0xffe8('0xb'),JSON[_0xffe8('0xd')](_0x487d3d));if(_0x487d3d[_0xffe8('0xe')]){if(_0x487d3d[_0xffe8('0xe')]['code']===0x1f4){logger[_0xffe8('0xe')](_0xffe8('0xa'),_0x323a03,_0x487d3d[_0xffe8('0xe')][_0xffe8('0xf')]);return _0x319872(_0x487d3d[_0xffe8('0xe')][_0xffe8('0xf')]);}logger['error'](_0xffe8('0xa'),_0x323a03,_0x487d3d[_0xffe8('0xe')][_0xffe8('0xf')]);return _0x3607b4(_0x487d3d[_0xffe8('0xe')]['message']);}else{logger['info'](_0xffe8('0xa'),_0x323a03,_0xffe8('0xb'));_0x3607b4(_0x487d3d['result'][_0xffe8('0xf')]);}})[_0xffe8('0x10')](function(_0x1e079){logger[_0xffe8('0xe')](_0xffe8('0xa'),_0x323a03,_0x1e079);_0x319872(_0x1e079);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7b797f8..740a412 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 _0x3e10=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','index','get','/describe','describe','/:id','isAuthenticated','post','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x85109b,_0x574528){var _0x503994=function(_0x24d0fa){while(--_0x24d0fa){_0x85109b['push'](_0x85109b['shift']());}};_0x503994(++_0x574528);}(_0x3e10,0x18d));var _0x03e1=function(_0x4add34,_0x4c0489){_0x4add34=_0x4add34-0x0;var _0x1200e4=_0x3e10[_0x4add34];return _0x1200e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x03e1('0x0'));var timeout=require(_0x03e1('0x1'));var express=require(_0x03e1('0x2'));var router=express[_0x03e1('0x3')]();var fs_extra=require(_0x03e1('0x4'));var auth=require(_0x03e1('0x5'));var interaction=require(_0x03e1('0x6'));var config=require('../../config/environment');var controller=require(_0x03e1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x03e1('0x8')]);router[_0x03e1('0x9')](_0x03e1('0xa'),auth['isAuthenticated'](),controller[_0x03e1('0xb')]);router[_0x03e1('0x9')](_0x03e1('0xc'),auth[_0x03e1('0xd')](),controller['show']);router[_0x03e1('0xe')]('/',auth[_0x03e1('0xd')](),controller[_0x03e1('0xf')]);router['put'](_0x03e1('0xc'),auth['isAuthenticated'](),controller[_0x03e1('0x10')]);router[_0x03e1('0x11')](_0x03e1('0xc'),auth[_0x03e1('0xd')](),controller[_0x03e1('0x12')]);module[_0x03e1('0x13')]=router; \ No newline at end of file +var _0x553b=['Router','fs-extra','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x48cd4f,_0x51050e){var _0x391273=function(_0x5c56c6){while(--_0x5c56c6){_0x48cd4f['push'](_0x48cd4f['shift']());}};_0x391273(++_0x51050e);}(_0x553b,0xb0));var _0xb553=function(_0x2916e5,_0x2fb75a){_0x2916e5=_0x2916e5-0x0;var _0x5ce811=_0x553b[_0x2916e5];return _0x5ce811;};'use strict';var multer=require(_0xb553('0x0'));var util=require(_0xb553('0x1'));var path=require('path');var timeout=require(_0xb553('0x2'));var express=require(_0xb553('0x3'));var router=express[_0xb553('0x4')]();var fs_extra=require(_0xb553('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb553('0x6'));router[_0xb553('0x7')]('/',auth[_0xb553('0x8')](),controller[_0xb553('0x9')]);router[_0xb553('0x7')]('/describe',auth[_0xb553('0x8')](),controller[_0xb553('0xa')]);router[_0xb553('0x7')](_0xb553('0xb'),auth[_0xb553('0x8')](),controller['show']);router[_0xb553('0xc')]('/',auth[_0xb553('0x8')](),controller[_0xb553('0xd')]);router['put'](_0xb553('0xb'),auth[_0xb553('0x8')](),controller[_0xb553('0xe')]);router[_0xb553('0xf')](_0xb553('0xb'),auth[_0xb553('0x8')](),controller[_0xb553('0x10')]);module[_0xb553('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 306aaa5..55830ef 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 _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x6f5229,_0x1e9031){var _0x5d2f3d=function(_0x57a8c9){while(--_0x57a8c9){_0x6f5229['push'](_0x6f5229['shift']());}};_0x5d2f3d(++_0x1e9031);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x495629,_0x263b6a){_0x495629=_0x495629-0x0;var _0x4c116a=_0x9ffd[_0x495629];return _0x4c116a;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file +var _0x58a4=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x35fbc3,_0x176326){var _0x4b9bbb=function(_0x547b45){while(--_0x547b45){_0x35fbc3['push'](_0x35fbc3['shift']());}};_0x4b9bbb(++_0x176326);}(_0x58a4,0xbf));var _0x458a=function(_0x2bfc60,_0xa254ab){_0x2bfc60=_0x2bfc60-0x0;var _0x44ea2c=_0x58a4[_0x2bfc60];return _0x44ea2c;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'name':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x458a('0x2')],'set':function(_0x362079){this[_0x458a('0x5')](_0x458a('0x6'),_0x362079?_0x362079[_0x458a('0x7')](''):[]);},'get':function(){return this[_0x458a('0x8')]('crudPermissions')?this['getDataValue'](_0x458a('0x6'))[_0x458a('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 04b3151..6ada360 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 _0xbb9d=['catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','filter','includeAll','include','UserProfileSection','findAll','rows'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0xbb9d,0xea));var _0xdbb9=function(_0x4b3be7,_0x19d667){_0x4b3be7=_0x4b3be7-0x0;var _0x22de14=_0xbb9d[_0x4b3be7];return _0x22de14;};'use strict';var emlformat=require(_0xdbb9('0x0'));var rimraf=require(_0xdbb9('0x1'));var zipdir=require(_0xdbb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbb9('0x3'));var moment=require(_0xdbb9('0x4'));var BPromise=require(_0xdbb9('0x5'));var Mustache=require(_0xdbb9('0x6'));var util=require('util');var path=require(_0xdbb9('0x7'));var sox=require(_0xdbb9('0x8'));var csv=require(_0xdbb9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbb9('0xa'));var _=require('lodash');var squel=require(_0xdbb9('0xb'));var crypto=require(_0xdbb9('0xc'));var jsforce=require(_0xdbb9('0xd'));var deskjs=require(_0xdbb9('0xe'));var toCsv=require(_0xdbb9('0x9'));var querystring=require(_0xdbb9('0xf'));var Papa=require(_0xdbb9('0x10'));var Redis=require(_0xdbb9('0x11'));var authService=require(_0xdbb9('0x12'));var qs=require(_0xdbb9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbb9('0x14'));var utils=require('../../config/utils');var config=require(_0xdbb9('0x15'));var licenseUtil=require(_0xdbb9('0x16'));var db=require(_0xdbb9('0x17'))['db'];function respondWithStatusCode(_0x410b84,_0x3ba0c1){_0x3ba0c1=_0x3ba0c1||0xcc;return function(_0x1fa551){if(_0x1fa551){return _0x410b84[_0xdbb9('0x18')](_0x3ba0c1);}return _0x410b84['status'](_0x3ba0c1)[_0xdbb9('0x19')]();};}function respondWithResult(_0x1fee14,_0xe70a3a){_0xe70a3a=_0xe70a3a||0xc8;return function(_0x356bd8){if(_0x356bd8){return _0x1fee14[_0xdbb9('0x1a')](_0xe70a3a)[_0xdbb9('0x1b')](_0x356bd8);}};}function respondWithFilteredResult(_0x53e2bf,_0x38cfe2){return function(_0x1b2506){if(_0x1b2506){var _0x4f8cc1=typeof _0x38cfe2[_0xdbb9('0x1c')]===_0xdbb9('0x1d')&&typeof _0x38cfe2[_0xdbb9('0x1e')]===_0xdbb9('0x1d');var _0x513fb7=_0x1b2506[_0xdbb9('0x1f')];var _0xc5bc6e=_0x4f8cc1?0x0:_0x38cfe2[_0xdbb9('0x1c')];var _0x32d80a=_0x4f8cc1?_0x1b2506[_0xdbb9('0x1f')]:_0x38cfe2[_0xdbb9('0x1c')]+_0x38cfe2[_0xdbb9('0x1e')];var _0x500926;if(_0x32d80a>=_0x513fb7){_0x32d80a=_0x513fb7;_0x500926=0xc8;}else{_0x500926=0xce;}_0x53e2bf[_0xdbb9('0x1a')](_0x500926);return _0x53e2bf[_0xdbb9('0x20')](_0xdbb9('0x21'),_0xc5bc6e+'-'+_0x32d80a+'/'+_0x513fb7)[_0xdbb9('0x1b')](_0x1b2506);}return null;};}function patchUpdates(_0x49e567){return function(_0x187fde){try{jsonpatch[_0xdbb9('0x22')](_0x187fde,_0x49e567,!![]);}catch(_0x24b218){return BPromise[_0xdbb9('0x23')](_0x24b218);}return _0x187fde['save']();};}function saveUpdates(_0x280870,_0x47d451){return function(_0x22e6ca){if(_0x22e6ca){return _0x22e6ca[_0xdbb9('0x24')](_0x280870)[_0xdbb9('0x25')](function(_0x22a538){return _0x22a538;});}return null;};}function removeEntity(_0x1bf2ed,_0x5447b3){return function(_0x29dcc1){if(_0x29dcc1){return _0x29dcc1['destroy']()[_0xdbb9('0x25')](function(){_0x1bf2ed[_0xdbb9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351447,_0x136cc3){return function(_0x116340){if(!_0x116340){_0x351447[_0xdbb9('0x18')](0x194);}return _0x116340;};}function handleError(_0x5729ba,_0x9ba4e9){_0x9ba4e9=_0x9ba4e9||0x1f4;return function(_0x38516d){logger['error'](_0x38516d[_0xdbb9('0x26')]);if(_0x38516d[_0xdbb9('0x27')]){delete _0x38516d['name'];}_0x5729ba[_0xdbb9('0x1a')](_0x9ba4e9)[_0xdbb9('0x28')](_0x38516d);};}exports[_0xdbb9('0x29')]=function(_0x215a88,_0x533257){var _0x14ad28={},_0x175aad={},_0x1b7fb2={'count':0x0,'rows':[]};var _0x2af7f1=_['map'](db['UserProfileSection'][_0xdbb9('0x2a')],function(_0x577a84){return{'name':_0x577a84[_0xdbb9('0x2b')],'type':_0x577a84[_0xdbb9('0x2c')][_0xdbb9('0x2d')]};});_0x175aad[_0xdbb9('0x2e')]=_[_0xdbb9('0x2f')](_0x2af7f1,_0xdbb9('0x27'));_0x175aad[_0xdbb9('0x30')]=_[_0xdbb9('0x31')](_0x215a88['query']);_0x175aad['filters']=_['intersection'](_0x175aad[_0xdbb9('0x2e')],_0x175aad[_0xdbb9('0x30')]);_0x14ad28['attributes']=_[_0xdbb9('0x32')](_0x175aad[_0xdbb9('0x2e')],qs[_0xdbb9('0x33')](_0x215a88[_0xdbb9('0x30')][_0xdbb9('0x33')]));_0x14ad28[_0xdbb9('0x34')]=_0x14ad28[_0xdbb9('0x34')][_0xdbb9('0x35')]?_0x14ad28[_0xdbb9('0x34')]:_0x175aad['model'];if(!_0x215a88[_0xdbb9('0x30')][_0xdbb9('0x36')](_0xdbb9('0x37'))){_0x14ad28['limit']=qs[_0xdbb9('0x1e')](_0x215a88[_0xdbb9('0x30')][_0xdbb9('0x1e')]);_0x14ad28[_0xdbb9('0x1c')]=qs['offset'](_0x215a88['query'][_0xdbb9('0x1c')]);}_0x14ad28['order']=qs[_0xdbb9('0x38')](_0x215a88['query'][_0xdbb9('0x38')]);_0x14ad28[_0xdbb9('0x39')]=qs[_0xdbb9('0x3a')](_['pick'](_0x215a88[_0xdbb9('0x30')],_0x175aad[_0xdbb9('0x3a')]),_0x2af7f1);if(_0x215a88[_0xdbb9('0x30')]['filter']){_0x14ad28['where']=_[_0xdbb9('0x3b')](_0x14ad28['where'],{'$or':_[_0xdbb9('0x2f')](_0x2af7f1,function(_0x41548a){if(_0x41548a[_0xdbb9('0x2c')]!=='VIRTUAL'){var _0x53c475={};_0x53c475[_0x41548a[_0xdbb9('0x27')]]={'$like':'%'+_0x215a88[_0xdbb9('0x30')][_0xdbb9('0x3c')]+'%'};return _0x53c475;}})});}_0x14ad28=_['merge']({},_0x14ad28,_0x215a88['options']);var _0x3cccee={'where':_0x14ad28[_0xdbb9('0x39')]};return db['UserProfileSection'][_0xdbb9('0x1f')](_0x3cccee)[_0xdbb9('0x25')](function(_0x2ce6dd){_0x1b7fb2[_0xdbb9('0x1f')]=_0x2ce6dd;if(_0x215a88['query'][_0xdbb9('0x3d')]){_0x14ad28[_0xdbb9('0x3e')]=[{'all':!![]}];}return db[_0xdbb9('0x3f')][_0xdbb9('0x40')](_0x14ad28);})['then'](function(_0x1d3224){_0x1b7fb2[_0xdbb9('0x41')]=_0x1d3224;return _0x1b7fb2;})[_0xdbb9('0x25')](respondWithFilteredResult(_0x533257,_0x14ad28))[_0xdbb9('0x42')](handleError(_0x533257,null));};exports[_0xdbb9('0x43')]=function(_0x531306,_0x485438){var _0x3bd88={'raw':![],'where':{'id':_0x531306[_0xdbb9('0x44')]['id']}},_0x4e6ef6={};_0x4e6ef6[_0xdbb9('0x2e')]=_['keys'](db[_0xdbb9('0x3f')][_0xdbb9('0x2a')]);_0x4e6ef6[_0xdbb9('0x30')]=_[_0xdbb9('0x31')](_0x531306[_0xdbb9('0x30')]);_0x4e6ef6['filters']=_[_0xdbb9('0x32')](_0x4e6ef6[_0xdbb9('0x2e')],_0x4e6ef6[_0xdbb9('0x30')]);_0x3bd88['attributes']=_[_0xdbb9('0x32')](_0x4e6ef6[_0xdbb9('0x2e')],qs['fields'](_0x531306[_0xdbb9('0x30')][_0xdbb9('0x33')]));_0x3bd88[_0xdbb9('0x34')]=_0x3bd88[_0xdbb9('0x34')]['length']?_0x3bd88[_0xdbb9('0x34')]:_0x4e6ef6[_0xdbb9('0x2e')];if(_0x531306[_0xdbb9('0x30')][_0xdbb9('0x3d')]){_0x3bd88[_0xdbb9('0x3e')]=[{'all':!![]}];}_0x3bd88=_['merge']({},_0x3bd88,_0x531306[_0xdbb9('0x45')]);return db[_0xdbb9('0x3f')][_0xdbb9('0x46')](_0x3bd88)[_0xdbb9('0x25')](handleEntityNotFound(_0x485438,null))[_0xdbb9('0x25')](respondWithResult(_0x485438,null))[_0xdbb9('0x42')](handleError(_0x485438,null));};exports[_0xdbb9('0x47')]=function(_0x1dd5c9,_0x98be39){return db[_0xdbb9('0x3f')]['create'](_0x1dd5c9[_0xdbb9('0x48')],{})[_0xdbb9('0x25')](respondWithResult(_0x98be39,0xc9))[_0xdbb9('0x42')](handleError(_0x98be39,null));};exports[_0xdbb9('0x24')]=function(_0x5e9443,_0x590822){if(_0x5e9443[_0xdbb9('0x48')]['id']){delete _0x5e9443['body']['id'];}return db[_0xdbb9('0x3f')]['find']({'where':{'id':_0x5e9443[_0xdbb9('0x44')]['id']}})[_0xdbb9('0x25')](handleEntityNotFound(_0x590822,null))[_0xdbb9('0x25')](saveUpdates(_0x5e9443[_0xdbb9('0x48')],null))[_0xdbb9('0x25')](respondWithResult(_0x590822,null))['catch'](handleError(_0x590822,null));};exports[_0xdbb9('0x49')]=function(_0x234643,_0x5a6dd7){return db[_0xdbb9('0x3f')][_0xdbb9('0x46')]({'where':{'id':_0x234643['params']['id']}})[_0xdbb9('0x25')](handleEntityNotFound(_0x5a6dd7,null))[_0xdbb9('0x25')](removeEntity(_0x5a6dd7,null))[_0xdbb9('0x42')](handleError(_0x5a6dd7,null));};exports[_0xdbb9('0x4a')]=function(_0x51b980,_0x59681d){return db[_0xdbb9('0x3f')][_0xdbb9('0x4a')]()[_0xdbb9('0x25')](respondWithResult(_0x59681d,null))[_0xdbb9('0x42')](handleError(_0x59681d,null));}; \ No newline at end of file +var _0x4e7a=['type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','catch','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName'];(function(_0x10dfa6,_0xc79b1b){var _0x272b37=function(_0xf50651){while(--_0xf50651){_0x10dfa6['push'](_0x10dfa6['shift']());}};_0x272b37(++_0xc79b1b);}(_0x4e7a,0xad));var _0xa4e7=function(_0x25f271,_0x4e67ed){_0x25f271=_0x25f271-0x0;var _0x104ab9=_0x4e7a[_0x25f271];return _0x104ab9;};'use strict';var emlformat=require(_0xa4e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4e7('0x1'));var jsonpatch=require(_0xa4e7('0x2'));var rp=require(_0xa4e7('0x3'));var moment=require(_0xa4e7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4e7('0x5'));var util=require(_0xa4e7('0x6'));var path=require(_0xa4e7('0x7'));var sox=require('sox');var csv=require(_0xa4e7('0x8'));var ejs=require(_0xa4e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4e7('0xa'));var squel=require(_0xa4e7('0xb'));var crypto=require(_0xa4e7('0xc'));var jsforce=require(_0xa4e7('0xd'));var deskjs=require(_0xa4e7('0xe'));var toCsv=require(_0xa4e7('0x8'));var querystring=require('querystring');var Papa=require(_0xa4e7('0xf'));var Redis=require(_0xa4e7('0x10'));var authService=require(_0xa4e7('0x11'));var qs=require(_0xa4e7('0x12'));var as=require(_0xa4e7('0x13'));var hardwareService=require(_0xa4e7('0x14'));var logger=require(_0xa4e7('0x15'))(_0xa4e7('0x16'));var utils=require(_0xa4e7('0x17'));var config=require(_0xa4e7('0x18'));var licenseUtil=require(_0xa4e7('0x19'));var db=require(_0xa4e7('0x1a'))['db'];function respondWithStatusCode(_0x7a0a52,_0x3b01ca){_0x3b01ca=_0x3b01ca||0xcc;return function(_0x4e1265){if(_0x4e1265){return _0x7a0a52[_0xa4e7('0x1b')](_0x3b01ca);}return _0x7a0a52[_0xa4e7('0x1c')](_0x3b01ca)[_0xa4e7('0x1d')]();};}function respondWithResult(_0x3c312c,_0x396a2c){_0x396a2c=_0x396a2c||0xc8;return function(_0xbb85dd){if(_0xbb85dd){return _0x3c312c['status'](_0x396a2c)[_0xa4e7('0x1e')](_0xbb85dd);}};}function respondWithFilteredResult(_0x4ac398,_0xee8399){return function(_0x5dd201){if(_0x5dd201){var _0x59b5f6=typeof _0xee8399[_0xa4e7('0x1f')]===_0xa4e7('0x20')&&typeof _0xee8399[_0xa4e7('0x21')]==='undefined';var _0xcb433=_0x5dd201[_0xa4e7('0x22')];var _0x1f85d0=_0x59b5f6?0x0:_0xee8399['offset'];var _0x5b456d=_0x59b5f6?_0x5dd201[_0xa4e7('0x22')]:_0xee8399[_0xa4e7('0x1f')]+_0xee8399[_0xa4e7('0x21')];var _0x18f2c5;if(_0x5b456d>=_0xcb433){_0x5b456d=_0xcb433;_0x18f2c5=0xc8;}else{_0x18f2c5=0xce;}_0x4ac398['status'](_0x18f2c5);return _0x4ac398[_0xa4e7('0x23')]('Content-Range',_0x1f85d0+'-'+_0x5b456d+'/'+_0xcb433)[_0xa4e7('0x1e')](_0x5dd201);}return null;};}function patchUpdates(_0x41fda8){return function(_0x5201b9){try{jsonpatch[_0xa4e7('0x24')](_0x5201b9,_0x41fda8,!![]);}catch(_0x24c0ec){return BPromise[_0xa4e7('0x25')](_0x24c0ec);}return _0x5201b9[_0xa4e7('0x26')]();};}function saveUpdates(_0x395736,_0x206d9f){return function(_0x89d70e){if(_0x89d70e){return _0x89d70e[_0xa4e7('0x27')](_0x395736)[_0xa4e7('0x28')](function(_0x3d22eb){return _0x3d22eb;});}return null;};}function removeEntity(_0x17dd57,_0x5158a3){return function(_0x3d02ae){if(_0x3d02ae){return _0x3d02ae[_0xa4e7('0x29')]()['then'](function(){_0x17dd57['status'](0xcc)[_0xa4e7('0x1d')]();});}};}function handleEntityNotFound(_0x3af1fb,_0x1a4036){return function(_0x1ab2ff){if(!_0x1ab2ff){_0x3af1fb[_0xa4e7('0x1b')](0x194);}return _0x1ab2ff;};}function handleError(_0x800c,_0x5d9122){_0x5d9122=_0x5d9122||0x1f4;return function(_0x1fe529){logger[_0xa4e7('0x2a')](_0x1fe529[_0xa4e7('0x2b')]);if(_0x1fe529[_0xa4e7('0x2c')]){delete _0x1fe529[_0xa4e7('0x2c')];}_0x800c['status'](_0x5d9122)[_0xa4e7('0x2d')](_0x1fe529);};}exports['index']=function(_0x541e22,_0x437e5f){var _0x2a8c6d={},_0x42dd04={},_0x38e67a={'count':0x0,'rows':[]};var _0x1af6fd=_[_0xa4e7('0x2e')](db['UserProfileSection'][_0xa4e7('0x2f')],function(_0x5e15d1){return{'name':_0x5e15d1[_0xa4e7('0x30')],'type':_0x5e15d1[_0xa4e7('0x31')]['key']};});_0x42dd04[_0xa4e7('0x32')]=_['map'](_0x1af6fd,_0xa4e7('0x2c'));_0x42dd04[_0xa4e7('0x33')]=_[_0xa4e7('0x34')](_0x541e22[_0xa4e7('0x33')]);_0x42dd04['filters']=_[_0xa4e7('0x35')](_0x42dd04['model'],_0x42dd04[_0xa4e7('0x33')]);_0x2a8c6d[_0xa4e7('0x36')]=_[_0xa4e7('0x35')](_0x42dd04['model'],qs['fields'](_0x541e22[_0xa4e7('0x33')][_0xa4e7('0x37')]));_0x2a8c6d[_0xa4e7('0x36')]=_0x2a8c6d[_0xa4e7('0x36')]['length']?_0x2a8c6d[_0xa4e7('0x36')]:_0x42dd04[_0xa4e7('0x32')];if(!_0x541e22[_0xa4e7('0x33')][_0xa4e7('0x38')](_0xa4e7('0x39'))){_0x2a8c6d[_0xa4e7('0x21')]=qs[_0xa4e7('0x21')](_0x541e22['query']['limit']);_0x2a8c6d[_0xa4e7('0x1f')]=qs[_0xa4e7('0x1f')](_0x541e22['query'][_0xa4e7('0x1f')]);}_0x2a8c6d['order']=qs[_0xa4e7('0x3a')](_0x541e22[_0xa4e7('0x33')][_0xa4e7('0x3a')]);_0x2a8c6d[_0xa4e7('0x3b')]=qs[_0xa4e7('0x3c')](_[_0xa4e7('0x3d')](_0x541e22[_0xa4e7('0x33')],_0x42dd04[_0xa4e7('0x3c')]),_0x1af6fd);if(_0x541e22[_0xa4e7('0x33')][_0xa4e7('0x3e')]){_0x2a8c6d['where']=_[_0xa4e7('0x3f')](_0x2a8c6d['where'],{'$or':_[_0xa4e7('0x2e')](_0x1af6fd,function(_0x356a67){if(_0x356a67['type']!==_0xa4e7('0x40')){var _0x54626a={};_0x54626a[_0x356a67[_0xa4e7('0x2c')]]={'$like':'%'+_0x541e22['query']['filter']+'%'};return _0x54626a;}})});}_0x2a8c6d=_[_0xa4e7('0x3f')]({},_0x2a8c6d,_0x541e22[_0xa4e7('0x41')]);var _0x40820e={'where':_0x2a8c6d[_0xa4e7('0x3b')]};return db[_0xa4e7('0x42')][_0xa4e7('0x22')](_0x40820e)[_0xa4e7('0x28')](function(_0x4bcdcf){_0x38e67a[_0xa4e7('0x22')]=_0x4bcdcf;if(_0x541e22[_0xa4e7('0x33')]['includeAll']){_0x2a8c6d['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x2a8c6d);})[_0xa4e7('0x28')](function(_0x14c24c){_0x38e67a['rows']=_0x14c24c;return _0x38e67a;})['then'](respondWithFilteredResult(_0x437e5f,_0x2a8c6d))[_0xa4e7('0x43')](handleError(_0x437e5f,null));};exports['show']=function(_0x3eb558,_0x10c665){var _0x2caa8c={'raw':![],'where':{'id':_0x3eb558[_0xa4e7('0x44')]['id']}},_0x2cf070={};_0x2cf070['model']=_[_0xa4e7('0x34')](db['UserProfileSection'][_0xa4e7('0x2f')]);_0x2cf070[_0xa4e7('0x33')]=_[_0xa4e7('0x34')](_0x3eb558[_0xa4e7('0x33')]);_0x2cf070[_0xa4e7('0x3c')]=_['intersection'](_0x2cf070['model'],_0x2cf070['query']);_0x2caa8c[_0xa4e7('0x36')]=_[_0xa4e7('0x35')](_0x2cf070[_0xa4e7('0x32')],qs['fields'](_0x3eb558[_0xa4e7('0x33')]['fields']));_0x2caa8c[_0xa4e7('0x36')]=_0x2caa8c[_0xa4e7('0x36')]['length']?_0x2caa8c[_0xa4e7('0x36')]:_0x2cf070[_0xa4e7('0x32')];if(_0x3eb558[_0xa4e7('0x33')][_0xa4e7('0x45')]){_0x2caa8c['include']=[{'all':!![]}];}_0x2caa8c=_[_0xa4e7('0x3f')]({},_0x2caa8c,_0x3eb558[_0xa4e7('0x41')]);return db[_0xa4e7('0x42')][_0xa4e7('0x46')](_0x2caa8c)[_0xa4e7('0x28')](handleEntityNotFound(_0x10c665,null))[_0xa4e7('0x28')](respondWithResult(_0x10c665,null))[_0xa4e7('0x43')](handleError(_0x10c665,null));};exports[_0xa4e7('0x47')]=function(_0x2a27d2,_0x477464){return db['UserProfileSection'][_0xa4e7('0x47')](_0x2a27d2['body'],{})['then'](respondWithResult(_0x477464,0xc9))[_0xa4e7('0x43')](handleError(_0x477464,null));};exports['update']=function(_0x154b10,_0x3f84ac){if(_0x154b10[_0xa4e7('0x48')]['id']){delete _0x154b10[_0xa4e7('0x48')]['id'];}return db[_0xa4e7('0x42')][_0xa4e7('0x46')]({'where':{'id':_0x154b10[_0xa4e7('0x44')]['id']}})[_0xa4e7('0x28')](handleEntityNotFound(_0x3f84ac,null))['then'](saveUpdates(_0x154b10[_0xa4e7('0x48')],null))[_0xa4e7('0x28')](respondWithResult(_0x3f84ac,null))['catch'](handleError(_0x3f84ac,null));};exports[_0xa4e7('0x29')]=function(_0x1a60a5,_0x579beb){return db[_0xa4e7('0x42')][_0xa4e7('0x46')]({'where':{'id':_0x1a60a5[_0xa4e7('0x44')]['id']}})[_0xa4e7('0x28')](handleEntityNotFound(_0x579beb,null))[_0xa4e7('0x28')](removeEntity(_0x579beb,null))[_0xa4e7('0x43')](handleError(_0x579beb,null));};exports['describe']=function(_0x2cd3cb,_0x5d316a){return db[_0xa4e7('0x42')][_0xa4e7('0x49')]()[_0xa4e7('0x28')](respondWithResult(_0x5d316a,null))[_0xa4e7('0x43')](handleError(_0x5d316a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b1b9212..cb84a66 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 _0xb3dc=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x20445c,_0x277ac4){var _0x5439c9=function(_0xe6f9fb){while(--_0xe6f9fb){_0x20445c['push'](_0x20445c['shift']());}};_0x5439c9(++_0x277ac4);}(_0xb3dc,0x12b));var _0xcb3d=function(_0x2c39a8,_0x419568){_0x2c39a8=_0x2c39a8-0x0;var _0x92aad6=_0xb3dc[_0x2c39a8];return _0x92aad6;};'use strict';var _=require(_0xcb3d('0x0'));var util=require(_0xcb3d('0x1'));var logger=require(_0xcb3d('0x2'))(_0xcb3d('0x3'));var moment=require(_0xcb3d('0x4'));var BPromise=require(_0xcb3d('0x5'));var rp=require(_0xcb3d('0x6'));var fs=require('fs');var path=require(_0xcb3d('0x7'));var rimraf=require('rimraf');var config=require(_0xcb3d('0x8'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x29adce,_0x1d6bc4){return _0x29adce[_0xcb3d('0x9')](_0xcb3d('0xa'),attributes,{'tableName':_0xcb3d('0xb'),'paranoid':![],'indexes':[{'name':_0xcb3d('0xc'),'fields':[_0xcb3d('0xd'),_0xcb3d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77f1=['api','bluebird','request-promise','path','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util'];(function(_0x1f15e8,_0x456666){var _0x70662b=function(_0x3c7bf1){while(--_0x3c7bf1){_0x1f15e8['push'](_0x1f15e8['shift']());}};_0x70662b(++_0x456666);}(_0x77f1,0x13e));var _0x177f=function(_0x3f13f1,_0x19678e){_0x3f13f1=_0x3f13f1-0x0;var _0x41280f=_0x77f1[_0x3f13f1];return _0x41280f;};'use strict';var _=require('lodash');var util=require(_0x177f('0x0'));var logger=require('../../config/logger')(_0x177f('0x1'));var moment=require('moment');var BPromise=require(_0x177f('0x2'));var rp=require(_0x177f('0x3'));var fs=require('fs');var path=require(_0x177f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x646046,_0x32dc75){return _0x646046[_0x177f('0x5')](_0x177f('0x6'),attributes,{'tableName':_0x177f('0x7'),'paranoid':![],'indexes':[{'name':_0x177f('0x8'),'fields':[_0x177f('0x9'),_0x177f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 395cb62..df45516 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 _0x1652=['then','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x1652,0xc1));var _0x2165=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x1652[_0x4e0026];return _0x3f8ee7;};'use strict';var _=require(_0x2165('0x0'));var util=require(_0x2165('0x1'));var moment=require(_0x2165('0x2'));var BPromise=require(_0x2165('0x3'));var rs=require(_0x2165('0x4'));var fs=require('fs');var Redis=require(_0x2165('0x5'));var db=require(_0x2165('0x6'))['db'];var utils=require(_0x2165('0x7'));var logger=require('../../config/logger')(_0x2165('0x8'));var config=require(_0x2165('0x9'));var jayson=require(_0x2165('0xa'));var client=jayson[_0x2165('0xb')][_0x2165('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40ae40,_0x43a3e0,_0x2ebc86){return new BPromise(function(_0x4871b7,_0x62b6b1){return client[_0x2165('0xd')](_0x40ae40,_0x2ebc86)[_0x2165('0xe')](function(_0x123ddf){logger['info'](_0x2165('0xf'),_0x43a3e0,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x43a3e0,_0x2165('0x10'),JSON['stringify'](_0x123ddf));if(_0x123ddf[_0x2165('0x11')]){if(_0x123ddf[_0x2165('0x11')][_0x2165('0x12')]===0x1f4){logger['error'](_0x2165('0xf'),_0x43a3e0,_0x123ddf[_0x2165('0x11')][_0x2165('0x13')]);return _0x62b6b1(_0x123ddf[_0x2165('0x11')]['message']);}logger[_0x2165('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x43a3e0,_0x123ddf['error'][_0x2165('0x13')]);return _0x4871b7(_0x123ddf[_0x2165('0x11')][_0x2165('0x13')]);}else{logger[_0x2165('0x14')](_0x2165('0xf'),_0x43a3e0,_0x2165('0x10'));_0x4871b7(_0x123ddf[_0x2165('0x15')][_0x2165('0x13')]);}})[_0x2165('0x16')](function(_0x273bbd){logger[_0x2165('0x11')](_0x2165('0xf'),_0x43a3e0,_0x273bbd);_0x62b6b1(_0x273bbd);});});} \ No newline at end of file +var _0x2e61=['error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x59b2ea,_0x2aa714){var _0x39dc9d=function(_0x1c00f3){while(--_0x1c00f3){_0x59b2ea['push'](_0x59b2ea['shift']());}};_0x39dc9d(++_0x2aa714);}(_0x2e61,0x1d4));var _0x12e6=function(_0x59fef1,_0x23ee6f){_0x59fef1=_0x59fef1-0x0;var _0x58f163=_0x2e61[_0x59fef1];return _0x58f163;};'use strict';var _=require(_0x12e6('0x0'));var util=require(_0x12e6('0x1'));var moment=require(_0x12e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e6('0x3'));var fs=require('fs');var Redis=require(_0x12e6('0x4'));var db=require(_0x12e6('0x5'))['db'];var utils=require(_0x12e6('0x6'));var logger=require(_0x12e6('0x7'))(_0x12e6('0x8'));var config=require(_0x12e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x12e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456105,_0x40d415,_0x4706dd){return new BPromise(function(_0x56c3ed,_0x3cc772){return client[_0x12e6('0xb')](_0x456105,_0x4706dd)[_0x12e6('0xc')](function(_0x4e58aa){logger[_0x12e6('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x40d415,_0x12e6('0xe'));logger['debug'](_0x12e6('0xf'),_0x40d415,_0x12e6('0xe'),JSON['stringify'](_0x4e58aa));if(_0x4e58aa[_0x12e6('0x10')]){if(_0x4e58aa['error'][_0x12e6('0x11')]===0x1f4){logger[_0x12e6('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x40d415,_0x4e58aa[_0x12e6('0x10')]['message']);return _0x3cc772(_0x4e58aa[_0x12e6('0x10')][_0x12e6('0x12')]);}logger[_0x12e6('0x10')](_0x12e6('0x13'),_0x40d415,_0x4e58aa[_0x12e6('0x10')]['message']);return _0x56c3ed(_0x4e58aa[_0x12e6('0x10')]['message']);}else{logger[_0x12e6('0xd')](_0x12e6('0x13'),_0x40d415,'request\x20sent');_0x56c3ed(_0x4e58aa[_0x12e6('0x14')][_0x12e6('0x12')]);}})[_0x12e6('0x15')](function(_0x209b9f){logger[_0x12e6('0x10')](_0x12e6('0x13'),_0x40d415,_0x209b9f);_0x3cc772(_0x209b9f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5b043e2..a3217de 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3e1e47,_0x3082cd){var _0x49e69c=function(_0x4da78a){while(--_0x4da78a){_0x3e1e47['push'](_0x3e1e47['shift']());}};_0x49e69c(++_0x3082cd);}(_0x70e0,0x17b));var _0x070e=function(_0x29381a,_0x434b68){_0x29381a=_0x29381a-0x0;var _0x40c16b=_0x70e0[_0x29381a];return _0x40c16b;};'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(_0x156e90,_0x2f709d){var _0xeb544c=function(_0x1f623){while(--_0x1f623){_0x156e90['push'](_0x156e90['shift']());}};_0xeb544c(++_0x2f709d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 72eba60..234fa99 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 _0xab7c=['INTEGER','sequelize'];(function(_0x23a417,_0x56ff8e){var _0x3c1651=function(_0x3e2b19){while(--_0x3e2b19){_0x23a417['push'](_0x23a417['shift']());}};_0x3c1651(++_0x56ff8e);}(_0xab7c,0xfb));var _0xcab7=function(_0x4d127e,_0x5aa2d9){_0x4d127e=_0x4d127e-0x0;var _0x264f22=_0xab7c[_0x4d127e];return _0x264f22;};'use strict';var Sequelize=require(_0xcab7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xcab7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb024=['INTEGER','exports'];(function(_0x2d4e6a,_0x1b683c){var _0x458b32=function(_0x3c9aea){while(--_0x3c9aea){_0x2d4e6a['push'](_0x2d4e6a['shift']());}};_0x458b32(++_0x1b683c);}(_0xb024,0x1ad));var _0x4b02=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb024[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x4b02('0x0')]={'penalty':{'type':Sequelize[_0x4b02('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 7d912b0..4d34fe6 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 _0xb934=['exports','define','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0xb934,0x92));var _0x4b93=function(_0x59627b,_0x247133){_0x59627b=_0x59627b-0x0;var _0x54f1e7=_0xb934[_0x59627b];return _0x54f1e7;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require(_0x4b93('0x3'));var BPromise=require(_0x4b93('0x4'));var rp=require(_0x4b93('0x5'));var fs=require('fs');var path=require(_0x4b93('0x6'));var rimraf=require(_0x4b93('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x4b93('0x8')]=function(_0x1fa8af,_0x2ea5ad){return _0x1fa8af[_0x4b93('0x9')]('UserSmsQueue',attributes,{'tableName':_0x4b93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2bc=['./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5048d6,_0x141ac4){var _0x342b3a=function(_0x4df27d){while(--_0x4df27d){_0x5048d6['push'](_0x5048d6['shift']());}};_0x342b3a(++_0x141ac4);}(_0xe2bc,0x1a6));var _0xce2b=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe2bc[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var logger=require(_0xce2b('0x1'))('api');var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rp=require(_0xce2b('0x4'));var fs=require('fs');var path=require(_0xce2b('0x5'));var rimraf=require(_0xce2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xce2b('0x7'));module[_0xce2b('0x8')]=function(_0x3c15d3,_0x343373){return _0x3c15d3[_0xce2b('0x9')]('UserSmsQueue',attributes,{'tableName':_0xce2b('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 92add91..7f803dd 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 _0x8edf=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x31bbe3,_0x108dca){var _0x6abf93=function(_0x248997){while(--_0x248997){_0x31bbe3['push'](_0x31bbe3['shift']());}};_0x6abf93(++_0x108dca);}(_0x8edf,0x11a));var _0xf8ed=function(_0x10f526,_0x2f160b){_0x10f526=_0x10f526-0x0;var _0x274a13=_0x8edf[_0x10f526];return _0x274a13;};'use strict';var _=require(_0xf8ed('0x0'));var util=require(_0xf8ed('0x1'));var moment=require(_0xf8ed('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf8ed('0x4'))(_0xf8ed('0x5'));var config=require(_0xf8ed('0x6'));var jayson=require(_0xf8ed('0x7'));var client=jayson[_0xf8ed('0x8')][_0xf8ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1969eb,_0x3583b6,_0xe781fc){return new BPromise(function(_0x4226bd,_0x55411e){return client['request'](_0x1969eb,_0xe781fc)[_0xf8ed('0xa')](function(_0x56a9bf){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x3583b6,_0xf8ed('0xb'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3583b6,_0xf8ed('0xb'),JSON[_0xf8ed('0xc')](_0x56a9bf));if(_0x56a9bf[_0xf8ed('0xd')]){if(_0x56a9bf[_0xf8ed('0xd')][_0xf8ed('0xe')]===0x1f4){logger[_0xf8ed('0xd')](_0xf8ed('0xf'),_0x3583b6,_0x56a9bf['error']['message']);return _0x55411e(_0x56a9bf[_0xf8ed('0xd')][_0xf8ed('0x10')]);}logger['error'](_0xf8ed('0xf'),_0x3583b6,_0x56a9bf['error'][_0xf8ed('0x10')]);return _0x4226bd(_0x56a9bf[_0xf8ed('0xd')][_0xf8ed('0x10')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x3583b6,_0xf8ed('0xb'));_0x4226bd(_0x56a9bf[_0xf8ed('0x11')][_0xf8ed('0x10')]);}})[_0xf8ed('0x12')](function(_0x426c78){logger[_0xf8ed('0xd')](_0xf8ed('0xf'),_0x3583b6,_0x426c78);_0x55411e(_0x426c78);});});} \ No newline at end of file +var _0x08ca=['jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x581bc8,_0x7566e){var _0x351c3e=function(_0x512a01){while(--_0x512a01){_0x581bc8['push'](_0x581bc8['shift']());}};_0x351c3e(++_0x7566e);}(_0x08ca,0xb5));var _0xa08c=function(_0x5e4414,_0x3d8917){_0x5e4414=_0x5e4414-0x0;var _0x239c1e=_0x08ca[_0x5e4414];return _0x239c1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa08c('0x0'));var BPromise=require(_0xa08c('0x1'));var rs=require(_0xa08c('0x2'));var fs=require('fs');var Redis=require(_0xa08c('0x3'));var db=require(_0xa08c('0x4'))['db'];var utils=require(_0xa08c('0x5'));var logger=require(_0xa08c('0x6'))('rpc');var config=require(_0xa08c('0x7'));var jayson=require(_0xa08c('0x8'));var client=jayson[_0xa08c('0x9')][_0xa08c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438ace,_0x1efd9e,_0x197336){return new BPromise(function(_0x1d2b67,_0x50108f){return client[_0xa08c('0xb')](_0x438ace,_0x197336)[_0xa08c('0xc')](function(_0x544968){logger[_0xa08c('0xd')](_0xa08c('0xe'),_0x1efd9e,_0xa08c('0xf'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1efd9e,_0xa08c('0xf'),JSON[_0xa08c('0x10')](_0x544968));if(_0x544968[_0xa08c('0x11')]){if(_0x544968[_0xa08c('0x11')]['code']===0x1f4){logger[_0xa08c('0x11')](_0xa08c('0xe'),_0x1efd9e,_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);return _0x50108f(_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);}logger['error'](_0xa08c('0xe'),_0x1efd9e,_0x544968['error'][_0xa08c('0x12')]);return _0x1d2b67(_0x544968[_0xa08c('0x11')][_0xa08c('0x12')]);}else{logger[_0xa08c('0xd')](_0xa08c('0xe'),_0x1efd9e,_0xa08c('0xf'));_0x1d2b67(_0x544968[_0xa08c('0x13')][_0xa08c('0x12')]);}})[_0xa08c('0x14')](function(_0x5bb29b){logger[_0xa08c('0x11')](_0xa08c('0xe'),_0x1efd9e,_0x5bb29b);_0x50108f(_0x5bb29b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 147aeba..ebc4cd4 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 _0xf0ab=['exports','INTEGER','sequelize'];(function(_0x1403ba,_0x21ae03){var _0xa9a873=function(_0x44823f){while(--_0x44823f){_0x1403ba['push'](_0x1403ba['shift']());}};_0xa9a873(++_0x21ae03);}(_0xf0ab,0x17c));var _0xbf0a=function(_0x4ff2e4,_0x3b1489){_0x4ff2e4=_0x4ff2e4-0x0;var _0x69c350=_0xf0ab[_0x4ff2e4];return _0x69c350;};'use strict';var Sequelize=require(_0xbf0a('0x0'));module[_0xbf0a('0x1')]={'UserId':{'type':Sequelize[_0xbf0a('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6e18=['exports','INTEGER','sequelize'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x6e18,0x17f));var _0x86e1=function(_0xb05fa9,_0x135edb){_0xb05fa9=_0xb05fa9-0x0;var _0x56c48b=_0x6e18[_0xb05fa9];return _0x56c48b;};'use strict';var Sequelize=require(_0x86e1('0x0'));module[_0x86e1('0x1')]={'UserId':{'type':Sequelize[_0x86e1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x86e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8a43d22..d3a0a23 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(_0x3516fe,_0x60c65b){var _0x55c750=function(_0x1f62f8){while(--_0x1f62f8){_0x3516fe['push'](_0x3516fe['shift']());}};_0x55c750(++_0x60c65b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));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(_0x34b165,_0x520f2f){var _0x4cc313=function(_0x3a0892){while(--_0x3a0892){_0x34b165['push'](_0x34b165['shift']());}};_0x4cc313(++_0x520f2f);}(_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 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 98cc298..7c01b5f 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(_0x3ce6b0,_0x2e9f26){var _0x5c783c=function(_0x580ef3){while(--_0x580ef3){_0x3ce6b0['push'](_0x3ce6b0['shift']());}};_0x5c783c(++_0x2e9f26);}(_0x70e0,0x17b));var _0x070e=function(_0x55931b,_0x431f7c){_0x55931b=_0x55931b-0x0;var _0xf5154e=_0x70e0[_0x55931b];return _0xf5154e;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x398026,_0x3f0014){var _0x82d0d4=function(_0xb3d33f){while(--_0xb3d33f){_0x398026['push'](_0x398026['shift']());}};_0x82d0d4(++_0x3f0014);}(_0x70e0,0x17b));var _0x070e=function(_0x22adcc,_0x5bcc6a){_0x22adcc=_0x22adcc-0x0;var _0x2aeed5=_0x70e0[_0x22adcc];return _0x2aeed5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 116bb57..da2f168 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 _0xc02c=['sequelize','exports','INTEGER'];(function(_0x58a13e,_0xe4f934){var _0x1082b6=function(_0x3d5888){while(--_0x3d5888){_0x58a13e['push'](_0x58a13e['shift']());}};_0x1082b6(++_0xe4f934);}(_0xc02c,0x18f));var _0xcc02=function(_0x3a177c,_0xfb1964){_0x3a177c=_0x3a177c-0x0;var _0x291a58=_0xc02c[_0x3a177c];return _0x291a58;};'use strict';var Sequelize=require(_0xcc02('0x0'));module[_0xcc02('0x1')]={'penalty':{'type':Sequelize[_0xcc02('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd29e=['INTEGER','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd29e,0x1a7));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xed29('0x0')]={'penalty':{'type':Sequelize[_0xed29('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index eb86ec4..8ef33a4 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 _0x51d8=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x51d8,0x168));var _0x851d=function(_0x5e367f,_0xa51c83){_0x5e367f=_0x5e367f-0x0;var _0x3d7263=_0x51d8[_0x5e367f];return _0x3d7263;};'use strict';var _=require('lodash');var util=require(_0x851d('0x0'));var logger=require(_0x851d('0x1'))(_0x851d('0x2'));var moment=require('moment');var BPromise=require(_0x851d('0x3'));var rp=require(_0x851d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x851d('0x5'));var config=require(_0x851d('0x6'));var attributes=require(_0x851d('0x7'));module[_0x851d('0x8')]=function(_0xbffeb6,_0x166ab7){return _0xbffeb6[_0x851d('0x9')](_0x851d('0xa'),attributes,{'tableName':_0x851d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x588b=['rimraf','../../config/environment','define','user_has_voice_queues','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x588b,0x1bc));var _0xb588=function(_0x29b08d,_0x5b1eb6){_0x29b08d=_0x29b08d-0x0;var _0x492da4=_0x588b[_0x29b08d];return _0x492da4;};'use strict';var _=require(_0xb588('0x0'));var util=require(_0xb588('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb588('0x2'));var BPromise=require(_0xb588('0x3'));var rp=require(_0xb588('0x4'));var fs=require('fs');var path=require(_0xb588('0x5'));var rimraf=require(_0xb588('0x6'));var config=require(_0xb588('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x4c24af,_0x282d31){return _0x4c24af[_0xb588('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xb588('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index fe0e0cf..a0a1b8c 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 _0xc63d=['code','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xc63d,0x1d2));var _0xdc63=function(_0x15a49b,_0x2c8ed6){_0x15a49b=_0x15a49b-0x0;var _0x213a68=_0xc63d[_0x15a49b];return _0x213a68;};'use strict';var _=require(_0xdc63('0x0'));var util=require(_0xdc63('0x1'));var moment=require(_0xdc63('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc63('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc63('0x4'))(_0xdc63('0x5'));var config=require(_0xdc63('0x6'));var jayson=require(_0xdc63('0x7'));var client=jayson['client'][_0xdc63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a78ac,_0x52f9f9,_0x27e296){return new BPromise(function(_0x1938b9,_0x13bcd9){return client[_0xdc63('0x9')](_0x3a78ac,_0x27e296)[_0xdc63('0xa')](function(_0x29a70d){logger[_0xdc63('0xb')](_0xdc63('0xc'),_0x52f9f9,'request\x20sent');logger[_0xdc63('0xd')](_0xdc63('0xe'),_0x52f9f9,_0xdc63('0xf'),JSON[_0xdc63('0x10')](_0x29a70d));if(_0x29a70d[_0xdc63('0x11')]){if(_0x29a70d['error'][_0xdc63('0x12')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x52f9f9,_0x29a70d[_0xdc63('0x11')][_0xdc63('0x13')]);return _0x13bcd9(_0x29a70d['error'][_0xdc63('0x13')]);}logger[_0xdc63('0x11')](_0xdc63('0xc'),_0x52f9f9,_0x29a70d['error'][_0xdc63('0x13')]);return _0x1938b9(_0x29a70d[_0xdc63('0x11')][_0xdc63('0x13')]);}else{logger[_0xdc63('0xb')](_0xdc63('0xc'),_0x52f9f9,_0xdc63('0xf'));_0x1938b9(_0x29a70d[_0xdc63('0x14')][_0xdc63('0x13')]);}})[_0xdc63('0x15')](function(_0x543afc){logger[_0xdc63('0x11')](_0xdc63('0xc'),_0x52f9f9,_0x543afc);_0x13bcd9(_0x543afc);});});} \ No newline at end of file +var _0xdbbc=['jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xdbbc,0x11f));var _0xcdbb=function(_0x39fdda,_0x1994e1){_0x39fdda=_0x39fdda-0x0;var _0x5c9d2f=_0xdbbc[_0x39fdda];return _0x5c9d2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcdbb('0x0'));var BPromise=require('bluebird');var rs=require(_0xcdbb('0x1'));var fs=require('fs');var Redis=require(_0xcdbb('0x2'));var db=require(_0xcdbb('0x3'))['db'];var utils=require(_0xcdbb('0x4'));var logger=require(_0xcdbb('0x5'))(_0xcdbb('0x6'));var config=require('../../config/environment');var jayson=require(_0xcdbb('0x7'));var client=jayson[_0xcdbb('0x8')][_0xcdbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c4f2e,_0x243d78,_0x2395f2){return new BPromise(function(_0x4a0bd8,_0x5d03c9){return client[_0xcdbb('0xa')](_0x3c4f2e,_0x2395f2)['then'](function(_0x4b6ef4){logger[_0xcdbb('0xb')](_0xcdbb('0xc'),_0x243d78,'request\x20sent');logger[_0xcdbb('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x243d78,_0xcdbb('0xe'),JSON[_0xcdbb('0xf')](_0x4b6ef4));if(_0x4b6ef4[_0xcdbb('0x10')]){if(_0x4b6ef4[_0xcdbb('0x10')][_0xcdbb('0x11')]===0x1f4){logger[_0xcdbb('0x10')](_0xcdbb('0xc'),_0x243d78,_0x4b6ef4[_0xcdbb('0x10')][_0xcdbb('0x12')]);return _0x5d03c9(_0x4b6ef4[_0xcdbb('0x10')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x243d78,_0x4b6ef4[_0xcdbb('0x10')][_0xcdbb('0x12')]);return _0x4a0bd8(_0x4b6ef4[_0xcdbb('0x10')]['message']);}else{logger[_0xcdbb('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x243d78,'request\x20sent');_0x4a0bd8(_0x4b6ef4[_0xcdbb('0x13')]['message']);}})[_0xcdbb('0x14')](function(_0x58dbec){logger[_0xcdbb('0x10')](_0xcdbb('0xc'),_0x243d78,_0x58dbec);_0x5d03c9(_0x58dbec);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ad1333c..3a617bf 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2276e2,_0x373589){var _0x343d3b=function(_0x4f99e7){while(--_0x4f99e7){_0x2276e2['push'](_0x2276e2['shift']());}};_0x343d3b(++_0x373589);}(_0x70e0,0x17b));var _0x070e=function(_0x452ad2,_0xd9b3c4){_0x452ad2=_0x452ad2-0x0;var _0x4a3b76=_0x70e0[_0x452ad2];return _0x4a3b76;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x348bf2,_0x4227cb){var _0x3d8ff1=function(_0x13cfe6){while(--_0x13cfe6){_0x348bf2['push'](_0x348bf2['shift']());}};_0x3d8ff1(++_0x4227cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0xcb91[_0x16cb03];return _0x10944e;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0134316..07d96b4 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 _0x3e86=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x51cbcd,_0xf7881d){var _0x49bb5c=function(_0x1bd368){while(--_0x1bd368){_0x51cbcd['push'](_0x51cbcd['shift']());}};_0x49bb5c(++_0xf7881d);}(_0x3e86,0x1c6));var _0x63e8=function(_0x2b9749,_0x42d8cf){_0x2b9749=_0x2b9749-0x0;var _0x47bcee=_0x3e86[_0x2b9749];return _0x47bcee;};'use strict';var Sequelize=require(_0x63e8('0x0'));module[_0x63e8('0x1')]={'uniqueid':{'type':Sequelize[_0x63e8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x63e8('0x3')],'allowNull':![],'comment':_0x63e8('0x4')},'UserId':{'type':Sequelize[_0x63e8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x63e8('0x3')],'allowNull':![],'unique':_0x63e8('0x5'),'comment':_0x63e8('0x4')},'VoiceQueueId':{'type':Sequelize[_0x63e8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x63e8('0x3')],'allowNull':![],'unique':_0x63e8('0x5'),'comment':_0x63e8('0x4')},'penalty':{'type':Sequelize[_0x63e8('0x2')](0xb),'defaultValue':0x0,'comment':_0x63e8('0x4')},'paused':{'type':Sequelize[_0x63e8('0x2')](0xb),'defaultValue':0x0,'comment':_0x63e8('0x4')}}; \ No newline at end of file +var _0x143b=['queue_interface','sequelize','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x143b,0xf6));var _0xb143=function(_0x264ab9,_0x30b321){_0x264ab9=_0x264ab9-0x0;var _0x573fb7=_0x143b[_0x264ab9];return _0x573fb7;};'use strict';var Sequelize=require(_0xb143('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb143('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb143('0x2')],'allowNull':![],'comment':_0xb143('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb143('0x4'),'comment':_0xb143('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb143('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb143('0x4'),'comment':_0xb143('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb143('0x3')},'paused':{'type':Sequelize[_0xb143('0x1')](0xb),'defaultValue':0x0,'comment':_0xb143('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3a80f8d..1dc1190 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 _0x57f2=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x108b78,_0x28a619){var _0x3f81ed=function(_0x117143){while(--_0x117143){_0x108b78['push'](_0x108b78['shift']());}};_0x3f81ed(++_0x28a619);}(_0x57f2,0x72));var _0x257f=function(_0x143873,_0x34c95f){_0x143873=_0x143873-0x0;var _0xc717bb=_0x57f2[_0x143873];return _0xc717bb;};'use strict';var EventEmitter=require(_0x257f('0x0'));var UserVoiceQueueRt=require(_0x257f('0x1'))['db'][_0x257f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x257f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x257f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43de0c){return function(_0x2adc5b,_0x252981,_0x3ff187){UserVoiceQueueRtEvents['emit'](_0x43de0c+':'+_0x2adc5b['id'],_0x2adc5b);UserVoiceQueueRtEvents[_0x257f('0x5')](_0x43de0c,_0x2adc5b);_0x3ff187(null);};}for(var e in events){if(events[_0x257f('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x257f('0x7')](e,emitEvent(event));}}module[_0x257f('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfb23=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x10ae14,_0x1e19a6){var _0x336ac5=function(_0x1db627){while(--_0x1db627){_0x10ae14['push'](_0x10ae14['shift']());}};_0x336ac5(++_0x1e19a6);}(_0xfb23,0xb0));var _0x3fb2=function(_0x5bcd01,_0x36a17c){_0x5bcd01=_0x5bcd01-0x0;var _0x417ea8=_0xfb23[_0x5bcd01];return _0x417ea8;};'use strict';var EventEmitter=require(_0x3fb2('0x0'));var UserVoiceQueueRt=require(_0x3fb2('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3fb2('0x2')](0x0);var events={'afterCreate':_0x3fb2('0x3'),'afterUpdate':_0x3fb2('0x4'),'afterDestroy':_0x3fb2('0x5')};function emitEvent(_0x2aeeee){return function(_0x49188a,_0x2c3d2b,_0x5da395){UserVoiceQueueRtEvents[_0x3fb2('0x6')](_0x2aeeee+':'+_0x49188a['id'],_0x49188a);UserVoiceQueueRtEvents['emit'](_0x2aeeee,_0x49188a);_0x5da395(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3fb2('0x7')](e,emitEvent(event));}}module[_0x3fb2('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1b30c2d..db56ee8 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 _0xe05e=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x40300e,_0x4506d6){var _0x334662=function(_0x3473ae){while(--_0x3473ae){_0x40300e['push'](_0x40300e['shift']());}};_0x334662(++_0x4506d6);}(_0xe05e,0x94));var _0xee05=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xe05e[_0x3c2b2e];return _0x27a338;};'use strict';var _=require(_0xee05('0x0'));var util=require(_0xee05('0x1'));var logger=require(_0xee05('0x2'))(_0xee05('0x3'));var moment=require('moment');var BPromise=require(_0xee05('0x4'));var rp=require(_0xee05('0x5'));var fs=require('fs');var path=require(_0xee05('0x6'));var rimraf=require(_0xee05('0x7'));var config=require('../../config/environment');var attributes=require(_0xee05('0x8'));module[_0xee05('0x9')]=function(_0x2a2689,_0x2d6048){return _0x2a2689[_0xee05('0xa')](_0xee05('0xb'),attributes,{'tableName':_0xee05('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x747a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash'];(function(_0x299a98,_0x578011){var _0x6fd85a=function(_0x139658){while(--_0x139658){_0x299a98['push'](_0x299a98['shift']());}};_0x6fd85a(++_0x578011);}(_0x747a,0xbf));var _0xa747=function(_0x5bf459,_0xafeea1){_0x5bf459=_0x5bf459-0x0;var _0x4c0765=_0x747a[_0x5bf459];return _0x4c0765;};'use strict';var _=require(_0xa747('0x0'));var util=require('util');var logger=require(_0xa747('0x1'))(_0xa747('0x2'));var moment=require(_0xa747('0x3'));var BPromise=require('bluebird');var rp=require(_0xa747('0x4'));var fs=require('fs');var path=require(_0xa747('0x5'));var rimraf=require(_0xa747('0x6'));var config=require(_0xa747('0x7'));var attributes=require(_0xa747('0x8'));module[_0xa747('0x9')]=function(_0x4abb0d,_0x439799){return _0x4abb0d[_0xa747('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0xa747('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 79299fa..e09cd6f 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 _0xb5d4=['redis','defaults','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4f84fc,_0x29ca45){var _0x296601=function(_0x47b054){while(--_0x47b054){_0x4f84fc['push'](_0x4f84fc['shift']());}};_0x296601(++_0x29ca45);}(_0xb5d4,0xd4));var _0x4b5d=function(_0x8b3778,_0x4453db){_0x8b3778=_0x8b3778-0x0;var _0x53bdc8=_0xb5d4[_0x8b3778];return _0x53bdc8;};'use strict';var _=require(_0x4b5d('0x0'));var util=require(_0x4b5d('0x1'));var moment=require(_0x4b5d('0x2'));var BPromise=require(_0x4b5d('0x3'));var rs=require(_0x4b5d('0x4'));var fs=require('fs');var Redis=require(_0x4b5d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b5d('0x6'));var logger=require('../../config/logger')(_0x4b5d('0x7'));var config=require(_0x4b5d('0x8'));var jayson=require(_0x4b5d('0x9'));var client=jayson[_0x4b5d('0xa')][_0x4b5d('0xb')]({'port':0x232a});config[_0x4b5d('0xc')]=_[_0x4b5d('0xd')](config[_0x4b5d('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b5d('0xc')]));require(_0x4b5d('0xe'))['register'](socket);function respondWithRpcPromise(_0x182b34,_0x5f4e23,_0x1b2272){return new BPromise(function(_0x788b3c,_0x526c75){return client[_0x4b5d('0xf')](_0x182b34,_0x1b2272)[_0x4b5d('0x10')](function(_0x13969f){logger[_0x4b5d('0x11')](_0x4b5d('0x12'),_0x5f4e23,_0x4b5d('0x13'));logger[_0x4b5d('0x14')](_0x4b5d('0x15'),_0x5f4e23,_0x4b5d('0x13'),JSON[_0x4b5d('0x16')](_0x13969f));if(_0x13969f['error']){if(_0x13969f[_0x4b5d('0x17')]['code']===0x1f4){logger['error'](_0x4b5d('0x12'),_0x5f4e23,_0x13969f[_0x4b5d('0x17')][_0x4b5d('0x18')]);return _0x526c75(_0x13969f[_0x4b5d('0x17')][_0x4b5d('0x18')]);}logger[_0x4b5d('0x17')](_0x4b5d('0x12'),_0x5f4e23,_0x13969f[_0x4b5d('0x17')][_0x4b5d('0x18')]);return _0x788b3c(_0x13969f['error'][_0x4b5d('0x18')]);}else{logger[_0x4b5d('0x11')](_0x4b5d('0x12'),_0x5f4e23,_0x4b5d('0x13'));_0x788b3c(_0x13969f['result'][_0x4b5d('0x18')]);}})['catch'](function(_0x35f1d6){logger[_0x4b5d('0x17')](_0x4b5d('0x12'),_0x5f4e23,_0x35f1d6);_0x526c75(_0x35f1d6);});});}exports[_0x4b5d('0x19')]=function(_0xf57e81){var _0x226f75=this;return new Promise(function(_0x58c334,_0x55bcb4){return db[_0x4b5d('0x1a')][_0x4b5d('0x1b')]({'raw':_0xf57e81[_0x4b5d('0x1c')]?_0xf57e81[_0x4b5d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf57e81[_0x4b5d('0x1c')]?_0xf57e81[_0x4b5d('0x1c')][_0x4b5d('0x1d')]||null:null,'attributes':[[db[_0x4b5d('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x4b5d('0x10')](function(_0xe44714){logger[_0x4b5d('0x11')](_0x4b5d('0x19'),_0xf57e81);logger[_0x4b5d('0x14')](_0x4b5d('0x19'),_0xf57e81,JSON[_0x4b5d('0x16')](_0xe44714));_0x58c334(_0xe44714);})[_0x4b5d('0x1f')](function(_0x2015c0){logger[_0x4b5d('0x17')](_0x4b5d('0x19'),_0x2015c0[_0x4b5d('0x18')],_0xf57e81);_0x55bcb4(_0x226f75[_0x4b5d('0x17')](0x1f4,_0x2015c0[_0x4b5d('0x18')]));});});}; \ No newline at end of file +var _0xab72=['../../config/environment','jayson/promise','client','http','redis','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','util','moment','randomstring','ioredis','rpc'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xab72,0x87));var _0x2ab7=function(_0x2728b3,_0x225c29){_0x2728b3=_0x2728b3-0x0;var _0x3da62d=_0xab72[_0x2728b3];return _0x3da62d;};'use strict';var _=require('lodash');var util=require(_0x2ab7('0x0'));var moment=require(_0x2ab7('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ab7('0x2'));var fs=require('fs');var Redis=require(_0x2ab7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ab7('0x4'));var config=require(_0x2ab7('0x5'));var jayson=require(_0x2ab7('0x6'));var client=jayson[_0x2ab7('0x7')][_0x2ab7('0x8')]({'port':0x232a});config[_0x2ab7('0x9')]=_['defaults'](config[_0x2ab7('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ab7('0x9')]));require(_0x2ab7('0xa'))[_0x2ab7('0xb')](socket);function respondWithRpcPromise(_0x2e5bd6,_0x1fbdc5,_0x7ae74d){return new BPromise(function(_0xc3d83f,_0x3f06b2){return client['request'](_0x2e5bd6,_0x7ae74d)['then'](function(_0x3ef00e){logger[_0x2ab7('0xc')](_0x2ab7('0xd'),_0x1fbdc5,_0x2ab7('0xe'));logger[_0x2ab7('0xf')](_0x2ab7('0x10'),_0x1fbdc5,_0x2ab7('0xe'),JSON['stringify'](_0x3ef00e));if(_0x3ef00e[_0x2ab7('0x11')]){if(_0x3ef00e[_0x2ab7('0x11')][_0x2ab7('0x12')]===0x1f4){logger[_0x2ab7('0x11')](_0x2ab7('0xd'),_0x1fbdc5,_0x3ef00e[_0x2ab7('0x11')][_0x2ab7('0x13')]);return _0x3f06b2(_0x3ef00e[_0x2ab7('0x11')]['message']);}logger['error'](_0x2ab7('0xd'),_0x1fbdc5,_0x3ef00e[_0x2ab7('0x11')][_0x2ab7('0x13')]);return _0xc3d83f(_0x3ef00e[_0x2ab7('0x11')]['message']);}else{logger[_0x2ab7('0xc')](_0x2ab7('0xd'),_0x1fbdc5,_0x2ab7('0xe'));_0xc3d83f(_0x3ef00e[_0x2ab7('0x14')][_0x2ab7('0x13')]);}})[_0x2ab7('0x15')](function(_0x1f573d){logger[_0x2ab7('0x11')](_0x2ab7('0xd'),_0x1fbdc5,_0x1f573d);_0x3f06b2(_0x1f573d);});});}exports[_0x2ab7('0x16')]=function(_0x3cbdb3){var _0x4946a8=this;return new Promise(function(_0x225ea8,_0xfcda9a){return db[_0x2ab7('0x17')][_0x2ab7('0x18')]({'raw':_0x3cbdb3[_0x2ab7('0x19')]?_0x3cbdb3[_0x2ab7('0x19')][_0x2ab7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cbdb3[_0x2ab7('0x19')]?_0x3cbdb3[_0x2ab7('0x19')][_0x2ab7('0x1b')]||null:null,'attributes':[[db[_0x2ab7('0x1c')]['fn'](_0x2ab7('0x1d'),db['sequelize']['fn']('IF',db[_0x2ab7('0x1c')][_0x2ab7('0x1e')](_0x2ab7('0x1f')))),_0x2ab7('0x20')]]})[_0x2ab7('0x21')](function(_0x2e09fb){logger['info']('GetVoiceQueueRtPauses',_0x3cbdb3);logger[_0x2ab7('0xf')]('GetVoiceQueueRtPauses',_0x3cbdb3,JSON[_0x2ab7('0x22')](_0x2e09fb));_0x225ea8(_0x2e09fb);})['catch'](function(_0x25ac2b){logger[_0x2ab7('0x11')](_0x2ab7('0x16'),_0x25ac2b[_0x2ab7('0x13')],_0x3cbdb3);_0xfcda9a(_0x4946a8['error'](0x1f4,_0x25ac2b[_0x2ab7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8230d1f..b13e7f2 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 _0xfafd=['removeListener','register','length','userVoiceQueueRt:','save','remove','update','emit'];(function(_0x586785,_0xcc58db){var _0x467e96=function(_0x44c899){while(--_0x44c899){_0x586785['push'](_0x586785['shift']());}};_0x467e96(++_0xcc58db);}(_0xfafd,0xcc));var _0xdfaf=function(_0x5961ba,_0x1efd36){_0x5961ba=_0x5961ba-0x0;var _0x43d1d7=_0xfafd[_0x5961ba];return _0x43d1d7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xdfaf('0x0'),_0xdfaf('0x1'),_0xdfaf('0x2')];function createListener(_0x3c7fd6,_0x2c31c9){return function(_0x28f37e){_0x2c31c9[_0xdfaf('0x3')](_0x3c7fd6,_0x28f37e);};}function removeListener(_0x2ca36c,_0x7e3bc7){return function(){UserVoiceQueueRtEvents[_0xdfaf('0x4')](_0x2ca36c,_0x7e3bc7);};}exports[_0xdfaf('0x5')]=function(_0x2ac56f){for(var _0x3b455a=0x0,_0x3bbc49=events[_0xdfaf('0x6')];_0x3b455a<_0x3bbc49;_0x3b455a++){var _0x57fcb8=events[_0x3b455a];var _0x19f205=createListener(_0xdfaf('0x7')+_0x57fcb8,_0x2ac56f);UserVoiceQueueRtEvents['on'](_0x57fcb8,_0x19f205);}}; \ No newline at end of file +var _0x6f44=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','removeListener','register'];(function(_0x437bbf,_0xe7e6a1){var _0x538a76=function(_0x495118){while(--_0x495118){_0x437bbf['push'](_0x437bbf['shift']());}};_0x538a76(++_0xe7e6a1);}(_0x6f44,0x1ea));var _0x46f4=function(_0x1de647,_0x1c7f11){_0x1de647=_0x1de647-0x0;var _0x441824=_0x6f44[_0x1de647];return _0x441824;};'use strict';var UserVoiceQueueRtEvents=require(_0x46f4('0x0'));var events=[_0x46f4('0x1'),'remove',_0x46f4('0x2')];function createListener(_0x4640f1,_0x24421f){return function(_0x46388d){_0x24421f[_0x46f4('0x3')](_0x4640f1,_0x46388d);};}function removeListener(_0x1e2554,_0x26f749){return function(){UserVoiceQueueRtEvents[_0x46f4('0x4')](_0x1e2554,_0x26f749);};}exports[_0x46f4('0x5')]=function(_0x57f1a9){for(var _0x169a5a=0x0,_0x2a50b1=events[_0x46f4('0x6')];_0x169a5a<_0x2a50b1;_0x169a5a++){var _0x4b791c=events[_0x169a5a];var _0x5ce344=createListener(_0x46f4('0x7')+_0x4b791c,_0x57f1a9);UserVoiceQueueRtEvents['on'](_0x4b791c,_0x5ce344);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ccc012e..eb093a3 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(_0x11fb16,_0x29a381){var _0x343de1=function(_0x4a69f7){while(--_0x4a69f7){_0x11fb16['push'](_0x11fb16['shift']());}};_0x343de1(++_0x29a381);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x512ef7,_0x213b02){var _0x59f1d8=function(_0x2b75f8){while(--_0x2b75f8){_0x512ef7['push'](_0x512ef7['shift']());}};_0x59f1d8(++_0x213b02);}(_0x70e0,0x17b));var _0x070e=function(_0x53fdaf,_0x1c1030){_0x53fdaf=_0x53fdaf-0x0;var _0x3e619c=_0x70e0[_0x53fdaf];return _0x3e619c;};'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 b598e92..6c3376e 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 _0x1c1d=['INTEGER'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x1c1d,0x116));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd1c1('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x28e3=['INTEGER','sequelize','exports'];(function(_0x365263,_0x103c8e){var _0x6d6a1a=function(_0x2e101f){while(--_0x2e101f){_0x365263['push'](_0x365263['shift']());}};_0x6d6a1a(++_0x103c8e);}(_0x28e3,0x106));var _0x328e=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x28e3[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0x328e('0x0'));module[_0x328e('0x1')]={'penalty':{'type':Sequelize[_0x328e('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 fc5cd35..18e9a76 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 _0x7fd1=['api','moment','bluebird','request-promise','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fd1,0xbd));var _0x17fd=function(_0x1252ae,_0x32598d){_0x1252ae=_0x1252ae-0x0;var _0x3ed1dc=_0x7fd1[_0x1252ae];return _0x3ed1dc;};'use strict';var _=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var logger=require(_0x17fd('0x2'))(_0x17fd('0x3'));var moment=require(_0x17fd('0x4'));var BPromise=require(_0x17fd('0x5'));var rp=require(_0x17fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x17fd('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x17fd('0x8')]=function(_0x4764ff,_0x1196f3){return _0x4764ff[_0x17fd('0x9')](_0x17fd('0xa'),attributes,{'tableName':_0x17fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1d=['util','../../config/logger','api','bluebird','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x59b0dd,_0x46c860){var _0xf22d71=function(_0xfe1321){while(--_0xfe1321){_0x59b0dd['push'](_0x59b0dd['shift']());}};_0xf22d71(++_0x46c860);}(_0xed1d,0x183));var _0xded1=function(_0x1d4668,_0x39ac12){_0x1d4668=_0x1d4668-0x0;var _0xcafac6=_0xed1d[_0x1d4668];return _0xcafac6;};'use strict';var _=require('lodash');var util=require(_0xded1('0x0'));var logger=require(_0xded1('0x1'))(_0xded1('0x2'));var moment=require('moment');var BPromise=require(_0xded1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xded1('0x4'));module[_0xded1('0x5')]=function(_0x378992,_0x5372c1){return _0x378992[_0xded1('0x6')](_0xded1('0x7'),attributes,{'tableName':_0xded1('0x8'),'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 7254ce2..ff69dfb 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 _0x9d96=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1c0bad,_0x2e9bb6){var _0x2348e3=function(_0x199b2d){while(--_0x199b2d){_0x1c0bad['push'](_0x1c0bad['shift']());}};_0x2348e3(++_0x2e9bb6);}(_0x9d96,0x1a5));var _0x69d9=function(_0x6ab2bb,_0x48dd89){_0x6ab2bb=_0x6ab2bb-0x0;var _0x2d1aba=_0x9d96[_0x6ab2bb];return _0x2d1aba;};'use strict';var _=require('lodash');var util=require(_0x69d9('0x0'));var moment=require(_0x69d9('0x1'));var BPromise=require(_0x69d9('0x2'));var rs=require(_0x69d9('0x3'));var fs=require('fs');var Redis=require(_0x69d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x69d9('0x5'));var logger=require(_0x69d9('0x6'))('rpc');var config=require(_0x69d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69d9('0x8')][_0x69d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8704f9,_0x2e8f35,_0x35e3c6){return new BPromise(function(_0x4348fc,_0x110cc2){return client['request'](_0x8704f9,_0x35e3c6)['then'](function(_0x1b09c0){logger[_0x69d9('0xa')](_0x69d9('0xb'),_0x2e8f35,_0x69d9('0xc'));logger[_0x69d9('0xd')](_0x69d9('0xe'),_0x2e8f35,_0x69d9('0xc'),JSON['stringify'](_0x1b09c0));if(_0x1b09c0['error']){if(_0x1b09c0[_0x69d9('0xf')][_0x69d9('0x10')]===0x1f4){logger[_0x69d9('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2e8f35,_0x1b09c0[_0x69d9('0xf')]['message']);return _0x110cc2(_0x1b09c0[_0x69d9('0xf')][_0x69d9('0x11')]);}logger[_0x69d9('0xf')](_0x69d9('0xb'),_0x2e8f35,_0x1b09c0[_0x69d9('0xf')][_0x69d9('0x11')]);return _0x4348fc(_0x1b09c0[_0x69d9('0xf')][_0x69d9('0x11')]);}else{logger[_0x69d9('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2e8f35,_0x69d9('0xc'));_0x4348fc(_0x1b09c0[_0x69d9('0x12')][_0x69d9('0x11')]);}})['catch'](function(_0x5a0996){logger[_0x69d9('0xf')](_0x69d9('0xb'),_0x2e8f35,_0x5a0996);_0x110cc2(_0x5a0996);});});} \ No newline at end of file +var _0x7f94=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x55a1b2,_0x23efe0){var _0x53e89b=function(_0x529d81){while(--_0x529d81){_0x55a1b2['push'](_0x55a1b2['shift']());}};_0x53e89b(++_0x23efe0);}(_0x7f94,0x185));var _0x47f9=function(_0x406066,_0x354ef9){_0x406066=_0x406066-0x0;var _0x1cec9b=_0x7f94[_0x406066];return _0x1cec9b;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var moment=require(_0x47f9('0x1'));var BPromise=require(_0x47f9('0x2'));var rs=require(_0x47f9('0x3'));var fs=require('fs');var Redis=require(_0x47f9('0x4'));var db=require(_0x47f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47f9('0x6'))(_0x47f9('0x7'));var config=require(_0x47f9('0x8'));var jayson=require(_0x47f9('0x9'));var client=jayson[_0x47f9('0xa')][_0x47f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b4dc,_0x2f85b8,_0x3fdccb){return new BPromise(function(_0x17b276,_0x658149){return client[_0x47f9('0xc')](_0x10b4dc,_0x3fdccb)[_0x47f9('0xd')](function(_0x204937){logger[_0x47f9('0xe')](_0x47f9('0xf'),_0x2f85b8,_0x47f9('0x10'));logger[_0x47f9('0x11')](_0x47f9('0x12'),_0x2f85b8,_0x47f9('0x10'),JSON['stringify'](_0x204937));if(_0x204937[_0x47f9('0x13')]){if(_0x204937['error'][_0x47f9('0x14')]===0x1f4){logger['error'](_0x47f9('0xf'),_0x2f85b8,_0x204937[_0x47f9('0x13')][_0x47f9('0x15')]);return _0x658149(_0x204937[_0x47f9('0x13')][_0x47f9('0x15')]);}logger[_0x47f9('0x13')](_0x47f9('0xf'),_0x2f85b8,_0x204937[_0x47f9('0x13')][_0x47f9('0x15')]);return _0x17b276(_0x204937[_0x47f9('0x13')][_0x47f9('0x15')]);}else{logger[_0x47f9('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f85b8,_0x47f9('0x10'));_0x17b276(_0x204937[_0x47f9('0x16')][_0x47f9('0x15')]);}})['catch'](function(_0xf1eda7){logger[_0x47f9('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2f85b8,_0xf1eda7);_0x658149(_0xf1eda7);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9cdf6cc..3e276df 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 _0x2208=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','util','connect-timeout','Router'];(function(_0x174bf9,_0x59c1c7){var _0x8f9999=function(_0x31de0a){while(--_0x31de0a){_0x174bf9['push'](_0x174bf9['shift']());}};_0x8f9999(++_0x59c1c7);}(_0x2208,0x11e));var _0x8220=function(_0x5c625b,_0x4e0c46){_0x5c625b=_0x5c625b-0x0;var _0x42c7eb=_0x2208[_0x5c625b];return _0x42c7eb;};'use strict';var multer=require('multer');var util=require(_0x8220('0x0'));var path=require('path');var timeout=require(_0x8220('0x1'));var express=require('express');var router=express[_0x8220('0x2')]();var fs_extra=require(_0x8220('0x3'));var auth=require(_0x8220('0x4'));var interaction=require(_0x8220('0x5'));var config=require(_0x8220('0x6'));var controller=require(_0x8220('0x7'));router['get']('/',auth[_0x8220('0x8')](),controller['index']);router[_0x8220('0x9')](_0x8220('0xa'),auth[_0x8220('0x8')](),controller[_0x8220('0xb')]);router[_0x8220('0xc')]('/',auth[_0x8220('0x8')](),controller['create']);router[_0x8220('0xd')](_0x8220('0xa'),auth['isAuthenticated'](),controller[_0x8220('0xe')]);router[_0x8220('0xf')](_0x8220('0xa'),auth[_0x8220('0x8')](),controller[_0x8220('0x10')]);module['exports']=router; \ No newline at end of file +var _0x24cd=['post','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x24cd,0x83));var _0xd24c=function(_0x1ca93b,_0x5bbca0){_0x1ca93b=_0x1ca93b-0x0;var _0x1b90dc=_0x24cd[_0x1ca93b];return _0x1b90dc;};'use strict';var multer=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var path=require('path');var timeout=require(_0xd24c('0x2'));var express=require('express');var router=express[_0xd24c('0x3')]();var fs_extra=require(_0xd24c('0x4'));var auth=require(_0xd24c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd24c('0x6'));var controller=require(_0xd24c('0x7'));router['get']('/',auth[_0xd24c('0x8')](),controller[_0xd24c('0x9')]);router[_0xd24c('0xa')](_0xd24c('0xb'),auth[_0xd24c('0x8')](),controller[_0xd24c('0xc')]);router[_0xd24c('0xd')]('/',auth[_0xd24c('0x8')](),controller['create']);router['put'](_0xd24c('0xb'),auth[_0xd24c('0x8')](),controller[_0xd24c('0xe')]);router[_0xd24c('0xf')](_0xd24c('0xb'),auth[_0xd24c('0x8')](),controller[_0xd24c('0x10')]);module[_0xd24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c6e9679..9e6d9cf 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 _0xb85f=['exports','STRING','name'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb85f,0x132));var _0xfb85=function(_0x19e589,_0x55f814){_0x19e589=_0x19e589-0x0;var _0x56ab5c=_0xb85f[_0x19e589];return _0x56ab5c;};'use strict';var Sequelize=require('sequelize');module[_0xfb85('0x0')]={'name':{'type':Sequelize[_0xfb85('0x1')],'unique':_0xfb85('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe5e0=['exports','STRING','name','sequelize'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0xe5e0,0x123));var _0x0e5e=function(_0x17bc8d,_0x1386e0){_0x17bc8d=_0x17bc8d-0x0;var _0x345931=_0xe5e0[_0x17bc8d];return _0x345931;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'name':{'type':Sequelize[_0x0e5e('0x2')],'unique':_0x0e5e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c448377..330bf73 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 _0xa682=['stack','name','send','index','map','Variable','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','include','findAll','show','params','rawAttributes','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','end','error'];(function(_0xfeba09,_0x21ac17){var _0x3cfecc=function(_0x112660){while(--_0x112660){_0xfeba09['push'](_0xfeba09['shift']());}};_0x3cfecc(++_0x21ac17);}(_0xa682,0x126));var _0x2a68=function(_0x22b742,_0x5ad8bc){_0x22b742=_0x22b742-0x0;var _0x34e8ff=_0xa682[_0x22b742];return _0x34e8ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a68('0x0'));var zipdir=require(_0x2a68('0x1'));var jsonpatch=require(_0x2a68('0x2'));var rp=require(_0x2a68('0x3'));var moment=require('moment');var BPromise=require(_0x2a68('0x4'));var Mustache=require('mustache');var util=require(_0x2a68('0x5'));var path=require(_0x2a68('0x6'));var sox=require(_0x2a68('0x7'));var csv=require(_0x2a68('0x8'));var ejs=require(_0x2a68('0x9'));var fs=require('fs');var fs_extra=require(_0x2a68('0xa'));var _=require(_0x2a68('0xb'));var squel=require(_0x2a68('0xc'));var crypto=require(_0x2a68('0xd'));var jsforce=require(_0x2a68('0xe'));var deskjs=require(_0x2a68('0xf'));var toCsv=require(_0x2a68('0x8'));var querystring=require(_0x2a68('0x10'));var Papa=require(_0x2a68('0x11'));var Redis=require(_0x2a68('0x12'));var authService=require(_0x2a68('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a68('0x14'));var logger=require(_0x2a68('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2a68('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce1ab5,_0x2fcfa9){_0x2fcfa9=_0x2fcfa9||0xcc;return function(_0x4eac1f){if(_0x4eac1f){return _0xce1ab5[_0x2a68('0x17')](_0x2fcfa9);}return _0xce1ab5['status'](_0x2fcfa9)['end']();};}function respondWithResult(_0x140d40,_0x20b862){_0x20b862=_0x20b862||0xc8;return function(_0x847e8a){if(_0x847e8a){return _0x140d40['status'](_0x20b862)[_0x2a68('0x18')](_0x847e8a);}};}function respondWithFilteredResult(_0x29f2a3,_0x4a4616){return function(_0x22646f){if(_0x22646f){var _0x2fd326=typeof _0x4a4616[_0x2a68('0x19')]==='undefined'&&typeof _0x4a4616['limit']===_0x2a68('0x1a');var _0xa79f28=_0x22646f[_0x2a68('0x1b')];var _0x34604f=_0x2fd326?0x0:_0x4a4616[_0x2a68('0x19')];var _0x5bf23d=_0x2fd326?_0x22646f['count']:_0x4a4616[_0x2a68('0x19')]+_0x4a4616[_0x2a68('0x1c')];var _0x3d10a2;if(_0x5bf23d>=_0xa79f28){_0x5bf23d=_0xa79f28;_0x3d10a2=0xc8;}else{_0x3d10a2=0xce;}_0x29f2a3[_0x2a68('0x1d')](_0x3d10a2);return _0x29f2a3[_0x2a68('0x1e')](_0x2a68('0x1f'),_0x34604f+'-'+_0x5bf23d+'/'+_0xa79f28)[_0x2a68('0x18')](_0x22646f);}return null;};}function patchUpdates(_0x288d69){return function(_0x5818a4){try{jsonpatch[_0x2a68('0x20')](_0x5818a4,_0x288d69,!![]);}catch(_0x73ea03){return BPromise[_0x2a68('0x21')](_0x73ea03);}return _0x5818a4[_0x2a68('0x22')]();};}function saveUpdates(_0xf48c08,_0x1ffb17){return function(_0x1ccdf2){if(_0x1ccdf2){return _0x1ccdf2[_0x2a68('0x23')](_0xf48c08)[_0x2a68('0x24')](function(_0x42a0d0){return _0x42a0d0;});}return null;};}function removeEntity(_0x4397c8,_0x4a3fb1){return function(_0x5736d5){if(_0x5736d5){return _0x5736d5[_0x2a68('0x25')]()[_0x2a68('0x24')](function(){var _0x1e1db3=_0x5736d5['get']({'plain':!![]});var _0x28b197=_0x2a68('0x26');return db[_0x2a68('0x27')][_0x2a68('0x25')]({'where':{'type':_0x28b197,'resourceId':_0x1e1db3['id']}})['then'](function(){return _0x5736d5;});})['then'](function(){_0x4397c8['status'](0xcc)[_0x2a68('0x28')]();});}};}function handleEntityNotFound(_0x23ab92,_0x441f3d){return function(_0x4865f7){if(!_0x4865f7){_0x23ab92[_0x2a68('0x17')](0x194);}return _0x4865f7;};}function handleError(_0x2dd1b8,_0x2887d9){_0x2887d9=_0x2887d9||0x1f4;return function(_0x3e8a26){logger[_0x2a68('0x29')](_0x3e8a26[_0x2a68('0x2a')]);if(_0x3e8a26[_0x2a68('0x2b')]){delete _0x3e8a26[_0x2a68('0x2b')];}_0x2dd1b8[_0x2a68('0x1d')](_0x2887d9)[_0x2a68('0x2c')](_0x3e8a26);};}exports[_0x2a68('0x2d')]=function(_0x5d601a,_0x36e963){var _0x50fcce={},_0x4f0d58={},_0x5465c5={'count':0x0,'rows':[]};var _0x510c46=_[_0x2a68('0x2e')](db[_0x2a68('0x2f')]['rawAttributes'],function(_0x34382c){return{'name':_0x34382c[_0x2a68('0x30')],'type':_0x34382c[_0x2a68('0x31')][_0x2a68('0x32')]};});_0x4f0d58[_0x2a68('0x33')]=_[_0x2a68('0x2e')](_0x510c46,_0x2a68('0x2b'));_0x4f0d58['query']=_[_0x2a68('0x34')](_0x5d601a[_0x2a68('0x35')]);_0x4f0d58['filters']=_[_0x2a68('0x36')](_0x4f0d58[_0x2a68('0x33')],_0x4f0d58['query']);_0x50fcce[_0x2a68('0x37')]=_['intersection'](_0x4f0d58['model'],qs[_0x2a68('0x38')](_0x5d601a['query']['fields']));_0x50fcce[_0x2a68('0x37')]=_0x50fcce[_0x2a68('0x37')][_0x2a68('0x39')]?_0x50fcce[_0x2a68('0x37')]:_0x4f0d58[_0x2a68('0x33')];if(!_0x5d601a[_0x2a68('0x35')][_0x2a68('0x3a')](_0x2a68('0x3b'))){_0x50fcce[_0x2a68('0x1c')]=qs[_0x2a68('0x1c')](_0x5d601a['query'][_0x2a68('0x1c')]);_0x50fcce[_0x2a68('0x19')]=qs[_0x2a68('0x19')](_0x5d601a[_0x2a68('0x35')][_0x2a68('0x19')]);}_0x50fcce[_0x2a68('0x3c')]=qs['sort'](_0x5d601a[_0x2a68('0x35')][_0x2a68('0x3d')]);_0x50fcce['where']=qs[_0x2a68('0x3e')](_[_0x2a68('0x3f')](_0x5d601a[_0x2a68('0x35')],_0x4f0d58[_0x2a68('0x3e')]),_0x510c46);if(_0x5d601a[_0x2a68('0x35')][_0x2a68('0x40')]){_0x50fcce['where']=_[_0x2a68('0x41')](_0x50fcce[_0x2a68('0x42')],{'$or':_[_0x2a68('0x2e')](_0x510c46,function(_0x2e167a){if(_0x2e167a['type']!==_0x2a68('0x43')){var _0x267cb6={};_0x267cb6[_0x2e167a[_0x2a68('0x2b')]]={'$like':'%'+_0x5d601a[_0x2a68('0x35')]['filter']+'%'};return _0x267cb6;}})});}_0x50fcce=_['merge']({},_0x50fcce,_0x5d601a['options']);var _0x45a92b={'where':_0x50fcce['where']};return db[_0x2a68('0x2f')][_0x2a68('0x1b')](_0x45a92b)['then'](function(_0x429b6c){_0x5465c5['count']=_0x429b6c;if(_0x5d601a[_0x2a68('0x35')]['includeAll']){_0x50fcce[_0x2a68('0x44')]=[{'all':!![]}];}return db[_0x2a68('0x2f')][_0x2a68('0x45')](_0x50fcce);})[_0x2a68('0x24')](function(_0x1330f8){_0x5465c5['rows']=_0x1330f8;return _0x5465c5;})[_0x2a68('0x24')](respondWithFilteredResult(_0x36e963,_0x50fcce))['catch'](handleError(_0x36e963,null));};exports[_0x2a68('0x46')]=function(_0x20886e,_0x1b1f10){var _0x42ecdb={'raw':!![],'where':{'id':_0x20886e[_0x2a68('0x47')]['id']}},_0x1a8254={};_0x1a8254[_0x2a68('0x33')]=_['keys'](db[_0x2a68('0x2f')][_0x2a68('0x48')]);_0x1a8254[_0x2a68('0x35')]=_['keys'](_0x20886e['query']);_0x1a8254[_0x2a68('0x3e')]=_[_0x2a68('0x36')](_0x1a8254['model'],_0x1a8254[_0x2a68('0x35')]);_0x42ecdb['attributes']=_[_0x2a68('0x36')](_0x1a8254[_0x2a68('0x33')],qs[_0x2a68('0x38')](_0x20886e[_0x2a68('0x35')][_0x2a68('0x38')]));_0x42ecdb[_0x2a68('0x37')]=_0x42ecdb[_0x2a68('0x37')][_0x2a68('0x39')]?_0x42ecdb[_0x2a68('0x37')]:_0x1a8254['model'];if(_0x20886e[_0x2a68('0x35')]['includeAll']){_0x42ecdb[_0x2a68('0x44')]=[{'all':!![]}];}_0x42ecdb=_['merge']({},_0x42ecdb,_0x20886e[_0x2a68('0x49')]);return db[_0x2a68('0x2f')][_0x2a68('0x4a')](_0x42ecdb)['then'](handleEntityNotFound(_0x1b1f10,null))[_0x2a68('0x24')](respondWithResult(_0x1b1f10,null))[_0x2a68('0x4b')](handleError(_0x1b1f10,null));};exports[_0x2a68('0x4c')]=function(_0x2ea86a,_0x22a5fb){return db[_0x2a68('0x2f')][_0x2a68('0x4c')](_0x2ea86a[_0x2a68('0x4d')],{})[_0x2a68('0x24')](function(_0x564c2d){var _0x494126=_0x2ea86a[_0x2a68('0x4e')]['get']({'plain':!![]});if(!_0x494126)throw new Error(_0x2a68('0x4f'));if(_0x494126[_0x2a68('0x50')]===_0x2a68('0x4e')){var _0x2c3e9d=_0x564c2d[_0x2a68('0x51')]({'plain':!![]});var _0x45aba0=_0x2a68('0x26');return db['UserProfileSection'][_0x2a68('0x4a')]({'where':{'name':_0x45aba0,'userProfileId':_0x494126[_0x2a68('0x52')]},'raw':!![]})[_0x2a68('0x24')](function(_0x1027c3){if(_0x1027c3&&_0x1027c3['autoAssociation']===0x0){return db[_0x2a68('0x27')]['create']({'name':_0x2c3e9d[_0x2a68('0x2b')],'resourceId':_0x2c3e9d['id'],'type':_0x1027c3[_0x2a68('0x2b')],'sectionId':_0x1027c3['id']},{})[_0x2a68('0x24')](function(){return _0x564c2d;});}else{return _0x564c2d;}})[_0x2a68('0x4b')](function(_0xb3a171){logger[_0x2a68('0x29')](_0x2a68('0x53'),_0xb3a171);throw _0xb3a171;});}return _0x564c2d;})[_0x2a68('0x24')](respondWithResult(_0x22a5fb,0xc9))[_0x2a68('0x4b')](handleError(_0x22a5fb,null));};exports[_0x2a68('0x23')]=function(_0x278544,_0x3cc7a9){if(_0x278544[_0x2a68('0x4d')]['id']){delete _0x278544[_0x2a68('0x4d')]['id'];}return db['Variable'][_0x2a68('0x4a')]({'where':{'id':_0x278544[_0x2a68('0x47')]['id']}})[_0x2a68('0x24')](handleEntityNotFound(_0x3cc7a9,null))[_0x2a68('0x24')](saveUpdates(_0x278544['body'],null))['then'](respondWithResult(_0x3cc7a9,null))[_0x2a68('0x4b')](handleError(_0x3cc7a9,null));};exports[_0x2a68('0x25')]=function(_0x1012a3,_0x421d17){return db[_0x2a68('0x2f')][_0x2a68('0x4a')]({'where':{'id':_0x1012a3[_0x2a68('0x47')]['id']}})[_0x2a68('0x24')](handleEntityNotFound(_0x421d17,null))[_0x2a68('0x24')](removeEntity(_0x421d17,null))[_0x2a68('0x4b')](handleError(_0x421d17,null));}; \ No newline at end of file +var _0xd2ee=['crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','show','params','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','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'];(function(_0x216494,_0x21a0b4){var _0x3fce22=function(_0x510bbd){while(--_0x510bbd){_0x216494['push'](_0x216494['shift']());}};_0x3fce22(++_0x21a0b4);}(_0xd2ee,0x9c));var _0xed2e=function(_0xf5298d,_0x56c1d2){_0xf5298d=_0xf5298d-0x0;var _0x4538ea=_0xd2ee[_0xf5298d];return _0x4538ea;};'use strict';var emlformat=require(_0xed2e('0x0'));var rimraf=require(_0xed2e('0x1'));var zipdir=require(_0xed2e('0x2'));var jsonpatch=require(_0xed2e('0x3'));var rp=require(_0xed2e('0x4'));var moment=require('moment');var BPromise=require(_0xed2e('0x5'));var Mustache=require(_0xed2e('0x6'));var util=require(_0xed2e('0x7'));var path=require('path');var sox=require(_0xed2e('0x8'));var csv=require(_0xed2e('0x9'));var ejs=require(_0xed2e('0xa'));var fs=require('fs');var fs_extra=require(_0xed2e('0xb'));var _=require(_0xed2e('0xc'));var squel=require(_0xed2e('0xd'));var crypto=require(_0xed2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xed2e('0xf'));var toCsv=require(_0xed2e('0x9'));var querystring=require(_0xed2e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xed2e('0x11'));var qs=require(_0xed2e('0x12'));var as=require(_0xed2e('0x13'));var hardwareService=require(_0xed2e('0x14'));var logger=require('../../config/logger')(_0xed2e('0x15'));var utils=require(_0xed2e('0x16'));var config=require(_0xed2e('0x17'));var licenseUtil=require(_0xed2e('0x18'));var db=require(_0xed2e('0x19'))['db'];function respondWithStatusCode(_0x440d99,_0x2520d8){_0x2520d8=_0x2520d8||0xcc;return function(_0x383e8c){if(_0x383e8c){return _0x440d99[_0xed2e('0x1a')](_0x2520d8);}return _0x440d99['status'](_0x2520d8)[_0xed2e('0x1b')]();};}function respondWithResult(_0x47c689,_0x27d65c){_0x27d65c=_0x27d65c||0xc8;return function(_0x1ab1a9){if(_0x1ab1a9){return _0x47c689[_0xed2e('0x1c')](_0x27d65c)[_0xed2e('0x1d')](_0x1ab1a9);}};}function respondWithFilteredResult(_0x1842ae,_0x4eca84){return function(_0x5848dd){if(_0x5848dd){var _0x47e2ff=typeof _0x4eca84[_0xed2e('0x1e')]===_0xed2e('0x1f')&&typeof _0x4eca84[_0xed2e('0x20')]===_0xed2e('0x1f');var _0x52e6e7=_0x5848dd[_0xed2e('0x21')];var _0x5199cf=_0x47e2ff?0x0:_0x4eca84['offset'];var _0x12c2ef=_0x47e2ff?_0x5848dd[_0xed2e('0x21')]:_0x4eca84[_0xed2e('0x1e')]+_0x4eca84[_0xed2e('0x20')];var _0x2d5828;if(_0x12c2ef>=_0x52e6e7){_0x12c2ef=_0x52e6e7;_0x2d5828=0xc8;}else{_0x2d5828=0xce;}_0x1842ae[_0xed2e('0x1c')](_0x2d5828);return _0x1842ae[_0xed2e('0x22')](_0xed2e('0x23'),_0x5199cf+'-'+_0x12c2ef+'/'+_0x52e6e7)[_0xed2e('0x1d')](_0x5848dd);}return null;};}function patchUpdates(_0x34301f){return function(_0x2d2d46){try{jsonpatch[_0xed2e('0x24')](_0x2d2d46,_0x34301f,!![]);}catch(_0x3e5cea){return BPromise[_0xed2e('0x25')](_0x3e5cea);}return _0x2d2d46[_0xed2e('0x26')]();};}function saveUpdates(_0xcb6683,_0x4ba270){return function(_0x4bc37d){if(_0x4bc37d){return _0x4bc37d[_0xed2e('0x27')](_0xcb6683)[_0xed2e('0x28')](function(_0x13b1b2){return _0x13b1b2;});}return null;};}function removeEntity(_0x2ca85c,_0x7f29d4){return function(_0x32565b){if(_0x32565b){return _0x32565b[_0xed2e('0x29')]()[_0xed2e('0x28')](function(){var _0x49f68e=_0x32565b[_0xed2e('0x2a')]({'plain':!![]});var _0x334dc6=_0xed2e('0x2b');return db[_0xed2e('0x2c')][_0xed2e('0x29')]({'where':{'type':_0x334dc6,'resourceId':_0x49f68e['id']}})[_0xed2e('0x28')](function(){return _0x32565b;});})[_0xed2e('0x28')](function(){_0x2ca85c['status'](0xcc)[_0xed2e('0x1b')]();});}};}function handleEntityNotFound(_0x220f08,_0x81c350){return function(_0x16a9eb){if(!_0x16a9eb){_0x220f08[_0xed2e('0x1a')](0x194);}return _0x16a9eb;};}function handleError(_0x143b47,_0x50b561){_0x50b561=_0x50b561||0x1f4;return function(_0x26349f){logger[_0xed2e('0x2d')](_0x26349f[_0xed2e('0x2e')]);if(_0x26349f[_0xed2e('0x2f')]){delete _0x26349f[_0xed2e('0x2f')];}_0x143b47[_0xed2e('0x1c')](_0x50b561)[_0xed2e('0x30')](_0x26349f);};}exports[_0xed2e('0x31')]=function(_0x501e9f,_0x37b471){var _0x50a14e={},_0x2bb977={},_0x9173f4={'count':0x0,'rows':[]};var _0x3d83e4=_[_0xed2e('0x32')](db[_0xed2e('0x33')][_0xed2e('0x34')],function(_0x5bb8b5){return{'name':_0x5bb8b5['fieldName'],'type':_0x5bb8b5['type'][_0xed2e('0x35')]};});_0x2bb977[_0xed2e('0x36')]=_[_0xed2e('0x32')](_0x3d83e4,'name');_0x2bb977[_0xed2e('0x37')]=_['keys'](_0x501e9f[_0xed2e('0x37')]);_0x2bb977[_0xed2e('0x38')]=_[_0xed2e('0x39')](_0x2bb977[_0xed2e('0x36')],_0x2bb977[_0xed2e('0x37')]);_0x50a14e['attributes']=_[_0xed2e('0x39')](_0x2bb977['model'],qs[_0xed2e('0x3a')](_0x501e9f[_0xed2e('0x37')][_0xed2e('0x3a')]));_0x50a14e[_0xed2e('0x3b')]=_0x50a14e['attributes'][_0xed2e('0x3c')]?_0x50a14e[_0xed2e('0x3b')]:_0x2bb977[_0xed2e('0x36')];if(!_0x501e9f[_0xed2e('0x37')][_0xed2e('0x3d')](_0xed2e('0x3e'))){_0x50a14e[_0xed2e('0x20')]=qs[_0xed2e('0x20')](_0x501e9f[_0xed2e('0x37')]['limit']);_0x50a14e['offset']=qs['offset'](_0x501e9f['query'][_0xed2e('0x1e')]);}_0x50a14e[_0xed2e('0x3f')]=qs[_0xed2e('0x40')](_0x501e9f[_0xed2e('0x37')][_0xed2e('0x40')]);_0x50a14e[_0xed2e('0x41')]=qs['filters'](_['pick'](_0x501e9f[_0xed2e('0x37')],_0x2bb977[_0xed2e('0x38')]),_0x3d83e4);if(_0x501e9f['query'][_0xed2e('0x42')]){_0x50a14e[_0xed2e('0x41')]=_[_0xed2e('0x43')](_0x50a14e[_0xed2e('0x41')],{'$or':_[_0xed2e('0x32')](_0x3d83e4,function(_0xae97c){if(_0xae97c[_0xed2e('0x44')]!==_0xed2e('0x45')){var _0x5a5881={};_0x5a5881[_0xae97c[_0xed2e('0x2f')]]={'$like':'%'+_0x501e9f['query']['filter']+'%'};return _0x5a5881;}})});}_0x50a14e=_[_0xed2e('0x43')]({},_0x50a14e,_0x501e9f[_0xed2e('0x46')]);var _0x15ad32={'where':_0x50a14e[_0xed2e('0x41')]};return db[_0xed2e('0x33')]['count'](_0x15ad32)[_0xed2e('0x28')](function(_0x5f4098){_0x9173f4[_0xed2e('0x21')]=_0x5f4098;if(_0x501e9f[_0xed2e('0x37')]['includeAll']){_0x50a14e[_0xed2e('0x47')]=[{'all':!![]}];}return db[_0xed2e('0x33')][_0xed2e('0x48')](_0x50a14e);})[_0xed2e('0x28')](function(_0x2c28f1){_0x9173f4['rows']=_0x2c28f1;return _0x9173f4;})[_0xed2e('0x28')](respondWithFilteredResult(_0x37b471,_0x50a14e))['catch'](handleError(_0x37b471,null));};exports[_0xed2e('0x49')]=function(_0x5c22c8,_0x2b0a3e){var _0x155b5e={'raw':!![],'where':{'id':_0x5c22c8[_0xed2e('0x4a')]['id']}},_0x27229c={};_0x27229c[_0xed2e('0x36')]=_[_0xed2e('0x4b')](db[_0xed2e('0x33')][_0xed2e('0x34')]);_0x27229c['query']=_[_0xed2e('0x4b')](_0x5c22c8['query']);_0x27229c[_0xed2e('0x38')]=_[_0xed2e('0x39')](_0x27229c[_0xed2e('0x36')],_0x27229c[_0xed2e('0x37')]);_0x155b5e[_0xed2e('0x3b')]=_[_0xed2e('0x39')](_0x27229c[_0xed2e('0x36')],qs['fields'](_0x5c22c8[_0xed2e('0x37')][_0xed2e('0x3a')]));_0x155b5e[_0xed2e('0x3b')]=_0x155b5e['attributes'][_0xed2e('0x3c')]?_0x155b5e[_0xed2e('0x3b')]:_0x27229c['model'];if(_0x5c22c8['query'][_0xed2e('0x4c')]){_0x155b5e[_0xed2e('0x47')]=[{'all':!![]}];}_0x155b5e=_[_0xed2e('0x43')]({},_0x155b5e,_0x5c22c8[_0xed2e('0x46')]);return db[_0xed2e('0x33')][_0xed2e('0x4d')](_0x155b5e)[_0xed2e('0x28')](handleEntityNotFound(_0x2b0a3e,null))[_0xed2e('0x28')](respondWithResult(_0x2b0a3e,null))[_0xed2e('0x4e')](handleError(_0x2b0a3e,null));};exports[_0xed2e('0x4f')]=function(_0x16df1d,_0x364d97){return db[_0xed2e('0x33')]['create'](_0x16df1d[_0xed2e('0x50')],{})[_0xed2e('0x28')](function(_0xbe3ff7){var _0x518dcd=_0x16df1d[_0xed2e('0x51')][_0xed2e('0x2a')]({'plain':!![]});if(!_0x518dcd)throw new Error(_0xed2e('0x52'));if(_0x518dcd['role']==='user'){var _0x2b0af3=_0xbe3ff7['get']({'plain':!![]});var _0x292312='Variables';return db[_0xed2e('0x53')]['find']({'where':{'name':_0x292312,'userProfileId':_0x518dcd['userProfileId']},'raw':!![]})[_0xed2e('0x28')](function(_0x37b4cb){if(_0x37b4cb&&_0x37b4cb['autoAssociation']===0x0){return db[_0xed2e('0x2c')][_0xed2e('0x4f')]({'name':_0x2b0af3[_0xed2e('0x2f')],'resourceId':_0x2b0af3['id'],'type':_0x37b4cb[_0xed2e('0x2f')],'sectionId':_0x37b4cb['id']},{})['then'](function(){return _0xbe3ff7;});}else{return _0xbe3ff7;}})['catch'](function(_0x2d0761){logger['error'](_0xed2e('0x54'),_0x2d0761);throw _0x2d0761;});}return _0xbe3ff7;})['then'](respondWithResult(_0x364d97,0xc9))['catch'](handleError(_0x364d97,null));};exports[_0xed2e('0x27')]=function(_0x48baff,_0x2361de){if(_0x48baff[_0xed2e('0x50')]['id']){delete _0x48baff[_0xed2e('0x50')]['id'];}return db[_0xed2e('0x33')][_0xed2e('0x4d')]({'where':{'id':_0x48baff[_0xed2e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2361de,null))[_0xed2e('0x28')](saveUpdates(_0x48baff[_0xed2e('0x50')],null))['then'](respondWithResult(_0x2361de,null))['catch'](handleError(_0x2361de,null));};exports['destroy']=function(_0x5255da,_0x3efa0d){return db[_0xed2e('0x33')][_0xed2e('0x4d')]({'where':{'id':_0x5255da[_0xed2e('0x4a')]['id']}})[_0xed2e('0x28')](handleEntityNotFound(_0x3efa0d,null))[_0xed2e('0x28')](removeEntity(_0x3efa0d,null))[_0xed2e('0x4e')](handleError(_0x3efa0d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d321b3c..3d505ec 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 _0x519b=['../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','Variable','tools_variables','lodash','util'];(function(_0x21c01f,_0x1641e4){var _0x49f9e3=function(_0x3ca03e){while(--_0x3ca03e){_0x21c01f['push'](_0x21c01f['shift']());}};_0x49f9e3(++_0x1641e4);}(_0x519b,0x111));var _0xb519=function(_0x53935f,_0xab8c3d){_0x53935f=_0x53935f-0x0;var _0xd4774e=_0x519b[_0x53935f];return _0xd4774e;};'use strict';var _=require(_0xb519('0x0'));var util=require(_0xb519('0x1'));var logger=require(_0xb519('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb519('0x3'));var rp=require(_0xb519('0x4'));var fs=require('fs');var path=require(_0xb519('0x5'));var rimraf=require('rimraf');var config=require(_0xb519('0x6'));var attributes=require('./variable.attributes');module[_0xb519('0x7')]=function(_0x14489f,_0x42c68c){return _0x14489f[_0xb519('0x8')](_0xb519('0x9'),attributes,{'tableName':_0xb519('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa384=['api','moment','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xa384,0x1a1));var _0x4a38=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xa384[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x4a38('0x0'));var util=require(_0x4a38('0x1'));var logger=require(_0x4a38('0x2'))(_0x4a38('0x3'));var moment=require(_0x4a38('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a38('0x5'));var config=require(_0x4a38('0x6'));var attributes=require(_0x4a38('0x7'));module[_0x4a38('0x8')]=function(_0x47532f,_0x2f5cc0){return _0x47532f[_0x4a38('0x9')](_0x4a38('0xa'),attributes,{'tableName':_0x4a38('0xb'),'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 c77efb5..40a5be7 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x296aeb,_0x550891){var _0x48f94f=function(_0x4e63cb){while(--_0x4e63cb){_0x296aeb['push'](_0x296aeb['shift']());}};_0x48f94f(++_0x550891);}(_0x55ca,0x126));var _0xa55c=function(_0x2c9f51,_0x2eec01){_0x2c9f51=_0x2c9f51-0x0;var _0x12abf9=_0x55ca[_0x2c9f51];return _0x12abf9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x1819b4,_0x2125ba){var _0x2f258c=function(_0x2588e4){while(--_0x2588e4){_0x1819b4['push'](_0x1819b4['shift']());}};_0x2f258c(++_0x2125ba);}(_0xf494,0x1c6));var _0x4f49=function(_0x52ac81,_0x11cb91){_0x52ac81=_0x52ac81-0x0;var _0x40b637=_0xf494[_0x52ac81];return _0x40b637;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 684cf1c..86f9b65 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 _0xead9=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','exports','express'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0xead9,0xbf));var _0x9ead=function(_0x4a503e,_0x1b4535){_0x4a503e=_0x4a503e-0x0;var _0x291740=_0xead9[_0x4a503e];return _0x291740;};'use strict';var express=require(_0x9ead('0x0'));var router=express[_0x9ead('0x1')]();var auth=require(_0x9ead('0x2'));var controller=require(_0x9ead('0x3'));router[_0x9ead('0x4')]('/',controller[_0x9ead('0x5')]);router[_0x9ead('0x4')](_0x9ead('0x6'),auth[_0x9ead('0x7')](),auth[_0x9ead('0x8')](),controller['fetch']);router[_0x9ead('0x4')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9ead('0x9')]);router['get'](_0x9ead('0xa'),auth[_0x9ead('0x7')](),auth[_0x9ead('0x8')](),controller[_0x9ead('0xb')]);router[_0x9ead('0x4')](_0x9ead('0xc'),auth['isAuthenticated'](),controller[_0x9ead('0xd')]);router[_0x9ead('0x4')](_0x9ead('0xe'),controller['migrations']);module[_0x9ead('0xf')]=router; \ No newline at end of file +var _0x525c=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch'];(function(_0x2ff664,_0x49c6b0){var _0x58195c=function(_0xe8693d){while(--_0xe8693d){_0x2ff664['push'](_0x2ff664['shift']());}};_0x58195c(++_0x49c6b0);}(_0x525c,0x14e));var _0xc525=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x525c[_0x1a36a5];return _0x746243;};'use strict';var express=require(_0xc525('0x0'));var router=express[_0xc525('0x1')]();var auth=require(_0xc525('0x2'));var controller=require(_0xc525('0x3'));router[_0xc525('0x4')]('/',controller['index']);router['get'](_0xc525('0x5'),auth[_0xc525('0x6')](),auth[_0xc525('0x7')](),controller[_0xc525('0x8')]);router[_0xc525('0x4')](_0xc525('0x9'),auth[_0xc525('0x6')](),auth[_0xc525('0x7')](),controller[_0xc525('0xa')]);router[_0xc525('0x4')](_0xc525('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc525('0xc')]);router['get']('/restart',auth[_0xc525('0x6')](),controller[_0xc525('0xd')]);router['get'](_0xc525('0xe'),controller[_0xc525('0xf')]);module[_0xc525('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5350b9c..fabd863 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 _0x783a=['join','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync'];(function(_0x3399bb,_0x5e7c53){var _0x1afd51=function(_0x463f5f){while(--_0x463f5f){_0x3399bb['push'](_0x3399bb['shift']());}};_0x1afd51(++_0x5e7c53);}(_0x783a,0xe8));var _0xa783=function(_0x1b3f33,_0x759610){_0x1b3f33=_0x1b3f33-0x0;var _0x5af081=_0x783a[_0x1b3f33];return _0x5af081;};'use strict';var Umzug=require(_0xa783('0x0'));var path=require(_0xa783('0x1'));var fs=require('fs');var _=require(_0xa783('0x2'));var pkginfo=require(_0xa783('0x3'))(module,_0xa783('0x4'));var compareVersions=require(_0xa783('0x5'));var exec=require(_0xa783('0x6'))['exec'];var db=require(_0xa783('0x7'))['db'];var config=require(_0xa783('0x8'));var pm2=require(_0xa783('0x9'));var logger=require('../../config/logger')('update');var git=require(_0xa783('0xa'))(config[_0xa783('0xb')]);exports[_0xa783('0xc')]=function(_0xcb4dd2,_0x29d70b){var _0x520ca1={'current':module[_0xa783('0xd')][_0xa783('0x4')],'phonebar':0x2};if(_0xcb4dd2[_0xa783('0xe')]&&_0xcb4dd2['query']['latest']){return git[_0xa783('0xf')]()[_0xa783('0x10')](function(_0x3bdaf0,_0x66a58b){_0x520ca1[_0xa783('0x11')]=(_0x3bdaf0?module[_0xa783('0xd')]['version']:_0x66a58b[_0xa783('0x11')])||_0xa783('0x12');return _0x29d70b[_0xa783('0x13')](0xc8)['json'](_0x520ca1);});}else{return _0x29d70b[_0xa783('0x13')](0xc8)[_0xa783('0x14')](_0x520ca1);}};exports[_0xa783('0xf')]=function(_0x25b2de,_0x455126){return git[_0xa783('0xf')]([_0xa783('0x15'),_0xa783('0x16')],function(_0x231cb5){if(_0x231cb5){logger[_0xa783('0x17')](_0x231cb5);return _0x455126[_0xa783('0x13')](0x1f4)[_0xa783('0x14')](_0x231cb5);}logger[_0xa783('0x18')](_0xa783('0x19'));return _0x455126[_0xa783('0x13')](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x1a')});});};exports[_0xa783('0x1b')]=function(_0x3b47a2,_0x39c4e8){return git[_0xa783('0x1b')]([_0xa783('0x1c'),'FETCH_HEAD'],function(_0x24c346){if(_0x24c346){logger[_0xa783('0x17')](_0x24c346);return _0x39c4e8[_0xa783('0x13')](0x1f4)[_0xa783('0x14')](_0x24c346);}logger[_0xa783('0x18')](_0xa783('0x1d'));return _0x39c4e8[_0xa783('0x13')](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x1e')});});};exports[_0xa783('0x1f')]=function(_0xe5f643,_0x4d8530){exec('npm\x20install\x20--production',function(_0xe29813,_0x37b149,_0x5765c9){logger[_0xa783('0x18')](_0x37b149);logger['info'](_0x5765c9);if(_0xe29813){logger['error'](_0xe29813);return _0x4d8530[_0xa783('0x13')](0x1f4)[_0xa783('0x14')](_0xe29813);}return _0x4d8530['status'](0xc8)['json']({'output':_0x37b149});});};exports[_0xa783('0x20')]=function(_0x541e9a,_0x307089){return pm2[_0xa783('0x20')](_0xa783('0x21'))[_0xa783('0x22')](function(_0x55bfd2){logger['info']('pm2\x20restart\x20motion\x20%s',_0x55bfd2);return _0x307089['status'](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x23')});})[_0xa783('0x24')](function(_0x297a9f){logger['error'](_0x297a9f);return _0x307089[_0xa783('0x13')](0x1f4)[_0xa783('0x14')](_0x297a9f);});};exports['migrations']=function(_0x178f84,_0xd1a7fa){var _0x5a973c=fs[_0xa783('0x25')](path[_0xa783('0x26')](config[_0xa783('0xb')],_0xa783('0x27'),_0xa783('0x28')));var _0x5b3b37=[];for(var _0x482a94=0x0;_0x482a94<_0x5a973c[_0xa783('0x29')];_0x482a94++){var _0x41c193=_0x5a973c[_0x482a94]['replace'](_0xa783('0x2a'),'');if(compareVersions(module['exports'][_0xa783('0x4')],_0x41c193)===-0x1){_0x5b3b37[_0xa783('0x2b')](_0x41c193);}}if(_0x5b3b37[_0xa783('0x29')]){var _0x3be132=_0x5b3b37[_0xa783('0x2c')](compareVersions);var _0x5c55b8=new Umzug({'storage':_0xa783('0x2d'),'storageOptions':{'model':db[_0xa783('0x2e')],'modelName':_0xa783('0x2e'),'columnName':_0xa783('0x4')},'migrations':{'params':[db[_0xa783('0x2d')][_0xa783('0x2f')](),db[_0xa783('0x2d')]['constructor'],function(){throw new Error(_0xa783('0x30'));}],'path':path[_0xa783('0x26')](config[_0xa783('0xb')],'server',_0xa783('0x28')),'pattern':/\.js$/}});_0x5c55b8['up']({'migrations':_['map'](_0x3be132,function(_0x3d4aa5){return _0x3d4aa5+_0xa783('0x2a');})})[_0xa783('0x22')](function(){return _0xd1a7fa[_0xa783('0x13')](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x31')+module[_0xa783('0xd')]['version']+_0xa783('0x32')+_[_0xa783('0x33')](_0x3be132),'migrations':_[_0xa783('0x26')](_0x3be132)});})['catch'](function(_0x192ce1){if(_0x192ce1 instanceof db[_0xa783('0x2d')][_0xa783('0x34')]){return _0xd1a7fa[_0xa783('0x13')](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x35')});}else{return _0xd1a7fa[_0xa783('0x13')](0x1f4)[_0xa783('0x14')](_0x192ce1);}});}else{return _0xd1a7fa[_0xa783('0x13')](0xc8)[_0xa783('0x14')]({'output':_0xa783('0x35')});}}; \ No newline at end of file +var _0x0eee=['catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','exec','../../mysqldb','../../config/logger','update','simple-git','root','query','latest','fetch','tags','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','server','.js','exports','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last'];(function(_0xb3f165,_0x1a9fb5){var _0x4eff46=function(_0x12c120){while(--_0x12c120){_0xb3f165['push'](_0xb3f165['shift']());}};_0x4eff46(++_0x1a9fb5);}(_0x0eee,0x183));var _0xe0ee=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x0eee[_0x3a0c4f];return _0x247049;};'use strict';var Umzug=require(_0xe0ee('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe0ee('0x1'));var pkginfo=require(_0xe0ee('0x2'))(module,_0xe0ee('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xe0ee('0x4')];var db=require(_0xe0ee('0x5'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xe0ee('0x6'))(_0xe0ee('0x7'));var git=require(_0xe0ee('0x8'))(config[_0xe0ee('0x9')]);exports['index']=function(_0x26c658,_0x3b162d){var _0x3ead81={'current':module['exports']['version'],'phonebar':0x2};if(_0x26c658['query']&&_0x26c658[_0xe0ee('0xa')][_0xe0ee('0xb')]){return git[_0xe0ee('0xc')]()[_0xe0ee('0xd')](function(_0x61b973,_0x585f4d){_0x3ead81['latest']=(_0x61b973?module['exports'][_0xe0ee('0x3')]:_0x585f4d['latest'])||'2.0.0';return _0x3b162d[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')](_0x3ead81);});}else{return _0x3b162d[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')](_0x3ead81);}};exports['fetch']=function(_0x5f25fe,_0x1cfd5d){return git[_0xe0ee('0xc')]([_0xe0ee('0x10'),'master'],function(_0x10abd5){if(_0x10abd5){logger[_0xe0ee('0x11')](_0x10abd5);return _0x1cfd5d[_0xe0ee('0xe')](0x1f4)['json'](_0x10abd5);}logger[_0xe0ee('0x12')](_0xe0ee('0x13'));return _0x1cfd5d[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':_0xe0ee('0x14')});});};exports['reset']=function(_0x2639cb,_0x501692){return git[_0xe0ee('0x15')]([_0xe0ee('0x16'),_0xe0ee('0x17')],function(_0x530db8){if(_0x530db8){logger[_0xe0ee('0x11')](_0x530db8);return _0x501692[_0xe0ee('0xe')](0x1f4)[_0xe0ee('0xf')](_0x530db8);}logger[_0xe0ee('0x12')](_0xe0ee('0x18'));return _0x501692[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':_0xe0ee('0x19')});});};exports['pull']=function(_0x50f9ab,_0x49819a){exec(_0xe0ee('0x1a'),function(_0x373a63,_0x2d6cab,_0xb4b311){logger[_0xe0ee('0x12')](_0x2d6cab);logger[_0xe0ee('0x12')](_0xb4b311);if(_0x373a63){logger[_0xe0ee('0x11')](_0x373a63);return _0x49819a[_0xe0ee('0xe')](0x1f4)[_0xe0ee('0xf')](_0x373a63);}return _0x49819a[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':_0x2d6cab});});};exports[_0xe0ee('0x1b')]=function(_0x1cbaaf,_0x4f33ff){return pm2[_0xe0ee('0x1b')]('motion2')['then'](function(_0x193bd2){logger[_0xe0ee('0x12')](_0xe0ee('0x1c'),_0x193bd2);return _0x4f33ff['status'](0xc8)[_0xe0ee('0xf')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x2bfefb){logger['error'](_0x2bfefb);return _0x4f33ff[_0xe0ee('0xe')](0x1f4)['json'](_0x2bfefb);});};exports[_0xe0ee('0x1d')]=function(_0x9a283,_0xc2f16c){var _0x457c08=fs[_0xe0ee('0x1e')](path[_0xe0ee('0x1f')](config[_0xe0ee('0x9')],_0xe0ee('0x20'),_0xe0ee('0x1d')));var _0x1a7925=[];for(var _0x523fbd=0x0;_0x523fbd<_0x457c08['length'];_0x523fbd++){var _0x22bab1=_0x457c08[_0x523fbd]['replace'](_0xe0ee('0x21'),'');if(compareVersions(module[_0xe0ee('0x22')][_0xe0ee('0x3')],_0x22bab1)===-0x1){_0x1a7925['push'](_0x22bab1);}}if(_0x1a7925['length']){var _0x158474=_0x1a7925[_0xe0ee('0x23')](compareVersions);var _0x2de690=new Umzug({'storage':_0xe0ee('0x24'),'storageOptions':{'model':db[_0xe0ee('0x25')],'modelName':_0xe0ee('0x25'),'columnName':_0xe0ee('0x3')},'migrations':{'params':[db[_0xe0ee('0x24')][_0xe0ee('0x26')](),db[_0xe0ee('0x24')][_0xe0ee('0x27')],function(){throw new Error(_0xe0ee('0x28'));}],'path':path[_0xe0ee('0x1f')](config[_0xe0ee('0x9')],'server',_0xe0ee('0x1d')),'pattern':/\.js$/}});_0x2de690['up']({'migrations':_[_0xe0ee('0x29')](_0x158474,function(_0x17eee2){return _0x17eee2+_0xe0ee('0x21');})})['then'](function(){return _0xc2f16c[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':_0xe0ee('0x2a')+module[_0xe0ee('0x22')][_0xe0ee('0x3')]+_0xe0ee('0x2b')+_[_0xe0ee('0x2c')](_0x158474),'migrations':_['join'](_0x158474)});})[_0xe0ee('0x2d')](function(_0x5884ad){if(_0x5884ad instanceof db['sequelize'][_0xe0ee('0x2e')]){return _0xc2f16c[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xc2f16c[_0xe0ee('0xe')](0x1f4)['json'](_0x5884ad);}});}else{return _0xc2f16c[_0xe0ee('0xe')](0xc8)[_0xe0ee('0xf')]({'output':_0xe0ee('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index c71f059..dd5489e 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 _0x2629=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2629,0x107));var _0x9262=function(_0x562456,_0x9ad741){_0x562456=_0x562456-0x0;var _0x46d4a9=_0x2629[_0x562456];return _0x46d4a9;};'use strict';var multer=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var path=require(_0x9262('0x2'));var timeout=require('connect-timeout');var express=require(_0x9262('0x3'));var router=express[_0x9262('0x4')]();var fs_extra=require(_0x9262('0x5'));var auth=require(_0x9262('0x6'));var interaction=require(_0x9262('0x7'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x9262('0x8')]('/',auth[_0x9262('0x9')](),controller[_0x9262('0xa')]);router['get'](_0x9262('0xb'),auth[_0x9262('0x9')](),controller[_0x9262('0xc')]);router[_0x9262('0x8')](_0x9262('0xd'),auth[_0x9262('0x9')](),controller[_0x9262('0xe')]);router[_0x9262('0xf')]('/',auth[_0x9262('0x9')](),controller['create']);router[_0x9262('0x10')](_0x9262('0xd'),auth[_0x9262('0x9')](),controller['update']);router[_0x9262('0x11')]('/:id',auth[_0x9262('0x9')](),controller[_0x9262('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf496=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','describe','create','/:id','update','delete','destroy','exports','multer'];(function(_0x2a2f6e,_0x5f488a){var _0x149fc0=function(_0x330d04){while(--_0x330d04){_0x2a2f6e['push'](_0x2a2f6e['shift']());}};_0x149fc0(++_0x5f488a);}(_0xf496,0x11f));var _0x6f49=function(_0xbb0a93,_0x2ee485){_0xbb0a93=_0xbb0a93-0x0;var _0x29a0de=_0xf496[_0xbb0a93];return _0x29a0de;};'use strict';var multer=require(_0x6f49('0x0'));var util=require(_0x6f49('0x1'));var path=require(_0x6f49('0x2'));var timeout=require(_0x6f49('0x3'));var express=require('express');var router=express[_0x6f49('0x4')]();var fs_extra=require(_0x6f49('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f49('0x6'));var controller=require(_0x6f49('0x7'));router['get']('/',auth[_0x6f49('0x8')](),controller[_0x6f49('0x9')]);router[_0x6f49('0xa')]('/describe',auth[_0x6f49('0x8')](),controller[_0x6f49('0xb')]);router[_0x6f49('0xa')]('/:id',auth[_0x6f49('0x8')](),controller['show']);router['post']('/',auth[_0x6f49('0x8')](),controller[_0x6f49('0xc')]);router['put'](_0x6f49('0xd'),auth[_0x6f49('0x8')](),controller[_0x6f49('0xe')]);router[_0x6f49('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6f49('0x10')]);module[_0x6f49('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 11e1b23..13fa373 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 _0x1c3d=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN'];(function(_0x90b523,_0x10173e){var _0x2dfc72=function(_0x44540e){while(--_0x44540e){_0x90b523['push'](_0x90b523['shift']());}};_0x2dfc72(++_0x10173e);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0xe59404,_0xc31864){_0xe59404=_0xe59404-0x0;var _0x23a1e1=_0x1c3d[_0xe59404];return _0x23a1e1;};'use strict';var Sequelize=require('sequelize');module[_0xd1c3('0x0')]={'type':{'type':Sequelize[_0xd1c3('0x1')]},'uniqueid':{'type':Sequelize[_0xd1c3('0x1')]},'calleridnum':{'type':Sequelize[_0xd1c3('0x1')]},'calleridname':{'type':Sequelize[_0xd1c3('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd1c3('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd1c3('0x2')]},'agentconnectAt':{'type':Sequelize[_0xd1c3('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd1c3('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd1c3('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd1c3('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd1c3('0x4')]},'agentacw':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd1c3('0x4')]},'reason':{'type':Sequelize[_0xd1c3('0x1')]},'lastevent':{'type':Sequelize[_0xd1c3('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd1c3('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd1c3('0x1')]},'connectedlinename':{'type':Sequelize[_0xd1c3('0x1')]},'language':{'type':Sequelize[_0xd1c3('0x1')]},'accountcode':{'type':Sequelize[_0xd1c3('0x1')]},'context':{'type':Sequelize[_0xd1c3('0x1')]},'exten':{'type':Sequelize[_0xd1c3('0x1')]},'priority':{'type':Sequelize[_0xd1c3('0x1')]},'destchannel':{'type':Sequelize[_0xd1c3('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd1c3('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd1c3('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd1c3('0x1')]},'destaccountcode':{'type':Sequelize[_0xd1c3('0x1')]},'destcontext':{'type':Sequelize[_0xd1c3('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd1c3('0x1')]},'destuniqueid':{'type':Sequelize[_0xd1c3('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd1c3('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd1c3('0x1')]},'transfer':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd1c3('0x1')],'comment':_0xd1c3('0x5')},'transferexten':{'type':Sequelize[_0xd1c3('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd1c3('0x1')]},'agententerreason':{'type':Sequelize[_0xd1c3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4cf8=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x57d136,_0x54b080){var _0x2033d4=function(_0x146c26){while(--_0x146c26){_0x57d136['push'](_0x57d136['shift']());}};_0x2033d4(++_0x54b080);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x4cf8[_0x11b58d];return _0xc2811b;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'type':{'type':Sequelize[_0x84cf('0x2')]},'uniqueid':{'type':Sequelize[_0x84cf('0x2')]},'calleridnum':{'type':Sequelize[_0x84cf('0x2')]},'calleridname':{'type':Sequelize[_0x84cf('0x2')]},'queue':{'type':Sequelize[_0x84cf('0x2')]},'interface':{'type':Sequelize[_0x84cf('0x2')]},'membername':{'type':Sequelize[_0x84cf('0x2')]},'agentcalledAt':{'type':Sequelize[_0x84cf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x84cf('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x84cf('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x84cf('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x84cf('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x84cf('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x84cf('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x84cf('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x84cf('0x2')]},'channel':{'type':Sequelize[_0x84cf('0x2')]},'channelstate':{'type':Sequelize[_0x84cf('0x4')]},'channelstatedesc':{'type':Sequelize[_0x84cf('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x84cf('0x2')]},'language':{'type':Sequelize[_0x84cf('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x84cf('0x2')]},'priority':{'type':Sequelize[_0x84cf('0x2')]},'destchannel':{'type':Sequelize[_0x84cf('0x2')]},'destchannelstate':{'type':Sequelize[_0x84cf('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x84cf('0x2')]},'destcalleridnum':{'type':Sequelize[_0x84cf('0x2')]},'destcalleridname':{'type':Sequelize[_0x84cf('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x84cf('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x84cf('0x2')]},'destlanguage':{'type':Sequelize[_0x84cf('0x2')]},'destaccountcode':{'type':Sequelize[_0x84cf('0x2')]},'destcontext':{'type':Sequelize[_0x84cf('0x2')]},'destexten':{'type':Sequelize[_0x84cf('0x2')]},'destpriority':{'type':Sequelize[_0x84cf('0x2')]},'destuniqueid':{'type':Sequelize[_0x84cf('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x84cf('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x84cf('0x2')]},'transfer':{'type':Sequelize[_0x84cf('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x84cf('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x84cf('0x2')]},'transferuniqueid':{'type':Sequelize[_0x84cf('0x2')]},'agententerreason':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ec71603..96aa837 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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 6271ee4..f3fb3f6 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 _0xd1f9=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1b11bf,_0x181bdc){var _0x133774=function(_0x48ae84){while(--_0x48ae84){_0x1b11bf['push'](_0x1b11bf['shift']());}};_0x133774(++_0x181bdc);}(_0xd1f9,0x88));var _0x9d1f=function(_0x3fdd09,_0x2853f7){_0x3fdd09=_0x3fdd09-0x0;var _0x2be280=_0xd1f9[_0x3fdd09];return _0x2be280;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d1f('0x0'))(_0x9d1f('0x1'));var moment=require(_0x9d1f('0x2'));var BPromise=require(_0x9d1f('0x3'));var rp=require(_0x9d1f('0x4'));var fs=require('fs');var path=require(_0x9d1f('0x5'));var rimraf=require(_0x9d1f('0x6'));var config=require(_0x9d1f('0x7'));var attributes=require(_0x9d1f('0x8'));module['exports']=function(_0x3c4bad,_0x1a72d8){return _0x3c4bad[_0x9d1f('0x9')](_0x9d1f('0xa'),attributes,{'tableName':_0x9d1f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9d1f('0xc'),_0x9d1f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc03e=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api'];(function(_0x370ad3,_0x215042){var _0x4b5173=function(_0x33ab26){while(--_0x33ab26){_0x370ad3['push'](_0x370ad3['shift']());}};_0x4b5173(++_0x215042);}(_0xc03e,0x15a));var _0xec03=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0xc03e[_0x299784];return _0x5ab008;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xec03('0xa'),_0xec03('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 c1e8770..aef42ec 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 _0x610e=['result','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','stringify','catch','update','body','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x610e,0xf5));var _0xe610=function(_0x39c895,_0x3702e1){_0x39c895=_0x39c895-0x0;var _0x1450ce=_0x610e[_0x39c895];return _0x1450ce;};'use strict';var _=require(_0xe610('0x0'));var util=require(_0xe610('0x1'));var moment=require(_0xe610('0x2'));var BPromise=require(_0xe610('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe610('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe610('0x5'))(_0xe610('0x6'));var config=require(_0xe610('0x7'));var jayson=require(_0xe610('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ade3d,_0x17f95d,_0x417a79){return new BPromise(function(_0xa67352,_0x55ef1c){return client[_0xe610('0x9')](_0x2ade3d,_0x417a79)[_0xe610('0xa')](function(_0x1ea007){logger[_0xe610('0xb')](_0xe610('0xc'),_0x17f95d,_0xe610('0xd'));logger[_0xe610('0xe')](_0xe610('0xf'),_0x17f95d,_0xe610('0xd'),JSON['stringify'](_0x1ea007));if(_0x1ea007[_0xe610('0x10')]){if(_0x1ea007[_0xe610('0x10')][_0xe610('0x11')]===0x1f4){logger['error'](_0xe610('0xc'),_0x17f95d,_0x1ea007[_0xe610('0x10')][_0xe610('0x12')]);return _0x55ef1c(_0x1ea007[_0xe610('0x10')][_0xe610('0x12')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x17f95d,_0x1ea007[_0xe610('0x10')][_0xe610('0x12')]);return _0xa67352(_0x1ea007[_0xe610('0x10')]['message']);}else{logger[_0xe610('0xb')](_0xe610('0xc'),_0x17f95d,'request\x20sent');_0xa67352(_0x1ea007[_0xe610('0x13')][_0xe610('0x12')]);}})['catch'](function(_0x5d3db5){logger[_0xe610('0x10')](_0xe610('0xc'),_0x17f95d,_0x5d3db5);_0x55ef1c(_0x5d3db5);});});}exports['CreateVoiceAgentReport']=function(_0x2f395c){var _0x359512=this;return new Promise(function(_0x1b1f9c,_0x216eb5){return db[_0xe610('0x14')][_0xe610('0x15')](_0x2f395c['body'],{'raw':_0x2f395c[_0xe610('0x16')]?_0x2f395c[_0xe610('0x16')][_0xe610('0x17')]===undefined?!![]:![]:!![]})[_0xe610('0xa')](function(_0x586929){logger[_0xe610('0xb')](_0xe610('0x18'),_0x2f395c);logger[_0xe610('0xe')](_0xe610('0x18'),_0x2f395c,JSON[_0xe610('0x19')](_0x586929));_0x1b1f9c(_0x586929);})[_0xe610('0x1a')](function(_0x549930){logger[_0xe610('0x10')](_0xe610('0x18'),_0x549930['message'],_0x2f395c);_0x216eb5(_0x359512[_0xe610('0x10')](0x1f4,_0x549930[_0xe610('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2b83bf){var _0x34f7ea=this;return new Promise(function(_0x3c5208,_0x323e00){return db[_0xe610('0x14')][_0xe610('0x1b')](_0x2b83bf[_0xe610('0x1c')],{'raw':_0x2b83bf['options']?_0x2b83bf['options'][_0xe610('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b83bf[_0xe610('0x16')]?_0x2b83bf['options'][_0xe610('0x1d')]||null:null,'attributes':_0x2b83bf[_0xe610('0x16')]?_0x2b83bf['options'][_0xe610('0x1e')]||null:null,'limit':_0x2b83bf[_0xe610('0x16')]?_0x2b83bf[_0xe610('0x16')][_0xe610('0x1f')]||null:null})[_0xe610('0xa')](function(_0x1800bc){logger[_0xe610('0xb')](_0xe610('0x20'),_0x2b83bf);logger[_0xe610('0xe')](_0xe610('0x20'),_0x2b83bf,JSON[_0xe610('0x19')](_0x1800bc));_0x3c5208(_0x1800bc);})[_0xe610('0x1a')](function(_0x1c76c6){logger[_0xe610('0x10')](_0xe610('0x20'),_0x1c76c6[_0xe610('0x12')],_0x2b83bf);_0x323e00(_0x34f7ea[_0xe610('0x10')](0x1f4,_0x1c76c6[_0xe610('0x12')]));});});}; \ No newline at end of file +var _0xf586=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','update','body','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0xf586,0x7b));var _0x6f58=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0xf586[_0x3f55de];return _0x2698de;};'use strict';var _=require(_0x6f58('0x0'));var util=require('util');var moment=require(_0x6f58('0x1'));var BPromise=require(_0x6f58('0x2'));var rs=require(_0x6f58('0x3'));var fs=require('fs');var Redis=require(_0x6f58('0x4'));var db=require(_0x6f58('0x5'))['db'];var utils=require(_0x6f58('0x6'));var logger=require(_0x6f58('0x7'))(_0x6f58('0x8'));var config=require(_0x6f58('0x9'));var jayson=require(_0x6f58('0xa'));var client=jayson[_0x6f58('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a3095,_0x1eb7a4,_0x1f537c){return new BPromise(function(_0x36f2a5,_0x33eccd){return client[_0x6f58('0xc')](_0x1a3095,_0x1f537c)[_0x6f58('0xd')](function(_0x33801e){logger[_0x6f58('0xe')](_0x6f58('0xf'),_0x1eb7a4,_0x6f58('0x10'));logger[_0x6f58('0x11')](_0x6f58('0x12'),_0x1eb7a4,_0x6f58('0x10'),JSON['stringify'](_0x33801e));if(_0x33801e['error']){if(_0x33801e[_0x6f58('0x13')][_0x6f58('0x14')]===0x1f4){logger[_0x6f58('0x13')](_0x6f58('0xf'),_0x1eb7a4,_0x33801e[_0x6f58('0x13')][_0x6f58('0x15')]);return _0x33eccd(_0x33801e[_0x6f58('0x13')][_0x6f58('0x15')]);}logger[_0x6f58('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1eb7a4,_0x33801e[_0x6f58('0x13')][_0x6f58('0x15')]);return _0x36f2a5(_0x33801e[_0x6f58('0x13')][_0x6f58('0x15')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x1eb7a4,_0x6f58('0x10'));_0x36f2a5(_0x33801e[_0x6f58('0x16')]['message']);}})[_0x6f58('0x17')](function(_0x9a1a72){logger[_0x6f58('0x13')](_0x6f58('0xf'),_0x1eb7a4,_0x9a1a72);_0x33eccd(_0x9a1a72);});});}exports[_0x6f58('0x18')]=function(_0x13e160){var _0x3d2580=this;return new Promise(function(_0x217f17,_0x373d43){return db[_0x6f58('0x19')][_0x6f58('0x1a')](_0x13e160['body'],{'raw':_0x13e160[_0x6f58('0x1b')]?_0x13e160[_0x6f58('0x1b')][_0x6f58('0x1c')]===undefined?!![]:![]:!![]})[_0x6f58('0xd')](function(_0x44d6dc){logger[_0x6f58('0xe')]('CreateVoiceAgentReport',_0x13e160);logger[_0x6f58('0x11')](_0x6f58('0x18'),_0x13e160,JSON[_0x6f58('0x1d')](_0x44d6dc));_0x217f17(_0x44d6dc);})[_0x6f58('0x17')](function(_0x8ad66d){logger[_0x6f58('0x13')](_0x6f58('0x18'),_0x8ad66d[_0x6f58('0x15')],_0x13e160);_0x373d43(_0x3d2580[_0x6f58('0x13')](0x1f4,_0x8ad66d[_0x6f58('0x15')]));});});};exports[_0x6f58('0x1e')]=function(_0x24d88a){var _0x3b6179=this;return new Promise(function(_0x17c7a0,_0xf7774){return db[_0x6f58('0x19')][_0x6f58('0x1f')](_0x24d88a[_0x6f58('0x20')],{'raw':_0x24d88a[_0x6f58('0x1b')]?_0x24d88a[_0x6f58('0x1b')][_0x6f58('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d88a['options']?_0x24d88a['options'][_0x6f58('0x21')]||null:null,'attributes':_0x24d88a[_0x6f58('0x1b')]?_0x24d88a[_0x6f58('0x1b')]['attributes']||null:null,'limit':_0x24d88a['options']?_0x24d88a['options'][_0x6f58('0x22')]||null:null})[_0x6f58('0xd')](function(_0x4549f0){logger[_0x6f58('0xe')](_0x6f58('0x1e'),_0x24d88a);logger['debug'](_0x6f58('0x1e'),_0x24d88a,JSON['stringify'](_0x4549f0));_0x17c7a0(_0x4549f0);})[_0x6f58('0x17')](function(_0x52e90b){logger[_0x6f58('0x13')](_0x6f58('0x1e'),_0x52e90b['message'],_0x24d88a);_0xf7774(_0x3b6179[_0x6f58('0x13')](0x1f4,_0x52e90b[_0x6f58('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 55c5015..632ce5f 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 _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','index','get'];(function(_0x337b62,_0x29231a){var _0x3c60f4=function(_0x18a836){while(--_0x18a836){_0x337b62['push'](_0x337b62['shift']());}};_0x3c60f4(++_0x29231a);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5cc7fe,_0x1ba718){_0x5cc7fe=_0x5cc7fe-0x0;var _0xa8d0d4=_0x8d0e[_0x5cc7fe];return _0xa8d0d4;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x4782c6,_0x23499f){var _0x12d554=function(_0x4ccbb1){while(--_0x4ccbb1){_0x4782c6['push'](_0x4782c6['shift']());}};_0x12d554(++_0x23499f);}(_0xe0ae,0xa1));var _0xee0a=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0xe0ae[_0x459b74];return _0x46cb16;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0e4fd65..663f5dc 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 _0xb03e=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports'];(function(_0xce931d,_0x4a2e1a){var _0x57351c=function(_0x141ba9){while(--_0x141ba9){_0xce931d['push'](_0xce931d['shift']());}};_0x57351c(++_0x4a2e1a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x347bba,_0x203e67){_0x347bba=_0x347bba-0x0;var _0x4910a1=_0xb03e[_0x347bba];return _0x4910a1;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'uniqueid':{'type':Sequelize[_0xeb03('0x1')]},'type':{'type':Sequelize[_0xeb03('0x2')](_0xeb03('0x3'),_0xeb03('0x4'),_0xeb03('0x5'),_0xeb03('0x6'),_0xeb03('0x7'),_0xeb03('0x8'))},'tag':{'type':Sequelize[_0xeb03('0x1')]},'accountcode':{'type':Sequelize[_0xeb03('0x1')]},'source':{'type':Sequelize[_0xeb03('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xeb03('0x1')]},'callerid':{'type':Sequelize[_0xeb03('0x1')]},'channel':{'type':Sequelize[_0xeb03('0x1')]},'destinationchannel':{'type':Sequelize[_0xeb03('0x1')]},'lastapplication':{'type':Sequelize[_0xeb03('0x1')]},'lastdata':{'type':Sequelize[_0xeb03('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xeb03('0xa')]},'answertime':{'type':Sequelize[_0xeb03('0xa')]},'endtime':{'type':Sequelize[_0xeb03('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xeb03('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeb03('0x1')]},'amaflags':{'type':Sequelize[_0xeb03('0x1')]},'userfield':{'type':Sequelize[_0xeb03('0x1')]},'userDisposition':{'type':Sequelize[_0xeb03('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xeb03('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xeb03('0x1')]},'note':{'type':Sequelize[_0xeb03('0x1')]},'prefix':{'type':Sequelize[_0xeb03('0x1')]},'routeid':{'type':Sequelize[_0xeb03('0xb')]},'sipcallid':{'type':Sequelize[_0xeb03('0x1')]}}; \ No newline at end of file +var _0xcbcd=['TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer'];(function(_0x3aa519,_0x307fb1){var _0x47c52e=function(_0x5d5001){while(--_0x5d5001){_0x3aa519['push'](_0x3aa519['shift']());}};_0x47c52e(++_0x307fb1);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xcbcd[_0x438685];return _0x41cca2;};'use strict';var Sequelize=require('sequelize');module[_0xdcbc('0x0')]={'uniqueid':{'type':Sequelize[_0xdcbc('0x1')]},'type':{'type':Sequelize[_0xdcbc('0x2')](_0xdcbc('0x3'),_0xdcbc('0x4'),_0xdcbc('0x5'),'inbound-fax',_0xdcbc('0x6'),_0xdcbc('0x7'))},'tag':{'type':Sequelize[_0xdcbc('0x1')]},'accountcode':{'type':Sequelize[_0xdcbc('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdcbc('0x1')]},'destinationcontext':{'type':Sequelize[_0xdcbc('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdcbc('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xdcbc('0x1')]},'lastdata':{'type':Sequelize[_0xdcbc('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xdcbc('0x9')]},'endtime':{'type':Sequelize[_0xdcbc('0x9')]},'duration':{'type':Sequelize[_0xdcbc('0xa')]},'billableseconds':{'type':Sequelize[_0xdcbc('0xa')]},'mohtime':{'type':Sequelize[_0xdcbc('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdcbc('0x1')]},'amaflags':{'type':Sequelize[_0xdcbc('0x1')]},'userfield':{'type':Sequelize[_0xdcbc('0x1')]},'userDisposition':{'type':Sequelize[_0xdcbc('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xdcbc('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xdcbc('0x1')]},'note':{'type':Sequelize[_0xdcbc('0x1')]},'prefix':{'type':Sequelize[_0xdcbc('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xdcbc('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8ff3cc8..3b189cb 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x711ab1,_0x3731c2){_0x711ab1=_0x711ab1-0x0;var _0x1746e6=_0x5f2f[_0x711ab1];return _0x1746e6;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x5f2f,0x73));var _0xf5f2=function(_0x442723,_0x477376){_0x442723=_0x442723-0x0;var _0x3d308e=_0x5f2f[_0x442723];return _0x3d308e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cd9b81f..40812a4 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 _0x428c=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x95207,_0x1df5a7){var _0x35f6be=function(_0x80e914){while(--_0x80e914){_0x95207['push'](_0x95207['shift']());}};_0x35f6be(++_0x1df5a7);}(_0x428c,0x1d4));var _0xc428=function(_0x14d626,_0x3b62dd){_0x14d626=_0x14d626-0x0;var _0xcf2897=_0x428c[_0x14d626];return _0xcf2897;};'use strict';var _=require(_0xc428('0x0'));var util=require(_0xc428('0x1'));var logger=require(_0xc428('0x2'))(_0xc428('0x3'));var moment=require(_0xc428('0x4'));var BPromise=require('bluebird');var rp=require(_0xc428('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc428('0x6'));var config=require('../../config/environment');var attributes=require(_0xc428('0x7'));module[_0xc428('0x8')]=function(_0x55ec7a,_0x45953a){return _0x55ec7a[_0xc428('0x9')](_0xc428('0xa'),attributes,{'tableName':_0xc428('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc428('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcda6=['VoiceCallReport','uniqueid','lodash','api','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcda6,0x18a));var _0x6cda=function(_0x10baa7,_0x273ece){_0x10baa7=_0x10baa7-0x0;var _0x30e291=_0xcda6[_0x10baa7];return _0x30e291;};'use strict';var _=require(_0x6cda('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6cda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6cda('0x2'));var attributes=require(_0x6cda('0x3'));module[_0x6cda('0x4')]=function(_0x22ec09,_0x253cdc){return _0x22ec09[_0x6cda('0x5')](_0x6cda('0x6'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6cda('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d35fd00..bae282d 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 _0x00e8=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x00e8,0xb4));var _0x800e=function(_0x50e04c,_0x3c0b77){_0x50e04c=_0x50e04c-0x0;var _0x4f6b35=_0x00e8[_0x50e04c];return _0x4f6b35;};'use strict';var _=require(_0x800e('0x0'));var util=require(_0x800e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x800e('0x2'));var db=require(_0x800e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x800e('0x4'))(_0x800e('0x5'));var config=require(_0x800e('0x6'));var jayson=require(_0x800e('0x7'));var client=jayson[_0x800e('0x8')][_0x800e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x122788,_0x33fd64,_0x132682){return new BPromise(function(_0x1ad89e,_0x1186ae){return client['request'](_0x122788,_0x132682)[_0x800e('0xa')](function(_0x5e66f2){logger[_0x800e('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x33fd64,_0x800e('0xc'));logger[_0x800e('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x33fd64,_0x800e('0xc'),JSON[_0x800e('0xe')](_0x5e66f2));if(_0x5e66f2[_0x800e('0xf')]){if(_0x5e66f2[_0x800e('0xf')][_0x800e('0x10')]===0x1f4){logger[_0x800e('0xf')](_0x800e('0x11'),_0x33fd64,_0x5e66f2[_0x800e('0xf')][_0x800e('0x12')]);return _0x1186ae(_0x5e66f2['error']['message']);}logger[_0x800e('0xf')](_0x800e('0x11'),_0x33fd64,_0x5e66f2['error'][_0x800e('0x12')]);return _0x1ad89e(_0x5e66f2[_0x800e('0xf')]['message']);}else{logger[_0x800e('0xb')](_0x800e('0x11'),_0x33fd64,_0x800e('0xc'));_0x1ad89e(_0x5e66f2[_0x800e('0x13')][_0x800e('0x12')]);}})[_0x800e('0x14')](function(_0x5d53d9){logger[_0x800e('0xf')](_0x800e('0x11'),_0x33fd64,_0x5d53d9);_0x1186ae(_0x5d53d9);});});}exports['GetVoiceCallReport']=function(_0x5a3cb7){var _0xa6b0db=this;return new Promise(function(_0x564b3,_0x35ed5d){return db[_0x800e('0x15')][_0x800e('0x16')]({'raw':_0x5a3cb7[_0x800e('0x17')]?_0x5a3cb7['options'][_0x800e('0x18')]===undefined?!![]:![]:!![],'where':_0x5a3cb7[_0x800e('0x17')]?_0x5a3cb7[_0x800e('0x17')][_0x800e('0x19')]||null:null,'attributes':_0x5a3cb7[_0x800e('0x17')]?_0x5a3cb7[_0x800e('0x17')][_0x800e('0x1a')]||null:null,'limit':_0x5a3cb7[_0x800e('0x17')]?_0x5a3cb7['options'][_0x800e('0x1b')]||null:null,'include':_0x5a3cb7[_0x800e('0x17')]?_0x5a3cb7[_0x800e('0x17')][_0x800e('0x1c')]?_[_0x800e('0x1d')](_0x5a3cb7[_0x800e('0x17')]['include'],function(_0x1dc6d2){return{'model':db[_0x1dc6d2[_0x800e('0x1e')]],'as':_0x1dc6d2['as'],'attributes':_0x1dc6d2[_0x800e('0x1a')],'include':_0x1dc6d2['include']?_[_0x800e('0x1d')](_0x1dc6d2[_0x800e('0x1c')],function(_0x1f37ba){return{'model':db[_0x1f37ba[_0x800e('0x1e')]],'as':_0x1f37ba['as'],'attributes':_0x1f37ba[_0x800e('0x1a')],'include':_0x1f37ba[_0x800e('0x1c')]?_[_0x800e('0x1d')](_0x1f37ba[_0x800e('0x1c')],function(_0x1ce9fa){return{'model':db[_0x1ce9fa[_0x800e('0x1e')]],'as':_0x1ce9fa['as'],'attributes':_0x1ce9fa[_0x800e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x800e('0xa')](function(_0x109c8e){logger[_0x800e('0xb')](_0x800e('0x1f'),_0x5a3cb7);logger[_0x800e('0xd')](_0x800e('0x1f'),_0x5a3cb7,JSON[_0x800e('0xe')](_0x109c8e));_0x564b3(_0x109c8e);})[_0x800e('0x14')](function(_0x2b1afa){logger[_0x800e('0xf')](_0x800e('0x1f'),_0x2b1afa['message'],_0x5a3cb7);_0x35ed5d(_0xa6b0db['error'](0x1f4,_0x2b1afa[_0x800e('0x12')]));});});};exports[_0x800e('0x20')]=function(_0x253068){var _0x3fa0e0=this;return new Promise(function(_0x27e970,_0x393584){return db[_0x800e('0x15')][_0x800e('0x21')](_0x253068[_0x800e('0x22')],{'raw':_0x253068[_0x800e('0x17')]?_0x253068[_0x800e('0x17')][_0x800e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3dae21){logger[_0x800e('0xb')]('CreateVoiceCallReport',_0x253068);logger[_0x800e('0xd')]('CreateVoiceCallReport',_0x253068,JSON['stringify'](_0x3dae21));_0x27e970(_0x3dae21);})[_0x800e('0x14')](function(_0x4947f4){logger[_0x800e('0xf')](_0x800e('0x20'),_0x4947f4['message'],_0x253068);_0x393584(_0x3fa0e0[_0x800e('0xf')](0x1f4,_0x4947f4[_0x800e('0x12')]));});});};exports[_0x800e('0x23')]=function(_0x6a9a1c){var _0x37d381=this;return new Promise(function(_0x4f9a45,_0x1ab906){return db['VoiceCallReport'][_0x800e('0x24')](_0x6a9a1c[_0x800e('0x22')],{'raw':_0x6a9a1c[_0x800e('0x17')]?_0x6a9a1c['options'][_0x800e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a9a1c[_0x800e('0x17')]?_0x6a9a1c[_0x800e('0x17')][_0x800e('0x19')]||null:null,'attributes':_0x6a9a1c[_0x800e('0x17')]?_0x6a9a1c['options']['attributes']||null:null,'limit':_0x6a9a1c[_0x800e('0x17')]?_0x6a9a1c[_0x800e('0x17')]['limit']||null:null})[_0x800e('0xa')](function(_0x4fb94a){logger[_0x800e('0xb')](_0x800e('0x23'),_0x6a9a1c);logger[_0x800e('0xd')](_0x800e('0x23'),_0x6a9a1c,JSON['stringify'](_0x4fb94a));_0x4f9a45(_0x4fb94a);})[_0x800e('0x14')](function(_0x45e178){logger[_0x800e('0xf')](_0x800e('0x23'),_0x45e178[_0x800e('0x12')],_0x6a9a1c);_0x1ab906(_0x37d381[_0x800e('0xf')](0x1f4,_0x45e178[_0x800e('0x12')]));});});}; \ No newline at end of file +var _0x82cf=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','map','model','then','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','raw','lodash','moment','bluebird','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x82cf,0x18c));var _0xf82c=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x82cf[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0xf82c('0x0'));var util=require('util');var moment=require(_0xf82c('0x1'));var BPromise=require(_0xf82c('0x2'));var rs=require(_0xf82c('0x3'));var fs=require('fs');var Redis=require(_0xf82c('0x4'));var db=require(_0xf82c('0x5'))['db'];var utils=require(_0xf82c('0x6'));var logger=require('../../config/logger')(_0xf82c('0x7'));var config=require(_0xf82c('0x8'));var jayson=require(_0xf82c('0x9'));var client=jayson[_0xf82c('0xa')][_0xf82c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52fb49,_0x22b0c0,_0x518f61){return new BPromise(function(_0xa29583,_0x3b7e91){return client[_0xf82c('0xc')](_0x52fb49,_0x518f61)['then'](function(_0x13f629){logger[_0xf82c('0xd')](_0xf82c('0xe'),_0x22b0c0,'request\x20sent');logger[_0xf82c('0xf')](_0xf82c('0x10'),_0x22b0c0,'request\x20sent',JSON[_0xf82c('0x11')](_0x13f629));if(_0x13f629['error']){if(_0x13f629['error'][_0xf82c('0x12')]===0x1f4){logger[_0xf82c('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x22b0c0,_0x13f629[_0xf82c('0x13')][_0xf82c('0x14')]);return _0x3b7e91(_0x13f629['error'][_0xf82c('0x14')]);}logger['error'](_0xf82c('0xe'),_0x22b0c0,_0x13f629[_0xf82c('0x13')][_0xf82c('0x14')]);return _0xa29583(_0x13f629[_0xf82c('0x13')][_0xf82c('0x14')]);}else{logger[_0xf82c('0xd')](_0xf82c('0xe'),_0x22b0c0,_0xf82c('0x15'));_0xa29583(_0x13f629[_0xf82c('0x16')]['message']);}})[_0xf82c('0x17')](function(_0x4cd196){logger[_0xf82c('0x13')](_0xf82c('0xe'),_0x22b0c0,_0x4cd196);_0x3b7e91(_0x4cd196);});});}exports[_0xf82c('0x18')]=function(_0x332f8a){var _0x2b30d7=this;return new Promise(function(_0x47147c,_0x439e08){return db[_0xf82c('0x19')]['findAll']({'raw':_0x332f8a[_0xf82c('0x1a')]?_0x332f8a[_0xf82c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x332f8a[_0xf82c('0x1a')]?_0x332f8a[_0xf82c('0x1a')][_0xf82c('0x1b')]||null:null,'attributes':_0x332f8a['options']?_0x332f8a[_0xf82c('0x1a')][_0xf82c('0x1c')]||null:null,'limit':_0x332f8a[_0xf82c('0x1a')]?_0x332f8a[_0xf82c('0x1a')][_0xf82c('0x1d')]||null:null,'include':_0x332f8a[_0xf82c('0x1a')]?_0x332f8a['options'][_0xf82c('0x1e')]?_[_0xf82c('0x1f')](_0x332f8a[_0xf82c('0x1a')][_0xf82c('0x1e')],function(_0x7f8a23){return{'model':db[_0x7f8a23['model']],'as':_0x7f8a23['as'],'attributes':_0x7f8a23[_0xf82c('0x1c')],'include':_0x7f8a23['include']?_[_0xf82c('0x1f')](_0x7f8a23[_0xf82c('0x1e')],function(_0x24d68f){return{'model':db[_0x24d68f['model']],'as':_0x24d68f['as'],'attributes':_0x24d68f['attributes'],'include':_0x24d68f[_0xf82c('0x1e')]?_[_0xf82c('0x1f')](_0x24d68f[_0xf82c('0x1e')],function(_0x5da7c7){return{'model':db[_0x5da7c7[_0xf82c('0x20')]],'as':_0x5da7c7['as'],'attributes':_0x5da7c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf82c('0x21')](function(_0x3859fc){logger[_0xf82c('0xd')](_0xf82c('0x18'),_0x332f8a);logger[_0xf82c('0xf')](_0xf82c('0x18'),_0x332f8a,JSON[_0xf82c('0x11')](_0x3859fc));_0x47147c(_0x3859fc);})[_0xf82c('0x17')](function(_0x1a6241){logger[_0xf82c('0x13')](_0xf82c('0x18'),_0x1a6241[_0xf82c('0x14')],_0x332f8a);_0x439e08(_0x2b30d7[_0xf82c('0x13')](0x1f4,_0x1a6241['message']));});});};exports['CreateVoiceCallReport']=function(_0x11dec1){var _0x98d507=this;return new Promise(function(_0x2d4202,_0x4bfad3){return db[_0xf82c('0x19')][_0xf82c('0x22')](_0x11dec1[_0xf82c('0x23')],{'raw':_0x11dec1['options']?_0x11dec1[_0xf82c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2ba356){logger[_0xf82c('0xd')](_0xf82c('0x24'),_0x11dec1);logger[_0xf82c('0xf')](_0xf82c('0x24'),_0x11dec1,JSON[_0xf82c('0x11')](_0x2ba356));_0x2d4202(_0x2ba356);})[_0xf82c('0x17')](function(_0x29f766){logger[_0xf82c('0x13')](_0xf82c('0x24'),_0x29f766[_0xf82c('0x14')],_0x11dec1);_0x4bfad3(_0x98d507[_0xf82c('0x13')](0x1f4,_0x29f766[_0xf82c('0x14')]));});});};exports[_0xf82c('0x25')]=function(_0x5312ec){var _0x5bf8ce=this;return new Promise(function(_0x27020c,_0x20ac2a){return db[_0xf82c('0x19')][_0xf82c('0x26')](_0x5312ec[_0xf82c('0x23')],{'raw':_0x5312ec['options']?_0x5312ec[_0xf82c('0x1a')][_0xf82c('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5312ec[_0xf82c('0x1a')]?_0x5312ec['options']['where']||null:null,'attributes':_0x5312ec[_0xf82c('0x1a')]?_0x5312ec[_0xf82c('0x1a')][_0xf82c('0x1c')]||null:null,'limit':_0x5312ec[_0xf82c('0x1a')]?_0x5312ec[_0xf82c('0x1a')][_0xf82c('0x1d')]||null:null})[_0xf82c('0x21')](function(_0x3a5667){logger[_0xf82c('0xd')](_0xf82c('0x25'),_0x5312ec);logger[_0xf82c('0xf')](_0xf82c('0x25'),_0x5312ec,JSON[_0xf82c('0x11')](_0x3a5667));_0x27020c(_0x3a5667);})[_0xf82c('0x17')](function(_0x114027){logger['error'](_0xf82c('0x25'),_0x114027[_0xf82c('0x14')],_0x5312ec);_0x20ac2a(_0x5bf8ce[_0xf82c('0x13')](0x1f4,_0x114027[_0xf82c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 45b6d4d..b5c464f 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 _0xf3fc=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x515fc5,_0x218565){var _0x343aa2=function(_0x149d93){while(--_0x149d93){_0x515fc5['push'](_0x515fc5['shift']());}};_0x343aa2(++_0x218565);}(_0xf3fc,0xcc));var _0xcf3f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf3fc[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xcf3f('0x0'));var path=require('path');var timeout=require(_0xcf3f('0x1'));var express=require(_0xcf3f('0x2'));var router=express[_0xcf3f('0x3')]();var fs_extra=require(_0xcf3f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf3f('0x5'));var config=require(_0xcf3f('0x6'));var controller=require(_0xcf3f('0x7'));router[_0xcf3f('0x8')]('/',auth[_0xcf3f('0x9')](),controller[_0xcf3f('0xa')]);router['get'](_0xcf3f('0xb'),auth[_0xcf3f('0x9')](),controller[_0xcf3f('0xc')]);router['post']('/',auth[_0xcf3f('0x9')](),controller[_0xcf3f('0xd')]);router[_0xcf3f('0xe')]('/:id',auth[_0xcf3f('0x9')](),controller['update']);router[_0xcf3f('0xf')](_0xcf3f('0xb'),auth[_0xcf3f('0x9')](),controller[_0xcf3f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcb70=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x859f7e,_0x4d92c1){var _0x5df160=function(_0x3b6f76){while(--_0x3b6f76){_0x859f7e['push'](_0x859f7e['shift']());}};_0x5df160(++_0x4d92c1);}(_0xcb70,0x111));var _0x0cb7=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xcb70[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require('multer');var util=require(_0x0cb7('0x0'));var path=require(_0x0cb7('0x1'));var timeout=require(_0x0cb7('0x2'));var express=require(_0x0cb7('0x3'));var router=express[_0x0cb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0cb7('0x5'));var interaction=require(_0x0cb7('0x6'));var config=require(_0x0cb7('0x7'));var controller=require(_0x0cb7('0x8'));router[_0x0cb7('0x9')]('/',auth[_0x0cb7('0xa')](),controller[_0x0cb7('0xb')]);router[_0x0cb7('0x9')](_0x0cb7('0xc'),auth[_0x0cb7('0xa')](),controller[_0x0cb7('0xd')]);router[_0x0cb7('0xe')]('/',auth['isAuthenticated'](),controller[_0x0cb7('0xf')]);router[_0x0cb7('0x10')](_0x0cb7('0xc'),auth[_0x0cb7('0xa')](),controller[_0x0cb7('0x11')]);router[_0x0cb7('0x12')](_0x0cb7('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0cb7('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 cc62656..44a6b3d 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 _0x8eee=['BOOLEAN','sequelize','exports','STRING','name','join','options','split'];(function(_0x19f727,_0x28224e){var _0x412836=function(_0x40634f){while(--_0x40634f){_0x19f727['push'](_0x19f727['shift']());}};_0x412836(++_0x28224e);}(_0x8eee,0x181));var _0xe8ee=function(_0x44532f,_0x2dac86){_0x44532f=_0x44532f-0x0;var _0x11e878=_0x8eee[_0x44532f];return _0x11e878;};'use strict';var Sequelize=require(_0xe8ee('0x0'));module[_0xe8ee('0x1')]={'name':{'type':Sequelize[_0xe8ee('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xe8ee('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x423de8){this['setDataValue']('options',_0x423de8?_0x423de8[_0xe8ee('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue'](_0xe8ee('0x5'))[_0xe8ee('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe8ee('0x2')]},'record':{'type':Sequelize[_0xe8ee('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8bfc=['options','split','BOOLEAN','sequelize','STRING','name','setDataValue','join','getDataValue'];(function(_0x55334a,_0x140452){var _0x2945bd=function(_0x2e3617){while(--_0x2e3617){_0x55334a['push'](_0x55334a['shift']());}};_0x2945bd(++_0x140452);}(_0x8bfc,0x8a));var _0xc8bf=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x8bfc[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0xc8bf('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8bf('0x1')]},'prefix':{'type':Sequelize[_0xc8bf('0x1')],'unique':_0xc8bf('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xc8bf('0x1')],'set':function(_0x269288){this[_0xc8bf('0x3')]('options',_0x269288?_0x269288[_0xc8bf('0x4')](''):[]);},'get':function(){return this[_0xc8bf('0x5')](_0xc8bf('0x6'))?this[_0xc8bf('0x5')](_0xc8bf('0x6'))[_0xc8bf('0x7')](''):[];}},'auth':{'type':Sequelize[_0xc8bf('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xc8bf('0x1')]},'record':{'type':Sequelize[_0xc8bf('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc8bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 21bec5e..79ef95a 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 _0x6e16=['destroy','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','zip-dir','request-promise','bluebird','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/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then'];(function(_0x25fd37,_0x1cecd6){var _0x5237e6=function(_0x3a8f80){while(--_0x3a8f80){_0x25fd37['push'](_0x25fd37['shift']());}};_0x5237e6(++_0x1cecd6);}(_0x6e16,0x1d3));var _0x66e1=function(_0x37ce59,_0x559f6e){_0x37ce59=_0x37ce59-0x0;var _0x5a90fe=_0x6e16[_0x37ce59];return _0x5a90fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var Mustache=require(_0x66e1('0x3'));var util=require('util');var path=require(_0x66e1('0x4'));var sox=require('sox');var csv=require(_0x66e1('0x5'));var ejs=require(_0x66e1('0x6'));var fs=require('fs');var fs_extra=require(_0x66e1('0x7'));var _=require('lodash');var squel=require(_0x66e1('0x8'));var crypto=require(_0x66e1('0x9'));var jsforce=require(_0x66e1('0xa'));var deskjs=require(_0x66e1('0xb'));var toCsv=require(_0x66e1('0x5'));var querystring=require(_0x66e1('0xc'));var Papa=require(_0x66e1('0xd'));var Redis=require(_0x66e1('0xe'));var authService=require(_0x66e1('0xf'));var qs=require(_0x66e1('0x10'));var as=require(_0x66e1('0x11'));var hardwareService=require(_0x66e1('0x12'));var logger=require(_0x66e1('0x13'))(_0x66e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x15'));var db=require(_0x66e1('0x16'))['db'];function respondWithStatusCode(_0x23e018,_0x497712){_0x497712=_0x497712||0xcc;return function(_0x58c184){if(_0x58c184){return _0x23e018[_0x66e1('0x17')](_0x497712);}return _0x23e018['status'](_0x497712)[_0x66e1('0x18')]();};}function respondWithResult(_0x3e36ff,_0x5b802b){_0x5b802b=_0x5b802b||0xc8;return function(_0x9c17f9){if(_0x9c17f9){return _0x3e36ff[_0x66e1('0x19')](_0x5b802b)['json'](_0x9c17f9);}};}function respondWithFilteredResult(_0x137f52,_0x12ca0b){return function(_0x18e2ab){if(_0x18e2ab){var _0x3a68b3=typeof _0x12ca0b['offset']===_0x66e1('0x1a')&&typeof _0x12ca0b[_0x66e1('0x1b')]===_0x66e1('0x1a');var _0x28e236=_0x18e2ab[_0x66e1('0x1c')];var _0x4f3276=_0x3a68b3?0x0:_0x12ca0b['offset'];var _0x2b5585=_0x3a68b3?_0x18e2ab['count']:_0x12ca0b[_0x66e1('0x1d')]+_0x12ca0b[_0x66e1('0x1b')];var _0x260e87;if(_0x2b5585>=_0x28e236){_0x2b5585=_0x28e236;_0x260e87=0xc8;}else{_0x260e87=0xce;}_0x137f52[_0x66e1('0x19')](_0x260e87);return _0x137f52[_0x66e1('0x1e')]('Content-Range',_0x4f3276+'-'+_0x2b5585+'/'+_0x28e236)[_0x66e1('0x1f')](_0x18e2ab);}return null;};}function patchUpdates(_0x23c6ce){return function(_0xe2822e){try{jsonpatch[_0x66e1('0x20')](_0xe2822e,_0x23c6ce,!![]);}catch(_0x28f6cf){return BPromise[_0x66e1('0x21')](_0x28f6cf);}return _0xe2822e[_0x66e1('0x22')]();};}function saveUpdates(_0x38cf5b,_0x11232c){return function(_0x350b81){if(_0x350b81){return _0x350b81[_0x66e1('0x23')](_0x38cf5b)[_0x66e1('0x24')](function(_0x43686e){return _0x43686e;});}return null;};}function removeEntity(_0x2ea42d,_0x756840){return function(_0x11b7f0){if(_0x11b7f0){return _0x11b7f0[_0x66e1('0x25')]()['then'](function(){var _0xca80e3=_0x11b7f0['get']({'plain':!![]});var _0x203919=_0x66e1('0x26');return db[_0x66e1('0x27')][_0x66e1('0x25')]({'where':{'type':_0x203919,'resourceId':_0xca80e3['id']}})[_0x66e1('0x24')](function(){return _0x11b7f0;});})['then'](function(){_0x2ea42d[_0x66e1('0x19')](0xcc)[_0x66e1('0x18')]();});}};}function handleEntityNotFound(_0x2c4d08,_0x57fd03){return function(_0x4036c5){if(!_0x4036c5){_0x2c4d08['sendStatus'](0x194);}return _0x4036c5;};}function handleError(_0x5e1e87,_0x21fd24){_0x21fd24=_0x21fd24||0x1f4;return function(_0x3fcc99){logger[_0x66e1('0x28')](_0x3fcc99[_0x66e1('0x29')]);if(_0x3fcc99[_0x66e1('0x2a')]){delete _0x3fcc99[_0x66e1('0x2a')];}_0x5e1e87[_0x66e1('0x19')](_0x21fd24)[_0x66e1('0x2b')](_0x3fcc99);};}exports[_0x66e1('0x2c')]=function(_0x2b9045,_0x87bf90){var _0x24730f={},_0x53227c={},_0x1fefdb={'count':0x0,'rows':[]};var _0x1a708a=_['map'](db[_0x66e1('0x2d')][_0x66e1('0x2e')],function(_0xe4df21){return{'name':_0xe4df21[_0x66e1('0x2f')],'type':_0xe4df21['type'][_0x66e1('0x30')]};});_0x53227c[_0x66e1('0x31')]=_[_0x66e1('0x32')](_0x1a708a,'name');_0x53227c[_0x66e1('0x33')]=_['keys'](_0x2b9045['query']);_0x53227c['filters']=_[_0x66e1('0x34')](_0x53227c[_0x66e1('0x31')],_0x53227c['query']);_0x24730f[_0x66e1('0x35')]=_[_0x66e1('0x34')](_0x53227c['model'],qs['fields'](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x36')]));_0x24730f[_0x66e1('0x35')]=_0x24730f['attributes'][_0x66e1('0x37')]?_0x24730f[_0x66e1('0x35')]:_0x53227c[_0x66e1('0x31')];if(!_0x2b9045[_0x66e1('0x33')]['hasOwnProperty'](_0x66e1('0x38'))){_0x24730f[_0x66e1('0x1b')]=qs[_0x66e1('0x1b')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x1b')]);_0x24730f[_0x66e1('0x1d')]=qs[_0x66e1('0x1d')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x1d')]);}_0x24730f[_0x66e1('0x39')]=qs[_0x66e1('0x3a')](_0x2b9045[_0x66e1('0x33')][_0x66e1('0x3a')]);_0x24730f[_0x66e1('0x3b')]=qs[_0x66e1('0x3c')](_[_0x66e1('0x3d')](_0x2b9045[_0x66e1('0x33')],_0x53227c['filters']),_0x1a708a);if(_0x2b9045[_0x66e1('0x33')][_0x66e1('0x3e')]){_0x24730f[_0x66e1('0x3b')]=_['merge'](_0x24730f[_0x66e1('0x3b')],{'$or':_[_0x66e1('0x32')](_0x1a708a,function(_0xcaf0ae){if(_0xcaf0ae[_0x66e1('0x3f')]!==_0x66e1('0x40')){var _0x1bd058={};_0x1bd058[_0xcaf0ae[_0x66e1('0x2a')]]={'$like':'%'+_0x2b9045[_0x66e1('0x33')]['filter']+'%'};return _0x1bd058;}})});}_0x24730f=_[_0x66e1('0x41')]({},_0x24730f,_0x2b9045[_0x66e1('0x42')]);var _0x1d331e={'where':_0x24730f[_0x66e1('0x3b')]};return db[_0x66e1('0x2d')][_0x66e1('0x1c')](_0x1d331e)[_0x66e1('0x24')](function(_0x42f58e){_0x1fefdb[_0x66e1('0x1c')]=_0x42f58e;if(_0x2b9045[_0x66e1('0x33')][_0x66e1('0x43')]){_0x24730f[_0x66e1('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x66e1('0x45')](_0x24730f);})[_0x66e1('0x24')](function(_0x561b89){_0x1fefdb[_0x66e1('0x46')]=_0x561b89;return _0x1fefdb;})[_0x66e1('0x24')](respondWithFilteredResult(_0x87bf90,_0x24730f))[_0x66e1('0x47')](handleError(_0x87bf90,null));};exports[_0x66e1('0x48')]=function(_0x986bca,_0x9d35f1){var _0x406c70={'raw':![],'where':{'id':_0x986bca['params']['id']}},_0x46511c={};_0x46511c[_0x66e1('0x31')]=_['keys'](db[_0x66e1('0x2d')]['rawAttributes']);_0x46511c['query']=_[_0x66e1('0x49')](_0x986bca[_0x66e1('0x33')]);_0x46511c[_0x66e1('0x3c')]=_['intersection'](_0x46511c[_0x66e1('0x31')],_0x46511c[_0x66e1('0x33')]);_0x406c70[_0x66e1('0x35')]=_[_0x66e1('0x34')](_0x46511c['model'],qs['fields'](_0x986bca[_0x66e1('0x33')][_0x66e1('0x36')]));_0x406c70[_0x66e1('0x35')]=_0x406c70[_0x66e1('0x35')][_0x66e1('0x37')]?_0x406c70['attributes']:_0x46511c[_0x66e1('0x31')];if(_0x986bca['query'][_0x66e1('0x43')]){_0x406c70['include']=[{'all':!![]}];}_0x406c70=_[_0x66e1('0x41')]({},_0x406c70,_0x986bca['options']);return db[_0x66e1('0x2d')][_0x66e1('0x4a')](_0x406c70)[_0x66e1('0x24')](handleEntityNotFound(_0x9d35f1,null))[_0x66e1('0x24')](respondWithResult(_0x9d35f1,null))[_0x66e1('0x47')](handleError(_0x9d35f1,null));};exports[_0x66e1('0x4b')]=function(_0x529fe2,_0x317424){return db['VoiceChanSpy'][_0x66e1('0x4b')](_0x529fe2[_0x66e1('0x4c')],{})['then'](function(_0x441405){var _0xbb788c=_0x529fe2[_0x66e1('0x4d')][_0x66e1('0x4e')]({'plain':!![]});if(!_0xbb788c)throw new Error(_0x66e1('0x4f'));if(_0xbb788c['role']===_0x66e1('0x4d')){var _0x2db8f3=_0x441405[_0x66e1('0x4e')]({'plain':!![]});var _0x6bed1f=_0x66e1('0x26');return db[_0x66e1('0x50')][_0x66e1('0x4a')]({'where':{'name':_0x6bed1f,'userProfileId':_0xbb788c[_0x66e1('0x51')]},'raw':!![]})['then'](function(_0x7c6ced){if(_0x7c6ced&&_0x7c6ced[_0x66e1('0x52')]===0x0){return db[_0x66e1('0x27')]['create']({'name':_0x2db8f3[_0x66e1('0x2a')],'resourceId':_0x2db8f3['id'],'type':_0x7c6ced[_0x66e1('0x2a')],'sectionId':_0x7c6ced['id']},{})['then'](function(){return _0x441405;});}else{return _0x441405;}})['catch'](function(_0x14d27e){logger[_0x66e1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d27e);throw _0x14d27e;});}return _0x441405;})['then'](respondWithResult(_0x317424,0xc9))[_0x66e1('0x47')](handleError(_0x317424,null));};exports[_0x66e1('0x23')]=function(_0x172768,_0x1ef749){if(_0x172768[_0x66e1('0x4c')]['id']){delete _0x172768[_0x66e1('0x4c')]['id'];}return db[_0x66e1('0x2d')][_0x66e1('0x4a')]({'where':{'id':_0x172768['params']['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x1ef749,null))[_0x66e1('0x24')](saveUpdates(_0x172768[_0x66e1('0x4c')],null))[_0x66e1('0x24')](respondWithResult(_0x1ef749,null))['catch'](handleError(_0x1ef749,null));};exports[_0x66e1('0x25')]=function(_0x33eb7f,_0x169d5a){return db[_0x66e1('0x2d')][_0x66e1('0x4a')]({'where':{'id':_0x33eb7f[_0x66e1('0x53')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x169d5a,null))[_0x66e1('0x24')](removeEntity(_0x169d5a,null))[_0x66e1('0x47')](handleError(_0x169d5a,null));}; \ No newline at end of file +var _0xa588=['apply','reject','save','update','then','destroy','get','ChanSpies','sendStatus','error','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4afd22,_0x210f85){var _0x4a5a01=function(_0x29da8a){while(--_0x29da8a){_0x4afd22['push'](_0x4afd22['shift']());}};_0x4a5a01(++_0x210f85);}(_0xa588,0xe1));var _0x8a58=function(_0x136290,_0x3e6b8f){_0x136290=_0x136290-0x0;var _0x290e92=_0xa588[_0x136290];return _0x290e92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a58('0x0'));var zipdir=require(_0x8a58('0x1'));var jsonpatch=require(_0x8a58('0x2'));var rp=require(_0x8a58('0x3'));var moment=require(_0x8a58('0x4'));var BPromise=require(_0x8a58('0x5'));var Mustache=require(_0x8a58('0x6'));var util=require(_0x8a58('0x7'));var path=require(_0x8a58('0x8'));var sox=require('sox');var csv=require(_0x8a58('0x9'));var ejs=require(_0x8a58('0xa'));var fs=require('fs');var fs_extra=require(_0x8a58('0xb'));var _=require(_0x8a58('0xc'));var squel=require(_0x8a58('0xd'));var crypto=require(_0x8a58('0xe'));var jsforce=require(_0x8a58('0xf'));var deskjs=require(_0x8a58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a58('0x11'));var Papa=require(_0x8a58('0x12'));var Redis=require(_0x8a58('0x13'));var authService=require(_0x8a58('0x14'));var qs=require(_0x8a58('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a58('0x16'));var logger=require(_0x8a58('0x17'))(_0x8a58('0x18'));var utils=require(_0x8a58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a58('0x1a'))['db'];function respondWithStatusCode(_0x5ec103,_0x21208d){_0x21208d=_0x21208d||0xcc;return function(_0xc5d2fa){if(_0xc5d2fa){return _0x5ec103['sendStatus'](_0x21208d);}return _0x5ec103[_0x8a58('0x1b')](_0x21208d)[_0x8a58('0x1c')]();};}function respondWithResult(_0x56a61d,_0x3d40a5){_0x3d40a5=_0x3d40a5||0xc8;return function(_0x268506){if(_0x268506){return _0x56a61d['status'](_0x3d40a5)[_0x8a58('0x1d')](_0x268506);}};}function respondWithFilteredResult(_0x18a33c,_0x3010ae){return function(_0x3ff39e){if(_0x3ff39e){var _0x26e3a8=typeof _0x3010ae[_0x8a58('0x1e')]===_0x8a58('0x1f')&&typeof _0x3010ae['limit']==='undefined';var _0x31de8d=_0x3ff39e[_0x8a58('0x20')];var _0x18a14d=_0x26e3a8?0x0:_0x3010ae['offset'];var _0x282f2d=_0x26e3a8?_0x3ff39e[_0x8a58('0x20')]:_0x3010ae['offset']+_0x3010ae[_0x8a58('0x21')];var _0x15b527;if(_0x282f2d>=_0x31de8d){_0x282f2d=_0x31de8d;_0x15b527=0xc8;}else{_0x15b527=0xce;}_0x18a33c[_0x8a58('0x1b')](_0x15b527);return _0x18a33c[_0x8a58('0x22')](_0x8a58('0x23'),_0x18a14d+'-'+_0x282f2d+'/'+_0x31de8d)[_0x8a58('0x1d')](_0x3ff39e);}return null;};}function patchUpdates(_0x284bb8){return function(_0x115e19){try{jsonpatch[_0x8a58('0x24')](_0x115e19,_0x284bb8,!![]);}catch(_0xbf556a){return BPromise[_0x8a58('0x25')](_0xbf556a);}return _0x115e19[_0x8a58('0x26')]();};}function saveUpdates(_0x3758fa,_0x34adb8){return function(_0x561a9a){if(_0x561a9a){return _0x561a9a[_0x8a58('0x27')](_0x3758fa)[_0x8a58('0x28')](function(_0x20a6c5){return _0x20a6c5;});}return null;};}function removeEntity(_0x3f07ab,_0x22c898){return function(_0x415946){if(_0x415946){return _0x415946[_0x8a58('0x29')]()['then'](function(){var _0x1ff181=_0x415946[_0x8a58('0x2a')]({'plain':!![]});var _0x30c96b=_0x8a58('0x2b');return db['UserProfileResource'][_0x8a58('0x29')]({'where':{'type':_0x30c96b,'resourceId':_0x1ff181['id']}})[_0x8a58('0x28')](function(){return _0x415946;});})[_0x8a58('0x28')](function(){_0x3f07ab['status'](0xcc)[_0x8a58('0x1c')]();});}};}function handleEntityNotFound(_0x31abcc,_0x4426ff){return function(_0x27d7c8){if(!_0x27d7c8){_0x31abcc[_0x8a58('0x2c')](0x194);}return _0x27d7c8;};}function handleError(_0x3e317f,_0x1a411a){_0x1a411a=_0x1a411a||0x1f4;return function(_0x4d5041){logger[_0x8a58('0x2d')](_0x4d5041['stack']);if(_0x4d5041['name']){delete _0x4d5041['name'];}_0x3e317f['status'](_0x1a411a)['send'](_0x4d5041);};}exports[_0x8a58('0x2e')]=function(_0x175235,_0x1b2d9e){var _0x205b41={},_0x5dc010={},_0x261096={'count':0x0,'rows':[]};var _0x2a20ad=_[_0x8a58('0x2f')](db[_0x8a58('0x30')][_0x8a58('0x31')],function(_0x8ab99c){return{'name':_0x8ab99c[_0x8a58('0x32')],'type':_0x8ab99c[_0x8a58('0x33')]['key']};});_0x5dc010[_0x8a58('0x34')]=_[_0x8a58('0x2f')](_0x2a20ad,_0x8a58('0x35'));_0x5dc010[_0x8a58('0x36')]=_[_0x8a58('0x37')](_0x175235[_0x8a58('0x36')]);_0x5dc010['filters']=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],_0x5dc010[_0x8a58('0x36')]);_0x205b41[_0x8a58('0x39')]=_[_0x8a58('0x38')](_0x5dc010[_0x8a58('0x34')],qs[_0x8a58('0x3a')](_0x175235['query'][_0x8a58('0x3a')]));_0x205b41[_0x8a58('0x39')]=_0x205b41[_0x8a58('0x39')]['length']?_0x205b41['attributes']:_0x5dc010['model'];if(!_0x175235[_0x8a58('0x36')][_0x8a58('0x3b')](_0x8a58('0x3c'))){_0x205b41[_0x8a58('0x21')]=qs['limit'](_0x175235[_0x8a58('0x36')][_0x8a58('0x21')]);_0x205b41[_0x8a58('0x1e')]=qs[_0x8a58('0x1e')](_0x175235['query'][_0x8a58('0x1e')]);}_0x205b41[_0x8a58('0x3d')]=qs['sort'](_0x175235[_0x8a58('0x36')][_0x8a58('0x3e')]);_0x205b41[_0x8a58('0x3f')]=qs[_0x8a58('0x40')](_[_0x8a58('0x41')](_0x175235[_0x8a58('0x36')],_0x5dc010['filters']),_0x2a20ad);if(_0x175235['query'][_0x8a58('0x42')]){_0x205b41[_0x8a58('0x3f')]=_['merge'](_0x205b41[_0x8a58('0x3f')],{'$or':_[_0x8a58('0x2f')](_0x2a20ad,function(_0x478454){if(_0x478454[_0x8a58('0x33')]!==_0x8a58('0x43')){var _0x4e9e04={};_0x4e9e04[_0x478454[_0x8a58('0x35')]]={'$like':'%'+_0x175235['query'][_0x8a58('0x42')]+'%'};return _0x4e9e04;}})});}_0x205b41=_[_0x8a58('0x44')]({},_0x205b41,_0x175235[_0x8a58('0x45')]);var _0x40ca09={'where':_0x205b41[_0x8a58('0x3f')]};return db[_0x8a58('0x30')][_0x8a58('0x20')](_0x40ca09)['then'](function(_0x5cd9d8){_0x261096[_0x8a58('0x20')]=_0x5cd9d8;if(_0x175235['query']['includeAll']){_0x205b41[_0x8a58('0x46')]=[{'all':!![]}];}return db[_0x8a58('0x30')][_0x8a58('0x47')](_0x205b41);})['then'](function(_0x56a410){_0x261096[_0x8a58('0x48')]=_0x56a410;return _0x261096;})['then'](respondWithFilteredResult(_0x1b2d9e,_0x205b41))[_0x8a58('0x49')](handleError(_0x1b2d9e,null));};exports[_0x8a58('0x4a')]=function(_0x3feec0,_0x3faae2){var _0x4c9c56={'raw':![],'where':{'id':_0x3feec0[_0x8a58('0x4b')]['id']}},_0x417951={};_0x417951['model']=_[_0x8a58('0x37')](db[_0x8a58('0x30')][_0x8a58('0x31')]);_0x417951[_0x8a58('0x36')]=_['keys'](_0x3feec0[_0x8a58('0x36')]);_0x417951['filters']=_[_0x8a58('0x38')](_0x417951[_0x8a58('0x34')],_0x417951['query']);_0x4c9c56[_0x8a58('0x39')]=_['intersection'](_0x417951['model'],qs[_0x8a58('0x3a')](_0x3feec0[_0x8a58('0x36')][_0x8a58('0x3a')]));_0x4c9c56[_0x8a58('0x39')]=_0x4c9c56[_0x8a58('0x39')][_0x8a58('0x4c')]?_0x4c9c56['attributes']:_0x417951['model'];if(_0x3feec0[_0x8a58('0x36')][_0x8a58('0x4d')]){_0x4c9c56[_0x8a58('0x46')]=[{'all':!![]}];}_0x4c9c56=_[_0x8a58('0x44')]({},_0x4c9c56,_0x3feec0[_0x8a58('0x45')]);return db[_0x8a58('0x30')][_0x8a58('0x4e')](_0x4c9c56)[_0x8a58('0x28')](handleEntityNotFound(_0x3faae2,null))[_0x8a58('0x28')](respondWithResult(_0x3faae2,null))[_0x8a58('0x49')](handleError(_0x3faae2,null));};exports[_0x8a58('0x4f')]=function(_0x392c32,_0x1ea824){return db[_0x8a58('0x30')]['create'](_0x392c32[_0x8a58('0x50')],{})[_0x8a58('0x28')](function(_0xeb5231){var _0x409f9e=_0x392c32[_0x8a58('0x51')][_0x8a58('0x2a')]({'plain':!![]});if(!_0x409f9e)throw new Error(_0x8a58('0x52'));if(_0x409f9e['role']==='user'){var _0x5ab682=_0xeb5231[_0x8a58('0x2a')]({'plain':!![]});var _0xe0ed75=_0x8a58('0x2b');return db['UserProfileSection'][_0x8a58('0x4e')]({'where':{'name':_0xe0ed75,'userProfileId':_0x409f9e[_0x8a58('0x53')]},'raw':!![]})[_0x8a58('0x28')](function(_0x3ad78c){if(_0x3ad78c&&_0x3ad78c[_0x8a58('0x54')]===0x0){return db[_0x8a58('0x55')][_0x8a58('0x4f')]({'name':_0x5ab682[_0x8a58('0x35')],'resourceId':_0x5ab682['id'],'type':_0x3ad78c[_0x8a58('0x35')],'sectionId':_0x3ad78c['id']},{})[_0x8a58('0x28')](function(){return _0xeb5231;});}else{return _0xeb5231;}})[_0x8a58('0x49')](function(_0x130406){logger['error'](_0x8a58('0x56'),_0x130406);throw _0x130406;});}return _0xeb5231;})[_0x8a58('0x28')](respondWithResult(_0x1ea824,0xc9))['catch'](handleError(_0x1ea824,null));};exports[_0x8a58('0x27')]=function(_0xfab1e4,_0x1ce5e0){if(_0xfab1e4['body']['id']){delete _0xfab1e4[_0x8a58('0x50')]['id'];}return db['VoiceChanSpy'][_0x8a58('0x4e')]({'where':{'id':_0xfab1e4[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x1ce5e0,null))[_0x8a58('0x28')](saveUpdates(_0xfab1e4[_0x8a58('0x50')],null))[_0x8a58('0x28')](respondWithResult(_0x1ce5e0,null))[_0x8a58('0x49')](handleError(_0x1ce5e0,null));};exports[_0x8a58('0x29')]=function(_0x2c4a18,_0x53fbde){return db[_0x8a58('0x30')][_0x8a58('0x4e')]({'where':{'id':_0x2c4a18[_0x8a58('0x4b')]['id']}})[_0x8a58('0x28')](handleEntityNotFound(_0x53fbde,null))[_0x8a58('0x28')](removeEntity(_0x53fbde,null))['catch'](handleError(_0x53fbde,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6a19686..099a41b 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 _0x9039=['then','catch','exports','models','define','voice_chanspy','bulkCreate','destroy','VoiceExtension','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','merge','Set','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','push','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','agent'];(function(_0x498b8f,_0x460c72){var _0x26c57e=function(_0x59f493){while(--_0x59f493){_0x498b8f['push'](_0x498b8f['shift']());}};_0x26c57e(++_0x460c72);}(_0x9039,0x1c3));var _0x9903=function(_0x270a12,_0x50745c){_0x270a12=_0x270a12-0x0;var _0x35ce30=_0x9039[_0x270a12];return _0x35ce30;};'use strict';var _=require(_0x9903('0x0'));var util=require(_0x9903('0x1'));var BPromise=require(_0x9903('0x2'));var attributes=require(_0x9903('0x3'));var getUserApplications=function(_0x1f9c41,_0x2e4568,_0x323238){var _0x1dde6d=0x1;var _0x37bb89=[];var _0x419906={'context':_0x2e4568[_0x9903('0x4')]||_0x9903('0x5'),'exten':util[_0x9903('0x6')]('%s%s',_0x1f9c41['prefix'],_0x323238),'type':'system','isApp':![],'ChanSpyId':_0x1f9c41['id'],'UserId':_0x2e4568['id']};_0x37bb89['push'](_[_0x9903('0x7')]({'app':_0x9903('0x8'),'appdata':util[_0x9903('0x6')](_0x9903('0x9'),'chanspy'),'priority':_0x1dde6d++},_0x419906));if(_0x1f9c41['record']){_0x37bb89['push'](_[_0x9903('0x7')]({'app':_0x9903('0xa'),'appdata':util[_0x9903('0x6')](_0x9903('0xb'),_0x1f9c41['recordingFormat']),'priority':_0x1dde6d++},_0x419906));}if(_0x1f9c41[_0x9903('0xc')]){_0x37bb89['push'](_[_0x9903('0x7')]({'app':_0x9903('0xd'),'appdata':_0x1f9c41['password'],'priority':_0x1dde6d++},_0x419906));}_0x37bb89[_0x9903('0xe')](_['merge']({'app':'ChanSpy','appdata':util[_0x9903('0x6')](_0x9903('0xf'),_0x2e4568[_0x9903('0x10')],_0x1f9c41[_0x9903('0x11')]?_0x1f9c41[_0x9903('0x11')][_0x9903('0x12')](''):''),'priority':_0x1dde6d++},_0x419906));if(_0x1f9c41[_0x9903('0x13')]){_0x37bb89['push'](_[_0x9903('0x7')]({'app':_0x9903('0x14'),'priority':_0x1dde6d++},_0x419906));}return _0x37bb89;};var getChanSpyApplications=function(_0x13ecf1,_0x323e2d){var _0x5a06e4=[];for(var _0x51fdbd=0x0,_0xd399e4=0x1;_0x51fdbd<_0x323e2d[_0x9903('0x15')];_0x51fdbd++,_0xd399e4=0x1){_0x5a06e4=_0x5a06e4[_0x9903('0x16')](getUserApplications(_0x13ecf1,_0x323e2d[_0x51fdbd],_0x323e2d[_0x51fdbd][_0x9903('0x17')]));if(_0x323e2d[_0x51fdbd][_0x9903('0x17')]!=_0x323e2d[_0x51fdbd][_0x9903('0x10')]){_0x5a06e4=_0x5a06e4[_0x9903('0x16')](getUserApplications(_0x13ecf1,_0x323e2d[_0x51fdbd],_0x323e2d[_0x51fdbd][_0x9903('0x10')]));}}return _0x5a06e4;};var getChanSpyPromise=function(_0x202158,_0x400c2e){return new BPromise(function(_0x50b073,_0xcb573f){return _0x202158['User']['findAll']({'attributes':['id',_0x9903('0x10'),_0x9903('0x17')],'where':{'role':_0x9903('0x18'),'chanspy':!![]},'raw':!![]})[_0x9903('0x19')](function(_0x26afc0){if(_0x26afc0){return _0x50b073(getChanSpyApplications(_0x400c2e,_0x26afc0));}return _0x50b073([]);})[_0x9903('0x1a')](function(_0x4aa142){_0xcb573f(_0x4aa142);});});};module[_0x9903('0x1b')]=function(_0x3c923e,_0xe724aa){var _0x5464a8=_0x3c923e[_0x9903('0x1c')];return _0x3c923e[_0x9903('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0x9903('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41608b,_0x327763,_0x418ca7){return getChanSpyPromise(_0x5464a8,_0x41608b)['then'](function(_0xf28fd){if(_0xf28fd&&_0xf28fd[_0x9903('0x15')]){return _0x5464a8['VoiceExtension'][_0x9903('0x1f')](_0xf28fd);}})['then'](function(){_0x418ca7();})['catch'](function(_0x654819){_0x418ca7(_0x654819);});},'afterUpdate':function(_0x465d93,_0x37ccfa,_0x2bb826){return _0x5464a8['VoiceExtension'][_0x9903('0x20')]({'where':{'ChanSpyId':_0x465d93['id']}})[_0x9903('0x19')](function(){return getChanSpyPromise(_0x5464a8,_0x465d93);})['then'](function(_0x930795){if(_0x930795&&_0x930795[_0x9903('0x15')]){return _0x5464a8[_0x9903('0x21')][_0x9903('0x1f')](_0x930795);}})[_0x9903('0x19')](function(){_0x2bb826();})[_0x9903('0x1a')](function(_0x4570f1){_0x2bb826(_0x4570f1);});},'afterDestroy':function(_0xb97437,_0x46cd5e,_0x3b64c4){return _0x5464a8[_0x9903('0x21')][_0x9903('0x20')]({'where':{'ChanSpyId':_0xb97437['id']}})[_0x9903('0x19')](function(){_0x3b64c4();})[_0x9903('0x1a')](function(_0x370c38){_0x3b64c4(_0x370c38);});}}});}; \ No newline at end of file +var _0xca09=['Set','CDR(type)=%s','chanspy','record','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','findAll','agent','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','./voiceChanSpy.attributes','context','%s%s','prefix','push','merge'];(function(_0x1261ac,_0x357a74){var _0x363168=function(_0x45c05c){while(--_0x45c05c){_0x1261ac['push'](_0x1261ac['shift']());}};_0x363168(++_0x357a74);}(_0xca09,0xac));var _0x9ca0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca09[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9ca0('0x0'));var util=require(_0x9ca0('0x1'));var BPromise=require('bluebird');var attributes=require(_0x9ca0('0x2'));var getUserApplications=function(_0x3275c1,_0x33a4b6,_0x2ee13c){var _0x2ae352=0x1;var _0x10d710=[];var _0x5e5b4a={'context':_0x33a4b6[_0x9ca0('0x3')]||'from-sip','exten':util['format'](_0x9ca0('0x4'),_0x3275c1[_0x9ca0('0x5')],_0x2ee13c),'type':'system','isApp':![],'ChanSpyId':_0x3275c1['id'],'UserId':_0x33a4b6['id']};_0x10d710[_0x9ca0('0x6')](_[_0x9ca0('0x7')]({'app':_0x9ca0('0x8'),'appdata':util['format'](_0x9ca0('0x9'),_0x9ca0('0xa')),'priority':_0x2ae352++},_0x5e5b4a));if(_0x3275c1[_0x9ca0('0xb')]){_0x10d710['push'](_[_0x9ca0('0x7')]({'app':_0x9ca0('0xc'),'appdata':util[_0x9ca0('0xd')](_0x9ca0('0xe'),_0x3275c1[_0x9ca0('0xf')]),'priority':_0x2ae352++},_0x5e5b4a));}if(_0x3275c1['auth']){_0x10d710[_0x9ca0('0x6')](_[_0x9ca0('0x7')]({'app':_0x9ca0('0x10'),'appdata':_0x3275c1[_0x9ca0('0x11')],'priority':_0x2ae352++},_0x5e5b4a));}_0x10d710[_0x9ca0('0x6')](_[_0x9ca0('0x7')]({'app':'ChanSpy','appdata':util[_0x9ca0('0xd')](_0x9ca0('0x12'),_0x33a4b6[_0x9ca0('0x13')],_0x3275c1[_0x9ca0('0x14')]?_0x3275c1['options']['join'](''):''),'priority':_0x2ae352++},_0x5e5b4a));if(_0x3275c1[_0x9ca0('0xb')]){_0x10d710[_0x9ca0('0x6')](_[_0x9ca0('0x7')]({'app':_0x9ca0('0x15'),'priority':_0x2ae352++},_0x5e5b4a));}return _0x10d710;};var getChanSpyApplications=function(_0x12c8fe,_0x2f51fb){var _0x27376d=[];for(var _0x215bae=0x0,_0x5229f7=0x1;_0x215bae<_0x2f51fb[_0x9ca0('0x16')];_0x215bae++,_0x5229f7=0x1){_0x27376d=_0x27376d[_0x9ca0('0x17')](getUserApplications(_0x12c8fe,_0x2f51fb[_0x215bae],_0x2f51fb[_0x215bae][_0x9ca0('0x18')]));if(_0x2f51fb[_0x215bae][_0x9ca0('0x18')]!=_0x2f51fb[_0x215bae][_0x9ca0('0x13')]){_0x27376d=_0x27376d[_0x9ca0('0x17')](getUserApplications(_0x12c8fe,_0x2f51fb[_0x215bae],_0x2f51fb[_0x215bae][_0x9ca0('0x13')]));}}return _0x27376d;};var getChanSpyPromise=function(_0x334339,_0x51b5c4){return new BPromise(function(_0x2924f1,_0x5e6032){return _0x334339['User'][_0x9ca0('0x19')]({'attributes':['id',_0x9ca0('0x13'),'internal'],'where':{'role':_0x9ca0('0x1a'),'chanspy':!![]},'raw':!![]})[_0x9ca0('0x1b')](function(_0x484c31){if(_0x484c31){return _0x2924f1(getChanSpyApplications(_0x51b5c4,_0x484c31));}return _0x2924f1([]);})['catch'](function(_0x21e95b){_0x5e6032(_0x21e95b);});});};module[_0x9ca0('0x1c')]=function(_0x35b3c6,_0x32d718){var _0x48ac1c=_0x35b3c6[_0x9ca0('0x1d')];return _0x35b3c6['define'](_0x9ca0('0x1e'),attributes,{'tableName':_0x9ca0('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa45c34,_0x45c973,_0x2848f7){return getChanSpyPromise(_0x48ac1c,_0xa45c34)[_0x9ca0('0x1b')](function(_0x578ce6){if(_0x578ce6&&_0x578ce6['length']){return _0x48ac1c[_0x9ca0('0x20')][_0x9ca0('0x21')](_0x578ce6);}})[_0x9ca0('0x1b')](function(){_0x2848f7();})[_0x9ca0('0x22')](function(_0x2c7b56){_0x2848f7(_0x2c7b56);});},'afterUpdate':function(_0x242805,_0x5a2a01,_0x2da87b){return _0x48ac1c[_0x9ca0('0x20')][_0x9ca0('0x23')]({'where':{'ChanSpyId':_0x242805['id']}})[_0x9ca0('0x1b')](function(){return getChanSpyPromise(_0x48ac1c,_0x242805);})[_0x9ca0('0x1b')](function(_0x16de82){if(_0x16de82&&_0x16de82[_0x9ca0('0x16')]){return _0x48ac1c[_0x9ca0('0x20')]['bulkCreate'](_0x16de82);}})[_0x9ca0('0x1b')](function(){_0x2da87b();})[_0x9ca0('0x22')](function(_0x65194){_0x2da87b(_0x65194);});},'afterDestroy':function(_0x532b41,_0x57b1d5,_0x530cdc){return _0x48ac1c[_0x9ca0('0x20')][_0x9ca0('0x23')]({'where':{'ChanSpyId':_0x532b41['id']}})[_0x9ca0('0x1b')](function(){_0x530cdc();})[_0x9ca0('0x22')](function(_0x43be68){_0x530cdc(_0x43be68);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2565a9b..22f2248 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 _0xb49a=['info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3199af,_0x339560){var _0x5aa4d0=function(_0x1cb5f0){while(--_0x1cb5f0){_0x3199af['push'](_0x3199af['shift']());}};_0x5aa4d0(++_0x339560);}(_0xb49a,0xfb));var _0xab49=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xb49a[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});} \ No newline at end of file +var _0x39cb=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8059636..86afbbc 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 _0xc5ac=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','update','delete'];(function(_0x155ef6,_0x2ade34){var _0x4e4164=function(_0x3b2486){while(--_0x3b2486){_0x155ef6['push'](_0x155ef6['shift']());}};_0x4e4164(++_0x2ade34);}(_0xc5ac,0x100));var _0xcc5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5ac[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xcc5a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc5a('0x1'));var router=express[_0xcc5a('0x2')]();var fs_extra=require(_0xcc5a('0x3'));var auth=require(_0xcc5a('0x4'));var interaction=require(_0xcc5a('0x5'));var config=require(_0xcc5a('0x6'));var controller=require(_0xcc5a('0x7'));router['get']('/',auth[_0xcc5a('0x8')](),controller[_0xcc5a('0x9')]);router[_0xcc5a('0xa')](_0xcc5a('0xb'),auth[_0xcc5a('0x8')](),controller[_0xcc5a('0xc')]);router[_0xcc5a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcc5a('0xb'),auth[_0xcc5a('0x8')](),controller[_0xcc5a('0xe')]);router[_0xcc5a('0xf')](_0xcc5a('0xb'),auth[_0xcc5a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe523=['../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x437537,_0x19b4a5){var _0x1d9de1=function(_0x4a9cc7){while(--_0x4a9cc7){_0x437537['push'](_0x437537['shift']());}};_0x1d9de1(++_0x19b4a5);}(_0xe523,0x147));var _0x3e52=function(_0xd69818,_0x2ad5de){_0xd69818=_0xd69818-0x0;var _0x3544a0=_0xe523[_0xd69818];return _0x3544a0;};'use strict';var multer=require(_0x3e52('0x0'));var util=require('util');var path=require(_0x3e52('0x1'));var timeout=require(_0x3e52('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3e52('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x3e52('0x4')]('/',auth[_0x3e52('0x5')](),controller[_0x3e52('0x6')]);router[_0x3e52('0x4')](_0x3e52('0x7'),auth[_0x3e52('0x5')](),controller[_0x3e52('0x8')]);router[_0x3e52('0x9')]('/',auth[_0x3e52('0x5')](),controller[_0x3e52('0xa')]);router[_0x3e52('0xb')](_0x3e52('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x3e52('0xc')](_0x3e52('0x7'),auth[_0x3e52('0x5')](),controller[_0x3e52('0xd')]);module[_0x3e52('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c436100..20ef348 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 _0x1dec=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x1dec,0x157));var _0xc1de=function(_0x45c388,_0xb70f0a){_0x45c388=_0x45c388-0x0;var _0x24acb7=_0x1dec[_0x45c388];return _0x24acb7;};'use strict';var Sequelize=require(_0xc1de('0x0'));module[_0xc1de('0x1')]={'name':{'type':Sequelize[_0xc1de('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xc1de('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc1de('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64b0=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x64b0,0xd4));var _0x064b=function(_0x1f2010,_0x183444){_0x1f2010=_0x1f2010-0x0;var _0x31621b=_0x64b0[_0x1f2010];return _0x31621b;};'use strict';var Sequelize=require(_0x064b('0x0'));module[_0x064b('0x1')]={'name':{'type':Sequelize[_0x064b('0x2')],'unique':_0x064b('0x3')},'description':{'type':Sequelize[_0x064b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x064b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d581915..e9fc09f 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 _0xfb3f=['destroy','Contexts','UserProfileResource','stack','name','send','index','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','keys','options','find','create','body','join','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','server/files/templates/context.ejs','readFileSync','root','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','undefined','offset','count','limit','set','json','save','update'];(function(_0x29e327,_0x2b6ea9){var _0x3dac9e=function(_0x5c0e02){while(--_0x5c0e02){_0x29e327['push'](_0x29e327['shift']());}};_0x3dac9e(++_0x2b6ea9);}(_0xfb3f,0x99));var _0xffb3=function(_0x150766,_0x458f38){_0x150766=_0x150766-0x0;var _0x12a585=_0xfb3f[_0x150766];return _0x12a585;};'use strict';var emlformat=require(_0xffb3('0x0'));var rimraf=require(_0xffb3('0x1'));var zipdir=require(_0xffb3('0x2'));var jsonpatch=require(_0xffb3('0x3'));var rp=require(_0xffb3('0x4'));var moment=require(_0xffb3('0x5'));var BPromise=require(_0xffb3('0x6'));var Mustache=require(_0xffb3('0x7'));var util=require(_0xffb3('0x8'));var path=require(_0xffb3('0x9'));var sox=require(_0xffb3('0xa'));var csv=require(_0xffb3('0xb'));var ejs=require(_0xffb3('0xc'));var fs=require('fs');var fs_extra=require(_0xffb3('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xffb3('0xe'));var toCsv=require(_0xffb3('0xb'));var querystring=require('querystring');var Papa=require(_0xffb3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xffb3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffb3('0x11'));var logger=require(_0xffb3('0x12'))('api');var utils=require(_0xffb3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xffb3('0x14'));var db=require(_0xffb3('0x15'))['db'];var jayson=require(_0xffb3('0x16'));var client=jayson['client'][_0xffb3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4873a2,_0xff0caa,_0x30cb3a,_0x1a8e33){return new BPromise(function(_0x3d5539,_0x440edd){var _0x2f832f=_0x1a8e33||client;return _0x2f832f['request'](_0x4873a2,_0x30cb3a)[_0xffb3('0x18')](function(_0x5eee20){logger[_0xffb3('0x19')](_0xffb3('0x1a'),_0xff0caa,_0xffb3('0x1b'));logger[_0xffb3('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xff0caa,_0xffb3('0x1b'),JSON[_0xffb3('0x1d')](_0x5eee20));if(_0x5eee20[_0xffb3('0x1e')]){if(_0x5eee20[_0xffb3('0x1e')]['code']===0x1f4){logger[_0xffb3('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xff0caa,_0x5eee20[_0xffb3('0x1e')][_0xffb3('0x1f')]);return _0x440edd(_0x5eee20[_0xffb3('0x1e')][_0xffb3('0x1f')]);}logger[_0xffb3('0x1e')](_0xffb3('0x1a'),_0xff0caa,_0x5eee20[_0xffb3('0x1e')]['message']);return _0x3d5539(_0x5eee20[_0xffb3('0x1e')][_0xffb3('0x1f')]);}else{logger[_0xffb3('0x19')](_0xffb3('0x1a'),_0xff0caa,_0xffb3('0x1b'));_0x3d5539(_0x5eee20[_0xffb3('0x20')][_0xffb3('0x1f')]);}})[_0xffb3('0x21')](function(_0x1a2958){logger['error'](_0xffb3('0x1a'),_0xff0caa,_0x1a2958);_0x440edd(_0x1a2958);});});}function respondWithStatusCode(_0x4ed94e,_0x5af32f){_0x5af32f=_0x5af32f||0xcc;return function(_0x42c3b0){if(_0x42c3b0){return _0x4ed94e[_0xffb3('0x22')](_0x5af32f);}return _0x4ed94e[_0xffb3('0x23')](_0x5af32f)[_0xffb3('0x24')]();};}function respondWithResult(_0x146385,_0x29fa32){_0x29fa32=_0x29fa32||0xc8;return function(_0x4da7da){if(_0x4da7da){return _0x146385[_0xffb3('0x23')](_0x29fa32)['json'](_0x4da7da);}};}function respondWithFilteredResult(_0x2dd9f4,_0x10fbd6){return function(_0x22b33d){if(_0x22b33d){var _0x5fa11f=typeof _0x10fbd6['offset']===_0xffb3('0x25')&&typeof _0x10fbd6['limit']===_0xffb3('0x25');var _0x1cd811=_0x22b33d['count'];var _0x54b465=_0x5fa11f?0x0:_0x10fbd6[_0xffb3('0x26')];var _0x2ea14f=_0x5fa11f?_0x22b33d[_0xffb3('0x27')]:_0x10fbd6['offset']+_0x10fbd6[_0xffb3('0x28')];var _0x355de1;if(_0x2ea14f>=_0x1cd811){_0x2ea14f=_0x1cd811;_0x355de1=0xc8;}else{_0x355de1=0xce;}_0x2dd9f4[_0xffb3('0x23')](_0x355de1);return _0x2dd9f4[_0xffb3('0x29')]('Content-Range',_0x54b465+'-'+_0x2ea14f+'/'+_0x1cd811)[_0xffb3('0x2a')](_0x22b33d);}return null;};}function patchUpdates(_0x15a1e2){return function(_0x4a5da8){try{jsonpatch['apply'](_0x4a5da8,_0x15a1e2,!![]);}catch(_0x4244a0){return BPromise['reject'](_0x4244a0);}return _0x4a5da8[_0xffb3('0x2b')]();};}function saveUpdates(_0xe7574b,_0x183b0a){return function(_0x6faf07){if(_0x6faf07){return _0x6faf07[_0xffb3('0x2c')](_0xe7574b)[_0xffb3('0x18')](function(_0x40500e){return _0x40500e;});}return null;};}function removeEntity(_0x5334f3,_0xd9f2b1){return function(_0x3ed32b){if(_0x3ed32b){return _0x3ed32b[_0xffb3('0x2d')]()['then'](function(){var _0x41c964=_0x3ed32b['get']({'plain':!![]});var _0x235175=_0xffb3('0x2e');return db[_0xffb3('0x2f')][_0xffb3('0x2d')]({'where':{'type':_0x235175,'resourceId':_0x41c964['id']}})[_0xffb3('0x18')](function(){return _0x3ed32b;});})[_0xffb3('0x18')](function(){_0x5334f3['status'](0xcc)[_0xffb3('0x24')]();});}};}function handleEntityNotFound(_0x3f8173,_0x3e6828){return function(_0x2894da){if(!_0x2894da){_0x3f8173[_0xffb3('0x22')](0x194);}return _0x2894da;};}function handleError(_0xc890b1,_0x5041da){_0x5041da=_0x5041da||0x1f4;return function(_0x1414a8){logger[_0xffb3('0x1e')](_0x1414a8[_0xffb3('0x30')]);if(_0x1414a8[_0xffb3('0x31')]){delete _0x1414a8[_0xffb3('0x31')];}_0xc890b1[_0xffb3('0x23')](_0x5041da)[_0xffb3('0x32')](_0x1414a8);};}exports[_0xffb3('0x33')]=function(_0x517a85,_0x475bf2){var _0x551f09={},_0x1654a6={},_0x1bbe83={'count':0x0,'rows':[]};var _0x513bea=_['map'](db['VoiceContext'][_0xffb3('0x34')],function(_0x2d81be){return{'name':_0x2d81be['fieldName'],'type':_0x2d81be[_0xffb3('0x35')]['key']};});_0x1654a6[_0xffb3('0x36')]=_[_0xffb3('0x37')](_0x513bea,_0xffb3('0x31'));_0x1654a6[_0xffb3('0x38')]=_['keys'](_0x517a85[_0xffb3('0x38')]);_0x1654a6[_0xffb3('0x39')]=_[_0xffb3('0x3a')](_0x1654a6[_0xffb3('0x36')],_0x1654a6['query']);_0x551f09['attributes']=_[_0xffb3('0x3a')](_0x1654a6[_0xffb3('0x36')],qs[_0xffb3('0x3b')](_0x517a85['query'][_0xffb3('0x3b')]));_0x551f09['attributes']=_0x551f09[_0xffb3('0x3c')][_0xffb3('0x3d')]?_0x551f09[_0xffb3('0x3c')]:_0x1654a6[_0xffb3('0x36')];if(!_0x517a85['query'][_0xffb3('0x3e')](_0xffb3('0x3f'))){_0x551f09['limit']=qs[_0xffb3('0x28')](_0x517a85[_0xffb3('0x38')][_0xffb3('0x28')]);_0x551f09[_0xffb3('0x26')]=qs[_0xffb3('0x26')](_0x517a85[_0xffb3('0x38')]['offset']);}_0x551f09[_0xffb3('0x40')]=qs[_0xffb3('0x41')](_0x517a85[_0xffb3('0x38')][_0xffb3('0x41')]);_0x551f09[_0xffb3('0x42')]=qs[_0xffb3('0x39')](_[_0xffb3('0x43')](_0x517a85[_0xffb3('0x38')],_0x1654a6[_0xffb3('0x39')]),_0x513bea);if(_0x517a85['query'][_0xffb3('0x44')]){_0x551f09[_0xffb3('0x42')]=_[_0xffb3('0x45')](_0x551f09[_0xffb3('0x42')],{'$or':_[_0xffb3('0x37')](_0x513bea,function(_0x23b845){if(_0x23b845[_0xffb3('0x35')]!==_0xffb3('0x46')){var _0x3e7357={};_0x3e7357[_0x23b845[_0xffb3('0x31')]]={'$like':'%'+_0x517a85['query']['filter']+'%'};return _0x3e7357;}})});}_0x551f09=_[_0xffb3('0x45')]({},_0x551f09,_0x517a85['options']);var _0x57658e={'where':_0x551f09[_0xffb3('0x42')]};return db[_0xffb3('0x47')][_0xffb3('0x27')](_0x57658e)[_0xffb3('0x18')](function(_0x374db1){_0x1bbe83[_0xffb3('0x27')]=_0x374db1;if(_0x517a85['query'][_0xffb3('0x48')]){_0x551f09[_0xffb3('0x49')]=[{'all':!![]}];}return db[_0xffb3('0x47')][_0xffb3('0x4a')](_0x551f09);})['then'](function(_0x33732c){_0x1bbe83['rows']=_0x33732c;return _0x1bbe83;})[_0xffb3('0x18')](respondWithFilteredResult(_0x475bf2,_0x551f09))[_0xffb3('0x21')](handleError(_0x475bf2,null));};exports[_0xffb3('0x4b')]=function(_0x45a3b0,_0x54dde8){var _0x323d2e={'raw':![],'where':{'id':_0x45a3b0[_0xffb3('0x4c')]['id']}},_0xce6b8a={};_0xce6b8a['model']=_[_0xffb3('0x4d')](db[_0xffb3('0x47')][_0xffb3('0x34')]);_0xce6b8a[_0xffb3('0x38')]=_['keys'](_0x45a3b0['query']);_0xce6b8a[_0xffb3('0x39')]=_[_0xffb3('0x3a')](_0xce6b8a[_0xffb3('0x36')],_0xce6b8a['query']);_0x323d2e[_0xffb3('0x3c')]=_[_0xffb3('0x3a')](_0xce6b8a[_0xffb3('0x36')],qs[_0xffb3('0x3b')](_0x45a3b0[_0xffb3('0x38')][_0xffb3('0x3b')]));_0x323d2e[_0xffb3('0x3c')]=_0x323d2e['attributes'][_0xffb3('0x3d')]?_0x323d2e[_0xffb3('0x3c')]:_0xce6b8a[_0xffb3('0x36')];if(_0x45a3b0[_0xffb3('0x38')][_0xffb3('0x48')]){_0x323d2e[_0xffb3('0x49')]=[{'all':!![]}];}_0x323d2e=_[_0xffb3('0x45')]({},_0x323d2e,_0x45a3b0[_0xffb3('0x4e')]);return db['VoiceContext'][_0xffb3('0x4f')](_0x323d2e)['then'](handleEntityNotFound(_0x54dde8,null))[_0xffb3('0x18')](respondWithResult(_0x54dde8,null))[_0xffb3('0x21')](handleError(_0x54dde8,null));};exports['create']=function(_0x43e19d,_0x1d6021,_0xc66216){var _0xc1b412;return db[_0xffb3('0x47')][_0xffb3('0x50')](_0x43e19d[_0xffb3('0x51')],{'raw':!![]})[_0xffb3('0x18')](function(_0x18754b){_0xc1b412=_0x18754b;return db[_0xffb3('0x47')]['findAll']({'raw':!![]});})[_0xffb3('0x18')](function(_0x705867){var _0x198f93=fs['readFileSync'](path[_0xffb3('0x52')](config['root'],'server/files/templates/context.ejs'),_0xffb3('0x53'));var _0x1724f7=ejs[_0xffb3('0x54')](_0x198f93,{'contexts':_0x705867||[]});fs[_0xffb3('0x55')](_0xffb3('0x56'),_0x1724f7);})[_0xffb3('0x18')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xffb3('0x57')});})[_0xffb3('0x18')](function(){var _0x445158=_0x43e19d['user'][_0xffb3('0x58')]({'plain':!![]});if(!_0x445158)throw new Error(_0xffb3('0x59'));if(_0x445158[_0xffb3('0x5a')]===_0xffb3('0x5b')){var _0x12b1d6=_0xc1b412['get']({'plain':!![]});return db[_0xffb3('0x5c')]['find']({'where':{'name':'Contexts','userProfileId':_0x445158[_0xffb3('0x5d')]},'raw':!![]})[_0xffb3('0x18')](function(_0x52577c){if(_0x52577c&&_0x52577c[_0xffb3('0x5e')]===0x0){return db[_0xffb3('0x2f')][_0xffb3('0x50')]({'name':_0x12b1d6[_0xffb3('0x31')],'resourceId':_0x12b1d6['id'],'type':_0x52577c[_0xffb3('0x31')],'sectionId':_0x52577c['id']},{})[_0xffb3('0x18')](function(){return _0xc1b412;});}else{return _0xc1b412;}})[_0xffb3('0x21')](function(_0x3c50e4){logger[_0xffb3('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c50e4);throw _0x3c50e4;});}return _0xc1b412;})[_0xffb3('0x18')](respondWithResult(_0x1d6021,0xc9))[_0xffb3('0x21')](handleError(_0x1d6021,null));};exports[_0xffb3('0x2c')]=function(_0x1ed38a,_0x12612f,_0x39c25d){var _0x5933d0;return db[_0xffb3('0x47')][_0xffb3('0x4f')]({'where':{'id':_0x1ed38a['params']['id']}})[_0xffb3('0x18')](handleEntityNotFound(_0x12612f,null))[_0xffb3('0x18')](saveUpdates(_0x1ed38a[_0xffb3('0x51')],null))[_0xffb3('0x18')](function(_0x17e9f8){if(_0x17e9f8){_0x5933d0=_0x17e9f8;return db[_0xffb3('0x47')][_0xffb3('0x4a')]({'raw':!![]});}})[_0xffb3('0x18')](function(_0x3e8f83){var _0x3485d1=fs['readFileSync'](path[_0xffb3('0x52')](config['root'],_0xffb3('0x5f')),_0xffb3('0x53'));var _0x3bec11=ejs[_0xffb3('0x54')](_0x3485d1,{'contexts':_0x3e8f83||[]});fs[_0xffb3('0x55')](_0xffb3('0x56'),_0x3bec11);})[_0xffb3('0x18')](function(){return respondWithRpcPromise('Reload',_0xffb3('0x2c'),{'module':_0xffb3('0x57')});})[_0xffb3('0x18')](function(){return _0x5933d0;})['then'](respondWithResult(_0x12612f,null))[_0xffb3('0x21')](handleError(_0x12612f,null));};exports[_0xffb3('0x2d')]=function(_0x943899,_0x5d1d56,_0x91f05){var _0x2839cb;return db[_0xffb3('0x47')][_0xffb3('0x4f')]({'where':{'id':_0x943899[_0xffb3('0x4c')]['id']}})[_0xffb3('0x18')](handleEntityNotFound(_0x5d1d56,null))['then'](removeEntity(_0x5d1d56,null))['then'](function(){return db[_0xffb3('0x47')][_0xffb3('0x4a')]({'raw':!![]});})[_0xffb3('0x18')](function(_0x34406b){var _0xd7c2bd=fs[_0xffb3('0x60')](path[_0xffb3('0x52')](config[_0xffb3('0x61')],_0xffb3('0x5f')),_0xffb3('0x53'));var _0x2598f0=ejs[_0xffb3('0x54')](_0xd7c2bd,{'contexts':_0x34406b});fs['writeFileSync'](_0xffb3('0x56'),_0x2598f0);return respondWithRpcPromise(_0xffb3('0x62'),_0xffb3('0x2d'),{'module':_0xffb3('0x57')});})['catch'](handleError(_0x5d1d56,null));}; \ No newline at end of file +var _0x6662=['readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','options','VoiceContext','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0x482e73,_0x3bdd95){var _0x587fae=function(_0x119bf3){while(--_0x119bf3){_0x482e73['push'](_0x482e73['shift']());}};_0x587fae(++_0x3bdd95);}(_0x6662,0x13c));var _0x2666=function(_0xd93406,_0x5041d2){_0xd93406=_0xd93406-0x0;var _0x258da5=_0x6662[_0xd93406];return _0x258da5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2666('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2666('0x1'));var moment=require('moment');var BPromise=require(_0x2666('0x2'));var Mustache=require(_0x2666('0x3'));var util=require(_0x2666('0x4'));var path=require(_0x2666('0x5'));var sox=require('sox');var csv=require(_0x2666('0x6'));var ejs=require(_0x2666('0x7'));var fs=require('fs');var fs_extra=require(_0x2666('0x8'));var _=require(_0x2666('0x9'));var squel=require(_0x2666('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2666('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2666('0xc'));var Redis=require(_0x2666('0xd'));var authService=require(_0x2666('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2666('0xf'));var logger=require(_0x2666('0x10'))(_0x2666('0x11'));var utils=require(_0x2666('0x12'));var config=require(_0x2666('0x13'));var licenseUtil=require(_0x2666('0x14'));var db=require(_0x2666('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2666('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21739c,_0x2f45ff,_0x3a54fe,_0x2b3774){return new BPromise(function(_0x1acd8d,_0x56c253){var _0x2ed9b1=_0x2b3774||client;return _0x2ed9b1[_0x2666('0x17')](_0x21739c,_0x3a54fe)[_0x2666('0x18')](function(_0xd86209){logger[_0x2666('0x19')]('VoiceContext,\x20%s,\x20%s',_0x2f45ff,_0x2666('0x1a'));logger['debug'](_0x2666('0x1b'),_0x2f45ff,_0x2666('0x1a'),JSON[_0x2666('0x1c')](_0xd86209));if(_0xd86209[_0x2666('0x1d')]){if(_0xd86209['error']['code']===0x1f4){logger[_0x2666('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x2f45ff,_0xd86209[_0x2666('0x1d')][_0x2666('0x1e')]);return _0x56c253(_0xd86209[_0x2666('0x1d')][_0x2666('0x1e')]);}logger[_0x2666('0x1d')](_0x2666('0x1f'),_0x2f45ff,_0xd86209[_0x2666('0x1d')][_0x2666('0x1e')]);return _0x1acd8d(_0xd86209[_0x2666('0x1d')][_0x2666('0x1e')]);}else{logger[_0x2666('0x19')](_0x2666('0x1f'),_0x2f45ff,_0x2666('0x1a'));_0x1acd8d(_0xd86209[_0x2666('0x20')][_0x2666('0x1e')]);}})['catch'](function(_0x5cba8e){logger[_0x2666('0x1d')](_0x2666('0x1f'),_0x2f45ff,_0x5cba8e);_0x56c253(_0x5cba8e);});});}function respondWithStatusCode(_0x28d0de,_0x16ac0d){_0x16ac0d=_0x16ac0d||0xcc;return function(_0x17a3fb){if(_0x17a3fb){return _0x28d0de[_0x2666('0x21')](_0x16ac0d);}return _0x28d0de[_0x2666('0x22')](_0x16ac0d)[_0x2666('0x23')]();};}function respondWithResult(_0x3f5952,_0x1dabae){_0x1dabae=_0x1dabae||0xc8;return function(_0x341f19){if(_0x341f19){return _0x3f5952[_0x2666('0x22')](_0x1dabae)['json'](_0x341f19);}};}function respondWithFilteredResult(_0x24e72f,_0x2b58b0){return function(_0x58a92c){if(_0x58a92c){var _0x3d4f27=typeof _0x2b58b0[_0x2666('0x24')]===_0x2666('0x25')&&typeof _0x2b58b0[_0x2666('0x26')]===_0x2666('0x25');var _0x4528e9=_0x58a92c[_0x2666('0x27')];var _0x5b9487=_0x3d4f27?0x0:_0x2b58b0['offset'];var _0x1fe3ea=_0x3d4f27?_0x58a92c[_0x2666('0x27')]:_0x2b58b0['offset']+_0x2b58b0[_0x2666('0x26')];var _0x27ff1e;if(_0x1fe3ea>=_0x4528e9){_0x1fe3ea=_0x4528e9;_0x27ff1e=0xc8;}else{_0x27ff1e=0xce;}_0x24e72f[_0x2666('0x22')](_0x27ff1e);return _0x24e72f[_0x2666('0x28')](_0x2666('0x29'),_0x5b9487+'-'+_0x1fe3ea+'/'+_0x4528e9)[_0x2666('0x2a')](_0x58a92c);}return null;};}function patchUpdates(_0x16756e){return function(_0x45ab58){try{jsonpatch[_0x2666('0x2b')](_0x45ab58,_0x16756e,!![]);}catch(_0x5eff2c){return BPromise[_0x2666('0x2c')](_0x5eff2c);}return _0x45ab58[_0x2666('0x2d')]();};}function saveUpdates(_0xd34f20,_0x111d4f){return function(_0x2e286a){if(_0x2e286a){return _0x2e286a[_0x2666('0x2e')](_0xd34f20)[_0x2666('0x18')](function(_0xfb7f15){return _0xfb7f15;});}return null;};}function removeEntity(_0x300fae,_0x1fdaf2){return function(_0x3f0f49){if(_0x3f0f49){return _0x3f0f49[_0x2666('0x2f')]()['then'](function(){var _0xe8deab=_0x3f0f49['get']({'plain':!![]});var _0x4914fa=_0x2666('0x30');return db[_0x2666('0x31')][_0x2666('0x2f')]({'where':{'type':_0x4914fa,'resourceId':_0xe8deab['id']}})[_0x2666('0x18')](function(){return _0x3f0f49;});})[_0x2666('0x18')](function(){_0x300fae['status'](0xcc)[_0x2666('0x23')]();});}};}function handleEntityNotFound(_0x20fe44,_0x41604d){return function(_0x1c0220){if(!_0x1c0220){_0x20fe44[_0x2666('0x21')](0x194);}return _0x1c0220;};}function handleError(_0x3a19a3,_0x31f808){_0x31f808=_0x31f808||0x1f4;return function(_0x5af8f7){logger[_0x2666('0x1d')](_0x5af8f7[_0x2666('0x32')]);if(_0x5af8f7['name']){delete _0x5af8f7[_0x2666('0x33')];}_0x3a19a3[_0x2666('0x22')](_0x31f808)[_0x2666('0x34')](_0x5af8f7);};}exports[_0x2666('0x35')]=function(_0x6f4adc,_0x2577b0){var _0x56dcac={},_0x58f351={},_0x44a3bc={'count':0x0,'rows':[]};var _0x46c45c=_['map'](db['VoiceContext'][_0x2666('0x36')],function(_0x52f5a5){return{'name':_0x52f5a5[_0x2666('0x37')],'type':_0x52f5a5[_0x2666('0x38')][_0x2666('0x39')]};});_0x58f351[_0x2666('0x3a')]=_['map'](_0x46c45c,_0x2666('0x33'));_0x58f351[_0x2666('0x3b')]=_[_0x2666('0x3c')](_0x6f4adc[_0x2666('0x3b')]);_0x58f351[_0x2666('0x3d')]=_[_0x2666('0x3e')](_0x58f351[_0x2666('0x3a')],_0x58f351[_0x2666('0x3b')]);_0x56dcac[_0x2666('0x3f')]=_[_0x2666('0x3e')](_0x58f351[_0x2666('0x3a')],qs[_0x2666('0x40')](_0x6f4adc[_0x2666('0x3b')]['fields']));_0x56dcac[_0x2666('0x3f')]=_0x56dcac['attributes']['length']?_0x56dcac[_0x2666('0x3f')]:_0x58f351[_0x2666('0x3a')];if(!_0x6f4adc['query'][_0x2666('0x41')]('nolimit')){_0x56dcac[_0x2666('0x26')]=qs[_0x2666('0x26')](_0x6f4adc[_0x2666('0x3b')][_0x2666('0x26')]);_0x56dcac[_0x2666('0x24')]=qs[_0x2666('0x24')](_0x6f4adc['query'][_0x2666('0x24')]);}_0x56dcac[_0x2666('0x42')]=qs[_0x2666('0x43')](_0x6f4adc[_0x2666('0x3b')]['sort']);_0x56dcac[_0x2666('0x44')]=qs[_0x2666('0x3d')](_['pick'](_0x6f4adc[_0x2666('0x3b')],_0x58f351[_0x2666('0x3d')]),_0x46c45c);if(_0x6f4adc['query'][_0x2666('0x45')]){_0x56dcac[_0x2666('0x44')]=_[_0x2666('0x46')](_0x56dcac[_0x2666('0x44')],{'$or':_[_0x2666('0x47')](_0x46c45c,function(_0x459e1f){if(_0x459e1f[_0x2666('0x38')]!=='VIRTUAL'){var _0x2198f8={};_0x2198f8[_0x459e1f[_0x2666('0x33')]]={'$like':'%'+_0x6f4adc[_0x2666('0x3b')]['filter']+'%'};return _0x2198f8;}})});}_0x56dcac=_[_0x2666('0x46')]({},_0x56dcac,_0x6f4adc[_0x2666('0x48')]);var _0x3fd804={'where':_0x56dcac[_0x2666('0x44')]};return db[_0x2666('0x49')][_0x2666('0x27')](_0x3fd804)[_0x2666('0x18')](function(_0x5eb7f1){_0x44a3bc['count']=_0x5eb7f1;if(_0x6f4adc['query'][_0x2666('0x4a')]){_0x56dcac['include']=[{'all':!![]}];}return db[_0x2666('0x49')][_0x2666('0x4b')](_0x56dcac);})[_0x2666('0x18')](function(_0x373b38){_0x44a3bc[_0x2666('0x4c')]=_0x373b38;return _0x44a3bc;})[_0x2666('0x18')](respondWithFilteredResult(_0x2577b0,_0x56dcac))[_0x2666('0x4d')](handleError(_0x2577b0,null));};exports[_0x2666('0x4e')]=function(_0x1831a4,_0x4e7693){var _0x49335d={'raw':![],'where':{'id':_0x1831a4[_0x2666('0x4f')]['id']}},_0x505815={};_0x505815['model']=_[_0x2666('0x3c')](db[_0x2666('0x49')][_0x2666('0x36')]);_0x505815[_0x2666('0x3b')]=_[_0x2666('0x3c')](_0x1831a4[_0x2666('0x3b')]);_0x505815[_0x2666('0x3d')]=_[_0x2666('0x3e')](_0x505815['model'],_0x505815[_0x2666('0x3b')]);_0x49335d[_0x2666('0x3f')]=_[_0x2666('0x3e')](_0x505815['model'],qs[_0x2666('0x40')](_0x1831a4[_0x2666('0x3b')][_0x2666('0x40')]));_0x49335d[_0x2666('0x3f')]=_0x49335d['attributes']['length']?_0x49335d[_0x2666('0x3f')]:_0x505815[_0x2666('0x3a')];if(_0x1831a4[_0x2666('0x3b')][_0x2666('0x4a')]){_0x49335d[_0x2666('0x50')]=[{'all':!![]}];}_0x49335d=_[_0x2666('0x46')]({},_0x49335d,_0x1831a4[_0x2666('0x48')]);return db['VoiceContext'][_0x2666('0x51')](_0x49335d)['then'](handleEntityNotFound(_0x4e7693,null))[_0x2666('0x18')](respondWithResult(_0x4e7693,null))[_0x2666('0x4d')](handleError(_0x4e7693,null));};exports[_0x2666('0x52')]=function(_0x38fb8b,_0x56f863,_0x381e00){var _0x14d3a6;return db[_0x2666('0x49')][_0x2666('0x52')](_0x38fb8b[_0x2666('0x53')],{'raw':!![]})[_0x2666('0x18')](function(_0xad651a){_0x14d3a6=_0xad651a;return db[_0x2666('0x49')][_0x2666('0x4b')]({'raw':!![]});})['then'](function(_0x2da646){var _0x46a198=fs[_0x2666('0x54')](path['join'](config[_0x2666('0x55')],_0x2666('0x56')),_0x2666('0x57'));var _0xeee926=ejs[_0x2666('0x58')](_0x46a198,{'contexts':_0x2da646||[]});fs[_0x2666('0x59')](_0x2666('0x5a'),_0xeee926);})[_0x2666('0x18')](function(){return respondWithRpcPromise(_0x2666('0x5b'),_0x2666('0x52'),{'module':_0x2666('0x5c')});})[_0x2666('0x18')](function(){var _0x5270a2=_0x38fb8b['user'][_0x2666('0x5d')]({'plain':!![]});if(!_0x5270a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5270a2[_0x2666('0x5e')]==='user'){var _0x119b8a=_0x14d3a6[_0x2666('0x5d')]({'plain':!![]});return db[_0x2666('0x5f')][_0x2666('0x51')]({'where':{'name':_0x2666('0x30'),'userProfileId':_0x5270a2[_0x2666('0x60')]},'raw':!![]})[_0x2666('0x18')](function(_0xbcca8a){if(_0xbcca8a&&_0xbcca8a[_0x2666('0x61')]===0x0){return db[_0x2666('0x31')]['create']({'name':_0x119b8a[_0x2666('0x33')],'resourceId':_0x119b8a['id'],'type':_0xbcca8a[_0x2666('0x33')],'sectionId':_0xbcca8a['id']},{})[_0x2666('0x18')](function(){return _0x14d3a6;});}else{return _0x14d3a6;}})[_0x2666('0x4d')](function(_0x9f915f){logger['error'](_0x2666('0x62'),_0x9f915f);throw _0x9f915f;});}return _0x14d3a6;})['then'](respondWithResult(_0x56f863,0xc9))[_0x2666('0x4d')](handleError(_0x56f863,null));};exports['update']=function(_0x10ca9f,_0x5be754,_0x2e27b9){var _0x1a8e67;return db[_0x2666('0x49')]['find']({'where':{'id':_0x10ca9f[_0x2666('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5be754,null))['then'](saveUpdates(_0x10ca9f[_0x2666('0x53')],null))[_0x2666('0x18')](function(_0x173808){if(_0x173808){_0x1a8e67=_0x173808;return db[_0x2666('0x49')][_0x2666('0x4b')]({'raw':!![]});}})[_0x2666('0x18')](function(_0x2ce16e){var _0x23d96e=fs['readFileSync'](path[_0x2666('0x63')](config['root'],_0x2666('0x56')),_0x2666('0x57'));var _0x4b312c=ejs[_0x2666('0x58')](_0x23d96e,{'contexts':_0x2ce16e||[]});fs[_0x2666('0x59')](_0x2666('0x5a'),_0x4b312c);})['then'](function(){return respondWithRpcPromise(_0x2666('0x5b'),'update',{'module':_0x2666('0x5c')});})['then'](function(){return _0x1a8e67;})[_0x2666('0x18')](respondWithResult(_0x5be754,null))[_0x2666('0x4d')](handleError(_0x5be754,null));};exports[_0x2666('0x2f')]=function(_0x16b8b7,_0x576882,_0x557e36){var _0x55a4a6;return db[_0x2666('0x49')][_0x2666('0x51')]({'where':{'id':_0x16b8b7[_0x2666('0x4f')]['id']}})[_0x2666('0x18')](handleEntityNotFound(_0x576882,null))[_0x2666('0x18')](removeEntity(_0x576882,null))[_0x2666('0x18')](function(){return db[_0x2666('0x49')][_0x2666('0x4b')]({'raw':!![]});})[_0x2666('0x18')](function(_0x33668a){var _0x4488f5=fs[_0x2666('0x54')](path[_0x2666('0x63')](config[_0x2666('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x1518c5=ejs[_0x2666('0x58')](_0x4488f5,{'contexts':_0x33668a});fs[_0x2666('0x59')](_0x2666('0x5a'),_0x1518c5);return respondWithRpcPromise(_0x2666('0x5b'),_0x2666('0x2f'),{'module':_0x2666('0x5c')});})[_0x2666('0x4d')](handleError(_0x576882,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 59a0aba..a1257dc 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 _0xf98d=['./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x149736,_0x15dbc4){var _0x3c9a80=function(_0x5d0397){while(--_0x5d0397){_0x149736['push'](_0x149736['shift']());}};_0x3c9a80(++_0x15dbc4);}(_0xf98d,0xc4));var _0xdf98=function(_0x138985,_0xd4f776){_0x138985=_0x138985-0x0;var _0x36a6e6=_0xf98d[_0x138985];return _0x36a6e6;};'use strict';var _=require('lodash');var util=require(_0xdf98('0x0'));var logger=require(_0xdf98('0x1'))(_0xdf98('0x2'));var moment=require(_0xdf98('0x3'));var BPromise=require(_0xdf98('0x4'));var rp=require(_0xdf98('0x5'));var fs=require('fs');var path=require(_0xdf98('0x6'));var rimraf=require(_0xdf98('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf98('0x8'));module['exports']=function(_0x2e46ec,_0x57ee8e){return _0x2e46ec[_0xdf98('0x9')](_0xdf98('0xa'),attributes,{'tableName':_0xdf98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x969e=['VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x969e,0x136));var _0xe969=function(_0x100139,_0x2f1e04){_0x100139=_0x100139-0x0;var _0x3e41cc=_0x969e[_0x100139];return _0x3e41cc;};'use strict';var _=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var logger=require('../../config/logger')(_0xe969('0x2'));var moment=require(_0xe969('0x3'));var BPromise=require(_0xe969('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe969('0x5'));var attributes=require(_0xe969('0x6'));module[_0xe969('0x7')]=function(_0x18d730,_0x5d564d){return _0x18d730[_0xe969('0x8')](_0xe969('0x9'),attributes,{'tableName':_0xe969('0xa'),'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 c87d879..aad6875 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 _0xd57b=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','catch','lodash','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent'];(function(_0x369623,_0x304fd4){var _0x91a077=function(_0x34bb3f){while(--_0x34bb3f){_0x369623['push'](_0x369623['shift']());}};_0x91a077(++_0x304fd4);}(_0xd57b,0x1be));var _0xbd57=function(_0x3a4236,_0x1488df){_0x3a4236=_0x3a4236-0x0;var _0x52d615=_0xd57b[_0x3a4236];return _0x52d615;};'use strict';var _=require(_0xbd57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd57('0x1'));var db=require(_0xbd57('0x2'))['db'];var utils=require(_0xbd57('0x3'));var logger=require('../../config/logger')(_0xbd57('0x4'));var config=require('../../config/environment');var jayson=require(_0xbd57('0x5'));var client=jayson['client'][_0xbd57('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1a8df9,_0x453e94,_0xeba986){return new BPromise(function(_0x8fe30b,_0x32ee5f){return client[_0xbd57('0x7')](_0x1a8df9,_0xeba986)[_0xbd57('0x8')](function(_0x3aad6a){logger['info']('VoiceContext,\x20%s,\x20%s',_0x453e94,_0xbd57('0x9'));logger[_0xbd57('0xa')](_0xbd57('0xb'),_0x453e94,_0xbd57('0x9'),JSON[_0xbd57('0xc')](_0x3aad6a));if(_0x3aad6a[_0xbd57('0xd')]){if(_0x3aad6a[_0xbd57('0xd')][_0xbd57('0xe')]===0x1f4){logger[_0xbd57('0xd')](_0xbd57('0xf'),_0x453e94,_0x3aad6a[_0xbd57('0xd')][_0xbd57('0x10')]);return _0x32ee5f(_0x3aad6a['error'][_0xbd57('0x10')]);}logger[_0xbd57('0xd')]('VoiceContext,\x20%s,\x20%s',_0x453e94,_0x3aad6a[_0xbd57('0xd')][_0xbd57('0x10')]);return _0x8fe30b(_0x3aad6a[_0xbd57('0xd')][_0xbd57('0x10')]);}else{logger[_0xbd57('0x11')](_0xbd57('0xf'),_0x453e94,_0xbd57('0x9'));_0x8fe30b(_0x3aad6a['result']['message']);}})[_0xbd57('0x12')](function(_0x18da7e){logger[_0xbd57('0xd')](_0xbd57('0xf'),_0x453e94,_0x18da7e);_0x32ee5f(_0x18da7e);});});} \ No newline at end of file +var _0xa1bf=['result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s'];(function(_0xabbca1,_0x1ae520){var _0x3330a9=function(_0x8aff30){while(--_0x8aff30){_0xabbca1['push'](_0xabbca1['shift']());}};_0x3330a9(++_0x1ae520);}(_0xa1bf,0x91));var _0xfa1b=function(_0x3cccfb,_0x4eac2d){_0x3cccfb=_0x3cccfb-0x0;var _0x16110f=_0xa1bf[_0x3cccfb];return _0x16110f;};'use strict';var _=require('lodash');var util=require(_0xfa1b('0x0'));var moment=require(_0xfa1b('0x1'));var BPromise=require('bluebird');var rs=require(_0xfa1b('0x2'));var fs=require('fs');var Redis=require(_0xfa1b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa1b('0x4'));var logger=require(_0xfa1b('0x5'))(_0xfa1b('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa1b('0x7'));var client=jayson['client'][_0xfa1b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a2d1f,_0xf297fc,_0x2d430c){return new BPromise(function(_0x398d41,_0x4ce604){return client['request'](_0x3a2d1f,_0x2d430c)['then'](function(_0x1f7719){logger[_0xfa1b('0x9')]('VoiceContext,\x20%s,\x20%s',_0xf297fc,'request\x20sent');logger[_0xfa1b('0xa')](_0xfa1b('0xb'),_0xf297fc,'request\x20sent',JSON[_0xfa1b('0xc')](_0x1f7719));if(_0x1f7719[_0xfa1b('0xd')]){if(_0x1f7719['error'][_0xfa1b('0xe')]===0x1f4){logger[_0xfa1b('0xd')]('VoiceContext,\x20%s,\x20%s',_0xf297fc,_0x1f7719[_0xfa1b('0xd')]['message']);return _0x4ce604(_0x1f7719[_0xfa1b('0xd')][_0xfa1b('0xf')]);}logger[_0xfa1b('0xd')]('VoiceContext,\x20%s,\x20%s',_0xf297fc,_0x1f7719[_0xfa1b('0xd')][_0xfa1b('0xf')]);return _0x398d41(_0x1f7719[_0xfa1b('0xd')][_0xfa1b('0xf')]);}else{logger[_0xfa1b('0x9')](_0xfa1b('0x10'),_0xf297fc,'request\x20sent');_0x398d41(_0x1f7719[_0xfa1b('0x11')]['message']);}})['catch'](function(_0x57fffa){logger[_0xfa1b('0xd')]('VoiceContext,\x20%s,\x20%s',_0xf297fc,_0x57fffa);_0x4ce604(_0x57fffa);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bee0239..ff34202 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 _0x4dcb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','create','/:id','update','delete','destroy','exports','multer','util','express'];(function(_0x4d2a5b,_0x50a2b3){var _0x469b4f=function(_0x555736){while(--_0x555736){_0x4d2a5b['push'](_0x4d2a5b['shift']());}};_0x469b4f(++_0x50a2b3);}(_0x4dcb,0x153));var _0xb4dc=function(_0x548558,_0x37489d){_0x548558=_0x548558-0x0;var _0x38b266=_0x4dcb[_0x548558];return _0x38b266;};'use strict';var multer=require(_0xb4dc('0x0'));var util=require(_0xb4dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb4dc('0x2'));var router=express[_0xb4dc('0x3')]();var fs_extra=require(_0xb4dc('0x4'));var auth=require(_0xb4dc('0x5'));var interaction=require(_0xb4dc('0x6'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xb4dc('0x7')]('/',auth['isAuthenticated'](),controller[_0xb4dc('0x8')]);router['get'](_0xb4dc('0x9'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xb')]);router[_0xb4dc('0x7')]('/:id',auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb4dc('0xd')]);router['put'](_0xb4dc('0xe'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0xf')]);router[_0xb4dc('0x10')](_0xb4dc('0xe'),auth[_0xb4dc('0xa')](),controller[_0xb4dc('0x11')]);module[_0xb4dc('0x12')]=router; \ No newline at end of file +var _0xe148=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','show','post','create'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe148,0x109));var _0x8e14=function(_0x53d0f2,_0x461fff){_0x53d0f2=_0x53d0f2-0x0;var _0x4039fe=_0xe148[_0x53d0f2];return _0x4039fe;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require(_0x8e14('0x2'));var timeout=require(_0x8e14('0x3'));var express=require(_0x8e14('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require(_0x8e14('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8e14('0x9')](_0x8e14('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8e14('0x9')]('/:id',auth[_0x8e14('0xb')](),controller[_0x8e14('0xc')]);router[_0x8e14('0xd')]('/',auth[_0x8e14('0xb')](),controller[_0x8e14('0xe')]);router[_0x8e14('0xf')](_0x8e14('0x10'),auth[_0x8e14('0xb')](),controller['update']);router[_0x8e14('0x11')]('/:id',auth[_0x8e14('0xb')](),controller[_0x8e14('0x12')]);module[_0x8e14('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2e972b9..7c5d206 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x4c9044,_0x10735b){var _0x322b73=function(_0x36da1c){while(--_0x36da1c){_0x4c9044['push'](_0x4c9044['shift']());}};_0x322b73(++_0x10735b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x1b1dd2,_0x54f33f){var _0x5ae50d=function(_0x5e6935){while(--_0x5e6935){_0x1b1dd2['push'](_0x1b1dd2['shift']());}};_0x5ae50d(++_0x54f33f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1ebe2f,_0x523227){_0x1ebe2f=_0x1ebe2f-0x0;var _0xdeb06f=_0xf3cd[_0x1ebe2f];return _0xdeb06f;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 866e3c5..93d7afe 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 _0x9922=['rows','catch','show','params','keys','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll'];(function(_0x8f270,_0x2f435f){var _0x5446cb=function(_0x6b3be8){while(--_0x6b3be8){_0x8f270['push'](_0x8f270['shift']());}};_0x5446cb(++_0x2f435f);}(_0x9922,0xa8));var _0x2992=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9922[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2992('0x0'));var rimraf=require(_0x2992('0x1'));var zipdir=require(_0x2992('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2992('0x3'));var moment=require(_0x2992('0x4'));var BPromise=require(_0x2992('0x5'));var Mustache=require(_0x2992('0x6'));var util=require(_0x2992('0x7'));var path=require(_0x2992('0x8'));var sox=require(_0x2992('0x9'));var csv=require('to-csv');var ejs=require(_0x2992('0xa'));var fs=require('fs');var fs_extra=require(_0x2992('0xb'));var _=require(_0x2992('0xc'));var squel=require(_0x2992('0xd'));var crypto=require('crypto');var jsforce=require(_0x2992('0xe'));var deskjs=require(_0x2992('0xf'));var toCsv=require(_0x2992('0x10'));var querystring=require(_0x2992('0x11'));var Papa=require(_0x2992('0x12'));var Redis=require(_0x2992('0x13'));var authService=require(_0x2992('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2992('0x15'));var hardwareService=require(_0x2992('0x16'));var logger=require(_0x2992('0x17'))(_0x2992('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2992('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x524dc0,_0x29ca99){_0x29ca99=_0x29ca99||0xcc;return function(_0x5ca1c6){if(_0x5ca1c6){return _0x524dc0['sendStatus'](_0x29ca99);}return _0x524dc0[_0x2992('0x1a')](_0x29ca99)[_0x2992('0x1b')]();};}function respondWithResult(_0x3c2db8,_0x4081e8){_0x4081e8=_0x4081e8||0xc8;return function(_0x44aa8f){if(_0x44aa8f){return _0x3c2db8[_0x2992('0x1a')](_0x4081e8)[_0x2992('0x1c')](_0x44aa8f);}};}function respondWithFilteredResult(_0x27bc64,_0x5598b6){return function(_0x7211d3){if(_0x7211d3){var _0x2f2432=typeof _0x5598b6[_0x2992('0x1d')]===_0x2992('0x1e')&&typeof _0x5598b6['limit']==='undefined';var _0x2016b4=_0x7211d3['count'];var _0x52b840=_0x2f2432?0x0:_0x5598b6['offset'];var _0x2106d6=_0x2f2432?_0x7211d3[_0x2992('0x1f')]:_0x5598b6['offset']+_0x5598b6[_0x2992('0x20')];var _0x56b0f8;if(_0x2106d6>=_0x2016b4){_0x2106d6=_0x2016b4;_0x56b0f8=0xc8;}else{_0x56b0f8=0xce;}_0x27bc64[_0x2992('0x1a')](_0x56b0f8);return _0x27bc64[_0x2992('0x21')](_0x2992('0x22'),_0x52b840+'-'+_0x2106d6+'/'+_0x2016b4)[_0x2992('0x1c')](_0x7211d3);}return null;};}function patchUpdates(_0x137452){return function(_0x4d39ac){try{jsonpatch[_0x2992('0x23')](_0x4d39ac,_0x137452,!![]);}catch(_0x10a993){return BPromise[_0x2992('0x24')](_0x10a993);}return _0x4d39ac[_0x2992('0x25')]();};}function saveUpdates(_0x51befc,_0x201042){return function(_0x1203d0){if(_0x1203d0){return _0x1203d0[_0x2992('0x26')](_0x51befc)[_0x2992('0x27')](function(_0x378947){return _0x378947;});}return null;};}function removeEntity(_0xbebbd9,_0x1b630d){return function(_0x4bc9eb){if(_0x4bc9eb){return _0x4bc9eb['destroy']()[_0x2992('0x27')](function(){_0xbebbd9[_0x2992('0x1a')](0xcc)[_0x2992('0x1b')]();});}};}function handleEntityNotFound(_0x4c16b8,_0x1e6334){return function(_0x258a0d){if(!_0x258a0d){_0x4c16b8[_0x2992('0x28')](0x194);}return _0x258a0d;};}function handleError(_0x1028ae,_0x5b5b26){_0x5b5b26=_0x5b5b26||0x1f4;return function(_0x293288){logger[_0x2992('0x29')](_0x293288['stack']);if(_0x293288['name']){delete _0x293288[_0x2992('0x2a')];}_0x1028ae[_0x2992('0x1a')](_0x5b5b26)[_0x2992('0x2b')](_0x293288);};}exports[_0x2992('0x2c')]=function(_0x3b29ab,_0x1c0501){var _0x5d3a32={},_0x3d9ec9={},_0x5b309b={'count':0x0,'rows':[]};var _0x597062=_['map'](db[_0x2992('0x2d')][_0x2992('0x2e')],function(_0x2d8cde){return{'name':_0x2d8cde[_0x2992('0x2f')],'type':_0x2d8cde[_0x2992('0x30')][_0x2992('0x31')]};});_0x3d9ec9[_0x2992('0x32')]=_[_0x2992('0x33')](_0x597062,_0x2992('0x2a'));_0x3d9ec9[_0x2992('0x34')]=_['keys'](_0x3b29ab[_0x2992('0x34')]);_0x3d9ec9[_0x2992('0x35')]=_['intersection'](_0x3d9ec9[_0x2992('0x32')],_0x3d9ec9[_0x2992('0x34')]);_0x5d3a32[_0x2992('0x36')]=_[_0x2992('0x37')](_0x3d9ec9[_0x2992('0x32')],qs[_0x2992('0x38')](_0x3b29ab[_0x2992('0x34')][_0x2992('0x38')]));_0x5d3a32[_0x2992('0x36')]=_0x5d3a32['attributes'][_0x2992('0x39')]?_0x5d3a32['attributes']:_0x3d9ec9[_0x2992('0x32')];if(!_0x3b29ab['query'][_0x2992('0x3a')](_0x2992('0x3b'))){_0x5d3a32[_0x2992('0x20')]=qs[_0x2992('0x20')](_0x3b29ab[_0x2992('0x34')][_0x2992('0x20')]);_0x5d3a32[_0x2992('0x1d')]=qs[_0x2992('0x1d')](_0x3b29ab[_0x2992('0x34')][_0x2992('0x1d')]);}_0x5d3a32[_0x2992('0x3c')]=qs['sort'](_0x3b29ab['query'][_0x2992('0x3d')]);_0x5d3a32[_0x2992('0x3e')]=qs[_0x2992('0x35')](_[_0x2992('0x3f')](_0x3b29ab[_0x2992('0x34')],_0x3d9ec9['filters']),_0x597062);if(_0x3b29ab[_0x2992('0x34')][_0x2992('0x40')]){_0x5d3a32[_0x2992('0x3e')]=_[_0x2992('0x41')](_0x5d3a32[_0x2992('0x3e')],{'$or':_[_0x2992('0x33')](_0x597062,function(_0x55b0d9){if(_0x55b0d9['type']!=='VIRTUAL'){var _0x3fdcd1={};_0x3fdcd1[_0x55b0d9[_0x2992('0x2a')]]={'$like':'%'+_0x3b29ab['query'][_0x2992('0x40')]+'%'};return _0x3fdcd1;}})});}_0x5d3a32=_['merge']({},_0x5d3a32,_0x3b29ab['options']);var _0xcb0764={'where':_0x5d3a32[_0x2992('0x3e')]};return db[_0x2992('0x2d')][_0x2992('0x1f')](_0xcb0764)[_0x2992('0x27')](function(_0x45a506){_0x5b309b['count']=_0x45a506;if(_0x3b29ab[_0x2992('0x34')][_0x2992('0x42')]){_0x5d3a32[_0x2992('0x43')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x2992('0x44')](_0x5d3a32);})['then'](function(_0x26ff4d){_0x5b309b[_0x2992('0x45')]=_0x26ff4d;return _0x5b309b;})[_0x2992('0x27')](respondWithFilteredResult(_0x1c0501,_0x5d3a32))[_0x2992('0x46')](handleError(_0x1c0501,null));};exports[_0x2992('0x47')]=function(_0x1d6783,_0x51de98){var _0x2ebc7c={'raw':!![],'where':{'id':_0x1d6783[_0x2992('0x48')]['id']}},_0x5b39a4={};_0x5b39a4['model']=_[_0x2992('0x49')](db[_0x2992('0x2d')][_0x2992('0x2e')]);_0x5b39a4[_0x2992('0x34')]=_[_0x2992('0x49')](_0x1d6783[_0x2992('0x34')]);_0x5b39a4['filters']=_[_0x2992('0x37')](_0x5b39a4[_0x2992('0x32')],_0x5b39a4[_0x2992('0x34')]);_0x2ebc7c[_0x2992('0x36')]=_[_0x2992('0x37')](_0x5b39a4[_0x2992('0x32')],qs[_0x2992('0x38')](_0x1d6783['query']['fields']));_0x2ebc7c[_0x2992('0x36')]=_0x2ebc7c[_0x2992('0x36')][_0x2992('0x39')]?_0x2ebc7c[_0x2992('0x36')]:_0x5b39a4[_0x2992('0x32')];if(_0x1d6783[_0x2992('0x34')][_0x2992('0x42')]){_0x2ebc7c[_0x2992('0x43')]=[{'all':!![]}];}_0x2ebc7c=_[_0x2992('0x41')]({},_0x2ebc7c,_0x1d6783[_0x2992('0x4a')]);return db[_0x2992('0x2d')][_0x2992('0x4b')](_0x2ebc7c)['then'](handleEntityNotFound(_0x51de98,null))[_0x2992('0x27')](respondWithResult(_0x51de98,null))[_0x2992('0x46')](handleError(_0x51de98,null));};exports[_0x2992('0x4c')]=function(_0x52ecfe,_0x5174d9){return db[_0x2992('0x2d')][_0x2992('0x4c')](_0x52ecfe[_0x2992('0x4d')],{})[_0x2992('0x27')](respondWithResult(_0x5174d9,0xc9))[_0x2992('0x46')](handleError(_0x5174d9,null));};exports[_0x2992('0x26')]=function(_0x32512d,_0x1fdee4){if(_0x32512d[_0x2992('0x4d')]['id']){delete _0x32512d['body']['id'];}return db[_0x2992('0x2d')][_0x2992('0x4b')]({'where':{'id':_0x32512d[_0x2992('0x48')]['id']}})[_0x2992('0x27')](handleEntityNotFound(_0x1fdee4,null))[_0x2992('0x27')](saveUpdates(_0x32512d[_0x2992('0x4d')],null))[_0x2992('0x27')](respondWithResult(_0x1fdee4,null))[_0x2992('0x46')](handleError(_0x1fdee4,null));};exports[_0x2992('0x4e')]=function(_0xd78dca,_0x1ea7d1){return db['VoiceDialReport'][_0x2992('0x4b')]({'where':{'id':_0xd78dca[_0x2992('0x48')]['id']}})[_0x2992('0x27')](handleEntityNotFound(_0x1ea7d1,null))[_0x2992('0x27')](removeEntity(_0x1ea7d1,null))['catch'](handleError(_0x1ea7d1,null));};exports['describe']=function(_0x36e1b2,_0x1b846b){return db[_0x2992('0x2d')]['describe']()[_0x2992('0x27')](respondWithResult(_0x1b846b,null))[_0x2992('0x46')](handleError(_0x1b846b,null));}; \ No newline at end of file +var _0x6648=['length','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','index','VoiceDialReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','filters','where','merge','map','VIRTUAL','filter','includeAll','rows','catch','show','params','rawAttributes'];(function(_0x4ea972,_0xde1d16){var _0x34db41=function(_0x3487ef){while(--_0x3487ef){_0x4ea972['push'](_0x4ea972['shift']());}};_0x34db41(++_0xde1d16);}(_0x6648,0x1c2));var _0x8664=function(_0x546d37,_0x57fa5a){_0x546d37=_0x546d37-0x0;var _0x1f9fac=_0x6648[_0x546d37];return _0x1f9fac;};'use strict';var emlformat=require(_0x8664('0x0'));var rimraf=require(_0x8664('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8664('0x2'));var rp=require(_0x8664('0x3'));var moment=require(_0x8664('0x4'));var BPromise=require(_0x8664('0x5'));var Mustache=require(_0x8664('0x6'));var util=require(_0x8664('0x7'));var path=require(_0x8664('0x8'));var sox=require(_0x8664('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8664('0xa'));var _=require(_0x8664('0xb'));var squel=require(_0x8664('0xc'));var crypto=require('crypto');var jsforce=require(_0x8664('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8664('0xe'));var querystring=require(_0x8664('0xf'));var Papa=require(_0x8664('0x10'));var Redis=require(_0x8664('0x11'));var authService=require(_0x8664('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8664('0x13'));var hardwareService=require(_0x8664('0x14'));var logger=require(_0x8664('0x15'))(_0x8664('0x16'));var utils=require(_0x8664('0x17'));var config=require(_0x8664('0x18'));var licenseUtil=require(_0x8664('0x19'));var db=require(_0x8664('0x1a'))['db'];function respondWithStatusCode(_0x3b06a8,_0x2a397a){_0x2a397a=_0x2a397a||0xcc;return function(_0x12ddb4){if(_0x12ddb4){return _0x3b06a8[_0x8664('0x1b')](_0x2a397a);}return _0x3b06a8['status'](_0x2a397a)[_0x8664('0x1c')]();};}function respondWithResult(_0x22d107,_0x413122){_0x413122=_0x413122||0xc8;return function(_0x3702c8){if(_0x3702c8){return _0x22d107[_0x8664('0x1d')](_0x413122)[_0x8664('0x1e')](_0x3702c8);}};}function respondWithFilteredResult(_0x38d7ff,_0x19a8f8){return function(_0x248200){if(_0x248200){var _0xaca1fe=typeof _0x19a8f8[_0x8664('0x1f')]===_0x8664('0x20')&&typeof _0x19a8f8['limit']===_0x8664('0x20');var _0x38ed02=_0x248200[_0x8664('0x21')];var _0x180182=_0xaca1fe?0x0:_0x19a8f8['offset'];var _0x5a22af=_0xaca1fe?_0x248200[_0x8664('0x21')]:_0x19a8f8['offset']+_0x19a8f8[_0x8664('0x22')];var _0xc264ec;if(_0x5a22af>=_0x38ed02){_0x5a22af=_0x38ed02;_0xc264ec=0xc8;}else{_0xc264ec=0xce;}_0x38d7ff[_0x8664('0x1d')](_0xc264ec);return _0x38d7ff['set'](_0x8664('0x23'),_0x180182+'-'+_0x5a22af+'/'+_0x38ed02)[_0x8664('0x1e')](_0x248200);}return null;};}function patchUpdates(_0x49b1b9){return function(_0x30c521){try{jsonpatch[_0x8664('0x24')](_0x30c521,_0x49b1b9,!![]);}catch(_0x3ef87d){return BPromise['reject'](_0x3ef87d);}return _0x30c521[_0x8664('0x25')]();};}function saveUpdates(_0x43d0d5,_0x482484){return function(_0x5d8ae4){if(_0x5d8ae4){return _0x5d8ae4[_0x8664('0x26')](_0x43d0d5)['then'](function(_0x487c04){return _0x487c04;});}return null;};}function removeEntity(_0x4ff6cb,_0x45c353){return function(_0x2fb6b1){if(_0x2fb6b1){return _0x2fb6b1[_0x8664('0x27')]()[_0x8664('0x28')](function(){_0x4ff6cb['status'](0xcc)[_0x8664('0x1c')]();});}};}function handleEntityNotFound(_0x5a6050,_0x2c133e){return function(_0xd11c2e){if(!_0xd11c2e){_0x5a6050['sendStatus'](0x194);}return _0xd11c2e;};}function handleError(_0x5bbb21,_0xf18e6d){_0xf18e6d=_0xf18e6d||0x1f4;return function(_0x4b38da){logger[_0x8664('0x29')](_0x4b38da[_0x8664('0x2a')]);if(_0x4b38da[_0x8664('0x2b')]){delete _0x4b38da['name'];}_0x5bbb21[_0x8664('0x1d')](_0xf18e6d)['send'](_0x4b38da);};}exports[_0x8664('0x2c')]=function(_0x4b5187,_0x10d9fa){var _0x4722e4={},_0x418f37={},_0x2657c5={'count':0x0,'rows':[]};var _0x53fced=_['map'](db[_0x8664('0x2d')]['rawAttributes'],function(_0x1183d8){return{'name':_0x1183d8[_0x8664('0x2e')],'type':_0x1183d8[_0x8664('0x2f')][_0x8664('0x30')]};});_0x418f37[_0x8664('0x31')]=_['map'](_0x53fced,_0x8664('0x2b'));_0x418f37[_0x8664('0x32')]=_[_0x8664('0x33')](_0x4b5187[_0x8664('0x32')]);_0x418f37['filters']=_[_0x8664('0x34')](_0x418f37[_0x8664('0x31')],_0x418f37[_0x8664('0x32')]);_0x4722e4[_0x8664('0x35')]=_['intersection'](_0x418f37['model'],qs[_0x8664('0x36')](_0x4b5187['query']['fields']));_0x4722e4[_0x8664('0x35')]=_0x4722e4['attributes']['length']?_0x4722e4['attributes']:_0x418f37['model'];if(!_0x4b5187[_0x8664('0x32')]['hasOwnProperty']('nolimit')){_0x4722e4[_0x8664('0x22')]=qs['limit'](_0x4b5187[_0x8664('0x32')][_0x8664('0x22')]);_0x4722e4[_0x8664('0x1f')]=qs['offset'](_0x4b5187[_0x8664('0x32')][_0x8664('0x1f')]);}_0x4722e4[_0x8664('0x37')]=qs['sort'](_0x4b5187[_0x8664('0x32')]['sort']);_0x4722e4['where']=qs[_0x8664('0x38')](_['pick'](_0x4b5187[_0x8664('0x32')],_0x418f37[_0x8664('0x38')]),_0x53fced);if(_0x4b5187[_0x8664('0x32')]['filter']){_0x4722e4[_0x8664('0x39')]=_[_0x8664('0x3a')](_0x4722e4['where'],{'$or':_[_0x8664('0x3b')](_0x53fced,function(_0x5a03b7){if(_0x5a03b7[_0x8664('0x2f')]!==_0x8664('0x3c')){var _0x9f91f={};_0x9f91f[_0x5a03b7[_0x8664('0x2b')]]={'$like':'%'+_0x4b5187[_0x8664('0x32')][_0x8664('0x3d')]+'%'};return _0x9f91f;}})});}_0x4722e4=_[_0x8664('0x3a')]({},_0x4722e4,_0x4b5187['options']);var _0x202d7b={'where':_0x4722e4['where']};return db[_0x8664('0x2d')]['count'](_0x202d7b)[_0x8664('0x28')](function(_0x1d9967){_0x2657c5[_0x8664('0x21')]=_0x1d9967;if(_0x4b5187['query'][_0x8664('0x3e')]){_0x4722e4['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x4722e4);})[_0x8664('0x28')](function(_0x492d9b){_0x2657c5[_0x8664('0x3f')]=_0x492d9b;return _0x2657c5;})[_0x8664('0x28')](respondWithFilteredResult(_0x10d9fa,_0x4722e4))[_0x8664('0x40')](handleError(_0x10d9fa,null));};exports[_0x8664('0x41')]=function(_0x1e0ae1,_0x4e748a){var _0x32297a={'raw':!![],'where':{'id':_0x1e0ae1[_0x8664('0x42')]['id']}},_0x3a17cc={};_0x3a17cc[_0x8664('0x31')]=_[_0x8664('0x33')](db[_0x8664('0x2d')][_0x8664('0x43')]);_0x3a17cc[_0x8664('0x32')]=_[_0x8664('0x33')](_0x1e0ae1[_0x8664('0x32')]);_0x3a17cc[_0x8664('0x38')]=_[_0x8664('0x34')](_0x3a17cc[_0x8664('0x31')],_0x3a17cc['query']);_0x32297a[_0x8664('0x35')]=_[_0x8664('0x34')](_0x3a17cc[_0x8664('0x31')],qs[_0x8664('0x36')](_0x1e0ae1[_0x8664('0x32')][_0x8664('0x36')]));_0x32297a['attributes']=_0x32297a[_0x8664('0x35')][_0x8664('0x44')]?_0x32297a['attributes']:_0x3a17cc[_0x8664('0x31')];if(_0x1e0ae1[_0x8664('0x32')][_0x8664('0x3e')]){_0x32297a[_0x8664('0x45')]=[{'all':!![]}];}_0x32297a=_[_0x8664('0x3a')]({},_0x32297a,_0x1e0ae1['options']);return db[_0x8664('0x2d')][_0x8664('0x46')](_0x32297a)[_0x8664('0x28')](handleEntityNotFound(_0x4e748a,null))['then'](respondWithResult(_0x4e748a,null))[_0x8664('0x40')](handleError(_0x4e748a,null));};exports[_0x8664('0x47')]=function(_0x37df8c,_0x46eace){return db[_0x8664('0x2d')][_0x8664('0x47')](_0x37df8c[_0x8664('0x48')],{})[_0x8664('0x28')](respondWithResult(_0x46eace,0xc9))[_0x8664('0x40')](handleError(_0x46eace,null));};exports[_0x8664('0x26')]=function(_0x5a06fd,_0x16deaf){if(_0x5a06fd[_0x8664('0x48')]['id']){delete _0x5a06fd['body']['id'];}return db[_0x8664('0x2d')][_0x8664('0x46')]({'where':{'id':_0x5a06fd[_0x8664('0x42')]['id']}})[_0x8664('0x28')](handleEntityNotFound(_0x16deaf,null))[_0x8664('0x28')](saveUpdates(_0x5a06fd[_0x8664('0x48')],null))['then'](respondWithResult(_0x16deaf,null))[_0x8664('0x40')](handleError(_0x16deaf,null));};exports[_0x8664('0x27')]=function(_0x296413,_0x38871f){return db[_0x8664('0x2d')][_0x8664('0x46')]({'where':{'id':_0x296413['params']['id']}})[_0x8664('0x28')](handleEntityNotFound(_0x38871f,null))['then'](removeEntity(_0x38871f,null))['catch'](handleError(_0x38871f,null));};exports[_0x8664('0x49')]=function(_0xdb05ee,_0xa55100){return db[_0x8664('0x2d')][_0x8664('0x49')]()[_0x8664('0x28')](respondWithResult(_0xa55100,null))[_0x8664('0x40')](handleError(_0xa55100,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 787d133..6c8d368 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 _0x1d7e=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird','path'];(function(_0x77de7b,_0x1026c8){var _0x33b993=function(_0x4b9921){while(--_0x4b9921){_0x77de7b['push'](_0x77de7b['shift']());}};_0x33b993(++_0x1026c8);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x1d7e[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0xe1d7('0x0'));var logger=require(_0xe1d7('0x1'))(_0xe1d7('0x2'));var moment=require('moment');var BPromise=require(_0xe1d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1d7('0x4'));var rimraf=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var attributes=require(_0xe1d7('0x7'));module[_0xe1d7('0x8')]=function(_0x4058fe,_0x252026){return _0x4058fe[_0xe1d7('0x9')](_0xe1d7('0xa'),attributes,{'tableName':_0xe1d7('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe1d7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa43c=['../../config/environment','./voiceDialReport.attributes','define','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x27acbf,_0xe7afec){var _0xf93fc8=function(_0x1a91f7){while(--_0x1a91f7){_0x27acbf['push'](_0x27acbf['shift']());}};_0xf93fc8(++_0xe7afec);}(_0xa43c,0x157));var _0xca43=function(_0x688379,_0xf8cb05){_0x688379=_0x688379-0x0;var _0x10ec21=_0xa43c[_0x688379];return _0x10ec21;};'use strict';var _=require(_0xca43('0x0'));var util=require(_0xca43('0x1'));var logger=require(_0xca43('0x2'))(_0xca43('0x3'));var moment=require(_0xca43('0x4'));var BPromise=require(_0xca43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca43('0x6'));var rimraf=require(_0xca43('0x7'));var config=require(_0xca43('0x8'));var attributes=require(_0xca43('0x9'));module['exports']=function(_0x379e9e,_0x37a025){return _0x379e9e[_0xca43('0xa')]('VoiceDialReport',attributes,{'tableName':_0xca43('0xb'),'paranoid':![],'indexes':[{'fields':[_0xca43('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 64fc8ca..36a530e 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 _0x6dbf=['then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','VoiceDialReport','create','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','body','limit'];(function(_0x487155,_0x3c41b4){var _0x197e7c=function(_0x33b0c6){while(--_0x33b0c6){_0x487155['push'](_0x487155['shift']());}};_0x197e7c(++_0x3c41b4);}(_0x6dbf,0x109));var _0xf6db=function(_0x15b89f,_0x30b62a){_0x15b89f=_0x15b89f-0x0;var _0x443339=_0x6dbf[_0x15b89f];return _0x443339;};'use strict';var _=require('lodash');var util=require(_0xf6db('0x0'));var moment=require(_0xf6db('0x1'));var BPromise=require(_0xf6db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6db('0x3'));var db=require(_0xf6db('0x4'))['db'];var utils=require(_0xf6db('0x5'));var logger=require(_0xf6db('0x6'))(_0xf6db('0x7'));var config=require(_0xf6db('0x8'));var jayson=require(_0xf6db('0x9'));var client=jayson[_0xf6db('0xa')][_0xf6db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114826,_0x458316,_0x39150b){return new BPromise(function(_0xef8a2a,_0x2ccc80){return client[_0xf6db('0xc')](_0x114826,_0x39150b)['then'](function(_0x1bf574){logger[_0xf6db('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x458316,_0xf6db('0xe'));logger[_0xf6db('0xf')](_0xf6db('0x10'),_0x458316,_0xf6db('0xe'),JSON[_0xf6db('0x11')](_0x1bf574));if(_0x1bf574['error']){if(_0x1bf574[_0xf6db('0x12')][_0xf6db('0x13')]===0x1f4){logger['error'](_0xf6db('0x14'),_0x458316,_0x1bf574[_0xf6db('0x12')][_0xf6db('0x15')]);return _0x2ccc80(_0x1bf574['error'][_0xf6db('0x15')]);}logger[_0xf6db('0x12')](_0xf6db('0x14'),_0x458316,_0x1bf574[_0xf6db('0x12')]['message']);return _0xef8a2a(_0x1bf574[_0xf6db('0x12')]['message']);}else{logger[_0xf6db('0xd')](_0xf6db('0x14'),_0x458316,_0xf6db('0xe'));_0xef8a2a(_0x1bf574['result'][_0xf6db('0x15')]);}})['catch'](function(_0x10a683){logger[_0xf6db('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x458316,_0x10a683);_0x2ccc80(_0x10a683);});});}exports['CreateVoiceDialReport']=function(_0x45fda4){var _0x258d41=this;return new Promise(function(_0x26c617,_0x519b8b){return db[_0xf6db('0x16')][_0xf6db('0x17')](_0x45fda4['body'],{'raw':_0x45fda4[_0xf6db('0x18')]?_0x45fda4[_0xf6db('0x18')][_0xf6db('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x33d3b0){logger[_0xf6db('0xd')](_0xf6db('0x1a'),_0x45fda4);logger[_0xf6db('0xf')]('CreateVoiceDialReport',_0x45fda4,JSON[_0xf6db('0x11')](_0x33d3b0));_0x26c617(_0x33d3b0);})[_0xf6db('0x1b')](function(_0x333c55){logger[_0xf6db('0x12')](_0xf6db('0x1a'),_0x333c55[_0xf6db('0x15')],_0x45fda4);_0x519b8b(_0x258d41[_0xf6db('0x12')](0x1f4,_0x333c55[_0xf6db('0x15')]));});});};exports[_0xf6db('0x1c')]=function(_0x1d0931){var _0x2f0057=this;return new Promise(function(_0x3f169b,_0x4ca31d){return db['VoiceDialReport'][_0xf6db('0x1d')](_0x1d0931[_0xf6db('0x1e')],{'raw':_0x1d0931[_0xf6db('0x18')]?_0x1d0931[_0xf6db('0x18')][_0xf6db('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0931[_0xf6db('0x18')]?_0x1d0931[_0xf6db('0x18')]['where']||null:null,'attributes':_0x1d0931[_0xf6db('0x18')]?_0x1d0931[_0xf6db('0x18')]['attributes']||null:null,'limit':_0x1d0931[_0xf6db('0x18')]?_0x1d0931[_0xf6db('0x18')][_0xf6db('0x1f')]||null:null})[_0xf6db('0x20')](function(_0x1d4cdb){logger[_0xf6db('0xd')](_0xf6db('0x1c'),_0x1d0931);logger[_0xf6db('0xf')]('UpdateVoiceDialReport',_0x1d0931,JSON['stringify'](_0x1d4cdb));_0x3f169b(_0x1d4cdb);})[_0xf6db('0x1b')](function(_0x1712e4){logger[_0xf6db('0x12')]('UpdateVoiceDialReport',_0x1712e4[_0xf6db('0x15')],_0x1d0931);_0x4ca31d(_0x2f0057[_0xf6db('0x12')](0x1f4,_0x1712e4[_0xf6db('0x15')]));});});}; \ No newline at end of file +var _0x5c85=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','create','options','raw','then','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','VoiceDialReport','update','body','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x5c85,0x14e));var _0x55c8=function(_0x565688,_0x1cd54a){_0x565688=_0x565688-0x0;var _0x4a1e72=_0x5c85[_0x565688];return _0x4a1e72;};'use strict';var _=require(_0x55c8('0x0'));var util=require('util');var moment=require(_0x55c8('0x1'));var BPromise=require(_0x55c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55c8('0x3'));var db=require(_0x55c8('0x4'))['db'];var utils=require(_0x55c8('0x5'));var logger=require(_0x55c8('0x6'))(_0x55c8('0x7'));var config=require(_0x55c8('0x8'));var jayson=require(_0x55c8('0x9'));var client=jayson['client'][_0x55c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2932ea,_0x39ef6b,_0x358ed4){return new BPromise(function(_0x11b292,_0x57c233){return client[_0x55c8('0xb')](_0x2932ea,_0x358ed4)['then'](function(_0x4f50ea){logger[_0x55c8('0xc')](_0x55c8('0xd'),_0x39ef6b,_0x55c8('0xe'));logger[_0x55c8('0xf')](_0x55c8('0x10'),_0x39ef6b,_0x55c8('0xe'),JSON['stringify'](_0x4f50ea));if(_0x4f50ea['error']){if(_0x4f50ea['error'][_0x55c8('0x11')]===0x1f4){logger['error'](_0x55c8('0xd'),_0x39ef6b,_0x4f50ea[_0x55c8('0x12')][_0x55c8('0x13')]);return _0x57c233(_0x4f50ea[_0x55c8('0x12')][_0x55c8('0x13')]);}logger[_0x55c8('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x39ef6b,_0x4f50ea['error'][_0x55c8('0x13')]);return _0x11b292(_0x4f50ea[_0x55c8('0x12')]['message']);}else{logger[_0x55c8('0xc')](_0x55c8('0xd'),_0x39ef6b,_0x55c8('0xe'));_0x11b292(_0x4f50ea[_0x55c8('0x14')]['message']);}})[_0x55c8('0x15')](function(_0x4ad268){logger[_0x55c8('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x39ef6b,_0x4ad268);_0x57c233(_0x4ad268);});});}exports['CreateVoiceDialReport']=function(_0x7674cd){var _0x40a9dc=this;return new Promise(function(_0xb34200,_0x1a393a){return db['VoiceDialReport'][_0x55c8('0x16')](_0x7674cd['body'],{'raw':_0x7674cd[_0x55c8('0x17')]?_0x7674cd[_0x55c8('0x17')][_0x55c8('0x18')]===undefined?!![]:![]:!![]})[_0x55c8('0x19')](function(_0x29ba09){logger['info']('CreateVoiceDialReport',_0x7674cd);logger['debug'](_0x55c8('0x1a'),_0x7674cd,JSON[_0x55c8('0x1b')](_0x29ba09));_0xb34200(_0x29ba09);})[_0x55c8('0x15')](function(_0x5a50c2){logger[_0x55c8('0x12')](_0x55c8('0x1a'),_0x5a50c2['message'],_0x7674cd);_0x1a393a(_0x40a9dc[_0x55c8('0x12')](0x1f4,_0x5a50c2['message']));});});};exports[_0x55c8('0x1c')]=function(_0x555181){var _0xfdfb89=this;return new Promise(function(_0x7b5741,_0x3fb5f7){return db[_0x55c8('0x1d')][_0x55c8('0x1e')](_0x555181[_0x55c8('0x1f')],{'raw':_0x555181['options']?_0x555181[_0x55c8('0x17')][_0x55c8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555181[_0x55c8('0x17')]?_0x555181[_0x55c8('0x17')]['where']||null:null,'attributes':_0x555181[_0x55c8('0x17')]?_0x555181[_0x55c8('0x17')][_0x55c8('0x20')]||null:null,'limit':_0x555181[_0x55c8('0x17')]?_0x555181[_0x55c8('0x17')][_0x55c8('0x21')]||null:null})[_0x55c8('0x19')](function(_0x8e7f31){logger[_0x55c8('0xc')](_0x55c8('0x1c'),_0x555181);logger['debug'](_0x55c8('0x1c'),_0x555181,JSON[_0x55c8('0x1b')](_0x8e7f31));_0x7b5741(_0x8e7f31);})['catch'](function(_0xd94ea6){logger['error'](_0x55c8('0x1c'),_0xd94ea6[_0x55c8('0x13')],_0x555181);_0x3fb5f7(_0xfdfb89[_0x55c8('0x12')](0x1f4,_0xd94ea6[_0x55c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ddb9da2..57d560f 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 _0xe767=['Router','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','post','/:id/applications','put','update','delete','destroy','multer','util','path'];(function(_0x2c44d2,_0x13cb52){var _0x195143=function(_0x34b67d){while(--_0x34b67d){_0x2c44d2['push'](_0x2c44d2['shift']());}};_0x195143(++_0x13cb52);}(_0xe767,0x184));var _0x7e76=function(_0x2f004f,_0x2b356d){_0x2f004f=_0x2f004f-0x0;var _0x3dcd59=_0xe767[_0x2f004f];return _0x3dcd59;};'use strict';var multer=require(_0x7e76('0x0'));var util=require(_0x7e76('0x1'));var path=require(_0x7e76('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e76('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7e76('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7e76('0x5'));router[_0x7e76('0x6')]('/',auth[_0x7e76('0x7')](),controller['index']);router['get'](_0x7e76('0x8'),auth[_0x7e76('0x7')](),controller[_0x7e76('0x9')]);router['post']('/',auth[_0x7e76('0x7')](),controller[_0x7e76('0xa')]);router[_0x7e76('0xb')](_0x7e76('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0x7e76('0xd')](_0x7e76('0x8'),auth[_0x7e76('0x7')](),controller[_0x7e76('0xe')]);router[_0x7e76('0xf')](_0x7e76('0x8'),auth[_0x7e76('0x7')](),controller[_0x7e76('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0416=['./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12e041,_0x16027f){var _0x5e0569=function(_0xb708c){while(--_0xb708c){_0x12e041['push'](_0x12e041['shift']());}};_0x5e0569(++_0x16027f);}(_0x0416,0x19b));var _0x6041=function(_0x5bb6eb,_0x36a2f8){_0x5bb6eb=_0x5bb6eb-0x0;var _0xa73f41=_0x0416[_0x5bb6eb];return _0xa73f41;};'use strict';var multer=require(_0x6041('0x0'));var util=require('util');var path=require(_0x6041('0x1'));var timeout=require(_0x6041('0x2'));var express=require(_0x6041('0x3'));var router=express[_0x6041('0x4')]();var fs_extra=require(_0x6041('0x5'));var auth=require(_0x6041('0x6'));var interaction=require(_0x6041('0x7'));var config=require(_0x6041('0x8'));var controller=require(_0x6041('0x9'));router[_0x6041('0xa')]('/',auth[_0x6041('0xb')](),controller[_0x6041('0xc')]);router[_0x6041('0xa')](_0x6041('0xd'),auth[_0x6041('0xb')](),controller['show']);router[_0x6041('0xe')]('/',auth[_0x6041('0xb')](),controller[_0x6041('0xf')]);router['post'](_0x6041('0x10'),auth[_0x6041('0xb')](),controller['addApplications']);router[_0x6041('0x11')](_0x6041('0xd'),auth[_0x6041('0xb')](),controller['update']);router[_0x6041('0x12')](_0x6041('0xd'),auth[_0x6041('0xb')](),controller['destroy']);module[_0x6041('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a72f81a..1b2209f 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 _0x70f7=['INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*'];(function(_0x5e8b10,_0x5afe9e){var _0x4d2a10=function(_0x1629fb){while(--_0x1629fb){_0x5e8b10['push'](_0x5e8b10['shift']());}};_0x4d2a10(++_0x5afe9e);}(_0x70f7,0xcb));var _0x770f=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x70f7[_0x299784];return _0x5ab008;};'use strict';var Sequelize=require(_0x770f('0x0'));module[_0x770f('0x1')]={'context':{'type':Sequelize[_0x770f('0x2')],'allowNull':![],'unique':_0x770f('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x770f('0x3')},'priority':{'type':Sequelize[_0x770f('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x770f('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x770f('0x2')],'allowNull':![],'defaultValue':_0x770f('0x4')},'appdata':{'type':Sequelize[_0x770f('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x770f('0x5'),_0x770f('0x6'),_0x770f('0x7'),_0x770f('0x8'),_0x770f('0x9'),_0x770f('0xa'),_0x770f('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x770f('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x770f('0xc')},'IntervalId':{'type':Sequelize[_0x770f('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x770f('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x770f('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x770f('0xd')]},'recordingFormat':{'type':Sequelize[_0x770f('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x770f('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x770f('0xf')],'get':function(_0x398dd1){return this[_0x770f('0x10')](_0x770f('0x11'));}},'alias':{'type':Sequelize[_0x770f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc620=['compositeIndex','ENUM','outbound','inbound-fax','outbound-fax','system','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xc620,0x165));var _0x0c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc620[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c62('0x0'));module[_0x0c62('0x1')]={'context':{'type':Sequelize[_0x0c62('0x2')],'allowNull':![],'unique':_0x0c62('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0c62('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x0c62('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0c62('0x4')]('inbound',_0x0c62('0x5'),'internal',_0x0c62('0x6'),_0x0c62('0x7'),_0x0c62('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0c62('0x2')]},'interval':{'type':Sequelize[_0x0c62('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x0c62('0x9')]},'isApp':{'type':Sequelize[_0x0c62('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0c62('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0c62('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x0c62('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x0c62('0x2')],'defaultValue':_0x0c62('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0c62('0xc')],'get':function(_0x89d819){return this[_0x0c62('0xd')](_0x0c62('0xe'));}},'alias':{'type':Sequelize[_0x0c62('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 61fc1f2..ac607a0 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 _0xa13d=['concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','catch','update','context','description','recordingFormat','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','find','type','name','destroy','error','send','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','options','includeAll','rows','show','params','include','create','body','startsWith','exten'];(function(_0x234644,_0xdb62e6){var _0x1168d8=function(_0x4eb1cd){while(--_0x4eb1cd){_0x234644['push'](_0x234644['shift']());}};_0x1168d8(++_0xdb62e6);}(_0xa13d,0x71));var _0xda13=function(_0x345605,_0x19db4d){_0x345605=_0x345605-0x0;var _0x52fbb3=_0xa13d[_0x345605];return _0x52fbb3;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xda13('0x0'));var logger=require(_0xda13('0x1'))(_0xda13('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xda13('0x3')]=_[_0xda13('0x4')](config[_0xda13('0x3')],{'host':_0xda13('0x5'),'port':0x18eb});var socket=require(_0xda13('0x6'))(new Redis(config[_0xda13('0x3')]));require(_0xda13('0x7'))[_0xda13('0x8')](socket);function respondWithStatusCode(_0x832ddc,_0x5ea74b){_0x5ea74b=_0x5ea74b||0xcc;return function(_0x38ffe7){if(_0x38ffe7){return _0x832ddc[_0xda13('0x9')](_0x5ea74b);}return _0x832ddc[_0xda13('0xa')](_0x5ea74b)[_0xda13('0xb')]();};}function respondWithResult(_0x354f41,_0x2d43a7){_0x2d43a7=_0x2d43a7||0xc8;return function(_0x6e2a23){if(_0x6e2a23){return _0x354f41[_0xda13('0xa')](_0x2d43a7)['json'](_0x6e2a23);}};}function respondWithFilteredResult(_0x5aa055,_0x1773ba){return function(_0x772775){if(_0x772775){var _0x47ca7a=typeof _0x1773ba[_0xda13('0xc')]==='undefined'&&typeof _0x1773ba[_0xda13('0xd')]===_0xda13('0xe');var _0x1258e1=_0x772775[_0xda13('0xf')];var _0x21ee4d=_0x47ca7a?0x0:_0x1773ba[_0xda13('0xc')];var _0x4faafe=_0x47ca7a?_0x772775[_0xda13('0xf')]:_0x1773ba[_0xda13('0xc')]+_0x1773ba[_0xda13('0xd')];var _0x5af30a;if(_0x4faafe>=_0x1258e1){_0x4faafe=_0x1258e1;_0x5af30a=0xc8;}else{_0x5af30a=0xce;}_0x5aa055[_0xda13('0xa')](_0x5af30a);return _0x5aa055['set'](_0xda13('0x10'),_0x21ee4d+'-'+_0x4faafe+'/'+_0x1258e1)['json'](_0x772775);}return null;};}function removeEntity(_0x35d14a){return function(_0x1b207d){if(_0x1b207d){return _0x1b207d['destroy']()[_0xda13('0x11')](function(){var _0x3663e0=_0x1b207d[_0xda13('0x12')]({'plain':!![]});var _0x178f59=[{'name':_0xda13('0x13'),'value':_0xda13('0x14'),'ignore':![]},{'name':_0xda13('0x15'),'value':_0xda13('0x16'),'ignore':![]},{'name':_0xda13('0x17'),'value':_0xda13('0x18'),'ignore':![]}];var _0x127a71=_(_0x178f59)[_0xda13('0x19')](_0xda13('0x1a'))['map']('value')[_0xda13('0x1b')]();if(_[_0xda13('0x1c')](_0x127a71,_0x3663e0['type'])){return;}var _0x434c44=_[_0xda13('0x1d')](_0x178f59,[_0xda13('0x1b'),_0x3663e0[_0xda13('0x1e')]])[_0xda13('0x1f')];return db['UserProfileResource'][_0xda13('0x20')]({'where':{'type':_0x434c44,'resourceId':_0x3663e0['id']}})[_0xda13('0x11')](function(){return _0x1b207d;});})[_0xda13('0x11')](function(){_0x35d14a[_0xda13('0xa')](0xcc)[_0xda13('0xb')]();});}};}function handleEntityNotFound(_0x5aebd6){return function(_0x29ddbd){if(!_0x29ddbd){_0x5aebd6['sendStatus'](0x194);}return _0x29ddbd;};}function handleError(_0x88e167,_0x14f6b2){_0x14f6b2=_0x14f6b2||0x1f4;return function(_0xfb6f49){logger[_0xda13('0x21')](_0xfb6f49['stack']);if(_0xfb6f49[_0xda13('0x1f')]){delete _0xfb6f49['name'];}_0x88e167[_0xda13('0xa')](_0x14f6b2)[_0xda13('0x22')](_0xfb6f49);};}exports[_0xda13('0x23')]=function(_0x4be90e,_0x538a43){var _0x3ca783={},_0x22a4bb={},_0x3e3b21={'count':0x0,'rows':[]};var _0xb1e74d=_[_0xda13('0x24')](db[_0xda13('0x25')][_0xda13('0x26')],function(_0xb3dcb){return{'name':_0xb3dcb[_0xda13('0x27')],'type':_0xb3dcb[_0xda13('0x1e')][_0xda13('0x28')]};});_0x22a4bb['model']=_[_0xda13('0x24')](_0xb1e74d,_0xda13('0x1f'));_0x22a4bb[_0xda13('0x29')]=_[_0xda13('0x2a')](_0x4be90e[_0xda13('0x29')]);_0x22a4bb['filters']=_[_0xda13('0x2b')](_0x22a4bb[_0xda13('0x2c')],_0x22a4bb['query']);_0x3ca783['attributes']=_[_0xda13('0x2b')](_0x22a4bb[_0xda13('0x2c')],qs[_0xda13('0x2d')](_0x4be90e[_0xda13('0x29')][_0xda13('0x2d')]));_0x3ca783[_0xda13('0x2e')]=_0x3ca783[_0xda13('0x2e')][_0xda13('0x2f')]?_0x3ca783[_0xda13('0x2e')]:_0x22a4bb['model'];if(!_0x4be90e[_0xda13('0x29')][_0xda13('0x30')](_0xda13('0x31'))){_0x3ca783[_0xda13('0xd')]=qs['limit'](_0x4be90e[_0xda13('0x29')][_0xda13('0xd')]);_0x3ca783[_0xda13('0xc')]=qs[_0xda13('0xc')](_0x4be90e[_0xda13('0x29')][_0xda13('0xc')]);}_0x3ca783['order']=qs['sort'](_0x4be90e['query'][_0xda13('0x32')]);_0x3ca783['where']=qs['filters'](_[_0xda13('0x33')](_0x4be90e[_0xda13('0x29')],_0x22a4bb[_0xda13('0x34')]),_0xb1e74d);if(_0x4be90e[_0xda13('0x29')][_0xda13('0x19')]){_0x3ca783[_0xda13('0x35')]=_['merge'](_0x3ca783['where'],{'$or':_[_0xda13('0x24')](_0xb1e74d,function(_0x10bbfb){if(_0x10bbfb[_0xda13('0x1e')]!=='VIRTUAL'){var _0x46508e={};_0x46508e[_0x10bbfb[_0xda13('0x1f')]]={'$like':'%'+_0x4be90e[_0xda13('0x29')][_0xda13('0x19')]+'%'};return _0x46508e;}})});}_0x3ca783=_[_0xda13('0x36')]({},_0x3ca783,_0x4be90e[_0xda13('0x37')]);var _0x154ab7={'where':_0x3ca783[_0xda13('0x35')]};return db['VoiceExtension'][_0xda13('0xf')](_0x154ab7)[_0xda13('0x11')](function(_0x120e11){_0x3e3b21[_0xda13('0xf')]=_0x120e11;if(_0x4be90e[_0xda13('0x29')][_0xda13('0x38')]){_0x3ca783['include']=[{'all':!![]}];}return db[_0xda13('0x25')]['findAll'](_0x3ca783);})[_0xda13('0x11')](function(_0x15fac6){_0x3e3b21[_0xda13('0x39')]=_0x15fac6;return _0x3e3b21;})['then'](respondWithFilteredResult(_0x538a43,_0x3ca783))['catch'](handleError(_0x538a43,null));};exports[_0xda13('0x3a')]=function(_0x3cc947,_0x219acb){var _0x3f1e3e={'raw':![],'where':{'id':_0x3cc947[_0xda13('0x3b')]['id']}},_0x38b522={};_0x38b522['model']=_[_0xda13('0x2a')](db[_0xda13('0x25')][_0xda13('0x26')]);_0x38b522['query']=_['keys'](_0x3cc947[_0xda13('0x29')]);_0x38b522[_0xda13('0x34')]=_[_0xda13('0x2b')](_0x38b522['model'],_0x38b522['query']);_0x3f1e3e[_0xda13('0x2e')]=_[_0xda13('0x2b')](_0x38b522[_0xda13('0x2c')],qs[_0xda13('0x2d')](_0x3cc947[_0xda13('0x29')][_0xda13('0x2d')]));_0x3f1e3e[_0xda13('0x2e')]=_0x3f1e3e['attributes'][_0xda13('0x2f')]?_0x3f1e3e['attributes']:_0x38b522[_0xda13('0x2c')];if(_0x3cc947[_0xda13('0x29')][_0xda13('0x38')]){_0x3f1e3e[_0xda13('0x3c')]=[{'all':!![]}];}_0x3f1e3e=_[_0xda13('0x36')]({},_0x3f1e3e,_0x3cc947[_0xda13('0x37')]);return db[_0xda13('0x25')][_0xda13('0x1d')](_0x3f1e3e)[_0xda13('0x11')](handleEntityNotFound(_0x219acb,null))[_0xda13('0x11')](respondWithResult(_0x219acb,null))['catch'](handleError(_0x219acb,null));};exports[_0xda13('0x20')]=function(_0x22cc76,_0x5557e6){return db['VoiceExtension'][_0xda13('0x1d')]({'where':{'id':_0x22cc76[_0xda13('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5557e6,null))[_0xda13('0x11')](removeEntity(_0x5557e6,null))['catch'](handleError(_0x5557e6,null));};exports[_0xda13('0x3d')]=function(_0x4e4491,_0xd880af){if(_0x4e4491[_0xda13('0x3e')]['type']===_0xda13('0x16')&&!_[_0xda13('0x3f')](_0x4e4491[_0xda13('0x3e')][_0xda13('0x40')],'_')){_0x4e4491[_0xda13('0x3e')]['exten']='_'[_0xda13('0x41')](_0x4e4491[_0xda13('0x3e')][_0xda13('0x40')]);}return db[_0xda13('0x25')]['create'](_0x4e4491[_0xda13('0x3e')],{'raw':![]})[_0xda13('0x11')](function(_0x20ee17){var _0x4e4e43=_0x4e4491[_0xda13('0x42')]['get']({'plain':!![]});if(!_0x4e4e43)throw new Error(_0xda13('0x43'));if(_0x4e4e43['role']===_0xda13('0x42')){var _0x37347a=_0x20ee17[_0xda13('0x12')]({'plain':!![]});var _0x3d36ac=[{'name':_0xda13('0x13'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xda13('0x16')},{'name':_0xda13('0x17'),'value':_0xda13('0x18')}];var _0x5c71bf=_[_0xda13('0x1d')](_0x3d36ac,[_0xda13('0x1b'),_0x37347a[_0xda13('0x1e')]])['name'];return db['UserProfileSection'][_0xda13('0x1d')]({'where':{'name':_0x5c71bf,'userProfileId':_0x4e4e43[_0xda13('0x44')]},'raw':!![]})['then'](function(_0x2f5fd5){if(_0x2f5fd5&&_0x2f5fd5[_0xda13('0x45')]===0x0){return db[_0xda13('0x46')][_0xda13('0x3d')]({'name':_0x37347a['name'],'resourceId':_0x37347a['id'],'type':_0x2f5fd5[_0xda13('0x1f')],'sectionId':_0x2f5fd5['id']},{})[_0xda13('0x11')](function(){return _0x20ee17;});}else{return _0x20ee17;}})[_0xda13('0x47')](function(_0x30ad0a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30ad0a);throw _0x30ad0a;});}return _0x20ee17;})[_0xda13('0x11')](respondWithResult(_0xd880af,0xc9))[_0xda13('0x47')](handleError(_0xd880af,null));};exports[_0xda13('0x48')]=function(_0xef5cb0,_0x1f2e00){if(_0xef5cb0[_0xda13('0x3e')]['id']){delete _0xef5cb0[_0xda13('0x3e')]['id'];}return db[_0xda13('0x25')][_0xda13('0x1d')]({'where':{'id':_0xef5cb0['params']['id']}})[_0xda13('0x11')](handleEntityNotFound(_0x1f2e00,null))[_0xda13('0x11')](function(_0x25ade0){if(_0x25ade0){return db[_0xda13('0x25')][_0xda13('0x48')](_['pick'](_0xef5cb0[_0xda13('0x3e')],[_0xda13('0x40'),_0xda13('0x49'),_0xda13('0x4a'),_0xda13('0x4b'),'cutdigits','mandatoryDisposition',_0xda13('0x4c')]),{'where':{'context':_0x25ade0['context'],'exten':_0x25ade0[_0xda13('0x40')]},'individualHooks':!![]})[_0xda13('0x11')](function(_0x5beb8b){return _0x5beb8b;});}return null;})[_0xda13('0x11')](respondWithStatusCode(_0x1f2e00,null))[_0xda13('0x47')](handleError(_0x1f2e00,null));};exports[_0xda13('0x4d')]=function(_0x547745,_0x4cdeef){var _0x2f2451=_0x547745[_0xda13('0x3b')]['id'];var _0x52b353=_0x547745[_0xda13('0x3e')];var _0xe1e95=0xc8;var _0xd0be19=null;return db['sequelize'][_0xda13('0x4e')]({'isolationLevel':db[_0xda13('0x4f')][_0xda13('0x50')][_0xda13('0x51')]['READ_COMMITTED']},function(_0x557a7e){return db[_0xda13('0x25')][_0xda13('0x52')]({'where':{'id':_0x2f2451},'transaction':_0x557a7e})[_0xda13('0x11')](function(_0x3b90ad){if(_0x3b90ad){return db[_0xda13('0x25')][_0xda13('0x20')]({'where':{'VoiceExtensionId':_0x2f2451},'transaction':_0x557a7e})[_0xda13('0x11')](function(){var _0x50b3db=_[_0xda13('0x24')](_0x52b353,function(_0x534ada){_0x534ada['VoiceExtensionId']=_0x2f2451;_0x534ada[_0xda13('0x53')]=!![];return _0x534ada;});return _0x3b90ad['createRouting'](_0x50b3db);})[_0xda13('0x11')](function(_0x740371){return db[_0xda13('0x25')][_0xda13('0x54')](_0x740371,{'transaction':_0x557a7e});});}else{_0xe1e95=0x194;_0xd0be19=[];}});})[_0xda13('0x11')](function(){if(_0xe1e95!==0x194){return db[_0xda13('0x25')][_0xda13('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2f2451},'order':_0xda13('0x56')})['then'](function(_0x624e79){_0xd0be19=_0x624e79;});}})[_0xda13('0x47')](function(_0x4f3c20){_0xe1e95=0x1f4;logger['error'](_0x4f3c20[_0xda13('0x57')]);if(_0x4f3c20['name']){delete _0x4f3c20[_0xda13('0x1f')];}_0xd0be19=_0x4f3c20;})[_0xda13('0x58')](function(){if(_0xd0be19===null){_0x4cdeef[_0xda13('0x9')](_0xe1e95);}else{if(_0xe1e95===0x1f4){_0x4cdeef[_0xda13('0xa')](_0xe1e95)[_0xda13('0x22')](_0xd0be19);}else{_0x4cdeef[_0xda13('0xa')](_0xe1e95)['json'](_0xd0be19);}}});}; \ No newline at end of file +var _0xfcf9=['rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','outbound','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId','error','update','context','description','mandatoryDisposition','addApplications','sequelize','transaction','ISOLATION_LEVELS','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','send','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','destroy','get','inbound','OutboundRoutes','internal','filter','map','value','includes','find','type','UserProfileResource','then','stack','name','VoiceExtension'];(function(_0x1cc942,_0x5c49b2){var _0x148105=function(_0x3d6061){while(--_0x3d6061){_0x1cc942['push'](_0x1cc942['shift']());}};_0x148105(++_0x5c49b2);}(_0xfcf9,0x141));var _0x9fcf=function(_0x558cba,_0x524c4b){_0x558cba=_0x558cba-0x0;var _0xbcca64=_0xfcf9[_0x558cba];return _0xbcca64;};'use strict';var _=require('lodash');var Redis=require(_0x9fcf('0x0'));var qs=require(_0x9fcf('0x1'));var logger=require('../../config/logger')(_0x9fcf('0x2'));var config=require(_0x9fcf('0x3'));var db=require(_0x9fcf('0x4'))['db'];config['redis']=_[_0x9fcf('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9fcf('0x6'))(new Redis(config[_0x9fcf('0x7')]));require(_0x9fcf('0x8'))[_0x9fcf('0x9')](socket);function respondWithStatusCode(_0xf493ef,_0xa7af58){_0xa7af58=_0xa7af58||0xcc;return function(_0x374721){if(_0x374721){return _0xf493ef[_0x9fcf('0xa')](_0xa7af58);}return _0xf493ef['status'](_0xa7af58)[_0x9fcf('0xb')]();};}function respondWithResult(_0x43991a,_0x22c6dc){_0x22c6dc=_0x22c6dc||0xc8;return function(_0x32cfe6){if(_0x32cfe6){return _0x43991a[_0x9fcf('0xc')](_0x22c6dc)[_0x9fcf('0xd')](_0x32cfe6);}};}function respondWithFilteredResult(_0x4c7315,_0x4b0ff7){return function(_0x12fd32){if(_0x12fd32){var _0x242c9a=typeof _0x4b0ff7[_0x9fcf('0xe')]===_0x9fcf('0xf')&&typeof _0x4b0ff7[_0x9fcf('0x10')]===_0x9fcf('0xf');var _0x3b4fc2=_0x12fd32[_0x9fcf('0x11')];var _0x34005d=_0x242c9a?0x0:_0x4b0ff7[_0x9fcf('0xe')];var _0x296cc4=_0x242c9a?_0x12fd32['count']:_0x4b0ff7[_0x9fcf('0xe')]+_0x4b0ff7[_0x9fcf('0x10')];var _0x179081;if(_0x296cc4>=_0x3b4fc2){_0x296cc4=_0x3b4fc2;_0x179081=0xc8;}else{_0x179081=0xce;}_0x4c7315['status'](_0x179081);return _0x4c7315[_0x9fcf('0x12')]('Content-Range',_0x34005d+'-'+_0x296cc4+'/'+_0x3b4fc2)['json'](_0x12fd32);}return null;};}function removeEntity(_0x210ade){return function(_0x398e54){if(_0x398e54){return _0x398e54[_0x9fcf('0x13')]()['then'](function(){var _0x8ba661=_0x398e54[_0x9fcf('0x14')]({'plain':!![]});var _0x4e148d=[{'name':'InboundRoutes','value':_0x9fcf('0x15'),'ignore':![]},{'name':_0x9fcf('0x16'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x9fcf('0x17'),'ignore':![]}];var _0x456a47=_(_0x4e148d)[_0x9fcf('0x18')]('ignore')[_0x9fcf('0x19')](_0x9fcf('0x1a'))['value']();if(_[_0x9fcf('0x1b')](_0x456a47,_0x8ba661['type'])){return;}var _0x5622b0=_[_0x9fcf('0x1c')](_0x4e148d,[_0x9fcf('0x1a'),_0x8ba661[_0x9fcf('0x1d')]])['name'];return db[_0x9fcf('0x1e')][_0x9fcf('0x13')]({'where':{'type':_0x5622b0,'resourceId':_0x8ba661['id']}})[_0x9fcf('0x1f')](function(){return _0x398e54;});})['then'](function(){_0x210ade[_0x9fcf('0xc')](0xcc)[_0x9fcf('0xb')]();});}};}function handleEntityNotFound(_0x512b35){return function(_0x4fe464){if(!_0x4fe464){_0x512b35[_0x9fcf('0xa')](0x194);}return _0x4fe464;};}function handleError(_0x161e5f,_0x8fd87b){_0x8fd87b=_0x8fd87b||0x1f4;return function(_0x1b997e){logger['error'](_0x1b997e[_0x9fcf('0x20')]);if(_0x1b997e[_0x9fcf('0x21')]){delete _0x1b997e[_0x9fcf('0x21')];}_0x161e5f[_0x9fcf('0xc')](_0x8fd87b)['send'](_0x1b997e);};}exports['index']=function(_0x594bd2,_0x3919f2){var _0x26ed89={},_0x9e5bdd={},_0xecb90a={'count':0x0,'rows':[]};var _0x1b5465=_[_0x9fcf('0x19')](db[_0x9fcf('0x22')][_0x9fcf('0x23')],function(_0x2c647c){return{'name':_0x2c647c[_0x9fcf('0x24')],'type':_0x2c647c[_0x9fcf('0x1d')][_0x9fcf('0x25')]};});_0x9e5bdd['model']=_[_0x9fcf('0x19')](_0x1b5465,_0x9fcf('0x21'));_0x9e5bdd['query']=_[_0x9fcf('0x26')](_0x594bd2[_0x9fcf('0x27')]);_0x9e5bdd['filters']=_[_0x9fcf('0x28')](_0x9e5bdd[_0x9fcf('0x29')],_0x9e5bdd[_0x9fcf('0x27')]);_0x26ed89[_0x9fcf('0x2a')]=_[_0x9fcf('0x28')](_0x9e5bdd[_0x9fcf('0x29')],qs[_0x9fcf('0x2b')](_0x594bd2[_0x9fcf('0x27')][_0x9fcf('0x2b')]));_0x26ed89[_0x9fcf('0x2a')]=_0x26ed89['attributes'][_0x9fcf('0x2c')]?_0x26ed89[_0x9fcf('0x2a')]:_0x9e5bdd[_0x9fcf('0x29')];if(!_0x594bd2['query']['hasOwnProperty']('nolimit')){_0x26ed89['limit']=qs['limit'](_0x594bd2[_0x9fcf('0x27')][_0x9fcf('0x10')]);_0x26ed89['offset']=qs[_0x9fcf('0xe')](_0x594bd2['query'][_0x9fcf('0xe')]);}_0x26ed89[_0x9fcf('0x2d')]=qs['sort'](_0x594bd2['query'][_0x9fcf('0x2e')]);_0x26ed89[_0x9fcf('0x2f')]=qs[_0x9fcf('0x30')](_[_0x9fcf('0x31')](_0x594bd2['query'],_0x9e5bdd['filters']),_0x1b5465);if(_0x594bd2[_0x9fcf('0x27')][_0x9fcf('0x18')]){_0x26ed89[_0x9fcf('0x2f')]=_[_0x9fcf('0x32')](_0x26ed89['where'],{'$or':_[_0x9fcf('0x19')](_0x1b5465,function(_0x6e01c){if(_0x6e01c[_0x9fcf('0x1d')]!==_0x9fcf('0x33')){var _0x31102f={};_0x31102f[_0x6e01c['name']]={'$like':'%'+_0x594bd2['query']['filter']+'%'};return _0x31102f;}})});}_0x26ed89=_[_0x9fcf('0x32')]({},_0x26ed89,_0x594bd2[_0x9fcf('0x34')]);var _0x30105d={'where':_0x26ed89[_0x9fcf('0x2f')]};return db[_0x9fcf('0x22')][_0x9fcf('0x11')](_0x30105d)[_0x9fcf('0x1f')](function(_0x55310b){_0xecb90a['count']=_0x55310b;if(_0x594bd2[_0x9fcf('0x27')][_0x9fcf('0x35')]){_0x26ed89[_0x9fcf('0x36')]=[{'all':!![]}];}return db['VoiceExtension'][_0x9fcf('0x37')](_0x26ed89);})['then'](function(_0x3846e6){_0xecb90a[_0x9fcf('0x38')]=_0x3846e6;return _0xecb90a;})['then'](respondWithFilteredResult(_0x3919f2,_0x26ed89))[_0x9fcf('0x39')](handleError(_0x3919f2,null));};exports[_0x9fcf('0x3a')]=function(_0x4398ac,_0x581c19){var _0x3ff16a={'raw':![],'where':{'id':_0x4398ac['params']['id']}},_0x4c9ad9={};_0x4c9ad9[_0x9fcf('0x29')]=_[_0x9fcf('0x26')](db[_0x9fcf('0x22')][_0x9fcf('0x23')]);_0x4c9ad9[_0x9fcf('0x27')]=_[_0x9fcf('0x26')](_0x4398ac[_0x9fcf('0x27')]);_0x4c9ad9['filters']=_['intersection'](_0x4c9ad9[_0x9fcf('0x29')],_0x4c9ad9[_0x9fcf('0x27')]);_0x3ff16a[_0x9fcf('0x2a')]=_[_0x9fcf('0x28')](_0x4c9ad9[_0x9fcf('0x29')],qs[_0x9fcf('0x2b')](_0x4398ac[_0x9fcf('0x27')][_0x9fcf('0x2b')]));_0x3ff16a['attributes']=_0x3ff16a[_0x9fcf('0x2a')]['length']?_0x3ff16a[_0x9fcf('0x2a')]:_0x4c9ad9[_0x9fcf('0x29')];if(_0x4398ac['query'][_0x9fcf('0x35')]){_0x3ff16a['include']=[{'all':!![]}];}_0x3ff16a=_[_0x9fcf('0x32')]({},_0x3ff16a,_0x4398ac[_0x9fcf('0x34')]);return db[_0x9fcf('0x22')]['find'](_0x3ff16a)[_0x9fcf('0x1f')](handleEntityNotFound(_0x581c19,null))[_0x9fcf('0x1f')](respondWithResult(_0x581c19,null))[_0x9fcf('0x39')](handleError(_0x581c19,null));};exports[_0x9fcf('0x13')]=function(_0x11112b,_0x33c77b){return db['VoiceExtension'][_0x9fcf('0x1c')]({'where':{'id':_0x11112b[_0x9fcf('0x3b')]['id']}})[_0x9fcf('0x1f')](handleEntityNotFound(_0x33c77b,null))['then'](removeEntity(_0x33c77b,null))[_0x9fcf('0x39')](handleError(_0x33c77b,null));};exports[_0x9fcf('0x3c')]=function(_0xb1d9c,_0x40e27e){if(_0xb1d9c['body'][_0x9fcf('0x1d')]===_0x9fcf('0x3d')&&!_[_0x9fcf('0x3e')](_0xb1d9c[_0x9fcf('0x3f')]['exten'],'_')){_0xb1d9c['body'][_0x9fcf('0x40')]='_'[_0x9fcf('0x41')](_0xb1d9c[_0x9fcf('0x3f')][_0x9fcf('0x40')]);}return db['VoiceExtension']['create'](_0xb1d9c[_0x9fcf('0x3f')],{'raw':![]})[_0x9fcf('0x1f')](function(_0x345a5d){var _0xde3b20=_0xb1d9c['user'][_0x9fcf('0x14')]({'plain':!![]});if(!_0xde3b20)throw new Error(_0x9fcf('0x42'));if(_0xde3b20[_0x9fcf('0x43')]===_0x9fcf('0x44')){var _0x4ad946=_0x345a5d[_0x9fcf('0x14')]({'plain':!![]});var _0x30e697=[{'name':_0x9fcf('0x45'),'value':_0x9fcf('0x15')},{'name':_0x9fcf('0x16'),'value':_0x9fcf('0x3d')},{'name':_0x9fcf('0x46'),'value':'internal'}];var _0x5b5f15=_[_0x9fcf('0x1c')](_0x30e697,[_0x9fcf('0x1a'),_0x4ad946[_0x9fcf('0x1d')]])[_0x9fcf('0x21')];return db[_0x9fcf('0x47')][_0x9fcf('0x1c')]({'where':{'name':_0x5b5f15,'userProfileId':_0xde3b20[_0x9fcf('0x48')]},'raw':!![]})[_0x9fcf('0x1f')](function(_0xacffb3){if(_0xacffb3&&_0xacffb3['autoAssociation']===0x0){return db[_0x9fcf('0x1e')]['create']({'name':_0x4ad946[_0x9fcf('0x21')],'resourceId':_0x4ad946['id'],'type':_0xacffb3[_0x9fcf('0x21')],'sectionId':_0xacffb3['id']},{})[_0x9fcf('0x1f')](function(){return _0x345a5d;});}else{return _0x345a5d;}})['catch'](function(_0x3df3ab){logger[_0x9fcf('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3df3ab);throw _0x3df3ab;});}return _0x345a5d;})[_0x9fcf('0x1f')](respondWithResult(_0x40e27e,0xc9))[_0x9fcf('0x39')](handleError(_0x40e27e,null));};exports[_0x9fcf('0x4a')]=function(_0x5e4172,_0x4c369c){if(_0x5e4172[_0x9fcf('0x3f')]['id']){delete _0x5e4172[_0x9fcf('0x3f')]['id'];}return db[_0x9fcf('0x22')][_0x9fcf('0x1c')]({'where':{'id':_0x5e4172['params']['id']}})[_0x9fcf('0x1f')](handleEntityNotFound(_0x4c369c,null))[_0x9fcf('0x1f')](function(_0x12d592){if(_0x12d592){return db[_0x9fcf('0x22')]['update'](_[_0x9fcf('0x31')](_0x5e4172[_0x9fcf('0x3f')],['exten',_0x9fcf('0x4b'),_0x9fcf('0x4c'),'recordingFormat','cutdigits',_0x9fcf('0x4d'),'alias']),{'where':{'context':_0x12d592[_0x9fcf('0x4b')],'exten':_0x12d592['exten']},'individualHooks':!![]})['then'](function(_0x407826){return _0x407826;});}return null;})[_0x9fcf('0x1f')](respondWithStatusCode(_0x4c369c,null))[_0x9fcf('0x39')](handleError(_0x4c369c,null));};exports[_0x9fcf('0x4e')]=function(_0xf7ba67,_0x5cb255){var _0x507db3=_0xf7ba67['params']['id'];var _0x164491=_0xf7ba67[_0x9fcf('0x3f')];var _0x5e92b8=0xc8;var _0x2365c9=null;return db[_0x9fcf('0x4f')][_0x9fcf('0x50')]({'isolationLevel':db[_0x9fcf('0x4f')]['Transaction'][_0x9fcf('0x51')]['READ_COMMITTED']},function(_0x2daf48){return db[_0x9fcf('0x22')]['findOne']({'where':{'id':_0x507db3},'transaction':_0x2daf48})['then'](function(_0x51d8fe){if(_0x51d8fe){return db[_0x9fcf('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x507db3},'transaction':_0x2daf48})[_0x9fcf('0x1f')](function(){var _0x310083=_['map'](_0x164491,function(_0x49c366){_0x49c366[_0x9fcf('0x52')]=_0x507db3;_0x49c366[_0x9fcf('0x53')]=!![];return _0x49c366;});return _0x51d8fe[_0x9fcf('0x54')](_0x310083);})[_0x9fcf('0x1f')](function(_0x9cfaef){return db['VoiceExtension'][_0x9fcf('0x55')](_0x9cfaef,{'transaction':_0x2daf48});});}else{_0x5e92b8=0x194;_0x2365c9=[];}});})['then'](function(){if(_0x5e92b8!==0x194){return db[_0x9fcf('0x22')][_0x9fcf('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x507db3},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x27fc03){_0x2365c9=_0x27fc03;});}})[_0x9fcf('0x39')](function(_0x498db8){_0x5e92b8=0x1f4;logger[_0x9fcf('0x49')](_0x498db8[_0x9fcf('0x20')]);if(_0x498db8[_0x9fcf('0x21')]){delete _0x498db8[_0x9fcf('0x21')];}_0x2365c9=_0x498db8;})[_0x9fcf('0x57')](function(){if(_0x2365c9===null){_0x5cb255[_0x9fcf('0xa')](_0x5e92b8);}else{if(_0x5e92b8===0x1f4){_0x5cb255[_0x9fcf('0xc')](_0x5e92b8)[_0x9fcf('0x58')](_0x2365c9);}else{_0x5cb255[_0x9fcf('0xc')](_0x5e92b8)['json'](_0x2365c9);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 73a29cc..23bcbcd 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 _0x0766=['emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','save','remove'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x0766,0xc0));var _0x6076=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0766[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6076('0x0'))['db'][_0x6076('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6076('0x2'),'afterUpdate':'update','afterDestroy':_0x6076('0x3')};function emitEvent(_0x373719){return function(_0x58add2,_0x2330b2,_0x1a344c){VoiceExtensionEvents[_0x6076('0x4')](_0x373719+':'+_0x58add2['id'],_0x58add2);VoiceExtensionEvents[_0x6076('0x4')](_0x373719,_0x58add2);_0x1a344c(null);};}for(var e in events){if(events[_0x6076('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x6076('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5c5e=['exports','save','update','remove','emit'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0x5c5e,0x1eb));var _0xe5c5=function(_0x43cb08,_0x44fc78){_0x43cb08=_0x43cb08-0x0;var _0x2f9297=_0x5c5e[_0x43cb08];return _0x2f9297;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe5c5('0x0'),'afterUpdate':_0xe5c5('0x1'),'afterDestroy':_0xe5c5('0x2')};function emitEvent(_0x1c2233){return function(_0x30296f,_0x53a620,_0xe6b804){VoiceExtensionEvents[_0xe5c5('0x3')](_0x1c2233+':'+_0x30296f['id'],_0x30296f);VoiceExtensionEvents[_0xe5c5('0x3')](_0x1c2233,_0x30296f);_0xe6b804(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe5c5('0x4')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 78b7448..aeb7bfb 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 _0xfd40=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','then','length','*,*,*,*','intervals','interval','IntervalId','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat'];(function(_0x261d18,_0x13490f){var _0x3e7208=function(_0xd1a22b){while(--_0xd1a22b){_0x261d18['push'](_0x261d18['shift']());}};_0x3e7208(++_0x13490f);}(_0xfd40,0x182));var _0x0fd4=function(_0x12bb08,_0x3032f3){_0x12bb08=_0x12bb08-0x0;var _0x2e2ef8=_0xfd40[_0x12bb08];return _0x2e2ef8;};'use strict';var _=require('lodash');var attributes=require(_0x0fd4('0x0'));module[_0x0fd4('0x1')]=function(_0x2e0ef4){var _0x18c5e0=_0x2e0ef4[_0x0fd4('0x2')];function _0x325260(_0x5a7b70){var _0x291b5a=0x2;var _0x3400dd=[{'type':_0x5a7b70[_0x0fd4('0x3')],'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x5')+_0x5a7b70[_0x0fd4('0x3')],'context':_0x5a7b70[_0x0fd4('0x6')],'exten':_0x5a7b70['exten'],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']},{'type':_0x5a7b70[_0x0fd4('0x3')],'app':_0x5a7b70['alias']?_0x0fd4('0x4'):_0x0fd4('0x7'),'appdata':_0x5a7b70[_0x0fd4('0x8')]?_0x0fd4('0x9')+_0x5a7b70[_0x0fd4('0x8')]:_0x0fd4('0xa'),'context':_0x5a7b70[_0x0fd4('0x6')],'exten':_0x5a7b70[_0x0fd4('0xb')],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']}];if(_0x5a7b70[_0x0fd4('0x3')]===_0x0fd4('0xc')){_0x3400dd[_0x0fd4('0xd')]({'type':_0x0fd4('0xc'),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0xe')+_0x5a7b70['id'],'context':_0x5a7b70['context'],'exten':_0x5a7b70[_0x0fd4('0xb')],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']});}_0x3400dd[_0x0fd4('0xd')]({'type':_0x5a7b70['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5a7b70['context'],'exten':_0x5a7b70[_0x0fd4('0xb')],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']},{'type':_0x5a7b70['type'],'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0xf'),'context':_0x5a7b70[_0x0fd4('0x6')],'exten':_0x5a7b70[_0x0fd4('0xb')],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']},{'type':_0x5a7b70['type'],'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x10'),'context':_0x5a7b70[_0x0fd4('0x6')],'exten':_0x5a7b70[_0x0fd4('0xb')],'priority':_0x291b5a++,'VoiceExtensionId':_0x5a7b70['id']});return _0x3400dd;}function _0x49200c(_0x49dc73){var _0x3584b6=0x2;var _0x42089f=[{'type':_0x0fd4('0x11'),'app':'Set','appdata':_0x0fd4('0x12'),'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73['exten'],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x49dc73[_0x0fd4('0x8')]?_0x0fd4('0x4'):_0x0fd4('0x7'),'appdata':_0x49dc73[_0x0fd4('0x8')]?_0x0fd4('0x9')+_0x49dc73[_0x0fd4('0x8')]:'No\x20alias\x20set','context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':'outbound','app':'Set','appdata':_0x0fd4('0x13')+(_0x49dc73[_0x0fd4('0x14')]?_0x0fd4('0x15')+_0x49dc73['cutdigits']+'}':_0x0fd4('0x16')),'context':_0x49dc73['context'],'exten':_0x49dc73['exten'],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':'Set','appdata':_0x0fd4('0xe')+_0x49dc73['id'],'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x0fd4('0x17'),'appdata':_0x0fd4('0x18')+(_0x3584b6+0x2)+'):Goto('+(_0x3584b6+0x1)+')','context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x0fd4('0x4'),'appdata':_0x49dc73[_0x0fd4('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x49dc73[_0x0fd4('0x14')]+'}':_0x0fd4('0x19'),'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x0fd4('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73['exten'],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':'outbound','app':_0x0fd4('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x10'),'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x1a')+_0x49dc73['id'],'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']}];if(_0x49dc73[_0x0fd4('0x1b')](_0x0fd4('0x1c'))&&_0x49dc73['recordingFormat']!==_0x0fd4('0x1d')){_0x42089f['push']({'type':_0x0fd4('0x11'),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x1e'),'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73[_0x0fd4('0xb')],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']},{'type':_0x0fd4('0x11'),'app':'Set','appdata':_0x0fd4('0x1f')+_0x49dc73[_0x0fd4('0x1c')]||_0x0fd4('0x20'),'context':_0x49dc73[_0x0fd4('0x6')],'exten':_0x49dc73['exten'],'priority':_0x3584b6++,'VoiceExtensionId':_0x49dc73['id']});}return _0x42089f;}function _0x43ac08(_0x40658c,_0x42699e){var _0x4fa404=[{'name':_0x0fd4('0x21'),'param':0x0},{'name':_0x0fd4('0x22'),'param':0x1},{'name':_0x0fd4('0x23'),'param':0x2},{'name':_0x0fd4('0x24'),'param':0x3}];var _0x1d873d={};var _0x234c22=_0x42699e[_0x0fd4('0x25')](',');var _0x295971=[];for(var _0x2ef7ac=0x0;_0x2ef7ac<_0x4fa404['length'];_0x2ef7ac++){switch(_0x4fa404[_0x2ef7ac][_0x0fd4('0x26')]){case _0x0fd4('0x21'):_0x1d873d[_0x0fd4('0x21')]=_0x234c22[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]][_0x0fd4('0x25')]('/')[0x1];_0x1d873d[_0x0fd4('0x28')]=_0x234c22[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]]['split']('/')[0x2];_0x1d873d[_0x0fd4('0x29')]=_0x1d873d[_0x0fd4('0x28')]?_0x1d873d[_0x0fd4('0x28')][_0x0fd4('0x25')]('$')[0x0]:undefined;_0x1d873d[_0x0fd4('0x28')]=_0x40658c[_0x0fd4('0x14')]?(_0x1d873d['prefix']||'')+'${EXTEN:'+_0x40658c['cutdigits']+'}':(_0x1d873d['prefix']||'')+_0x0fd4('0x16');_0x295971[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]]=[_0x0fd4('0x2a'),_0x1d873d[_0x0fd4('0x21')],_0x1d873d['phone']][_0x0fd4('0x2b')]('/');break;case'options':_0x1d873d[_0x0fd4('0x23')]=_0x234c22[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]];if(_0x40658c[_0x0fd4('0x1c')]!==_0x0fd4('0x1d')){if(_0x1d873d[_0x0fd4('0x23')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x1d873d[_0x0fd4('0x23')]+=_0x0fd4('0x2c');}}else{_0x1d873d[_0x0fd4('0x23')]=_0x1d873d[_0x0fd4('0x23')]['replace'](_0x0fd4('0x2c'),'');}_0x295971[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]]=_0x1d873d[_0x0fd4('0x23')];break;default:_0x295971[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]]=_0x234c22[_0x4fa404[_0x2ef7ac][_0x0fd4('0x27')]];}}return _0x295971[_0x0fd4('0x2b')](',');}function _0x5ca5e8(_0x162ee5,_0x482c57,_0x2dd51d){return new Promise(function(_0x25e8cb,_0x26e4aa){var _0x1a2769=[];if(_[_0x0fd4('0x2d')](_0x482c57))return _0x25e8cb(_0x1a2769);_0x18c5e0[_0x0fd4('0x2e')][_0x0fd4('0x2f')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x0fd4('0x30')](function(_0x19f336){for(var _0x101fd4=0x0,_0x38d2b1=0x0;_0x101fd4<_0x482c57[_0x0fd4('0x31')];_0x101fd4++,_0x38d2b1=0x0){var _0x37254d=_0x482c57[_0x101fd4];var _0x28b9c0=[];var _0x4f965b=[];delete _0x37254d['id'];if(_0x37254d['interval']!==_0x0fd4('0x32')){_0x37254d[_0x0fd4('0x33')]=[_0x37254d[_0x0fd4('0x34')]];}else{_0x37254d[_0x0fd4('0x33')]=_0x37254d[_0x0fd4('0x35')]?_['map'](_[_0x0fd4('0x36')](_0x19f336,{'IntervalId':_0x37254d[_0x0fd4('0x35')]}),_0x0fd4('0x34')):[];}_0x37254d[_0x0fd4('0x6')]=_0x162ee5[_0x0fd4('0x6')];_0x37254d['exten']=_0x162ee5[_0x0fd4('0xb')];if(_0x37254d[_0x0fd4('0x3')])_0x37254d[_0x0fd4('0x3')]=_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')]();if(_0x162ee5['type']===_0x0fd4('0x11')){if(_0x37254d['hasOwnProperty'](_0x0fd4('0x38'))&&_0x37254d[_0x0fd4('0x38')]&&_0x37254d[_0x0fd4('0x38')]!=='--'){_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')](),'app':_0x0fd4('0x4'),'appdata':'CDR(tag)='+_0x37254d['tag'],'context':_0x162ee5['context'],'exten':_0x162ee5['exten'],'priority':_0x37254d['intervals'][_0x0fd4('0x31')]+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});}_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d['type']['toLowerCase'](),'app':_0x0fd4('0x17'),'appdata':_0x0fd4('0x39')+(_0x37254d['callerID']?_0x0fd4('0x3a')+_0x37254d[_0x0fd4('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d[_0x0fd4('0x33')]['length']+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});}else{if(_0x37254d[_0x0fd4('0x1b')]('answer')){if([_0x0fd4('0x3c'),_0x0fd4('0x3d')][_0x0fd4('0x3e')](_0x37254d[_0x0fd4('0x3f')][_0x0fd4('0x37')]())&&_0x37254d[_0x0fd4('0x40')]!==_0x0fd4('0x41')){if(_0x37254d[_0x0fd4('0x42')]){_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')](),'app':'ExecIf','appdata':_0x0fd4('0x43'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d[_0x0fd4('0x33')][_0x0fd4('0x31')]+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d[_0x0fd4('0x3')]['toLowerCase'](),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x44'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d['intervals']['length']+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});}else{_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')](),'app':_0x0fd4('0x17'),'appdata':_0x0fd4('0x45'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d[_0x0fd4('0x33')][_0x0fd4('0x31')]+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});_0x28b9c0['push']({'type':_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')](),'app':_0x0fd4('0x4'),'appdata':_0x0fd4('0x46'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d[_0x0fd4('0x33')][_0x0fd4('0x31')]+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});}}}}for(var _0x57e126=0x0;_0x57e126<_0x37254d[_0x0fd4('0x33')]['length'];_0x57e126++){var _0x33358f=_0x2dd51d+_0x37254d[_0x0fd4('0x33')][_0x0fd4('0x31')];var _0x55185a=_0x57e126===_0x37254d[_0x0fd4('0x33')][_0x0fd4('0x31')]-0x1?_0x2dd51d+_0x28b9c0[_0x0fd4('0x31')]+_0x4f965b[_0x0fd4('0x31')]+0x2:_0x2dd51d+_0x57e126+0x1;_0x28b9c0[_0x0fd4('0x47')](_0x57e126,0x0,{'type':_0x162ee5[_0x0fd4('0x3')],'app':_0x0fd4('0x48'),'appdata':_0x37254d['intervals'][_0x57e126]+'?'+_0x162ee5[_0x0fd4('0x6')]+',${EXTEN},'+_0x33358f+':'+_0x162ee5['context']+_0x0fd4('0x49')+_0x55185a,'exten':_0x162ee5['exten'],'context':_0x162ee5[_0x0fd4('0x6')],'priority':_0x2dd51d+_0x57e126,'VoiceExtensionId':_0x162ee5['id']});}if(_0x37254d[_0x0fd4('0x40')]==='outboundDial'){_0x37254d[_0x0fd4('0x4a')]=_0x43ac08(_0x162ee5,_0x37254d['appdata']);}if(_0x37254d[_0x0fd4('0x40')]===_0x0fd4('0x4b')){_0x28b9c0[_0x0fd4('0xd')]({'type':_0x37254d[_0x0fd4('0x3')][_0x0fd4('0x37')](),'app':'Set','appdata':_0x0fd4('0x4c'),'context':_0x162ee5[_0x0fd4('0x6')],'exten':_0x162ee5[_0x0fd4('0xb')],'priority':_0x37254d['intervals'][_0x0fd4('0x31')]+_0x2dd51d+_0x38d2b1++,'VoiceExtensionId':_0x162ee5['id']});}_0x37254d[_0x0fd4('0x4d')]=_0x28b9c0[_0x0fd4('0x31')]?_[_0x0fd4('0x4e')](_0x28b9c0)[_0x0fd4('0x4d')]+0x1:_0x2dd51d;_0x1a2769=_[_0x0fd4('0x4f')](_0x1a2769,_0x28b9c0,[_0x37254d],_0x4f965b);_0x2dd51d=_['last'](_0x1a2769)['priority']+0x1;}return _0x25e8cb(_0x1a2769);})['catch'](function(_0x31be09){_0x26e4aa(_0x31be09);});});}return _0x2e0ef4['define'](_0x0fd4('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3e43da){var _0x44a988=this[_0x0fd4('0x51')]({'plain':!![]});var _0x552992=_0x44a988['type']===_0x0fd4('0x11')?_0x49200c(_0x44a988):_0x325260(_0x44a988);return _0x5ca5e8(_0x44a988,_0x3e43da,_[_0x0fd4('0x4e')](_0x552992)[_0x0fd4('0x4d')]+0x1)[_0x0fd4('0x30')](function(_0x3ef171){var _0x363fa1=_['concat'](_0x552992,_0x3ef171);_0x363fa1[_0x0fd4('0xd')]({'type':_0x44a988[_0x0fd4('0x3')],'app':_0x0fd4('0x52'),'exten':_0x44a988['exten'],'context':_0x44a988[_0x0fd4('0x6')],'priority':_[_0x0fd4('0x4e')](_0x363fa1)[_0x0fd4('0x4d')]+0x1,'VoiceExtensionId':_0x44a988['id']});return _0x363fa1;});}}});}; \ No newline at end of file +var _0x9f07=['splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','define','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','context','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','length','name','param','split','phone','prefix','${EXTEN}','indexOf','U(xcally-mixmonitor-context)','replace','join','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x362744,_0x55c430){var _0x49416d=function(_0x722b9a){while(--_0x722b9a){_0x362744['push'](_0x362744['shift']());}};_0x49416d(++_0x55c430);}(_0x9f07,0x140));var _0x79f0=function(_0x14b7ee,_0x21283d){_0x14b7ee=_0x14b7ee-0x0;var _0x34276f=_0x9f07[_0x14b7ee];return _0x34276f;};'use strict';var _=require(_0x79f0('0x0'));var attributes=require(_0x79f0('0x1'));module[_0x79f0('0x2')]=function(_0x3ab03d){var _0x1d8d48=_0x3ab03d[_0x79f0('0x3')];function _0x41c016(_0x4f118c){var _0x21bd71=0x2;var _0xe78a2f=[{'type':_0x4f118c[_0x79f0('0x4')],'app':'Set','appdata':'CDR(type)='+_0x4f118c['type'],'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c['exten'],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']},{'type':_0x4f118c['type'],'app':_0x4f118c[_0x79f0('0x6')]?_0x79f0('0x7'):_0x79f0('0x8'),'appdata':_0x4f118c[_0x79f0('0x6')]?_0x79f0('0x9')+_0x4f118c[_0x79f0('0x6')]:_0x79f0('0xa'),'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c[_0x79f0('0xb')],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']}];if(_0x4f118c[_0x79f0('0x4')]===_0x79f0('0xc')){_0xe78a2f[_0x79f0('0xd')]({'type':_0x79f0('0xc'),'app':'Set','appdata':_0x79f0('0xe')+_0x4f118c['id'],'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c[_0x79f0('0xb')],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']});}_0xe78a2f['push']({'type':_0x4f118c[_0x79f0('0x4')],'app':'Set','appdata':_0x79f0('0xf'),'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c[_0x79f0('0xb')],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']},{'type':_0x4f118c[_0x79f0('0x4')],'app':_0x79f0('0x7'),'appdata':_0x79f0('0x10'),'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c[_0x79f0('0xb')],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']},{'type':_0x4f118c[_0x79f0('0x4')],'app':_0x79f0('0x7'),'appdata':_0x79f0('0x11'),'context':_0x4f118c[_0x79f0('0x5')],'exten':_0x4f118c[_0x79f0('0xb')],'priority':_0x21bd71++,'VoiceExtensionId':_0x4f118c['id']});return _0xe78a2f;}function _0x373a52(_0x35f06d){var _0x34a1da=0x2;var _0x3c5f43=[{'type':_0x79f0('0x12'),'app':_0x79f0('0x7'),'appdata':_0x79f0('0x13'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d['exten'],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x35f06d[_0x79f0('0x6')]?_0x79f0('0x7'):_0x79f0('0x8'),'appdata':_0x35f06d[_0x79f0('0x6')]?_0x79f0('0x9')+_0x35f06d[_0x79f0('0x6')]:_0x79f0('0xa'),'context':_0x35f06d['context'],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x79f0('0x7'),'appdata':'CDR(destination)='+(_0x35f06d[_0x79f0('0x14')]?_0x79f0('0x15')+_0x35f06d[_0x79f0('0x14')]+'}':'${EXTEN}'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d['exten'],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x79f0('0x7'),'appdata':_0x79f0('0xe')+_0x35f06d['id'],'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x79f0('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x34a1da+0x2)+'):Goto('+(_0x34a1da+0x1)+')','context':_0x35f06d['context'],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x79f0('0x7'),'appdata':_0x35f06d[_0x79f0('0x14')]?_0x79f0('0x17')+_0x35f06d[_0x79f0('0x14')]+'}':_0x79f0('0x18'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':'outbound','app':_0x79f0('0x7'),'appdata':_0x79f0('0xf'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':'outbound','app':'Set','appdata':_0x79f0('0x10'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':'Set','appdata':_0x79f0('0x11'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':'Set','appdata':_0x79f0('0x19')+_0x35f06d['id'],'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d['exten'],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']}];if(_0x35f06d[_0x79f0('0x1a')](_0x79f0('0x1b'))&&_0x35f06d['recordingFormat']!==_0x79f0('0x1c')){_0x3c5f43[_0x79f0('0xd')]({'type':_0x79f0('0x12'),'app':'Set','appdata':_0x79f0('0x1d'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']},{'type':_0x79f0('0x12'),'app':_0x79f0('0x7'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x35f06d[_0x79f0('0x1b')]||_0x79f0('0x1e'),'context':_0x35f06d[_0x79f0('0x5')],'exten':_0x35f06d[_0x79f0('0xb')],'priority':_0x34a1da++,'VoiceExtensionId':_0x35f06d['id']});}return _0x3c5f43;}function _0x428292(_0x22f469,_0x31a315){var _0x38a1e4=[{'name':_0x79f0('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x79f0('0x20'),'param':0x2},{'name':_0x79f0('0x21'),'param':0x3}];var _0x26f309={};var _0x3889dd=_0x31a315['split'](',');var _0x278cad=[];for(var _0x1a6afa=0x0;_0x1a6afa<_0x38a1e4[_0x79f0('0x22')];_0x1a6afa++){switch(_0x38a1e4[_0x1a6afa][_0x79f0('0x23')]){case'trunk':_0x26f309['trunk']=_0x3889dd[_0x38a1e4[_0x1a6afa][_0x79f0('0x24')]][_0x79f0('0x25')]('/')[0x1];_0x26f309[_0x79f0('0x26')]=_0x3889dd[_0x38a1e4[_0x1a6afa]['param']]['split']('/')[0x2];_0x26f309['prefix']=_0x26f309['phone']?_0x26f309[_0x79f0('0x26')][_0x79f0('0x25')]('$')[0x0]:undefined;_0x26f309[_0x79f0('0x26')]=_0x22f469[_0x79f0('0x14')]?(_0x26f309[_0x79f0('0x27')]||'')+_0x79f0('0x15')+_0x22f469[_0x79f0('0x14')]+'}':(_0x26f309[_0x79f0('0x27')]||'')+_0x79f0('0x28');_0x278cad[_0x38a1e4[_0x1a6afa][_0x79f0('0x24')]]=['SIP',_0x26f309['trunk'],_0x26f309['phone']]['join']('/');break;case'options':_0x26f309['options']=_0x3889dd[_0x38a1e4[_0x1a6afa][_0x79f0('0x24')]];if(_0x22f469[_0x79f0('0x1b')]!==_0x79f0('0x1c')){if(_0x26f309['options'][_0x79f0('0x29')](_0x79f0('0x2a'))<0x0){_0x26f309[_0x79f0('0x20')]+=_0x79f0('0x2a');}}else{_0x26f309[_0x79f0('0x20')]=_0x26f309['options'][_0x79f0('0x2b')](_0x79f0('0x2a'),'');}_0x278cad[_0x38a1e4[_0x1a6afa]['param']]=_0x26f309['options'];break;default:_0x278cad[_0x38a1e4[_0x1a6afa]['param']]=_0x3889dd[_0x38a1e4[_0x1a6afa][_0x79f0('0x24')]];}}return _0x278cad[_0x79f0('0x2c')](',');}function _0x3f6529(_0x442bc4,_0xb777ab,_0x573905){return new Promise(function(_0x3fc074,_0x2f0aa2){var _0x5b1340=[];if(_['isEmpty'](_0xb777ab))return _0x3fc074(_0x5b1340);_0x1d8d48['Interval'][_0x79f0('0x2d')]({'attributes':['id',_0x79f0('0x2e'),'IntervalId'],'raw':!![]})[_0x79f0('0x2f')](function(_0x1a415e){for(var _0x2080d1=0x0,_0x56eca3=0x0;_0x2080d1<_0xb777ab['length'];_0x2080d1++,_0x56eca3=0x0){var _0x214a63=_0xb777ab[_0x2080d1];var _0x45e8dd=[];var _0x368bde=[];delete _0x214a63['id'];if(_0x214a63[_0x79f0('0x2e')]!==_0x79f0('0x30')){_0x214a63[_0x79f0('0x31')]=[_0x214a63['interval']];}else{_0x214a63['intervals']=_0x214a63[_0x79f0('0x32')]?_[_0x79f0('0x33')](_[_0x79f0('0x34')](_0x1a415e,{'IntervalId':_0x214a63[_0x79f0('0x32')]}),_0x79f0('0x2e')):[];}_0x214a63[_0x79f0('0x5')]=_0x442bc4[_0x79f0('0x5')];_0x214a63['exten']=_0x442bc4[_0x79f0('0xb')];if(_0x214a63[_0x79f0('0x4')])_0x214a63[_0x79f0('0x4')]=_0x214a63[_0x79f0('0x4')][_0x79f0('0x35')]();if(_0x442bc4[_0x79f0('0x4')]===_0x79f0('0x12')){if(_0x214a63['hasOwnProperty'](_0x79f0('0x36'))&&_0x214a63[_0x79f0('0x36')]&&_0x214a63[_0x79f0('0x36')]!=='--'){_0x45e8dd['push']({'type':_0x214a63[_0x79f0('0x4')][_0x79f0('0x35')](),'app':_0x79f0('0x7'),'appdata':_0x79f0('0x37')+_0x214a63[_0x79f0('0x36')],'context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4[_0x79f0('0xb')],'priority':_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});}_0x45e8dd[_0x79f0('0xd')]({'type':_0x214a63['type'][_0x79f0('0x35')](),'app':_0x79f0('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x214a63[_0x79f0('0x38')]?'Set(CALLERID(all)='+_0x214a63['callerID']+')':_0x79f0('0x39')),'context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4[_0x79f0('0xb')],'priority':_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});}else{if(_0x214a63[_0x79f0('0x1a')](_0x79f0('0x3a'))){if([_0x79f0('0x3b'),_0x79f0('0x3c')]['includes'](_0x214a63['app'][_0x79f0('0x35')]())&&_0x214a63[_0x79f0('0x3d')]!=='custom'){if(_0x214a63[_0x79f0('0x3a')]){_0x45e8dd['push']({'type':_0x214a63[_0x79f0('0x4')][_0x79f0('0x35')](),'app':_0x79f0('0x16'),'appdata':_0x79f0('0x3e'),'context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4['exten'],'priority':_0x214a63['intervals'][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});_0x45e8dd[_0x79f0('0xd')]({'type':_0x214a63[_0x79f0('0x4')][_0x79f0('0x35')](),'app':_0x79f0('0x7'),'appdata':_0x79f0('0x3f'),'context':_0x442bc4['context'],'exten':_0x442bc4[_0x79f0('0xb')],'priority':_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});}else{_0x45e8dd[_0x79f0('0xd')]({'type':_0x214a63['type'][_0x79f0('0x35')](),'app':_0x79f0('0x16'),'appdata':_0x79f0('0x40'),'context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4[_0x79f0('0xb')],'priority':_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});_0x45e8dd[_0x79f0('0xd')]({'type':_0x214a63['type']['toLowerCase'](),'app':_0x79f0('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4['exten'],'priority':_0x214a63['intervals'][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});}}}}for(var _0x1feff1=0x0;_0x1feff1<_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')];_0x1feff1++){var _0x534c2c=_0x573905+_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')];var _0x5acf6f=_0x1feff1===_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]-0x1?_0x573905+_0x45e8dd[_0x79f0('0x22')]+_0x368bde[_0x79f0('0x22')]+0x2:_0x573905+_0x1feff1+0x1;_0x45e8dd[_0x79f0('0x41')](_0x1feff1,0x0,{'type':_0x442bc4[_0x79f0('0x4')],'app':_0x79f0('0x42'),'appdata':_0x214a63[_0x79f0('0x31')][_0x1feff1]+'?'+_0x442bc4[_0x79f0('0x5')]+_0x79f0('0x43')+_0x534c2c+':'+_0x442bc4['context']+_0x79f0('0x43')+_0x5acf6f,'exten':_0x442bc4[_0x79f0('0xb')],'context':_0x442bc4[_0x79f0('0x5')],'priority':_0x573905+_0x1feff1,'VoiceExtensionId':_0x442bc4['id']});}if(_0x214a63[_0x79f0('0x3d')]==='outboundDial'){_0x214a63[_0x79f0('0x44')]=_0x428292(_0x442bc4,_0x214a63[_0x79f0('0x44')]);}if(_0x214a63[_0x79f0('0x3d')]===_0x79f0('0x45')){_0x45e8dd['push']({'type':_0x214a63[_0x79f0('0x4')][_0x79f0('0x35')](),'app':'Set','appdata':_0x79f0('0x46'),'context':_0x442bc4[_0x79f0('0x5')],'exten':_0x442bc4[_0x79f0('0xb')],'priority':_0x214a63[_0x79f0('0x31')][_0x79f0('0x22')]+_0x573905+_0x56eca3++,'VoiceExtensionId':_0x442bc4['id']});}_0x214a63[_0x79f0('0x47')]=_0x45e8dd[_0x79f0('0x22')]?_['last'](_0x45e8dd)[_0x79f0('0x47')]+0x1:_0x573905;_0x5b1340=_[_0x79f0('0x48')](_0x5b1340,_0x45e8dd,[_0x214a63],_0x368bde);_0x573905=_[_0x79f0('0x49')](_0x5b1340)[_0x79f0('0x47')]+0x1;}return _0x3fc074(_0x5b1340);})['catch'](function(_0x18ec0e){_0x2f0aa2(_0x18ec0e);});});}return _0x3ab03d[_0x79f0('0x4a')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44fd5d){var _0x4d5c6e=this[_0x79f0('0x4b')]({'plain':!![]});var _0xf0f052=_0x4d5c6e[_0x79f0('0x4')]===_0x79f0('0x12')?_0x373a52(_0x4d5c6e):_0x41c016(_0x4d5c6e);return _0x3f6529(_0x4d5c6e,_0x44fd5d,_[_0x79f0('0x49')](_0xf0f052)[_0x79f0('0x47')]+0x1)[_0x79f0('0x2f')](function(_0x1c90ec){var _0x439c1d=_[_0x79f0('0x48')](_0xf0f052,_0x1c90ec);_0x439c1d[_0x79f0('0xd')]({'type':_0x4d5c6e[_0x79f0('0x4')],'app':_0x79f0('0x4c'),'exten':_0x4d5c6e[_0x79f0('0xb')],'context':_0x4d5c6e[_0x79f0('0x5')],'priority':_[_0x79f0('0x49')](_0x439c1d)['priority']+0x1,'VoiceExtensionId':_0x4d5c6e['id']});return _0x439c1d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6b18627..7fee6e8 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 _0xbdb9=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','then','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x4d31de,_0x4e403f){var _0x515423=function(_0x57c4dc){while(--_0x57c4dc){_0x4d31de['push'](_0x4d31de['shift']());}};_0x515423(++_0x4e403f);}(_0xbdb9,0xac));var _0x9bdb=function(_0x213aa7,_0x26e5b8){_0x213aa7=_0x213aa7-0x0;var _0x2b60b7=_0xbdb9[_0x213aa7];return _0x2b60b7;};'use strict';var _=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var moment=require(_0x9bdb('0x2'));var BPromise=require(_0x9bdb('0x3'));var rs=require(_0x9bdb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9bdb('0x6'));var client=jayson['client'][_0x9bdb('0x7')]({'port':0x232a});config['redis']=_[_0x9bdb('0x8')](config[_0x9bdb('0x9')],{'host':_0x9bdb('0xa'),'port':0x18eb});var socket=require(_0x9bdb('0xb'))(new Redis(config[_0x9bdb('0x9')]));require(_0x9bdb('0xc'))[_0x9bdb('0xd')](socket);function respondWithRpcPromise(_0x58812d,_0x118bb1,_0x355bad){return new BPromise(function(_0x274dee,_0x35a5b9){return client[_0x9bdb('0xe')](_0x58812d,_0x355bad)['then'](function(_0x5af5d6){logger[_0x9bdb('0xf')](_0x9bdb('0x10'),_0x118bb1,_0x9bdb('0x11'));logger[_0x9bdb('0x12')](_0x9bdb('0x13'),_0x118bb1,_0x9bdb('0x11'),JSON['stringify'](_0x5af5d6));if(_0x5af5d6[_0x9bdb('0x14')]){if(_0x5af5d6[_0x9bdb('0x14')][_0x9bdb('0x15')]===0x1f4){logger[_0x9bdb('0x14')](_0x9bdb('0x10'),_0x118bb1,_0x5af5d6['error'][_0x9bdb('0x16')]);return _0x35a5b9(_0x5af5d6[_0x9bdb('0x14')][_0x9bdb('0x16')]);}logger['error'](_0x9bdb('0x10'),_0x118bb1,_0x5af5d6[_0x9bdb('0x14')][_0x9bdb('0x16')]);return _0x274dee(_0x5af5d6[_0x9bdb('0x14')][_0x9bdb('0x16')]);}else{logger[_0x9bdb('0xf')](_0x9bdb('0x10'),_0x118bb1,_0x9bdb('0x11'));_0x274dee(_0x5af5d6[_0x9bdb('0x17')][_0x9bdb('0x16')]);}})['catch'](function(_0x37837d){logger[_0x9bdb('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x118bb1,_0x37837d);_0x35a5b9(_0x37837d);});});}exports[_0x9bdb('0x18')]=function(_0x16a953){var _0x2fb1f3=this;return new Promise(function(_0x582a46,_0xdaab91){return db[_0x9bdb('0x19')][_0x9bdb('0x1a')]({'raw':_0x16a953['options']?_0x16a953[_0x9bdb('0x1b')][_0x9bdb('0x1c')]===undefined?!![]:![]:!![],'where':_0x16a953[_0x9bdb('0x1b')]?_0x16a953[_0x9bdb('0x1b')][_0x9bdb('0x1d')]||null:null,'attributes':_0x16a953[_0x9bdb('0x1b')]?_0x16a953['options']['attributes']||null:null,'limit':_0x16a953[_0x9bdb('0x1b')]?_0x16a953[_0x9bdb('0x1b')][_0x9bdb('0x1e')]||null:null,'include':_0x16a953['options']?_0x16a953[_0x9bdb('0x1b')][_0x9bdb('0x1f')]?_[_0x9bdb('0x20')](_0x16a953[_0x9bdb('0x1b')]['include'],function(_0x37a02a){return{'model':db[_0x37a02a['model']],'as':_0x37a02a['as'],'attributes':_0x37a02a[_0x9bdb('0x21')],'include':_0x37a02a[_0x9bdb('0x1f')]?_[_0x9bdb('0x20')](_0x37a02a['include'],function(_0x158604){return{'model':db[_0x158604[_0x9bdb('0x22')]],'as':_0x158604['as'],'attributes':_0x158604[_0x9bdb('0x21')],'include':_0x158604[_0x9bdb('0x1f')]?_[_0x9bdb('0x20')](_0x158604[_0x9bdb('0x1f')],function(_0x426390){return{'model':db[_0x426390[_0x9bdb('0x22')]],'as':_0x426390['as'],'attributes':_0x426390[_0x9bdb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9bdb('0x23')](function(_0x54ed65){logger[_0x9bdb('0xf')](_0x9bdb('0x18'),_0x16a953);logger[_0x9bdb('0x12')](_0x9bdb('0x18'),_0x16a953,JSON[_0x9bdb('0x24')](_0x54ed65));_0x582a46(_0x54ed65);})[_0x9bdb('0x25')](function(_0x106160){logger['error'](_0x9bdb('0x18'),_0x106160['message'],_0x16a953);_0xdaab91(_0x2fb1f3[_0x9bdb('0x14')](0x1f4,_0x106160[_0x9bdb('0x16')]));});});}; \ No newline at end of file +var _0xd8fb=['result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x399565,_0x32e9b8){var _0x5848d8=function(_0x29a0a5){while(--_0x29a0a5){_0x399565['push'](_0x399565['shift']());}};_0x5848d8(++_0x32e9b8);}(_0xd8fb,0x99));var _0xbd8f=function(_0x63f620,_0x1acbe9){_0x63f620=_0x63f620-0x0;var _0x4d8371=_0xd8fb[_0x63f620];return _0x4d8371;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});}exports[_0xbd8f('0x17')]=function(_0x4b5fac){var _0xd706bc=this;return new Promise(function(_0x7f46d4,_0xb47c8e){return db[_0xbd8f('0x18')][_0xbd8f('0x19')]({'raw':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1c')]||null:null,'attributes':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1d')]||null:null,'limit':_0x4b5fac[_0xbd8f('0x1a')]?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1e')]||null:null,'include':_0x4b5fac['options']?_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1f')]?_[_0xbd8f('0x20')](_0x4b5fac[_0xbd8f('0x1a')][_0xbd8f('0x1f')],function(_0x2257fd){return{'model':db[_0x2257fd[_0xbd8f('0x21')]],'as':_0x2257fd['as'],'attributes':_0x2257fd[_0xbd8f('0x1d')],'include':_0x2257fd['include']?_[_0xbd8f('0x20')](_0x2257fd[_0xbd8f('0x1f')],function(_0x5a3a8c){return{'model':db[_0x5a3a8c[_0xbd8f('0x21')]],'as':_0x5a3a8c['as'],'attributes':_0x5a3a8c['attributes'],'include':_0x5a3a8c[_0xbd8f('0x1f')]?_[_0xbd8f('0x20')](_0x5a3a8c[_0xbd8f('0x1f')],function(_0x202126){return{'model':db[_0x202126[_0xbd8f('0x21')]],'as':_0x202126['as'],'attributes':_0x202126[_0xbd8f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x166de7){logger[_0xbd8f('0xd')](_0xbd8f('0x17'),_0x4b5fac);logger[_0xbd8f('0xf')](_0xbd8f('0x17'),_0x4b5fac,JSON[_0xbd8f('0x12')](_0x166de7));_0x7f46d4(_0x166de7);})[_0xbd8f('0x22')](function(_0x479a0c){logger[_0xbd8f('0x13')](_0xbd8f('0x17'),_0x479a0c[_0xbd8f('0x15')],_0x4b5fac);_0xb47c8e(_0xd706bc[_0xbd8f('0x13')](0x1f4,_0x479a0c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2e5a76c..8905c67 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0xcb5d5d,_0x5eadc1){var _0x165b44=function(_0x5654bd){while(--_0x5654bd){_0xcb5d5d['push'](_0xcb5d5d['shift']());}};_0x165b44(++_0x5eadc1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x54c335,_0x3461a8){var _0x4be068=function(_0x133f24){while(--_0x133f24){_0x54c335['push'](_0x54c335['shift']());}};_0x4be068(++_0x3461a8);}(_0x0295,0x1f0));var _0x5029=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x0295[_0x2e3dfc];return _0x4b1245;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 47f422d..b50dc8a 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 _0x2272=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var fs_extra=require(_0x2227('0x5'));var auth=require(_0x2227('0x6'));var interaction=require(_0x2227('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x2227('0x8')]('/',auth[_0x2227('0x9')](),controller[_0x2227('0xa')]);router[_0x2227('0x8')](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0xc')]);router[_0x2227('0x8')](_0x2227('0xd'),auth[_0x2227('0x9')](),controller['getMessages']);router[_0x2227('0xe')]('/',auth['isAuthenticated'](),controller[_0x2227('0xf')]);router[_0x2227('0x10')](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0x11')]);router['delete'](_0x2227('0xb'),auth[_0x2227('0x9')](),controller[_0x2227('0x12')]);module[_0x2227('0x13')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x41f9a1,_0x497bb3){var _0x163214=function(_0x12aeaa){while(--_0x12aeaa){_0x41f9a1['push'](_0x41f9a1['shift']());}};_0x163214(++_0x497bb3);}(_0x2ef3,0xba));var _0x32ef=function(_0x10fd51,_0x5466e3){_0x10fd51=_0x10fd51-0x0;var _0x2c6328=_0x2ef3[_0x10fd51];return _0x2c6328;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 75d7ed0..86ebcfa 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 _0xd1be=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox','STRING','email','string'];(function(_0x380756,_0xbc18a0){var _0x2e002d=function(_0x135b40){while(--_0x135b40){_0x380756['push'](_0x380756['shift']());}};_0x2e002d(++_0xbc18a0);}(_0xd1be,0x77));var _0xed1b=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0xd1be[_0x21ecc8];return _0x510c1d;};'use strict';var Sequelize=require(_0xed1b('0x0'));module[_0xed1b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xed1b('0x2'),'unique':_0xed1b('0x3')},'mailbox':{'type':Sequelize[_0xed1b('0x4')],'defaultValue':'','allowNull':![],'unique':_0xed1b('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xed1b('0x4')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x28a799){this['setDataValue'](_0xed1b('0x5'),typeof _0x28a799===_0xed1b('0x6')&&_0x28a799[_0xed1b('0x7')]()?_0x28a799[_0xed1b('0x7')]():null);}},'pager':{'type':Sequelize[_0xed1b('0x4')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xed1b('0x8')},'attach':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xed1b('0xa'),'no'),'defaultValue':_0xed1b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xed1b('0x4')]},'review':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xed1b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':_0xed1b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xed1b('0x9')](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xed1b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xed1b('0xc')},'emailsubject':{'type':Sequelize[_0xed1b('0x4')]},'emailbody':{'type':Sequelize[_0xed1b('0x4')]},'maxsecs':{'type':Sequelize[_0xed1b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xed1b('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xed1b('0xe')],'get':function(){return this[_0xed1b('0xf')]('fullname')+_0xed1b('0x10')+this['getDataValue'](_0xed1b('0x11'));}}}; \ No newline at end of file +var _0xe77b=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize'];(function(_0x1cded1,_0x46b0fa){var _0xdddcee=function(_0x535932){while(--_0x535932){_0x1cded1['push'](_0x1cded1['shift']());}};_0xdddcee(++_0x46b0fa);}(_0xe77b,0xd7));var _0xbe77=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe77b[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xbe77('0x0'));module[_0xbe77('0x1')]={'customer_id':{'type':Sequelize[_0xbe77('0x2')]},'context':{'type':Sequelize[_0xbe77('0x2')],'defaultValue':'from-voicemail','unique':_0xbe77('0x3')},'mailbox':{'type':Sequelize[_0xbe77('0x2')],'defaultValue':'','allowNull':![],'unique':_0xbe77('0x3')},'password':{'type':Sequelize[_0xbe77('0x2')]},'fullname':{'type':Sequelize[_0xbe77('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x43ffe1){this[_0xbe77('0x4')](_0xbe77('0x5'),typeof _0x43ffe1===_0xbe77('0x6')&&_0x43ffe1[_0xbe77('0x7')]()?_0x43ffe1[_0xbe77('0x7')]():null);}},'pager':{'type':Sequelize[_0xbe77('0x2')]},'tz':{'type':Sequelize[_0xbe77('0x2')],'defaultValue':_0xbe77('0x8')},'attach':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':_0xbe77('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbe77('0x2')]},'callback':{'type':Sequelize[_0xbe77('0x2')]},'review':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbe77('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbe77('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbe77('0x9')](_0xbe77('0xa'),'no'),'defaultValue':_0xbe77('0xa'),'allowNull':![]},'stamp':{'type':_0xbe77('0xc')},'emailsubject':{'type':Sequelize[_0xbe77('0x2')]},'emailbody':{'type':Sequelize[_0xbe77('0x2')]},'maxsecs':{'type':Sequelize[_0xbe77('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbe77('0xe')],'get':function(){return this[_0xbe77('0xf')](_0xbe77('0x10'))+'\x20-\x20'+this['getDataValue'](_0xbe77('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ee7d65b..e85f5d1 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 _0x84a0=['UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x84a0,0x66));var _0x084a=function(_0x834994,_0x19bb3d){_0x834994=_0x834994-0x0;var _0x3af23d=_0x84a0[_0x834994];return _0x3af23d;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){var _0x5be167=_0x1f2c9f[_0x084a('0x27')]({'plain':!![]});var _0x2af138=_0x084a('0x28');return db['UserProfileResource'][_0x084a('0x25')]({'where':{'type':_0x2af138,'resourceId':_0x5be167['id']}})[_0x084a('0x26')](function(){return _0x1f2c9f;});})[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4874fe,_0x52227a){return function(_0x33b88f){if(!_0x33b88f){_0x4874fe['sendStatus'](0x194);}return _0x33b88f;};}function handleError(_0x5bea78,_0x51c9f4){_0x51c9f4=_0x51c9f4||0x1f4;return function(_0x3b8176){logger[_0x084a('0x29')](_0x3b8176[_0x084a('0x2a')]);if(_0x3b8176[_0x084a('0x2b')]){delete _0x3b8176[_0x084a('0x2b')];}_0x5bea78[_0x084a('0x19')](_0x51c9f4)[_0x084a('0x2c')](_0x3b8176);};}exports[_0x084a('0x2d')]=function(_0x5e6ea8,_0x2ed3cd){var _0x3b2b38={},_0x501a16={},_0xe1980b={'count':0x0,'rows':[]};var _0x24bcf5=_[_0x084a('0x2e')](db[_0x084a('0x2f')][_0x084a('0x30')],function(_0x202602){return{'name':_0x202602[_0x084a('0x31')],'type':_0x202602[_0x084a('0x32')][_0x084a('0x33')]};});_0x501a16[_0x084a('0x34')]=_[_0x084a('0x2e')](_0x24bcf5,_0x084a('0x2b'));_0x501a16[_0x084a('0x35')]=_['keys'](_0x5e6ea8['query']);_0x501a16[_0x084a('0x36')]=_[_0x084a('0x37')](_0x501a16[_0x084a('0x34')],_0x501a16[_0x084a('0x35')]);_0x3b2b38[_0x084a('0x38')]=_['intersection'](_0x501a16[_0x084a('0x34')],qs[_0x084a('0x39')](_0x5e6ea8[_0x084a('0x35')]['fields']));_0x3b2b38[_0x084a('0x38')]=_0x3b2b38[_0x084a('0x38')][_0x084a('0x3a')]?_0x3b2b38['attributes']:_0x501a16['model'];if(!_0x5e6ea8['query'][_0x084a('0x3b')](_0x084a('0x3c'))){_0x3b2b38[_0x084a('0x1f')]=qs['limit'](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1f')]);_0x3b2b38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1d')]);}_0x3b2b38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x3e')]);_0x3b2b38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_[_0x084a('0x40')](_0x5e6ea8[_0x084a('0x35')],_0x501a16[_0x084a('0x36')]),_0x24bcf5);if(_0x5e6ea8['query'][_0x084a('0x41')]){_0x3b2b38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x3b2b38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x24bcf5,function(_0x22862b){if(_0x22862b[_0x084a('0x32')]!==_0x084a('0x43')){var _0x13dc4c={};_0x13dc4c[_0x22862b['name']]={'$like':'%'+_0x5e6ea8[_0x084a('0x35')][_0x084a('0x41')]+'%'};return _0x13dc4c;}})});}_0x3b2b38=_[_0x084a('0x42')]({},_0x3b2b38,_0x5e6ea8[_0x084a('0x44')]);var _0x256008={'where':_0x3b2b38[_0x084a('0x3f')]};return db['VoiceMail'][_0x084a('0x1e')](_0x256008)[_0x084a('0x26')](function(_0x55c5f4){_0xe1980b[_0x084a('0x1e')]=_0x55c5f4;if(_0x5e6ea8[_0x084a('0x35')][_0x084a('0x45')]){_0x3b2b38['include']=[{'all':!![]}];}return db[_0x084a('0x2f')][_0x084a('0x46')](_0x3b2b38);})['then'](function(_0x3e2b92){_0xe1980b[_0x084a('0x47')]=_0x3e2b92;return _0xe1980b;})['then'](respondWithFilteredResult(_0x2ed3cd,_0x3b2b38))['catch'](handleError(_0x2ed3cd,null));};exports[_0x084a('0x48')]=function(_0x17a8d4,_0x3726bd){var _0xec2713={'raw':!![],'where':{'id':_0x17a8d4[_0x084a('0x49')]['id']}},_0x1e2a2d={};_0x1e2a2d[_0x084a('0x34')]=_[_0x084a('0x4a')](db[_0x084a('0x2f')][_0x084a('0x30')]);_0x1e2a2d[_0x084a('0x35')]=_['keys'](_0x17a8d4['query']);_0x1e2a2d[_0x084a('0x36')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],_0x1e2a2d['query']);_0xec2713[_0x084a('0x38')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],qs[_0x084a('0x39')](_0x17a8d4[_0x084a('0x35')]['fields']));_0xec2713[_0x084a('0x38')]=_0xec2713['attributes'][_0x084a('0x3a')]?_0xec2713[_0x084a('0x38')]:_0x1e2a2d[_0x084a('0x34')];if(_0x17a8d4['query']['includeAll']){_0xec2713[_0x084a('0x4b')]=[{'all':!![]}];}_0xec2713=_[_0x084a('0x42')]({},_0xec2713,_0x17a8d4['options']);return db[_0x084a('0x2f')][_0x084a('0x4c')](_0xec2713)[_0x084a('0x26')](handleEntityNotFound(_0x3726bd,null))[_0x084a('0x26')](respondWithResult(_0x3726bd,null))['catch'](handleError(_0x3726bd,null));};exports[_0x084a('0x4d')]=function(_0x865368,_0x31677b){return db[_0x084a('0x2f')]['create'](_0x865368[_0x084a('0x4e')],{})[_0x084a('0x26')](function(_0x411fa9){var _0x2d3d01=_0x865368['user']['get']({'plain':!![]});if(!_0x2d3d01)throw new Error(_0x084a('0x4f'));if(_0x2d3d01[_0x084a('0x50')]===_0x084a('0x51')){var _0x264f09=_0x411fa9[_0x084a('0x27')]({'plain':!![]});var _0x3b2df4=_0x084a('0x28');return db[_0x084a('0x52')][_0x084a('0x4c')]({'where':{'name':_0x3b2df4,'userProfileId':_0x2d3d01[_0x084a('0x53')]},'raw':!![]})[_0x084a('0x26')](function(_0x98769c){if(_0x98769c&&_0x98769c['autoAssociation']===0x0){return db[_0x084a('0x54')][_0x084a('0x4d')]({'name':_0x264f09[_0x084a('0x2b')],'resourceId':_0x264f09['id'],'type':_0x98769c[_0x084a('0x2b')],'sectionId':_0x98769c['id']},{})[_0x084a('0x26')](function(){return _0x411fa9;});}else{return _0x411fa9;}})[_0x084a('0x55')](function(_0xa5362){logger['error'](_0x084a('0x56'),_0xa5362);throw _0xa5362;});}return _0x411fa9;})[_0x084a('0x26')](respondWithResult(_0x31677b,0xc9))[_0x084a('0x55')](handleError(_0x31677b,null));};exports['update']=function(_0x54ca1f,_0x424cd1){if(_0x54ca1f['body']['id']){delete _0x54ca1f[_0x084a('0x4e')]['id'];}return db[_0x084a('0x2f')]['find']({'where':{'id':_0x54ca1f[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x424cd1,null))['then'](saveUpdates(_0x54ca1f[_0x084a('0x4e')],null))[_0x084a('0x26')](respondWithResult(_0x424cd1,null))[_0x084a('0x55')](handleError(_0x424cd1,null));};exports[_0x084a('0x25')]=function(_0x2a8056,_0x57d397){return db[_0x084a('0x2f')]['find']({'where':{'id':_0x2a8056[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x57d397,null))[_0x084a('0x26')](removeEntity(_0x57d397,null))['catch'](handleError(_0x57d397,null));};exports[_0x084a('0x57')]=function(_0x339088,_0x12db87,_0x9246dd){return db['VoiceMail'][_0x084a('0x58')]({'where':{'id':_0x339088['params']['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x12db87,null))[_0x084a('0x26')](function(_0x21a18a){var _0x4cc344;var _0x589e38={},_0xd37003={};_0xd37003[_0x084a('0x34')]=_['keys'](db[_0x084a('0x59')]['rawAttributes']);_0xd37003['query']=_[_0x084a('0x4a')](_0x339088[_0x084a('0x35')]);_0xd37003[_0x084a('0x36')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],_0xd37003[_0x084a('0x35')]);_0x589e38[_0x084a('0x38')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],qs['fields'](_0x339088[_0x084a('0x35')][_0x084a('0x39')]));_0x589e38[_0x084a('0x38')]=_0x589e38['attributes'][_0x084a('0x3a')]?_0x589e38[_0x084a('0x38')]:_0xd37003['model'];if(!_0x339088[_0x084a('0x35')]['hasOwnProperty']('nolimit')){_0x589e38[_0x084a('0x1f')]=qs['limit'](_0x339088['query'][_0x084a('0x1f')]);_0x589e38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x339088['query'][_0x084a('0x1d')]);}_0x589e38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x339088[_0x084a('0x35')][_0x084a('0x3e')]);_0x589e38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_['pick'](_0x339088['query'],_0xd37003[_0x084a('0x36')]));if(_0x339088[_0x084a('0x35')]['filter']){_0x589e38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x589e38['attributes'],function(_0x21dd85){var _0x3fa52e={};_0x3fa52e[_0x21dd85]={'$like':'%'+_0x339088[_0x084a('0x35')]['filter']+'%'};return _0x3fa52e;})});}_0x589e38['where']=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'mailboxuser':_0x21a18a[_0x084a('0x5a')]});_0x589e38=_[_0x084a('0x42')]({},_0x589e38,_0x339088[_0x084a('0x44')]);return db[_0x084a('0x59')][_0x084a('0x5b')](_0x589e38)['then'](respondWithFilteredResult(_0x12db87,_0x589e38));})[_0x084a('0x55')](handleError(_0x12db87,null));}; \ No newline at end of file +var _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x16acc8,_0x401f23){var _0x1d39ba=function(_0x47b7f4){while(--_0x47b7f4){_0x16acc8['push'](_0x16acc8['shift']());}};_0x1d39ba(++_0x401f23);}(_0x13f6,0x124));var _0x613f=function(_0x374b28,_0x3b5fce){_0x374b28=_0x374b28-0x0;var _0x398dcd=_0x13f6[_0x374b28];return _0x398dcd;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index df60c3e..d1c15fa 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 _0x988c=['path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19a11f,_0x6d8be7){var _0x51485f=function(_0x1394a1){while(--_0x1394a1){_0x19a11f['push'](_0x19a11f['shift']());}};_0x51485f(++_0x6d8be7);}(_0x988c,0x1d5));var _0xc988=function(_0x2b5472,_0x4ad5ed){_0x2b5472=_0x2b5472-0x0;var _0xf4b1e0=_0x988c[_0x2b5472];return _0xf4b1e0;};'use strict';var _=require(_0xc988('0x0'));var util=require(_0xc988('0x1'));var logger=require(_0xc988('0x2'))(_0xc988('0x3'));var moment=require(_0xc988('0x4'));var BPromise=require(_0xc988('0x5'));var rp=require(_0xc988('0x6'));var fs=require('fs');var path=require(_0xc988('0x7'));var rimraf=require(_0xc988('0x8'));var config=require(_0xc988('0x9'));var attributes=require(_0xc988('0xa'));module['exports']=function(_0xbf4062,_0x254d23){return _0xbf4062[_0xc988('0xb')](_0xc988('0xc'),attributes,{'tableName':_0xc988('0xd'),'paranoid':![],'indexes':[{'name':_0xc988('0xe'),'fields':[_0xc988('0xf'),_0xc988('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x892d=['voice_voicemail','mailbox_context','mailbox','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x1e6a2c,_0x3c3e90){var _0xdab7f3=function(_0x7295af){while(--_0x7295af){_0x1e6a2c['push'](_0x1e6a2c['shift']());}};_0xdab7f3(++_0x3c3e90);}(_0x892d,0xb7));var _0xd892=function(_0x173fcf,_0x477fae){_0x173fcf=_0x173fcf-0x0;var _0x53a544=_0x892d[_0x173fcf];return _0x53a544;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd892('0x0'))('api');var moment=require(_0xd892('0x1'));var BPromise=require('bluebird');var rp=require(_0xd892('0x2'));var fs=require('fs');var path=require(_0xd892('0x3'));var rimraf=require(_0xd892('0x4'));var config=require(_0xd892('0x5'));var attributes=require(_0xd892('0x6'));module[_0xd892('0x7')]=function(_0x2f3a51,_0x2049cf){return _0x2f3a51[_0xd892('0x8')]('VoiceMail',attributes,{'tableName':_0xd892('0x9'),'paranoid':![],'indexes':[{'name':_0xd892('0xa'),'fields':[_0xd892('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 98661c3..4d73511 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 _0x642f=['catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x235e61,_0x39bf64){var _0x58af19=function(_0x2e55df){while(--_0x2e55df){_0x235e61['push'](_0x235e61['shift']());}};_0x58af19(++_0x39bf64);}(_0x642f,0x1e4));var _0xf642=function(_0xd35f8d,_0x1af405){_0xd35f8d=_0xd35f8d-0x0;var _0x58bc8e=_0x642f[_0xd35f8d];return _0x58bc8e;};'use strict';var _=require(_0xf642('0x0'));var util=require(_0xf642('0x1'));var moment=require('moment');var BPromise=require(_0xf642('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf642('0x3'));var db=require(_0xf642('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf642('0x5'));var config=require(_0xf642('0x6'));var jayson=require(_0xf642('0x7'));var client=jayson[_0xf642('0x8')][_0xf642('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4741a9,_0x2df2d0,_0x1da5f0){return new BPromise(function(_0x58c9a5,_0x18409a){return client[_0xf642('0xa')](_0x4741a9,_0x1da5f0)[_0xf642('0xb')](function(_0x48403c){logger[_0xf642('0xc')](_0xf642('0xd'),_0x2df2d0,_0xf642('0xe'));logger[_0xf642('0xf')](_0xf642('0x10'),_0x2df2d0,_0xf642('0xe'),JSON['stringify'](_0x48403c));if(_0x48403c['error']){if(_0x48403c[_0xf642('0x11')]['code']===0x1f4){logger[_0xf642('0x11')](_0xf642('0xd'),_0x2df2d0,_0x48403c[_0xf642('0x11')]['message']);return _0x18409a(_0x48403c[_0xf642('0x11')][_0xf642('0x12')]);}logger['error'](_0xf642('0xd'),_0x2df2d0,_0x48403c[_0xf642('0x11')][_0xf642('0x12')]);return _0x58c9a5(_0x48403c[_0xf642('0x11')][_0xf642('0x12')]);}else{logger['info'](_0xf642('0xd'),_0x2df2d0,'request\x20sent');_0x58c9a5(_0x48403c[_0xf642('0x13')]['message']);}})[_0xf642('0x14')](function(_0x1487b3){logger[_0xf642('0x11')](_0xf642('0xd'),_0x2df2d0,_0x1487b3);_0x18409a(_0x1487b3);});});} \ No newline at end of file +var _0x2b68=['request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2b68,0x144));var _0x82b6=function(_0x129c55,_0x49f3fb){_0x129c55=_0x129c55-0x0;var _0x53bb23=_0x2b68[_0x129c55];return _0x53bb23;};'use strict';var _=require(_0x82b6('0x0'));var util=require(_0x82b6('0x1'));var moment=require(_0x82b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x82b6('0x3'));var fs=require('fs');var Redis=require(_0x82b6('0x4'));var db=require(_0x82b6('0x5'))['db'];var utils=require(_0x82b6('0x6'));var logger=require(_0x82b6('0x7'))(_0x82b6('0x8'));var config=require(_0x82b6('0x9'));var jayson=require(_0x82b6('0xa'));var client=jayson['client'][_0x82b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21ba27,_0x1d25d2,_0x436c65){return new BPromise(function(_0x2a17fc,_0x3feb90){return client[_0x82b6('0xc')](_0x21ba27,_0x436c65)[_0x82b6('0xd')](function(_0x371654){logger[_0x82b6('0xe')](_0x82b6('0xf'),_0x1d25d2,'request\x20sent');logger[_0x82b6('0x10')](_0x82b6('0x11'),_0x1d25d2,_0x82b6('0x12'),JSON[_0x82b6('0x13')](_0x371654));if(_0x371654[_0x82b6('0x14')]){if(_0x371654[_0x82b6('0x14')]['code']===0x1f4){logger['error'](_0x82b6('0xf'),_0x1d25d2,_0x371654['error'][_0x82b6('0x15')]);return _0x3feb90(_0x371654[_0x82b6('0x14')][_0x82b6('0x15')]);}logger[_0x82b6('0x14')](_0x82b6('0xf'),_0x1d25d2,_0x371654[_0x82b6('0x14')][_0x82b6('0x15')]);return _0x2a17fc(_0x371654['error'][_0x82b6('0x15')]);}else{logger[_0x82b6('0xe')]('VoiceMail,\x20%s,\x20%s',_0x1d25d2,_0x82b6('0x12'));_0x2a17fc(_0x371654[_0x82b6('0x16')][_0x82b6('0x15')]);}})[_0x82b6('0x17')](function(_0x5789f0){logger['error'](_0x82b6('0xf'),_0x1d25d2,_0x5789f0);_0x3feb90(_0x5789f0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d063a9d..2bec934 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 _0x5dc9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1b9544,_0xe23637){var _0x3bfb58=function(_0x440637){while(--_0x440637){_0x1b9544['push'](_0x1b9544['shift']());}};_0x3bfb58(++_0xe23637);}(_0x5dc9,0x16e));var _0x95dc=function(_0x399c4f,_0x417e30){_0x399c4f=_0x399c4f-0x0;var _0x179470=_0x5dc9[_0x399c4f];return _0x179470;};'use strict';var multer=require(_0x95dc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95dc('0x1'));var express=require(_0x95dc('0x2'));var router=express[_0x95dc('0x3')]();var fs_extra=require(_0x95dc('0x4'));var auth=require(_0x95dc('0x5'));var interaction=require(_0x95dc('0x6'));var config=require(_0x95dc('0x7'));var controller=require(_0x95dc('0x8'));router[_0x95dc('0x9')]('/',auth[_0x95dc('0xa')](),controller[_0x95dc('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x95dc('0xc')]);router[_0x95dc('0x9')](_0x95dc('0xd'),auth[_0x95dc('0xa')](),controller[_0x95dc('0xe')]);router[_0x95dc('0xf')]('/',auth[_0x95dc('0xa')](),controller[_0x95dc('0x10')]);router[_0x95dc('0x11')](_0x95dc('0x12'),auth[_0x95dc('0xa')](),controller[_0x95dc('0x13')]);router[_0x95dc('0x14')](_0x95dc('0x12'),auth[_0x95dc('0xa')](),controller[_0x95dc('0x15')]);module[_0x95dc('0x16')]=router; \ No newline at end of file +var _0x4a02=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','show','get','/:id/download','post','create','put','update','delete','destroy','exports','util','path','express','fs-extra'];(function(_0x46eb54,_0x4f1eac){var _0x3902b2=function(_0x3ac68b){while(--_0x3ac68b){_0x46eb54['push'](_0x46eb54['shift']());}};_0x3902b2(++_0x4f1eac);}(_0x4a02,0x1ca));var _0x24a0=function(_0x32f799,_0x2e3aab){_0x32f799=_0x32f799-0x0;var _0x44b063=_0x4a02[_0x32f799];return _0x44b063;};'use strict';var multer=require('multer');var util=require(_0x24a0('0x0'));var path=require(_0x24a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x24a0('0x2'));var router=express['Router']();var fs_extra=require(_0x24a0('0x3'));var auth=require(_0x24a0('0x4'));var interaction=require(_0x24a0('0x5'));var config=require(_0x24a0('0x6'));var controller=require(_0x24a0('0x7'));router['get']('/',auth[_0x24a0('0x8')](),controller[_0x24a0('0x9')]);router['get'](_0x24a0('0xa'),auth[_0x24a0('0x8')](),controller[_0x24a0('0xb')]);router[_0x24a0('0xc')](_0x24a0('0xd'),auth[_0x24a0('0x8')](),controller['download']);router[_0x24a0('0xe')]('/',auth[_0x24a0('0x8')](),controller[_0x24a0('0xf')]);router[_0x24a0('0x10')](_0x24a0('0xa'),auth['isAuthenticated'](),controller[_0x24a0('0x11')]);router[_0x24a0('0x12')]('/:id',auth[_0x24a0('0x8')](),controller[_0x24a0('0x13')]);module[_0x24a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f386a73..9a06ab1 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 _0x65b6=['getDataValue','INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x925616,_0x144755){var _0x323713=function(_0x1c26d8){while(--_0x1c26d8){_0x925616['push'](_0x925616['shift']());}};_0x323713(++_0x144755);}(_0x65b6,0x15c));var _0x665b=function(_0x1641ca,_0x290a2e){_0x1641ca=_0x1641ca-0x0;var _0xd3a8d2=_0x65b6[_0x1641ca];return _0xd3a8d2;};'use strict';var Sequelize=require(_0x665b('0x0'));module[_0x665b('0x1')]={'name':{'type':Sequelize[_0x665b('0x2')],'get':function(_0x49a436){return this[_0x665b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x665b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x665b('0x5')],'defaultValue':''},'stamp':{'type':_0x665b('0x6'),'defaultValue':Sequelize[_0x665b('0x7')](_0x665b('0x8'))}}; \ No newline at end of file +var _0x35f0=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x20be7e,_0x56db99){var _0x43728c=function(_0x43d386){while(--_0x43d386){_0x20be7e['push'](_0x20be7e['shift']());}};_0x43728c(++_0x56db99);}(_0x35f0,0x1b9));var _0x035f=function(_0x326902,_0x2408fe){_0x326902=_0x326902-0x0;var _0xdf6ab5=_0x35f0[_0x326902];return _0xdf6ab5;};'use strict';var Sequelize=require(_0x035f('0x0'));module[_0x035f('0x1')]={'name':{'type':Sequelize[_0x035f('0x2')],'get':function(_0x5c59a4){return this[_0x035f('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x035f('0x5')](_0x035f('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x035f('0x4')],'defaultValue':''},'stamp':{'type':_0x035f('0x7'),'defaultValue':Sequelize[_0x035f('0x8')](_0x035f('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 00a56b3..03ce442 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 _0x4a75=['params','find','create','body','destroy','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','rows','catch'];(function(_0x2c4e40,_0x1f77a1){var _0x5b2bba=function(_0x1f6d0f){while(--_0x1f6d0f){_0x2c4e40['push'](_0x2c4e40['shift']());}};_0x5b2bba(++_0x1f77a1);}(_0x4a75,0x65));var _0x54a7=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x4a75[_0x81dcac];return _0xc7803b;};'use strict';var emlformat=require(_0x54a7('0x0'));var rimraf=require(_0x54a7('0x1'));var zipdir=require(_0x54a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54a7('0x3'));var moment=require('moment');var BPromise=require(_0x54a7('0x4'));var Mustache=require(_0x54a7('0x5'));var util=require(_0x54a7('0x6'));var path=require(_0x54a7('0x7'));var sox=require('sox');var csv=require(_0x54a7('0x8'));var ejs=require(_0x54a7('0x9'));var fs=require('fs');var fs_extra=require(_0x54a7('0xa'));var _=require(_0x54a7('0xb'));var squel=require(_0x54a7('0xc'));var crypto=require(_0x54a7('0xd'));var jsforce=require(_0x54a7('0xe'));var deskjs=require(_0x54a7('0xf'));var toCsv=require(_0x54a7('0x8'));var querystring=require(_0x54a7('0x10'));var Papa=require(_0x54a7('0x11'));var Redis=require(_0x54a7('0x12'));var authService=require(_0x54a7('0x13'));var qs=require(_0x54a7('0x14'));var as=require(_0x54a7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a7('0x16'))(_0x54a7('0x17'));var utils=require(_0x54a7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x54a7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x240a56,_0x9f3699){_0x9f3699=_0x9f3699||0xcc;return function(_0x9a2a78){if(_0x9a2a78){return _0x240a56['sendStatus'](_0x9f3699);}return _0x240a56[_0x54a7('0x1a')](_0x9f3699)[_0x54a7('0x1b')]();};}function respondWithResult(_0x353c55,_0x57cb0e){_0x57cb0e=_0x57cb0e||0xc8;return function(_0x3b4b43){if(_0x3b4b43){return _0x353c55[_0x54a7('0x1a')](_0x57cb0e)[_0x54a7('0x1c')](_0x3b4b43);}};}function respondWithFilteredResult(_0x4fcaef,_0xbf7f5e){return function(_0x36d8a2){if(_0x36d8a2){var _0x24b423=typeof _0xbf7f5e[_0x54a7('0x1d')]===_0x54a7('0x1e')&&typeof _0xbf7f5e[_0x54a7('0x1f')]==='undefined';var _0x4046c2=_0x36d8a2[_0x54a7('0x20')];var _0x10354b=_0x24b423?0x0:_0xbf7f5e[_0x54a7('0x1d')];var _0xf4321a=_0x24b423?_0x36d8a2['count']:_0xbf7f5e[_0x54a7('0x1d')]+_0xbf7f5e[_0x54a7('0x1f')];var _0x44f919;if(_0xf4321a>=_0x4046c2){_0xf4321a=_0x4046c2;_0x44f919=0xc8;}else{_0x44f919=0xce;}_0x4fcaef['status'](_0x44f919);return _0x4fcaef[_0x54a7('0x21')](_0x54a7('0x22'),_0x10354b+'-'+_0xf4321a+'/'+_0x4046c2)['json'](_0x36d8a2);}return null;};}function patchUpdates(_0x2e0eb8){return function(_0x2f39ae){try{jsonpatch[_0x54a7('0x23')](_0x2f39ae,_0x2e0eb8,!![]);}catch(_0x3b74e3){return BPromise[_0x54a7('0x24')](_0x3b74e3);}return _0x2f39ae[_0x54a7('0x25')]();};}function saveUpdates(_0x567f50,_0x437cea){return function(_0x52e109){if(_0x52e109){return _0x52e109[_0x54a7('0x26')](_0x567f50)[_0x54a7('0x27')](function(_0x5af5e6){return _0x5af5e6;});}return null;};}function removeEntity(_0x4dab07,_0x29197e){return function(_0x8feb95){if(_0x8feb95){return _0x8feb95['destroy']()[_0x54a7('0x27')](function(){_0x4dab07['status'](0xcc)[_0x54a7('0x1b')]();});}};}function handleEntityNotFound(_0x5cd506,_0x4ace8a){return function(_0x25156b){if(!_0x25156b){_0x5cd506[_0x54a7('0x28')](0x194);}return _0x25156b;};}function handleError(_0x503312,_0x32685b){_0x32685b=_0x32685b||0x1f4;return function(_0x140b3d){logger[_0x54a7('0x29')](_0x140b3d['stack']);if(_0x140b3d['name']){delete _0x140b3d[_0x54a7('0x2a')];}_0x503312[_0x54a7('0x1a')](_0x32685b)[_0x54a7('0x2b')](_0x140b3d);};}exports[_0x54a7('0x2c')]=function(_0x2734ba,_0x164384){var _0x2e1162={},_0x511b35={},_0x3c418d={'count':0x0,'rows':[]};var _0x55fd67=_[_0x54a7('0x2d')](db['VoiceMailMessage'][_0x54a7('0x2e')],function(_0x3ef02b){return{'name':_0x3ef02b[_0x54a7('0x2f')],'type':_0x3ef02b[_0x54a7('0x30')][_0x54a7('0x31')]};});_0x511b35[_0x54a7('0x32')]=_[_0x54a7('0x33')](_[_0x54a7('0x2d')](_0x55fd67,_0x54a7('0x2a')),[_0x54a7('0x2a')]);_0x511b35[_0x54a7('0x34')]=_[_0x54a7('0x35')](_0x2734ba[_0x54a7('0x34')]);_0x511b35[_0x54a7('0x36')]=_[_0x54a7('0x37')](_0x511b35[_0x54a7('0x32')],_0x511b35[_0x54a7('0x34')]);_0x2e1162[_0x54a7('0x38')]=_['intersection'](_0x511b35['model'],qs[_0x54a7('0x39')](_0x2734ba[_0x54a7('0x34')]['fields']));_0x2e1162[_0x54a7('0x38')]=_0x2e1162[_0x54a7('0x38')][_0x54a7('0x3a')]?_0x2e1162[_0x54a7('0x38')]:_0x511b35['model'];if(!_0x2734ba['query']['hasOwnProperty'](_0x54a7('0x3b'))){_0x2e1162[_0x54a7('0x1f')]=qs[_0x54a7('0x1f')](_0x2734ba['query'][_0x54a7('0x1f')]);_0x2e1162['offset']=qs[_0x54a7('0x1d')](_0x2734ba[_0x54a7('0x34')][_0x54a7('0x1d')]);}_0x2e1162[_0x54a7('0x3c')]=qs[_0x54a7('0x3d')](_0x2734ba[_0x54a7('0x34')][_0x54a7('0x3d')]);_0x2e1162[_0x54a7('0x3e')]=qs[_0x54a7('0x36')](_[_0x54a7('0x3f')](_0x2734ba[_0x54a7('0x34')],_0x511b35[_0x54a7('0x36')]),_0x55fd67);if(_0x2734ba[_0x54a7('0x34')][_0x54a7('0x40')]){_0x2e1162[_0x54a7('0x3e')]=_[_0x54a7('0x41')](_0x2e1162[_0x54a7('0x3e')],{'$or':_['map'](_0x55fd67,function(_0x1cf41a){if(_0x1cf41a[_0x54a7('0x30')]!==_0x54a7('0x42')){var _0x11791f={};_0x11791f[_0x1cf41a['name']]={'$like':'%'+_0x2734ba[_0x54a7('0x34')][_0x54a7('0x40')]+'%'};return _0x11791f;}})});}_0x2e1162=_['merge']({},_0x2e1162,_0x2734ba[_0x54a7('0x43')]);var _0x4af67e={'where':_0x2e1162[_0x54a7('0x3e')]};return db[_0x54a7('0x44')]['count'](_0x4af67e)[_0x54a7('0x27')](function(_0x520cc0){_0x3c418d['count']=_0x520cc0;if(_0x2734ba[_0x54a7('0x34')][_0x54a7('0x45')]){_0x2e1162[_0x54a7('0x46')]=[{'all':!![]}];}return db[_0x54a7('0x44')]['findAll'](_0x2e1162);})['then'](function(_0x1acc3d){_0x3c418d[_0x54a7('0x47')]=_0x1acc3d;return _0x3c418d;})[_0x54a7('0x27')](respondWithFilteredResult(_0x164384,_0x2e1162))[_0x54a7('0x48')](handleError(_0x164384,null));};exports['show']=function(_0x1c8c48,_0x1c3b34){var _0x56fcf2={'raw':!![],'where':{'id':_0x1c8c48[_0x54a7('0x49')]['id']}},_0x4cf90a={};_0x4cf90a['model']=_[_0x54a7('0x35')](db[_0x54a7('0x44')][_0x54a7('0x2e')]);_0x4cf90a[_0x54a7('0x34')]=_[_0x54a7('0x35')](_0x1c8c48[_0x54a7('0x34')]);_0x4cf90a['filters']=_[_0x54a7('0x37')](_0x4cf90a[_0x54a7('0x32')],_0x4cf90a['query']);_0x56fcf2[_0x54a7('0x38')]=_[_0x54a7('0x37')](_0x4cf90a[_0x54a7('0x32')],qs[_0x54a7('0x39')](_0x1c8c48['query'][_0x54a7('0x39')]));_0x56fcf2['attributes']=_0x56fcf2[_0x54a7('0x38')][_0x54a7('0x3a')]?_0x56fcf2[_0x54a7('0x38')]:_0x4cf90a['model'];if(_0x1c8c48[_0x54a7('0x34')][_0x54a7('0x45')]){_0x56fcf2[_0x54a7('0x46')]=[{'all':!![]}];}_0x56fcf2=_['merge']({},_0x56fcf2,_0x1c8c48[_0x54a7('0x43')]);return db[_0x54a7('0x44')][_0x54a7('0x4a')](_0x56fcf2)['then'](handleEntityNotFound(_0x1c3b34,null))[_0x54a7('0x27')](respondWithResult(_0x1c3b34,null))['catch'](handleError(_0x1c3b34,null));};exports[_0x54a7('0x4b')]=function(_0x5af9e7,_0x26b83a){return db[_0x54a7('0x44')]['create'](_0x5af9e7['body'],{})[_0x54a7('0x27')](respondWithResult(_0x26b83a,0xc9))[_0x54a7('0x48')](handleError(_0x26b83a,null));};exports[_0x54a7('0x26')]=function(_0x140cdc,_0x1775a0){if(_0x140cdc[_0x54a7('0x4c')]['id']){delete _0x140cdc['body']['id'];}return db[_0x54a7('0x44')][_0x54a7('0x4a')]({'where':{'id':_0x140cdc[_0x54a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x1775a0,null))['then'](saveUpdates(_0x140cdc[_0x54a7('0x4c')],null))[_0x54a7('0x27')](respondWithResult(_0x1775a0,null))[_0x54a7('0x48')](handleError(_0x1775a0,null));};exports[_0x54a7('0x4d')]=function(_0x257359,_0x1cd1a9){return db[_0x54a7('0x44')][_0x54a7('0x4a')]({'where':{'id':_0x257359[_0x54a7('0x49')]['id']}})[_0x54a7('0x27')](handleEntityNotFound(_0x1cd1a9,null))[_0x54a7('0x27')](removeEntity(_0x1cd1a9,null))[_0x54a7('0x48')](handleError(_0x1cd1a9,null));};exports[_0x54a7('0x4e')]=function(_0x71e649,_0x45b837,_0x11846c){return db[_0x54a7('0x44')][_0x54a7('0x4a')]({'where':{'id':_0x71e649[_0x54a7('0x49')]['id']},'attributes':['id','recording',_0x54a7('0x4f')]})[_0x54a7('0x27')](handleEntityNotFound(_0x45b837,null))[_0x54a7('0x27')](function(_0x46568d){if(_0x46568d){if(!_0x46568d[_0x54a7('0x50')]){throw new db[(_0x54a7('0x51'))][(_0x54a7('0x52'))](_0x54a7('0x53'));}var _0x1ec38f={'Content-Type':_0x54a7('0x54'),'Content-Disposition':_0x54a7('0x55')};if(_0x46568d[_0x54a7('0x4f')]){_0x1ec38f['Content-Disposition']='attachment;\x20filename=\x22'+_0x46568d[_0x54a7('0x4f')]+_0x54a7('0x56');}_0x45b837[_0x54a7('0x21')](_0x1ec38f);return _0x45b837[_0x54a7('0x2b')](new Buffer(_0x46568d[_0x54a7('0x50')]));}})[_0x54a7('0x48')](handleError(_0x45b837,null));}; \ No newline at end of file +var _0xf65b=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','length','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','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'];(function(_0x2ad941,_0x52fd58){var _0x3649c9=function(_0x1963be){while(--_0x1963be){_0x2ad941['push'](_0x2ad941['shift']());}};_0x3649c9(++_0x52fd58);}(_0xf65b,0x9d));var _0xbf65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf65b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xbf65('0x0'));var rimraf=require(_0xbf65('0x1'));var zipdir=require(_0xbf65('0x2'));var jsonpatch=require(_0xbf65('0x3'));var rp=require(_0xbf65('0x4'));var moment=require('moment');var BPromise=require(_0xbf65('0x5'));var Mustache=require(_0xbf65('0x6'));var util=require(_0xbf65('0x7'));var path=require(_0xbf65('0x8'));var sox=require(_0xbf65('0x9'));var csv=require(_0xbf65('0xa'));var ejs=require(_0xbf65('0xb'));var fs=require('fs');var fs_extra=require(_0xbf65('0xc'));var _=require(_0xbf65('0xd'));var squel=require(_0xbf65('0xe'));var crypto=require(_0xbf65('0xf'));var jsforce=require(_0xbf65('0x10'));var deskjs=require(_0xbf65('0x11'));var toCsv=require(_0xbf65('0xa'));var querystring=require(_0xbf65('0x12'));var Papa=require(_0xbf65('0x13'));var Redis=require('ioredis');var authService=require(_0xbf65('0x14'));var qs=require(_0xbf65('0x15'));var as=require(_0xbf65('0x16'));var hardwareService=require(_0xbf65('0x17'));var logger=require(_0xbf65('0x18'))('api');var utils=require(_0xbf65('0x19'));var config=require(_0xbf65('0x1a'));var licenseUtil=require(_0xbf65('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x385e2e,_0x2295ab){_0x2295ab=_0x2295ab||0xcc;return function(_0x3c79f5){if(_0x3c79f5){return _0x385e2e[_0xbf65('0x1c')](_0x2295ab);}return _0x385e2e[_0xbf65('0x1d')](_0x2295ab)[_0xbf65('0x1e')]();};}function respondWithResult(_0x1beeb0,_0x132459){_0x132459=_0x132459||0xc8;return function(_0x2201c8){if(_0x2201c8){return _0x1beeb0[_0xbf65('0x1d')](_0x132459)[_0xbf65('0x1f')](_0x2201c8);}};}function respondWithFilteredResult(_0x11685c,_0x4103d2){return function(_0x57cb3c){if(_0x57cb3c){var _0x4c6dcb=typeof _0x4103d2['offset']===_0xbf65('0x20')&&typeof _0x4103d2[_0xbf65('0x21')]===_0xbf65('0x20');var _0x25017b=_0x57cb3c[_0xbf65('0x22')];var _0x210c34=_0x4c6dcb?0x0:_0x4103d2['offset'];var _0x51777b=_0x4c6dcb?_0x57cb3c['count']:_0x4103d2[_0xbf65('0x23')]+_0x4103d2['limit'];var _0x27832b;if(_0x51777b>=_0x25017b){_0x51777b=_0x25017b;_0x27832b=0xc8;}else{_0x27832b=0xce;}_0x11685c[_0xbf65('0x1d')](_0x27832b);return _0x11685c[_0xbf65('0x24')](_0xbf65('0x25'),_0x210c34+'-'+_0x51777b+'/'+_0x25017b)[_0xbf65('0x1f')](_0x57cb3c);}return null;};}function patchUpdates(_0x55776c){return function(_0x143402){try{jsonpatch[_0xbf65('0x26')](_0x143402,_0x55776c,!![]);}catch(_0x9abbc0){return BPromise[_0xbf65('0x27')](_0x9abbc0);}return _0x143402['save']();};}function saveUpdates(_0x23f7cc,_0x2235bc){return function(_0x21f3da){if(_0x21f3da){return _0x21f3da[_0xbf65('0x28')](_0x23f7cc)[_0xbf65('0x29')](function(_0x10ee25){return _0x10ee25;});}return null;};}function removeEntity(_0x26d60d,_0x39a313){return function(_0x1c2c54){if(_0x1c2c54){return _0x1c2c54[_0xbf65('0x2a')]()[_0xbf65('0x29')](function(){_0x26d60d[_0xbf65('0x1d')](0xcc)[_0xbf65('0x1e')]();});}};}function handleEntityNotFound(_0x209a51,_0x193550){return function(_0xd002f2){if(!_0xd002f2){_0x209a51[_0xbf65('0x1c')](0x194);}return _0xd002f2;};}function handleError(_0x42ca4c,_0xbd701c){_0xbd701c=_0xbd701c||0x1f4;return function(_0x4bf5cb){logger['error'](_0x4bf5cb[_0xbf65('0x2b')]);if(_0x4bf5cb[_0xbf65('0x2c')]){delete _0x4bf5cb[_0xbf65('0x2c')];}_0x42ca4c['status'](_0xbd701c)[_0xbf65('0x2d')](_0x4bf5cb);};}exports[_0xbf65('0x2e')]=function(_0x2b071e,_0x9ae062){var _0x2638e6={},_0x314a37={},_0x37fe7c={'count':0x0,'rows':[]};var _0x5819d2=_[_0xbf65('0x2f')](db[_0xbf65('0x30')]['rawAttributes'],function(_0x45eb6a){return{'name':_0x45eb6a[_0xbf65('0x31')],'type':_0x45eb6a[_0xbf65('0x32')]['key']};});_0x314a37[_0xbf65('0x33')]=_[_0xbf65('0x34')](_[_0xbf65('0x2f')](_0x5819d2,_0xbf65('0x2c')),[_0xbf65('0x2c')]);_0x314a37[_0xbf65('0x35')]=_[_0xbf65('0x36')](_0x2b071e[_0xbf65('0x35')]);_0x314a37[_0xbf65('0x37')]=_[_0xbf65('0x38')](_0x314a37[_0xbf65('0x33')],_0x314a37[_0xbf65('0x35')]);_0x2638e6[_0xbf65('0x39')]=_[_0xbf65('0x38')](_0x314a37[_0xbf65('0x33')],qs[_0xbf65('0x3a')](_0x2b071e[_0xbf65('0x35')][_0xbf65('0x3a')]));_0x2638e6[_0xbf65('0x39')]=_0x2638e6[_0xbf65('0x39')]['length']?_0x2638e6[_0xbf65('0x39')]:_0x314a37['model'];if(!_0x2b071e[_0xbf65('0x35')][_0xbf65('0x3b')](_0xbf65('0x3c'))){_0x2638e6[_0xbf65('0x21')]=qs[_0xbf65('0x21')](_0x2b071e['query'][_0xbf65('0x21')]);_0x2638e6[_0xbf65('0x23')]=qs[_0xbf65('0x23')](_0x2b071e['query'][_0xbf65('0x23')]);}_0x2638e6['order']=qs[_0xbf65('0x3d')](_0x2b071e[_0xbf65('0x35')][_0xbf65('0x3d')]);_0x2638e6[_0xbf65('0x3e')]=qs[_0xbf65('0x37')](_[_0xbf65('0x3f')](_0x2b071e['query'],_0x314a37[_0xbf65('0x37')]),_0x5819d2);if(_0x2b071e[_0xbf65('0x35')][_0xbf65('0x40')]){_0x2638e6[_0xbf65('0x3e')]=_['merge'](_0x2638e6[_0xbf65('0x3e')],{'$or':_[_0xbf65('0x2f')](_0x5819d2,function(_0x51721e){if(_0x51721e['type']!==_0xbf65('0x41')){var _0x32dc2c={};_0x32dc2c[_0x51721e[_0xbf65('0x2c')]]={'$like':'%'+_0x2b071e['query']['filter']+'%'};return _0x32dc2c;}})});}_0x2638e6=_[_0xbf65('0x42')]({},_0x2638e6,_0x2b071e[_0xbf65('0x43')]);var _0x139f18={'where':_0x2638e6[_0xbf65('0x3e')]};return db[_0xbf65('0x30')][_0xbf65('0x22')](_0x139f18)['then'](function(_0x168af8){_0x37fe7c[_0xbf65('0x22')]=_0x168af8;if(_0x2b071e[_0xbf65('0x35')]['includeAll']){_0x2638e6[_0xbf65('0x44')]=[{'all':!![]}];}return db[_0xbf65('0x30')][_0xbf65('0x45')](_0x2638e6);})[_0xbf65('0x29')](function(_0xf16313){_0x37fe7c[_0xbf65('0x46')]=_0xf16313;return _0x37fe7c;})['then'](respondWithFilteredResult(_0x9ae062,_0x2638e6))[_0xbf65('0x47')](handleError(_0x9ae062,null));};exports[_0xbf65('0x48')]=function(_0x24d2c3,_0x174b0d){var _0x33f0a3={'raw':!![],'where':{'id':_0x24d2c3['params']['id']}},_0x4ddaa4={};_0x4ddaa4[_0xbf65('0x33')]=_[_0xbf65('0x36')](db['VoiceMailMessage']['rawAttributes']);_0x4ddaa4[_0xbf65('0x35')]=_[_0xbf65('0x36')](_0x24d2c3[_0xbf65('0x35')]);_0x4ddaa4['filters']=_[_0xbf65('0x38')](_0x4ddaa4['model'],_0x4ddaa4[_0xbf65('0x35')]);_0x33f0a3[_0xbf65('0x39')]=_['intersection'](_0x4ddaa4[_0xbf65('0x33')],qs[_0xbf65('0x3a')](_0x24d2c3['query'][_0xbf65('0x3a')]));_0x33f0a3[_0xbf65('0x39')]=_0x33f0a3[_0xbf65('0x39')][_0xbf65('0x49')]?_0x33f0a3[_0xbf65('0x39')]:_0x4ddaa4[_0xbf65('0x33')];if(_0x24d2c3[_0xbf65('0x35')]['includeAll']){_0x33f0a3[_0xbf65('0x44')]=[{'all':!![]}];}_0x33f0a3=_[_0xbf65('0x42')]({},_0x33f0a3,_0x24d2c3[_0xbf65('0x43')]);return db[_0xbf65('0x30')]['find'](_0x33f0a3)[_0xbf65('0x29')](handleEntityNotFound(_0x174b0d,null))[_0xbf65('0x29')](respondWithResult(_0x174b0d,null))[_0xbf65('0x47')](handleError(_0x174b0d,null));};exports['create']=function(_0x5279c3,_0xd64e35){return db['VoiceMailMessage'][_0xbf65('0x4a')](_0x5279c3[_0xbf65('0x4b')],{})['then'](respondWithResult(_0xd64e35,0xc9))['catch'](handleError(_0xd64e35,null));};exports['update']=function(_0x115b1c,_0x21a3ed){if(_0x115b1c[_0xbf65('0x4b')]['id']){delete _0x115b1c[_0xbf65('0x4b')]['id'];}return db[_0xbf65('0x30')][_0xbf65('0x4c')]({'where':{'id':_0x115b1c[_0xbf65('0x4d')]['id']}})[_0xbf65('0x29')](handleEntityNotFound(_0x21a3ed,null))[_0xbf65('0x29')](saveUpdates(_0x115b1c['body'],null))[_0xbf65('0x29')](respondWithResult(_0x21a3ed,null))[_0xbf65('0x47')](handleError(_0x21a3ed,null));};exports[_0xbf65('0x2a')]=function(_0xc13fd1,_0x9d110c){return db[_0xbf65('0x30')][_0xbf65('0x4c')]({'where':{'id':_0xc13fd1['params']['id']}})[_0xbf65('0x29')](handleEntityNotFound(_0x9d110c,null))[_0xbf65('0x29')](removeEntity(_0x9d110c,null))[_0xbf65('0x47')](handleError(_0x9d110c,null));};exports[_0xbf65('0x4e')]=function(_0x161df0,_0x3aad5e,_0x44ebc5){return db[_0xbf65('0x30')][_0xbf65('0x4c')]({'where':{'id':_0x161df0[_0xbf65('0x4d')]['id']},'attributes':['id',_0xbf65('0x4f'),_0xbf65('0x50')]})[_0xbf65('0x29')](handleEntityNotFound(_0x3aad5e,null))[_0xbf65('0x29')](function(_0x28ea41){if(_0x28ea41){if(!_0x28ea41[_0xbf65('0x4f')]){throw new db[(_0xbf65('0x51'))][(_0xbf65('0x52'))](_0xbf65('0x53'));}var _0x3c7558={'Content-Type':_0xbf65('0x54'),'Content-Disposition':_0xbf65('0x55')};if(_0x28ea41[_0xbf65('0x50')]){_0x3c7558['Content-Disposition']=_0xbf65('0x56')+_0x28ea41['msg_id']+_0xbf65('0x57');}_0x3aad5e[_0xbf65('0x24')](_0x3c7558);return _0x3aad5e[_0xbf65('0x2d')](new Buffer(_0x28ea41[_0xbf65('0x4f')]));}})[_0xbf65('0x47')](handleError(_0x3aad5e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 96c05ed..3243fdd 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 _0x6195=['voice_voicemail_messages','dir','lodash','util','api','moment','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define'];(function(_0x2ede74,_0x36ac75){var _0x25020c=function(_0x314890){while(--_0x314890){_0x2ede74['push'](_0x2ede74['shift']());}};_0x25020c(++_0x36ac75);}(_0x6195,0x1e2));var _0x5619=function(_0x419018,_0x23a46c){_0x419018=_0x419018-0x0;var _0x2197ef=_0x6195[_0x419018];return _0x2197ef;};'use strict';var _=require(_0x5619('0x0'));var util=require(_0x5619('0x1'));var logger=require('../../config/logger')(_0x5619('0x2'));var moment=require(_0x5619('0x3'));var BPromise=require('bluebird');var rp=require(_0x5619('0x4'));var fs=require('fs');var path=require(_0x5619('0x5'));var rimraf=require(_0x5619('0x6'));var config=require('../../config/environment');var attributes=require(_0x5619('0x7'));module[_0x5619('0x8')]=function(_0x195649,_0x1806c8){return _0x195649[_0x5619('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x5619('0xa'),'paranoid':![],'indexes':[{'name':_0x5619('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x24c3=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x14e220,_0x57056){var _0x746d60=function(_0x376042){while(--_0x376042){_0x14e220['push'](_0x14e220['shift']());}};_0x746d60(++_0x57056);}(_0x24c3,0x14a));var _0x324c=function(_0x39545b,_0x191dd7){_0x39545b=_0x39545b-0x0;var _0x2b489f=_0x24c3[_0x39545b];return _0x2b489f;};'use strict';var _=require(_0x324c('0x0'));var util=require(_0x324c('0x1'));var logger=require(_0x324c('0x2'))(_0x324c('0x3'));var moment=require('moment');var BPromise=require(_0x324c('0x4'));var rp=require(_0x324c('0x5'));var fs=require('fs');var path=require(_0x324c('0x6'));var rimraf=require(_0x324c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x324c('0x8')]=function(_0x154f0f,_0x19a644){return _0x154f0f[_0x324c('0x9')](_0x324c('0xa'),attributes,{'tableName':_0x324c('0xb'),'paranoid':![],'indexes':[{'name':_0x324c('0xc'),'fields':[_0x324c('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4ff57a0..40e93e7 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 _0xa277=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xa277,0x143));var _0x7a27=function(_0x3e6f41,_0x307396){_0x3e6f41=_0x3e6f41-0x0;var _0xa7503e=_0xa277[_0x3e6f41];return _0xa7503e;};'use strict';var _=require('lodash');var util=require(_0x7a27('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7a27('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a27('0x2'))['db'];var utils=require(_0x7a27('0x3'));var logger=require(_0x7a27('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a27('0x5'));var client=jayson[_0x7a27('0x6')][_0x7a27('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bb71a,_0x2c97d3,_0x42a32d){return new BPromise(function(_0x42834a,_0x56c4f0){return client[_0x7a27('0x8')](_0x3bb71a,_0x42a32d)[_0x7a27('0x9')](function(_0x2d48b4){logger[_0x7a27('0xa')](_0x7a27('0xb'),_0x2c97d3,'request\x20sent');logger[_0x7a27('0xc')](_0x7a27('0xd'),_0x2c97d3,_0x7a27('0xe'),JSON[_0x7a27('0xf')](_0x2d48b4));if(_0x2d48b4[_0x7a27('0x10')]){if(_0x2d48b4[_0x7a27('0x10')][_0x7a27('0x11')]===0x1f4){logger[_0x7a27('0x10')](_0x7a27('0xb'),_0x2c97d3,_0x2d48b4['error'][_0x7a27('0x12')]);return _0x56c4f0(_0x2d48b4[_0x7a27('0x10')]['message']);}logger['error'](_0x7a27('0xb'),_0x2c97d3,_0x2d48b4[_0x7a27('0x10')][_0x7a27('0x12')]);return _0x42834a(_0x2d48b4[_0x7a27('0x10')][_0x7a27('0x12')]);}else{logger['info'](_0x7a27('0xb'),_0x2c97d3,_0x7a27('0xe'));_0x42834a(_0x2d48b4[_0x7a27('0x13')]['message']);}})[_0x7a27('0x14')](function(_0x55e1e2){logger[_0x7a27('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2c97d3,_0x55e1e2);_0x56c4f0(_0x55e1e2);});});} \ No newline at end of file +var _0xc5d5=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x179c42,_0x3ad79f){var _0x31625e=function(_0x4d92b1){while(--_0x4d92b1){_0x179c42['push'](_0x179c42['shift']());}};_0x31625e(++_0x3ad79f);}(_0xc5d5,0x1ac));var _0x5c5d=function(_0x21f270,_0xd4d697){_0x21f270=_0x21f270-0x0;var _0x29eacb=_0xc5d5[_0x21f270];return _0x29eacb;};'use strict';var _=require('lodash');var util=require(_0x5c5d('0x0'));var moment=require(_0x5c5d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c5d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c5d('0x3'))['db'];var utils=require(_0x5c5d('0x4'));var logger=require(_0x5c5d('0x5'))(_0x5c5d('0x6'));var config=require(_0x5c5d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c5d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19c8dd,_0x5e3210,_0xc0cb7){return new BPromise(function(_0x1eee87,_0x5c1bc5){return client['request'](_0x19c8dd,_0xc0cb7)[_0x5c5d('0x9')](function(_0x5e5e85){logger['info'](_0x5c5d('0xa'),_0x5e3210,_0x5c5d('0xb'));logger[_0x5c5d('0xc')](_0x5c5d('0xd'),_0x5e3210,_0x5c5d('0xb'),JSON[_0x5c5d('0xe')](_0x5e5e85));if(_0x5e5e85[_0x5c5d('0xf')]){if(_0x5e5e85['error'][_0x5c5d('0x10')]===0x1f4){logger[_0x5c5d('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5e3210,_0x5e5e85[_0x5c5d('0xf')][_0x5c5d('0x11')]);return _0x5c1bc5(_0x5e5e85['error'][_0x5c5d('0x11')]);}logger['error'](_0x5c5d('0xa'),_0x5e3210,_0x5e5e85[_0x5c5d('0xf')]['message']);return _0x1eee87(_0x5e5e85['error'][_0x5c5d('0x11')]);}else{logger[_0x5c5d('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x5e3210,_0x5c5d('0xb'));_0x1eee87(_0x5e5e85[_0x5c5d('0x13')][_0x5c5d('0x11')]);}})[_0x5c5d('0x14')](function(_0x389954){logger['error'](_0x5c5d('0xa'),_0x5e3210,_0x389954);_0x5c1bc5(_0x389954);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e30935d..9723f4e 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 _0x5236=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id/sounds','post','addSound','put','destroy','delete','/:id/sounds/:id2'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0x5236,0x190));var _0x6523=function(_0x46ec3e,_0x1c8c95){_0x46ec3e=_0x46ec3e-0x0;var _0x453789=_0x5236[_0x46ec3e];return _0x453789;};'use strict';var multer=require(_0x6523('0x0'));var util=require('util');var path=require(_0x6523('0x1'));var timeout=require(_0x6523('0x2'));var express=require(_0x6523('0x3'));var router=express[_0x6523('0x4')]();var fs_extra=require(_0x6523('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6523('0x6'));var config=require(_0x6523('0x7'));var controller=require(_0x6523('0x8'));router[_0x6523('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6523('0x9')]('/:id',auth[_0x6523('0xa')](),controller['show']);router[_0x6523('0x9')](_0x6523('0xb'),auth[_0x6523('0xa')](),controller['getSounds']);router[_0x6523('0xc')]('/',auth[_0x6523('0xa')](),controller['create']);router[_0x6523('0xc')](_0x6523('0xb'),auth['isAuthenticated'](),controller[_0x6523('0xd')]);router[_0x6523('0xe')]('/:id',auth[_0x6523('0xa')](),controller['update']);router['delete']('/:id',auth[_0x6523('0xa')](),controller[_0x6523('0xf')]);router[_0x6523('0x10')](_0x6523('0x11'),auth[_0x6523('0xa')](),controller['removeSound']);module[_0x6523('0x12')]=router; \ No newline at end of file +var _0x380f=['create','/:id/sounds','addSound','destroy','delete','/:id/sounds/:id2','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','post'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x380f,0xc3));var _0xf380=function(_0x536000,_0xde5c03){_0x536000=_0x536000-0x0;var _0x203834=_0x380f[_0x536000];return _0x203834;};'use strict';var multer=require(_0xf380('0x0'));var util=require(_0xf380('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf380('0x2'));var router=express[_0xf380('0x3')]();var fs_extra=require(_0xf380('0x4'));var auth=require(_0xf380('0x5'));var interaction=require(_0xf380('0x6'));var config=require(_0xf380('0x7'));var controller=require(_0xf380('0x8'));router[_0xf380('0x9')]('/',auth[_0xf380('0xa')](),controller['index']);router[_0xf380('0x9')](_0xf380('0xb'),auth[_0xf380('0xa')](),controller[_0xf380('0xc')]);router[_0xf380('0x9')]('/:id/sounds',auth[_0xf380('0xa')](),controller[_0xf380('0xd')]);router[_0xf380('0xe')]('/',auth['isAuthenticated'](),controller[_0xf380('0xf')]);router[_0xf380('0xe')](_0xf380('0x10'),auth[_0xf380('0xa')](),controller[_0xf380('0x11')]);router['put'](_0xf380('0xb'),auth[_0xf380('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf380('0x12')]);router[_0xf380('0x13')](_0xf380('0x14'),auth[_0xf380('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 813c373..43589ec 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 _0xf7f8=['quietmp3','mp3','alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xf7f8,0x13b));var _0x8f7f=function(_0x5adc46,_0x2b2b0d){_0x5adc46=_0x5adc46-0x0;var _0x1bab26=_0xf7f8[_0x5adc46];return _0x1bab26;};'use strict';var Sequelize=require(_0x8f7f('0x0'));module[_0x8f7f('0x1')]={'name':{'type':Sequelize[_0x8f7f('0x2')],'allowNull':![],'unique':_0x8f7f('0x3')},'mode':{'type':Sequelize[_0x8f7f('0x4')](_0x8f7f('0x5'),_0x8f7f('0x6'),_0x8f7f('0x7'),_0x8f7f('0x8'),_0x8f7f('0x9'),_0x8f7f('0xa')),'allowNull':!![],'defaultValue':_0x8f7f('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x8f7f('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8f7f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8f7f('0xb')},'format':{'type':Sequelize[_0x8f7f('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0dde=['alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x4009dd,_0x2e5052){var _0x4dc3fe=function(_0x4d1495){while(--_0x4d1495){_0x4009dd['push'](_0x4009dd['shift']());}};_0x4dc3fe(++_0x2e5052);}(_0x0dde,0x153));var _0xe0dd=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0x0dde[_0x4a489f];return _0x4a4137;};'use strict';var Sequelize=require(_0xe0dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0dd('0x1')],'allowNull':![],'unique':_0xe0dd('0x2')},'mode':{'type':Sequelize[_0xe0dd('0x3')]('custom',_0xe0dd('0x4'),_0xe0dd('0x5'),_0xe0dd('0x6'),_0xe0dd('0x7'),_0xe0dd('0x8')),'allowNull':!![],'defaultValue':_0xe0dd('0x4')},'directory':{'type':Sequelize[_0xe0dd('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xe0dd('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xe0dd('0x1')],'allowNull':!![],'defaultValue':_0xe0dd('0x9')},'format':{'type':Sequelize[_0xe0dd('0x1')],'allowNull':!![]},'stamp':{'type':_0xe0dd('0xa')},'defaultEntry':{'type':Sequelize[_0xe0dd('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ca3d8a2..d946248 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 _0x2561=['transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','ValidationError','message','addSound','Sound','save_name','createdAt','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize','findOne','removeSound','getSounds','length','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','body','params','create'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2561,0x96));var _0x1256=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2561[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x1256('0x0'));var rimraf=require(_0x1256('0x1'));var zipdir=require(_0x1256('0x2'));var jsonpatch=require(_0x1256('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1256('0x4'));var Mustache=require('mustache');var util=require(_0x1256('0x5'));var path=require('path');var sox=require(_0x1256('0x6'));var csv=require(_0x1256('0x7'));var ejs=require(_0x1256('0x8'));var fs=require('fs');var fs_extra=require(_0x1256('0x9'));var _=require(_0x1256('0xa'));var squel=require(_0x1256('0xb'));var crypto=require(_0x1256('0xc'));var jsforce=require(_0x1256('0xd'));var deskjs=require(_0x1256('0xe'));var toCsv=require(_0x1256('0x7'));var querystring=require('querystring');var Papa=require(_0x1256('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1256('0x10'));var as=require(_0x1256('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1256('0x12'))(_0x1256('0x13'));var utils=require(_0x1256('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1256('0x15'))['db'];function respondWithStatusCode(_0x4ba37c,_0x748339){_0x748339=_0x748339||0xcc;return function(_0x812724){if(_0x812724){return _0x4ba37c[_0x1256('0x16')](_0x748339);}return _0x4ba37c[_0x1256('0x17')](_0x748339)[_0x1256('0x18')]();};}function respondWithResult(_0x4ef6d6,_0x5855c0){_0x5855c0=_0x5855c0||0xc8;return function(_0x15bc96){if(_0x15bc96){return _0x4ef6d6['status'](_0x5855c0)[_0x1256('0x19')](_0x15bc96);}};}function respondWithFilteredResult(_0x55f090,_0xf697cc){return function(_0x37a25e){if(_0x37a25e){var _0x81cabc=typeof _0xf697cc[_0x1256('0x1a')]==='undefined'&&typeof _0xf697cc[_0x1256('0x1b')]===_0x1256('0x1c');var _0x2e0a66=_0x37a25e[_0x1256('0x1d')];var _0x537a71=_0x81cabc?0x0:_0xf697cc[_0x1256('0x1a')];var _0x54ab60=_0x81cabc?_0x37a25e[_0x1256('0x1d')]:_0xf697cc[_0x1256('0x1a')]+_0xf697cc[_0x1256('0x1b')];var _0x150770;if(_0x54ab60>=_0x2e0a66){_0x54ab60=_0x2e0a66;_0x150770=0xc8;}else{_0x150770=0xce;}_0x55f090[_0x1256('0x17')](_0x150770);return _0x55f090['set'](_0x1256('0x1e'),_0x537a71+'-'+_0x54ab60+'/'+_0x2e0a66)[_0x1256('0x19')](_0x37a25e);}return null;};}function patchUpdates(_0x3116c7){return function(_0x4669b7){try{jsonpatch[_0x1256('0x1f')](_0x4669b7,_0x3116c7,!![]);}catch(_0x3ab2c5){return BPromise[_0x1256('0x20')](_0x3ab2c5);}return _0x4669b7[_0x1256('0x21')]();};}function saveUpdates(_0x4d6a55,_0x3f5c4c){return function(_0x5deaff){if(_0x5deaff){return _0x5deaff[_0x1256('0x22')](_0x4d6a55)[_0x1256('0x23')](function(_0x1ce5b6){return _0x1ce5b6;});}return null;};}function removeEntity(_0x3d2d7b,_0x2f54bf){return function(_0x4581fa){if(_0x4581fa){return _0x4581fa[_0x1256('0x24')]()[_0x1256('0x23')](function(){var _0x51e58b=_0x4581fa[_0x1256('0x25')]({'plain':!![]});var _0x565dc0=_0x1256('0x26');return db[_0x1256('0x27')]['destroy']({'where':{'type':_0x565dc0,'resourceId':_0x51e58b['id']}})[_0x1256('0x23')](function(){return _0x4581fa;});})[_0x1256('0x23')](function(){_0x3d2d7b[_0x1256('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c95ea,_0x172e65){return function(_0x143fb9){if(!_0x143fb9){_0x3c95ea[_0x1256('0x16')](0x194);}return _0x143fb9;};}function handleError(_0x3ab789,_0xbd72d0){_0xbd72d0=_0xbd72d0||0x1f4;return function(_0x220d11){logger[_0x1256('0x28')](_0x220d11[_0x1256('0x29')]);if(_0x220d11['name']){delete _0x220d11[_0x1256('0x2a')];}_0x3ab789[_0x1256('0x17')](_0xbd72d0)[_0x1256('0x2b')](_0x220d11);};}exports[_0x1256('0x2c')]=function(_0x4e82e1,_0x1b2880){var _0x30b3ef={},_0x14c721={},_0xd12314={'count':0x0,'rows':[]};var _0x39739a=_[_0x1256('0x2d')](db[_0x1256('0x2e')]['rawAttributes'],function(_0x25e806){return{'name':_0x25e806[_0x1256('0x2f')],'type':_0x25e806[_0x1256('0x30')][_0x1256('0x31')]};});_0x14c721[_0x1256('0x32')]=_['map'](_0x39739a,'name');_0x14c721[_0x1256('0x33')]=_[_0x1256('0x34')](_0x4e82e1[_0x1256('0x33')]);_0x14c721['filters']=_[_0x1256('0x35')](_0x14c721['model'],_0x14c721[_0x1256('0x33')]);_0x30b3ef[_0x1256('0x36')]=_[_0x1256('0x35')](_0x14c721[_0x1256('0x32')],qs['fields'](_0x4e82e1[_0x1256('0x33')][_0x1256('0x37')]));_0x30b3ef[_0x1256('0x36')]=_0x30b3ef[_0x1256('0x36')]['length']?_0x30b3ef[_0x1256('0x36')]:_0x14c721['model'];if(!_0x4e82e1[_0x1256('0x33')][_0x1256('0x38')]('nolimit')){_0x30b3ef[_0x1256('0x1b')]=qs[_0x1256('0x1b')](_0x4e82e1[_0x1256('0x33')]['limit']);_0x30b3ef[_0x1256('0x1a')]=qs['offset'](_0x4e82e1[_0x1256('0x33')][_0x1256('0x1a')]);}_0x30b3ef['order']=qs[_0x1256('0x39')](_0x4e82e1[_0x1256('0x33')][_0x1256('0x39')]);delete _0x4e82e1[_0x1256('0x33')][_0x1256('0x39')];_0x30b3ef[_0x1256('0x3a')]=qs['filters'](_[_0x1256('0x3b')](_0x4e82e1[_0x1256('0x33')],_0x14c721[_0x1256('0x3c')]),_0x39739a);if(_0x4e82e1[_0x1256('0x33')][_0x1256('0x3d')]){_0x30b3ef[_0x1256('0x3a')]=_[_0x1256('0x3e')](_0x30b3ef[_0x1256('0x3a')],{'$or':_[_0x1256('0x2d')](_0x39739a,function(_0x342766){if(_0x342766[_0x1256('0x30')]!==_0x1256('0x3f')){var _0x4b1f9a={};_0x4b1f9a[_0x342766[_0x1256('0x2a')]]={'$like':'%'+_0x4e82e1['query']['filter']+'%'};return _0x4b1f9a;}})});}_0x30b3ef=_[_0x1256('0x3e')]({},_0x30b3ef,_0x4e82e1['options']);var _0x308d33={'where':_0x30b3ef[_0x1256('0x3a')]};return db[_0x1256('0x2e')][_0x1256('0x1d')](_0x308d33)[_0x1256('0x23')](function(_0x166c5e){_0xd12314[_0x1256('0x1d')]=_0x166c5e;if(_0x4e82e1[_0x1256('0x33')][_0x1256('0x40')]){_0x30b3ef[_0x1256('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x1256('0x42')](_0x30b3ef);})[_0x1256('0x23')](function(_0x24dd4f){_0xd12314[_0x1256('0x43')]=_0x24dd4f;return _0xd12314;})[_0x1256('0x23')](respondWithFilteredResult(_0x1b2880,_0x30b3ef))[_0x1256('0x44')](handleError(_0x1b2880,null));};exports[_0x1256('0x45')]=function(_0x36d07e,_0x11463d){var _0x54b4e1={'raw':![],'where':{'id':_0x36d07e['params']['id']}},_0xda7172={};_0xda7172['model']=_[_0x1256('0x34')](db['VoiceMusicOnHold'][_0x1256('0x46')]);_0xda7172[_0x1256('0x33')]=_[_0x1256('0x34')](_0x36d07e[_0x1256('0x33')]);_0xda7172[_0x1256('0x3c')]=_[_0x1256('0x35')](_0xda7172[_0x1256('0x32')],_0xda7172[_0x1256('0x33')]);_0x54b4e1['attributes']=_[_0x1256('0x35')](_0xda7172[_0x1256('0x32')],qs[_0x1256('0x37')](_0x36d07e[_0x1256('0x33')]['fields']));_0x54b4e1[_0x1256('0x36')]=_0x54b4e1[_0x1256('0x36')]['length']?_0x54b4e1['attributes']:_0xda7172[_0x1256('0x32')];if(_0x36d07e[_0x1256('0x33')][_0x1256('0x40')]){_0x54b4e1[_0x1256('0x41')]=[{'all':!![]}];}_0x54b4e1=_['merge']({},_0x54b4e1,_0x36d07e[_0x1256('0x47')]);return db[_0x1256('0x2e')][_0x1256('0x48')](_0x54b4e1)['then'](handleEntityNotFound(_0x11463d,null))['then'](respondWithResult(_0x11463d,null))[_0x1256('0x44')](handleError(_0x11463d,null));};exports[_0x1256('0x22')]=function(_0x1b8713,_0x9d40b8){if(_0x1b8713[_0x1256('0x49')]['id']){delete _0x1b8713[_0x1256('0x49')]['id'];}return db[_0x1256('0x2e')][_0x1256('0x48')]({'where':{'id':_0x1b8713[_0x1256('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9d40b8,null))['then'](saveUpdates(_0x1b8713[_0x1256('0x49')],null))['then'](respondWithResult(_0x9d40b8,null))[_0x1256('0x44')](handleError(_0x9d40b8,null));};exports[_0x1256('0x4b')]=function(_0x40eb38,_0x279503,_0x502761){return db['sequelize'][_0x1256('0x4c')](function(_0x2b6009){if(_0x40eb38[_0x1256('0x49')][_0x1256('0x4d')]===_0x1256('0x4e')){_0x40eb38[_0x1256('0x49')][_0x1256('0x4f')]=path[_0x1256('0x50')](config[_0x1256('0x51')],_0x1256('0x52'),_0x40eb38[_0x1256('0x49')]['name']);}return db[_0x1256('0x2e')][_0x1256('0x4b')](_0x40eb38[_0x1256('0x49')],{'transaction':_0x2b6009})[_0x1256('0x23')](function(_0xe29086){if(_0x40eb38[_0x1256('0x49')][_0x1256('0x4d')]===_0x1256('0x4e')){fs[_0x1256('0x53')](_0xe29086[_0x1256('0x4f')],parseInt(_0x1256('0x54'),0x8));}var _0x27d76=_0x40eb38[_0x1256('0x55')]['get']({'plain':!![]});if(!_0x27d76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d76[_0x1256('0x56')]==='user'){var _0x155934=_0xe29086[_0x1256('0x25')]({'plain':!![]});return db[_0x1256('0x57')][_0x1256('0x48')]({'where':{'name':_0x1256('0x26'),'userProfileId':_0x27d76[_0x1256('0x58')]},'raw':!![]})[_0x1256('0x23')](function(_0x52578b){if(_0x52578b&&_0x52578b[_0x1256('0x59')]===0x0){return db[_0x1256('0x27')][_0x1256('0x4b')]({'name':_0x155934[_0x1256('0x2a')],'resourceId':_0x155934['id'],'type':_0x52578b[_0x1256('0x2a')],'sectionId':_0x52578b['id']},{})['then'](function(){return _0xe29086;});}else{return _0xe29086;}})['catch'](function(_0x6c0b00){logger[_0x1256('0x28')](_0x1256('0x5a'),_0x6c0b00);});}return _0xe29086;});})[_0x1256('0x23')](respondWithResult(_0x279503,0xc9))[_0x1256('0x44')](handleError(_0x279503,null));};exports['destroy']=function(_0x29a335,_0x623f38,_0x1fe005){var _0x4c72c6;return db[_0x1256('0x2e')]['find']({'where':{'id':_0x29a335[_0x1256('0x4a')]['id']}})['then'](function(_0x34a32a){if(_0x34a32a){return db[_0x1256('0x5b')][_0x1256('0x4c')](function(_0x30f5e4){return _0x34a32a[_0x1256('0x24')]({'transaction':_0x30f5e4,'raw':!![]})[_0x1256('0x23')](function(_0x170f06){if(_0x170f06[_0x1256('0x4f')]){fs[_0x1256('0x5c')](_0x170f06['directory'])[_0x1256('0x5d')](function(_0x41a3ce){fs['unlinkSync'](path[_0x1256('0x50')](_0x170f06[_0x1256('0x4f')],_0x41a3ce));});fs['rmdirSync'](_0x170f06['directory']);}return _0x170f06;});})['catch'](function(_0x23893f){throw new db['Sequelize'][(_0x1256('0x5e'))](_0x23893f[_0x1256('0x5f')]);});}})[_0x1256('0x23')](handleEntityNotFound(_0x623f38,null))[_0x1256('0x23')](removeEntity(_0x623f38,null))[_0x1256('0x44')](handleError(_0x623f38,null));};exports[_0x1256('0x60')]=function(_0xc5515c,_0xfef8a6,_0x36971e){return db['sequelize']['transaction'](function(_0x4b05ca){var _0x4e3a0f;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xc5515c[_0x1256('0x4a')]['id']}})[_0x1256('0x23')](function(_0x587da2){if(_0x587da2){_0x4e3a0f=_0x587da2;return _0x587da2[_0x1256('0x60')](_0xc5515c[_0x1256('0x49')]['id'],{'transaction':_0x4b05ca});}})[_0x1256('0x23')](function(_0x93d842){if(_0x93d842){return db[_0x1256('0x61')]['findOne']({'where':{'id':_0xc5515c['body']['id']},'attributes':['id',_0x1256('0x2a'),_0x1256('0x62'),'converted_format',_0x1256('0x63')],'raw':!![]});}})['then'](function(_0x44f6e4){if(_0x44f6e4){var _0x48195b=path[_0x1256('0x50')](config['root'],'server/files/sounds/converted',util[_0x1256('0x64')](_0x1256('0x65'),path[_0x1256('0x66')](_0x44f6e4[_0x1256('0x62')],path[_0x1256('0x67')](_0x44f6e4[_0x1256('0x62')])),_0x44f6e4[_0x1256('0x68')]));var _0x1ee8e0=path['join'](config[_0x1256('0x51')],'server/files/moh',_0x4e3a0f[_0x1256('0x2a')],util[_0x1256('0x64')](_0x1256('0x65'),_0x44f6e4[_0x1256('0x2a')],_0x44f6e4['converted_format']));fs[_0x1256('0x69')](_0x48195b,_0x1ee8e0);return _0x44f6e4;}})['catch'](function(_0x42dc68){throw new db[(_0x1256('0x6a'))]['ValidationError'](_0x42dc68[_0x1256('0x5f')]);});})[_0x1256('0x23')](handleEntityNotFound(_0xfef8a6,null))[_0x1256('0x23')](respondWithResult(_0xfef8a6,0xc9))[_0x1256('0x44')](handleError(_0xfef8a6,null));};exports['removeSound']=function(_0x49ed55,_0x45af7c,_0x1468d8){return db[_0x1256('0x5b')][_0x1256('0x4c')](function(_0x5c6c1e){var _0x58fc6d;return db[_0x1256('0x2e')][_0x1256('0x6b')]({'where':{'id':_0x49ed55[_0x1256('0x4a')]['id']}})[_0x1256('0x23')](handleEntityNotFound(_0x45af7c,null))[_0x1256('0x23')](function(_0x30bbda){if(_0x30bbda){_0x58fc6d=_0x30bbda;return _0x30bbda[_0x1256('0x6c')](_0x49ed55['params']['id2']);}})['then'](function(_0x3f52ec){if(_0x3f52ec){return db['Sound'][_0x1256('0x6b')]({'where':{'id':_0x49ed55['params']['id2']},'attributes':['id',_0x1256('0x2a'),'save_name',_0x1256('0x68'),_0x1256('0x63')],'raw':!![]});}})['then'](function(_0x541d90){if(_0x541d90){fs['unlinkSync'](path[_0x1256('0x50')](_0x58fc6d[_0x1256('0x4f')],util['format'](_0x1256('0x65'),_0x541d90[_0x1256('0x2a')],_0x541d90[_0x1256('0x68')])));return _0x541d90;}})[_0x1256('0x44')](function(_0x2c4e62){throw new db[(_0x1256('0x6a'))][(_0x1256('0x5e'))](_0x2c4e62['message']);});})[_0x1256('0x23')](handleEntityNotFound(_0x45af7c,null))[_0x1256('0x23')](respondWithStatusCode(_0x45af7c,0xcc))[_0x1256('0x44')](handleError(_0x45af7c,null));};exports[_0x1256('0x6d')]=function(_0x24e979,_0x3e1ca0,_0x45623e){var _0x182af0={};var _0x28fe83={};var _0x3c7154;var _0x542b61;return db[_0x1256('0x2e')][_0x1256('0x6b')]({'where':{'id':_0x24e979[_0x1256('0x4a')]['id']}})[_0x1256('0x23')](handleEntityNotFound(_0x3e1ca0,null))['then'](function(_0x1e6d51){if(_0x1e6d51){_0x3c7154=_0x1e6d51;_0x28fe83[_0x1256('0x32')]=_[_0x1256('0x34')](db['Sound'][_0x1256('0x46')]);_0x28fe83[_0x1256('0x33')]=_['keys'](_0x24e979[_0x1256('0x33')]);_0x28fe83[_0x1256('0x3c')]=_['intersection'](_0x28fe83['model'],_0x28fe83[_0x1256('0x33')]);_0x182af0[_0x1256('0x36')]=_[_0x1256('0x35')](_0x28fe83['model'],qs[_0x1256('0x37')](_0x24e979[_0x1256('0x33')]['fields']));_0x182af0[_0x1256('0x36')]=_0x182af0[_0x1256('0x36')][_0x1256('0x6e')]?_0x182af0['attributes']:_0x28fe83['model'];_0x182af0[_0x1256('0x6f')]=qs[_0x1256('0x39')](_0x24e979[_0x1256('0x33')][_0x1256('0x39')]);_0x182af0[_0x1256('0x3a')]=qs[_0x1256('0x3c')](_[_0x1256('0x3b')](_0x24e979[_0x1256('0x33')],_0x28fe83[_0x1256('0x3c')]));if(_0x24e979[_0x1256('0x33')]['filter']){_0x182af0[_0x1256('0x3a')]=_['merge'](_0x182af0[_0x1256('0x3a')],{'$or':_[_0x1256('0x2d')](_0x182af0[_0x1256('0x36')],function(_0x2d2383){var _0x3c349d={};_0x3c349d[_0x2d2383]={'$like':'%'+_0x24e979[_0x1256('0x33')]['filter']+'%'};return _0x3c349d;})});}_0x182af0=_['merge']({},_0x182af0,_0x24e979[_0x1256('0x47')]);return _0x3c7154['getSounds'](_0x182af0);}})[_0x1256('0x23')](function(_0x29311f){if(_0x29311f){_0x542b61=_0x29311f[_0x1256('0x6e')];if(!_0x24e979[_0x1256('0x33')]['hasOwnProperty'](_0x1256('0x70'))){_0x182af0[_0x1256('0x1b')]=qs[_0x1256('0x1b')](_0x24e979['query'][_0x1256('0x1b')]);_0x182af0[_0x1256('0x1a')]=qs[_0x1256('0x1a')](_0x24e979[_0x1256('0x33')][_0x1256('0x1a')]);}return _0x3c7154['getSounds'](_0x182af0);}})[_0x1256('0x23')](function(_0xc66651){if(_0xc66651){return _0xc66651?{'count':_0x542b61,'rows':_0xc66651}:null;}})['then'](respondWithResult(_0x3e1ca0,null))[_0x1256('0x44')](handleError(_0x3e1ca0,null));}; \ No newline at end of file +var _0xe50b=['Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','findOne','removeSound','id2','getSounds','order','options','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','update','then','destroy','get','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound'];(function(_0x4d453c,_0x311b8c){var _0x4c80ac=function(_0x5548c0){while(--_0x5548c0){_0x4d453c['push'](_0x4d453c['shift']());}};_0x4c80ac(++_0x311b8c);}(_0xe50b,0x7e));var _0xbe50=function(_0x20a1a0,_0x2cd01f){_0x20a1a0=_0x20a1a0-0x0;var _0x151152=_0xe50b[_0x20a1a0];return _0x151152;};'use strict';var emlformat=require(_0xbe50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe50('0x1'));var jsonpatch=require(_0xbe50('0x2'));var rp=require(_0xbe50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe50('0x4'));var util=require(_0xbe50('0x5'));var path=require(_0xbe50('0x6'));var sox=require(_0xbe50('0x7'));var csv=require(_0xbe50('0x8'));var ejs=require(_0xbe50('0x9'));var fs=require('fs');var fs_extra=require(_0xbe50('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe50('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbe50('0xc'));var toCsv=require(_0xbe50('0x8'));var querystring=require(_0xbe50('0xd'));var Papa=require(_0xbe50('0xe'));var Redis=require(_0xbe50('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe50('0x10'));var as=require(_0xbe50('0x11'));var hardwareService=require(_0xbe50('0x12'));var logger=require(_0xbe50('0x13'))('api');var utils=require(_0xbe50('0x14'));var config=require(_0xbe50('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe50('0x16'))['db'];function respondWithStatusCode(_0x516ee8,_0x2be374){_0x2be374=_0x2be374||0xcc;return function(_0x5cbe4a){if(_0x5cbe4a){return _0x516ee8[_0xbe50('0x17')](_0x2be374);}return _0x516ee8['status'](_0x2be374)[_0xbe50('0x18')]();};}function respondWithResult(_0x1e89d3,_0xc989a4){_0xc989a4=_0xc989a4||0xc8;return function(_0x2a1be){if(_0x2a1be){return _0x1e89d3[_0xbe50('0x19')](_0xc989a4)[_0xbe50('0x1a')](_0x2a1be);}};}function respondWithFilteredResult(_0xa96f3a,_0x1f297f){return function(_0x59349d){if(_0x59349d){var _0x1bdbda=typeof _0x1f297f[_0xbe50('0x1b')]===_0xbe50('0x1c')&&typeof _0x1f297f[_0xbe50('0x1d')]===_0xbe50('0x1c');var _0x3ad7ea=_0x59349d[_0xbe50('0x1e')];var _0x3f7749=_0x1bdbda?0x0:_0x1f297f[_0xbe50('0x1b')];var _0x19530a=_0x1bdbda?_0x59349d[_0xbe50('0x1e')]:_0x1f297f[_0xbe50('0x1b')]+_0x1f297f['limit'];var _0x2c9e1a;if(_0x19530a>=_0x3ad7ea){_0x19530a=_0x3ad7ea;_0x2c9e1a=0xc8;}else{_0x2c9e1a=0xce;}_0xa96f3a[_0xbe50('0x19')](_0x2c9e1a);return _0xa96f3a['set'](_0xbe50('0x1f'),_0x3f7749+'-'+_0x19530a+'/'+_0x3ad7ea)[_0xbe50('0x1a')](_0x59349d);}return null;};}function patchUpdates(_0x1b522c){return function(_0x8ac7a){try{jsonpatch[_0xbe50('0x20')](_0x8ac7a,_0x1b522c,!![]);}catch(_0x32bad2){return BPromise[_0xbe50('0x21')](_0x32bad2);}return _0x8ac7a['save']();};}function saveUpdates(_0x53be79,_0x53c486){return function(_0x7289f1){if(_0x7289f1){return _0x7289f1[_0xbe50('0x22')](_0x53be79)[_0xbe50('0x23')](function(_0x116d06){return _0x116d06;});}return null;};}function removeEntity(_0x116d11,_0x17be4f){return function(_0x2eaf38){if(_0x2eaf38){return _0x2eaf38[_0xbe50('0x24')]()[_0xbe50('0x23')](function(){var _0x4425d9=_0x2eaf38[_0xbe50('0x25')]({'plain':!![]});var _0x15ebec='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0x15ebec,'resourceId':_0x4425d9['id']}})[_0xbe50('0x23')](function(){return _0x2eaf38;});})[_0xbe50('0x23')](function(){_0x116d11[_0xbe50('0x19')](0xcc)[_0xbe50('0x18')]();});}};}function handleEntityNotFound(_0x29e21a,_0x484aba){return function(_0x35987c){if(!_0x35987c){_0x29e21a[_0xbe50('0x17')](0x194);}return _0x35987c;};}function handleError(_0x195337,_0x4c7a6c){_0x4c7a6c=_0x4c7a6c||0x1f4;return function(_0x35d647){logger[_0xbe50('0x26')](_0x35d647[_0xbe50('0x27')]);if(_0x35d647['name']){delete _0x35d647[_0xbe50('0x28')];}_0x195337[_0xbe50('0x19')](_0x4c7a6c)[_0xbe50('0x29')](_0x35d647);};}exports[_0xbe50('0x2a')]=function(_0x156432,_0x13a394){var _0x29075c={},_0xf135e8={},_0x108e0e={'count':0x0,'rows':[]};var _0x1a97f9=_[_0xbe50('0x2b')](db[_0xbe50('0x2c')][_0xbe50('0x2d')],function(_0x105fb6){return{'name':_0x105fb6[_0xbe50('0x2e')],'type':_0x105fb6[_0xbe50('0x2f')]['key']};});_0xf135e8[_0xbe50('0x30')]=_['map'](_0x1a97f9,'name');_0xf135e8[_0xbe50('0x31')]=_[_0xbe50('0x32')](_0x156432[_0xbe50('0x31')]);_0xf135e8['filters']=_[_0xbe50('0x33')](_0xf135e8[_0xbe50('0x30')],_0xf135e8[_0xbe50('0x31')]);_0x29075c[_0xbe50('0x34')]=_['intersection'](_0xf135e8[_0xbe50('0x30')],qs[_0xbe50('0x35')](_0x156432[_0xbe50('0x31')][_0xbe50('0x35')]));_0x29075c[_0xbe50('0x34')]=_0x29075c['attributes'][_0xbe50('0x36')]?_0x29075c[_0xbe50('0x34')]:_0xf135e8[_0xbe50('0x30')];if(!_0x156432[_0xbe50('0x31')][_0xbe50('0x37')](_0xbe50('0x38'))){_0x29075c[_0xbe50('0x1d')]=qs['limit'](_0x156432['query'][_0xbe50('0x1d')]);_0x29075c[_0xbe50('0x1b')]=qs[_0xbe50('0x1b')](_0x156432[_0xbe50('0x31')][_0xbe50('0x1b')]);}_0x29075c['order']=qs[_0xbe50('0x39')](_0x156432[_0xbe50('0x31')][_0xbe50('0x39')]);delete _0x156432[_0xbe50('0x31')][_0xbe50('0x39')];_0x29075c[_0xbe50('0x3a')]=qs[_0xbe50('0x3b')](_[_0xbe50('0x3c')](_0x156432[_0xbe50('0x31')],_0xf135e8[_0xbe50('0x3b')]),_0x1a97f9);if(_0x156432[_0xbe50('0x31')][_0xbe50('0x3d')]){_0x29075c[_0xbe50('0x3a')]=_[_0xbe50('0x3e')](_0x29075c[_0xbe50('0x3a')],{'$or':_[_0xbe50('0x2b')](_0x1a97f9,function(_0x3cf0e4){if(_0x3cf0e4[_0xbe50('0x2f')]!==_0xbe50('0x3f')){var _0x58eb74={};_0x58eb74[_0x3cf0e4[_0xbe50('0x28')]]={'$like':'%'+_0x156432['query']['filter']+'%'};return _0x58eb74;}})});}_0x29075c=_[_0xbe50('0x3e')]({},_0x29075c,_0x156432['options']);var _0x31fa5b={'where':_0x29075c[_0xbe50('0x3a')]};return db[_0xbe50('0x2c')]['count'](_0x31fa5b)[_0xbe50('0x23')](function(_0x57b1ce){_0x108e0e[_0xbe50('0x1e')]=_0x57b1ce;if(_0x156432['query'][_0xbe50('0x40')]){_0x29075c[_0xbe50('0x41')]=[{'all':!![]}];}return db[_0xbe50('0x2c')][_0xbe50('0x42')](_0x29075c);})['then'](function(_0xd2fc97){_0x108e0e[_0xbe50('0x43')]=_0xd2fc97;return _0x108e0e;})[_0xbe50('0x23')](respondWithFilteredResult(_0x13a394,_0x29075c))[_0xbe50('0x44')](handleError(_0x13a394,null));};exports[_0xbe50('0x45')]=function(_0x4b8028,_0x7a7344){var _0x2489db={'raw':![],'where':{'id':_0x4b8028[_0xbe50('0x46')]['id']}},_0x4bb839={};_0x4bb839['model']=_[_0xbe50('0x32')](db['VoiceMusicOnHold'][_0xbe50('0x2d')]);_0x4bb839[_0xbe50('0x31')]=_[_0xbe50('0x32')](_0x4b8028[_0xbe50('0x31')]);_0x4bb839[_0xbe50('0x3b')]=_['intersection'](_0x4bb839[_0xbe50('0x30')],_0x4bb839[_0xbe50('0x31')]);_0x2489db[_0xbe50('0x34')]=_['intersection'](_0x4bb839[_0xbe50('0x30')],qs[_0xbe50('0x35')](_0x4b8028[_0xbe50('0x31')][_0xbe50('0x35')]));_0x2489db['attributes']=_0x2489db[_0xbe50('0x34')][_0xbe50('0x36')]?_0x2489db['attributes']:_0x4bb839['model'];if(_0x4b8028[_0xbe50('0x31')][_0xbe50('0x40')]){_0x2489db['include']=[{'all':!![]}];}_0x2489db=_['merge']({},_0x2489db,_0x4b8028['options']);return db[_0xbe50('0x2c')]['find'](_0x2489db)[_0xbe50('0x23')](handleEntityNotFound(_0x7a7344,null))[_0xbe50('0x23')](respondWithResult(_0x7a7344,null))[_0xbe50('0x44')](handleError(_0x7a7344,null));};exports['update']=function(_0x3bdd5f,_0x1b1e78){if(_0x3bdd5f['body']['id']){delete _0x3bdd5f['body']['id'];}return db[_0xbe50('0x2c')][_0xbe50('0x47')]({'where':{'id':_0x3bdd5f[_0xbe50('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1e78,null))['then'](saveUpdates(_0x3bdd5f[_0xbe50('0x48')],null))[_0xbe50('0x23')](respondWithResult(_0x1b1e78,null))[_0xbe50('0x44')](handleError(_0x1b1e78,null));};exports[_0xbe50('0x49')]=function(_0x3db34a,_0x377fc7,_0x2a9029){return db['sequelize'][_0xbe50('0x4a')](function(_0x2fe45e){if(_0x3db34a['body'][_0xbe50('0x4b')]===_0xbe50('0x4c')){_0x3db34a[_0xbe50('0x48')][_0xbe50('0x4d')]=path[_0xbe50('0x4e')](config[_0xbe50('0x4f')],_0xbe50('0x50'),_0x3db34a[_0xbe50('0x48')][_0xbe50('0x28')]);}return db[_0xbe50('0x2c')][_0xbe50('0x49')](_0x3db34a[_0xbe50('0x48')],{'transaction':_0x2fe45e})[_0xbe50('0x23')](function(_0xc73df0){if(_0x3db34a['body']['mode']==='files'){fs['mkdirSync'](_0xc73df0['directory'],parseInt(_0xbe50('0x51'),0x8));}var _0x3a1b98=_0x3db34a[_0xbe50('0x52')][_0xbe50('0x25')]({'plain':!![]});if(!_0x3a1b98)throw new Error(_0xbe50('0x53'));if(_0x3a1b98[_0xbe50('0x54')]===_0xbe50('0x52')){var _0xf511da=_0xc73df0[_0xbe50('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xbe50('0x47')]({'where':{'name':_0xbe50('0x55'),'userProfileId':_0x3a1b98[_0xbe50('0x56')]},'raw':!![]})[_0xbe50('0x23')](function(_0x1d83e0){if(_0x1d83e0&&_0x1d83e0[_0xbe50('0x57')]===0x0){return db['UserProfileResource'][_0xbe50('0x49')]({'name':_0xf511da['name'],'resourceId':_0xf511da['id'],'type':_0x1d83e0[_0xbe50('0x28')],'sectionId':_0x1d83e0['id']},{})[_0xbe50('0x23')](function(){return _0xc73df0;});}else{return _0xc73df0;}})[_0xbe50('0x44')](function(_0x4d4cf7){logger[_0xbe50('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d4cf7);});}return _0xc73df0;});})['then'](respondWithResult(_0x377fc7,0xc9))[_0xbe50('0x44')](handleError(_0x377fc7,null));};exports[_0xbe50('0x24')]=function(_0x5d6a9b,_0x1d6b26,_0x47f136){var _0x5c5e79;return db['VoiceMusicOnHold'][_0xbe50('0x47')]({'where':{'id':_0x5d6a9b['params']['id']}})[_0xbe50('0x23')](function(_0x1d69f3){if(_0x1d69f3){return db[_0xbe50('0x58')][_0xbe50('0x4a')](function(_0x3e9e3a){return _0x1d69f3['destroy']({'transaction':_0x3e9e3a,'raw':!![]})[_0xbe50('0x23')](function(_0x46f403){if(_0x46f403['directory']){fs[_0xbe50('0x59')](_0x46f403['directory'])[_0xbe50('0x5a')](function(_0x38f1b9){fs[_0xbe50('0x5b')](path[_0xbe50('0x4e')](_0x46f403[_0xbe50('0x4d')],_0x38f1b9));});fs['rmdirSync'](_0x46f403['directory']);}return _0x46f403;});})[_0xbe50('0x44')](function(_0x298466){throw new db[(_0xbe50('0x5c'))][(_0xbe50('0x5d'))](_0x298466[_0xbe50('0x5e')]);});}})[_0xbe50('0x23')](handleEntityNotFound(_0x1d6b26,null))['then'](removeEntity(_0x1d6b26,null))[_0xbe50('0x44')](handleError(_0x1d6b26,null));};exports['addSound']=function(_0x1ab055,_0x2fef9f,_0xa2dab){return db['sequelize']['transaction'](function(_0x259985){var _0x54baeb;return db[_0xbe50('0x2c')]['find']({'where':{'id':_0x1ab055[_0xbe50('0x46')]['id']}})[_0xbe50('0x23')](function(_0x41fd33){if(_0x41fd33){_0x54baeb=_0x41fd33;return _0x41fd33[_0xbe50('0x5f')](_0x1ab055[_0xbe50('0x48')]['id'],{'transaction':_0x259985});}})['then'](function(_0xbcd950){if(_0xbcd950){return db[_0xbe50('0x60')]['findOne']({'where':{'id':_0x1ab055[_0xbe50('0x48')]['id']},'attributes':['id',_0xbe50('0x28'),'save_name',_0xbe50('0x61'),_0xbe50('0x62')],'raw':!![]});}})[_0xbe50('0x23')](function(_0x42d956){if(_0x42d956){var _0x10f028=path[_0xbe50('0x4e')](config[_0xbe50('0x4f')],_0xbe50('0x63'),util[_0xbe50('0x64')](_0xbe50('0x65'),path['basename'](_0x42d956[_0xbe50('0x66')],path[_0xbe50('0x67')](_0x42d956[_0xbe50('0x66')])),_0x42d956[_0xbe50('0x61')]));var _0x273dc9=path[_0xbe50('0x4e')](config['root'],_0xbe50('0x50'),_0x54baeb[_0xbe50('0x28')],util[_0xbe50('0x64')](_0xbe50('0x65'),_0x42d956[_0xbe50('0x28')],_0x42d956[_0xbe50('0x61')]));fs[_0xbe50('0x68')](_0x10f028,_0x273dc9);return _0x42d956;}})[_0xbe50('0x44')](function(_0xa35ec6){throw new db['Sequelize'][(_0xbe50('0x5d'))](_0xa35ec6['message']);});})['then'](handleEntityNotFound(_0x2fef9f,null))[_0xbe50('0x23')](respondWithResult(_0x2fef9f,0xc9))[_0xbe50('0x44')](handleError(_0x2fef9f,null));};exports['removeSound']=function(_0x1407a6,_0x3fe095,_0x523491){return db['sequelize'][_0xbe50('0x4a')](function(_0x2b7b02){var _0x780079;return db['VoiceMusicOnHold'][_0xbe50('0x69')]({'where':{'id':_0x1407a6[_0xbe50('0x46')]['id']}})[_0xbe50('0x23')](handleEntityNotFound(_0x3fe095,null))[_0xbe50('0x23')](function(_0x1995ef){if(_0x1995ef){_0x780079=_0x1995ef;return _0x1995ef[_0xbe50('0x6a')](_0x1407a6[_0xbe50('0x46')][_0xbe50('0x6b')]);}})['then'](function(_0x3e6cb2){if(_0x3e6cb2){return db[_0xbe50('0x60')][_0xbe50('0x69')]({'where':{'id':_0x1407a6[_0xbe50('0x46')][_0xbe50('0x6b')]},'attributes':['id',_0xbe50('0x28'),_0xbe50('0x66'),_0xbe50('0x61'),_0xbe50('0x62')],'raw':!![]});}})['then'](function(_0x5d469a){if(_0x5d469a){fs[_0xbe50('0x5b')](path[_0xbe50('0x4e')](_0x780079[_0xbe50('0x4d')],util[_0xbe50('0x64')](_0xbe50('0x65'),_0x5d469a['name'],_0x5d469a[_0xbe50('0x61')])));return _0x5d469a;}})['catch'](function(_0x14f946){throw new db[(_0xbe50('0x5c'))]['ValidationError'](_0x14f946[_0xbe50('0x5e')]);});})[_0xbe50('0x23')](handleEntityNotFound(_0x3fe095,null))['then'](respondWithStatusCode(_0x3fe095,0xcc))['catch'](handleError(_0x3fe095,null));};exports[_0xbe50('0x6c')]=function(_0x32e1ca,_0x4a96fd,_0x42a311){var _0x55d56a={};var _0x3c9815={};var _0x4f7067;var _0x14f3b1;return db['VoiceMusicOnHold'][_0xbe50('0x69')]({'where':{'id':_0x32e1ca[_0xbe50('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a96fd,null))[_0xbe50('0x23')](function(_0x42d95c){if(_0x42d95c){_0x4f7067=_0x42d95c;_0x3c9815[_0xbe50('0x30')]=_[_0xbe50('0x32')](db[_0xbe50('0x60')][_0xbe50('0x2d')]);_0x3c9815[_0xbe50('0x31')]=_[_0xbe50('0x32')](_0x32e1ca[_0xbe50('0x31')]);_0x3c9815[_0xbe50('0x3b')]=_['intersection'](_0x3c9815[_0xbe50('0x30')],_0x3c9815['query']);_0x55d56a[_0xbe50('0x34')]=_[_0xbe50('0x33')](_0x3c9815[_0xbe50('0x30')],qs[_0xbe50('0x35')](_0x32e1ca[_0xbe50('0x31')]['fields']));_0x55d56a[_0xbe50('0x34')]=_0x55d56a['attributes'][_0xbe50('0x36')]?_0x55d56a['attributes']:_0x3c9815[_0xbe50('0x30')];_0x55d56a[_0xbe50('0x6d')]=qs['sort'](_0x32e1ca['query'][_0xbe50('0x39')]);_0x55d56a[_0xbe50('0x3a')]=qs[_0xbe50('0x3b')](_['pick'](_0x32e1ca['query'],_0x3c9815[_0xbe50('0x3b')]));if(_0x32e1ca[_0xbe50('0x31')][_0xbe50('0x3d')]){_0x55d56a['where']=_[_0xbe50('0x3e')](_0x55d56a['where'],{'$or':_[_0xbe50('0x2b')](_0x55d56a[_0xbe50('0x34')],function(_0x5b58fe){var _0x131d89={};_0x131d89[_0x5b58fe]={'$like':'%'+_0x32e1ca[_0xbe50('0x31')]['filter']+'%'};return _0x131d89;})});}_0x55d56a=_['merge']({},_0x55d56a,_0x32e1ca[_0xbe50('0x6e')]);return _0x4f7067['getSounds'](_0x55d56a);}})[_0xbe50('0x23')](function(_0x655264){if(_0x655264){_0x14f3b1=_0x655264['length'];if(!_0x32e1ca[_0xbe50('0x31')][_0xbe50('0x37')](_0xbe50('0x38'))){_0x55d56a['limit']=qs[_0xbe50('0x1d')](_0x32e1ca[_0xbe50('0x31')][_0xbe50('0x1d')]);_0x55d56a['offset']=qs[_0xbe50('0x1b')](_0x32e1ca['query'][_0xbe50('0x1b')]);}return _0x4f7067[_0xbe50('0x6c')](_0x55d56a);}})[_0xbe50('0x23')](function(_0x4adbff){if(_0x4adbff){return _0x4adbff?{'count':_0x14f3b1,'rows':_0x4adbff}:null;}})[_0xbe50('0x23')](respondWithResult(_0x4a96fd,null))[_0xbe50('0x44')](handleError(_0x4a96fd,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bd5298d..c60d795 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 _0xe500=['request-promise','rimraf','../../config/environment','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment'];(function(_0x3cbda0,_0x289456){var _0x36acb2=function(_0x1181c1){while(--_0x1181c1){_0x3cbda0['push'](_0x3cbda0['shift']());}};_0x36acb2(++_0x289456);}(_0xe500,0x67));var _0x0e50=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0xe500[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require(_0x0e50('0x0'));var util=require(_0x0e50('0x1'));var logger=require(_0x0e50('0x2'))(_0x0e50('0x3'));var moment=require(_0x0e50('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e50('0x6'));var config=require(_0x0e50('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x2f60ab,_0x245dfb){return _0x2f60ab['define'](_0x0e50('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f5=['VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','bluebird','path','exports'];(function(_0x23bd73,_0x4c1e6d){var _0x29ed07=function(_0x5e6c8e){while(--_0x5e6c8e){_0x23bd73['push'](_0x23bd73['shift']());}};_0x29ed07(++_0x4c1e6d);}(_0xf4f5,0xc6));var _0x5f4f=function(_0x5762e0,_0x3048a6){_0x5762e0=_0x5762e0-0x0;var _0x1d0a4d=_0xf4f5[_0x5762e0];return _0x1d0a4d;};'use strict';var _=require(_0x5f4f('0x0'));var util=require('util');var logger=require(_0x5f4f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5f4f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f4f('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x5f4f('0x4')]=function(_0x2a2d4a,_0x3dedae){return _0x2a2d4a['define'](_0x5f4f('0x5'),attributes,{'tableName':_0x5f4f('0x6'),'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 7214181..fc95884 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(_0x2b478c,_0xf4a488){var _0x54187c=function(_0x44ecc6){while(--_0x44ecc6){_0x2b478c['push'](_0x2b478c['shift']());}};_0x54187c(++_0xf4a488);}(_0xedd9,0xfc));var _0x9edd=function(_0x490a99,_0x385d34){_0x490a99=_0x490a99-0x0;var _0x5b6a4e=_0xedd9[_0x490a99];return _0x5b6a4e;};'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(_0x463e4a,_0x4e26fe){var _0xa00024=function(_0x3458bd){while(--_0x3458bd){_0x463e4a['push'](_0x463e4a['shift']());}};_0xa00024(++_0x4e26fe);}(_0x70e0,0x17b));var _0x070e=function(_0x1e4244,_0x2dcbab){_0x1e4244=_0x1e4244-0x0;var _0x54442c=_0x70e0[_0x1e4244];return _0x54442c;};'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 b6f9af5..b67534f 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 _0xd846=['Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getTeams','post','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0xd846,0x195));var _0x6d84=function(_0x2f63fe,_0x1b5a27){_0x2f63fe=_0x2f63fe-0x0;var _0x6613f9=_0xd846[_0x2f63fe];return _0x6613f9;};'use strict';var multer=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var path=require(_0x6d84('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d84('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d84('0x4'));var config=require(_0x6d84('0x5'));var controller=require('./voicePrefix.controller');router[_0x6d84('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d84('0x6')](_0x6d84('0x7'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x9')]);router[_0x6d84('0x6')](_0x6d84('0xa'),auth[_0x6d84('0x8')](),controller[_0x6d84('0xb')]);router[_0x6d84('0x6')](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller['getAgents']);router[_0x6d84('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6d84('0xd')]);router[_0x6d84('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6d84('0xe')](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller[_0x6d84('0xf')]);router[_0x6d84('0xe')](_0x6d84('0x10'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x11')]);router[_0x6d84('0x12')](_0x6d84('0xa'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x13')]);router[_0x6d84('0x14')]('/:id',auth[_0x6d84('0x8')](),controller[_0x6d84('0x15')]);router['delete'](_0x6d84('0xc'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x16')]);router[_0x6d84('0x14')](_0x6d84('0x10'),auth[_0x6d84('0x8')](),controller[_0x6d84('0x17')]);module['exports']=router; \ No newline at end of file +var _0x294b=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','post','create','/:id/users','put','/:id'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb294('0x0'));var util=require('util');var path=require(_0xb294('0x1'));var timeout=require(_0xb294('0x2'));var express=require(_0xb294('0x3'));var router=express[_0xb294('0x4')]();var fs_extra=require(_0xb294('0x5'));var auth=require(_0xb294('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb294('0x7'));router[_0xb294('0x8')]('/',auth[_0xb294('0x9')](),controller[_0xb294('0xa')]);router[_0xb294('0x8')]('/describe',auth[_0xb294('0x9')](),controller['describe']);router['get']('/:id',auth[_0xb294('0x9')](),controller[_0xb294('0xb')]);router[_0xb294('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xb294('0x8')](_0xb294('0xc'),auth[_0xb294('0x9')](),controller[_0xb294('0xd')]);router[_0xb294('0xe')]('/',auth[_0xb294('0x9')](),controller[_0xb294('0xf')]);router[_0xb294('0xe')](_0xb294('0x10'),auth[_0xb294('0x9')](),controller['addAgents']);router['post'](_0xb294('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0xb294('0x11')](_0xb294('0x12'),auth[_0xb294('0x9')](),controller[_0xb294('0x13')]);router[_0xb294('0x14')](_0xb294('0x12'),auth[_0xb294('0x9')](),controller[_0xb294('0x15')]);router[_0xb294('0x14')](_0xb294('0x10'),auth[_0xb294('0x9')](),controller['removeAgents']);router[_0xb294('0x14')](_0xb294('0xc'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xb294('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 07f2e8d..5158eca 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 _0x078e=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x28a940,_0x2e1581){var _0x4f7d3e=function(_0x1c13ee){while(--_0x1c13ee){_0x28a940['push'](_0x28a940['shift']());}};_0x4f7d3e(++_0x2e1581);}(_0x078e,0x182));var _0xe078=function(_0x38a651,_0x1698c2){_0x38a651=_0x38a651-0x0;var _0x1c2095=_0x078e[_0x38a651];return _0x1c2095;};'use strict';var Sequelize=require(_0xe078('0x0'));module[_0xe078('0x1')]={'name':{'type':Sequelize[_0xe078('0x2')],'allowNull':![],'unique':_0xe078('0x3')},'prefix':{'type':Sequelize[_0xe078('0x4')],'get':function(_0xdf35a9){return _0xe078('0x5')+this[_0xe078('0x6')](_0xe078('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe078('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe078('0x7')]}}; \ No newline at end of file +var _0x4132=['system-','getDataValue','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x5eb842,_0x1dde37){var _0x3a1402=function(_0x52e6e4){while(--_0x52e6e4){_0x5eb842['push'](_0x5eb842['shift']());}};_0x3a1402(++_0x1dde37);}(_0x4132,0x1d0));var _0x2413=function(_0x49858f,_0x37171f){_0x49858f=_0x49858f-0x0;var _0x34539a=_0x4132[_0x49858f];return _0x34539a;};'use strict';var Sequelize=require(_0x2413('0x0'));module[_0x2413('0x1')]={'name':{'type':Sequelize[_0x2413('0x2')],'allowNull':![],'unique':_0x2413('0x3')},'prefix':{'type':Sequelize[_0x2413('0x4')],'get':function(_0x2c5b50){return _0x2413('0x5')+this[_0x2413('0x6')](_0x2413('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2413('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9cdecbd..17fb65d 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 _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','describe','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','create','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','charAt','system-','transaction','addAgents','ids','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','addTeams','findAll','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','Team','select','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x26ca1f,_0x4cbdd6){var _0x34c6e7=function(_0x5171ed){while(--_0x5171ed){_0x26ca1f['push'](_0x26ca1f['shift']());}};_0x34c6e7(++_0x4cbdd6);}(_0x14a0,0x8e));var _0x014a=function(_0x4ac11c,_0x3446ca){_0x4ac11c=_0x4ac11c-0x0;var _0x453f36=_0x14a0[_0x4ac11c];return _0x453f36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);function respondWithStatusCode(_0x3c54c8,_0x4fe87c){_0x4fe87c=_0x4fe87c||0xcc;return function(_0x130d13){if(_0x130d13){return _0x3c54c8[_0x014a('0x1a')](_0x4fe87c);}return _0x3c54c8['status'](_0x4fe87c)[_0x014a('0x1b')]();};}function respondWithResult(_0x128c46,_0x59a4ea){_0x59a4ea=_0x59a4ea||0xc8;return function(_0x16e6fc){if(_0x16e6fc){return _0x128c46[_0x014a('0x1c')](_0x59a4ea)[_0x014a('0x1d')](_0x16e6fc);}};}function respondWithFilteredResult(_0x12da95,_0x2c26ac){return function(_0x12d339){if(_0x12d339){var _0x61ec9f=typeof _0x2c26ac[_0x014a('0x1e')]===_0x014a('0x1f')&&typeof _0x2c26ac[_0x014a('0x20')]===_0x014a('0x1f');var _0x89e132=_0x12d339[_0x014a('0x21')];var _0x34e5c3=_0x61ec9f?0x0:_0x2c26ac['offset'];var _0x359903=_0x61ec9f?_0x12d339[_0x014a('0x21')]:_0x2c26ac[_0x014a('0x1e')]+_0x2c26ac[_0x014a('0x20')];var _0xc9a563;if(_0x359903>=_0x89e132){_0x359903=_0x89e132;_0xc9a563=0xc8;}else{_0xc9a563=0xce;}_0x12da95[_0x014a('0x1c')](_0xc9a563);return _0x12da95[_0x014a('0x22')](_0x014a('0x23'),_0x34e5c3+'-'+_0x359903+'/'+_0x89e132)[_0x014a('0x1d')](_0x12d339);}return null;};}function patchUpdates(_0x486e66){return function(_0x3679ed){try{jsonpatch['apply'](_0x3679ed,_0x486e66,!![]);}catch(_0x1a1318){return BPromise[_0x014a('0x24')](_0x1a1318);}return _0x3679ed[_0x014a('0x25')]();};}function saveUpdates(_0x36d52b,_0x2b3c10){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0x014a('0x26')](_0x36d52b)[_0x014a('0x27')](function(_0x165a42){return _0x165a42;});}return null;};}function removeEntity(_0x4c2627,_0x3b4b92){return function(_0x5358e9){if(_0x5358e9){return _0x5358e9[_0x014a('0x28')]()[_0x014a('0x27')](function(){var _0x4f1c44=_0x5358e9['get']({'plain':!![]});var _0x9a901f=_0x014a('0x29');return db[_0x014a('0x2a')]['destroy']({'where':{'type':_0x9a901f,'resourceId':_0x4f1c44['id']}})[_0x014a('0x27')](function(){return _0x5358e9;});})[_0x014a('0x27')](function(){_0x4c2627['status'](0xcc)[_0x014a('0x1b')]();});}};}function handleEntityNotFound(_0x2560a6,_0x496040){return function(_0x4f9c1c){if(!_0x4f9c1c){_0x2560a6[_0x014a('0x1a')](0x194);}return _0x4f9c1c;};}function handleError(_0x3e5a0a,_0xe70dfa){_0xe70dfa=_0xe70dfa||0x1f4;return function(_0x29fce5){logger['error'](_0x29fce5[_0x014a('0x2b')]);if(_0x29fce5[_0x014a('0x2c')]){delete _0x29fce5[_0x014a('0x2c')];}_0x3e5a0a[_0x014a('0x1c')](_0xe70dfa)[_0x014a('0x2d')](_0x29fce5);};}exports[_0x014a('0x2e')]=function(_0x354f4c,_0x1dae8e){var _0xc802d5={},_0x3c8755={},_0x9dfb11={'count':0x0,'rows':[]};var _0x4ed54e=_[_0x014a('0x2f')](db[_0x014a('0x30')][_0x014a('0x31')],function(_0x457883){return{'name':_0x457883[_0x014a('0x32')],'type':_0x457883[_0x014a('0x33')][_0x014a('0x34')]};});_0x3c8755['model']=_[_0x014a('0x2f')](_0x4ed54e,_0x014a('0x2c'));_0x3c8755['query']=_[_0x014a('0x35')](_0x354f4c[_0x014a('0x36')]);_0x3c8755[_0x014a('0x37')]=_[_0x014a('0x38')](_0x3c8755[_0x014a('0x39')],_0x3c8755[_0x014a('0x36')]);_0xc802d5[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x3c8755['model'],qs[_0x014a('0x3b')](_0x354f4c[_0x014a('0x36')][_0x014a('0x3b')]));_0xc802d5[_0x014a('0x3a')]=_0xc802d5['attributes'][_0x014a('0x3c')]?_0xc802d5[_0x014a('0x3a')]:_0x3c8755[_0x014a('0x39')];if(!_0x354f4c[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0xc802d5[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x354f4c[_0x014a('0x36')]['limit']);_0xc802d5[_0x014a('0x1e')]=qs['offset'](_0x354f4c[_0x014a('0x36')][_0x014a('0x1e')]);}_0xc802d5[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x354f4c[_0x014a('0x36')]['sort']);_0xc802d5[_0x014a('0x41')]=qs[_0x014a('0x37')](_['pick'](_0x354f4c[_0x014a('0x36')],_0x3c8755[_0x014a('0x37')]),_0x4ed54e);if(_0x354f4c[_0x014a('0x36')][_0x014a('0x42')]){_0xc802d5[_0x014a('0x41')]=_[_0x014a('0x43')](_0xc802d5[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x4ed54e,function(_0x2beddc){if(_0x2beddc['type']!==_0x014a('0x44')){var _0x3baf40={};_0x3baf40[_0x2beddc[_0x014a('0x2c')]]={'$like':'%'+_0x354f4c[_0x014a('0x36')]['filter']+'%'};return _0x3baf40;}})});}_0xc802d5=_[_0x014a('0x43')]({},_0xc802d5,_0x354f4c[_0x014a('0x45')]);var _0x4cd132={'where':_0xc802d5[_0x014a('0x41')]};return db[_0x014a('0x30')][_0x014a('0x21')](_0x4cd132)['then'](function(_0x361866){_0x9dfb11[_0x014a('0x21')]=_0x361866;if(_0x354f4c['query'][_0x014a('0x46')]){_0xc802d5[_0x014a('0x47')]=[{'all':!![]}];}return db[_0x014a('0x30')]['findAll'](_0xc802d5);})[_0x014a('0x27')](function(_0x50a8f0){_0x9dfb11['rows']=_0x50a8f0;return _0x9dfb11;})[_0x014a('0x27')](respondWithFilteredResult(_0x1dae8e,_0xc802d5))[_0x014a('0x48')](handleError(_0x1dae8e,null));};exports['show']=function(_0x1557ad,_0x11c0d5){var _0xa4b68e={'raw':![],'where':{'id':_0x1557ad[_0x014a('0x49')]['id']}},_0x15c5dc={};_0x15c5dc[_0x014a('0x39')]=_['keys'](db[_0x014a('0x30')][_0x014a('0x31')]);_0x15c5dc[_0x014a('0x36')]=_['keys'](_0x1557ad['query']);_0x15c5dc[_0x014a('0x37')]=_['intersection'](_0x15c5dc['model'],_0x15c5dc[_0x014a('0x36')]);_0xa4b68e['attributes']=_[_0x014a('0x38')](_0x15c5dc[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x1557ad['query'][_0x014a('0x3b')]));_0xa4b68e[_0x014a('0x3a')]=_0xa4b68e[_0x014a('0x3a')][_0x014a('0x3c')]?_0xa4b68e[_0x014a('0x3a')]:_0x15c5dc[_0x014a('0x39')];if(_0x1557ad['query'][_0x014a('0x46')]){_0xa4b68e[_0x014a('0x47')]=[{'all':!![]}];}_0xa4b68e=_['merge']({},_0xa4b68e,_0x1557ad[_0x014a('0x45')]);return db[_0x014a('0x30')][_0x014a('0x4a')](_0xa4b68e)[_0x014a('0x27')](handleEntityNotFound(_0x11c0d5,null))[_0x014a('0x27')](respondWithResult(_0x11c0d5,null))[_0x014a('0x48')](handleError(_0x11c0d5,null));};exports[_0x014a('0x28')]=function(_0x21680f,_0x4aa72b){return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x21680f[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x4aa72b,null))[_0x014a('0x27')](removeEntity(_0x4aa72b,null))['catch'](handleError(_0x4aa72b,null));};exports[_0x014a('0x4b')]=function(_0x5bee56,_0x2da804){return db[_0x014a('0x30')][_0x014a('0x4b')]()[_0x014a('0x27')](respondWithResult(_0x2da804,null))[_0x014a('0x48')](handleError(_0x2da804,null));};exports['create']=function(_0x51e1de,_0x4bb0b2){var _0x58905d;return db[_0x014a('0x4c')]['transaction'](function(_0x1fe253){return db['VoicePrefix']['create'](_0x51e1de[_0x014a('0x4d')],{'transaction':_0x1fe253})['then'](function(_0x1c640b){_0x58905d=_0x1c640b[_0x014a('0x4e')]({'plain':!![]});return db[_0x014a('0x4f')][_0x014a('0x4a')]({'where':{'id':_0x58905d[_0x014a('0x50')]},'raw':!![]})[_0x014a('0x27')](function(_0x35a421){return createVoicePrefixExtensions(_0x58905d,_0x35a421,_0x1fe253);});});})[_0x014a('0x27')](function(){var _0x133fcd=_0x51e1de[_0x014a('0x51')]['get']({'plain':!![]});if(!_0x133fcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133fcd[_0x014a('0x52')]===_0x014a('0x51')){var _0x237345=_0x58905d;return db['UserProfileSection']['find']({'where':{'name':_0x014a('0x29'),'userProfileId':_0x133fcd['userProfileId']},'raw':!![]})[_0x014a('0x27')](function(_0x3f6177){if(_0x3f6177&&_0x3f6177[_0x014a('0x53')]===0x0){return db[_0x014a('0x2a')]['create']({'name':_0x237345[_0x014a('0x2c')],'resourceId':_0x237345['id'],'type':_0x3f6177[_0x014a('0x2c')],'sectionId':_0x3f6177['id']},{})[_0x014a('0x27')](function(){return _0x58905d;});}else{return _0x58905d;}})['catch'](function(_0xbaeb5f){logger['error'](_0x014a('0x54'),_0xbaeb5f);throw _0xbaeb5f;});}return _0x58905d;})[_0x014a('0x27')](respondWithResult(_0x4bb0b2,null))[_0x014a('0x48')](handleError(_0x4bb0b2,null));};function Extension(_0x24d433,_0xd0334a,_0x1a308b,_0x4e9260){this[_0x014a('0x55')]=_0x014a('0x56');this[_0x014a('0x57')]=_0x24d433;this['app']=_0x1a308b;this[_0x014a('0x33')]=_0x014a('0x58');this[_0x014a('0x59')]=_0x014a('0x5a');this[_0x014a('0x5b')]=_0xd0334a;this['appdata']=_0x4e9260;}function createVoicePrefixExtensions(_0x8ac9cd,_0x46168d,_0x63c341){return new BPromise(function(_0x37a7b8,_0x3ca7e6){var _0x37b4a5=new Extension(formatPrefixName(_0x8ac9cd[_0x014a('0x5c')]),0x1,_0x014a('0x5d'),_0x014a('0x5e'));_0x37b4a5[_0x014a('0x5f')]=_0x8ac9cd['id'];return db[_0x014a('0x4f')][_0x014a('0x60')](_0x37b4a5,{'transaction':_0x63c341})['then'](function(_0x2ac66a){var _0x5ac216=_0x2ac66a['get']({'plain':!![]});var _0x5c9c47=_['map'](addVoicePrefixExtensions(_0x8ac9cd,_0x46168d),function(_0x5a38b4){_0x5a38b4[_0x014a('0x50')]=_0x5ac216['id'];_0x5a38b4[_0x014a('0x5f')]=_0x8ac9cd['id'];return _0x5a38b4;});return db[_0x014a('0x4f')]['bulkCreate'](_0x5c9c47,{'transaction':_0x63c341})[_0x014a('0x27')](function(_0x2a5007){if(!_0x2a5007){return _0x3ca7e6(_0x014a('0x61'));}else{return _0x37a7b8(_0x2a5007);}})[_0x014a('0x48')](function(_0x4dd210){return _0x3ca7e6(_0x4dd210);});});;});};function addVoicePrefixExtensions(_0x5edf80,_0xd3ab26){var _0x39154c=[];var _0x411948=formatPrefixName(_0x5edf80[_0x014a('0x5c')]);_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x2,_0x014a('0x63'),_0x014a('0x64')+_0x5edf80[_0x014a('0x2c')]));if(_0x5edf80[_0x014a('0x65')]){_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x3,_0x014a('0x63'),'PREFIX-CALLERIDALL='+_0x5edf80[_0x014a('0x65')]));}else{_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x3,'NoOp',_0x014a('0x66')));}_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x4,'goto',_0xd3ab26[_0x014a('0x55')]+','+'${EXTEN:'+(0x8+_0x5edf80[_0x014a('0x2c')][_0x014a('0x3c')])+'}'+','+0x1));return _0x39154c;}function formatPrefixName(_0xcdcbbb){var _0x456d69='_';for(var _0x37b8f=0x0;_0x37b8f<_0xcdcbbb['length'];_0x37b8f++){if(_0xcdcbbb[_0x014a('0x67')](_0x37b8f)=='-'){_0x456d69+=_0xcdcbbb[_0x014a('0x67')](_0x37b8f);}else{_0x456d69+='['+_0xcdcbbb[_0x014a('0x67')](_0x37b8f)+']';}}_0x456d69+='.';return _0x456d69;}exports[_0x014a('0x26')]=function(_0xbad5ef,_0x52e79e,_0x20cddc){var _0x188e65=_0xbad5ef[_0x014a('0x4d')];_0x188e65['prefix']=_0x014a('0x68')+_0x188e65['name']+'-';return db[_0x014a('0x4c')][_0x014a('0x69')](function(_0x267026){return db[_0x014a('0x30')][_0x014a('0x26')](_0x188e65,{'where':{'id':_0x188e65['id']},'transaction':_0x267026})[_0x014a('0x27')](function(){return db[_0x014a('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x188e65['id']},'transaction':_0x267026})['then'](function(){return db[_0x014a('0x4f')]['find']({'where':{'id':_0x188e65[_0x014a('0x50')]},'raw':!![]})['then'](function(_0x1dcfc6){return createVoicePrefixExtensions(_0x188e65,_0x1dcfc6,_0x267026);});});});})[_0x014a('0x27')](function(){return db['VoicePrefix']['findById'](_0x188e65['id']);})[_0x014a('0x27')](respondWithResult(_0x52e79e,null))[_0x014a('0x48')](handleError(_0x52e79e,null));};exports['addAgents']=function(_0x882fc9,_0x42e4e9,_0x5635fc){return db['VoicePrefix'][_0x014a('0x4a')]({'where':{'id':_0x882fc9[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x42e4e9,null))[_0x014a('0x27')](function(_0x37ea2d){if(_0x37ea2d){return _0x37ea2d[_0x014a('0x6a')](_0x882fc9['body'][_0x014a('0x6b')],_['omit'](_0x882fc9['body'],[_0x014a('0x6b'),'id'])||{})[_0x014a('0x6c')](function(_0x523859){for(var _0x27e363=0x0;_0x27e363<_0x882fc9[_0x014a('0x4d')][_0x014a('0x6b')][_0x014a('0x3c')];_0x27e363+=0x1){socket[_0x014a('0x6d')]('userVoicePrefix:save',{'UserId':Number(_0x882fc9[_0x014a('0x4d')][_0x014a('0x6b')][_0x27e363]),'VoicePrefixId':Number(_0x882fc9[_0x014a('0x49')]['id'])});}return _0x523859;});}})[_0x014a('0x27')](respondWithResult(_0x42e4e9,null))['catch'](handleError(_0x42e4e9,null));};exports[_0x014a('0x6e')]=function(_0x4c568c,_0x469bb0,_0x3807c4){return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x4c568c[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x469bb0,null))['then'](function(_0x389bfb){if(_0x389bfb){return _0x389bfb[_0x014a('0x6e')](_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')])[_0x014a('0x27')](function(){if(_[_0x014a('0x6f')](_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')])){for(var _0x55cfe7=0x0;_0x55cfe7<_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')][_0x014a('0x3c')];_0x55cfe7+=0x1){socket['emit'](_0x014a('0x70'),{'UserId':Number(_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')][_0x55cfe7]),'VoicePrefixId':Number(_0x4c568c[_0x014a('0x49')]['id'])});}}else{socket[_0x014a('0x6d')](_0x014a('0x70'),{'UserId':Number(_0x4c568c[_0x014a('0x36')]['ids']),'VoicePrefixId':Number(_0x4c568c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x469bb0,null))['catch'](handleError(_0x469bb0,null));};exports[_0x014a('0x71')]=function(_0x32683c,_0x1810a8,_0x3804e1){var _0xe1b5ed={};var _0x7cd599={};var _0x1ba571;var _0x4e5d25;return db[_0x014a('0x30')][_0x014a('0x72')]({'where':{'id':_0x32683c[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x1810a8,null))['then'](function(_0x55d5f1){if(_0x55d5f1){_0x1ba571=_0x55d5f1;_0x7cd599[_0x014a('0x39')]=_[_0x014a('0x35')](db['User']['rawAttributes']);_0x7cd599[_0x014a('0x36')]=_['keys'](_0x32683c['query']);_0x7cd599[_0x014a('0x37')]=_[_0x014a('0x38')](_0x7cd599['model'],_0x7cd599[_0x014a('0x36')]);_0xe1b5ed[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x7cd599[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x32683c[_0x014a('0x36')][_0x014a('0x3b')]));_0xe1b5ed[_0x014a('0x3a')]=_0xe1b5ed['attributes']['length']?_0xe1b5ed[_0x014a('0x3a')]:_0x7cd599['model'];_0xe1b5ed['order']=qs['sort'](_0x32683c[_0x014a('0x36')][_0x014a('0x40')]);_0xe1b5ed[_0x014a('0x41')]=qs['filters'](_[_0x014a('0x73')](_0x32683c[_0x014a('0x36')],_0x7cd599[_0x014a('0x37')]));if(_0x32683c[_0x014a('0x36')]['filter']){_0xe1b5ed[_0x014a('0x41')]=_[_0x014a('0x43')](_0xe1b5ed[_0x014a('0x41')],{'$or':_['map'](_0xe1b5ed[_0x014a('0x3a')],function(_0x52a3a8){var _0x59871d={};_0x59871d[_0x52a3a8]={'$like':'%'+_0x32683c[_0x014a('0x36')][_0x014a('0x42')]+'%'};return _0x59871d;})});}_0xe1b5ed=_[_0x014a('0x43')]({},_0xe1b5ed,_0x32683c['options']);return _0x1ba571[_0x014a('0x71')](_0xe1b5ed);}})[_0x014a('0x27')](function(_0x53c335){if(_0x53c335){_0x4e5d25=_0x53c335[_0x014a('0x3c')];if(!_0x32683c[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0xe1b5ed[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x32683c[_0x014a('0x36')][_0x014a('0x20')]);_0xe1b5ed['offset']=qs[_0x014a('0x1e')](_0x32683c[_0x014a('0x36')]['offset']);}return _0x1ba571['getAgents'](_0xe1b5ed);}})[_0x014a('0x27')](function(_0x45a093){if(_0x45a093){return _0x45a093?{'count':_0x4e5d25,'rows':_0x45a093}:null;}})['then'](respondWithResult(_0x1810a8,null))[_0x014a('0x48')](handleError(_0x1810a8,null));};exports[_0x014a('0x74')]=function(_0x216b27,_0x5ddb47,_0x3a0012){var _0x2c320f={};var _0x5dedaf={};var _0x5baf80;var _0x105786;return db['VoicePrefix'][_0x014a('0x72')]({'where':{'id':_0x216b27['params']['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x5ddb47,null))[_0x014a('0x27')](function(_0xda07b5){if(_0xda07b5){_0x5baf80=_0xda07b5;_0x5dedaf[_0x014a('0x39')]=_[_0x014a('0x35')](db['Team'][_0x014a('0x31')]);_0x5dedaf[_0x014a('0x36')]=_[_0x014a('0x35')](_0x216b27[_0x014a('0x36')]);_0x5dedaf[_0x014a('0x37')]=_[_0x014a('0x38')](_0x5dedaf[_0x014a('0x39')],_0x5dedaf[_0x014a('0x36')]);_0x2c320f['attributes']=_[_0x014a('0x38')](_0x5dedaf['model'],qs[_0x014a('0x3b')](_0x216b27['query']['fields']));_0x2c320f['attributes']=_0x2c320f['attributes'][_0x014a('0x3c')]?_0x2c320f[_0x014a('0x3a')]:_0x5dedaf[_0x014a('0x39')];_0x2c320f[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x216b27[_0x014a('0x36')][_0x014a('0x40')]);_0x2c320f[_0x014a('0x41')]=qs['filters'](_['pick'](_0x216b27[_0x014a('0x36')],_0x5dedaf[_0x014a('0x37')]));if(_0x216b27[_0x014a('0x36')][_0x014a('0x42')]){_0x2c320f[_0x014a('0x41')]=_[_0x014a('0x43')](_0x2c320f[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x2c320f['attributes'],function(_0x27431c){var _0x3cfcc7={};_0x3cfcc7[_0x27431c]={'$like':'%'+_0x216b27[_0x014a('0x36')][_0x014a('0x42')]+'%'};return _0x3cfcc7;})});}_0x2c320f=_[_0x014a('0x43')]({},_0x2c320f,_0x216b27['options']);return _0x5baf80[_0x014a('0x74')](_0x2c320f);}})[_0x014a('0x27')](function(_0x2b9496){if(_0x2b9496){_0x105786=_0x2b9496[_0x014a('0x3c')];if(!_0x216b27[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0x2c320f['limit']=qs[_0x014a('0x20')](_0x216b27['query']['limit']);_0x2c320f[_0x014a('0x1e')]=qs[_0x014a('0x1e')](_0x216b27['query'][_0x014a('0x1e')]);}return _0x5baf80[_0x014a('0x74')](_0x2c320f);}})[_0x014a('0x27')](function(_0x5e116d){if(_0x5e116d){return _0x5e116d?{'count':_0x105786,'rows':_0x5e116d}:null;}})[_0x014a('0x27')](respondWithResult(_0x5ddb47,null))[_0x014a('0x48')](handleError(_0x5ddb47,null));};exports[_0x014a('0x75')]=function(_0x336bcf,_0x2f7969,_0x263212){var _0x13c2b2=_0x336bcf[_0x014a('0x4d')][_0x014a('0x6b')];var _0x58341b;return db['Team'][_0x014a('0x76')]({'where':{'id':_0x13c2b2},'attributes':['id'],'include':[{'model':db[_0x014a('0x77')],'as':_0x014a('0x78'),'attributes':['id','name',_0x014a('0x79'),_0x014a('0x7a'),_0x014a('0x7b')],'raw':!![]}]})[_0x014a('0x27')](function(_0x49997){if(_0x49997){_0x58341b=_0x49997;var _0x2888a0=_['flatMap'](_0x49997,function(_0x1c8cba){var _0x3ab005=_0x1c8cba[_0x014a('0x4e')]({'plain':!![]});return _0x3ab005[_0x014a('0x78')];});return db['VoicePrefix'][_0x014a('0x4a')]({'where':{'id':_0x336bcf[_0x014a('0x49')]['id']}})[_0x014a('0x27')](function(_0x30999a){return db[_0x014a('0x4c')]['transaction'](function(_0xcf0aee){return _0x30999a['addTeams'](_0x13c2b2,{'transaction':_0xcf0aee})['then'](function(){return BPromise[_0x014a('0x7c')](_0x58341b,function(_0x369fbd){return db[_0x014a('0x7d')][_0x014a('0x7e')]({'TeamId':_0x369fbd['id'],'VoicePrefixId':_0x336bcf[_0x014a('0x49')]['id']},{'transaction':_0xcf0aee});});})[_0x014a('0x27')](function(){return BPromise[_0x014a('0x7c')](_0x2888a0,function(_0x3a9352){return db[_0x014a('0x7f')][_0x014a('0x80')]({'where':{'UserId':_0x3a9352['id'],'VoicePrefixId':_0x336bcf[_0x014a('0x49')]['id']},'transaction':_0xcf0aee});});})[_0x014a('0x27')](function(){_0x2888a0[_0x014a('0x81')](function(_0x175c12){socket[_0x014a('0x6d')](_0x014a('0x82'),{'UserId':_0x175c12['id'],'VoicePrefixId':_0x30999a['id']});});});});});}})['then'](respondWithStatusCode(_0x2f7969,null))[_0x014a('0x48')](handleError(_0x2f7969,null));};exports[_0x014a('0x83')]=function(_0x3c03ac,_0x4ab9d6,_0x4495c1){return db[_0x014a('0x84')][_0x014a('0x76')]({'where':{'id':_0x3c03ac[_0x014a('0x36')][_0x014a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x014a('0x77')],'as':_0x014a('0x78'),'attributes':['id'],'raw':!![]}]})[_0x014a('0x27')](handleEntityNotFound(_0x4ab9d6,null))[_0x014a('0x27')](function(_0x480639){var _0x346734=_[_0x014a('0x2f')](_0x480639,'id');var _0x1b1e6a=[];var _0x11aab3=[];var _0x4f91f1=squel[_0x014a('0x85')]();_0x4f91f1['field']('tq.TeamId')[_0x014a('0x86')]('team_has_voice_prefixes','tq')[_0x014a('0x87')](_0x014a('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x014a('0x41')]('VoicePrefixId\x20=\x20?',_0x3c03ac[_0x014a('0x49')]['id']);for(var _0x8cc35d=0x0;_0x8cc35d<_0x480639['length'];_0x8cc35d+=0x1){let _0x183bf6=_0x480639[_0x8cc35d];for(var _0x1b1c4e=0x0;_0x1b1c4e<_0x183bf6['Agents'][_0x014a('0x3c')];_0x1b1c4e+=0x1){let _0x3f5c3e=_0x183bf6[_0x014a('0x78')][_0x1b1c4e];var _0x383c07=_0x4f91f1[_0x014a('0x89')]();_0x383c07[_0x014a('0x41')](_0x014a('0x8a'),_0x3f5c3e['id']);_0x11aab3[_0x014a('0x62')](db[_0x014a('0x4c')][_0x014a('0x36')](_0x383c07[_0x014a('0x8b')](),{'type':db[_0x014a('0x4c')]['QueryTypes'][_0x014a('0x8c')]})[_0x014a('0x27')](function(_0x3d8d34){if(_0x3d8d34[_0x014a('0x3c')]===0x1){return _0x3f5c3e['id'];}else{var _0x3cf20e=_[_0x014a('0x8d')](_[_0x014a('0x2f')](_0x3d8d34,_0x014a('0x8e')),function(_0x5a7fd0){return _[_0x014a('0x8f')](_0x346734,_0x5a7fd0);});if(_0x3cf20e){return _0x3f5c3e['id'];}}}));}}return BPromise[_0x014a('0x90')](_0x11aab3)[_0x014a('0x27')](function(_0x29d217){_0x1b1e6a=_(_0x1b1e6a)[_0x014a('0x91')](_0x29d217)[_0x014a('0x92')]()['value']();return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x3c03ac[_0x014a('0x49')]['id']}})['then'](function(_0x4e6844){return db[_0x014a('0x4c')][_0x014a('0x69')](function(_0x262513){return _0x4e6844[_0x014a('0x83')](_0x3c03ac[_0x014a('0x36')]['ids'],{'transaction':_0x262513})[_0x014a('0x27')](function(){if(!_[_0x014a('0x93')](_0x1b1e6a)){return _0x4e6844[_0x014a('0x6e')](_0x1b1e6a,{'transaction':_0x262513});}})[_0x014a('0x27')](function(){_0x1b1e6a[_0x014a('0x81')](function(_0x87c7e5){socket['emit'](_0x014a('0x70'),{'UserId':_0x87c7e5,'VoicePrefixId':_0x4e6844['id']});});});});});});})['then'](respondWithStatusCode(_0x4ab9d6,null))[_0x014a('0x48')](handleError(_0x4ab9d6,null));}; \ No newline at end of file +var _0xd824=['NoOp','charAt','system-','transaction','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','sort','pick','nolimit','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes','all','value','removeTeams','isEmpty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','userProfileId','autoAssociation','UserProfileResource','context','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL='];(function(_0x54cffa,_0x514151){var _0x54e231=function(_0x2b60e3){while(--_0x2b60e3){_0x54cffa['push'](_0x54cffa['shift']());}};_0x54e231(++_0x514151);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4d82('0x14')]=_[_0x4d82('0x15')](config[_0x4d82('0x14')],{'host':_0x4d82('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0x14')]));require(_0x4d82('0x17'))[_0x4d82('0x18')](socket);function respondWithStatusCode(_0x486152,_0x70c598){_0x70c598=_0x70c598||0xcc;return function(_0x4f4c45){if(_0x4f4c45){return _0x486152[_0x4d82('0x19')](_0x70c598);}return _0x486152['status'](_0x70c598)[_0x4d82('0x1a')]();};}function respondWithResult(_0x496f3b,_0x474acf){_0x474acf=_0x474acf||0xc8;return function(_0xb1640d){if(_0xb1640d){return _0x496f3b[_0x4d82('0x1b')](_0x474acf)[_0x4d82('0x1c')](_0xb1640d);}};}function respondWithFilteredResult(_0x2648a8,_0x7c03fc){return function(_0x258c59){if(_0x258c59){var _0x217b72=typeof _0x7c03fc[_0x4d82('0x1d')]==='undefined'&&typeof _0x7c03fc[_0x4d82('0x1e')]===_0x4d82('0x1f');var _0x1b1e39=_0x258c59[_0x4d82('0x20')];var _0xe6260=_0x217b72?0x0:_0x7c03fc[_0x4d82('0x1d')];var _0x1a513d=_0x217b72?_0x258c59[_0x4d82('0x20')]:_0x7c03fc[_0x4d82('0x1d')]+_0x7c03fc[_0x4d82('0x1e')];var _0xf2f5a5;if(_0x1a513d>=_0x1b1e39){_0x1a513d=_0x1b1e39;_0xf2f5a5=0xc8;}else{_0xf2f5a5=0xce;}_0x2648a8['status'](_0xf2f5a5);return _0x2648a8[_0x4d82('0x21')](_0x4d82('0x22'),_0xe6260+'-'+_0x1a513d+'/'+_0x1b1e39)['json'](_0x258c59);}return null;};}function patchUpdates(_0x1a419f){return function(_0x41f194){try{jsonpatch[_0x4d82('0x23')](_0x41f194,_0x1a419f,!![]);}catch(_0x14a2d4){return BPromise[_0x4d82('0x24')](_0x14a2d4);}return _0x41f194[_0x4d82('0x25')]();};}function saveUpdates(_0x11c043,_0x462258){return function(_0x12feab){if(_0x12feab){return _0x12feab[_0x4d82('0x26')](_0x11c043)[_0x4d82('0x27')](function(_0x395efc){return _0x395efc;});}return null;};}function removeEntity(_0x7404ba,_0x284c66){return function(_0x1940ef){if(_0x1940ef){return _0x1940ef['destroy']()['then'](function(){var _0x3dcb0f=_0x1940ef[_0x4d82('0x28')]({'plain':!![]});var _0x2a0572=_0x4d82('0x29');return db['UserProfileResource'][_0x4d82('0x2a')]({'where':{'type':_0x2a0572,'resourceId':_0x3dcb0f['id']}})[_0x4d82('0x27')](function(){return _0x1940ef;});})[_0x4d82('0x27')](function(){_0x7404ba[_0x4d82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4081f6,_0x4a7444){return function(_0x4d9ac4){if(!_0x4d9ac4){_0x4081f6['sendStatus'](0x194);}return _0x4d9ac4;};}function handleError(_0x52533b,_0x3d2229){_0x3d2229=_0x3d2229||0x1f4;return function(_0x8cfbf1){logger[_0x4d82('0x2b')](_0x8cfbf1['stack']);if(_0x8cfbf1[_0x4d82('0x2c')]){delete _0x8cfbf1[_0x4d82('0x2c')];}_0x52533b['status'](_0x3d2229)['send'](_0x8cfbf1);};}exports[_0x4d82('0x2d')]=function(_0x46a058,_0x16d30a){var _0x175961={},_0x5447f8={},_0x33d2a9={'count':0x0,'rows':[]};var _0x59cd4f=_[_0x4d82('0x2e')](db[_0x4d82('0x2f')]['rawAttributes'],function(_0x583cc5){return{'name':_0x583cc5[_0x4d82('0x30')],'type':_0x583cc5[_0x4d82('0x31')][_0x4d82('0x32')]};});_0x5447f8[_0x4d82('0x33')]=_[_0x4d82('0x2e')](_0x59cd4f,_0x4d82('0x2c'));_0x5447f8[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x46a058[_0x4d82('0x34')]);_0x5447f8[_0x4d82('0x36')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],_0x5447f8[_0x4d82('0x34')]);_0x175961[_0x4d82('0x37')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],qs[_0x4d82('0x38')](_0x46a058['query'][_0x4d82('0x38')]));_0x175961[_0x4d82('0x37')]=_0x175961[_0x4d82('0x37')]['length']?_0x175961[_0x4d82('0x37')]:_0x5447f8[_0x4d82('0x33')];if(!_0x46a058['query'][_0x4d82('0x39')]('nolimit')){_0x175961[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x46a058['query'][_0x4d82('0x1e')]);_0x175961['offset']=qs[_0x4d82('0x1d')](_0x46a058['query']['offset']);}_0x175961[_0x4d82('0x3a')]=qs['sort'](_0x46a058[_0x4d82('0x34')]['sort']);_0x175961[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0x46a058[_0x4d82('0x34')],_0x5447f8['filters']),_0x59cd4f);if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x175961['where']=_[_0x4d82('0x3d')](_0x175961['where'],{'$or':_[_0x4d82('0x2e')](_0x59cd4f,function(_0x54f714){if(_0x54f714[_0x4d82('0x31')]!==_0x4d82('0x3e')){var _0x1d9e8b={};_0x1d9e8b[_0x54f714[_0x4d82('0x2c')]]={'$like':'%'+_0x46a058['query'][_0x4d82('0x3c')]+'%'};return _0x1d9e8b;}})});}_0x175961=_[_0x4d82('0x3d')]({},_0x175961,_0x46a058[_0x4d82('0x3f')]);var _0x3e29a6={'where':_0x175961[_0x4d82('0x3b')]};return db[_0x4d82('0x2f')][_0x4d82('0x20')](_0x3e29a6)['then'](function(_0x3c80d6){_0x33d2a9[_0x4d82('0x20')]=_0x3c80d6;if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x40')]){_0x175961[_0x4d82('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x4d82('0x42')](_0x175961);})[_0x4d82('0x27')](function(_0x3f0a9f){_0x33d2a9[_0x4d82('0x43')]=_0x3f0a9f;return _0x33d2a9;})[_0x4d82('0x27')](respondWithFilteredResult(_0x16d30a,_0x175961))[_0x4d82('0x44')](handleError(_0x16d30a,null));};exports[_0x4d82('0x45')]=function(_0x5847c0,_0xe8c15f){var _0x1909da={'raw':![],'where':{'id':_0x5847c0[_0x4d82('0x46')]['id']}},_0x55e2f7={};_0x55e2f7['model']=_[_0x4d82('0x35')](db[_0x4d82('0x2f')]['rawAttributes']);_0x55e2f7[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x5847c0['query']);_0x55e2f7[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x55e2f7[_0x4d82('0x33')],_0x55e2f7['query']);_0x1909da[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x55e2f7['model'],qs['fields'](_0x5847c0[_0x4d82('0x34')][_0x4d82('0x38')]));_0x1909da[_0x4d82('0x37')]=_0x1909da[_0x4d82('0x37')][_0x4d82('0x48')]?_0x1909da[_0x4d82('0x37')]:_0x55e2f7[_0x4d82('0x33')];if(_0x5847c0['query'][_0x4d82('0x40')]){_0x1909da[_0x4d82('0x41')]=[{'all':!![]}];}_0x1909da=_[_0x4d82('0x3d')]({},_0x1909da,_0x5847c0[_0x4d82('0x3f')]);return db['VoicePrefix']['find'](_0x1909da)['then'](handleEntityNotFound(_0xe8c15f,null))[_0x4d82('0x27')](respondWithResult(_0xe8c15f,null))[_0x4d82('0x44')](handleError(_0xe8c15f,null));};exports[_0x4d82('0x2a')]=function(_0x34a08b,_0x25fc80){return db[_0x4d82('0x2f')]['find']({'where':{'id':_0x34a08b[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x25fc80,null))[_0x4d82('0x27')](removeEntity(_0x25fc80,null))[_0x4d82('0x44')](handleError(_0x25fc80,null));};exports[_0x4d82('0x49')]=function(_0x33f498,_0x127ef3){return db[_0x4d82('0x2f')][_0x4d82('0x49')]()['then'](respondWithResult(_0x127ef3,null))[_0x4d82('0x44')](handleError(_0x127ef3,null));};exports[_0x4d82('0x4a')]=function(_0x1822db,_0x25e8b9){var _0x1d853f;return db[_0x4d82('0x4b')]['transaction'](function(_0x5cf138){return db[_0x4d82('0x2f')][_0x4d82('0x4a')](_0x1822db[_0x4d82('0x4c')],{'transaction':_0x5cf138})[_0x4d82('0x27')](function(_0x2e373a){_0x1d853f=_0x2e373a[_0x4d82('0x28')]({'plain':!![]});return db[_0x4d82('0x4d')][_0x4d82('0x4e')]({'where':{'id':_0x1d853f[_0x4d82('0x4f')]},'raw':!![]})[_0x4d82('0x27')](function(_0x367c82){return createVoicePrefixExtensions(_0x1d853f,_0x367c82,_0x5cf138);});});})[_0x4d82('0x27')](function(){var _0x517f87=_0x1822db[_0x4d82('0x50')]['get']({'plain':!![]});if(!_0x517f87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517f87[_0x4d82('0x51')]===_0x4d82('0x50')){var _0x257dc4=_0x1d853f;return db['UserProfileSection'][_0x4d82('0x4e')]({'where':{'name':_0x4d82('0x29'),'userProfileId':_0x517f87[_0x4d82('0x52')]},'raw':!![]})[_0x4d82('0x27')](function(_0x4aaa65){if(_0x4aaa65&&_0x4aaa65[_0x4d82('0x53')]===0x0){return db[_0x4d82('0x54')][_0x4d82('0x4a')]({'name':_0x257dc4[_0x4d82('0x2c')],'resourceId':_0x257dc4['id'],'type':_0x4aaa65[_0x4d82('0x2c')],'sectionId':_0x4aaa65['id']},{})['then'](function(){return _0x1d853f;});}else{return _0x1d853f;}})[_0x4d82('0x44')](function(_0x3297ce){logger[_0x4d82('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3297ce);throw _0x3297ce;});}return _0x1d853f;})[_0x4d82('0x27')](respondWithResult(_0x25e8b9,null))[_0x4d82('0x44')](handleError(_0x25e8b9,null));};function Extension(_0x131bb5,_0x189e3f,_0x14e621,_0x3148bd){this[_0x4d82('0x55')]='from-sip';this['exten']=_0x131bb5;this[_0x4d82('0x56')]=_0x14e621;this[_0x4d82('0x31')]=_0x4d82('0x57');this['description']=_0x4d82('0x58');this[_0x4d82('0x59')]=_0x189e3f;this[_0x4d82('0x5a')]=_0x3148bd;}function createVoicePrefixExtensions(_0x3d85c2,_0x238459,_0x2aec60){return new BPromise(function(_0xa2cdb3,_0xc70504){var _0x131a10=new Extension(formatPrefixName(_0x3d85c2[_0x4d82('0x5b')]),0x1,'NoOp','Voice\x20Prefix');_0x131a10[_0x4d82('0x5c')]=_0x3d85c2['id'];return db[_0x4d82('0x4d')][_0x4d82('0x4a')](_0x131a10,{'transaction':_0x2aec60})['then'](function(_0x471349){var _0xc80c61=_0x471349[_0x4d82('0x28')]({'plain':!![]});var _0x328991=_[_0x4d82('0x2e')](addVoicePrefixExtensions(_0x3d85c2,_0x238459),function(_0x43c72e){_0x43c72e[_0x4d82('0x4f')]=_0xc80c61['id'];_0x43c72e[_0x4d82('0x5c')]=_0x3d85c2['id'];return _0x43c72e;});return db['VoiceExtension'][_0x4d82('0x5d')](_0x328991,{'transaction':_0x2aec60})[_0x4d82('0x27')](function(_0x279172){if(!_0x279172){return _0xc70504('Extensions\x20creation\x20failed');}else{return _0xa2cdb3(_0x279172);}})['catch'](function(_0x1d3e90){return _0xc70504(_0x1d3e90);});});;});};function addVoicePrefixExtensions(_0xc5b353,_0x1a785a){var _0x15d620=[];var _0x2872bf=formatPrefixName(_0xc5b353[_0x4d82('0x5b')]);_0x15d620['push'](new Extension(_0x2872bf,0x2,_0x4d82('0x5e'),_0x4d82('0x5f')+_0xc5b353[_0x4d82('0x2c')]));if(_0xc5b353['callerIdAll']){_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x5e'),_0x4d82('0x61')+_0xc5b353['callerIdAll']));}else{_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x62'),'No\x20callerid\x20available'));}_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x4,'goto',_0x1a785a[_0x4d82('0x55')]+','+'${EXTEN:'+(0x8+_0xc5b353['name'][_0x4d82('0x48')])+'}'+','+0x1));return _0x15d620;}function formatPrefixName(_0x32e291){var _0x5279e3='_';for(var _0x307592=0x0;_0x307592<_0x32e291['length'];_0x307592++){if(_0x32e291[_0x4d82('0x63')](_0x307592)=='-'){_0x5279e3+=_0x32e291['charAt'](_0x307592);}else{_0x5279e3+='['+_0x32e291[_0x4d82('0x63')](_0x307592)+']';}}_0x5279e3+='.';return _0x5279e3;}exports[_0x4d82('0x26')]=function(_0x2fcf61,_0x75900c,_0x9c5e5c){var _0x456f33=_0x2fcf61[_0x4d82('0x4c')];_0x456f33[_0x4d82('0x5b')]=_0x4d82('0x64')+_0x456f33[_0x4d82('0x2c')]+'-';return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x14d697){return db[_0x4d82('0x2f')][_0x4d82('0x26')](_0x456f33,{'where':{'id':_0x456f33['id']},'transaction':_0x14d697})[_0x4d82('0x27')](function(){return db[_0x4d82('0x4d')][_0x4d82('0x2a')]({'where':{'VoicePrefixId':_0x456f33['id']},'transaction':_0x14d697})['then'](function(){return db['VoiceExtension'][_0x4d82('0x4e')]({'where':{'id':_0x456f33['VoiceExtensionId']},'raw':!![]})[_0x4d82('0x27')](function(_0x47644d){return createVoicePrefixExtensions(_0x456f33,_0x47644d,_0x14d697);});});});})[_0x4d82('0x27')](function(){return db[_0x4d82('0x2f')][_0x4d82('0x66')](_0x456f33['id']);})[_0x4d82('0x27')](respondWithResult(_0x75900c,null))['catch'](handleError(_0x75900c,null));};exports[_0x4d82('0x67')]=function(_0x220e87,_0x554778,_0x80d688){return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0x220e87[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x554778,null))[_0x4d82('0x27')](function(_0x212561){if(_0x212561){return _0x212561[_0x4d82('0x67')](_0x220e87['body']['ids'],_['omit'](_0x220e87['body'],['ids','id'])||{})[_0x4d82('0x68')](function(_0x245e97){for(var _0x1fe26a=0x0;_0x1fe26a<_0x220e87['body'][_0x4d82('0x69')][_0x4d82('0x48')];_0x1fe26a+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':Number(_0x220e87[_0x4d82('0x4c')]['ids'][_0x1fe26a]),'VoicePrefixId':Number(_0x220e87['params']['id'])});}return _0x245e97;});}})[_0x4d82('0x27')](respondWithResult(_0x554778,null))[_0x4d82('0x44')](handleError(_0x554778,null));};exports[_0x4d82('0x6c')]=function(_0x2471b8,_0xd64d2a,_0x353c18){return db['VoicePrefix'][_0x4d82('0x4e')]({'where':{'id':_0x2471b8['params']['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0xd64d2a,null))[_0x4d82('0x27')](function(_0x28a256){if(_0x28a256){return _0x28a256[_0x4d82('0x6c')](_0x2471b8[_0x4d82('0x34')]['ids'])[_0x4d82('0x27')](function(){if(_[_0x4d82('0x6d')](_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')])){for(var _0x2a50b3=0x0;_0x2a50b3<_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')][_0x4d82('0x48')];_0x2a50b3+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')]['ids'][_0x2a50b3]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}}else{socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}});}})[_0x4d82('0x27')](respondWithStatusCode(_0xd64d2a,null))['catch'](handleError(_0xd64d2a,null));};exports[_0x4d82('0x6f')]=function(_0x3b7592,_0x5380ce,_0x21ea7c){var _0x588471={};var _0x634bfb={};var _0x5092ff;var _0x472666;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0x3b7592[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5380ce,null))['then'](function(_0x960e9){if(_0x960e9){_0x5092ff=_0x960e9;_0x634bfb[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x71')][_0x4d82('0x72')]);_0x634bfb[_0x4d82('0x34')]=_['keys'](_0x3b7592['query']);_0x634bfb[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x634bfb[_0x4d82('0x33')],_0x634bfb[_0x4d82('0x34')]);_0x588471[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x634bfb['model'],qs[_0x4d82('0x38')](_0x3b7592[_0x4d82('0x34')]['fields']));_0x588471[_0x4d82('0x37')]=_0x588471[_0x4d82('0x37')][_0x4d82('0x48')]?_0x588471['attributes']:_0x634bfb[_0x4d82('0x33')];_0x588471[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0x3b7592[_0x4d82('0x34')]['sort']);_0x588471[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_[_0x4d82('0x74')](_0x3b7592[_0x4d82('0x34')],_0x634bfb['filters']));if(_0x3b7592[_0x4d82('0x34')]['filter']){_0x588471['where']=_[_0x4d82('0x3d')](_0x588471[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x588471[_0x4d82('0x37')],function(_0xb2d707){var _0x49d4ed={};_0x49d4ed[_0xb2d707]={'$like':'%'+_0x3b7592[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x49d4ed;})});}_0x588471=_['merge']({},_0x588471,_0x3b7592[_0x4d82('0x3f')]);return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x210ed6){if(_0x210ed6){_0x472666=_0x210ed6['length'];if(!_0x3b7592[_0x4d82('0x34')]['hasOwnProperty'](_0x4d82('0x75'))){_0x588471[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x588471[_0x4d82('0x1d')]=qs['offset'](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1d')]);}return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x2c80ae){if(_0x2c80ae){return _0x2c80ae?{'count':_0x472666,'rows':_0x2c80ae}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5380ce,null))[_0x4d82('0x44')](handleError(_0x5380ce,null));};exports['getTeams']=function(_0xfb0987,_0x5a65e4,_0x252db4){var _0x24a63a={};var _0x2d0b29={};var _0x44c35f;var _0x54fcd4;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0xfb0987[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5a65e4,null))[_0x4d82('0x27')](function(_0x45b2e3){if(_0x45b2e3){_0x44c35f=_0x45b2e3;_0x2d0b29[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x76')][_0x4d82('0x72')]);_0x2d0b29[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0xfb0987[_0x4d82('0x34')]);_0x2d0b29['filters']=_[_0x4d82('0x47')](_0x2d0b29[_0x4d82('0x33')],_0x2d0b29[_0x4d82('0x34')]);_0x24a63a[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x2d0b29['model'],qs[_0x4d82('0x38')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x38')]));_0x24a63a[_0x4d82('0x37')]=_0x24a63a[_0x4d82('0x37')][_0x4d82('0x48')]?_0x24a63a['attributes']:_0x2d0b29['model'];_0x24a63a[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0xfb0987[_0x4d82('0x34')]['sort']);_0x24a63a[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0xfb0987[_0x4d82('0x34')],_0x2d0b29[_0x4d82('0x36')]));if(_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x24a63a[_0x4d82('0x3b')]=_[_0x4d82('0x3d')](_0x24a63a[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x24a63a['attributes'],function(_0x5471c3){var _0x1d1329={};_0x1d1329[_0x5471c3]={'$like':'%'+_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x1d1329;})});}_0x24a63a=_['merge']({},_0x24a63a,_0xfb0987[_0x4d82('0x3f')]);return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})[_0x4d82('0x27')](function(_0x5a9056){if(_0x5a9056){_0x54fcd4=_0x5a9056[_0x4d82('0x48')];if(!_0xfb0987['query']['hasOwnProperty'](_0x4d82('0x75'))){_0x24a63a[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x24a63a[_0x4d82('0x1d')]=qs[_0x4d82('0x1d')](_0xfb0987[_0x4d82('0x34')]['offset']);}return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})['then'](function(_0xc764bb){if(_0xc764bb){return _0xc764bb?{'count':_0x54fcd4,'rows':_0xc764bb}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5a65e4,null))[_0x4d82('0x44')](handleError(_0x5a65e4,null));};exports['addTeams']=function(_0xead937,_0x59e1bc,_0x521566){var _0x1eda7c=_0xead937['body'][_0x4d82('0x69')];var _0x5ac864;return db[_0x4d82('0x76')][_0x4d82('0x42')]({'where':{'id':_0x1eda7c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4d82('0x78'),'attributes':['id',_0x4d82('0x2c'),_0x4d82('0x79'),_0x4d82('0x7a'),_0x4d82('0x7b')],'raw':!![]}]})[_0x4d82('0x27')](function(_0x2b832e){if(_0x2b832e){_0x5ac864=_0x2b832e;var _0x402626=_[_0x4d82('0x7c')](_0x2b832e,function(_0x3be4f9){var _0x47c734=_0x3be4f9[_0x4d82('0x28')]({'plain':!![]});return _0x47c734[_0x4d82('0x78')];});return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xead937[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](function(_0x1768e2){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x1c61f5){return _0x1768e2[_0x4d82('0x7d')](_0x1eda7c,{'transaction':_0x1c61f5})[_0x4d82('0x27')](function(){return BPromise[_0x4d82('0x7e')](_0x5ac864,function(_0x44729c){return db[_0x4d82('0x7f')][_0x4d82('0x80')]({'TeamId':_0x44729c['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},{'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){return BPromise['each'](_0x402626,function(_0x2867e7){return db[_0x4d82('0x81')][_0x4d82('0x82')]({'where':{'UserId':_0x2867e7['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){_0x402626['forEach'](function(_0x14b0cb){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':_0x14b0cb['id'],'VoicePrefixId':_0x1768e2['id']});});});});});}})[_0x4d82('0x27')](respondWithStatusCode(_0x59e1bc,null))[_0x4d82('0x44')](handleError(_0x59e1bc,null));};exports['removeTeams']=function(_0xc56d02,_0x34234c,_0x23778f){return db['Team'][_0x4d82('0x42')]({'where':{'id':_0xc56d02['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4d82('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34234c,null))[_0x4d82('0x27')](function(_0x1d32c3){var _0x4d0047=_['map'](_0x1d32c3,'id');var _0x4f7c18=[];var _0x4277b7=[];var _0x2b7c2c=squel[_0x4d82('0x83')]();_0x2b7c2c['field']('tq.TeamId')[_0x4d82('0x84')](_0x4d82('0x85'),'tq')[_0x4d82('0x86')](_0x4d82('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4d82('0x3b')](_0x4d82('0x88'),_0xc56d02[_0x4d82('0x46')]['id']);for(var _0x2c18b2=0x0;_0x2c18b2<_0x1d32c3[_0x4d82('0x48')];_0x2c18b2+=0x1){let _0x37cac6=_0x1d32c3[_0x2c18b2];for(var _0x642d9=0x0;_0x642d9<_0x37cac6['Agents'][_0x4d82('0x48')];_0x642d9+=0x1){let _0x3097f8=_0x37cac6[_0x4d82('0x78')][_0x642d9];var _0x5ccadb=_0x2b7c2c['clone']();_0x5ccadb[_0x4d82('0x3b')](_0x4d82('0x89'),_0x3097f8['id']);_0x4277b7[_0x4d82('0x60')](db['sequelize'][_0x4d82('0x34')](_0x5ccadb[_0x4d82('0x8a')](),{'type':db[_0x4d82('0x4b')][_0x4d82('0x8b')]['SELECT']})[_0x4d82('0x27')](function(_0x3f0228){if(_0x3f0228['length']===0x1){return _0x3097f8['id'];}else{var _0x5f4633=_[_0x4d82('0x8c')](_['map'](_0x3f0228,'TeamId'),function(_0x3e4fb1){return _[_0x4d82('0x8d')](_0x4d0047,_0x3e4fb1);});if(_0x5f4633){return _0x3097f8['id'];}}}));}}return BPromise[_0x4d82('0x8e')](_0x4277b7)['then'](function(_0x4d6de5){_0x4f7c18=_(_0x4f7c18)['union'](_0x4d6de5)['compact']()[_0x4d82('0x8f')]();return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xc56d02['params']['id']}})[_0x4d82('0x27')](function(_0x227e2c){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x4f36f5){return _0x227e2c[_0x4d82('0x90')](_0xc56d02['query'][_0x4d82('0x69')],{'transaction':_0x4f36f5})[_0x4d82('0x27')](function(){if(!_[_0x4d82('0x91')](_0x4f7c18)){return _0x227e2c[_0x4d82('0x6c')](_0x4f7c18,{'transaction':_0x4f36f5});}})[_0x4d82('0x27')](function(){_0x4f7c18['forEach'](function(_0x3a0735){socket[_0x4d82('0x6a')]('userVoicePrefix:remove',{'UserId':_0x3a0735,'VoicePrefixId':_0x227e2c['id']});});});});});});})['then'](respondWithStatusCode(_0x34234c,null))['catch'](handleError(_0x34234c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 797dde5..96a62ea 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 _0xf390=['save','update','remove','hook','events','VoicePrefix'];(function(_0x2cf680,_0x228066){var _0x4bf780=function(_0x2dd9e3){while(--_0x2dd9e3){_0x2cf680['push'](_0x2cf680['shift']());}};_0x4bf780(++_0x228066);}(_0xf390,0x196));var _0x0f39=function(_0x275dd2,_0x5a5a54){_0x275dd2=_0x275dd2-0x0;var _0x26364=_0xf390[_0x275dd2];return _0x26364;};'use strict';var EventEmitter=require(_0x0f39('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x0f39('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f39('0x2'),'afterUpdate':_0x0f39('0x3'),'afterDestroy':_0x0f39('0x4')};function emitEvent(_0x51221c){return function(_0x5a6a1f,_0x2e5cdc,_0x169ae5){VoicePrefixEvents['emit'](_0x51221c+':'+_0x5a6a1f['id'],_0x5a6a1f);VoicePrefixEvents['emit'](_0x51221c,_0x5a6a1f);_0x169ae5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x0f39('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xf58f=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','VoicePrefix'];(function(_0x50cb5c,_0x377a47){var _0x361ad4=function(_0x3c8d51){while(--_0x3c8d51){_0x50cb5c['push'](_0x50cb5c['shift']());}};_0x361ad4(++_0x377a47);}(_0xf58f,0x16f));var _0xff58=function(_0x53baab,_0x5cb8ac){_0x53baab=_0x53baab-0x0;var _0x34d1c0=_0xf58f[_0x53baab];return _0x34d1c0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xff58('0x0'))['db'][_0xff58('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xff58('0x2')](0x0);var events={'afterCreate':_0xff58('0x3'),'afterUpdate':_0xff58('0x4'),'afterDestroy':_0xff58('0x5')};function emitEvent(_0x13c3eb){return function(_0x4df9e4,_0x1d5002,_0x21091f){VoicePrefixEvents[_0xff58('0x6')](_0x13c3eb+':'+_0x4df9e4['id'],_0x4df9e4);VoicePrefixEvents[_0xff58('0x6')](_0x13c3eb,_0x4df9e4);_0x21091f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xff58('0x7')](e,emitEvent(event));}}module[_0xff58('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 60180a8..6f84646 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 _0x41cd=['./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2bf181,_0x2bba7d){var _0x17dd00=function(_0x1baef2){while(--_0x1baef2){_0x2bf181['push'](_0x2bf181['shift']());}};_0x17dd00(++_0x2bba7d);}(_0x41cd,0x16c));var _0xd41c=function(_0x5997f4,_0x482272){_0x5997f4=_0x5997f4-0x0;var _0xa47e6a=_0x41cd[_0x5997f4];return _0xa47e6a;};'use strict';var _=require(_0xd41c('0x0'));var util=require(_0xd41c('0x1'));var logger=require('../../config/logger')(_0xd41c('0x2'));var moment=require(_0xd41c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd41c('0x4'));var fs=require('fs');var path=require(_0xd41c('0x5'));var rimraf=require(_0xd41c('0x6'));var config=require(_0xd41c('0x7'));var attributes=require(_0xd41c('0x8'));module[_0xd41c('0x9')]=function(_0x2c2bfe,_0x61ab45){return _0x2c2bfe[_0xd41c('0xa')](_0xd41c('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8c1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','VoicePrefix','voice_prefixes'];(function(_0x568c0c,_0x380c8c){var _0x1f649c=function(_0x1410f0){while(--_0x1410f0){_0x568c0c['push'](_0x568c0c['shift']());}};_0x1f649c(++_0x380c8c);}(_0xc8c1,0xc0));var _0x1c8c=function(_0x3ccca8,_0x5ee18f){_0x3ccca8=_0x3ccca8-0x0;var _0x2e5876=_0xc8c1[_0x3ccca8];return _0x2e5876;};'use strict';var _=require(_0x1c8c('0x0'));var util=require(_0x1c8c('0x1'));var logger=require(_0x1c8c('0x2'))(_0x1c8c('0x3'));var moment=require(_0x1c8c('0x4'));var BPromise=require(_0x1c8c('0x5'));var rp=require(_0x1c8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c8c('0x7'));var config=require(_0x1c8c('0x8'));var attributes=require(_0x1c8c('0x9'));module['exports']=function(_0x2c72df,_0x187851){return _0x2c72df['define'](_0x1c8c('0xa'),attributes,{'tableName':_0x1c8c('0xb'),'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 3b824c1..2d4470a 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 _0xafb9=['../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ce92f,_0x3ce63f){var _0x15ac02=function(_0x53c88e){while(--_0x53c88e){_0x1ce92f['push'](_0x1ce92f['shift']());}};_0x15ac02(++_0x3ce63f);}(_0xafb9,0x68));var _0x9afb=function(_0x5b456b,_0x80d465){_0x5b456b=_0x5b456b-0x0;var _0x59891c=_0xafb9[_0x5b456b];return _0x59891c;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9afb('0xb')],{'host':_0x9afb('0xc'),'port':0x18eb});var socket=require(_0x9afb('0xd'))(new Redis(config['redis']));require(_0x9afb('0xe'))[_0x9afb('0xf')](socket);function respondWithRpcPromise(_0x2aaefe,_0x27fa71,_0x1e5325){return new BPromise(function(_0x56f477,_0x5bb974){return client[_0x9afb('0x10')](_0x2aaefe,_0x1e5325)[_0x9afb('0x11')](function(_0x3e6a29){logger[_0x9afb('0x12')](_0x9afb('0x13'),_0x27fa71,_0x9afb('0x14'));logger[_0x9afb('0x15')](_0x9afb('0x16'),_0x27fa71,_0x9afb('0x14'),JSON[_0x9afb('0x17')](_0x3e6a29));if(_0x3e6a29['error']){if(_0x3e6a29[_0x9afb('0x18')]['code']===0x1f4){logger['error'](_0x9afb('0x13'),_0x27fa71,_0x3e6a29[_0x9afb('0x18')][_0x9afb('0x19')]);return _0x5bb974(_0x3e6a29[_0x9afb('0x18')][_0x9afb('0x19')]);}logger[_0x9afb('0x18')](_0x9afb('0x13'),_0x27fa71,_0x3e6a29['error'][_0x9afb('0x19')]);return _0x56f477(_0x3e6a29[_0x9afb('0x18')][_0x9afb('0x19')]);}else{logger[_0x9afb('0x12')](_0x9afb('0x13'),_0x27fa71,'request\x20sent');_0x56f477(_0x3e6a29[_0x9afb('0x1a')]['message']);}})[_0x9afb('0x1b')](function(_0x12aa19){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x27fa71,_0x12aa19);_0x5bb974(_0x12aa19);});});} \ No newline at end of file +var _0x01a6=['http','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01a6,0x162));var _0x601a=function(_0x53fc3a,_0x28c60e){_0x53fc3a=_0x53fc3a-0x0;var _0x5073e7=_0x01a6[_0x53fc3a];return _0x5073e7;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});config[_0x601a('0xb')]=_['defaults'](config['redis'],{'host':_0x601a('0xc'),'port':0x18eb});var socket=require(_0x601a('0xd'))(new Redis(config[_0x601a('0xb')]));require('./voicePrefix.socket')[_0x601a('0xe')](socket);function respondWithRpcPromise(_0x2e9f4f,_0x5c9073,_0x44b2b6){return new BPromise(function(_0x2eb393,_0x51ed58){return client[_0x601a('0xf')](_0x2e9f4f,_0x44b2b6)[_0x601a('0x10')](function(_0x3fec87){logger[_0x601a('0x11')](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));logger[_0x601a('0x14')](_0x601a('0x15'),_0x5c9073,_0x601a('0x13'),JSON[_0x601a('0x16')](_0x3fec87));if(_0x3fec87[_0x601a('0x17')]){if(_0x3fec87['error'][_0x601a('0x18')]===0x1f4){logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x51ed58(_0x3fec87[_0x601a('0x17')]['message']);}logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x2eb393(_0x3fec87['error'][_0x601a('0x19')]);}else{logger['info'](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));_0x2eb393(_0x3fec87[_0x601a('0x1a')][_0x601a('0x19')]);}})[_0x601a('0x1b')](function(_0x47230b){logger[_0x601a('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5c9073,_0x47230b);_0x51ed58(_0x47230b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a1149a4..9b34ffe 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 _0x54f3=['save','remove','update','removeListener','length','voicePrefix:'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x54f3,0x120));var _0x354f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x54f3[_0x4e676e];return _0x336a3c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x354f('0x0'),_0x354f('0x1'),_0x354f('0x2')];function createListener(_0x1cb51f,_0x2cd824){return function(_0x517a53){_0x2cd824['emit'](_0x1cb51f,_0x517a53);};}function removeListener(_0xe4efe,_0x86b73e){return function(){VoicePrefixEvents[_0x354f('0x3')](_0xe4efe,_0x86b73e);};}exports['register']=function(_0x5618ac){for(var _0x234ac6=0x0,_0x51cd16=events[_0x354f('0x4')];_0x234ac6<_0x51cd16;_0x234ac6++){var _0x4311ad=events[_0x234ac6];var _0x2f111a=createListener(_0x354f('0x5')+_0x4311ad,_0x5618ac);VoicePrefixEvents['on'](_0x4311ad,_0x2f111a);}}; \ No newline at end of file +var _0xbf82=['remove','removeListener','register','voicePrefix:','./voicePrefix.events'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x5be112,_0x22bb3f){_0x5be112=_0x5be112-0x0;var _0x33876f=_0xbf82[_0x5be112];return _0x33876f;};'use strict';var VoicePrefixEvents=require(_0x2bf8('0x0'));var events=['save',_0x2bf8('0x1'),'update'];function createListener(_0x3d3645,_0x4289fc){return function(_0x436197){_0x4289fc['emit'](_0x3d3645,_0x436197);};}function removeListener(_0x5e2adc,_0x3e581e){return function(){VoicePrefixEvents[_0x2bf8('0x2')](_0x5e2adc,_0x3e581e);};}exports[_0x2bf8('0x3')]=function(_0x20dc19){for(var _0x19d402=0x0,_0x5a3818=events['length'];_0x19d402<_0x5a3818;_0x19d402++){var _0x1c57e9=events[_0x19d402];var _0x5c1944=createListener(_0x2bf8('0x4')+_0x1c57e9,_0x20dc19);VoicePrefixEvents['on'](_0x1c57e9,_0x5c1944);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 25d84b7..06f4e47 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xb10b,0x12a));var _0xbb10=function(_0xefd3e6,_0x10d71e){_0xefd3e6=_0xefd3e6-0x0;var _0x52a204=_0xb10b[_0xefd3e6];return _0x52a204;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xb10b,0x12a));var _0xbb10=function(_0x565f9b,_0x3697c0){_0x565f9b=_0x565f9b-0x0;var _0x1a27f9=_0xb10b[_0x565f9b];return _0x1a27f9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2ed5c0e..85f29dc 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 _0x6943=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','outbound','ENUM','ringall','leastrecent','fewestcalls','random','linear','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','preview','booked','includes','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.'];(function(_0x1d3953,_0x550473){var _0x57eeb4=function(_0x5f0f58){while(--_0x5f0f58){_0x1d3953['push'](_0x1d3953['shift']());}};_0x57eeb4(++_0x550473);}(_0x6943,0x6f));var _0x3694=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0x6943[_0x4b980d];return _0x5c7974;};'use strict';var Sequelize=require(_0x3694('0x0'));module[_0x3694('0x1')]={'name':{'type':Sequelize[_0x3694('0x2')],'allowNull':![],'unique':_0x3694('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x3694('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3694('0x5')]('rr',_0x3694('0x6'),_0x3694('0x7'),_0x3694('0x8'),_0x3694('0x9'),'rrmemory',_0x3694('0xa'),'wrandom',_0x3694('0xb')),'allowNull':![],'defaultValue':_0x3694('0x6'),'set':function(_0x5a7543){this[_0x3694('0xc')](_0x3694('0xd'),_0x5a7543?_0x5a7543:_0x3694('0xe'));},'get':function(){var _0x14ecaf=this[_0x3694('0xf')](_0x3694('0x10'));var _0x5cc36d=this[_0x3694('0xf')](_0x3694('0x11'));var _0x4b3c15=this[_0x3694('0xf')](_0x3694('0xd'));if(_0x14ecaf==='outbound'){if(_0x5cc36d===_0x3694('0x12')){return null;}if(_0x5cc36d===_0x3694('0x13')&&!['rrmemory','roundrobin'][_0x3694('0x14')](_0x4b3c15)){this[_0x3694('0xc')](_0x3694('0xd'),_0x3694('0xe'));}}return _0x4b3c15;}},'servicelevel':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3694('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3694('0x5')]('yes','no'),'defaultValue':_0x3694('0x16')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3694('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x3694('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3694('0x5')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3694('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3694('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3694('0x5')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3694('0x16')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x3694('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3694('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x3694('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3694('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3694('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3694('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3694('0x2')]},'queue_quantity1':{'type':Sequelize[_0x3694('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x3694('0x2')]},'queue_less_than':{'type':Sequelize[_0x3694('0x2')]},'periodic_announce':{'type':Sequelize[_0x3694('0x18')],'set':function(_0xe34dde){this['setDataValue'](_0x3694('0x19'),_0xe34dde?_0xe34dde[_0x3694('0x1a')](','):[]);},'get':function(){return this[_0x3694('0xf')](_0x3694('0x19'))?this[_0x3694('0xf')](_0x3694('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x3694('0x2')],'defaultValue':_0x3694('0x16'),'set':function(_0x261bf7){this[_0x3694('0xc')](_0x3694('0x1b'),_0x261bf7?_0x261bf7[_0x3694('0x1a')](','):undefined);},'get':function(){return this[_0x3694('0xf')](_0x3694('0x1b'))?this['getDataValue']('joinempty')[_0x3694('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3694('0x2')],'defaultValue':'no','set':function(_0x217264){this[_0x3694('0xc')](_0x3694('0x1d'),_0x217264?_0x217264['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x3694('0x1d'))?this[_0x3694('0xf')](_0x3694('0x1d'))[_0x3694('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3694('0x2')]},'description':{'type':Sequelize[_0x3694('0x2')]},'acw':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':0x0,'set':function(_0x18609d){this[_0x3694('0xc')](_0x3694('0x1f'),_0x18609d);if(_0x18609d){if(this['getDataValue'](_0x3694('0x20'))<0x2){this[_0x3694('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3694('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3694('0x21')},'dialMethod':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x12'),_0x3694('0x22'),_0x3694('0x23'),_0x3694('0x24'),_0x3694('0x13')),'defaultValue':'progressive','comment':_0x3694('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3694('0x26')},'dialLimitQueue':{'type':Sequelize[_0x3694('0x15')](0x4)[_0x3694('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3694('0x28')},'dialPowerLevel':{'type':Sequelize[_0x3694('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3694('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x3694('0x2b')),'defaultValue':_0x3694('0x2b'),'comment':_0x3694('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3694('0x29')](0x2)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3694('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3694('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3694('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3694('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x3694('0x30'),'comment':_0x3694('0x31')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x3694('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3694('0x15')](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3694('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x3694('0x15')](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3694('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0x3,'comment':_0x3694('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3694('0x15')](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3694('0x35')},'dialTimezone':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3694('0x2')],'defaultValue':_0x3694('0x36')},'dialPrefix':{'type':Sequelize[_0x3694('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x37'),_0x3694('0x38'),_0x3694('0x39')),'defaultValue':_0x3694('0x37')},'dialAMDActive':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3694('0x15')](0x9)[_0x3694('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3694('0x15')](0x9)[_0x3694('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3694('0x15')](0x9)[_0x3694('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3694('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3694('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x3694('0x15')](0x9)[_0x3694('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3694('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3694('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3694('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3694('0x15')](0x5)[_0x3694('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3694('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3694('0x15')](0x9)[_0x3694('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3694('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x3694('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3694('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':0x0,'comment':_0x3694('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3694('0x5')](_0x3694('0x42'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x3694('0x2')],'comment':_0x3694('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x3694('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3694('0x44')},'dialCutDigit':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3694('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x3694('0x15')](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3694('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3694('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3694('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3694('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3694('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3694('0x15')](0x3)[_0x3694('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3694('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3694('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x3694('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':![],'comment':_0x3694('0x4c'),'set':function(_0x9498d){if(!_0x9498d)this[_0x3694('0xc')]('mandatoryDispositionPauseId',null);this[_0x3694('0xc')](_0x3694('0x4d'),_0x9498d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3694('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3694('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x3694('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3694('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ac0=['type','preview','booked','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','predictive','progressive','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.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','fewestcalls','rrmemory','wrandom','setDataValue','strategy','getDataValue'];(function(_0x5ec110,_0x1b40b8){var _0x458489=function(_0x3596d0){while(--_0x3596d0){_0x5ec110['push'](_0x5ec110['shift']());}};_0x458489(++_0x1b40b8);}(_0x4ac0,0x182));var _0x04ac=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4ac0[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x04ac('0x0'));module[_0x04ac('0x1')]={'name':{'type':Sequelize[_0x04ac('0x2')],'allowNull':![],'unique':_0x04ac('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x5'),_0x04ac('0x6')),'allowNull':![],'defaultValue':_0x04ac('0x5')},'musiconhold':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x04ac('0x4')]('rr',_0x04ac('0x7'),'leastrecent',_0x04ac('0x8'),'random',_0x04ac('0x9'),'linear',_0x04ac('0xa'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x2dc9bc){this[_0x04ac('0xb')](_0x04ac('0xc'),_0x2dc9bc?_0x2dc9bc:_0x04ac('0x9'));},'get':function(){var _0x206912=this[_0x04ac('0xd')](_0x04ac('0xe'));var _0x516128=this[_0x04ac('0xd')]('dialMethod');var _0x27cef8=this['getDataValue'](_0x04ac('0xc'));if(_0x206912===_0x04ac('0x6')){if(_0x516128===_0x04ac('0xf')){return null;}if(_0x516128===_0x04ac('0x10')&&![_0x04ac('0x9'),'roundrobin'][_0x04ac('0x11')](_0x27cef8)){this[_0x04ac('0xb')]('strategy',_0x04ac('0x9'));}}return _0x27cef8;}},'servicelevel':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x04ac('0x12')](0xb)},'timeout':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x04ac('0x2')]},'weight':{'type':Sequelize[_0x04ac('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x04ac('0x4')]('yes','no'),'defaultValue':_0x04ac('0x13')},'autopause':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no',_0x04ac('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x04ac('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x04ac('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x04ac('0x13')},'announce_holdtime':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no',_0x04ac('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x04ac('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x04ac('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x04ac('0x2')]},'queue_youarenext':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x04ac('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x04ac('0x2')]},'queue_quantity1':{'type':Sequelize[_0x04ac('0x2')]},'queue_quantity2':{'type':Sequelize[_0x04ac('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x04ac('0x2')]},'queue_less_than':{'type':Sequelize[_0x04ac('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2bea71){this[_0x04ac('0xb')]('periodic_announce',_0x2bea71?_0x2bea71[_0x04ac('0x16')](','):[]);},'get':function(){return this[_0x04ac('0xd')](_0x04ac('0x17'))?this['getDataValue'](_0x04ac('0x17'))[_0x04ac('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':'yes','set':function(_0x58da88){this['setDataValue'](_0x04ac('0x19'),_0x58da88?_0x58da88['join'](','):undefined);},'get':function(){return this[_0x04ac('0xd')](_0x04ac('0x19'))?this[_0x04ac('0xd')](_0x04ac('0x19'))[_0x04ac('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':'no','set':function(_0x5cf3bf){this[_0x04ac('0xb')](_0x04ac('0x1a'),_0x5cf3bf?_0x5cf3bf['join'](','):undefined);},'get':function(){return this[_0x04ac('0xd')](_0x04ac('0x1a'))?this['getDataValue'](_0x04ac('0x1a'))[_0x04ac('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x04ac('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x04ac('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x04ac('0x2')]},'description':{'type':Sequelize[_0x04ac('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x38adfe){this[_0x04ac('0xb')]('acw',_0x38adfe);if(_0x38adfe){if(this['getDataValue'](_0x04ac('0x1b'))<0x2){this[_0x04ac('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x04ac('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x04ac('0x1c')],'defaultValue':0x0,'comment':_0x04ac('0x1d')},'dialMethod':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0xf'),'progressive','power',_0x04ac('0x1e'),_0x04ac('0x10')),'defaultValue':_0x04ac('0x1f'),'comment':_0x04ac('0x20')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x04ac('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x04ac('0x22')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x04ac('0x23')},'dialPowerLevel':{'type':Sequelize[_0x04ac('0x24')](0x2)[_0x04ac('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x04ac('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x26'),_0x04ac('0x27')),'defaultValue':_0x04ac('0x27'),'comment':_0x04ac('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x04ac('0x24')](0x2)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x04ac('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x04ac('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x04ac('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x04ac('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x04ac('0x2c'),'comment':_0x04ac('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x2e')},'dialQueueProject':{'type':Sequelize[_0x04ac('0x2')],'comment':_0x04ac('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x04ac('0x12')](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04ac('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x04ac('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x04ac('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x04ac('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':_0x04ac('0x35')},'dialPrefix':{'type':Sequelize[_0x04ac('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x04ac('0x4')](_0x04ac('0x36'),_0x04ac('0x37'),_0x04ac('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x04ac('0x12')](0x9)[_0x04ac('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x04ac('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x04ac('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x04ac('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x04ac('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x04ac('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x04ac('0x12')](0x9)[_0x04ac('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x04ac('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x04ac('0x12')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x04ac('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x04ac('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x04ac('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x04ac('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x04ac('0x12')](0x9)[_0x04ac('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x04ac('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x04ac('0x12')](0x5)[_0x04ac('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x04ac('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x04ac('0x4')]('DESC',_0x04ac('0x41')),'defaultValue':_0x04ac('0x42')},'dialQueueProject2':{'type':Sequelize[_0x04ac('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x04ac('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x04ac('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x04ac('0x43')},'dialCutDigit':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x04ac('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04ac('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x04ac('0x12')](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04ac('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x04ac('0x12')](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04ac('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04ac('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x04ac('0x12')](0x5)[_0x04ac('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04ac('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04ac('0x12')],'allowNull':!![],'comment':_0x04ac('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x04ac('0x1c')],'defaultValue':![],'comment':_0x04ac('0x4e'),'set':function(_0x1e32ab){if(!_0x1e32ab)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x04ac('0xb')](_0x04ac('0x4f'),_0x1e32ab);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x04ac('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x04ac('0x12')](0x3)[_0x04ac('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 2c420c2..f7c4195 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 _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x333456,_0x2993b5){var _0x13ea10=function(_0x2c5a5b){while(--_0x2c5a5b){_0x333456['push'](_0x333456['shift']());}};_0x13ea10(++_0x2993b5);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,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(_0x3fdd6b,_0x38049d){var _0x13fc2d=function(_0x3d93af){while(--_0x3d93af){_0x3fdd6b['push'](_0x3fdd6b['shift']());}};_0x13fc2d(++_0x38049d);}(_0x3e74,0x175));var _0x43e7=function(_0xe373d2,_0x4f1b60){_0xe373d2=_0xe373d2-0x0;var _0x597555=_0x3e74[_0xe373d2];return _0x597555;};'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 a5ec7fb..a849d38 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 _0x28e1=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x400df5,_0x13c4ff){var _0x47de81=function(_0x4f3889){while(--_0x4f3889){_0x400df5['push'](_0x400df5['shift']());}};_0x47de81(++_0x13c4ff);}(_0x28e1,0x11c));var _0x128e=function(_0x35c6e9,_0x438507){_0x35c6e9=_0x35c6e9-0x0;var _0x3cd6ae=_0x28e1[_0x35c6e9];return _0x3cd6ae;};'use strict';var EventEmitter=require(_0x128e('0x0'));var VoiceQueue=require(_0x128e('0x1'))['db'][_0x128e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x128e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x128e('0x4')};function emitEvent(_0x38273f){return function(_0x55ae4b,_0x18f810,_0x4d7487){VoiceQueueEvents[_0x128e('0x5')](_0x38273f+':'+_0x55ae4b['id'],_0x55ae4b);VoiceQueueEvents['emit'](_0x38273f,_0x55ae4b);_0x4d7487(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x128e('0x6')](e,emitEvent(event));}}module[_0x128e('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x8563=['emit','hasOwnProperty','exports','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x8563,0xb7));var _0x3856=function(_0x136261,_0x48ecfd){_0x136261=_0x136261-0x0;var _0x293b0f=_0x8563[_0x136261];return _0x293b0f;};'use strict';var EventEmitter=require(_0x3856('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x3856('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3856('0x2')](0x0);var events={'afterCreate':_0x3856('0x3'),'afterUpdate':_0x3856('0x4'),'afterDestroy':_0x3856('0x5')};function emitEvent(_0x303829){return function(_0x38fb70,_0x40257b,_0x401ff4){VoiceQueueEvents['emit'](_0x303829+':'+_0x38fb70['id'],_0x38fb70);VoiceQueueEvents[_0x3856('0x6')](_0x303829,_0x38fb70);_0x401ff4(null);};}for(var e in events){if(events[_0x3856('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3856('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3bca146..2ee0511 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x21233e,_0x2d39c1){var _0x3752c9=function(_0x1201f3){while(--_0x1201f3){_0x21233e['push'](_0x21233e['shift']());}};_0x3752c9(++_0x2d39c1);}(_0x3e74,0x175));var _0x43e7=function(_0x48edb2,_0x479826){_0x48edb2=_0x48edb2-0x0;var _0x31104a=_0x3e74[_0x48edb2];return _0x31104a;};'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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x55d877,_0x75b0b2){var _0x550138=function(_0x3d6981){while(--_0x3d6981){_0x55d877['push'](_0x55d877['shift']());}};_0x550138(++_0x75b0b2);}(_0x70e0,0x17b));var _0x070e=function(_0x337d08,_0x456dc1){_0x337d08=_0x337d08-0x0;var _0xa73cd3=_0x70e0[_0x337d08];return _0xa73cd3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 915be29..41534f1 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 _0x224f=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','debug','ShowVoiceQueue','find','map','lodash','util','bluebird','randomstring','ioredis'];(function(_0x15edb4,_0x312549){var _0x389446=function(_0x78b78f){while(--_0x78b78f){_0x15edb4['push'](_0x15edb4['shift']());}};_0x389446(++_0x312549);}(_0x224f,0x19d));var _0xf224=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x224f[_0x311f44];return _0x46f1e6;};'use strict';var _=require(_0xf224('0x0'));var util=require(_0xf224('0x1'));var moment=require('moment');var BPromise=require(_0xf224('0x2'));var rs=require(_0xf224('0x3'));var fs=require('fs');var Redis=require(_0xf224('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf224('0x5'))(_0xf224('0x6'));var config=require(_0xf224('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf224('0x8')][_0xf224('0x9')]({'port':0x232a});config[_0xf224('0xa')]=_[_0xf224('0xb')](config[_0xf224('0xa')],{'host':_0xf224('0xc'),'port':0x18eb});var socket=require(_0xf224('0xd'))(new Redis(config[_0xf224('0xa')]));require(_0xf224('0xe'))['register'](socket);function respondWithRpcPromise(_0x33a245,_0x2208c1,_0x1ed5b7){return new BPromise(function(_0x50a1d9,_0xc148ef){return client['request'](_0x33a245,_0x1ed5b7)['then'](function(_0x4b54ca){logger[_0xf224('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x2208c1,_0xf224('0x10'));logger['debug'](_0xf224('0x11'),_0x2208c1,_0xf224('0x10'),JSON[_0xf224('0x12')](_0x4b54ca));if(_0x4b54ca[_0xf224('0x13')]){if(_0x4b54ca[_0xf224('0x13')][_0xf224('0x14')]===0x1f4){logger['error'](_0xf224('0x15'),_0x2208c1,_0x4b54ca[_0xf224('0x13')][_0xf224('0x16')]);return _0xc148ef(_0x4b54ca['error'][_0xf224('0x16')]);}logger[_0xf224('0x13')](_0xf224('0x15'),_0x2208c1,_0x4b54ca[_0xf224('0x13')][_0xf224('0x16')]);return _0x50a1d9(_0x4b54ca[_0xf224('0x13')]['message']);}else{logger[_0xf224('0xf')](_0xf224('0x15'),_0x2208c1,_0xf224('0x10'));_0x50a1d9(_0x4b54ca['result'][_0xf224('0x16')]);}})[_0xf224('0x17')](function(_0x2055f3){logger[_0xf224('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x2208c1,_0x2055f3);_0xc148ef(_0x2055f3);});});}exports[_0xf224('0x18')]=function(_0x3dc014){var _0x55bbd3=this;return new Promise(function(_0x1ef3f3,_0x1a9543){return db[_0xf224('0x19')][_0xf224('0x1a')]({'raw':_0x3dc014['options']?_0x3dc014[_0xf224('0x1b')][_0xf224('0x1c')]===undefined?!![]:![]:!![],'where':_0x3dc014[_0xf224('0x1b')]?_0x3dc014['options'][_0xf224('0x1d')]||null:null,'attributes':_0x3dc014[_0xf224('0x1b')]?_0x3dc014[_0xf224('0x1b')][_0xf224('0x1e')]||null:null,'limit':_0x3dc014[_0xf224('0x1b')]?_0x3dc014[_0xf224('0x1b')][_0xf224('0x1f')]||null:null,'include':_0x3dc014[_0xf224('0x1b')]?_0x3dc014['options'][_0xf224('0x20')]?_['map'](_0x3dc014[_0xf224('0x1b')]['include'],function(_0x4ca435){return{'model':db[_0x4ca435[_0xf224('0x21')]],'as':_0x4ca435['as'],'attributes':_0x4ca435['attributes'],'include':_0x4ca435['include']?_['map'](_0x4ca435['include'],function(_0x28ca66){return{'model':db[_0x28ca66[_0xf224('0x21')]],'as':_0x28ca66['as'],'attributes':_0x28ca66[_0xf224('0x1e')],'include':_0x28ca66['include']?_['map'](_0x28ca66[_0xf224('0x20')],function(_0x1490e9){return{'model':db[_0x1490e9[_0xf224('0x21')]],'as':_0x1490e9['as'],'attributes':_0x1490e9[_0xf224('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x456bde){logger[_0xf224('0xf')](_0xf224('0x18'),_0x3dc014);logger[_0xf224('0x22')](_0xf224('0x18'),_0x3dc014,JSON['stringify'](_0x456bde));_0x1ef3f3(_0x456bde);})['catch'](function(_0x491b63){logger[_0xf224('0x13')](_0xf224('0x18'),_0x491b63[_0xf224('0x16')],_0x3dc014);_0x1a9543(_0x55bbd3[_0xf224('0x13')](0x1f4,_0x491b63['message']));});});};exports[_0xf224('0x23')]=function(_0x34a5c7){var _0x4e8000=this;return new Promise(function(_0x4bc6ff,_0x447ef8){return db[_0xf224('0x19')][_0xf224('0x24')]({'raw':_0x34a5c7[_0xf224('0x1b')]?_0x34a5c7[_0xf224('0x1b')][_0xf224('0x1c')]===undefined?!![]:![]:!![],'where':_0x34a5c7[_0xf224('0x1b')]?_0x34a5c7[_0xf224('0x1b')]['where']||null:null,'attributes':_0x34a5c7[_0xf224('0x1b')]?_0x34a5c7['options']['attributes']||null:null,'include':_0x34a5c7[_0xf224('0x1b')]?_0x34a5c7[_0xf224('0x1b')][_0xf224('0x20')]?_[_0xf224('0x25')](_0x34a5c7[_0xf224('0x1b')]['include'],function(_0xc54b0f){return{'model':db[_0xc54b0f['model']],'as':_0xc54b0f['as'],'attributes':_0xc54b0f[_0xf224('0x1e')],'include':_0xc54b0f['include']?_['map'](_0xc54b0f[_0xf224('0x20')],function(_0x97ead2){return{'model':db[_0x97ead2[_0xf224('0x21')]],'as':_0x97ead2['as'],'attributes':_0x97ead2[_0xf224('0x1e')],'include':_0x97ead2[_0xf224('0x20')]?_[_0xf224('0x25')](_0x97ead2['include'],function(_0x7a315f){return{'model':db[_0x7a315f[_0xf224('0x21')]],'as':_0x7a315f['as'],'attributes':_0x7a315f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18826c){logger[_0xf224('0xf')]('ShowVoiceQueue',_0x34a5c7);logger['debug']('ShowVoiceQueue',_0x34a5c7,JSON['stringify'](_0x18826c));_0x4bc6ff(_0x18826c);})[_0xf224('0x17')](function(_0x56f35d){logger[_0xf224('0x13')](_0xf224('0x23'),_0x56f35d['message'],_0x34a5c7);_0x447ef8(_0x4e8000[_0xf224('0x13')](0x1f4,_0x56f35d[_0xf224('0x16')]));});});}; \ No newline at end of file +var _0x3c43=['request\x20sent','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','ShowVoiceQueue','find','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','VoiceQueue,\x20%s,\x20%s','debug'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x3c43,0x173));var _0x33c4=function(_0x459c7a,_0x2a6ce8){_0x459c7a=_0x459c7a-0x0;var _0x13e070=_0x3c43[_0x459c7a];return _0x13e070;};'use strict';var _=require('lodash');var util=require(_0x33c4('0x0'));var moment=require(_0x33c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x33c4('0x2'));var fs=require('fs');var Redis=require(_0x33c4('0x3'));var db=require(_0x33c4('0x4'))['db'];var utils=require(_0x33c4('0x5'));var logger=require('../../config/logger')(_0x33c4('0x6'));var config=require(_0x33c4('0x7'));var jayson=require(_0x33c4('0x8'));var client=jayson[_0x33c4('0x9')][_0x33c4('0xa')]({'port':0x232a});config[_0x33c4('0xb')]=_[_0x33c4('0xc')](config['redis'],{'host':_0x33c4('0xd'),'port':0x18eb});var socket=require(_0x33c4('0xe'))(new Redis(config[_0x33c4('0xb')]));require(_0x33c4('0xf'))['register'](socket);function respondWithRpcPromise(_0x344cf6,_0x195960,_0x26fbb7){return new BPromise(function(_0xc09075,_0x741d1d){return client['request'](_0x344cf6,_0x26fbb7)[_0x33c4('0x10')](function(_0x3e3a4a){logger['info'](_0x33c4('0x11'),_0x195960,'request\x20sent');logger[_0x33c4('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x195960,_0x33c4('0x13'),JSON[_0x33c4('0x14')](_0x3e3a4a));if(_0x3e3a4a[_0x33c4('0x15')]){if(_0x3e3a4a[_0x33c4('0x15')][_0x33c4('0x16')]===0x1f4){logger[_0x33c4('0x15')](_0x33c4('0x11'),_0x195960,_0x3e3a4a[_0x33c4('0x15')]['message']);return _0x741d1d(_0x3e3a4a['error'][_0x33c4('0x17')]);}logger[_0x33c4('0x15')](_0x33c4('0x11'),_0x195960,_0x3e3a4a['error'][_0x33c4('0x17')]);return _0xc09075(_0x3e3a4a['error'][_0x33c4('0x17')]);}else{logger[_0x33c4('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x195960,'request\x20sent');_0xc09075(_0x3e3a4a[_0x33c4('0x19')]['message']);}})['catch'](function(_0x15a176){logger['error'](_0x33c4('0x11'),_0x195960,_0x15a176);_0x741d1d(_0x15a176);});});}exports[_0x33c4('0x1a')]=function(_0x54656d){var _0x295d09=this;return new Promise(function(_0x4fb782,_0x47d3ec){return db[_0x33c4('0x1b')][_0x33c4('0x1c')]({'raw':_0x54656d[_0x33c4('0x1d')]?_0x54656d['options']['raw']===undefined?!![]:![]:!![],'where':_0x54656d[_0x33c4('0x1d')]?_0x54656d[_0x33c4('0x1d')][_0x33c4('0x1e')]||null:null,'attributes':_0x54656d[_0x33c4('0x1d')]?_0x54656d['options'][_0x33c4('0x1f')]||null:null,'limit':_0x54656d[_0x33c4('0x1d')]?_0x54656d[_0x33c4('0x1d')][_0x33c4('0x20')]||null:null,'include':_0x54656d['options']?_0x54656d[_0x33c4('0x1d')][_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x54656d[_0x33c4('0x1d')][_0x33c4('0x21')],function(_0x46753d){return{'model':db[_0x46753d[_0x33c4('0x23')]],'as':_0x46753d['as'],'attributes':_0x46753d['attributes'],'include':_0x46753d[_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x46753d['include'],function(_0x28a26d){return{'model':db[_0x28a26d[_0x33c4('0x23')]],'as':_0x28a26d['as'],'attributes':_0x28a26d['attributes'],'include':_0x28a26d[_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x28a26d[_0x33c4('0x21')],function(_0x13c71f){return{'model':db[_0x13c71f[_0x33c4('0x23')]],'as':_0x13c71f['as'],'attributes':_0x13c71f['attributes']};}):[]};}):[]};}):[]:[]})[_0x33c4('0x10')](function(_0x386aa7){logger['info'](_0x33c4('0x1a'),_0x54656d);logger[_0x33c4('0x12')]('GetVoiceQueue',_0x54656d,JSON['stringify'](_0x386aa7));_0x4fb782(_0x386aa7);})['catch'](function(_0x4f946f){logger['error'](_0x33c4('0x1a'),_0x4f946f['message'],_0x54656d);_0x47d3ec(_0x295d09[_0x33c4('0x15')](0x1f4,_0x4f946f['message']));});});};exports[_0x33c4('0x24')]=function(_0x1a7005){var _0x5024a1=this;return new Promise(function(_0x11348b,_0x419ab7){return db['VoiceQueue'][_0x33c4('0x25')]({'raw':_0x1a7005[_0x33c4('0x1d')]?_0x1a7005['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a7005['options']?_0x1a7005['options'][_0x33c4('0x1e')]||null:null,'attributes':_0x1a7005[_0x33c4('0x1d')]?_0x1a7005[_0x33c4('0x1d')][_0x33c4('0x1f')]||null:null,'include':_0x1a7005[_0x33c4('0x1d')]?_0x1a7005[_0x33c4('0x1d')][_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x1a7005['options'][_0x33c4('0x21')],function(_0x43c5da){return{'model':db[_0x43c5da[_0x33c4('0x23')]],'as':_0x43c5da['as'],'attributes':_0x43c5da['attributes'],'include':_0x43c5da[_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x43c5da['include'],function(_0x2ca019){return{'model':db[_0x2ca019['model']],'as':_0x2ca019['as'],'attributes':_0x2ca019[_0x33c4('0x1f')],'include':_0x2ca019[_0x33c4('0x21')]?_[_0x33c4('0x22')](_0x2ca019[_0x33c4('0x21')],function(_0x3fe118){return{'model':db[_0x3fe118[_0x33c4('0x23')]],'as':_0x3fe118['as'],'attributes':_0x3fe118['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x310402){logger[_0x33c4('0x18')](_0x33c4('0x24'),_0x1a7005);logger[_0x33c4('0x12')](_0x33c4('0x24'),_0x1a7005,JSON[_0x33c4('0x14')](_0x310402));_0x11348b(_0x310402);})[_0x33c4('0x26')](function(_0x51558c){logger[_0x33c4('0x15')](_0x33c4('0x24'),_0x51558c['message'],_0x1a7005);_0x419ab7(_0x5024a1[_0x33c4('0x15')](0x1f4,_0x51558c[_0x33c4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 429fc61..fccda02 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 _0x7d6f=['./voiceQueue.events','save','remove','update','length'];(function(_0x902d2d,_0x349166){var _0x1422d5=function(_0x29e810){while(--_0x29e810){_0x902d2d['push'](_0x902d2d['shift']());}};_0x1422d5(++_0x349166);}(_0x7d6f,0x104));var _0xf7d6=function(_0x1f79b5,_0x46d8d7){_0x1f79b5=_0x1f79b5-0x0;var _0xcf8bee=_0x7d6f[_0x1f79b5];return _0xcf8bee;};'use strict';var VoiceQueueEvents=require(_0xf7d6('0x0'));var events=[_0xf7d6('0x1'),_0xf7d6('0x2'),_0xf7d6('0x3')];function createListener(_0x4d1996,_0x57a192){return function(_0x12faf2){_0x57a192['emit'](_0x4d1996,_0x12faf2);};}function removeListener(_0x292a9f,_0x19eda1){return function(){VoiceQueueEvents['removeListener'](_0x292a9f,_0x19eda1);};}exports['register']=function(_0x1f5f96){for(var _0x5b8098=0x0,_0x57f055=events[_0xf7d6('0x4')];_0x5b8098<_0x57f055;_0x5b8098++){var _0x1fa3dd=events[_0x5b8098];var _0x54f2ff=createListener('voiceQueue:'+_0x1fa3dd,_0x1f5f96);VoiceQueueEvents['on'](_0x1fa3dd,_0x54f2ff);}}; \ No newline at end of file +var _0xc9ce=['length','voiceQueue:','./voiceQueue.events','save','emit','removeListener'];(function(_0x3a409b,_0x147b4f){var _0x5b6d4a=function(_0x1a129d){while(--_0x1a129d){_0x3a409b['push'](_0x3a409b['shift']());}};_0x5b6d4a(++_0x147b4f);}(_0xc9ce,0x182));var _0xec9c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc9ce[_0x2c91e9];return _0x13f0ff;};'use strict';var VoiceQueueEvents=require(_0xec9c('0x0'));var events=[_0xec9c('0x1'),'remove','update'];function createListener(_0x24c9d7,_0x5e0384){return function(_0x513986){_0x5e0384[_0xec9c('0x2')](_0x24c9d7,_0x513986);};}function removeListener(_0x3580a7,_0x1f55dc){return function(){VoiceQueueEvents[_0xec9c('0x3')](_0x3580a7,_0x1f55dc);};}exports['register']=function(_0x160f5c){for(var _0x3e021a=0x0,_0x2af832=events[_0xec9c('0x4')];_0x3e021a<_0x2af832;_0x3e021a++){var _0x2cc6b1=events[_0x3e021a];var _0x100d8b=createListener(_0xec9c('0x5')+_0x2cc6b1,_0x160f5c);VoiceQueueEvents['on'](_0x2cc6b1,_0x100d8b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 034205c..aac0221 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 _0xa068=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','show','post','create','put','/:id','update'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0xa068,0xc2));var _0x8a06=function(_0x328df6,_0x43f53a){_0x328df6=_0x328df6-0x0;var _0x2695bc=_0xa068[_0x328df6];return _0x2695bc;};'use strict';var multer=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var path=require(_0x8a06('0x2'));var timeout=require(_0x8a06('0x3'));var express=require(_0x8a06('0x4'));var router=express[_0x8a06('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8a06('0x6'));var config=require(_0x8a06('0x7'));var controller=require(_0x8a06('0x8'));router[_0x8a06('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a06('0xa')]);router[_0x8a06('0x9')](_0x8a06('0xb'),auth['isAuthenticated'](),controller[_0x8a06('0xc')]);router[_0x8a06('0x9')](_0x8a06('0xd'),auth[_0x8a06('0xe')](),controller[_0x8a06('0xf')]);router[_0x8a06('0x9')]('/:id',auth[_0x8a06('0xe')](),controller[_0x8a06('0x10')]);router[_0x8a06('0x11')]('/',auth['isAuthenticated'](),controller[_0x8a06('0x12')]);router[_0x8a06('0x13')](_0x8a06('0x14'),auth[_0x8a06('0xe')](),controller[_0x8a06('0x15')]);router['delete']('/:id',auth[_0x8a06('0xe')](),controller[_0x8a06('0x16')]);module[_0x8a06('0x17')]=router; \ No newline at end of file +var _0x38fd=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index','getVoiceQueuesReport','/:id','show'];(function(_0x393d7d,_0x49632d){var _0x5b2cee=function(_0x43c567){while(--_0x43c567){_0x393d7d['push'](_0x393d7d['shift']());}};_0x5b2cee(++_0x49632d);}(_0x38fd,0x1a5));var _0xd38f=function(_0x27e715,_0x511373){_0x27e715=_0x27e715-0x0;var _0x129828=_0x38fd[_0x27e715];return _0x129828;};'use strict';var multer=require(_0xd38f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd38f('0x1'));var express=require(_0xd38f('0x2'));var router=express[_0xd38f('0x3')]();var fs_extra=require(_0xd38f('0x4'));var auth=require(_0xd38f('0x5'));var interaction=require(_0xd38f('0x6'));var config=require('../../config/environment');var controller=require(_0xd38f('0x7'));router['get']('/',auth[_0xd38f('0x8')](),controller[_0xd38f('0x9')]);router[_0xd38f('0xa')]('/describe',auth[_0xd38f('0x8')](),controller[_0xd38f('0xb')]);router[_0xd38f('0xa')](_0xd38f('0xc'),auth[_0xd38f('0x8')](),controller[_0xd38f('0xd')]);router[_0xd38f('0xa')](_0xd38f('0xe'),auth[_0xd38f('0x8')](),controller[_0xd38f('0xf')]);router[_0xd38f('0x10')]('/',auth['isAuthenticated'](),controller[_0xd38f('0x11')]);router[_0xd38f('0x12')](_0xd38f('0xe'),auth[_0xd38f('0x8')](),controller[_0xd38f('0x13')]);router[_0xd38f('0x14')](_0xd38f('0xe'),auth[_0xd38f('0x8')](),controller[_0xd38f('0x15')]);module[_0xd38f('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a2c3e3a..abd98d0 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 _0xa3e2=['exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa3e2,0x1d0));var _0x2a3e=function(_0x424ebf,_0x4c64d3){_0x424ebf=_0x424ebf-0x0;var _0x4c6aef=_0xa3e2[_0x424ebf];return _0x4c6aef;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a3e('0x0'));module[_0x2a3e('0x1')]={'type':{'type':Sequelize[_0x2a3e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2a3e('0x2')]},'calleridname':{'type':Sequelize[_0x2a3e('0x2')]},'queue':{'type':Sequelize[_0x2a3e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2a3e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x2a3e('0x3')],'set':function(_0x289c3c){var _0x4cfa3b=moment(_0x289c3c);var _0x5a944e=moment(this['getDataValue'](_0x2a3e('0x4')))[_0x2a3e('0x5')](_0x2a3e('0x6'));var _0x33de89=_0x4cfa3b[_0x2a3e('0x7')](_0x5a944e,_0x2a3e('0x8'));this[_0x2a3e('0x9')](_0x2a3e('0xa'),_0x289c3c);this['setDataValue']('holdtime',_0x33de89||null);}},'position':{'type':Sequelize[_0x2a3e('0xb')]},'count':{'type':Sequelize[_0x2a3e('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a3e('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x2a3e('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2a3e('0x2')],'comment':_0x2a3e('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x2a3e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2a3e('0x2')]},'accountcode':{'type':Sequelize[_0x2a3e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2a3e('0x2')]},'priority':{'type':Sequelize[_0x2a3e('0x2')]},'holdtime':{'type':Sequelize[_0x2a3e('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2a3e('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2a3e('0x2')]},'transfer':{'type':Sequelize[_0x2a3e('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2a3e('0xe')},'transferexten':{'type':Sequelize[_0x2a3e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2a3e('0x2')]},'disposition':{'type':Sequelize[_0x2a3e('0x2')]},'secondDisposition':{'type':Sequelize[_0x2a3e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2a3e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2a3e('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x2a3e('0x2')]}}; \ No newline at end of file +var _0xf544=['BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER'];(function(_0x4a0af5,_0x19c2ab){var _0x359b72=function(_0x329ee5){while(--_0x329ee5){_0x4a0af5['push'](_0x4a0af5['shift']());}};_0x359b72(++_0x19c2ab);}(_0xf544,0x1c1));var _0x4f54=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf544[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4f54('0x0'));module[_0x4f54('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4f54('0x2')]},'calleridnum':{'type':Sequelize[_0x4f54('0x2')]},'calleridname':{'type':Sequelize[_0x4f54('0x2')]},'queue':{'type':Sequelize[_0x4f54('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x4f54('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x4f54('0x3')],'set':function(_0x572335){var _0x2f7890=moment(_0x572335);var _0x398041=moment(this[_0x4f54('0x4')](_0x4f54('0x5')))['format'](_0x4f54('0x6'));var _0x4b3ea8=_0x2f7890[_0x4f54('0x7')](_0x398041,_0x4f54('0x8'));this['setDataValue'](_0x4f54('0x9'),_0x572335);this[_0x4f54('0xa')](_0x4f54('0xb'),_0x4b3ea8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x4f54('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4f54('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4f54('0x3')]},'queuecallerexit':{'type':Sequelize[_0x4f54('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4f54('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x4f54('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x4f54('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4f54('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f54('0x2')]},'accountcode':{'type':Sequelize[_0x4f54('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4f54('0x2')]},'priority':{'type':Sequelize[_0x4f54('0x2')]},'holdtime':{'type':Sequelize[_0x4f54('0xc')]},'mohtime':{'type':Sequelize[_0x4f54('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4f54('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4f54('0x2')]},'transfer':{'type':Sequelize[_0x4f54('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f54('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4f54('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4f54('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4f54('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4f54('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x4f54('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x4f54('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 4ac438f..1511a91 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 _0xf5ef=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x2721ae,_0x162c17){var _0x1438df=function(_0x39ed24){while(--_0x39ed24){_0x2721ae['push'](_0x2721ae['shift']());}};_0x1438df(++_0x162c17);}(_0xf5ef,0xf5));var _0xff5e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xf5ef[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xff5e('0x0'));var rimraf=require(_0xff5e('0x1'));var zipdir=require(_0xff5e('0x2'));var jsonpatch=require(_0xff5e('0x3'));var rp=require(_0xff5e('0x4'));var moment=require(_0xff5e('0x5'));var BPromise=require(_0xff5e('0x6'));var Mustache=require(_0xff5e('0x7'));var util=require(_0xff5e('0x8'));var path=require(_0xff5e('0x9'));var sox=require(_0xff5e('0xa'));var csv=require(_0xff5e('0xb'));var ejs=require(_0xff5e('0xc'));var fs=require('fs');var fs_extra=require(_0xff5e('0xd'));var _=require(_0xff5e('0xe'));var squel=require(_0xff5e('0xf'));var crypto=require(_0xff5e('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xff5e('0x11'));var toCsv=require(_0xff5e('0xb'));var querystring=require(_0xff5e('0x12'));var Papa=require(_0xff5e('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff5e('0x14'));var as=require(_0xff5e('0x15'));var hardwareService=require(_0xff5e('0x16'));var logger=require(_0xff5e('0x17'))('api');var utils=require(_0xff5e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xff5e('0x19'));var db=require(_0xff5e('0x1a'))['db'];config[_0xff5e('0x1b')]=_['defaults'](config[_0xff5e('0x1b')],{'host':_0xff5e('0x1c'),'port':0x18eb});var socket=require(_0xff5e('0x1d'))(new Redis(config[_0xff5e('0x1b')]));require('./voiceQueueReport.socket')[_0xff5e('0x1e')](socket);function respondWithStatusCode(_0x39c86d,_0xd2e5be){_0xd2e5be=_0xd2e5be||0xcc;return function(_0x4b3185){if(_0x4b3185){return _0x39c86d[_0xff5e('0x1f')](_0xd2e5be);}return _0x39c86d[_0xff5e('0x20')](_0xd2e5be)[_0xff5e('0x21')]();};}function respondWithResult(_0x452007,_0xd0fc5f){_0xd0fc5f=_0xd0fc5f||0xc8;return function(_0x160470){if(_0x160470){return _0x452007['status'](_0xd0fc5f)[_0xff5e('0x22')](_0x160470);}};}function respondWithFilteredResult(_0x1e5b2c,_0x195b8f){return function(_0x1a057e){if(_0x1a057e){var _0x58b324=typeof _0x195b8f[_0xff5e('0x23')]==='undefined'&&typeof _0x195b8f[_0xff5e('0x24')]===_0xff5e('0x25');var _0x521ead=_0x1a057e[_0xff5e('0x26')];var _0x41669c=_0x58b324?0x0:_0x195b8f[_0xff5e('0x23')];var _0x4b797b=_0x58b324?_0x1a057e[_0xff5e('0x26')]:_0x195b8f[_0xff5e('0x23')]+_0x195b8f['limit'];var _0x7c9885;if(_0x4b797b>=_0x521ead){_0x4b797b=_0x521ead;_0x7c9885=0xc8;}else{_0x7c9885=0xce;}_0x1e5b2c[_0xff5e('0x20')](_0x7c9885);return _0x1e5b2c[_0xff5e('0x27')](_0xff5e('0x28'),_0x41669c+'-'+_0x4b797b+'/'+_0x521ead)[_0xff5e('0x22')](_0x1a057e);}return null;};}function patchUpdates(_0x37e2f1){return function(_0xbc764f){try{jsonpatch[_0xff5e('0x29')](_0xbc764f,_0x37e2f1,!![]);}catch(_0x24ff51){return BPromise[_0xff5e('0x2a')](_0x24ff51);}return _0xbc764f[_0xff5e('0x2b')]();};}function saveUpdates(_0x3ef71d,_0x2c6755){return function(_0x314e29){if(_0x314e29){return _0x314e29[_0xff5e('0x2c')](_0x3ef71d)[_0xff5e('0x2d')](function(_0x1a55b1){return _0x1a55b1;});}return null;};}function removeEntity(_0x54a8b2,_0x437b0f){return function(_0x1ef5ba){if(_0x1ef5ba){return _0x1ef5ba[_0xff5e('0x2e')]()[_0xff5e('0x2d')](function(){_0x54a8b2[_0xff5e('0x20')](0xcc)[_0xff5e('0x21')]();});}};}function handleEntityNotFound(_0x544e54,_0x2461b){return function(_0x5c992f){if(!_0x5c992f){_0x544e54[_0xff5e('0x1f')](0x194);}return _0x5c992f;};}function handleError(_0x3259dc,_0x178e82){_0x178e82=_0x178e82||0x1f4;return function(_0x19b66b){logger['error'](_0x19b66b[_0xff5e('0x2f')]);if(_0x19b66b['name']){delete _0x19b66b[_0xff5e('0x30')];}_0x3259dc[_0xff5e('0x20')](_0x178e82)['send'](_0x19b66b);};}exports[_0xff5e('0x31')]=function(_0x419599,_0x587c75){var _0x2221c7={},_0x526680={},_0x154dda={'count':0x0,'rows':[]};var _0x2d68e3=_[_0xff5e('0x32')](db[_0xff5e('0x33')]['rawAttributes'],function(_0xf09421){return{'name':_0xf09421[_0xff5e('0x34')],'type':_0xf09421['type'][_0xff5e('0x35')]};});_0x526680[_0xff5e('0x36')]=_['map'](_0x2d68e3,_0xff5e('0x30'));_0x526680[_0xff5e('0x37')]=_[_0xff5e('0x38')](_0x419599['query']);_0x526680[_0xff5e('0x39')]=_[_0xff5e('0x3a')](_0x526680[_0xff5e('0x36')],_0x526680[_0xff5e('0x37')]);_0x2221c7[_0xff5e('0x3b')]=_[_0xff5e('0x3a')](_0x526680[_0xff5e('0x36')],qs[_0xff5e('0x3c')](_0x419599['query'][_0xff5e('0x3c')]));_0x2221c7[_0xff5e('0x3b')]=_0x2221c7[_0xff5e('0x3b')][_0xff5e('0x3d')]?_0x2221c7['attributes']:_0x526680[_0xff5e('0x36')];if(!_0x419599[_0xff5e('0x37')][_0xff5e('0x3e')](_0xff5e('0x3f'))){_0x2221c7[_0xff5e('0x24')]=qs['limit'](_0x419599[_0xff5e('0x37')]['limit']);_0x2221c7[_0xff5e('0x23')]=qs[_0xff5e('0x23')](_0x419599['query'][_0xff5e('0x23')]);}_0x2221c7[_0xff5e('0x40')]=qs[_0xff5e('0x41')](_0x419599[_0xff5e('0x37')][_0xff5e('0x41')]);_0x2221c7[_0xff5e('0x42')]=qs[_0xff5e('0x39')](_[_0xff5e('0x43')](_0x419599[_0xff5e('0x37')],_0x526680[_0xff5e('0x39')]),_0x2d68e3);if(_0x419599[_0xff5e('0x37')][_0xff5e('0x44')]){_0x2221c7['where']=_[_0xff5e('0x45')](_0x2221c7['where'],{'$or':_[_0xff5e('0x32')](_0x2d68e3,function(_0x1863d6){if(_0x1863d6[_0xff5e('0x46')]!==_0xff5e('0x47')){var _0x4c119a={};_0x4c119a[_0x1863d6[_0xff5e('0x30')]]={'$like':'%'+_0x419599[_0xff5e('0x37')]['filter']+'%'};return _0x4c119a;}})});}_0x2221c7=_[_0xff5e('0x45')]({},_0x2221c7,_0x419599[_0xff5e('0x48')]);var _0x4a109a={'where':_0x2221c7['where']};return db[_0xff5e('0x33')][_0xff5e('0x26')](_0x4a109a)[_0xff5e('0x2d')](function(_0xb4a443){_0x154dda[_0xff5e('0x26')]=_0xb4a443;if(_0x419599['query'][_0xff5e('0x49')]){_0x2221c7[_0xff5e('0x4a')]=[{'all':!![]}];}return db[_0xff5e('0x33')][_0xff5e('0x4b')](_0x2221c7);})['then'](function(_0x2e6e85){_0x154dda[_0xff5e('0x4c')]=_0x2e6e85;return _0x154dda;})[_0xff5e('0x2d')](respondWithFilteredResult(_0x587c75,_0x2221c7))[_0xff5e('0x4d')](handleError(_0x587c75,null));};exports[_0xff5e('0x4e')]=function(_0x1c72f0,_0x182610){var _0x5613bc={'raw':![],'where':{'id':_0x1c72f0[_0xff5e('0x4f')]['id']}},_0x190dc={};_0x190dc['model']=_[_0xff5e('0x38')](db[_0xff5e('0x33')][_0xff5e('0x50')]);_0x190dc[_0xff5e('0x37')]=_[_0xff5e('0x38')](_0x1c72f0[_0xff5e('0x37')]);_0x190dc[_0xff5e('0x39')]=_[_0xff5e('0x3a')](_0x190dc[_0xff5e('0x36')],_0x190dc['query']);_0x5613bc[_0xff5e('0x3b')]=_[_0xff5e('0x3a')](_0x190dc[_0xff5e('0x36')],qs[_0xff5e('0x3c')](_0x1c72f0[_0xff5e('0x37')]['fields']));_0x5613bc[_0xff5e('0x3b')]=_0x5613bc[_0xff5e('0x3b')]['length']?_0x5613bc[_0xff5e('0x3b')]:_0x190dc['model'];if(_0x1c72f0[_0xff5e('0x37')][_0xff5e('0x49')]){_0x5613bc[_0xff5e('0x4a')]=[{'all':!![]}];}_0x5613bc=_[_0xff5e('0x45')]({},_0x5613bc,_0x1c72f0[_0xff5e('0x48')]);return db[_0xff5e('0x33')][_0xff5e('0x51')](_0x5613bc)[_0xff5e('0x2d')](handleEntityNotFound(_0x182610,null))[_0xff5e('0x2d')](respondWithResult(_0x182610,null))[_0xff5e('0x4d')](handleError(_0x182610,null));};exports[_0xff5e('0x52')]=function(_0xf5951a,_0x2241e3){return db[_0xff5e('0x33')]['create'](_0xf5951a[_0xff5e('0x53')],{})[_0xff5e('0x2d')](respondWithResult(_0x2241e3,0xc9))[_0xff5e('0x4d')](handleError(_0x2241e3,null));};exports[_0xff5e('0x2c')]=function(_0x549536,_0x387e76){if(_0x549536['body']['id']){delete _0x549536[_0xff5e('0x53')]['id'];}return db['VoiceQueueReport'][_0xff5e('0x51')]({'where':{'id':_0x549536[_0xff5e('0x4f')]['id']}})[_0xff5e('0x2d')](handleEntityNotFound(_0x387e76,null))[_0xff5e('0x2d')](saveUpdates(_0x549536[_0xff5e('0x53')],null))[_0xff5e('0x2d')](respondWithResult(_0x387e76,null))[_0xff5e('0x4d')](handleError(_0x387e76,null));};exports['destroy']=function(_0x23fa1d,_0xf6bbe7){return db[_0xff5e('0x33')][_0xff5e('0x51')]({'where':{'id':_0x23fa1d[_0xff5e('0x4f')]['id']}})[_0xff5e('0x2d')](handleEntityNotFound(_0xf6bbe7,null))['then'](removeEntity(_0xf6bbe7,null))[_0xff5e('0x4d')](handleError(_0xf6bbe7,null));};exports[_0xff5e('0x54')]=function(_0xfe428f,_0x5b58fa){return db['VoiceQueueReport'][_0xff5e('0x54')]()[_0xff5e('0x2d')](respondWithResult(_0x5b58fa,null))[_0xff5e('0x4d')](handleError(_0x5b58fa,null));};exports['getVoiceQueuesReport']=function(_0x426c85,_0x1c894a){var _0x2574b9={},_0x1787c9={},_0x5a8435={'count':0x0,'rows':[]};_0x1787c9[_0xff5e('0x36')]=_['keys'](db[_0xff5e('0x33')]['rawAttributes']);_0x1787c9[_0xff5e('0x37')]=_[_0xff5e('0x38')](_0x426c85[_0xff5e('0x37')]);_0x1787c9[_0xff5e('0x39')]=_[_0xff5e('0x3a')](_0x1787c9[_0xff5e('0x36')],_0x1787c9[_0xff5e('0x37')]);_0x2574b9[_0xff5e('0x3b')]=_[_0xff5e('0x3a')](_0x1787c9[_0xff5e('0x36')],qs[_0xff5e('0x3c')](_0x426c85[_0xff5e('0x37')][_0xff5e('0x3c')]));_0x2574b9['attributes']=_0x2574b9[_0xff5e('0x3b')][_0xff5e('0x3d')]?_0x2574b9[_0xff5e('0x3b')]:_0x1787c9['model'];if(!_0x426c85['query'][_0xff5e('0x3e')]('nolimit')){_0x2574b9[_0xff5e('0x24')]=qs[_0xff5e('0x24')](_0x426c85[_0xff5e('0x37')][_0xff5e('0x24')]);_0x2574b9[_0xff5e('0x23')]=qs['offset'](_0x426c85[_0xff5e('0x37')][_0xff5e('0x23')]);}_0x2574b9[_0xff5e('0x40')]=qs[_0xff5e('0x41')](_0x426c85[_0xff5e('0x37')][_0xff5e('0x41')]);_0x2574b9[_0xff5e('0x42')]=qs['filters'](_[_0xff5e('0x43')](_0x426c85[_0xff5e('0x37')],_0x1787c9['filters']));if(_0x426c85[_0xff5e('0x37')][_0xff5e('0x44')]){_0x2574b9[_0xff5e('0x42')]=_[_0xff5e('0x45')](_0x2574b9[_0xff5e('0x42')],{'$or':_[_0xff5e('0x32')](_0x2574b9[_0xff5e('0x3b')],function(_0x4aae1e){var _0x29252e={};_0x29252e[_0x4aae1e]={'$like':'%'+_0x426c85[_0xff5e('0x37')][_0xff5e('0x44')]+'%'};return _0x29252e;})});}_0x2574b9=_['merge']({},_0x2574b9,_0x426c85['options']);var _0x2a2bbe={'where':_0x2574b9[_0xff5e('0x42')]};return db[_0xff5e('0x33')][_0xff5e('0x26')](_0x2a2bbe)[_0xff5e('0x2d')](function(_0xe6a8b2){_0x5a8435[_0xff5e('0x26')]=_0xe6a8b2;if(_0x426c85[_0xff5e('0x37')][_0xff5e('0x49')]){_0x2574b9['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2574b9);})['then'](function(_0x64fcb9){_0x5a8435['rows']=_0x64fcb9;return _0x5a8435;})[_0xff5e('0x2d')](respondWithFilteredResult(_0x1c894a,_0x2574b9,_0xff5e('0x55')))['catch'](handleError(_0x1c894a,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x4d70=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','describe','getVoiceQueuesReport','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register'];(function(_0x5299e1,_0x23c6f1){var _0x1fe633=function(_0x112aaf){while(--_0x112aaf){_0x5299e1['push'](_0x5299e1['shift']());}};_0x1fe633(++_0x23c6f1);}(_0x4d70,0x1d0));var _0x04d7=function(_0x531b74,_0x3a473b){_0x531b74=_0x531b74-0x0;var _0x513d17=_0x4d70[_0x531b74];return _0x513d17;};'use strict';var emlformat=require(_0x04d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04d7('0x2'));var moment=require(_0x04d7('0x3'));var BPromise=require(_0x04d7('0x4'));var Mustache=require(_0x04d7('0x5'));var util=require(_0x04d7('0x6'));var path=require(_0x04d7('0x7'));var sox=require(_0x04d7('0x8'));var csv=require(_0x04d7('0x9'));var ejs=require(_0x04d7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04d7('0xb'));var squel=require(_0x04d7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x04d7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x04d7('0xe'));var Papa=require(_0x04d7('0xf'));var Redis=require(_0x04d7('0x10'));var authService=require(_0x04d7('0x11'));var qs=require(_0x04d7('0x12'));var as=require(_0x04d7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x04d7('0x14'));var utils=require('../../config/utils');var config=require(_0x04d7('0x15'));var licenseUtil=require(_0x04d7('0x16'));var db=require(_0x04d7('0x17'))['db'];config[_0x04d7('0x18')]=_[_0x04d7('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x04d7('0x1a'))(new Redis(config[_0x04d7('0x18')]));require('./voiceQueueReport.socket')[_0x04d7('0x1b')](socket);function respondWithStatusCode(_0x35e0be,_0x35a02d){_0x35a02d=_0x35a02d||0xcc;return function(_0x21effd){if(_0x21effd){return _0x35e0be[_0x04d7('0x1c')](_0x35a02d);}return _0x35e0be[_0x04d7('0x1d')](_0x35a02d)[_0x04d7('0x1e')]();};}function respondWithResult(_0x1dd196,_0x226368){_0x226368=_0x226368||0xc8;return function(_0x46383b){if(_0x46383b){return _0x1dd196[_0x04d7('0x1d')](_0x226368)[_0x04d7('0x1f')](_0x46383b);}};}function respondWithFilteredResult(_0x3b65c8,_0x3b3584){return function(_0x131f63){if(_0x131f63){var _0x4a212d=typeof _0x3b3584[_0x04d7('0x20')]===_0x04d7('0x21')&&typeof _0x3b3584[_0x04d7('0x22')]==='undefined';var _0x38f3fa=_0x131f63[_0x04d7('0x23')];var _0x256769=_0x4a212d?0x0:_0x3b3584[_0x04d7('0x20')];var _0x294fe5=_0x4a212d?_0x131f63['count']:_0x3b3584[_0x04d7('0x20')]+_0x3b3584[_0x04d7('0x22')];var _0x461e6b;if(_0x294fe5>=_0x38f3fa){_0x294fe5=_0x38f3fa;_0x461e6b=0xc8;}else{_0x461e6b=0xce;}_0x3b65c8[_0x04d7('0x1d')](_0x461e6b);return _0x3b65c8[_0x04d7('0x24')](_0x04d7('0x25'),_0x256769+'-'+_0x294fe5+'/'+_0x38f3fa)[_0x04d7('0x1f')](_0x131f63);}return null;};}function patchUpdates(_0x570721){return function(_0x544bf0){try{jsonpatch[_0x04d7('0x26')](_0x544bf0,_0x570721,!![]);}catch(_0x4dbf45){return BPromise['reject'](_0x4dbf45);}return _0x544bf0[_0x04d7('0x27')]();};}function saveUpdates(_0x4804f2,_0x387f4f){return function(_0x529f75){if(_0x529f75){return _0x529f75[_0x04d7('0x28')](_0x4804f2)[_0x04d7('0x29')](function(_0x1153c3){return _0x1153c3;});}return null;};}function removeEntity(_0x53a29f,_0x7bd822){return function(_0xf55e0e){if(_0xf55e0e){return _0xf55e0e['destroy']()['then'](function(){_0x53a29f[_0x04d7('0x1d')](0xcc)[_0x04d7('0x1e')]();});}};}function handleEntityNotFound(_0x3d2c69,_0x13982d){return function(_0x50bdfb){if(!_0x50bdfb){_0x3d2c69[_0x04d7('0x1c')](0x194);}return _0x50bdfb;};}function handleError(_0x5e264e,_0x20be6b){_0x20be6b=_0x20be6b||0x1f4;return function(_0x2f189b){logger[_0x04d7('0x2a')](_0x2f189b[_0x04d7('0x2b')]);if(_0x2f189b[_0x04d7('0x2c')]){delete _0x2f189b[_0x04d7('0x2c')];}_0x5e264e[_0x04d7('0x1d')](_0x20be6b)[_0x04d7('0x2d')](_0x2f189b);};}exports[_0x04d7('0x2e')]=function(_0x227369,_0x56c464){var _0x32277d={},_0x34500a={},_0x150f54={'count':0x0,'rows':[]};var _0x2f08ed=_[_0x04d7('0x2f')](db[_0x04d7('0x30')][_0x04d7('0x31')],function(_0x4e731d){return{'name':_0x4e731d[_0x04d7('0x32')],'type':_0x4e731d[_0x04d7('0x33')][_0x04d7('0x34')]};});_0x34500a[_0x04d7('0x35')]=_[_0x04d7('0x2f')](_0x2f08ed,_0x04d7('0x2c'));_0x34500a[_0x04d7('0x36')]=_[_0x04d7('0x37')](_0x227369[_0x04d7('0x36')]);_0x34500a[_0x04d7('0x38')]=_[_0x04d7('0x39')](_0x34500a[_0x04d7('0x35')],_0x34500a[_0x04d7('0x36')]);_0x32277d[_0x04d7('0x3a')]=_[_0x04d7('0x39')](_0x34500a[_0x04d7('0x35')],qs[_0x04d7('0x3b')](_0x227369['query'][_0x04d7('0x3b')]));_0x32277d[_0x04d7('0x3a')]=_0x32277d[_0x04d7('0x3a')][_0x04d7('0x3c')]?_0x32277d[_0x04d7('0x3a')]:_0x34500a[_0x04d7('0x35')];if(!_0x227369[_0x04d7('0x36')][_0x04d7('0x3d')](_0x04d7('0x3e'))){_0x32277d[_0x04d7('0x22')]=qs['limit'](_0x227369[_0x04d7('0x36')][_0x04d7('0x22')]);_0x32277d[_0x04d7('0x20')]=qs[_0x04d7('0x20')](_0x227369[_0x04d7('0x36')][_0x04d7('0x20')]);}_0x32277d[_0x04d7('0x3f')]=qs[_0x04d7('0x40')](_0x227369[_0x04d7('0x36')][_0x04d7('0x40')]);_0x32277d[_0x04d7('0x41')]=qs[_0x04d7('0x38')](_[_0x04d7('0x42')](_0x227369[_0x04d7('0x36')],_0x34500a[_0x04d7('0x38')]),_0x2f08ed);if(_0x227369[_0x04d7('0x36')][_0x04d7('0x43')]){_0x32277d[_0x04d7('0x41')]=_[_0x04d7('0x44')](_0x32277d[_0x04d7('0x41')],{'$or':_[_0x04d7('0x2f')](_0x2f08ed,function(_0x4825b4){if(_0x4825b4['type']!==_0x04d7('0x45')){var _0x783326={};_0x783326[_0x4825b4[_0x04d7('0x2c')]]={'$like':'%'+_0x227369[_0x04d7('0x36')]['filter']+'%'};return _0x783326;}})});}_0x32277d=_['merge']({},_0x32277d,_0x227369[_0x04d7('0x46')]);var _0x5c0eae={'where':_0x32277d[_0x04d7('0x41')]};return db[_0x04d7('0x30')][_0x04d7('0x23')](_0x5c0eae)[_0x04d7('0x29')](function(_0x11ac0b){_0x150f54[_0x04d7('0x23')]=_0x11ac0b;if(_0x227369[_0x04d7('0x36')][_0x04d7('0x47')]){_0x32277d[_0x04d7('0x48')]=[{'all':!![]}];}return db[_0x04d7('0x30')]['findAll'](_0x32277d);})[_0x04d7('0x29')](function(_0x2f2e8c){_0x150f54['rows']=_0x2f2e8c;return _0x150f54;})[_0x04d7('0x29')](respondWithFilteredResult(_0x56c464,_0x32277d))[_0x04d7('0x49')](handleError(_0x56c464,null));};exports['show']=function(_0xfae39e,_0x33639f){var _0x32b103={'raw':![],'where':{'id':_0xfae39e[_0x04d7('0x4a')]['id']}},_0x351b46={};_0x351b46[_0x04d7('0x35')]=_[_0x04d7('0x37')](db[_0x04d7('0x30')][_0x04d7('0x31')]);_0x351b46['query']=_['keys'](_0xfae39e[_0x04d7('0x36')]);_0x351b46[_0x04d7('0x38')]=_[_0x04d7('0x39')](_0x351b46['model'],_0x351b46[_0x04d7('0x36')]);_0x32b103['attributes']=_[_0x04d7('0x39')](_0x351b46[_0x04d7('0x35')],qs[_0x04d7('0x3b')](_0xfae39e[_0x04d7('0x36')][_0x04d7('0x3b')]));_0x32b103[_0x04d7('0x3a')]=_0x32b103[_0x04d7('0x3a')][_0x04d7('0x3c')]?_0x32b103[_0x04d7('0x3a')]:_0x351b46[_0x04d7('0x35')];if(_0xfae39e[_0x04d7('0x36')][_0x04d7('0x47')]){_0x32b103[_0x04d7('0x48')]=[{'all':!![]}];}_0x32b103=_[_0x04d7('0x44')]({},_0x32b103,_0xfae39e[_0x04d7('0x46')]);return db['VoiceQueueReport'][_0x04d7('0x4b')](_0x32b103)[_0x04d7('0x29')](handleEntityNotFound(_0x33639f,null))[_0x04d7('0x29')](respondWithResult(_0x33639f,null))['catch'](handleError(_0x33639f,null));};exports['create']=function(_0x53cf34,_0x2a1817){return db[_0x04d7('0x30')][_0x04d7('0x4c')](_0x53cf34[_0x04d7('0x4d')],{})[_0x04d7('0x29')](respondWithResult(_0x2a1817,0xc9))[_0x04d7('0x49')](handleError(_0x2a1817,null));};exports[_0x04d7('0x28')]=function(_0x4dbd8c,_0x12d698){if(_0x4dbd8c['body']['id']){delete _0x4dbd8c[_0x04d7('0x4d')]['id'];}return db[_0x04d7('0x30')][_0x04d7('0x4b')]({'where':{'id':_0x4dbd8c['params']['id']}})[_0x04d7('0x29')](handleEntityNotFound(_0x12d698,null))[_0x04d7('0x29')](saveUpdates(_0x4dbd8c['body'],null))[_0x04d7('0x29')](respondWithResult(_0x12d698,null))['catch'](handleError(_0x12d698,null));};exports['destroy']=function(_0x22e931,_0x5864bc){return db['VoiceQueueReport'][_0x04d7('0x4b')]({'where':{'id':_0x22e931[_0x04d7('0x4a')]['id']}})[_0x04d7('0x29')](handleEntityNotFound(_0x5864bc,null))[_0x04d7('0x29')](removeEntity(_0x5864bc,null))[_0x04d7('0x49')](handleError(_0x5864bc,null));};exports[_0x04d7('0x4e')]=function(_0x435360,_0x21462a){return db[_0x04d7('0x30')]['describe']()[_0x04d7('0x29')](respondWithResult(_0x21462a,null))[_0x04d7('0x49')](handleError(_0x21462a,null));};exports[_0x04d7('0x4f')]=function(_0x859ef8,_0x3eb3a6){var _0x5bb985={},_0x1d32ee={},_0xe12859={'count':0x0,'rows':[]};_0x1d32ee['model']=_['keys'](db['VoiceQueueReport']['rawAttributes']);_0x1d32ee[_0x04d7('0x36')]=_[_0x04d7('0x37')](_0x859ef8[_0x04d7('0x36')]);_0x1d32ee[_0x04d7('0x38')]=_[_0x04d7('0x39')](_0x1d32ee[_0x04d7('0x35')],_0x1d32ee[_0x04d7('0x36')]);_0x5bb985[_0x04d7('0x3a')]=_[_0x04d7('0x39')](_0x1d32ee[_0x04d7('0x35')],qs[_0x04d7('0x3b')](_0x859ef8[_0x04d7('0x36')]['fields']));_0x5bb985[_0x04d7('0x3a')]=_0x5bb985[_0x04d7('0x3a')][_0x04d7('0x3c')]?_0x5bb985[_0x04d7('0x3a')]:_0x1d32ee[_0x04d7('0x35')];if(!_0x859ef8[_0x04d7('0x36')]['hasOwnProperty'](_0x04d7('0x3e'))){_0x5bb985[_0x04d7('0x22')]=qs[_0x04d7('0x22')](_0x859ef8[_0x04d7('0x36')][_0x04d7('0x22')]);_0x5bb985['offset']=qs[_0x04d7('0x20')](_0x859ef8[_0x04d7('0x36')][_0x04d7('0x20')]);}_0x5bb985[_0x04d7('0x3f')]=qs['sort'](_0x859ef8[_0x04d7('0x36')][_0x04d7('0x40')]);_0x5bb985['where']=qs[_0x04d7('0x38')](_[_0x04d7('0x42')](_0x859ef8[_0x04d7('0x36')],_0x1d32ee[_0x04d7('0x38')]));if(_0x859ef8['query']['filter']){_0x5bb985['where']=_[_0x04d7('0x44')](_0x5bb985[_0x04d7('0x41')],{'$or':_[_0x04d7('0x2f')](_0x5bb985['attributes'],function(_0x15c826){var _0x59468c={};_0x59468c[_0x15c826]={'$like':'%'+_0x859ef8['query'][_0x04d7('0x43')]+'%'};return _0x59468c;})});}_0x5bb985=_[_0x04d7('0x44')]({},_0x5bb985,_0x859ef8[_0x04d7('0x46')]);var _0x4670b8={'where':_0x5bb985[_0x04d7('0x41')]};return db[_0x04d7('0x30')][_0x04d7('0x23')](_0x4670b8)[_0x04d7('0x29')](function(_0x3085d0){_0xe12859[_0x04d7('0x23')]=_0x3085d0;if(_0x859ef8[_0x04d7('0x36')][_0x04d7('0x47')]){_0x5bb985['include']=[{'all':!![]}];}return db[_0x04d7('0x30')][_0x04d7('0x50')](_0x5bb985);})[_0x04d7('0x29')](function(_0x76b3e9){_0xe12859[_0x04d7('0x51')]=_0x76b3e9;return _0xe12859;})[_0x04d7('0x29')](respondWithFilteredResult(_0x3eb3a6,_0x5bb985,_0x04d7('0x4f')))[_0x04d7('0x49')](handleError(_0x3eb3a6,null,_0x04d7('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ddc177a..2d44c7a 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 _0xfcf1=['../../mysqldb','VoiceQueueReport','save','update','remove','hasOwnProperty','exports','events'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfcf1,0x87));var _0x1fcf=function(_0x223c13,_0x2c4e2a){_0x223c13=_0x223c13-0x0;var _0x406055=_0xfcf1[_0x223c13];return _0x406055;};'use strict';var EventEmitter=require(_0x1fcf('0x0'));var VoiceQueueReport=require(_0x1fcf('0x1'))['db'][_0x1fcf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1fcf('0x3'),'afterUpdate':_0x1fcf('0x4'),'afterDestroy':_0x1fcf('0x5')};function emitEvent(_0x2c3fa1){return function(_0x4ba0cb,_0x36189c,_0x2421dd){VoiceQueueReportEvents['emit'](_0x2c3fa1+':'+_0x4ba0cb['id'],_0x4ba0cb);VoiceQueueReportEvents['emit'](_0x2c3fa1,_0x4ba0cb);_0x2421dd(null);};}for(var e in events){if(events[_0x1fcf('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x1fcf('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9874=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceQueueReport'];(function(_0x3d5a15,_0x55c422){var _0x19673d=function(_0x1972cb){while(--_0x1972cb){_0x3d5a15['push'](_0x3d5a15['shift']());}};_0x19673d(++_0x55c422);}(_0x9874,0x1a2));var _0x4987=function(_0x4617b4,_0x4e09fd){_0x4617b4=_0x4617b4-0x0;var _0x374d78=_0x9874[_0x4617b4];return _0x374d78;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4987('0x0'))['db'][_0x4987('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4987('0x2'),'afterUpdate':'update','afterDestroy':_0x4987('0x3')};function emitEvent(_0x26030f){return function(_0x3a62d1,_0x543b20,_0x428a54){VoiceQueueReportEvents['emit'](_0x26030f+':'+_0x3a62d1['id'],_0x3a62d1);VoiceQueueReportEvents[_0x4987('0x4')](_0x26030f,_0x3a62d1);_0x428a54(null);};}for(var e in events){if(events[_0x4987('0x5')](e)){var event=events[e];VoiceQueueReport[_0x4987('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f86e6de..c8f2c9d 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 _0x2bc3=['bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x2bc3,0x1ae));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x32bc('0x0'));var util=require(_0x32bc('0x1'));var logger=require(_0x32bc('0x2'))(_0x32bc('0x3'));var moment=require(_0x32bc('0x4'));var BPromise=require(_0x32bc('0x5'));var rp=require(_0x32bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32bc('0x7'));var config=require(_0x32bc('0x8'));var attributes=require(_0x32bc('0x9'));module[_0x32bc('0xa')]=function(_0x2c8ca5,_0xf64c6){return _0x2c8ca5[_0x32bc('0xb')](_0x32bc('0xc'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x32bc('0xd')]},{'fields':[_0x32bc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3628=['define','report_queue','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3e8353,_0x5e83bc){var _0x146bfa=function(_0x2f75bc){while(--_0x2f75bc){_0x3e8353['push'](_0x3e8353['shift']());}};_0x146bfa(++_0x5e83bc);}(_0x3628,0xff));var _0x8362=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x3628[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x8362('0x0'));var util=require(_0x8362('0x1'));var logger=require(_0x8362('0x2'))(_0x8362('0x3'));var moment=require(_0x8362('0x4'));var BPromise=require('bluebird');var rp=require(_0x8362('0x5'));var fs=require('fs');var path=require(_0x8362('0x6'));var rimraf=require(_0x8362('0x7'));var config=require(_0x8362('0x8'));var attributes=require(_0x8362('0x9'));module[_0x8362('0xa')]=function(_0x279b14,_0x2665bb){return _0x279b14[_0x8362('0xb')]('VoiceQueueReport',attributes,{'tableName':_0x8362('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x8362('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index be37b66..08cd3b1 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 _0x3451=['stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x19a41b,_0x59f827){var _0x3bd57d=function(_0x48db5e){while(--_0x48db5e){_0x19a41b['push'](_0x19a41b['shift']());}};_0x3bd57d(++_0x59f827);}(_0x3451,0x112));var _0x1345=function(_0x7c6b9f,_0x633a39){_0x7c6b9f=_0x7c6b9f-0x0;var _0x2d47e0=_0x3451[_0x7c6b9f];return _0x2d47e0;};'use strict';var _=require(_0x1345('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1345('0x1'));var fs=require('fs');var Redis=require(_0x1345('0x2'));var db=require(_0x1345('0x3'))['db'];var utils=require(_0x1345('0x4'));var logger=require(_0x1345('0x5'))(_0x1345('0x6'));var config=require(_0x1345('0x7'));var jayson=require(_0x1345('0x8'));var client=jayson[_0x1345('0x9')][_0x1345('0xa')]({'port':0x232a});config[_0x1345('0xb')]=_[_0x1345('0xc')](config[_0x1345('0xb')],{'host':_0x1345('0xd'),'port':0x18eb});var socket=require(_0x1345('0xe'))(new Redis(config[_0x1345('0xb')]));require(_0x1345('0xf'))['register'](socket);function respondWithRpcPromise(_0x49d2a2,_0x452ba4,_0x332917){return new BPromise(function(_0x29036e,_0x3ea1eb){return client['request'](_0x49d2a2,_0x332917)[_0x1345('0x10')](function(_0x424d37){logger[_0x1345('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x452ba4,_0x1345('0x12'));logger['debug'](_0x1345('0x13'),_0x452ba4,'request\x20sent',JSON[_0x1345('0x14')](_0x424d37));if(_0x424d37['error']){if(_0x424d37[_0x1345('0x15')][_0x1345('0x16')]===0x1f4){logger['error'](_0x1345('0x17'),_0x452ba4,_0x424d37[_0x1345('0x15')][_0x1345('0x18')]);return _0x3ea1eb(_0x424d37[_0x1345('0x15')]['message']);}logger[_0x1345('0x15')](_0x1345('0x17'),_0x452ba4,_0x424d37[_0x1345('0x15')]['message']);return _0x29036e(_0x424d37['error'][_0x1345('0x18')]);}else{logger['info'](_0x1345('0x17'),_0x452ba4,_0x1345('0x12'));_0x29036e(_0x424d37['result']['message']);}})[_0x1345('0x19')](function(_0x4795ea){logger[_0x1345('0x15')](_0x1345('0x17'),_0x452ba4,_0x4795ea);_0x3ea1eb(_0x4795ea);});});}exports[_0x1345('0x1a')]=function(_0x10cd22){var _0x2e7a7a=this;return new Promise(function(_0x3ed709,_0x2a229a){return db['VoiceQueueReport'][_0x1345('0x1b')]({'raw':_0x10cd22[_0x1345('0x1c')]?_0x10cd22[_0x1345('0x1c')][_0x1345('0x1d')]===undefined?!![]:![]:!![],'where':_0x10cd22[_0x1345('0x1c')]?_0x10cd22['options'][_0x1345('0x1e')]||null:null,'attributes':_0x10cd22[_0x1345('0x1c')]?_0x10cd22[_0x1345('0x1c')][_0x1345('0x1f')]||null:null,'limit':_0x10cd22[_0x1345('0x1c')]?_0x10cd22[_0x1345('0x1c')]['limit']||null:null,'include':_0x10cd22[_0x1345('0x1c')]?_0x10cd22[_0x1345('0x1c')][_0x1345('0x20')]?_[_0x1345('0x21')](_0x10cd22[_0x1345('0x1c')][_0x1345('0x20')],function(_0x5693cd){return{'model':db[_0x5693cd[_0x1345('0x22')]],'as':_0x5693cd['as'],'attributes':_0x5693cd[_0x1345('0x1f')],'include':_0x5693cd[_0x1345('0x20')]?_['map'](_0x5693cd[_0x1345('0x20')],function(_0x1631f9){return{'model':db[_0x1631f9[_0x1345('0x22')]],'as':_0x1631f9['as'],'attributes':_0x1631f9[_0x1345('0x1f')],'include':_0x1631f9[_0x1345('0x20')]?_[_0x1345('0x21')](_0x1631f9['include'],function(_0x67011f){return{'model':db[_0x67011f[_0x1345('0x22')]],'as':_0x67011f['as'],'attributes':_0x67011f[_0x1345('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1345('0x10')](function(_0x3d8b6a){logger['info']('GetVoiceQueueReport',_0x10cd22);logger[_0x1345('0x23')](_0x1345('0x1a'),_0x10cd22,JSON[_0x1345('0x14')](_0x3d8b6a));_0x3ed709(_0x3d8b6a);})[_0x1345('0x19')](function(_0xf81dd0){logger[_0x1345('0x15')]('GetVoiceQueueReport',_0xf81dd0[_0x1345('0x18')],_0x10cd22);_0x2a229a(_0x2e7a7a['error'](0x1f4,_0xf81dd0[_0x1345('0x18')]));});});};exports[_0x1345('0x24')]=function(_0x5f0112){var _0x5331d4=this;return new Promise(function(_0x12b330,_0x2a53bc){return db['VoiceQueueReport'][_0x1345('0x25')](_0x5f0112[_0x1345('0x26')],{'raw':_0x5f0112[_0x1345('0x1c')]?_0x5f0112[_0x1345('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x328eb9){logger[_0x1345('0x11')](_0x1345('0x24'),_0x5f0112);logger['debug']('CreateVoiceQueueReport',_0x5f0112,JSON[_0x1345('0x14')](_0x328eb9));_0x12b330(_0x328eb9);})[_0x1345('0x19')](function(_0xe2ec68){logger['error']('CreateVoiceQueueReport',_0xe2ec68['message'],_0x5f0112);_0x2a53bc(_0x5331d4[_0x1345('0x15')](0x1f4,_0xe2ec68[_0x1345('0x18')]));});});};exports[_0x1345('0x27')]=function(_0x1b8b11){var _0x25e96b=this;return new Promise(function(_0x125f98,_0x3151d3){return db[_0x1345('0x28')]['update'](_0x1b8b11[_0x1345('0x26')],{'raw':_0x1b8b11[_0x1345('0x1c')]?_0x1b8b11[_0x1345('0x1c')][_0x1345('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8b11[_0x1345('0x1c')]?_0x1b8b11[_0x1345('0x1c')][_0x1345('0x1e')]||null:null,'attributes':_0x1b8b11[_0x1345('0x1c')]?_0x1b8b11[_0x1345('0x1c')]['attributes']||null:null,'limit':_0x1b8b11['options']?_0x1b8b11['options'][_0x1345('0x29')]||null:null})[_0x1345('0x10')](function(_0x3ff9bd){logger[_0x1345('0x11')](_0x1345('0x27'),_0x1b8b11);logger[_0x1345('0x23')](_0x1345('0x27'),_0x1b8b11,JSON[_0x1345('0x14')](_0x3ff9bd));_0x125f98(_0x3ff9bd);})[_0x1345('0x19')](function(_0x1d083c){logger[_0x1345('0x15')](_0x1345('0x27'),_0x1d083c[_0x1345('0x18')],_0x1b8b11);_0x3151d3(_0x25e96b[_0x1345('0x15')](0x1f4,_0x1d083c['message']));});});}; \ No newline at end of file +var _0xb688=['redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','debug','catch','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xb688,0xc7));var _0x8b68=function(_0x4c0380,_0x428429){_0x4c0380=_0x4c0380-0x0;var _0x2baa7d=_0xb688[_0x4c0380];return _0x2baa7d;};'use strict';var _=require(_0x8b68('0x0'));var util=require(_0x8b68('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b68('0x2'));var fs=require('fs');var Redis=require(_0x8b68('0x3'));var db=require(_0x8b68('0x4'))['db'];var utils=require(_0x8b68('0x5'));var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});config[_0x8b68('0xb')]=_['defaults'](config[_0x8b68('0xb')],{'host':_0x8b68('0xc'),'port':0x18eb});var socket=require(_0x8b68('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x8b68('0xe')](socket);function respondWithRpcPromise(_0x1f9db3,_0x308244,_0x21480f){return new BPromise(function(_0x32adbc,_0x42c70b){return client[_0x8b68('0xf')](_0x1f9db3,_0x21480f)[_0x8b68('0x10')](function(_0x547261){logger[_0x8b68('0x11')](_0x8b68('0x12'),_0x308244,_0x8b68('0x13'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x308244,_0x8b68('0x13'),JSON[_0x8b68('0x14')](_0x547261));if(_0x547261[_0x8b68('0x15')]){if(_0x547261[_0x8b68('0x15')][_0x8b68('0x16')]===0x1f4){logger['error'](_0x8b68('0x12'),_0x308244,_0x547261[_0x8b68('0x15')][_0x8b68('0x17')]);return _0x42c70b(_0x547261['error'][_0x8b68('0x17')]);}logger[_0x8b68('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x308244,_0x547261[_0x8b68('0x15')][_0x8b68('0x17')]);return _0x32adbc(_0x547261['error'][_0x8b68('0x17')]);}else{logger[_0x8b68('0x11')](_0x8b68('0x12'),_0x308244,_0x8b68('0x13'));_0x32adbc(_0x547261[_0x8b68('0x18')][_0x8b68('0x17')]);}})['catch'](function(_0x58e99c){logger[_0x8b68('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x308244,_0x58e99c);_0x42c70b(_0x58e99c);});});}exports[_0x8b68('0x19')]=function(_0x4426ce){var _0x4b277e=this;return new Promise(function(_0x37c598,_0x29640f){return db[_0x8b68('0x1a')][_0x8b68('0x1b')]({'raw':_0x4426ce[_0x8b68('0x1c')]?_0x4426ce['options'][_0x8b68('0x1d')]===undefined?!![]:![]:!![],'where':_0x4426ce['options']?_0x4426ce[_0x8b68('0x1c')][_0x8b68('0x1e')]||null:null,'attributes':_0x4426ce[_0x8b68('0x1c')]?_0x4426ce[_0x8b68('0x1c')][_0x8b68('0x1f')]||null:null,'limit':_0x4426ce[_0x8b68('0x1c')]?_0x4426ce['options']['limit']||null:null,'include':_0x4426ce[_0x8b68('0x1c')]?_0x4426ce['options'][_0x8b68('0x20')]?_[_0x8b68('0x21')](_0x4426ce[_0x8b68('0x1c')][_0x8b68('0x20')],function(_0x1d8642){return{'model':db[_0x1d8642[_0x8b68('0x22')]],'as':_0x1d8642['as'],'attributes':_0x1d8642[_0x8b68('0x1f')],'include':_0x1d8642[_0x8b68('0x20')]?_[_0x8b68('0x21')](_0x1d8642[_0x8b68('0x20')],function(_0x2c20aa){return{'model':db[_0x2c20aa[_0x8b68('0x22')]],'as':_0x2c20aa['as'],'attributes':_0x2c20aa[_0x8b68('0x1f')],'include':_0x2c20aa[_0x8b68('0x20')]?_['map'](_0x2c20aa[_0x8b68('0x20')],function(_0xc31107){return{'model':db[_0xc31107['model']],'as':_0xc31107['as'],'attributes':_0xc31107['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b68('0x10')](function(_0x2bde5a){logger[_0x8b68('0x11')]('GetVoiceQueueReport',_0x4426ce);logger[_0x8b68('0x23')](_0x8b68('0x19'),_0x4426ce,JSON[_0x8b68('0x14')](_0x2bde5a));_0x37c598(_0x2bde5a);})[_0x8b68('0x24')](function(_0x423107){logger[_0x8b68('0x15')](_0x8b68('0x19'),_0x423107[_0x8b68('0x17')],_0x4426ce);_0x29640f(_0x4b277e[_0x8b68('0x15')](0x1f4,_0x423107[_0x8b68('0x17')]));});});};exports[_0x8b68('0x25')]=function(_0xfbb64c){var _0x572991=this;return new Promise(function(_0x32f876,_0x6cf9f6){return db[_0x8b68('0x1a')]['create'](_0xfbb64c[_0x8b68('0x26')],{'raw':_0xfbb64c[_0x8b68('0x1c')]?_0xfbb64c['options'][_0x8b68('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x57c9b7){logger['info'](_0x8b68('0x25'),_0xfbb64c);logger['debug'](_0x8b68('0x25'),_0xfbb64c,JSON[_0x8b68('0x14')](_0x57c9b7));_0x32f876(_0x57c9b7);})[_0x8b68('0x24')](function(_0x6367b0){logger[_0x8b68('0x15')](_0x8b68('0x25'),_0x6367b0[_0x8b68('0x17')],_0xfbb64c);_0x6cf9f6(_0x572991[_0x8b68('0x15')](0x1f4,_0x6367b0[_0x8b68('0x17')]));});});};exports[_0x8b68('0x27')]=function(_0x18fe50){var _0x3c80b2=this;return new Promise(function(_0x42b842,_0x333886){return db[_0x8b68('0x1a')][_0x8b68('0x28')](_0x18fe50['body'],{'raw':_0x18fe50[_0x8b68('0x1c')]?_0x18fe50[_0x8b68('0x1c')][_0x8b68('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18fe50[_0x8b68('0x1c')]?_0x18fe50[_0x8b68('0x1c')][_0x8b68('0x1e')]||null:null,'attributes':_0x18fe50[_0x8b68('0x1c')]?_0x18fe50[_0x8b68('0x1c')][_0x8b68('0x1f')]||null:null,'limit':_0x18fe50[_0x8b68('0x1c')]?_0x18fe50[_0x8b68('0x1c')][_0x8b68('0x29')]||null:null})[_0x8b68('0x10')](function(_0x371a74){logger[_0x8b68('0x11')](_0x8b68('0x27'),_0x18fe50);logger[_0x8b68('0x23')]('UpdateVoiceQueueReport',_0x18fe50,JSON['stringify'](_0x371a74));_0x42b842(_0x371a74);})[_0x8b68('0x24')](function(_0x3233e6){logger['error'](_0x8b68('0x27'),_0x3233e6[_0x8b68('0x17')],_0x18fe50);_0x333886(_0x3c80b2[_0x8b68('0x15')](0x1f4,_0x3233e6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b006141..8ca579c 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 _0x5eb8=['save','remove','removeListener','register','length'];(function(_0x5c9b35,_0x112dd5){var _0x20b56b=function(_0x261acf){while(--_0x261acf){_0x5c9b35['push'](_0x5c9b35['shift']());}};_0x20b56b(++_0x112dd5);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x5eb8[_0x180c9b];return _0x3ff116;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x85eb('0x0'),_0x85eb('0x1'),'update'];function createListener(_0x4e9ac4,_0x963724){return function(_0x2e57e9){_0x963724['emit'](_0x4e9ac4,_0x2e57e9);};}function removeListener(_0x41b11e,_0x30ac6a){return function(){VoiceQueueReportEvents[_0x85eb('0x2')](_0x41b11e,_0x30ac6a);};}exports[_0x85eb('0x3')]=function(_0x4c6606){for(var _0xec020a=0x0,_0x665c30=events[_0x85eb('0x4')];_0xec020a<_0x665c30;_0xec020a++){var _0x415299=events[_0xec020a];var _0x2a5cef=createListener('voiceQueueReport:'+_0x415299,_0x4c6606);VoiceQueueReportEvents['on'](_0x415299,_0x2a5cef);}}; \ No newline at end of file +var _0xf9d5=['length','voiceQueueReport:','save','remove','emit','removeListener'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf9d5,0x122));var _0x5f9d=function(_0x27062f,_0x43732a){_0x27062f=_0x27062f-0x0;var _0x30bcf9=_0xf9d5[_0x27062f];return _0x30bcf9;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x5f9d('0x0'),_0x5f9d('0x1'),'update'];function createListener(_0x1b4d74,_0xe4b9ee){return function(_0x21d986){_0xe4b9ee[_0x5f9d('0x2')](_0x1b4d74,_0x21d986);};}function removeListener(_0x25fa8c,_0xdd68fd){return function(){VoiceQueueReportEvents[_0x5f9d('0x3')](_0x25fa8c,_0xdd68fd);};}exports['register']=function(_0x1fc74c){for(var _0x59027b=0x0,_0x24999e=events[_0x5f9d('0x4')];_0x59027b<_0x24999e;_0x59027b++){var _0x4fb9f7=events[_0x59027b];var _0x3420b2=createListener(_0x5f9d('0x5')+_0x4fb9f7,_0x1fc74c);VoiceQueueReportEvents['on'](_0x4fb9f7,_0x3420b2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5af590e..7d7fbb7 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 _0x2194=['/:id','show','post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x122633,_0x28b158){var _0x8eb68f=function(_0x3c6795){while(--_0x3c6795){_0x122633['push'](_0x122633['shift']());}};_0x8eb68f(++_0x28b158);}(_0x2194,0x8d));var _0x4219=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2194[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require('multer');var util=require(_0x4219('0x0'));var path=require(_0x4219('0x1'));var timeout=require('connect-timeout');var express=require(_0x4219('0x2'));var router=express[_0x4219('0x3')]();var fs_extra=require(_0x4219('0x4'));var auth=require(_0x4219('0x5'));var interaction=require(_0x4219('0x6'));var config=require(_0x4219('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x4219('0x8')]('/',auth[_0x4219('0x9')](),controller[_0x4219('0xa')]);router[_0x4219('0x8')](_0x4219('0xb'),auth[_0x4219('0x9')](),controller[_0x4219('0xc')]);router[_0x4219('0xd')]('/',auth[_0x4219('0x9')](),controller[_0x4219('0xe')]);router['put'](_0x4219('0xb'),auth[_0x4219('0x9')](),controller[_0x4219('0xf')]);router[_0x4219('0x10')](_0x4219('0xb'),auth[_0x4219('0x9')](),controller[_0x4219('0x11')]);module[_0x4219('0x12')]=router; \ No newline at end of file +var _0x4b84=['../../components/interaction/service','../../config/environment','index','/:id','show','create','put','update','delete','isAuthenticated','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x22057f,_0x2fbb83){var _0x340c45=function(_0x269fb5){while(--_0x269fb5){_0x22057f['push'](_0x22057f['shift']());}};_0x340c45(++_0x2fbb83);}(_0x4b84,0x1cc));var _0x44b8=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4b84[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0xa')](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);router[_0x44b8('0xc')](_0x44b8('0x7'),auth[_0x44b8('0xd')](),controller[_0x44b8('0xe')]);module[_0x44b8('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ed4cd22..292cdc7 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 _0x409f=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x409f,0x1ac));var _0xf409=function(_0x29940f,_0x5c519a){_0x29940f=_0x29940f-0x0;var _0x342c30=_0x409f[_0x29940f];return _0x342c30;};'use strict';var Sequelize=require(_0xf409('0x0'));var moment=require(_0xf409('0x1'));module[_0xf409('0x2')]={'time':{'type':Sequelize[_0xf409('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf409('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf409('0x4')](_0xf409('0x5'))}}; \ No newline at end of file +var _0x0530=['sequelize','moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0530,0x93));var _0x0053=function(_0x557373,_0x434b2e){_0x557373=_0x557373-0x0;var _0x1eb75d=_0x0530[_0x557373];return _0x1eb75d;};'use strict';var Sequelize=require(_0x0053('0x0'));var moment=require(_0x0053('0x1'));module[_0x0053('0x2')]={'time':{'type':Sequelize[_0x0053('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0053('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0053('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x0053('0x5')](_0x0053('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 01cedcf..8f2845b 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 _0x918c=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','VoiceQueuesLog','type','map','query','keys','intersection','model','fields','attributes','length','order','sort','filters','where','VIRTUAL','filter','merge','options','findAll','catch','show','rawAttributes','includeAll','include','find','create','body','params','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0x918c,0x13e));var _0xc918=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x918c[_0x22b68a];return _0x1ac67a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc918('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc918('0x1'));var moment=require(_0xc918('0x2'));var BPromise=require(_0xc918('0x3'));var Mustache=require(_0xc918('0x4'));var util=require('util');var path=require(_0xc918('0x5'));var sox=require('sox');var csv=require(_0xc918('0x6'));var ejs=require(_0xc918('0x7'));var fs=require('fs');var fs_extra=require(_0xc918('0x8'));var _=require(_0xc918('0x9'));var squel=require(_0xc918('0xa'));var crypto=require(_0xc918('0xb'));var jsforce=require(_0xc918('0xc'));var deskjs=require(_0xc918('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc918('0xe'));var Papa=require('papaparse');var Redis=require(_0xc918('0xf'));var authService=require(_0xc918('0x10'));var qs=require(_0xc918('0x11'));var as=require(_0xc918('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc918('0x13'))(_0xc918('0x14'));var utils=require(_0xc918('0x15'));var config=require(_0xc918('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc918('0x17'))['db'];function respondWithStatusCode(_0x27bd1e,_0xa8c9a0){_0xa8c9a0=_0xa8c9a0||0xcc;return function(_0x4c4113){if(_0x4c4113){return _0x27bd1e['sendStatus'](_0xa8c9a0);}return _0x27bd1e[_0xc918('0x18')](_0xa8c9a0)[_0xc918('0x19')]();};}function respondWithResult(_0x383c9c,_0x408bf2){_0x408bf2=_0x408bf2||0xc8;return function(_0x2c53b2){if(_0x2c53b2){return _0x383c9c[_0xc918('0x18')](_0x408bf2)[_0xc918('0x1a')](_0x2c53b2);}};}function respondWithFilteredResult(_0x3e659d,_0x40a323){return function(_0x175bc6){if(_0x175bc6){var _0x49223c=typeof _0x40a323[_0xc918('0x1b')]===_0xc918('0x1c')&&typeof _0x40a323[_0xc918('0x1d')]===_0xc918('0x1c');var _0x58cecc=_0x175bc6[_0xc918('0x1e')];var _0x8e5183=_0x49223c?0x0:_0x40a323['offset'];var _0x49e00c=_0x49223c?_0x175bc6[_0xc918('0x1e')]:_0x40a323['offset']+_0x40a323[_0xc918('0x1d')];var _0x2df26b;if(_0x49e00c>=_0x58cecc){_0x49e00c=_0x58cecc;_0x2df26b=0xc8;}else{_0x2df26b=0xce;}_0x3e659d[_0xc918('0x18')](_0x2df26b);return _0x3e659d[_0xc918('0x1f')](_0xc918('0x20'),_0x8e5183+'-'+_0x49e00c+'/'+_0x58cecc)[_0xc918('0x1a')](_0x175bc6);}return null;};}function patchUpdates(_0x322143){return function(_0x43af9f){try{jsonpatch[_0xc918('0x21')](_0x43af9f,_0x322143,!![]);}catch(_0x2ae02a){return BPromise[_0xc918('0x22')](_0x2ae02a);}return _0x43af9f['save']();};}function saveUpdates(_0x1552d1,_0x5c9e10){return function(_0x527da7){if(_0x527da7){return _0x527da7[_0xc918('0x23')](_0x1552d1)[_0xc918('0x24')](function(_0x4ad199){return _0x4ad199;});}return null;};}function removeEntity(_0x509636,_0x5a2fab){return function(_0x2ee576){if(_0x2ee576){return _0x2ee576[_0xc918('0x25')]()[_0xc918('0x24')](function(){_0x509636['status'](0xcc)[_0xc918('0x19')]();});}};}function handleEntityNotFound(_0xf0c17a,_0x94b67b){return function(_0x200cdb){if(!_0x200cdb){_0xf0c17a['sendStatus'](0x194);}return _0x200cdb;};}function handleError(_0x325d25,_0x4c7eea){_0x4c7eea=_0x4c7eea||0x1f4;return function(_0x48a9c8){logger['error'](_0x48a9c8[_0xc918('0x26')]);if(_0x48a9c8[_0xc918('0x27')]){delete _0x48a9c8[_0xc918('0x27')];}_0x325d25[_0xc918('0x18')](_0x4c7eea)['send'](_0x48a9c8);};}exports[_0xc918('0x28')]=function(_0x351504,_0x303318){var _0x39e866={},_0x4ebd52={},_0x45cdaf={'count':0x0,'rows':[]};var _0x26136f=_['map'](db[_0xc918('0x29')]['rawAttributes'],function(_0x2eb492){return{'name':_0x2eb492['fieldName'],'type':_0x2eb492[_0xc918('0x2a')]['key']};});_0x4ebd52['model']=_[_0xc918('0x2b')](_0x26136f,_0xc918('0x27'));_0x4ebd52[_0xc918('0x2c')]=_[_0xc918('0x2d')](_0x351504[_0xc918('0x2c')]);_0x4ebd52['filters']=_[_0xc918('0x2e')](_0x4ebd52[_0xc918('0x2f')],_0x4ebd52['query']);_0x39e866['attributes']=_['intersection'](_0x4ebd52['model'],qs[_0xc918('0x30')](_0x351504[_0xc918('0x2c')]['fields']));_0x39e866['attributes']=_0x39e866[_0xc918('0x31')][_0xc918('0x32')]?_0x39e866[_0xc918('0x31')]:_0x4ebd52[_0xc918('0x2f')];if(!_0x351504[_0xc918('0x2c')]['hasOwnProperty']('nolimit')){_0x39e866[_0xc918('0x1d')]=qs[_0xc918('0x1d')](_0x351504[_0xc918('0x2c')][_0xc918('0x1d')]);_0x39e866[_0xc918('0x1b')]=qs[_0xc918('0x1b')](_0x351504[_0xc918('0x2c')][_0xc918('0x1b')]);}_0x39e866[_0xc918('0x33')]=qs[_0xc918('0x34')](_0x351504[_0xc918('0x2c')][_0xc918('0x34')]);_0x39e866['where']=qs['filters'](_['pick'](_0x351504[_0xc918('0x2c')],_0x4ebd52[_0xc918('0x35')]),_0x26136f);if(_0x351504[_0xc918('0x2c')]['filter']){_0x39e866[_0xc918('0x36')]=_['merge'](_0x39e866[_0xc918('0x36')],{'$or':_[_0xc918('0x2b')](_0x26136f,function(_0x4deabe){if(_0x4deabe[_0xc918('0x2a')]!==_0xc918('0x37')){var _0xa3a399={};_0xa3a399[_0x4deabe['name']]={'$like':'%'+_0x351504['query'][_0xc918('0x38')]+'%'};return _0xa3a399;}})});}_0x39e866=_[_0xc918('0x39')]({},_0x39e866,_0x351504[_0xc918('0x3a')]);var _0xa4e59b={'where':_0x39e866[_0xc918('0x36')]};return db['VoiceQueuesLog'][_0xc918('0x1e')](_0xa4e59b)[_0xc918('0x24')](function(_0xbc641c){_0x45cdaf[_0xc918('0x1e')]=_0xbc641c;if(_0x351504[_0xc918('0x2c')]['includeAll']){_0x39e866['include']=[{'all':!![]}];}return db[_0xc918('0x29')][_0xc918('0x3b')](_0x39e866);})[_0xc918('0x24')](function(_0x33becb){_0x45cdaf['rows']=_0x33becb;return _0x45cdaf;})['then'](respondWithFilteredResult(_0x303318,_0x39e866))[_0xc918('0x3c')](handleError(_0x303318,null));};exports[_0xc918('0x3d')]=function(_0x3be4a4,_0x517a0a){var _0x3c7c32={'raw':!![],'where':{'id':_0x3be4a4['params']['id']}},_0x428adc={};_0x428adc[_0xc918('0x2f')]=_[_0xc918('0x2d')](db[_0xc918('0x29')][_0xc918('0x3e')]);_0x428adc[_0xc918('0x2c')]=_[_0xc918('0x2d')](_0x3be4a4['query']);_0x428adc[_0xc918('0x35')]=_[_0xc918('0x2e')](_0x428adc[_0xc918('0x2f')],_0x428adc[_0xc918('0x2c')]);_0x3c7c32[_0xc918('0x31')]=_['intersection'](_0x428adc['model'],qs['fields'](_0x3be4a4[_0xc918('0x2c')][_0xc918('0x30')]));_0x3c7c32['attributes']=_0x3c7c32['attributes'][_0xc918('0x32')]?_0x3c7c32['attributes']:_0x428adc[_0xc918('0x2f')];if(_0x3be4a4[_0xc918('0x2c')][_0xc918('0x3f')]){_0x3c7c32[_0xc918('0x40')]=[{'all':!![]}];}_0x3c7c32=_[_0xc918('0x39')]({},_0x3c7c32,_0x3be4a4[_0xc918('0x3a')]);return db[_0xc918('0x29')][_0xc918('0x41')](_0x3c7c32)[_0xc918('0x24')](handleEntityNotFound(_0x517a0a,null))[_0xc918('0x24')](respondWithResult(_0x517a0a,null))[_0xc918('0x3c')](handleError(_0x517a0a,null));};exports[_0xc918('0x42')]=function(_0x5c442c,_0x53f924){return db[_0xc918('0x29')][_0xc918('0x42')](_0x5c442c[_0xc918('0x43')],{})[_0xc918('0x24')](respondWithResult(_0x53f924,0xc9))['catch'](handleError(_0x53f924,null));};exports[_0xc918('0x23')]=function(_0xc50309,_0x4044a5){if(_0xc50309['body']['id']){delete _0xc50309[_0xc918('0x43')]['id'];}return db[_0xc918('0x29')][_0xc918('0x41')]({'where':{'id':_0xc50309[_0xc918('0x44')]['id']}})['then'](handleEntityNotFound(_0x4044a5,null))['then'](saveUpdates(_0xc50309[_0xc918('0x43')],null))[_0xc918('0x24')](respondWithResult(_0x4044a5,null))['catch'](handleError(_0x4044a5,null));};exports[_0xc918('0x25')]=function(_0x2e8d70,_0x30fa84){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2e8d70[_0xc918('0x44')]['id']}})['then'](handleEntityNotFound(_0x30fa84,null))['then'](removeEntity(_0x30fa84,null))[_0xc918('0x3c')](handleError(_0x30fa84,null));}; \ No newline at end of file +var _0xa420=['catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0x3b2b64,_0x345f57){var _0x50f97d=function(_0x6b796a){while(--_0x6b796a){_0x3b2b64['push'](_0x3b2b64['shift']());}};_0x50f97d(++_0x345f57);}(_0xa420,0x9a));var _0x0a42=function(_0x4aa86b,_0x340ccb){_0x4aa86b=_0x4aa86b-0x0;var _0x6b942b=_0xa420[_0x4aa86b];return _0x6b942b;};'use strict';var emlformat=require(_0x0a42('0x0'));var rimraf=require(_0x0a42('0x1'));var zipdir=require(_0x0a42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a42('0x4'));var util=require(_0x0a42('0x5'));var path=require(_0x0a42('0x6'));var sox=require('sox');var csv=require(_0x0a42('0x7'));var ejs=require(_0x0a42('0x8'));var fs=require('fs');var fs_extra=require(_0x0a42('0x9'));var _=require(_0x0a42('0xa'));var squel=require('squel');var crypto=require(_0x0a42('0xb'));var jsforce=require(_0x0a42('0xc'));var deskjs=require(_0x0a42('0xd'));var toCsv=require(_0x0a42('0x7'));var querystring=require(_0x0a42('0xe'));var Papa=require(_0x0a42('0xf'));var Redis=require('ioredis');var authService=require(_0x0a42('0x10'));var qs=require(_0x0a42('0x11'));var as=require(_0x0a42('0x12'));var hardwareService=require(_0x0a42('0x13'));var logger=require('../../config/logger')(_0x0a42('0x14'));var utils=require(_0x0a42('0x15'));var config=require(_0x0a42('0x16'));var licenseUtil=require(_0x0a42('0x17'));var db=require(_0x0a42('0x18'))['db'];function respondWithStatusCode(_0x240770,_0xfa7e20){_0xfa7e20=_0xfa7e20||0xcc;return function(_0x21e084){if(_0x21e084){return _0x240770[_0x0a42('0x19')](_0xfa7e20);}return _0x240770['status'](_0xfa7e20)['end']();};}function respondWithResult(_0x526d65,_0x377c80){_0x377c80=_0x377c80||0xc8;return function(_0x3f4e09){if(_0x3f4e09){return _0x526d65[_0x0a42('0x1a')](_0x377c80)[_0x0a42('0x1b')](_0x3f4e09);}};}function respondWithFilteredResult(_0x1fdb6b,_0x37c923){return function(_0x3e89f8){if(_0x3e89f8){var _0x2ca69c=typeof _0x37c923[_0x0a42('0x1c')]===_0x0a42('0x1d')&&typeof _0x37c923[_0x0a42('0x1e')]==='undefined';var _0x180f8f=_0x3e89f8['count'];var _0x1c6a32=_0x2ca69c?0x0:_0x37c923[_0x0a42('0x1c')];var _0x456264=_0x2ca69c?_0x3e89f8['count']:_0x37c923[_0x0a42('0x1c')]+_0x37c923[_0x0a42('0x1e')];var _0x5b9c7a;if(_0x456264>=_0x180f8f){_0x456264=_0x180f8f;_0x5b9c7a=0xc8;}else{_0x5b9c7a=0xce;}_0x1fdb6b[_0x0a42('0x1a')](_0x5b9c7a);return _0x1fdb6b['set'](_0x0a42('0x1f'),_0x1c6a32+'-'+_0x456264+'/'+_0x180f8f)['json'](_0x3e89f8);}return null;};}function patchUpdates(_0x24c24c){return function(_0x1ffda2){try{jsonpatch[_0x0a42('0x20')](_0x1ffda2,_0x24c24c,!![]);}catch(_0x250b84){return BPromise[_0x0a42('0x21')](_0x250b84);}return _0x1ffda2[_0x0a42('0x22')]();};}function saveUpdates(_0x3f2179,_0x3ed5b6){return function(_0x2abf01){if(_0x2abf01){return _0x2abf01[_0x0a42('0x23')](_0x3f2179)[_0x0a42('0x24')](function(_0x4ea8fa){return _0x4ea8fa;});}return null;};}function removeEntity(_0x46c96b,_0x27d142){return function(_0x196fba){if(_0x196fba){return _0x196fba[_0x0a42('0x25')]()[_0x0a42('0x24')](function(){_0x46c96b['status'](0xcc)[_0x0a42('0x26')]();});}};}function handleEntityNotFound(_0x559818,_0x59638d){return function(_0xa787ca){if(!_0xa787ca){_0x559818[_0x0a42('0x19')](0x194);}return _0xa787ca;};}function handleError(_0x2f68b7,_0x438b08){_0x438b08=_0x438b08||0x1f4;return function(_0x4dc21e){logger[_0x0a42('0x27')](_0x4dc21e[_0x0a42('0x28')]);if(_0x4dc21e[_0x0a42('0x29')]){delete _0x4dc21e[_0x0a42('0x29')];}_0x2f68b7[_0x0a42('0x1a')](_0x438b08)['send'](_0x4dc21e);};}exports[_0x0a42('0x2a')]=function(_0x55b2ac,_0x51979f){var _0x704029={},_0x566144={},_0x4eaff0={'count':0x0,'rows':[]};var _0x2287f1=_[_0x0a42('0x2b')](db[_0x0a42('0x2c')][_0x0a42('0x2d')],function(_0x29ea14){return{'name':_0x29ea14['fieldName'],'type':_0x29ea14[_0x0a42('0x2e')][_0x0a42('0x2f')]};});_0x566144[_0x0a42('0x30')]=_[_0x0a42('0x2b')](_0x2287f1,_0x0a42('0x29'));_0x566144['query']=_[_0x0a42('0x31')](_0x55b2ac[_0x0a42('0x32')]);_0x566144[_0x0a42('0x33')]=_['intersection'](_0x566144['model'],_0x566144['query']);_0x704029[_0x0a42('0x34')]=_[_0x0a42('0x35')](_0x566144['model'],qs['fields'](_0x55b2ac['query'][_0x0a42('0x36')]));_0x704029[_0x0a42('0x34')]=_0x704029[_0x0a42('0x34')][_0x0a42('0x37')]?_0x704029[_0x0a42('0x34')]:_0x566144['model'];if(!_0x55b2ac['query'][_0x0a42('0x38')]('nolimit')){_0x704029[_0x0a42('0x1e')]=qs['limit'](_0x55b2ac['query'][_0x0a42('0x1e')]);_0x704029[_0x0a42('0x1c')]=qs['offset'](_0x55b2ac['query'][_0x0a42('0x1c')]);}_0x704029['order']=qs[_0x0a42('0x39')](_0x55b2ac['query'][_0x0a42('0x39')]);_0x704029[_0x0a42('0x3a')]=qs[_0x0a42('0x33')](_['pick'](_0x55b2ac[_0x0a42('0x32')],_0x566144[_0x0a42('0x33')]),_0x2287f1);if(_0x55b2ac[_0x0a42('0x32')][_0x0a42('0x3b')]){_0x704029[_0x0a42('0x3a')]=_[_0x0a42('0x3c')](_0x704029[_0x0a42('0x3a')],{'$or':_[_0x0a42('0x2b')](_0x2287f1,function(_0x49fd3b){if(_0x49fd3b['type']!==_0x0a42('0x3d')){var _0x5dd9e2={};_0x5dd9e2[_0x49fd3b[_0x0a42('0x29')]]={'$like':'%'+_0x55b2ac[_0x0a42('0x32')][_0x0a42('0x3b')]+'%'};return _0x5dd9e2;}})});}_0x704029=_[_0x0a42('0x3c')]({},_0x704029,_0x55b2ac[_0x0a42('0x3e')]);var _0x457c1a={'where':_0x704029[_0x0a42('0x3a')]};return db[_0x0a42('0x2c')]['count'](_0x457c1a)[_0x0a42('0x24')](function(_0x13bb26){_0x4eaff0[_0x0a42('0x3f')]=_0x13bb26;if(_0x55b2ac['query'][_0x0a42('0x40')]){_0x704029[_0x0a42('0x41')]=[{'all':!![]}];}return db[_0x0a42('0x2c')][_0x0a42('0x42')](_0x704029);})[_0x0a42('0x24')](function(_0x153887){_0x4eaff0[_0x0a42('0x43')]=_0x153887;return _0x4eaff0;})['then'](respondWithFilteredResult(_0x51979f,_0x704029))[_0x0a42('0x44')](handleError(_0x51979f,null));};exports[_0x0a42('0x45')]=function(_0x1ff47c,_0x40d4ef){var _0x39a7b0={'raw':!![],'where':{'id':_0x1ff47c[_0x0a42('0x46')]['id']}},_0x5149d5={};_0x5149d5[_0x0a42('0x30')]=_[_0x0a42('0x31')](db[_0x0a42('0x2c')][_0x0a42('0x2d')]);_0x5149d5[_0x0a42('0x32')]=_[_0x0a42('0x31')](_0x1ff47c[_0x0a42('0x32')]);_0x5149d5[_0x0a42('0x33')]=_['intersection'](_0x5149d5['model'],_0x5149d5['query']);_0x39a7b0['attributes']=_[_0x0a42('0x35')](_0x5149d5[_0x0a42('0x30')],qs['fields'](_0x1ff47c[_0x0a42('0x32')]['fields']));_0x39a7b0[_0x0a42('0x34')]=_0x39a7b0['attributes']['length']?_0x39a7b0[_0x0a42('0x34')]:_0x5149d5['model'];if(_0x1ff47c['query'][_0x0a42('0x40')]){_0x39a7b0[_0x0a42('0x41')]=[{'all':!![]}];}_0x39a7b0=_[_0x0a42('0x3c')]({},_0x39a7b0,_0x1ff47c[_0x0a42('0x3e')]);return db[_0x0a42('0x2c')][_0x0a42('0x47')](_0x39a7b0)[_0x0a42('0x24')](handleEntityNotFound(_0x40d4ef,null))[_0x0a42('0x24')](respondWithResult(_0x40d4ef,null))[_0x0a42('0x44')](handleError(_0x40d4ef,null));};exports['create']=function(_0x991248,_0x18cce6){return db[_0x0a42('0x2c')][_0x0a42('0x48')](_0x991248[_0x0a42('0x49')],{})[_0x0a42('0x24')](respondWithResult(_0x18cce6,0xc9))['catch'](handleError(_0x18cce6,null));};exports[_0x0a42('0x23')]=function(_0xabcf42,_0x18ffa7){if(_0xabcf42[_0x0a42('0x49')]['id']){delete _0xabcf42[_0x0a42('0x49')]['id'];}return db[_0x0a42('0x2c')][_0x0a42('0x47')]({'where':{'id':_0xabcf42[_0x0a42('0x46')]['id']}})[_0x0a42('0x24')](handleEntityNotFound(_0x18ffa7,null))[_0x0a42('0x24')](saveUpdates(_0xabcf42[_0x0a42('0x49')],null))[_0x0a42('0x24')](respondWithResult(_0x18ffa7,null))['catch'](handleError(_0x18ffa7,null));};exports[_0x0a42('0x25')]=function(_0x4dc787,_0x37c9ee){return db[_0x0a42('0x2c')][_0x0a42('0x47')]({'where':{'id':_0x4dc787[_0x0a42('0x46')]['id']}})['then'](handleEntityNotFound(_0x37c9ee,null))['then'](removeEntity(_0x37c9ee,null))[_0x0a42('0x44')](handleError(_0x37c9ee,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 28c8fc1..23c721f 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 _0xa882=['dtm','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event'];(function(_0x4e3261,_0x54dc80){var _0x496bf9=function(_0x402aae){while(--_0x402aae){_0x4e3261['push'](_0x4e3261['shift']());}};_0x496bf9(++_0x54dc80);}(_0xa882,0x135));var _0x2a88=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xa882[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x2a88('0x0'));var util=require(_0x2a88('0x1'));var logger=require(_0x2a88('0x2'))('api');var moment=require(_0x2a88('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a88('0x4'));var fs=require('fs');var path=require(_0x2a88('0x5'));var rimraf=require(_0x2a88('0x6'));var config=require(_0x2a88('0x7'));var attributes=require(_0x2a88('0x8'));module['exports']=function(_0x106b35,_0x58339c){return _0x106b35[_0x2a88('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x2a88('0xa'),'paranoid':![],'indexes':[{'name':_0x2a88('0xb'),'fields':[_0x2a88('0xc'),_0x2a88('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3ac6=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger'];(function(_0x29c15b,_0x1af5a7){var _0x49bbec=function(_0x5508f5){while(--_0x5508f5){_0x29c15b['push'](_0x29c15b['shift']());}};_0x49bbec(++_0x1af5a7);}(_0x3ac6,0xeb));var _0x63ac=function(_0x2d8479,_0x371202){_0x2d8479=_0x2d8479-0x0;var _0x1c7dad=_0x3ac6[_0x2d8479];return _0x1c7dad;};'use strict';var _=require(_0x63ac('0x0'));var util=require(_0x63ac('0x1'));var logger=require(_0x63ac('0x2'))(_0x63ac('0x3'));var moment=require(_0x63ac('0x4'));var BPromise=require(_0x63ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63ac('0x6'));var rimraf=require(_0x63ac('0x7'));var config=require(_0x63ac('0x8'));var attributes=require(_0x63ac('0x9'));module['exports']=function(_0x196003,_0x5e791b){return _0x196003[_0x63ac('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x63ac('0xb'),'paranoid':![],'indexes':[{'name':_0x63ac('0xc'),'fields':[_0x63ac('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 94db87f..b88be11 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 _0x68f9=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x212579,_0xdb4d5a){var _0x55d50e=function(_0x38fa1d){while(--_0x38fa1d){_0x212579['push'](_0x212579['shift']());}};_0x55d50e(++_0xdb4d5a);}(_0x68f9,0xca));var _0x968f=function(_0x1ed0ab,_0x13bf64){_0x1ed0ab=_0x1ed0ab-0x0;var _0x47fd17=_0x68f9[_0x1ed0ab];return _0x47fd17;};'use strict';var _=require(_0x968f('0x0'));var util=require(_0x968f('0x1'));var moment=require(_0x968f('0x2'));var BPromise=require(_0x968f('0x3'));var rs=require(_0x968f('0x4'));var fs=require('fs');var Redis=require(_0x968f('0x5'));var db=require(_0x968f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x968f('0x7'))(_0x968f('0x8'));var config=require(_0x968f('0x9'));var jayson=require(_0x968f('0xa'));var client=jayson[_0x968f('0xb')][_0x968f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5214b6,_0x3883c4,_0x4dd516){return new BPromise(function(_0x14140f,_0x352cae){return client[_0x968f('0xd')](_0x5214b6,_0x4dd516)['then'](function(_0x1a812c){logger[_0x968f('0xe')](_0x968f('0xf'),_0x3883c4,_0x968f('0x10'));logger[_0x968f('0x11')](_0x968f('0x12'),_0x3883c4,_0x968f('0x10'),JSON['stringify'](_0x1a812c));if(_0x1a812c[_0x968f('0x13')]){if(_0x1a812c[_0x968f('0x13')][_0x968f('0x14')]===0x1f4){logger['error'](_0x968f('0xf'),_0x3883c4,_0x1a812c[_0x968f('0x13')][_0x968f('0x15')]);return _0x352cae(_0x1a812c['error'][_0x968f('0x15')]);}logger[_0x968f('0x13')](_0x968f('0xf'),_0x3883c4,_0x1a812c[_0x968f('0x13')][_0x968f('0x15')]);return _0x14140f(_0x1a812c[_0x968f('0x13')]['message']);}else{logger[_0x968f('0xe')](_0x968f('0xf'),_0x3883c4,_0x968f('0x10'));_0x14140f(_0x1a812c[_0x968f('0x16')]['message']);}})[_0x968f('0x17')](function(_0x3d77a6){logger[_0x968f('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3883c4,_0x3d77a6);_0x352cae(_0x3d77a6);});});} \ No newline at end of file +var _0xac7f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0xbc291b,_0x34ad4a){var _0x33286b=function(_0x2d1bd4){while(--_0x2d1bd4){_0xbc291b['push'](_0xbc291b['shift']());}};_0x33286b(++_0x34ad4a);}(_0xac7f,0x1e2));var _0xfac7=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xac7f[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xfac7('0x0'));var util=require('util');var moment=require(_0xfac7('0x1'));var BPromise=require(_0xfac7('0x2'));var rs=require(_0xfac7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfac7('0x4'))['db'];var utils=require(_0xfac7('0x5'));var logger=require(_0xfac7('0x6'))(_0xfac7('0x7'));var config=require(_0xfac7('0x8'));var jayson=require(_0xfac7('0x9'));var client=jayson['client'][_0xfac7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5be533,_0x100c9c,_0x1d177b){return new BPromise(function(_0x592be2,_0x250c99){return client[_0xfac7('0xb')](_0x5be533,_0x1d177b)[_0xfac7('0xc')](function(_0x529223){logger[_0xfac7('0xd')](_0xfac7('0xe'),_0x100c9c,'request\x20sent');logger['debug'](_0xfac7('0xf'),_0x100c9c,_0xfac7('0x10'),JSON[_0xfac7('0x11')](_0x529223));if(_0x529223[_0xfac7('0x12')]){if(_0x529223[_0xfac7('0x12')]['code']===0x1f4){logger[_0xfac7('0x12')](_0xfac7('0xe'),_0x100c9c,_0x529223[_0xfac7('0x12')][_0xfac7('0x13')]);return _0x250c99(_0x529223[_0xfac7('0x12')][_0xfac7('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x100c9c,_0x529223[_0xfac7('0x12')]['message']);return _0x592be2(_0x529223[_0xfac7('0x12')][_0xfac7('0x13')]);}else{logger['info'](_0xfac7('0xe'),_0x100c9c,_0xfac7('0x10'));_0x592be2(_0x529223['result'][_0xfac7('0x13')]);}})[_0xfac7('0x14')](function(_0x132eac){logger[_0xfac7('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x100c9c,_0x132eac);_0x250c99(_0x132eac);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 29ab6e4..5b6d713 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 _0x61d9=['show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x3b5da3,_0x12aa79){var _0x7e0d98=function(_0xb3f02){while(--_0xb3f02){_0x3b5da3['push'](_0x3b5da3['shift']());}};_0x7e0d98(++_0x12aa79);}(_0x61d9,0xff));var _0x961d=function(_0x5197da,_0x510a44){_0x5197da=_0x5197da-0x0;var _0x1d2374=_0x61d9[_0x5197da];return _0x1d2374;};'use strict';var multer=require(_0x961d('0x0'));var util=require(_0x961d('0x1'));var path=require(_0x961d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x961d('0x3')]();var fs_extra=require(_0x961d('0x4'));var auth=require(_0x961d('0x5'));var interaction=require(_0x961d('0x6'));var config=require(_0x961d('0x7'));var controller=require(_0x961d('0x8'));router['get']('/',auth[_0x961d('0x9')](),controller[_0x961d('0xa')]);router[_0x961d('0xb')](_0x961d('0xc'),auth[_0x961d('0x9')](),controller[_0x961d('0xd')]);router['get'](_0x961d('0xe'),auth[_0x961d('0x9')](),controller[_0x961d('0xf')]);router[_0x961d('0xb')](_0x961d('0x10'),auth[_0x961d('0x9')](),controller[_0x961d('0x11')]);router[_0x961d('0xb')](_0x961d('0x12'),controller[_0x961d('0x13')]);router['get'](_0x961d('0x14'),auth[_0x961d('0x9')](),controller[_0x961d('0x15')]);router[_0x961d('0x16')]('/',auth[_0x961d('0x9')](),controller[_0x961d('0x17')]);router[_0x961d('0x16')]('/:id/transcribe',auth[_0x961d('0x9')](),controller[_0x961d('0x18')]);router[_0x961d('0x19')]('/:id',auth[_0x961d('0x9')](),controller[_0x961d('0x1a')]);router[_0x961d('0x1b')](_0x961d('0xe'),auth[_0x961d('0x9')](),controller[_0x961d('0x1c')]);module[_0x961d('0x1d')]=router; \ No newline at end of file +var _0x7bf4=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download'];(function(_0x48fb42,_0x35cb4f){var _0xc321ba=function(_0x4b02a2){while(--_0x4b02a2){_0x48fb42['push'](_0x48fb42['shift']());}};_0xc321ba(++_0x35cb4f);}(_0x7bf4,0x11e));var _0x47bf=function(_0x288e25,_0x3fd6a4){_0x288e25=_0x288e25-0x0;var _0xb36077=_0x7bf4[_0x288e25];return _0xb36077;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x47bf('0x0'));var express=require(_0x47bf('0x1'));var router=express[_0x47bf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x47bf('0x3'));var interaction=require(_0x47bf('0x4'));var config=require(_0x47bf('0x5'));var controller=require('./voiceRecording.controller');router[_0x47bf('0x6')]('/',auth[_0x47bf('0x7')](),controller['index']);router[_0x47bf('0x6')](_0x47bf('0x8'),auth[_0x47bf('0x7')](),controller[_0x47bf('0x9')]);router['get'](_0x47bf('0xa'),auth['isAuthenticated'](),controller[_0x47bf('0xb')]);router['get'](_0x47bf('0xc'),auth['isAuthenticated'](),controller[_0x47bf('0xd')]);router[_0x47bf('0x6')](_0x47bf('0xe'),controller[_0x47bf('0xf')]);router[_0x47bf('0x6')](_0x47bf('0x10'),auth[_0x47bf('0x7')](),controller[_0x47bf('0x11')]);router[_0x47bf('0x12')]('/',auth[_0x47bf('0x7')](),controller[_0x47bf('0x13')]);router[_0x47bf('0x12')](_0x47bf('0x10'),auth[_0x47bf('0x7')](),controller[_0x47bf('0x14')]);router[_0x47bf('0x15')](_0x47bf('0xa'),auth[_0x47bf('0x7')](),controller['update']);router[_0x47bf('0x16')](_0x47bf('0xa'),auth[_0x47bf('0x7')](),controller[_0x47bf('0x17')]);module[_0x47bf('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 86f2c62..8294251 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 13a62be..4eff732 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 _0x41d4=['bluebird','mustache','util','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../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','save','update','then','destroy','stack','name','index','map','VoiceRecording','rawAttributes','type','key','format','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','unlink','VoiceRecording\x20not\x20found','send','../../components/encryptor','sequelize','MD5','col','token','$and','push','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentRegion','Sequelize','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x41d4,0x1a6));var _0x441d=function(_0x53fda3,_0x5cc847){_0x53fda3=_0x53fda3-0x0;var _0x3c0742=_0x41d4[_0x53fda3];return _0x3c0742;};'use strict';var emlformat=require(_0x441d('0x0'));var rimraf=require(_0x441d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x441d('0x2'));var rp=require(_0x441d('0x3'));var moment=require('moment');var BPromise=require(_0x441d('0x4'));var Mustache=require(_0x441d('0x5'));var util=require(_0x441d('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x441d('0x7'));var _=require(_0x441d('0x8'));var squel=require(_0x441d('0x9'));var crypto=require('crypto');var jsforce=require(_0x441d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x441d('0xb'));var querystring=require(_0x441d('0xc'));var Papa=require(_0x441d('0xd'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x441d('0xe'));var as=require(_0x441d('0xf'));var hardwareService=require(_0x441d('0x10'));var logger=require(_0x441d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x441d('0x12'));var licenseUtil=require(_0x441d('0x13'));var db=require(_0x441d('0x14'))['db'];function respondWithStatusCode(_0x2cef7f,_0x1dcb3a){_0x1dcb3a=_0x1dcb3a||0xcc;return function(_0x5a9e2a){if(_0x5a9e2a){return _0x2cef7f[_0x441d('0x15')](_0x1dcb3a);}return _0x2cef7f[_0x441d('0x16')](_0x1dcb3a)[_0x441d('0x17')]();};}function respondWithResult(_0x1e853b,_0x557b76){_0x557b76=_0x557b76||0xc8;return function(_0x2be9c3){if(_0x2be9c3){return _0x1e853b[_0x441d('0x16')](_0x557b76)[_0x441d('0x18')](_0x2be9c3);}};}function respondWithFilteredResult(_0xc99ad5,_0x2d7711){return function(_0x1fcd96){if(_0x1fcd96){var _0x1a8a43=typeof _0x2d7711[_0x441d('0x19')]===_0x441d('0x1a')&&typeof _0x2d7711[_0x441d('0x1b')]===_0x441d('0x1a');var _0x1428f=_0x1fcd96[_0x441d('0x1c')];var _0x46bb38=_0x1a8a43?0x0:_0x2d7711[_0x441d('0x19')];var _0x2eea2c=_0x1a8a43?_0x1fcd96['count']:_0x2d7711[_0x441d('0x19')]+_0x2d7711['limit'];var _0x5852bf;if(_0x2eea2c>=_0x1428f){_0x2eea2c=_0x1428f;_0x5852bf=0xc8;}else{_0x5852bf=0xce;}_0xc99ad5[_0x441d('0x16')](_0x5852bf);return _0xc99ad5[_0x441d('0x1d')](_0x441d('0x1e'),_0x46bb38+'-'+_0x2eea2c+'/'+_0x1428f)[_0x441d('0x18')](_0x1fcd96);}return null;};}function patchUpdates(_0x2a2f49){return function(_0x1677f9){try{jsonpatch['apply'](_0x1677f9,_0x2a2f49,!![]);}catch(_0xaecfa2){return BPromise['reject'](_0xaecfa2);}return _0x1677f9[_0x441d('0x1f')]();};}function saveUpdates(_0x52cb58,_0x5c864d){return function(_0x24854a){if(_0x24854a){return _0x24854a[_0x441d('0x20')](_0x52cb58)[_0x441d('0x21')](function(_0x958e51){return _0x958e51;});}return null;};}function removeEntity(_0x422cf9,_0xd931e2){return function(_0x4203bc){if(_0x4203bc){return _0x4203bc[_0x441d('0x22')]()[_0x441d('0x21')](function(){_0x422cf9['status'](0xcc)[_0x441d('0x17')]();});}};}function handleEntityNotFound(_0x176737,_0x139b79){return function(_0x18bec3){if(!_0x18bec3){_0x176737[_0x441d('0x15')](0x194);}return _0x18bec3;};}function handleError(_0x2a3e2d,_0x43fde5){_0x43fde5=_0x43fde5||0x1f4;return function(_0xba060e){logger['error'](_0xba060e[_0x441d('0x23')]);if(_0xba060e[_0x441d('0x24')]){delete _0xba060e[_0x441d('0x24')];}_0x2a3e2d[_0x441d('0x16')](_0x43fde5)['send'](_0xba060e);};}exports[_0x441d('0x25')]=function(_0x2a86b2,_0x16dd7c){var _0x367d2f={},_0x54c805={},_0x418da8={'count':0x0,'rows':[]};var _0x23e041=_[_0x441d('0x26')](db[_0x441d('0x27')][_0x441d('0x28')],function(_0x304478){return{'name':_0x304478['fieldName'],'type':_0x304478[_0x441d('0x29')][_0x441d('0x2a')]};});_0x54c805['model']=_['differenceBy'](_[_0x441d('0x26')](_0x23e041,_0x441d('0x24')),[_0x441d('0x2b')]);_0x54c805[_0x441d('0x2c')]=_[_0x441d('0x2d')](_0x2a86b2[_0x441d('0x2c')]);_0x54c805[_0x441d('0x2e')]=_[_0x441d('0x2f')](_0x54c805[_0x441d('0x30')],_0x54c805[_0x441d('0x2c')]);_0x367d2f[_0x441d('0x31')]=_[_0x441d('0x2f')](_0x54c805['model'],qs[_0x441d('0x32')](_0x2a86b2[_0x441d('0x2c')][_0x441d('0x32')]));_0x367d2f[_0x441d('0x31')]=_0x367d2f[_0x441d('0x31')]['length']?_0x367d2f['attributes']:_0x54c805[_0x441d('0x30')];if(!_0x2a86b2['query']['hasOwnProperty'](_0x441d('0x33'))){_0x367d2f[_0x441d('0x1b')]=qs['limit'](_0x2a86b2[_0x441d('0x2c')][_0x441d('0x1b')]);_0x367d2f['offset']=qs[_0x441d('0x19')](_0x2a86b2[_0x441d('0x2c')][_0x441d('0x19')]);}_0x367d2f[_0x441d('0x34')]=qs[_0x441d('0x35')](_0x2a86b2['query']['sort']);_0x367d2f[_0x441d('0x36')]=qs[_0x441d('0x2e')](_['pick'](_0x2a86b2[_0x441d('0x2c')],_0x54c805['filters']),_0x23e041);if(_0x2a86b2['query'][_0x441d('0x37')]){_0x367d2f[_0x441d('0x36')]=_[_0x441d('0x38')](_0x367d2f[_0x441d('0x36')],{'$or':_[_0x441d('0x26')](_0x23e041,function(_0x23d30e){if(_0x23d30e[_0x441d('0x29')]!==_0x441d('0x39')){var _0x2c3c83={};_0x2c3c83[_0x23d30e[_0x441d('0x24')]]={'$like':'%'+_0x2a86b2[_0x441d('0x2c')]['filter']+'%'};return _0x2c3c83;}})});}_0x367d2f=_[_0x441d('0x38')]({},_0x367d2f,_0x2a86b2[_0x441d('0x3a')]);var _0x16128c={'where':_0x367d2f[_0x441d('0x36')]};return db[_0x441d('0x27')][_0x441d('0x1c')](_0x16128c)['then'](function(_0x1be9dd){_0x418da8[_0x441d('0x1c')]=_0x1be9dd;if(_0x2a86b2[_0x441d('0x2c')][_0x441d('0x3b')]){_0x367d2f[_0x441d('0x3c')]=[{'all':!![]}];}return db[_0x441d('0x27')]['findAll'](_0x367d2f);})['then'](function(_0x474f77){_0x418da8[_0x441d('0x3d')]=_0x474f77;return _0x418da8;})[_0x441d('0x21')](respondWithFilteredResult(_0x16dd7c,_0x367d2f))[_0x441d('0x3e')](handleError(_0x16dd7c,null));};exports[_0x441d('0x3f')]=function(_0x11e272,_0xa12c25){var _0x24f212={'raw':![],'where':{'id':_0x11e272[_0x441d('0x40')]['id']}},_0x321176={};_0x321176[_0x441d('0x30')]=_['keys'](db[_0x441d('0x27')]['rawAttributes']);_0x321176[_0x441d('0x2c')]=_[_0x441d('0x2d')](_0x11e272[_0x441d('0x2c')]);_0x321176[_0x441d('0x2e')]=_[_0x441d('0x2f')](_0x321176['model'],_0x321176[_0x441d('0x2c')]);_0x24f212[_0x441d('0x31')]=_['intersection'](_0x321176[_0x441d('0x30')],qs[_0x441d('0x32')](_0x11e272[_0x441d('0x2c')][_0x441d('0x32')]));_0x24f212[_0x441d('0x31')]=_0x24f212[_0x441d('0x31')]['length']?_0x24f212[_0x441d('0x31')]:_0x321176[_0x441d('0x30')];if(_0x11e272['query']['includeAll']){_0x24f212[_0x441d('0x3c')]=[{'all':!![]}];}_0x24f212=_[_0x441d('0x38')]({},_0x24f212,_0x11e272[_0x441d('0x3a')]);return db[_0x441d('0x27')][_0x441d('0x41')](_0x24f212)[_0x441d('0x21')](handleEntityNotFound(_0xa12c25,null))['then'](respondWithResult(_0xa12c25,null))[_0x441d('0x3e')](handleError(_0xa12c25,null));};exports[_0x441d('0x42')]=function(_0x182977,_0x139ed1){return db[_0x441d('0x27')][_0x441d('0x42')](_0x182977['body'],{})[_0x441d('0x21')](respondWithResult(_0x139ed1,0xc9))[_0x441d('0x3e')](handleError(_0x139ed1,null));};exports[_0x441d('0x20')]=function(_0x409ec6,_0x328bb9){if(_0x409ec6[_0x441d('0x43')]['id']){delete _0x409ec6[_0x441d('0x43')]['id'];}return db[_0x441d('0x27')][_0x441d('0x41')]({'where':{'id':_0x409ec6['params']['id']}})['then'](handleEntityNotFound(_0x328bb9,null))[_0x441d('0x21')](saveUpdates(_0x409ec6['body'],null))[_0x441d('0x21')](respondWithResult(_0x328bb9,null))[_0x441d('0x3e')](handleError(_0x328bb9,null));};exports[_0x441d('0x44')]=function(_0x4d08b8,_0x1d1156){return db[_0x441d('0x27')]['describe']()[_0x441d('0x21')](respondWithResult(_0x1d1156,null))[_0x441d('0x3e')](handleError(_0x1d1156,null));};exports[_0x441d('0x45')]=function(_0x43267b,_0x280ab3,_0x3322b0){var _0x97062c=require('../../components/encryptor');var _0x4e2c2c=![];var _0x59a22b={};if(_0x43267b[_0x441d('0x2c')]['type']&&_0x43267b[_0x441d('0x2c')]['type']===_0x441d('0x46')){_0x59a22b['uniqueid']=_0x43267b['params']['id'];}else{_0x59a22b['id']=_0x43267b['params']['id'];}return db[_0x441d('0x27')][_0x441d('0x41')]({'where':_0x59a22b,'attributes':['id',_0x441d('0x47')],'raw':!![]})[_0x441d('0x21')](handleEntityNotFound(_0x280ab3,null))[_0x441d('0x21')](function(_0x4082b1){if(_0x4082b1){var _0x21508a=_0x4082b1[_0x441d('0x47')];var _0x3970bd=util[_0x441d('0x2b')](_0x441d('0x48'),_0x21508a);if(fs[_0x441d('0x49')](_0x3970bd)){_0x4e2c2c=!![];return _0x97062c[_0x441d('0x4a')](_0x3970bd,_0x21508a,config[_0x441d('0x4b')][_0x441d('0x4c')])['then'](function(){return _0x4082b1;});}return _0x4082b1;}})[_0x441d('0x21')](function(_0x55ad58){if(_0x55ad58){var _0x3670f3=_0x55ad58[_0x441d('0x47')];if(!fs['existsSync'](_0x3670f3)){throw new db['Sequelize'][(_0x441d('0x4d'))]('VoiceRecording\x20not\x20found');}if(_0x55ad58['filename']){return _0x280ab3[_0x441d('0x45')](_0x3670f3,_0x55ad58[_0x441d('0x4e')]+path['extname'](_0x3670f3),function(){if(_0x4e2c2c){fs[_0x441d('0x4f')](_0x3670f3);}});}else{return _0x280ab3[_0x441d('0x45')](_0x3670f3,function(_0x5d4e6f){if(_0x4e2c2c){fs['unlink'](_0x3670f3);}});}}})[_0x441d('0x3e')](function(_0x150984){if(_0x150984['message']===_0x441d('0x50')){_0x280ab3[_0x441d('0x16')](0x194)[_0x441d('0x51')]('Not\x20found');}else{return handleError(_0x280ab3,null);}});};exports['downloads']=function(_0xbf9458,_0x223163,_0x128c02){var _0x75c21a=require(_0x441d('0x52'));var _0x3fc15e=![];var _0x480b50={'$and':[db[_0x441d('0x53')][_0x441d('0x36')](db['sequelize']['fn'](_0x441d('0x54'),db['sequelize'][_0x441d('0x55')](_0x441d('0x46'))),_0xbf9458[_0x441d('0x2c')][_0x441d('0x56')])]};if(_0xbf9458['query'][_0x441d('0x29')]&&_0xbf9458[_0x441d('0x2c')][_0x441d('0x29')]==='uniqueid'){_0x480b50[_0x441d('0x57')]['push']({'uniqueid':_0xbf9458[_0x441d('0x40')]['id']});}else{_0x480b50[_0x441d('0x57')][_0x441d('0x58')]({'id':_0xbf9458[_0x441d('0x40')]['id']});}return db[_0x441d('0x27')]['find']({'where':_0x480b50,'attributes':['id','value'],'raw':!![]})[_0x441d('0x21')](handleEntityNotFound(_0x223163,null))[_0x441d('0x21')](function(_0x2b181f){if(_0x2b181f){var _0x30fbad=util[_0x441d('0x2b')]('%s.cypher',_0x2b181f[_0x441d('0x47')]);if(fs[_0x441d('0x49')](_0x30fbad)){_0x3fc15e=!![];return _0x75c21a[_0x441d('0x4a')](_0x30fbad,_0x2b181f[_0x441d('0x47')],config[_0x441d('0x4b')]['recording'])[_0x441d('0x21')](function(){return _0x2b181f;});}return _0x2b181f;}})[_0x441d('0x21')](function(_0x47c83c){if(_0x47c83c){if(!fs['existsSync'](_0x47c83c['value'])){throw new db['Sequelize'][(_0x441d('0x4d'))](_0x441d('0x50'));}if(_0x47c83c[_0x441d('0x4e')]){return _0x223163[_0x441d('0x45')](_0x47c83c[_0x441d('0x47')],_0x47c83c[_0x441d('0x4e')]+path[_0x441d('0x59')](_0x47c83c[_0x441d('0x47')]),function(){if(_0x3fc15e){fs[_0x441d('0x4f')](_0x47c83c['value']);}});}else{return _0x223163[_0x441d('0x45')](_0x47c83c[_0x441d('0x47')],function(_0x42938e){if(_0x3fc15e){fs['unlink'](_0x47c83c[_0x441d('0x47')]);}});}}})[_0x441d('0x3e')](handleError(_0x223163,null));};exports[_0x441d('0x22')]=function(_0x25e3fe,_0x2d58b7){return db[_0x441d('0x27')][_0x441d('0x41')]({'where':{'id':_0x25e3fe[_0x441d('0x40')]['id']}})[_0x441d('0x21')](function(_0x257885){if(_[_0x441d('0x5a')](_0x257885)){throw new ReferenceError(_0x441d('0x5b'));}return _0x257885;})[_0x441d('0x21')](function(_0x2d09f8){var _0x1473c5=_0x2d09f8['value'];logger[_0x441d('0x5c')](_0x441d('0x5d'),_0x1473c5);if(!_[_0x441d('0x5a')](_0x2d09f8[_0x441d('0x47')])&&fs[_0x441d('0x49')](_0x1473c5)){logger[_0x441d('0x5c')](_0x441d('0x5e')+_0x1473c5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1473c5);}_0x1473c5=_0x1473c5+_0x441d('0x5f');if(!_[_0x441d('0x5a')](_0x2d09f8[_0x441d('0x47')])&&fs['existsSync'](_0x1473c5)){logger[_0x441d('0x5c')](_0x441d('0x5e')+_0x1473c5+_0x441d('0x60'));fs[_0x441d('0x61')](_0x1473c5);}return _0x2d09f8;})['then'](function(_0x3ae2c7){if(!_0x3ae2c7)throw new InternalError();return _0x3ae2c7[_0x441d('0x22')]();})[_0x441d('0x21')](function(){_0x2d58b7[_0x441d('0x16')](0xcc)[_0x441d('0x17')]();})[_0x441d('0x3e')](handleError(_0x2d58b7,null));};function getBucketslist(_0x24aee5,_0x496335,_0x36a9c2){return new Promise(function(_0x347ad5,_0x5a29db){var _0x40b214=new AWS['S3']({'accessKeyId':_0x496335,'secretAccessKey':_0x24aee5,'region':_0x36a9c2});_0x40b214[_0x441d('0x62')]({},function(_0x52f954,_0x207433){if(_0x52f954){return _0x5a29db(_0x52f954);}else{return _0x347ad5(_0x207433);}});});}function createBucket(_0x3d018c,_0x43bb1d,_0x218de2,_0x3584a8){return new Promise(function(_0x3d1d5e,_0x5b3ac2){var _0x5633df=new AWS['S3']({'accessKeyId':_0x43bb1d,'secretAccessKey':_0x3d018c,'region':_0x218de2});_0x5633df['createBucket']({'Bucket':_0x3584a8},function(_0x4acec3,_0x3b7a31){if(_0x4acec3){return _0x5b3ac2(_0x4acec3);}else{return _0x3d1d5e(_0x3b7a31);}});});}function uploadFile(_0x4908f1,_0x47b26d,_0x2eaaf5,_0x3c6f5f,_0x14ea86,_0x49bd43){return new Promise(function(_0x30c3d5,_0x5989d3){var _0xae7e97=new AWS['S3']({'accessKeyId':_0x47b26d,'secretAccessKey':_0x4908f1,'region':_0x2eaaf5});_0xae7e97[_0x441d('0x63')]({'Bucket':_0x3c6f5f,'Key':_0x14ea86,'Body':_0x49bd43},function(_0x20c912,_0x5379e9){if(_0x20c912){return _0x5989d3(_0x20c912);}else{return _0x30c3d5(_0x5379e9);}});});}function startTranscribe(_0x33a551,_0x41f238,_0x12f8e1,_0x1ba117,_0x28efe1,_0x3f4eb3){return new Promise(function(_0x5c009b,_0x310e8c){var _0x3f6133=new AWS[(_0x441d('0x64'))]({'accessKeyId':_0x41f238,'secretAccessKey':_0x33a551,'region':_0x12f8e1});_0x3f6133[_0x441d('0x65')]({'TranscriptionJobName':_0x1ba117,'LanguageCode':_0x28efe1,'Media':{'MediaFileUri':_0x3f4eb3}},function(_0x9dbaea,_0x5a6fe0){if(_0x9dbaea){return _0x310e8c(_0x9dbaea);}else{return _0x5c009b(_0x5a6fe0);}});});}function transcribe(_0x18fd59,_0x28f09b,_0x336e5f,_0x399916,_0x4685a0,_0x48fb90,_0x9bb06f){return new Promise(function(_0x1e17cc,_0x2c3cc0){var _0x1772f9={};logger[_0x441d('0x5c')](util[_0x441d('0x2b')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x18fd59,_0x4685a0));return uploadFile(_0x28f09b,_0x336e5f,_0x399916,_0x4685a0,path['basename'](_0x48fb90),fs[_0x441d('0x66')](_0x48fb90))['then'](function(_0xab7162){logger['info'](util[_0x441d('0x2b')](_0x441d('0x67'),_0x18fd59,_0x4685a0,_0xab7162[_0x441d('0x68')]));_0x1772f9[_0x441d('0x69')]=_0xab7162[_0x441d('0x6a')];_0x1772f9[_0x441d('0x6b')]=_0xab7162[_0x441d('0x68')];logger[_0x441d('0x5c')](util['format'](_0x441d('0x6c'),_0x18fd59));return startTranscribe(_0x28f09b,_0x336e5f,_0x399916,uuidv4(),_0x9bb06f,_0xab7162[_0x441d('0x68')]);})[_0x441d('0x21')](function(_0x23df93){logger[_0x441d('0x5c')](util[_0x441d('0x2b')](_0x441d('0x6d'),_0x18fd59,_0x23df93['TranscriptionJob'][_0x441d('0x6e')]));_0x1772f9['transcribeName']=_0x23df93[_0x441d('0x6f')][_0x441d('0x6e')];_0x1772f9['transcribeStatus']=_0x23df93[_0x441d('0x6f')][_0x441d('0x70')];return _0x1e17cc(_0x1772f9);})[_0x441d('0x3e')](function(_0x43ac99){return _0x2c3cc0(_0x43ac99);});});}exports['runTranscribe']=function(_0x37df98,_0x5c7fe1,_0x2fb16c){var _0x482698;var _0x3b275d;var _0x22f6ed;var _0x22278e=require('../../components/encryptor');return db[_0x441d('0x27')]['findOne']({'where':{'id':_0x37df98['params']['id']}})['then'](function(_0x26dcc6){if(_0x26dcc6){var _0x21bb81=util[_0x441d('0x2b')](_0x441d('0x48'),_0x26dcc6['value']);if(fs['existsSync'](_0x21bb81)){cypher=!![];return _0x22278e['decryptFile'](_0x21bb81,_0x26dcc6[_0x441d('0x47')],config[_0x441d('0x4b')][_0x441d('0x4c')])[_0x441d('0x21')](function(){return _0x26dcc6;});}return _0x26dcc6;}})[_0x441d('0x21')](function(_0x5f03d3){if(!_0x5f03d3){throw new db['Sequelize'][(_0x441d('0x4d'))]('Voice\x20Recording\x20not\x20found');}_0x3b275d=_0x5f03d3;return db[_0x441d('0x71')][_0x441d('0x72')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5c7fe1,null))[_0x441d('0x21')](function(_0x2f0e98){if(_0x2f0e98){_0x482698=_0x2f0e98;if(!_0x482698[_0x441d('0x73')]||!_0x482698[_0x441d('0x74')]||!_0x482698[_0x441d('0x75')]||!_0x482698[_0x441d('0x76')]||!_0x482698[_0x441d('0x69')]){throw new db['Sequelize'][(_0x441d('0x4d'))]('Transcribe\x20not\x20configured');}if(_0x37df98['body'][_0x441d('0x77')]&&(!_0x482698[_0x441d('0x78')]||!_0x482698['sentimentAccountId']||!_0x482698[_0x441d('0x79')]||!_0x482698[_0x441d('0x76')]||!_0x482698[_0x441d('0x69')])){throw new db[(_0x441d('0x7a'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x441d('0x7b')][_0x441d('0x72')]({'where':{'id':_0x482698[_0x441d('0x74')]}});}})[_0x441d('0x21')](function(_0x4254f6){if(!_0x4254f6){throw new db['Sequelize']['ValidationError'](_0x441d('0x7c'));}if(!_0x4254f6[_0x441d('0x7d')]||!_0x4254f6['data2']){throw new db[(_0x441d('0x7a'))][(_0x441d('0x4d'))](_0x441d('0x7e'));}_0x22f6ed=_0x4254f6;return getBucketslist(_0x22f6ed[_0x441d('0x7d')],_0x22f6ed[_0x441d('0x7f')],_0x482698['transcribeRegion']);})[_0x441d('0x21')](function(_0xc9605d){if(_0xc9605d&&_0xc9605d[_0x441d('0x80')]){var _0x4cc35c=_[_0x441d('0x41')](_0xc9605d['Buckets'],function(_0x509d73){return _0x509d73[_0x441d('0x81')]===_0x482698[_0x441d('0x69')];});if(!_0x4cc35c){logger[_0x441d('0x5c')](util[_0x441d('0x2b')](_0x441d('0x82'),_0x37df98[_0x441d('0x40')]['id'],_0x482698['bucket']));return createBucket(_0x22f6ed[_0x441d('0x7d')],_0x22f6ed[_0x441d('0x7f')],_0x482698[_0x441d('0x75')],_0x482698[_0x441d('0x69')]);}logger[_0x441d('0x5c')](util['format'](_0x441d('0x83'),_0x37df98[_0x441d('0x40')]['id'],_0x482698[_0x441d('0x69')]));return;}})['then'](function(_0x38b62b){if(_0x3b275d[_0x441d('0x84')]===_0x441d('0x85')){return transcribe(_0x37df98['params']['id'],_0x22f6ed['data1'],_0x22f6ed[_0x441d('0x7f')],_0x482698[_0x441d('0x75')],_0x482698[_0x441d('0x69')],_0x3b275d[_0x441d('0x47')],_0x482698['language']);}else{logger[_0x441d('0x5c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x37df98[_0x441d('0x40')]['id']));return{'transcribeStatus':_0x441d('0x86')};}})[_0x441d('0x21')](function(_0x515a96){if(_0x515a96){_0x515a96[_0x441d('0x87')]=_0x37df98['body'][_0x441d('0x77')];return _0x3b275d[_0x441d('0x88')](_0x515a96);}})['then'](respondWithResult(_0x5c7fe1,null))[_0x441d('0x3e')](handleError(_0x5c7fe1,null));};function writeFile(_0x4ed7e9,_0xea74f2){return new Promise(function(_0xad7d20,_0xcdced6){fs[_0x441d('0x89')](_0xea74f2,_0x4ed7e9,function(_0x4212e2,_0x309d72){if(_0x4212e2){return _0xcdced6(_0x4212e2);}else{return _0xad7d20(_0x309d72);}});});}exports[_0x441d('0x8a')]=function(_0x9fee21,_0x557810,_0x21a5ad){return db[_0x441d('0x27')]['findOne']({'where':{'id':_0x9fee21[_0x441d('0x40')]['id']}})['then'](handleEntityNotFound(_0x557810))[_0x441d('0x21')](function(_0x48b36b){if(_0x48b36b&&_0x48b36b[_0x441d('0x8b')]){var _0x224748=_0x48b36b['fileText'];var _0x32f3c3=config[_0x441d('0x8c')]+'/server/files/transcribes/transcribe_'+_0x48b36b['id']+'.txt';if(fs[_0x441d('0x49')](_0x32f3c3)){return _0x32f3c3;}return writeFile(_0x224748,_0x32f3c3)[_0x441d('0x21')](function(){return _0x32f3c3;});}else{throw new db[(_0x441d('0x7a'))]['ValidationError'](_0x441d('0x8d'));}})[_0x441d('0x21')](function(_0x235b22){return _0x557810['download'](_0x235b22);})[_0x441d('0x3e')](handleError(_0x557810));}; \ No newline at end of file +var _0x0e15=['reject','update','then','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','filters','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','filename','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x3eebb4,_0x43eec2){var _0x53e755=function(_0x2eb67d){while(--_0x2eb67d){_0x3eebb4['push'](_0x3eebb4['shift']());}};_0x53e755(++_0x43eec2);}(_0x0e15,0x1ab));var _0x50e1=function(_0x5221d2,_0x41e41b){_0x5221d2=_0x5221d2-0x0;var _0xb29497=_0x0e15[_0x5221d2];return _0xb29497;};'use strict';var emlformat=require(_0x50e1('0x0'));var rimraf=require(_0x50e1('0x1'));var zipdir=require(_0x50e1('0x2'));var jsonpatch=require(_0x50e1('0x3'));var rp=require(_0x50e1('0x4'));var moment=require(_0x50e1('0x5'));var BPromise=require(_0x50e1('0x6'));var Mustache=require(_0x50e1('0x7'));var util=require(_0x50e1('0x8'));var path=require(_0x50e1('0x9'));var sox=require('sox');var csv=require(_0x50e1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50e1('0xb'));var _=require(_0x50e1('0xc'));var squel=require(_0x50e1('0xd'));var crypto=require(_0x50e1('0xe'));var jsforce=require(_0x50e1('0xf'));var deskjs=require(_0x50e1('0x10'));var toCsv=require(_0x50e1('0xa'));var querystring=require(_0x50e1('0x11'));var Papa=require(_0x50e1('0x12'));var AWS=require('aws-sdk');var uuidv4=require(_0x50e1('0x13'));var Redis=require(_0x50e1('0x14'));var authService=require(_0x50e1('0x15'));var qs=require(_0x50e1('0x16'));var as=require(_0x50e1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50e1('0x18'))('api');var utils=require(_0x50e1('0x19'));var config=require(_0x50e1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x50e1('0x1b'))['db'];function respondWithStatusCode(_0x5803f8,_0x4d5f34){_0x4d5f34=_0x4d5f34||0xcc;return function(_0x5b77ef){if(_0x5b77ef){return _0x5803f8['sendStatus'](_0x4d5f34);}return _0x5803f8[_0x50e1('0x1c')](_0x4d5f34)[_0x50e1('0x1d')]();};}function respondWithResult(_0x44a50a,_0x593748){_0x593748=_0x593748||0xc8;return function(_0x3773af){if(_0x3773af){return _0x44a50a['status'](_0x593748)['json'](_0x3773af);}};}function respondWithFilteredResult(_0x348ca7,_0x8a6b23){return function(_0x12b02){if(_0x12b02){var _0x182af2=typeof _0x8a6b23['offset']===_0x50e1('0x1e')&&typeof _0x8a6b23[_0x50e1('0x1f')]===_0x50e1('0x1e');var _0x1f448b=_0x12b02[_0x50e1('0x20')];var _0x188c59=_0x182af2?0x0:_0x8a6b23[_0x50e1('0x21')];var _0x6969e4=_0x182af2?_0x12b02[_0x50e1('0x20')]:_0x8a6b23['offset']+_0x8a6b23[_0x50e1('0x1f')];var _0x671431;if(_0x6969e4>=_0x1f448b){_0x6969e4=_0x1f448b;_0x671431=0xc8;}else{_0x671431=0xce;}_0x348ca7[_0x50e1('0x1c')](_0x671431);return _0x348ca7[_0x50e1('0x22')](_0x50e1('0x23'),_0x188c59+'-'+_0x6969e4+'/'+_0x1f448b)[_0x50e1('0x24')](_0x12b02);}return null;};}function patchUpdates(_0x250b54){return function(_0xa16e74){try{jsonpatch[_0x50e1('0x25')](_0xa16e74,_0x250b54,!![]);}catch(_0x26db89){return BPromise[_0x50e1('0x26')](_0x26db89);}return _0xa16e74['save']();};}function saveUpdates(_0x3f431a,_0x2de914){return function(_0x571cb7){if(_0x571cb7){return _0x571cb7[_0x50e1('0x27')](_0x3f431a)['then'](function(_0x3961ac){return _0x3961ac;});}return null;};}function removeEntity(_0x38c840,_0x6cd036){return function(_0x5d030d){if(_0x5d030d){return _0x5d030d['destroy']()[_0x50e1('0x28')](function(){_0x38c840[_0x50e1('0x1c')](0xcc)[_0x50e1('0x1d')]();});}};}function handleEntityNotFound(_0xf02bfb,_0x1ccc6c){return function(_0x441730){if(!_0x441730){_0xf02bfb[_0x50e1('0x29')](0x194);}return _0x441730;};}function handleError(_0x299d39,_0x4f1de9){_0x4f1de9=_0x4f1de9||0x1f4;return function(_0x4400c7){logger[_0x50e1('0x2a')](_0x4400c7[_0x50e1('0x2b')]);if(_0x4400c7[_0x50e1('0x2c')]){delete _0x4400c7[_0x50e1('0x2c')];}_0x299d39[_0x50e1('0x1c')](_0x4f1de9)[_0x50e1('0x2d')](_0x4400c7);};}exports[_0x50e1('0x2e')]=function(_0x5caf8f,_0x46a4f7){var _0x3b3b92={},_0x3c41f1={},_0x2e421f={'count':0x0,'rows':[]};var _0xd06641=_[_0x50e1('0x2f')](db[_0x50e1('0x30')][_0x50e1('0x31')],function(_0x3a88a7){return{'name':_0x3a88a7[_0x50e1('0x32')],'type':_0x3a88a7[_0x50e1('0x33')][_0x50e1('0x34')]};});_0x3c41f1['model']=_['differenceBy'](_['map'](_0xd06641,_0x50e1('0x2c')),[_0x50e1('0x35')]);_0x3c41f1[_0x50e1('0x36')]=_[_0x50e1('0x37')](_0x5caf8f[_0x50e1('0x36')]);_0x3c41f1['filters']=_[_0x50e1('0x38')](_0x3c41f1['model'],_0x3c41f1[_0x50e1('0x36')]);_0x3b3b92[_0x50e1('0x39')]=_[_0x50e1('0x38')](_0x3c41f1[_0x50e1('0x3a')],qs[_0x50e1('0x3b')](_0x5caf8f['query'][_0x50e1('0x3b')]));_0x3b3b92[_0x50e1('0x39')]=_0x3b3b92[_0x50e1('0x39')][_0x50e1('0x3c')]?_0x3b3b92['attributes']:_0x3c41f1[_0x50e1('0x3a')];if(!_0x5caf8f[_0x50e1('0x36')]['hasOwnProperty'](_0x50e1('0x3d'))){_0x3b3b92['limit']=qs[_0x50e1('0x1f')](_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x1f')]);_0x3b3b92[_0x50e1('0x21')]=qs[_0x50e1('0x21')](_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x21')]);}_0x3b3b92[_0x50e1('0x3e')]=qs[_0x50e1('0x3f')](_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x3f')]);_0x3b3b92['where']=qs['filters'](_['pick'](_0x5caf8f[_0x50e1('0x36')],_0x3c41f1['filters']),_0xd06641);if(_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x40')]){_0x3b3b92[_0x50e1('0x41')]=_['merge'](_0x3b3b92[_0x50e1('0x41')],{'$or':_[_0x50e1('0x2f')](_0xd06641,function(_0xa0d250){if(_0xa0d250[_0x50e1('0x33')]!==_0x50e1('0x42')){var _0x23124c={};_0x23124c[_0xa0d250[_0x50e1('0x2c')]]={'$like':'%'+_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x40')]+'%'};return _0x23124c;}})});}_0x3b3b92=_[_0x50e1('0x43')]({},_0x3b3b92,_0x5caf8f[_0x50e1('0x44')]);var _0x4978d5={'where':_0x3b3b92['where']};return db[_0x50e1('0x30')][_0x50e1('0x20')](_0x4978d5)[_0x50e1('0x28')](function(_0x17861c){_0x2e421f[_0x50e1('0x20')]=_0x17861c;if(_0x5caf8f[_0x50e1('0x36')][_0x50e1('0x45')]){_0x3b3b92[_0x50e1('0x46')]=[{'all':!![]}];}return db[_0x50e1('0x30')][_0x50e1('0x47')](_0x3b3b92);})['then'](function(_0x20eb47){_0x2e421f[_0x50e1('0x48')]=_0x20eb47;return _0x2e421f;})[_0x50e1('0x28')](respondWithFilteredResult(_0x46a4f7,_0x3b3b92))[_0x50e1('0x49')](handleError(_0x46a4f7,null));};exports['show']=function(_0x2baa52,_0x1a7cb4){var _0x1503e2={'raw':![],'where':{'id':_0x2baa52[_0x50e1('0x4a')]['id']}},_0x4fed1c={};_0x4fed1c['model']=_[_0x50e1('0x37')](db[_0x50e1('0x30')][_0x50e1('0x31')]);_0x4fed1c['query']=_['keys'](_0x2baa52[_0x50e1('0x36')]);_0x4fed1c[_0x50e1('0x4b')]=_['intersection'](_0x4fed1c[_0x50e1('0x3a')],_0x4fed1c['query']);_0x1503e2[_0x50e1('0x39')]=_[_0x50e1('0x38')](_0x4fed1c[_0x50e1('0x3a')],qs[_0x50e1('0x3b')](_0x2baa52[_0x50e1('0x36')][_0x50e1('0x3b')]));_0x1503e2[_0x50e1('0x39')]=_0x1503e2['attributes'][_0x50e1('0x3c')]?_0x1503e2[_0x50e1('0x39')]:_0x4fed1c[_0x50e1('0x3a')];if(_0x2baa52[_0x50e1('0x36')][_0x50e1('0x45')]){_0x1503e2[_0x50e1('0x46')]=[{'all':!![]}];}_0x1503e2=_[_0x50e1('0x43')]({},_0x1503e2,_0x2baa52[_0x50e1('0x44')]);return db['VoiceRecording']['find'](_0x1503e2)[_0x50e1('0x28')](handleEntityNotFound(_0x1a7cb4,null))[_0x50e1('0x28')](respondWithResult(_0x1a7cb4,null))[_0x50e1('0x49')](handleError(_0x1a7cb4,null));};exports['create']=function(_0xa7406b,_0x2aaf9a){return db[_0x50e1('0x30')][_0x50e1('0x4c')](_0xa7406b[_0x50e1('0x4d')],{})[_0x50e1('0x28')](respondWithResult(_0x2aaf9a,0xc9))['catch'](handleError(_0x2aaf9a,null));};exports[_0x50e1('0x27')]=function(_0x2150de,_0x2fa479){if(_0x2150de['body']['id']){delete _0x2150de[_0x50e1('0x4d')]['id'];}return db[_0x50e1('0x30')]['find']({'where':{'id':_0x2150de[_0x50e1('0x4a')]['id']}})[_0x50e1('0x28')](handleEntityNotFound(_0x2fa479,null))[_0x50e1('0x28')](saveUpdates(_0x2150de[_0x50e1('0x4d')],null))[_0x50e1('0x28')](respondWithResult(_0x2fa479,null))[_0x50e1('0x49')](handleError(_0x2fa479,null));};exports['describe']=function(_0x174c81,_0x2f57a3){return db[_0x50e1('0x30')][_0x50e1('0x4e')]()[_0x50e1('0x28')](respondWithResult(_0x2f57a3,null))['catch'](handleError(_0x2f57a3,null));};exports[_0x50e1('0x4f')]=function(_0x5e78c8,_0x569a44,_0x5465ac){var _0x567342=require(_0x50e1('0x50'));var _0x5cc78b=![];var _0x16cfce={};if(_0x5e78c8[_0x50e1('0x36')][_0x50e1('0x33')]&&_0x5e78c8[_0x50e1('0x36')]['type']==='uniqueid'){_0x16cfce[_0x50e1('0x51')]=_0x5e78c8[_0x50e1('0x4a')]['id'];}else{_0x16cfce['id']=_0x5e78c8[_0x50e1('0x4a')]['id'];}return db['VoiceRecording'][_0x50e1('0x52')]({'where':_0x16cfce,'attributes':['id',_0x50e1('0x53')],'raw':!![]})[_0x50e1('0x28')](handleEntityNotFound(_0x569a44,null))['then'](function(_0x563949){if(_0x563949){var _0x5d72e6=_0x563949[_0x50e1('0x53')];var _0x5a0172=util['format'](_0x50e1('0x54'),_0x5d72e6);if(fs['existsSync'](_0x5a0172)){_0x5cc78b=!![];return _0x567342[_0x50e1('0x55')](_0x5a0172,_0x5d72e6,config[_0x50e1('0x56')][_0x50e1('0x57')])[_0x50e1('0x28')](function(){return _0x563949;});}return _0x563949;}})[_0x50e1('0x28')](function(_0x18873f){if(_0x18873f){var _0x11daf3=_0x18873f[_0x50e1('0x53')];if(!fs['existsSync'](_0x11daf3)){throw new db[(_0x50e1('0x58'))][(_0x50e1('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x18873f['filename']){return _0x569a44[_0x50e1('0x4f')](_0x11daf3,_0x18873f['filename']+path[_0x50e1('0x5a')](_0x11daf3),function(){if(_0x5cc78b){fs['unlink'](_0x11daf3);}});}else{return _0x569a44[_0x50e1('0x4f')](_0x11daf3,function(_0x399909){if(_0x5cc78b){fs[_0x50e1('0x5b')](_0x11daf3);}});}}})[_0x50e1('0x49')](function(_0x47137c){if(_0x47137c[_0x50e1('0x5c')]===_0x50e1('0x5d')){_0x569a44[_0x50e1('0x1c')](0x194)[_0x50e1('0x2d')](_0x50e1('0x5e'));}else{return handleError(_0x569a44,null);}});};exports[_0x50e1('0x5f')]=function(_0x13de50,_0x5d06db,_0x190da3){var _0x28b68e=require('../../components/encryptor');var _0x634730=![];var _0x2c6932={'$and':[db[_0x50e1('0x60')][_0x50e1('0x41')](db[_0x50e1('0x60')]['fn'](_0x50e1('0x61'),db[_0x50e1('0x60')][_0x50e1('0x62')](_0x50e1('0x51'))),_0x13de50[_0x50e1('0x36')][_0x50e1('0x63')])]};if(_0x13de50[_0x50e1('0x36')][_0x50e1('0x33')]&&_0x13de50[_0x50e1('0x36')]['type']==='uniqueid'){_0x2c6932['$and'][_0x50e1('0x64')]({'uniqueid':_0x13de50[_0x50e1('0x4a')]['id']});}else{_0x2c6932[_0x50e1('0x65')][_0x50e1('0x64')]({'id':_0x13de50[_0x50e1('0x4a')]['id']});}return db['VoiceRecording'][_0x50e1('0x52')]({'where':_0x2c6932,'attributes':['id',_0x50e1('0x53')],'raw':!![]})[_0x50e1('0x28')](handleEntityNotFound(_0x5d06db,null))[_0x50e1('0x28')](function(_0x4ee16b){if(_0x4ee16b){var _0x5e5a5c=util['format'](_0x50e1('0x54'),_0x4ee16b['value']);if(fs['existsSync'](_0x5e5a5c)){_0x634730=!![];return _0x28b68e['decryptFile'](_0x5e5a5c,_0x4ee16b['value'],config[_0x50e1('0x56')]['recording'])[_0x50e1('0x28')](function(){return _0x4ee16b;});}return _0x4ee16b;}})['then'](function(_0x3487a7){if(_0x3487a7){if(!fs['existsSync'](_0x3487a7[_0x50e1('0x53')])){throw new db[(_0x50e1('0x58'))]['ValidationError'](_0x50e1('0x5d'));}if(_0x3487a7[_0x50e1('0x66')]){return _0x5d06db[_0x50e1('0x4f')](_0x3487a7[_0x50e1('0x53')],_0x3487a7[_0x50e1('0x66')]+path[_0x50e1('0x5a')](_0x3487a7[_0x50e1('0x53')]),function(){if(_0x634730){fs[_0x50e1('0x5b')](_0x3487a7[_0x50e1('0x53')]);}});}else{return _0x5d06db[_0x50e1('0x4f')](_0x3487a7[_0x50e1('0x53')],function(_0x3cbcaa){if(_0x634730){fs['unlink'](_0x3487a7['value']);}});}}})[_0x50e1('0x49')](handleError(_0x5d06db,null));};exports[_0x50e1('0x67')]=function(_0x299e7b,_0x4def1e){return db['VoiceRecording'][_0x50e1('0x52')]({'where':{'id':_0x299e7b[_0x50e1('0x4a')]['id']}})[_0x50e1('0x28')](function(_0x1b2d6b){if(_[_0x50e1('0x68')](_0x1b2d6b)){throw new ReferenceError(_0x50e1('0x69'));}return _0x1b2d6b;})[_0x50e1('0x28')](function(_0x453758){var _0x2eacd3=_0x453758[_0x50e1('0x53')];logger[_0x50e1('0x6a')](_0x50e1('0x6b'),_0x2eacd3);if(!_['isNil'](_0x453758[_0x50e1('0x53')])&&fs[_0x50e1('0x6c')](_0x2eacd3)){logger['info'](_0x50e1('0x6d')+_0x2eacd3+_0x50e1('0x6e'));fs['unlinkSync'](_0x2eacd3);}_0x2eacd3=_0x2eacd3+'.cypher';if(!_[_0x50e1('0x68')](_0x453758[_0x50e1('0x53')])&&fs[_0x50e1('0x6c')](_0x2eacd3)){logger[_0x50e1('0x6a')]('File:\x20\x22'+_0x2eacd3+_0x50e1('0x6e'));fs[_0x50e1('0x6f')](_0x2eacd3);}return _0x453758;})[_0x50e1('0x28')](function(_0x598a57){if(!_0x598a57)throw new InternalError();return _0x598a57[_0x50e1('0x67')]();})[_0x50e1('0x28')](function(){_0x4def1e[_0x50e1('0x1c')](0xcc)[_0x50e1('0x1d')]();})['catch'](handleError(_0x4def1e,null));};function getBucketslist(_0x4bcd7c,_0x599b86,_0x36cb31){return new Promise(function(_0x2ee994,_0x46bd73){var _0x302250=new AWS['S3']({'accessKeyId':_0x599b86,'secretAccessKey':_0x4bcd7c,'region':_0x36cb31});_0x302250['listBuckets']({},function(_0x5e0e69,_0x46527b){if(_0x5e0e69){return _0x46bd73(_0x5e0e69);}else{return _0x2ee994(_0x46527b);}});});}function createBucket(_0x3dde0b,_0x1267ad,_0x21ac8d,_0x5604a9){return new Promise(function(_0x4c46d2,_0x342ed4){var _0x497a8a=new AWS['S3']({'accessKeyId':_0x1267ad,'secretAccessKey':_0x3dde0b,'region':_0x21ac8d});_0x497a8a[_0x50e1('0x70')]({'Bucket':_0x5604a9},function(_0x52ada3,_0x3a675b){if(_0x52ada3){return _0x342ed4(_0x52ada3);}else{return _0x4c46d2(_0x3a675b);}});});}function uploadFile(_0x4cc975,_0x28841b,_0x3bdd7e,_0x17b7bc,_0x1e6b1e,_0x113529){return new Promise(function(_0x45b655,_0x5e62ac){var _0xd8f383=new AWS['S3']({'accessKeyId':_0x28841b,'secretAccessKey':_0x4cc975,'region':_0x3bdd7e});_0xd8f383['upload']({'Bucket':_0x17b7bc,'Key':_0x1e6b1e,'Body':_0x113529},function(_0x8577c0,_0x3887de){if(_0x8577c0){return _0x5e62ac(_0x8577c0);}else{return _0x45b655(_0x3887de);}});});}function startTranscribe(_0x572104,_0x18fbbf,_0x19d291,_0x2045b1,_0x4fc8db,_0x50b3ee){return new Promise(function(_0x41c07f,_0x301cc1){var _0x395570=new AWS[(_0x50e1('0x71'))]({'accessKeyId':_0x18fbbf,'secretAccessKey':_0x572104,'region':_0x19d291});_0x395570['startTranscriptionJob']({'TranscriptionJobName':_0x2045b1,'LanguageCode':_0x4fc8db,'Media':{'MediaFileUri':_0x50b3ee}},function(_0x1096ef,_0x3bed46){if(_0x1096ef){return _0x301cc1(_0x1096ef);}else{return _0x41c07f(_0x3bed46);}});});}function transcribe(_0x23a4ac,_0x3b444f,_0x55665c,_0x1b5485,_0x21e0c1,_0x21e229,_0x3ecfdc){return new Promise(function(_0x5b9da6,_0x1024a2){var _0x34e47a={};logger[_0x50e1('0x6a')](util[_0x50e1('0x35')](_0x50e1('0x72'),_0x23a4ac,_0x21e0c1));return uploadFile(_0x3b444f,_0x55665c,_0x1b5485,_0x21e0c1,path[_0x50e1('0x73')](_0x21e229),fs['readFileSync'](_0x21e229))[_0x50e1('0x28')](function(_0x3b465d){logger[_0x50e1('0x6a')](util[_0x50e1('0x35')](_0x50e1('0x74'),_0x23a4ac,_0x21e0c1,_0x3b465d[_0x50e1('0x75')]));_0x34e47a[_0x50e1('0x76')]=_0x3b465d[_0x50e1('0x77')];_0x34e47a[_0x50e1('0x78')]=_0x3b465d[_0x50e1('0x75')];logger['info'](util[_0x50e1('0x35')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x23a4ac));return startTranscribe(_0x3b444f,_0x55665c,_0x1b5485,uuidv4(),_0x3ecfdc,_0x3b465d[_0x50e1('0x75')]);})['then'](function(_0x429877){logger['info'](util[_0x50e1('0x35')](_0x50e1('0x79'),_0x23a4ac,_0x429877[_0x50e1('0x7a')][_0x50e1('0x7b')]));_0x34e47a['transcribeName']=_0x429877[_0x50e1('0x7a')]['TranscriptionJobName'];_0x34e47a[_0x50e1('0x7c')]=_0x429877[_0x50e1('0x7a')][_0x50e1('0x7d')];return _0x5b9da6(_0x34e47a);})[_0x50e1('0x49')](function(_0x60149c){return _0x1024a2(_0x60149c);});});}exports[_0x50e1('0x7e')]=function(_0x5f2a44,_0x3ca5eb,_0x123983){var _0x3de0d7;var _0x53f51d;var _0x3104d1;var _0x1aecaf=require(_0x50e1('0x50'));return db[_0x50e1('0x30')][_0x50e1('0x7f')]({'where':{'id':_0x5f2a44[_0x50e1('0x4a')]['id']}})[_0x50e1('0x28')](function(_0x487319){if(_0x487319){var _0x24f795=util[_0x50e1('0x35')](_0x50e1('0x54'),_0x487319[_0x50e1('0x53')]);if(fs[_0x50e1('0x6c')](_0x24f795)){cypher=!![];return _0x1aecaf[_0x50e1('0x55')](_0x24f795,_0x487319[_0x50e1('0x53')],config['secrets'][_0x50e1('0x57')])[_0x50e1('0x28')](function(){return _0x487319;});}return _0x487319;}})[_0x50e1('0x28')](function(_0xe5f058){if(!_0xe5f058){throw new db[(_0x50e1('0x58'))][(_0x50e1('0x59'))](_0x50e1('0x80'));}_0x53f51d=_0xe5f058;return db[_0x50e1('0x81')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3ca5eb,null))[_0x50e1('0x28')](function(_0x34f294){if(_0x34f294){_0x3de0d7=_0x34f294;if(!_0x3de0d7['transcribe']||!_0x3de0d7[_0x50e1('0x82')]||!_0x3de0d7[_0x50e1('0x83')]||!_0x3de0d7['language']||!_0x3de0d7[_0x50e1('0x76')]){throw new db[(_0x50e1('0x58'))][(_0x50e1('0x59'))](_0x50e1('0x84'));}if(_0x5f2a44['body'][_0x50e1('0x85')]&&(!_0x3de0d7[_0x50e1('0x86')]||!_0x3de0d7[_0x50e1('0x87')]||!_0x3de0d7[_0x50e1('0x88')]||!_0x3de0d7[_0x50e1('0x89')]||!_0x3de0d7[_0x50e1('0x76')])){throw new db[(_0x50e1('0x58'))]['ValidationError'](_0x50e1('0x8a'));}return db[_0x50e1('0x8b')][_0x50e1('0x7f')]({'where':{'id':_0x3de0d7[_0x50e1('0x82')]}});}})[_0x50e1('0x28')](function(_0x54fe76){if(!_0x54fe76){throw new db[(_0x50e1('0x58'))][(_0x50e1('0x59'))](_0x50e1('0x8c'));}if(!_0x54fe76['data1']||!_0x54fe76[_0x50e1('0x8d')]){throw new db[(_0x50e1('0x58'))][(_0x50e1('0x59'))]('Cloud\x20Provider\x20not\x20configured');}_0x3104d1=_0x54fe76;return getBucketslist(_0x3104d1['data1'],_0x3104d1[_0x50e1('0x8d')],_0x3de0d7[_0x50e1('0x83')]);})[_0x50e1('0x28')](function(_0x7be6d1){if(_0x7be6d1&&_0x7be6d1['Buckets']){var _0x38e302=_[_0x50e1('0x52')](_0x7be6d1['Buckets'],function(_0x62ba59){return _0x62ba59[_0x50e1('0x8e')]===_0x3de0d7[_0x50e1('0x76')];});if(!_0x38e302){logger[_0x50e1('0x6a')](util[_0x50e1('0x35')](_0x50e1('0x8f'),_0x5f2a44['params']['id'],_0x3de0d7['bucket']));return createBucket(_0x3104d1['data1'],_0x3104d1['data2'],_0x3de0d7['transcribeRegion'],_0x3de0d7[_0x50e1('0x76')]);}logger['info'](util[_0x50e1('0x35')](_0x50e1('0x90'),_0x5f2a44[_0x50e1('0x4a')]['id'],_0x3de0d7[_0x50e1('0x76')]));return;}})[_0x50e1('0x28')](function(_0x3a051f){if(_0x53f51d[_0x50e1('0x7c')]==='NEW'){return transcribe(_0x5f2a44[_0x50e1('0x4a')]['id'],_0x3104d1[_0x50e1('0x91')],_0x3104d1[_0x50e1('0x8d')],_0x3de0d7['transcribeRegion'],_0x3de0d7[_0x50e1('0x76')],_0x53f51d[_0x50e1('0x53')],_0x3de0d7[_0x50e1('0x89')]);}else{logger[_0x50e1('0x6a')](util['format'](_0x50e1('0x92'),_0x5f2a44[_0x50e1('0x4a')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x50e1('0x28')](function(_0x3d0b14){if(_0x3d0b14){_0x3d0b14[_0x50e1('0x93')]=_0x5f2a44[_0x50e1('0x4d')][_0x50e1('0x85')];return _0x53f51d[_0x50e1('0x94')](_0x3d0b14);}})[_0x50e1('0x28')](respondWithResult(_0x3ca5eb,null))[_0x50e1('0x49')](handleError(_0x3ca5eb,null));};function writeFile(_0x15d49b,_0x16100b){return new Promise(function(_0x68ac34,_0x346802){fs[_0x50e1('0x95')](_0x16100b,_0x15d49b,function(_0x2790d7,_0x463703){if(_0x2790d7){return _0x346802(_0x2790d7);}else{return _0x68ac34(_0x463703);}});});}exports[_0x50e1('0x96')]=function(_0x1d6896,_0x4abe89,_0xa7b56d){return db['VoiceRecording'][_0x50e1('0x7f')]({'where':{'id':_0x1d6896[_0x50e1('0x4a')]['id']}})[_0x50e1('0x28')](handleEntityNotFound(_0x4abe89))[_0x50e1('0x28')](function(_0x41aa49){if(_0x41aa49&&_0x41aa49['fileText']){var _0x47cd0a=_0x41aa49[_0x50e1('0x97')];var _0x3d4adf=config[_0x50e1('0x98')]+_0x50e1('0x99')+_0x41aa49['id']+_0x50e1('0x9a');if(fs['existsSync'](_0x3d4adf)){return _0x3d4adf;}return writeFile(_0x47cd0a,_0x3d4adf)[_0x50e1('0x28')](function(){return _0x3d4adf;});}else{throw new db[(_0x50e1('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0xe09516){return _0x4abe89[_0x50e1('0x4f')](_0xe09516);})[_0x50e1('0x49')](handleError(_0x4abe89));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a3c57cd..a8d32f3 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 _0xc17f=['define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x18ac34,_0x2b1ba2){var _0x4d5444=function(_0x5631e8){while(--_0x5631e8){_0x18ac34['push'](_0x18ac34['shift']());}};_0x4d5444(++_0x2b1ba2);}(_0xc17f,0xb8));var _0xfc17=function(_0x4852f2,_0x3ce31e){_0x4852f2=_0x4852f2-0x0;var _0x10fcf9=_0xc17f[_0x4852f2];return _0x10fcf9;};'use strict';var attributes=require(_0xfc17('0x0'));module[_0xfc17('0x1')]=function(_0x45c778,_0x46c84a){return _0x45c778[_0xfc17('0x2')](_0xfc17('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xfc17('0x4'),'fields':[_0xfc17('0x4')]},{'name':_0xfc17('0x5'),'fields':[_0xfc17('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf9b=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x2f8c0a,_0x58fc5f){_0x2f8c0a=_0x2f8c0a-0x0;var _0x99eede=_0xaf9b[_0x2f8c0a];return _0x99eede;};'use strict';var attributes=require(_0xbaf9('0x0'));module['exports']=function(_0x2c58cf,_0x58d1a2){return _0x2c58cf[_0xbaf9('0x1')](_0xbaf9('0x2'),attributes,{'tableName':_0xbaf9('0x3'),'paranoid':![],'indexes':[{'name':_0xbaf9('0x4'),'fields':['uniqueid']},{'name':_0xbaf9('0x5'),'fields':[_0xbaf9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index bbcf44e..808a34f 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xd943,0x15d));var _0x3d94=function(_0x1eba81,_0x18cee3){_0x1eba81=_0x1eba81-0x0;var _0x2ff17f=_0xd943[_0x1eba81];return _0x2ff17f;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0x10c020,_0x2a69ac){var _0x2d3407=function(_0x4796a6){while(--_0x4796a6){_0x10c020['push'](_0x10c020['shift']());}};_0x2d3407(++_0x2a69ac);}(_0x6a55,0xdb));var _0x56a5=function(_0x6ff984,_0x52fbd1){_0x6ff984=_0x6ff984-0x0;var _0x1b8400=_0x6a55[_0x6ff984];return _0x1b8400;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 7437a8b..f8e0ff1 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 _0x1833=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0xb9de30,_0x19c1a1){var _0x2ca6a2=function(_0x272594){while(--_0x272594){_0xb9de30['push'](_0xb9de30['shift']());}};_0x2ca6a2(++_0x19c1a1);}(_0x1833,0xa2));var _0x3183=function(_0x55c7e4,_0x1746d7){_0x55c7e4=_0x55c7e4-0x0;var _0x48b877=_0x1833[_0x55c7e4];return _0x48b877;};'use strict';var multer=require(_0x3183('0x0'));var util=require(_0x3183('0x1'));var path=require(_0x3183('0x2'));var timeout=require(_0x3183('0x3'));var express=require(_0x3183('0x4'));var router=express['Router']();var fs_extra=require(_0x3183('0x5'));var auth=require(_0x3183('0x6'));var interaction=require(_0x3183('0x7'));var config=require(_0x3183('0x8'));var controller=require(_0x3183('0x9'));router[_0x3183('0xa')]('/',auth['isAuthenticated'](),controller[_0x3183('0xb')]);router[_0x3183('0xa')](_0x3183('0xc'),auth[_0x3183('0xd')](),controller['describe']);router['get'](_0x3183('0xe'),auth[_0x3183('0xd')](),controller[_0x3183('0xf')]);router[_0x3183('0x10')]('/',auth['isAuthenticated'](),controller[_0x3183('0x11')]);router[_0x3183('0x12')](_0x3183('0xe'),auth[_0x3183('0xd')](),controller[_0x3183('0x13')]);router[_0x3183('0x14')](_0x3183('0xe'),auth['isAuthenticated'](),controller[_0x3183('0x15')]);module[_0x3183('0x16')]=router; \ No newline at end of file +var _0x7c78=['/:id','show','post','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe'];(function(_0x3542a3,_0x390011){var _0xf9eac6=function(_0x1a6189){while(--_0x1a6189){_0x3542a3['push'](_0x3542a3['shift']());}};_0xf9eac6(++_0x390011);}(_0x7c78,0x96));var _0x87c7=function(_0x59eb67,_0x556537){_0x59eb67=_0x59eb67-0x0;var _0x1f95f6=_0x7c78[_0x59eb67];return _0x1f95f6;};'use strict';var multer=require(_0x87c7('0x0'));var util=require(_0x87c7('0x1'));var path=require('path');var timeout=require(_0x87c7('0x2'));var express=require(_0x87c7('0x3'));var router=express['Router']();var fs_extra=require(_0x87c7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x87c7('0x5'));var controller=require(_0x87c7('0x6'));router['get']('/',auth[_0x87c7('0x7')](),controller['index']);router[_0x87c7('0x8')](_0x87c7('0x9'),auth[_0x87c7('0x7')](),controller['describe']);router['get'](_0x87c7('0xa'),auth[_0x87c7('0x7')](),controller[_0x87c7('0xb')]);router[_0x87c7('0xc')]('/',auth[_0x87c7('0x7')](),controller['create']);router['put']('/:id',auth[_0x87c7('0x7')](),controller[_0x87c7('0xd')]);router[_0x87c7('0xe')](_0x87c7('0xa'),auth[_0x87c7('0x7')](),controller[_0x87c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f4f9d7a..f198d9e 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 _0x23f2=['ENUM','blind','STRING','sequelize','moment','exports'];(function(_0x52cf0b,_0x50fd6f){var _0x3b887a=function(_0x4986b6){while(--_0x4986b6){_0x52cf0b['push'](_0x52cf0b['shift']());}};_0x3b887a(++_0x50fd6f);}(_0x23f2,0x171));var _0x223f=function(_0xf697c3,_0x31c085){_0xf697c3=_0xf697c3-0x0;var _0x30bf03=_0x23f2[_0xf697c3];return _0x30bf03;};'use strict';var Sequelize=require(_0x223f('0x0'));var moment=require(_0x223f('0x1'));module[_0x223f('0x2')]={'type':{'type':Sequelize[_0x223f('0x3')](_0x223f('0x4'),'attended')},'result':{'type':Sequelize[_0x223f('0x5')]},'transfererchannel':{'type':Sequelize[_0x223f('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x223f('0x5')]},'transferercalleridname':{'type':Sequelize[_0x223f('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x223f('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x223f('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x223f('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x223f('0x5')]},'transfereechannel':{'type':Sequelize[_0x223f('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x223f('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x223f('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x223f('0x5')]},'transfereecontext':{'type':Sequelize[_0x223f('0x5')]},'transfereeexten':{'type':Sequelize[_0x223f('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x223f('0x5')]},'isexternal':{'type':Sequelize[_0x223f('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x223f('0x5')]}}; \ No newline at end of file +var _0x6c63=['blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6c63,0x1c1));var _0x36c6=function(_0x3846a4,_0x278374){_0x3846a4=_0x3846a4-0x0;var _0x5cdce6=_0x6c63[_0x3846a4];return _0x5cdce6;};'use strict';var Sequelize=require(_0x36c6('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x36c6('0x1'),_0x36c6('0x2'))},'result':{'type':Sequelize[_0x36c6('0x3')]},'transfererchannel':{'type':Sequelize[_0x36c6('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x36c6('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x36c6('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x36c6('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x36c6('0x3')]},'transferercontext':{'type':Sequelize[_0x36c6('0x3')]},'transfererexten':{'type':Sequelize[_0x36c6('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x36c6('0x3')]},'transfereechannel':{'type':Sequelize[_0x36c6('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x36c6('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x36c6('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x36c6('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x36c6('0x3')]},'transfereecontext':{'type':Sequelize[_0x36c6('0x3')]},'transfereeexten':{'type':Sequelize[_0x36c6('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x36c6('0x4')](_0x36c6('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x36c6('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a0fb8ae..486cdbc 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 _0x55d1=['../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','VoiceTransferReport','fieldName','type','model','map','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','keys','fields','includeAll','options','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x485cd7,_0x3c438b){var _0x3b1f04=function(_0x4c3a16){while(--_0x4c3a16){_0x485cd7['push'](_0x485cd7['shift']());}};_0x3b1f04(++_0x3c438b);}(_0x55d1,0x15b));var _0x155d=function(_0x467e9a,_0x3f060b){_0x467e9a=_0x467e9a-0x0;var _0x54ab51=_0x55d1[_0x467e9a];return _0x54ab51;};'use strict';var emlformat=require(_0x155d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x155d('0x1'));var jsonpatch=require(_0x155d('0x2'));var rp=require(_0x155d('0x3'));var moment=require('moment');var BPromise=require(_0x155d('0x4'));var Mustache=require(_0x155d('0x5'));var util=require(_0x155d('0x6'));var path=require(_0x155d('0x7'));var sox=require(_0x155d('0x8'));var csv=require(_0x155d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x155d('0xa'));var _=require(_0x155d('0xb'));var squel=require(_0x155d('0xc'));var crypto=require('crypto');var jsforce=require(_0x155d('0xd'));var deskjs=require(_0x155d('0xe'));var toCsv=require(_0x155d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x155d('0xf'));var qs=require(_0x155d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x155d('0x11'));var logger=require(_0x155d('0x12'))(_0x155d('0x13'));var utils=require(_0x155d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x155d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0771,_0xb12c7e){_0xb12c7e=_0xb12c7e||0xcc;return function(_0x1f31fa){if(_0x1f31fa){return _0x3c0771[_0x155d('0x16')](_0xb12c7e);}return _0x3c0771[_0x155d('0x17')](_0xb12c7e)[_0x155d('0x18')]();};}function respondWithResult(_0x5eb35e,_0x4c9611){_0x4c9611=_0x4c9611||0xc8;return function(_0x4d6354){if(_0x4d6354){return _0x5eb35e[_0x155d('0x17')](_0x4c9611)[_0x155d('0x19')](_0x4d6354);}};}function respondWithFilteredResult(_0x21adb8,_0x3bd443){return function(_0x1628f6){if(_0x1628f6){var _0x5a5b76=typeof _0x3bd443[_0x155d('0x1a')]===_0x155d('0x1b')&&typeof _0x3bd443[_0x155d('0x1c')]==='undefined';var _0x7d5724=_0x1628f6[_0x155d('0x1d')];var _0x42ce6d=_0x5a5b76?0x0:_0x3bd443[_0x155d('0x1a')];var _0x41a1d2=_0x5a5b76?_0x1628f6[_0x155d('0x1d')]:_0x3bd443[_0x155d('0x1a')]+_0x3bd443[_0x155d('0x1c')];var _0x5c049;if(_0x41a1d2>=_0x7d5724){_0x41a1d2=_0x7d5724;_0x5c049=0xc8;}else{_0x5c049=0xce;}_0x21adb8[_0x155d('0x17')](_0x5c049);return _0x21adb8[_0x155d('0x1e')](_0x155d('0x1f'),_0x42ce6d+'-'+_0x41a1d2+'/'+_0x7d5724)[_0x155d('0x19')](_0x1628f6);}return null;};}function patchUpdates(_0x528d28){return function(_0x2c9397){try{jsonpatch[_0x155d('0x20')](_0x2c9397,_0x528d28,!![]);}catch(_0x4f4f31){return BPromise['reject'](_0x4f4f31);}return _0x2c9397[_0x155d('0x21')]();};}function saveUpdates(_0x16f409,_0x3dbca9){return function(_0x192dde){if(_0x192dde){return _0x192dde['update'](_0x16f409)[_0x155d('0x22')](function(_0x3ae3ee){return _0x3ae3ee;});}return null;};}function removeEntity(_0x13590c,_0x19cedf){return function(_0x391e71){if(_0x391e71){return _0x391e71[_0x155d('0x23')]()[_0x155d('0x22')](function(){_0x13590c[_0x155d('0x17')](0xcc)[_0x155d('0x18')]();});}};}function handleEntityNotFound(_0x224bb7,_0x53c4ef){return function(_0x47615e){if(!_0x47615e){_0x224bb7[_0x155d('0x16')](0x194);}return _0x47615e;};}function handleError(_0x4a7e66,_0x8d33ff){_0x8d33ff=_0x8d33ff||0x1f4;return function(_0x14a6e8){logger[_0x155d('0x24')](_0x14a6e8[_0x155d('0x25')]);if(_0x14a6e8[_0x155d('0x26')]){delete _0x14a6e8['name'];}_0x4a7e66[_0x155d('0x17')](_0x8d33ff)['send'](_0x14a6e8);};}exports[_0x155d('0x27')]=function(_0x3c6bff,_0x2aadf9){var _0x1ec6de={},_0x4539a5={},_0xd9e65e={'count':0x0,'rows':[]};var _0x1f3e56=_['map'](db[_0x155d('0x28')]['rawAttributes'],function(_0x4b86fa){return{'name':_0x4b86fa[_0x155d('0x29')],'type':_0x4b86fa[_0x155d('0x2a')]['key']};});_0x4539a5[_0x155d('0x2b')]=_[_0x155d('0x2c')](_0x1f3e56,'name');_0x4539a5[_0x155d('0x2d')]=_['keys'](_0x3c6bff[_0x155d('0x2d')]);_0x4539a5['filters']=_[_0x155d('0x2e')](_0x4539a5['model'],_0x4539a5[_0x155d('0x2d')]);_0x1ec6de[_0x155d('0x2f')]=_[_0x155d('0x2e')](_0x4539a5[_0x155d('0x2b')],qs['fields'](_0x3c6bff[_0x155d('0x2d')]['fields']));_0x1ec6de[_0x155d('0x2f')]=_0x1ec6de[_0x155d('0x2f')][_0x155d('0x30')]?_0x1ec6de['attributes']:_0x4539a5[_0x155d('0x2b')];if(!_0x3c6bff['query'][_0x155d('0x31')](_0x155d('0x32'))){_0x1ec6de[_0x155d('0x1c')]=qs[_0x155d('0x1c')](_0x3c6bff[_0x155d('0x2d')]['limit']);_0x1ec6de[_0x155d('0x1a')]=qs[_0x155d('0x1a')](_0x3c6bff['query']['offset']);}_0x1ec6de[_0x155d('0x33')]=qs[_0x155d('0x34')](_0x3c6bff[_0x155d('0x2d')]['sort']);_0x1ec6de[_0x155d('0x35')]=qs[_0x155d('0x36')](_['pick'](_0x3c6bff[_0x155d('0x2d')],_0x4539a5['filters']),_0x1f3e56);if(_0x3c6bff[_0x155d('0x2d')][_0x155d('0x37')]){_0x1ec6de[_0x155d('0x35')]=_[_0x155d('0x38')](_0x1ec6de[_0x155d('0x35')],{'$or':_[_0x155d('0x2c')](_0x1f3e56,function(_0x3f97c9){if(_0x3f97c9[_0x155d('0x2a')]!==_0x155d('0x39')){var _0x4ec7ae={};_0x4ec7ae[_0x3f97c9[_0x155d('0x26')]]={'$like':'%'+_0x3c6bff[_0x155d('0x2d')]['filter']+'%'};return _0x4ec7ae;}})});}_0x1ec6de=_[_0x155d('0x38')]({},_0x1ec6de,_0x3c6bff['options']);var _0x38d3b1={'where':_0x1ec6de['where']};return db[_0x155d('0x28')][_0x155d('0x1d')](_0x38d3b1)[_0x155d('0x22')](function(_0x316f89){_0xd9e65e[_0x155d('0x1d')]=_0x316f89;if(_0x3c6bff[_0x155d('0x2d')]['includeAll']){_0x1ec6de[_0x155d('0x3a')]=[{'all':!![]}];}return db[_0x155d('0x28')][_0x155d('0x3b')](_0x1ec6de);})['then'](function(_0x46ded0){_0xd9e65e['rows']=_0x46ded0;return _0xd9e65e;})[_0x155d('0x22')](respondWithFilteredResult(_0x2aadf9,_0x1ec6de))[_0x155d('0x3c')](handleError(_0x2aadf9,null));};exports[_0x155d('0x3d')]=function(_0x40481b,_0x5deccf){var _0x202fad={'raw':!![],'where':{'id':_0x40481b[_0x155d('0x3e')]['id']}},_0x332fe1={};_0x332fe1['model']=_['keys'](db[_0x155d('0x28')][_0x155d('0x3f')]);_0x332fe1[_0x155d('0x2d')]=_[_0x155d('0x40')](_0x40481b[_0x155d('0x2d')]);_0x332fe1[_0x155d('0x36')]=_[_0x155d('0x2e')](_0x332fe1[_0x155d('0x2b')],_0x332fe1[_0x155d('0x2d')]);_0x202fad['attributes']=_[_0x155d('0x2e')](_0x332fe1[_0x155d('0x2b')],qs[_0x155d('0x41')](_0x40481b[_0x155d('0x2d')]['fields']));_0x202fad['attributes']=_0x202fad[_0x155d('0x2f')][_0x155d('0x30')]?_0x202fad[_0x155d('0x2f')]:_0x332fe1[_0x155d('0x2b')];if(_0x40481b[_0x155d('0x2d')][_0x155d('0x42')]){_0x202fad[_0x155d('0x3a')]=[{'all':!![]}];}_0x202fad=_['merge']({},_0x202fad,_0x40481b[_0x155d('0x43')]);return db[_0x155d('0x28')][_0x155d('0x44')](_0x202fad)[_0x155d('0x22')](handleEntityNotFound(_0x5deccf,null))[_0x155d('0x22')](respondWithResult(_0x5deccf,null))['catch'](handleError(_0x5deccf,null));};exports[_0x155d('0x45')]=function(_0x4f246a,_0x43325e){return db[_0x155d('0x28')][_0x155d('0x45')](_0x4f246a['body'],{})[_0x155d('0x22')](respondWithResult(_0x43325e,0xc9))[_0x155d('0x3c')](handleError(_0x43325e,null));};exports[_0x155d('0x46')]=function(_0x5b85d9,_0x2bc1e9){if(_0x5b85d9[_0x155d('0x47')]['id']){delete _0x5b85d9[_0x155d('0x47')]['id'];}return db[_0x155d('0x28')]['find']({'where':{'id':_0x5b85d9['params']['id']}})[_0x155d('0x22')](handleEntityNotFound(_0x2bc1e9,null))[_0x155d('0x22')](saveUpdates(_0x5b85d9['body'],null))[_0x155d('0x22')](respondWithResult(_0x2bc1e9,null))[_0x155d('0x3c')](handleError(_0x2bc1e9,null));};exports[_0x155d('0x23')]=function(_0x3f6488,_0x27f973){return db[_0x155d('0x28')]['find']({'where':{'id':_0x3f6488[_0x155d('0x3e')]['id']}})[_0x155d('0x22')](handleEntityNotFound(_0x27f973,null))[_0x155d('0x22')](removeEntity(_0x27f973,null))[_0x155d('0x3c')](handleError(_0x27f973,null));};exports[_0x155d('0x48')]=function(_0x1d2a21,_0x3e77de){return db[_0x155d('0x28')][_0x155d('0x48')]()[_0x155d('0x22')](respondWithResult(_0x3e77de,null))['catch'](handleError(_0x3e77de,null));}; \ No newline at end of file +var _0x00bd=['options','where','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge'];(function(_0x208dd8,_0x44bf8f){var _0x3e7ce9=function(_0x32a8d4){while(--_0x32a8d4){_0x208dd8['push'](_0x208dd8['shift']());}};_0x3e7ce9(++_0x44bf8f);}(_0x00bd,0x136));var _0xd00b=function(_0x61255f,_0x421690){_0x61255f=_0x61255f-0x0;var _0xce5c53=_0x00bd[_0x61255f];return _0xce5c53;};'use strict';var emlformat=require(_0xd00b('0x0'));var rimraf=require(_0xd00b('0x1'));var zipdir=require(_0xd00b('0x2'));var jsonpatch=require(_0xd00b('0x3'));var rp=require(_0xd00b('0x4'));var moment=require('moment');var BPromise=require(_0xd00b('0x5'));var Mustache=require(_0xd00b('0x6'));var util=require(_0xd00b('0x7'));var path=require(_0xd00b('0x8'));var sox=require(_0xd00b('0x9'));var csv=require('to-csv');var ejs=require(_0xd00b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd00b('0xb'));var squel=require('squel');var crypto=require(_0xd00b('0xc'));var jsforce=require(_0xd00b('0xd'));var deskjs=require(_0xd00b('0xe'));var toCsv=require(_0xd00b('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd00b('0x10'));var as=require(_0xd00b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd00b('0x12'));var config=require(_0xd00b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd00b('0x14'))['db'];function respondWithStatusCode(_0x2859ac,_0x45dc45){_0x45dc45=_0x45dc45||0xcc;return function(_0x16843e){if(_0x16843e){return _0x2859ac['sendStatus'](_0x45dc45);}return _0x2859ac[_0xd00b('0x15')](_0x45dc45)[_0xd00b('0x16')]();};}function respondWithResult(_0x260151,_0x52270c){_0x52270c=_0x52270c||0xc8;return function(_0x4aeb65){if(_0x4aeb65){return _0x260151[_0xd00b('0x15')](_0x52270c)[_0xd00b('0x17')](_0x4aeb65);}};}function respondWithFilteredResult(_0x2b22aa,_0x2ce7ab){return function(_0x226498){if(_0x226498){var _0x1542d6=typeof _0x2ce7ab['offset']==='undefined'&&typeof _0x2ce7ab[_0xd00b('0x18')]===_0xd00b('0x19');var _0x301339=_0x226498[_0xd00b('0x1a')];var _0x251117=_0x1542d6?0x0:_0x2ce7ab[_0xd00b('0x1b')];var _0x914d05=_0x1542d6?_0x226498[_0xd00b('0x1a')]:_0x2ce7ab[_0xd00b('0x1b')]+_0x2ce7ab[_0xd00b('0x18')];var _0x5b1aff;if(_0x914d05>=_0x301339){_0x914d05=_0x301339;_0x5b1aff=0xc8;}else{_0x5b1aff=0xce;}_0x2b22aa[_0xd00b('0x15')](_0x5b1aff);return _0x2b22aa['set']('Content-Range',_0x251117+'-'+_0x914d05+'/'+_0x301339)[_0xd00b('0x17')](_0x226498);}return null;};}function patchUpdates(_0x7b6862){return function(_0x26bb5f){try{jsonpatch[_0xd00b('0x1c')](_0x26bb5f,_0x7b6862,!![]);}catch(_0x2a0058){return BPromise[_0xd00b('0x1d')](_0x2a0058);}return _0x26bb5f[_0xd00b('0x1e')]();};}function saveUpdates(_0x1f177d,_0x1e4b00){return function(_0x2626d0){if(_0x2626d0){return _0x2626d0[_0xd00b('0x1f')](_0x1f177d)[_0xd00b('0x20')](function(_0x43f45c){return _0x43f45c;});}return null;};}function removeEntity(_0x37a378,_0x4503dd){return function(_0x153502){if(_0x153502){return _0x153502[_0xd00b('0x21')]()[_0xd00b('0x20')](function(){_0x37a378[_0xd00b('0x15')](0xcc)[_0xd00b('0x16')]();});}};}function handleEntityNotFound(_0x216bd0,_0x4ceb13){return function(_0x341aa4){if(!_0x341aa4){_0x216bd0[_0xd00b('0x22')](0x194);}return _0x341aa4;};}function handleError(_0x2b7e54,_0x41998e){_0x41998e=_0x41998e||0x1f4;return function(_0x23b199){logger[_0xd00b('0x23')](_0x23b199[_0xd00b('0x24')]);if(_0x23b199['name']){delete _0x23b199[_0xd00b('0x25')];}_0x2b7e54[_0xd00b('0x15')](_0x41998e)[_0xd00b('0x26')](_0x23b199);};}exports[_0xd00b('0x27')]=function(_0x41c625,_0x488b70){var _0x90c86d={},_0x3a3ad4={},_0xeef9b={'count':0x0,'rows':[]};var _0x465e6a=_[_0xd00b('0x28')](db[_0xd00b('0x29')][_0xd00b('0x2a')],function(_0x22a148){return{'name':_0x22a148[_0xd00b('0x2b')],'type':_0x22a148[_0xd00b('0x2c')][_0xd00b('0x2d')]};});_0x3a3ad4[_0xd00b('0x2e')]=_[_0xd00b('0x28')](_0x465e6a,_0xd00b('0x25'));_0x3a3ad4['query']=_[_0xd00b('0x2f')](_0x41c625[_0xd00b('0x30')]);_0x3a3ad4[_0xd00b('0x31')]=_[_0xd00b('0x32')](_0x3a3ad4[_0xd00b('0x2e')],_0x3a3ad4[_0xd00b('0x30')]);_0x90c86d[_0xd00b('0x33')]=_[_0xd00b('0x32')](_0x3a3ad4[_0xd00b('0x2e')],qs[_0xd00b('0x34')](_0x41c625[_0xd00b('0x30')][_0xd00b('0x34')]));_0x90c86d['attributes']=_0x90c86d[_0xd00b('0x33')]['length']?_0x90c86d['attributes']:_0x3a3ad4[_0xd00b('0x2e')];if(!_0x41c625['query'][_0xd00b('0x35')](_0xd00b('0x36'))){_0x90c86d[_0xd00b('0x18')]=qs[_0xd00b('0x18')](_0x41c625[_0xd00b('0x30')]['limit']);_0x90c86d[_0xd00b('0x1b')]=qs[_0xd00b('0x1b')](_0x41c625[_0xd00b('0x30')][_0xd00b('0x1b')]);}_0x90c86d[_0xd00b('0x37')]=qs['sort'](_0x41c625['query'][_0xd00b('0x38')]);_0x90c86d['where']=qs[_0xd00b('0x31')](_['pick'](_0x41c625['query'],_0x3a3ad4[_0xd00b('0x31')]),_0x465e6a);if(_0x41c625[_0xd00b('0x30')][_0xd00b('0x39')]){_0x90c86d['where']=_['merge'](_0x90c86d['where'],{'$or':_[_0xd00b('0x28')](_0x465e6a,function(_0x3bbb8d){if(_0x3bbb8d[_0xd00b('0x2c')]!==_0xd00b('0x3a')){var _0x32b585={};_0x32b585[_0x3bbb8d['name']]={'$like':'%'+_0x41c625[_0xd00b('0x30')][_0xd00b('0x39')]+'%'};return _0x32b585;}})});}_0x90c86d=_[_0xd00b('0x3b')]({},_0x90c86d,_0x41c625[_0xd00b('0x3c')]);var _0x2827c0={'where':_0x90c86d[_0xd00b('0x3d')]};return db[_0xd00b('0x29')]['count'](_0x2827c0)[_0xd00b('0x20')](function(_0x5e4e99){_0xeef9b[_0xd00b('0x1a')]=_0x5e4e99;if(_0x41c625['query'][_0xd00b('0x3e')]){_0x90c86d[_0xd00b('0x3f')]=[{'all':!![]}];}return db[_0xd00b('0x29')][_0xd00b('0x40')](_0x90c86d);})['then'](function(_0x44b987){_0xeef9b[_0xd00b('0x41')]=_0x44b987;return _0xeef9b;})['then'](respondWithFilteredResult(_0x488b70,_0x90c86d))['catch'](handleError(_0x488b70,null));};exports[_0xd00b('0x42')]=function(_0x4e4549,_0x1748c0){var _0x1d4304={'raw':!![],'where':{'id':_0x4e4549[_0xd00b('0x43')]['id']}},_0x559308={};_0x559308[_0xd00b('0x2e')]=_[_0xd00b('0x2f')](db[_0xd00b('0x29')][_0xd00b('0x2a')]);_0x559308[_0xd00b('0x30')]=_[_0xd00b('0x2f')](_0x4e4549[_0xd00b('0x30')]);_0x559308[_0xd00b('0x31')]=_[_0xd00b('0x32')](_0x559308[_0xd00b('0x2e')],_0x559308[_0xd00b('0x30')]);_0x1d4304[_0xd00b('0x33')]=_[_0xd00b('0x32')](_0x559308[_0xd00b('0x2e')],qs['fields'](_0x4e4549['query'][_0xd00b('0x34')]));_0x1d4304[_0xd00b('0x33')]=_0x1d4304['attributes'][_0xd00b('0x44')]?_0x1d4304[_0xd00b('0x33')]:_0x559308[_0xd00b('0x2e')];if(_0x4e4549[_0xd00b('0x30')][_0xd00b('0x3e')]){_0x1d4304[_0xd00b('0x3f')]=[{'all':!![]}];}_0x1d4304=_[_0xd00b('0x3b')]({},_0x1d4304,_0x4e4549[_0xd00b('0x3c')]);return db[_0xd00b('0x29')]['find'](_0x1d4304)['then'](handleEntityNotFound(_0x1748c0,null))[_0xd00b('0x20')](respondWithResult(_0x1748c0,null))[_0xd00b('0x45')](handleError(_0x1748c0,null));};exports[_0xd00b('0x46')]=function(_0x3d4afb,_0x426780){return db['VoiceTransferReport'][_0xd00b('0x46')](_0x3d4afb['body'],{})[_0xd00b('0x20')](respondWithResult(_0x426780,0xc9))[_0xd00b('0x45')](handleError(_0x426780,null));};exports['update']=function(_0x2f6871,_0x2d0d81){if(_0x2f6871['body']['id']){delete _0x2f6871[_0xd00b('0x47')]['id'];}return db['VoiceTransferReport'][_0xd00b('0x48')]({'where':{'id':_0x2f6871['params']['id']}})[_0xd00b('0x20')](handleEntityNotFound(_0x2d0d81,null))[_0xd00b('0x20')](saveUpdates(_0x2f6871['body'],null))['then'](respondWithResult(_0x2d0d81,null))[_0xd00b('0x45')](handleError(_0x2d0d81,null));};exports['destroy']=function(_0xe5db00,_0x31786c){return db[_0xd00b('0x29')][_0xd00b('0x48')]({'where':{'id':_0xe5db00[_0xd00b('0x43')]['id']}})[_0xd00b('0x20')](handleEntityNotFound(_0x31786c,null))[_0xd00b('0x20')](removeEntity(_0x31786c,null))[_0xd00b('0x45')](handleError(_0x31786c,null));};exports['describe']=function(_0x1436c1,_0x357550){return db[_0xd00b('0x29')][_0xd00b('0x49')]()[_0xd00b('0x20')](respondWithResult(_0x357550,null))[_0xd00b('0x45')](handleError(_0x357550,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7c2cb9f..0895bcb 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 _0xe857=['report_call_transfer','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0xcb7169,_0x1412c3){var _0x458921=function(_0x42ba82){while(--_0x42ba82){_0xcb7169['push'](_0xcb7169['shift']());}};_0x458921(++_0x1412c3);}(_0xe857,0x199));var _0x7e85=function(_0x54e64c,_0x246c37){_0x54e64c=_0x54e64c-0x0;var _0x512e24=_0xe857[_0x54e64c];return _0x512e24;};'use strict';var _=require('lodash');var util=require(_0x7e85('0x0'));var logger=require(_0x7e85('0x1'))('api');var moment=require(_0x7e85('0x2'));var BPromise=require(_0x7e85('0x3'));var rp=require(_0x7e85('0x4'));var fs=require('fs');var path=require(_0x7e85('0x5'));var rimraf=require(_0x7e85('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e85('0x7'));module[_0x7e85('0x8')]=function(_0x10b30c,_0x5a06a5){return _0x10b30c[_0x7e85('0x9')](_0x7e85('0xa'),attributes,{'tableName':_0x7e85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf27d=['../../config/environment','exports','define','VoiceTransferReport','lodash','bluebird','request-promise','path'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xf27d,0x94));var _0xdf27=function(_0x285c86,_0x4c522a){_0x285c86=_0x285c86-0x0;var _0x49573d=_0xf27d[_0x285c86];return _0x49573d;};'use strict';var _=require(_0xdf27('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdf27('0x1'));var rp=require(_0xdf27('0x2'));var fs=require('fs');var path=require(_0xdf27('0x3'));var rimraf=require('rimraf');var config=require(_0xdf27('0x4'));var attributes=require('./voiceTransferReport.attributes');module[_0xdf27('0x5')]=function(_0x372a8d,_0x248279){return _0x372a8d[_0xdf27('0x6')](_0xdf27('0x7'),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 adb4a4b..3134533 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 _0x3fec=['raw','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options'];(function(_0x1a17d9,_0x4db427){var _0x481201=function(_0x3deae9){while(--_0x3deae9){_0x1a17d9['push'](_0x1a17d9['shift']());}};_0x481201(++_0x4db427);}(_0x3fec,0x79));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require(_0xc3fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3fe('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3fe('0x3'));var logger=require(_0xc3fe('0x4'))(_0xc3fe('0x5'));var config=require(_0xc3fe('0x6'));var jayson=require(_0xc3fe('0x7'));var client=jayson['client'][_0xc3fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5725f3,_0x509825,_0x4a1ef2){return new BPromise(function(_0x5b8a29,_0x333fa3){return client['request'](_0x5725f3,_0x4a1ef2)['then'](function(_0x317356){logger[_0xc3fe('0x9')](_0xc3fe('0xa'),_0x509825,'request\x20sent');logger[_0xc3fe('0xb')](_0xc3fe('0xc'),_0x509825,_0xc3fe('0xd'),JSON['stringify'](_0x317356));if(_0x317356[_0xc3fe('0xe')]){if(_0x317356[_0xc3fe('0xe')][_0xc3fe('0xf')]===0x1f4){logger['error'](_0xc3fe('0xa'),_0x509825,_0x317356[_0xc3fe('0xe')]['message']);return _0x333fa3(_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);}logger[_0xc3fe('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x509825,_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);return _0x5b8a29(_0x317356[_0xc3fe('0xe')][_0xc3fe('0x10')]);}else{logger[_0xc3fe('0x9')](_0xc3fe('0xa'),_0x509825,_0xc3fe('0xd'));_0x5b8a29(_0x317356[_0xc3fe('0x11')]['message']);}})[_0xc3fe('0x12')](function(_0x2401af){logger[_0xc3fe('0xe')](_0xc3fe('0xa'),_0x509825,_0x2401af);_0x333fa3(_0x2401af);});});}exports[_0xc3fe('0x13')]=function(_0xe5cb83){var _0x1bba78=this;return new Promise(function(_0x27428f,_0x465b10){return db[_0xc3fe('0x14')]['create'](_0xe5cb83[_0xc3fe('0x15')],{'raw':_0xe5cb83[_0xc3fe('0x16')]?_0xe5cb83['options'][_0xc3fe('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x50c77c){logger[_0xc3fe('0x9')](_0xc3fe('0x13'),_0xe5cb83);logger[_0xc3fe('0xb')]('CreateVoiceTransferReport',_0xe5cb83,JSON['stringify'](_0x50c77c));_0x27428f(_0x50c77c);})[_0xc3fe('0x12')](function(_0x15d1b1){logger[_0xc3fe('0xe')](_0xc3fe('0x13'),_0x15d1b1[_0xc3fe('0x10')],_0xe5cb83);_0x465b10(_0x1bba78[_0xc3fe('0xe')](0x1f4,_0x15d1b1['message']));});});}; \ No newline at end of file +var _0x5f57=['message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0x5f57,0x19d));var _0x75f5=function(_0x1bfc7a,_0x2df6c4){_0x1bfc7a=_0x1bfc7a-0x0;var _0x54e5fc=_0x5f57[_0x1bfc7a];return _0x54e5fc;};'use strict';var _=require(_0x75f5('0x0'));var util=require(_0x75f5('0x1'));var moment=require(_0x75f5('0x2'));var BPromise=require(_0x75f5('0x3'));var rs=require(_0x75f5('0x4'));var fs=require('fs');var Redis=require(_0x75f5('0x5'));var db=require(_0x75f5('0x6'))['db'];var utils=require(_0x75f5('0x7'));var logger=require(_0x75f5('0x8'))(_0x75f5('0x9'));var config=require(_0x75f5('0xa'));var jayson=require(_0x75f5('0xb'));var client=jayson[_0x75f5('0xc')][_0x75f5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7c4420,_0x5c59bd,_0x36f839){return new BPromise(function(_0x50b91a,_0xd3e1f8){return client['request'](_0x7c4420,_0x36f839)['then'](function(_0x15f5d5){logger[_0x75f5('0xe')](_0x75f5('0xf'),_0x5c59bd,'request\x20sent');logger[_0x75f5('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5c59bd,_0x75f5('0x11'),JSON[_0x75f5('0x12')](_0x15f5d5));if(_0x15f5d5[_0x75f5('0x13')]){if(_0x15f5d5[_0x75f5('0x13')][_0x75f5('0x14')]===0x1f4){logger[_0x75f5('0x13')](_0x75f5('0xf'),_0x5c59bd,_0x15f5d5[_0x75f5('0x13')][_0x75f5('0x15')]);return _0xd3e1f8(_0x15f5d5[_0x75f5('0x13')]['message']);}logger[_0x75f5('0x13')](_0x75f5('0xf'),_0x5c59bd,_0x15f5d5[_0x75f5('0x13')][_0x75f5('0x15')]);return _0x50b91a(_0x15f5d5[_0x75f5('0x13')][_0x75f5('0x15')]);}else{logger[_0x75f5('0xe')](_0x75f5('0xf'),_0x5c59bd,_0x75f5('0x11'));_0x50b91a(_0x15f5d5[_0x75f5('0x16')][_0x75f5('0x15')]);}})[_0x75f5('0x17')](function(_0x213157){logger[_0x75f5('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c59bd,_0x213157);_0xd3e1f8(_0x213157);});});}exports[_0x75f5('0x18')]=function(_0x11fe29){var _0x5cbdd2=this;return new Promise(function(_0x5136a5,_0x392442){return db[_0x75f5('0x19')][_0x75f5('0x1a')](_0x11fe29[_0x75f5('0x1b')],{'raw':_0x11fe29[_0x75f5('0x1c')]?_0x11fe29[_0x75f5('0x1c')][_0x75f5('0x1d')]===undefined?!![]:![]:!![]})[_0x75f5('0x1e')](function(_0x45c14f){logger[_0x75f5('0xe')]('CreateVoiceTransferReport',_0x11fe29);logger[_0x75f5('0x10')](_0x75f5('0x18'),_0x11fe29,JSON[_0x75f5('0x12')](_0x45c14f));_0x5136a5(_0x45c14f);})[_0x75f5('0x17')](function(_0x5a2dfe){logger[_0x75f5('0x13')](_0x75f5('0x18'),_0x5a2dfe['message'],_0x11fe29);_0x392442(_0x5cbdd2[_0x75f5('0x13')](0x1f4,_0x5a2dfe[_0x75f5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 47c44ec..cf2c9a3 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x25b310,_0x5ce2ee){var _0x525d37=function(_0x30930a){while(--_0x30930a){_0x25b310['push'](_0x25b310['shift']());}};_0x525d37(++_0x5ce2ee);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4f9e2b,_0x216629){_0x4f9e2b=_0x4f9e2b-0x0;var _0x494d90=_0xf4eb[_0x4f9e2b];return _0x494d90;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x691489,_0x263745){var _0x52e3fb=function(_0x2bcdf1){while(--_0x2bcdf1){_0x691489['push'](_0x691489['shift']());}};_0x52e3fb(++_0x263745);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0xb4e6[_0x3fa296];return _0x10b19f;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index be5ea76..515231a 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 _0xe205=['hold\x20fired:','hold\x20executed!','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','hangup','hangup\x20fired:','userId','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold'];(function(_0x4bda76,_0x58f3b4){var _0x753838=function(_0x307050){while(--_0x307050){_0x4bda76['push'](_0x4bda76['shift']());}};_0x753838(++_0x58f3b4);}(_0xe205,0xa7));var _0x5e20=function(_0x58991c,_0x1eaab5){_0x58991c=_0x58991c-0x0;var _0x4ddbfd=_0xe205[_0x58991c];return _0x4ddbfd;};'use strict';var path=require(_0x5e20('0x0'));var fs=require('fs');var _=require(_0x5e20('0x1'));var db=require(_0x5e20('0x2'))['db'];var config=require(_0x5e20('0x3'));var util=require(_0x5e20('0x4'));var BPromise=require(_0x5e20('0x5'));var jayson=require(_0x5e20('0x6'));var amiClient=jayson[_0x5e20('0x7')][_0x5e20('0x8')]({'port':0x232a});var logger=require('../../config/logger')(_0x5e20('0x9'));var Redis=require(_0x5e20('0xa'));config[_0x5e20('0xb')]=_[_0x5e20('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e20('0xd'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'callNumber':{'type':'string','required':[!![],_0x5e20('0x10')]},'callerId':{'type':_0x5e20('0x11')},'callbackUrl':{'type':_0x5e20('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':[!![],_0x5e20('0x12')]},'transferNumber':{'type':_0x5e20('0x11'),'required':[!![],_0x5e20('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5e20('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5e20('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5e20('0xe'),'required':[!![],_0x5e20('0xf')]}});function emit(_0x542b3c,_0xeaeb77,_0x9a59ce){logger[_0x5e20('0x14')](_0x542b3c,_0xeaeb77,JSON[_0x5e20('0x15')](_0x9a59ce));io['to'](_0x542b3c)[_0x5e20('0x16')](_0xeaeb77,_0x9a59ce);}function handleError(_0x3b353f){return function(_0x1cc706){console[_0x5e20('0x17')]('handleError:',_0x1cc706,_0x1cc706 instanceof RangeError);logger[_0x5e20('0x18')](_0x1cc706[_0x5e20('0x19')]);if(_0x1cc706 instanceof RangeError){if(_0x1cc706['name']){delete _0x1cc706[_0x5e20('0x1a')];}_0x3b353f[_0x5e20('0x1b')](0x194)[_0x5e20('0x1c')](_0x1cc706);}else{if(_0x1cc706[_0x5e20('0x1a')]){delete _0x1cc706['name'];}_0x3b353f[_0x5e20('0x1b')](0x1f4)['send'](_0x1cc706);}};}function checkError(){return function(_0x4a3587){if(!_0x4a3587){throw new RangeError('NotFound');}return _0x4a3587;};}function respondWithRpcPromise(_0x5d0d1a,_0xe562ba){return new BPromise(function(_0x5cca90,_0x3d89e4){var _0x29b111=amiClient;return _0x29b111[_0x5e20('0x1d')](_0x5d0d1a,_0xe562ba)[_0x5e20('0x1e')](function(_0x3ef7fa){if(_0x3ef7fa[_0x5e20('0x18')]){if(_0x3ef7fa['error'][_0x5e20('0x1f')]===0x1f4){return _0x3d89e4(_0x3ef7fa['error']['message']);}return _0x5cca90(_0x3ef7fa[_0x5e20('0x18')][_0x5e20('0x20')]);}else{_0x5cca90(_0x3ef7fa[_0x5e20('0x21')]);}})[_0x5e20('0x22')](function(_0xbf7a24){_0x3d89e4(_0xbf7a24);});});}function getAgent(_0x200774){return db[_0x5e20('0x23')]['findOne']({'where':{'id':_0x200774,'role':_0x5e20('0x24')}})[_0x5e20('0x1e')](checkError());}function getAgentCheckSession(_0x238758,_0x3032ef){return new BPromise(function(_0x4c799d,_0x3a0f06){var _0x2c5d80=respondWithRpcPromise(_0x5e20('0x25'));var _0x222e7a=getAgent(_0x238758);Promise[_0x5e20('0x26')]([_0x2c5d80,_0x222e7a])[_0x5e20('0x1e')](function(_0x5ec45b){var _0xbc2b0e=_0x5ec45b[0x0];var _0x34a3d6=_0x5ec45b[0x1];var _0x543c29=_[_0x5e20('0x27')](_0xbc2b0e[_0x5e20('0x28')],function(_0x335f1e){return _0x335f1e[_0x5e20('0x29')]==_0x34a3d6['id']&&_0x335f1e[_0x5e20('0x2a')]==_0x3032ef;});if(_0x543c29[_0x5e20('0x2b')]==0x1){_0x4c799d(_0x34a3d6);}else{_0x3a0f06(new RangeError('sessionId\x20'+_0x3032ef+_0x5e20('0x2c')));}});});}exports[_0x5e20('0x2d')]=function(_0x330341,_0x5f2f1d){logger[_0x5e20('0x14')](_0x5e20('0x2e'),_0x330341[_0x5e20('0x2f')]);var _0x1ed59d=originateValidation[_0x5e20('0x30')](_0x330341[_0x5e20('0x2f')]);if(_0x1ed59d[_0x5e20('0x2b')]>0x0){return _0x5f2f1d['status'](0x190)[_0x5e20('0x31')](_0x1ed59d);}var _0x1a9fff=_0x330341[_0x5e20('0x2f')]['userId'];var _0x9469cd=_0x330341[_0x5e20('0x2f')][_0x5e20('0x32')];var _0x2e367e=_0x330341[_0x5e20('0x2f')][_0x5e20('0x33')];var _0x1114ae=_0x330341[_0x5e20('0x2f')][_0x5e20('0x34')];return getAgent(_0x1a9fff)[_0x5e20('0x1e')](function(_0x36e825){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x36e825[_0x5e20('0x1a')]);emit(util['format'](_0x5e20('0x36'),_0x36e825['name']),'webbar:originate',{'callNumber':_0x9469cd,'callerId':_0x2e367e,'callbackUrl':_0x1114ae});return _0x5f2f1d[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0x5e20('0x22')](handleError(_0x5f2f1d));};exports[_0x5e20('0x37')]=function(_0x4f34c0,_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x38'),_0x4f34c0[_0x5e20('0x2f')]);var _0x15ce1d=hangupValidation[_0x5e20('0x30')](_0x4f34c0[_0x5e20('0x2f')]);if(_0x15ce1d[_0x5e20('0x2b')]>0x0){return _0x3f3908[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x15ce1d);}var _0x473b69=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x1cb3f0=_0x4f34c0[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x473b69)[_0x5e20('0x1e')](function(_0x17feb4){logger['info'](_0x5e20('0x35'),_0x17feb4[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x17feb4[_0x5e20('0x1a')]),'webbar:hangup',{'sessionId':_0x1cb3f0});return _0x3f3908[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x3b')});})[_0x5e20('0x22')](handleError(_0x3f3908));};exports[_0x5e20('0x3c')]=function(_0x30d3ef,_0x5c7ae8){logger[_0x5e20('0x14')](_0x5e20('0x3d'),_0x30d3ef[_0x5e20('0x2f')]);var _0x5a21f0=answerValidation[_0x5e20('0x30')](_0x30d3ef[_0x5e20('0x2f')]);if(_0x5a21f0[_0x5e20('0x2b')]>0x0){return _0x5c7ae8[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5a21f0);}var _0x336d61=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x5c9504=_0x30d3ef[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x336d61)[_0x5e20('0x1e')](function(_0x503cb6){logger[_0x5e20('0x14')]('entityFound:',_0x503cb6[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x503cb6[_0x5e20('0x1a')]),_0x5e20('0x3e'),{'sessionId':_0x5c9504});return _0x5c7ae8['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x5c7ae8));};exports[_0x5e20('0x3f')]=function(_0x28f155,_0x9d9d62){logger[_0x5e20('0x14')](_0x5e20('0x40'),_0x28f155[_0x5e20('0x2f')]);var _0x57c794=holdValidation['validate'](_0x28f155['body']);if(_0x57c794[_0x5e20('0x2b')]>0x0){return _0x9d9d62[_0x5e20('0x1b')](0x190)['json'](_0x57c794);}var _0x22b84e=_0x28f155[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x3bd5b8=_0x28f155[_0x5e20('0x2f')]['sessionId'];return getAgent(_0x22b84e)[_0x5e20('0x1e')](function(_0x245b52){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x245b52[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x245b52[_0x5e20('0x1a')]),'webbar:hold',{'sessionId':_0x3bd5b8});return _0x9d9d62['status'](0xc8)['json']({'error':![],'message':_0x5e20('0x41')});})[_0x5e20('0x22')](handleError(_0x9d9d62));};exports['unhold']=function(_0x4392ca,_0x4bfea7){logger[_0x5e20('0x14')]('unhold\x20fired:',_0x4392ca[_0x5e20('0x2f')]);var _0x59372c=unholdValidation[_0x5e20('0x30')](_0x4392ca[_0x5e20('0x2f')]);if(_0x59372c[_0x5e20('0x2b')]>0x0){return _0x4bfea7[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59372c);}var _0x200094=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x39')];var _0x19c128=_0x4392ca[_0x5e20('0x2f')][_0x5e20('0x2a')];return getAgent(_0x200094)[_0x5e20('0x1e')](function(_0x278b0e){logger[_0x5e20('0x14')](_0x5e20('0x35'),_0x278b0e[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')](_0x5e20('0x36'),_0x278b0e['name']),'webbar:unhold',{'sessionId':_0x19c128});return _0x4bfea7[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x42')});})[_0x5e20('0x22')](handleError(_0x4bfea7));};exports[_0x5e20('0x43')]=function(_0x596971,_0x457552){logger[_0x5e20('0x14')](_0x5e20('0x44'),_0x457552['body']);var _0x5d2aa2=callsValidation['validate'](_0x596971[_0x5e20('0x2f')]);if(_0x5d2aa2[_0x5e20('0x2b')]>0x0){return _0x457552[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x5d2aa2);}var _0xbacc1f=_0x596971[_0x5e20('0x2f')]['userId'];var _0x393724=respondWithRpcPromise('VoiceChannels');var _0x2913e7=getAgent(_0xbacc1f);return Promise['all']([_0x393724,_0x2913e7])[_0x5e20('0x1e')](function(_0x2eff14){var _0x141743=_0x2eff14[0x0];var _0x5f025b=_0x2eff14[0x1];var _0x1f6a32=_[_0x5e20('0x27')](_0x141743[_0x5e20('0x28')],function(_0x4309b8){return _0x4309b8[_0x5e20('0x29')]==_0x5f025b['id'];});return _0x457552[_0x5e20('0x1b')](0xc8)[_0x5e20('0x31')]({'count':_0x1f6a32['length'],'rows':_0x1f6a32});})[_0x5e20('0x22')](handleError(_0x457552));};exports[_0x5e20('0x45')]=function(_0x1a03e4,_0x2f9089){logger['info'](_0x5e20('0x46'),_0x1a03e4[_0x5e20('0x2f')]);var _0x23f07d=conferenceValidation[_0x5e20('0x30')](_0x1a03e4['body']);if(_0x23f07d[_0x5e20('0x2b')]>0x0){return _0x2f9089[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x23f07d);}var _0x53ddd4=_0x1a03e4['body']['userId'];return getAgent(_0x53ddd4)[_0x5e20('0x1e')](function(_0x1eb84c){logger['info'](_0x5e20('0x35'),_0x1eb84c[_0x5e20('0x1a')]);emit(util[_0x5e20('0x3a')]('user:%s',_0x1eb84c[_0x5e20('0x1a')]),_0x5e20('0x47'));return _0x2f9089['status'](0xc8)[_0x5e20('0x31')]({'error':![],'message':_0x5e20('0x48')});})['catch'](handleError(_0x2f9089));};exports[_0x5e20('0x49')]=function(_0x9993ae,_0x1e531d){logger[_0x5e20('0x14')]('transfer\x20fired:',_0x9993ae[_0x5e20('0x2f')]);var _0x59bff7=transferValidation['validate'](_0x9993ae[_0x5e20('0x2f')]);if(_0x59bff7[_0x5e20('0x2b')]>0x0){return _0x1e531d[_0x5e20('0x1b')](0x190)[_0x5e20('0x31')](_0x59bff7);}var _0x54cd1=_0x9993ae[_0x5e20('0x2f')]['userId'];var _0x4bccbe=_0x9993ae[_0x5e20('0x2f')][_0x5e20('0x2a')];var _0x17f248=_0x9993ae['body'][_0x5e20('0x4a')];return getAgent(_0x54cd1)[_0x5e20('0x1e')](function(_0x52f8ef){logger[_0x5e20('0x14')]('entityFound:',_0x52f8ef['name']);emit(util[_0x5e20('0x3a')]('user:%s',_0x52f8ef[_0x5e20('0x1a')]),_0x5e20('0x4b'),{'sessionId':_0x4bccbe,'transferNumber':_0x17f248});return _0x1e531d[_0x5e20('0x1b')](0xc8)['json']({'error':![],'message':_0x5e20('0x4c')});})[_0x5e20('0x22')](handleError(_0x1e531d));}; \ No newline at end of file +var _0x0a9a=['hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','message','result','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','body','length','status','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','answer','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:'];(function(_0x5e25a0,_0x4603f5){var _0x23a5a3=function(_0x55a88c){while(--_0x55a88c){_0x5e25a0['push'](_0x5e25a0['shift']());}};_0x23a5a3(++_0x4603f5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5b2d23,_0x16fd99){_0x5b2d23=_0x5b2d23-0x0;var _0x49069f=_0x0a9a[_0x5b2d23];return _0x49069f;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa0a9('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xa0a9('0x1'));var util=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var jayson=require(_0xa0a9('0x4'));var amiClient=jayson['client'][_0xa0a9('0x5')]({'port':0x232a});var logger=require(_0xa0a9('0x6'))('webbarapi');var Redis=require(_0xa0a9('0x7'));config[_0xa0a9('0x8')]=_[_0xa0a9('0x9')](config[_0xa0a9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa0a9('0xa'))(new Redis(config['redis']));var Schema=require(_0xa0a9('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'callNumber':{'type':_0xa0a9('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xa0a9('0xe')},'callbackUrl':{'type':_0xa0a9('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':[!![],_0xa0a9('0xf')]},'transferNumber':{'type':_0xa0a9('0xe'),'required':[!![],_0xa0a9('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x176faa,_0x48c315,_0x4a57dd){logger[_0xa0a9('0x11')](_0x176faa,_0x48c315,JSON[_0xa0a9('0x12')](_0x4a57dd));io['to'](_0x176faa)[_0xa0a9('0x13')](_0x48c315,_0x4a57dd);}function handleError(_0x16c3e3){return function(_0x568409){console[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x568409,_0x568409 instanceof RangeError);logger[_0xa0a9('0x16')](_0x568409[_0xa0a9('0x17')]);if(_0x568409 instanceof RangeError){if(_0x568409[_0xa0a9('0x18')]){delete _0x568409[_0xa0a9('0x18')];}_0x16c3e3['status'](0x194)[_0xa0a9('0x19')](_0x568409);}else{if(_0x568409[_0xa0a9('0x18')]){delete _0x568409['name'];}_0x16c3e3['status'](0x1f4)[_0xa0a9('0x19')](_0x568409);}};}function checkError(){return function(_0x1f6955){if(!_0x1f6955){throw new RangeError(_0xa0a9('0x1a'));}return _0x1f6955;};}function respondWithRpcPromise(_0x54a9a9,_0x307d7e){return new BPromise(function(_0x4e6f4c,_0x1fb36b){var _0x5e6148=amiClient;return _0x5e6148[_0xa0a9('0x1b')](_0x54a9a9,_0x307d7e)[_0xa0a9('0x1c')](function(_0x2f0b14){if(_0x2f0b14[_0xa0a9('0x16')]){if(_0x2f0b14['error'][_0xa0a9('0x1d')]===0x1f4){return _0x1fb36b(_0x2f0b14['error'][_0xa0a9('0x1e')]);}return _0x4e6f4c(_0x2f0b14[_0xa0a9('0x16')][_0xa0a9('0x1e')]);}else{_0x4e6f4c(_0x2f0b14[_0xa0a9('0x1f')]);}})['catch'](function(_0x7c1502){_0x1fb36b(_0x7c1502);});});}function getAgent(_0xe49d3b){return db[_0xa0a9('0x20')][_0xa0a9('0x21')]({'where':{'id':_0xe49d3b,'role':'agent'}})[_0xa0a9('0x1c')](checkError());}function getAgentCheckSession(_0x38e454,_0x2eae30){return new BPromise(function(_0x5c446e,_0x54125d){var _0x2b3cbb=respondWithRpcPromise(_0xa0a9('0x22'));var _0x10bbfd=getAgent(_0x38e454);Promise[_0xa0a9('0x23')]([_0x2b3cbb,_0x10bbfd])[_0xa0a9('0x1c')](function(_0xe218ff){var _0x2386c9=_0xe218ff[0x0];var _0x24e744=_0xe218ff[0x1];var _0xc6a4=_[_0xa0a9('0x24')](_0x2386c9[_0xa0a9('0x25')],function(_0x554191){return _0x554191[_0xa0a9('0x26')]==_0x24e744['id']&&_0x554191[_0xa0a9('0x27')]==_0x2eae30;});if(_0xc6a4['length']==0x1){_0x5c446e(_0x24e744);}else{_0x54125d(new RangeError(_0xa0a9('0x28')+_0x2eae30+_0xa0a9('0x29')));}});});}exports['originate']=function(_0x47c19b,_0x45374e){logger['info']('originate\x20fired:',_0x47c19b[_0xa0a9('0x2a')]);var _0x104936=originateValidation[_0xa0a9('0xb')](_0x47c19b[_0xa0a9('0x2a')]);if(_0x104936[_0xa0a9('0x2b')]>0x0){return _0x45374e[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x104936);}var _0x4bbcc2=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x539807=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2f')];var _0x2363e6=_0x47c19b['body']['callerId'];var _0x3b1a11=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x30')];return getAgent(_0x4bbcc2)[_0xa0a9('0x1c')](function(_0x520817){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x520817[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x520817[_0xa0a9('0x18')]),_0xa0a9('0x33'),{'callNumber':_0x539807,'callerId':_0x2363e6,'callbackUrl':_0x3b1a11});return _0x45374e['status'](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x34')});})[_0xa0a9('0x35')](handleError(_0x45374e));};exports[_0xa0a9('0x36')]=function(_0x2e11dc,_0x1d6bae){logger[_0xa0a9('0x11')](_0xa0a9('0x37'),_0x2e11dc[_0xa0a9('0x2a')]);var _0x2ea301=hangupValidation[_0xa0a9('0xb')](_0x2e11dc[_0xa0a9('0x2a')]);if(_0x2ea301[_0xa0a9('0x2b')]>0x0){return _0x1d6bae[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x2ea301);}var _0x1b1aff=_0x2e11dc[_0xa0a9('0x2a')]['userId'];var _0x3f1e4f=_0x2e11dc[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1b1aff)['then'](function(_0x757e10){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x757e10[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x757e10[_0xa0a9('0x18')]),_0xa0a9('0x38'),{'sessionId':_0x3f1e4f});return _0x1d6bae[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0xa0a9('0x35')](handleError(_0x1d6bae));};exports[_0xa0a9('0x39')]=function(_0x39c02a,_0x32d926){logger[_0xa0a9('0x11')]('answer\x20fired:',_0x39c02a[_0xa0a9('0x2a')]);var _0x11c130=answerValidation[_0xa0a9('0xb')](_0x39c02a[_0xa0a9('0x2a')]);if(_0x11c130[_0xa0a9('0x2b')]>0x0){return _0x32d926['status'](0x190)[_0xa0a9('0x2d')](_0x11c130);}var _0x1c8760=_0x39c02a['body']['userId'];var _0x41cd22=_0x39c02a[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1c8760)[_0xa0a9('0x1c')](function(_0x4a128f){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x4a128f[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x4a128f[_0xa0a9('0x18')]),_0xa0a9('0x3b'),{'sessionId':_0x41cd22});return _0x32d926[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3c')});})[_0xa0a9('0x35')](handleError(_0x32d926));};exports[_0xa0a9('0x3d')]=function(_0x2fcc76,_0x3bb0fb){logger[_0xa0a9('0x11')](_0xa0a9('0x3e'),_0x2fcc76[_0xa0a9('0x2a')]);var _0x54e917=holdValidation[_0xa0a9('0xb')](_0x2fcc76['body']);if(_0x54e917[_0xa0a9('0x2b')]>0x0){return _0x3bb0fb[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x54e917);}var _0x132eca=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x38cb0d=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x132eca)['then'](function(_0x5d4162){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5d4162['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5d4162[_0xa0a9('0x18')]),'webbar:hold',{'sessionId':_0x38cb0d});return _0x3bb0fb[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3f')});})[_0xa0a9('0x35')](handleError(_0x3bb0fb));};exports['unhold']=function(_0x398501,_0x45db88){logger[_0xa0a9('0x11')](_0xa0a9('0x40'),_0x398501[_0xa0a9('0x2a')]);var _0x41128b=unholdValidation[_0xa0a9('0xb')](_0x398501['body']);if(_0x41128b[_0xa0a9('0x2b')]>0x0){return _0x45db88[_0xa0a9('0x2c')](0x190)['json'](_0x41128b);}var _0x2cbd5e=_0x398501[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x506168=_0x398501['body'][_0xa0a9('0x27')];return getAgent(_0x2cbd5e)[_0xa0a9('0x1c')](function(_0x3f67ac){logger[_0xa0a9('0x11')]('entityFound:',_0x3f67ac['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x3f67ac['name']),'webbar:unhold',{'sessionId':_0x506168});return _0x45db88[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x41')});})[_0xa0a9('0x35')](handleError(_0x45db88));};exports[_0xa0a9('0x42')]=function(_0x361bf1,_0x24af09){logger[_0xa0a9('0x11')](_0xa0a9('0x43'),_0x24af09[_0xa0a9('0x2a')]);var _0x2da124=callsValidation['validate'](_0x361bf1[_0xa0a9('0x2a')]);if(_0x2da124[_0xa0a9('0x2b')]>0x0){return _0x24af09[_0xa0a9('0x2c')](0x190)['json'](_0x2da124);}var _0x426ddc=_0x361bf1[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x4a1912=respondWithRpcPromise(_0xa0a9('0x22'));var _0x18893f=getAgent(_0x426ddc);return Promise[_0xa0a9('0x23')]([_0x4a1912,_0x18893f])[_0xa0a9('0x1c')](function(_0x3d47b3){var _0x47107f=_0x3d47b3[0x0];var _0x12f97d=_0x3d47b3[0x1];var _0x577c1f=_[_0xa0a9('0x24')](_0x47107f[_0xa0a9('0x25')],function(_0x3f6ef4){return _0x3f6ef4[_0xa0a9('0x26')]==_0x12f97d['id'];});return _0x24af09[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'count':_0x577c1f[_0xa0a9('0x2b')],'rows':_0x577c1f});})['catch'](handleError(_0x24af09));};exports['conference']=function(_0x4a2307,_0x40d0f5){logger['info'](_0xa0a9('0x44'),_0x4a2307['body']);var _0x349f1b=conferenceValidation[_0xa0a9('0xb')](_0x4a2307[_0xa0a9('0x2a')]);if(_0x349f1b[_0xa0a9('0x2b')]>0x0){return _0x40d0f5[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x349f1b);}var _0x1c7191=_0x4a2307[_0xa0a9('0x2a')]['userId'];return getAgent(_0x1c7191)['then'](function(_0x471e1a){logger['info'](_0xa0a9('0x31'),_0x471e1a[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')]('user:%s',_0x471e1a[_0xa0a9('0x18')]),'webbar:conference');return _0x40d0f5[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x45')});})['catch'](handleError(_0x40d0f5));};exports[_0xa0a9('0x46')]=function(_0x478b4e,_0x2648e4){logger['info'](_0xa0a9('0x47'),_0x478b4e['body']);var _0x662a0=transferValidation[_0xa0a9('0xb')](_0x478b4e[_0xa0a9('0x2a')]);if(_0x662a0[_0xa0a9('0x2b')]>0x0){return _0x2648e4[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x662a0);}var _0x4cc06d=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x2e6d3f=_0x478b4e['body'][_0xa0a9('0x27')];var _0x184b0e=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x48')];return getAgent(_0x4cc06d)[_0xa0a9('0x1c')](function(_0x5581c7){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5581c7[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5581c7[_0xa0a9('0x18')]),_0xa0a9('0x49'),{'sessionId':_0x2e6d3f,'transferNumber':_0x184b0e});return _0x2648e4[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x4a')});})['catch'](handleError(_0x2648e4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 999c62c..8a75ec9 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 _0x4786=['index','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4786,0xff));var _0x6478=function(_0x473141,_0x53a677){_0x473141=_0x473141-0x0;var _0xa8ecfb=_0x4786[_0x473141];return _0xa8ecfb;};'use strict';var multer=require(_0x6478('0x0'));var util=require('util');var path=require(_0x6478('0x1'));var timeout=require('connect-timeout');var express=require(_0x6478('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6478('0x3'));var interaction=require(_0x6478('0x4'));var config=require(_0x6478('0x5'));var controller=require(_0x6478('0x6'));router[_0x6478('0x7')]('/',auth[_0x6478('0x8')](),controller[_0x6478('0x9')]);router[_0x6478('0x7')]('/describe',auth[_0x6478('0x8')](),controller[_0x6478('0xa')]);router[_0x6478('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6478('0xb')]);router[_0x6478('0x7')](_0x6478('0xc'),auth[_0x6478('0x8')](),controller[_0x6478('0xd')]);router[_0x6478('0x7')]('/:id/canned_answers',auth[_0x6478('0x8')](),controller[_0x6478('0xe')]);router[_0x6478('0x7')](_0x6478('0xf'),auth[_0x6478('0x8')](),controller['getAgents']);router['get']('/:id/applications',auth[_0x6478('0x8')](),controller[_0x6478('0x10')]);router[_0x6478('0x11')]('/',auth[_0x6478('0x8')](),controller[_0x6478('0x12')]);router[_0x6478('0x11')](_0x6478('0xc'),auth['isAuthenticated'](),controller[_0x6478('0x13')]);router['post'](_0x6478('0x14'),auth[_0x6478('0x8')](),controller[_0x6478('0x15')]);router[_0x6478('0x11')](_0x6478('0xf'),auth[_0x6478('0x8')](),controller[_0x6478('0x16')]);router['post'](_0x6478('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6478('0x11')]('/:id/notify',controller['notify']);router['post'](_0x6478('0x18'),auth[_0x6478('0x8')](),controller[_0x6478('0x19')]);router[_0x6478('0x1a')](_0x6478('0x1b'),auth['isAuthenticated'](),controller[_0x6478('0x1c')]);router[_0x6478('0x1d')](_0x6478('0x1b'),auth[_0x6478('0x8')](),controller[_0x6478('0x1e')]);router[_0x6478('0x1d')]('/:id/dispositions',auth[_0x6478('0x8')](),controller[_0x6478('0x1f')]);router[_0x6478('0x1d')](_0x6478('0x14'),auth[_0x6478('0x8')](),controller[_0x6478('0x20')]);router[_0x6478('0x1d')](_0x6478('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf7b7=['../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1a1c48,_0x27dc9c){var _0x45a303=function(_0xb0c34){while(--_0xb0c34){_0x1a1c48['push'](_0x1a1c48['shift']());}};_0x45a303(++_0x27dc9c);}(_0xf7b7,0x145));var _0x7f7b=function(_0x23f624,_0x43bce3){_0x23f624=_0x23f624-0x0;var _0x4bf6f9=_0xf7b7[_0x23f624];return _0x4bf6f9;};'use strict';var multer=require(_0x7f7b('0x0'));var util=require(_0x7f7b('0x1'));var path=require(_0x7f7b('0x2'));var timeout=require(_0x7f7b('0x3'));var express=require(_0x7f7b('0x4'));var router=express[_0x7f7b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7f7b('0x6'));var interaction=require(_0x7f7b('0x7'));var config=require(_0x7f7b('0x8'));var controller=require(_0x7f7b('0x9'));router[_0x7f7b('0xa')]('/',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0xc')]);router[_0x7f7b('0xa')]('/describe',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0xd')]);router[_0x7f7b('0xa')](_0x7f7b('0xe'),auth[_0x7f7b('0xb')](),controller['show']);router[_0x7f7b('0xa')]('/:id/dispositions',auth[_0x7f7b('0xb')](),controller['getDispositions']);router[_0x7f7b('0xa')](_0x7f7b('0xf'),auth[_0x7f7b('0xb')](),controller['getAnswers']);router['get'](_0x7f7b('0x10'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x11')]);router[_0x7f7b('0xa')](_0x7f7b('0x12'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x13')]);router[_0x7f7b('0x14')]('/',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x15')]);router[_0x7f7b('0x14')](_0x7f7b('0x16'),auth[_0x7f7b('0xb')](),controller['addDisposition']);router['post'](_0x7f7b('0xf'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x17')]);router['post']('/:id/users',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x18')]);router[_0x7f7b('0x14')](_0x7f7b('0x12'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x19')]);router[_0x7f7b('0x14')]('/:id/notify',controller[_0x7f7b('0x1a')]);router[_0x7f7b('0x14')](_0x7f7b('0x1b'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x1c')]);router[_0x7f7b('0x1d')](_0x7f7b('0xe'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x1e')]);router[_0x7f7b('0x1f')](_0x7f7b('0xe'),auth['isAuthenticated'](),controller[_0x7f7b('0x20')]);router['delete']('/:id/dispositions',auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x21')]);router[_0x7f7b('0x1f')](_0x7f7b('0xf'),auth[_0x7f7b('0xb')](),controller[_0x7f7b('0x22')]);router[_0x7f7b('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x7f7b('0x23')]);module[_0x7f7b('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6951cb4..721dc47 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 _0xfd1c=['mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3cadb1,_0x5174ee){var _0x5d198=function(_0x4b701d){while(--_0x4b701d){_0x3cadb1['push'](_0x3cadb1['shift']());}};_0x5d198(++_0x5174ee);}(_0xfd1c,0xd3));var _0xcfd1=function(_0x46306f,_0x5aef14){_0x46306f=_0x46306f-0x0;var _0x16a27f=_0xfd1c[_0x46306f];return _0x16a27f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xcfd1('0x0')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xcfd1('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0xcfd1('0x0')],'allowNull':![]},'token':{'type':Sequelize[_0xcfd1('0x0')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xcfd1('0x0')]},'type':{'type':Sequelize[_0xcfd1('0x1')](_0xcfd1('0x2'),'sinch')},'accountSid':{'type':Sequelize[_0xcfd1('0x0')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xcfd1('0x0')]},'notificationTemplate':{'type':Sequelize[_0xcfd1('0x3')],'defaultValue':function(){return _0xcfd1('0x4');}},'notificationSound':{'type':Sequelize[_0xcfd1('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xcfd1('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcfd1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcfd1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcfd1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcfd1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcfd1('0x6')],'comment':_0xcfd1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xcfd1('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x56f9d7){if(!_0x56f9d7){this[_0xcfd1('0x8')](_0xcfd1('0x9'),null);}this[_0xcfd1('0x8')](_0xcfd1('0xa'),_0x56f9d7);}},'description':{'type':Sequelize[_0xcfd1('0x0')]}}; \ No newline at end of file +var _0x4057=['ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','generate'];(function(_0x5078ac,_0x206ecf){var _0x1f8dd6=function(_0x4c7d86){while(--_0x4c7d86){_0x5078ac['push'](_0x5078ac['shift']());}};_0x1f8dd6(++_0x206ecf);}(_0x4057,0xea));var _0x7405=function(_0x111e74,_0x2834cf){_0x111e74=_0x111e74-0x0;var _0x54c6e6=_0x4057[_0x111e74];return _0x54c6e6;};'use strict';var Sequelize=require(_0x7405('0x0'));var rs=require(_0x7405('0x1'));module[_0x7405('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7405('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7405('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x7405('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x7405('0x4')],'defaultValue':function(){return rs[_0x7405('0x5')]();}},'phone':{'type':Sequelize[_0x7405('0x4')]},'type':{'type':Sequelize[_0x7405('0x6')](_0x7405('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x7405('0x4')]},'baseUrl':{'type':Sequelize[_0x7405('0x4')]},'authToken':{'type':Sequelize[_0x7405('0x4')]},'notificationTemplate':{'type':Sequelize[_0x7405('0x8')],'defaultValue':function(){return _0x7405('0x9');}},'notificationSound':{'type':Sequelize[_0x7405('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7405('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7405('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7405('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7405('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7405('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7405('0xa')],'defaultValue':![],'comment':_0x7405('0xc'),'set':function(_0x4b56e5){if(!_0x4b56e5){this[_0x7405('0xd')](_0x7405('0xe'),null);}this[_0x7405('0xd')]('mandatoryDisposition',_0x4b56e5);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 591bec8..45dc0a3 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 _0xe1b5=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','client','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappAccount','findAll','rows','show','keys','rawAttributes','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','ids','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','From','replace','Body','MessageSid','from','notifications','messageId','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','defaults','contact','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','Start','startRouting','info','entity\x20found','stringify','set','Content-Type','text/xml','send','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','rimraf'];(function(_0x4dfce8,_0x2a9880){var _0x488a8c=function(_0xcf49e5){while(--_0xcf49e5){_0x4dfce8['push'](_0x4dfce8['shift']());}};_0x488a8c(++_0x2a9880);}(_0xe1b5,0xc2));var _0x5e1b=function(_0xf4990c,_0x37b7a7){_0xf4990c=_0xf4990c-0x0;var _0x171da9=_0xe1b5[_0xf4990c];return _0x171da9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e1b('0x0'));var zipdir=require(_0x5e1b('0x1'));var jsonpatch=require(_0x5e1b('0x2'));var rp=require('request-promise');var moment=require(_0x5e1b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e1b('0x4'));var util=require(_0x5e1b('0x5'));var path=require(_0x5e1b('0x6'));var sox=require(_0x5e1b('0x7'));var csv=require(_0x5e1b('0x8'));var ejs=require(_0x5e1b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e1b('0xa'));var crypto=require('crypto');var jsforce=require(_0x5e1b('0xb'));var deskjs=require(_0x5e1b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e1b('0xd'));var Redis=require(_0x5e1b('0xe'));var authService=require(_0x5e1b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e1b('0x10'));var hardwareService=require(_0x5e1b('0x11'));var logger=require(_0x5e1b('0x12'))(_0x5e1b('0x13'));var utils=require('../../config/utils');var config=require(_0x5e1b('0x14'));var licenseUtil=require(_0x5e1b('0x15'));var db=require(_0x5e1b('0x16'))['db'];config['redis']=_['defaults'](config[_0x5e1b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e1b('0x18'))(new Redis(config[_0x5e1b('0x17')]));require(_0x5e1b('0x19'))[_0x5e1b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5e1b('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x421e33,_0x4cfb85,_0x344843,_0x362d78){return new BPromise(function(_0x47c715,_0x430aee){var _0x16db54=_0x362d78||client;return _0x16db54['request'](_0x421e33,_0x344843)[_0x5e1b('0x1c')](function(_0x143ed8){logger['info'](_0x5e1b('0x1d'),_0x4cfb85,_0x5e1b('0x1e'));logger[_0x5e1b('0x1f')](_0x5e1b('0x20'),_0x4cfb85,_0x5e1b('0x1e'),JSON['stringify'](_0x143ed8));if(_0x143ed8[_0x5e1b('0x21')]){if(_0x143ed8[_0x5e1b('0x21')][_0x5e1b('0x22')]===0x1f4){logger[_0x5e1b('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4cfb85,_0x143ed8[_0x5e1b('0x21')]['message']);return _0x430aee(_0x143ed8['error']['message']);}logger[_0x5e1b('0x21')](_0x5e1b('0x1d'),_0x4cfb85,_0x143ed8['error'][_0x5e1b('0x23')]);return _0x47c715(_0x143ed8[_0x5e1b('0x21')][_0x5e1b('0x23')]);}else{logger['info'](_0x5e1b('0x1d'),_0x4cfb85,_0x5e1b('0x1e'));_0x47c715(_0x143ed8[_0x5e1b('0x24')][_0x5e1b('0x23')]);}})[_0x5e1b('0x25')](function(_0x5a9abb){logger['error'](_0x5e1b('0x1d'),_0x4cfb85,_0x5a9abb);_0x430aee(_0x5a9abb);});});}function respondWithStatusCode(_0x22f63e,_0x530968){_0x530968=_0x530968||0xcc;return function(_0x5e72e3){if(_0x5e72e3){return _0x22f63e[_0x5e1b('0x26')](_0x530968);}return _0x22f63e[_0x5e1b('0x27')](_0x530968)['end']();};}function respondWithResult(_0x3eafdd,_0x294de3){_0x294de3=_0x294de3||0xc8;return function(_0x422919){if(_0x422919){return _0x3eafdd[_0x5e1b('0x27')](_0x294de3)[_0x5e1b('0x28')](_0x422919);}};}function respondWithFilteredResult(_0x346565,_0x8b1766){return function(_0x5b6e85){if(_0x5b6e85){var _0x58f97a=typeof _0x8b1766['offset']===_0x5e1b('0x29')&&typeof _0x8b1766[_0x5e1b('0x2a')]===_0x5e1b('0x29');var _0x1d2f21=_0x5b6e85['count'];var _0x477b9f=_0x58f97a?0x0:_0x8b1766[_0x5e1b('0x2b')];var _0x4c5506=_0x58f97a?_0x5b6e85[_0x5e1b('0x2c')]:_0x8b1766['offset']+_0x8b1766['limit'];var _0x4da395;if(_0x4c5506>=_0x1d2f21){_0x4c5506=_0x1d2f21;_0x4da395=0xc8;}else{_0x4da395=0xce;}_0x346565['status'](_0x4da395);return _0x346565['set'](_0x5e1b('0x2d'),_0x477b9f+'-'+_0x4c5506+'/'+_0x1d2f21)[_0x5e1b('0x28')](_0x5b6e85);}return null;};}function patchUpdates(_0x51cce8){return function(_0x4b8b46){try{jsonpatch[_0x5e1b('0x2e')](_0x4b8b46,_0x51cce8,!![]);}catch(_0x5f1799){return BPromise['reject'](_0x5f1799);}return _0x4b8b46[_0x5e1b('0x2f')]();};}function saveUpdates(_0x4bd213,_0x42e954){return function(_0x26f74b){if(_0x26f74b){return _0x26f74b[_0x5e1b('0x30')](_0x4bd213)[_0x5e1b('0x1c')](function(_0xa007c3){return _0xa007c3;});}return null;};}function removeEntity(_0x51ad7,_0x143489){return function(_0x4a9e34){if(_0x4a9e34){return _0x4a9e34[_0x5e1b('0x31')]()[_0x5e1b('0x1c')](function(){var _0x2c4f2c=_0x4a9e34[_0x5e1b('0x32')]({'plain':!![]});var _0x4943b0='WhatsappAccounts';return db[_0x5e1b('0x33')][_0x5e1b('0x31')]({'where':{'type':_0x4943b0,'resourceId':_0x2c4f2c['id']}})[_0x5e1b('0x1c')](function(){return _0x4a9e34;});})[_0x5e1b('0x1c')](function(){_0x51ad7['status'](0xcc)[_0x5e1b('0x34')]();});}};}function handleEntityNotFound(_0x4880a7,_0x5a6728){return function(_0x3bb8d6){if(!_0x3bb8d6){_0x4880a7['sendStatus'](0x194);}return _0x3bb8d6;};}function handleError(_0xbc0270,_0x3eb256){_0x3eb256=_0x3eb256||0x1f4;return function(_0x592416){logger['error'](_0x592416[_0x5e1b('0x35')]);if(_0x592416[_0x5e1b('0x36')]){delete _0x592416[_0x5e1b('0x36')];}_0xbc0270['status'](_0x3eb256)['send'](_0x592416);};}exports[_0x5e1b('0x37')]=function(_0x2cb49a,_0x2d6eac){var _0x9ee489={'include':[{'model':db[_0x5e1b('0x38')],'as':_0x5e1b('0x39')}]},_0x5c105b={},_0x530155={'count':0x0,'rows':[]};var _0x12c048=_[_0x5e1b('0x3a')](db['WhatsappAccount']['rawAttributes'],function(_0x3dd166){return{'name':_0x3dd166['fieldName'],'type':_0x3dd166[_0x5e1b('0x3b')][_0x5e1b('0x3c')]};});_0x5c105b[_0x5e1b('0x3d')]=_['map'](_0x12c048,'name');_0x5c105b['query']=_['keys'](_0x2cb49a[_0x5e1b('0x3e')]);_0x5c105b[_0x5e1b('0x3f')]=_[_0x5e1b('0x40')](_0x5c105b['model'],_0x5c105b[_0x5e1b('0x3e')]);_0x9ee489[_0x5e1b('0x41')]=_['intersection'](_0x5c105b[_0x5e1b('0x3d')],qs[_0x5e1b('0x42')](_0x2cb49a['query'][_0x5e1b('0x42')]));_0x9ee489['attributes']=_0x9ee489[_0x5e1b('0x41')][_0x5e1b('0x43')]?_0x9ee489['attributes']:_0x5c105b['model'];if(!_0x2cb49a[_0x5e1b('0x3e')]['hasOwnProperty'](_0x5e1b('0x44'))){_0x9ee489[_0x5e1b('0x2a')]=qs[_0x5e1b('0x2a')](_0x2cb49a['query'][_0x5e1b('0x2a')]);_0x9ee489[_0x5e1b('0x2b')]=qs[_0x5e1b('0x2b')](_0x2cb49a[_0x5e1b('0x3e')][_0x5e1b('0x2b')]);}_0x9ee489['order']=qs[_0x5e1b('0x45')](_0x2cb49a[_0x5e1b('0x3e')][_0x5e1b('0x45')]);_0x9ee489['where']=qs[_0x5e1b('0x3f')](_[_0x5e1b('0x46')](_0x2cb49a[_0x5e1b('0x3e')],_0x5c105b[_0x5e1b('0x3f')]),_0x12c048);if(_0x2cb49a[_0x5e1b('0x3e')][_0x5e1b('0x47')]){_0x9ee489[_0x5e1b('0x48')]=_[_0x5e1b('0x49')](_0x9ee489[_0x5e1b('0x48')],{'$or':_[_0x5e1b('0x3a')](_0x12c048,function(_0x482fa3){if(_0x482fa3[_0x5e1b('0x3b')]!==_0x5e1b('0x4a')){var _0x5c8552={};_0x5c8552[_0x482fa3['name']]={'$like':'%'+_0x2cb49a[_0x5e1b('0x3e')][_0x5e1b('0x47')]+'%'};return _0x5c8552;}})});}_0x9ee489=_['merge']({},_0x9ee489,_0x2cb49a[_0x5e1b('0x4b')]);var _0x358d55={'where':_0x9ee489[_0x5e1b('0x48')]};return db[_0x5e1b('0x4c')]['count'](_0x358d55)[_0x5e1b('0x1c')](function(_0x31ef8b){_0x530155[_0x5e1b('0x2c')]=_0x31ef8b;if(_0x2cb49a[_0x5e1b('0x3e')]['includeAll']){_0x9ee489['include']=[{'all':!![]}];}return db[_0x5e1b('0x4c')][_0x5e1b('0x4d')](_0x9ee489);})[_0x5e1b('0x1c')](function(_0x4e3c0f){_0x530155[_0x5e1b('0x4e')]=_0x4e3c0f;return _0x530155;})['then'](respondWithFilteredResult(_0x2d6eac,_0x9ee489))['catch'](handleError(_0x2d6eac,null));};exports[_0x5e1b('0x4f')]=function(_0x653878,_0x194f32){var _0x21c335={'raw':![],'where':{'id':_0x653878['params']['id']},'include':[{'model':db[_0x5e1b('0x38')],'as':_0x5e1b('0x39')}]},_0x21e00d={};_0x21e00d[_0x5e1b('0x3d')]=_[_0x5e1b('0x50')](db['WhatsappAccount'][_0x5e1b('0x51')]);_0x21e00d[_0x5e1b('0x3e')]=_[_0x5e1b('0x50')](_0x653878[_0x5e1b('0x3e')]);_0x21e00d[_0x5e1b('0x3f')]=_['intersection'](_0x21e00d[_0x5e1b('0x3d')],_0x21e00d['query']);_0x21c335['attributes']=_[_0x5e1b('0x40')](_0x21e00d[_0x5e1b('0x3d')],qs['fields'](_0x653878['query'][_0x5e1b('0x42')]));_0x21c335[_0x5e1b('0x41')]=_0x21c335[_0x5e1b('0x41')]['length']?_0x21c335[_0x5e1b('0x41')]:_0x21e00d['model'];if(_0x653878[_0x5e1b('0x3e')][_0x5e1b('0x52')]){_0x21c335[_0x5e1b('0x53')]=[{'all':!![]}];}_0x21c335=_[_0x5e1b('0x49')]({},_0x21c335,_0x653878[_0x5e1b('0x4b')]);return db[_0x5e1b('0x4c')]['find'](_0x21c335)[_0x5e1b('0x1c')](handleEntityNotFound(_0x194f32,null))[_0x5e1b('0x1c')](respondWithResult(_0x194f32,null))[_0x5e1b('0x25')](handleError(_0x194f32,null));};exports[_0x5e1b('0x54')]=function(_0x3e2962,_0x26f625){return db[_0x5e1b('0x4c')][_0x5e1b('0x54')](_0x3e2962[_0x5e1b('0x55')],{})[_0x5e1b('0x1c')](function(_0x1d2c3e){var _0x5cb0f0=_0x3e2962[_0x5e1b('0x56')][_0x5e1b('0x32')]({'plain':!![]});if(!_0x5cb0f0)throw new Error(_0x5e1b('0x57'));if(_0x5cb0f0[_0x5e1b('0x58')]==='user'){var _0x3002e7=_0x1d2c3e['get']({'plain':!![]});var _0x4147be=_0x5e1b('0x59');return db['UserProfileSection'][_0x5e1b('0x5a')]({'where':{'name':_0x4147be,'userProfileId':_0x5cb0f0[_0x5e1b('0x5b')]},'raw':!![]})[_0x5e1b('0x1c')](function(_0x35c11c){if(_0x35c11c&&_0x35c11c['autoAssociation']===0x0){return db[_0x5e1b('0x33')]['create']({'name':_0x3002e7[_0x5e1b('0x36')],'resourceId':_0x3002e7['id'],'type':_0x35c11c[_0x5e1b('0x36')],'sectionId':_0x35c11c['id']},{})[_0x5e1b('0x1c')](function(){return _0x1d2c3e;});}else{return _0x1d2c3e;}})[_0x5e1b('0x25')](function(_0x279958){logger[_0x5e1b('0x21')](_0x5e1b('0x5c'),_0x279958);throw _0x279958;});}return _0x1d2c3e;})['then'](respondWithResult(_0x26f625,0xc9))['catch'](handleError(_0x26f625,null));};exports[_0x5e1b('0x30')]=function(_0x30336a,_0x19ed93){if(_0x30336a[_0x5e1b('0x55')]['id']){delete _0x30336a['body']['id'];}return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x30336a['params']['id']},'include':[{'model':db[_0x5e1b('0x38')],'as':_0x5e1b('0x39')}]})[_0x5e1b('0x1c')](handleEntityNotFound(_0x19ed93,null))['then'](saveUpdates(_0x30336a[_0x5e1b('0x55')],null))[_0x5e1b('0x1c')](respondWithResult(_0x19ed93,null))[_0x5e1b('0x25')](handleError(_0x19ed93,null));};exports[_0x5e1b('0x31')]=function(_0x3ba11c,_0x36c73c){return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x3ba11c[_0x5e1b('0x5d')]['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x36c73c,null))[_0x5e1b('0x1c')](removeEntity(_0x36c73c,null))['catch'](handleError(_0x36c73c,null));};exports[_0x5e1b('0x5e')]=function(_0x246163,_0x4bd821){return db['WhatsappAccount']['describe']()[_0x5e1b('0x1c')](respondWithResult(_0x4bd821,null))['catch'](handleError(_0x4bd821,null));};exports['addDisposition']=function(_0x16e104,_0x503339,_0x5a87c0){if(_0x16e104[_0x5e1b('0x55')]['id']){delete _0x16e104['body']['id'];}return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x16e104['params']['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x503339,null))[_0x5e1b('0x1c')](function(_0x2566d3){if(_0x2566d3){_0x16e104[_0x5e1b('0x55')][_0x5e1b('0x5f')]=_0x2566d3['id'];return db[_0x5e1b('0x60')][_0x5e1b('0x54')](_0x16e104[_0x5e1b('0x55')]);}})[_0x5e1b('0x1c')](respondWithResult(_0x503339,null))['catch'](handleError(_0x503339,null));};exports[_0x5e1b('0x61')]=function(_0x39f943,_0x2571ce,_0x4f2dd0){var _0x3de084={'raw':![],'where':{}};var _0x5a2bbf={};var _0x4bfc54={'count':0x0,'rows':[]};return db[_0x5e1b('0x4c')][_0x5e1b('0x62')]({'where':{'id':_0x39f943[_0x5e1b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2571ce,null))['then'](function(_0x2ebad8){if(_0x2ebad8){_0x5a2bbf[_0x5e1b('0x3d')]=_[_0x5e1b('0x50')](db[_0x5e1b('0x60')][_0x5e1b('0x51')]);_0x5a2bbf[_0x5e1b('0x3e')]=_['keys'](_0x39f943['query']);_0x5a2bbf[_0x5e1b('0x3f')]=_[_0x5e1b('0x40')](_0x5a2bbf[_0x5e1b('0x3d')],_0x5a2bbf[_0x5e1b('0x3e')]);_0x3de084[_0x5e1b('0x41')]=_['intersection'](_0x5a2bbf[_0x5e1b('0x3d')],qs[_0x5e1b('0x42')](_0x39f943['query']['fields']));_0x3de084['attributes']=_0x3de084['attributes'][_0x5e1b('0x43')]?_0x3de084[_0x5e1b('0x41')]:_0x5a2bbf[_0x5e1b('0x3d')];if(!_0x39f943['query'][_0x5e1b('0x63')](_0x5e1b('0x44'))){_0x3de084[_0x5e1b('0x2a')]=qs[_0x5e1b('0x2a')](_0x39f943[_0x5e1b('0x3e')]['limit']);_0x3de084[_0x5e1b('0x2b')]=qs[_0x5e1b('0x2b')](_0x39f943[_0x5e1b('0x3e')]['offset']);}_0x3de084[_0x5e1b('0x64')]=qs['sort'](_0x39f943[_0x5e1b('0x3e')][_0x5e1b('0x45')]);_0x3de084[_0x5e1b('0x48')]=qs[_0x5e1b('0x3f')](_[_0x5e1b('0x46')](_0x39f943['query'],_0x5a2bbf[_0x5e1b('0x3f')]));_0x3de084[_0x5e1b('0x48')][_0x5e1b('0x5f')]=_0x2ebad8['id'];if(_0x39f943[_0x5e1b('0x3e')]['filter']){_0x3de084['where']=_[_0x5e1b('0x49')](_0x3de084['where'],{'$or':_[_0x5e1b('0x3a')](_0x3de084['attributes'],function(_0x588c60){var _0x53241a={};_0x53241a[_0x588c60]={'$like':'%'+_0x39f943[_0x5e1b('0x3e')][_0x5e1b('0x47')]+'%'};return _0x53241a;})});}_0x3de084=_[_0x5e1b('0x49')]({},_0x3de084,_0x39f943[_0x5e1b('0x4b')]);return db[_0x5e1b('0x60')][_0x5e1b('0x2c')]({'where':_0x3de084['where']})[_0x5e1b('0x1c')](function(_0x39c32f){_0x4bfc54[_0x5e1b('0x2c')]=_0x39c32f;if(_0x39f943[_0x5e1b('0x3e')][_0x5e1b('0x52')]){_0x3de084['include']=[{'all':!![]}];}return db[_0x5e1b('0x60')]['findAll'](_0x3de084);})[_0x5e1b('0x1c')](function(_0x2d41c8){_0x4bfc54[_0x5e1b('0x4e')]=_0x2d41c8;return _0x4bfc54;});}})[_0x5e1b('0x1c')](respondWithFilteredResult(_0x2571ce,_0x3de084))['catch'](handleError(_0x2571ce,null));};exports['removeDispositions']=function(_0x2d897c,_0x417131,_0x42dfa6){return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x2d897c['params']['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x417131,null))[_0x5e1b('0x1c')](function(_0x308fb5){if(_0x308fb5){return _0x308fb5[_0x5e1b('0x65')](_0x2d897c[_0x5e1b('0x3e')]['ids']);}})[_0x5e1b('0x1c')](respondWithStatusCode(_0x417131,null))[_0x5e1b('0x25')](handleError(_0x417131,null));};exports[_0x5e1b('0x66')]=function(_0x214d63,_0x366dcf,_0x2224cd){if(_0x214d63[_0x5e1b('0x55')]['id']){delete _0x214d63[_0x5e1b('0x55')]['id'];}return db[_0x5e1b('0x4c')]['find']({'where':{'id':_0x214d63[_0x5e1b('0x5d')]['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x366dcf,null))[_0x5e1b('0x1c')](function(_0x5a9bd0){if(_0x5a9bd0){_0x214d63[_0x5e1b('0x55')][_0x5e1b('0x5f')]=_0x5a9bd0['id'];return db['CannedAnswer']['create'](_0x214d63['body']);}})['then'](respondWithResult(_0x366dcf,null))[_0x5e1b('0x25')](handleError(_0x366dcf,null));};exports[_0x5e1b('0x67')]=function(_0xa01c7a,_0x3eb627,_0x47f4cb){var _0x9a7752={'raw':![],'where':{}};var _0x41c0e4={};var _0x41247a={'count':0x0,'rows':[]};return db[_0x5e1b('0x4c')][_0x5e1b('0x62')]({'where':{'id':_0xa01c7a[_0x5e1b('0x5d')]['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x3eb627,null))[_0x5e1b('0x1c')](function(_0x5ee0c8){if(_0x5ee0c8){_0x41c0e4[_0x5e1b('0x3d')]=_[_0x5e1b('0x50')](db[_0x5e1b('0x68')][_0x5e1b('0x51')]);_0x41c0e4[_0x5e1b('0x3e')]=_[_0x5e1b('0x50')](_0xa01c7a[_0x5e1b('0x3e')]);_0x41c0e4[_0x5e1b('0x3f')]=_[_0x5e1b('0x40')](_0x41c0e4[_0x5e1b('0x3d')],_0x41c0e4[_0x5e1b('0x3e')]);_0x9a7752['attributes']=_[_0x5e1b('0x40')](_0x41c0e4['model'],qs['fields'](_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x42')]));_0x9a7752['attributes']=_0x9a7752[_0x5e1b('0x41')][_0x5e1b('0x43')]?_0x9a7752[_0x5e1b('0x41')]:_0x41c0e4[_0x5e1b('0x3d')];if(!_0xa01c7a['query'][_0x5e1b('0x63')](_0x5e1b('0x44'))){_0x9a7752['limit']=qs['limit'](_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x2a')]);_0x9a7752[_0x5e1b('0x2b')]=qs['offset'](_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x2b')]);}_0x9a7752[_0x5e1b('0x64')]=qs[_0x5e1b('0x45')](_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x45')]);_0x9a7752['where']=qs[_0x5e1b('0x3f')](_['pick'](_0xa01c7a[_0x5e1b('0x3e')],_0x41c0e4['filters']));_0x9a7752[_0x5e1b('0x48')]['WhatsappAccountId']=_0x5ee0c8['id'];if(_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x47')]){_0x9a7752[_0x5e1b('0x48')]=_[_0x5e1b('0x49')](_0x9a7752[_0x5e1b('0x48')],{'$or':_[_0x5e1b('0x3a')](_0x9a7752['attributes'],function(_0x26dc16){var _0x819a50={};_0x819a50[_0x26dc16]={'$like':'%'+_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x47')]+'%'};return _0x819a50;})});}_0x9a7752=_[_0x5e1b('0x49')]({},_0x9a7752,_0xa01c7a[_0x5e1b('0x4b')]);return db[_0x5e1b('0x68')][_0x5e1b('0x2c')]({'where':_0x9a7752[_0x5e1b('0x48')]})['then'](function(_0x4781e8){_0x41247a['count']=_0x4781e8;if(_0xa01c7a[_0x5e1b('0x3e')][_0x5e1b('0x52')]){_0x9a7752[_0x5e1b('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5e1b('0x4d')](_0x9a7752);})[_0x5e1b('0x1c')](function(_0x228111){_0x41247a[_0x5e1b('0x4e')]=_0x228111;return _0x41247a;});}})[_0x5e1b('0x1c')](respondWithFilteredResult(_0x3eb627,_0x9a7752))[_0x5e1b('0x25')](handleError(_0x3eb627,null));};exports[_0x5e1b('0x69')]=function(_0x5c494b,_0x4e2378,_0x58bb97){return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x5c494b[_0x5e1b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4e2378,null))[_0x5e1b('0x1c')](function(_0x2f7319){if(_0x2f7319){return _0x2f7319['removeAnswers'](_0x5c494b[_0x5e1b('0x3e')]['ids']);}})[_0x5e1b('0x1c')](respondWithStatusCode(_0x4e2378,null))[_0x5e1b('0x25')](handleError(_0x4e2378,null));};exports[_0x5e1b('0x6a')]=function(_0x25c26e,_0x3f787a,_0x4500ff){return db[_0x5e1b('0x4c')]['find']({'where':{'id':_0x25c26e['params']['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x3f787a,null))[_0x5e1b('0x1c')](function(_0x4a6084){if(_0x4a6084){return _0x4a6084[_0x5e1b('0x6a')](_0x25c26e[_0x5e1b('0x55')][_0x5e1b('0x6b')],_[_0x5e1b('0x6c')](_0x25c26e[_0x5e1b('0x55')],[_0x5e1b('0x6b'),'id'])||{})['spread'](function(_0x582d93){for(var _0x4c4684=0x0;_0x4c4684<_0x25c26e[_0x5e1b('0x55')][_0x5e1b('0x6b')][_0x5e1b('0x43')];_0x4c4684+=0x1){socket[_0x5e1b('0x6d')](_0x5e1b('0x6e'),{'UserId':Number(_0x25c26e[_0x5e1b('0x55')][_0x5e1b('0x6b')][_0x4c4684]),'WhatsappAccountId':Number(_0x25c26e['params']['id'])});}return _0x582d93;});}})['then'](respondWithResult(_0x3f787a,null))[_0x5e1b('0x25')](handleError(_0x3f787a,null));};exports[_0x5e1b('0x6f')]=function(_0x5a5471,_0x3c3722,_0x3dc4ac){return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x5a5471[_0x5e1b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3c3722,null))['then'](function(_0x812aa4){if(_0x812aa4){return _0x812aa4['removeAgents'](_0x5a5471['query'][_0x5e1b('0x6b')])[_0x5e1b('0x1c')](function(){if(_[_0x5e1b('0x70')](_0x5a5471[_0x5e1b('0x3e')]['ids'])){for(var _0x2f830c=0x0;_0x2f830c<_0x5a5471[_0x5e1b('0x3e')][_0x5e1b('0x6b')][_0x5e1b('0x43')];_0x2f830c+=0x1){socket[_0x5e1b('0x6d')](_0x5e1b('0x71'),{'UserId':Number(_0x5a5471[_0x5e1b('0x3e')]['ids'][_0x2f830c]),'WhatsappAccountId':Number(_0x5a5471['params']['id'])});}}else{socket[_0x5e1b('0x6d')](_0x5e1b('0x71'),{'UserId':Number(_0x5a5471['query']['ids']),'WhatsappAccountId':Number(_0x5a5471[_0x5e1b('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c3722,null))[_0x5e1b('0x25')](handleError(_0x3c3722,null));};exports[_0x5e1b('0x72')]=function(_0x3e9a6c,_0x544f7e,_0x1c546e){var _0x35c65f={};var _0x432c52={};var _0x22fee4;var _0x4cc45c;return db['WhatsappAccount'][_0x5e1b('0x62')]({'where':{'id':_0x3e9a6c[_0x5e1b('0x5d')]['id']}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x544f7e,null))['then'](function(_0x3372be){if(_0x3372be){_0x22fee4=_0x3372be;_0x432c52['model']=_['keys'](db[_0x5e1b('0x73')][_0x5e1b('0x51')]);_0x432c52[_0x5e1b('0x3e')]=_[_0x5e1b('0x50')](_0x3e9a6c['query']);_0x432c52['filters']=_[_0x5e1b('0x40')](_0x432c52[_0x5e1b('0x3d')],_0x432c52['query']);_0x35c65f[_0x5e1b('0x41')]=_[_0x5e1b('0x40')](_0x432c52[_0x5e1b('0x3d')],qs[_0x5e1b('0x42')](_0x3e9a6c[_0x5e1b('0x3e')]['fields']));_0x35c65f[_0x5e1b('0x41')]=_0x35c65f['attributes'][_0x5e1b('0x43')]?_0x35c65f[_0x5e1b('0x41')]:_0x432c52[_0x5e1b('0x3d')];_0x35c65f['order']=qs[_0x5e1b('0x45')](_0x3e9a6c[_0x5e1b('0x3e')]['sort']);_0x35c65f[_0x5e1b('0x48')]=qs[_0x5e1b('0x3f')](_['pick'](_0x3e9a6c['query'],_0x432c52['filters']));if(_0x3e9a6c['query'][_0x5e1b('0x47')]){_0x35c65f['where']=_[_0x5e1b('0x49')](_0x35c65f[_0x5e1b('0x48')],{'$or':_[_0x5e1b('0x3a')](_0x35c65f[_0x5e1b('0x41')],function(_0x5e6c3f){var _0x5e8bbf={};_0x5e8bbf[_0x5e6c3f]={'$like':'%'+_0x3e9a6c[_0x5e1b('0x3e')]['filter']+'%'};return _0x5e8bbf;})});}_0x35c65f=_[_0x5e1b('0x49')]({},_0x35c65f,_0x3e9a6c[_0x5e1b('0x4b')]);return _0x22fee4[_0x5e1b('0x72')](_0x35c65f);}})[_0x5e1b('0x1c')](function(_0x4ca1c9){if(_0x4ca1c9){_0x4cc45c=_0x4ca1c9[_0x5e1b('0x43')];if(!_0x3e9a6c[_0x5e1b('0x3e')][_0x5e1b('0x63')]('nolimit')){_0x35c65f[_0x5e1b('0x2a')]=qs['limit'](_0x3e9a6c[_0x5e1b('0x3e')][_0x5e1b('0x2a')]);_0x35c65f[_0x5e1b('0x2b')]=qs['offset'](_0x3e9a6c[_0x5e1b('0x3e')][_0x5e1b('0x2b')]);}return _0x22fee4[_0x5e1b('0x72')](_0x35c65f);}})[_0x5e1b('0x1c')](function(_0x1b2bd3){if(_0x1b2bd3){return _0x1b2bd3?{'count':_0x4cc45c,'rows':_0x1b2bd3}:null;}})[_0x5e1b('0x1c')](respondWithResult(_0x544f7e,null))[_0x5e1b('0x25')](handleError(_0x544f7e,null));};exports[_0x5e1b('0x74')]=function(_0x3a384b,_0x129b7a){var _0x247b7f=_0x3a384b['params']['id'];var _0x6b43e6=_0x3a384b[_0x5e1b('0x55')];var _0x4153dc=0xc8;var _0x2e13ad=null;return db['sequelize'][_0x5e1b('0x75')]({'isolationLevel':db['sequelize']['Transaction'][_0x5e1b('0x76')][_0x5e1b('0x77')]},function(_0x48e8bc){return db[_0x5e1b('0x4c')][_0x5e1b('0x62')]({'where':{'id':_0x247b7f},'transaction':_0x48e8bc})[_0x5e1b('0x1c')](function(_0x3dc6b3){if(_0x3dc6b3){return db[_0x5e1b('0x78')][_0x5e1b('0x31')]({'where':{'WhatsappAccountId':_0x247b7f},'transaction':_0x48e8bc})['then'](function(){var _0x2073b1=_[_0x5e1b('0x3a')](_0x6b43e6,function(_0x39d28e){_0x39d28e[_0x5e1b('0x5f')]=_0x247b7f;return _0x39d28e;});return db[_0x5e1b('0x78')][_0x5e1b('0x79')](_0x2073b1,{'transaction':_0x48e8bc});});}else{_0x4153dc=0x194;_0x2e13ad=[];}});})[_0x5e1b('0x1c')](function(){if(_0x4153dc!==0x194){return db[_0x5e1b('0x78')][_0x5e1b('0x7a')]({'where':{'WhatsappAccountId':_0x247b7f},'order':'priority'})[_0x5e1b('0x1c')](function(_0x17cfec){_0x2e13ad=_0x17cfec;});}})[_0x5e1b('0x25')](function(_0x13facd){_0x4153dc=0x1f4;logger['error'](_0x13facd[_0x5e1b('0x35')]);if(_0x13facd['name']){delete _0x13facd[_0x5e1b('0x36')];}_0x2e13ad=_0x13facd;})[_0x5e1b('0x7b')](function(){if(_0x2e13ad===null){_0x129b7a[_0x5e1b('0x26')](_0x4153dc);}else{if(_0x4153dc===0x1f4){_0x129b7a[_0x5e1b('0x27')](_0x4153dc)['send'](_0x2e13ad);}else{_0x129b7a[_0x5e1b('0x27')](_0x4153dc)[_0x5e1b('0x28')](_0x2e13ad);}}});};exports[_0x5e1b('0x7c')]=function(_0x599a46,_0x2e98fa,_0xe9df79){var _0x7f1b9b={};var _0x592752={};var _0x31f403;var _0x93cd5c;return db[_0x5e1b('0x4c')][_0x5e1b('0x62')]({'where':{'id':_0x599a46[_0x5e1b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e98fa,null))[_0x5e1b('0x1c')](function(_0x5aa5c2){if(_0x5aa5c2){_0x31f403=_0x5aa5c2;_0x592752[_0x5e1b('0x3d')]=_[_0x5e1b('0x50')](db[_0x5e1b('0x78')]['rawAttributes']);_0x592752[_0x5e1b('0x3e')]=_[_0x5e1b('0x50')](_0x599a46[_0x5e1b('0x3e')]);_0x592752[_0x5e1b('0x3f')]=_[_0x5e1b('0x40')](_0x592752[_0x5e1b('0x3d')],_0x592752['query']);_0x7f1b9b['attributes']=_[_0x5e1b('0x40')](_0x592752['model'],qs[_0x5e1b('0x42')](_0x599a46['query']['fields']));_0x7f1b9b[_0x5e1b('0x41')]=_0x7f1b9b[_0x5e1b('0x41')][_0x5e1b('0x43')]?_0x7f1b9b[_0x5e1b('0x41')]:_0x592752[_0x5e1b('0x3d')];_0x7f1b9b['order']=qs[_0x5e1b('0x45')](_0x599a46[_0x5e1b('0x3e')]['sort']);_0x7f1b9b[_0x5e1b('0x48')]=qs[_0x5e1b('0x3f')](_['pick'](_0x599a46[_0x5e1b('0x3e')],_0x592752['filters']));if(_0x599a46[_0x5e1b('0x3e')][_0x5e1b('0x47')]){_0x7f1b9b[_0x5e1b('0x48')]=_['merge'](_0x7f1b9b[_0x5e1b('0x48')],{'$or':_[_0x5e1b('0x3a')](_0x7f1b9b[_0x5e1b('0x41')],function(_0x125015){var _0x432383={};_0x432383[_0x125015]={'$like':'%'+_0x599a46['query']['filter']+'%'};return _0x432383;})});}_0x7f1b9b=_[_0x5e1b('0x49')]({},_0x7f1b9b,_0x599a46['options']);return _0x31f403[_0x5e1b('0x7c')](_0x7f1b9b);}})[_0x5e1b('0x1c')](function(_0x290239){if(_0x290239){_0x93cd5c=_0x290239[_0x5e1b('0x43')];if(!_0x599a46[_0x5e1b('0x3e')][_0x5e1b('0x63')](_0x5e1b('0x44'))){_0x7f1b9b[_0x5e1b('0x2a')]=qs['limit'](_0x599a46[_0x5e1b('0x3e')][_0x5e1b('0x2a')]);_0x7f1b9b[_0x5e1b('0x2b')]=qs['offset'](_0x599a46['query']['offset']);}return _0x31f403[_0x5e1b('0x7c')](_0x7f1b9b);}})[_0x5e1b('0x1c')](function(_0x3abc83){if(_0x3abc83){return _0x3abc83?{'count':_0x93cd5c,'rows':_0x3abc83}:null;}})[_0x5e1b('0x1c')](respondWithResult(_0x2e98fa,null))['catch'](handleError(_0x2e98fa,null));};exports[_0x5e1b('0x7d')]=function(_0x15604d,_0x38c345,_0x536542){var _0x3269ba={'channel':_0x5e1b('0x7e')};var _0x45b963=[];var _0x48bb04=[];var _0x9dfce1={};return db['WhatsappAccount']['find']({'where':{'id':_0x15604d[_0x5e1b('0x5d')]['id']},'include':[{'model':db[_0x5e1b('0x78')],'as':_0x5e1b('0x7f')}]})[_0x5e1b('0x1c')](handleEntityNotFound(_0x38c345,null))[_0x5e1b('0x1c')](function(_0x2ad4b2){_0x3269ba[_0x5e1b('0x80')]=_0x2ad4b2;if(_0x3269ba[_0x5e1b('0x80')]&&_0x3269ba[_0x5e1b('0x80')][_0x5e1b('0x3b')]===_0x5e1b('0x81')&&_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x82')]){if(_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x82')][_0x5e1b('0x43')]===0x0)return;if(_0x15604d[_0x5e1b('0x55')]['statuses'][0x0]['state']!==_0x5e1b('0x83'))return;return db[_0x5e1b('0x84')][_0x5e1b('0x30')]({'read':!![],'readAt':_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x82')][0x0][_0x5e1b('0x85')]},{'where':{'messageId':_0x15604d[_0x5e1b('0x55')]['statuses'][0x0][_0x5e1b('0x86')]},'individualHooks':!![]})[_0x5e1b('0x1c')](function(_0x442baa){return _0x38c345[_0x5e1b('0x27')](0xc8)[_0x5e1b('0x28')](_0x442baa);});}_0x3269ba[_0x5e1b('0x87')]=_['orderBy'](_0x2ad4b2[_0x5e1b('0x7f')],['priority'],['asc']);if(_0x3269ba[_0x5e1b('0x80')]['Applications']){delete _0x3269ba[_0x5e1b('0x80')][_0x5e1b('0x7f')];}return db[_0x5e1b('0x88')]['describe']()['then'](function(_0x5048d0){if(!_0x5048d0){throw new db[(_0x5e1b('0x89'))][(_0x5e1b('0x8a'))](_0x5e1b('0x8b'));}_0x45b963=_[_0x5e1b('0x8c')](_[_0x5e1b('0x50')](_0x5048d0),['createdAt',_0x5e1b('0x8d')]);_0x48bb04=_[_0x5e1b('0x8c')](_[_0x5e1b('0x50')](_0x5048d0),[_0x5e1b('0x8e'),_0x5e1b('0x8d'),_0x5e1b('0x8f'),_0x5e1b('0x90')]);_0x3269ba[_0x5e1b('0x55')]={'mapKey':_0x5e1b('0x91')};if(_0x3269ba[_0x5e1b('0x80')]&&_0x3269ba[_0x5e1b('0x80')]['type']===_0x5e1b('0x92')){_0x3269ba[_0x5e1b('0x55')]['from']=_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x93')][_0x5e1b('0x94')]('whatsapp:','');_0x3269ba[_0x5e1b('0x55')]['body']=_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x95')];_0x3269ba[_0x5e1b('0x55')]['messageId']=_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x96')];}if(_0x3269ba[_0x5e1b('0x80')]&&_0x3269ba['account']['type']===_0x5e1b('0x81')){_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x97')]=_0x15604d[_0x5e1b('0x55')][_0x5e1b('0x98')][0x0]['from'];_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x55')]=_0x15604d['body'][_0x5e1b('0x98')][0x0]['message']['body'];_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x99')]=_0x15604d[_0x5e1b('0x55')]['notifications'][0x0][_0x5e1b('0x86')];}if(_0x3269ba['body']['id']){delete _0x3269ba[_0x5e1b('0x55')]['id'];}if(_['isNil'](_0x3269ba['body'][_0x5e1b('0x97')])){throw new db[(_0x5e1b('0x89'))][(_0x5e1b('0x8a'))](_0x5e1b('0x9a'));}if(_[_0x5e1b('0x9b')](_0x3269ba[_0x5e1b('0x55')]['body'])||_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x55')]===''){throw new db[(_0x5e1b('0x89'))][(_0x5e1b('0x8a'))](_0x5e1b('0x9c'));}if(_[_0x5e1b('0x9b')](_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x9d')])){throw new db[(_0x5e1b('0x89'))][(_0x5e1b('0x8a'))](_0x5e1b('0x9e')+_0x48bb04);}if(!_['includes'](_0x48bb04,_0x3269ba['body'][_0x5e1b('0x9d')])){throw new db[(_0x5e1b('0x89'))][(_0x5e1b('0x8a'))](_0x5e1b('0x9f')+_0x48bb04);}_0x9dfce1[_0x3269ba[_0x5e1b('0x55')]['mapKey']]=_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x97')];return db[_0x5e1b('0xa0')][_0x5e1b('0x5a')]({'where':{'id':_0x3269ba[_0x5e1b('0x80')][_0x5e1b('0x90')]},'include':[{'model':db[_0x5e1b('0x88')],'as':_0x5e1b('0xa1'),'where':_0x9dfce1,'limit':0x1,'order':[[_0x5e1b('0x8d'),_0x5e1b('0xa2')]]}]});})[_0x5e1b('0x1c')](handleEntityNotFound(_0x38c345,null))[_0x5e1b('0x1c')](function(_0x386d51){if(_0x386d51){_0x3269ba[_0x5e1b('0xa3')]=_[_0x5e1b('0x6c')](_0x386d51,['Contacts']);if(_0x386d51[_0x5e1b('0xa1')][_0x5e1b('0x43')]){return _0x386d51['Contacts'][0x0];}var _0x3c1fa5=_[_0x5e1b('0xa4')](_0x3269ba[_0x5e1b('0x55')],{'firstName':_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x97')],'ListId':_0x386d51['id']});_0x3c1fa5[_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x9d')]]=_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x97')];return db['CmContact'][_0x5e1b('0x54')](_0x3c1fa5,{'fields':_0x45b963,'raw':!![]});}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x38c345,null))['then'](function(_0x132303){if(_0x132303){_0x3269ba[_0x5e1b('0xa5')]=_0x132303;var _0x2fd7bd={'ContactId':_0x132303['id'],'phone':_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x97')],'WhatsappAccountId':_0x15604d[_0x5e1b('0x5d')]['id']};var _0x4b42f0={'ContactId':_0x132303['id'],'WhatsappAccountId':_0x15604d[_0x5e1b('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x5e1b('0x5a')]({'where':_0x4b42f0})['then'](function(_0x532253){if(_0x532253){return[_0x532253,![]];}return db['WhatsappInteraction']['create'](_0x2fd7bd)[_0x5e1b('0x1c')](function(_0x1c42a1){return[_0x1c42a1,!![]];});});}})['spread'](function(_0x47bc5d,_0x2c7acb){_0x3269ba['interaction']=_0x47bc5d[_0x5e1b('0x32')]({'plain':!![]});_0x3269ba[_0x5e1b('0xa6')]['created']=![];if(_0x2c7acb){if(_0x3269ba[_0x5e1b('0x80')][_0x5e1b('0xa7')]){_0x3269ba[_0x5e1b('0x87')][_0x5e1b('0xa8')]({'id':0x0,'priority':_0x3269ba[_0x5e1b('0x87')][_0x5e1b('0x43')]+0x1,'app':_0x5e1b('0xa9'),'appdata':_0x5e1b('0xaa'),'interval':_0x5e1b('0xab')});}_0x3269ba[_0x5e1b('0xa6')][_0x5e1b('0xac')]=!![];}return db[_0x5e1b('0x84')][_0x5e1b('0x54')]({'phone':_0x3269ba['body'][_0x5e1b('0x97')],'messageId':_0x3269ba['body'][_0x5e1b('0x99')],'body':_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0x55')],'WhatsappAccountId':_0x15604d[_0x5e1b('0x5d')]['id'],'WhatsappInteractionId':_0x47bc5d['id'],'direction':'in','ContactId':_0x47bc5d[_0x5e1b('0xad')],'AttachmentId':_0x3269ba[_0x5e1b('0x55')][_0x5e1b('0xae')]});})['then'](function(_0x45a837){_0x3269ba[_0x5e1b('0x23')]=_0x45a837;if(!_0x3269ba[_0x5e1b('0xa6')][_0x5e1b('0xaf')])return;return db[_0x5e1b('0x73')][_0x5e1b('0x5a')]({'attributes':['id',_0x5e1b('0x36')],'where':{'id':_0x3269ba['interaction'][_0x5e1b('0xaf')]}});})[_0x5e1b('0x1c')](function(_0x43dc18){if(_0x43dc18){_0x3269ba['applications'][_0x5e1b('0xb0')]({'id':0x0,'priority':0x0,'app':_0x5e1b('0xb1'),'appdata':_0x43dc18[_0x5e1b('0x36')]+','+(_0x3269ba['account'][_0x5e1b('0xb2')]||0xa),'interval':'*,*,*,*'});}if(!_0x3269ba['interaction'][_0x5e1b('0xb3')])return;return db['WhatsappQueue']['find']({'attributes':['id','name'],'where':{'id':_0x3269ba[_0x5e1b('0xa6')][_0x5e1b('0xb3')]}});})[_0x5e1b('0x1c')](function(_0x2efabe){if(_0x2efabe){_0x3269ba[_0x5e1b('0x87')][_0x5e1b('0xb0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2efabe[_0x5e1b('0x36')]+','+(_0x3269ba['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x5e1b('0xab')});}return respondWithRpcPromise(_0x5e1b('0xb4'),_0x5e1b('0xb5'),_0x3269ba);})[_0x5e1b('0x1c')](function(_0x3aee21){if(_0x3aee21){var _0x7ebe42=0xc8;var _0x3610eb='receiveMessage';logger[_0x5e1b('0xb6')](_0x5e1b('0x20'),_0x3610eb,_0x7ebe42,'entity\x20found');logger[_0x5e1b('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3610eb,_0x7ebe42,_0x5e1b('0xb7'),JSON[_0x5e1b('0xb8')](_0x3aee21));if(_0x3269ba['account'][_0x5e1b('0x3b')]===_0x5e1b('0x92')){return _0x38c345['status'](_0x7ebe42)[_0x5e1b('0xb9')](_0x5e1b('0xba'),_0x5e1b('0xbb'))[_0x5e1b('0xbc')]('\x0a');}else{return _0x38c345[_0x5e1b('0x27')](_0x7ebe42)[_0x5e1b('0x28')](_0x3aee21);}}});})[_0x5e1b('0x25')](handleError(_0x38c345,null));};exports['send']=function(_0x408897,_0x4506c6,_0x2d9ad5){var _0x186e71,_0xc65de7,_0x43f23c;if(_[_0x5e1b('0x9b')](_0x408897['body'][_0x5e1b('0x55')])||_0x408897[_0x5e1b('0x55')][_0x5e1b('0x55')]===''){throw new db['Sequelize'][(_0x5e1b('0x8a'))](_0x5e1b('0x9c'));}if(_[_0x5e1b('0x9b')](_0x408897[_0x5e1b('0x55')]['to'])){throw new db['Sequelize']['ValidationError'](_0x5e1b('0xbd'));}_0x186e71=_0x408897['body']['to'];return db[_0x5e1b('0x4c')][_0x5e1b('0x5a')]({'where':{'id':_0x408897['params']['id']},'include':[{'model':db[_0x5e1b('0xa0')],'as':_0x5e1b('0xbe'),'include':[{'model':db[_0x5e1b('0x88')],'as':_0x5e1b('0xa1'),'where':{'mobile':_0x186e71},'limit':0x1,'order':[[_0x5e1b('0x8d'),_0x5e1b('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x4506c6,null))[_0x5e1b('0x1c')](function(_0x45e9ea){if(_0x45e9ea&&_0x45e9ea[_0x5e1b('0xbe')]){_0xc65de7=_0x45e9ea[_0x5e1b('0x32')]({'plain':!![]});if(_0xc65de7[_0x5e1b('0xbe')]&&_0xc65de7[_0x5e1b('0xbe')]['Contacts'][_0x5e1b('0x43')]){return _0xc65de7[_0x5e1b('0xbe')][_0x5e1b('0xa1')][0x0];}return db[_0x5e1b('0x88')][_0x5e1b('0x54')](_[_0x5e1b('0xa4')](_0x408897[_0x5e1b('0x55')],{'firstName':_0x186e71,'mobile':_0x186e71,'phone':_0x186e71,'ListId':_0xc65de7['ListId']}));}})[_0x5e1b('0x1c')](handleEntityNotFound(_0x4506c6,null))[_0x5e1b('0x1c')](function(_0x35f3f6){if(_0x35f3f6){_0x43f23c=_0x35f3f6;return db[_0x5e1b('0xbf')]['find']({'where':{'ContactId':_0x43f23c['id'],'closed':![],'WhatsappAccountId':_0xc65de7['id']}})[_0x5e1b('0x1c')](function(_0x552db4){if(_0x552db4){return[_0x552db4,![]];}return db[_0x5e1b('0xbf')][_0x5e1b('0x54')]({'UserId':_0x408897[_0x5e1b('0x56')]['id'],'ContactId':_0x43f23c['id'],'WhatsappAccountId':_0xc65de7['id'],'phone':_0x186e71,'firstMsgDirection':_0x5e1b('0xc0'),'Messages':[_[_0x5e1b('0x49')](_0x408897[_0x5e1b('0x55')],{'read':![],'body':_0x408897[_0x5e1b('0x55')]['body'],'phone':_0x186e71,'WhatsappAccountId':_0xc65de7['id'],'UserId':_0x408897['user']['id'],'ContactId':_0x43f23c['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x5e1b('0xc1')}]})[_0x5e1b('0x1c')](function(_0x3b0615){return[_0x3b0615,!![]];});});}})['spread'](function(_0x32cbc6,_0x2114f9){if(_0x2114f9){return _0x32cbc6;}return db[_0x5e1b('0x84')][_0x5e1b('0x54')](_['merge'](_0x408897[_0x5e1b('0x55')],{'read':![],'body':_0x408897[_0x5e1b('0x55')][_0x5e1b('0x55')],'phone':_0x186e71,'WhatsappAccountId':_0xc65de7['id'],'WhatsappInteractionId':_0x32cbc6['id'],'UserId':_0x408897[_0x5e1b('0x56')]['id'],'ContactId':_0x43f23c['id']}))['then'](function(_0x401dbd){_0x32cbc6[_0x5e1b('0xc2')][_0x5e1b('0xc1')]=[];_0x32cbc6[_0x5e1b('0xc2')][_0x5e1b('0xc1')][_0x5e1b('0xa8')](_0x401dbd[_0x5e1b('0xc2')]);return _0x32cbc6;});})[_0x5e1b('0x1c')](respondWithResult(_0x4506c6,null))['catch'](handleError(_0x4506c6,null));}; \ No newline at end of file +var _0x4028=['destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','nolimit','order','WhatsappAccountId','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','User','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','account','sinch','statuses','read','timestamp','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','mobile','twilio','from','replace','Body','messageId','notifications','message_id','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','applications','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','UserProfileResource'];(function(_0x273c8b,_0x583d9b){var _0x2055b1=function(_0x1c04bf){while(--_0x1c04bf){_0x273c8b['push'](_0x273c8b['shift']());}};_0x2055b1(++_0x583d9b);}(_0x4028,0x15a));var _0x8402=function(_0x13fb20,_0x5b72a2){_0x13fb20=_0x13fb20-0x0;var _0xda7583=_0x4028[_0x13fb20];return _0xda7583;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8402('0x0'));var zipdir=require(_0x8402('0x1'));var jsonpatch=require(_0x8402('0x2'));var rp=require(_0x8402('0x3'));var moment=require('moment');var BPromise=require(_0x8402('0x4'));var Mustache=require(_0x8402('0x5'));var util=require(_0x8402('0x6'));var path=require(_0x8402('0x7'));var sox=require(_0x8402('0x8'));var csv=require(_0x8402('0x9'));var ejs=require(_0x8402('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8402('0xb'));var crypto=require(_0x8402('0xc'));var jsforce=require(_0x8402('0xd'));var deskjs=require(_0x8402('0xe'));var toCsv=require(_0x8402('0x9'));var querystring=require(_0x8402('0xf'));var Papa=require(_0x8402('0x10'));var Redis=require(_0x8402('0x11'));var authService=require(_0x8402('0x12'));var qs=require(_0x8402('0x13'));var as=require(_0x8402('0x14'));var hardwareService=require(_0x8402('0x15'));var logger=require('../../config/logger')(_0x8402('0x16'));var utils=require(_0x8402('0x17'));var config=require(_0x8402('0x18'));var licenseUtil=require(_0x8402('0x19'));var db=require(_0x8402('0x1a'))['db'];config[_0x8402('0x1b')]=_[_0x8402('0x1c')](config[_0x8402('0x1b')],{'host':_0x8402('0x1d'),'port':0x18eb});var socket=require(_0x8402('0x1e'))(new Redis(config[_0x8402('0x1b')]));require(_0x8402('0x1f'))[_0x8402('0x20')](socket);var jayson=require(_0x8402('0x21'));var client=jayson['client'][_0x8402('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x193ad4,_0x42b0b8,_0x5c5bdc,_0x4d85b){return new BPromise(function(_0x1f61a1,_0x2eb250){var _0x509c3e=_0x4d85b||client;return _0x509c3e[_0x8402('0x23')](_0x193ad4,_0x5c5bdc)[_0x8402('0x24')](function(_0x175354){logger[_0x8402('0x25')](_0x8402('0x26'),_0x42b0b8,'request\x20sent');logger[_0x8402('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x42b0b8,_0x8402('0x28'),JSON[_0x8402('0x29')](_0x175354));if(_0x175354[_0x8402('0x2a')]){if(_0x175354[_0x8402('0x2a')][_0x8402('0x2b')]===0x1f4){logger[_0x8402('0x2a')](_0x8402('0x26'),_0x42b0b8,_0x175354['error'][_0x8402('0x2c')]);return _0x2eb250(_0x175354[_0x8402('0x2a')]['message']);}logger[_0x8402('0x2a')](_0x8402('0x26'),_0x42b0b8,_0x175354['error'][_0x8402('0x2c')]);return _0x1f61a1(_0x175354[_0x8402('0x2a')][_0x8402('0x2c')]);}else{logger['info'](_0x8402('0x26'),_0x42b0b8,_0x8402('0x28'));_0x1f61a1(_0x175354[_0x8402('0x2d')]['message']);}})[_0x8402('0x2e')](function(_0x5554a3){logger[_0x8402('0x2a')](_0x8402('0x26'),_0x42b0b8,_0x5554a3);_0x2eb250(_0x5554a3);});});}function respondWithStatusCode(_0x1cf060,_0x4e654c){_0x4e654c=_0x4e654c||0xcc;return function(_0x582dc0){if(_0x582dc0){return _0x1cf060[_0x8402('0x2f')](_0x4e654c);}return _0x1cf060[_0x8402('0x30')](_0x4e654c)[_0x8402('0x31')]();};}function respondWithResult(_0x86229e,_0x1fb808){_0x1fb808=_0x1fb808||0xc8;return function(_0x2884e9){if(_0x2884e9){return _0x86229e[_0x8402('0x30')](_0x1fb808)[_0x8402('0x32')](_0x2884e9);}};}function respondWithFilteredResult(_0x9ad146,_0xbddb01){return function(_0x3a9851){if(_0x3a9851){var _0x4235eb=typeof _0xbddb01[_0x8402('0x33')]===_0x8402('0x34')&&typeof _0xbddb01['limit']===_0x8402('0x34');var _0x2af9d1=_0x3a9851[_0x8402('0x35')];var _0x29f38d=_0x4235eb?0x0:_0xbddb01[_0x8402('0x33')];var _0x2cc4b7=_0x4235eb?_0x3a9851[_0x8402('0x35')]:_0xbddb01[_0x8402('0x33')]+_0xbddb01[_0x8402('0x36')];var _0x49e857;if(_0x2cc4b7>=_0x2af9d1){_0x2cc4b7=_0x2af9d1;_0x49e857=0xc8;}else{_0x49e857=0xce;}_0x9ad146[_0x8402('0x30')](_0x49e857);return _0x9ad146['set'](_0x8402('0x37'),_0x29f38d+'-'+_0x2cc4b7+'/'+_0x2af9d1)['json'](_0x3a9851);}return null;};}function patchUpdates(_0x109647){return function(_0x1d3001){try{jsonpatch[_0x8402('0x38')](_0x1d3001,_0x109647,!![]);}catch(_0x2ea66){return BPromise['reject'](_0x2ea66);}return _0x1d3001[_0x8402('0x39')]();};}function saveUpdates(_0x59058e,_0x5006ab){return function(_0x4e1f49){if(_0x4e1f49){return _0x4e1f49[_0x8402('0x3a')](_0x59058e)[_0x8402('0x24')](function(_0x47ddb1){return _0x47ddb1;});}return null;};}function removeEntity(_0x59e3b4,_0xb5428f){return function(_0x2a82ee){if(_0x2a82ee){return _0x2a82ee['destroy']()[_0x8402('0x24')](function(){var _0x1fde05=_0x2a82ee['get']({'plain':!![]});var _0x456ed9='WhatsappAccounts';return db[_0x8402('0x3b')][_0x8402('0x3c')]({'where':{'type':_0x456ed9,'resourceId':_0x1fde05['id']}})[_0x8402('0x24')](function(){return _0x2a82ee;});})[_0x8402('0x24')](function(){_0x59e3b4[_0x8402('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5318f6,_0x21ed99){return function(_0x31cd89){if(!_0x31cd89){_0x5318f6['sendStatus'](0x194);}return _0x31cd89;};}function handleError(_0x4aa4b4,_0x62faf7){_0x62faf7=_0x62faf7||0x1f4;return function(_0x23eb96){logger[_0x8402('0x2a')](_0x23eb96[_0x8402('0x3d')]);if(_0x23eb96[_0x8402('0x3e')]){delete _0x23eb96[_0x8402('0x3e')];}_0x4aa4b4['status'](_0x62faf7)[_0x8402('0x3f')](_0x23eb96);};}exports[_0x8402('0x40')]=function(_0x2b926f,_0xec8939){var _0x17569a={'include':[{'model':db[_0x8402('0x41')],'as':_0x8402('0x42')}]},_0x48fed6={},_0x518b3a={'count':0x0,'rows':[]};var _0x1fc8b6=_['map'](db[_0x8402('0x43')][_0x8402('0x44')],function(_0x546303){return{'name':_0x546303[_0x8402('0x45')],'type':_0x546303[_0x8402('0x46')][_0x8402('0x47')]};});_0x48fed6[_0x8402('0x48')]=_['map'](_0x1fc8b6,_0x8402('0x3e'));_0x48fed6[_0x8402('0x49')]=_[_0x8402('0x4a')](_0x2b926f['query']);_0x48fed6[_0x8402('0x4b')]=_[_0x8402('0x4c')](_0x48fed6['model'],_0x48fed6[_0x8402('0x49')]);_0x17569a['attributes']=_['intersection'](_0x48fed6[_0x8402('0x48')],qs[_0x8402('0x4d')](_0x2b926f[_0x8402('0x49')][_0x8402('0x4d')]));_0x17569a[_0x8402('0x4e')]=_0x17569a['attributes'][_0x8402('0x4f')]?_0x17569a[_0x8402('0x4e')]:_0x48fed6[_0x8402('0x48')];if(!_0x2b926f[_0x8402('0x49')][_0x8402('0x50')]('nolimit')){_0x17569a[_0x8402('0x36')]=qs[_0x8402('0x36')](_0x2b926f[_0x8402('0x49')]['limit']);_0x17569a['offset']=qs[_0x8402('0x33')](_0x2b926f[_0x8402('0x49')][_0x8402('0x33')]);}_0x17569a['order']=qs[_0x8402('0x51')](_0x2b926f['query']['sort']);_0x17569a[_0x8402('0x52')]=qs[_0x8402('0x4b')](_[_0x8402('0x53')](_0x2b926f[_0x8402('0x49')],_0x48fed6[_0x8402('0x4b')]),_0x1fc8b6);if(_0x2b926f['query'][_0x8402('0x54')]){_0x17569a['where']=_[_0x8402('0x55')](_0x17569a[_0x8402('0x52')],{'$or':_[_0x8402('0x56')](_0x1fc8b6,function(_0x16440c){if(_0x16440c[_0x8402('0x46')]!==_0x8402('0x57')){var _0x5680c8={};_0x5680c8[_0x16440c[_0x8402('0x3e')]]={'$like':'%'+_0x2b926f['query'][_0x8402('0x54')]+'%'};return _0x5680c8;}})});}_0x17569a=_['merge']({},_0x17569a,_0x2b926f[_0x8402('0x58')]);var _0x565151={'where':_0x17569a['where']};return db['WhatsappAccount'][_0x8402('0x35')](_0x565151)['then'](function(_0x2b18c7){_0x518b3a[_0x8402('0x35')]=_0x2b18c7;if(_0x2b926f[_0x8402('0x49')][_0x8402('0x59')]){_0x17569a[_0x8402('0x5a')]=[{'all':!![]}];}return db[_0x8402('0x43')][_0x8402('0x5b')](_0x17569a);})[_0x8402('0x24')](function(_0x454fab){_0x518b3a['rows']=_0x454fab;return _0x518b3a;})[_0x8402('0x24')](respondWithFilteredResult(_0xec8939,_0x17569a))[_0x8402('0x2e')](handleError(_0xec8939,null));};exports[_0x8402('0x5c')]=function(_0x1a14eb,_0x17cf68){var _0xdf19b3={'raw':![],'where':{'id':_0x1a14eb['params']['id']},'include':[{'model':db[_0x8402('0x41')],'as':'mandatoryDispositionPause'}]},_0x1aa42e={};_0x1aa42e[_0x8402('0x48')]=_['keys'](db[_0x8402('0x43')][_0x8402('0x44')]);_0x1aa42e[_0x8402('0x49')]=_['keys'](_0x1a14eb['query']);_0x1aa42e['filters']=_[_0x8402('0x4c')](_0x1aa42e[_0x8402('0x48')],_0x1aa42e['query']);_0xdf19b3[_0x8402('0x4e')]=_[_0x8402('0x4c')](_0x1aa42e[_0x8402('0x48')],qs[_0x8402('0x4d')](_0x1a14eb[_0x8402('0x49')]['fields']));_0xdf19b3[_0x8402('0x4e')]=_0xdf19b3[_0x8402('0x4e')][_0x8402('0x4f')]?_0xdf19b3['attributes']:_0x1aa42e[_0x8402('0x48')];if(_0x1a14eb[_0x8402('0x49')][_0x8402('0x59')]){_0xdf19b3[_0x8402('0x5a')]=[{'all':!![]}];}_0xdf19b3=_['merge']({},_0xdf19b3,_0x1a14eb[_0x8402('0x58')]);return db['WhatsappAccount'][_0x8402('0x5d')](_0xdf19b3)[_0x8402('0x24')](handleEntityNotFound(_0x17cf68,null))[_0x8402('0x24')](respondWithResult(_0x17cf68,null))[_0x8402('0x2e')](handleError(_0x17cf68,null));};exports[_0x8402('0x5e')]=function(_0x18a383,_0x4acdcd){return db[_0x8402('0x43')][_0x8402('0x5e')](_0x18a383[_0x8402('0x5f')],{})[_0x8402('0x24')](function(_0x460656){var _0x5b3351=_0x18a383[_0x8402('0x60')][_0x8402('0x61')]({'plain':!![]});if(!_0x5b3351)throw new Error(_0x8402('0x62'));if(_0x5b3351[_0x8402('0x63')]===_0x8402('0x60')){var _0x47537b=_0x460656['get']({'plain':!![]});var _0x34fd30=_0x8402('0x64');return db[_0x8402('0x65')][_0x8402('0x5d')]({'where':{'name':_0x34fd30,'userProfileId':_0x5b3351[_0x8402('0x66')]},'raw':!![]})['then'](function(_0x52dd96){if(_0x52dd96&&_0x52dd96[_0x8402('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0x47537b[_0x8402('0x3e')],'resourceId':_0x47537b['id'],'type':_0x52dd96[_0x8402('0x3e')],'sectionId':_0x52dd96['id']},{})['then'](function(){return _0x460656;});}else{return _0x460656;}})[_0x8402('0x2e')](function(_0x379bc9){logger['error'](_0x8402('0x68'),_0x379bc9);throw _0x379bc9;});}return _0x460656;})[_0x8402('0x24')](respondWithResult(_0x4acdcd,0xc9))[_0x8402('0x2e')](handleError(_0x4acdcd,null));};exports[_0x8402('0x3a')]=function(_0x2b4a64,_0x48f926){if(_0x2b4a64['body']['id']){delete _0x2b4a64[_0x8402('0x5f')]['id'];}return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0x2b4a64[_0x8402('0x69')]['id']},'include':[{'model':db['Pause'],'as':_0x8402('0x42')}]})[_0x8402('0x24')](handleEntityNotFound(_0x48f926,null))['then'](saveUpdates(_0x2b4a64['body'],null))[_0x8402('0x24')](respondWithResult(_0x48f926,null))[_0x8402('0x2e')](handleError(_0x48f926,null));};exports[_0x8402('0x3c')]=function(_0x3ba554,_0x9a1392){return db['WhatsappAccount'][_0x8402('0x5d')]({'where':{'id':_0x3ba554[_0x8402('0x69')]['id']}})['then'](handleEntityNotFound(_0x9a1392,null))[_0x8402('0x24')](removeEntity(_0x9a1392,null))[_0x8402('0x2e')](handleError(_0x9a1392,null));};exports[_0x8402('0x6a')]=function(_0x489bca,_0x164a88){return db[_0x8402('0x43')][_0x8402('0x6a')]()[_0x8402('0x24')](respondWithResult(_0x164a88,null))[_0x8402('0x2e')](handleError(_0x164a88,null));};exports['addDisposition']=function(_0xaeebed,_0xda62d6,_0x14db5b){if(_0xaeebed[_0x8402('0x5f')]['id']){delete _0xaeebed['body']['id'];}return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0xaeebed[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0xda62d6,null))[_0x8402('0x24')](function(_0x5f2f71){if(_0x5f2f71){_0xaeebed[_0x8402('0x5f')]['WhatsappAccountId']=_0x5f2f71['id'];return db['Disposition'][_0x8402('0x5e')](_0xaeebed[_0x8402('0x5f')]);}})[_0x8402('0x24')](respondWithResult(_0xda62d6,null))[_0x8402('0x2e')](handleError(_0xda62d6,null));};exports['getDispositions']=function(_0x22e461,_0x266e44,_0x48759f){var _0x1282ff={'raw':![],'where':{}};var _0x198ce3={};var _0x3febdc={'count':0x0,'rows':[]};return db[_0x8402('0x43')]['findOne']({'where':{'id':_0x22e461[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x266e44,null))[_0x8402('0x24')](function(_0x22ca65){if(_0x22ca65){_0x198ce3[_0x8402('0x48')]=_[_0x8402('0x4a')](db[_0x8402('0x6b')][_0x8402('0x44')]);_0x198ce3[_0x8402('0x49')]=_[_0x8402('0x4a')](_0x22e461['query']);_0x198ce3[_0x8402('0x4b')]=_[_0x8402('0x4c')](_0x198ce3[_0x8402('0x48')],_0x198ce3[_0x8402('0x49')]);_0x1282ff['attributes']=_[_0x8402('0x4c')](_0x198ce3['model'],qs['fields'](_0x22e461[_0x8402('0x49')][_0x8402('0x4d')]));_0x1282ff[_0x8402('0x4e')]=_0x1282ff[_0x8402('0x4e')][_0x8402('0x4f')]?_0x1282ff[_0x8402('0x4e')]:_0x198ce3[_0x8402('0x48')];if(!_0x22e461[_0x8402('0x49')][_0x8402('0x50')](_0x8402('0x6c'))){_0x1282ff[_0x8402('0x36')]=qs[_0x8402('0x36')](_0x22e461[_0x8402('0x49')][_0x8402('0x36')]);_0x1282ff[_0x8402('0x33')]=qs[_0x8402('0x33')](_0x22e461[_0x8402('0x49')]['offset']);}_0x1282ff[_0x8402('0x6d')]=qs['sort'](_0x22e461[_0x8402('0x49')][_0x8402('0x51')]);_0x1282ff[_0x8402('0x52')]=qs[_0x8402('0x4b')](_[_0x8402('0x53')](_0x22e461['query'],_0x198ce3[_0x8402('0x4b')]));_0x1282ff['where'][_0x8402('0x6e')]=_0x22ca65['id'];if(_0x22e461[_0x8402('0x49')][_0x8402('0x54')]){_0x1282ff[_0x8402('0x52')]=_[_0x8402('0x55')](_0x1282ff[_0x8402('0x52')],{'$or':_[_0x8402('0x56')](_0x1282ff[_0x8402('0x4e')],function(_0x5cb8c6){var _0x3e4baf={};_0x3e4baf[_0x5cb8c6]={'$like':'%'+_0x22e461['query']['filter']+'%'};return _0x3e4baf;})});}_0x1282ff=_[_0x8402('0x55')]({},_0x1282ff,_0x22e461[_0x8402('0x58')]);return db[_0x8402('0x6b')][_0x8402('0x35')]({'where':_0x1282ff['where']})[_0x8402('0x24')](function(_0x7a18af){_0x3febdc['count']=_0x7a18af;if(_0x22e461[_0x8402('0x49')][_0x8402('0x59')]){_0x1282ff[_0x8402('0x5a')]=[{'all':!![]}];}return db[_0x8402('0x6b')][_0x8402('0x5b')](_0x1282ff);})[_0x8402('0x24')](function(_0x3783a8){_0x3febdc[_0x8402('0x6f')]=_0x3783a8;return _0x3febdc;});}})[_0x8402('0x24')](respondWithFilteredResult(_0x266e44,_0x1282ff))[_0x8402('0x2e')](handleError(_0x266e44,null));};exports['removeDispositions']=function(_0xaa3612,_0x6005f9,_0x39409d){return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0xaa3612[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x6005f9,null))['then'](function(_0x52b1f4){if(_0x52b1f4){return _0x52b1f4[_0x8402('0x70')](_0xaa3612[_0x8402('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x6005f9,null))[_0x8402('0x2e')](handleError(_0x6005f9,null));};exports[_0x8402('0x71')]=function(_0x28d857,_0x234fb8,_0xe1b15d){if(_0x28d857[_0x8402('0x5f')]['id']){delete _0x28d857[_0x8402('0x5f')]['id'];}return db[_0x8402('0x43')]['find']({'where':{'id':_0x28d857[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x234fb8,null))[_0x8402('0x24')](function(_0x51f0c6){if(_0x51f0c6){_0x28d857[_0x8402('0x5f')][_0x8402('0x6e')]=_0x51f0c6['id'];return db[_0x8402('0x72')][_0x8402('0x5e')](_0x28d857[_0x8402('0x5f')]);}})[_0x8402('0x24')](respondWithResult(_0x234fb8,null))['catch'](handleError(_0x234fb8,null));};exports[_0x8402('0x73')]=function(_0x1ce8f9,_0x251f3c,_0x419b92){var _0x44756b={'raw':![],'where':{}};var _0xfc5ed3={};var _0xe8e043={'count':0x0,'rows':[]};return db[_0x8402('0x43')][_0x8402('0x74')]({'where':{'id':_0x1ce8f9[_0x8402('0x69')]['id']}})['then'](handleEntityNotFound(_0x251f3c,null))[_0x8402('0x24')](function(_0x4ffe58){if(_0x4ffe58){_0xfc5ed3['model']=_[_0x8402('0x4a')](db[_0x8402('0x72')][_0x8402('0x44')]);_0xfc5ed3[_0x8402('0x49')]=_[_0x8402('0x4a')](_0x1ce8f9['query']);_0xfc5ed3[_0x8402('0x4b')]=_['intersection'](_0xfc5ed3[_0x8402('0x48')],_0xfc5ed3['query']);_0x44756b['attributes']=_[_0x8402('0x4c')](_0xfc5ed3['model'],qs[_0x8402('0x4d')](_0x1ce8f9[_0x8402('0x49')]['fields']));_0x44756b[_0x8402('0x4e')]=_0x44756b['attributes']['length']?_0x44756b[_0x8402('0x4e')]:_0xfc5ed3[_0x8402('0x48')];if(!_0x1ce8f9[_0x8402('0x49')][_0x8402('0x50')](_0x8402('0x6c'))){_0x44756b['limit']=qs[_0x8402('0x36')](_0x1ce8f9[_0x8402('0x49')]['limit']);_0x44756b[_0x8402('0x33')]=qs[_0x8402('0x33')](_0x1ce8f9[_0x8402('0x49')][_0x8402('0x33')]);}_0x44756b[_0x8402('0x6d')]=qs[_0x8402('0x51')](_0x1ce8f9[_0x8402('0x49')]['sort']);_0x44756b['where']=qs[_0x8402('0x4b')](_[_0x8402('0x53')](_0x1ce8f9[_0x8402('0x49')],_0xfc5ed3[_0x8402('0x4b')]));_0x44756b[_0x8402('0x52')][_0x8402('0x6e')]=_0x4ffe58['id'];if(_0x1ce8f9[_0x8402('0x49')][_0x8402('0x54')]){_0x44756b[_0x8402('0x52')]=_[_0x8402('0x55')](_0x44756b[_0x8402('0x52')],{'$or':_[_0x8402('0x56')](_0x44756b[_0x8402('0x4e')],function(_0x42b5e8){var _0x433914={};_0x433914[_0x42b5e8]={'$like':'%'+_0x1ce8f9[_0x8402('0x49')]['filter']+'%'};return _0x433914;})});}_0x44756b=_[_0x8402('0x55')]({},_0x44756b,_0x1ce8f9[_0x8402('0x58')]);return db[_0x8402('0x72')][_0x8402('0x35')]({'where':_0x44756b[_0x8402('0x52')]})['then'](function(_0x14bbb5){_0xe8e043['count']=_0x14bbb5;if(_0x1ce8f9['query'][_0x8402('0x59')]){_0x44756b[_0x8402('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8402('0x5b')](_0x44756b);})[_0x8402('0x24')](function(_0x59bd6b){_0xe8e043[_0x8402('0x6f')]=_0x59bd6b;return _0xe8e043;});}})[_0x8402('0x24')](respondWithFilteredResult(_0x251f3c,_0x44756b))[_0x8402('0x2e')](handleError(_0x251f3c,null));};exports[_0x8402('0x75')]=function(_0x146599,_0x1ab40c,_0x1eb76e){return db['WhatsappAccount']['find']({'where':{'id':_0x146599['params']['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x1ab40c,null))[_0x8402('0x24')](function(_0x4962ed){if(_0x4962ed){return _0x4962ed[_0x8402('0x75')](_0x146599[_0x8402('0x49')][_0x8402('0x76')]);}})['then'](respondWithStatusCode(_0x1ab40c,null))[_0x8402('0x2e')](handleError(_0x1ab40c,null));};exports[_0x8402('0x77')]=function(_0x844f45,_0x27c10c,_0xfc366a){return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0x844f45[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x27c10c,null))[_0x8402('0x24')](function(_0x4470df){if(_0x4470df){return _0x4470df[_0x8402('0x77')](_0x844f45[_0x8402('0x5f')][_0x8402('0x76')],_[_0x8402('0x78')](_0x844f45['body'],['ids','id'])||{})['spread'](function(_0x55c780){for(var _0x14e6cc=0x0;_0x14e6cc<_0x844f45[_0x8402('0x5f')][_0x8402('0x76')][_0x8402('0x4f')];_0x14e6cc+=0x1){socket['emit'](_0x8402('0x79'),{'UserId':Number(_0x844f45[_0x8402('0x5f')]['ids'][_0x14e6cc]),'WhatsappAccountId':Number(_0x844f45[_0x8402('0x69')]['id'])});}return _0x55c780;});}})[_0x8402('0x24')](respondWithResult(_0x27c10c,null))[_0x8402('0x2e')](handleError(_0x27c10c,null));};exports[_0x8402('0x7a')]=function(_0x447ede,_0x48e5c7,_0x1a9e10){return db[_0x8402('0x43')]['find']({'where':{'id':_0x447ede[_0x8402('0x69')]['id']}})['then'](handleEntityNotFound(_0x48e5c7,null))[_0x8402('0x24')](function(_0x16b310){if(_0x16b310){return _0x16b310['removeAgents'](_0x447ede[_0x8402('0x49')][_0x8402('0x76')])[_0x8402('0x24')](function(){if(_[_0x8402('0x7b')](_0x447ede[_0x8402('0x49')][_0x8402('0x76')])){for(var _0x4ea6b8=0x0;_0x4ea6b8<_0x447ede['query'][_0x8402('0x76')][_0x8402('0x4f')];_0x4ea6b8+=0x1){socket[_0x8402('0x7c')]('userWhatsappAccount:remove',{'UserId':Number(_0x447ede[_0x8402('0x49')][_0x8402('0x76')][_0x4ea6b8]),'WhatsappAccountId':Number(_0x447ede[_0x8402('0x69')]['id'])});}}else{socket[_0x8402('0x7c')]('userWhatsappAccount:remove',{'UserId':Number(_0x447ede[_0x8402('0x49')][_0x8402('0x76')]),'WhatsappAccountId':Number(_0x447ede[_0x8402('0x69')]['id'])});}});}})[_0x8402('0x24')](respondWithStatusCode(_0x48e5c7,null))[_0x8402('0x2e')](handleError(_0x48e5c7,null));};exports['getAgents']=function(_0x165342,_0x43db59,_0x3e745e){var _0x11e7e6={};var _0x554512={};var _0x467ae8;var _0x10bfd8;return db['WhatsappAccount']['findOne']({'where':{'id':_0x165342['params']['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x43db59,null))[_0x8402('0x24')](function(_0x7393d0){if(_0x7393d0){_0x467ae8=_0x7393d0;_0x554512[_0x8402('0x48')]=_[_0x8402('0x4a')](db[_0x8402('0x7d')][_0x8402('0x44')]);_0x554512[_0x8402('0x49')]=_[_0x8402('0x4a')](_0x165342[_0x8402('0x49')]);_0x554512[_0x8402('0x4b')]=_['intersection'](_0x554512['model'],_0x554512['query']);_0x11e7e6[_0x8402('0x4e')]=_[_0x8402('0x4c')](_0x554512[_0x8402('0x48')],qs[_0x8402('0x4d')](_0x165342[_0x8402('0x49')][_0x8402('0x4d')]));_0x11e7e6[_0x8402('0x4e')]=_0x11e7e6[_0x8402('0x4e')][_0x8402('0x4f')]?_0x11e7e6[_0x8402('0x4e')]:_0x554512[_0x8402('0x48')];_0x11e7e6[_0x8402('0x6d')]=qs['sort'](_0x165342[_0x8402('0x49')][_0x8402('0x51')]);_0x11e7e6[_0x8402('0x52')]=qs[_0x8402('0x4b')](_[_0x8402('0x53')](_0x165342[_0x8402('0x49')],_0x554512[_0x8402('0x4b')]));if(_0x165342[_0x8402('0x49')]['filter']){_0x11e7e6[_0x8402('0x52')]=_[_0x8402('0x55')](_0x11e7e6[_0x8402('0x52')],{'$or':_['map'](_0x11e7e6['attributes'],function(_0x1b9902){var _0x28fa44={};_0x28fa44[_0x1b9902]={'$like':'%'+_0x165342['query'][_0x8402('0x54')]+'%'};return _0x28fa44;})});}_0x11e7e6=_['merge']({},_0x11e7e6,_0x165342['options']);return _0x467ae8[_0x8402('0x7e')](_0x11e7e6);}})[_0x8402('0x24')](function(_0x57f17f){if(_0x57f17f){_0x10bfd8=_0x57f17f[_0x8402('0x4f')];if(!_0x165342[_0x8402('0x49')]['hasOwnProperty'](_0x8402('0x6c'))){_0x11e7e6['limit']=qs[_0x8402('0x36')](_0x165342[_0x8402('0x49')]['limit']);_0x11e7e6['offset']=qs[_0x8402('0x33')](_0x165342['query']['offset']);}return _0x467ae8['getAgents'](_0x11e7e6);}})[_0x8402('0x24')](function(_0x299af9){if(_0x299af9){return _0x299af9?{'count':_0x10bfd8,'rows':_0x299af9}:null;}})[_0x8402('0x24')](respondWithResult(_0x43db59,null))[_0x8402('0x2e')](handleError(_0x43db59,null));};exports[_0x8402('0x7f')]=function(_0x53f9f8,_0x43e922){var _0xc8ef80=_0x53f9f8[_0x8402('0x69')]['id'];var _0x81bc25=_0x53f9f8[_0x8402('0x5f')];var _0x342685=0xc8;var _0x5bc481=null;return db[_0x8402('0x80')][_0x8402('0x81')]({'isolationLevel':db[_0x8402('0x80')][_0x8402('0x82')]['ISOLATION_LEVELS'][_0x8402('0x83')]},function(_0x4c1633){return db[_0x8402('0x43')][_0x8402('0x74')]({'where':{'id':_0xc8ef80},'transaction':_0x4c1633})[_0x8402('0x24')](function(_0x282a87){if(_0x282a87){return db[_0x8402('0x84')][_0x8402('0x3c')]({'where':{'WhatsappAccountId':_0xc8ef80},'transaction':_0x4c1633})['then'](function(){var _0x1db92f=_[_0x8402('0x56')](_0x81bc25,function(_0x45efab){_0x45efab['WhatsappAccountId']=_0xc8ef80;return _0x45efab;});return db[_0x8402('0x84')][_0x8402('0x85')](_0x1db92f,{'transaction':_0x4c1633});});}else{_0x342685=0x194;_0x5bc481=[];}});})['then'](function(){if(_0x342685!==0x194){return db[_0x8402('0x84')]['findAndCountAll']({'where':{'WhatsappAccountId':_0xc8ef80},'order':_0x8402('0x86')})[_0x8402('0x24')](function(_0x148dc8){_0x5bc481=_0x148dc8;});}})['catch'](function(_0x5d1e74){_0x342685=0x1f4;logger[_0x8402('0x2a')](_0x5d1e74[_0x8402('0x3d')]);if(_0x5d1e74[_0x8402('0x3e')]){delete _0x5d1e74[_0x8402('0x3e')];}_0x5bc481=_0x5d1e74;})['finally'](function(){if(_0x5bc481===null){_0x43e922[_0x8402('0x2f')](_0x342685);}else{if(_0x342685===0x1f4){_0x43e922[_0x8402('0x30')](_0x342685)['send'](_0x5bc481);}else{_0x43e922[_0x8402('0x30')](_0x342685)[_0x8402('0x32')](_0x5bc481);}}});};exports[_0x8402('0x87')]=function(_0x1ca33d,_0x51e8b4,_0x423ba5){var _0x335cd4={};var _0x5e3b73={};var _0x488485;var _0x296563;return db['WhatsappAccount']['findOne']({'where':{'id':_0x1ca33d[_0x8402('0x69')]['id']}})[_0x8402('0x24')](handleEntityNotFound(_0x51e8b4,null))[_0x8402('0x24')](function(_0x1a39da){if(_0x1a39da){_0x488485=_0x1a39da;_0x5e3b73[_0x8402('0x48')]=_[_0x8402('0x4a')](db[_0x8402('0x84')][_0x8402('0x44')]);_0x5e3b73['query']=_[_0x8402('0x4a')](_0x1ca33d[_0x8402('0x49')]);_0x5e3b73[_0x8402('0x4b')]=_[_0x8402('0x4c')](_0x5e3b73[_0x8402('0x48')],_0x5e3b73[_0x8402('0x49')]);_0x335cd4[_0x8402('0x4e')]=_[_0x8402('0x4c')](_0x5e3b73['model'],qs[_0x8402('0x4d')](_0x1ca33d[_0x8402('0x49')][_0x8402('0x4d')]));_0x335cd4['attributes']=_0x335cd4['attributes'][_0x8402('0x4f')]?_0x335cd4['attributes']:_0x5e3b73[_0x8402('0x48')];_0x335cd4[_0x8402('0x6d')]=qs[_0x8402('0x51')](_0x1ca33d['query']['sort']);_0x335cd4['where']=qs['filters'](_['pick'](_0x1ca33d[_0x8402('0x49')],_0x5e3b73[_0x8402('0x4b')]));if(_0x1ca33d[_0x8402('0x49')][_0x8402('0x54')]){_0x335cd4[_0x8402('0x52')]=_[_0x8402('0x55')](_0x335cd4[_0x8402('0x52')],{'$or':_[_0x8402('0x56')](_0x335cd4['attributes'],function(_0x24d0d2){var _0x12908f={};_0x12908f[_0x24d0d2]={'$like':'%'+_0x1ca33d[_0x8402('0x49')][_0x8402('0x54')]+'%'};return _0x12908f;})});}_0x335cd4=_[_0x8402('0x55')]({},_0x335cd4,_0x1ca33d['options']);return _0x488485[_0x8402('0x87')](_0x335cd4);}})['then'](function(_0x788c2){if(_0x788c2){_0x296563=_0x788c2['length'];if(!_0x1ca33d['query'][_0x8402('0x50')](_0x8402('0x6c'))){_0x335cd4[_0x8402('0x36')]=qs['limit'](_0x1ca33d[_0x8402('0x49')][_0x8402('0x36')]);_0x335cd4['offset']=qs['offset'](_0x1ca33d[_0x8402('0x49')]['offset']);}return _0x488485[_0x8402('0x87')](_0x335cd4);}})[_0x8402('0x24')](function(_0x2090b9){if(_0x2090b9){return _0x2090b9?{'count':_0x296563,'rows':_0x2090b9}:null;}})[_0x8402('0x24')](respondWithResult(_0x51e8b4,null))[_0x8402('0x2e')](handleError(_0x51e8b4,null));};exports['notify']=function(_0x35f286,_0x21adce,_0x3b5c64){var _0xc9e9ea={'channel':_0x8402('0x88')};var _0x2265bf=[];var _0x37c95d=[];var _0x113341={};return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0x35f286[_0x8402('0x69')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x8402('0x24')](handleEntityNotFound(_0x21adce,null))[_0x8402('0x24')](function(_0x16880c){_0xc9e9ea['account']=_0x16880c;if(_0xc9e9ea[_0x8402('0x89')]&&_0xc9e9ea['account'][_0x8402('0x46')]===_0x8402('0x8a')&&_0x35f286['body'][_0x8402('0x8b')]){if(_0x35f286['body'][_0x8402('0x8b')][_0x8402('0x4f')]===0x0)return;if(_0x35f286[_0x8402('0x5f')][_0x8402('0x8b')][0x0]['state']!==_0x8402('0x8c'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x35f286[_0x8402('0x5f')][_0x8402('0x8b')][0x0][_0x8402('0x8d')]},{'where':{'messageId':_0x35f286[_0x8402('0x5f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x8402('0x24')](function(_0x31a9f9){return _0x21adce[_0x8402('0x30')](0xc8)['json'](_0x31a9f9);});}_0xc9e9ea['applications']=_[_0x8402('0x8e')](_0x16880c[_0x8402('0x8f')],['priority'],[_0x8402('0x90')]);if(_0xc9e9ea[_0x8402('0x89')]['Applications']){delete _0xc9e9ea[_0x8402('0x89')][_0x8402('0x8f')];}return db[_0x8402('0x91')][_0x8402('0x6a')]()[_0x8402('0x24')](function(_0x2c42cc){if(!_0x2c42cc){throw new db[(_0x8402('0x92'))]['ValidationError'](_0x8402('0x93'));}_0x2265bf=_[_0x8402('0x94')](_[_0x8402('0x4a')](_0x2c42cc),['createdAt',_0x8402('0x95')]);_0x37c95d=_[_0x8402('0x94')](_[_0x8402('0x4a')](_0x2c42cc),[_0x8402('0x96'),_0x8402('0x95'),'CompanyId','ListId']);_0xc9e9ea['body']={'mapKey':_0x8402('0x97')};if(_0xc9e9ea[_0x8402('0x89')]&&_0xc9e9ea['account']['type']===_0x8402('0x98')){_0xc9e9ea['body'][_0x8402('0x99')]=_0x35f286[_0x8402('0x5f')]['From'][_0x8402('0x9a')]('whatsapp:','');_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x5f')]=_0x35f286[_0x8402('0x5f')][_0x8402('0x9b')];_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x9c')]=_0x35f286['body']['MessageSid'];}if(_0xc9e9ea['account']&&_0xc9e9ea['account'][_0x8402('0x46')]===_0x8402('0x8a')){_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x99')]=_0x35f286[_0x8402('0x5f')][_0x8402('0x9d')][0x0]['from'];_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x5f')]=_0x35f286[_0x8402('0x5f')][_0x8402('0x9d')][0x0][_0x8402('0x2c')]['body'];_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x9c')]=_0x35f286[_0x8402('0x5f')][_0x8402('0x9d')][0x0][_0x8402('0x9e')];}if(_0xc9e9ea[_0x8402('0x5f')]['id']){delete _0xc9e9ea[_0x8402('0x5f')]['id'];}if(_['isNil'](_0xc9e9ea[_0x8402('0x5f')]['from'])){throw new db[(_0x8402('0x92'))][(_0x8402('0x9f'))](_0x8402('0xa0'));}if(_[_0x8402('0xa1')](_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x5f')])||_0xc9e9ea[_0x8402('0x5f')]['body']===''){throw new db['Sequelize'][(_0x8402('0x9f'))](_0x8402('0xa2'));}if(_[_0x8402('0xa1')](_0xc9e9ea[_0x8402('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x8402('0x9f'))](_0x8402('0xa3')+_0x37c95d);}if(!_[_0x8402('0xa4')](_0x37c95d,_0xc9e9ea[_0x8402('0x5f')][_0x8402('0xa5')])){throw new db[(_0x8402('0x92'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37c95d);}_0x113341[_0xc9e9ea[_0x8402('0x5f')][_0x8402('0xa5')]]=_0xc9e9ea['body'][_0x8402('0x99')];return db[_0x8402('0xa6')][_0x8402('0x5d')]({'where':{'id':_0xc9e9ea[_0x8402('0x89')]['ListId']},'include':[{'model':db[_0x8402('0x91')],'as':_0x8402('0xa7'),'where':_0x113341,'limit':0x1,'order':[[_0x8402('0x95'),_0x8402('0xa8')]]}]});})[_0x8402('0x24')](handleEntityNotFound(_0x21adce,null))[_0x8402('0x24')](function(_0x2e9d27){if(_0x2e9d27){_0xc9e9ea['list']=_['omit'](_0x2e9d27,[_0x8402('0xa7')]);if(_0x2e9d27[_0x8402('0xa7')][_0x8402('0x4f')]){return _0x2e9d27['Contacts'][0x0];}var _0x369652=_['defaults'](_0xc9e9ea[_0x8402('0x5f')],{'firstName':_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x99')],'ListId':_0x2e9d27['id']});_0x369652[_0xc9e9ea['body'][_0x8402('0xa5')]]=_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x99')];return db['CmContact'][_0x8402('0x5e')](_0x369652,{'fields':_0x2265bf,'raw':!![]});}})[_0x8402('0x24')](handleEntityNotFound(_0x21adce,null))[_0x8402('0x24')](function(_0x256eca){if(_0x256eca){_0xc9e9ea[_0x8402('0xa9')]=_0x256eca;var _0x71925={'ContactId':_0x256eca['id'],'phone':_0xc9e9ea['body']['from'],'WhatsappAccountId':_0x35f286[_0x8402('0x69')]['id']};var _0x58e098={'ContactId':_0x256eca['id'],'WhatsappAccountId':_0x35f286[_0x8402('0x69')]['id'],'closed':![]};return db[_0x8402('0xaa')][_0x8402('0x5d')]({'where':_0x58e098})[_0x8402('0x24')](function(_0x3f22d9){if(_0x3f22d9){return[_0x3f22d9,![]];}return db[_0x8402('0xaa')]['create'](_0x71925)[_0x8402('0x24')](function(_0x579a9e){return[_0x579a9e,!![]];});});}})[_0x8402('0xab')](function(_0x4de9b5,_0x1ba3dc){_0xc9e9ea[_0x8402('0xac')]=_0x4de9b5['get']({'plain':!![]});_0xc9e9ea[_0x8402('0xac')][_0x8402('0xad')]=![];if(_0x1ba3dc){if(_0xc9e9ea[_0x8402('0x89')][_0x8402('0xae')]){_0xc9e9ea['applications'][_0x8402('0xaf')]({'id':0x0,'priority':_0xc9e9ea[_0x8402('0xb0')]['length']+0x1,'app':_0x8402('0xb1'),'appdata':'unmanaged','interval':_0x8402('0xb2')});}_0xc9e9ea[_0x8402('0xac')][_0x8402('0xad')]=!![];}return db[_0x8402('0xb3')][_0x8402('0x5e')]({'phone':_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x99')],'messageId':_0xc9e9ea[_0x8402('0x5f')][_0x8402('0x9c')],'body':_0xc9e9ea['body']['body'],'WhatsappAccountId':_0x35f286['params']['id'],'WhatsappInteractionId':_0x4de9b5['id'],'direction':'in','ContactId':_0x4de9b5[_0x8402('0xb4')],'AttachmentId':_0xc9e9ea[_0x8402('0x5f')][_0x8402('0xb5')]});})[_0x8402('0x24')](function(_0x5a9dc7){_0xc9e9ea['message']=_0x5a9dc7;if(!_0xc9e9ea[_0x8402('0xac')]['UserId'])return;return db['User'][_0x8402('0x5d')]({'attributes':['id',_0x8402('0x3e')],'where':{'id':_0xc9e9ea[_0x8402('0xac')][_0x8402('0xb6')]}});})[_0x8402('0x24')](function(_0x3fcdfa){if(_0x3fcdfa){_0xc9e9ea[_0x8402('0xb0')][_0x8402('0xb7')]({'id':0x0,'priority':0x0,'app':_0x8402('0xb8'),'appdata':_0x3fcdfa[_0x8402('0x3e')]+','+(_0xc9e9ea[_0x8402('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0x8402('0xb2')});}if(!_0xc9e9ea['interaction'][_0x8402('0xb9')])return;return db[_0x8402('0xba')]['find']({'attributes':['id',_0x8402('0x3e')],'where':{'id':_0xc9e9ea['interaction']['queueId']}});})[_0x8402('0x24')](function(_0x20c024){if(_0x20c024){_0xc9e9ea[_0x8402('0xb0')][_0x8402('0xb7')]({'id':0x0,'priority':0x1,'app':_0x8402('0xbb'),'appdata':_0x20c024[_0x8402('0x3e')]+','+(_0xc9e9ea[_0x8402('0x89')][_0x8402('0xbc')]||0x12c),'interval':_0x8402('0xb2')});}return respondWithRpcPromise(_0x8402('0xbd'),_0x8402('0xbe'),_0xc9e9ea);})['then'](function(_0xe2c317){if(_0xe2c317){var _0x319cee=0xc8;var _0x39dc3b=_0x8402('0xbf');logger['info'](_0x8402('0xc0'),_0x39dc3b,_0x319cee,_0x8402('0xc1'));logger[_0x8402('0x27')](_0x8402('0xc2'),_0x39dc3b,_0x319cee,_0x8402('0xc1'),JSON[_0x8402('0x29')](_0xe2c317));if(_0xc9e9ea[_0x8402('0x89')][_0x8402('0x46')]===_0x8402('0x98')){return _0x21adce[_0x8402('0x30')](_0x319cee)[_0x8402('0xc3')](_0x8402('0xc4'),'text/xml')['send']('\x0a');}else{return _0x21adce[_0x8402('0x30')](_0x319cee)[_0x8402('0x32')](_0xe2c317);}}});})[_0x8402('0x2e')](handleError(_0x21adce,null));};exports[_0x8402('0x3f')]=function(_0x209a0d,_0x3b92e3,_0x3add10){var _0x5078ac,_0x11b7c5,_0xe0c1f5;if(_[_0x8402('0xa1')](_0x209a0d[_0x8402('0x5f')]['body'])||_0x209a0d['body'][_0x8402('0x5f')]===''){throw new db[(_0x8402('0x92'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8402('0xa1')](_0x209a0d['body']['to'])){throw new db['Sequelize'][(_0x8402('0x9f'))](_0x8402('0xc5'));}_0x5078ac=_0x209a0d[_0x8402('0x5f')]['to'];return db[_0x8402('0x43')][_0x8402('0x5d')]({'where':{'id':_0x209a0d[_0x8402('0x69')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x8402('0xa7'),'where':{'mobile':_0x5078ac},'limit':0x1,'order':[[_0x8402('0x95'),_0x8402('0xa8')]]}]}]})[_0x8402('0x24')](handleEntityNotFound(_0x3b92e3,null))[_0x8402('0x24')](function(_0x2656f4){if(_0x2656f4&&_0x2656f4[_0x8402('0xc6')]){_0x11b7c5=_0x2656f4[_0x8402('0x61')]({'plain':!![]});if(_0x11b7c5[_0x8402('0xc6')]&&_0x11b7c5[_0x8402('0xc6')]['Contacts'][_0x8402('0x4f')]){return _0x11b7c5[_0x8402('0xc6')][_0x8402('0xa7')][0x0];}return db['CmContact'][_0x8402('0x5e')](_[_0x8402('0x1c')](_0x209a0d[_0x8402('0x5f')],{'firstName':_0x5078ac,'mobile':_0x5078ac,'phone':_0x5078ac,'ListId':_0x11b7c5[_0x8402('0xc7')]}));}})[_0x8402('0x24')](handleEntityNotFound(_0x3b92e3,null))[_0x8402('0x24')](function(_0x49f3ee){if(_0x49f3ee){_0xe0c1f5=_0x49f3ee;return db[_0x8402('0xaa')][_0x8402('0x5d')]({'where':{'ContactId':_0xe0c1f5['id'],'closed':![],'WhatsappAccountId':_0x11b7c5['id']}})[_0x8402('0x24')](function(_0x4e7987){if(_0x4e7987){return[_0x4e7987,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x209a0d['user']['id'],'ContactId':_0xe0c1f5['id'],'WhatsappAccountId':_0x11b7c5['id'],'phone':_0x5078ac,'firstMsgDirection':_0x8402('0xc8'),'Messages':[_[_0x8402('0x55')](_0x209a0d[_0x8402('0x5f')],{'read':![],'body':_0x209a0d[_0x8402('0x5f')][_0x8402('0x5f')],'phone':_0x5078ac,'WhatsappAccountId':_0x11b7c5['id'],'UserId':_0x209a0d[_0x8402('0x60')]['id'],'ContactId':_0xe0c1f5['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8402('0xc9')}]})[_0x8402('0x24')](function(_0x2b9049){return[_0x2b9049,!![]];});});}})[_0x8402('0xab')](function(_0x30346a,_0x17df9a){if(_0x17df9a){return _0x30346a;}return db[_0x8402('0xb3')][_0x8402('0x5e')](_[_0x8402('0x55')](_0x209a0d[_0x8402('0x5f')],{'read':![],'body':_0x209a0d['body'][_0x8402('0x5f')],'phone':_0x5078ac,'WhatsappAccountId':_0x11b7c5['id'],'WhatsappInteractionId':_0x30346a['id'],'UserId':_0x209a0d[_0x8402('0x60')]['id'],'ContactId':_0xe0c1f5['id']}))['then'](function(_0x37d4fb){_0x30346a['dataValues'][_0x8402('0xc9')]=[];_0x30346a['dataValues']['Messages'][_0x8402('0xaf')](_0x37d4fb[_0x8402('0xca')]);return _0x30346a;});})[_0x8402('0x24')](respondWithResult(_0x3b92e3,null))[_0x8402('0x2e')](handleError(_0x3b92e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2f6dbae..66eafa6 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 _0xc436=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0xc436,0x153));var _0x6c43=function(_0x4b0297,_0x27af79){_0x4b0297=_0x4b0297-0x0;var _0x179539=_0xc436[_0x4b0297];return _0x179539;};'use strict';var EventEmitter=require(_0x6c43('0x0'));var WhatsappAccount=require(_0x6c43('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6c43('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6c43('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37ee0e){return function(_0x35d95d,_0x2f479f,_0x23d795){WhatsappAccountEvents[_0x6c43('0x4')](_0x37ee0e+':'+_0x35d95d['id'],_0x35d95d);WhatsappAccountEvents[_0x6c43('0x4')](_0x37ee0e,_0x35d95d);_0x23d795(null);};}for(var e in events){if(events[_0x6c43('0x5')](e)){var event=events[e];WhatsappAccount[_0x6c43('0x6')](e,emitEvent(event));}}module[_0x6c43('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x45d9=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2f327b,_0x119a62){var _0x13781a=function(_0x25216f){while(--_0x25216f){_0x2f327b['push'](_0x2f327b['shift']());}};_0x13781a(++_0x119a62);}(_0x45d9,0x142));var _0x945d=function(_0x497d0f,_0x4ec233){_0x497d0f=_0x497d0f-0x0;var _0x4a2b8e=_0x45d9[_0x497d0f];return _0x4a2b8e;};'use strict';var EventEmitter=require(_0x945d('0x0'));var WhatsappAccount=require(_0x945d('0x1'))['db'][_0x945d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x945d('0x3')](0x0);var events={'afterCreate':_0x945d('0x4'),'afterUpdate':'update','afterDestroy':_0x945d('0x5')};function emitEvent(_0x191bbd){return function(_0x2dc790,_0x314ed2,_0x4a11b6){WhatsappAccountEvents[_0x945d('0x6')](_0x191bbd+':'+_0x2dc790['id'],_0x2dc790);WhatsappAccountEvents['emit'](_0x191bbd,_0x2dc790);_0x4a11b6(null);};}for(var e in events){if(events[_0x945d('0x7')](e)){var event=events[e];WhatsappAccount[_0x945d('0x8')](e,emitEvent(event));}}module[_0x945d('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a02a834..338c290 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 _0xaed0=['../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x922cd8,_0x3e8b4c){var _0x3427e6=function(_0x91e6ff){while(--_0x91e6ff){_0x922cd8['push'](_0x922cd8['shift']());}};_0x3427e6(++_0x3e8b4c);}(_0xaed0,0x1cb));var _0x0aed=function(_0x32ff72,_0x5047b3){_0x32ff72=_0x32ff72-0x0;var _0x59a8b4=_0xaed0[_0x32ff72];return _0x59a8b4;};'use strict';var _=require(_0x0aed('0x0'));var util=require(_0x0aed('0x1'));var logger=require(_0x0aed('0x2'))(_0x0aed('0x3'));var moment=require(_0x0aed('0x4'));var BPromise=require(_0x0aed('0x5'));var rp=require(_0x0aed('0x6'));var fs=require('fs');var path=require(_0x0aed('0x7'));var rimraf=require(_0x0aed('0x8'));var config=require(_0x0aed('0x9'));var attributes=require('./whatsappAccount.attributes');module[_0x0aed('0xa')]=function(_0x5a8d7a,_0x5d4ccc){return _0x5a8d7a['define'](_0x0aed('0xb'),attributes,{'tableName':_0x0aed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x613a=['define','WhatsappAccount','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x539709,_0x5b0c54){var _0x2b5bb8=function(_0x4df4a1){while(--_0x4df4a1){_0x539709['push'](_0x539709['shift']());}};_0x2b5bb8(++_0x5b0c54);}(_0x613a,0x70));var _0xa613=function(_0x284e60,_0x4650db){_0x284e60=_0x284e60-0x0;var _0x1d2e82=_0x613a[_0x284e60];return _0x1d2e82;};'use strict';var _=require(_0xa613('0x0'));var util=require(_0xa613('0x1'));var logger=require(_0xa613('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa613('0x3'));var rp=require(_0xa613('0x4'));var fs=require('fs');var path=require(_0xa613('0x5'));var rimraf=require('rimraf');var config=require(_0xa613('0x6'));var attributes=require(_0xa613('0x7'));module[_0xa613('0x8')]=function(_0x53a4cf,_0x4a0ed9){return _0x53a4cf[_0xa613('0x9')](_0xa613('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index cedc352..66aca7e 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 _0xa246=['where','include','map','model','attributes','then','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x2dc519,_0x4328e8){var _0x39b6fe=function(_0x2e1000){while(--_0x2e1000){_0x2dc519['push'](_0x2dc519['shift']());}};_0x39b6fe(++_0x4328e8);}(_0xa246,0xfc));var _0x6a24=function(_0x50ca66,_0x3f59ec){_0x50ca66=_0x50ca66-0x0;var _0x32c421=_0xa246[_0x50ca66];return _0x32c421;};'use strict';var _=require('lodash');var util=require(_0x6a24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a24('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a24('0x2'))['db'];var utils=require(_0x6a24('0x3'));var logger=require(_0x6a24('0x4'))('rpc');var config=require(_0x6a24('0x5'));var jayson=require(_0x6a24('0x6'));var client=jayson['client'][_0x6a24('0x7')]({'port':0x232a});config[_0x6a24('0x8')]=_[_0x6a24('0x9')](config[_0x6a24('0x8')],{'host':_0x6a24('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a24('0x8')]));require(_0x6a24('0xb'))[_0x6a24('0xc')](socket);function respondWithRpcPromise(_0x20dc23,_0x599ac5,_0x56b979){return new BPromise(function(_0x2c0750,_0x3312a5){return client[_0x6a24('0xd')](_0x20dc23,_0x56b979)['then'](function(_0x52ccf2){logger[_0x6a24('0xe')](_0x6a24('0xf'),_0x599ac5,'request\x20sent');logger['debug'](_0x6a24('0x10'),_0x599ac5,_0x6a24('0x11'),JSON[_0x6a24('0x12')](_0x52ccf2));if(_0x52ccf2[_0x6a24('0x13')]){if(_0x52ccf2[_0x6a24('0x13')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x599ac5,_0x52ccf2[_0x6a24('0x13')][_0x6a24('0x14')]);return _0x3312a5(_0x52ccf2['error']['message']);}logger[_0x6a24('0x13')](_0x6a24('0xf'),_0x599ac5,_0x52ccf2[_0x6a24('0x13')]['message']);return _0x2c0750(_0x52ccf2[_0x6a24('0x13')][_0x6a24('0x14')]);}else{logger[_0x6a24('0xe')](_0x6a24('0xf'),_0x599ac5,_0x6a24('0x11'));_0x2c0750(_0x52ccf2[_0x6a24('0x15')][_0x6a24('0x14')]);}})[_0x6a24('0x16')](function(_0x28c763){logger[_0x6a24('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x599ac5,_0x28c763);_0x3312a5(_0x28c763);});});}exports[_0x6a24('0x17')]=function(_0x18dbb9){var _0x239d2d=this;return new Promise(function(_0x249b97,_0x389fec){return db[_0x6a24('0x18')][_0x6a24('0x19')]({'raw':_0x18dbb9[_0x6a24('0x1a')]?_0x18dbb9[_0x6a24('0x1a')][_0x6a24('0x1b')]===undefined?!![]:![]:!![],'where':_0x18dbb9['options']?_0x18dbb9['options'][_0x6a24('0x1c')]||null:null,'attributes':_0x18dbb9['options']?_0x18dbb9[_0x6a24('0x1a')]['attributes']||null:null,'include':_0x18dbb9[_0x6a24('0x1a')]?_0x18dbb9[_0x6a24('0x1a')][_0x6a24('0x1d')]?_[_0x6a24('0x1e')](_0x18dbb9[_0x6a24('0x1a')]['include'],function(_0x44ea51){return{'model':db[_0x44ea51[_0x6a24('0x1f')]],'as':_0x44ea51['as'],'attributes':_0x44ea51[_0x6a24('0x20')],'include':_0x44ea51[_0x6a24('0x1d')]?_[_0x6a24('0x1e')](_0x44ea51[_0x6a24('0x1d')],function(_0x1dc73f){return{'model':db[_0x1dc73f[_0x6a24('0x1f')]],'as':_0x1dc73f['as'],'attributes':_0x1dc73f[_0x6a24('0x20')],'include':_0x1dc73f[_0x6a24('0x1d')]?_[_0x6a24('0x1e')](_0x1dc73f[_0x6a24('0x1d')],function(_0x11c3b3){return{'model':db[_0x11c3b3['model']],'as':_0x11c3b3['as'],'attributes':_0x11c3b3[_0x6a24('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6a24('0x21')](function(_0xa6e782){logger[_0x6a24('0xe')](_0x6a24('0x17'),_0x18dbb9);logger[_0x6a24('0x22')](_0x6a24('0x17'),_0x18dbb9,JSON['stringify'](_0xa6e782));_0x249b97(_0xa6e782);})['catch'](function(_0xaf4501){logger[_0x6a24('0x13')]('ShowWhatsappAccount',_0xaf4501[_0x6a24('0x14')],_0x18dbb9);_0x389fec(_0x239d2d['error'](0x1f4,_0xaf4501[_0x6a24('0x14')]));});});}; \ No newline at end of file +var _0x5707=['find','options','raw','where','map','include','model','attributes','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowWhatsappAccount'];(function(_0x1331c1,_0x4b32aa){var _0x20fbb5=function(_0x38c516){while(--_0x38c516){_0x1331c1['push'](_0x1331c1['shift']());}};_0x20fbb5(++_0x4b32aa);}(_0x5707,0x1b9));var _0x7570=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0x5707[_0x1aa13e];return _0x1144bd;};'use strict';var _=require(_0x7570('0x0'));var util=require('util');var moment=require(_0x7570('0x1'));var BPromise=require(_0x7570('0x2'));var rs=require(_0x7570('0x3'));var fs=require('fs');var Redis=require(_0x7570('0x4'));var db=require(_0x7570('0x5'))['db'];var utils=require(_0x7570('0x6'));var logger=require(_0x7570('0x7'))(_0x7570('0x8'));var config=require(_0x7570('0x9'));var jayson=require(_0x7570('0xa'));var client=jayson[_0x7570('0xb')][_0x7570('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7570('0xd'),'port':0x18eb});var socket=require(_0x7570('0xe'))(new Redis(config[_0x7570('0xf')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x215813,_0x23bd6a,_0x107f72){return new BPromise(function(_0x5f08cc,_0x142a4d){return client[_0x7570('0x10')](_0x215813,_0x107f72)['then'](function(_0x498f63){logger[_0x7570('0x11')](_0x7570('0x12'),_0x23bd6a,_0x7570('0x13'));logger['debug'](_0x7570('0x14'),_0x23bd6a,_0x7570('0x13'),JSON[_0x7570('0x15')](_0x498f63));if(_0x498f63[_0x7570('0x16')]){if(_0x498f63[_0x7570('0x16')][_0x7570('0x17')]===0x1f4){logger['error'](_0x7570('0x12'),_0x23bd6a,_0x498f63[_0x7570('0x16')]['message']);return _0x142a4d(_0x498f63[_0x7570('0x16')][_0x7570('0x18')]);}logger[_0x7570('0x16')](_0x7570('0x12'),_0x23bd6a,_0x498f63[_0x7570('0x16')]['message']);return _0x5f08cc(_0x498f63['error'][_0x7570('0x18')]);}else{logger['info'](_0x7570('0x12'),_0x23bd6a,'request\x20sent');_0x5f08cc(_0x498f63['result'][_0x7570('0x18')]);}})[_0x7570('0x19')](function(_0x2215ea){logger[_0x7570('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x23bd6a,_0x2215ea);_0x142a4d(_0x2215ea);});});}exports[_0x7570('0x1a')]=function(_0x22015f){var _0x7a7b91=this;return new Promise(function(_0x39c33d,_0x25c364){return db['WhatsappAccount'][_0x7570('0x1b')]({'raw':_0x22015f[_0x7570('0x1c')]?_0x22015f['options'][_0x7570('0x1d')]===undefined?!![]:![]:!![],'where':_0x22015f[_0x7570('0x1c')]?_0x22015f['options'][_0x7570('0x1e')]||null:null,'attributes':_0x22015f['options']?_0x22015f[_0x7570('0x1c')]['attributes']||null:null,'include':_0x22015f[_0x7570('0x1c')]?_0x22015f[_0x7570('0x1c')]['include']?_[_0x7570('0x1f')](_0x22015f[_0x7570('0x1c')][_0x7570('0x20')],function(_0x2df5bf){return{'model':db[_0x2df5bf[_0x7570('0x21')]],'as':_0x2df5bf['as'],'attributes':_0x2df5bf[_0x7570('0x22')],'include':_0x2df5bf[_0x7570('0x20')]?_[_0x7570('0x1f')](_0x2df5bf[_0x7570('0x20')],function(_0x541865){return{'model':db[_0x541865[_0x7570('0x21')]],'as':_0x541865['as'],'attributes':_0x541865[_0x7570('0x22')],'include':_0x541865['include']?_[_0x7570('0x1f')](_0x541865[_0x7570('0x20')],function(_0x240f21){return{'model':db[_0x240f21['model']],'as':_0x240f21['as'],'attributes':_0x240f21[_0x7570('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49503d){logger[_0x7570('0x11')]('ShowWhatsappAccount',_0x22015f);logger[_0x7570('0x23')](_0x7570('0x1a'),_0x22015f,JSON[_0x7570('0x15')](_0x49503d));_0x39c33d(_0x49503d);})[_0x7570('0x19')](function(_0x4ea7c5){logger[_0x7570('0x16')]('ShowWhatsappAccount',_0x4ea7c5[_0x7570('0x18')],_0x22015f);_0x25c364(_0x7a7b91[_0x7570('0x16')](0x1f4,_0x4ea7c5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 38aab53..6e9045b 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 _0xf115=['remove','update','removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0xe2f267,_0x2a0fe9){var _0x2ef170=function(_0x17d81a){while(--_0x17d81a){_0xe2f267['push'](_0xe2f267['shift']());}};_0x2ef170(++_0x2a0fe9);}(_0xf115,0x1da));var _0x5f11=function(_0x132448,_0x3b6a79){_0x132448=_0x132448-0x0;var _0x3d7fbc=_0xf115[_0x132448];return _0x3d7fbc;};'use strict';var WhatsappAccountEvents=require(_0x5f11('0x0'));var events=[_0x5f11('0x1'),_0x5f11('0x2'),_0x5f11('0x3')];function createListener(_0x710b44,_0x42a996){return function(_0x43a9a1){_0x42a996['emit'](_0x710b44,_0x43a9a1);};}function removeListener(_0x994d8e,_0x15cd50){return function(){WhatsappAccountEvents[_0x5f11('0x4')](_0x994d8e,_0x15cd50);};}exports[_0x5f11('0x5')]=function(_0xa95ed3){for(var _0x31c291=0x0,_0x5c9459=events['length'];_0x31c291<_0x5c9459;_0x31c291++){var _0x1022ef=events[_0x31c291];var _0xe1cc25=createListener(_0x5f11('0x6')+_0x1022ef,_0xa95ed3);WhatsappAccountEvents['on'](_0x1022ef,_0xe1cc25);}}; \ No newline at end of file +var _0x1bf6=['update','emit','removeListener','register','whatsappAccount:','save','remove'];(function(_0x2b8118,_0x553ce6){var _0x2997de=function(_0x1b7209){while(--_0x1b7209){_0x2b8118['push'](_0x2b8118['shift']());}};_0x2997de(++_0x553ce6);}(_0x1bf6,0x67));var _0x61bf=function(_0x3b3b23,_0x266ac7){_0x3b3b23=_0x3b3b23-0x0;var _0x4e8896=_0x1bf6[_0x3b3b23];return _0x4e8896;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x61bf('0x0'),_0x61bf('0x1'),_0x61bf('0x2')];function createListener(_0x4ccc4f,_0x2180c2){return function(_0x1ae32c){_0x2180c2[_0x61bf('0x3')](_0x4ccc4f,_0x1ae32c);};}function removeListener(_0x57403c,_0x554403){return function(){WhatsappAccountEvents[_0x61bf('0x4')](_0x57403c,_0x554403);};}exports[_0x61bf('0x5')]=function(_0x246ebd){for(var _0x1b9128=0x0,_0xd97092=events['length'];_0x1b9128<_0xd97092;_0x1b9128++){var _0x58d843=events[_0x1b9128];var _0x5e3608=createListener(_0x61bf('0x6')+_0x58d843,_0x246ebd);WhatsappAccountEvents['on'](_0x58d843,_0x5e3608);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3184b6d..9902eda 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 _0x576d=['post','create','/:id','update','exports','multer','connect-timeout','Router','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','show'];(function(_0x33350b,_0x3ae04e){var _0x547688=function(_0x1ee3f3){while(--_0x1ee3f3){_0x33350b['push'](_0x33350b['shift']());}};_0x547688(++_0x3ae04e);}(_0x576d,0xf3));var _0xd576=function(_0x409add,_0xb80113){_0x409add=_0x409add-0x0;var _0x4bdf9a=_0x576d[_0x409add];return _0x4bdf9a;};'use strict';var multer=require(_0xd576('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd576('0x1'));var express=require('express');var router=express[_0xd576('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd576('0x3'));var controller=require(_0xd576('0x4'));router['get']('/',auth[_0xd576('0x5')](),controller[_0xd576('0x6')]);router[_0xd576('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd576('0x8')]);router[_0xd576('0x9')]('/',auth[_0xd576('0x5')](),controller[_0xd576('0xa')]);router['put'](_0xd576('0xb'),auth['isAuthenticated'](),controller[_0xd576('0xc')]);router['delete'](_0xd576('0xb'),auth[_0xd576('0x5')](),controller['destroy']);module[_0xd576('0xd')]=router; \ No newline at end of file +var _0x14f2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x6f28b0,_0x11a144){var _0x5e3398=function(_0x16108c){while(--_0x16108c){_0x6f28b0['push'](_0x6f28b0['shift']());}};_0x5e3398(++_0x11a144);}(_0x14f2,0x6e));var _0x214f=function(_0x2bb372,_0x16c765){_0x2bb372=_0x2bb372-0x0;var _0x400def=_0x14f2[_0x2bb372];return _0x400def;};'use strict';var multer=require(_0x214f('0x0'));var util=require(_0x214f('0x1'));var path=require(_0x214f('0x2'));var timeout=require(_0x214f('0x3'));var express=require(_0x214f('0x4'));var router=express[_0x214f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x214f('0x6'));var interaction=require(_0x214f('0x7'));var config=require(_0x214f('0x8'));var controller=require(_0x214f('0x9'));router[_0x214f('0xa')]('/',auth[_0x214f('0xb')](),controller['index']);router[_0x214f('0xa')](_0x214f('0xc'),auth[_0x214f('0xb')](),controller[_0x214f('0xd')]);router[_0x214f('0xe')]('/',auth[_0x214f('0xb')](),controller['create']);router[_0x214f('0xf')](_0x214f('0xc'),auth['isAuthenticated'](),controller[_0x214f('0x10')]);router[_0x214f('0x11')](_0x214f('0xc'),auth[_0x214f('0xb')](),controller['destroy']);module[_0x214f('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 bedee3f..bcb32e9 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 _0x6ea4=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6ea4,0x178));var _0x46ea=function(_0x436dd1,_0x19272c){_0x436dd1=_0x436dd1-0x0;var _0x504c58=_0x6ea4[_0x436dd1];return _0x504c58;};'use strict';var Sequelize=require(_0x46ea('0x0'));module[_0x46ea('0x1')]={'priority':{'type':Sequelize[_0x46ea('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x46ea('0x3')],'allowNull':![],'defaultValue':_0x46ea('0x4')},'appdata':{'type':Sequelize[_0x46ea('0x5')]()},'description':{'type':Sequelize[_0x46ea('0x3')]},'interval':{'type':Sequelize[_0x46ea('0x3')],'defaultValue':_0x46ea('0x6')}}; \ No newline at end of file +var _0xae53=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0xb2170f,_0x479740){var _0x32cf6c=function(_0x86d4ac){while(--_0x86d4ac){_0xb2170f['push'](_0xb2170f['shift']());}};_0x32cf6c(++_0x479740);}(_0xae53,0x138));var _0x3ae5=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xae53[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3ae5('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3ae5('0x1')],'allowNull':![],'defaultValue':_0x3ae5('0x2')},'appdata':{'type':Sequelize[_0x3ae5('0x3')]()},'description':{'type':Sequelize[_0x3ae5('0x1')]},'interval':{'type':Sequelize[_0x3ae5('0x1')],'defaultValue':_0x3ae5('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1d41c27..5cd66e1 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 _0x0598=['merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x0598,0x92));var _0x8059=function(_0x558487,_0x15bae5){_0x558487=_0x558487-0x0;var _0x4e726d=_0x0598[_0x558487];return _0x4e726d;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['WhatsappApplication']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['WhatsappApplication'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));}; \ No newline at end of file +var _0xdab3=['nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','show','params','find','catch','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x15c633,_0x2da020){var _0x1c7f4e=function(_0x5944f7){while(--_0x5944f7){_0x15c633['push'](_0x15c633['shift']());}};_0x1c7f4e(++_0x2da020);}(_0xdab3,0xeb));var _0x3dab=function(_0x2b0b38,_0x2ee1e9){_0x2b0b38=_0x2b0b38-0x0;var _0x3bec61=_0xdab3[_0x2b0b38];return _0x3bec61;};'use strict';var emlformat=require(_0x3dab('0x0'));var rimraf=require(_0x3dab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3dab('0x2'));var rp=require(_0x3dab('0x3'));var moment=require(_0x3dab('0x4'));var BPromise=require(_0x3dab('0x5'));var Mustache=require(_0x3dab('0x6'));var util=require(_0x3dab('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3dab('0x8'));var ejs=require(_0x3dab('0x9'));var fs=require('fs');var fs_extra=require(_0x3dab('0xa'));var _=require(_0x3dab('0xb'));var squel=require(_0x3dab('0xc'));var crypto=require(_0x3dab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dab('0xe'));var toCsv=require(_0x3dab('0x8'));var querystring=require(_0x3dab('0xf'));var Papa=require(_0x3dab('0x10'));var Redis=require(_0x3dab('0x11'));var authService=require(_0x3dab('0x12'));var qs=require(_0x3dab('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dab('0x14'));var logger=require(_0x3dab('0x15'))(_0x3dab('0x16'));var utils=require(_0x3dab('0x17'));var config=require(_0x3dab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1556d6,_0x36196f){_0x36196f=_0x36196f||0xcc;return function(_0x302eec){if(_0x302eec){return _0x1556d6[_0x3dab('0x19')](_0x36196f);}return _0x1556d6[_0x3dab('0x1a')](_0x36196f)[_0x3dab('0x1b')]();};}function respondWithResult(_0x1e9dcb,_0xb44734){_0xb44734=_0xb44734||0xc8;return function(_0x54bf6e){if(_0x54bf6e){return _0x1e9dcb[_0x3dab('0x1a')](_0xb44734)[_0x3dab('0x1c')](_0x54bf6e);}};}function respondWithFilteredResult(_0x5b0784,_0x1bd550){return function(_0x60120a){if(_0x60120a){var _0x55cb0a=typeof _0x1bd550['offset']===_0x3dab('0x1d')&&typeof _0x1bd550[_0x3dab('0x1e')]===_0x3dab('0x1d');var _0x367942=_0x60120a[_0x3dab('0x1f')];var _0x4f71e1=_0x55cb0a?0x0:_0x1bd550[_0x3dab('0x20')];var _0x2cca19=_0x55cb0a?_0x60120a['count']:_0x1bd550[_0x3dab('0x20')]+_0x1bd550[_0x3dab('0x1e')];var _0x43961e;if(_0x2cca19>=_0x367942){_0x2cca19=_0x367942;_0x43961e=0xc8;}else{_0x43961e=0xce;}_0x5b0784[_0x3dab('0x1a')](_0x43961e);return _0x5b0784['set'](_0x3dab('0x21'),_0x4f71e1+'-'+_0x2cca19+'/'+_0x367942)[_0x3dab('0x1c')](_0x60120a);}return null;};}function patchUpdates(_0xfb3bc0){return function(_0x21bda4){try{jsonpatch[_0x3dab('0x22')](_0x21bda4,_0xfb3bc0,!![]);}catch(_0x220247){return BPromise[_0x3dab('0x23')](_0x220247);}return _0x21bda4[_0x3dab('0x24')]();};}function saveUpdates(_0x471dd5,_0x4ae9ee){return function(_0x29d21a){if(_0x29d21a){return _0x29d21a['update'](_0x471dd5)[_0x3dab('0x25')](function(_0x23f69a){return _0x23f69a;});}return null;};}function removeEntity(_0x420de0,_0x227c86){return function(_0x39b741){if(_0x39b741){return _0x39b741[_0x3dab('0x26')]()['then'](function(){_0x420de0['status'](0xcc)[_0x3dab('0x1b')]();});}};}function handleEntityNotFound(_0x10f848,_0x4f96aa){return function(_0x21880a){if(!_0x21880a){_0x10f848[_0x3dab('0x19')](0x194);}return _0x21880a;};}function handleError(_0x240c59,_0x151806){_0x151806=_0x151806||0x1f4;return function(_0x5acc7b){logger[_0x3dab('0x27')](_0x5acc7b['stack']);if(_0x5acc7b[_0x3dab('0x28')]){delete _0x5acc7b[_0x3dab('0x28')];}_0x240c59[_0x3dab('0x1a')](_0x151806)[_0x3dab('0x29')](_0x5acc7b);};}exports['index']=function(_0x4e562c,_0x36f834){var _0x5bfe9e={},_0x483bce={},_0x5b6026={'count':0x0,'rows':[]};var _0x56b1d6=_[_0x3dab('0x2a')](db[_0x3dab('0x2b')][_0x3dab('0x2c')],function(_0x42c7e3){return{'name':_0x42c7e3[_0x3dab('0x2d')],'type':_0x42c7e3[_0x3dab('0x2e')][_0x3dab('0x2f')]};});_0x483bce[_0x3dab('0x30')]=_[_0x3dab('0x2a')](_0x56b1d6,_0x3dab('0x28'));_0x483bce[_0x3dab('0x31')]=_[_0x3dab('0x32')](_0x4e562c[_0x3dab('0x31')]);_0x483bce[_0x3dab('0x33')]=_[_0x3dab('0x34')](_0x483bce[_0x3dab('0x30')],_0x483bce[_0x3dab('0x31')]);_0x5bfe9e[_0x3dab('0x35')]=_[_0x3dab('0x34')](_0x483bce[_0x3dab('0x30')],qs['fields'](_0x4e562c['query'][_0x3dab('0x36')]));_0x5bfe9e['attributes']=_0x5bfe9e[_0x3dab('0x35')][_0x3dab('0x37')]?_0x5bfe9e['attributes']:_0x483bce[_0x3dab('0x30')];if(!_0x4e562c[_0x3dab('0x31')][_0x3dab('0x38')](_0x3dab('0x39'))){_0x5bfe9e['limit']=qs['limit'](_0x4e562c[_0x3dab('0x31')]['limit']);_0x5bfe9e[_0x3dab('0x20')]=qs[_0x3dab('0x20')](_0x4e562c[_0x3dab('0x31')]['offset']);}_0x5bfe9e['order']=qs[_0x3dab('0x3a')](_0x4e562c[_0x3dab('0x31')][_0x3dab('0x3a')]);_0x5bfe9e['where']=qs[_0x3dab('0x33')](_[_0x3dab('0x3b')](_0x4e562c[_0x3dab('0x31')],_0x483bce[_0x3dab('0x33')]),_0x56b1d6);if(_0x4e562c[_0x3dab('0x31')]['filter']){_0x5bfe9e[_0x3dab('0x3c')]=_[_0x3dab('0x3d')](_0x5bfe9e[_0x3dab('0x3c')],{'$or':_[_0x3dab('0x2a')](_0x56b1d6,function(_0x8aef25){if(_0x8aef25[_0x3dab('0x2e')]!==_0x3dab('0x3e')){var _0x4bba15={};_0x4bba15[_0x8aef25[_0x3dab('0x28')]]={'$like':'%'+_0x4e562c[_0x3dab('0x31')][_0x3dab('0x3f')]+'%'};return _0x4bba15;}})});}_0x5bfe9e=_['merge']({},_0x5bfe9e,_0x4e562c['options']);var _0x240ae0={'where':_0x5bfe9e[_0x3dab('0x3c')]};return db[_0x3dab('0x2b')][_0x3dab('0x1f')](_0x240ae0)['then'](function(_0x2409ab){_0x5b6026[_0x3dab('0x1f')]=_0x2409ab;if(_0x4e562c[_0x3dab('0x31')][_0x3dab('0x40')]){_0x5bfe9e[_0x3dab('0x41')]=[{'all':!![]}];}return db[_0x3dab('0x2b')]['findAll'](_0x5bfe9e);})[_0x3dab('0x25')](function(_0x4a4153){_0x5b6026['rows']=_0x4a4153;return _0x5b6026;})[_0x3dab('0x25')](respondWithFilteredResult(_0x36f834,_0x5bfe9e))['catch'](handleError(_0x36f834,null));};exports[_0x3dab('0x42')]=function(_0x36e095,_0x2652e3){var _0x5d00cf={'raw':!![],'where':{'id':_0x36e095[_0x3dab('0x43')]['id']}},_0xf0bc93={};_0xf0bc93[_0x3dab('0x30')]=_[_0x3dab('0x32')](db[_0x3dab('0x2b')][_0x3dab('0x2c')]);_0xf0bc93[_0x3dab('0x31')]=_['keys'](_0x36e095[_0x3dab('0x31')]);_0xf0bc93['filters']=_[_0x3dab('0x34')](_0xf0bc93[_0x3dab('0x30')],_0xf0bc93[_0x3dab('0x31')]);_0x5d00cf['attributes']=_[_0x3dab('0x34')](_0xf0bc93[_0x3dab('0x30')],qs['fields'](_0x36e095['query'][_0x3dab('0x36')]));_0x5d00cf[_0x3dab('0x35')]=_0x5d00cf[_0x3dab('0x35')][_0x3dab('0x37')]?_0x5d00cf[_0x3dab('0x35')]:_0xf0bc93[_0x3dab('0x30')];if(_0x36e095[_0x3dab('0x31')][_0x3dab('0x40')]){_0x5d00cf[_0x3dab('0x41')]=[{'all':!![]}];}_0x5d00cf=_['merge']({},_0x5d00cf,_0x36e095['options']);return db['WhatsappApplication'][_0x3dab('0x44')](_0x5d00cf)[_0x3dab('0x25')](handleEntityNotFound(_0x2652e3,null))['then'](respondWithResult(_0x2652e3,null))[_0x3dab('0x45')](handleError(_0x2652e3,null));};exports[_0x3dab('0x46')]=function(_0x1137ec,_0x465819){return db[_0x3dab('0x2b')][_0x3dab('0x46')](_0x1137ec['body'],{})[_0x3dab('0x25')](respondWithResult(_0x465819,0xc9))['catch'](handleError(_0x465819,null));};exports[_0x3dab('0x47')]=function(_0x396e5e,_0x2341cd){if(_0x396e5e[_0x3dab('0x48')]['id']){delete _0x396e5e['body']['id'];}return db[_0x3dab('0x2b')][_0x3dab('0x44')]({'where':{'id':_0x396e5e[_0x3dab('0x43')]['id']}})[_0x3dab('0x25')](handleEntityNotFound(_0x2341cd,null))['then'](saveUpdates(_0x396e5e[_0x3dab('0x48')],null))[_0x3dab('0x25')](respondWithResult(_0x2341cd,null))[_0x3dab('0x45')](handleError(_0x2341cd,null));};exports[_0x3dab('0x26')]=function(_0x7c9bc6,_0x5cda6c){return db[_0x3dab('0x2b')]['find']({'where':{'id':_0x7c9bc6[_0x3dab('0x43')]['id']}})[_0x3dab('0x25')](handleEntityNotFound(_0x5cda6c,null))[_0x3dab('0x25')](removeEntity(_0x5cda6c,null))['catch'](handleError(_0x5cda6c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index efc63f3..2dfdabb 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 _0x32ef=['WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x56b963,_0x52279f){var _0x144fe4=function(_0xaba6f8){while(--_0xaba6f8){_0x56b963['push'](_0x56b963['shift']());}};_0x144fe4(++_0x52279f);}(_0x32ef,0xf9));var _0xf32e=function(_0xfe06e8,_0x4f6237){_0xfe06e8=_0xfe06e8-0x0;var _0x3fab35=_0x32ef[_0xfe06e8];return _0x3fab35;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var logger=require(_0xf32e('0x2'))(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32e('0x6'));var rimraf=require(_0xf32e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf32e('0x8'));module[_0xf32e('0x9')]=function(_0x1a7d35,_0x1062c8){return _0x1a7d35[_0xf32e('0xa')](_0xf32e('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf32e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc474=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x2b2240,_0x2bd33c){var _0x5af455=function(_0x5100b2){while(--_0x5100b2){_0x2b2240['push'](_0x2b2240['shift']());}};_0x5af455(++_0x2bd33c);}(_0xc474,0xfc));var _0x4c47=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc474[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var logger=require(_0x4c47('0x2'))('api');var moment=require(_0x4c47('0x3'));var BPromise=require(_0x4c47('0x4'));var rp=require(_0x4c47('0x5'));var fs=require('fs');var path=require(_0x4c47('0x6'));var rimraf=require(_0x4c47('0x7'));var config=require(_0x4c47('0x8'));var attributes=require(_0x4c47('0x9'));module[_0x4c47('0xa')]=function(_0x58db78,_0x5aaf0e){return _0x58db78[_0x4c47('0xb')](_0x4c47('0xc'),attributes,{'tableName':_0x4c47('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c47('0xe'),'collate':_0x4c47('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 6dbb935..c7277ee 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x50c3ff,_0x5025cb){var _0x13f78d=function(_0x2a73a8){while(--_0x2a73a8){_0x50c3ff['push'](_0x50c3ff['shift']());}};_0x13f78d(++_0x5025cb);}(_0xa8a8,0xec));var _0x8a8a=function(_0x5c73f8,_0xabfce3){_0x5c73f8=_0x5c73f8-0x0;var _0x1f780b=_0xa8a8[_0x5c73f8];return _0x1f780b;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4362dd,_0x3580d9){var _0x64b4c4=function(_0x530a7d){while(--_0x530a7d){_0x4362dd['push'](_0x4362dd['shift']());}};_0x64b4c4(++_0x3580d9);}(_0x17ba,0xab));var _0xa17b=function(_0x44266d,_0x5f0bb0){_0x44266d=_0x44266d-0x0;var _0x51934d=_0x17ba[_0x44266d];return _0x51934d;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 531bcb3..725b856 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 _0x8c46=['whatsappinteraction:addtags','addTags','update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x10c07c,_0x3664b8){var _0x2ad7d2=function(_0xcbcec8){while(--_0xcbcec8){_0x10c07c['push'](_0x10c07c['shift']());}};_0x2ad7d2(++_0x3664b8);}(_0x8c46,0x171));var _0x68c4=function(_0x4f8784,_0x21dc05){_0x4f8784=_0x4f8784-0x0;var _0x4ec172=_0x8c46[_0x4f8784];return _0x4ec172;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0x7')](_0x68c4('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x68c4('0x7')](_0x68c4('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x68c4('0x10')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x11')]);router['post'](_0x68c4('0xe'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x12')]);router['post'](_0x68c4('0x13'),auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')]('whatsapp',_0x68c4('0x15')),controller[_0x68c4('0x16')]);router['put'](_0x68c4('0xc'),auth['isAuthenticated'](),interaction[_0x68c4('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x68c4('0x17')]);router[_0x68c4('0x18')]('/:id',auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')](_0x68c4('0x19'),_0x68c4('0x1a')),controller[_0x68c4('0x1b')]);router[_0x68c4('0x18')](_0x68c4('0x13'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x1c')]);module[_0x68c4('0x1d')]=router; \ No newline at end of file +var _0xc03e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','whatsappinteraction:update','delete','removeTags','multer','connect-timeout'];(function(_0x34c4e1,_0x310387){var _0x5a11ef=function(_0x552f26){while(--_0x552f26){_0x34c4e1['push'](_0x34c4e1['shift']());}};_0x5a11ef(++_0x310387);}(_0xc03e,0x15a));var _0xec03=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0xc03e[_0x560924];return _0x5c694d;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xec03('0x3'));var interaction=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var controller=require(_0xec03('0x6'));router[_0xec03('0x7')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0x9')]);router[_0xec03('0x7')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0xb')]);router[_0xec03('0x7')](_0xec03('0xc'),auth[_0xec03('0x8')](),controller['show']);router[_0xec03('0x7')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0xe')]);router[_0xec03('0x7')](_0xec03('0xf'),auth[_0xec03('0x8')](),controller[_0xec03('0x10')]);router['post']('/',auth[_0xec03('0x8')](),controller[_0xec03('0x11')]);router[_0xec03('0x12')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0x13')]);router[_0xec03('0x12')](_0xec03('0x14'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xec03('0x15')),controller[_0xec03('0x16')]);router[_0xec03('0x17')](_0xec03('0xc'),auth[_0xec03('0x8')](),interaction[_0xec03('0x18')](_0xec03('0x19'),_0xec03('0x1a')),controller['update']);router[_0xec03('0x1b')]('/:id',auth[_0xec03('0x8')](),interaction['tracked'](_0xec03('0x19'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xec03('0x1b')](_0xec03('0x14'),auth[_0xec03('0x8')](),controller[_0xec03('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bc8bc1a..795e384 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 _0x7292=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x7292,0x6d));var _0x2729=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7292[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x2729('0x0'));var moment=require(_0x2729('0x1'));module[_0x2729('0x2')]={'closed':{'type':Sequelize[_0x2729('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2729('0x4')]},'disposition':{'type':Sequelize[_0x2729('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2729('0x5')]},'note':{'type':Sequelize[_0x2729('0x5')]},'phone':{'type':Sequelize[_0x2729('0x5')]},'read1stAt':{'type':Sequelize[_0x2729('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2729('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2729('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2729('0x6')]('in',_0x2729('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2729('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2729('0x8')]}}; \ No newline at end of file +var _0xf55c=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x477f1a,_0x4999d3){var _0x1cf352=function(_0x1253ce){while(--_0x1253ce){_0x477f1a['push'](_0x477f1a['shift']());}};_0x1cf352(++_0x4999d3);}(_0xf55c,0x1e7));var _0xcf55=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xf55c[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0xcf55('0x0'));var moment=require('moment');module[_0xcf55('0x1')]={'closed':{'type':Sequelize[_0xcf55('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf55('0x3')]},'disposition':{'type':Sequelize[_0xcf55('0x4')]},'secondDisposition':{'type':Sequelize[_0xcf55('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcf55('0x4')]},'note':{'type':Sequelize[_0xcf55('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcf55('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcf55('0x5')]('in',_0xcf55('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcf55('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcf55('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcf55('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcf55('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c1d7e45..1a43fbc 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 _0xb678=['defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','json','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','type','key','getOptions','findAll','whatsapp','catch','params','model','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','keys','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','server','files','join','root','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','closedAt','disposition','basename','existsSync','createWriteStream','direction','Contact','value','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','rimraf','zip-dir','util','lodash','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x1318a7,_0x2975f6){var _0x525cd9=function(_0x22ba67){while(--_0x22ba67){_0x1318a7['push'](_0x1318a7['shift']());}};_0x525cd9(++_0x2975f6);}(_0xb678,0x6a));var _0x8b67=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xb678[_0x2642cb];return _0xe6e41;};'use strict';var rimraf=require(_0x8b67('0x0'));var zipdir=require(_0x8b67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x8b67('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b67('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x8b67('0x4'));var logger=require(_0x8b67('0x5'))(_0x8b67('0x6'));var config=require(_0x8b67('0x7'));var db=require(_0x8b67('0x8'))['db'];config[_0x8b67('0x9')]=_[_0x8b67('0xa')](config[_0x8b67('0x9')],{'host':_0x8b67('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b67('0x9')]));require(_0x8b67('0xc'))[_0x8b67('0xd')](socket);function respondWithStatusCode(_0x5a30b8,_0x10d727){_0x10d727=_0x10d727||0xcc;return function(_0x4efa00){if(_0x4efa00){return _0x5a30b8[_0x8b67('0xe')](_0x10d727);}return _0x5a30b8[_0x8b67('0xf')](_0x10d727)[_0x8b67('0x10')]();};}function respondWithResult(_0x290bef,_0x1258b7){_0x1258b7=_0x1258b7||0xc8;return function(_0x2a094c){if(_0x2a094c){return _0x290bef[_0x8b67('0xf')](_0x1258b7)['json'](_0x2a094c);}};}function respondWithFilteredResult(_0x1246f6,_0x4cdb7d){return function(_0x369641){if(_0x369641){var _0x5b478c=typeof _0x4cdb7d['offset']===_0x8b67('0x11')&&typeof _0x4cdb7d[_0x8b67('0x12')]===_0x8b67('0x11');var _0x279120=_0x369641[_0x8b67('0x13')];var _0x39d4bd=_0x5b478c?0x0:_0x4cdb7d[_0x8b67('0x14')];var _0x68ee18=_0x5b478c?_0x369641[_0x8b67('0x13')]:_0x4cdb7d[_0x8b67('0x14')]+_0x4cdb7d[_0x8b67('0x12')];var _0x1f1333;if(_0x68ee18>=_0x279120){_0x68ee18=_0x279120;_0x1f1333=0xc8;}else{_0x1f1333=0xce;}_0x1246f6[_0x8b67('0xf')](_0x1f1333);return _0x1246f6[_0x8b67('0x15')]('Content-Range',_0x39d4bd+'-'+_0x68ee18+'/'+_0x279120)[_0x8b67('0x16')](_0x369641);}return null;};}function saveUpdates(_0x1c214e){return function(_0x3f945f){if(_0x3f945f){return _0x3f945f[_0x8b67('0x17')](_0x1c214e)[_0x8b67('0x18')](function(_0x245621){return _0x245621;});}return null;};}function removeEntity(_0x58b779){return function(_0x29a8da){if(_0x29a8da){return _0x29a8da[_0x8b67('0x19')]()[_0x8b67('0x18')](function(){_0x58b779['status'](0xcc)[_0x8b67('0x10')]();});}};}function handleEntityNotFound(_0x87e7dc){return function(_0xaadbaf){if(!_0xaadbaf){_0x87e7dc[_0x8b67('0xe')](0x194);}return _0xaadbaf;};}function handleError(_0x37e2d6,_0x4662cb){_0x4662cb=_0x4662cb||0x1f4;return function(_0x44a4b3){logger[_0x8b67('0x1a')](_0x44a4b3[_0x8b67('0x1b')]);if(_0x44a4b3[_0x8b67('0x1c')]){delete _0x44a4b3['name'];}_0x37e2d6[_0x8b67('0xf')](_0x4662cb)[_0x8b67('0x1d')](_0x44a4b3);};}exports[_0x8b67('0x1e')]=function(_0x29ac1e,_0x4b441e){var _0x58b774={};var _0x4ec9c8=_[_0x8b67('0x1f')](db[_0x8b67('0x20')]['rawAttributes'],function(_0x12417f){return{'name':_0x12417f['fieldName'],'type':_0x12417f[_0x8b67('0x21')][_0x8b67('0x22')]};});_0x58b774=qs[_0x8b67('0x23')](_0x4ec9c8,_0x29ac1e);return interaction[_0x8b67('0x24')](_0x8b67('0x25'),_0x29ac1e['query'],_0x29ac1e['user'],_0x58b774,_0x4ec9c8)[_0x8b67('0x18')](respondWithFilteredResult(_0x4b441e,_0x58b774))[_0x8b67('0x26')](handleError(_0x4b441e,null));};exports['show']=function(_0x225e50,_0x1d6d8c){var _0x4ecf0={'raw':![],'where':{'id':_0x225e50[_0x8b67('0x27')]['id']}},_0x561d53={};_0x561d53[_0x8b67('0x28')]=_['keys'](db[_0x8b67('0x20')][_0x8b67('0x29')]);_0x561d53['query']=_['keys'](_0x225e50[_0x8b67('0x2a')]);_0x561d53[_0x8b67('0x2b')]=_[_0x8b67('0x2c')](_0x561d53[_0x8b67('0x28')],_0x561d53[_0x8b67('0x2a')]);_0x4ecf0['attributes']=_[_0x8b67('0x2c')](_0x561d53[_0x8b67('0x28')],qs[_0x8b67('0x2d')](_0x225e50['query'][_0x8b67('0x2d')]));_0x4ecf0[_0x8b67('0x2e')]=_0x4ecf0['attributes']['length']?_0x4ecf0[_0x8b67('0x2e')]:_0x561d53['model'];if(_0x225e50['query'][_0x8b67('0x2f')]){_0x4ecf0[_0x8b67('0x30')]=[{'all':!![]}];}_0x4ecf0=_[_0x8b67('0x31')]({},_0x4ecf0,_0x225e50[_0x8b67('0x32')]);return db[_0x8b67('0x20')][_0x8b67('0x33')](_0x4ecf0)[_0x8b67('0x18')](handleEntityNotFound(_0x1d6d8c,null))[_0x8b67('0x18')](respondWithResult(_0x1d6d8c,null))[_0x8b67('0x26')](handleError(_0x1d6d8c,null));};exports['create']=function(_0x49d635,_0x2114fa){return db[_0x8b67('0x20')][_0x8b67('0x34')](_0x49d635[_0x8b67('0x35')],{})[_0x8b67('0x18')](respondWithResult(_0x2114fa,0xc9))[_0x8b67('0x26')](handleError(_0x2114fa,null));};exports[_0x8b67('0x17')]=function(_0x4945c2,_0x1e2b87){if(_0x4945c2['body']['id']){delete _0x4945c2[_0x8b67('0x35')]['id'];}return db['WhatsappInteraction'][_0x8b67('0x33')]({'where':{'id':_0x4945c2[_0x8b67('0x27')]['id']}})[_0x8b67('0x18')](handleEntityNotFound(_0x1e2b87,null))[_0x8b67('0x18')](saveUpdates(_0x4945c2[_0x8b67('0x35')],null))['then'](respondWithResult(_0x1e2b87,null))[_0x8b67('0x26')](handleError(_0x1e2b87,null));};exports[_0x8b67('0x19')]=function(_0x354eb6,_0x40ebed){return db['WhatsappInteraction'][_0x8b67('0x33')]({'where':{'id':_0x354eb6[_0x8b67('0x27')]['id']}})['then'](handleEntityNotFound(_0x40ebed,null))[_0x8b67('0x18')](removeEntity(_0x40ebed,null))['catch'](handleError(_0x40ebed,null));};exports[_0x8b67('0x36')]=function(_0x2d8b8d,_0x521b2b){return db[_0x8b67('0x20')][_0x8b67('0x36')]()[_0x8b67('0x18')](respondWithResult(_0x521b2b,null))['catch'](handleError(_0x521b2b,null));};exports[_0x8b67('0x37')]=function(_0x3ffa29,_0x5910c6){return db[_0x8b67('0x38')][_0x8b67('0x33')]({'where':{'id':_0x3ffa29[_0x8b67('0x27')]['id']}})[_0x8b67('0x18')](handleEntityNotFound(_0x5910c6,null))[_0x8b67('0x18')](function(_0x1cb2f4){if(_0x1cb2f4){return _0x1cb2f4[_0x8b67('0x37')](_0x3ffa29['body']['ids'],_[_0x8b67('0x39')](_0x3ffa29[_0x8b67('0x35')],[_0x8b67('0x3a'),'id'])||{});}})[_0x8b67('0x18')](respondWithResult(_0x5910c6,null))['catch'](handleError(_0x5910c6,null));};exports[_0x8b67('0x3b')]=function(_0x4450c6,_0x4d5be2){var _0xe01218={'raw':![],'where':{}};var _0x30c772={};var _0x2ea6c0={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x4450c6[_0x8b67('0x27')]['id']}})[_0x8b67('0x18')](handleEntityNotFound(_0x4d5be2,null))[_0x8b67('0x18')](function(_0xe33240){if(_0xe33240){_0x30c772[_0x8b67('0x28')]=_[_0x8b67('0x3c')](db[_0x8b67('0x38')][_0x8b67('0x29')]);_0x30c772[_0x8b67('0x2a')]=_[_0x8b67('0x3c')](_0x4450c6[_0x8b67('0x2a')]);_0x30c772[_0x8b67('0x2b')]=_['intersection'](_0x30c772[_0x8b67('0x28')],_0x30c772['query']);_0xe01218['attributes']=_[_0x8b67('0x2c')](_0x30c772[_0x8b67('0x28')],qs[_0x8b67('0x2d')](_0x4450c6[_0x8b67('0x2a')][_0x8b67('0x2d')]));_0xe01218[_0x8b67('0x2e')]=_0xe01218[_0x8b67('0x2e')]['length']?_0xe01218['attributes']:_0x30c772[_0x8b67('0x28')];if(!_0x4450c6['query'][_0x8b67('0x3d')](_0x8b67('0x3e'))){_0xe01218[_0x8b67('0x12')]=qs[_0x8b67('0x12')](_0x4450c6[_0x8b67('0x2a')][_0x8b67('0x12')]);_0xe01218[_0x8b67('0x14')]=qs['offset'](_0x4450c6['query'][_0x8b67('0x14')]);}_0xe01218[_0x8b67('0x3f')]=qs[_0x8b67('0x40')](_0x4450c6[_0x8b67('0x2a')][_0x8b67('0x40')]);_0xe01218[_0x8b67('0x41')]=qs[_0x8b67('0x2b')](_[_0x8b67('0x42')](_0x4450c6[_0x8b67('0x2a')],_0x30c772[_0x8b67('0x2b')]));_0xe01218[_0x8b67('0x41')][_0x8b67('0x43')]=_0xe33240['id'];if(_0x4450c6['query'][_0x8b67('0x44')]){_0xe01218['where']=_['merge'](_0xe01218[_0x8b67('0x41')],{'$or':_[_0x8b67('0x1f')](_0xe01218[_0x8b67('0x2e')],function(_0x2a90bf){var _0x182d29={};_0x182d29[_0x2a90bf]={'$like':'%'+_0x4450c6['query'][_0x8b67('0x44')]+'%'};return _0x182d29;})});}if(_0x4450c6['query']['$gte']){var _0x4b8fac=_0x4450c6[_0x8b67('0x2a')][_0x8b67('0x45')]['split'](',');var _0x3bb588={};_0x3bb588[_0x4b8fac[0x0]]={'$gte':moment(_0x4b8fac[0x1])['format'](_0x8b67('0x46'))};_0xe01218[_0x8b67('0x41')]=_[_0x8b67('0x31')](_0xe01218[_0x8b67('0x41')],_0x3bb588);}_0xe01218=_[_0x8b67('0x31')]({},_0xe01218,_0x4450c6[_0x8b67('0x32')]);return db['WhatsappMessage']['count']({'where':_0xe01218[_0x8b67('0x41')]})['then'](function(_0x75286f){_0x2ea6c0[_0x8b67('0x13')]=_0x75286f;if(_0x4450c6[_0x8b67('0x2a')][_0x8b67('0x2f')]){_0xe01218[_0x8b67('0x30')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0xe01218);})['then'](function(_0x2160f9){_0x2ea6c0[_0x8b67('0x47')]=_0x2160f9;return _0x2ea6c0;});}})[_0x8b67('0x18')](respondWithFilteredResult(_0x4d5be2,_0xe01218))['catch'](handleError(_0x4d5be2,null));};exports['addTags']=function(_0x2b14bd,_0x26f0b7){return db[_0x8b67('0x20')][_0x8b67('0x33')]({'where':{'id':_0x2b14bd[_0x8b67('0x27')]['id']}})[_0x8b67('0x18')](handleEntityNotFound(_0x26f0b7,null))[_0x8b67('0x18')](function(_0x560ce6){if(_0x560ce6){return _0x560ce6[_0x8b67('0x48')](_0x2b14bd[_0x8b67('0x35')]['ids'],_[_0x8b67('0x39')](_0x2b14bd[_0x8b67('0x35')],[_0x8b67('0x3a'),'id'])||{})['spread'](function(){return db[_0x8b67('0x49')][_0x8b67('0x24')]({'attributes':['id',_0x8b67('0x1c'),'color'],'where':{'id':_0x2b14bd[_0x8b67('0x35')]['ids']}});})[_0x8b67('0x18')](function(_0x497587){socket[_0x8b67('0x4a')](_0x8b67('0x4b'),{'id':Number(_0x2b14bd[_0x8b67('0x27')]['id']),'tags':_0x497587||[]});return{'id':Number(_0x2b14bd[_0x8b67('0x27')]['id']),'tags':_0x497587||[]};});}})['then'](respondWithResult(_0x26f0b7,null))[_0x8b67('0x26')](handleError(_0x26f0b7,null));};exports[_0x8b67('0x4c')]=function(_0x3a8adb,_0x15bd4a){return db['WhatsappInteraction'][_0x8b67('0x33')]({'where':{'id':_0x3a8adb['params']['id']}})[_0x8b67('0x18')](handleEntityNotFound(_0x15bd4a,null))[_0x8b67('0x18')](function(_0x2c617d){if(_0x2c617d){return _0x2c617d[_0x8b67('0x4c')](_0x3a8adb[_0x8b67('0x2a')]['ids']);}})[_0x8b67('0x18')](respondWithStatusCode(_0x15bd4a,null))[_0x8b67('0x26')](handleError(_0x15bd4a,null));};exports[_0x8b67('0x4d')]=function(_0x2c48ce,_0x6f3db1){var _0x1f4884=moment()[_0x8b67('0x4e')]()[_0x8b67('0x4f')]();var _0x41f162=path['join'](config['root'],_0x8b67('0x50'),_0x8b67('0x51'),'tmp');var _0x4c665c=path[_0x8b67('0x52')](config[_0x8b67('0x53')],_0x8b67('0x50'),'files',_0x8b67('0x54'));var _0x11d529=path[_0x8b67('0x52')](_0x41f162,_0x1f4884);var _0x15ac72=util[_0x8b67('0x55')](_0x8b67('0x56'),_0x2c48ce[_0x8b67('0x27')]['id'],_0x1f4884);var _0x195bc8=path[_0x8b67('0x52')](_0x41f162,_0x15ac72);var _0x1ab122=[];_0x1ab122[_0x8b67('0x57')]({'model':db[_0x8b67('0x58')],'as':'User','attributes':['id',_0x8b67('0x59')],'raw':!![]});_0x1ab122['push']({'model':db[_0x8b67('0x5a')],'as':'Contact','attributes':['id',_0x8b67('0x5b'),_0x8b67('0x5c')],'raw':!![]});if(_0x2c48ce['query'][_0x8b67('0x54')]){_0x1ab122[_0x8b67('0x57')]({'model':db[_0x8b67('0x5d')],'as':'Attachment','raw':!![]});}var _0x482856=[{'model':db[_0x8b67('0x38')],'as':_0x8b67('0x5e'),'attributes':['id',_0x8b67('0x35'),'createdAt','direction',_0x8b67('0x5f'),'read'],'include':_0x1ab122}];_0x482856['push']({'model':db[_0x8b67('0x60')],'as':_0x8b67('0x61'),'attributes':['id',_0x8b67('0x1c')]});_0x482856[_0x8b67('0x57')]({'model':db[_0x8b67('0x58')],'as':_0x8b67('0x62'),'attributes':['id',_0x8b67('0x59')]});return db[_0x8b67('0x20')][_0x8b67('0x33')]({'where':{'id':_0x2c48ce[_0x8b67('0x27')]['id']},'include':_0x482856})[_0x8b67('0x18')](handleEntityNotFound(_0x6f3db1,null))[_0x8b67('0x18')](function(_0x15d4c0){if(_0x15d4c0){var _0xddd626=_0x15d4c0[_0x8b67('0x63')]({'plain':!![]});fs[_0x8b67('0x64')](_0x11d529);var _0x2f8a1c={'channel':_0x8b67('0x65'),'account':_0xddd626[_0x8b67('0x61')]['name'],'agent':_0xddd626['Owner']?_0xddd626[_0x8b67('0x62')]['fullname']:_0x8b67('0x66'),'createdAt':moment(_0xddd626[_0x8b67('0x67')])[_0x8b67('0x55')](_0x8b67('0x46'))[_0x8b67('0x4f')](),'closedAt':_0xddd626['closed']?moment(_0xddd626[_0x8b67('0x68')])[_0x8b67('0x55')](_0x8b67('0x46'))[_0x8b67('0x4f')]():'','disposition':_0xddd626[_0x8b67('0x69')],'messages':_(_0xddd626[_0x8b67('0x5e')])[_0x8b67('0x44')]({'secret':![]})[_0x8b67('0x1f')](function(_0x25e97f){if(_0x25e97f[_0x8b67('0x5d')]){var _0x19e514=path['join'](_0x4c665c,_0x25e97f[_0x8b67('0x5d')][_0x8b67('0x6a')]);if(fs[_0x8b67('0x6b')](_0x19e514)){fs['createReadStream'](_0x19e514)['pipe'](fs[_0x8b67('0x6c')](path[_0x8b67('0x52')](_0x11d529,_0x25e97f['Attachment']['basename'])));}}return{'date':moment(_0x25e97f[_0x8b67('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8b67('0x4f')](),'sender':_0x25e97f[_0x8b67('0x6d')]==='out'?_0x25e97f['User']?_0x25e97f['User'][_0x8b67('0x59')]:'System':_0x25e97f['Contact'][_0x8b67('0x5b')]+(_0x25e97f['Contact']['lastName']?'\x20'+_0x25e97f[_0x8b67('0x6e')][_0x8b67('0x5c')]:''),'body':_0x25e97f[_0x8b67('0x5d')]?_0x25e97f[_0x8b67('0x5d')][_0x8b67('0x6a')]:_0x25e97f[_0x8b67('0x35')],'direction':_0x25e97f[_0x8b67('0x6d')]==='out'?'A':'C','secret':_0x25e97f[_0x8b67('0x5f')],'read':_0x25e97f['read'],'attachment':_0x25e97f[_0x8b67('0x5d')]};})[_0x8b67('0x6f')]()};return ejs['renderFile'](path[_0x8b67('0x52')](config[_0x8b67('0x53')],'server','views',_0x8b67('0x70')),{'interaction':_0x2f8a1c})[_0x8b67('0x18')](function(_0x2db66f){var _0x351f05=path['join'](_0x11d529,_0x8b67('0x71')+_0xddd626['id']+'-'+_0x1f4884+'.pdf');var _0x1084f0={'path':_0x351f05,'channel':_0x8b67('0x65'),'interactionId':_0xddd626['id']};return pdf[_0x8b67('0x72')](_0x2db66f,_0x1084f0);})[_0x8b67('0x18')](function(){return new BPromise(function(_0x14a10a,_0x1afd2c){zipdir(_0x11d529,{'saveTo':_0x195bc8},function(_0xef30a2,_0x41067a){if(_0xef30a2)return _0x1afd2c(_0xef30a2);return _0x14a10a(_0x41067a);});})[_0x8b67('0x18')](function(){return new BPromise(function(_0x250581,_0x235fe7){rimraf(_0x11d529,function(_0x3fcc9c){if(_0x3fcc9c)_0x235fe7(_0x3fcc9c);return _0x250581();});});})[_0x8b67('0x18')](function(){return _0x6f3db1['download'](_0x195bc8,_0x15ac72,function(_0x391d66){if(_0x391d66){console[_0x8b67('0x73')]('err',_0x391d66);}else{fs['unlinkSync'](_0x195bc8);}});});});}else{return _0x6f3db1[_0x8b67('0xe')](0xc8);}})[_0x8b67('0x26')](handleError(_0x6f3db1,null));}; \ No newline at end of file +var _0xd0af=['create','catch','body','find','describe','addMessage','WhatsappMessage','ids','findOne','length','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format','includeAll','include','rows','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','files','tmp','server','attachments','push','User','CmContact','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Account','fullname','createdAt','closed','disposition','basename','existsSync','createReadStream','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','value','root','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','WhatsappInteraction','rawAttributes','key','getOptions','findAll','whatsapp','query','user','params','model','keys','filters','intersection','attributes','fields','merge','options'];(function(_0x2599fb,_0x326664){var _0x3b1691=function(_0x34b694){while(--_0x34b694){_0x2599fb['push'](_0x2599fb['shift']());}};_0x3b1691(++_0x326664);}(_0xd0af,0x1cb));var _0xfd0a=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0xd0af[_0x1abb11];return _0x149a9f;};'use strict';var rimraf=require(_0xfd0a('0x0'));var zipdir=require(_0xfd0a('0x1'));var moment=require(_0xfd0a('0x2'));var BPromise=require(_0xfd0a('0x3'));var util=require(_0xfd0a('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd0a('0x5'));var Redis=require(_0xfd0a('0x6'));var interaction=require(_0xfd0a('0x7'));var qs=require(_0xfd0a('0x8'));var pdf=require(_0xfd0a('0x9'));var logger=require(_0xfd0a('0xa'))(_0xfd0a('0xb'));var config=require(_0xfd0a('0xc'));var db=require(_0xfd0a('0xd'))['db'];config[_0xfd0a('0xe')]=_['defaults'](config[_0xfd0a('0xe')],{'host':_0xfd0a('0xf'),'port':0x18eb});var socket=require(_0xfd0a('0x10'))(new Redis(config[_0xfd0a('0xe')]));require(_0xfd0a('0x11'))[_0xfd0a('0x12')](socket);function respondWithStatusCode(_0x26d8b4,_0x38f6f2){_0x38f6f2=_0x38f6f2||0xcc;return function(_0x38f819){if(_0x38f819){return _0x26d8b4[_0xfd0a('0x13')](_0x38f6f2);}return _0x26d8b4[_0xfd0a('0x14')](_0x38f6f2)[_0xfd0a('0x15')]();};}function respondWithResult(_0x3abb3d,_0x5579c2){_0x5579c2=_0x5579c2||0xc8;return function(_0x132fba){if(_0x132fba){return _0x3abb3d[_0xfd0a('0x14')](_0x5579c2)[_0xfd0a('0x16')](_0x132fba);}};}function respondWithFilteredResult(_0x591384,_0x1f3f4d){return function(_0x7ec104){if(_0x7ec104){var _0x2674b7=typeof _0x1f3f4d[_0xfd0a('0x17')]===_0xfd0a('0x18')&&typeof _0x1f3f4d[_0xfd0a('0x19')]===_0xfd0a('0x18');var _0x35b7f7=_0x7ec104['count'];var _0x2c8592=_0x2674b7?0x0:_0x1f3f4d[_0xfd0a('0x17')];var _0x3875cc=_0x2674b7?_0x7ec104[_0xfd0a('0x1a')]:_0x1f3f4d[_0xfd0a('0x17')]+_0x1f3f4d['limit'];var _0x1855da;if(_0x3875cc>=_0x35b7f7){_0x3875cc=_0x35b7f7;_0x1855da=0xc8;}else{_0x1855da=0xce;}_0x591384['status'](_0x1855da);return _0x591384[_0xfd0a('0x1b')](_0xfd0a('0x1c'),_0x2c8592+'-'+_0x3875cc+'/'+_0x35b7f7)[_0xfd0a('0x16')](_0x7ec104);}return null;};}function saveUpdates(_0x377070){return function(_0x1e6e5b){if(_0x1e6e5b){return _0x1e6e5b[_0xfd0a('0x1d')](_0x377070)[_0xfd0a('0x1e')](function(_0x5ee02d){return _0x5ee02d;});}return null;};}function removeEntity(_0x1932a9){return function(_0x352a94){if(_0x352a94){return _0x352a94[_0xfd0a('0x1f')]()[_0xfd0a('0x1e')](function(){_0x1932a9[_0xfd0a('0x14')](0xcc)[_0xfd0a('0x15')]();});}};}function handleEntityNotFound(_0x5f57ce){return function(_0x3a3f06){if(!_0x3a3f06){_0x5f57ce[_0xfd0a('0x13')](0x194);}return _0x3a3f06;};}function handleError(_0x21eb30,_0x59c4e0){_0x59c4e0=_0x59c4e0||0x1f4;return function(_0x5e6d98){logger['error'](_0x5e6d98[_0xfd0a('0x20')]);if(_0x5e6d98[_0xfd0a('0x21')]){delete _0x5e6d98[_0xfd0a('0x21')];}_0x21eb30['status'](_0x59c4e0)['send'](_0x5e6d98);};}exports[_0xfd0a('0x22')]=function(_0xe32996,_0x116ba1){var _0x40bf37={};var _0x6ef9a0=_[_0xfd0a('0x23')](db[_0xfd0a('0x24')][_0xfd0a('0x25')],function(_0xe5f2bd){return{'name':_0xe5f2bd['fieldName'],'type':_0xe5f2bd['type'][_0xfd0a('0x26')]};});_0x40bf37=qs[_0xfd0a('0x27')](_0x6ef9a0,_0xe32996);return interaction[_0xfd0a('0x28')](_0xfd0a('0x29'),_0xe32996[_0xfd0a('0x2a')],_0xe32996[_0xfd0a('0x2b')],_0x40bf37,_0x6ef9a0)[_0xfd0a('0x1e')](respondWithFilteredResult(_0x116ba1,_0x40bf37))['catch'](handleError(_0x116ba1,null));};exports['show']=function(_0x2c04e4,_0x6cfc3d){var _0x4f885f={'raw':![],'where':{'id':_0x2c04e4[_0xfd0a('0x2c')]['id']}},_0xae68c9={};_0xae68c9[_0xfd0a('0x2d')]=_['keys'](db['WhatsappInteraction'][_0xfd0a('0x25')]);_0xae68c9['query']=_[_0xfd0a('0x2e')](_0x2c04e4[_0xfd0a('0x2a')]);_0xae68c9[_0xfd0a('0x2f')]=_[_0xfd0a('0x30')](_0xae68c9[_0xfd0a('0x2d')],_0xae68c9['query']);_0x4f885f[_0xfd0a('0x31')]=_[_0xfd0a('0x30')](_0xae68c9[_0xfd0a('0x2d')],qs[_0xfd0a('0x32')](_0x2c04e4[_0xfd0a('0x2a')][_0xfd0a('0x32')]));_0x4f885f[_0xfd0a('0x31')]=_0x4f885f['attributes']['length']?_0x4f885f[_0xfd0a('0x31')]:_0xae68c9['model'];if(_0x2c04e4[_0xfd0a('0x2a')]['includeAll']){_0x4f885f['include']=[{'all':!![]}];}_0x4f885f=_[_0xfd0a('0x33')]({},_0x4f885f,_0x2c04e4[_0xfd0a('0x34')]);return db[_0xfd0a('0x24')]['find'](_0x4f885f)[_0xfd0a('0x1e')](handleEntityNotFound(_0x6cfc3d,null))['then'](respondWithResult(_0x6cfc3d,null))['catch'](handleError(_0x6cfc3d,null));};exports[_0xfd0a('0x35')]=function(_0x526808,_0x24da54){return db[_0xfd0a('0x24')][_0xfd0a('0x35')](_0x526808['body'],{})[_0xfd0a('0x1e')](respondWithResult(_0x24da54,0xc9))[_0xfd0a('0x36')](handleError(_0x24da54,null));};exports['update']=function(_0x3f2b41,_0x5f7145){if(_0x3f2b41[_0xfd0a('0x37')]['id']){delete _0x3f2b41['body']['id'];}return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x3f2b41['params']['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x5f7145,null))[_0xfd0a('0x1e')](saveUpdates(_0x3f2b41[_0xfd0a('0x37')],null))[_0xfd0a('0x1e')](respondWithResult(_0x5f7145,null))[_0xfd0a('0x36')](handleError(_0x5f7145,null));};exports[_0xfd0a('0x1f')]=function(_0x4f7704,_0x2de7ee){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x4f7704[_0xfd0a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2de7ee,null))[_0xfd0a('0x1e')](removeEntity(_0x2de7ee,null))['catch'](handleError(_0x2de7ee,null));};exports[_0xfd0a('0x39')]=function(_0x348bed,_0x3e256a){return db[_0xfd0a('0x24')][_0xfd0a('0x39')]()['then'](respondWithResult(_0x3e256a,null))[_0xfd0a('0x36')](handleError(_0x3e256a,null));};exports[_0xfd0a('0x3a')]=function(_0x3ceb91,_0x2081d1){return db[_0xfd0a('0x3b')][_0xfd0a('0x38')]({'where':{'id':_0x3ceb91[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x2081d1,null))['then'](function(_0x35ccab){if(_0x35ccab){return _0x35ccab[_0xfd0a('0x3a')](_0x3ceb91[_0xfd0a('0x37')]['ids'],_['omit'](_0x3ceb91[_0xfd0a('0x37')],[_0xfd0a('0x3c'),'id'])||{});}})[_0xfd0a('0x1e')](respondWithResult(_0x2081d1,null))[_0xfd0a('0x36')](handleError(_0x2081d1,null));};exports['getMessages']=function(_0x2bc807,_0x5206af){var _0x2715c8={'raw':![],'where':{}};var _0x2b2310={};var _0x588532={'count':0x0,'rows':[]};return db[_0xfd0a('0x24')][_0xfd0a('0x3d')]({'where':{'id':_0x2bc807[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x5206af,null))[_0xfd0a('0x1e')](function(_0x175f01){if(_0x175f01){_0x2b2310[_0xfd0a('0x2d')]=_[_0xfd0a('0x2e')](db[_0xfd0a('0x3b')][_0xfd0a('0x25')]);_0x2b2310['query']=_['keys'](_0x2bc807[_0xfd0a('0x2a')]);_0x2b2310[_0xfd0a('0x2f')]=_['intersection'](_0x2b2310[_0xfd0a('0x2d')],_0x2b2310[_0xfd0a('0x2a')]);_0x2715c8[_0xfd0a('0x31')]=_[_0xfd0a('0x30')](_0x2b2310[_0xfd0a('0x2d')],qs[_0xfd0a('0x32')](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x32')]));_0x2715c8[_0xfd0a('0x31')]=_0x2715c8['attributes'][_0xfd0a('0x3e')]?_0x2715c8[_0xfd0a('0x31')]:_0x2b2310[_0xfd0a('0x2d')];if(!_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x3f')](_0xfd0a('0x40'))){_0x2715c8[_0xfd0a('0x19')]=qs['limit'](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x19')]);_0x2715c8[_0xfd0a('0x17')]=qs[_0xfd0a('0x17')](_0x2bc807[_0xfd0a('0x2a')]['offset']);}_0x2715c8['order']=qs[_0xfd0a('0x41')](_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x41')]);_0x2715c8[_0xfd0a('0x42')]=qs[_0xfd0a('0x2f')](_[_0xfd0a('0x43')](_0x2bc807['query'],_0x2b2310[_0xfd0a('0x2f')]));_0x2715c8[_0xfd0a('0x42')]['WhatsappInteractionId']=_0x175f01['id'];if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x44')]){_0x2715c8[_0xfd0a('0x42')]=_['merge'](_0x2715c8[_0xfd0a('0x42')],{'$or':_[_0xfd0a('0x23')](_0x2715c8[_0xfd0a('0x31')],function(_0x11e457){var _0x12dfbf={};_0x12dfbf[_0x11e457]={'$like':'%'+_0x2bc807['query'][_0xfd0a('0x44')]+'%'};return _0x12dfbf;})});}if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x45')]){var _0x288809=_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x45')][_0xfd0a('0x46')](',');var _0x148bed={};_0x148bed[_0x288809[0x0]]={'$gte':moment(_0x288809[0x1])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2715c8[_0xfd0a('0x42')]=_[_0xfd0a('0x33')](_0x2715c8['where'],_0x148bed);}_0x2715c8=_[_0xfd0a('0x33')]({},_0x2715c8,_0x2bc807[_0xfd0a('0x34')]);return db['WhatsappMessage'][_0xfd0a('0x1a')]({'where':_0x2715c8['where']})[_0xfd0a('0x1e')](function(_0x50105e){_0x588532[_0xfd0a('0x1a')]=_0x50105e;if(_0x2bc807[_0xfd0a('0x2a')][_0xfd0a('0x48')]){_0x2715c8[_0xfd0a('0x49')]=[{'all':!![]}];}return db[_0xfd0a('0x3b')][_0xfd0a('0x28')](_0x2715c8);})['then'](function(_0x2114e4){_0x588532[_0xfd0a('0x4a')]=_0x2114e4;return _0x588532;});}})[_0xfd0a('0x1e')](respondWithFilteredResult(_0x5206af,_0x2715c8))[_0xfd0a('0x36')](handleError(_0x5206af,null));};exports[_0xfd0a('0x4b')]=function(_0x4fbf8f,_0x3e4868){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x4fbf8f['params']['id']}})['then'](handleEntityNotFound(_0x3e4868,null))[_0xfd0a('0x1e')](function(_0x2d8174){if(_0x2d8174){return _0x2d8174[_0xfd0a('0x4c')](_0x4fbf8f[_0xfd0a('0x37')]['ids'],_[_0xfd0a('0x4d')](_0x4fbf8f[_0xfd0a('0x37')],[_0xfd0a('0x3c'),'id'])||{})[_0xfd0a('0x4e')](function(){return db[_0xfd0a('0x4f')][_0xfd0a('0x28')]({'attributes':['id','name',_0xfd0a('0x50')],'where':{'id':_0x4fbf8f[_0xfd0a('0x37')][_0xfd0a('0x3c')]}});})[_0xfd0a('0x1e')](function(_0x2383ef){socket[_0xfd0a('0x51')](_0xfd0a('0x52'),{'id':Number(_0x4fbf8f[_0xfd0a('0x2c')]['id']),'tags':_0x2383ef||[]});return{'id':Number(_0x4fbf8f[_0xfd0a('0x2c')]['id']),'tags':_0x2383ef||[]};});}})[_0xfd0a('0x1e')](respondWithResult(_0x3e4868,null))[_0xfd0a('0x36')](handleError(_0x3e4868,null));};exports[_0xfd0a('0x53')]=function(_0x14a200,_0x3e5db4){return db[_0xfd0a('0x24')][_0xfd0a('0x38')]({'where':{'id':_0x14a200[_0xfd0a('0x2c')]['id']}})[_0xfd0a('0x1e')](handleEntityNotFound(_0x3e5db4,null))[_0xfd0a('0x1e')](function(_0x481122){if(_0x481122){return _0x481122[_0xfd0a('0x53')](_0x14a200['query'][_0xfd0a('0x3c')]);}})[_0xfd0a('0x1e')](respondWithStatusCode(_0x3e5db4,null))[_0xfd0a('0x36')](handleError(_0x3e5db4,null));};exports[_0xfd0a('0x54')]=function(_0xaeb884,_0x38fb9f){var _0x29f0a3=moment()[_0xfd0a('0x55')]()[_0xfd0a('0x56')]();var _0x5a932b=path[_0xfd0a('0x57')](config['root'],'server',_0xfd0a('0x58'),_0xfd0a('0x59'));var _0x35c9f0=path[_0xfd0a('0x57')](config['root'],_0xfd0a('0x5a'),'files',_0xfd0a('0x5b'));var _0x19125e=path[_0xfd0a('0x57')](_0x5a932b,_0x29f0a3);var _0x27e4fc=util[_0xfd0a('0x47')]('transcript-%d-%s.zip',_0xaeb884[_0xfd0a('0x2c')]['id'],_0x29f0a3);var _0x40f559=path[_0xfd0a('0x57')](_0x5a932b,_0x27e4fc);var _0x18c5fa=[];_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5d')],'as':_0xfd0a('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5e')],'as':_0xfd0a('0x5f'),'attributes':['id','firstName',_0xfd0a('0x60')],'raw':!![]});if(_0xaeb884[_0xfd0a('0x2a')][_0xfd0a('0x5b')]){_0x18c5fa[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x61')],'as':_0xfd0a('0x61'),'raw':!![]});}var _0x40001f=[{'model':db[_0xfd0a('0x3b')],'as':_0xfd0a('0x62'),'attributes':['id',_0xfd0a('0x37'),'createdAt',_0xfd0a('0x63'),_0xfd0a('0x64'),'read'],'include':_0x18c5fa}];_0x40001f[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x65')],'as':'Account','attributes':['id',_0xfd0a('0x21')]});_0x40001f[_0xfd0a('0x5c')]({'model':db[_0xfd0a('0x5d')],'as':_0xfd0a('0x66'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0xaeb884[_0xfd0a('0x2c')]['id']},'include':_0x40001f})[_0xfd0a('0x1e')](handleEntityNotFound(_0x38fb9f,null))[_0xfd0a('0x1e')](function(_0xa16a63){if(_0xa16a63){var _0x339f93=_0xa16a63[_0xfd0a('0x67')]({'plain':!![]});fs[_0xfd0a('0x68')](_0x19125e);var _0x14af6d={'channel':'Whatsapp','account':_0x339f93[_0xfd0a('0x69')][_0xfd0a('0x21')],'agent':_0x339f93['Owner']?_0x339f93[_0xfd0a('0x66')][_0xfd0a('0x6a')]:'N.A.','createdAt':moment(_0x339f93[_0xfd0a('0x6b')])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfd0a('0x56')](),'closedAt':_0x339f93[_0xfd0a('0x6c')]?moment(_0x339f93['closedAt'])[_0xfd0a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x339f93[_0xfd0a('0x6d')],'messages':_(_0x339f93['Messages'])[_0xfd0a('0x44')]({'secret':![]})[_0xfd0a('0x23')](function(_0x354296){if(_0x354296['Attachment']){var _0x371610=path[_0xfd0a('0x57')](_0x35c9f0,_0x354296[_0xfd0a('0x61')][_0xfd0a('0x6e')]);if(fs[_0xfd0a('0x6f')](_0x371610)){fs[_0xfd0a('0x70')](_0x371610)['pipe'](fs[_0xfd0a('0x71')](path[_0xfd0a('0x57')](_0x19125e,_0x354296[_0xfd0a('0x61')]['basename'])));}}return{'date':moment(_0x354296[_0xfd0a('0x6b')])[_0xfd0a('0x47')](_0xfd0a('0x72'))[_0xfd0a('0x56')](),'sender':_0x354296['direction']===_0xfd0a('0x73')?_0x354296[_0xfd0a('0x5d')]?_0x354296[_0xfd0a('0x5d')][_0xfd0a('0x6a')]:_0xfd0a('0x74'):_0x354296['Contact'][_0xfd0a('0x75')]+(_0x354296[_0xfd0a('0x5f')]['lastName']?'\x20'+_0x354296['Contact'][_0xfd0a('0x60')]:''),'body':_0x354296['Attachment']?_0x354296[_0xfd0a('0x61')][_0xfd0a('0x6e')]:_0x354296[_0xfd0a('0x37')],'direction':_0x354296[_0xfd0a('0x63')]===_0xfd0a('0x73')?'A':'C','secret':_0x354296[_0xfd0a('0x64')],'read':_0x354296['read'],'attachment':_0x354296[_0xfd0a('0x61')]};})[_0xfd0a('0x76')]()};return ejs['renderFile'](path['join'](config[_0xfd0a('0x77')],_0xfd0a('0x5a'),_0xfd0a('0x78'),_0xfd0a('0x79')),{'interaction':_0x14af6d})[_0xfd0a('0x1e')](function(_0x492577){var _0x158dbc=path[_0xfd0a('0x57')](_0x19125e,_0xfd0a('0x7a')+_0x339f93['id']+'-'+_0x29f0a3+_0xfd0a('0x7b'));var _0x56c973={'path':_0x158dbc,'channel':_0xfd0a('0x7c'),'interactionId':_0x339f93['id']};return pdf['createPdfFromHTML'](_0x492577,_0x56c973);})[_0xfd0a('0x1e')](function(){return new BPromise(function(_0x3d26ed,_0x469f62){zipdir(_0x19125e,{'saveTo':_0x40f559},function(_0x416741,_0xf8f9e1){if(_0x416741)return _0x469f62(_0x416741);return _0x3d26ed(_0xf8f9e1);});})[_0xfd0a('0x1e')](function(){return new BPromise(function(_0x2f0e21,_0xcbfdcc){rimraf(_0x19125e,function(_0xa8e7cf){if(_0xa8e7cf)_0xcbfdcc(_0xa8e7cf);return _0x2f0e21();});});})['then'](function(){return _0x38fb9f['download'](_0x40f559,_0x27e4fc,function(_0x292128){if(_0x292128){console[_0xfd0a('0x7d')](_0xfd0a('0x7e'),_0x292128);}else{fs[_0xfd0a('0x7f')](_0x40f559);}});});});}else{return _0x38fb9f['sendStatus'](0xc8);}})[_0xfd0a('0x36')](handleError(_0x38fb9f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fc9638e..da22a94 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 _0x6e6c=['events','../../mysqldb','WhatsappMessage','update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var WhatsappInteraction=require(_0xc6e6('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xc6e6('0x1'))['db'][_0xc6e6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6e6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40b7e1){return function(_0x4b13f0,_0xe59212,_0x1182c7){_0x4b13f0['getUsers']({'attributes':['id'],'raw':!![]})[_0xc6e6('0x4')](function(_0x30a10b){_0x4b13f0['setDataValue'](_0xc6e6('0x5'),_0x30a10b[_0xc6e6('0x6')](function(_0x5a7ef3){return{'id':_0x5a7ef3['id']};}));return WhatsappMessage[_0xc6e6('0x7')]({'where':{'WhatsappInteractionId':_0x4b13f0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x172aa9){_0x4b13f0[_0xc6e6('0x8')](_0xc6e6('0x9'),_0x172aa9[_0xc6e6('0xa')]);WhatsappInteractionEvents[_0xc6e6('0xb')](_0x40b7e1+':'+_0x4b13f0['id'],_0x4b13f0);WhatsappInteractionEvents[_0xc6e6('0xb')](_0x40b7e1,_0x4b13f0);_0x1182c7(null);})[_0xc6e6('0xc')](_0x1182c7(null));};}for(var e in events){if(events[_0xc6e6('0xd')](e)){var event=events[e];WhatsappInteraction[_0xc6e6('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x0c5d=['update','remove','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x567302,_0xd3b070){_0x567302=_0x567302-0x0;var _0x15b59a=_0x0c5d[_0x567302];return _0x15b59a;};'use strict';var EventEmitter=require(_0xd0c5('0x0'));var WhatsappInteraction=require(_0xd0c5('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xd0c5('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd0c5('0x2')](0x0);var events={'afterCreate':_0xd0c5('0x3'),'afterUpdate':_0xd0c5('0x4'),'afterDestroy':_0xd0c5('0x5')};function emitEvent(_0x4664bc){return function(_0xc3a9b9,_0x166636,_0x121911){_0xc3a9b9['getUsers']({'attributes':['id'],'raw':!![]})[_0xd0c5('0x6')](function(_0x518801){_0xc3a9b9['setDataValue'](_0xd0c5('0x7'),_0x518801['map'](function(_0x567113){return{'id':_0x567113['id']};}));return WhatsappMessage[_0xd0c5('0x8')]({'where':{'WhatsappInteractionId':_0xc3a9b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd0c5('0x6')](function(_0x50ed33){_0xc3a9b9[_0xd0c5('0x9')](_0xd0c5('0xa'),_0x50ed33['length']);WhatsappInteractionEvents[_0xd0c5('0xb')](_0x4664bc+':'+_0xc3a9b9['id'],_0xc3a9b9);WhatsappInteractionEvents[_0xd0c5('0xb')](_0x4664bc,_0xc3a9b9);_0x121911(null);})[_0xd0c5('0xc')](_0x121911(null));};}for(var e in events){if(events[_0xd0c5('0xd')](e)){var event=events[e];WhatsappInteraction[_0xd0c5('0xe')](e,emitEvent(event));}}module[_0xd0c5('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index eb0e07b..ed1b319 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 _0x0214=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x15d9a0,_0x3d2b19){var _0x5661cf=function(_0x283e16){while(--_0x283e16){_0x15d9a0['push'](_0x15d9a0['shift']());}};_0x5661cf(++_0x3d2b19);}(_0x0214,0xf0));var _0x4021=function(_0x28de75,_0x103055){_0x28de75=_0x28de75-0x0;var _0xa1b275=_0x0214[_0x28de75];return _0xa1b275;};'use strict';var _=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4021('0x2'));var BPromise=require(_0x4021('0x3'));var rp=require(_0x4021('0x4'));var fs=require('fs');var path=require(_0x4021('0x5'));var rimraf=require('rimraf');var config=require(_0x4021('0x6'));var attributes=require(_0x4021('0x7'));module[_0x4021('0x8')]=function(_0xfe186c,_0x50d2d5){return _0xfe186c[_0x4021('0x9')](_0x4021('0xa'),attributes,{'tableName':_0x4021('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x514d67,_0x195282,_0x41dcee){if(_0x514d67[_0x4021('0xc')](_0x4021('0xd'))){_0x514d67[_0x4021('0xe')]=moment()[_0x4021('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x41dcee(null,_0x514d67);}}});}; \ No newline at end of file +var _0xec81=['rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2dc154,_0x1a3464){var _0x329085=function(_0x2dc156){while(--_0x2dc156){_0x2dc154['push'](_0x2dc154['shift']());}};_0x329085(++_0x1a3464);}(_0xec81,0xf6));var _0x1ec8=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0xec81[_0x399849];return _0xfbb04;};'use strict';var _=require(_0x1ec8('0x0'));var util=require(_0x1ec8('0x1'));var logger=require(_0x1ec8('0x2'))(_0x1ec8('0x3'));var moment=require('moment');var BPromise=require(_0x1ec8('0x4'));var rp=require(_0x1ec8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ec8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ec8('0x7'));module[_0x1ec8('0x8')]=function(_0x162872,_0x3fe6b0){return _0x162872['define'](_0x1ec8('0x9'),attributes,{'tableName':_0x1ec8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c0f35,_0x4c468f,_0x51d752){if(_0x5c0f35[_0x1ec8('0xb')]('closed')){_0x5c0f35['closedAt']=moment()[_0x1ec8('0xc')](_0x1ec8('0xd'));}_0x51d752(null,_0x5c0f35);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 67d3ecf..b307b7e 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 _0x2d2c=['error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','util','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5765db,_0x409bde){var _0x187812=function(_0x504d83){while(--_0x504d83){_0x5765db['push'](_0x5765db['shift']());}};_0x187812(++_0x409bde);}(_0x2d2c,0xaf));var _0xc2d2=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0x2d2c[_0x1945a5];return _0x5817a5;};'use strict';var _=require('lodash');var util=require(_0xc2d2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2d2('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc2d2('0x2'));var config=require(_0xc2d2('0x3'));var jayson=require(_0xc2d2('0x4'));var client=jayson[_0xc2d2('0x5')][_0xc2d2('0x6')]({'port':0x232a});config[_0xc2d2('0x7')]=_[_0xc2d2('0x8')](config['redis'],{'host':_0xc2d2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2d2('0x7')]));require(_0xc2d2('0xa'))[_0xc2d2('0xb')](socket);function respondWithRpcPromise(_0x5baad2,_0x2fd009,_0x59fe79){return new BPromise(function(_0x6bd696,_0x2aad44){return client[_0xc2d2('0xc')](_0x5baad2,_0x59fe79)[_0xc2d2('0xd')](function(_0x1d910d){logger[_0xc2d2('0xe')](_0xc2d2('0xf'),_0x2fd009,_0xc2d2('0x10'));logger[_0xc2d2('0x11')](_0xc2d2('0x12'),_0x2fd009,_0xc2d2('0x10'),JSON[_0xc2d2('0x13')](_0x1d910d));if(_0x1d910d[_0xc2d2('0x14')]){if(_0x1d910d[_0xc2d2('0x14')][_0xc2d2('0x15')]===0x1f4){logger[_0xc2d2('0x14')](_0xc2d2('0xf'),_0x2fd009,_0x1d910d[_0xc2d2('0x14')][_0xc2d2('0x16')]);return _0x2aad44(_0x1d910d[_0xc2d2('0x14')]['message']);}logger[_0xc2d2('0x14')](_0xc2d2('0xf'),_0x2fd009,_0x1d910d[_0xc2d2('0x14')][_0xc2d2('0x16')]);return _0x6bd696(_0x1d910d[_0xc2d2('0x14')][_0xc2d2('0x16')]);}else{logger[_0xc2d2('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x2fd009,_0xc2d2('0x10'));_0x6bd696(_0x1d910d[_0xc2d2('0x17')][_0xc2d2('0x16')]);}})[_0xc2d2('0x18')](function(_0x1625ff){logger['error'](_0xc2d2('0xf'),_0x2fd009,_0x1625ff);_0x2aad44(_0x1625ff);});});}exports[_0xc2d2('0x19')]=function(_0x531641){var _0x452348=this;return new Promise(function(_0x365f6d,_0x30fb40){return db['WhatsappInteraction'][_0xc2d2('0x1a')](_0x531641[_0xc2d2('0x1b')],{'raw':_0x531641[_0xc2d2('0x1c')]?_0x531641[_0xc2d2('0x1c')][_0xc2d2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531641[_0xc2d2('0x1c')]?_0x531641['options'][_0xc2d2('0x1e')]||null:null,'attributes':_0x531641[_0xc2d2('0x1c')]?_0x531641[_0xc2d2('0x1c')]['attributes']||null:null,'limit':_0x531641[_0xc2d2('0x1c')]?_0x531641[_0xc2d2('0x1c')][_0xc2d2('0x1f')]||null:null})['then'](function(_0x5654b6){logger['info'](_0xc2d2('0x19'),_0x531641);logger[_0xc2d2('0x11')](_0xc2d2('0x19'),_0x531641,JSON['stringify'](_0x5654b6));_0x365f6d(_0x5654b6);})[_0xc2d2('0x18')](function(_0x1679b8){logger['error'](_0xc2d2('0x19'),_0x1679b8[_0xc2d2('0x16')],_0x531641);_0x30fb40(_0x452348[_0xc2d2('0x14')](0x1f4,_0x1679b8['message']));});});};exports[_0xc2d2('0x20')]=function(_0x5b8db6){return new Promise(function(_0xe028b6,_0x1d5554){return db['WhatsappInteraction'][_0xc2d2('0x21')]({'where':_0x5b8db6['options']?_0x5b8db6[_0xc2d2('0x1c')][_0xc2d2('0x1e')]||null:null})['then'](function(_0x2dd337){if(_0x2dd337){return _0x2dd337[_0xc2d2('0x22')](_0x5b8db6[_0xc2d2('0x1b')][_0xc2d2('0x23')],_[_0xc2d2('0x24')](_0x5b8db6['body'],[_0xc2d2('0x23'),'id'])||{});}})[_0xc2d2('0x25')](function(_0x25f123){logger[_0xc2d2('0xe')]('AddTags',_0x5b8db6);logger[_0xc2d2('0x11')](_0xc2d2('0x26'),_0x5b8db6,JSON[_0xc2d2('0x13')](_0x25f123));_0xe028b6(_0x25f123);})['catch'](function(_0x16d076){logger[_0xc2d2('0x14')](_0xc2d2('0x26'),_0x16d076[_0xc2d2('0x16')],_0x5b8db6);_0x1d5554(_this[_0xc2d2('0x14')](0x1f4,_0x16d076['message']));});});}; \ No newline at end of file +var _0x1c93=['find','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','debug','AddTagsToWhatsappInteraction'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0x1c93,0x16d));var _0x31c9=function(_0x29b30c,_0x4f4b69){_0x29b30c=_0x29b30c-0x0;var _0x3e0cd3=_0x1c93[_0x29b30c];return _0x3e0cd3;};'use strict';var _=require(_0x31c9('0x0'));var util=require(_0x31c9('0x1'));var moment=require('moment');var BPromise=require(_0x31c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31c9('0x3'));var db=require(_0x31c9('0x4'))['db'];var utils=require(_0x31c9('0x5'));var logger=require(_0x31c9('0x6'))(_0x31c9('0x7'));var config=require(_0x31c9('0x8'));var jayson=require(_0x31c9('0x9'));var client=jayson['client'][_0x31c9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x31c9('0xb'),'port':0x18eb});var socket=require(_0x31c9('0xc'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x33e86c,_0x3760d3,_0x58dc24){return new BPromise(function(_0x248ccc,_0x2e0ee6){return client[_0x31c9('0xd')](_0x33e86c,_0x58dc24)[_0x31c9('0xe')](function(_0x54030f){logger['info'](_0x31c9('0xf'),_0x3760d3,_0x31c9('0x10'));logger['debug'](_0x31c9('0x11'),_0x3760d3,_0x31c9('0x10'),JSON[_0x31c9('0x12')](_0x54030f));if(_0x54030f[_0x31c9('0x13')]){if(_0x54030f[_0x31c9('0x13')][_0x31c9('0x14')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3760d3,_0x54030f['error'][_0x31c9('0x15')]);return _0x2e0ee6(_0x54030f['error'][_0x31c9('0x15')]);}logger[_0x31c9('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x3760d3,_0x54030f[_0x31c9('0x13')][_0x31c9('0x15')]);return _0x248ccc(_0x54030f['error']['message']);}else{logger[_0x31c9('0x16')](_0x31c9('0xf'),_0x3760d3,_0x31c9('0x10'));_0x248ccc(_0x54030f[_0x31c9('0x17')][_0x31c9('0x15')]);}})[_0x31c9('0x18')](function(_0x4828d1){logger[_0x31c9('0x13')](_0x31c9('0xf'),_0x3760d3,_0x4828d1);_0x2e0ee6(_0x4828d1);});});}exports[_0x31c9('0x19')]=function(_0x472b2c){var _0x3d1b6d=this;return new Promise(function(_0x5564a9,_0x49f5ee){return db[_0x31c9('0x1a')][_0x31c9('0x1b')](_0x472b2c[_0x31c9('0x1c')],{'raw':_0x472b2c['options']?_0x472b2c[_0x31c9('0x1d')][_0x31c9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x472b2c[_0x31c9('0x1d')]?_0x472b2c[_0x31c9('0x1d')][_0x31c9('0x1f')]||null:null,'attributes':_0x472b2c[_0x31c9('0x1d')]?_0x472b2c[_0x31c9('0x1d')][_0x31c9('0x20')]||null:null,'limit':_0x472b2c['options']?_0x472b2c[_0x31c9('0x1d')]['limit']||null:null})[_0x31c9('0xe')](function(_0x5934f8){logger[_0x31c9('0x16')]('UpdateWhatsappInteraction',_0x472b2c);logger[_0x31c9('0x21')](_0x31c9('0x19'),_0x472b2c,JSON['stringify'](_0x5934f8));_0x5564a9(_0x5934f8);})['catch'](function(_0x4eb493){logger[_0x31c9('0x13')]('UpdateWhatsappInteraction',_0x4eb493[_0x31c9('0x15')],_0x472b2c);_0x49f5ee(_0x3d1b6d['error'](0x1f4,_0x4eb493[_0x31c9('0x15')]));});});};exports[_0x31c9('0x22')]=function(_0x35e5ed){return new Promise(function(_0x2af656,_0x308975){return db[_0x31c9('0x1a')][_0x31c9('0x23')]({'where':_0x35e5ed[_0x31c9('0x1d')]?_0x35e5ed[_0x31c9('0x1d')]['where']||null:null})[_0x31c9('0xe')](function(_0x12fa38){if(_0x12fa38){return _0x12fa38['addTags'](_0x35e5ed[_0x31c9('0x1c')][_0x31c9('0x24')],_[_0x31c9('0x25')](_0x35e5ed[_0x31c9('0x1c')],['ids','id'])||{});}})[_0x31c9('0x26')](function(_0xf6a4b0){logger['info'](_0x31c9('0x27'),_0x35e5ed);logger[_0x31c9('0x21')](_0x31c9('0x27'),_0x35e5ed,JSON[_0x31c9('0x12')](_0xf6a4b0));_0x2af656(_0xf6a4b0);})['catch'](function(_0x57b05b){logger[_0x31c9('0x13')](_0x31c9('0x27'),_0x57b05b[_0x31c9('0x15')],_0x35e5ed);_0x308975(_this[_0x31c9('0x13')](0x1f4,_0x57b05b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 29b9aba..0d64d6f 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 _0x0b6a=['./whatsappInteraction.events','save','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x78029b,_0x19ce64){var _0x2c1b66=function(_0x3d1543){while(--_0x3d1543){_0x78029b['push'](_0x78029b['shift']());}};_0x2c1b66(++_0x19ce64);}(_0x0b6a,0x1a8));var _0xa0b6=function(_0x20ee8a,_0x543cdd){_0x20ee8a=_0x20ee8a-0x0;var _0x340c92=_0x0b6a[_0x20ee8a];return _0x340c92;};'use strict';var WhatsappInteractionEvents=require(_0xa0b6('0x0'));var events=[_0xa0b6('0x1'),'remove',_0xa0b6('0x2')];function createListener(_0x4ed23f,_0x58f39b){return function(_0x49c120){_0x58f39b[_0xa0b6('0x3')](_0x4ed23f,_0x49c120);};}function removeListener(_0x51d46f,_0x1e546a){return function(){WhatsappInteractionEvents[_0xa0b6('0x4')](_0x51d46f,_0x1e546a);};}exports[_0xa0b6('0x5')]=function(_0x441796){for(var _0x37ac85=0x0,_0x76c462=events[_0xa0b6('0x6')];_0x37ac85<_0x76c462;_0x37ac85++){var _0x53fd81=events[_0x37ac85];var _0x35e4bb=createListener(_0xa0b6('0x7')+_0x53fd81,_0x441796);WhatsappInteractionEvents['on'](_0x53fd81,_0x35e4bb);}}; \ No newline at end of file +var _0x1d91=['./whatsappInteraction.events','save','emit','removeListener','register','length'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1d91,0x90));var _0x11d9=function(_0x54023f,_0x57551f){_0x54023f=_0x54023f-0x0;var _0x12d55f=_0x1d91[_0x54023f];return _0x12d55f;};'use strict';var WhatsappInteractionEvents=require(_0x11d9('0x0'));var events=[_0x11d9('0x1'),'remove','update'];function createListener(_0x21869b,_0x168a2f){return function(_0x1dbb8a){_0x168a2f[_0x11d9('0x2')](_0x21869b,_0x1dbb8a);};}function removeListener(_0x433b44,_0x41903f){return function(){WhatsappInteractionEvents[_0x11d9('0x3')](_0x433b44,_0x41903f);};}exports[_0x11d9('0x4')]=function(_0x301e18){for(var _0x3dd4b0=0x0,_0x264e83=events[_0x11d9('0x5')];_0x3dd4b0<_0x264e83;_0x3dd4b0++){var _0x411463=events[_0x3dd4b0];var _0x50441a=createListener('whatsappInteraction:'+_0x411463,_0x301e18);WhatsappInteractionEvents['on'](_0x411463,_0x50441a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ade78df..a5ed210 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 _0x3618=['post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x3618,0x14f));var _0x8361=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3618[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x8361('0x0'));var util=require(_0x8361('0x1'));var path=require(_0x8361('0x2'));var timeout=require(_0x8361('0x3'));var express=require(_0x8361('0x4'));var router=express[_0x8361('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8361('0x6'));var interaction=require(_0x8361('0x7'));var config=require(_0x8361('0x8'));var controller=require(_0x8361('0x9'));router['get']('/',auth[_0x8361('0xa')](),controller[_0x8361('0xb')]);router['get'](_0x8361('0xc'),auth[_0x8361('0xa')](),controller[_0x8361('0xd')]);router[_0x8361('0xe')](_0x8361('0xf'),auth[_0x8361('0xa')](),controller[_0x8361('0x10')]);router[_0x8361('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8361('0x12')](_0x8361('0x13'),_0x8361('0x14')),controller[_0x8361('0x15')]);router['post']('/:id/status',controller[_0x8361('0x16')]);router[_0x8361('0x17')](_0x8361('0xf'),auth[_0x8361('0xa')](),controller[_0x8361('0x18')]);router[_0x8361('0x17')](_0x8361('0x19'),auth[_0x8361('0xa')](),controller[_0x8361('0x1a')]);router[_0x8361('0x17')](_0x8361('0x1b'),auth['isAuthenticated'](),controller[_0x8361('0x1c')]);router[_0x8361('0x1d')](_0x8361('0xf'),auth[_0x8361('0xa')](),controller[_0x8361('0x1e')]);module[_0x8361('0x1f')]=router; \ No newline at end of file +var _0xb724=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject'];(function(_0x25e995,_0x143cdc){var _0x446a58=function(_0x545ebc){while(--_0x545ebc){_0x25e995['push'](_0x25e995['shift']());}};_0x446a58(++_0x143cdc);}(_0xb724,0x1cd));var _0x4b72=function(_0x51898e,_0x443d26){_0x51898e=_0x51898e-0x0;var _0x2dcd8b=_0xb724[_0x51898e];return _0x2dcd8b;};'use strict';var multer=require(_0x4b72('0x0'));var util=require('util');var path=require(_0x4b72('0x1'));var timeout=require(_0x4b72('0x2'));var express=require(_0x4b72('0x3'));var router=express[_0x4b72('0x4')]();var fs_extra=require(_0x4b72('0x5'));var auth=require(_0x4b72('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b72('0x7'));var controller=require(_0x4b72('0x8'));router[_0x4b72('0x9')]('/',auth[_0x4b72('0xa')](),controller[_0x4b72('0xb')]);router[_0x4b72('0x9')](_0x4b72('0xc'),auth['isAuthenticated'](),controller[_0x4b72('0xd')]);router[_0x4b72('0x9')](_0x4b72('0xe'),auth[_0x4b72('0xa')](),controller[_0x4b72('0xf')]);router['post']('/',auth[_0x4b72('0xa')](),interaction[_0x4b72('0x10')](_0x4b72('0x11'),_0x4b72('0x12')),controller[_0x4b72('0x13')]);router['post']('/:id/status',controller[_0x4b72('0x14')]);router[_0x4b72('0x15')](_0x4b72('0xe'),auth[_0x4b72('0xa')](),controller[_0x4b72('0x16')]);router[_0x4b72('0x15')](_0x4b72('0x17'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x4b72('0x18'),auth[_0x4b72('0xa')](),controller['reject']);router[_0x4b72('0x19')](_0x4b72('0xe'),auth[_0x4b72('0xa')](),controller[_0x4b72('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8c35c88..c9cdc5c 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 _0x0725=['medium','BOOLEAN','out','STRING','DATE','exports'];(function(_0x5649ef,_0x3745d5){var _0x97109=function(_0x2ff5e4){while(--_0x2ff5e4){_0x5649ef['push'](_0x5649ef['shift']());}};_0x97109(++_0x3745d5);}(_0x0725,0x167));var _0x5072=function(_0x54772b,_0x291042){_0x54772b=_0x54772b-0x0;var _0x4d178d=_0x0725[_0x54772b];return _0x4d178d;};'use strict';var Sequelize=require('sequelize');module[_0x5072('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5072('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5072('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5072('0x3')),'defaultValue':_0x5072('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5072('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x5072('0x5')]},'secret':{'type':Sequelize[_0x5072('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5072('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb453=['sequelize','exports','medium','BOOLEAN','out','STRING','DATE','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb453,0x1e8));var _0x3b45=function(_0x425900,_0x577c33){_0x425900=_0x425900-0x0;var _0x58635e=_0xb453[_0x425900];return _0x58635e;};'use strict';var Sequelize=require(_0x3b45('0x0'));module[_0x3b45('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3b45('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3b45('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3b45('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b45('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3b45('0x5')]},'readAt':{'type':Sequelize[_0x3b45('0x6')]},'secret':{'type':Sequelize[_0x3b45('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3b45('0x5')]},'providerResponse':{'type':Sequelize[_0x3b45('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d5137bc..df9f2eb 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 _0x8422=['mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','WhatsappMessage','findAll','rows','show','params','length','includeAll','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','email','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x8422,0x8b));var _0x2842=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x8422[_0x2e249d];return _0x1faa37;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2842('0x0'));var jsonpatch=require(_0x2842('0x1'));var rp=require(_0x2842('0x2'));var moment=require(_0x2842('0x3'));var BPromise=require(_0x2842('0x4'));var Mustache=require(_0x2842('0x5'));var util=require(_0x2842('0x6'));var path=require('path');var sox=require(_0x2842('0x7'));var csv=require('to-csv');var ejs=require(_0x2842('0x8'));var fs=require('fs');var fs_extra=require(_0x2842('0x9'));var _=require(_0x2842('0xa'));var squel=require(_0x2842('0xb'));var crypto=require(_0x2842('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2842('0xd'));var toCsv=require(_0x2842('0xe'));var querystring=require('querystring');var Papa=require(_0x2842('0xf'));var Redis=require(_0x2842('0x10'));var authService=require(_0x2842('0x11'));var qs=require(_0x2842('0x12'));var as=require(_0x2842('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2842('0x14'))(_0x2842('0x15'));var utils=require(_0x2842('0x16'));var config=require(_0x2842('0x17'));var licenseUtil=require(_0x2842('0x18'));var db=require(_0x2842('0x19'))['db'];config[_0x2842('0x1a')]=_['defaults'](config[_0x2842('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2842('0x1b'))[_0x2842('0x1c')](socket);var jayson=require(_0x2842('0x1d'));var client=jayson[_0x2842('0x1e')][_0x2842('0x1f')]({'port':0x232c});var client9002=jayson[_0x2842('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c663f,_0x130110,_0x41a55b,_0x3b26ac){return new BPromise(function(_0x237098,_0xfff048){var _0x440811=_0x3b26ac||client;return _0x440811[_0x2842('0x20')](_0x1c663f,_0x41a55b)[_0x2842('0x21')](function(_0x5d1dac){logger[_0x2842('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x130110,_0x2842('0x23'));logger[_0x2842('0x24')](_0x2842('0x25'),_0x130110,_0x2842('0x23'),JSON[_0x2842('0x26')](_0x5d1dac));if(_0x5d1dac['error']){if(_0x5d1dac[_0x2842('0x27')][_0x2842('0x28')]===0x1f4){logger[_0x2842('0x27')](_0x2842('0x29'),_0x130110,_0x5d1dac[_0x2842('0x27')][_0x2842('0x2a')]);return _0xfff048(_0x5d1dac[_0x2842('0x27')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x130110,_0x5d1dac['error'][_0x2842('0x2a')]);return _0x237098(_0x5d1dac[_0x2842('0x27')][_0x2842('0x2a')]);}else{logger[_0x2842('0x22')](_0x2842('0x29'),_0x130110,_0x2842('0x23'));_0x237098(_0x5d1dac[_0x2842('0x2b')][_0x2842('0x2a')]);}})[_0x2842('0x2c')](function(_0x5478a5){logger[_0x2842('0x27')](_0x2842('0x29'),_0x130110,_0x5478a5);_0xfff048(_0x5478a5);});});}function respondWithStatusCode(_0x1af3f8,_0x3fae4b){_0x3fae4b=_0x3fae4b||0xcc;return function(_0x915d36){if(_0x915d36){return _0x1af3f8['sendStatus'](_0x3fae4b);}return _0x1af3f8[_0x2842('0x2d')](_0x3fae4b)[_0x2842('0x2e')]();};}function respondWithResult(_0x2fed2b,_0x33ae0b){_0x33ae0b=_0x33ae0b||0xc8;return function(_0x76b4da){if(_0x76b4da){return _0x2fed2b[_0x2842('0x2d')](_0x33ae0b)[_0x2842('0x2f')](_0x76b4da);}};}function respondWithFilteredResult(_0x28d443,_0x47013d){return function(_0x3a887b){if(_0x3a887b){var _0x246fcf=typeof _0x47013d[_0x2842('0x30')]===_0x2842('0x31')&&typeof _0x47013d[_0x2842('0x32')]===_0x2842('0x31');var _0x2b4d91=_0x3a887b[_0x2842('0x33')];var _0x190865=_0x246fcf?0x0:_0x47013d[_0x2842('0x30')];var _0x5c18a1=_0x246fcf?_0x3a887b[_0x2842('0x33')]:_0x47013d['offset']+_0x47013d[_0x2842('0x32')];var _0x56c4e4;if(_0x5c18a1>=_0x2b4d91){_0x5c18a1=_0x2b4d91;_0x56c4e4=0xc8;}else{_0x56c4e4=0xce;}_0x28d443[_0x2842('0x2d')](_0x56c4e4);return _0x28d443['set'](_0x2842('0x34'),_0x190865+'-'+_0x5c18a1+'/'+_0x2b4d91)[_0x2842('0x2f')](_0x3a887b);}return null;};}function patchUpdates(_0x45383c){return function(_0x4bbb96){try{jsonpatch[_0x2842('0x35')](_0x4bbb96,_0x45383c,!![]);}catch(_0x2e029a){return BPromise[_0x2842('0x36')](_0x2e029a);}return _0x4bbb96['save']();};}function saveUpdates(_0x3f54c9,_0x505567){return function(_0x26b559){if(_0x26b559){return _0x26b559[_0x2842('0x37')](_0x3f54c9)[_0x2842('0x21')](function(_0x5898c0){return _0x5898c0;});}return null;};}function removeEntity(_0x30f2a5,_0x3f5e81){return function(_0x1d8ac6){if(_0x1d8ac6){return _0x1d8ac6[_0x2842('0x38')]()[_0x2842('0x21')](function(){_0x30f2a5[_0x2842('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb83fdb,_0x14c906){return function(_0x483ca3){if(!_0x483ca3){_0xb83fdb[_0x2842('0x39')](0x194);}return _0x483ca3;};}function handleError(_0x5ce04d,_0x1c2d76){_0x1c2d76=_0x1c2d76||0x1f4;return function(_0x4a0b5e){logger[_0x2842('0x27')](_0x4a0b5e[_0x2842('0x3a')]);if(_0x4a0b5e['name']){delete _0x4a0b5e[_0x2842('0x3b')];}_0x5ce04d['status'](_0x1c2d76)[_0x2842('0x3c')](_0x4a0b5e);};}exports[_0x2842('0x3d')]=function(_0x286ca0,_0x44dc28){var _0x48ba68={},_0x51289d={},_0x3e7aa9={'count':0x0,'rows':[]};var _0x5f53df=_['map'](db['WhatsappMessage'][_0x2842('0x3e')],function(_0x287bd6){return{'name':_0x287bd6[_0x2842('0x3f')],'type':_0x287bd6[_0x2842('0x40')]['key']};});_0x51289d['model']=_[_0x2842('0x41')](_0x5f53df,'name');_0x51289d['query']=_[_0x2842('0x42')](_0x286ca0[_0x2842('0x43')]);_0x51289d[_0x2842('0x44')]=_[_0x2842('0x45')](_0x51289d[_0x2842('0x46')],_0x51289d[_0x2842('0x43')]);_0x48ba68[_0x2842('0x47')]=_['intersection'](_0x51289d['model'],qs[_0x2842('0x48')](_0x286ca0['query']['fields']));_0x48ba68[_0x2842('0x47')]=_0x48ba68[_0x2842('0x47')]['length']?_0x48ba68[_0x2842('0x47')]:_0x51289d['model'];if(!_0x286ca0[_0x2842('0x43')][_0x2842('0x49')](_0x2842('0x4a'))){_0x48ba68['limit']=qs['limit'](_0x286ca0[_0x2842('0x43')][_0x2842('0x32')]);_0x48ba68[_0x2842('0x30')]=qs[_0x2842('0x30')](_0x286ca0[_0x2842('0x43')]['offset']);}_0x48ba68[_0x2842('0x4b')]=qs[_0x2842('0x4c')](_0x286ca0[_0x2842('0x43')]['sort']);_0x48ba68[_0x2842('0x4d')]=qs['filters'](_[_0x2842('0x4e')](_0x286ca0['query'],_0x51289d[_0x2842('0x44')]),_0x5f53df);if(_0x286ca0[_0x2842('0x43')]['filter']){_0x48ba68[_0x2842('0x4d')]=_[_0x2842('0x4f')](_0x48ba68['where'],{'$or':_[_0x2842('0x41')](_0x5f53df,function(_0x312af4){if(_0x312af4[_0x2842('0x40')]!==_0x2842('0x50')){var _0xdf728c={};_0xdf728c[_0x312af4[_0x2842('0x3b')]]={'$like':'%'+_0x286ca0[_0x2842('0x43')][_0x2842('0x51')]+'%'};return _0xdf728c;}})});}_0x48ba68=_[_0x2842('0x4f')]({},_0x48ba68,_0x286ca0[_0x2842('0x52')]);var _0x2e5581={'where':_0x48ba68['where']};return db['WhatsappMessage'][_0x2842('0x33')](_0x2e5581)['then'](function(_0x20eb43){_0x3e7aa9[_0x2842('0x33')]=_0x20eb43;if(_0x286ca0[_0x2842('0x43')]['includeAll']){_0x48ba68[_0x2842('0x53')]=[{'all':!![]}];}return db[_0x2842('0x54')][_0x2842('0x55')](_0x48ba68);})[_0x2842('0x21')](function(_0x54667a){_0x3e7aa9[_0x2842('0x56')]=_0x54667a;return _0x3e7aa9;})[_0x2842('0x21')](respondWithFilteredResult(_0x44dc28,_0x48ba68))[_0x2842('0x2c')](handleError(_0x44dc28,null));};exports[_0x2842('0x57')]=function(_0x45cfd3,_0x2e02a2){var _0x26348c={'raw':!![],'where':{'id':_0x45cfd3[_0x2842('0x58')]['id']}},_0x4c0804={};_0x4c0804[_0x2842('0x46')]=_[_0x2842('0x42')](db[_0x2842('0x54')]['rawAttributes']);_0x4c0804[_0x2842('0x43')]=_[_0x2842('0x42')](_0x45cfd3[_0x2842('0x43')]);_0x4c0804[_0x2842('0x44')]=_['intersection'](_0x4c0804[_0x2842('0x46')],_0x4c0804['query']);_0x26348c[_0x2842('0x47')]=_['intersection'](_0x4c0804[_0x2842('0x46')],qs[_0x2842('0x48')](_0x45cfd3[_0x2842('0x43')][_0x2842('0x48')]));_0x26348c[_0x2842('0x47')]=_0x26348c['attributes'][_0x2842('0x59')]?_0x26348c[_0x2842('0x47')]:_0x4c0804['model'];if(_0x45cfd3[_0x2842('0x43')][_0x2842('0x5a')]){_0x26348c[_0x2842('0x53')]=[{'all':!![]}];}_0x26348c=_[_0x2842('0x4f')]({},_0x26348c,_0x45cfd3[_0x2842('0x52')]);return db[_0x2842('0x54')][_0x2842('0x5b')](_0x26348c)[_0x2842('0x21')](handleEntityNotFound(_0x2e02a2,null))[_0x2842('0x21')](respondWithResult(_0x2e02a2,null))[_0x2842('0x2c')](handleError(_0x2e02a2,null));};exports[_0x2842('0x5c')]=function(_0x16cf2f,_0x5e4b0a){return db[_0x2842('0x54')][_0x2842('0x5c')](_0x16cf2f[_0x2842('0x5d')],{})['then'](respondWithResult(_0x5e4b0a,0xc9))[_0x2842('0x2c')](handleError(_0x5e4b0a,null));};exports[_0x2842('0x37')]=function(_0x104904,_0x2e16b3){if(_0x104904['body']['id']){delete _0x104904['body']['id'];}return db[_0x2842('0x54')][_0x2842('0x5b')]({'where':{'id':_0x104904['params']['id']}})[_0x2842('0x21')](handleEntityNotFound(_0x2e16b3,null))[_0x2842('0x21')](saveUpdates(_0x104904['body'],null))['then'](respondWithResult(_0x2e16b3,null))['catch'](handleError(_0x2e16b3,null));};exports[_0x2842('0x38')]=function(_0xd6b4a9,_0x15b98f){return db[_0x2842('0x54')][_0x2842('0x5b')]({'where':{'id':_0xd6b4a9[_0x2842('0x58')]['id']}})[_0x2842('0x21')](handleEntityNotFound(_0x15b98f,null))[_0x2842('0x21')](removeEntity(_0x15b98f,null))['catch'](handleError(_0x15b98f,null));};exports[_0x2842('0x5e')]=function(_0x7118b0,_0x15004e){return db[_0x2842('0x54')][_0x2842('0x5e')]()[_0x2842('0x21')](respondWithResult(_0x15004e,null))[_0x2842('0x2c')](handleError(_0x15004e,null));};var interaction_log=require(_0x2842('0x14'))(_0x2842('0x5f'));exports[_0x2842('0x60')]=function(_0x503398,_0x47a431,_0x1247f8){var _0x111e89={'agent':{},'channel':_0x2842('0x61')};if(_0x503398[_0x2842('0x5d')]['id']){delete _0x503398[_0x2842('0x5d')]['id'];}_0x503398[_0x2842('0x5d')][_0x2842('0x62')]=!![];_0x503398[_0x2842('0x5d')][_0x2842('0x63')]=moment()[_0x2842('0x64')](_0x2842('0x65'));_0x503398[_0x2842('0x5d')]['UserId']=_0x503398['body']['UserId']||_0x503398[_0x2842('0x66')]['id'];_0x111e89[_0x2842('0x67')]['id']=_0x503398[_0x2842('0x5d')][_0x2842('0x68')];return db[_0x2842('0x54')][_0x2842('0x5b')]({'where':{'id':_0x503398[_0x2842('0x58')]['id'],'UserId':null}})[_0x2842('0x21')](handleEntityNotFound(_0x47a431,null))['then'](saveUpdates(_0x503398[_0x2842('0x5d')],null))[_0x2842('0x21')](function(_0x9508f0){if(_0x9508f0){_0x111e89[_0x2842('0x2a')]=_0x9508f0[_0x2842('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x2842('0x5b')]({'where':{'id':_0x9508f0['WhatsappInteractionId']}});}return null;})[_0x2842('0x21')](handleEntityNotFound(_0x47a431,null))['then'](function(_0x164da4){if(_0x164da4){return _0x164da4[_0x2842('0x37')]({'UserId':_0x503398[_0x2842('0x5d')]['UserId'],'read1stAt':_[_0x2842('0x6a')](_0x164da4[_0x2842('0x6b')])?moment()['format'](_0x2842('0x65')):undefined});}return null;})[_0x2842('0x21')](function(_0xad83d5){if(_0xad83d5){_0x111e89[_0x2842('0x6c')]=_0xad83d5[_0x2842('0x69')]({'plain':!![]});interaction_log[_0x2842('0x22')](_0x2842('0x6d'),_0x503398[_0x2842('0x66')]['id'],_0x503398[_0x2842('0x66')]['name'],_0x503398[_0x2842('0x66')][_0x2842('0x6e')],_0x111e89[_0x2842('0x6c')]['id'],_0x503398['body']?JSON['stringify'](_0x503398['body']):_0x2842('0x6f'));return respondWithRpcPromise(_0x2842('0x70'),_0x2842('0x71'),_0x111e89);}return null;})[_0x2842('0x21')](function(_0x4eebb6){var _0x419f33=_0x2842('0x72')+_0x4eebb6[_0x2842('0x2a')][_0x2842('0x73')];return db[_0x2842('0x74')]['query'](_0x419f33,{'type':db['Sequelize'][_0x2842('0x75')][_0x2842('0x76')],'raw':!![]})[_0x2842('0x21')](function(_0x10e0e1){return _0x10e0e1;});})[_0x2842('0x21')](function(_0x597c2a){if(_0x597c2a){_0x111e89['message'][_0x2842('0x77')]=_0x597c2a[0x0];if(!_0x503398[_0x2842('0x5d')][_0x2842('0x68')])return;return db[_0x2842('0x78')][_0x2842('0x5b')]({'where':{'id':_0x503398[_0x2842('0x5d')][_0x2842('0x68')],'role':_0x2842('0x67')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x3c98b7){if(!_0x3c98b7)return null;_0x111e89[_0x2842('0x2a')][_0x2842('0x67')]=_0x3c98b7;return _0x111e89;})[_0x2842('0x21')](function(_0x5edbcc){if(_0x5edbcc){if(_0x503398[_0x2842('0x5d')]['manual']){_0x111e89[_0x2842('0x2a')][_0x2842('0x79')]=util['format'](_0x2842('0x7a'),_0x503398[_0x2842('0x66')]['name']);_0x111e89[_0x2842('0x2a')][_0x2842('0x7b')]=_0x111e89[_0x2842('0x7b')];_0x111e89[_0x2842('0x2a')][_0x2842('0x7c')]=_0x111e89[_0x2842('0x7b')];_0x111e89[_0x2842('0x2a')][_0x2842('0x7d')]=_0x2842('0x60');return respondWithRpcPromise('EventManager',_0x2842('0x7e'),{'event':'acceptmessage','message':_0x111e89[_0x2842('0x2a')]},client9002)[_0x2842('0x21')](function(){return _0x111e89;});}return _0x111e89;}return null;})[_0x2842('0x21')](respondWithResult(_0x47a431,null))[_0x2842('0x2c')](handleError(_0x47a431,null));};var interaction_log=require(_0x2842('0x14'))(_0x2842('0x5f'));exports[_0x2842('0x36')]=function(_0x211d4e,_0x57e261,_0x2157c0){var _0x539a7d={'agent':{},'channel':_0x2842('0x61')};if(_0x211d4e[_0x2842('0x5d')]['id']){delete _0x211d4e['body']['id'];}_0x211d4e[_0x2842('0x5d')]['UserId']=_0x211d4e['body'][_0x2842('0x68')]||_0x211d4e['user']['id'];_0x539a7d[_0x2842('0x67')]['id']=_0x211d4e[_0x2842('0x5d')]['UserId'];return db[_0x2842('0x54')][_0x2842('0x5b')]({'where':{'id':_0x211d4e['params']['id'],'UserId':null}})[_0x2842('0x21')](handleEntityNotFound(_0x57e261,null))[_0x2842('0x21')](function(_0x25445f){if(_0x25445f){_0x539a7d[_0x2842('0x2a')]=_0x25445f[_0x2842('0x69')]({'plain':!![]});return db[_0x2842('0x7f')][_0x2842('0x5b')]({'where':{'id':_0x25445f['WhatsappInteractionId']}});}return null;})[_0x2842('0x21')](handleEntityNotFound(_0x57e261,null))[_0x2842('0x21')](function(_0x7c7b6d){if(_0x7c7b6d){_0x539a7d['interaction']=_0x7c7b6d[_0x2842('0x69')]({'plain':!![]});interaction_log[_0x2842('0x22')](_0x2842('0x80'),_0x211d4e[_0x2842('0x66')]['id'],_0x211d4e['user'][_0x2842('0x3b')],_0x211d4e['user'][_0x2842('0x6e')],_0x539a7d[_0x2842('0x6c')]['id'],_0x211d4e[_0x2842('0x5d')]?JSON['stringify'](_0x211d4e[_0x2842('0x5d')]):'null');return respondWithRpcPromise(_0x2842('0x81'),_0x2842('0x82'),_0x539a7d);}return null;})['then'](function(_0x175691){var _0x207086='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x175691[_0x2842('0x2a')][_0x2842('0x73')];return db[_0x2842('0x74')][_0x2842('0x43')](_0x207086,{'type':db[_0x2842('0x83')][_0x2842('0x75')][_0x2842('0x76')],'raw':!![]})[_0x2842('0x21')](function(_0x2a7e8a){return _0x2a7e8a;});})[_0x2842('0x21')](function(_0x450efa){if(_0x450efa){_0x539a7d['message'][_0x2842('0x77')]=_0x450efa[0x0];if(!_0x211d4e[_0x2842('0x5d')][_0x2842('0x68')])return;return db[_0x2842('0x78')][_0x2842('0x5b')]({'where':{'id':_0x211d4e[_0x2842('0x5d')][_0x2842('0x68')],'role':_0x2842('0x67')},'attributes':['id',_0x2842('0x3b'),'fullname',_0x2842('0x84'),_0x2842('0x85')],'raw':!![]});}return null;})[_0x2842('0x21')](function(_0x267217){if(!_0x267217)return null;_0x539a7d[_0x2842('0x2a')][_0x2842('0x67')]=_0x267217;return _0x539a7d;})[_0x2842('0x21')](function(_0x101b95){if(_0x101b95){_0x101b95['message'][_0x2842('0x79')]=util['format'](_0x2842('0x7a'),_0x211d4e['user']['name']);_0x101b95[_0x2842('0x2a')][_0x2842('0x7b')]=_0x539a7d[_0x2842('0x7b')];_0x101b95[_0x2842('0x2a')]['motionChannel']=_0x539a7d[_0x2842('0x7b')];_0x101b95[_0x2842('0x2a')][_0x2842('0x7d')]='reject';respondWithRpcPromise(_0x2842('0x7e'),'EventManager',{'event':'rejectmessage','message':_0x101b95[_0x2842('0x2a')]},client9002);return _0x539a7d;}return null;})[_0x2842('0x21')](respondWithResult(_0x57e261,null))[_0x2842('0x2c')](handleError(_0x57e261,null));};exports[_0x2842('0x2d')]=function(_0x405247,_0x4718ae,_0x102e93){if(_0x405247['body']['id']){delete _0x405247[_0x2842('0x5d')]['id'];}var _0x48ab0d;return db['WhatsappMessage'][_0x2842('0x5b')]({'where':{'id':_0x405247[_0x2842('0x58')]['id']}})[_0x2842('0x21')](handleEntityNotFound(_0x4718ae,null))[_0x2842('0x21')](function(_0x2bcd48){if(_0x2bcd48){_0x48ab0d=_0x2bcd48;return db[_0x2842('0x86')][_0x2842('0x5b')]({'where':{'id':_0x2bcd48[_0x2842('0x87')]}});}})[_0x2842('0x21')](handleEntityNotFound(_0x4718ae,null))[_0x2842('0x21')](function(_0x290d5a){if(_0x290d5a){logger[_0x2842('0x24')](_0x2842('0x88'),'status',_0x2842('0x89'),_0x290d5a[_0x2842('0x40')],util[_0x2842('0x8a')](_0x405247[_0x2842('0x5d')],{'showHidden':![],'depth':null}));switch(_0x290d5a[_0x2842('0x40')]){case _0x2842('0x8b'):if(_0x405247['body'][_0x2842('0x8c')]&&_0x405247[_0x2842('0x5d')]['MessageSid']===_0x48ab0d[_0x2842('0x8d')]&&_0x405247[_0x2842('0x5d')][_0x2842('0x8e')]&&_0x405247['body'][_0x2842('0x8e')]===_0x2842('0x62')){return _0x48ab0d['update']({'read':!![]});}else{logger[_0x2842('0x27')](_0x2842('0x8f'),_0x2842('0x2d'),_0x2842('0x8b'),util[_0x2842('0x8a')](_0x405247['body'],{'showHidden':![],'depth':null}));}break;}return _0x48ab0d;}})[_0x2842('0x21')](respondWithResult(_0x4718ae,null))['catch'](handleError(_0x4718ae,null));}; \ No newline at end of file +var _0x2989=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','sequelize','internal','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','read','twilio'];(function(_0x4a5791,_0x1bb81b){var _0x2f3aa0=function(_0x2c6d5e){while(--_0x2c6d5e){_0x4a5791['push'](_0x4a5791['shift']());}};_0x2f3aa0(++_0x1bb81b);}(_0x2989,0x1b6));var _0x9298=function(_0x544760,_0x392ead){_0x544760=_0x544760-0x0;var _0x2cb028=_0x2989[_0x544760];return _0x2cb028;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9298('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9298('0x1'));var rp=require(_0x9298('0x2'));var moment=require(_0x9298('0x3'));var BPromise=require(_0x9298('0x4'));var Mustache=require(_0x9298('0x5'));var util=require(_0x9298('0x6'));var path=require(_0x9298('0x7'));var sox=require(_0x9298('0x8'));var csv=require(_0x9298('0x9'));var ejs=require(_0x9298('0xa'));var fs=require('fs');var fs_extra=require(_0x9298('0xb'));var _=require(_0x9298('0xc'));var squel=require(_0x9298('0xd'));var crypto=require(_0x9298('0xe'));var jsforce=require(_0x9298('0xf'));var deskjs=require(_0x9298('0x10'));var toCsv=require(_0x9298('0x9'));var querystring=require('querystring');var Papa=require(_0x9298('0x11'));var Redis=require(_0x9298('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9298('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9298('0x14'));var logger=require('../../config/logger')(_0x9298('0x15'));var utils=require(_0x9298('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9298('0x17'));var db=require(_0x9298('0x18'))['db'];config[_0x9298('0x19')]=_[_0x9298('0x1a')](config[_0x9298('0x19')],{'host':_0x9298('0x1b'),'port':0x18eb});var socket=require(_0x9298('0x1c'))(new Redis(config[_0x9298('0x19')]));require('./whatsappMessage.socket')[_0x9298('0x1d')](socket);var jayson=require(_0x9298('0x1e'));var client=jayson[_0x9298('0x1f')][_0x9298('0x20')]({'port':0x232c});var client9002=jayson[_0x9298('0x1f')][_0x9298('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4e357c,_0x55136b,_0xc87ae8,_0x4132da){return new BPromise(function(_0x16d0bd,_0x594ad6){var _0x14a8d1=_0x4132da||client;return _0x14a8d1[_0x9298('0x21')](_0x4e357c,_0xc87ae8)[_0x9298('0x22')](function(_0x60cbae){logger[_0x9298('0x23')](_0x9298('0x24'),_0x55136b,_0x9298('0x25'));logger[_0x9298('0x26')](_0x9298('0x27'),_0x55136b,_0x9298('0x25'),JSON[_0x9298('0x28')](_0x60cbae));if(_0x60cbae['error']){if(_0x60cbae[_0x9298('0x29')][_0x9298('0x2a')]===0x1f4){logger[_0x9298('0x29')](_0x9298('0x24'),_0x55136b,_0x60cbae[_0x9298('0x29')][_0x9298('0x2b')]);return _0x594ad6(_0x60cbae[_0x9298('0x29')][_0x9298('0x2b')]);}logger['error'](_0x9298('0x24'),_0x55136b,_0x60cbae[_0x9298('0x29')][_0x9298('0x2b')]);return _0x16d0bd(_0x60cbae[_0x9298('0x29')][_0x9298('0x2b')]);}else{logger['info'](_0x9298('0x24'),_0x55136b,_0x9298('0x25'));_0x16d0bd(_0x60cbae[_0x9298('0x2c')][_0x9298('0x2b')]);}})[_0x9298('0x2d')](function(_0x4b1ed3){logger['error'](_0x9298('0x24'),_0x55136b,_0x4b1ed3);_0x594ad6(_0x4b1ed3);});});}function respondWithStatusCode(_0x37ea44,_0x3b96da){_0x3b96da=_0x3b96da||0xcc;return function(_0x292c66){if(_0x292c66){return _0x37ea44[_0x9298('0x2e')](_0x3b96da);}return _0x37ea44[_0x9298('0x2f')](_0x3b96da)[_0x9298('0x30')]();};}function respondWithResult(_0x557bba,_0x10c19b){_0x10c19b=_0x10c19b||0xc8;return function(_0x1e5112){if(_0x1e5112){return _0x557bba['status'](_0x10c19b)[_0x9298('0x31')](_0x1e5112);}};}function respondWithFilteredResult(_0x4aeaeb,_0x59745d){return function(_0x40025d){if(_0x40025d){var _0x44c87d=typeof _0x59745d[_0x9298('0x32')]===_0x9298('0x33')&&typeof _0x59745d[_0x9298('0x34')]===_0x9298('0x33');var _0x165e73=_0x40025d[_0x9298('0x35')];var _0x1a1105=_0x44c87d?0x0:_0x59745d[_0x9298('0x32')];var _0x1d16a0=_0x44c87d?_0x40025d[_0x9298('0x35')]:_0x59745d[_0x9298('0x32')]+_0x59745d['limit'];var _0x1b687f;if(_0x1d16a0>=_0x165e73){_0x1d16a0=_0x165e73;_0x1b687f=0xc8;}else{_0x1b687f=0xce;}_0x4aeaeb['status'](_0x1b687f);return _0x4aeaeb['set'](_0x9298('0x36'),_0x1a1105+'-'+_0x1d16a0+'/'+_0x165e73)[_0x9298('0x31')](_0x40025d);}return null;};}function patchUpdates(_0x379a64){return function(_0x5b1cc1){try{jsonpatch[_0x9298('0x37')](_0x5b1cc1,_0x379a64,!![]);}catch(_0x36e8ae){return BPromise[_0x9298('0x38')](_0x36e8ae);}return _0x5b1cc1[_0x9298('0x39')]();};}function saveUpdates(_0x3c1ce6,_0x2630b7){return function(_0x5ef038){if(_0x5ef038){return _0x5ef038[_0x9298('0x3a')](_0x3c1ce6)[_0x9298('0x22')](function(_0x10b9ff){return _0x10b9ff;});}return null;};}function removeEntity(_0x12a15e,_0x4f35cc){return function(_0xd52463){if(_0xd52463){return _0xd52463[_0x9298('0x3b')]()[_0x9298('0x22')](function(){_0x12a15e[_0x9298('0x2f')](0xcc)[_0x9298('0x30')]();});}};}function handleEntityNotFound(_0x226ef8,_0x2fdb6e){return function(_0x3df830){if(!_0x3df830){_0x226ef8[_0x9298('0x2e')](0x194);}return _0x3df830;};}function handleError(_0x24924b,_0x1471ad){_0x1471ad=_0x1471ad||0x1f4;return function(_0x3a00f5){logger[_0x9298('0x29')](_0x3a00f5[_0x9298('0x3c')]);if(_0x3a00f5[_0x9298('0x3d')]){delete _0x3a00f5['name'];}_0x24924b[_0x9298('0x2f')](_0x1471ad)[_0x9298('0x3e')](_0x3a00f5);};}exports[_0x9298('0x3f')]=function(_0x4f43b4,_0x5ac660){var _0x93a2b9={},_0x3fdd74={},_0x265d42={'count':0x0,'rows':[]};var _0x43f297=_[_0x9298('0x40')](db[_0x9298('0x41')][_0x9298('0x42')],function(_0x28e24e){return{'name':_0x28e24e[_0x9298('0x43')],'type':_0x28e24e[_0x9298('0x44')][_0x9298('0x45')]};});_0x3fdd74[_0x9298('0x46')]=_['map'](_0x43f297,_0x9298('0x3d'));_0x3fdd74[_0x9298('0x47')]=_[_0x9298('0x48')](_0x4f43b4[_0x9298('0x47')]);_0x3fdd74['filters']=_[_0x9298('0x49')](_0x3fdd74[_0x9298('0x46')],_0x3fdd74['query']);_0x93a2b9[_0x9298('0x4a')]=_[_0x9298('0x49')](_0x3fdd74[_0x9298('0x46')],qs['fields'](_0x4f43b4[_0x9298('0x47')]['fields']));_0x93a2b9['attributes']=_0x93a2b9[_0x9298('0x4a')][_0x9298('0x4b')]?_0x93a2b9[_0x9298('0x4a')]:_0x3fdd74[_0x9298('0x46')];if(!_0x4f43b4[_0x9298('0x47')]['hasOwnProperty'](_0x9298('0x4c'))){_0x93a2b9[_0x9298('0x34')]=qs[_0x9298('0x34')](_0x4f43b4[_0x9298('0x47')][_0x9298('0x34')]);_0x93a2b9[_0x9298('0x32')]=qs[_0x9298('0x32')](_0x4f43b4[_0x9298('0x47')]['offset']);}_0x93a2b9['order']=qs[_0x9298('0x4d')](_0x4f43b4[_0x9298('0x47')][_0x9298('0x4d')]);_0x93a2b9['where']=qs[_0x9298('0x4e')](_[_0x9298('0x4f')](_0x4f43b4['query'],_0x3fdd74['filters']),_0x43f297);if(_0x4f43b4[_0x9298('0x47')][_0x9298('0x50')]){_0x93a2b9[_0x9298('0x51')]=_[_0x9298('0x52')](_0x93a2b9[_0x9298('0x51')],{'$or':_[_0x9298('0x40')](_0x43f297,function(_0xefab0f){if(_0xefab0f[_0x9298('0x44')]!==_0x9298('0x53')){var _0x3aa299={};_0x3aa299[_0xefab0f[_0x9298('0x3d')]]={'$like':'%'+_0x4f43b4[_0x9298('0x47')][_0x9298('0x50')]+'%'};return _0x3aa299;}})});}_0x93a2b9=_[_0x9298('0x52')]({},_0x93a2b9,_0x4f43b4[_0x9298('0x54')]);var _0x3d5169={'where':_0x93a2b9[_0x9298('0x51')]};return db[_0x9298('0x41')]['count'](_0x3d5169)[_0x9298('0x22')](function(_0x590ecd){_0x265d42[_0x9298('0x35')]=_0x590ecd;if(_0x4f43b4['query'][_0x9298('0x55')]){_0x93a2b9[_0x9298('0x56')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x9298('0x57')](_0x93a2b9);})[_0x9298('0x22')](function(_0x23c33e){_0x265d42[_0x9298('0x58')]=_0x23c33e;return _0x265d42;})[_0x9298('0x22')](respondWithFilteredResult(_0x5ac660,_0x93a2b9))[_0x9298('0x2d')](handleError(_0x5ac660,null));};exports[_0x9298('0x59')]=function(_0x4bde60,_0x3e6a90){var _0x57a700={'raw':!![],'where':{'id':_0x4bde60[_0x9298('0x5a')]['id']}},_0x8bfcdd={};_0x8bfcdd[_0x9298('0x46')]=_['keys'](db['WhatsappMessage'][_0x9298('0x42')]);_0x8bfcdd[_0x9298('0x47')]=_[_0x9298('0x48')](_0x4bde60[_0x9298('0x47')]);_0x8bfcdd[_0x9298('0x4e')]=_[_0x9298('0x49')](_0x8bfcdd[_0x9298('0x46')],_0x8bfcdd['query']);_0x57a700[_0x9298('0x4a')]=_[_0x9298('0x49')](_0x8bfcdd['model'],qs['fields'](_0x4bde60['query'][_0x9298('0x5b')]));_0x57a700[_0x9298('0x4a')]=_0x57a700[_0x9298('0x4a')][_0x9298('0x4b')]?_0x57a700[_0x9298('0x4a')]:_0x8bfcdd['model'];if(_0x4bde60[_0x9298('0x47')][_0x9298('0x55')]){_0x57a700[_0x9298('0x56')]=[{'all':!![]}];}_0x57a700=_['merge']({},_0x57a700,_0x4bde60['options']);return db[_0x9298('0x41')][_0x9298('0x5c')](_0x57a700)[_0x9298('0x22')](handleEntityNotFound(_0x3e6a90,null))[_0x9298('0x22')](respondWithResult(_0x3e6a90,null))[_0x9298('0x2d')](handleError(_0x3e6a90,null));};exports[_0x9298('0x5d')]=function(_0x1ed019,_0x116d30){return db[_0x9298('0x41')][_0x9298('0x5d')](_0x1ed019[_0x9298('0x5e')],{})[_0x9298('0x22')](respondWithResult(_0x116d30,0xc9))['catch'](handleError(_0x116d30,null));};exports[_0x9298('0x3a')]=function(_0x225686,_0x370f3a){if(_0x225686[_0x9298('0x5e')]['id']){delete _0x225686[_0x9298('0x5e')]['id'];}return db[_0x9298('0x41')][_0x9298('0x5c')]({'where':{'id':_0x225686[_0x9298('0x5a')]['id']}})['then'](handleEntityNotFound(_0x370f3a,null))[_0x9298('0x22')](saveUpdates(_0x225686[_0x9298('0x5e')],null))[_0x9298('0x22')](respondWithResult(_0x370f3a,null))[_0x9298('0x2d')](handleError(_0x370f3a,null));};exports['destroy']=function(_0xdc6d4c,_0x35f8b9){return db[_0x9298('0x41')][_0x9298('0x5c')]({'where':{'id':_0xdc6d4c[_0x9298('0x5a')]['id']}})[_0x9298('0x22')](handleEntityNotFound(_0x35f8b9,null))['then'](removeEntity(_0x35f8b9,null))[_0x9298('0x2d')](handleError(_0x35f8b9,null));};exports[_0x9298('0x5f')]=function(_0x2f0966,_0x5bf2b3){return db[_0x9298('0x41')]['describe']()[_0x9298('0x22')](respondWithResult(_0x5bf2b3,null))[_0x9298('0x2d')](handleError(_0x5bf2b3,null));};var interaction_log=require(_0x9298('0x60'))(_0x9298('0x61'));exports[_0x9298('0x62')]=function(_0x5142dd,_0x4738b4,_0x449ddc){var _0x3b8736={'agent':{},'channel':_0x9298('0x63')};if(_0x5142dd[_0x9298('0x5e')]['id']){delete _0x5142dd['body']['id'];}_0x5142dd[_0x9298('0x5e')]['read']=!![];_0x5142dd[_0x9298('0x5e')]['readAt']=moment()[_0x9298('0x64')](_0x9298('0x65'));_0x5142dd[_0x9298('0x5e')][_0x9298('0x66')]=_0x5142dd[_0x9298('0x5e')][_0x9298('0x66')]||_0x5142dd[_0x9298('0x67')]['id'];_0x3b8736[_0x9298('0x68')]['id']=_0x5142dd[_0x9298('0x5e')][_0x9298('0x66')];return db[_0x9298('0x41')][_0x9298('0x5c')]({'where':{'id':_0x5142dd[_0x9298('0x5a')]['id'],'UserId':null}})[_0x9298('0x22')](handleEntityNotFound(_0x4738b4,null))[_0x9298('0x22')](saveUpdates(_0x5142dd[_0x9298('0x5e')],null))[_0x9298('0x22')](function(_0x5739e1){if(_0x5739e1){_0x3b8736['message']=_0x5739e1[_0x9298('0x69')]({'plain':!![]});return db[_0x9298('0x6a')][_0x9298('0x5c')]({'where':{'id':_0x5739e1['WhatsappInteractionId']}});}return null;})[_0x9298('0x22')](handleEntityNotFound(_0x4738b4,null))[_0x9298('0x22')](function(_0x4209fa){if(_0x4209fa){return _0x4209fa[_0x9298('0x3a')]({'UserId':_0x5142dd[_0x9298('0x5e')][_0x9298('0x66')],'read1stAt':_[_0x9298('0x6b')](_0x4209fa[_0x9298('0x6c')])?moment()[_0x9298('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9298('0x22')](function(_0x440634){if(_0x440634){_0x3b8736[_0x9298('0x6d')]=_0x440634['get']({'plain':!![]});interaction_log['info'](_0x9298('0x6e'),_0x5142dd['user']['id'],_0x5142dd[_0x9298('0x67')]['name'],_0x5142dd[_0x9298('0x67')]['role'],_0x3b8736[_0x9298('0x6d')]['id'],_0x5142dd['body']?JSON[_0x9298('0x28')](_0x5142dd['body']):'null');return respondWithRpcPromise(_0x9298('0x6f'),_0x9298('0x70'),_0x3b8736);}return null;})['then'](function(_0x1944fc){var _0x292856=_0x9298('0x71')+_0x1944fc[_0x9298('0x2b')][_0x9298('0x72')];return db['sequelize']['query'](_0x292856,{'type':db[_0x9298('0x73')][_0x9298('0x74')][_0x9298('0x75')],'raw':!![]})[_0x9298('0x22')](function(_0x4e999a){return _0x4e999a;});})[_0x9298('0x22')](function(_0x1fe176){if(_0x1fe176){_0x3b8736[_0x9298('0x2b')][_0x9298('0x76')]=_0x1fe176[0x0];if(!_0x5142dd[_0x9298('0x5e')]['UserId'])return;return db[_0x9298('0x77')][_0x9298('0x5c')]({'where':{'id':_0x5142dd['body'][_0x9298('0x66')],'role':_0x9298('0x68')},'attributes':['id','name',_0x9298('0x78'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x58197e){if(!_0x58197e)return null;_0x3b8736['message'][_0x9298('0x68')]=_0x58197e;return _0x3b8736;})[_0x9298('0x22')](function(_0x54b976){if(_0x54b976){if(_0x5142dd[_0x9298('0x5e')][_0x9298('0x79')]){_0x3b8736[_0x9298('0x2b')][_0x9298('0x7a')]=util[_0x9298('0x64')](_0x9298('0x7b'),_0x5142dd[_0x9298('0x67')][_0x9298('0x3d')]);_0x3b8736['message'][_0x9298('0x7c')]=_0x3b8736[_0x9298('0x7c')];_0x3b8736[_0x9298('0x2b')]['motionChannel']=_0x3b8736['channel'];_0x3b8736[_0x9298('0x2b')]['event']=_0x9298('0x62');return respondWithRpcPromise(_0x9298('0x7d'),_0x9298('0x7d'),{'event':_0x9298('0x7e'),'message':_0x3b8736[_0x9298('0x2b')]},client9002)['then'](function(){return _0x3b8736;});}return _0x3b8736;}return null;})[_0x9298('0x22')](respondWithResult(_0x4738b4,null))['catch'](handleError(_0x4738b4,null));};var interaction_log=require(_0x9298('0x60'))(_0x9298('0x61'));exports[_0x9298('0x38')]=function(_0x4b5abb,_0x31eca2,_0x5b5f18){var _0x18e323={'agent':{},'channel':_0x9298('0x63')};if(_0x4b5abb[_0x9298('0x5e')]['id']){delete _0x4b5abb[_0x9298('0x5e')]['id'];}_0x4b5abb[_0x9298('0x5e')][_0x9298('0x66')]=_0x4b5abb[_0x9298('0x5e')][_0x9298('0x66')]||_0x4b5abb[_0x9298('0x67')]['id'];_0x18e323[_0x9298('0x68')]['id']=_0x4b5abb[_0x9298('0x5e')][_0x9298('0x66')];return db[_0x9298('0x41')][_0x9298('0x5c')]({'where':{'id':_0x4b5abb[_0x9298('0x5a')]['id'],'UserId':null}})[_0x9298('0x22')](handleEntityNotFound(_0x31eca2,null))[_0x9298('0x22')](function(_0x4259d1){if(_0x4259d1){_0x18e323[_0x9298('0x2b')]=_0x4259d1['get']({'plain':!![]});return db['WhatsappInteraction'][_0x9298('0x5c')]({'where':{'id':_0x4259d1[_0x9298('0x7f')]}});}return null;})[_0x9298('0x22')](handleEntityNotFound(_0x31eca2,null))[_0x9298('0x22')](function(_0x29f367){if(_0x29f367){_0x18e323['interaction']=_0x29f367[_0x9298('0x69')]({'plain':!![]});interaction_log[_0x9298('0x23')](_0x9298('0x80'),_0x4b5abb[_0x9298('0x67')]['id'],_0x4b5abb['user'][_0x9298('0x3d')],_0x4b5abb['user'][_0x9298('0x81')],_0x18e323[_0x9298('0x6d')]['id'],_0x4b5abb[_0x9298('0x5e')]?JSON[_0x9298('0x28')](_0x4b5abb['body']):_0x9298('0x82'));return respondWithRpcPromise(_0x9298('0x83'),_0x9298('0x84'),_0x18e323);}return null;})['then'](function(_0x219232){var _0x2ed81d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x219232[_0x9298('0x2b')]['ContactId'];return db[_0x9298('0x85')][_0x9298('0x47')](_0x2ed81d,{'type':db['Sequelize'][_0x9298('0x74')][_0x9298('0x75')],'raw':!![]})['then'](function(_0x46aad4){return _0x46aad4;});})[_0x9298('0x22')](function(_0x120700){if(_0x120700){_0x18e323[_0x9298('0x2b')][_0x9298('0x76')]=_0x120700[0x0];if(!_0x4b5abb[_0x9298('0x5e')]['UserId'])return;return db[_0x9298('0x77')][_0x9298('0x5c')]({'where':{'id':_0x4b5abb[_0x9298('0x5e')]['UserId'],'role':_0x9298('0x68')},'attributes':['id','name',_0x9298('0x78'),'email',_0x9298('0x86')],'raw':!![]});}return null;})[_0x9298('0x22')](function(_0x150194){if(!_0x150194)return null;_0x18e323[_0x9298('0x2b')]['agent']=_0x150194;return _0x18e323;})[_0x9298('0x22')](function(_0x241c02){if(_0x241c02){_0x241c02[_0x9298('0x2b')][_0x9298('0x7a')]=util[_0x9298('0x64')](_0x9298('0x7b'),_0x4b5abb[_0x9298('0x67')][_0x9298('0x3d')]);_0x241c02[_0x9298('0x2b')][_0x9298('0x7c')]=_0x18e323[_0x9298('0x7c')];_0x241c02['message']['motionChannel']=_0x18e323[_0x9298('0x7c')];_0x241c02['message'][_0x9298('0x87')]=_0x9298('0x38');respondWithRpcPromise(_0x9298('0x7d'),'EventManager',{'event':_0x9298('0x88'),'message':_0x241c02[_0x9298('0x2b')]},client9002);return _0x18e323;}return null;})[_0x9298('0x22')](respondWithResult(_0x31eca2,null))[_0x9298('0x2d')](handleError(_0x31eca2,null));};exports[_0x9298('0x2f')]=function(_0x5095cf,_0x1b0be6,_0x491835){if(_0x5095cf[_0x9298('0x5e')]['id']){delete _0x5095cf[_0x9298('0x5e')]['id'];}var _0x1b6062;return db[_0x9298('0x41')][_0x9298('0x5c')]({'where':{'id':_0x5095cf[_0x9298('0x5a')]['id']}})[_0x9298('0x22')](handleEntityNotFound(_0x1b0be6,null))[_0x9298('0x22')](function(_0x1989a8){if(_0x1989a8){_0x1b6062=_0x1989a8;return db[_0x9298('0x89')][_0x9298('0x5c')]({'where':{'id':_0x1989a8[_0x9298('0x8a')]}});}})[_0x9298('0x22')](handleEntityNotFound(_0x1b0be6,null))[_0x9298('0x22')](function(_0x522109){if(_0x522109){logger[_0x9298('0x26')](_0x9298('0x8b'),_0x9298('0x2f'),'received\x20delivery\x20report\x20from',_0x522109['type'],util[_0x9298('0x8c')](_0x5095cf[_0x9298('0x5e')],{'showHidden':![],'depth':null}));switch(_0x522109[_0x9298('0x44')]){case'twilio':if(_0x5095cf[_0x9298('0x5e')][_0x9298('0x8d')]&&_0x5095cf[_0x9298('0x5e')]['MessageSid']===_0x1b6062[_0x9298('0x8e')]&&_0x5095cf[_0x9298('0x5e')][_0x9298('0x8f')]&&_0x5095cf['body'][_0x9298('0x8f')]===_0x9298('0x90')){return _0x1b6062['update']({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x9298('0x2f'),_0x9298('0x91'),util['inspect'](_0x5095cf[_0x9298('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1b6062;}})[_0x9298('0x22')](respondWithResult(_0x1b0be6,null))[_0x9298('0x2d')](handleError(_0x1b0be6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index cd60439..529c3f9 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 _0x5c00=['WhatsappMessage','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x487177,_0x1ddcd6){var _0x147202=function(_0xa5105){while(--_0xa5105){_0x487177['push'](_0x487177['shift']());}};_0x147202(++_0x1ddcd6);}(_0x5c00,0x17e));var _0x05c0=function(_0x347884,_0xd8ef37){_0x347884=_0x347884-0x0;var _0x2cd3fa=_0x5c00[_0x347884];return _0x2cd3fa;};'use strict';var EventEmitter=require(_0x05c0('0x0'));var WhatsappMessage=require(_0x05c0('0x1'))['db'][_0x05c0('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05c0('0x3'),'afterUpdate':'update','afterDestroy':_0x05c0('0x4')};function emitEvent(_0x25c3a9){return function(_0x37b644,_0x28d9c7,_0x565efc){WhatsappMessageEvents[_0x05c0('0x5')](_0x25c3a9+':'+_0x37b644['id'],_0x37b644);WhatsappMessageEvents[_0x05c0('0x5')](_0x25c3a9,_0x37b644);_0x565efc(null);};}for(var e in events){if(events[_0x05c0('0x6')](e)){var event=events[e];WhatsappMessage[_0x05c0('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x6b20=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x6b20,0xd1));var _0x06b2=function(_0x20092b,_0x3c31ac){_0x20092b=_0x20092b-0x0;var _0x15c57d=_0x6b20[_0x20092b];return _0x15c57d;};'use strict';var EventEmitter=require(_0x06b2('0x0'));var WhatsappMessage=require(_0x06b2('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x06b2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x06b2('0x3'),'afterDestroy':_0x06b2('0x4')};function emitEvent(_0x353f6a){return function(_0x5ba392,_0x311643,_0x3ea357){WhatsappMessageEvents[_0x06b2('0x5')](_0x353f6a+':'+_0x5ba392['id'],_0x5ba392);WhatsappMessageEvents[_0x06b2('0x5')](_0x353f6a,_0x5ba392);_0x3ea357(null);};}for(var e in events){if(events[_0x06b2('0x6')](e)){var event=events[e];WhatsappMessage[_0x06b2('0x7')](e,emitEvent(event));}}module[_0x06b2('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 106e956..ff42188 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 _0x34ab=['messages','create','whatsapp:','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','/whatsapp/v1/','/messages/','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId','then','update','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone'];(function(_0x2079e7,_0xdc5145){var _0x5a26c9=function(_0x29422d){while(--_0x29422d){_0x2079e7['push'](_0x2079e7['shift']());}};_0x5a26c9(++_0xdc5145);}(_0x34ab,0xf1));var _0xb34a=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x34ab[_0x5e9a69];return _0x5979c8;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var logger=require(_0xb34a('0x2'))(_0xb34a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb34a('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xb34a('0x5'));var rimraf=require(_0xb34a('0x6'));var config=require(_0xb34a('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb34a('0x8')]=function(_0x1f6df3,_0x2c7c79){return _0x1f6df3[_0xb34a('0x9')](_0xb34a('0xa'),attributes,{'tableName':_0xb34a('0xb'),'paranoid':![],'indexes':[{'name':_0xb34a('0xc'),'fields':['messageId']},{'name':_0xb34a('0xd'),'fields':[_0xb34a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22f097,_0x3888c8,_0x351970){var _0x53f630=_0x1f6df3[_0xb34a('0xf')];var _0x468c1b=_0x22f097[_0xb34a('0x10')]({'plain':!![]});if(_0x468c1b[_0xb34a('0x11')][_0xb34a('0x12')]()==='in'||_0x468c1b[_0xb34a('0x11')][_0xb34a('0x12')]()===_0xb34a('0x13')&&!_0x468c1b[_0xb34a('0x14')]&&!_['isNil'](_0x468c1b[_0xb34a('0x15')])){_0x53f630['WhatsappInteraction'][_0xb34a('0x16')]({'where':{'id':_0x468c1b[_0xb34a('0x17')]}})[_0xb34a('0x18')](function(_0x7f4b87){if(_0x7f4b87){_0x7f4b87[_0xb34a('0x19')]({'lastMsgAt':_0x468c1b['createdAt'],'lastMsgDirection':_0x468c1b[_0xb34a('0x11')][_0xb34a('0x12')]()});}})['catch'](function(_0x573c6c){console[_0xb34a('0x1a')](_0x573c6c);});}if(_0x468c1b[_0xb34a('0x11')]===_0xb34a('0x13')&&!_0x468c1b['secret']){var _0x3d3404;_0x53f630[_0xb34a('0x1b')][_0xb34a('0x1c')]({'where':{'id':_0x468c1b[_0xb34a('0x1d')]},'raw':!![]})['then'](function(_0x5ed23c){_0x3d3404=_0x5ed23c;if(_0x3d3404&&_0x3d3404[_0xb34a('0x1e')]){switch(_0x3d3404[_0xb34a('0x1e')]){case _0xb34a('0x1f'):var _0x15d0ae=require(_0xb34a('0x1f'));if(_0x3d3404[_0xb34a('0x20')]&&_0x3d3404['authToken']&&_0x3d3404[_0xb34a('0x21')]){var _0x4532d7=new _0x15d0ae(_0x3d3404[_0xb34a('0x20')],_0x3d3404['authToken']);_0x4532d7[_0xb34a('0x22')][_0xb34a('0x23')]({'body':_0x468c1b[_0xb34a('0xe')],'to':_0xb34a('0x24')+_0x468c1b[_0xb34a('0x21')],'from':'whatsapp:'+_0x3d3404[_0xb34a('0x21')],'statusCallback':_0x3d3404['remote']+'/api/whatsapp/messages/'+_0x468c1b['id']+_0xb34a('0x25')+_0x3d3404[_0xb34a('0x26')]})[_0xb34a('0x18')](function(_0x4ddb88){if(_0x4ddb88['sid']){return _0x22f097[_0xb34a('0x19')]({'messageId':_0x4ddb88[_0xb34a('0x27')]});}})['catch'](function(_0x195846){logger[_0xb34a('0x1a')](_0xb34a('0x28'),_0xb34a('0x29'),_0xb34a('0x1f'),util['inspect'](_0x195846,{'showHidden':![],'depth':null}));});}else{logger[_0xb34a('0x1a')](_0xb34a('0x28'),'afterCreate',_0xb34a('0x1f'),_0xb34a('0x2a'));}break;case _0xb34a('0x2b'):var _0x23bc41=_0x3d3404['accountSid'];var _0x487d46=_0x3d3404[_0xb34a('0x2c')];var _0x8cc74d=_0x3d3404['baseUrl']+_0xb34a('0x2d')+_0x23bc41+_0xb34a('0x2e');var _0x442baf={'to':[_0x468c1b[_0xb34a('0x21')]],'message':{'type':'text','text':_0x468c1b[_0xb34a('0xe')]}};var _0x198e52={'method':'POST','uri':_0x8cc74d,'headers':{'Authorization':_0xb34a('0x2f')+_0x487d46,'Content-Type':_0xb34a('0x30')},'body':_0x442baf,'json':!![]};rp(_0x198e52)[_0xb34a('0x18')](function(_0x23e5aa){if(_0x23e5aa[_0xb34a('0x31')][0x0][_0xb34a('0x32')]){return _0x22f097[_0xb34a('0x19')]({'messageId':_0x23e5aa[_0xb34a('0x31')][0x0][_0xb34a('0x32')]});}})['catch'](function(_0x321cce){logger[_0xb34a('0x33')](_0xb34a('0x34'),_0x321cce);});break;}}})['finally'](function(){_0x351970();});}else{_0x351970();}}},'charset':_0xb34a('0x35'),'collate':_0xb34a('0x36')});}; \ No newline at end of file +var _0x27dc=['baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','catch','error','WhatsappAccount','find','WhatsappAccountId','then','twilio','authToken','phone','accountSid','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x4777d9,_0x32ba6e){var _0xb5bb71=function(_0x209d5d){while(--_0x209d5d){_0x4777d9['push'](_0x4777d9['shift']());}};_0xb5bb71(++_0x32ba6e);}(_0x27dc,0xe9));var _0xc27d=function(_0x6ba6c8,_0x1b1166){_0x6ba6c8=_0x6ba6c8-0x0;var _0x1e3e19=_0x27dc[_0x6ba6c8];return _0x1e3e19;};'use strict';var _=require(_0xc27d('0x0'));var util=require('util');var logger=require(_0xc27d('0x1'))(_0xc27d('0x2'));var moment=require(_0xc27d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xc27d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc27d('0x5'));var config=require(_0xc27d('0x6'));var attributes=require(_0xc27d('0x7'));module[_0xc27d('0x8')]=function(_0x4464e0,_0x956533){return _0x4464e0['define'](_0xc27d('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc27d('0xa'),'fields':[_0xc27d('0xa')]},{'name':_0xc27d('0xb'),'fields':['body'],'type':_0xc27d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11c553,_0x3206ce,_0x1e25d4){var _0x19bd0f=_0x4464e0[_0xc27d('0xd')];var _0x314144=_0x11c553['get']({'plain':!![]});if(_0x314144[_0xc27d('0xe')]['toLowerCase']()==='in'||_0x314144[_0xc27d('0xe')][_0xc27d('0xf')]()===_0xc27d('0x10')&&!_0x314144[_0xc27d('0x11')]&&!_['isNil'](_0x314144[_0xc27d('0x12')])){_0x19bd0f[_0xc27d('0x13')][_0xc27d('0x14')]({'where':{'id':_0x314144[_0xc27d('0x15')]}})['then'](function(_0x512e05){if(_0x512e05){_0x512e05[_0xc27d('0x16')]({'lastMsgAt':_0x314144['createdAt'],'lastMsgDirection':_0x314144[_0xc27d('0xe')][_0xc27d('0xf')]()});}})[_0xc27d('0x17')](function(_0x89a47e){console[_0xc27d('0x18')](_0x89a47e);});}if(_0x314144[_0xc27d('0xe')]==='out'&&!_0x314144[_0xc27d('0x11')]){var _0xdaf259;_0x19bd0f[_0xc27d('0x19')][_0xc27d('0x1a')]({'where':{'id':_0x314144[_0xc27d('0x1b')]},'raw':!![]})[_0xc27d('0x1c')](function(_0xd1227f){_0xdaf259=_0xd1227f;if(_0xdaf259&&_0xdaf259['type']){switch(_0xdaf259['type']){case _0xc27d('0x1d'):var _0x2bb7d8=require(_0xc27d('0x1d'));if(_0xdaf259['accountSid']&&_0xdaf259[_0xc27d('0x1e')]&&_0xdaf259[_0xc27d('0x1f')]){var _0x1bedaa=new _0x2bb7d8(_0xdaf259[_0xc27d('0x20')],_0xdaf259[_0xc27d('0x1e')]);_0x1bedaa[_0xc27d('0x21')][_0xc27d('0x22')]({'body':_0x314144[_0xc27d('0x23')],'to':_0xc27d('0x24')+_0x314144[_0xc27d('0x1f')],'from':_0xc27d('0x24')+_0xdaf259[_0xc27d('0x1f')],'statusCallback':_0xdaf259[_0xc27d('0x25')]+_0xc27d('0x26')+_0x314144['id']+_0xc27d('0x27')+_0xdaf259[_0xc27d('0x28')]})[_0xc27d('0x1c')](function(_0x27a2f3){if(_0x27a2f3[_0xc27d('0x29')]){return _0x11c553[_0xc27d('0x16')]({'messageId':_0x27a2f3[_0xc27d('0x29')]});}})[_0xc27d('0x17')](function(_0x2cf112){logger[_0xc27d('0x18')](_0xc27d('0x2a'),_0xc27d('0x2b'),_0xc27d('0x1d'),util[_0xc27d('0x2c')](_0x2cf112,{'showHidden':![],'depth':null}));});}else{logger[_0xc27d('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc27d('0x1d'),_0xc27d('0x2d'));}break;case _0xc27d('0x2e'):var _0x15f595=_0xdaf259['accountSid'];var _0x5978bb=_0xdaf259[_0xc27d('0x1e')];var _0x9c429=_0xdaf259[_0xc27d('0x2f')]+'/whatsapp/v1/'+_0x15f595+_0xc27d('0x30');var _0x34fa13={'to':[_0x314144[_0xc27d('0x1f')]],'message':{'type':_0xc27d('0x31'),'text':_0x314144[_0xc27d('0x23')]}};var _0x3760ae={'method':_0xc27d('0x32'),'uri':_0x9c429,'headers':{'Authorization':_0xc27d('0x33')+_0x5978bb,'Content-Type':'application/json'},'body':_0x34fa13,'json':!![]};rp(_0x3760ae)[_0xc27d('0x1c')](function(_0x22c53b){if(_0x22c53b[_0xc27d('0x34')][0x0][_0xc27d('0x35')]){return _0x11c553['update']({'messageId':_0x22c53b[_0xc27d('0x34')][0x0]['message_id']});}})[_0xc27d('0x17')](function(_0x529ce6){logger['err']('WhatsappMessage,\x20%s',_0x529ce6);});break;}}})['finally'](function(){_0x1e25d4();});}else{_0x1e25d4();}}},'charset':_0xc27d('0x36'),'collate':_0xc27d('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index baf456a..49e1bdf 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 _0xf5eb=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','create','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xe42f5,_0x526183){var _0xc7b5ec=function(_0x31036e){while(--_0x31036e){_0xe42f5['push'](_0xe42f5['shift']());}};_0xc7b5ec(++_0x526183);}(_0xf5eb,0x181));var _0xbf5e=function(_0x25c26,_0x84fc41){_0x25c26=_0x25c26-0x0;var _0x321e20=_0xf5eb[_0x25c26];return _0x321e20;};'use strict';var _=require('lodash');var util=require(_0xbf5e('0x0'));var moment=require(_0xbf5e('0x1'));var BPromise=require(_0xbf5e('0x2'));var rs=require(_0xbf5e('0x3'));var fs=require('fs');var Redis=require(_0xbf5e('0x4'));var db=require(_0xbf5e('0x5'))['db'];var utils=require(_0xbf5e('0x6'));var logger=require(_0xbf5e('0x7'))(_0xbf5e('0x8'));var config=require(_0xbf5e('0x9'));var jayson=require(_0xbf5e('0xa'));var client=jayson[_0xbf5e('0xb')]['http']({'port':0x232a});config[_0xbf5e('0xc')]=_[_0xbf5e('0xd')](config[_0xbf5e('0xc')],{'host':_0xbf5e('0xe'),'port':0x18eb});var socket=require(_0xbf5e('0xf'))(new Redis(config[_0xbf5e('0xc')]));require(_0xbf5e('0x10'))[_0xbf5e('0x11')](socket);function respondWithRpcPromise(_0x5d1332,_0x2f1964,_0x22535e){return new BPromise(function(_0x5405b7,_0x41292a){return client[_0xbf5e('0x12')](_0x5d1332,_0x22535e)[_0xbf5e('0x13')](function(_0x45902a){logger[_0xbf5e('0x14')](_0xbf5e('0x15'),_0x2f1964,_0xbf5e('0x16'));logger['debug'](_0xbf5e('0x17'),_0x2f1964,_0xbf5e('0x16'),JSON[_0xbf5e('0x18')](_0x45902a));if(_0x45902a[_0xbf5e('0x19')]){if(_0x45902a[_0xbf5e('0x19')][_0xbf5e('0x1a')]===0x1f4){logger[_0xbf5e('0x19')](_0xbf5e('0x15'),_0x2f1964,_0x45902a[_0xbf5e('0x19')]['message']);return _0x41292a(_0x45902a[_0xbf5e('0x19')][_0xbf5e('0x1b')]);}logger['error'](_0xbf5e('0x15'),_0x2f1964,_0x45902a[_0xbf5e('0x19')][_0xbf5e('0x1b')]);return _0x5405b7(_0x45902a[_0xbf5e('0x19')][_0xbf5e('0x1b')]);}else{logger[_0xbf5e('0x14')](_0xbf5e('0x15'),_0x2f1964,'request\x20sent');_0x5405b7(_0x45902a['result'][_0xbf5e('0x1b')]);}})[_0xbf5e('0x1c')](function(_0x175160){logger[_0xbf5e('0x19')](_0xbf5e('0x15'),_0x2f1964,_0x175160);_0x41292a(_0x175160);});});}exports[_0xbf5e('0x1d')]=function(_0x3b9f2b){var _0x5441ff=this;return new Promise(function(_0x7da6ec,_0x532af1){return db['WhatsappMessage'][_0xbf5e('0x1e')](_0x3b9f2b['body'],{'raw':_0x3b9f2b[_0xbf5e('0x1f')]?_0x3b9f2b[_0xbf5e('0x1f')][_0xbf5e('0x20')]===undefined?!![]:![]:!![]})[_0xbf5e('0x13')](function(_0x4b4041){logger[_0xbf5e('0x14')](_0xbf5e('0x1d'),_0x3b9f2b);logger[_0xbf5e('0x21')](_0xbf5e('0x1d'),_0x3b9f2b,JSON[_0xbf5e('0x18')](_0x4b4041));_0x7da6ec(_0x4b4041);})['catch'](function(_0xd62326){logger[_0xbf5e('0x19')](_0xbf5e('0x1d'),_0xd62326['message'],_0x3b9f2b);_0x532af1(_0x5441ff[_0xbf5e('0x19')](0x1f4,_0xd62326[_0xbf5e('0x1b')]));});});}; \ No newline at end of file +var _0x481e=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappMessage','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x50ba3a,_0x2afbd0){var _0x5a8554=function(_0x26e2d8){while(--_0x26e2d8){_0x50ba3a['push'](_0x50ba3a['shift']());}};_0x5a8554(++_0x2afbd0);}(_0x481e,0x106));var _0xe481=function(_0x5a03ff,_0x406efa){_0x5a03ff=_0x5a03ff-0x0;var _0x42bfb5=_0x481e[_0x5a03ff];return _0x42bfb5;};'use strict';var _=require(_0xe481('0x0'));var util=require(_0xe481('0x1'));var moment=require(_0xe481('0x2'));var BPromise=require(_0xe481('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe481('0x4'));var db=require(_0xe481('0x5'))['db'];var utils=require(_0xe481('0x6'));var logger=require('../../config/logger')(_0xe481('0x7'));var config=require(_0xe481('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe481('0x9')][_0xe481('0xa')]({'port':0x232a});config[_0xe481('0xb')]=_[_0xe481('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe481('0xd'))(new Redis(config[_0xe481('0xb')]));require(_0xe481('0xe'))[_0xe481('0xf')](socket);function respondWithRpcPromise(_0x456142,_0x1adb7f,_0x4c2e43){return new BPromise(function(_0x22acf0,_0x506d14){return client['request'](_0x456142,_0x4c2e43)[_0xe481('0x10')](function(_0x377d3b){logger[_0xe481('0x11')](_0xe481('0x12'),_0x1adb7f,_0xe481('0x13'));logger[_0xe481('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1adb7f,_0xe481('0x13'),JSON[_0xe481('0x15')](_0x377d3b));if(_0x377d3b[_0xe481('0x16')]){if(_0x377d3b[_0xe481('0x16')]['code']===0x1f4){logger[_0xe481('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1adb7f,_0x377d3b[_0xe481('0x16')][_0xe481('0x17')]);return _0x506d14(_0x377d3b['error'][_0xe481('0x17')]);}logger['error'](_0xe481('0x12'),_0x1adb7f,_0x377d3b[_0xe481('0x16')][_0xe481('0x17')]);return _0x22acf0(_0x377d3b['error'][_0xe481('0x17')]);}else{logger[_0xe481('0x11')](_0xe481('0x12'),_0x1adb7f,'request\x20sent');_0x22acf0(_0x377d3b[_0xe481('0x18')][_0xe481('0x17')]);}})[_0xe481('0x19')](function(_0x28398c){logger[_0xe481('0x16')](_0xe481('0x12'),_0x1adb7f,_0x28398c);_0x506d14(_0x28398c);});});}exports[_0xe481('0x1a')]=function(_0x27ba43){var _0x37581a=this;return new Promise(function(_0x1a983b,_0x3668c1){return db['WhatsappMessage']['create'](_0x27ba43[_0xe481('0x1b')],{'raw':_0x27ba43[_0xe481('0x1c')]?_0x27ba43[_0xe481('0x1c')][_0xe481('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3610d7){logger[_0xe481('0x11')](_0xe481('0x1a'),_0x27ba43);logger[_0xe481('0x14')](_0xe481('0x1a'),_0x27ba43,JSON[_0xe481('0x15')](_0x3610d7));_0x1a983b(_0x3610d7);})[_0xe481('0x19')](function(_0x58e7fe){logger[_0xe481('0x16')](_0xe481('0x1a'),_0x58e7fe[_0xe481('0x17')],_0x27ba43);_0x3668c1(_0x37581a[_0xe481('0x16')](0x1f4,_0x58e7fe[_0xe481('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9f1fca0..4973215 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 _0x4da4=['whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register','length'];(function(_0x392d1d,_0x486c41){var _0xb1282a=function(_0x113aeb){while(--_0x113aeb){_0x392d1d['push'](_0x392d1d['shift']());}};_0xb1282a(++_0x486c41);}(_0x4da4,0x121));var _0x44da=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0x4da4[_0x2a2e72];return _0x3cfb4a;};'use strict';var WhatsappMessageEvents=require(_0x44da('0x0'));var events=[_0x44da('0x1'),_0x44da('0x2'),_0x44da('0x3')];function createListener(_0x34ae85,_0x16ae98){return function(_0x3ce28e){_0x16ae98['emit'](_0x34ae85,_0x3ce28e);};}function removeListener(_0xa9c515,_0x321280){return function(){WhatsappMessageEvents[_0x44da('0x4')](_0xa9c515,_0x321280);};}exports[_0x44da('0x5')]=function(_0x1f4758){for(var _0x2ba114=0x0,_0x4db5e7=events[_0x44da('0x6')];_0x2ba114<_0x4db5e7;_0x2ba114++){var _0x3ba248=events[_0x2ba114];var _0x5798b2=createListener(_0x44da('0x7')+_0x3ba248,_0x1f4758);WhatsappMessageEvents['on'](_0x3ba248,_0x5798b2);}}; \ No newline at end of file +var _0x5715=['whatsappMessage:','./whatsappMessage.events','save','emit','removeListener','register','length'];(function(_0x50944f,_0x76bd49){var _0x304575=function(_0x31f885){while(--_0x31f885){_0x50944f['push'](_0x50944f['shift']());}};_0x304575(++_0x76bd49);}(_0x5715,0x71));var _0x5571=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x5715[_0x5be7aa];return _0x215408;};'use strict';var WhatsappMessageEvents=require(_0x5571('0x0'));var events=[_0x5571('0x1'),'remove','update'];function createListener(_0x587705,_0x304e48){return function(_0x2c6724){_0x304e48[_0x5571('0x2')](_0x587705,_0x2c6724);};}function removeListener(_0x4cb3d7,_0x23f6e2){return function(){WhatsappMessageEvents[_0x5571('0x3')](_0x4cb3d7,_0x23f6e2);};}exports[_0x5571('0x4')]=function(_0x4f68c8){for(var _0x113d21=0x0,_0x404454=events[_0x5571('0x5')];_0x113d21<_0x404454;_0x113d21++){var _0x433abe=events[_0x113d21];var _0x1889d6=createListener(_0x5571('0x6')+_0x433abe,_0x4f68c8);WhatsappMessageEvents['on'](_0x433abe,_0x1889d6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 519881b..6e95a14 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 _0x61cb=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','express','Router'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x61cb,0xbf));var _0xb61c=function(_0x1f6ba3,_0x5b7a1d){_0x1f6ba3=_0x1f6ba3-0x0;var _0x218b24=_0x61cb[_0x1f6ba3];return _0x218b24;};'use strict';var multer=require(_0xb61c('0x0'));var util=require(_0xb61c('0x1'));var path=require(_0xb61c('0x2'));var timeout=require('connect-timeout');var express=require(_0xb61c('0x3'));var router=express[_0xb61c('0x4')]();var fs_extra=require(_0xb61c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb61c('0x6'));var config=require(_0xb61c('0x7'));var controller=require(_0xb61c('0x8'));router[_0xb61c('0x9')]('/',auth[_0xb61c('0xa')](),controller[_0xb61c('0xb')]);router['get'](_0xb61c('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb61c('0xd'),auth[_0xb61c('0xa')](),controller[_0xb61c('0xe')]);router[_0xb61c('0x9')](_0xb61c('0xf'),auth[_0xb61c('0xa')](),controller[_0xb61c('0x10')]);router[_0xb61c('0x9')](_0xb61c('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb61c('0x9')](_0xb61c('0x12'),auth[_0xb61c('0xa')](),controller['getAgents']);router[_0xb61c('0x13')]('/',auth[_0xb61c('0xa')](),controller['create']);router[_0xb61c('0x13')](_0xb61c('0x11'),auth[_0xb61c('0xa')](),controller[_0xb61c('0x14')]);router[_0xb61c('0x13')]('/:id/users',auth[_0xb61c('0xa')](),controller['addAgents']);router[_0xb61c('0x15')](_0xb61c('0xd'),auth[_0xb61c('0xa')](),controller[_0xb61c('0x16')]);router['delete'](_0xb61c('0xd'),auth[_0xb61c('0xa')](),controller[_0xb61c('0x17')]);router['delete']('/:id/teams',auth[_0xb61c('0xa')](),controller[_0xb61c('0x18')]);router[_0xb61c('0x19')](_0xb61c('0x12'),auth[_0xb61c('0xa')](),controller[_0xb61c('0x1a')]);module[_0xb61c('0x1b')]=router; \ No newline at end of file +var _0x99e9=['post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents'];(function(_0xbd1eb5,_0x14e1f7){var _0x5eba88=function(_0xd541d9){while(--_0xd541d9){_0xbd1eb5['push'](_0xbd1eb5['shift']());}};_0x5eba88(++_0x14e1f7);}(_0x99e9,0x137));var _0x999e=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x99e9[_0x3b5ad9];return _0x611ae9;};'use strict';var multer=require(_0x999e('0x0'));var util=require(_0x999e('0x1'));var path=require(_0x999e('0x2'));var timeout=require('connect-timeout');var express=require(_0x999e('0x3'));var router=express[_0x999e('0x4')]();var fs_extra=require(_0x999e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x999e('0x6'));var config=require(_0x999e('0x7'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x999e('0x8')]);router[_0x999e('0x9')](_0x999e('0xa'),auth[_0x999e('0xb')](),controller[_0x999e('0xc')]);router[_0x999e('0x9')](_0x999e('0xd'),auth[_0x999e('0xb')](),controller[_0x999e('0xe')]);router[_0x999e('0x9')]('/:id/members',auth[_0x999e('0xb')](),controller[_0x999e('0xf')]);router[_0x999e('0x9')](_0x999e('0x10'),auth['isAuthenticated'](),controller[_0x999e('0x11')]);router['get']('/:id/users',auth[_0x999e('0xb')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')]('/',auth[_0x999e('0xb')](),controller[_0x999e('0x14')]);router[_0x999e('0x13')](_0x999e('0x10'),auth[_0x999e('0xb')](),controller[_0x999e('0x15')]);router['post'](_0x999e('0x16'),auth['isAuthenticated'](),controller[_0x999e('0x17')]);router[_0x999e('0x18')](_0x999e('0xd'),auth[_0x999e('0xb')](),controller['update']);router[_0x999e('0x19')]('/:id',auth[_0x999e('0xb')](),controller[_0x999e('0x1a')]);router[_0x999e('0x19')](_0x999e('0x10'),auth['isAuthenticated'](),controller[_0x999e('0x1b')]);router[_0x999e('0x19')](_0x999e('0x16'),auth['isAuthenticated'](),controller[_0x999e('0x1c')]);module[_0x999e('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 0d54eab..0a8203e 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 _0x138d=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x3ef6ed,_0x8c54b){var _0x422936=function(_0x2b4f3a){while(--_0x2b4f3a){_0x3ef6ed['push'](_0x3ef6ed['shift']());}};_0x422936(++_0x8c54b);}(_0x138d,0x1ab));var _0xd138=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0x138d[_0x114d1f];return _0x5b91d4;};'use strict';var Sequelize=require(_0xd138('0x0'));module[_0xd138('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd138('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xd138('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd138('0x4')](_0xd138('0x5'),_0xd138('0x6'),_0xd138('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbbfa=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x59a5d0,_0x4b3308){_0x59a5d0=_0x59a5d0-0x0;var _0x6840ac=_0xbbfa[_0x59a5d0];return _0x6840ac;};'use strict';var Sequelize=require(_0xabbf('0x0'));module['exports']={'name':{'type':Sequelize[_0xabbf('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xabbf('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabbf('0x3')](_0xabbf('0x4'),_0xabbf('0x5'),_0xabbf('0x6'))},'description':{'type':Sequelize[_0xabbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 717c502..2894e6a 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 _0xcf91=['UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','omit','getAgents','bluebird','lodash','squel','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','json','offset','limit','count','set','Content-Range','then','destroy','get','UserProfileResource','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','error','body','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x58df37,_0xa0cc7b){var _0x491b76=function(_0x55c225){while(--_0x55c225){_0x58df37['push'](_0x58df37['shift']());}};_0x491b76(++_0xa0cc7b);}(_0xcf91,0xac));var _0x1cf9=function(_0x231508,_0x5bb273){_0x231508=_0x231508-0x0;var _0xe2468e=_0xcf91[_0x231508];return _0xe2468e;};'use strict';var BPromise=require(_0x1cf9('0x0'));var util=require('util');var _=require(_0x1cf9('0x1'));var squel=require(_0x1cf9('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1cf9('0x3'))(_0x1cf9('0x4'));var config=require('../../config/environment');var db=require(_0x1cf9('0x5'))['db'];config[_0x1cf9('0x6')]=_[_0x1cf9('0x7')](config[_0x1cf9('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cf9('0x8'))(new Redis(config[_0x1cf9('0x6')]));require(_0x1cf9('0x9'))['register'](socket);function respondWithStatusCode(_0x2a03e7,_0x40823f){_0x40823f=_0x40823f||0xcc;return function(_0x49406b){if(_0x49406b){return _0x2a03e7[_0x1cf9('0xa')](_0x40823f);}return _0x2a03e7['status'](_0x40823f)[_0x1cf9('0xb')]();};}function respondWithResult(_0x32e50f,_0x4ed431){_0x4ed431=_0x4ed431||0xc8;return function(_0x2fffd8){if(_0x2fffd8){return _0x32e50f[_0x1cf9('0xc')](_0x4ed431)[_0x1cf9('0xd')](_0x2fffd8);}};}function respondWithFilteredResult(_0x284a28,_0xb15be6){return function(_0x51fb29){if(_0x51fb29){var _0x394960=typeof _0xb15be6[_0x1cf9('0xe')]==='undefined'&&typeof _0xb15be6[_0x1cf9('0xf')]==='undefined';var _0x387b66=_0x51fb29[_0x1cf9('0x10')];var _0x487451=_0x394960?0x0:_0xb15be6[_0x1cf9('0xe')];var _0x2a645d=_0x394960?_0x51fb29[_0x1cf9('0x10')]:_0xb15be6[_0x1cf9('0xe')]+_0xb15be6[_0x1cf9('0xf')];var _0x59eef6;if(_0x2a645d>=_0x387b66){_0x2a645d=_0x387b66;_0x59eef6=0xc8;}else{_0x59eef6=0xce;}_0x284a28[_0x1cf9('0xc')](_0x59eef6);return _0x284a28[_0x1cf9('0x11')](_0x1cf9('0x12'),_0x487451+'-'+_0x2a645d+'/'+_0x387b66)[_0x1cf9('0xd')](_0x51fb29);}return null;};}function saveUpdates(_0x56697f){return function(_0x550648){if(_0x550648){return _0x550648['update'](_0x56697f)[_0x1cf9('0x13')](function(_0x769d8a){return _0x769d8a;});}return null;};}function removeEntity(_0x5aeeac){return function(_0x47046b){if(_0x47046b){return _0x47046b[_0x1cf9('0x14')]()['then'](function(){var _0x482c02=_0x47046b[_0x1cf9('0x15')]({'plain':!![]});var _0x3576ff='WhatsappQueues';return db[_0x1cf9('0x16')][_0x1cf9('0x14')]({'where':{'type':_0x3576ff,'resourceId':_0x482c02['id']}})['then'](function(){return _0x47046b;});})[_0x1cf9('0x13')](function(){_0x5aeeac['status'](0xcc)[_0x1cf9('0xb')]();});}};}function handleEntityNotFound(_0x1c4f4e){return function(_0x292267){if(!_0x292267){_0x1c4f4e['sendStatus'](0x194);}return _0x292267;};}function handleError(_0x169dbf,_0x5b7a10){_0x5b7a10=_0x5b7a10||0x1f4;return function(_0x385026){logger['error'](_0x385026[_0x1cf9('0x17')]);if(_0x385026[_0x1cf9('0x18')]){delete _0x385026[_0x1cf9('0x18')];}_0x169dbf[_0x1cf9('0xc')](_0x5b7a10)[_0x1cf9('0x19')](_0x385026);};}exports['index']=function(_0x46749b,_0x3decad){var _0x5da6fe={};var _0x3424f3={'count':0x0,'rows':[]};var _0x2f6b13=_[_0x1cf9('0x1a')](db[_0x1cf9('0x1b')][_0x1cf9('0x1c')],function(_0x436fe4){return{'name':_0x436fe4[_0x1cf9('0x1d')],'type':_0x436fe4[_0x1cf9('0x1e')]['key']};});_0x5da6fe=qs[_0x1cf9('0x1f')](_0x2f6b13,_0x46749b);var _0x301f44={'where':_0x5da6fe[_0x1cf9('0x20')]};return db[_0x1cf9('0x1b')][_0x1cf9('0x10')](_0x301f44)[_0x1cf9('0x13')](function(_0x398e21){_0x3424f3[_0x1cf9('0x10')]=_0x398e21;_0x5da6fe['include']=qs[_0x1cf9('0x21')](_0x46749b[_0x1cf9('0x22')]);return db[_0x1cf9('0x1b')]['findAll'](_0x5da6fe);})[_0x1cf9('0x13')](function(_0x484ed9){_0x3424f3[_0x1cf9('0x23')]=_0x484ed9;return _0x3424f3;})[_0x1cf9('0x13')](respondWithFilteredResult(_0x3decad,_0x5da6fe))[_0x1cf9('0x24')](handleError(_0x3decad,null));};exports[_0x1cf9('0x25')]=function(_0x1a505e,_0x4d7266){var _0x4c003d={'raw':!![],'where':{'id':_0x1a505e[_0x1cf9('0x26')]['id']}},_0x4dc187={};_0x4dc187['model']=_['keys'](db[_0x1cf9('0x1b')][_0x1cf9('0x1c')]);_0x4dc187[_0x1cf9('0x22')]=_[_0x1cf9('0x27')](_0x1a505e[_0x1cf9('0x22')]);_0x4dc187['filters']=_[_0x1cf9('0x28')](_0x4dc187[_0x1cf9('0x29')],_0x4dc187[_0x1cf9('0x22')]);_0x4c003d[_0x1cf9('0x2a')]=_[_0x1cf9('0x28')](_0x4dc187[_0x1cf9('0x29')],qs[_0x1cf9('0x2b')](_0x1a505e[_0x1cf9('0x22')][_0x1cf9('0x2b')]));_0x4c003d[_0x1cf9('0x2a')]=_0x4c003d[_0x1cf9('0x2a')][_0x1cf9('0x2c')]?_0x4c003d[_0x1cf9('0x2a')]:_0x4dc187[_0x1cf9('0x29')];if(_0x1a505e[_0x1cf9('0x22')][_0x1cf9('0x2d')]){_0x4c003d[_0x1cf9('0x21')]=[{'all':!![]}];}_0x4c003d=_[_0x1cf9('0x2e')]({},_0x4c003d,_0x1a505e[_0x1cf9('0x2f')]);return db[_0x1cf9('0x1b')][_0x1cf9('0x30')](_0x4c003d)['then'](handleEntityNotFound(_0x4d7266,null))['then'](respondWithResult(_0x4d7266,null))[_0x1cf9('0x24')](handleError(_0x4d7266,null));};exports['create']=function(_0x3c599f,_0x436e84){return db['WhatsappQueue'][_0x1cf9('0x31')](_0x3c599f['body'],{})[_0x1cf9('0x13')](function(_0x3e66d1){var _0x554666=_0x3c599f[_0x1cf9('0x32')]['get']({'plain':!![]});if(!_0x554666)throw new Error(_0x1cf9('0x33'));if(_0x554666[_0x1cf9('0x34')]===_0x1cf9('0x32')){var _0xdfbd25=_0x3e66d1[_0x1cf9('0x15')]({'plain':!![]});var _0x681112=_0x1cf9('0x35');return db[_0x1cf9('0x36')][_0x1cf9('0x30')]({'where':{'name':_0x681112,'userProfileId':_0x554666[_0x1cf9('0x37')]},'raw':!![]})[_0x1cf9('0x13')](function(_0x29825d){if(_0x29825d&&_0x29825d['autoAssociation']===0x0){return db[_0x1cf9('0x16')][_0x1cf9('0x31')]({'name':_0xdfbd25['name'],'resourceId':_0xdfbd25['id'],'type':_0x29825d[_0x1cf9('0x18')],'sectionId':_0x29825d['id']},{})[_0x1cf9('0x13')](function(){return _0x3e66d1;});}else{return _0x3e66d1;}})[_0x1cf9('0x24')](function(_0x14bb5c){logger[_0x1cf9('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14bb5c);throw _0x14bb5c;});}return _0x3e66d1;})[_0x1cf9('0x13')](respondWithResult(_0x436e84,0xc9))[_0x1cf9('0x24')](handleError(_0x436e84,null));};exports['update']=function(_0x1d217a,_0x210c8c){if(_0x1d217a[_0x1cf9('0x39')]['id']){delete _0x1d217a[_0x1cf9('0x39')]['id'];}return db[_0x1cf9('0x1b')][_0x1cf9('0x30')]({'where':{'id':_0x1d217a[_0x1cf9('0x26')]['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x210c8c,null))[_0x1cf9('0x13')](saveUpdates(_0x1d217a[_0x1cf9('0x39')],null))[_0x1cf9('0x13')](respondWithResult(_0x210c8c,null))['catch'](handleError(_0x210c8c,null));};exports[_0x1cf9('0x14')]=function(_0x2da9cb,_0x4c2dbe){return db[_0x1cf9('0x1b')][_0x1cf9('0x30')]({'where':{'id':_0x2da9cb['params']['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x4c2dbe,null))['then'](removeEntity(_0x4c2dbe,null))[_0x1cf9('0x24')](handleError(_0x4c2dbe,null));};exports[_0x1cf9('0x3a')]=function(_0x4397dc,_0x181337){return db[_0x1cf9('0x1b')][_0x1cf9('0x3a')]()[_0x1cf9('0x13')](respondWithResult(_0x181337,null))[_0x1cf9('0x24')](handleError(_0x181337,null));};exports[_0x1cf9('0x3b')]=function(_0x55bc61,_0x31ea10){var _0x33c37e={'raw':!![],'where':{}},_0x139eb6={},_0x2b0193;return db[_0x1cf9('0x1b')][_0x1cf9('0x3c')]({'where':{'id':_0x55bc61['params']['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x31ea10,null))[_0x1cf9('0x13')](function(_0x57fda0){if(_0x57fda0){_0x2b0193=_0x57fda0[_0x1cf9('0x15')]({'plain':!![]});_0x139eb6[_0x1cf9('0x29')]=_[_0x1cf9('0x27')](db['UserWhatsappQueue'][_0x1cf9('0x1c')]);_0x139eb6['query']=_['keys'](_0x55bc61[_0x1cf9('0x22')]);_0x139eb6[_0x1cf9('0x3d')]=_[_0x1cf9('0x28')](_0x139eb6[_0x1cf9('0x29')],_0x139eb6['query']);_0x33c37e[_0x1cf9('0x2a')]=_[_0x1cf9('0x28')](_0x139eb6[_0x1cf9('0x29')],qs[_0x1cf9('0x2b')](_0x55bc61[_0x1cf9('0x22')][_0x1cf9('0x2b')]));_0x33c37e[_0x1cf9('0x2a')]=_0x33c37e['attributes'][_0x1cf9('0x2c')]?_0x33c37e['attributes']:_0x139eb6[_0x1cf9('0x29')];if(!_0x55bc61[_0x1cf9('0x22')][_0x1cf9('0x3e')](_0x1cf9('0x3f'))){_0x33c37e[_0x1cf9('0xf')]=qs[_0x1cf9('0xf')](_0x55bc61['query']['limit']);_0x33c37e[_0x1cf9('0xe')]=qs[_0x1cf9('0xe')](_0x55bc61[_0x1cf9('0x22')]['offset']);}_0x33c37e[_0x1cf9('0x40')]=qs[_0x1cf9('0x41')](_0x55bc61[_0x1cf9('0x22')]['sort']);_0x33c37e[_0x1cf9('0x20')]=qs[_0x1cf9('0x3d')](_[_0x1cf9('0x42')](_0x55bc61[_0x1cf9('0x22')],_0x139eb6[_0x1cf9('0x3d')]));_0x33c37e['where']['WhatsappQueueId']=_0x57fda0['id'];if(_0x55bc61[_0x1cf9('0x22')][_0x1cf9('0x43')]){_0x33c37e[_0x1cf9('0x20')]=_[_0x1cf9('0x2e')](_0x33c37e[_0x1cf9('0x20')],{'$or':_['map'](_0x33c37e['attributes'],function(_0x26596c){var _0x467915={};_0x467915[_0x26596c]={'$like':'%'+_0x55bc61[_0x1cf9('0x22')][_0x1cf9('0x43')]+'%'};return _0x467915;})});}_0x33c37e=_[_0x1cf9('0x2e')]({},_0x33c37e,_0x55bc61['options']);return db[_0x1cf9('0x44')][_0x1cf9('0x45')](_0x33c37e);}})[_0x1cf9('0x13')](function(_0x2a4fb3){if(_0x2a4fb3){return db[_0x1cf9('0x46')][_0x1cf9('0x47')]({'where':{'id':_[_0x1cf9('0x1a')](_0x2a4fb3,_0x1cf9('0x48')),'role':_0x1cf9('0x49')},'attributes':['id',_0x1cf9('0x18'),_0x1cf9('0x4a'),_0x1cf9('0x4b'),'createdAt']});}})[_0x1cf9('0x13')](function(_0x2199c3){if(_0x2199c3){return{'count':_0x2199c3[_0x1cf9('0x10')],'rows':_[_0x1cf9('0x1a')](_0x2199c3[_0x1cf9('0x23')],function(_0x54b61a){return{'membername':_0x54b61a[_0x1cf9('0x18')],'UserId':_0x54b61a['id'],'queue_name':_0x2b0193['name'],'WhatsappQueueId':_0x2b0193['id'],'interface':util[_0x1cf9('0x4c')](_0x1cf9('0x4d'),_0x1cf9('0x4e'),_0x54b61a[_0x1cf9('0x18')]),'penalty':0x0,'paused':_0x54b61a[_0x1cf9('0x4a')],'createdAt':_0x54b61a[_0x1cf9('0x4f')],'updatedAt':_0x54b61a[_0x1cf9('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1cf9('0x13')](respondWithFilteredResult(_0x31ea10,_0x33c37e))[_0x1cf9('0x24')](handleError(_0x31ea10,null));};exports['getTeams']=function(_0x186dcf,_0x53a362){var _0x1ddc64={};var _0x41bdf5={};var _0x1bcd6b;var _0x3febe0;return db[_0x1cf9('0x1b')]['findOne']({'where':{'id':_0x186dcf[_0x1cf9('0x26')]['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x53a362,null))[_0x1cf9('0x13')](function(_0xbed44d){if(_0xbed44d){_0x1bcd6b=_0xbed44d;_0x41bdf5[_0x1cf9('0x29')]=_[_0x1cf9('0x27')](db[_0x1cf9('0x50')][_0x1cf9('0x1c')]);_0x41bdf5[_0x1cf9('0x22')]=_[_0x1cf9('0x27')](_0x186dcf[_0x1cf9('0x22')]);_0x41bdf5[_0x1cf9('0x3d')]=_[_0x1cf9('0x28')](_0x41bdf5['model'],_0x41bdf5['query']);_0x1ddc64['attributes']=_[_0x1cf9('0x28')](_0x41bdf5[_0x1cf9('0x29')],qs[_0x1cf9('0x2b')](_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0x2b')]));_0x1ddc64[_0x1cf9('0x2a')]=_0x1ddc64[_0x1cf9('0x2a')][_0x1cf9('0x2c')]?_0x1ddc64[_0x1cf9('0x2a')]:_0x41bdf5['model'];_0x1ddc64[_0x1cf9('0x40')]=qs[_0x1cf9('0x41')](_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0x41')]);_0x1ddc64['where']=qs[_0x1cf9('0x3d')](_[_0x1cf9('0x42')](_0x186dcf[_0x1cf9('0x22')],_0x41bdf5[_0x1cf9('0x3d')]));if(_0x186dcf[_0x1cf9('0x22')]['filter']){_0x1ddc64[_0x1cf9('0x20')]=_[_0x1cf9('0x2e')](_0x1ddc64['where'],{'$or':_[_0x1cf9('0x1a')](_0x1ddc64[_0x1cf9('0x2a')],function(_0x3424e0){var _0x96e024={};_0x96e024[_0x3424e0]={'$like':'%'+_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0x43')]+'%'};return _0x96e024;})});}_0x1ddc64=_[_0x1cf9('0x2e')]({},_0x1ddc64,_0x186dcf['options']);return _0x1bcd6b[_0x1cf9('0x51')](_0x1ddc64);}})[_0x1cf9('0x13')](function(_0x5a46ee){if(_0x5a46ee){_0x3febe0=_0x5a46ee['length'];if(!_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0x3e')]('nolimit')){_0x1ddc64['limit']=qs[_0x1cf9('0xf')](_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0xf')]);_0x1ddc64[_0x1cf9('0xe')]=qs['offset'](_0x186dcf[_0x1cf9('0x22')][_0x1cf9('0xe')]);}return _0x1bcd6b[_0x1cf9('0x51')](_0x1ddc64);}})[_0x1cf9('0x13')](function(_0x45ee3f){if(_0x45ee3f){return _0x45ee3f?{'count':_0x3febe0,'rows':_0x45ee3f}:null;}})[_0x1cf9('0x13')](respondWithResult(_0x53a362,null))[_0x1cf9('0x24')](handleError(_0x53a362,null));};exports['addTeams']=function(_0x38789b,_0x4e75a9){var _0x5d1b14=_0x38789b[_0x1cf9('0x39')][_0x1cf9('0x52')];return db[_0x1cf9('0x50')][_0x1cf9('0x45')]({'where':{'id':_0x5d1b14},'attributes':['id'],'include':[{'model':db[_0x1cf9('0x46')],'as':_0x1cf9('0x53'),'attributes':['id','name',_0x1cf9('0x54'),_0x1cf9('0x55'),_0x1cf9('0x56')],'raw':!![]}]})['then'](function(_0x30a295){if(_0x30a295){var _0x1a30ca=_[_0x1cf9('0x57')](_0x30a295,function(_0x55d3bc){var _0x39fd05=_0x55d3bc[_0x1cf9('0x15')]({'plain':!![]});return _0x39fd05['Agents'];});return db[_0x1cf9('0x1b')]['find']({'where':{'id':_0x38789b[_0x1cf9('0x26')]['id']}})[_0x1cf9('0x13')](function(_0x50169a){return db['sequelize'][_0x1cf9('0x58')](function(_0x3bc6c4){return _0x50169a[_0x1cf9('0x59')](_0x5d1b14,{'transaction':_0x3bc6c4})[_0x1cf9('0x13')](function(){return BPromise[_0x1cf9('0x5a')](_0x1a30ca,function(_0x183788){return db[_0x1cf9('0x44')]['findOrCreate']({'where':{'UserId':_0x183788['id'],'WhatsappQueueId':_0x38789b['params']['id']},'transaction':_0x3bc6c4});});})[_0x1cf9('0x13')](function(){_0x1a30ca[_0x1cf9('0x5b')](function(_0xe4e47a){socket[_0x1cf9('0x5c')](_0x1cf9('0x5d'),{'UserId':_0xe4e47a['id'],'WhatsappQueueId':_0x50169a['id']});});});});});}})[_0x1cf9('0x13')](respondWithStatusCode(_0x4e75a9,null))[_0x1cf9('0x24')](handleError(_0x4e75a9,null));};exports[_0x1cf9('0x5e')]=function(_0x4f9590,_0x43f414){return db['Team'][_0x1cf9('0x45')]({'where':{'id':_0x4f9590[_0x1cf9('0x22')][_0x1cf9('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1cf9('0x13')](handleEntityNotFound(_0x43f414,null))['then'](function(_0x33f799){var _0x3e62d5=_[_0x1cf9('0x1a')](_0x33f799,'id');var _0x32ace0=[];var _0x6cc2=[];var _0x309dca=squel[_0x1cf9('0x5f')]();_0x309dca[_0x1cf9('0x60')](_0x1cf9('0x61'))[_0x1cf9('0x62')](_0x1cf9('0x63'),'tq')[_0x1cf9('0x64')](_0x1cf9('0x65'),'ut',_0x1cf9('0x66'))[_0x1cf9('0x20')]('WhatsappQueueId\x20=\x20?',_0x4f9590['params']['id']);for(var _0xe5a60=0x0;_0xe5a60<_0x33f799[_0x1cf9('0x2c')];_0xe5a60+=0x1){let _0x2e7547=_0x33f799[_0xe5a60];for(var _0x5eb722=0x0;_0x5eb722<_0x2e7547[_0x1cf9('0x53')]['length'];_0x5eb722+=0x1){let _0x36761b=_0x2e7547[_0x1cf9('0x53')][_0x5eb722];var _0x4ab658=_0x309dca[_0x1cf9('0x67')]();_0x4ab658[_0x1cf9('0x20')](_0x1cf9('0x68'),_0x36761b['id']);_0x6cc2[_0x1cf9('0x69')](db[_0x1cf9('0x6a')]['query'](_0x4ab658['toString'](),{'type':db[_0x1cf9('0x6a')][_0x1cf9('0x6b')][_0x1cf9('0x6c')]})[_0x1cf9('0x13')](function(_0x188ae3){if(_0x188ae3[_0x1cf9('0x2c')]===0x1){return _0x36761b['id'];}else{var _0x3d2a92=_[_0x1cf9('0x6d')](_[_0x1cf9('0x1a')](_0x188ae3,_0x1cf9('0x6e')),function(_0x32e9bb){return _[_0x1cf9('0x6f')](_0x3e62d5,_0x32e9bb);});if(_0x3d2a92){return _0x36761b['id'];}}}));}}return BPromise['all'](_0x6cc2)[_0x1cf9('0x13')](function(_0x56068f){_0x32ace0=_(_0x32ace0)[_0x1cf9('0x70')](_0x56068f)[_0x1cf9('0x71')]()[_0x1cf9('0x72')]();return db['WhatsappQueue'][_0x1cf9('0x30')]({'where':{'id':_0x4f9590[_0x1cf9('0x26')]['id']}})['then'](function(_0x4d7bdd){return db[_0x1cf9('0x6a')][_0x1cf9('0x58')](function(_0x2108a8){return _0x4d7bdd[_0x1cf9('0x5e')](_0x4f9590[_0x1cf9('0x22')][_0x1cf9('0x52')],{'transaction':_0x2108a8})[_0x1cf9('0x13')](function(){if(!_[_0x1cf9('0x73')](_0x32ace0)){return _0x4d7bdd[_0x1cf9('0x74')](_0x32ace0,{'transaction':_0x2108a8});}})[_0x1cf9('0x13')](function(){_0x32ace0[_0x1cf9('0x5b')](function(_0x201e22){socket['emit'](_0x1cf9('0x75'),{'UserId':_0x201e22,'WhatsappQueueId':_0x4d7bdd['id']});});});});});});})['then'](respondWithStatusCode(_0x43f414,null))[_0x1cf9('0x24')](handleError(_0x43f414,null));};exports['addAgents']=function(_0x1b8f3f,_0x579b6c){return db['WhatsappQueue'][_0x1cf9('0x30')]({'where':{'id':_0x1b8f3f[_0x1cf9('0x26')]['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x579b6c,null))[_0x1cf9('0x13')](function(_0x49171a){if(_0x49171a){return _0x49171a['addAgents'](_0x1b8f3f[_0x1cf9('0x39')][_0x1cf9('0x52')],_[_0x1cf9('0x76')](_0x1b8f3f[_0x1cf9('0x39')],[_0x1cf9('0x52'),'id'])||{})['spread'](function(_0x57233d){for(var _0x4e5a84=0x0;_0x4e5a84<_0x1b8f3f[_0x1cf9('0x39')][_0x1cf9('0x52')][_0x1cf9('0x2c')];_0x4e5a84+=0x1){socket[_0x1cf9('0x5c')]('userWhatsappQueue:save',{'UserId':Number(_0x1b8f3f[_0x1cf9('0x39')]['ids'][_0x4e5a84]),'WhatsappQueueId':Number(_0x1b8f3f[_0x1cf9('0x26')]['id'])});}return _0x57233d;});}})['then'](respondWithResult(_0x579b6c,null))[_0x1cf9('0x24')](handleError(_0x579b6c,null));};exports[_0x1cf9('0x74')]=function(_0x11ec19,_0x3635be){return db[_0x1cf9('0x1b')][_0x1cf9('0x30')]({'where':{'id':_0x11ec19['params']['id']}})['then'](handleEntityNotFound(_0x3635be,null))['then'](function(_0x534a6a){if(_0x534a6a){return _0x534a6a[_0x1cf9('0x74')](_0x11ec19[_0x1cf9('0x22')][_0x1cf9('0x52')])['then'](function(){if(_['isArray'](_0x11ec19[_0x1cf9('0x22')][_0x1cf9('0x52')])){for(var _0x52ed9b=0x0;_0x52ed9b<_0x11ec19['query'][_0x1cf9('0x52')]['length'];_0x52ed9b+=0x1){socket[_0x1cf9('0x5c')](_0x1cf9('0x75'),{'UserId':Number(_0x11ec19[_0x1cf9('0x22')][_0x1cf9('0x52')][_0x52ed9b]),'WhatsappQueueId':Number(_0x11ec19[_0x1cf9('0x26')]['id'])});}}else{socket[_0x1cf9('0x5c')](_0x1cf9('0x75'),{'UserId':Number(_0x11ec19[_0x1cf9('0x22')]['ids']),'WhatsappQueueId':Number(_0x11ec19[_0x1cf9('0x26')]['id'])});}});}})[_0x1cf9('0x13')](respondWithStatusCode(_0x3635be,null))[_0x1cf9('0x24')](handleError(_0x3635be,null));};exports[_0x1cf9('0x77')]=function(_0x3ae86b,_0x588209){var _0x2eb258={};var _0x2bf778={};var _0x4a2b4d;var _0x40379d;return db['WhatsappQueue'][_0x1cf9('0x3c')]({'where':{'id':_0x3ae86b[_0x1cf9('0x26')]['id']}})[_0x1cf9('0x13')](handleEntityNotFound(_0x588209,null))[_0x1cf9('0x13')](function(_0x276bdd){if(_0x276bdd){_0x4a2b4d=_0x276bdd;_0x2bf778[_0x1cf9('0x29')]=_[_0x1cf9('0x27')](db['User'][_0x1cf9('0x1c')]);_0x2bf778[_0x1cf9('0x22')]=_['keys'](_0x3ae86b[_0x1cf9('0x22')]);_0x2bf778[_0x1cf9('0x3d')]=_['intersection'](_0x2bf778[_0x1cf9('0x29')],_0x2bf778[_0x1cf9('0x22')]);_0x2eb258[_0x1cf9('0x2a')]=_[_0x1cf9('0x28')](_0x2bf778[_0x1cf9('0x29')],qs[_0x1cf9('0x2b')](_0x3ae86b['query'][_0x1cf9('0x2b')]));_0x2eb258[_0x1cf9('0x2a')]=_0x2eb258[_0x1cf9('0x2a')]['length']?_0x2eb258['attributes']:_0x2bf778[_0x1cf9('0x29')];_0x2eb258[_0x1cf9('0x40')]=qs[_0x1cf9('0x41')](_0x3ae86b[_0x1cf9('0x22')][_0x1cf9('0x41')]);_0x2eb258[_0x1cf9('0x20')]=qs[_0x1cf9('0x3d')](_[_0x1cf9('0x42')](_0x3ae86b[_0x1cf9('0x22')],_0x2bf778[_0x1cf9('0x3d')]));if(_0x3ae86b['query'][_0x1cf9('0x43')]){_0x2eb258[_0x1cf9('0x20')]=_['merge'](_0x2eb258['where'],{'$or':_[_0x1cf9('0x1a')](_0x2eb258[_0x1cf9('0x2a')],function(_0x2ae855){var _0x19c52d={};_0x19c52d[_0x2ae855]={'$like':'%'+_0x3ae86b[_0x1cf9('0x22')]['filter']+'%'};return _0x19c52d;})});}_0x2eb258=_[_0x1cf9('0x2e')]({},_0x2eb258,_0x3ae86b[_0x1cf9('0x2f')]);return _0x4a2b4d[_0x1cf9('0x77')](_0x2eb258);}})[_0x1cf9('0x13')](function(_0x5ed7bb){if(_0x5ed7bb){_0x40379d=_0x5ed7bb[_0x1cf9('0x2c')];if(!_0x3ae86b[_0x1cf9('0x22')][_0x1cf9('0x3e')](_0x1cf9('0x3f'))){_0x2eb258['limit']=qs[_0x1cf9('0xf')](_0x3ae86b['query'][_0x1cf9('0xf')]);_0x2eb258[_0x1cf9('0xe')]=qs['offset'](_0x3ae86b[_0x1cf9('0x22')][_0x1cf9('0xe')]);}return _0x4a2b4d[_0x1cf9('0x77')](_0x2eb258);}})[_0x1cf9('0x13')](function(_0x219e00){if(_0x219e00){return _0x219e00?{'count':_0x40379d,'rows':_0x219e00}:null;}})[_0x1cf9('0x13')](respondWithResult(_0x588209,null))['catch'](handleError(_0x588209,null));}; \ No newline at end of file +var _0x515d=['role','UserProfileSection','userProfileId','getMembers','findOne','UserWhatsappQueue','order','sort','pick','WhatsappQueueId','filter','User','agent','updatedAt','format','%s/%s','whatsappPause','createdAt','Team','getTeams','hasOwnProperty','nolimit','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','WhatsappQueue','fieldName','type','getOptions','where','include','query','findAll','rows','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x45934a,_0x155e6c){var _0x3b441f=function(_0x3f6fd5){while(--_0x3f6fd5){_0x45934a['push'](_0x45934a['shift']());}};_0x3b441f(++_0x155e6c);}(_0x515d,0x1a6));var _0xd515=function(_0xf5ac97,_0x22a80b){_0xf5ac97=_0xf5ac97-0x0;var _0x576e78=_0x515d[_0xf5ac97];return _0x576e78;};'use strict';var BPromise=require(_0xd515('0x0'));var util=require(_0xd515('0x1'));var _=require(_0xd515('0x2'));var squel=require(_0xd515('0x3'));var Redis=require(_0xd515('0x4'));var qs=require(_0xd515('0x5'));var logger=require(_0xd515('0x6'))(_0xd515('0x7'));var config=require(_0xd515('0x8'));var db=require(_0xd515('0x9'))['db'];config[_0xd515('0xa')]=_[_0xd515('0xb')](config[_0xd515('0xa')],{'host':_0xd515('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xd515('0xd')](socket);function respondWithStatusCode(_0x1ca206,_0x562cad){_0x562cad=_0x562cad||0xcc;return function(_0x33e019){if(_0x33e019){return _0x1ca206[_0xd515('0xe')](_0x562cad);}return _0x1ca206[_0xd515('0xf')](_0x562cad)[_0xd515('0x10')]();};}function respondWithResult(_0x20d6fc,_0x4fb43f){_0x4fb43f=_0x4fb43f||0xc8;return function(_0x1f1215){if(_0x1f1215){return _0x20d6fc[_0xd515('0xf')](_0x4fb43f)[_0xd515('0x11')](_0x1f1215);}};}function respondWithFilteredResult(_0x54e0d8,_0x3108f7){return function(_0x3676f4){if(_0x3676f4){var _0x51c49c=typeof _0x3108f7[_0xd515('0x12')]===_0xd515('0x13')&&typeof _0x3108f7[_0xd515('0x14')]===_0xd515('0x13');var _0x2b477f=_0x3676f4['count'];var _0x5aab47=_0x51c49c?0x0:_0x3108f7[_0xd515('0x12')];var _0x39c909=_0x51c49c?_0x3676f4[_0xd515('0x15')]:_0x3108f7['offset']+_0x3108f7['limit'];var _0x19ea3f;if(_0x39c909>=_0x2b477f){_0x39c909=_0x2b477f;_0x19ea3f=0xc8;}else{_0x19ea3f=0xce;}_0x54e0d8[_0xd515('0xf')](_0x19ea3f);return _0x54e0d8[_0xd515('0x16')](_0xd515('0x17'),_0x5aab47+'-'+_0x39c909+'/'+_0x2b477f)[_0xd515('0x11')](_0x3676f4);}return null;};}function saveUpdates(_0xb9827b){return function(_0x3ea359){if(_0x3ea359){return _0x3ea359[_0xd515('0x18')](_0xb9827b)[_0xd515('0x19')](function(_0x37106b){return _0x37106b;});}return null;};}function removeEntity(_0x5361da){return function(_0x51aa41){if(_0x51aa41){return _0x51aa41[_0xd515('0x1a')]()[_0xd515('0x19')](function(){var _0x1d70b2=_0x51aa41[_0xd515('0x1b')]({'plain':!![]});var _0x4fbef5=_0xd515('0x1c');return db[_0xd515('0x1d')]['destroy']({'where':{'type':_0x4fbef5,'resourceId':_0x1d70b2['id']}})[_0xd515('0x19')](function(){return _0x51aa41;});})[_0xd515('0x19')](function(){_0x5361da[_0xd515('0xf')](0xcc)[_0xd515('0x10')]();});}};}function handleEntityNotFound(_0x2b9ec6){return function(_0x3de8fa){if(!_0x3de8fa){_0x2b9ec6[_0xd515('0xe')](0x194);}return _0x3de8fa;};}function handleError(_0x164a07,_0x2293ec){_0x2293ec=_0x2293ec||0x1f4;return function(_0x213c90){logger[_0xd515('0x1e')](_0x213c90['stack']);if(_0x213c90['name']){delete _0x213c90[_0xd515('0x1f')];}_0x164a07['status'](_0x2293ec)[_0xd515('0x20')](_0x213c90);};}exports['index']=function(_0x384536,_0x296331){var _0x5e91c8={};var _0x3e8a99={'count':0x0,'rows':[]};var _0x291ec2=_[_0xd515('0x21')](db[_0xd515('0x22')]['rawAttributes'],function(_0x1d4795){return{'name':_0x1d4795[_0xd515('0x23')],'type':_0x1d4795[_0xd515('0x24')]['key']};});_0x5e91c8=qs[_0xd515('0x25')](_0x291ec2,_0x384536);var _0x1bca00={'where':_0x5e91c8[_0xd515('0x26')]};return db[_0xd515('0x22')]['count'](_0x1bca00)[_0xd515('0x19')](function(_0xd9ca7b){_0x3e8a99[_0xd515('0x15')]=_0xd9ca7b;_0x5e91c8[_0xd515('0x27')]=qs['include'](_0x384536[_0xd515('0x28')]);return db['WhatsappQueue'][_0xd515('0x29')](_0x5e91c8);})[_0xd515('0x19')](function(_0x3797b5){_0x3e8a99[_0xd515('0x2a')]=_0x3797b5;return _0x3e8a99;})[_0xd515('0x19')](respondWithFilteredResult(_0x296331,_0x5e91c8))['catch'](handleError(_0x296331,null));};exports[_0xd515('0x2b')]=function(_0x1d26ec,_0x52070a){var _0x292339={'raw':!![],'where':{'id':_0x1d26ec[_0xd515('0x2c')]['id']}},_0x131742={};_0x131742[_0xd515('0x2d')]=_[_0xd515('0x2e')](db['WhatsappQueue'][_0xd515('0x2f')]);_0x131742[_0xd515('0x28')]=_[_0xd515('0x2e')](_0x1d26ec['query']);_0x131742[_0xd515('0x30')]=_['intersection'](_0x131742[_0xd515('0x2d')],_0x131742[_0xd515('0x28')]);_0x292339[_0xd515('0x31')]=_[_0xd515('0x32')](_0x131742[_0xd515('0x2d')],qs['fields'](_0x1d26ec[_0xd515('0x28')][_0xd515('0x33')]));_0x292339[_0xd515('0x31')]=_0x292339[_0xd515('0x31')][_0xd515('0x34')]?_0x292339['attributes']:_0x131742[_0xd515('0x2d')];if(_0x1d26ec['query'][_0xd515('0x35')]){_0x292339['include']=[{'all':!![]}];}_0x292339=_[_0xd515('0x36')]({},_0x292339,_0x1d26ec[_0xd515('0x37')]);return db['WhatsappQueue'][_0xd515('0x38')](_0x292339)['then'](handleEntityNotFound(_0x52070a,null))[_0xd515('0x19')](respondWithResult(_0x52070a,null))[_0xd515('0x39')](handleError(_0x52070a,null));};exports[_0xd515('0x3a')]=function(_0x12e1bd,_0x1f4c34){return db[_0xd515('0x22')]['create'](_0x12e1bd[_0xd515('0x3b')],{})['then'](function(_0x404a75){var _0x2da433=_0x12e1bd[_0xd515('0x3c')][_0xd515('0x1b')]({'plain':!![]});if(!_0x2da433)throw new Error(_0xd515('0x3d'));if(_0x2da433[_0xd515('0x3e')]==='user'){var _0x5ca266=_0x404a75[_0xd515('0x1b')]({'plain':!![]});var _0x2d6267=_0xd515('0x1c');return db[_0xd515('0x3f')]['find']({'where':{'name':_0x2d6267,'userProfileId':_0x2da433[_0xd515('0x40')]},'raw':!![]})[_0xd515('0x19')](function(_0x48c04c){if(_0x48c04c&&_0x48c04c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5ca266[_0xd515('0x1f')],'resourceId':_0x5ca266['id'],'type':_0x48c04c[_0xd515('0x1f')],'sectionId':_0x48c04c['id']},{})[_0xd515('0x19')](function(){return _0x404a75;});}else{return _0x404a75;}})[_0xd515('0x39')](function(_0x4dc02c){logger[_0xd515('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dc02c);throw _0x4dc02c;});}return _0x404a75;})[_0xd515('0x19')](respondWithResult(_0x1f4c34,0xc9))['catch'](handleError(_0x1f4c34,null));};exports[_0xd515('0x18')]=function(_0x536580,_0x5e77a6){if(_0x536580[_0xd515('0x3b')]['id']){delete _0x536580[_0xd515('0x3b')]['id'];}return db[_0xd515('0x22')]['find']({'where':{'id':_0x536580[_0xd515('0x2c')]['id']}})[_0xd515('0x19')](handleEntityNotFound(_0x5e77a6,null))[_0xd515('0x19')](saveUpdates(_0x536580[_0xd515('0x3b')],null))[_0xd515('0x19')](respondWithResult(_0x5e77a6,null))['catch'](handleError(_0x5e77a6,null));};exports['destroy']=function(_0x5bd62c,_0x18bb8b){return db[_0xd515('0x22')][_0xd515('0x38')]({'where':{'id':_0x5bd62c[_0xd515('0x2c')]['id']}})[_0xd515('0x19')](handleEntityNotFound(_0x18bb8b,null))[_0xd515('0x19')](removeEntity(_0x18bb8b,null))[_0xd515('0x39')](handleError(_0x18bb8b,null));};exports['describe']=function(_0xc8af81,_0x30d670){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x30d670,null))[_0xd515('0x39')](handleError(_0x30d670,null));};exports[_0xd515('0x41')]=function(_0x48c509,_0x96f5bc){var _0x235956={'raw':!![],'where':{}},_0x4c6b67={},_0x3ae47e;return db['WhatsappQueue'][_0xd515('0x42')]({'where':{'id':_0x48c509['params']['id']}})['then'](handleEntityNotFound(_0x96f5bc,null))[_0xd515('0x19')](function(_0x4f6222){if(_0x4f6222){_0x3ae47e=_0x4f6222[_0xd515('0x1b')]({'plain':!![]});_0x4c6b67['model']=_[_0xd515('0x2e')](db[_0xd515('0x43')][_0xd515('0x2f')]);_0x4c6b67[_0xd515('0x28')]=_[_0xd515('0x2e')](_0x48c509[_0xd515('0x28')]);_0x4c6b67[_0xd515('0x30')]=_['intersection'](_0x4c6b67[_0xd515('0x2d')],_0x4c6b67[_0xd515('0x28')]);_0x235956['attributes']=_[_0xd515('0x32')](_0x4c6b67[_0xd515('0x2d')],qs[_0xd515('0x33')](_0x48c509[_0xd515('0x28')][_0xd515('0x33')]));_0x235956[_0xd515('0x31')]=_0x235956[_0xd515('0x31')][_0xd515('0x34')]?_0x235956[_0xd515('0x31')]:_0x4c6b67[_0xd515('0x2d')];if(!_0x48c509['query']['hasOwnProperty']('nolimit')){_0x235956[_0xd515('0x14')]=qs[_0xd515('0x14')](_0x48c509[_0xd515('0x28')][_0xd515('0x14')]);_0x235956['offset']=qs['offset'](_0x48c509[_0xd515('0x28')]['offset']);}_0x235956[_0xd515('0x44')]=qs['sort'](_0x48c509[_0xd515('0x28')][_0xd515('0x45')]);_0x235956[_0xd515('0x26')]=qs[_0xd515('0x30')](_[_0xd515('0x46')](_0x48c509[_0xd515('0x28')],_0x4c6b67[_0xd515('0x30')]));_0x235956[_0xd515('0x26')][_0xd515('0x47')]=_0x4f6222['id'];if(_0x48c509['query'][_0xd515('0x48')]){_0x235956[_0xd515('0x26')]=_[_0xd515('0x36')](_0x235956['where'],{'$or':_[_0xd515('0x21')](_0x235956[_0xd515('0x31')],function(_0x45b8a5){var _0x10695f={};_0x10695f[_0x45b8a5]={'$like':'%'+_0x48c509[_0xd515('0x28')][_0xd515('0x48')]+'%'};return _0x10695f;})});}_0x235956=_[_0xd515('0x36')]({},_0x235956,_0x48c509[_0xd515('0x37')]);return db['UserWhatsappQueue'][_0xd515('0x29')](_0x235956);}})['then'](function(_0x134b4f){if(_0x134b4f){return db[_0xd515('0x49')]['findAndCountAll']({'where':{'id':_['map'](_0x134b4f,'UserId'),'role':_0xd515('0x4a')},'attributes':['id',_0xd515('0x1f'),'whatsappPause',_0xd515('0x4b'),'createdAt']});}})['then'](function(_0x189022){if(_0x189022){return{'count':_0x189022[_0xd515('0x15')],'rows':_['map'](_0x189022[_0xd515('0x2a')],function(_0x52c897){return{'membername':_0x52c897[_0xd515('0x1f')],'UserId':_0x52c897['id'],'queue_name':_0x3ae47e[_0xd515('0x1f')],'WhatsappQueueId':_0x3ae47e['id'],'interface':util[_0xd515('0x4c')](_0xd515('0x4d'),'SIP',_0x52c897['name']),'penalty':0x0,'paused':_0x52c897[_0xd515('0x4e')],'createdAt':_0x52c897[_0xd515('0x4f')],'updatedAt':_0x52c897['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd515('0x19')](respondWithFilteredResult(_0x96f5bc,_0x235956))['catch'](handleError(_0x96f5bc,null));};exports['getTeams']=function(_0x5a02d2,_0x1dc7f3){var _0x50fc71={};var _0x2f0313={};var _0x195d5b;var _0x50981c;return db[_0xd515('0x22')][_0xd515('0x42')]({'where':{'id':_0x5a02d2['params']['id']}})[_0xd515('0x19')](handleEntityNotFound(_0x1dc7f3,null))[_0xd515('0x19')](function(_0x368be2){if(_0x368be2){_0x195d5b=_0x368be2;_0x2f0313[_0xd515('0x2d')]=_['keys'](db[_0xd515('0x50')][_0xd515('0x2f')]);_0x2f0313[_0xd515('0x28')]=_['keys'](_0x5a02d2[_0xd515('0x28')]);_0x2f0313[_0xd515('0x30')]=_[_0xd515('0x32')](_0x2f0313['model'],_0x2f0313['query']);_0x50fc71['attributes']=_['intersection'](_0x2f0313[_0xd515('0x2d')],qs[_0xd515('0x33')](_0x5a02d2[_0xd515('0x28')]['fields']));_0x50fc71[_0xd515('0x31')]=_0x50fc71['attributes'][_0xd515('0x34')]?_0x50fc71['attributes']:_0x2f0313[_0xd515('0x2d')];_0x50fc71['order']=qs['sort'](_0x5a02d2[_0xd515('0x28')][_0xd515('0x45')]);_0x50fc71[_0xd515('0x26')]=qs[_0xd515('0x30')](_[_0xd515('0x46')](_0x5a02d2[_0xd515('0x28')],_0x2f0313[_0xd515('0x30')]));if(_0x5a02d2[_0xd515('0x28')][_0xd515('0x48')]){_0x50fc71[_0xd515('0x26')]=_['merge'](_0x50fc71[_0xd515('0x26')],{'$or':_[_0xd515('0x21')](_0x50fc71[_0xd515('0x31')],function(_0x32082c){var _0x4c3a84={};_0x4c3a84[_0x32082c]={'$like':'%'+_0x5a02d2[_0xd515('0x28')][_0xd515('0x48')]+'%'};return _0x4c3a84;})});}_0x50fc71=_[_0xd515('0x36')]({},_0x50fc71,_0x5a02d2[_0xd515('0x37')]);return _0x195d5b[_0xd515('0x51')](_0x50fc71);}})[_0xd515('0x19')](function(_0x3c2470){if(_0x3c2470){_0x50981c=_0x3c2470[_0xd515('0x34')];if(!_0x5a02d2['query'][_0xd515('0x52')](_0xd515('0x53'))){_0x50fc71['limit']=qs[_0xd515('0x14')](_0x5a02d2['query'][_0xd515('0x14')]);_0x50fc71['offset']=qs['offset'](_0x5a02d2['query'][_0xd515('0x12')]);}return _0x195d5b[_0xd515('0x51')](_0x50fc71);}})['then'](function(_0x1633aa){if(_0x1633aa){return _0x1633aa?{'count':_0x50981c,'rows':_0x1633aa}:null;}})['then'](respondWithResult(_0x1dc7f3,null))[_0xd515('0x39')](handleError(_0x1dc7f3,null));};exports['addTeams']=function(_0x351231,_0x3441de){var _0x3132b7=_0x351231['body']['ids'];return db[_0xd515('0x50')][_0xd515('0x29')]({'where':{'id':_0x3132b7},'attributes':['id'],'include':[{'model':db[_0xd515('0x49')],'as':_0xd515('0x54'),'attributes':['id',_0xd515('0x1f'),_0xd515('0x55'),_0xd515('0x56'),_0xd515('0x57')],'raw':!![]}]})[_0xd515('0x19')](function(_0x24abd3){if(_0x24abd3){var _0x4ddaf=_['flatMap'](_0x24abd3,function(_0x7f1fe2){var _0x1c6095=_0x7f1fe2['get']({'plain':!![]});return _0x1c6095[_0xd515('0x54')];});return db[_0xd515('0x22')][_0xd515('0x38')]({'where':{'id':_0x351231[_0xd515('0x2c')]['id']}})[_0xd515('0x19')](function(_0x281f96){return db[_0xd515('0x58')][_0xd515('0x59')](function(_0x63f54e){return _0x281f96['addTeams'](_0x3132b7,{'transaction':_0x63f54e})[_0xd515('0x19')](function(){return BPromise['each'](_0x4ddaf,function(_0x4c1057){return db['UserWhatsappQueue'][_0xd515('0x5a')]({'where':{'UserId':_0x4c1057['id'],'WhatsappQueueId':_0x351231[_0xd515('0x2c')]['id']},'transaction':_0x63f54e});});})[_0xd515('0x19')](function(){_0x4ddaf['forEach'](function(_0x31b4eb){socket[_0xd515('0x5b')](_0xd515('0x5c'),{'UserId':_0x31b4eb['id'],'WhatsappQueueId':_0x281f96['id']});});});});});}})[_0xd515('0x19')](respondWithStatusCode(_0x3441de,null))[_0xd515('0x39')](handleError(_0x3441de,null));};exports[_0xd515('0x5d')]=function(_0x2b6ab9,_0x4179e9){return db[_0xd515('0x50')][_0xd515('0x29')]({'where':{'id':_0x2b6ab9[_0xd515('0x28')][_0xd515('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xd515('0x49')],'as':_0xd515('0x54'),'attributes':['id'],'raw':!![]}]})[_0xd515('0x19')](handleEntityNotFound(_0x4179e9,null))['then'](function(_0x3e57b1){var _0x28c9e9=_['map'](_0x3e57b1,'id');var _0x5a740e=[];var _0x242dee=[];var _0x33f078=squel[_0xd515('0x5f')]();_0x33f078[_0xd515('0x60')](_0xd515('0x61'))[_0xd515('0x62')](_0xd515('0x63'),'tq')[_0xd515('0x64')](_0xd515('0x65'),'ut',_0xd515('0x66'))['where'](_0xd515('0x67'),_0x2b6ab9[_0xd515('0x2c')]['id']);for(var _0x193f20=0x0;_0x193f20<_0x3e57b1[_0xd515('0x34')];_0x193f20+=0x1){let _0x32d347=_0x3e57b1[_0x193f20];for(var _0x4d879c=0x0;_0x4d879c<_0x32d347['Agents'][_0xd515('0x34')];_0x4d879c+=0x1){let _0x46f69c=_0x32d347['Agents'][_0x4d879c];var _0x37967f=_0x33f078[_0xd515('0x68')]();_0x37967f[_0xd515('0x26')](_0xd515('0x69'),_0x46f69c['id']);_0x242dee[_0xd515('0x6a')](db[_0xd515('0x58')][_0xd515('0x28')](_0x37967f[_0xd515('0x6b')](),{'type':db[_0xd515('0x58')][_0xd515('0x6c')][_0xd515('0x6d')]})[_0xd515('0x19')](function(_0x5cda8b){if(_0x5cda8b[_0xd515('0x34')]===0x1){return _0x46f69c['id'];}else{var _0x39d816=_[_0xd515('0x6e')](_[_0xd515('0x21')](_0x5cda8b,'TeamId'),function(_0xab263f){return _['includes'](_0x28c9e9,_0xab263f);});if(_0x39d816){return _0x46f69c['id'];}}}));}}return BPromise[_0xd515('0x6f')](_0x242dee)[_0xd515('0x19')](function(_0x31073a){_0x5a740e=_(_0x5a740e)['union'](_0x31073a)[_0xd515('0x70')]()[_0xd515('0x71')]();return db['WhatsappQueue'][_0xd515('0x38')]({'where':{'id':_0x2b6ab9[_0xd515('0x2c')]['id']}})[_0xd515('0x19')](function(_0x88bfbb){return db['sequelize'][_0xd515('0x59')](function(_0x470577){return _0x88bfbb[_0xd515('0x5d')](_0x2b6ab9['query'][_0xd515('0x5e')],{'transaction':_0x470577})['then'](function(){if(!_[_0xd515('0x72')](_0x5a740e)){return _0x88bfbb[_0xd515('0x73')](_0x5a740e,{'transaction':_0x470577});}})[_0xd515('0x19')](function(){_0x5a740e[_0xd515('0x74')](function(_0x42bdcc){socket[_0xd515('0x5b')](_0xd515('0x75'),{'UserId':_0x42bdcc,'WhatsappQueueId':_0x88bfbb['id']});});});});});});})[_0xd515('0x19')](respondWithStatusCode(_0x4179e9,null))[_0xd515('0x39')](handleError(_0x4179e9,null));};exports[_0xd515('0x76')]=function(_0xdded8,_0xd785d9){return db['WhatsappQueue'][_0xd515('0x38')]({'where':{'id':_0xdded8['params']['id']}})[_0xd515('0x19')](handleEntityNotFound(_0xd785d9,null))[_0xd515('0x19')](function(_0x1477c3){if(_0x1477c3){return _0x1477c3['addAgents'](_0xdded8[_0xd515('0x3b')][_0xd515('0x5e')],_[_0xd515('0x77')](_0xdded8[_0xd515('0x3b')],[_0xd515('0x5e'),'id'])||{})['spread'](function(_0x124773){for(var _0x1d62ba=0x0;_0x1d62ba<_0xdded8[_0xd515('0x3b')][_0xd515('0x5e')][_0xd515('0x34')];_0x1d62ba+=0x1){socket[_0xd515('0x5b')](_0xd515('0x5c'),{'UserId':Number(_0xdded8[_0xd515('0x3b')][_0xd515('0x5e')][_0x1d62ba]),'WhatsappQueueId':Number(_0xdded8[_0xd515('0x2c')]['id'])});}return _0x124773;});}})['then'](respondWithResult(_0xd785d9,null))[_0xd515('0x39')](handleError(_0xd785d9,null));};exports[_0xd515('0x73')]=function(_0x4e3cbb,_0x57d4d0){return db[_0xd515('0x22')][_0xd515('0x38')]({'where':{'id':_0x4e3cbb[_0xd515('0x2c')]['id']}})['then'](handleEntityNotFound(_0x57d4d0,null))[_0xd515('0x19')](function(_0x2a6136){if(_0x2a6136){return _0x2a6136['removeAgents'](_0x4e3cbb[_0xd515('0x28')][_0xd515('0x5e')])[_0xd515('0x19')](function(){if(_['isArray'](_0x4e3cbb[_0xd515('0x28')][_0xd515('0x5e')])){for(var _0x50fe94=0x0;_0x50fe94<_0x4e3cbb[_0xd515('0x28')][_0xd515('0x5e')][_0xd515('0x34')];_0x50fe94+=0x1){socket[_0xd515('0x5b')]('userWhatsappQueue:remove',{'UserId':Number(_0x4e3cbb[_0xd515('0x28')][_0xd515('0x5e')][_0x50fe94]),'WhatsappQueueId':Number(_0x4e3cbb[_0xd515('0x2c')]['id'])});}}else{socket[_0xd515('0x5b')](_0xd515('0x75'),{'UserId':Number(_0x4e3cbb['query'][_0xd515('0x5e')]),'WhatsappQueueId':Number(_0x4e3cbb[_0xd515('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x57d4d0,null))['catch'](handleError(_0x57d4d0,null));};exports['getAgents']=function(_0x1f3ce4,_0x443e2c){var _0x4ae940={};var _0xe7061a={};var _0x129dd5;var _0x2993eb;return db[_0xd515('0x22')][_0xd515('0x42')]({'where':{'id':_0x1f3ce4[_0xd515('0x2c')]['id']}})[_0xd515('0x19')](handleEntityNotFound(_0x443e2c,null))['then'](function(_0xe5887c){if(_0xe5887c){_0x129dd5=_0xe5887c;_0xe7061a[_0xd515('0x2d')]=_[_0xd515('0x2e')](db[_0xd515('0x49')][_0xd515('0x2f')]);_0xe7061a[_0xd515('0x28')]=_[_0xd515('0x2e')](_0x1f3ce4['query']);_0xe7061a[_0xd515('0x30')]=_[_0xd515('0x32')](_0xe7061a[_0xd515('0x2d')],_0xe7061a['query']);_0x4ae940[_0xd515('0x31')]=_[_0xd515('0x32')](_0xe7061a[_0xd515('0x2d')],qs[_0xd515('0x33')](_0x1f3ce4[_0xd515('0x28')][_0xd515('0x33')]));_0x4ae940[_0xd515('0x31')]=_0x4ae940[_0xd515('0x31')]['length']?_0x4ae940[_0xd515('0x31')]:_0xe7061a[_0xd515('0x2d')];_0x4ae940['order']=qs[_0xd515('0x45')](_0x1f3ce4[_0xd515('0x28')][_0xd515('0x45')]);_0x4ae940[_0xd515('0x26')]=qs[_0xd515('0x30')](_[_0xd515('0x46')](_0x1f3ce4[_0xd515('0x28')],_0xe7061a[_0xd515('0x30')]));if(_0x1f3ce4[_0xd515('0x28')]['filter']){_0x4ae940[_0xd515('0x26')]=_['merge'](_0x4ae940['where'],{'$or':_['map'](_0x4ae940[_0xd515('0x31')],function(_0x3c15c3){var _0x39211a={};_0x39211a[_0x3c15c3]={'$like':'%'+_0x1f3ce4[_0xd515('0x28')][_0xd515('0x48')]+'%'};return _0x39211a;})});}_0x4ae940=_[_0xd515('0x36')]({},_0x4ae940,_0x1f3ce4[_0xd515('0x37')]);return _0x129dd5['getAgents'](_0x4ae940);}})[_0xd515('0x19')](function(_0x4f86f7){if(_0x4f86f7){_0x2993eb=_0x4f86f7['length'];if(!_0x1f3ce4['query'][_0xd515('0x52')]('nolimit')){_0x4ae940[_0xd515('0x14')]=qs[_0xd515('0x14')](_0x1f3ce4['query']['limit']);_0x4ae940[_0xd515('0x12')]=qs[_0xd515('0x12')](_0x1f3ce4[_0xd515('0x28')][_0xd515('0x12')]);}return _0x129dd5[_0xd515('0x78')](_0x4ae940);}})['then'](function(_0x11081c){if(_0x11081c){return _0x11081c?{'count':_0x2993eb,'rows':_0x11081c}:null;}})[_0xd515('0x19')](respondWithResult(_0x443e2c,null))[_0xd515('0x39')](handleError(_0x443e2c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9a80989..dff8863 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 _0x15a5=['events','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0xd03fe0,_0x4b55d3){var _0x554ed3=function(_0x2926b5){while(--_0x2926b5){_0xd03fe0['push'](_0xd03fe0['shift']());}};_0x554ed3(++_0x4b55d3);}(_0x15a5,0x1c0));var _0x515a=function(_0x50470f,_0x270a2a){_0x50470f=_0x50470f-0x0;var _0x3ab771=_0x15a5[_0x50470f];return _0x3ab771;};'use strict';var EventEmitter=require(_0x515a('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x515a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x515a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1c50fd){return function(_0x204bd9,_0x4c8141,_0x23933d){WhatsappQueueEvents['emit'](_0x1c50fd+':'+_0x204bd9['id'],_0x204bd9);WhatsappQueueEvents[_0x515a('0x3')](_0x1c50fd,_0x204bd9);_0x23933d(null);};}for(var e in events){if(events[_0x515a('0x4')](e)){var event=events[e];WhatsappQueue[_0x515a('0x5')](e,emitEvent(event));}}module[_0x515a('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x68cd=['update','remove','emit','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x3b8078,_0x35772a){var _0x555a47=function(_0x287f6a){while(--_0x287f6a){_0x3b8078['push'](_0x3b8078['shift']());}};_0x555a47(++_0x35772a);}(_0x68cd,0x10d));var _0xd68c=function(_0x27a125,_0x330c0e){_0x27a125=_0x27a125-0x0;var _0x36eac1=_0x68cd[_0x27a125];return _0x36eac1;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd68c('0x0'))['db'][_0xd68c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd68c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd68c('0x3'),'afterDestroy':_0xd68c('0x4')};function emitEvent(_0x3b1deb){return function(_0x5ed8ac,_0x54def3,_0x3045ef){WhatsappQueueEvents[_0xd68c('0x5')](_0x3b1deb+':'+_0x5ed8ac['id'],_0x5ed8ac);WhatsappQueueEvents[_0xd68c('0x5')](_0x3b1deb,_0x5ed8ac);_0x3045ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd68c('0x6')](e,emitEvent(event));}}module[_0xd68c('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 5e41e78..0aca6cf 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 _0x6482=['whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x6482,0x71));var _0x2648=function(_0x37dbb4,_0xc6ead9){_0x37dbb4=_0x37dbb4-0x0;var _0x34dcf3=_0x6482[_0x37dbb4];return _0x34dcf3;};'use strict';var _=require(_0x2648('0x0'));var util=require(_0x2648('0x1'));var logger=require('../../config/logger')(_0x2648('0x2'));var moment=require(_0x2648('0x3'));var BPromise=require(_0x2648('0x4'));var rp=require(_0x2648('0x5'));var fs=require('fs');var path=require(_0x2648('0x6'));var rimraf=require(_0x2648('0x7'));var config=require(_0x2648('0x8'));var attributes=require(_0x2648('0x9'));module[_0x2648('0xa')]=function(_0x49bcfa,_0x512c11){return _0x49bcfa[_0x2648('0xb')](_0x2648('0xc'),attributes,{'tableName':_0x2648('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb59=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api'];(function(_0x4f7618,_0x243df2){var _0x20ba5f=function(_0x1bfe65){while(--_0x1bfe65){_0x4f7618['push'](_0x4f7618['shift']());}};_0x20ba5f(++_0x243df2);}(_0xeb59,0x123));var _0x9eb5=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xeb59[_0x249e96];return _0x17444c;};'use strict';var _=require(_0x9eb5('0x0'));var util=require('util');var logger=require(_0x9eb5('0x1'))(_0x9eb5('0x2'));var moment=require(_0x9eb5('0x3'));var BPromise=require(_0x9eb5('0x4'));var rp=require(_0x9eb5('0x5'));var fs=require('fs');var path=require(_0x9eb5('0x6'));var rimraf=require(_0x9eb5('0x7'));var config=require(_0x9eb5('0x8'));var attributes=require(_0x9eb5('0x9'));module[_0x9eb5('0xa')]=function(_0x44aab5,_0x541764){return _0x44aab5[_0x9eb5('0xb')](_0x9eb5('0xc'),attributes,{'tableName':_0x9eb5('0xd'),'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 c4ec98d..bb47efc 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 _0x793f=['WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x5e3dd6,_0x57c85f){var _0x51a2a2=function(_0x1fbf8e){while(--_0x1fbf8e){_0x5e3dd6['push'](_0x5e3dd6['shift']());}};_0x51a2a2(++_0x57c85f);}(_0x793f,0xeb));var _0xf793=function(_0x3c00cc,_0x4b0ddb){_0x3c00cc=_0x3c00cc-0x0;var _0x45e86e=_0x793f[_0x3c00cc];return _0x45e86e;};'use strict';var _=require(_0xf793('0x0'));var util=require('util');var moment=require(_0xf793('0x1'));var BPromise=require(_0xf793('0x2'));var rs=require(_0xf793('0x3'));var fs=require('fs');var Redis=require(_0xf793('0x4'));var db=require(_0xf793('0x5'))['db'];var utils=require(_0xf793('0x6'));var logger=require(_0xf793('0x7'))(_0xf793('0x8'));var config=require(_0xf793('0x9'));var jayson=require(_0xf793('0xa'));var client=jayson[_0xf793('0xb')][_0xf793('0xc')]({'port':0x232a});config[_0xf793('0xd')]=_[_0xf793('0xe')](config[_0xf793('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf793('0xf'))(new Redis(config[_0xf793('0xd')]));require(_0xf793('0x10'))[_0xf793('0x11')](socket);function respondWithRpcPromise(_0x4286ad,_0x1c0493,_0x43824c){return new BPromise(function(_0x18b330,_0x349686){return client[_0xf793('0x12')](_0x4286ad,_0x43824c)[_0xf793('0x13')](function(_0xe76899){logger[_0xf793('0x14')](_0xf793('0x15'),_0x1c0493,_0xf793('0x16'));logger['debug'](_0xf793('0x17'),_0x1c0493,_0xf793('0x16'),JSON['stringify'](_0xe76899));if(_0xe76899['error']){if(_0xe76899[_0xf793('0x18')][_0xf793('0x19')]===0x1f4){logger[_0xf793('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1c0493,_0xe76899[_0xf793('0x18')][_0xf793('0x1a')]);return _0x349686(_0xe76899[_0xf793('0x18')][_0xf793('0x1a')]);}logger[_0xf793('0x18')](_0xf793('0x15'),_0x1c0493,_0xe76899['error'][_0xf793('0x1a')]);return _0x18b330(_0xe76899['error'][_0xf793('0x1a')]);}else{logger['info'](_0xf793('0x15'),_0x1c0493,_0xf793('0x16'));_0x18b330(_0xe76899[_0xf793('0x1b')][_0xf793('0x1a')]);}})[_0xf793('0x1c')](function(_0x2cb107){logger[_0xf793('0x18')](_0xf793('0x15'),_0x1c0493,_0x2cb107);_0x349686(_0x2cb107);});});}exports[_0xf793('0x1d')]=function(_0x342374){var _0x59fa83=this;return new Promise(function(_0x1ad641,_0x331d74){return db[_0xf793('0x1e')]['findAll']({'raw':_0x342374[_0xf793('0x1f')]?_0x342374[_0xf793('0x1f')][_0xf793('0x20')]===undefined?!![]:![]:!![],'where':_0x342374[_0xf793('0x1f')]?_0x342374[_0xf793('0x1f')][_0xf793('0x21')]||null:null,'attributes':_0x342374[_0xf793('0x1f')]?_0x342374['options'][_0xf793('0x22')]||null:null,'limit':_0x342374[_0xf793('0x1f')]?_0x342374[_0xf793('0x1f')][_0xf793('0x23')]||null:null,'include':_0x342374[_0xf793('0x1f')]?_0x342374[_0xf793('0x1f')][_0xf793('0x24')]?_[_0xf793('0x25')](_0x342374[_0xf793('0x1f')][_0xf793('0x24')],function(_0x23ef10){return{'model':db[_0x23ef10[_0xf793('0x26')]],'as':_0x23ef10['as'],'attributes':_0x23ef10['attributes'],'include':_0x23ef10[_0xf793('0x24')]?_[_0xf793('0x25')](_0x23ef10[_0xf793('0x24')],function(_0x4e4b4a){return{'model':db[_0x4e4b4a[_0xf793('0x26')]],'as':_0x4e4b4a['as'],'attributes':_0x4e4b4a['attributes'],'include':_0x4e4b4a['include']?_[_0xf793('0x25')](_0x4e4b4a[_0xf793('0x24')],function(_0x207ee4){return{'model':db[_0x207ee4[_0xf793('0x26')]],'as':_0x207ee4['as'],'attributes':_0x207ee4[_0xf793('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x138ba4){logger['info'](_0xf793('0x1d'),_0x342374);logger[_0xf793('0x27')]('GetWhatsappQueue',_0x342374,JSON[_0xf793('0x28')](_0x138ba4));_0x1ad641(_0x138ba4);})[_0xf793('0x1c')](function(_0x3e6e44){logger['error'](_0xf793('0x1d'),_0x3e6e44[_0xf793('0x1a')],_0x342374);_0x331d74(_0x59fa83[_0xf793('0x18')](0x1f4,_0x3e6e44[_0xf793('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x2576ac){var _0x5b00d5=this;return new Promise(function(_0x2e4215,_0x5d0ab3){return db[_0xf793('0x1e')][_0xf793('0x29')]({'raw':_0x2576ac[_0xf793('0x1f')]?_0x2576ac[_0xf793('0x1f')][_0xf793('0x20')]===undefined?!![]:![]:!![],'where':_0x2576ac[_0xf793('0x1f')]?_0x2576ac['options'][_0xf793('0x21')]||null:null,'attributes':_0x2576ac['options']?_0x2576ac[_0xf793('0x1f')][_0xf793('0x22')]||null:null,'include':_0x2576ac[_0xf793('0x1f')]?_0x2576ac[_0xf793('0x1f')][_0xf793('0x24')]?_[_0xf793('0x25')](_0x2576ac[_0xf793('0x1f')][_0xf793('0x24')],function(_0x552f03){return{'model':db[_0x552f03[_0xf793('0x26')]],'as':_0x552f03['as'],'attributes':_0x552f03[_0xf793('0x22')],'include':_0x552f03[_0xf793('0x24')]?_[_0xf793('0x25')](_0x552f03[_0xf793('0x24')],function(_0x205cc0){return{'model':db[_0x205cc0[_0xf793('0x26')]],'as':_0x205cc0['as'],'attributes':_0x205cc0[_0xf793('0x22')],'include':_0x205cc0['include']?_[_0xf793('0x25')](_0x205cc0[_0xf793('0x24')],function(_0x45d9fa){return{'model':db[_0x45d9fa[_0xf793('0x26')]],'as':_0x45d9fa['as'],'attributes':_0x45d9fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xf793('0x13')](function(_0x468cae){logger[_0xf793('0x14')](_0xf793('0x2a'),_0x2576ac);logger[_0xf793('0x27')]('ShowWhatsappQueue',_0x2576ac,JSON[_0xf793('0x28')](_0x468cae));_0x2e4215(_0x468cae);})['catch'](function(_0x52de12){logger['error']('ShowWhatsappQueue',_0x52de12[_0xf793('0x1a')],_0x2576ac);_0x5d0ab3(_0x5b00d5['error'](0x1f4,_0x52de12[_0xf793('0x1a')]));});});}; \ No newline at end of file +var _0x0195=['request','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','map','then','ShowWhatsappQueue','find','where','model','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register'];(function(_0x35b695,_0x436c9a){var _0x2f5386=function(_0x162a6b){while(--_0x162a6b){_0x35b695['push'](_0x35b695['shift']());}};_0x2f5386(++_0x436c9a);}(_0x0195,0xdb));var _0x5019=function(_0x59d75b,_0x1ef0e3){_0x59d75b=_0x59d75b-0x0;var _0x50189e=_0x0195[_0x59d75b];return _0x50189e;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require('bluebird');var rs=require(_0x5019('0x3'));var fs=require('fs');var Redis=require(_0x5019('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5019('0x5'));var logger=require(_0x5019('0x6'))('rpc');var config=require(_0x5019('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5019('0x8')][_0x5019('0x9')]({'port':0x232a});config[_0x5019('0xa')]=_[_0x5019('0xb')](config[_0x5019('0xa')],{'host':_0x5019('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5019('0xd'))[_0x5019('0xe')](socket);function respondWithRpcPromise(_0x2fd243,_0x570cb6,_0x6792af){return new BPromise(function(_0x158490,_0x5982b8){return client[_0x5019('0xf')](_0x2fd243,_0x6792af)['then'](function(_0x2f75e8){logger[_0x5019('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x570cb6,_0x5019('0x11'));logger[_0x5019('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x570cb6,_0x5019('0x11'),JSON[_0x5019('0x13')](_0x2f75e8));if(_0x2f75e8[_0x5019('0x14')]){if(_0x2f75e8[_0x5019('0x14')][_0x5019('0x15')]===0x1f4){logger[_0x5019('0x14')](_0x5019('0x16'),_0x570cb6,_0x2f75e8[_0x5019('0x14')][_0x5019('0x17')]);return _0x5982b8(_0x2f75e8[_0x5019('0x14')]['message']);}logger['error'](_0x5019('0x16'),_0x570cb6,_0x2f75e8[_0x5019('0x14')][_0x5019('0x17')]);return _0x158490(_0x2f75e8['error'][_0x5019('0x17')]);}else{logger[_0x5019('0x10')](_0x5019('0x16'),_0x570cb6,_0x5019('0x11'));_0x158490(_0x2f75e8[_0x5019('0x18')][_0x5019('0x17')]);}})[_0x5019('0x19')](function(_0x49c768){logger[_0x5019('0x14')](_0x5019('0x16'),_0x570cb6,_0x49c768);_0x5982b8(_0x49c768);});});}exports[_0x5019('0x1a')]=function(_0x43cca0){var _0x2c43e4=this;return new Promise(function(_0x4efbd9,_0x1a6a46){return db[_0x5019('0x1b')]['findAll']({'raw':_0x43cca0[_0x5019('0x1c')]?_0x43cca0['options'][_0x5019('0x1d')]===undefined?!![]:![]:!![],'where':_0x43cca0['options']?_0x43cca0['options']['where']||null:null,'attributes':_0x43cca0[_0x5019('0x1c')]?_0x43cca0['options'][_0x5019('0x1e')]||null:null,'limit':_0x43cca0[_0x5019('0x1c')]?_0x43cca0[_0x5019('0x1c')][_0x5019('0x1f')]||null:null,'include':_0x43cca0[_0x5019('0x1c')]?_0x43cca0[_0x5019('0x1c')][_0x5019('0x20')]?_['map'](_0x43cca0['options'][_0x5019('0x20')],function(_0x265015){return{'model':db[_0x265015['model']],'as':_0x265015['as'],'attributes':_0x265015[_0x5019('0x1e')],'include':_0x265015[_0x5019('0x20')]?_['map'](_0x265015[_0x5019('0x20')],function(_0x294f99){return{'model':db[_0x294f99['model']],'as':_0x294f99['as'],'attributes':_0x294f99[_0x5019('0x1e')],'include':_0x294f99[_0x5019('0x20')]?_[_0x5019('0x21')](_0x294f99['include'],function(_0x1acb1a){return{'model':db[_0x1acb1a['model']],'as':_0x1acb1a['as'],'attributes':_0x1acb1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5019('0x22')](function(_0x1c7c87){logger[_0x5019('0x10')](_0x5019('0x1a'),_0x43cca0);logger[_0x5019('0x12')]('GetWhatsappQueue',_0x43cca0,JSON[_0x5019('0x13')](_0x1c7c87));_0x4efbd9(_0x1c7c87);})[_0x5019('0x19')](function(_0x373791){logger[_0x5019('0x14')](_0x5019('0x1a'),_0x373791[_0x5019('0x17')],_0x43cca0);_0x1a6a46(_0x2c43e4['error'](0x1f4,_0x373791[_0x5019('0x17')]));});});};exports[_0x5019('0x23')]=function(_0x3fee7f){var _0x3ad2e0=this;return new Promise(function(_0xfe5006,_0x5dacd9){return db['WhatsappQueue'][_0x5019('0x24')]({'raw':_0x3fee7f['options']?_0x3fee7f[_0x5019('0x1c')][_0x5019('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fee7f[_0x5019('0x1c')]?_0x3fee7f[_0x5019('0x1c')][_0x5019('0x25')]||null:null,'attributes':_0x3fee7f[_0x5019('0x1c')]?_0x3fee7f[_0x5019('0x1c')][_0x5019('0x1e')]||null:null,'include':_0x3fee7f[_0x5019('0x1c')]?_0x3fee7f[_0x5019('0x1c')]['include']?_[_0x5019('0x21')](_0x3fee7f[_0x5019('0x1c')][_0x5019('0x20')],function(_0x2686fe){return{'model':db[_0x2686fe[_0x5019('0x26')]],'as':_0x2686fe['as'],'attributes':_0x2686fe[_0x5019('0x1e')],'include':_0x2686fe['include']?_['map'](_0x2686fe[_0x5019('0x20')],function(_0x14279b){return{'model':db[_0x14279b[_0x5019('0x26')]],'as':_0x14279b['as'],'attributes':_0x14279b[_0x5019('0x1e')],'include':_0x14279b[_0x5019('0x20')]?_[_0x5019('0x21')](_0x14279b[_0x5019('0x20')],function(_0xb87d39){return{'model':db[_0xb87d39['model']],'as':_0xb87d39['as'],'attributes':_0xb87d39[_0x5019('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da446){logger['info'](_0x5019('0x23'),_0x3fee7f);logger['debug'](_0x5019('0x23'),_0x3fee7f,JSON[_0x5019('0x13')](_0x3da446));_0xfe5006(_0x3da446);})[_0x5019('0x19')](function(_0x3f9a2d){logger['error'](_0x5019('0x23'),_0x3f9a2d[_0x5019('0x17')],_0x3fee7f);_0x5dacd9(_0x3ad2e0[_0x5019('0x14')](0x1f4,_0x3f9a2d[_0x5019('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d2111a9..77ed523 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 _0x3a82=['register','whatsappQueue:','./whatsappQueue.events','update','emit','removeListener'];(function(_0x162b73,_0x128905){var _0x22e1b6=function(_0x3f35ad){while(--_0x3f35ad){_0x162b73['push'](_0x162b73['shift']());}};_0x22e1b6(++_0x128905);}(_0x3a82,0x1a0));var _0x23a8=function(_0x33c0dd,_0x4a6fe9){_0x33c0dd=_0x33c0dd-0x0;var _0x428232=_0x3a82[_0x33c0dd];return _0x428232;};'use strict';var WhatsappQueueEvents=require(_0x23a8('0x0'));var events=['save','remove',_0x23a8('0x1')];function createListener(_0x481a60,_0x2df375){return function(_0x904389){_0x2df375[_0x23a8('0x2')](_0x481a60,_0x904389);};}function removeListener(_0x185d5c,_0x1d2a92){return function(){WhatsappQueueEvents[_0x23a8('0x3')](_0x185d5c,_0x1d2a92);};}exports[_0x23a8('0x4')]=function(_0x73d706){for(var _0x487f45=0x0,_0x1bf234=events['length'];_0x487f45<_0x1bf234;_0x487f45++){var _0x8c4a25=events[_0x487f45];var _0x4f65c8=createListener(_0x23a8('0x5')+_0x8c4a25,_0x73d706);WhatsappQueueEvents['on'](_0x8c4a25,_0x4f65c8);}}; \ No newline at end of file +var _0xcc27=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xcc27,0xe2));var _0x7cc2=function(_0x1f4f0b,_0xc6db05){_0x1f4f0b=_0x1f4f0b-0x0;var _0x1be5c2=_0xcc27[_0x1f4f0b];return _0x1be5c2;};'use strict';var WhatsappQueueEvents=require(_0x7cc2('0x0'));var events=[_0x7cc2('0x1'),_0x7cc2('0x2'),_0x7cc2('0x3')];function createListener(_0x4ced40,_0x2768ce){return function(_0x3cde24){_0x2768ce[_0x7cc2('0x4')](_0x4ced40,_0x3cde24);};}function removeListener(_0x5ea6f2,_0x5e786e){return function(){WhatsappQueueEvents[_0x7cc2('0x5')](_0x5ea6f2,_0x5e786e);};}exports[_0x7cc2('0x6')]=function(_0x1e8ae9){for(var _0x7adae7=0x0,_0x284895=events[_0x7cc2('0x7')];_0x7adae7<_0x284895;_0x7adae7++){var _0x702cc5=events[_0x7adae7];var _0x5b4d70=createListener(_0x7cc2('0x8')+_0x702cc5,_0x1e8ae9);WhatsappQueueEvents['on'](_0x702cc5,_0x5b4d70);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bcac51b..ebbca81 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 _0x33dd=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','exports'];(function(_0x3d393f,_0x523ddc){var _0xd5cc33=function(_0x4feaee){while(--_0x4feaee){_0x3d393f['push'](_0x3d393f['shift']());}};_0xd5cc33(++_0x523ddc);}(_0x33dd,0xc6));var _0xd33d=function(_0x4d7775,_0x34c15d){_0x4d7775=_0x4d7775-0x0;var _0x138029=_0x33dd[_0x4d7775];return _0x138029;};'use strict';var multer=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var path=require('path');var timeout=require(_0xd33d('0x2'));var express=require('express');var router=express[_0xd33d('0x3')]();var fs_extra=require(_0xd33d('0x4'));var auth=require(_0xd33d('0x5'));var interaction=require(_0xd33d('0x6'));var config=require('../../config/environment');var controller=require(_0xd33d('0x7'));router[_0xd33d('0x8')]('/',auth[_0xd33d('0x9')](),controller[_0xd33d('0xa')]);router[_0xd33d('0x8')](_0xd33d('0xb'),auth[_0xd33d('0x9')](),controller['describe']);router['get'](_0xd33d('0xc'),auth[_0xd33d('0x9')](),controller[_0xd33d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd33d('0xe')]);router[_0xd33d('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd33d('0x10')](_0xd33d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd33d('0x11')]=router; \ No newline at end of file +var _0x3db6=['create','update','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x572b43,_0x120a91){var _0x20360f=function(_0x414213){while(--_0x414213){_0x572b43['push'](_0x572b43['shift']());}};_0x20360f(++_0x120a91);}(_0x3db6,0x114));var _0x63db=function(_0x41d88b,_0x28cc09){_0x41d88b=_0x41d88b-0x0;var _0x14aa00=_0x3db6[_0x41d88b];return _0x14aa00;};'use strict';var multer=require(_0x63db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x63db('0x1'));var express=require(_0x63db('0x2'));var router=express[_0x63db('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x63db('0x4'));var config=require(_0x63db('0x5'));var controller=require(_0x63db('0x6'));router[_0x63db('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x63db('0x7')](_0x63db('0x8'),auth[_0x63db('0x9')](),controller[_0x63db('0xa')]);router[_0x63db('0x7')](_0x63db('0xb'),auth[_0x63db('0x9')](),controller['show']);router[_0x63db('0xc')]('/',auth[_0x63db('0x9')](),controller[_0x63db('0xd')]);router['put'](_0x63db('0xb'),auth[_0x63db('0x9')](),controller[_0x63db('0xe')]);router[_0x63db('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x63db('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index fd128d8..d4fdf93 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5be121,_0x5e1054){var _0x5254a7=function(_0x22e4b8){while(--_0x22e4b8){_0x5be121['push'](_0x5be121['shift']());}};_0x5254a7(++_0x5e1054);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x22809a,_0x8b7e4a){var _0xdabc0=function(_0x559cee){while(--_0x559cee){_0x22809a['push'](_0x22809a['shift']());}};_0xdabc0(++_0x8b7e4a);}(_0x7a54,0x106));var _0x47a5=function(_0x4424ac,_0x372a83){_0x4424ac=_0x4424ac-0x0;var _0x4373f8=_0x7a54[_0x4424ac];return _0x4373f8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index fa4cc5b..106e3ea 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 _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0x2bbf4d,_0xe5c8bb){var _0x8dd663=function(_0x2809da){while(--_0x2809da){_0x2bbf4d['push'](_0x2bbf4d['shift']());}};_0x8dd663(++_0xe5c8bb);}(_0x0565,0xf2));var _0x5056=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0565[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file +var _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','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','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0x34d6f8,_0x33c98f){var _0x455f4f=function(_0x3be7e7){while(--_0x3be7e7){_0x34d6f8['push'](_0x34d6f8['shift']());}};_0x455f4f(++_0x33c98f);}(_0x3266,0x6a));var _0x6326=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x3266[_0x382e89];return _0x3a1318;};'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(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4d6129c..7254765 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 _0x5519=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5519,0x176));var _0x9551=function(_0x364797,_0x2e97de){_0x364797=_0x364797-0x0;var _0x4ebd83=_0x5519[_0x364797];return _0x4ebd83;};'use strict';var _=require(_0x9551('0x0'));var util=require(_0x9551('0x1'));var logger=require(_0x9551('0x2'))('api');var moment=require(_0x9551('0x3'));var BPromise=require('bluebird');var rp=require(_0x9551('0x4'));var fs=require('fs');var path=require(_0x9551('0x5'));var rimraf=require('rimraf');var config=require(_0x9551('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x9551('0x7')]=function(_0xa00e7a,_0x1cf6e3){return _0xa00e7a[_0x9551('0x8')](_0x9551('0x9'),attributes,{'tableName':_0x9551('0xa'),'paranoid':![],'indexes':[{'name':_0x9551('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb672=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x5ca534,_0x238119){var _0x2df5ae=function(_0x34fc26){while(--_0x34fc26){_0x5ca534['push'](_0x5ca534['shift']());}};_0x2df5ae(++_0x238119);}(_0xb672,0x9f));var _0x2b67=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb672[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x2b67('0x0'));var util=require(_0x2b67('0x1'));var logger=require(_0x2b67('0x2'))('api');var moment=require(_0x2b67('0x3'));var BPromise=require(_0x2b67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b67('0x5'));var rimraf=require(_0x2b67('0x6'));var config=require(_0x2b67('0x7'));var attributes=require(_0x2b67('0x8'));module[_0x2b67('0x9')]=function(_0x4658a5,_0x452b97){return _0x4658a5[_0x2b67('0xa')](_0x2b67('0xb'),attributes,{'tableName':_0x2b67('0xc'),'paranoid':![],'indexes':[{'name':_0x2b67('0xd'),'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 a57ebe8..99eb8ce 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 _0xf1d5=['info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','limit','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x441ae1,_0x4fd210){var _0x3900f3=function(_0x3a13a9){while(--_0x3a13a9){_0x441ae1['push'](_0x441ae1['shift']());}};_0x3900f3(++_0x4fd210);}(_0xf1d5,0x14d));var _0x5f1d=function(_0x132e5b,_0x1e1801){_0x132e5b=_0x132e5b-0x0;var _0x38e3ce=_0xf1d5[_0x132e5b];return _0x38e3ce;};'use strict';var _=require('lodash');var util=require(_0x5f1d('0x0'));var moment=require(_0x5f1d('0x1'));var BPromise=require(_0x5f1d('0x2'));var rs=require(_0x5f1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5f1d('0x4'));var logger=require('../../config/logger')(_0x5f1d('0x5'));var config=require(_0x5f1d('0x6'));var jayson=require(_0x5f1d('0x7'));var client=jayson[_0x5f1d('0x8')][_0x5f1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x201c67,_0x2b6e06,_0x56d92d){return new BPromise(function(_0x4ad031,_0x4bfc43){return client['request'](_0x201c67,_0x56d92d)[_0x5f1d('0xa')](function(_0x45e934){logger['info'](_0x5f1d('0xb'),_0x2b6e06,_0x5f1d('0xc'));logger[_0x5f1d('0xd')](_0x5f1d('0xe'),_0x2b6e06,_0x5f1d('0xc'),JSON[_0x5f1d('0xf')](_0x45e934));if(_0x45e934['error']){if(_0x45e934[_0x5f1d('0x10')][_0x5f1d('0x11')]===0x1f4){logger[_0x5f1d('0x10')](_0x5f1d('0xb'),_0x2b6e06,_0x45e934['error']['message']);return _0x4bfc43(_0x45e934['error'][_0x5f1d('0x12')]);}logger['error'](_0x5f1d('0xb'),_0x2b6e06,_0x45e934['error'][_0x5f1d('0x12')]);return _0x4ad031(_0x45e934['error'][_0x5f1d('0x12')]);}else{logger[_0x5f1d('0x13')](_0x5f1d('0xb'),_0x2b6e06,_0x5f1d('0xc'));_0x4ad031(_0x45e934[_0x5f1d('0x14')][_0x5f1d('0x12')]);}})[_0x5f1d('0x15')](function(_0x4cfc23){logger[_0x5f1d('0x10')](_0x5f1d('0xb'),_0x2b6e06,_0x4cfc23);_0x4bfc43(_0x4cfc23);});});}exports[_0x5f1d('0x16')]=function(_0x305d1c){var _0x1fed81=this;return new Promise(function(_0x34d174,_0x2bf964){return db[_0x5f1d('0x17')][_0x5f1d('0x18')](_0x305d1c[_0x5f1d('0x19')],{'raw':_0x305d1c[_0x5f1d('0x1a')]?_0x305d1c[_0x5f1d('0x1a')][_0x5f1d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xbb0495){logger['info'](_0x5f1d('0x16'),_0x305d1c);logger['debug'](_0x5f1d('0x16'),_0x305d1c,JSON[_0x5f1d('0xf')](_0xbb0495));_0x34d174(_0xbb0495);})[_0x5f1d('0x15')](function(_0x45b6db){logger[_0x5f1d('0x10')]('CreateWhatsappQueueReport',_0x45b6db[_0x5f1d('0x12')],_0x305d1c);_0x2bf964(_0x1fed81[_0x5f1d('0x10')](0x1f4,_0x45b6db['message']));});});};exports[_0x5f1d('0x1c')]=function(_0x4222c8){var _0x9dab4c=this;return new Promise(function(_0x5a8f74,_0x33f2c9){return db[_0x5f1d('0x17')][_0x5f1d('0x1d')](_0x4222c8[_0x5f1d('0x19')],{'raw':_0x4222c8[_0x5f1d('0x1a')]?_0x4222c8[_0x5f1d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4222c8[_0x5f1d('0x1a')]?_0x4222c8[_0x5f1d('0x1a')][_0x5f1d('0x1e')]||null:null,'attributes':_0x4222c8[_0x5f1d('0x1a')]?_0x4222c8[_0x5f1d('0x1a')]['attributes']||null:null,'limit':_0x4222c8[_0x5f1d('0x1a')]?_0x4222c8[_0x5f1d('0x1a')][_0x5f1d('0x1f')]||null:null})['then'](function(_0x50bef2){logger['info'](_0x5f1d('0x1c'),_0x4222c8);logger[_0x5f1d('0xd')](_0x5f1d('0x1c'),_0x4222c8,JSON[_0x5f1d('0xf')](_0x50bef2));_0x5a8f74(_0x50bef2);})[_0x5f1d('0x15')](function(_0x2ff4a8){logger[_0x5f1d('0x10')]('UpdateWhatsappQueueReport',_0x2ff4a8[_0x5f1d('0x12')],_0x4222c8);_0x33f2c9(_0x9dab4c[_0x5f1d('0x10')](0x1f4,_0x2ff4a8[_0x5f1d('0x12')]));});});}; \ No newline at end of file +var _0xcdde=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2e6006,_0x3dcaf1){var _0xac662c=function(_0x5685ab){while(--_0x5685ab){_0x2e6006['push'](_0x2e6006['shift']());}};_0xac662c(++_0x3dcaf1);}(_0xcdde,0x12b));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecdd('0x0'));var util=require(_0xecdd('0x1'));var moment=require(_0xecdd('0x2'));var BPromise=require(_0xecdd('0x3'));var rs=require(_0xecdd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecdd('0x5'))['db'];var utils=require(_0xecdd('0x6'));var logger=require(_0xecdd('0x7'))(_0xecdd('0x8'));var config=require(_0xecdd('0x9'));var jayson=require(_0xecdd('0xa'));var client=jayson[_0xecdd('0xb')][_0xecdd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cb955,_0x2092ee,_0x4a9eb1){return new BPromise(function(_0x7ebe31,_0x2e6055){return client[_0xecdd('0xd')](_0x1cb955,_0x4a9eb1)[_0xecdd('0xe')](function(_0x3f2d7e){logger[_0xecdd('0xf')](_0xecdd('0x10'),_0x2092ee,_0xecdd('0x11'));logger[_0xecdd('0x12')](_0xecdd('0x13'),_0x2092ee,_0xecdd('0x11'),JSON[_0xecdd('0x14')](_0x3f2d7e));if(_0x3f2d7e[_0xecdd('0x15')]){if(_0x3f2d7e['error'][_0xecdd('0x16')]===0x1f4){logger['error'](_0xecdd('0x10'),_0x2092ee,_0x3f2d7e[_0xecdd('0x15')][_0xecdd('0x17')]);return _0x2e6055(_0x3f2d7e[_0xecdd('0x15')][_0xecdd('0x17')]);}logger[_0xecdd('0x15')](_0xecdd('0x10'),_0x2092ee,_0x3f2d7e['error'][_0xecdd('0x17')]);return _0x7ebe31(_0x3f2d7e['error'][_0xecdd('0x17')]);}else{logger[_0xecdd('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2092ee,_0xecdd('0x11'));_0x7ebe31(_0x3f2d7e['result'][_0xecdd('0x17')]);}})[_0xecdd('0x18')](function(_0x42b56c){logger[_0xecdd('0x15')](_0xecdd('0x10'),_0x2092ee,_0x42b56c);_0x2e6055(_0x42b56c);});});}exports[_0xecdd('0x19')]=function(_0x540ae9){var _0x4f0c5f=this;return new Promise(function(_0x1c2a2c,_0x2faeb2){return db[_0xecdd('0x1a')]['create'](_0x540ae9['body'],{'raw':_0x540ae9[_0xecdd('0x1b')]?_0x540ae9[_0xecdd('0x1b')][_0xecdd('0x1c')]===undefined?!![]:![]:!![]})[_0xecdd('0xe')](function(_0x1a90f0){logger[_0xecdd('0xf')](_0xecdd('0x19'),_0x540ae9);logger[_0xecdd('0x12')](_0xecdd('0x19'),_0x540ae9,JSON['stringify'](_0x1a90f0));_0x1c2a2c(_0x1a90f0);})[_0xecdd('0x18')](function(_0x2961bf){logger[_0xecdd('0x15')](_0xecdd('0x19'),_0x2961bf['message'],_0x540ae9);_0x2faeb2(_0x4f0c5f[_0xecdd('0x15')](0x1f4,_0x2961bf[_0xecdd('0x17')]));});});};exports[_0xecdd('0x1d')]=function(_0x3d416f){var _0x42d0ef=this;return new Promise(function(_0x4ab8ac,_0x4c72de){return db[_0xecdd('0x1a')][_0xecdd('0x1e')](_0x3d416f['body'],{'raw':_0x3d416f[_0xecdd('0x1b')]?_0x3d416f[_0xecdd('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d416f[_0xecdd('0x1b')]?_0x3d416f[_0xecdd('0x1b')][_0xecdd('0x1f')]||null:null,'attributes':_0x3d416f[_0xecdd('0x1b')]?_0x3d416f[_0xecdd('0x1b')][_0xecdd('0x20')]||null:null,'limit':_0x3d416f['options']?_0x3d416f['options'][_0xecdd('0x21')]||null:null})[_0xecdd('0xe')](function(_0x2ddbb7){logger[_0xecdd('0xf')](_0xecdd('0x1d'),_0x3d416f);logger[_0xecdd('0x12')](_0xecdd('0x1d'),_0x3d416f,JSON[_0xecdd('0x14')](_0x2ddbb7));_0x4ab8ac(_0x2ddbb7);})[_0xecdd('0x18')](function(_0xbc04da){logger['error'](_0xecdd('0x1d'),_0xbc04da[_0xecdd('0x17')],_0x3d416f);_0x4c72de(_0x42d0ef[_0xecdd('0x15')](0x1f4,_0xbc04da[_0xecdd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e21122c..6cec723 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 _0x902c=['show','post','isAuthenticated','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x902c,0xb4));var _0xc902=function(_0x19a54e,_0x4fa9e4){_0x19a54e=_0x19a54e-0x0;var _0x276103=_0x902c[_0x19a54e];return _0x276103;};'use strict';var multer=require(_0xc902('0x0'));var util=require(_0xc902('0x1'));var path=require(_0xc902('0x2'));var timeout=require(_0xc902('0x3'));var express=require(_0xc902('0x4'));var router=express['Router']();var fs_extra=require(_0xc902('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc902('0x6'));var config=require('../../config/environment');var controller=require(_0xc902('0x7'));router[_0xc902('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc902('0x8')](_0xc902('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc902('0xa')]);router[_0xc902('0xb')]('/',auth[_0xc902('0xc')](),controller[_0xc902('0xd')]);router[_0xc902('0xe')]('/:id',auth[_0xc902('0xc')](),controller[_0xc902('0xf')]);router[_0xc902('0x10')](_0xc902('0x11'),auth[_0xc902('0xc')](),controller['destroy']);module[_0xc902('0x12')]=router; \ No newline at end of file +var _0xe2ea=['get','/describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2ea,0x1c3));var _0xae2e=function(_0x3bcc0f,_0x3c4bb8){_0x3bcc0f=_0x3bcc0f-0x0;var _0x33862f=_0xe2ea[_0x3bcc0f];return _0x33862f;};'use strict';var multer=require(_0xae2e('0x0'));var util=require(_0xae2e('0x1'));var path=require(_0xae2e('0x2'));var timeout=require(_0xae2e('0x3'));var express=require('express');var router=express[_0xae2e('0x4')]();var fs_extra=require(_0xae2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae2e('0x6'));var config=require(_0xae2e('0x7'));var controller=require(_0xae2e('0x8'));router['get']('/',auth[_0xae2e('0x9')](),controller[_0xae2e('0xa')]);router[_0xae2e('0xb')](_0xae2e('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xae2e('0xd')]);router[_0xae2e('0xe')]('/',auth['isAuthenticated'](),controller[_0xae2e('0xf')]);router[_0xae2e('0x10')]('/:id',auth[_0xae2e('0x9')](),controller[_0xae2e('0x11')]);router[_0xae2e('0x12')](_0xae2e('0x13'),auth[_0xae2e('0x9')](),controller[_0xae2e('0x14')]);module[_0xae2e('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 7911d47..bbf1b10 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 _0xbc95=['sequelize','exports','STRING','ENUM','account'];(function(_0x2854ea,_0x16af20){var _0x40c6e3=function(_0x4b09a7){while(--_0x4b09a7){_0x2854ea['push'](_0x2854ea['shift']());}};_0x40c6e3(++_0x16af20);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x58bce9,_0x3c41e5){_0x58bce9=_0x58bce9-0x0;var _0x1b4eaf=_0xbc95[_0x58bce9];return _0x1b4eaf;};'use strict';var Sequelize=require(_0x5bc9('0x0'));module[_0x5bc9('0x1')]={'uniqueid':{'type':Sequelize[_0x5bc9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bc9('0x3')](_0x5bc9('0x4'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x97b2=['STRING','ENUM','account','agent','DATE','sequelize','exports'];(function(_0x106137,_0xf3c345){var _0x1ef76d=function(_0x1ae3b5){while(--_0x1ae3b5){_0x106137['push'](_0x106137['shift']());}};_0x1ef76d(++_0xf3c345);}(_0x97b2,0x1b7));var _0x297b=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0x97b2[_0x4e11d5];return _0x5e4e4c;};'use strict';var Sequelize=require(_0x297b('0x0'));module[_0x297b('0x1')]={'uniqueid':{'type':Sequelize[_0x297b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x297b('0x3')](_0x297b('0x4'),_0x297b('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x297b('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e6f440b..e0a6f81 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 _0xac9a=['where','pick','merge','options','includeAll','catch','show','params','fields','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3e0e91,_0x5758c3){var _0x134a7d=function(_0x5b620a){while(--_0x5b620a){_0x3e0e91['push'](_0x3e0e91['shift']());}};_0x134a7d(++_0x5758c3);}(_0xac9a,0x131));var _0xaac9=function(_0x1c360a,_0x50d2a0){_0x1c360a=_0x1c360a-0x0;var _0x535c4c=_0xac9a[_0x1c360a];return _0x535c4c;};'use strict';var emlformat=require(_0xaac9('0x0'));var rimraf=require(_0xaac9('0x1'));var zipdir=require(_0xaac9('0x2'));var jsonpatch=require(_0xaac9('0x3'));var rp=require('request-promise');var moment=require(_0xaac9('0x4'));var BPromise=require(_0xaac9('0x5'));var Mustache=require('mustache');var util=require(_0xaac9('0x6'));var path=require(_0xaac9('0x7'));var sox=require(_0xaac9('0x8'));var csv=require(_0xaac9('0x9'));var ejs=require(_0xaac9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac9('0xb'));var squel=require(_0xaac9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaac9('0xd'));var toCsv=require(_0xaac9('0x9'));var querystring=require(_0xaac9('0xe'));var Papa=require(_0xaac9('0xf'));var Redis=require(_0xaac9('0x10'));var authService=require(_0xaac9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaac9('0x12'))(_0xaac9('0x13'));var utils=require('../../config/utils');var config=require(_0xaac9('0x14'));var licenseUtil=require(_0xaac9('0x15'));var db=require(_0xaac9('0x16'))['db'];function respondWithStatusCode(_0x5e2933,_0x3b333c){_0x3b333c=_0x3b333c||0xcc;return function(_0x55aeff){if(_0x55aeff){return _0x5e2933['sendStatus'](_0x3b333c);}return _0x5e2933[_0xaac9('0x17')](_0x3b333c)['end']();};}function respondWithResult(_0x1f0506,_0x114fab){_0x114fab=_0x114fab||0xc8;return function(_0x246b82){if(_0x246b82){return _0x1f0506[_0xaac9('0x17')](_0x114fab)['json'](_0x246b82);}};}function respondWithFilteredResult(_0x1a3074,_0x3e57a8){return function(_0x15dad8){if(_0x15dad8){var _0x292012=typeof _0x3e57a8['offset']==='undefined'&&typeof _0x3e57a8['limit']===_0xaac9('0x18');var _0x5eb691=_0x15dad8[_0xaac9('0x19')];var _0x58fd20=_0x292012?0x0:_0x3e57a8[_0xaac9('0x1a')];var _0x11bbc5=_0x292012?_0x15dad8[_0xaac9('0x19')]:_0x3e57a8[_0xaac9('0x1a')]+_0x3e57a8[_0xaac9('0x1b')];var _0x2ef5b5;if(_0x11bbc5>=_0x5eb691){_0x11bbc5=_0x5eb691;_0x2ef5b5=0xc8;}else{_0x2ef5b5=0xce;}_0x1a3074[_0xaac9('0x17')](_0x2ef5b5);return _0x1a3074[_0xaac9('0x1c')](_0xaac9('0x1d'),_0x58fd20+'-'+_0x11bbc5+'/'+_0x5eb691)[_0xaac9('0x1e')](_0x15dad8);}return null;};}function patchUpdates(_0x5664b4){return function(_0x4611ac){try{jsonpatch[_0xaac9('0x1f')](_0x4611ac,_0x5664b4,!![]);}catch(_0x20ba44){return BPromise[_0xaac9('0x20')](_0x20ba44);}return _0x4611ac[_0xaac9('0x21')]();};}function saveUpdates(_0x4f019e,_0x1320ab){return function(_0x424f0f){if(_0x424f0f){return _0x424f0f[_0xaac9('0x22')](_0x4f019e)[_0xaac9('0x23')](function(_0x1d1735){return _0x1d1735;});}return null;};}function removeEntity(_0x8f5400,_0x35308){return function(_0x4699e8){if(_0x4699e8){return _0x4699e8[_0xaac9('0x24')]()[_0xaac9('0x23')](function(){_0x8f5400[_0xaac9('0x17')](0xcc)[_0xaac9('0x25')]();});}};}function handleEntityNotFound(_0xc23285,_0x4b8673){return function(_0x188864){if(!_0x188864){_0xc23285['sendStatus'](0x194);}return _0x188864;};}function handleError(_0x463055,_0x21fa18){_0x21fa18=_0x21fa18||0x1f4;return function(_0x569339){logger[_0xaac9('0x26')](_0x569339[_0xaac9('0x27')]);if(_0x569339[_0xaac9('0x28')]){delete _0x569339[_0xaac9('0x28')];}_0x463055['status'](_0x21fa18)[_0xaac9('0x29')](_0x569339);};}exports[_0xaac9('0x2a')]=function(_0xfb0427,_0x4cd821){var _0x6fdda4={},_0x5b92a0={},_0x741973={'count':0x0,'rows':[]};var _0x3947ef=_[_0xaac9('0x2b')](db[_0xaac9('0x2c')][_0xaac9('0x2d')],function(_0x22ab31){return{'name':_0x22ab31[_0xaac9('0x2e')],'type':_0x22ab31[_0xaac9('0x2f')][_0xaac9('0x30')]};});_0x5b92a0[_0xaac9('0x31')]=_['map'](_0x3947ef,_0xaac9('0x28'));_0x5b92a0['query']=_[_0xaac9('0x32')](_0xfb0427[_0xaac9('0x33')]);_0x5b92a0[_0xaac9('0x34')]=_[_0xaac9('0x35')](_0x5b92a0[_0xaac9('0x31')],_0x5b92a0[_0xaac9('0x33')]);_0x6fdda4[_0xaac9('0x36')]=_[_0xaac9('0x35')](_0x5b92a0[_0xaac9('0x31')],qs['fields'](_0xfb0427[_0xaac9('0x33')]['fields']));_0x6fdda4[_0xaac9('0x36')]=_0x6fdda4['attributes'][_0xaac9('0x37')]?_0x6fdda4[_0xaac9('0x36')]:_0x5b92a0[_0xaac9('0x31')];if(!_0xfb0427[_0xaac9('0x33')][_0xaac9('0x38')](_0xaac9('0x39'))){_0x6fdda4['limit']=qs[_0xaac9('0x1b')](_0xfb0427[_0xaac9('0x33')]['limit']);_0x6fdda4[_0xaac9('0x1a')]=qs[_0xaac9('0x1a')](_0xfb0427[_0xaac9('0x33')][_0xaac9('0x1a')]);}_0x6fdda4[_0xaac9('0x3a')]=qs['sort'](_0xfb0427[_0xaac9('0x33')][_0xaac9('0x3b')]);_0x6fdda4[_0xaac9('0x3c')]=qs[_0xaac9('0x34')](_[_0xaac9('0x3d')](_0xfb0427[_0xaac9('0x33')],_0x5b92a0[_0xaac9('0x34')]),_0x3947ef);if(_0xfb0427[_0xaac9('0x33')]['filter']){_0x6fdda4[_0xaac9('0x3c')]=_[_0xaac9('0x3e')](_0x6fdda4[_0xaac9('0x3c')],{'$or':_['map'](_0x3947ef,function(_0x3bd235){if(_0x3bd235[_0xaac9('0x2f')]!=='VIRTUAL'){var _0x5f5076={};_0x5f5076[_0x3bd235['name']]={'$like':'%'+_0xfb0427[_0xaac9('0x33')]['filter']+'%'};return _0x5f5076;}})});}_0x6fdda4=_[_0xaac9('0x3e')]({},_0x6fdda4,_0xfb0427[_0xaac9('0x3f')]);var _0x35376b={'where':_0x6fdda4['where']};return db[_0xaac9('0x2c')][_0xaac9('0x19')](_0x35376b)[_0xaac9('0x23')](function(_0x5219b8){_0x741973[_0xaac9('0x19')]=_0x5219b8;if(_0xfb0427[_0xaac9('0x33')][_0xaac9('0x40')]){_0x6fdda4['include']=[{'all':!![]}];}return db[_0xaac9('0x2c')]['findAll'](_0x6fdda4);})['then'](function(_0x8c8af2){_0x741973['rows']=_0x8c8af2;return _0x741973;})[_0xaac9('0x23')](respondWithFilteredResult(_0x4cd821,_0x6fdda4))[_0xaac9('0x41')](handleError(_0x4cd821,null));};exports[_0xaac9('0x42')]=function(_0x46891e,_0x20a3f0){var _0x76ce97={'raw':!![],'where':{'id':_0x46891e[_0xaac9('0x43')]['id']}},_0x4bd949={};_0x4bd949[_0xaac9('0x31')]=_[_0xaac9('0x32')](db[_0xaac9('0x2c')][_0xaac9('0x2d')]);_0x4bd949['query']=_[_0xaac9('0x32')](_0x46891e['query']);_0x4bd949['filters']=_['intersection'](_0x4bd949['model'],_0x4bd949['query']);_0x76ce97[_0xaac9('0x36')]=_[_0xaac9('0x35')](_0x4bd949[_0xaac9('0x31')],qs[_0xaac9('0x44')](_0x46891e['query']['fields']));_0x76ce97[_0xaac9('0x36')]=_0x76ce97[_0xaac9('0x36')][_0xaac9('0x37')]?_0x76ce97[_0xaac9('0x36')]:_0x4bd949['model'];if(_0x46891e[_0xaac9('0x33')][_0xaac9('0x40')]){_0x76ce97['include']=[{'all':!![]}];}_0x76ce97=_[_0xaac9('0x3e')]({},_0x76ce97,_0x46891e['options']);return db['WhatsappTransferReport']['find'](_0x76ce97)[_0xaac9('0x23')](handleEntityNotFound(_0x20a3f0,null))['then'](respondWithResult(_0x20a3f0,null))[_0xaac9('0x41')](handleError(_0x20a3f0,null));};exports['create']=function(_0x4265a1,_0x4a5bee){return db['WhatsappTransferReport'][_0xaac9('0x45')](_0x4265a1[_0xaac9('0x46')],{})[_0xaac9('0x23')](respondWithResult(_0x4a5bee,0xc9))[_0xaac9('0x41')](handleError(_0x4a5bee,null));};exports[_0xaac9('0x22')]=function(_0x231370,_0x356591){if(_0x231370['body']['id']){delete _0x231370[_0xaac9('0x46')]['id'];}return db[_0xaac9('0x2c')][_0xaac9('0x47')]({'where':{'id':_0x231370[_0xaac9('0x43')]['id']}})[_0xaac9('0x23')](handleEntityNotFound(_0x356591,null))[_0xaac9('0x23')](saveUpdates(_0x231370[_0xaac9('0x46')],null))[_0xaac9('0x23')](respondWithResult(_0x356591,null))['catch'](handleError(_0x356591,null));};exports['destroy']=function(_0x28fe85,_0x4981f4){return db['WhatsappTransferReport']['find']({'where':{'id':_0x28fe85[_0xaac9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4981f4,null))['then'](removeEntity(_0x4981f4,null))['catch'](handleError(_0x4981f4,null));};exports['describe']=function(_0x4d3e10,_0x3f78d7){return db[_0xaac9('0x2c')][_0xaac9('0x48')]()[_0xaac9('0x23')](respondWithResult(_0x3f78d7,null))['catch'](handleError(_0x3f78d7,null));}; \ No newline at end of file +var _0xc900=['filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','keys','query'];(function(_0xc9cd67,_0x340f38){var _0x5aaa21=function(_0x43a9ea){while(--_0x43a9ea){_0xc9cd67['push'](_0xc9cd67['shift']());}};_0x5aaa21(++_0x340f38);}(_0xc900,0xb3));var _0x0c90=function(_0x38124f,_0x2e241c){_0x38124f=_0x38124f-0x0;var _0x2e6c9a=_0xc900[_0x38124f];return _0x2e6c9a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){_0x212164['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d005,_0x3ea861){return function(_0x35c243){if(!_0x35c243){_0x28d005[_0x0c90('0x19')](0x194);}return _0x35c243;};}function handleError(_0x4dde67,_0x2dfa14){_0x2dfa14=_0x2dfa14||0x1f4;return function(_0x438652){logger[_0x0c90('0x27')](_0x438652[_0x0c90('0x28')]);if(_0x438652[_0x0c90('0x29')]){delete _0x438652[_0x0c90('0x29')];}_0x4dde67['status'](_0x2dfa14)[_0x0c90('0x2a')](_0x438652);};}exports[_0x0c90('0x2b')]=function(_0x39f1b2,_0x13b377){var _0x52d28d={},_0x4c8603={},_0x1f27f1={'count':0x0,'rows':[]};var _0x25da6e=_[_0x0c90('0x2c')](db[_0x0c90('0x2d')][_0x0c90('0x2e')],function(_0x562664){return{'name':_0x562664[_0x0c90('0x2f')],'type':_0x562664[_0x0c90('0x30')][_0x0c90('0x31')]};});_0x4c8603['model']=_[_0x0c90('0x2c')](_0x25da6e,'name');_0x4c8603['query']=_[_0x0c90('0x32')](_0x39f1b2[_0x0c90('0x33')]);_0x4c8603[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x4c8603['model'],_0x4c8603[_0x0c90('0x33')]);_0x52d28d['attributes']=_[_0x0c90('0x35')](_0x4c8603['model'],qs[_0x0c90('0x36')](_0x39f1b2[_0x0c90('0x33')]['fields']));_0x52d28d[_0x0c90('0x37')]=_0x52d28d[_0x0c90('0x37')][_0x0c90('0x38')]?_0x52d28d[_0x0c90('0x37')]:_0x4c8603[_0x0c90('0x39')];if(!_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3a')](_0x0c90('0x3b'))){_0x52d28d['limit']=qs[_0x0c90('0x1f')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1f')]);_0x52d28d[_0x0c90('0x1d')]=qs['offset'](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x1d')]);}_0x52d28d[_0x0c90('0x3c')]=qs[_0x0c90('0x3d')](_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3d')]);_0x52d28d[_0x0c90('0x3e')]=qs[_0x0c90('0x34')](_['pick'](_0x39f1b2[_0x0c90('0x33')],_0x4c8603[_0x0c90('0x34')]),_0x25da6e);if(_0x39f1b2['query'][_0x0c90('0x3f')]){_0x52d28d[_0x0c90('0x3e')]=_[_0x0c90('0x40')](_0x52d28d[_0x0c90('0x3e')],{'$or':_[_0x0c90('0x2c')](_0x25da6e,function(_0x50c126){if(_0x50c126[_0x0c90('0x30')]!==_0x0c90('0x41')){var _0x11530f={};_0x11530f[_0x50c126[_0x0c90('0x29')]]={'$like':'%'+_0x39f1b2[_0x0c90('0x33')][_0x0c90('0x3f')]+'%'};return _0x11530f;}})});}_0x52d28d=_[_0x0c90('0x40')]({},_0x52d28d,_0x39f1b2[_0x0c90('0x42')]);var _0x11a8e3={'where':_0x52d28d['where']};return db[_0x0c90('0x2d')]['count'](_0x11a8e3)[_0x0c90('0x25')](function(_0x593cc0){_0x1f27f1[_0x0c90('0x20')]=_0x593cc0;if(_0x39f1b2[_0x0c90('0x33')]['includeAll']){_0x52d28d['include']=[{'all':!![]}];}return db[_0x0c90('0x2d')]['findAll'](_0x52d28d);})[_0x0c90('0x25')](function(_0x4545bb){_0x1f27f1[_0x0c90('0x43')]=_0x4545bb;return _0x1f27f1;})['then'](respondWithFilteredResult(_0x13b377,_0x52d28d))[_0x0c90('0x44')](handleError(_0x13b377,null));};exports[_0x0c90('0x45')]=function(_0x123b58,_0x3e5137){var _0x2139c3={'raw':!![],'where':{'id':_0x123b58['params']['id']}},_0x1184c4={};_0x1184c4[_0x0c90('0x39')]=_[_0x0c90('0x32')](db[_0x0c90('0x2d')][_0x0c90('0x2e')]);_0x1184c4[_0x0c90('0x33')]=_[_0x0c90('0x32')](_0x123b58[_0x0c90('0x33')]);_0x1184c4['filters']=_[_0x0c90('0x35')](_0x1184c4['model'],_0x1184c4[_0x0c90('0x33')]);_0x2139c3[_0x0c90('0x37')]=_[_0x0c90('0x35')](_0x1184c4[_0x0c90('0x39')],qs[_0x0c90('0x36')](_0x123b58[_0x0c90('0x33')][_0x0c90('0x36')]));_0x2139c3[_0x0c90('0x37')]=_0x2139c3[_0x0c90('0x37')][_0x0c90('0x38')]?_0x2139c3[_0x0c90('0x37')]:_0x1184c4[_0x0c90('0x39')];if(_0x123b58[_0x0c90('0x33')][_0x0c90('0x46')]){_0x2139c3[_0x0c90('0x47')]=[{'all':!![]}];}_0x2139c3=_['merge']({},_0x2139c3,_0x123b58[_0x0c90('0x42')]);return db[_0x0c90('0x2d')][_0x0c90('0x48')](_0x2139c3)[_0x0c90('0x25')](handleEntityNotFound(_0x3e5137,null))[_0x0c90('0x25')](respondWithResult(_0x3e5137,null))[_0x0c90('0x44')](handleError(_0x3e5137,null));};exports[_0x0c90('0x49')]=function(_0x302dc6,_0x3bb138){return db[_0x0c90('0x2d')][_0x0c90('0x49')](_0x302dc6[_0x0c90('0x4a')],{})[_0x0c90('0x25')](respondWithResult(_0x3bb138,0xc9))[_0x0c90('0x44')](handleError(_0x3bb138,null));};exports['update']=function(_0x1b4aac,_0x38f492){if(_0x1b4aac['body']['id']){delete _0x1b4aac['body']['id'];}return db['WhatsappTransferReport'][_0x0c90('0x48')]({'where':{'id':_0x1b4aac[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x38f492,null))[_0x0c90('0x25')](saveUpdates(_0x1b4aac[_0x0c90('0x4a')],null))['then'](respondWithResult(_0x38f492,null))[_0x0c90('0x44')](handleError(_0x38f492,null));};exports[_0x0c90('0x26')]=function(_0x2b756d,_0x549c78){return db[_0x0c90('0x2d')][_0x0c90('0x48')]({'where':{'id':_0x2b756d[_0x0c90('0x4b')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x549c78,null))[_0x0c90('0x25')](removeEntity(_0x549c78,null))[_0x0c90('0x44')](handleError(_0x549c78,null));};exports[_0x0c90('0x4c')]=function(_0x2a339d,_0x1daeed){return db[_0x0c90('0x2d')]['describe']()[_0x0c90('0x25')](respondWithResult(_0x1daeed,null))['catch'](handleError(_0x1daeed,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ca7ea2c..8b66af5 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 _0x4b15=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x621b28,_0x1b0547){var _0x391f9e=function(_0x4eab22){while(--_0x4eab22){_0x621b28['push'](_0x621b28['shift']());}};_0x391f9e(++_0x1b0547);}(_0x4b15,0x118));var _0x54b1=function(_0x2e7368,_0x4b5c32){_0x2e7368=_0x2e7368-0x0;var _0x1f537b=_0x4b15[_0x2e7368];return _0x1f537b;};'use strict';var _=require(_0x54b1('0x0'));var util=require(_0x54b1('0x1'));var logger=require(_0x54b1('0x2'))('api');var moment=require(_0x54b1('0x3'));var BPromise=require(_0x54b1('0x4'));var rp=require(_0x54b1('0x5'));var fs=require('fs');var path=require(_0x54b1('0x6'));var rimraf=require('rimraf');var config=require(_0x54b1('0x7'));var attributes=require(_0x54b1('0x8'));module[_0x54b1('0x9')]=function(_0x37529a,_0x1a783e){return _0x37529a[_0x54b1('0xa')](_0x54b1('0xb'),attributes,{'tableName':_0x54b1('0xc'),'paranoid':![],'indexes':[{'name':_0x54b1('0xd'),'fields':[_0x54b1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0db1=['WhatsappTransferReport','uniqueid','util','api','bluebird','../../config/environment','./whatsappTransferReport.attributes'];(function(_0xb3339d,_0x8803d){var _0x4dce04=function(_0x42ead0){while(--_0x42ead0){_0xb3339d['push'](_0xb3339d['shift']());}};_0x4dce04(++_0x8803d);}(_0x0db1,0x136));var _0x10db=function(_0x99f98c,_0x3d8aaf){_0x99f98c=_0x99f98c-0x0;var _0x5ea1e8=_0x0db1[_0x99f98c];return _0x5ea1e8;};'use strict';var _=require('lodash');var util=require(_0x10db('0x0'));var logger=require('../../config/logger')(_0x10db('0x1'));var moment=require('moment');var BPromise=require(_0x10db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x10db('0x3'));var attributes=require(_0x10db('0x4'));module['exports']=function(_0x519391,_0x371dc1){return _0x519391['define'](_0x10db('0x5'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x10db('0x6'),'fields':[_0x10db('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 3a5181c..b909818 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 _0x175d=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x18ea7b,_0x4981cc){var _0x23c405=function(_0x4694ec){while(--_0x4694ec){_0x18ea7b['push'](_0x18ea7b['shift']());}};_0x23c405(++_0x4981cc);}(_0x175d,0x13d));var _0xd175=function(_0x403015,_0x2ae377){_0x403015=_0x403015-0x0;var _0x524e13=_0x175d[_0x403015];return _0x524e13;};'use strict';var _=require('lodash');var util=require(_0xd175('0x0'));var moment=require(_0xd175('0x1'));var BPromise=require(_0xd175('0x2'));var rs=require(_0xd175('0x3'));var fs=require('fs');var Redis=require(_0xd175('0x4'));var db=require(_0xd175('0x5'))['db'];var utils=require(_0xd175('0x6'));var logger=require(_0xd175('0x7'))(_0xd175('0x8'));var config=require(_0xd175('0x9'));var jayson=require(_0xd175('0xa'));var client=jayson[_0xd175('0xb')][_0xd175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ec1e8,_0x74af42,_0x73ccf3){return new BPromise(function(_0x2adc28,_0x483978){return client[_0xd175('0xd')](_0x4ec1e8,_0x73ccf3)[_0xd175('0xe')](function(_0x7651e3){logger[_0xd175('0xf')](_0xd175('0x10'),_0x74af42,_0xd175('0x11'));logger[_0xd175('0x12')](_0xd175('0x13'),_0x74af42,_0xd175('0x11'),JSON[_0xd175('0x14')](_0x7651e3));if(_0x7651e3[_0xd175('0x15')]){if(_0x7651e3[_0xd175('0x15')][_0xd175('0x16')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x74af42,_0x7651e3['error'][_0xd175('0x17')]);return _0x483978(_0x7651e3[_0xd175('0x15')][_0xd175('0x17')]);}logger[_0xd175('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x74af42,_0x7651e3[_0xd175('0x15')][_0xd175('0x17')]);return _0x2adc28(_0x7651e3[_0xd175('0x15')][_0xd175('0x17')]);}else{logger[_0xd175('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x74af42,'request\x20sent');_0x2adc28(_0x7651e3[_0xd175('0x18')]['message']);}})[_0xd175('0x19')](function(_0x3479f3){logger[_0xd175('0x15')](_0xd175('0x10'),_0x74af42,_0x3479f3);_0x483978(_0x3479f3);});});} \ No newline at end of file +var _0x53ae=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x53ae,0x133));var _0xe53a=function(_0xd93a79,_0x34b03b){_0xd93a79=_0xd93a79-0x0;var _0x51d792=_0x53ae[_0xd93a79];return _0x51d792;};'use strict';var _=require(_0xe53a('0x0'));var util=require(_0xe53a('0x1'));var moment=require(_0xe53a('0x2'));var BPromise=require(_0xe53a('0x3'));var rs=require(_0xe53a('0x4'));var fs=require('fs');var Redis=require(_0xe53a('0x5'));var db=require(_0xe53a('0x6'))['db'];var utils=require(_0xe53a('0x7'));var logger=require(_0xe53a('0x8'))(_0xe53a('0x9'));var config=require(_0xe53a('0xa'));var jayson=require(_0xe53a('0xb'));var client=jayson[_0xe53a('0xc')][_0xe53a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c31b2,_0x4c6e2f,_0x374e9f){return new BPromise(function(_0x368812,_0x1ead69){return client['request'](_0x1c31b2,_0x374e9f)[_0xe53a('0xe')](function(_0x545f6e){logger[_0xe53a('0xf')](_0xe53a('0x10'),_0x4c6e2f,_0xe53a('0x11'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4c6e2f,'request\x20sent',JSON['stringify'](_0x545f6e));if(_0x545f6e['error']){if(_0x545f6e['error'][_0xe53a('0x12')]===0x1f4){logger[_0xe53a('0x13')](_0xe53a('0x10'),_0x4c6e2f,_0x545f6e['error'][_0xe53a('0x14')]);return _0x1ead69(_0x545f6e[_0xe53a('0x13')][_0xe53a('0x14')]);}logger[_0xe53a('0x13')](_0xe53a('0x10'),_0x4c6e2f,_0x545f6e[_0xe53a('0x13')][_0xe53a('0x14')]);return _0x368812(_0x545f6e[_0xe53a('0x13')][_0xe53a('0x14')]);}else{logger['info'](_0xe53a('0x10'),_0x4c6e2f,_0xe53a('0x11'));_0x368812(_0x545f6e[_0xe53a('0x15')][_0xe53a('0x14')]);}})[_0xe53a('0x16')](function(_0x1cc57d){logger[_0xe53a('0x13')](_0xe53a('0x10'),_0x4c6e2f,_0x1cc57d);_0x1ead69(_0x1cc57d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3b2e422..e283856 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a63=['default','listen','info','start','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','filter','status','None','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x5a63,0xe3));var _0x35a6=function(_0x156789,_0x52249e){_0x156789=_0x156789-0x0;var _0x203419=_0x5a63[_0x156789];return _0x203419;};'use strict';var _=require(_0x35a6('0x0'));var db=require(_0x35a6('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x35a6('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0x35a6('0x3'));var pm2=require(_0x35a6('0x4'));var pm2Config=require(_0x35a6('0x5'));var schedule=require(_0x35a6('0x6'));var chat=require(_0x35a6('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x35a6('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x35a6('0x9')]['sync']()[_0x35a6('0xa')](function(){if(config['seedDB']){return seedDb[_0x35a6('0xb')]();}})[_0x35a6('0xa')](function(){return checkLicense[_0x35a6('0xb')]();})[_0x35a6('0xa')](function(){return rpc[_0x35a6('0xc')]();})['then'](function(_0x2899a8){logger[_0x35a6('0xd')](_0x2899a8);return chat[_0x35a6('0xe')]();})['then'](function(){return whatsapp[_0x35a6('0xe')]();})['then'](function(){return schedule[_0x35a6('0xe')]();})[_0x35a6('0xa')](function(){return transcribe[_0x35a6('0xe')]();})[_0x35a6('0xa')](function(){return provider[_0x35a6('0xe')]();})['then'](function(_0x436c0a){logger[_0x35a6('0xd')](_0x436c0a);return pm2[_0x35a6('0xe')](pm2Config);})[_0x35a6('0xa')](function(_0x250c7){var _0x30154b=_0x250c7['filter'](function(_0x32347a){return typeof _0x32347a[_0x35a6('0xf')]===_0x35a6('0x10')&&_0x32347a[_0x35a6('0xf')]>=0x0;});if(_0x30154b[_0x35a6('0x11')]>0x0){throw new Error(_0x30154b[_0x35a6('0x11')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x35a6('0x12')](_0x30154b,function(_0x4047d2){return'\x22'+_0x4047d2[_0x35a6('0x13')][_0x35a6('0x14')]+'\x22';}));}logger[_0x35a6('0xd')](_0x35a6('0x15'),_[_0x35a6('0x12')](_['filter'](_0x250c7,{'status':_0x35a6('0x16')}),_0x35a6('0x14'))[_0x35a6('0x17')]());logger['info'](_0x35a6('0x18'),_[_0x35a6('0x12')](_[_0x35a6('0x19')](_0x250c7,function(_0x4a68b6){return _0x4a68b6[_0x35a6('0x1a')]!==_0x35a6('0x16');}),'name')[_0x35a6('0x17')]()||_0x35a6('0x1b'));console['log']('App\x20Ready!');})[_0x35a6('0x1c')](function(_0x13f029){console[_0x35a6('0x1d')](_0x35a6('0x1e'),_0x13f029);logger[_0x35a6('0x1f')](_0x35a6('0x20'),_0x13f029);process[_0x35a6('0x21')](0x1);});}main(); \ No newline at end of file +var _0x96f1=['./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','info','Online\x20apps:','online','name','Offline\x20apps:','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment'];(function(_0x254e8b,_0x5868ee){var _0x1e1d15=function(_0x334772){while(--_0x334772){_0x254e8b['push'](_0x254e8b['shift']());}};_0x1e1d15(++_0x5868ee);}(_0x96f1,0x19c));var _0x196f=function(_0x47ed60,_0x526d60){_0x47ed60=_0x47ed60-0x0;var _0x34580b=_0x96f1[_0x47ed60];return _0x34580b;};'use strict';var _=require(_0x196f('0x0'));var db=require(_0x196f('0x1'))['db'];var seedDb=require(_0x196f('0x2'));var checkLicense=require(_0x196f('0x3'));var rpc=require(_0x196f('0x4'));var config=require(_0x196f('0x5'));var logger=require(_0x196f('0x6'))(_0x196f('0x7'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x196f('0x8'));var chat=require(_0x196f('0x9'));var whatsapp=require(_0x196f('0xa'));var transcribe=require(_0x196f('0xb'));var provider=require(_0x196f('0xc'));function main(){return db['sequelize'][_0x196f('0xd')]()[_0x196f('0xe')](function(){if(config[_0x196f('0xf')]){return seedDb[_0x196f('0x10')]();}})['then'](function(){return checkLicense[_0x196f('0x10')]();})['then'](function(){return rpc[_0x196f('0x11')]();})['then'](function(_0x7f3527){logger['info'](_0x7f3527);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0x196f('0xe')](function(){return schedule[_0x196f('0x12')]();})[_0x196f('0xe')](function(){return transcribe[_0x196f('0x12')]();})[_0x196f('0xe')](function(){return provider[_0x196f('0x12')]();})['then'](function(_0x3aef83){logger['info'](_0x3aef83);return pm2[_0x196f('0x12')](pm2Config);})['then'](function(_0x16bd9d){var _0x516a91=_0x16bd9d[_0x196f('0x13')](function(_0x106562){return typeof _0x106562[_0x196f('0x14')]===_0x196f('0x15')&&_0x106562[_0x196f('0x14')]>=0x0;});if(_0x516a91[_0x196f('0x16')]>0x0){throw new Error(_0x516a91['length']+_0x196f('0x17')+_[_0x196f('0x18')](_0x516a91,function(_0x1e73f1){return'\x22'+_0x1e73f1[_0x196f('0x19')]['name']+'\x22';}));}logger[_0x196f('0x1a')](_0x196f('0x1b'),_[_0x196f('0x18')](_['filter'](_0x16bd9d,{'status':_0x196f('0x1c')}),_0x196f('0x1d'))['join']());logger['info'](_0x196f('0x1e'),_[_0x196f('0x18')](_[_0x196f('0x13')](_0x16bd9d,function(_0x16bec1){return _0x16bec1[_0x196f('0x1f')]!==_0x196f('0x1c');}),_0x196f('0x1d'))['join']()||_0x196f('0x20'));console[_0x196f('0x21')](_0x196f('0x22'));})['catch'](function(_0x4ba46a){console[_0x196f('0x21')](_0x196f('0x23'),_0x4ba46a);logger[_0x196f('0x24')](_0x196f('0x25'),_0x4ba46a);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4c9a71a..b692ace 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 _0x6b62=['toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','floor','now','toString','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','email','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isAuthenticated','use','user','params','closed','disposition','then','forceDownload','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','name','pass','Bearer','status','query','getUuid','apikey','sub','Setting','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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','decryptString','split'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0x6b62,0x1ad));var _0x26b6=function(_0x548c41,_0x183f0e){_0x548c41=_0x548c41-0x0;var _0x53b27a=_0x6b62[_0x548c41];return _0x53b27a;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x26b6('0x0'));var licenseUtil=require(_0x26b6('0x1'));var encryptor=require(_0x26b6('0x2'));var _=require(_0x26b6('0x3'));var jwt=require(_0x26b6('0x4'));var expressJwt=require(_0x26b6('0x5'));var compose=require(_0x26b6('0x6'));var basicAuth=require(_0x26b6('0x7'));var crypto=require(_0x26b6('0x8'));var BPromise=require(_0x26b6('0x9'));var util=require(_0x26b6('0xa'));var moment=require(_0x26b6('0xb'));var validateJwt=expressJwt({'secret':config[_0x26b6('0xc')]['session']});var userAttributes=['id',_0x26b6('0xd'),_0x26b6('0xe'),'name','internal',_0x26b6('0xf'),_0x26b6('0x10'),'permissions',_0x26b6('0x11'),_0x26b6('0x12'),_0x26b6('0x13'),'mailPause',_0x26b6('0x14'),'smsPause',_0x26b6('0x15'),_0x26b6('0x16'),_0x26b6('0x17'),_0x26b6('0x18'),_0x26b6('0x19'),_0x26b6('0x1a'),_0x26b6('0x1b'),_0x26b6('0x1c'),'alias',_0x26b6('0x1d'),_0x26b6('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x26b6('0x1f'),_0x26b6('0x20'),'phoneBarExpires',_0x26b6('0x21'),_0x26b6('0x22'),_0x26b6('0x23'),_0x26b6('0x24'),_0x26b6('0x25'),_0x26b6('0x26'),'privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings',_0x26b6('0x27'),_0x26b6('0x28'),_0x26b6('0x29'),'selectRecallMeCampaign',_0x26b6('0x2a'),'chatAutoanswerDelay','emailAutoanswer',_0x26b6('0x2b'),_0x26b6('0x2c'),_0x26b6('0x2d'),_0x26b6('0x2e'),_0x26b6('0x2f'),_0x26b6('0x30'),'faxAutoanswerDelay',_0x26b6('0x31'),_0x26b6('0x32'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0x26b6('0x33')](!![])[_0x26b6('0x34')](function(_0x130f3a,_0x4c5854,_0x543bae){if(_0x130f3a[_0x26b6('0x35')]){_0x543bae();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x130f3a[_0x26b6('0x36')]['id']},'attributes':['id',_0x26b6('0x37'),_0x26b6('0x38')],'raw':!![]})[_0x26b6('0x39')](function(_0x22bf21){if(_0x22bf21&&_0x22bf21[_0x26b6('0x37')]&&!_0x130f3a['query'][_0x26b6('0x3a')]){return _0x4c5854['status'](_0x22bf21['disposition']===_0x26b6('0x3b')?0x195:0x193)[_0x26b6('0x3c')]({'message':_0x22bf21[_0x26b6('0x38')]===_0x26b6('0x3b')?'Unmanaged.':_0x26b6('0x3d')});}else{_0x543bae();}})[_0x26b6('0x3e')](function(_0x5e7e80){_0x543bae(_0x5e7e80);});}});};exports[_0x26b6('0x33')]=function isAuthenticated(_0x43ea5b){return compose()[_0x26b6('0x34')](function(_0x4ad998,_0x5a9156,_0x572059){var _0x24f565;if(_0x4ad998[_0x26b6('0x3f')][_0x26b6('0x40')]){if(_[_0x26b6('0x41')](_0x4ad998[_0x26b6('0x3f')]['authorization'],_0x26b6('0x42'))){var _0x203b64=basicAuth(_0x4ad998);db[_0x26b6('0x43')][_0x26b6('0x44')]({'where':{'name':_0x203b64[_0x26b6('0x45')]}})[_0x26b6('0x39')](function(_0x3b7a43){if(!_0x3b7a43||!_0x3b7a43['authenticate'](_0x203b64[_0x26b6('0x46')])){return _0x5a9156['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x4ad998[_0x26b6('0x35')]={'id':_0x3b7a43['id']};_0x572059();})[_0x26b6('0x3e')](function(_0x1c0eb8){_0x572059(_0x1c0eb8);});}else if(_[_0x26b6('0x41')](_0x4ad998[_0x26b6('0x3f')][_0x26b6('0x40')],_0x26b6('0x47'))){validateJwt(_0x4ad998,_0x5a9156,_0x572059);}else{if(_0x43ea5b){_0x572059();}else{return _0x5a9156[_0x26b6('0x48')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4ad998[_0x26b6('0x49')]['apikey']){try{var _0x2177df={'audience':hardwareConf[_0x26b6('0x4a')](),'issuer':hardwareConf[_0x26b6('0x4a')]()};verifyJwt(_0x4ad998[_0x26b6('0x49')][_0x26b6('0x4b')],_0x2177df)[_0x26b6('0x39')](function(_0x3d2cdc){return db[_0x26b6('0x43')][_0x26b6('0x44')]({'where':{'id':_0x3d2cdc[_0x26b6('0x4c')]}})[_0x26b6('0x39')](function(_0x32f83c){_0x24f565=_0x32f83c;return db[_0x26b6('0x4d')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x26b6('0x4e')],'raw':!![]});})[_0x26b6('0x39')](function(_0x18f2c0){if(!_0x24f565||!_[_0x26b6('0x4f')](_0x24f565[_0x26b6('0x50')],_0x3d2cdc['nonce'])){return _0x5a9156[_0x26b6('0x48')](0x191)[_0x26b6('0x3c')]({'message':_0x26b6('0x51')});}if(_0x24f565[_0x26b6('0x52')]){return _0x5a9156[_0x26b6('0x48')](0x191)[_0x26b6('0x3c')]({'message':_0x26b6('0x53')});}if(_0x24f565[_0x26b6('0x54')]){if(_0x18f2c0[_0x26b6('0x4e')]>0x0){if(moment(_0x24f565['blockedAt'])[_0x26b6('0x55')](_0x18f2c0[_0x26b6('0x4e')],_0x26b6('0x56'))>moment()){return _0x5a9156[_0x26b6('0x48')](0x191)[_0x26b6('0x3c')]({'message':_0x26b6('0x53')});}}else{return _0x5a9156[_0x26b6('0x48')](0x191)[_0x26b6('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4ad998[_0x26b6('0x35')]={'id':_0x24f565['id']};_0x572059();});})['catch'](function(){return _0x5a9156[_0x26b6('0x48')](0x191)[_0x26b6('0x3c')]({'message':_0x26b6('0x53')});});}catch(_0xb454b8){_0x572059(_0xb454b8);}}else if(_0x43ea5b){_0x572059();}else{return _0x5a9156[_0x26b6('0x48')](0x193)[_0x26b6('0x3c')]({'message':_0x26b6('0x57')});}})[_0x26b6('0x34')](function(_0x2beca0,_0x3d0126,_0x36508c){if(_0x2beca0[_0x26b6('0x35')]){db[_0x26b6('0x43')]['find']({'where':{'id':_0x2beca0[_0x26b6('0x35')]['id']},'attributes':userAttributes})[_0x26b6('0x39')](function(_0x11d194){if(!_0x11d194){return _0x3d0126[_0x26b6('0x48')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x2beca0['user']=_0x11d194;_0x36508c();})[_0x26b6('0x3e')](function(_0x237a95){_0x36508c(_0x237a95);});}else if(_0x43ea5b){_0x36508c();}else{return _0x3d0126['status'](0x194)[_0x26b6('0x3c')]({'message':_0x26b6('0x58')});}});};exports[_0x26b6('0x59')]=function canUpdate(){return compose()[_0x26b6('0x34')](function(_0x1e22ed,_0x5b249c,_0xb764cb){return licenseUtil['getLicense']()[_0x26b6('0x39')](function(_0x5ebf49){if(_0x5ebf49['update']){_0xb764cb();}else{return _0x5b249c[_0x26b6('0x48')](0x193)[_0x26b6('0x3c')]({'message':_0x26b6('0x5a')});}})['catch'](function(_0x37b747){_0xb764cb(_0x37b747);});});};exports[_0x26b6('0x5b')]=function isWebrtcLicence(){return compose()[_0x26b6('0x34')](function(_0x46a2ff,_0x5724c3,_0x22d6d5){return licenseUtil[_0x26b6('0x5c')]()['then'](function(_0x309b5e){if(_0x309b5e[_0x26b6('0x5d')]){_0x22d6d5();}else{return _0x5724c3[_0x26b6('0x48')](0x193)['json']({'message':_0x26b6('0x5a')});}})['catch'](function(_0x22753f){_0x22d6d5(_0x22753f);});});};exports[_0x26b6('0x5e')]=function(_0x1ac914,_0x2c3f93,_0x23d471){_0x1ac914[_0x26b6('0x5e')]=!![];return _0x23d471();};exports[_0x26b6('0x5f')]=function signToken(_0xbb2cb3){return signJwt(_0xbb2cb3);};exports[_0x26b6('0x60')]=function(_0x1cf99d,_0xc3850c){if(!_0x1cf99d['user']){return _0xc3850c[_0x26b6('0x48')](0x194)[_0x26b6('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x19c9b9={'payload':{'id':_0x1cf99d[_0x26b6('0x35')]['id'],'role':_0x1cf99d[_0x26b6('0x35')][_0x26b6('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19c9b9)['then'](function(_0x5292f4){_0xc3850c[_0x26b6('0x61')](_0x26b6('0x62'),_0x5292f4);_0xc3850c[_0x26b6('0x63')](_0x26b6('0x64'));})[_0x26b6('0x3e')](function(_0x24d1e1){return _0xc3850c[_0x26b6('0x48')](0x1f4)[_0x26b6('0x65')](_0x24d1e1);});};exports[_0x26b6('0x66')]=function(_0x4803b8){if(_[_0x26b6('0x67')](_0x4803b8['apiKeyNonce'])||_[_0x26b6('0x67')](_0x4803b8['apiKeyIat'])){return null;}else{return createJwt(_0x4803b8);}};exports['generateApiKey']=function(_0x43df3a){_0x43df3a[_0x26b6('0x50')]=generateNonce();_0x43df3a[_0x26b6('0x68')]=generateIssuedAt();return createJwt(_0x43df3a);};exports[_0x26b6('0x69')]=function(_0x3bf7f5,_0x12654e){var _0xbe4670=_0x3bf7f5[_0x26b6('0x49')][_0x26b6('0x4b')];if(_0xbe4670){var _0x2cdee5={'nonce':_0x12654e['apiKeyNonce'],'iat':_0x12654e[_0x26b6('0x68')],'audience':hardwareConf[_0x26b6('0x4a')](),'issuer':hardwareConf[_0x26b6('0x4a')]()};return verifyJwt(_0xbe4670,_0x2cdee5)['then'](function(){return generateApiKey(_0x12654e);});}else{throw{'message':_0x26b6('0x6a')};}};exports[_0x26b6('0x6b')]=function(_0x348f59){var _0x1ec721=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ec721[_0x26b6('0x6c')](_0x348f59))throw new db[(_0x26b6('0x6d'))][(_0x26b6('0x6e'))](_0x26b6('0x6f'));return;};exports[_0x26b6('0x70')]=function(_0x497af2,_0x5e1418,_0x59bd29){var _0x50c83e=encryptor[_0x26b6('0x71')](_0x5e1418)[_0x26b6('0x72')](',');for(var _0x750b9a=0x0;_0x750b9a<_0x59bd29;_0x750b9a++){if(!_0x50c83e[_0x750b9a])break;if(_0x497af2['toLowerCase']()===_0x50c83e[_0x750b9a][_0x26b6('0x73')]()){var _0x37dabc=util[_0x26b6('0x74')](_0x26b6('0x75'),_0x59bd29);if(_0x59bd29===0x1){_0x37dabc=_0x26b6('0x76');}throw new db[(_0x26b6('0x6d'))][(_0x26b6('0x6e'))](_0x37dabc);}}return;};exports['updatePasswordsHistory']=function(_0x47b358,_0x3d4192){var _0x2324ff=_0x3d4192?encryptor[_0x26b6('0x71')](_0x3d4192)[_0x26b6('0x72')](','):[];if(_0x2324ff[_0x26b6('0x77')]===0x5){_0x2324ff[_0x26b6('0x78')](-0x1,0x1);}_0x2324ff[_0x26b6('0x79')](_0x47b358);return encryptor[_0x26b6('0x7a')](_0x2324ff[_0x26b6('0x7b')](','));};function signJwt(_0xffd424){var _0x581662=BPromise[_0x26b6('0x7c')](jwt[_0x26b6('0x7d')],{'context':jwt});var _0x4c58a8=_0xffd424[_0x26b6('0x7e')]||config['secrets'][_0x26b6('0x7f')];return new BPromise(function(_0x16c3d7,_0x4e8ba2){_0x581662(_0xffd424[_0x26b6('0x80')],_0x4c58a8,_0xffd424[_0x26b6('0x81')])[_0x26b6('0x39')](function(_0x1d4ee8){_0x16c3d7(_0x1d4ee8);})[_0x26b6('0x3e')](function(_0x1996b8){_0x4e8ba2(_0x1996b8);});});}function verifyJwt(_0x251b1d,_0x4ada4d,_0x50813f){var _0x418c1a=BPromise[_0x26b6('0x7c')](jwt[_0x26b6('0x82')],{'context':jwt});var _0x15c9a4=_0x50813f||config[_0x26b6('0xc')][_0x26b6('0x7f')];return new BPromise(function(_0x3c6785,_0x39e12e){_0x418c1a(_0x251b1d,_0x15c9a4,_0x4ada4d)[_0x26b6('0x39')](function(_0x15cecf){_0x3c6785(_0x15cecf);})['catch'](function(_0x50a4e8){_0x39e12e(_0x50a4e8);});});}function generateNonce(){return crypto[_0x26b6('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x26b6('0x84')](Date[_0x26b6('0x85')]()/0x3e8)[_0x26b6('0x86')]();}function createJwt(_0x5da3d7){var _0x16d7f9={'payload':{'iat':_0x5da3d7[_0x26b6('0x68')],'nonce':_0x5da3d7[_0x26b6('0x50')]},'options':{'algorithm':_0x26b6('0x87'),'subject':_0x5da3d7['id'][_0x26b6('0x86')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x26b6('0x4a')]()}};return signJwt(_0x16d7f9)[_0x26b6('0x39')](function(_0x5bfba5){return{'iat':_0x5da3d7[_0x26b6('0x68')],'nonce':_0x5da3d7[_0x26b6('0x50')],'token':_0x5bfba5};});} \ No newline at end of file +var _0xc246=['phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','then','query','status','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','User','find','json','Wrong\x20credentials.','startsWith','authorization','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','findOne','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','use','User\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','validatePasswordPattern','test','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','secrets','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer'];(function(_0x3da14f,_0x3013ff){var _0x1fec58=function(_0x4e5a73){while(--_0x4e5a73){_0x3da14f['push'](_0x3da14f['shift']());}};_0x1fec58(++_0x3013ff);}(_0xc246,0x179));var _0x6c24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc246[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x6c24('0x0'))['db'];var config=require(_0x6c24('0x1'));var hardwareConf=require(_0x6c24('0x2'));var licenseUtil=require(_0x6c24('0x3'));var encryptor=require('../encryptor');var _=require(_0x6c24('0x4'));var jwt=require(_0x6c24('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x6c24('0x6'));var basicAuth=require(_0x6c24('0x7'));var crypto=require('crypto');var BPromise=require(_0x6c24('0x8'));var util=require(_0x6c24('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x6c24('0xa')]['session']});var userAttributes=['id',_0x6c24('0xb'),_0x6c24('0xc'),_0x6c24('0xd'),'internal',_0x6c24('0xe'),_0x6c24('0xf'),_0x6c24('0x10'),_0x6c24('0x11'),_0x6c24('0x12'),_0x6c24('0x13'),_0x6c24('0x14'),'faxPause',_0x6c24('0x15'),_0x6c24('0x16'),_0x6c24('0x17'),'showWebBar',_0x6c24('0x18'),_0x6c24('0x19'),_0x6c24('0x1a'),_0x6c24('0x1b'),_0x6c24('0x1c'),_0x6c24('0x1d'),_0x6c24('0x1e'),_0x6c24('0x1f'),_0x6c24('0x20'),'phoneBarEnableRecording',_0x6c24('0x21'),_0x6c24('0x22'),'phoneBarExpires',_0x6c24('0x23'),'phoneBarRemoteControl',_0x6c24('0x24'),_0x6c24('0x25'),_0x6c24('0x26'),_0x6c24('0x27'),'privacyEnabled',_0x6c24('0x28'),_0x6c24('0x29'),_0x6c24('0x2a'),_0x6c24('0x2b'),_0x6c24('0x2c'),_0x6c24('0x2d'),'selectRecallMeCampaign',_0x6c24('0x2e'),'chatAutoanswerDelay',_0x6c24('0x2f'),_0x6c24('0x30'),_0x6c24('0x31'),_0x6c24('0x32'),'openchannelAutoanswer',_0x6c24('0x33'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x6c24('0x34'),_0x6c24('0x35')];exports[_0x6c24('0x36')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x5f524c,_0x5674ed,_0x1f4a8d){if(_0x5f524c[_0x6c24('0x37')]){_0x1f4a8d();}else{return db[_0x6c24('0x38')]['findOne']({'where':{'id':_0x5f524c[_0x6c24('0x39')]['id']},'attributes':['id',_0x6c24('0x3a'),_0x6c24('0x3b')],'raw':!![]})[_0x6c24('0x3c')](function(_0x1c9c9f){if(_0x1c9c9f&&_0x1c9c9f[_0x6c24('0x3a')]&&!_0x5f524c[_0x6c24('0x3d')]['forceDownload']){return _0x5674ed[_0x6c24('0x3e')](_0x1c9c9f[_0x6c24('0x3b')]===_0x6c24('0x3f')?0x195:0x193)['json']({'message':_0x1c9c9f[_0x6c24('0x3b')]===_0x6c24('0x3f')?_0x6c24('0x40'):_0x6c24('0x41')});}else{_0x1f4a8d();}})[_0x6c24('0x42')](function(_0x35b0c2){_0x1f4a8d(_0x35b0c2);});}});};exports[_0x6c24('0x43')]=function isAuthenticated(_0x44c19f){return compose()['use'](function(_0x1d0c9e,_0x25f7e2,_0x3f864a){var _0x928c94;if(_0x1d0c9e[_0x6c24('0x44')]['authorization']){if(_['startsWith'](_0x1d0c9e[_0x6c24('0x44')]['authorization'],'Basic')){var _0x1ffb44=basicAuth(_0x1d0c9e);db[_0x6c24('0x45')][_0x6c24('0x46')]({'where':{'name':_0x1ffb44[_0x6c24('0xd')]}})[_0x6c24('0x3c')](function(_0x3e3dbb){if(!_0x3e3dbb||!_0x3e3dbb['authenticate'](_0x1ffb44['pass'])){return _0x25f7e2['status'](0x191)[_0x6c24('0x47')]({'message':_0x6c24('0x48')});}_0x1d0c9e[_0x6c24('0x37')]={'id':_0x3e3dbb['id']};_0x3f864a();})[_0x6c24('0x42')](function(_0x328d3b){_0x3f864a(_0x328d3b);});}else if(_[_0x6c24('0x49')](_0x1d0c9e[_0x6c24('0x44')][_0x6c24('0x4a')],_0x6c24('0x4b'))){validateJwt(_0x1d0c9e,_0x25f7e2,_0x3f864a);}else{if(_0x44c19f){_0x3f864a();}else{return _0x25f7e2[_0x6c24('0x3e')](0x193)[_0x6c24('0x47')]({'message':_0x6c24('0x4c')});}}}else if(_0x1d0c9e['query'][_0x6c24('0x4d')]){try{var _0x5a6258={'audience':hardwareConf[_0x6c24('0x4e')](),'issuer':hardwareConf[_0x6c24('0x4e')]()};verifyJwt(_0x1d0c9e['query'][_0x6c24('0x4d')],_0x5a6258)['then'](function(_0x3d7c4c){return db[_0x6c24('0x45')][_0x6c24('0x46')]({'where':{'id':_0x3d7c4c[_0x6c24('0x4f')]}})[_0x6c24('0x3c')](function(_0x2e0b2a){_0x928c94=_0x2e0b2a;return db[_0x6c24('0x50')][_0x6c24('0x51')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6c24('0x3c')](function(_0x2dc71c){if(!_0x928c94||!_[_0x6c24('0x52')](_0x928c94[_0x6c24('0x53')],_0x3d7c4c[_0x6c24('0x54')])){return _0x25f7e2['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x928c94[_0x6c24('0x55')]){return _0x25f7e2[_0x6c24('0x3e')](0x191)[_0x6c24('0x47')]({'message':_0x6c24('0x56')});}if(_0x928c94[_0x6c24('0x57')]){if(_0x2dc71c[_0x6c24('0x58')]>0x0){if(moment(_0x928c94[_0x6c24('0x59')])[_0x6c24('0x5a')](_0x2dc71c[_0x6c24('0x58')],_0x6c24('0x5b'))>moment()){return _0x25f7e2['status'](0x191)[_0x6c24('0x47')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x25f7e2[_0x6c24('0x3e')](0x191)[_0x6c24('0x47')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1d0c9e[_0x6c24('0x37')]={'id':_0x928c94['id']};_0x3f864a();});})[_0x6c24('0x42')](function(){return _0x25f7e2[_0x6c24('0x3e')](0x191)[_0x6c24('0x47')]({'message':_0x6c24('0x56')});});}catch(_0x4ea5ff){_0x3f864a(_0x4ea5ff);}}else if(_0x44c19f){_0x3f864a();}else{return _0x25f7e2[_0x6c24('0x3e')](0x193)[_0x6c24('0x47')]({'message':'Unknown\x20authorization\x20format'});}})[_0x6c24('0x5c')](function(_0x54dcff,_0x470bba,_0x44a592){if(_0x54dcff[_0x6c24('0x37')]){db['User'][_0x6c24('0x46')]({'where':{'id':_0x54dcff[_0x6c24('0x37')]['id']},'attributes':userAttributes})[_0x6c24('0x3c')](function(_0x2b7d1a){if(!_0x2b7d1a){return _0x470bba['status'](0x194)[_0x6c24('0x47')]({'message':_0x6c24('0x5d')});}_0x54dcff[_0x6c24('0x37')]=_0x2b7d1a;_0x44a592();})[_0x6c24('0x42')](function(_0x478e2a){_0x44a592(_0x478e2a);});}else if(_0x44c19f){_0x44a592();}else{return _0x470bba[_0x6c24('0x3e')](0x194)[_0x6c24('0x47')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x6c24('0x5e')]=function canUpdate(){return compose()[_0x6c24('0x5c')](function(_0x25edaa,_0x28eb12,_0x52d2f1){return licenseUtil['getLicense']()['then'](function(_0x2910fe){if(_0x2910fe[_0x6c24('0x5f')]){_0x52d2f1();}else{return _0x28eb12[_0x6c24('0x3e')](0x193)[_0x6c24('0x47')]({'message':_0x6c24('0x60')});}})[_0x6c24('0x42')](function(_0x1c38d8){_0x52d2f1(_0x1c38d8);});});};exports[_0x6c24('0x61')]=function isWebrtcLicence(){return compose()[_0x6c24('0x5c')](function(_0x1bc865,_0x41a661,_0x3f7014){return licenseUtil[_0x6c24('0x62')]()[_0x6c24('0x3c')](function(_0x5a3a40){if(_0x5a3a40[_0x6c24('0x63')]){_0x3f7014();}else{return _0x41a661[_0x6c24('0x3e')](0x193)[_0x6c24('0x47')]({'message':'Forbidden'});}})[_0x6c24('0x42')](function(_0x43fdd1){_0x3f7014(_0x43fdd1);});});};exports[_0x6c24('0x64')]=function(_0x366584,_0x319e7c,_0x3a2504){_0x366584['isMiddleware']=!![];return _0x3a2504();};exports[_0x6c24('0x65')]=function signToken(_0xaba16a){return signJwt(_0xaba16a);};exports[_0x6c24('0x66')]=function(_0x158479,_0x1fc897){if(!_0x158479[_0x6c24('0x37')]){return _0x1fc897[_0x6c24('0x3e')](0x194)[_0x6c24('0x47')]({'message':_0x6c24('0x67')});}var _0x4cef44={'payload':{'id':_0x158479[_0x6c24('0x37')]['id'],'role':_0x158479['user'][_0x6c24('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4cef44)['then'](function(_0x30d645){_0x1fc897[_0x6c24('0x68')]('motion.token',_0x30d645);_0x1fc897['redirect'](_0x6c24('0x69'));})[_0x6c24('0x42')](function(_0x387d6f){return _0x1fc897[_0x6c24('0x3e')](0x1f4)['send'](_0x387d6f);});};exports[_0x6c24('0x6a')]=function(_0x58cebe){if(_[_0x6c24('0x6b')](_0x58cebe['apiKeyNonce'])||_[_0x6c24('0x6b')](_0x58cebe['apiKeyIat'])){return null;}else{return createJwt(_0x58cebe);}};exports['generateApiKey']=function(_0xa3c5c4){_0xa3c5c4[_0x6c24('0x53')]=generateNonce();_0xa3c5c4[_0x6c24('0x6c')]=generateIssuedAt();return createJwt(_0xa3c5c4);};exports['regenerateApiKey']=function(_0x51f565,_0x20a03e){var _0x442e3f=_0x51f565['query'][_0x6c24('0x4d')];if(_0x442e3f){var _0x5072e7={'nonce':_0x20a03e['apiKeyNonce'],'iat':_0x20a03e[_0x6c24('0x6c')],'audience':hardwareConf[_0x6c24('0x4e')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x442e3f,_0x5072e7)[_0x6c24('0x3c')](function(){return generateApiKey(_0x20a03e);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x6c24('0x6d')]=function(_0x494a19){var _0x8cb0e3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x8cb0e3[_0x6c24('0x6e')](_0x494a19))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x138772,_0x4a3f32,_0x1f92e5){var _0x1c93e2=encryptor[_0x6c24('0x6f')](_0x4a3f32)[_0x6c24('0x70')](',');for(var _0x56bfe=0x0;_0x56bfe<_0x1f92e5;_0x56bfe++){if(!_0x1c93e2[_0x56bfe])break;if(_0x138772[_0x6c24('0x71')]()===_0x1c93e2[_0x56bfe][_0x6c24('0x71')]()){var _0x33f840=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1f92e5);if(_0x1f92e5===0x1){_0x33f840=_0x6c24('0x72');}throw new db[(_0x6c24('0x73'))][(_0x6c24('0x74'))](_0x33f840);}}return;};exports[_0x6c24('0x75')]=function(_0x12537c,_0x5301f3){var _0x2d500e=_0x5301f3?encryptor[_0x6c24('0x6f')](_0x5301f3)[_0x6c24('0x70')](','):[];if(_0x2d500e[_0x6c24('0x76')]===0x5){_0x2d500e[_0x6c24('0x77')](-0x1,0x1);}_0x2d500e[_0x6c24('0x78')](_0x12537c);return encryptor[_0x6c24('0x79')](_0x2d500e[_0x6c24('0x7a')](','));};function signJwt(_0x54cc3d){var _0x2c70e3=BPromise[_0x6c24('0x7b')](jwt[_0x6c24('0x7c')],{'context':jwt});var _0x8a67c0=_0x54cc3d[_0x6c24('0x7d')]||config['secrets'][_0x6c24('0x7e')];return new BPromise(function(_0x345adc,_0x381889){_0x2c70e3(_0x54cc3d[_0x6c24('0x7f')],_0x8a67c0,_0x54cc3d[_0x6c24('0x80')])[_0x6c24('0x3c')](function(_0x53c2fc){_0x345adc(_0x53c2fc);})[_0x6c24('0x42')](function(_0x2b80a2){_0x381889(_0x2b80a2);});});}function verifyJwt(_0x1cbd2a,_0x3cd1a6,_0x3ad28a){var _0x419a50=BPromise[_0x6c24('0x7b')](jwt[_0x6c24('0x81')],{'context':jwt});var _0x4e69b2=_0x3ad28a||config[_0x6c24('0xa')][_0x6c24('0x7e')];return new BPromise(function(_0xfa722b,_0xfa1471){_0x419a50(_0x1cbd2a,_0x4e69b2,_0x3cd1a6)[_0x6c24('0x3c')](function(_0x24a9ee){_0xfa722b(_0x24a9ee);})[_0x6c24('0x42')](function(_0x5a3b5d){_0xfa1471(_0x5a3b5d);});});}function generateNonce(){return crypto[_0x6c24('0x82')](0x10)[_0x6c24('0x83')](_0x6c24('0x84'));}function generateIssuedAt(){return Math[_0x6c24('0x85')](Date[_0x6c24('0x86')]()/0x3e8)[_0x6c24('0x83')]();}function createJwt(_0x52a06a){var _0x30b52d={'payload':{'iat':_0x52a06a[_0x6c24('0x6c')],'nonce':_0x52a06a[_0x6c24('0x53')]},'options':{'algorithm':_0x6c24('0x87'),'subject':_0x52a06a['id'][_0x6c24('0x83')](),'issuer':hardwareConf[_0x6c24('0x4e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x30b52d)[_0x6c24('0x3c')](function(_0x24c425){return{'iat':_0x52a06a[_0x6c24('0x6c')],'nonce':_0x52a06a[_0x6c24('0x53')],'token':_0x24c425};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 783aa04..d732c07 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 _0xf1a3=['resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','where','fields','filter','user','clause','skip','ids','tag','countFilteredContacts','count','User','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','findOne','slice','all','length','fieldType','map','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery'];(function(_0x4cbde1,_0x5785ec){var _0x37d42=function(_0x318af3){while(--_0x318af3){_0x4cbde1['push'](_0x4cbde1['shift']());}};_0x37d42(++_0x5785ec);}(_0xf1a3,0x10c));var _0x3f1a=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xf1a3[_0x2d982d];return _0x4f36b0;};'use strict';var _=require('lodash');var sqlUtils=require(_0x3f1a('0x0'));var db=require(_0x3f1a('0x1'))['db'];exports[_0x3f1a('0x2')]=function(_0x299974,_0x29ec44,_0x3f9b64,_0x376ef3){var _0xba76e9={'count':0x0,'rows':[]};var _0x24de6c=sqlUtils[_0x3f1a('0x3')](_0x29ec44,_0x299974);if(_0x24de6c){return Promise[_0x3f1a('0x4')](_0xba76e9);}var _0x44376d=sqlUtils[_0x3f1a('0x5')]();var _0x178692={};var _0x1ef872=![];var _0x3a95aa=![];return Promise[_0x3f1a('0x4')]()[_0x3f1a('0x6')](function(){if(_0x299974[_0x3f1a('0x7')]){return sqlUtils[_0x3f1a('0x8')](_0x299974[_0x3f1a('0x7')],_0x376ef3);}else{return sqlUtils['parseQueryParameters'](_0x299974,_0x376ef3);}})[_0x3f1a('0x6')](function(_0x4a835c){_0x44376d[_0x3f1a('0x9')](_0x4a835c['default']);_0x44376d[_0x3f1a('0x9')](_0x4a835c[_0x3f1a('0xa')]);_0x44376d[_0x3f1a('0x9')](_0x4a835c[_0x3f1a('0xb')]);_0x44376d[_0x3f1a('0x9')](_0x4a835c[_0x3f1a('0xc')][_0x3f1a('0xd')]);_0x178692=_0x4a835c['tags'];_0x3a95aa=_0x4a835c[_0x3f1a('0xc')][_0x3f1a('0xe')];return sqlUtils['checkListsRestrictions'](_0x29ec44,_0x299974,_0x3a95aa);})[_0x3f1a('0x6')](function(_0x35e310){_0x44376d['where'](_0x35e310);var _0xf5553f=_0x299974[_0x3f1a('0x7')]?_0x178692[_0x3f1a('0xf')]:_0x299974[_0x3f1a('0x10')];_0x1ef872=_0xf5553f?!![]:![];return sqlUtils[_0x3f1a('0x11')](_0x44376d,_0xf5553f);})[_0x3f1a('0x6')](function(_0x1b2e0e){_0xba76e9[_0x3f1a('0x12')]=_0x1b2e0e;if(_0xba76e9[_0x3f1a('0x12')]===0x0){return;}if(_0x299974[_0x3f1a('0x13')]){_0x3a95aa=!![];}return sqlUtils['buildContactsQuery'](_0x44376d,_0x299974[_0x3f1a('0xa')],_0x3f9b64,_0x1ef872,_0x178692[_0x3f1a('0xd')],_0x3a95aa);})['then'](function(_0x4b6e5a){if(!_0x4b6e5a){return[];}return sqlUtils[_0x3f1a('0x14')](_0x4b6e5a,_0x299974,_0x3f9b64);})['then'](function(_0x27abce){_0xba76e9['rows']=_0x27abce;return _0xba76e9;})[_0x3f1a('0x15')](function(_0x36af81){throw _0x36af81;});};exports[_0x3f1a('0x16')]=function(){var _0x35d541={};var _0x3f0b6f=[];return db[_0x3f1a('0x17')]['describe']()[_0x3f1a('0x6')](function(_0x34a0f1){_0x35d541=_0x34a0f1;var _0x39557f=Object[_0x3f1a('0x18')](_0x35d541)['filter'](function(_0x53c11f){return _[_0x3f1a('0x19')](_0x53c11f,_0x3f1a('0x1a'))?_0x53c11f:undefined;});var _0x27322b=_0x39557f['map'](function(_0x97283a){return db['CmCustomField'][_0x3f1a('0x1b')]({'where':{'id':_0x97283a[_0x3f1a('0x1c')](0x3)},'raw':!![]});});return Promise[_0x3f1a('0x1d')](_0x27322b);})[_0x3f1a('0x6')](function(_0xccd8fa){for(var _0x1d83b2=0x0;_0x1d83b2<_0xccd8fa[_0x3f1a('0x1e')];_0x1d83b2++){if(_0xccd8fa[_0x1d83b2]){var _0x550d1e=_0x3f1a('0x1a')+_0xccd8fa[_0x1d83b2]['id'];_0x35d541[_0x550d1e][_0x3f1a('0x1f')]=_0xccd8fa[_0x1d83b2]['type'];}}_0x3f0b6f=_[_0x3f1a('0x20')](Object[_0x3f1a('0x18')](_0x35d541),function(_0x1b404a){return{'name':_0x1b404a,'type':_0x35d541[_0x1b404a][_0x3f1a('0x21')]};});return _0x3f0b6f;})[_0x3f1a('0x15')](function(_0x1dc9ee){throw _0x1dc9ee;});}; \ No newline at end of file +var _0x4ee5=['findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','rows','describe','CmContact','keys','startsWith','map','CmCustomField','findOne','all','cf_','fieldType','type','lodash','../../mysqldb'];(function(_0x3ffebe,_0x58f9c0){var _0x45e32e=function(_0xe11880){while(--_0xe11880){_0x3ffebe['push'](_0x3ffebe['shift']());}};_0x45e32e(++_0x58f9c0);}(_0x4ee5,0x67));var _0x54ee=function(_0x27f1f7,_0x592c3c){_0x27f1f7=_0x27f1f7-0x0;var _0x5ef94e=_0x4ee5[_0x27f1f7];return _0x5ef94e;};'use strict';var _=require(_0x54ee('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x54ee('0x1'))['db'];exports[_0x54ee('0x2')]=function(_0x52f948,_0x57d108,_0x1fb777,_0x2b0d05){var _0x10a2e5={'count':0x0,'rows':[]};var _0x2524a9=sqlUtils[_0x54ee('0x3')](_0x57d108,_0x52f948);if(_0x2524a9){return Promise[_0x54ee('0x4')](_0x10a2e5);}var _0x22df63=sqlUtils[_0x54ee('0x5')]();var _0x5afd98={};var _0x102bcf=![];var _0x3c2007=![];return Promise[_0x54ee('0x4')]()[_0x54ee('0x6')](function(){if(_0x52f948['search']){return sqlUtils[_0x54ee('0x7')](_0x52f948[_0x54ee('0x8')],_0x2b0d05);}else{return sqlUtils[_0x54ee('0x9')](_0x52f948,_0x2b0d05);}})[_0x54ee('0x6')](function(_0x19b50d){_0x22df63[_0x54ee('0xa')](_0x19b50d[_0x54ee('0xb')]);_0x22df63[_0x54ee('0xa')](_0x19b50d[_0x54ee('0xc')]);_0x22df63[_0x54ee('0xa')](_0x19b50d[_0x54ee('0xd')]);_0x22df63[_0x54ee('0xa')](_0x19b50d[_0x54ee('0xe')]['clause']);_0x5afd98=_0x19b50d[_0x54ee('0xf')];_0x3c2007=_0x19b50d[_0x54ee('0xe')][_0x54ee('0x10')];return sqlUtils[_0x54ee('0x11')](_0x57d108,_0x52f948,_0x3c2007);})[_0x54ee('0x6')](function(_0x3e3a7e){_0x22df63[_0x54ee('0xa')](_0x3e3a7e);var _0x2d0835=_0x52f948[_0x54ee('0x8')]?_0x5afd98[_0x54ee('0x12')]:_0x52f948[_0x54ee('0x13')];_0x102bcf=_0x2d0835?!![]:![];return sqlUtils['countFilteredContacts'](_0x22df63,_0x2d0835);})['then'](function(_0x80c2ef){_0x10a2e5[_0x54ee('0x14')]=_0x80c2ef;if(_0x10a2e5[_0x54ee('0x14')]===0x0){return;}if(_0x52f948[_0x54ee('0x15')]){_0x3c2007=!![];}return sqlUtils[_0x54ee('0x16')](_0x22df63,_0x52f948[_0x54ee('0xc')],_0x1fb777,_0x102bcf,_0x5afd98['clause'],_0x3c2007);})[_0x54ee('0x6')](function(_0xe1d28f){if(!_0xe1d28f){return[];}return sqlUtils['getFilteredContacts'](_0xe1d28f,_0x52f948,_0x1fb777);})['then'](function(_0xa33cd){_0x10a2e5[_0x54ee('0x17')]=_0xa33cd;return _0x10a2e5;})['catch'](function(_0x7a0f82){throw _0x7a0f82;});};exports[_0x54ee('0x18')]=function(){var _0x505532={};var _0x444fb6=[];return db[_0x54ee('0x19')][_0x54ee('0x18')]()[_0x54ee('0x6')](function(_0x25d529){_0x505532=_0x25d529;var _0x50b15c=Object[_0x54ee('0x1a')](_0x505532)[_0x54ee('0xd')](function(_0x2dde70){return _[_0x54ee('0x1b')](_0x2dde70,'cf_')?_0x2dde70:undefined;});var _0x353965=_0x50b15c[_0x54ee('0x1c')](function(_0x4e7962){return db[_0x54ee('0x1d')][_0x54ee('0x1e')]({'where':{'id':_0x4e7962['slice'](0x3)},'raw':!![]});});return Promise[_0x54ee('0x1f')](_0x353965);})[_0x54ee('0x6')](function(_0x300882){for(var _0x35d59c=0x0;_0x35d59c<_0x300882['length'];_0x35d59c++){if(_0x300882[_0x35d59c]){var _0x4273b6=_0x54ee('0x20')+_0x300882[_0x35d59c]['id'];_0x505532[_0x4273b6][_0x54ee('0x21')]=_0x300882[_0x35d59c]['type'];}}_0x444fb6=_[_0x54ee('0x1c')](Object['keys'](_0x505532),function(_0x2418f5){return{'name':_0x2418f5,'type':_0x505532[_0x2418f5][_0x54ee('0x22')]};});return _0x444fb6;})['catch'](function(_0x11c41a){throw _0x11c41a;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d6d590d..b6a8cc2 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 _0x3356=['c.deletedAt\x20IS\x20NULL','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','ListId','CompanyId','createdAt','updatedAt','TagIds','includes','push','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','DATE','buildExpression','type','text','value','start','end','Tag','split','map','tags','clause','and','ids','User','user','skip','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','CmContact','sequelize','toString','Tags','clone','t.id\x20IN\x20?','SELECT','query','COUNT(*)','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','autocomplete','true','select','from','cm_contacts','where'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x3356,0x19c));var _0x6335=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3356[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x6335('0x0'));var qs=require(_0x6335('0x1'));var utils=require('../interaction/utils');var db=require(_0x6335('0x2'))['db'];function skipContactsQuery(_0x3fbd41,_0x52ac38){var _0xb4ca6f=![];if(_0x3fbd41[_0x6335('0x3')]===_0x6335('0x4')&&!_0x52ac38[_0x6335('0x5')]&&!_0x52ac38['ListId']&&_0x52ac38[_0x6335('0x6')]!==_0x6335('0x7')){_0xb4ca6f=!![];}return _0xb4ca6f;}function getContactsSubquery(){return squel[_0x6335('0x8')]()[_0x6335('0x9')](_0x6335('0xa'),'c')[_0x6335('0xb')](_0x6335('0xc'));}function applyJoinClauses(_0x3223b4,_0x3730fd){var _0x85d6d=_0x3730fd?'c':'subqry';_0x3223b4['left_join']('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x85d6d+_0x6335('0xd'))['left_join'](_0x6335('0xe'),'ct',_0x6335('0xf')+_0x85d6d+'.id')[_0x6335('0x10')](_0x6335('0x11'),'t',_0x6335('0x12'));return _0x3223b4;}function addFieldsToQuery(_0x28ab08,_0x2a054d,_0x10b778,_0x3d3e08,_0x55d110){var _0x20440b=_0x55d110?'c':_0x6335('0x13');if(!_0x2a054d){_0x2a054d=['id',_0x6335('0x14'),_0x6335('0x15'),_0x6335('0x16'),_0x6335('0x17'),_0x6335('0x18'),_0x6335('0x19'),_0x6335('0x1a'),_0x6335('0x1b'),_0x6335('0x1c'),_0x6335('0x1d'),'deletedAt',_0x6335('0x1e')];}else if(!_0x2a054d[_0x6335('0x1f')]('id')){_0x2a054d[_0x6335('0x20')]('id');}var _0x2f0f71=_0x10b778&&_0x55d110||!_0x10b778&&!_0x55d110;if(_0x3d3e08){_0x2f0f71=_0x3d3e08&&_0x55d110||!_0x3d3e08&&!_0x55d110;}_0x2a054d['forEach'](function(_0x3d9539){if(_0x3d9539===_0x6335('0x1e')){if(_0x2f0f71){_0x28ab08[_0x6335('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3d9539);}else if(_0x10b778||_0x3d3e08){_0x28ab08[_0x6335('0x21')](_0x20440b+'.'+_0x3d9539);}}else{_0x28ab08[_0x6335('0x21')](_0x20440b+'.'+_0x3d9539);}});return _0x28ab08;}function getSqlClauses(){var _0x20261f={'default':squel[_0x6335('0x22')](),'fields':squel['expr'](),'filter':squel[_0x6335('0x22')](),'tags':{'clause':squel[_0x6335('0x22')](),'ids':null},'user':{'clause':squel[_0x6335('0x22')](),'skip':![]}};return _0x20261f;}function parseTagParameter(_0x51d8aa){var _0x1b4c1c=squel[_0x6335('0x22')]();if(_0x51d8aa){var _0x53bbd6=utils[_0x6335('0x23')](_0x51d8aa);_0x53bbd6[_0x6335('0x24')](function(_0x16eb5f){_0x1b4c1c['or'](_0x6335('0x25'),'%,'+_0x16eb5f+',%');});}return _0x1b4c1c;}function parseSearchFilter(_0x401ef0){var _0x501459=squel[_0x6335('0x22')]();if(_0x401ef0){var _0x2f3545=_0x401ef0[_0x6335('0x26')]('\x5c','\x5c\x5c')[_0x6335('0x26')](/'/g,'\x27\x27');if(_0x2f3545['split']('\x20')[_0x6335('0x27')]>0x1){_0x501459['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6335('0x28')](_0x2f3545,!![]),null);}else{if(qs['isNumeric'](_0x2f3545)){_0x501459['or'](_0x6335('0x29'),_0x2f3545+'%');_0x501459['or'](_0x6335('0x2a'),_0x2f3545+'%');_0x501459['or'](_0x6335('0x2b'),_0x2f3545+'%');_0x501459['or']('c.fax\x20LIKE\x20?',_0x2f3545+'%');}else if(qs[_0x6335('0x2c')](_0x2f3545)){_0x501459['or']('c.email\x20LIKE\x20?',_0x2f3545+'%');}else{_0x501459['or'](_0x6335('0x2d'),'%'+_0x2f3545+'%');_0x501459['or']('c.lastName\x20LIKE\x20?','%'+_0x2f3545+'%');_0x501459['or'](_0x6335('0x2e'),'%'+_0x2f3545+'%');}}}return _0x501459;}function parseAdvancedSearchFilter(_0x4ba680,_0x72c5f8){var _0x172fa9=getSqlClauses();var _0xe423cb=as[_0x6335('0x2f')](_0x4ba680);var _0x29de65=_0xe423cb[_0x6335('0x30')];for(var _0x1a6086=0x0;_0x1a6086<_0xe423cb[_0x6335('0x31')][_0x6335('0x27')];_0x1a6086++){var _0x602818=_0xe423cb[_0x6335('0x31')][_0x1a6086];var _0x58d1ea='c';var _0x25b4d6=_[_0x6335('0x32')](_0x72c5f8,[_0x6335('0x33'),_0x602818['field']]);if(_0x25b4d6){if(_0x602818['field']===_0x6335('0x34')||_0x25b4d6[_0x6335('0x35')]==='datetime'){_0x602818['castTo']=_0x6335('0x36');}var _0x29b5fd=as[_0x6335('0x37')](_0x58d1ea,_0x25b4d6[_0x6335('0x38')],_0x602818);_0x172fa9['default'][_0x29de65](_0x29b5fd[_0x6335('0x39')],_0x29b5fd[_0x6335('0x3a')][_0x6335('0x3b')],_0x29b5fd[_0x6335('0x3a')][_0x6335('0x3c')]);}else{if(_0x602818['field']===_0x6335('0x3d')){var _0x431859=_0x602818[_0x6335('0x3a')][_0x6335('0x3e')](',')[_0x6335('0x3f')](function(_0x2f0669){return Number(_0x2f0669);});var _0x34615b=parseTagParameter(_0x431859);_0x172fa9[_0x6335('0x40')][_0x6335('0x41')][_0x6335('0x42')](_0x34615b);_0x172fa9[_0x6335('0x40')][_0x6335('0x43')]=_0x431859;}else if(_0x602818[_0x6335('0x21')]===_0x6335('0x44')){_0x172fa9[_0x6335('0x45')][_0x6335('0x41')][_0x6335('0x42')]('uc.UserId\x20=\x20?',_0x602818[_0x6335('0x3a')]);_0x172fa9[_0x6335('0x45')][_0x6335('0x46')]=!![];}}}return _0x172fa9;}function parseModelFields(_0xb05229,_0x5b4783){var _0x39822d=squel[_0x6335('0x22')]();var _0x5f4372=_(_0xb05229)['keys']()[_0x6335('0x3f')](function(_0x30d5cd){return _['some'](_0x5b4783,[_0x6335('0x33'),_0x30d5cd])?_0x30d5cd:undefined;})['compact']()[_0x6335('0x3a')]();if(_0xb05229[_0x6335('0x47')]){_0x5f4372[_0x6335('0x20')]('Contact');}if(_0xb05229['User']){_0x5f4372[_0x6335('0x20')]('User');}if(_0x5f4372[_0x6335('0x27')]>0x0){_0x5f4372[_0x6335('0x24')](function(_0x1a09ed){if(_0x1a09ed==='ListId'){_0x39822d[_0x6335('0x42')](_0x6335('0x48'),[][_0x6335('0x49')](_0xb05229[_0x1a09ed]));}else if(_0x1a09ed==='Contact'){var _0xb0448f='%'+_0xb05229[_0x1a09ed]+'%';_0x39822d[_0x6335('0x42')](_0x6335('0x4a'),_0xb0448f);}else if(_0x1a09ed===_0x6335('0x44')){_0x39822d['and'](_0x6335('0x4b'),_0xb05229[_0x1a09ed]);}else{_0x39822d[_0x6335('0x42')]('c.'+_0x1a09ed+_0x6335('0x4c'),_0xb05229[_0x1a09ed]);}});}return _0x39822d;}function parseQueryParameters(_0x44a3de,_0x1861ac){var _0x42bc01=getSqlClauses();return Promise[_0x6335('0x4d')]()['then'](function(){return parseModelFields(_0x44a3de,_0x1861ac);})[_0x6335('0x4e')](function(_0x4908b1){_0x42bc01[_0x6335('0x4f')][_0x6335('0x42')](_0x4908b1);return parseTagParameter(_0x44a3de[_0x6335('0x50')]);})[_0x6335('0x4e')](function(_0x56c8da){_0x42bc01[_0x6335('0x40')][_0x6335('0x41')][_0x6335('0x42')](_0x56c8da);return parseSearchFilter(_0x44a3de[_0x6335('0x51')]);})[_0x6335('0x4e')](function(_0x177398){_0x42bc01[_0x6335('0x51')]=_0x177398;return _0x42bc01;});}function checkListsRestrictions(_0x3a6e1a,_0x56d513,_0x30bd8e){var _0x55d7a8=squel[_0x6335('0x22')]();return Promise[_0x6335('0x4d')]()[_0x6335('0x4e')](function(){if(_0x56d513['search']&&_0x3a6e1a[_0x6335('0x3')]===_0x6335('0x4')&&!_0x30bd8e){return _0x3a6e1a[_0x6335('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4d83a2){if(_0x4d83a2){if(_0x4d83a2['length']===0x0){_0x55d7a8[_0x6335('0x42')](_0x6335('0x53'));}else{_0x55d7a8[_0x6335('0x42')](_0x6335('0x48'),_[_0x6335('0x3f')](_0x4d83a2,'id'));}}})[_0x6335('0x4e')](function(){return _0x55d7a8;});}function buildContactsQuery(_0x284da5,_0x43a4de,_0x124032,_0x3cea72,_0x5acad3,_0x5ba4ab){if(_0x43a4de){_0x43a4de=_0x124032['attributes'];}_0x284da5=addFieldsToQuery(_0x284da5,_0x43a4de,_0x3cea72,_0x5ba4ab,!![]);var _0x3bb0b1=squel[_0x6335('0x8')]();_0x3bb0b1=addFieldsToQuery(_0x3bb0b1,_0x43a4de,_0x3cea72,_0x5ba4ab,![]);if(_0x3cea72||_0x5ba4ab){_0x284da5=applyJoinClauses(_0x284da5,!![]);_0x284da5['group'](_0x6335('0x54'));if(_0x124032[_0x6335('0x55')]){_0x3bb0b1['limit'](_0x124032[_0x6335('0x55')]);}if(_0x124032[_0x6335('0x56')]){_0x3bb0b1['offset'](_0x124032['offset']);}}else{_0x3bb0b1=applyJoinClauses(_0x3bb0b1,![]);_0x3bb0b1[_0x6335('0x57')](_0x6335('0x58'));if(_0x124032[_0x6335('0x55')]){_0x284da5[_0x6335('0x55')](_0x124032[_0x6335('0x55')]);}if(_0x124032[_0x6335('0x56')]){_0x284da5[_0x6335('0x56')](_0x124032['offset']);}}_0x3bb0b1[_0x6335('0x59')](_0x5acad3);if(_0x124032['order']){_0x124032[_0x6335('0x5a')]['forEach'](function(_0x245d71){_0x284da5[_0x6335('0x5a')]('c.'+_0x245d71[0x0],_0x245d71[0x1]===_0x6335('0x5b')?![]:!![]);_0x3bb0b1[_0x6335('0x5a')](_0x6335('0x5c')+_0x245d71[0x0],_0x245d71[0x1]===_0x6335('0x5b')?![]:!![]);});}_0x3bb0b1['from'](_0x284da5,_0x6335('0x13'));return _0x3bb0b1;}function getFilteredContacts(_0x1e0ca3){var _0x2ee7f9=[];return db['Tag'][_0x6335('0x5d')]({'attributes':['id',_0x6335('0x33'),'color'],'raw':!![]})[_0x6335('0x4e')](function(_0x5e53f9){_0x2ee7f9=_[_0x6335('0x5e')](_0x5e53f9,'id');var _0x48a194={'type':db[_0x6335('0x5f')][_0x6335('0x60')]['SELECT'],'model':db[_0x6335('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6335('0x62')]['query'](_0x1e0ca3[_0x6335('0x63')](),_0x48a194);})[_0x6335('0x4e')](function(_0x498395){_0x498395[_0x6335('0x24')](function(_0x1d3a00){if(_0x1d3a00['TagIds']){_0x1d3a00[_0x6335('0x64')]=[];_0x1d3a00[_0x6335('0x1e')][_0x6335('0x3e')](',')[_0x6335('0x24')](function(_0x89b2cf){_0x1d3a00[_0x6335('0x64')][_0x6335('0x20')](_0x2ee7f9[_0x89b2cf]);});}delete _0x1d3a00[_0x6335('0x1e')];});return _0x498395;});}function countFilteredContacts(_0x4958c8,_0xc0bb87){var _0x5c1c79=_0x4958c8[_0x6335('0x65')]();_0x5c1c79['field']('COUNT(*)');_0x5c1c79=applyJoinClauses(_0x5c1c79,!![]);_0x4958c8[_0x6335('0x57')](_0x6335('0x54'));var _0x5c725e=utils[_0x6335('0x23')](_0xc0bb87);if(!_['isEmpty'](_0x5c725e)){_0x5c1c79[_0x6335('0xb')](_0x6335('0x66'),_0x5c725e);}var _0x190435={'type':db[_0x6335('0x5f')][_0x6335('0x60')][_0x6335('0x67')],'raw':!![]};return db[_0x6335('0x62')][_0x6335('0x68')](_0x5c1c79['toString'](),_0x190435)[_0x6335('0x4e')](function(_0x2b4779){return _0x2b4779[0x0][_0x6335('0x69')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xc219=['DESC','subqry.','keyBy','QueryTypes','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','Sequelize','lodash','squel','../parsers/advancedSearch','../../mysqldb','agent','ListId','autocomplete','true','select','from','cm_contacts','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','TagIds','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','value','start','end','Tag','map','tags','clause','and','ids','user','skip','some','name','compact','Contact','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order'];(function(_0x4169d1,_0x30a16a){var _0x3ea5f6=function(_0x1d0b03){while(--_0x1d0b03){_0x4169d1['push'](_0x4169d1['shift']());}};_0x3ea5f6(++_0x30a16a);}(_0xc219,0x1c3));var _0x9c21=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xc219[_0x2bcb75];return _0x175345;};'use strict';var _=require(_0x9c21('0x0'));var squel=require(_0x9c21('0x1'));var as=require(_0x9c21('0x2'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x9c21('0x3'))['db'];function skipContactsQuery(_0x40336b,_0x2f9276){var _0x5dddaa=![];if(_0x40336b['role']===_0x9c21('0x4')&&!_0x2f9276['search']&&!_0x2f9276[_0x9c21('0x5')]&&_0x2f9276[_0x9c21('0x6')]!==_0x9c21('0x7')){_0x5dddaa=!![];}return _0x5dddaa;}function getContactsSubquery(){return squel[_0x9c21('0x8')]()[_0x9c21('0x9')](_0x9c21('0xa'),'c')[_0x9c21('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4c0495,_0x477740){var _0x4348f5=_0x477740?'c':_0x9c21('0xc');_0x4c0495['left_join'](_0x9c21('0xd'),'uc',_0x9c21('0xe')+_0x4348f5+_0x9c21('0xf'))[_0x9c21('0x10')](_0x9c21('0x11'),'ct',_0x9c21('0x12')+_0x4348f5+_0x9c21('0xf'))[_0x9c21('0x10')](_0x9c21('0x13'),'t',_0x9c21('0x14'));return _0x4c0495;}function addFieldsToQuery(_0xa4d464,_0x122323,_0x42dcab,_0x802d78,_0x18cf8c){var _0x342341=_0x18cf8c?'c':_0x9c21('0xc');if(!_0x122323){_0x122323=['id',_0x9c21('0x15'),_0x9c21('0x16'),_0x9c21('0x17'),'mobile',_0x9c21('0x18'),_0x9c21('0x19'),_0x9c21('0x5'),_0x9c21('0x1a'),_0x9c21('0x1b'),_0x9c21('0x1c'),_0x9c21('0x1d'),'TagIds'];}else if(!_0x122323[_0x9c21('0x1e')]('id')){_0x122323[_0x9c21('0x1f')]('id');}var _0x544d18=_0x42dcab&&_0x18cf8c||!_0x42dcab&&!_0x18cf8c;if(_0x802d78){_0x544d18=_0x802d78&&_0x18cf8c||!_0x802d78&&!_0x18cf8c;}_0x122323['forEach'](function(_0x7c5d7a){if(_0x7c5d7a===_0x9c21('0x20')){if(_0x544d18){_0xa4d464[_0x9c21('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7c5d7a);}else if(_0x42dcab||_0x802d78){_0xa4d464[_0x9c21('0x21')](_0x342341+'.'+_0x7c5d7a);}}else{_0xa4d464[_0x9c21('0x21')](_0x342341+'.'+_0x7c5d7a);}});return _0xa4d464;}function getSqlClauses(){var _0x21db5b={'default':squel['expr'](),'fields':squel[_0x9c21('0x22')](),'filter':squel[_0x9c21('0x22')](),'tags':{'clause':squel[_0x9c21('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x21db5b;}function parseTagParameter(_0x3f2cce){var _0x52b3a3=squel['expr']();if(_0x3f2cce){var _0x4d6f82=utils[_0x9c21('0x23')](_0x3f2cce);_0x4d6f82[_0x9c21('0x24')](function(_0x4b1521){_0x52b3a3['or'](_0x9c21('0x25'),'%,'+_0x4b1521+',%');});}return _0x52b3a3;}function parseSearchFilter(_0x32a810){var _0x493434=squel[_0x9c21('0x22')]();if(_0x32a810){var _0x4194fc=_0x32a810[_0x9c21('0x26')]('\x5c','\x5c\x5c')[_0x9c21('0x26')](/'/g,'\x27\x27');if(_0x4194fc[_0x9c21('0x27')]('\x20')[_0x9c21('0x28')]>0x1){_0x493434['or'](_0x9c21('0x29'),qs[_0x9c21('0x2a')](_0x4194fc,!![]),null);}else{if(qs['isNumeric'](_0x4194fc)){_0x493434['or'](_0x9c21('0x2b'),_0x4194fc+'%');_0x493434['or']('c.phone\x20LIKE\x20?',_0x4194fc+'%');_0x493434['or'](_0x9c21('0x2c'),_0x4194fc+'%');_0x493434['or'](_0x9c21('0x2d'),_0x4194fc+'%');}else if(qs[_0x9c21('0x2e')](_0x4194fc)){_0x493434['or'](_0x9c21('0x2f'),_0x4194fc+'%');}else{_0x493434['or'](_0x9c21('0x30'),'%'+_0x4194fc+'%');_0x493434['or'](_0x9c21('0x31'),'%'+_0x4194fc+'%');_0x493434['or'](_0x9c21('0x2f'),'%'+_0x4194fc+'%');}}}return _0x493434;}function parseAdvancedSearchFilter(_0x97267d,_0x44c199){var _0x58cef9=getSqlClauses();var _0x12f05b=as['parseSearch'](_0x97267d);var _0x45f634=_0x12f05b[_0x9c21('0x32')];for(var _0x1f525b=0x0;_0x1f525b<_0x12f05b['conditions'][_0x9c21('0x28')];_0x1f525b++){var _0x36ffab=_0x12f05b[_0x9c21('0x33')][_0x1f525b];var _0x5d0cbb='c';var _0x549aea=_[_0x9c21('0x34')](_0x44c199,['name',_0x36ffab[_0x9c21('0x21')]]);if(_0x549aea){if(_0x36ffab[_0x9c21('0x21')]===_0x9c21('0x35')||_0x549aea[_0x9c21('0x36')]===_0x9c21('0x37')){_0x36ffab[_0x9c21('0x38')]=_0x9c21('0x39');}var _0x5ba50b=as[_0x9c21('0x3a')](_0x5d0cbb,_0x549aea[_0x9c21('0x3b')],_0x36ffab);_0x58cef9['default'][_0x45f634](_0x5ba50b['text'],_0x5ba50b[_0x9c21('0x3c')][_0x9c21('0x3d')],_0x5ba50b[_0x9c21('0x3c')][_0x9c21('0x3e')]);}else{if(_0x36ffab[_0x9c21('0x21')]===_0x9c21('0x3f')){var _0x2eb096=_0x36ffab[_0x9c21('0x3c')][_0x9c21('0x27')](',')[_0x9c21('0x40')](function(_0x13bd02){return Number(_0x13bd02);});var _0xde7298=parseTagParameter(_0x2eb096);_0x58cef9[_0x9c21('0x41')][_0x9c21('0x42')][_0x9c21('0x43')](_0xde7298);_0x58cef9[_0x9c21('0x41')][_0x9c21('0x44')]=_0x2eb096;}else if(_0x36ffab[_0x9c21('0x21')]==='User'){_0x58cef9[_0x9c21('0x45')][_0x9c21('0x42')][_0x9c21('0x43')]('uc.UserId\x20=\x20?',_0x36ffab[_0x9c21('0x3c')]);_0x58cef9[_0x9c21('0x45')][_0x9c21('0x46')]=!![];}}}return _0x58cef9;}function parseModelFields(_0x341784,_0x5de8b7){var _0x552d5f=squel[_0x9c21('0x22')]();var _0x5702c9=_(_0x341784)['keys']()['map'](function(_0x58caa0){return _[_0x9c21('0x47')](_0x5de8b7,[_0x9c21('0x48'),_0x58caa0])?_0x58caa0:undefined;})[_0x9c21('0x49')]()['value']();if(_0x341784[_0x9c21('0x4a')]){_0x5702c9[_0x9c21('0x1f')](_0x9c21('0x4a'));}if(_0x341784[_0x9c21('0x4b')]){_0x5702c9['push'](_0x9c21('0x4b'));}if(_0x5702c9[_0x9c21('0x28')]>0x0){_0x5702c9['forEach'](function(_0x15a508){if(_0x15a508===_0x9c21('0x5')){_0x552d5f[_0x9c21('0x43')](_0x9c21('0x4c'),[][_0x9c21('0x4d')](_0x341784[_0x15a508]));}else if(_0x15a508===_0x9c21('0x4a')){var _0x331d43='%'+_0x341784[_0x15a508]+'%';_0x552d5f[_0x9c21('0x43')](_0x9c21('0x4e'),_0x331d43);}else if(_0x15a508===_0x9c21('0x4b')){_0x552d5f[_0x9c21('0x43')](_0x9c21('0x4f'),_0x341784[_0x15a508]);}else{_0x552d5f['and']('c.'+_0x15a508+'\x20=\x20?',_0x341784[_0x15a508]);}});}return _0x552d5f;}function parseQueryParameters(_0x468436,_0x4f72a1){var _0x3bd0d3=getSqlClauses();return Promise[_0x9c21('0x50')]()[_0x9c21('0x51')](function(){return parseModelFields(_0x468436,_0x4f72a1);})[_0x9c21('0x51')](function(_0x316a2b){_0x3bd0d3[_0x9c21('0x52')][_0x9c21('0x43')](_0x316a2b);return parseTagParameter(_0x468436['tag']);})[_0x9c21('0x51')](function(_0x1cf44f){_0x3bd0d3[_0x9c21('0x41')][_0x9c21('0x42')]['and'](_0x1cf44f);return parseSearchFilter(_0x468436[_0x9c21('0x53')]);})[_0x9c21('0x51')](function(_0x18ad92){_0x3bd0d3['filter']=_0x18ad92;return _0x3bd0d3;});}function checkListsRestrictions(_0x5d40fc,_0x8d28a5,_0x2274b1){var _0x31af6c=squel[_0x9c21('0x22')]();return Promise[_0x9c21('0x50')]()[_0x9c21('0x51')](function(){if(_0x8d28a5[_0x9c21('0x54')]&&_0x5d40fc['role']===_0x9c21('0x4')&&!_0x2274b1){return _0x5d40fc[_0x9c21('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x9c21('0x51')](function(_0x4c11fa){if(_0x4c11fa){if(_0x4c11fa['length']===0x0){_0x31af6c['and'](_0x9c21('0x56'));}else{_0x31af6c[_0x9c21('0x43')]('c.ListId\x20IN\x20?',_[_0x9c21('0x40')](_0x4c11fa,'id'));}}})[_0x9c21('0x51')](function(){return _0x31af6c;});}function buildContactsQuery(_0x398bbe,_0x5db415,_0x15638d,_0x4c23af,_0x32c13f,_0x4b9b50){if(_0x5db415){_0x5db415=_0x15638d[_0x9c21('0x57')];}_0x398bbe=addFieldsToQuery(_0x398bbe,_0x5db415,_0x4c23af,_0x4b9b50,!![]);var _0x5c5989=squel[_0x9c21('0x8')]();_0x5c5989=addFieldsToQuery(_0x5c5989,_0x5db415,_0x4c23af,_0x4b9b50,![]);if(_0x4c23af||_0x4b9b50){_0x398bbe=applyJoinClauses(_0x398bbe,!![]);_0x398bbe[_0x9c21('0x58')]('c.id');if(_0x15638d[_0x9c21('0x59')]){_0x5c5989[_0x9c21('0x59')](_0x15638d[_0x9c21('0x59')]);}if(_0x15638d[_0x9c21('0x5a')]){_0x5c5989[_0x9c21('0x5a')](_0x15638d[_0x9c21('0x5a')]);}}else{_0x5c5989=applyJoinClauses(_0x5c5989,![]);_0x5c5989[_0x9c21('0x58')](_0x9c21('0x5b'));if(_0x15638d['limit']){_0x398bbe[_0x9c21('0x59')](_0x15638d[_0x9c21('0x59')]);}if(_0x15638d[_0x9c21('0x5a')]){_0x398bbe[_0x9c21('0x5a')](_0x15638d['offset']);}}_0x5c5989[_0x9c21('0x5c')](_0x32c13f);if(_0x15638d[_0x9c21('0x5d')]){_0x15638d[_0x9c21('0x5d')][_0x9c21('0x24')](function(_0x5e03e5){_0x398bbe[_0x9c21('0x5d')]('c.'+_0x5e03e5[0x0],_0x5e03e5[0x1]===_0x9c21('0x5e')?![]:!![]);_0x5c5989['order'](_0x9c21('0x5f')+_0x5e03e5[0x0],_0x5e03e5[0x1]===_0x9c21('0x5e')?![]:!![]);});}_0x5c5989['from'](_0x398bbe,_0x9c21('0xc'));return _0x5c5989;}function getFilteredContacts(_0x44b965){var _0x2cd963=[];return db[_0x9c21('0x3f')]['findAll']({'attributes':['id',_0x9c21('0x48'),'color'],'raw':!![]})[_0x9c21('0x51')](function(_0x1b2cd1){_0x2cd963=_[_0x9c21('0x60')](_0x1b2cd1,'id');var _0x5345be={'type':db['Sequelize'][_0x9c21('0x61')][_0x9c21('0x62')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9c21('0x63')][_0x9c21('0x64')](_0x44b965[_0x9c21('0x65')](),_0x5345be);})['then'](function(_0xacc74d){_0xacc74d[_0x9c21('0x24')](function(_0x57dd0f){if(_0x57dd0f[_0x9c21('0x20')]){_0x57dd0f[_0x9c21('0x66')]=[];_0x57dd0f[_0x9c21('0x20')]['split'](',')[_0x9c21('0x24')](function(_0x368e0c){_0x57dd0f[_0x9c21('0x66')][_0x9c21('0x1f')](_0x2cd963[_0x368e0c]);});}delete _0x57dd0f[_0x9c21('0x20')];});return _0xacc74d;});}function countFilteredContacts(_0x29a809,_0xc9bdc5){var _0x3dfc75=_0x29a809[_0x9c21('0x67')]();_0x3dfc75[_0x9c21('0x21')](_0x9c21('0x68'));_0x3dfc75=applyJoinClauses(_0x3dfc75,!![]);_0x29a809[_0x9c21('0x58')](_0x9c21('0x69'));var _0x398176=utils[_0x9c21('0x23')](_0xc9bdc5);if(!_[_0x9c21('0x6a')](_0x398176)){_0x3dfc75[_0x9c21('0xb')](_0x9c21('0x6b'),_0x398176);}var _0x1c98c4={'type':db[_0x9c21('0x6c')][_0x9c21('0x61')][_0x9c21('0x62')],'raw':!![]};return db[_0x9c21('0x63')][_0x9c21('0x64')](_0x3dfc75[_0x9c21('0x65')](),_0x1c98c4)[_0x9c21('0x51')](function(_0x4f5350){return _0x4f5350[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9d636b6..7c2b337 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 _0x8d5f=['data','update','write','end','binary','close','decryptFile','createWriteStream','createDecipher','unlink','secret','base64','final','utf8','crypto','bluebird','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x8d5f,0x184));var _0xf8d5=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x8d5f[_0x453e2b];return _0x50f306;};'use strict';var crypto=require(_0xf8d5('0x0'));var fs=require('fs');var BPromise=require(_0xf8d5('0x1'));var _=require('lodash');var config=require(_0xf8d5('0x2'));var logger=require(_0xf8d5('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf8d5('0x4')][_0xf8d5('0x5')],'algorithm':_0xf8d5('0x6')};const fileOptions={'algorithm':_0xf8d5('0x7')};if(config[_0xf8d5('0x8')]&&config[_0xf8d5('0x8')][_0xf8d5('0x9')]){var isSupported=isAlgorithmSupported(config[_0xf8d5('0x8')]['algorithm']);if(isSupported){fileOptions[_0xf8d5('0x9')]=config[_0xf8d5('0x8')][_0xf8d5('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf8d5('0xa')](',\x20');logger[_0xf8d5('0xb')](config[_0xf8d5('0x8')][_0xf8d5('0x9')],_0xf8d5('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x275055){return AES_SUPPORTED_RX[_0xf8d5('0xd')](_0x275055);}function getSupportedCiphers(){return crypto[_0xf8d5('0xe')]()[_0xf8d5('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x1dbcba){return getSupportedCiphers()[_0xf8d5('0x10')](_0x1dbcba)>-0x1;}function combineOptions(_0x1a000f){var _0x581a72={};for(var _0x151fa7 in fileOptions){if(fileOptions[_0xf8d5('0x11')](_0x151fa7)){_0x581a72[_0x151fa7]=fileOptions[_0x151fa7];}}if(_0x1a000f){for(var _0x17473a in _0x1a000f){if(_0x1a000f[_0xf8d5('0x11')](_0x17473a)){_0x581a72[_0x17473a]=_0x1a000f[_0x17473a];}}}return _0x581a72;}exports[_0xf8d5('0x12')]=function(_0x5b9d7f,_0x4339fd,_0x42f747,_0x4ce91c){return new BPromise(function(_0x502199,_0x559f1f){_0x4ce91c=combineOptions(_0x4ce91c);var _0x5072da=new Buffer(_0x42f747);var _0x77873=fs['createReadStream'](_0x5b9d7f);var _0x102504=fs['createWriteStream'](_0x4339fd);var _0x40cd99=crypto[_0xf8d5('0x13')](_0x4ce91c[_0xf8d5('0x9')],_0x5072da);_0x77873['on'](_0xf8d5('0x14'),function(_0x5c5b46){var _0x9d4277=new Buffer(_0x40cd99[_0xf8d5('0x15')](_0x5c5b46),'binary');_0x102504[_0xf8d5('0x16')](_0x9d4277);});_0x77873['on'](_0xf8d5('0x17'),function(){try{var _0x1c4217=new Buffer(_0x40cd99['final'](_0xf8d5('0x18')),_0xf8d5('0x18'));_0x102504[_0xf8d5('0x16')](_0x1c4217);_0x102504[_0xf8d5('0x17')]();_0x102504['on'](_0xf8d5('0x19'),function(){return _0x502199(_0x4339fd);});}catch(_0x35ac40){fs['unlink'](_0x4339fd);return _0x559f1f(_0x35ac40);}});});};exports[_0xf8d5('0x1a')]=function(_0x5d57dd,_0x583423,_0x34660a,_0x2abfef){return new BPromise(function(_0x42e483,_0xb97478){_0x2abfef=combineOptions(_0x2abfef);var _0x5bff89=new Buffer(_0x34660a);var _0x56505a=fs['createReadStream'](_0x5d57dd);var _0x132bf3=fs[_0xf8d5('0x1b')](_0x583423);var _0x2691d7=crypto[_0xf8d5('0x1c')](_0x2abfef['algorithm'],_0x5bff89);_0x56505a['on'](_0xf8d5('0x14'),function(_0x4734e9){var _0x29b793=new Buffer(_0x2691d7['update'](_0x4734e9),'binary');_0x132bf3[_0xf8d5('0x16')](_0x29b793);});_0x56505a['on'](_0xf8d5('0x17'),function(){try{var _0x3cd16a=new Buffer(_0x2691d7['final']('binary'),_0xf8d5('0x18'));_0x132bf3[_0xf8d5('0x16')](_0x3cd16a);_0x132bf3[_0xf8d5('0x17')]();_0x132bf3['on'](_0xf8d5('0x19'),function(){return _0x42e483(_0x583423);});}catch(_0x534fb6){fs[_0xf8d5('0x1d')](_0x583423);return _0xb97478(_0x534fb6);}});});};exports['encryptString']=function(_0x3975b7,_0x378d7e,_0x12ee68){var _0x15cd6f=_0x12ee68||stringOptions['algorithm'];var _0x333efe=_0x378d7e||stringOptions[_0xf8d5('0x1e')];var _0x15fec0=crypto[_0xf8d5('0x13')](_0x15cd6f,_0x333efe);var _0x228290=_0x15fec0[_0xf8d5('0x15')](_0x3975b7,'utf8',_0xf8d5('0x1f'));_0x228290+=_0x15fec0[_0xf8d5('0x20')](_0xf8d5('0x1f'));return _0x228290;};exports['decryptString']=function(_0x2d2102,_0x581718,_0x4f8e70){var _0x5d990a=_0x4f8e70||stringOptions['algorithm'];var _0x2cde81=_0x581718||stringOptions[_0xf8d5('0x1e')];var _0x36d0a9=crypto[_0xf8d5('0x1c')](_0x5d990a,_0x2cde81);var _0x960f50=_0x36d0a9['update'](_0x2d2102,_0xf8d5('0x1f'),_0xf8d5('0x21'));_0x960f50+=_0x36d0a9[_0xf8d5('0x20')](_0xf8d5('0x21'));return _0x960f50;}; \ No newline at end of file +var _0x84cf=['lodash','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','end','final','write','close','unlink','createReadStream','data','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x84cf,0x1cd));var _0xf84c=function(_0x312e90,_0x47626f){_0x312e90=_0x312e90-0x0;var _0x21790b=_0x84cf[_0x312e90];return _0x21790b;};'use strict';var crypto=require(_0xf84c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xf84c('0x1'));var config=require('../../config/environment');var logger=require(_0xf84c('0x2'))(_0xf84c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf84c('0x4')]['session'],'algorithm':_0xf84c('0x5')};const fileOptions={'algorithm':_0xf84c('0x6')};if(config[_0xf84c('0x7')]&&config[_0xf84c('0x7')][_0xf84c('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xf84c('0x8')]);if(isSupported){fileOptions[_0xf84c('0x8')]=config[_0xf84c('0x7')][_0xf84c('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf84c('0x9')](',\x20');logger['error'](config[_0xf84c('0x7')]['algorithm'],_0xf84c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2afbb7){return AES_SUPPORTED_RX[_0xf84c('0xb')](_0x2afbb7);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xf84c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x1d9941){return getSupportedCiphers()[_0xf84c('0xd')](_0x1d9941)>-0x1;}function combineOptions(_0x315699){var _0x33bc52={};for(var _0x4fc0ee in fileOptions){if(fileOptions[_0xf84c('0xe')](_0x4fc0ee)){_0x33bc52[_0x4fc0ee]=fileOptions[_0x4fc0ee];}}if(_0x315699){for(var _0x45bf90 in _0x315699){if(_0x315699[_0xf84c('0xe')](_0x45bf90)){_0x33bc52[_0x45bf90]=_0x315699[_0x45bf90];}}}return _0x33bc52;}exports[_0xf84c('0xf')]=function(_0x37c396,_0x18004a,_0x13883c,_0x2a81c3){return new BPromise(function(_0x4991da,_0x1d0625){_0x2a81c3=combineOptions(_0x2a81c3);var _0x166f4a=new Buffer(_0x13883c);var _0x5687b8=fs['createReadStream'](_0x37c396);var _0xff94dc=fs[_0xf84c('0x10')](_0x18004a);var _0x4c179d=crypto[_0xf84c('0x11')](_0x2a81c3[_0xf84c('0x8')],_0x166f4a);_0x5687b8['on']('data',function(_0x42b779){var _0x5e5515=new Buffer(_0x4c179d[_0xf84c('0x12')](_0x42b779),_0xf84c('0x13'));_0xff94dc['write'](_0x5e5515);});_0x5687b8['on'](_0xf84c('0x14'),function(){try{var _0x4c1e7c=new Buffer(_0x4c179d[_0xf84c('0x15')](_0xf84c('0x13')),_0xf84c('0x13'));_0xff94dc[_0xf84c('0x16')](_0x4c1e7c);_0xff94dc['end']();_0xff94dc['on'](_0xf84c('0x17'),function(){return _0x4991da(_0x18004a);});}catch(_0x5a661d){fs[_0xf84c('0x18')](_0x18004a);return _0x1d0625(_0x5a661d);}});});};exports['decryptFile']=function(_0x2a4236,_0x30a3d7,_0x5d39a2,_0x5c8279){return new BPromise(function(_0x52982c,_0x4aff99){_0x5c8279=combineOptions(_0x5c8279);var _0x3f937a=new Buffer(_0x5d39a2);var _0x4b2afe=fs[_0xf84c('0x19')](_0x2a4236);var _0x3721a2=fs[_0xf84c('0x10')](_0x30a3d7);var _0x517eb1=crypto['createDecipher'](_0x5c8279['algorithm'],_0x3f937a);_0x4b2afe['on'](_0xf84c('0x1a'),function(_0x348f04){var _0x1177d3=new Buffer(_0x517eb1[_0xf84c('0x12')](_0x348f04),_0xf84c('0x13'));_0x3721a2[_0xf84c('0x16')](_0x1177d3);});_0x4b2afe['on'](_0xf84c('0x14'),function(){try{var _0x43a60b=new Buffer(_0x517eb1[_0xf84c('0x15')]('binary'),_0xf84c('0x13'));_0x3721a2[_0xf84c('0x16')](_0x43a60b);_0x3721a2['end']();_0x3721a2['on']('close',function(){return _0x52982c(_0x30a3d7);});}catch(_0x48ee59){fs[_0xf84c('0x18')](_0x30a3d7);return _0x4aff99(_0x48ee59);}});});};exports[_0xf84c('0x1b')]=function(_0xfcc99d,_0x3d5c2f,_0x3b67ac){var _0x4ecc7d=_0x3b67ac||stringOptions[_0xf84c('0x8')];var _0x158735=_0x3d5c2f||stringOptions[_0xf84c('0x1c')];var _0x3a06d9=crypto[_0xf84c('0x11')](_0x4ecc7d,_0x158735);var _0x141cd0=_0x3a06d9['update'](_0xfcc99d,_0xf84c('0x1d'),_0xf84c('0x1e'));_0x141cd0+=_0x3a06d9[_0xf84c('0x15')](_0xf84c('0x1e'));return _0x141cd0;};exports[_0xf84c('0x1f')]=function(_0x4c5420,_0x1ed575,_0x1703cb){var _0x5440f2=_0x1703cb||stringOptions['algorithm'];var _0x8c47c9=_0x1ed575||stringOptions[_0xf84c('0x1c')];var _0x101b17=crypto[_0xf84c('0x20')](_0x5440f2,_0x8c47c9);var _0x56be48=_0x101b17['update'](_0x4c5420,_0xf84c('0x1e'),'utf8');_0x56be48+=_0x101b17['final'](_0xf84c('0x1d'));return _0x56be48;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5c4da49..b2f0cc6 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 _0xdae1=['%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','join','%s%d.%s','csv'];(function(_0x48c232,_0x540a6f){var _0x1503db=function(_0x5640ab){while(--_0x5640ab){_0x48c232['push'](_0x48c232['shift']());}};_0x1503db(++_0x540a6f);}(_0xdae1,0x66));var _0x1dae=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xdae1[_0x138f59];return _0x3d114d;};'use strict';var util=require('util');var path=require(_0x1dae('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x1dae('0x1'));var zipdir=require(_0x1dae('0x2'));var rimraf=require(_0x1dae('0x3'));var db=require(_0x1dae('0x4'))['db'];var dbH=require(_0x1dae('0x4'))[_0x1dae('0x5')];var logger=require(_0x1dae('0x6'))(_0x1dae('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1dae('0x8')][0x2]);var QUERY=process[_0x1dae('0x8')][0x3];var PATH=process[_0x1dae('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6be94c,_0x28420a){var _0x31e0d1={'status':_0x6be94c};var _0x475455={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28420a){_0x31e0d1['savename']=_0x28420a;}return db[_0x1dae('0x9')][_0x1dae('0xa')](_0x31e0d1,_0x475455);}function main(){var _0x464813=0x1388;var _0x29a06a;logger[_0x1dae('0xb')](util[_0x1dae('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x1dae('0xd')][_0x1dae('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1dae('0xf')]})[_0x1dae('0x10')](function(_0x167d06){if(_0x167d06){_0x29a06a=_0x167d06;_0x464813=_0x29a06a['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x1dae('0x11')][_0x1dae('0x12')](util['format'](_0x1dae('0x13'),QUERY),{'type':dbH[_0x1dae('0x11')][_0x1dae('0x14')][_0x1dae('0x15')]});})[_0x1dae('0x10')](function(_0x4245e3){if(!_0x4245e3[0x0][_0x1dae('0x16')]){return analyticExtractedReport(_0x1dae('0x17'));}var _0x3c24fb=[];var _0x56384e=0x0;if(_0x29a06a[_0x1dae('0x18')]){if(_0x4245e3&&_0x4245e3['length']){var _0x417ca6=_['range'](_0x4245e3[0x0][_0x1dae('0x16')]/_0x464813);var _0x12b3b2=Number[_0x1dae('0x19')](_0x4245e3[0x0][_0x1dae('0x16')]/_0x464813)?_0x4245e3[0x0]['num']%_0x464813:0x0;_0x417ca6[_0x1dae('0x1a')](function(_0xa743ae){if(_0xa743ae>0x0){_0x56384e+=_0x464813;}_0x3c24fb[_0x1dae('0x1b')](dbH[_0x1dae('0x11')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x464813,_0x56384e),{'type':dbH['sequelize'][_0x1dae('0x14')][_0x1dae('0x15')]}));});if(_0x12b3b2>0x0){_0x56384e+=_0x464813;_0x3c24fb['push'](dbH[_0x1dae('0x11')][_0x1dae('0x12')](util[_0x1dae('0xc')](_0x1dae('0x1c'),QUERY,_0x12b3b2,_0x56384e),{'type':dbH[_0x1dae('0x11')][_0x1dae('0x14')][_0x1dae('0x15')]}));}}}else{_0x3c24fb[_0x1dae('0x1b')](dbH[_0x1dae('0x11')][_0x1dae('0x12')](QUERY,{'type':dbH[_0x1dae('0x11')][_0x1dae('0x14')]['SELECT']}));}var _0x5d345b=path[_0x1dae('0x1d')](PATH);var _0x456692=path[_0x1dae('0x1e')](PATH,'.csv');var _0x307813=_0x29a06a['split']&&_0x3c24fb[_0x1dae('0x1f')]>0x1;var _0x30e00b=[];if(!fs[_0x1dae('0x20')](path[_0x1dae('0x21')](_0x5d345b,_0x456692))&&_0x307813){fs['mkdirSync'](path[_0x1dae('0x21')](_0x5d345b,_0x456692));}return BPromise['each'](_0x3c24fb,function(_0x1ddec7){_0x30e00b['push'](_0x1ddec7);})[_0x1dae('0x10')](function(){for(var _0x133234=0x0;_0x133234<_0x30e00b[_0x1dae('0x1f')];_0x133234+=0x1){var _0x52bd75;var _0x11e381=_0x30e00b[_0x133234];if(_0x307813){_0x52bd75=path[_0x1dae('0x21')](_0x5d345b,_0x456692,util[_0x1dae('0xc')](_0x1dae('0x22'),_0x456692,_0x133234,_0x1dae('0x23')));}else{_0x52bd75=path['join'](_0x5d345b,util[_0x1dae('0xc')](_0x1dae('0x24'),_0x456692,_0x1dae('0x23')));}fs[_0x1dae('0x25')](_0x52bd75,csv(_0x11e381));}})['then'](function(){if(_0x307813){return new Promise(function(_0x46f056){zipdir(path[_0x1dae('0x21')](_0x5d345b,_0x456692),{'saveTo':path[_0x1dae('0x21')](_0x5d345b,util[_0x1dae('0xc')](_0x1dae('0x24'),_0x456692,_0x1dae('0x26')))},function(_0x230678,_0x2fc8b5){rimraf(path[_0x1dae('0x21')](_0x5d345b,_0x456692),function(){});_0x46f056(_0x1dae('0x27'));});});}})[_0x1dae('0x10')](function(){logger[_0x1dae('0xb')](util[_0x1dae('0xc')](_0x1dae('0x28'),EXTRACTED_REPORT_ID,_0x1dae('0x29')));return analyticExtractedReport('Completed',_0x307813?util['format'](_0x1dae('0x24'),_0x456692,_0x307813?_0x1dae('0x26'):'csv'):null);});})['catch'](function(_0x27ea19){logger['info'](util['format'](_0x1dae('0x2a'),EXTRACTED_REPORT_ID,_0x1dae('0x29')),util[_0x1dae('0x2b')](_0x27ea19,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1dae('0x2c')](function(){process[_0x1dae('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3623=['util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','num','forEach','push','query','basename','.csv','existsSync','each','join','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally'];(function(_0x5f570c,_0x56c6c5){var _0x5e6c9b=function(_0x2b3795){while(--_0x2b3795){_0x5f570c['push'](_0x5f570c['shift']());}};_0x5e6c9b(++_0x56c6c5);}(_0x3623,0x90));var _0x3362=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x3623[_0x2d460c];return _0xf6fc4c;};'use strict';var util=require(_0x3362('0x0'));var path=require(_0x3362('0x1'));var _=require(_0x3362('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x3362('0x3'));var zipdir=require(_0x3362('0x4'));var rimraf=require('rimraf');var db=require(_0x3362('0x5'))['db'];var dbH=require(_0x3362('0x5'))[_0x3362('0x6')];var logger=require(_0x3362('0x7'))(_0x3362('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x3362('0x9')][0x2]);var QUERY=process[_0x3362('0x9')][0x3];var PATH=process[_0x3362('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x48c664,_0x544234){var _0x296ebd={'status':_0x48c664};var _0x71154f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x544234){_0x296ebd[_0x3362('0xa')]=_0x544234;}return db[_0x3362('0xb')]['update'](_0x296ebd,_0x71154f);}function main(){var _0x1e1dd0=0x1388;var _0xdfc3d0;logger[_0x3362('0xc')](util[_0x3362('0xd')](_0x3362('0xe'),EXTRACTED_REPORT_ID,_0x3362('0xf')));return db[_0x3362('0x10')][_0x3362('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3362('0x12'),_0x3362('0x13')]})[_0x3362('0x14')](function(_0x12f894){if(_0x12f894){_0xdfc3d0=_0x12f894;_0x1e1dd0=_0xdfc3d0[_0x3362('0x13')]||0x1388;}})[_0x3362('0x14')](function(){return dbH[_0x3362('0x15')]['query'](util[_0x3362('0xd')](_0x3362('0x16'),QUERY),{'type':dbH[_0x3362('0x15')][_0x3362('0x17')][_0x3362('0x18')]});})[_0x3362('0x14')](function(_0x3155a9){if(!_0x3155a9[0x0]['num']){return analyticExtractedReport(_0x3362('0x19'));}var _0x44e6b3=[];var _0x53ba7f=0x0;if(_0xdfc3d0[_0x3362('0x12')]){if(_0x3155a9&&_0x3155a9[_0x3362('0x1a')]){var _0x1aa6dc=_[_0x3362('0x1b')](_0x3155a9[0x0]['num']/_0x1e1dd0);var _0xa26839=Number[_0x3362('0x1c')](_0x3155a9[0x0][_0x3362('0x1d')]/_0x1e1dd0)?_0x3155a9[0x0]['num']%_0x1e1dd0:0x0;_0x1aa6dc[_0x3362('0x1e')](function(_0x110416){if(_0x110416>0x0){_0x53ba7f+=_0x1e1dd0;}_0x44e6b3[_0x3362('0x1f')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1e1dd0,_0x53ba7f),{'type':dbH[_0x3362('0x15')][_0x3362('0x17')]['SELECT']}));});if(_0xa26839>0x0){_0x53ba7f+=_0x1e1dd0;_0x44e6b3[_0x3362('0x1f')](dbH[_0x3362('0x15')][_0x3362('0x20')](util[_0x3362('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa26839,_0x53ba7f),{'type':dbH[_0x3362('0x15')][_0x3362('0x17')][_0x3362('0x18')]}));}}}else{_0x44e6b3['push'](dbH[_0x3362('0x15')][_0x3362('0x20')](QUERY,{'type':dbH[_0x3362('0x15')][_0x3362('0x17')]['SELECT']}));}var _0x4be7a0=path['dirname'](PATH);var _0x449f21=path[_0x3362('0x21')](PATH,_0x3362('0x22'));var _0x339177=_0xdfc3d0['split']&&_0x44e6b3[_0x3362('0x1a')]>0x1;var _0x49c311=[];if(!fs[_0x3362('0x23')](path['join'](_0x4be7a0,_0x449f21))&&_0x339177){fs['mkdirSync'](path['join'](_0x4be7a0,_0x449f21));}return BPromise[_0x3362('0x24')](_0x44e6b3,function(_0x2fbde9){_0x49c311['push'](_0x2fbde9);})[_0x3362('0x14')](function(){for(var _0x3d635b=0x0;_0x3d635b<_0x49c311['length'];_0x3d635b+=0x1){var _0x1ce536;var _0x44ed94=_0x49c311[_0x3d635b];if(_0x339177){_0x1ce536=path[_0x3362('0x25')](_0x4be7a0,_0x449f21,util[_0x3362('0xd')](_0x3362('0x26'),_0x449f21,_0x3d635b,_0x3362('0x27')));}else{_0x1ce536=path[_0x3362('0x25')](_0x4be7a0,util[_0x3362('0xd')]('%s.%s',_0x449f21,_0x3362('0x27')));}fs['writeFileSync'](_0x1ce536,csv(_0x44ed94));}})['then'](function(){if(_0x339177){return new Promise(function(_0x2fec30){zipdir(path[_0x3362('0x25')](_0x4be7a0,_0x449f21),{'saveTo':path[_0x3362('0x25')](_0x4be7a0,util[_0x3362('0xd')](_0x3362('0x28'),_0x449f21,_0x3362('0x29')))},function(_0x14a6d7,_0x4b14a9){rimraf(path['join'](_0x4be7a0,_0x449f21),function(){});_0x2fec30('zip\x20finished');});});}})[_0x3362('0x14')](function(){logger[_0x3362('0xc')](util[_0x3362('0xd')](_0x3362('0x2a'),EXTRACTED_REPORT_ID,_0x3362('0xf')));return analyticExtractedReport(_0x3362('0x2b'),_0x339177?util['format']('%s.%s',_0x449f21,_0x339177?_0x3362('0x29'):_0x3362('0x27')):null);});})['catch'](function(_0x140ca5){logger[_0x3362('0xc')](util[_0x3362('0xd')](_0x3362('0x2c'),EXTRACTED_REPORT_ID,_0x3362('0xf')),util[_0x3362('0x2d')](_0x140ca5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3362('0x2e'));})[_0x3362('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7881aa1..cf0cbe0 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 _0x4521=['chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','push','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','flatten','%s%d.%s','%s.%s','pdf','zip\x20finished','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body'];(function(_0x132f8e,_0x58fbe7){var _0x4f7c29=function(_0x26d0f7){while(--_0x26d0f7){_0x132f8e['push'](_0x132f8e['shift']());}};_0x4f7c29(++_0x58fbe7);}(_0x4521,0x94));var _0x1452=function(_0x5c5f1f,_0x19a5c5){_0x5c5f1f=_0x5c5f1f-0x0;var _0x13a653=_0x4521[_0x5c5f1f];return _0x13a653;};'use strict';var _=require(_0x1452('0x0'));var fs=require('fs');var util=require(_0x1452('0x1'));var path=require(_0x1452('0x2'));var moment=require(_0x1452('0x3'));var htmlToPdfmake=require(_0x1452('0x4'));var PdfPrinter=require(_0x1452('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x1452('0x6'));var JSDOM=require(_0x1452('0x7'))[_0x1452('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x1452('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1452('0xa'))[_0x1452('0xb')];var logger=require('../../config/logger')(_0x1452('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1452('0xd')][0x2]);var QUERY=process[_0x1452('0xd')][0x3];var PATH=process[_0x1452('0xd')][0x4];var NAME=process[_0x1452('0xd')][0x5];var FORMAT=_0x1452('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb7cdca,_0x3d18fa){var _0x2c5b0c={'status':_0xb7cdca};var _0x43c9f5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d18fa){_0x2c5b0c['savename']=_0x3d18fa;}return db[_0x1452('0xf')][_0x1452('0x10')](_0x2c5b0c,_0x43c9f5);}function getHeaders(_0x1ea52d){return _[_0x1452('0x11')](_0x1ea52d,function(_0x2da134){return{'text':_0x2da134,'style':_0x1452('0x12')};});}function getRows(_0x19c6b9,_0x2c0109){return _['map'](_0x2c0109,function(_0x3bb36d){return _(_0x3bb36d)[_0x1452('0x13')](_0x19c6b9)[_0x1452('0x11')](function(_0x5d8f0d){return _0x5d8f0d?_[_0x1452('0x14')](_0x5d8f0d):'';})[_0x1452('0x15')]();});}function createTable(_0x17b9f0,_0x1f97d7){var _0x181dde={'widths':_[_0x1452('0x16')](Array(_0x17b9f0[_0x1452('0x17')]),0x91),'heights':function(_0x2e52bf){return _0x2e52bf===0x0?_0x1452('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x44656a=getHeaders(_0x17b9f0);_0x181dde[_0x1452('0x19')]['push'](_0x44656a);var _0x412ce8=getRows(_0x17b9f0,_0x1f97d7);_0x181dde[_0x1452('0x19')]=_0x181dde['body']['concat'](_0x412ce8);return _0x181dde;}function createTables(_0x57e3f9){var _0x5d584e=[];var _0x3d7cf4=_[_0x1452('0x1a')](Object[_0x1452('0x1b')](_0x57e3f9[0x0]),0x5);_0x3d7cf4[_0x1452('0x1c')](function(_0x52ea2e){_0x5d584e['push'](createTable(_0x52ea2e,_0x57e3f9));});return _0x5d584e;}function getPDFDocDefinition(_0x42103d){var _0x4aee5a=util[_0x1452('0x1d')](_0x1452('0x1e'),NAME,EXTRACTED_REPORT[_0x1452('0x1f')],moment(EXTRACTED_REPORT[_0x1452('0x20')])[_0x1452('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x1452('0x21')])[_0x1452('0x1d')](FORMAT));var _0x19638e=[];for(var _0x1ce51e=0x0;_0x1ce51e<_0x42103d['length'];_0x1ce51e++){var _0x1919bc=[];if(_0x1ce51e===0x0){_0x1919bc[_0x1452('0x22')]({'text':_0x4aee5a,'style':_0x1452('0x23')});}var _0x4bba6f={'table':_0x42103d[_0x1ce51e]};if(_0x1ce51e>0x0){_0x4bba6f[_0x1452('0x24')]=_0x1452('0x25');_0x4bba6f[_0x1452('0x26')]=[0x0,0x46,0x0,0x0];}_0x1919bc['push'](_0x4bba6f);_0x19638e[_0x1452('0x22')](_0x1919bc);}return{'pageSize':'A4','pageOrientation':_0x1452('0x27'),'content':_0x19638e,'footer':function(_0xd11495,_0x5ee1d8){return{'text':_0xd11495[_0x1452('0x14')]()+_0x1452('0x28')+_0x5ee1d8,'style':_0x1452('0x29')};},'defaultStyle':{'font':_0x1452('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1452('0x2b')},'footer':{'alignment':_0x1452('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x20d0bb){var _0x14b65d=0x1388;var _0x2ab35e;if(!_0x20d0bb[0x0][_0x1452('0x2d')]){return analyticExtractedReport('Empty');}return db[_0x1452('0x2e')][_0x1452('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1452('0x30')]})[_0x1452('0x31')](function(_0x28c8cc){if(_0x28c8cc){_0x2ab35e=_0x28c8cc;_0x14b65d=_0x2ab35e[_0x1452('0x30')]||0x3e8;}})[_0x1452('0x31')](function(){var _0x595e36=[];var _0xd435f1=0x0;if(_0x2ab35e[_0x1452('0x32')]){if(_0x20d0bb&&_0x20d0bb[_0x1452('0x17')]){var _0x1abe88=_[_0x1452('0x33')](_0x20d0bb[0x0]['num']/_0x14b65d);var _0x514f0a=Number[_0x1452('0x34')](_0x20d0bb[0x0]['num']/_0x14b65d)?_0x20d0bb[0x0][_0x1452('0x2d')]%_0x14b65d:0x0;_0x1abe88[_0x1452('0x1c')](function(_0x53c7ba){if(_0x53c7ba>0x0){_0xd435f1+=_0x14b65d;}_0x595e36['push'](dbH[_0x1452('0x35')][_0x1452('0x36')](util[_0x1452('0x1d')](_0x1452('0x37'),QUERY,_0x14b65d,_0xd435f1),{'type':dbH[_0x1452('0x35')][_0x1452('0x38')]['SELECT']}));});if(_0x514f0a>0x0){_0xd435f1+=_0x14b65d;_0x595e36[_0x1452('0x22')](dbH[_0x1452('0x35')][_0x1452('0x36')](util[_0x1452('0x1d')](_0x1452('0x37'),QUERY,_0x514f0a,_0xd435f1),{'type':dbH['sequelize']['QueryTypes'][_0x1452('0x39')]}));}}}else{_0x595e36[_0x1452('0x22')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x454aef=path[_0x1452('0x3a')](PATH);var _0x1933e4=path['basename'](PATH,_0x1452('0x3b'));var _0x2cbaa4=_0x2ab35e['split']&&_0x595e36[_0x1452('0x17')]>0x1;var _0x220c8e=[];if(!fs['existsSync'](path[_0x1452('0x3c')](_0x454aef,_0x1933e4))&&_0x2cbaa4){fs[_0x1452('0x3d')](path[_0x1452('0x3c')](_0x454aef,_0x1933e4));}return BPromise['each'](_0x595e36,function(_0x53d7d0){_0x220c8e['push'](_0x53d7d0);})[_0x1452('0x31')](function(){var _0x546117=[];for(var _0x2079e7=0x0;_0x2079e7<_0x220c8e['length'];_0x2079e7+=0x1){var _0x59a858=_0x220c8e[_0x2079e7];var _0x1cb5aa=createTables(_[_0x1452('0x3e')](_0x59a858));var _0x45727a;var _0x11edee=getPDFDocDefinition(_0x1cb5aa);var _0x4b8c36=getPDFPrinter();var _0x507e7a=_0x4b8c36['createPdfKitDocument'](_0x11edee);if(_0x2cbaa4){_0x45727a=path[_0x1452('0x3c')](_0x454aef,_0x1933e4,util[_0x1452('0x1d')](_0x1452('0x3f'),_0x1933e4,_0x2079e7,'pdf'));}else{_0x45727a=path[_0x1452('0x3c')](_0x454aef,util[_0x1452('0x1d')](_0x1452('0x40'),_0x1933e4,_0x1452('0x41')));}_0x546117[_0x1452('0x22')](writePDFDocument(_0x507e7a,_0x45727a));}return Promise['all'](_0x546117);})['then'](function(){if(_0x2cbaa4){return new Promise(function(_0x1f63ad){zipdir(path[_0x1452('0x3c')](_0x454aef,_0x1933e4),{'saveTo':path['join'](_0x454aef,util['format'](_0x1452('0x40'),_0x1933e4,'zip'))},function(){rimraf(path[_0x1452('0x3c')](_0x454aef,_0x1933e4),function(){});_0x1f63ad(_0x1452('0x42'));});});}})[_0x1452('0x31')](function(){if(!_0x2cbaa4)return;rimraf(path[_0x1452('0x3c')](_0x454aef,_0x1933e4),function(){});})[_0x1452('0x31')](function(){logger['info'](util[_0x1452('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x2cbaa4?util['format'](_0x1452('0x40'),_0x1933e4,_0x2cbaa4?_0x1452('0x43'):_0x1452('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1452('0x44')](util[_0x1452('0x1d')](_0x1452('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x1452('0xf')][_0x1452('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2ece10){EXTRACTED_REPORT=_0x2ece10;return dbH[_0x1452('0x35')][_0x1452('0x36')](util[_0x1452('0x1d')](_0x1452('0x47'),QUERY),{'type':dbH['sequelize'][_0x1452('0x38')][_0x1452('0x39')]});})['then'](extractReport)['catch'](function(_0x5163fb){logger['info'](util[_0x1452('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1452('0x48')),util[_0x1452('0x49')](_0x5163fb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1452('0x4a'));})[_0x1452('0x4b')](function(){process[_0x1452('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x156587=new PdfPrinter({'Arial':{'normal':__dirname+_0x1452('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1452('0x4e')}});return _0x156587;}function getPDFDocDefinitionFromHTML(_0x416703,_0x1f2d4f){var _0x3d2350=util[_0x1452('0x1d')](_0x1452('0x4f'),_0x1f2d4f['channel'],_0x1f2d4f[_0x1452('0x50')]);var _0x4b1fa0=moment()[_0x1452('0x1d')]('YYYY-MM-DD')['toString']();var _0x17c4de=htmlToPdfmake(_0x416703,{'window':window,'tableAutoSize':!![]});return{'content':[_0x17c4de],'defaultStyle':{'font':_0x1452('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1452('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1452('0x51')}},'header':function(){return[{'text':_0x1452('0x52'),'style':_0x1452('0x23')}];},'footer':function(_0xcdc25c,_0x369528){return[{'text':util['format'](_0x1452('0x53'),_0x3d2350,_0xcdc25c,_0x369528,_0x4b1fa0),'style':'footer'}];}};}function writePDFDocument(_0x4caefe,_0x8c8e84){return new Promise(function(_0x50a2d1,_0x349fa4){var _0x2c6438=_0x4caefe['pipe'](fs['createWriteStream'](_0x8c8e84));_0x2c6438['on'](_0x1452('0x54'),function(){_0x50a2d1(_0x1452('0x54'));});_0x2c6438['on'](_0x1452('0x55'),function(_0x325721){_0x349fa4(_0x325721);});_0x4caefe['end']();});}exports[_0x1452('0x56')]=function(_0x390617,_0x315291){var _0x53eb3c=getPDFPrinter();var _0x3983a8=getPDFDocDefinitionFromHTML(_0x390617,_0x315291);var _0x278ddd=_0x53eb3c['createPdfKitDocument'](_0x3983a8);return writePDFDocument(_0x278ddd,_0x315291['path'])['catch'](function(_0x531399){throw _0x531399;});}; \ No newline at end of file +var _0x2191=['then','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','flatten','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfKitDocument','path','lodash','util','moment','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','chunk','keys','forEach','format','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','split','splitSizePdf'];(function(_0xc5caf7,_0xc6d31b){var _0x509351=function(_0x531902){while(--_0x531902){_0xc5caf7['push'](_0xc5caf7['shift']());}};_0x509351(++_0xc6d31b);}(_0x2191,0x80));var _0x1219=function(_0x5e85dd,_0xdd1168){_0x5e85dd=_0x5e85dd-0x0;var _0x22111e=_0x2191[_0x5e85dd];return _0x22111e;};'use strict';var _=require(_0x1219('0x0'));var fs=require('fs');var util=require(_0x1219('0x1'));var path=require('path');var moment=require(_0x1219('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x1219('0x3'));var zipdir=require(_0x1219('0x4'));var rimraf=require(_0x1219('0x5'));var JSDOM=require('jsdom')[_0x1219('0x6')];var window=new JSDOM('')[_0x1219('0x7')];var BPromise=require(_0x1219('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1219('0x9'))[_0x1219('0xa')];var logger=require('../../config/logger')(_0x1219('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x1219('0xc')][0x2]);var QUERY=process[_0x1219('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x1219('0xc')][0x5];var FORMAT=_0x1219('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ee39f,_0x105bbb){var _0x110030={'status':_0x1ee39f};var _0x23c781={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x105bbb){_0x110030[_0x1219('0xe')]=_0x105bbb;}return db['AnalyticExtractedReport']['update'](_0x110030,_0x23c781);}function getHeaders(_0x1cd22c){return _[_0x1219('0xf')](_0x1cd22c,function(_0x12af0a){return{'text':_0x12af0a,'style':_0x1219('0x10')};});}function getRows(_0x1a3018,_0x4d2544){return _[_0x1219('0xf')](_0x4d2544,function(_0x178ece){return _(_0x178ece)[_0x1219('0x11')](_0x1a3018)[_0x1219('0xf')](function(_0x25dd11){return _0x25dd11?_[_0x1219('0x12')](_0x25dd11):'';})[_0x1219('0x13')]();});}function createTable(_0x54f9e7,_0x46f554){var _0x2361dd={'widths':_[_0x1219('0x14')](Array(_0x54f9e7['length']),0x91),'heights':function(_0x13509f){return _0x13509f===0x0?_0x1219('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x30c6e6=getHeaders(_0x54f9e7);_0x2361dd[_0x1219('0x16')][_0x1219('0x17')](_0x30c6e6);var _0x322ed1=getRows(_0x54f9e7,_0x46f554);_0x2361dd[_0x1219('0x16')]=_0x2361dd[_0x1219('0x16')][_0x1219('0x18')](_0x322ed1);return _0x2361dd;}function createTables(_0x3c21a8){var _0x3453ee=[];var _0x20dae0=_[_0x1219('0x19')](Object[_0x1219('0x1a')](_0x3c21a8[0x0]),0x5);_0x20dae0[_0x1219('0x1b')](function(_0x3443f4){_0x3453ee[_0x1219('0x17')](createTable(_0x3443f4,_0x3c21a8));});return _0x3453ee;}function getPDFDocDefinition(_0x4c3120){var _0x4e00aa=util[_0x1219('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x1219('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x1219('0x1d')])[_0x1219('0x1c')](FORMAT));var _0x38dabc=[];for(var _0x57d2eb=0x0;_0x57d2eb<_0x4c3120[_0x1219('0x1e')];_0x57d2eb++){var _0x5c7039=[];if(_0x57d2eb===0x0){_0x5c7039[_0x1219('0x17')]({'text':_0x4e00aa,'style':_0x1219('0x1f')});}var _0x49b4fe={'table':_0x4c3120[_0x57d2eb]};if(_0x57d2eb>0x0){_0x49b4fe[_0x1219('0x20')]=_0x1219('0x21');_0x49b4fe[_0x1219('0x22')]=[0x0,0x46,0x0,0x0];}_0x5c7039[_0x1219('0x17')](_0x49b4fe);_0x38dabc['push'](_0x5c7039);}return{'pageSize':'A4','pageOrientation':_0x1219('0x23'),'content':_0x38dabc,'footer':function(_0x5d5fde,_0x4b8e47){return{'text':_0x5d5fde[_0x1219('0x12')]()+_0x1219('0x24')+_0x4b8e47,'style':_0x1219('0x25')};},'defaultStyle':{'font':_0x1219('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x1219('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5760b6){var _0x465d78=0x1388;var _0x7a03b9;if(!_0x5760b6[0x0][_0x1219('0x28')]){return analyticExtractedReport(_0x1219('0x29'));}return db[_0x1219('0x2a')][_0x1219('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1219('0x2c'),_0x1219('0x2d')]})[_0x1219('0x2e')](function(_0x1d32ce){if(_0x1d32ce){_0x7a03b9=_0x1d32ce;_0x465d78=_0x7a03b9[_0x1219('0x2d')]||0x3e8;}})['then'](function(){var _0x4fc145=[];var _0x3b241f=0x0;if(_0x7a03b9[_0x1219('0x2c')]){if(_0x5760b6&&_0x5760b6['length']){var _0xc97c44=_[_0x1219('0x2f')](_0x5760b6[0x0]['num']/_0x465d78);var _0x191c82=Number['isInteger'](_0x5760b6[0x0][_0x1219('0x28')]/_0x465d78)?_0x5760b6[0x0]['num']%_0x465d78:0x0;_0xc97c44[_0x1219('0x1b')](function(_0x2347b7){if(_0x2347b7>0x0){_0x3b241f+=_0x465d78;}_0x4fc145[_0x1219('0x17')](dbH[_0x1219('0x30')][_0x1219('0x31')](util[_0x1219('0x1c')](_0x1219('0x32'),QUERY,_0x465d78,_0x3b241f),{'type':dbH[_0x1219('0x30')][_0x1219('0x33')][_0x1219('0x34')]}));});if(_0x191c82>0x0){_0x3b241f+=_0x465d78;_0x4fc145[_0x1219('0x17')](dbH['sequelize'][_0x1219('0x31')](util[_0x1219('0x1c')](_0x1219('0x32'),QUERY,_0x191c82,_0x3b241f),{'type':dbH['sequelize']['QueryTypes'][_0x1219('0x34')]}));}}}else{_0x4fc145[_0x1219('0x17')](dbH[_0x1219('0x30')][_0x1219('0x31')](QUERY,{'type':dbH[_0x1219('0x30')]['QueryTypes']['SELECT']}));}var _0x4d684c=path[_0x1219('0x35')](PATH);var _0x4c402e=path[_0x1219('0x36')](PATH,'.pdf');var _0x1b20e8=_0x7a03b9['split']&&_0x4fc145[_0x1219('0x1e')]>0x1;var _0x57f23b=[];if(!fs[_0x1219('0x37')](path[_0x1219('0x38')](_0x4d684c,_0x4c402e))&&_0x1b20e8){fs[_0x1219('0x39')](path[_0x1219('0x38')](_0x4d684c,_0x4c402e));}return BPromise['each'](_0x4fc145,function(_0x157e0b){_0x57f23b['push'](_0x157e0b);})[_0x1219('0x2e')](function(){var _0x239357=[];for(var _0x1ceea9=0x0;_0x1ceea9<_0x57f23b['length'];_0x1ceea9+=0x1){var _0x8754e9=_0x57f23b[_0x1ceea9];var _0x46a9ab=createTables(_[_0x1219('0x3a')](_0x8754e9));var _0x2e1916;var _0x328e87=getPDFDocDefinition(_0x46a9ab);var _0x46b15f=getPDFPrinter();var _0x3d8cf1=_0x46b15f['createPdfKitDocument'](_0x328e87);if(_0x1b20e8){_0x2e1916=path['join'](_0x4d684c,_0x4c402e,util[_0x1219('0x1c')]('%s%d.%s',_0x4c402e,_0x1ceea9,_0x1219('0x3b')));}else{_0x2e1916=path[_0x1219('0x38')](_0x4d684c,util['format'](_0x1219('0x3c'),_0x4c402e,'pdf'));}_0x239357[_0x1219('0x17')](writePDFDocument(_0x3d8cf1,_0x2e1916));}return Promise[_0x1219('0x3d')](_0x239357);})['then'](function(){if(_0x1b20e8){return new Promise(function(_0x5cacba){zipdir(path[_0x1219('0x38')](_0x4d684c,_0x4c402e),{'saveTo':path[_0x1219('0x38')](_0x4d684c,util[_0x1219('0x1c')](_0x1219('0x3c'),_0x4c402e,_0x1219('0x3e')))},function(){rimraf(path[_0x1219('0x38')](_0x4d684c,_0x4c402e),function(){});_0x5cacba(_0x1219('0x3f'));});});}})['then'](function(){if(!_0x1b20e8)return;rimraf(path[_0x1219('0x38')](_0x4d684c,_0x4c402e),function(){});})[_0x1219('0x2e')](function(){logger[_0x1219('0x40')](util[_0x1219('0x1c')](_0x1219('0x41'),EXTRACTED_REPORT_ID,_0x1219('0x42')));return analyticExtractedReport('Completed',_0x1b20e8?util[_0x1219('0x1c')](_0x1219('0x3c'),_0x4c402e,_0x1b20e8?_0x1219('0x3e'):_0x1219('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x1219('0x1c')](_0x1219('0x43'),EXTRACTED_REPORT_ID,_0x1219('0x42')));return db[_0x1219('0x44')][_0x1219('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1219('0x2e')](function(_0x47597a){EXTRACTED_REPORT=_0x47597a;return dbH[_0x1219('0x30')]['query'](util[_0x1219('0x1c')](_0x1219('0x46'),QUERY),{'type':dbH[_0x1219('0x30')][_0x1219('0x33')][_0x1219('0x34')]});})[_0x1219('0x2e')](extractReport)[_0x1219('0x47')](function(_0x5f1576){logger['info'](util['format'](_0x1219('0x48'),EXTRACTED_REPORT_ID,_0x1219('0x42')),util['inspect'](_0x5f1576,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1219('0x49'));})[_0x1219('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x583e52=new PdfPrinter({'Arial':{'normal':__dirname+_0x1219('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x1219('0x4c')}});return _0x583e52;}function getPDFDocDefinitionFromHTML(_0x3435e0,_0x147879){var _0x1b2d26=util[_0x1219('0x1c')](_0x1219('0x4d'),_0x147879[_0x1219('0x4e')],_0x147879['interactionId']);var _0x479834=moment()[_0x1219('0x1c')](_0x1219('0x4f'))[_0x1219('0x12')]();var _0x2f532c=htmlToPdfmake(_0x3435e0,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2f532c],'defaultStyle':{'font':_0x1219('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1219('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1219('0x50')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x1219('0x1f')}];},'footer':function(_0x3b229e,_0x2c579a){return[{'text':util[_0x1219('0x1c')](_0x1219('0x51'),_0x1b2d26,_0x3b229e,_0x2c579a,_0x479834),'style':_0x1219('0x25')}];}};}function writePDFDocument(_0x376da2,_0x4cc429){return new Promise(function(_0x1fd978,_0xa2b2d0){var _0x14171f=_0x376da2[_0x1219('0x52')](fs[_0x1219('0x53')](_0x4cc429));_0x14171f['on']('finish',function(){_0x1fd978(_0x1219('0x54'));});_0x14171f['on']('error',function(_0x566be8){_0xa2b2d0(_0x566be8);});_0x376da2['end']();});}exports['createPdfFromHTML']=function(_0x2cb8ff,_0x27c8ca){var _0x540464=getPDFPrinter();var _0x1afe57=getPDFDocDefinitionFromHTML(_0x2cb8ff,_0x27c8ca);var _0x48470f=_0x540464[_0x1219('0x55')](_0x1afe57);return writePDFDocument(_0x48470f,_0x27c8ca[_0x1219('0x56')])['catch'](function(_0x1ea991){throw _0x1ea991;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 07b61b5..f93120d 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 _0xbfcc=['splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','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','finally','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split'];(function(_0x287e8f,_0x118814){var _0x2b67a1=function(_0x1dd7e5){while(--_0x1dd7e5){_0x287e8f['push'](_0x287e8f['shift']());}};_0x2b67a1(++_0x118814);}(_0xbfcc,0x186));var _0xcbfc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xbfcc[_0x382c73];return _0x1dd0bf;};'use strict';var util=require(_0xcbfc('0x0'));var path=require(_0xcbfc('0x1'));var _=require(_0xcbfc('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xcbfc('0x3'));var zipdir=require(_0xcbfc('0x4'));var rimraf=require(_0xcbfc('0x5'));var db=require(_0xcbfc('0x6'))['db'];var dbH=require('../../mysqldb')[_0xcbfc('0x7')];var logger=require('../../config/logger')(_0xcbfc('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xcbfc('0x9')][0x2]);var QUERY=process[_0xcbfc('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x57a207,_0x44fd34){var _0x58eda9={'status':_0x57a207};var _0xb08141={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44fd34){_0x58eda9['savename']=_0x44fd34;}return db[_0xcbfc('0xa')][_0xcbfc('0xb')](_0x58eda9,_0xb08141);}function main(){var _0x4c3131=0x1388;var _0x3a18e3;logger[_0xcbfc('0xc')](util[_0xcbfc('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcbfc('0xe')));return db[_0xcbfc('0xf')][_0xcbfc('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcbfc('0x11'),_0xcbfc('0x12')]})[_0xcbfc('0x13')](function(_0x4d3341){if(_0x4d3341){_0x3a18e3=_0x4d3341;_0x4c3131=_0x3a18e3[_0xcbfc('0x12')]||0x1388;}})[_0xcbfc('0x13')](function(){return dbH[_0xcbfc('0x14')][_0xcbfc('0x15')](util[_0xcbfc('0xd')](_0xcbfc('0x16'),QUERY),{'type':dbH[_0xcbfc('0x14')][_0xcbfc('0x17')][_0xcbfc('0x18')]});})[_0xcbfc('0x13')](function(_0x34c151){if(!_0x34c151[0x0][_0xcbfc('0x19')]){return analyticExtractedReport(_0xcbfc('0x1a'));}var _0x5b3e44=[];var _0x29aff6=0x0;if(_0x3a18e3['split']){if(_0x34c151&&_0x34c151[_0xcbfc('0x1b')]){var _0x50c042=_[_0xcbfc('0x1c')](_0x34c151[0x0]['num']/_0x4c3131);var _0x3b0f82=Number[_0xcbfc('0x1d')](_0x34c151[0x0]['num']/_0x4c3131)?_0x34c151[0x0][_0xcbfc('0x19')]%_0x4c3131:0x0;_0x50c042[_0xcbfc('0x1e')](function(_0x4fc79c){if(_0x4fc79c>0x0){_0x29aff6+=_0x4c3131;}_0x5b3e44[_0xcbfc('0x1f')](dbH[_0xcbfc('0x14')][_0xcbfc('0x15')](util[_0xcbfc('0xd')](_0xcbfc('0x20'),QUERY,_0x4c3131,_0x29aff6),{'type':dbH[_0xcbfc('0x14')][_0xcbfc('0x17')][_0xcbfc('0x18')]}));});if(_0x3b0f82>0x0){_0x29aff6+=_0x4c3131;_0x5b3e44['push'](dbH[_0xcbfc('0x14')][_0xcbfc('0x15')](util[_0xcbfc('0xd')](_0xcbfc('0x20'),QUERY,_0x3b0f82,_0x29aff6),{'type':dbH[_0xcbfc('0x14')][_0xcbfc('0x17')][_0xcbfc('0x18')]}));}}}else{_0x5b3e44[_0xcbfc('0x1f')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0xcbfc('0x17')][_0xcbfc('0x18')]}));}var _0x28833b=path[_0xcbfc('0x21')](PATH);var _0x3baafb=path[_0xcbfc('0x22')](PATH,_0xcbfc('0x23'));var _0x174779=_0x3a18e3['split']&&_0x5b3e44[_0xcbfc('0x1b')]>0x1;var _0x2cc5c1=[];if(!fs[_0xcbfc('0x24')](path['join'](_0x28833b,_0x3baafb))&&_0x174779){fs[_0xcbfc('0x25')](path[_0xcbfc('0x26')](_0x28833b,_0x3baafb));}return BPromise[_0xcbfc('0x27')](_0x5b3e44,function(_0xace3d2){_0x2cc5c1[_0xcbfc('0x1f')](_0xace3d2);})[_0xcbfc('0x13')](function(){for(var _0x51100f=0x0;_0x51100f<_0x2cc5c1[_0xcbfc('0x1b')];_0x51100f+=0x1){var _0x31f71b;var _0x5e0867=_0x2cc5c1[_0x51100f];if(_0x174779){_0x31f71b=path[_0xcbfc('0x26')](_0x28833b,_0x3baafb,util[_0xcbfc('0xd')](_0xcbfc('0x28'),_0x3baafb,_0x51100f,_0xcbfc('0x29')));}else{_0x31f71b=path[_0xcbfc('0x26')](_0x28833b,util['format'](_0xcbfc('0x2a'),_0x3baafb,_0xcbfc('0x29')));}fs['writeFileSync'](_0x31f71b,json2xls(_0x5e0867),_0xcbfc('0x2b'));}})[_0xcbfc('0x13')](function(){if(_0x174779){return new Promise(function(_0x2921a8){zipdir(path[_0xcbfc('0x26')](_0x28833b,_0x3baafb),{'saveTo':path[_0xcbfc('0x26')](_0x28833b,util[_0xcbfc('0xd')](_0xcbfc('0x2a'),_0x3baafb,'zip'))},function(_0x2a0ec2,_0x4a1e05){rimraf(path[_0xcbfc('0x26')](_0x28833b,_0x3baafb),function(){});_0x2921a8(_0xcbfc('0x2c'));});});}})[_0xcbfc('0x13')](function(){logger[_0xcbfc('0xc')](util[_0xcbfc('0xd')](_0xcbfc('0x2d'),EXTRACTED_REPORT_ID,_0xcbfc('0xe')));return analyticExtractedReport('Completed',_0x174779?util[_0xcbfc('0xd')](_0xcbfc('0x2a'),_0x3baafb,_0x174779?'zip':_0xcbfc('0x29')):null);});})[_0xcbfc('0x2e')](function(_0xaf6c8d){logger[_0xcbfc('0xc')](util['format'](_0xcbfc('0x2f'),EXTRACTED_REPORT_ID,_0xcbfc('0xe')),util[_0xcbfc('0x30')](_0xaf6c8d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcbfc('0x31'));})[_0xcbfc('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfb4b=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','each','length','%s%d.%s','xlsx','%s.%s','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfb4b,0x1d6));var _0xbfb4=function(_0x5c6e48,_0x3c418c){_0x5c6e48=_0x5c6e48-0x0;var _0x180ed4=_0xfb4b[_0x5c6e48];return _0x180ed4;};'use strict';var util=require(_0xbfb4('0x0'));var path=require(_0xbfb4('0x1'));var _=require(_0xbfb4('0x2'));var fs=require('fs');var json2xls=require(_0xbfb4('0x3'));var BPromise=require(_0xbfb4('0x4'));var zipdir=require(_0xbfb4('0x5'));var rimraf=require(_0xbfb4('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbfb4('0x7'))[_0xbfb4('0x8')];var logger=require(_0xbfb4('0x9'))(_0xbfb4('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x553521,_0x414f58){var _0x151752={'status':_0x553521};var _0x15fcea={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x414f58){_0x151752['savename']=_0x414f58;}return db[_0xbfb4('0xb')][_0xbfb4('0xc')](_0x151752,_0x15fcea);}function main(){var _0x864a2e=0x1388;var _0x429302;logger[_0xbfb4('0xd')](util[_0xbfb4('0xe')](_0xbfb4('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xbfb4('0x10')][_0xbfb4('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbfb4('0x12'),_0xbfb4('0x13')]})[_0xbfb4('0x14')](function(_0x283ffc){if(_0x283ffc){_0x429302=_0x283ffc;_0x864a2e=_0x429302[_0xbfb4('0x13')]||0x1388;}})[_0xbfb4('0x14')](function(){return dbH[_0xbfb4('0x15')][_0xbfb4('0x16')](util['format'](_0xbfb4('0x17'),QUERY),{'type':dbH[_0xbfb4('0x15')][_0xbfb4('0x18')][_0xbfb4('0x19')]});})[_0xbfb4('0x14')](function(_0x123758){if(!_0x123758[0x0]['num']){return analyticExtractedReport(_0xbfb4('0x1a'));}var _0x3eb341=[];var _0xe1054d=0x0;if(_0x429302[_0xbfb4('0x12')]){if(_0x123758&&_0x123758['length']){var _0xb5d1d5=_[_0xbfb4('0x1b')](_0x123758[0x0][_0xbfb4('0x1c')]/_0x864a2e);var _0x2a9767=Number[_0xbfb4('0x1d')](_0x123758[0x0]['num']/_0x864a2e)?_0x123758[0x0]['num']%_0x864a2e:0x0;_0xb5d1d5['forEach'](function(_0x4cf694){if(_0x4cf694>0x0){_0xe1054d+=_0x864a2e;}_0x3eb341[_0xbfb4('0x1e')](dbH['sequelize']['query'](util[_0xbfb4('0xe')](_0xbfb4('0x1f'),QUERY,_0x864a2e,_0xe1054d),{'type':dbH[_0xbfb4('0x15')]['QueryTypes']['SELECT']}));});if(_0x2a9767>0x0){_0xe1054d+=_0x864a2e;_0x3eb341['push'](dbH[_0xbfb4('0x15')][_0xbfb4('0x16')](util[_0xbfb4('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2a9767,_0xe1054d),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x3eb341[_0xbfb4('0x1e')](dbH[_0xbfb4('0x15')][_0xbfb4('0x16')](QUERY,{'type':dbH[_0xbfb4('0x15')][_0xbfb4('0x18')]['SELECT']}));}var _0x474692=path[_0xbfb4('0x20')](PATH);var _0x1ae53a=path[_0xbfb4('0x21')](PATH,'.xlsx');var _0x2f8224=_0x429302[_0xbfb4('0x12')]&&_0x3eb341['length']>0x1;var _0x5574e8=[];if(!fs[_0xbfb4('0x22')](path[_0xbfb4('0x23')](_0x474692,_0x1ae53a))&&_0x2f8224){fs['mkdirSync'](path[_0xbfb4('0x23')](_0x474692,_0x1ae53a));}return BPromise[_0xbfb4('0x24')](_0x3eb341,function(_0x552660){_0x5574e8[_0xbfb4('0x1e')](_0x552660);})[_0xbfb4('0x14')](function(){for(var _0x1a914c=0x0;_0x1a914c<_0x5574e8[_0xbfb4('0x25')];_0x1a914c+=0x1){var _0x478991;var _0x3f1c2e=_0x5574e8[_0x1a914c];if(_0x2f8224){_0x478991=path[_0xbfb4('0x23')](_0x474692,_0x1ae53a,util['format'](_0xbfb4('0x26'),_0x1ae53a,_0x1a914c,_0xbfb4('0x27')));}else{_0x478991=path[_0xbfb4('0x23')](_0x474692,util[_0xbfb4('0xe')](_0xbfb4('0x28'),_0x1ae53a,_0xbfb4('0x27')));}fs['writeFileSync'](_0x478991,json2xls(_0x3f1c2e),_0xbfb4('0x29'));}})['then'](function(){if(_0x2f8224){return new Promise(function(_0x276c7f){zipdir(path[_0xbfb4('0x23')](_0x474692,_0x1ae53a),{'saveTo':path[_0xbfb4('0x23')](_0x474692,util['format']('%s.%s',_0x1ae53a,'zip'))},function(_0x31b30e,_0x206be6){rimraf(path['join'](_0x474692,_0x1ae53a),function(){});_0x276c7f('zip\x20finished');});});}})[_0xbfb4('0x14')](function(){logger['info'](util[_0xbfb4('0xe')](_0xbfb4('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x2f8224?util[_0xbfb4('0xe')]('%s.%s',_0x1ae53a,_0x2f8224?_0xbfb4('0x2b'):_0xbfb4('0x27')):null);});})['catch'](function(_0xcfd2b4){logger['info'](util[_0xbfb4('0xe')](_0xbfb4('0x2c'),EXTRACTED_REPORT_ID,_0xbfb4('0x2d')),util[_0xbfb4('0x2e')](_0xcfd2b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbfb4('0x2f'));})[_0xbfb4('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e843ce6..c11b8e5 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 _0x36c5=['length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','destroy','catch','rewrite','lodash','util','models','then','intervals','VoiceExtension','findAll','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','Set','CDR(destination)=','extension','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x36c5,0x16d));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x536c('0x0'));var util=require(_0x536c('0x1'));function rewrite(_0x40be5f,_0x2bc0a2){var _0x39a1f6=this;return _0x40be5f[_0x536c('0x2')]['Interval']['findAll']({'raw':!![]})[_0x536c('0x3')](function(_0x29d901){_0x39a1f6[_0x536c('0x4')]=_0x29d901;return _0x40be5f[_0x536c('0x2')][_0x536c('0x5')][_0x536c('0x6')]({'where':{'IntervalId':_0x2bc0a2[_0x536c('0x7')]},'raw':!![]});})[_0x536c('0x3')](function(_0x38a1b8){return _0x40be5f[_0x536c('0x2')]['VoiceExtension'][_0x536c('0x6')]({'where':{'exten':{'$in':_['uniq'](_[_0x536c('0x8')](_0x38a1b8,_0x536c('0x9')))}},'order':[{'raw':_0x536c('0xa')}],'raw':!![]});})['then'](function(_0x26f85d){var _0x5163e8=_['filter'](_0x26f85d,{'priority':'1'});var _0x5de9ae=_[_0x536c('0xb')](_0x26f85d,{'isApp':0x1});var _0xf40f9b=_[_0x536c('0xc')](_0x5de9ae,_0x536c('0x9'));var _0x213c90=[_0x536c('0xd'),_0x536c('0xe')];var _0x45c261=[];var _0x1bf06e=[];for(var _0x4e17fc in _0xf40f9b){if(_0xf40f9b[_0x536c('0xf')](_0x4e17fc)){_0x39a1f6[_0x536c('0x10')]=0x2;_0x39a1f6[_0x536c('0x11')]=[];_0x39a1f6['extension']=_['find'](_0x5163e8,{'exten':_0xf40f9b[_0x4e17fc][0x0]['exten']});_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':'Set','appdata':util[_0x536c('0x14')](_0x536c('0x15'),_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')]),'context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0]['VoiceExtensionId']});if(_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')]===_0x536c('0x17')){_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':'Set','appdata':_0x536c('0x18')+_0xf40f9b[_0x4e17fc][0x0]['VoiceExtensionId'],'context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});}else if(_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')]==='outbound'){if(_0x39a1f6['extension']){_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x1b')+(_0x39a1f6[_0x536c('0x1c')][_0x536c('0x1d')]?'${EXTEN:'+_0x39a1f6[_0x536c('0x1c')][_0x536c('0x1d')]+'}':_0x536c('0x1e')),'context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6['priority']++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});}_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':'Set','appdata':_0x536c('0x18')+_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')],'context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0]['exten'],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});var _0x303f1c=_0x39a1f6[_0x536c('0x10')]++;_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1f'),'appdata':_0x536c('0x20')+(_0x303f1c+0x2)+_0x536c('0x21')+(_0x303f1c+0x1)+')','context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x303f1c,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});if(_0x39a1f6[_0x536c('0x1c')]){_0x39a1f6['extensions'][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x39a1f6[_0x536c('0x1c')]['cutdigits']?_0x536c('0x22')+_0x39a1f6['extension'][_0x536c('0x1d')]+'}':_0x536c('0x23'),'context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0]['exten'],'priority':_0x39a1f6['priority']++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});}_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':'Set','appdata':_0x536c('0x24')+_0xf40f9b[_0x4e17fc][0x0]['VoiceExtensionId'],'context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});if(_0x39a1f6['extension']&&_0x39a1f6[_0x536c('0x1c')][_0x536c('0xf')]('recordingFormat')&&_0x39a1f6[_0x536c('0x1c')][_0x536c('0x25')]!==_0x536c('0x26')){_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x27')+_0x39a1f6[_0x536c('0x1c')]['recordingFormat']||_0x536c('0x28'),'context':_0xf40f9b[_0x4e17fc][0x0]['context'],'exten':_0xf40f9b[_0x4e17fc][0x0]['exten'],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});}}_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x29'),'context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0]['exten'],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});_0x39a1f6['extensions']['push']({'type':_0xf40f9b[_0x4e17fc][0x0]['type'],'app':_0x536c('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0]['exten'],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0]['VoiceExtensionId']});_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x2a'),'context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'priority':_0x39a1f6[_0x536c('0x10')]++,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});for(var _0x99fbe3=0x0,_0x37762f=0x0;_0x99fbe3<_0xf40f9b[_0x4e17fc][_0x536c('0x2b')];_0x99fbe3+=0x1,_0x37762f=0x0){var _0x544bac=_0xf40f9b[_0x4e17fc][_0x99fbe3];if(_0x544bac[_0x536c('0x13')]){_0x544bac['type']=_0x544bac[_0x536c('0x13')][_0x536c('0x2c')]();}var _0x8dc9e1=[];var _0x2cf3f7=[];delete _0x544bac['id'];delete _0x544bac[_0x536c('0x2d')];delete _0x544bac[_0x536c('0x2e')];var _0x327565=_0x544bac['interval']!==_0x536c('0x2f')?[_0x544bac[_0x536c('0x30')]]:_0x544bac['IntervalId']?_['map'](_[_0x536c('0xb')](_0x39a1f6[_0x536c('0x4')],{'IntervalId':_0x544bac['IntervalId']}),_0x536c('0x30')):[];if(_0x544bac[_0x536c('0xf')](_0x536c('0x31'))){if(_0x544bac[_0x536c('0x31')]&&_0x544bac[_0x536c('0x31')]!=='--'){_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x32')+_0x544bac[_0x536c('0x31')],'context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565['length']+_0x39a1f6[_0x536c('0x10')]+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});}}if(_0x544bac[_0x536c('0x13')]===_0x536c('0x33')&&_0x544bac[_0x536c('0xf')](_0x536c('0x34'))){if(_0x544bac['callerID']){_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x544bac[_0x536c('0x34')]+')','context':_0x544bac['context'],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565['length']+_0x39a1f6[_0x536c('0x10')]+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});}else{_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x1f'),'appdata':_0x536c('0x35'),'context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565['length']+_0x39a1f6['priority']+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});}}if(_0x544bac['hasOwnProperty']('answer')){if(_0x213c90[_0x536c('0x36')](_0x544bac['app'][_0x536c('0x2c')]())>=0x0&&_0x544bac[_0x536c('0x37')]!==_0x536c('0x38')){if(_0x544bac['answer']){_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x1f'),'appdata':_0x536c('0x39'),'context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac['exten'],'priority':_0x327565['length']+_0x39a1f6['priority']+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac['type'],'app':_0x536c('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565['length']+_0x39a1f6[_0x536c('0x10')]+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});}else{_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':'ExecIf','appdata':_0x536c('0x3a'),'context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565[_0x536c('0x2b')]+_0x39a1f6[_0x536c('0x10')]+_0x37762f++,'VoiceExtensionId':_0x544bac[_0x536c('0x19')]});_0x8dc9e1[_0x536c('0x12')]({'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x1a'),'appdata':_0x536c('0x3b'),'context':_0x544bac[_0x536c('0x16')],'exten':_0x544bac[_0x536c('0x9')],'priority':_0x327565[_0x536c('0x2b')]+_0x39a1f6[_0x536c('0x10')]+_0x37762f++,'VoiceExtensionId':_0x544bac['VoiceExtensionId']});}}}for(var _0x49eccc=0x0;_0x49eccc<_0x327565[_0x536c('0x2b')];_0x49eccc+=0x1){var _0x48e3ea=_0x39a1f6[_0x536c('0x10')]+_0x327565[_0x536c('0x2b')];var _0x15c86f=_0x49eccc===_0x327565[_0x536c('0x2b')]-0x1?_0x39a1f6[_0x536c('0x10')]+_0x8dc9e1[_0x536c('0x2b')]+_0x2cf3f7['length']+0x2:_0x39a1f6['priority']+_0x49eccc+0x1;_0x8dc9e1[_0x536c('0x3c')](_0x49eccc,0x0,{'type':_0x544bac[_0x536c('0x13')],'app':_0x536c('0x3d'),'appdata':_0x327565[_0x49eccc]+'?'+_0x544bac['context']+_0x536c('0x3e')+_0x48e3ea+':'+_0x544bac[_0x536c('0x16')]+_0x536c('0x3e')+_0x15c86f,'exten':_0x544bac['exten'],'context':_0x544bac[_0x536c('0x16')],'priority':_0x39a1f6[_0x536c('0x10')]+_0x49eccc,'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0]['VoiceExtensionId']});}_0x544bac[_0x536c('0x10')]=_0x8dc9e1[_0x536c('0x2b')]?_['last'](_0x8dc9e1)[_0x536c('0x10')]+0x1:_0x39a1f6[_0x536c('0x10')];_0x39a1f6[_0x536c('0x10')]=(_0x2cf3f7['length']?_['last'](_0x2cf3f7)[_0x536c('0x10')]:_0x544bac['priority'])+0x1;_0x39a1f6[_0x536c('0x11')]=_[_0x536c('0x3f')](_0x39a1f6[_0x536c('0x11')],_0x8dc9e1,[_0x544bac],_0x2cf3f7);}_0x39a1f6[_0x536c('0x11')][_0x536c('0x12')]({'type':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x13')],'app':_0x536c('0x40'),'exten':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x9')],'context':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x16')],'priority':_0x39a1f6[_0x536c('0x10')],'VoiceExtensionId':_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]});_0x45c261['push'](_0xf40f9b[_0x4e17fc][0x0][_0x536c('0x19')]);_0x1bf06e=_[_0x536c('0x3f')](_0x1bf06e,_0x39a1f6[_0x536c('0x11')]);}}return _0x40be5f['transaction'](function(_0x22a825){return _0x40be5f[_0x536c('0x2')][_0x536c('0x5')][_0x536c('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x45c261}},'transaction':_0x22a825})[_0x536c('0x3')](function(_0x2764b6){return _0x40be5f[_0x536c('0x2')][_0x536c('0x5')]['bulkCreate'](_['sortBy'](_0x1bf06e,_0x536c('0x10')),{'transaction':_0x22a825});});});})[_0x536c('0x42')](function(_0x32797b){console['error'](_0x32797b);});}exports[_0x536c('0x43')]=rewrite; \ No newline at end of file +var _0x72ec=['length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extension','extensions','type','Set','format','CDR(type)=%s','context','inbound','push','CDR(routeid)=','VoiceExtensionId','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','none','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x72ec,0x9c));var _0xc72e=function(_0x3926ba,_0x237901){_0x3926ba=_0x3926ba-0x0;var _0x18756e=_0x72ec[_0x3926ba];return _0x18756e;};'use strict';var _=require('lodash');var util=require(_0xc72e('0x0'));function rewrite(_0x18ac3e,_0x163d12){var _0xf95be0=this;return _0x18ac3e[_0xc72e('0x1')][_0xc72e('0x2')][_0xc72e('0x3')]({'raw':!![]})['then'](function(_0x3c3b28){_0xf95be0[_0xc72e('0x4')]=_0x3c3b28;return _0x18ac3e['models'][_0xc72e('0x5')][_0xc72e('0x3')]({'where':{'IntervalId':_0x163d12['IntervalId']},'raw':!![]});})[_0xc72e('0x6')](function(_0x336087){return _0x18ac3e[_0xc72e('0x1')][_0xc72e('0x5')][_0xc72e('0x3')]({'where':{'exten':{'$in':_[_0xc72e('0x7')](_[_0xc72e('0x8')](_0x336087,_0xc72e('0x9')))}},'order':[{'raw':_0xc72e('0xa')}],'raw':!![]});})[_0xc72e('0x6')](function(_0x184199){var _0x219a79=_[_0xc72e('0xb')](_0x184199,{'priority':'1'});var _0x2dc21b=_[_0xc72e('0xb')](_0x184199,{'isApp':0x1});var _0xf679ea=_['groupBy'](_0x2dc21b,_0xc72e('0x9'));var _0x2d4138=[_0xc72e('0xc'),'playback'];var _0x3b2c9c=[];var _0xcadfe7=[];for(var _0x3cf26a in _0xf679ea){if(_0xf679ea[_0xc72e('0xd')](_0x3cf26a)){_0xf95be0[_0xc72e('0xe')]=0x2;_0xf95be0['extensions']=[];_0xf95be0[_0xc72e('0xf')]=_['find'](_0x219a79,{'exten':_0xf679ea[_0x3cf26a][0x0]['exten']});_0xf95be0[_0xc72e('0x10')]['push']({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':util[_0xc72e('0x13')](_0xc72e('0x14'),_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')]),'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0]['exten'],'priority':_0xf95be0['priority']++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0]['VoiceExtensionId']});if(_0xf679ea[_0x3cf26a][0x0]['type']===_0xc72e('0x16')){_0xf95be0[_0xc72e('0x10')][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x18')+_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')],'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});}else if(_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')]==='outbound'){if(_0xf95be0[_0xc72e('0xf')]){_0xf95be0[_0xc72e('0x10')][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x1a')+(_0xf95be0['extension']['cutdigits']?_0xc72e('0x1b')+_0xf95be0[_0xc72e('0xf')][_0xc72e('0x1c')]+'}':_0xc72e('0x1d')),'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});}_0xf95be0[_0xc72e('0x10')][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x18')+_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')],'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0]['exten'],'priority':_0xf95be0['priority']++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});var _0x2c127b=_0xf95be0[_0xc72e('0xe')]++;_0xf95be0['extensions'][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0]['type'],'app':_0xc72e('0x1e'),'appdata':_0xc72e('0x1f')+(_0x2c127b+0x2)+_0xc72e('0x20')+(_0x2c127b+0x1)+')','context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0x2c127b,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0]['VoiceExtensionId']});if(_0xf95be0[_0xc72e('0xf')]){_0xf95be0[_0xc72e('0x10')]['push']({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':'Set','appdata':_0xf95be0[_0xc72e('0xf')]['cutdigits']?_0xc72e('0x21')+_0xf95be0['extension'][_0xc72e('0x1c')]+'}':_0xc72e('0x22'),'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});}_0xf95be0['extensions'][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x23')+_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')],'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0['priority']++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0]['VoiceExtensionId']});if(_0xf95be0[_0xc72e('0xf')]&&_0xf95be0[_0xc72e('0xf')][_0xc72e('0xd')]('recordingFormat')&&_0xf95be0[_0xc72e('0xf')]['recordingFormat']!==_0xc72e('0x24')){_0xf95be0[_0xc72e('0x10')][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xf679ea[_0x3cf26a][0x0]['context'],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});_0xf95be0['extensions'][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0]['type'],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x25')+_0xf95be0[_0xc72e('0xf')][_0xc72e('0x26')]||_0xc72e('0x27'),'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0]['exten'],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});}}_0xf95be0['extensions'][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x28'),'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});_0xf95be0['extensions'][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x29'),'context':_0xf679ea[_0x3cf26a][0x0]['context'],'exten':_0xf679ea[_0x3cf26a][0x0]['exten'],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});_0xf95be0[_0xc72e('0x10')]['push']({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0xf679ea[_0x3cf26a][0x0]['context'],'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'priority':_0xf95be0[_0xc72e('0xe')]++,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});for(var _0x44447b=0x0,_0x5fac38=0x0;_0x44447b<_0xf679ea[_0x3cf26a]['length'];_0x44447b+=0x1,_0x5fac38=0x0){var _0xb66186=_0xf679ea[_0x3cf26a][_0x44447b];if(_0xb66186[_0xc72e('0x11')]){_0xb66186['type']=_0xb66186[_0xc72e('0x11')][_0xc72e('0x2a')]();}var _0x19a471=[];var _0x59cc3f=[];delete _0xb66186['id'];delete _0xb66186[_0xc72e('0x2b')];delete _0xb66186['updatedAt'];var _0x4202d1=_0xb66186[_0xc72e('0x2c')]!==_0xc72e('0x2d')?[_0xb66186['interval']]:_0xb66186[_0xc72e('0x2e')]?_[_0xc72e('0x8')](_['filter'](_0xf95be0['intervals'],{'IntervalId':_0xb66186[_0xc72e('0x2e')]}),'interval'):[];if(_0xb66186['hasOwnProperty'](_0xc72e('0x2f'))){if(_0xb66186['tag']&&_0xb66186['tag']!=='--'){_0x19a471[_0xc72e('0x17')]({'type':_0xb66186[_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':'CDR(tag)='+_0xb66186['tag'],'context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});}}if(_0xb66186[_0xc72e('0x11')]===_0xc72e('0x31')&&_0xb66186[_0xc72e('0xd')](_0xc72e('0x32'))){if(_0xb66186[_0xc72e('0x32')]){_0x19a471[_0xc72e('0x17')]({'type':_0xb66186[_0xc72e('0x11')],'app':_0xc72e('0x1e'),'appdata':_0xc72e('0x33')+_0xb66186[_0xc72e('0x32')]+')','context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});}else{_0x19a471[_0xc72e('0x17')]({'type':_0xb66186[_0xc72e('0x11')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});}}if(_0xb66186['hasOwnProperty'](_0xc72e('0x34'))){if(_0x2d4138[_0xc72e('0x35')](_0xb66186['app'][_0xc72e('0x2a')]())>=0x0&&_0xb66186['appType']!=='custom'){if(_0xb66186[_0xc72e('0x34')]){_0x19a471[_0xc72e('0x17')]({'type':_0xb66186['type'],'app':'ExecIf','appdata':_0xc72e('0x36'),'context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186['exten'],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});_0x19a471[_0xc72e('0x17')]({'type':_0xb66186['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1['length']+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});}else{_0x19a471[_0xc72e('0x17')]({'type':_0xb66186[_0xc72e('0x11')],'app':_0xc72e('0x1e'),'appdata':_0xc72e('0x37'),'context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186['VoiceExtensionId']});_0x19a471[_0xc72e('0x17')]({'type':_0xb66186[_0xc72e('0x11')],'app':_0xc72e('0x12'),'appdata':_0xc72e('0x38'),'context':_0xb66186[_0xc72e('0x15')],'exten':_0xb66186[_0xc72e('0x9')],'priority':_0x4202d1[_0xc72e('0x30')]+_0xf95be0[_0xc72e('0xe')]+_0x5fac38++,'VoiceExtensionId':_0xb66186[_0xc72e('0x19')]});}}}for(var _0xcc4224=0x0;_0xcc4224<_0x4202d1[_0xc72e('0x30')];_0xcc4224+=0x1){var _0x31afad=_0xf95be0['priority']+_0x4202d1[_0xc72e('0x30')];var _0xd202bc=_0xcc4224===_0x4202d1[_0xc72e('0x30')]-0x1?_0xf95be0[_0xc72e('0xe')]+_0x19a471[_0xc72e('0x30')]+_0x59cc3f[_0xc72e('0x30')]+0x2:_0xf95be0['priority']+_0xcc4224+0x1;_0x19a471[_0xc72e('0x39')](_0xcc4224,0x0,{'type':_0xb66186[_0xc72e('0x11')],'app':_0xc72e('0x3a'),'appdata':_0x4202d1[_0xcc4224]+'?'+_0xb66186['context']+_0xc72e('0x3b')+_0x31afad+':'+_0xb66186['context']+_0xc72e('0x3b')+_0xd202bc,'exten':_0xb66186[_0xc72e('0x9')],'context':_0xb66186[_0xc72e('0x15')],'priority':_0xf95be0['priority']+_0xcc4224,'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});}_0xb66186[_0xc72e('0xe')]=_0x19a471[_0xc72e('0x30')]?_[_0xc72e('0x3c')](_0x19a471)[_0xc72e('0xe')]+0x1:_0xf95be0[_0xc72e('0xe')];_0xf95be0[_0xc72e('0xe')]=(_0x59cc3f['length']?_[_0xc72e('0x3c')](_0x59cc3f)[_0xc72e('0xe')]:_0xb66186[_0xc72e('0xe')])+0x1;_0xf95be0['extensions']=_[_0xc72e('0x3d')](_0xf95be0[_0xc72e('0x10')],_0x19a471,[_0xb66186],_0x59cc3f);}_0xf95be0[_0xc72e('0x10')][_0xc72e('0x17')]({'type':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x11')],'app':_0xc72e('0x3e'),'exten':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x9')],'context':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x15')],'priority':_0xf95be0['priority'],'VoiceExtensionId':_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]});_0x3b2c9c[_0xc72e('0x17')](_0xf679ea[_0x3cf26a][0x0][_0xc72e('0x19')]);_0xcadfe7=_[_0xc72e('0x3d')](_0xcadfe7,_0xf95be0[_0xc72e('0x10')]);}}return _0x18ac3e[_0xc72e('0x3f')](function(_0x593e45){return _0x18ac3e[_0xc72e('0x1')][_0xc72e('0x5')][_0xc72e('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3b2c9c}},'transaction':_0x593e45})[_0xc72e('0x6')](function(_0x17c149){return _0x18ac3e[_0xc72e('0x1')][_0xc72e('0x5')][_0xc72e('0x41')](_['sortBy'](_0xcadfe7,_0xc72e('0xe')),{'transaction':_0x593e45});});});})[_0xc72e('0x42')](function(_0x17342b){console[_0xc72e('0x43')](_0x17342b);});}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 19fe8f5..9ebf46a 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 _0x6f5a=['error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','data','firstName','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','fromQuery','scheduledAt','ContactId','createdAt','select','phone','field','toString','NOW()','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','from','cm_hopper','\x20=\x20?','insert','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','all','VoiceQueue','BlackLists','query','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!'];(function(_0xf3e4a0,_0x16a172){var _0x43f1cc=function(_0x3abdf5){while(--_0x3abdf5){_0xf3e4a0['push'](_0xf3e4a0['shift']());}};_0x43f1cc(++_0x16a172);}(_0x6f5a,0x19b));var _0xa6f5=function(_0x1f8376,_0x38684b){_0x1f8376=_0x1f8376-0x0;var _0xee8e37=_0x6f5a[_0x1f8376];return _0xee8e37;};'use strict';var BPromise=require(_0xa6f5('0x0'));var util=require(_0xa6f5('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xa6f5('0x2'));var Papa=require(_0xa6f5('0x3'));var Redis=require('ioredis');var db=require(_0xa6f5('0x4'))['db'];var config=require(_0xa6f5('0x5'));var logger=require(_0xa6f5('0x6'))(_0xa6f5('0x7'));config[_0xa6f5('0x8')]=_[_0xa6f5('0x9')](config[_0xa6f5('0x8')],{'host':_0xa6f5('0xa'),'port':0x18eb});var socket=require(_0xa6f5('0xb'))(new Redis(config[_0xa6f5('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xa6f5('0xc')](socket);try{if(!process[_0xa6f5('0xd')][0x2]||process[_0xa6f5('0xd')][0x2]===_0xa6f5('0xe')||process[_0xa6f5('0xd')][0x2]===_0xa6f5('0xf')){throw new Error(_0xa6f5('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0xa6f5('0xd')][0x3]||process[_0xa6f5('0xd')][0x3]===_0xa6f5('0xe')||process[_0xa6f5('0xd')][0x3]===_0xa6f5('0xf')||!process[_0xa6f5('0xd')][0x4]||process[_0xa6f5('0xd')][0x4]==='undefined'||process[_0xa6f5('0xd')][0x4]===_0xa6f5('0xf')){throw new Error(_0xa6f5('0x11'));}var FIELDS=_[_0xa6f5('0x12')](process['argv'][0x3]['split'](','),process[_0xa6f5('0xd')][0x4][_0xa6f5('0x13')](','));if(!process[_0xa6f5('0xd')][0x5]||process[_0xa6f5('0xd')][0x5]===_0xa6f5('0xe')||process[_0xa6f5('0xd')][0x5]===_0xa6f5('0xf')){throw new Error(_0xa6f5('0x14'));}var LISTID=process[_0xa6f5('0xd')][0x5];var COMPANYID=process[_0xa6f5('0xd')][0x6]&&process[_0xa6f5('0xd')][0x6]!=='undefined'&&process[_0xa6f5('0xd')][0x6]!==_0xa6f5('0xf')?process[_0xa6f5('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xa6f5('0xd')][0x7]!=='undefined'&&process[_0xa6f5('0xd')][0x7]!==_0xa6f5('0xf')?process[_0xa6f5('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xa6f5('0xd')][0x8]===_0xa6f5('0xe')||process[_0xa6f5('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x440873){logger[_0xa6f5('0x15')](_0x440873);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(_0x146e4f,_0x127e7a,_0x5ad863,_0x57a763){var _0x3ce5be={'message':_0x127e7a};_0x3ce5be[_0x146e4f]=!![];if(_0x5ad863){_0x3ce5be[_0xa6f5('0x16')]=_0x5ad863;}if(_0x57a763){_0x3ce5be['index']=_0x57a763;}return _0x3ce5be;}function isEmail(_0x2ad5f1){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))*$/[_0xa6f5('0x17')](_0x2ad5f1);}function checkRow(_0x535958,_0x3c8a18,_0x39a84b){return new BPromise(function(_0xcb61e4,_0x1f8159){if(_[_0xa6f5('0x18')](_0x535958)){return _0x1f8159(handleCheckRowError(_0xa6f5('0x15'),_0xa6f5('0x19'),null,_0x39a84b));}if(_0x535958['errors']&&_0x535958[_0xa6f5('0x1a')][_0xa6f5('0x1b')]){var _0x596ef3=_[_0xa6f5('0x1c')](_0x535958[_0xa6f5('0x1a')],_0xa6f5('0x1d'))['join'](';');return _0x1f8159(handleCheckRowError(_0xa6f5('0x15'),_0x596ef3,null,_0x39a84b));}var _0x1c068e={};for(var _0x5d818b in FIELDS){if(FIELDS['hasOwnProperty'](_0x5d818b)&&FIELDS[_0x5d818b]){_0x1c068e[_0x5d818b]=_0x535958[_0xa6f5('0x1e')][0x0][FIELDS[_0x5d818b]]||_0x535958[_0xa6f5('0x1e')][0x0]['\ufeff'+FIELDS[_0x5d818b]];}}if(!_0x1c068e[_0xa6f5('0x1f')]){return _0x1f8159(handleCheckRowError(_0xa6f5('0x15'),'firstName\x20not\x20specified!',null,_0x39a84b));}if(!_0x1c068e['phone']){return _0x1f8159(handleCheckRowError(_0xa6f5('0x15'),_0xa6f5('0x20'),null,_0x39a84b));}if(_0x1c068e[_0xa6f5('0x21')]){var _0x3754b7=moment(_0x1c068e['birthDate'],_0xa6f5('0x22'));if(!_0x3754b7[_0xa6f5('0x23')]()){return _0x1f8159(handleCheckRowError('error',_0xa6f5('0x24'),null,_0x39a84b));}}if(_0x1c068e['email']){if(!isEmail(_0x1c068e[_0xa6f5('0x25')])){return _0x1f8159(handleCheckRowError(_0xa6f5('0x15'),_0xa6f5('0x26'),null,_0x39a84b));}}_0x1c068e[_0xa6f5('0x27')]=LISTID;_0x1c068e['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3c8a18){var _0x231fd6={};for(var _0x250676=0x0,_0x1ecb7c=DUPLICATES[_0xa6f5('0x1b')];_0x250676<_0x1ecb7c;_0x250676+=0x1){_0x231fd6[DUPLICATES[_0x250676]]=_0x1c068e[DUPLICATES[_0x250676]];}var _0xab2b19=_[_0xa6f5('0x28')](_0x3c8a18,_0x231fd6);if(_0xab2b19){return _0x1f8159(handleCheckRowError(_0xa6f5('0x29'),_0xa6f5('0x2a'),_0xab2b19,_0x39a84b));}}return db[_0xa6f5('0x2b')][_0xa6f5('0x2c')](_0x1c068e,{'raw':!![],'hooks':![],'fields':_[_0xa6f5('0x2d')](_0x1c068e)})[_0xa6f5('0x2e')](function(_0x2490f0){if(DUPLICATES&&DUPLICATES[_0xa6f5('0x1b')]&&_0x3c8a18){_0x3c8a18[_0xa6f5('0x2f')](_['pick'](_0x1c068e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2490f0['id'];return _0xcb61e4();})[_0xa6f5('0x30')](function(_0x23ef37){return _0x1f8159(handleCheckRowError('error',_0xa6f5('0x31')+(_0x23ef37[_0xa6f5('0x1d')]||JSON[_0xa6f5('0x32')](_0x23ef37)),null,_0x39a84b));});});}function checkHopper(){function _0x10ab07(){return function(_0x5a2e99){logger[_0xa6f5('0x15')]('cmContact','checkHopper',util[_0xa6f5('0x33')](_0x5a2e99,{'showHidden':![],'depth':null}));};}var _0x244586=function(_0x352420,_0x758f26){var _0x115d8d=squel['insert']()['into']('cm_hopper')[_0xa6f5('0x34')](['phone',_0xa6f5('0x35'),_0xa6f5('0x36'),'ListId',_0x758f26,_0xa6f5('0x37'),'updatedAt'],squel[_0xa6f5('0x38')]()['field']('phone',_0xa6f5('0x39'))[_0xa6f5('0x3a')]('NOW()',_0xa6f5('0x35'))[_0xa6f5('0x3a')]('id',_0xa6f5('0x36'))['field'](LISTID['toString'](),_0xa6f5('0x27'))['field'](_0x352420['id'][_0xa6f5('0x3b')](),_0x758f26)['field'](_0xa6f5('0x3c'),_0xa6f5('0x37'))['field'](_0xa6f5('0x3c'),_0xa6f5('0x3d'))['from'](_0xa6f5('0x3e'))[_0xa6f5('0x3f')](_0xa6f5('0x40'))[_0xa6f5('0x3f')](_0xa6f5('0x41'),LISTID[_0xa6f5('0x3b')]())[_0xa6f5('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa6f5('0x38')]()[_0xa6f5('0x3a')](_0xa6f5('0x39'))[_0xa6f5('0x42')](_0xa6f5('0x43'))[_0xa6f5('0x3f')](_0x758f26+_0xa6f5('0x44'),_0x352420['id'][_0xa6f5('0x3b')]())))[_0xa6f5('0x3b')]();return _0x115d8d;};var _0x1c1a93=function(_0x570262,_0x5aac81){var _0x411bbd=squel[_0xa6f5('0x45')]()[_0xa6f5('0x46')](_0xa6f5('0x43'))['fromQuery']([_0xa6f5('0x39'),'scheduledAt',_0xa6f5('0x36'),_0xa6f5('0x27'),_0x5aac81,_0xa6f5('0x37'),_0xa6f5('0x3d')],squel[_0xa6f5('0x38')]()[_0xa6f5('0x3a')](_0xa6f5('0x39'),_0xa6f5('0x39'))[_0xa6f5('0x3a')](_0xa6f5('0x3c'),_0xa6f5('0x35'))[_0xa6f5('0x3a')]('id','ContactId')[_0xa6f5('0x3a')](LISTID[_0xa6f5('0x3b')](),_0xa6f5('0x27'))[_0xa6f5('0x3a')](_0x570262['id'][_0xa6f5('0x3b')](),_0x5aac81)[_0xa6f5('0x3a')](_0xa6f5('0x3c'),_0xa6f5('0x37'))[_0xa6f5('0x3a')](_0xa6f5('0x3c'),'updatedAt')['from'](_0xa6f5('0x3e'))[_0xa6f5('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa6f5('0x3f')]('ListId\x20=\x20?',LISTID[_0xa6f5('0x3b')]())[_0xa6f5('0x3f')](_0xa6f5('0x47'),squel[_0xa6f5('0x48')](hopperContacts))[_0xa6f5('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xa6f5('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa6f5('0x3a')](_0xa6f5('0x49'))[_0xa6f5('0x42')](_0xa6f5('0x4a'))[_0xa6f5('0x3f')](_0x5aac81+_0xa6f5('0x44'),_0x570262['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa6f5('0x38')]()['field'](_0xa6f5('0x39'))['from'](_0xa6f5('0x43'))[_0xa6f5('0x3f')](_0x5aac81+_0xa6f5('0x44'),_0x570262['id']['toString']())))[_0xa6f5('0x3b')]();return _0x411bbd;};function _0x4fbf14(_0x7729f,_0x588775){var _0x503337=squel['insert']()[_0xa6f5('0x46')](_0xa6f5('0x43'))[_0xa6f5('0x34')]([_0xa6f5('0x39'),'scheduledAt',_0xa6f5('0x36'),_0xa6f5('0x27'),_0x588775,'createdAt','updatedAt'],squel[_0xa6f5('0x38')]()[_0xa6f5('0x3a')]('phone',_0xa6f5('0x39'))[_0xa6f5('0x3a')](_0xa6f5('0x3c'),_0xa6f5('0x35'))[_0xa6f5('0x3a')]('id',_0xa6f5('0x36'))[_0xa6f5('0x3a')](LISTID[_0xa6f5('0x3b')](),_0xa6f5('0x27'))[_0xa6f5('0x3a')](_0x7729f['id'][_0xa6f5('0x3b')](),_0x588775)[_0xa6f5('0x3a')]('NOW()',_0xa6f5('0x37'))['field'](_0xa6f5('0x3c'),_0xa6f5('0x3d'))['from']('cm_contacts')[_0xa6f5('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa6f5('0x3f')](_0xa6f5('0x41'),LISTID[_0xa6f5('0x3b')]())[_0xa6f5('0x3f')]('id\x20IN\x20?',squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xa6f5('0x3b')]();return _0x503337;}function _0x3446b1(_0x4740ef,_0x46ba64){var _0x351c29=squel[_0xa6f5('0x45')]()[_0xa6f5('0x46')](_0xa6f5('0x4b'))[_0xa6f5('0x34')]([_0xa6f5('0x39'),_0xa6f5('0x36'),_0xa6f5('0x27'),_0x46ba64,'createdAt',_0xa6f5('0x3d')],squel[_0xa6f5('0x38')]()['field'](_0xa6f5('0x39'),_0xa6f5('0x39'))['field']('id',_0xa6f5('0x36'))[_0xa6f5('0x3a')](LISTID[_0xa6f5('0x3b')](),_0xa6f5('0x27'))[_0xa6f5('0x3a')](_0x4740ef['id'][_0xa6f5('0x3b')](),_0x46ba64)[_0xa6f5('0x3a')]('NOW()',_0xa6f5('0x37'))[_0xa6f5('0x3a')](_0xa6f5('0x3c'),'updatedAt')['from']('cm_contacts')['where'](_0xa6f5('0x40'))[_0xa6f5('0x3f')](_0xa6f5('0x41'),LISTID[_0xa6f5('0x3b')]())[_0xa6f5('0x3f')](_0xa6f5('0x47'),squel[_0xa6f5('0x48')](hopperContacts))[_0xa6f5('0x3f')](_0xa6f5('0x4c')))[_0xa6f5('0x3b')]();return _0x351c29;}return db['VoiceQueue'][_0xa6f5('0x4d')]({'where':{'type':_0xa6f5('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa6f5('0x4f')],'as':_0xa6f5('0x50'),'where':{'id':LISTID}}]})[_0xa6f5('0x2e')](function(_0x21778a){var _0x42c8ca=[];if(_0x21778a){var _0x20bdef;for(var _0x449e84=0x0,_0x506c57;_0x449e84<_0x21778a[_0xa6f5('0x1b')];_0x449e84+=0x1){_0x506c57=_0x21778a[_0x449e84][_0xa6f5('0x51')]({'plain':!![]});switch(_0x506c57[_0xa6f5('0x52')]){case _0xa6f5('0x53'):_0x42c8ca[_0xa6f5('0x2f')](db[_0xa6f5('0x54')]['query'](_0x1c1a93(_0x506c57,_0xa6f5('0x55')))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));break;case _0xa6f5('0x56'):_0x42c8ca[_0xa6f5('0x2f')](db[_0xa6f5('0x54')]['query'](_0x244586(_0x506c57,_0xa6f5('0x55')))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));break;default:_0x42c8ca[_0xa6f5('0x2f')](db['sequelize']['query'](_0x4fbf14(_0x506c57,_0xa6f5('0x55')))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));}}}return _0x42c8ca;})[_0xa6f5('0x57')]()[_0xa6f5('0x2e')](function(){return db[_0xa6f5('0x58')][_0xa6f5('0x4d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa6f5('0x4f')],'as':_0xa6f5('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x525660){var _0x5c3751=[];if(_0x525660){var _0xb5846b;for(var _0x34f02b=0x0,_0x58cd19;_0x34f02b<_0x525660[_0xa6f5('0x1b')];_0x34f02b+=0x1){_0x58cd19=_0x525660[_0x34f02b][_0xa6f5('0x51')]({'plain':!![]});_0x5c3751['push'](db['sequelize'][_0xa6f5('0x5a')](_0x3446b1(_0x58cd19,_0xa6f5('0x55')))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));}}return _0x5c3751;})[_0xa6f5('0x57')]();})['then'](function(){return db[_0xa6f5('0x5b')][_0xa6f5('0x4d')]({'attributes':['id',_0xa6f5('0x52')],'include':[{'model':db[_0xa6f5('0x4f')],'as':_0xa6f5('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x4e7806){var _0x2c5ee4=[];if(_0x4e7806){for(var _0x2e17d5=0x0,_0xa3371;_0x2e17d5<_0x4e7806[_0xa6f5('0x1b')];_0x2e17d5+=0x1){_0xa3371=_0x4e7806[_0x2e17d5][_0xa6f5('0x51')]({'plain':!![]});switch(_0xa3371[_0xa6f5('0x52')]){case _0xa6f5('0x53'):_0x2c5ee4[_0xa6f5('0x2f')](db[_0xa6f5('0x54')]['query'](_0x1c1a93(_0xa3371,_0xa6f5('0x5c')))['then'](function(){})[_0xa6f5('0x30')](_0x10ab07()));break;case'onlyIfOpen':_0x2c5ee4['push'](db[_0xa6f5('0x54')]['query'](_0x244586(_0xa3371,_0xa6f5('0x5c')))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));break;default:_0x2c5ee4[_0xa6f5('0x2f')](db[_0xa6f5('0x54')]['query'](_0x4fbf14(_0xa3371,'CampaignId'))[_0xa6f5('0x2e')](function(){})[_0xa6f5('0x30')](_0x10ab07()));}}}return _0x2c5ee4;})[_0xa6f5('0x57')]();})[_0xa6f5('0x2e')](function(){return db[_0xa6f5('0x5b')][_0xa6f5('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa6f5('0x59'),'where':{'id':LISTID}}]})[_0xa6f5('0x2e')](function(_0x2e0a60){var _0x187f04=[];if(_0x2e0a60){for(var _0xd3eb90=0x0,_0x21d2db;_0xd3eb90<_0x2e0a60[_0xa6f5('0x1b')];_0xd3eb90+=0x1){_0x21d2db=_0x2e0a60[_0xd3eb90]['get']({'plain':!![]});_0x187f04[_0xa6f5('0x2f')](db[_0xa6f5('0x54')][_0xa6f5('0x5a')](_0x3446b1(_0x21d2db,'CampaignId'))[_0xa6f5('0x2e')](function(){})['catch'](_0x10ab07()));}}return _0x187f04;})[_0xa6f5('0x57')]();})[_0xa6f5('0x30')](function(_0x3c6781){logger[_0xa6f5('0x15')](_0xa6f5('0x5d'),_0xa6f5('0x5e'),_0x3c6781[_0xa6f5('0x1d')]);});}var processPromises=function(_0x4dccbd){return BPromise['all'](promises)[_0xa6f5('0x2e')](function(_0x2560f7){})[_0xa6f5('0x30')](function(_0x38123b){logger[_0xa6f5('0x15')](_0xa6f5('0x5f'),JSON[_0xa6f5('0x32')](_0x38123b));})[_0xa6f5('0x60')](function(){socket['emit'](_0xa6f5('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4dccbd){return _0x4dccbd[_0xa6f5('0x62')]();}});};var endCsv=function(){return BPromise[_0xa6f5('0x63')]()[_0xa6f5('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0xa6f5('0x2e')](function(){socket['emit'](_0xa6f5('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xedbd7f){logger[_0xa6f5('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xa6f5('0x32')](_0xedbd7f));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xa6f5('0x64')](_0xa6f5('0x65'));endCsv();});function main(){return BPromise[_0xa6f5('0x63')]()[_0xa6f5('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa6f5('0x2b')][_0xa6f5('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1c07e4){var _0x1bfd27=fs[_0xa6f5('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa6f5('0x67')](_0x1bfd27,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd24f3a,_0x8b5ed1){total+=0x1;var _0x3a8282=total;promises[_0xa6f5('0x2f')](checkRow(_0xd24f3a,_0x1c07e4,_0x3a8282)[_0xa6f5('0x2e')](function(){success+=0x1;})[_0xa6f5('0x30')](function(_0x4b4201){if(_0x4b4201[_0xa6f5('0x15')]){errors+=0x1;delete _0x4b4201[_0xa6f5('0x15')];}else if(_0x4b4201['duplicate']){duplicates+=0x1;delete _0x4b4201[_0xa6f5('0x29')];}rows[_0xa6f5('0x2f')](_0x4b4201);}));if(total%0xc8===0x0){_0x8b5ed1[_0xa6f5('0x68')]();return processPromises(_0x8b5ed1);}},'complete':function(){return processPromises()[_0xa6f5('0x2e')](function(){logger[_0xa6f5('0x64')](_0xa6f5('0x69'));endCsv();});},'error':function(_0x430f5f,_0x466ba7){logger['info'](_0xa6f5('0x6a'),JSON[_0xa6f5('0x32')](_0x430f5f));endCsv();}});})[_0xa6f5('0x30')](function(_0xb39ee3){logger['error'](_0xa6f5('0x6b'),JSON[_0xa6f5('0x32')](_0xb39ee3));});}main(); \ No newline at end of file +var _0xbadc=['Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','push','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync'];(function(_0x2dee81,_0x58c3df){var _0xa3a214=function(_0x459326){while(--_0x459326){_0x2dee81['push'](_0x2dee81['shift']());}};_0xa3a214(++_0x58c3df);}(_0xbadc,0x1c4));var _0xcbad=function(_0x52ac27,_0x8776c8){_0x52ac27=_0x52ac27-0x0;var _0x40732e=_0xbadc[_0x52ac27];return _0x40732e;};'use strict';var BPromise=require('bluebird');var util=require(_0xcbad('0x0'));var _=require(_0xcbad('0x1'));var fs=require('fs');var squel=require(_0xcbad('0x2'));var Papa=require('papaparse');var Redis=require(_0xcbad('0x3'));var db=require(_0xcbad('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xcbad('0x5'))(_0xcbad('0x6'));config[_0xcbad('0x7')]=_[_0xcbad('0x8')](config['redis'],{'host':_0xcbad('0x9'),'port':0x18eb});var socket=require(_0xcbad('0xa'))(new Redis(config[_0xcbad('0x7')]));require(_0xcbad('0xb'))['register'](socket);try{if(!process[_0xcbad('0xc')][0x2]||process['argv'][0x2]==='undefined'||process[_0xcbad('0xc')][0x2]===_0xcbad('0xd')){throw new Error(_0xcbad('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xcbad('0xc')][0x3]||process[_0xcbad('0xc')][0x3]==='undefined'||process[_0xcbad('0xc')][0x3]===_0xcbad('0xd')||!process[_0xcbad('0xc')][0x4]||process[_0xcbad('0xc')][0x4]===_0xcbad('0xf')||process[_0xcbad('0xc')][0x4]===_0xcbad('0xd')){throw new Error(_0xcbad('0x10'));}var FIELDS=_[_0xcbad('0x11')](process[_0xcbad('0xc')][0x3][_0xcbad('0x12')](','),process[_0xcbad('0xc')][0x4][_0xcbad('0x12')](','));if(!process[_0xcbad('0xc')][0x5]||process[_0xcbad('0xc')][0x5]==='undefined'||process[_0xcbad('0xc')][0x5]===_0xcbad('0xd')){throw new Error(_0xcbad('0x13'));}var LISTID=process[_0xcbad('0xc')][0x5];var COMPANYID=process[_0xcbad('0xc')][0x6]&&process[_0xcbad('0xc')][0x6]!=='undefined'&&process[_0xcbad('0xc')][0x6]!==_0xcbad('0xd')?process[_0xcbad('0xc')][0x6]:null;var DUPLICATES=process[_0xcbad('0xc')][0x7]&&process[_0xcbad('0xc')][0x7]!==_0xcbad('0xf')&&process['argv'][0x7]!==_0xcbad('0xd')?process[_0xcbad('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xcbad('0xf')||process[_0xcbad('0xc')][0x8]===_0xcbad('0xd')){throw new Error(_0xcbad('0x14'));}var SOCKET_TIMESTAMP=process[_0xcbad('0xc')][0x8];}catch(_0x4c25c0){logger[_0xcbad('0x15')](_0x4c25c0);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(_0x32aa04,_0x1e4475,_0x3c241c,_0x220440){var _0x54870d={'message':_0x1e4475};_0x54870d[_0x32aa04]=!![];if(_0x3c241c){_0x54870d[_0xcbad('0x16')]=_0x3c241c;}if(_0x220440){_0x54870d[_0xcbad('0x17')]=_0x220440;}return _0x54870d;}function isEmail(_0x119122){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))*$/[_0xcbad('0x18')](_0x119122);}function checkRow(_0x555a01,_0x30497b,_0x4dba07){return new BPromise(function(_0x4daa63,_0x43ee70){if(_['isNil'](_0x555a01)){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),_0xcbad('0x19'),null,_0x4dba07));}if(_0x555a01[_0xcbad('0x1a')]&&_0x555a01[_0xcbad('0x1a')][_0xcbad('0x1b')]){var _0x3690e0=_[_0xcbad('0x1c')](_0x555a01[_0xcbad('0x1a')],_0xcbad('0x1d'))[_0xcbad('0x1e')](';');return _0x43ee70(handleCheckRowError('error',_0x3690e0,null,_0x4dba07));}var _0x5b0bbd={};for(var _0x153a1e in FIELDS){if(FIELDS[_0xcbad('0x1f')](_0x153a1e)&&FIELDS[_0x153a1e]){_0x5b0bbd[_0x153a1e]=_0x555a01[_0xcbad('0x20')][0x0][FIELDS[_0x153a1e]]||_0x555a01[_0xcbad('0x20')][0x0]['\ufeff'+FIELDS[_0x153a1e]];}}if(!_0x5b0bbd[_0xcbad('0x21')]){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),'firstName\x20not\x20specified!',null,_0x4dba07));}if(!_0x5b0bbd[_0xcbad('0x22')]){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),_0xcbad('0x23'),null,_0x4dba07));}if(_0x5b0bbd[_0xcbad('0x24')]){var _0x51a843=moment(_0x5b0bbd[_0xcbad('0x24')],'YYYY-MM-DD');if(!_0x51a843['isValid']()){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),_0xcbad('0x25'),null,_0x4dba07));}}if(_0x5b0bbd[_0xcbad('0x26')]){if(!isEmail(_0x5b0bbd[_0xcbad('0x26')])){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4dba07));}}_0x5b0bbd[_0xcbad('0x27')]=LISTID;_0x5b0bbd['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcbad('0x1b')]&&_0x30497b){var _0x44d409={};for(var _0x21da25=0x0,_0x371221=DUPLICATES['length'];_0x21da25<_0x371221;_0x21da25+=0x1){_0x44d409[DUPLICATES[_0x21da25]]=_0x5b0bbd[DUPLICATES[_0x21da25]];}var _0x404d27=_[_0xcbad('0x28')](_0x30497b,_0x44d409);if(_0x404d27){return _0x43ee70(handleCheckRowError(_0xcbad('0x29'),_0xcbad('0x2a'),_0x404d27,_0x4dba07));}}return db[_0xcbad('0x2b')]['create'](_0x5b0bbd,{'raw':!![],'hooks':![],'fields':_[_0xcbad('0x2c')](_0x5b0bbd)})[_0xcbad('0x2d')](function(_0x57cf83){if(DUPLICATES&&DUPLICATES[_0xcbad('0x1b')]&&_0x30497b){_0x30497b['push'](_[_0xcbad('0x2e')](_0x5b0bbd,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x57cf83['id'];return _0x4daa63();})[_0xcbad('0x2f')](function(_0x8df1e){return _0x43ee70(handleCheckRowError(_0xcbad('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x8df1e['message']||JSON[_0xcbad('0x30')](_0x8df1e)),null,_0x4dba07));});});}function checkHopper(){function _0x770347(){return function(_0x5f0540){logger[_0xcbad('0x15')](_0xcbad('0x31'),_0xcbad('0x32'),util[_0xcbad('0x33')](_0x5f0540,{'showHidden':![],'depth':null}));};}var _0x9973f=function(_0x4bcac8,_0x5ecd54){var _0x55985d=squel[_0xcbad('0x34')]()[_0xcbad('0x35')](_0xcbad('0x36'))[_0xcbad('0x37')]([_0xcbad('0x22'),_0xcbad('0x38'),_0xcbad('0x39'),_0xcbad('0x27'),_0x5ecd54,_0xcbad('0x3a'),_0xcbad('0x3b')],squel[_0xcbad('0x3c')]()['field'](_0xcbad('0x22'),'phone')[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x38'))[_0xcbad('0x3d')]('id','ContactId')[_0xcbad('0x3d')](LISTID['toString'](),_0xcbad('0x27'))[_0xcbad('0x3d')](_0x4bcac8['id'][_0xcbad('0x3f')](),_0x5ecd54)['field'](_0xcbad('0x3e'),_0xcbad('0x3a'))['field'](_0xcbad('0x3e'),'updatedAt')[_0xcbad('0x40')](_0xcbad('0x41'))['where'](_0xcbad('0x42'))['where'](_0xcbad('0x43'),LISTID[_0xcbad('0x3f')]())[_0xcbad('0x44')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcbad('0x3d')](_0xcbad('0x22'))[_0xcbad('0x40')](_0xcbad('0x36'))[_0xcbad('0x44')](_0x5ecd54+_0xcbad('0x45'),_0x4bcac8['id'][_0xcbad('0x3f')]())))[_0xcbad('0x3f')]();return _0x55985d;};var _0x5255f4=function(_0x2d982d,_0x308028){var _0x303c4a=squel[_0xcbad('0x34')]()[_0xcbad('0x35')](_0xcbad('0x36'))[_0xcbad('0x37')]([_0xcbad('0x22'),_0xcbad('0x38'),_0xcbad('0x39'),_0xcbad('0x27'),_0x308028,_0xcbad('0x3a'),_0xcbad('0x3b')],squel['select']()['field'](_0xcbad('0x22'),'phone')[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x38'))[_0xcbad('0x3d')]('id',_0xcbad('0x39'))[_0xcbad('0x3d')](LISTID[_0xcbad('0x3f')](),'ListId')['field'](_0x2d982d['id'][_0xcbad('0x3f')](),_0x308028)[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x3a'))[_0xcbad('0x3d')]('NOW()',_0xcbad('0x3b'))[_0xcbad('0x40')]('cm_contacts')['where'](_0xcbad('0x42'))[_0xcbad('0x44')](_0xcbad('0x43'),LISTID[_0xcbad('0x3f')]())[_0xcbad('0x44')](_0xcbad('0x46'),squel['str'](hopperContacts))[_0xcbad('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xcbad('0x44')](_0xcbad('0x47'),squel[_0xcbad('0x3c')]()[_0xcbad('0x3d')](_0xcbad('0x48'))[_0xcbad('0x40')](_0xcbad('0x49'))['where'](_0x308028+'\x20=\x20?',_0x2d982d['id'][_0xcbad('0x3f')]()))[_0xcbad('0x44')](_0xcbad('0x47'),squel[_0xcbad('0x3c')]()[_0xcbad('0x3d')]('phone')['from'](_0xcbad('0x36'))['where'](_0x308028+_0xcbad('0x45'),_0x2d982d['id']['toString']())))[_0xcbad('0x3f')]();return _0x303c4a;};function _0x3322c1(_0x54303f,_0x3ba18e){var _0xfc705=squel[_0xcbad('0x34')]()[_0xcbad('0x35')](_0xcbad('0x36'))[_0xcbad('0x37')]([_0xcbad('0x22'),_0xcbad('0x38'),'ContactId',_0xcbad('0x27'),_0x3ba18e,_0xcbad('0x3a'),_0xcbad('0x3b')],squel[_0xcbad('0x3c')]()[_0xcbad('0x3d')](_0xcbad('0x22'),'phone')[_0xcbad('0x3d')]('NOW()',_0xcbad('0x38'))[_0xcbad('0x3d')]('id',_0xcbad('0x39'))['field'](LISTID[_0xcbad('0x3f')](),'ListId')[_0xcbad('0x3d')](_0x54303f['id'][_0xcbad('0x3f')](),_0x3ba18e)[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x3a'))[_0xcbad('0x3d')]('NOW()',_0xcbad('0x3b'))['from'](_0xcbad('0x41'))[_0xcbad('0x44')](_0xcbad('0x42'))[_0xcbad('0x44')](_0xcbad('0x43'),LISTID[_0xcbad('0x3f')]())[_0xcbad('0x44')](_0xcbad('0x46'),squel[_0xcbad('0x4a')](hopperContacts))['where'](_0xcbad('0x4b')))[_0xcbad('0x3f')]();return _0xfc705;}function _0x5dd5c0(_0x236c1e,_0x495325){var _0x284c73=squel[_0xcbad('0x34')]()['into'](_0xcbad('0x4c'))['fromQuery'](['phone',_0xcbad('0x39'),_0xcbad('0x27'),_0x495325,'createdAt','updatedAt'],squel['select']()[_0xcbad('0x3d')]('phone',_0xcbad('0x22'))[_0xcbad('0x3d')]('id',_0xcbad('0x39'))['field'](LISTID[_0xcbad('0x3f')](),'ListId')[_0xcbad('0x3d')](_0x236c1e['id']['toString'](),_0x495325)[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x3a'))[_0xcbad('0x3d')](_0xcbad('0x3e'),_0xcbad('0x3b'))[_0xcbad('0x40')](_0xcbad('0x41'))[_0xcbad('0x44')](_0xcbad('0x42'))[_0xcbad('0x44')](_0xcbad('0x43'),LISTID[_0xcbad('0x3f')]())[_0xcbad('0x44')]('id\x20IN\x20?',squel[_0xcbad('0x4a')](hopperContacts))['where'](_0xcbad('0x4b')))[_0xcbad('0x3f')]();return _0x284c73;}return db[_0xcbad('0x4d')][_0xcbad('0x4e')]({'where':{'type':_0xcbad('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xcbad('0x50')],'as':_0xcbad('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x3d0b72){var _0x4e6412=[];if(_0x3d0b72){var _0x4810ac;for(var _0x13a583=0x0,_0x2e368f;_0x13a583<_0x3d0b72[_0xcbad('0x1b')];_0x13a583+=0x1){_0x2e368f=_0x3d0b72[_0x13a583][_0xcbad('0x52')]({'plain':!![]});switch(_0x2e368f[_0xcbad('0x53')]){case _0xcbad('0x54'):_0x4e6412['push'](db[_0xcbad('0x55')][_0xcbad('0x56')](_0x5255f4(_0x2e368f,_0xcbad('0x57')))[_0xcbad('0x2d')](function(){})[_0xcbad('0x2f')](_0x770347()));break;case _0xcbad('0x58'):_0x4e6412[_0xcbad('0x59')](db[_0xcbad('0x55')][_0xcbad('0x56')](_0x9973f(_0x2e368f,_0xcbad('0x57')))['then'](function(){})[_0xcbad('0x2f')](_0x770347()));break;default:_0x4e6412['push'](db[_0xcbad('0x55')][_0xcbad('0x56')](_0x3322c1(_0x2e368f,_0xcbad('0x57')))[_0xcbad('0x2d')](function(){})['catch'](_0x770347()));}}}return _0x4e6412;})['all']()[_0xcbad('0x2d')](function(){return db[_0xcbad('0x4d')][_0xcbad('0x4e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xcbad('0x5a'),'where':{'id':LISTID}}]})[_0xcbad('0x2d')](function(_0x495cbf){var _0x146829=[];if(_0x495cbf){var _0xb77058;for(var _0x4b1676=0x0,_0x17c3a3;_0x4b1676<_0x495cbf[_0xcbad('0x1b')];_0x4b1676+=0x1){_0x17c3a3=_0x495cbf[_0x4b1676][_0xcbad('0x52')]({'plain':!![]});_0x146829[_0xcbad('0x59')](db['sequelize']['query'](_0x5dd5c0(_0x17c3a3,'VoiceQueueId'))['then'](function(){})[_0xcbad('0x2f')](_0x770347()));}}return _0x146829;})[_0xcbad('0x5b')]();})[_0xcbad('0x2d')](function(){return db[_0xcbad('0x5c')][_0xcbad('0x4e')]({'attributes':['id',_0xcbad('0x53')],'include':[{'model':db[_0xcbad('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0xcbad('0x2d')](function(_0x457a1b){var _0x2c72c6=[];if(_0x457a1b){for(var _0x5df7b2=0x0,_0x1d093b;_0x5df7b2<_0x457a1b[_0xcbad('0x1b')];_0x5df7b2+=0x1){_0x1d093b=_0x457a1b[_0x5df7b2][_0xcbad('0x52')]({'plain':!![]});switch(_0x1d093b[_0xcbad('0x53')]){case'always':_0x2c72c6[_0xcbad('0x59')](db[_0xcbad('0x55')]['query'](_0x5255f4(_0x1d093b,_0xcbad('0x5d')))[_0xcbad('0x2d')](function(){})[_0xcbad('0x2f')](_0x770347()));break;case'onlyIfOpen':_0x2c72c6[_0xcbad('0x59')](db[_0xcbad('0x55')][_0xcbad('0x56')](_0x9973f(_0x1d093b,_0xcbad('0x5d')))['then'](function(){})[_0xcbad('0x2f')](_0x770347()));break;default:_0x2c72c6[_0xcbad('0x59')](db[_0xcbad('0x55')][_0xcbad('0x56')](_0x3322c1(_0x1d093b,_0xcbad('0x5d')))[_0xcbad('0x2d')](function(){})['catch'](_0x770347()));}}}return _0x2c72c6;})[_0xcbad('0x5b')]();})[_0xcbad('0x2d')](function(){return db[_0xcbad('0x5c')][_0xcbad('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xcbad('0x50')],'as':_0xcbad('0x5a'),'where':{'id':LISTID}}]})[_0xcbad('0x2d')](function(_0x34690a){var _0xf4a4e7=[];if(_0x34690a){for(var _0x44d4dc=0x0,_0x2ea0e6;_0x44d4dc<_0x34690a[_0xcbad('0x1b')];_0x44d4dc+=0x1){_0x2ea0e6=_0x34690a[_0x44d4dc][_0xcbad('0x52')]({'plain':!![]});_0xf4a4e7[_0xcbad('0x59')](db['sequelize'][_0xcbad('0x56')](_0x5dd5c0(_0x2ea0e6,'CampaignId'))[_0xcbad('0x2d')](function(){})[_0xcbad('0x2f')](_0x770347()));}}return _0xf4a4e7;})[_0xcbad('0x5b')]();})[_0xcbad('0x2f')](function(_0x3c7644){logger[_0xcbad('0x15')](_0xcbad('0x5e'),_0xcbad('0x5f'),_0x3c7644['message']);});}var processPromises=function(_0x2db400){return BPromise[_0xcbad('0x5b')](promises)['then'](function(_0xd5912f){})['catch'](function(_0x3c092a){logger['error'](_0xcbad('0x60'),JSON['stringify'](_0x3c092a));})[_0xcbad('0x61')](function(){socket[_0xcbad('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2db400){return _0x2db400[_0xcbad('0x63')]();}});};var endCsv=function(){return BPromise[_0xcbad('0x64')]()[_0xcbad('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xcbad('0x2d')](function(){socket[_0xcbad('0x62')](_0xcbad('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcbad('0x66')](FILEPATH);}catch(_0xe61569){logger['error'](_0xcbad('0x67'),JSON[_0xcbad('0x30')](_0xe61569));}finally{process[_0xcbad('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0xcbad('0x69')](_0xcbad('0x6a'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcbad('0x12')](',');return db[_0xcbad('0x2b')][_0xcbad('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcbad('0x2d')](function(_0x811d8){var _0x3505fa=fs[_0xcbad('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcbad('0x6c')](_0x3505fa,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4278e5,_0x56bb69){total+=0x1;var _0x4abbf9=total;promises[_0xcbad('0x59')](checkRow(_0x4278e5,_0x811d8,_0x4abbf9)[_0xcbad('0x2d')](function(){success+=0x1;})['catch'](function(_0x5d66e1){if(_0x5d66e1['error']){errors+=0x1;delete _0x5d66e1[_0xcbad('0x15')];}else if(_0x5d66e1[_0xcbad('0x29')]){duplicates+=0x1;delete _0x5d66e1[_0xcbad('0x29')];}rows[_0xcbad('0x59')](_0x5d66e1);}));if(total%0xc8===0x0){_0x56bb69[_0xcbad('0x6d')]();return processPromises(_0x56bb69);}},'complete':function(){return processPromises()[_0xcbad('0x2d')](function(){logger[_0xcbad('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1bd212,_0x1fb5e3){logger['info']('CSV\x20parse\x20error',JSON[_0xcbad('0x30')](_0x1bd212));endCsv();}});})[_0xcbad('0x2f')](function(_0x2faa05){logger[_0xcbad('0x15')](_0xcbad('0x6e'),JSON[_0xcbad('0x30')](_0x2faa05));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f615f05..d84eb81 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 _0x7f44=['redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','phone','updatedAt','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','recallme','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','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=','dialTimezone','offset','set','main','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','name','_description','writeFileSync','createReadStream','data','rows','errors','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','utcOffset','firstName','\x20not\x20specified','replace','description','appendFileSync','contact:import:','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import'];(function(_0x2fac5f,_0x13af80){var _0x1b7572=function(_0x666bb5){while(--_0x666bb5){_0x2fac5f['push'](_0x2fac5f['shift']());}};_0x1b7572(++_0x13af80);}(_0x7f44,0x15f));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x47f4('0x0'));var _=require(_0x47f4('0x1'));var Papa=require(_0x47f4('0x2'));var util=require('util');var BPromise=require(_0x47f4('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x47f4('0x4'))['db'];var config=require(_0x47f4('0x5'));var shared=require(_0x47f4('0x6'));var logger=require(_0x47f4('0x7'))(_0x47f4('0x8'));config[_0x47f4('0x9')]=_['defaults'](config[_0x47f4('0x9')],{'host':_0x47f4('0xa'),'port':0x18eb});var socket=require(_0x47f4('0xb'))(new Redis(config[_0x47f4('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x47f4('0xc')](_0x47f4('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x47f4('0xc')](_0x47f4('0xd'));function isEmail(_0x344eb5){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'](_0x344eb5);}function selectNotIn(_0x1fe7a3,_0x21849e,_0x9f13be,_0x3d1873,_0x4454c1){return squel[_0x47f4('0xe')]()[_0x47f4('0xf')]('phone')[_0x47f4('0x10')](_0x3d1873)[_0x47f4('0x11')](_0x21849e,null,_0x21849e+_0x47f4('0x12')+_0x3d1873+'.'+_0x9f13be)[_0x47f4('0x13')](_0x3d1873+'.'+_0x9f13be+_0x47f4('0x14')+_0x1fe7a3+'.'+_0x9f13be)[_0x47f4('0x13')](_0x21849e+_0x47f4('0x15')+_0x4454c1[_0x47f4('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c34a2,_0x29328e){promisesAdditionalPhones=[];return db[_0x47f4('0x16')][_0x47f4('0x17')]({'raw':!![],'attributes':['id',_0x47f4('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x47f4('0x19')](function(_0x45fae2){if(_0x45fae2!==null){var _0x3247cf=[];for(var _0x2efb18=0x0;_0x2efb18<_0x45fae2[_0x47f4('0x1a')];_0x2efb18++){var _0xa06bbd=_0x45fae2[_0x2efb18];_0x3247cf[_0x47f4('0x1b')](insertAdditionalPhones(_0xa06bbd));}}Promise[_0x47f4('0x1c')](_0x3247cf)[_0x47f4('0x19')](function(){_0x1c34a2({'val':0x1});});});});}function insertAdditionalPhones(_0xc0564d){return new Promise(function(_0x5a5217,_0xfc02d){var _0x1bfdbe=_0xc0564d[_0x47f4('0x18')];var _0x8b1ea3=_0x1bfdbe[_0x47f4('0x1d')](';');var _0x25cbc1=[];orderBy=0x0;for(var _0x430b9d=0x0;_0x430b9d<_0x8b1ea3[_0x47f4('0x1a')];_0x430b9d++){_0x25cbc1[_0x47f4('0x1b')](splitAdditionalPhone(_0xc0564d['id'],_0x8b1ea3[_0x430b9d]));}Promise[_0x47f4('0x1c')](_0x25cbc1)[_0x47f4('0x19')](function(){_0x5a5217({'val':_0x8b1ea3[_0x47f4('0x1a')]});});});}function splitAdditionalPhone(_0x4143ff,_0x4fe48a){return new Promise(function(_0x4f7a98,_0x231749){var _0x3a7ee7=_0x4fe48a[_0x47f4('0x1d')](':');var _0x534ec4=_0x3a7ee7[0x0];var _0x1f1ae2=_0x3a7ee7[0x1];if(!_[_0x47f4('0x1e')](_0x1f1ae2)){var _0x455507=_0x1f1ae2[_0x47f4('0x1d')]('|');var _0x43f291=[];for(var _0x57891d=0x0;_0x57891d<_0x455507['length'];_0x57891d++){if(_0x455507[_0x57891d]!==''){var _0x2972af=_[_0x47f4('0x1f')](promisesAdditionalPhones,{'contactId':_0x4143ff,'phone':_0x455507[_0x57891d]});if(_0x2972af[_0x47f4('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4143ff,'contactTypeId':_0x534ec4,'phone':_0x455507[_0x57891d],'orderBy':orderBy});}}}_0x4f7a98({'ok':0x1});}else _0x4f7a98({'res':0x0});});}function createAdditionalPhone(_0x34169e,_0x5ddd98,_0x18a351,_0x2ea693){var _0x2f83d3='';var _0x2b59e6='';var _0xa96f0=_0x18a351[_0x47f4('0x1d')]('§');_0x2f83d3=_0xa96f0[0x0];if(_0xa96f0[_0x47f4('0x1a')]==0x2)_0x2b59e6=_0xa96f0[0x1];return new Promise(function(_0x2c95fd,_0x496c54){return db[_0x47f4('0x20')][_0x47f4('0x21')]({'where':{'CmContactId':_0x34169e,'item':_0x2f83d3}})[_0x47f4('0x19')](function(_0x2ead95){if(_0x2ead95){return db['CmContactHasItem'][_0x47f4('0x22')]({'ItemTypeId':_0x5ddd98,'description':_0x2b59e6,'OrderBy':_0x2ea693},{'where':{'CmContactId':_0x34169e,'item':_0x2f83d3}})[_0x47f4('0x19')](function(_0x3237f9){_0x2c95fd({'res':_0x47f4('0x23')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x34169e,'item':_0x2f83d3,'description':_0x2b59e6,'ItemTypeId':_0x5ddd98,'OrderBy':_0x2ea693,'ItemClass':'PHONE'})[_0x47f4('0x19')](function(_0x529d76){_0x2c95fd({'res':'inserted'});});}});});}function insertCmHopper(_0x457a0c,_0x231363,_0x5c3049,_0x7eda22,_0x592d36){var _0x3ca90a=[_0x47f4('0x24'),'cm_contacts.scheduledat',_0x47f4('0x25'),_0x47f4('0x26'),_0x231363+'.'+_0x7eda22,_0x47f4('0x27'),_0x47f4('0x28'),_0x47f4('0x29'),_0x47f4('0x2a'),'\x22'+_0x592d36+'\x22'];return squel[_0x47f4('0x2b')]()[_0x47f4('0x2c')]('cm_hopper')[_0x47f4('0x2d')](['phone','scheduledat',_0x47f4('0x2e'),_0x47f4('0x2f'),_0x7eda22,_0x47f4('0x30'),'updatedAt',_0x47f4('0x31'),_0x47f4('0x32'),'recallme'],squel[_0x47f4('0xe')]()[_0x47f4('0x33')](_0x3ca90a)['from'](_0x231363)['join'](_0x47f4('0x34'),null,_0x47f4('0x35')+_0x231363+_0x47f4('0x36'))[_0x47f4('0x11')](_0x5c3049,null,_0x5c3049+_0x47f4('0x12')+_0x231363+'.'+_0x7eda22)[_0x47f4('0x13')](_0x231363+_0x47f4('0x37'),_0x457a0c)['where'](_0x47f4('0x38'),NOW)[_0x47f4('0x13')](_0x47f4('0x39'),selectNotIn(_0x231363,_0x5c3049,_0x7eda22,_0x47f4('0x3a'),[_0x47f4('0x3b'),_0x47f4('0x3c')]))[_0x47f4('0x13')](_0x47f4('0x39'),selectNotIn(_0x231363,_0x5c3049,_0x7eda22,'cm_hopper',[_0x47f4('0x3b')])))['toString']();}function insertCmHopperBlack(_0x2350c7,_0x3bc1a2,_0x98f7a7,_0x737c98){var _0x3cec5e=['cm_contacts.phone',_0x47f4('0x25'),_0x47f4('0x26'),_0x3bc1a2+'.'+_0x737c98,_0x47f4('0x27'),_0x47f4('0x28')];return squel[_0x47f4('0x2b')]()[_0x47f4('0x2c')](_0x47f4('0x3d'))[_0x47f4('0x2d')]([_0x47f4('0x3e'),_0x47f4('0x2e'),_0x47f4('0x2f'),_0x737c98,'createdAt',_0x47f4('0x3f')],squel[_0x47f4('0xe')]()[_0x47f4('0x33')](_0x3cec5e)['from'](_0x3bc1a2)[_0x47f4('0x11')](_0x47f4('0x34'),null,_0x47f4('0x35')+_0x3bc1a2+'.CmListId')[_0x47f4('0x11')](_0x98f7a7,null,_0x98f7a7+'.id\x20=\x20'+_0x3bc1a2+'.'+_0x737c98)[_0x47f4('0x13')](_0x3bc1a2+_0x47f4('0x37'),_0x2350c7)[_0x47f4('0x13')](_0x47f4('0x38'),NOW)[_0x47f4('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x47f4('0xe')]()['field'](_0x47f4('0x3e'))['from'](_0x47f4('0x3d'))['where'](_0x47f4('0x40'),_0x2350c7)['where'](_0x737c98+_0x47f4('0x14')+_0x3bc1a2+'.'+_0x737c98)))[_0x47f4('0x41')]();}function insertTzCmHopper(_0x2f3694,_0x5ca444,_0x26793c,_0x50122e,_0x6a2e77,_0x24038b){var _0x38f237=[_0x47f4('0x24'),_0x47f4('0x42')+_0x24038b+_0x47f4('0x43'),'cm_contacts.id','cm_contacts.ListId',_0x5ca444+'.'+_0x50122e,_0x47f4('0x27'),_0x47f4('0x28'),_0x47f4('0x29'),_0x47f4('0x2a'),'\x22'+_0x6a2e77+'\x22'];var _0x4783b3=squel['insert']()[_0x47f4('0x2c')]('cm_hopper')[_0x47f4('0x2d')]([_0x47f4('0x3e'),_0x47f4('0x44'),'ContactId',_0x47f4('0x2f'),_0x50122e,_0x47f4('0x30'),_0x47f4('0x3f'),_0x47f4('0x31'),_0x47f4('0x32'),_0x47f4('0x45')],squel[_0x47f4('0xe')]()['fields'](_0x38f237)[_0x47f4('0x10')](_0x5ca444)[_0x47f4('0x11')](_0x47f4('0x34'),null,_0x47f4('0x35')+_0x5ca444+'.CmListId')['join'](_0x26793c,null,_0x26793c+'.id\x20=\x20'+_0x5ca444+'.'+_0x50122e)[_0x47f4('0x11')](_0x24038b,null,_0x24038b+'.id\x20=\x20'+_0x5ca444+'.'+_0x50122e)[_0x47f4('0x13')](_0x5ca444+_0x47f4('0x37'),_0x2f3694)[_0x47f4('0x13')](_0x47f4('0x38'),NOW)[_0x47f4('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5ca444,_0x26793c,_0x50122e,_0x47f4('0x3a'),[_0x47f4('0x3b'),_0x47f4('0x3c')]))[_0x47f4('0x13')](_0x47f4('0x39'),selectNotIn(_0x5ca444,_0x26793c,_0x50122e,_0x47f4('0x3a'),[_0x47f4('0x3b')])))[_0x47f4('0x41')]();return _0x4783b3;}function insertTzCmHopperBlack(_0x4d8e68,_0x17f4ec,_0x372a59,_0x191e12){var _0x134f2d=[_0x47f4('0x24'),_0x47f4('0x25'),'cm_contacts.ListId',_0x17f4ec+'.'+_0x191e12,_0x47f4('0x27'),_0x47f4('0x28')];return squel[_0x47f4('0x2b')]()[_0x47f4('0x2c')](_0x47f4('0x3d'))[_0x47f4('0x2d')]([_0x47f4('0x3e'),'ContactId','ListId',_0x191e12,_0x47f4('0x30'),_0x47f4('0x3f')],squel[_0x47f4('0xe')]()['fields'](_0x134f2d)['from'](_0x17f4ec)[_0x47f4('0x11')](_0x47f4('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x17f4ec+_0x47f4('0x36'))['join'](_0x372a59,null,_0x372a59+'.id\x20=\x20'+_0x17f4ec+'.'+_0x191e12)[_0x47f4('0x13')](_0x17f4ec+_0x47f4('0x37'),_0x4d8e68)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47f4('0x13')](_0x47f4('0x39'),squel[_0x47f4('0xe')]()['field'](_0x47f4('0x3e'))[_0x47f4('0x10')](_0x47f4('0x3d'))[_0x47f4('0x13')](_0x47f4('0x40'),_0x4d8e68)['where'](_0x191e12+_0x47f4('0x14')+_0x17f4ec+'.'+_0x191e12)))[_0x47f4('0x41')]();}function insertCmHopperAdditionalPhones(_0x5dfb3c){var _0x463890=[_0x47f4('0x46'),'cm_contact_has_items.item',_0x47f4('0x47'),_0x47f4('0x48'),'cm_contact_has_items.updatedAt'];return squel[_0x47f4('0x2b')]()[_0x47f4('0x2c')](_0x47f4('0x49'))[_0x47f4('0x2d')]([_0x47f4('0x4a'),_0x47f4('0x3e'),_0x47f4('0x4b'),_0x47f4('0x30'),_0x47f4('0x3f')],squel['select']()[_0x47f4('0x33')](_0x463890)[_0x47f4('0x10')](_0x47f4('0x3a'))['join'](_0x47f4('0x34'),null,_0x47f4('0x4c'))[_0x47f4('0x11')](_0x47f4('0x4d'),null,_0x47f4('0x4e'))[_0x47f4('0x13')]('cm_hopper.ListId\x20=\x20?',_0x5dfb3c)[_0x47f4('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x42f306,_0x7dba0d,_0x2f0593,_0x217643){var _0x27eca5=_['concat'](_[_0x47f4('0x4f')](_0x217643),[_0x47f4('0x2f'),_0x47f4('0x50'),'createdAt','updatedAt',_0x47f4('0x51')]);return squel['insert']()[_0x47f4('0x2c')](_0x47f4('0x34'))[_0x47f4('0x2d')](_0x27eca5,squel[_0x47f4('0xe')]()[_0x47f4('0x33')](_0x27eca5)['from'](_0x7dba0d)[_0x47f4('0x13')]('('+_0x2f0593['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x47f4('0xe')]()[_0x47f4('0x33')](_0x2f0593)[_0x47f4('0x10')](_0x47f4('0x34'))[_0x47f4('0x13')](_0x47f4('0x40'),_0x42f306)[_0x47f4('0x13')](_0x47f4('0x52')))[_0x47f4('0x13')]('id\x20IN\x20?',squel[_0x47f4('0xe')]()[_0x47f4('0xf')](_0x47f4('0x53'),_0x47f4('0x54'))[_0x47f4('0x10')](_0x7dba0d)[_0x47f4('0x55')](_0x2f0593[_0x47f4('0x11')](','))))[_0x47f4('0x41')]();}function handleStop(){logger[_0x47f4('0x56')](_0x47f4('0x57'));stopped=!![];}function handleUncaughtException(_0x17a3be){logger[_0x47f4('0x58')](_0x17a3be[_0x47f4('0x59')]);process[_0x47f4('0x5a')](0x1);}function handleError(_0x5a52c6,_0x3bc066){stats['errors']['push']({'name':_0x3bc066[_0x47f4('0x5b')],'message':_0x3bc066[_0x47f4('0x59')],'row':_0x5a52c6});}function handleQuery(_0x11e6fc){logger['info'](_0x11e6fc);return db['sequelize'][_0x47f4('0x5c')](_0x11e6fc)[_0x47f4('0x5d')](function(_0x41f857){results['push'](_0x41f857);})[_0x47f4('0x5e')](function(_0x437faa){logger['error'](_0x437faa['message']);});}function updateTzCampaigns(_0x3020ce){return new Promise(function(_0x30962f,_0x268777){var _0x52993e=squel['select']()[_0x47f4('0x33')]([_0x47f4('0x5f'),_0x47f4('0x60')])[_0x47f4('0x10')](_0x47f4('0x61'))[_0x47f4('0x11')](_0x47f4('0x62'),null,_0x47f4('0x63'))[_0x47f4('0x13')]('campaigns_has_cm_lists.CmListId='+_0x3020ce);db[_0x47f4('0x64')][_0x47f4('0x5c')](_0x52993e[_0x47f4('0x41')]())['spread'](function(_0x4fe9e8){var _0x1233e9=[];for(var _0x391bbb=0x0;_0x391bbb<_0x4fe9e8['length'];_0x391bbb++){_0x1233e9[_0x47f4('0x1b')](getTimezoneData(_0x4fe9e8[_0x391bbb],tmp_campaigns));}BPromise[_0x47f4('0x1c')](_0x1233e9)[_0x47f4('0x19')](function(){_0x30962f({'val':0x1});});})[_0x47f4('0x5e')](function(_0x5f2d00){logger[_0x47f4('0x58')](_0x5f2d00[_0x47f4('0x59')]);_0x30962f({'val':0x0});});});}function updateTzVoiceQueues(_0x457b21){return new Promise(function(_0xaaa21a,_0x281d17){var _0x241d12=squel[_0x47f4('0xe')]()[_0x47f4('0x33')]([_0x47f4('0x65'),_0x47f4('0x66')])[_0x47f4('0x10')](_0x47f4('0x67'))['join'](_0x47f4('0x68'),null,_0x47f4('0x69'))[_0x47f4('0x13')](_0x47f4('0x6a')+_0x457b21);db[_0x47f4('0x64')][_0x47f4('0x5c')](_0x241d12[_0x47f4('0x41')]())[_0x47f4('0x5d')](function(_0x6b2b06){var _0x54b144=[];for(var _0x4c3959=0x0;_0x4c3959<_0x6b2b06[_0x47f4('0x1a')];_0x4c3959++){_0x54b144[_0x47f4('0x1b')](getTimezoneData(_0x6b2b06[_0x4c3959],tmp_voice_queues));}BPromise[_0x47f4('0x1c')](_0x54b144)[_0x47f4('0x19')](function(){_0xaaa21a({'val':0x1});});})[_0x47f4('0x5e')](function(_0x33e80a){logger[_0x47f4('0x58')](_0x33e80a[_0x47f4('0x59')]);_0xaaa21a({'val':0x0});});});}function getTimezoneData(_0x770cf4,_0x41f4b2){return new Promise(function(_0x4193dd,_0x26d0f2){var _0x6b4783=shared['timezones'];var _0xeb886e=_0x6b4783[_0x770cf4[_0x47f4('0x6b')]];if(_[_0x47f4('0x1e')](_0xeb886e)){_0x4193dd({'ret':0x1});}else{var _0x3e39eb=_0xeb886e['utcOffset'];var _0x3d3ecf=squel[_0x47f4('0x2b')]()[_0x47f4('0x2c')](_0x41f4b2)['set']('id',_0x770cf4['id'])['set'](_0x47f4('0x6c'),_0x3e39eb)[_0x47f4('0x6d')](_0x47f4('0x6b'),_0x770cf4[_0x47f4('0x6b')])[_0x47f4('0x41')]();return db[_0x47f4('0x64')][_0x47f4('0x5c')](_0x3d3ecf)[_0x47f4('0x5d')](function(_0x103dd3){_0x4193dd({'ret':0x1});})[_0x47f4('0x5e')](function(_0x2e4f10){logger['error'](_0x2e4f10[_0x47f4('0x59')]);_0x26d0f2({'ret':0x1});});}});}function handleTZQuery(_0x385e93){logger[_0x47f4('0x56')](_0x385e93);return db[_0x47f4('0x64')][_0x47f4('0x5c')](_0x385e93)[_0x47f4('0x5d')](function(_0x4a9f99){})[_0x47f4('0x5e')](function(_0x2190c7){logger[_0x47f4('0x58')](_0x2190c7[_0x47f4('0x59')]);});}function main(_0x413158,_0x5ac0c5,_0x4654c2,_0x28762a){logger[_0x47f4('0x56')](_0x47f4('0x6e'),_0x413158,JSON['stringify'](_0x5ac0c5));process['send'](_0x47f4('0x6f'));var _0x296875=_0x5ac0c5[_0x47f4('0x70')];var _0x1885cc=_[_0x47f4('0x71')](_0x296875);var _0x47db95=_0x5ac0c5[_0x47f4('0x72')];var _0x215a90=path[_0x47f4('0x11')](config['root'],_0x47f4('0x73'),_0x47db95+_0x47f4('0x74'));hasTZ=_[_0x47f4('0x4f')](_0x296875)[_0x47f4('0x75')](_0x47f4('0x6b'));var _0x525fe2=_[_0x47f4('0x4f')](_0x296875)[_0x47f4('0x11')]();logger[_0x47f4('0x56')](_0x47f4('0x76'),_0x525fe2);db['ContactItemType'][_0x47f4('0x17')]({'raw':!![],'attributes':['id',_0x47f4('0x77')]})[_0x47f4('0x19')](function(_0x223b04){for(var _0x24a2a2=0x0;_0x24a2a2<_0x223b04[_0x47f4('0x1a')];_0x24a2a2++){if(_0x223b04[_0x24a2a2][_0x47f4('0x77')]in _0x296875){contactItemTypes[_0x47f4('0x1b')](_0x223b04[_0x24a2a2]);delete _0x1885cc[_0x223b04[_0x24a2a2]['name']];hasAdditionalPhones=!![];}for(var _0xaa3bf6 in _0x296875){if(_0x223b04[_0x24a2a2]['name']+_0x47f4('0x78')===_0xaa3bf6){phoneDescriptions[_0x47f4('0x1b')]({'itemTypeId':_0x223b04[_0x24a2a2]['id'],'description':_0xaa3bf6});delete _0x1885cc[_0xaa3bf6];}}}if(hasAdditionalPhones)_0x1885cc[_0x47f4('0x18')]='';var _0x15a638=_[_0x47f4('0x4f')](_0x1885cc)[_0x47f4('0x11')]();logger[_0x47f4('0x56')](_0x47f4('0x76'),_0x15a638);fs[_0x47f4('0x79')](_0x215a90,_0x15a638+'\x0a');Papa['parse'](fs[_0x47f4('0x7a')](_0x413158),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e8c7b,_0x25dbfb){try{for(var _0x1f1e98=0x0,_0x428b6d=[];_0x1f1e98<_0x3e8c7b[_0x47f4('0x7b')][_0x47f4('0x1a')];_0x1f1e98++){stats[_0x47f4('0x7c')]+=0x1;if(_0x3e8c7b[_0x47f4('0x7d')][_0x1f1e98]){handleError(_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98],_0x3e8c7b['errors'][_0x1f1e98]);}else{var _0x53fbc3=[];var _0x5588e7=[];var _0x96f52c={};for(var _0x52dfa7 in _0x296875){let _0x3333bb=contactItemTypes[_0x47f4('0x7e')](_0xe15bbe=>_0xe15bbe[_0x47f4('0x77')]===_0x52dfa7);let _0x74fc64=contactItemTypes['find'](_0x3a9c8c=>_0x3a9c8c[_0x47f4('0x77')]+_0x47f4('0x78')===_0x52dfa7);if(_['isNil'](_0x3333bb)&&_[_0x47f4('0x1e')](_0x74fc64)){if(_0x296875[_0x47f4('0x7f')](_0x52dfa7)){if(_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98][_0x296875[_0x52dfa7]]){var _0x4f02af=_[_0x47f4('0x80')](_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98][_0x296875[_0x52dfa7]]['replace'](/"/g,'\x27'));switch(_0x52dfa7){case _0x47f4('0x44'):var _0x58e231=moment(_0x4f02af,_0x47f4('0xd'),!![]);if(_0x58e231[_0x47f4('0x81')]()){_0x428b6d[_0x47f4('0x1b')]('\x22'+_0x4f02af+'\x22');}else{_0x53fbc3[_0x47f4('0x1b')](_0x47f4('0x82'));}break;case _0x47f4('0x31'):var _0x113b92=parseInt(_0x4f02af);_0x4f02af=_[_0x47f4('0x83')](_0x113b92)||_0x113b92<0x0||_0x113b92>0x4?_0x28762a?0x3:0x2:_0x113b92;_0x428b6d['push']('\x22'+_0x4f02af+'\x22');break;case'UserId':var _0x4a2c22=parseInt(_0x4f02af);if(_['isNumber'](_0x4a2c22)&&_['includes'](_0x4654c2,_0x4a2c22)){_0x428b6d['push']('\x22'+_0x4a2c22+'\x22');}else{_0x53fbc3[_0x47f4('0x1b')](_0x47f4('0x84'));}break;case _0x47f4('0x85'):if(isEmail(_0x4f02af)){_0x428b6d[_0x47f4('0x1b')]('\x22'+_0x4f02af+'\x22');}else{_0x53fbc3[_0x47f4('0x1b')](_0x47f4('0x86'));}break;case _0x47f4('0x87'):var _0x5aa003=moment(_0x4f02af,_0x47f4('0x88'),!![]);if(_0x5aa003[_0x47f4('0x81')]()){_0x428b6d['push']('\x22'+_0x4f02af+'\x22');}else{_0x53fbc3['push'](_0x47f4('0x89'));}break;case _0x47f4('0x6b'):var _0x12f732=shared[_0x47f4('0x8a')];var _0x178c6c=_0x12f732[_0x4f02af];if(!_[_0x47f4('0x1e')](_0x178c6c)){var _0x5ddb8f=_0x178c6c[_0x47f4('0x8b')];_0x428b6d['push']('\x22'+_0x4f02af+'\x22');_0x428b6d[_0x47f4('0x1b')]('\x22'+_0x5ddb8f+'\x22');}break;default:_0x428b6d[_0x47f4('0x1b')]('\x22'+_0x4f02af+'\x22');}}else{switch(_0x52dfa7){case _0x47f4('0x8c'):case _0x47f4('0x3e'):_0x53fbc3[_0x47f4('0x1b')](_0x52dfa7+_0x47f4('0x8d'));break;default:_0x428b6d[_0x47f4('0x1b')]('\x22\x22');}}}}else{var _0x5c24bf='';if(!_['isNil'](_0x3333bb)){if(!_0x96f52c['hasOwnProperty'](_0x3333bb['id'])){if(!_['isNil'](_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98][_0x296875[_0x52dfa7]])){var _0x4f02af=_[_0x47f4('0x80')](_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98][_0x296875[_0x52dfa7]][_0x47f4('0x8e')](/"/g,'\x27'));var _0x5be4ab=phoneDescriptions[_0x47f4('0x7e')](_0x4c7274=>_0x4c7274['itemTypeId']===_0x3333bb['id']);if(!_[_0x47f4('0x1e')](_0x5be4ab)){var _0x3d9ad3=_['trim'](_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98][_0x296875[_0x5be4ab[_0x47f4('0x8f')]]][_0x47f4('0x8e')](/"/g,'\x27'));if(!_[_0x47f4('0x1e')](_0x3d9ad3))_0x4f02af=_0x4f02af+'§'+_0x3d9ad3;}if(_0x5c24bf=='')_0x5c24bf=_0x4f02af;else _0x5c24bf+='|'+_0x4f02af;}_0x5588e7[_0x47f4('0x1b')](_0x3333bb['id']+':'+_0x5c24bf);_0x96f52c[_0x3333bb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x428b6d[_0x47f4('0x1b')]('\x22'+_0x5588e7[_0x47f4('0x11')](';')+'\x22');}if(_0x53fbc3[_0x47f4('0x1a')]){handleError(_0x3e8c7b[_0x47f4('0x7b')][_0x1f1e98],{'code':'SystemRow','message':_0x53fbc3['join']()});}else{fs[_0x47f4('0x90')](_0x215a90,_0x428b6d[_0x47f4('0x11')]()+'\x0a');}_0x428b6d=[];}if(!(stats[_0x47f4('0x7c')]%0xc8)){socket['emit'](_0x47f4('0x91')+_0x47db95,stats);stats[_0x47f4('0x7d')]=[];}}if(stopped){logger[_0x47f4('0x56')]('Abort\x20parser');_0x25dbfb[_0x47f4('0x92')]();}}catch(_0xa56506){handleError(_0x3e8c7b['data'][_0x1f1e98],{'code':'SystemError','message':_0xa56506[_0x47f4('0x59')]});logger[_0x47f4('0x58')]('step',_0xa56506[_0x47f4('0x59')]);}},'complete':function(){try{var _0xf2d441=[];var _0x194861=[];var _0x36d254=_0x47f4('0x34');if(_0x5ac0c5[_0x47f4('0x93')]&&_0x5ac0c5[_0x47f4('0x93')][_0x47f4('0x1a')]){_0x36d254=_0x47f4('0x94')+_0x47db95;_0xf2d441[_0x47f4('0x1b')](_0x47f4('0x95')+_0x36d254+_0x47f4('0x96'));}tmp_campaigns=_0x47f4('0x97')+_0x47db95;tmp_voice_queues=_0x47f4('0x98')+_0x47db95;_0x194861['push'](_0x47f4('0x95')+tmp_campaigns+_0x47f4('0x99'));_0x194861[_0x47f4('0x1b')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x47f4('0x99'));BPromise[_0x47f4('0x9a')](_0x194861,handleTZQuery)['then'](function(_0x3e7b94){updateTzCampaigns(_0x5ac0c5[_0x47f4('0x2f')])[_0x47f4('0x19')](function(_0x4d152a){updateTzVoiceQueues(_0x5ac0c5[_0x47f4('0x2f')])[_0x47f4('0x19')](function(_0x300987){if(hasTZ)_0x15a638=_0x15a638[_0x47f4('0x8e')](_0x47f4('0x6b'),_0x47f4('0x9b'));var _0x75a721=util[_0x47f4('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x215a90,_0x36d254,_0x15a638,_0x5ac0c5[_0x47f4('0x2f')],_0x5ac0c5[_0x47f4('0x50')]||null,NOW,NOW);if(_[_0x47f4('0x1e')](_0x296875[_0x47f4('0x44')])){_0x75a721+=',\x20scheduledAt\x20=\x20NOW()';}_0xf2d441['push'](_0x75a721);if(_0x5ac0c5[_0x47f4('0x93')]&&_0x5ac0c5[_0x47f4('0x93')][_0x47f4('0x1a')]){_0xf2d441[_0x47f4('0x1b')](insertCmContact(_0x5ac0c5[_0x47f4('0x2f')],_0x36d254,_0x5ac0c5['duplicates'],_0x296875));_0xf2d441[_0x47f4('0x1b')]('DROP\x20TABLE\x20'+_0x36d254+';');}BPromise[_0x47f4('0x9a')](_0xf2d441,handleQuery)[_0x47f4('0x19')](function(_0x4d4302){BPromise['all']([handleAdditionalPhones()])[_0x47f4('0x19')](function(){_0xf2d441=[];for(var _0x4ade71=0x0;_0x4ade71\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','createdAt','priority','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','updatedAt','.CmListId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId','UserId','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','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','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','catch','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists.CmListId=','utcOffset','set','offset','dialTimezone','main','stringify','send','clone','socket_timestamp','.csv','includes','header','findAll','name'];(function(_0x29cc9d,_0x19a8e3){var _0x4a31be=function(_0x1aaa76){while(--_0x1aaa76){_0x29cc9d['push'](_0x29cc9d['shift']());}};_0x4a31be(++_0x19a8e3);}(_0xa9d2,0x100));var _0x2a9d=function(_0x3500de,_0x54e13e){_0x3500de=_0x3500de-0x0;var _0x32ede4=_0xa9d2[_0x3500de];return _0x32ede4;};'use strict';var fs=require('fs');var path=require(_0x2a9d('0x0'));var _=require(_0x2a9d('0x1'));var Papa=require(_0x2a9d('0x2'));var util=require(_0x2a9d('0x3'));var BPromise=require(_0x2a9d('0x4'));var moment=require('moment');var squel=require(_0x2a9d('0x5'));var Redis=require(_0x2a9d('0x6'));var db=require(_0x2a9d('0x7'))['db'];var config=require(_0x2a9d('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x2a9d('0x9'))(_0x2a9d('0xa'));config['redis']=_[_0x2a9d('0xb')](config['redis'],{'host':_0x2a9d('0xc'),'port':0x18eb});var socket=require(_0x2a9d('0xd'))(new Redis(config[_0x2a9d('0xe')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2a9d('0xf')](_0x2a9d('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2a9d('0xf')](_0x2a9d('0x10'));function isEmail(_0x2d5e0d){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))*$/[_0x2a9d('0x11')](_0x2d5e0d);}function selectNotIn(_0x1f7942,_0x478f11,_0x3595c2,_0x38b429,_0x4be416){return squel[_0x2a9d('0x12')]()[_0x2a9d('0x13')](_0x2a9d('0x14'))[_0x2a9d('0x15')](_0x38b429)[_0x2a9d('0x16')](_0x478f11,null,_0x478f11+_0x2a9d('0x17')+_0x38b429+'.'+_0x3595c2)['where'](_0x38b429+'.'+_0x3595c2+_0x2a9d('0x18')+_0x1f7942+'.'+_0x3595c2)[_0x2a9d('0x19')](_0x478f11+_0x2a9d('0x1a')+_0x4be416[_0x2a9d('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d7b83,_0x292e3f){promisesAdditionalPhones=[];return db[_0x2a9d('0x1b')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2a9d('0x1c')](function(_0x241097){if(_0x241097!==null){var _0x1cdb37=[];for(var _0xd30c24=0x0;_0xd30c24<_0x241097[_0x2a9d('0x1d')];_0xd30c24++){var _0x18ce3b=_0x241097[_0xd30c24];_0x1cdb37[_0x2a9d('0x1e')](insertAdditionalPhones(_0x18ce3b));}}Promise[_0x2a9d('0x1f')](_0x1cdb37)[_0x2a9d('0x1c')](function(){_0x3d7b83({'val':0x1});});});});}function insertAdditionalPhones(_0xedd92e){return new Promise(function(_0x104fed,_0xcbf784){var _0x2f40e3=_0xedd92e['AdditionalPhones'];var _0x3d3364=_0x2f40e3[_0x2a9d('0x20')](';');var _0x556851=[];orderBy=0x0;for(var _0x57cf3f=0x0;_0x57cf3f<_0x3d3364[_0x2a9d('0x1d')];_0x57cf3f++){_0x556851[_0x2a9d('0x1e')](splitAdditionalPhone(_0xedd92e['id'],_0x3d3364[_0x57cf3f]));}Promise[_0x2a9d('0x1f')](_0x556851)[_0x2a9d('0x1c')](function(){_0x104fed({'val':_0x3d3364['length']});});});}function splitAdditionalPhone(_0x340cef,_0x1b581a){return new Promise(function(_0x43eef,_0x36e78d){var _0x511e48=_0x1b581a[_0x2a9d('0x20')](':');var _0x3baf86=_0x511e48[0x0];var _0x271ac2=_0x511e48[0x1];if(!_[_0x2a9d('0x21')](_0x271ac2)){var _0x1471bc=_0x271ac2[_0x2a9d('0x20')]('|');var _0xb5bbb9=[];for(var _0x88a8c1=0x0;_0x88a8c1<_0x1471bc[_0x2a9d('0x1d')];_0x88a8c1++){if(_0x1471bc[_0x88a8c1]!==''){var _0x58dfe7=_[_0x2a9d('0x22')](promisesAdditionalPhones,{'contactId':_0x340cef,'phone':_0x1471bc[_0x88a8c1]});if(_0x58dfe7['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2a9d('0x1e')]({'contactId':_0x340cef,'contactTypeId':_0x3baf86,'phone':_0x1471bc[_0x88a8c1],'orderBy':orderBy});}}}_0x43eef({'ok':0x1});}else _0x43eef({'res':0x0});});}function createAdditionalPhone(_0x468a15,_0x3c9772,_0x10ed54,_0x3c8b12){var _0x2ac264='';var _0x292429='';var _0x932a81=_0x10ed54['split']('§');_0x2ac264=_0x932a81[0x0];if(_0x932a81[_0x2a9d('0x1d')]==0x2)_0x292429=_0x932a81[0x1];return new Promise(function(_0x5807f5,_0x4f77fb){return db[_0x2a9d('0x23')][_0x2a9d('0x24')]({'where':{'CmContactId':_0x468a15,'item':_0x2ac264}})[_0x2a9d('0x1c')](function(_0x5ba510){if(_0x5ba510){return db[_0x2a9d('0x23')]['update']({'ItemTypeId':_0x3c9772,'description':_0x292429,'OrderBy':_0x3c8b12},{'where':{'CmContactId':_0x468a15,'item':_0x2ac264}})[_0x2a9d('0x1c')](function(_0x1932b4){_0x5807f5({'res':_0x2a9d('0x25')});});}else{return db[_0x2a9d('0x23')][_0x2a9d('0x26')]({'CmContactId':_0x468a15,'item':_0x2ac264,'description':_0x292429,'ItemTypeId':_0x3c9772,'OrderBy':_0x3c8b12,'ItemClass':_0x2a9d('0x27')})[_0x2a9d('0x1c')](function(_0x5e0764){_0x5807f5({'res':'inserted'});});}});});}function insertCmHopper(_0x51a86e,_0x4f4c9e,_0xecd76c,_0x179c56,_0x54ac6c){var _0x587c56=[_0x2a9d('0x28'),'cm_contacts.scheduledat',_0x2a9d('0x29'),'cm_contacts.ListId',_0x4f4c9e+'.'+_0x179c56,'cm_contacts.createdAt',_0x2a9d('0x2a'),_0x2a9d('0x2b'),_0x2a9d('0x2c'),'\x22'+_0x54ac6c+'\x22'];return squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')]('cm_hopper')[_0x2a9d('0x2f')]([_0x2a9d('0x14'),'scheduledat',_0x2a9d('0x30'),'ListId',_0x179c56,_0x2a9d('0x31'),'updatedAt',_0x2a9d('0x32'),'UserId','recallme'],squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')](_0x587c56)['from'](_0x4f4c9e)[_0x2a9d('0x16')](_0x2a9d('0x34'),null,_0x2a9d('0x35')+_0x4f4c9e+'.CmListId')['join'](_0xecd76c,null,_0xecd76c+'.id\x20=\x20'+_0x4f4c9e+'.'+_0x179c56)[_0x2a9d('0x19')](_0x4f4c9e+_0x2a9d('0x36'),_0x51a86e)[_0x2a9d('0x19')](_0x2a9d('0x37'),NOW)[_0x2a9d('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f4c9e,_0xecd76c,_0x179c56,_0x2a9d('0x38'),[_0x2a9d('0x39'),_0x2a9d('0x3a')]))['where'](_0x2a9d('0x3b'),selectNotIn(_0x4f4c9e,_0xecd76c,_0x179c56,_0x2a9d('0x38'),['\x22always\x22'])))[_0x2a9d('0x3c')]();}function insertCmHopperBlack(_0x134871,_0x3aba35,_0x2074ae,_0x233f41){var _0x741a80=[_0x2a9d('0x28'),_0x2a9d('0x29'),_0x2a9d('0x3d'),_0x3aba35+'.'+_0x233f41,_0x2a9d('0x3e'),_0x2a9d('0x2a')];return squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')](_0x2a9d('0x3f'))['fromQuery'](['phone',_0x2a9d('0x30'),'ListId',_0x233f41,_0x2a9d('0x31'),_0x2a9d('0x40')],squel['select']()[_0x2a9d('0x33')](_0x741a80)['from'](_0x3aba35)[_0x2a9d('0x16')](_0x2a9d('0x34'),null,_0x2a9d('0x35')+_0x3aba35+_0x2a9d('0x41'))[_0x2a9d('0x16')](_0x2074ae,null,_0x2074ae+_0x2a9d('0x17')+_0x3aba35+'.'+_0x233f41)['where'](_0x3aba35+_0x2a9d('0x36'),_0x134871)[_0x2a9d('0x19')](_0x2a9d('0x37'),NOW)[_0x2a9d('0x19')](_0x2a9d('0x3b'),squel[_0x2a9d('0x12')]()[_0x2a9d('0x13')](_0x2a9d('0x14'))[_0x2a9d('0x15')](_0x2a9d('0x3f'))[_0x2a9d('0x19')](_0x2a9d('0x42'),_0x134871)[_0x2a9d('0x19')](_0x233f41+_0x2a9d('0x18')+_0x3aba35+'.'+_0x233f41)))['toString']();}function insertTzCmHopper(_0x3a2c55,_0x1170e2,_0x26ee31,_0x31d7dc,_0x14fc2a,_0x5ba3fb){var _0x4a32cc=[_0x2a9d('0x28'),_0x2a9d('0x43')+_0x5ba3fb+_0x2a9d('0x44'),_0x2a9d('0x29'),_0x2a9d('0x3d'),_0x1170e2+'.'+_0x31d7dc,_0x2a9d('0x3e'),_0x2a9d('0x2a'),_0x2a9d('0x2b'),'cm_contacts.UserId','\x22'+_0x14fc2a+'\x22'];var _0x5379bb=squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')]('cm_hopper')[_0x2a9d('0x2f')]([_0x2a9d('0x14'),'scheduledat',_0x2a9d('0x30'),_0x2a9d('0x45'),_0x31d7dc,_0x2a9d('0x31'),_0x2a9d('0x40'),_0x2a9d('0x32'),_0x2a9d('0x46'),_0x2a9d('0x47')],squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')](_0x4a32cc)[_0x2a9d('0x15')](_0x1170e2)[_0x2a9d('0x16')](_0x2a9d('0x34'),null,_0x2a9d('0x35')+_0x1170e2+_0x2a9d('0x41'))[_0x2a9d('0x16')](_0x26ee31,null,_0x26ee31+_0x2a9d('0x17')+_0x1170e2+'.'+_0x31d7dc)[_0x2a9d('0x16')](_0x5ba3fb,null,_0x5ba3fb+_0x2a9d('0x17')+_0x1170e2+'.'+_0x31d7dc)[_0x2a9d('0x19')](_0x1170e2+'.CmListId\x20=\x20?',_0x3a2c55)['where'](_0x2a9d('0x37'),NOW)['where'](_0x2a9d('0x3b'),selectNotIn(_0x1170e2,_0x26ee31,_0x31d7dc,_0x2a9d('0x38'),['\x22always\x22',_0x2a9d('0x3a')]))['where'](_0x2a9d('0x3b'),selectNotIn(_0x1170e2,_0x26ee31,_0x31d7dc,_0x2a9d('0x38'),[_0x2a9d('0x39')])))[_0x2a9d('0x3c')]();return _0x5379bb;}function insertTzCmHopperBlack(_0x4728af,_0x278c69,_0x59efc6,_0xbd716b){var _0x5d8aaf=[_0x2a9d('0x28'),_0x2a9d('0x29'),_0x2a9d('0x3d'),_0x278c69+'.'+_0xbd716b,_0x2a9d('0x3e'),'cm_contacts.updatedAt'];return squel[_0x2a9d('0x2d')]()['into'](_0x2a9d('0x3f'))[_0x2a9d('0x2f')]([_0x2a9d('0x14'),_0x2a9d('0x30'),_0x2a9d('0x45'),_0xbd716b,_0x2a9d('0x31'),_0x2a9d('0x40')],squel['select']()[_0x2a9d('0x33')](_0x5d8aaf)[_0x2a9d('0x15')](_0x278c69)[_0x2a9d('0x16')](_0x2a9d('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x278c69+_0x2a9d('0x41'))[_0x2a9d('0x16')](_0x59efc6,null,_0x59efc6+_0x2a9d('0x17')+_0x278c69+'.'+_0xbd716b)[_0x2a9d('0x19')](_0x278c69+_0x2a9d('0x36'),_0x4728af)[_0x2a9d('0x19')](_0x2a9d('0x37'),NOW)[_0x2a9d('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2a9d('0x12')]()[_0x2a9d('0x13')](_0x2a9d('0x14'))[_0x2a9d('0x15')](_0x2a9d('0x3f'))[_0x2a9d('0x19')](_0x2a9d('0x42'),_0x4728af)['where'](_0xbd716b+_0x2a9d('0x18')+_0x278c69+'.'+_0xbd716b)))[_0x2a9d('0x3c')]();}function insertCmHopperAdditionalPhones(_0x4f7c7d){var _0x236a92=[_0x2a9d('0x48'),_0x2a9d('0x49'),'cm_contact_has_items.OrderBy',_0x2a9d('0x4a'),_0x2a9d('0x4b')];return squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')](_0x2a9d('0x4c'))[_0x2a9d('0x2f')]([_0x2a9d('0x4d'),_0x2a9d('0x14'),'OrderBy','createdAt','updatedAt'],squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')](_0x236a92)[_0x2a9d('0x15')]('cm_hopper')[_0x2a9d('0x16')](_0x2a9d('0x34'),null,_0x2a9d('0x4e'))[_0x2a9d('0x16')](_0x2a9d('0x4f'),null,_0x2a9d('0x50'))[_0x2a9d('0x19')](_0x2a9d('0x51'),_0x4f7c7d)[_0x2a9d('0x19')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x2025da,_0x3a0960,_0x53070a,_0x54ba4a){var _0x3cfce6=_[_0x2a9d('0x52')](_[_0x2a9d('0x53')](_0x54ba4a),[_0x2a9d('0x45'),_0x2a9d('0x54'),_0x2a9d('0x31'),_0x2a9d('0x40'),_0x2a9d('0x55')]);return squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')](_0x2a9d('0x34'))[_0x2a9d('0x2f')](_0x3cfce6,squel[_0x2a9d('0x12')]()['fields'](_0x3cfce6)[_0x2a9d('0x15')](_0x3a0960)['where']('('+_0x53070a[_0x2a9d('0x16')](',')+_0x2a9d('0x56'),squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')](_0x53070a)[_0x2a9d('0x15')]('cm_contacts')[_0x2a9d('0x19')](_0x2a9d('0x42'),_0x2025da)['where'](_0x2a9d('0x57')))['where'](_0x2a9d('0x58'),squel['select']()[_0x2a9d('0x13')](_0x2a9d('0x59'),_0x2a9d('0x5a'))[_0x2a9d('0x15')](_0x3a0960)['group'](_0x53070a[_0x2a9d('0x16')](','))))[_0x2a9d('0x3c')]();}function handleStop(){logger[_0x2a9d('0x5b')](_0x2a9d('0x5c'));stopped=!![];}function handleUncaughtException(_0x8d3d12){logger[_0x2a9d('0x5d')](_0x8d3d12['message']);process[_0x2a9d('0x5e')](0x1);}function handleError(_0x47a3cb,_0x4f06ed){stats[_0x2a9d('0x5f')]['push']({'name':_0x4f06ed[_0x2a9d('0x60')],'message':_0x4f06ed[_0x2a9d('0x61')],'row':_0x47a3cb});}function handleQuery(_0x4d1288){logger[_0x2a9d('0x5b')](_0x4d1288);return db[_0x2a9d('0x62')][_0x2a9d('0x63')](_0x4d1288)[_0x2a9d('0x64')](function(_0x37b32e){results[_0x2a9d('0x1e')](_0x37b32e);})[_0x2a9d('0x65')](function(_0x95e294){logger[_0x2a9d('0x5d')](_0x95e294[_0x2a9d('0x61')]);});}function updateTzCampaigns(_0x3e668a){return new Promise(function(_0x438dc9,_0x4b778c){var _0xdad1f5=squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')](['campaigns.id',_0x2a9d('0x66')])[_0x2a9d('0x15')]('campaigns')[_0x2a9d('0x16')](_0x2a9d('0x67'),null,_0x2a9d('0x68'))[_0x2a9d('0x19')](_0x2a9d('0x69')+_0x3e668a);db[_0x2a9d('0x62')][_0x2a9d('0x63')](_0xdad1f5[_0x2a9d('0x3c')]())[_0x2a9d('0x64')](function(_0x421ae6){var _0x53a6cf=[];for(var _0x2ff8c1=0x0;_0x2ff8c1<_0x421ae6[_0x2a9d('0x1d')];_0x2ff8c1++){_0x53a6cf[_0x2a9d('0x1e')](getTimezoneData(_0x421ae6[_0x2ff8c1],tmp_campaigns));}BPromise[_0x2a9d('0x1f')](_0x53a6cf)[_0x2a9d('0x1c')](function(){_0x438dc9({'val':0x1});});})['catch'](function(_0x515270){logger[_0x2a9d('0x5d')](_0x515270['message']);_0x438dc9({'val':0x0});});});}function updateTzVoiceQueues(_0x431c9f){return new Promise(function(_0x1fa839,_0x42c196){var _0x1ab76e=squel[_0x2a9d('0x12')]()[_0x2a9d('0x33')]([_0x2a9d('0x6a'),_0x2a9d('0x6b')])[_0x2a9d('0x15')](_0x2a9d('0x6c'))['join']('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x2a9d('0x6d')+_0x431c9f);db[_0x2a9d('0x62')]['query'](_0x1ab76e[_0x2a9d('0x3c')]())[_0x2a9d('0x64')](function(_0x232ad1){var _0x2af4dd=[];for(var _0x59ab01=0x0;_0x59ab01<_0x232ad1[_0x2a9d('0x1d')];_0x59ab01++){_0x2af4dd[_0x2a9d('0x1e')](getTimezoneData(_0x232ad1[_0x59ab01],tmp_voice_queues));}BPromise[_0x2a9d('0x1f')](_0x2af4dd)[_0x2a9d('0x1c')](function(){_0x1fa839({'val':0x1});});})[_0x2a9d('0x65')](function(_0x374a2a){logger[_0x2a9d('0x5d')](_0x374a2a[_0x2a9d('0x61')]);_0x1fa839({'val':0x0});});});}function getTimezoneData(_0x46e3f9,_0x26297c){return new Promise(function(_0x607f46,_0x4f515f){var _0x44de5b=shared['timezones'];var _0x4f4a3f=_0x44de5b[_0x46e3f9['dialTimezone']];if(_[_0x2a9d('0x21')](_0x4f4a3f)){_0x607f46({'ret':0x1});}else{var _0x18bbae=_0x4f4a3f[_0x2a9d('0x6e')];var _0x2658ba=squel[_0x2a9d('0x2d')]()[_0x2a9d('0x2e')](_0x26297c)[_0x2a9d('0x6f')]('id',_0x46e3f9['id'])[_0x2a9d('0x6f')](_0x2a9d('0x70'),_0x18bbae)['set']('dialTimezone',_0x46e3f9[_0x2a9d('0x71')])[_0x2a9d('0x3c')]();return db[_0x2a9d('0x62')][_0x2a9d('0x63')](_0x2658ba)[_0x2a9d('0x64')](function(_0x2f4517){_0x607f46({'ret':0x1});})[_0x2a9d('0x65')](function(_0x3e54d3){logger[_0x2a9d('0x5d')](_0x3e54d3[_0x2a9d('0x61')]);_0x4f515f({'ret':0x1});});}});}function handleTZQuery(_0x2e62b3){logger[_0x2a9d('0x5b')](_0x2e62b3);return db[_0x2a9d('0x62')][_0x2a9d('0x63')](_0x2e62b3)[_0x2a9d('0x64')](function(_0x1c5963){})[_0x2a9d('0x65')](function(_0xc28749){logger[_0x2a9d('0x5d')](_0xc28749['message']);});}function main(_0x2d8db2,_0x13aa36,_0x38a1a4,_0x5b4fe2){logger[_0x2a9d('0x5b')](_0x2a9d('0x72'),_0x2d8db2,JSON[_0x2a9d('0x73')](_0x13aa36));process[_0x2a9d('0x74')]('start');var _0x454b59=_0x13aa36['binding'];var _0x448560=_[_0x2a9d('0x75')](_0x454b59);var _0x4b97d3=_0x13aa36[_0x2a9d('0x76')];var _0x31a8f4=path[_0x2a9d('0x16')](config['root'],'server/files/tmp',_0x4b97d3+_0x2a9d('0x77'));hasTZ=_[_0x2a9d('0x53')](_0x454b59)[_0x2a9d('0x78')](_0x2a9d('0x71'));var _0xdcb089=_[_0x2a9d('0x53')](_0x454b59)['join']();logger['info'](_0x2a9d('0x79'),_0xdcb089);db['ContactItemType'][_0x2a9d('0x7a')]({'raw':!![],'attributes':['id','name']})[_0x2a9d('0x1c')](function(_0x3516a2){for(var _0x235cb8=0x0;_0x235cb8<_0x3516a2['length'];_0x235cb8++){if(_0x3516a2[_0x235cb8][_0x2a9d('0x7b')]in _0x454b59){contactItemTypes[_0x2a9d('0x1e')](_0x3516a2[_0x235cb8]);delete _0x448560[_0x3516a2[_0x235cb8][_0x2a9d('0x7b')]];hasAdditionalPhones=!![];}for(var _0x3555aa in _0x454b59){if(_0x3516a2[_0x235cb8]['name']+'_description'===_0x3555aa){phoneDescriptions['push']({'itemTypeId':_0x3516a2[_0x235cb8]['id'],'description':_0x3555aa});delete _0x448560[_0x3555aa];}}}if(hasAdditionalPhones)_0x448560['AdditionalPhones']='';var _0x283473=_[_0x2a9d('0x53')](_0x448560)[_0x2a9d('0x16')]();logger[_0x2a9d('0x5b')](_0x2a9d('0x79'),_0x283473);fs[_0x2a9d('0x7c')](_0x31a8f4,_0x283473+'\x0a');Papa['parse'](fs[_0x2a9d('0x7d')](_0x2d8db2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3debe1,_0xa70231){try{for(var _0x58ae08=0x0,_0x40d651=[];_0x58ae08<_0x3debe1[_0x2a9d('0x7e')][_0x2a9d('0x1d')];_0x58ae08++){stats[_0x2a9d('0x7f')]+=0x1;if(_0x3debe1[_0x2a9d('0x5f')][_0x58ae08]){handleError(_0x3debe1[_0x2a9d('0x7e')][_0x58ae08],_0x3debe1[_0x2a9d('0x5f')][_0x58ae08]);}else{var _0x3a10c4=[];var _0x26b0f7=[];var _0x34d61c={};for(var _0x4a1356 in _0x454b59){let _0x2defcb=contactItemTypes[_0x2a9d('0x80')](_0x2458a9=>_0x2458a9['name']===_0x4a1356);let _0x30b283=contactItemTypes['find'](_0x4eb257=>_0x4eb257[_0x2a9d('0x7b')]+'_description'===_0x4a1356);if(_['isNil'](_0x2defcb)&&_[_0x2a9d('0x21')](_0x30b283)){if(_0x454b59[_0x2a9d('0x81')](_0x4a1356)){if(_0x3debe1[_0x2a9d('0x7e')][_0x58ae08][_0x454b59[_0x4a1356]]){var _0x1d59a3=_[_0x2a9d('0x82')](_0x3debe1['data'][_0x58ae08][_0x454b59[_0x4a1356]][_0x2a9d('0x83')](/"/g,'\x27'));switch(_0x4a1356){case'scheduledat':var _0x998e04=moment(_0x1d59a3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x998e04['isValid']()){_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x1d59a3+'\x22');}else{_0x3a10c4[_0x2a9d('0x1e')](_0x2a9d('0x84'));}break;case _0x2a9d('0x32'):var _0x1e5d08=parseInt(_0x1d59a3);_0x1d59a3=_[_0x2a9d('0x85')](_0x1e5d08)||_0x1e5d08<0x0||_0x1e5d08>0x4?_0x5b4fe2?0x3:0x2:_0x1e5d08;_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x1d59a3+'\x22');break;case _0x2a9d('0x46'):var _0x369968=parseInt(_0x1d59a3);if(_[_0x2a9d('0x86')](_0x369968)&&_[_0x2a9d('0x78')](_0x38a1a4,_0x369968)){_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x369968+'\x22');}else{_0x3a10c4[_0x2a9d('0x1e')]('agent\x20not\x20exists');}break;case _0x2a9d('0x87'):if(isEmail(_0x1d59a3)){_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x1d59a3+'\x22');}else{_0x3a10c4['push'](_0x2a9d('0x88'));}break;case _0x2a9d('0x89'):var _0x57fb58=moment(_0x1d59a3,_0x2a9d('0x8a'),!![]);if(_0x57fb58['isValid']()){_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x1d59a3+'\x22');}else{_0x3a10c4[_0x2a9d('0x1e')](_0x2a9d('0x8b'));}break;case'dialTimezone':var _0x446bc1=shared[_0x2a9d('0x8c')];var _0x59f6c7=_0x446bc1[_0x1d59a3];if(!_[_0x2a9d('0x21')](_0x59f6c7)){var _0x537c3f=_0x59f6c7[_0x2a9d('0x6e')];_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x1d59a3+'\x22');_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x537c3f+'\x22');}break;default:_0x40d651['push']('\x22'+_0x1d59a3+'\x22');}}else{switch(_0x4a1356){case _0x2a9d('0x8d'):case'phone':_0x3a10c4[_0x2a9d('0x1e')](_0x4a1356+_0x2a9d('0x8e'));break;default:_0x40d651[_0x2a9d('0x1e')]('\x22\x22');}}}}else{var _0x2a66cb='';if(!_['isNil'](_0x2defcb)){if(!_0x34d61c[_0x2a9d('0x81')](_0x2defcb['id'])){if(!_[_0x2a9d('0x21')](_0x3debe1[_0x2a9d('0x7e')][_0x58ae08][_0x454b59[_0x4a1356]])){var _0x1d59a3=_[_0x2a9d('0x82')](_0x3debe1['data'][_0x58ae08][_0x454b59[_0x4a1356]][_0x2a9d('0x83')](/"/g,'\x27'));var _0x303b47=phoneDescriptions['find'](_0x3483f3=>_0x3483f3[_0x2a9d('0x8f')]===_0x2defcb['id']);if(!_[_0x2a9d('0x21')](_0x303b47)){var _0x804591=_[_0x2a9d('0x82')](_0x3debe1[_0x2a9d('0x7e')][_0x58ae08][_0x454b59[_0x303b47[_0x2a9d('0x90')]]][_0x2a9d('0x83')](/"/g,'\x27'));if(!_[_0x2a9d('0x21')](_0x804591))_0x1d59a3=_0x1d59a3+'§'+_0x804591;}if(_0x2a66cb=='')_0x2a66cb=_0x1d59a3;else _0x2a66cb+='|'+_0x1d59a3;}_0x26b0f7[_0x2a9d('0x1e')](_0x2defcb['id']+':'+_0x2a66cb);_0x34d61c[_0x2defcb['id']]=0x1;}}}}if(hasAdditionalPhones){_0x40d651[_0x2a9d('0x1e')]('\x22'+_0x26b0f7['join'](';')+'\x22');}if(_0x3a10c4[_0x2a9d('0x1d')]){handleError(_0x3debe1[_0x2a9d('0x7e')][_0x58ae08],{'code':_0x2a9d('0x91'),'message':_0x3a10c4[_0x2a9d('0x16')]()});}else{fs[_0x2a9d('0x92')](_0x31a8f4,_0x40d651[_0x2a9d('0x16')]()+'\x0a');}_0x40d651=[];}if(!(stats[_0x2a9d('0x7f')]%0xc8)){socket[_0x2a9d('0x93')](_0x2a9d('0x94')+_0x4b97d3,stats);stats[_0x2a9d('0x5f')]=[];}}if(stopped){logger[_0x2a9d('0x5b')](_0x2a9d('0x95'));_0xa70231[_0x2a9d('0x96')]();}}catch(_0x5bda71){handleError(_0x3debe1[_0x2a9d('0x7e')][_0x58ae08],{'code':_0x2a9d('0x97'),'message':_0x5bda71[_0x2a9d('0x61')]});logger[_0x2a9d('0x5d')](_0x2a9d('0x98'),_0x5bda71[_0x2a9d('0x61')]);}},'complete':function(){try{var _0x410b0c=[];var _0x251607=[];var _0x6951d0=_0x2a9d('0x34');if(_0x13aa36[_0x2a9d('0x99')]&&_0x13aa36[_0x2a9d('0x99')][_0x2a9d('0x1d')]){_0x6951d0=_0x2a9d('0x9a')+_0x4b97d3;_0x410b0c[_0x2a9d('0x1e')](_0x2a9d('0x9b')+_0x6951d0+_0x2a9d('0x9c'));}tmp_campaigns=_0x2a9d('0x9d')+_0x4b97d3;tmp_voice_queues=_0x2a9d('0x9e')+_0x4b97d3;_0x251607[_0x2a9d('0x1e')](_0x2a9d('0x9b')+tmp_campaigns+_0x2a9d('0x9f'));_0x251607[_0x2a9d('0x1e')](_0x2a9d('0x9b')+tmp_voice_queues+_0x2a9d('0x9f'));BPromise[_0x2a9d('0xa0')](_0x251607,handleTZQuery)[_0x2a9d('0x1c')](function(_0x2e0421){updateTzCampaigns(_0x13aa36[_0x2a9d('0x45')])[_0x2a9d('0x1c')](function(_0x466986){updateTzVoiceQueues(_0x13aa36[_0x2a9d('0x45')])['then'](function(_0x2b33a7){if(hasTZ)_0x283473=_0x283473['replace'](_0x2a9d('0x71'),_0x2a9d('0xa1'));var _0x25dc3f=util[_0x2a9d('0xf')](_0x2a9d('0xa2'),_0x31a8f4,_0x6951d0,_0x283473,_0x13aa36['ListId'],_0x13aa36['CompanyId']||null,NOW,NOW);if(_[_0x2a9d('0x21')](_0x454b59[_0x2a9d('0xa3')])){_0x25dc3f+=_0x2a9d('0xa4');}_0x410b0c[_0x2a9d('0x1e')](_0x25dc3f);if(_0x13aa36['duplicates']&&_0x13aa36[_0x2a9d('0x99')][_0x2a9d('0x1d')]){_0x410b0c[_0x2a9d('0x1e')](insertCmContact(_0x13aa36[_0x2a9d('0x45')],_0x6951d0,_0x13aa36['duplicates'],_0x454b59));_0x410b0c['push'](_0x2a9d('0xa5')+_0x6951d0+';');}BPromise['each'](_0x410b0c,handleQuery)[_0x2a9d('0x1c')](function(_0x2f9a51){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x410b0c=[];for(var _0x526ddd=0x0;_0x526ddd\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','message','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','ContactId','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','id\x20IN\x20?','MIN(id)','info','error','exit'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x4142af,_0x396358){_0x4142af=_0x4142af-0x0;var _0x4bd460=_0xd1d3[_0x4142af];return _0x4bd460;};'use strict';var fs=require('fs');var path=require(_0x3d1d('0x0'));var _=require('lodash');var Papa=require(_0x3d1d('0x1'));var util=require('util');var BPromise=require(_0x3d1d('0x2'));var moment=require(_0x3d1d('0x3'));var squel=require(_0x3d1d('0x4'));var Redis=require(_0x3d1d('0x5'));var db=require(_0x3d1d('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x3d1d('0x7'))(_0x3d1d('0x8'));config['redis']=_[_0x3d1d('0x9')](config[_0x3d1d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d1d('0xb'))(new Redis(config[_0x3d1d('0xa')]));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()[_0x3d1d('0xc')](_0x3d1d('0xd'));var tempTableName=_0x3d1d('0xe')+moment()[_0x3d1d('0xc')](_0x3d1d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x448422){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))*$/[_0x3d1d('0x10')](_0x448422);}function selectNotIn(_0x246954,_0xf2ac87,_0x2b1d2f,_0x3037d8,_0xde1f63){return squel[_0x3d1d('0x11')]()[_0x3d1d('0x12')](_0x3d1d('0x13'))[_0x3d1d('0x14')](_0x3037d8)[_0x3d1d('0x15')](_0xf2ac87,null,_0xf2ac87+'.id\x20=\x20'+_0x3037d8+'.'+_0x2b1d2f)[_0x3d1d('0x16')](_0x3037d8+'.'+_0x2b1d2f+_0x3d1d('0x17')+_0x246954+'.'+_0x2b1d2f)[_0x3d1d('0x16')](_0xf2ac87+_0x3d1d('0x18')+_0xde1f63[_0x3d1d('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x12dd84,_0x4751b9){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3d1d('0x19')]['query'](_0x3d1d('0x1a')+tempTableName)[_0x3d1d('0x1b')](function(_0x5d6a51){if(_0x5d6a51!==null){var _0x5786df=[];for(var _0x3b30bd=0x0;_0x3b30bd<_0x5d6a51[_0x3d1d('0x1c')];_0x3b30bd++){var _0x1e71cf=_0x5d6a51[_0x3b30bd];if(!_[_0x3d1d('0x1d')](_0x1e71cf['phone'])){if(!_[_0x3d1d('0x1d')](_0x1e71cf[_0x3d1d('0x1e')]))_0x5786df[_0x3d1d('0x1f')](insertAdditionalPhones(_0x1e71cf));promisesContact[_0x3d1d('0x1f')]({'contact':_0x1e71cf});}}}Promise[_0x3d1d('0x20')](_0x5786df)[_0x3d1d('0x21')](function(){_0x12dd84({'val':0x1});});})['catch'](function(_0x5d1af5){logger['error'](_0x5d1af5[_0x3d1d('0x22')]);});});}function insertAdditionalPhones(_0x19ae5b){return new Promise(function(_0x982a88,_0xedf825){var _0x1f5c7c=_0x19ae5b[_0x3d1d('0x1e')];if(_[_0x3d1d('0x1d')](_0x1f5c7c))_0xedf825({'val':0x0});else{var _0x42a46d=_0x1f5c7c[_0x3d1d('0x23')](';');var _0x4bbb58=[];orderBy=0x0;for(var _0x553fa1=0x0;_0x553fa1<_0x42a46d[_0x3d1d('0x1c')];_0x553fa1++){_0x4bbb58[_0x3d1d('0x1f')](splitAdditionalPhone(_0x19ae5b['id'],_0x42a46d[_0x553fa1]));}Promise[_0x3d1d('0x20')](_0x4bbb58)['then'](function(){_0x982a88({'val':_0x42a46d[_0x3d1d('0x1c')]});});}});}function splitAdditionalPhone(_0x3dae29,_0x4760a4){return new Promise(function(_0x21d60e,_0x12f5ab){var _0x50bd12=_0x4760a4[_0x3d1d('0x23')](':');var _0x1542e3=_0x50bd12[0x0];var _0x1a7c18=_0x50bd12[0x1];if(_0x1a7c18!==''){var _0x2e0339=_0x1a7c18[_0x3d1d('0x23')]('|');var _0xbda25a=[];for(var _0x49b800=0x0;_0x49b800<_0x2e0339['length'];_0x49b800++){if(_0x2e0339[_0x49b800]!==''){var _0x4efc5c=_[_0x3d1d('0x24')](promisesAdditionalPhones,{'contactId':_0x3dae29,'phone':_0x2e0339[_0x49b800]});if(_0x4efc5c[_0x3d1d('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x3d1d('0x1f')]({'contactId':_0x3dae29,'contactTypeId':_0x1542e3,'phone':_0x2e0339[_0x49b800],'orderBy':orderBy});}}}_0x21d60e({'ok':0x1});}else _0x21d60e({'res':0x0});});}function createAdditionalPhone(_0xf7687d,_0x54d7d5,_0x4a4623,_0x8aaf8){var _0x5ea525='';var _0x181d71='';var _0x23116a=_0x4a4623[_0x3d1d('0x23')]('§');_0x5ea525=_0x23116a[0x0];if(_0x23116a[_0x3d1d('0x1c')]==0x2)_0x181d71=_0x23116a[0x1];return new Promise(function(_0xb75151,_0x151ded){return db[_0x3d1d('0x25')][_0x3d1d('0x26')]({'where':{'CmContactId':_0xf7687d,'item':_0x5ea525}})[_0x3d1d('0x21')](function(_0x58b541){if(_0x58b541){return db[_0x3d1d('0x25')][_0x3d1d('0x27')]({'ItemTypeId':_0x54d7d5,'description':_0x181d71,'OrderBy':_0x8aaf8},{'where':{'CmContactId':_0xf7687d,'item':_0x5ea525}})[_0x3d1d('0x21')](function(_0xdaab2){_0xb75151({'res':_0x3d1d('0x28')});});}else{return db[_0x3d1d('0x25')][_0x3d1d('0x29')]({'CmContactId':_0xf7687d,'item':_0x5ea525,'ItemTypeId':_0x54d7d5,'description':_0x181d71,'OrderBy':_0x8aaf8,'ItemClass':_0x3d1d('0x2a')})['then'](function(_0x2b3bd3){_0xb75151({'res':_0x3d1d('0x2b')});});}});});}function updateContact(_0xf53b40){return new Promise(function(_0x20111a,_0x122a0b){var _0x26033e=_0xf53b40['id'];delete _0xf53b40['id'];return db[_0x3d1d('0x2c')][_0x3d1d('0x27')](_0xf53b40,{'where':{'id':_0x26033e}})[_0x3d1d('0x21')](function(_0xb65cbc){updatedRows+=0x1;return db['CmHopper'][_0x3d1d('0x27')]({'phone':_0xf53b40[_0x3d1d('0x13')]},{'where':{'ContactId':_0x26033e}})[_0x3d1d('0x21')](function(_0xaedceb){_0x20111a({'ret':'OK'});});});});}function insertCmHopper(_0x183063,_0x17db7b,_0x43a778,_0x2cdf4,_0x3bc7fc){var _0xe1cb4b=[_0x3d1d('0x2d'),_0x3d1d('0x2e'),'cm_contacts.id',_0x3d1d('0x2f'),_0x17db7b+'.'+_0x2cdf4,_0x3d1d('0x30'),_0x3d1d('0x31'),'cm_contacts.priority',_0x3d1d('0x32'),'\x22'+_0x3bc7fc+'\x22'];return squel[_0x3d1d('0x33')]()[_0x3d1d('0x34')]('cm_hopper')['fromQuery']([_0x3d1d('0x13'),'scheduledat','ContactId',_0x3d1d('0x35'),_0x2cdf4,_0x3d1d('0x36'),_0x3d1d('0x37'),_0x3d1d('0x38'),'UserId',_0x3d1d('0x39')],squel[_0x3d1d('0x11')]()[_0x3d1d('0x3a')](_0xe1cb4b)['from'](_0x17db7b)[_0x3d1d('0x15')](_0x3d1d('0x3b'),null,_0x3d1d('0x3c')+_0x17db7b+_0x3d1d('0x3d'))[_0x3d1d('0x15')](_0x43a778,null,_0x43a778+_0x3d1d('0x3e')+_0x17db7b+'.'+_0x2cdf4)[_0x3d1d('0x16')](_0x17db7b+'.CmListId\x20=\x20?',_0x183063)[_0x3d1d('0x16')](_0x3d1d('0x3f'),NOW)[_0x3d1d('0x16')](_0x3d1d('0x40'),selectNotIn(_0x17db7b,_0x43a778,_0x2cdf4,_0x3d1d('0x41'),[_0x3d1d('0x42'),_0x3d1d('0x43')]))[_0x3d1d('0x16')](_0x3d1d('0x40'),selectNotIn(_0x17db7b,_0x43a778,_0x2cdf4,_0x3d1d('0x41'),[_0x3d1d('0x42')])))[_0x3d1d('0x44')]();}function insertCmHopperBlack(_0x564078,_0x4adf17,_0x29643f,_0x493175){var _0x1526ea=['cm_contacts.phone','cm_contacts.id',_0x3d1d('0x2f'),_0x4adf17+'.'+_0x493175,_0x3d1d('0x30'),_0x3d1d('0x31')];return squel[_0x3d1d('0x33')]()[_0x3d1d('0x34')](_0x3d1d('0x45'))[_0x3d1d('0x46')]([_0x3d1d('0x13'),_0x3d1d('0x47'),_0x3d1d('0x35'),_0x493175,_0x3d1d('0x36'),_0x3d1d('0x37')],squel[_0x3d1d('0x11')]()['fields'](_0x1526ea)[_0x3d1d('0x14')](_0x4adf17)[_0x3d1d('0x15')](_0x3d1d('0x3b'),null,_0x3d1d('0x3c')+_0x4adf17+_0x3d1d('0x3d'))[_0x3d1d('0x15')](_0x29643f,null,_0x29643f+_0x3d1d('0x3e')+_0x4adf17+'.'+_0x493175)['where'](_0x4adf17+'.CmListId\x20=\x20?',_0x564078)['where'](_0x3d1d('0x3f'),NOW)[_0x3d1d('0x16')](_0x3d1d('0x40'),squel['select']()[_0x3d1d('0x12')](_0x3d1d('0x13'))[_0x3d1d('0x14')](_0x3d1d('0x45'))[_0x3d1d('0x16')](_0x3d1d('0x48'),_0x564078)[_0x3d1d('0x16')](_0x493175+_0x3d1d('0x49'),_0x4adf17+'.'+_0x493175)))[_0x3d1d('0x44')]();}function insertCmHopperAdditionalPhones(_0x1185b0){var _0x134aab=[_0x3d1d('0x4a'),_0x3d1d('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x3d1d('0x4c')];return squel[_0x3d1d('0x33')]()['into'](_0x3d1d('0x4d'))[_0x3d1d('0x46')]([_0x3d1d('0x4e'),_0x3d1d('0x13'),_0x3d1d('0x4f'),_0x3d1d('0x36'),_0x3d1d('0x37')],squel[_0x3d1d('0x11')]()[_0x3d1d('0x3a')](_0x134aab)[_0x3d1d('0x14')]('cm_hopper')[_0x3d1d('0x15')](_0x3d1d('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x3d1d('0x15')](_0x3d1d('0x50'),null,_0x3d1d('0x51'))['where'](_0x3d1d('0x52'),_0x1185b0)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x250e43,_0x15f1e8,_0x2e1d56,_0x1072be){var _0x39ca6d=_['concat'](_[_0x3d1d('0x53')](_0x1072be),[_0x3d1d('0x35'),'CompanyId','createdAt',_0x3d1d('0x37')]);return squel[_0x3d1d('0x33')]()[_0x3d1d('0x34')]('cm_contacts')[_0x3d1d('0x46')](_0x39ca6d,squel[_0x3d1d('0x11')]()['fields'](_0x39ca6d)[_0x3d1d('0x14')](_0x15f1e8)[_0x3d1d('0x16')]('('+_0x2e1d56[_0x3d1d('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x3d1d('0x11')]()[_0x3d1d('0x3a')](_0x2e1d56)[_0x3d1d('0x14')]('cm_contacts')[_0x3d1d('0x16')]('ListId\x20=\x20?',_0x250e43))['where'](_0x3d1d('0x54'),squel[_0x3d1d('0x11')]()['field'](_0x3d1d('0x55'),'min_id')[_0x3d1d('0x14')](_0x15f1e8)['group'](_0x2e1d56[_0x3d1d('0x15')](','))))['toString']();}function handleStop(){logger[_0x3d1d('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xbab993){logger[_0x3d1d('0x57')](_0xbab993[_0x3d1d('0x22')]);process[_0x3d1d('0x58')](0x1);}function handleError(_0x797e20,_0xd9490d){stats['errors'][_0x3d1d('0x1f')]({'name':_0xd9490d[_0x3d1d('0x59')],'message':_0xd9490d[_0x3d1d('0x22')],'row':_0x797e20});}function handleQuery(_0xae2c34){logger['info'](_0xae2c34);return db[_0x3d1d('0x19')][_0x3d1d('0x5a')](_0xae2c34)[_0x3d1d('0x1b')](function(_0x1ace4a){results[_0x3d1d('0x1f')](_0x1ace4a);})[_0x3d1d('0x5b')](function(_0x4d05cf){logger[_0x3d1d('0x57')](_0x4d05cf[_0x3d1d('0x22')]);});}function main(_0x474d6f,_0xc4e01f,_0x26c51e,_0x3ee563){logger['info'](_0x3d1d('0x5c'),_0x474d6f,JSON[_0x3d1d('0x5d')](_0xc4e01f));process['send'](_0x3d1d('0x5e'));var _0x12c60f=_0xc4e01f[_0x3d1d('0x5f')];var _0x18d525=_[_0x3d1d('0x60')](_0x12c60f);var _0x4c9a53=_0xc4e01f[_0x3d1d('0x61')];var _0x559232=path[_0x3d1d('0x15')](config[_0x3d1d('0x62')],_0x3d1d('0x63'),_0x4c9a53+_0x3d1d('0x64'));logger['info']('body',_0xc4e01f);db['ContactItemType'][_0x3d1d('0x65')]({'raw':!![],'attributes':['id','name']})[_0x3d1d('0x21')](function(_0x47f8df){for(var _0x29b37c=0x0;_0x29b37c<_0x47f8df[_0x3d1d('0x1c')];_0x29b37c++){if(_0x47f8df[_0x29b37c]['name']in _0x12c60f){contactItemTypes[_0x3d1d('0x1f')](_0x47f8df[_0x29b37c]);delete _0x18d525[_0x47f8df[_0x29b37c][_0x3d1d('0x66')]];hasAdditionalPhones=!![];}for(var _0x4ad51b in _0x12c60f){if(_0x47f8df[_0x29b37c][_0x3d1d('0x66')]+_0x3d1d('0x67')===_0x4ad51b){phoneDescriptions[_0x3d1d('0x1f')]({'itemTypeId':_0x47f8df[_0x29b37c]['id'],'description':_0x4ad51b});delete _0x18d525[_0x4ad51b];}}}if(hasAdditionalPhones)_0x18d525['AdditionalPhones']='';var _0x4e75e0=_[_0x3d1d('0x53')](_0x18d525)[_0x3d1d('0x15')]();logger['info']('header',_0x4e75e0);fs['writeFileSync'](_0x559232,_0x4e75e0+'\x0a');Papa['parse'](fs[_0x3d1d('0x68')](_0x474d6f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x40d393,_0x5d8609){try{for(var _0x205c4a=0x0,_0x1ae110=[];_0x205c4a<_0x40d393[_0x3d1d('0x69')][_0x3d1d('0x1c')];_0x205c4a++){stats[_0x3d1d('0x6a')]+=0x1;if(_0x40d393[_0x3d1d('0x6b')][_0x205c4a]){handleError(_0x40d393[_0x3d1d('0x69')][_0x205c4a],_0x40d393['errors'][_0x205c4a]);}else{var _0x19fde5=[];var _0x1c064e=[];var _0x514685={};for(var _0x56b2f5 in _0x12c60f){let _0x531e23=contactItemTypes[_0x3d1d('0x6c')](_0x1099f9=>_0x1099f9[_0x3d1d('0x66')]===_0x56b2f5);let _0x1294f9=contactItemTypes[_0x3d1d('0x6c')](_0x2dbc56=>_0x2dbc56[_0x3d1d('0x66')]+'_description'===_0x56b2f5);if(_['isNil'](_0x531e23)&&_[_0x3d1d('0x1d')](_0x1294f9)){if(_0x12c60f[_0x3d1d('0x6d')](_0x56b2f5)){if(_0x40d393[_0x3d1d('0x69')][_0x205c4a][_0x12c60f[_0x56b2f5]]){var _0x50d9dc=_[_0x3d1d('0x6e')](_0x40d393['data'][_0x205c4a][_0x12c60f[_0x56b2f5]]['replace'](/"/g,'\x27'));switch(_0x56b2f5){case _0x3d1d('0x6f'):var _0x17d09f=moment(_0x50d9dc,_0x3d1d('0xd'),!![]);if(_0x17d09f[_0x3d1d('0x70')]()){_0x1ae110[_0x3d1d('0x1f')]('\x22'+_0x50d9dc+'\x22');}else{_0x19fde5['push'](_0x3d1d('0x71'));}break;case _0x3d1d('0x38'):var _0x47a0a0=parseInt(_0x50d9dc);_0x50d9dc=_[_0x3d1d('0x72')](_0x47a0a0)||_0x47a0a0<0x0||_0x47a0a0>0x4?_0x3ee563?0x3:0x2:_0x47a0a0;_0x1ae110['push']('\x22'+_0x50d9dc+'\x22');break;case'UserId':var _0x51fef0=parseInt(_0x50d9dc);if(_['isNumber'](_0x51fef0)&&_[_0x3d1d('0x73')](_0x26c51e,_0x51fef0)){_0x1ae110[_0x3d1d('0x1f')]('\x22'+_0x51fef0+'\x22');}else{_0x19fde5[_0x3d1d('0x1f')](_0x3d1d('0x74'));}break;case _0x3d1d('0x75'):if(isEmail(_0x50d9dc)){_0x1ae110[_0x3d1d('0x1f')]('\x22'+_0x50d9dc+'\x22');}else{_0x19fde5[_0x3d1d('0x1f')](_0x3d1d('0x76'));}break;case _0x3d1d('0x77'):var _0x31d9ab=moment(_0x50d9dc,'YYYY-MM-DD',!![]);if(_0x31d9ab[_0x3d1d('0x70')]()){_0x1ae110['push']('\x22'+_0x50d9dc+'\x22');}else{_0x19fde5[_0x3d1d('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1ae110[_0x3d1d('0x1f')]('\x22'+_0x50d9dc+'\x22');}}else{switch(_0x56b2f5){case _0x3d1d('0x78'):case _0x3d1d('0x13'):_0x19fde5[_0x3d1d('0x1f')](_0x56b2f5+'\x20not\x20specified');break;default:_0x1ae110[_0x3d1d('0x1f')]('\x22\x22');}}}}else{var _0x121694='';if(!_['isNil'](_0x531e23)){if(!_0x514685[_0x3d1d('0x6d')](_0x531e23['id'])){for(var _0x28c220=0x0;_0x28c220<_0x12c60f[_0x56b2f5][_0x3d1d('0x1c')];_0x28c220++){var _0x50d9dc=_[_0x3d1d('0x6e')](_0x40d393[_0x3d1d('0x69')][_0x205c4a][_0x12c60f[_0x56b2f5][_0x28c220]][_0x3d1d('0x79')](/"/g,'\x27'));var _0x4e429b=phoneDescriptions[_0x3d1d('0x6c')](_0x2c4d94=>_0x2c4d94[_0x3d1d('0x7a')]===_0x531e23['id']);if(!_[_0x3d1d('0x1d')](_0x4e429b)){var _0x5cd169=_[_0x3d1d('0x6e')](_0x40d393[_0x3d1d('0x69')][_0x205c4a][_0x12c60f[_0x4e429b[_0x3d1d('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x5cd169))_0x50d9dc=_0x50d9dc+'§'+_0x5cd169;}if(_0x121694=='')_0x121694=_0x50d9dc;else _0x121694+='|'+_0x50d9dc;}_0x1c064e[_0x3d1d('0x1f')](_0x531e23['id']+':'+_0x121694);_0x514685[_0x531e23['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1ae110['push']('\x22'+_0x1c064e['join'](';')+'\x22');}if(_0x19fde5[_0x3d1d('0x1c')]){handleError(_0x40d393[_0x3d1d('0x69')][_0x205c4a],{'code':'SystemRow','message':_0x19fde5[_0x3d1d('0x15')]()});}else{fs[_0x3d1d('0x7c')](_0x559232,_0x1ae110['join']()+'\x0a');}_0x1ae110=[];}if(!(stats[_0x3d1d('0x6a')]%0xc8)){socket[_0x3d1d('0x7d')](_0x3d1d('0x7e')+_0x4c9a53,stats);stats[_0x3d1d('0x6b')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x5d8609['abort']();}}catch(_0x46338d){handleError(_0x40d393[_0x3d1d('0x69')][_0x205c4a],{'code':_0x3d1d('0x7f'),'message':_0x46338d[_0x3d1d('0x22')]});logger[_0x3d1d('0x57')]('step',_0x46338d['message']);}},'complete':function(){try{var _0x4aac07=[];var _0x1692af=tempTableName;_0x4aac07[_0x3d1d('0x1f')](_0x3d1d('0x80')+_0x1692af+_0x3d1d('0x81'));logger[_0x3d1d('0x56')](_0x3d1d('0x82'),contactItemTypes['length']);var _0x13dfc0=util['format'](_0x3d1d('0x83'),_0x559232,_0x1692af,_0x4e75e0,_0xc4e01f[_0x3d1d('0x35')],_0xc4e01f['CompanyId']||null,NOW,NOW);if(_[_0x3d1d('0x1d')](_0x12c60f['scheduledat'])){_0x13dfc0+=_0x3d1d('0x84');}_0x4aac07['push'](_0x13dfc0);BPromise[_0x3d1d('0x85')](_0x4aac07,handleQuery)[_0x3d1d('0x21')](function(_0x2c39b4){BPromise['all']([handleAdditionalPhones()])[_0x3d1d('0x21')](function(){_0x4aac07=[];for(var _0x322989=0x0;_0x322989\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','lodash','util','bluebird','moment','ioredis','../../../config/environment','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','split','filter','CmContactHasItem','update','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','fromQuery','cm_hopper_black','cm_hopper.id','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts','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','CompanyId'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x2c91,0xe0));var _0x12c9=function(_0x582c52,_0x4b4d69){_0x582c52=_0x582c52-0x0;var _0x5c1fd7=_0x2c91[_0x582c52];return _0x5c1fd7;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x12c9('0x0'));var Papa=require('papaparse');var util=require(_0x12c9('0x1'));var BPromise=require(_0x12c9('0x2'));var moment=require(_0x12c9('0x3'));var squel=require('squel');var Redis=require(_0x12c9('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x12c9('0x5'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x12c9('0x6')](config[_0x12c9('0x7')],{'host':_0x12c9('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12c9('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x12c9('0x9'));var tempTableName=_0x12c9('0xa')+moment()['format'](_0x12c9('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3e7ca8){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))*$/[_0x12c9('0xc')](_0x3e7ca8);}function selectNotIn(_0x3325ce,_0x2cad41,_0x367a1f,_0x420bbd,_0x6bec6e){return squel[_0x12c9('0xd')]()[_0x12c9('0xe')](_0x12c9('0xf'))[_0x12c9('0x10')](_0x420bbd)[_0x12c9('0x11')](_0x2cad41,null,_0x2cad41+_0x12c9('0x12')+_0x420bbd+'.'+_0x367a1f)['where'](_0x420bbd+'.'+_0x367a1f+_0x12c9('0x13')+_0x3325ce+'.'+_0x367a1f)[_0x12c9('0x14')](_0x2cad41+_0x12c9('0x15')+_0x6bec6e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x38c297,_0xd20d4e){promisesAdditionalPhones=[];promisesContact=[];return db[_0x12c9('0x16')]['query'](_0x12c9('0x17')+tempTableName)[_0x12c9('0x18')](function(_0x1d4222){if(_0x1d4222!==null){var _0x4877c2=[];for(var _0x3828d4=0x0;_0x3828d4<_0x1d4222[_0x12c9('0x19')];_0x3828d4++){var _0xc440fc=_0x1d4222[_0x3828d4];if(!_[_0x12c9('0x1a')](_0xc440fc[_0x12c9('0xf')])){if(!_[_0x12c9('0x1a')](_0xc440fc['AdditionalPhones']))_0x4877c2[_0x12c9('0x1b')](insertAdditionalPhones(_0xc440fc));promisesContact[_0x12c9('0x1b')]({'contact':_0xc440fc});}}}Promise[_0x12c9('0x1c')](_0x4877c2)[_0x12c9('0x1d')](function(){_0x38c297({'val':0x1});});})[_0x12c9('0x1e')](function(_0x222ffe){logger['error'](_0x222ffe['message']);});});}function insertAdditionalPhones(_0x548564){return new Promise(function(_0x260b85,_0x4009a9){var _0x37a3a9=_0x548564['AdditionalPhones'];if(_[_0x12c9('0x1a')](_0x37a3a9))_0x4009a9({'val':0x0});else{var _0x11c778=_0x37a3a9[_0x12c9('0x1f')](';');var _0x595234=[];orderBy=0x0;for(var _0x2e7f82=0x0;_0x2e7f82<_0x11c778[_0x12c9('0x19')];_0x2e7f82++){_0x595234[_0x12c9('0x1b')](splitAdditionalPhone(_0x548564['id'],_0x11c778[_0x2e7f82]));}Promise[_0x12c9('0x1c')](_0x595234)['then'](function(){_0x260b85({'val':_0x11c778[_0x12c9('0x19')]});});}});}function splitAdditionalPhone(_0x47cd3c,_0x2e1fa6){return new Promise(function(_0x2859dc,_0x30998f){var _0x4735e5=_0x2e1fa6['split'](':');var _0x15f747=_0x4735e5[0x0];var _0x2f0ca9=_0x4735e5[0x1];if(_0x2f0ca9!==''){var _0x1deecf=_0x2f0ca9['split']('|');var _0x3fc97b=[];for(var _0x2e9a2c=0x0;_0x2e9a2c<_0x1deecf[_0x12c9('0x19')];_0x2e9a2c++){if(_0x1deecf[_0x2e9a2c]!==''){var _0x9c142e=_[_0x12c9('0x20')](promisesAdditionalPhones,{'contactId':_0x47cd3c,'phone':_0x1deecf[_0x2e9a2c]});if(_0x9c142e[_0x12c9('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x12c9('0x1b')]({'contactId':_0x47cd3c,'contactTypeId':_0x15f747,'phone':_0x1deecf[_0x2e9a2c],'orderBy':orderBy});}}}_0x2859dc({'ok':0x1});}else _0x2859dc({'res':0x0});});}function createAdditionalPhone(_0x246850,_0x1f4f09,_0x27b97a,_0x117315){var _0x55deb9='';var _0x3d1da8='';var _0x464812=_0x27b97a[_0x12c9('0x1f')]('§');_0x55deb9=_0x464812[0x0];if(_0x464812[_0x12c9('0x19')]==0x2)_0x3d1da8=_0x464812[0x1];return new Promise(function(_0x3182f3,_0x545e01){return db[_0x12c9('0x21')]['findOne']({'where':{'CmContactId':_0x246850,'item':_0x55deb9}})[_0x12c9('0x1d')](function(_0x184bd8){if(_0x184bd8){return db['CmContactHasItem'][_0x12c9('0x22')]({'ItemTypeId':_0x1f4f09,'description':_0x3d1da8,'OrderBy':_0x117315},{'where':{'CmContactId':_0x246850,'item':_0x55deb9}})[_0x12c9('0x1d')](function(_0x2c368a){_0x3182f3({'res':'updated'});});}else{return db[_0x12c9('0x21')][_0x12c9('0x23')]({'CmContactId':_0x246850,'item':_0x55deb9,'ItemTypeId':_0x1f4f09,'description':_0x3d1da8,'OrderBy':_0x117315,'ItemClass':_0x12c9('0x24')})[_0x12c9('0x1d')](function(_0xc37ef9){_0x3182f3({'res':'inserted'});});}});});}function updateContact(_0x11ee3e){return new Promise(function(_0x1e6293,_0x35aece){var _0x4ceced=_0x11ee3e['id'];delete _0x11ee3e['id'];return db[_0x12c9('0x25')]['update'](_0x11ee3e,{'where':{'id':_0x4ceced}})[_0x12c9('0x1d')](function(_0x365b97){updatedRows+=0x1;return db[_0x12c9('0x26')][_0x12c9('0x22')]({'phone':_0x11ee3e[_0x12c9('0xf')]},{'where':{'ContactId':_0x4ceced}})['then'](function(_0x52e3b0){_0x1e6293({'ret':'OK'});});});});}function insertCmHopper(_0x3d9f89,_0x5bff5b,_0x4d6194,_0x18eb96,_0x395113){var _0x319754=[_0x12c9('0x27'),'cm_contacts.scheduledat',_0x12c9('0x28'),'cm_contacts.ListId',_0x5bff5b+'.'+_0x18eb96,'cm_contacts.createdAt',_0x12c9('0x29'),_0x12c9('0x2a'),'cm_contacts.UserId','\x22'+_0x395113+'\x22'];return squel[_0x12c9('0x2b')]()[_0x12c9('0x2c')](_0x12c9('0x2d'))['fromQuery']([_0x12c9('0xf'),'scheduledat',_0x12c9('0x2e'),_0x12c9('0x2f'),_0x18eb96,_0x12c9('0x30'),_0x12c9('0x31'),'priority','UserId','recallme'],squel[_0x12c9('0xd')]()[_0x12c9('0x32')](_0x319754)['from'](_0x5bff5b)['join']('cm_contacts',null,_0x12c9('0x33')+_0x5bff5b+_0x12c9('0x34'))[_0x12c9('0x11')](_0x4d6194,null,_0x4d6194+_0x12c9('0x12')+_0x5bff5b+'.'+_0x18eb96)['where'](_0x5bff5b+_0x12c9('0x35'),_0x3d9f89)[_0x12c9('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x12c9('0x36'),selectNotIn(_0x5bff5b,_0x4d6194,_0x18eb96,_0x12c9('0x2d'),[_0x12c9('0x37'),_0x12c9('0x38')]))[_0x12c9('0x14')](_0x12c9('0x36'),selectNotIn(_0x5bff5b,_0x4d6194,_0x18eb96,_0x12c9('0x2d'),[_0x12c9('0x37')])))[_0x12c9('0x39')]();}function insertCmHopperBlack(_0x214f34,_0x19963c,_0x4fb64a,_0x4de2ec){var _0x2c5acc=[_0x12c9('0x27'),_0x12c9('0x28'),_0x12c9('0x3a'),_0x19963c+'.'+_0x4de2ec,'cm_contacts.createdAt',_0x12c9('0x29')];return squel['insert']()[_0x12c9('0x2c')]('cm_hopper_black')[_0x12c9('0x3b')]([_0x12c9('0xf'),_0x12c9('0x2e'),_0x12c9('0x2f'),_0x4de2ec,_0x12c9('0x30'),'updatedAt'],squel[_0x12c9('0xd')]()[_0x12c9('0x32')](_0x2c5acc)[_0x12c9('0x10')](_0x19963c)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x19963c+'.CmListId')[_0x12c9('0x11')](_0x4fb64a,null,_0x4fb64a+_0x12c9('0x12')+_0x19963c+'.'+_0x4de2ec)[_0x12c9('0x14')](_0x19963c+_0x12c9('0x35'),_0x214f34)[_0x12c9('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x12c9('0x14')](_0x12c9('0x36'),squel[_0x12c9('0xd')]()[_0x12c9('0xe')](_0x12c9('0xf'))[_0x12c9('0x10')](_0x12c9('0x3c'))[_0x12c9('0x14')]('ListId\x20=\x20?',_0x214f34)[_0x12c9('0x14')](_0x4de2ec+'\x20=\x20?',_0x19963c+'.'+_0x4de2ec)))[_0x12c9('0x39')]();}function insertCmHopperAdditionalPhones(_0x39fb55){var _0xf993a7=[_0x12c9('0x3d'),'cm_contact_has_items.item',_0x12c9('0x3e'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x12c9('0x2b')]()[_0x12c9('0x2c')](_0x12c9('0x3f'))[_0x12c9('0x3b')]([_0x12c9('0x40'),_0x12c9('0xf'),_0x12c9('0x41'),_0x12c9('0x30'),_0x12c9('0x31')],squel['select']()[_0x12c9('0x32')](_0xf993a7)[_0x12c9('0x10')]('cm_hopper')[_0x12c9('0x11')](_0x12c9('0x42'),null,_0x12c9('0x43'))[_0x12c9('0x11')](_0x12c9('0x44'),null,_0x12c9('0x45'))[_0x12c9('0x14')](_0x12c9('0x46'),_0x39fb55)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x3da484,_0x33509b,_0x1c327c,_0x572783){var _0x165a30=_[_0x12c9('0x47')](_[_0x12c9('0x48')](_0x572783),[_0x12c9('0x2f'),_0x12c9('0x49'),_0x12c9('0x30'),_0x12c9('0x31')]);return squel[_0x12c9('0x2b')]()[_0x12c9('0x2c')](_0x12c9('0x42'))[_0x12c9('0x3b')](_0x165a30,squel[_0x12c9('0xd')]()[_0x12c9('0x32')](_0x165a30)[_0x12c9('0x10')](_0x33509b)[_0x12c9('0x14')]('('+_0x1c327c[_0x12c9('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x12c9('0xd')]()[_0x12c9('0x32')](_0x1c327c)['from']('cm_contacts')[_0x12c9('0x14')](_0x12c9('0x4a'),_0x3da484))[_0x12c9('0x14')](_0x12c9('0x4b'),squel[_0x12c9('0xd')]()['field'](_0x12c9('0x4c'),_0x12c9('0x4d'))[_0x12c9('0x10')](_0x33509b)[_0x12c9('0x4e')](_0x1c327c[_0x12c9('0x11')](','))))[_0x12c9('0x39')]();}function handleStop(){logger[_0x12c9('0x4f')](_0x12c9('0x50'));stopped=!![];}function handleUncaughtException(_0x3c0f71){logger['error'](_0x3c0f71['message']);process[_0x12c9('0x51')](0x1);}function handleError(_0x1f86b7,_0x2c9c03){stats[_0x12c9('0x52')]['push']({'name':_0x2c9c03[_0x12c9('0x53')],'message':_0x2c9c03[_0x12c9('0x54')],'row':_0x1f86b7});}function handleQuery(_0x109f81){logger[_0x12c9('0x4f')](_0x109f81);return db[_0x12c9('0x16')][_0x12c9('0x55')](_0x109f81)[_0x12c9('0x18')](function(_0x170130){results['push'](_0x170130);})[_0x12c9('0x1e')](function(_0x22634f){logger[_0x12c9('0x56')](_0x22634f[_0x12c9('0x54')]);});}function main(_0x46f6b4,_0x11c589,_0x281e2e,_0x464da4){logger['info'](_0x12c9('0x57'),_0x46f6b4,JSON[_0x12c9('0x58')](_0x11c589));process[_0x12c9('0x59')]('start');var _0x4fa2b0=_0x11c589[_0x12c9('0x5a')];var _0xa34f1c=_[_0x12c9('0x5b')](_0x4fa2b0);var _0x9fff56=_0x11c589[_0x12c9('0x5c')];var _0x497158=path['join'](config[_0x12c9('0x5d')],_0x12c9('0x5e'),_0x9fff56+_0x12c9('0x5f'));logger[_0x12c9('0x4f')](_0x12c9('0x60'),_0x11c589);db[_0x12c9('0x61')][_0x12c9('0x62')]({'raw':!![],'attributes':['id',_0x12c9('0x63')]})['then'](function(_0x357186){for(var _0x9e197e=0x0;_0x9e197e<_0x357186['length'];_0x9e197e++){if(_0x357186[_0x9e197e][_0x12c9('0x63')]in _0x4fa2b0){contactItemTypes[_0x12c9('0x1b')](_0x357186[_0x9e197e]);delete _0xa34f1c[_0x357186[_0x9e197e][_0x12c9('0x63')]];hasAdditionalPhones=!![];}for(var _0x512ba2 in _0x4fa2b0){if(_0x357186[_0x9e197e][_0x12c9('0x63')]+'_description'===_0x512ba2){phoneDescriptions['push']({'itemTypeId':_0x357186[_0x9e197e]['id'],'description':_0x512ba2});delete _0xa34f1c[_0x512ba2];}}}if(hasAdditionalPhones)_0xa34f1c[_0x12c9('0x64')]='';var _0x4625cc=_[_0x12c9('0x48')](_0xa34f1c)[_0x12c9('0x11')]();logger[_0x12c9('0x4f')](_0x12c9('0x65'),_0x4625cc);fs['writeFileSync'](_0x497158,_0x4625cc+'\x0a');Papa[_0x12c9('0x66')](fs[_0x12c9('0x67')](_0x46f6b4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d2338,_0x28e628){try{for(var _0x46755f=0x0,_0x44a739=[];_0x46755f<_0x3d2338[_0x12c9('0x68')]['length'];_0x46755f++){stats['rows']+=0x1;if(_0x3d2338[_0x12c9('0x52')][_0x46755f]){handleError(_0x3d2338[_0x12c9('0x68')][_0x46755f],_0x3d2338[_0x12c9('0x52')][_0x46755f]);}else{var _0x236aa8=[];var _0x5f01bf=[];var _0x50de9f={};for(var _0x51cf12 in _0x4fa2b0){let _0x24d3ee=contactItemTypes['find'](_0x4ba2b8=>_0x4ba2b8[_0x12c9('0x63')]===_0x51cf12);let _0x314fea=contactItemTypes[_0x12c9('0x69')](_0x426d13=>_0x426d13[_0x12c9('0x63')]+_0x12c9('0x6a')===_0x51cf12);if(_[_0x12c9('0x1a')](_0x24d3ee)&&_['isNil'](_0x314fea)){if(_0x4fa2b0[_0x12c9('0x6b')](_0x51cf12)){if(_0x3d2338[_0x12c9('0x68')][_0x46755f][_0x4fa2b0[_0x51cf12]]){var _0x588441=_[_0x12c9('0x6c')](_0x3d2338[_0x12c9('0x68')][_0x46755f][_0x4fa2b0[_0x51cf12]]['replace'](/"/g,'\x27'));switch(_0x51cf12){case _0x12c9('0x6d'):var _0x103673=moment(_0x588441,_0x12c9('0x9'),!![]);if(_0x103673[_0x12c9('0x6e')]()){_0x44a739['push']('\x22'+_0x588441+'\x22');}else{_0x236aa8[_0x12c9('0x1b')](_0x12c9('0x6f'));}break;case _0x12c9('0x70'):var _0x3a7fbe=parseInt(_0x588441);_0x588441=_['isNaN'](_0x3a7fbe)||_0x3a7fbe<0x0||_0x3a7fbe>0x4?_0x464da4?0x3:0x2:_0x3a7fbe;_0x44a739[_0x12c9('0x1b')]('\x22'+_0x588441+'\x22');break;case'UserId':var _0x360bd7=parseInt(_0x588441);if(_[_0x12c9('0x71')](_0x360bd7)&&_[_0x12c9('0x72')](_0x281e2e,_0x360bd7)){_0x44a739[_0x12c9('0x1b')]('\x22'+_0x360bd7+'\x22');}else{_0x236aa8[_0x12c9('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x588441)){_0x44a739[_0x12c9('0x1b')]('\x22'+_0x588441+'\x22');}else{_0x236aa8[_0x12c9('0x1b')](_0x12c9('0x73'));}break;case _0x12c9('0x74'):var _0x42db71=moment(_0x588441,_0x12c9('0x75'),!![]);if(_0x42db71['isValid']()){_0x44a739[_0x12c9('0x1b')]('\x22'+_0x588441+'\x22');}else{_0x236aa8[_0x12c9('0x1b')](_0x12c9('0x76'));}break;default:_0x44a739[_0x12c9('0x1b')]('\x22'+_0x588441+'\x22');}}else{switch(_0x51cf12){case _0x12c9('0x77'):case'phone':_0x236aa8[_0x12c9('0x1b')](_0x51cf12+_0x12c9('0x78'));break;default:_0x44a739[_0x12c9('0x1b')]('\x22\x22');}}}}else{var _0x3dff77='';if(!_[_0x12c9('0x1a')](_0x24d3ee)){if(!_0x50de9f[_0x12c9('0x6b')](_0x24d3ee['id'])){for(var _0x49b81a=0x0;_0x49b81a<_0x4fa2b0[_0x51cf12][_0x12c9('0x19')];_0x49b81a++){var _0x588441=_[_0x12c9('0x6c')](_0x3d2338[_0x12c9('0x68')][_0x46755f][_0x4fa2b0[_0x51cf12][_0x49b81a]]['replace'](/"/g,'\x27'));var _0x24b451=phoneDescriptions[_0x12c9('0x69')](_0x43355c=>_0x43355c['itemTypeId']===_0x24d3ee['id']);if(!_['isNil'](_0x24b451)){var _0x3f02ca=_[_0x12c9('0x6c')](_0x3d2338['data'][_0x46755f][_0x4fa2b0[_0x24b451[_0x12c9('0x79')]][0x0]][_0x12c9('0x7a')](/"/g,'\x27'));if(!_[_0x12c9('0x1a')](_0x3f02ca))_0x588441=_0x588441+'§'+_0x3f02ca;}if(_0x3dff77=='')_0x3dff77=_0x588441;else _0x3dff77+='|'+_0x588441;}_0x5f01bf[_0x12c9('0x1b')](_0x24d3ee['id']+':'+_0x3dff77);_0x50de9f[_0x24d3ee['id']]=0x1;}}}}if(hasAdditionalPhones){_0x44a739[_0x12c9('0x1b')]('\x22'+_0x5f01bf[_0x12c9('0x11')](';')+'\x22');}if(_0x236aa8['length']){handleError(_0x3d2338[_0x12c9('0x68')][_0x46755f],{'code':_0x12c9('0x7b'),'message':_0x236aa8[_0x12c9('0x11')]()});}else{fs[_0x12c9('0x7c')](_0x497158,_0x44a739[_0x12c9('0x11')]()+'\x0a');}_0x44a739=[];}if(!(stats[_0x12c9('0x7d')]%0xc8)){socket[_0x12c9('0x7e')]('contact:import:'+_0x9fff56,stats);stats[_0x12c9('0x52')]=[];}}if(stopped){logger[_0x12c9('0x4f')](_0x12c9('0x7f'));_0x28e628[_0x12c9('0x80')]();}}catch(_0x56f06a){handleError(_0x3d2338['data'][_0x46755f],{'code':'SystemError','message':_0x56f06a['message']});logger[_0x12c9('0x56')](_0x12c9('0x81'),_0x56f06a[_0x12c9('0x54')]);}},'complete':function(){try{var _0x5e7a92=[];var _0x3eea13=tempTableName;_0x5e7a92['push'](_0x12c9('0x82')+_0x3eea13+'\x20LIKE\x20cm_contacts;');logger[_0x12c9('0x4f')]('CIS\x20len',contactItemTypes[_0x12c9('0x19')]);var _0x45bd4c=util[_0x12c9('0x83')](_0x12c9('0x84'),_0x497158,_0x3eea13,_0x4625cc,_0x11c589[_0x12c9('0x2f')],_0x11c589['CompanyId']||null,NOW,NOW);if(_[_0x12c9('0x1a')](_0x4fa2b0[_0x12c9('0x6d')])){_0x45bd4c+=',\x20scheduledAt\x20=\x20NOW()';}_0x5e7a92[_0x12c9('0x1b')](_0x45bd4c);BPromise[_0x12c9('0x85')](_0x5e7a92,handleQuery)[_0x12c9('0x1d')](function(_0x1a3942){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x5e7a92=[];for(var _0x371f3a=0x0;_0x371f3a\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','findOne','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','left_join','u.id\x20=\x20ui.UserId','length','where','getInteractionsTables','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','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','buildExpression','type','value','end','unreadMessages','read','and','Contact','operator','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','contact','text','Tag','map','tags','User','$substring','user','UserId','start','body','keys','compact','\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','resolve','then','clause','filter','Websites','agent','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','i.substatus','join','capitalize','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.thirdDisposition','i.MailAccountId','i.UserId'];(function(_0x5093bc,_0x49b180){var _0x31f82d=function(_0x1bad21){while(--_0x1bad21){_0x5093bc['push'](_0x5093bc['shift']());}};_0x31f82d(++_0x49b180);}(_0x4907,0x14f));var _0x7490=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4907[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7490('0x0'));var squel=require(_0x7490('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x7490('0x2'));var updateInteraction=require(_0x7490('0x3'))[_0x7490('0x4')];var utils=require(_0x7490('0x5'));var db=require(_0x7490('0x6'))['db'];function skipInteractionsQuery(_0x27cba5,_0x2293ba,_0x21527e){var _0x3d4b42=![];var _0x4f0fe2=utils[_0x7490('0x7')](_0x27cba5);if(_0x2293ba[_0x7490('0x8')]==='agent'&&!_0x21527e[_0x7490('0x9')]&&!_0x21527e[_0x4f0fe2]){_0x3d4b42=!![];}return _0x3d4b42;}function getTagsQuery(){return squel[_0x7490('0xa')]()[_0x7490('0xb')]('id')[_0x7490('0xb')](_0x7490('0xc'))['field'](_0x7490('0xd'))[_0x7490('0xe')](_0x7490('0xf'));}function getUsersQuery(_0x226de7,_0x4e26a7){var _0x4c0e20=utils[_0x7490('0x10')](_0x226de7);var _0x51aa4d='user_has_'+_0x226de7+_0x7490('0x11');var _0x4ee49e=squel['select']()[_0x7490('0xb')](_0x7490('0x12'))[_0x7490('0xb')](_0x7490('0x13'))[_0x7490('0xb')]('ui.'+_0x4c0e20)[_0x7490('0xe')](_0x51aa4d,'ui')[_0x7490('0x14')]('users','u',_0x7490('0x15'));if(_0x4e26a7[_0x7490('0x16')]>0x0){_0x4ee49e[_0x7490('0x17')]('ui.'+_0x4c0e20+'\x20IN\x20?',_['map'](_0x4e26a7,'id'));}return _0x4ee49e;}function getInteractionsQuery(_0x3dc581){var _0x3d36ea=utils[_0x7490('0x18')](_0x3dc581);var _0x508c16=utils[_0x7490('0x7')](_0x3dc581);var _0xbbfc91=utils['getInteractionFK'](_0x3dc581);return squel[_0x7490('0xa')]()['from'](_0x3d36ea[_0x7490('0x19')],'i')['left_join'](_0x7490('0x1a'),'c',_0x7490('0x1b'))[_0x7490('0x14')](_0x7490('0x1c'),'o',_0x7490('0x1d'))[_0x7490('0x14')](_0x3d36ea[_0x7490('0x1e')],'a','a.id\x20=\x20i.'+_0x508c16)[_0x7490('0x14')](_0x3d36ea[_0x7490('0x1f')],'me',_0x7490('0x20')+_0xbbfc91+_0x7490('0x21'))[_0x7490('0x14')](_0x3d36ea['interactionsTags'],'it','it.'+_0xbbfc91+'\x20=\x20i.id')[_0x7490('0x14')](_0x7490('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x59fe9a={'body':squel[_0x7490('0x22')](),'contact':squel['expr'](),'default':squel[_0x7490('0x22')](),'fields':squel[_0x7490('0x22')](),'filter':squel[_0x7490('0x22')](),'read':squel[_0x7490('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x59fe9a;}function parseTagParameter(_0x51e1a7){var _0x496c94=squel['expr']();if(_0x51e1a7){var _0x1b2d38=utils[_0x7490('0x23')](_0x51e1a7);_0x1b2d38[_0x7490('0x24')](function(_0x157cdc){_0x496c94['or'](_0x7490('0x25'),'%,'+_0x157cdc+',%');});}return _0x496c94;}function parseReadParameter(_0x373c28){var _0x3d1631='';if(_0x373c28){_0x3d1631=_0x7490('0x26');if(_0x373c28==='1'){_0x3d1631=_0x3d1631[_0x7490('0x27')](_0x7490('0x28'),'=');}else{_0x3d1631=_0x3d1631[_0x7490('0x27')](_0x7490('0x28'),'>');}}return _0x3d1631;}function parseSearchFilter(_0x492615,_0x399d42){var _0x4cf845=squel[_0x7490('0x22')]();if(_0x399d42){var _0x1a258c=_0x399d42[_0x7490('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7490('0x29')](_0x1a258c)){_0x4cf845['or']('i.id\x20LIKE\x20?',_0x1a258c+'%');if([_0x7490('0x2a'),'whatsapp']['includes'](_0x492615)){_0x4cf845['or'](_0x7490('0x2b'),_0x1a258c+'%');}else if(_0x492615===_0x7490('0x2c')){_0x4cf845['or'](_0x7490('0x2d'),_0x1a258c+'%');}else if(_0x492615===_0x7490('0x2e')){_0x4cf845['or']('i.from\x20LIKE\x20?',_0x1a258c+'%');}}else if(_0x492615===_0x7490('0x2f')&&qs[_0x7490('0x30')](_0x1a258c)){_0x4cf845['or'](_0x7490('0x31'),_0x1a258c+'%');}else{if(_0x492615===_0x7490('0x2f')){_0x4cf845['or'](_0x7490('0x32'),qs[_0x7490('0x33')](_0x1a258c,!![]))['or'](_0x7490('0x34'),qs['getFullTextValue'](_0x1a258c));}else if(_0x492615!=='fax'){_0x4cf845['or'](_0x7490('0x35'),qs[_0x7490('0x33')](_0x1a258c));}_0x4cf845['or'](_0x7490('0x36'),qs[_0x7490('0x33')](_0x1a258c,!![]),null);}}return _0x4cf845;}function parseAdvancedSearchFilter(_0x4dcc4,_0x50d1b3){var _0x4f44ad=getSqlClauses();var _0x5b25da=as[_0x7490('0x37')](_0x4dcc4);var _0x1e28f3=_0x5b25da['sqlOperator'];for(var _0x404011=0x0;_0x404011<_0x5b25da[_0x7490('0x38')]['length'];_0x404011++){var _0x262828=_0x5b25da[_0x7490('0x38')][_0x404011];var _0x132266='i';var _0x43d9b9=_['find'](_0x50d1b3,[_0x7490('0xc'),_0x262828[_0x7490('0xb')]]);if(_0x43d9b9){var _0x13cf14=as[_0x7490('0x39')](_0x132266,_0x43d9b9[_0x7490('0x3a')],_0x262828);_0x4f44ad['default'][_0x1e28f3](_0x13cf14['text'],_0x13cf14['value']['start'],_0x13cf14[_0x7490('0x3b')][_0x7490('0x3c')]);}else{switch(_0x262828[_0x7490('0xb')]){case _0x7490('0x3d'):var _0x5dfeb2=parseReadParameter(_0x262828[_0x7490('0x3b')]);_0x4f44ad[_0x7490('0x3e')][_0x7490('0x3f')](_0x5dfeb2);break;case _0x7490('0x40'):if(_0x262828[_0x7490('0x41')]==='$substring'){if(_0x262828[_0x7490('0x3b')]['split']('\x20')[_0x7490('0x16')]>0x1){_0x4f44ad['contact'][_0x1e28f3](_0x7490('0x36'),qs[_0x7490('0x33')](_0x262828[_0x7490('0x3b')],!![]),null);}else{var _0xfb8c26='%'+_0x262828[_0x7490('0x3b')]+'%';_0x4f44ad['contact'][_0x1e28f3](_0x7490('0x42'),_0xfb8c26,_0xfb8c26,_0xfb8c26);}}else{_0x43d9b9=_[_0x7490('0x43')](_0x50d1b3,['name','ContactId']);_0x262828['field']=_0x7490('0x44');_0x13cf14=as['buildExpression'](_0x132266,_0x43d9b9['type'],_0x262828);_0x4f44ad[_0x7490('0x45')][_0x1e28f3](_0x13cf14[_0x7490('0x46')],_0x13cf14[_0x7490('0x3b')]['start'],_0x13cf14[_0x7490('0x3b')][_0x7490('0x3c')]);}break;case _0x7490('0x47'):var _0x9741d8=_0x262828[_0x7490('0x3b')]['split'](',')[_0x7490('0x48')](function(_0x513ea4){return Number(_0x513ea4);});var _0x56814d=parseTagParameter(_0x9741d8);_0x4f44ad['tags']['clause'][_0x7490('0x3f')](_0x56814d);_0x4f44ad[_0x7490('0x49')]['ids']=_0x9741d8;break;case _0x7490('0x4a'):if(_0x262828[_0x7490('0x41')]===_0x7490('0x4b')){_0x4f44ad[_0x7490('0x4c')][_0x1e28f3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x262828[_0x7490('0x3b')]+'%',null);}else{_0x43d9b9=_[_0x7490('0x43')](_0x50d1b3,[_0x7490('0xc'),'UserId']);_0x262828['field']=_0x7490('0x4d');_0x13cf14=as[_0x7490('0x39')](_0x132266,_0x43d9b9[_0x7490('0x3a')],_0x262828);_0x4f44ad[_0x7490('0x4c')][_0x1e28f3](_0x13cf14[_0x7490('0x46')],_0x13cf14['value'][_0x7490('0x4e')],_0x13cf14['value'][_0x7490('0x3c')]);}break;case _0x7490('0x4f'):case'plainBody':_0x13cf14=as['buildExpression']('me',null,_0x262828);_0x4f44ad[_0x7490('0x4f')][_0x1e28f3](_0x13cf14[_0x7490('0x46')],_0x13cf14[_0x7490('0x3b')][_0x7490('0x4e')],_0x13cf14[_0x7490('0x3b')]['end']);break;}}}return _0x4f44ad;}function parseModelFields(_0x1b4d36,_0x43853c,_0x4471b5){var _0x18c747=utils[_0x7490('0x7')](_0x1b4d36);var _0x7d0341=squel[_0x7490('0x22')]();var _0x3904ea=_(_0x43853c)[_0x7490('0x50')]()[_0x7490('0x48')](function(_0x24c248){return _['some'](_0x4471b5,[_0x7490('0xc'),_0x24c248])?_0x24c248:undefined;})[_0x7490('0x51')]()[_0x7490('0x3b')]();if(_0x3904ea[_0x7490('0x16')]>0x0){_0x3904ea['forEach'](function(_0x477244){if(_0x477244===_0x18c747){_0x7d0341[_0x7490('0x3f')]('i.'+_0x18c747+_0x7490('0x52'),[]['concat'](_0x43853c[_0x477244]));}else if(_0x477244===_0x7490('0x53')){var _0x2f8bb4=JSON[_0x7490('0x54')](_0x43853c[_0x477244])['$gte'];var _0x32880e=JSON[_0x7490('0x54')](_0x43853c[_0x477244])[_0x7490('0x55')];_0x7d0341[_0x7490('0x3f')](_0x7490('0x56'),_0x2f8bb4,_0x32880e);}else{if(_0x43853c[_0x477244]==='null'){_0x7d0341['and']('i.'+_0x477244+'\x20IS\x20NULL');}else{_0x7d0341[_0x7490('0x3f')]('i.'+_0x477244+_0x7490('0x57'),_0x43853c[_0x477244]);}}});}return _0x7d0341;}function parseQueryParameters(_0x1a2a17,_0x39f3cc,_0xbf2c65){var _0x331376=getSqlClauses();return Promise[_0x7490('0x58')]()[_0x7490('0x59')](function(){return parseModelFields(_0x1a2a17,_0x39f3cc,_0xbf2c65);})[_0x7490('0x59')](function(_0x5b10ad){_0x331376['fields'][_0x7490('0x3f')](_0x5b10ad);return parseReadParameter(_0x39f3cc[_0x7490('0x3e')]);})[_0x7490('0x59')](function(_0x4e9ade){_0x331376[_0x7490('0x3e')]['and'](_0x4e9ade);return parseTagParameter(_0x39f3cc['tag']);})[_0x7490('0x59')](function(_0x44e624){_0x331376[_0x7490('0x49')][_0x7490('0x5a')][_0x7490('0x3f')](_0x44e624);return parseSearchFilter(_0x1a2a17,_0x39f3cc[_0x7490('0x5b')]);})[_0x7490('0x59')](function(_0x49a1c5){_0x331376['filter']=_0x49a1c5;return _0x331376;});}function checkAccountsRestrictions(_0x3de535,_0x192f8b,_0x8aed9){var _0x3f313d=utils[_0x7490('0x7')](_0x3de535);var _0x423b63='get'+_['capitalize'](_0x3de535)+(_0x3de535==='chat'?_0x7490('0x5c'):'Accounts');var _0x1d8164=squel[_0x7490('0x22')]();return Promise[_0x7490('0x58')]()[_0x7490('0x59')](function(){if(_0x8aed9[_0x7490('0x9')]&&_0x192f8b[_0x7490('0x8')]===_0x7490('0x5d')){return _0x192f8b[_0x423b63]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4baf42){if(_0x4baf42){if(_0x4baf42[_0x7490('0x16')]===0x0){_0x1d8164['and']('i.'+_0x3f313d+_0x7490('0x5e'));}else{_0x1d8164['and']('i.'+_0x3f313d+_0x7490('0x52'),_[_0x7490('0x48')](_0x4baf42,'id'));}}else if(!_0x8aed9[_0x3f313d]){_0x1d8164[_0x7490('0x3f')]('i.'+_0x3f313d+_0x7490('0x5f'));}})[_0x7490('0x59')](function(){return _0x1d8164;});}function getClosedOrderClause(_0x44cbd7,_0x14c9fc){var _0xd3a005='';var _0x130f82=['i.thirdDisposition',_0x7490('0x60'),_0x7490('0x61')];if(_0x44cbd7===_0x7490('0x2f')){_0x130f82['unshift'](_0x7490('0x62'));}if(_0x14c9fc['closed']==='0'&&_0x44cbd7===_0x7490('0x2f')){_0xd3a005=_0x7490('0x62');}else{if(_0x14c9fc['closed']==='1'){_0x130f82['shift']();}_0xd3a005='CONCAT_WS(\x27\x27,\x20'+_0x130f82[_0x7490('0x63')](',\x20')+')';}return _0xd3a005;}function getFilteredInteractions(_0x5bfb54,_0x3c6573,_0x252789,_0xc0f26b){var _0x1ffdd0=utils['getInteractionFK'](_0x5bfb54);var _0x4bc55b=_[_0x7490('0x64')](_0x5bfb54)+'Interaction';var _0x120539=[];var _0x12d131=getTagsQuery();var _0x2c094d={'type':db[_0x7490('0x65')][_0x7490('0x66')]['SELECT'],'raw':!![]};var _0x237fab=[];var _0x347472=[];return db[_0x7490('0x67')][_0x7490('0x68')](_0x12d131[_0x7490('0x69')](),_0x2c094d)['then'](function(_0x5a1ef1){_0x120539=_[_0x7490('0x6a')](_0x5a1ef1,'id');_0x2c094d=_[_0x7490('0x6b')](_0x2c094d,{'model':db[_0x4bc55b],'mapToModel':!![],'nest':!![]});if(_0x252789[_0x7490('0x6c')]){_0xc0f26b['attributes'][_0x7490('0x24')](function(_0x4b991c){_0x3c6573[_0x7490('0xb')]('i.'+_0x4b991c);});}else{_0x3c6573[_0x7490('0xb')](_0x7490('0x6d'),'unreadMessages');_0x3c6573[_0x7490('0xb')](_0x7490('0x6e'),_0x7490('0x6f'));_0x3c6573[_0x7490('0xb')](_0x7490('0x70'),_0x7490('0x71'));if(_0x5bfb54===_0x7490('0x2f')){_0x3c6573[_0x7490('0xb')]('a.email',_0x7490('0x72'));_0x3c6573[_0x7490('0xb')](_0x7490('0x73'),'contactName');_0x3c6573[_0x7490('0xb')]('i.id');_0x3c6573[_0x7490('0xb')](_0x7490('0x74'));_0x3c6573['field'](_0x7490('0x75'));_0x3c6573[_0x7490('0xb')](_0x7490('0x76'));_0x3c6573[_0x7490('0xb')](_0x7490('0x77'));_0x3c6573[_0x7490('0xb')]('i.attach');_0x3c6573[_0x7490('0xb')](_0x7490('0x78'));_0x3c6573[_0x7490('0xb')]('i.lastMsgDirection');_0x3c6573[_0x7490('0xb')]('i.subject');_0x3c6573[_0x7490('0xb')](_0x7490('0x61'));_0x3c6573[_0x7490('0xb')](_0x7490('0x60'));_0x3c6573['field'](_0x7490('0x79'));_0x3c6573['field'](_0x7490('0x62'));_0x3c6573['field']('i.to');_0x3c6573[_0x7490('0xb')]('i.ContactId');_0x3c6573[_0x7490('0xb')](_0x7490('0x7a'));_0x3c6573[_0x7490('0xb')](_0x7490('0x7b'));}else if(_0x5bfb54===_0x7490('0x2e')){_0x3c6573[_0x7490('0xb')](_0x7490('0x7c'),_0x7490('0x7d'));}else{_0x3c6573[_0x7490('0xb')](_0x7490('0x7e'),_0x7490('0x7d'));}if(_0x5bfb54!=='mail'){_0x3c6573[_0x7490('0xb')](_0x7490('0x7f'));}_0x3c6573['field'](_0x7490('0x80'),_0x7490('0x81'));_0x3c6573['field'](_0x7490('0x82'),_0x7490('0x83'));_0x3c6573['field'](_0x7490('0x84'),'Contact.email');_0x3c6573[_0x7490('0xb')]('c.phone','Contact.phone');_0x3c6573['field'](_0x7490('0x85'),_0x7490('0x86'));_0x3c6573[_0x7490('0xb')](_0x7490('0x87'),_0x7490('0x88'));_0x3c6573[_0x7490('0xb')](_0x7490('0x89'),_0x7490('0x8a'));_0x3c6573[_0x7490('0xb')](_0x7490('0x8b'),_0x7490('0x8c'));_0x3c6573[_0x7490('0xb')](_0x7490('0x8d'),_0x7490('0x8e'));}if(_0xc0f26b[_0x7490('0x8f')]){_0x3c6573['limit'](_0xc0f26b[_0x7490('0x8f')]);}if(_0xc0f26b[_0x7490('0x90')]){_0x3c6573[_0x7490('0x90')](_0xc0f26b['offset']);}return db[_0x7490('0x67')]['query'](_0x3c6573[_0x7490('0x69')](),_0x2c094d);})['then'](function(_0x9195d){_0x237fab=_0x9195d;var _0x16b2bf=getUsersQuery(_0x5bfb54,_0x237fab);return db[_0x7490('0x67')]['query'](_0x16b2bf['toString'](),_0x2c094d);})[_0x7490('0x59')](function(_0x1e8236){_0x347472=_['groupBy'](_0x1e8236,_0x1ffdd0);if(_0x5bfb54===_0x7490('0x2f')){return db['Setting'][_0x7490('0x91')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x7490('0x59')](function(_0x3b79f0){var _0x547bbd=_0x3b79f0?_0x3b79f0['enableEmailPreview']:undefined;var _0x1459fb=_0x237fab[_0x7490('0x48')](function(_0x1e1539){return updateInteraction(_0x1e1539,_0x120539,_0x347472,_0x547bbd);});return Promise[_0x7490('0x92')](_0x1459fb);});}function countFilteredInteractions(_0x1aadb2,_0x759356){var _0x47466b=_0x1aadb2[_0x7490('0x93')]();_0x47466b['field'](_0x7490('0x94'));_0x47466b[_0x7490('0xb')](_0x7490('0x6d'),'unreadMessages');var _0x513751=utils['getSelectedTags'](_0x759356);if(!_[_0x7490('0x95')](_0x513751)){_0x47466b[_0x7490('0x17')](_0x7490('0x96'),_0x513751);}var _0x190b1a={'type':db['Sequelize']['QueryTypes'][_0x7490('0x97')],'raw':!![]};return db[_0x7490('0x67')][_0x7490('0x68')](_0x47466b[_0x7490('0x69')](),_0x190b1a);}module[_0x7490('0x98')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x599b=['i.id\x20LIKE\x20?','whatsapp','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','read','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.to','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','limit','offset','Setting','findOne','enableEmailPreview','COUNT(*)','t.id\x20IN\x20?','SELECT','exports','lodash','squel','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','agent','select','field','name','from','tools_tags','getInteractionFK','_interactions','u.fullname','ui.','users','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x599b,0x1b5));var _0xb599=function(_0x209cc4,_0xfcdd09){_0x209cc4=_0x209cc4-0x0;var _0x28569d=_0x599b[_0x209cc4];return _0x28569d;};'use strict';var _=require(_0xb599('0x0'));var squel=require(_0xb599('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0xb599('0x2'))[_0xb599('0x3')];var utils=require('./utils');var db=require(_0xb599('0x4'))['db'];function skipInteractionsQuery(_0x527a5b,_0xa85307,_0x134ad6){var _0x3ea560=![];var _0x2979cd=utils[_0xb599('0x5')](_0x527a5b);if(_0xa85307[_0xb599('0x6')]===_0xb599('0x7')&&!_0x134ad6['search']&&!_0x134ad6[_0x2979cd]){_0x3ea560=!![];}return _0x3ea560;}function getTagsQuery(){return squel[_0xb599('0x8')]()[_0xb599('0x9')]('id')[_0xb599('0x9')](_0xb599('0xa'))['field']('color')[_0xb599('0xb')](_0xb599('0xc'));}function getUsersQuery(_0x2562fe,_0x208890){var _0x517c6a=utils[_0xb599('0xd')](_0x2562fe);var _0xcf4307='user_has_'+_0x2562fe+_0xb599('0xe');var _0x196a1f=squel[_0xb599('0x8')]()[_0xb599('0x9')]('u.id')[_0xb599('0x9')](_0xb599('0xf'))[_0xb599('0x9')](_0xb599('0x10')+_0x517c6a)['from'](_0xcf4307,'ui')['left_join'](_0xb599('0x11'),'u','u.id\x20=\x20ui.UserId');if(_0x208890[_0xb599('0x12')]>0x0){_0x196a1f[_0xb599('0x13')](_0xb599('0x10')+_0x517c6a+_0xb599('0x14'),_[_0xb599('0x15')](_0x208890,'id'));}return _0x196a1f;}function getInteractionsQuery(_0x28543d){var _0x4d9e33=utils[_0xb599('0x16')](_0x28543d);var _0x3a5d07=utils[_0xb599('0x5')](_0x28543d);var _0x2e41ca=utils['getInteractionFK'](_0x28543d);return squel['select']()[_0xb599('0xb')](_0x4d9e33[_0xb599('0x17')],'i')[_0xb599('0x18')](_0xb599('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb599('0x18')]('users','o',_0xb599('0x1a'))[_0xb599('0x18')](_0x4d9e33[_0xb599('0x1b')],'a',_0xb599('0x1c')+_0x3a5d07)[_0xb599('0x18')](_0x4d9e33[_0xb599('0x1d')],'me',_0xb599('0x1e')+_0x2e41ca+_0xb599('0x1f'))[_0xb599('0x18')](_0x4d9e33[_0xb599('0x20')],'it',_0xb599('0x21')+_0x2e41ca+_0xb599('0x1f'))[_0xb599('0x18')](_0xb599('0xc'),'t',_0xb599('0x22'));}function getSqlClauses(){var _0x59214e={'body':squel[_0xb599('0x23')](),'contact':squel['expr'](),'default':squel[_0xb599('0x23')](),'fields':squel['expr'](),'filter':squel[_0xb599('0x23')](),'read':squel[_0xb599('0x23')](),'tags':{'clause':squel[_0xb599('0x23')](),'ids':null},'user':squel['expr']()};return _0x59214e;}function parseTagParameter(_0x4c9aea){var _0x2ac35b=squel['expr']();if(_0x4c9aea){var _0x377177=utils[_0xb599('0x24')](_0x4c9aea);_0x377177[_0xb599('0x25')](function(_0x5c8cec){_0x2ac35b['or'](_0xb599('0x26'),'%,'+_0x5c8cec+',%');});}return _0x2ac35b;}function parseReadParameter(_0x2ce78a){var _0x4c6daa='';if(_0x2ce78a){_0x4c6daa=_0xb599('0x27');if(_0x2ce78a==='1'){_0x4c6daa=_0x4c6daa[_0xb599('0x28')](_0xb599('0x29'),'=');}else{_0x4c6daa=_0x4c6daa[_0xb599('0x28')](_0xb599('0x29'),'>');}}return _0x4c6daa;}function parseSearchFilter(_0x59c871,_0x2f3849){var _0x471521=squel[_0xb599('0x23')]();if(_0x2f3849){var _0x1d3a4a=_0x2f3849[_0xb599('0x28')]('\x5c','\x5c\x5c')[_0xb599('0x28')](/'/g,'\x27\x27');if(qs[_0xb599('0x2a')](_0x1d3a4a)){_0x471521['or'](_0xb599('0x2b'),_0x1d3a4a+'%');if(['sms',_0xb599('0x2c')]['includes'](_0x59c871)){_0x471521['or']('i.phone\x20LIKE\x20?',_0x1d3a4a+'%');}else if(_0x59c871==='fax'){_0x471521['or'](_0xb599('0x2d'),_0x1d3a4a+'%');}else if(_0x59c871==='openchannel'){_0x471521['or'](_0xb599('0x2e'),_0x1d3a4a+'%');}}else if(_0x59c871===_0xb599('0x2f')&&qs[_0xb599('0x30')](_0x1d3a4a)){_0x471521['or'](_0xb599('0x31'),_0x1d3a4a+'%');}else{if(_0x59c871==='mail'){_0x471521['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb599('0x32')](_0x1d3a4a,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb599('0x32')](_0x1d3a4a));}else if(_0x59c871!==_0xb599('0x33')){_0x471521['or'](_0xb599('0x34'),qs[_0xb599('0x32')](_0x1d3a4a));}_0x471521['or'](_0xb599('0x35'),qs[_0xb599('0x32')](_0x1d3a4a,!![]),null);}}return _0x471521;}function parseAdvancedSearchFilter(_0x303ef6,_0x17dc0c){var _0x1f734c=getSqlClauses();var _0x6e74ae=as['parseSearch'](_0x303ef6);var _0x5ae9ce=_0x6e74ae[_0xb599('0x36')];for(var _0x41270e=0x0;_0x41270e<_0x6e74ae['conditions'][_0xb599('0x12')];_0x41270e++){var _0x377e7b=_0x6e74ae[_0xb599('0x37')][_0x41270e];var _0x5b3873='i';var _0x2072e8=_[_0xb599('0x38')](_0x17dc0c,['name',_0x377e7b['field']]);if(_0x2072e8){var _0x1f44b8=as[_0xb599('0x39')](_0x5b3873,_0x2072e8[_0xb599('0x3a')],_0x377e7b);_0x1f734c[_0xb599('0x3b')][_0x5ae9ce](_0x1f44b8[_0xb599('0x3c')],_0x1f44b8[_0xb599('0x3d')][_0xb599('0x3e')],_0x1f44b8[_0xb599('0x3d')][_0xb599('0x3f')]);}else{switch(_0x377e7b['field']){case _0xb599('0x40'):var _0x38e4e6=parseReadParameter(_0x377e7b['value']);_0x1f734c['read'][_0xb599('0x41')](_0x38e4e6);break;case _0xb599('0x42'):if(_0x377e7b[_0xb599('0x43')]===_0xb599('0x44')){if(_0x377e7b[_0xb599('0x3d')][_0xb599('0x45')]('\x20')[_0xb599('0x12')]>0x1){_0x1f734c[_0xb599('0x46')][_0x5ae9ce]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb599('0x32')](_0x377e7b['value'],!![]),null);}else{var _0x3530d6='%'+_0x377e7b['value']+'%';_0x1f734c[_0xb599('0x46')][_0x5ae9ce](_0xb599('0x47'),_0x3530d6,_0x3530d6,_0x3530d6);}}else{_0x2072e8=_[_0xb599('0x38')](_0x17dc0c,[_0xb599('0xa'),_0xb599('0x48')]);_0x377e7b[_0xb599('0x9')]=_0xb599('0x48');_0x1f44b8=as[_0xb599('0x39')](_0x5b3873,_0x2072e8['type'],_0x377e7b);_0x1f734c[_0xb599('0x46')][_0x5ae9ce](_0x1f44b8[_0xb599('0x3c')],_0x1f44b8[_0xb599('0x3d')]['start'],_0x1f44b8[_0xb599('0x3d')][_0xb599('0x3f')]);}break;case _0xb599('0x49'):var _0x406e78=_0x377e7b['value'][_0xb599('0x45')](',')[_0xb599('0x15')](function(_0x4f27c4){return Number(_0x4f27c4);});var _0x56ecb3=parseTagParameter(_0x406e78);_0x1f734c['tags'][_0xb599('0x4a')][_0xb599('0x41')](_0x56ecb3);_0x1f734c['tags']['ids']=_0x406e78;break;case _0xb599('0x4b'):if(_0x377e7b[_0xb599('0x43')]===_0xb599('0x44')){_0x1f734c[_0xb599('0x4c')][_0x5ae9ce](_0xb599('0x4d'),'%'+_0x377e7b[_0xb599('0x3d')]+'%',null);}else{_0x2072e8=_[_0xb599('0x38')](_0x17dc0c,[_0xb599('0xa'),'UserId']);_0x377e7b[_0xb599('0x9')]=_0xb599('0x4e');_0x1f44b8=as[_0xb599('0x39')](_0x5b3873,_0x2072e8['type'],_0x377e7b);_0x1f734c[_0xb599('0x4c')][_0x5ae9ce](_0x1f44b8[_0xb599('0x3c')],_0x1f44b8[_0xb599('0x3d')][_0xb599('0x3e')],_0x1f44b8[_0xb599('0x3d')]['end']);}break;case _0xb599('0x4f'):case _0xb599('0x50'):_0x1f44b8=as[_0xb599('0x39')]('me',null,_0x377e7b);_0x1f734c[_0xb599('0x4f')][_0x5ae9ce](_0x1f44b8['text'],_0x1f44b8[_0xb599('0x3d')][_0xb599('0x3e')],_0x1f44b8['value'][_0xb599('0x3f')]);break;}}}return _0x1f734c;}function parseModelFields(_0x19f058,_0x5e40f2,_0x1d38d4){var _0x489935=utils[_0xb599('0x5')](_0x19f058);var _0x4a811c=squel[_0xb599('0x23')]();var _0xa25701=_(_0x5e40f2)['keys']()[_0xb599('0x15')](function(_0xd39c5c){return _[_0xb599('0x51')](_0x1d38d4,['name',_0xd39c5c])?_0xd39c5c:undefined;})[_0xb599('0x52')]()['value']();if(_0xa25701[_0xb599('0x12')]>0x0){_0xa25701[_0xb599('0x25')](function(_0x2170ef){if(_0x2170ef===_0x489935){_0x4a811c['and']('i.'+_0x489935+_0xb599('0x14'),[][_0xb599('0x53')](_0x5e40f2[_0x2170ef]));}else if(_0x2170ef===_0xb599('0x54')){var _0x2df3fa=JSON[_0xb599('0x55')](_0x5e40f2[_0x2170ef])['$gte'];var _0x15dc7e=JSON['parse'](_0x5e40f2[_0x2170ef])[_0xb599('0x56')];_0x4a811c[_0xb599('0x41')](_0xb599('0x57'),_0x2df3fa,_0x15dc7e);}else{if(_0x5e40f2[_0x2170ef]==='null'){_0x4a811c[_0xb599('0x41')]('i.'+_0x2170ef+_0xb599('0x58'));}else{_0x4a811c['and']('i.'+_0x2170ef+_0xb599('0x59'),_0x5e40f2[_0x2170ef]);}}});}return _0x4a811c;}function parseQueryParameters(_0x41a9aa,_0x2b5fd4,_0xf94c86){var _0x2bf5da=getSqlClauses();return Promise['resolve']()[_0xb599('0x5a')](function(){return parseModelFields(_0x41a9aa,_0x2b5fd4,_0xf94c86);})['then'](function(_0x21f652){_0x2bf5da[_0xb599('0x5b')]['and'](_0x21f652);return parseReadParameter(_0x2b5fd4[_0xb599('0x5c')]);})[_0xb599('0x5a')](function(_0x29c490){_0x2bf5da[_0xb599('0x5c')][_0xb599('0x41')](_0x29c490);return parseTagParameter(_0x2b5fd4[_0xb599('0x5d')]);})[_0xb599('0x5a')](function(_0x381fc9){_0x2bf5da['tags'][_0xb599('0x4a')][_0xb599('0x41')](_0x381fc9);return parseSearchFilter(_0x41a9aa,_0x2b5fd4[_0xb599('0x5e')]);})[_0xb599('0x5a')](function(_0x5c51bf){_0x2bf5da['filter']=_0x5c51bf;return _0x2bf5da;});}function checkAccountsRestrictions(_0x1ea580,_0x436477,_0x2384ad){var _0x59649a=utils[_0xb599('0x5')](_0x1ea580);var _0x4a6063=_0xb599('0x5f')+_[_0xb599('0x60')](_0x1ea580)+(_0x1ea580===_0xb599('0x61')?_0xb599('0x62'):_0xb599('0x63'));var _0x263b71=squel[_0xb599('0x23')]();return Promise[_0xb599('0x64')]()[_0xb599('0x5a')](function(){if(_0x2384ad['search']&&_0x436477[_0xb599('0x6')]===_0xb599('0x7')){return _0x436477[_0x4a6063]({'attributes':['id'],'raw':!![]});}})[_0xb599('0x5a')](function(_0x42ca37){if(_0x42ca37){if(_0x42ca37[_0xb599('0x12')]===0x0){_0x263b71[_0xb599('0x41')]('i.'+_0x59649a+_0xb599('0x58'));}else{_0x263b71[_0xb599('0x41')]('i.'+_0x59649a+_0xb599('0x14'),_[_0xb599('0x15')](_0x42ca37,'id'));}}else if(!_0x2384ad[_0x59649a]){_0x263b71['and']('i.'+_0x59649a+_0xb599('0x65'));}})[_0xb599('0x5a')](function(){return _0x263b71;});}function getClosedOrderClause(_0x3898e9,_0x104eec){var _0x4b1ebf='';var _0x45b8b7=[_0xb599('0x66'),_0xb599('0x67'),_0xb599('0x68')];if(_0x3898e9==='mail'){_0x45b8b7['unshift'](_0xb599('0x69'));}if(_0x104eec[_0xb599('0x6a')]==='0'&&_0x3898e9===_0xb599('0x2f')){_0x4b1ebf=_0xb599('0x69');}else{if(_0x104eec[_0xb599('0x6a')]==='1'){_0x45b8b7[_0xb599('0x6b')]();}_0x4b1ebf=_0xb599('0x6c')+_0x45b8b7[_0xb599('0x6d')](',\x20')+')';}return _0x4b1ebf;}function getFilteredInteractions(_0x14c19d,_0x5bd976,_0x3395b1,_0x3c9c42){var _0x1a94a2=utils['getInteractionFK'](_0x14c19d);var _0x821860=_[_0xb599('0x60')](_0x14c19d)+_0xb599('0x6e');var _0x13939a=[];var _0x4395b4=getTagsQuery();var _0x49aec8={'type':db[_0xb599('0x6f')][_0xb599('0x70')]['SELECT'],'raw':!![]};var _0x4aa839=[];var _0x34f5dc=[];return db[_0xb599('0x71')][_0xb599('0x72')](_0x4395b4[_0xb599('0x73')](),_0x49aec8)[_0xb599('0x5a')](function(_0x19a825){_0x13939a=_['keyBy'](_0x19a825,'id');_0x49aec8=_[_0xb599('0x74')](_0x49aec8,{'model':db[_0x821860],'mapToModel':!![],'nest':!![]});if(_0x3395b1[_0xb599('0x5b')]){_0x3c9c42[_0xb599('0x75')]['forEach'](function(_0x4a579b){_0x5bd976[_0xb599('0x9')]('i.'+_0x4a579b);});}else{_0x5bd976['field'](_0xb599('0x76'),_0xb599('0x40'));_0x5bd976[_0xb599('0x9')](_0xb599('0x77'),'Account.key');_0x5bd976[_0xb599('0x9')](_0xb599('0x78'),_0xb599('0x79'));if(_0x14c19d===_0xb599('0x2f')){_0x5bd976[_0xb599('0x9')](_0xb599('0x7a'),_0xb599('0x7b'));_0x5bd976[_0xb599('0x9')](_0xb599('0x7c'),_0xb599('0x7d'));_0x5bd976[_0xb599('0x9')]('i.id');_0x5bd976[_0xb599('0x9')](_0xb599('0x7e'));_0x5bd976[_0xb599('0x9')](_0xb599('0x7f'));_0x5bd976['field'](_0xb599('0x80'));_0x5bd976[_0xb599('0x9')]('i.closedAt');_0x5bd976[_0xb599('0x9')](_0xb599('0x81'));_0x5bd976['field'](_0xb599('0x82'));_0x5bd976['field']('i.lastMsgDirection');_0x5bd976[_0xb599('0x9')](_0xb599('0x83'));_0x5bd976[_0xb599('0x9')](_0xb599('0x68'));_0x5bd976[_0xb599('0x9')](_0xb599('0x67'));_0x5bd976[_0xb599('0x9')](_0xb599('0x66'));_0x5bd976['field'](_0xb599('0x69'));_0x5bd976['field'](_0xb599('0x84'));_0x5bd976['field']('i.ContactId');_0x5bd976[_0xb599('0x9')](_0xb599('0x85'));_0x5bd976[_0xb599('0x9')](_0xb599('0x86'));}else if(_0x14c19d===_0xb599('0x87')){_0x5bd976[_0xb599('0x9')](_0xb599('0x88'),'contactName');}else{_0x5bd976[_0xb599('0x9')](_0xb599('0x89'),_0xb599('0x7d'));}if(_0x14c19d!==_0xb599('0x2f')){_0x5bd976[_0xb599('0x9')](_0xb599('0x8a'));}_0x5bd976[_0xb599('0x9')]('c.firstName',_0xb599('0x8b'));_0x5bd976[_0xb599('0x9')]('c.lastName',_0xb599('0x8c'));_0x5bd976[_0xb599('0x9')](_0xb599('0x8d'),'Contact.email');_0x5bd976['field'](_0xb599('0x8e'),_0xb599('0x8f'));_0x5bd976[_0xb599('0x9')](_0xb599('0x90'),_0xb599('0x91'));_0x5bd976[_0xb599('0x9')](_0xb599('0x92'),_0xb599('0x93'));_0x5bd976['field'](_0xb599('0x94'),'Owner.fullname');_0x5bd976['field'](_0xb599('0x95'),_0xb599('0x96'));_0x5bd976[_0xb599('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3c9c42[_0xb599('0x97')]){_0x5bd976['limit'](_0x3c9c42['limit']);}if(_0x3c9c42[_0xb599('0x98')]){_0x5bd976[_0xb599('0x98')](_0x3c9c42[_0xb599('0x98')]);}return db[_0xb599('0x71')][_0xb599('0x72')](_0x5bd976[_0xb599('0x73')](),_0x49aec8);})['then'](function(_0x3943e9){_0x4aa839=_0x3943e9;var _0x1db903=getUsersQuery(_0x14c19d,_0x4aa839);return db[_0xb599('0x71')][_0xb599('0x72')](_0x1db903[_0xb599('0x73')](),_0x49aec8);})[_0xb599('0x5a')](function(_0x49d893){_0x34f5dc=_['groupBy'](_0x49d893,_0x1a94a2);if(_0x14c19d===_0xb599('0x2f')){return db[_0xb599('0x99')][_0xb599('0x9a')]({'attributes':[_0xb599('0x9b')],'raw':!![]});}})['then'](function(_0xfd9312){var _0x284c0e=_0xfd9312?_0xfd9312[_0xb599('0x9b')]:undefined;var _0x57c702=_0x4aa839[_0xb599('0x15')](function(_0x3acb1f){return updateInteraction(_0x3acb1f,_0x13939a,_0x34f5dc,_0x284c0e);});return Promise['all'](_0x57c702);});}function countFilteredInteractions(_0x25cb8b,_0x300989){var _0x5e503d=_0x25cb8b['clone']();_0x5e503d[_0xb599('0x9')](_0xb599('0x9c'));_0x5e503d[_0xb599('0x9')](_0xb599('0x76'),_0xb599('0x40'));var _0x37bf12=utils['getSelectedTags'](_0x300989);if(!_['isEmpty'](_0x37bf12)){_0x5e503d['where'](_0xb599('0x9d'),_0x37bf12);}var _0x442780={'type':db['Sequelize'][_0xb599('0x70')][_0xb599('0x9e')],'raw':!![]};return db[_0xb599('0x71')][_0xb599('0x72')](_0x5e503d[_0xb599('0x73')](),_0x442780);}module[_0xb599('0x9f')]={'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 6576175..0c3e87f 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 _0x9530=['push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','findOne','out','plainBody','-id','then','trimStart','updateInteraction','Tags','TagIds','catch','lodash','../../mysqldb','map','split','forEach'];(function(_0x1584e2,_0x14c000){var _0x344273=function(_0x1acb10){while(--_0x1acb10){_0x1584e2['push'](_0x1584e2['shift']());}};_0x344273(++_0x14c000);}(_0x9530,0xdc));var _0x0953=function(_0x18f810,_0x31965e){_0x18f810=_0x18f810-0x0;var _0x56a714=_0x9530[_0x18f810];return _0x56a714;};'use strict';var _=require(_0x0953('0x0'));var db=require(_0x0953('0x1'))['db'];function getInteractionUsers(_0x4d4ef7,_0xad383d){return new Promise(function(_0x48bcc4,_0x26706e){try{var _0x2be8e7=[];if(_0xad383d[_0x4d4ef7]){_0x2be8e7=_0xad383d[_0x4d4ef7][_0x0953('0x2')](function(_0xdda471){return{'id':_0xdda471['id'],'fullname':_0xdda471['fullname']};});}return _0x48bcc4(_0x2be8e7);}catch(_0x8cc5aa){_0x26706e(_0x8cc5aa);}});}function getInteractionTags(_0x295f36,_0x37196e){var _0x12839d=[];if(_0x295f36){_0x295f36[_0x0953('0x3')](',')[_0x0953('0x4')](function(_0x4af57a){_0x12839d[_0x0953('0x5')](_0x37196e[_0x4af57a]);});}return _0x12839d;}function updateWaitingCounter(_0x57bdaf){if(_0x57bdaf['waiting']){_0x57bdaf[_0x0953('0x6')]-=0x1;}}function updateInteractionCounters(_0x5dcf62){_0x5dcf62[_0x0953('0x6')]=0x0;_0x5dcf62[_0x0953('0x7')]=0x0;_0x5dcf62[_0x0953('0x8')]=0x0;_0x5dcf62[_0x0953('0x9')]=0x0;_0x5dcf62[_0x0953('0xa')]=0x0;_0x5dcf62['total']=0x0;if(_0x5dcf62[_0x0953('0xb')]){if(_0x5dcf62[_0x0953('0xc')]===_0x0953('0xa')){_0x5dcf62[_0x0953('0xa')]+=0x1;updateWaitingCounter(_0x5dcf62);}if(_0x5dcf62[_0x0953('0xd')]){_0x5dcf62[_0x0953('0x8')]+=0x1;if(_0x5dcf62[_0x0953('0x7')]){_0x5dcf62[_0x0953('0x7')]-=0x1;}}else{if(_0x5dcf62[_0x0953('0xc')]){_0x5dcf62['unmanaged']+=0x1;updateWaitingCounter(_0x5dcf62);}}}else{if(!_0x5dcf62['UserId']){_0x5dcf62['waiting']+=0x1;}if(_0x5dcf62['UserId']){_0x5dcf62[_0x0953('0x7')]+=0x1;updateWaitingCounter(_0x5dcf62);}}_0x5dcf62[_0x0953('0xe')]+=0x1;return _0x5dcf62;}function getLastMessageText(_0x575b50){return db['MailMessage'][_0x0953('0xf')]({'where':{'$and':[{'MailInteractionId':_0x575b50['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0953('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0953('0x11')],'order':_0x0953('0x12'),'raw':!![]})[_0x0953('0x13')](function(_0x1a5c7e){if(_0x1a5c7e&&_0x1a5c7e[_0x0953('0x11')]){_0x575b50['lastMsgText']=_[_0x0953('0x14')](_0x1a5c7e[_0x0953('0x11')]);}return _0x575b50;})['catch'](function(_0x37fadb){throw _0x37fadb;});}exports[_0x0953('0x15')]=function(_0x128f7f,_0x1565ea,_0x1016aa,_0x16930f){return new Promise(function(_0x3b24b4,_0x587a13){return getInteractionUsers(_0x128f7f['id'],_0x1016aa)['then'](function(_0x43aaae){_0x128f7f['Users']=_0x43aaae;return getInteractionTags(_0x128f7f['TagIds'],_0x1565ea);})[_0x0953('0x13')](function(_0x558595){_0x128f7f[_0x0953('0x16')]=_0x558595;delete _0x128f7f[_0x0953('0x17')];return updateInteractionCounters(_0x128f7f);})['then'](function(_0x29cdd0){if(_0x16930f){return getLastMessageText(_0x29cdd0);}else{return _0x29cdd0;}})[_0x0953('0x13')](function(_0x241afc){_0x3b24b4(_0x241afc);})[_0x0953('0x18')](function(_0x41a86d){_0x587a13(_0x41a86d);});});}; \ No newline at end of file +var _0xded4=['forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','-id','then','plainBody','lastMsgText','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','fullname','split'];(function(_0x3236b8,_0x2248b3){var _0x404e8d=function(_0x305772){while(--_0x305772){_0x3236b8['push'](_0x3236b8['shift']());}};_0x404e8d(++_0x2248b3);}(_0xded4,0x7e));var _0x4ded=function(_0x45f319,_0x3f67b7){_0x45f319=_0x45f319-0x0;var _0x5b8f7c=_0xded4[_0x45f319];return _0x5b8f7c;};'use strict';var _=require(_0x4ded('0x0'));var db=require(_0x4ded('0x1'))['db'];function getInteractionUsers(_0x140fa0,_0x14362b){return new Promise(function(_0x233191,_0x215f41){try{var _0x52df47=[];if(_0x14362b[_0x140fa0]){_0x52df47=_0x14362b[_0x140fa0]['map'](function(_0x373138){return{'id':_0x373138['id'],'fullname':_0x373138[_0x4ded('0x2')]};});}return _0x233191(_0x52df47);}catch(_0x37d4a6){_0x215f41(_0x37d4a6);}});}function getInteractionTags(_0x2c2c74,_0x48067f){var _0x30a331=[];if(_0x2c2c74){_0x2c2c74[_0x4ded('0x3')](',')[_0x4ded('0x4')](function(_0x1bc7ea){_0x30a331[_0x4ded('0x5')](_0x48067f[_0x1bc7ea]);});}return _0x30a331;}function updateWaitingCounter(_0x534f23){if(_0x534f23[_0x4ded('0x6')]){_0x534f23[_0x4ded('0x6')]-=0x1;}}function updateInteractionCounters(_0x2bbe4a){_0x2bbe4a[_0x4ded('0x6')]=0x0;_0x2bbe4a[_0x4ded('0x7')]=0x0;_0x2bbe4a[_0x4ded('0x8')]=0x0;_0x2bbe4a[_0x4ded('0x9')]=0x0;_0x2bbe4a[_0x4ded('0xa')]=0x0;_0x2bbe4a[_0x4ded('0xb')]=0x0;if(_0x2bbe4a[_0x4ded('0xc')]){if(_0x2bbe4a[_0x4ded('0xd')]==='abandoned'){_0x2bbe4a[_0x4ded('0xa')]+=0x1;updateWaitingCounter(_0x2bbe4a);}if(_0x2bbe4a[_0x4ded('0xe')]){_0x2bbe4a['answered']+=0x1;if(_0x2bbe4a[_0x4ded('0x7')]){_0x2bbe4a[_0x4ded('0x7')]-=0x1;}}else{if(_0x2bbe4a[_0x4ded('0xd')]){_0x2bbe4a['unmanaged']+=0x1;updateWaitingCounter(_0x2bbe4a);}}}else{if(!_0x2bbe4a[_0x4ded('0xe')]){_0x2bbe4a[_0x4ded('0x6')]+=0x1;}if(_0x2bbe4a[_0x4ded('0xe')]){_0x2bbe4a[_0x4ded('0x7')]+=0x1;updateWaitingCounter(_0x2bbe4a);}}_0x2bbe4a[_0x4ded('0xb')]+=0x1;return _0x2bbe4a;}function getLastMessageText(_0x5e5054){return db[_0x4ded('0xf')][_0x4ded('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5e5054['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x4ded('0x11'),'raw':!![]})[_0x4ded('0x12')](function(_0x52b5bb){if(_0x52b5bb&&_0x52b5bb[_0x4ded('0x13')]){_0x5e5054[_0x4ded('0x14')]=_['trimStart'](_0x52b5bb['plainBody']);}return _0x5e5054;})[_0x4ded('0x15')](function(_0x2232aa){throw _0x2232aa;});}exports[_0x4ded('0x16')]=function(_0x539599,_0x26b8e0,_0x22fc34,_0x1cb968){return new Promise(function(_0xacc722,_0x2327d0){return getInteractionUsers(_0x539599['id'],_0x22fc34)[_0x4ded('0x12')](function(_0xb13d75){_0x539599[_0x4ded('0x17')]=_0xb13d75;return getInteractionTags(_0x539599['TagIds'],_0x26b8e0);})[_0x4ded('0x12')](function(_0x2ca355){_0x539599[_0x4ded('0x18')]=_0x2ca355;delete _0x539599[_0x4ded('0x19')];return updateInteractionCounters(_0x539599);})[_0x4ded('0x12')](function(_0x558733){if(_0x1cb968){return getLastMessageText(_0x558733);}else{return _0x558733;}})[_0x4ded('0x12')](function(_0x5f0cc0){_0xacc722(_0x5f0cc0);})[_0x4ded('0x15')](function(_0x200531){_0x2327d0(_0x200531);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 14bd930..1e2eac7 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 _0x84d1=['catch','error','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','update','info'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x84d1,0x1c2));var _0x184d=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x84d1[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require(_0x184d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x184d('0x1'))(_0x184d('0x2')),'mail':require(_0x184d('0x1'))(_0x184d('0x3')),'fax':require(_0x184d('0x1'))(_0x184d('0x4')),'sms':require('../../config/logger')(_0x184d('0x5')),'chat':require('../../config/logger')(_0x184d('0x6')),'whatsapp':require(_0x184d('0x1'))(_0x184d('0x7'))};function getAccountFK(_0x2c3e4d){return _['capitalize'](_0x2c3e4d)+(_0x2c3e4d===_0x184d('0x8')?_0x184d('0x9'):_0x184d('0xa'))+'Id';}function getInteractionFK(_0xa69c60){return _['capitalize'](_0xa69c60)+_0x184d('0xb');}function getInteractionId(_0x2dc488,_0x179439,_0x17b494){if(_0x2dc488&&_0x2dc488[_[_0x184d('0xc')](_0x17b494)+'InteractionId']){return _0x2dc488[_[_0x184d('0xc')](_0x17b494)+_0x184d('0xb')];}else if(_0x2dc488&&_0x2dc488['id']){return _0x2dc488['id'];}else if(_0x179439&&_0x179439['id']){return _0x179439['id'];}else{return _0x184d('0xd');}}function getInteractionsTables(_0x48aba9){return{'accounts':_0x48aba9+'_'+(_0x48aba9===_0x184d('0x8')?_0x184d('0xe'):_0x184d('0xf')),'interactions':_0x48aba9+_0x184d('0x10'),'interactionsTags':_0x48aba9+_0x184d('0x11'),'messages':_0x48aba9+_0x184d('0x12'),'userInteractions':'user_has_'+_0x48aba9+_0x184d('0x10')};}function getSelectedTags(_0x4011d9){var _0x20ad11=[];if(_0x4011d9){_0x20ad11=Array[_0x184d('0x13')](_0x4011d9)?_0x4011d9:[_0x4011d9];}return _0x20ad11;}function log(_0x52b327,_0x456c48,_0x41c051,_0x3a84e9,_0x5aa861,_0xd8d440){loggers[_0x5aa861['toLowerCase']()][_0x52b327](_0x184d('0x14'),_0xd8d440[_0x184d('0x15')](),_0x456c48?_0x456c48['id']:null,_0x456c48?_0x456c48[_0x184d('0x16')]:null,_0x456c48?_0x456c48['role']:null,getInteractionId(_0x41c051,_0x3a84e9,_0x5aa861),_0x41c051?JSON[_0x184d('0x17')](_0x41c051):_0x184d('0x18'));}function updateUser(_0xe27b51,_0x4ecde1,_0x2ba3d9,_0xd46dfe,_0x377393){db[_[_0x184d('0xc')](_0xd46dfe)+_0x184d('0x19')][_0x184d('0x1a')]({'where':{'id':getInteractionId(_0x4ecde1,_0x2ba3d9,_0xd46dfe)}})[_0x184d('0x1b')](function(_0x4eac36){if(_0x4eac36){return _0x4eac36[_0x184d('0x1c')]({'UserId':_0xe27b51?_0xe27b51['id']:null});}})['then'](function(_0x5c80e3){if(_0x5c80e3){log(_0x184d('0x1d'),_0xe27b51,_0x4ecde1,_0x2ba3d9,_0xd46dfe,_0x377393);}})[_0x184d('0x1e')](function(){log(_0x184d('0x1f'),_0xe27b51,_0x4ecde1,_0x2ba3d9,_0xd46dfe,_0x377393);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x5f8b=['update','then','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','findOne'];(function(_0x1a1009,_0x457e27){var _0x55d394=function(_0x496a72){while(--_0x496a72){_0x1a1009['push'](_0x1a1009['shift']());}};_0x55d394(++_0x457e27);}(_0x5f8b,0x171));var _0xb5f8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f8b[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var db=require(_0xb5f8('0x0'))['db'];var loggers={'openchannel':require(_0xb5f8('0x1'))(_0xb5f8('0x2')),'mail':require('../../config/logger')(_0xb5f8('0x3')),'fax':require(_0xb5f8('0x1'))('fax-interactions'),'sms':require(_0xb5f8('0x1'))('sms-interactions'),'chat':require('../../config/logger')(_0xb5f8('0x4')),'whatsapp':require(_0xb5f8('0x1'))(_0xb5f8('0x5'))};function getAccountFK(_0xda5c30){return _[_0xb5f8('0x6')](_0xda5c30)+(_0xda5c30===_0xb5f8('0x7')?_0xb5f8('0x8'):_0xb5f8('0x9'))+'Id';}function getInteractionFK(_0xc50263){return _[_0xb5f8('0x6')](_0xc50263)+_0xb5f8('0xa');}function getInteractionId(_0x28ff8a,_0x313cd8,_0xed652e){if(_0x28ff8a&&_0x28ff8a[_['upperFirst'](_0xed652e)+_0xb5f8('0xa')]){return _0x28ff8a[_[_0xb5f8('0xb')](_0xed652e)+_0xb5f8('0xa')];}else if(_0x28ff8a&&_0x28ff8a['id']){return _0x28ff8a['id'];}else if(_0x313cd8&&_0x313cd8['id']){return _0x313cd8['id'];}else{return _0xb5f8('0xc');}}function getInteractionsTables(_0x345555){return{'accounts':_0x345555+'_'+(_0x345555===_0xb5f8('0x7')?_0xb5f8('0xd'):'accounts'),'interactions':_0x345555+_0xb5f8('0xe'),'interactionsTags':_0x345555+'_interaction_has_tags','messages':_0x345555+_0xb5f8('0xf'),'userInteractions':'user_has_'+_0x345555+_0xb5f8('0xe')};}function getSelectedTags(_0x1a5939){var _0x4659f3=[];if(_0x1a5939){_0x4659f3=Array['isArray'](_0x1a5939)?_0x1a5939:[_0x1a5939];}return _0x4659f3;}function log(_0x2195bb,_0x395c0d,_0x348b5c,_0x4291db,_0x51bf80,_0x3591a7){loggers[_0x51bf80[_0xb5f8('0x10')]()][_0x2195bb](_0xb5f8('0x11'),_0x3591a7['toUpperCase'](),_0x395c0d?_0x395c0d['id']:null,_0x395c0d?_0x395c0d['name']:null,_0x395c0d?_0x395c0d['role']:null,getInteractionId(_0x348b5c,_0x4291db,_0x51bf80),_0x348b5c?JSON[_0xb5f8('0x12')](_0x348b5c):_0xb5f8('0x13'));}function updateUser(_0x119a53,_0x55c304,_0x291142,_0x3a5509,_0x22f36a){db[_[_0xb5f8('0xb')](_0x3a5509)+'Interaction'][_0xb5f8('0x14')]({'where':{'id':getInteractionId(_0x55c304,_0x291142,_0x3a5509)}})['then'](function(_0x52b18e){if(_0x52b18e){return _0x52b18e[_0xb5f8('0x15')]({'UserId':_0x119a53?_0x119a53['id']:null});}})[_0xb5f8('0x16')](function(_0x3c8d0f){if(_0x3c8d0f){log(_0xb5f8('0x17'),_0x119a53,_0x55c304,_0x291142,_0x3a5509,_0x22f36a);}})['catch'](function(){log(_0xb5f8('0x18'),_0x119a53,_0x55c304,_0x291142,_0x3a5509,_0x22f36a);});}module[_0xb5f8('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5605c9c..2b1f5f9 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 _0x1c52=['isUserLimit','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','hasOwnProperty','use','License','then','count','status','json','catch','users','User','user'];(function(_0x3a4984,_0x20aed5){var _0x571a96=function(_0x14a3b0){while(--_0x14a3b0){_0x3a4984['push'](_0x3a4984['shift']());}};_0x571a96(++_0x20aed5);}(_0x1c52,0x181));var _0x21c5=function(_0x3042aa,_0x4c46bc){_0x3042aa=_0x3042aa-0x0;var _0x54b464=_0x1c52[_0x3042aa];return _0x54b464;};'use strict';var crypto=require('crypto');var util=require(_0x21c5('0x0'));var compose=require(_0x21c5('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x21c5('0x2'));function getValueFromLicense(_0x11031c,_0xbab427){if(_0x11031c&&_0xbab427){if(_0xbab427[_0x21c5('0x3')]&&_0xbab427[_0x21c5('0x4')]){var _0x2f782e=_0xbab427[_0x21c5('0x3')];var _0xa4f712=_0xbab427[_0x21c5('0x4')];var _0x3fe819=_0x2f782e[_0x21c5('0x5')]('-')[0x4];var _0x322717=_0x2f782e[_0x21c5('0x5')]('-')[0x0];var _0x3d6bdd=crypto['createDecipher'](_0x21c5('0x6'),util[_0x21c5('0x7')](_0x21c5('0x8'),_0x3fe819,_0x2f782e,_0x322717));var _0x3a1295=_0x3d6bdd['update'](_0xa4f712,_0x21c5('0x9'),_0x21c5('0xa'));_0x3a1295+=_0x3d6bdd[_0x21c5('0xb')](_0x21c5('0xa'));var _0x52ccfe=JSON['parse'](_0x3a1295);return _0x52ccfe[_0x21c5('0xc')](_0x11031c)?_0x52ccfe[_0x11031c]:null;}}return null;}function isLimit(_0x33b0f8,_0x708f07,_0x1d6cb6,_0x3d3416){var _0x377907=_0x708f07;return compose()[_0x21c5('0xd')](function(_0x4706d7,_0xd8f04d,_0x35bd33){return db[_0x21c5('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x109cb4){var _0x359e02=getValueFromLicense(_0x33b0f8,_0x109cb4);return _0x359e02?_0x359e02:_0x377907;})[_0x21c5('0xf')](function(_0x18c785){_0x377907=_0x18c785;return _0x1d6cb6[_0x21c5('0x10')](_0x3d3416);})['then'](function(_0x54a2c6){if(_0x54a2c6>=_0x377907){return _0xd8f04d[_0x21c5('0x11')](0x193)[_0x21c5('0x12')]({'message':util[_0x21c5('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x33b0f8)});}_0x35bd33();})[_0x21c5('0x13')](function(_0x26ec15){_0x35bd33(_0x26ec15);});});}function isUserLimit(){return isLimit(_0x21c5('0x14'),0x1,db[_0x21c5('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x21c5('0x16')}]}});}exports[_0x21c5('0x17')]=isUserLimit; \ No newline at end of file +var _0xa0a3=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','update','utf8','parse','hasOwnProperty','use','License','then','count','status','json'];(function(_0x36fa4b,_0x45a4e0){var _0x43bfa3=function(_0x34135f){while(--_0x34135f){_0x36fa4b['push'](_0x36fa4b['shift']());}};_0x43bfa3(++_0x45a4e0);}(_0xa0a3,0x17c));var _0x3a0a=function(_0x5814d8,_0x54b694){_0x5814d8=_0x5814d8-0x0;var _0x2cb878=_0xa0a3[_0x5814d8];return _0x2cb878;};'use strict';var crypto=require(_0x3a0a('0x0'));var util=require(_0x3a0a('0x1'));var compose=require(_0x3a0a('0x2'));var db=require(_0x3a0a('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3c44c1,_0x302d3d){if(_0x3c44c1&&_0x302d3d){if(_0x302d3d[_0x3a0a('0x4')]&&_0x302d3d[_0x3a0a('0x5')]){var _0x5d6c27=_0x302d3d['data1'];var _0x47d154=_0x302d3d['license'];var _0x5d7388=_0x5d6c27[_0x3a0a('0x6')]('-')[0x4];var _0x372adc=_0x5d6c27['split']('-')[0x0];var _0x4db75c=crypto[_0x3a0a('0x7')]('aes-256-ctr',util[_0x3a0a('0x8')](_0x3a0a('0x9'),_0x5d7388,_0x5d6c27,_0x372adc));var _0x73de58=_0x4db75c[_0x3a0a('0xa')](_0x47d154,'base64',_0x3a0a('0xb'));_0x73de58+=_0x4db75c['final'](_0x3a0a('0xb'));var _0x10331a=JSON[_0x3a0a('0xc')](_0x73de58);return _0x10331a[_0x3a0a('0xd')](_0x3c44c1)?_0x10331a[_0x3c44c1]:null;}}return null;}function isLimit(_0xcee380,_0x36be37,_0x1f2176,_0x990ef8){var _0x2d63db=_0x36be37;return compose()[_0x3a0a('0xe')](function(_0x14cb98,_0x1a1ba0,_0x279568){return db[_0x3a0a('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x59203b){var _0xb0e4c2=getValueFromLicense(_0xcee380,_0x59203b);return _0xb0e4c2?_0xb0e4c2:_0x2d63db;})[_0x3a0a('0x10')](function(_0x33fd57){_0x2d63db=_0x33fd57;return _0x1f2176[_0x3a0a('0x11')](_0x990ef8);})[_0x3a0a('0x10')](function(_0x20afd1){if(_0x20afd1>=_0x2d63db){return _0x1a1ba0[_0x3a0a('0x12')](0x193)[_0x3a0a('0x13')]({'message':util[_0x3a0a('0x8')](_0x3a0a('0x14'),_0xcee380)});}_0x279568();})['catch'](function(_0x38bb6){_0x279568(_0x38bb6);});});}function isUserLimit(){return isLimit(_0x3a0a('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0x3a0a('0x16')},{'role':_0x3a0a('0x17')}]}});}exports[_0x3a0a('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0472b58..79337ee 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 _0x7c10=['>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','$between','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','DATE','$eq','operator','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte'];(function(_0x2280b1,_0x4900ad){var _0x42770b=function(_0x49c8a7){while(--_0x49c8a7){_0x2280b1['push'](_0x2280b1['shift']());}};_0x42770b(++_0x4900ad);}(_0x7c10,0xe9));var _0x07c1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7c10[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x07c1('0x0'));var moment=require(_0x07c1('0x1'));exports[_0x07c1('0x2')]=function(_0x1cbd82){var _0x1a8a48={'conditions':[]};_0x1a8a48[_0x07c1('0x3')]=_['startsWith'](_0x1cbd82,_0x07c1('0x4'))?'or':_0x07c1('0x5');var _0x1e453f=_0x1cbd82[_0x07c1('0x6')](_0x07c1('0x7'),'')[_0x07c1('0x6')]('[$or]','')[_0x07c1('0x8')]('||');for(var _0x44bc4d=0x0;_0x44bc4d<_0x1e453f[_0x07c1('0x9')];_0x44bc4d++){var _0x48f5a6=_0x1e453f[_0x44bc4d]['split'](':=');var _0x41f304=_0x48f5a6[0x0];var _0xce1a01=_0x48f5a6[_0x07c1('0xa')](0x1);_0xce1a01[_0x07c1('0xb')](function(_0x504d93){var _0x5237c5=_0x504d93['split']('[')[_0x07c1('0xc')]();var _0x58302c=_0x504d93[_0x07c1('0xd')](/\[(.*?)\]/g);_0x58302c[_0x07c1('0xb')](function(_0x585b87){var _0xf12083=_0x585b87[_0x07c1('0x8')]('[')['filter'](function(_0x2ba358){return _0x2ba358[_0x07c1('0xe')](']')>-0x1;})[_0x07c1('0xf')](function(_0x44be25){return _0x44be25['split'](']')[0x0];})[0x0];_0x1a8a48[_0x07c1('0x10')][_0x07c1('0x11')]({'field':_0x41f304,'operator':_0x5237c5,'value':_0xf12083});});});}return _0x1a8a48;};exports['buildExpression']=function(_0x21f471,_0x33ef72,_0x5b2878){var _0x34d211={};if(_0x33ef72===_0x07c1('0x12')){if(_0x5b2878['operator']===_0x07c1('0x13')){_0x5b2878[_0x07c1('0x14')]='$between';_0x5b2878[_0x07c1('0x15')]+=','+_0x5b2878['value'];}else if(_[_0x07c1('0x16')]([_0x07c1('0x17'),'$lte'],_0x5b2878[_0x07c1('0x14')])){_0x5b2878[_0x07c1('0x15')]=moment(_0x5b2878[_0x07c1('0x15')])[_0x07c1('0x18')](0x1,_0x07c1('0x19'))[_0x07c1('0x1a')](_0x07c1('0x1b'));}}if(_0x5b2878[_0x07c1('0x1c')]){_0x33ef72=_0x5b2878[_0x07c1('0x1c')];_0x34d211['text']='CAST('+_0x21f471+'.'+_0x5b2878[_0x07c1('0x1d')]+_0x07c1('0x1e')+_0x5b2878[_0x07c1('0x1c')]+')\x20'+parseOperator(_0x5b2878['operator']);}else{_0x34d211['text']=_0x21f471+'.'+_0x5b2878[_0x07c1('0x1d')]+'\x20'+parseOperator(_0x5b2878[_0x07c1('0x14')]);}if(_[_0x07c1('0x16')]([_0x07c1('0x1f'),_0x07c1('0x20')],_0x5b2878['operator']))_0x34d211[_0x07c1('0x21')]='('+_0x34d211[_0x07c1('0x21')]+_0x07c1('0x22')+_0x21f471+'.'+_0x5b2878[_0x07c1('0x1d')]+'\x20IS\x20NULL)';_0x34d211['value']=parseValue(_0x33ef72,_0x5b2878[_0x07c1('0x14')],_0x5b2878[_0x07c1('0x15')]);return _0x34d211;};function parseOperator(_0x40ee6c){var _0x19350d;switch(_0x40ee6c){case _0x07c1('0x23'):_0x19350d=_0x07c1('0x24');break;case'$notIn':_0x19350d='NOT\x20IN\x20?';break;case _0x07c1('0x13'):_0x19350d=_0x07c1('0x25');break;case _0x07c1('0x1f'):_0x19350d=_0x07c1('0x26');break;case _0x07c1('0x27'):case _0x07c1('0x28'):case'$endsWith':_0x19350d=_0x07c1('0x29');break;case _0x07c1('0x2a'):_0x19350d='<\x20?';break;case _0x07c1('0x17'):_0x19350d=_0x07c1('0x2b');break;case _0x07c1('0x2c'):_0x19350d=_0x07c1('0x2d');break;case _0x07c1('0x2e'):_0x19350d=_0x07c1('0x2f');break;case'$between':_0x19350d=_0x07c1('0x30');break;}return _0x19350d;}function parseValue(_0x48cb63,_0x45137e,_0x33ffd8){var _0x15c4ad={'start':undefined,'end':undefined};switch(_0x45137e){case _0x07c1('0x23'):case _0x07c1('0x20'):_0x15c4ad[_0x07c1('0x31')]=_0x33ffd8[_0x07c1('0x8')](',');break;case'$substring':_0x15c4ad[_0x07c1('0x31')]='%'+_0x33ffd8+'%';break;case'$startsWith':_0x15c4ad[_0x07c1('0x31')]=_0x33ffd8+'%';break;case _0x07c1('0x32'):_0x15c4ad[_0x07c1('0x31')]='%'+_0x33ffd8;break;case _0x07c1('0x33'):var _0x3f3dc1=_0x33ffd8['split'](',');var _0x33ffd8=_0x3f3dc1[_0x07c1('0xc')]();var _0x314d49=_0x3f3dc1[_0x07c1('0x34')]();if(_0x48cb63==='DATE'){_0x33ffd8=moment(_0x33ffd8)[_0x07c1('0x35')](0x0,!![])['format']();_0x314d49=moment(_0x314d49)[_0x07c1('0x35')](0x0,!![])[_0x07c1('0x18')](0x17,_0x07c1('0x36'))['add'](0x3b,'minutes')[_0x07c1('0x18')](0x3b,_0x07c1('0x37'))[_0x07c1('0x1a')]();}_0x15c4ad={'start':_0x33ffd8,'end':_0x314d49};break;default:_0x15c4ad[_0x07c1('0x31')]=_0x33ffd8;break;}return _0x15c4ad;} \ No newline at end of file +var _0x03b4=['$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','>=\x20?','start','pop','DATE','utcOffset','format','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x03b4,0x1a1));var _0x403b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x03b4[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x403b('0x0'));var moment=require('moment');exports[_0x403b('0x1')]=function(_0x2d0e82){var _0x5027ab={'conditions':[]};_0x5027ab[_0x403b('0x2')]=_[_0x403b('0x3')](_0x2d0e82,_0x403b('0x4'))?'or':_0x403b('0x5');var _0x2f0bc7=_0x2d0e82[_0x403b('0x6')]('[$and]','')['replace'](_0x403b('0x4'),'')[_0x403b('0x7')]('||');for(var _0x4334c1=0x0;_0x4334c1<_0x2f0bc7[_0x403b('0x8')];_0x4334c1++){var _0x11c97e=_0x2f0bc7[_0x4334c1][_0x403b('0x7')](':=');var _0x16a8fb=_0x11c97e[0x0];var _0x1397a4=_0x11c97e[_0x403b('0x9')](0x1);_0x1397a4[_0x403b('0xa')](function(_0x274f7c){var _0x4f3639=_0x274f7c[_0x403b('0x7')]('[')[_0x403b('0xb')]();var _0x4317ff=_0x274f7c['match'](/\[(.*?)\]/g);_0x4317ff[_0x403b('0xa')](function(_0x2b6a8c){var _0x53d0e=_0x2b6a8c[_0x403b('0x7')]('[')[_0x403b('0xc')](function(_0x3a5db7){return _0x3a5db7[_0x403b('0xd')](']')>-0x1;})[_0x403b('0xe')](function(_0x12bfc2){return _0x12bfc2[_0x403b('0x7')](']')[0x0];})[0x0];_0x5027ab[_0x403b('0xf')]['push']({'field':_0x16a8fb,'operator':_0x4f3639,'value':_0x53d0e});});});}return _0x5027ab;};exports[_0x403b('0x10')]=function(_0x37d0c8,_0x51d154,_0x116fe0){var _0x4e9954={};if(_0x51d154==='DATE'){if(_0x116fe0[_0x403b('0x11')]===_0x403b('0x12')){_0x116fe0[_0x403b('0x11')]=_0x403b('0x13');_0x116fe0[_0x403b('0x14')]+=','+_0x116fe0[_0x403b('0x14')];}else if(_['includes']([_0x403b('0x15'),_0x403b('0x16')],_0x116fe0[_0x403b('0x11')])){_0x116fe0[_0x403b('0x14')]=moment(_0x116fe0[_0x403b('0x14')])[_0x403b('0x17')](0x1,_0x403b('0x18'))['format']('YYYY-MM-DD');}}if(_0x116fe0[_0x403b('0x19')]){_0x51d154=_0x116fe0[_0x403b('0x19')];_0x4e9954[_0x403b('0x1a')]=_0x403b('0x1b')+_0x37d0c8+'.'+_0x116fe0[_0x403b('0x1c')]+_0x403b('0x1d')+_0x116fe0['castTo']+')\x20'+parseOperator(_0x116fe0[_0x403b('0x11')]);}else{_0x4e9954[_0x403b('0x1a')]=_0x37d0c8+'.'+_0x116fe0[_0x403b('0x1c')]+'\x20'+parseOperator(_0x116fe0['operator']);}if(_['includes']([_0x403b('0x1e'),_0x403b('0x1f')],_0x116fe0[_0x403b('0x11')]))_0x4e9954[_0x403b('0x1a')]='('+_0x4e9954['text']+'\x20OR\x20'+_0x37d0c8+'.'+_0x116fe0[_0x403b('0x1c')]+_0x403b('0x20');_0x4e9954['value']=parseValue(_0x51d154,_0x116fe0['operator'],_0x116fe0[_0x403b('0x14')]);return _0x4e9954;};function parseOperator(_0x1b4e33){var _0x33da93;switch(_0x1b4e33){case _0x403b('0x21'):_0x33da93='IN\x20?';break;case _0x403b('0x1f'):_0x33da93=_0x403b('0x22');break;case'$eq':_0x33da93=_0x403b('0x23');break;case _0x403b('0x1e'):_0x33da93=_0x403b('0x24');break;case _0x403b('0x25'):case _0x403b('0x26'):case _0x403b('0x27'):_0x33da93=_0x403b('0x28');break;case'$lt':_0x33da93=_0x403b('0x29');break;case _0x403b('0x15'):_0x33da93='>\x20?';break;case _0x403b('0x16'):_0x33da93=_0x403b('0x2a');break;case _0x403b('0x2b'):_0x33da93=_0x403b('0x2c');break;case _0x403b('0x13'):_0x33da93='BETWEEN\x20?\x20AND\x20?';break;}return _0x33da93;}function parseValue(_0x155051,_0x3f563d,_0x1e7050){var _0x27cc4c={'start':undefined,'end':undefined};switch(_0x3f563d){case _0x403b('0x21'):case _0x403b('0x1f'):_0x27cc4c[_0x403b('0x2d')]=_0x1e7050[_0x403b('0x7')](',');break;case _0x403b('0x25'):_0x27cc4c[_0x403b('0x2d')]='%'+_0x1e7050+'%';break;case _0x403b('0x26'):_0x27cc4c['start']=_0x1e7050+'%';break;case _0x403b('0x27'):_0x27cc4c[_0x403b('0x2d')]='%'+_0x1e7050;break;case _0x403b('0x13'):var _0x5af8d5=_0x1e7050['split'](',');var _0x1e7050=_0x5af8d5['shift']();var _0x3ecbf5=_0x5af8d5[_0x403b('0x2e')]();if(_0x155051===_0x403b('0x2f')){_0x1e7050=moment(_0x1e7050)[_0x403b('0x30')](0x0,!![])[_0x403b('0x31')]();_0x3ecbf5=moment(_0x3ecbf5)[_0x403b('0x30')](0x0,!![])[_0x403b('0x17')](0x17,'hours')[_0x403b('0x17')](0x3b,'minutes')[_0x403b('0x17')](0x3b,'seconds')[_0x403b('0x31')]();}_0x27cc4c={'start':_0x1e7050,'end':_0x3ecbf5};break;default:_0x27cc4c[_0x403b('0x2d')]=_0x1e7050;break;}return _0x27cc4c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e73f36e..4a445dc 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 _0x8a8b=['isArray','limit','offset','sort','map','priority','col','unsigned','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','{EXPR}','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','include','push','lodash','../../mysqldb','includes','parse','keys','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','name','uniqueid'];(function(_0x112561,_0x3006ec){var _0x4311d4=function(_0x4cd5d5){while(--_0x4cd5d5){_0x112561['push'](_0x112561['shift']());}};_0x4311d4(++_0x3006ec);}(_0x8a8b,0xae));var _0xb8a8=function(_0x1cf66b,_0x58035b){_0x1cf66b=_0x1cf66b-0x0;var _0x325300=_0x8a8b[_0x1cf66b];return _0x325300;};'use strict';var _=require(_0xb8a8('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require(_0xb8a8('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x308da3){var _0x4f56d4=['ne'];try{var _0x13bc8b=JSON['parse'](_0x308da3);var _0xca9854=Object['keys'](_0x13bc8b)[0x0];return _0x4f56d4[_0xb8a8('0x2')](_0xca9854);}catch(_0x372822){return![];}}function getOperatorValue(_0xcca5ca){var _0x578e1b=JSON[_0xb8a8('0x3')](_0xcca5ca);var _0x59cf56=Object[_0xb8a8('0x4')](_0x578e1b)[0x0];var _0x4c46e9=_0x578e1b[_0x59cf56];return{['$'+_0x59cf56]:_0x4c46e9};}function parseIncludeModel(_0x79cb4a){var _0x363bae=JSON[_0xb8a8('0x3')](_0x79cb4a);return{'model':db[_0x363bae['model']],'as':_0x363bae[_0xb8a8('0x5')],'attributes':_0x363bae[_0xb8a8('0x6')],'raw':_0x363bae[_0xb8a8('0x7')]};}exports[_0xb8a8('0x6')]=function(_0x3ea7ad){var _0x42cb78=null;if(_0x3ea7ad){_0x42cb78=_0x3ea7ad[_0xb8a8('0x8')](',');}return _0x42cb78;};exports[_0xb8a8('0x9')]=function(_0x477cd4,_0x3d47ce){var _0x3baf33={};if(!_[_0xb8a8('0xa')](_0x477cd4)){_[_0xb8a8('0xb')](_0x477cd4,function(_0x5278f8,_0x376608){try{if(_0x3d47ce){var _0x2fe2b5=_[_0xb8a8('0xc')](_0x3d47ce,{'name':_0x376608})||{};if(hasSequelizeOperator(_0x5278f8)){_0x3baf33[_0x376608]=getOperatorValue(_0x5278f8);}else if(_0x2fe2b5[_0xb8a8('0xd')]===_0xb8a8('0xe')&&_[_0xb8a8('0xf')](_0x5278f8)){var _0x3cf353=JSON[_0xb8a8('0x3')](_0x5278f8);var _0x22e0ac={'$gte':moment(moment(_0x3cf353[_0xb8a8('0x10')])[_0xb8a8('0x11')]('YYYY-MM-DD'))[_0xb8a8('0x12')]()['format'](),'$lte':moment(moment(_0x3cf353[_0xb8a8('0x13')])[_0xb8a8('0x11')](_0xb8a8('0x14')))[_0xb8a8('0x12')]()[_0xb8a8('0x15')](0x1,'s')[_0xb8a8('0x11')]()};_0x3baf33[_0x376608]=_0x22e0ac;}else if(_0x2fe2b5[_0xb8a8('0x16')]===_0xb8a8('0x17')){_0x3baf33[_0x376608]=_0x5278f8;}else{_0x3baf33[_0x376608]=_['isArray'](_0x5278f8)?_0x5278f8:JSON['parse'](_0x5278f8);}}else{_0x3baf33[_0x376608]=_[_0xb8a8('0x18')](_0x5278f8)?_0x5278f8:JSON['parse'](_0x5278f8);}}catch(_0x51fbce){_0x3baf33[_0x376608]=_0x5278f8['split'](',');}});}return _0x3baf33;};exports[_0xb8a8('0x19')]=function(_0x44cdee){_0x44cdee=parseInt(_0x44cdee,0xa);if(!_0x44cdee||_0x44cdee<0x0){_0x44cdee=LIMIT_VALUE;}return _0x44cdee;};exports[_0xb8a8('0x1a')]=function(_0xe68165){_0xe68165=parseInt(_0xe68165,0xa);if(!_0xe68165||_0xe68165<0x0){_0xe68165=0x0;}return _0xe68165;};exports[_0xb8a8('0x1b')]=function(_0x27ab83){var _0x5ecac7,_0x17c2b8=null;if(_0x27ab83){_0x5ecac7=_0x27ab83[_0xb8a8('0x8')](',');_0x17c2b8=_[_0xb8a8('0x1c')](_0x5ecac7,function(_0x4429eb){if(_0x4429eb['indexOf']('-')===0x0){return[_0x4429eb===_0xb8a8('0x1d')?sequelize['cast'](sequelize[_0xb8a8('0x1e')]('priority'),_0xb8a8('0x1f')):_0x4429eb['substr'](0x1),'DESC'];}else{return[_0x4429eb==='priority'?sequelize['cast'](sequelize[_0xb8a8('0x1e')](_0xb8a8('0x1d')),_0xb8a8('0x1f')):_0x4429eb,_0xb8a8('0x20')];}});}return _0x17c2b8;};exports[_0xb8a8('0x21')]=function(_0x4b6c93,_0x375db6){if(_[_0xb8a8('0xa')](_0x4b6c93)){return _0x4b6c93;}if(_[_0xb8a8('0x18')](_0x4b6c93)){for(var _0x2d26fa=0x0;_0x2d26fa<_0x4b6c93[_0xb8a8('0x22')];_0x2d26fa+=0x1){_0x4b6c93[_0x2d26fa]=this['omit'](_0x4b6c93[_0x2d26fa],_0x375db6);}return _0x4b6c93;}if(!_[_0xb8a8('0x23')](_0x4b6c93)){return _0x4b6c93;}if(_[_0xb8a8('0x24')](_0x375db6)){_0x375db6=[_0x375db6];}if(!_[_0xb8a8('0x18')](_0x375db6)){return _0x4b6c93;}for(var _0x1e7403=0x0;_0x1e7403<_0x375db6[_0xb8a8('0x22')];_0x1e7403+=0x1){_['unset'](_0x4b6c93,_0x375db6[_0x1e7403]);}for(var _0x4aec01 in _0x4b6c93){if(_0x4b6c93[_0xb8a8('0x25')](_0x4aec01)){_0x4b6c93[_0x4aec01]=this[_0xb8a8('0x21')](_0x4b6c93[_0x4aec01],_0x375db6);}}return _0x4b6c93;};exports[_0xb8a8('0x26')]=function(_0x3c2bea){return _0x3c2bea[_0xb8a8('0x27')](RegExp(_0xb8a8('0x28')))?!![]:![];};exports[_0xb8a8('0x29')]=function(_0x45049){return _0x45049[_0xb8a8('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xb8a8('0x2a')]=function(_0x527c1d,_0x5aa416){var _0x180b39=[];var _0x2457ff=/[ `!@#$%^&*()_\-?~]/;var _0x44be3b=_0x5aa416?'\x22{EXPR}\x22':'{EXPR}';_0x527c1d['split'](/[ ,]+/)['forEach'](function(_0x5f1b59){_0x5f1b59=_0x5f1b59[_0xb8a8('0x2b')](/([^:]")"+/g,'$1');_0x5f1b59='+'+_0x5f1b59+'*';var _0x1baf40=_0x5f1b59[_0xb8a8('0x27')](_0x2457ff);if(_0x1baf40){_0x5f1b59='\x22'+_0x5f1b59+'\x22';}_0x180b39['push'](_0x5f1b59);});_0x44be3b=_0x44be3b[_0xb8a8('0x2b')](_0xb8a8('0x2c'),_0x180b39[_0xb8a8('0x2d')]('\x20'));return _0x44be3b;};exports[_0xb8a8('0x2e')]=function(_0x38039b,_0x450b5d,_0x5be00a){var _0x2bb89f={},_0x87dd06={};if(_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x30')]){_0x450b5d[_0xb8a8('0x2f')]['id']=_0x450b5d[_0xb8a8('0x2f')]['$id'];delete _0x450b5d['query'][_0xb8a8('0x30')];}_0x2bb89f[_0xb8a8('0x31')]=_[_0xb8a8('0x1c')](_0x38039b,_0xb8a8('0x16'));_0x2bb89f[_0xb8a8('0x2f')]=_[_0xb8a8('0x4')](_0x450b5d[_0xb8a8('0x2f')]);_0x2bb89f['filters']=_[_0xb8a8('0x32')](_0x2bb89f[_0xb8a8('0x31')],_0x2bb89f[_0xb8a8('0x2f')]);_0x87dd06[_0xb8a8('0x33')]=_[_0xb8a8('0x32')](_0x2bb89f[_0xb8a8('0x31')],this[_0xb8a8('0x6')](_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x6')]));_0x87dd06[_0xb8a8('0x33')]=_0x87dd06[_0xb8a8('0x33')][_0xb8a8('0x22')]?_0x87dd06[_0xb8a8('0x33')]:_0x2bb89f[_0xb8a8('0x31')];if(!_0x450b5d['query'][_0xb8a8('0x25')](_0xb8a8('0x34'))){_0x87dd06[_0xb8a8('0x19')]=this[_0xb8a8('0x19')](_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x19')]);_0x87dd06[_0xb8a8('0x1a')]=this[_0xb8a8('0x1a')](_0x450b5d['query'][_0xb8a8('0x1a')]);}_0x87dd06[_0xb8a8('0x35')]=this[_0xb8a8('0x1b')](_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x1b')]);_0x87dd06[_0xb8a8('0x36')]=this[_0xb8a8('0x9')](_[_0xb8a8('0x37')](_0x450b5d['query'],_0x2bb89f[_0xb8a8('0x9')]),_0x38039b);if(_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x38')]){var _0x4d0f99=_0x38039b;var _0x3590ac=_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x38')];if(typeof _0x3590ac===_0xb8a8('0x39')){_0x4d0f99=_['filter'](_0x38039b,function(_0x37e402){return _['includes'](_0x3590ac[_0xb8a8('0x3a')],_0x37e402['name']);});_0x3590ac=_0x3590ac[_0xb8a8('0x3b')];}_0x87dd06[_0xb8a8('0x36')]=_[_0xb8a8('0x3c')](_0x87dd06[_0xb8a8('0x36')],{'$or':_[_0xb8a8('0x1c')](_0x4d0f99,function(_0x2d2a5b){if(_0x2d2a5b[_0xb8a8('0xd')]!==_0xb8a8('0x3d')){if(_0x5be00a){return sequelize[_0xb8a8('0x36')](sequelize['fn'](_0xb8a8('0x3e'),sequelize[_0xb8a8('0x1e')](_0x2d2a5b[_0xb8a8('0x16')])),{'$like':sequelize['fn'](_0xb8a8('0x3e'),'%'+_0x450b5d[_0xb8a8('0x2f')]['filter']+'%')});}else{var _0x2bba38={};_0x2bba38[_0x2d2a5b['name']]={'$like':'%'+_0x450b5d[_0xb8a8('0x2f')][_0xb8a8('0x38')]+'%'};return _0x2bba38;}}})});}_0x87dd06=_[_0xb8a8('0x3c')]({},_0x87dd06,_0x450b5d[_0xb8a8('0x3f')]);return _0x87dd06;};exports[_0xb8a8('0x40')]=function(_0x26bf7a){var _0x244e7c=[];if(_0x26bf7a['includeAll']){_0x244e7c[_0xb8a8('0x41')]({'all':!![]});}else if(_0x26bf7a[_0xb8a8('0x40')]){if(Array[_0xb8a8('0x18')](_0x26bf7a['include'])){_0x244e7c=Object[_0xb8a8('0x4')](_0x26bf7a[_0xb8a8('0x40')])['map'](function(_0x5420f9){return parseIncludeModel(_0x26bf7a[_0xb8a8('0x40')][_0x5420f9]);});}else{var _0x45e3d3=parseIncludeModel(_0x26bf7a[_0xb8a8('0x40')]);_0x244e7c['push'](_0x45e3d3);}}return _0x244e7c;}; \ No newline at end of file +var _0x683f=['DATE','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','limit','offset','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','{EXPR}','push','replace','getOptions','query','$id','attributes','intersection','nolimit','order','sort','where','pick','filter','object','columns','value','merge','map','lower','includeAll','include','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','raw','split','filters','forOwn','find','type'];(function(_0x1a291f,_0xe36641){var _0x109313=function(_0xba951f){while(--_0xba951f){_0x1a291f['push'](_0x1a291f['shift']());}};_0x109313(++_0xe36641);}(_0x683f,0x18e));var _0xf683=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x683f[_0x2fa1c6];return _0x5f3257;};'use strict';var _=require(_0xf683('0x0'));var sequelize=require(_0xf683('0x1'));var moment=require(_0xf683('0x2'));var db=require(_0xf683('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5461fb){var _0x1266e3=['ne'];try{var _0x577816=JSON['parse'](_0x5461fb);var _0x1d740c=Object[_0xf683('0x4')](_0x577816)[0x0];return _0x1266e3[_0xf683('0x5')](_0x1d740c);}catch(_0x2bb81e){return![];}}function getOperatorValue(_0x53e1c4){var _0x46b9a3=JSON[_0xf683('0x6')](_0x53e1c4);var _0x48ccd9=Object[_0xf683('0x4')](_0x46b9a3)[0x0];var _0x20a5a0=_0x46b9a3[_0x48ccd9];return{['$'+_0x48ccd9]:_0x20a5a0};}function parseIncludeModel(_0x54dca5){var _0x1abd7f=JSON['parse'](_0x54dca5);return{'model':db[_0x1abd7f[_0xf683('0x7')]],'as':_0x1abd7f[_0xf683('0x8')],'attributes':_0x1abd7f[_0xf683('0x9')],'raw':_0x1abd7f[_0xf683('0xa')]};}exports[_0xf683('0x9')]=function(_0x2f61e5){var _0x5fd41a=null;if(_0x2f61e5){_0x5fd41a=_0x2f61e5[_0xf683('0xb')](',');}return _0x5fd41a;};exports[_0xf683('0xc')]=function(_0x597459,_0x1dfc34){var _0x5ea448={};if(!_['isEmpty'](_0x597459)){_[_0xf683('0xd')](_0x597459,function(_0x498f9c,_0x2acf54){try{if(_0x1dfc34){var _0x395e6e=_[_0xf683('0xe')](_0x1dfc34,{'name':_0x2acf54})||{};if(hasSequelizeOperator(_0x498f9c)){_0x5ea448[_0x2acf54]=getOperatorValue(_0x498f9c);}else if(_0x395e6e[_0xf683('0xf')]===_0xf683('0x10')&&_['isPlainObject'](_0x498f9c)){var _0x26eee5=JSON[_0xf683('0x6')](_0x498f9c);var _0x4dd082={'$gte':moment(moment(_0x26eee5[_0xf683('0x11')])['format'](_0xf683('0x12')))[_0xf683('0x13')]()[_0xf683('0x14')](),'$lte':moment(moment(_0x26eee5[_0xf683('0x15')])[_0xf683('0x14')](_0xf683('0x12')))[_0xf683('0x13')]()[_0xf683('0x16')](0x1,'s')[_0xf683('0x14')]()};_0x5ea448[_0x2acf54]=_0x4dd082;}else if(_0x395e6e[_0xf683('0x17')]===_0xf683('0x18')){_0x5ea448[_0x2acf54]=_0x498f9c;}else{_0x5ea448[_0x2acf54]=_[_0xf683('0x19')](_0x498f9c)?_0x498f9c:JSON[_0xf683('0x6')](_0x498f9c);}}else{_0x5ea448[_0x2acf54]=_[_0xf683('0x19')](_0x498f9c)?_0x498f9c:JSON[_0xf683('0x6')](_0x498f9c);}}catch(_0x425447){_0x5ea448[_0x2acf54]=_0x498f9c[_0xf683('0xb')](',');}});}return _0x5ea448;};exports[_0xf683('0x1a')]=function(_0x3d9dc9){_0x3d9dc9=parseInt(_0x3d9dc9,0xa);if(!_0x3d9dc9||_0x3d9dc9<0x0){_0x3d9dc9=LIMIT_VALUE;}return _0x3d9dc9;};exports[_0xf683('0x1b')]=function(_0x35cc2c){_0x35cc2c=parseInt(_0x35cc2c,0xa);if(!_0x35cc2c||_0x35cc2c<0x0){_0x35cc2c=0x0;}return _0x35cc2c;};exports['sort']=function(_0x285cfc){var _0x41ebc0,_0x2410c9=null;if(_0x285cfc){_0x41ebc0=_0x285cfc[_0xf683('0xb')](',');_0x2410c9=_['map'](_0x41ebc0,function(_0x4b7e0f){if(_0x4b7e0f[_0xf683('0x1c')]('-')===0x0){return[_0x4b7e0f===_0xf683('0x1d')?sequelize[_0xf683('0x1e')](sequelize[_0xf683('0x1f')](_0xf683('0x1d')),_0xf683('0x20')):_0x4b7e0f[_0xf683('0x21')](0x1),_0xf683('0x22')];}else{return[_0x4b7e0f===_0xf683('0x1d')?sequelize[_0xf683('0x1e')](sequelize[_0xf683('0x1f')]('priority'),_0xf683('0x20')):_0x4b7e0f,_0xf683('0x23')];}});}return _0x2410c9;};exports[_0xf683('0x24')]=function(_0x3106d5,_0x30cc25){if(_[_0xf683('0x25')](_0x3106d5)){return _0x3106d5;}if(_[_0xf683('0x19')](_0x3106d5)){for(var _0x2ee79c=0x0;_0x2ee79c<_0x3106d5[_0xf683('0x26')];_0x2ee79c+=0x1){_0x3106d5[_0x2ee79c]=this[_0xf683('0x24')](_0x3106d5[_0x2ee79c],_0x30cc25);}return _0x3106d5;}if(!_[_0xf683('0x27')](_0x3106d5)){return _0x3106d5;}if(_[_0xf683('0x28')](_0x30cc25)){_0x30cc25=[_0x30cc25];}if(!_[_0xf683('0x19')](_0x30cc25)){return _0x3106d5;}for(var _0x52eb65=0x0;_0x52eb65<_0x30cc25['length'];_0x52eb65+=0x1){_[_0xf683('0x29')](_0x3106d5,_0x30cc25[_0x52eb65]);}for(var _0x4b3a5e in _0x3106d5){if(_0x3106d5[_0xf683('0x2a')](_0x4b3a5e)){_0x3106d5[_0x4b3a5e]=this[_0xf683('0x24')](_0x3106d5[_0x4b3a5e],_0x30cc25);}}return _0x3106d5;};exports[_0xf683('0x2b')]=function(_0x31087f){return _0x31087f[_0xf683('0x2c')](RegExp(_0xf683('0x2d')))?!![]:![];};exports[_0xf683('0x2e')]=function(_0x1b34d2){return _0x1b34d2[_0xf683('0x2c')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4a323f,_0x488cf3){var _0x3f8b0d=[];var _0x2977f9=/[ `!@#$%^&*()_\-?~]/;var _0x32d08b=_0x488cf3?'\x22{EXPR}\x22':_0xf683('0x2f');_0x4a323f[_0xf683('0xb')](/[ ,]+/)['forEach'](function(_0x346d57){_0x346d57=_0x346d57['replace'](/([^:]")"+/g,'$1');_0x346d57='+'+_0x346d57+'*';var _0x756345=_0x346d57[_0xf683('0x2c')](_0x2977f9);if(_0x756345){_0x346d57='\x22'+_0x346d57+'\x22';}_0x3f8b0d[_0xf683('0x30')](_0x346d57);});_0x32d08b=_0x32d08b[_0xf683('0x31')](_0xf683('0x2f'),_0x3f8b0d['join']('\x20'));return _0x32d08b;};exports[_0xf683('0x32')]=function(_0x43996f,_0x5bd6a4,_0x5bc0ce){var _0x1e6fe9={},_0x27c60f={};if(_0x5bd6a4[_0xf683('0x33')][_0xf683('0x34')]){_0x5bd6a4[_0xf683('0x33')]['id']=_0x5bd6a4[_0xf683('0x33')][_0xf683('0x34')];delete _0x5bd6a4[_0xf683('0x33')][_0xf683('0x34')];}_0x1e6fe9[_0xf683('0x7')]=_['map'](_0x43996f,_0xf683('0x17'));_0x1e6fe9['query']=_[_0xf683('0x4')](_0x5bd6a4[_0xf683('0x33')]);_0x1e6fe9[_0xf683('0xc')]=_['intersection'](_0x1e6fe9[_0xf683('0x7')],_0x1e6fe9[_0xf683('0x33')]);_0x27c60f[_0xf683('0x35')]=_[_0xf683('0x36')](_0x1e6fe9[_0xf683('0x7')],this[_0xf683('0x9')](_0x5bd6a4[_0xf683('0x33')][_0xf683('0x9')]));_0x27c60f[_0xf683('0x35')]=_0x27c60f[_0xf683('0x35')]['length']?_0x27c60f[_0xf683('0x35')]:_0x1e6fe9[_0xf683('0x7')];if(!_0x5bd6a4[_0xf683('0x33')][_0xf683('0x2a')](_0xf683('0x37'))){_0x27c60f[_0xf683('0x1a')]=this[_0xf683('0x1a')](_0x5bd6a4['query'][_0xf683('0x1a')]);_0x27c60f[_0xf683('0x1b')]=this[_0xf683('0x1b')](_0x5bd6a4['query'][_0xf683('0x1b')]);}_0x27c60f[_0xf683('0x38')]=this[_0xf683('0x39')](_0x5bd6a4[_0xf683('0x33')][_0xf683('0x39')]);_0x27c60f[_0xf683('0x3a')]=this[_0xf683('0xc')](_[_0xf683('0x3b')](_0x5bd6a4[_0xf683('0x33')],_0x1e6fe9['filters']),_0x43996f);if(_0x5bd6a4['query'][_0xf683('0x3c')]){var _0x148e68=_0x43996f;var _0x2569e3=_0x5bd6a4[_0xf683('0x33')][_0xf683('0x3c')];if(typeof _0x2569e3===_0xf683('0x3d')){_0x148e68=_[_0xf683('0x3c')](_0x43996f,function(_0x3a8fb2){return _[_0xf683('0x5')](_0x2569e3[_0xf683('0x3e')],_0x3a8fb2['name']);});_0x2569e3=_0x2569e3[_0xf683('0x3f')];}_0x27c60f['where']=_[_0xf683('0x40')](_0x27c60f[_0xf683('0x3a')],{'$or':_[_0xf683('0x41')](_0x148e68,function(_0x50b38d){if(_0x50b38d[_0xf683('0xf')]!=='VIRTUAL'){if(_0x5bc0ce){return sequelize[_0xf683('0x3a')](sequelize['fn'](_0xf683('0x42'),sequelize[_0xf683('0x1f')](_0x50b38d[_0xf683('0x17')])),{'$like':sequelize['fn'](_0xf683('0x42'),'%'+_0x5bd6a4[_0xf683('0x33')]['filter']+'%')});}else{var _0x6fa1ac={};_0x6fa1ac[_0x50b38d[_0xf683('0x17')]]={'$like':'%'+_0x5bd6a4['query'][_0xf683('0x3c')]+'%'};return _0x6fa1ac;}}})});}_0x27c60f=_[_0xf683('0x40')]({},_0x27c60f,_0x5bd6a4['options']);return _0x27c60f;};exports['include']=function(_0x2e34b9){var _0x556fd8=[];if(_0x2e34b9[_0xf683('0x43')]){_0x556fd8[_0xf683('0x30')]({'all':!![]});}else if(_0x2e34b9[_0xf683('0x44')]){if(Array['isArray'](_0x2e34b9[_0xf683('0x44')])){_0x556fd8=Object[_0xf683('0x4')](_0x2e34b9[_0xf683('0x44')])[_0xf683('0x41')](function(_0x1b4532){return parseIncludeModel(_0x2e34b9['include'][_0x1b4532]);});}else{var _0x602d8b=parseIncludeModel(_0x2e34b9[_0xf683('0x44')]);_0x556fd8[_0xf683('0x30')](_0x602d8b);}}return _0x556fd8;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7897122..2ad9fe5 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 _0x24ca=['find','merge','globalStatus','getSortedAgentsIdsByStatus','fields','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','smsCapacity','smsCurrentCapacity','routealias','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','User','name','fullname','pauseType'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x24ca,0x1bc));var _0xa24c=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x24ca[_0x903228];return _0xcec81d;};'use strict';var _=require(_0xa24c('0x0'));var jayson=require('jayson/promise');var db=require(_0xa24c('0x1'))['db'];var amiClient=jayson[_0xa24c('0x2')][_0xa24c('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xa24c('0x3')]({'port':0x232c});function isAgentPaused(_0x8a54a0,_0x195e60){var _0x28aa2f=[_0x8a54a0[_0xa24c('0x4')],_0x8a54a0[_0xa24c('0x5')],_0x8a54a0[_0xa24c('0x6')],_0x8a54a0[_0xa24c('0x7')],_0x8a54a0[_0xa24c('0x8')],_0x8a54a0[_0xa24c('0x9')],_0x8a54a0[_0xa24c('0xa')]];if(!_0x195e60)return _['every'](_0x28aa2f);var _0x42d89c=_[_0xa24c('0xb')](_0x28aa2f);return _0x42d89c[_0xa24c('0xc')]>0x0&&_0x42d89c['length']<_0x28aa2f[_0xa24c('0xc')]?!![]:![];}function isIdle(_0x325c6d){return _0x325c6d===_0xa24c('0xd')||_0x325c6d===_0xa24c('0xe')||_0x325c6d===_0xa24c('0xf')||_0x325c6d===_0xa24c('0x10')||_[_0xa24c('0x11')](_0x325c6d);}function isAgentIdle(_0xc82af0){if(_0xc82af0[_0xa24c('0x12')]!=='idle'&&_0xc82af0[_0xa24c('0x9')]){_0xc82af0[_0xa24c('0x12')]=_0xa24c('0x13');return![];}return _[_0xa24c('0x14')]([_0xc82af0['chatStatus'],_0xc82af0[_0xa24c('0x15')],_0xc82af0[_0xa24c('0x16')],_0xc82af0[_0xa24c('0x17')],_0xc82af0[_0xa24c('0x18')],_0xc82af0[_0xa24c('0x12')],_0xc82af0[_0xa24c('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa24c('0x1a')]('Agents',{})['then'](function(_0xb80781){if(_0xb80781[_0xa24c('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x5babb5=_0xb80781[_0xa24c('0x1c')];return routingClient[_0xa24c('0x1a')]('Agents',{})[_0xa24c('0x1d')](function(_0x5de3e6){if(_0x5de3e6[_0xa24c('0x1b')]){throw new Error(_0xa24c('0x1e'));}var _0x1fcd4b=_0x5de3e6[_0xa24c('0x1c')];return _['merge']({},_0x5babb5,_0x1fcd4b);});})[_0xa24c('0x1f')](function(_0x18b7e0){throw _0x18b7e0;});}exports[_0xa24c('0x20')]=getRealtimeAgents;function getAgentStatus(_0x4d4bab){var _0x48a768='unknown';if(isAgentPaused(_0x4d4bab))_0x48a768='pause';else if(isAgentPaused(_0x4d4bab,!![]))_0x48a768=_0xa24c('0x21');else if(isAgentIdle(_0x4d4bab))_0x48a768=_0xa24c('0xd');else _0x48a768=_0xa24c('0x22');return _0x48a768;}exports[_0xa24c('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x51a275,_0x30ec21){var _0x5f299e=_[_0xa24c('0x24')](_0x51a275)?_0x51a275:[_0x51a275];var _0xb81d97=_['startCase'](_0x30ec21)+_0xa24c('0x25');var _0x363d52=_[_0xa24c('0x26')](_0x5f299e,function(_0x188ee2){return db[_0xb81d97][_0xa24c('0x27')]({'where':{'id':_0x188ee2}})['then'](function(_0xec9167){if(!_0xec9167)return[];return _0xec9167['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xa24c('0x28')](_0x363d52)[_0xa24c('0x1d')](function(_0x294685){var _0x51dc3f=_(_0x294685)[_0xa24c('0x29')]()[_0xa24c('0x26')]('id')[_0xa24c('0x2a')]()[_0xa24c('0x2b')]();return _0x51dc3f;});}exports[_0xa24c('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ad0e6,_0x39609a,_0x5b23f4){try{if(_0x39609a[_0xa24c('0xc')]>0x0){_0x3ad0e6=_0x3ad0e6[_0xa24c('0xb')](function(_0x152120){return _0x39609a[_0xa24c('0x2d')](_0x152120['id']);});}var _0x5e491e=_0x3ad0e6[_0xa24c('0xb')](function(_0xc96ce7){var _0x97c08='busy';if(isAgentIdle(_0xc96ce7)){_0x97c08=_0xa24c('0xd');}return _0x97c08===_0x5b23f4;});return _[_0xa24c('0x26')](_0x5e491e,'id');}catch(_0x253d83){throw _0x253d83;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x245fb2,_0x5e0226,_0x1102ab){return Promise[_0xa24c('0x2e')]()[_0xa24c('0x1d')](function(){if(_0x5e0226['length']>0x0){_0x245fb2=_0x245fb2[_0xa24c('0xb')](function(_0x53f90){return _0x5e0226[_0xa24c('0x2d')](_0x53f90['id']);});}return _0x245fb2;})['then'](function(){return db[_0xa24c('0x2f')]['findAll']({'attributes':['id',_0xa24c('0x30'),_0xa24c('0x31'),'chatPause','faxPause',_0xa24c('0x6'),_0xa24c('0x7'),_0xa24c('0x8'),_0xa24c('0x9'),_0xa24c('0xa'),_0xa24c('0x32')],'where':{'id':{'$in':_[_0xa24c('0x26')](_0x245fb2,'id')}},'raw':!![]});})['then'](function(_0x39f146){return _0x39f146[_0xa24c('0x26')](function(_0x12825d){var _0xbd24c0=_[_0xa24c('0x33')](_0x245fb2,['id',_0x12825d['id']]);var _0x31b19d=filterAgentAttributes(_0xbd24c0);_[_0xa24c('0x34')](_0x12825d,_0x31b19d);_0x12825d[_0xa24c('0x35')]=getAgentStatus(_0x12825d);return _0x12825d;});})[_0xa24c('0x1d')](function(_0x129bb9){var _0x4c7a30=sortAgentsByStatus(_0x129bb9,_0x1102ab);return _[_0xa24c('0x26')](_0x4c7a30,'id');})[_0xa24c('0x1f')](function(_0x2b362d){throw _0x2b362d;});}exports[_0xa24c('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x578b72){var _0x56a485={'fields':[],'order':null};var _0x19a65f=_0x578b72['split'](',');_0x56a485[_0xa24c('0x37')]=_[_0xa24c('0xb')](_0x19a65f,function(_0x22a316){if(!_0x22a316[_0xa24c('0x2d')](_0xa24c('0x35'))){return!![];}_0x56a485['order']=_['startsWith'](_0x22a316,'-')?_0xa24c('0x38'):_0xa24c('0x39');return![];});return _0x56a485;}exports[_0xa24c('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x213dc3){if(!_0x213dc3){_0x213dc3=_0xa24c('0x3b');}if(_0x213dc3[_0xa24c('0x2d')]('fullname')&&!_0x213dc3['includes'](_0xa24c('0x3c'))){var _0x1ce83e=_0x213dc3[_0xa24c('0x3d')](0x0,_0x213dc3[_0xa24c('0x3e')](_0xa24c('0x31')));_0x213dc3+=','+_0x1ce83e+'internal';}return _0x213dc3;}exports[_0xa24c('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x7895e,_0x5ef186){var _0x599627=_0x7895e[_0xa24c('0x40')](function(_0x44f6ae,_0x231eea){if(_0x44f6ae['globalStatus']===_0x231eea['globalStatus']){if(_0x44f6ae[_0xa24c('0x35')]===_0xa24c('0x13')){if(_0x5ef186===_0xa24c('0x38')){return(_0x44f6ae[_0xa24c('0x32')]||'')<(_0x231eea[_0xa24c('0x32')]||'')||_0x44f6ae[_0xa24c('0x31')][_0xa24c('0x41')]()>_0x231eea[_0xa24c('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x44f6ae['pauseType']||'')<(_0x231eea[_0xa24c('0x32')]||'')||_0x44f6ae[_0xa24c('0x31')][_0xa24c('0x41')]()>_0x231eea['fullname'][_0xa24c('0x41')]()?-0x1:0x1;}}else{if(_0x5ef186===_0xa24c('0x38')){return _0x44f6ae[_0xa24c('0x31')][_0xa24c('0x41')]()<_0x231eea[_0xa24c('0x31')][_0xa24c('0x41')]()?0x1:-0x1;}else{return _0x44f6ae[_0xa24c('0x31')][_0xa24c('0x41')]()<_0x231eea[_0xa24c('0x31')][_0xa24c('0x41')]()?-0x1:0x1;}}}else{if(_0x5ef186==='DESC'){return _0x44f6ae[_0xa24c('0x35')]<_0x231eea[_0xa24c('0x35')]?0x1:-0x1;}else{return _0x44f6ae[_0xa24c('0x35')]<_0x231eea['globalStatus']?-0x1:0x1;}}});return _0x599627;}exports[_0xa24c('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x247d2c){var _0x3feaf6=[_0xa24c('0x43'),_0xa24c('0x44'),_0xa24c('0x45'),_0xa24c('0x46'),_0xa24c('0x32'),_0xa24c('0x46'),_0xa24c('0x3c'),_0xa24c('0x47'),'chatPause',_0xa24c('0x7'),_0xa24c('0x6'),_0xa24c('0x8'),_0xa24c('0xa'),_0xa24c('0x5'),_0xa24c('0x9'),_0xa24c('0x48'),_0xa24c('0x49'),_0xa24c('0x4a'),'smsCapacity','whatsappCapacity',_0xa24c('0x4b'),'chatCurrentCapacity',_0xa24c('0x4c'),_0xa24c('0x4d'),'smsCurrentCapacity',_0xa24c('0x4e'),_0xa24c('0x4f'),_0xa24c('0x50'),'openchannelStatus','mailStatus',_0xa24c('0x18'),'whatsappStatus',_0xa24c('0x15'),_0xa24c('0x12'),_0xa24c('0x51'),_0xa24c('0x52'),_0xa24c('0x53'),_0xa24c('0x54'),_0xa24c('0x55'),_0xa24c('0x56'),_0xa24c('0x57'),_0xa24c('0x58'),'destconnectedlinenum',_0xa24c('0x59'),_0xa24c('0x5a'),_0xa24c('0x5b'),'routealias'];var _0x5bde94=['chatPause',_0xa24c('0x7'),'mailPause',_0xa24c('0x8'),_0xa24c('0xa'),'faxPause',_0xa24c('0x9'),_0xa24c('0x44')];var _0x131a7a=_(_0x247d2c)[_0xa24c('0x5c')](_0x5bde94)[_0xa24c('0x5d')](_0x3feaf6)[_0xa24c('0x2b')]();return _0x131a7a;}exports[_0xa24c('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xa24c('0x30'),'fullname',_0xa24c('0x5f'),'internal','online','globalStatus','userpic','lastLoginAt',_0xa24c('0x32'),'lastPauseAt',_0xa24c('0x5'),_0xa24c('0x4'),_0xa24c('0x6'),_0xa24c('0x7'),_0xa24c('0x8'),_0xa24c('0x9'),_0xa24c('0xa'),_0xa24c('0x50'),_0xa24c('0x15'),_0xa24c('0x16'),_0xa24c('0x17'),_0xa24c('0x18'),_0xa24c('0x12'),_0xa24c('0x19'),_0xa24c('0x51'),'faxStatusTime',_0xa24c('0x53'),_0xa24c('0x52'),'smsStatusTime',_0xa24c('0x57'),_0xa24c('0x55'),_0xa24c('0x48'),_0xa24c('0x4b'),'mailCapacity','openchannelCapacity',_0xa24c('0x60'),'whatsappCapacity','chatCurrentCapacity',_0xa24c('0x4f'),_0xa24c('0x4d'),_0xa24c('0x4c'),_0xa24c('0x61'),'whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent',_0xa24c('0x5b'),'destconnectedlinenum','onhold',_0xa24c('0x58'),_0xa24c('0x62'),_0xa24c('0x59')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x4819=['queue','destconnectedlinenum','omit','pick','filterAgentAttributes','role','whatsappStatusTime','chatCapacity','mailCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','routealias','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','pause','*pause','busy','isArray','startCase','Queue','findOne','getAgents','all','flatten','map','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','openchannelPause','smsPause','pauseType','globalStatus','split','fields','startsWith','ASC','fullname,internal','internal','indexOf','validateSortParameter','DESC','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime'];(function(_0x3e81c2,_0x4533d6){var _0x5acff1=function(_0x10222f){while(--_0x10222f){_0x3e81c2['push'](_0x3e81c2['shift']());}};_0x5acff1(++_0x4533d6);}(_0x4819,0xcd));var _0x9481=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x4819[_0x590851];return _0x3b0115;};'use strict';var _=require('lodash');var jayson=require(_0x9481('0x0'));var db=require(_0x9481('0x1'))['db'];var amiClient=jayson[_0x9481('0x2')][_0x9481('0x3')]({'port':0x232a});var routingClient=jayson[_0x9481('0x2')][_0x9481('0x3')]({'port':0x232c});function isAgentPaused(_0x40a703,_0x14dc10){var _0xc39edf=[_0x40a703[_0x9481('0x4')],_0x40a703['faxPause'],_0x40a703[_0x9481('0x5')],_0x40a703['openchannelPause'],_0x40a703['smsPause'],_0x40a703[_0x9481('0x6')],_0x40a703[_0x9481('0x7')]];if(!_0x14dc10)return _[_0x9481('0x8')](_0xc39edf);var _0x3278ff=_[_0x9481('0x9')](_0xc39edf);return _0x3278ff['length']>0x0&&_0x3278ff[_0x9481('0xa')]<_0xc39edf['length']?!![]:![];}function isIdle(_0x2fabf1){return _0x2fabf1==='idle'||_0x2fabf1===_0x9481('0xb')||_0x2fabf1===_0x9481('0xc')||_0x2fabf1===_0x9481('0xd')||_[_0x9481('0xe')](_0x2fabf1);}function isAgentIdle(_0xe84f77){if(_0xe84f77[_0x9481('0xf')]!==_0x9481('0x10')&&_0xe84f77[_0x9481('0x6')]){_0xe84f77[_0x9481('0xf')]='pause';return![];}return _['every']([_0xe84f77[_0x9481('0x11')],_0xe84f77[_0x9481('0x12')],_0xe84f77[_0x9481('0x13')],_0xe84f77[_0x9481('0x14')],_0xe84f77[_0x9481('0x15')],_0xe84f77[_0x9481('0xf')],_0xe84f77[_0x9481('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x9481('0x17'),{})[_0x9481('0x18')](function(_0x5b1fe6){if(_0x5b1fe6[_0x9481('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x34108d=_0x5b1fe6[_0x9481('0x1a')];return routingClient[_0x9481('0x1b')](_0x9481('0x17'),{})['then'](function(_0x5eda66){if(_0x5eda66[_0x9481('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d0da7=_0x5eda66[_0x9481('0x1a')];return _[_0x9481('0x1c')]({},_0x34108d,_0x4d0da7);});})[_0x9481('0x1d')](function(_0x41051d){throw _0x41051d;});}exports[_0x9481('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3dc33f){var _0x55a1bd=_0x9481('0xb');if(isAgentPaused(_0x3dc33f))_0x55a1bd=_0x9481('0x1f');else if(isAgentPaused(_0x3dc33f,!![]))_0x55a1bd=_0x9481('0x20');else if(isAgentIdle(_0x3dc33f))_0x55a1bd=_0x9481('0x10');else _0x55a1bd=_0x9481('0x21');return _0x55a1bd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x215dd7,_0x294908){var _0x572599=_[_0x9481('0x22')](_0x215dd7)?_0x215dd7:[_0x215dd7];var _0xd1cd1a=_[_0x9481('0x23')](_0x294908)+_0x9481('0x24');var _0x2dc02e=_['map'](_0x572599,function(_0x91e3d9){return db[_0xd1cd1a][_0x9481('0x25')]({'where':{'id':_0x91e3d9}})['then'](function(_0x5eb4f5){if(!_0x5eb4f5)return[];return _0x5eb4f5[_0x9481('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x9481('0x27')](_0x2dc02e)['then'](function(_0x1e6f28){var _0x20ff9a=_(_0x1e6f28)[_0x9481('0x28')]()[_0x9481('0x29')]('id')['uniq']()[_0x9481('0x2a')]();return _0x20ff9a;});}exports[_0x9481('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3c2585,_0x587706,_0x1791b2){try{if(_0x587706['length']>0x0){_0x3c2585=_0x3c2585[_0x9481('0x9')](function(_0xe153ab){return _0x587706[_0x9481('0x2c')](_0xe153ab['id']);});}var _0x13ef93=_0x3c2585[_0x9481('0x9')](function(_0x53560d){var _0x2aa9ff=_0x9481('0x21');if(isAgentIdle(_0x53560d)){_0x2aa9ff=_0x9481('0x10');}return _0x2aa9ff===_0x1791b2;});return _['map'](_0x13ef93,'id');}catch(_0x56752e){throw _0x56752e;}}exports[_0x9481('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x427c25,_0x42df68,_0x2b33f8){return Promise['resolve']()['then'](function(){if(_0x42df68['length']>0x0){_0x427c25=_0x427c25[_0x9481('0x9')](function(_0x5d6c65){return _0x42df68[_0x9481('0x2c')](_0x5d6c65['id']);});}return _0x427c25;})['then'](function(){return db[_0x9481('0x2e')][_0x9481('0x2f')]({'attributes':['id',_0x9481('0x30'),_0x9481('0x31'),_0x9481('0x4'),'faxPause',_0x9481('0x5'),_0x9481('0x32'),_0x9481('0x33'),'voicePause',_0x9481('0x7'),_0x9481('0x34')],'where':{'id':{'$in':_[_0x9481('0x29')](_0x427c25,'id')}},'raw':!![]});})[_0x9481('0x18')](function(_0xdc87e6){return _0xdc87e6[_0x9481('0x29')](function(_0x5d7299){var _0x41c6a2=_['find'](_0x427c25,['id',_0x5d7299['id']]);var _0x203ef9=filterAgentAttributes(_0x41c6a2);_[_0x9481('0x1c')](_0x5d7299,_0x203ef9);_0x5d7299[_0x9481('0x35')]=getAgentStatus(_0x5d7299);return _0x5d7299;});})[_0x9481('0x18')](function(_0x2ebcbd){var _0x2face9=sortAgentsByStatus(_0x2ebcbd,_0x2b33f8);return _['map'](_0x2face9,'id');})[_0x9481('0x1d')](function(_0x15e27f){throw _0x15e27f;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5e00ad){var _0x31ea6a={'fields':[],'order':null};var _0x5ab28f=_0x5e00ad[_0x9481('0x36')](',');_0x31ea6a[_0x9481('0x37')]=_[_0x9481('0x9')](_0x5ab28f,function(_0x2a1bcf){if(!_0x2a1bcf['includes'](_0x9481('0x35'))){return!![];}_0x31ea6a['order']=_[_0x9481('0x38')](_0x2a1bcf,'-')?'DESC':_0x9481('0x39');return![];});return _0x31ea6a;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x315fb9){if(!_0x315fb9){_0x315fb9=_0x9481('0x3a');}if(_0x315fb9[_0x9481('0x2c')](_0x9481('0x31'))&&!_0x315fb9[_0x9481('0x2c')](_0x9481('0x3b'))){var _0xb6ff1=_0x315fb9['substring'](0x0,_0x315fb9[_0x9481('0x3c')](_0x9481('0x31')));_0x315fb9+=','+_0xb6ff1+_0x9481('0x3b');}return _0x315fb9;}exports[_0x9481('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x3f1b6f,_0x344e2d){var _0x2e4241=_0x3f1b6f['sort'](function(_0xf7b2e1,_0x1872ff){if(_0xf7b2e1['globalStatus']===_0x1872ff[_0x9481('0x35')]){if(_0xf7b2e1[_0x9481('0x35')]===_0x9481('0x1f')){if(_0x344e2d===_0x9481('0x3e')){return(_0xf7b2e1[_0x9481('0x34')]||'')<(_0x1872ff['pauseType']||'')||_0xf7b2e1[_0x9481('0x31')]['toLowerCase']()>_0x1872ff[_0x9481('0x31')][_0x9481('0x3f')]()?0x1:-0x1;}else{return(_0xf7b2e1['pauseType']||'')<(_0x1872ff['pauseType']||'')||_0xf7b2e1[_0x9481('0x31')][_0x9481('0x3f')]()>_0x1872ff[_0x9481('0x31')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x344e2d===_0x9481('0x3e')){return _0xf7b2e1[_0x9481('0x31')]['toLowerCase']()<_0x1872ff['fullname'][_0x9481('0x3f')]()?0x1:-0x1;}else{return _0xf7b2e1['fullname'][_0x9481('0x3f')]()<_0x1872ff[_0x9481('0x31')][_0x9481('0x3f')]()?-0x1:0x1;}}}else{if(_0x344e2d===_0x9481('0x3e')){return _0xf7b2e1[_0x9481('0x35')]<_0x1872ff['globalStatus']?0x1:-0x1;}else{return _0xf7b2e1[_0x9481('0x35')]<_0x1872ff[_0x9481('0x35')]?-0x1:0x1;}}});return _0x2e4241;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x1c98fa){var _0x35d740=[_0x9481('0x40'),_0x9481('0x41'),_0x9481('0x42'),_0x9481('0x43'),_0x9481('0x34'),_0x9481('0x43'),_0x9481('0x3b'),'address',_0x9481('0x4'),'openchannelPause','mailPause',_0x9481('0x33'),'whatsappPause',_0x9481('0x44'),_0x9481('0x6'),'chatCapacity',_0x9481('0x45'),_0x9481('0x46'),_0x9481('0x47'),_0x9481('0x48'),_0x9481('0x49'),_0x9481('0x4a'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x9481('0x4b'),_0x9481('0x4c'),_0x9481('0x4d'),_0x9481('0x11'),_0x9481('0x14'),_0x9481('0x13'),_0x9481('0x15'),_0x9481('0x16'),'faxStatus',_0x9481('0xf'),_0x9481('0x4e'),_0x9481('0x4f'),_0x9481('0x50'),_0x9481('0x51'),'whatsappStatusTime','faxStatusTime',_0x9481('0x52'),_0x9481('0x53'),_0x9481('0x54'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias'];var _0x538507=['chatPause','openchannelPause',_0x9481('0x5'),_0x9481('0x33'),'whatsappPause',_0x9481('0x44'),'voicePause',_0x9481('0x41')];var _0x229b69=_(_0x1c98fa)[_0x9481('0x55')](_0x538507)[_0x9481('0x56')](_0x35d740)[_0x9481('0x2a')]();return _0x229b69;}exports[_0x9481('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x9481('0x30'),'fullname',_0x9481('0x58'),_0x9481('0x3b'),'online',_0x9481('0x35'),_0x9481('0x40'),_0x9481('0x42'),_0x9481('0x34'),_0x9481('0x43'),'faxPause',_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x32'),_0x9481('0x33'),_0x9481('0x6'),_0x9481('0x7'),_0x9481('0x11'),_0x9481('0x12'),_0x9481('0x13'),'openchannelStatus','smsStatus','voiceStatus',_0x9481('0x16'),_0x9481('0x4e'),'faxStatusTime',_0x9481('0x50'),_0x9481('0x4f'),_0x9481('0x51'),_0x9481('0x52'),_0x9481('0x59'),_0x9481('0x5a'),'faxCapacity','mailCapacity',_0x9481('0x45'),_0x9481('0x47'),_0x9481('0x48'),_0x9481('0x4a'),_0x9481('0x4d'),_0x9481('0x5b'),'openchannelCurrentCapacity','smsCurrentCapacity',_0x9481('0x4c'),'phoneBarEnableScreenRecordingByAgent',_0x9481('0x5c'),'destconnectedlinenum',_0x9481('0x5d'),_0x9481('0x53'),_0x9481('0x5e'),'screenrecording'];}exports[_0x9481('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index eb4675b..8fcffa3 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 _0x9488=['predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','paused','available','talking','merge','pick','initializeQueues','lodash','jayson/promise','client','http','loggedIn','waiting','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','unknown','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold'];(function(_0x4fe3a9,_0x2a6654){var _0x1d1df1=function(_0xf6f3c5){while(--_0xf6f3c5){_0x4fe3a9['push'](_0x4fe3a9['shift']());}};_0x1d1df1(++_0x2a6654);}(_0x9488,0x1e5));var _0x8948=function(_0x158598,_0x433f61){_0x158598=_0x158598-0x0;var _0x19ddcd=_0x9488[_0x158598];return _0x19ddcd;};'use strict';var _=require(_0x8948('0x0'));var jayson=require(_0x8948('0x1'));var util=require('util');var amiClient=jayson[_0x8948('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x8948('0x2')][_0x8948('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x8948('0x4'),'paused',_0x8948('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x8948('0x6'),_0x8948('0x7'),_0x8948('0x8'),'notInUse',_0x8948('0x9'),_0x8948('0xa'),_0x8948('0xb'),'talking','unavailable',_0x8948('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8948('0xd'),_0x8948('0xe'),_0x8948('0xf'),'statusMessage',_0x8948('0x10'),_0x8948('0x11'),_0x8948('0x12'),_0x8948('0x13'),_0x8948('0x14'),'erlangCalls',_0x8948('0x15'),_0x8948('0x16'),_0x8948('0x17'),'dialPredictiveInterval',_0x8948('0x18'),'dialPredictiveIntervalMinThreshold',_0x8948('0x19'),_0x8948('0x1a'),_0x8948('0x1b'),'predictiveIntervalDroppedCallsTimeout',_0x8948('0x1c'),_0x8948('0x1d'),_0x8948('0x1e')];function getRealtimeQueues(_0x2396c4,_0x18c468){var _0x1700c5=_0x18c468===_0x8948('0x1f')?amiClient:routingClient;return _0x1700c5[_0x8948('0x20')](_[_0x8948('0x21')](_0x18c468)+_0x8948('0x22'),_0x2396c4)['then'](function(_0x3ff517){if(_0x3ff517[_0x8948('0x23')])throw new Error(util[_0x8948('0x24')](_0x8948('0x25'),_0x18c468));return _0x3ff517[_0x8948('0x26')];})[_0x8948('0x27')](function(_0x211e66){throw _0x211e66;});}exports[_0x8948('0x28')]=getRealtimeQueues;function initializeQueues(_0x51a5e1,_0x39b316,_0x1e3b9c,_0x49e688){var _0x2da52e=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1e3b9c==='voice'){if(_0x49e688===_0x8948('0x29')){_0x2da52e=_0x2da52e[_0x8948('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x49e688===_0x8948('0x2b')){_0x2da52e=_0x2da52e[_0x8948('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x51a5e1['map'](function(_0x52f43b){var _0x5b2dc1=_0x52f43b[_0x8948('0x2c')]({'plain':!![]});_0x5b2dc1[_0x8948('0x2d')]=0x0;_0x5b2dc1[_0x8948('0x8')]=0x0;_0x5b2dc1['loggedIn']=0x0;_0x5b2dc1[_0x8948('0x2e')]=0x0;_0x5b2dc1[_0x8948('0x5')]=0x0;if(_0x1e3b9c===_0x8948('0x1f')){_0x5b2dc1[_0x8948('0x2f')]=0x0;_0x5b2dc1['busy']=0x0;if(_0x49e688===_0x8948('0x2b')){_0x5b2dc1[_0x8948('0xd')]=0x0;_0x5b2dc1[_0x8948('0xe')]=0x0;}}var _0x7d15fe=_['find'](_0x39b316,['id',_0x5b2dc1['id']]);if(_0x7d15fe){_[_0x8948('0x30')](_0x5b2dc1,_[_0x8948('0x31')](_0x7d15fe,_0x2da52e));}return _0x5b2dc1;});}exports[_0x8948('0x32')]=initializeQueues; \ No newline at end of file +var _0xb1b3=['unavailable','pTalking','originated','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1b3,0x89));var _0x3b1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b1b('0x0'));var jayson=require(_0x3b1b('0x1'));var util=require(_0x3b1b('0x2'));var amiClient=jayson[_0x3b1b('0x3')][_0x3b1b('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x3b1b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3b1b('0x5'),'loggedIn',_0x3b1b('0x6'),_0x3b1b('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x3b1b('0x8'),_0x3b1b('0x9'),_0x3b1b('0xa'),_0x3b1b('0xb'),'notInUse',_0x3b1b('0xc'),_0x3b1b('0xd'),_0x3b1b('0xe'),_0x3b1b('0xf'),_0x3b1b('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3b1b('0x11'),_0x3b1b('0x12'),_0x3b1b('0x13'),_0x3b1b('0x14'),_0x3b1b('0x15'),'dialMethod',_0x3b1b('0x16'),_0x3b1b('0x17'),_0x3b1b('0x18'),_0x3b1b('0x19'),_0x3b1b('0x1a'),_0x3b1b('0x1b'),'erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x3b1b('0x1c'),_0x3b1b('0x1d'),_0x3b1b('0x1e'),_0x3b1b('0x1f'),'predictiveIntervalDroppedCallsTimeout',_0x3b1b('0x20'),_0x3b1b('0x21'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x38028d,_0x146fcb){var _0x4daeb3=_0x146fcb===_0x3b1b('0x22')?amiClient:routingClient;return _0x4daeb3[_0x3b1b('0x23')](_[_0x3b1b('0x24')](_0x146fcb)+_0x3b1b('0x25'),_0x38028d)['then'](function(_0x4980a3){if(_0x4980a3['error'])throw new Error(util[_0x3b1b('0x26')](_0x3b1b('0x27'),_0x146fcb));return _0x4980a3['result'];})[_0x3b1b('0x28')](function(_0x20b650){throw _0x20b650;});}exports[_0x3b1b('0x29')]=getRealtimeQueues;function initializeQueues(_0x4fb8d0,_0x1a4185,_0x4b99eb,_0x3fc8a3){var _0x5be910=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4b99eb==='voice'){if(_0x3fc8a3===_0x3b1b('0x2a')){_0x5be910=_0x5be910[_0x3b1b('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3fc8a3===_0x3b1b('0x2c')){_0x5be910=_0x5be910[_0x3b1b('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4fb8d0[_0x3b1b('0x2d')](function(_0x5666e0){var _0x39591b=_0x5666e0[_0x3b1b('0x2e')]({'plain':!![]});_0x39591b[_0x3b1b('0x6')]=0x0;_0x39591b[_0x3b1b('0xb')]=0x0;_0x39591b[_0x3b1b('0x2f')]=0x0;_0x39591b[_0x3b1b('0x5')]=0x0;_0x39591b[_0x3b1b('0x7')]=0x0;if(_0x4b99eb===_0x3b1b('0x22')){_0x39591b[_0x3b1b('0xf')]=0x0;_0x39591b[_0x3b1b('0x8')]=0x0;if(_0x3fc8a3===_0x3b1b('0x2c')){_0x39591b['pTalking']=0x0;_0x39591b[_0x3b1b('0x12')]=0x0;}}var _0x44bf4c=_['find'](_0x1a4185,['id',_0x39591b['id']]);if(_0x44bf4c){_[_0x3b1b('0x30')](_0x39591b,_[_0x3b1b('0x31')](_0x44bf4c,_0x5be910));}return _0x39591b;});}exports[_0x3b1b('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0648f15..268249a 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x503325,_0x24a407){var _0x452fff=function(_0x42bf26){while(--_0x42bf26){_0x503325['push'](_0x503325['shift']());}};_0x452fff(++_0x24a407);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7be5d40..76ec6db 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 _0xadf5=['address','getFirstInterface','cpus','map','join','createHash','md5','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00'];(function(_0x2048ce,_0x455a8e){var _0x46d448=function(_0x5ca4aa){while(--_0x5ca4aa){_0x2048ce['push'](_0x2048ce['shift']());}};_0x46d448(++_0x455a8e);}(_0xadf5,0x12b));var _0x5adf=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xadf5[_0x515afd];return _0x536d53;};'use strict';var _=require(_0x5adf('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x5adf('0x1'));var exec=require(_0x5adf('0x2'))[_0x5adf('0x3')];var config=require(_0x5adf('0x4'));function getInterfaces(){var _0x590059=[];var _0x1e7db5=os[_0x5adf('0x5')]();var _0x542191=_[_0x5adf('0x6')](_[_0x5adf('0x7')](_0x1e7db5));for(var _0x1af47f=0x0;_0x1af47f<_0x542191[_0x5adf('0x8')];_0x1af47f++){var _0xb5f6ff=_0x1e7db5[_0x542191[_0x1af47f]][_0x5adf('0x9')](function(_0x5be5da){return _0x5be5da[_0x5adf('0xa')]===_0x5adf('0xb')&&_0x5be5da[_0x5adf('0xc')]===![];});_0x590059=_0x590059[_0x5adf('0xd')](_0xb5f6ff);}return _0x590059;}function getFirstInterface(){var _0x5604bc=_['head'](getInterfaces());return{'macAddress':_0x5604bc&&_0x5604bc[_0x5adf('0xe')]?_0x5604bc[_0x5adf('0xe')]:_0x5adf('0xf'),'ipAddress':_0x5604bc&&_0x5604bc[_0x5adf('0x10')]?_0x5604bc[_0x5adf('0x10')]:'127.0.0.1'};}exports[_0x5adf('0x11')]=getFirstInterface;function getCPUhash(){var _0x35a3ec=_['orderBy'](os[_0x5adf('0x12')]()[_0x5adf('0x13')](function(_0x45cf0f){return _0x45cf0f['model'];}))[_0x5adf('0x14')](':');return crypto[_0x5adf('0x15')](_0x5adf('0x16'))[_0x5adf('0x17')](_0x35a3ec)['digest'](_0x5adf('0x18'));}exports[_0x5adf('0x19')]=function(){var _0x1b2cf3=os[_0x5adf('0x1a')]();var _0x496dde=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x496dde[_0x5adf('0x1b')](config[_0x5adf('0x1c')])){return config[_0x5adf('0x1c')];}else if(_0x1b2cf3===_0x5adf('0x1d')){return exec(_0x5adf('0x1e'),{'encoding':_0x5adf('0x1f')})['replace']('\x0d\x0a','');}else{var _0x48d228=getFirstInterface();var _0x16772e=getCPUhash();var _0x2376f3=_0x16772e+'|'+os[_0x5adf('0x20')]()+'|'+_0x48d228['macAddress']+'|'+_0x48d228[_0x5adf('0x21')];var _0x545d41=crypto[_0x5adf('0x15')]('md5')[_0x5adf('0x17')](_0x2376f3)['digest'](_0x5adf('0x18'));return _0x545d41[_0x5adf('0x22')](0x0,0x8)+'-'+_0x545d41[_0x5adf('0x22')](0x8,0xc)+'-'+_0x545d41['substring'](0xc,0x10)+'-'+_0x545d41['substring'](0x10,0x14)+'-'+_0x545d41['substring'](0x14);}}; \ No newline at end of file +var _0x073e=['md5','digest','hex','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','createHash'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x073e,0x71));var _0xe073=function(_0x845a40,_0x466cd6){_0x845a40=_0x845a40-0x0;var _0x535e25=_0x073e[_0x845a40];return _0x535e25;};'use strict';var _=require(_0xe073('0x0'));var os=require('os');var crypto=require(_0xe073('0x1'));var machine=require(_0xe073('0x2'));var exec=require('child_process')[_0xe073('0x3')];var config=require(_0xe073('0x4'));function getInterfaces(){var _0x41d8a5=[];var _0x2d6fd6=os[_0xe073('0x5')]();var _0x149386=_[_0xe073('0x6')](_[_0xe073('0x7')](_0x2d6fd6));for(var _0x171b0c=0x0;_0x171b0c<_0x149386[_0xe073('0x8')];_0x171b0c++){var _0xb8ced4=_0x2d6fd6[_0x149386[_0x171b0c]][_0xe073('0x9')](function(_0x79eda0){return _0x79eda0[_0xe073('0xa')]===_0xe073('0xb')&&_0x79eda0[_0xe073('0xc')]===![];});_0x41d8a5=_0x41d8a5[_0xe073('0xd')](_0xb8ced4);}return _0x41d8a5;}function getFirstInterface(){var _0x244691=_[_0xe073('0xe')](getInterfaces());return{'macAddress':_0x244691&&_0x244691[_0xe073('0xf')]?_0x244691[_0xe073('0xf')]:_0xe073('0x10'),'ipAddress':_0x244691&&_0x244691[_0xe073('0x11')]?_0x244691[_0xe073('0x11')]:_0xe073('0x12')};}exports[_0xe073('0x13')]=getFirstInterface;function getCPUhash(){var _0x512008=_[_0xe073('0x6')](os['cpus']()[_0xe073('0x14')](function(_0xc1d4d){return _0xc1d4d[_0xe073('0x15')];}))['join'](':');return crypto[_0xe073('0x16')](_0xe073('0x17'))['update'](_0x512008)[_0xe073('0x18')](_0xe073('0x19'));}exports['getUuid']=function(){var _0x273ad6=os[_0xe073('0x1a')]();var _0x3f647a=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3f647a[_0xe073('0x1b')](config['licenseToken'])){return config[_0xe073('0x1c')];}else if(_0x273ad6==='win32'){return exec(_0xe073('0x1d'),{'encoding':_0xe073('0x1e')})['replace']('\x0d\x0a','');}else{var _0x5d5c66=getFirstInterface();var _0x134ec8=getCPUhash();var _0x4b27b5=_0x134ec8+'|'+os['hostname']()+'|'+_0x5d5c66[_0xe073('0x1f')]+'|'+_0x5d5c66[_0xe073('0x20')];var _0x248625=crypto[_0xe073('0x16')]('md5')['update'](_0x4b27b5)[_0xe073('0x18')](_0xe073('0x19'));return _0x248625[_0xe073('0x21')](0x0,0x8)+'-'+_0x248625[_0xe073('0x21')](0x8,0xc)+'-'+_0x248625[_0xe073('0x21')](0xc,0x10)+'-'+_0x248625[_0xe073('0x21')](0x10,0x14)+'-'+_0x248625['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f213024..8ab7a02 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 _0x73e9=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','message','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0xcbf2a3,_0x167876){var _0x4f4272=function(_0x4ce2b2){while(--_0x4ce2b2){_0xcbf2a3['push'](_0xcbf2a3['shift']());}};_0x4f4272(++_0x167876);}(_0x73e9,0xfd));var _0x973e=function(_0x5a4257,_0x3ae34d){_0x5a4257=_0x5a4257-0x0;var _0x3746a7=_0x73e9[_0x5a4257];return _0x3746a7;};'use strict';var util=require(_0x973e('0x0'));var moment=require('moment');var rp=require(_0x973e('0x1'));var BPromise=require(_0x973e('0x2'));var pkginfo=require(_0x973e('0x3'))(module,_0x973e('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x973e('0x5'));var hardware=require('./hardware');var logger=require(_0x973e('0x6'))('license');var HOST=_0x973e('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x6a6b1d){return new BPromise(function(_0x5c5cfa,_0xdb08c1){var _0x590c2c=util[_0x973e('0x8')](_0x973e('0x9'),HOST,_0x6a6b1d,module[_0x973e('0xa')][_0x973e('0x4')]);if(oldToken){_0x590c2c=util[_0x973e('0x8')](_0x973e('0xb'),HOST,_0x6a6b1d,module['exports'][_0x973e('0x4')],oldToken);}var _0x2ddd7f={'uri':_0x590c2c,'method':_0x973e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x2ddd7f)['then'](function(_0x385050){_0x5c5cfa(_0x385050);})[_0x973e('0xd')](function(_0x5ed504){_0xdb08c1(_0x5ed504);});});}function manageLicense(_0x512ca6,_0x35b43e){var _0x802328=_0x35b43e[_0x973e('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x802328[_0x973e('0xf')]!==_0x512ca6&&!_0x802328[_0x973e('0x10')]){oldToken=_0x802328[_0x973e('0xf')];}httpRequest(_0x512ca6)[_0x973e('0x11')](function(_0xfddea5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xfddea5[_0x973e('0x12')]){isOldTokenSent=![];if(!_0x802328[_0x973e('0x13')]&&_0x802328[_0x973e('0x13')]!=_0xfddea5[_0x973e('0x13')]||_0x802328[_0x973e('0x13')]&&_0x802328['data2']){logger[_0x973e('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x802328[_0x973e('0x13')]&&!_0x802328['data2']&&_0x802328['license']!=_0xfddea5[_0x973e('0x13')]){logger['info'](_0x973e('0x15'));}if(_0x802328[_0x973e('0x13')]&&!_0x802328['data2']&&_0x802328[_0x973e('0x13')]==_0xfddea5[_0x973e('0x13')]){return _0x35b43e;}return _0x35b43e[_0x973e('0x16')]({'data1':_0x512ca6,'data2':null,'license':_0xfddea5[_0x973e('0x13')]});}else{if(_0xfddea5['license']||_0x802328[_0x973e('0x13')]){if(!_0x802328['data2']){if(_0x802328[_0x973e('0xf')]==_0x512ca6){GRAY_PERIOD_REASON=_0x973e('0x17');logger[_0x973e('0x14')](_0x973e('0x18'));}else{GRAY_PERIOD_REASON=_0x973e('0x19');logger[_0x973e('0x14')](_0x973e('0x1a'),_0x802328[_0x973e('0xf')],_0x512ca6);}logger[_0x973e('0x14')](_0x973e('0x1b'),GRAY_PERIOD_REASON[_0x973e('0x1c')](),moment()['format'](_0x973e('0x1d')));return _0x35b43e[_0x973e('0x16')]({'data2':encryptor[_0x973e('0x1e')](moment()[_0x973e('0x8')](_0x973e('0x1d')))});}else{if(moment()[_0x973e('0x1f')](encryptor[_0x973e('0x20')](_0x802328[_0x973e('0x10')]),_0x973e('0x21'))>DAYS){logger[_0x973e('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x973e('0x8')](_0x973e('0x1d')));isOldTokenSent=![];return _0x35b43e[_0x973e('0x16')]({'data1':_0x512ca6,'data2':null,'license':null});}}}else{if(_0x802328['data1']!=_0x512ca6){logger['info'](_0x973e('0x1a'),_0x802328[_0x973e('0xf')],_0x512ca6);return _0x35b43e[_0x973e('0x16')]({'data1':_0x512ca6,'data2':null,'license':null});}}}return _0x35b43e;})[_0x973e('0x11')](function(_0x16e94b){_0x35b43e=_0x16e94b;})[_0x973e('0xd')](function(_0x34cf8c){logger[_0x973e('0x22')](_0x34cf8c[_0x973e('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x973e('0x24')](),_0x35b43e);},TIME);});}function defaultLicense(){var _0x1d0c28=hardware['getUuid']();if(_0x1d0c28){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1d0c28}})[_0x973e('0x25')](function(_0x59b915,_0x51b7b0){logger[_0x973e('0x14')](_0x973e('0x26'),_0x1d0c28);manageLicense(_0x1d0c28,_0x59b915);})[_0x973e('0xd')](function(_0x5c9df5){logger['error'](_0x5c9df5[_0x973e('0x23')]);});}}exports[_0x973e('0x27')]=defaultLicense; \ No newline at end of file +var _0xe90d=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','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','decryptString','days','DEMO\x20START\x20AT\x20%s','update','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data2','data1','then','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe90d,0x159));var _0xde90=function(_0x4482bd,_0x220b45){_0x4482bd=_0x4482bd-0x0;var _0x4e266f=_0xe90d[_0x4482bd];return _0x4e266f;};'use strict';var util=require(_0xde90('0x0'));var moment=require(_0xde90('0x1'));var rp=require(_0xde90('0x2'));var BPromise=require(_0xde90('0x3'));var pkginfo=require(_0xde90('0x4'))(module,_0xde90('0x5'));var db=require(_0xde90('0x6'))['db'];var encryptor=require(_0xde90('0x7'));var hardware=require(_0xde90('0x8'));var logger=require(_0xde90('0x9'))(_0xde90('0xa'));var HOST=_0xde90('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x13e4b6){return new BPromise(function(_0x5dcd3e,_0x32cb76){var _0x435407=util[_0xde90('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x13e4b6,module[_0xde90('0xd')][_0xde90('0x5')]);if(oldToken){_0x435407=util[_0xde90('0xc')](_0xde90('0xe'),HOST,_0x13e4b6,module[_0xde90('0xd')]['version'],oldToken);}var _0x756347={'uri':_0x435407,'method':_0xde90('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x756347)['then'](function(_0x15086c){_0x5dcd3e(_0x15086c);})[_0xde90('0x10')](function(_0x49af01){_0x32cb76(_0x49af01);});});}function manageLicense(_0xe0f646,_0xb14ea8){var _0x8d6d38=_0xb14ea8[_0xde90('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x8d6d38['data1']!==_0xe0f646&&!_0x8d6d38[_0xde90('0x12')]){oldToken=_0x8d6d38[_0xde90('0x13')];}httpRequest(_0xe0f646)[_0xde90('0x14')](function(_0x2c68b7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2c68b7[_0xde90('0x15')]){isOldTokenSent=![];if(!_0x8d6d38[_0xde90('0xa')]&&_0x8d6d38[_0xde90('0xa')]!=_0x2c68b7[_0xde90('0xa')]||_0x8d6d38[_0xde90('0xa')]&&_0x8d6d38['data2']){logger['info'](_0xde90('0x16'));}if(_0x8d6d38[_0xde90('0xa')]&&!_0x8d6d38[_0xde90('0x12')]&&_0x8d6d38['license']!=_0x2c68b7[_0xde90('0xa')]){logger[_0xde90('0x17')](_0xde90('0x18'));}if(_0x8d6d38[_0xde90('0xa')]&&!_0x8d6d38[_0xde90('0x12')]&&_0x8d6d38[_0xde90('0xa')]==_0x2c68b7[_0xde90('0xa')]){return _0xb14ea8;}return _0xb14ea8['update']({'data1':_0xe0f646,'data2':null,'license':_0x2c68b7[_0xde90('0xa')]});}else{if(_0x2c68b7[_0xde90('0xa')]||_0x8d6d38[_0xde90('0xa')]){if(!_0x8d6d38[_0xde90('0x12')]){if(_0x8d6d38[_0xde90('0x13')]==_0xe0f646){GRAY_PERIOD_REASON='Disabled';logger[_0xde90('0x17')](_0xde90('0x19'));}else{GRAY_PERIOD_REASON=_0xde90('0x1a');logger[_0xde90('0x17')](_0xde90('0x1b'),_0x8d6d38[_0xde90('0x13')],_0xe0f646);}logger[_0xde90('0x17')](_0xde90('0x1c'),GRAY_PERIOD_REASON[_0xde90('0x1d')](),moment()[_0xde90('0xc')](_0xde90('0x1e')));return _0xb14ea8['update']({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xde90('0x1f')](_0x8d6d38['data2']),_0xde90('0x20'))>DAYS){logger[_0xde90('0x17')](_0xde90('0x21'),moment()[_0xde90('0xc')](_0xde90('0x1e')));isOldTokenSent=![];return _0xb14ea8[_0xde90('0x22')]({'data1':_0xe0f646,'data2':null,'license':null});}}}else{if(_0x8d6d38['data1']!=_0xe0f646){logger[_0xde90('0x17')](_0xde90('0x1b'),_0x8d6d38[_0xde90('0x13')],_0xe0f646);return _0xb14ea8[_0xde90('0x22')]({'data1':_0xe0f646,'data2':null,'license':null});}}}return _0xb14ea8;})[_0xde90('0x14')](function(_0x5c4540){_0xb14ea8=_0x5c4540;})['catch'](function(_0x5673fc){logger['error'](_0x5673fc[_0xde90('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xde90('0x24')](),_0xb14ea8);},TIME);});}function defaultLicense(){var _0x21e784=hardware[_0xde90('0x24')]();if(_0x21e784){return db['License'][_0xde90('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x21e784}})[_0xde90('0x26')](function(_0x5a06df,_0x14a56b){logger['info'](_0xde90('0x27'),_0x21e784);manageLicense(_0x21e784,_0x5a06df);})[_0xde90('0x10')](function(_0x1e2cc0){logger[_0xde90('0x28')](_0x1e2cc0[_0xde90('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 569dc19..be735d7 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 _0xfec5=['uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','demo','machineUuid','gray','deadline','add','grayReason','changed','message','User','findAll','role','COUNT','sequelize','count','telephone','users','telephones','forEach','user','pick','countBy','admin','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','./hardware','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch'];(function(_0x5c64b9,_0x136a7c){var _0x1b405e=function(_0x3baa56){while(--_0x3baa56){_0x5c64b9['push'](_0x5c64b9['shift']());}};_0x1b405e(++_0x136a7c);}(_0xfec5,0xd5));var _0x5fec=function(_0x7e51fc,_0x34fd1a){_0x7e51fc=_0x7e51fc-0x0;var _0x5bbdac=_0xfec5[_0x7e51fc];return _0x5bbdac;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x5fec('0x0'));var BPromise=require(_0x5fec('0x1'));var hardware=require(_0x5fec('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x5fec('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x5fec('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5fec('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5fec('0x6'),'machineUuid':hardware[_0x5fec('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2574e0){return new BPromise(function(_0x29b4fe,_0x3574e9){return db[_0x5fec('0x7')][_0x5fec('0x8')](_[_0x5fec('0x9')](_0x2574e0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5123e6){return checkLicense(_0x5123e6,null);})[_0x5fec('0xa')](function(_0x5ab83c){_0x29b4fe(_0x5ab83c);return;})[_0x5fec('0xb')](function(_0x5cadc0){_0x3574e9(_0x5cadc0);});});}function checkLicense(_0x2fbfd8,_0x1fbb84){if(!_0x2fbfd8){demoLicense[_0x5fec('0xc')]=_0x2fbfd8['data1'];return demoLicense;}try{var _0xa5ea75=_0x1fbb84||_0x2fbfd8[_0x5fec('0xd')];if(_[_0x5fec('0xe')](_0xa5ea75)){throw new Error(_0x5fec('0xf'));}var _0x18ed73=_0x2fbfd8[_0x5fec('0x10')];var _0x34e39a=_0x2fbfd8[_0x5fec('0x11')];var _0x448c09=_0x18ed73[_0x5fec('0x12')]('-')[0x4];var _0x218def=_0x18ed73[_0x5fec('0x12')]('-')[0x0];var _0xafab6f=encryptor[_0x5fec('0x13')](_0xa5ea75,util[_0x5fec('0x14')]('%s:%s:%s',_0x448c09,_0x18ed73,_0x218def));var _0x2ef078=JSON['parse'](_0xafab6f);_0x2ef078[_0x5fec('0x15')]=![];_0x2ef078['uuid']=_0x18ed73;_0x2ef078[_0x5fec('0x16')]=hardware[_0x5fec('0x4')]();if(_0x34e39a){var _0x18436a=encryptor[_0x5fec('0x13')](_0x34e39a);_0x2ef078[_0x5fec('0x17')]=_0x18436a;_0x2ef078[_0x5fec('0x18')]=moment(_0x18436a)[_0x5fec('0x19')](0x7,'days')['format']();_0x2ef078[_0x5fec('0x1a')]=_0x2ef078[_0x5fec('0xc')]!=_0x2ef078[_0x5fec('0x16')]?_0x5fec('0x1b'):'disabled';}return _0x2ef078;}catch(_0x4ea5c8){breakingLicense[_0x5fec('0xc')]=_0x2fbfd8[_0x5fec('0x10')];breakingLicense['message']=_0x4ea5c8[_0x5fec('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3b8100,_0x15b7c1){getLicense()[_0x5fec('0xa')](function(_0x113cdb){return db[_0x5fec('0x1d')][_0x5fec('0x1e')]({'attributes':[_0x5fec('0x1f'),[db['sequelize']['fn'](_0x5fec('0x20'),db[_0x5fec('0x21')]['col']('role')),_0x5fec('0x22')]],'group':_0x5fec('0x1f'),'where':{'role':{'$or':['admin','user',_0x5fec('0x23')]}},'raw':!![]})[_0x5fec('0xa')](function(_0x17b27b){var _0x5d7341={'user':_0x113cdb[_0x5fec('0x24')]||0x0,'telephone':_0x113cdb[_0x5fec('0x25')]||0x0};_0x17b27b[_0x5fec('0x26')](function(_0x414e9b){var _0x17acf7=_0x414e9b[_0x5fec('0x1f')]==='admin'?_0x5fec('0x27'):_0x414e9b[_0x5fec('0x1f')];_0x5d7341[_0x17acf7]-=_0x414e9b['count'];if(_0x5d7341[_0x17acf7]<0x0)_0x5d7341[_0x17acf7]=0x0;});_0x3b8100(_0x5d7341);return;});})[_0x5fec('0xb')](function(_0x38b4cb){_0x15b7c1(_0x38b4cb);});});}function checkUserLimits(_0x5d4fc9){return new BPromise(function(_0x5cabb2,_0x20cde1){getLimits()[_0x5fec('0xa')](function(_0x122ac6){var _0x32f6e2=_[_0x5fec('0x28')](_[_0x5fec('0x29')](_0x5d4fc9,_0x5fec('0x1f')),[_0x5fec('0x2a'),_0x5fec('0x27'),_0x5fec('0x23')]);var _0x133322=(_0x32f6e2[_0x5fec('0x2a')]||0x0)+(_0x32f6e2['user']||0x0);var _0x4a4e18=_0x32f6e2[_0x5fec('0x23')]||0x0;if(_0x133322>_0x122ac6[_0x5fec('0x27')])return _0x20cde1('License\x20limit\x20reached\x20for\x20users');if(_0x4a4e18>_0x122ac6[_0x5fec('0x23')])return _0x20cde1(_0x5fec('0x2b'));return _0x5cabb2();})[_0x5fec('0xb')](function(_0x586483){_0x20cde1(_0x586483);});});}module[_0x5fec('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xff1f=['split','format','%s:%s:%s','machineUuid','decryptString','gray','add','days','grayReason','disabled','message','role','COUNT','sequelize','col','count','telephone','telephones','forEach','user','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','getUuid','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x12fb2c,_0xad4eb9){var _0x1431cf=function(_0x387d5d){while(--_0x387d5d){_0x12fb2c['push'](_0x12fb2c['shift']());}};_0x1431cf(++_0xad4eb9);}(_0xff1f,0x64));var _0xfff1=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xff1f[_0xcfeff4];return _0xb2fadc;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfff1('0x0'));var BPromise=require(_0xfff1('0x1'));var hardware=require(_0xfff1('0x2'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfff1('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xfff1('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfff1('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xfff1('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x575193){return new BPromise(function(_0x105070,_0x259c24){return db['License'][_0xfff1('0x5')](_[_0xfff1('0x6')](_0x575193,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xdfbfe2){return checkLicense(_0xdfbfe2,null);})[_0xfff1('0x7')](function(_0x41385e){_0x105070(_0x41385e);return;})[_0xfff1('0x8')](function(_0x525b35){_0x259c24(_0x525b35);});});}function checkLicense(_0x14bde8,_0x1b868e){if(!_0x14bde8){demoLicense[_0xfff1('0x9')]=_0x14bde8[_0xfff1('0xa')];return demoLicense;}try{var _0x5db775=_0x1b868e||_0x14bde8['license'];if(_[_0xfff1('0xb')](_0x5db775)){throw new Error(_0xfff1('0xc'));}var _0x379a98=_0x14bde8[_0xfff1('0xa')];var _0x5b2f82=_0x14bde8[_0xfff1('0xd')];var _0x4b9486=_0x379a98[_0xfff1('0xe')]('-')[0x4];var _0x111aa9=_0x379a98['split']('-')[0x0];var _0x6c1114=encryptor['decryptString'](_0x5db775,util[_0xfff1('0xf')](_0xfff1('0x10'),_0x4b9486,_0x379a98,_0x111aa9));var _0x27f6e3=JSON['parse'](_0x6c1114);_0x27f6e3['demo']=![];_0x27f6e3['uuid']=_0x379a98;_0x27f6e3[_0xfff1('0x11')]=hardware['getUuid']();if(_0x5b2f82){var _0x3eba82=encryptor[_0xfff1('0x12')](_0x5b2f82);_0x27f6e3[_0xfff1('0x13')]=_0x3eba82;_0x27f6e3['deadline']=moment(_0x3eba82)[_0xfff1('0x14')](0x7,_0xfff1('0x15'))[_0xfff1('0xf')]();_0x27f6e3[_0xfff1('0x16')]=_0x27f6e3[_0xfff1('0x9')]!=_0x27f6e3[_0xfff1('0x11')]?'changed':_0xfff1('0x17');}return _0x27f6e3;}catch(_0x3f4b63){breakingLicense[_0xfff1('0x9')]=_0x14bde8[_0xfff1('0xa')];breakingLicense['message']=_0x3f4b63[_0xfff1('0x18')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x777ab,_0x17bad4){getLicense()['then'](function(_0x50dc40){return db['User']['findAll']({'attributes':[_0xfff1('0x19'),[db['sequelize']['fn'](_0xfff1('0x1a'),db[_0xfff1('0x1b')][_0xfff1('0x1c')](_0xfff1('0x19'))),_0xfff1('0x1d')]],'group':_0xfff1('0x19'),'where':{'role':{'$or':['admin','user',_0xfff1('0x1e')]}},'raw':!![]})[_0xfff1('0x7')](function(_0x485fed){var _0xf01d8={'user':_0x50dc40['users']||0x0,'telephone':_0x50dc40[_0xfff1('0x1f')]||0x0};_0x485fed[_0xfff1('0x20')](function(_0x2c775e){var _0x3e74b0=_0x2c775e[_0xfff1('0x19')]==='admin'?_0xfff1('0x21'):_0x2c775e[_0xfff1('0x19')];_0xf01d8[_0x3e74b0]-=_0x2c775e[_0xfff1('0x1d')];if(_0xf01d8[_0x3e74b0]<0x0)_0xf01d8[_0x3e74b0]=0x0;});_0x777ab(_0xf01d8);return;});})[_0xfff1('0x8')](function(_0x27c57e){_0x17bad4(_0x27c57e);});});}function checkUserLimits(_0x4005bf){return new BPromise(function(_0x1f9d19,_0x17a46b){getLimits()[_0xfff1('0x7')](function(_0x28b47e){var _0x10a196=_['pick'](_[_0xfff1('0x22')](_0x4005bf,_0xfff1('0x19')),[_0xfff1('0x23'),_0xfff1('0x21'),'telephone']);var _0x1a7915=(_0x10a196[_0xfff1('0x23')]||0x0)+(_0x10a196['user']||0x0);var _0x5dd124=_0x10a196[_0xfff1('0x1e')]||0x0;if(_0x1a7915>_0x28b47e[_0xfff1('0x21')])return _0x17a46b(_0xfff1('0x24'));if(_0x5dd124>_0x28b47e[_0xfff1('0x1e')])return _0x17a46b(_0xfff1('0x25'));return _0x1f9d19();})[_0xfff1('0x8')](function(_0xbd35de){_0x17a46b(_0xbd35de);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5b06d6f..fe4d16b 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 _0x7708=['http://localhost:9000','app-id','exports'];(function(_0x8c032,_0x4a9362){var _0x3939da=function(_0x1bb3c1){while(--_0x1bb3c1){_0x8c032['push'](_0x8c032['shift']());}};_0x3939da(++_0x4a9362);}(_0x7708,0x188));var _0x8770=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x7708[_0x2aefb6];return _0x202772;};'use strict';module[_0x8770('0x0')]={'DOMAIN':_0x8770('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8770('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0424=['myappanuglar-secret','app-id','secret'];(function(_0x11a995,_0x3783a8){var _0x171998=function(_0x5cf57f){while(--_0x5cf57f){_0x11a995['push'](_0x11a995['shift']());}};_0x171998(++_0x3783a8);}(_0x0424,0x159));var _0x4042=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x0424[_0x145b3c];return _0x1b6e36;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x4042('0x0'),'GOOGLE_ID':_0x4042('0x1'),'GOOGLE_SECRET':_0x4042('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 886984b..b7392bc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32d7=['exports','../utils/loggers'];(function(_0x1fc753,_0x45b16d){var _0x1fb788=function(_0x41b2d5){while(--_0x41b2d5){_0x1fc753['push'](_0x1fc753['shift']());}};_0x1fb788(++_0x45b16d);}(_0x32d7,0xfd));var _0x732d=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x32d7[_0x71b765];return _0x34cb24;};'use strict';var fileLogger=require(_0x732d('0x0'))['fileLogger'];module[_0x732d('0x1')]=fileLogger; \ No newline at end of file +var _0xdd17=['fileLogger'];(function(_0x37bed5,_0x4fcea4){var _0xfd86c3=function(_0x28d4fa){while(--_0x28d4fa){_0x37bed5['push'](_0x37bed5['shift']());}};_0xfd86c3(++_0x4fcea4);}(_0xdd17,0x1a6));var _0x7dd1=function(_0x3e52b9,_0x2f4611){_0x3e52b9=_0x3e52b9-0x0;var _0x50e9fa=_0xdd17[_0x3e52b9];return _0x50e9fa;};'use strict';var fileLogger=require('../utils/loggers')[_0x7dd1('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 2a0eb46..ca2a273 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 _0x2ff7=['root','express','agi','../../services/agi/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join'];(function(_0x12a612,_0x2a147e){var _0x20eea8=function(_0x1745b3){while(--_0x1745b3){_0x12a612['push'](_0x12a612['shift']());}};_0x20eea8(++_0x2a147e);}(_0x2ff7,0x6a));var _0x72ff=function(_0x24b312,_0x3c8336){_0x24b312=_0x24b312-0x0;var _0x3185a2=_0x2ff7[_0x24b312];return _0x3185a2;};'use strict';var path=require(_0x72ff('0x0'));var cfg=require(_0x72ff('0x1'));var env={'NODE_PATH':path[_0x72ff('0x2')](path[_0x72ff('0x3')](cfg[_0x72ff('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x72ff('0x5'),'script':path[_0x72ff('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x72ff('0x6'),'script':path[_0x72ff('0x3')](__dirname,_0x72ff('0x7')),'env':env},{'name':'email','script':path[_0x72ff('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,_0x72ff('0x8')),'env':env},{'name':'xdr','script':path[_0x72ff('0x3')](__dirname,_0x72ff('0x9')),'env':env}]};module[_0x72ff('0xa')]=pm2config; \ No newline at end of file +var _0x4b00=['path','../../config/environment','root','legacy-libs','join','ami','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x4b00,0xa8));var _0x04b0=function(_0x1dfd46,_0x52efef){_0x1dfd46=_0x1dfd46-0x0;var _0x1702da=_0x4b00[_0x1dfd46];return _0x1702da;};'use strict';var path=require(_0x04b0('0x0'));var cfg=require(_0x04b0('0x1'));var env={'NODE_PATH':path['resolve'](path['join'](cfg[_0x04b0('0x2')],_0x04b0('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x04b0('0x4')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x04b0('0x5'),'script':path[_0x04b0('0x4')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x04b0('0x6'),'script':path[_0x04b0('0x4')](__dirname,_0x04b0('0x7')),'env':env},{'name':_0x04b0('0x8'),'script':path[_0x04b0('0x4')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x04b0('0x9'),'script':path[_0x04b0('0x4')](__dirname,_0x04b0('0xa')),'env':env},{'name':_0x04b0('0xb'),'script':path[_0x04b0('0x4')](__dirname,_0x04b0('0xc')),'env':env}]};module[_0x04b0('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 691329b..2446b95 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 _0x3dce=['then','restart','list','describe','delete','dump','pm2','connect','connected','start','disconnect','stop'];(function(_0x4afcde,_0x47406e){var _0x135787=function(_0x436556){while(--_0x436556){_0x4afcde['push'](_0x4afcde['shift']());}};_0x135787(++_0x47406e);}(_0x3dce,0xa2));var _0xe3dc=function(_0x433130,_0x402006){_0x433130=_0x433130-0x0;var _0xf24027=_0x3dce[_0x433130];return _0xf24027;};'use strict';var pm2=require(_0xe3dc('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x493597,_0x4026e2){return pm2[_0xe3dc('0x1')](function(_0x209234){if(_0x209234){return _0x4026e2(_0x209234);}return _0x493597(_0xe3dc('0x2'));});});};exports[_0xe3dc('0x3')]=function(_0x2f35f1){return connect()['then'](function(){return new BPromise(function(_0x1e4fe4,_0x3aa675){return pm2[_0xe3dc('0x3')](_0x2f35f1,function(_0x42fb95,_0x2b8c98){if(_0x42fb95){return _0x3aa675(_0x42fb95);}pm2[_0xe3dc('0x4')]();return _0x1e4fe4(_0x2b8c98);});});});};exports[_0xe3dc('0x5')]=function(_0x1c795d){return connect()[_0xe3dc('0x6')](function(){return new BPromise(function(_0xb8d5e5,_0x129926){return pm2[_0xe3dc('0x5')](_0x1c795d,function(_0x46f285,_0x4f5e64){if(_0x46f285){return _0x129926(_0x46f285);}pm2[_0xe3dc('0x4')]();return _0xb8d5e5(_0x4f5e64);});});});};exports[_0xe3dc('0x7')]=function(_0x2eeba5){return connect()['then'](function(){return new BPromise(function(_0x42a6ab,_0x518d71){return pm2[_0xe3dc('0x7')](_0x2eeba5,function(_0x512881,_0x3bf186){if(_0x512881){return _0x518d71(_0x512881);}pm2['disconnect']();return _0x42a6ab(_0x3bf186);});});});};exports[_0xe3dc('0x8')]=function(){return connect()[_0xe3dc('0x6')](function(){return new BPromise(function(_0xf3c205,_0x1d551c){return pm2[_0xe3dc('0x8')](function(_0x4d251b,_0x13763d){if(_0x4d251b){return _0x1d551c(_0x4d251b);}pm2[_0xe3dc('0x4')]();return _0xf3c205(_0x13763d);});});});};exports[_0xe3dc('0x9')]=function(_0xc0e509){return connect()[_0xe3dc('0x6')](function(){return new BPromise(function(_0x4d7e05,_0x4ef784){return pm2[_0xe3dc('0x9')](_0xc0e509,function(_0x4bbf1b,_0x47b47a){if(_0x4bbf1b){return _0x4ef784(_0x4bbf1b);}pm2[_0xe3dc('0x4')]();return _0x4d7e05(_0x47b47a);});});});};exports[_0xe3dc('0xa')]=function(_0x3033a3){return connect()[_0xe3dc('0x6')](function(){return new BPromise(function(_0x6702f7,_0x4dda6b){return pm2[_0xe3dc('0xa')](_0x3033a3,function(_0x2262ca,_0x1d1c30){if(_0x2262ca){return _0x4dda6b(_0x2262ca);}pm2[_0xe3dc('0x4')]();return _0x6702f7(_0x1d1c30);});});});};exports['dump']=function(){return connect()[_0xe3dc('0x6')](function(){return new BPromise(function(_0x441c14,_0x4b2185){return pm2[_0xe3dc('0xb')](function(_0x596f83){if(_0x596f83){return _0x4b2185(_0x596f83);}return _0x441c14('saved');});});});}; \ No newline at end of file +var _0x8869=['restart','list','describe','delete','dump','pm2','bluebird','./config','connect','start','then','disconnect','stop'];(function(_0xec4642,_0x2b3bb6){var _0x23768a=function(_0x47b687){while(--_0x47b687){_0xec4642['push'](_0xec4642['shift']());}};_0x23768a(++_0x2b3bb6);}(_0x8869,0x157));var _0x9886=function(_0x2f488b,_0x4b3563){_0x2f488b=_0x2f488b-0x0;var _0x17346f=_0x8869[_0x2f488b];return _0x17346f;};'use strict';var pm2=require(_0x9886('0x0'));var BPromise=require(_0x9886('0x1'));var config=require(_0x9886('0x2'));function connect(){return new BPromise(function(_0x2dd87a,_0x5e2393){return pm2[_0x9886('0x3')](function(_0x245fe3){if(_0x245fe3){return _0x5e2393(_0x245fe3);}return _0x2dd87a('connected');});});};exports[_0x9886('0x4')]=function(_0x1cb15f){return connect()[_0x9886('0x5')](function(){return new BPromise(function(_0x59a7a5,_0x3188a1){return pm2[_0x9886('0x4')](_0x1cb15f,function(_0x13e78c,_0x26d679){if(_0x13e78c){return _0x3188a1(_0x13e78c);}pm2[_0x9886('0x6')]();return _0x59a7a5(_0x26d679);});});});};exports[_0x9886('0x7')]=function(_0x37484c){return connect()['then'](function(){return new BPromise(function(_0x3aa87f,_0x3cd9d7){return pm2['stop'](_0x37484c,function(_0x197900,_0xeac5bf){if(_0x197900){return _0x3cd9d7(_0x197900);}pm2[_0x9886('0x6')]();return _0x3aa87f(_0xeac5bf);});});});};exports[_0x9886('0x8')]=function(_0xa8d2ce){return connect()['then'](function(){return new BPromise(function(_0x50cf29,_0x749fcf){return pm2[_0x9886('0x8')](_0xa8d2ce,function(_0x18b2de,_0x2a5a1b){if(_0x18b2de){return _0x749fcf(_0x18b2de);}pm2[_0x9886('0x6')]();return _0x50cf29(_0x2a5a1b);});});});};exports[_0x9886('0x9')]=function(){return connect()[_0x9886('0x5')](function(){return new BPromise(function(_0x3437d5,_0x3be5b1){return pm2['list'](function(_0x2b1a51,_0x54a477){if(_0x2b1a51){return _0x3be5b1(_0x2b1a51);}pm2['disconnect']();return _0x3437d5(_0x54a477);});});});};exports[_0x9886('0xa')]=function(_0x36bbc6){return connect()[_0x9886('0x5')](function(){return new BPromise(function(_0x242083,_0x23ab33){return pm2[_0x9886('0xa')](_0x36bbc6,function(_0xca6410,_0x4378de){if(_0xca6410){return _0x23ab33(_0xca6410);}pm2[_0x9886('0x6')]();return _0x242083(_0x4378de);});});});};exports[_0x9886('0xb')]=function(_0x5777d0){return connect()[_0x9886('0x5')](function(){return new BPromise(function(_0x292e37,_0x3df841){return pm2[_0x9886('0xb')](_0x5777d0,function(_0x37dc57,_0x16aa84){if(_0x37dc57){return _0x3df841(_0x37dc57);}pm2[_0x9886('0x6')]();return _0x292e37(_0x16aa84);});});});};exports[_0x9886('0xc')]=function(){return connect()[_0x9886('0x5')](function(){return new BPromise(function(_0x5a58c2,_0x561e4e){return pm2[_0x9886('0xc')](function(_0x24f9ed){if(_0x24f9ed){return _0x561e4e(_0x24f9ed);}return _0x5a58c2('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4f5cc58..a99eb7b 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 _0x35bb=['../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb'];(function(_0x257a77,_0x5ba0e0){var _0x302c6d=function(_0x467a0c){while(--_0x467a0c){_0x257a77['push'](_0x257a77['shift']());}};_0x302c6d(++_0x5ba0e0);}(_0x35bb,0x114));var _0xb35b=function(_0x5bd9dc,_0x5d4d7f){_0x5bd9dc=_0x5bd9dc-0x0;var _0x384e3f=_0x35bb[_0x5bd9dc];return _0x384e3f;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xb35b('0x0'));var util=require(_0xb35b('0x1'));var config=require(_0xb35b('0x2'));var db=require(_0xb35b('0x3'))['db'];var logger=require(_0xb35b('0x4'))(_0xb35b('0x5'));config['redis']=_[_0xb35b('0x6')](config[_0xb35b('0x7')],{'host':_0xb35b('0x8'),'port':0x18eb});var io=require(_0xb35b('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x2dd917=0x0;var _0x4051eb=[];return db[_0xb35b('0xa')][_0xb35b('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb35b('0xc')](function(_0xbc9d13){_0x2dd917=_0xbc9d13[_0xb35b('0xd')];if(_0x2dd917){return db[_0xb35b('0xe')][_0xb35b('0xf')]({'raw':!![],'attributes':['id',_0xb35b('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb35b('0x11')](_0xbc9d13[_0xb35b('0xd')],_0xb35b('0x12'))}}});}else{return[];}})[_0xb35b('0xc')](function(_0xff5f7){if(_0xff5f7&&_0xff5f7['length']){_0x4051eb=_[_0xb35b('0x13')](_0xff5f7||[],'id');logger[_0xb35b('0x14')](_0xb35b('0x15'),_0x4051eb[_0xb35b('0x16')]());return db[_0xb35b('0xe')][_0xb35b('0x17')]({'closeReason':'system','disposition':_0xb35b('0x18'),'closed':!![],'closedAt':moment()[_0xb35b('0x19')](_0xb35b('0x1a'))},{'where':{'id':_0x4051eb}});}})['then'](function(){if(_0x4051eb&&_0x4051eb[_0xb35b('0x1b')]){logger['info'](_0xb35b('0x1c'),_0x4051eb[_0xb35b('0x16')]());for(var _0x41ed36=0x0;_0x41ed36<_0x4051eb['length'];_0x41ed36++){io[_0xb35b('0x1d')](_0xb35b('0x1e'),{'id':_0x4051eb[_0x41ed36],'closed':!![]});}}})['catch'](function(_0x2ebb7d){logger[_0xb35b('0x1f')](_0xb35b('0x20'),_0x2ebb7d?util[_0xb35b('0x21')](_0x2ebb7d,{'showHidden':![],'depth':null}):'');});}exports[_0xb35b('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3d43=['minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','lastMsgAt','subtract'];(function(_0x1657c0,_0x2e07e5){var _0x40912a=function(_0x31a217){while(--_0x31a217){_0x1657c0['push'](_0x1657c0['shift']());}};_0x40912a(++_0x2e07e5);}(_0x3d43,0x1e1));var _0x33d4=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x3d43[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0x33d4('0x0'));var moment=require(_0x33d4('0x1'));var Redis=require(_0x33d4('0x2'));var util=require('util');var config=require(_0x33d4('0x3'));var db=require(_0x33d4('0x4'))['db'];var logger=require('../logger')(_0x33d4('0x5'));config[_0x33d4('0x6')]=_[_0x33d4('0x7')](config[_0x33d4('0x6')],{'host':_0x33d4('0x8'),'port':0x18eb});var io=require(_0x33d4('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x363c1c=0x0;var _0x52b015=[];return db[_0x33d4('0xa')]['find']({'raw':!![],'attributes':['id',_0x33d4('0xb')],'where':{'id':0x1}})[_0x33d4('0xc')](function(_0x2dcaa9){_0x363c1c=_0x2dcaa9[_0x33d4('0xb')];if(_0x363c1c){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x33d4('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x33d4('0xe')](_0x2dcaa9[_0x33d4('0xb')],_0x33d4('0xf'))}}});}else{return[];}})[_0x33d4('0xc')](function(_0x348301){if(_0x348301&&_0x348301[_0x33d4('0x10')]){_0x52b015=_['map'](_0x348301||[],'id');logger['info'](_0x33d4('0x11'),_0x52b015[_0x33d4('0x12')]());return db[_0x33d4('0x13')]['update']({'closeReason':_0x33d4('0x14'),'disposition':_0x33d4('0x15'),'closed':!![],'closedAt':moment()[_0x33d4('0x16')](_0x33d4('0x17'))},{'where':{'id':_0x52b015}});}})['then'](function(){if(_0x52b015&&_0x52b015[_0x33d4('0x10')]){logger['info'](_0x33d4('0x18'),_0x52b015['join']());for(var _0xa2ad7e=0x0;_0xa2ad7e<_0x52b015['length'];_0xa2ad7e++){io[_0x33d4('0x19')](_0x33d4('0x1a'),{'id':_0x52b015[_0xa2ad7e],'closed':!![]});}}})[_0x33d4('0x1b')](function(_0x19a3fd){logger[_0x33d4('0x1c')](_0x33d4('0x1d'),_0x19a3fd?util['inspect'](_0x19a3fd,{'showHidden':![],'depth':null}):'');});}exports[_0x33d4('0x1e')]=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 6aff068..ae851d2 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 _0x3039=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1e603c,_0x16f855){var _0x2fe121=function(_0x500fd0){while(--_0x500fd0){_0x1e603c['push'](_0x1e603c['shift']());}};_0x2fe121(++_0x16f855);}(_0x3039,0x197));var _0x9303=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3039[_0x2641f9];return _0x585741;};'use strict';function start(){var _0x3f1a1b=require(_0x9303('0x0'));return _0x3f1a1b[_0x9303('0x1')]();}module[_0x9303('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x9229=['exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9229,0xc5));var _0x9922=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x9229[_0x494d1f];return _0x457b6e;};'use strict';function start(){var _0x1e035f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1e035f['startAllRefreshIntervals']();}module[_0x9922('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 3ea7796..60da9fe 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 _0xa07a=['path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','\x22%s\x22\x20<%s>','name','email','MailAccount','Smtp','user','format','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','error','no\x20report\x20id','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop\x20cron','update\x20cron','run','util'];(function(_0x1ceb32,_0x53e397){var _0x27c407=function(_0x49d29e){while(--_0x49d29e){_0x1ceb32['push'](_0x1ceb32['shift']());}};_0x27c407(++_0x53e397);}(_0xa07a,0xfb));var _0xaa07=function(_0x402dc5,_0x12c36f){_0x402dc5=_0x402dc5-0x0;var _0x4193a1=_0xa07a[_0x402dc5];return _0x4193a1;};'use strict';var fs=require('fs');var util=require(_0xaa07('0x0'));var path=require(_0xaa07('0x1'));var _=require(_0xaa07('0x2'));var moment=require(_0xaa07('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaa07('0x4'));var BPromise=require(_0xaa07('0x5'));var logger=require(_0xaa07('0x6'))(_0xaa07('0x7'));var db=require(_0xaa07('0x8'))['db'];var analyticCustomReportController=require(_0xaa07('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xaa07('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b2e8c,_0x2c750e){return function(){logger[_0xaa07('0xb')](_0xaa07('0xc'),_0x4b2e8c['email']);var _0x329a4f=!![];var _0xf586fb=_0x4b2e8c['MailAccount']['getSmtpOptions']();var _0x66316b={'account':_0xf586fb,'message':{'from':util['format'](_0xaa07('0xd'),_0x4b2e8c['MailAccount'][_0xaa07('0xe')],_0x4b2e8c['MailAccount'][_0xaa07('0xf')]||_0x4b2e8c[_0xaa07('0x10')][_0xaa07('0x11')][_0xaa07('0x12')]),'to':_0x4b2e8c[_0xaa07('0xf')],'cc':_0x4b2e8c['cc'],'bcc':_0x4b2e8c['bcc'],'subject':util[_0xaa07('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x2c750e[_0xaa07('0xe')],_0x4b2e8c[_0xaa07('0x14')],_0x4b2e8c[_0xaa07('0x15')])}};var _0x431708=path[_0xaa07('0x16')](__dirname,_0xaa07('0x17'));var _0x7efd36=_0x2c750e[_0xaa07('0x18')];var _0x2b7773=util['format'](_0xaa07('0x19'),path[_0xaa07('0x1a')](_0x2c750e[_0xaa07('0x18')],path[_0xaa07('0x1b')](_0x2c750e[_0xaa07('0x18')])),_0xaa07('0x1c'));var _0x116c8f=path[_0xaa07('0x16')](_0x431708,_0x7efd36);var _0x572954=path[_0xaa07('0x16')](_0x431708,_0x2b7773);if(fs[_0xaa07('0x1d')](_0x116c8f)){_0x2c750e[_0xaa07('0x1e')]=_0xaa07('0x1f');_0x66316b[_0xaa07('0x20')][_0xaa07('0x21')]=[{'filename':_0x7efd36,'path':_0x116c8f}];_0x66316b[_0xaa07('0x20')]['text']=util[_0xaa07('0x13')](_0xaa07('0x22'),JSON[_0xaa07('0x23')](_0x2c750e,null,0x2));}else if(fs[_0xaa07('0x1d')](_0x572954)){_0x2c750e[_0xaa07('0x1e')]='Sent';_0x66316b[_0xaa07('0x20')][_0xaa07('0x21')]=[{'filename':_0x2b7773,'path':_0x572954}];}else{_0x66316b['message'][_0xaa07('0x24')]=_0xaa07('0x25');if(!_0x4b2e8c[_0xaa07('0x26')]){_0x329a4f=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x329a4f){return client[_0xaa07('0x27')](_0xaa07('0x28'),_0x66316b)[_0xaa07('0x29')](function(_0x38c7c2){if(_0x38c7c2['error']){return logger['error'](_0xaa07('0x2a'),JSON['stringify'](_0x38c7c2));}return logger[_0xaa07('0xb')](_0xaa07('0x2b'));})['catch'](function(_0x39fe70){return logger['error'](_0xaa07('0x2a'),JSON['stringify'](_0x39fe70));});}};}function handleError(){return function(_0x770014){return logger['error'](JSON[_0xaa07('0x23')](_0x770014));};}function handleResult(_0x194f6){return function(_0x4ccf09){logger[_0xaa07('0xb')](_0xaa07('0x2c'),JSON['stringify'](_0x4ccf09));if(_0x194f6[_0xaa07('0x10')]&&_0x194f6['MailAccount']['Smtp']&&!_[_0xaa07('0x2d')](_0x194f6[_0xaa07('0xf')])){setTimeout(handleSendEmail(_0x194f6,_0x4ccf09),0x3c*0x3e8);}};}function handleJob(_0x2d005a){return function(){try{if(_[_0xaa07('0x2d')](_0x2d005a[_0xaa07('0x14')])){return logger['info'](_0xaa07('0x2e'));}if(_[_0xaa07('0x2d')](_0x2d005a[_0xaa07('0x15')])){return logger[_0xaa07('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x26b366={'startDate':moment()[_0xaa07('0x2f')](_0x2d005a['subtractNumber'],_0x2d005a[_0xaa07('0x15')])[_0xaa07('0x13')](_0xaa07('0x30')),'endDate':moment()['format'](_0xaa07('0x30')),'type':_0xaa07('0x31'),'output':_0x2d005a[_0xaa07('0x32')],'name':_0x2d005a[_0xaa07('0xe')]};if(!_['isNil'](_0x2d005a[_0xaa07('0x33')])){logger[_0xaa07('0xb')](_0xaa07('0x34'),_0x2d005a[_0xaa07('0x33')]);return analyticDefaultReportController[_0xaa07('0x35')]({'id':_0x2d005a[_0xaa07('0x33')]},_0x26b366)[_0xaa07('0x29')](handleResult(_0x2d005a))[_0xaa07('0x36')](handleError());}if(!_[_0xaa07('0x2d')](_0x2d005a[_0xaa07('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x2d005a[_0xaa07('0x37')]);return analyticCustomReportController[_0xaa07('0x35')]({'id':_0x2d005a[_0xaa07('0x37')]},_0x26b366)['then'](handleResult(_0x2d005a))[_0xaa07('0x36')](handleError());}}catch(_0x56f42b){logger[_0xaa07('0x38')](JSON['stringify'](_0x56f42b));}return logger[_0xaa07('0xb')](_0xaa07('0x39'));};}function getJobs(_0x3b866e){var _0x43ad27={};if(_0x3b866e){_0x43ad27['id']=_0x3b866e;}return db['Schedule'][_0xaa07('0x3a')]({'where':_0x43ad27,'include':[{'model':db[_0xaa07('0x10')],'attributes':['id',_0xaa07('0xe'),_0xaa07('0xf')],'include':[{'model':db[_0xaa07('0x3b')],'as':_0xaa07('0x11'),'include':[{'model':db[_0xaa07('0x3c')],'as':_0xaa07('0x3c')}]}]}]})[_0xaa07('0x29')](function(_0x2f05b1){var _0x5a7ae0=_['keys'](manager[_0xaa07('0x3d')]);var _0x3ba1b6=_[_0xaa07('0x3e')](_0x2f05b1,function(_0x96fb52){return _0x96fb52['id'][_0xaa07('0x3f')]();});var _0x36a59e=_[_0xaa07('0x40')](_0x2f05b1,function(_0x40c5ab){return _0x40c5ab['id']['toString']();});var _0x387880=_0x3b866e?_0x3ba1b6:_[_0xaa07('0x41')](_0x3ba1b6,_0x5a7ae0);var _0x6fb9b5=_[_0xaa07('0x42')](_0x3ba1b6,_0x5a7ae0);var _0x1b6cd8=_[_0xaa07('0x41')](_0x5a7ae0,_0x3ba1b6);var _0x1a4639;var _0x1b3d2d;for(_0x1a4639=0x0;_0x1a4639<_0x1b6cd8[_0xaa07('0x43')]&&!_0x3b866e;_0x1a4639+=0x1){_0x1b3d2d=_0x1b6cd8[_0x1a4639]['toString']();if(manager[_0xaa07('0x44')](_0x1b3d2d)){manager[_0xaa07('0x45')](_0x1b3d2d);manager[_0xaa07('0x46')](_0x1b3d2d);logger['info'](_0xaa07('0x47'),_0x1b3d2d);}}logger[_0xaa07('0xb')](_0xaa07('0x48'),JSON[_0xaa07('0x23')](_0x387880));for(_0x1a4639=0x0;_0x1a4639<_0x387880[_0xaa07('0x43')];_0x1a4639+=0x1){_0x1b3d2d=_0x387880[_0x1a4639][_0xaa07('0x3f')]();logger['info']('index',_0x1b3d2d);if(_0x3b866e){logger[_0xaa07('0xb')](_0xaa07('0x49'),_0x3b866e);logger['info'](JSON[_0xaa07('0x23')](_0x36a59e[_0x1b3d2d]));BPromise['resolve']()[_0xaa07('0x29')](handleJob(_0x36a59e[_0x1b3d2d]));logger['info'](_0xaa07('0x4a'),_0x36a59e[_0x1b3d2d]['name'],_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')]);}else if(_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')]&&_0x36a59e[_0x1b3d2d][_0xaa07('0x4c')]&&moment()[_0xaa07('0x4d')](_0x36a59e[_0x1b3d2d][_0xaa07('0x4e')],_0x36a59e[_0x1b3d2d]['endAt'])){manager['add'](_0x1b3d2d,_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')],handleJob(_0x36a59e[_0x1b3d2d]));manager[_0xaa07('0x4f')](_0x1b3d2d);logger[_0xaa07('0xb')](_0xaa07('0x50'),_0x36a59e[_0x1b3d2d][_0xaa07('0xe')],_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')]);}else if(manager[_0xaa07('0x44')](_0x1b3d2d)){manager[_0xaa07('0x45')](_0x1b3d2d);manager[_0xaa07('0x46')](_0x1b3d2d);logger[_0xaa07('0xb')](_0xaa07('0x51'),_0x36a59e[_0x1b3d2d][_0xaa07('0xe')],_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')]);}}for(_0x1a4639=0x0,_0x1b3d2d;_0x1a4639<_0x6fb9b5[_0xaa07('0x43')]&&!_0x3b866e;_0x1a4639+=0x1){_0x1b3d2d=_0x6fb9b5[_0x1a4639][_0xaa07('0x3f')]();if(manager[_0xaa07('0x44')](_0x1b3d2d)){if(_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')]&&_0x36a59e[_0x1b3d2d]['active']&&moment()[_0xaa07('0x4d')](_0x36a59e[_0x1b3d2d][_0xaa07('0x4e')],_0x36a59e[_0x1b3d2d]['endAt'])){manager['update'](_0x1b3d2d,_0x36a59e[_0x1b3d2d][_0xaa07('0x4b')],handleJob(_0x36a59e[_0x1b3d2d]));logger['info'](_0xaa07('0x52'),_0x36a59e[_0x1b3d2d][_0xaa07('0xe')],_0x36a59e[_0x1b3d2d]['cron']);}else{manager[_0xaa07('0x45')](_0x1b3d2d);manager[_0xaa07('0x46')](_0x1b3d2d);logger[_0xaa07('0xb')](_0xaa07('0x51'),_0x36a59e[_0x1b3d2d]['name'],_0x36a59e[_0x1b3d2d]['cron']);}}}})[_0xaa07('0x36')](function(_0x3f73c8){logger[_0xaa07('0x38')](JSON[_0xaa07('0x23')](_0x3f73c8));});}exports[_0xaa07('0x53')]=function(_0x5c4c65){return getJobs(_0x5c4c65);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7c88=['info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','bcc','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','join','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','active','isBetween','startAt','endAt','cron','add\x20cron','stop','update','update\x20cron','stop\x20cron','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x7c88,0x145));var _0x87c8=function(_0xf65aa5,_0x5a125b){_0xf65aa5=_0xf65aa5-0x0;var _0x160e4c=_0x7c88[_0xf65aa5];return _0x160e4c;};'use strict';var fs=require('fs');var util=require(_0x87c8('0x0'));var path=require(_0x87c8('0x1'));var _=require(_0x87c8('0x2'));var moment=require(_0x87c8('0x3'));var CronJobManager=require(_0x87c8('0x4'));var jayson=require(_0x87c8('0x5'));var BPromise=require('bluebird');var logger=require(_0x87c8('0x6'))('schedule');var db=require(_0x87c8('0x7'))['db'];var analyticCustomReportController=require(_0x87c8('0x8'));var analyticDefaultReportController=require(_0x87c8('0x9'));var client=jayson['client'][_0x87c8('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2c588a,_0x17c53d){return function(){logger[_0x87c8('0xb')](_0x87c8('0xc'),_0x2c588a[_0x87c8('0xd')]);var _0x4a2c08=!![];var _0x4d0617=_0x2c588a['MailAccount'][_0x87c8('0xe')]();var _0x4fd008={'account':_0x4d0617,'message':{'from':util[_0x87c8('0xf')](_0x87c8('0x10'),_0x2c588a[_0x87c8('0x11')][_0x87c8('0x12')],_0x2c588a['MailAccount']['email']||_0x2c588a['MailAccount'][_0x87c8('0x13')]['user']),'to':_0x2c588a[_0x87c8('0xd')],'cc':_0x2c588a['cc'],'bcc':_0x2c588a[_0x87c8('0x14')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x17c53d['name'],_0x2c588a[_0x87c8('0x15')],_0x2c588a[_0x87c8('0x16')])}};var _0x4a0eeb=path['join'](__dirname,'../../files/reports');var _0x46848d=_0x17c53d['savename'];var _0x441024=util['format'](_0x87c8('0x17'),path[_0x87c8('0x18')](_0x17c53d[_0x87c8('0x19')],path[_0x87c8('0x1a')](_0x17c53d[_0x87c8('0x19')])),'zip');var _0x4e313d=path[_0x87c8('0x1b')](_0x4a0eeb,_0x46848d);var _0x1b2c0d=path[_0x87c8('0x1b')](_0x4a0eeb,_0x441024);if(fs[_0x87c8('0x1c')](_0x4e313d)){_0x17c53d['status']=_0x87c8('0x1d');_0x4fd008[_0x87c8('0x1e')][_0x87c8('0x1f')]=[{'filename':_0x46848d,'path':_0x4e313d}];_0x4fd008[_0x87c8('0x1e')][_0x87c8('0x20')]=util[_0x87c8('0xf')](_0x87c8('0x21'),JSON[_0x87c8('0x22')](_0x17c53d,null,0x2));}else if(fs[_0x87c8('0x1c')](_0x1b2c0d)){_0x17c53d[_0x87c8('0x23')]=_0x87c8('0x1d');_0x4fd008[_0x87c8('0x1e')][_0x87c8('0x1f')]=[{'filename':_0x441024,'path':_0x1b2c0d}];}else{_0x4fd008[_0x87c8('0x1e')]['text']=_0x87c8('0x24');if(!_0x2c588a[_0x87c8('0x25')]){_0x4a2c08=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4a2c08){return client[_0x87c8('0x26')](_0x87c8('0x27'),_0x4fd008)[_0x87c8('0x28')](function(_0x3bb9af){if(_0x3bb9af[_0x87c8('0x29')]){return logger[_0x87c8('0x29')](_0x87c8('0x2a'),JSON[_0x87c8('0x22')](_0x3bb9af));}return logger['info'](_0x87c8('0x2b'));})[_0x87c8('0x2c')](function(_0x3e5c59){return logger[_0x87c8('0x29')](_0x87c8('0x2a'),JSON[_0x87c8('0x22')](_0x3e5c59));});}};}function handleError(){return function(_0x8ec82e){return logger['error'](JSON[_0x87c8('0x22')](_0x8ec82e));};}function handleResult(_0x1fadf3){return function(_0x7913a3){logger[_0x87c8('0xb')]('data',JSON[_0x87c8('0x22')](_0x7913a3));if(_0x1fadf3[_0x87c8('0x11')]&&_0x1fadf3[_0x87c8('0x11')][_0x87c8('0x13')]&&!_['isNil'](_0x1fadf3[_0x87c8('0xd')])){setTimeout(handleSendEmail(_0x1fadf3,_0x7913a3),0x3c*0x3e8);}};}function handleJob(_0x3035d2){return function(){try{if(_[_0x87c8('0x2d')](_0x3035d2[_0x87c8('0x15')])){return logger[_0x87c8('0xb')](_0x87c8('0x2e'));}if(_['isNil'](_0x3035d2[_0x87c8('0x16')])){return logger[_0x87c8('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1e1eae={'startDate':moment()[_0x87c8('0x2f')](_0x3035d2[_0x87c8('0x15')],_0x3035d2[_0x87c8('0x16')])[_0x87c8('0xf')](_0x87c8('0x30')),'endDate':moment()[_0x87c8('0xf')](_0x87c8('0x30')),'type':'scheduled','output':_0x3035d2['output'],'name':_0x3035d2[_0x87c8('0x12')]};if(!_[_0x87c8('0x2d')](_0x3035d2[_0x87c8('0x31')])){logger[_0x87c8('0xb')](_0x87c8('0x32'),_0x3035d2[_0x87c8('0x31')]);return analyticDefaultReportController['runReport']({'id':_0x3035d2[_0x87c8('0x31')]},_0x1e1eae)['then'](handleResult(_0x3035d2))[_0x87c8('0x2c')](handleError());}if(!_[_0x87c8('0x2d')](_0x3035d2[_0x87c8('0x33')])){logger[_0x87c8('0xb')](_0x87c8('0x34'),_0x3035d2[_0x87c8('0x33')]);return analyticCustomReportController[_0x87c8('0x35')]({'id':_0x3035d2[_0x87c8('0x33')]},_0x1e1eae)[_0x87c8('0x28')](handleResult(_0x3035d2))['catch'](handleError());}}catch(_0x2f8e55){logger[_0x87c8('0x29')](JSON[_0x87c8('0x22')](_0x2f8e55));}return logger[_0x87c8('0xb')]('no\x20report\x20id');};}function getJobs(_0x3a3189){var _0x9f1e43={};if(_0x3a3189){_0x9f1e43['id']=_0x3a3189;}return db['Schedule'][_0x87c8('0x36')]({'where':_0x9f1e43,'include':[{'model':db[_0x87c8('0x11')],'attributes':['id',_0x87c8('0x12'),_0x87c8('0xd')],'include':[{'model':db[_0x87c8('0x37')],'as':_0x87c8('0x13'),'include':[{'model':db[_0x87c8('0x38')],'as':_0x87c8('0x38')}]}]}]})[_0x87c8('0x28')](function(_0x5bcf2a){var _0x2c7ca9=_[_0x87c8('0x39')](manager[_0x87c8('0x3a')]);var _0x3d8187=_[_0x87c8('0x3b')](_0x5bcf2a,function(_0x1d5944){return _0x1d5944['id'][_0x87c8('0x3c')]();});var _0x1dc09e=_['keyBy'](_0x5bcf2a,function(_0x282b7f){return _0x282b7f['id'][_0x87c8('0x3c')]();});var _0x285668=_0x3a3189?_0x3d8187:_[_0x87c8('0x3d')](_0x3d8187,_0x2c7ca9);var _0x5ddd89=_[_0x87c8('0x3e')](_0x3d8187,_0x2c7ca9);var _0x40d60b=_[_0x87c8('0x3d')](_0x2c7ca9,_0x3d8187);var _0x58ab53;var _0xee036f;for(_0x58ab53=0x0;_0x58ab53<_0x40d60b[_0x87c8('0x3f')]&&!_0x3a3189;_0x58ab53+=0x1){_0xee036f=_0x40d60b[_0x58ab53][_0x87c8('0x3c')]();if(manager[_0x87c8('0x40')](_0xee036f)){manager['stop'](_0xee036f);manager[_0x87c8('0x41')](_0xee036f);logger[_0x87c8('0xb')](_0x87c8('0x42'),_0xee036f);}}logger['info'](_0x87c8('0x43'),JSON[_0x87c8('0x22')](_0x285668));for(_0x58ab53=0x0;_0x58ab53<_0x285668['length'];_0x58ab53+=0x1){_0xee036f=_0x285668[_0x58ab53][_0x87c8('0x3c')]();logger['info'](_0x87c8('0x44'),_0xee036f);if(_0x3a3189){logger[_0x87c8('0xb')](_0x87c8('0x45'),_0x3a3189);logger['info'](JSON[_0x87c8('0x22')](_0x1dc09e[_0xee036f]));BPromise[_0x87c8('0x46')]()['then'](handleJob(_0x1dc09e[_0xee036f]));logger[_0x87c8('0xb')](_0x87c8('0x47'),_0x1dc09e[_0xee036f]['name'],_0x1dc09e[_0xee036f]['cron']);}else if(_0x1dc09e[_0xee036f]['cron']&&_0x1dc09e[_0xee036f][_0x87c8('0x48')]&&moment()[_0x87c8('0x49')](_0x1dc09e[_0xee036f][_0x87c8('0x4a')],_0x1dc09e[_0xee036f][_0x87c8('0x4b')])){manager['add'](_0xee036f,_0x1dc09e[_0xee036f][_0x87c8('0x4c')],handleJob(_0x1dc09e[_0xee036f]));manager['start'](_0xee036f);logger[_0x87c8('0xb')](_0x87c8('0x4d'),_0x1dc09e[_0xee036f][_0x87c8('0x12')],_0x1dc09e[_0xee036f]['cron']);}else if(manager[_0x87c8('0x40')](_0xee036f)){manager[_0x87c8('0x4e')](_0xee036f);manager['deleteJob'](_0xee036f);logger['info']('stop\x20cron',_0x1dc09e[_0xee036f]['name'],_0x1dc09e[_0xee036f]['cron']);}}for(_0x58ab53=0x0,_0xee036f;_0x58ab53<_0x5ddd89[_0x87c8('0x3f')]&&!_0x3a3189;_0x58ab53+=0x1){_0xee036f=_0x5ddd89[_0x58ab53]['toString']();if(manager[_0x87c8('0x40')](_0xee036f)){if(_0x1dc09e[_0xee036f]['cron']&&_0x1dc09e[_0xee036f][_0x87c8('0x48')]&&moment()[_0x87c8('0x49')](_0x1dc09e[_0xee036f][_0x87c8('0x4a')],_0x1dc09e[_0xee036f][_0x87c8('0x4b')])){manager[_0x87c8('0x4f')](_0xee036f,_0x1dc09e[_0xee036f]['cron'],handleJob(_0x1dc09e[_0xee036f]));logger[_0x87c8('0xb')](_0x87c8('0x50'),_0x1dc09e[_0xee036f][_0x87c8('0x12')],_0x1dc09e[_0xee036f][_0x87c8('0x4c')]);}else{manager['stop'](_0xee036f);manager[_0x87c8('0x41')](_0xee036f);logger['info'](_0x87c8('0x51'),_0x1dc09e[_0xee036f][_0x87c8('0x12')],_0x1dc09e[_0xee036f][_0x87c8('0x4c')]);}}}})[_0x87c8('0x2c')](function(_0x2ed28b){logger['error'](JSON[_0x87c8('0x22')](_0x2ed28b));});}exports[_0x87c8('0x52')]=function(_0x1b2a66){return getJobs(_0x1b2a66);};exports[_0x87c8('0x53')]=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 c55a5cc..95e8b47 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 _0xa596=['TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','bucket','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','SequelizeValidationError','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x278f74,_0x54625a){var _0x17b4bd=function(_0x10ed8e){while(--_0x10ed8e){_0x278f74['push'](_0x278f74['shift']());}};_0x17b4bd(++_0x54625a);}(_0xa596,0x7b));var _0x6a59=function(_0x3d99f0,_0x39115d){_0x3d99f0=_0x3d99f0-0x0;var _0xa63db4=_0xa596[_0x3d99f0];return _0xa63db4;};var _=require(_0x6a59('0x0'));var AWS=require(_0x6a59('0x1'));var rp=require('request-promise');var util=require(_0x6a59('0x2'));var BPromise=require(_0x6a59('0x3'));var db=require(_0x6a59('0x4'))['db'];var logger=require(_0x6a59('0x5'))(_0x6a59('0x6'));function getTranscriptionJob(_0xf0435f,_0x11cce1,_0x272793,_0x4f42f6){return new Promise(function(_0x37d9ef,_0x3fab57){var _0x21e97f=new AWS[(_0x6a59('0x7'))]({'accessKeyId':_0x11cce1,'secretAccessKey':_0xf0435f,'region':_0x272793});_0x21e97f[_0x6a59('0x8')]({'TranscriptionJobName':_0x4f42f6},function(_0x3c392f,_0x5aa5fe){if(_0x3c392f){return _0x3fab57(_0x3c392f);}else{return _0x37d9ef(_0x5aa5fe);}});});}function sentiment(_0x3f25d8,_0x48ecee,_0x21008c,_0x49be8c,_0x55ef5b){return new Promise(function(_0x3b44b5,_0x6e6ef7){var _0x24041e=new AWS['Comprehend']({'accessKeyId':_0x48ecee,'secretAccessKey':_0x3f25d8,'region':_0x21008c});_0x24041e[_0x6a59('0x9')]({'Text':_0x49be8c,'LanguageCode':_0x55ef5b[_0x6a59('0xa')](0x0,0x2)},function(_0x5a8484,_0x4e2323){if(_0x5a8484){return _0x6e6ef7(_0x5a8484);}else{return _0x3b44b5(_0x4e2323);}});});}function checkTranscribeJob(_0x4bf880,_0x23e9e3,_0x3075ca){var _0x177506;return new BPromise(function(_0x68dd0a,_0x1b0d74){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0xd'),_0x4bf880['id'],_0x4bf880[_0x6a59('0xe')]));return getTranscriptionJob(_0x3075ca[_0x6a59('0xf')],_0x3075ca[_0x6a59('0x10')],_0x23e9e3['transcribeRegion'],_0x4bf880[_0x6a59('0xe')])[_0x6a59('0x11')](function(_0x416613){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x12'),_0x4bf880['id'],_0x4bf880['transcribeName'],_0x416613[_0x6a59('0x13')][_0x6a59('0x14')]));if(!_0x4bf880[_0x6a59('0x15')]){switch(_0x416613[_0x6a59('0x13')][_0x6a59('0x14')]){case _0x6a59('0x16'):var _0x4988e2={'transcribeStatus':_0x416613[_0x6a59('0x13')][_0x6a59('0x14')],'fileUri':_0x416613[_0x6a59('0x13')][_0x6a59('0x17')][_0x6a59('0x18')]};logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x19'),_0x4bf880['id']));return rp({'uri':_0x416613[_0x6a59('0x13')][_0x6a59('0x17')]['TranscriptFileUri'],'json':!![]})[_0x6a59('0x11')](function(_0x3e068b){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4bf880['id']));if(_0x3e068b&&_0x3e068b['results']&&_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')]&&_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')]['length']){_0x4988e2['fileText']='';for(var _0x344cea=0x0;_0x344cea<_0x3e068b[_0x6a59('0x1a')]['transcripts'][_0x6a59('0x1c')];_0x344cea++){_0x4988e2['fileText']+=_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')][_0x344cea]['transcript']+'';}}return _0x4bf880[_0x6a59('0x1d')](_0x4988e2);})['then'](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4bf880['id']));if(!_0x4bf880[_0x6a59('0x1e')]){throw new db['Sequelize'][(_0x6a59('0x1f'))](_0x6a59('0x20'));}if(!_0x23e9e3[_0x6a59('0x21')]||!_0x23e9e3[_0x6a59('0x22')]||!_0x23e9e3[_0x6a59('0x23')]||!_0x23e9e3[_0x6a59('0x24')]||!_0x23e9e3['bucket']){throw new db['Sequelize'][(_0x6a59('0x1f'))](_0x6a59('0x25'));}if(!_0x4988e2['fileText']){throw new Error(_0x6a59('0x26'));}if(_0x23e9e3['sentimentAccountId']===_0x3075ca['id']){return _0x3075ca;}else{return db[_0x6a59('0x27')][_0x6a59('0x28')]({'where':{'id':_settings[_0x6a59('0x22')]}});}})['then'](function(_0x360e16){if(!_0x360e16){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x360e16[_0x6a59('0xf')]||!_0x360e16[_0x6a59('0x10')]){throw new db['Sequelize'][(_0x6a59('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x177506=_0x360e16;logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4bf880['id']));return sentiment(_0x177506[_0x6a59('0xf')],_0x177506[_0x6a59('0x10')],_0x23e9e3['sentimentRegion'],_0x4988e2['fileText'],_0x23e9e3['language']);})['then'](function(_0x49542a){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x2a'),_0x4bf880['id']));return _0x4bf880['update']({'sentiment':_0x49542a[_0x6a59('0x2b')],'sPositive':_0x49542a[_0x6a59('0x2c')]['Positive'],'sNegative':_0x49542a['SentimentScore'][_0x6a59('0x2d')],'sMixed':_0x49542a['SentimentScore'][_0x6a59('0x2e')],'sNeutral':_0x49542a[_0x6a59('0x2c')][_0x6a59('0x2f')]});})[_0x6a59('0x11')](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});case _0x6a59('0x31'):return _0x4bf880[_0x6a59('0x1d')]({'transcribeStatus':_0x6a59('0x31'),'failureReason':_0x416613[_0x6a59('0x13')][_0x6a59('0x32')]})[_0x6a59('0x11')](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});default:logger['info'](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4bf880['id']));break;}}else{return BPromise[_0x6a59('0x33')]()[_0x6a59('0x11')](function(){if(!_0x4bf880[_0x6a59('0x1e')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x20'));}if(!_0x23e9e3[_0x6a59('0x21')]||!_0x23e9e3[_0x6a59('0x22')]||!_0x23e9e3[_0x6a59('0x23')]||!_0x23e9e3['language']||!_0x23e9e3[_0x6a59('0x34')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4bf880['fileText']){throw new Error(_0x6a59('0x26'));}if(_0x23e9e3[_0x6a59('0x22')]===_0x3075ca['id']){return _0x3075ca;}else{return db[_0x6a59('0x27')]['findOne']({'where':{'id':_settings[_0x6a59('0x22')]}});}})[_0x6a59('0x11')](function(_0x399532){if(!_0x399532){throw new db['Sequelize']['ValidationError'](_0x6a59('0x35'));}if(!_0x399532[_0x6a59('0xf')]||!_0x399532[_0x6a59('0x10')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x36'));}_0x177506=_0x399532;logger['info'](util['format'](_0x6a59('0x37'),_0x4bf880['id']));return sentiment(_0x177506['data1'],_0x177506[_0x6a59('0x10')],_0x23e9e3[_0x6a59('0x23')],_0x4bf880['fileText'],_0x23e9e3[_0x6a59('0x24')]);})[_0x6a59('0x11')](function(_0x267a4b){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4bf880['id']));return _0x4bf880[_0x6a59('0x1d')]({'sentiment':_0x267a4b['Sentiment'],'sPositive':_0x267a4b['SentimentScore']['Positive'],'sNegative':_0x267a4b[_0x6a59('0x2c')][_0x6a59('0x2d')],'sMixed':_0x267a4b[_0x6a59('0x2c')]['Mixed'],'sNeutral':_0x267a4b[_0x6a59('0x2c')][_0x6a59('0x2f')],'transcribeStatus':_0x6a59('0x16')});})['then'](function(){logger['info'](util['format'](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});}})['catch'](function(_0xa17ed9){if(_0xa17ed9){if(!_0xa17ed9[_0x6a59('0x38')]||_0xa17ed9['name']!=='SequelizeValidationError'){logger['error'](util[_0x6a59('0xc')](_0x6a59('0x39'),_0x4bf880['id']),util[_0x6a59('0x3a')](_0xa17ed9,{'showHidden':![],'depth':null}));}}_0x68dd0a();});});}function checkTranscribe(){var _0x180dc4;var _0x1509e2;var _0x11715b;return db[_0x6a59('0x3b')]['findAll']({'where':{'transcribeStatus':_0x6a59('0x3c')}})[_0x6a59('0x11')](function(_0xbc5b1a){if(!_0xbc5b1a||!_0xbc5b1a[_0x6a59('0x1c')]){throw new db[(_0x6a59('0x29'))]['ValidationError'](_0x6a59('0x3d'));}_0x180dc4=_0xbc5b1a;return db[_0x6a59('0x3e')][_0x6a59('0x28')]({'where':{'id':0x1}});})[_0x6a59('0x11')](function(_0x278e7a){if(!_0x278e7a){throw new db[(_0x6a59('0x29'))]['ValidationError'](_0x6a59('0x3f'));}_0x1509e2=_0x278e7a;if(!_0x1509e2['transcribe']||!_0x1509e2[_0x6a59('0x40')]||!_0x1509e2[_0x6a59('0x41')]||!_0x1509e2[_0x6a59('0x24')]||!_0x1509e2['bucket']){throw new db['Sequelize']['ValidationError'](_0x6a59('0x42'));}return db[_0x6a59('0x27')]['findOne']({'where':{'id':_0x1509e2[_0x6a59('0x40')]}});})[_0x6a59('0x11')](function(_0x31aa4e){if(!_0x31aa4e){throw new db[(_0x6a59('0x29'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x31aa4e[_0x6a59('0xf')]||!_0x31aa4e[_0x6a59('0x10')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x36'));}_0x11715b=_0x31aa4e;var _0x574c24=[];_0x180dc4['forEach'](function(_0x1a118e){_0x574c24[_0x6a59('0x43')](checkTranscribeJob(_0x1a118e,_0x1509e2,_0x11715b));});return BPromise[_0x6a59('0x44')](_0x574c24);})['catch'](function(_0x328e78){if(_0x328e78){if(!_0x328e78['name']||_0x328e78[_0x6a59('0x38')]!==_0x6a59('0x45')){logger['error'](util[_0x6a59('0x3a')](_0x328e78,{'showHidden':![],'depth':null}));}}});}exports[_0x6a59('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6b20=['Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','length','fileText','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','Sentiment','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','lodash','aws-sdk','util','../../mysqldb','../../config/logger','transcribe','TranscribeService'];(function(_0x3611f2,_0x4ef70c){var _0x3d6c0c=function(_0x5af60f){while(--_0x5af60f){_0x3611f2['push'](_0x3611f2['shift']());}};_0x3d6c0c(++_0x4ef70c);}(_0x6b20,0xd1));var _0x06b2=function(_0x5d21ad,_0x478270){_0x5d21ad=_0x5d21ad-0x0;var _0x33c5a7=_0x6b20[_0x5d21ad];return _0x33c5a7;};var _=require(_0x06b2('0x0'));var AWS=require(_0x06b2('0x1'));var rp=require('request-promise');var util=require(_0x06b2('0x2'));var BPromise=require('bluebird');var db=require(_0x06b2('0x3'))['db'];var logger=require(_0x06b2('0x4'))(_0x06b2('0x5'));function getTranscriptionJob(_0x5ba392,_0x311643,_0x3ea357,_0x236287){return new Promise(function(_0x30d39c,_0x3b792b){var _0x37b825=new AWS[(_0x06b2('0x6'))]({'accessKeyId':_0x311643,'secretAccessKey':_0x5ba392,'region':_0x3ea357});_0x37b825['getTranscriptionJob']({'TranscriptionJobName':_0x236287},function(_0x21cd31,_0x1828e4){if(_0x21cd31){return _0x3b792b(_0x21cd31);}else{return _0x30d39c(_0x1828e4);}});});}function sentiment(_0x315223,_0x58538a,_0x37ace0,_0x57f854,_0x2cc28f){return new Promise(function(_0x4da705,_0x552cd8){var _0x301519=new AWS[(_0x06b2('0x7'))]({'accessKeyId':_0x58538a,'secretAccessKey':_0x315223,'region':_0x37ace0});_0x301519['detectSentiment']({'Text':_0x57f854,'LanguageCode':_0x2cc28f[_0x06b2('0x8')](0x0,0x2)},function(_0x41306a,_0x3fa17b){if(_0x41306a){return _0x552cd8(_0x41306a);}else{return _0x4da705(_0x3fa17b);}});});}function checkTranscribeJob(_0x368889,_0x44a9b4,_0x810a12){var _0x3039c9;return new BPromise(function(_0x926bf6,_0x265c36){logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0xb'),_0x368889['id'],_0x368889[_0x06b2('0xc')]));return getTranscriptionJob(_0x810a12['data1'],_0x810a12[_0x06b2('0xd')],_0x44a9b4[_0x06b2('0xe')],_0x368889[_0x06b2('0xc')])[_0x06b2('0xf')](function(_0xef0466){logger[_0x06b2('0x9')](util['format'](_0x06b2('0x10'),_0x368889['id'],_0x368889[_0x06b2('0xc')],_0xef0466['TranscriptionJob'][_0x06b2('0x11')]));if(!_0x368889['fileText']){switch(_0xef0466['TranscriptionJob'][_0x06b2('0x11')]){case _0x06b2('0x12'):var _0x27852e={'transcribeStatus':_0xef0466[_0x06b2('0x13')]['TranscriptionJobStatus'],'fileUri':_0xef0466[_0x06b2('0x13')][_0x06b2('0x14')][_0x06b2('0x15')]};logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0x16'),_0x368889['id']));return rp({'uri':_0xef0466[_0x06b2('0x13')]['Transcript'][_0x06b2('0x15')],'json':!![]})[_0x06b2('0xf')](function(_0xb05f65){logger[_0x06b2('0x9')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x368889['id']));if(_0xb05f65&&_0xb05f65[_0x06b2('0x17')]&&_0xb05f65[_0x06b2('0x17')]['transcripts']&&_0xb05f65[_0x06b2('0x17')]['transcripts'][_0x06b2('0x18')]){_0x27852e[_0x06b2('0x19')]='';for(var _0x2a0645=0x0;_0x2a0645<_0xb05f65['results'][_0x06b2('0x1a')][_0x06b2('0x18')];_0x2a0645++){_0x27852e[_0x06b2('0x19')]+=_0xb05f65[_0x06b2('0x17')][_0x06b2('0x1a')][_0x2a0645]['transcript']+'';}}return _0x368889[_0x06b2('0x1b')](_0x27852e);})[_0x06b2('0xf')](function(){logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0x1c'),_0x368889['id']));if(!_0x368889[_0x06b2('0x1d')]){throw new db['Sequelize'][(_0x06b2('0x1e'))](_0x06b2('0x1f'));}if(!_0x44a9b4[_0x06b2('0x20')]||!_0x44a9b4[_0x06b2('0x21')]||!_0x44a9b4[_0x06b2('0x22')]||!_0x44a9b4[_0x06b2('0x23')]||!_0x44a9b4[_0x06b2('0x24')]){throw new db['Sequelize'][(_0x06b2('0x1e'))](_0x06b2('0x25'));}if(!_0x27852e[_0x06b2('0x19')]){throw new Error(_0x06b2('0x26'));}if(_0x44a9b4[_0x06b2('0x21')]===_0x810a12['id']){return _0x810a12;}else{return db[_0x06b2('0x27')][_0x06b2('0x28')]({'where':{'id':_settings[_0x06b2('0x21')]}});}})['then'](function(_0x2682e0){if(!_0x2682e0){throw new db[(_0x06b2('0x29'))][(_0x06b2('0x1e'))](_0x06b2('0x2a'));}if(!_0x2682e0[_0x06b2('0x2b')]||!_0x2682e0[_0x06b2('0xd')]){throw new db[(_0x06b2('0x29'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3039c9=_0x2682e0;logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0x2c'),_0x368889['id']));return sentiment(_0x3039c9['data1'],_0x3039c9[_0x06b2('0xd')],_0x44a9b4[_0x06b2('0x22')],_0x27852e[_0x06b2('0x19')],_0x44a9b4[_0x06b2('0x23')]);})[_0x06b2('0xf')](function(_0x27f172){logger['info'](util[_0x06b2('0xa')](_0x06b2('0x2d'),_0x368889['id']));return _0x368889[_0x06b2('0x1b')]({'sentiment':_0x27f172['Sentiment'],'sPositive':_0x27f172[_0x06b2('0x2e')][_0x06b2('0x2f')],'sNegative':_0x27f172['SentimentScore'][_0x06b2('0x30')],'sMixed':_0x27f172[_0x06b2('0x2e')][_0x06b2('0x31')],'sNeutral':_0x27f172[_0x06b2('0x2e')][_0x06b2('0x32')]});})[_0x06b2('0xf')](function(){logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0x1c'),_0x368889['id']));_0x926bf6();});case _0x06b2('0x33'):return _0x368889[_0x06b2('0x1b')]({'transcribeStatus':_0x06b2('0x33'),'failureReason':_0xef0466['TranscriptionJob'][_0x06b2('0x34')]})['then'](function(){logger['info'](util[_0x06b2('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x368889['id']));_0x926bf6();});default:logger[_0x06b2('0x9')](util['format'](_0x06b2('0x35'),_0x368889['id']));break;}}else{return BPromise[_0x06b2('0x36')]()[_0x06b2('0xf')](function(){if(!_0x368889[_0x06b2('0x1d')]){throw new db[(_0x06b2('0x29'))]['ValidationError'](_0x06b2('0x1f'));}if(!_0x44a9b4[_0x06b2('0x20')]||!_0x44a9b4[_0x06b2('0x21')]||!_0x44a9b4[_0x06b2('0x22')]||!_0x44a9b4[_0x06b2('0x23')]||!_0x44a9b4[_0x06b2('0x24')]){throw new db['Sequelize'][(_0x06b2('0x1e'))](_0x06b2('0x25'));}if(!_0x368889['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x44a9b4[_0x06b2('0x21')]===_0x810a12['id']){return _0x810a12;}else{return db[_0x06b2('0x27')][_0x06b2('0x28')]({'where':{'id':_settings[_0x06b2('0x21')]}});}})[_0x06b2('0xf')](function(_0x1d174d){if(!_0x1d174d){throw new db[(_0x06b2('0x29'))][(_0x06b2('0x1e'))](_0x06b2('0x2a'));}if(!_0x1d174d[_0x06b2('0x2b')]||!_0x1d174d[_0x06b2('0xd')]){throw new db[(_0x06b2('0x29'))][(_0x06b2('0x1e'))](_0x06b2('0x37'));}_0x3039c9=_0x1d174d;logger[_0x06b2('0x9')](util[_0x06b2('0xa')](_0x06b2('0x2c'),_0x368889['id']));return sentiment(_0x3039c9[_0x06b2('0x2b')],_0x3039c9[_0x06b2('0xd')],_0x44a9b4['sentimentRegion'],_0x368889[_0x06b2('0x19')],_0x44a9b4[_0x06b2('0x23')]);})[_0x06b2('0xf')](function(_0x26bab7){logger['info'](util[_0x06b2('0xa')](_0x06b2('0x2d'),_0x368889['id']));return _0x368889['update']({'sentiment':_0x26bab7[_0x06b2('0x38')],'sPositive':_0x26bab7[_0x06b2('0x2e')]['Positive'],'sNegative':_0x26bab7[_0x06b2('0x2e')][_0x06b2('0x30')],'sMixed':_0x26bab7['SentimentScore']['Mixed'],'sNeutral':_0x26bab7['SentimentScore'][_0x06b2('0x32')],'transcribeStatus':_0x06b2('0x12')});})[_0x06b2('0xf')](function(){logger[_0x06b2('0x9')](util[_0x06b2('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x368889['id']));_0x926bf6();});}})['catch'](function(_0x15332e){if(_0x15332e){if(!_0x15332e[_0x06b2('0x39')]||_0x15332e[_0x06b2('0x39')]!==_0x06b2('0x3a')){logger[_0x06b2('0x3b')](util[_0x06b2('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x368889['id']),util[_0x06b2('0x3c')](_0x15332e,{'showHidden':![],'depth':null}));}}_0x926bf6();});});}function checkTranscribe(){var _0x2aefd9;var _0x2e996a;var _0x33f72e;return db[_0x06b2('0x3d')][_0x06b2('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x06b2('0xf')](function(_0x1daa9e){if(!_0x1daa9e||!_0x1daa9e[_0x06b2('0x18')]){throw new db[(_0x06b2('0x29'))]['ValidationError'](_0x06b2('0x3f'));}_0x2aefd9=_0x1daa9e;return db[_0x06b2('0x40')][_0x06b2('0x28')]({'where':{'id':0x1}});})[_0x06b2('0xf')](function(_0x546c9e){if(!_0x546c9e){throw new db[(_0x06b2('0x29'))][(_0x06b2('0x1e'))](_0x06b2('0x41'));}_0x2e996a=_0x546c9e;if(!_0x2e996a[_0x06b2('0x5')]||!_0x2e996a[_0x06b2('0x42')]||!_0x2e996a[_0x06b2('0xe')]||!_0x2e996a[_0x06b2('0x23')]||!_0x2e996a[_0x06b2('0x24')]){throw new db['Sequelize'][(_0x06b2('0x1e'))](_0x06b2('0x43'));}return db[_0x06b2('0x27')][_0x06b2('0x28')]({'where':{'id':_0x2e996a[_0x06b2('0x42')]}});})[_0x06b2('0xf')](function(_0x4fba4c){if(!_0x4fba4c){throw new db['Sequelize'][(_0x06b2('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4fba4c['data1']||!_0x4fba4c[_0x06b2('0xd')]){throw new db['Sequelize'][(_0x06b2('0x1e'))](_0x06b2('0x37'));}_0x33f72e=_0x4fba4c;var _0x18a927=[];_0x2aefd9[_0x06b2('0x44')](function(_0x2e5423){_0x18a927[_0x06b2('0x45')](checkTranscribeJob(_0x2e5423,_0x2e996a,_0x33f72e));});return BPromise[_0x06b2('0x46')](_0x18a927);})[_0x06b2('0x47')](function(_0x204cc7){if(_0x204cc7){if(!_0x204cc7[_0x06b2('0x39')]||_0x204cc7['name']!=='SequelizeValidationError'){logger[_0x06b2('0x3b')](util[_0x06b2('0x3c')](_0x204cc7,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index df1eeaa..a3f7941 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 _0x0185=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x52aa95,_0x5f3c12){var _0x4c4400=function(_0x457c8e){while(--_0x457c8e){_0x52aa95['push'](_0x52aa95['shift']());}};_0x4c4400(++_0x5f3c12);}(_0x0185,0xb3));var _0x5018=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0185[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x5018('0x0'));var moment=require('moment');var Redis=require(_0x5018('0x1'));var util=require('util');var config=require(_0x5018('0x2'));var db=require(_0x5018('0x3'))['db'];var logger=require(_0x5018('0x4'))(_0x5018('0x5'));config[_0x5018('0x6')]=_['defaults'](config[_0x5018('0x6')],{'host':_0x5018('0x7'),'port':0x18eb});var io=require(_0x5018('0x8'))(new Redis(config[_0x5018('0x6')]));function closeInteractions(){var _0x15f033=[];return db[_0x5018('0x9')][_0x5018('0xa')]({'raw':!![],'attributes':['id',_0x5018('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0x5018('0xc')](function(_0x26f972){if(_0x26f972&&_0x26f972[_0x5018('0xd')]){_0x15f033=_['map'](_0x26f972||[],'id');logger[_0x5018('0xe')](_0x5018('0xf'),_0x15f033[_0x5018('0x10')]());return db[_0x5018('0x9')]['update']({'closeReason':_0x5018('0x11'),'disposition':_0x5018('0x12'),'closed':!![],'closedAt':moment()[_0x5018('0x13')](_0x5018('0x14'))},{'where':{'id':_0x15f033}});}})['then'](function(){if(_0x15f033&&_0x15f033['length']){logger[_0x5018('0xe')](_0x5018('0x15'),_0x15f033[_0x5018('0x10')]());for(var _0x144e3d=0x0;_0x144e3d<_0x15f033[_0x5018('0xd')];_0x144e3d++){io[_0x5018('0x16')](_0x5018('0x17'),{'id':_0x15f033[_0x144e3d],'closed':!![]});}}})[_0x5018('0x18')](function(_0x528e75){logger[_0x5018('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x528e75?util[_0x5018('0x1a')](_0x528e75,{'showHidden':![],'depth':null}):'');});}exports[_0x5018('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7c11=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7c11,0x1ce));var _0x17c1=function(_0x13c3aa,_0x37ef3f){_0x13c3aa=_0x13c3aa-0x0;var _0x4aea35=_0x7c11[_0x13c3aa];return _0x4aea35;};'use strict';var _=require(_0x17c1('0x0'));var moment=require('moment');var Redis=require(_0x17c1('0x1'));var util=require(_0x17c1('0x2'));var config=require(_0x17c1('0x3'));var db=require(_0x17c1('0x4'))['db'];var logger=require(_0x17c1('0x5'))('schedule');config['redis']=_['defaults'](config[_0x17c1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x17c1('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x204f73=[];return db[_0x17c1('0x8')][_0x17c1('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x17c1('0xa')](0x18,_0x17c1('0xb'))}}})[_0x17c1('0xc')](function(_0x381c4c){if(_0x381c4c&&_0x381c4c[_0x17c1('0xd')]){_0x204f73=_[_0x17c1('0xe')](_0x381c4c||[],'id');logger[_0x17c1('0xf')](_0x17c1('0x10'),_0x204f73['join']());return db['WhatsappInteraction'][_0x17c1('0x11')]({'closeReason':_0x17c1('0x12'),'disposition':_0x17c1('0x13'),'closed':!![],'closedAt':moment()[_0x17c1('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x204f73}});}})[_0x17c1('0xc')](function(){if(_0x204f73&&_0x204f73[_0x17c1('0xd')]){logger[_0x17c1('0xf')](_0x17c1('0x15'),_0x204f73[_0x17c1('0x16')]());for(var _0x1b7525=0x0;_0x1b7525<_0x204f73[_0x17c1('0xd')];_0x1b7525++){io[_0x17c1('0x17')](_0x17c1('0x18'),{'id':_0x204f73[_0x1b7525],'closed':!![]});}}})['catch'](function(_0x3090c6){logger['error'](_0x17c1('0x19'),_0x3090c6?util[_0x17c1('0x1a')](_0x3090c6,{'showHidden':![],'depth':null}):'');});}exports[_0x17c1('0x1b')]=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 280302a..c9e49b0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2b9=['CmHopper','then','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','log','finished\x20populating','contacts1'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0xb2b9,0x15b));var _0x9b2b=function(_0x4c52f0,_0x5919c9){_0x4c52f0=_0x4c52f0-0x0;var _0x238400=_0xb2b9[_0x4c52f0];return _0x238400;};'use strict';var util=require(_0x9b2b('0x0'));var db=require(_0x9b2b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9b2b('0x2')]({'id':i,'firstName':_0x9b2b('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9b2b('0x4')+i+_0x9b2b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9b2b('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b2b('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9b2b('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9b2b('0x7')+i,'phone':0xf879fb460+i,'email':_0x9b2b('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9b2b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9b2b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9b2b('0x6')]()});}db[_0x9b2b('0x8')][_0x9b2b('0x9')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x9b2b('0xa')](_0x9b2b('0xb'),_0x9b2b('0xc'));return db[_0x9b2b('0xd')][_0x9b2b('0x9')]({'where':{}});})[_0x9b2b('0xe')](function(){return db[_0x9b2b('0xd')][_0x9b2b('0xf')](hopper);})[_0x9b2b('0xe')](function(){console[_0x9b2b('0xa')]('finished\x20populating',_0x9b2b('0x10'));return db[_0x9b2b('0x8')][_0x9b2b('0xf')](contacts2);})[_0x9b2b('0xe')](function(){console['log'](_0x9b2b('0xb'),_0x9b2b('0x11'));return db[_0x9b2b('0xd')]['bulkCreate'](hopper2);})[_0x9b2b('0xe')](function(){console[_0x9b2b('0xa')]('finished\x20populating',_0x9b2b('0x12'));})[_0x9b2b('0x13')](function(_0x1db086){console[_0x9b2b('0xa')](_0x1db086);}); \ No newline at end of file +var _0xead7=['contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x325fc5,_0x5f30a3){var _0x5cc2ef=function(_0x2b4d87){while(--_0x2b4d87){_0x325fc5['push'](_0x325fc5['shift']());}};_0x5cc2ef(++_0x5f30a3);}(_0xead7,0xf3));var _0x7ead=function(_0x5752c0,_0x402768){_0x5752c0=_0x5752c0-0x0;var _0x1acee7=_0xead7[_0x5752c0];return _0x1acee7;};'use strict';var util=require(_0x7ead('0x0'));var db=require(_0x7ead('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7ead('0x2')]({'id':i,'firstName':_0x7ead('0x3')+i,'lastName':_0x7ead('0x4')+i,'phone':0xf879fb460+i,'email':_0x7ead('0x5')+i+_0x7ead('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7ead('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7ead('0x7')](),'updatedAt':Date[_0x7ead('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7ead('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7ead('0x5')+i+_0x7ead('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x7ead('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ead('0x7')]()});}db[_0x7ead('0x8')][_0x7ead('0x9')]({'where':{}})[_0x7ead('0xa')](function(){return db[_0x7ead('0x8')][_0x7ead('0xb')](contacts);})[_0x7ead('0xa')](function(){console[_0x7ead('0xc')](_0x7ead('0xd'),_0x7ead('0xe'));return db[_0x7ead('0xf')][_0x7ead('0x9')]({'where':{}});})[_0x7ead('0xa')](function(){return db[_0x7ead('0xf')][_0x7ead('0xb')](hopper);})[_0x7ead('0xa')](function(){console['log'](_0x7ead('0xd'),_0x7ead('0x10'));return db[_0x7ead('0x8')][_0x7ead('0xb')](contacts2);})[_0x7ead('0xa')](function(){console[_0x7ead('0xc')](_0x7ead('0xd'),_0x7ead('0x11'));return db[_0x7ead('0xf')][_0x7ead('0xb')](hopper2);})[_0x7ead('0xa')](function(){console['log'](_0x7ead('0xd'),_0x7ead('0x12'));})[_0x7ead('0x13')](function(_0x37f59e){console['log'](_0x37f59e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6b58488..a8698b3 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4029=['%s%s','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','catch','util','../mysqldb','push','format','agent'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0x4029,0x12b));var _0x9402=function(_0x3dbc69,_0x17d1df){_0x3dbc69=_0x3dbc69-0x0;var _0x2cf14d=_0x4029[_0x3dbc69];return _0x2cf14d;};'use strict';var util=require(_0x9402('0x0'));var db=require(_0x9402('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9402('0x2')]({'name':util[_0x9402('0x3')]('%s%s',_0x9402('0x4'),i),'fullname':util['format'](_0x9402('0x5'),_0x9402('0x4'),i),'email':util[_0x9402('0x3')](_0x9402('0x6'),_0x9402('0x4'),i),'role':_0x9402('0x4'),'password':_0x9402('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x9402('0x8')],'disallow':[_0x9402('0x9')],'allow':[_0x9402('0xa')],'defaultuser':util['format'](_0x9402('0x5'),'agent',i),'encryption':'yes','avpf':_0x9402('0xb'),'force_avp':_0x9402('0xb'),'icesupport':_0x9402('0xb'),'dtlsenable':_0x9402('0xb'),'dtlsverify':'no','dtlscertfile':_0x9402('0xc'),'dtlsprivatekey':_0x9402('0xd'),'dtlssetup':'actpass','callerid':util[_0x9402('0x3')](_0x9402('0xe'),util['format'](_0x9402('0x5'),_0x9402('0x4'),i),0xfa0+i)});}db[_0x9402('0xf')]['bulkCreate'](users)[_0x9402('0x10')](function(){console[_0x9402('0x11')]('add\x20user');})[_0x9402('0x12')](function(_0x1794af){console['log'](_0x1794af);}); \ No newline at end of file +var _0xe96d=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xe96d,0x96));var _0xde96=function(_0x172827,_0x58eb8e){_0x172827=_0x172827-0x0;var _0xfd8eb2=_0xe96d[_0x172827];return _0xfd8eb2;};'use strict';var util=require(_0xde96('0x0'));var db=require(_0xde96('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xde96('0x2')](_0xde96('0x3'),_0xde96('0x4'),i),'fullname':util[_0xde96('0x2')](_0xde96('0x3'),_0xde96('0x4'),i),'email':util[_0xde96('0x2')](_0xde96('0x5'),_0xde96('0x4'),i),'role':_0xde96('0x4'),'password':_0xde96('0x6'),'internal':0xfa0+i,'type':_0xde96('0x7'),'transport':['udp','ws',_0xde96('0x8')],'disallow':[_0xde96('0x9')],'allow':[_0xde96('0xa')],'defaultuser':util[_0xde96('0x2')](_0xde96('0x3'),_0xde96('0x4'),i),'encryption':_0xde96('0xb'),'avpf':_0xde96('0xb'),'force_avp':_0xde96('0xb'),'icesupport':'yes','dtlsenable':_0xde96('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xde96('0xc'),'dtlssetup':_0xde96('0xd'),'callerid':util[_0xde96('0x2')](_0xde96('0xe'),util[_0xde96('0x2')](_0xde96('0x3'),_0xde96('0x4'),i),0xfa0+i)});}db['User'][_0xde96('0xf')](users)[_0xde96('0x10')](function(){console['log'](_0xde96('0x11'));})[_0xde96('0x12')](function(_0x5ea305){console[_0xde96('0x13')](_0x5ea305);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 58a091f..a663883 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a08=['WhatsappQueues','findAll','Telephones','resourceId','role','Campaign','where','format','Agents','length','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueues','userProfileId','SmsQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','User','name','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4a08,0x11b));var _0x84a0=function(_0x401bd4,_0x372d33){_0x401bd4=_0x401bd4-0x0;var _0x44ecd6=_0x4a08[_0x401bd4];return _0x44ecd6;};'use strict';var _=require(_0x84a0('0x0'));var util=require('util');var BPromise=require(_0x84a0('0x1'));var db=require(_0x84a0('0x2'))['db'];var config=require(_0x84a0('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x84a0('0x4')],'attributes':['id',_0x84a0('0x5'),'role'],'raw':!![],'where':{'role':_0x84a0('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x84a0('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x84a0('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x84a0('0x8')],'where':{'type':_0x84a0('0x9')}};function getAssociatedResources(_0x3c3ff5,_0x2368dc,_0x11fdf2){return db[_0x84a0('0xa')]['findOne']({'where':{'name':_0x3c3ff5,'userProfileId':_0x2368dc},'raw':!![]})[_0x84a0('0xb')](function(_0x2940ed){if(_0x2940ed){if(_0x2940ed[_0x84a0('0xc')]){switch(_0x3c3ff5){case'VoiceQueues':case'ChatQueues':case _0x84a0('0xd'):case _0x84a0('0xe'):case _0x84a0('0xf'):case _0x84a0('0x10'):case _0x84a0('0x11'):return db[_0x11fdf2][_0x84a0('0x12')](queryQueues);case _0x84a0('0x13'):return db[_0x11fdf2][_0x84a0('0x12')](queryTelephones);case'Trunks':return db[_0x11fdf2][_0x84a0('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x11fdf2]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x84a0('0x12')]({'attributes':[_0x84a0('0x14')],'where':{'sectionId':_0x2940ed['id']},'raw':!![]})[_0x84a0('0xb')](function(_0x532119){if(_0x532119){var _0x340c44={'where':{'id':_['map'](_0x532119,_0x84a0('0x14'))},'raw':!![]};switch(_0x11fdf2){case _0x84a0('0x4'):_0x340c44['where'][_0x84a0('0x15')]=_0x84a0('0x7');break;case _0x84a0('0x16'):_0x340c44[_0x84a0('0x17')]['type']=_0x84a0('0x9');break;}return db[_0x11fdf2][_0x84a0('0x12')](_0x340c44);}else{return[];}});}}else{return[];}})[_0x84a0('0xb')](function(_0xd87f9c){return _0xd87f9c;});}function joinOrLeaveQueues(_0x4cc249,_0x236b96,_0x1dd0d8,_0x4db19d){_0x4cc249[_0x236b96](util[_0x84a0('0x18')]('%s:queue:%s',_0x1dd0d8,_0x4db19d['name']));if(_0x4db19d['Agents']){for(var _0x3baba6=0x0;_0x3baba6<_0x4db19d[_0x84a0('0x19')][_0x84a0('0x1a')];_0x3baba6+=0x1){_0x4cc249[_0x236b96](util[_0x84a0('0x18')]('user:%s',_0x4db19d[_0x84a0('0x19')][_0x3baba6][_0x84a0('0x5')]));}}}function joinOrLeave(_0x19e52b,_0x533220,_0x2e630e){var _0x15b030;if(_0x19e52b[_0x84a0('0x1b')][_0x84a0('0x1c')]['id']){db[_0x84a0('0x4')][_0x84a0('0x1d')]({'attributes':['id',_0x84a0('0x5'),_0x84a0('0x15'),'userProfileId'],'where':{'id':_0x19e52b[_0x84a0('0x1b')][_0x84a0('0x1c')]['id']},'include':[{'model':db[_0x84a0('0x1e')],'as':_0x84a0('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x84a0('0x20')],'as':_0x84a0('0x21'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x84a0('0x22'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x84a0('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x84a0('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x84a0('0x25')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x84a0('0xb')](function(_0x2f0ec6){if(_0x2f0ec6){_0x15b030=_0x2f0ec6;_0x19e52b[_0x533220](util[_0x84a0('0x18')](_0x84a0('0x26'),_0x2f0ec6[_0x84a0('0x5')]));var _0x20d493=[];switch(_0x2f0ec6[_0x84a0('0x15')]){case _0x84a0('0x27'):_0x19e52b[_0x533220](_0x84a0('0x28'));_0x19e52b[_0x533220]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x84a0('0x29'))){delete queryQueues[_0x84a0('0x29')];}_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x2b')][_0x84a0('0x12')](queryQueues));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x2c')][_0x84a0('0x12')](queryQueues));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x2d')]['findAll'](queryQueues));_0x20d493[_0x84a0('0x2a')](db['SmsQueue'][_0x84a0('0x12')](queryQueues));_0x20d493[_0x84a0('0x2a')](db['MailQueue'][_0x84a0('0x12')](queryQueues));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x2e')][_0x84a0('0x12')](queryQueues));_0x20d493['push'](db[_0x84a0('0x2f')][_0x84a0('0x12')](queryQueues));_0x20d493['push'](db['User']['findAll'](queryTelephones));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x30')][_0x84a0('0x12')](queryTrunks));_0x20d493['push'](db[_0x84a0('0x16')][_0x84a0('0x12')](queryCampaigns));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x4')][_0x84a0('0x12')](queryAgents));break;case _0x84a0('0x31'):_0x19e52b[_0x533220](_0x84a0('0x28'));_0x19e52b[_0x533220](_0x84a0('0x32'));_0x20d493[_0x84a0('0x2a')](getAssociatedResources(_0x84a0('0x33'),_0x2f0ec6['userProfileId'],_0x84a0('0x2b')));_0x20d493['push'](getAssociatedResources('ChatQueues',_0x2f0ec6[_0x84a0('0x34')],_0x84a0('0x2c')));_0x20d493[_0x84a0('0x2a')](getAssociatedResources('FaxQueues',_0x2f0ec6[_0x84a0('0x34')],'FaxQueue'));_0x20d493[_0x84a0('0x2a')](getAssociatedResources(_0x84a0('0xe'),_0x2f0ec6[_0x84a0('0x34')],_0x84a0('0x35')));_0x20d493['push'](getAssociatedResources(_0x84a0('0xf'),_0x2f0ec6['userProfileId'],'MailQueue'));_0x20d493[_0x84a0('0x2a')](getAssociatedResources(_0x84a0('0x10'),_0x2f0ec6[_0x84a0('0x34')],'OpenchannelQueue'));_0x20d493[_0x84a0('0x2a')](getAssociatedResources(_0x84a0('0x11'),_0x2f0ec6['userProfileId'],'WhatsappQueue'));_0x20d493['push'](getAssociatedResources(_0x84a0('0x13'),_0x2f0ec6['userProfileId'],_0x84a0('0x4')));_0x20d493[_0x84a0('0x2a')](getAssociatedResources('Trunks',_0x2f0ec6[_0x84a0('0x34')],'Trunk'));_0x20d493['push'](getAssociatedResources('IvrCampaigns',_0x2f0ec6['userProfileId'],_0x84a0('0x16')));_0x20d493[_0x84a0('0x2a')](db[_0x84a0('0x4')]['findAll'](queryAgents));break;case _0x84a0('0x6'):_0x19e52b[_0x533220](_0x84a0('0x28'));_0x19e52b[_0x533220](_0x84a0('0x32'));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x36')]({'attributes':['id',_0x84a0('0x5')]}));_0x20d493['push'](_0x2f0ec6[_0x84a0('0x37')]({'attributes':['id',_0x84a0('0x5')]}));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x38')]({'attributes':['id',_0x84a0('0x5')]}));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x39')]({'attributes':['id','name']}));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x3a')]({'attributes':['id','name']}));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x3b')]({'attributes':['id','name']}));_0x20d493[_0x84a0('0x2a')](_0x2f0ec6[_0x84a0('0x3c')]({'attributes':['id',_0x84a0('0x5')]}));break;}return BPromise[_0x84a0('0x3d')](_0x20d493);}})[_0x84a0('0xb')](function(_0x5022b8){if(_0x5022b8&&_0x5022b8[_0x84a0('0x1a')]){for(var _0x4a403c=0x0;_0x4a403c<_0x5022b8[_0x84a0('0x1a')];_0x4a403c+=0x1){for(var _0x5bccd9=0x0;_0x5bccd9<_0x5022b8[_0x4a403c][_0x84a0('0x1a')];_0x5bccd9+=0x1){switch(_0x4a403c){case 0x0:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x3e'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x1:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x3f'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x2:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x40'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x3:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x41'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x4:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x42'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x5:joinOrLeaveQueues(_0x19e52b,_0x533220,_0x84a0('0x43'),_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x6:joinOrLeaveQueues(_0x19e52b,_0x533220,'whatsapp',_0x5022b8[_0x4a403c][_0x5bccd9]);break;case 0x7:if(_0x15b030['role']!==_0x84a0('0x6'))_0x19e52b[_0x533220](util['format'](_0x84a0('0x44'),_0x5022b8[_0x4a403c][_0x5bccd9][_0x84a0('0x5')]));break;case 0x8:if(_0x15b030[_0x84a0('0x15')]!==_0x84a0('0x6'))_0x19e52b[_0x533220](util[_0x84a0('0x18')](_0x84a0('0x45'),_0x5022b8[_0x4a403c][_0x5bccd9]['name']));break;case 0x9:if(_0x15b030['role']!==_0x84a0('0x6'))_0x19e52b[_0x533220](util['format'](_0x84a0('0x46'),_0x5022b8[_0x4a403c][_0x5bccd9][_0x84a0('0x8')],_0x5022b8[_0x4a403c][_0x5bccd9]['name']));break;case 0xa:_0x19e52b[_0x533220](util[_0x84a0('0x18')](_0x84a0('0x26'),_0x5022b8[_0x4a403c][_0x5bccd9][_0x84a0('0x5')]));break;}}}}})[_0x84a0('0xb')](function(){if(_0x533220===_0x84a0('0x47')){var _0x2811be=_[_0x84a0('0x48')](_0x15b030['ChatInteractions'],'id');return _0x15b030[_0x84a0('0x49')](_0x2811be)[_0x84a0('0xb')](function(){for(var _0x256761=0x0;_0x256761<_0x2811be['length'];_0x256761+=0x1){_0x2e630e[_0x84a0('0x4a')](_0x84a0('0x4b'),{'ChatInteractionId':Number(_0x2811be[_0x256761]),'UserId':Number(_0x15b030['id'])});}});}})['then'](function(){if(_0x533220===_0x84a0('0x47')){var _0x1d731d=_['map'](_0x15b030[_0x84a0('0x21')],'id');return _0x15b030[_0x84a0('0x4c')](_0x1d731d)[_0x84a0('0xb')](function(){for(var _0x51ee86=0x0;_0x51ee86<_0x1d731d['length'];_0x51ee86+=0x1){_0x2e630e[_0x84a0('0x4a')](_0x84a0('0x4d'),{'MailInteractionId':Number(_0x1d731d[_0x51ee86]),'UserId':Number(_0x15b030['id'])});}});}})[_0x84a0('0xb')](function(){if(_0x533220===_0x84a0('0x47')){var _0x14d177=_[_0x84a0('0x48')](_0x15b030['FaxInteractions'],'id');return _0x15b030[_0x84a0('0x4e')](_0x14d177)[_0x84a0('0xb')](function(){for(var _0x45555d=0x0;_0x45555d<_0x14d177[_0x84a0('0x1a')];_0x45555d+=0x1){_0x2e630e[_0x84a0('0x4a')](_0x84a0('0x4f'),{'FaxInteractionId':Number(_0x14d177[_0x45555d]),'UserId':Number(_0x15b030['id'])});}});}})[_0x84a0('0xb')](function(){if(_0x533220===_0x84a0('0x47')){var _0x63121a=_[_0x84a0('0x48')](_0x15b030[_0x84a0('0x23')],'id');return _0x15b030['removeSmsInteractions'](_0x63121a)[_0x84a0('0xb')](function(){for(var _0x412263=0x0;_0x412263<_0x63121a[_0x84a0('0x1a')];_0x412263+=0x1){_0x2e630e['emit'](_0x84a0('0x50'),{'SmsInteractionId':Number(_0x63121a[_0x412263]),'UserId':Number(_0x15b030['id'])});}});}})[_0x84a0('0xb')](function(){if(_0x533220===_0x84a0('0x47')){var _0x38f3a9=_['map'](_0x15b030[_0x84a0('0x51')],'id');return _0x15b030[_0x84a0('0x52')](_0x38f3a9)['then'](function(){for(var _0xb801e9=0x0;_0xb801e9<_0x38f3a9[_0x84a0('0x1a')];_0xb801e9+=0x1){_0x2e630e[_0x84a0('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x38f3a9[_0xb801e9]),'UserId':Number(_0x15b030['id'])});}});}})[_0x84a0('0xb')](function(){if(_0x533220===_0x84a0('0x47')){var _0x295cd8=_[_0x84a0('0x48')](_0x15b030[_0x84a0('0x53')],'id');return _0x15b030['removeWhatsappInteractions'](_0x295cd8)[_0x84a0('0xb')](function(){for(var _0x174b6e=0x0;_0x174b6e<_0x295cd8[_0x84a0('0x1a')];_0x174b6e+=0x1){_0x2e630e[_0x84a0('0x4a')](_0x84a0('0x54'),{'WhatsappInteractionId':Number(_0x295cd8[_0x174b6e]),'UserId':Number(_0x15b030['id'])});}});}})[_0x84a0('0x55')](function(_0x103e2b){_0x19e52b[_0x84a0('0x56')](_0x103e2b);});}}function onDisconnect(_0x1197ef,_0x1f560b){joinOrLeave(_0x1197ef,'leave',_0x1f560b);}function onConnect(_0x460047){joinOrLeave(_0x460047,_0x84a0('0x57'));}exports[_0x84a0('0x58')]=function(_0x194f62){_0x194f62['on'](_0x84a0('0x59'),function(_0x2390f9){_0x2390f9[_0x84a0('0x5a')](0x0);_0x2390f9['address']=_0x2390f9[_0x84a0('0x5b')][_0x84a0('0x59')][_0x84a0('0x5c')]+':'+_0x2390f9['request'][_0x84a0('0x59')][_0x84a0('0x5d')];_0x2390f9[_0x84a0('0x5e')]=new Date();_0x2390f9[_0x84a0('0x56')]=function(_0x3d5a75){console['log'](_0x84a0('0x5f')+_0x2390f9[_0x84a0('0x60')][_0x84a0('0x5')]+'['+_0x2390f9[_0x84a0('0x61')]+']',_0x3d5a75);};_0x2390f9['on'](_0x84a0('0x62'),function(){onDisconnect(_0x2390f9,_0x194f62);_0x2390f9[_0x84a0('0x56')]('DISCONNECTED');});onConnect(_0x2390f9);_0x2390f9[_0x84a0('0x56')](_0x84a0('0x63'));});}; \ No newline at end of file +var _0xf4c9=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','findAll','Trunks','resourceId','map','where','Campaign','%s:queue:%s','format','user:%s','handshake','query','find','role','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','include','VoiceQueue','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','userProfileId','ChatQueue','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','voice:inbound','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','fax','mail','whatsapp','trunk:%s','campaign:%s:%s','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions'];(function(_0x2de97e,_0xa0a8db){var _0x5412c1=function(_0xd3c52b){while(--_0xd3c52b){_0x2de97e['push'](_0x2de97e['shift']());}};_0x5412c1(++_0xa0a8db);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf4c9[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var BPromise=require(_0x9f4c('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x9f4c('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x9f4c('0x4'),'model':db[_0x9f4c('0x5')],'attributes':['id',_0x9f4c('0x6'),'role'],'raw':!![],'where':{'role':_0x9f4c('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x9f4c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9f4c('0x6'),_0x9f4c('0x9')],'where':{'type':_0x9f4c('0xa')}};function getAssociatedResources(_0x3ea263,_0x25b07c,_0x37b693){return db['UserProfileSection'][_0x9f4c('0xb')]({'where':{'name':_0x3ea263,'userProfileId':_0x25b07c},'raw':!![]})[_0x9f4c('0xc')](function(_0x20c329){if(_0x20c329){if(_0x20c329[_0x9f4c('0xd')]){switch(_0x3ea263){case _0x9f4c('0xe'):case _0x9f4c('0xf'):case _0x9f4c('0x10'):case _0x9f4c('0x11'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x37b693][_0x9f4c('0x12')](queryQueues);case'Telephones':return db[_0x37b693]['findAll'](queryTelephones);case _0x9f4c('0x13'):return db[_0x37b693]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x37b693][_0x9f4c('0x12')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x9f4c('0x14')],'where':{'sectionId':_0x20c329['id']},'raw':!![]})['then'](function(_0x25f8ed){if(_0x25f8ed){var _0x336fc2={'where':{'id':_[_0x9f4c('0x15')](_0x25f8ed,_0x9f4c('0x14'))},'raw':!![]};switch(_0x37b693){case _0x9f4c('0x5'):_0x336fc2[_0x9f4c('0x16')]['role']=_0x9f4c('0x8');break;case _0x9f4c('0x17'):_0x336fc2[_0x9f4c('0x16')][_0x9f4c('0x9')]=_0x9f4c('0xa');break;}return db[_0x37b693]['findAll'](_0x336fc2);}else{return[];}});}}else{return[];}})[_0x9f4c('0xc')](function(_0x158493){return _0x158493;});}function joinOrLeaveQueues(_0x8efbfe,_0x5d9587,_0x4a33c7,_0x502a33){_0x8efbfe[_0x5d9587](util['format'](_0x9f4c('0x18'),_0x4a33c7,_0x502a33['name']));if(_0x502a33['Agents']){for(var _0x603a8d=0x0;_0x603a8d<_0x502a33[_0x9f4c('0x4')]['length'];_0x603a8d+=0x1){_0x8efbfe[_0x5d9587](util[_0x9f4c('0x19')](_0x9f4c('0x1a'),_0x502a33['Agents'][_0x603a8d][_0x9f4c('0x6')]));}}}function joinOrLeave(_0x5abb5d,_0x5e6632,_0x36e15f){var _0x49d6d6;if(_0x5abb5d[_0x9f4c('0x1b')][_0x9f4c('0x1c')]['id']){db[_0x9f4c('0x5')][_0x9f4c('0x1d')]({'attributes':['id',_0x9f4c('0x6'),_0x9f4c('0x1e'),'userProfileId'],'where':{'id':_0x5abb5d[_0x9f4c('0x1b')][_0x9f4c('0x1c')]['id']},'include':[{'model':db[_0x9f4c('0x1f')],'as':_0x9f4c('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f4c('0x21')],'as':_0x9f4c('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f4c('0x23')],'as':_0x9f4c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f4c('0x25')],'as':_0x9f4c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f4c('0x27')],'as':_0x9f4c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f4c('0x29')],'as':_0x9f4c('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x9f4c('0xc')](function(_0x246599){if(_0x246599){_0x49d6d6=_0x246599;_0x5abb5d[_0x5e6632](util[_0x9f4c('0x19')](_0x9f4c('0x1a'),_0x246599[_0x9f4c('0x6')]));var _0x2400d9=[];switch(_0x246599[_0x9f4c('0x1e')]){case _0x9f4c('0x2b'):_0x5abb5d[_0x5e6632]('voice:inbound');_0x5abb5d[_0x5e6632]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x9f4c('0x2c'))){delete queryQueues[_0x9f4c('0x2c')];}_0x2400d9['push'](db[_0x9f4c('0x2d')][_0x9f4c('0x12')](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db['ChatQueue']['findAll'](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x2f')]['findAll'](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x30')][_0x9f4c('0x12')](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x31')][_0x9f4c('0x12')](queryQueues));_0x2400d9['push'](db[_0x9f4c('0x32')][_0x9f4c('0x12')](queryQueues));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x5')][_0x9f4c('0x12')](queryTelephones));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x33')][_0x9f4c('0x12')](queryTrunks));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x17')][_0x9f4c('0x12')](queryCampaigns));_0x2400d9[_0x9f4c('0x2e')](db[_0x9f4c('0x5')]['findAll'](queryAgents));break;case _0x9f4c('0x34'):_0x5abb5d[_0x5e6632]('voice:inbound');_0x5abb5d[_0x5e6632](_0x9f4c('0x35'));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0xe'),_0x246599[_0x9f4c('0x36')],_0x9f4c('0x2d')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0xf'),_0x246599[_0x9f4c('0x36')],_0x9f4c('0x37')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x10'),_0x246599[_0x9f4c('0x36')],'FaxQueue'));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x11'),_0x246599[_0x9f4c('0x36')],'SmsQueue'));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x38'),_0x246599[_0x9f4c('0x36')],'MailQueue'));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x39'),_0x246599[_0x9f4c('0x36')],_0x9f4c('0x31')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x3a'),_0x246599[_0x9f4c('0x36')],_0x9f4c('0x32')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources(_0x9f4c('0x3b'),_0x246599['userProfileId'],_0x9f4c('0x5')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources('Trunks',_0x246599[_0x9f4c('0x36')],_0x9f4c('0x33')));_0x2400d9[_0x9f4c('0x2e')](getAssociatedResources('IvrCampaigns',_0x246599[_0x9f4c('0x36')],'Campaign'));_0x2400d9[_0x9f4c('0x2e')](db['User'][_0x9f4c('0x12')](queryAgents));break;case _0x9f4c('0x7'):_0x5abb5d[_0x5e6632](_0x9f4c('0x3c'));_0x5abb5d[_0x5e6632](_0x9f4c('0x35'));_0x2400d9[_0x9f4c('0x2e')](_0x246599['getVoiceQueues']({'attributes':['id','name']}));_0x2400d9[_0x9f4c('0x2e')](_0x246599[_0x9f4c('0x3d')]({'attributes':['id',_0x9f4c('0x6')]}));_0x2400d9['push'](_0x246599[_0x9f4c('0x3e')]({'attributes':['id','name']}));_0x2400d9['push'](_0x246599[_0x9f4c('0x3f')]({'attributes':['id','name']}));_0x2400d9[_0x9f4c('0x2e')](_0x246599[_0x9f4c('0x40')]({'attributes':['id',_0x9f4c('0x6')]}));_0x2400d9['push'](_0x246599[_0x9f4c('0x41')]({'attributes':['id','name']}));_0x2400d9[_0x9f4c('0x2e')](_0x246599[_0x9f4c('0x42')]({'attributes':['id',_0x9f4c('0x6')]}));break;}return BPromise[_0x9f4c('0x43')](_0x2400d9);}})['then'](function(_0x1da84e){if(_0x1da84e&&_0x1da84e['length']){for(var _0x448cb3=0x0;_0x448cb3<_0x1da84e['length'];_0x448cb3+=0x1){for(var _0x3eec45=0x0;_0x3eec45<_0x1da84e[_0x448cb3][_0x9f4c('0x44')];_0x3eec45+=0x1){switch(_0x448cb3){case 0x0:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,'voice',_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x1:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,_0x9f4c('0x45'),_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x2:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,_0x9f4c('0x46'),_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x3:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,'sms',_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x4:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,_0x9f4c('0x47'),_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x5:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,'openchannel',_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x6:joinOrLeaveQueues(_0x5abb5d,_0x5e6632,_0x9f4c('0x48'),_0x1da84e[_0x448cb3][_0x3eec45]);break;case 0x7:if(_0x49d6d6[_0x9f4c('0x1e')]!=='agent')_0x5abb5d[_0x5e6632](util['format']('telephone:%s',_0x1da84e[_0x448cb3][_0x3eec45][_0x9f4c('0x6')]));break;case 0x8:if(_0x49d6d6[_0x9f4c('0x1e')]!=='agent')_0x5abb5d[_0x5e6632](util[_0x9f4c('0x19')](_0x9f4c('0x49'),_0x1da84e[_0x448cb3][_0x3eec45][_0x9f4c('0x6')]));break;case 0x9:if(_0x49d6d6['role']!==_0x9f4c('0x7'))_0x5abb5d[_0x5e6632](util['format'](_0x9f4c('0x4a'),_0x1da84e[_0x448cb3][_0x3eec45][_0x9f4c('0x9')],_0x1da84e[_0x448cb3][_0x3eec45]['name']));break;case 0xa:_0x5abb5d[_0x5e6632](util['format'](_0x9f4c('0x1a'),_0x1da84e[_0x448cb3][_0x3eec45][_0x9f4c('0x6')]));break;}}}}})['then'](function(){if(_0x5e6632===_0x9f4c('0x4b')){var _0x885938=_[_0x9f4c('0x15')](_0x49d6d6['ChatInteractions'],'id');return _0x49d6d6['removeChatInteractions'](_0x885938)[_0x9f4c('0xc')](function(){for(var _0x27eef4=0x0;_0x27eef4<_0x885938[_0x9f4c('0x44')];_0x27eef4+=0x1){_0x36e15f[_0x9f4c('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x885938[_0x27eef4]),'UserId':Number(_0x49d6d6['id'])});}});}})[_0x9f4c('0xc')](function(){if(_0x5e6632===_0x9f4c('0x4b')){var _0x16c41a=_[_0x9f4c('0x15')](_0x49d6d6[_0x9f4c('0x22')],'id');return _0x49d6d6[_0x9f4c('0x4d')](_0x16c41a)[_0x9f4c('0xc')](function(){for(var _0x1e88b0=0x0;_0x1e88b0<_0x16c41a[_0x9f4c('0x44')];_0x1e88b0+=0x1){_0x36e15f[_0x9f4c('0x4c')](_0x9f4c('0x4e'),{'MailInteractionId':Number(_0x16c41a[_0x1e88b0]),'UserId':Number(_0x49d6d6['id'])});}});}})['then'](function(){if(_0x5e6632===_0x9f4c('0x4b')){var _0x1f3f31=_[_0x9f4c('0x15')](_0x49d6d6[_0x9f4c('0x24')],'id');return _0x49d6d6[_0x9f4c('0x4f')](_0x1f3f31)['then'](function(){for(var _0x5c6ca7=0x0;_0x5c6ca7<_0x1f3f31[_0x9f4c('0x44')];_0x5c6ca7+=0x1){_0x36e15f['emit'](_0x9f4c('0x50'),{'FaxInteractionId':Number(_0x1f3f31[_0x5c6ca7]),'UserId':Number(_0x49d6d6['id'])});}});}})['then'](function(){if(_0x5e6632===_0x9f4c('0x4b')){var _0x9ce6c0=_[_0x9f4c('0x15')](_0x49d6d6[_0x9f4c('0x26')],'id');return _0x49d6d6[_0x9f4c('0x51')](_0x9ce6c0)[_0x9f4c('0xc')](function(){for(var _0x559c65=0x0;_0x559c65<_0x9ce6c0[_0x9f4c('0x44')];_0x559c65+=0x1){_0x36e15f[_0x9f4c('0x4c')](_0x9f4c('0x52'),{'SmsInteractionId':Number(_0x9ce6c0[_0x559c65]),'UserId':Number(_0x49d6d6['id'])});}});}})[_0x9f4c('0xc')](function(){if(_0x5e6632===_0x9f4c('0x4b')){var _0x584744=_[_0x9f4c('0x15')](_0x49d6d6[_0x9f4c('0x28')],'id');return _0x49d6d6[_0x9f4c('0x53')](_0x584744)[_0x9f4c('0xc')](function(){for(var _0x13c74b=0x0;_0x13c74b<_0x584744[_0x9f4c('0x44')];_0x13c74b+=0x1){_0x36e15f[_0x9f4c('0x4c')](_0x9f4c('0x54'),{'OpenchannelInteractionId':Number(_0x584744[_0x13c74b]),'UserId':Number(_0x49d6d6['id'])});}});}})[_0x9f4c('0xc')](function(){if(_0x5e6632==='leave'){var _0x173d28=_[_0x9f4c('0x15')](_0x49d6d6[_0x9f4c('0x2a')],'id');return _0x49d6d6[_0x9f4c('0x55')](_0x173d28)[_0x9f4c('0xc')](function(){for(var _0x1a8349=0x0;_0x1a8349<_0x173d28['length'];_0x1a8349+=0x1){_0x36e15f[_0x9f4c('0x4c')](_0x9f4c('0x56'),{'WhatsappInteractionId':Number(_0x173d28[_0x1a8349]),'UserId':Number(_0x49d6d6['id'])});}});}})[_0x9f4c('0x57')](function(_0x8b20cf){_0x5abb5d[_0x9f4c('0x58')](_0x8b20cf);});}}function onDisconnect(_0xa3daa8,_0x4a488f){joinOrLeave(_0xa3daa8,'leave',_0x4a488f);}function onConnect(_0x484151){joinOrLeave(_0x484151,_0x9f4c('0x59'));}exports[_0x9f4c('0x5a')]=function(_0x2135ef){_0x2135ef['on']('connection',function(_0x10fad7){_0x10fad7[_0x9f4c('0x5b')](0x0);_0x10fad7[_0x9f4c('0x5c')]=_0x10fad7[_0x9f4c('0x5d')][_0x9f4c('0x5e')][_0x9f4c('0x5f')]+':'+_0x10fad7[_0x9f4c('0x5d')][_0x9f4c('0x5e')][_0x9f4c('0x60')];_0x10fad7[_0x9f4c('0x61')]=new Date();_0x10fad7['log']=function(_0x296b29){console[_0x9f4c('0x58')](_0x9f4c('0x62')+_0x10fad7[_0x9f4c('0x63')]['name']+'['+_0x10fad7['address']+']',_0x296b29);};_0x10fad7['on']('disconnect',function(){onDisconnect(_0x10fad7,_0x2135ef);_0x10fad7[_0x9f4c('0x58')](_0x9f4c('0x64'));});onConnect(_0x10fad7);_0x10fad7['log'](_0x9f4c('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8037df9..0c3db78 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 _0x579b=['ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','sequelize','query','Sequelize','SELECT','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','format','changed','closed','substatus','User','fullname','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','../../mysqldb','../logger','triggers','client','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction'];(function(_0x1c55b3,_0x368234){var _0x500497=function(_0x53b55e){while(--_0x53b55e){_0x1c55b3['push'](_0x1c55b3['shift']());}};_0x500497(++_0x368234);}(_0x579b,0x8a));var _0xb579=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x579b[_0x1ca29f];return _0x576c3b;};'use strict';var util=require('util');var db=require(_0xb579('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0xb579('0x1'))(_0xb579('0x2'));var client=jayson[_0xb579('0x3')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xb579('0x4'),'event':_0xb579('0x5'),'condition':_0xb579('0x6'),'callback':afterCreate},{'channel':_0xb579('0x7'),'model':'ChatInteraction','event':_0xb579('0x8'),'condition':_0xb579('0x9'),'callback':afterUpdate},{'channel':_0xb579('0x7'),'model':_0xb579('0xa'),'event':_0xb579('0x5'),'condition':_0xb579('0xb'),'callback':afterCreateMessage},{'channel':_0xb579('0x7'),'model':_0xb579('0xc'),'event':_0xb579('0x5'),'condition':_0xb579('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xb579('0xd'),'model':_0xb579('0xe'),'event':_0xb579('0x5'),'condition':_0xb579('0x6'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0xb579('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb579('0xd'),'model':_0xb579('0xf'),'event':'afterCreate','condition':_0xb579('0xb'),'callback':afterCreateMessage},{'channel':_0xb579('0x10'),'model':_0xb579('0x11'),'event':_0xb579('0x5'),'condition':_0xb579('0x6'),'callback':afterCreate},{'channel':_0xb579('0x10'),'model':_0xb579('0x11'),'event':_0xb579('0x8'),'condition':_0xb579('0x9'),'callback':afterUpdate},{'channel':_0xb579('0x10'),'model':_0xb579('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb579('0x13'),'model':_0xb579('0x14'),'event':_0xb579('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xb579('0x8'),'condition':_0xb579('0x9'),'callback':afterUpdate},{'channel':_0xb579('0x13'),'model':_0xb579('0x15'),'event':_0xb579('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0xb579('0x5'),'condition':_0xb579('0x6'),'callback':afterCreate},{'channel':_0xb579('0x16'),'model':'MailInteraction','event':_0xb579('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb579('0x16'),'model':_0xb579('0x17'),'event':_0xb579('0x5'),'condition':_0xb579('0xb'),'callback':afterCreateMessage},{'channel':_0xb579('0x18'),'model':_0xb579('0x19'),'event':'afterCreate','condition':_0xb579('0x6'),'callback':afterCreate},{'channel':_0xb579('0x18'),'model':_0xb579('0x19'),'event':'afterUpdate','condition':_0xb579('0x9'),'callback':afterUpdate},{'channel':_0xb579('0x18'),'model':_0xb579('0x1a'),'event':_0xb579('0x5'),'condition':_0xb579('0xb'),'callback':afterCreateMessage}];function request(_0x32402a){return client[_0xb579('0x1b')](_0xb579('0x1c'),_0x32402a)[_0xb579('0x1d')](function(_0x4944b3){logger[_0xb579('0x1e')](_0xb579('0x1f'),_0xb579('0x1c'),_0x4944b3);if(_0x4944b3[_0xb579('0x20')]){if(_0x4944b3[_0xb579('0x20')][_0xb579('0x21')]===0x1f4){logger[_0xb579('0x20')](_0xb579('0x1f'),_0xb579('0x1c'),_0x4944b3['error']);}}})[_0xb579('0x22')](function(_0x50d099){logger[_0xb579('0x20')](_0xb579('0x1f'),_0xb579('0x1c'),_0x50d099);});}function afterCreateMessage(_0x5049b0){return function(_0x38a1a7){_0x38a1a7=_0x38a1a7[_0xb579('0x23')]({'plain':!![]});_0x38a1a7[_0xb579('0x24')]=_0x5049b0;_0x38a1a7[_0xb579('0x25')]=_0x5049b0;_0x38a1a7[_0xb579('0x26')]=_0x38a1a7[_0xb579('0x27')];Promise[_0xb579('0x28')]()[_0xb579('0x1d')](function(){if(typeof _0x38a1a7[_0xb579('0x29')]===_0xb579('0x2a'))return null;var _0x24ff3e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x38a1a7[_0xb579('0x29')];return db[_0xb579('0x2b')][_0xb579('0x2c')](_0x24ff3e,{'type':db[_0xb579('0x2d')]['QueryTypes'][_0xb579('0x2e')],'raw':!![]});})[_0xb579('0x1d')](function(_0x343026){if(_0x343026){_0x38a1a7[_0xb579('0x2f')]=_0x343026[0x0];}if(typeof _0x38a1a7[_0xb579('0x30')]==='undefined')return;return getAgent(_0x38a1a7[_0xb579('0x30')]);})['then'](function(_0xc33e78){if(_0xc33e78){_0x38a1a7[_0xb579('0x31')]=util['format'](_0xb579('0x32'),_0xc33e78[_0xb579('0x33')]);_0x38a1a7[_0xb579('0x34')]=_0xc33e78;_0x38a1a7[_0xb579('0x24')]=_0x5049b0;return request({'event':_0xb579('0x35'),'message':_0x38a1a7});}else{return request({'event':'outgoingmessage','message':_0x38a1a7});}})[_0xb579('0x22')](function(_0x5593ec){logger[_0xb579('0x20')](_0xb579('0x1f'),_0xb579('0x36'),_0x5593ec);});};}function afterCreateOfflineMessage(_0xea1733){return function(_0x3ac529){_0x3ac529=_0x3ac529['get']({'plain':!![]});_0x3ac529[_0xb579('0x24')]=_0xea1733;_0x3ac529[_0xb579('0x25')]=_0xea1733;_0x3ac529['event']=_0xb579('0x37');return request({'event':_0x3ac529[_0xb579('0x26')],'message':_0x3ac529});};}function afterCreate(_0x34e883,_0x8777a7){return function(_0x26582d){_0x26582d=_0x26582d[_0xb579('0x23')]({'plain':!![]});_0x26582d[_0xb579('0x24')]=_0x34e883;_0x26582d[_0xb579('0x25')]=_0x34e883;_0x26582d[_0xb579('0x26')]=_0xb579('0x38');Promise['resolve']()[_0xb579('0x1d')](function(){var _0x585498=_0xb579('0x39')+_0x26582d[_0xb579('0x29')];return db['sequelize'][_0xb579('0x2c')](_0x585498,{'type':db[_0xb579('0x2d')][_0xb579('0x3a')][_0xb579('0x2e')],'raw':!![]});})[_0xb579('0x1d')](function(_0x8b0b53){if(_0x8b0b53){_0x26582d[_0xb579('0x2f')]=_0x8b0b53[0x0];}if(typeof _0x26582d[_0xb579('0x30')]===_0xb579('0x2a'))return;return getAgent(_0x26582d[_0xb579('0x30')]);})['then'](function(_0x5b918d){if(_0x5b918d){_0x26582d[_0xb579('0x31')]=util[_0xb579('0x3b')](_0xb579('0x32'),_0x5b918d['name']);_0x26582d[_0xb579('0x34')]=_0x5b918d;}return request({'event':_0x8777a7,'message':_0x26582d});})[_0xb579('0x22')](function(_0x520811){logger[_0xb579('0x20')](_0xb579('0x1f'),'AfterCreate',_0x520811);});};}function afterUpdate(_0x252517){return function(_0x2d14ed){var _0x49d7be=_0x2d14ed[_0xb579('0x3c')](_0xb579('0x3d'))&&_0x2d14ed['closed'];var _0x5100b4=_0x2d14ed[_0xb579('0x3c')]('substatus');if(_0x49d7be||_0x5100b4){var _0x3b9008=_0x49d7be?_0xb579('0x9'):_0xb579('0x3e');var _0xe6eeb1=_0x2d14ed[_0xb579('0x23')]({'plain':!![]});_0xe6eeb1[_0xb579('0x24')]=_0x252517;_0xe6eeb1[_0xb579('0x25')]=_0x252517;_0xe6eeb1[_0xb579('0x26')]=_0x49d7be?'closed':_0xb579('0x3e');var _0x3fe7ec='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xe6eeb1[_0xb579('0x29')];return db[_0xb579('0x2b')][_0xb579('0x2c')](_0x3fe7ec,{'type':db[_0xb579('0x2d')][_0xb579('0x3a')][_0xb579('0x2e')],'raw':!![]})[_0xb579('0x1d')](function(_0x3861df){if(_0x3861df){_0xe6eeb1['contact']=_0x3861df[0x0];}if(typeof _0xe6eeb1[_0xb579('0x30')]===_0xb579('0x2a'))return;return getAgent(_0xe6eeb1[_0xb579('0x30')]);})['then'](function(_0xff1828){if(_0xff1828){_0xe6eeb1['interface']=util[_0xb579('0x3b')](_0xb579('0x32'),_0xff1828[_0xb579('0x33')]);_0xe6eeb1[_0xb579('0x34')]=_0xff1828;}return request({'event':_0x3b9008,'message':_0xe6eeb1});})[_0xb579('0x22')](function(_0x3e633e){logger['error'](_0xb579('0x1f'),'AfterUpdate',_0x3e633e);});}};}function getAgent(_0xf3c675){return db[_0xb579('0x3f')]['find']({'where':{'id':_0xf3c675},'attributes':['id',_0xb579('0x33'),_0xb579('0x40'),'email',_0xb579('0x41')],'raw':!![]})['then'](function(_0x5bb11d){return _0x5bb11d;});}exports[_0xb579('0x42')]=function(){for(var _0x2a116f=0x0;_0x2a116f=_0x177067[_0x8858('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1baca9(_0x771e9a);})['catch'](function(_0x1c3dfe){_0x4cc929(_0x1c3dfe);});});}; \ No newline at end of file +var _0xaadb=['clearBlockUser','blockedAt','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes'];(function(_0xb14408,_0x114ae3){var _0x7f17d7=function(_0x58d4ae){while(--_0x58d4ae){_0xb14408['push'](_0xb14408['shift']());}};_0x7f17d7(++_0x114ae3);}(_0xaadb,0xe7));var _0xbaad=function(_0xec83d9,_0xeccc19){_0xec83d9=_0xec83d9-0x0;var _0x1f05f5=_0xaadb[_0xec83d9];return _0x1f05f5;};'use strict';var _=require(_0xbaad('0x0'));var BPromise=require('bluebird');var db=require(_0xbaad('0x1'))['db'];var util=require(_0xbaad('0x2'));var channels=['voice',_0xbaad('0x3'),_0xbaad('0x4'),_0xbaad('0x5'),_0xbaad('0x6'),_0xbaad('0x7'),_0xbaad('0x8')];exports['getChannels']=function(){return channels;};exports[_0xbaad('0x9')]=function(_0x4a4948){_0x4a4948=_0x4a4948['toLowerCase']();return _[_0xbaad('0xa')](channels,_0x4a4948);};exports[_0xbaad('0xb')]=function(_0x2bd321,_0xc1d057,_0x51ad1b,_0x3faa92){var _0x278d9b={'loginAttempts':_0xc1d057,'blocked':_0x51ad1b};if(!_['isUndefined'](_0x3faa92)){_0x278d9b[_0xbaad('0xc')]=_0x3faa92;}return _0x2bd321['updateAttributes'](_0x278d9b);};exports[_0xbaad('0xd')]=function(_0x17e0d0){return new BPromise(function(_0x54deb2,_0x2e6d08){var _0xae83b9=0x0;if(_0x17e0d0[_0xbaad('0xe')]!==_0xbaad('0xf')){_0x54deb2(_0x17e0d0);}db[_0xbaad('0x10')][_0xbaad('0x11')]({'where':{'role':_0xbaad('0xf'),'online':!![],'id':{'$ne':_0x17e0d0['id']}}})[_0xbaad('0x12')](function(_0xae62d3){_0xae83b9=_0xae62d3;return util[_0xbaad('0xd')]();})[_0xbaad('0x12')](function(_0x7523b4){if(_0x7523b4&&_0x7523b4['agents']&&_0xae83b9>=_0x7523b4[_0xbaad('0x13')]){throw Error(_0xbaad('0x14'));}_0x54deb2(_0x17e0d0);})[_0xbaad('0x15')](function(_0x4b87f2){_0x2e6d08(_0x4b87f2);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 931c658..948f58b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0584=['error','stack','statusMessage','status','send','../config/logger','api','message','Error','inherits','name','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','Forbidden'];(function(_0xd49e15,_0x5e34ac){var _0x306b6a=function(_0x38ce9c){while(--_0x38ce9c){_0xd49e15['push'](_0xd49e15['shift']());}};_0x306b6a(++_0x5e34ac);}(_0x0584,0x9d));var _0x4058=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x0584[_0x424a9a];return _0xa7831c;};'use strict';var util=require('util');var logger=require(_0x4058('0x0'))(_0x4058('0x1'));var APIError=function(_0x24b9d3,_0x17d9df){this[_0x4058('0x2')]=_0x24b9d3||'Internal\x20Server\x20Error';this['name']=_0x17d9df||_0x4058('0x3');util[_0x4058('0x4')](APIError,Error);};var APIBadRequestError=function(_0xbf9dd0){this[_0x4058('0x2')]=_0xbf9dd0||'Bad\x20Request';this[_0x4058('0x5')]='Bad\x20Request';util[_0x4058('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x427c36){this[_0x4058('0x2')]=_0x427c36||'Forbidden';this[_0x4058('0x5')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0xd499f6){this[_0x4058('0x2')]=_0xd499f6||_0x4058('0x6');this['name']=_0x4058('0x7');util[_0x4058('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x529d12){this['message']=_0x529d12||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x4058('0x5')]=_0x4058('0x8');this[_0x4058('0x9')]=0x193;this[_0x4058('0xa')]={'type':'OutOfInterval'};util[_0x4058('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x312688){this[_0x4058('0x2')]=_0x312688||_0x4058('0xb');this['name']=_0x4058('0xc');util[_0x4058('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x22b02d){switch(_0x22b02d){case'Bad\x20Request':return 0x190;case _0x4058('0xd'),'Out\x20Of\x20Interval':return 0x193;case _0x4058('0x7'):return 0x194;case _0x4058('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x409f49){if(_0x409f49===_0x4058('0x8'))return _0x409f49;return null;}function handleError(_0xb3dc67){return function(_0x55e972){logger[_0x4058('0xe')](_0x55e972[_0x4058('0xf')]);var _0x4c9730=getStatusCode(_0x55e972[_0x4058('0x5')]);var _0x551c25=getCustomStatusMessage(_0x55e972[_0x4058('0x5')]);if(_0x55e972['name']){delete _0x55e972[_0x4058('0x5')];}if(_0x551c25){_0xb3dc67[_0x4058('0x10')]=_0x551c25;}return _0xb3dc67[_0x4058('0x11')](_0x4c9730)[_0x4058('0x12')](_0x55e972);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x4d34=['code','OutOfInterval','Resource\x20Conflict','Conflict','Not\x20Found','Out\x20Of\x20Interval','error','statusMessage','status','exports','util','../config/logger','api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found'];(function(_0x1d2420,_0x3b69a8){var _0x4cb726=function(_0x39a6b5){while(--_0x39a6b5){_0x1d2420['push'](_0x1d2420['shift']());}};_0x4cb726(++_0x3b69a8);}(_0x4d34,0xee));var _0x44d3=function(_0x5873f2,_0x5bb298){_0x5873f2=_0x5873f2-0x0;var _0x4351d5=_0x4d34[_0x5873f2];return _0x4351d5;};'use strict';var util=require(_0x44d3('0x0'));var logger=require(_0x44d3('0x1'))(_0x44d3('0x2'));var APIError=function(_0x5d884b,_0x294261){this[_0x44d3('0x3')]=_0x5d884b||'Internal\x20Server\x20Error';this[_0x44d3('0x4')]=_0x294261||'Error';util[_0x44d3('0x5')](APIError,Error);};var APIBadRequestError=function(_0x4b7886){this[_0x44d3('0x3')]=_0x4b7886||_0x44d3('0x6');this[_0x44d3('0x4')]=_0x44d3('0x6');util[_0x44d3('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5cd959){this['message']=_0x5cd959||_0x44d3('0x7');this['name']='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x527268){this[_0x44d3('0x3')]=_0x527268||_0x44d3('0x8');this[_0x44d3('0x4')]='Not\x20Found';util[_0x44d3('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x16d98a){this['message']=_0x16d98a||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']='Out\x20Of\x20Interval';this[_0x44d3('0x9')]=0x193;this['details']={'type':_0x44d3('0xa')};util[_0x44d3('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x385cfd){this[_0x44d3('0x3')]=_0x385cfd||_0x44d3('0xb');this[_0x44d3('0x4')]=_0x44d3('0xc');util[_0x44d3('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x47bdb6){switch(_0x47bdb6){case _0x44d3('0x6'):return 0x190;case _0x44d3('0x7'),'Out\x20Of\x20Interval':return 0x193;case _0x44d3('0xd'):return 0x194;case _0x44d3('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x4ba193){if(_0x4ba193===_0x44d3('0xe'))return _0x4ba193;return null;}function handleError(_0x13a5d1){return function(_0x64cc4){logger[_0x44d3('0xf')](_0x64cc4['stack']);var _0x3aed15=getStatusCode(_0x64cc4[_0x44d3('0x4')]);var _0x43f512=getCustomStatusMessage(_0x64cc4[_0x44d3('0x4')]);if(_0x64cc4['name']){delete _0x64cc4[_0x44d3('0x4')];}if(_0x43f512){_0x13a5d1[_0x44d3('0x10')]=_0x43f512;}return _0x13a5d1[_0x44d3('0x11')](_0x3aed15)['send'](_0x64cc4);};}module[_0x44d3('0x12')]={'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 ed2cc7c..3fd73b9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c2c=['json','send','404','status'];(function(_0x97a9fe,_0x1ebec7){var _0xae397e=function(_0x1006ed){while(--_0x1006ed){_0x97a9fe['push'](_0x97a9fe['shift']());}};_0xae397e(++_0x1ebec7);}(_0x8c2c,0x92));var _0xc8c2=function(_0x2605e7,_0x236140){_0x2605e7=_0x2605e7-0x0;var _0x1982c3=_0x8c2c[_0x2605e7];return _0x1982c3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1693bb,_0xc1eb7f){var _0x1c02cf=_0xc8c2('0x0');var _0x149d48=0x194;var _0x315813={'status':_0x149d48};_0xc1eb7f[_0xc8c2('0x1')](_0x315813[_0xc8c2('0x1')]);_0xc1eb7f['render'](_0x1c02cf,{},function(_0x49963c,_0x1bcea0){if(_0x49963c){return _0xc1eb7f[_0xc8c2('0x1')](_0x315813[_0xc8c2('0x1')])[_0xc8c2('0x2')](_0x315813);}_0xc1eb7f[_0xc8c2('0x3')](_0x1bcea0);});}; \ No newline at end of file +var _0xf3bd=['render','json','exports','404','status'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xf3bd,0xac));var _0xdf3b=function(_0x5c1c11,_0x19da4a){_0x5c1c11=_0x5c1c11-0x0;var _0x24551f=_0xf3bd[_0x5c1c11];return _0x24551f;};'use strict';module[_0xdf3b('0x0')][0x194]=function pageNotFound(_0x209cf5,_0x21244d){var _0x193629=_0xdf3b('0x1');var _0x58b516=0x194;var _0x1f7a23={'status':_0x58b516};_0x21244d[_0xdf3b('0x2')](_0x1f7a23[_0xdf3b('0x2')]);_0x21244d[_0xdf3b('0x3')](_0x193629,{},function(_0x402434,_0x10a445){if(_0x402434){return _0x21244d[_0xdf3b('0x2')](_0x1f7a23[_0xdf3b('0x2')])[_0xdf3b('0x4')](_0x1f7a23);}_0x21244d['send'](_0x10a445);});}; \ No newline at end of file diff --git a/server/files/chat/iframe.ejs b/server/files/chat/iframe.ejs index ae3ec99..8bbdea1 100644 --- a/server/files/chat/iframe.ejs +++ b/server/files/chat/iframe.ejs @@ -1,420 +1,392 @@ (function() { - 'use strict'; - try { - const chatWebsiteAddress = new URL('{{{chatWebsiteAddressOrigin}}}'); - if (chatWebsiteAddress.origin !== window.location.origin){ - throw new Error(`Domain "${window.location.origin}"" can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); + 'use strict'; + try { + const chatWebsiteAddress = new URL('{{{chatWebsiteAddressOrigin}}}') + if (chatWebsiteAddress.origin !== window.location.origin){ + throw new Error(`Domain "${window.location.origin}"" can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`) + } + } catch (error) { + window.alert(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`) + return } - } catch (error) { - window.alert(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); - return; - } - - // Init all URLs - const remoteURL = new URL('{{{remote}}}'); - const chatOrigin = remoteURL.origin; - const chatPath = '/snippet/'; - const chatStylesPath = chatPath + 'styles/'; - const chatVersion = '{{{chatVersion}}}'; - - // Style setttings - const divColor = '<%=div_color%>'; - const textColor = '<%=text_color%>'; - const buttonColor = '<%=button_color%>'; - const backgroungColor = '<%=background_color%>'; - let alignment = "<%=alignment%>"; - let verticalAlignment = "<%=verticalAlignment%>"; - - // iframe URL settings - const iframeId = 'motion-chat-iframe'; - const iframeSrcURL = new URL(chatPath, chatOrigin); - const iframeSearchParams = new URLSearchParams('{{{query}}}'); - iframeSearchParams.append('version', chatVersion); - iframeSearchParams.append('location', btoa(window.location.host)); - iframeSrcURL.search = iframeSearchParams; - - // Style URL settings - const linkURL = new URL(chatStylesPath + 'mobile.css', chatOrigin); - linkURL.search = new URLSearchParams({ version: chatVersion }); - const linkMobile = document.createElement('link'); - linkMobile.type = "text/css"; - linkMobile.rel='stylesheet'; - linkMobile.href = linkURL.toString(); - - // Iframe localstorage whitelisting - const allowedOrigins = [chatOrigin]; - - function remoteLocalStorageEventHandler(event) { - if (allowedOrigins.includes(event.origin)) { - const { action, key, value } = event.data; - const localStorage = window.localStorage; - switch(action) { - case 'setItem': { - localStorage.setItem(key, JSON.stringify(value)) - event.source.postMessage( - { action: 'setItemResult', key }, - event.origin - ); - break; - } - case 'getItem': { - let item = localStorage.getItem(key); - if (item) { - try { - item = JSON.parse(item); - } catch (error) { - console.error('Cannot read data from localstorage', error); + // Init all URLs + const remoteURL = new URL('{{{remote}}}') + const chatOrigin = remoteURL.origin + const chatPath = '/snippet/' + const chatStylesPath = chatPath + 'styles/' + const chatVersion = '{{{chatVersion}}}' + + // Style setttings + const divColor = '<%=div_color%>' + const textColor = '<%=text_color%>' + const buttonColor = '<%=button_color%>' + const backgroungColor = '<%=background_color%>' + let alignment = "<%=alignment%>"; + let verticalAlignment = "<%=verticalAlignment%>"; + + // iframe URL settings + const iframeId = 'motion-chat-iframe' + const iframeSrcURL = new URL(chatPath, chatOrigin) + const iframeSearchParams = new URLSearchParams('{{{query}}}') + iframeSearchParams.append('version', chatVersion) + iframeSearchParams.append('location', btoa(window.location.host)) + iframeSrcURL.search = iframeSearchParams + + // Style URL settings + const linkURL = new URL(chatStylesPath + 'mobile.css', chatOrigin) + linkURL.search = new URLSearchParams({ version: chatVersion }) + const linkMobile = document.createElement('link'); + linkMobile.type = "text/css"; + linkMobile.rel='stylesheet'; + linkMobile.href = linkURL.toString() + + // Iframe localstorage whitelisting + const allowedOrigins = [chatOrigin] + + function remoteLocalStorageEventHandler(event){ + if (allowedOrigins.includes(event.origin)) { + const { action, key, value } = event.data + const localStorage = window.localStorage + switch(action){ + case 'setItem': + { + localStorage.setItem(key, JSON.stringify(value)) + event.source.postMessage( + { + action: 'setItemResult', + key + }, event.origin) + } + break + case 'getItem': + { + let item = localStorage.getItem(key) + if(item){ + try { + item = JSON.parse(item) + } catch (error) { + console.error('Cannot read data from localstorage', error) + } + } + event.source.postMessage( + { + action: 'getItemResult', + key, + item + }, event.origin) + } + break + case 'removeItem': + { + localStorage.removeItem(key) + event.source.postMessage( + { + action: 'removeItemResult', + key + }, event.origin) + } + break + default: + typeof action === 'string' && console.debug('Unsupported action', action) + break; + } } - } - event.source.postMessage( - { action: 'getItemResult', key, item }, - event.origin - ); - break; - } - case 'removeItem': { - localStorage.removeItem(key); - event.source.postMessage( - { action: 'removeItemResult', key }, - event.origin - ); - break; } - default: - typeof action === 'string' && console.debug('Unsupported action', action); - break; - } - } - } - - // DOM Manipulation - let iframe = document.createElement('iframe'); - // Attributes - iframe['id'] = iframeId; - iframe['src'] = iframeSrcURL.toString() - - let iframe_status = false; - - document.documentElement.style.setProperty('--xc-ws-div-color', divColor); - document.documentElement.style.setProperty('--xc-ws-text-color', textColor); - document.documentElement.style.setProperty('--xc-ws-button-color', buttonColor); - document.documentElement.style.setProperty('--xc-ws-background-color', backgroungColor); - - document.head.appendChild(linkMobile); - document.body.appendChild(iframe); - - <% if (alignment == 'bottom_right') { -%> - // Bottom, right - iframe.className = 'motion-chat-iframe-bottom_right'; - verticalAlignment = 0; - <% } else if (alignment == 'right') { -%> - // Right - iframe.className = 'motion-chat-iframe-right'; - iframe.style['top'] = verticalAlignment+'%'; - let iframe_h = topIframe_calc(); - topIframe_set(iframe_h); - let div_tab = document.createElement('div'); - div_tab['id'] = 'motion-chat-iframe-tab'; - div_tab.className = 'motion-chat-div-right'; - let tab_status=0; - <% } else if (alignment == 'left') { -%> - // Left - iframe.className = 'motion-chat-iframe-left'; - iframe.style['top'] = verticalAlignment+'%'; - let iframe_h = topIframe_calc(); - topIframe_set(iframe_h); - let div_tab = document.createElement('div'); - div_tab.className = 'motion-chat-div-left'; - div_tab['id'] ='motion-chat-iframe-tab'; - let tab_status=0; - <% } -%> - - <% if (alignment == 'right') { -%> - // RIGHT - topChat_set(iframe_h, verticalAlignment); - document.body.appendChild(div_tab); - let html = '
<
<%=labelText%>'; - div_tab.innerHTML = html; - - div_tab.style.backgroundColor = divColor; - document.getElementById("chat_tab_text").style.color = textColor; - document.getElementById("chat_tab_arrow").style.color = divColor; - document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; - document.getElementById("motion-chat-iframe-tab").style.display = "flex"; - - function appendLink(){ - if(iframe_status == false){ - document.body.appendChild(iframe); - iframe_status=true; - } - } - function expandChatRight(){ - appendLink(); - div_tab.style.right = '295px'; - iframe.style.right = '0px'; - document.getElementById("chat_tab_arrow").innerHTML = " > "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"show"}, '*'); - } + // DOM Manipulation + let iframe = document.createElement('iframe'); + // Attributes + iframe['id'] = iframeId; + iframe['src'] = iframeSrcURL.toString() - function collapseChatRight(){ - appendLink(); - div_tab.style.right = '0px'; - iframe.style.right = '-312px'; - document.getElementById("chat_tab_arrow").innerHTML = " < "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); - } + let iframe_status = false; - function toggleChatExpandedRight(){ - if (tab_status % 2 === 0) { - expandChatRight(); - } - else { - collapseChatRight(); - } - tab_status++; - } + document.documentElement.style.setProperty('--xc-ws-div-color', divColor); + document.documentElement.style.setProperty('--xc-ws-text-color', textColor); + document.documentElement.style.setProperty('--xc-ws-button-color', buttonColor); + document.documentElement.style.setProperty('--xc-ws-background-color', backgroungColor); + + document.head.appendChild(linkMobile); - document.getElementById("motion-chat-iframe-tab").addEventListener("click", toggleChatExpandedRight); - <% } else if (alignment == 'left') { -%> - // LEFT - topChat_set(iframe_h, verticalAlignment); - document.body.appendChild(div_tab); - let html='
>
<%=labelText%>'; - div_tab.innerHTML = html; - - div_tab.style.backgroundColor = divColor; - document.getElementById("chat_tab_text").style.color = textColor; - document.getElementById("chat_tab_arrow").style.color = divColor; - document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; - document.getElementById("motion-chat-iframe-tab").style.display="flex"; - - function appendLink() { - if (iframe_status == false){ - document.body.appendChild(iframe); - iframe_status=true; - } - } + <% if (alignment == 'bottom_right') { -%> // Bottom, right + iframe.className = 'motion-chat-iframe-bottom_right'; + verticalAlignment = 0; + document.body.appendChild(iframe); - function expandChatLeft() { - appendLink(); - div_tab.style.left = '295px'; - iframe.style.left = '0px'; - document.getElementById("chat_tab_arrow").innerHTML = " < "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"show"}, '*'); - } + <% } else if (alignment == 'right') { -%> // Right + iframe.className = 'motion-chat-iframe-right'; + iframe.style['top'] = verticalAlignment+'%'; + let iframe_h = topIframe_calc(); + topIframe_set(iframe_h); + let div_tab = document.createElement('div'); + div_tab['id'] = 'motion-chat-iframe-tab'; + div_tab.className = 'motion-chat-div-right'; + let tab_status=0; - function collapseChatLeft() { - appendLink(); - div_tab.style.left = '0px'; - iframe.style.left = '-312px'; - document.getElementById("chat_tab_arrow").innerHTML = " > "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); - } + <% } else if (alignment == 'left') { -%> // Left + iframe.className = 'motion-chat-iframe-left'; + iframe.style['top'] = verticalAlignment+'%'; + let iframe_h = topIframe_calc(); + topIframe_set(iframe_h); + let div_tab = document.createElement('div'); + div_tab.className = 'motion-chat-div-left'; + div_tab['id'] ='motion-chat-iframe-tab'; + let tab_status=0; - function toggleChatExpandedLeft() { - if (tab_status % 2 === 0) { - expandChatLeft(); - } - else { - collapseChatLeft(); - } - tab_status++; - } + <% } -%> - document.getElementById("motion-chat-iframe-tab").addEventListener("click", toggleChatExpandedLeft); - <% } -%> - - // START Events management - window.addEventListener( - 'message', - function(evt) { - remoteLocalStorageEventHandler(evt) - switch (evt.data.cmd) { - case 'show': - <% if (alignment == 'bottom_right') { -%> - // Bottom, right - iframe.style.top = 'auto'; - iframe.style.bottom = '0px'; - <% } else if (alignment == 'right') { -%> - // Right - iframe.style.right = '0px'; - div_tab.style.right = '295px'; - <% } else if (alignment == 'left') { -%> - // Left - iframe.style.left = '0px'; - div_tab.style.left = '295px'; - <% } -%> - break; - case 'hide': - <% if (alignment == 'bottom_right') { -%> - // Bottom, right - iframe.style.top = 'calc(100% - 50px)'; - <% } else if (alignment == 'right') { -%> - // Right - iframe.style.right = '-312px'; - div_tab.style['right'] = '0px'; - <% } else if (alignment == 'left') { -%> - // Left - iframe.style.left = '-312px'; - div_tab.style.left = '0px'; - <% } -%> - break; - case "init": - <% if (alignment == 'right' || alignment == 'left') { -%> - // Bottom, right + <% if (alignment == 'right') { -%> // Right + topChat_set(iframe_h, verticalAlignment); + document.body.appendChild(div_tab); + let html = '
<
<%=labelText%>'; + div_tab.innerHTML = html; + div_tab.style.backgroundColor = divColor; document.getElementById("chat_tab_text").style.color = textColor; - document.getElementById("chat_tab_arrow").style.color = divColor; + document.getElementById("chat_tab_arrow").style.color = divColor document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; document.getElementById("motion-chat-iframe-tab").style.display = "flex"; - <% } -%> - break; - case "offline": - <% if (alignment == 'right' || alignment == 'left') { -%> - // Bottom, right - document.getElementById("motion-chat-iframe-tab").style.display = "none"; - <% } -%> - break; - default: - } - }, - false - ); - // END Events management - - // START Proactive action management - <% proactiveActions.forEach(function(action, index) { -%> - <% if (action.type == 'timeout') { -%> - setTimeout(function() { - <% if (alignment == 'right') { -%> - expandChatRight(); - tab_status++; - <% } else if (alignment == 'left') { -%> - expandChatLeft(); - tab_status++; - <% } else { -%> - iframe.style.bottom = '0px'; - iframe.contentWindow?.postMessage({ - evt: 'show' - }, '*'); - <% } -%> - }, <%- action.timeout %> * 1000); - <% } -%> - <% if (action.type == 'mouseOver') { -%> - let elements<%- index %> = document.querySelectorAll("<%- action.selector %>"); - for (let i = 0; i < elements<%- index %>.length; i++) { - elements<%- index %>[i].onmouseover = function() { - <% if (alignment == 'right') { -%> - expandChatRight(); - tab_status++; - <% } else if (alignment == 'left') { -%> - expandChatLeft(); - tab_status++; - <% } else { -%> - iframe.style.bottom = '0px'; - iframe.contentWindow?.postMessage({ - evt: 'show' - }, '*'); - <% } -%> - } - } - <% } -%> <% }); -%> - // END Proactive action management - - if (window.DeviceOrientationEvent) { - window.addEventListener( - 'orientationchange', - function() { - if (alignment == 'right') { - document.getElementById("chat_tab_arrow").innerHTML = " < "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); - tab_status = 0; - iframe_h = topIframe_calc(); - topIframe_set(iframe_h); - if (typeof div_tab != "undefined") { + + function appendLink(){ + if(iframe_status == false){ + document.body.appendChild(iframe); + iframe_status=true; + } + } + + function expandChatRight(){ + appendLink() + div_tab.style.right = '295px'; + iframe.style.right = '0px'; + document.getElementById("chat_tab_arrow").innerHTML = " > "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"show"}, '*'); + } + + function collapseChatRight(){ + appendLink() + div_tab.style.right = '0px'; + iframe.style.right = '-312px'; + document.getElementById("chat_tab_arrow").innerHTML = " < "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); + } + + function toggleChatExpandedRight(){ + if(tab_status % 2 === 0) { + expandChatRight() + } + else { + collapseChatRight() + } + tab_status++; + } + + document.getElementById("motion-chat-iframe-tab").addEventListener("click", toggleChatExpandedRight); + <% } else if (alignment == 'left') { -%> topChat_set(iframe_h, verticalAlignment); - } + document.body.appendChild(div_tab); + let html='
>
<%=labelText%>'; + div_tab.innerHTML=html; + + div_tab.style.backgroundColor = divColor; + document.getElementById("chat_tab_text").style.color = textColor; + document.getElementById("chat_tab_arrow").style.color = divColor; + document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; + document.getElementById("motion-chat-iframe-tab").style.display="flex"; + + function appendLink(){ + if(iframe_status == false){ + document.body.appendChild(iframe); + iframe_status=true; + } + } + + function expandChatLeft(){ + appendLink() + div_tab.style.left = '295px'; + iframe.style.left = '0px'; + document.getElementById("chat_tab_arrow").innerHTML = " < "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"show"}, '*'); + } + + function collapseChatLeft(){ + appendLink() + div_tab.style.left = '0px'; + iframe.style.left = '-312px'; + document.getElementById("chat_tab_arrow").innerHTML = " > "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); + } + + function toggleChatExpandedLeft(){ + if(tab_status % 2 === 0) { + expandChatLeft() + } + else { + collapseChatLeft() + } + tab_status++; + } + + document.getElementById("motion-chat-iframe-tab").addEventListener("click", toggleChatExpandedLeft); + + <% } -%> + + // START Events management + window.addEventListener('message', function(evt) { + remoteLocalStorageEventHandler(evt) + switch (evt.data.cmd) { + case 'show': + <% if (alignment == 'bottom_right') { -%> // Bottom, right + iframe.style.top = 'auto'; + iframe.style.bottom = '0px'; + <% } else if (alignment == 'right') { -%> // Right + iframe.style.right = '0px'; + div_tab.style.right = '295px'; + <% } else if (alignment == 'left') { -%> // Left + iframe.style.left = '0px'; + div_tab.style.left = '295px'; + // Left + <% } -%> break; + case 'hide': + <% if (alignment == 'bottom_right') { -%> // Bottom, right + iframe.style.top = 'calc(100% - 50px)'; + <% } else if (alignment == 'right') { -%> // Right + iframe.style.right = '-312px'; + div_tab.style['right'] = '0px'; + <% } else if (alignment == 'left') { -%> // Left + iframe.style.left = '-312px'; + div_tab.style.left = '0px'; + <% } -%> break; + case "init": + <% if (alignment == 'right' || alignment == 'left') { -%> // Bottom, right + div_tab.style.backgroundColor = divColor; + document.getElementById("chat_tab_text").style.color = textColor; + document.getElementById("chat_tab_arrow").style.color = divColor; + document.getElementById("chat_tab_arrow").style.backgroundColor = textColor; + document.getElementById("motion-chat-iframe-tab").style.display = "flex"; + <% } -%> break; + case "offline": + <% if (alignment == 'right' || alignment == 'left') { -%> // Bottom, right + document.getElementById("motion-chat-iframe-tab").style.display = "none"; + <% } -%> break; + default: + } + + }, false); + // END Events management + + // START Proactive action management + <% proactiveActions.forEach(function(action, index) { -%> + <% if (action.type == 'timeout') { -%> + setTimeout(function() { + <% if (alignment == 'right') { -%> + expandChatRight(); + tab_status++; + <% } else if (alignment == 'left') { -%> + expandChatLeft(); + tab_status++; + <% } else { -%> + iframe.style.bottom = '0px'; + iframe.contentWindow?.postMessage({ + evt: 'show' + }, '*'); + <% } -%> + }, <%- action.timeout %> * 1000); + <% } -%> + <% if (action.type == 'mouseOver') { -%> + let elements<%- index %> = document.querySelectorAll("<%- action.selector %>"); + for (let i = 0; i < elements<%- index %>.length; i++) { + elements<%- index %>[i].onmouseover = function() { + <% if (alignment == 'right') { -%> + expandChatRight(); + tab_status++; + <% } else if (alignment == 'left') { -%> + expandChatLeft(); + tab_status++; + <% } else { -%> + iframe.style.bottom = '0px'; + iframe.contentWindow?.postMessage({ + evt: 'show' + }, '*'); + <% } -%> + } } - else if (alignment == 'left') { - document.getElementById("chat_tab_arrow").innerHTML = " > "; - let iframeEl = document.getElementById('motion-chat-iframe'); - iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); - tab_status = 0; - iframe_h = topIframe_calc(); - topIframe_set(iframe_h); - if (typeof div_tab != "undefined") { - topChat_set(iframe_h, verticalAlignment); - } + <% } -%> <% }); -%> + // END Proactive action management + + + if (window.DeviceOrientationEvent) { + window.addEventListener('orientationchange', function() { + if (alignment == 'right'){ + document.getElementById("chat_tab_arrow").innerHTML = " < "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); + tab_status = 0; + iframe_h = topIframe_calc(); + topIframe_set(iframe_h); + if(typeof div_tab != "undefined") topChat_set(iframe_h, verticalAlignment); + } + else if (alignment == 'left'){ + document.getElementById("chat_tab_arrow").innerHTML = " > "; + let iframeEl = document.getElementById('motion-chat-iframe'); + iframeEl.contentWindow?.postMessage({"evt":"hide"}, '*'); + tab_status = 0; + iframe_h = topIframe_calc(); + topIframe_set(iframe_h); + if(typeof div_tab != "undefined") topChat_set(iframe_h, verticalAlignment); + } }, false); } - }, - false - ); - } - - window.addEventListener( - "resize", - function(event) { - let iframe_h = topIframe_calc(); - topIframe_set(iframe_h); - if(typeof div_tab != "undefined") { - topChat_set(iframe_h, verticalAlignment); - } - } - ); - - function topIframe_calc(){ - let height_iframe - let heightD = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); - let iframeT = ((heightD/100)*verticalAlignment) + 450; - if (heightD < iframeT) { - height_iframe = 450 - (iframeT - heightD); - } - else { - height_iframe = 450; - } - return height_iframe; - } - - function topIframe_set(height_iframe) { - if (height_iframe > 340) { - iframe.style['height'] = height_iframe +'px'; - if (alignment == "right" || alignment == "left") { - iframe.style['top'] = verticalAlignment + "%"; - } - else { - iframe.style['bottom'] = "0%"; - } - } - else { - iframe.style['height'] = '340px'; - if (alignment == "right" || alignment == "left") { - iframe.style['top'] = "calc(100% - 340px)"; - } - else { - iframe.style['bottom'] = "0%"; - } - } - } - function topChat_set(height_iframe, verticalAlignment) { - if (height_iframe > 340) { - div_tab.style['top'] = "calc("+ verticalAlignment +"% + " + (height_iframe - 100) + "px)"; - } - else { - div_tab.style['top'] = "auto"; - div_tab.style['bottom'] = "0px"; - } - } + window.addEventListener("resize", function(event) { + let iframe_h = topIframe_calc(); + topIframe_set(iframe_h); + if(typeof div_tab != "undefined") topChat_set(iframe_h, verticalAlignment); + }); + + function topIframe_calc(){ + let height_iframe + let heightD = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); + let iframeT = ((heightD/100)*verticalAlignment) + 450; + if (heightD < iframeT) { + height_iframe = 450 - (iframeT - heightD); + } + else { height_iframe = 450; } + return height_iframe; + } + + function topIframe_set(height_iframe){ + if( height_iframe > 340){ + iframe.style['height'] = height_iframe +'px'; + if (alignment == "right" || alignment == "left" ) + { iframe.style['top'] = verticalAlignment + "%"; } + else{ iframe.style['bottom'] = "0%"; } + + } + else { + iframe.style['height'] = '340px'; + if (alignment == "right" || alignment == "left" ) + { iframe.style['top'] = "calc(100% - 340px)"; } + else{ iframe.style['bottom'] = "0%"; } - // hide chat - <% if (hideWhenOffline && intervalId != null) { -%> - // hide template - document.getElementById("motion-chat-iframe-tab").style.display = "none"; - <% } -%> + } + } + + function topChat_set(height_iframe, verticalAlignment){ + + if( height_iframe > 340){ + div_tab.style['top'] = "calc("+ verticalAlignment +"% + " + (height_iframe - 100) + "px)"; + } + else { + div_tab.style['top'] = "auto"; + div_tab.style['bottom'] = "0px"; + } + } + + // hide chat + <% if (hideWhenOffline && intervalId != null) { -%> // hide template + document.getElementById("motion-chat-iframe-tab").style.display = "none"; + <% } -%> }()); \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9e66787..6cd763c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a4c=['AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','User','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','ChatQueues','SmsQueue','SmsQueues','UserSmsQueue','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','VoiceChanSpy','SpiedAgents','Applications','Sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','CannedAnswer','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Users','Interaction','TagId','Dashboard','DashboardItem','Dispositions','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ChatWebsiteId','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','AutomationAllId','Actions','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmConfiguration','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','ZendeskConfiguration','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowConfiguration','Dynamics365Field','FromId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','VoiceQueues','team_has_mail_queues','team_has_chat_queues','FaxQueues','team_has_openchannel_queues','OpenchannelQueues','TrunkBackup','SquareProject','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','FromAccount','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','mysql','name','sequelizeHistory','127.0.0.1','utf8mb4','utf8','utf8_general_ci','username','password','options','database','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model'];(function(_0xac6072,_0x38d9dd){var _0x528239=function(_0x5197ca){while(--_0x5197ca){_0xac6072['push'](_0xac6072['shift']());}};_0x528239(++_0x38d9dd);}(_0x1a4c,0x164));var _0xc1a4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a4c[_0x122ef9];return _0x42fba0;};'use strict';var config=require(_0xc1a4('0x0'));var Sequelize=require('sequelize');var _=require(_0xc1a4('0x1'));var jstz=require(_0xc1a4('0x2'));var timezone=jstz[_0xc1a4('0x3')]();config['sequelize']=_[_0xc1a4('0x4')](config[_0xc1a4('0x5')],{'database':_0xc1a4('0x6'),'username':_0xc1a4('0x7'),'password':_0xc1a4('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc1a4('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc1a4('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xc1a4('0xb')]=_[_0xc1a4('0x4')](config[_0xc1a4('0xb')],{'database':'motion2','username':_0xc1a4('0x7'),'password':_0xc1a4('0x8'),'options':{'host':_0xc1a4('0xc'),'port':0xcea,'dialect':_0xc1a4('0x9'),'dialectOptions':{'charset':_0xc1a4('0xd')},'logging':![],'timezone':timezone[_0xc1a4('0xa')](),'define':{'charset':_0xc1a4('0xe'),'collate':_0xc1a4('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xc1a4('0x5')][_0xc1a4('0x10')],config[_0xc1a4('0x5')][_0xc1a4('0x11')],config['sequelize'][_0xc1a4('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc1a4('0xb')][_0xc1a4('0x13')],config['sequelizeHistory'][_0xc1a4('0x10')],config[_0xc1a4('0xb')][_0xc1a4('0x11')],config[_0xc1a4('0xb')][_0xc1a4('0x12')])};db['User']=db['sequelize']['import'](_0xc1a4('0x14'));db['VoiceChanSpy']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x16'));db[_0xc1a4('0x17')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x18'));db['VoiceExtension']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x19'));db[_0xc1a4('0x1a')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x1b'));db[_0xc1a4('0x1c')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x1d'));db[_0xc1a4('0x1e')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x1f'));db[_0xc1a4('0x20')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x21'));db[_0xc1a4('0x22')]=db['sequelize']['import'](_0xc1a4('0x23'));db[_0xc1a4('0x24')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x25'));db[_0xc1a4('0x26')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x27'));db[_0xc1a4('0x28')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x29'));db[_0xc1a4('0x2a')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/memberReport/memberReport.model');db[_0xc1a4('0x2b')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x2c'));db[_0xc1a4('0x2d')]=db['sequelize']['import'](_0xc1a4('0x2e'));db[_0xc1a4('0x2f')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x30'));db[_0xc1a4('0x31')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x32'));db[_0xc1a4('0x33')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xc1a4('0x34')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x35'));db[_0xc1a4('0x36')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x37'));db['UserSmsQueue']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x38'));db['UserOpenchannelQueue']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x39'));db['UserWhatsappQueue']=db['sequelize']['import'](_0xc1a4('0x3a'));db[_0xc1a4('0x3b')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x3c'));db['MailServerOut']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xc1a4('0x3d')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x3e'));db[_0xc1a4('0x3f')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x40'));db['MailSubstatus']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x41'));db[_0xc1a4('0x42')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x43'));db[_0xc1a4('0x44')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x45'));db['MailApplication']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/mailApplication/mailApplication.model');db[_0xc1a4('0x46')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x47'));db['DashboardItem']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x48'));db[_0xc1a4('0x49')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/faxAccount/faxAccount.model');db[_0xc1a4('0x4a')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x4b'));db[_0xc1a4('0x4c')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x4d'));db['FaxMessage']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x4e'));db[_0xc1a4('0x4f')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x50'));db[_0xc1a4('0x51')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x52'));db[_0xc1a4('0x53')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x54'));db[_0xc1a4('0x55')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x56'));db[_0xc1a4('0x57')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x58'));db[_0xc1a4('0x59')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x5a'));db['SmsQueue']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/smsQueue/smsQueue.model');db[_0xc1a4('0x5b')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x5c'));db[_0xc1a4('0x5d')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x5e'));db[_0xc1a4('0x5f')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x60'));db[_0xc1a4('0x61')]=db[_0xc1a4('0x5')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xc1a4('0x62')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x63'));db['ChatWebsite']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x64'));db['OpenchannelQueueReport']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x65'));db['ChatApplication']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x66'));db[_0xc1a4('0x67')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x68'));db[_0xc1a4('0x69')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x6a'));db[_0xc1a4('0x6b')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x6c'));db[_0xc1a4('0x6d')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x6e'));db[_0xc1a4('0x6f')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x70'));db[_0xc1a4('0x71')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xc1a4('0x72')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x73'));db[_0xc1a4('0x74')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/cmContact/cmContact.model');db[_0xc1a4('0x75')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x76'));db[_0xc1a4('0x77')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x78'));db[_0xc1a4('0x79')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x7a'));db[_0xc1a4('0x7b')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x7c'));db['ReportAgentPreview']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x7d'));db['CmCustomField']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x7e'));db[_0xc1a4('0x7f')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x80'));db[_0xc1a4('0x81')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x82'));db['CannedAnswer']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x83'));db[_0xc1a4('0x84')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x85'));db[_0xc1a4('0x86')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x87'));db[_0xc1a4('0x88')]=db['sequelize']['import'](_0xc1a4('0x89'));db[_0xc1a4('0x8a')]=db[_0xc1a4('0x5')]['import']('../api/pause/pause.model');db[_0xc1a4('0x8b')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x8c'));db[_0xc1a4('0x8d')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x8e'));db[_0xc1a4('0x8f')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x90'));db[_0xc1a4('0x91')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0x92'));db['Tag']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x93'));db[_0xc1a4('0x94')]=db['sequelize'][_0xc1a4('0x15')]('../api/contactItemType/contactItemType.model');db[_0xc1a4('0x95')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x96'));db[_0xc1a4('0x97')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xc1a4('0x98')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x99'));db['Trigger']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/trigger/trigger.model');db[_0xc1a4('0x9a')]=db['sequelize']['import'](_0xc1a4('0x9b'));db['Integration']=db['sequelize']['import'](_0xc1a4('0x9c'));db[_0xc1a4('0x9d')]=db['sequelize']['import'](_0xc1a4('0x9e'));db[_0xc1a4('0x9f')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xa0'));db[_0xc1a4('0xa1')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xa2'));db[_0xc1a4('0xa3')]=db[_0xc1a4('0x5')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xc1a4('0xa4')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xa5'));db[_0xc1a4('0xa6')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xa7'));db[_0xc1a4('0xa8')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xa9'));db[_0xc1a4('0xaa')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xab'));db[_0xc1a4('0xac')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xad'));db['SalesforceField']=db['sequelize'][_0xc1a4('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0xc1a4('0xae')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xaf'));db[_0xc1a4('0xb0')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xc1a4('0xb1')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xb2'));db['DeskConfiguration']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xb3'));db[_0xc1a4('0xb4')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xb5'));db[_0xc1a4('0xb6')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xb7'));db[_0xc1a4('0xb8')]=db[_0xc1a4('0x5')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xb9'));db['ZendeskAccount']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xba'));db['ZendeskConfiguration']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xbb'));db[_0xc1a4('0xbc')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0xc1a4('0xbd')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xbe'));db['VtigerAccount']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xbf'));db[_0xc1a4('0xc0')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xc1'));db['VtigerField']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0xc1a4('0xc2')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xc3'));db[_0xc1a4('0xc4')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xc5'));db[_0xc1a4('0xc6')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xc7'));db[_0xc1a4('0xc8')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xc9'));db['Dynamics365Field']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xca'));db[_0xc1a4('0xcb')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xcc'));db[_0xc1a4('0xcd')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xce'));db[_0xc1a4('0xcf')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xd0'));db['Integration']=db[_0xc1a4('0x5')]['import'](_0xc1a4('0x9c'));db[_0xc1a4('0xd1')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xd2'));db[_0xc1a4('0xd3')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xd4'));db[_0xc1a4('0xd5')]=db['sequelize']['import'](_0xc1a4('0xd6'));db[_0xc1a4('0xd7')]=db['sequelize'][_0xc1a4('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xc1a4('0xd8')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xd9'));db[_0xc1a4('0xda')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xdb'));db['SmsQueueReport']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xdc'));db['SquareReport']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xdd'));db[_0xc1a4('0xde')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xdf'));db['JscriptyProject']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xe0'));db[_0xc1a4('0xe1')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xe2'));db[_0xc1a4('0xe3')]=db['sequelize'][_0xc1a4('0x15')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xe4'));db[_0xc1a4('0xe5')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xe6'));db[_0xc1a4('0xe7')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xe8'));db['Team']=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/team/team.model');db[_0xc1a4('0xe9')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xea'));db[_0xc1a4('0xeb')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xec'));db['Migration']=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xed'));db[_0xc1a4('0xee')]=db['sequelize']['import'](_0xc1a4('0xef'));db[_0xc1a4('0xf0')]=db['sequelize']['import'](_0xc1a4('0xf1'));db[_0xc1a4('0xf2')]=db['sequelize'][_0xc1a4('0x15')](_0xc1a4('0xf3'));db[_0xc1a4('0xf4')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0xc1a4('0xf5')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xf6'));db[_0xc1a4('0xf7')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xf8'));db[_0xc1a4('0xf9')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xfa'));db[_0xc1a4('0xfb')]=db[_0xc1a4('0x5')]['import'](_0xc1a4('0xfc'));db[_0xc1a4('0xfd')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0xfe'));db[_0xc1a4('0xff')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x100'));db['UserProfileSection']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x101'));db[_0xc1a4('0x102')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x103'));db[_0xc1a4('0x104')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x105'));db[_0xc1a4('0x106')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x107'));db[_0xc1a4('0x108')]=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xc1a4('0x109')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xc1a4('0x10a')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0xc1a4('0x10b')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x10c'));db[_0xc1a4('0x10d')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x10e'));db[_0xc1a4('0x10f')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x110'));db[_0xc1a4('0x111')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x112'));db[_0xc1a4('0x113')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x114'));db[_0xc1a4('0x115')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x116'));db[_0xc1a4('0x117')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x118'));db[_0xc1a4('0x119')]=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x11a'));db['MailInteractionHasTag']=db[_0xc1a4('0x5')][_0xc1a4('0x15')](_0xc1a4('0x11b'));db['User'][_0xc1a4('0x11c')](db[_0xc1a4('0x20')],{'as':_0xc1a4('0x20'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')][_0xc1a4('0x11c')](db[_0xc1a4('0x119')],{'as':_0xc1a4('0x120'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db[_0xc1a4('0x1e')],{'as':_0xc1a4('0x122'),'foreignKey':'UserId'});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db['UserVoiceQueueRt'],{'as':_0xc1a4('0x123'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')]['hasMany'](db[_0xc1a4('0x124')],{'as':_0xc1a4('0x125'),'onDelete':_0xc1a4('0x11d'),'hooks':!![]});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db[_0xc1a4('0x79')],{'as':_0xc1a4('0x126'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db[_0xc1a4('0x7b')],{'as':_0xc1a4('0x127'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')]['hasMany'](db[_0xc1a4('0x128')],{'as':_0xc1a4('0x128'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')]['hasMany'](db[_0xc1a4('0x5f')],{'as':_0xc1a4('0x129'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db[_0xc1a4('0x67')],{'as':_0xc1a4('0x12a'),'foreignKey':_0xc1a4('0x11e')});db['User'][_0xc1a4('0x121')](db[_0xc1a4('0x57')],{'as':_0xc1a4('0x12b'),'foreignKey':'UserId'});db['User'][_0xc1a4('0x121')](db[_0xc1a4('0x4c')],{'as':_0xc1a4('0x12c'),'foreignKey':_0xc1a4('0x11e')});db['User'][_0xc1a4('0x121')](db[_0xc1a4('0x42')],{'as':_0xc1a4('0x12d'),'foreignKey':_0xc1a4('0x11e')});db['User'][_0xc1a4('0x121')](db[_0xc1a4('0x109')],{'as':_0xc1a4('0x12e'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db['UserNotification'],{'as':_0xc1a4('0x12f'),'foreignKey':_0xc1a4('0x130')});db[_0xc1a4('0x11f')][_0xc1a4('0x121')](db[_0xc1a4('0x75')],{'as':_0xc1a4('0x131'),'foreignKey':_0xc1a4('0x11e'),'onDelete':_0xc1a4('0x132')});db[_0xc1a4('0x11f')][_0xc1a4('0x133')](db[_0xc1a4('0xff')],{'as':_0xc1a4('0xff'),'foreignKey':_0xc1a4('0x134')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x6f')],{'as':_0xc1a4('0x136'),'through':_0xc1a4('0x137')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x138'),'through':'cm_user_has_contacts'});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x139'),'through':'cm_user_has_lists'});db['User'][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':_0xc1a4('0x13b')});db['User'][_0xc1a4('0x135')](db['MailInteraction'],{'as':_0xc1a4('0x12d'),'through':_0xc1a4('0x13c')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x67')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x4c')],{'as':_0xc1a4('0x12c'),'through':_0xc1a4('0x13d')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x57')],{'as':_0xc1a4('0x12b'),'through':_0xc1a4('0x13e')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x5f')],{'as':_0xc1a4('0x129'),'through':'user_has_openchannel_interactions'});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db['WhatsappInteraction'],{'as':_0xc1a4('0x12e'),'through':_0xc1a4('0x13f')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x1c')],{'as':'VoiceQueues','through':_0xc1a4('0x31'),'required':![]});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0xc1a4('0x117'),'required':![]});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x3f')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x6d')],{'as':_0xc1a4('0x140'),'through':_0xc1a4('0x33'),'required':![],'hooks':!![]});db[_0xc1a4('0x11f')]['belongsToMany'](db[_0xc1a4('0x4f')],{'as':'FaxQueues','through':_0xc1a4('0x36'),'required':![]});db[_0xc1a4('0x11f')]['belongsToMany'](db[_0xc1a4('0x141')],{'as':_0xc1a4('0x142'),'through':_0xc1a4('0x143'),'required':![]});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0xc1a4('0x144'),'required':![]});db['User'][_0xc1a4('0x135')](db[_0xc1a4('0x10f')],{'as':_0xc1a4('0x145'),'through':_0xc1a4('0x146'),'required':![]});db['User'][_0xc1a4('0x135')](db[_0xc1a4('0xfb')],{'through':_0xc1a4('0x147')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x148')],{'as':'ChatWebsites','through':_0xc1a4('0x149')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x49')],{'as':_0xc1a4('0x14a'),'through':_0xc1a4('0x14b')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x14c'),'through':_0xc1a4('0x14d')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x5b')],{'as':_0xc1a4('0x14e'),'through':_0xc1a4('0x14f')});db[_0xc1a4('0x11f')][_0xc1a4('0x135')](db[_0xc1a4('0x53')],{'as':_0xc1a4('0x150'),'through':_0xc1a4('0x151')});db['User'][_0xc1a4('0x135')](db[_0xc1a4('0x106')],{'as':_0xc1a4('0x152'),'through':'user_has_whatsapp_accounts'});db[_0xc1a4('0x153')][_0xc1a4('0x121')](db[_0xc1a4('0x124')],{'as':_0xc1a4('0x154'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'ChanSpyId'});db[_0xc1a4('0x17')][_0xc1a4('0x121')](db[_0xc1a4('0x124')],{'onDelete':_0xc1a4('0x11d')});db['VoiceExtension'][_0xc1a4('0x121')](db[_0xc1a4('0x124')],{'as':_0xc1a4('0x155'),'onDelete':'cascade'});db[_0xc1a4('0x1a')]['belongsToMany'](db[_0xc1a4('0x91')],{'as':_0xc1a4('0x156'),'through':'moh_has_sounds'});db[_0xc1a4('0x1c')]['hasMany'](db[_0xc1a4('0x2f')],{'as':_0xc1a4('0x157'),'foreignKey':_0xc1a4('0x158')});db[_0xc1a4('0x1c')][_0xc1a4('0x121')](db[_0xc1a4('0x75')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0xc1a4('0x1c')][_0xc1a4('0x121')](db[_0xc1a4('0x79')],{'as':_0xc1a4('0x126'),'foreignKey':_0xc1a4('0x158')});db['VoiceQueue']['hasMany'](db[_0xc1a4('0x7b')],{'as':'HopperHistories','foreignKey':_0xc1a4('0x158')});db[_0xc1a4('0x1c')][_0xc1a4('0x121')](db[_0xc1a4('0x128')],{'as':_0xc1a4('0x128'),'foreignKey':'VoiceQueueId'});db[_0xc1a4('0x1c')][_0xc1a4('0x121')](db[_0xc1a4('0x77')],{'as':_0xc1a4('0x159'),'foreignKey':'VoiceQueueId'});db[_0xc1a4('0x1c')][_0xc1a4('0x121')](db[_0xc1a4('0xda')],{'as':_0xc1a4('0x15a'),'foreignKey':_0xc1a4('0x158')});db[_0xc1a4('0x1c')][_0xc1a4('0x133')](db[_0xc1a4('0x2b')],{'as':_0xc1a4('0x2b'),'foreignKey':_0xc1a4('0x15b')});db[_0xc1a4('0x1c')][_0xc1a4('0x133')](db[_0xc1a4('0x2b')],{'as':'TrunkBackup','foreignKey':_0xc1a4('0x15c')});db[_0xc1a4('0x1c')]['belongsTo'](db[_0xc1a4('0x88')],{'as':_0xc1a4('0x88'),'foreignKey':_0xc1a4('0x15d')});db['VoiceQueue'][_0xc1a4('0x133')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xc1a4('0x15e')});db[_0xc1a4('0x1c')][_0xc1a4('0x135')](db[_0xc1a4('0xfb')],{'as':'Lists','through':_0xc1a4('0x15f')});db[_0xc1a4('0x1c')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x31')});db[_0xc1a4('0x1c')]['belongsToMany'](db[_0xc1a4('0x13a')],{'as':_0xc1a4('0x161'),'through':_0xc1a4('0x113')});db[_0xc1a4('0x1c')]['belongsToMany'](db[_0xc1a4('0xfb')],{'as':'BlackLists','through':_0xc1a4('0x162')});db[_0xc1a4('0x1e')][_0xc1a4('0x133')](db['User'],{'as':_0xc1a4('0x11f'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x163')][_0xc1a4('0x133')](db['User'],{'as':'User','foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x20')]['hasMany'](db[_0xc1a4('0x22')],{'as':_0xc1a4('0x164'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x165'),'sourceKey':_0xc1a4('0x166')});db[_0xc1a4('0x22')]['belongsTo'](db[_0xc1a4('0x20')],{'foreignKey':_0xc1a4('0x165'),'targetKey':'mailbox'});db[_0xc1a4('0x24')][_0xc1a4('0x121')](db[_0xc1a4('0x28')],{'as':_0xc1a4('0x167'),'foreignKey':_0xc1a4('0x168'),'constraints':![]});db[_0xc1a4('0x24')][_0xc1a4('0x121')](db[_0xc1a4('0x26')],{'as':_0xc1a4('0x169'),'foreignKey':_0xc1a4('0x168'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x11f'),'foreignKey':'UserId'});db[_0xc1a4('0x24')][_0xc1a4('0x133')](db['CmContact'],{'as':'Contact','foreignKey':_0xc1a4('0x16a')});db['MailServerIn']['belongsTo'](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x3d'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x3b')][_0xc1a4('0x133')](db[_0xc1a4('0x111')],{'as':_0xc1a4('0x111'),'foreignKey':_0xc1a4('0x16c'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x16e')][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x3d'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x16e')][_0xc1a4('0x133')](db[_0xc1a4('0x111')],{'as':_0xc1a4('0x111'),'foreignKey':_0xc1a4('0x16c'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x3d')]['hasOne'](db[_0xc1a4('0x3b')],{'as':_0xc1a4('0x16f'),'onDelete':_0xc1a4('0x11d')});db['MailAccount'][_0xc1a4('0x11c')](db[_0xc1a4('0x16e')],{'as':'Smtp','onDelete':'cascade'});db[_0xc1a4('0x3d')][_0xc1a4('0x121')](db[_0xc1a4('0x84')],{'as':'Dispositions','foreignKey':_0xc1a4('0x16b'),'onDelete':'cascade'});db[_0xc1a4('0x3d')][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':_0xc1a4('0x171'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x3d')]['hasMany'](db[_0xc1a4('0x44')],{'as':_0xc1a4('0x164'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x3d')][_0xc1a4('0x121')](db[_0xc1a4('0x42')],{'as':_0xc1a4('0x172')});db['MailAccount'][_0xc1a4('0x121')](db[_0xc1a4('0x173')],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x16b'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x3d')][_0xc1a4('0x133')](db['CmList'],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x3d')][_0xc1a4('0x133')](db['Template'],{'as':_0xc1a4('0x98'),'foreignKey':_0xc1a4('0x176')});db[_0xc1a4('0x3d')]['belongsTo'](db['Pause'],{'as':_0xc1a4('0x177'),'foreignKey':_0xc1a4('0x15e')});db[_0xc1a4('0x3d')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':'user_has_mail_accounts'});db[_0xc1a4('0x3f')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x34')});db[_0xc1a4('0x3f')][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':'team_has_mail_queues','as':_0xc1a4('0x161')});db[_0xc1a4('0x42')][_0xc1a4('0x121')](db[_0xc1a4('0x44')],{'as':'Messages','onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x178')});db['MailInteraction'][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x42')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db['MailInteraction'][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17b'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x42')][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':_0xc1a4('0x17d'),'as':_0xc1a4('0x17e')});db['MailInteraction'][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':_0xc1a4('0x17d'),'as':'ThroughTags'});db['MailInteraction'][_0xc1a4('0x135')](db['User'],{'as':_0xc1a4('0x17f'),'through':'user_has_mail_interactions','foreignKey':_0xc1a4('0x178')});db[_0xc1a4('0x44')]['hasMany'](db[_0xc1a4('0xee')],{'as':'Attachments','onDelete':'cascade'});db[_0xc1a4('0x44')]['belongsTo'](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x11f')});db[_0xc1a4('0x44')]['belongsTo'](db[_0xc1a4('0x74')],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x17a')});db[_0xc1a4('0x44')]['belongsTo'](db[_0xc1a4('0x42')],{'as':_0xc1a4('0x180'),'foreignKey':_0xc1a4('0x178')});db[_0xc1a4('0x44')][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x179'),'foreignKey':'MailAccountId'});db[_0xc1a4('0x44')][_0xc1a4('0x133')](db[_0xc1a4('0x148')],{'as':_0xc1a4('0x148'),'foreignKey':'ChatWebsiteId'});db[_0xc1a4('0x44')][_0xc1a4('0x133')](db[_0xc1a4('0x6b')],{'as':_0xc1a4('0x6b'),'foreignKey':'ChatOfflineMessageId'});db[_0xc1a4('0x173')][_0xc1a4('0x133')](db['User'],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x173')]['belongsTo'](db[_0xc1a4('0x3f')],{'onDelete':_0xc1a4('0x16d')});db['MailApplication'][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'onDelete':_0xc1a4('0x16d')});db['MailApplication'][_0xc1a4('0x133')](db[_0xc1a4('0x88')],{'onDelete':'restrict','foreignKey':_0xc1a4('0x15d')});db[_0xc1a4('0x173')][_0xc1a4('0x133')](db[_0xc1a4('0x17c')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x181')});db['MailQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{});db[_0xc1a4('0x46')]['belongsTo'](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':'ListId'});db[_0xc1a4('0x46')][_0xc1a4('0x133')](db['CmContact'],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x46')][_0xc1a4('0x133')](db[_0xc1a4('0x42')],{});db[_0xc1a4('0x46')][_0xc1a4('0x133')](db[_0xc1a4('0x44')],{});db[_0xc1a4('0x46')][_0xc1a4('0x133')](db['User'],{});db[_0xc1a4('0x46')]['belongsTo'](db[_0xc1a4('0x3f')],{});db[_0xc1a4('0x182')]['hasMany'](db[_0xc1a4('0x183')],{'as':'Items','onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x49')][_0xc1a4('0x121')](db['Disposition'],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x185'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x49')][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':'Answers','foreignKey':_0xc1a4('0x185')});db[_0xc1a4('0x49')][_0xc1a4('0x121')](db[_0xc1a4('0x4c')],{'as':_0xc1a4('0x172')});db['FaxAccount']['hasMany'](db[_0xc1a4('0x4a')],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x185'),'onDelete':_0xc1a4('0x11d')});db['FaxAccount']['hasMany'](db[_0xc1a4('0x124')],{'as':_0xc1a4('0x186'),'onDelete':_0xc1a4('0x11d')});db['FaxAccount']['hasMany'](db[_0xc1a4('0x187')],{'as':_0xc1a4('0x164')});db[_0xc1a4('0x49')][_0xc1a4('0x133')](db[_0xc1a4('0x2b')],{'as':_0xc1a4('0x2b')});db['FaxAccount'][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':'List','foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x49')]['belongsTo'](db[_0xc1a4('0x8a')],{'as':_0xc1a4('0x177'),'foreignKey':_0xc1a4('0x15e')});db['FaxAccount'][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x14b')});db[_0xc1a4('0x4a')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x4a')]['belongsTo'](db[_0xc1a4('0x4f')],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x4a')][_0xc1a4('0x133')](db['FaxAccount'],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x4a')][_0xc1a4('0x133')](db[_0xc1a4('0x17c')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':'TagId'});db[_0xc1a4('0x4c')][_0xc1a4('0x121')](db[_0xc1a4('0x187')],{'as':_0xc1a4('0x164'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x188')});db['FaxInteraction'][_0xc1a4('0x133')](db[_0xc1a4('0x49')],{'as':_0xc1a4('0x179'),'foreignKey':'FaxAccountId'});db[_0xc1a4('0x4c')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db['FaxInteraction']['belongsTo'](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17b'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x4c')]['belongsToMany'](db[_0xc1a4('0x17c')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0xc1a4('0x4c')][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x189'),'as':_0xc1a4('0x18a')});db[_0xc1a4('0x4c')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17f'),'through':_0xc1a4('0x13d'),'foreignKey':_0xc1a4('0x188')});db[_0xc1a4('0x187')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x11f')});db['FaxMessage'][_0xc1a4('0x133')](db[_0xc1a4('0x4c')],{'as':_0xc1a4('0x180'),'foreignKey':_0xc1a4('0x188')});db['FaxMessage'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x17a')});db[_0xc1a4('0x187')][_0xc1a4('0x133')](db[_0xc1a4('0xee')],{'as':_0xc1a4('0xee'),'foreignKey':_0xc1a4('0x18b')});db[_0xc1a4('0x187')][_0xc1a4('0x133')](db[_0xc1a4('0x49')],{'as':'Account','foreignKey':_0xc1a4('0x185')});db[_0xc1a4('0x4f')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x36')});db[_0xc1a4('0x4f')][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':_0xc1a4('0x18c'),'as':_0xc1a4('0x161')});db[_0xc1a4('0x51')]['belongsTo'](db[_0xc1a4('0x49')],{});db[_0xc1a4('0x51')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x51')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x51')]['belongsTo'](db['FaxInteraction'],{});db[_0xc1a4('0x51')][_0xc1a4('0x133')](db[_0xc1a4('0x187')],{});db[_0xc1a4('0x51')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{});db[_0xc1a4('0x51')][_0xc1a4('0x133')](db[_0xc1a4('0x4f')],{});db[_0xc1a4('0x53')]['hasMany'](db[_0xc1a4('0x84')],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x18d'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x53')][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':_0xc1a4('0x171'),'foreignKey':_0xc1a4('0x18d')});db[_0xc1a4('0x53')][_0xc1a4('0x121')](db[_0xc1a4('0x59')],{'as':_0xc1a4('0x164'),'foreignKey':_0xc1a4('0x18d')});db['SmsAccount'][_0xc1a4('0x121')](db[_0xc1a4('0x57')],{'as':'Interactions'});db[_0xc1a4('0x53')][_0xc1a4('0x121')](db[_0xc1a4('0x55')],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x18d'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x53')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':'List','foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x53')][_0xc1a4('0x133')](db[_0xc1a4('0x8a')],{'as':_0xc1a4('0x177'),'foreignKey':_0xc1a4('0x15e')});db[_0xc1a4('0x53')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':'user_has_sms_accounts'});db[_0xc1a4('0x55')]['belongsTo'](db[_0xc1a4('0x11f')],{'onDelete':'restrict'});db[_0xc1a4('0x55')][_0xc1a4('0x133')](db[_0xc1a4('0x141')],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x55')][_0xc1a4('0x133')](db[_0xc1a4('0x53')],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x55')][_0xc1a4('0x133')](db[_0xc1a4('0x88')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x15d')});db[_0xc1a4('0x55')][_0xc1a4('0x133')](db['Tag'],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x181')});db['SmsInteraction'][_0xc1a4('0x121')](db['SmsMessage'],{'as':_0xc1a4('0x164'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x18e')});db['SmsInteraction'][_0xc1a4('0x133')](db[_0xc1a4('0x53')],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x18d')});db[_0xc1a4('0x57')]['belongsTo'](db[_0xc1a4('0x74')],{'as':'Contact','foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x57')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17b'),'foreignKey':'UserId'});db['SmsInteraction'][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':'sms_interaction_has_tags','as':_0xc1a4('0x17e')});db[_0xc1a4('0x57')][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x18f'),'as':_0xc1a4('0x18a')});db[_0xc1a4('0x57')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17f'),'through':_0xc1a4('0x13e'),'foreignKey':_0xc1a4('0x18e')});db[_0xc1a4('0x59')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x11f')});db[_0xc1a4('0x59')]['belongsTo'](db['CmContact'],{'onDelete':_0xc1a4('0x11d'),'as':'Contact'});db[_0xc1a4('0x59')][_0xc1a4('0x133')](db['SmsInteraction'],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x180'),'foreignKey':_0xc1a4('0x18e')});db[_0xc1a4('0x59')][_0xc1a4('0x133')](db['SmsAccount'],{'as':_0xc1a4('0x179'),'foreignKey':'SmsAccountId'});db[_0xc1a4('0x141')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x143'),'foreignKey':_0xc1a4('0x190')});db[_0xc1a4('0x141')]['belongsToMany'](db[_0xc1a4('0x13a')],{'through':_0xc1a4('0x191'),'as':_0xc1a4('0x161')});db[_0xc1a4('0x5b')][_0xc1a4('0x121')](db['Disposition'],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x192'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x5b')][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':_0xc1a4('0x171'),'foreignKey':_0xc1a4('0x192')});db[_0xc1a4('0x5b')]['hasMany'](db[_0xc1a4('0x5f')],{'as':_0xc1a4('0x172'),'foreignKey':_0xc1a4('0x192')});db[_0xc1a4('0x5b')][_0xc1a4('0x121')](db[_0xc1a4('0x61')],{'as':_0xc1a4('0x164'),'foreignKey':_0xc1a4('0x192')});db[_0xc1a4('0x5b')][_0xc1a4('0x121')](db['OpenchannelApplication'],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x192'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x5b')][_0xc1a4('0x133')](db['CmList'],{'as':'List','foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x5b')][_0xc1a4('0x133')](db[_0xc1a4('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0xc1a4('0x15e')});db[_0xc1a4('0x5b')]['belongsToMany'](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x14f')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x5d')]['belongsTo'](db[_0xc1a4('0x62')],{'onDelete':'restrict','foreignKey':_0xc1a4('0x193')});db[_0xc1a4('0x5d')]['belongsTo'](db[_0xc1a4('0x5b')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x192')});db['OpenchannelApplication'][_0xc1a4('0x133')](db[_0xc1a4('0x88')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x15d')});db['OpenchannelApplication']['belongsTo'](db['Tag'],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x181')});db[_0xc1a4('0x5f')][_0xc1a4('0x121')](db[_0xc1a4('0x61')],{'as':_0xc1a4('0x164'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x194')});db['OpenchannelInteraction']['belongsTo'](db[_0xc1a4('0x5b')],{'as':'Account','foreignKey':_0xc1a4('0x192')});db['OpenchannelInteraction']['belongsTo'](db[_0xc1a4('0x74')],{'as':'Contact','foreignKey':_0xc1a4('0x16a')});db['OpenchannelInteraction'][_0xc1a4('0x133')](db['User'],{'as':_0xc1a4('0x17b'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x5f')][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x195'),'as':_0xc1a4('0x17e')});db[_0xc1a4('0x5f')][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':'openchannel_interaction_has_tags','as':_0xc1a4('0x18a')});db[_0xc1a4('0x5f')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':'Users','through':_0xc1a4('0x196'),'foreignKey':_0xc1a4('0x194')});db[_0xc1a4('0x61')][_0xc1a4('0x133')](db['User'],{'onDelete':'cascade','as':_0xc1a4('0x11f')});db['OpenchannelMessage'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x17a')});db['OpenchannelMessage'][_0xc1a4('0x133')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xc1a4('0x194')});db['OpenchannelMessage'][_0xc1a4('0x133')](db[_0xc1a4('0xee')],{'as':_0xc1a4('0xee'),'foreignKey':_0xc1a4('0x18b')});db[_0xc1a4('0x61')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xc1a4('0x179'),'foreignKey':'OpenchannelAccountId'});db[_0xc1a4('0x62')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite']['hasMany'](db[_0xc1a4('0x84')],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x197'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x148')][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':'Answers','foreignKey':_0xc1a4('0x197')});db[_0xc1a4('0x148')]['hasMany'](db['ChatProactiveAction'],{'as':_0xc1a4('0x198')});db['ChatWebsite'][_0xc1a4('0x121')](db[_0xc1a4('0x67')],{'as':'Interactions'});db[_0xc1a4('0x148')]['hasMany'](db[_0xc1a4('0x199')],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x197'),'onDelete':_0xc1a4('0x11d')});db['ChatWebsite'][_0xc1a4('0x121')](db[_0xc1a4('0x69')],{'as':_0xc1a4('0x164')});db[_0xc1a4('0x148')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':'List','foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x148')][_0xc1a4('0x133')](db[_0xc1a4('0x88')],{'as':'Interval','foreignKey':_0xc1a4('0x15d')});db[_0xc1a4('0x148')][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'as':_0xc1a4('0x3d'),'foreignKey':_0xc1a4('0x16b')});db[_0xc1a4('0x148')]['belongsTo'](db['Pause'],{'as':_0xc1a4('0x177'),'foreignKey':_0xc1a4('0x15e')});db[_0xc1a4('0x148')]['belongsToMany'](db['User'],{'as':_0xc1a4('0x160'),'through':'user_has_chat_websites'});db[_0xc1a4('0x19a')][_0xc1a4('0x133')](db[_0xc1a4('0x5b')],{});db['OpenchannelQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':'List','foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x19a')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db['OpenchannelQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x5f')],{});db[_0xc1a4('0x19a')][_0xc1a4('0x133')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{});db[_0xc1a4('0x19a')][_0xc1a4('0x133')](db[_0xc1a4('0x62')],{});db[_0xc1a4('0x199')][_0xc1a4('0x133')](db['User'],{'as':_0xc1a4('0x19b'),'foreignKey':_0xc1a4('0x11e'),'onDelete':'restrict'});db[_0xc1a4('0x199')][_0xc1a4('0x133')](db[_0xc1a4('0x6d')],{'as':_0xc1a4('0x19c'),'foreignKey':'ChatQueueId','onDelete':_0xc1a4('0x16d')});db['ChatApplication']['belongsTo'](db[_0xc1a4('0x148')],{'as':_0xc1a4('0x19d'),'foreignKey':_0xc1a4('0x197'),'onDelete':'restrict'});db[_0xc1a4('0x199')][_0xc1a4('0x133')](db[_0xc1a4('0x17c')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x181')});db['ChatInteraction']['hasMany'](db[_0xc1a4('0x69')],{'as':_0xc1a4('0x164'),'onDelete':'cascade','foreignKey':_0xc1a4('0x19e')});db[_0xc1a4('0x67')][_0xc1a4('0x133')](db['ChatWebsite'],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x197')});db[_0xc1a4('0x67')]['belongsTo'](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db['ChatInteraction'][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17b'),'foreignKey':_0xc1a4('0x11e')});db[_0xc1a4('0x67')][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':_0xc1a4('0x19f'),'as':_0xc1a4('0x17e')});db['ChatInteraction']['belongsToMany'](db[_0xc1a4('0x17c')],{'through':_0xc1a4('0x19f'),'as':_0xc1a4('0x18a')});db[_0xc1a4('0x67')][_0xc1a4('0x135')](db['User'],{'as':_0xc1a4('0x17f'),'through':_0xc1a4('0x1a0'),'foreignKey':_0xc1a4('0x19e')});db['ChatMessage'][_0xc1a4('0x133')](db['User'],{'onDelete':_0xc1a4('0x11d'),'as':'User'});db[_0xc1a4('0x69')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'onDelete':'cascade','as':_0xc1a4('0x17a'),'foreignKey':'ContactId'});db[_0xc1a4('0x69')][_0xc1a4('0x133')](db[_0xc1a4('0x67')],{'onDelete':'cascade','as':_0xc1a4('0x180'),'foreignKey':_0xc1a4('0x19e')});db[_0xc1a4('0x69')][_0xc1a4('0x133')](db[_0xc1a4('0xee')],{'as':'Attachment','foreignKey':_0xc1a4('0x18b')});db[_0xc1a4('0x69')][_0xc1a4('0x133')](db[_0xc1a4('0x148')],{'as':_0xc1a4('0x179'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xc1a4('0x121')](db[_0xc1a4('0xee')],{'as':'Attachments','foreignKey':_0xc1a4('0x1a1'),'onDelete':_0xc1a4('0x11d'),'hooks':!![]});db['ChatOfflineMessage'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'onDelete':_0xc1a4('0x11d'),'as':'Contact','foreignKey':'ContactId'});db[_0xc1a4('0x6b')][_0xc1a4('0x133')](db['ChatWebsite'],{'as':_0xc1a4('0x179'),'foreignKey':'ChatWebsiteId'});db[_0xc1a4('0x6d')]['belongsToMany'](db['User'],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x33'),'hooks':!![]});db['ChatQueue'][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':'team_has_chat_queues','as':_0xc1a4('0x161')});db[_0xc1a4('0x6f')][_0xc1a4('0x121')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0xc1a4('0x11d')});db['ChatGroup'][_0xc1a4('0x135')](db['User'],{'as':'Members','through':_0xc1a4('0x137')});db['ChatProactiveAction'][_0xc1a4('0x133')](db[_0xc1a4('0x148')],{'as':_0xc1a4('0x19d'),'foreignKey':'ChatWebsiteId'});db[_0xc1a4('0x72')][_0xc1a4('0x121')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x138'),'foreignKey':_0xc1a4('0x1a2')});db[_0xc1a4('0x74')][_0xc1a4('0x121')](db[_0xc1a4('0x95')],{'as':_0xc1a4('0x1a3'),'foreignKey':_0xc1a4('0x1a4')});db[_0xc1a4('0x74')][_0xc1a4('0x121')](db[_0xc1a4('0x75')],{'as':_0xc1a4('0x131'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x74')][_0xc1a4('0x121')](db[_0xc1a4('0x79')],{'as':_0xc1a4('0x126'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x74')][_0xc1a4('0x121')](db[_0xc1a4('0x7b')],{'as':_0xc1a4('0x1a5'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x74')]['hasMany'](db[_0xc1a4('0x128')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xc1a4('0x74')][_0xc1a4('0x121')](db[_0xc1a4('0xda')],{'as':_0xc1a4('0x15a'),'foreignKey':_0xc1a4('0x16a')});db['CmContact'][_0xc1a4('0x121')](db[_0xc1a4('0x5f')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x74')]['hasMany'](db[_0xc1a4('0x67')],{'as':_0xc1a4('0x12a'),'foreignKey':_0xc1a4('0x16a'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x74')]['hasMany'](db[_0xc1a4('0x57')],{'as':_0xc1a4('0x12b'),'foreignKey':'ContactId','onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x74')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xc1a4('0x16d')});db['CmContact'][_0xc1a4('0x121')](db[_0xc1a4('0x42')],{'as':_0xc1a4('0x12d'),'foreignKey':_0xc1a4('0x16a'),'onDelete':'restrict'});db[_0xc1a4('0x74')][_0xc1a4('0x133')](db[_0xc1a4('0x72')],{'as':_0xc1a4('0x1a6'),'foreignKey':_0xc1a4('0x1a2')});db[_0xc1a4('0x74')]['belongsTo'](db['CmList'],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175'),'onDelete':'cascade'});db[_0xc1a4('0x74')]['belongsToMany'](db['User'],{'as':_0xc1a4('0x17f'),'through':_0xc1a4('0x1a7')});db['CmContact'][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'as':_0xc1a4('0x17e'),'through':'cm_contact_has_tags'});db[_0xc1a4('0x74')][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x1a8'),'as':_0xc1a4('0x18a')});db[_0xc1a4('0x75')]['hasMany'](db[_0xc1a4('0x97')],{'as':_0xc1a4('0x1a9'),'foreignKey':_0xc1a4('0x1aa')});db[_0xc1a4('0x75')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x75')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':'ListId','onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x75')][_0xc1a4('0x133')](db['User'],{'as':'Agent','foreignKey':_0xc1a4('0x11e')});db['CmHopper'][_0xc1a4('0x133')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xc1a4('0x158'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x75')][_0xc1a4('0x133')](db[_0xc1a4('0xeb')],{'as':'Campaign','foreignKey':_0xc1a4('0x1ab'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x75')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17b'),'foreignKey':_0xc1a4('0x1ac')});db['CmHopperBlack'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':'Contact','foreignKey':_0xc1a4('0x16a'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x77')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175'),'onDelete':_0xc1a4('0x11d')});db['CmHopperBlack'][_0xc1a4('0x133')](db[_0xc1a4('0x1c')],{'as':_0xc1a4('0x19c'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc1a4('0x77')][_0xc1a4('0x133')](db[_0xc1a4('0xeb')],{'as':'Campaign','foreignKey':_0xc1a4('0x1ab'),'onDelete':'cascade'});db[_0xc1a4('0x81')][_0xc1a4('0x121')](db['Condition'],{'as':{'plural':_0xc1a4('0x1ad'),'singular':'OneAll'},'foreignKey':_0xc1a4('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0xc1a4('0x81')][_0xc1a4('0x121')](db[_0xc1a4('0x86')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xc1a4('0x11d'),'hooks':!![]});db[_0xc1a4('0x81')][_0xc1a4('0x121')](db[_0xc1a4('0x7f')],{'as':_0xc1a4('0x1af'),'foreignKey':_0xc1a4('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0xc1a4('0x84')]['hasMany'](db[_0xc1a4('0x84')],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x1b1'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x88')][_0xc1a4('0x121')](db[_0xc1a4('0x88')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xc1a4('0x11d'),'hooks':!![],'required':![]});db[_0xc1a4('0x88')][_0xc1a4('0x121')](db['VoiceExtension'],{'as':_0xc1a4('0x125'),'foreignKey':'IntervalId','onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x88')][_0xc1a4('0x121')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xc1a4('0x15d')});db[_0xc1a4('0x88')][_0xc1a4('0x121')](db[_0xc1a4('0x199')],{'as':_0xc1a4('0x1b2'),'foreignKey':'IntervalId'});db[_0xc1a4('0x88')][_0xc1a4('0x121')](db[_0xc1a4('0x4a')],{'as':_0xc1a4('0x1b3'),'foreignKey':_0xc1a4('0x15d')});db['Interval'][_0xc1a4('0x121')](db['SmsApplication'],{'as':_0xc1a4('0x1b4'),'foreignKey':_0xc1a4('0x15d')});db[_0xc1a4('0x8f')][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{});db[_0xc1a4('0x8f')][_0xc1a4('0x133')](db['AnalyticDefaultReport'],{'foreignKey':_0xc1a4('0x1b5')});db['Schedule'][_0xc1a4('0x133')](db['AnalyticCustomReport'],{'foreignKey':_0xc1a4('0x1b6')});db[_0xc1a4('0x91')][_0xc1a4('0x135')](db[_0xc1a4('0x1a')],{'as':_0xc1a4('0x1b7'),'through':_0xc1a4('0x1b8'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x17c')]['belongsToMany'](db[_0xc1a4('0x74')],{'through':_0xc1a4('0x1a8')});db[_0xc1a4('0x17c')][_0xc1a4('0x135')](db[_0xc1a4('0x67')],{'through':_0xc1a4('0x19f')});db[_0xc1a4('0x17c')]['belongsToMany'](db['MailInteraction'],{'through':_0xc1a4('0x17d')});db[_0xc1a4('0x17c')][_0xc1a4('0x135')](db[_0xc1a4('0x57')],{'through':_0xc1a4('0x18f')});db[_0xc1a4('0x17c')][_0xc1a4('0x135')](db[_0xc1a4('0x4c')],{'through':_0xc1a4('0x189')});db[_0xc1a4('0x17c')]['belongsToMany'](db[_0xc1a4('0x5f')],{'through':_0xc1a4('0x195')});db[_0xc1a4('0x17c')]['belongsToMany'](db[_0xc1a4('0x109')],{'through':_0xc1a4('0x1b9')});db[_0xc1a4('0x95')][_0xc1a4('0x133')](db[_0xc1a4('0x94')],{'as':_0xc1a4('0x1ba'),'foreignKey':_0xc1a4('0x1bb')});db[_0xc1a4('0x97')][_0xc1a4('0x133')](db[_0xc1a4('0x75')],{'as':_0xc1a4('0x1bc'),'foreignKey':_0xc1a4('0x1aa')});db['CmContactHasItem'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':'Contact','foreignKey':_0xc1a4('0x1a4')});db[_0xc1a4('0x1bd')][_0xc1a4('0x121')](db[_0xc1a4('0x86')],{'as':{'plural':_0xc1a4('0x1be'),'singular':_0xc1a4('0x1bf')},'foreignKey':_0xc1a4('0x1c0'),'onDelete':_0xc1a4('0x11d'),'hooks':!![]});db[_0xc1a4('0x1bd')]['hasMany'](db[_0xc1a4('0x86')],{'as':{'plural':_0xc1a4('0x1c1'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xc1a4('0x1bd')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0xc1a4('0x1c2'),'onDelete':'cascade','hooks':!![]});db[_0xc1a4('0x9f')][_0xc1a4('0x121')](db['AnalyticFieldReport'],{'as':_0xc1a4('0x1c3'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xc1a4('0xa1')][_0xc1a4('0x121')](db['AnalyticFieldReport'],{'as':_0xc1a4('0x1c3'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'DefaultReportId'});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc1a4('0x1c4')});db['AnalyticFieldReport'][_0xc1a4('0x133')](db[_0xc1a4('0xa4')],{'foreignKey':_0xc1a4('0x1c4')});db['SalesforceAccount'][_0xc1a4('0x121')](db[_0xc1a4('0xac')],{'as':_0xc1a4('0x1c5'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1c6')});db['SalesforceConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0x1c7')],{'as':_0xc1a4('0x1c8'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xc1a4('0xac')][_0xc1a4('0x121')](db[_0xc1a4('0x1c7')],{'as':_0xc1a4('0x1c9'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0xac')][_0xc1a4('0x121')](db[_0xc1a4('0x1c7')],{'as':'Fields','onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cb')});db['SalesforceConfiguration'][_0xc1a4('0x133')](db[_0xc1a4('0xaa')],{'as':_0xc1a4('0x179'),'foreignKey':'AccountId'});db[_0xc1a4('0x1c7')][_0xc1a4('0x121')](db[_0xc1a4('0x1c7')],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db['SalesforceField'][_0xc1a4('0x121')](db['SalesforceField'],{'as':_0xc1a4('0x1ce'),'foreignKey':'DescriptionId'});db[_0xc1a4('0x1c7')][_0xc1a4('0x121')](db[_0xc1a4('0x1c7')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db['SalesforceField'][_0xc1a4('0x133')](db['Variable'],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0xae')][_0xc1a4('0x121')](db[_0xc1a4('0x1d1')],{'as':'Configurations','onDelete':_0xc1a4('0x11d'),'foreignKey':'AccountId'});db[_0xc1a4('0x1d1')]['hasMany'](db[_0xc1a4('0xb0')],{'as':_0xc1a4('0x1c8'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0x1d1')][_0xc1a4('0x121')](db['SugarcrmField'],{'as':_0xc1a4('0x1c9'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1d1')][_0xc1a4('0x121')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1d1')][_0xc1a4('0x133')](db[_0xc1a4('0xae')],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0xb0')][_0xc1a4('0x121')](db['SugarcrmField'],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db['SugarcrmField'][_0xc1a4('0x121')](db[_0xc1a4('0xb0')],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db['SugarcrmField'][_0xc1a4('0x121')](db[_0xc1a4('0xb0')],{'as':'Field','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xb0')][_0xc1a4('0x133')](db[_0xc1a4('0x9a')],{'as':'Variable','foreignKey':_0xc1a4('0x1d0')});db['DeskAccount'][_0xc1a4('0x121')](db['DeskConfiguration'],{'as':_0xc1a4('0x1c5'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1c6')});db['DeskConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0xb4')],{'as':_0xc1a4('0x1c8'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'SubjectId'});db[_0xc1a4('0x1d2')]['hasMany'](db[_0xc1a4('0xb4')],{'as':_0xc1a4('0x1c9'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'DescriptionId'});db[_0xc1a4('0x1d2')][_0xc1a4('0x121')](db[_0xc1a4('0xb4')],{'as':_0xc1a4('0x1c3'),'onDelete':'cascade','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1d2')][_0xc1a4('0x133')](db[_0xc1a4('0xb1')],{'as':_0xc1a4('0x179'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xc1a4('0x1d3')});db[_0xc1a4('0xb4')][_0xc1a4('0x121')](db[_0xc1a4('0xb4')],{'as':'Subject','foreignKey':_0xc1a4('0x1cd')});db['DeskField'][_0xc1a4('0x121')](db[_0xc1a4('0xb4')],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db['DeskField'][_0xc1a4('0x121')](db[_0xc1a4('0xb4')],{'as':'Field','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xb4')][_0xc1a4('0x133')](db['Variable'],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0xb6')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc1a4('0x1c6')});db['ZohoConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0x1d4')],{'as':_0xc1a4('0x1c8'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0xb8')][_0xc1a4('0x121')](db[_0xc1a4('0x1d4')],{'as':_0xc1a4('0x1c9'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0xb8')]['hasMany'](db[_0xc1a4('0x1d4')],{'as':_0xc1a4('0x1c3'),'onDelete':'cascade','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xb8')][_0xc1a4('0x133')](db[_0xc1a4('0xb6')],{'as':_0xc1a4('0x179'),'foreignKey':'AccountId'});db['ZohoField'][_0xc1a4('0x121')](db[_0xc1a4('0x1d4')],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db['ZohoField'][_0xc1a4('0x121')](db[_0xc1a4('0x1d4')],{'as':'Description','foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1d4')][_0xc1a4('0x121')](db[_0xc1a4('0x1d4')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1d4')][_0xc1a4('0x133')](db[_0xc1a4('0x9a')],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0x1d5')]['hasMany'](db[_0xc1a4('0x1d6')],{'as':_0xc1a4('0x1c5'),'onDelete':'cascade','foreignKey':_0xc1a4('0x1c6')});db['ZendeskConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1c8'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0x1d6')][_0xc1a4('0x121')](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1c9'),'foreignKey':_0xc1a4('0x1ca')});db['ZendeskConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1c3'),'foreignKey':_0xc1a4('0x1cb')});db['ZendeskConfiguration'][_0xc1a4('0x133')](db[_0xc1a4('0x1d5')],{'as':'Account','foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0x1d6')]['belongsToMany'](db[_0xc1a4('0x17c')],{'through':'int_zendesk_configuration_has_tags'});db[_0xc1a4('0xbc')]['hasMany'](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0xbc')][_0xc1a4('0x121')](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0xbc')][_0xc1a4('0x121')](db[_0xc1a4('0xbc')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db['ZendeskField']['belongsTo'](db[_0xc1a4('0x9a')],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0xbd')]['hasMany'](db[_0xc1a4('0x1d7')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0x1d7')]['hasMany'](db[_0xc1a4('0x1d8')],{'as':_0xc1a4('0x1c8'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xc1a4('0x1d7')][_0xc1a4('0x121')](db[_0xc1a4('0x1d8')],{'as':'Descriptions','onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1d7')]['hasMany'](db[_0xc1a4('0x1d8')],{'as':_0xc1a4('0x1c3'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1d7')]['belongsTo'](db[_0xc1a4('0xbd')],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0x1d7')][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x1d9')});db[_0xc1a4('0x1d8')][_0xc1a4('0x121')](db[_0xc1a4('0x1d8')],{'as':_0xc1a4('0x1cc'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xc1a4('0x121')](db[_0xc1a4('0x1d8')],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1d8')][_0xc1a4('0x121')](db[_0xc1a4('0x1d8')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1d8')][_0xc1a4('0x133')](db[_0xc1a4('0x9a')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc1a4('0x1da')][_0xc1a4('0x121')](db[_0xc1a4('0xc0')],{'as':'Configurations','onDelete':_0xc1a4('0x11d'),'foreignKey':'AccountId'});db[_0xc1a4('0xc0')][_0xc1a4('0x121')](db[_0xc1a4('0x1db')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xc1a4('0xc0')]['hasMany'](db[_0xc1a4('0x1db')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xc1a4('0xc0')][_0xc1a4('0x121')](db[_0xc1a4('0x1db')],{'as':_0xc1a4('0x1c3'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xc0')][_0xc1a4('0x133')](db['VtigerAccount'],{'as':_0xc1a4('0x179'),'foreignKey':'AccountId'});db[_0xc1a4('0x1db')][_0xc1a4('0x121')](db['VtigerField'],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0x1db')][_0xc1a4('0x121')](db['VtigerField'],{'as':'Description','foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1db')][_0xc1a4('0x121')](db[_0xc1a4('0x1db')],{'as':'Field','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0x1db')]['belongsTo'](db['Variable'],{'as':_0xc1a4('0x9a'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0xc1a4('0x121')](db[_0xc1a4('0x1dc')],{'as':_0xc1a4('0x1c5'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'AccountId'});db[_0xc1a4('0x1dc')][_0xc1a4('0x121')](db[_0xc1a4('0xc4')],{'as':_0xc1a4('0x1c8'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0x1dc')][_0xc1a4('0x121')](db[_0xc1a4('0xc4')],{'as':_0xc1a4('0x1c9'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1dc')]['hasMany'](db[_0xc1a4('0xc4')],{'as':_0xc1a4('0x1c3'),'foreignKey':_0xc1a4('0x1cb')});db['ServicenowConfiguration'][_0xc1a4('0x133')](db[_0xc1a4('0xc2')],{'as':'Account','foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0xc4')][_0xc1a4('0x121')](db[_0xc1a4('0xc4')],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0xc4')][_0xc1a4('0x121')](db['ServicenowField'],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0xc4')][_0xc1a4('0x121')](db[_0xc1a4('0xc4')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xc4')][_0xc1a4('0x133')](db[_0xc1a4('0x9a')],{'as':_0xc1a4('0x9a'),'foreignKey':'VariableId'});db[_0xc1a4('0xc6')]['hasMany'](db[_0xc1a4('0xc8')],{'as':'Configurations','onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1c6')});db[_0xc1a4('0xc6')][_0xc1a4('0x133')](db[_0xc1a4('0x111')],{'as':_0xc1a4('0x111'),'foreignKey':_0xc1a4('0x16c')});db[_0xc1a4('0xc8')]['hasMany'](db[_0xc1a4('0x1dd')],{'as':_0xc1a4('0x1c8'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0xc8')]['hasMany'](db['Dynamics365Field'],{'as':_0xc1a4('0x1c9'),'onDelete':_0xc1a4('0x11d'),'foreignKey':'DescriptionId'});db[_0xc1a4('0xc8')][_0xc1a4('0x121')](db[_0xc1a4('0x1dd')],{'as':_0xc1a4('0x1c3'),'onDelete':'cascade','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xc8')][_0xc1a4('0x133')](db['Dynamics365Account'],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x1c6')});db['Dynamics365Field'][_0xc1a4('0x121')](db[_0xc1a4('0x1dd')],{'as':_0xc1a4('0x1cc'),'foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0x1dd')][_0xc1a4('0x121')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0xc1a4('0x1ca')});db[_0xc1a4('0x1dd')][_0xc1a4('0x121')](db[_0xc1a4('0x1dd')],{'as':_0xc1a4('0x1cf'),'foreignKey':_0xc1a4('0x1cb')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0xcb')][_0xc1a4('0x121')](db[_0xc1a4('0xcd')],{'as':'Configurations','onDelete':_0xc1a4('0x11d'),'foreignKey':'AccountId'});db[_0xc1a4('0xcd')]['hasMany'](db[_0xc1a4('0xcf')],{'as':'Subjects','foreignKey':_0xc1a4('0x1cd')});db[_0xc1a4('0xcd')][_0xc1a4('0x121')](db[_0xc1a4('0xcf')],{'as':_0xc1a4('0x1c9'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0xc1a4('0x121')](db[_0xc1a4('0xcf')],{'as':_0xc1a4('0x1c3'),'foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xcd')][_0xc1a4('0x133')](db[_0xc1a4('0xcb')],{'as':_0xc1a4('0x179'),'foreignKey':'AccountId'});db[_0xc1a4('0xcf')]['hasMany'](db[_0xc1a4('0xcf')],{'as':_0xc1a4('0x1cc'),'foreignKey':'SubjectId'});db[_0xc1a4('0xcf')][_0xc1a4('0x121')](db[_0xc1a4('0xcf')],{'as':_0xc1a4('0x1ce'),'foreignKey':_0xc1a4('0x1ca')});db['FreshsalesField'][_0xc1a4('0x121')](db[_0xc1a4('0xcf')],{'as':'Field','foreignKey':_0xc1a4('0x1cb')});db[_0xc1a4('0xcf')][_0xc1a4('0x133')](db['Variable'],{'as':_0xc1a4('0x9a'),'foreignKey':_0xc1a4('0x1d0')});db[_0xc1a4('0xd3')][_0xc1a4('0x133')](db['ChatWebsite'],{});db[_0xc1a4('0xd3')]['belongsTo'](db['CmList'],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175')});db['ChatQueueReport'][_0xc1a4('0x133')](db['CmContact'],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0xd3')][_0xc1a4('0x133')](db[_0xc1a4('0x67')],{});db[_0xc1a4('0xd3')][_0xc1a4('0x133')](db['ChatMessage'],{});db[_0xc1a4('0xd3')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{});db['ChatQueueReport']['belongsTo'](db['ChatQueue'],{});db[_0xc1a4('0xd5')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x1de')});db[_0xc1a4('0xd5')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'onDelete':_0xc1a4('0x11d'),'foreignKey':'ToId'});db[_0xc1a4('0xda')][_0xc1a4('0x121')](db[_0xc1a4('0xd8')],{'foreignKey':_0xc1a4('0x1df'),'onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0xda')]['hasMany'](db[_0xc1a4('0xd7')],{'foreignKey':_0xc1a4('0x1df'),'onDelete':_0xc1a4('0x11d')});db['SmsQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x53')],{});db[_0xc1a4('0x1e0')][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':'ContactId'});db[_0xc1a4('0x1e0')][_0xc1a4('0x133')](db[_0xc1a4('0x57')],{});db[_0xc1a4('0x1e0')][_0xc1a4('0x133')](db[_0xc1a4('0x59')],{});db[_0xc1a4('0x1e0')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{});db['SmsQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x141')],{});db[_0xc1a4('0x1e1')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0xc1a4('0x1e2')});db[_0xc1a4('0x1e1')]['hasMany'](db[_0xc1a4('0xd8')],{'foreignKey':_0xc1a4('0x1e2')});db[_0xc1a4('0x1e1')][_0xc1a4('0x121')](db[_0xc1a4('0xd7')],{'foreignKey':'ProjectId'});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db['User'],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x13b')});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db[_0xc1a4('0x1c')],{'through':'TeamVoiceQueue','as':_0xc1a4('0x1e3')});db[_0xc1a4('0x13a')]['belongsToMany'](db[_0xc1a4('0x3f')],{'through':_0xc1a4('0x1e4'),'as':'MailQueues'});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db['ChatQueue'],{'through':_0xc1a4('0x1e5'),'as':_0xc1a4('0x140')});db['Team']['belongsToMany'](db[_0xc1a4('0x4f')],{'through':_0xc1a4('0x18c'),'as':_0xc1a4('0x1e6')});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db[_0xc1a4('0x141')],{'through':_0xc1a4('0x191'),'as':_0xc1a4('0x142')});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db[_0xc1a4('0x62')],{'through':_0xc1a4('0x1e7'),'as':_0xc1a4('0x1e8')});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db[_0xc1a4('0x10f')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xc1a4('0x13a')][_0xc1a4('0x135')](db['VoicePrefix'],{'through':_0xc1a4('0x115'),'as':'VoicePrefixes'});db[_0xc1a4('0xeb')][_0xc1a4('0x121')](db[_0xc1a4('0x75')],{'as':_0xc1a4('0x131'),'foreignKey':_0xc1a4('0x1ab')});db[_0xc1a4('0xeb')][_0xc1a4('0x121')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xc1a4('0x1ab')});db[_0xc1a4('0xeb')]['hasMany'](db[_0xc1a4('0x7b')],{'as':_0xc1a4('0x1a5'),'foreignKey':'CampaignId'});db['Campaign'][_0xc1a4('0x121')](db[_0xc1a4('0x77')],{'as':_0xc1a4('0x159'),'foreignKey':_0xc1a4('0x1ab')});db[_0xc1a4('0xeb')][_0xc1a4('0x133')](db[_0xc1a4('0x2b')],{'as':_0xc1a4('0x2b'),'foreignKey':_0xc1a4('0x15b')});db[_0xc1a4('0xeb')]['belongsTo'](db[_0xc1a4('0x2b')],{'as':_0xc1a4('0x1e9'),'foreignKey':'TrunkBackupId'});db[_0xc1a4('0xeb')][_0xc1a4('0x133')](db[_0xc1a4('0x88')],{'as':_0xc1a4('0x88'),'foreignKey':_0xc1a4('0x15d')});db['Campaign'][_0xc1a4('0x133')](db['SquareProject'],{'as':_0xc1a4('0x1ea'),'foreignKey':_0xc1a4('0x1eb')});db[_0xc1a4('0xeb')][_0xc1a4('0x135')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x139'),'through':_0xc1a4('0x1ec')});db['Campaign']['belongsToMany'](db['CmList'],{'as':_0xc1a4('0x1ed'),'through':_0xc1a4('0x1ee')});db[_0xc1a4('0xee')][_0xc1a4('0x133')](db[_0xc1a4('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0xc1a4('0x1a1')});db[_0xc1a4('0xf2')][_0xc1a4('0x133')](db[_0xc1a4('0x44')],{});db['MailTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x42')],{});db['MailTransferReport']['belongsTo'](db[_0xc1a4('0x3d')],{'foreignKey':_0xc1a4('0x1ef'),'as':'FromAccount'});db[_0xc1a4('0xf2')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f0'),'as':_0xc1a4('0x1f1')});db[_0xc1a4('0xf2')]['belongsTo'](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db['MailTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x3f')],{'foreignKey':'ToMailQueueId','as':_0xc1a4('0x1f4')});db[_0xc1a4('0xf2')][_0xc1a4('0x133')](db[_0xc1a4('0x3d')],{'foreignKey':_0xc1a4('0x1f5'),'as':_0xc1a4('0x1f6')});db['ChatTransferReport'][_0xc1a4('0x133')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db[_0xc1a4('0x67')],{});db[_0xc1a4('0xf4')][_0xc1a4('0x133')](db[_0xc1a4('0x148')],{'foreignKey':_0xc1a4('0x1f7'),'as':'FromAccount'});db[_0xc1a4('0xf4')][_0xc1a4('0x133')](db['User'],{'foreignKey':_0xc1a4('0x1f0'),'as':_0xc1a4('0x1f1')});db[_0xc1a4('0xf4')][_0xc1a4('0x133')](db['User'],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db['ChatTransferReport']['belongsTo'](db[_0xc1a4('0x6d')],{'foreignKey':_0xc1a4('0x1f8'),'as':_0xc1a4('0x1f4')});db['ChatTransferReport'][_0xc1a4('0x133')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xc1a4('0x1f6')});db[_0xc1a4('0xf5')][_0xc1a4('0x133')](db['FaxMessage'],{});db[_0xc1a4('0xf5')]['belongsTo'](db[_0xc1a4('0x4c')],{});db[_0xc1a4('0xf5')][_0xc1a4('0x133')](db['FaxAccount'],{'foreignKey':_0xc1a4('0x1f9'),'as':_0xc1a4('0x1fa')});db[_0xc1a4('0xf5')][_0xc1a4('0x133')](db['User'],{'foreignKey':_0xc1a4('0x1f0'),'as':'FromAgent'});db[_0xc1a4('0xf5')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db['FaxTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x4f')],{'foreignKey':_0xc1a4('0x1fb'),'as':'ToQueue'});db[_0xc1a4('0xf5')]['belongsTo'](db[_0xc1a4('0x49')],{'foreignKey':'ToFaxAccountId','as':_0xc1a4('0x1f6')});db[_0xc1a4('0xf7')][_0xc1a4('0x133')](db[_0xc1a4('0x61')],{});db['OpenchannelTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x5f')],{});db[_0xc1a4('0xf7')][_0xc1a4('0x133')](db['OpenchannelAccount'],{'foreignKey':_0xc1a4('0x1fc'),'as':_0xc1a4('0x1fa')});db['OpenchannelTransferReport']['belongsTo'](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f0'),'as':_0xc1a4('0x1f1')});db[_0xc1a4('0xf7')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db['OpenchannelTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0xc1a4('0x1f4')});db[_0xc1a4('0xf7')][_0xc1a4('0x133')](db[_0xc1a4('0x5b')],{'foreignKey':_0xc1a4('0x1fd'),'as':_0xc1a4('0x1f6')});db[_0xc1a4('0xf9')][_0xc1a4('0x133')](db[_0xc1a4('0x59')],{});db[_0xc1a4('0xf9')]['belongsTo'](db[_0xc1a4('0x57')],{});db[_0xc1a4('0xf9')]['belongsTo'](db[_0xc1a4('0x53')],{'foreignKey':'FromSmsAccountId','as':_0xc1a4('0x1fa')});db['SmsTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f0'),'as':_0xc1a4('0x1f1')});db[_0xc1a4('0xf9')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db['SmsTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x141')],{'foreignKey':_0xc1a4('0x1fe'),'as':'ToQueue'});db['SmsTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x53')],{'foreignKey':_0xc1a4('0x1ff'),'as':_0xc1a4('0x1f6')});db['CmList']['hasMany'](db[_0xc1a4('0x84')],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x175'),'onDelete':'cascade'});db[_0xc1a4('0xfb')][_0xc1a4('0x121')](db[_0xc1a4('0x200')],{'as':'CustomFields','foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':_0xc1a4('0x138'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0xfb')][_0xc1a4('0x121')](db[_0xc1a4('0x79')],{'as':_0xc1a4('0x126'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0xfb')]['hasMany'](db[_0xc1a4('0x7b')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xc1a4('0xfb')]['hasMany'](db[_0xc1a4('0x128')],{'as':_0xc1a4('0x128'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0xfb')]['belongsToMany'](db[_0xc1a4('0x1c')],{'as':_0xc1a4('0x201'),'through':'voice_queues_has_cm_lists'});db[_0xc1a4('0xfb')]['belongsToMany'](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x147')});db['VoicePrefix'][_0xc1a4('0x121')](db[_0xc1a4('0x124')],{'as':_0xc1a4('0x125'),'onDelete':_0xc1a4('0x11d')});db['VoicePrefix'][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x117')});db[_0xc1a4('0xfd')][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':'TeamVoicePrefix','as':_0xc1a4('0x161')});db[_0xc1a4('0xff')][_0xc1a4('0x121')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x17f'),'foreignKey':_0xc1a4('0x134')});db[_0xc1a4('0xff')][_0xc1a4('0x121')](db[_0xc1a4('0x202')],{'as':_0xc1a4('0x203'),'foreignKey':_0xc1a4('0x134'),'onDelete':_0xc1a4('0x11d')});db['UserProfileSection'][_0xc1a4('0x121')](db[_0xc1a4('0x102')],{'as':_0xc1a4('0x204'),'foreignKey':'sectionId','onDelete':_0xc1a4('0x11d')});db[_0xc1a4('0x106')][_0xc1a4('0x121')](db['Disposition'],{'as':_0xc1a4('0x184'),'foreignKey':_0xc1a4('0x205'),'onDelete':_0xc1a4('0x11d')});db['WhatsappAccount'][_0xc1a4('0x121')](db[_0xc1a4('0x170')],{'as':'Answers','foreignKey':_0xc1a4('0x205')});db[_0xc1a4('0x106')][_0xc1a4('0x121')](db[_0xc1a4('0x10a')],{'as':_0xc1a4('0x164'),'foreignKey':_0xc1a4('0x205')});db[_0xc1a4('0x106')]['hasMany'](db[_0xc1a4('0x109')],{'as':'Interactions'});db[_0xc1a4('0x106')]['hasMany'](db['WhatsappApplication'],{'as':_0xc1a4('0x155'),'foreignKey':_0xc1a4('0x205'),'onDelete':'cascade'});db['WhatsappAccount'][_0xc1a4('0x133')](db['CmList'],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175')});db[_0xc1a4('0x106')][_0xc1a4('0x133')](db[_0xc1a4('0x8a')],{'as':_0xc1a4('0x177'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':'Agents','through':_0xc1a4('0x206')});db[_0xc1a4('0x108')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'onDelete':'restrict'});db[_0xc1a4('0x108')]['belongsTo'](db[_0xc1a4('0x10f')],{'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x108')]['belongsTo'](db['WhatsappAccount'],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0xc1a4('0x16d'),'foreignKey':'IntervalId'});db[_0xc1a4('0x108')][_0xc1a4('0x133')](db[_0xc1a4('0x17c')],{'onDelete':_0xc1a4('0x16d'),'foreignKey':_0xc1a4('0x181')});db['WhatsappInteraction'][_0xc1a4('0x121')](db['WhatsappMessage'],{'as':_0xc1a4('0x164'),'onDelete':_0xc1a4('0x11d'),'foreignKey':_0xc1a4('0x207')});db['WhatsappInteraction']['belongsTo'](db[_0xc1a4('0x106')],{'as':_0xc1a4('0x179'),'foreignKey':_0xc1a4('0x205')});db[_0xc1a4('0x109')][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':_0xc1a4('0x16a')});db[_0xc1a4('0x109')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':'Owner','foreignKey':'UserId'});db[_0xc1a4('0x109')][_0xc1a4('0x135')](db[_0xc1a4('0x17c')],{'through':_0xc1a4('0x1b9'),'as':'Tags'});db['WhatsappInteraction'][_0xc1a4('0x135')](db['Tag'],{'through':_0xc1a4('0x1b9'),'as':_0xc1a4('0x18a')});db['WhatsappInteraction']['belongsToMany'](db[_0xc1a4('0x11f')],{'as':'Users','through':_0xc1a4('0x13f'),'foreignKey':_0xc1a4('0x207')});db[_0xc1a4('0x10a')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x11f')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xc1a4('0x11d'),'as':_0xc1a4('0x17a')});db[_0xc1a4('0x10a')][_0xc1a4('0x133')](db[_0xc1a4('0x109')],{'onDelete':_0xc1a4('0x11d'),'as':'Interaction','foreignKey':_0xc1a4('0x207')});db[_0xc1a4('0x10a')]['belongsTo'](db[_0xc1a4('0x106')],{'as':'Account','foreignKey':_0xc1a4('0x205')});db[_0xc1a4('0x10b')][_0xc1a4('0x133')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0xfb')],{'as':_0xc1a4('0x174'),'foreignKey':_0xc1a4('0x175')});db['WhatsappQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x74')],{'as':_0xc1a4('0x17a'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x109')],{});db[_0xc1a4('0x10b')][_0xc1a4('0x133')](db[_0xc1a4('0x10f')],{});db['WhatsappQueueReport'][_0xc1a4('0x133')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{});db['WhatsappTransferReport'][_0xc1a4('0x133')](db[_0xc1a4('0x10a')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xc1a4('0x109')],{});db[_0xc1a4('0x10d')][_0xc1a4('0x133')](db['WhatsappAccount'],{'foreignKey':_0xc1a4('0x208'),'as':_0xc1a4('0x1fa')});db['WhatsappTransferReport'][_0xc1a4('0x133')](db['WhatsappAccount'],{'foreignKey':_0xc1a4('0x209'),'as':_0xc1a4('0x1f6')});db[_0xc1a4('0x10d')][_0xc1a4('0x133')](db[_0xc1a4('0x10f')],{'foreignKey':_0xc1a4('0x20a'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xc1a4('0x133')](db['User'],{'foreignKey':_0xc1a4('0x1f0'),'as':_0xc1a4('0x1f1')});db[_0xc1a4('0x10d')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'foreignKey':_0xc1a4('0x1f2'),'as':_0xc1a4('0x1f3')});db[_0xc1a4('0x10f')][_0xc1a4('0x135')](db[_0xc1a4('0x11f')],{'as':_0xc1a4('0x160'),'through':_0xc1a4('0x146'),'foreignKey':_0xc1a4('0x20b')});db['WhatsappQueue'][_0xc1a4('0x135')](db[_0xc1a4('0x13a')],{'through':'team_has_whatsapp_queues','as':_0xc1a4('0x161')});db[_0xc1a4('0x119')][_0xc1a4('0x133')](db[_0xc1a4('0x11f')],{'as':'user','foreignKey':_0xc1a4('0x11e'),'onDelete':'cascade','hooks':!![]});db[_0xc1a4('0x111')][_0xc1a4('0x11c')](db[_0xc1a4('0xc6')],{'as':_0xc1a4('0xc6'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x111')][_0xc1a4('0x11c')](db['MailServerIn'],{'as':_0xc1a4('0x16f'),'onDelete':_0xc1a4('0x16d')});db[_0xc1a4('0x111')]['hasOne'](db[_0xc1a4('0x16e')],{'as':'Smtp','onDelete':_0xc1a4('0x16d')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x25e4=['Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SpiedAgents','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Tag','Tags','mail_interaction_has_tags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','Items','FaxAccountId','FaxInteraction','Exntensions','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','user_has_sms_accounts','SmsInteractionId','Owner','ThroughTags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','CmContactId','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Queue','All','OneAll','Any','OneAny','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmConfiguration','SugarcrmField','DeskField','int_desk_configuration_has_tags','Descriptions','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowAccount','ServicenowConfiguration','Dynamics365Configuration','FreshsalesAccount','ChatQueueReport','FromId','SessionId','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToQueueId','user','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../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','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../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','License','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoicePrefix','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt'];(function(_0x2ac8eb,_0x4e8e62){var _0x306e30=function(_0x1e5d8c){while(--_0x1e5d8c){_0x2ac8eb['push'](_0x2ac8eb['shift']());}};_0x306e30(++_0x4e8e62);}(_0x25e4,0xe8));var _0x425e=function(_0x185998,_0x14886f){_0x185998=_0x185998-0x0;var _0x3fe58a=_0x25e4[_0x185998];return _0x3fe58a;};'use strict';var config=require(_0x425e('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x425e('0x1'));var timezone=jstz[_0x425e('0x2')]();config[_0x425e('0x3')]=_[_0x425e('0x4')](config[_0x425e('0x3')],{'database':_0x425e('0x5'),'username':_0x425e('0x6'),'password':_0x425e('0x7'),'options':{'host':_0x425e('0x8'),'port':0xcea,'dialect':_0x425e('0x9'),'dialectOptions':{'charset':_0x425e('0xa')},'logging':![],'timezone':timezone[_0x425e('0xb')](),'define':{'charset':_0x425e('0xc'),'collate':'utf8_general_ci'}}});config[_0x425e('0xd')]=_[_0x425e('0x4')](config[_0x425e('0xd')],{'database':_0x425e('0x5'),'username':_0x425e('0x6'),'password':_0x425e('0x7'),'options':{'host':_0x425e('0x8'),'port':0xcea,'dialect':_0x425e('0x9'),'dialectOptions':{'charset':_0x425e('0xa')},'logging':![],'timezone':timezone[_0x425e('0xb')](),'define':{'charset':'utf8','collate':_0x425e('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x425e('0x3')][_0x425e('0xf')],config[_0x425e('0x3')][_0x425e('0x10')],config[_0x425e('0x3')][_0x425e('0x11')],config[_0x425e('0x3')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x425e('0xd')]['database'],config[_0x425e('0xd')]['username'],config['sequelizeHistory'][_0x425e('0x11')],config[_0x425e('0xd')][_0x425e('0x12')])};db[_0x425e('0x13')]=db[_0x425e('0x3')]['import']('../api/user/user.model');db[_0x425e('0x14')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x16'));db[_0x425e('0x17')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x18'));db[_0x425e('0x19')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x1a'));db['VoiceMusicOnHold']=db['sequelize']['import'](_0x425e('0x1b'));db[_0x425e('0x1c')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x1d'));db['VoiceRecording']=db[_0x425e('0x3')]['import'](_0x425e('0x1e'));db[_0x425e('0x1f')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x20'));db['VoiceMail']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x21'));db[_0x425e('0x22')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x425e('0x3')]['import'](_0x425e('0x23'));db[_0x425e('0x24')]=db[_0x425e('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x425e('0x25')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x26'));db['VoiceQueueReport']=db[_0x425e('0x3')][_0x425e('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x425e('0x27')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0x425e('0x28')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x29'));db['VoiceTransferReport']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x2a'));db[_0x425e('0x2b')]=db[_0x425e('0x3')]['import'](_0x425e('0x2c'));db[_0x425e('0x2d')]=db[_0x425e('0x3')]['import'](_0x425e('0x2e'));db[_0x425e('0x2f')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x30'));db[_0x425e('0x31')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x32'));db[_0x425e('0x33')]=db['sequelize'][_0x425e('0x15')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize'][_0x425e('0x15')](_0x425e('0x34'));db[_0x425e('0x35')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x425e('0x36')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x37'));db[_0x425e('0x38')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x39'));db[_0x425e('0x3a')]=db['sequelize'][_0x425e('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x425e('0x3b')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x3c'));db[_0x425e('0x3d')]=db[_0x425e('0x3')]['import'](_0x425e('0x3e'));db[_0x425e('0x3f')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x425e('0x40')]=db['sequelize'][_0x425e('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x425e('0x41')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/mailMessage/mailMessage.model');db[_0x425e('0x42')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x43'));db[_0x425e('0x44')]=db[_0x425e('0x3')]['import']('../api/dashboard/dashboard.model');db[_0x425e('0x45')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x46'));db[_0x425e('0x47')]=db[_0x425e('0x3')]['import'](_0x425e('0x48'));db[_0x425e('0x49')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db[_0x425e('0x4a')]=db[_0x425e('0x3')]['import'](_0x425e('0x4b'));db[_0x425e('0x4c')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x4d'));db[_0x425e('0x4e')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x4f'));db[_0x425e('0x50')]=db['sequelize']['import'](_0x425e('0x51'));db[_0x425e('0x52')]=db[_0x425e('0x3')]['import']('../api/smsApplication/smsApplication.model');db[_0x425e('0x53')]=db['sequelize'][_0x425e('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x425e('0x54')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x55'));db[_0x425e('0x56')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x57'));db['OpenchannelAccount']=db[_0x425e('0x3')][_0x425e('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x425e('0x58')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x59'));db['OpenchannelInteraction']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x5a'));db[_0x425e('0x5b')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x5c'));db[_0x425e('0x5d')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x425e('0x5e')]=db[_0x425e('0x3')]['import'](_0x425e('0x5f'));db['OpenchannelQueueReport']=db['sequelize'][_0x425e('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x425e('0x60')]=db['sequelize'][_0x425e('0x15')]('../api/chatApplication/chatApplication.model');db[_0x425e('0x61')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x62'));db[_0x425e('0x63')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x64'));db[_0x425e('0x65')]=db['sequelize']['import'](_0x425e('0x66'));db[_0x425e('0x67')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x68'));db[_0x425e('0x69')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x6a'));db[_0x425e('0x6b')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x6c'));db['CmCompany']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x6d'));db[_0x425e('0x6e')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x6f'));db[_0x425e('0x70')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x71'));db[_0x425e('0x72')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x425e('0x73')]=db[_0x425e('0x3')]['import'](_0x425e('0x74'));db[_0x425e('0x75')]=db['sequelize'][_0x425e('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x425e('0x76')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x77'));db[_0x425e('0x78')]=db['sequelize'][_0x425e('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0x425e('0x79')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x7a'));db[_0x425e('0x7b')]=db[_0x425e('0x3')]['import'](_0x425e('0x7c'));db[_0x425e('0x7d')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x7e'));db[_0x425e('0x7f')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x80'));db[_0x425e('0x81')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x82'));db[_0x425e('0x83')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/interval/interval.model');db[_0x425e('0x84')]=db['sequelize'][_0x425e('0x15')]('../api/pause/pause.model');db[_0x425e('0x85')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x86'));db[_0x425e('0x87')]=db['sequelize']['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x425e('0x88')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x89'));db['Sound']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x8a'));db['Tag']=db[_0x425e('0x3')]['import'](_0x425e('0x8b'));db[_0x425e('0x8c')]=db[_0x425e('0x3')]['import'](_0x425e('0x8d'));db[_0x425e('0x8e')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x8f'));db[_0x425e('0x90')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x91'));db['Template']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x92'));db[_0x425e('0x93')]=db[_0x425e('0x3')]['import'](_0x425e('0x94'));db[_0x425e('0x95')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/variable/variable.model');db['Integration']=db['sequelize'][_0x425e('0x15')](_0x425e('0x96'));db['IntegrationReport']=db[_0x425e('0x3')]['import'](_0x425e('0x97'));db[_0x425e('0x98')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x425e('0x99')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x9a'));db[_0x425e('0x9b')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x9c'));db[_0x425e('0x9d')]=db[_0x425e('0x3')]['import'](_0x425e('0x9e'));db[_0x425e('0x9f')]=db['sequelize'][_0x425e('0x15')](_0x425e('0xa0'));db['AnalyticTreeReport']=db['sequelize']['import'](_0x425e('0xa1'));db['SalesforceAccount']=db['sequelize'][_0x425e('0x15')](_0x425e('0xa2'));db['SalesforceConfiguration']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xa3'));db[_0x425e('0xa4')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xa5'));db[_0x425e('0xa6')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xa7'));db['SugarcrmConfiguration']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xa8'));db['SugarcrmField']=db['sequelize'][_0x425e('0x15')](_0x425e('0xa9'));db['DeskAccount']=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x425e('0xaa')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xab'));db['DeskField']=db['sequelize'][_0x425e('0x15')](_0x425e('0xac'));db['ZohoAccount']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xad'));db[_0x425e('0xae')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xaf'));db[_0x425e('0xb0')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intZohoField/intZohoField.model');db[_0x425e('0xb1')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xb2'));db[_0x425e('0xb3')]=db['sequelize'][_0x425e('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x425e('0xb4')]=db['sequelize']['import'](_0x425e('0xb5'));db[_0x425e('0xb6')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xb7'));db[_0x425e('0xb8')]=db[_0x425e('0x3')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db['sequelize'][_0x425e('0x15')](_0x425e('0xb9'));db[_0x425e('0xba')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x425e('0xbb')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xbc'));db[_0x425e('0xbd')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xbe'));db['ServicenowConfiguration']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xbf'));db[_0x425e('0xc0')]=db['sequelize']['import'](_0x425e('0xc1'));db[_0x425e('0xc2')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize']['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x425e('0xc3')]=db['sequelize'][_0x425e('0x15')](_0x425e('0xc4'));db['FreshsalesAccount']=db[_0x425e('0x3')]['import'](_0x425e('0xc5'));db[_0x425e('0xc6')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x425e('0xc7')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xc8'));db[_0x425e('0xc9')]=db['sequelize'][_0x425e('0x15')](_0x425e('0x96'));db['Network']=db['sequelize'][_0x425e('0x15')]('../api/network/network.model');db['ChatQueueReport']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xca'));db[_0x425e('0xcb')]=db[_0x425e('0x3')]['import'](_0x425e('0xcc'));db[_0x425e('0xcd')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x425e('0xce')]=db['sequelize']['import'](_0x425e('0xcf'));db[_0x425e('0xd0')]=db[_0x425e('0x3')]['import'](_0x425e('0xd1'));db[_0x425e('0xd2')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xd3'));db[_0x425e('0xd4')]=db[_0x425e('0x3')]['import'](_0x425e('0xd5'));db[_0x425e('0xd6')]=db[_0x425e('0x3')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x425e('0xd7')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xd8'));db['Setting']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xd9'));db[_0x425e('0xda')]=db[_0x425e('0x3')]['import'](_0x425e('0xdb'));db[_0x425e('0xdc')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xdd'));db[_0x425e('0xde')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xdf'));db[_0x425e('0xe0')]=db[_0x425e('0x3')]['import'](_0x425e('0xe1'));db[_0x425e('0xe2')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xe3'));db[_0x425e('0xe4')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/license/license.model');db[_0x425e('0xe5')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xe6'));db[_0x425e('0xe7')]=db['sequelize'][_0x425e('0x15')]('../api/migration/migration.model');db['Attachment']=db[_0x425e('0x3')]['import'](_0x425e('0xe8'));db[_0x425e('0xe9')]=db['sequelize'][_0x425e('0x15')](_0x425e('0xea'));db[_0x425e('0xeb')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xec'));db[_0x425e('0xed')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xee'));db[_0x425e('0xef')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xf0'));db[_0x425e('0xf1')]=db[_0x425e('0x3')]['import'](_0x425e('0xf2'));db['SmsTransferReport']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xf3'));db[_0x425e('0xf4')]=db[_0x425e('0x3')]['import'](_0x425e('0xf5'));db['VoicePrefix']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xf6'));db[_0x425e('0xf7')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xf8'));db['UserProfileSection']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xf9'));db[_0x425e('0xfa')]=db['sequelize'][_0x425e('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x425e('0xfb')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xfc'));db['WhatsappAccount']=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xfd'));db[_0x425e('0xfe')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0xff'));db[_0x425e('0x100')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x101'));db[_0x425e('0x102')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x103'));db[_0x425e('0x104')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x105'));db[_0x425e('0x106')]=db[_0x425e('0x3')][_0x425e('0x15')](_0x425e('0x107'));db[_0x425e('0x108')]=db['sequelize']['import'](_0x425e('0x109'));db[_0x425e('0x10a')]=db['sequelize'][_0x425e('0x15')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x425e('0x3')][_0x425e('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x425e('0x10b')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x425e('0x10c')]=db[_0x425e('0x3')][_0x425e('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x425e('0x10d')]=db['sequelize']['import'](_0x425e('0x10e'));db[_0x425e('0x10f')]=db[_0x425e('0x3')]['import'](_0x425e('0x110'));db[_0x425e('0x13')][_0x425e('0x111')](db['VoiceMail'],{'as':_0x425e('0x112'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x111')](db['UserSetting'],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x425e('0x114')});db['User'][_0x425e('0x115')](db['VoiceRecording'],{'as':_0x425e('0x116'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db['UserVoiceQueueRt'],{'as':_0x425e('0x117'),'foreignKey':_0x425e('0x114')});db['User'][_0x425e('0x115')](db[_0x425e('0x19')],{'as':_0x425e('0x118'),'onDelete':'cascade','hooks':!![]});db[_0x425e('0x13')][_0x425e('0x115')](db['CmHopperFinal'],{'as':_0x425e('0x119'),'foreignKey':_0x425e('0x114')});db['User'][_0x425e('0x115')](db['CmHopperHistory'],{'as':_0x425e('0x11a'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db[_0x425e('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x425e('0x114')});db['User'][_0x425e('0x115')](db[_0x425e('0x11b')],{'as':_0x425e('0x11c'),'foreignKey':'UserId'});db['User'][_0x425e('0x115')](db[_0x425e('0x61')],{'as':_0x425e('0x11d'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db[_0x425e('0x53')],{'as':'SmsInteractions','foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db['FaxInteraction'],{'as':_0x425e('0x11e'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')]['hasMany'](db[_0x425e('0x40')],{'as':_0x425e('0x11f'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db[_0x425e('0x100')],{'as':_0x425e('0x120'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x13')][_0x425e('0x115')](db[_0x425e('0xfb')],{'as':_0x425e('0x121'),'foreignKey':_0x425e('0x122')});db[_0x425e('0x13')][_0x425e('0x115')](db[_0x425e('0x70')],{'as':_0x425e('0x123'),'foreignKey':_0x425e('0x114'),'onDelete':_0x425e('0x124')});db['User']['belongsTo'](db[_0x425e('0xf7')],{'as':_0x425e('0xf7'),'foreignKey':_0x425e('0x125')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x69')],{'as':_0x425e('0x127'),'through':_0x425e('0x128')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x6e')],{'as':'Contacts','through':_0x425e('0x129')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0xf4')],{'as':_0x425e('0x12a'),'through':_0x425e('0x12b')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':'user_has_teams'});db['User']['belongsToMany'](db[_0x425e('0x40')],{'as':'MailInteractions','through':_0x425e('0x12c')});db[_0x425e('0x13')][_0x425e('0x126')](db['ChatInteraction'],{'as':_0x425e('0x11d'),'through':_0x425e('0x12d')});db[_0x425e('0x13')][_0x425e('0x126')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x425e('0x12e')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x53')],{'as':_0x425e('0x12f'),'through':_0x425e('0x130')});db['User'][_0x425e('0x126')](db[_0x425e('0x11b')],{'as':_0x425e('0x11c'),'through':_0x425e('0x131')});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x100')],{'as':'WhatsappInteractions','through':_0x425e('0x132')});db['User'][_0x425e('0x126')](db['VoiceQueue'],{'as':_0x425e('0x133'),'through':_0x425e('0x2d'),'required':![]});db['User'][_0x425e('0x126')](db[_0x425e('0x134')],{'as':_0x425e('0x135'),'through':'UserVoicePrefix','required':![]});db[_0x425e('0x13')][_0x425e('0x126')](db['MailQueue'],{'as':_0x425e('0x136'),'through':'UserMailQueue','required':![]});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x67')],{'as':_0x425e('0x137'),'through':_0x425e('0x2f'),'required':![],'hooks':!![]});db['User'][_0x425e('0x126')](db[_0x425e('0x4c')],{'as':_0x425e('0x138'),'through':_0x425e('0x33'),'required':![]});db[_0x425e('0x13')][_0x425e('0x126')](db[_0x425e('0x56')],{'as':_0x425e('0x139'),'through':_0x425e('0x13a'),'required':![]});db['User']['belongsToMany'](db[_0x425e('0x5d')],{'as':_0x425e('0x13b'),'through':_0x425e('0x35'),'required':![]});db[_0x425e('0x13')]['belongsToMany'](db[_0x425e('0x108')],{'as':_0x425e('0x13c'),'through':_0x425e('0x36'),'required':![]});db[_0x425e('0x13')]['belongsToMany'](db[_0x425e('0xf4')],{'through':_0x425e('0x12b')});db['User'][_0x425e('0x126')](db[_0x425e('0x5e')],{'as':'ChatWebsites','through':_0x425e('0x13d')});db[_0x425e('0x13')][_0x425e('0x126')](db['FaxAccount'],{'as':_0x425e('0x13e'),'through':_0x425e('0x13f')});db['User'][_0x425e('0x126')](db['MailAccount'],{'as':'MailAccounts','through':_0x425e('0x140')});db['User'][_0x425e('0x126')](db[_0x425e('0x141')],{'as':_0x425e('0x142'),'through':_0x425e('0x143')});db[_0x425e('0x13')][_0x425e('0x126')](db['SmsAccount'],{'as':_0x425e('0x144'),'through':'user_has_sms_accounts'});db[_0x425e('0x13')][_0x425e('0x126')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x425e('0x14')]['hasMany'](db[_0x425e('0x19')],{'as':_0x425e('0x145'),'onDelete':_0x425e('0x113'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x425e('0x115')](db[_0x425e('0x19')],{'onDelete':'cascade'});db[_0x425e('0x19')][_0x425e('0x115')](db[_0x425e('0x19')],{'as':_0x425e('0x146'),'onDelete':_0x425e('0x113')});db[_0x425e('0x147')][_0x425e('0x126')](db[_0x425e('0x148')],{'as':_0x425e('0x149'),'through':_0x425e('0x14a')});db[_0x425e('0x1c')][_0x425e('0x115')](db[_0x425e('0x2b')],{'as':'Members','foreignKey':_0x425e('0x14b')});db[_0x425e('0x1c')][_0x425e('0x115')](db['CmHopper'],{'as':_0x425e('0x123'),'foreignKey':_0x425e('0x14b')});db['VoiceQueue']['hasMany'](db[_0x425e('0x73')],{'as':_0x425e('0x119'),'foreignKey':_0x425e('0x14b')});db['VoiceQueue'][_0x425e('0x115')](db[_0x425e('0x75')],{'as':_0x425e('0x14c'),'foreignKey':_0x425e('0x14b')});db['VoiceQueue'][_0x425e('0x115')](db[_0x425e('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x425e('0x14b')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x425e('0x14d'),'foreignKey':_0x425e('0x14b')});db[_0x425e('0x1c')][_0x425e('0x115')](db['JscriptySessionReport'],{'as':_0x425e('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x425e('0x1c')][_0x425e('0x14f')](db[_0x425e('0x28')],{'as':'Trunk','foreignKey':_0x425e('0x150')});db[_0x425e('0x1c')][_0x425e('0x14f')](db[_0x425e('0x28')],{'as':_0x425e('0x151'),'foreignKey':_0x425e('0x152')});db[_0x425e('0x1c')][_0x425e('0x14f')](db['Interval'],{'as':_0x425e('0x83'),'foreignKey':_0x425e('0x153')});db[_0x425e('0x1c')][_0x425e('0x14f')](db['Pause'],{'as':_0x425e('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x425e('0x1c')]['belongsToMany'](db[_0x425e('0xf4')],{'as':_0x425e('0x12a'),'through':_0x425e('0x155')});db[_0x425e('0x1c')]['belongsToMany'](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x2d')});db[_0x425e('0x1c')][_0x425e('0x126')](db['Team'],{'as':_0x425e('0x157'),'through':_0x425e('0x158')});db[_0x425e('0x1c')][_0x425e('0x126')](db['CmList'],{'as':'BlackLists','through':_0x425e('0x159')});db['VoiceRecording'][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x425e('0x14f')](db['User'],{'as':_0x425e('0x13'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x112')]['hasMany'](db[_0x425e('0x22')],{'as':_0x425e('0x15a'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x15b'),'sourceKey':_0x425e('0x15c')});db[_0x425e('0x22')][_0x425e('0x14f')](db['VoiceMail'],{'foreignKey':_0x425e('0x15b'),'targetKey':_0x425e('0x15c')});db[_0x425e('0x15d')][_0x425e('0x115')](db[_0x425e('0x15e')],{'as':_0x425e('0x15f'),'foreignKey':_0x425e('0x160'),'constraints':![]});db['VoiceCallReport'][_0x425e('0x115')](db[_0x425e('0x25')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x13'),'foreignKey':_0x425e('0x114')});db['VoiceCallReport'][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x38')]['belongsTo'](db[_0x425e('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerIn'][_0x425e('0x14f')](db[_0x425e('0x10a')],{'as':_0x425e('0x10a'),'foreignKey':_0x425e('0x163'),'onDelete':_0x425e('0x164')});db['MailServerOut'][_0x425e('0x14f')](db[_0x425e('0x3b')],{'as':_0x425e('0x3b'),'foreignKey':_0x425e('0x165')});db[_0x425e('0x3a')][_0x425e('0x14f')](db[_0x425e('0x10a')],{'as':_0x425e('0x10a'),'foreignKey':_0x425e('0x163'),'onDelete':_0x425e('0x164')});db[_0x425e('0x3b')]['hasOne'](db[_0x425e('0x38')],{'as':_0x425e('0x166'),'onDelete':'cascade'});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':_0x425e('0x167'),'onDelete':_0x425e('0x113')});db['MailAccount'][_0x425e('0x115')](db['Disposition'],{'as':_0x425e('0x168'),'foreignKey':_0x425e('0x165'),'onDelete':_0x425e('0x113')});db['MailAccount'][_0x425e('0x115')](db[_0x425e('0x7d')],{'as':_0x425e('0x169'),'foreignKey':_0x425e('0x165')});db[_0x425e('0x3b')]['hasMany'](db['MailMessage'],{'as':_0x425e('0x15a'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x425e('0x115')](db[_0x425e('0x40')],{'as':_0x425e('0x16a')});db[_0x425e('0x3b')][_0x425e('0x115')](db['MailApplication'],{'as':_0x425e('0x146'),'foreignKey':_0x425e('0x165'),'onDelete':_0x425e('0x113')});db['MailAccount'][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db['MailAccount']['belongsTo'](db[_0x425e('0x16d')],{'as':_0x425e('0x16d'),'foreignKey':_0x425e('0x16e')});db['MailAccount'][_0x425e('0x14f')](db[_0x425e('0x84')],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db['MailAccount'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':'user_has_mail_accounts'});db[_0x425e('0x3d')]['belongsToMany'](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':'UserMailQueue'});db[_0x425e('0x3d')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':'team_has_mail_queues','as':_0x425e('0x157')});db[_0x425e('0x40')][_0x425e('0x115')](db[_0x425e('0x41')],{'as':_0x425e('0x15a'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x170')});db[_0x425e('0x40')][_0x425e('0x14f')](db[_0x425e('0x3b')],{'as':_0x425e('0x171'),'foreignKey':'MailAccountId'});db[_0x425e('0x40')]['belongsTo'](db['CmContact'],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x40')]['belongsTo'](db[_0x425e('0x13')],{'as':'Owner','foreignKey':_0x425e('0x114')});db[_0x425e('0x40')]['belongsToMany'](db[_0x425e('0x172')],{'through':'mail_interaction_has_tags','as':_0x425e('0x173')});db[_0x425e('0x40')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x174'),'as':'ThroughTags'});db['MailInteraction'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x175'),'through':'user_has_mail_interactions','foreignKey':_0x425e('0x170')});db['MailMessage'][_0x425e('0x115')](db[_0x425e('0x176')],{'as':_0x425e('0x177'),'onDelete':_0x425e('0x113')});db[_0x425e('0x41')][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x13')});db[_0x425e('0x41')]['belongsTo'](db[_0x425e('0x6e')],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x161')});db['MailMessage'][_0x425e('0x14f')](db['MailInteraction'],{'as':_0x425e('0x178'),'foreignKey':_0x425e('0x170')});db[_0x425e('0x41')][_0x425e('0x14f')](db[_0x425e('0x3b')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x165')});db[_0x425e('0x41')]['belongsTo'](db['ChatWebsite'],{'as':_0x425e('0x5e'),'foreignKey':_0x425e('0x179')});db[_0x425e('0x41')][_0x425e('0x14f')](db[_0x425e('0x65')],{'as':_0x425e('0x65'),'foreignKey':_0x425e('0x17a')});db[_0x425e('0x42')][_0x425e('0x14f')](db['User'],{'onDelete':_0x425e('0x164')});db[_0x425e('0x42')][_0x425e('0x14f')](db[_0x425e('0x3d')],{'onDelete':_0x425e('0x164')});db[_0x425e('0x42')][_0x425e('0x14f')](db[_0x425e('0x3b')],{'onDelete':_0x425e('0x164')});db[_0x425e('0x42')]['belongsTo'](db['Interval'],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x153')});db[_0x425e('0x42')][_0x425e('0x14f')](db['Tag'],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x17b')});db[_0x425e('0x17c')]['belongsTo'](db[_0x425e('0x3b')],{});db[_0x425e('0x17c')][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db['MailQueueReport']['belongsTo'](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x17c')][_0x425e('0x14f')](db['MailInteraction'],{});db[_0x425e('0x17c')][_0x425e('0x14f')](db[_0x425e('0x41')],{});db['MailQueueReport'][_0x425e('0x14f')](db[_0x425e('0x13')],{});db[_0x425e('0x17c')]['belongsTo'](db['MailQueue'],{});db[_0x425e('0x44')]['hasMany'](db[_0x425e('0x45')],{'as':_0x425e('0x17d'),'onDelete':_0x425e('0x113')});db['FaxAccount'][_0x425e('0x115')](db[_0x425e('0x7f')],{'as':'Dispositions','foreignKey':_0x425e('0x17e'),'onDelete':_0x425e('0x113')});db['FaxAccount'][_0x425e('0x115')](db[_0x425e('0x7d')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x425e('0x115')](db[_0x425e('0x17f')],{'as':_0x425e('0x16a')});db[_0x425e('0x47')][_0x425e('0x115')](db[_0x425e('0x49')],{'as':'Applications','foreignKey':_0x425e('0x17e'),'onDelete':_0x425e('0x113')});db[_0x425e('0x47')][_0x425e('0x115')](db[_0x425e('0x19')],{'as':_0x425e('0x180'),'onDelete':_0x425e('0x113')});db[_0x425e('0x47')][_0x425e('0x115')](db[_0x425e('0x4a')],{'as':_0x425e('0x15a')});db[_0x425e('0x47')][_0x425e('0x14f')](db[_0x425e('0x28')],{'as':_0x425e('0x28')});db[_0x425e('0x47')][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0x425e('0x47')]['belongsTo'](db['Pause'],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db[_0x425e('0x47')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':'user_has_fax_accounts'});db[_0x425e('0x49')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':'restrict'});db[_0x425e('0x49')][_0x425e('0x14f')](db['FaxQueue'],{'onDelete':_0x425e('0x164')});db[_0x425e('0x49')]['belongsTo'](db[_0x425e('0x47')],{'onDelete':_0x425e('0x164')});db[_0x425e('0x49')][_0x425e('0x14f')](db[_0x425e('0x172')],{'onDelete':'restrict','foreignKey':_0x425e('0x17b')});db['FaxInteraction'][_0x425e('0x115')](db[_0x425e('0x4a')],{'as':'Messages','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x181')});db[_0x425e('0x17f')]['belongsTo'](db[_0x425e('0x47')],{'as':'Account','foreignKey':_0x425e('0x17e')});db[_0x425e('0x17f')][_0x425e('0x14f')](db['CmContact'],{'as':'Contact','foreignKey':_0x425e('0x162')});db['FaxInteraction'][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':'Owner','foreignKey':_0x425e('0x114')});db['FaxInteraction']['belongsToMany'](db[_0x425e('0x172')],{'through':_0x425e('0x182'),'as':_0x425e('0x173')});db[_0x425e('0x17f')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x182'),'as':'ThroughTags'});db['FaxInteraction'][_0x425e('0x126')](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x425e('0x181')});db[_0x425e('0x4a')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x13')});db['FaxMessage'][_0x425e('0x14f')](db[_0x425e('0x17f')],{'as':_0x425e('0x178'),'foreignKey':_0x425e('0x181')});db['FaxMessage']['belongsTo'](db[_0x425e('0x6e')],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x161')});db[_0x425e('0x4a')][_0x425e('0x14f')](db[_0x425e('0x176')],{'as':_0x425e('0x176'),'foreignKey':_0x425e('0x183')});db[_0x425e('0x4a')][_0x425e('0x14f')](db[_0x425e('0x47')],{'as':'Account','foreignKey':_0x425e('0x17e')});db[_0x425e('0x4c')][_0x425e('0x126')](db['User'],{'as':_0x425e('0x156'),'through':_0x425e('0x33')});db[_0x425e('0x4c')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':'team_has_fax_queues','as':_0x425e('0x157')});db[_0x425e('0x4e')][_0x425e('0x14f')](db[_0x425e('0x47')],{});db[_0x425e('0x4e')][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db[_0x425e('0x4e')][_0x425e('0x14f')](db['CmContact'],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db['FaxQueueReport'][_0x425e('0x14f')](db['FaxInteraction'],{});db[_0x425e('0x4e')]['belongsTo'](db['FaxMessage'],{});db[_0x425e('0x4e')][_0x425e('0x14f')](db['User'],{});db[_0x425e('0x4e')]['belongsTo'](db['FaxQueue'],{});db[_0x425e('0x50')]['hasMany'](db[_0x425e('0x7f')],{'as':_0x425e('0x168'),'foreignKey':_0x425e('0x184'),'onDelete':_0x425e('0x113')});db[_0x425e('0x50')]['hasMany'](db[_0x425e('0x7d')],{'as':_0x425e('0x169'),'foreignKey':_0x425e('0x184')});db[_0x425e('0x50')]['hasMany'](db['SmsMessage'],{'as':_0x425e('0x15a'),'foreignKey':_0x425e('0x184')});db[_0x425e('0x50')][_0x425e('0x115')](db[_0x425e('0x53')],{'as':_0x425e('0x16a')});db[_0x425e('0x50')][_0x425e('0x115')](db[_0x425e('0x52')],{'as':_0x425e('0x146'),'foreignKey':_0x425e('0x184'),'onDelete':_0x425e('0x113')});db[_0x425e('0x50')]['belongsTo'](db['CmList'],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db['SmsAccount'][_0x425e('0x14f')](db[_0x425e('0x84')],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db[_0x425e('0x50')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x185')});db['SmsApplication'][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x164')});db[_0x425e('0x52')]['belongsTo'](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication'][_0x425e('0x14f')](db['SmsAccount'],{'onDelete':_0x425e('0x164')});db[_0x425e('0x52')][_0x425e('0x14f')](db[_0x425e('0x83')],{'onDelete':_0x425e('0x164'),'foreignKey':'IntervalId'});db[_0x425e('0x52')]['belongsTo'](db[_0x425e('0x172')],{'onDelete':_0x425e('0x164'),'foreignKey':'TagId'});db[_0x425e('0x53')][_0x425e('0x115')](db[_0x425e('0x54')],{'as':'Messages','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x186')});db[_0x425e('0x53')][_0x425e('0x14f')](db['SmsAccount'],{'as':_0x425e('0x171'),'foreignKey':'SmsAccountId'});db[_0x425e('0x53')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x53')][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x187'),'foreignKey':_0x425e('0x114')});db['SmsInteraction'][_0x425e('0x126')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x425e('0x173')});db[_0x425e('0x53')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':'sms_interaction_has_tags','as':_0x425e('0x188')});db['SmsInteraction'][_0x425e('0x126')](db['User'],{'as':_0x425e('0x175'),'through':_0x425e('0x130'),'foreignKey':_0x425e('0x186')});db[_0x425e('0x54')][_0x425e('0x14f')](db['User'],{'as':_0x425e('0x13')});db['SmsMessage'][_0x425e('0x14f')](db['CmContact'],{'onDelete':_0x425e('0x113'),'as':'Contact'});db[_0x425e('0x54')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x425e('0x113'),'as':'Interaction','foreignKey':_0x425e('0x186')});db['SmsMessage'][_0x425e('0x14f')](db['SmsAccount'],{'as':'Account','foreignKey':_0x425e('0x184')});db['SmsQueue'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x13a'),'foreignKey':_0x425e('0x189')});db[_0x425e('0x56')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x425e('0x141')][_0x425e('0x115')](db['Disposition'],{'as':_0x425e('0x168'),'foreignKey':_0x425e('0x18a'),'onDelete':'cascade'});db[_0x425e('0x141')]['hasMany'](db[_0x425e('0x7d')],{'as':_0x425e('0x169'),'foreignKey':_0x425e('0x18a')});db[_0x425e('0x141')]['hasMany'](db[_0x425e('0x11b')],{'as':_0x425e('0x16a'),'foreignKey':_0x425e('0x18a')});db[_0x425e('0x141')][_0x425e('0x115')](db[_0x425e('0x5b')],{'as':_0x425e('0x15a'),'foreignKey':_0x425e('0x18a')});db[_0x425e('0x141')]['hasMany'](db[_0x425e('0x58')],{'as':_0x425e('0x146'),'foreignKey':_0x425e('0x18a'),'onDelete':_0x425e('0x113')});db['OpenchannelAccount'][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':'List','foreignKey':_0x425e('0x16c')});db[_0x425e('0x141')][_0x425e('0x14f')](db[_0x425e('0x84')],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db['OpenchannelAccount'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x425e('0x58')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x164')});db[_0x425e('0x58')][_0x425e('0x14f')](db[_0x425e('0x5d')],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x18b')});db[_0x425e('0x58')][_0x425e('0x14f')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x425e('0x18a')});db[_0x425e('0x58')][_0x425e('0x14f')](db['Interval'],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x153')});db['OpenchannelApplication'][_0x425e('0x14f')](db['Tag'],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x17b')});db[_0x425e('0x11b')][_0x425e('0x115')](db['OpenchannelMessage'],{'as':_0x425e('0x15a'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x18c')});db[_0x425e('0x11b')][_0x425e('0x14f')](db['OpenchannelAccount'],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x18a')});db[_0x425e('0x11b')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x11b')]['belongsTo'](db['User'],{'as':_0x425e('0x187'),'foreignKey':_0x425e('0x114')});db['OpenchannelInteraction'][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x18d'),'as':_0x425e('0x173')});db[_0x425e('0x11b')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x18d'),'as':_0x425e('0x188')});db[_0x425e('0x11b')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x175'),'through':_0x425e('0x131'),'foreignKey':_0x425e('0x18c')});db[_0x425e('0x5b')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x113'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x425e('0x161')});db[_0x425e('0x5b')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x178'),'foreignKey':_0x425e('0x18c')});db[_0x425e('0x5b')]['belongsTo'](db[_0x425e('0x176')],{'as':_0x425e('0x176'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x425e('0x14f')](db['OpenchannelAccount'],{'as':_0x425e('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x425e('0x5d')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x35'),'foreignKey':_0x425e('0x18b')});db[_0x425e('0x5d')][_0x425e('0x126')](db['Team'],{'through':_0x425e('0x18e'),'as':'Teams'});db[_0x425e('0x5e')]['hasMany'](db[_0x425e('0x7f')],{'as':_0x425e('0x168'),'foreignKey':'ChatWebsiteId','onDelete':_0x425e('0x113')});db[_0x425e('0x5e')][_0x425e('0x115')](db[_0x425e('0x7d')],{'as':_0x425e('0x169'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x425e('0x115')](db[_0x425e('0x6b')],{'as':'ProactiveActions'});db[_0x425e('0x5e')][_0x425e('0x115')](db['ChatInteraction'],{'as':_0x425e('0x16a')});db[_0x425e('0x5e')][_0x425e('0x115')](db[_0x425e('0x60')],{'as':_0x425e('0x146'),'foreignKey':_0x425e('0x179'),'onDelete':_0x425e('0x113')});db[_0x425e('0x5e')][_0x425e('0x115')](db[_0x425e('0x63')],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0x425e('0x83'),'foreignKey':_0x425e('0x153')});db['ChatWebsite'][_0x425e('0x14f')](db['MailAccount'],{'as':_0x425e('0x3b'),'foreignKey':_0x425e('0x165')});db[_0x425e('0x5e')][_0x425e('0x14f')](db[_0x425e('0x84')],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db['ChatWebsite'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x13d')});db[_0x425e('0x18f')][_0x425e('0x14f')](db[_0x425e('0x141')],{});db['OpenchannelQueueReport'][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':_0x425e('0x161'),'foreignKey':'ContactId'});db[_0x425e('0x18f')][_0x425e('0x14f')](db[_0x425e('0x11b')],{});db[_0x425e('0x18f')][_0x425e('0x14f')](db[_0x425e('0x5b')],{});db[_0x425e('0x18f')]['belongsTo'](db[_0x425e('0x13')],{});db[_0x425e('0x18f')][_0x425e('0x14f')](db[_0x425e('0x5d')],{});db[_0x425e('0x60')][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x190'),'foreignKey':_0x425e('0x114'),'onDelete':_0x425e('0x164')});db['ChatApplication']['belongsTo'](db[_0x425e('0x67')],{'as':'Queue','foreignKey':_0x425e('0x191'),'onDelete':'restrict'});db['ChatApplication'][_0x425e('0x14f')](db[_0x425e('0x5e')],{'as':_0x425e('0x192'),'foreignKey':_0x425e('0x179'),'onDelete':_0x425e('0x164')});db['ChatApplication'][_0x425e('0x14f')](db[_0x425e('0x172')],{'onDelete':'restrict','foreignKey':_0x425e('0x17b')});db[_0x425e('0x61')][_0x425e('0x115')](db[_0x425e('0x63')],{'as':_0x425e('0x15a'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x193')});db[_0x425e('0x61')][_0x425e('0x14f')](db[_0x425e('0x5e')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x179')});db[_0x425e('0x61')]['belongsTo'](db[_0x425e('0x6e')],{'as':'Contact','foreignKey':_0x425e('0x162')});db['ChatInteraction']['belongsTo'](db['User'],{'as':_0x425e('0x187'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x61')]['belongsToMany'](db['Tag'],{'through':_0x425e('0x194'),'as':'Tags'});db[_0x425e('0x61')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x194'),'as':'ThroughTags'});db[_0x425e('0x61')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x175'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x425e('0x63')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x13')});db[_0x425e('0x63')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'onDelete':_0x425e('0x113'),'as':_0x425e('0x161'),'foreignKey':'ContactId'});db['ChatMessage'][_0x425e('0x14f')](db[_0x425e('0x61')],{'onDelete':_0x425e('0x113'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x425e('0x63')][_0x425e('0x14f')](db['Attachment'],{'as':_0x425e('0x176'),'foreignKey':_0x425e('0x183')});db['ChatMessage'][_0x425e('0x14f')](db[_0x425e('0x5e')],{'as':_0x425e('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x425e('0x65')]['hasMany'](db[_0x425e('0x176')],{'as':_0x425e('0x177'),'foreignKey':_0x425e('0x17a'),'onDelete':'cascade','hooks':!![]});db[_0x425e('0x65')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'onDelete':_0x425e('0x113'),'as':'Contact','foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x425e('0x14f')](db[_0x425e('0x5e')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x179')});db[_0x425e('0x67')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x2f'),'hooks':!![]});db[_0x425e('0x67')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':_0x425e('0x195'),'as':'Teams'});db['ChatGroup'][_0x425e('0x115')](db[_0x425e('0xcb')],{'as':_0x425e('0x15a'),'foreignKey':_0x425e('0x196'),'onDelete':'cascade'});db[_0x425e('0x69')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x197'),'through':_0x425e('0x128')});db[_0x425e('0x6b')][_0x425e('0x14f')](db[_0x425e('0x5e')],{'as':'Website','foreignKey':_0x425e('0x179')});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x425e('0x198'),'foreignKey':_0x425e('0x199')});db[_0x425e('0x6e')][_0x425e('0x115')](db[_0x425e('0x8e')],{'as':'Phones','foreignKey':_0x425e('0x19a')});db[_0x425e('0x6e')][_0x425e('0x115')](db[_0x425e('0x70')],{'as':'Hoppers','foreignKey':_0x425e('0x162')});db[_0x425e('0x6e')]['hasMany'](db[_0x425e('0x73')],{'as':_0x425e('0x119'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x6e')][_0x425e('0x115')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x425e('0x162')});db[_0x425e('0x6e')][_0x425e('0x115')](db['ReportAgentPreview'],{'as':_0x425e('0x76'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x6e')][_0x425e('0x115')](db['JscriptySessionReport'],{'as':_0x425e('0x14e'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x6e')][_0x425e('0x115')](db['OpenchannelInteraction'],{'as':_0x425e('0x11c'),'foreignKey':_0x425e('0x162'),'onDelete':_0x425e('0x164')});db[_0x425e('0x6e')][_0x425e('0x115')](db[_0x425e('0x61')],{'as':_0x425e('0x11d'),'foreignKey':'ContactId','onDelete':_0x425e('0x164')});db[_0x425e('0x6e')][_0x425e('0x115')](db[_0x425e('0x53')],{'as':_0x425e('0x12f'),'foreignKey':'ContactId','onDelete':_0x425e('0x164')});db[_0x425e('0x6e')][_0x425e('0x115')](db[_0x425e('0x17f')],{'as':'FaxInteractions','foreignKey':_0x425e('0x162'),'onDelete':_0x425e('0x164')});db['CmContact']['hasMany'](db[_0x425e('0x40')],{'as':_0x425e('0x11f'),'foreignKey':'ContactId','onDelete':_0x425e('0x164')});db['CmContact'][_0x425e('0x14f')](db[_0x425e('0x19b')],{'as':_0x425e('0x19c'),'foreignKey':_0x425e('0x199')});db['CmContact'][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c'),'onDelete':_0x425e('0x113')});db[_0x425e('0x6e')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x175'),'through':_0x425e('0x129')});db[_0x425e('0x6e')]['belongsToMany'](db[_0x425e('0x172')],{'as':_0x425e('0x173'),'through':_0x425e('0x19d')});db[_0x425e('0x6e')]['belongsToMany'](db[_0x425e('0x172')],{'through':'cm_contact_has_tags','as':_0x425e('0x188')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x425e('0x19e'),'foreignKey':_0x425e('0x19f')});db[_0x425e('0x70')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':'Contact','foreignKey':_0x425e('0x162'),'onDelete':_0x425e('0x113')});db[_0x425e('0x70')]['belongsTo'](db['CmList'],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c'),'onDelete':_0x425e('0x113')});db[_0x425e('0x70')][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':'Agent','foreignKey':_0x425e('0x114')});db[_0x425e('0x70')][_0x425e('0x14f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x425e('0x14b'),'onDelete':_0x425e('0x113')});db[_0x425e('0x70')][_0x425e('0x14f')](db['Campaign'],{'as':_0x425e('0xe5'),'foreignKey':_0x425e('0x1a0'),'onDelete':_0x425e('0x113')});db[_0x425e('0x70')]['belongsTo'](db['User'],{'as':_0x425e('0x187'),'foreignKey':_0x425e('0x1a1')});db[_0x425e('0x72')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':'ContactId','onDelete':_0x425e('0x113')});db[_0x425e('0x72')][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':'List','foreignKey':'ListId','onDelete':_0x425e('0x113')});db['CmHopperBlack'][_0x425e('0x14f')](db[_0x425e('0x1c')],{'as':_0x425e('0x1a2'),'foreignKey':_0x425e('0x14b'),'onDelete':_0x425e('0x113')});db[_0x425e('0x72')][_0x425e('0x14f')](db['Campaign'],{'as':_0x425e('0xe5'),'foreignKey':_0x425e('0x1a0'),'onDelete':_0x425e('0x113')});db[_0x425e('0x7b')][_0x425e('0x115')](db['Condition'],{'as':{'plural':_0x425e('0x1a3'),'singular':_0x425e('0x1a4')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x425e('0x7b')]['hasMany'](db[_0x425e('0x81')],{'as':{'plural':_0x425e('0x1a5'),'singular':_0x425e('0x1a6')},'foreignKey':'AutomationAnyId','onDelete':_0x425e('0x113'),'hooks':!![]});db['Automation'][_0x425e('0x115')](db[_0x425e('0x79')],{'as':'Actions','foreignKey':_0x425e('0x1a7'),'onDelete':_0x425e('0x113'),'hooks':!![]});db[_0x425e('0x7f')][_0x425e('0x115')](db[_0x425e('0x7f')],{'as':'Dispositions','foreignKey':_0x425e('0x1a8'),'onDelete':'cascade'});db[_0x425e('0x83')][_0x425e('0x115')](db[_0x425e('0x83')],{'as':'Intervals','foreignKey':_0x425e('0x153'),'onDelete':_0x425e('0x113'),'hooks':!![],'required':![]});db['Interval'][_0x425e('0x115')](db[_0x425e('0x19')],{'as':_0x425e('0x118'),'foreignKey':_0x425e('0x153'),'onDelete':'restrict'});db[_0x425e('0x83')][_0x425e('0x115')](db[_0x425e('0x42')],{'as':_0x425e('0x1a9'),'foreignKey':_0x425e('0x153')});db[_0x425e('0x83')][_0x425e('0x115')](db[_0x425e('0x60')],{'as':_0x425e('0x1aa'),'foreignKey':_0x425e('0x153')});db['Interval']['hasMany'](db['FaxApplication'],{'as':_0x425e('0x1ab'),'foreignKey':_0x425e('0x153')});db[_0x425e('0x83')][_0x425e('0x115')](db['SmsApplication'],{'as':_0x425e('0x1ac'),'foreignKey':_0x425e('0x153')});db[_0x425e('0x88')]['belongsTo'](db[_0x425e('0x3b')],{});db[_0x425e('0x88')][_0x425e('0x14f')](db[_0x425e('0x99')],{'foreignKey':_0x425e('0x1ad')});db[_0x425e('0x88')]['belongsTo'](db[_0x425e('0x98')],{'foreignKey':_0x425e('0x1ae')});db['Sound'][_0x425e('0x126')](db[_0x425e('0x147')],{'as':_0x425e('0x1af'),'through':_0x425e('0x14a'),'onDelete':_0x425e('0x164')});db[_0x425e('0x172')]['belongsToMany'](db[_0x425e('0x6e')],{'through':'cm_contact_has_tags'});db[_0x425e('0x172')][_0x425e('0x126')](db[_0x425e('0x61')],{'through':_0x425e('0x194')});db[_0x425e('0x172')]['belongsToMany'](db[_0x425e('0x40')],{'through':'mail_interaction_has_tags'});db[_0x425e('0x172')]['belongsToMany'](db[_0x425e('0x53')],{'through':_0x425e('0x1b0')});db[_0x425e('0x172')]['belongsToMany'](db[_0x425e('0x17f')],{'through':_0x425e('0x182')});db[_0x425e('0x172')]['belongsToMany'](db[_0x425e('0x11b')],{'through':_0x425e('0x18d')});db[_0x425e('0x172')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x425e('0x1b1')});db[_0x425e('0x8e')][_0x425e('0x14f')](db[_0x425e('0x8c')],{'as':'ItemType','foreignKey':_0x425e('0x1b2')});db[_0x425e('0x90')][_0x425e('0x14f')](db[_0x425e('0x70')],{'as':_0x425e('0x1b3'),'foreignKey':_0x425e('0x19f')});db[_0x425e('0x8e')][_0x425e('0x14f')](db['CmContact'],{'as':'Contact','foreignKey':_0x425e('0x19a')});db['Trigger'][_0x425e('0x115')](db[_0x425e('0x81')],{'as':{'plural':_0x425e('0x1b4'),'singular':'AllCondition'},'foreignKey':_0x425e('0x1b5'),'onDelete':_0x425e('0x113'),'hooks':!![]});db[_0x425e('0x93')]['hasMany'](db['Condition'],{'as':{'plural':_0x425e('0x1b6'),'singular':_0x425e('0x1b7')},'foreignKey':_0x425e('0x1b8'),'onDelete':_0x425e('0x113'),'hooks':!![]});db[_0x425e('0x93')]['hasMany'](db['Action'],{'as':_0x425e('0x1b9'),'foreignKey':_0x425e('0x1ba'),'onDelete':_0x425e('0x113'),'hooks':!![]});db[_0x425e('0x98')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x425e('0x99')][_0x425e('0x115')](db[_0x425e('0x9f')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1ad')});db['AnalyticMetric']['hasMany'](db[_0x425e('0x9f')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1bc')});db[_0x425e('0x9f')][_0x425e('0x14f')](db[_0x425e('0x9d')],{'foreignKey':_0x425e('0x1bc')});db[_0x425e('0x1bd')][_0x425e('0x115')](db[_0x425e('0x1be')],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0x1be')][_0x425e('0x115')](db['SalesforceField'],{'as':_0x425e('0x1c1'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0x1be')][_0x425e('0x115')](db[_0x425e('0xa4')],{'as':'Descriptions','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c3')});db['SalesforceConfiguration']['hasMany'](db[_0x425e('0xa4')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c4')});db['SalesforceConfiguration'][_0x425e('0x14f')](db[_0x425e('0x1bd')],{'as':'Account','foreignKey':_0x425e('0x1c0')});db[_0x425e('0xa4')][_0x425e('0x115')](db['SalesforceField'],{'as':_0x425e('0x1c5'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0xa4')]['hasMany'](db[_0x425e('0xa4')],{'as':_0x425e('0x1c6'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xa4')][_0x425e('0x115')](db[_0x425e('0xa4')],{'as':_0x425e('0x1c7'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xa4')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x425e('0x1c8')});db[_0x425e('0xa6')][_0x425e('0x115')](db[_0x425e('0x1c9')],{'as':'Configurations','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0x1c9')][_0x425e('0x115')](db[_0x425e('0x1ca')],{'as':_0x425e('0x1c1'),'onDelete':_0x425e('0x113'),'foreignKey':'SubjectId'});db[_0x425e('0x1c9')][_0x425e('0x115')](db[_0x425e('0x1ca')],{'as':'Descriptions','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0x1c9')][_0x425e('0x115')](db[_0x425e('0x1ca')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':'FieldId'});db[_0x425e('0x1c9')]['belongsTo'](db[_0x425e('0xa6')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0x1ca')][_0x425e('0x115')](db[_0x425e('0x1ca')],{'as':'Subject','foreignKey':_0x425e('0x1c2')});db['SugarcrmField'][_0x425e('0x115')](db['SugarcrmField'],{'as':_0x425e('0x1c6'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0x1ca')][_0x425e('0x115')](db[_0x425e('0x1ca')],{'as':'Field','foreignKey':'FieldId'});db[_0x425e('0x1ca')][_0x425e('0x14f')](db['Variable'],{'as':_0x425e('0x95'),'foreignKey':_0x425e('0x1c8')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0x425e('0x1bf'),'onDelete':'cascade','foreignKey':_0x425e('0x1c0')});db[_0x425e('0xaa')][_0x425e('0x115')](db[_0x425e('0x1cb')],{'as':_0x425e('0x1c1'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0xaa')][_0x425e('0x115')](db[_0x425e('0x1cb')],{'as':'Descriptions','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xaa')][_0x425e('0x115')](db['DeskField'],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xaa')][_0x425e('0x14f')](db['DeskAccount'],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xaa')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x1cc')});db[_0x425e('0x1cb')][_0x425e('0x115')](db['DeskField'],{'as':'Subject','foreignKey':_0x425e('0x1c2')});db[_0x425e('0x1cb')][_0x425e('0x115')](db[_0x425e('0x1cb')],{'as':'Description','foreignKey':_0x425e('0x1c3')});db['DeskField'][_0x425e('0x115')](db[_0x425e('0x1cb')],{'as':'Field','foreignKey':_0x425e('0x1c4')});db[_0x425e('0x1cb')][_0x425e('0x14f')](db['Variable'],{'as':_0x425e('0x95'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x425e('0x115')](db[_0x425e('0xae')],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xae')][_0x425e('0x115')](db[_0x425e('0xb0')],{'as':_0x425e('0x1c1'),'onDelete':_0x425e('0x113'),'foreignKey':'SubjectId'});db[_0x425e('0xae')][_0x425e('0x115')](db[_0x425e('0xb0')],{'as':_0x425e('0x1cd'),'onDelete':_0x425e('0x113'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x425e('0x115')](db[_0x425e('0xb0')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xae')][_0x425e('0x14f')](db[_0x425e('0x1ce')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xb0')]['hasMany'](db['ZohoField'],{'as':'Subject','foreignKey':_0x425e('0x1c2')});db['ZohoField'][_0x425e('0x115')](db[_0x425e('0xb0')],{'as':_0x425e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x425e('0xb0')][_0x425e('0x115')](db[_0x425e('0xb0')],{'as':'Field','foreignKey':_0x425e('0x1c4')});db[_0x425e('0xb0')][_0x425e('0x14f')](db[_0x425e('0x95')],{'as':_0x425e('0x95'),'foreignKey':_0x425e('0x1c8')});db[_0x425e('0xb1')][_0x425e('0x115')](db['ZendeskConfiguration'],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x425e('0x115')](db[_0x425e('0xb4')],{'as':'Subjects','foreignKey':_0x425e('0x1c2')});db[_0x425e('0xb3')][_0x425e('0x115')](db['ZendeskField'],{'as':_0x425e('0x1cd'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xb3')][_0x425e('0x115')](db[_0x425e('0xb4')],{'as':_0x425e('0x1bb'),'foreignKey':'FieldId'});db[_0x425e('0xb3')][_0x425e('0x14f')](db[_0x425e('0xb1')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xb3')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x1cf')});db[_0x425e('0xb4')][_0x425e('0x115')](db[_0x425e('0xb4')],{'as':_0x425e('0x1c5'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x425e('0x115')](db[_0x425e('0xb4')],{'as':_0x425e('0x1c6'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xb4')][_0x425e('0x115')](db[_0x425e('0xb4')],{'as':'Field','foreignKey':_0x425e('0x1c4')});db['ZendeskField'][_0x425e('0x14f')](db['Variable'],{'as':_0x425e('0x95'),'foreignKey':_0x425e('0x1c8')});db[_0x425e('0xb6')][_0x425e('0x115')](db[_0x425e('0xb8')],{'as':'Configurations','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xb8')][_0x425e('0x115')](db[_0x425e('0x1d0')],{'as':_0x425e('0x1c1'),'onDelete':_0x425e('0x113'),'foreignKey':'SubjectId'});db[_0x425e('0xb8')]['hasMany'](db[_0x425e('0x1d0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x425e('0xb8')][_0x425e('0x115')](db[_0x425e('0x1d0')],{'as':_0x425e('0x1bb'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xb8')]['belongsTo'](db[_0x425e('0xb6')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xb8')]['belongsToMany'](db[_0x425e('0x172')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x425e('0x1d0')][_0x425e('0x115')](db[_0x425e('0x1d0')],{'as':_0x425e('0x1c5'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0x1d0')]['hasMany'](db[_0x425e('0x1d0')],{'as':_0x425e('0x1c6'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0x1d0')]['hasMany'](db[_0x425e('0x1d0')],{'as':_0x425e('0x1c7'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0x1d0')]['belongsTo'](db['Variable'],{'as':_0x425e('0x95'),'foreignKey':_0x425e('0x1c8')});db[_0x425e('0xba')][_0x425e('0x115')](db[_0x425e('0xbb')],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db['VtigerConfiguration'][_0x425e('0x115')](db[_0x425e('0xbd')],{'as':_0x425e('0x1c1'),'foreignKey':'SubjectId'});db[_0x425e('0xbb')]['hasMany'](db[_0x425e('0xbd')],{'as':_0x425e('0x1cd'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xbb')][_0x425e('0x115')](db[_0x425e('0xbd')],{'as':_0x425e('0x1bb'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xbb')][_0x425e('0x14f')](db['VtigerAccount'],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xbd')][_0x425e('0x115')](db[_0x425e('0xbd')],{'as':_0x425e('0x1c5'),'foreignKey':'SubjectId'});db[_0x425e('0xbd')][_0x425e('0x115')](db[_0x425e('0xbd')],{'as':_0x425e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x425e('0xbd')][_0x425e('0x115')](db['VtigerField'],{'as':_0x425e('0x1c7'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xbd')][_0x425e('0x14f')](db[_0x425e('0x95')],{'as':_0x425e('0x95'),'foreignKey':'VariableId'});db[_0x425e('0x1d1')][_0x425e('0x115')](db[_0x425e('0x1d2')],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0x1d2')]['hasMany'](db[_0x425e('0xc0')],{'as':'Subjects','foreignKey':_0x425e('0x1c2')});db[_0x425e('0x1d2')][_0x425e('0x115')](db['ServicenowField'],{'as':_0x425e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x425e('0x1d2')][_0x425e('0x115')](db['ServicenowField'],{'as':_0x425e('0x1bb'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x425e('0x14f')](db['ServicenowAccount'],{'as':_0x425e('0x171'),'foreignKey':'AccountId'});db[_0x425e('0xc0')][_0x425e('0x115')](db[_0x425e('0xc0')],{'as':'Subject','foreignKey':_0x425e('0x1c2')});db[_0x425e('0xc0')][_0x425e('0x115')](db[_0x425e('0xc0')],{'as':'Description','foreignKey':_0x425e('0x1c3')});db[_0x425e('0xc0')][_0x425e('0x115')](db['ServicenowField'],{'as':'Field','foreignKey':_0x425e('0x1c4')});db['ServicenowField'][_0x425e('0x14f')](db[_0x425e('0x95')],{'as':_0x425e('0x95'),'foreignKey':'VariableId'});db[_0x425e('0xc2')]['hasMany'](db[_0x425e('0x1d3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x425e('0x1c0')});db[_0x425e('0xc2')]['belongsTo'](db[_0x425e('0x10a')],{'as':_0x425e('0x10a'),'foreignKey':_0x425e('0x163')});db[_0x425e('0x1d3')][_0x425e('0x115')](db[_0x425e('0xc3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x425e('0x1c2')});db[_0x425e('0x1d3')][_0x425e('0x115')](db[_0x425e('0xc3')],{'as':_0x425e('0x1cd'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0x1d3')][_0x425e('0x115')](db[_0x425e('0xc3')],{'as':_0x425e('0x1bb'),'onDelete':'cascade','foreignKey':_0x425e('0x1c4')});db[_0x425e('0x1d3')][_0x425e('0x14f')](db[_0x425e('0xc2')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xc3')][_0x425e('0x115')](db[_0x425e('0xc3')],{'as':_0x425e('0x1c5'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0xc3')][_0x425e('0x115')](db[_0x425e('0xc3')],{'as':_0x425e('0x1c6'),'foreignKey':_0x425e('0x1c3')});db['Dynamics365Field'][_0x425e('0x115')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x425e('0x1c4')});db[_0x425e('0xc3')][_0x425e('0x14f')](db[_0x425e('0x95')],{'as':'Variable','foreignKey':_0x425e('0x1c8')});db[_0x425e('0x1d4')][_0x425e('0x115')](db[_0x425e('0xc6')],{'as':_0x425e('0x1bf'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1c0')});db[_0x425e('0xc6')][_0x425e('0x115')](db[_0x425e('0xc7')],{'as':_0x425e('0x1c1'),'foreignKey':_0x425e('0x1c2')});db[_0x425e('0xc6')][_0x425e('0x115')](db[_0x425e('0xc7')],{'as':_0x425e('0x1cd'),'foreignKey':_0x425e('0x1c3')});db[_0x425e('0xc6')][_0x425e('0x115')](db[_0x425e('0xc7')],{'as':_0x425e('0x1bb'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xc6')][_0x425e('0x14f')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x425e('0x1c0')});db['FreshsalesField']['hasMany'](db[_0x425e('0xc7')],{'as':_0x425e('0x1c5'),'foreignKey':'SubjectId'});db[_0x425e('0xc7')][_0x425e('0x115')](db['FreshsalesField'],{'as':_0x425e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x425e('0xc7')]['hasMany'](db[_0x425e('0xc7')],{'as':_0x425e('0x1c7'),'foreignKey':_0x425e('0x1c4')});db[_0x425e('0xc7')][_0x425e('0x14f')](db['Variable'],{'as':_0x425e('0x95'),'foreignKey':_0x425e('0x1c8')});db['ChatQueueReport'][_0x425e('0x14f')](db[_0x425e('0x5e')],{});db[_0x425e('0x1d5')]['belongsTo'](db[_0x425e('0xf4')],{'as':'List','foreignKey':_0x425e('0x16c')});db['ChatQueueReport'][_0x425e('0x14f')](db['CmContact'],{'as':_0x425e('0x161'),'foreignKey':_0x425e('0x162')});db[_0x425e('0x1d5')][_0x425e('0x14f')](db[_0x425e('0x61')],{});db[_0x425e('0x1d5')][_0x425e('0x14f')](db['ChatMessage'],{});db[_0x425e('0x1d5')][_0x425e('0x14f')](db[_0x425e('0x13')],{});db[_0x425e('0x1d5')]['belongsTo'](db[_0x425e('0x67')],{});db[_0x425e('0xcb')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1d6')});db[_0x425e('0xcb')][_0x425e('0x14f')](db[_0x425e('0x13')],{'onDelete':_0x425e('0x113'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0x425e('0x115')](db[_0x425e('0xce')],{'foreignKey':_0x425e('0x1d7'),'onDelete':_0x425e('0x113')});db[_0x425e('0xd0')][_0x425e('0x115')](db[_0x425e('0xcd')],{'foreignKey':_0x425e('0x1d7'),'onDelete':'cascade'});db[_0x425e('0xd2')][_0x425e('0x14f')](db[_0x425e('0x50')],{});db[_0x425e('0xd2')][_0x425e('0x14f')](db[_0x425e('0xf4')],{'as':_0x425e('0x16b'),'foreignKey':'ListId'});db[_0x425e('0xd2')][_0x425e('0x14f')](db['CmContact'],{'as':_0x425e('0x161'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0x425e('0x53')],{});db[_0x425e('0xd2')][_0x425e('0x14f')](db['SmsMessage'],{});db[_0x425e('0xd2')][_0x425e('0x14f')](db[_0x425e('0x13')],{});db['SmsQueueReport'][_0x425e('0x14f')](db[_0x425e('0x56')],{});db[_0x425e('0xd7')][_0x425e('0x115')](db[_0x425e('0xd0')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x425e('0x115')](db[_0x425e('0xce')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x425e('0x115')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['Team'][_0x425e('0x126')](db[_0x425e('0x13')],{'as':'Agents','through':'user_has_teams'});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x1c')],{'through':_0x425e('0x158'),'as':_0x425e('0x133')});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x3d')],{'through':'team_has_mail_queues','as':_0x425e('0x136')});db['Team'][_0x425e('0x126')](db[_0x425e('0x67')],{'through':_0x425e('0x195'),'as':_0x425e('0x137')});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x4c')],{'through':'team_has_fax_queues','as':_0x425e('0x138')});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x56')],{'through':_0x425e('0x1d8'),'as':_0x425e('0x139')});db['Team'][_0x425e('0x126')](db['OpenchannelQueue'],{'through':_0x425e('0x18e'),'as':'OpenchannelQueues'});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x108')],{'through':_0x425e('0x1d9'),'as':_0x425e('0x13c')});db[_0x425e('0xe2')][_0x425e('0x126')](db[_0x425e('0x134')],{'through':_0x425e('0x10b'),'as':_0x425e('0x135')});db[_0x425e('0xe5')]['hasMany'](db[_0x425e('0x70')],{'as':'Hoppers','foreignKey':_0x425e('0x1a0')});db[_0x425e('0xe5')][_0x425e('0x115')](db[_0x425e('0x73')],{'as':'HopperFinals','foreignKey':_0x425e('0x1a0')});db[_0x425e('0xe5')][_0x425e('0x115')](db[_0x425e('0x75')],{'as':_0x425e('0x14c'),'foreignKey':_0x425e('0x1a0')});db[_0x425e('0xe5')][_0x425e('0x115')](db[_0x425e('0x72')],{'as':'HopperBlacks','foreignKey':_0x425e('0x1a0')});db['Campaign'][_0x425e('0x14f')](db['Trunk'],{'as':_0x425e('0x28'),'foreignKey':_0x425e('0x150')});db[_0x425e('0xe5')][_0x425e('0x14f')](db[_0x425e('0x28')],{'as':_0x425e('0x151'),'foreignKey':_0x425e('0x152')});db['Campaign']['belongsTo'](db[_0x425e('0x83')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x425e('0xe5')][_0x425e('0x14f')](db[_0x425e('0xdc')],{'as':_0x425e('0xdc'),'foreignKey':_0x425e('0x1da')});db[_0x425e('0xe5')][_0x425e('0x126')](db[_0x425e('0xf4')],{'as':_0x425e('0x12a'),'through':'campaigns_has_cm_lists'});db[_0x425e('0xe5')][_0x425e('0x126')](db[_0x425e('0xf4')],{'as':_0x425e('0x1db'),'through':_0x425e('0x1dc')});db[_0x425e('0x176')][_0x425e('0x14f')](db[_0x425e('0x65')],{'as':_0x425e('0x65'),'foreignKey':_0x425e('0x17a')});db[_0x425e('0xeb')][_0x425e('0x14f')](db['MailMessage'],{});db[_0x425e('0xeb')][_0x425e('0x14f')](db[_0x425e('0x40')],{});db[_0x425e('0xeb')][_0x425e('0x14f')](db[_0x425e('0x3b')],{'foreignKey':_0x425e('0x1dd'),'as':_0x425e('0x1de')});db[_0x425e('0xeb')][_0x425e('0x14f')](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1df'),'as':_0x425e('0x1e0')});db[_0x425e('0xeb')][_0x425e('0x14f')](db[_0x425e('0x13')],{'foreignKey':'ToUserId','as':_0x425e('0x1e1')});db[_0x425e('0xeb')][_0x425e('0x14f')](db[_0x425e('0x3d')],{'foreignKey':_0x425e('0x1e2'),'as':_0x425e('0x1e3')});db[_0x425e('0xeb')]['belongsTo'](db[_0x425e('0x3b')],{'foreignKey':_0x425e('0x1e4'),'as':_0x425e('0x1e5')});db[_0x425e('0xed')]['belongsTo'](db[_0x425e('0x63')],{});db['ChatTransferReport'][_0x425e('0x14f')](db[_0x425e('0x61')],{});db['ChatTransferReport'][_0x425e('0x14f')](db[_0x425e('0x5e')],{'foreignKey':_0x425e('0x1e6'),'as':_0x425e('0x1de')});db['ChatTransferReport'][_0x425e('0x14f')](db['User'],{'foreignKey':'FromUserId','as':_0x425e('0x1e0')});db['ChatTransferReport'][_0x425e('0x14f')](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1e7'),'as':_0x425e('0x1e1')});db[_0x425e('0xed')]['belongsTo'](db[_0x425e('0x67')],{'foreignKey':_0x425e('0x1e8'),'as':_0x425e('0x1e3')});db[_0x425e('0xed')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x425e('0x1e9'),'as':_0x425e('0x1e5')});db[_0x425e('0xef')]['belongsTo'](db[_0x425e('0x4a')],{});db[_0x425e('0xef')][_0x425e('0x14f')](db[_0x425e('0x17f')],{});db[_0x425e('0xef')][_0x425e('0x14f')](db[_0x425e('0x47')],{'foreignKey':'FromFaxAccountId','as':_0x425e('0x1de')});db['FaxTransferReport'][_0x425e('0x14f')](db['User'],{'foreignKey':_0x425e('0x1df'),'as':'FromAgent'});db[_0x425e('0xef')]['belongsTo'](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1e7'),'as':_0x425e('0x1e1')});db['FaxTransferReport'][_0x425e('0x14f')](db[_0x425e('0x4c')],{'foreignKey':_0x425e('0x1ea'),'as':'ToQueue'});db[_0x425e('0xef')][_0x425e('0x14f')](db[_0x425e('0x47')],{'foreignKey':_0x425e('0x1eb'),'as':_0x425e('0x1e5')});db['OpenchannelTransferReport']['belongsTo'](db[_0x425e('0x5b')],{});db[_0x425e('0xf1')][_0x425e('0x14f')](db[_0x425e('0x11b')],{});db[_0x425e('0xf1')][_0x425e('0x14f')](db[_0x425e('0x141')],{'foreignKey':_0x425e('0x1ec'),'as':_0x425e('0x1de')});db[_0x425e('0xf1')]['belongsTo'](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1df'),'as':_0x425e('0x1e0')});db[_0x425e('0xf1')][_0x425e('0x14f')](db['User'],{'foreignKey':_0x425e('0x1e7'),'as':_0x425e('0x1e1')});db[_0x425e('0xf1')][_0x425e('0x14f')](db['OpenchannelQueue'],{'foreignKey':_0x425e('0x1ed'),'as':_0x425e('0x1e3')});db[_0x425e('0xf1')][_0x425e('0x14f')](db[_0x425e('0x141')],{'foreignKey':_0x425e('0x1ee'),'as':'ToAccount'});db[_0x425e('0x1ef')]['belongsTo'](db[_0x425e('0x54')],{});db['SmsTransferReport'][_0x425e('0x14f')](db['SmsInteraction'],{});db[_0x425e('0x1ef')][_0x425e('0x14f')](db['SmsAccount'],{'foreignKey':_0x425e('0x1f0'),'as':'FromAccount'});db[_0x425e('0x1ef')]['belongsTo'](db[_0x425e('0x13')],{'foreignKey':'FromUserId','as':_0x425e('0x1e0')});db['SmsTransferReport'][_0x425e('0x14f')](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1e7'),'as':_0x425e('0x1e1')});db[_0x425e('0x1ef')][_0x425e('0x14f')](db[_0x425e('0x56')],{'foreignKey':_0x425e('0x1f1'),'as':_0x425e('0x1e3')});db[_0x425e('0x1ef')][_0x425e('0x14f')](db[_0x425e('0x50')],{'foreignKey':_0x425e('0x1f2'),'as':_0x425e('0x1e5')});db[_0x425e('0xf4')][_0x425e('0x115')](db[_0x425e('0x7f')],{'as':'Dispositions','foreignKey':_0x425e('0x16c'),'onDelete':_0x425e('0x113')});db[_0x425e('0xf4')][_0x425e('0x115')](db[_0x425e('0x78')],{'as':_0x425e('0x1f3'),'foreignKey':_0x425e('0x16c')});db['CmList'][_0x425e('0x115')](db[_0x425e('0x6e')],{'as':'Contacts','onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x16c')});db[_0x425e('0xf4')]['hasMany'](db[_0x425e('0x73')],{'as':_0x425e('0x119'),'foreignKey':_0x425e('0x16c')});db[_0x425e('0xf4')][_0x425e('0x115')](db[_0x425e('0x75')],{'as':'HopperHistory','foreignKey':_0x425e('0x16c')});db['CmList'][_0x425e('0x115')](db['ReportAgentPreview'],{'as':_0x425e('0x76'),'foreignKey':_0x425e('0x16c')});db[_0x425e('0xf4')]['belongsToMany'](db['VoiceQueue'],{'as':_0x425e('0x1f4'),'through':_0x425e('0x155')});db[_0x425e('0xf4')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x12b')});db[_0x425e('0x134')][_0x425e('0x115')](db[_0x425e('0x19')],{'as':_0x425e('0x118'),'onDelete':_0x425e('0x113')});db[_0x425e('0x134')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x10c')});db[_0x425e('0x134')][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':'TeamVoicePrefix','as':_0x425e('0x157')});db[_0x425e('0xf7')][_0x425e('0x115')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x425e('0xf7')][_0x425e('0x115')](db[_0x425e('0x1f5')],{'as':_0x425e('0x1f6'),'foreignKey':_0x425e('0x125'),'onDelete':_0x425e('0x113')});db[_0x425e('0x1f5')][_0x425e('0x115')](db['UserProfileResource'],{'as':_0x425e('0x1f7'),'foreignKey':_0x425e('0x1f8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x425e('0x115')](db[_0x425e('0x7f')],{'as':_0x425e('0x168'),'foreignKey':'WhatsappAccountId','onDelete':_0x425e('0x113')});db[_0x425e('0x1f9')][_0x425e('0x115')](db[_0x425e('0x7d')],{'as':_0x425e('0x169'),'foreignKey':_0x425e('0x1fa')});db[_0x425e('0x1f9')][_0x425e('0x115')](db[_0x425e('0x102')],{'as':_0x425e('0x15a'),'foreignKey':'WhatsappAccountId'});db[_0x425e('0x1f9')]['hasMany'](db[_0x425e('0x100')],{'as':_0x425e('0x16a')});db[_0x425e('0x1f9')][_0x425e('0x115')](db['WhatsappApplication'],{'as':_0x425e('0x146'),'foreignKey':'WhatsappAccountId','onDelete':_0x425e('0x113')});db['WhatsappAccount']['belongsTo'](db[_0x425e('0xf4')],{'as':'List','foreignKey':_0x425e('0x16c')});db[_0x425e('0x1f9')][_0x425e('0x14f')](db[_0x425e('0x84')],{'as':_0x425e('0x154'),'foreignKey':_0x425e('0x16f')});db[_0x425e('0x1f9')]['belongsToMany'](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x1fb')});db[_0x425e('0xfe')][_0x425e('0x14f')](db['User'],{'onDelete':_0x425e('0x164')});db[_0x425e('0xfe')]['belongsTo'](db[_0x425e('0x108')],{'onDelete':_0x425e('0x164')});db['WhatsappApplication'][_0x425e('0x14f')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x425e('0xfe')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':_0x425e('0x164'),'foreignKey':_0x425e('0x17b')});db[_0x425e('0x100')][_0x425e('0x115')](db[_0x425e('0x102')],{'as':_0x425e('0x15a'),'onDelete':_0x425e('0x113'),'foreignKey':_0x425e('0x1fc')});db[_0x425e('0x100')][_0x425e('0x14f')](db[_0x425e('0x1f9')],{'as':_0x425e('0x171'),'foreignKey':_0x425e('0x1fa')});db[_0x425e('0x100')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':_0x425e('0x161'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0x425e('0x13')],{'as':_0x425e('0x187'),'foreignKey':_0x425e('0x114')});db[_0x425e('0x100')][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x1b1'),'as':_0x425e('0x173')});db['WhatsappInteraction'][_0x425e('0x126')](db[_0x425e('0x172')],{'through':_0x425e('0x1b1'),'as':_0x425e('0x188')});db[_0x425e('0x100')][_0x425e('0x126')](db[_0x425e('0x13')],{'as':'Users','through':_0x425e('0x132'),'foreignKey':_0x425e('0x1fc')});db['WhatsappMessage'][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x13')});db[_0x425e('0x102')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'onDelete':_0x425e('0x113'),'as':'Contact'});db[_0x425e('0x102')][_0x425e('0x14f')](db[_0x425e('0x100')],{'onDelete':'cascade','as':_0x425e('0x178'),'foreignKey':_0x425e('0x1fc')});db[_0x425e('0x102')][_0x425e('0x14f')](db[_0x425e('0x1f9')],{'as':_0x425e('0x171'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x425e('0x14f')](db[_0x425e('0x1f9')],{});db[_0x425e('0x104')][_0x425e('0x14f')](db['CmList'],{'as':_0x425e('0x16b'),'foreignKey':_0x425e('0x16c')});db[_0x425e('0x104')][_0x425e('0x14f')](db[_0x425e('0x6e')],{'as':'Contact','foreignKey':_0x425e('0x162')});db[_0x425e('0x104')][_0x425e('0x14f')](db[_0x425e('0x100')],{});db[_0x425e('0x104')][_0x425e('0x14f')](db[_0x425e('0x108')],{});db[_0x425e('0x104')]['belongsTo'](db[_0x425e('0x102')],{});db[_0x425e('0x104')]['belongsTo'](db[_0x425e('0x13')],{});db[_0x425e('0x106')][_0x425e('0x14f')](db[_0x425e('0x102')],{});db[_0x425e('0x106')][_0x425e('0x14f')](db[_0x425e('0x100')],{});db['WhatsappTransferReport'][_0x425e('0x14f')](db[_0x425e('0x1f9')],{'foreignKey':'FromWhatsappAccountId','as':_0x425e('0x1de')});db[_0x425e('0x106')][_0x425e('0x14f')](db[_0x425e('0x1f9')],{'foreignKey':'ToWhatsappAccountId','as':_0x425e('0x1e5')});db[_0x425e('0x106')][_0x425e('0x14f')](db[_0x425e('0x108')],{'foreignKey':_0x425e('0x1fd'),'as':'ToQueue'});db[_0x425e('0x106')]['belongsTo'](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1df'),'as':'FromAgent'});db['WhatsappTransferReport']['belongsTo'](db[_0x425e('0x13')],{'foreignKey':_0x425e('0x1e7'),'as':_0x425e('0x1e1')});db[_0x425e('0x108')]['belongsToMany'](db[_0x425e('0x13')],{'as':_0x425e('0x156'),'through':_0x425e('0x36'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x425e('0x126')](db[_0x425e('0xe2')],{'through':_0x425e('0x1d9'),'as':'Teams'});db[_0x425e('0x10d')][_0x425e('0x14f')](db[_0x425e('0x13')],{'as':_0x425e('0x1fe'),'foreignKey':_0x425e('0x114'),'onDelete':_0x425e('0x113'),'hooks':!![]});db[_0x425e('0x10a')]['hasOne'](db[_0x425e('0xc2')],{'as':_0x425e('0xc2'),'onDelete':_0x425e('0x164')});db['CloudProvider'][_0x425e('0x111')](db[_0x425e('0x38')],{'as':'Imap','onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0x425e('0x3a')],{'as':_0x425e('0x167'),'onDelete':_0x425e('0x164')});module[_0x425e('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e57d477..cd6809b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2f6=['/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./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/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','/api/pauses','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/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/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/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/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/snippet','3.9.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/messages','./api/mailMessage'];(function(_0x370985,_0x5263a5){var _0xc1d964=function(_0x40c268){while(--_0x40c268){_0x370985['push'](_0x370985['shift']());}};_0xc1d964(++_0x5263a5);}(_0xf2f6,0x1f4));var _0x6f2f=function(_0x3f3ec3,_0x3c9cee){_0x3f3ec3=_0x3f3ec3-0x0;var _0x7791be=_0xf2f6[_0x3f3ec3];return _0x7791be;};'use strict';var path=require(_0x6f2f('0x0'));var express=require('express');var errors=require(_0x6f2f('0x1'));var config=require(_0x6f2f('0x2'));var setupLoggers=require(_0x6f2f('0x3'))[_0x6f2f('0x4')];var clientSideLogs=require(_0x6f2f('0x5'));exports[_0x6f2f('0x6')]=function(_0x56944c){return setupLoggers(_0x56944c)[_0x6f2f('0x7')](function(){_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x9'),require(_0x6f2f('0xa')));_0x56944c['use']('/api/voice/chanspy',require(_0x6f2f('0xb')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xc'),require(_0x6f2f('0xd')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xe'),require(_0x6f2f('0xf')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x10'),require('./api/voiceMusicOnHold'));_0x56944c[_0x6f2f('0x8')]('/api/voice/queues',require(_0x6f2f('0x11')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x12'),require(_0x6f2f('0x13')));_0x56944c['use'](_0x6f2f('0x14'),require('./api/screenRecording'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x15'),require(_0x6f2f('0x16')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x17'),require(_0x6f2f('0x18')));_0x56944c['use'](_0x6f2f('0x19'),require(_0x6f2f('0x1a')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x1b'),require('./api/voiceDialReport'));_0x56944c['use']('/api/voice/agents/reports',require(_0x6f2f('0x1c')));_0x56944c['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x1d'),require(_0x6f2f('0x1e')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x1f'),require(_0x6f2f('0x20')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x21'),require(_0x6f2f('0x22')));_0x56944c['use'](_0x6f2f('0x23'),require(_0x6f2f('0x24')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x25'),require(_0x6f2f('0x26')));_0x56944c['use'](_0x6f2f('0x27'),require('./api/mailQueue'));_0x56944c[_0x6f2f('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x56944c[_0x6f2f('0x8')]('/api/mail/interactions',require('./api/mailInteraction'));_0x56944c['use'](_0x6f2f('0x28'),require(_0x6f2f('0x29')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x2a'),require('./api/mailApplication'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x2b'),require(_0x6f2f('0x2c')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x2d'),require(_0x6f2f('0x2e')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x2f'),require(_0x6f2f('0x30')));_0x56944c['use']('/api/fax/accounts',require(_0x6f2f('0x31')));_0x56944c['use'](_0x6f2f('0x32'),require('./api/faxApplication'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x33'),require('./api/faxInteraction'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x34'),require(_0x6f2f('0x35')));_0x56944c[_0x6f2f('0x8')]('/api/fax/queues',require(_0x6f2f('0x36')));_0x56944c['use']('/api/fax/reports/queue',require(_0x6f2f('0x37')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x38'),require(_0x6f2f('0x39')));_0x56944c[_0x6f2f('0x8')]('/api/sms/applications',require(_0x6f2f('0x3a')));_0x56944c[_0x6f2f('0x8')]('/api/sms/interactions',require(_0x6f2f('0x3b')));_0x56944c['use']('/api/sms/messages',require(_0x6f2f('0x3c')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x3d'),require(_0x6f2f('0x3e')));_0x56944c['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x3f'),require(_0x6f2f('0x40')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x41'),require(_0x6f2f('0x42')));_0x56944c[_0x6f2f('0x8')]('/api/openchannel/messages',require(_0x6f2f('0x43')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x44'),require(_0x6f2f('0x45')));_0x56944c['use'](_0x6f2f('0x46'),require(_0x6f2f('0x47')));_0x56944c['use'](_0x6f2f('0x48'),require(_0x6f2f('0x49')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x4a'),require(_0x6f2f('0x4b')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x4c'),require(_0x6f2f('0x4d')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x4e'),require(_0x6f2f('0x4f')));_0x56944c['use'](_0x6f2f('0x50'),require(_0x6f2f('0x51')));_0x56944c[_0x6f2f('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x52'),require(_0x6f2f('0x53')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x54'),require(_0x6f2f('0x55')));_0x56944c['use']('/api/cm/companies',require(_0x6f2f('0x56')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x57'),require('./api/cmContact'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x58'),require(_0x6f2f('0x59')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x5a'),require('./api/cmHopperBlack'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x5b'),require(_0x6f2f('0x5c')));_0x56944c['use']('/api/cm/hopper_history',require(_0x6f2f('0x5d')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x5e'),require('./api/cmCustomField'));_0x56944c['use']('/api/actions',require(_0x6f2f('0x5f')));_0x56944c['use'](_0x6f2f('0x60'),require(_0x6f2f('0x61')));_0x56944c[_0x6f2f('0x8')]('/api/canned_answers',require(_0x6f2f('0x62')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x63'),require('./api/disposition'));_0x56944c['use']('/api/conditions',require('./api/condition'));_0x56944c[_0x6f2f('0x8')]('/api/intervals',require('./api/interval'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x64'),require('./api/pause'));_0x56944c[_0x6f2f('0x8')]('/api/cdr',require(_0x6f2f('0x65')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x66'),require('./api/voiceQueuesLog'));_0x56944c['use'](_0x6f2f('0x67'),require(_0x6f2f('0x68')));_0x56944c['use'](_0x6f2f('0x69'),require(_0x6f2f('0x6a')));_0x56944c[_0x6f2f('0x8')]('/api/tags',require(_0x6f2f('0x6b')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x6c'),require('./api/contactItemType'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x6d'),require(_0x6f2f('0x6e')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x6f'),require(_0x6f2f('0x70')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x71'),require('./api/template'));_0x56944c[_0x6f2f('0x8')]('/api/triggers',require(_0x6f2f('0x72')));_0x56944c['use']('/api/variables',require(_0x6f2f('0x73')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x74'),require(_0x6f2f('0x75')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x76'),require(_0x6f2f('0x77')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x78'),require(_0x6f2f('0x79')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x7a'),require(_0x6f2f('0x7b')));_0x56944c['use']('/api/analytics/extracted_reports',require(_0x6f2f('0x7c')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x7d'),require(_0x6f2f('0x7e')));_0x56944c['use']('/api/analytics/field_reports',require(_0x6f2f('0x7f')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x80'),require(_0x6f2f('0x81')));_0x56944c['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x82'),require(_0x6f2f('0x83')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x84'),require('./api/intSalesforceField'));_0x56944c['use'](_0x6f2f('0x85'),require(_0x6f2f('0x86')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x87'),require('./api/intSugarcrmConfiguration'));_0x56944c['use']('/api/integrations/sugarcrm/fields',require(_0x6f2f('0x88')));_0x56944c['use'](_0x6f2f('0x89'),require(_0x6f2f('0x8a')));_0x56944c[_0x6f2f('0x8')]('/api/integrations/desk/configurations',require(_0x6f2f('0x8b')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x8c'),require(_0x6f2f('0x8d')));_0x56944c['use'](_0x6f2f('0x8e'),require('./api/intZohoAccount'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x8f'),require(_0x6f2f('0x90')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x91'),require('./api/intZohoField'));_0x56944c[_0x6f2f('0x8')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x56944c['use'](_0x6f2f('0x92'),require(_0x6f2f('0x93')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x94'),require(_0x6f2f('0x95')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x96'),require(_0x6f2f('0x97')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x98'),require('./api/intFreshdeskConfiguration'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x99'),require(_0x6f2f('0x9a')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x9b'),require(_0x6f2f('0x9c')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x9d'),require(_0x6f2f('0x9e')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x9f'),require(_0x6f2f('0xa0')));_0x56944c['use']('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xa1'),require('./api/intServicenowConfiguration'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xa2'),require(_0x6f2f('0xa3')));_0x56944c[_0x6f2f('0x8')]('/api/integrations/dynamics365/accounts',require(_0x6f2f('0xa4')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xa5'),require('./api/intDynamics365Configuration'));_0x56944c[_0x6f2f('0x8')]('/api/integrations/dynamics365/fields',require(_0x6f2f('0xa6')));_0x56944c['use'](_0x6f2f('0xa7'),require(_0x6f2f('0xa8')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xa9'),require(_0x6f2f('0xaa')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xab'),require(_0x6f2f('0xac')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xad'),require(_0x6f2f('0xae')));_0x56944c['use'](_0x6f2f('0xaf'),require(_0x6f2f('0xb0')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xb1'),require(_0x6f2f('0xb2')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xb3'),require(_0x6f2f('0xb4')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xb5'),require(_0x6f2f('0xb6')));_0x56944c[_0x6f2f('0x8')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xb7'),require(_0x6f2f('0xb8')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xb9'),require('./api/squareReport'));_0x56944c[_0x6f2f('0x8')]('/api/square/details/reports',require(_0x6f2f('0xba')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xbb'),require(_0x6f2f('0xbc')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xbd'),require(_0x6f2f('0xbe')));_0x56944c['use'](_0x6f2f('0xbf'),require(_0x6f2f('0xc0')));_0x56944c['use'](_0x6f2f('0xc1'),require(_0x6f2f('0xc2')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xc3'),require('./api/squareRecording'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xc4'),require(_0x6f2f('0xc5')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xc6'),require(_0x6f2f('0xc7')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xc8'),require(_0x6f2f('0xc9')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xca'),require(_0x6f2f('0xcb')));_0x56944c['use'](_0x6f2f('0xcc'),require(_0x6f2f('0xcd')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xce'),require(_0x6f2f('0xcf')));_0x56944c[_0x6f2f('0x8')]('/api/plugins',require('./api/plugin'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xd0'),require('./api/mailTransferReport'));_0x56944c[_0x6f2f('0x8')]('/api/chat/reports/transfer',require(_0x6f2f('0xd1')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xd2'),require('./api/faxTransferReport'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xd3'),require(_0x6f2f('0xd4')));_0x56944c['use'](_0x6f2f('0xd5'),require(_0x6f2f('0xd6')));_0x56944c['use'](_0x6f2f('0xd7'),require(_0x6f2f('0xd8')));_0x56944c['use'](_0x6f2f('0xd9'),require(_0x6f2f('0xda')));_0x56944c[_0x6f2f('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xdb'),require(_0x6f2f('0xdc')));_0x56944c['use'](_0x6f2f('0xdd'),require(_0x6f2f('0xde')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xdf'),require(_0x6f2f('0xe0')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xe1'),require(_0x6f2f('0xe2')));_0x56944c['use'](_0x6f2f('0xe3'),require('./api/whatsappApplication'));_0x56944c['use'](_0x6f2f('0xe4'),require('./api/whatsappInteraction'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xe5'),require('./api/whatsappMessage'));_0x56944c['use']('/api/whatsapp/reports/queue',require(_0x6f2f('0xe6')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xe7'),require(_0x6f2f('0xe8')));_0x56944c['use'](_0x6f2f('0xe9'),require(_0x6f2f('0xea')));_0x56944c['use']('/api/cloudProviders',require(_0x6f2f('0xeb')));_0x56944c['use'](_0x6f2f('0xec'),require(_0x6f2f('0xed')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xee'),require(_0x6f2f('0xef')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xf0'),require(_0x6f2f('0xf1')));_0x56944c['use'](_0x6f2f('0xf2'),require(_0x6f2f('0xf3')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xf4'),require(_0x6f2f('0xf5')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xf6'),require(_0x6f2f('0xf7')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xf8'),require(_0x6f2f('0xf9')));_0x56944c[_0x6f2f('0x8')]('/api/rpc',require(_0x6f2f('0xfa')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xfb'),require('./api/version'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xfc'),require(_0x6f2f('0xfd')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xfe'),require('./api/pm2'));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0xff'),require(_0x6f2f('0x100')));_0x56944c[_0x6f2f('0x8')]('/api/logs',clientSideLogs);_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x101'),express[_0x6f2f('0x102')](path[_0x6f2f('0x103')](config[_0x6f2f('0x104')],'/apidoc')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x105'),express[_0x6f2f('0x102')](path['join'](config['root'],_0x6f2f('0x105'))));_0x56944c['use']('/demo',express[_0x6f2f('0x102')](path[_0x6f2f('0x103')](config[_0x6f2f('0x104')],'/demo')));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x106'),express[_0x6f2f('0x102')](path[_0x6f2f('0x103')](config['root'],'snippet',_0x6f2f('0x107'))));_0x56944c[_0x6f2f('0x8')](_0x6f2f('0x108'),express['static'](path[_0x6f2f('0x103')](config[_0x6f2f('0x104')],_0x6f2f('0x109'))));_0x56944c['route'](_0x6f2f('0x10a'))[_0x6f2f('0x10b')](errors[0x194]);_0x56944c['route']('/*')[_0x6f2f('0x10b')](function(_0x4a9da2,_0x3d9a7e){_0x3d9a7e[_0x6f2f('0x10c')](path[_0x6f2f('0x10d')](_0x56944c[_0x6f2f('0x10b')]('appPath')+_0x6f2f('0x10e')));});return _0x56944c;});}; \ No newline at end of file +var _0xa0af=['sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/template','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','/api/campaigns','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get'];(function(_0x1f8da0,_0xbb56b0){var _0x3c779c=function(_0x202eb5){while(--_0x202eb5){_0x1f8da0['push'](_0x1f8da0['shift']());}};_0x3c779c(++_0xbb56b0);}(_0xa0af,0x114));var _0xfa0a=function(_0x383e4c,_0x41a441){_0x383e4c=_0x383e4c-0x0;var _0x1f0b2f=_0xa0af[_0x383e4c];return _0x1f0b2f;};'use strict';var path=require(_0xfa0a('0x0'));var express=require(_0xfa0a('0x1'));var errors=require(_0xfa0a('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xfa0a('0x3'))[_0xfa0a('0x4')];var clientSideLogs=require(_0xfa0a('0x5'));exports[_0xfa0a('0x6')]=function(_0x326cf6){return setupLoggers(_0x326cf6)['then'](function(){_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x8'),require('./api/user'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x9'),require('./api/voiceChanSpy'));_0x326cf6['use'](_0xfa0a('0xa'),require(_0xfa0a('0xb')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xc'),require(_0xfa0a('0xd')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xe'),require(_0xfa0a('0xf')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x10'),require(_0xfa0a('0x11')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x12'),require(_0xfa0a('0x13')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x14'),require(_0xfa0a('0x15')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x16'),require(_0xfa0a('0x17')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x18'),require(_0xfa0a('0x19')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x1a'),require(_0xfa0a('0x1b')));_0x326cf6['use'](_0xfa0a('0x1c'),require('./api/voiceDialReport'));_0x326cf6[_0xfa0a('0x7')]('/api/voice/agents/reports',require(_0xfa0a('0x1d')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x1e'),require(_0xfa0a('0x1f')));_0x326cf6['use'](_0xfa0a('0x20'),require(_0xfa0a('0x21')));_0x326cf6[_0xfa0a('0x7')]('/api/trunks',require(_0xfa0a('0x22')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x23'),require('./api/voiceTransferReport'));_0x326cf6['use'](_0xfa0a('0x24'),require(_0xfa0a('0x25')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x26'),require(_0xfa0a('0x27')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x28'),require(_0xfa0a('0x29')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x2a'),require(_0xfa0a('0x2b')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x2c'),require(_0xfa0a('0x2d')));_0x326cf6['use'](_0xfa0a('0x2e'),require(_0xfa0a('0x2f')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x30'),require(_0xfa0a('0x31')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x32'),require(_0xfa0a('0x33')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x34'),require(_0xfa0a('0x35')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x36'),require(_0xfa0a('0x37')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x38'),require(_0xfa0a('0x39')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x3a'),require(_0xfa0a('0x3b')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x3c'),require(_0xfa0a('0x3d')));_0x326cf6['use'](_0xfa0a('0x3e'),require(_0xfa0a('0x3f')));_0x326cf6['use'](_0xfa0a('0x40'),require(_0xfa0a('0x41')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x42'),require(_0xfa0a('0x43')));_0x326cf6[_0xfa0a('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x44'),require('./api/smsApplication'));_0x326cf6['use'](_0xfa0a('0x45'),require(_0xfa0a('0x46')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x47'),require(_0xfa0a('0x48')));_0x326cf6['use']('/api/sms/queues',require(_0xfa0a('0x49')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x4a'),require(_0xfa0a('0x4b')));_0x326cf6[_0xfa0a('0x7')]('/api/openchannel/applications',require(_0xfa0a('0x4c')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x4d'),require('./api/openchannelInteraction'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x4e'),require(_0xfa0a('0x4f')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x50'),require('./api/openchannelQueue'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x51'),require('./api/chatWebsite'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x52'),require(_0xfa0a('0x53')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x54'),require(_0xfa0a('0x55')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x56'),require(_0xfa0a('0x57')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x58'),require(_0xfa0a('0x59')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x5a'),require('./api/chatOfflineMessage'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x5b'),require('./api/chatQueue'));_0x326cf6['use']('/api/chat/groups',require(_0xfa0a('0x5c')));_0x326cf6['use']('/api/chat/proactive_actions',require(_0xfa0a('0x5d')));_0x326cf6['use'](_0xfa0a('0x5e'),require(_0xfa0a('0x5f')));_0x326cf6['use'](_0xfa0a('0x60'),require(_0xfa0a('0x61')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x62'),require(_0xfa0a('0x63')));_0x326cf6[_0xfa0a('0x7')]('/api/cm/hopper_black',require(_0xfa0a('0x64')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x65'),require(_0xfa0a('0x66')));_0x326cf6['use'](_0xfa0a('0x67'),require(_0xfa0a('0x68')));_0x326cf6['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x326cf6['use'](_0xfa0a('0x69'),require(_0xfa0a('0x6a')));_0x326cf6['use'](_0xfa0a('0x6b'),require(_0xfa0a('0x6c')));_0x326cf6['use'](_0xfa0a('0x6d'),require('./api/cannedAnswer'));_0x326cf6['use']('/api/dispositions',require('./api/disposition'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x6e'),require(_0xfa0a('0x6f')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x70'),require(_0xfa0a('0x71')));_0x326cf6['use'](_0xfa0a('0x72'),require(_0xfa0a('0x73')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x74'),require(_0xfa0a('0x75')));_0x326cf6[_0xfa0a('0x7')]('/api/voiceQueuesLog',require(_0xfa0a('0x76')));_0x326cf6[_0xfa0a('0x7')]('/api/schedules',require(_0xfa0a('0x77')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x78'),require('./api/sound'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x79'),require('./api/tag'));_0x326cf6['use']('/api/contact_item_types',require(_0xfa0a('0x7a')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x7b'),require(_0xfa0a('0x7c')));_0x326cf6[_0xfa0a('0x7')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x326cf6[_0xfa0a('0x7')]('/api/templates',require(_0xfa0a('0x7d')));_0x326cf6[_0xfa0a('0x7')]('/api/triggers',require('./api/trigger'));_0x326cf6['use']('/api/variables',require(_0xfa0a('0x7e')));_0x326cf6['use'](_0xfa0a('0x7f'),require(_0xfa0a('0x80')));_0x326cf6['use'](_0xfa0a('0x81'),require(_0xfa0a('0x82')));_0x326cf6['use'](_0xfa0a('0x83'),require('./api/analyticCustomReport'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x84'),require(_0xfa0a('0x85')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x86'),require(_0xfa0a('0x87')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x88'),require('./api/analyticMetric'));_0x326cf6['use'](_0xfa0a('0x89'),require(_0xfa0a('0x8a')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x8b'),require(_0xfa0a('0x8c')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x8d'),require(_0xfa0a('0x8e')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x8f'),require(_0xfa0a('0x90')));_0x326cf6['use'](_0xfa0a('0x91'),require(_0xfa0a('0x92')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xfa0a('0x93')));_0x326cf6['use'](_0xfa0a('0x94'),require(_0xfa0a('0x95')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/desk/accounts',require(_0xfa0a('0x96')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/desk/configurations',require(_0xfa0a('0x97')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x98'),require('./api/intDeskField'));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/zoho/accounts',require(_0xfa0a('0x99')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x9a'),require('./api/intZohoConfiguration'));_0x326cf6['use'](_0xfa0a('0x9b'),require(_0xfa0a('0x9c')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x9d'),require('./api/intZendeskAccount'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x9e'),require(_0xfa0a('0x9f')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/zendesk/fields',require(_0xfa0a('0xa0')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xa1'),require(_0xfa0a('0xa2')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xa3'),require(_0xfa0a('0xa4')));_0x326cf6['use'](_0xfa0a('0xa5'),require(_0xfa0a('0xa6')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/vtiger/configurations',require(_0xfa0a('0xa7')));_0x326cf6['use'](_0xfa0a('0xa8'),require(_0xfa0a('0xa9')));_0x326cf6[_0xfa0a('0x7')]('/api/integrations/servicenow/accounts',require(_0xfa0a('0xaa')));_0x326cf6['use']('/api/integrations/servicenow/configurations',require(_0xfa0a('0xab')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xac'),require(_0xfa0a('0xad')));_0x326cf6['use'](_0xfa0a('0xae'),require(_0xfa0a('0xaf')));_0x326cf6['use']('/api/integrations/dynamics365/configurations',require(_0xfa0a('0xb0')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xb1'),require(_0xfa0a('0xb2')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xb3'),require(_0xfa0a('0xb4')));_0x326cf6['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xb5'),require(_0xfa0a('0xb6')));_0x326cf6[_0xfa0a('0x7')]('/api/networks',require(_0xfa0a('0xb7')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xb8'),require(_0xfa0a('0xb9')));_0x326cf6[_0xfa0a('0x7')]('/api/chat/internal/messages',require(_0xfa0a('0xba')));_0x326cf6[_0xfa0a('0x7')]('/api/jscripty/answers/reports',require(_0xfa0a('0xbb')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xbc'),require(_0xfa0a('0xbd')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xbe'),require('./api/jscriptySessionReport'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xbf'),require(_0xfa0a('0xc0')));_0x326cf6['use'](_0xfa0a('0xc1'),require(_0xfa0a('0xc2')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xc3'),require(_0xfa0a('0xc4')));_0x326cf6['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xc5'),require(_0xfa0a('0xc6')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xc7'),require(_0xfa0a('0xc8')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xc9'),require(_0xfa0a('0xca')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xcb'),require(_0xfa0a('0xcc')));_0x326cf6[_0xfa0a('0x7')]('/api/square/messages',require(_0xfa0a('0xcd')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xce'),require('./api/team'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xcf'),require('./api/license'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd0'),require('./api/campaign'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd1'),require('./api/migration'));_0x326cf6['use'](_0xfa0a('0xd2'),require('./api/attachment'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd3'),require('./api/plugin'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd4'),require('./api/mailTransferReport'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd5'),require(_0xfa0a('0xd6')));_0x326cf6[_0xfa0a('0x7')]('/api/fax/reports/transfer',require(_0xfa0a('0xd7')));_0x326cf6['use'](_0xfa0a('0xd8'),require('./api/openchannelTransferReport'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xd9'),require(_0xfa0a('0xda')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xdb'),require('./api/cmList'));_0x326cf6['use'](_0xfa0a('0xdc'),require(_0xfa0a('0xdd')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xde'),require(_0xfa0a('0xdf')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xe0'),require('./api/userProfileSection'));_0x326cf6['use']('/api/userProfile/resources',require(_0xfa0a('0xe1')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xe2'),require(_0xfa0a('0xe3')));_0x326cf6[_0xfa0a('0x7')]('/api/whatsapp/accounts',require(_0xfa0a('0xe4')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xe5'),require(_0xfa0a('0xe6')));_0x326cf6['use'](_0xfa0a('0xe7'),require('./api/whatsappInteraction'));_0x326cf6['use'](_0xfa0a('0xe8'),require('./api/whatsappMessage'));_0x326cf6['use'](_0xfa0a('0xe9'),require(_0xfa0a('0xea')));_0x326cf6[_0xfa0a('0x7')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x326cf6['use'](_0xfa0a('0xeb'),require(_0xfa0a('0xec')));_0x326cf6[_0xfa0a('0x7')]('/api/cloudProviders',require(_0xfa0a('0xed')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xee'),require(_0xfa0a('0xef')));_0x326cf6[_0xfa0a('0x7')]('/api/user-settings',require(_0xfa0a('0xf0')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xf1'),require(_0xfa0a('0xf2')));_0x326cf6['use']('/api/auth/local',require(_0xfa0a('0xf3')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xf4'),require(_0xfa0a('0xf5')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xf6'),require(_0xfa0a('0xf7')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xf8'),require(_0xfa0a('0xf9')));_0x326cf6[_0xfa0a('0x7')]('/api/rpc',require(_0xfa0a('0xfa')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xfb'),require(_0xfa0a('0xfc')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xfd'),require('./api/system'));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0xfe'),require('./api/pm2'));_0x326cf6[_0xfa0a('0x7')]('/api/webbar',require(_0xfa0a('0xff')));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x100'),clientSideLogs);_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x101'),express[_0xfa0a('0x102')](path['join'](config[_0xfa0a('0x103')],_0xfa0a('0x101'))));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x104'),express[_0xfa0a('0x102')](path[_0xfa0a('0x105')](config[_0xfa0a('0x103')],_0xfa0a('0x104'))));_0x326cf6[_0xfa0a('0x7')](_0xfa0a('0x106'),express[_0xfa0a('0x102')](path[_0xfa0a('0x105')](config[_0xfa0a('0x103')],_0xfa0a('0x106'))));_0x326cf6[_0xfa0a('0x7')]('/snippet',express[_0xfa0a('0x102')](path[_0xfa0a('0x105')](config[_0xfa0a('0x103')],_0xfa0a('0x107'),'3.9.0')));_0x326cf6['use']('/plugins',express['static'](path[_0xfa0a('0x105')](config[_0xfa0a('0x103')],_0xfa0a('0x108'))));_0x326cf6[_0xfa0a('0x109')](_0xfa0a('0x10a'))[_0xfa0a('0x10b')](errors[0x194]);_0x326cf6[_0xfa0a('0x109')]('/*')[_0xfa0a('0x10b')](function(_0x4ce7de,_0x43fa81){_0x43fa81[_0xfa0a('0x10c')](path[_0xfa0a('0x10d')](_0x326cf6['get'](_0xfa0a('0x10e'))+_0xfa0a('0x10f')));});return _0x326cf6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1598f13..55b0959 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4cd=['../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.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/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../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/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc'];(function(_0x3a14aa,_0x1005af){var _0x392b54=function(_0x4bbf80){while(--_0x4bbf80){_0x3a14aa['push'](_0x3a14aa['shift']());}};_0x392b54(++_0x1005af);}(_0xe4cd,0x84));var _0xde4c=function(_0xb5efa3,_0x52d81f){_0xb5efa3=_0xb5efa3-0x0;var _0x440167=_0xe4cd[_0xb5efa3];return _0x440167;};'use strict';var jayson=require(_0xde4c('0x0'));var _=require('lodash');var config=require(_0xde4c('0x1'));exports[_0xde4c('0x2')]=function(){return new Promise(function(_0x5ad78d,_0x4a3892){var _0x39ade2={};_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x4')));_0x39ade2=_['merge'](_0x39ade2,require('../api/voiceExtension/voiceExtension.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x5')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x6')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x7')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x8')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x9')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0xa')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0xb')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0xc')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/mailServerIn/mailServerIn.rpc'));_0x39ade2=_['merge'](_0x39ade2,require('../api/mailAccount/mailAccount.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0xd')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0xe')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0xf')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x10')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x11')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x12')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x13')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x14')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x15')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x16')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x17')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x18')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/smsInteraction/smsInteraction.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/smsMessage/smsMessage.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x19')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x1a')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x1b')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x1c')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x1d')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/chatInteraction/chatInteraction.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x1e')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/chatQueue/chatQueue.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x1f')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x20')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x21')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x22')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x23')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x24')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x25')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x26')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x27')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x28')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x29')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x2a')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x39ade2=_['merge'](_0x39ade2,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x2b')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x2c')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x2d')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x2e')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x2f')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x30')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x31')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x32')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x33')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x34')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x35')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x36')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x37')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x38')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x39')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x3a')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x3b')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x3c')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x3d')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x3e')));_0x39ade2=_[_0xde4c('0x3')](_0x39ade2,require(_0xde4c('0x3f')));_0x39ade2=_['merge'](_0x39ade2,require(_0xde4c('0x40')));var _0xc14b26=jayson[_0xde4c('0x41')](_0x39ade2)[_0xde4c('0x42')]();var _0x141d4c=config[_0xde4c('0x43')][_0xde4c('0x44')]||config['port']+0x1;var _0x2fb522=config[_0xde4c('0x43')]['ip']||_0xde4c('0x45');_0xc14b26['on'](_0xde4c('0x46'),function(_0x23a003){return _0x4a3892(_0x23a003);});_0xc14b26[_0xde4c('0x2')](_0x141d4c,_0x2fb522,function(){console[_0xde4c('0x47')](_0xde4c('0x48'),_0x2fb522,_0x141d4c);require(_0xde4c('0x49'))[_0xde4c('0x4a')]();return _0x5ad78d(_0xde4c('0x4b')+_0x2fb522+':'+_0x141d4c);});});}; \ No newline at end of file +var _0x931b=['../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.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','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x931b,0x1e0));var _0xb931=function(_0x4d2c5e,_0x502b01){_0x4d2c5e=_0x4d2c5e-0x0;var _0x191079=_0x931b[_0x4d2c5e];return _0x191079;};'use strict';var jayson=require(_0xb931('0x0'));var _=require(_0xb931('0x1'));var config=require(_0xb931('0x2'));exports[_0xb931('0x3')]=function(){return new Promise(function(_0x2d773a,_0x19765b){var _0x240caa={};_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/user/user.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/voiceExtension/voiceExtension.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/voiceQueue/voiceQueue.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x5')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x6')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x7')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x8')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x9')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0xa')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0xb')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0xc')));_0x240caa=_['merge'](_0x240caa,require('../api/mailAccount/mailAccount.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0xd')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0xe')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0xf')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x10')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x11')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/faxAccount/faxAccount.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/faxApplication/faxApplication.rpc'));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x12')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x13')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x14')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x15')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x16')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x17')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/smsMessage/smsMessage.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x18')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x19')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x1a')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x1b')));_0x240caa=_['merge'](_0x240caa,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x1c')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x1d')));_0x240caa=_['merge'](_0x240caa,require('../api/chatMessage/chatMessage.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x1e')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x1f')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x20')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x21')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x22')));_0x240caa=_['merge'](_0x240caa,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x23')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x24')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x25')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/sound/sound.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x26')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/trigger/trigger.rpc'));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x27')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x28')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x29')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2a')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2b')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2c')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2d')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2e')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x2f')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x30')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x31')));_0x240caa=_['merge'](_0x240caa,require('../api/squareReport/squareReport.rpc'));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x32')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x33')));_0x240caa=_['merge'](_0x240caa,require(_0xb931('0x34')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x35')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/squareRecording/squareRecording.rpc'));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x36')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x37')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x38')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x39')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x3a')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x3b')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x3c')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require(_0xb931('0x3d')));_0x240caa=_[_0xb931('0x4')](_0x240caa,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x425670=jayson[_0xb931('0x3e')](_0x240caa)['http']();var _0x17dba2=config[_0xb931('0x3f')][_0xb931('0x40')]||config[_0xb931('0x40')]+0x1;var _0x12d55e=config[_0xb931('0x3f')]['ip']||_0xb931('0x41');_0x425670['on'](_0xb931('0x42'),function(_0x5ad0be){return _0x19765b(_0x5ad0be);});_0x425670[_0xb931('0x3')](_0x17dba2,_0x12d55e,function(){console[_0xb931('0x43')](_0xb931('0x44'),_0x12d55e,_0x17dba2);require(_0xb931('0x45'))[_0xb931('0x46')]();return _0x2d773a(_0xb931('0x47')+_0x12d55e+':'+_0x17dba2);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 881d2b0..e856df9 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 _0xce2a=['setEncoding','utf8','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./error','call'];(function(_0x462723,_0x388c95){var _0x4737cc=function(_0x2900b9){while(--_0x2900b9){_0x462723['push'](_0x462723['shift']());}};_0x4737cc(++_0x388c95);}(_0xce2a,0xd3));var _0xace2=function(_0x120e67,_0x17f410){_0x120e67=_0x120e67-0x0;var _0x1f4918=_0xce2a[_0x120e67];return _0x1f4918;};'use strict';var util=require('util');var _=require(_0xace2('0x0'));var EventEmitter=require(_0xace2('0x1'))[_0xace2('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xace2('0x3'));function AGIChannel(_0x88316){var _0x2c09ae=this,_0x5eb117=new AGIReply(),_0x362167=![],_0x5b569f={};EventEmitter[_0xace2('0x4')](_0x2c09ae);_0x88316[_0xace2('0x5')]('utf8');_0x88316['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5eb117[_0xace2('0x5')](_0xace2('0x6'));_0x5eb117['on'](_0xace2('0x7'),function(_0x144669){for(var _0x17253c in _0x144669){_0x2c09ae[_0x17253c]=_0x144669[_0x17253c];}_0x2c09ae['emit'](_0xace2('0x8'));});_0x5eb117['on'](_0xace2('0x9'),function(_0x50de17){if(_0x50de17[_0xace2('0xa')]()==_0xace2('0xb')){_0x2c09ae[_0xace2('0xc')](_0xace2('0xb'));return;}if(_0x50de17[_0xace2('0xd')](0x0,0xb)==_0xace2('0xe')){_0x362167=!![];}if(_0x362167){_0x5b569f['rx']+=_0x50de17+'\x0a';if(_0x50de17[_0xace2('0xf')](_0xace2('0x10'))!=-0x1){_0x362167=![];}}else{_0x5b569f['rx']=_0x50de17;}if(_0x362167){return;}if(typeof _0x5b569f['cb']==_0xace2('0x11')){var _0x26f48d=_0x5b569f['rx'][_0xace2('0xd')](0x0,0x3),_0x267254=null,_0x255bf0=null;_0x26f48d=parseInt(_0x26f48d);if(isNaN(_0x26f48d)){_0x5b569f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x26f48d!=0xc8){_0x5b569f['cb'](null,{'code':_0x26f48d,'result':-0x1,'extra':'KO'});return;}_0x267254=_0x5b569f['rx']['substring'](0x4)[_0xace2('0x12')](_0xace2('0x13'),'');if(_0x267254[_0xace2('0x14')]('\x20')!=-0x1){_0x267254=_0x267254[_0xace2('0x15')](0x0,_0x267254[_0xace2('0x14')]('\x20'));}if(_['startsWith'](_0x267254,'-1')){_0x267254=parseInt(_0x267254);}_0x255bf0=_0x5b569f['rx'][_0xace2('0x16')]('\x20');if(_0x255bf0[_0xace2('0x17')]==0x3){_0x255bf0=_0x255bf0[0x2][_0xace2('0xd')](0x1,_0x255bf0[0x2][_0xace2('0x17')]-0x1);}else if(_0x255bf0['length']>0x3){var _0xc9d38e=/\((.+)\)/;var _0x7c844e=_0x5b569f['rx']['match'](_0xc9d38e);if(_0x7c844e){_0x255bf0=_0x7c844e[0x1];}else{_0x255bf0=null;}}else{_0x255bf0=null;}_0x5b569f['cb'](null,{'code':_0x26f48d,'result':_0x267254,'extra':_0x255bf0});}});_0x88316['on'](_0xace2('0x18'),function(_0x1a5cf2){_0x2c09ae[_0xace2('0xc')]('error',new AGIError(_0xace2('0x19'),_0x1a5cf2[_0xace2('0x1a')]));});_0x88316['on'](_0xace2('0x1b'),function(){_0x2c09ae[_0xace2('0xc')](_0xace2('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x88316['on'](_0xace2('0x1c'),function(){_0x2c09ae[_0xace2('0xc')](_0xace2('0x1c'),new AGIError(_0xace2('0x1d')));_0x88316[_0xace2('0x1e')]();});_0x88316['pipe'](_0x5eb117);this[_0xace2('0x1f')]=function(_0x10b9b3,_0x59893f){var _0x10b9b3=_0x10b9b3||'',_0x59893f=typeof _0x59893f==_0xace2('0x11')?_0x59893f:new Function();_0x5b569f={'tx':_0x10b9b3,'rx':'','cb':_0x59893f};_0x88316[_0xace2('0x20')](_0x10b9b3+'\x0a');},this[_0xace2('0x1b')]=function(){_0x88316[_0xace2('0x1e')]();};}util[_0xace2('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xace2('0x22')][_0xace2('0x23')]=function(_0x2797b6){return this[_0xace2('0x1f')][_0xace2('0x24')](this,_0x2797b6);};AGIChannel[_0xace2('0x22')][_0xace2('0x25')]=function(){return this[_0xace2('0x23')](_0xace2('0x26'));};AGIChannel['prototype']['getData']=function(_0x3f542a,_0x5230eb,_0x56ce59){_0x3f542a=_0x3f542a===undefined?'beep':_0x3f542a;_0x5230eb=_0x5230eb===undefined?'5':_0x5230eb;_0x56ce59=_0x56ce59===undefined?'1':_0x56ce59;return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x28'),_0x3f542a,_0x5230eb*0x3e8,_0x56ce59));};AGIChannel[_0xace2('0x22')]['noop']=function(_0x11d2eb){_0x11d2eb=_0x11d2eb||_0xace2('0x29');return this['sendRequest'](util[_0xace2('0x27')]('VERBOSE\x20\x22%s\x22',_0x11d2eb));};AGIChannel[_0xace2('0x22')][_0xace2('0x2a')]=function(_0x5224d2,_0x243385){if(_['isArray'](_0x243385)){return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x2b'),_0x5224d2,_0x243385[_0xace2('0x2c')](',')));}return this['sendRequest'](util[_0xace2('0x27')](_0xace2('0x2b'),_0x5224d2,_0x243385));};AGIChannel[_0xace2('0x22')]['setContext']=function(_0x426d50){return this['sendRequest'](util[_0xace2('0x27')]('SET\x20CONTEXT\x20%s',_0x426d50));};AGIChannel[_0xace2('0x22')][_0xace2('0x2d')]=function(_0x2bfa84){return this['sendRequest'](util[_0xace2('0x27')](_0xace2('0x2e'),_0x2bfa84));};AGIChannel[_0xace2('0x22')][_0xace2('0x2f')]=function(_0xa788cf){return this['sendRequest'](util[_0xace2('0x27')](_0xace2('0x30'),_0xa788cf));};AGIChannel[_0xace2('0x22')][_0xace2('0xb')]=function(){return this[_0xace2('0x23')](_0xace2('0x31'));};AGIChannel[_0xace2('0x22')][_0xace2('0x32')]=function(_0x18d98c,_0x377343){var _0x2b3297=_[_0xace2('0x33')](_0x377343)||_[_0xace2('0x34')](_0x377343)?_0x377343[_0xace2('0x35')]():_0x377343;return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x36'),_0x18d98c,_0x2b3297?_0x2b3297['toString']()[_0xace2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xace2('0x22')][_0xace2('0x37')]=function(_0x266a43,_0x31e6ca){return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x38'),_0x266a43,_0x31e6ca));};AGIChannel[_0xace2('0x22')][_0xace2('0x39')]=function(_0x54766e,_0x12fe64){return this[_0xace2('0x23')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x54766e,_0x12fe64));};AGIChannel[_0xace2('0x22')][_0xace2('0x3a')]=function(_0x416a93,_0x4bc0cb){return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x3b'),_0x416a93,_0x4bc0cb));};AGIChannel[_0xace2('0x22')][_0xace2('0x3c')]=function(_0x263bcb,_0x12b93f,_0x1fde43){_0x12b93f=_0x12b93f||this['extension'];_0x1fde43=_0x1fde43||0x1;this[_0xace2('0x3d')](_0x263bcb);this['setExtension'](_0x12b93f);this[_0xace2('0x2f')](_0x1fde43);return this[_0xace2('0x3e')](util[_0xace2('0x27')](_0xace2('0x3f'),_0x263bcb,_0x12b93f,_0x1fde43));};AGIChannel[_0xace2('0x22')]['getVariable']=function(_0x303975){return this[_0xace2('0x23')](util[_0xace2('0x27')](_0xace2('0x40'),_0x303975));};AGIChannel[_0xace2('0x22')][_0xace2('0x41')]=function(_0xb414c3,_0x412bd1,_0x8b46de,_0x38d8a7,_0xd00611,_0x3ddc7e){_0x412bd1=_0x412bd1||_0xace2('0x42');_0x8b46de=_0x8b46de||'';_0x38d8a7=_0x38d8a7===undefined?-0x1:_0x38d8a7==='-1'?-0x1:_0x38d8a7*0x3e8;_0xd00611=_0xd00611===undefined?'':'s='+_0xd00611;_0x3ddc7e=_0x3ddc7e?'BEEP':'';return this['sendRequest'](util[_0xace2('0x27')](_0xace2('0x43'),_0xb414c3,_0x412bd1,_0x8b46de,_0x38d8a7,_0x3ddc7e,_0xd00611));};AGIChannel['prototype']['streamFile']=function(_0x354ab6,_0x298dfc){_0x298dfc=_0x298dfc||'';return this[_0xace2('0x23')](util[_0xace2('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x354ab6,_0x298dfc));};AGIChannel[_0xace2('0x22')][_0xace2('0x44')]=function(_0x3e149a){return this[_0xace2('0x2a')](_0xace2('0x45'),_0x3e149a);};AGIChannel['prototype']['wait']=function(_0x96e84e){return this[_0xace2('0x2a')]('WAIT',_0x96e84e);};AGIChannel[_0xace2('0x22')]['error']=function(_0x1acad4,_0x292bf7){this['noop'](util['format'](_0xace2('0x46'),_0x1acad4['id'],_0x1acad4[_0xace2('0x47')],_0x292bf7));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xcb1a=['setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','answer','getData','beep','format','noop','NO\x20MESSAGE','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s'];(function(_0xac5e90,_0x3880ec){var _0x1d8c03=function(_0x3f64d3){while(--_0x3f64d3){_0xac5e90['push'](_0xac5e90['shift']());}};_0x1d8c03(++_0x3880ec);}(_0xcb1a,0xb6));var _0xacb1=function(_0x2e434b,_0x12fa98){_0x2e434b=_0x2e434b-0x0;var _0xfc9227=_0xcb1a[_0x2e434b];return _0xfc9227;};'use strict';var util=require(_0xacb1('0x0'));var _=require(_0xacb1('0x1'));var EventEmitter=require(_0xacb1('0x2'))[_0xacb1('0x3')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x25f29b){var _0x5248c7=this,_0x3015ce=new AGIReply(),_0x1356be=![],_0x5e4f72={};EventEmitter[_0xacb1('0x4')](_0x5248c7);_0x25f29b[_0xacb1('0x5')](_0xacb1('0x6'));_0x25f29b[_0xacb1('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3015ce[_0xacb1('0x5')](_0xacb1('0x6'));_0x3015ce['on']('headers',function(_0x39a417){for(var _0x6dc009 in _0x39a417){_0x5248c7[_0x6dc009]=_0x39a417[_0x6dc009];}_0x5248c7[_0xacb1('0x8')](_0xacb1('0x9'));});_0x3015ce['on'](_0xacb1('0xa'),function(_0x36d52f){if(_0x36d52f[_0xacb1('0xb')]()==_0xacb1('0xc')){_0x5248c7[_0xacb1('0x8')](_0xacb1('0xc'));return;}if(_0x36d52f[_0xacb1('0xd')](0x0,0xb)=='520-Invalid'){_0x1356be=!![];}if(_0x1356be){_0x5e4f72['rx']+=_0x36d52f+'\x0a';if(_0x36d52f[_0xacb1('0xe')](_0xacb1('0xf'))!=-0x1){_0x1356be=![];}}else{_0x5e4f72['rx']=_0x36d52f;}if(_0x1356be){return;}if(typeof _0x5e4f72['cb']=='function'){var _0x5b868c=_0x5e4f72['rx'][_0xacb1('0xd')](0x0,0x3),_0x436df5=null,_0x471798=null;_0x5b868c=parseInt(_0x5b868c);if(isNaN(_0x5b868c)){_0x5e4f72['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xacb1('0x10')});return;}if(_0x5b868c!=0xc8){_0x5e4f72['cb'](null,{'code':_0x5b868c,'result':-0x1,'extra':'KO'});return;}_0x436df5=_0x5e4f72['rx'][_0xacb1('0xd')](0x4)[_0xacb1('0x11')]('result=','');if(_0x436df5[_0xacb1('0x12')]('\x20')!=-0x1){_0x436df5=_0x436df5['substr'](0x0,_0x436df5[_0xacb1('0x12')]('\x20'));}if(_[_0xacb1('0x13')](_0x436df5,'-1')){_0x436df5=parseInt(_0x436df5);}_0x471798=_0x5e4f72['rx'][_0xacb1('0x14')]('\x20');if(_0x471798[_0xacb1('0x15')]==0x3){_0x471798=_0x471798[0x2]['substring'](0x1,_0x471798[0x2]['length']-0x1);}else if(_0x471798[_0xacb1('0x15')]>0x3){var _0x2bed0d=/\((.+)\)/;var _0x31ee0b=_0x5e4f72['rx'][_0xacb1('0x16')](_0x2bed0d);if(_0x31ee0b){_0x471798=_0x31ee0b[0x1];}else{_0x471798=null;}}else{_0x471798=null;}_0x5e4f72['cb'](null,{'code':_0x5b868c,'result':_0x436df5,'extra':_0x471798});}});_0x25f29b['on'](_0xacb1('0x17'),function(_0x687132){_0x5248c7[_0xacb1('0x8')](_0xacb1('0x17'),new AGIError(_0xacb1('0x18'),_0x687132[_0xacb1('0x19')]));});_0x25f29b['on'](_0xacb1('0x1a'),function(){_0x5248c7[_0xacb1('0x8')](_0xacb1('0x1a'),new AGIError(_0xacb1('0x1b')));});_0x25f29b['on'](_0xacb1('0x1c'),function(){_0x5248c7[_0xacb1('0x8')](_0xacb1('0x1c'),new AGIError(_0xacb1('0x1d')));_0x25f29b[_0xacb1('0x1e')]();});_0x25f29b[_0xacb1('0x1f')](_0x3015ce);this[_0xacb1('0x20')]=function(_0x20af7e,_0x237fe0){var _0x20af7e=_0x20af7e||'',_0x237fe0=typeof _0x237fe0=='function'?_0x237fe0:new Function();_0x5e4f72={'tx':_0x20af7e,'rx':'','cb':_0x237fe0};_0x25f29b[_0xacb1('0x21')](_0x20af7e+'\x0a');},this[_0xacb1('0x1a')]=function(){_0x25f29b['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xacb1('0x22')][_0xacb1('0x23')]=function(_0x58febe){return this[_0xacb1('0x20')][_0xacb1('0x24')](this,_0x58febe);};AGIChannel[_0xacb1('0x22')][_0xacb1('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0xacb1('0x22')][_0xacb1('0x26')]=function(_0x5dd30e,_0x1b01d6,_0x3fe20c){_0x5dd30e=_0x5dd30e===undefined?_0xacb1('0x27'):_0x5dd30e;_0x1b01d6=_0x1b01d6===undefined?'5':_0x1b01d6;_0x3fe20c=_0x3fe20c===undefined?'1':_0x3fe20c;return this[_0xacb1('0x23')](util[_0xacb1('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5dd30e,_0x1b01d6*0x3e8,_0x3fe20c));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x29')]=function(_0x5bf95c){_0x5bf95c=_0x5bf95c||_0xacb1('0x2a');return this[_0xacb1('0x23')](util[_0xacb1('0x28')]('VERBOSE\x20\x22%s\x22',_0x5bf95c));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x2b')]=function(_0x48a0d6,_0x1e3c87){if(_[_0xacb1('0x2c')](_0x1e3c87)){return this[_0xacb1('0x23')](util['format']('EXEC\x20%s\x20%s',_0x48a0d6,_0x1e3c87[_0xacb1('0x2d')](',')));}return this['sendRequest'](util[_0xacb1('0x28')](_0xacb1('0x2e'),_0x48a0d6,_0x1e3c87));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x2f')]=function(_0x14299d){return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x30'),_0x14299d));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x31')]=function(_0x46f37f){return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x32'),_0x46f37f));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x33')]=function(_0x588292){return this[_0xacb1('0x23')](util[_0xacb1('0x28')]('SET\x20PRIORITY\x20%s',_0x588292));};AGIChannel[_0xacb1('0x22')][_0xacb1('0xc')]=function(){return this['sendRequest'](_0xacb1('0x34'));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x35')]=function(_0x569636,_0x12f335){var _0x257a86=_[_0xacb1('0x36')](_0x12f335)||_[_0xacb1('0x37')](_0x12f335)?_0x12f335[_0xacb1('0x38')]():_0x12f335;return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x39'),_0x569636,_0x257a86?_0x257a86['toString']()[_0xacb1('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x3a')]=function(_0x5a0c95,_0x9b6509){return this[_0xacb1('0x23')](util['format'](_0xacb1('0x3b'),_0x5a0c95,_0x9b6509));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x3c')]=function(_0x31e02a,_0x5db911){return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x3d'),_0x31e02a,_0x5db911));};AGIChannel[_0xacb1('0x22')]['sayPhonetic']=function(_0x7050fb,_0x347837){return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x3e'),_0x7050fb,_0x347837));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x3f')]=function(_0x435e78,_0x4d8d13,_0x1f79a6){_0x4d8d13=_0x4d8d13||this[_0xacb1('0x40')];_0x1f79a6=_0x1f79a6||0x1;this[_0xacb1('0x2f')](_0x435e78);this[_0xacb1('0x31')](_0x4d8d13);this[_0xacb1('0x33')](_0x1f79a6);return this['noop'](util['format'](_0xacb1('0x41'),_0x435e78,_0x4d8d13,_0x1f79a6));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x42')]=function(_0x66244){return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x43'),_0x66244));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x44')]=function(_0x1b2fe8,_0x521461,_0x2042ae,_0x16c863,_0x14ddbe,_0x150e38){_0x521461=_0x521461||_0xacb1('0x45');_0x2042ae=_0x2042ae||'';_0x16c863=_0x16c863===undefined?-0x1:_0x16c863==='-1'?-0x1:_0x16c863*0x3e8;_0x14ddbe=_0x14ddbe===undefined?'':'s='+_0x14ddbe;_0x150e38=_0x150e38?_0xacb1('0x46'):'';return this['sendRequest'](util[_0xacb1('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1b2fe8,_0x521461,_0x2042ae,_0x16c863,_0x150e38,_0x14ddbe));};AGIChannel[_0xacb1('0x22')][_0xacb1('0x47')]=function(_0x100401,_0x52e90c){_0x52e90c=_0x52e90c||'';return this[_0xacb1('0x23')](util[_0xacb1('0x28')](_0xacb1('0x48'),_0x100401,_0x52e90c));};AGIChannel[_0xacb1('0x22')]['agi']=function(_0x106926){return this[_0xacb1('0x2b')](_0xacb1('0x49'),_0x106926);};AGIChannel[_0xacb1('0x22')]['wait']=function(_0x59247f){return this['exec'](_0xacb1('0x4a'),_0x59247f);};AGIChannel['prototype'][_0xacb1('0x17')]=function(_0x5938ea,_0x208df0){this[_0xacb1('0x29')](util[_0xacb1('0x28')](_0xacb1('0x4b'),_0x5938ea['id'],_0x5938ea['label'],_0x208df0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xacb1('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0cf8b70..aa73126 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 _0xaa47=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x179d88,_0x548f72){var _0x179ffa=function(_0x1daa48){while(--_0x1daa48){_0x179d88['push'](_0x179d88['shift']());}};_0x179ffa(++_0x548f72);}(_0xaa47,0x6c));var _0x7aa4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaa47[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x7aa4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x7aa4('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7aa4('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x7aa4('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x7aa4('0x4'),'E_AGI_SOCKET_ERROR':_0x7aa4('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x7aa4('0x6'),'E_AGI_COMMAND_EMPTY':_0x7aa4('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7aa4('0x8')};function AGIError(_0x1aa25c){var _0x1aa25c=_0x1aa25c||null,_0x353728=_0x353728||[],_0x4c5a1e=0x1,_0x573342='';if(!error[_0x1aa25c]){_0x1aa25c='E_AGI_UNDEFINED';}_0x353728[_0x7aa4('0x9')](error[_0x1aa25c]);while(arguments[_0x4c5a1e]){_0x353728[_0x7aa4('0x9')](arguments[_0x4c5a1e]);_0x4c5a1e++;}_0x573342=util['format']['apply'](util,_0x353728);this['message']=_0x573342;this[_0x7aa4('0xa')]=_0x1aa25c;}module['exports']=AGIError; \ No newline at end of file +var _0x6ead=['push','apply','message','name','exports','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1d2c88,_0x4cb2a3){var _0x48e57e=function(_0x3b11ef){while(--_0x3b11ef){_0x1d2c88['push'](_0x1d2c88['shift']());}};_0x48e57e(++_0x4cb2a3);}(_0x6ead,0x17c));var _0xd6ea=function(_0x3ca7c6,_0x50d67f){_0x3ca7c6=_0x3ca7c6-0x0;var _0x18acd0=_0x6ead[_0x3ca7c6];return _0x18acd0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xd6ea('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xd6ea('0x1'),'E_AGI_SERVER_CLOSE':_0xd6ea('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xd6ea('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xd6ea('0x4'),'E_AGI_SOCKET_ERROR':_0xd6ea('0x5'),'E_AGI_SOCKET_CLOSE':_0xd6ea('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xd6ea('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd6ea('0x8'),'E_AGI_IVR_ENTRY':_0xd6ea('0x9')};function AGIError(_0x2bfe39){var _0x2bfe39=_0x2bfe39||null,_0x580308=_0x580308||[],_0x1b7818=0x1,_0x1f389d='';if(!error[_0x2bfe39]){_0x2bfe39='E_AGI_UNDEFINED';}_0x580308[_0xd6ea('0xa')](error[_0x2bfe39]);while(arguments[_0x1b7818]){_0x580308[_0xd6ea('0xa')](arguments[_0x1b7818]);_0x1b7818++;}_0x1f389d=util['format'][_0xd6ea('0xb')](util,_0x580308);this[_0xd6ea('0xc')]=_0x1f389d;this[_0xd6ea('0xd')]=_0x2bfe39;}module[_0xd6ea('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index e2017d8..3510c99 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 _0x8988=['agi','parse','projectUpdate','exports','lodash','EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x8988,0x18a));var _0x8898=function(_0x3c5433,_0x515ff7){_0x3c5433=_0x3c5433-0x0;var _0x425f26=_0x8988[_0x3c5433];return _0x425f26;};'use strict';var _=require(_0x8898('0x0'));var EventEmitter=require('events')[_0x8898('0x1')];var Redis=require('ioredis');var AGIError=require(_0x8898('0x2'));var config=require(_0x8898('0x3'));config[_0x8898('0x4')]=_[_0x8898('0x5')](config[_0x8898('0x4')],{'host':_0x8898('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x8898('0x7')]('agi',function(_0x3aa006){if(_0x3aa006)return eventEmitter[_0x8898('0x8')](_0x8898('0x9'),new AGIError(_0x8898('0xa'),_0x3aa006));});sub['on']('message',function(_0x18fc29,_0x246f52){if(_0x18fc29!==_0x8898('0xb'))return;try{var _0x1ae6ce=JSON[_0x8898('0xc')](_0x246f52);eventEmitter[_0x8898('0x8')](_0x8898('0xd'),_0x1ae6ce);}catch(_0x35ae3d){eventEmitter['emit']('error',new AGIError(_0x8898('0xa'),_0x35ae3d));}});module[_0x8898('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xaa7e=['defaults','localhost','subscribe','agi','emit','error','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','./error','redis'];(function(_0x3efaaf,_0x395954){var _0x461320=function(_0x3b7a98){while(--_0x3b7a98){_0x3efaaf['push'](_0x3efaaf['shift']());}};_0x461320(++_0x395954);}(_0xaa7e,0xbe));var _0xeaa7=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xaa7e[_0x4017b0];return _0x5ed4f7;};'use strict';var _=require(_0xeaa7('0x0'));var EventEmitter=require(_0xeaa7('0x1'))[_0xeaa7('0x2')];var Redis=require('ioredis');var AGIError=require(_0xeaa7('0x3'));var config=require('../../config/environment');config[_0xeaa7('0x4')]=_[_0xeaa7('0x5')](config[_0xeaa7('0x4')],{'host':_0xeaa7('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xeaa7('0x4')]);sub[_0xeaa7('0x7')](_0xeaa7('0x8'),function(_0x534653){if(_0x534653)return eventEmitter[_0xeaa7('0x9')](_0xeaa7('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x534653));});sub['on']('message',function(_0x51c059,_0x54d1e7){if(_0x51c059!==_0xeaa7('0x8'))return;try{var _0x5e63a2=JSON['parse'](_0x54d1e7);eventEmitter['emit'](_0xeaa7('0xb'),_0x5e63a2);}catch(_0x1f2e7c){eventEmitter[_0xeaa7('0x9')](_0xeaa7('0xa'),new AGIError(_0xeaa7('0xc'),_0x1f2e7c));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c857de9..298af34 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 _0xcd63=['relations','getVertex','traverseBFS','no\x20vertex\x20found','info','length','no\x20edge/s\x20available','condition','split','default','target','agicommand','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size'];(function(_0x4fd061,_0x882200){var _0x5e7024=function(_0x532000){while(--_0x532000){_0x4fd061['push'](_0x4fd061['shift']());}};_0x5e7024(++_0x882200);}(_0xcd63,0xc6));var _0x3cd6=function(_0x50efd6,_0x2ca1a5){_0x50efd6=_0x50efd6-0x0;var _0x738bfe=_0xcd63[_0x50efd6];return _0x738bfe;};'use strict';var _=require(_0x3cd6('0x0'));var logger=require(_0x3cd6('0x1'))(_0x3cd6('0x2'));var verticesWithRetry=[_0x3cd6('0x3'),_0x3cd6('0x4'),'getsecretdigits'];var Graph=function(){this[_0x3cd6('0x5')]={};this[_0x3cd6('0x6')]={};this[_0x3cd6('0x7')]=0x0;};Graph[_0x3cd6('0x8')]['addVertex']=function(_0x407d89){this[_0x3cd6('0x5')][_0x407d89['id']]=_0x407d89;this[_0x3cd6('0x6')][_0x407d89['id']]=[];};Graph[_0x3cd6('0x8')][_0x3cd6('0x9')]=function(_0x300b47,_0x1ae824,_0x1d8410){this[_0x3cd6('0x6')][_0x300b47][_0x3cd6('0xa')]({'target':_0x1ae824,'condition':_0x1d8410});this['numberOfEdges']+=0x1;};Graph[_0x3cd6('0x8')]['size']=function(){return _[_0x3cd6('0xb')](this['vertices']);};Graph['prototype'][_0x3cd6('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x3cd6('0x8')][_0x3cd6('0xd')]=function(_0x208b1d){return this[_0x3cd6('0x5')][_0x208b1d];};Graph[_0x3cd6('0x8')][_0x3cd6('0xe')]=function(_0x334fe3,_0xb60de9){if(!this[_0x3cd6('0x5')][_0x334fe3]){return logger['info'](_0x3cd6('0xf'));}var _0xf6d8fc=_0xb60de9(this['vertices'][_0x334fe3]);if(!_0xf6d8fc){return logger[_0x3cd6('0x10')]('stop\x20traverse');}if(this[_0x3cd6('0x6')][_0x334fe3][_0x3cd6('0x11')]===0x0){return logger['info'](_0x3cd6('0x12'));}for(var _0x5a58ea=0x0,_0x3e0f87=[],_0x3045dd=![];_0x5a58ea\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','port','listening','connection','lodash','syncho','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','message','name','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','catch','hasOwnProperty','indexOf','substring','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x752b,0x175));var _0xb752=function(_0x342c39,_0x17c253){_0x342c39=_0x342c39-0x0;var _0x229347=_0x752b[_0x342c39];return _0x229347;};'use strict';var _=require(_0xb752('0x0'));var syncho=require(_0xb752('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0xb752('0x2'))(_0xb752('0x3'));var utilLicense=require(_0xb752('0x4'));var rpc=require('./rpc');var Project=require(_0xb752('0x5'));var AGIEmitter=require(_0xb752('0x6'))[_0xb752('0x7')];var projects=[];config[_0xb752('0x3')]=_[_0xb752('0x8')](config[_0xb752('0x3')],{'ip':_0xb752('0x9'),'port':0x11dd});AGIEmitter['on'](_0xb752('0xa'),projectUpdateHandler);function connectionHandler(_0x58cd0e){process[_0xb752('0xb')](function(){syncho(function(){try{setChannelVariables(_0x58cd0e);agiHandler(_0x58cd0e);}catch(_0x1b0168){logger['error'](_0x1b0168[_0xb752('0xc')]);}});});}function projectUpdateHandler(_0x4c3a4c){try{var _0x6e7d34=_[_0xb752('0xd')](projects,['id',_0x4c3a4c['id']]);if(_0x6e7d34>-0x1){if(_0x4c3a4c[_0xb752('0xe')]===!![]){projects[_0xb752('0xf')](_0x6e7d34,0x1);}else{projects[_0x6e7d34]=_0x4c3a4c;}}else{projects[_0xb752('0x10')](_0x4c3a4c);}}catch(_0x155c0e){logger[_0xb752('0x11')](_0x155c0e['stack']);}}function listeningHandler(){console[_0xb752('0x12')](_0xb752('0x13'),config[_0xb752('0x3')]['port']);logger['info'](util[_0xb752('0x14')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xb752('0x3')]['ip'],config[_0xb752('0x3')]['port']));}function errorHandler(_0x3613d4){if(_0x3613d4&&_0x3613d4['name']&&_0x3613d4[_0xb752('0x15')]){logger[_0xb752('0x11')](util[_0xb752('0x14')]('[%s]\x20%s',_0x3613d4[_0xb752('0x16')],_0x3613d4[_0xb752('0x15')]));}else{logger[_0xb752('0x11')](util[_0xb752('0x14')](_0xb752('0x17'),_0x3613d4[_0xb752('0xc')]));}}function closeHandler(){logger[_0xb752('0x18')](util[_0xb752('0x14')](_0xb752('0x19'),this['arg_1'],this[_0xb752('0x1a')],this[_0xb752('0x1b')],this[_0xb752('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2d580d){logger[_0xb752('0x11')](_0x2d580d[_0xb752('0xc')]);}}function timeoutHandler(){logger[_0xb752('0x18')](util['format'](_0xb752('0x1d'),this[_0xb752('0x1e')],this[_0xb752('0x1a')],this[_0xb752('0x1b')],this[_0xb752('0x1c')],this[_0xb752('0x1f')]));}function hangupHandler(){logger[_0xb752('0x18')](util[_0xb752('0x14')](_0xb752('0x20'),this[_0xb752('0x1e')],this[_0xb752('0x1a')],this[_0xb752('0x1b')],this[_0xb752('0x1c')],this['uniqueid']));this[_0xb752('0x21')]=!![];}function createSquareReport(_0x1195b0,_0x46fa57){rpc['createSquareReport'](_0x1195b0)['then'](function(_0x3838d2){if(_0x46fa57){_0x46fa57(null,_0x3838d2);}})[_0xb752('0x22')](function(_0x266595){if(_0x46fa57){_0x46fa57(null,_0x266595);}});}function setChannelVariables(_0x2aa716){for(var _0x35942d in _0x2aa716){if(_0x2aa716[_0xb752('0x23')](_0x35942d)){if(_0x35942d[_0xb752('0x24')]('agi_')===0x0){_0x2aa716[_0x35942d[_0xb752('0x25')](0x4)]=_0x2aa716[_0x35942d];delete _0x2aa716[_0x35942d];}}}}function agiHandler(_0x5562a4){logger[_0xb752('0x26')]('variables',JSON[_0xb752('0x27')](_0x5562a4,null,0x2));logger['info'](util['format'](_0xb752('0x28'),_0x5562a4[_0xb752('0x1e')],_0x5562a4[_0xb752('0x1a')],_0x5562a4[_0xb752('0x1b')],_0x5562a4[_0xb752('0x1c')],_0x5562a4[_0xb752('0x1f')]));_0x5562a4['on'](_0xb752('0x11'),errorHandler);_0x5562a4['on'](_0xb752('0x29'),closeHandler);_0x5562a4['on'](_0xb752('0x2a'),timeoutHandler);_0x5562a4[_0xb752('0x21')]=![];_0x5562a4['on']('hangup',hangupHandler);var _0x2f5e58=_[_0xb752('0x2b')](projects,[_0xb752('0x16'),_0x5562a4['arg_1']]);if(!_0x2f5e58)return Project['handleNotFound'](_0x5562a4);if(!_0x2f5e58['production'])return Project[_0xb752('0x2c')](_0x5562a4);return Project[_0xb752('0x2d')](_0x2f5e58,_0x5562a4);}function main(){var _0x194df1;return utilLicense[_0xb752('0x2e')]()['then'](function(_0x2afb1d){if(!_0x2afb1d)return;if(_0x2afb1d[_0xb752('0x2f')]){if(_0x2afb1d['callysquare']&&_0x2afb1d[_0xb752('0x30')]>0x0){logger[_0xb752('0x18')](util[_0xb752('0x14')](_0xb752('0x31'),_0x2afb1d[_0xb752('0x30')]));_0x194df1=_0x2afb1d[_0xb752('0x30')];}else{logger[_0xb752('0x18')](_0xb752('0x32'));}}else{logger[_0xb752('0x18')](_0xb752('0x33'));_0x194df1=-0x1;}})[_0xb752('0x34')](function(){return Project[_0xb752('0x35')]();})[_0xb752('0x34')](function(_0x135a53){projects=_0x135a53;return;})[_0xb752('0x22')](function(_0x4244d7){logger['error'](_0xb752('0x36'),_0x4244d7['stack']);})[_0xb752('0x37')](function(){var _0x4b319b=require('./server')(config['agi'][_0xb752('0x38')],config[_0xb752('0x3')]['ip'],_0x194df1);_0x4b319b['on'](_0xb752('0x11'),errorHandler);_0x4b319b['on'](_0xb752('0x39'),listeningHandler);_0x4b319b['on'](_0xb752('0x3a'),connectionHandler);_0x4b319b['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x3b32=['./rpc','./project','./events','defaults','127.0.0.1','nextTick','error','stack','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','find','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','listening','connection','lodash','syncho','../../config/logger','agi','../../config/license/util'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x3b32,0xa3));var _0x23b3=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x3b32[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x23b3('0x0'));var syncho=require(_0x23b3('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x23b3('0x2'))(_0x23b3('0x3'));var utilLicense=require(_0x23b3('0x4'));var rpc=require(_0x23b3('0x5'));var Project=require(_0x23b3('0x6'));var AGIEmitter=require(_0x23b3('0x7'))['EventEmitter'];var projects=[];config['agi']=_[_0x23b3('0x8')](config['agi'],{'ip':_0x23b3('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x319784){process[_0x23b3('0xa')](function(){syncho(function(){try{setChannelVariables(_0x319784);agiHandler(_0x319784);}catch(_0x3b37fd){logger[_0x23b3('0xb')](_0x3b37fd[_0x23b3('0xc')]);}});});}function projectUpdateHandler(_0x239559){try{var _0xf776d7=_['findIndex'](projects,['id',_0x239559['id']]);if(_0xf776d7>-0x1){if(_0x239559['deleted']===!![]){projects['splice'](_0xf776d7,0x1);}else{projects[_0xf776d7]=_0x239559;}}else{projects[_0x23b3('0xd')](_0x239559);}}catch(_0x18e833){logger['error'](_0x18e833[_0x23b3('0xc')]);}}function listeningHandler(){console[_0x23b3('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x23b3('0xf')]);logger[_0x23b3('0x10')](util[_0x23b3('0x11')](_0x23b3('0x12'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x30b9f3){if(_0x30b9f3&&_0x30b9f3[_0x23b3('0x13')]&&_0x30b9f3[_0x23b3('0x14')]){logger[_0x23b3('0xb')](util['format'](_0x23b3('0x15'),_0x30b9f3[_0x23b3('0x13')],_0x30b9f3['message']));}else{logger[_0x23b3('0xb')](util['format'](_0x23b3('0x16'),_0x30b9f3['stack']));}}function closeHandler(){logger[_0x23b3('0x10')](util[_0x23b3('0x11')](_0x23b3('0x17'),this[_0x23b3('0x18')],this[_0x23b3('0x19')],this[_0x23b3('0x1a')],this[_0x23b3('0x1b')],this[_0x23b3('0x1c')]));try{createSquareReport(this);}catch(_0x427aa4){logger[_0x23b3('0xb')](_0x427aa4[_0x23b3('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x23b3('0x11')](_0x23b3('0x1d'),this[_0x23b3('0x18')],this[_0x23b3('0x19')],this[_0x23b3('0x1a')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x23b3('0x10')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x23b3('0x18')],this['calleridname'],this[_0x23b3('0x1a')],this[_0x23b3('0x1b')],this[_0x23b3('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x541187,_0x14f44d){rpc['createSquareReport'](_0x541187)[_0x23b3('0x1e')](function(_0x124e4e){if(_0x14f44d){_0x14f44d(null,_0x124e4e);}})[_0x23b3('0x1f')](function(_0x1c4e40){if(_0x14f44d){_0x14f44d(null,_0x1c4e40);}});}function setChannelVariables(_0x145d32){for(var _0x1ce897 in _0x145d32){if(_0x145d32[_0x23b3('0x20')](_0x1ce897)){if(_0x1ce897['indexOf'](_0x23b3('0x21'))===0x0){_0x145d32[_0x1ce897[_0x23b3('0x22')](0x4)]=_0x145d32[_0x1ce897];delete _0x145d32[_0x1ce897];}}}}function agiHandler(_0x250cbf){logger[_0x23b3('0x23')](_0x23b3('0x24'),JSON[_0x23b3('0x25')](_0x250cbf,null,0x2));logger[_0x23b3('0x10')](util[_0x23b3('0x11')](_0x23b3('0x26'),_0x250cbf[_0x23b3('0x18')],_0x250cbf[_0x23b3('0x19')],_0x250cbf['callerid'],_0x250cbf[_0x23b3('0x1b')],_0x250cbf[_0x23b3('0x1c')]));_0x250cbf['on']('error',errorHandler);_0x250cbf['on'](_0x23b3('0x27'),closeHandler);_0x250cbf['on'](_0x23b3('0x28'),timeoutHandler);_0x250cbf[_0x23b3('0x29')]=![];_0x250cbf['on'](_0x23b3('0x2a'),hangupHandler);var _0x44c1fc=_[_0x23b3('0x2b')](projects,[_0x23b3('0x13'),_0x250cbf[_0x23b3('0x18')]]);if(!_0x44c1fc)return Project['handleNotFound'](_0x250cbf);if(!_0x44c1fc[_0x23b3('0x2c')])return Project[_0x23b3('0x2d')](_0x250cbf);return Project[_0x23b3('0x2e')](_0x44c1fc,_0x250cbf);}function main(){var _0xd80753;return utilLicense['getLicense']()['then'](function(_0x1f062b){if(!_0x1f062b)return;if(_0x1f062b[_0x23b3('0x2f')]){if(_0x1f062b[_0x23b3('0x30')]&&_0x1f062b['callysquare']>0x0){logger[_0x23b3('0x10')](util[_0x23b3('0x11')](_0x23b3('0x31'),_0x1f062b[_0x23b3('0x30')]));_0xd80753=_0x1f062b[_0x23b3('0x30')];}else{logger[_0x23b3('0x10')](_0x23b3('0x32'));}}else{logger[_0x23b3('0x10')](_0x23b3('0x33'));_0xd80753=-0x1;}})['then'](function(){return Project[_0x23b3('0x34')]();})['then'](function(_0x57f197){projects=_0x57f197;return;})[_0x23b3('0x1f')](function(_0x59a5a3){logger[_0x23b3('0xb')]('[LICENSE]',_0x59a5a3[_0x23b3('0xc')]);})[_0x23b3('0x35')](function(){var _0xb31094=require('./server')(config[_0x23b3('0x3')][_0x23b3('0xf')],config[_0x23b3('0x3')]['ip'],_0xd80753);_0xb31094['on'](_0x23b3('0xb'),errorHandler);_0xb31094['on'](_0x23b3('0x36'),listeningHandler);_0xb31094['on'](_0x23b3('0x37'),connectionHandler);_0xb31094['on'](_0x23b3('0x27'),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 d48c742..d5f0298 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 _0x7f3b=['error','message','result','catch','bluebird','jayson/promise','http','request','then'];(function(_0x255c69,_0x41b52f){var _0x2d03da=function(_0x2c6712){while(--_0x2c6712){_0x255c69['push'](_0x255c69['shift']());}};_0x2d03da(++_0x41b52f);}(_0x7f3b,0xdc));var _0xb7f3=function(_0x3542d9,_0x495531){_0x3542d9=_0x3542d9-0x0;var _0x2e92fe=_0x7f3b[_0x3542d9];return _0x2e92fe;};'use strict';var BPromise=require(_0xb7f3('0x0'));var jayson=require(_0xb7f3('0x1'));var client=jayson['client'][_0xb7f3('0x2')]({'port':0x232b});function request(_0x3772d7,_0x4c4efe){return new BPromise(function(_0x335e14,_0x322cd8){return client[_0xb7f3('0x3')](_0x3772d7,_0x4c4efe)[_0xb7f3('0x4')](function(_0x5a16d8){if(_0x5a16d8[_0xb7f3('0x5')]){return _0x322cd8(_0x5a16d8[_0xb7f3('0x5')][_0xb7f3('0x6')]);}else{return _0x335e14(_0x5a16d8[_0xb7f3('0x7')]);}})[_0xb7f3('0x8')](function(_0x1ad94a){return _0x322cd8(_0x1ad94a);});});}exports['sendMailMessage']=function(_0x1586d8,_0x323ac5){return request('SendMail',{'account':_0x1586d8,'message':_0x323ac5});}; \ No newline at end of file +var _0x4217=['error','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x224c59,_0x240239){var _0x272ab8=function(_0x532a71){while(--_0x532a71){_0x224c59['push'](_0x224c59['shift']());}};_0x272ab8(++_0x240239);}(_0x4217,0x184));var _0x7421=function(_0x3953df,_0x37f232){_0x3953df=_0x3953df-0x0;var _0x49b983=_0x4217[_0x3953df];return _0x49b983;};'use strict';var BPromise=require(_0x7421('0x0'));var jayson=require(_0x7421('0x1'));var client=jayson[_0x7421('0x2')][_0x7421('0x3')]({'port':0x232b});function request(_0x5b72d4,_0x40a763){return new BPromise(function(_0x597197,_0x476b6a){return client['request'](_0x5b72d4,_0x40a763)['then'](function(_0x30b286){if(_0x30b286[_0x7421('0x4')]){return _0x476b6a(_0x30b286[_0x7421('0x4')]['message']);}else{return _0x597197(_0x30b286[_0x7421('0x5')]);}})['catch'](function(_0x1a01bd){return _0x476b6a(_0x1a01bd);});});}exports[_0x7421('0x6')]=function(_0x4a4081,_0x5852a9){return request(_0x7421('0x7'),{'account':_0x4a4081,'message':_0x5852a9});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 85b6834..f88066c 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 _0xc666=['Project\x20%s\x20not\x20published','exports','lodash','util','../../config/logger','./rpc','./mailRpc','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','toJson','mxGraphModel','root','inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','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','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','debug','isUndefined','result','toString','agicommand\x20not\x20found','stack','dnid','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found'];(function(_0x3b06d1,_0x4a0229){var _0x2ad9dc=function(_0x4d9990){while(--_0x4d9990){_0x3b06d1['push'](_0x3b06d1['shift']());}};_0x2ad9dc(++_0x4a0229);}(_0xc666,0x1da));var _0x6c66=function(_0x537d8b,_0x449dc2){_0x537d8b=_0x537d8b-0x0;var _0x43f272=_0xc666[_0x537d8b];return _0x43f272;};'use strict';var _=require(_0x6c66('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0x6c66('0x1'));var logger=require(_0x6c66('0x2'))('agi');var rpc=require(_0x6c66('0x3'));var mailRpc=require(_0x6c66('0x4'));var Graph=require('./graph');var Vertices=require(_0x6c66('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x3646fc){logger[_0x6c66('0x6')](_0x6c66('0x7'),_0x3646fc['stack']);return[];});}function addVertex(_0x589bb0,_0x41050a,_0x3cdfb8){_0x41050a[_0x6c66('0x8')]=_0x3cdfb8;if(_0x41050a[_0x6c66('0x9')](_0x6c66('0xa'))){_0x41050a[_0x6c66('0xb')]=parseInt(_0x41050a[_0x6c66('0xa')],0xa);}_0x589bb0[_0x6c66('0xc')](_[_0x6c66('0xd')](_0x41050a,_0x6c66('0xe')));}function initGraph(_0x5a38bc,_0x2635fc){var _0xc0932=new Graph();for(var _0x5cdb19 in _0x5a38bc){if(_0x5a38bc['hasOwnProperty'](_0x5cdb19)){if(_[_0x6c66('0xf')](_0x5a38bc[_0x5cdb19])){for(var _0x29c805=0x0;_0x29c805<_0x5a38bc[_0x5cdb19][_0x6c66('0x10')];_0x29c805+=0x1){addVertex(_0xc0932,_0x5a38bc[_0x5cdb19][_0x29c805],_0x5cdb19);}}else{addVertex(_0xc0932,_0x5a38bc[_0x5cdb19],_0x5cdb19);}}}for(var _0x211b97=0x0;_0x211b97<_0x2635fc[_0x6c66('0x10')];_0x211b97+=0x1){if(_0x2635fc[_0x211b97][_0x6c66('0x11')]&&_0x2635fc[_0x211b97][_0x6c66('0x12')]){_0xc0932[_0x6c66('0x13')](_0x2635fc[_0x211b97][_0x6c66('0x11')],_0x2635fc[_0x211b97][_0x6c66('0x12')],_0x2635fc[_0x211b97]['value']);}}return _0xc0932;}function getRoot(_0x216eda){return parser[_0x6c66('0x14')](_0x216eda,{'object':!![]})[_0x6c66('0x15')][_0x6c66('0x16')];}function inspect(_0x2c2aca){return util[_0x6c66('0x17')](_0x2c2aca,{'showHidden':![],'depth':null});}function initialize(_0x4ba4bd,_0x215e32){var _0x306f1d=getRoot(_0x4ba4bd[_0x6c66('0x18')]);if(!_0x306f1d||!_0x306f1d[_0x6c66('0x19')])return;var _0x5147c3,_0x5cb7f2,_0x116b81;logger['debug'](_0x6c66('0x16'),JSON[_0x6c66('0x1a')](_0x306f1d,null,0x2));_0x215e32[_0x6c66('0x1b')]=moment()[_0x6c66('0x1c')](_0x6c66('0x1d'));_0x5147c3=initGraph(_[_0x6c66('0xd')](_0x306f1d,_0x6c66('0xe')),_0x306f1d[_0x6c66('0xe')]);_0x5cb7f2=new Vertices(_0x215e32,rpc,mailRpc);logger[_0x6c66('0x1e')](util[_0x6c66('0x1c')](_0x6c66('0x1f'),_0x215e32[_0x6c66('0x20')],_0x215e32[_0x6c66('0x21')],_0x215e32[_0x6c66('0x22')],_0x215e32['dnid'],_0x215e32[_0x6c66('0x23')]));_0x5147c3['traverseBFS'](_0x306f1d['start']['id'],function(_0x5f083f){try{_0x5f083f=_0x5cb7f2['clear'](_0x5f083f);logger['debug'](_0x6c66('0x24'),JSON[_0x6c66('0x1a')](_0x5f083f,null,0x2));if(_0x5f083f['agicommand']===_0x6c66('0x25')){logger[_0x6c66('0x1e')](_0x6c66('0x26'));_0x215e32['context']=_0x5f083f[_0x6c66('0x27')]||_0x215e32['context'];_0x215e32['extension']=_0x5f083f[_0x6c66('0x28')];_0x215e32[_0x6c66('0x29')]=_0x5f083f['priority']?_0x5f083f['priority']-0x1:0x1;return null;}else if(_0x5f083f&&_0x5cb7f2[_0x5f083f[_0x6c66('0x8')]]){_0x116b81=_0x5cb7f2[_0x5f083f[_0x6c66('0x8')]](_0x5f083f);logger[_0x6c66('0x1e')](_0x6c66('0x2a'),JSON[_0x6c66('0x1a')](_0x116b81,null,0x2));if(_0x116b81&&_0x116b81[_0x6c66('0x2b')]===AGI_CODE_SUCCESS&&_0x116b81['result']!==AGI_RESULT_ERROR&&!_0x215e32[_0x6c66('0x2c')]){logger[_0x6c66('0x2d')](_0x6c66('0x2a'),inspect(_0x116b81));return _[_0x6c66('0x2e')](_0x116b81[_0x6c66('0x2f')])?null:_0x116b81['result'][_0x6c66('0x30')]();}else{logger[_0x6c66('0x6')](_0x6c66('0x2a'),inspect(_0x116b81));return null;}}else{logger[_0x6c66('0x6')](_0x6c66('0x31'));return null;}}catch(_0x545491){logger[_0x6c66('0x6')](_0x545491[_0x6c66('0x32')]);return null;}});if(_0x306f1d['finally']){logger[_0x6c66('0x1e')](util[_0x6c66('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x215e32['arg_1'],_0x215e32['calleridname'],_0x215e32['callerid'],_0x215e32[_0x6c66('0x33')],_0x215e32[_0x6c66('0x23')]));_0x5147c3['traverseBFS'](_0x306f1d['finally']['id'],function(_0x56166f){try{_0x56166f=_0x5cb7f2[_0x6c66('0x34')](_0x56166f);logger['debug'](_0x6c66('0x24'),JSON[_0x6c66('0x1a')](_0x56166f,null,0x2));if(_0x56166f&&_0x5cb7f2[_0x56166f[_0x6c66('0x8')]]){_0x116b81=_0x5cb7f2[_0x56166f[_0x6c66('0x8')]](_0x56166f);if(_0x116b81){logger[_0x6c66('0x2d')](_0x6c66('0x2a'),inspect(_0x116b81));return _[_0x6c66('0x2e')](_0x116b81[_0x6c66('0x2f')])?null:_0x116b81['result'][_0x6c66('0x30')]();}else{logger['error'](_0x6c66('0x2a'),inspect(_0x116b81));return null;}}else{logger[_0x6c66('0x6')](_0x6c66('0x31'));return null;}}catch(_0x2db99e){logger['error'](_0x2db99e[_0x6c66('0x32')]);return null;}});}logger[_0x6c66('0x1e')](util[_0x6c66('0x1c')](_0x6c66('0x35'),_0x215e32[_0x6c66('0x20')],_0x215e32[_0x6c66('0x21')],_0x215e32[_0x6c66('0x22')],_0x215e32['dnid'],_0x215e32['uniqueid']));logger['info'](util[_0x6c66('0x1c')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x215e32[_0x6c66('0x27')],_0x215e32[_0x6c66('0x28')],parseInt(_0x215e32[_0x6c66('0x29')],0xa)+0x1));_0x215e32[_0x6c66('0x36')](_0x215e32[_0x6c66('0x27')],_0x215e32[_0x6c66('0x28')],parseInt(_0x215e32[_0x6c66('0x29')],0xa)+0x1);_0x215e32[_0x6c66('0x37')]();}function handleNotFound(_0x1005a6){logger[_0x6c66('0x6')](util['format'](_0x6c66('0x38'),_0x1005a6[_0x6c66('0x20')]));_0x1005a6[_0x6c66('0x36')](_0x1005a6[_0x6c66('0x27')],_0x1005a6[_0x6c66('0x28')],parseInt(_0x1005a6[_0x6c66('0x29')],0xa)+0x1);_0x1005a6['close']();}function handleUnpublished(_0x3fee67){logger[_0x6c66('0x6')](util[_0x6c66('0x1c')](_0x6c66('0x39'),_0x3fee67[_0x6c66('0x20')]));_0x3fee67[_0x6c66('0x36')](_0x3fee67[_0x6c66('0x27')],_0x3fee67[_0x6c66('0x28')],parseInt(_0x3fee67[_0x6c66('0x29')],0xa)+0x1);_0x3fee67[_0x6c66('0x37')]();}module[_0x6c66('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x8d54=['clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','agicommand\x20not\x20found','arg_1','finally','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','util','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','mxGraphModel','production','start','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','calleridname','callerid','dnid','uniqueid','traverseBFS'];(function(_0x1841a8,_0x36ae07){var _0x117a5c=function(_0x473146){while(--_0x473146){_0x1841a8['push'](_0x1841a8['shift']());}};_0x117a5c(++_0x36ae07);}(_0x8d54,0x102));var _0x48d5=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0x8d54[_0x20714a];return _0x15e877;};'use strict';var _=require('lodash');var moment=require(_0x48d5('0x0'));var parser=require('xml2json');var util=require(_0x48d5('0x1'));var logger=require(_0x48d5('0x2'))('agi');var rpc=require(_0x48d5('0x3'));var mailRpc=require(_0x48d5('0x4'));var Graph=require(_0x48d5('0x5'));var Vertices=require(_0x48d5('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x48d5('0x7')]()[_0x48d5('0x8')](function(_0x3d5b63){logger[_0x48d5('0x9')](_0x48d5('0xa'),_0x3d5b63[_0x48d5('0xb')]);return[];});}function addVertex(_0x1c6dfd,_0x5a9a60,_0x5231f5){_0x5a9a60[_0x48d5('0xc')]=_0x5231f5;if(_0x5a9a60[_0x48d5('0xd')]('retry')){_0x5a9a60[_0x48d5('0xe')]=parseInt(_0x5a9a60[_0x48d5('0xf')],0xa);}_0x1c6dfd[_0x48d5('0x10')](_[_0x48d5('0x11')](_0x5a9a60,_0x48d5('0x12')));}function initGraph(_0x13444f,_0x55b5b5){var _0x362ac0=new Graph();for(var _0x347d03 in _0x13444f){if(_0x13444f[_0x48d5('0xd')](_0x347d03)){if(_[_0x48d5('0x13')](_0x13444f[_0x347d03])){for(var _0x35fc16=0x0;_0x35fc16<_0x13444f[_0x347d03][_0x48d5('0x14')];_0x35fc16+=0x1){addVertex(_0x362ac0,_0x13444f[_0x347d03][_0x35fc16],_0x347d03);}}else{addVertex(_0x362ac0,_0x13444f[_0x347d03],_0x347d03);}}}for(var _0x3babd6=0x0;_0x3babd6<_0x55b5b5['length'];_0x3babd6+=0x1){if(_0x55b5b5[_0x3babd6][_0x48d5('0x15')]&&_0x55b5b5[_0x3babd6][_0x48d5('0x16')]){_0x362ac0[_0x48d5('0x17')](_0x55b5b5[_0x3babd6][_0x48d5('0x15')],_0x55b5b5[_0x3babd6][_0x48d5('0x16')],_0x55b5b5[_0x3babd6]['value']);}}return _0x362ac0;}function getRoot(_0x554b87){return parser['toJson'](_0x554b87,{'object':!![]})[_0x48d5('0x18')]['root'];}function inspect(_0x5d266f){return util['inspect'](_0x5d266f,{'showHidden':![],'depth':null});}function initialize(_0x2814b2,_0x1517ef){var _0x58331b=getRoot(_0x2814b2[_0x48d5('0x19')]);if(!_0x58331b||!_0x58331b[_0x48d5('0x1a')])return;var _0x3f16ef,_0x4e461f,_0x4f20fd;logger['debug'](_0x48d5('0x1b'),JSON[_0x48d5('0x1c')](_0x58331b,null,0x2));_0x1517ef['joinAt']=moment()[_0x48d5('0x1d')](_0x48d5('0x1e'));_0x3f16ef=initGraph(_[_0x48d5('0x11')](_0x58331b,_0x48d5('0x12')),_0x58331b['mxCell']);_0x4e461f=new Vertices(_0x1517ef,rpc,mailRpc);logger[_0x48d5('0x1f')](util[_0x48d5('0x1d')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1517ef['arg_1'],_0x1517ef[_0x48d5('0x20')],_0x1517ef[_0x48d5('0x21')],_0x1517ef[_0x48d5('0x22')],_0x1517ef[_0x48d5('0x23')]));_0x3f16ef[_0x48d5('0x24')](_0x58331b[_0x48d5('0x1a')]['id'],function(_0x511ea5){try{_0x511ea5=_0x4e461f[_0x48d5('0x25')](_0x511ea5);logger[_0x48d5('0x26')](_0x48d5('0x27'),JSON[_0x48d5('0x1c')](_0x511ea5,null,0x2));if(_0x511ea5[_0x48d5('0xc')]===_0x48d5('0x28')){logger[_0x48d5('0x1f')](_0x48d5('0x29'));_0x1517ef[_0x48d5('0x2a')]=_0x511ea5['context']||_0x1517ef[_0x48d5('0x2a')];_0x1517ef[_0x48d5('0x2b')]=_0x511ea5[_0x48d5('0x2b')];_0x1517ef['priority']=_0x511ea5[_0x48d5('0x2c')]?_0x511ea5[_0x48d5('0x2c')]-0x1:0x1;return null;}else if(_0x511ea5&&_0x4e461f[_0x511ea5[_0x48d5('0xc')]]){_0x4f20fd=_0x4e461f[_0x511ea5[_0x48d5('0xc')]](_0x511ea5);logger[_0x48d5('0x1f')](_0x48d5('0x2d'),JSON[_0x48d5('0x1c')](_0x4f20fd,null,0x2));if(_0x4f20fd&&_0x4f20fd[_0x48d5('0x2e')]===AGI_CODE_SUCCESS&&_0x4f20fd['result']!==AGI_RESULT_ERROR&&!_0x1517ef[_0x48d5('0x2f')]){logger[_0x48d5('0x26')](_0x48d5('0x2d'),inspect(_0x4f20fd));return _[_0x48d5('0x30')](_0x4f20fd['result'])?null:_0x4f20fd[_0x48d5('0x31')]['toString']();}else{logger['error'](_0x48d5('0x2d'),inspect(_0x4f20fd));return null;}}else{logger[_0x48d5('0x9')](_0x48d5('0x32'));return null;}}catch(_0x3d78a7){logger[_0x48d5('0x9')](_0x3d78a7[_0x48d5('0xb')]);return null;}});if(_0x58331b['finally']){logger[_0x48d5('0x1f')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1517ef[_0x48d5('0x33')],_0x1517ef[_0x48d5('0x20')],_0x1517ef['callerid'],_0x1517ef['dnid'],_0x1517ef[_0x48d5('0x23')]));_0x3f16ef[_0x48d5('0x24')](_0x58331b[_0x48d5('0x34')]['id'],function(_0x3f23a9){try{_0x3f23a9=_0x4e461f['clear'](_0x3f23a9);logger[_0x48d5('0x26')](_0x48d5('0x27'),JSON[_0x48d5('0x1c')](_0x3f23a9,null,0x2));if(_0x3f23a9&&_0x4e461f[_0x3f23a9[_0x48d5('0xc')]]){_0x4f20fd=_0x4e461f[_0x3f23a9['agicommand']](_0x3f23a9);if(_0x4f20fd){logger['debug']('response',inspect(_0x4f20fd));return _[_0x48d5('0x30')](_0x4f20fd[_0x48d5('0x31')])?null:_0x4f20fd[_0x48d5('0x31')][_0x48d5('0x35')]();}else{logger[_0x48d5('0x9')]('response',inspect(_0x4f20fd));return null;}}else{logger[_0x48d5('0x9')](_0x48d5('0x32'));return null;}}catch(_0x3644de){logger[_0x48d5('0x9')](_0x3644de[_0x48d5('0xb')]);return null;}});}logger[_0x48d5('0x1f')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1517ef[_0x48d5('0x33')],_0x1517ef['calleridname'],_0x1517ef['callerid'],_0x1517ef['dnid'],_0x1517ef['uniqueid']));logger['info'](util[_0x48d5('0x1d')](_0x48d5('0x36'),_0x1517ef['context'],_0x1517ef[_0x48d5('0x2b')],parseInt(_0x1517ef['priority'],0xa)+0x1));_0x1517ef[_0x48d5('0x37')](_0x1517ef['context'],_0x1517ef[_0x48d5('0x2b')],parseInt(_0x1517ef['priority'],0xa)+0x1);_0x1517ef[_0x48d5('0x38')]();}function handleNotFound(_0x5c15a8){logger[_0x48d5('0x9')](util[_0x48d5('0x1d')](_0x48d5('0x39'),_0x5c15a8[_0x48d5('0x33')]));_0x5c15a8[_0x48d5('0x37')](_0x5c15a8[_0x48d5('0x2a')],_0x5c15a8[_0x48d5('0x2b')],parseInt(_0x5c15a8[_0x48d5('0x2c')],0xa)+0x1);_0x5c15a8[_0x48d5('0x38')]();}function handleUnpublished(_0x7a47fb){logger[_0x48d5('0x9')](util[_0x48d5('0x1d')]('Project\x20%s\x20not\x20published',_0x7a47fb[_0x48d5('0x33')]));_0x7a47fb[_0x48d5('0x37')](_0x7a47fb['context'],_0x7a47fb[_0x48d5('0x2b')],parseInt(_0x7a47fb[_0x48d5('0x2c')],0xa)+0x1);_0x7a47fb[_0x48d5('0x38')]();}module[_0x48d5('0x3a')]={'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 a14e3d3..7244570 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 _0x5668=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','split','indexOf','emit','headers','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x472ee7,_0x5838cb){var _0x2b84f9=function(_0x4541f0){while(--_0x4541f0){_0x472ee7['push'](_0x472ee7['shift']());}};_0x2b84f9(++_0x5838cb);}(_0x5668,0x8b));var _0x8566=function(_0x1e661a,_0x1e6690){_0x1e661a=_0x1e661a-0x0;var _0x2d8beb=_0x5668[_0x1e661a];return _0x2d8beb;};'use strict';var util=require(_0x8566('0x0'));var Transform=require(_0x8566('0x1'))[_0x8566('0x2')];function AGIReply(_0x3297a3){Transform[_0x8566('0x3')](this,_0x3297a3);this[_0x8566('0x4')]='';this[_0x8566('0x5')]=![];}util[_0x8566('0x6')](AGIReply,Transform);AGIReply[_0x8566('0x7')][_0x8566('0x8')]=function(_0x174099,_0x1a25d0,_0x2f958c){var _0x4885d6='\x0a',_0x355fce=['\x0a\x0a',_0x8566('0x9')],_0x2ffec4=-0x1,_0x49f55a=-0x1,_0x4aaf3f='',_0x4045ed=0x0,_0x4cbf90='',_0x555ffa='';this['_localBuffer']+=_0x174099[_0x8566('0xa')]();_0x4cbf90=this[_0x8566('0x4')];if(!this[_0x8566('0x5')]){_0x4045ed=0x0;while(_0x355fce[_0x4045ed]){while((_0x49f55a=_0x4cbf90['indexOf'](_0x355fce[_0x4045ed]))!=-0x1){_0x4aaf3f=_0x355fce[_0x4045ed];_0x555ffa=_0x4cbf90[_0x8566('0xb')](0x0,_0x49f55a);_0x4cbf90=_0x4cbf90[_0x8566('0xb')](_0x49f55a+_0x4aaf3f['length']);var _0x4ca241=_0x555ffa[_0x8566('0xc')](_0x4885d6),_0x51c3ba=0x0,_0x522618={},_0x11e0a5='',_0x3318a3='',_0x2025a2=-0x1;while(_0x4ca241[_0x51c3ba]){_0x2025a2=_0x4ca241[_0x51c3ba][_0x8566('0xd')](':');if(_0x2025a2!=-0x1){_0x11e0a5=_0x4ca241[_0x51c3ba]['slice'](0x0,_0x2025a2)['trim']();_0x3318a3=_0x4ca241[_0x51c3ba]['slice'](_0x2025a2+0x1)['trim']();if(_0x11e0a5['length']>0x0){_0x522618[_0x11e0a5]=_0x3318a3;}}else{}_0x51c3ba++;}this[_0x8566('0xe')](_0x8566('0xf'),_0x522618);this[_0x8566('0x5')]=!![];}_0x4045ed++;}this[_0x8566('0x4')]=_0x4cbf90;}else{while((_0x2ffec4=_0x4cbf90[_0x8566('0xd')](_0x4885d6))!=-0x1){_0x555ffa=_0x4cbf90['substring'](0x0,_0x2ffec4);this[_0x8566('0xe')](_0x8566('0x10'),_0x555ffa);_0x4cbf90=_0x4cbf90[_0x8566('0xb')](_0x2ffec4+_0x4885d6['length']);}this[_0x8566('0x4')]=_0x4cbf90;}_0x2f958c();};module[_0x8566('0x11')]=AGIReply; \ No newline at end of file +var _0x9857=['headers','line','util','stream','Transform','call','_inBody','inherits','prototype','_transform','_localBuffer','toString','substring','length','split','indexOf','trim','slice','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9857,0x87));var _0x7985=function(_0x37697f,_0x349ab){_0x37697f=_0x37697f-0x0;var _0x17a373=_0x9857[_0x37697f];return _0x17a373;};'use strict';var util=require(_0x7985('0x0'));var Transform=require(_0x7985('0x1'))[_0x7985('0x2')];function AGIReply(_0x53aa17){Transform[_0x7985('0x3')](this,_0x53aa17);this['_localBuffer']='';this[_0x7985('0x4')]=![];}util[_0x7985('0x5')](AGIReply,Transform);AGIReply[_0x7985('0x6')][_0x7985('0x7')]=function(_0x20ebae,_0x2cad90,_0x32aacc){var _0x396d12='\x0a',_0x1d0179=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x53d2cd=-0x1,_0x4ce3a0=-0x1,_0xa42742='',_0x2e9df=0x0,_0x861d15='',_0x62e3ce='';this[_0x7985('0x8')]+=_0x20ebae[_0x7985('0x9')]();_0x861d15=this[_0x7985('0x8')];if(!this[_0x7985('0x4')]){_0x2e9df=0x0;while(_0x1d0179[_0x2e9df]){while((_0x4ce3a0=_0x861d15['indexOf'](_0x1d0179[_0x2e9df]))!=-0x1){_0xa42742=_0x1d0179[_0x2e9df];_0x62e3ce=_0x861d15[_0x7985('0xa')](0x0,_0x4ce3a0);_0x861d15=_0x861d15[_0x7985('0xa')](_0x4ce3a0+_0xa42742[_0x7985('0xb')]);var _0x5e6cc6=_0x62e3ce[_0x7985('0xc')](_0x396d12),_0x5d450a=0x0,_0x15dabd={},_0x4b36a5='',_0x193fa9='',_0x272f9e=-0x1;while(_0x5e6cc6[_0x5d450a]){_0x272f9e=_0x5e6cc6[_0x5d450a][_0x7985('0xd')](':');if(_0x272f9e!=-0x1){_0x4b36a5=_0x5e6cc6[_0x5d450a]['slice'](0x0,_0x272f9e)[_0x7985('0xe')]();_0x193fa9=_0x5e6cc6[_0x5d450a][_0x7985('0xf')](_0x272f9e+0x1)[_0x7985('0xe')]();if(_0x4b36a5['length']>0x0){_0x15dabd[_0x4b36a5]=_0x193fa9;}}else{}_0x5d450a++;}this[_0x7985('0x10')](_0x7985('0x11'),_0x15dabd);this[_0x7985('0x4')]=!![];}_0x2e9df++;}this['_localBuffer']=_0x861d15;}else{while((_0x53d2cd=_0x861d15[_0x7985('0xd')](_0x396d12))!=-0x1){_0x62e3ce=_0x861d15[_0x7985('0xa')](0x0,_0x53d2cd);this[_0x7985('0x10')](_0x7985('0x12'),_0x62e3ce);_0x861d15=_0x861d15[_0x7985('0xa')](_0x53d2cd+_0x396d12['length']);}this['_localBuffer']=_0x861d15;}_0x32aacc();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index f5411ab..afbb15c 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 _0xe829=['getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','request','then','error','message','result','catch','getSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact'];(function(_0x18a5a9,_0x4e6c02){var _0x3796ba=function(_0x2bde35){while(--_0x2bde35){_0x18a5a9['push'](_0x18a5a9['shift']());}};_0x3796ba(++_0x4e6c02);}(_0xe829,0x1d8));var _0x9e82=function(_0xec722a,_0x354472){_0xec722a=_0xec722a-0x0;var _0xbb0f9e=_0xe829[_0xec722a];return _0xbb0f9e;};'use strict';var _=require(_0x9e82('0x0'));var moment=require(_0x9e82('0x1'));var jayson=require(_0x9e82('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0xf56525,_0x337730){return new Promise(function(_0x1b47d8,_0x168d3e){return client[_0x9e82('0x3')](_0xf56525,_0x337730)[_0x9e82('0x4')](function(_0x580d41){if(_0x580d41[_0x9e82('0x5')]){return _0x168d3e(_0x580d41[_0x9e82('0x5')][_0x9e82('0x6')]);}else{return _0x1b47d8(_0x580d41[_0x9e82('0x7')]);}})[_0x9e82('0x8')](function(_0x5c4c57){return _0x168d3e(_0x5c4c57);});});}exports[_0x9e82('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x9e82('0xa'),_0x9e82('0xb')]}});};exports['getSquareProject']=function(_0x5965b0){return request(_0x9e82('0xc'),{'options':{'raw':![],'where':{'name':_0x5965b0},'attributes':[_0x9e82('0xb')]}});};exports[_0x9e82('0xd')]=function(_0x378f5c){return request(_0x9e82('0xe'),{'options':{'raw':![],'where':{'id':_0x378f5c},'include':[{'model':_0x9e82('0xf'),'as':_0x9e82('0x10'),'include':[{'model':_0x9e82('0x11'),'as':_0x9e82('0x11')}]}],'attributes':['id',_0x9e82('0xa'),_0x9e82('0x12')],'smtp':!![]}});};exports[_0x9e82('0x13')]=function(_0x5e0c79){return request('ShowSquareProject',{'options':{'where':{'id':_0x5e0c79},'attributes':[_0x9e82('0xa')]}});};exports[_0x9e82('0x14')]=function(_0x202d99){return request(_0x9e82('0x15'),{'options':{'where':{'id':_0x202d99},'attributes':['name']}});};exports[_0x9e82('0x16')]=function(_0xfa4802){return request(_0x9e82('0x17'),{'options':{'where':{'id':_0xfa4802},'attributes':[_0x9e82('0xa')]}});};exports['getSquareOdbcById']=function(_0x11b7ea){return request(_0x9e82('0x18'),{'options':{'where':{'id':_0x11b7ea},'attributes':[_0x9e82('0x19')]}});};exports[_0x9e82('0x1a')]=function(_0x50b85c){return request('ShowUser',{'options':{'where':{'id':_0x50b85c},'attributes':['name']}});};exports[_0x9e82('0x1b')]=function(_0x2de033){return request(_0x9e82('0x1c'),{'options':{'where':{'phone':_0x2de033[_0x9e82('0x1d')]},'attributes':['id']}});};exports[_0x9e82('0x1e')]=function(_0x4dce73){return request(_0x9e82('0x1f'),{'options':{'where':{'id':_0x4dce73},'attributes':[_0x9e82('0xa')]}});};exports[_0x9e82('0x20')]=function(_0x199984){return request('ShowSound',{'options':{'where':{'id':_0x199984},'attributes':['save_name']}});};exports[_0x9e82('0x21')]=function(_0x2c37ad){return request(_0x9e82('0x22'),{'options':{'raw':![],'where':{'id':_0x2c37ad},'include':[{'model':_0x9e82('0x23'),'as':_0x9e82('0x24')}]}});};exports[_0x9e82('0x25')]=function(_0x53d6a0){return request(_0x9e82('0x26'),{'options':{'where':{'id':_0x53d6a0},'attributes':['id',_0x9e82('0xa')]}});};exports[_0x9e82('0x27')]=function(_0x3eb596){return request(_0x9e82('0x28'),{'body':_0x3eb596});};exports['createSquareDetailsReport']=function(_0x21519d){return request('CreateSquareDetailsReport',{'body':_0x21519d});};exports[_0x9e82('0x29')]=function(_0x4d3bbb){return request(_0x9e82('0x2a'),{'body':_[_0x9e82('0x2b')](_0x4d3bbb,{'project_name':_0x4d3bbb[_0x9e82('0x2c')],'prev_project_name':_0x4d3bbb[_0x9e82('0x2d')]||'','is_subproject':_0x4d3bbb[_0x9e82('0x2d')]?!![]:![],'leaveAt':moment()[_0x9e82('0x2e')](_0x9e82('0x2f'))})});};exports[_0x9e82('0x30')]=function(_0xbcc412){return request(_0x9e82('0x31'),{'body':_0xbcc412});};exports[_0x9e82('0x32')]=function(_0x523a11){return request(_0x9e82('0x33'),{'body':_0x523a11});};exports[_0x9e82('0x34')]=function(_0x221ac0){return request(_0x9e82('0x35'),{'options':{'raw':![],'where':{'phone':_0x221ac0[_0x9e82('0x1d')],'ListId':_0x221ac0[_0x9e82('0x36')]}}})[_0x9e82('0x4')](function(_0x1b0c8b){if(_0x1b0c8b){return _0x1b0c8b;}return request(_0x9e82('0x37'),{'body':_0x221ac0});});};exports[_0x9e82('0x38')]=function(_0x3c67d8){return request(_0x9e82('0x39'),{'options':{'where':{'id':_0x3c67d8},'attributes':[_0x9e82('0xa')]}});};exports[_0x9e82('0x3a')]=function(_0x5040a2,_0x4bf8b7){return request(_0x9e82('0x3b'),{'body':{'interface':_0x4bf8b7},'options':{'where':_0x5040a2}});};exports[_0x9e82('0x3c')]=function(_0xd5ce64,_0x32a2d2,_0x133b48){return request(_0x9e82('0x3d'),{'body':{'type':_0x32a2d2,'uniqueid':_0x133b48},'options':{'where':_0xd5ce64}});};exports[_0x9e82('0x3e')]=function(_0x5d357f){return request(_0x9e82('0x3f'),{'body':{},'options':{'where':_0x5d357f}});};exports[_0x9e82('0x40')]=function(_0x5d1654){return request(_0x9e82('0x41'),{'body':{},'options':{'where':_0x5d1654}});}; \ No newline at end of file +var _0x48d0=['ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getIntervalById','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject'];(function(_0x43849d,_0x387244){var _0x38d037=function(_0x17961a){while(--_0x17961a){_0x43849d['push'](_0x43849d['shift']());}};_0x38d037(++_0x387244);}(_0x48d0,0xd3));var _0x048d=function(_0xf253a2,_0x3f037e){_0xf253a2=_0xf253a2-0x0;var _0x1a5d19=_0x48d0[_0xf253a2];return _0x1a5d19;};'use strict';var _=require(_0x048d('0x0'));var moment=require(_0x048d('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x048d('0x2')][_0x048d('0x3')]({'port':0x2329});function request(_0x13b589,_0x4ec740){return new Promise(function(_0x1f8bf1,_0x1e9131){return client['request'](_0x13b589,_0x4ec740)[_0x048d('0x4')](function(_0x19c441){if(_0x19c441[_0x048d('0x5')]){return _0x1e9131(_0x19c441['error'][_0x048d('0x6')]);}else{return _0x1f8bf1(_0x19c441[_0x048d('0x7')]);}})['catch'](function(_0x3939cb){return _0x1e9131(_0x3939cb);});});}exports[_0x048d('0x8')]=function(){return request(_0x048d('0x9'),{'options':{'raw':![],'attributes':['id',_0x048d('0xa'),_0x048d('0xb')]}});};exports[_0x048d('0xc')]=function(_0x209485){return request(_0x048d('0xd'),{'options':{'raw':![],'where':{'name':_0x209485},'attributes':[_0x048d('0xb')]}});};exports[_0x048d('0xe')]=function(_0x1ab490){return request(_0x048d('0xf'),{'options':{'raw':![],'where':{'id':_0x1ab490},'include':[{'model':'MailServerOut','as':_0x048d('0x10'),'include':[{'model':'CloudProvider','as':_0x048d('0x11')}]}],'attributes':['id',_0x048d('0xa'),_0x048d('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x110e6c){return request('ShowSquareProject',{'options':{'where':{'id':_0x110e6c},'attributes':[_0x048d('0xa')]}});};exports[_0x048d('0x13')]=function(_0x553b00){return request(_0x048d('0x14'),{'options':{'where':{'id':_0x553b00},'attributes':['name']}});};exports[_0x048d('0x15')]=function(_0x245e10){return request(_0x048d('0x16'),{'options':{'where':{'id':_0x245e10},'attributes':[_0x048d('0xa')]}});};exports[_0x048d('0x17')]=function(_0x22795c){return request(_0x048d('0x18'),{'options':{'where':{'id':_0x22795c},'attributes':['dsn']}});};exports[_0x048d('0x19')]=function(_0xef2f1c){return request(_0x048d('0x1a'),{'options':{'where':{'id':_0xef2f1c},'attributes':['name']}});};exports[_0x048d('0x1b')]=function(_0x47bb61){return request('GetContactByPhone',{'options':{'where':{'phone':_0x47bb61[_0x048d('0x1c')]},'attributes':['id']}});};exports[_0x048d('0x1d')]=function(_0x34408a){return request('ShowTrunk',{'options':{'where':{'id':_0x34408a},'attributes':[_0x048d('0xa')]}});};exports['getSoundById']=function(_0x386b90){return request('ShowSound',{'options':{'where':{'id':_0x386b90},'attributes':['save_name']}});};exports[_0x048d('0x1e')]=function(_0x499ba9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x499ba9},'include':[{'model':'Interval','as':_0x048d('0x1f')}]}});};exports[_0x048d('0x20')]=function(_0x113b7b){return request(_0x048d('0x21'),{'options':{'where':{'id':_0x113b7b},'attributes':['id',_0x048d('0xa')]}});};exports[_0x048d('0x22')]=function(_0x4b6dca){return request('CreateSmsMessage',{'body':_0x4b6dca});};exports[_0x048d('0x23')]=function(_0x4d772d){return request('CreateSquareDetailsReport',{'body':_0x4d772d});};exports[_0x048d('0x24')]=function(_0x51d6c8){return request('CreateSquareReport',{'body':_[_0x048d('0x25')](_0x51d6c8,{'project_name':_0x51d6c8[_0x048d('0x26')],'prev_project_name':_0x51d6c8[_0x048d('0x27')]||'','is_subproject':_0x51d6c8[_0x048d('0x27')]?!![]:![],'leaveAt':moment()[_0x048d('0x28')](_0x048d('0x29'))})});};exports[_0x048d('0x2a')]=function(_0xe0cdce){return request(_0x048d('0x2b'),{'body':_0xe0cdce});};exports[_0x048d('0x2c')]=function(_0x189227){return request('CreateSquareMessage',{'body':_0x189227});};exports[_0x048d('0x2d')]=function(_0x4682db){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4682db['phone'],'ListId':_0x4682db['ListId']}}})[_0x048d('0x4')](function(_0x517e8b){if(_0x517e8b){return _0x517e8b;}return request(_0x048d('0x2e'),{'body':_0x4682db});});};exports[_0x048d('0x2f')]=function(_0x35acaa){return request(_0x048d('0x30'),{'options':{'where':{'id':_0x35acaa},'attributes':[_0x048d('0xa')]}});};exports[_0x048d('0x31')]=function(_0x5326b3,_0x15e47e){return request(_0x048d('0x32'),{'body':{'interface':_0x15e47e},'options':{'where':_0x5326b3}});};exports['agentPause']=function(_0x1849d2,_0x3d1249,_0x87e456){return request(_0x048d('0x33'),{'body':{'type':_0x3d1249,'uniqueid':_0x87e456},'options':{'where':_0x1849d2}});};exports[_0x048d('0x34')]=function(_0x15b7d2){return request(_0x048d('0x35'),{'body':{},'options':{'where':_0x15b7d2}});};exports[_0x048d('0x36')]=function(_0x4f8837){return request(_0x048d('0x37'),{'body':{},'options':{'where':_0x4f8837}});}; \ 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 6959ae1..0977a13 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 _0x4677=['exports','./polly'];(function(_0x5ca259,_0x145448){var _0x30d5d8=function(_0x3a0a32){while(--_0x3a0a32){_0x5ca259['push'](_0x5ca259['shift']());}};_0x30d5d8(++_0x145448);}(_0x4677,0x155));var _0x7467=function(_0x69f3d7,_0x5e91c1){_0x69f3d7=_0x69f3d7-0x0;var _0x2dce0b=_0x4677[_0x69f3d7];return _0x2dce0b;};var polly=require(_0x7467('0x0'));var lex=require('./lex');module[_0x7467('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5d59=['exports','./lex'];(function(_0x3b6daf,_0x45b397){var _0x1b3b76=function(_0x4c4ce9){while(--_0x4c4ce9){_0x3b6daf['push'](_0x3b6daf['shift']());}};_0x1b3b76(++_0x45b397);}(_0x5d59,0x15f));var _0x95d5=function(_0x4cd226,_0x489a22){_0x4cd226=_0x4cd226-0x0;var _0x19c008=_0x5d59[_0x4cd226];return _0x19c008;};var polly=require('./polly');var lex=require(_0x95d5('0x0'));module[_0x95d5('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 7f81adb..40ee6b8 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 _0x96cc=['./lib/api'];(function(_0x1dbfa4,_0x500677){var _0x23f447=function(_0x58dc2f){while(--_0x58dc2f){_0x1dbfa4['push'](_0x1dbfa4['shift']());}};_0x23f447(++_0x500677);}(_0x96cc,0x16c));var _0xc96c=function(_0x3efe28,_0x2870fc){_0x3efe28=_0x3efe28-0x0;var _0x54d927=_0x96cc[_0x3efe28];return _0x54d927;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ No newline at end of file +var _0x9354=['exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x96));var _0x4935=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x9354[_0x2a56ad];return _0x425175;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ 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 d203394..2f140f1 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(_0x89db4a,_0x1b0ff6){var _0x45957b=function(_0x15c1d1){while(--_0x15c1d1){_0x89db4a['push'](_0x89db4a['shift']());}};_0x45957b(++_0x1b0ff6);}(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1ff545,_0x159120){var _0x575b3d=function(_0x22759b){while(--_0x22759b){_0x1ff545['push'](_0x1ff545['shift']());}};_0x575b3d(++_0x159120);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 4ef793d..b541666 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 _0x2747=['./lib/api','exports'];(function(_0xee2bb3,_0x307f91){var _0x26d192=function(_0x4726eb){while(--_0x4726eb){_0xee2bb3['push'](_0xee2bb3['shift']());}};_0x26d192(++_0x307f91);}(_0x2747,0x124));var _0x7274=function(_0x4171a8,_0x2309d6){_0x4171a8=_0x4171a8-0x0;var _0x41e768=_0x2747[_0x4171a8];return _0x41e768;};'use strict';var polly=require(_0x7274('0x0'));module[_0x7274('0x1')]=function(_0x3198f8,_0x5e15ac,_0x2999cb,_0xff3695,_0x368e50,_0x37a17b,_0x2be6fb){return polly(_0x3198f8,_0x5e15ac,_0x2999cb,_0xff3695,_0x368e50,_0x37a17b,_0x2be6fb);}; \ No newline at end of file +var _0x6945=['exports'];(function(_0x27a29c,_0x31abe9){var _0x30cea4=function(_0x2371ad){while(--_0x2371ad){_0x27a29c['push'](_0x27a29c['shift']());}};_0x30cea4(++_0x31abe9);}(_0x6945,0x1c3));var _0x5694=function(_0x4002b1,_0x228cb5){_0x4002b1=_0x4002b1-0x0;var _0x3df6c6=_0x6945[_0x4002b1];return _0x3df6c6;};'use strict';var polly=require('./lib/api');module[_0x5694('0x0')]=function(_0x26c8d7,_0xa188d5,_0x3781f1,_0x2908e2,_0x40729b,_0x290f26,_0x11186a){return polly(_0x26c8d7,_0xa188d5,_0x3781f1,_0x2908e2,_0x40729b,_0x290f26,_0x11186a);}; \ 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 2936e36..7532fd1 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 _0x6c31=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0xcb8fef,_0x32565c){var _0x41d48c=function(_0x5e4a2b){while(--_0x5e4a2b){_0xcb8fef['push'](_0xcb8fef['shift']());}};_0x41d48c(++_0x32565c);}(_0x6c31,0x16f));var _0x16c3=function(_0x1bffc9,_0x505bf0){_0x1bffc9=_0x1bffc9-0x0;var _0x26177e=_0x6c31[_0x1bffc9];return _0x26177e;};'use strict';var fs=require('fs');var path=require(_0x16c3('0x0'));var BPromise=require(_0x16c3('0x1'));var rs=require(_0x16c3('0x2'));var AWS=require(_0x16c3('0x3'));function pollyResult(_0xb5c78d,_0x504a70,_0x288976){return new BPromise(function(_0x312ef5,_0xfbac02){_0xb5c78d['synthesizeSpeech'](_0x504a70,function(_0x4a9e49,_0x4fc4e3){if(_0x4a9e49){_0xfbac02(_0x4a9e49);}else if(_0x4fc4e3){if(_0x4fc4e3[_0x16c3('0x4')]instanceof Buffer){fs[_0x16c3('0x5')](_0x288976,_0x4fc4e3['AudioStream'],function(_0xe60cd6){if(_0xe60cd6){_0xfbac02(_0xe60cd6);}else{_0x312ef5();}});}else{_0xfbac02(new Error(_0x16c3('0x6')));}}else{_0xfbac02(new Error(_0x16c3('0x7')));}});});}module[_0x16c3('0x8')]=function(_0x34f717,_0x4b78d4,_0x3b7ea1,_0x21a404,_0x49854f,_0x46de61,_0x57ca85){var _0x25c31a=new AWS[(_0x16c3('0x9'))]({'accessKeyId':_0x34f717,'secretAccessKey':_0x4b78d4,'region':_0x3b7ea1});var _0x32ec86={'Text':_0x49854f,'TextType':_0x46de61||_0x16c3('0xa'),'OutputFormat':_0x16c3('0xb'),'VoiceId':_0x21a404};return pollyResult(_0x25c31a,_0x32ec86,_0x57ca85);}; \ No newline at end of file +var _0x8440=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8440,0x109));var _0x0844=function(_0xcdb582,_0x4cf78f){_0xcdb582=_0xcdb582-0x0;var _0x105148=_0x8440[_0xcdb582];return _0x105148;};'use strict';var fs=require('fs');var path=require(_0x0844('0x0'));var BPromise=require('bluebird');var rs=require(_0x0844('0x1'));var AWS=require(_0x0844('0x2'));function pollyResult(_0x1bb368,_0x5b7420,_0x3f01ad){return new BPromise(function(_0x911a1e,_0x578190){_0x1bb368[_0x0844('0x3')](_0x5b7420,function(_0x171d28,_0x1255cd){if(_0x171d28){_0x578190(_0x171d28);}else if(_0x1255cd){if(_0x1255cd[_0x0844('0x4')]instanceof Buffer){fs[_0x0844('0x5')](_0x3f01ad,_0x1255cd[_0x0844('0x4')],function(_0x422d04){if(_0x422d04){_0x578190(_0x422d04);}else{_0x911a1e();}});}else{_0x578190(new Error(_0x0844('0x6')));}}else{_0x578190(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x5b8a19,_0x7026e3,_0x20154e,_0x2fbb15,_0x122cee,_0x21d504,_0x5f422d){var _0x3a1867=new AWS[(_0x0844('0x7'))]({'accessKeyId':_0x5b8a19,'secretAccessKey':_0x7026e3,'region':_0x20154e});var _0x5c2915={'Text':_0x122cee,'TextType':_0x21d504||_0x0844('0x8'),'OutputFormat':_0x0844('0x9'),'VoiceId':_0x2fbb15};return pollyResult(_0x3a1867,_0x5c2915,_0x5f422d);}; \ 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 32dae0a..e639684 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 _0x4ff5=['./lib/api','exports'];(function(_0x55e024,_0x41bb5f){var _0x340969=function(_0x422b54){while(--_0x422b54){_0x55e024['push'](_0x55e024['shift']());}};_0x340969(++_0x41bb5f);}(_0x4ff5,0x10a));var _0x54ff=function(_0x3e810a,_0x16b5ca){_0x3e810a=_0x3e810a-0x0;var _0x3e1d8e=_0x4ff5[_0x3e810a];return _0x3e1d8e;};'use strict';var asr=require(_0x54ff('0x0'));module[_0x54ff('0x1')]=function(_0x9df8eb,_0x3d7bea,_0xda800d,_0x3df58a){return asr(_0x9df8eb,_0x3d7bea,_0xda800d);}; \ No newline at end of file +var _0xeab7=['./lib/api'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xeab7,0x1b9));var _0x7eab=function(_0x214a52,_0x58f137){_0x214a52=_0x214a52-0x0;var _0xe56ea0=_0xeab7[_0x214a52];return _0xe56ea0;};'use strict';var asr=require(_0x7eab('0x0'));module['exports']=function(_0x4e3c97,_0x2d2215,_0x1ca7fa,_0x13e43d){return asr(_0x4e3c97,_0x2d2215,_0x1ca7fa);}; \ 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 7aa9967..ebe3d75 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 _0xdb4b=['lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x3a615e,_0x4da265){var _0x407774=function(_0x24b547){while(--_0x24b547){_0x3a615e['push'](_0x3a615e['shift']());}};_0x407774(++_0x4da265);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x245e9c,_0x3846b6){_0x245e9c=_0x245e9c-0x0;var _0x423cb0=_0xdb4b[_0x245e9c];return _0x423cb0;};'use strict';var url=require('url');var BPromise=require(_0xbdb4('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xbdb4('0x1')]=function(_0x883c71,_0x3d5174,_0x257d67){return new BPromise(function(_0x47a78c,_0x3cc8c2){var _0x40e5ca;if(typeof _0x883c71!==_0xbdb4('0x2')||_0x883c71[_0xbdb4('0x3')]===0x0){return _0x3cc8c2(_0xbdb4('0x4'));}if(typeof _0x3d5174!==_0xbdb4('0x2')||_0x3d5174[_0xbdb4('0x3')]===0x0){return _0x3cc8c2('key\x20should\x20be\x20a\x20string');}if(typeof _0x257d67!=='undefined'&&(typeof _0x257d67!==_0xbdb4('0x2')||_0x257d67[_0xbdb4('0x3')]===0x0)){return _0x3cc8c2(_0xbdb4('0x5'));}try{_0x40e5ca=fs[_0xbdb4('0x6')](_0x883c71)['toString'](_0xbdb4('0x7'));}catch(_0x5ba9f8){return _0x3cc8c2(_0x5ba9f8);}return _0x47a78c({'method':_0xbdb4('0x8'),'uri':host+_0xbdb4('0x9')+_0x3d5174,'body':{'config':{'encoding':_0xbdb4('0xa'),'sampleRateHertz':'8000','languageCode':_0x257d67},'audio':{'content':_0x40e5ca}},'json':!![]});});}; \ No newline at end of file +var _0x70e0=['8000','url','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x70e0,0x17b));var _0x070e=function(_0x1e8c33,_0x438a1f){_0x1e8c33=_0x1e8c33-0x0;var _0x196e99=_0x70e0[_0x1e8c33];return _0x196e99;};'use strict';var url=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var fs=require('fs');var host=_0x070e('0x2');module['exports']=function(_0x579b83,_0x16e651,_0xee173){return new BPromise(function(_0x277d32,_0x2593e5){var _0x5c90fc;if(typeof _0x579b83!==_0x070e('0x3')||_0x579b83['length']===0x0){return _0x2593e5(_0x070e('0x4'));}if(typeof _0x16e651!=='string'||_0x16e651['length']===0x0){return _0x2593e5('key\x20should\x20be\x20a\x20string');}if(typeof _0xee173!==_0x070e('0x5')&&(typeof _0xee173!==_0x070e('0x3')||_0xee173[_0x070e('0x6')]===0x0)){return _0x2593e5(_0x070e('0x7'));}try{_0x5c90fc=fs[_0x070e('0x8')](_0x579b83)[_0x070e('0x9')](_0x070e('0xa'));}catch(_0x4e99e6){return _0x2593e5(_0x4e99e6);}return _0x277d32({'method':'POST','uri':host+_0x070e('0xb')+_0x16e651,'body':{'config':{'encoding':_0x070e('0xc'),'sampleRateHertz':_0x070e('0xd'),'languageCode':_0xee173},'audio':{'content':_0x5c90fc}},'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 a4aeed9..c79344c 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 _0x71dd=['exports'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x71dd,0x152));var _0xd71d=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0x71dd[_0x369a98];return _0x29565c;};var asr=require('./asr');module[_0xd71d('0x0')]={'asr':asr}; \ No newline at end of file +var _0x8299=['exports','./asr'];(function(_0x33f1e2,_0x2111bb){var _0x581421=function(_0x3a2628){while(--_0x3a2628){_0x33f1e2['push'](_0x33f1e2['shift']());}};_0x581421(++_0x2111bb);}(_0x8299,0x67));var _0x9829=function(_0x4da5d1,_0x128317){_0x4da5d1=_0x4da5d1-0x0;var _0xc613a1=_0x8299[_0x4da5d1];return _0xc613a1;};var asr=require(_0x9829('0x0'));module[_0x9829('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 d430661..66e1bb8 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 _0x09c9=['path','request-promise','randomstring','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','end','protocol','https:','WHAT_EVER','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','generate','.mp3','from','base64','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','replace','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5'];(function(_0x3776b4,_0x19a1e3){var _0x1636d9=function(_0x320ae3){while(--_0x320ae3){_0x3776b4['push'](_0x3776b4['shift']());}};_0x1636d9(++_0x19a1e3);}(_0x09c9,0x81));var _0x909c=function(_0x56c414,_0x524ac6){_0x56c414=_0x56c414-0x0;var _0x103e21=_0x09c9[_0x56c414];return _0x103e21;};'use strict';var apiai=require(_0x909c('0x0'));var BPromise=require(_0x909c('0x1'));var dialogflow=require(_0x909c('0x2'));var fs=require('fs');var http=require(_0x909c('0x3'));var https=require(_0x909c('0x4'));var md5=require(_0x909c('0x5'));var path=require(_0x909c('0x6'));var querystring=require('querystring');var rp=require(_0x909c('0x7'));var rs=require(_0x909c('0x8'));var sox=require('sox');var tts=require(_0x909c('0x9'));var urlParse=require(_0x909c('0xa'))[_0x909c('0xb')];var util=require(_0x909c('0xc'));var aws=require('./aws');var google=require(_0x909c('0xd'));var sestek=require(_0x909c('0xe'));var tilde=require(_0x909c('0xf'));var logger=require(_0x909c('0x10'))(_0x909c('0x11'));var ISPEECH_API=_0x909c('0x12');function downloadFile(_0x6a8f48,_0x156618){return new BPromise(function(_0x353d24,_0x387f12){var _0x3024e6=urlParse(_0x6a8f48);var _0x41ce6d=_0x3024e6['protocol']==='https:'?https:http;var _0x2e19d8={'host':_0x3024e6[_0x909c('0x13')],'path':_0x3024e6[_0x909c('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x41ce6d[_0x909c('0x14')](_0x2e19d8,function(_0x28f03e){if(_0x28f03e['statusCode']!==0xc8){logger[_0x909c('0x15')](_0x909c('0x16')+_0x6a8f48+_0x909c('0x17')+_0x28f03e[_0x909c('0x18')]+'\x20('+_0x28f03e['statusMessage']+')');_0x387f12(new Error(_0x909c('0x16')+_0x6a8f48+_0x909c('0x17')+_0x28f03e[_0x909c('0x18')]+'\x20('+_0x28f03e[_0x909c('0x19')]+')'));return;}var _0x5347f4=fs[_0x909c('0x1a')](_0x156618);_0x5347f4['on']('finish',function(){logger[_0x909c('0x1b')](_0x909c('0x1c'));_0x5347f4[_0x909c('0x1d')](_0x353d24);});_0x5347f4['on'](_0x909c('0x15'),function(_0x3cc7ad){fs[_0x909c('0x1e')](_0x156618);logger[_0x909c('0x15')]('download\x20error',_0x3cc7ad);_0x387f12(_0x3cc7ad);});_0x28f03e['pipe'](_0x5347f4);})['on'](_0x909c('0x15'),function(_0x499f69){logger[_0x909c('0x15')](_0x499f69);_0x387f12(_0x499f69);})[_0x909c('0x1f')]();});}function uploadFile(_0x755656){return new BPromise(function(_0x2d165c,_0x221413){var _0x2821fd=urlParse(_0x755656);var _0x2f523c=_0x2821fd[_0x909c('0x20')]===_0x909c('0x21')?https:http;var _0x30b8d={'host':_0x2821fd[_0x909c('0x13')],'path':_0x2821fd[_0x909c('0x6')],'headers':{'user-agent':_0x909c('0x22')}};_0x2f523c[_0x909c('0x14')](_0x30b8d,function(_0xc051df){if(_0xc051df[_0x909c('0x18')]!==0xc8){_0x221413(new Error(_0x909c('0x16')+_0x755656+'\x20failed,\x20status\x20code\x20=\x20'+_0xc051df[_0x909c('0x18')]+'\x20('+_0xc051df[_0x909c('0x19')]+')'));return;}var _0x157a05='';_0xc051df['on'](_0x909c('0x23'),function(_0x4a0e0b){_0x157a05+=_0x4a0e0b;});_0xc051df['on'](_0x909c('0x1f'),function(){_0x2d165c(_0x157a05);});})['on']('error',function(_0x418822){_0x221413(_0x418822);})[_0x909c('0x1f')]();});}function convertFile(_0x35f82b,_0x359ca8){return new BPromise(function(_0x344374,_0x385aa0){var _0xdc9e37=sox['transcode'](_0x35f82b,_0x359ca8,{'sampleRate':0x1f40,'format':_0x909c('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xdc9e37['on'](_0x909c('0x15'),function(_0x5a1902){logger[_0x909c('0x15')](_0x909c('0x25'),_0x5a1902);_0x385aa0(_0x5a1902);});_0xdc9e37['on']('end',function(){logger[_0x909c('0x1b')](_0x909c('0x26'));_0x344374();});_0xdc9e37[_0x909c('0x27')]();});}function base64Decode(_0x43a721,_0x2c16a9){var _0x3d9a5c=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs['generate'](0x4)+_0x909c('0x2a'));fs[_0x909c('0x2b')](_0x3d9a5c,_0x43a721,'base64');return convertFile(_0x3d9a5c,_0x2c16a9)['then'](function(){try{fs[_0x909c('0x1e')](_0x3d9a5c);fs[_0x909c('0x2c')](_0x2c16a9,_0x909c('0x2d'));}catch(_0x578679){logger[_0x909c('0x15')](_0x578679);}return _0x2c16a9[_0x909c('0x2e')]('.')[0x0];});}function base64Encode(_0x5e1987){var _0x3b814b=fs[_0x909c('0x2f')](_0x5e1987);return new Buffer(_0x3b814b)[_0x909c('0x30')]('base64');}exports[_0x909c('0x31')]=function(_0x4615f3,_0x5f091c,_0x36dbd2,_0xa36464,_0x8b25cc,_0x3b9e11){var _0x4921da,_0x55bd62;var _0x5a993d=_0x909c('0x32');var _0x20eed4=_0x909c('0x33')+_0x4615f3;var _0x5f3561={};if(_0x5f091c===_0x909c('0x34')){_0x5f3561[_0x909c('0x35')]={'ssml':_0x36dbd2};}else{_0x5f3561[_0x909c('0x35')]={'text':_0x36dbd2};};_0x5f3561[_0x909c('0x36')]={'languageCode':_0xa36464,'ssmlGender':_0x8b25cc};_0x5f3561[_0x909c('0x37')]={'audioEncoding':_0x909c('0x38'),'sampleRateHertz':0x1f40};var _0x41bc68={'url':_0x5a993d+_0x909c('0x39')+_0x20eed4,'method':_0x909c('0x3a'),'json':!![],'body':_0x5f3561};return rp(_0x41bc68)[_0x909c('0x3b')](function(_0x2d225f){return new BPromise(function(_0x569f4c,_0x12eeb1){_0x4921da=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs[_0x909c('0x3c')](0x4)+_0x909c('0x3d'));var _0x4c0ff1=Buffer[_0x909c('0x3e')](_0x2d225f['audioContent'],_0x909c('0x3f'));return fs[_0x909c('0x40')](_0x4921da,_0x4c0ff1,function(_0x1722bf){_0x12eeb1(_0x1722bf);},function(_0x296676){fs[_0x909c('0x2c')](_0x4921da,_0x909c('0x2d'));_0x569f4c(_0x296676);});});})[_0x909c('0x3b')](function(_0x3f9b5d){_0x55bd62=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs[_0x909c('0x3c')](0x4)+_0x909c('0x2a'));return convertFile(_0x4921da,_0x55bd62);})[_0x909c('0x3b')](function(){try{fs['unlink'](_0x4921da);fs[_0x909c('0x2c')](_0x55bd62,_0x909c('0x2d'));}catch(_0x2cb06d){logger[_0x909c('0x15')](_0x2cb06d);}logger[_0x909c('0x1b')](_0x909c('0x41'),_0x55bd62[_0x909c('0x2e')]('.')[0x0]);return _0x55bd62[_0x909c('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x1e6923,_0x4f32d4){var _0x801333=_0x909c('0x42');var _0x1153df,_0x28cba2;var _0x450355;var _0x29d62e={'encoding':_0x909c('0x43'),'method':'POST','timeout':0x2710,'url':_0x801333,'headers':{'Content-Type':_0x909c('0x44')},'body':_0x909c('0x45')+encodeURIComponent(JSON[_0x909c('0x46')]([[[_0x909c('0x47'),JSON[_0x909c('0x46')]([_0x1e6923,_0x4f32d4||'en',![],_0x909c('0x48')]),null,_0x909c('0x49')]]]))};return rp(_0x29d62e)[_0x909c('0x3b')](function(_0x4f1e83){try{_0x450355=eval(_0x4f1e83[_0x909c('0x4a')](0x5))[0x0][0x2];}catch(_0x558e22){throw new Error(_0x909c('0x4b')+_0x4f1e83[_0x909c('0x23')]);}if(!_0x450355){if(_0x1e6923['length']>0xc8){throw new Error(_0x909c('0x4c'));}else{throw new Error('lang\x20\x22'+_0x4f32d4+_0x909c('0x4d'));}}try{_0x450355=eval(_0x450355)[0x0];}catch(_0x14a41d){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x909c('0x23')]);}const _0x45552c=_0x450355;_0x1153df=path['resolve'](__dirname,'tmp',rs[_0x909c('0x3c')](0x4)+_0x909c('0x3d'));fs[_0x909c('0x2b')](_0x1153df,_0x450355,{'encoding':_0x909c('0x3f')});_0x28cba2=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs[_0x909c('0x3c')](0x4)+_0x909c('0x2a'));return convertFile(_0x1153df,_0x28cba2);})[_0x909c('0x3b')](function(){try{fs['unlink'](_0x1153df);fs[_0x909c('0x2c')](_0x28cba2,'777');}catch(_0x3206c2){logger[_0x909c('0x15')](_0x3206c2);}logger[_0x909c('0x1b')](_0x909c('0x4e'),_0x28cba2[_0x909c('0x2e')]('.')[0x0]);return _0x28cba2[_0x909c('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x2e5e06,_0x4150dd,_0x323b04){return google[_0x909c('0x4f')](_0x2e5e06,_0x4150dd,_0x323b04)[_0x909c('0x3b')](function(_0x54f717){logger[_0x909c('0x1b')](_0x54f717['uri']);return rp(_0x54f717);})[_0x909c('0x3b')](function(_0x5b324e){var _0x4d58a8='';var _0x56d816=0x0;try{fs[_0x909c('0x1e')](_0x2e5e06);}catch(_0x42977c){logger['error'](_0x42977c);}if(_0x5b324e&&_0x5b324e[_0x909c('0x50')]){_0x4d58a8=_0x5b324e[_0x909c('0x50')][_0x909c('0x51')](function(_0x205937){return _0x205937&&_0x205937['alternatives'][0x0]&&_0x205937[_0x909c('0x52')][0x0][_0x909c('0x53')]?_0x205937[_0x909c('0x52')][0x0][_0x909c('0x53')]:'';})[_0x909c('0x54')]('\x0a');_0x56d816=_0x5b324e[_0x909c('0x50')][_0x909c('0x51')](function(_0x1cc04a){return _0x1cc04a&&_0x1cc04a[_0x909c('0x52')][0x0]&&_0x1cc04a[_0x909c('0x52')][0x0][_0x909c('0x55')]?_0x1cc04a[_0x909c('0x52')][0x0][_0x909c('0x55')]:0x0;})[_0x909c('0x54')]('\x0a');}logger[_0x909c('0x1b')]('googleASR\x20transcription',_0x4d58a8);logger[_0x909c('0x1b')]('googleASR\x20confidence',_0x56d816);return{'transcript':_0x4d58a8,'confidence':_0x56d816};})[_0x909c('0x56')](function(_0x4de129){logger[_0x909c('0x15')](_0x909c('0x57'),_0x4de129[_0x909c('0x18')],_0x4de129[_0x909c('0x58')],_0x4de129[_0x909c('0x59')]);});};exports[_0x909c('0x5a')]=function(_0x2723fe,_0x33b6a3,_0x51ff17,_0x2dfc50){var _0x2f08b9=apiai(_0x33b6a3,{'language':_0x2dfc50||'en'});return _0x2f08b9[_0x909c('0x5b')](_0x51ff17,{'sessionId':md5(_0x2723fe)})[_0x909c('0x3b')](function(_0x2aa3f0){logger['info'](JSON['stringify'](_0x2aa3f0));return{'source':_0x2aa3f0[_0x909c('0x5c')]['source'],'resolvedQuery':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x5d')],'action':_0x2aa3f0[_0x909c('0x5c')]['action'],'actionIncomplete':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x5e')],'speech':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x5f')][_0x909c('0x60')],'score':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x61')],'statusCode':_0x2aa3f0[_0x909c('0x62')][_0x909c('0x63')],'endConversation':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x64')][_0x909c('0x65')]||![],'isFallbackIntent':_0x2aa3f0[_0x909c('0x5c')][_0x909c('0x64')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0xa5cf22,_0x1d8bb0,_0x2f07a3,_0x19b044,_0x1f3595,_0xb3f432){var _0x5e4e4e=_0x19b044[_0x909c('0x66')](/\\n/g,'\x0a');var _0x1304b7={'credentials':{'private_key':_0x5e4e4e,'client_email':_0x2f07a3}};var _0x34fa04=new dialogflow['SessionsClient'](_0x1304b7);var _0x2c8fa3=_0x34fa04['sessionPath'](_0x1d8bb0,md5(_0xa5cf22));var _0x3c7c47={'session':_0x2c8fa3,'queryInput':{'text':{'text':_0x1f3595,'languageCode':_0xb3f432}}};return _0x34fa04[_0x909c('0x67')](_0x3c7c47)[_0x909c('0x3b')](function(_0x1fccea){if(_0x1fccea&&_0x1fccea[_0x909c('0x68')]){logger['info'](_0x909c('0x69'),JSON[_0x909c('0x46')](_0x1fccea));var _0xdaed42=_0x1fccea[0x0];if(_0xdaed42){var _0x4c7baf={'action':_0xdaed42[_0x909c('0x6a')][_0x909c('0x6b')],'allRequiredParamsPresent':_0xdaed42[_0x909c('0x6a')][_0x909c('0x6c')],'endConversation':_0xdaed42[_0x909c('0x6a')]['diagnosticInfo']&&_0xdaed42['queryResult'][_0x909c('0x6d')][_0x909c('0x6e')]?_0xdaed42['queryResult'][_0x909c('0x6d')][_0x909c('0x6e')][_0x909c('0x6f')][_0x909c('0x70')]:![],'fulfillmentText':_0xdaed42[_0x909c('0x6a')][_0x909c('0x71')],'intentName':_0xdaed42[_0x909c('0x6a')][_0x909c('0x72')][_0x909c('0x58')],'intentDisplayName':_0xdaed42[_0x909c('0x6a')][_0x909c('0x72')][_0x909c('0x73')],'isFallbackIntent':_0xdaed42[_0x909c('0x6a')][_0x909c('0x72')]['isFallback'],'languageCode':_0xdaed42[_0x909c('0x6a')][_0x909c('0x74')],'queryText':_0xdaed42[_0x909c('0x6a')][_0x909c('0x75')],'responseId':_0xdaed42[_0x909c('0x76')],'score':_0xdaed42['queryResult']['intentDetectionConfidence'],'speech':_0xdaed42[_0x909c('0x6a')][_0x909c('0x71')],'providerResponse':JSON['stringify'](_0x1fccea)};return _0x4c7baf;}}});};exports[_0x909c('0x77')]=function(_0x56c86d,_0x3c3531,_0x2988d,_0x2250aa){return tilde[_0x909c('0x4f')](_0x56c86d,_0x3c3531,_0x2988d,_0x2250aa)['then'](function(_0x55011a){try{fs['unlink'](_0x56c86d);}catch(_0x2b052d){logger['error'](_0x2b052d);}logger[_0x909c('0x1b')](_0x909c('0x78'),_0x55011a[_0x909c('0x53')]);logger[_0x909c('0x1b')]('Tilde\x20ASR\x20confidence',_0x55011a['confidence']);return _0x55011a;});};exports[_0x909c('0x79')]=function(_0x58dd08,_0x5ed601,_0x4249e5,_0x5d5af2,_0x3bdc76,_0x1f273b){var _0x537c5e=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs[_0x909c('0x3c')](0x4)+_0x909c('0x3d'));var _0x14bba3;return aws[_0x909c('0x7a')](_0x58dd08,_0x5ed601,_0x4249e5,_0x5d5af2,_0x3bdc76,_0x1f273b,_0x537c5e)[_0x909c('0x3b')](function(){_0x14bba3=path[_0x909c('0x28')](__dirname,'tmp',rs[_0x909c('0x3c')](0x4)+_0x909c('0x2a'));return convertFile(_0x537c5e,_0x14bba3);})[_0x909c('0x3b')](function(){try{fs['unlink'](_0x537c5e);fs['chmodSync'](_0x14bba3,'777');}catch(_0x2cbb4f){logger[_0x909c('0x15')](_0x2cbb4f);}return _0x14bba3[_0x909c('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x5bde10,_0x595cf5,_0x1d1314,_0x2314a4,_0x5c02d6,_0x515c72){return aws['lex'](_0x5bde10,_0x595cf5,_0x1d1314,_0x2314a4,_0x5c02d6,_0x515c72)[_0x909c('0x3b')](function(_0x1a6163){logger[_0x909c('0x1b')](JSON['stringify'](_0x1a6163));return _0x1a6163;});};exports['ispeechTTS']=function(_0x325920,_0xd64e99,_0x4c6dad,_0x4c8033){var _0x2c80ae=util[_0x909c('0x7b')](_0x909c('0x7c'),ISPEECH_API,_0x325920,encodeURIComponent(_0xd64e99),_0x4c6dad,_0x4c8033);var _0x56952c=path[_0x909c('0x28')](__dirname,_0x909c('0x29'),rs['generate'](0x4)+_0x909c('0x3d'));var _0x95c84a;return downloadFile(_0x2c80ae,_0x56952c)[_0x909c('0x3b')](function(){_0x95c84a=path['resolve'](__dirname,_0x909c('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x56952c,_0x95c84a);})[_0x909c('0x3b')](function(){try{fs['unlink'](_0x56952c);fs[_0x909c('0x2c')](_0x95c84a,_0x909c('0x2d'));}catch(_0x42768f){logger['error'](_0x42768f);}return _0x95c84a[_0x909c('0x2e')]('.')[0x0];});};exports[_0x909c('0x7d')]=function(_0x436f80,_0x530bd8,_0x1e94d5,_0x2ec690){var _0xa2cb44=util['format'](_0x909c('0x7e'),ISPEECH_API,_0x530bd8,_0x1e94d5,base64Encode(_0x436f80),_0x2ec690?util[_0x909c('0x7b')](_0x909c('0x7f'),encodeURIComponent(_0x2ec690)):'freeform=3');return uploadFile(_0xa2cb44)['then'](function(_0x50ba73){return querystring[_0x909c('0xb')](_0x50ba73);});};exports['sestekNDA']=function(_0x3521cd,_0x5aa902){return sestek[_0x909c('0x80')](_0x3521cd,_0x5aa902)[_0x909c('0x3b')](function(_0x339bf1){logger[_0x909c('0x1b')](JSON['stringify'](_0x339bf1));var _0x4176d9={'speech':_0x339bf1['text'],'action':_0x339bf1['channelData']?_0x339bf1[_0x909c('0x81')][_0x909c('0x82')]:undefined,'actiondata':_0x339bf1[_0x909c('0x81')]?_0x339bf1[_0x909c('0x81')][_0x909c('0x83')]:undefined};if(_0x339bf1['channelData']&&_0x339bf1[_0x909c('0x81')][_0x909c('0x84')]){return base64Decode(_0x339bf1[_0x909c('0x81')][_0x909c('0x84')][_0x909c('0x85')],path[_0x909c('0x28')](__dirname,'tmp',rs[_0x909c('0x3c')](0x4)+_0x909c('0x2a')))['then'](function(_0x1834c1){_0x4176d9[_0x909c('0x86')]=_0x1834c1;return _0x4176d9;});}return _0x4176d9;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xccb1=['languageCode','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','path','request-promise','randomstring','sox','url','parse','util','./aws','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','pipe','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','then','chmodSync','split','readFileSync','toString','base64','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','tmp','goggleTTS\x20path','googleASR','asr','uri','results','transcript','alternatives','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','fulfillment','speech','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xccb1,0x1ab));var _0x1ccb=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xccb1[_0x341e0f];return _0x59555a;};'use strict';var apiai=require(_0x1ccb('0x0'));var BPromise=require(_0x1ccb('0x1'));var dialogflow=require(_0x1ccb('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x1ccb('0x3'));var querystring=require('querystring');var rp=require(_0x1ccb('0x4'));var rs=require(_0x1ccb('0x5'));var sox=require(_0x1ccb('0x6'));var tts=require('google-tts-api');var urlParse=require(_0x1ccb('0x7'))[_0x1ccb('0x8')];var util=require(_0x1ccb('0x9'));var aws=require(_0x1ccb('0xa'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x1ccb('0xb'));var logger=require(_0x1ccb('0xc'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4e14fc,_0x2710c1){return new BPromise(function(_0x2cae42,_0x1791da){var _0x5b4717=urlParse(_0x4e14fc);var _0x338707=_0x5b4717[_0x1ccb('0xd')]===_0x1ccb('0xe')?https:http;var _0x5774ff={'host':_0x5b4717[_0x1ccb('0xf')],'path':_0x5b4717['path'],'headers':{'user-agent':_0x1ccb('0x10')}};_0x338707[_0x1ccb('0x11')](_0x5774ff,function(_0x264fd8){if(_0x264fd8[_0x1ccb('0x12')]!==0xc8){logger[_0x1ccb('0x13')](_0x1ccb('0x14')+_0x4e14fc+'\x20failed,\x20status\x20code\x20=\x20'+_0x264fd8[_0x1ccb('0x12')]+'\x20('+_0x264fd8[_0x1ccb('0x15')]+')');_0x1791da(new Error(_0x1ccb('0x14')+_0x4e14fc+_0x1ccb('0x16')+_0x264fd8['statusCode']+'\x20('+_0x264fd8[_0x1ccb('0x15')]+')'));return;}var _0xb7061=fs[_0x1ccb('0x17')](_0x2710c1);_0xb7061['on'](_0x1ccb('0x18'),function(){logger[_0x1ccb('0x19')](_0x1ccb('0x1a'));_0xb7061['close'](_0x2cae42);});_0xb7061['on'](_0x1ccb('0x13'),function(_0x698023){fs[_0x1ccb('0x1b')](_0x2710c1);logger[_0x1ccb('0x13')]('download\x20error',_0x698023);_0x1791da(_0x698023);});_0x264fd8[_0x1ccb('0x1c')](_0xb7061);})['on'](_0x1ccb('0x13'),function(_0x377967){logger[_0x1ccb('0x13')](_0x377967);_0x1791da(_0x377967);})['end']();});}function uploadFile(_0x59df1e){return new BPromise(function(_0xac96db,_0x1d3889){var _0x3ec16b=urlParse(_0x59df1e);var _0x2e1a10=_0x3ec16b[_0x1ccb('0xd')]==='https:'?https:http;var _0xcd53d1={'host':_0x3ec16b[_0x1ccb('0xf')],'path':_0x3ec16b[_0x1ccb('0x3')],'headers':{'user-agent':_0x1ccb('0x10')}};_0x2e1a10[_0x1ccb('0x11')](_0xcd53d1,function(_0x544cf0){if(_0x544cf0['statusCode']!==0xc8){_0x1d3889(new Error(_0x1ccb('0x14')+_0x59df1e+_0x1ccb('0x16')+_0x544cf0[_0x1ccb('0x12')]+'\x20('+_0x544cf0['statusMessage']+')'));return;}var _0xa7d9aa='';_0x544cf0['on'](_0x1ccb('0x1d'),function(_0x2dd095){_0xa7d9aa+=_0x2dd095;});_0x544cf0['on'](_0x1ccb('0x1e'),function(){_0xac96db(_0xa7d9aa);});})['on'](_0x1ccb('0x13'),function(_0x3137c5){_0x1d3889(_0x3137c5);})['end']();});}function convertFile(_0x49f0c2,_0x59308c){return new BPromise(function(_0x5aa23f,_0x2dc484){var _0x7db4d7=sox[_0x1ccb('0x1f')](_0x49f0c2,_0x59308c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7db4d7['on'](_0x1ccb('0x13'),function(_0x2b20ce){logger['error'](_0x1ccb('0x20'),_0x2b20ce);_0x2dc484(_0x2b20ce);});_0x7db4d7['on'](_0x1ccb('0x1e'),function(){logger[_0x1ccb('0x19')](_0x1ccb('0x21'));_0x5aa23f();});_0x7db4d7[_0x1ccb('0x22')]();});}function base64Decode(_0x24a984,_0x50d3fb){var _0x1a7202=path[_0x1ccb('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x1ccb('0x24'));fs[_0x1ccb('0x25')](_0x1a7202,_0x24a984,'base64');return convertFile(_0x1a7202,_0x50d3fb)[_0x1ccb('0x26')](function(){try{fs[_0x1ccb('0x1b')](_0x1a7202);fs[_0x1ccb('0x27')](_0x50d3fb,'777');}catch(_0xdfb1c1){logger['error'](_0xdfb1c1);}return _0x50d3fb[_0x1ccb('0x28')]('.')[0x0];});}function base64Encode(_0xbbe65a){var _0x4a7fe3=fs[_0x1ccb('0x29')](_0xbbe65a);return new Buffer(_0x4a7fe3)[_0x1ccb('0x2a')](_0x1ccb('0x2b'));}exports['googleCloudTTS']=function(_0x550f5d,_0x426321,_0x2c1170,_0x162b59,_0x174605,_0x16d429){var _0x37fdef,_0x255032;var _0x38842d='https://texttospeech.googleapis.com/v1/';var _0x384ae6=_0x1ccb('0x2c')+_0x550f5d;var _0x767ab7={};if(_0x426321==='ssml'){_0x767ab7[_0x1ccb('0x2d')]={'ssml':_0x2c1170};}else{_0x767ab7[_0x1ccb('0x2d')]={'text':_0x2c1170};};_0x767ab7[_0x1ccb('0x2e')]={'languageCode':_0x162b59,'ssmlGender':_0x174605};_0x767ab7[_0x1ccb('0x2f')]={'audioEncoding':_0x1ccb('0x30'),'sampleRateHertz':0x1f40};var _0x4989f9={'url':_0x38842d+_0x1ccb('0x31')+_0x384ae6,'method':_0x1ccb('0x32'),'json':!![],'body':_0x767ab7};return rp(_0x4989f9)[_0x1ccb('0x26')](function(_0x22f8e1){return new BPromise(function(_0x2e460b,_0x34e470){_0x37fdef=path[_0x1ccb('0x23')](__dirname,'tmp',rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x34'));var _0x5143a9=Buffer[_0x1ccb('0x35')](_0x22f8e1[_0x1ccb('0x36')],_0x1ccb('0x2b'));return fs['writeFile'](_0x37fdef,_0x5143a9,function(_0x1e3263){_0x34e470(_0x1e3263);},function(_0x24b14f){fs['chmodSync'](_0x37fdef,_0x1ccb('0x37'));_0x2e460b(_0x24b14f);});});})[_0x1ccb('0x26')](function(_0x3ab13d){_0x255032=path['resolve'](__dirname,'tmp',rs[_0x1ccb('0x33')](0x4)+'.wav');return convertFile(_0x37fdef,_0x255032);})[_0x1ccb('0x26')](function(){try{fs['unlink'](_0x37fdef);fs[_0x1ccb('0x27')](_0x255032,_0x1ccb('0x37'));}catch(_0x111228){logger[_0x1ccb('0x13')](_0x111228);}logger['info']('googleCloudTTS\x20path',_0x255032['split']('.')[0x0]);return _0x255032['split']('.')[0x0];});};exports[_0x1ccb('0x38')]=function(_0x154fa6,_0x214872){var _0x26c73d=_0x1ccb('0x39');var _0x7cbedc,_0xfe9bb9;var _0x95f11f;var _0x38f719={'encoding':_0x1ccb('0x3a'),'method':_0x1ccb('0x32'),'timeout':0x2710,'url':_0x26c73d,'headers':{'Content-Type':_0x1ccb('0x3b')},'body':'f.req='+encodeURIComponent(JSON[_0x1ccb('0x3c')]([[[_0x1ccb('0x3d'),JSON['stringify']([_0x154fa6,_0x214872||'en',![],_0x1ccb('0x3e')]),null,_0x1ccb('0x3f')]]]))};return rp(_0x38f719)['then'](function(_0x2b3aee){try{_0x95f11f=eval(_0x2b3aee['slice'](0x5))[0x0][0x2];}catch(_0x24f997){throw new Error(_0x1ccb('0x40')+_0x2b3aee[_0x1ccb('0x1d')]);}if(!_0x95f11f){if(_0x154fa6[_0x1ccb('0x41')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x1ccb('0x42')+_0x214872+_0x1ccb('0x43'));}}try{_0x95f11f=eval(_0x95f11f)[0x0];}catch(_0x2524c1){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x2cbc4f=_0x95f11f;_0x7cbedc=path[_0x1ccb('0x23')](__dirname,'tmp',rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x34'));fs[_0x1ccb('0x25')](_0x7cbedc,_0x95f11f,{'encoding':_0x1ccb('0x2b')});_0xfe9bb9=path[_0x1ccb('0x23')](__dirname,_0x1ccb('0x44'),rs['generate'](0x4)+'.wav');return convertFile(_0x7cbedc,_0xfe9bb9);})[_0x1ccb('0x26')](function(){try{fs[_0x1ccb('0x1b')](_0x7cbedc);fs['chmodSync'](_0xfe9bb9,_0x1ccb('0x37'));}catch(_0x585aa3){logger[_0x1ccb('0x13')](_0x585aa3);}logger['info'](_0x1ccb('0x45'),_0xfe9bb9['split']('.')[0x0]);return _0xfe9bb9['split']('.')[0x0];});};exports[_0x1ccb('0x46')]=function(_0x59243c,_0x333af1,_0x367297){return google[_0x1ccb('0x47')](_0x59243c,_0x333af1,_0x367297)['then'](function(_0x441f6a){logger['info'](_0x441f6a[_0x1ccb('0x48')]);return rp(_0x441f6a);})['then'](function(_0x24add9){var _0x579d9c='';var _0x224563=0x0;try{fs[_0x1ccb('0x1b')](_0x59243c);}catch(_0xac2202){logger[_0x1ccb('0x13')](_0xac2202);}if(_0x24add9&&_0x24add9[_0x1ccb('0x49')]){_0x579d9c=_0x24add9[_0x1ccb('0x49')]['map'](function(_0x137873){return _0x137873&&_0x137873['alternatives'][0x0]&&_0x137873['alternatives'][0x0][_0x1ccb('0x4a')]?_0x137873[_0x1ccb('0x4b')][0x0][_0x1ccb('0x4a')]:'';})[_0x1ccb('0x4c')]('\x0a');_0x224563=_0x24add9[_0x1ccb('0x49')][_0x1ccb('0x4d')](function(_0x19c2ec){return _0x19c2ec&&_0x19c2ec['alternatives'][0x0]&&_0x19c2ec[_0x1ccb('0x4b')][0x0][_0x1ccb('0x4e')]?_0x19c2ec['alternatives'][0x0][_0x1ccb('0x4e')]:0x0;})[_0x1ccb('0x4c')]('\x0a');}logger['info'](_0x1ccb('0x4f'),_0x579d9c);logger[_0x1ccb('0x19')]('googleASR\x20confidence',_0x224563);return{'transcript':_0x579d9c,'confidence':_0x224563};})[_0x1ccb('0x50')](function(_0x51667a){logger[_0x1ccb('0x13')](_0x1ccb('0x51'),_0x51667a[_0x1ccb('0x12')],_0x51667a[_0x1ccb('0x52')],_0x51667a[_0x1ccb('0x53')]);});};exports['googleDialogflow']=function(_0xc3f8c1,_0x30ba22,_0x2d98e0,_0x30b4f4){var _0xabfaef=apiai(_0x30ba22,{'language':_0x30b4f4||'en'});return _0xabfaef[_0x1ccb('0x54')](_0x2d98e0,{'sessionId':md5(_0xc3f8c1)})['then'](function(_0x2135c3){logger[_0x1ccb('0x19')](JSON['stringify'](_0x2135c3));return{'source':_0x2135c3[_0x1ccb('0x55')][_0x1ccb('0x56')],'resolvedQuery':_0x2135c3[_0x1ccb('0x55')][_0x1ccb('0x57')],'action':_0x2135c3[_0x1ccb('0x55')][_0x1ccb('0x58')],'actionIncomplete':_0x2135c3[_0x1ccb('0x55')]['actionIncomplete'],'speech':_0x2135c3['result'][_0x1ccb('0x59')][_0x1ccb('0x5a')],'score':_0x2135c3[_0x1ccb('0x55')]['score'],'statusCode':_0x2135c3[_0x1ccb('0x5b')][_0x1ccb('0x5c')],'endConversation':_0x2135c3[_0x1ccb('0x55')][_0x1ccb('0x5d')][_0x1ccb('0x5e')]||![],'isFallbackIntent':_0x2135c3[_0x1ccb('0x55')][_0x1ccb('0x5d')]['isFallbackIntent']};});};exports[_0x1ccb('0x5f')]=function(_0x5dec84,_0x19e6cc,_0x5aaa81,_0x7338b3,_0x1b6f9b,_0x13e7df){var _0x5cf0f3=_0x7338b3[_0x1ccb('0x60')](/\\n/g,'\x0a');var _0x4cbcdd={'credentials':{'private_key':_0x5cf0f3,'client_email':_0x5aaa81}};var _0x890752=new dialogflow[(_0x1ccb('0x61'))](_0x4cbcdd);var _0x597526=_0x890752[_0x1ccb('0x62')](_0x19e6cc,md5(_0x5dec84));var _0x1d755e={'session':_0x597526,'queryInput':{'text':{'text':_0x1b6f9b,'languageCode':_0x13e7df}}};return _0x890752[_0x1ccb('0x63')](_0x1d755e)[_0x1ccb('0x26')](function(_0x315bd2){if(_0x315bd2&&_0x315bd2[_0x1ccb('0x41')]){logger[_0x1ccb('0x19')](_0x1ccb('0x64'),JSON[_0x1ccb('0x3c')](_0x315bd2));var _0x4f4d5f=_0x315bd2[0x0];if(_0x4f4d5f){var _0x48f79c={'action':_0x4f4d5f['queryResult'][_0x1ccb('0x58')],'allRequiredParamsPresent':_0x4f4d5f['queryResult'][_0x1ccb('0x65')],'endConversation':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x67')]&&_0x4f4d5f['queryResult'][_0x1ccb('0x67')][_0x1ccb('0x68')]?_0x4f4d5f['queryResult'][_0x1ccb('0x67')][_0x1ccb('0x68')][_0x1ccb('0x69')][_0x1ccb('0x6a')]:![],'fulfillmentText':_0x4f4d5f[_0x1ccb('0x66')]['fulfillmentText'],'intentName':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x6b')][_0x1ccb('0x52')],'intentDisplayName':_0x4f4d5f['queryResult'][_0x1ccb('0x6b')][_0x1ccb('0x6c')],'isFallbackIntent':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x6b')]['isFallback'],'languageCode':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x6d')],'queryText':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x6e')],'responseId':_0x4f4d5f[_0x1ccb('0x6f')],'score':_0x4f4d5f[_0x1ccb('0x66')]['intentDetectionConfidence'],'speech':_0x4f4d5f[_0x1ccb('0x66')][_0x1ccb('0x70')],'providerResponse':JSON['stringify'](_0x315bd2)};return _0x48f79c;}}});};exports['tildeASR']=function(_0x4c7ff0,_0x2deb9c,_0x5dc523,_0xd4525f){return tilde['asr'](_0x4c7ff0,_0x2deb9c,_0x5dc523,_0xd4525f)['then'](function(_0x42629b){try{fs[_0x1ccb('0x1b')](_0x4c7ff0);}catch(_0x3ec5fa){logger[_0x1ccb('0x13')](_0x3ec5fa);}logger[_0x1ccb('0x19')](_0x1ccb('0x71'),_0x42629b[_0x1ccb('0x4a')]);logger['info'](_0x1ccb('0x72'),_0x42629b[_0x1ccb('0x4e')]);return _0x42629b;});};exports[_0x1ccb('0x73')]=function(_0x4d6318,_0x419250,_0xf46491,_0x5d316f,_0x18ea22,_0x129e3f){var _0x3cd2a6=path[_0x1ccb('0x23')](__dirname,_0x1ccb('0x44'),rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x34'));var _0x476483;return aws[_0x1ccb('0x74')](_0x4d6318,_0x419250,_0xf46491,_0x5d316f,_0x18ea22,_0x129e3f,_0x3cd2a6)[_0x1ccb('0x26')](function(){_0x476483=path[_0x1ccb('0x23')](__dirname,_0x1ccb('0x44'),rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x24'));return convertFile(_0x3cd2a6,_0x476483);})['then'](function(){try{fs[_0x1ccb('0x1b')](_0x3cd2a6);fs[_0x1ccb('0x27')](_0x476483,_0x1ccb('0x37'));}catch(_0x4db4ce){logger[_0x1ccb('0x13')](_0x4db4ce);}return _0x476483[_0x1ccb('0x28')]('.')[0x0];});};exports['awsLex']=function(_0x339bb9,_0x186844,_0x1ff4e4,_0x31ef83,_0x7e43b9,_0x458066){return aws[_0x1ccb('0x75')](_0x339bb9,_0x186844,_0x1ff4e4,_0x31ef83,_0x7e43b9,_0x458066)[_0x1ccb('0x26')](function(_0x3e15c2){logger[_0x1ccb('0x19')](JSON[_0x1ccb('0x3c')](_0x3e15c2));return _0x3e15c2;});};exports[_0x1ccb('0x76')]=function(_0x59e94c,_0x4a311e,_0x41c568,_0x31815a){var _0x4308cc=util[_0x1ccb('0x77')](_0x1ccb('0x78'),ISPEECH_API,_0x59e94c,encodeURIComponent(_0x4a311e),_0x41c568,_0x31815a);var _0x156777=path[_0x1ccb('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x57bbbd;return downloadFile(_0x4308cc,_0x156777)[_0x1ccb('0x26')](function(){_0x57bbbd=path[_0x1ccb('0x23')](__dirname,_0x1ccb('0x44'),rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x24'));return convertFile(_0x156777,_0x57bbbd);})['then'](function(){try{fs['unlink'](_0x156777);fs[_0x1ccb('0x27')](_0x57bbbd,_0x1ccb('0x37'));}catch(_0x1da592){logger[_0x1ccb('0x13')](_0x1da592);}return _0x57bbbd[_0x1ccb('0x28')]('.')[0x0];});};exports[_0x1ccb('0x79')]=function(_0x22fd76,_0x49cda7,_0x549861,_0x244747){var _0x2bcc12=util[_0x1ccb('0x77')](_0x1ccb('0x7a'),ISPEECH_API,_0x49cda7,_0x549861,base64Encode(_0x22fd76),_0x244747?util[_0x1ccb('0x77')](_0x1ccb('0x7b'),encodeURIComponent(_0x244747)):_0x1ccb('0x7c'));return uploadFile(_0x2bcc12)[_0x1ccb('0x26')](function(_0x5a4112){return querystring[_0x1ccb('0x8')](_0x5a4112);});};exports[_0x1ccb('0x7d')]=function(_0x9cb9e,_0x57fa59){return sestek[_0x1ccb('0x7e')](_0x9cb9e,_0x57fa59)[_0x1ccb('0x26')](function(_0x114f2a){logger[_0x1ccb('0x19')](JSON[_0x1ccb('0x3c')](_0x114f2a));var _0x39a525={'speech':_0x114f2a[_0x1ccb('0x7f')],'action':_0x114f2a['channelData']?_0x114f2a[_0x1ccb('0x80')][_0x1ccb('0x81')]:undefined,'actiondata':_0x114f2a[_0x1ccb('0x80')]?_0x114f2a['channelData'][_0x1ccb('0x82')]:undefined};if(_0x114f2a[_0x1ccb('0x80')]&&_0x114f2a[_0x1ccb('0x80')][_0x1ccb('0x83')]){return base64Decode(_0x114f2a['channelData'][_0x1ccb('0x83')]['Data'],path[_0x1ccb('0x23')](__dirname,_0x1ccb('0x44'),rs[_0x1ccb('0x33')](0x4)+_0x1ccb('0x24')))['then'](function(_0x369449){_0x39a525[_0x1ccb('0x84')]=_0x369449;return _0x39a525;});}return _0x39a525;});};exports[_0x1ccb('0x85')]=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 f767198..cfc4174 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 _0x31a7=['exports','./nda'];(function(_0x5ba974,_0x19791c){var _0x52a61f=function(_0x21a24f){while(--_0x21a24f){_0x5ba974['push'](_0x5ba974['shift']());}};_0x52a61f(++_0x19791c);}(_0x31a7,0x113));var _0x731a=function(_0xf6b1a,_0x2894c5){_0xf6b1a=_0xf6b1a-0x0;var _0x1f6ffb=_0x31a7[_0xf6b1a];return _0x1f6ffb;};var nda=require(_0x731a('0x0'));module[_0x731a('0x1')]={'nda':nda}; \ No newline at end of file +var _0x88cc=['exports'];(function(_0x28f351,_0x4db337){var _0x27ed9a=function(_0xd812da){while(--_0xd812da){_0x28f351['push'](_0x28f351['shift']());}};_0x27ed9a(++_0x4db337);}(_0x88cc,0x17c));var _0xc88c=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x88cc[_0x4b7d87];return _0x3b9f82;};var nda=require('./nda');module[_0xc88c('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index b7f0e4f..adcde4c 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 _0x0aaf=['body','CustomAction','custom_action','custom_action_data','CustomActionData','info','../../../../../config/logger','agi','exports','POST','resolve','/token','username','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','channelData','audio/wav'];(function(_0x2ecbc0,_0x26ee68){var _0x5c25db=function(_0x205101){while(--_0x205101){_0x2ecbc0['push'](_0x2ecbc0['shift']());}};_0x5c25db(++_0x26ee68);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0x0aaf[_0x3328b4];return _0x530143;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xf0aa('0x0'))(_0xf0aa('0x1'));module[_0xf0aa('0x2')]=function(_0x3402de,_0x5e7bdc){var _0x507aaa={'method':_0xf0aa('0x3'),'uri':url[_0xf0aa('0x4')](_0x5e7bdc['ndauth_url'],_0xf0aa('0x5')),'form':{'grant_type':'password','username':_0x5e7bdc[_0xf0aa('0x6')],'password':_0x5e7bdc['password']},'json':!![]};return rp(_0x507aaa)[_0xf0aa('0x7')](function(_0x244745){var _0x38bf88={'method':'POST','uri':url[_0xf0aa('0x4')](_0x5e7bdc[_0xf0aa('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5e7bdc[_0xf0aa('0x9')]||_0xf0aa('0xa'),'channelId':_0xf0aa('0xb'),'conversation':{'id':_0x3402de[_0xf0aa('0xc')]},'from':{'id':_0x3402de[_0xf0aa('0xd')],'name':_0x3402de[_0xf0aa('0xe')]},'recipient':{'id':_0x3402de[_0xf0aa('0xf')],'name':_0x3402de[_0xf0aa('0x10')]},'text':_0x5e7bdc[_0xf0aa('0x11')],'channelData':{}},'headers':{'Authorization':_0xf0aa('0x12')+_0x244745[_0xf0aa('0x13')]},'json':!![]};if(_0x5e7bdc[_0xf0aa('0x14')]){_0x38bf88['body']['channelData'][_0xf0aa('0x15')]=_0x5e7bdc[_0xf0aa('0x14')];}if(_0x5e7bdc['ndagenerate_audio']=='1'){_0x38bf88['body'][_0xf0aa('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf0aa('0x17')};}if(_0x5e7bdc['custom_action']){_0x38bf88[_0xf0aa('0x18')]['channelData'][_0xf0aa('0x19')]=_0x5e7bdc[_0xf0aa('0x1a')];if(_0x5e7bdc[_0xf0aa('0x1b')]){_0x38bf88[_0xf0aa('0x18')][_0xf0aa('0x16')][_0xf0aa('0x1c')]=_0x5e7bdc[_0xf0aa('0x1b')];}}logger[_0xf0aa('0x1d')](JSON['stringify'](_0x38bf88));return rp(_0x38bf88);});}; \ No newline at end of file +var _0xa446=['Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','resolve','ndauth_url','/token','password','username','POST','ndassistant_url','ndaactivity_type','message'];(function(_0xa334ba,_0x2ae17a){var _0x3f8dad=function(_0x5a4a59){while(--_0x5a4a59){_0xa334ba['push'](_0xa334ba['shift']());}};_0x3f8dad(++_0x2ae17a);}(_0xa446,0xc6));var _0x6a44=function(_0x42ba70,_0x4948a8){_0x42ba70=_0x42ba70-0x0;var _0x1ffd03=_0xa446[_0x42ba70];return _0x1ffd03;};'use strict';var rp=require(_0x6a44('0x0'));var url=require(_0x6a44('0x1'));var logger=require('../../../../../config/logger')(_0x6a44('0x2'));module['exports']=function(_0x45c6e2,_0x4c400a){var _0x12bf16={'method':'POST','uri':url[_0x6a44('0x3')](_0x4c400a[_0x6a44('0x4')],_0x6a44('0x5')),'form':{'grant_type':_0x6a44('0x6'),'username':_0x4c400a[_0x6a44('0x7')],'password':_0x4c400a[_0x6a44('0x6')]},'json':!![]};return rp(_0x12bf16)['then'](function(_0x1569ec){var _0x36a426={'method':_0x6a44('0x8'),'uri':url[_0x6a44('0x3')](_0x4c400a[_0x6a44('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4c400a[_0x6a44('0xa')]||_0x6a44('0xb'),'channelId':_0x6a44('0xc'),'conversation':{'id':_0x45c6e2[_0x6a44('0xd')]},'from':{'id':_0x45c6e2[_0x6a44('0xe')],'name':_0x45c6e2[_0x6a44('0xf')]},'recipient':{'id':_0x45c6e2[_0x6a44('0x10')],'name':_0x45c6e2['extension']},'text':_0x4c400a[_0x6a44('0x11')],'channelData':{}},'headers':{'Authorization':_0x6a44('0x12')+_0x1569ec['access_token']},'json':!![]};if(_0x4c400a[_0x6a44('0x13')]){_0x36a426[_0x6a44('0x14')][_0x6a44('0x15')]['ProjectName']=_0x4c400a[_0x6a44('0x13')];}if(_0x4c400a[_0x6a44('0x16')]=='1'){_0x36a426[_0x6a44('0x14')][_0x6a44('0x15')][_0x6a44('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6a44('0x18')};}if(_0x4c400a['custom_action']){_0x36a426['body'][_0x6a44('0x15')][_0x6a44('0x19')]=_0x4c400a['custom_action'];if(_0x4c400a[_0x6a44('0x1a')]){_0x36a426[_0x6a44('0x14')][_0x6a44('0x15')][_0x6a44('0x1b')]=_0x4c400a[_0x6a44('0x1a')];}}logger[_0x6a44('0x1c')](JSON[_0x6a44('0x1d')](_0x36a426));return rp(_0x36a426);});}; \ 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 cb93638..c701d0f 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 _0x2d53=['./lib/api'];(function(_0x116df5,_0x3ada0e){var _0x2f71e6=function(_0x367e16){while(--_0x367e16){_0x116df5['push'](_0x116df5['shift']());}};_0x2f71e6(++_0x3ada0e);}(_0x2d53,0xaa));var _0x32d5=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0x2d53[_0x1fd675];return _0x521d1c;};'use strict';var asr=require(_0x32d5('0x0'));module['exports']=function(_0x3c33bd,_0x163e50,_0x144c51,_0xc8c57b){return asr(_0x3c33bd,_0x163e50,_0x144c51,_0xc8c57b);}; \ No newline at end of file +var _0xe185=['./lib/api','exports'];(function(_0x40a04f,_0x241755){var _0x4a8865=function(_0x333d69){while(--_0x333d69){_0x40a04f['push'](_0x40a04f['shift']());}};_0x4a8865(++_0x241755);}(_0xe185,0x120));var _0x5e18=function(_0x1b1bc9,_0x16c5a1){_0x1b1bc9=_0x1b1bc9-0x0;var _0x150fd1=_0xe185[_0x1b1bc9];return _0x150fd1;};'use strict';var asr=require(_0x5e18('0x0'));module[_0x5e18('0x1')]=function(_0x276e36,_0x414b7a,_0xaef11c,_0x551d41){return asr(_0x276e36,_0x414b7a,_0xaef11c,_0x551d41);}; \ 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 5fb1573..579d27b 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 _0x472e=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate'];(function(_0x250093,_0x288a2f){var _0x2a4f56=function(_0xc8200f){while(--_0xc8200f){_0x250093['push'](_0x250093['shift']());}};_0x2a4f56(++_0x288a2f);}(_0x472e,0xa6));var _0xe472=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x472e[_0x1526e1];return _0x249a1e;};'use strict';var BPromise=require(_0xe472('0x0'));var _=require(_0xe472('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe472('0x2'));var crypto=require('crypto');var logger=require(_0xe472('0x3'))('agi');module[_0xe472('0x4')]=function(_0x549c3e,_0x358e3e,_0x56246d,_0x4cc1e1){return new BPromise(function(_0x15f8d4,_0x23b262){logger['info'](_0xe472('0x5'),_0x4cc1e1||_0xe472('0x6'));var _0x28a93a=new WebSocket(_0x4cc1e1||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x41c456='';var _0x49cb73='0';var _0x387c0d='1';var _0x523801=_0xe472('0x7');function _0x5f5d45(_0x1b25e2){var _0x308949=crypto[_0xe472('0x8')]('sha1');_0x308949[_0xe472('0x9')](_0x1b25e2);return _0x308949[_0xe472('0xa')](_0xe472('0xb'));}function _0x1299c9(){try{logger['info'](_0xe472('0xc'));var _0x55b25e=moment()['unix']();var _0x243b9a=_0x5f5d45(_0x55b25e+_0x358e3e+_0x56246d);_0x28a93a[_0xe472('0xd')](JSON[_0xe472('0xe')]({'appID':_0x358e3e,'timestamp':_0x55b25e,'appKey':_0x243b9a}));var _0x52bdb7=fs[_0xe472('0xf')](_0x549c3e);_0x52bdb7['on']('data',function(_0x272f02){_0x28a93a[_0xe472('0xd')](_0x272f02);});_0x52bdb7['on'](_0xe472('0x10'),function(){_0x28a93a[_0xe472('0xd')](_0xe472('0x11'));});}catch(_0x39053a){logger[_0xe472('0x12')](_0xe472('0x13'),JSON[_0xe472('0xe')](_0x39053a));_0x28a93a['terminate']();}}function _0xcff8a4(_0x1f7bfb){try{if(_0x1f7bfb){var _0x213ef1=JSON['parse'](_0x1f7bfb);switch(_0x213ef1[_0xe472('0x14')]){case 0x0:if(_0x213ef1['result']){if(_0x213ef1[_0xe472('0x15')][_0xe472('0x16')]){logger[_0xe472('0x17')](_0xe472('0x18'),JSON[_0xe472('0xe')](_0x213ef1[_0xe472('0x15')]['hypotheses']));_0x41c456=_0x213ef1['result'][_0xe472('0x19')][0x0][_0xe472('0x1a')];_0x49cb73=_0x213ef1[_0xe472('0x15')]['hypotheses'][0x0]['likelihood'];_0x387c0d='0';_0x523801=_0xe472('0x1b');_0x28a93a[_0xe472('0x1c')]();}}break;case 0x1:logger[_0xe472('0x17')](_0xe472('0x7'));_0x387c0d='1';_0x523801='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x387c0d='2';_0x523801=_0xe472('0x1d');break;case 0x9:logger[_0xe472('0x17')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x387c0d='9';_0x523801=_0xe472('0x1e');break;case 0xa:logger[_0xe472('0x17')](_0xe472('0x1f'));_0x387c0d='10';_0x523801=_0xe472('0x1f');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x387c0d='11';_0x523801=_0xe472('0x20');}}}catch(_0x4c57fb){logger[_0xe472('0x12')](_0xe472('0x21'),JSON['stringify'](_0x4c57fb));_0x28a93a[_0xe472('0x1c')]();}}function _0x9f799(){logger[_0xe472('0x17')]('Close\x20Tilde\x20ASR\x20socket');_0x15f8d4({'transcript':_0x41c456,'confidence':_0x49cb73,'status':_0x387c0d,'status_message':_0x523801});}function _0xa26284(_0x263037){logger[_0xe472('0x12')](_0xe472('0x22'));if(!_[_0xe472('0x23')](_0x263037)){logger[_0xe472('0x12')](_[_0xe472('0x24')](_0x263037)?JSON[_0xe472('0xe')](_0x263037):_0x263037);}}_0x28a93a['on'](_0xe472('0x25'),_0x1299c9);_0x28a93a['on'](_0xe472('0x26'),_0xcff8a4);_0x28a93a['on']('close',_0x9f799);_0x28a93a['on']('error',_0xa26284);});}; \ No newline at end of file +var _0x5e81=['send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isNil','open','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','sha1','update','digest'];(function(_0x52b1c4,_0x4eef81){var _0x1a1461=function(_0x4226cd){while(--_0x4226cd){_0x52b1c4['push'](_0x52b1c4['shift']());}};_0x1a1461(++_0x4eef81);}(_0x5e81,0x12a));var _0x15e8=function(_0x4005e8,_0x52a3b5){_0x4005e8=_0x4005e8-0x0;var _0x2d2903=_0x5e81[_0x4005e8];return _0x2d2903;};'use strict';var BPromise=require(_0x15e8('0x0'));var _=require(_0x15e8('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x15e8('0x2'));var crypto=require(_0x15e8('0x3'));var logger=require(_0x15e8('0x4'))(_0x15e8('0x5'));module[_0x15e8('0x6')]=function(_0xca398e,_0x54ace0,_0x376f75,_0x68f60d){return new BPromise(function(_0x431f49,_0x15cefa){logger[_0x15e8('0x7')](_0x15e8('0x8'),_0x68f60d||_0x15e8('0x9'));var _0x2ed89b=new WebSocket(_0x68f60d||_0x15e8('0x9'),{'perMessageDeflate':![]});var _0x2370ba='';var _0x1f9a5c='0';var _0x624dcb='1';var _0x3bda74=_0x15e8('0xa');function _0x546764(_0x21b32d){var _0x5879b6=crypto['createHash'](_0x15e8('0xb'));_0x5879b6[_0x15e8('0xc')](_0x21b32d);return _0x5879b6[_0x15e8('0xd')]('hex');}function _0x1ca62e(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x4b394f=moment()['unix']();var _0x324e60=_0x546764(_0x4b394f+_0x54ace0+_0x376f75);_0x2ed89b[_0x15e8('0xe')](JSON['stringify']({'appID':_0x54ace0,'timestamp':_0x4b394f,'appKey':_0x324e60}));var _0x438e90=fs[_0x15e8('0xf')](_0xca398e);_0x438e90['on'](_0x15e8('0x10'),function(_0x16d677){_0x2ed89b['send'](_0x16d677);});_0x438e90['on'](_0x15e8('0x11'),function(){_0x2ed89b['send'](_0x15e8('0x12'));});}catch(_0x3e800f){logger[_0x15e8('0x13')](_0x15e8('0x14'),JSON[_0x15e8('0x15')](_0x3e800f));_0x2ed89b[_0x15e8('0x16')]();}}function _0x4dcc10(_0x59700b){try{if(_0x59700b){var _0x23dc73=JSON[_0x15e8('0x17')](_0x59700b);switch(_0x23dc73[_0x15e8('0x18')]){case 0x0:if(_0x23dc73[_0x15e8('0x19')]){if(_0x23dc73[_0x15e8('0x19')][_0x15e8('0x1a')]){logger[_0x15e8('0x7')](_0x15e8('0x1b'),JSON['stringify'](_0x23dc73['result'][_0x15e8('0x1c')]));_0x2370ba=_0x23dc73[_0x15e8('0x19')][_0x15e8('0x1c')][0x0]['transcript'];_0x1f9a5c=_0x23dc73[_0x15e8('0x19')]['hypotheses'][0x0][_0x15e8('0x1d')];_0x624dcb='0';_0x3bda74=_0x15e8('0x1e');_0x2ed89b[_0x15e8('0x16')]();}}break;case 0x1:logger['info'](_0x15e8('0xa'));_0x624dcb='1';_0x3bda74=_0x15e8('0xa');break;case 0x2:logger[_0x15e8('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x624dcb='2';_0x3bda74=_0x15e8('0x1f');break;case 0x9:logger[_0x15e8('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x624dcb='9';_0x3bda74=_0x15e8('0x20');break;case 0xa:logger[_0x15e8('0x7')]('Authentication\x20failed.');_0x624dcb='10';_0x3bda74=_0x15e8('0x21');break;case 0xb:logger[_0x15e8('0x7')](_0x15e8('0x22'));_0x624dcb='11';_0x3bda74=_0x15e8('0x22');}}}catch(_0x2cd7bb){logger[_0x15e8('0x13')](_0x15e8('0x23'),JSON[_0x15e8('0x15')](_0x2cd7bb));_0x2ed89b[_0x15e8('0x16')]();}}function _0x4cbafa(){logger[_0x15e8('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x431f49({'transcript':_0x2370ba,'confidence':_0x1f9a5c,'status':_0x624dcb,'status_message':_0x3bda74});}function _0x23ec9a(_0x30be08){logger[_0x15e8('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x15e8('0x24')](_0x30be08)){logger[_0x15e8('0x13')](_['isObject'](_0x30be08)?JSON['stringify'](_0x30be08):_0x30be08);}}_0x2ed89b['on'](_0x15e8('0x25'),_0x1ca62e);_0x2ed89b['on'](_0x15e8('0x26'),_0x4dcc10);_0x2ed89b['on']('close',_0x4cbafa);_0x2ed89b['on'](_0x15e8('0x13'),_0x23ec9a);});}; \ 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 aba738b..121121d 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 _0x97e5=['./asr','exports'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x97e5,0x1a4));var _0x597e=function(_0x38eac2,_0x22bb9e){_0x38eac2=_0x38eac2-0x0;var _0x10b76f=_0x97e5[_0x38eac2];return _0x10b76f;};var asr=require(_0x597e('0x0'));module[_0x597e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1734=['exports','./asr'];(function(_0x36839a,_0x41bc4a){var _0xf7dc8a=function(_0x1e66a6){while(--_0x1e66a6){_0x36839a['push'](_0x36839a['shift']());}};_0xf7dc8a(++_0x41bc4a);}(_0x1734,0x19f));var _0x4173=function(_0x285a9c,_0x35009b){_0x285a9c=_0x285a9c-0x0;var _0x43b02e=_0x1734[_0x285a9c];return _0x43b02e;};var asr=require(_0x4173('0x0'));module[_0x4173('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e221050..638ae27 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 _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(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 +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(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 072733a..ab95704 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 _0x66fa=['toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','body','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','clone','isString','includes','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','noop','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','sync','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','hasOwnProperty','DIALOGFLOW_%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','phone','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','variable_id','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','no\x20variable\x20selected','join','exports','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunkById','getSound','getSoundPath','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agentUnpause','agent','callerid','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT'];(function(_0x177bc0,_0x2dc066){var _0xe3b5c=function(_0x3fbd03){while(--_0x3fbd03){_0x177bc0['push'](_0x177bc0['shift']());}};_0xe3b5c(++_0x2dc066);}(_0x66fa,0x168));var _0xa66f=function(_0x3b274a,_0x6318fa){_0x3b274a=_0x3b274a-0x0;var _0x2197a6=_0x66fa[_0x3b274a];return _0x2197a6;};'use strict';var fs=require('fs');var util=require(_0xa66f('0x0'));var _=require(_0xa66f('0x1'));var sh=require(_0xa66f('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xa66f('0x3'));var Mustache=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var scripts=require(_0xa66f('0x9'));var FILES_PATH=_0xa66f('0xa');var recursiveMapAttributes=[_0xa66f('0xb'),_0xa66f('0xc')];var verticesWithRetry=[_0xa66f('0xd'),'getdigits',_0xa66f('0xe')];var AGIVertices=function(_0x5ec156,_0x183448,_0x246781){this['channel']=_0x5ec156;this[_0xa66f('0xf')]=_0x183448;this[_0xa66f('0x10')]=_0x246781;};AGIVertices[_0xa66f('0x11')][_0xa66f('0x12')]=function(_0x234c43,_0x42f064){this['rpc']['getVariableById'](_0x234c43)[_0xa66f('0x13')](function(_0x59f8f8){_0x42f064(null,_0x59f8f8?_0x59f8f8[_0xa66f('0x14')]:![]);})[_0xa66f('0x15')](function(_0x1162c0){_0x42f064(_0x1162c0);});};AGIVertices['prototype'][_0xa66f('0x16')]=function(_0x1a1ab2,_0x4ad224){this[_0xa66f('0xf')][_0xa66f('0x17')](_0x1a1ab2)[_0xa66f('0x13')](function(_0x96a262){_0x4ad224(null,_0x96a262?_0x96a262['name']:![]);})[_0xa66f('0x15')](function(_0x27f04e){_0x4ad224(_0x27f04e);});};AGIVertices['prototype'][_0xa66f('0x18')]=function(_0x33270b,_0xc68431){this[_0xa66f('0xf')][_0xa66f('0x19')](_0x33270b)[_0xa66f('0x13')](function(_0x58f239){_0xc68431(null,_0x58f239?_0x58f239['name']:![]);})[_0xa66f('0x15')](function(_0x16648b){_0xc68431(_0x16648b);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1a')]=function(_0x5d04a1,_0x1e448e){this[_0xa66f('0xf')]['getSquareOdbcById'](_0x5d04a1)[_0xa66f('0x13')](function(_0x4b4099){_0x1e448e(null,_0x4b4099?_0x4b4099[_0xa66f('0x1b')]:![]);})[_0xa66f('0x15')](function(_0x4a92dd){_0x1e448e(_0x4a92dd);});};AGIVertices['prototype'][_0xa66f('0x1c')]=function(_0x5e6856,_0x5b2cf0){this['rpc']['getUserById'](_0x5e6856)[_0xa66f('0x13')](function(_0x15910d){_0x5b2cf0(null,_0x15910d?_0x15910d[_0xa66f('0x14')]:![]);})['catch'](function(_0x20bf81){_0x5b2cf0(_0x20bf81);});};AGIVertices[_0xa66f('0x11')]['getTrunk']=function(_0x27fdba,_0x473b00){this[_0xa66f('0xf')][_0xa66f('0x1d')](_0x27fdba)[_0xa66f('0x13')](function(_0x13aec8){_0x473b00(null,_0x13aec8?_0x13aec8['name']:![]);})['catch'](function(_0x272f1e){_0x473b00(_0x272f1e);});};AGIVertices['prototype'][_0xa66f('0x1e')]=function(_0x278531,_0x2cf4c9){var _0x49e1b3=this;this[_0xa66f('0xf')]['getSoundById'](_0x278531)['then'](function(_0x4c7b82){_0x2cf4c9(null,_0x4c7b82?_0x49e1b3[_0xa66f('0x1f')](_0x4c7b82['save_name']):![]);})[_0xa66f('0x15')](function(_0x7d07a4){_0x2cf4c9(_0x7d07a4);});};AGIVertices[_0xa66f('0x11')]['getMailAccount']=function(_0x59ba61,_0x3ad042){this[_0xa66f('0xf')][_0xa66f('0x20')](_0x59ba61)['then'](function(_0x46c525){_0x3ad042(null,_0x46c525?_0x46c525:![]);})['catch'](function(_0x6be926){_0x3ad042(_0x6be926);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x21')]=function(_0x36525b,_0x2a1e6b,_0x265b50){this['mailRpc'][_0xa66f('0x21')](_0x36525b,_0x2a1e6b)[_0xa66f('0x13')](function(){_0x265b50(null);})['catch'](function(_0x1d37c2){_0x265b50(_0x1d37c2);});};AGIVertices[_0xa66f('0x11')]['getIntervals']=function(_0x49e47c,_0x2fb3d8){this[_0xa66f('0xf')][_0xa66f('0x22')](_0x49e47c)[_0xa66f('0x13')](function(_0x351656){if(_0x351656){if(_0x351656[_0xa66f('0x23')]){_0x2fb3d8(null,[_0x351656['interval']]);}else{_0x2fb3d8(null,_[_0xa66f('0x24')](_0x351656[_0xa66f('0x25')],_0xa66f('0x26')));}}else{_0x2fb3d8(null,![]);}})[_0xa66f('0x15')](function(_0x4e1eea){_0x2fb3d8(_0x4e1eea);});};AGIVertices['prototype'][_0xa66f('0x1f')]=function(_0x5ef649){return util[_0xa66f('0x27')](_0xa66f('0x28'),FILES_PATH,_0x5ef649);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x29')]=function(_0x1361c8,_0x28caf6,_0x343cdc){odbc[_0xa66f('0x2a')](_0x1361c8,function(_0x126aa3){if(_0x126aa3){logger[_0xa66f('0x2b')](_0xa66f('0x2c'),_0x126aa3);_0x343cdc(_0x126aa3);}else{logger[_0xa66f('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0xa66f('0x2e')](_0x28caf6,function(_0x276622,_0x4d3e55){if(_0x276622){logger[_0xa66f('0x2d')]('Error\x20executing\x20query\x20%s',_0x28caf6);_0x343cdc(_0x276622);}else{logger[_0xa66f('0x2d')](_0xa66f('0x2f'),_0x28caf6);odbc[_0xa66f('0x30')](function(_0x2c185b){if(_0x2c185b){logger['error'](_0xa66f('0x31'),_0x2c185b);}_0x343cdc(null,_0x4d3e55);});}});}});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x32')]=function(_0x34a742,_0x5a778f){this[_0xa66f('0xf')]['getSmsAccountById'](_0x34a742)[_0xa66f('0x13')](function(_0xe4601d){_0x5a778f(null,_0xe4601d?_0xe4601d:![]);})[_0xa66f('0x15')](function(_0x2dca82){_0x5a778f(_0x2dca82);});};AGIVertices['prototype'][_0xa66f('0x33')]=function(_0x4d3a9d,_0x835156){this[_0xa66f('0xf')][_0xa66f('0x33')](_0x4d3a9d)[_0xa66f('0x13')](function(_0x331ad8){_0x835156(null,_0x331ad8);})[_0xa66f('0x15')](function(_0xe88e56){_0x835156(_0xe88e56);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x34')]=function(_0x3ed4a0,_0x324818,_0x132afa){this[_0xa66f('0xf')][_0xa66f('0x34')]({'uniqueid':this[_0xa66f('0x35')]['uniqueid'],'node':_0x3ed4a0[_0xa66f('0x36')],'application':_0x3ed4a0[_0xa66f('0x37')],'data':_0x324818||null,'project_name':this[_0xa66f('0x35')]['arg_1'],'callerid':this[_0xa66f('0x35')]['callerid']})[_0xa66f('0x13')](function(_0x1141a1){if(_0x132afa){_0x132afa(null,_0x1141a1);}})[_0xa66f('0x15')](function(_0x4fc452){if(_0x132afa){_0x132afa(_0x4fc452);}});};AGIVertices['prototype'][_0xa66f('0x38')]=function(_0x54ae9d,_0x3e5778,_0x4562a1,_0x3c26f5){this[_0xa66f('0xf')]['createSquareRecording']({'uniqueid':this[_0xa66f('0x35')][_0xa66f('0x39')],'callerid':this['channel']['callerid'],'calleridname':this[_0xa66f('0x35')][_0xa66f('0x3a')],'context':this[_0xa66f('0x35')][_0xa66f('0x3b')],'extension':this[_0xa66f('0x35')]['extension'],'priority':this[_0xa66f('0x35')][_0xa66f('0x3c')],'accountcode':this[_0xa66f('0x35')][_0xa66f('0x3d')],'dnid':this[_0xa66f('0x35')]['dnid'],'projectName':this[_0xa66f('0x35')][_0xa66f('0x3e')],'saveName':_0x3e5778,'filename':_0x54ae9d[_0xa66f('0x3f')]||_0x3e5778,'savePath':_0x4562a1})[_0xa66f('0x13')](function(_0x35108c){_0x3c26f5(null,_0x35108c);})['catch'](function(_0x596d69){_0x3c26f5(_0x596d69);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x40')]=function(_0x35d81f,_0x312f1a,_0x40cf7e,_0x349872,_0x3a1efc){this[_0xa66f('0xf')]['createSquareMessage']({'uniqueid':this[_0xa66f('0x35')][_0xa66f('0x39')],'body':_0x35d81f,'direction':_0x312f1a,'providerName':_0x40cf7e,'providerResponse':_0x349872})[_0xa66f('0x13')](function(_0x6038f3){if(_0x3a1efc){_0x3a1efc(null,_0x6038f3);}})[_0xa66f('0x15')](function(_0x55e402){if(_0x3a1efc){_0x3a1efc(_0x55e402);}});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x41')]=function(_0xc195b1,_0x5db07e){this['rpc'][_0xa66f('0x41')]({'firstName':_[_0xa66f('0x42')](_0xc195b1[_0xa66f('0x14')])||_[_0xa66f('0x43')](_0xc195b1[_0xa66f('0x14')])?'callback_'+Math[_0xa66f('0x44')]():_0xc195b1['name'],'lastName':_[_0xa66f('0x42')](_0xc195b1[_0xa66f('0x45')])||_[_0xa66f('0x43')](_0xc195b1['lastName'])?null:_0xc195b1[_0xa66f('0x45')],'phone':_0xc195b1['phone'],'ListId':_0xc195b1[_0xa66f('0x46')],'scheduledat':_0xc195b1[_0xa66f('0x47')],'callbackUniqueid':this[_0xa66f('0x35')][_0xa66f('0x39')],'tags':_0xa66f('0x48'),'description':_0xa66f('0x49')+_0xc195b1[_0xa66f('0x47')]['toString'](),'priority':_0xc195b1['callback_priority']})['then'](function(_0x1a057b){_0x5db07e(null,_0x1a057b);})[_0xa66f('0x15')](function(_0x45efb3){_0x5db07e(_0x45efb3);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x4a')]=function(_0x2c8ede,_0x210b18){this['rpc'][_0xa66f('0x4b')](_0x2c8ede)['then'](function(_0x34130a){_0x210b18(null,_0x34130a?_0x34130a[_0xa66f('0x14')]:![]);})['catch'](function(_0x405b48){_0x210b18(_0x405b48);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x4c')]=function(_0x585bca,_0x4dbefc,_0x5ac6fc){var _0xf804dc={'role':'agent'};_0xf804dc[_0x585bca]=this[_0xa66f('0x35')]['callerid'];this[_0xa66f('0xf')][_0xa66f('0x4c')](_0xf804dc,_0x4dbefc,this['channel']['uniqueid'])['then'](function(_0x28e782){_0x5ac6fc(null,_[_0xa66f('0x43')](_0x28e782)?![]:!![]);})[_0xa66f('0x15')](function(_0x1ebc02){logger[_0xa66f('0x2b')](_0x1ebc02);_0x5ac6fc(null,![]);});};AGIVertices['prototype'][_0xa66f('0x4d')]=function(_0x386fc6,_0x51d039){var _0x4ec127={'role':_0xa66f('0x4e')};_0x4ec127[_0x386fc6]=this[_0xa66f('0x35')][_0xa66f('0x4f')];this[_0xa66f('0xf')][_0xa66f('0x4d')](_0x4ec127)[_0xa66f('0x13')](function(_0x3028f3){_0x51d039(null,_[_0xa66f('0x43')](_0x3028f3)?![]:!![]);})[_0xa66f('0x15')](function(_0x1aa2e0){logger[_0xa66f('0x2b')](_0x1aa2e0);_0x51d039(null,![]);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x50')]=function(_0x547ce1,_0x107635){var _0x55399a={'role':_0xa66f('0x4e')};_0x55399a[_0x547ce1]=this[_0xa66f('0x35')][_0xa66f('0x4f')];this[_0xa66f('0xf')][_0xa66f('0x50')](_0x55399a)[_0xa66f('0x13')](function(_0x39eede){_0x107635(null,_[_0xa66f('0x43')](_0x39eede)?![]:!![]);})[_0xa66f('0x15')](function(_0xd4767e){logger[_0xa66f('0x2b')](_0xd4767e);_0x107635(null,![]);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x51')]=function(_0x1d97bf,_0x5cd489){var _0x3850e8={'role':_0xa66f('0x4e')};_0x3850e8[_0x1d97bf]=this[_0xa66f('0x35')][_0xa66f('0x4f')];var _0x5e5d1c=_0x1d97bf!=_0xa66f('0x52')?util[_0xa66f('0x27')]('%s/%s@from-sip/n','LOCAL',this[_0xa66f('0x35')][_0xa66f('0x4f')]):undefined;this[_0xa66f('0xf')][_0xa66f('0x51')](_0x3850e8,_0x5e5d1c)['then'](function(_0x20aa55){_0x5cd489(null,_[_0xa66f('0x43')](_0x20aa55)?![]:!![]);})[_0xa66f('0x15')](function(_0x116f0c){logger[_0xa66f('0x2b')](_0x116f0c);_0x5cd489(null,![]);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x53')]=function(_0x3c1f45,_0x269d48){sh[_0xa66f('0x54')](_[_0xa66f('0x55')](_0x3c1f45),function(_0x4f6c48,_0x8d9be8){var _0x4b0f2b=_0x8d9be8[_0xa66f('0x56')](/(\r\n|\n|\r)/gm,'');_0x269d48(null,_0x4b0f2b);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x57')]=function(_0x190cce,_0x278cd5){scripts[_0xa66f('0x57')](_0x190cce[_0xa66f('0x58')],_0x190cce['google_cloud_tts_text_type']||_0xa66f('0x59'),_0x190cce[_0xa66f('0x59')],_0x190cce['languageCode']||'en-US',_0x190cce[_0xa66f('0x5a')]||_0xa66f('0x5b'),_0x190cce[_0xa66f('0x5c')]||_0xa66f('0x5d'))['then'](function(_0x370448){_0x278cd5(null,_0x370448);})[_0xa66f('0x15')](function(_0x17f631){_0x278cd5(_0x17f631);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x5e')]=function(_0x197d4a,_0x2b43e0){scripts['googleTTS'](_0x197d4a[_0xa66f('0x59')],_0x197d4a[_0xa66f('0x5f')]||'en',0x1)[_0xa66f('0x13')](function(_0x4964db){_0x2b43e0(null,_0x4964db);})[_0xa66f('0x15')](function(_0x46242c){_0x2b43e0(_0x46242c);});};AGIVertices['prototype'][_0xa66f('0x60')]=function(_0xe0f0bd,_0x5693ed){var _0x742a7b={'uri':_0xe0f0bd[_0xa66f('0x61')],'method':_0xe0f0bd[_0xa66f('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xe0f0bd[_0xa66f('0x63')])===_0xa66f('0x64')&&parseInt(_0xe0f0bd[_0xa66f('0x63')])>=0x1?parseInt(_0xe0f0bd['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xa66f('0x65'),_0xa66f('0x66')],_0x742a7b[_0xa66f('0x62')][_0xa66f('0x67')]())){try{_0x742a7b['body']=_0xe0f0bd[_0xa66f('0xc')]?JSON[_0xa66f('0x68')](_0xe0f0bd['rawBody']):{};}catch(_0xca5065){logger[_0xa66f('0x2b')](_0xa66f('0x69'),_0xca5065);}}try{_0x742a7b['headers']=_0xe0f0bd[_0xa66f('0xb')]?JSON[_0xa66f('0x68')](_0xe0f0bd[_0xa66f('0xb')]):{};}catch(_0x494599){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x494599);}if(_0xe0f0bd[_0xa66f('0x6a')]){try{var _0xf696fb=require(_0xe0f0bd[_0xa66f('0x6a')])['sync'](this,_0x742a7b);_0x742a7b['uri']=Mustache[_0xa66f('0x6b')](_0xe0f0bd[_0xa66f('0x61')],_0xf696fb,{},['$$','$$']);if(_0x742a7b[_0xa66f('0x6c')]){_0x742a7b[_0xa66f('0x6c')]=JSON[_0xa66f('0x68')](Mustache[_0xa66f('0x6b')](JSON['stringify'](_0x742a7b[_0xa66f('0x6c')]),_0xf696fb,{},['$$','$$']));}if(_0x742a7b['body']){_0x742a7b[_0xa66f('0x6d')]=JSON[_0xa66f('0x68')](Mustache[_0xa66f('0x6b')](JSON[_0xa66f('0x6e')](_0x742a7b[_0xa66f('0x6d')]),_0xf696fb,{},['$$','$$']));}}catch(_0x14f78c){logger[_0xa66f('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x14f78c);}}rp(_0x742a7b)[_0xa66f('0x13')](function(_0x5efc27){var _0x39b0df={'statusCode':_0x5efc27[_0xa66f('0x6f')]||0xc8,'statusMessage':_0x5efc27[_0xa66f('0x70')]||'OK','headers':_0x5efc27[_0xa66f('0x6c')]||{},'body':_0x5efc27[_0xa66f('0x6d')]||{}};_0x5693ed(null,_0x39b0df);})[_0xa66f('0x15')](function(_0x16b100){var _0x2c648f={'statusCode':_0x16b100['statusCode']||0x1f4,'statusMessage':_0x16b100[_0xa66f('0x71')]||_0xa66f('0x72'),'headers':_0x16b100[_0xa66f('0x73')][_0xa66f('0x6c')]||{},'body':_0x16b100['options'][_0xa66f('0x6d')]||{}};_0x5693ed(null,_0x2c648f);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x74')]=function(_0x26c796,_0x14ed70){scripts[_0xa66f('0x74')](this[_0xa66f('0x35')]['uniqueid'],_0x26c796[_0xa66f('0x75')],_0x26c796[_0xa66f('0x59')],_0x26c796['dialogflow_language']||'en')[_0xa66f('0x13')](function(_0x1d035c){_0x14ed70(null,_0x1d035c);})['catch'](function(_0x4dea2f){_0x14ed70(_0x4dea2f);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x76')]=function(_0x2f1e3d,_0x56a75f){scripts['googleDialogflowV2'](this[_0xa66f('0x35')][_0xa66f('0x39')],_0x2f1e3d[_0xa66f('0x77')],_0x2f1e3d[_0xa66f('0x78')],_0x2f1e3d[_0xa66f('0x79')],_0x2f1e3d['text'],_0x2f1e3d[_0xa66f('0x7a')]||'en')[_0xa66f('0x13')](function(_0x113f54){_0x56a75f(null,_0x113f54);})[_0xa66f('0x15')](function(_0x5e29ce){_0x56a75f(_0x5e29ce);});};AGIVertices['prototype'][_0xa66f('0x7b')]=function(_0x6d62fe,_0x39a830){scripts['sestekNDA'](this['channel'],_0x6d62fe)[_0xa66f('0x13')](function(_0x1b4625){_0x39a830(null,_0x1b4625);})[_0xa66f('0x15')](function(_0x1f89f5){_0x39a830(_0x1f89f5);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x7c')]=function(_0x15b3fd,_0x418b6f){scripts[_0xa66f('0x7c')](_0x15b3fd[_0xa66f('0x75')],_0x15b3fd[_0xa66f('0x59')],_0x15b3fd[_0xa66f('0x7d')]||_0xa66f('0x7e'),_0x15b3fd[_0xa66f('0x7f')])['then'](function(_0x156320){_0x418b6f(null,_0x156320);})['catch'](function(_0x30e89e){_0x418b6f(_0x30e89e);});};AGIVertices['prototype'][_0xa66f('0x80')]=function(_0x1fd1fa,_0x4eb32b,_0x5362fe){scripts[_0xa66f('0x80')](_0x4eb32b,_0x1fd1fa[_0xa66f('0x75')],_0x1fd1fa[_0xa66f('0x81')]||_0xa66f('0x7e'),this[_0xa66f('0x82')](_0x1fd1fa['model'])?_0x1fd1fa[_0xa66f('0x83')]:undefined)['then'](function(_0x45a8ff){_0x5362fe(null,_0x45a8ff);})[_0xa66f('0x15')](function(_0x29c8e4){_0x5362fe(_0x29c8e4);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x84')]=function(_0x414dba,_0x17affe){scripts['awsPolly'](_0x414dba[_0xa66f('0x85')],_0x414dba[_0xa66f('0x86')],_0x414dba[_0xa66f('0x87')],_0x414dba[_0xa66f('0x88')]||'Amy',_0x414dba[_0xa66f('0x59')],_0x414dba[_0xa66f('0x89')]||'text')['then'](function(_0x6478de){_0x17affe(null,_0x6478de);})[_0xa66f('0x15')](function(_0x386c00){_0x17affe(_0x386c00);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x8a')]=function(_0x4e1956,_0x56c60c){scripts['awsLex'](this[_0xa66f('0x35')][_0xa66f('0x39')],_0x4e1956[_0xa66f('0x85')],_0x4e1956['aws_secret_access_key'],_0x4e1956[_0xa66f('0x8b')],_0x4e1956['text'],_0x4e1956['aws_bot_name'])[_0xa66f('0x13')](function(_0x567d5f){_0x56c60c(null,_0x567d5f);})[_0xa66f('0x15')](function(_0x450921){_0x56c60c(_0x450921);});};AGIVertices[_0xa66f('0x11')][_0xa66f('0x8c')]=function(_0x55886a,_0x200935,_0xb87b8c){scripts[_0xa66f('0x8c')](_0x200935,_0x55886a[_0xa66f('0x75')],_0x55886a[_0xa66f('0x8d')]||_0xa66f('0x7e'))[_0xa66f('0x13')](function(_0x16c906){_0xb87b8c(null,_0x16c906);})[_0xa66f('0x15')](function(_0x104976){_0xb87b8c(_0x104976);});};AGIVertices[_0xa66f('0x11')]['tildeASR']=function(_0xa00f9f,_0x2986be,_0x4ace46){scripts[_0xa66f('0x8e')](_0x2986be,_0xa00f9f['appid'],_0xa00f9f[_0xa66f('0x8f')],_0xa00f9f[_0xa66f('0x90')])[_0xa66f('0x13')](function(_0x5a3ccc){_0x4ace46(null,_0x5a3ccc);})[_0xa66f('0x15')](function(_0x215172){_0x4ace46(_0x215172);});};AGIVertices['prototype'][_0xa66f('0x91')]=function(_0x49497a){var _0x410f4b=_['includes'](verticesWithRetry,_0x49497a[_0xa66f('0x37')])?_0x49497a:_[_0xa66f('0x92')](_0x49497a);for(var _0x289e3e in _0x410f4b){if(_0x410f4b['hasOwnProperty'](_0x289e3e)){if(_0x410f4b[_0x289e3e]&&_[_0xa66f('0x93')](_0x410f4b[_0x289e3e])){if(_[_0xa66f('0x94')](recursiveMapAttributes,_0x289e3e)){_0x410f4b[_0x289e3e]=this['replaceObjectAllVariables'](_0x410f4b[_0x289e3e]);}else{_0x410f4b[_0x289e3e]=this['replaceAllVariables'](_0x410f4b[_0x289e3e]);}}}}return _0x410f4b;};AGIVertices[_0xa66f('0x11')][_0xa66f('0x95')]=function(_0x257f53){for(var _0x359618 in _0x257f53){if(_0x257f53['hasOwnProperty'](_0x359618)){if(_[_0xa66f('0x96')](_0x257f53[_0x359618])){this[_0xa66f('0x95')](_0x257f53[_0x359618]);}else if(_[_0xa66f('0x97')](_0x257f53[_0x359618])){for(var _0x3e4b47=0x0;_0x3e4b47<_0x257f53[_0x359618][_0xa66f('0x98')];_0x3e4b47++){this[_0xa66f('0x95')](_0x257f53[_0x359618][_0x3e4b47]);}}else if(_[_0xa66f('0x93')](_0x257f53[_0x359618])){_0x257f53[_0x359618]=this[_0xa66f('0x99')](_0x257f53[_0x359618]);}}}};AGIVertices[_0xa66f('0x11')]['saveRestApiResult']=function(_0x4e7af4,_0x2b1cd5){for(var _0x34bfa4 in _0x4e7af4){if(_0x4e7af4['hasOwnProperty'](_0x34bfa4)){if(_['isPlainObject'](_0x4e7af4[_0x34bfa4])){if(!_[_0xa66f('0x42')](_0x4e7af4[_0x34bfa4])){this[_0xa66f('0x9a')](_0x4e7af4[_0x34bfa4],util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x2b1cd5,_0x34bfa4));}}else if(_[_0xa66f('0x97')](_0x4e7af4[_0x34bfa4])){for(var _0x193042=0x0;_0x193042<_0x4e7af4[_0x34bfa4][_0xa66f('0x98')];_0x193042++){this[_0xa66f('0x9a')](_0x4e7af4[_0x34bfa4][_0x193042],util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x2b1cd5,_0x34bfa4+'['+_0x193042+']'));}}else{if(!_['isNil'](_0x4e7af4[_0x34bfa4])){this['channel'][_0xa66f('0x9c')](util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x2b1cd5,_0x34bfa4),_0x4e7af4[_0x34bfa4]);}}}}};AGIVertices[_0xa66f('0x11')][_0xa66f('0x9d')]=function(_0x1856ef){try{var _0x5afa36=JSON[_0xa66f('0x68')](_0x1856ef);this[_0xa66f('0x95')](_0x5afa36);return JSON[_0xa66f('0x6e')](_0x5afa36);}catch(_0x4c08ea){return this['replaceAllVariables'](_0x1856ef);}};AGIVertices[_0xa66f('0x11')][_0xa66f('0x99')]=function(_0x32a6f7){var _0x32c519=_0x32a6f7[_0xa66f('0x9e')]('{');for(var _0x2e8eda=0x1;_0x2e8eda<_0x32c519[_0xa66f('0x98')];_0x2e8eda+=0x1){var _0x2beb4a=_0x32c519[_0x2e8eda]['split']('}');if(_0x2beb4a['length']>0x1){_0x32a6f7=_0x32a6f7['replaceAll']('{'+_0x2beb4a[0x0]+'}',this['channel'][_0xa66f('0x12')](_0x2beb4a[0x0])[_0xa66f('0x9f')]||_0x2beb4a[0x0]);}}if(_0x32c519[_0xa66f('0x98')]===0x1){return _0x32a6f7[_0xa66f('0xa0')]();}return this[_0xa66f('0x99')](_0x32a6f7);};AGIVertices[_0xa66f('0x11')]['getAndSetVariable']=function(_0x455ce1,_0x1325a3){var _0x2c7caa=this['channel']['getVariable'](_0x455ce1);if(_0x2c7caa[_0xa66f('0xa1')]===-0x1){return _0x2c7caa;}logger[_0xa66f('0x2d')](util['format'](_0xa66f('0xa2'),_0x1325a3,_0x2c7caa[_0xa66f('0x9f')]));return this[_0xa66f('0x35')][_0xa66f('0x9c')](_0x1325a3,_0x2c7caa['extra']);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x82')]=function(_0x431889){return _0x431889&&_0x431889!=='0'&&_0x431889!=='-1'&&_0x431889!=='';};AGIVertices[_0xa66f('0x11')][_0xa66f('0xa3')]=function(_0x43b8f9){this[_0xa66f('0x34')]['sync'](this,_0x43b8f9,'-');_0x43b8f9[_0xa66f('0xa4')]=_0x43b8f9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa66f('0x11')]['mrcpsynth']=function(_0x26ecaa){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0xa5'),_0x26ecaa['label']));if(!this[_0xa66f('0x82')](_0x26ecaa[_0xa66f('0x59')])){return this[_0xa66f('0x35')]['noop'](_0xa66f('0xa6'));}var _0x4220eb='\x22'+_0x26ecaa[_0xa66f('0x59')]+'\x22';if(this[_0xa66f('0x82')](_0x26ecaa[_0xa66f('0x73')])){_0x4220eb+=','+_0x26ecaa[_0xa66f('0x73')];}var _0x53c598=this[_0xa66f('0x35')][_0xa66f('0x54')]('MRCPSynth',_0x4220eb);if(_0x53c598['result']===-0x1){return _0x53c598;}return this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4220eb));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xa8')]=function(_0x123167){logger['info'](util[_0xa66f('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x123167['label']));if(!this['isConfigured'](_0x123167[_0xa66f('0xa9')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xaa'));}var _0x5142cf=_0x123167['grammar'];if(this[_0xa66f('0x82')](_0x123167['options'])){_0x5142cf+=','+_0x123167['options'];}var _0x46ea85=this['channel']['exec'](_0xa66f('0xab'),_0x5142cf);if(_0x46ea85[_0xa66f('0xa1')]===-0x1){return _0x46ea85;}var _0x30676b=this[_0xa66f('0xac')](_0xa66f('0xad'),_0xa66f('0xae'));if(_0x30676b[_0xa66f('0xa1')]===-0x1){return _0x30676b;}var _0x2d8768=this['getAndSetVariable'](_0xa66f('0xaf'),_0xa66f('0xb0'));if(_0x2d8768[_0xa66f('0xa1')]===-0x1){return _0x2d8768;}var _0x5428e7=this[_0xa66f('0xac')](_0xa66f('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x5428e7[_0xa66f('0xa1')]===-0x1){return _0x5428e7;}return this[_0xa66f('0x35')]['noop'](util['format'](_0xa66f('0xb2'),_0x5142cf));};AGIVertices['prototype'][_0xa66f('0x7')]=function(_0x2cd4b3){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xb3'),_0x2cd4b3[_0xa66f('0x36')]));return this['channel'][_0xa66f('0x7')]([_0x2cd4b3['command'],_0x2cd4b3['args']]);};AGIVertices[_0xa66f('0x11')][_0xa66f('0xb4')]=function(_0x465146){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0xb5'),_0x465146[_0xa66f('0x36')]));if(this[_0xa66f('0x82')](_0x465146['timeout'])){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xb6'),_0x465146['timeout']));var _0x558633=this[_0xa66f('0x35')][_0xa66f('0xb7')](_0x465146[_0xa66f('0x63')]);if(_0x558633[_0xa66f('0xa1')]===-0x1){return _0x558633;}}return this['channel'][_0xa66f('0xb4')]();};AGIVertices[_0xa66f('0x11')]['callback']=function(_0x1efb4e){logger['info'](util[_0xa66f('0x27')](_0xa66f('0xb8'),_0x1efb4e['label']));if(!this[_0xa66f('0x82')](_0x1efb4e['list_id'])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x1efb4e,_0xa66f('0xb9'));}_0x1efb4e[_0xa66f('0x47')]=moment();if(this[_0xa66f('0x82')](_0x1efb4e['delay'])){_0x1efb4e[_0xa66f('0x47')]=moment()[_0xa66f('0xba')](_0x1efb4e[_0xa66f('0xbb')],'minutes');}if(!this[_0xa66f('0x82')](_0x1efb4e['callback_priority'])){_0x1efb4e[_0xa66f('0xbc')]=0x2;}this[_0xa66f('0x41')]['sync'](this,_0x1efb4e);return this['channel']['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1efb4e['phone'],_0x1efb4e[_0xa66f('0x46')],_0x1efb4e[_0xa66f('0x47')]));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xbd')]=function(_0x210e21){logger['info'](util[_0xa66f('0x27')](_0xa66f('0xbe'),_0x210e21[_0xa66f('0x36')]));var _0x4f9037=this['channel']['exec'](_0x210e21[_0xa66f('0xbf')],_0x210e21[_0xa66f('0x73')]);if(_0x4f9037['result']===-0x1){return _0x4f9037;}return this[_0xa66f('0x35')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x210e21[_0xa66f('0xbf')],_0x210e21[_0xa66f('0x73')]));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xc0')]=function(_0x4c9c1a){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xc1'),_0x4c9c1a[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x4c9c1a['text'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xa6'));}var _0x489838='\x22'+_0x4c9c1a[_0xa66f('0x59')]+'\x22';if(this[_0xa66f('0x82')](_0x4c9c1a[_0xa66f('0x73')])){_0x489838+=','+_0x4c9c1a[_0xa66f('0x73')];}var _0x2e7787=this[_0xa66f('0x35')]['exec'](_0xa66f('0xc2'),_0x489838);if(_0x2e7787[_0xa66f('0xa1')]===-0x1){return _0x2e7787;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0xc3'),_0x489838));};AGIVertices['prototype'][_0xa66f('0xc4')]=function(_0x7ea2e5){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0xc5'),_0x7ea2e5[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x7ea2e5[_0xa66f('0x59')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')]('no\x20text\x20configured');}var _0xc9d5f4='\x22'+_0x7ea2e5[_0xa66f('0x59')]+'\x22';if(this['isConfigured'](_0x7ea2e5[_0xa66f('0x73')])){_0xc9d5f4+=','+_0x7ea2e5[_0xa66f('0x73')];}var _0x756905=this['channel']['exec'](_0xa66f('0xc2'),_0xc9d5f4);if(_0x756905['result']===-0x1){return _0x756905;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0xc9d5f4));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xc6')]=function(_0x3a27fb){logger['info'](util[_0xa66f('0x27')](_0xa66f('0xc7'),_0x3a27fb[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x3a27fb[_0xa66f('0xa9')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')]('no\x20grammar\x20configured');}var _0x262551=_0x3a27fb[_0xa66f('0xa9')];if(this[_0xa66f('0x82')](_0x3a27fb[_0xa66f('0x73')])){_0x262551+=','+_0x3a27fb[_0xa66f('0x73')];}var _0x2a09fd=this['channel'][_0xa66f('0x54')]('MRCPRecog',_0x262551);if(_0x2a09fd['result']===-0x1){return _0x2a09fd;}var _0x59176c=this['getAndSetVariable'](_0xa66f('0xad'),_0xa66f('0xc8'));if(_0x59176c['result']===-0x1){return _0x59176c;}var _0x406fa7=this[_0xa66f('0xac')](_0xa66f('0xaf'),_0xa66f('0xc9'));if(_0x406fa7[_0xa66f('0xa1')]===-0x1){return _0x406fa7;}var _0xb8e60f=this['getAndSetVariable'](_0xa66f('0xb1'),_0xa66f('0xca'));if(_0xb8e60f['result']===-0x1){return _0xb8e60f;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x262551));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xcb')]=function(_0x227c01){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x227c01['label']));if(!this[_0xa66f('0x82')](_0x227c01['grammar'])){return this['channel'][_0xa66f('0xa7')](_0xa66f('0xaa'));}var _0x32ab83=_0x227c01[_0xa66f('0xa9')];if(this[_0xa66f('0x82')](_0x227c01[_0xa66f('0x73')])){_0x32ab83+=','+_0x227c01[_0xa66f('0x73')];}var _0x26b44d=this[_0xa66f('0x35')]['exec'](_0xa66f('0xab'),_0x32ab83);if(_0x26b44d[_0xa66f('0xa1')]===-0x1){return _0x26b44d;}var _0x67558a=this['getAndSetVariable'](_0xa66f('0xad'),_0xa66f('0xcc'));if(_0x67558a['result']===-0x1){return _0x67558a;}var _0x416024=this[_0xa66f('0xac')](_0xa66f('0xaf'),_0xa66f('0xcd'));if(_0x416024[_0xa66f('0xa1')]===-0x1){return _0x416024;}var _0x39df77=this[_0xa66f('0xac')]('RECOG_INSTANCE()',_0xa66f('0xce'));if(_0x39df77[_0xa66f('0xa1')]===-0x1){return _0x39df77;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0xb2'),_0x32ab83));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xcf')]=function(_0x2bf90f){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xd0'),_0x2bf90f[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x2bf90f[_0xa66f('0xd1')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x2bf90f,_0xa66f('0xd2'));}var _0x3765ae=this['getSquareOdbc'][_0xa66f('0xd3')](this,_0x2bf90f[_0xa66f('0xd1')]);if(!_0x3765ae){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x2bf90f,_0xa66f('0xd4'));}if(!this[_0xa66f('0x82')](_0x2bf90f[_0xa66f('0x2e')])){return this['channel'][_0xa66f('0x2b')](_0x2bf90f,_0xa66f('0xd5'));}var _0x52ec28=_0x2bf90f['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0xd6'),_0x52ec28));var _0x269ec2=this[_0xa66f('0x29')][_0xa66f('0xd3')](this,_0x3765ae,_0x52ec28);this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x2bf90f,_0x52ec28);if(!this[_0xa66f('0x82')](_0x2bf90f['variable_id'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xd7'));}var _0x2ace7b=this['getVariable'][_0xa66f('0xd3')](this,_0x2bf90f['variable_id']);if(!_0x2ace7b){return this[_0xa66f('0x35')]['error'](_0x2bf90f,_0xa66f('0xd8'));}var _0x394afa=this;_0x269ec2[_0xa66f('0xd9')](function(_0xbb18dc,_0x3c2c3e){Object[_0xa66f('0xda')](_0xbb18dc)[_0xa66f('0xd9')](function(_0x206c53){_0x394afa['channel'][_0xa66f('0x9c')](util['format'](_0xa66f('0xdb'),_0x2ace7b,_0x3c2c3e,_0x206c53),_0xbb18dc[_0x206c53]);});});this[_0xa66f('0x35')][_0xa66f('0x9c')](util[_0xa66f('0x27')]('%s_ROWS_COUNT',_0x2ace7b),_0x269ec2['length']);return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0xdc'),_0x2ace7b));};AGIVertices['prototype'][_0xa66f('0xdd')]=function(_0x55b6ac){logger[_0xa66f('0xde')](util[_0xa66f('0x27')](_0xa66f('0xdf'),_0x55b6ac[_0xa66f('0x36')]));if(!this['isConfigured'](_0x55b6ac['sip_id'])){return this[_0xa66f('0x35')]['error'](_0x55b6ac,_0xa66f('0xe0'));}var _0x2e1a75=this[_0xa66f('0x1c')][_0xa66f('0xd3')](this,_0x55b6ac['sip_id']);if(!_0x2e1a75){return this[_0xa66f('0x35')]['error'](_0x55b6ac,_0xa66f('0xe1'));}var _0x780136=this[_0xa66f('0x35')]['exec']('DIAL',[util[_0xa66f('0x27')](_0xa66f('0xe2'),_0x2e1a75),_0x55b6ac['timeout'],_0x55b6ac[_0xa66f('0xe3')],_0x55b6ac['url']]);if(_0x780136[_0xa66f('0xa1')]===-0x1){return _0x780136;}return this['channel'][_0xa66f('0xa7')](util['format']('Executed\x20command\x20%s',_0xa66f('0xe4')));};AGIVertices[_0xa66f('0x11')]['dialogflow']=function(_0x308741){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xe5'),_0x308741[_0xa66f('0x36')]));if(!this['isConfigured'](_0x308741['key'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xe6'));}if(!this[_0xa66f('0x82')](_0x308741[_0xa66f('0x59')])){return this[_0xa66f('0x35')]['noop'](_0xa66f('0xa6'));}this['channel'][_0xa66f('0xe7')]=!![];this[_0xa66f('0x34')](_0x308741);this[_0xa66f('0x40')](_0x308741[_0xa66f('0x59')],'in','','');this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Trying\x20Dialogflow:\x20%s',_0x308741[_0xa66f('0x59')]));var _0x5ae15d=this[_0xa66f('0x74')]['sync'](this,_0x308741);if(_0x5ae15d){for(var _0x2a1cbd in _0x5ae15d){if(_0x5ae15d[_0xa66f('0xe8')](_0x2a1cbd)){this[_0xa66f('0x35')][_0xa66f('0x9c')](util[_0xa66f('0x27')](_0xa66f('0xe9'),_0x2a1cbd[_0xa66f('0x67')]()),_0x5ae15d[_0x2a1cbd]);}}this[_0xa66f('0x40')](_0x5ae15d['speech'],'out','dialogflow','');return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Dialogflow\x20Result\x20%s',_0x5ae15d['speech']));}return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x308741,_0xa66f('0xea'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xeb')]=function(_0x5a3929){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xec'),_0x5a3929['label']));if(!this[_0xa66f('0x82')](_0x5a3929[_0xa66f('0x77')])){return this['channel']['noop'](_0xa66f('0xed'));}if(!this['isConfigured'](_0x5a3929[_0xa66f('0x78')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')]('no\x20client_email\x20configured');}if(!this[_0xa66f('0x82')](_0x5a3929[_0xa66f('0x79')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')]('no\x20private_key\x20configured');}if(!this[_0xa66f('0x82')](_0x5a3929[_0xa66f('0x7a')])){return this[_0xa66f('0x35')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x5a3929[_0xa66f('0x59')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xa6'));}this[_0xa66f('0x35')][_0xa66f('0xe7')]=!![];this[_0xa66f('0x34')](_0x5a3929);this[_0xa66f('0x40')](_0x5a3929['text'],'in','','');this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0xee'),_0x5a3929[_0xa66f('0x59')]));var _0x246b54=this[_0xa66f('0x76')][_0xa66f('0xd3')](this,_0x5a3929);if(_0x246b54){for(var _0x2b8362 in _0x246b54){if(_0x246b54[_0xa66f('0xe8')](_0x2b8362)){if(_0x2b8362!==_0xa66f('0xef')){this[_0xa66f('0x35')]['setVariable'](util[_0xa66f('0x27')](_0xa66f('0xe9'),_0x2b8362[_0xa66f('0x67')]()),_0x246b54[_0x2b8362]);}}}this[_0xa66f('0x40')](_0x246b54[_0xa66f('0xf0')],_0xa66f('0xf1'),_0xa66f('0xeb'),_0x246b54[_0xa66f('0xef')]);return this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0xf2'),_0x246b54[_0xa66f('0xf0')]));}return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x5a3929,_0xa66f('0xf3'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0xf4')]=function(_0x56e28a){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0xf5'),_0x56e28a[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x56e28a[_0xa66f('0xf6')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xf7'));}if(!this['isConfigured'](_0x56e28a[_0xa66f('0xf8')])){return this['channel']['noop'](_0xa66f('0xf9'));}if(!this['isConfigured'](_0x56e28a['password'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xfa'));}if(!this[_0xa66f('0x82')](_0x56e28a[_0xa66f('0xfb')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xa6'));}this['channel'][_0xa66f('0xe7')]=!![];this[_0xa66f('0x34')](_0x56e28a);this[_0xa66f('0x40')](_0x56e28a[_0xa66f('0x59')],'in','','');this['channel']['noop'](util[_0xa66f('0x27')](_0xa66f('0xfc'),_0x56e28a[_0xa66f('0x59')]));var _0x392d37=this[_0xa66f('0x7b')][_0xa66f('0xd3')](this,_0x56e28a);if(_0x392d37){for(var _0x889d6d in _0x392d37){if(_0x392d37[_0xa66f('0xe8')](_0x889d6d)){this[_0xa66f('0x35')]['setVariable'](util[_0xa66f('0x27')](_0xa66f('0xfd'),_0x889d6d[_0xa66f('0x67')]()),_0x392d37[_0x889d6d]);}}this[_0xa66f('0x40')](_0x392d37['speech'],_0xa66f('0xf1'),_0xa66f('0xf4'),'');if(_0x392d37[_0xa66f('0xfe')]){this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0xff'),_0x392d37[_0xa66f('0xfe')]));var _0x1917fe=this[_0xa66f('0x35')][_0xa66f('0x100')](_0x392d37[_0xa66f('0xfe')]);try{fs['unlink'](_0x392d37['audiofile']+'.wav');}catch(_0x357535){logger[_0xa66f('0x2b')](_0x357535);}return _0x1917fe;}else{return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('SestekNDA\x20Result\x20%s',_0x392d37[_0xa66f('0xf0')]));}}return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x56e28a,_0xa66f('0x101'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x102')]=function(_0xde01d9){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x103'),_0xde01d9[_0xa66f('0x36')]));return this['channel'][_0xa66f('0xa7')](_0xa66f('0x102'));};AGIVertices[_0xa66f('0x11')]['ext_dial']=function(_0x48ff24){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x104'),_0x48ff24[_0xa66f('0x36')]));var _0x46d628='';if(_0x48ff24[_0xa66f('0x105')]){if(!this[_0xa66f('0x82')](_0x48ff24[_0xa66f('0x105')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x48ff24,'no\x20trunk\x20selected');}else{var _0x47613e=parseInt(_0x48ff24[_0xa66f('0x105')],0xa);if(isNaN(_0x47613e)){_0x46d628=_0x48ff24[_0xa66f('0x105')];}else{_0x46d628=this[_0xa66f('0x106')][_0xa66f('0xd3')](this,_0x48ff24[_0xa66f('0x105')]);if(!_0x46d628){return this[_0xa66f('0x35')]['error'](_0x48ff24,_0xa66f('0x107'));}}}}else if(_0x48ff24['trunk_name']){_0x46d628=_0x48ff24[_0xa66f('0x108')];}else{return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x48ff24,_0xa66f('0x109'));}var _0x1282bc=this['channel']['exec']('DIAL',[util[_0xa66f('0x27')](_0xa66f('0x10a'),_0x46d628,_0x48ff24[_0xa66f('0x10b')]),_0x48ff24[_0xa66f('0x63')],_0x48ff24[_0xa66f('0xe3')],_0x48ff24[_0xa66f('0x61')]]);if(_0x1282bc[_0xa66f('0xa1')]===-0x1){return _0x1282bc;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0x10c'),_0xa66f('0xe4')));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x10d')]=function(_0x4a4bdb){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x10e'),_0x4a4bdb[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x10d'));};AGIVertices[_0xa66f('0x11')]['getdigits']=function(_0x35ffba){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x10f'),_0x35ffba[_0xa66f('0x36')]));if(_0x35ffba[_0xa66f('0xa4')]===0x0){return this[_0xa66f('0xa3')](_0x35ffba);}_0x35ffba[_0xa66f('0xa4')]-=0x1;if(!this[_0xa66f('0x82')](_0x35ffba[_0xa66f('0x110')])){return this[_0xa66f('0x35')]['error'](_0x35ffba,_0xa66f('0x111'));}var _0x19c833=this[_0xa66f('0x1e')][_0xa66f('0xd3')](this,_0x35ffba['file_id']);if(!_0x19c833){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x35ffba,'no\x20file\x20audio\x20found');}if(!this[_0xa66f('0x82')](_0x35ffba['variable_id'])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0xa66f('0xd7'));}var _0x357b68=this[_0xa66f('0x35')][_0xa66f('0x112')](_0x19c833,_0x35ffba['response'],_0x35ffba[_0xa66f('0x113')]);var _0x3e6800=_0x357b68[_0xa66f('0xa1')]?_0x357b68[_0xa66f('0xa1')]['toString']():'';logger[_0xa66f('0x2d')](_0xa66f('0x114'),JSON['stringify'](_0x357b68));if(_0x357b68['result']===-0x1){this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x35ffba,_0x3e6800);return _0x357b68;}else if(_0x357b68['extra']==='timeout'){_0x357b68[_0xa66f('0xa1')]=_0x3e6800[_0xa66f('0x98')]>=parseInt(_0x35ffba[_0xa66f('0x115')])?'x':'i';}else{_0x357b68[_0xa66f('0xa1')]=_0x3e6800[_0xa66f('0x98')]>=parseInt(_0x35ffba['mindigit'])&&_0x3e6800['length']<=parseInt(_0x35ffba[_0xa66f('0x113')])?'x':'i';}var _0x30208a=this[_0xa66f('0x12')][_0xa66f('0xd3')](this,_0x35ffba['variable_id']);if(!_0x30208a){return this['channel']['error'](_0x35ffba,_0xa66f('0xd8'));}this[_0xa66f('0x35')]['setVariable'](_0x30208a,_0x3e6800);if(this['isConfigured'](_0x35ffba[_0xa66f('0x116')])){var _0x4ba83a=parseInt(_0x35ffba[_0xa66f('0x116')],0xa);var _0x124cc6=rs['generate']({'charset':'*','length':_0x4ba83a});var _0x4f97ab=_0x3e6800[_0xa66f('0x98')];if(_0x4f97ab>0x0){if(_0x4f97ab>_0x4ba83a){this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x35ffba,_0x35ffba[_0xa66f('0x117')]===_0xa66f('0x118')?_0x124cc6+_0x3e6800[_0xa66f('0x119')](_0x4ba83a):_0x3e6800[_0xa66f('0x119')](0x0,_0x4f97ab-_0x4ba83a)+_0x124cc6);}else{this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x35ffba,rs[_0xa66f('0x11a')]({'charset':'*','length':_0x4f97ab}));}}else{this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x35ffba,'');}}else{this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x35ffba,_0x3e6800);}return _0x357b68;};AGIVertices[_0xa66f('0x11')][_0xa66f('0xe')]=function(_0x2c70ea){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x11b'),_0x2c70ea['label']));return this[_0xa66f('0x11c')](_0x2c70ea);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x11d')]=function(_0x2a5c0f){logger['info'](util['format'](_0xa66f('0x11e'),_0x2a5c0f['label']));this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x2a5c0f,_0x2a5c0f[_0xa66f('0x11f')]);return this['channel'][_0xa66f('0xa7')](util['format'](_0xa66f('0x120'),_0x2a5c0f[_0xa66f('0x11f')]));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x121')]=function(_0x328afa){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x122'),_0x328afa[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x328afa[_0xa66f('0x85')])||!this['isConfigured'](_0x328afa[_0xa66f('0x86')])){return this[_0xa66f('0x35')]['noop'](_0xa66f('0x123'));}if(!this[_0xa66f('0x82')](_0x328afa['text'])){return this[_0xa66f('0x35')]['noop'](_0xa66f('0xa6'));}this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x124'),_0x328afa['text']));var _0x1b660f=this['awsPolly'][_0xa66f('0xd3')](this,_0x328afa);if(_0x1b660f){this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x125'),_0x1b660f));var _0x22434a=this['channel'][_0xa66f('0x100')](_0x1b660f);try{fs[_0xa66f('0x126')](_0x1b660f+_0xa66f('0x127'));}catch(_0x28d67d){logger['error'](_0x28d67d);}return _0x22434a;}return this[_0xa66f('0x35')]['error'](_0x328afa,_0xa66f('0x128'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x129')]=function(_0xe44c81){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x12a'),_0xe44c81[_0xa66f('0x36')]));if(!this['isConfigured'](_0xe44c81[_0xa66f('0x85')])||!this[_0xa66f('0x82')](_0xe44c81[_0xa66f('0x86')])){return this['channel']['noop'](_0xa66f('0x123'));}if(!this[_0xa66f('0x82')](_0xe44c81[_0xa66f('0x12b')])){return this['channel'][_0xa66f('0xa7')](_0xa66f('0x12c'));}if(!this[_0xa66f('0x82')](_0xe44c81[_0xa66f('0x59')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xa6'));}this[_0xa66f('0x35')][_0xa66f('0xe7')]=!![];this[_0xa66f('0x34')](_0xe44c81);this[_0xa66f('0x40')](_0xe44c81[_0xa66f('0x59')],'in','','');this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0x12d'),_0xe44c81[_0xa66f('0x59')]));var _0x103e4a=this[_0xa66f('0x8a')]['sync'](this,_0xe44c81);if(_0x103e4a){for(var _0x127a4c in _0x103e4a){if(_0x103e4a[_0xa66f('0xe8')](_0x127a4c)&&_['isString'](_0x103e4a[_0x127a4c])){this[_0xa66f('0x35')][_0xa66f('0x9c')](util[_0xa66f('0x27')](_0xa66f('0x12e'),_0x127a4c[_0xa66f('0x67')]()),_0x103e4a[_0x127a4c]);}}if(_[_0xa66f('0x43')](_0x103e4a['message'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x12f'));}else{this['createSquareMessage'](_0x103e4a[_0xa66f('0x71')],_0xa66f('0xf1'),_0xa66f('0x130'),'');return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x103e4a[_0xa66f('0x71')]));}}return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0xe44c81,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xa66f('0x11')]['googleasr']=function(_0x28a910){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x131'),_0x28a910[_0xa66f('0x36')],_0x28a910['timeout']));if(!this[_0xa66f('0x82')](_0x28a910[_0xa66f('0x75')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xe6'));}var _0x14d245=_0xa66f('0x132');var _0x352544=util[_0xa66f('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xa66f('0x11a')](0x4));var _0xe0606=util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x352544,_0x14d245);var _0x1e957e=!![];if(_0x28a910[_0xa66f('0x133')]===_0xa66f('0x134')){_0x1e957e=![];}var _0x234b2b=this[_0xa66f('0x35')][_0xa66f('0x135')](_0x352544,_0x14d245,_0x28a910['intKey'],_0x28a910[_0xa66f('0x63')],undefined,_0x1e957e);if(_0x234b2b[_0xa66f('0xa1')]!==-0x1){this['channel'][_0xa66f('0xa7')](util['format'](_0xa66f('0x136'),_0xe0606));var _0x193f24=this[_0xa66f('0x8c')][_0xa66f('0xd3')](this,_0x28a910,_0xe0606);if(_0x193f24){for(var _0x4f8e9e in _0x193f24){if(_0x193f24[_0xa66f('0xe8')](_0x4f8e9e)){this[_0xa66f('0x35')][_0xa66f('0x9c')](util['format']('GOOGLE_ASR_%s',_0x4f8e9e[_0xa66f('0x67')]()),_0x193f24[_0x4f8e9e]);}}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0x137'),JSON[_0xa66f('0x6e')](_0x193f24)));}}return _0x234b2b;};AGIVertices[_0xa66f('0x11')]['tildeasr']=function(_0x426b66){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x138'),_0x426b66[_0xa66f('0x36')]));if(!this['isConfigured'](_0x426b66['appid'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x139'));}if(!this[_0xa66f('0x82')](_0x426b66[_0xa66f('0x8f')])){return this['channel']['noop'](_0xa66f('0x13a'));}var _0x4decf0='wav';var _0x5e3381=util[_0xa66f('0x27')](_0xa66f('0x13b'),FILES_PATH,rs[_0xa66f('0x11a')](0x4));var _0x3446b8=util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x5e3381,_0x4decf0);var _0x514e31=!![];if(_0x426b66[_0xa66f('0x133')]===_0xa66f('0x134')){_0x514e31=![];}var _0x4951cc=this[_0xa66f('0x35')][_0xa66f('0x135')](_0x5e3381,_0x4decf0,_0x426b66[_0xa66f('0x13c')],_0x426b66[_0xa66f('0x63')],undefined,_0x514e31);if(_0x4951cc['result']!==-0x1){this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0x13d'),_0x3446b8));var _0x3d97ac=this['tildeASR'][_0xa66f('0xd3')](this,_0x426b66,_0x3446b8);if(_0x3d97ac){for(var _0x54d656 in _0x3d97ac){if(_0x3d97ac[_0xa66f('0xe8')](_0x54d656)){this[_0xa66f('0x35')][_0xa66f('0x9c')](util['format'](_0xa66f('0x13e'),_0x54d656['toUpperCase']()),_0x3d97ac[_0x54d656]);}}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x13f'),JSON[_0xa66f('0x6e')](_0x3d97ac)));}}return _0x4951cc;};AGIVertices[_0xa66f('0x11')][_0xa66f('0x140')]=function(_0x56cd59){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x141'),_0x56cd59[_0xa66f('0x36')]));return this['channel']['continueAt'](_0x56cd59['context'],_0x56cd59[_0xa66f('0x142')],_0x56cd59[_0xa66f('0x3c')]);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x143')]=function(_0x32b9f0){logger['info'](util[_0xa66f('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x32b9f0[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x32b9f0['condition'])){return this[_0xa66f('0x35')]['error'](_0x32b9f0,'no\x20condition\x20configured');}try{var _0x36d6e3=eval(_0x32b9f0[_0xa66f('0x144')])?_0xa66f('0x145'):_0xa66f('0x146');this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x147'),_0x32b9f0['condition'],_0x36d6e3));return{'code':0xc8,'result':_0x36d6e3};}catch(_0x127d52){return{'code':0xc8,'result':_0xa66f('0x146')};}};AGIVertices[_0xa66f('0x11')]['gotoiftime']=function(_0x2dc2c2){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x148'),_0x2dc2c2[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x2dc2c2[_0xa66f('0x149')])){return this['channel']['error'](_0x2dc2c2,_0xa66f('0x14a'));}var _0x2ee308=this[_0xa66f('0x14b')]['sync'](this,_0x2dc2c2['interval_id']);if(!_0x2ee308){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x2dc2c2,_0xa66f('0x14c'));}for(var _0x16a93c=0x0;_0x16a93c<_0x2ee308['length'];_0x16a93c+=0x1){var _0x85dbc9=this[_0xa66f('0x35')][_0xa66f('0x12')](util[_0xa66f('0x27')]('IFTIME(%s?true:false)',_0x2ee308[_0x16a93c]));if(_0x85dbc9[_0xa66f('0xa1')]===-0x1){return _0x85dbc9;}logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x14d'),_0x2ee308[_0x16a93c],_0x85dbc9[_0xa66f('0x9f')]));if(_0x85dbc9['extra']==='true'){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x14d'),_0x2ee308[_0x16a93c],_0xa66f('0x145')));this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')]('IFTIME\x20%s\x20%s',_0x2ee308[_0x16a93c],_0xa66f('0x145')));return{'code':0xc8,'result':_0xa66f('0x145')};}else{logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x14d'),_0x2ee308[_0x16a93c],_0xa66f('0x146')));this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')]('IFTIME\x20%s\x20%s',_0x2ee308[_0x16a93c],_0xa66f('0x146')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xa66f('0x11')][_0xa66f('0x14e')]=function(_0x186809){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x14f'),_0x186809[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0x14e')]();};AGIVertices[_0xa66f('0x11')][_0xa66f('0x150')]=function(_0x5c4615){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x5c4615['label']));if(!this['isConfigured'](_0x5c4615['key'])){return this['channel'][_0xa66f('0xa7')]('no\x20key\x20configured');}var _0x4a9855='wav';var _0x188ff9=util[_0xa66f('0x27')](_0xa66f('0x13b'),FILES_PATH,rs[_0xa66f('0x11a')](0x4));var _0x4aa197=util[_0xa66f('0x27')](_0xa66f('0x9b'),_0x188ff9,_0x4a9855);var _0x5b384c=!![];if(_0x5c4615[_0xa66f('0x133')]==='NOBEEP'){_0x5b384c=![];}var _0x14b9b6=this[_0xa66f('0x35')][_0xa66f('0x135')](_0x188ff9,_0x4a9855,_0x5c4615[_0xa66f('0x13c')],_0x5c4615[_0xa66f('0x63')],undefined,_0x5b384c);if(_0x14b9b6['result']!==-0x1){this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format']('ispeech\x20%s\x20file\x20created',_0x4aa197));var _0x33eadd=this[_0xa66f('0x80')]['sync'](this,_0x5c4615,_0x4aa197);if(_0x33eadd){for(var _0x4fcc61 in _0x33eadd){if(_0x33eadd['hasOwnProperty'](_0x4fcc61)){this['channel'][_0xa66f('0x9c')](util[_0xa66f('0x27')](_0xa66f('0x151'),_0x4fcc61[_0xa66f('0x67')]()),_0x33eadd[_0x4fcc61]);}}return this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0x152'),JSON[_0xa66f('0x6e')](_0x33eadd)));}}return _0x14b9b6;};AGIVertices[_0xa66f('0x11')][_0xa66f('0x153')]=function(_0xfc4332){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x154'),_0xfc4332[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0xfc4332[_0xa66f('0x75')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xa66f('0x82')](_0xfc4332['text'])){return this['channel'][_0xa66f('0xa7')](_0xa66f('0xa6'));}this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x155'),_0xfc4332[_0xa66f('0x59')]));var _0x1e791b=this[_0xa66f('0x7c')]['sync'](this,_0xfc4332);if(_0x1e791b){this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x156'),_0x1e791b));var _0x298d5e=this[_0xa66f('0x35')][_0xa66f('0x100')](_0x1e791b,_0xfc4332[_0xa66f('0x13c')]);try{fs[_0xa66f('0x126')](_0x1e791b+_0xa66f('0x127'));}catch(_0x36cba3){logger[_0xa66f('0x2b')](_0x36cba3);}return _0x298d5e;}return this['channel'][_0xa66f('0x2b')](_0xfc4332,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa66f('0x11')]['login']=function(_0x1a0712){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1a0712['label']));if(!this[_0xa66f('0x82')](_0x1a0712[_0xa66f('0x157')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x1a0712,_0xa66f('0x158'));}logger['info'](util[_0xa66f('0x27')](_0xa66f('0x159'),this[_0xa66f('0x35')]['callerid'],_0x1a0712[_0xa66f('0x157')]));var _0x4de239=this['agentLogin'][_0xa66f('0xd3')](this,_0x1a0712[_0xa66f('0x157')]);if(_0x4de239){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x15a'),this['channel'][_0xa66f('0x4f')],_0x1a0712[_0xa66f('0x157')]));this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x15a'),this['channel'][_0xa66f('0x4f')],_0x1a0712[_0xa66f('0x157')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa66f('0x27')](_0xa66f('0x15b'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x1a0712[_0xa66f('0x157')]));this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0x15b'),this['channel'][_0xa66f('0x4f')],_0x1a0712[_0xa66f('0x157')]));return{'code':0xc8,'result':_0xa66f('0x15c')};}};AGIVertices[_0xa66f('0x11')]['logout']=function(_0xee1718){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x15d'),_0xee1718[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0xee1718[_0xa66f('0x157')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0xee1718,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa66f('0x27')](_0xa66f('0x159'),this['channel'][_0xa66f('0x4f')],_0xee1718[_0xa66f('0x157')]));var _0x57bbd1=this[_0xa66f('0x50')]['sync'](this,_0xee1718[_0xa66f('0x157')]);if(_0x57bbd1){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x15a'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0xee1718['findBy']));this[_0xa66f('0x35')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa66f('0x35')][_0xa66f('0x4f')],_0xee1718[_0xa66f('0x157')]));return{'code':0xc8,'result':_0xa66f('0x15e')};}else{logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa66f('0x35')][_0xa66f('0x4f')],_0xee1718['findBy']));this['channel']['noop'](util[_0xa66f('0x27')](_0xa66f('0x15b'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0xee1718[_0xa66f('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa66f('0x11')][_0xa66f('0x15f')]=function(_0x3e09e8){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3e09e8[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x3e09e8[_0xa66f('0x160')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x3e09e8,_0xa66f('0x161'));}this[_0xa66f('0x35')]['noop'](util['format']('math\x20%s',_0x3e09e8['operation']));var _0x48fc76=eval(_0x3e09e8[_0xa66f('0x160')]);if(!this[_0xa66f('0x82')](_0x3e09e8['variable_id'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xd7'));}var _0xded190=this['getVariable'][_0xa66f('0xd3')](this,_0x3e09e8['variable_id']);if(!_0xded190){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x3e09e8,_0xa66f('0xd8'));}if(_['isArray'](_0x48fc76)){var _0x2ed9bd=this;_0x48fc76[_0xa66f('0xd9')](function(_0x282980,_0x5df373){_0x2ed9bd[_0xa66f('0x35')][_0xa66f('0x9c')](util[_0xa66f('0x27')]('%s[%s]',_0xded190,_0x5df373),_0x282980);});return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x162'),_0xded190));}else{return this[_0xa66f('0x35')]['setVariable'](_0xded190,_0x48fc76);}};AGIVertices[_0xa66f('0x11')][_0xa66f('0xd')]=function(_0x22a70e){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x163'),_0x22a70e[_0xa66f('0x36')]));if(_0x22a70e['retry']===0x0){return this['maxRetry'](_0x22a70e);}_0x22a70e[_0xa66f('0xa4')]-=0x1;if(!this[_0xa66f('0x82')](_0x22a70e[_0xa66f('0x110')])){return this['channel'][_0xa66f('0x2b')](_0x22a70e,_0xa66f('0x111'));}var _0x5c148e=this[_0xa66f('0x1e')][_0xa66f('0xd3')](this,_0x22a70e[_0xa66f('0x110')]);if(!_0x5c148e){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x22a70e,_0xa66f('0x164'));}var _0xf4f3e4=this[_0xa66f('0x35')]['getData'](_0x5c148e,_0x22a70e['response'],_0x22a70e[_0xa66f('0x165')]);var _0x422298=_0xf4f3e4[_0xa66f('0xa1')];if(_0xf4f3e4[_0xa66f('0xa1')]===-0x1){this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x22a70e,'-1');return _0xf4f3e4;}else if(_0xf4f3e4[_0xa66f('0x9f')]==='timeout'){_0xf4f3e4[_0xa66f('0xa1')]=_0xf4f3e4[_0xa66f('0xa1')][_0xa66f('0x98')]>0x0?_0xf4f3e4['result']:'t';}else if(_['isEmpty'](_0xf4f3e4[_0xa66f('0xa1')])){_0xf4f3e4[_0xa66f('0xa1')]='#';_0x422298='#';}if(!this[_0xa66f('0x82')](_0x22a70e[_0xa66f('0x166')])){this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xd7'));}else{var _0x541ef5=this[_0xa66f('0x12')]['sync'](this,_0x22a70e[_0xa66f('0x166')]);if(!_0x541ef5){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x22a70e,_0xa66f('0xd8'));}this[_0xa66f('0x35')][_0xa66f('0x9c')](_0x541ef5,_0x422298);}this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x22a70e,_0x422298);return _0xf4f3e4;};AGIVertices[_0xa66f('0x11')][_0xa66f('0xa7')]=function(_0x5991f2){logger['info'](util['format'](_0xa66f('0x167'),_0x5991f2[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0x5991f2[_0xa66f('0x168')]||_0x5991f2['label']);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x169')]=function(_0x5b4068){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x16a'),_0x5b4068['label']));if(!this[_0xa66f('0x82')](_0x5b4068[_0xa66f('0x157')])){return this[_0xa66f('0x35')]['error'](_0x5b4068,'no\x20find\x20by\x20configured');}logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x159'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x5b4068[_0xa66f('0x157')]));var _0x244d9=this['getPause'][_0xa66f('0xd3')](this,_0x5b4068[_0xa66f('0x16b')]);var _0x596aa3=this['agentPause'][_0xa66f('0xd3')](this,_0x5b4068[_0xa66f('0x157')],_0x244d9);if(_0x596aa3){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x15a'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x5b4068['findBy']));this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x15a'),this['channel'][_0xa66f('0x4f')],_0x5b4068['findBy']));return{'code':0xc8,'result':_0xa66f('0x15e')};}else{logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa66f('0x35')]['callerid'],_0x5b4068[_0xa66f('0x157')]));this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x15a'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x5b4068[_0xa66f('0x157')]));return{'code':0xc8,'result':_0xa66f('0x15c')};}};AGIVertices[_0xa66f('0x11')][_0xa66f('0x16c')]=function(_0x23429d){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x16d'),_0x23429d['label']));if(!this[_0xa66f('0x82')](_0x23429d[_0xa66f('0x110')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x23429d,_0xa66f('0x111'));}var _0x1e8c84=this[_0xa66f('0x1e')][_0xa66f('0xd3')](this,_0x23429d[_0xa66f('0x110')]);if(!_0x1e8c84){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x23429d,_0xa66f('0x164'));}var _0x3e55c9=this['channel'][_0xa66f('0x54')](_0xa66f('0x16e'),[_0x1e8c84,_0x23429d[_0xa66f('0xe3')]]);if(_0x3e55c9[_0xa66f('0xa1')]===-0x1){return _0x3e55c9;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x16f'),_0xa66f('0x16e'),_0x1e8c84));};AGIVertices['prototype']['queue']=function(_0x587fdf){logger[_0xa66f('0x2d')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x587fdf[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x587fdf[_0xa66f('0x170')])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x587fdf,'no\x20queue\x20selected');}var _0x2c0134='';var _0x2265b3=parseInt(_0x587fdf[_0xa66f('0x170')],0xa);if(isNaN(_0x2265b3)){_0x2c0134=_0x587fdf[_0xa66f('0x170')];}else{_0x2c0134=this['getVoiceQueue'][_0xa66f('0xd3')](this,_0x587fdf['queue_id']);if(!_0x2c0134){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x587fdf,_0xa66f('0x171'));}}var _0xc66870='';if(this['isConfigured'](_0x587fdf['file_id'])){var _0x190c5c=this[_0xa66f('0x1e')][_0xa66f('0xd3')](this,_0x587fdf['file_id']);if(_0x190c5c){_0xc66870=_0x190c5c;}}this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x587fdf,_0x2c0134);if(_0x587fdf['opts'][_0xa66f('0x172')]('x')<0x0){_0x587fdf[_0xa66f('0xe3')]+='x';}if(_0x587fdf[_0xa66f('0xe3')][_0xa66f('0x172')]('X')<0x0){_0x587fdf['opts']+='X';}this[_0xa66f('0x35')][_0xa66f('0x9c')](_0xa66f('0x173'),_0x2c0134?_0x2c0134[_0xa66f('0x174')]():'');var _0xdd7f4e=this['channel'][_0xa66f('0x54')](_0xa66f('0x175'),[_0x2c0134,_0x587fdf[_0xa66f('0xe3')],_0x587fdf[_0xa66f('0x61')],_0xc66870,_0x587fdf[_0xa66f('0x63')],_0x587fdf[_0xa66f('0x7')],_0x587fdf[_0xa66f('0x176')],_0x587fdf[_0xa66f('0x177')],'',_0x587fdf['position']]);if(_0xdd7f4e[_0xa66f('0xa1')]===-0x1){return _0xdd7f4e;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x16f'),_0xa66f('0x175'),_0x2c0134));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x178')]=function(_0x1afa25){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x179'),_0x1afa25[_0xa66f('0x36')]));var _0x34181c=_0x1afa25[_0xa66f('0x17a')]||_0xa66f('0x132');var _0x987ccd=util['format'](_0xa66f('0x17b'),this['channel'][_0xa66f('0x39')],rs[_0xa66f('0x11a')](0x5));var _0x5032cb=util[_0xa66f('0x27')](_0xa66f('0x17c'),FILES_PATH,_0x987ccd,_0x34181c);var _0x5e93b7=util[_0xa66f('0x27')](_0xa66f('0x13b'),FILES_PATH,_0x987ccd);this[_0xa66f('0x38')][_0xa66f('0xd3')](this,_0x1afa25,_0x987ccd,_0x5032cb);this[_0xa66f('0x35')][_0xa66f('0x9c')](_0xa66f('0x17d'),_0x987ccd);logger[_0xa66f('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5e93b7,_0x34181c,_0x1afa25[_0xa66f('0x17e')],_0x1afa25[_0xa66f('0x63')]);return this[_0xa66f('0x35')][_0xa66f('0x135')](_0x5e93b7,_0x34181c,_0x1afa25[_0xa66f('0x17e')],_0x1afa25['timeout'],undefined,!![]);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x17f')]=function(_0x1a99b4){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x180'),_0x1a99b4[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x1a99b4['url'])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x181'));}var _0x17959b=this[_0xa66f('0x60')]['sync'](this,_0x1a99b4);logger[_0xa66f('0x2d')](util[_0xa66f('0x27')]('Response:',util[_0xa66f('0x182')](_0x17959b,{'showHidden':![],'depth':null})));if(!this[_0xa66f('0x82')](_0x1a99b4[_0xa66f('0x166')])){return this[_0xa66f('0x35')]['noop'](_0xa66f('0x183'));}var _0x3bdd85=this['getVariable'][_0xa66f('0xd3')](this,_0x1a99b4['variable_id']);if(!_0x3bdd85){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x1a99b4,_0xa66f('0xd8'));}this[_0xa66f('0x35')]['setVariable'](util[_0xa66f('0x27')]('%s_STATUS_CODE',_0x3bdd85),_0x17959b[_0xa66f('0x6f')]?_0x17959b[_0xa66f('0x6f')]:_0xa66f('0x184'));this['channel'][_0xa66f('0x9c')](util[_0xa66f('0x27')](_0xa66f('0x185'),_0x3bdd85),_0x17959b[_0xa66f('0x70')]?_0x17959b[_0xa66f('0x70')]:'OK');if(_0x17959b[_0xa66f('0x6d')]){try{this[_0xa66f('0x9a')](_0x17959b[_0xa66f('0x6d')],_0x3bdd85);}catch(_0x488916){logger[_0xa66f('0x2b')](util[_0xa66f('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3bdd85));}}return this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0xdc'),_0x3bdd85));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x186')]=function(_0x14ad9a){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x187'),_0x14ad9a[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0x188')](_0x14ad9a[_0xa66f('0x189')][_0xa66f('0x56')](/\s+/g,''),_0x14ad9a['escape_digits']);};AGIVertices[_0xa66f('0x11')]['saynumber']=function(_0x106649){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x18a'),_0x106649[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0x18b')](_0x106649[_0xa66f('0x64')][_0xa66f('0x56')](/\s+/g,''),_0x106649['escape_digits']);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x18c')]=function(_0x5afbf2){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x18d'),_0x5afbf2[_0xa66f('0x36')]));return this[_0xa66f('0x35')][_0xa66f('0x18e')](_0x5afbf2[_0xa66f('0x59')],_0x5afbf2[_0xa66f('0x17e')]);};AGIVertices['prototype'][_0xa66f('0x18f')]=function(_0x40a482){logger[_0xa66f('0x2d')](util['format'](_0xa66f('0x190'),_0x40a482[_0xa66f('0x36')]));if(!this['isConfigured'](_0x40a482[_0xa66f('0x191')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x192'));}var _0x194323=this[_0xa66f('0x193')][_0xa66f('0xd3')](this,_0x40a482[_0xa66f('0x191')]);if(!_0x194323||!_0x194323[_0xa66f('0x194')]){return this[_0xa66f('0x35')]['error'](_0x40a482,'no\x20mail\x20account\x20found');}var _0x54f726={'from':util['format'](_0xa66f('0x195'),_0x194323[_0xa66f('0x14')],_0x194323['email']||_0x194323[_0xa66f('0x194')][_0xa66f('0x196')]),'to':_0x40a482['to']||'','cc':_0x40a482['cc']||'','bcc':_0x40a482[_0xa66f('0x197')]||'','subject':_0x40a482['subject'],'html':_0x40a482[_0xa66f('0x59')],'text':_0x40a482[_0xa66f('0x59')]};if(this[_0xa66f('0x82')](_0x40a482[_0xa66f('0x198')])){}logger[_0xa66f('0xde')](_0xa66f('0x199'),JSON[_0xa66f('0x6e')](_0x54f726));this[_0xa66f('0x34')]['sync'](this,_0x40a482,_0x40a482[_0xa66f('0x191')]);this[_0xa66f('0x35')][_0xa66f('0xa7')](util['format'](_0xa66f('0x19a'),_0x194323['name']));this['sendMailMessage'][_0xa66f('0xd3')](this,_0x194323[_0xa66f('0x19b')],_0x54f726);return this['channel'][_0xa66f('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa66f('0x11')][_0xa66f('0x19c')]=function(_0x33ab06){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x19d'),_0x33ab06['label']));return this['channel'][_0xa66f('0xa7')](_0xa66f('0x19e'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x19f')]=function(_0x172ba9){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x1a0'),_0x172ba9[_0xa66f('0x36')]));if(!this['isConfigured'](_0x172ba9[_0xa66f('0x1a1')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x1a2'));}var _0x404ed1=this[_0xa66f('0x32')]['sync'](this,_0x172ba9[_0xa66f('0x1a1')]);if(!_0x404ed1){return this[_0xa66f('0x35')]['error'](_0x172ba9,_0xa66f('0x1a3'));}var _0x48b397={'body':_0x172ba9['sms_text'],'phone':_0x172ba9['to']||'','SmsAccountId':_0x404ed1['id']};logger[_0xa66f('0xde')](_0xa66f('0x1a4'),JSON['stringify'](_0x48b397));this['createSquareDetailsReport']['sync'](this,_0x172ba9,_0x172ba9[_0xa66f('0x1a1')]);this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x1a5'),_0x404ed1[_0xa66f('0x14')]));this['createSmsMessage']['sync'](this,_0x48b397);return this['channel'][_0xa66f('0xa7')](_0xa66f('0x1a6'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1a7')]=function(_0x503925){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x1a8'),_0x503925[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x503925['variable_id'])){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x503925,'no\x20variable\x20selected');}var _0x26e5be=this[_0xa66f('0x12')]['sync'](this,_0x503925[_0xa66f('0x166')]);if(!_0x26e5be){return this[_0xa66f('0x35')]['error'](_0x503925,_0xa66f('0xd8'));}return this[_0xa66f('0x35')][_0xa66f('0x9c')](_0x26e5be,_0x503925[_0xa66f('0x1a9')]);};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1aa')]=function(_0x30b7a0){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x1ab'),_0x30b7a0[_0xa66f('0x36')]));this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x1ac'));var _0x4c787a=this[_0xa66f('0x35')][_0xa66f('0x12')](_0xa66f('0x1ad'));if(!_['isEmpty'](_0x4c787a[_0xa66f('0x9f')])){this[_0xa66f('0x35')][_0xa66f('0x39')]=_0x4c787a[_0xa66f('0x9f')];}if(_0x30b7a0['answer']===_0xa66f('0x1ae')){this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x1af'));return this[_0xa66f('0x35')]['answer']();}return this[_0xa66f('0x35')]['noop'](_0xa66f('0x1b0'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1b1')]=function(_0x52c0cd){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x1b2'),_0x52c0cd[_0xa66f('0x36')]));if(!this[_0xa66f('0x82')](_0x52c0cd[_0xa66f('0x1b3')])){return this[_0xa66f('0x35')]['error'](_0x52c0cd,'no\x20subproject\x20selected');}var _0x2b8bed=this[_0xa66f('0x18')][_0xa66f('0xd3')](this,_0x52c0cd['project_id']);if(!this[_0xa66f('0x82')](_0x2b8bed)){return this['channel'][_0xa66f('0x2b')](_0x52c0cd,util[_0xa66f('0x27')](_0xa66f('0x1b4'),_0x52c0cd[_0xa66f('0x1b3')]));}if(_0x2b8bed===this[_0xa66f('0x35')]['arg_1']){return this[_0xa66f('0x35')]['error'](_0x52c0cd,_0xa66f('0x1b5'));}this[_0xa66f('0x34')][_0xa66f('0xd3')](this,_0x52c0cd,_0x2b8bed);var _0x50b57c=this[_0xa66f('0x35')][_0xa66f('0x54')](_0xa66f('0x1b6'),util[_0xa66f('0x27')](_0xa66f('0x1b7'),config[_0xa66f('0x7')]['host']||'127.0.0.1',_0x2b8bed,this['channel'][_0xa66f('0x3e')]));if(_0x50b57c[_0xa66f('0xa1')]===-0x1){return _0x50b57c;}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x16f'),_0xa66f('0x1b6'),_0x2b8bed));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1b8')]=function(_0x20225c){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x1b9'),_0x20225c[_0xa66f('0x36')]));var _0x2ec989=this[_0xa66f('0x53')][_0xa66f('0xd3')](this,_0x20225c[_0xa66f('0x1ba')]);this[_0xa66f('0x34')]['sync'](this,_0x20225c,_0x20225c[_0xa66f('0x1ba')]);if(this['isConfigured'](_0x20225c['variable_id'])){var _0x17fbee=this[_0xa66f('0x12')][_0xa66f('0xd3')](this,_0x20225c[_0xa66f('0x166')]);if(_0x17fbee){this[_0xa66f('0x35')][_0xa66f('0x9c')](_0x17fbee,_0x2ec989);return this[_0xa66f('0x35')]['noop'](util[_0xa66f('0x27')](_0xa66f('0x1bb'),_0x20225c['command'],_0x17fbee));}}return this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x1bc'),_0x20225c[_0xa66f('0x1ba')]));};AGIVertices[_0xa66f('0x11')]['google_cloud_tts']=function(_0x29f9d6){logger['info'](util['format'](_0xa66f('0x1bd'),_0x29f9d6['label']));_0x29f9d6[_0xa66f('0x59')]=_0x29f9d6[_0xa66f('0x59')][_0xa66f('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x29f9d6[_0xa66f('0x58')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0x1be'));}if(!this[_0xa66f('0x82')](_0x29f9d6[_0xa66f('0x59')])){return this['channel'][_0xa66f('0xa7')](_0xa66f('0xa6'));}this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x1bf'),_0x29f9d6[_0xa66f('0x59')]));var _0x28d9a8=this[_0xa66f('0x57')][_0xa66f('0xd3')](this,_0x29f9d6);if(_0x28d9a8){this['channel']['noop'](util[_0xa66f('0x27')](_0xa66f('0x1c0'),_0x28d9a8));var _0x18faa1=this[_0xa66f('0x35')]['streamFile'](_0x28d9a8);try{fs[_0xa66f('0x126')](_0x28d9a8+_0xa66f('0x127'));}catch(_0x2a1910){logger[_0xa66f('0x2b')](_0x2a1910);}return _0x18faa1;}return this['channel']['error'](_0x29f9d6,_0xa66f('0x1c1'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1c2')]=function(_0x4ee8d4){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4ee8d4[_0xa66f('0x36')]));_0x4ee8d4['text']=_0x4ee8d4[_0xa66f('0x59')][_0xa66f('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa66f('0x82')](_0x4ee8d4[_0xa66f('0x59')])){return this[_0xa66f('0x35')][_0xa66f('0xa7')](_0xa66f('0xa6'));}this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x1c3'),_0x4ee8d4[_0xa66f('0x59')]));var _0x2672a2=this[_0xa66f('0x5e')][_0xa66f('0xd3')](this,_0x4ee8d4);if(_0x2672a2){this[_0xa66f('0x35')][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x1c4'),_0x2672a2));var _0x3a6cb9=this['channel'][_0xa66f('0x100')](_0x2672a2);try{fs[_0xa66f('0x126')](_0x2672a2+_0xa66f('0x127'));}catch(_0x129580){logger['error'](_0x129580);}return _0x3a6cb9;}return this[_0xa66f('0x35')]['error'](_0x4ee8d4,_0xa66f('0x1c5'));};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1c6')]=function(_0x38e447){logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x1c7'),_0x38e447[_0xa66f('0x36')]));if(!this['isConfigured'](_0x38e447[_0xa66f('0x157')])){return this['channel'][_0xa66f('0x2b')](_0x38e447,_0xa66f('0x158'));}logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x159'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x38e447[_0xa66f('0x157')]));var _0x198f16=this[_0xa66f('0x4d')][_0xa66f('0xd3')](this,_0x38e447[_0xa66f('0x157')]);if(_0x198f16){logger[_0xa66f('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x38e447['findBy']));this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x15a'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x38e447[_0xa66f('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa66f('0x2d')](util[_0xa66f('0x27')](_0xa66f('0x15b'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x38e447[_0xa66f('0x157')]));this['channel'][_0xa66f('0xa7')](util[_0xa66f('0x27')](_0xa66f('0x15b'),this[_0xa66f('0x35')][_0xa66f('0x4f')],_0x38e447[_0xa66f('0x157')]));return{'code':0xc8,'result':_0xa66f('0x15c')};}};AGIVertices[_0xa66f('0x11')][_0xa66f('0x1c8')]=function(_0x5a3fa5){logger['info'](util[_0xa66f('0x27')](_0xa66f('0x1c9'),_0x5a3fa5[_0xa66f('0x36')]));var _0x33fab7=this[_0xa66f('0x35')][_0xa66f('0x54')](_0xa66f('0x1ca'),[_0x5a3fa5[_0xa66f('0x1cb')],_0x5a3fa5['options']]);if(_0x33fab7['result']===-0x1){return _0x33fab7;}return this['channel']['noop'](util[_0xa66f('0x27')](_0xa66f('0x16f'),_0xa66f('0x1ca'),_0x5a3fa5[_0xa66f('0x1cb')]));};AGIVertices[_0xa66f('0x11')]['vswitch']=function(_0x18ae87){logger['info'](util[_0xa66f('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x18ae87['label']));if(!this['isConfigured'](_0x18ae87[_0xa66f('0x166')])){return this['channel'][_0xa66f('0x2b')](_0x18ae87,_0xa66f('0x1cc'));}var _0xe24a97=this[_0xa66f('0x12')][_0xa66f('0xd3')](this,_0x18ae87[_0xa66f('0x166')]);if(!_0xe24a97){return this[_0xa66f('0x35')][_0xa66f('0x2b')](_0x18ae87,_0xa66f('0xd8'));}var _0xa12d36=this['channel']['getVariable'](_0xe24a97);return{'code':0xc8,'result':_0xa12d36[_0xa66f('0x9f')]?_0xa12d36[_0xa66f('0x9f')]:'-'};};String[_0xa66f('0x11')]['replaceAll']=function(_0x312bbe,_0x5bb2b6){return this[_0xa66f('0x9e')](_0x312bbe)[_0xa66f('0x1cd')](_0x5bb2b6);};module[_0xa66f('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x9649=['Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','parse','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','tildeASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','format','%s.%s','setVariable','length','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','MRCPSynth','result','noop','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','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\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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\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','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','then','name','prototype','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','interval','map','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x9649,0x19f));var _0x9964=function(_0x3d7c4c,_0x52669f){_0x3d7c4c=_0x3d7c4c-0x0;var _0x423002=_0x9649[_0x3d7c4c];return _0x423002;};'use strict';var fs=require('fs');var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var sh=require(_0x9964('0x2'));var odbc=require(_0x9964('0x3'))();var rs=require('randomstring');var moment=require(_0x9964('0x4'));var Mustache=require(_0x9964('0x5'));var rp=require('request-promise');var logger=require(_0x9964('0x6'))('agi');var config=require(_0x9964('0x7'));var scripts=require(_0x9964('0x8'));var FILES_PATH=_0x9964('0x9');var recursiveMapAttributes=[_0x9964('0xa'),_0x9964('0xb')];var verticesWithRetry=[_0x9964('0xc'),_0x9964('0xd'),'getsecretdigits'];var AGIVertices=function(_0x45dda7,_0x67291b,_0x5071f7){this[_0x9964('0xe')]=_0x45dda7;this[_0x9964('0xf')]=_0x67291b;this['mailRpc']=_0x5071f7;};AGIVertices['prototype'][_0x9964('0x10')]=function(_0x4c4a3d,_0xe205db){this[_0x9964('0xf')][_0x9964('0x11')](_0x4c4a3d)['then'](function(_0x2be3fc){_0xe205db(null,_0x2be3fc?_0x2be3fc['name']:![]);})[_0x9964('0x12')](function(_0x39c624){_0xe205db(_0x39c624);});};AGIVertices['prototype'][_0x9964('0x13')]=function(_0x39ef74,_0x5aa1a8){this[_0x9964('0xf')][_0x9964('0x14')](_0x39ef74)[_0x9964('0x15')](function(_0x46688a){_0x5aa1a8(null,_0x46688a?_0x46688a[_0x9964('0x16')]:![]);})['catch'](function(_0x411544){_0x5aa1a8(_0x411544);});};AGIVertices[_0x9964('0x17')]['getSquareProject']=function(_0x2fd50d,_0x3fe796){this['rpc'][_0x9964('0x18')](_0x2fd50d)[_0x9964('0x15')](function(_0x69994d){_0x3fe796(null,_0x69994d?_0x69994d[_0x9964('0x16')]:![]);})['catch'](function(_0x40b3dd){_0x3fe796(_0x40b3dd);});};AGIVertices[_0x9964('0x17')]['getSquareOdbc']=function(_0x2eb3a8,_0x3f6472){this[_0x9964('0xf')][_0x9964('0x19')](_0x2eb3a8)[_0x9964('0x15')](function(_0x1bf791){_0x3f6472(null,_0x1bf791?_0x1bf791[_0x9964('0x1a')]:![]);})[_0x9964('0x12')](function(_0x1072b5){_0x3f6472(_0x1072b5);});};AGIVertices[_0x9964('0x17')]['getUser']=function(_0x455b62,_0x447026){this['rpc'][_0x9964('0x1b')](_0x455b62)['then'](function(_0x242e0a){_0x447026(null,_0x242e0a?_0x242e0a[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x167525){_0x447026(_0x167525);});};AGIVertices[_0x9964('0x17')][_0x9964('0x1c')]=function(_0x5f30e8,_0x452c96){this[_0x9964('0xf')]['getTrunkById'](_0x5f30e8)[_0x9964('0x15')](function(_0x15a14c){_0x452c96(null,_0x15a14c?_0x15a14c[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x26cd95){_0x452c96(_0x26cd95);});};AGIVertices['prototype'][_0x9964('0x1d')]=function(_0x4c2b44,_0x44cb60){var _0x512f6b=this;this[_0x9964('0xf')]['getSoundById'](_0x4c2b44)[_0x9964('0x15')](function(_0x162b83){_0x44cb60(null,_0x162b83?_0x512f6b[_0x9964('0x1e')](_0x162b83[_0x9964('0x1f')]):![]);})[_0x9964('0x12')](function(_0x23df5e){_0x44cb60(_0x23df5e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x20')]=function(_0x46c57d,_0x58ce2c){this['rpc']['getMailAccountById'](_0x46c57d)['then'](function(_0x36220b){_0x58ce2c(null,_0x36220b?_0x36220b:![]);})[_0x9964('0x12')](function(_0x4efb43){_0x58ce2c(_0x4efb43);});};AGIVertices[_0x9964('0x17')][_0x9964('0x21')]=function(_0x3092b2,_0x17a244,_0x9d4eaf){this[_0x9964('0x22')]['sendMailMessage'](_0x3092b2,_0x17a244)[_0x9964('0x15')](function(){_0x9d4eaf(null);})[_0x9964('0x12')](function(_0x59ab78){_0x9d4eaf(_0x59ab78);});};AGIVertices[_0x9964('0x17')][_0x9964('0x23')]=function(_0x3e5154,_0x257430){this['rpc']['getIntervalById'](_0x3e5154)[_0x9964('0x15')](function(_0x4e517c){if(_0x4e517c){if(_0x4e517c['IntervalId']){_0x257430(null,[_0x4e517c[_0x9964('0x24')]]);}else{_0x257430(null,_[_0x9964('0x25')](_0x4e517c['Intervals'],'interval'));}}else{_0x257430(null,![]);}})[_0x9964('0x12')](function(_0x71d436){_0x257430(_0x71d436);});};AGIVertices['prototype'][_0x9964('0x1e')]=function(_0x4fca90){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x4fca90);};AGIVertices[_0x9964('0x17')][_0x9964('0x26')]=function(_0x168f41,_0x1df24e,_0x2cdbbc){odbc[_0x9964('0x27')](_0x168f41,function(_0x31b296){if(_0x31b296){logger[_0x9964('0x28')](_0x9964('0x29'),_0x31b296);_0x2cdbbc(_0x31b296);}else{logger['info'](_0x9964('0x2a'));odbc[_0x9964('0x2b')](_0x1df24e,function(_0x39cd4a,_0x132c7c){if(_0x39cd4a){logger['info']('Error\x20executing\x20query\x20%s',_0x1df24e);_0x2cdbbc(_0x39cd4a);}else{logger[_0x9964('0x2c')](_0x9964('0x2d'),_0x1df24e);odbc[_0x9964('0x2e')](function(_0x1bad9d){if(_0x1bad9d){logger[_0x9964('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1bad9d);}_0x2cdbbc(null,_0x132c7c);});}});}});};AGIVertices[_0x9964('0x17')][_0x9964('0x2f')]=function(_0x2b9684,_0x3bde2b){this[_0x9964('0xf')][_0x9964('0x30')](_0x2b9684)[_0x9964('0x15')](function(_0x178f52){_0x3bde2b(null,_0x178f52?_0x178f52:![]);})[_0x9964('0x12')](function(_0x29efe7){_0x3bde2b(_0x29efe7);});};AGIVertices[_0x9964('0x17')][_0x9964('0x31')]=function(_0x3539bf,_0xdc12f7){this[_0x9964('0xf')][_0x9964('0x31')](_0x3539bf)['then'](function(_0x344c6c){_0xdc12f7(null,_0x344c6c);})['catch'](function(_0x366b93){_0xdc12f7(_0x366b93);});};AGIVertices[_0x9964('0x17')][_0x9964('0x32')]=function(_0x4c3d38,_0xf4a80e,_0x5f5312){this[_0x9964('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'node':_0x4c3d38[_0x9964('0x34')],'application':_0x4c3d38[_0x9964('0x35')],'data':_0xf4a80e||null,'project_name':this[_0x9964('0xe')][_0x9964('0x36')],'callerid':this[_0x9964('0xe')][_0x9964('0x37')]})['then'](function(_0x2d83ea){if(_0x5f5312){_0x5f5312(null,_0x2d83ea);}})[_0x9964('0x12')](function(_0x2948f2){if(_0x5f5312){_0x5f5312(_0x2948f2);}});};AGIVertices[_0x9964('0x17')][_0x9964('0x38')]=function(_0x307787,_0xc717aa,_0x28ac20,_0x9841f8){this[_0x9964('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0x9964('0x33')],'callerid':this['channel'][_0x9964('0x37')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x9964('0x39')],'extension':this[_0x9964('0xe')][_0x9964('0x3a')],'priority':this['channel']['priority'],'accountcode':this[_0x9964('0xe')]['accountcode'],'dnid':this[_0x9964('0xe')][_0x9964('0x3b')],'projectName':this[_0x9964('0xe')][_0x9964('0x36')],'saveName':_0xc717aa,'filename':_0x307787[_0x9964('0x3c')]||_0xc717aa,'savePath':_0x28ac20})[_0x9964('0x15')](function(_0x521d03){_0x9841f8(null,_0x521d03);})[_0x9964('0x12')](function(_0x323995){_0x9841f8(_0x323995);});};AGIVertices[_0x9964('0x17')][_0x9964('0x3d')]=function(_0x1c575b,_0x506c24,_0x1e7c32,_0x3873f5,_0x2847e8){this['rpc'][_0x9964('0x3d')]({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'body':_0x1c575b,'direction':_0x506c24,'providerName':_0x1e7c32,'providerResponse':_0x3873f5})[_0x9964('0x15')](function(_0x338140){if(_0x2847e8){_0x2847e8(null,_0x338140);}})[_0x9964('0x12')](function(_0x1a5344){if(_0x2847e8){_0x2847e8(_0x1a5344);}});};AGIVertices[_0x9964('0x17')]['createCmContact']=function(_0x67f068,_0x52566e){this['rpc'][_0x9964('0x3e')]({'firstName':_['isEmpty'](_0x67f068[_0x9964('0x16')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x16')])?'callback_'+Math[_0x9964('0x40')]():_0x67f068[_0x9964('0x16')],'lastName':_[_0x9964('0x41')](_0x67f068[_0x9964('0x42')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x42')])?null:_0x67f068[_0x9964('0x42')],'phone':_0x67f068[_0x9964('0x43')],'ListId':_0x67f068[_0x9964('0x44')],'scheduledat':_0x67f068['scheduledAt'],'callbackUniqueid':this[_0x9964('0xe')]['uniqueid'],'tags':_0x9964('0x45'),'description':_0x9964('0x46')+_0x67f068[_0x9964('0x47')]['toString'](),'priority':_0x67f068[_0x9964('0x48')]})[_0x9964('0x15')](function(_0x238867){_0x52566e(null,_0x238867);})[_0x9964('0x12')](function(_0xaf7e23){_0x52566e(_0xaf7e23);});};AGIVertices['prototype'][_0x9964('0x49')]=function(_0x205f12,_0x29c074){this[_0x9964('0xf')][_0x9964('0x4a')](_0x205f12)['then'](function(_0x5a0ece){_0x29c074(null,_0x5a0ece?_0x5a0ece['name']:![]);})['catch'](function(_0x368c1a){_0x29c074(_0x368c1a);});};AGIVertices['prototype']['agentPause']=function(_0x5b8892,_0x275535,_0x498c8f){var _0x28201d={'role':_0x9964('0x4b')};_0x28201d[_0x5b8892]=this[_0x9964('0xe')]['callerid'];this[_0x9964('0xf')]['agentPause'](_0x28201d,_0x275535,this['channel'][_0x9964('0x33')])[_0x9964('0x15')](function(_0x2ffa8e){_0x498c8f(null,_['isNil'](_0x2ffa8e)?![]:!![]);})[_0x9964('0x12')](function(_0x1b0752){logger[_0x9964('0x28')](_0x1b0752);_0x498c8f(null,![]);});};AGIVertices['prototype'][_0x9964('0x4c')]=function(_0x2f97c5,_0x3c846d){var _0x4e0e7c={'role':'agent'};_0x4e0e7c[_0x2f97c5]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4c')](_0x4e0e7c)[_0x9964('0x15')](function(_0x222fd1){_0x3c846d(null,_[_0x9964('0x3f')](_0x222fd1)?![]:!![]);})[_0x9964('0x12')](function(_0x21a16f){logger[_0x9964('0x28')](_0x21a16f);_0x3c846d(null,![]);});};AGIVertices[_0x9964('0x17')][_0x9964('0x4d')]=function(_0x36d0c1,_0xc4ba66){var _0x3c706e={'role':'agent'};_0x3c706e[_0x36d0c1]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4d')](_0x3c706e)['then'](function(_0x56bf70){_0xc4ba66(null,_['isNil'](_0x56bf70)?![]:!![]);})['catch'](function(_0x4e374e){logger[_0x9964('0x28')](_0x4e374e);_0xc4ba66(null,![]);});};AGIVertices[_0x9964('0x17')]['agentLogin']=function(_0x249fa7,_0x4434ac){var _0x61b486={'role':_0x9964('0x4b')};_0x61b486[_0x249fa7]=this[_0x9964('0xe')]['callerid'];var _0x3446c8=_0x249fa7!=_0x9964('0x4e')?util['format'](_0x9964('0x4f'),'LOCAL',this[_0x9964('0xe')]['callerid']):undefined;this[_0x9964('0xf')][_0x9964('0x50')](_0x61b486,_0x3446c8)['then'](function(_0x476dba){_0x4434ac(null,_['isNil'](_0x476dba)?![]:!![]);})['catch'](function(_0x1614ad){logger['error'](_0x1614ad);_0x4434ac(null,![]);});};AGIVertices[_0x9964('0x17')]['shellCommand']=function(_0x39acbe,_0x5666c0){sh[_0x9964('0x51')](_[_0x9964('0x52')](_0x39acbe),function(_0x336f52,_0x41144f){var _0x2d0b16=_0x41144f[_0x9964('0x53')](/(\r\n|\n|\r)/gm,'');_0x5666c0(null,_0x2d0b16);});};AGIVertices['prototype'][_0x9964('0x54')]=function(_0x2d90c9,_0xa59931){scripts['googleCloudTTS'](_0x2d90c9[_0x9964('0x55')],_0x2d90c9[_0x9964('0x56')]||_0x9964('0x57'),_0x2d90c9[_0x9964('0x57')],_0x2d90c9[_0x9964('0x58')]||_0x9964('0x59'),_0x2d90c9[_0x9964('0x5a')]||_0x9964('0x5b'),_0x2d90c9[_0x9964('0x5c')]||_0x9964('0x5d'))[_0x9964('0x15')](function(_0x5c6920){_0xa59931(null,_0x5c6920);})[_0x9964('0x12')](function(_0x587874){_0xa59931(_0x587874);});};AGIVertices[_0x9964('0x17')][_0x9964('0x5e')]=function(_0x19fbef,_0xcb9b08){scripts['googleTTS'](_0x19fbef[_0x9964('0x57')],_0x19fbef[_0x9964('0x5f')]||'en',0x1)[_0x9964('0x15')](function(_0x4727aa){_0xcb9b08(null,_0x4727aa);})[_0x9964('0x12')](function(_0x39d044){_0xcb9b08(_0x39d044);});};AGIVertices[_0x9964('0x17')][_0x9964('0x60')]=function(_0x24b96d,_0x16ba3a){var _0x4e3b67={'uri':_0x24b96d[_0x9964('0x61')],'method':_0x24b96d[_0x9964('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24b96d[_0x9964('0x63')])===_0x9964('0x64')&&parseInt(_0x24b96d[_0x9964('0x63')])>=0x1?parseInt(_0x24b96d[_0x9964('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9964('0x65'),_0x9964('0x66')],_0x4e3b67[_0x9964('0x62')][_0x9964('0x67')]())){try{_0x4e3b67['body']=_0x24b96d['rawBody']?JSON['parse'](_0x24b96d[_0x9964('0xb')]):{};}catch(_0x373c88){logger['error'](_0x9964('0x68'),_0x373c88);}}try{_0x4e3b67[_0x9964('0x69')]=_0x24b96d[_0x9964('0xa')]?JSON['parse'](_0x24b96d[_0x9964('0xa')]):{};}catch(_0x43964c){logger['error'](_0x9964('0x6a'),_0x43964c);}if(_0x24b96d[_0x9964('0x6b')]){try{var _0x4a9a78=require(_0x24b96d[_0x9964('0x6b')])[_0x9964('0x6c')](this,_0x4e3b67);_0x4e3b67[_0x9964('0x6d')]=Mustache[_0x9964('0x6e')](_0x24b96d[_0x9964('0x61')],_0x4a9a78,{},['$$','$$']);if(_0x4e3b67['headers']){_0x4e3b67[_0x9964('0x69')]=JSON['parse'](Mustache[_0x9964('0x6e')](JSON[_0x9964('0x6f')](_0x4e3b67['headers']),_0x4a9a78,{},['$$','$$']));}if(_0x4e3b67[_0x9964('0x70')]){_0x4e3b67[_0x9964('0x70')]=JSON[_0x9964('0x71')](Mustache[_0x9964('0x6e')](JSON['stringify'](_0x4e3b67[_0x9964('0x70')]),_0x4a9a78,{},['$$','$$']));}}catch(_0x1abca3){logger[_0x9964('0x28')](_0x9964('0x72'),_0x1abca3);}}rp(_0x4e3b67)[_0x9964('0x15')](function(_0x265d7e){var _0x128882={'statusCode':_0x265d7e[_0x9964('0x73')]||0xc8,'statusMessage':_0x265d7e[_0x9964('0x74')]||'OK','headers':_0x265d7e[_0x9964('0x69')]||{},'body':_0x265d7e[_0x9964('0x70')]||{}};_0x16ba3a(null,_0x128882);})[_0x9964('0x12')](function(_0x4d6ac6){var _0x424e6e={'statusCode':_0x4d6ac6['statusCode']||0x1f4,'statusMessage':_0x4d6ac6[_0x9964('0x75')]||_0x9964('0x76'),'headers':_0x4d6ac6['options'][_0x9964('0x69')]||{},'body':_0x4d6ac6[_0x9964('0x77')][_0x9964('0x70')]||{}};_0x16ba3a(null,_0x424e6e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x78')]=function(_0x2fefdc,_0x411413){scripts[_0x9964('0x78')](this['channel'][_0x9964('0x33')],_0x2fefdc[_0x9964('0x79')],_0x2fefdc[_0x9964('0x57')],_0x2fefdc['dialogflow_language']||'en')[_0x9964('0x15')](function(_0x3a2be8){_0x411413(null,_0x3a2be8);})[_0x9964('0x12')](function(_0x4d9cd3){_0x411413(_0x4d9cd3);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7a')]=function(_0x3072e8,_0xc99eac){scripts[_0x9964('0x7a')](this[_0x9964('0xe')][_0x9964('0x33')],_0x3072e8[_0x9964('0x7b')],_0x3072e8[_0x9964('0x7c')],_0x3072e8['private_key'],_0x3072e8[_0x9964('0x57')],_0x3072e8[_0x9964('0x7d')]||'en')[_0x9964('0x15')](function(_0x582b39){_0xc99eac(null,_0x582b39);})[_0x9964('0x12')](function(_0x5bb243){_0xc99eac(_0x5bb243);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7e')]=function(_0x463365,_0x540bac){scripts[_0x9964('0x7e')](this[_0x9964('0xe')],_0x463365)[_0x9964('0x15')](function(_0x5ae9ee){_0x540bac(null,_0x5ae9ee);})[_0x9964('0x12')](function(_0x292836){_0x540bac(_0x292836);});};AGIVertices[_0x9964('0x17')]['ispeechTTS']=function(_0x14db69,_0x22e298){scripts[_0x9964('0x7f')](_0x14db69['key'],_0x14db69[_0x9964('0x57')],_0x14db69[_0x9964('0x80')]||_0x9964('0x59'),_0x14db69['speed'])[_0x9964('0x15')](function(_0x2f8d1d){_0x22e298(null,_0x2f8d1d);})[_0x9964('0x12')](function(_0x31b5ab){_0x22e298(_0x31b5ab);});};AGIVertices[_0x9964('0x17')][_0x9964('0x81')]=function(_0x5bdd6d,_0x107967,_0x13caf7){scripts[_0x9964('0x81')](_0x107967,_0x5bdd6d[_0x9964('0x79')],_0x5bdd6d[_0x9964('0x82')]||_0x9964('0x59'),this[_0x9964('0x83')](_0x5bdd6d['model'])?_0x5bdd6d[_0x9964('0x84')]:undefined)[_0x9964('0x15')](function(_0x1570fc){_0x13caf7(null,_0x1570fc);})[_0x9964('0x12')](function(_0x1d1822){_0x13caf7(_0x1d1822);});};AGIVertices[_0x9964('0x17')][_0x9964('0x85')]=function(_0x3b03af,_0x2a9a53){scripts[_0x9964('0x85')](_0x3b03af['aws_access_key_id'],_0x3b03af['aws_secret_access_key'],_0x3b03af['aws_polly_region'],_0x3b03af['aws_polly_voice']||_0x9964('0x86'),_0x3b03af[_0x9964('0x57')],_0x3b03af[_0x9964('0x87')]||_0x9964('0x57'))[_0x9964('0x15')](function(_0xf61611){_0x2a9a53(null,_0xf61611);})[_0x9964('0x12')](function(_0x5b5ece){_0x2a9a53(_0x5b5ece);});};AGIVertices['prototype'][_0x9964('0x88')]=function(_0x53d1e0,_0x30f32){scripts[_0x9964('0x88')](this[_0x9964('0xe')][_0x9964('0x33')],_0x53d1e0[_0x9964('0x89')],_0x53d1e0['aws_secret_access_key'],_0x53d1e0['aws_lex_region'],_0x53d1e0['text'],_0x53d1e0['aws_bot_name'])['then'](function(_0x4783a5){_0x30f32(null,_0x4783a5);})[_0x9964('0x12')](function(_0x88cb7b){_0x30f32(_0x88cb7b);});};AGIVertices[_0x9964('0x17')][_0x9964('0x8a')]=function(_0x43959b,_0x3b61fe,_0x353abf){scripts['googleASR'](_0x3b61fe,_0x43959b[_0x9964('0x79')],_0x43959b['google_asr_language']||_0x9964('0x59'))[_0x9964('0x15')](function(_0x2c9461){_0x353abf(null,_0x2c9461);})['catch'](function(_0x9ad7a8){_0x353abf(_0x9ad7a8);});};AGIVertices['prototype'][_0x9964('0x8b')]=function(_0x2c2d39,_0x2b8be7,_0xd7906f){scripts[_0x9964('0x8b')](_0x2b8be7,_0x2c2d39['appid'],_0x2c2d39[_0x9964('0x8c')],_0x2c2d39[_0x9964('0x6d')])[_0x9964('0x15')](function(_0x457d52){_0xd7906f(null,_0x457d52);})[_0x9964('0x12')](function(_0x3a9149){_0xd7906f(_0x3a9149);});};AGIVertices['prototype'][_0x9964('0x8d')]=function(_0x110c3a){var _0x5d691b=_[_0x9964('0x8e')](verticesWithRetry,_0x110c3a[_0x9964('0x35')])?_0x110c3a:_[_0x9964('0x8f')](_0x110c3a);for(var _0x527c0d in _0x5d691b){if(_0x5d691b[_0x9964('0x90')](_0x527c0d)){if(_0x5d691b[_0x527c0d]&&_[_0x9964('0x91')](_0x5d691b[_0x527c0d])){if(_[_0x9964('0x8e')](recursiveMapAttributes,_0x527c0d)){_0x5d691b[_0x527c0d]=this[_0x9964('0x92')](_0x5d691b[_0x527c0d]);}else{_0x5d691b[_0x527c0d]=this[_0x9964('0x93')](_0x5d691b[_0x527c0d]);}}}}return _0x5d691b;};AGIVertices['prototype'][_0x9964('0x94')]=function(_0x12d128){for(var _0xe15ec5 in _0x12d128){if(_0x12d128['hasOwnProperty'](_0xe15ec5)){if(_[_0x9964('0x95')](_0x12d128[_0xe15ec5])){this[_0x9964('0x94')](_0x12d128[_0xe15ec5]);}else if(_[_0x9964('0x96')](_0x12d128[_0xe15ec5])){for(var _0x30743e=0x0;_0x30743e<_0x12d128[_0xe15ec5]['length'];_0x30743e++){this[_0x9964('0x94')](_0x12d128[_0xe15ec5][_0x30743e]);}}else if(_[_0x9964('0x91')](_0x12d128[_0xe15ec5])){_0x12d128[_0xe15ec5]=this[_0x9964('0x93')](_0x12d128[_0xe15ec5]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x4ca948,_0x280577){for(var _0x1d0890 in _0x4ca948){if(_0x4ca948[_0x9964('0x90')](_0x1d0890)){if(_[_0x9964('0x95')](_0x4ca948[_0x1d0890])){if(!_[_0x9964('0x41')](_0x4ca948[_0x1d0890])){this[_0x9964('0x97')](_0x4ca948[_0x1d0890],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890));}}else if(_[_0x9964('0x96')](_0x4ca948[_0x1d0890])){for(var _0x4b8bbb=0x0;_0x4b8bbb<_0x4ca948[_0x1d0890]['length'];_0x4b8bbb++){this[_0x9964('0x97')](_0x4ca948[_0x1d0890][_0x4b8bbb],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890+'['+_0x4b8bbb+']'));}}else{if(!_['isNil'](_0x4ca948[_0x1d0890])){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890),_0x4ca948[_0x1d0890]);}}}}};AGIVertices['prototype'][_0x9964('0x92')]=function(_0x120714){try{var _0x2ddaf6=JSON[_0x9964('0x71')](_0x120714);this['recursiveNodeIndex'](_0x2ddaf6);return JSON[_0x9964('0x6f')](_0x2ddaf6);}catch(_0x3754fa){return this[_0x9964('0x93')](_0x120714);}};AGIVertices[_0x9964('0x17')][_0x9964('0x93')]=function(_0x29ba52){var _0x36c913=_0x29ba52['split']('{');for(var _0x46f14b=0x1;_0x46f14b<_0x36c913[_0x9964('0x9b')];_0x46f14b+=0x1){var _0x5748d1=_0x36c913[_0x46f14b][_0x9964('0x9c')]('}');if(_0x5748d1[_0x9964('0x9b')]>0x1){_0x29ba52=_0x29ba52[_0x9964('0x9d')]('{'+_0x5748d1[0x0]+'}',this[_0x9964('0xe')][_0x9964('0x10')](_0x5748d1[0x0])[_0x9964('0x9e')]||_0x5748d1[0x0]);}}if(_0x36c913['length']===0x1){return _0x29ba52[_0x9964('0x9f')]();}return this[_0x9964('0x93')](_0x29ba52);};AGIVertices[_0x9964('0x17')][_0x9964('0xa0')]=function(_0x4a42ab,_0x3d40fd){var _0x383702=this[_0x9964('0xe')]['getVariable'](_0x4a42ab);if(_0x383702['result']===-0x1){return _0x383702;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa1'),_0x3d40fd,_0x383702['extra']));return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3d40fd,_0x383702[_0x9964('0x9e')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x83')]=function(_0x39c568){return _0x39c568&&_0x39c568!=='0'&&_0x39c568!=='-1'&&_0x39c568!=='';};AGIVertices[_0x9964('0x17')][_0x9964('0xa2')]=function(_0x434b3f){this[_0x9964('0x32')]['sync'](this,_0x434b3f,'-');_0x434b3f[_0x9964('0xa3')]=_0x434b3f[_0x9964('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9964('0xa4')]=function(_0x15a129){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x15a129['label']));if(!this['isConfigured'](_0x15a129['text'])){return this[_0x9964('0xe')]['noop']('no\x20text\x20configured');}var _0x467218='\x22'+_0x15a129[_0x9964('0x57')]+'\x22';if(this[_0x9964('0x83')](_0x15a129['options'])){_0x467218+=','+_0x15a129[_0x9964('0x77')];}var _0x38c329=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x467218);if(_0x38c329[_0x9964('0xa6')]===-0x1){return _0x38c329;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20MRCPSynth\x20%s',_0x467218));};AGIVertices[_0x9964('0x17')]['mrcprecog']=function(_0x88702d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa8'),_0x88702d[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x88702d[_0x9964('0xa9')])){return this['channel']['noop'](_0x9964('0xaa'));}var _0x501be0=_0x88702d[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x88702d['options'])){_0x501be0+=','+_0x88702d[_0x9964('0x77')];}var _0x403040=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xab'),_0x501be0);if(_0x403040[_0x9964('0xa6')]===-0x1){return _0x403040;}var _0x1bd26d=this[_0x9964('0xa0')](_0x9964('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x1bd26d['result']===-0x1){return _0x1bd26d;}var _0x5107fd=this['getAndSetVariable']('RECOG_INPUT()',_0x9964('0xad'));if(_0x5107fd[_0x9964('0xa6')]===-0x1){return _0x5107fd;}var _0x132c1b=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xaf'));if(_0x132c1b[_0x9964('0xa6')]===-0x1){return _0x132c1b;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x501be0));};AGIVertices[_0x9964('0x17')][_0x9964('0xb1')]=function(_0x2eba6a){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2eba6a['label']));return this[_0x9964('0xe')][_0x9964('0xb1')]([_0x2eba6a[_0x9964('0xb2')],_0x2eba6a[_0x9964('0xb3')]]);};AGIVertices[_0x9964('0x17')][_0x9964('0xb4')]=function(_0x1f961e){logger['info'](util['format'](_0x9964('0xb5'),_0x1f961e[_0x9964('0x34')]));if(this[_0x9964('0x83')](_0x1f961e['timeout'])){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb6'),_0x1f961e[_0x9964('0x63')]));var _0x5961e9=this[_0x9964('0xe')]['wait'](_0x1f961e[_0x9964('0x63')]);if(_0x5961e9['result']===-0x1){return _0x5961e9;}}return this[_0x9964('0xe')][_0x9964('0xb4')]();};AGIVertices[_0x9964('0x17')][_0x9964('0x45')]=function(_0x19c945){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb7'),_0x19c945['label']));if(!this[_0x9964('0x83')](_0x19c945[_0x9964('0x44')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x19c945,_0x9964('0xb8'));}_0x19c945[_0x9964('0x47')]=moment();if(this['isConfigured'](_0x19c945['delay'])){_0x19c945['scheduledAt']=moment()['add'](_0x19c945[_0x9964('0xb9')],_0x9964('0xba'));}if(!this['isConfigured'](_0x19c945[_0x9964('0x48')])){_0x19c945['callback_priority']=0x2;}this[_0x9964('0x3e')][_0x9964('0x6c')](this,_0x19c945);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbb'),_0x19c945['phone'],_0x19c945[_0x9964('0x44')],_0x19c945['scheduledAt']));};AGIVertices[_0x9964('0x17')][_0x9964('0xbc')]=function(_0x13ec8){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xbd'),_0x13ec8['label']));var _0x244c6c=this[_0x9964('0xe')][_0x9964('0x51')](_0x13ec8['application'],_0x13ec8[_0x9964('0x77')]);if(_0x244c6c[_0x9964('0xa6')]===-0x1){return _0x244c6c;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x13ec8[_0x9964('0xbf')],_0x13ec8[_0x9964('0x77')]));};AGIVertices[_0x9964('0x17')][_0x9964('0xc0')]=function(_0x518095){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xc1'),_0x518095['label']));if(!this[_0x9964('0x83')](_0x518095[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}var _0x22d02e='\x22'+_0x518095['text']+'\x22';if(this[_0x9964('0x83')](_0x518095['options'])){_0x22d02e+=','+_0x518095[_0x9964('0x77')];}var _0x5b26e5=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x22d02e);if(_0x5b26e5[_0x9964('0xa6')]===-0x1){return _0x5b26e5;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x22d02e));};AGIVertices['prototype'][_0x9964('0xc4')]=function(_0xec910){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xec910[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0xec910[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}var _0x483b0e='\x22'+_0xec910['text']+'\x22';if(this[_0x9964('0x83')](_0xec910[_0x9964('0x77')])){_0x483b0e+=','+_0xec910[_0x9964('0x77')];}var _0x5972f6=this[_0x9964('0xe')][_0x9964('0x51')]('MRCPSynth',_0x483b0e);if(_0x5972f6[_0x9964('0xa6')]===-0x1){return _0x5972f6;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x483b0e));};AGIVertices[_0x9964('0x17')][_0x9964('0xc5')]=function(_0x148483){logger['info'](util[_0x9964('0x98')](_0x9964('0xc6'),_0x148483[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x148483[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x29a8ae=_0x148483[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x148483[_0x9964('0x77')])){_0x29a8ae+=','+_0x148483['options'];}var _0x19242c=this['channel']['exec'](_0x9964('0xab'),_0x29a8ae);if(_0x19242c[_0x9964('0xa6')]===-0x1){return _0x19242c;}var _0x10f924=this[_0x9964('0xa0')](_0x9964('0xac'),_0x9964('0xc7'));if(_0x10f924[_0x9964('0xa6')]===-0x1){return _0x10f924;}var _0x5ca24f=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5ca24f[_0x9964('0xa6')]===-0x1){return _0x5ca24f;}var _0x45b0ff=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xc8'));if(_0x45b0ff['result']===-0x1){return _0x45b0ff;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x29a8ae));};AGIVertices[_0x9964('0x17')]['sestekasr']=function(_0x945844){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x945844[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x945844[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x1ee9ee=_0x945844[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x945844[_0x9964('0x77')])){_0x1ee9ee+=','+_0x945844[_0x9964('0x77')];}var _0x19e6bb=this[_0x9964('0xe')]['exec'](_0x9964('0xab'),_0x1ee9ee);if(_0x19e6bb[_0x9964('0xa6')]===-0x1){return _0x19e6bb;}var _0x7cb84e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9964('0xc9'));if(_0x7cb84e[_0x9964('0xa6')]===-0x1){return _0x7cb84e;}var _0x309300=this[_0x9964('0xa0')](_0x9964('0xca'),_0x9964('0xcb'));if(_0x309300[_0x9964('0xa6')]===-0x1){return _0x309300;}var _0x1f3f21=this['getAndSetVariable'](_0x9964('0xae'),_0x9964('0xcc'));if(_0x1f3f21[_0x9964('0xa6')]===-0x1){return _0x1f3f21;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xb0'),_0x1ee9ee));};AGIVertices[_0x9964('0x17')][_0x9964('0xcd')]=function(_0x269aaa){logger['info'](util[_0x9964('0x98')](_0x9964('0xce'),_0x269aaa['label']));if(!this['isConfigured'](_0x269aaa[_0x9964('0xcf')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd0'));}var _0x5abf5e=this[_0x9964('0xd1')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xcf')]);if(!_0x5abf5e){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd2'));}if(!this['isConfigured'](_0x269aaa[_0x9964('0x2b')])){return this['channel'][_0x9964('0x28')](_0x269aaa,_0x9964('0xd3'));}var _0x431a7c=_0x269aaa['query'][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xd4'),_0x431a7c));var _0xb2de82=this[_0x9964('0x26')][_0x9964('0x6c')](this,_0x5abf5e,_0x431a7c);this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x269aaa,_0x431a7c);if(!this[_0x9964('0x83')](_0x269aaa[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e5e4a=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xd5')]);if(!_0x4e5e4a){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd6'));}var _0x49087f=this;_0xb2de82[_0x9964('0xd7')](function(_0x584d9d,_0x2a3235){Object[_0x9964('0xd8')](_0x584d9d)['forEach'](function(_0x3f46eb){_0x49087f[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xd9'),_0x4e5e4a,_0x2a3235,_0x3f46eb),_0x584d9d[_0x3f46eb]);});});this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xda'),_0x4e5e4a),_0xb2de82['length']);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0x4e5e4a));};AGIVertices['prototype']['dial']=function(_0x1a99a5){logger['debug'](util['format'](_0x9964('0xdb'),_0x1a99a5['label']));if(!this[_0x9964('0x83')](_0x1a99a5[_0x9964('0xdc')])){return this['channel'][_0x9964('0x28')](_0x1a99a5,_0x9964('0xdd'));}var _0x32a37e=this['getUser'][_0x9964('0x6c')](this,_0x1a99a5['sip_id']);if(!_0x32a37e){return this[_0x9964('0xe')]['error'](_0x1a99a5,_0x9964('0xde'));}var _0x58e727=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util['format'](_0x9964('0xe0'),_0x32a37e),_0x1a99a5['timeout'],_0x1a99a5[_0x9964('0xe1')],_0x1a99a5['url']]);if(_0x58e727['result']===-0x1){return _0x58e727;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s',_0x9964('0xdf')));};AGIVertices[_0x9964('0x17')][_0x9964('0xe2')]=function(_0x29984d){logger[_0x9964('0x2c')](util['format'](_0x9964('0xe3'),_0x29984d[_0x9964('0x34')]));if(!this['isConfigured'](_0x29984d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}if(!this[_0x9964('0x83')](_0x29984d[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x29984d);this[_0x9964('0x3d')](_0x29984d[_0x9964('0x57')],'in','','');this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe6'),_0x29984d[_0x9964('0x57')]));var _0x3da78c=this[_0x9964('0x78')][_0x9964('0x6c')](this,_0x29984d);if(_0x3da78c){for(var _0x10c006 in _0x3da78c){if(_0x3da78c[_0x9964('0x90')](_0x10c006)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xe7'),_0x10c006[_0x9964('0x67')]()),_0x3da78c[_0x10c006]);}}this[_0x9964('0x3d')](_0x3da78c['speech'],_0x9964('0xe8'),_0x9964('0xe2'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe9'),_0x3da78c[_0x9964('0xea')]));}return this[_0x9964('0xe')]['error'](_0x29984d,_0x9964('0xeb'));};AGIVertices[_0x9964('0x17')][_0x9964('0xec')]=function(_0x4dfbca){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xed'),_0x4dfbca['label']));if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7b')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20project_id\x20configured');}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7c')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xee'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0xef')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x4dfbca['dialogflowV2_language'])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf0'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x4dfbca);this[_0x9964('0x3d')](_0x4dfbca[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xf1'),_0x4dfbca[_0x9964('0x57')]));var _0x235d7f=this[_0x9964('0x7a')][_0x9964('0x6c')](this,_0x4dfbca);if(_0x235d7f){for(var _0x1b61ca in _0x235d7f){if(_0x235d7f['hasOwnProperty'](_0x1b61ca)){if(_0x1b61ca!=='providerResponse'){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xe7'),_0x1b61ca[_0x9964('0x67')]()),_0x235d7f[_0x1b61ca]);}}}this[_0x9964('0x3d')](_0x235d7f[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xec'),_0x235d7f['providerResponse']);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')]('DialogflowV2\x20Result\x20%s',_0x235d7f['speech']));}return this[_0x9964('0xe')][_0x9964('0x28')](_0x4dfbca,_0x9964('0xf2'));};AGIVertices[_0x9964('0x17')][_0x9964('0xf3')]=function(_0x519238){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x519238[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf4')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf5'));}if(!this['isConfigured'](_0x519238[_0x9964('0xf6')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20username\x20configured');}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf7')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf8'));}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf9')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x519238);this[_0x9964('0x3d')](_0x519238[_0x9964('0x57')],'in','','');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfa'),_0x519238[_0x9964('0x57')]));var _0x599510=this[_0x9964('0x7e')]['sync'](this,_0x519238);if(_0x599510){for(var _0x34a50b in _0x599510){if(_0x599510[_0x9964('0x90')](_0x34a50b)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xfb'),_0x34a50b[_0x9964('0x67')]()),_0x599510[_0x34a50b]);}}this[_0x9964('0x3d')](_0x599510[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xf3'),'');if(_0x599510['audiofile']){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfc'),_0x599510[_0x9964('0xfd')]));var _0x396803=this[_0x9964('0xe')][_0x9964('0xfe')](_0x599510['audiofile']);try{fs[_0x9964('0xff')](_0x599510[_0x9964('0xfd')]+_0x9964('0x100'));}catch(_0x38c44e){logger[_0x9964('0x28')](_0x38c44e);}return _0x396803;}else{return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('SestekNDA\x20Result\x20%s',_0x599510[_0x9964('0xea')]));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x519238,_0x9964('0x101'));};AGIVertices[_0x9964('0x17')][_0x9964('0x102')]=function(_0x17c7fb){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x103'),_0x17c7fb['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x102'));};AGIVertices[_0x9964('0x17')]['ext_dial']=function(_0x3df1f0){logger[_0x9964('0x2c')](util['format'](_0x9964('0x104'),_0x3df1f0['label']));var _0x4e1c9c='';if(_0x3df1f0['trunk_id']){if(!this['isConfigured'](_0x3df1f0[_0x9964('0x105')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}else{var _0x2415ae=parseInt(_0x3df1f0[_0x9964('0x105')],0xa);if(isNaN(_0x2415ae)){_0x4e1c9c=_0x3df1f0[_0x9964('0x105')];}else{_0x4e1c9c=this['getTrunk'][_0x9964('0x6c')](this,_0x3df1f0[_0x9964('0x105')]);if(!_0x4e1c9c){return this['channel']['error'](_0x3df1f0,_0x9964('0x107'));}}}}else if(_0x3df1f0[_0x9964('0x108')]){_0x4e1c9c=_0x3df1f0[_0x9964('0x108')];}else{return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}var _0x4f20a0=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util[_0x9964('0x98')](_0x9964('0x109'),_0x4e1c9c,_0x3df1f0['phone']),_0x3df1f0['timeout'],_0x3df1f0['opts'],_0x3df1f0[_0x9964('0x61')]]);if(_0x4f20a0[_0x9964('0xa6')]===-0x1){return _0x4f20a0;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x10a'),_0x9964('0xdf')));};AGIVertices['prototype'][_0x9964('0x10b')]=function(_0x1e90d8){logger['info'](util[_0x9964('0x98')](_0x9964('0x10c'),_0x1e90d8[_0x9964('0x34')]));return this['channel'][_0x9964('0xa7')](_0x9964('0x10b'));};AGIVertices[_0x9964('0x17')][_0x9964('0xd')]=function(_0x50e53f){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x50e53f[_0x9964('0x34')]));if(_0x50e53f[_0x9964('0xa3')]===0x0){return this[_0x9964('0xa2')](_0x50e53f);}_0x50e53f[_0x9964('0xa3')]-=0x1;if(!this[_0x9964('0x83')](_0x50e53f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10e'));}var _0x5659ff=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0x10d')]);if(!_0x5659ff){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10f'));}if(!this['isConfigured'](_0x50e53f[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e4505=this[_0x9964('0xe')]['getData'](_0x5659ff,_0x50e53f[_0x9964('0x110')],_0x50e53f[_0x9964('0x111')]);var _0x10836c=_0x4e4505['result']?_0x4e4505[_0x9964('0xa6')][_0x9964('0x9f')]():'';logger['info']('test',JSON[_0x9964('0x6f')](_0x4e4505));if(_0x4e4505[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x10836c);return _0x4e4505;}else if(_0x4e4505[_0x9964('0x9e')]==='timeout'){_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])?'x':'i';}else{_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])&&_0x10836c['length']<=parseInt(_0x50e53f['maxdigit'])?'x':'i';}var _0x1a4dfd=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0xd5')]);if(!_0x1a4dfd){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,'no\x20variable\x20found');}this[_0x9964('0xe')][_0x9964('0x9a')](_0x1a4dfd,_0x10836c);if(this['isConfigured'](_0x50e53f[_0x9964('0x112')])){var _0xd3ef5c=parseInt(_0x50e53f['hiddendigitsnum'],0xa);var _0x506efc=rs[_0x9964('0x113')]({'charset':'*','length':_0xd3ef5c});var _0x34f0de=_0x10836c[_0x9964('0x9b')];if(_0x34f0de>0x0){if(_0x34f0de>_0xd3ef5c){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x50e53f['hiddendigitspos']===_0x9964('0x114')?_0x506efc+_0x10836c[_0x9964('0x115')](_0xd3ef5c):_0x10836c[_0x9964('0x115')](0x0,_0x34f0de-_0xd3ef5c)+_0x506efc);}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,rs[_0x9964('0x113')]({'charset':'*','length':_0x34f0de}));}}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,'');}}else{this[_0x9964('0x32')]['sync'](this,_0x50e53f,_0x10836c);}return _0x4e4505;};AGIVertices[_0x9964('0x17')][_0x9964('0x116')]=function(_0x368456){logger['info'](util[_0x9964('0x98')](_0x9964('0x117'),_0x368456[_0x9964('0x34')]));return this[_0x9964('0xd')](_0x368456);};AGIVertices[_0x9964('0x17')][_0x9964('0x118')]=function(_0x37265){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x119'),_0x37265[_0x9964('0x34')]));this['createSquareDetailsReport']['sync'](this,_0x37265,_0x37265[_0x9964('0x11a')]);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x11b'),_0x37265[_0x9964('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x57fbf7){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x11c'),_0x57fbf7[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x89')])||!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x11d')])){return this['channel'][_0x9964('0xa7')](_0x9964('0x11e'));}if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x11f'),_0x57fbf7[_0x9964('0x57')]));var _0x4350f8=this['awsPolly'][_0x9964('0x6c')](this,_0x57fbf7);if(_0x4350f8){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x120'),_0x4350f8));var _0x1dda2d=this[_0x9964('0xe')]['streamFile'](_0x4350f8);try{fs[_0x9964('0xff')](_0x4350f8+'.wav');}catch(_0x164b4c){logger[_0x9964('0x28')](_0x164b4c);}return _0x1dda2d;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x57fbf7,_0x9964('0x121'));};AGIVertices[_0x9964('0x17')]['awslex']=function(_0x420faa){logger['info'](util[_0x9964('0x98')](_0x9964('0x122'),_0x420faa[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x420faa['aws_access_key_id'])||!this['isConfigured'](_0x420faa['aws_secret_access_key'])){return this['channel']['noop'](_0x9964('0x11e'));}if(!this['isConfigured'](_0x420faa['aws_bot_name'])){return this[_0x9964('0xe')]['noop'](_0x9964('0x123'));}if(!this['isConfigured'](_0x420faa[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x420faa);this[_0x9964('0x3d')](_0x420faa[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x124'),_0x420faa['text']));var _0x3deff7=this[_0x9964('0x88')][_0x9964('0x6c')](this,_0x420faa);if(_0x3deff7){for(var _0x4e0bc7 in _0x3deff7){if(_0x3deff7[_0x9964('0x90')](_0x4e0bc7)&&_['isString'](_0x3deff7[_0x4e0bc7])){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x125'),_0x4e0bc7['toUpperCase']()),_0x3deff7[_0x4e0bc7]);}}if(_[_0x9964('0x3f')](_0x3deff7[_0x9964('0x75')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3deff7[_0x9964('0x75')],'out',_0x9964('0x126'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x127'),_0x3deff7['message']));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x420faa,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9964('0x17')][_0x9964('0x128')]=function(_0x57369d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x129'),_0x57369d['label'],_0x57369d[_0x9964('0x63')]));if(!this[_0x9964('0x83')](_0x57369d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}var _0x569fd6=_0x9964('0x12a');var _0x1b4a64=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x25278d=util[_0x9964('0x98')]('%s.%s',_0x1b4a64,_0x569fd6);var _0x3c7901=!![];if(_0x57369d[_0x9964('0x12c')]===_0x9964('0x12d')){_0x3c7901=![];}var _0x1d7638=this[_0x9964('0xe')][_0x9964('0x12e')](_0x1b4a64,_0x569fd6,_0x57369d['intKey'],_0x57369d[_0x9964('0x63')],undefined,_0x3c7901);if(_0x1d7638[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('google\x20%s\x20file\x20created',_0x25278d));var _0x4ec225=this['googleASR'][_0x9964('0x6c')](this,_0x57369d,_0x25278d);if(_0x4ec225){for(var _0x127a1f in _0x4ec225){if(_0x4ec225['hasOwnProperty'](_0x127a1f)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x12f'),_0x127a1f[_0x9964('0x67')]()),_0x4ec225[_0x127a1f]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x130'),JSON[_0x9964('0x6f')](_0x4ec225)));}}return _0x1d7638;};AGIVertices[_0x9964('0x17')]['tildeasr']=function(_0x34671b){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x34671b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x131')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x132'));}if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x8c')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x133'));}var _0x211488=_0x9964('0x12a');var _0x580a19=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x18e305=util['format'](_0x9964('0x99'),_0x580a19,_0x211488);var _0x23543c=!![];if(_0x34671b['beep']===_0x9964('0x12d')){_0x23543c=![];}var _0x3b3e6b=this[_0x9964('0xe')][_0x9964('0x12e')](_0x580a19,_0x211488,_0x34671b[_0x9964('0x134')],_0x34671b['timeout'],undefined,_0x23543c);if(_0x3b3e6b['result']!==-0x1){this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x135'),_0x18e305));var _0x11f382=this['tildeASR'][_0x9964('0x6c')](this,_0x34671b,_0x18e305);if(_0x11f382){for(var _0x7703d in _0x11f382){if(_0x11f382[_0x9964('0x90')](_0x7703d)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')]('TILDE_ASR_%s',_0x7703d['toUpperCase']()),_0x11f382[_0x7703d]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('TildeASR\x20Result\x20%s',JSON[_0x9964('0x6f')](_0x11f382)));}}return _0x3b3e6b;};AGIVertices[_0x9964('0x17')][_0x9964('0x136')]=function(_0x3b744a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x137'),_0x3b744a[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x138')](_0x3b744a[_0x9964('0x39')],_0x3b744a[_0x9964('0x3a')],_0x3b744a[_0x9964('0x139')]);};AGIVertices[_0x9964('0x17')]['gotoif']=function(_0x56268a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x13a'),_0x56268a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x56268a[_0x9964('0x13b')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x56268a,_0x9964('0x13c'));}try{var _0x593a02=eval(_0x56268a['condition'])?_0x9964('0x13d'):'false';this['channel']['noop'](util[_0x9964('0x98')](_0x9964('0x13e'),_0x56268a[_0x9964('0x13b')],_0x593a02));return{'code':0xc8,'result':_0x593a02};}catch(_0x1440a4){return{'code':0xc8,'result':_0x9964('0x13f')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x140')]=function(_0x3a09d1){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x141'),_0x3a09d1['label']));if(!this[_0x9964('0x83')](_0x3a09d1[_0x9964('0x142')])){return this[_0x9964('0xe')]['error'](_0x3a09d1,_0x9964('0x143'));}var _0x21659b=this[_0x9964('0x23')][_0x9964('0x6c')](this,_0x3a09d1[_0x9964('0x142')]);if(!_0x21659b){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3a09d1,_0x9964('0x144'));}for(var _0x509f1e=0x0;_0x509f1e<_0x21659b[_0x9964('0x9b')];_0x509f1e+=0x1){var _0x4c45a3=this[_0x9964('0xe')]['getVariable'](util[_0x9964('0x98')](_0x9964('0x145'),_0x21659b[_0x509f1e]));if(_0x4c45a3[_0x9964('0xa6')]===-0x1){return _0x4c45a3;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x4c45a3[_0x9964('0x9e')]));if(_0x4c45a3[_0x9964('0x9e')]==='true'){logger['info'](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));return{'code':0xc8,'result':_0x9964('0x13d')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x9964('0x13f')));this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x146'),_0x21659b[_0x509f1e],'false'));}}return{'code':0xc8,'result':_0x9964('0x13f')};};AGIVertices[_0x9964('0x17')][_0x9964('0x147')]=function(_0x47e48f){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x148'),_0x47e48f['label']));return this[_0x9964('0xe')][_0x9964('0x147')]();};AGIVertices['prototype'][_0x9964('0x149')]=function(_0x136039){logger[_0x9964('0x2c')](util['format'](_0x9964('0x14a'),_0x136039[_0x9964('0x34')]));if(!this['isConfigured'](_0x136039[_0x9964('0x79')])){return this['channel']['noop'](_0x9964('0xe4'));}var _0x5775d0='wav';var _0x266979=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x4ff92f=util[_0x9964('0x98')](_0x9964('0x99'),_0x266979,_0x5775d0);var _0x2021dc=!![];if(_0x136039[_0x9964('0x12c')]===_0x9964('0x12d')){_0x2021dc=![];}var _0x515ed6=this[_0x9964('0xe')][_0x9964('0x12e')](_0x266979,_0x5775d0,_0x136039[_0x9964('0x134')],_0x136039['timeout'],undefined,_0x2021dc);if(_0x515ed6[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x14b'),_0x4ff92f));var _0x2c717d=this[_0x9964('0x81')][_0x9964('0x6c')](this,_0x136039,_0x4ff92f);if(_0x2c717d){for(var _0x32f6d4 in _0x2c717d){if(_0x2c717d['hasOwnProperty'](_0x32f6d4)){this['channel']['setVariable'](util[_0x9964('0x98')](_0x9964('0x14c'),_0x32f6d4['toUpperCase']()),_0x2c717d[_0x32f6d4]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x14d'),JSON[_0x9964('0x6f')](_0x2c717d)));}}return _0x515ed6;};AGIVertices['prototype'][_0x9964('0x14e')]=function(_0x3ca89b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x14f'),_0x3ca89b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3ca89b['key'])){return this[_0x9964('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x9964('0x83')](_0x3ca89b[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('Trying\x20ispeech\x20TTS\x20%s',_0x3ca89b['text']));var _0xfbb7f2=this[_0x9964('0x7f')][_0x9964('0x6c')](this,_0x3ca89b);if(_0xfbb7f2){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x14b'),_0xfbb7f2));var _0x1a9631=this[_0x9964('0xe')][_0x9964('0xfe')](_0xfbb7f2,_0x3ca89b['intKey']);try{fs['unlink'](_0xfbb7f2+_0x9964('0x100'));}catch(_0x73d597){logger[_0x9964('0x28')](_0x73d597);}return _0x1a9631;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3ca89b,_0x9964('0x150'));};AGIVertices[_0x9964('0x17')][_0x9964('0x151')]=function(_0x787730){logger['info'](util['format'](_0x9964('0x152'),_0x787730[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x787730[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x787730,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));var _0x1a11b9=this[_0x9964('0x50')][_0x9964('0x6c')](this,_0x787730['findBy']);if(_0x1a11b9){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util['format'](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')]['callerid'],_0x787730['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['logout']=function(_0x3ca563){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x15a'),_0x3ca563['label']));if(!this[_0x9964('0x83')](_0x3ca563[_0x9964('0x153')])){return this[_0x9964('0xe')]['error'](_0x3ca563,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));var _0x4fde68=this[_0x9964('0x4d')][_0x9964('0x6c')](this,_0x3ca563['findBy']);if(_0x4fde68){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger['info'](util[_0x9964('0x98')](_0x9964('0x158'),this['channel'][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x15b')]=function(_0x399ba2){logger[_0x9964('0x2c')](util['format'](_0x9964('0x15c'),_0x399ba2['label']));if(!this[_0x9964('0x83')](_0x399ba2[_0x9964('0x15d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x399ba2,_0x9964('0x15e'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x15f'),_0x399ba2[_0x9964('0x15d')]));var _0x16b2a3=eval(_0x399ba2[_0x9964('0x15d')]);if(!this['isConfigured'](_0x399ba2[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}var _0x4bf8a9=this[_0x9964('0x10')]['sync'](this,_0x399ba2[_0x9964('0xd5')]);if(!_0x4bf8a9){return this[_0x9964('0xe')]['error'](_0x399ba2,_0x9964('0xd6'));}if(_['isArray'](_0x16b2a3)){var _0x3c0494=this;_0x16b2a3[_0x9964('0xd7')](function(_0x2c2542,_0x224d94){_0x3c0494[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x161'),_0x4bf8a9,_0x224d94),_0x2c2542);});return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x162'),_0x4bf8a9));}else{return this[_0x9964('0xe')][_0x9964('0x9a')](_0x4bf8a9,_0x16b2a3);}};AGIVertices['prototype'][_0x9964('0xc')]=function(_0x32f80f){logger['info'](util['format'](_0x9964('0x163'),_0x32f80f['label']));if(_0x32f80f['retry']===0x0){return this[_0x9964('0xa2')](_0x32f80f);}_0x32f80f['retry']-=0x1;if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0x10e'));}var _0x5c041b=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0x10d')]);if(!_0x5c041b){return this['channel']['error'](_0x32f80f,'no\x20file\x20audio\x20found');}var _0x114abe=this[_0x9964('0xe')][_0x9964('0x164')](_0x5c041b,_0x32f80f[_0x9964('0x110')],_0x32f80f[_0x9964('0x165')]);var _0x31bbd1=_0x114abe[_0x9964('0xa6')];if(_0x114abe[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,'-1');return _0x114abe;}else if(_0x114abe[_0x9964('0x9e')]===_0x9964('0x63')){_0x114abe[_0x9964('0xa6')]=_0x114abe[_0x9964('0xa6')]['length']>0x0?_0x114abe[_0x9964('0xa6')]:'t';}else if(_[_0x9964('0x41')](_0x114abe[_0x9964('0xa6')])){_0x114abe[_0x9964('0xa6')]='#';_0x31bbd1='#';}if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0xd5')])){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}else{var _0x420452=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0xd5')]);if(!_0x420452){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](_0x420452,_0x31bbd1);}this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,_0x31bbd1);return _0x114abe;};AGIVertices[_0x9964('0x17')]['noop']=function(_0x2956ba){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x166'),_0x2956ba['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x2956ba['output']||_0x2956ba[_0x9964('0x34')]);};AGIVertices[_0x9964('0x17')]['pause']=function(_0x5d1692){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x167'),_0x5d1692['label']));if(!this[_0x9964('0x83')](_0x5d1692[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5d1692,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));var _0x5af231=this[_0x9964('0x49')][_0x9964('0x6c')](this,_0x5d1692[_0x9964('0x168')]);var _0x464f04=this[_0x9964('0x169')]['sync'](this,_0x5d1692['findBy'],_0x5af231);if(_0x464f04){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')]['callerid'],_0x5d1692[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x5d1692['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x16a')]=function(_0x4414b4){logger[_0x9964('0x2c')](util['format'](_0x9964('0x16b'),_0x4414b4[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x4414b4['file_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x4414b4,'no\x20file\x20audio\x20selected');}var _0xebef3a=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x4414b4[_0x9964('0x10d')]);if(!_0xebef3a){return this[_0x9964('0xe')]['error'](_0x4414b4,_0x9964('0x10f'));}var _0x27a326=this['channel']['exec'](_0x9964('0x16c'),[_0xebef3a,_0x4414b4[_0x9964('0xe1')]]);if(_0x27a326['result']===-0x1){return _0x27a326;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),'PLAYBACK',_0xebef3a));};AGIVertices[_0x9964('0x17')]['queue']=function(_0x57a83a){logger[_0x9964('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x57a83a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57a83a[_0x9964('0x16d')])){return this[_0x9964('0xe')]['error'](_0x57a83a,_0x9964('0x16e'));}var _0x129784='';var _0x2ac83b=parseInt(_0x57a83a[_0x9964('0x16d')],0xa);if(isNaN(_0x2ac83b)){_0x129784=_0x57a83a['queue_id'];}else{_0x129784=this['getVoiceQueue'][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x16d')]);if(!_0x129784){return this[_0x9964('0xe')][_0x9964('0x28')](_0x57a83a,_0x9964('0x16f'));}}var _0x2e9604='';if(this['isConfigured'](_0x57a83a[_0x9964('0x10d')])){var _0x304435=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x10d')]);if(_0x304435){_0x2e9604=_0x304435;}}this[_0x9964('0x32')]['sync'](this,_0x57a83a,_0x129784);if(_0x57a83a['opts'][_0x9964('0x170')]('x')<0x0){_0x57a83a[_0x9964('0xe1')]+='x';}if(_0x57a83a['opts'][_0x9964('0x170')]('X')<0x0){_0x57a83a[_0x9964('0xe1')]+='X';}this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x171'),_0x129784?_0x129784[_0x9964('0x172')]():'');var _0x1424d9=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0x173'),[_0x129784,_0x57a83a[_0x9964('0xe1')],_0x57a83a[_0x9964('0x61')],_0x2e9604,_0x57a83a[_0x9964('0x63')],_0x57a83a[_0x9964('0xb1')],_0x57a83a[_0x9964('0x174')],_0x57a83a[_0x9964('0x175')],'',_0x57a83a['position']]);if(_0x1424d9[_0x9964('0xa6')]===-0x1){return _0x1424d9;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x9964('0x173'),_0x129784));};AGIVertices[_0x9964('0x17')][_0x9964('0x176')]=function(_0x5273ee){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x177'),_0x5273ee['label']));var _0xb20037=_0x5273ee[_0x9964('0x178')]||_0x9964('0x12a');var _0x4b54ae=util['format']('%s_%s',this['channel'][_0x9964('0x33')],rs['generate'](0x5));var _0x505265=util[_0x9964('0x98')]('%s/recordings/%s.%s',FILES_PATH,_0x4b54ae,_0xb20037);var _0x47c8ca=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,_0x4b54ae);this[_0x9964('0x38')][_0x9964('0x6c')](this,_0x5273ee,_0x4b54ae,_0x505265);this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x179'),_0x4b54ae);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x47c8ca,_0xb20037,_0x5273ee[_0x9964('0x17a')],_0x5273ee[_0x9964('0x63')]);return this[_0x9964('0xe')][_0x9964('0x12e')](_0x47c8ca,_0xb20037,_0x5273ee['escape_digits'],_0x5273ee[_0x9964('0x63')],undefined,!![]);};AGIVertices[_0x9964('0x17')][_0x9964('0x17b')]=function(_0x314e2a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x17c'),_0x314e2a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x314e2a['url'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x17d'));}var _0x93b3f8=this[_0x9964('0x60')][_0x9964('0x6c')](this,_0x314e2a);logger['info'](util[_0x9964('0x98')]('Response:',util['inspect'](_0x93b3f8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x314e2a[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x17e'));}var _0xa848ad=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x314e2a[_0x9964('0xd5')]);if(!_0xa848ad){return this['channel'][_0x9964('0x28')](_0x314e2a,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](util['format'](_0x9964('0x17f'),_0xa848ad),_0x93b3f8[_0x9964('0x73')]?_0x93b3f8[_0x9964('0x73')]:_0x9964('0x180'));this[_0x9964('0xe')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0xa848ad),_0x93b3f8[_0x9964('0x74')]?_0x93b3f8[_0x9964('0x74')]:'OK');if(_0x93b3f8[_0x9964('0x70')]){try{this['saveRestApiResult'](_0x93b3f8[_0x9964('0x70')],_0xa848ad);}catch(_0x1725e2){logger[_0x9964('0x28')](util[_0x9964('0x98')](_0x9964('0x181'),_0xa848ad));}}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0xa848ad));};AGIVertices['prototype'][_0x9964('0x182')]=function(_0x8996c3){logger[_0x9964('0x2c')](util['format'](_0x9964('0x183'),_0x8996c3[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x184')](_0x8996c3[_0x9964('0x185')][_0x9964('0x53')](/\s+/g,''),_0x8996c3[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x186')]=function(_0x4dc77a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x187'),_0x4dc77a[_0x9964('0x34')]));return this['channel'][_0x9964('0x188')](_0x4dc77a[_0x9964('0x64')][_0x9964('0x53')](/\s+/g,''),_0x4dc77a['escape_digits']);};AGIVertices[_0x9964('0x17')][_0x9964('0x189')]=function(_0x2c9045){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x18a'),_0x2c9045['label']));return this[_0x9964('0xe')][_0x9964('0x18b')](_0x2c9045['text'],_0x2c9045[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x18c')]=function(_0x2989e5){logger['info'](util[_0x9964('0x98')](_0x9964('0x18d'),_0x2989e5[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x2989e5['account_id'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x18e'));}var _0x37539c=this[_0x9964('0x20')][_0x9964('0x6c')](this,_0x2989e5[_0x9964('0x18f')]);if(!_0x37539c||!_0x37539c['Smtp']){return this[_0x9964('0xe')]['error'](_0x2989e5,_0x9964('0x190'));}var _0x4aecc9={'from':util[_0x9964('0x98')](_0x9964('0x191'),_0x37539c[_0x9964('0x16')],_0x37539c[_0x9964('0x192')]||_0x37539c[_0x9964('0x193')]['user']),'to':_0x2989e5['to']||'','cc':_0x2989e5['cc']||'','bcc':_0x2989e5[_0x9964('0x194')]||'','subject':_0x2989e5['subject'],'html':_0x2989e5[_0x9964('0x57')],'text':_0x2989e5[_0x9964('0x57')]};if(this[_0x9964('0x83')](_0x2989e5[_0x9964('0x195')])){}logger[_0x9964('0x196')]('sendMail\x20message',JSON[_0x9964('0x6f')](_0x4aecc9));this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x2989e5,_0x2989e5[_0x9964('0x18f')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x197'),_0x37539c[_0x9964('0x16')]));this[_0x9964('0x21')][_0x9964('0x6c')](this,_0x37539c[_0x9964('0x198')],_0x4aecc9);return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x199'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19a')]=function(_0x273ace){logger[_0x9964('0x2c')](util['format'](_0x9964('0x19b'),_0x273ace[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x19c'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19d')]=function(_0x3631cb){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3631cb[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3631cb[_0x9964('0x19e')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x19f'));}var _0x4dbf83=this[_0x9964('0x2f')][_0x9964('0x6c')](this,_0x3631cb['sms_account_id']);if(!_0x4dbf83){return this[_0x9964('0xe')]['error'](_0x3631cb,'no\x20sms\x20account\x20found');}var _0x5b14cc={'body':_0x3631cb[_0x9964('0x1a0')],'phone':_0x3631cb['to']||'','SmsAccountId':_0x4dbf83['id']};logger[_0x9964('0x196')]('sendSMS\x20message',JSON[_0x9964('0x6f')](_0x5b14cc));this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x3631cb,_0x3631cb[_0x9964('0x19e')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1a1'),_0x4dbf83[_0x9964('0x16')]));this[_0x9964('0x31')][_0x9964('0x6c')](this,_0x5b14cc);return this[_0x9964('0xe')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9964('0x17')][_0x9964('0x1a2')]=function(_0x205314){logger[_0x9964('0x2c')](util['format'](_0x9964('0x1a3'),_0x205314[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x205314[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x205314,_0x9964('0x1a4'));}var _0x3629fe=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x205314[_0x9964('0xd5')]);if(!_0x3629fe){return this['channel'][_0x9964('0x28')](_0x205314,_0x9964('0xd6'));}return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3629fe,_0x205314[_0x9964('0x1a5')]);};AGIVertices['prototype'][_0x9964('0x1a6')]=function(_0x4a5bbf){logger['info'](util['format'](_0x9964('0x1a7'),_0x4a5bbf['label']));this[_0x9964('0xe')][_0x9964('0xa7')]('START\x20CALLY\x20SQUARE');var _0x34ce44=this[_0x9964('0xe')][_0x9964('0x10')](_0x9964('0x1a8'));if(!_[_0x9964('0x41')](_0x34ce44['extra'])){this['channel'][_0x9964('0x33')]=_0x34ce44[_0x9964('0x9e')];}if(_0x4a5bbf[_0x9964('0xb4')]===_0x9964('0x1a9')){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1aa'));return this[_0x9964('0xe')][_0x9964('0xb4')]();}return this[_0x9964('0xe')]['noop'](_0x9964('0x1ab'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1ac')]=function(_0x5a21f3){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ad'),_0x5a21f3[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a21f3['project_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1ae'));}var _0x98277c=this[_0x9964('0x1af')][_0x9964('0x6c')](this,_0x5a21f3['project_id']);if(!this['isConfigured'](_0x98277c)){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,util['format'](_0x9964('0x1b0'),_0x5a21f3[_0x9964('0x1b1')]));}if(_0x98277c===this[_0x9964('0xe')][_0x9964('0x36')]){return this['channel'][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1b2'));}this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x5a21f3,_0x98277c);var _0x33cd78=this[_0x9964('0xe')]['exec'](_0x9964('0x1b3'),util[_0x9964('0x98')](_0x9964('0x1b4'),config['agi']['host']||_0x9964('0x1b5'),_0x98277c,this[_0x9964('0xe')][_0x9964('0x36')]));if(_0x33cd78['result']===-0x1){return _0x33cd78;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),_0x9964('0x1b3'),_0x98277c));};AGIVertices[_0x9964('0x17')][_0x9964('0x1b6')]=function(_0x4a2a33){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4a2a33['label']));var _0x575a01=this[_0x9964('0x1b7')][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xb2')]);this[_0x9964('0x32')]['sync'](this,_0x4a2a33,_0x4a2a33[_0x9964('0xb2')]);if(this['isConfigured'](_0x4a2a33['variable_id'])){var _0x3f7189=this['getVariable'][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xd5')]);if(_0x3f7189){this[_0x9964('0xe')][_0x9964('0x9a')](_0x3f7189,_0x575a01);return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x1b8'),_0x4a2a33[_0x9964('0xb2')],_0x3f7189));}}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1b9'),_0x4a2a33[_0x9964('0xb2')]));};AGIVertices[_0x9964('0x17')]['google_cloud_tts']=function(_0x3db5f5){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ba'),_0x3db5f5[_0x9964('0x34')]));_0x3db5f5['text']=_0x3db5f5[_0x9964('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x3db5f5['apiKey'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1bb'));}if(!this['isConfigured'](_0x3db5f5[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1bc'),_0x3db5f5[_0x9964('0x57')]));var _0x4a30f7=this['googleCloudTTS']['sync'](this,_0x3db5f5);if(_0x4a30f7){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1bd'),_0x4a30f7));var _0x2161f3=this[_0x9964('0xe')]['streamFile'](_0x4a30f7);try{fs[_0x9964('0xff')](_0x4a30f7+_0x9964('0x100'));}catch(_0x42d2c2){logger[_0x9964('0x28')](_0x42d2c2);}return _0x2161f3;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3db5f5,_0x9964('0x1be'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1bf')]=function(_0x6ada9a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c0'),_0x6ada9a[_0x9964('0x34')]));_0x6ada9a['text']=_0x6ada9a[_0x9964('0x57')][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x6ada9a[_0x9964('0x57')])){return this['channel'][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1c1'),_0x6ada9a[_0x9964('0x57')]));var _0x175b70=this[_0x9964('0x5e')][_0x9964('0x6c')](this,_0x6ada9a);if(_0x175b70){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1c2'),_0x175b70));var _0x159555=this[_0x9964('0xe')]['streamFile'](_0x175b70);try{fs['unlink'](_0x175b70+'.wav');}catch(_0x1daf82){logger[_0x9964('0x28')](_0x1daf82);}return _0x159555;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x6ada9a,_0x9964('0x1c3'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c4')]=function(_0x1a5649){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c5'),_0x1a5649[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x1a5649[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x1a5649,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this['channel'][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));var _0x1b516b=this['agentUnpause'][_0x9964('0x6c')](this,_0x1a5649[_0x9964('0x153')]);if(_0x1b516b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x1a5649['findBy']));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['voicemail']=function(_0x48c502){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x48c502[_0x9964('0x34')]));var _0x1e6dec=this[_0x9964('0xe')]['exec'](_0x9964('0x1c6'),[_0x48c502[_0x9964('0x1c7')],_0x48c502[_0x9964('0x77')]]);if(_0x1e6dec[_0x9964('0xa6')]===-0x1){return _0x1e6dec;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s\x20%s',_0x9964('0x1c6'),_0x48c502['mailbox']));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c8')]=function(_0x5a9fe9){logger['info'](util['format'](_0x9964('0x1c9'),_0x5a9fe9[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a9fe9['variable_id'])){return this['channel']['error'](_0x5a9fe9,_0x9964('0x1a4'));}var _0x144ea7=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x5a9fe9[_0x9964('0xd5')]);if(!_0x144ea7){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a9fe9,_0x9964('0xd6'));}var _0x4f5681=this[_0x9964('0xe')]['getVariable'](_0x144ea7);return{'code':0xc8,'result':_0x4f5681['extra']?_0x4f5681[_0x9964('0x9e')]:'-'};};String[_0x9964('0x17')]['replaceAll']=function(_0x2110b9,_0x50add4){return this[_0x9964('0x9c')](_0x2110b9)[_0x9964('0x1ca')](_0x50add4);};module[_0x9964('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 59de23a..655a4a2 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 _0xdaa4=['destlinkedid','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','then','error','[%s][UPDATE][ERRORS:%s]','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','Action','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','message','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','ACW','update','[%s][UPDATE][ACWTIME:%s]','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','interface'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xdaa4,0xd0));var _0x4daa=function(_0x5afdda,_0x422b72){_0x5afdda=_0x5afdda-0x0;var _0x4a7bd6=_0xdaa4[_0x5afdda];return _0x4a7bd6;};'use strict';var _=require(_0x4daa('0x0'));var moment=require('moment');var ami=require(_0x4daa('0x1'));var logger=require(_0x4daa('0x2'))(_0x4daa('0x3'));var RpcUser=require(_0x4daa('0x4'));var RpcVoiceAgentReport=require(_0x4daa('0x5'));function Acw(_0x331ce2){this[_0x4daa('0x6')]=_0x331ce2[_0x4daa('0x6')];this[_0x4daa('0x7')]=_0x331ce2[_0x4daa('0x7')];this[_0x4daa('0x8')]=_0x331ce2['timers'];this[_0x4daa('0x9')]={};ami['on'](_0x4daa('0xa'),this[_0x4daa('0xb')]['bind'](this));ami['on'](_0x4daa('0xc'),this[_0x4daa('0xd')][_0x4daa('0xe')](this));ami['on'](_0x4daa('0xf'),this[_0x4daa('0x10')][_0x4daa('0xe')](this));ami['on'](_0x4daa('0x11'),this[_0x4daa('0x12')][_0x4daa('0xe')](this));ami['on'](_0x4daa('0x13'),this[_0x4daa('0x14')][_0x4daa('0xe')](this));ami['on'](_0x4daa('0x15'),this[_0x4daa('0x16')]['bind'](this));ami['on'](_0x4daa('0x17'),this[_0x4daa('0x18')]['bind'](this));}function getDiff(_0x26feb5){var _0x4f22eb=moment()[_0x4daa('0x19')](0x0);var _0x19ee90=moment(_0x26feb5)[_0x4daa('0x19')](0x0);return _0x4f22eb[_0x4daa('0x1a')](_0x19ee90,'seconds');}Acw[_0x4daa('0x1b')][_0x4daa('0x1c')]=function(_0x1c9c63,_0x585cc9){var _0x4ed7c4=this;var _0x1d97b0=getDiff(_0x4ed7c4[_0x4daa('0x8')][_0x1c9c63][_0x4daa('0x1d')]);clearTimeout(_0x4ed7c4[_0x4daa('0x8')][_0x1c9c63]['timer']);_0x4ed7c4[_0x4daa('0x8')][_0x1c9c63][_0x4daa('0x1e')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x1d97b0},_0x4ed7c4[_0x4daa('0x8')][_0x1c9c63]['uniqueid'],_0x1c9c63)[_0x4daa('0x1f')](function(_0x2bb939){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x585cc9,_0x1d97b0,_0x2bb939);})['catch'](function(_0x5da692){logger[_0x4daa('0x20')](_0x4daa('0x21'),_0x585cc9,_0x5da692);})['finally'](function(){delete _0x4ed7c4[_0x4daa('0x8')][_0x1c9c63];});};Acw[_0x4daa('0x1b')][_0x4daa('0x22')]=function(_0x3eb2a5){try{var _0x271985=this;var _0x5d4aee=this['channels'][_0x3eb2a5]['interface'];var _0x4fef54=this[_0x4daa('0x9')][_0x3eb2a5][_0x4daa('0x23')];var _0x177d9c=this[_0x4daa('0x6')][_0x4fef54];var _0x3aa374=![];var _0x48fb9d='ACW';if(_0x177d9c[_0x4daa('0x24')]&&_0x177d9c[_0x4daa('0x25')]['name']){_0x3aa374=!![];_0x48fb9d=_0x177d9c['mandatoryDispositionPause']['name'];}return ami[_0x4daa('0x26')]({'action':'QueuePause','interface':_0x5d4aee,'paused':!![],'reason':_0x48fb9d})['then'](function(){if(_0x271985[_0x4daa('0x7')][_0x5d4aee]){return RpcUser['getAgent'](_0x271985[_0x4daa('0x7')][_0x5d4aee]['id'])[_0x4daa('0x1f')](function(_0xccbf2){if(!_0xccbf2||_0xccbf2[_0x4daa('0x27')]){logger[_0x4daa('0x28')](_0x4daa('0x29'),_0x3eb2a5,_0x5d4aee,_0x4fef54);return;}logger[_0x4daa('0x28')](_0x4daa('0x2a'),_0x3eb2a5,_0x5d4aee,_0x4fef54);var _0x3c8eb4=_0x271985[_0x4daa('0x9')][_0x3eb2a5]['attended']&&_0x271985['channels'][_0x3eb2a5]['destlinkedid']?_0x271985[_0x4daa('0x9')][_0x3eb2a5]['destlinkedid']:_0x3eb2a5;return RpcUser['savePause'](_0x271985[_0x4daa('0x7')][_0x5d4aee],_0x48fb9d,_0x3c8eb4)['then'](function(_0x2a7b08){_0x271985[_0x4daa('0x6')][_0x4fef54][_0x4daa('0x2b')]-=0x1;_0x271985[_0x4daa('0x6')][_0x4fef54][_0x4daa('0x2c')]+=0x1;return _0x2a7b08;});})[_0x4daa('0x1f')](function(_0x538623){if(_0x3aa374||!_0x538623){return;}_0x271985[_0x4daa('0x8')][_0x5d4aee]={};logger[_0x4daa('0x28')](_0x4daa('0x2d'),_0x3eb2a5,_0x271985[_0x4daa('0x6')][_0x4fef54][_0x4daa('0x2e')],_0x5d4aee,_0x4fef54);_0x271985[_0x4daa('0x8')][_0x5d4aee][_0x4daa('0x1e')]=setTimeout(_0x271985[_0x4daa('0x2f')][_0x4daa('0xe')](_0x271985,_0x5d4aee),_0x271985['voiceQueues'][_0x4fef54][_0x4daa('0x2e')]*0x3e8);_0x271985[_0x4daa('0x8')][_0x5d4aee]['lastPauseAt']=moment()[_0x4daa('0x30')](_0x4daa('0x31'));_0x271985['timers'][_0x5d4aee][_0x4daa('0x32')]=_0x3eb2a5;_0x271985[_0x4daa('0x8')][_0x5d4aee][_0x4daa('0x23')]=_0x4fef54;_0x271985[_0x4daa('0x8')][_0x5d4aee][_0x4daa('0x1c')]=_0x271985[_0x4daa('0x1c')][_0x4daa('0xe')](_0x271985,_0x5d4aee,_0x3eb2a5);});}})['catch'](function(){logger[_0x4daa('0x20')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3eb2a5,_0x271985[_0x4daa('0x6')][_0x4fef54][_0x4daa('0x2e')],_0x5d4aee,_0x4fef54);})['finally'](function(){delete _0x271985[_0x4daa('0x9')][_0x3eb2a5];});}catch(_0x308e2d){logger[_0x4daa('0x20')]('[ACW][START]\x20%s',_0x308e2d[_0x4daa('0x33')]);}};Acw[_0x4daa('0x1b')][_0x4daa('0x2f')]=function(_0xc55541){try{var _0x2abdef=this;if(_0x2abdef['timers'][_0xc55541]){_0x2abdef[_0x4daa('0x8')][_0xc55541]['timer']=![];var _0x7a658=_0x2abdef[_0x4daa('0x8')][_0xc55541]['uniqueid'];var _0x498466=_0x2abdef['timers'][_0xc55541][_0x4daa('0x23')];var _0x5b3009=_0x2abdef[_0x4daa('0x6')][_0x498466]['acwTimeout'];logger['info'](_0x4daa('0x34'),_0x7a658,_0xc55541);RpcUser[_0x4daa('0x35')](this[_0x4daa('0x7')][_0xc55541]['id'])[_0x4daa('0x1f')](function(_0x589cb7){if(_0x589cb7[_0x4daa('0x36')]===_0x4daa('0x37')){return RpcUser['saveUnpause'](_0x2abdef[_0x4daa('0x7')][_0xc55541]);}});RpcVoiceAgentReport[_0x4daa('0x38')]({'acwtime':_0x5b3009,'agentacw':!![]},_0x7a658,_0xc55541)[_0x4daa('0x1f')](function(_0x32b3b6){logger[_0x4daa('0x28')](_0x4daa('0x39'),_0x7a658,_0x5b3009,_0x32b3b6);})[_0x4daa('0x3a')](function(_0x194655){logger['error'](_0x4daa('0x21'),_0x7a658,_0x194655);});}else{logger[_0x4daa('0x20')](_0x4daa('0x3b'),_0xc55541);if(_0x2abdef[_0x4daa('0x8')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x2abdef['timers']));}}}catch(_0x191d6e){logger[_0x4daa('0x20')](_0x4daa('0x3c'),_0x191d6e['message']);}};Acw[_0x4daa('0x1b')][_0x4daa('0xb')]=function(_0x3da45f){try{if(this[_0x4daa('0x6')][_0x3da45f[_0x4daa('0x23')]]&&(this[_0x4daa('0x6')][_0x3da45f[_0x4daa('0x23')]][_0x4daa('0x3')]||this[_0x4daa('0x6')][_0x3da45f[_0x4daa('0x23')]][_0x4daa('0x24')])){if(this['agents'][_0x3da45f['interface']]){this['channels'][_0x3da45f['uniqueid']]={'queue':_0x3da45f[_0x4daa('0x23')],'interface':_0x3da45f[_0x4daa('0x3d')],'destlinkedid':_0x3da45f[_0x4daa('0x3e')]};}}}catch(_0x44cd9f){logger[_0x4daa('0x20')](_0x4daa('0x3f'),_0x44cd9f[_0x4daa('0x33')]);}};Acw[_0x4daa('0x1b')][_0x4daa('0x18')]=function(_0x175673){try{if(this[_0x4daa('0x6')][_0x175673['queue']]&&(this[_0x4daa('0x6')][_0x175673[_0x4daa('0x23')]]['acw']||this[_0x4daa('0x6')][_0x175673[_0x4daa('0x23')]][_0x4daa('0x24')])){if(this['agents'][_0x175673[_0x4daa('0x3d')]]){this[_0x4daa('0x9')][_0x175673[_0x4daa('0x32')]]={'queue':_0x175673['queue'],'interface':_0x175673['interface']};}}}catch(_0x1fdc2a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1fdc2a[_0x4daa('0x33')]);}};Acw[_0x4daa('0x1b')][_0x4daa('0xd')]=function(_0x4bf14c){try{if(this['channels'][_0x4bf14c[_0x4daa('0x32')]]&&_[_0x4daa('0x40')](this['channels'][_0x4bf14c[_0x4daa('0x32')]][_0x4daa('0x41')])){logger[_0x4daa('0x28')](_0x4daa('0x42'),_0x4bf14c['uniqueid']);this['startAcw'](_0x4bf14c[_0x4daa('0x32')]);}else if(this['channels'][_0x4bf14c[_0x4daa('0x43')]]&&_[_0x4daa('0x40')](this[_0x4daa('0x9')][_0x4bf14c[_0x4daa('0x43')]][_0x4daa('0x41')])){logger['info'](_0x4daa('0x44'),_0x4bf14c[_0x4daa('0x43')]);this[_0x4daa('0x22')](_0x4bf14c['linkedid']);}}catch(_0x26f124){logger[_0x4daa('0x20')](_0x4daa('0x45'),_0x26f124[_0x4daa('0x33')]);}};Acw['prototype'][_0x4daa('0x10')]=function(_0x2022c4){try{if(this[_0x4daa('0x9')][_0x2022c4[_0x4daa('0x32')]]&&this[_0x4daa('0x9')][_0x2022c4[_0x4daa('0x32')]][_0x4daa('0x41')]){logger['info'](_0x4daa('0x46'),_0x2022c4[_0x4daa('0x32')]);this['startAcw'](_0x2022c4['uniqueid']);}else if(this[_0x4daa('0x9')][_0x2022c4[_0x4daa('0x43')]]&&this[_0x4daa('0x9')][_0x2022c4['linkedid']][_0x4daa('0x41')]){logger[_0x4daa('0x28')](_0x4daa('0x47'),_0x2022c4[_0x4daa('0x43')]);this[_0x4daa('0x22')](_0x2022c4[_0x4daa('0x43')]);}}catch(_0x11783e){logger[_0x4daa('0x20')]('[ACW][syncHangup]\x20%s',_0x11783e[_0x4daa('0x33')]);}};Acw[_0x4daa('0x1b')][_0x4daa('0x14')]=function(_0x368c10){try{if(!_[_0x4daa('0x48')](this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x49')]])){this[_0x4daa('0x22')](_0x368c10['transfereeuniqueid']);if(this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4a')]]){this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4a')]][_0x4daa('0x41')]=!![];this['channels'][_0x368c10[_0x4daa('0x4b')]]=this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4a')]];delete this['channels'][_0x368c10[_0x4daa('0x4a')]];}}else if(!_[_0x4daa('0x48')](this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4b')]])){this['startAcw'](_0x368c10['transfertargetuniqueid']);if(this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4c')]]){this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4c')]][_0x4daa('0x41')]=!![];this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x49')]]=this[_0x4daa('0x9')][_0x368c10[_0x4daa('0x4c')]];delete this[_0x4daa('0x9')][_0x368c10['origtransfereruniqueid']];}}}catch(_0x239fcc){logger[_0x4daa('0x20')](_0x4daa('0x4d'),_0x239fcc['message']);}};Acw[_0x4daa('0x1b')][_0x4daa('0x16')]=function(_0x47de9c){try{if(this[_0x4daa('0x9')][_0x47de9c[_0x4daa('0x4e')]]){logger[_0x4daa('0x28')](_0x4daa('0x4f'),JSON['stringify'](_0x47de9c[_0x4daa('0x4e')]));this[_0x4daa('0x22')](_0x47de9c[_0x4daa('0x4e')]);}else if(this['channels'][_0x47de9c[_0x4daa('0x50')]]){logger[_0x4daa('0x28')](_0x4daa('0x51'),JSON[_0x4daa('0x52')](_0x47de9c[_0x4daa('0x50')]));this['startAcw'](_0x47de9c['transfererlinkedid']);}}catch(_0x40e8d2){logger[_0x4daa('0x20')](_0x4daa('0x53'),_0x40e8d2[_0x4daa('0x33')]);}};Acw['prototype'][_0x4daa('0x12')]=function(_0x4b025c){try{if(this['voiceQueues'][_0x4b025c['queue']]&&this[_0x4daa('0x6')][_0x4b025c['queue']][_0x4daa('0x54')]===_0x4daa('0x55')){if(this[_0x4daa('0x7')][_0x4b025c[_0x4daa('0x3d')]]){logger[_0x4daa('0x28')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4b025c[_0x4daa('0x32')],_0x4b025c[_0x4daa('0x3d')],_0x4b025c[_0x4daa('0x23')]);return RpcUser[_0x4daa('0x56')](this[_0x4daa('0x7')][_0x4b025c['interface']],_0x4daa('0x57'),_0x4b025c['uniqueid']);}}}catch(_0x1866a7){logger[_0x4daa('0x20')](_0x4daa('0x58'),_0x1866a7[_0x4daa('0x33')]);}};module[_0x4daa('0x59')]=Acw; \ No newline at end of file +var _0xb7df=['channels','agentconnect','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','bind','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDispositionPause','name','Action','then','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','stopAcw','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','moment','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb7df,0x193));var _0xfb7d=function(_0x2acaf8,_0x2fda8f){_0x2acaf8=_0x2acaf8-0x0;var _0xe99da9=_0xb7df[_0x2acaf8];return _0xe99da9;};'use strict';var _=require(_0xfb7d('0x0'));var moment=require(_0xfb7d('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xfb7d('0x2'));var RpcVoiceAgentReport=require(_0xfb7d('0x3'));function Acw(_0x3535cb){this[_0xfb7d('0x4')]=_0x3535cb[_0xfb7d('0x4')];this[_0xfb7d('0x5')]=_0x3535cb[_0xfb7d('0x5')];this[_0xfb7d('0x6')]=_0x3535cb[_0xfb7d('0x6')];this[_0xfb7d('0x7')]={};ami['on'](_0xfb7d('0x8'),this['syncAgentConnect']['bind'](this));ami['on'](_0xfb7d('0x9'),this['syncHangupRequest']['bind'](this));ami['on'](_0xfb7d('0xa'),this[_0xfb7d('0xb')]['bind'](this));ami['on'](_0xfb7d('0xc'),this[_0xfb7d('0xd')][_0xfb7d('0xe')](this));ami['on'](_0xfb7d('0xf'),this[_0xfb7d('0x10')][_0xfb7d('0xe')](this));ami['on'](_0xfb7d('0x11'),this['syncBlindTransfer'][_0xfb7d('0xe')](this));ami['on'](_0xfb7d('0x12'),this[_0xfb7d('0x13')][_0xfb7d('0xe')](this));}function getDiff(_0x3185ed){var _0x4c6069=moment()[_0xfb7d('0x14')](0x0);var _0x3bf45b=moment(_0x3185ed)[_0xfb7d('0x14')](0x0);return _0x4c6069[_0xfb7d('0x15')](_0x3bf45b,'seconds');}Acw[_0xfb7d('0x16')][_0xfb7d('0x17')]=function(_0x2eb266,_0x255d85){var _0x30160c=this;var _0x2026c9=getDiff(_0x30160c[_0xfb7d('0x6')][_0x2eb266]['lastPauseAt']);clearTimeout(_0x30160c[_0xfb7d('0x6')][_0x2eb266]['timer']);_0x30160c[_0xfb7d('0x6')][_0x2eb266][_0xfb7d('0x18')]=![];return RpcVoiceAgentReport[_0xfb7d('0x19')]({'acwtime':_0x2026c9},_0x30160c[_0xfb7d('0x6')][_0x2eb266][_0xfb7d('0x1a')],_0x2eb266)['then'](function(_0x24b4cd){logger[_0xfb7d('0x1b')](_0xfb7d('0x1c'),_0x255d85,_0x2026c9,_0x24b4cd);})[_0xfb7d('0x1d')](function(_0x1f8209){logger[_0xfb7d('0x1e')](_0xfb7d('0x1f'),_0x255d85,_0x1f8209);})[_0xfb7d('0x20')](function(){delete _0x30160c[_0xfb7d('0x6')][_0x2eb266];});};Acw[_0xfb7d('0x16')]['startAcw']=function(_0x1f04d6){try{var _0x78bba0=this;var _0x5be6e7=this[_0xfb7d('0x7')][_0x1f04d6][_0xfb7d('0x21')];var _0x351650=this[_0xfb7d('0x7')][_0x1f04d6][_0xfb7d('0x22')];var _0x19424d=this[_0xfb7d('0x4')][_0x351650];var _0xf58683=![];var _0x5b8a28=_0xfb7d('0x23');if(_0x19424d['mandatoryDisposition']&&_0x19424d[_0xfb7d('0x24')][_0xfb7d('0x25')]){_0xf58683=!![];_0x5b8a28=_0x19424d[_0xfb7d('0x24')]['name'];}return ami[_0xfb7d('0x26')]({'action':'QueuePause','interface':_0x5be6e7,'paused':!![],'reason':_0x5b8a28})[_0xfb7d('0x27')](function(){if(_0x78bba0['agents'][_0x5be6e7]){return RpcUser['getAgent'](_0x78bba0['agents'][_0x5be6e7]['id'])[_0xfb7d('0x27')](function(_0x4061bf){if(!_0x4061bf||_0x4061bf['voicePause']){logger[_0xfb7d('0x1b')](_0xfb7d('0x28'),_0x1f04d6,_0x5be6e7,_0x351650);return;}logger[_0xfb7d('0x1b')](_0xfb7d('0x29'),_0x1f04d6,_0x5be6e7,_0x351650);var _0x7d594e=_0x78bba0[_0xfb7d('0x7')][_0x1f04d6][_0xfb7d('0x2a')]&&_0x78bba0['channels'][_0x1f04d6][_0xfb7d('0x2b')]?_0x78bba0[_0xfb7d('0x7')][_0x1f04d6][_0xfb7d('0x2b')]:_0x1f04d6;return RpcUser[_0xfb7d('0x2c')](_0x78bba0['agents'][_0x5be6e7],_0x5b8a28,_0x7d594e)[_0xfb7d('0x27')](function(_0x89fdb7){_0x78bba0['voiceQueues'][_0x351650]['available']-=0x1;_0x78bba0['voiceQueues'][_0x351650]['paused']+=0x1;return _0x89fdb7;});})[_0xfb7d('0x27')](function(_0x1f12ef){if(_0xf58683||!_0x1f12ef){return;}_0x78bba0[_0xfb7d('0x6')][_0x5be6e7]={};logger[_0xfb7d('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1f04d6,_0x78bba0[_0xfb7d('0x4')][_0x351650]['acwTimeout'],_0x5be6e7,_0x351650);_0x78bba0[_0xfb7d('0x6')][_0x5be6e7][_0xfb7d('0x18')]=setTimeout(_0x78bba0[_0xfb7d('0x2d')][_0xfb7d('0xe')](_0x78bba0,_0x5be6e7),_0x78bba0[_0xfb7d('0x4')][_0x351650][_0xfb7d('0x2e')]*0x3e8);_0x78bba0[_0xfb7d('0x6')][_0x5be6e7]['lastPauseAt']=moment()['format'](_0xfb7d('0x2f'));_0x78bba0[_0xfb7d('0x6')][_0x5be6e7][_0xfb7d('0x1a')]=_0x1f04d6;_0x78bba0[_0xfb7d('0x6')][_0x5be6e7][_0xfb7d('0x22')]=_0x351650;_0x78bba0[_0xfb7d('0x6')][_0x5be6e7][_0xfb7d('0x17')]=_0x78bba0[_0xfb7d('0x17')][_0xfb7d('0xe')](_0x78bba0,_0x5be6e7,_0x1f04d6);});}})[_0xfb7d('0x1d')](function(){logger['error'](_0xfb7d('0x30'),_0x1f04d6,_0x78bba0[_0xfb7d('0x4')][_0x351650][_0xfb7d('0x2e')],_0x5be6e7,_0x351650);})[_0xfb7d('0x20')](function(){delete _0x78bba0[_0xfb7d('0x7')][_0x1f04d6];});}catch(_0x32dbe7){logger[_0xfb7d('0x1e')]('[ACW][START]\x20%s',_0x32dbe7['message']);}};Acw[_0xfb7d('0x16')]['stopAcw']=function(_0x3085a0){try{var _0x56b49d=this;if(_0x56b49d[_0xfb7d('0x6')][_0x3085a0]){_0x56b49d[_0xfb7d('0x6')][_0x3085a0][_0xfb7d('0x18')]=![];var _0x40f14f=_0x56b49d['timers'][_0x3085a0][_0xfb7d('0x1a')];var _0x2a06cc=_0x56b49d['timers'][_0x3085a0][_0xfb7d('0x22')];var _0xc1a683=_0x56b49d[_0xfb7d('0x4')][_0x2a06cc][_0xfb7d('0x2e')];logger[_0xfb7d('0x1b')](_0xfb7d('0x31'),_0x40f14f,_0x3085a0);RpcUser[_0xfb7d('0x32')](this[_0xfb7d('0x5')][_0x3085a0]['id'])[_0xfb7d('0x27')](function(_0x4e5476){if(_0x4e5476[_0xfb7d('0x33')]===_0xfb7d('0x23')){return RpcUser[_0xfb7d('0x34')](_0x56b49d[_0xfb7d('0x5')][_0x3085a0]);}});RpcVoiceAgentReport[_0xfb7d('0x19')]({'acwtime':_0xc1a683,'agentacw':!![]},_0x40f14f,_0x3085a0)['then'](function(_0x54f78c){logger[_0xfb7d('0x1b')](_0xfb7d('0x1c'),_0x40f14f,_0xc1a683,_0x54f78c);})[_0xfb7d('0x1d')](function(_0x1e42f7){logger['error'](_0xfb7d('0x1f'),_0x40f14f,_0x1e42f7);});}else{logger['error'](_0xfb7d('0x35'),_0x3085a0);if(_0x56b49d[_0xfb7d('0x6')]){logger['info'](_0xfb7d('0x36'),JSON[_0xfb7d('0x37')](_0x56b49d[_0xfb7d('0x6')]));}}}catch(_0x274a39){logger['error'](_0xfb7d('0x38'),_0x274a39[_0xfb7d('0x39')]);}};Acw['prototype']['syncAgentConnect']=function(_0x3ac9df){try{if(this[_0xfb7d('0x4')][_0x3ac9df[_0xfb7d('0x22')]]&&(this[_0xfb7d('0x4')][_0x3ac9df[_0xfb7d('0x22')]]['acw']||this[_0xfb7d('0x4')][_0x3ac9df[_0xfb7d('0x22')]][_0xfb7d('0x3a')])){if(this[_0xfb7d('0x5')][_0x3ac9df[_0xfb7d('0x21')]]){this[_0xfb7d('0x7')][_0x3ac9df[_0xfb7d('0x1a')]]={'queue':_0x3ac9df[_0xfb7d('0x22')],'interface':_0x3ac9df[_0xfb7d('0x21')],'destlinkedid':_0x3ac9df[_0xfb7d('0x2b')]};}}}catch(_0x54dbd2){logger[_0xfb7d('0x1e')](_0xfb7d('0x3b'),_0x54dbd2[_0xfb7d('0x39')]);}};Acw['prototype'][_0xfb7d('0x13')]=function(_0x248ad4){try{if(this[_0xfb7d('0x4')][_0x248ad4[_0xfb7d('0x22')]]&&(this[_0xfb7d('0x4')][_0x248ad4['queue']][_0xfb7d('0x3c')]||this[_0xfb7d('0x4')][_0x248ad4[_0xfb7d('0x22')]][_0xfb7d('0x3a')])){if(this[_0xfb7d('0x5')][_0x248ad4[_0xfb7d('0x21')]]){this[_0xfb7d('0x7')][_0x248ad4[_0xfb7d('0x1a')]]={'queue':_0x248ad4[_0xfb7d('0x22')],'interface':_0x248ad4[_0xfb7d('0x21')]};}}}catch(_0x3a2284){logger['error'](_0xfb7d('0x3d'),_0x3a2284['message']);}};Acw[_0xfb7d('0x16')][_0xfb7d('0x3e')]=function(_0x47416a){try{if(this[_0xfb7d('0x7')][_0x47416a[_0xfb7d('0x1a')]]&&_[_0xfb7d('0x3f')](this[_0xfb7d('0x7')][_0x47416a[_0xfb7d('0x1a')]]['attended'])){logger['info'](_0xfb7d('0x40'),_0x47416a[_0xfb7d('0x1a')]);this[_0xfb7d('0x41')](_0x47416a['uniqueid']);}else if(this[_0xfb7d('0x7')][_0x47416a['linkedid']]&&_[_0xfb7d('0x3f')](this[_0xfb7d('0x7')][_0x47416a[_0xfb7d('0x42')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x47416a['linkedid']);this[_0xfb7d('0x41')](_0x47416a[_0xfb7d('0x42')]);}}catch(_0x219487){logger[_0xfb7d('0x1e')](_0xfb7d('0x43'),_0x219487[_0xfb7d('0x39')]);}};Acw[_0xfb7d('0x16')][_0xfb7d('0xb')]=function(_0x5eca28){try{if(this['channels'][_0x5eca28[_0xfb7d('0x1a')]]&&this[_0xfb7d('0x7')][_0x5eca28[_0xfb7d('0x1a')]][_0xfb7d('0x2a')]){logger['info'](_0xfb7d('0x44'),_0x5eca28[_0xfb7d('0x1a')]);this[_0xfb7d('0x41')](_0x5eca28['uniqueid']);}else if(this[_0xfb7d('0x7')][_0x5eca28[_0xfb7d('0x42')]]&&this[_0xfb7d('0x7')][_0x5eca28['linkedid']][_0xfb7d('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5eca28['linkedid']);this[_0xfb7d('0x41')](_0x5eca28[_0xfb7d('0x42')]);}}catch(_0x49ae1f){logger[_0xfb7d('0x1e')](_0xfb7d('0x45'),_0x49ae1f[_0xfb7d('0x39')]);}};Acw[_0xfb7d('0x16')][_0xfb7d('0x10')]=function(_0x279364){try{if(!_[_0xfb7d('0x46')](this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x47')]])){this[_0xfb7d('0x41')](_0x279364['transfereeuniqueid']);if(this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x48')]]){this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x48')]][_0xfb7d('0x2a')]=!![];this[_0xfb7d('0x7')][_0x279364['transfertargetuniqueid']]=this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x48')]];delete this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x48')]];}}else if(!_[_0xfb7d('0x46')](this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x49')]])){this[_0xfb7d('0x41')](_0x279364[_0xfb7d('0x49')]);if(this[_0xfb7d('0x7')][_0x279364['origtransfereruniqueid']]){this['channels'][_0x279364['origtransfereruniqueid']][_0xfb7d('0x2a')]=!![];this['channels'][_0x279364[_0xfb7d('0x47')]]=this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x4a')]];delete this[_0xfb7d('0x7')][_0x279364[_0xfb7d('0x4a')]];}}}catch(_0xda5bb4){logger[_0xfb7d('0x1e')](_0xfb7d('0x4b'),_0xda5bb4[_0xfb7d('0x39')]);}};Acw[_0xfb7d('0x16')]['syncBlindTransfer']=function(_0x11db88){try{if(this[_0xfb7d('0x7')][_0x11db88['transfereruniqueid']]){logger[_0xfb7d('0x1b')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x11db88[_0xfb7d('0x4c')]));this['startAcw'](_0x11db88[_0xfb7d('0x4c')]);}else if(this[_0xfb7d('0x7')][_0x11db88[_0xfb7d('0x4d')]]){logger[_0xfb7d('0x1b')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xfb7d('0x37')](_0x11db88[_0xfb7d('0x4d')]));this['startAcw'](_0x11db88['transfererlinkedid']);}}catch(_0x5e3c6a){logger[_0xfb7d('0x1e')](_0xfb7d('0x4e'),_0x5e3c6a[_0xfb7d('0x39')]);}};Acw['prototype'][_0xfb7d('0xd')]=function(_0xa6c941){try{if(this['voiceQueues'][_0xa6c941[_0xfb7d('0x22')]]&&this['voiceQueues'][_0xa6c941[_0xfb7d('0x22')]][_0xfb7d('0x4f')]==='all'){if(this[_0xfb7d('0x5')][_0xa6c941[_0xfb7d('0x21')]]){logger[_0xfb7d('0x1b')](_0xfb7d('0x50'),_0xa6c941[_0xfb7d('0x1a')],_0xa6c941[_0xfb7d('0x21')],_0xa6c941['queue']);return RpcUser[_0xfb7d('0x2c')](this['agents'][_0xa6c941[_0xfb7d('0x21')]],'Auto-Pause',_0xa6c941[_0xfb7d('0x1a')]);}}}catch(_0x17d10e){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x17d10e['message']);}};module[_0xfb7d('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e5e5410..6eabf1d 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 _0x4fc2=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x53ec7a,_0x2c1f7e){var _0x3a1407=function(_0x1a5934){while(--_0x1a5934){_0x53ec7a['push'](_0x53ec7a['shift']());}};_0x3a1407(++_0x2c1f7e);}(_0x4fc2,0x1cd));var _0x24fc=function(_0x37091d,_0x2fa386){_0x37091d=_0x37091d-0x0;var _0x460173=_0x4fc2[_0x37091d];return _0x460173;};'use strict';var Manager=require(_0x24fc('0x0'));var BPromise=require(_0x24fc('0x1'));var util=require(_0x24fc('0x2'));var logger=require('../../config/logger')(_0x24fc('0x3'));var config=require(_0x24fc('0x4'));var ami=new Manager(config[_0x24fc('0x5')][_0x24fc('0x6')],config[_0x24fc('0x5')]['ip'],config['asterisk'][_0x24fc('0x7')],config[_0x24fc('0x5')]['password'],!![]);ami[_0x24fc('0x8')]();ami[_0x24fc('0x9')]=BPromise[_0x24fc('0xa')](ami['action']);function error(_0x1c45f8){logger[_0x24fc('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x24fc('0x5')]['username'],config['asterisk']['ip'],config['asterisk'][_0x24fc('0x6')],util['inspect'](_0x1c45f8,![],null)));}function close(){logger[_0x24fc('0xb')](util['format'](_0x24fc('0xc'),config[_0x24fc('0x5')][_0x24fc('0x7')],config[_0x24fc('0x5')]['ip'],config[_0x24fc('0x5')][_0x24fc('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x24fc('0x9')]({'action':_0x24fc('0xd')});};};ami[_0x24fc('0xe')]=function(){return function(){return ami[_0x24fc('0x9')]({'action':_0x24fc('0xf')});};};ami[_0x24fc('0x10')]=function(){return function(){return ami['Action']({'action':_0x24fc('0x11')});};};ami[_0x24fc('0x12')]=function(){return function(){return ami[_0x24fc('0x9')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x24fc('0x9')]({'action':_0x24fc('0x13')});};};function connect(){logger[_0x24fc('0x14')](util[_0x24fc('0x15')](_0x24fc('0x16'),config[_0x24fc('0x5')][_0x24fc('0x7')],config[_0x24fc('0x5')]['ip'],config[_0x24fc('0x5')]['port']));ami[_0x24fc('0x17')]('error',error);ami[_0x24fc('0x17')](_0x24fc('0x18'),close);}ami['on'](_0x24fc('0x19'),connect);ami['on'](_0x24fc('0x1a'),function(_0x2bbd47){logger['info'](util[_0x24fc('0x15')](_0x24fc('0x1b'),config[_0x24fc('0x5')][_0x24fc('0x7')],config[_0x24fc('0x5')]['ip'],config[_0x24fc('0x5')][_0x24fc('0x6')],util[_0x24fc('0x1c')](_0x2bbd47,![],null)));});ami['on'](_0x24fc('0x1d'),function(){logger['info'](util[_0x24fc('0x15')](_0x24fc('0x1e'),config[_0x24fc('0x5')][_0x24fc('0x7')],config[_0x24fc('0x5')]['ip'],config[_0x24fc('0x5')][_0x24fc('0x6')]));return Promise[_0x24fc('0x1f')]()[_0x24fc('0x20')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())['then'](ami[_0x24fc('0x10')]())[_0x24fc('0x20')](ami[_0x24fc('0x12')]())[_0x24fc('0x20')](ami[_0x24fc('0x21')]())['catch'](function(_0x122d7c){logger[_0x24fc('0xb')](_0x24fc('0x22'),util[_0x24fc('0x1c')](_0x122d7c,{'showHidden':![],'depth':null}));});});ami[_0x24fc('0x17')](_0x24fc('0xb'),error);ami['once']('close',close);module['exports']=ami; \ No newline at end of file +var _0xb283=['bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','exports'];(function(_0x5a11d6,_0x13847c){var _0xf12dfe=function(_0x4e9e3e){while(--_0x4e9e3e){_0x5a11d6['push'](_0x5a11d6['shift']());}};_0xf12dfe(++_0x13847c);}(_0xb283,0xb4));var _0x3b28=function(_0x58736a,_0x5d0121){_0x58736a=_0x58736a-0x0;var _0x4518e2=_0xb283[_0x58736a];return _0x4518e2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x3b28('0x0'));var util=require(_0x3b28('0x1'));var logger=require(_0x3b28('0x2'))(_0x3b28('0x3'));var config=require(_0x3b28('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0x3b28('0x5')]['ip'],config[_0x3b28('0x5')][_0x3b28('0x6')],config[_0x3b28('0x5')][_0x3b28('0x7')],!![]);ami['keepConnected']();ami[_0x3b28('0x8')]=BPromise[_0x3b28('0x9')](ami['action']);function error(_0x12708a){logger[_0x3b28('0xa')](util[_0x3b28('0xb')](_0x3b28('0xc'),config['asterisk'][_0x3b28('0x6')],config[_0x3b28('0x5')]['ip'],config[_0x3b28('0x5')][_0x3b28('0xd')],util[_0x3b28('0xe')](_0x12708a,![],null)));}function close(){logger['error'](util[_0x3b28('0xb')](_0x3b28('0xf'),config[_0x3b28('0x5')][_0x3b28('0x6')],config[_0x3b28('0x5')]['ip'],config[_0x3b28('0x5')]['port']));}ami[_0x3b28('0x10')]=function(){return function(){return ami[_0x3b28('0x8')]({'action':'sipshowregistry'});};};ami[_0x3b28('0x11')]=function(){return function(){return ami[_0x3b28('0x8')]({'action':_0x3b28('0x12')});};};ami[_0x3b28('0x13')]=function(){return function(){return ami[_0x3b28('0x8')]({'action':'sippeerstatus'});};};ami[_0x3b28('0x14')]=function(){return function(){return ami[_0x3b28('0x8')]({'action':_0x3b28('0x15')});};};ami[_0x3b28('0x16')]=function(){return function(){return ami[_0x3b28('0x8')]({'action':_0x3b28('0x17')});};};function connect(){logger[_0x3b28('0x18')](util[_0x3b28('0xb')](_0x3b28('0x19'),config[_0x3b28('0x5')][_0x3b28('0x6')],config[_0x3b28('0x5')]['ip'],config[_0x3b28('0x5')][_0x3b28('0xd')]));ami['once']('error',error);ami[_0x3b28('0x1a')](_0x3b28('0x1b'),close);}ami['on'](_0x3b28('0x1c'),connect);ami['on'](_0x3b28('0x1d'),function(_0xeffe8b){logger[_0x3b28('0x18')](util[_0x3b28('0xb')](_0x3b28('0x1e'),config[_0x3b28('0x5')][_0x3b28('0x6')],config[_0x3b28('0x5')]['ip'],config[_0x3b28('0x5')][_0x3b28('0xd')],util[_0x3b28('0xe')](_0xeffe8b,![],null)));});ami['on'](_0x3b28('0x1f'),function(){logger[_0x3b28('0x18')](util[_0x3b28('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x3b28('0x5')][_0x3b28('0xd')]));return Promise[_0x3b28('0x20')]()[_0x3b28('0x21')](ami[_0x3b28('0x10')]())['then'](ami[_0x3b28('0x11')]())['then'](ami[_0x3b28('0x13')]())[_0x3b28('0x21')](ami[_0x3b28('0x14')]())[_0x3b28('0x21')](ami[_0x3b28('0x16')]())[_0x3b28('0x22')](function(_0x1b2e6b){logger[_0x3b28('0xa')]('[ami.js][fullybooted]',util[_0x3b28('0xe')](_0x1b2e6b,{'showHidden':![],'depth':null}));});});ami[_0x3b28('0x1a')](_0x3b28('0xa'),error);ami[_0x3b28('0x1a')](_0x3b28('0x1b'),close);module[_0x3b28('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6fd6bc6..cc1d9fd 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0xac4a,0x13f));var _0xaac4=function(_0x31ce0c,_0x21ad1f){_0x31ce0c=_0x31ce0c-0x0;var _0x38e55b=_0xac4a[_0x31ce0c];return _0x38e55b;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0xf32c6d,_0x372704){var _0x156c11=function(_0x34ef76){while(--_0x34ef76){_0xf32c6d['push'](_0xf32c6d['shift']());}};_0x156c11(++_0x372704);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31c09f,_0x42c393){_0x31c09f=_0x31c09f-0x0;var _0x239c40=_0xb43b[_0x31c09f];return _0x239c40;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9267dfd..4f63251 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 _0xa368=['assign','throttle','filter','dialPreviewRecallmeReminder','online','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','setXMDContactVariables','Contact','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','finally','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMinThreshold','talking','floor','erlangCalls','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[getDataPredictive]','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALL_TIMEOUT','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[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]','Ts\x20=\x20','Umin\x20=\x20','util','uuid','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','originateresponse','syncOriginateResponse','bind','agentcomplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\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','predictiveIntervalAnsweredCalls','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','debug','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','status','reachable','SIP/%s','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','interval','content','indexOf','true','catch','push','iftime\x20%s,%s','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','campaigns','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','intervalIftime','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','queue','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','ivr','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','queueCallerAbandonCreateState','add','ContactId','calleridname','[syncAgentComplete][createHistory][11]','actions','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','AMD','buildObj','amd','MACHINE','outboundAnswerAgiCallsDay','Machine','emit','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','membername','saveInDb','[syncHangupInAMDIvr]','countnoanswerretry','countagentrejectretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','outboundUnknownCallsDay','Unknow','running','statusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue'];(function(_0x5bc643,_0x2b786c){var _0x17e109=function(_0x3a1026){while(--_0x3a1026){_0x5bc643['push'](_0x5bc643['shift']());}};_0x17e109(++_0x2b786c);}(_0xa368,0xd3));var _0x8a36=function(_0x383255,_0x57edb2){_0x383255=_0x383255-0x0;var _0x4e2f00=_0xa368[_0x383255];return _0x4e2f00;};'use strict';var util=require(_0x8a36('0x0'));var _=require('lodash');var uuid=require(_0x8a36('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x8a36('0x2'));var ut=require(_0x8a36('0x3'));var config=require(_0x8a36('0x4'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x8a36('0x5'))(_0x8a36('0x6'));var loggerPredictive=require(_0x8a36('0x5'))(_0x8a36('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x8a36('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x8a36('0x9'));var ami=require(_0x8a36('0xa'));config['redis']=_[_0x8a36('0xb')](config[_0x8a36('0xc')],{'host':_0x8a36('0xd'),'port':0x18eb});var io=require(_0x8a36('0xe'))(new Redis(config[_0x8a36('0xc')]));var cmHopper=require(_0x8a36('0xf'));var voiceQueueRt=require(_0x8a36('0x10'));var RpcSetting=require(_0x8a36('0x11'));var Interval=require(_0x8a36('0x12'));var Action=require(_0x8a36('0x13'));var History=require('./models/history');var Final=require(_0x8a36('0x14'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x8a36('0x15'));var Hangup=require(_0x8a36('0x16'));var ipAgi=process['env'][_0x8a36('0x17')]||_0x8a36('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8a36('0x19')][_0x8a36('0x1a')]=function(_0x5a3dfb){this[_0x8a36('0x1b')]=this[_0x8a36('0x1b')]?this['tail']['finally'](_0x5a3dfb):_0x5a3dfb();};function Dialer(_0x12a01b,_0x49cdcb){this[_0x8a36('0x1c')]=new Sequence();this[_0x8a36('0x1d')]=_0x49cdcb;this[_0x8a36('0x1e')]=_0x12a01b[_0x8a36('0x1e')];this['campaigns']=_0x12a01b['campaigns'];this[_0x8a36('0x1f')]=_0x12a01b[_0x8a36('0x1f')];this[_0x8a36('0x20')]=_0x12a01b[_0x8a36('0x20')];this[_0x8a36('0x21')]=config[_0x8a36('0x21')]||0x2;this[_0x8a36('0x22')]={};this['actions']={};this[_0x8a36('0x23')]={};this[_0x8a36('0x24')]={};this[_0x8a36('0x25')]={};this[_0x8a36('0x26')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x8a36('0x27')]={};this[_0x8a36('0x28')]={};this[_0x8a36('0x29')]={};ami['on'](_0x8a36('0x2a'),this[_0x8a36('0x2b')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x8a36('0x2c'),this[_0x8a36('0x2d')][_0x8a36('0x2e')](this));ami['on'](_0x8a36('0x2f'),this['syncAgentComplete'][_0x8a36('0x2e')](this));ami['on']('custom:queuesummary',this[_0x8a36('0x9')][_0x8a36('0x2e')](this));ami['on'](_0x8a36('0x30'),this[_0x8a36('0x31')]['bind'](this));ami['on'](_0x8a36('0x32'),this[_0x8a36('0x33')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x8a36('0x2e')](this));ami['on'](_0x8a36('0x34'),this[_0x8a36('0x35')][_0x8a36('0x2e')](this));ami['on'](_0x8a36('0x36'),this[_0x8a36('0x37')][_0x8a36('0x2e')](this));ami['on'](_0x8a36('0x38'),this[_0x8a36('0x39')][_0x8a36('0x2e')](this));this[_0x8a36('0x3a')]();this['loopClearZombieChannels']();RpcSetting[_0x8a36('0x3b')]()[_0x8a36('0x3c')](function(_0x3e2e7c){previewRecallmeReminderInterval=_0x3e2e7c[_0x8a36('0x3d')];});}function isNotNull(_0x1d7c21){return _0x1d7c21!==null&&!_['isUndefined'](_0x1d7c21);}function msgResponse(_0x2b65b3,_0x30872b,_0x24773f){return{'action':_0x2b65b3,'response':_0x30872b,'message':_0x24773f,'stack':_0x24773f};}function emit(_0x353061,_0x386859,_0x3b279d){io['to'](_0x353061)['emit'](_0x386859,_0x3b279d);}function emitOutboundVoiceQueueSummary(_0x189ddd){if(_0x189ddd[_0x8a36('0x3e')]===_0x8a36('0x3f')){logger['debug'](_0x8a36('0x40'),util['inspect'](_0x189ddd,{'showHidden':![],'depth':null}));emit(util[_0x8a36('0x41')](_0x8a36('0x42'),_0x189ddd[_0x8a36('0x43')]),_0x8a36('0x44'),_0x189ddd);}}function checkGetDataPredictive(_0xed0617){if(isNotNull(_0xed0617)&&!_[_0x8a36('0x45')](_0xed0617)){loggerPredictive['info'](_0x8a36('0x46'));loggerPredictive['info'](_0x8a36('0x47'),_0xed0617['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x8a36('0x48'),_0xed0617[_0x8a36('0x49')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x4b'),_0xed0617['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x4c'),_0xed0617[_0x8a36('0x4d')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x4e'),_0xed0617['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x4f'),_0xed0617[_0x8a36('0x50')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x51'));if(_0xed0617[_0x8a36('0x52')]>0x0){if(!_[_0x8a36('0x53')](_0xed0617[_0x8a36('0x50')])&&_0xed0617[_0x8a36('0x50')]>0x0){return!![];}loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x54'));if(!_[_0x8a36('0x53')](_0xed0617[_0x8a36('0x55')])&&_0xed0617[_0x8a36('0x55')]>0x0){return!![];}loggerPredictive[_0x8a36('0x4a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x8a36('0x56'));}}else{loggerPredictive[_0x8a36('0x4a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2bc57d){return function(_0x39d619){loggerPredictive[_0x8a36('0x4a')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x8a36('0x57'),_0x39d619['erlangCalls']);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x58'),_0x39d619[_0x8a36('0x59')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x5a'),_0x39d619[_0x8a36('0x5b')]);loggerPredictive['info'](_0x8a36('0x5c'),_0x39d619[_0x8a36('0x5d')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x5a'),_0x39d619[_0x8a36('0x5b')]);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x51'));_[_0x8a36('0x5e')](_0x2bc57d,_0x39d619);};}function ifInterval(_0x5a6b9a,_0x212a6e){if(_[_0x8a36('0x53')](_0x212a6e)){return![];}return utils[_0x8a36('0x5f')](undefined,_0x212a6e)<_0x5a6b9a*0x3c;}function clearPredictiveAttributes(_0x492d99){if(_0x492d99[_0x8a36('0x60')]){_0x492d99[_0x8a36('0x60')]=undefined;loggerPredictive['debug'](_0x492d99[_0x8a36('0x43')],_0x8a36('0x61'));}if(_0x492d99['startPredictive']){_0x492d99['startPredictive']=undefined;loggerPredictive[_0x8a36('0x62')](_0x492d99[_0x8a36('0x43')],_0x8a36('0x63'));}if(_0x492d99[_0x8a36('0x64')]){clearInterval(_0x492d99['handlePredictive']);_0x492d99[_0x8a36('0x64')]=undefined;loggerPredictive[_0x8a36('0x62')](_0x492d99[_0x8a36('0x43')],_0x8a36('0x65'));}}function loggerCatchPredictive(_0x53a281,_0x1c6e18){return function(_0x4d9f34){loggerPredictive[_0x8a36('0x66')](_0x1c6e18['name'],_0x53a281);loggerPredictive[_0x8a36('0x66')](_0x4d9f34['stack']);clearPredictiveAttributes(_0x1c6e18);};}function loggerCatch(_0x3dc703){return function(_0x348aec){logger[_0x8a36('0x66')](_0x3dc703,util[_0x8a36('0x67')](_0x348aec,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xd8b2af,_0x3141d7,_0x368a2c){return function(_0x13c447){utils[_0x8a36('0x68')](_0x3141d7,_0x368a2c,0x0);_0x3141d7[_0x8a36('0x69')]=0x0;logger[_0x8a36('0x66')](_0xd8b2af,util[_0x8a36('0x67')](_0x13c447,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b2772){return function(_0x5b0060){if(isNotNull(_0x5b0060)&&isNotNull(_0x5b0060[0x0])){if(_0x5b0060[0x0][_0x8a36('0x6a')]>0x0){_0x5b2772[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x6d')];logger[_0x8a36('0x4a')]('[getContactDialer2][ReScheduled]'+_0x5b2772[_0x8a36('0x43')],_0x5b0060[0x0]['contactsRescheduled'],'contacts');}else{_0x5b2772[_0x8a36('0x6b')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger['info'](_0x8a36('0x6e')+_0x5b2772[_0x8a36('0x43')]);}}};}function createObjHistory(_0x305db8,_0x380e2f,_0x5628f9,_0x5148ff,_0x2ebd52){_0x305db8[_0x8a36('0x6b')]=_0x5628f9;var _0x31f847=new Action(_0x305db8,_0x380e2f);var _0x54e4d5=new History(_0x31f847);_0x54e4d5[_0x8a36('0x6f')]=_0x5148ff;_0x54e4d5[_0x8a36('0x70')]=_0x2ebd52;_0x54e4d5[_0x8a36('0x71')]=_0x31f847[_0x8a36('0x72')];return _0x54e4d5;}function unlockQueueStatus(_0x5d3bd6,_0x5eb15f){setTimeout(function(){if(_[_0x8a36('0x53')](_0x5d3bd6[_0x8a36('0x73')])){loggerBooked[_0x8a36('0x66')](_0x8a36('0x74'),_0x5eb15f);}_0x5d3bd6['queueStatusComplete']=!![];loggerBooked[_0x8a36('0x4a')](_0x8a36('0x75'),_0x5eb15f,JSON[_0x8a36('0x76')](_[_0x8a36('0x77')](_0x5d3bd6,[_0x8a36('0x43'),_0x8a36('0x73')])));},0x1f3);}function checkInterval(_0xd54ac8){return function(){if(!isNotNull(_0xd54ac8[_0x8a36('0x78')])){_0xd54ac8[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')]['NULL_INTERVAL'];throw _0xd54ac8[_0x8a36('0x43')]+_0x8a36('0x79');}if(!isNotNull(_0xd54ac8[_0x8a36('0x78')]['Intervals'])){_0xd54ac8[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')]['NULL_INTERVAL'];throw _0xd54ac8[_0x8a36('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0xd54ac8[_0x8a36('0x78')][_0x8a36('0x7a')]))){_0xd54ac8[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x7b')];throw _0xd54ac8['name']+_0x8a36('0x79');}};}function checkIsIVRCampaignActive(_0x62ce24){return function(){if(!utils[_0x8a36('0x7c')](_0x62ce24)){_0x62ce24['message']=utils[_0x8a36('0x6c')][_0x8a36('0x7d')];throw _0x62ce24[_0x8a36('0x43')]+_0x8a36('0x7e');}};}function emitCampaignSummary(_0x322959){if(utils['isIVRCampaign'](_0x322959)){emit(util['format'](_0x8a36('0x7f'),_0x322959[_0x8a36('0x43')]),_0x8a36('0x80'),_0x322959);}}function loggerCatchQueueSummary(_0x502004,_0x2e61b7){return function(_0x21f054){clearPredictiveAttributes(_0x2e61b7);emitCampaignSummary(_0x2e61b7);loggerSyncQueueSummary[_0x8a36('0x62')](_0x502004,util[_0x8a36('0x67')](_0x21f054,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2436f0){if(_0x2436f0[_0x8a36('0x81')]){if(_0x2436f0['originated']===0x0){_0x2436f0[_0x8a36('0x81')]=![];_0x2436f0[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x7d')];loggerSyncQueueSummary[_0x8a36('0x62')](_0x8a36('0x82'),_0x2436f0[_0x8a36('0x43')],'is\x20not\x20active');}else{_0x2436f0[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x83')];loggerSyncQueueSummary[_0x8a36('0x62')](_0x8a36('0x82'),_0x2436f0[_0x8a36('0x43')],_0x8a36('0x84'));}emitCampaignSummary(_0x2436f0);}}function myreject(_0x3d32b3){return function(_0x5141b8){return _0x3d32b3(msgResponse(_0x8a36('0x85'),_0x8a36('0x86'),JSON[_0x8a36('0x76')](_0x5141b8)));};}Dialer[_0x8a36('0x19')]['isTrunkReachable']=function(_0x16a0b0){return!_['isUndefined'](_0x16a0b0)&&_0x16a0b0&&!_[_0x8a36('0x53')](_0x16a0b0['name'])&&!_[_0x8a36('0x53')](_0x16a0b0[_0x8a36('0x87')])&&_0x16a0b0[_0x8a36('0x87')]&&(this[_0x8a36('0x20')][util['format']('SIP/%s',_0x16a0b0['name'])][_0x8a36('0x88')]===_0x8a36('0x89')||this['trunks'][util['format'](_0x8a36('0x8a'),_0x16a0b0[_0x8a36('0x43')])][_0x8a36('0x88')]==='unmonitored');};Dialer[_0x8a36('0x19')][_0x8a36('0x8b')]=function(_0x33db79){var _0x560a3a=this;return function(){if(!_0x560a3a[_0x8a36('0x8c')](_0x33db79[_0x8a36('0x8d')])){if(!_0x560a3a[_0x8a36('0x8c')](_0x33db79[_0x8a36('0x8e')])){_0x33db79[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x8f')];throw _0x33db79[_0x8a36('0x43')]+_0x8a36('0x90');}}};};Dialer[_0x8a36('0x19')][_0x8a36('0x91')]=function(_0x43b2f9,_0x587fac,_0x4bcdbc,_0x245a62){var _0x2f5f93=this;return function(){var _0x5c5983=!![];return _0x2f5f93[_0x8a36('0x92')](_0x43b2f9,_0x587fac,_0x4bcdbc,_0x245a62,_0x5c5983);};};Dialer[_0x8a36('0x19')][_0x8a36('0x93')]=function(_0x3bd447,_0x37f335,_0x3ed43e,_0x26a63a){var _0x20d166=this;return function(){var _0x382086=![];return _0x20d166[_0x8a36('0x92')](_0x3bd447['Intervals'],_0x37f335,_0x3ed43e,_0x26a63a,_0x382086);};};Dialer[_0x8a36('0x19')][_0x8a36('0x92')]=function(_0x252aba,_0x57e564,_0x5012fe,_0x369102,_0x5e4cbc){var _0x65dbf7=[];return new Promise(function(_0x26ae92,_0x58c38b){if(!isNotNull(_0x252aba)){_0x369102[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')][_0x8a36('0x7b')];return _0x58c38b(msgResponse(_0x8a36('0x94'),_0x8a36('0x95'),_0x5012fe+_0x8a36('0x96')));}if(_[_0x8a36('0x45')](_0x252aba)){_0x369102[_0x8a36('0x6b')]=utils[_0x8a36('0x6c')]['EMPTY_INTERVAL'];return _0x58c38b(msgResponse('ifTime',_0x8a36('0x95'),_0x5012fe+'\x20Intervals\x20is\x20empty\x20'));}if(_0x57e564&&_['isUndefined'](config[_0x8a36('0x97')][_0x57e564])){_0x369102[_0x8a36('0x6b')]=utils['CAMPAIGN_STATUS'][_0x8a36('0x98')];return _0x58c38b(msgResponse('ifTime','Failure',_0x5012fe+_0x8a36('0x99')+_0x57e564));}if(_[_0x8a36('0x9a')](_0x252aba)){for(var _0x2193cc=0x0;_0x2193cc<_0x252aba[_0x8a36('0x9b')];_0x2193cc+=0x1){_0x65dbf7['push'](ami[_0x8a36('0x9c')]({'action':_0x8a36('0x9d'),'command':util[_0x8a36('0x41')]('iftime\x20%s,%s',_0x252aba[_0x2193cc][_0x8a36('0x9e')],!_['isUndefined'](config['timezones'][_0x57e564])?_0x57e564:'')})['then'](function(_0x3d9f1e){return _0x3d9f1e[_0x8a36('0x9f')][_0x8a36('0xa0')](_0x8a36('0xa1'))>=0x0;})[_0x8a36('0xa2')](myreject(_0x58c38b)));}}else{_0x65dbf7[_0x8a36('0xa3')](ami[_0x8a36('0x9c')]({'action':_0x8a36('0x9d'),'command':util['format'](_0x8a36('0xa4'),_0x252aba,!_[_0x8a36('0x53')](config[_0x8a36('0x97')][_0x57e564])?_0x57e564:'')})[_0x8a36('0x3c')](function(_0x440e93){return _0x440e93['content'][_0x8a36('0xa0')]('true')>=0x0;})[_0x8a36('0xa2')](myreject(_0x58c38b)));}Promise['all'](_0x65dbf7)[_0x8a36('0x3c')](function(_0x46887b){var _0x32963e=_[_0x8a36('0xa5')](_0x46887b);if(_0x32963e){return _0x26ae92(_0x32963e);}else{_0x369102['message']=_0x5e4cbc?utils[_0x8a36('0x6c')][_0x8a36('0xa6')]:utils[_0x8a36('0x6c')]['OVERTIME_INTERVAL'];return _0x58c38b(msgResponse(_0x8a36('0xa7'),_0x8a36('0x95'),_0x8a36('0xa8')+_0x5e4cbc+'\x20'+_0x5012fe+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8a36('0x67')](_0x252aba,{'showHidden':![],'depth':null})+_0x8a36('0xa9')+_0x57e564));}})[_0x8a36('0xa2')](function(_0x307244){return _0x58c38b(msgResponse(_0x8a36('0x94'),'Failure',JSON[_0x8a36('0x76')](_0x307244)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x16e127=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x8a36('0x3c')](function(){setInterval(function(){_0x16e127[_0x8a36('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x8a36('0xaa')]=function(){var _0x528618=this;var _0x2dc863;for(var _0x42d527 in this['campaigns']){if(typeof this['campaigns'][_0x42d527]!==_0x8a36('0xab')){_0x2dc863=this[_0x8a36('0xac')][_0x42d527];if(utils[_0x8a36('0xad')](_0x2dc863)&&utils[_0x8a36('0x7c')](_0x2dc863)){_0x2dc863[_0x8a36('0x81')]=!![];Promise[_0x8a36('0xae')]()[_0x8a36('0x3c')](checkIsIVRCampaignActive(_0x2dc863))[_0x8a36('0x3c')](checkInterval(_0x2dc863))[_0x8a36('0x3c')](_0x528618[_0x8a36('0x8b')](_0x2dc863))[_0x8a36('0x3c')](_0x528618[_0x8a36('0x91')](_0x2dc863[_0x8a36('0xaf')],_0x2dc863[_0x8a36('0xb0')],_0x2dc863[_0x8a36('0x43')],_0x2dc863))[_0x8a36('0x3c')](_0x528618[_0x8a36('0x93')](_0x2dc863[_0x8a36('0x78')],_0x2dc863['dialTimezone'],_0x2dc863[_0x8a36('0x43')],_0x2dc863))[_0x8a36('0x3c')](_0x528618['launchHandleIvr'](_0x2dc863))[_0x8a36('0xa2')](loggerCatchQueueSummary(_0x8a36('0xb1'),_0x2dc863));}else{notSendMessagesCampaign(_0x2dc863);}}}};Dialer['prototype'][_0x8a36('0xb2')]=function(_0x4a7571){if(_0x4a7571[_0x8a36('0xb3')]!==_0x8a36('0x7')){clearPredictiveAttributes(_0x4a7571);}switch(_0x4a7571[_0x8a36('0xb3')]){case _0x8a36('0xb4'):this[_0x8a36('0xb5')](_0x4a7571,0x1);break;case'power':this[_0x8a36('0xb5')](_0x4a7571,_0x4a7571[_0x8a36('0xb6')]);break;case _0x8a36('0x7'):this['predictive'](_0x4a7571);break;case _0x8a36('0x6'):this['handlePower'](_0x4a7571,0x1);break;default:logger[_0x8a36('0x66')](_0x8a36('0xb7'),_0x4a7571[_0x8a36('0x43')],_0x8a36('0xb8'));}};Dialer[_0x8a36('0x19')][_0x8a36('0x94')]=function(_0x55cf4b,_0x59f44c){var _0x560db5=_0x55cf4b[_0x8a36('0xb0')];var _0x4cabb7=_0x59f44c?_0x55cf4b['dialGlobalInterval']:_0x55cf4b[_0x8a36('0x78')][_0x8a36('0x7a')];logger[_0x8a36('0xb9')]('Dialer::ifTime()',_0x4cabb7,_0x560db5,_0x55cf4b[_0x8a36('0x43')],util[_0x8a36('0x41')]('Voice\x20Queue\x20%s\x20$s',_0x55cf4b[_0x8a36('0x43')],_0x55cf4b['id']));var _0x357e59=null;return Interval[_0x8a36('0xba')](_0x4cabb7,_0x560db5)['then'](function(_0x338717){if(_0x338717===!![]){return _0x338717;}else{_0x55cf4b[_0x8a36('0x6b')]=_0x59f44c?utils[_0x8a36('0x6c')][_0x8a36('0xa6')]:utils[_0x8a36('0x6c')]['OVERTIME_INTERVAL'];_0x357e59=msgResponse(_0x8a36('0xa7'),_0x8a36('0x95'),'Global:\x20'+_0x59f44c+'\x20'+_0x55cf4b[_0x8a36('0x43')]+_0x8a36('0xbb')+util[_0x8a36('0x67')](_0x4cabb7,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x560db5);}if(_0x357e59!==null){logger[_0x8a36('0xb9')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x357e59);_0x357e59[_0x8a36('0xbc')]=_0x59f44c;throw _0x357e59;}})[_0x8a36('0xa2')](function(_0x3e5768){logger['error'](_0x8a36('0xbd'),_0x3e5768);throw msgResponse('[ifTime][Action]','Error',util[_0x8a36('0x67')](_0x3e5768,{'showHidden':![],'depth':null}));});};Dialer[_0x8a36('0x19')][_0x8a36('0x2b')]=function(_0x334b37){if(this['voiceQueues'][_0x334b37[_0x8a36('0xbe')]]){if(this['uniqueId'][_0x334b37[_0x8a36('0xbf')]]&&this[_0x8a36('0x24')][_0x334b37[_0x8a36('0xbf')]][_0x8a36('0x3e')]!=='ivr'){this[_0x8a36('0xc0')](this[_0x8a36('0x1e')][_0x334b37[_0x8a36('0xbe')]]);this['uniqueId'][_0x334b37[_0x8a36('0xbf')]][_0x8a36('0xc1')]=moment()[_0x8a36('0x41')](_0x8a36('0xc2'));}}};Dialer[_0x8a36('0x19')][_0x8a36('0xc3')]=function(_0x57c60b){var _0x3b814d=this[_0x8a36('0x24')][_0x57c60b[_0x8a36('0xbf')]];if(this['voiceQueues'][_0x57c60b['queue']]){if(_0x3b814d&&_0x3b814d['type']!==_0x8a36('0xc4')){delete this[_0x8a36('0x24')][_0x57c60b[_0x8a36('0xbf')]];this[_0x8a36('0x1e')][_0x57c60b['queue']]['outboundAnswerCallsDay']+=0x1;var _0x30cc5e=new AgentComplete(_0x3b814d,_0x57c60b);if(_0x57c60b[_0x8a36('0xc5')]===_0x8a36('0xc6')){_0x30cc5e[_0x8a36('0xc7')]=this[_0x8a36('0x1e')][_0x57c60b[_0x8a36('0xbe')]][_0x8a36('0xc8')]&&this[_0x8a36('0x1e')][_0x57c60b[_0x8a36('0xbe')]][_0x8a36('0xc9')]?moment()[_0x8a36('0x41')](_0x8a36('0xc2')):undefined;}hopperUtils['createHistory'](_0x30cc5e)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xca')));hopperUtils[_0x8a36('0xcb')](_0x30cc5e)[_0x8a36('0xa2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x8a36('0x19')][_0x8a36('0xcc')]=function(_0x1db951){var _0x36ff9e=this['uniqueId'][_0x1db951[_0x8a36('0xbf')]];var _0x47b0f9=this;var _0x300bfe=![];var _0x4ee672;var _0x5997cd;if(this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]]){if(_0x36ff9e&&_0x36ff9e[_0x8a36('0x3e')]!=='ivr'){delete this['uniqueId'][_0x1db951[_0x8a36('0xbf')]];this[_0x8a36('0xc0')](this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]]);_0x36ff9e[_0x8a36('0xcd')]=moment()[_0x8a36('0x41')](_0x8a36('0xc2'));var _0x5cb8de=new QueueCallerAbandon(_0x36ff9e,_0x1db951);if(utils['getSeconds'](_0x36ff9e[_0x8a36('0xcd')],_0x36ff9e[_0x8a36('0xce')])>=_0x36ff9e[_0x8a36('0xcf')]){this['voiceQueues'][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xd0')]+=0x1;this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xd1')]+=0x1;this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xd2')]+=0x1;_0x5cb8de[_0x8a36('0x6f')]=0xa;_0x5cb8de['statedesc']='Drop';_0x5cb8de['dropreason']='TIMEOUT';_0x5cb8de[_0x8a36('0xc7')]=this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xc8')]?moment()['format'](_0x8a36('0xc2')):undefined;_0x5cb8de[_0x8a36('0xd3')]+=0x1;_0x5cb8de[_0x8a36('0xd4')]+=0x1;_0x4ee672=this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xd5')];_0x5997cd=this[_0x8a36('0x1e')][_0x1db951['queue']][_0x8a36('0xd6')];hopperUtils['verifyAdditionalPhones'](_0x5cb8de,_0x5cb8de[_0x8a36('0x6f')],_0x36ff9e['voiceQueue'])[_0x8a36('0x3c')](function(_0x57caf0){_0x300bfe=_0x57caf0[_0x8a36('0xd7')]==0x1;if(_0x5cb8de['countdropretry']>=_0x47b0f9[_0x8a36('0x1e')][_0x1db951['queue']][_0x8a36('0xd8')]){_0x47b0f9['queueCallerAbandonCreateState'](_0x5cb8de,_0x57caf0[_0x8a36('0xd7')]);}else{hopperUtils[_0x8a36('0xd9')]({'active':![],'countdropretry':_0x5cb8de[_0x8a36('0xd3')],'scheduledat':moment()['add'](_0x47b0f9[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]]['dialDropRetryFrequency'],_0x8a36('0xda'))[_0x8a36('0x41')](_0x8a36('0xc2')),'ContactId':_0x36ff9e['ContactId'],'ListId':_0x36ff9e[_0x8a36('0xdb')],'VoiceQueueId':_0x36ff9e[_0x8a36('0xdc')]||undefined,'CampaignId':_0x36ff9e[_0x8a36('0xdd')]||undefined})['catch'](loggerCatch(_0x8a36('0xde')));var _0x50ad07=new History(_0x5cb8de);_0x50ad07[_0x8a36('0x6f')]=0xa;_0x50ad07['statedesc']=_0x8a36('0xdf');_0x50ad07[_0x8a36('0x72')]=moment()[_0x8a36('0x41')](_0x8a36('0xc2'));_0x50ad07[_0x8a36('0x71')]=_0x50ad07['starttime'];_0x50ad07['calleridname']=_0x5cb8de['calleridname'];_0x50ad07[_0x8a36('0xe0')]=_0x5cb8de[_0x8a36('0xe0')];hopperUtils[_0x8a36('0xe1')](_0x50ad07)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xe2')));}})[_0x8a36('0x3c')](function(){if(_0x300bfe)hopperUtils[_0x8a36('0xe3')](_0x5cb8de,_0x4ee672,_0x5997cd)[_0x8a36('0x3c')](function(){return 0x1;});});}else{this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0x4d')]+=0x1;this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xe4')]+=0x1;_0x5cb8de['state']=0xb;_0x5cb8de[_0x8a36('0x70')]=_0x8a36('0xe5');_0x5cb8de[_0x8a36('0xe6')]=_0x8a36('0xe7');_0x5cb8de[_0x8a36('0xe8')]+=0x1;_0x5cb8de['countglobal']+=0x1;_0x4ee672=this[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xe9')];_0x5997cd=this['voiceQueues'][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xd6')];hopperUtils[_0x8a36('0xea')](_0x5cb8de,_0x5cb8de[_0x8a36('0x6f')],_0x36ff9e['voiceQueue'])[_0x8a36('0x3c')](function(_0x4e5f7c){if(_0x5cb8de[_0x8a36('0xe8')]>=_0x47b0f9[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xeb')]){_0x47b0f9[_0x8a36('0xec')](_0x5cb8de,_0x4e5f7c[_0x8a36('0xd7')]);}else{hopperUtils[_0x8a36('0xd9')]({'active':![],'countabandonedretry':_0x5cb8de[_0x8a36('0xe8')],'scheduledat':moment()[_0x8a36('0xed')](_0x47b0f9[_0x8a36('0x1e')][_0x1db951[_0x8a36('0xbe')]][_0x8a36('0xe9')],_0x8a36('0xda'))['format'](_0x8a36('0xc2')),'ContactId':_0x36ff9e[_0x8a36('0xee')],'ListId':_0x36ff9e[_0x8a36('0xdb')],'VoiceQueueId':_0x36ff9e['VoiceQueueId']||undefined,'CampaignId':_0x36ff9e[_0x8a36('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x26f97e=new History(_0x5cb8de);_0x26f97e[_0x8a36('0x6f')]=0xb;_0x26f97e[_0x8a36('0x70')]=_0x8a36('0xe5');_0x26f97e[_0x8a36('0x72')]=moment()[_0x8a36('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x26f97e[_0x8a36('0x71')]=_0x26f97e[_0x8a36('0x72')];_0x26f97e[_0x8a36('0xef')]=_0x5cb8de[_0x8a36('0xef')];_0x26f97e['calleridnum']=_0x5cb8de[_0x8a36('0xe0')];hopperUtils[_0x8a36('0xe1')](_0x26f97e)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xf0')));}})[_0x8a36('0x3c')](function(){if(_0x300bfe)hopperUtils['swapAdditionalPhones'](_0x5cb8de,_0x4ee672,_0x5997cd)[_0x8a36('0x3c')](function(){return 0x1;});});}}}};Dialer[_0x8a36('0x19')]['syncNewExten']=function(_0x1ba4a2){if(this['actions'][_0x1ba4a2[_0x8a36('0xbf')]]){this[_0x8a36('0xf1')][_0x1ba4a2['uniqueid']][_0x8a36('0xf2')]=_0x1ba4a2[_0x8a36('0xf2')];}if(this[_0x8a36('0x24')][_0x1ba4a2[_0x8a36('0xbf')]]){this[_0x8a36('0x24')][_0x1ba4a2[_0x8a36('0xbf')]]['channel']=_0x1ba4a2[_0x8a36('0xf2')];}};Dialer[_0x8a36('0x19')][_0x8a36('0x37')]=function(_0x5ce910){if(!this[_0x8a36('0xf1')][_0x5ce910['actionid']]){return;}var _0x4f71cb=this[_0x8a36('0x1e')][this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]]['queue']]['strategy']||_0x8a36('0xf4');if(_0x4f71cb===_0x8a36('0xf5')){if(this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]]&&_[_0x8a36('0xf6')](this[_0x8a36('0xf1')][_0x5ce910['actionid']][_0x8a36('0xf7')])&&_0x5ce910[_0x8a36('0x88')]==='1'&&_0x5ce910[_0x8a36('0xf8')]==='0'){if(this[_0x8a36('0x1f')][_0x5ce910[_0x8a36('0xf9')]]){if(!this['agents'][_0x5ce910[_0x8a36('0xf9')]][_0x8a36('0xf7')]){this['agents'][_0x5ce910['stateinterface']][_0x8a36('0xf7')]=!![];this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]][_0x8a36('0xf7')]=!![];this['actions'][_0x5ce910[_0x8a36('0xf3')]][_0x8a36('0xf9')]=_0x5ce910['stateinterface'];}}}}else if(_0x4f71cb===_0x8a36('0xf4')){if(this[_0x8a36('0xf1')][_0x5ce910['actionid']]){if(this[_0x8a36('0x1f')][_0x5ce910[_0x8a36('0xf9')]]){this['actions'][_0x5ce910[_0x8a36('0xf3')]][_0x8a36('0xf9')]=_0x5ce910['stateinterface'];if(_['isNil'](this[_0x8a36('0x27')][this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]][_0x8a36('0xbe')]])){this[_0x8a36('0x27')][this[_0x8a36('0xf1')][_0x5ce910['actionid']]['queue']]=[];}this[_0x8a36('0x27')][this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]][_0x8a36('0xbe')]][_0x8a36('0xa3')](_[_0x8a36('0x5e')](_[_0x8a36('0x77')](this[_0x8a36('0xf1')][_0x5ce910[_0x8a36('0xf3')]],[_0x8a36('0xfa'),_0x8a36('0xf9')]),{'status':_0x5ce910['status'],'paused':_0x5ce910[_0x8a36('0xf8')]}));}}}};Dialer[_0x8a36('0x19')][_0x8a36('0x39')]=function(_0x52972d){if(!this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]){return;}var _0x93dad6=this;var _0x49ed96=this[_0x8a36('0x1e')][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]['queue']];var _0x1a54b3=_0x49ed96['strategy']||_0x8a36('0xf4');if(_0x1a54b3===_0x8a36('0xf5')){if(this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]&&this[_0x8a36('0xf1')][_0x52972d['actionid']][_0x8a36('0xf9')]){this[_0x8a36('0x1d')][_0x8a36('0xfb')](this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xfa')],this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]['stateinterface'])[_0x8a36('0xa2')](function(_0x4fd79f){logger['error'](_0x8a36('0xfc'),util['inspect'](_0x4fd79f,{'showHidden':![],'depth':null}));})['finally'](function(){_0x93dad6[_0x8a36('0xc0')](_0x93dad6[_0x8a36('0x1e')][_0x93dad6[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]]);_0x93dad6['agents'][_0x93dad6[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]['stateinterface']][_0x8a36('0xf7')]=![];delete _0x93dad6['actions'][_0x52972d[_0x8a36('0xf3')]];unlockQueueStatus(_0x49ed96);});}else{this[_0x8a36('0xc0')](this[_0x8a36('0x1e')][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xee')],'ListId':this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xdb')],'VoiceQueueId':this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xfd')));delete this[_0x8a36('0xf1')][_0x52972d['actionid']];unlockQueueStatus(_0x49ed96);}}else if(_0x1a54b3===_0x8a36('0xf4')){var _0x17a298;if(this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]&&!_[_0x8a36('0x45')](this[_0x8a36('0x27')][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]])){if(this[_0x8a36('0x28')][_0x93dad6[_0x8a36('0xf1')][_0x52972d['actionid']][_0x8a36('0xbe')]]){this[_0x8a36('0x28')][_0x93dad6[_0x8a36('0xf1')][_0x52972d['actionid']][_0x8a36('0xbe')]]=this[_0x8a36('0x28')][this['actions'][_0x52972d['actionid']][_0x8a36('0xbe')]]?this['queueBookedRR'][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]]:this[_0x8a36('0x27')][this['actions'][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]]?this['queueBooked'][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]][_0x8a36('0xfe')]||0x0:0x0;}this[_0x8a36('0x27')][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]][_0x8a36('0xbe')]][_0x8a36('0xfe')]=this['queueBookedRR'][this[_0x8a36('0xf1')][_0x52972d[_0x8a36('0xf3')]]['queue']];for(var _0x4c1d2c=0x0;_0x4c1d2c=_0x2bd36c[_0x8a36('0x120')]){_0x3353bf[_0x8a36('0x121')](_0x1fad56,_0x42aacb,_0x52f55b,_0x8a36('0x122'));}else{if(_0x1fad56[_0x8a36('0x123')]>=_0x2bd36c[_0x8a36('0x124')]){_0x3353bf[_0x8a36('0x125')](_0x1fad56,_0x42aacb,_0x52f55b,_0x8a36('0x126'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1fad56[_0x8a36('0x123')],'scheduledat':moment()[_0x8a36('0xed')](_0x2bd36c[_0x8a36('0x127')],_0x8a36('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1fad56[_0x8a36('0xee')],'ListId':_0x1fad56[_0x8a36('0xdb')],'VoiceQueueId':_0x1fad56[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1fad56['CampaignId']||undefined})['catch'](loggerCatch(_0x8a36('0x128')));_0x42aacb({'reschedule':0x1});}}});}if(_0x15bfa1[_0x8a36('0x3e')]===_0x8a36('0xc4')&&this[_0x8a36('0xac')][_0x15bfa1[_0x8a36('0xbe')]][_0x8a36('0x10f')]&&_0x1816ff[_0x8a36('0x110')]===_0x8a36('0x111')){delete this[_0x8a36('0x24')][_0x1816ff['uniqueid']];this['updateOriginated'](this[_0x8a36('0xac')][_0x15bfa1['queue']]);_0x51cf9e=new Hangup(_0x15bfa1,_0x1816ff);_0x51cf9e[_0x8a36('0x6f')]=0x12;_0x51cf9e[_0x8a36('0x70')]=_0x8a36('0x113');_0x51cf9e[_0x8a36('0x129')]=_0x8a36('0x114');ami[_0x8a36('0x11a')](_0x8a36('0x11b'),ut[_0x8a36('0x115')](_0x51cf9e,_0x8a36('0x116')));this[_0x8a36('0x12a')](_0x51cf9e,'[syncHangupInAMDIvr][createHistory]',_0x8a36('0x12b'));}if(_0x15bfa1[_0x8a36('0x3e')]===_0x8a36('0xc4')&&this[_0x8a36('0xac')][_0x15bfa1[_0x8a36('0xbe')]][_0x8a36('0x10f')]&&_0x1816ff[_0x8a36('0x110')]===_0x8a36('0x117')){return new Promise(function(_0x3ef654,_0x1cd89d){delete _0x3353bf[_0x8a36('0x24')][_0x1816ff[_0x8a36('0xbf')]];_0x3353bf[_0x8a36('0xc0')](_0x3353bf[_0x8a36('0xac')][_0x15bfa1['queue']]);_0x3353bf['campaigns'][_0x15bfa1[_0x8a36('0xbe')]][_0x8a36('0x112')]+=0x1;_0x3353bf[_0x8a36('0xac')][_0x15bfa1['queue']][_0x8a36('0x118')]+=0x1;var _0xcbdfde=_0x3353bf[_0x8a36('0xac')][_0x15bfa1[_0x8a36('0xbe')]];var _0x512a48=new Hangup(_0x15bfa1,_0x1816ff);_0x512a48[_0x8a36('0x6f')]=0x13;_0x512a48[_0x8a36('0x70')]=_0x8a36('0x119');_0x512a48[_0x8a36('0x129')]='AMD';_0x512a48['countmachineretry']+=0x1;_0x512a48[_0x8a36('0xd4')]+=0x1;_0x512a48['amd']=!![];ami['emit'](_0x8a36('0x11b'),ut['buildObj'](_0x512a48,_0x8a36('0x116')));hopperUtils[_0x8a36('0xe1')](_0x512a48)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x11c')));if(_0x512a48[_0x8a36('0x11d')]+_0x512a48[_0x8a36('0x11e')]+_0x512a48[_0x8a36('0x12c')]+_0x512a48[_0x8a36('0x11f')]+_0x512a48[_0x8a36('0xd3')]+_0x512a48[_0x8a36('0xe8')]+_0x512a48[_0x8a36('0x123')]+_0x512a48[_0x8a36('0x12d')]>=_0xcbdfde['dialGlobalMaxRetry']){_0x3353bf[_0x8a36('0x121')](_0x512a48,_0x3ef654,_0x1cd89d,_0x8a36('0x122'));}else{if(_0x512a48[_0x8a36('0x123')]>=_0xcbdfde[_0x8a36('0x124')]){_0x3353bf['createStateFinal'](_0x512a48,_0x3ef654,_0x1cd89d,_0x8a36('0x126'));}else{hopperUtils[_0x8a36('0xd9')]({'active':![],'countmachineretry':_0x512a48[_0x8a36('0x123')],'scheduledat':moment()[_0x8a36('0xed')](_0xcbdfde[_0x8a36('0x127')],'minutes')['format'](_0x8a36('0xc2')),'ContactId':_0x512a48[_0x8a36('0xee')],'ListId':_0x512a48[_0x8a36('0xdb')],'VoiceQueueId':_0x512a48[_0x8a36('0xdc')]||undefined,'CampaignId':_0x512a48[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x128')));_0x3ef654({'reschedule':0x1});}}});}}};Dialer[_0x8a36('0x19')][_0x8a36('0x33')]=function(_0x26c326){var _0x8b4c5=this['uniqueId'][_0x26c326[_0x8a36('0xbf')]];var _0x5e5615;if(_0x8b4c5&&_0x8b4c5[_0x8a36('0x3e')]===_0x8a36('0xc4')){delete this[_0x8a36('0x24')][_0x26c326[_0x8a36('0xbf')]];this[_0x8a36('0xc0')](this[_0x8a36('0xac')][_0x8b4c5['queue']]);this[_0x8a36('0xac')][_0x8b4c5['queue']][_0x8a36('0x12e')]+=0x1;_0x5e5615=new Hangup(_0x8b4c5,_0x26c326);hopperUtils['createHistory'](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x12f')));hopperUtils['moveContactManagedDialer'](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x130')));}if(_0x8b4c5&&_0x8b4c5[_0x8a36('0x3e')]!==_0x8a36('0xc4')&&isNotNull(this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]][_0x8a36('0x131')])){delete this[_0x8a36('0x24')][_0x26c326[_0x8a36('0xbf')]];this[_0x8a36('0xc0')](this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]]);this['voiceQueues'][_0x8b4c5[_0x8a36('0xbe')]]['outboundAnswerCallsDay']+=0x1;this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5e5615=new Hangup(_0x8b4c5,_0x26c326);_0x5e5615[_0x8a36('0x6f')]=0x10;_0x5e5615[_0x8a36('0x70')]=_0x8a36('0x132');_0x5e5615[_0x8a36('0x129')]='AGI';hopperUtils['createHistory'](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x12f')));hopperUtils[_0x8a36('0xcb')](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x130')));}if(_0x8b4c5&&_0x8b4c5[_0x8a36('0x3e')]!==_0x8a36('0xc4')&&!isNotNull(this['voiceQueues'][_0x8b4c5[_0x8a36('0xbe')]][_0x8a36('0x131')])){if(_0x26c326[_0x8a36('0x133')]==='Normal\x20Clearing'){delete this[_0x8a36('0x24')][_0x26c326['uniqueid']];this[_0x8a36('0x1e')][_0x8b4c5['queue']][_0x8a36('0x112')]+=0x1;const _0x3311e5=new AgentComplete(_0x8b4c5,_0x26c326);_0x3311e5['CampaignId']=this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]]['id'];hopperUtils[_0x8a36('0xe1')](_0x3311e5)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xca')));hopperUtils[_0x8a36('0xcb')](_0x3311e5)[_0x8a36('0xa2')](loggerCatch('[syncAgentComplete]'));}else{delete this['uniqueId'][_0x26c326['uniqueid']];this[_0x8a36('0xc0')](this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]]);this[_0x8a36('0x1e')][_0x8b4c5[_0x8a36('0xbe')]][_0x8a36('0x134')]+=0x1;_0x5e5615=new Hangup(_0x8b4c5,_0x26c326);_0x5e5615[_0x8a36('0x6f')]=0xc;_0x5e5615['statedesc']=_0x26c326[_0x8a36('0x133')];_0x5e5615[_0x8a36('0x129')]=_0x8a36('0x135');hopperUtils[_0x8a36('0xe1')](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x12f')));hopperUtils[_0x8a36('0xcb')](_0x5e5615)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x130')));}}};Dialer[_0x8a36('0x19')][_0x8a36('0x9')]=function(_0x23e904){var _0x40173d=this;if(!_0x40173d[_0x8a36('0x29')][_0x23e904['name']]){_0x40173d[_0x8a36('0x29')][_0x23e904[_0x8a36('0x43')]]={'running':![]};}else if(_0x40173d['queuesSummary'][_0x23e904[_0x8a36('0x43')]][_0x8a36('0x136')]===!![]){return;}else if(_0x40173d[_0x8a36('0x29')][_0x23e904[_0x8a36('0x43')]][_0x8a36('0x136')]===![]){_0x40173d['queuesSummary'][_0x23e904[_0x8a36('0x43')]][_0x8a36('0x136')]=!![];}var _0x2f58f6=_0x40173d[_0x8a36('0x1e')][_0x23e904[_0x8a36('0x43')]];var _0xb0042d=_0x2f58f6[_0x8a36('0x6b')]!==utils['CAMPAIGN_STATUS'][_0x8a36('0x7d')];var _0xbc4be9=utils['isPreviewCampaign'](_0x2f58f6);_0x2f58f6[_0x8a36('0x137')]=utils['getQueueCampaignStatusMessage'](_0x2f58f6,_0x40173d['trunks']);Promise[_0x8a36('0xae')]()[_0x8a36('0x3c')](function(){if(_0x2f58f6[_0x8a36('0x137')]===utils['CAMPAIGN_STATUS'][_0x8a36('0x7d')]){if(_0xb0042d){clearPredictiveAttributes(_0x2f58f6);_0x23e904[_0x8a36('0x26')]=undefined;_0x23e904[_0x8a36('0x60')]=undefined;}if(_0x2f58f6[_0x8a36('0x137')]===utils[_0x8a36('0x6c')]['INACTIVE']){_0x23e904[_0x8a36('0x138')]=0x0;_0x23e904['paused']=0x0;_0x23e904[_0x8a36('0x139')]=0x0;_0x23e904['talking']=0x0;_0x23e904[_0x8a36('0x13a')]=0x0;}}else if(_0x2f58f6[_0x8a36('0x137')]===utils[_0x8a36('0x6c')][_0x8a36('0x13b')]&&!_0xbc4be9){return _0x40173d[_0x8a36('0x94')](_0x2f58f6,!![])[_0x8a36('0x3c')](function(){return _0x40173d[_0x8a36('0x94')](_0x2f58f6,![]);})[_0x8a36('0x3c')](function(){return _0x40173d[_0x8a36('0xb2')](_0x2f58f6);})['catch'](function(_0x2d67e6){loggerSyncQueueSummary[_0x8a36('0x62')](_0x8a36('0x13c'),util[_0x8a36('0x67')](_0x2d67e6,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2f58f6);});}else{clearPredictiveAttributes(_0x2f58f6);}})['then'](function(){var _0xbd1d34=_0x23e904[_0x8a36('0x13d')](_0x2f58f6);if(_0xbd1d34||_0x2f58f6[_0x8a36('0x13e')]){_0x2f58f6[_0x8a36('0x13e')]=![];_0x23e904[_0x8a36('0x13f')](_0x2f58f6);Object[_0x8a36('0x140')](_0x2f58f6,_0x23e904);emitOutboundVoiceQueueSummary(_0x23e904);}_0x40173d[_0x8a36('0x29')][_0x2f58f6[_0x8a36('0x43')]]['running']=![];})[_0x8a36('0xa2')](function(_0x262ed6){logger['error'](_0x8a36('0x13c'),util[_0x8a36('0x67')](_0x262ed6,{'showHidden':![],'depth':null}));_0x40173d[_0x8a36('0x29')][_0x2f58f6[_0x8a36('0x43')]]['running']=![];});};Dialer['prototype'][_0x8a36('0x31')]=_[_0x8a36('0x141')](function(){var _0x2da0e4=_[_0x8a36('0x142')](this[_0x8a36('0x1e')],function(_0x2470f9){return _0x2470f9[_0x8a36('0x143')];});var _0xfd060=_[_0x8a36('0x142')](this[_0x8a36('0x1f')],function(_0x3e62ea){return _0x3e62ea[_0x8a36('0x144')]&&_0x3e62ea[_0x8a36('0x88')]==='reachable';});if(_0x2da0e4[_0x8a36('0x9b')]>0x0&&_0xfd060[_0x8a36('0x9b')]>0x0){return Promise[_0x8a36('0xae')]()[_0x8a36('0x3c')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x2da0e4,'id'),previewRecallmeReminderInterval,_['map'](_0xfd060,'id')))[_0x8a36('0x3c')](function(_0x323c1a){for(var _0x3eab2b=0x0;_0x3eab2b<_0x323c1a[_0x8a36('0x9b')];_0x3eab2b++){var _0x4982ff=_0x323c1a[_0x3eab2b]['Agent'][_0x8a36('0x43')];if(_0x4982ff)io['to'](util[_0x8a36('0x41')]('user:%s',_0x4982ff))[_0x8a36('0x11a')]('user:dialPreviewRecallReminder',{'hopper':_0x323c1a[_0x3eab2b]});}})['catch'](function(_0x1d0450){logger[_0x8a36('0x66')](_0x8a36('0x145'),_0x1d0450);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8a36('0x19')]['loopClearZombieChannels']=function(){var _0x6dcb77=this;setInterval(function(){_0x6dcb77[_0x8a36('0x146')](_0x6dcb77[_0x8a36('0x24')],_0x8a36('0x147'));_0x6dcb77[_0x8a36('0x146')](_0x6dcb77[_0x8a36('0xf1')],_0x8a36('0x148'));},0x32c8);};Dialer[_0x8a36('0x19')][_0x8a36('0x146')]=function(_0x4c9dc0,_0x329172){var _0x2c8ada=this;for(var _0x10c373 in _0x4c9dc0){if(typeof _0x4c9dc0[_0x10c373]!==_0x8a36('0xab')){this[_0x8a36('0x1c')]['enqueue'](function(){if(!_[_0x8a36('0xf6')](_0x4c9dc0[_0x10c373])){return ami['Action']({'action':_0x8a36('0x88'),'channel':_0x4c9dc0[_0x10c373][_0x8a36('0xf2')]})[_0x8a36('0xa2')](function(_0x5ebfbb){if(_0x5ebfbb[_0x8a36('0x6b')]===_0x8a36('0x149')){setTimeout(function(){if(_0x4c9dc0[_0x10c373]&&_0x4c9dc0[_0x10c373][_0x8a36('0x3e')]!==_0x8a36('0xc4')){_0x2c8ada[_0x8a36('0xc0')](_0x2c8ada[_0x8a36('0x1e')][_0x4c9dc0[_0x10c373][_0x8a36('0xbe')]]);logger[_0x8a36('0x66')](_0x8a36('0x14a'),_0x329172,_0x10c373,_0x4c9dc0[_0x10c373][_0x8a36('0xbe')]);delete _0x4c9dc0[_0x10c373];}if(_0x4c9dc0[_0x10c373]&&_0x4c9dc0[_0x10c373]['type']==='ivr'){_0x2c8ada[_0x8a36('0xc0')](_0x2c8ada[_0x8a36('0xac')][_0x4c9dc0[_0x10c373][_0x8a36('0xbe')]]);logger[_0x8a36('0x66')](_0x8a36('0x14b'),_0x329172,_0x10c373,_0x4c9dc0[_0x10c373][_0x8a36('0xbe')]);delete _0x4c9dc0[_0x10c373];}},0x2328);}});}});}}};Dialer[_0x8a36('0x19')]['getVoiceQueueRtPauses']=function(_0x206c1f){return Promise[_0x8a36('0xae')]()[_0x8a36('0x3c')](voiceQueueRt[_0x8a36('0x14c')](_0x206c1f))[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x14d')));};Dialer['prototype']['updateOriginated']=function(_0x89c9b4){if(!_[_0x8a36('0x53')](_0x89c9b4)&&_0x89c9b4!==null){if(typeof _0x89c9b4[_0x8a36('0x14e')]!==_0x8a36('0xab')){if(_0x89c9b4['originated']>0x0){_0x89c9b4['originated']-=0x1;}else{logger[_0x8a36('0x66')](_0x8a36('0x14f'));}}}else{logger[_0x8a36('0x66')](_0x8a36('0x150'));}};Dialer[_0x8a36('0x19')][_0x8a36('0x151')]=function(_0x5aa374,_0x443431){var _0x2ee425=this;return function(_0x24fbe2){_0x2ee425[_0x8a36('0xc0')](_0x443431);logger['error'](_0x5aa374,util[_0x8a36('0x67')](_0x24fbe2,{'showHidden':![],'depth':null}));};};Dialer[_0x8a36('0x19')][_0x8a36('0x152')]=function(_0x285a08,_0x2da226,_0x1facb9){var _0x5e4f3f={'state':0x19,'statedesc':_0x8a36('0x153')};this[_0x8a36('0xc0')](_0x2da226);this[_0x8a36('0x12a')](_[_0x8a36('0x5e')](_0x5e4f3f,_[_0x8a36('0x77')](_0x1facb9,[_0x8a36('0xee'),'ListId',_0x8a36('0x154'),'VoiceQueueId',_0x8a36('0xdd')])),_0x8a36('0x155'),'[emptyContact]');logger['error'](_0x285a08);};Dialer[_0x8a36('0x19')]['saveInDb']=function(_0x3a0c51,_0x1af4b0,_0x15597b){hopperUtils[_0x8a36('0xe1')](_0x3a0c51)[_0x8a36('0xa2')](loggerCatch(_0x1af4b0));hopperUtils[_0x8a36('0xcb')](_0x3a0c51)[_0x8a36('0xa2')](loggerCatch(_0x15597b));};Dialer['prototype'][_0x8a36('0xec')]=function(_0x3587e3,_0x3825b4){hopperUtils[_0x8a36('0xe1')](_0x3587e3)['catch'](loggerCatch(_0x8a36('0xca')));if(_0x3825b4==0x0){hopperUtils[_0x8a36('0xcb')](_0x3587e3)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x156')));}};Dialer[_0x8a36('0x19')][_0x8a36('0x145')]=function(_0x4ccd3d){return Promise['resolve']()['then'](cmHopper[_0x8a36('0x157')](_0x4ccd3d['id'],previewRecallmeReminderInterval))[_0x8a36('0x3c')](function(_0x130bd6){for(var _0x42eb93=0x0;_0x42eb93<_0x130bd6[_0x8a36('0x9b')];_0x42eb93++){var _0x3d347b=_0x130bd6[_0x42eb93]['Agent'][_0x8a36('0x43')];if(_0x3d347b)io['to'](util[_0x8a36('0x41')](_0x8a36('0x158'),_0x3d347b))[_0x8a36('0x11a')](_0x8a36('0x159'),{'hopper':_0x130bd6[_0x42eb93]});}})[_0x8a36('0xa2')](function(){});};Dialer['prototype'][_0x8a36('0x15a')]=function(_0x3f4366){var _0x4901c4=this;return function(){_0x4901c4['handleIvr'](_0x3f4366);};};Dialer['prototype'][_0x8a36('0x15b')]=function(_0x4d0834,_0x5c280b){var _0x9c5a69=this;var _0x14191f=uuid['v4']();this[_0x8a36('0xf1')][_0x14191f]=new Action(_0x4d0834,_0x5c280b,_0x14191f);return new Promise(function(_0x3a6ffa,_0x52d1a0){if(_[_0x8a36('0x53')](_0x4d0834)&&typeof _0x4d0834!==_0x8a36('0x15c')){return _0x52d1a0(msgResponse(_0x8a36('0x15d'),_0x8a36('0x95'),_0x8a36('0x15e')));}if(_['isUndefined'](_0x5c280b['phone'])||_0x5c280b[_0x8a36('0x15f')]===null){return _0x52d1a0(msgResponse(_0x8a36('0x15d'),'Failure','contact\x20is\x20undefine'));}var _0x1385b5={'XMD-CALLERID':_0x9c5a69[_0x8a36('0xf1')][_0x14191f][_0x8a36('0x160')](),'XMD-AGI':_0x4d0834['dialQueueProject']?util[_0x8a36('0x41')](_0x8a36('0x161'),ipAgi,_0x4d0834['dialQueueProject']):_0x8a36('0x162'),'XMD-AGIAFTER':_0x4d0834[_0x8a36('0xc8')]?util[_0x8a36('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d0834[_0x8a36('0xc8')]):_0x8a36('0x162'),'XMD-QUEUE':utils[_0x8a36('0x163')](_0x4d0834)?util[_0x8a36('0x41')](_0x8a36('0x164'),_0x4d0834['name'],_0x4d0834[_0x8a36('0x165')]||'',_0x4d0834[_0x8a36('0xc9')]?'c':'',_0x4d0834[_0x8a36('0xcf')]||0x3):_0x8a36('0x162'),'XMD-CONTACTID':_0x5c280b['ContactId'],'XMD-CDRTYPE':_0x8a36('0x166'),'CALLERID(all)':_0x9c5a69[_0x8a36('0xf1')][_0x14191f][_0x8a36('0x160')](),'XMD-AMD':_0x4d0834[_0x8a36('0x10f')]?_0x8a36('0x13b'):_0x8a36('0x162'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4d0834[_0x8a36('0x10f')]){_0x1385b5[_0x8a36('0x167')]=_0x4d0834[_0x8a36('0x168')]||0x9c4;_0x1385b5[_0x8a36('0x169')]=_0x4d0834[_0x8a36('0x16a')]||0x5dc;_0x1385b5['XMD-AMDAFTERGREETINGSILENCE']=_0x4d0834['dialAMDAfterGreetingSilence']||0x320;_0x1385b5['XMD-AMDTOTALANALYSISTIME']=_0x4d0834[_0x8a36('0x16b')]||0x1388;_0x1385b5[_0x8a36('0x16c')]=_0x4d0834[_0x8a36('0x16d')]||0x64;_0x1385b5['XMD-AMDBETWEENWORDSSILENCE']=_0x4d0834[_0x8a36('0x16e')]||0x32;_0x1385b5[_0x8a36('0x16f')]=_0x4d0834[_0x8a36('0x170')]||0x3;_0x1385b5[_0x8a36('0x171')]=_0x4d0834[_0x8a36('0x172')]||0x100;_0x1385b5[_0x8a36('0x173')]=_0x4d0834[_0x8a36('0x174')]||0x1388;}if(utils[_0x8a36('0x163')](_0x4d0834)){_0x1385b5['XMD-VOICEQUEUEID']=_0x5c280b[_0x8a36('0xdc')];}else{_0x1385b5['XMD-CAMPAIGNID']=_0x5c280b['CampaignId'];}var _0x3b9a14=utils[_0x8a36('0x175')](_0x5c280b[_0x8a36('0x176')]);Object[_0x8a36('0x140')](_0x1385b5,_0x3b9a14);var _0x27d871=_0x9c5a69[_0x8a36('0x8c')](_0x4d0834[_0x8a36('0x8d')])?utils[_0x8a36('0x177')](_0x4d0834['Trunk'][_0x8a36('0x178')],_0x4d0834['dialOriginateCallerIdName'],_0x4d0834['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x8a36('0x179')](_0x4d0834[_0x8a36('0x17a')],_0x4d0834[_0x8a36('0x17b')]):_0x4d0834[_0x8a36('0x17a')]):utils[_0x8a36('0x177')](_[_0x8a36('0xf6')](_0x4d0834[_0x8a36('0x8e')])?_0x4d0834[_0x8a36('0x8d')][_0x8a36('0x178')]:_0x4d0834[_0x8a36('0x8e')][_0x8a36('0x178')],_0x4d0834[_0x8a36('0x17c')],_0x4d0834[_0x8a36('0x17b')]>0x0?utils[_0x8a36('0x179')](_0x4d0834[_0x8a36('0x17a')],_0x4d0834[_0x8a36('0x17b')]):_0x4d0834[_0x8a36('0x17a')]);if(_0x27d871){_0x1385b5['XMD-ORIGINATECALLERIDNAME']=_0x9c5a69['actions'][_0x14191f]['originatecalleridname']=utils['extractCalleridName'](_0x27d871);_0x1385b5[_0x8a36('0x17d')]=_0x5c280b[_0x8a36('0x15f')];}_0x4d0834[_0x8a36('0x17e')]=_0x1385b5;return ami[_0x8a36('0x9c')]({'actionid':_0x14191f,'action':_0x8a36('0x15d'),'channel':_0x9c5a69[_0x8a36('0x8c')](_0x4d0834[_0x8a36('0x8d')])?util[_0x8a36('0x41')]('SIP/%s/%s%s',_0x4d0834[_0x8a36('0x8d')][_0x8a36('0x43')],isNotNull(_0x4d0834[_0x8a36('0x17f')])?_0x4d0834[_0x8a36('0x17f')][_0x8a36('0x180')]()||'':'',_0x4d0834[_0x8a36('0x181')]>0x0?_0x5c280b[_0x8a36('0x15f')][_0x8a36('0x182')](_0x4d0834[_0x8a36('0x181')]):_0x5c280b[_0x8a36('0x15f')]):util[_0x8a36('0x41')](_0x8a36('0x183'),_[_0x8a36('0xf6')](_0x4d0834[_0x8a36('0x8e')])?_0x4d0834['Trunk'][_0x8a36('0x43')]:_0x4d0834[_0x8a36('0x8e')][_0x8a36('0x43')],isNotNull(_0x4d0834[_0x8a36('0x17f')])?_0x4d0834[_0x8a36('0x17f')][_0x8a36('0x180')]()||'':'',_0x4d0834['dialCutDigit']>0x0?_0x5c280b['phone'][_0x8a36('0x182')](_0x4d0834['dialCutDigit']):_0x5c280b[_0x8a36('0x15f')]),'callerid':_0x27d871,'Exten':_0x8a36('0x10e'),'Context':_0x8a36('0x184'),'Priority':'1','variable':_0x1385b5,'timeout':(_0x4d0834[_0x8a36('0x185')]||0x1e)*0x3e8,'async':!![],'channelid':_0x14191f})[_0x8a36('0x3c')](function(_0x113ee1){return _0x3a6ffa(_0x113ee1);})['catch'](function(_0x404968){_0x4d0834['outboundOriginateFailureCallsDay']+=0x1;var _0x5e4faa=new History(_0x9c5a69[_0x8a36('0xf1')][_0x14191f]);logger[_0x8a36('0x66')](util[_0x8a36('0x41')]('[originateError]:\x20%s',JSON[_0x8a36('0x76')](_0x404968)));_0x5e4faa[_0x8a36('0x6f')]=0xe;_0x5e4faa[_0x8a36('0x70')]=_0x8a36('0x186');_0x5e4faa[_0x8a36('0x72')]=moment()[_0x8a36('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e4faa['endtime']=_0x5e4faa[_0x8a36('0x72')];hopperUtils['createHistory'](_0x5e4faa)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x187')));_0x9c5a69['moveContactManagedDialer'](_0x5e4faa)[_0x8a36('0xa2')](loggerCatch('[originate][error]'))[_0x8a36('0x188')](function(){delete _0x9c5a69[_0x8a36('0xf1')][_0x14191f];return _0x52d1a0(msgResponse(_0x8a36('0x15d'),_0x8a36('0x86'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x3b842b,_0x2111d0,_0x71bd4e){var _0x1b5f75=new History(_0x2111d0);if(_0x1b5f75['countbusyretry']+_0x1b5f75[_0x8a36('0x11e')]+_0x1b5f75[_0x8a36('0x12c')]+_0x1b5f75['countnosuchnumberretry']+_0x1b5f75[_0x8a36('0xd3')]+_0x1b5f75[_0x8a36('0xe8')]+_0x1b5f75['countmachineretry']+_0x1b5f75[_0x8a36('0x12d')]>=_0x71bd4e[_0x8a36('0x120')]-0x1){return!![];}switch(_0x3b842b){case 0x3:if(_0x1b5f75[_0x8a36('0x12c')]>=_0x71bd4e['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countnoanswerretry':_0x1b5f75[_0x8a36('0x12c')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0x189')],_0x8a36('0xda'))[_0x8a36('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b5f75['ContactId'],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75['VoiceQueueId']||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1b5f75['countbusyretry']>=_0x71bd4e[_0x8a36('0x18a')]-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countbusyretry':_0x1b5f75['countbusyretry']+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0x18b')],_0x8a36('0xda'))[_0x8a36('0x41')](_0x8a36('0xc2')),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75['ListId'],'VoiceQueueId':_0x1b5f75['VoiceQueueId']||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x18c')));break;case 0x8:if(_0x1b5f75['countcongestionretry']>=_0x71bd4e[_0x8a36('0x18d')]-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countcongestionretry':_0x1b5f75[_0x8a36('0x11e')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e['dialCongestionRetryFrequency'],'minutes')[_0x8a36('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75['CampaignId']||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x18e')));break;case 0x0:if(_0x1b5f75[_0x8a36('0x11f')]>=_0x71bd4e[_0x8a36('0x18f')]-0x1){return!![];}else{hopperUtils[_0x8a36('0xd9')]({'active':![],'countnosuchnumberretry':_0x1b5f75[_0x8a36('0x11f')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0x190')],_0x8a36('0xda'))[_0x8a36('0x41')](_0x8a36('0xc2')),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})['catch'](loggerCatch(_0x8a36('0x191')));}break;case 0xa:if(_0x1b5f75[_0x8a36('0xd3')]>=_0x71bd4e[_0x8a36('0xd8')]-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countdropretry':_0x1b5f75['countdropretry']+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0xd5')],_0x8a36('0xda'))[_0x8a36('0x41')](_0x8a36('0xc2')),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75['ListId'],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0xde')));break;case 0xb:if(_0x1b5f75[_0x8a36('0xe8')]>=_0x71bd4e[_0x8a36('0xeb')]-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countabandonedretry':_0x1b5f75[_0x8a36('0xe8')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0xe9')],_0x8a36('0xda'))['format'](_0x8a36('0xc2')),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1b5f75[_0x8a36('0x123')]>=_0x71bd4e[_0x8a36('0x124')]-0x1){return!![];}hopperUtils[_0x8a36('0xd9')]({'active':![],'countmachineretry':_0x1b5f75[_0x8a36('0x123')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e['dialMachineRetryFrequency'],_0x8a36('0xda'))[_0x8a36('0x41')](_0x8a36('0xc2')),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1b5f75['countagentrejectretry']>=_0x71bd4e[_0x8a36('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1b5f75[_0x8a36('0x12d')]+=0x1,'scheduledat':moment()[_0x8a36('0xed')](_0x71bd4e[_0x8a36('0x193')],_0x8a36('0xda'))[_0x8a36('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b5f75[_0x8a36('0xee')],'ListId':_0x1b5f75[_0x8a36('0xdb')],'VoiceQueueId':_0x1b5f75[_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b5f75['CampaignId']||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x194')));break;default:return!![];}};Dialer[_0x8a36('0x19')]['callProgressDetecting']=function(_0x35ac75,_0xc992c2,_0x3fab9e){var _0x4e7fc4=this;var _0x263228=new History(_0x35ac75);var _0x1eb148=![];var _0x48ee54;var _0x546d1e;return new Promise(function(_0x58441b,_0x76b1c8){if(_[_0x8a36('0x53')](_0xc992c2)&&typeof _0xc992c2!==_0x8a36('0x15c')){return _0x76b1c8(msgResponse(_0x8a36('0x195'),_0x8a36('0x95'),'entity\x20is\x20undefine'));}if(_[_0x8a36('0x53')](_0x3fab9e)&&typeof _0x3fab9e!==_0x8a36('0x15c')){return _0x76b1c8(msgResponse(_0x8a36('0x195'),'Failure',_0x8a36('0x196')));}hopperUtils[_0x8a36('0xea')](_0x263228,_0x3fab9e[_0x8a36('0xc5')],_0xc992c2)[_0x8a36('0x3c')](function(_0x4a6023){if(_0x4a6023['additional']==0x1)_0x1eb148=!![];switch(_0x3fab9e['reason']){case'0':_0xc992c2[_0x8a36('0x197')]+=0x1;_0x263228[_0x8a36('0x6f')]=0x0;_0x263228[_0x8a36('0x70')]=_0x8a36('0x198');_0x263228[_0x8a36('0x11f')]+=0x1;_0x263228[_0x8a36('0xd4')]+=0x1;ami[_0x8a36('0x11a')](_0x8a36('0x199'),ut[_0x8a36('0x115')](_0x35ac75,_0x8a36('0x19a')));_0x48ee54=_0xc992c2[_0x8a36('0x190')];_0x546d1e=_0xc992c2[_0x8a36('0xd6')];hopperUtils['createHistory'](_0x263228)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x11c')));if(_0x4e7fc4[_0x8a36('0x19b')](0x0,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x11f')]>=_0xc992c2[_0x8a36('0x18f')]){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x19c'));}else{_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x19c'));}}break;case'3':_0xc992c2[_0x8a36('0x19d')]+=0x1;_0x263228[_0x8a36('0x6f')]=0x3;_0x263228[_0x8a36('0x70')]=_0x8a36('0x19e');_0x263228[_0x8a36('0x12c')]+=0x1;_0x263228[_0x8a36('0xd4')]+=0x1;var _0x2232a3=ut[_0x8a36('0x19f')](_0x35ac75,_0xc992c2);ami[_0x8a36('0x11a')]('custom:agentnoanswer',_0x2232a3);_0x48ee54=_0xc992c2[_0x8a36('0x189')];_0x546d1e=_0xc992c2['callAdditionalPhoneAfterMin'];hopperUtils[_0x8a36('0xe1')](_0x263228)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1a0')));if(_0x4e7fc4[_0x8a36('0x19b')](0x3,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x12c')]>=_0xc992c2['dialNoAnswerMaxRetry']){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1a1'));}else{_0x4e7fc4['stateGlobal'](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1a1'));}}break;case'5':_0xc992c2[_0x8a36('0x1a2')]+=0x1;_0x263228['state']=0x5;_0x263228[_0x8a36('0x70')]='Busy';_0x263228['countbusyretry']+=0x1;_0x263228[_0x8a36('0xd4')]+=0x1;ami[_0x8a36('0x11a')](_0x8a36('0x1a3'),ut['buildObj'](_0x35ac75,_0x8a36('0x1a4')));_0x48ee54=_0xc992c2[_0x8a36('0x18b')];_0x546d1e=_0xc992c2[_0x8a36('0xd6')];hopperUtils['createHistory'](_0x263228)[_0x8a36('0xa2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4e7fc4['checkRetriveMax'](0x5,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x11d')]>=_0xc992c2[_0x8a36('0x18a')]){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1a5'));}else{_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,'reason\x205\x20busy');}}break;case'8':_0xc992c2['outboundCongestionCallsDay']+=0x1;_0x263228[_0x8a36('0x6f')]=0x8;_0x263228[_0x8a36('0x70')]=_0x8a36('0x1a6');_0x263228[_0x8a36('0x11e')]+=0x1;_0x263228['countglobal']+=0x1;_0x48ee54=_0xc992c2[_0x8a36('0x1a7')];_0x546d1e=_0xc992c2['callAdditionalPhoneAfterMin'];ami[_0x8a36('0x11a')](_0x8a36('0x1a8'),ut[_0x8a36('0x115')](_0x35ac75,_0x8a36('0x1a9')));hopperUtils[_0x8a36('0xe1')](_0x263228)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1aa')));if(_0x4e7fc4['checkRetriveMax'](0x8,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x11e')]>=_0xc992c2[_0x8a36('0x18d')]){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1ab'));}else{_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,'reason\x208\x20congestion');}}break;case'11':_0xc992c2[_0x8a36('0x1ac')]+=0x1;_0x263228['state']=0xb;_0x263228[_0x8a36('0x70')]='Abandoned';_0x263228[_0x8a36('0xe8')]+=0x1;_0x263228[_0x8a36('0xd4')]+=0x1;_0x48ee54=_0xc992c2['dialAbandonedRetryFrequency'];_0x546d1e=_0xc992c2[_0x8a36('0xd6')];hopperUtils[_0x8a36('0xe1')](_0x263228)['catch'](loggerCatch(_0x8a36('0xf0')));if(_0x4e7fc4[_0x8a36('0x19b')](0xb,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0xe8')]>=_0xc992c2[_0x8a36('0xeb')]){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,'reason\x2011\x20abandoned');}else{_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,'reason\x2011\x20abandoned');}}break;case'20':_0xc992c2[_0x8a36('0x1ad')]+=0x1;_0x263228[_0x8a36('0x6f')]=0x14;_0x263228[_0x8a36('0x70')]='AgentReject';_0x263228[_0x8a36('0x12d')]+=0x1;_0x263228[_0x8a36('0xd4')]+=0x1;_0x48ee54=_0xc992c2['dialAgentRejectRetryFrequency'];_0x546d1e=_0xc992c2['callAdditionalPhoneAfterMin'];ami[_0x8a36('0x11a')](_0x8a36('0x1ae'),ut[_0x8a36('0x115')](_0x35ac75,_0x8a36('0x1af')));hopperUtils['createHistory'](_0x263228)[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1b0')));if(_0x4e7fc4[_0x8a36('0x19b')](0x14,_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x12d')]>=_0xc992c2[_0x8a36('0x192')]){_0x4e7fc4[_0x8a36('0x125')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1b1'));}else{_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,_0x8a36('0x1b1'));}}break;default:_0xc992c2['outboundUnknownCallsDay']+=0x1;_0x263228['state']=0xc;_0x263228[_0x8a36('0x70')]=_0x3fab9e[_0x8a36('0xc5')];_0x48ee54=_0xc992c2['dialAgentRejectRetryFrequency'];_0x546d1e=_0xc992c2[_0x8a36('0xd6')];hopperUtils[_0x8a36('0xe1')](_0x263228)[_0x8a36('0xa2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4e7fc4['checkRetriveMax'](_0x3fab9e[_0x8a36('0xc5')],_0x35ac75,_0xc992c2)&&!_0x1eb148){if(_0x263228[_0x8a36('0x11d')]+_0x263228['countcongestionretry']+_0x263228[_0x8a36('0x12c')]+_0x263228['countnosuchnumberretry']+_0x263228[_0x8a36('0xd3')]+_0x263228[_0x8a36('0xe8')]+_0x263228[_0x8a36('0x123')]+_0x263228[_0x8a36('0x12d')]>=_0xc992c2['dialGlobalMaxRetry']){_0x4e7fc4[_0x8a36('0x121')](_0x263228,_0x58441b,_0x76b1c8,_0x3fab9e['reason']);}else{_0x4e7fc4['createStateFinal'](_0x263228,_0x58441b,_0x76b1c8,_0x3fab9e['reason']);}}}})['then'](function(){if(_0x1eb148){hopperUtils[_0x8a36('0xe3')](_0x263228,_0x48ee54,_0x546d1e)[_0x8a36('0x3c')](function(){return _0x58441b(0x1);});}});});};Dialer['prototype'][_0x8a36('0x121')]=function(_0x325004,_0x265417,_0x33cdb6,_0x128417){var _0x24ad9b=new Final(_0x325004);_0x24ad9b['state']=0xf;_0x24ad9b['statedesc']=_0x8a36('0x1b2');this[_0x8a36('0x125')](_0x24ad9b,_0x265417,_0x33cdb6,_0x128417);};Dialer[_0x8a36('0x19')][_0x8a36('0x125')]=function(_0x19d5f2,_0x548313,_0x50fbb0,_0x2905ed){hopperUtils[_0x8a36('0xcb')](_0x19d5f2)['then'](function(){return _0x548313(msgResponse(_0x8a36('0x195'),_0x8a36('0x1b3'),_0x2905ed));})[_0x8a36('0xa2')](function(){return _0x50fbb0(msgResponse(_0x8a36('0x1b4'),_0x8a36('0x95'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x8a36('0x7')]=function(_0x2a19b2){var _0x1098b1=_0x2a19b2[_0x8a36('0x1b5')]/0x64;var _0x410c9b=_0x2a19b2['outboundDropCallsDayTimeout']/(_0x2a19b2[_0x8a36('0xd1')]+_0x2a19b2[_0x8a36('0x112')]);var _0x451445=Math['round'](_0x2a19b2[_0x8a36('0x1b6')]*(_0x2a19b2['predictiveIntervalMaxThreshold']/0x64));var _0x43cfc7=Math['round'](_0x2a19b2[_0x8a36('0x1b6')]*(_0x2a19b2[_0x8a36('0x1b7')]/0x64));var _0x4d317b=_0x2a19b2[_0x8a36('0x138')]+_0x2a19b2[_0x8a36('0x1b8')];var _0x32d07b=Math[_0x8a36('0x1b9')](_0x2a19b2[_0x8a36('0x1ba')]*_0x2a19b2[_0x8a36('0x5b')]*_0x2a19b2['predictiveIntervalHitRate']*_0x2a19b2[_0x8a36('0x1bb')]);if(_['isUndefined'](_0x2a19b2['startProgressive'])){if(!_[_0x8a36('0x53')](_0x2a19b2['startPredictive'])){_0x2a19b2[_0x8a36('0x26')]=undefined;loggerPredictive[_0x8a36('0x66')]('[startMethodPredictive][StartProgressive]',_0x8a36('0x1bc'));}if(!_[_0x8a36('0x53')](_0x2a19b2['handlePredictive'])){loggerPredictive[_0x8a36('0x66')](_0x8a36('0x1bd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2a19b2[_0x8a36('0x64')]);_0x2a19b2[_0x8a36('0x64')]=undefined;}_0x2a19b2[_0x8a36('0x60')]=moment()[_0x8a36('0x41')](_0x8a36('0xc2'));loggerPredictive['info'](_0x2a19b2[_0x8a36('0x43')],_0x8a36('0x1be'),_0x2a19b2[_0x8a36('0x60')]);this['handlePower'](_0x2a19b2,0x1);}else if(ifInterval(_0x2a19b2[_0x8a36('0x1bf')],_0x2a19b2['startProgressive'])){this[_0x8a36('0xb5')](_0x2a19b2,0x1);loggerPredictiveCalls[_0x8a36('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x2a19b2[_0x8a36('0x60')],_0x2a19b2[_0x8a36('0x43')]);_0x2a19b2['erlangCalls']=0x0;_0x2a19b2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1098b1<_0x410c9b&&_0x2a19b2[_0x8a36('0x1c0')]===_0x8a36('0x1c1')){clearPredictiveAttributes(_0x2a19b2);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x1c2'),_0x8a36('0x1c3'),_0x410c9b,_0x8a36('0x60'),_0x2a19b2[_0x8a36('0x43')]);}else if(_0x32d07b<_0x2a19b2[_0x8a36('0xd2')]&&_0x2a19b2[_0x8a36('0x1c0')]==='dropRate'){clearPredictiveAttributes(_0x2a19b2);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x1c4'),'Max\x20Drop\x20',_0x32d07b,'Drop\x20in\x20this\x20interval',_0x2a19b2[_0x8a36('0xd2')],'startProgressive',_0x2a19b2[_0x8a36('0x43')]);}else if(!ifInterval(_0x2a19b2['dialPredictiveInterval'],_0x2a19b2[_0x8a36('0x60')])&&_['isUndefined'](_0x2a19b2[_0x8a36('0x26')])&&!_[_0x8a36('0x53')](_0x2a19b2[_0x8a36('0x60')])){_0x2a19b2[_0x8a36('0x26')]=moment()[_0x8a36('0x41')](_0x8a36('0xc2'));loggerPredictive[_0x8a36('0x4a')](_0x2a19b2[_0x8a36('0x43')],_0x8a36('0x1c5'),_0x2a19b2['startPredictive']);hopperUtils[_0x8a36('0x1c6')](_0x2a19b2[_0x8a36('0x1bf')])[_0x8a36('0x3c')](this[_0x8a36('0x1c7')](_0x2a19b2))[_0x8a36('0x3c')](mergeDataErlangB(_0x2a19b2))[_0x8a36('0x3c')](this['startMethodPredictive'](_0x2a19b2))[_0x8a36('0xa2')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2a19b2));}else if(!ifInterval(_0x2a19b2[_0x8a36('0x1bf')],_0x2a19b2['startPredictive'])){_0x2a19b2['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2a19b2[_0x8a36('0x26')]=moment()['format'](_0x8a36('0xc2'));loggerPredictive[_0x8a36('0x4a')](_0x2a19b2[_0x8a36('0x43')],_0x8a36('0x1c8'),_0x2a19b2[_0x8a36('0x26')]);clearInterval(_0x2a19b2[_0x8a36('0x64')]);_0x2a19b2['handlePredictive']=undefined;hopperUtils[_0x8a36('0x1c6')](_0x2a19b2[_0x8a36('0x1bf')])['then'](this[_0x8a36('0x1c7')](_0x2a19b2))[_0x8a36('0x3c')](mergeDataErlangB(_0x2a19b2))[_0x8a36('0x3c')](this[_0x8a36('0x1c9')](_0x2a19b2))[_0x8a36('0xa2')](loggerCatchPredictive(_0x8a36('0x1ca'),_0x2a19b2));}else if(_0x2a19b2[_0x8a36('0x1b6')]&&_0x4d317b<_0x2a19b2['predictiveIntervalAvailable']-_0x43cfc7){clearPredictiveAttributes(_0x2a19b2);loggerPredictive[_0x8a36('0x4a')](_0x2a19b2['name'],_0x8a36('0x1cb'),_0x4d317b,_0x8a36('0x1cc'),_0x2a19b2['predictiveIntervalAvailable'],'-',_0x43cfc7,'=',_0x2a19b2['predictiveIntervalAvailable']-_0x43cfc7,')');}else if(_0x2a19b2[_0x8a36('0x1b6')]&&_0x4d317b>_0x2a19b2[_0x8a36('0x1b6')]+_0x451445){clearPredictiveAttributes(_0x2a19b2);loggerPredictive[_0x8a36('0x4a')](_0x2a19b2['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4d317b,')\x20are\x20more\x20than\x20threshold\x20(',_0x2a19b2[_0x8a36('0x1b6')],'+',_0x451445,'=',_0x2a19b2[_0x8a36('0x1b6')]+_0x451445,')');}};Dialer[_0x8a36('0x19')][_0x8a36('0x1c7')]=function(_0xc6e51c){var _0x41e4c9=this;return function(_0x42102d){return new Promise(function(_0x4863a4,_0x283a60){_[_0x8a36('0x5e')](_0xc6e51c,_0x42102d[0x0]);if(checkGetDataPredictive(_0x42102d[0x0])){var _0x2c09e2=_0xc6e51c[_0x8a36('0x1b6')]=_0xc6e51c[_0x8a36('0x1b8')]+_0xc6e51c[_0x8a36('0x138')];var _0x2c2623=_0xc6e51c[_0x8a36('0x1bf')]*0x3c;var _0x445912=_0x42102d[0x0][_0x8a36('0x50')]+_0x42102d[0x0][_0x8a36('0x55')];var _0x320ddc=(_0x42102d[0x0][_0x8a36('0x49')]+_0x42102d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x42102d[0x0][_0x8a36('0x4d')])/_0x42102d[0x0][_0x8a36('0x52')];_0xc6e51c[_0x8a36('0x1cd')]=_0x320ddc>0x0?_0x320ddc:0x1;switch(_0xc6e51c[_0x8a36('0x1c0')]){case _0x8a36('0x1c1'):var _0xb06186=_0xc6e51c[_0x8a36('0x1b5')]/0x64;return _0x41e4c9['abandonmentRate'](_0x2c09e2,_0x2c2623,_0x445912,_0x320ddc,_0xb06186)['then'](function(_0x24ceee){return _0x4863a4(_0x24ceee);});case _0x8a36('0x1ce'):var _0x96d21a=_0xc6e51c['dialPredictiveOptimizationPercentage']/0x64;return _0x41e4c9[_0x8a36('0x1cf')](_0x2c09e2,_0x2c2623,_0x445912,_0x320ddc,_0x96d21a)[_0x8a36('0x3c')](function(_0x10050f){return _0x4863a4(_0x10050f);});default:return _0x283a60(msgResponse('[getDataPredictive]',_0x8a36('0x95'),_0x8a36('0x1d0')));}}else{return _0x283a60(msgResponse('[getDataPredictive]',_0x8a36('0x95'),_0x8a36('0x1d1')));}});};};Dialer[_0x8a36('0x19')][_0x8a36('0x1d2')]=function(_0xd633e4){var _0x4c914c=this;return function(_0x3d2fb7){return new Promise(function(_0x3466b9,_0x1dbb63){_[_0x8a36('0x5e')](_0xd633e4,_0x3d2fb7[0x0]);if(checkGetDataPredictive(_0x3d2fb7[0x0])){loggerPredictive[_0x8a36('0x4a')](JSON[_0x8a36('0x76')](_0x3d2fb7[0x0]));if(_0xd633e4[_0x8a36('0x1c0')]==='dropRate'){return _0x4c914c[_0x8a36('0x14c')](_0xd633e4['id'])['then'](function(_0x24d368){var _0x143bdd=_0xd633e4[_0x8a36('0x1d3')]-_0x24d368[0x0]['outboundQueuePauses'];var _0x3a7628=_0xd633e4[_0x8a36('0x1bf')]*0x3c;var _0x4b0164=_0x3d2fb7[0x0][_0x8a36('0x50')]+_0x3d2fb7[0x0][_0x8a36('0x55')];var _0x5c918d=(_0x3d2fb7[0x0][_0x8a36('0x49')]+_0x3d2fb7[0x0][_0x8a36('0xd0')]+_0x3d2fb7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3d2fb7[0x0][_0x8a36('0x52')];var _0x16cbd7=_0xd633e4[_0x8a36('0x1b5')]/0x64;_0xd633e4['predictiveIntervalPauses']=_0x24d368[0x0][_0x8a36('0x1d4')]||0x0;_0xd633e4[_0x8a36('0x1cd')]=_0x5c918d>0x0?_0x5c918d:0x1;return _0x4c914c['abandonmentRate'](_0x143bdd,_0x3a7628,_0x4b0164,_0x5c918d,_0x16cbd7);})[_0x8a36('0x3c')](function(_0x19fdf7){return _0x3466b9(_0x19fdf7);})[_0x8a36('0xa2')](function(_0x2bb225){return _0x1dbb63(msgResponse('[CatchErlangB]',_0x8a36('0x95'),JSON['stringify'](_0x2bb225)));});}if(_0xd633e4['dialPredictiveOptimization']===_0x8a36('0x1ce')){return _0x4c914c['getVoiceQueueRtPauses'](_0xd633e4['id'])[_0x8a36('0x3c')](function(_0x3c7c89){var _0xd682ba=_0xd633e4[_0x8a36('0x1d3')]-_0x3c7c89[0x0][_0x8a36('0x1d4')];var _0x802825=_0xd633e4[_0x8a36('0x1bf')]*0x3c;var _0x4d58f5=_0x3d2fb7[0x0][_0x8a36('0x50')]+_0x3d2fb7[0x0]['predictiveIntervalAvgHoldtime'];var _0x2089dd=(_0x3d2fb7[0x0][_0x8a36('0x49')]+_0x3d2fb7[0x0][_0x8a36('0xd0')]+_0x3d2fb7[0x0][_0x8a36('0x4d')])/_0x3d2fb7[0x0][_0x8a36('0x52')];var _0x2d0619=_0xd633e4[_0x8a36('0x1b5')]/0x64;_0xd633e4[_0x8a36('0x1d5')]=_0x3c7c89[0x0][_0x8a36('0x1d4')]||0x0;_0xd633e4[_0x8a36('0x1cd')]=_0x2089dd>0x0?_0x2089dd:0x1;return _0x4c914c[_0x8a36('0x1cf')](_0xd682ba,_0x802825,_0x4d58f5,_0x2089dd,_0x2d0619);})[_0x8a36('0x3c')](function(_0x1704cd){return _0x3466b9(_0x1704cd);})['catch'](function(_0x4243c8){return _0x1dbb63(msgResponse(_0x8a36('0x1d6'),'Failure',JSON[_0x8a36('0x76')](_0x4243c8)));});}}else{return _0x1dbb63(msgResponse(_0x8a36('0x1d7'),'Failure',_0x8a36('0x1d1')));}});};};Dialer[_0x8a36('0x19')][_0x8a36('0x1c9')]=function(_0x13edcf){var _0x3ea4ac=this;return function(){var _0x99d39e=0x0;var _0x4028f1=Math[_0x8a36('0x1b9')](_0x13edcf['erlangCallToSecond']*0x3e8);if(_0x4028f1>0x0){_0x4028f1=_0x4028f1<0x64?0x64:_0x4028f1;loggerPredictive['info'](_0x13edcf[_0x8a36('0x43')],'one\x20call\x20every:',_0x4028f1,'milliseconds');_0x13edcf[_0x8a36('0x64')]=setInterval(function(){_0x3ea4ac[_0x8a36('0x64')](_0x13edcf);loggerPredictiveCalls['info'](_0x8a36('0x1d8'),_0x99d39e+=0x1);},_0x4028f1);}else{loggerPredictive[_0x8a36('0x4a')](_0x13edcf[_0x8a36('0x43')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x8a36('0x19')][_0x8a36('0x1d9')]=function(_0x5118b0,_0x2ec888){var _0x1b1490=this;return function(_0xa8b41c){if(_['isEmpty'](_0xa8b41c)){if(_[_0x8a36('0xf6')](_0x2ec888[_0x8a36('0x154')])||!_0x2ec888[_0x8a36('0x1da')]){if(_0x5118b0['dialMethod']===_0x8a36('0x6')){_0x5118b0['queueStatusComplete']=_[_0x8a36('0x53')](_0x5118b0[_0x8a36('0x73')])?!![]:_0x5118b0[_0x8a36('0x73')];var _0x259bc3=uuid['v4']();_0x1b1490[_0x8a36('0xf1')][_0x259bc3]=new Action(_0x5118b0,_0x2ec888,_0x259bc3);loggerBooked[_0x8a36('0x4a')](_0x8a36('0x1db'),_0x259bc3,_0x8a36('0x1dc'),JSON[_0x8a36('0x76')](_0x5118b0[_0x8a36('0x73')]),_0x8a36('0x1dd'),_0x5118b0[_0x8a36('0x43')]);if(_0x5118b0['queueStatusComplete']){_0x5118b0[_0x8a36('0x73')]=![];_0x1b1490[_0x8a36('0x27')][_0x1b1490[_0x8a36('0xf1')][_0x259bc3][_0x8a36('0xbe')]]=[];ami[_0x8a36('0x9c')]({'actionid':_0x259bc3,'action':_0x8a36('0x1de'),'queue':_0x5118b0[_0x8a36('0x43')]})[_0x8a36('0xa2')](function(){_0x1b1490[_0x8a36('0xc0')](_0x5118b0);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1b1490['actions'][_0x259bc3]['ContactId'],'ListId':_0x1b1490['actions'][_0x259bc3][_0x8a36('0xdb')],'VoiceQueueId':_0x1b1490[_0x8a36('0xf1')][_0x259bc3]['VoiceQueueId']||undefined,'CampaignId':_0x1b1490[_0x8a36('0xf1')][_0x259bc3][_0x8a36('0xdd')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1b1490[_0x8a36('0xf1')][_0x259bc3];});}else{loggerBooked[_0x8a36('0x4a')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x5118b0[_0x8a36('0x73')]),_0x8a36('0x1dd'),_0x5118b0[_0x8a36('0x43')]);_0x1b1490[_0x8a36('0xc0')](_0x5118b0);hopperUtils[_0x8a36('0xd9')]({'active':![],'ContactId':_0x1b1490[_0x8a36('0xf1')][_0x259bc3]['ContactId'],'ListId':_0x1b1490['actions'][_0x259bc3][_0x8a36('0xdb')],'VoiceQueueId':_0x1b1490[_0x8a36('0xf1')][_0x259bc3][_0x8a36('0xdc')]||undefined,'CampaignId':_0x1b1490[_0x8a36('0xf1')][_0x259bc3][_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1df')));delete _0x1b1490['actions'][_0x259bc3];}}else{return _0x1b1490['actionOriginate'](_0x5118b0,_0x2ec888);}}else{if(utils[_0x8a36('0x5f')](undefined,_0x2ec888[_0x8a36('0x1e0')])<_0x5118b0[_0x8a36('0x1e1')]*0x3c){if(_0x2ec888['Agent']&&!_0x2ec888['Agent'][_0x8a36('0x1e2')]){_0x1b1490['preview'][_0x8a36('0xfb')](_0x2ec888['id'])[_0x8a36('0x188')](function(){_0x1b1490[_0x8a36('0xc0')](_0x5118b0);});}else{hopperUtils[_0x8a36('0x1e3')]({'active':![]},_0x2ec888['id'],0x1)[_0x8a36('0x188')](function(){_0x1b1490[_0x8a36('0xc0')](_0x5118b0);});}}else{_0x5118b0[_0x8a36('0x1e4')]+=0x1;_0x1b1490[_0x8a36('0xc0')](_0x5118b0);if(_0x5118b0[_0x8a36('0x1e5')]){hopperUtils[_0x8a36('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2ec888['ContactId'],'ListId':_0x2ec888[_0x8a36('0xdb')],'VoiceQueueId':_0x2ec888[_0x8a36('0xdc')]||undefined,'CampaignId':_0x2ec888[_0x8a36('0xdd')]||undefined})[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1e6')));hopperUtils['createHistory'](createObjHistory(_0x5118b0,_0x2ec888,utils[_0x8a36('0x6c')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x8a36('0xa2')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1b1490[_0x8a36('0x12a')](createObjHistory(_0x5118b0,_0x2ec888,utils[_0x8a36('0x6c')][_0x8a36('0x1e7')],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x5118b0[_0x8a36('0x1e8')]+=0x1;_0x1b1490[_0x8a36('0x12a')](createObjHistory(_0x5118b0,_0x2ec888,utils['CAMPAIGN_STATUS'][_0x8a36('0x1e9')],0xd,_0x8a36('0x1ea')),_0x8a36('0x1eb'),'[Originate][MoveBlacklist]');throw _0x8a36('0x1ec');}};};Dialer[_0x8a36('0x19')][_0x8a36('0x1ed')]=function(_0x157740){var _0x5d4ed8=this;var _0x384461=_0x157740[_0x8a36('0x1ee')]-_0x157740[_0x8a36('0x14e')];emitCampaignSummary(_0x157740);if(_0x384461>0x0&&_0x157740[_0x8a36('0x69')]==0x0){if(_0x384461>this[_0x8a36('0x21')]){_0x384461=this['maxNumberOriginate'];}_0x157740[_0x8a36('0x69')]=0x1;hopperUtils[_0x8a36('0x1ef')](_0x157740,_0x384461)['then'](function(_0x3b1c29){_0x157740[_0x8a36('0x69')]=0x0;if(_0x3b1c29){if(!utils[_0x8a36('0x1f0')](_0x3b1c29)){_0x157740['message']=utils[_0x8a36('0x6c')][_0x8a36('0x1f1')];logger[_0x8a36('0x4a')]('[getContactCampaign2][Empty]'+_0x157740[_0x8a36('0x43')]);}else{_0x157740[_0x8a36('0x14e')]+=_0x3b1c29['length'];_0x157740['message']=utils[_0x8a36('0x6c')][_0x8a36('0x1f2')];for(var _0x97d637=0x0;_0x97d637<_0x3b1c29[_0x8a36('0x9b')];_0x97d637+=0x1){_0x157740[_0x8a36('0x1f3')]+=0x1;if(_[_0x8a36('0xf6')](_0x3b1c29[_0x97d637])||_[_0x8a36('0xf6')](_0x3b1c29[_0x97d637]['Contact'])||_[_0x8a36('0xf6')](_0x3b1c29[_0x97d637][_0x8a36('0x15f')])){_0x5d4ed8['emptyContact']('[actionOriginate]\x20',_0x157740,_0x3b1c29[_0x97d637]);}else{hopperUtils[_0x8a36('0x1f4')](_[_0x8a36('0x77')](_0x3b1c29[_0x97d637],[_0x8a36('0xdd'),_0x8a36('0x15f')]))[_0x8a36('0x3c')](_0x5d4ed8[_0x8a36('0x1d9')](_0x157740,_0x3b1c29[_0x97d637]))[_0x8a36('0xa2')](_0x5d4ed8[_0x8a36('0x151')](_0x8a36('0x1f5'),_0x157740));}}}}})[_0x8a36('0xa2')](loggerGetContactDialer(_0x8a36('0x1f6'),_0x157740,_0x384461));}};Dialer[_0x8a36('0x19')][_0x8a36('0xb5')]=function(_0x53a448,_0xfdff23){var _0x307729=this;var _0x2418cf=[];if(_0xfdff23<0x1||_0x53a448[_0x8a36('0xb3')]==='booked'){_0xfdff23=0x1;}var _0xce007e=Math[_0x8a36('0x1b9')](_0x53a448[_0x8a36('0x138')]*_0xfdff23)-_0x53a448[_0x8a36('0x14e')];if(_0x53a448[_0x8a36('0x1f7')]>0x0){var _0x222bb6=_0x53a448['dialLimitQueue']-_0x53a448['originated']-_0x53a448[_0x8a36('0x1b8')]-_0x53a448[_0x8a36('0x13a')];if(_0xce007e>_0x222bb6){_0xce007e=_0x222bb6;}}if(_0xce007e>0x0&&_0x53a448[_0x8a36('0x69')]==0x0){if(_0x53a448['dialMethod']===_0x8a36('0x6')){_0xce007e=0x1;}if(_0xce007e>this[_0x8a36('0x21')]){_0xce007e=this[_0x8a36('0x21')];}for(var _0x49d568 in this[_0x8a36('0x1f')]){if(typeof this['agents'][_0x49d568]!==_0x8a36('0xab')){if(this[_0x8a36('0x1f')][_0x49d568][_0x8a36('0x6f')]===_0x8a36('0x1f8')&&this['agents'][_0x49d568][_0x8a36('0x88')]===_0x8a36('0x89')){_0x2418cf['push'](this[_0x8a36('0x1f')][_0x49d568]['id']);}}}_0x53a448[_0x8a36('0x69')]=0x1;hopperUtils[_0x8a36('0x1f9')](_0x53a448,_0x2418cf,_0xce007e)[_0x8a36('0x3c')](function(_0x3d0937){_0x53a448[_0x8a36('0x69')]=0x0;if(_0x3d0937){if(!utils[_0x8a36('0x1f0')](_0x3d0937)){hopperUtils[_0x8a36('0x1fa')](_0x53a448)[_0x8a36('0x3c')](sendMessageReschedule(_0x53a448))['catch'](loggerCatch(_0x8a36('0x1fb')));}else{_0x53a448[_0x8a36('0x14e')]+=_0x3d0937[_0x8a36('0x9b')];_0x53a448[_0x8a36('0x6b')]=_0x53a448['dialMethod']===_0x8a36('0x6')?utils['CAMPAIGN_STATUS'][_0x8a36('0x13b')]:utils[_0x8a36('0x6c')][_0x8a36('0x1f2')];for(var _0x4495cc=0x0;_0x4495cc<_0x3d0937[_0x8a36('0x9b')];_0x4495cc+=0x1){if(_['isNil'](_0x3d0937[_0x4495cc])||_[_0x8a36('0xf6')](_0x3d0937[_0x4495cc][_0x8a36('0x176')])||_[_0x8a36('0xf6')](_0x3d0937[_0x4495cc][_0x8a36('0x15f')])){_0x307729['emptyContact'](_0x8a36('0x1fc'),_0x53a448,_0x3d0937[_0x4495cc]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x3d0937[_0x4495cc],[_0x8a36('0xdc'),_0x8a36('0x15f')]))[_0x8a36('0x3c')](_0x307729[_0x8a36('0x1d9')](_0x53a448,_0x3d0937[_0x4495cc]))[_0x8a36('0xa2')](_0x307729[_0x8a36('0x151')](_0x8a36('0x1fc'),_0x53a448));}}}}})[_0x8a36('0xa2')](loggerGetContactDialer(_0x8a36('0x1fd'),_0x53a448,_0xce007e));}};Dialer['prototype'][_0x8a36('0x64')]=function(_0x1e9b5a){if(_0x1e9b5a[_0x8a36('0x1f7')]>0x0){var _0x5b32a8=_0x1e9b5a['dialLimitQueue']-_0x1e9b5a['originated']-_0x1e9b5a[_0x8a36('0x1b8')];if(_0x5b32a8>0x0&&_0x1e9b5a[_0x8a36('0x69')]==0x0){this['tryOriginatePredictive'](_0x1e9b5a);}else{loggerPredictiveCalls[_0x8a36('0x4a')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x1e9b5a);}};Dialer[_0x8a36('0x19')]['tryOriginatePredictive']=function(_0x2e9c16){var _0x1818a7=this;var _0x3b50e6=[];_0x2e9c16['originated']+=0x1;for(var _0x183c2a in this[_0x8a36('0x1f')]){if(typeof this[_0x8a36('0x1f')][_0x183c2a]!==_0x8a36('0xab')){if(this[_0x8a36('0x1f')][_0x183c2a][_0x8a36('0x6f')]==='not_inuse'&&this[_0x8a36('0x1f')][_0x183c2a][_0x8a36('0x88')]===_0x8a36('0x89')){_0x3b50e6['push'](this['agents'][_0x183c2a]['id']);}}}_0x2e9c16[_0x8a36('0x69')]=0x1;return this['getContactDialer'](_0x2e9c16['id'],_0x3b50e6,0x1,_0x2e9c16[_0x8a36('0x1fe')],_0x2e9c16)[_0x8a36('0x3c')](function(_0x2625ef){_0x2e9c16[_0x8a36('0x69')]=0x1;if(_0x2625ef){if(!utils[_0x8a36('0x1f0')](_0x2625ef)){utils[_0x8a36('0x68')](_0x2e9c16,0x1,0x0);return hopperUtils[_0x8a36('0x1fa')](_0x2e9c16)[_0x8a36('0x3c')](sendMessageReschedule(_0x2e9c16))[_0x8a36('0xa2')](loggerCatch(_0x8a36('0x1fb')));}else{_0x2e9c16['message']=utils[_0x8a36('0x6c')]['RUNNING'];if(_[_0x8a36('0xf6')](_0x2625ef[0x0])||_[_0x8a36('0xf6')](_0x2625ef[0x0][_0x8a36('0x176')])||_['isNil'](_0x2625ef[0x0][_0x8a36('0x15f')])){_0x1818a7[_0x8a36('0x152')](_0x8a36('0x1fc'),_0x2e9c16,_0x2625ef[0x0]);}else{return hopperUtils[_0x8a36('0x1ff')](_[_0x8a36('0x77')](_0x2625ef[0x0],[_0x8a36('0xdc'),'phone']))[_0x8a36('0x3c')](_0x1818a7['checkContactBlack'](_0x2e9c16,_0x2625ef[0x0]))[_0x8a36('0xa2')](_0x1818a7[_0x8a36('0x151')](_0x8a36('0x200'),_0x2e9c16));}}}})[_0x8a36('0xa2')](loggerGetContactDialer(_0x8a36('0x201'),_0x2e9c16,0x1));};Dialer[_0x8a36('0x19')][_0x8a36('0x202')]=function(_0x597405,_0x54c78e,_0x5db715,_0x40ed2a,_0x59ac17,_0x1fc8ae){loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x203'));loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x204'),_0x597405);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x205'),_0x54c78e);loggerPredictive[_0x8a36('0x4a')]('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',_0x5db715);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x206'),_0x40ed2a);loggerPredictive['info'](_0x8a36('0x207'),_0x59ac17);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x51'));return new Promise(function(_0x27f229,_0x5e2146){if(_0x597405<=0x0||isNaN(_0x597405)){return _0x5e2146(msgResponse('[abandonmentRate]',_0x8a36('0x86'),_0x8a36('0x208')+_0x597405));}if(_0x5db715<=0x0||isNaN(_0x5db715)){return _0x5e2146(msgResponse(_0x8a36('0x209'),_0x8a36('0x86'),'Ts\x20=\x20'+_0x5db715));}if(_0x40ed2a<=0x0||isNaN(_0x40ed2a)){return _0x5e2146(msgResponse(_0x8a36('0x209'),_0x8a36('0x86'),_0x8a36('0x20a')+_0x40ed2a));}if(_0x54c78e<=0x0||isNaN(_0x54c78e)){return _0x5e2146(msgResponse(_0x8a36('0x209'),_0x8a36('0x86'),_0x8a36('0x20b')+_0x54c78e));}if(_0x59ac17<=0x0||isNaN(_0x59ac17)){return _0x5e2146(msgResponse(_0x8a36('0x209'),_0x8a36('0x86'),_0x8a36('0x20c')+_0x59ac17));}_0x1fc8ae=_0x1fc8ae||0x0;var _0x2f3141=0x1/_0x5db715;var _0x1a6bf8=0x0;var _0x145cea=0x0;var _0x3f7c1e=0x0;var _0x33abdc=0x0;for(var _0x2eee5f=0x0;_0x3f7c1e<_0x59ac17;_0x2eee5f+=0x1){_0x145cea=_0x2eee5f/_0x54c78e;_0x1a6bf8=(_0x40ed2a*_0x145cea+_0x1fc8ae)/_0x2f3141;_0x3f7c1e=utils[_0x8a36('0x20d')](_0x1a6bf8,_0x597405);_0x33abdc=_0x1a6bf8/_0x597405*(0x1-utils[_0x8a36('0x20d')](_0x1a6bf8,_0x597405));}return _0x27f229({'erlangCalls':_0x2eee5f,'erlangCallToSecond':_0x54c78e/_0x2eee5f,'erlangAbandonmentRate':_0x3f7c1e,'erlangBusyFactor':_0x33abdc});});};Dialer[_0x8a36('0x19')][_0x8a36('0x1cf')]=function(_0x87cf7f,_0x5adda0,_0x4a2511,_0x2215e7,_0x4d4ea3,_0x32df4d){loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x20e'));loggerPredictive['info'](_0x8a36('0x204'),_0x87cf7f);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x205'),_0x5adda0);loggerPredictive[_0x8a36('0x4a')]('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',_0x4a2511);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x206'),_0x2215e7);loggerPredictive[_0x8a36('0x4a')](_0x8a36('0x20f'),_0x4d4ea3);loggerPredictive[_0x8a36('0x4a')]('---------------------------');return new Promise(function(_0x119e04,_0x49f1a4){if(_0x87cf7f<=0x0||isNaN(_0x87cf7f)){return _0x49f1a4(msgResponse(_0x8a36('0x210'),_0x8a36('0x86'),_0x8a36('0x208')+_0x87cf7f));}if(_0x4a2511<=0x0||isNaN(_0x4a2511)){return _0x49f1a4(msgResponse(_0x8a36('0x210'),_0x8a36('0x86'),_0x8a36('0x211')+_0x4a2511));}if(_0x2215e7<=0x0||isNaN(_0x2215e7)){return _0x49f1a4(msgResponse('[busyFactor]',_0x8a36('0x86'),_0x8a36('0x20a')+_0x2215e7));}if(_0x5adda0<=0x0||isNaN(_0x5adda0)){return _0x49f1a4(msgResponse(_0x8a36('0x210'),_0x8a36('0x86'),_0x8a36('0x20b')+_0x5adda0));}if(_0x4d4ea3<=0x0||isNaN(_0x4d4ea3)){return _0x49f1a4(msgResponse(_0x8a36('0x210'),_0x8a36('0x86'),_0x8a36('0x212')+_0x4d4ea3));}_0x32df4d=_0x32df4d||0x0;var _0xdd6be5=0x1/_0x4a2511;var _0x11ce2b=0x0;var _0x237065=0x0;var _0x467d1b=0x0;var _0xa78132=0x0;for(var _0x7e92f8=0x0;_0xa78132<_0x4d4ea3;_0x7e92f8+=0x1){_0x237065=_0x7e92f8/_0x5adda0;_0x11ce2b=(_0x2215e7*_0x237065+_0x32df4d)/_0xdd6be5;_0x467d1b=utils[_0x8a36('0x20d')](_0x11ce2b,_0x87cf7f);_0xa78132=_0x11ce2b/_0x87cf7f*(0x1-utils['erlangb'](_0x11ce2b,_0x87cf7f));}return _0x119e04({'erlangCalls':_0x7e92f8,'erlangCallToSecond':_0x5adda0/_0x7e92f8,'erlangAbandonmentRate':_0x467d1b,'erlangBusyFactor':_0xa78132});});};module['exports']=Dialer; \ No newline at end of file +var _0xead0=['stateinterface','merge','pick','strategy','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','outboundAnswerCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','[syncAgentComplete]','outboundUnknownCallsDay','running','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','setXMDContactVariables','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','dropRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','unlockContact','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','booked','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','moment','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','queuecallerabandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','emit','type','debug','format','name','info','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\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','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','inspect','checkContactLowerLimitOriginate','temp','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','timezones','then','content','catch','Action','indexOf','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','isNil','locked','paused'];(function(_0x59348a,_0x5d7e16){var _0x5dc4c8=function(_0x54a67c){while(--_0x54a67c){_0x59348a['push'](_0x59348a['shift']());}};_0x5dc4c8(++_0x5d7e16);}(_0xead0,0x123));var _0x0ead=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xead0[_0x548627];return _0x844a84;};'use strict';var util=require(_0x0ead('0x0'));var _=require(_0x0ead('0x1'));var uuid=require('uuid');var moment=require(_0x0ead('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x0ead('0x3'));var hopperUtils=require(_0x0ead('0x4'));var ut=require('../preview/util/util');var config=require(_0x0ead('0x5'));var logger=require(_0x0ead('0x6'))(_0x0ead('0x7'));var loggerBooked=require(_0x0ead('0x6'))('booked');var loggerPredictive=require(_0x0ead('0x6'))(_0x0ead('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0ead('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x0ead('0xa'));var ami=require(_0x0ead('0xb'));config[_0x0ead('0xc')]=_['defaults'](config['redis'],{'host':_0x0ead('0xd'),'port':0x18eb});var io=require(_0x0ead('0xe'))(new Redis(config[_0x0ead('0xc')]));var cmHopper=require(_0x0ead('0xf'));var voiceQueueRt=require(_0x0ead('0x10'));var RpcSetting=require(_0x0ead('0x11'));var Interval=require(_0x0ead('0x12'));var Action=require(_0x0ead('0x13'));var History=require(_0x0ead('0x14'));var Final=require(_0x0ead('0x15'));var AgentComplete=require(_0x0ead('0x16'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x0ead('0x17'));var ipAgi=process['env'][_0x0ead('0x18')]||_0x0ead('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0ead('0x1a')]['enqueue']=function(_0x215e28){this['tail']=this[_0x0ead('0x1b')]?this['tail'][_0x0ead('0x1c')](_0x215e28):_0x215e28();};function Dialer(_0x30dd83,_0x1a65a6){this[_0x0ead('0x1d')]=new Sequence();this['preview']=_0x1a65a6;this[_0x0ead('0x1e')]=_0x30dd83['voiceQueues'];this[_0x0ead('0x1f')]=_0x30dd83[_0x0ead('0x1f')];this[_0x0ead('0x20')]=_0x30dd83[_0x0ead('0x20')];this['trunks']=_0x30dd83[_0x0ead('0x21')];this[_0x0ead('0x22')]=config[_0x0ead('0x22')]||0x2;this[_0x0ead('0x23')]={};this[_0x0ead('0x24')]={};this['contactsId']={};this[_0x0ead('0x25')]={};this[_0x0ead('0x26')]={};this[_0x0ead('0x27')]={};this[_0x0ead('0x28')]={};this[_0x0ead('0x29')]={};this[_0x0ead('0x2a')]={};this['queueBookedRR']={};this[_0x0ead('0x2b')]={};ami['on'](_0x0ead('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0x0ead('0x2d'),this['syncQueueCallerAbandon'][_0x0ead('0x2e')](this));ami['on'](_0x0ead('0x2f'),this['syncOriginateResponse'][_0x0ead('0x2e')](this));ami['on'](_0x0ead('0x30'),this[_0x0ead('0x31')]['bind'](this));ami['on'](_0x0ead('0x32'),this[_0x0ead('0xa')]['bind'](this));ami['on'](_0x0ead('0x33'),this[_0x0ead('0x34')][_0x0ead('0x2e')](this));ami['on'](_0x0ead('0x35'),this[_0x0ead('0x36')][_0x0ead('0x2e')](this));ami['on'](_0x0ead('0x37'),this[_0x0ead('0x38')]['bind'](this));ami['on'](_0x0ead('0x39'),this[_0x0ead('0x3a')][_0x0ead('0x2e')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x0ead('0x3b'),this[_0x0ead('0x3c')][_0x0ead('0x2e')](this));this[_0x0ead('0x3d')]();this[_0x0ead('0x3e')]();RpcSetting[_0x0ead('0x3f')]()['then'](function(_0x3a383d){previewRecallmeReminderInterval=_0x3a383d[_0x0ead('0x40')];});}function isNotNull(_0x2867ff){return _0x2867ff!==null&&!_['isUndefined'](_0x2867ff);}function msgResponse(_0x34bc11,_0x1a3277,_0x470fe9){return{'action':_0x34bc11,'response':_0x1a3277,'message':_0x470fe9,'stack':_0x470fe9};}function emit(_0x49916f,_0x1686a3,_0x507ea2){io['to'](_0x49916f)[_0x0ead('0x41')](_0x1686a3,_0x507ea2);}function emitOutboundVoiceQueueSummary(_0x41bdf6){if(_0x41bdf6[_0x0ead('0x42')]==='outbound'){logger[_0x0ead('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0x41bdf6,{'showHidden':![],'depth':null}));emit(util[_0x0ead('0x44')]('voice:queue:%s',_0x41bdf6[_0x0ead('0x45')]),'voice_queue:save',_0x41bdf6);}}function checkGetDataPredictive(_0x372b40){if(isNotNull(_0x372b40)&&!_['isEmpty'](_0x372b40)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0ead('0x46')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x372b40[_0x0ead('0x47')]);loggerPredictive[_0x0ead('0x46')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x372b40[_0x0ead('0x48')]);loggerPredictive[_0x0ead('0x46')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x372b40[_0x0ead('0x49')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x4a'),_0x372b40[_0x0ead('0x4b')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x4c'),_0x372b40[_0x0ead('0x4d')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x4e'),_0x372b40[_0x0ead('0x4f')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x50'));if(_0x372b40['predictiveIntervalTotalCalls']>0x0){if(!_[_0x0ead('0x51')](_0x372b40['predictiveIntervalAvgTalktime'])&&_0x372b40[_0x0ead('0x4f')]>0x0){return!![];}loggerPredictive[_0x0ead('0x46')](_0x0ead('0x52'));if(!_[_0x0ead('0x51')](_0x372b40[_0x0ead('0x4d')])&&_0x372b40['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0ead('0x46')](_0x0ead('0x53'));}else{loggerPredictive[_0x0ead('0x46')](_0x0ead('0x54'));}}else{loggerPredictive[_0x0ead('0x46')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2d5d8d){return function(_0x14aa97){loggerPredictive[_0x0ead('0x46')](_0x0ead('0x55'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14aa97[_0x0ead('0x56')]);loggerPredictive[_0x0ead('0x46')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14aa97[_0x0ead('0x57')]);loggerPredictive[_0x0ead('0x46')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14aa97[_0x0ead('0x58')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x59'),_0x14aa97[_0x0ead('0x5a')]);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x5b'),_0x14aa97['erlangAbandonmentRate']);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x50'));_['merge'](_0x2d5d8d,_0x14aa97);};}function ifInterval(_0x2174e4,_0x2cbd17){if(_['isUndefined'](_0x2cbd17)){return![];}return utils[_0x0ead('0x5c')](undefined,_0x2cbd17)<_0x2174e4*0x3c;}function clearPredictiveAttributes(_0x3626c5){if(_0x3626c5[_0x0ead('0x28')]){_0x3626c5['startProgressive']=undefined;loggerPredictive[_0x0ead('0x43')](_0x3626c5['name'],_0x0ead('0x5d'));}if(_0x3626c5[_0x0ead('0x27')]){_0x3626c5[_0x0ead('0x27')]=undefined;loggerPredictive['debug'](_0x3626c5[_0x0ead('0x45')],_0x0ead('0x5e'));}if(_0x3626c5['handlePredictive']){clearInterval(_0x3626c5[_0x0ead('0x5f')]);_0x3626c5[_0x0ead('0x5f')]=undefined;loggerPredictive[_0x0ead('0x43')](_0x3626c5[_0x0ead('0x45')],_0x0ead('0x60'));}}function loggerCatchPredictive(_0x4ce4f2,_0x4a8975){return function(_0x172d55){loggerPredictive[_0x0ead('0x61')](_0x4a8975['name'],_0x4ce4f2);loggerPredictive[_0x0ead('0x61')](_0x172d55['stack']);clearPredictiveAttributes(_0x4a8975);};}function loggerCatch(_0x5062ef){return function(_0x46c9a9){logger['error'](_0x5062ef,util[_0x0ead('0x62')](_0x46c9a9,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1e985d,_0x2ce692,_0x58477b){return function(_0x2a5bff){utils[_0x0ead('0x63')](_0x2ce692,_0x58477b,0x0);_0x2ce692[_0x0ead('0x64')]=0x0;logger[_0x0ead('0x61')](_0x1e985d,util['inspect'](_0x2a5bff,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xcc039){return function(_0x2d09eb){if(isNotNull(_0x2d09eb)&&isNotNull(_0x2d09eb[0x0])){if(_0x2d09eb[0x0]['contactsRescheduled']>0x0){_0xcc039['message']=utils[_0x0ead('0x65')][_0x0ead('0x66')];logger[_0x0ead('0x46')](_0x0ead('0x67')+_0xcc039['name'],_0x2d09eb[0x0][_0x0ead('0x68')],_0x0ead('0x69'));}else{_0xcc039['message']=utils[_0x0ead('0x65')][_0x0ead('0x6a')];logger[_0x0ead('0x46')](_0x0ead('0x6b')+_0xcc039[_0x0ead('0x45')]);}}};}function createObjHistory(_0x583936,_0x31df8a,_0x48c060,_0x256859,_0xe68558){_0x583936[_0x0ead('0x6c')]=_0x48c060;var _0x56f024=new Action(_0x583936,_0x31df8a);var _0x1d157e=new History(_0x56f024);_0x1d157e[_0x0ead('0x6d')]=_0x256859;_0x1d157e[_0x0ead('0x6e')]=_0xe68558;_0x1d157e[_0x0ead('0x6f')]=_0x56f024['starttime'];return _0x1d157e;}function unlockQueueStatus(_0x161466,_0x231a9e){setTimeout(function(){if(_[_0x0ead('0x51')](_0x161466[_0x0ead('0x70')])){loggerBooked[_0x0ead('0x61')](_0x0ead('0x71'),_0x231a9e);}_0x161466[_0x0ead('0x70')]=!![];loggerBooked[_0x0ead('0x46')]('[booked][unlockQueueStatus]',_0x231a9e,JSON[_0x0ead('0x72')](_['pick'](_0x161466,['name',_0x0ead('0x70')])));},0x1f3);}function checkInterval(_0x112679){return function(){if(!isNotNull(_0x112679['Interval'])){_0x112679['message']=utils[_0x0ead('0x65')][_0x0ead('0x73')];throw _0x112679['name']+_0x0ead('0x74');}if(!isNotNull(_0x112679[_0x0ead('0x75')][_0x0ead('0x76')])){_0x112679['message']=utils[_0x0ead('0x65')][_0x0ead('0x73')];throw _0x112679[_0x0ead('0x45')]+_0x0ead('0x74');}if(!isNotNull(_[_0x0ead('0x77')](_0x112679[_0x0ead('0x75')][_0x0ead('0x76')]))){_0x112679[_0x0ead('0x6c')]=utils[_0x0ead('0x65')][_0x0ead('0x73')];throw _0x112679['name']+_0x0ead('0x74');}};}function checkIsIVRCampaignActive(_0x1958bf){return function(){if(!utils['isIVRCampaignActive'](_0x1958bf)){_0x1958bf[_0x0ead('0x6c')]=utils[_0x0ead('0x65')]['INACTIVE'];throw _0x1958bf[_0x0ead('0x45')]+_0x0ead('0x78');}};}function emitCampaignSummary(_0x543e93){if(utils[_0x0ead('0x79')](_0x543e93)){emit(util[_0x0ead('0x44')](_0x0ead('0x7a'),_0x543e93['name']),_0x0ead('0x7b'),_0x543e93);}}function loggerCatchQueueSummary(_0x4a9354,_0x58f519){return function(_0x975a52){clearPredictiveAttributes(_0x58f519);emitCampaignSummary(_0x58f519);loggerSyncQueueSummary[_0x0ead('0x43')](_0x4a9354,util[_0x0ead('0x62')](_0x975a52,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x456fc8){if(_0x456fc8[_0x0ead('0x7c')]){if(_0x456fc8['originated']===0x0){_0x456fc8[_0x0ead('0x7c')]=![];_0x456fc8[_0x0ead('0x6c')]=utils[_0x0ead('0x65')][_0x0ead('0x7d')];loggerSyncQueueSummary[_0x0ead('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x456fc8[_0x0ead('0x45')],_0x0ead('0x7e'));}else{_0x456fc8[_0x0ead('0x6c')]=utils[_0x0ead('0x65')][_0x0ead('0x7f')];loggerSyncQueueSummary[_0x0ead('0x43')](_0x0ead('0x80'),_0x456fc8[_0x0ead('0x45')],_0x0ead('0x81'));}emitCampaignSummary(_0x456fc8);}}function myreject(_0x242950){return function(_0x4cc3da){return _0x242950(msgResponse('[ifTime][Action]',_0x0ead('0x82'),JSON[_0x0ead('0x72')](_0x4cc3da)));};}Dialer[_0x0ead('0x1a')][_0x0ead('0x83')]=function(_0x1b9d53){return!_['isUndefined'](_0x1b9d53)&&_0x1b9d53&&!_[_0x0ead('0x51')](_0x1b9d53[_0x0ead('0x45')])&&!_[_0x0ead('0x51')](_0x1b9d53[_0x0ead('0x84')])&&_0x1b9d53[_0x0ead('0x84')]&&(this[_0x0ead('0x21')][util[_0x0ead('0x44')](_0x0ead('0x85'),_0x1b9d53[_0x0ead('0x45')])][_0x0ead('0x86')]===_0x0ead('0x87')||this[_0x0ead('0x21')][util[_0x0ead('0x44')]('SIP/%s',_0x1b9d53[_0x0ead('0x45')])]['status']==='unmonitored');};Dialer[_0x0ead('0x1a')][_0x0ead('0x88')]=function(_0x1a9c57){var _0x10795f=this;return function(){if(!_0x10795f[_0x0ead('0x83')](_0x1a9c57['Trunk'])){if(!_0x10795f['isTrunkReachable'](_0x1a9c57[_0x0ead('0x89')])){_0x1a9c57[_0x0ead('0x6c')]=utils[_0x0ead('0x65')]['TRUNK_NOT_REACHABLE'];throw _0x1a9c57[_0x0ead('0x45')]+_0x0ead('0x8a');}}};};Dialer[_0x0ead('0x1a')]['checkIfTime']=function(_0x2640fa,_0x135887,_0x57b08d,_0x51148f){var _0x576d05=this;return function(){var _0xcf7607=!![];return _0x576d05[_0x0ead('0x8b')](_0x2640fa,_0x135887,_0x57b08d,_0x51148f,_0xcf7607);};};Dialer[_0x0ead('0x1a')][_0x0ead('0x8c')]=function(_0x9f9c01,_0x4fb0da,_0x18c539,_0x5a4396){var _0x2c73a3=this;return function(){var _0x4abb90=![];return _0x2c73a3[_0x0ead('0x8b')](_0x9f9c01[_0x0ead('0x76')],_0x4fb0da,_0x18c539,_0x5a4396,_0x4abb90);};};Dialer[_0x0ead('0x1a')][_0x0ead('0x8b')]=function(_0x17cb5e,_0x437314,_0x5e8fa7,_0x2d8de5,_0x17e8a4){var _0x27f1c9=[];return new Promise(function(_0x58925b,_0x522b1d){if(!isNotNull(_0x17cb5e)){_0x2d8de5[_0x0ead('0x6c')]=utils[_0x0ead('0x65')]['NULL_INTERVAL'];return _0x522b1d(msgResponse(_0x0ead('0x8d'),_0x0ead('0x8e'),_0x5e8fa7+_0x0ead('0x8f')));}if(_[_0x0ead('0x77')](_0x17cb5e)){_0x2d8de5[_0x0ead('0x6c')]=utils[_0x0ead('0x65')][_0x0ead('0x90')];return _0x522b1d(msgResponse('ifTime',_0x0ead('0x8e'),_0x5e8fa7+_0x0ead('0x91')));}if(_0x437314&&_[_0x0ead('0x51')](config['timezones'][_0x437314])){_0x2d8de5[_0x0ead('0x6c')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x522b1d(msgResponse(_0x0ead('0x8d'),_0x0ead('0x8e'),_0x5e8fa7+_0x0ead('0x92')+_0x437314));}if(_[_0x0ead('0x93')](_0x17cb5e)){for(var _0x3a41ec=0x0;_0x3a41ec<_0x17cb5e[_0x0ead('0x94')];_0x3a41ec+=0x1){_0x27f1c9[_0x0ead('0x95')](ami['Action']({'action':_0x0ead('0x96'),'command':util[_0x0ead('0x44')](_0x0ead('0x97'),_0x17cb5e[_0x3a41ec][_0x0ead('0x98')],!_[_0x0ead('0x51')](config[_0x0ead('0x99')][_0x437314])?_0x437314:'')})[_0x0ead('0x9a')](function(_0x192511){return _0x192511[_0x0ead('0x9b')]['indexOf']('true')>=0x0;})[_0x0ead('0x9c')](myreject(_0x522b1d)));}}else{_0x27f1c9[_0x0ead('0x95')](ami[_0x0ead('0x9d')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x17cb5e,!_[_0x0ead('0x51')](config['timezones'][_0x437314])?_0x437314:'')})[_0x0ead('0x9a')](function(_0x2807e6){return _0x2807e6[_0x0ead('0x9b')][_0x0ead('0x9e')]('true')>=0x0;})[_0x0ead('0x9c')](myreject(_0x522b1d)));}Promise[_0x0ead('0x9f')](_0x27f1c9)[_0x0ead('0x9a')](function(_0x5cdb90){var _0x52a96f=_['some'](_0x5cdb90);if(_0x52a96f){return _0x58925b(_0x52a96f);}else{_0x2d8de5[_0x0ead('0x6c')]=_0x17e8a4?utils[_0x0ead('0x65')][_0x0ead('0xa0')]:utils[_0x0ead('0x65')][_0x0ead('0xa1')];return _0x522b1d(msgResponse(_0x0ead('0xa2'),_0x0ead('0x8e'),_0x0ead('0xa3')+_0x17e8a4+'\x20'+_0x5e8fa7+_0x0ead('0xa4')+util[_0x0ead('0x62')](_0x17cb5e,{'showHidden':![],'depth':null})+_0x0ead('0xa5')+_0x437314));}})[_0x0ead('0x9c')](function(_0x8f2b4b){return _0x522b1d(msgResponse(_0x0ead('0x8d'),_0x0ead('0x8e'),JSON['stringify'](_0x8f2b4b)));});});};Dialer[_0x0ead('0x1a')][_0x0ead('0x3d')]=function(){var _0x4bc5e3=this;return cmHopper[_0x0ead('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x0ead('0x9a')](function(){setInterval(function(){_0x4bc5e3['syncCampaigns']();},0x3e8);});};Dialer[_0x0ead('0x1a')][_0x0ead('0xa7')]=function(){var _0x20420c=this;var _0x4807a1;for(var _0x49a897 in this['campaigns']){if(typeof this[_0x0ead('0x1f')][_0x49a897]!==_0x0ead('0xa8')){_0x4807a1=this['campaigns'][_0x49a897];if(utils[_0x0ead('0x79')](_0x4807a1)&&utils[_0x0ead('0xa9')](_0x4807a1)){_0x4807a1[_0x0ead('0x7c')]=!![];Promise[_0x0ead('0xaa')]()[_0x0ead('0x9a')](checkIsIVRCampaignActive(_0x4807a1))['then'](checkInterval(_0x4807a1))[_0x0ead('0x9a')](_0x20420c[_0x0ead('0x88')](_0x4807a1))['then'](_0x20420c[_0x0ead('0xab')](_0x4807a1[_0x0ead('0xac')],_0x4807a1[_0x0ead('0xad')],_0x4807a1[_0x0ead('0x45')],_0x4807a1))[_0x0ead('0x9a')](_0x20420c[_0x0ead('0x8c')](_0x4807a1[_0x0ead('0x75')],_0x4807a1['dialTimezone'],_0x4807a1[_0x0ead('0x45')],_0x4807a1))[_0x0ead('0x9a')](_0x20420c[_0x0ead('0xae')](_0x4807a1))[_0x0ead('0x9c')](loggerCatchQueueSummary(_0x0ead('0xaf'),_0x4807a1));}else{notSendMessagesCampaign(_0x4807a1);}}}};Dialer['prototype'][_0x0ead('0xb0')]=function(_0x132642){if(_0x132642['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x132642);}switch(_0x132642[_0x0ead('0xb1')]){case'progressive':this[_0x0ead('0xb2')](_0x132642,0x1);break;case _0x0ead('0xb3'):this[_0x0ead('0xb2')](_0x132642,_0x132642[_0x0ead('0xb4')]);break;case _0x0ead('0x8'):this[_0x0ead('0x8')](_0x132642);break;case'booked':this[_0x0ead('0xb2')](_0x132642,0x1);break;default:logger[_0x0ead('0x61')]('Queue',_0x132642[_0x0ead('0x45')],_0x0ead('0xb5'));}};Dialer[_0x0ead('0x1a')][_0x0ead('0x8d')]=function(_0x457620,_0x17acd1){var _0x21ec4d=_0x457620[_0x0ead('0xad')];var _0x26a9da=_0x17acd1?_0x457620[_0x0ead('0xac')]:_0x457620[_0x0ead('0x75')][_0x0ead('0x76')];logger[_0x0ead('0xb6')](_0x0ead('0xb7'),_0x26a9da,_0x21ec4d,_0x457620[_0x0ead('0x45')],util[_0x0ead('0x44')](_0x0ead('0xb8'),_0x457620[_0x0ead('0x45')],_0x457620['id']));var _0x24a00a=null;return Interval['intervalIftime'](_0x26a9da,_0x21ec4d)[_0x0ead('0x9a')](function(_0xdcbb45){if(_0xdcbb45===!![]){return _0xdcbb45;}else{_0x457620[_0x0ead('0x6c')]=_0x17acd1?utils[_0x0ead('0x65')][_0x0ead('0xa0')]:utils[_0x0ead('0x65')][_0x0ead('0xa1')];_0x24a00a=msgResponse(_0x0ead('0xa2'),_0x0ead('0x8e'),_0x0ead('0xa3')+_0x17acd1+'\x20'+_0x457620[_0x0ead('0x45')]+_0x0ead('0xa4')+util[_0x0ead('0x62')](_0x26a9da,{'showHidden':![],'depth':null})+_0x0ead('0xa5')+_0x21ec4d);}if(_0x24a00a!==null){logger[_0x0ead('0xb6')](_0x0ead('0xb9'),_0x24a00a);_0x24a00a[_0x0ead('0xba')]=_0x17acd1;throw _0x24a00a;}})[_0x0ead('0x9c')](function(_0x5bd03e){logger[_0x0ead('0x61')](_0x0ead('0xbb'),_0x5bd03e);throw msgResponse('[ifTime][Action]',_0x0ead('0x82'),util[_0x0ead('0x62')](_0x5bd03e,{'showHidden':![],'depth':null}));});};Dialer[_0x0ead('0x1a')][_0x0ead('0xbc')]=function(_0x291621){if(this[_0x0ead('0x1e')][_0x291621['queue']]){if(this[_0x0ead('0x25')][_0x291621[_0x0ead('0xbd')]]&&this['uniqueId'][_0x291621[_0x0ead('0xbd')]]['type']!==_0x0ead('0xbe')){this[_0x0ead('0xbf')](this[_0x0ead('0x1e')][_0x291621[_0x0ead('0xc0')]]);this[_0x0ead('0x25')][_0x291621[_0x0ead('0xbd')]][_0x0ead('0xc1')]=moment()['format'](_0x0ead('0xc2'));}}};Dialer[_0x0ead('0x1a')][_0x0ead('0x31')]=function(_0x44b12c){var _0xeef778=this['uniqueId'][_0x44b12c['uniqueid']];if(this[_0x0ead('0x1e')][_0x44b12c[_0x0ead('0xc0')]]){if(_0xeef778&&_0xeef778[_0x0ead('0x42')]!==_0x0ead('0xbe')){delete this[_0x0ead('0x25')][_0x44b12c['uniqueid']];this[_0x0ead('0x1e')][_0x44b12c[_0x0ead('0xc0')]]['outboundAnswerCallsDay']+=0x1;var _0x3d4204=new AgentComplete(_0xeef778,_0x44b12c);if(_0x44b12c[_0x0ead('0xc3')]===_0x0ead('0xc4')){_0x3d4204[_0x0ead('0xc5')]=this[_0x0ead('0x1e')][_0x44b12c[_0x0ead('0xc0')]][_0x0ead('0xc6')]&&this[_0x0ead('0x1e')][_0x44b12c[_0x0ead('0xc0')]][_0x0ead('0xc7')]?moment()[_0x0ead('0x44')](_0x0ead('0xc2')):undefined;}hopperUtils[_0x0ead('0xc8')](_0x3d4204)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0ead('0xc9')](_0x3d4204)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0ead('0x1a')]['syncQueueCallerAbandon']=function(_0x1b7c05){var _0x9a41b7=this['uniqueId'][_0x1b7c05[_0x0ead('0xbd')]];var _0x512ae9=this;var _0x45a12c=![];var _0x1c48e2;var _0x58d42b;if(this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]]){if(_0x9a41b7&&_0x9a41b7['type']!==_0x0ead('0xbe')){delete this[_0x0ead('0x25')][_0x1b7c05[_0x0ead('0xbd')]];this[_0x0ead('0xbf')](this[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]]);_0x9a41b7['droptime']=moment()[_0x0ead('0x44')](_0x0ead('0xc2'));var _0x4ab85d=new QueueCallerAbandon(_0x9a41b7,_0x1b7c05);if(utils['getSeconds'](_0x9a41b7[_0x0ead('0xca')],_0x9a41b7[_0x0ead('0xcb')])>=_0x9a41b7[_0x0ead('0xcc')]){this[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0x49')]+=0x1;this[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xcd')]+=0x1;this[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4ab85d['state']=0xa;_0x4ab85d[_0x0ead('0x6e')]=_0x0ead('0xce');_0x4ab85d[_0x0ead('0xcf')]=_0x0ead('0xd0');_0x4ab85d[_0x0ead('0xc5')]=this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xc6')]?moment()[_0x0ead('0x44')](_0x0ead('0xc2')):undefined;_0x4ab85d[_0x0ead('0xd1')]+=0x1;_0x4ab85d['countglobal']+=0x1;_0x1c48e2=this[_0x0ead('0x1e')][_0x1b7c05['queue']][_0x0ead('0xd2')];_0x58d42b=this[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xd3')];hopperUtils[_0x0ead('0xd4')](_0x4ab85d,_0x4ab85d[_0x0ead('0x6d')],_0x9a41b7[_0x0ead('0xd5')])[_0x0ead('0x9a')](function(_0x4a0b6b){_0x45a12c=_0x4a0b6b[_0x0ead('0xd6')]==0x1;if(_0x4ab85d['countdropretry']>=_0x512ae9[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xd7')]){_0x512ae9['queueCallerAbandonCreateState'](_0x4ab85d,_0x4a0b6b[_0x0ead('0xd6')]);}else{hopperUtils[_0x0ead('0xd8')]({'active':![],'countdropretry':_0x4ab85d[_0x0ead('0xd1')],'scheduledat':moment()[_0x0ead('0xd9')](_0x512ae9[_0x0ead('0x1e')][_0x1b7c05['queue']][_0x0ead('0xd2')],_0x0ead('0xda'))['format'](_0x0ead('0xc2')),'ContactId':_0x9a41b7[_0x0ead('0xdb')],'ListId':_0x9a41b7[_0x0ead('0xdc')],'VoiceQueueId':_0x9a41b7['VoiceQueueId']||undefined,'CampaignId':_0x9a41b7[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0xde')));var _0x541059=new History(_0x4ab85d);_0x541059[_0x0ead('0x6d')]=0xa;_0x541059['statedesc']='Drop';_0x541059[_0x0ead('0xdf')]=moment()[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x541059['endtime']=_0x541059[_0x0ead('0xdf')];_0x541059[_0x0ead('0xe0')]=_0x4ab85d[_0x0ead('0xe0')];_0x541059[_0x0ead('0xe1')]=_0x4ab85d[_0x0ead('0xe1')];hopperUtils['createHistory'](_0x541059)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0xe2')));}})[_0x0ead('0x9a')](function(){if(_0x45a12c)hopperUtils[_0x0ead('0xe3')](_0x4ab85d,_0x1c48e2,_0x58d42b)[_0x0ead('0x9a')](function(){return 0x1;});});}else{this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0x4b')]+=0x1;this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xe4')]+=0x1;_0x4ab85d[_0x0ead('0x6d')]=0xb;_0x4ab85d[_0x0ead('0x6e')]=_0x0ead('0xe5');_0x4ab85d[_0x0ead('0xcf')]='CALLEREXIT';_0x4ab85d[_0x0ead('0xe6')]+=0x1;_0x4ab85d[_0x0ead('0xe7')]+=0x1;_0x1c48e2=this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xe8')];_0x58d42b=this['voiceQueues'][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xd3')];hopperUtils[_0x0ead('0xd4')](_0x4ab85d,_0x4ab85d['state'],_0x9a41b7[_0x0ead('0xd5')])[_0x0ead('0x9a')](function(_0x429421){if(_0x4ab85d[_0x0ead('0xe6')]>=_0x512ae9[_0x0ead('0x1e')][_0x1b7c05['queue']][_0x0ead('0xe9')]){_0x512ae9[_0x0ead('0xea')](_0x4ab85d,_0x429421[_0x0ead('0xd6')]);}else{hopperUtils[_0x0ead('0xd8')]({'active':![],'countabandonedretry':_0x4ab85d[_0x0ead('0xe6')],'scheduledat':moment()[_0x0ead('0xd9')](_0x512ae9[_0x0ead('0x1e')][_0x1b7c05[_0x0ead('0xc0')]][_0x0ead('0xe8')],_0x0ead('0xda'))[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9a41b7[_0x0ead('0xdb')],'ListId':_0x9a41b7[_0x0ead('0xdc')],'VoiceQueueId':_0x9a41b7['VoiceQueueId']||undefined,'CampaignId':_0x9a41b7['CampaignId']||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0xeb')));var _0x126844=new History(_0x4ab85d);_0x126844[_0x0ead('0x6d')]=0xb;_0x126844[_0x0ead('0x6e')]=_0x0ead('0xe5');_0x126844[_0x0ead('0xdf')]=moment()[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x126844['endtime']=_0x126844['starttime'];_0x126844['calleridname']=_0x4ab85d[_0x0ead('0xe0')];_0x126844[_0x0ead('0xe1')]=_0x4ab85d[_0x0ead('0xe1')];hopperUtils['createHistory'](_0x126844)['catch'](loggerCatch(_0x0ead('0xec')));}})['then'](function(){if(_0x45a12c)hopperUtils[_0x0ead('0xe3')](_0x4ab85d,_0x1c48e2,_0x58d42b)[_0x0ead('0x9a')](function(){return 0x1;});});}}}};Dialer[_0x0ead('0x1a')][_0x0ead('0x38')]=function(_0x568617){if(this[_0x0ead('0x24')][_0x568617[_0x0ead('0xbd')]]){this[_0x0ead('0x24')][_0x568617[_0x0ead('0xbd')]][_0x0ead('0xed')]=_0x568617[_0x0ead('0xed')];}if(this[_0x0ead('0x25')][_0x568617[_0x0ead('0xbd')]]){this['uniqueId'][_0x568617[_0x0ead('0xbd')]][_0x0ead('0xed')]=_0x568617[_0x0ead('0xed')];}};Dialer['prototype']['syncQueueMember']=function(_0x5bee06){if(!this['actions'][_0x5bee06['actionid']]){return;}var _0x42876c=this['voiceQueues'][this[_0x0ead('0x24')][_0x5bee06[_0x0ead('0xee')]][_0x0ead('0xc0')]]['strategy']||_0x0ead('0xef');if(_0x42876c===_0x0ead('0xf0')){if(this[_0x0ead('0x24')][_0x5bee06['actionid']]&&_[_0x0ead('0xf1')](this['actions'][_0x5bee06[_0x0ead('0xee')]][_0x0ead('0xf2')])&&_0x5bee06[_0x0ead('0x86')]==='1'&&_0x5bee06[_0x0ead('0xf3')]==='0'){if(this[_0x0ead('0x20')][_0x5bee06[_0x0ead('0xf4')]]){if(!this[_0x0ead('0x20')][_0x5bee06[_0x0ead('0xf4')]]['locked']){this[_0x0ead('0x20')][_0x5bee06['stateinterface']][_0x0ead('0xf2')]=!![];this['actions'][_0x5bee06[_0x0ead('0xee')]][_0x0ead('0xf2')]=!![];this['actions'][_0x5bee06['actionid']][_0x0ead('0xf4')]=_0x5bee06[_0x0ead('0xf4')];}}}}else if(_0x42876c===_0x0ead('0xef')){if(this[_0x0ead('0x24')][_0x5bee06[_0x0ead('0xee')]]){if(this[_0x0ead('0x20')][_0x5bee06['stateinterface']]){this[_0x0ead('0x24')][_0x5bee06['actionid']]['stateinterface']=_0x5bee06[_0x0ead('0xf4')];if(_['isNil'](this[_0x0ead('0x2a')][this['actions'][_0x5bee06[_0x0ead('0xee')]][_0x0ead('0xc0')]])){this[_0x0ead('0x2a')][this[_0x0ead('0x24')][_0x5bee06[_0x0ead('0xee')]]['queue']]=[];}this[_0x0ead('0x2a')][this[_0x0ead('0x24')][_0x5bee06[_0x0ead('0xee')]][_0x0ead('0xc0')]][_0x0ead('0x95')](_[_0x0ead('0xf5')](_[_0x0ead('0xf6')](this[_0x0ead('0x24')][_0x5bee06[_0x0ead('0xee')]],['idHopper',_0x0ead('0xf4')]),{'status':_0x5bee06['status'],'paused':_0x5bee06[_0x0ead('0xf3')]}));}}}};Dialer[_0x0ead('0x1a')][_0x0ead('0x3c')]=function(_0x2aa8e1){if(!this['actions'][_0x2aa8e1[_0x0ead('0xee')]]){return;}var _0x2ea5a1=this;var _0x145695=this[_0x0ead('0x1e')][this['actions'][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]];var _0x109781=_0x145695[_0x0ead('0xf7')]||_0x0ead('0xef');if(_0x109781===_0x0ead('0xf0')){if(this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]]&&this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xf4')]){this['preview'][_0x0ead('0xf8')](this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xf9')],this[_0x0ead('0x24')][_0x2aa8e1['actionid']][_0x0ead('0xf4')])['catch'](function(_0x21d40c){logger[_0x0ead('0x61')](_0x0ead('0xfa'),util[_0x0ead('0x62')](_0x21d40c,{'showHidden':![],'depth':null}));})[_0x0ead('0x1c')](function(){_0x2ea5a1[_0x0ead('0xbf')](_0x2ea5a1['voiceQueues'][_0x2ea5a1[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]]);_0x2ea5a1[_0x0ead('0x20')][_0x2ea5a1[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xf4')]][_0x0ead('0xf2')]=![];delete _0x2ea5a1['actions'][_0x2aa8e1[_0x0ead('0xee')]];unlockQueueStatus(_0x145695);});}else{this[_0x0ead('0xbf')](this['voiceQueues'][this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]]['queue']]);hopperUtils[_0x0ead('0xd8')]({'active':![],'ContactId':this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xdb')],'ListId':this['actions'][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xdc')],'VoiceQueueId':this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xfb')]||undefined,'CampaignId':this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xdd')]||undefined})['catch'](loggerCatch(_0x0ead('0xfc')));delete this['actions'][_0x2aa8e1[_0x0ead('0xee')]];unlockQueueStatus(_0x145695);}}else if(_0x109781===_0x0ead('0xef')){var _0x4d051c;if(this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]]&&!_['isEmpty'](this[_0x0ead('0x2a')][this[_0x0ead('0x24')][_0x2aa8e1['actionid']][_0x0ead('0xc0')]])){if(this['queueBookedRR'][_0x2ea5a1[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]]){this[_0x0ead('0xfd')][_0x2ea5a1['actions'][_0x2aa8e1['actionid']][_0x0ead('0xc0')]]=this[_0x0ead('0xfd')][this['actions'][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]]?this[_0x0ead('0xfd')][this[_0x0ead('0x24')][_0x2aa8e1['actionid']][_0x0ead('0xc0')]]:this[_0x0ead('0x2a')][this['actions'][_0x2aa8e1['actionid']][_0x0ead('0xc0')]]?this[_0x0ead('0x2a')][this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]][_0x0ead('0xfe')]||0x0:0x0;}this[_0x0ead('0x2a')][this[_0x0ead('0x24')][_0x2aa8e1[_0x0ead('0xee')]]['queue']]['_rr']=this['queueBookedRR'][this['actions'][_0x2aa8e1[_0x0ead('0xee')]][_0x0ead('0xc0')]];for(var _0xbb0447=0x0;_0xbb0447=_0x160252['dialGlobalMaxRetry']){_0x2e1530['stateGlobal'](_0x54f7ad,_0x48478f,_0x4b7b2f,_0x0ead('0x126'));}else{if(_0x54f7ad[_0x0ead('0x121')]>=_0x160252[_0x0ead('0x127')]){_0x2e1530[_0x0ead('0x128')](_0x54f7ad,_0x48478f,_0x4b7b2f,'reason\x2019\x20machine....');}else{hopperUtils[_0x0ead('0xd8')]({'active':![],'countmachineretry':_0x54f7ad['countmachineretry'],'scheduledat':moment()[_0x0ead('0xd9')](_0x160252[_0x0ead('0x129')],_0x0ead('0xda'))['format'](_0x0ead('0xc2')),'ContactId':_0x54f7ad[_0x0ead('0xdb')],'ListId':_0x54f7ad['ListId'],'VoiceQueueId':_0x54f7ad[_0x0ead('0xfb')]||undefined,'CampaignId':_0x54f7ad[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x12a')));_0x48478f({'reschedule':0x1});}}});}if(_0x5be77[_0x0ead('0x42')]===_0x0ead('0xbe')&&this[_0x0ead('0x1f')][_0x5be77[_0x0ead('0xc0')]][_0x0ead('0x11c')]&&_0x26aac7[_0x0ead('0x11d')]==='HANGUP'){delete this[_0x0ead('0x25')][_0x26aac7[_0x0ead('0xbd')]];this['updateOriginated'](this[_0x0ead('0x1f')][_0x5be77[_0x0ead('0xc0')]]);_0x4be900=new Hangup(_0x5be77,_0x26aac7);_0x4be900['state']=0x12;_0x4be900[_0x0ead('0x6e')]=_0x0ead('0x113');_0x4be900[_0x0ead('0x114')]=_0x0ead('0x115');ami['emit']('custom:amd',ut[_0x0ead('0x117')](_0x4be900,_0x0ead('0x118')));this[_0x0ead('0x119')](_0x4be900,'[syncHangupInAMDIvr][createHistory]',_0x0ead('0x12b'));}if(_0x5be77[_0x0ead('0x42')]===_0x0ead('0xbe')&&this['campaigns'][_0x5be77[_0x0ead('0xc0')]][_0x0ead('0x11c')]&&_0x26aac7[_0x0ead('0x11d')]==='MACHINE'){return new Promise(function(_0x221fea,_0x51a8bc){delete _0x2e1530[_0x0ead('0x25')][_0x26aac7[_0x0ead('0xbd')]];_0x2e1530['updateOriginated'](_0x2e1530[_0x0ead('0x1f')][_0x5be77['queue']]);_0x2e1530[_0x0ead('0x1f')][_0x5be77[_0x0ead('0xc0')]][_0x0ead('0x11f')]+=0x1;_0x2e1530['campaigns'][_0x5be77[_0x0ead('0xc0')]][_0x0ead('0x112')]+=0x1;var _0x547c56=_0x2e1530[_0x0ead('0x1f')][_0x5be77[_0x0ead('0xc0')]];var _0x541eb5=new Hangup(_0x5be77,_0x26aac7);_0x541eb5[_0x0ead('0x6d')]=0x13;_0x541eb5['statedesc']=_0x0ead('0x120');_0x541eb5[_0x0ead('0x114')]='AMD';_0x541eb5['countmachineretry']+=0x1;_0x541eb5[_0x0ead('0xe7')]+=0x1;_0x541eb5[_0x0ead('0x118')]=!![];ami[_0x0ead('0x41')](_0x0ead('0x116'),ut['buildObj'](_0x541eb5,'amd'));hopperUtils[_0x0ead('0xc8')](_0x541eb5)['catch'](loggerCatch(_0x0ead('0x122')));if(_0x541eb5['countbusyretry']+_0x541eb5['countcongestionretry']+_0x541eb5[_0x0ead('0x12c')]+_0x541eb5[_0x0ead('0x124')]+_0x541eb5[_0x0ead('0xd1')]+_0x541eb5['countabandonedretry']+_0x541eb5[_0x0ead('0x121')]+_0x541eb5[_0x0ead('0x125')]>=_0x547c56[_0x0ead('0x12d')]){_0x2e1530[_0x0ead('0x12e')](_0x541eb5,_0x221fea,_0x51a8bc,_0x0ead('0x126'));}else{if(_0x541eb5['countmachineretry']>=_0x547c56['dialMachineMaxRetry']){_0x2e1530[_0x0ead('0x128')](_0x541eb5,_0x221fea,_0x51a8bc,'reason\x2019\x20machine....');}else{hopperUtils[_0x0ead('0xd8')]({'active':![],'countmachineretry':_0x541eb5[_0x0ead('0x121')],'scheduledat':moment()[_0x0ead('0xd9')](_0x547c56['dialMachineRetryFrequency'],'minutes')['format'](_0x0ead('0xc2')),'ContactId':_0x541eb5['ContactId'],'ListId':_0x541eb5[_0x0ead('0xdc')],'VoiceQueueId':_0x541eb5[_0x0ead('0xfb')]||undefined,'CampaignId':_0x541eb5[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x221fea({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0ead('0x36')]=function(_0x418d68){var _0x59b4e1=this[_0x0ead('0x25')][_0x418d68[_0x0ead('0xbd')]];var _0x5a7904;if(_0x59b4e1&&_0x59b4e1[_0x0ead('0x42')]===_0x0ead('0xbe')){delete this[_0x0ead('0x25')][_0x418d68[_0x0ead('0xbd')]];this[_0x0ead('0xbf')](this[_0x0ead('0x1f')][_0x59b4e1[_0x0ead('0xc0')]]);this[_0x0ead('0x1f')][_0x59b4e1[_0x0ead('0xc0')]][_0x0ead('0x12f')]+=0x1;_0x5a7904=new Hangup(_0x59b4e1,_0x418d68);hopperUtils['createHistory'](_0x5a7904)[_0x0ead('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0ead('0xc9')](_0x5a7904)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x130')));}if(_0x59b4e1&&_0x59b4e1[_0x0ead('0x42')]!==_0x0ead('0xbe')&&isNotNull(this[_0x0ead('0x1e')][_0x59b4e1[_0x0ead('0xc0')]][_0x0ead('0x131')])){delete this[_0x0ead('0x25')][_0x418d68[_0x0ead('0xbd')]];this[_0x0ead('0xbf')](this[_0x0ead('0x1e')][_0x59b4e1['queue']]);this[_0x0ead('0x1e')][_0x59b4e1['queue']][_0x0ead('0x11f')]+=0x1;this[_0x0ead('0x1e')][_0x59b4e1['queue']][_0x0ead('0x112')]+=0x1;_0x5a7904=new Hangup(_0x59b4e1,_0x418d68);_0x5a7904['state']=0x10;_0x5a7904['statedesc']=_0x0ead('0x132');_0x5a7904[_0x0ead('0x114')]='AGI';hopperUtils[_0x0ead('0xc8')](_0x5a7904)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x133')));hopperUtils[_0x0ead('0xc9')](_0x5a7904)[_0x0ead('0x9c')](loggerCatch('[syncHangupIvr]'));}if(_0x59b4e1&&_0x59b4e1['type']!==_0x0ead('0xbe')&&!isNotNull(this[_0x0ead('0x1e')][_0x59b4e1['queue']][_0x0ead('0x131')])){if(_0x418d68[_0x0ead('0x134')]===_0x0ead('0x135')){delete this[_0x0ead('0x25')][_0x418d68[_0x0ead('0xbd')]];this[_0x0ead('0x1e')][_0x59b4e1[_0x0ead('0xc0')]][_0x0ead('0x11f')]+=0x1;const _0x2bbf1d=new AgentComplete(_0x59b4e1,_0x418d68);_0x2bbf1d[_0x0ead('0xdd')]=this['voiceQueues'][_0x59b4e1[_0x0ead('0xc0')]]['id'];hopperUtils[_0x0ead('0xc8')](_0x2bbf1d)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0ead('0xc9')](_0x2bbf1d)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x136')));}else{delete this[_0x0ead('0x25')][_0x418d68[_0x0ead('0xbd')]];this[_0x0ead('0xbf')](this[_0x0ead('0x1e')][_0x59b4e1[_0x0ead('0xc0')]]);this[_0x0ead('0x1e')][_0x59b4e1[_0x0ead('0xc0')]][_0x0ead('0x137')]+=0x1;_0x5a7904=new Hangup(_0x59b4e1,_0x418d68);_0x5a7904[_0x0ead('0x6d')]=0xc;_0x5a7904[_0x0ead('0x6e')]=_0x418d68['cause-txt'];_0x5a7904[_0x0ead('0x114')]='Unknow';hopperUtils[_0x0ead('0xc8')](_0x5a7904)[_0x0ead('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x5a7904)['catch'](loggerCatch(_0x0ead('0x130')));}}};Dialer[_0x0ead('0x1a')][_0x0ead('0xa')]=function(_0x34fef3){var _0x460f62=this;if(!_0x460f62[_0x0ead('0x2b')][_0x34fef3[_0x0ead('0x45')]]){_0x460f62[_0x0ead('0x2b')][_0x34fef3['name']]={'running':![]};}else if(_0x460f62[_0x0ead('0x2b')][_0x34fef3[_0x0ead('0x45')]][_0x0ead('0x138')]===!![]){return;}else if(_0x460f62[_0x0ead('0x2b')][_0x34fef3[_0x0ead('0x45')]][_0x0ead('0x138')]===![]){_0x460f62['queuesSummary'][_0x34fef3[_0x0ead('0x45')]][_0x0ead('0x138')]=!![];}var _0x13ddf3=_0x460f62[_0x0ead('0x1e')][_0x34fef3[_0x0ead('0x45')]];var _0x4a4863=_0x13ddf3[_0x0ead('0x6c')]!==utils[_0x0ead('0x65')][_0x0ead('0x7d')];var _0x1d676a=utils['isPreviewCampaign'](_0x13ddf3);_0x13ddf3[_0x0ead('0x139')]=utils[_0x0ead('0x13a')](_0x13ddf3,_0x460f62[_0x0ead('0x21')]);Promise['resolve']()[_0x0ead('0x9a')](function(){if(_0x13ddf3[_0x0ead('0x139')]===utils[_0x0ead('0x65')][_0x0ead('0x7d')]){if(_0x4a4863){clearPredictiveAttributes(_0x13ddf3);_0x34fef3['startPredictive']=undefined;_0x34fef3['startProgressive']=undefined;}if(_0x13ddf3[_0x0ead('0x139')]===utils[_0x0ead('0x65')][_0x0ead('0x7d')]){_0x34fef3[_0x0ead('0x13b')]=0x0;_0x34fef3[_0x0ead('0xf3')]=0x0;_0x34fef3[_0x0ead('0x13c')]=0x0;_0x34fef3[_0x0ead('0x13d')]=0x0;_0x34fef3[_0x0ead('0x13e')]=0x0;}}else if(_0x13ddf3['statusMessage']===utils[_0x0ead('0x65')][_0x0ead('0x13f')]&&!_0x1d676a){return _0x460f62['ifTime'](_0x13ddf3,!![])[_0x0ead('0x9a')](function(){return _0x460f62[_0x0ead('0x8d')](_0x13ddf3,![]);})[_0x0ead('0x9a')](function(){return _0x460f62[_0x0ead('0xb0')](_0x13ddf3);})['catch'](function(_0x45e549){loggerSyncQueueSummary[_0x0ead('0x43')](_0x0ead('0x140'),util[_0x0ead('0x62')](_0x45e549,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x13ddf3);});}else{clearPredictiveAttributes(_0x13ddf3);}})[_0x0ead('0x9a')](function(){var _0x3d5804=_0x34fef3[_0x0ead('0x141')](_0x13ddf3);if(_0x3d5804||_0x13ddf3[_0x0ead('0x142')]){_0x13ddf3['queueSummaryCountersUpdated']=![];_0x34fef3[_0x0ead('0x143')](_0x13ddf3);Object[_0x0ead('0x144')](_0x13ddf3,_0x34fef3);emitOutboundVoiceQueueSummary(_0x34fef3);}_0x460f62[_0x0ead('0x2b')][_0x13ddf3[_0x0ead('0x45')]][_0x0ead('0x138')]=![];})['catch'](function(_0x1795ab){logger[_0x0ead('0x61')](_0x0ead('0x140'),util[_0x0ead('0x62')](_0x1795ab,{'showHidden':![],'depth':null}));_0x460f62[_0x0ead('0x2b')][_0x13ddf3[_0x0ead('0x45')]][_0x0ead('0x138')]=![];});};Dialer[_0x0ead('0x1a')][_0x0ead('0x34')]=_[_0x0ead('0x145')](function(){var _0x5ab81e=_[_0x0ead('0x146')](this[_0x0ead('0x1e')],function(_0x397d22){return _0x397d22[_0x0ead('0x147')];});var _0x323653=_[_0x0ead('0x146')](this[_0x0ead('0x20')],function(_0x38ff81){return _0x38ff81[_0x0ead('0x148')]&&_0x38ff81[_0x0ead('0x86')]===_0x0ead('0x87');});if(_0x5ab81e[_0x0ead('0x94')]>0x0&&_0x323653['length']>0x0){return Promise['resolve']()[_0x0ead('0x9a')](cmHopper[_0x0ead('0x149')](_[_0x0ead('0x14a')](_0x5ab81e,'id'),previewRecallmeReminderInterval,_[_0x0ead('0x14a')](_0x323653,'id')))[_0x0ead('0x9a')](function(_0x571e8e){for(var _0x279073=0x0;_0x279073<_0x571e8e[_0x0ead('0x94')];_0x279073++){var _0x503102=_0x571e8e[_0x279073][_0x0ead('0x14b')][_0x0ead('0x45')];if(_0x503102)io['to'](util[_0x0ead('0x44')]('user:%s',_0x503102))['emit'](_0x0ead('0x14c'),{'hopper':_0x571e8e[_0x279073]});}})[_0x0ead('0x9c')](function(_0x503912){logger[_0x0ead('0x61')](_0x0ead('0x14d'),_0x503912);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0ead('0x3e')]=function(){var _0x5e7a90=this;setInterval(function(){_0x5e7a90[_0x0ead('0x14e')](_0x5e7a90[_0x0ead('0x25')],_0x0ead('0x14f'));_0x5e7a90['clearZombieChannels'](_0x5e7a90[_0x0ead('0x24')],_0x0ead('0x150'));},0x32c8);};Dialer[_0x0ead('0x1a')]['clearZombieChannels']=function(_0x46fd5c,_0x5548ca){var _0x44e4c8=this;for(var _0x22fd78 in _0x46fd5c){if(typeof _0x46fd5c[_0x22fd78]!=='undefined'){this[_0x0ead('0x1d')][_0x0ead('0x151')](function(){if(!_['isNil'](_0x46fd5c[_0x22fd78])){return ami[_0x0ead('0x9d')]({'action':_0x0ead('0x86'),'channel':_0x46fd5c[_0x22fd78][_0x0ead('0xed')]})[_0x0ead('0x9c')](function(_0x3c450b){if(_0x3c450b['message']===_0x0ead('0x152')){setTimeout(function(){if(_0x46fd5c[_0x22fd78]&&_0x46fd5c[_0x22fd78]['type']!==_0x0ead('0xbe')){_0x44e4c8[_0x0ead('0xbf')](_0x44e4c8[_0x0ead('0x1e')][_0x46fd5c[_0x22fd78][_0x0ead('0xc0')]]);logger[_0x0ead('0x61')](_0x0ead('0x153'),_0x5548ca,_0x22fd78,_0x46fd5c[_0x22fd78][_0x0ead('0xc0')]);delete _0x46fd5c[_0x22fd78];}if(_0x46fd5c[_0x22fd78]&&_0x46fd5c[_0x22fd78]['type']===_0x0ead('0xbe')){_0x44e4c8[_0x0ead('0xbf')](_0x44e4c8[_0x0ead('0x1f')][_0x46fd5c[_0x22fd78][_0x0ead('0xc0')]]);logger[_0x0ead('0x61')]('[Dialer][checkChannel][ivr]',_0x5548ca,_0x22fd78,_0x46fd5c[_0x22fd78][_0x0ead('0xc0')]);delete _0x46fd5c[_0x22fd78];}},0x2328);}});}});}}};Dialer[_0x0ead('0x1a')][_0x0ead('0x154')]=function(_0x4ea75a){return Promise[_0x0ead('0xaa')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x4ea75a))[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x155')));};Dialer[_0x0ead('0x1a')][_0x0ead('0xbf')]=function(_0x4209b6){if(!_['isUndefined'](_0x4209b6)&&_0x4209b6!==null){if(typeof _0x4209b6[_0x0ead('0x156')]!==_0x0ead('0xa8')){if(_0x4209b6[_0x0ead('0x156')]>0x0){_0x4209b6[_0x0ead('0x156')]-=0x1;}else{logger[_0x0ead('0x61')](_0x0ead('0x157'));}}}else{logger['error'](_0x0ead('0x158'));}};Dialer[_0x0ead('0x1a')][_0x0ead('0x159')]=function(_0x1b52ca,_0x191742){var _0x5d0158=this;return function(_0x30a5df){_0x5d0158[_0x0ead('0xbf')](_0x191742);logger['error'](_0x1b52ca,util[_0x0ead('0x62')](_0x30a5df,{'showHidden':![],'depth':null}));};};Dialer[_0x0ead('0x1a')]['emptyContact']=function(_0x243b1c,_0x174d6f,_0x4836b1){var _0x38153e={'state':0x19,'statedesc':_0x0ead('0x15a')};this[_0x0ead('0xbf')](_0x174d6f);this[_0x0ead('0x119')](_[_0x0ead('0xf5')](_0x38153e,_['pick'](_0x4836b1,[_0x0ead('0xdb'),_0x0ead('0xdc'),_0x0ead('0x15b'),_0x0ead('0xfb'),'CampaignId'])),_0x0ead('0x15c'),_0x0ead('0x15d'));logger[_0x0ead('0x61')](_0x243b1c);};Dialer[_0x0ead('0x1a')][_0x0ead('0x119')]=function(_0x108331,_0xbe6d77,_0x38f111){hopperUtils[_0x0ead('0xc8')](_0x108331)['catch'](loggerCatch(_0xbe6d77));hopperUtils['moveContactManagedDialer'](_0x108331)['catch'](loggerCatch(_0x38f111));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x1c67b9,_0x2932e8){hopperUtils[_0x0ead('0xc8')](_0x1c67b9)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2932e8==0x0){hopperUtils[_0x0ead('0xc9')](_0x1c67b9)['catch'](loggerCatch(_0x0ead('0x15e')));}};Dialer[_0x0ead('0x1a')][_0x0ead('0x14d')]=function(_0xc5c186){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_0xc5c186['id'],previewRecallmeReminderInterval))['then'](function(_0x22cb27){for(var _0x20b231=0x0;_0x20b231<_0x22cb27[_0x0ead('0x94')];_0x20b231++){var _0x177797=_0x22cb27[_0x20b231][_0x0ead('0x14b')][_0x0ead('0x45')];if(_0x177797)io['to'](util[_0x0ead('0x44')](_0x0ead('0x15f'),_0x177797))[_0x0ead('0x41')]('user:dialPreviewRecallReminder',{'hopper':_0x22cb27[_0x20b231]});}})['catch'](function(){});};Dialer[_0x0ead('0x1a')]['launchHandleIvr']=function(_0x1039c4){var _0x4e3799=this;return function(){_0x4e3799['handleIvr'](_0x1039c4);};};Dialer[_0x0ead('0x1a')][_0x0ead('0x160')]=function(_0x45b55b,_0x443e50){var _0x31ede6=this;var _0x1b6ac4=uuid['v4']();this[_0x0ead('0x24')][_0x1b6ac4]=new Action(_0x45b55b,_0x443e50,_0x1b6ac4);return new Promise(function(_0x5bbf31,_0x23b412){if(_[_0x0ead('0x51')](_0x45b55b)&&typeof _0x45b55b!==_0x0ead('0x161')){return _0x23b412(msgResponse(_0x0ead('0x162'),_0x0ead('0x8e'),_0x0ead('0x163')));}if(_['isUndefined'](_0x443e50['phone'])||_0x443e50[_0x0ead('0x164')]===null){return _0x23b412(msgResponse(_0x0ead('0x162'),_0x0ead('0x8e'),_0x0ead('0x165')));}var _0x26baca={'XMD-CALLERID':_0x31ede6['actions'][_0x1b6ac4][_0x0ead('0x166')](),'XMD-AGI':_0x45b55b[_0x0ead('0x131')]?util[_0x0ead('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x45b55b[_0x0ead('0x131')]):'NONE','XMD-AGIAFTER':_0x45b55b[_0x0ead('0xc6')]?util[_0x0ead('0x44')](_0x0ead('0x167'),ipAgi,_0x45b55b[_0x0ead('0xc6')]):'NONE','XMD-QUEUE':utils[_0x0ead('0x168')](_0x45b55b)?util['format'](_0x0ead('0x169'),_0x45b55b[_0x0ead('0x45')],_0x45b55b[_0x0ead('0x16a')]||'',_0x45b55b['dialAgiAfterHangupAgent']?'c':'',_0x45b55b['dialQueueTimeout']||0x3):_0x0ead('0x16b'),'XMD-CONTACTID':_0x443e50[_0x0ead('0xdb')],'XMD-CDRTYPE':_0x0ead('0x7'),'CALLERID(all)':_0x31ede6[_0x0ead('0x24')][_0x1b6ac4]['getCaller'](),'XMD-AMD':_0x45b55b[_0x0ead('0x11c')]?_0x0ead('0x13f'):'NONE','XMD-DESTINATION':_0x0ead('0x110')};if(_0x45b55b[_0x0ead('0x11c')]){_0x26baca[_0x0ead('0x16c')]=_0x45b55b[_0x0ead('0x16d')]||0x9c4;_0x26baca['XMD-AMDGREETING']=_0x45b55b[_0x0ead('0x16e')]||0x5dc;_0x26baca['XMD-AMDAFTERGREETINGSILENCE']=_0x45b55b['dialAMDAfterGreetingSilence']||0x320;_0x26baca[_0x0ead('0x16f')]=_0x45b55b[_0x0ead('0x170')]||0x1388;_0x26baca[_0x0ead('0x171')]=_0x45b55b[_0x0ead('0x172')]||0x64;_0x26baca['XMD-AMDBETWEENWORDSSILENCE']=_0x45b55b['dialAMDBetweenWordsSilence']||0x32;_0x26baca[_0x0ead('0x173')]=_0x45b55b['dialAMDMaximumNumberOfWords']||0x3;_0x26baca[_0x0ead('0x174')]=_0x45b55b[_0x0ead('0x175')]||0x100;_0x26baca[_0x0ead('0x176')]=_0x45b55b[_0x0ead('0x177')]||0x1388;}if(utils[_0x0ead('0x168')](_0x45b55b)){_0x26baca['XMD-VOICEQUEUEID']=_0x443e50[_0x0ead('0xfb')];}else{_0x26baca['XMD-CAMPAIGNID']=_0x443e50[_0x0ead('0xdd')];}var _0x34de02=utils[_0x0ead('0x178')](_0x443e50['Contact']);Object['assign'](_0x26baca,_0x34de02);var _0x186837=_0x31ede6[_0x0ead('0x83')](_0x45b55b['Trunk'])?utils[_0x0ead('0x179')](_0x45b55b[_0x0ead('0x17a')][_0x0ead('0x17b')],_0x45b55b[_0x0ead('0x17c')],_0x45b55b[_0x0ead('0x17d')]>0x0?utils[_0x0ead('0x17e')](_0x45b55b[_0x0ead('0x17f')],_0x45b55b[_0x0ead('0x17d')]):_0x45b55b[_0x0ead('0x17f')]):utils[_0x0ead('0x179')](_[_0x0ead('0xf1')](_0x45b55b[_0x0ead('0x89')])?_0x45b55b[_0x0ead('0x17a')][_0x0ead('0x17b')]:_0x45b55b[_0x0ead('0x89')][_0x0ead('0x17b')],_0x45b55b[_0x0ead('0x17c')],_0x45b55b[_0x0ead('0x17d')]>0x0?utils[_0x0ead('0x17e')](_0x45b55b[_0x0ead('0x17f')],_0x45b55b['dialRandomLastDigitCallerIdNumber']):_0x45b55b['dialOriginateCallerIdNumber']);if(_0x186837){_0x26baca[_0x0ead('0x180')]=_0x31ede6['actions'][_0x1b6ac4][_0x0ead('0x181')]=utils[_0x0ead('0x182')](_0x186837);_0x26baca['XMD-ORIGINATECALLERIDNUM']=_0x443e50[_0x0ead('0x164')];}_0x45b55b['variables']=_0x26baca;return ami[_0x0ead('0x9d')]({'actionid':_0x1b6ac4,'action':_0x0ead('0x162'),'channel':_0x31ede6[_0x0ead('0x83')](_0x45b55b[_0x0ead('0x17a')])?util[_0x0ead('0x44')](_0x0ead('0x183'),_0x45b55b[_0x0ead('0x17a')][_0x0ead('0x45')],isNotNull(_0x45b55b['dialPrefix'])?_0x45b55b[_0x0ead('0x184')][_0x0ead('0x185')]()||'':'',_0x45b55b[_0x0ead('0x186')]>0x0?_0x443e50[_0x0ead('0x164')][_0x0ead('0x187')](_0x45b55b[_0x0ead('0x186')]):_0x443e50[_0x0ead('0x164')]):util[_0x0ead('0x44')](_0x0ead('0x183'),_[_0x0ead('0xf1')](_0x45b55b['TrunkBackup'])?_0x45b55b[_0x0ead('0x17a')][_0x0ead('0x45')]:_0x45b55b[_0x0ead('0x89')][_0x0ead('0x45')],isNotNull(_0x45b55b[_0x0ead('0x184')])?_0x45b55b[_0x0ead('0x184')][_0x0ead('0x185')]()||'':'',_0x45b55b[_0x0ead('0x186')]>0x0?_0x443e50[_0x0ead('0x164')][_0x0ead('0x187')](_0x45b55b[_0x0ead('0x186')]):_0x443e50[_0x0ead('0x164')]),'callerid':_0x186837,'Exten':_0x0ead('0x110'),'Context':_0x0ead('0x188'),'Priority':'1','variable':_0x26baca,'timeout':(_0x45b55b[_0x0ead('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b6ac4})[_0x0ead('0x9a')](function(_0x375fbc){return _0x5bbf31(_0x375fbc);})[_0x0ead('0x9c')](function(_0x5647eb){_0x45b55b[_0x0ead('0x18a')]+=0x1;var _0xa3bba3=new History(_0x31ede6[_0x0ead('0x24')][_0x1b6ac4]);logger[_0x0ead('0x61')](util[_0x0ead('0x44')]('[originateError]:\x20%s',JSON[_0x0ead('0x72')](_0x5647eb)));_0xa3bba3[_0x0ead('0x6d')]=0xe;_0xa3bba3['statedesc']=_0x0ead('0x18b');_0xa3bba3['starttime']=moment()['format'](_0x0ead('0xc2'));_0xa3bba3[_0x0ead('0x6f')]=_0xa3bba3[_0x0ead('0xdf')];hopperUtils[_0x0ead('0xc8')](_0xa3bba3)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x18c')));_0x31ede6[_0x0ead('0xc9')](_0xa3bba3)[_0x0ead('0x9c')](loggerCatch('[originate][error]'))[_0x0ead('0x1c')](function(){delete _0x31ede6['actions'][_0x1b6ac4];return _0x23b412(msgResponse(_0x0ead('0x162'),_0x0ead('0x82'),_0x0ead('0x18d')));});});});};Dialer[_0x0ead('0x1a')][_0x0ead('0x18e')]=function(_0x1a1b6f,_0x520cc4,_0x312d10){var _0x545724=new History(_0x520cc4);if(_0x545724['countbusyretry']+_0x545724[_0x0ead('0x18f')]+_0x545724[_0x0ead('0x12c')]+_0x545724[_0x0ead('0x124')]+_0x545724[_0x0ead('0xd1')]+_0x545724[_0x0ead('0xe6')]+_0x545724['countmachineretry']+_0x545724[_0x0ead('0x125')]>=_0x312d10[_0x0ead('0x12d')]-0x1){return!![];}switch(_0x1a1b6f){case 0x3:if(_0x545724['countnoanswerretry']>=_0x312d10[_0x0ead('0x190')]-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countnoanswerretry':_0x545724[_0x0ead('0x12c')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10[_0x0ead('0x191')],'minutes')[_0x0ead('0x44')](_0x0ead('0xc2')),'ContactId':_0x545724['ContactId'],'ListId':_0x545724['ListId'],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x192')));break;case 0x5:if(_0x545724[_0x0ead('0x123')]>=_0x312d10[_0x0ead('0x193')]-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countbusyretry':_0x545724[_0x0ead('0x123')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10['dialBusyRetryFrequency'],_0x0ead('0xda'))[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724['VoiceQueueId']||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x194')));break;case 0x8:if(_0x545724[_0x0ead('0x18f')]>=_0x312d10['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countcongestionretry':_0x545724[_0x0ead('0x18f')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10[_0x0ead('0x195')],'minutes')[_0x0ead('0x44')](_0x0ead('0xc2')),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})['catch'](loggerCatch(_0x0ead('0x196')));break;case 0x0:if(_0x545724['countnosuchnumberretry']>=_0x312d10[_0x0ead('0x197')]-0x1){return!![];}else{hopperUtils[_0x0ead('0xd8')]({'active':![],'countnosuchnumberretry':_0x545724[_0x0ead('0x124')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10['dialNoSuchNumberRetryFrequency'],_0x0ead('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724['ListId'],'VoiceQueueId':_0x545724['VoiceQueueId']||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})['catch'](loggerCatch(_0x0ead('0x198')));}break;case 0xa:if(_0x545724[_0x0ead('0xd1')]>=_0x312d10[_0x0ead('0xd7')]-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countdropretry':_0x545724[_0x0ead('0xd1')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10[_0x0ead('0xd2')],_0x0ead('0xda'))['format'](_0x0ead('0xc2')),'ContactId':_0x545724['ContactId'],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x545724['countabandonedretry']>=_0x312d10[_0x0ead('0xe9')]-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countabandonedretry':_0x545724[_0x0ead('0xe6')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10[_0x0ead('0xe8')],_0x0ead('0xda'))['format'](_0x0ead('0xc2')),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x545724[_0x0ead('0x121')]>=_0x312d10['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countmachineretry':_0x545724[_0x0ead('0x121')]+=0x1,'scheduledat':moment()['add'](_0x312d10[_0x0ead('0x129')],_0x0ead('0xda'))[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x545724[_0x0ead('0x125')]>=_0x312d10['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x0ead('0xd8')]({'active':![],'countagentrejectretry':_0x545724[_0x0ead('0x125')]+=0x1,'scheduledat':moment()[_0x0ead('0xd9')](_0x312d10[_0x0ead('0x199')],'minutes')[_0x0ead('0x44')](_0x0ead('0xc2')),'ContactId':_0x545724[_0x0ead('0xdb')],'ListId':_0x545724[_0x0ead('0xdc')],'VoiceQueueId':_0x545724[_0x0ead('0xfb')]||undefined,'CampaignId':_0x545724[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x19a')));break;default:return!![];}};Dialer[_0x0ead('0x1a')][_0x0ead('0x10c')]=function(_0x393b32,_0xa4f2f2,_0x4f4858){var _0x21781e=this;var _0x2e38cf=new History(_0x393b32);var _0x12f81f=![];var _0x5dc904;var _0x12cf78;return new Promise(function(_0x623b46,_0x1c5702){if(_['isUndefined'](_0xa4f2f2)&&typeof _0xa4f2f2!==_0x0ead('0x161')){return _0x1c5702(msgResponse(_0x0ead('0x19b'),'Failure',_0x0ead('0x19c')));}if(_[_0x0ead('0x51')](_0x4f4858)&&typeof _0x4f4858!==_0x0ead('0x161')){return _0x1c5702(msgResponse(_0x0ead('0x19b'),_0x0ead('0x8e'),_0x0ead('0x19d')));}hopperUtils['verifyAdditionalPhones'](_0x2e38cf,_0x4f4858[_0x0ead('0xc3')],_0xa4f2f2)[_0x0ead('0x9a')](function(_0x555ffd){if(_0x555ffd[_0x0ead('0xd6')]==0x1)_0x12f81f=!![];switch(_0x4f4858[_0x0ead('0xc3')]){case'0':_0xa4f2f2['outboundNoSuchCallsDay']+=0x1;_0x2e38cf['state']=0x0;_0x2e38cf[_0x0ead('0x6e')]=_0x0ead('0x19e');_0x2e38cf[_0x0ead('0x124')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;ami['emit'](_0x0ead('0x19f'),ut[_0x0ead('0x117')](_0x393b32,_0x0ead('0x1a0')));_0x5dc904=_0xa4f2f2[_0x0ead('0x1a1')];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];hopperUtils[_0x0ead('0xc8')](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x21781e[_0x0ead('0x18e')](0x0,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf['countnosuchnumberretry']>=_0xa4f2f2[_0x0ead('0x197')]){_0x21781e[_0x0ead('0x128')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1a2'));}else{_0x21781e[_0x0ead('0x12e')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1a2'));}}break;case'3':_0xa4f2f2[_0x0ead('0x1a3')]+=0x1;_0x2e38cf[_0x0ead('0x6d')]=0x3;_0x2e38cf['statedesc']='NoAnswer';_0x2e38cf[_0x0ead('0x12c')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;var _0x3a7d43=ut[_0x0ead('0x1a4')](_0x393b32,_0xa4f2f2);ami[_0x0ead('0x41')](_0x0ead('0x1a5'),_0x3a7d43);_0x5dc904=_0xa4f2f2[_0x0ead('0x191')];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];hopperUtils['createHistory'](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1a6')));if(_0x21781e[_0x0ead('0x18e')](0x3,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0x12c')]>=_0xa4f2f2[_0x0ead('0x190')]){_0x21781e['createStateFinal'](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1a7'));}else{_0x21781e['stateGlobal'](_0x2e38cf,_0x623b46,_0x1c5702,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xa4f2f2[_0x0ead('0x1a8')]+=0x1;_0x2e38cf['state']=0x5;_0x2e38cf[_0x0ead('0x6e')]='Busy';_0x2e38cf[_0x0ead('0x123')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;ami[_0x0ead('0x41')]('custom:agentbusy',ut[_0x0ead('0x117')](_0x393b32,_0x0ead('0x1a9')));_0x5dc904=_0xa4f2f2[_0x0ead('0x1aa')];_0x12cf78=_0xa4f2f2['callAdditionalPhoneAfterMin'];hopperUtils[_0x0ead('0xc8')](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x21781e['checkRetriveMax'](0x5,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0x123')]>=_0xa4f2f2[_0x0ead('0x193')]){_0x21781e['createStateFinal'](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1ab'));}else{_0x21781e[_0x0ead('0x12e')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1ab'));}}break;case'8':_0xa4f2f2[_0x0ead('0x1ac')]+=0x1;_0x2e38cf[_0x0ead('0x6d')]=0x8;_0x2e38cf['statedesc']=_0x0ead('0x1ad');_0x2e38cf[_0x0ead('0x18f')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;_0x5dc904=_0xa4f2f2[_0x0ead('0x195')];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];ami[_0x0ead('0x41')](_0x0ead('0x1ae'),ut[_0x0ead('0x117')](_0x393b32,'congestion'));hopperUtils[_0x0ead('0xc8')](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1af')));if(_0x21781e['checkRetriveMax'](0x8,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0x18f')]>=_0xa4f2f2[_0x0ead('0x1b0')]){_0x21781e[_0x0ead('0x128')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1b1'));}else{_0x21781e[_0x0ead('0x12e')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1b1'));}}break;case'11':_0xa4f2f2[_0x0ead('0x1b2')]+=0x1;_0x2e38cf[_0x0ead('0x6d')]=0xb;_0x2e38cf[_0x0ead('0x6e')]=_0x0ead('0xe5');_0x2e38cf[_0x0ead('0xe6')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;_0x5dc904=_0xa4f2f2[_0x0ead('0xe8')];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];hopperUtils[_0x0ead('0xc8')](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x21781e['checkRetriveMax'](0xb,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0xe6')]>=_0xa4f2f2[_0x0ead('0xe9')]){_0x21781e[_0x0ead('0x128')](_0x2e38cf,_0x623b46,_0x1c5702,'reason\x2011\x20abandoned');}else{_0x21781e['stateGlobal'](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1b3'));}}break;case'20':_0xa4f2f2[_0x0ead('0x1b4')]+=0x1;_0x2e38cf[_0x0ead('0x6d')]=0x14;_0x2e38cf['statedesc']=_0x0ead('0x1b5');_0x2e38cf[_0x0ead('0x125')]+=0x1;_0x2e38cf[_0x0ead('0xe7')]+=0x1;_0x5dc904=_0xa4f2f2['dialAgentRejectRetryFrequency'];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];ami[_0x0ead('0x41')](_0x0ead('0x1b6'),ut['buildObj'](_0x393b32,'agentreject'));hopperUtils['createHistory'](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1b7')));if(_0x21781e[_0x0ead('0x18e')](0x14,_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0x125')]>=_0xa4f2f2[_0x0ead('0x1b8')]){_0x21781e[_0x0ead('0x128')](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1b9'));}else{_0x21781e['stateGlobal'](_0x2e38cf,_0x623b46,_0x1c5702,_0x0ead('0x1b9'));}}break;default:_0xa4f2f2[_0x0ead('0x137')]+=0x1;_0x2e38cf[_0x0ead('0x6d')]=0xc;_0x2e38cf[_0x0ead('0x6e')]=_0x4f4858['reason'];_0x5dc904=_0xa4f2f2[_0x0ead('0x199')];_0x12cf78=_0xa4f2f2[_0x0ead('0xd3')];hopperUtils[_0x0ead('0xc8')](_0x2e38cf)[_0x0ead('0x9c')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x21781e[_0x0ead('0x18e')](_0x4f4858[_0x0ead('0xc3')],_0x393b32,_0xa4f2f2)&&!_0x12f81f){if(_0x2e38cf[_0x0ead('0x123')]+_0x2e38cf[_0x0ead('0x18f')]+_0x2e38cf[_0x0ead('0x12c')]+_0x2e38cf['countnosuchnumberretry']+_0x2e38cf[_0x0ead('0xd1')]+_0x2e38cf['countabandonedretry']+_0x2e38cf[_0x0ead('0x121')]+_0x2e38cf[_0x0ead('0x125')]>=_0xa4f2f2['dialGlobalMaxRetry']){_0x21781e[_0x0ead('0x12e')](_0x2e38cf,_0x623b46,_0x1c5702,_0x4f4858[_0x0ead('0xc3')]);}else{_0x21781e['createStateFinal'](_0x2e38cf,_0x623b46,_0x1c5702,_0x4f4858[_0x0ead('0xc3')]);}}}})[_0x0ead('0x9a')](function(){if(_0x12f81f){hopperUtils[_0x0ead('0xe3')](_0x2e38cf,_0x5dc904,_0x12cf78)[_0x0ead('0x9a')](function(){return _0x623b46(0x1);});}});});};Dialer[_0x0ead('0x1a')][_0x0ead('0x12e')]=function(_0x5cc804,_0x9b3584,_0x34a3bb,_0x4f227d){var _0x557a33=new Final(_0x5cc804);_0x557a33[_0x0ead('0x6d')]=0xf;_0x557a33[_0x0ead('0x6e')]=_0x0ead('0x1ba');this[_0x0ead('0x128')](_0x557a33,_0x9b3584,_0x34a3bb,_0x4f227d);};Dialer[_0x0ead('0x1a')][_0x0ead('0x128')]=function(_0x901e00,_0x41d384,_0xc2dd59,_0x2a2e49){hopperUtils[_0x0ead('0xc9')](_0x901e00)[_0x0ead('0x9a')](function(){return _0x41d384(msgResponse(_0x0ead('0x19b'),_0x0ead('0x10b'),_0x2a2e49));})['catch'](function(){return _0xc2dd59(msgResponse(_0x0ead('0x1bb'),_0x0ead('0x8e'),_0x0ead('0x1bc')));});};Dialer[_0x0ead('0x1a')][_0x0ead('0x8')]=function(_0x7415d2){var _0x4d31b4=_0x7415d2[_0x0ead('0x1bd')]/0x64;var _0x31c87e=_0x7415d2[_0x0ead('0xcd')]/(_0x7415d2[_0x0ead('0xcd')]+_0x7415d2[_0x0ead('0x11f')]);var _0x17f6d7=Math['round'](_0x7415d2[_0x0ead('0x1be')]*(_0x7415d2[_0x0ead('0x1bf')]/0x64));var _0x1b66f8=Math[_0x0ead('0x1c0')](_0x7415d2[_0x0ead('0x1be')]*(_0x7415d2[_0x0ead('0x1c1')]/0x64));var _0x18d138=_0x7415d2['available']+_0x7415d2[_0x0ead('0x13d')];var _0x13416a=Math['floor'](_0x7415d2[_0x0ead('0x56')]*_0x7415d2[_0x0ead('0x58')]*_0x7415d2[_0x0ead('0x1c2')]*_0x7415d2['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x7415d2[_0x0ead('0x28')])){if(!_[_0x0ead('0x51')](_0x7415d2['startPredictive'])){_0x7415d2[_0x0ead('0x27')]=undefined;loggerPredictive[_0x0ead('0x61')](_0x0ead('0x1c3'),_0x0ead('0x1c4'));}if(!_[_0x0ead('0x51')](_0x7415d2[_0x0ead('0x5f')])){loggerPredictive[_0x0ead('0x61')](_0x0ead('0x1c3'),_0x0ead('0x1c5'));clearInterval(_0x7415d2['handlePredictive']);_0x7415d2[_0x0ead('0x5f')]=undefined;}_0x7415d2[_0x0ead('0x28')]=moment()['format'](_0x0ead('0xc2'));loggerPredictive['info'](_0x7415d2[_0x0ead('0x45')],_0x0ead('0x1c6'),_0x7415d2[_0x0ead('0x28')]);this[_0x0ead('0xb2')](_0x7415d2,0x1);}else if(ifInterval(_0x7415d2['dialPredictiveInterval'],_0x7415d2[_0x0ead('0x28')])){this[_0x0ead('0xb2')](_0x7415d2,0x1);loggerPredictiveCalls['info'](_0x0ead('0x1c7'),_0x7415d2['startProgressive'],_0x7415d2[_0x0ead('0x45')]);_0x7415d2['erlangCalls']=0x0;_0x7415d2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4d31b4<_0x31c87e&&_0x7415d2[_0x0ead('0x1c8')]==='dropRate'){clearPredictiveAttributes(_0x7415d2);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x1c9'),_0x0ead('0x1ca'),_0x31c87e,_0x0ead('0x28'),_0x7415d2[_0x0ead('0x45')]);}else if(_0x13416a<_0x7415d2[_0x0ead('0x1cb')]&&_0x7415d2[_0x0ead('0x1c8')]==='dropRate'){clearPredictiveAttributes(_0x7415d2);loggerPredictive[_0x0ead('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x0ead('0x1cc'),_0x13416a,_0x0ead('0x1cd'),_0x7415d2[_0x0ead('0x1cb')],'startProgressive',_0x7415d2[_0x0ead('0x45')]);}else if(!ifInterval(_0x7415d2[_0x0ead('0x1ce')],_0x7415d2['startProgressive'])&&_[_0x0ead('0x51')](_0x7415d2[_0x0ead('0x27')])&&!_['isUndefined'](_0x7415d2[_0x0ead('0x28')])){_0x7415d2[_0x0ead('0x27')]=moment()[_0x0ead('0x44')](_0x0ead('0xc2'));loggerPredictive['info'](_0x7415d2['name'],'started\x20in\x20predictive\x20at',_0x7415d2[_0x0ead('0x27')]);hopperUtils[_0x0ead('0x1cf')](_0x7415d2[_0x0ead('0x1ce')])[_0x0ead('0x9a')](this[_0x0ead('0x1d0')](_0x7415d2))[_0x0ead('0x9a')](mergeDataErlangB(_0x7415d2))[_0x0ead('0x9a')](this[_0x0ead('0x1d1')](_0x7415d2))[_0x0ead('0x9c')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x7415d2));}else if(!ifInterval(_0x7415d2[_0x0ead('0x1ce')],_0x7415d2[_0x0ead('0x27')])){_0x7415d2[_0x0ead('0x1cb')]=0x0;_0x7415d2[_0x0ead('0x27')]=moment()[_0x0ead('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x7415d2[_0x0ead('0x45')],_0x0ead('0x1d2'),_0x7415d2[_0x0ead('0x27')]);clearInterval(_0x7415d2[_0x0ead('0x5f')]);_0x7415d2[_0x0ead('0x5f')]=undefined;hopperUtils[_0x0ead('0x1cf')](_0x7415d2[_0x0ead('0x1ce')])[_0x0ead('0x9a')](this['getDataPredictive'](_0x7415d2))['then'](mergeDataErlangB(_0x7415d2))[_0x0ead('0x9a')](this[_0x0ead('0x1d1')](_0x7415d2))[_0x0ead('0x9c')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x7415d2));}else if(_0x7415d2[_0x0ead('0x1be')]&&_0x18d138<_0x7415d2[_0x0ead('0x1be')]-_0x1b66f8){clearPredictiveAttributes(_0x7415d2);loggerPredictive['info'](_0x7415d2[_0x0ead('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x18d138,_0x0ead('0x1d3'),_0x7415d2[_0x0ead('0x1be')],'-',_0x1b66f8,'=',_0x7415d2[_0x0ead('0x1be')]-_0x1b66f8,')');}else if(_0x7415d2['predictiveIntervalAvailable']&&_0x18d138>_0x7415d2[_0x0ead('0x1be')]+_0x17f6d7){clearPredictiveAttributes(_0x7415d2);loggerPredictive[_0x0ead('0x46')](_0x7415d2[_0x0ead('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x18d138,')\x20are\x20more\x20than\x20threshold\x20(',_0x7415d2['predictiveIntervalAvailable'],'+',_0x17f6d7,'=',_0x7415d2['predictiveIntervalAvailable']+_0x17f6d7,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2a9df2){var _0x107f9a=this;return function(_0xbe2cb8){return new Promise(function(_0x2a0fbc,_0x48c6cf){_['merge'](_0x2a9df2,_0xbe2cb8[0x0]);if(checkGetDataPredictive(_0xbe2cb8[0x0])){var _0x55dbe2=_0x2a9df2[_0x0ead('0x1be')]=_0x2a9df2['talking']+_0x2a9df2[_0x0ead('0x13b')];var _0xb226d2=_0x2a9df2[_0x0ead('0x1ce')]*0x3c;var _0x5876b1=_0xbe2cb8[0x0][_0x0ead('0x4f')]+_0xbe2cb8[0x0][_0x0ead('0x4d')];var _0x22869c=(_0xbe2cb8[0x0]['predictiveIntervalAnsweredCalls']+_0xbe2cb8[0x0][_0x0ead('0x49')]+_0xbe2cb8[0x0][_0x0ead('0x4b')])/_0xbe2cb8[0x0]['predictiveIntervalTotalCalls'];_0x2a9df2[_0x0ead('0x1c2')]=_0x22869c>0x0?_0x22869c:0x1;switch(_0x2a9df2[_0x0ead('0x1c8')]){case _0x0ead('0x1d4'):var _0x23122c=_0x2a9df2['dialPredictiveOptimizationPercentage']/0x64;return _0x107f9a['abandonmentRate'](_0x55dbe2,_0xb226d2,_0x5876b1,_0x22869c,_0x23122c)[_0x0ead('0x9a')](function(_0x3d978d){return _0x2a0fbc(_0x3d978d);});case _0x0ead('0x1d5'):var _0x554cb7=_0x2a9df2[_0x0ead('0x1bd')]/0x64;return _0x107f9a[_0x0ead('0x1d6')](_0x55dbe2,_0xb226d2,_0x5876b1,_0x22869c,_0x554cb7)[_0x0ead('0x9a')](function(_0x364f66){return _0x2a0fbc(_0x364f66);});default:return _0x48c6cf(msgResponse('[getDataPredictive]',_0x0ead('0x8e'),_0x0ead('0x1d7')));}}else{return _0x48c6cf(msgResponse(_0x0ead('0x1d8'),_0x0ead('0x8e'),'check\x20failure'));}});};};Dialer[_0x0ead('0x1a')]['getDataPredictiveOld']=function(_0x43401b){var _0x335aeb=this;return function(_0x335267){return new Promise(function(_0x47b224,_0x4ccbfe){_[_0x0ead('0xf5')](_0x43401b,_0x335267[0x0]);if(checkGetDataPredictive(_0x335267[0x0])){loggerPredictive[_0x0ead('0x46')](JSON[_0x0ead('0x72')](_0x335267[0x0]));if(_0x43401b[_0x0ead('0x1c8')]===_0x0ead('0x1d4')){return _0x335aeb['getVoiceQueueRtPauses'](_0x43401b['id'])[_0x0ead('0x9a')](function(_0x59753d){var _0xbf0c9d=_0x43401b['loggedIn']-_0x59753d[0x0]['outboundQueuePauses'];var _0x1a868f=_0x43401b[_0x0ead('0x1ce')]*0x3c;var _0x3382da=_0x335267[0x0][_0x0ead('0x4f')]+_0x335267[0x0][_0x0ead('0x4d')];var _0x1e9719=(_0x335267[0x0][_0x0ead('0x48')]+_0x335267[0x0][_0x0ead('0x49')]+_0x335267[0x0][_0x0ead('0x4b')])/_0x335267[0x0][_0x0ead('0x47')];var _0x29e990=_0x43401b[_0x0ead('0x1bd')]/0x64;_0x43401b[_0x0ead('0x1d9')]=_0x59753d[0x0][_0x0ead('0x1da')]||0x0;_0x43401b[_0x0ead('0x1c2')]=_0x1e9719>0x0?_0x1e9719:0x1;return _0x335aeb['abandonmentRate'](_0xbf0c9d,_0x1a868f,_0x3382da,_0x1e9719,_0x29e990);})['then'](function(_0x4465c6){return _0x47b224(_0x4465c6);})[_0x0ead('0x9c')](function(_0x53c9b5){return _0x4ccbfe(msgResponse(_0x0ead('0x1db'),_0x0ead('0x8e'),JSON['stringify'](_0x53c9b5)));});}if(_0x43401b[_0x0ead('0x1c8')]===_0x0ead('0x1d5')){return _0x335aeb[_0x0ead('0x154')](_0x43401b['id'])[_0x0ead('0x9a')](function(_0x4ad7e2){var _0x2e61f6=_0x43401b['loggedIn']-_0x4ad7e2[0x0][_0x0ead('0x1da')];var _0x4cc2f2=_0x43401b[_0x0ead('0x1ce')]*0x3c;var _0x2baca8=_0x335267[0x0][_0x0ead('0x4f')]+_0x335267[0x0][_0x0ead('0x4d')];var _0x4ba40d=(_0x335267[0x0][_0x0ead('0x48')]+_0x335267[0x0][_0x0ead('0x49')]+_0x335267[0x0][_0x0ead('0x4b')])/_0x335267[0x0][_0x0ead('0x47')];var _0x3d792a=_0x43401b[_0x0ead('0x1bd')]/0x64;_0x43401b['predictiveIntervalPauses']=_0x4ad7e2[0x0][_0x0ead('0x1da')]||0x0;_0x43401b[_0x0ead('0x1c2')]=_0x4ba40d>0x0?_0x4ba40d:0x1;return _0x335aeb['busyFactor'](_0x2e61f6,_0x4cc2f2,_0x2baca8,_0x4ba40d,_0x3d792a);})[_0x0ead('0x9a')](function(_0x45d670){return _0x47b224(_0x45d670);})[_0x0ead('0x9c')](function(_0x299832){return _0x4ccbfe(msgResponse('[CatchErlangB]',_0x0ead('0x8e'),JSON['stringify'](_0x299832)));});}}else{return _0x4ccbfe(msgResponse(_0x0ead('0x1d8'),_0x0ead('0x8e'),_0x0ead('0x1dc')));}});};};Dialer[_0x0ead('0x1a')][_0x0ead('0x1d1')]=function(_0x38203a){var _0x27ae00=this;return function(){var _0xe3583f=0x0;var _0x1b6081=Math['floor'](_0x38203a[_0x0ead('0x57')]*0x3e8);if(_0x1b6081>0x0){_0x1b6081=_0x1b6081<0x64?0x64:_0x1b6081;loggerPredictive[_0x0ead('0x46')](_0x38203a[_0x0ead('0x45')],_0x0ead('0x1dd'),_0x1b6081,_0x0ead('0x1de'));_0x38203a[_0x0ead('0x5f')]=setInterval(function(){_0x27ae00['handlePredictive'](_0x38203a);loggerPredictiveCalls[_0x0ead('0x46')](_0x0ead('0x1df'),_0xe3583f+=0x1);},_0x1b6081);}else{loggerPredictive[_0x0ead('0x46')](_0x38203a[_0x0ead('0x45')],_0x0ead('0x1e0'));}};};Dialer[_0x0ead('0x1a')]['checkContactBlack']=function(_0x2860ad,_0xb1f38f){var _0x3b51a7=this;return function(_0x193232){if(_[_0x0ead('0x77')](_0x193232)){if(_[_0x0ead('0xf1')](_0xb1f38f[_0x0ead('0x15b')])||!_0xb1f38f[_0x0ead('0x1e1')]){if(_0x2860ad[_0x0ead('0xb1')]==='booked'){_0x2860ad['queueStatusComplete']=_[_0x0ead('0x51')](_0x2860ad[_0x0ead('0x70')])?!![]:_0x2860ad[_0x0ead('0x70')];var _0x35bd84=uuid['v4']();_0x3b51a7['actions'][_0x35bd84]=new Action(_0x2860ad,_0xb1f38f,_0x35bd84);loggerBooked[_0x0ead('0x46')]('[booked][checkContactBlack]',_0x35bd84,'queueStatusComplete:\x20',JSON['stringify'](_0x2860ad[_0x0ead('0x70')]),_0x0ead('0x1e2'),_0x2860ad[_0x0ead('0x45')]);if(_0x2860ad['queueStatusComplete']){_0x2860ad['queueStatusComplete']=![];_0x3b51a7[_0x0ead('0x2a')][_0x3b51a7[_0x0ead('0x24')][_0x35bd84]['queue']]=[];ami[_0x0ead('0x9d')]({'actionid':_0x35bd84,'action':_0x0ead('0x1e3'),'queue':_0x2860ad[_0x0ead('0x45')]})[_0x0ead('0x9c')](function(){_0x3b51a7[_0x0ead('0xbf')](_0x2860ad);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3b51a7[_0x0ead('0x24')][_0x35bd84]['ContactId'],'ListId':_0x3b51a7[_0x0ead('0x24')][_0x35bd84][_0x0ead('0xdc')],'VoiceQueueId':_0x3b51a7['actions'][_0x35bd84][_0x0ead('0xfb')]||undefined,'CampaignId':_0x3b51a7['actions'][_0x35bd84][_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1e4')));delete _0x3b51a7[_0x0ead('0x24')][_0x35bd84];});}else{loggerBooked[_0x0ead('0x46')]('[booked][checkContactBlack][else]',JSON[_0x0ead('0x72')](_0x2860ad[_0x0ead('0x70')]),_0x0ead('0x1e2'),_0x2860ad[_0x0ead('0x45')]);_0x3b51a7['updateOriginated'](_0x2860ad);hopperUtils[_0x0ead('0xd8')]({'active':![],'ContactId':_0x3b51a7[_0x0ead('0x24')][_0x35bd84]['ContactId'],'ListId':_0x3b51a7[_0x0ead('0x24')][_0x35bd84]['ListId'],'VoiceQueueId':_0x3b51a7[_0x0ead('0x24')][_0x35bd84][_0x0ead('0xfb')]||undefined,'CampaignId':_0x3b51a7['actions'][_0x35bd84][_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1e4')));delete _0x3b51a7[_0x0ead('0x24')][_0x35bd84];}}else{return _0x3b51a7[_0x0ead('0x160')](_0x2860ad,_0xb1f38f);}}else{if(utils['getSeconds'](undefined,_0xb1f38f['scheduledat'])<_0x2860ad[_0x0ead('0x1e5')]*0x3c){if(_0xb1f38f['Agent']&&!_0xb1f38f[_0x0ead('0x14b')][_0x0ead('0x1e6')]){_0x3b51a7[_0x0ead('0x102')][_0x0ead('0xf8')](_0xb1f38f['id'])[_0x0ead('0x1c')](function(){_0x3b51a7[_0x0ead('0xbf')](_0x2860ad);});}else{hopperUtils[_0x0ead('0x1e7')]({'active':![]},_0xb1f38f['id'],0x1)[_0x0ead('0x1c')](function(){_0x3b51a7[_0x0ead('0xbf')](_0x2860ad);});}}else{_0x2860ad['outboundReCallsDay']+=0x1;_0x3b51a7[_0x0ead('0xbf')](_0x2860ad);if(_0x2860ad['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb1f38f['ContactId'],'ListId':_0xb1f38f[_0x0ead('0xdc')],'VoiceQueueId':_0xb1f38f[_0x0ead('0xfb')]||undefined,'CampaignId':_0xb1f38f[_0x0ead('0xdd')]||undefined})[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x1e8')));hopperUtils[_0x0ead('0xc8')](createObjHistory(_0x2860ad,_0xb1f38f,utils['CAMPAIGN_STATUS'][_0x0ead('0x1e9')],0x17,'RecallInQueue'))[_0x0ead('0x9c')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3b51a7[_0x0ead('0x119')](createObjHistory(_0x2860ad,_0xb1f38f,utils[_0x0ead('0x65')]['RECALL_TIMEOUT'],0x16,_0x0ead('0x1ea')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2860ad[_0x0ead('0x1eb')]+=0x1;_0x3b51a7[_0x0ead('0x119')](createObjHistory(_0x2860ad,_0xb1f38f,utils[_0x0ead('0x65')][_0x0ead('0x1ec')],0xd,_0x0ead('0x1ed')),_0x0ead('0x1ee'),_0x0ead('0x1ef'));throw _0x0ead('0x1f0');}};};Dialer[_0x0ead('0x1a')][_0x0ead('0x1f1')]=function(_0x47f46e){var _0x1f496a=this;var _0x133bd2=_0x47f46e[_0x0ead('0x1f2')]-_0x47f46e['originated'];emitCampaignSummary(_0x47f46e);if(_0x133bd2>0x0&&_0x47f46e['temp']==0x0){if(_0x133bd2>this['maxNumberOriginate']){_0x133bd2=this[_0x0ead('0x22')];}_0x47f46e[_0x0ead('0x64')]=0x1;hopperUtils['getContactDialerIvr'](_0x47f46e,_0x133bd2)[_0x0ead('0x9a')](function(_0x246c79){_0x47f46e['temp']=0x0;if(_0x246c79){if(!utils[_0x0ead('0x1f3')](_0x246c79)){_0x47f46e[_0x0ead('0x6c')]=utils['CAMPAIGN_STATUS'][_0x0ead('0x6a')];logger[_0x0ead('0x46')]('[getContactCampaign2][Empty]'+_0x47f46e[_0x0ead('0x45')]);}else{_0x47f46e[_0x0ead('0x156')]+=_0x246c79[_0x0ead('0x94')];_0x47f46e['message']=utils['CAMPAIGN_STATUS'][_0x0ead('0x1f4')];for(var _0x12b9ac=0x0;_0x12b9ac<_0x246c79[_0x0ead('0x94')];_0x12b9ac+=0x1){_0x47f46e[_0x0ead('0x1f5')]+=0x1;if(_[_0x0ead('0xf1')](_0x246c79[_0x12b9ac])||_[_0x0ead('0xf1')](_0x246c79[_0x12b9ac][_0x0ead('0x1f6')])||_[_0x0ead('0xf1')](_0x246c79[_0x12b9ac][_0x0ead('0x164')])){_0x1f496a[_0x0ead('0x1f7')](_0x0ead('0x1f8'),_0x47f46e,_0x246c79[_0x12b9ac]);}else{hopperUtils[_0x0ead('0x1f9')](_[_0x0ead('0xf6')](_0x246c79[_0x12b9ac],[_0x0ead('0xdd'),_0x0ead('0x164')]))[_0x0ead('0x9a')](_0x1f496a[_0x0ead('0x1fa')](_0x47f46e,_0x246c79[_0x12b9ac]))[_0x0ead('0x9c')](_0x1f496a[_0x0ead('0x159')](_0x0ead('0x1fb'),_0x47f46e));}}}}})[_0x0ead('0x9c')](loggerGetContactDialer(_0x0ead('0x1fc'),_0x47f46e,_0x133bd2));}};Dialer[_0x0ead('0x1a')][_0x0ead('0xb2')]=function(_0x1f3e57,_0x42ebc1){var _0x9f1a4=this;var _0x175be6=[];if(_0x42ebc1<0x1||_0x1f3e57[_0x0ead('0xb1')]==='booked'){_0x42ebc1=0x1;}var _0x40166a=Math[_0x0ead('0x1fd')](_0x1f3e57[_0x0ead('0x13b')]*_0x42ebc1)-_0x1f3e57['originated'];if(_0x1f3e57[_0x0ead('0x1fe')]>0x0){var _0x328e96=_0x1f3e57['dialLimitQueue']-_0x1f3e57[_0x0ead('0x156')]-_0x1f3e57[_0x0ead('0x13d')]-_0x1f3e57[_0x0ead('0x13e')];if(_0x40166a>_0x328e96){_0x40166a=_0x328e96;}}if(_0x40166a>0x0&&_0x1f3e57[_0x0ead('0x64')]==0x0){if(_0x1f3e57[_0x0ead('0xb1')]==='booked'){_0x40166a=0x1;}if(_0x40166a>this[_0x0ead('0x22')]){_0x40166a=this[_0x0ead('0x22')];}for(var _0x4a18c0 in this[_0x0ead('0x20')]){if(typeof this[_0x0ead('0x20')][_0x4a18c0]!==_0x0ead('0xa8')){if(this['agents'][_0x4a18c0][_0x0ead('0x6d')]===_0x0ead('0x1ff')&&this[_0x0ead('0x20')][_0x4a18c0][_0x0ead('0x86')]==='reachable'){_0x175be6[_0x0ead('0x95')](this[_0x0ead('0x20')][_0x4a18c0]['id']);}}}_0x1f3e57[_0x0ead('0x64')]=0x1;hopperUtils[_0x0ead('0x200')](_0x1f3e57,_0x175be6,_0x40166a)[_0x0ead('0x9a')](function(_0xe4902f){_0x1f3e57[_0x0ead('0x64')]=0x0;if(_0xe4902f){if(!utils[_0x0ead('0x1f3')](_0xe4902f)){hopperUtils[_0x0ead('0x201')](_0x1f3e57)['then'](sendMessageReschedule(_0x1f3e57))[_0x0ead('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x1f3e57[_0x0ead('0x156')]+=_0xe4902f[_0x0ead('0x94')];_0x1f3e57['message']=_0x1f3e57[_0x0ead('0xb1')]===_0x0ead('0x202')?utils[_0x0ead('0x65')][_0x0ead('0x13f')]:utils[_0x0ead('0x65')][_0x0ead('0x1f4')];for(var _0x3d3ad9=0x0;_0x3d3ad9<_0xe4902f[_0x0ead('0x94')];_0x3d3ad9+=0x1){if(_['isNil'](_0xe4902f[_0x3d3ad9])||_['isNil'](_0xe4902f[_0x3d3ad9]['Contact'])||_[_0x0ead('0xf1')](_0xe4902f[_0x3d3ad9]['phone'])){_0x9f1a4[_0x0ead('0x1f7')](_0x0ead('0x1f8'),_0x1f3e57,_0xe4902f[_0x3d3ad9]);}else{hopperUtils[_0x0ead('0x203')](_[_0x0ead('0xf6')](_0xe4902f[_0x3d3ad9],[_0x0ead('0xfb'),_0x0ead('0x164')]))['then'](_0x9f1a4[_0x0ead('0x1fa')](_0x1f3e57,_0xe4902f[_0x3d3ad9]))[_0x0ead('0x9c')](_0x9f1a4[_0x0ead('0x159')](_0x0ead('0x1f8'),_0x1f3e57));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x1f3e57,_0x40166a));}};Dialer['prototype']['handlePredictive']=function(_0x6d6e8b){if(_0x6d6e8b[_0x0ead('0x1fe')]>0x0){var _0x5ba1ab=_0x6d6e8b[_0x0ead('0x1fe')]-_0x6d6e8b[_0x0ead('0x156')]-_0x6d6e8b[_0x0ead('0x13d')];if(_0x5ba1ab>0x0&&_0x6d6e8b['temp']==0x0){this[_0x0ead('0x204')](_0x6d6e8b);}else{loggerPredictiveCalls['info'](_0x0ead('0x205'));}}else{this[_0x0ead('0x204')](_0x6d6e8b);}};Dialer[_0x0ead('0x1a')][_0x0ead('0x204')]=function(_0x586ef5){var _0x42b906=this;var _0x18bc4=[];_0x586ef5[_0x0ead('0x156')]+=0x1;for(var _0x18c740 in this[_0x0ead('0x20')]){if(typeof this[_0x0ead('0x20')][_0x18c740]!==_0x0ead('0xa8')){if(this[_0x0ead('0x20')][_0x18c740][_0x0ead('0x6d')]===_0x0ead('0x1ff')&&this['agents'][_0x18c740][_0x0ead('0x86')]==='reachable'){_0x18bc4[_0x0ead('0x95')](this[_0x0ead('0x20')][_0x18c740]['id']);}}}_0x586ef5[_0x0ead('0x64')]=0x1;return this[_0x0ead('0x200')](_0x586ef5['id'],_0x18bc4,0x1,_0x586ef5[_0x0ead('0x206')],_0x586ef5)[_0x0ead('0x9a')](function(_0x4f2d9d){_0x586ef5['temp']=0x1;if(_0x4f2d9d){if(!utils[_0x0ead('0x1f3')](_0x4f2d9d)){utils['checkContactLowerLimitOriginate'](_0x586ef5,0x1,0x0);return hopperUtils[_0x0ead('0x201')](_0x586ef5)[_0x0ead('0x9a')](sendMessageReschedule(_0x586ef5))[_0x0ead('0x9c')](loggerCatch(_0x0ead('0x207')));}else{_0x586ef5['message']=utils['CAMPAIGN_STATUS'][_0x0ead('0x1f4')];if(_['isNil'](_0x4f2d9d[0x0])||_[_0x0ead('0xf1')](_0x4f2d9d[0x0][_0x0ead('0x1f6')])||_['isNil'](_0x4f2d9d[0x0][_0x0ead('0x164')])){_0x42b906[_0x0ead('0x1f7')]('[actionOriginate]\x20',_0x586ef5,_0x4f2d9d[0x0]);}else{return hopperUtils[_0x0ead('0x203')](_[_0x0ead('0xf6')](_0x4f2d9d[0x0],[_0x0ead('0xfb'),_0x0ead('0x164')]))[_0x0ead('0x9a')](_0x42b906[_0x0ead('0x1fa')](_0x586ef5,_0x4f2d9d[0x0]))[_0x0ead('0x9c')](_0x42b906[_0x0ead('0x159')](_0x0ead('0x208'),_0x586ef5));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x586ef5,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x4d9745,_0x540de5,_0x29ae8d,_0x3dc003,_0x3c0355,_0x49d476){loggerPredictive[_0x0ead('0x46')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0ead('0x46')](_0x0ead('0x209'),_0x4d9745);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20a'),_0x540de5);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20b'),_0x29ae8d);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20c'),_0x3dc003);loggerPredictive[_0x0ead('0x46')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c0355);loggerPredictive['info'](_0x0ead('0x50'));return new Promise(function(_0x31eb8a,_0x2c2b3a){if(_0x4d9745<=0x0||isNaN(_0x4d9745)){return _0x2c2b3a(msgResponse(_0x0ead('0x20d'),_0x0ead('0x82'),_0x0ead('0x20e')+_0x4d9745));}if(_0x29ae8d<=0x0||isNaN(_0x29ae8d)){return _0x2c2b3a(msgResponse(_0x0ead('0x20d'),'Error','Ts\x20=\x20'+_0x29ae8d));}if(_0x3dc003<=0x0||isNaN(_0x3dc003)){return _0x2c2b3a(msgResponse(_0x0ead('0x20d'),'Error',_0x0ead('0x20f')+_0x3dc003));}if(_0x540de5<=0x0||isNaN(_0x540de5)){return _0x2c2b3a(msgResponse(_0x0ead('0x20d'),_0x0ead('0x82'),_0x0ead('0x210')+_0x540de5));}if(_0x3c0355<=0x0||isNaN(_0x3c0355)){return _0x2c2b3a(msgResponse(_0x0ead('0x20d'),_0x0ead('0x82'),_0x0ead('0x211')+_0x3c0355));}_0x49d476=_0x49d476||0x0;var _0x3a29dd=0x1/_0x29ae8d;var _0xc6a6f9=0x0;var _0x1df1fd=0x0;var _0x3dbf34=0x0;var _0x5b364e=0x0;for(var _0x223f4e=0x0;_0x3dbf34<_0x3c0355;_0x223f4e+=0x1){_0x1df1fd=_0x223f4e/_0x540de5;_0xc6a6f9=(_0x3dc003*_0x1df1fd+_0x49d476)/_0x3a29dd;_0x3dbf34=utils[_0x0ead('0x212')](_0xc6a6f9,_0x4d9745);_0x5b364e=_0xc6a6f9/_0x4d9745*(0x1-utils[_0x0ead('0x212')](_0xc6a6f9,_0x4d9745));}return _0x31eb8a({'erlangCalls':_0x223f4e,'erlangCallToSecond':_0x540de5/_0x223f4e,'erlangAbandonmentRate':_0x3dbf34,'erlangBusyFactor':_0x5b364e});});};Dialer['prototype'][_0x0ead('0x1d6')]=function(_0x5a5310,_0x55e78b,_0xe0bf2c,_0x5b35a0,_0x190cad,_0x133fed){loggerPredictive[_0x0ead('0x46')]('----\x20Agent\x20Busy\x20Factor\x20----');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',_0x5a5310);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20a'),_0x55e78b);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20b'),_0xe0bf2c);loggerPredictive[_0x0ead('0x46')](_0x0ead('0x20c'),_0x5b35a0);loggerPredictive['info'](_0x0ead('0x213'),_0x190cad);loggerPredictive['info'](_0x0ead('0x50'));return new Promise(function(_0x249157,_0x133bce){if(_0x5a5310<=0x0||isNaN(_0x5a5310)){return _0x133bce(msgResponse('[busyFactor]',_0x0ead('0x82'),_0x0ead('0x20e')+_0x5a5310));}if(_0xe0bf2c<=0x0||isNaN(_0xe0bf2c)){return _0x133bce(msgResponse(_0x0ead('0x214'),_0x0ead('0x82'),_0x0ead('0x215')+_0xe0bf2c));}if(_0x5b35a0<=0x0||isNaN(_0x5b35a0)){return _0x133bce(msgResponse('[busyFactor]',_0x0ead('0x82'),'p\x20=\x20'+_0x5b35a0));}if(_0x55e78b<=0x0||isNaN(_0x55e78b)){return _0x133bce(msgResponse('[busyFactor]',_0x0ead('0x82'),_0x0ead('0x210')+_0x55e78b));}if(_0x190cad<=0x0||isNaN(_0x190cad)){return _0x133bce(msgResponse(_0x0ead('0x214'),_0x0ead('0x82'),_0x0ead('0x216')+_0x190cad));}_0x133fed=_0x133fed||0x0;var _0x3c4ec6=0x1/_0xe0bf2c;var _0x2b0559=0x0;var _0x3b160b=0x0;var _0x1ed753=0x0;var _0xdc23f5=0x0;for(var _0x511847=0x0;_0xdc23f5<_0x190cad;_0x511847+=0x1){_0x3b160b=_0x511847/_0x55e78b;_0x2b0559=(_0x5b35a0*_0x3b160b+_0x133fed)/_0x3c4ec6;_0x1ed753=utils[_0x0ead('0x212')](_0x2b0559,_0x5a5310);_0xdc23f5=_0x2b0559/_0x5a5310*(0x1-utils['erlangb'](_0x2b0559,_0x5a5310));}return _0x249157({'erlangCalls':_0x511847,'erlangCallToSecond':_0x55e78b/_0x511847,'erlangAbandonmentRate':_0x1ed753,'erlangBusyFactor':_0xdc23f5});});};module['exports']=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 3d350f8..8072e0e 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 _0xe646=['Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','voiceQueue','substring','exports','util','lodash','moment','isNil','uniqueid','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe646,0xea));var _0x6e64=function(_0x214731,_0xc943bc){_0x214731=_0x214731-0x0;var _0x483791=_0xe646[_0x214731];return _0x483791;};'use strict';var util=require(_0x6e64('0x0'));var _=require(_0x6e64('0x1'));var moment=require(_0x6e64('0x2'));function checkNameSurname(_0x16a1c4,_0x55fc13,_0x507ad6){var _0x4ce7c5='';if(!_[_0x6e64('0x3')](_0x55fc13)&&'string'===typeof _0x55fc13){_0x4ce7c5+=_0x55fc13;}if(!_['isNil'](_0x507ad6)&&'string'===typeof _0x507ad6){_0x4ce7c5+='\x20'+_0x507ad6;}if(_0x4ce7c5!==''){return _0x4ce7c5;}return _0x16a1c4;}function Action(_0x2940bb,_0x598ec7,_0x2a03e5){this['voiceQueue']=_0x2940bb;this[_0x6e64('0x4')]=_0x2a03e5||undefined;this[_0x6e64('0x5')]=checkNameSurname(_0x598ec7[_0x6e64('0x6')][_0x6e64('0x7')],_0x598ec7['Contact'][_0x6e64('0x8')],_0x598ec7['Contact']['lastName']);this[_0x6e64('0x9')]=_0x598ec7['phone'];this[_0x6e64('0xa')]=_0x2940bb[_0x6e64('0x5')];this[_0x6e64('0xb')]=_0x598ec7['active']||![];this[_0x6e64('0xc')]=_0x2940bb[_0x6e64('0xc')];this[_0x6e64('0xd')]=_0x2940bb[_0x6e64('0xd')]||0x3;this[_0x6e64('0xe')]=_0x598ec7[_0x6e64('0xe')];this[_0x6e64('0xf')]=_0x598ec7[_0x6e64('0xf')];this['countcongestionretry']=_0x598ec7[_0x6e64('0x10')];this[_0x6e64('0x11')]=_0x598ec7['countnoanswerretry'];this[_0x6e64('0x12')]=_0x598ec7[_0x6e64('0x12')];this[_0x6e64('0x13')]=_0x598ec7[_0x6e64('0x13')];this[_0x6e64('0x14')]=_0x598ec7[_0x6e64('0x14')];this['countmachineretry']=_0x598ec7[_0x6e64('0x15')];this[_0x6e64('0x16')]=_0x598ec7[_0x6e64('0x16')];this[_0x6e64('0x17')]=_0x598ec7['ContactId'];this['ListId']=_0x598ec7[_0x6e64('0x18')];this['UserId']=_0x598ec7[_0x6e64('0x19')];this[_0x6e64('0x1a')]=_0x598ec7['VoiceQueueId'];this['CampaignId']=_0x598ec7[_0x6e64('0x1b')];this['idHopper']=_0x598ec7['id'];this[_0x6e64('0x1c')]=_0x598ec7['Contact']['firstName']||'';this['starttime']=moment()['format'](_0x6e64('0x1d'));this['callback']=_0x598ec7['callback'];this[_0x6e64('0x1e')]=_0x598ec7[_0x6e64('0x1e')];this[_0x6e64('0x1f')]=_0x598ec7[_0x6e64('0x1f')];this[_0x6e64('0x20')]=_0x598ec7[_0x6e64('0x20')];this['originatecalleridnum']='';this[_0x6e64('0x21')]='';}Action[_0x6e64('0x22')]['getCaller']=function(){return util[_0x6e64('0x23')](_0x6e64('0x24'),this[_0x6e64('0x5')],this[_0x6e64('0x25')]['dialCutDigit']>0x0?this['number'][_0x6e64('0x26')](this[_0x6e64('0x25')]['dialCutDigit']):this['number']);};Action[_0x6e64('0x22')]['getQueue']=function(){return this[_0x6e64('0xa')];};module[_0x6e64('0x27')]=Action; \ No newline at end of file +var _0x2787=['lodash','moment','isNil','string','voiceQueue','name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','dialCutDigit','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2787,0x185));var _0x7278=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2787[_0x432682];return _0x463d05;};'use strict';var util=require(_0x7278('0x0'));var _=require(_0x7278('0x1'));var moment=require(_0x7278('0x2'));function checkNameSurname(_0x6a250a,_0x1f802d,_0x2e6f53){var _0x2980a4='';if(!_[_0x7278('0x3')](_0x1f802d)&&_0x7278('0x4')===typeof _0x1f802d){_0x2980a4+=_0x1f802d;}if(!_[_0x7278('0x3')](_0x2e6f53)&&_0x7278('0x4')===typeof _0x2e6f53){_0x2980a4+='\x20'+_0x2e6f53;}if(_0x2980a4!==''){return _0x2980a4;}return _0x6a250a;}function Action(_0x2253a5,_0x3f8675,_0x553c2f){this[_0x7278('0x5')]=_0x2253a5;this['uniqueid']=_0x553c2f||undefined;this[_0x7278('0x6')]=checkNameSurname(_0x3f8675[_0x7278('0x7')][_0x7278('0x8')],_0x3f8675[_0x7278('0x7')]['firstName'],_0x3f8675['Contact']['lastName']);this[_0x7278('0x9')]=_0x3f8675[_0x7278('0x8')];this[_0x7278('0xa')]=_0x2253a5[_0x7278('0x6')];this[_0x7278('0xb')]=_0x3f8675[_0x7278('0xb')]||![];this[_0x7278('0xc')]=_0x2253a5[_0x7278('0xc')];this['dialQueueTimeout']=_0x2253a5[_0x7278('0xd')]||0x3;this[_0x7278('0xe')]=_0x3f8675[_0x7278('0xe')];this['countbusyretry']=_0x3f8675[_0x7278('0xf')];this[_0x7278('0x10')]=_0x3f8675[_0x7278('0x10')];this[_0x7278('0x11')]=_0x3f8675['countnoanswerretry'];this[_0x7278('0x12')]=_0x3f8675[_0x7278('0x12')];this[_0x7278('0x13')]=_0x3f8675[_0x7278('0x13')];this[_0x7278('0x14')]=_0x3f8675['countabandonedretry'];this[_0x7278('0x15')]=_0x3f8675[_0x7278('0x15')];this[_0x7278('0x16')]=_0x3f8675[_0x7278('0x16')];this[_0x7278('0x17')]=_0x3f8675[_0x7278('0x17')];this[_0x7278('0x18')]=_0x3f8675[_0x7278('0x18')];this[_0x7278('0x19')]=_0x3f8675['UserId'];this[_0x7278('0x1a')]=_0x3f8675[_0x7278('0x1a')];this[_0x7278('0x1b')]=_0x3f8675[_0x7278('0x1b')];this[_0x7278('0x1c')]=_0x3f8675['id'];this[_0x7278('0x1d')]=_0x3f8675['Contact']['firstName']||'';this['starttime']=moment()[_0x7278('0x1e')](_0x7278('0x1f'));this[_0x7278('0x20')]=_0x3f8675['callback'];this[_0x7278('0x21')]=_0x3f8675[_0x7278('0x21')];this['callbackat']=_0x3f8675[_0x7278('0x22')];this['recallme']=_0x3f8675[_0x7278('0x23')];this['originatecalleridnum']='';this[_0x7278('0x24')]='';}Action['prototype'][_0x7278('0x25')]=function(){return util[_0x7278('0x1e')]('\x22%s\x22\x20<%s>',this[_0x7278('0x6')],this[_0x7278('0x5')][_0x7278('0x26')]>0x0?this['number']['substring'](this[_0x7278('0x5')][_0x7278('0x26')]):this[_0x7278('0x9')]);};Action['prototype']['getQueue']=function(){return this[_0x7278('0xa')];};module['exports']=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 75a4577..82820eb 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 _0xde99=['countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x9c1134,_0x42cec6){var _0x2ec18c=function(_0x3adffc){while(--_0x3adffc){_0x9c1134['push'](_0x9c1134['shift']());}};_0x2ec18c(++_0x42cec6);}(_0xde99,0xfe));var _0x9de9=function(_0x2a2091,_0x5d6a29){_0x2a2091=_0x2a2091-0x0;var _0x284077=_0xde99[_0x2a2091];return _0x284077;};'use strict';var moment=require(_0x9de9('0x0'));var utils=require(_0x9de9('0x1'));function AgentComplete(_0x2a3fa8,_0x1b84b7){this[_0x9de9('0x2')]=0x4;this['statedesc']=_0x9de9('0x3');this[_0x9de9('0x4')]=_0x2a3fa8[_0x9de9('0x4')];this[_0x9de9('0x5')]=_0x2a3fa8[_0x9de9('0x5')];this['campaigntype']=_0x2a3fa8[_0x9de9('0x5')]===_0x9de9('0x6')?'queue':_0x2a3fa8[_0x9de9('0x5')];this[_0x9de9('0x7')]=_0x2a3fa8['countbusyretry'];this[_0x9de9('0x8')]=_0x2a3fa8[_0x9de9('0x8')];this[_0x9de9('0x9')]=_0x2a3fa8[_0x9de9('0x9')];this['countglobal']=_0x2a3fa8['countbusyretry']+_0x2a3fa8[_0x9de9('0x8')]+_0x2a3fa8[_0x9de9('0x9')]+_0x2a3fa8['countnosuchnumberretry']+_0x2a3fa8[_0x9de9('0xa')]+_0x2a3fa8[_0x9de9('0xb')]+_0x2a3fa8['countmachineretry']+_0x2a3fa8[_0x9de9('0xc')];this[_0x9de9('0xd')]=_0x2a3fa8[_0x9de9('0xd')];this[_0x9de9('0xa')]=_0x2a3fa8['countdropretry'];this[_0x9de9('0xb')]=_0x2a3fa8[_0x9de9('0xb')];this[_0x9de9('0xe')]=_0x2a3fa8[_0x9de9('0xe')];this[_0x9de9('0xc')]=_0x2a3fa8[_0x9de9('0xc')];this[_0x9de9('0xf')]=_0x1b84b7[_0x9de9('0xf')];this['calleridname']=_0x2a3fa8[_0x9de9('0x10')];this[_0x9de9('0x11')]=_0x2a3fa8[_0x9de9('0x12')];this[_0x9de9('0x13')]=_0x2a3fa8[_0x9de9('0x13')];this[_0x9de9('0x14')]=_0x2a3fa8['responsetime'];this['answertime']=_0x2a3fa8[_0x9de9('0x15')];this[_0x9de9('0x16')]=moment()[_0x9de9('0x17')](_0x9de9('0x18'));this['ringtime']=utils[_0x9de9('0x19')](_0x2a3fa8[_0x9de9('0x14')],_0x2a3fa8['starttime']);this[_0x9de9('0x1a')]=utils[_0x9de9('0x19')](_0x2a3fa8[_0x9de9('0x15')],_0x2a3fa8[_0x9de9('0x14')]);this[_0x9de9('0x1b')]=utils['getSeconds'](this[_0x9de9('0x16')],_0x2a3fa8[_0x9de9('0x15')]);this[_0x9de9('0x1c')]=_0x1b84b7[_0x9de9('0x1c')];this['membername']=_0x1b84b7[_0x9de9('0x1d')];this[_0x9de9('0x1e')]=_0x1b84b7[_0x9de9('0x1e')];this[_0x9de9('0x1f')]=_0x2a3fa8[_0x9de9('0x1f')];this['callbackuniqueid']=_0x2a3fa8[_0x9de9('0x20')];this[_0x9de9('0x21')]=_0x2a3fa8[_0x9de9('0x21')];this[_0x9de9('0x22')]=_0x2a3fa8['recallme'];this[_0x9de9('0x23')]=_0x2a3fa8['ContactId'];this[_0x9de9('0x24')]=_0x2a3fa8[_0x9de9('0x24')];this[_0x9de9('0x25')]=_0x2a3fa8['UserId'];this[_0x9de9('0x26')]=_0x2a3fa8[_0x9de9('0x26')];this['CampaignId']=_0x2a3fa8[_0x9de9('0x27')];this[_0x9de9('0x28')]=_0x2a3fa8[_0x9de9('0x28')]||'';this[_0x9de9('0x29')]=_0x2a3fa8['originatecalleridname']||'';this[_0x9de9('0x2a')]=_0x2a3fa8[_0x9de9('0x2a')];}module[_0x9de9('0x2b')]=AgentComplete; \ No newline at end of file +var _0xf994=['starttime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x5a558e,_0x2c0473){var _0x44eb26=function(_0x1841b4){while(--_0x1841b4){_0x5a558e['push'](_0x5a558e['shift']());}};_0x44eb26(++_0x2c0473);}(_0xf994,0x118));var _0x4f99=function(_0x170959,_0xc9903e){_0x170959=_0x170959-0x0;var _0x4691cd=_0xf994[_0x170959];return _0x4691cd;};'use strict';var moment=require(_0x4f99('0x0'));var utils=require(_0x4f99('0x1'));function AgentComplete(_0x242050,_0x2bb8ae){this[_0x4f99('0x2')]=0x4;this[_0x4f99('0x3')]='Answer';this[_0x4f99('0x4')]=_0x242050['scheduledat'];this['type']=_0x242050[_0x4f99('0x5')];this[_0x4f99('0x6')]=_0x242050[_0x4f99('0x5')]===_0x4f99('0x7')?_0x4f99('0x8'):_0x242050[_0x4f99('0x5')];this[_0x4f99('0x9')]=_0x242050[_0x4f99('0x9')];this[_0x4f99('0xa')]=_0x242050[_0x4f99('0xa')];this[_0x4f99('0xb')]=_0x242050[_0x4f99('0xb')];this[_0x4f99('0xc')]=_0x242050[_0x4f99('0x9')]+_0x242050[_0x4f99('0xa')]+_0x242050[_0x4f99('0xb')]+_0x242050[_0x4f99('0xd')]+_0x242050[_0x4f99('0xe')]+_0x242050['countabandonedretry']+_0x242050[_0x4f99('0xf')]+_0x242050[_0x4f99('0x10')];this[_0x4f99('0xd')]=_0x242050[_0x4f99('0xd')];this[_0x4f99('0xe')]=_0x242050[_0x4f99('0xe')];this[_0x4f99('0x11')]=_0x242050['countabandonedretry'];this[_0x4f99('0xf')]=_0x242050[_0x4f99('0xf')];this[_0x4f99('0x10')]=_0x242050[_0x4f99('0x10')];this[_0x4f99('0x12')]=_0x2bb8ae[_0x4f99('0x12')];this[_0x4f99('0x13')]=_0x242050[_0x4f99('0x14')];this[_0x4f99('0x15')]=_0x242050[_0x4f99('0x16')];this['starttime']=_0x242050['starttime'];this[_0x4f99('0x17')]=_0x242050[_0x4f99('0x17')];this['answertime']=_0x242050[_0x4f99('0x18')];this[_0x4f99('0x19')]=moment()['format'](_0x4f99('0x1a'));this[_0x4f99('0x1b')]=utils['getSeconds'](_0x242050[_0x4f99('0x17')],_0x242050[_0x4f99('0x1c')]);this['holdtime']=utils[_0x4f99('0x1d')](_0x242050[_0x4f99('0x18')],_0x242050[_0x4f99('0x17')]);this[_0x4f99('0x1e')]=utils[_0x4f99('0x1d')](this[_0x4f99('0x19')],_0x242050['answertime']);this['queue']=_0x2bb8ae[_0x4f99('0x8')];this[_0x4f99('0x1f')]=_0x2bb8ae['membername'];this[_0x4f99('0x20')]=_0x2bb8ae[_0x4f99('0x20')];this['callback']=_0x242050[_0x4f99('0x21')];this['callbackuniqueid']=_0x242050[_0x4f99('0x22')];this[_0x4f99('0x23')]=_0x242050['callbackat'];this[_0x4f99('0x24')]=_0x242050[_0x4f99('0x24')];this[_0x4f99('0x25')]=_0x242050[_0x4f99('0x25')];this[_0x4f99('0x26')]=_0x242050['ListId'];this['UserId']=_0x242050['UserId'];this[_0x4f99('0x27')]=_0x242050[_0x4f99('0x27')];this[_0x4f99('0x28')]=_0x242050[_0x4f99('0x28')];this[_0x4f99('0x29')]=_0x242050['originatecalleridnum']||'';this[_0x4f99('0x2a')]=_0x242050[_0x4f99('0x2a')]||'';this['agiafterat']=_0x242050['agiafterat'];}module[_0x4f99('0x2b')]=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 976bf3f..8f1bde6 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 _0xb6b8=['countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry'];(function(_0x548898,_0x445b05){var _0x3d6768=function(_0x27ac59){while(--_0x27ac59){_0x548898['push'](_0x548898['shift']());}};_0x3d6768(++_0x445b05);}(_0xb6b8,0x153));var _0x8b6b=function(_0x65b9bd,_0x105cb0){_0x65b9bd=_0x65b9bd-0x0;var _0x2e0ec7=_0xb6b8[_0x65b9bd];return _0x2e0ec7;};'use strict';function Final(_0x47c09a){this['uniqueid']=_0x47c09a['uniqueid'];this['scheduledat']=_0x47c09a[_0x8b6b('0x0')];this['type']=_0x47c09a[_0x8b6b('0x1')];this[_0x8b6b('0x2')]=_0x47c09a[_0x8b6b('0x1')]===_0x8b6b('0x3')?_0x8b6b('0x4'):_0x47c09a[_0x8b6b('0x1')];this['countbusyretry']=_0x47c09a[_0x8b6b('0x5')];this['countcongestionretry']=_0x47c09a['countcongestionretry'];this[_0x8b6b('0x6')]=_0x47c09a[_0x8b6b('0x6')];this[_0x8b6b('0x7')]=_0x47c09a[_0x8b6b('0x5')]+_0x47c09a[_0x8b6b('0x8')]+_0x47c09a['countnoanswerretry']+_0x47c09a[_0x8b6b('0x9')]+_0x47c09a['countdropretry']+_0x47c09a[_0x8b6b('0xa')]+_0x47c09a[_0x8b6b('0xb')]+_0x47c09a['countagentrejectretry'];this[_0x8b6b('0x9')]=_0x47c09a[_0x8b6b('0x9')];this[_0x8b6b('0xc')]=_0x47c09a[_0x8b6b('0xc')];this['countabandonedretry']=_0x47c09a[_0x8b6b('0xa')];this[_0x8b6b('0xb')]=_0x47c09a[_0x8b6b('0xb')];this['countagentrejectretry']=_0x47c09a[_0x8b6b('0xd')];this[_0x8b6b('0x4')]=_0x47c09a[_0x8b6b('0x4')];this['calleridname']=_0x47c09a[_0x8b6b('0xe')];this[_0x8b6b('0xf')]=_0x47c09a['calleridnum'];this[_0x8b6b('0x10')]=_0x47c09a[_0x8b6b('0x10')];this['responsetime']=_0x47c09a[_0x8b6b('0x11')];this[_0x8b6b('0x12')]=_0x47c09a[_0x8b6b('0x11')];this[_0x8b6b('0x13')]=_0x47c09a[_0x8b6b('0x13')]||0x0;this[_0x8b6b('0x14')]=_0x47c09a[_0x8b6b('0x14')]||0x0;this['talktime']=_0x47c09a[_0x8b6b('0x15')]||0x0;this[_0x8b6b('0x16')]=_0x47c09a[_0x8b6b('0x16')];this[_0x8b6b('0x17')]=_0x47c09a[_0x8b6b('0x17')];this[_0x8b6b('0x18')]=_0x47c09a['callbackat'];this[_0x8b6b('0x19')]=_0x47c09a[_0x8b6b('0x19')];this[_0x8b6b('0x1a')]=_0x47c09a[_0x8b6b('0x1a')];this['ListId']=_0x47c09a['ListId'];this[_0x8b6b('0x1b')]=_0x47c09a[_0x8b6b('0x1b')];this['VoiceQueueId']=_0x47c09a[_0x8b6b('0x1c')];this[_0x8b6b('0x1d')]=_0x47c09a[_0x8b6b('0x1d')];this['originatecalleridnum']=_0x47c09a[_0x8b6b('0x1e')]||'';this[_0x8b6b('0x1f')]=_0x47c09a[_0x8b6b('0x1f')]||'';this[_0x8b6b('0x20')]=_0x47c09a[_0x8b6b('0x20')];this[_0x8b6b('0x21')]=_0x47c09a[_0x8b6b('0x21')];}module[_0x8b6b('0x22')]=Final; \ No newline at end of file +var _0xe219=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime'];(function(_0x2b7582,_0x520e2e){var _0x301470=function(_0x448299){while(--_0x448299){_0x2b7582['push'](_0x2b7582['shift']());}};_0x301470(++_0x520e2e);}(_0xe219,0xd5));var _0x9e21=function(_0x131ce,_0x540f85){_0x131ce=_0x131ce-0x0;var _0x56a158=_0xe219[_0x131ce];return _0x56a158;};'use strict';function Final(_0x3cc8ba){this[_0x9e21('0x0')]=_0x3cc8ba[_0x9e21('0x0')];this[_0x9e21('0x1')]=_0x3cc8ba[_0x9e21('0x1')];this[_0x9e21('0x2')]=_0x3cc8ba[_0x9e21('0x2')];this[_0x9e21('0x3')]=_0x3cc8ba[_0x9e21('0x2')]==='outbound'?_0x9e21('0x4'):_0x3cc8ba[_0x9e21('0x2')];this['countbusyretry']=_0x3cc8ba[_0x9e21('0x5')];this['countcongestionretry']=_0x3cc8ba['countcongestionretry'];this[_0x9e21('0x6')]=_0x3cc8ba[_0x9e21('0x6')];this['countglobal']=_0x3cc8ba[_0x9e21('0x5')]+_0x3cc8ba[_0x9e21('0x7')]+_0x3cc8ba[_0x9e21('0x6')]+_0x3cc8ba[_0x9e21('0x8')]+_0x3cc8ba[_0x9e21('0x9')]+_0x3cc8ba[_0x9e21('0xa')]+_0x3cc8ba[_0x9e21('0xb')]+_0x3cc8ba[_0x9e21('0xc')];this[_0x9e21('0x8')]=_0x3cc8ba[_0x9e21('0x8')];this[_0x9e21('0x9')]=_0x3cc8ba[_0x9e21('0x9')];this[_0x9e21('0xa')]=_0x3cc8ba[_0x9e21('0xa')];this[_0x9e21('0xb')]=_0x3cc8ba['countmachineretry'];this[_0x9e21('0xc')]=_0x3cc8ba['countagentrejectretry'];this[_0x9e21('0x4')]=_0x3cc8ba[_0x9e21('0x4')];this[_0x9e21('0xd')]=_0x3cc8ba[_0x9e21('0xd')];this[_0x9e21('0xe')]=_0x3cc8ba[_0x9e21('0xe')];this[_0x9e21('0xf')]=_0x3cc8ba[_0x9e21('0xf')];this[_0x9e21('0x10')]=_0x3cc8ba[_0x9e21('0x10')];this['endtime']=_0x3cc8ba['responsetime'];this[_0x9e21('0x11')]=_0x3cc8ba[_0x9e21('0x11')]||0x0;this[_0x9e21('0x12')]=_0x3cc8ba[_0x9e21('0x12')]||0x0;this[_0x9e21('0x13')]=_0x3cc8ba['talktime']||0x0;this['callback']=_0x3cc8ba[_0x9e21('0x14')];this[_0x9e21('0x15')]=_0x3cc8ba['callbackuniqueid'];this[_0x9e21('0x16')]=_0x3cc8ba[_0x9e21('0x16')];this[_0x9e21('0x17')]=_0x3cc8ba[_0x9e21('0x17')];this['ContactId']=_0x3cc8ba[_0x9e21('0x18')];this[_0x9e21('0x19')]=_0x3cc8ba[_0x9e21('0x19')];this['UserId']=_0x3cc8ba['UserId'];this[_0x9e21('0x1a')]=_0x3cc8ba['VoiceQueueId'];this[_0x9e21('0x1b')]=_0x3cc8ba[_0x9e21('0x1b')];this[_0x9e21('0x1c')]=_0x3cc8ba[_0x9e21('0x1c')]||'';this[_0x9e21('0x1d')]=_0x3cc8ba[_0x9e21('0x1d')]||'';this[_0x9e21('0x1e')]=_0x3cc8ba[_0x9e21('0x1e')];this['statedesc']=_0x3cc8ba[_0x9e21('0x1f')];}module[_0x9e21('0x20')]=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 e0b9f54..d513b3e 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 _0xa1d3=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','IVR','cause-txt'];(function(_0x3ab5e1,_0xdb9572){var _0xd640f2=function(_0x3b14d2){while(--_0x3b14d2){_0x3ab5e1['push'](_0x3ab5e1['shift']());}};_0xd640f2(++_0xdb9572);}(_0xa1d3,0x129));var _0x3a1d=function(_0xb60643,_0x5a28f0){_0xb60643=_0xb60643-0x0;var _0x2375d3=_0xa1d3[_0xb60643];return _0x2375d3;};'use strict';var moment=require(_0x3a1d('0x0'));var utils=require(_0x3a1d('0x1'));function Hangup(_0x40d830,_0x151289){this['state']=0x4;this[_0x3a1d('0x2')]=_0x3a1d('0x3');this['scheduledat']=_0x40d830[_0x3a1d('0x4')];this[_0x3a1d('0x5')]=_0x40d830['type'];this['campaigntype']=_0x40d830[_0x3a1d('0x5')]===_0x3a1d('0x6')?_0x3a1d('0x7'):_0x40d830['type'];this[_0x3a1d('0x8')]=_0x40d830[_0x3a1d('0x8')]||![];this['countbusyretry']=_0x40d830[_0x3a1d('0x9')];this['countcongestionretry']=_0x40d830[_0x3a1d('0xa')];this['countnoanswerretry']=_0x40d830[_0x3a1d('0xb')];this['countglobal']=_0x40d830[_0x3a1d('0x9')]+_0x40d830['countcongestionretry']+_0x40d830['countnoanswerretry']+_0x40d830[_0x3a1d('0xc')]+_0x40d830[_0x3a1d('0xd')]+_0x40d830[_0x3a1d('0xe')]+_0x40d830['countmachineretry']+_0x40d830[_0x3a1d('0xf')];this['countnosuchnumberretry']=_0x40d830[_0x3a1d('0xc')];this['countdropretry']=_0x40d830[_0x3a1d('0xd')];this['countabandonedretry']=_0x40d830[_0x3a1d('0xe')];this[_0x3a1d('0x10')]=_0x40d830[_0x3a1d('0x10')];this['countagentrejectretry']=_0x40d830[_0x3a1d('0xf')];this['uniqueid']=_0x151289['uniqueid'];this[_0x3a1d('0x11')]=_0x40d830[_0x3a1d('0x12')];this[_0x3a1d('0x13')]=_0x40d830[_0x3a1d('0x14')];this['starttime']=_0x40d830['starttime'];this[_0x3a1d('0x15')]=_0x40d830['responsetime'];this['endtime']=moment()['format'](_0x3a1d('0x16'));this[_0x3a1d('0x17')]=utils[_0x3a1d('0x18')](_0x40d830[_0x3a1d('0x15')],_0x40d830['starttime']);this[_0x3a1d('0x19')]=0x0;this[_0x3a1d('0x1a')]=utils['getSeconds'](this[_0x3a1d('0x1b')],_0x40d830[_0x3a1d('0x15')]);this[_0x3a1d('0x7')]=_0x40d830[_0x3a1d('0x7')];this[_0x3a1d('0x1c')]=_0x3a1d('0x1d');this['reason']=_0x151289[_0x3a1d('0x1e')];this['callback']=_0x40d830[_0x3a1d('0x1f')];this[_0x3a1d('0x20')]=_0x40d830[_0x3a1d('0x20')];this[_0x3a1d('0x21')]=_0x40d830[_0x3a1d('0x21')];this[_0x3a1d('0x22')]=_0x40d830[_0x3a1d('0x22')];this['ContactId']=_0x40d830[_0x3a1d('0x23')];this[_0x3a1d('0x24')]=_0x40d830[_0x3a1d('0x24')];this[_0x3a1d('0x25')]=_0x40d830[_0x3a1d('0x25')];this[_0x3a1d('0x26')]=_0x40d830['VoiceQueueId'];this[_0x3a1d('0x27')]=_0x40d830[_0x3a1d('0x27')];}module[_0x3a1d('0x28')]=Hangup; \ No newline at end of file +var _0xffa9=['YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','callback','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xffa9,0x16c));var _0x9ffa=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0xffa9[_0x4e82ff];return _0x495205;};'use strict';var moment=require('moment');var utils=require(_0x9ffa('0x0'));function Hangup(_0x306f34,_0x13d5b9){this[_0x9ffa('0x1')]=0x4;this['statedesc']=_0x9ffa('0x2');this['scheduledat']=_0x306f34[_0x9ffa('0x3')];this[_0x9ffa('0x4')]=_0x306f34['type'];this[_0x9ffa('0x5')]=_0x306f34[_0x9ffa('0x4')]===_0x9ffa('0x6')?_0x9ffa('0x7'):_0x306f34['type'];this[_0x9ffa('0x8')]=_0x306f34['amd']||![];this['countbusyretry']=_0x306f34[_0x9ffa('0x9')];this[_0x9ffa('0xa')]=_0x306f34[_0x9ffa('0xa')];this['countnoanswerretry']=_0x306f34[_0x9ffa('0xb')];this[_0x9ffa('0xc')]=_0x306f34['countbusyretry']+_0x306f34[_0x9ffa('0xa')]+_0x306f34['countnoanswerretry']+_0x306f34[_0x9ffa('0xd')]+_0x306f34[_0x9ffa('0xe')]+_0x306f34[_0x9ffa('0xf')]+_0x306f34['countmachineretry']+_0x306f34[_0x9ffa('0x10')];this[_0x9ffa('0xd')]=_0x306f34[_0x9ffa('0xd')];this[_0x9ffa('0xe')]=_0x306f34['countdropretry'];this[_0x9ffa('0xf')]=_0x306f34[_0x9ffa('0xf')];this[_0x9ffa('0x11')]=_0x306f34[_0x9ffa('0x11')];this[_0x9ffa('0x10')]=_0x306f34[_0x9ffa('0x10')];this[_0x9ffa('0x12')]=_0x13d5b9[_0x9ffa('0x12')];this['calleridname']=_0x306f34[_0x9ffa('0x13')];this[_0x9ffa('0x14')]=_0x306f34[_0x9ffa('0x15')];this[_0x9ffa('0x16')]=_0x306f34[_0x9ffa('0x16')];this[_0x9ffa('0x17')]=_0x306f34[_0x9ffa('0x17')];this[_0x9ffa('0x18')]=moment()[_0x9ffa('0x19')](_0x9ffa('0x1a'));this['ringtime']=utils[_0x9ffa('0x1b')](_0x306f34[_0x9ffa('0x17')],_0x306f34[_0x9ffa('0x16')]);this[_0x9ffa('0x1c')]=0x0;this[_0x9ffa('0x1d')]=utils[_0x9ffa('0x1b')](this['endtime'],_0x306f34[_0x9ffa('0x17')]);this[_0x9ffa('0x7')]=_0x306f34[_0x9ffa('0x7')];this[_0x9ffa('0x1e')]='IVR';this['reason']=_0x13d5b9['cause-txt'];this['callback']=_0x306f34[_0x9ffa('0x1f')];this['callbackuniqueid']=_0x306f34['callbackuniqueid'];this[_0x9ffa('0x20')]=_0x306f34['callbackat'];this[_0x9ffa('0x21')]=_0x306f34[_0x9ffa('0x21')];this[_0x9ffa('0x22')]=_0x306f34['ContactId'];this['ListId']=_0x306f34['ListId'];this[_0x9ffa('0x23')]=_0x306f34[_0x9ffa('0x23')];this['VoiceQueueId']=_0x306f34[_0x9ffa('0x24')];this[_0x9ffa('0x25')]=_0x306f34['CampaignId'];}module[_0x9ffa('0x26')]=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 dc55dcc..a524100 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 _0x3d45=['ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','name','number','starttime','responsetime','endtime'];(function(_0x2456c7,_0x8b97ac){var _0x904fd2=function(_0xc594c7){while(--_0xc594c7){_0x2456c7['push'](_0x2456c7['shift']());}};_0x904fd2(++_0x8b97ac);}(_0x3d45,0x7d));var _0x53d4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3d45[_0xbca1b1];return _0x4e1686;};'use strict';var utils=require(_0x53d4('0x0'));function History(_0x237a2b){this[_0x53d4('0x1')]=_0x237a2b['uniqueid'];this['scheduledat']=_0x237a2b[_0x53d4('0x2')]||undefined;this[_0x53d4('0x3')]=_0x237a2b[_0x53d4('0x3')];this['campaigntype']=_0x237a2b['type']==='outbound'?_0x53d4('0x4'):_0x237a2b['type'];this['countbusyretry']=_0x237a2b['countbusyretry'];this['countcongestionretry']=_0x237a2b[_0x53d4('0x5')];this[_0x53d4('0x6')]=_0x237a2b[_0x53d4('0x6')];this[_0x53d4('0x7')]=_0x237a2b[_0x53d4('0x8')]+_0x237a2b[_0x53d4('0x5')]+_0x237a2b[_0x53d4('0x6')]+_0x237a2b['countnosuchnumberretry']+_0x237a2b['countdropretry']+_0x237a2b[_0x53d4('0x9')]+_0x237a2b[_0x53d4('0xa')]+_0x237a2b[_0x53d4('0xb')];this[_0x53d4('0xc')]=_0x237a2b[_0x53d4('0xc')];this[_0x53d4('0xd')]=_0x237a2b['countdropretry'];this[_0x53d4('0x9')]=_0x237a2b[_0x53d4('0x9')];this['countmachineretry']=_0x237a2b[_0x53d4('0xa')];this[_0x53d4('0xb')]=_0x237a2b[_0x53d4('0xb')];this[_0x53d4('0x4')]=_0x237a2b[_0x53d4('0x4')];this['calleridname']=_0x237a2b[_0x53d4('0xe')];this['calleridnum']=_0x237a2b[_0x53d4('0xf')];this[_0x53d4('0x10')]=_0x237a2b[_0x53d4('0x10')];this[_0x53d4('0x11')]=_0x237a2b['responsetime'];this[_0x53d4('0x12')]=_0x237a2b[_0x53d4('0x11')];this[_0x53d4('0x13')]=utils[_0x53d4('0x14')](_0x237a2b[_0x53d4('0x11')],_0x237a2b[_0x53d4('0x10')]);this[_0x53d4('0x15')]=0x0;this[_0x53d4('0x16')]=0x0;this[_0x53d4('0x17')]=_0x237a2b[_0x53d4('0x17')];this[_0x53d4('0x18')]=_0x237a2b[_0x53d4('0x18')];this['callbackat']=_0x237a2b[_0x53d4('0x19')];this['recallme']=_0x237a2b[_0x53d4('0x1a')];this[_0x53d4('0x1b')]=_0x237a2b['ContactId'];this[_0x53d4('0x1c')]=_0x237a2b[_0x53d4('0x1c')];this[_0x53d4('0x1d')]=_0x237a2b['UserId'];this[_0x53d4('0x1e')]=_0x237a2b[_0x53d4('0x1e')];this[_0x53d4('0x1f')]=_0x237a2b[_0x53d4('0x1f')];this[_0x53d4('0x20')]=_0x237a2b['originatecalleridnum']||'';this['originatecalleridname']=_0x237a2b['originatecalleridname']||'';this[_0x53d4('0x21')]=_0x237a2b['state'];this[_0x53d4('0x22')]=_0x237a2b[_0x53d4('0x22')];}module[_0x53d4('0x23')]=History; \ No newline at end of file +var _0xc721=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xc721,0xa7));var _0x1c72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc721[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x1c72('0x0'));function History(_0xb0d99a){this[_0x1c72('0x1')]=_0xb0d99a[_0x1c72('0x1')];this[_0x1c72('0x2')]=_0xb0d99a[_0x1c72('0x2')]||undefined;this[_0x1c72('0x3')]=_0xb0d99a[_0x1c72('0x3')];this[_0x1c72('0x4')]=_0xb0d99a[_0x1c72('0x3')]===_0x1c72('0x5')?'queue':_0xb0d99a[_0x1c72('0x3')];this[_0x1c72('0x6')]=_0xb0d99a[_0x1c72('0x6')];this[_0x1c72('0x7')]=_0xb0d99a[_0x1c72('0x7')];this[_0x1c72('0x8')]=_0xb0d99a[_0x1c72('0x8')];this[_0x1c72('0x9')]=_0xb0d99a['countbusyretry']+_0xb0d99a['countcongestionretry']+_0xb0d99a[_0x1c72('0x8')]+_0xb0d99a['countnosuchnumberretry']+_0xb0d99a[_0x1c72('0xa')]+_0xb0d99a['countabandonedretry']+_0xb0d99a[_0x1c72('0xb')]+_0xb0d99a[_0x1c72('0xc')];this[_0x1c72('0xd')]=_0xb0d99a[_0x1c72('0xd')];this[_0x1c72('0xa')]=_0xb0d99a['countdropretry'];this[_0x1c72('0xe')]=_0xb0d99a[_0x1c72('0xe')];this[_0x1c72('0xb')]=_0xb0d99a[_0x1c72('0xb')];this[_0x1c72('0xc')]=_0xb0d99a['countagentrejectretry'];this[_0x1c72('0xf')]=_0xb0d99a[_0x1c72('0xf')];this['calleridname']=_0xb0d99a[_0x1c72('0x10')];this[_0x1c72('0x11')]=_0xb0d99a[_0x1c72('0x12')];this[_0x1c72('0x13')]=_0xb0d99a[_0x1c72('0x13')];this[_0x1c72('0x14')]=_0xb0d99a[_0x1c72('0x14')];this[_0x1c72('0x15')]=_0xb0d99a['responsetime'];this[_0x1c72('0x16')]=utils[_0x1c72('0x17')](_0xb0d99a[_0x1c72('0x14')],_0xb0d99a['starttime']);this[_0x1c72('0x18')]=0x0;this[_0x1c72('0x19')]=0x0;this[_0x1c72('0x1a')]=_0xb0d99a['callback'];this[_0x1c72('0x1b')]=_0xb0d99a[_0x1c72('0x1b')];this['callbackat']=_0xb0d99a[_0x1c72('0x1c')];this[_0x1c72('0x1d')]=_0xb0d99a[_0x1c72('0x1d')];this[_0x1c72('0x1e')]=_0xb0d99a[_0x1c72('0x1e')];this[_0x1c72('0x1f')]=_0xb0d99a[_0x1c72('0x1f')];this[_0x1c72('0x20')]=_0xb0d99a['UserId'];this[_0x1c72('0x21')]=_0xb0d99a[_0x1c72('0x21')];this[_0x1c72('0x22')]=_0xb0d99a[_0x1c72('0x22')];this[_0x1c72('0x23')]=_0xb0d99a['originatecalleridnum']||'';this[_0x1c72('0x24')]=_0xb0d99a['originatecalleridname']||'';this['state']=_0xb0d99a[_0x1c72('0x25')];this[_0x1c72('0x26')]=_0xb0d99a['statedesc'];}module[_0x1c72('0x27')]=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 6cd6a81..7598fca 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 _0x3202=['endtime','ringtime','starttime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','dropreason'];(function(_0x1efc3c,_0x55458f){var _0x5a5b7f=function(_0x269a38){while(--_0x269a38){_0x1efc3c['push'](_0x1efc3c['shift']());}};_0x5a5b7f(++_0x55458f);}(_0x3202,0x1b8));var _0x2320=function(_0x3ebb8f,_0x1a86e8){_0x3ebb8f=_0x3ebb8f-0x0;var _0x3a1c2e=_0x3202[_0x3ebb8f];return _0x3a1c2e;};'use strict';var utils=require(_0x2320('0x0'));function QueueCallerAbandon(_0xcafbc1,_0x1be715){this[_0x2320('0x1')]=_0xcafbc1[_0x2320('0x1')];this[_0x2320('0x2')]=_0xcafbc1[_0x2320('0x2')];this[_0x2320('0x3')]=_0xcafbc1[_0x2320('0x2')]===_0x2320('0x4')?_0x2320('0x5'):_0xcafbc1['type'];this[_0x2320('0x6')]=_0xcafbc1['countbusyretry'];this['countcongestionretry']=_0xcafbc1['countcongestionretry'];this[_0x2320('0x7')]=_0xcafbc1[_0x2320('0x7')];this[_0x2320('0x8')]=_0xcafbc1['countbusyretry']+_0xcafbc1['countcongestionretry']+_0xcafbc1['countnoanswerretry']+_0xcafbc1[_0x2320('0x9')]+_0xcafbc1[_0x2320('0xa')]+_0xcafbc1[_0x2320('0xb')]+_0xcafbc1[_0x2320('0xc')]+_0xcafbc1['countagentrejectretry'];this[_0x2320('0x9')]=_0xcafbc1[_0x2320('0x9')];this[_0x2320('0xa')]=_0xcafbc1[_0x2320('0xa')];this[_0x2320('0xb')]=_0xcafbc1[_0x2320('0xb')];this[_0x2320('0xc')]=_0xcafbc1[_0x2320('0xc')];this['countagentrejectretry']=_0xcafbc1[_0x2320('0xd')];this[_0x2320('0xe')]=_0x1be715[_0x2320('0xe')];this[_0x2320('0xf')]=_0xcafbc1[_0x2320('0x10')];this[_0x2320('0x11')]=_0xcafbc1[_0x2320('0x12')];this['starttime']=_0xcafbc1['starttime'];this[_0x2320('0x13')]=_0xcafbc1[_0x2320('0x13')];this[_0x2320('0x14')]=_0xcafbc1[_0x2320('0x14')];this[_0x2320('0x15')]=_0xcafbc1[_0x2320('0x15')];this[_0x2320('0x16')]=this[_0x2320('0x14')];this[_0x2320('0x17')]=utils['getSeconds'](_0xcafbc1[_0x2320('0x13')],_0xcafbc1[_0x2320('0x18')]);this[_0x2320('0x19')]=utils['getSeconds'](this[_0x2320('0x14')],_0xcafbc1[_0x2320('0x13')]);this['talktime']=0x0;this[_0x2320('0x5')]=_0x1be715[_0x2320('0x5')];this['membername']=_0x1be715['connectedlinename'];this['reason']=_0x1be715[_0x2320('0x1a')];this[_0x2320('0x1b')]=_0xcafbc1[_0x2320('0x1b')];this['callbackuniqueid']=_0xcafbc1[_0x2320('0x1c')];this[_0x2320('0x1d')]=_0xcafbc1[_0x2320('0x1d')];this['recallme']=_0xcafbc1[_0x2320('0x1e')];this[_0x2320('0x1f')]=_0xcafbc1[_0x2320('0x1f')];this[_0x2320('0x20')]=_0xcafbc1['ListId'];this[_0x2320('0x21')]=_0xcafbc1[_0x2320('0x21')];this[_0x2320('0x22')]=_0xcafbc1[_0x2320('0x22')];this[_0x2320('0x23')]=_0xcafbc1['CampaignId'];this['originatecalleridnum']=_0xcafbc1[_0x2320('0x24')]||'';this[_0x2320('0x25')]=_0xcafbc1['originatecalleridname']||'';this['agiafterat']=_0xcafbc1[_0x2320('0x26')];this[_0x2320('0x27')]=_0xcafbc1[_0x2320('0x27')];this[_0x2320('0x28')]=_0xcafbc1[_0x2320('0x28')];}module[_0x2320('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xc3c1=['countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2ceb9c,_0x99ff84){var _0x323824=function(_0x305905){while(--_0x305905){_0x2ceb9c['push'](_0x2ceb9c['shift']());}};_0x323824(++_0x99ff84);}(_0xc3c1,0x1ef));var _0x1c3c=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xc3c1[_0x31ced5];return _0x10d9e5;};'use strict';var utils=require(_0x1c3c('0x0'));function QueueCallerAbandon(_0x20b274,_0x4ed51c){this[_0x1c3c('0x1')]=_0x20b274['scheduledat'];this[_0x1c3c('0x2')]=_0x20b274[_0x1c3c('0x2')];this['campaigntype']=_0x20b274[_0x1c3c('0x2')]===_0x1c3c('0x3')?_0x1c3c('0x4'):_0x20b274[_0x1c3c('0x2')];this[_0x1c3c('0x5')]=_0x20b274[_0x1c3c('0x5')];this['countcongestionretry']=_0x20b274[_0x1c3c('0x6')];this[_0x1c3c('0x7')]=_0x20b274[_0x1c3c('0x7')];this[_0x1c3c('0x8')]=_0x20b274[_0x1c3c('0x5')]+_0x20b274[_0x1c3c('0x6')]+_0x20b274['countnoanswerretry']+_0x20b274[_0x1c3c('0x9')]+_0x20b274[_0x1c3c('0xa')]+_0x20b274['countabandonedretry']+_0x20b274['countmachineretry']+_0x20b274[_0x1c3c('0xb')];this[_0x1c3c('0x9')]=_0x20b274[_0x1c3c('0x9')];this[_0x1c3c('0xa')]=_0x20b274['countdropretry'];this[_0x1c3c('0xc')]=_0x20b274[_0x1c3c('0xc')];this['countmachineretry']=_0x20b274[_0x1c3c('0xd')];this[_0x1c3c('0xb')]=_0x20b274['countagentrejectretry'];this[_0x1c3c('0xe')]=_0x4ed51c[_0x1c3c('0xe')];this[_0x1c3c('0xf')]=_0x20b274[_0x1c3c('0x10')];this['calleridnum']=_0x20b274['number'];this[_0x1c3c('0x11')]=_0x20b274['starttime'];this['responsetime']=_0x20b274[_0x1c3c('0x12')];this[_0x1c3c('0x13')]=_0x20b274[_0x1c3c('0x13')];this['dropreason']=_0x20b274[_0x1c3c('0x14')];this['endtime']=this[_0x1c3c('0x13')];this[_0x1c3c('0x15')]=utils[_0x1c3c('0x16')](_0x20b274['responsetime'],_0x20b274[_0x1c3c('0x11')]);this[_0x1c3c('0x17')]=utils[_0x1c3c('0x16')](this['droptime'],_0x20b274[_0x1c3c('0x12')]);this[_0x1c3c('0x18')]=0x0;this[_0x1c3c('0x4')]=_0x4ed51c['queue'];this['membername']=_0x4ed51c[_0x1c3c('0x19')];this['reason']=_0x4ed51c[_0x1c3c('0x1a')];this['callback']=_0x20b274[_0x1c3c('0x1b')];this['callbackuniqueid']=_0x20b274[_0x1c3c('0x1c')];this['callbackat']=_0x20b274[_0x1c3c('0x1d')];this[_0x1c3c('0x1e')]=_0x20b274[_0x1c3c('0x1e')];this[_0x1c3c('0x1f')]=_0x20b274[_0x1c3c('0x1f')];this[_0x1c3c('0x20')]=_0x20b274['ListId'];this['UserId']=_0x20b274[_0x1c3c('0x21')];this[_0x1c3c('0x22')]=_0x20b274[_0x1c3c('0x22')];this[_0x1c3c('0x23')]=_0x20b274['CampaignId'];this[_0x1c3c('0x24')]=_0x20b274[_0x1c3c('0x24')]||'';this[_0x1c3c('0x25')]=_0x20b274[_0x1c3c('0x25')]||'';this[_0x1c3c('0x26')]=_0x20b274[_0x1c3c('0x26')];this[_0x1c3c('0x27')]=_0x20b274[_0x1c3c('0x27')];this['statedesc']=_0x20b274[_0x1c3c('0x28')];}module[_0x1c3c('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index dfc0a97..97b8797 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 _0x4bd3=['catch','error','[getContactDialer]','getContactDialerIvr','temp','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','inspect','getContactDialer'];(function(_0x1b5c7f,_0x550ad3){var _0x474642=function(_0x1c3a55){while(--_0x1c3a55){_0x1b5c7f['push'](_0x1b5c7f['shift']());}};_0x474642(++_0x550ad3);}(_0x4bd3,0x174));var _0x34bd=function(_0x544c32,_0x2c3406){_0x544c32=_0x544c32-0x0;var _0x5abd2c=_0x4bd3[_0x544c32];return _0x5abd2c;};'use strict';var util=require(_0x34bd('0x0'));var logger=require('../../../../config/logger')(_0x34bd('0x1'));var cmHopper=require(_0x34bd('0x2'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x22b921){return util[_0x34bd('0x3')](_0x22b921,{'showHidden':![],'depth':null});}function getContactDialer(_0x1fc8eb,_0x5846f3,_0x2133c5){return cmHopper[_0x34bd('0x4')](_0x1fc8eb['id'],_0x5846f3,_0x2133c5,_0x1fc8eb['dialOrderByScheduledAt'])[_0x34bd('0x5')](function(_0x213716){_0x1fc8eb['temp']=0x0;logger[_0x34bd('0x6')](_0x34bd('0x7'),inspectError(_0x213716));});}exports[_0x34bd('0x4')]=getContactDialer;function getContactDialerIvr(_0xed6181,_0x1ac77f){return cmHopper[_0x34bd('0x8')](_0xed6181['id'],_0x1ac77f,_0xed6181['dialOrderByScheduledAt'])[_0x34bd('0x5')](function(_0x45322f){_0xed6181[_0x34bd('0x9')]=0x0;logger[_0x34bd('0x6')]('[getContactDialerIvr]',inspectError(_0x45322f));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3da7a0){return cmHopper['countReScheduled'](_0x3da7a0)['catch'](function(_0x275d80){logger[_0x34bd('0x6')](_0x34bd('0xa'),inspectError(_0x275d80));});}exports[_0x34bd('0xb')]=countReScheduled;function rescheduleContact(_0x2ee180){return cmHopper[_0x34bd('0xc')](_0x2ee180)[_0x34bd('0x5')](function(_0x236f6b){logger[_0x34bd('0x6')]('[rescheduleContact]',inspectError(_0x236f6b));});}exports[_0x34bd('0xc')]=rescheduleContact;function unlockContact(_0x4d4955,_0x4e3886,_0x6638ed){return cmHopper[_0x34bd('0xd')](_0x4d4955,_0x4e3886,_0x6638ed)[_0x34bd('0x5')](function(_0x2dc917){logger[_0x34bd('0x6')](_0x34bd('0xe'),inspectError(_0x2dc917));});}exports[_0x34bd('0xd')]=unlockContact;function moveContactManagedDialer(_0x1c12e8){return cmHopper[_0x34bd('0xf')](_0x1c12e8)[_0x34bd('0x5')](function(_0x4b5ebb){logger['error'](_0x34bd('0x10'),inspectError(_0x4b5ebb));});}exports[_0x34bd('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x265e70){return cmHopperBlack[_0x34bd('0x11')](_0x265e70)[_0x34bd('0x5')](function(_0x23a94a){logger[_0x34bd('0x6')](_0x34bd('0x12'),inspectError(_0x23a94a));});}exports[_0x34bd('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x55538e){return cmHopperBlack[_0x34bd('0x13')](_0x55538e)[_0x34bd('0x5')](function(_0x49f625){logger[_0x34bd('0x6')](_0x34bd('0x14'),inspectError(_0x49f625));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x582772,_0x5da62a,_0x4edf84){return cmHopperAdditionalPhone[_0x34bd('0x15')](_0x582772,_0x5da62a,_0x4edf84)['catch'](function(_0x10fc4b){logger[_0x34bd('0x6')](_0x34bd('0x16'),inspectError(_0x10fc4b));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x41bffd,_0x14479a,_0x4f0dff){return cmHopperAdditionalPhone[_0x34bd('0x17')](_0x41bffd,_0x14479a,_0x4f0dff)['catch'](function(_0x29bda8){logger[_0x34bd('0x6')](_0x34bd('0x18'),inspectError(_0x29bda8));});}exports[_0x34bd('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x56baf7){return cmHopperHistory[_0x34bd('0x19')](_0x56baf7)[_0x34bd('0x5')](function(_0x5d2e3d){logger[_0x34bd('0x6')](_0x34bd('0x1a'),inspectError(_0x5d2e3d));});}exports[_0x34bd('0x19')]=avgHandleTime;function createHistory(_0x3f675c){return cmHopperHistory[_0x34bd('0x1b')](_0x3f675c)[_0x34bd('0x5')](function(_0x177d43){logger['error'](_0x34bd('0x1c'),inspectError(_0x177d43));});}exports[_0x34bd('0x1b')]=createHistory; \ No newline at end of file +var _0xbd51=['[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','catch','temp','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones'];(function(_0x3dfda9,_0x2674b5){var _0x33a818=function(_0x127d25){while(--_0x127d25){_0x3dfda9['push'](_0x3dfda9['shift']());}};_0x33a818(++_0x2674b5);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3ceb84,_0x22d03c){_0x3ceb84=_0x3ceb84-0x0;var _0x155102=_0xbd51[_0x3ceb84];return _0x155102;};'use strict';var util=require(_0x1bd5('0x0'));var logger=require('../../../../config/logger')(_0x1bd5('0x1'));var cmHopper=require(_0x1bd5('0x2'));var cmHopperAdditionalPhone=require(_0x1bd5('0x3'));var cmHopperBlack=require(_0x1bd5('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4d1bba){return util['inspect'](_0x4d1bba,{'showHidden':![],'depth':null});}function getContactDialer(_0x531028,_0x3bce00,_0x362b24){return cmHopper[_0x1bd5('0x5')](_0x531028['id'],_0x3bce00,_0x362b24,_0x531028['dialOrderByScheduledAt'])[_0x1bd5('0x6')](function(_0x30a385){_0x531028[_0x1bd5('0x7')]=0x0;logger[_0x1bd5('0x8')](_0x1bd5('0x9'),inspectError(_0x30a385));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x36ef1a,_0x5c8e0d){return cmHopper[_0x1bd5('0xa')](_0x36ef1a['id'],_0x5c8e0d,_0x36ef1a[_0x1bd5('0xb')])[_0x1bd5('0x6')](function(_0x1fbc68){_0x36ef1a[_0x1bd5('0x7')]=0x0;logger[_0x1bd5('0x8')]('[getContactDialerIvr]',inspectError(_0x1fbc68));});}exports[_0x1bd5('0xa')]=getContactDialerIvr;function countReScheduled(_0x4e666c){return cmHopper[_0x1bd5('0xc')](_0x4e666c)[_0x1bd5('0x6')](function(_0x37e8e1){logger[_0x1bd5('0x8')](_0x1bd5('0xd'),inspectError(_0x37e8e1));});}exports[_0x1bd5('0xc')]=countReScheduled;function rescheduleContact(_0x1527c1){return cmHopper['rescheduleContact'](_0x1527c1)['catch'](function(_0x8b2390){logger[_0x1bd5('0x8')](_0x1bd5('0xe'),inspectError(_0x8b2390));});}exports[_0x1bd5('0xf')]=rescheduleContact;function unlockContact(_0x48d048,_0x5072c2,_0xa63190){return cmHopper[_0x1bd5('0x10')](_0x48d048,_0x5072c2,_0xa63190)[_0x1bd5('0x6')](function(_0x4793dd){logger[_0x1bd5('0x8')](_0x1bd5('0x11'),inspectError(_0x4793dd));});}exports[_0x1bd5('0x10')]=unlockContact;function moveContactManagedDialer(_0x3afc4a){return cmHopper[_0x1bd5('0x12')](_0x3afc4a)['catch'](function(_0x53ad5e){logger[_0x1bd5('0x8')](_0x1bd5('0x13'),inspectError(_0x53ad5e));});}exports[_0x1bd5('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0xb95d4e){return cmHopperBlack[_0x1bd5('0x14')](_0xb95d4e)[_0x1bd5('0x6')](function(_0x3fbb39){logger[_0x1bd5('0x8')](_0x1bd5('0x15'),inspectError(_0x3fbb39));});}exports[_0x1bd5('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x34bd6a){return cmHopperBlack[_0x1bd5('0x16')](_0x34bd6a)[_0x1bd5('0x6')](function(_0x7ff933){logger[_0x1bd5('0x8')](_0x1bd5('0x17'),inspectError(_0x7ff933));});}exports[_0x1bd5('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x29c340,_0x5567c9,_0x42c43d){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x29c340,_0x5567c9,_0x42c43d)[_0x1bd5('0x6')](function(_0x1e534e){logger[_0x1bd5('0x8')]('[verifyAdditionalPhone]',inspectError(_0x1e534e));});}exports[_0x1bd5('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x4fa37c,_0x2ed551,_0x30676d){return cmHopperAdditionalPhone[_0x1bd5('0x19')](_0x4fa37c,_0x2ed551,_0x30676d)[_0x1bd5('0x6')](function(_0x47c84b){logger[_0x1bd5('0x8')](_0x1bd5('0x1a'),inspectError(_0x47c84b));});}exports[_0x1bd5('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x3b1090){return cmHopperHistory['avgHandleTime'](_0x3b1090)[_0x1bd5('0x6')](function(_0x24d4d9){logger[_0x1bd5('0x8')](_0x1bd5('0x1b'),inspectError(_0x24d4d9));});}exports[_0x1bd5('0x1c')]=avgHandleTime;function createHistory(_0xc73670){return cmHopperHistory['createHistory'](_0xc73670)[_0x1bd5('0x6')](function(_0x472b22){logger[_0x1bd5('0x8')]('[createHistory]',inspectError(_0x472b22));});}exports[_0x1bd5('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 9ca53c7..a87a061 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 _0x61fa=['paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb'];(function(_0xa20ed6,_0xe77cb0){var _0xa09de6=function(_0x3d0f51){while(--_0x3d0f51){_0xa20ed6['push'](_0xa20ed6['shift']());}};_0xa09de6(++_0xe77cb0);}(_0x61fa,0x1d8));var _0xa61f=function(_0x1e3128,_0x44f7b6){_0x1e3128=_0x1e3128-0x0;var _0x55755f=_0x61fa[_0x1e3128];return _0x55755f;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var logger=require('../../../../config/logger')(_0xa61f('0x0'));var timezones=require(_0xa61f('0x1'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa61f('0x2'),'BLACKLIST':_0xa61f('0x3'),'CONTACTS_RESCHEDULED':_0xa61f('0x4'),'DEACTIVATED':_0xa61f('0x5'),'DISACTIVED':_0xa61f('0x6'),'EMPTY_INTERVAL':_0xa61f('0x7'),'INACTIVE':_0xa61f('0x8'),'NO_AGENTS_LOGGED':_0xa61f('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xa61f('0xa'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xa61f('0xb'),'UNKNOWN_TIMEZONE':_0xa61f('0xc'),'UNREACHABLE_TRUNK':_0xa61f('0xd')};exports[_0xa61f('0xe')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xaa7dbd){return _0xaa7dbd[_0xa61f('0xf')]===_0xa61f('0x10');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x411ca0){return _0x411ca0[_0xa61f('0x11')]===_0xa61f('0x12');}exports[_0xa61f('0x13')]=isIVRCampaign;function isOutboundQueue(_0x3a59eb){return _0x3a59eb[_0xa61f('0x11')]===_0xa61f('0x14');}exports[_0xa61f('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x4eb2b8){return _0x4eb2b8[_0xa61f('0x16')];}exports[_0xa61f('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x20cd9b){return _0x20cd9b['active'];}exports[_0xa61f('0x18')]=isIVRCampaignActive;function getSeconds(_0x2257ac,_0x5935ac){var _0x57bab7=moment(_0x2257ac)[_0xa61f('0x19')](0x0);var _0x89c5d5=moment(_0x5935ac)[_0xa61f('0x19')](0x0);return _0x57bab7[_0xa61f('0x1a')](_0x89c5d5,'seconds');}exports[_0xa61f('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x29f357,_0x5a774a){var _0x5bdf12=![];var _0x58061d=_0x29f357[_0xa61f('0xf')]!==_0x5a774a[_0xa61f('0xf')]||_0x29f357['dialActive']!==_0x5a774a['dialActive']||_0x29f357[_0xa61f('0x1c')]!==_0x5a774a[_0xa61f('0x1c')];var _0x576bee=_0x29f357[_0xa61f('0x1d')]!==_0x5a774a[_0xa61f('0x1d')]||_0x29f357['loggedIn']!==_0x5a774a[_0xa61f('0x1e')]||_0x29f357['loggedInDb']!==_0x5a774a[_0xa61f('0x1f')]||_0x29f357[_0xa61f('0x20')]!==_0x5a774a[_0xa61f('0x20')]||_0x29f357[_0xa61f('0x21')]!==_0x5a774a[_0xa61f('0x21')]||_0x29f357[_0xa61f('0x22')]!==_0x5a774a[_0xa61f('0x22')]||_0x29f357['waiting']!==_0x5a774a[_0xa61f('0x23')]||_0x29f357[_0xa61f('0x24')]!==_0x5a774a[_0xa61f('0x24')]||_0x29f357[_0xa61f('0x25')]!==_0x5a774a[_0xa61f('0x25')];if(_0x29f357[_0xa61f('0x26')]&&_0x5a774a[_0xa61f('0x26')]){_0x5bdf12=_0x29f357[_0xa61f('0x26')][_0xa61f('0x27')]!==_0x5a774a[_0xa61f('0x26')][_0xa61f('0x27')]||_0x29f357[_0xa61f('0x26')][_0xa61f('0x28')]!==_0x5a774a[_0xa61f('0x26')][_0xa61f('0x28')];}return _0x58061d||_0x576bee||_0x5bdf12;}exports[_0xa61f('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x298c92){var _0x289485=null;var _0x470f46=_0x298c92['dialTimezone'];if(_['isNil'](_0x298c92['dialGlobalInterval'])||_[_0xa61f('0x2a')](_0x298c92[_0xa61f('0x2b')])||_[_0xa61f('0x2a')](_0x298c92[_0xa61f('0x2b')][_0xa61f('0x2c')])){_0x289485=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xa61f('0x2d')](_0x298c92['dialGlobalInterval'])||_[_0xa61f('0x2d')](_0x298c92[_0xa61f('0x2b')][_0xa61f('0x2c')])){_0x289485=CAMPAIGN_STATUS[_0xa61f('0x2e')];}else if(_0x470f46&&!timezones[_0x470f46]){_0x289485=CAMPAIGN_STATUS[_0xa61f('0x2f')];}return _0x289485;}function checkAnyValidTrunk(_0x50ebd7,_0x4affb2){var _0x4013f6=null;var _0x29c2e5=_0xa61f('0x30');var _0x43aa15=[_0xa61f('0x31'),_0xa61f('0x32')];var _0x3c1e5a=!![];if(_0x50ebd7['Trunk']&&_0x50ebd7[_0xa61f('0x26')][_0xa61f('0x28')]){_0x29c2e5+=_0x50ebd7[_0xa61f('0x26')][_0xa61f('0x27')];_0x4013f6=_0x4affb2[_0x29c2e5];_0x3c1e5a=_0x43aa15['includes'](_0x4013f6[_0xa61f('0x33')]);}else if(_0x50ebd7[_0xa61f('0x34')]&&_0x50ebd7[_0xa61f('0x34')][_0xa61f('0x28')]){_0x29c2e5+=_0x50ebd7[_0xa61f('0x34')][_0xa61f('0x27')];_0x4013f6=_0x4affb2[_0x29c2e5];_0x3c1e5a=_0x43aa15[_0xa61f('0x35')](_0x4013f6[_0xa61f('0x33')]);}return _0x3c1e5a;}function getQueueCampaignStatusMessage(_0x4eb6c1,_0x18fe13){var _0x32b49f=CAMPAIGN_STATUS[_0xa61f('0x2')];var _0x354d3a=isPreviewCampaign(_0x4eb6c1);if(!isQueueCampaignActive(_0x4eb6c1)){if(_0x354d3a){_0x32b49f=CAMPAIGN_STATUS[_0xa61f('0x36')];}else{if(_0x4eb6c1[_0xa61f('0x25')]===0x0&&_0x4eb6c1[_0xa61f('0x21')]===0x0&&_0x4eb6c1['waiting']===0x0&&(_0x4eb6c1[_0xa61f('0x22')]||0x0)===0x0){_0x32b49f=CAMPAIGN_STATUS[_0xa61f('0x36')];}else{_0x32b49f=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x4eb6c1[_0xa61f('0x1e')]===0x0){_0x32b49f=CAMPAIGN_STATUS[_0xa61f('0x37')];}else if(!checkAnyValidTrunk(_0x4eb6c1,_0x18fe13)){_0x32b49f=CAMPAIGN_STATUS[_0xa61f('0x38')];}else if(!isPreviewCampaign(_0x4eb6c1)){var _0x1a01f0=checkAnyValidQueueCampaignInterval(_0x4eb6c1);if(_0x1a01f0){_0x32b49f=_0x1a01f0;}}return _0x32b49f;}exports[_0xa61f('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x16f0ed){var _0x1697ee=CAMPAIGN_STATUS[_0xa61f('0x3a')];if(_0x16f0ed[_0xa61f('0x25')]===0x0&&_0x16f0ed[_0xa61f('0x21')]===0x0&&_0x16f0ed[_0xa61f('0x23')]===0x0&&(_0x16f0ed[_0xa61f('0x22')]||0x0)===0x0){_0x1697ee=CAMPAIGN_STATUS[_0xa61f('0x36')];}return _0x1697ee;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x50a77b){var _0x592d70=_0x50a77b[_0xa61f('0x3b')](/"(.*?)"/);return _0x592d70?_0x592d70[0x1]:_0x50a77b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x1f6c3e,_0x10260d,_0x232c87){if(!_[_0xa61f('0x3c')](_0x232c87)&&typeof _0x232c87===_0xa61f('0x3d')&&!_[_0xa61f('0x2d')](_0x232c87)){if(!_[_0xa61f('0x3c')](_0x10260d)&&typeof _0x10260d===_0xa61f('0x3d')&&!_[_0xa61f('0x2d')](_0x10260d)){return util[_0xa61f('0x3e')](_0xa61f('0x3f'),_0x10260d,_0x232c87);}return util['format']('\x22%s\x22\x20<%s>',_0x232c87,_0x232c87);}if(!_['isUndefined'](_0x1f6c3e)&&typeof _0x1f6c3e===_0xa61f('0x3d')&&!_[_0xa61f('0x2d')](_0x1f6c3e)){return _0x1f6c3e;}return _0xa61f('0x40');}exports[_0xa61f('0x41')]=getCallerId;function getCallerIdRandom(_0x226718,_0x539bda){var _0x301d17;var _0x3cb793;var _0x5ca306;if(_0x539bda<=0x0){_0x539bda=0x1;}_0x301d17=new RegExp(_0xa61f('0x42')+_0x539bda+'}$');_0x3cb793=Math[_0xa61f('0x43')](0xa,_0x539bda-0x1);_0x5ca306=Math[_0xa61f('0x43')](0xa,_0x539bda)-0x1;return util['format']('%s',_[_0xa61f('0x44')](_0x226718,_0x301d17,_[_0xa61f('0x45')](_0x3cb793,_0x5ca306)[_0xa61f('0x46')]()));}exports[_0xa61f('0x47')]=getCallerIdRandom;function decrementOriginate(_0x532091){if(_0x532091['originated']&&_0x532091[_0xa61f('0x25')]>0x0){_0x532091[_0xa61f('0x25')]-=0x1;}else{logger[_0xa61f('0x48')](_0xa61f('0x49'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x24cf95){return _0x24cf95&&_0x24cf95[_0xa61f('0x4a')]>0x0;}exports[_0xa61f('0x4b')]=checkContactEmpty;function erlangb(_0xbe53e,_0x211671){if(_0x211671===0x0){return 0x0;}var _0x3acf61=0x1;for(var _0x551f98=0x1;_0x551f98<=_0x211671;_0x551f98+=0x1){_0x3acf61=0x1+_0x3acf61*_0x551f98/_0xbe53e;}return 0x1/_0x3acf61;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x5317a1,_0x4e0c64,_0x7ff605){if(_0x4e0c64>_0x7ff605){for(var _0x4eeac3=0x0;_0x4eeac3<_0x4e0c64-_0x7ff605;_0x4eeac3+=0x1){decrementOriginate(_0x5317a1);}}}exports[_0xa61f('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2222c7){var _0x59944d={};var _0x10a7f4=['id',_0xa61f('0x4d'),_0xa61f('0x4e'),_0xa61f('0x4f')];const _0x241f7f=0xfa;if(_0x2222c7){for(var _0x54a34e in _0x2222c7){if(typeof _0x2222c7[_0x54a34e]!==_0xa61f('0x50')){if(!_['isNil'](_0x2222c7[_0x54a34e])&&!_0x10a7f4['includes'](_0x54a34e)){if(_0x54a34e===_0xa61f('0x51')&&_0x2222c7[_0x54a34e]['length']>_0x241f7f){_0x59944d[_0xa61f('0x52')+_0x54a34e[_0xa61f('0x53')]()]=_0x2222c7[_0x54a34e][_0xa61f('0x46')]()['substring'](0x0,_0x241f7f);}else{_0x59944d[_0xa61f('0x52')+_0x54a34e['toUpperCase']()]=_0x2222c7[_0x54a34e];}}}}}return _0x59944d;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x2c6b=['TIMEZONE_UNKNOW','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','Interval','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','updatedAt','undefined','description','XMD-','toUpperCase','toString','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING'];(function(_0x25efc3,_0x555aae){var _0x4d3891=function(_0x149c0a){while(--_0x149c0a){_0x25efc3['push'](_0x25efc3['shift']());}};_0x4d3891(++_0x555aae);}(_0x2c6b,0x9e));var _0xb2c6=function(_0x579121,_0x27e9e2){_0x579121=_0x579121-0x0;var _0x38a4ae=_0x2c6b[_0x579121];return _0x38a4ae;};'use strict';var _=require(_0xb2c6('0x0'));var moment=require(_0xb2c6('0x1'));var util=require(_0xb2c6('0x2'));var logger=require(_0xb2c6('0x3'))(_0xb2c6('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb2c6('0x5'),'BLACKLIST':_0xb2c6('0x6'),'CONTACTS_RESCHEDULED':_0xb2c6('0x7'),'DEACTIVATED':_0xb2c6('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb2c6('0x9'),'INACTIVE':_0xb2c6('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xb2c6('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xb2c6('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xb2c6('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xb2c6('0xe'),'RUNNING':_0xb2c6('0xf'),'UNKNOWN_TIMEZONE':_0xb2c6('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xb2c6('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4e82b0){return _0x4e82b0['dialMethod']===_0xb2c6('0x12');}exports[_0xb2c6('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x51eed3){return _0x51eed3[_0xb2c6('0x14')]===_0xb2c6('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x22606f){return _0x22606f[_0xb2c6('0x14')]===_0xb2c6('0x16');}exports[_0xb2c6('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x38c415){return _0x38c415['dialActive'];}exports[_0xb2c6('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0xb2874){return _0xb2874[_0xb2c6('0x19')];}exports[_0xb2c6('0x1a')]=isIVRCampaignActive;function getSeconds(_0x3080c3,_0x44a145){var _0x308eb1=moment(_0x3080c3)[_0xb2c6('0x1b')](0x0);var _0x21d0e4=moment(_0x44a145)[_0xb2c6('0x1b')](0x0);return _0x308eb1[_0xb2c6('0x1c')](_0x21d0e4,_0xb2c6('0x1d'));}exports[_0xb2c6('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x50b8e1,_0x4fd4ad){var _0xda8a5e=![];var _0x506583=_0x50b8e1['dialMethod']!==_0x4fd4ad[_0xb2c6('0x1f')]||_0x50b8e1[_0xb2c6('0x20')]!==_0x4fd4ad[_0xb2c6('0x20')]||_0x50b8e1[_0xb2c6('0x21')]!==_0x4fd4ad['message'];var _0x37c843=_0x50b8e1[_0xb2c6('0x22')]!==_0x4fd4ad[_0xb2c6('0x22')]||_0x50b8e1[_0xb2c6('0x23')]!==_0x4fd4ad['loggedIn']||_0x50b8e1[_0xb2c6('0x24')]!==_0x4fd4ad['loggedInDb']||_0x50b8e1[_0xb2c6('0x25')]!==_0x4fd4ad[_0xb2c6('0x25')]||_0x50b8e1[_0xb2c6('0x26')]!==_0x4fd4ad[_0xb2c6('0x26')]||_0x50b8e1[_0xb2c6('0x27')]!==_0x4fd4ad[_0xb2c6('0x27')]||_0x50b8e1[_0xb2c6('0x28')]!==_0x4fd4ad[_0xb2c6('0x28')]||_0x50b8e1[_0xb2c6('0x29')]!==_0x4fd4ad[_0xb2c6('0x29')]||_0x50b8e1[_0xb2c6('0x2a')]!==_0x4fd4ad[_0xb2c6('0x2a')];if(_0x50b8e1[_0xb2c6('0x2b')]&&_0x4fd4ad['Trunk']){_0xda8a5e=_0x50b8e1[_0xb2c6('0x2b')][_0xb2c6('0x2c')]!==_0x4fd4ad['Trunk'][_0xb2c6('0x2c')]||_0x50b8e1[_0xb2c6('0x2b')][_0xb2c6('0x19')]!==_0x4fd4ad[_0xb2c6('0x2b')][_0xb2c6('0x19')];}return _0x506583||_0x37c843||_0xda8a5e;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x169b5d){var _0x100adf=null;var _0xfed877=_0x169b5d['dialTimezone'];if(_[_0xb2c6('0x2d')](_0x169b5d['dialGlobalInterval'])||_[_0xb2c6('0x2d')](_0x169b5d['Interval'])||_[_0xb2c6('0x2d')](_0x169b5d[_0xb2c6('0x2e')]['Intervals'])){_0x100adf=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xb2c6('0x2f')](_0x169b5d[_0xb2c6('0x30')])||_['isEmpty'](_0x169b5d[_0xb2c6('0x2e')]['Intervals'])){_0x100adf=CAMPAIGN_STATUS[_0xb2c6('0x31')];}else if(_0xfed877&&!timezones[_0xfed877]){_0x100adf=CAMPAIGN_STATUS[_0xb2c6('0x32')];}return _0x100adf;}function checkAnyValidTrunk(_0x1ff9d3,_0x4073ff){var _0x2e415e=null;var _0x3b2d07=_0xb2c6('0x33');var _0x46de88=[_0xb2c6('0x34'),'unmonitored'];var _0x1bd2fd=!![];if(_0x1ff9d3[_0xb2c6('0x2b')]&&_0x1ff9d3[_0xb2c6('0x2b')][_0xb2c6('0x19')]){_0x3b2d07+=_0x1ff9d3['Trunk'][_0xb2c6('0x2c')];_0x2e415e=_0x4073ff[_0x3b2d07];_0x1bd2fd=_0x46de88[_0xb2c6('0x35')](_0x2e415e[_0xb2c6('0x36')]);}else if(_0x1ff9d3[_0xb2c6('0x37')]&&_0x1ff9d3[_0xb2c6('0x37')][_0xb2c6('0x19')]){_0x3b2d07+=_0x1ff9d3['TrunkBackup'][_0xb2c6('0x2c')];_0x2e415e=_0x4073ff[_0x3b2d07];_0x1bd2fd=_0x46de88[_0xb2c6('0x35')](_0x2e415e[_0xb2c6('0x36')]);}return _0x1bd2fd;}function getQueueCampaignStatusMessage(_0x2416fc,_0x12a704){var _0x1300e5=CAMPAIGN_STATUS[_0xb2c6('0x5')];var _0x289107=isPreviewCampaign(_0x2416fc);if(!isQueueCampaignActive(_0x2416fc)){if(_0x289107){_0x1300e5=CAMPAIGN_STATUS[_0xb2c6('0x38')];}else{if(_0x2416fc[_0xb2c6('0x2a')]===0x0&&_0x2416fc[_0xb2c6('0x26')]===0x0&&_0x2416fc[_0xb2c6('0x28')]===0x0&&(_0x2416fc['pTalking']||0x0)===0x0){_0x1300e5=CAMPAIGN_STATUS[_0xb2c6('0x38')];}else{_0x1300e5=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x2416fc[_0xb2c6('0x23')]===0x0){_0x1300e5=CAMPAIGN_STATUS[_0xb2c6('0x39')];}else if(!checkAnyValidTrunk(_0x2416fc,_0x12a704)){_0x1300e5=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2416fc)){var _0x2505b3=checkAnyValidQueueCampaignInterval(_0x2416fc);if(_0x2505b3){_0x1300e5=_0x2505b3;}}return _0x1300e5;}exports[_0xb2c6('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x110d57){var _0x12e00e=CAMPAIGN_STATUS[_0xb2c6('0x3b')];if(_0x110d57[_0xb2c6('0x2a')]===0x0&&_0x110d57[_0xb2c6('0x26')]===0x0&&_0x110d57['waiting']===0x0&&(_0x110d57['pTalking']||0x0)===0x0){_0x12e00e=CAMPAIGN_STATUS[_0xb2c6('0x38')];}return _0x12e00e;}exports[_0xb2c6('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xaff3b2){var _0x204c49=_0xaff3b2[_0xb2c6('0x3d')](/"(.*?)"/);return _0x204c49?_0x204c49[0x1]:_0xaff3b2;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xdf8527,_0x174442,_0x5dbb28){if(!_[_0xb2c6('0x3e')](_0x5dbb28)&&typeof _0x5dbb28===_0xb2c6('0x3f')&&!_[_0xb2c6('0x2f')](_0x5dbb28)){if(!_['isUndefined'](_0x174442)&&typeof _0x174442==='string'&&!_[_0xb2c6('0x2f')](_0x174442)){return util[_0xb2c6('0x40')]('\x22%s\x22\x20<%s>',_0x174442,_0x5dbb28);}return util[_0xb2c6('0x40')](_0xb2c6('0x41'),_0x5dbb28,_0x5dbb28);}if(!_[_0xb2c6('0x3e')](_0xdf8527)&&typeof _0xdf8527===_0xb2c6('0x3f')&&!_[_0xb2c6('0x2f')](_0xdf8527)){return _0xdf8527;}return'\x22\x22\x20<>';}exports[_0xb2c6('0x42')]=getCallerId;function getCallerIdRandom(_0x58265f,_0x303ea4){var _0x57f6ee;var _0xc15735;var _0x9725cf;if(_0x303ea4<=0x0){_0x303ea4=0x1;}_0x57f6ee=new RegExp(_0xb2c6('0x43')+_0x303ea4+'}$');_0xc15735=Math[_0xb2c6('0x44')](0xa,_0x303ea4-0x1);_0x9725cf=Math[_0xb2c6('0x44')](0xa,_0x303ea4)-0x1;return util[_0xb2c6('0x40')]('%s',_[_0xb2c6('0x45')](_0x58265f,_0x57f6ee,_[_0xb2c6('0x46')](_0xc15735,_0x9725cf)['toString']()));}exports[_0xb2c6('0x47')]=getCallerIdRandom;function decrementOriginate(_0x48d557){if(_0x48d557[_0xb2c6('0x2a')]&&_0x48d557['originated']>0x0){_0x48d557[_0xb2c6('0x2a')]-=0x1;}else{logger[_0xb2c6('0x48')](_0xb2c6('0x49'));}}exports[_0xb2c6('0x4a')]=decrementOriginate;function checkContactEmpty(_0x3b645f){return _0x3b645f&&_0x3b645f[_0xb2c6('0x4b')]>0x0;}exports[_0xb2c6('0x4c')]=checkContactEmpty;function erlangb(_0x501b13,_0x2a64d7){if(_0x2a64d7===0x0){return 0x0;}var _0x9628fe=0x1;for(var _0x374b79=0x1;_0x374b79<=_0x2a64d7;_0x374b79+=0x1){_0x9628fe=0x1+_0x9628fe*_0x374b79/_0x501b13;}return 0x1/_0x9628fe;}exports[_0xb2c6('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x2cb820,_0x2902dd,_0x5126d1){if(_0x2902dd>_0x5126d1){for(var _0x436cd5=0x0;_0x436cd5<_0x2902dd-_0x5126d1;_0x436cd5+=0x1){decrementOriginate(_0x2cb820);}}}exports[_0xb2c6('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4813ac){var _0xf5fcb6={};var _0x48b277=['id','createdAt','tags',_0xb2c6('0x4f')];const _0x10ae53=0xfa;if(_0x4813ac){for(var _0x42fb44 in _0x4813ac){if(typeof _0x4813ac[_0x42fb44]!==_0xb2c6('0x50')){if(!_[_0xb2c6('0x2d')](_0x4813ac[_0x42fb44])&&!_0x48b277['includes'](_0x42fb44)){if(_0x42fb44===_0xb2c6('0x51')&&_0x4813ac[_0x42fb44][_0xb2c6('0x4b')]>_0x10ae53){_0xf5fcb6[_0xb2c6('0x52')+_0x42fb44[_0xb2c6('0x53')]()]=_0x4813ac[_0x42fb44][_0xb2c6('0x54')]()[_0xb2c6('0x55')](0x0,_0x10ae53);}else{_0xf5fcb6['XMD-'+_0x42fb44[_0xb2c6('0x53')]()]=_0x4813ac[_0x42fb44];}}}}}return _0xf5fcb6;}exports[_0xb2c6('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 533b987..2b35fb6 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(_0x56dc98,_0x1357fc){var _0x2202d4=function(_0xf4fa3a){while(--_0xf4fa3a){_0x56dc98['push'](_0x56dc98['shift']());}};_0x2202d4(++_0x1357fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x23f6c1,_0x1194ec){var _0x28f8fc=function(_0x15024e){while(--_0x15024e){_0x23f6c1['push'](_0x23f6c1['shift']());}};_0x28f8fc(++_0x1194ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 da21b9d..be7f82c 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 _0x06bd=['./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','create','parse','application/pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','update','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','execute','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf'];(function(_0x43552e,_0x5099aa){var _0x8b47a4=function(_0x499267){while(--_0x499267){_0x43552e['push'](_0x43552e['shift']());}};_0x8b47a4(++_0x5099aa);}(_0x06bd,0x6a));var _0xd06b=function(_0x5f13cd,_0x3daaf8){_0x5f13cd=_0x5f13cd-0x0;var _0x827cb7=_0x06bd[_0x5f13cd];return _0x827cb7;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xd06b('0x0'));var uuid=require(_0xd06b('0x1'));var moment=require('moment');var path=require(_0xd06b('0x2'));var tiff2pdf=require(_0xd06b('0x3'));var gs=require(_0xd06b('0x4'));var logger=require(_0xd06b('0x5'))(_0xd06b('0x6'));var ami=require(_0xd06b('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xd06b('0x8'));var Action=require(_0xd06b('0x9'));var faxAccount=require(_0xd06b('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xd06b('0xb'));function Fax(_0x24643a){this[_0xd06b('0xc')]={};this[_0xd06b('0xd')]=_0x24643a[_0xd06b('0xd')];this[_0xd06b('0xe')]=_0x24643a[_0xd06b('0xe')];this[_0xd06b('0xf')]={};ami['on'](_0xd06b('0x10'),this[_0xd06b('0x11')][_0xd06b('0x12')](this));ami['on']('varset',this[_0xd06b('0x13')][_0xd06b('0x12')](this));ami['on'](_0xd06b('0x14'),this[_0xd06b('0x15')]['bind'](this));ami['on']('newexten',this[_0xd06b('0x16')][_0xd06b('0x12')](this));ami['on'](_0xd06b('0x17'),this[_0xd06b('0x18')][_0xd06b('0x12')](this));ami['on'](_0xd06b('0x19'),this['syncReceiveFax']['bind'](this));ami['on']('hangup',this[_0xd06b('0x1a')][_0xd06b('0x12')](this));ami['on'](_0xd06b('0x1b'),this[_0xd06b('0x1c')]['bind'](this));}Fax[_0xd06b('0x1d')]['syncNewchannel']=function(_0x2c5b89){if(_0x2c5b89[_0xd06b('0x1e')]===_0xd06b('0x1f')){for(var _0x3c5eb1 in this[_0xd06b('0xd')]){if(this[_0xd06b('0xd')][_0xd06b('0x20')](_0x3c5eb1)){if(_0x2c5b89['exten']===this['faxAccounts'][_0x3c5eb1][_0xd06b('0x21')]){this[_0xd06b('0xc')][_0x2c5b89[_0xd06b('0x22')]]={};this['channels'][_0x2c5b89[_0xd06b('0x22')]][_0xd06b('0x23')]=_0x2c5b89[_0xd06b('0x23')];this[_0xd06b('0xc')][_0x2c5b89[_0xd06b('0x22')]]['id']=this[_0xd06b('0xd')][_0x3c5eb1]['id'];this[_0xd06b('0xc')][_0x2c5b89[_0xd06b('0x22')]][_0xd06b('0x24')]=this[_0xd06b('0xd')][_0x3c5eb1][_0xd06b('0x24')];logger[_0xd06b('0x25')](_0x2c5b89['uniqueid'],_0xd06b('0x26'));}}}}if(this[_0xd06b('0xf')][_0x2c5b89[_0xd06b('0x22')]]){this[_0xd06b('0xc')][_0x2c5b89[_0xd06b('0x22')]]={};this['channels'][_0x2c5b89[_0xd06b('0x22')]][_0xd06b('0x23')]=_0x2c5b89['channel'];logger[_0xd06b('0x25')](_0x2c5b89['uniqueid'],_0xd06b('0x26'));}};Fax['prototype']['syncVarSet']=function(_0x36bfc5){if(this['channels'][_0x36bfc5[_0xd06b('0x22')]]){for(var _0x29df24 in _0x36bfc5[_0xd06b('0x27')]){if(_0x36bfc5[_0xd06b('0x27')][_0xd06b('0x20')](_0x29df24)){this[_0xd06b('0xc')][_0x36bfc5['uniqueid']][_0x29df24]=_0x36bfc5[_0xd06b('0x28')];}}}};Fax['prototype'][_0xd06b('0x15')]=function(_0x5e306a){if(this['channels'][_0x5e306a['uniqueid']]){this[_0xd06b('0xc')][_0x5e306a[_0xd06b('0x22')]][_0xd06b('0x29')]=_0x5e306a[_0xd06b('0x29')];this[_0xd06b('0xc')][_0x5e306a[_0xd06b('0x22')]][_0xd06b('0x2a')]=_0x5e306a[_0xd06b('0x2a')];}};Fax['prototype']['syncNewExten']=function(_0x33320a){if(this[_0xd06b('0xc')][_0x33320a[_0xd06b('0x22')]]){for(var _0x5af044 in _0x33320a[_0xd06b('0x27')]){if(_0x33320a[_0xd06b('0x27')][_0xd06b('0x20')](_0x5af044)){this[_0xd06b('0xc')][_0x33320a[_0xd06b('0x22')]][_0x5af044]=_0x33320a[_0xd06b('0x28')];}}}};Fax[_0xd06b('0x1d')]['syncFaxStatus']=function(_0x1880bb){if(this[_0xd06b('0xc')][_0x1880bb['uniqueid']]){this[_0xd06b('0xc')][_0x1880bb['uniqueid']][_0xd06b('0x2b')]=_0x1880bb[_0xd06b('0x2b')];this[_0xd06b('0xc')][_0x1880bb[_0xd06b('0x22')]]['status']=_0x1880bb[_0xd06b('0x2c')];this['channels'][_0x1880bb[_0xd06b('0x22')]][_0xd06b('0x21')]=_0x1880bb[_0xd06b('0x21')];this['channels'][_0x1880bb['uniqueid']][_0xd06b('0x2d')]=_0x1880bb[_0xd06b('0x2d')];logger[_0xd06b('0x25')](_0x1880bb[_0xd06b('0x22')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x40f4a8){var _0x220552=this;if(this[_0xd06b('0xc')][_0x40f4a8['uniqueid']]){var _0x48f4d2=this['channels'][_0x40f4a8[_0xd06b('0x22')]]['id'];this[_0xd06b('0xc')][_0x40f4a8[_0xd06b('0x22')]][_0xd06b('0x2e')]=_0x40f4a8[_0xd06b('0x2e')];this[_0xd06b('0xc')][_0x40f4a8[_0xd06b('0x22')]][_0xd06b('0x2f')]=_0x40f4a8[_0xd06b('0x2f')];this[_0xd06b('0xc')][_0x40f4a8[_0xd06b('0x22')]]['localstationid']=_0x40f4a8['localstationid'];this[_0xd06b('0xc')][_0x40f4a8['uniqueid']][_0xd06b('0x30')]=_0x40f4a8['resolution'];this[_0xd06b('0xc')][_0x40f4a8['uniqueid']][_0xd06b('0x31')]=_0x40f4a8['transferrate'];this[_0xd06b('0xc')][_0x40f4a8[_0xd06b('0x22')]]['filename']=_0x40f4a8[_0xd06b('0x2d')];this['channels'][_0x40f4a8[_0xd06b('0x22')]]['calleridnum']=_0x40f4a8[_0xd06b('0x32')];if(this[_0xd06b('0xc')][_0x40f4a8[_0xd06b('0x22')]][_0xd06b('0x2f')]>0x0){tiff2pdf(_0x40f4a8[_0xd06b('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x56614f){logger[_0xd06b('0x25')](_0x40f4a8['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x56614f[_0xd06b('0x33')]);attachment[_0xd06b('0x34')]({'name':path[_0xd06b('0x35')](_0x40f4a8[_0xd06b('0x2d')])[_0xd06b('0x24')],'basename':path[_0xd06b('0x35')](_0x40f4a8[_0xd06b('0x2d')])[_0xd06b('0x24')]+'.pdf','type':_0xd06b('0x36')})['then'](function(_0x2b6054){faxAccount['notify'](_0x48f4d2,{'from':_0x40f4a8['calleridnum'],'mapKey':_0xd06b('0x6'),'body':path[_0xd06b('0x35')](_0x40f4a8['filename'])['name']+'.pdf','AttachmentId':_0x2b6054['id']})[_0xd06b('0x37')](function(_0x21d461){logger[_0xd06b('0x38')](_0x40f4a8[_0xd06b('0x22')],_0xd06b('0x39'),JSON[_0xd06b('0x3a')](_0x21d461));});})['catch'](function(_0x437286){logger['error'](_0x40f4a8[_0xd06b('0x22')],_0xd06b('0x3b'),JSON['stringify'](_0x437286));});});}logger[_0xd06b('0x25')](_0x40f4a8['uniqueid'],_0xd06b('0x3b'));}};Fax['prototype'][_0xd06b('0x1c')]=function(_0x21d1cf){if(this[_0xd06b('0xf')][_0x21d1cf[_0xd06b('0x22')]]){_[_0xd06b('0x3c')](this[_0xd06b('0xc')][_0x21d1cf[_0xd06b('0x22')]],_[_0xd06b('0x3d')](_0x21d1cf,[_0xd06b('0x3e'),'reason']));}};function updateStatus(_0x3c2330){if(_0x3c2330[_0xd06b('0x3f')]){faxMessage['update'](_0x3c2330[_0xd06b('0x3f')],{'failMessage':_0xd06b('0x40')})['then'](function(_0x5726e1){ut[_0xd06b('0x41')](_0xd06b('0x42'),_0x5726e1);})[_0xd06b('0x37')](function(_0x14477d){ut[_0xd06b('0x41')](_0xd06b('0x43'),_0x14477d);});}else{ut[_0xd06b('0x41')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd06b('0x1d')][_0xd06b('0x44')]=function(_0x5bbb47,_0x13c306,_0x179c36){var _0x5e29b0=this;var _0x5971de={};if(_0x13c306){_0x5971de={'read':_0x13c306};}else{_0x5971de={'failMessage':_0x179c36};}if(this[_0xd06b('0xf')][_0x5bbb47]['AttachmentId']){faxMessage[_0xd06b('0x45')](this[_0xd06b('0xf')][_0x5bbb47][_0xd06b('0x3f')],_0x5971de)[_0xd06b('0x46')](function(_0x379ef4){ut[_0xd06b('0x41')](_0xd06b('0x47'),_0x379ef4);})[_0xd06b('0x37')](function(_0x44f776){ut[_0xd06b('0x41')]('[Fax][Message][NoUpdate1]',_0x44f776);})[_0xd06b('0x48')](function(){delete _0x5e29b0[_0xd06b('0xc')][_0x5bbb47];delete _0x5e29b0['actions'][_0x5bbb47];});}else{ut[_0xd06b('0x41')](_0xd06b('0x49'));delete this['channels'][_0x5bbb47];delete this[_0xd06b('0xf')][_0x5bbb47];}};Fax[_0xd06b('0x1d')][_0xd06b('0x1a')]=function(_0x4d4083){var _0x51eb05=this;if(this['channels'][_0x4d4083['uniqueid']]){if(this['actions'][_0x4d4083[_0xd06b('0x22')]]){this['channels'][_0x4d4083['uniqueid']]['id']=this[_0xd06b('0xf')][_0x4d4083[_0xd06b('0x22')]]['id'];this[_0xd06b('0xc')][_0x4d4083[_0xd06b('0x22')]][_0xd06b('0x24')]=this[_0xd06b('0xf')][_0x4d4083['uniqueid']]['name'];}logger[_0xd06b('0x25')](_0x4d4083['uniqueid'],this['actions'][_0x4d4083[_0xd06b('0x22')]]?_0xd06b('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0xd06b('0x3a')](this[_0xd06b('0xc')][_0x4d4083[_0xd06b('0x22')]]));if(this[_0xd06b('0xf')][_0x4d4083[_0xd06b('0x22')]]){if(this[_0xd06b('0xc')][_0x4d4083[_0xd06b('0x22')]]['faxpages']>0x0&&this[_0xd06b('0xc')][_0x4d4083['uniqueid']][_0xd06b('0x17')]===_0xd06b('0x4b')){this['updateStatus'](_0x4d4083[_0xd06b('0x22')],!![]);}else{this[_0xd06b('0x44')](_0x4d4083[_0xd06b('0x22')],![],this['channels'][_0x4d4083[_0xd06b('0x22')]][_0xd06b('0x4c')]?_0xd06b('0x4d')+this[_0xd06b('0xc')][_0x4d4083['uniqueid']][_0xd06b('0x4c')]:_0xd06b('0x4e'));}}}};Fax[_0xd06b('0x1d')]['send']=function(_0x5e1e13){var _0x415aae=this;return new BPromise(function(_0x225ecd,_0x1d8d0d){_0x415aae['execOriginate'](_0x5e1e13,_0x415aae[_0xd06b('0xd')][_0x5e1e13['FaxAccountId']])['then'](function(_0x54ec56){ut['logger']('[Fax][execOriginate][success]',_0x54ec56);_0x225ecd(ut['message'](_0xd06b('0x4f')));})['catch'](function(_0x19a4e5){ut[_0xd06b('0x41')](_0xd06b('0x50'),_0x19a4e5);updateStatus(_0x5e1e13);_0x1d8d0d(ut[_0xd06b('0x33')](_0xd06b('0x51')));});});};Fax[_0xd06b('0x1d')][_0xd06b('0x52')]=function(_0x1a0223){var _0x51e632=this;return new BPromise(function(_0x568571,_0x49d90d){var _0x536527=_0x51e632[_0xd06b('0x53')](_0x51e632[_0xd06b('0xd')][_0x1a0223[_0xd06b('0x54')]][_0xd06b('0x55')],_0x1a0223);if(_0x536527[_0xd06b('0x56')]){_0x568571(ut['message'](_0xd06b('0x57')));}else{_0x49d90d(ut[_0xd06b('0x33')](_0x536527[_0xd06b('0x33')]));}});};function originate(_0x702e1f,_0x1be1dd,_0x360c1c){return new BPromise(function(_0x2e71af,_0x6569c7){if(_0x360c1c){var _0x1ab1b5=util[_0xd06b('0x58')]('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[_0xd06b('0x35')](_0x702e1f[_0xd06b('0x2')])[_0xd06b('0x24')],_0x702e1f['path']);gs[_0xd06b('0x59')](_0x1ab1b5)[_0xd06b('0x46')](function(){_0x702e1f[_0xd06b('0x2')]=util[_0xd06b('0x58')]('%s/%s.tif',path['parse'](_0x702e1f[_0xd06b('0x2')])[_0xd06b('0x5a')],path['parse'](_0x702e1f[_0xd06b('0x2')])[_0xd06b('0x24')]);_0x1be1dd[_0xd06b('0x5b')]=_0x702e1f[_0xd06b('0x2')];ut[_0xd06b('0x41')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x702e1f,_0x1be1dd))['then'](function(_0x5a121c){_0x2e71af(_0x5a121c);})[_0xd06b('0x37')](function(_0x30f297){_0x6569c7(_0x30f297);});})[_0xd06b('0x37')](function(_0x17d2c6){_0x6569c7(_0x17d2c6);});}else{ami[_0xd06b('0x5c')](ut[_0xd06b('0x5d')](_0x702e1f,_0x1be1dd))['then'](function(_0x590c36){_0x2e71af(_0x590c36);})[_0xd06b('0x37')](function(_0x41f59b){_0x6569c7(_0x41f59b);});}});}Fax['prototype'][_0xd06b('0x5e')]=function(_0x58f290,_0x6521fa){var _0x35a67d=this;return new BPromise(function(_0x167b9e,_0x5a9377){var _0x50a784=uuid['v4']();var _0xc07bab=ut[_0xd06b('0x5f')](_0x58f290,_0x6521fa);_0x35a67d[_0xd06b('0xf')][_0x50a784]=new Action(_0x50a784,_0x6521fa,_0x58f290);var _0x1c81b1=_0x35a67d[_0xd06b('0xf')][_0x50a784];if(path[_0xd06b('0x35')](_0x58f290['path'])[_0xd06b('0x60')]===_0xd06b('0x61')){originate(_0x1c81b1,_0xc07bab,!![])[_0xd06b('0x46')](function(_0x3d31eb){_0x167b9e(_0x3d31eb);})[_0xd06b('0x37')](function(_0x1b983d){_0x5a9377(_0x1b983d);});}else{originate(_0x1c81b1,_0xc07bab,![])[_0xd06b('0x46')](function(_0x13029c){_0x167b9e(_0x13029c);})[_0xd06b('0x37')](function(_0x17d4e4){_0x5a9377(_0x17d4e4);});}});};Fax[_0xd06b('0x1d')][_0xd06b('0x62')]=function(_0x170155){return!_['isNil'](_0x170155)&&!_[_0xd06b('0x63')](_0x170155[_0xd06b('0x24')])&&!_['isNil'](_0x170155[_0xd06b('0x64')])&&_0x170155[_0xd06b('0x64')]&&!_[_0xd06b('0x63')](this[_0xd06b('0xe')][util[_0xd06b('0x58')]('SIP/%s',_0x170155[_0xd06b('0x24')])])&&!_[_0xd06b('0x63')](this['trunks'][util[_0xd06b('0x58')](_0xd06b('0x65'),_0x170155[_0xd06b('0x24')])][_0xd06b('0x2c')])&&(this[_0xd06b('0xe')][util[_0xd06b('0x58')]('SIP/%s',_0x170155[_0xd06b('0x24')])][_0xd06b('0x2c')]===_0xd06b('0x66')||this['trunks'][util[_0xd06b('0x58')]('SIP/%s',_0x170155[_0xd06b('0x24')])][_0xd06b('0x2c')]===_0xd06b('0x67'));};Fax[_0xd06b('0x1d')][_0xd06b('0x53')]=function(_0x2df40c,_0x257f81){if(!this[_0xd06b('0x62')](_0x2df40c)){ut[_0xd06b('0x41')](_0xd06b('0x68'),_[_0xd06b('0x63')](_0x2df40c)?'':_0x2df40c[_0xd06b('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xd06b('0x63')](_0x257f81[_0xd06b('0x6')])){ut[_0xd06b('0x41')](_0xd06b('0x69'),JSON[_0xd06b('0x3a')](_0x257f81));return{'isValid':![],'message':_0xd06b('0x6a')};}if(_[_0xd06b('0x63')](_0x257f81['path'])){ut[_0xd06b('0x41')](_0xd06b('0x6b'),JSON[_0xd06b('0x3a')](_0x257f81));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xd06b('0x6c')};};module[_0xd06b('0x6d')]=Fax; \ No newline at end of file +var _0xd205=['finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','newchannel','varset','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','syncVarSet','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]'];(function(_0x362525,_0x30848a){var _0x7a7f5a=function(_0x3defeb){while(--_0x3defeb){_0x362525['push'](_0x362525['shift']());}};_0x7a7f5a(++_0x30848a);}(_0xd205,0xa0));var _0x5d20=function(_0x266533,_0x410018){_0x266533=_0x266533-0x0;var _0x4e6e53=_0xd205[_0x266533];return _0x4e6e53;};'use strict';var util=require('util');var _=require(_0x5d20('0x0'));var BPromise=require(_0x5d20('0x1'));var uuid=require(_0x5d20('0x2'));var moment=require(_0x5d20('0x3'));var path=require(_0x5d20('0x4'));var tiff2pdf=require(_0x5d20('0x5'));var gs=require(_0x5d20('0x6'));var logger=require(_0x5d20('0x7'))(_0x5d20('0x8'));var ami=require(_0x5d20('0x9'));var rpcDb=require(_0x5d20('0xa'));var Channel=require(_0x5d20('0xb'));var ut=require(_0x5d20('0xc'));var Action=require('./action');var faxAccount=require(_0x5d20('0xd'));var attachment=require(_0x5d20('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x14d788){this['channels']={};this[_0x5d20('0xf')]=_0x14d788[_0x5d20('0xf')];this['trunks']=_0x14d788[_0x5d20('0x10')];this['actions']={};ami['on'](_0x5d20('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0x5d20('0x12'),this['syncVarSet'][_0x5d20('0x13')](this));ami['on'](_0x5d20('0x14'),this[_0x5d20('0x15')][_0x5d20('0x13')](this));ami['on'](_0x5d20('0x16'),this['syncNewExten'][_0x5d20('0x13')](this));ami['on'](_0x5d20('0x17'),this[_0x5d20('0x18')]['bind'](this));ami['on']('receivefax',this[_0x5d20('0x19')][_0x5d20('0x13')](this));ami['on']('hangup',this[_0x5d20('0x1a')][_0x5d20('0x13')](this));ami['on'](_0x5d20('0x1b'),this['syncOriginateResponse'][_0x5d20('0x13')](this));}Fax['prototype'][_0x5d20('0x1c')]=function(_0x466d02){if(_0x466d02[_0x5d20('0x1d')]===_0x5d20('0x1e')){for(var _0x357c53 in this['faxAccounts']){if(this[_0x5d20('0xf')][_0x5d20('0x1f')](_0x357c53)){if(_0x466d02[_0x5d20('0x20')]===this['faxAccounts'][_0x357c53][_0x5d20('0x21')]){this[_0x5d20('0x22')][_0x466d02[_0x5d20('0x23')]]={};this[_0x5d20('0x22')][_0x466d02['uniqueid']]['channel']=_0x466d02[_0x5d20('0x24')];this[_0x5d20('0x22')][_0x466d02[_0x5d20('0x23')]]['id']=this[_0x5d20('0xf')][_0x357c53]['id'];this[_0x5d20('0x22')][_0x466d02[_0x5d20('0x23')]][_0x5d20('0x25')]=this[_0x5d20('0xf')][_0x357c53][_0x5d20('0x25')];logger[_0x5d20('0x26')](_0x466d02[_0x5d20('0x23')],_0x5d20('0x27'));}}}}if(this[_0x5d20('0x28')][_0x466d02['uniqueid']]){this['channels'][_0x466d02['uniqueid']]={};this[_0x5d20('0x22')][_0x466d02[_0x5d20('0x23')]]['channel']=_0x466d02['channel'];logger[_0x5d20('0x26')](_0x466d02[_0x5d20('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x5d20('0x29')][_0x5d20('0x2a')]=function(_0x2477ba){if(this[_0x5d20('0x22')][_0x2477ba[_0x5d20('0x23')]]){for(var _0x33f219 in _0x2477ba[_0x5d20('0x2b')]){if(_0x2477ba[_0x5d20('0x2b')]['hasOwnProperty'](_0x33f219)){this[_0x5d20('0x22')][_0x2477ba[_0x5d20('0x23')]][_0x33f219]=_0x2477ba['value'];}}}};Fax[_0x5d20('0x29')][_0x5d20('0x15')]=function(_0x4c47ee){if(this[_0x5d20('0x22')][_0x4c47ee[_0x5d20('0x23')]]){this['channels'][_0x4c47ee['uniqueid']][_0x5d20('0x2c')]=_0x4c47ee['channelstate'];this[_0x5d20('0x22')][_0x4c47ee[_0x5d20('0x23')]]['channelstatedesc']=_0x4c47ee[_0x5d20('0x2d')];}};Fax['prototype'][_0x5d20('0x2e')]=function(_0x262b38){if(this[_0x5d20('0x22')][_0x262b38[_0x5d20('0x23')]]){for(var _0xf4b20f in _0x262b38['variable']){if(_0x262b38[_0x5d20('0x2b')]['hasOwnProperty'](_0xf4b20f)){this['channels'][_0x262b38[_0x5d20('0x23')]][_0xf4b20f]=_0x262b38[_0x5d20('0x2f')];}}}};Fax[_0x5d20('0x29')]['syncFaxStatus']=function(_0x1e637d){if(this[_0x5d20('0x22')][_0x1e637d[_0x5d20('0x23')]]){this[_0x5d20('0x22')][_0x1e637d[_0x5d20('0x23')]]['operation']=_0x1e637d[_0x5d20('0x30')];this['channels'][_0x1e637d['uniqueid']][_0x5d20('0x31')]=_0x1e637d['status'];this[_0x5d20('0x22')][_0x1e637d[_0x5d20('0x23')]][_0x5d20('0x21')]=_0x1e637d[_0x5d20('0x21')];this[_0x5d20('0x22')][_0x1e637d['uniqueid']][_0x5d20('0x32')]=_0x1e637d['filename'];logger[_0x5d20('0x26')](_0x1e637d[_0x5d20('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x5d20('0x29')][_0x5d20('0x19')]=function(_0x2d334b){var _0x17f927=this;if(this['channels'][_0x2d334b['uniqueid']]){var _0x29a928=this[_0x5d20('0x22')][_0x2d334b['uniqueid']]['id'];this['channels'][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x33')]=_0x2d334b[_0x5d20('0x33')];this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x34')]=_0x2d334b[_0x5d20('0x34')];this['channels'][_0x2d334b['uniqueid']]['localstationid']=_0x2d334b[_0x5d20('0x21')];this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]]['resolution']=_0x2d334b['resolution'];this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x35')]=_0x2d334b[_0x5d20('0x35')];this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x32')]=_0x2d334b['filename'];this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x36')]=_0x2d334b[_0x5d20('0x36')];if(this[_0x5d20('0x22')][_0x2d334b[_0x5d20('0x23')]][_0x5d20('0x34')]>0x0){tiff2pdf(_0x2d334b[_0x5d20('0x32')],_0x5d20('0x37'),function(_0x71af78){logger[_0x5d20('0x26')](_0x2d334b['uniqueid'],_0x5d20('0x38'),_0x71af78[_0x5d20('0x39')]);attachment[_0x5d20('0x3a')]({'name':path['parse'](_0x2d334b['filename'])[_0x5d20('0x25')],'basename':path[_0x5d20('0x3b')](_0x2d334b[_0x5d20('0x32')])[_0x5d20('0x25')]+'.pdf','type':_0x5d20('0x3c')})[_0x5d20('0x3d')](function(_0x435b00){faxAccount[_0x5d20('0x3e')](_0x29a928,{'from':_0x2d334b[_0x5d20('0x36')],'mapKey':_0x5d20('0x8'),'body':path[_0x5d20('0x3b')](_0x2d334b[_0x5d20('0x32')])[_0x5d20('0x25')]+_0x5d20('0x3f'),'AttachmentId':_0x435b00['id']})[_0x5d20('0x40')](function(_0x110754){logger[_0x5d20('0x41')](_0x2d334b[_0x5d20('0x23')],_0x5d20('0x42'),JSON[_0x5d20('0x43')](_0x110754));});})[_0x5d20('0x40')](function(_0x128f1d){logger['error'](_0x2d334b[_0x5d20('0x23')],_0x5d20('0x44'),JSON[_0x5d20('0x43')](_0x128f1d));});});}logger[_0x5d20('0x26')](_0x2d334b[_0x5d20('0x23')],_0x5d20('0x44'));}};Fax['prototype'][_0x5d20('0x45')]=function(_0x179aa3){if(this[_0x5d20('0x28')][_0x179aa3['uniqueid']]){_[_0x5d20('0x46')](this['channels'][_0x179aa3['uniqueid']],_[_0x5d20('0x47')](_0x179aa3,[_0x5d20('0x48'),_0x5d20('0x49')]));}};function updateStatus(_0x4a2794){if(_0x4a2794[_0x5d20('0x4a')]){faxMessage[_0x5d20('0x4b')](_0x4a2794[_0x5d20('0x4a')],{'failMessage':_0x5d20('0x4c')})['then'](function(_0x1116a8){ut[_0x5d20('0x4d')](_0x5d20('0x4e'),_0x1116a8);})['catch'](function(_0x543a14){ut[_0x5d20('0x4d')](_0x5d20('0x4f'),_0x543a14);});}else{ut[_0x5d20('0x4d')](_0x5d20('0x50'));}}Fax[_0x5d20('0x29')]['updateStatus']=function(_0x2a289d,_0x5b3505,_0x5141c8){var _0x5931ac=this;var _0x428e3b={};if(_0x5b3505){_0x428e3b={'read':_0x5b3505};}else{_0x428e3b={'failMessage':_0x5141c8};}if(this[_0x5d20('0x28')][_0x2a289d][_0x5d20('0x4a')]){faxMessage[_0x5d20('0x4b')](this[_0x5d20('0x28')][_0x2a289d][_0x5d20('0x4a')],_0x428e3b)['then'](function(_0x3a6644){ut[_0x5d20('0x4d')]('[Fax][Message][Updated]',_0x3a6644);})[_0x5d20('0x40')](function(_0x570662){ut['logger'](_0x5d20('0x51'),_0x570662);})[_0x5d20('0x52')](function(){delete _0x5931ac['channels'][_0x2a289d];delete _0x5931ac[_0x5d20('0x28')][_0x2a289d];});}else{ut[_0x5d20('0x4d')](_0x5d20('0x53'));delete this[_0x5d20('0x22')][_0x2a289d];delete this[_0x5d20('0x28')][_0x2a289d];}};Fax[_0x5d20('0x29')][_0x5d20('0x1a')]=function(_0x3b5b86){var _0x148c12=this;if(this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]]){if(this[_0x5d20('0x28')][_0x3b5b86[_0x5d20('0x23')]]){this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]]['id']=this[_0x5d20('0x28')][_0x3b5b86[_0x5d20('0x23')]]['id'];this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]][_0x5d20('0x25')]=this[_0x5d20('0x28')][_0x3b5b86[_0x5d20('0x23')]]['name'];}logger[_0x5d20('0x26')](_0x3b5b86[_0x5d20('0x23')],this[_0x5d20('0x28')][_0x3b5b86[_0x5d20('0x23')]]?_0x5d20('0x54'):_0x5d20('0x55'),JSON['stringify'](this['channels'][_0x3b5b86[_0x5d20('0x23')]]));if(this['actions'][_0x3b5b86[_0x5d20('0x23')]]){if(this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]][_0x5d20('0x56')]>0x0&&this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]]['faxstatus']===_0x5d20('0x57')){this['updateStatus'](_0x3b5b86[_0x5d20('0x23')],!![]);}else{this[_0x5d20('0x58')](_0x3b5b86[_0x5d20('0x23')],![],this[_0x5d20('0x22')][_0x3b5b86['uniqueid']][_0x5d20('0x59')]?_0x5d20('0x5a')+this[_0x5d20('0x22')][_0x3b5b86[_0x5d20('0x23')]]['faxstatusstring']:_0x5d20('0x5b'));}}}};Fax[_0x5d20('0x29')][_0x5d20('0x5c')]=function(_0x551bfc){var _0x4a83f8=this;return new BPromise(function(_0x23b432,_0x32cb85){_0x4a83f8['execOriginate'](_0x551bfc,_0x4a83f8[_0x5d20('0xf')][_0x551bfc[_0x5d20('0x5d')]])['then'](function(_0x567de7){ut[_0x5d20('0x4d')](_0x5d20('0x5e'),_0x567de7);_0x23b432(ut[_0x5d20('0x39')](_0x5d20('0x5f')));})[_0x5d20('0x40')](function(_0x83ab06){ut['logger'](_0x5d20('0x60'),_0x83ab06);updateStatus(_0x551bfc);_0x32cb85(ut[_0x5d20('0x39')](_0x5d20('0x61')));});});};Fax['prototype']['checkAfterSend']=function(_0x137847){var _0xccef0d=this;return new BPromise(function(_0x3391f7,_0x5b151a){var _0xe197d=_0xccef0d[_0x5d20('0x62')](_0xccef0d['faxAccounts'][_0x137847[_0x5d20('0x5d')]][_0x5d20('0x63')],_0x137847);if(_0xe197d['isValid']){_0x3391f7(ut[_0x5d20('0x39')](_0x5d20('0x64')));}else{_0x5b151a(ut[_0x5d20('0x39')](_0xe197d[_0x5d20('0x39')]));}});};function originate(_0x31755b,_0x49ad05,_0x23842f){return new BPromise(function(_0x5a6070,_0x2f2ce3){if(_0x23842f){var _0x126496=util[_0x5d20('0x65')](_0x5d20('0x66'),path['parse'](_0x31755b['path'])[_0x5d20('0x25')],_0x31755b[_0x5d20('0x4')]);gs[_0x5d20('0x67')](_0x126496)['then'](function(){_0x31755b['path']=util['format'](_0x5d20('0x68'),path[_0x5d20('0x3b')](_0x31755b[_0x5d20('0x4')])[_0x5d20('0x69')],path[_0x5d20('0x3b')](_0x31755b['path'])[_0x5d20('0x25')]);_0x49ad05[_0x5d20('0x6a')]=_0x31755b['path'];ut[_0x5d20('0x4d')](_0x5d20('0x6b'),'');ami[_0x5d20('0x6c')](ut[_0x5d20('0x6d')](_0x31755b,_0x49ad05))[_0x5d20('0x3d')](function(_0x20f7c9){_0x5a6070(_0x20f7c9);})[_0x5d20('0x40')](function(_0x151e5c){_0x2f2ce3(_0x151e5c);});})[_0x5d20('0x40')](function(_0x41f712){_0x2f2ce3(_0x41f712);});}else{ami['Action'](ut[_0x5d20('0x6d')](_0x31755b,_0x49ad05))[_0x5d20('0x3d')](function(_0x362567){_0x5a6070(_0x362567);})[_0x5d20('0x40')](function(_0x350a8c){_0x2f2ce3(_0x350a8c);});}});}Fax['prototype']['execOriginate']=function(_0x5c2f94,_0x3acb02){var _0x2f9ff4=this;return new BPromise(function(_0x316602,_0x547c69){var _0x44d2e3=uuid['v4']();var _0x1d1240=ut[_0x5d20('0x6e')](_0x5c2f94,_0x3acb02);_0x2f9ff4[_0x5d20('0x28')][_0x44d2e3]=new Action(_0x44d2e3,_0x3acb02,_0x5c2f94);var _0x185297=_0x2f9ff4[_0x5d20('0x28')][_0x44d2e3];if(path['parse'](_0x5c2f94[_0x5d20('0x4')])[_0x5d20('0x6f')]===_0x5d20('0x3f')){originate(_0x185297,_0x1d1240,!![])[_0x5d20('0x3d')](function(_0x444e43){_0x316602(_0x444e43);})[_0x5d20('0x40')](function(_0x4e6a55){_0x547c69(_0x4e6a55);});}else{originate(_0x185297,_0x1d1240,![])[_0x5d20('0x3d')](function(_0x352e1d){_0x316602(_0x352e1d);})[_0x5d20('0x40')](function(_0xbbaba0){_0x547c69(_0xbbaba0);});}});};Fax[_0x5d20('0x29')]['isTrunkReachable']=function(_0x4613ea){return!_[_0x5d20('0x70')](_0x4613ea)&&!_[_0x5d20('0x70')](_0x4613ea[_0x5d20('0x25')])&&!_['isNil'](_0x4613ea[_0x5d20('0x71')])&&_0x4613ea[_0x5d20('0x71')]&&!_[_0x5d20('0x70')](this[_0x5d20('0x10')][util[_0x5d20('0x65')]('SIP/%s',_0x4613ea[_0x5d20('0x25')])])&&!_[_0x5d20('0x70')](this['trunks'][util[_0x5d20('0x65')]('SIP/%s',_0x4613ea['name'])]['status'])&&(this[_0x5d20('0x10')][util[_0x5d20('0x65')](_0x5d20('0x72'),_0x4613ea[_0x5d20('0x25')])]['status']==='reachable'||this[_0x5d20('0x10')][util[_0x5d20('0x65')](_0x5d20('0x72'),_0x4613ea[_0x5d20('0x25')])][_0x5d20('0x31')]===_0x5d20('0x73'));};Fax[_0x5d20('0x29')][_0x5d20('0x62')]=function(_0x33d7cb,_0x36ecfe){if(!this['isTrunkReachable'](_0x33d7cb)){ut[_0x5d20('0x4d')](_0x5d20('0x74'),_[_0x5d20('0x70')](_0x33d7cb)?'':_0x33d7cb['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x5d20('0x70')](_0x36ecfe[_0x5d20('0x8')])){ut[_0x5d20('0x4d')](_0x5d20('0x75'),JSON[_0x5d20('0x43')](_0x36ecfe));return{'isValid':![],'message':_0x5d20('0x76')};}if(_[_0x5d20('0x70')](_0x36ecfe[_0x5d20('0x4')])){ut[_0x5d20('0x4d')](_0x5d20('0x77'),JSON['stringify'](_0x36ecfe));return{'isValid':![],'message':_0x5d20('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 775a3f8..c19e406 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 _0x18ca=['inspect','notify','resolve','then','[Notify]\x20','util','preview','lodash','../rpc/faxAccount'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x18ca,0x152));var _0xa18c=function(_0x5cae87,_0x5984ee){_0x5cae87=_0x5cae87-0x0;var _0x11bd60=_0x18ca[_0x5cae87];return _0x11bd60;};'use strict';var util=require(_0xa18c('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xa18c('0x1'));var _=require(_0xa18c('0x2'));var faxAccount=require(_0xa18c('0x3'));function loggerCatch(_0x350a6d){return function(_0x1b3cd1){logger['error'](_0x350a6d,util[_0xa18c('0x4')](_0x1b3cd1,{'showHidden':![],'depth':null}));};}exports[_0xa18c('0x5')]=function(_0x476c93,_0x354409){return BPromise[_0xa18c('0x6')]()[_0xa18c('0x7')](faxAccount[_0xa18c('0x5')](_0x476c93,_0x354409))['catch'](loggerCatch(_0xa18c('0x8')));}; \ No newline at end of file +var _0x0e3d=['bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','notify','then','[Notify]\x20'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0e3d,0x78));var _0xd0e3=function(_0x343fc8,_0x3fe674){_0x343fc8=_0x343fc8-0x0;var _0x41b3eb=_0x0e3d[_0x343fc8];return _0x41b3eb;};'use strict';var util=require('util');var BPromise=require(_0xd0e3('0x0'));var logger=require(_0xd0e3('0x1'))(_0xd0e3('0x2'));var _=require('lodash');var faxAccount=require(_0xd0e3('0x3'));function loggerCatch(_0x1a3ab5){return function(_0x4ce5ca){logger['error'](_0x1a3ab5,util[_0xd0e3('0x4')](_0x4ce5ca,{'showHidden':![],'depth':null}));};}exports[_0xd0e3('0x5')]=function(_0x2b62a5,_0x3cff5c){return BPromise['resolve']()[_0xd0e3('0x6')](faxAccount[_0xd0e3('0x5')](_0x2b62a5,_0x3cff5c))['catch'](loggerCatch(_0xd0e3('0x7')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 32e4a50..ccf12ff 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 _0xb3e8=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x1ae104,_0x4aab68){var _0x5f5639=function(_0x36aa8c){while(--_0x36aa8c){_0x1ae104['push'](_0x1ae104['shift']());}};_0x5f5639(++_0x4aab68);}(_0xb3e8,0x6a));var _0x8b3e=function(_0xcd49bd,_0x2a12a3){_0xcd49bd=_0xcd49bd-0x0;var _0xb6ee44=_0xb3e8[_0xcd49bd];return _0xb6ee44;};'use strict';var util=require(_0x8b3e('0x0'));var logger=require(_0x8b3e('0x1'))(_0x8b3e('0x2'));var BPromise=require(_0x8b3e('0x3'));var exec=require(_0x8b3e('0x4'))[_0x8b3e('0x5')];exports[_0x8b3e('0x6')]=function(_0x3e4f7a){return new BPromise(function(_0x1f5f5e,_0x3f9d17){exec(_0x3e4f7a,function(_0x38c78e,_0x470675,_0x336910){logger[_0x8b3e('0x7')](_0x8b3e('0x8'),_0x470675);if(_0x38c78e){logger[_0x8b3e('0x7')](_0x8b3e('0x8'),_0x8b3e('0x9'),util[_0x8b3e('0xa')](_0x38c78e,{'showHidden':![],'depth':null}),_0x470675,_0x336910);_0x3f9d17(_0x38c78e);}_0x1f5f5e(_0x470675);});});}; \ No newline at end of file +var _0xdbc5=['util','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x462b3f,_0xfc3638){var _0x1edff9=function(_0x505cfc){while(--_0x505cfc){_0x462b3f['push'](_0x462b3f['shift']());}};_0x1edff9(++_0xfc3638);}(_0xdbc5,0x120));var _0x5dbc=function(_0x452f04,_0x3706fd){_0x452f04=_0x452f04-0x0;var _0x2d135f=_0xdbc5[_0x452f04];return _0x2d135f;};'use strict';var util=require(_0x5dbc('0x0'));var logger=require(_0x5dbc('0x1'))(_0x5dbc('0x2'));var BPromise=require(_0x5dbc('0x3'));var exec=require('child_process')[_0x5dbc('0x4')];exports[_0x5dbc('0x5')]=function(_0x1baec7){return new BPromise(function(_0x3f5218,_0x12f978){exec(_0x1baec7,function(_0x25ec3c,_0x40481c,_0x440504){logger[_0x5dbc('0x6')](_0x5dbc('0x7'),_0x40481c);if(_0x25ec3c){logger[_0x5dbc('0x6')](_0x5dbc('0x7'),_0x5dbc('0x8'),util['inspect'](_0x25ec3c,{'showHidden':![],'depth':null}),_0x40481c,_0x440504);_0x12f978(_0x25ec3c);}_0x3f5218(_0x40481c);});});}; \ 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 d0f545a..cb66040 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 _0xfc79=['format','gateway','faxdetect','t38timeout','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','moment','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0xd0a290,_0x55cb33){var _0x377b3d=function(_0x56d2e0){while(--_0x56d2e0){_0xd0a290['push'](_0xd0a290['shift']());}};_0x377b3d(++_0x55cb33);}(_0xfc79,0x1c3));var _0x9fc7=function(_0x3ad5a6,_0x485c90){_0x3ad5a6=_0x3ad5a6-0x0;var _0x3ddbb3=_0xfc79[_0x3ad5a6];return _0x3ddbb3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9fc7('0x0'));var logger=require('../../../../config/logger')('fax');exports[_0x9fc7('0x1')]=function(_0x3ca9e0){return{'message':_0x3ca9e0};};exports[_0x9fc7('0x2')]=function(_0x3b18a5,_0x593427){logger[_0x9fc7('0x3')](_0x3b18a5,util[_0x9fc7('0x4')](_0x593427,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x32c028,_0x517ce1){var _0x2b6bdf={'XMF-ECM':_0x517ce1[_0x9fc7('0x5')],'XMF-HEADERINFO':_0x517ce1[_0x9fc7('0x6')],'XMF-MINRATE':_0x517ce1[_0x9fc7('0x7')],'XMF-MAXRATE':_0x517ce1[_0x9fc7('0x8')],'XMF-MODEM':util[_0x9fc7('0x9')]('\x22%s\x22',_0x517ce1['modem']),'XMF-GATEWAY':_0x517ce1[_0x9fc7('0xa')],'XMF-FAXDETECT':_0x517ce1[_0x9fc7('0xb')],'XMF-T38TIMEOUT':_0x517ce1[_0x9fc7('0xc')],'XMF-LOCALSTATIONID':_0x517ce1['localstationid'],'XMF-PATH':_0x32c028['path']};return _0x2b6bdf;};exports[_0x9fc7('0xd')]=function(_0xb99cac,_0x22fa21){return{'actionid':_0xb99cac[_0x9fc7('0xe')],'action':'originate','channel':_0xb99cac[_0x9fc7('0xf')],'Exten':_0x9fc7('0x10'),'Context':_0x9fc7('0x11'),'Priority':'1','callerid':util['format'](_0x9fc7('0x12'),_0xb99cac['headerinfo']?_0xb99cac['headerinfo']:'',_0xb99cac[_0x9fc7('0x13')]),'variable':_0x22fa21,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xb99cac[_0x9fc7('0xe')]};}; \ No newline at end of file +var _0x451d=['headerinfo','util','lodash','fax','info','addVariables','ecm','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x451d,0x65));var _0xd451=function(_0x2d3a70,_0x5548a0){_0x2d3a70=_0x2d3a70-0x0;var _0x2a974d=_0x451d[_0x2d3a70];return _0x2a974d;};'use strict';var util=require(_0xd451('0x0'));var _=require(_0xd451('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xd451('0x2'));exports['message']=function(_0x15d64a){return{'message':_0x15d64a};};exports['logger']=function(_0x3f9564,_0x48844f){logger[_0xd451('0x3')](_0x3f9564,util['inspect'](_0x48844f,{'showHidden':![],'depth':null}));};exports[_0xd451('0x4')]=function(_0x40afb0,_0x2c5b88){var _0x3bb033={'XMF-ECM':_0x2c5b88[_0xd451('0x5')],'XMF-HEADERINFO':_0x2c5b88['headerinfo'],'XMF-MINRATE':_0x2c5b88['minrate'],'XMF-MAXRATE':_0x2c5b88[_0xd451('0x6')],'XMF-MODEM':util[_0xd451('0x7')](_0xd451('0x8'),_0x2c5b88[_0xd451('0x9')]),'XMF-GATEWAY':_0x2c5b88['gateway'],'XMF-FAXDETECT':_0x2c5b88[_0xd451('0xa')],'XMF-T38TIMEOUT':_0x2c5b88[_0xd451('0xb')],'XMF-LOCALSTATIONID':_0x2c5b88[_0xd451('0xc')],'XMF-PATH':_0x40afb0['path']};return _0x3bb033;};exports[_0xd451('0xd')]=function(_0x26b01f,_0x59ee07){return{'actionid':_0x26b01f[_0xd451('0xe')],'action':'originate','channel':_0x26b01f[_0xd451('0xf')],'Exten':_0xd451('0x10'),'Context':_0xd451('0x11'),'Priority':'1','callerid':util[_0xd451('0x7')](_0xd451('0x12'),_0x26b01f[_0xd451('0x13')]?_0x26b01f['headerinfo']:'',_0x26b01f[_0xd451('0xc')]),'variable':_0x59ee07,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x26b01f['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4ebf954..84cae93 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 _0x2a6a=['initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','sync','catch','[index.js][main]','inspect','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./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/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts'];(function(_0xa89b69,_0xcafead){var _0x349ddb=function(_0x333961){while(--_0x333961){_0xa89b69['push'](_0xa89b69['shift']());}};_0x349ddb(++_0xcafead);}(_0x2a6a,0x144));var _0xa2a6=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2a6a[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0xa2a6('0x0'));var moment=require(_0xa2a6('0x1'));var server=require(_0xa2a6('0x2'));var Realtime=require(_0xa2a6('0x3'));var Report=require(_0xa2a6('0x4'));var Acw=require(_0xa2a6('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xa2a6('0x6'));var Preview=require(_0xa2a6('0x7'));var Fax=require(_0xa2a6('0x8'));var user=require(_0xa2a6('0x9'));var voiceQueue=require(_0xa2a6('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xa2a6('0xb'));var trunk=require(_0xa2a6('0xc'));var trigger=require(_0xa2a6('0xd'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xa2a6('0xe'));var voiceExtension=require(_0xa2a6('0xf'));var faxAccount=require(_0xa2a6('0x10'));var zendesk=require(_0xa2a6('0x11'));var salesforce=require(_0xa2a6('0x12'));var sugarcrm=require(_0xa2a6('0x13'));var freshdesk=require(_0xa2a6('0x14'));var desk=require(_0xa2a6('0x15'));var zoho=require(_0xa2a6('0x16'));var vtiger=require(_0xa2a6('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xa2a6('0x18'));var dynamics365=require(_0xa2a6('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xa2a6('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa2a6('0x1b')](_0xa2a6('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa2a6('0x1b')](_0xa2a6('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xa2a6('0x1d')]()[_0xa2a6('0x1e')](user[_0xa2a6('0x1f')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x20')]())[_0xa2a6('0x1e')](user[_0xa2a6('0x21')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x22')]())[_0xa2a6('0x1e')](trunk[_0xa2a6('0x23')]())[_0xa2a6('0x1e')](realtime['initTrunks']())[_0xa2a6('0x1e')](voiceQueue[_0xa2a6('0x24')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x25')]())['then'](trigger[_0xa2a6('0x26')]())['then'](realtime[_0xa2a6('0x27')]())['then'](template['getTemplates']())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x28')]())[_0xa2a6('0x1e')](zendesk[_0xa2a6('0x29')]())['then'](realtime[_0xa2a6('0x2a')]())[_0xa2a6('0x1e')](salesforce[_0xa2a6('0x2b')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x2c')]())[_0xa2a6('0x1e')](sugarcrm[_0xa2a6('0x2d')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x2e')]())[_0xa2a6('0x1e')](freshdesk[_0xa2a6('0x2f')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x30')]())[_0xa2a6('0x1e')](desk[_0xa2a6('0x31')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x32')]())[_0xa2a6('0x1e')](zoho['getZohoAccounts']())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x33')]())[_0xa2a6('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime[_0xa2a6('0x34')]())[_0xa2a6('0x1e')](freshsales[_0xa2a6('0x35')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x36')]())['then'](servicenow[_0xa2a6('0x37')]())['then'](realtime[_0xa2a6('0x38')]())[_0xa2a6('0x1e')](dynamics365[_0xa2a6('0x39')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0xa2a6('0x3a')]())[_0xa2a6('0x1e')](realtime['initCampaigns']())[_0xa2a6('0x1e')](voiceExtension['getVoiceExtensions']())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x3b')]())[_0xa2a6('0x1e')](faxAccount[_0xa2a6('0x3c')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x3d')]())[_0xa2a6('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0xa2a6('0x1d')]()[_0xa2a6('0x1e')](voiceQueueReport[_0xa2a6('0x3e')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x3f')]())[_0xa2a6('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x40')]())[_0xa2a6('0x1e')](cmHopperHistory[_0xa2a6('0x41')]())['then'](realtime[_0xa2a6('0x42')]())[_0xa2a6('0x1e')](voiceCallReport[_0xa2a6('0x43')]())[_0xa2a6('0x1e')](realtime[_0xa2a6('0x44')]())['catch'](function(_0x20cf38){logger[_0xa2a6('0x45')](_0xa2a6('0x46'),util['inspect'](_0x20cf38,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xa2a6('0x1e')](function(){return initRealtime();})[_0xa2a6('0x1e')](function(){return initParams();})[_0xa2a6('0x1e')](function(){report[_0xa2a6('0x47')]();setInterval(initRealtime,0x1388);})[_0xa2a6('0x48')](function(_0x35d9f8){logger[_0xa2a6('0x45')](_0xa2a6('0x49'),util[_0xa2a6('0x4a')](_0x35d9f8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb204=['[index.js][initParams]','inspect','sync','util','./server','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error'];(function(_0x604866,_0x20fee1){var _0xfbffca=function(_0x1a4b48){while(--_0x1a4b48){_0x604866['push'](_0x604866['shift']());}};_0xfbffca(++_0x20fee1);}(_0xb204,0x170));var _0x4b20=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xb204[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x4b20('0x0'));var moment=require('moment');var server=require(_0x4b20('0x1'));var Realtime=require('./realtime');var Report=require(_0x4b20('0x2'));var Acw=require('./acw');var Trigger=require(_0x4b20('0x3'));var Dialer=require(_0x4b20('0x4'));var Preview=require(_0x4b20('0x5'));var Fax=require(_0x4b20('0x6'));var user=require(_0x4b20('0x7'));var voiceQueue=require(_0x4b20('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4b20('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x4b20('0xa'));var template=require(_0x4b20('0xb'));var cmHopperHistory=require(_0x4b20('0xc'));var campaign=require(_0x4b20('0xd'));var voiceExtension=require(_0x4b20('0xe'));var faxAccount=require(_0x4b20('0xf'));var zendesk=require(_0x4b20('0x10'));var salesforce=require(_0x4b20('0x11'));var sugarcrm=require(_0x4b20('0x12'));var freshdesk=require(_0x4b20('0x13'));var desk=require(_0x4b20('0x14'));var zoho=require(_0x4b20('0x15'));var vtiger=require(_0x4b20('0x16'));var freshsales=require(_0x4b20('0x17'));var servicenow=require(_0x4b20('0x18'));var dynamics365=require(_0x4b20('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x4b20('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4b20('0x1b')](_0x4b20('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4b20('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4b20('0x1d')]()[_0x4b20('0x1e')](user[_0x4b20('0x1f')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x20')]())[_0x4b20('0x1e')](user['getTelephones']())['then'](realtime[_0x4b20('0x21')]())['then'](trunk[_0x4b20('0x22')]())[_0x4b20('0x1e')](realtime['initTrunks']())[_0x4b20('0x1e')](voiceQueue[_0x4b20('0x23')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x24')]())[_0x4b20('0x1e')](trigger[_0x4b20('0x25')]())['then'](realtime[_0x4b20('0x26')]())['then'](template[_0x4b20('0x27')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x28')]())[_0x4b20('0x1e')](zendesk[_0x4b20('0x29')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x2a')]())[_0x4b20('0x1e')](salesforce[_0x4b20('0x2b')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x4b20('0x2c')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x2d')]())[_0x4b20('0x1e')](freshdesk[_0x4b20('0x2e')]())['then'](realtime[_0x4b20('0x2f')]())[_0x4b20('0x1e')](desk[_0x4b20('0x30')]())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x4b20('0x31')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x32')]())[_0x4b20('0x1e')](vtiger['getVtigerAccounts']())['then'](realtime[_0x4b20('0x33')]())[_0x4b20('0x1e')](freshsales[_0x4b20('0x34')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x35')]())['then'](servicenow[_0x4b20('0x36')]())['then'](realtime[_0x4b20('0x37')]())[_0x4b20('0x1e')](dynamics365[_0x4b20('0x38')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x39')]())[_0x4b20('0x1e')](campaign[_0x4b20('0x3a')]())[_0x4b20('0x1e')](realtime['initCampaigns']())[_0x4b20('0x1e')](voiceExtension[_0x4b20('0x3b')]())['then'](realtime[_0x4b20('0x3c')]())[_0x4b20('0x1e')](faxAccount[_0x4b20('0x3d')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x3e')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x4b20('0x1d')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4b20('0x1e')](realtime[_0x4b20('0x3f')]())['then'](cmHopperHistory[_0x4b20('0x40')]())['then'](realtime[_0x4b20('0x41')]())[_0x4b20('0x1e')](voiceCallReport[_0x4b20('0x42')]())[_0x4b20('0x1e')](realtime[_0x4b20('0x43')]())[_0x4b20('0x44')](function(_0x8659d0){logger[_0x4b20('0x45')](_0x4b20('0x46'),util[_0x4b20('0x47')](_0x8659d0,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x4b20('0x1e')](function(){return initRealtime();})[_0x4b20('0x1e')](function(){return initParams();})[_0x4b20('0x1e')](function(){report[_0x4b20('0x48')]();setInterval(initRealtime,0x1388);})[_0x4b20('0x44')](function(_0x345d55){logger[_0x4b20('0x45')]('[index.js][main]',util[_0x4b20('0x47')](_0x345d55,{'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 8f7e27d..8c3f741 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 _0x4fb8=['md5','emit','user:ami:update','omit','user:presence','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','fullname','stateTime','status','stringify'];(function(_0x38b590,_0x2be5c0){var _0x1d3664=function(_0x440375){while(--_0x440375){_0x38b590['push'](_0x38b590['shift']());}};_0x1d3664(++_0x2be5c0);}(_0x4fb8,0x10e));var _0x84fb=function(_0x334d92,_0x11c599){_0x334d92=_0x334d92-0x0;var _0x51e5f1=_0x4fb8[_0x334d92];return _0x51e5f1;};'use strict';var _=require(_0x84fb('0x0'));var util=require('util');var moment=require(_0x84fb('0x1'));var md5=require('md5');var Redis=require(_0x84fb('0x2'));var config=require(_0x84fb('0x3'));config[_0x84fb('0x4')]=_[_0x84fb('0x5')](config['redis'],{'host':_0x84fb('0x6'),'port':0x18eb});var io=require(_0x84fb('0x7'))(new Redis(config['redis']));function Agent(_0x57d098){this['id']=_0x57d098['id']||0x0;this[_0x84fb('0x8')]=_0x57d098[_0x84fb('0x8')]||'';this[_0x84fb('0x9')]=_0x57d098['email']||'';this[_0x84fb('0xa')]=_0x57d098[_0x84fb('0xa')]||'';this['fullname']=_0x57d098['fullname']||'';this['state']='unknown';this['stateTime']=0x0;this['status']=_0x84fb('0xb');this[_0x84fb('0xc')]='';this[_0x84fb('0xd')]='';this[_0x84fb('0xe')]='';this[_0x84fb('0xf')]='';this[_0x84fb('0x10')]=_0x57d098[_0x84fb('0x10')]||![];this['voiceStatus']='unknown';this[_0x84fb('0x11')]=0x0;this[_0x84fb('0x12')]='';this[_0x84fb('0x13')]='';this[_0x84fb('0x14')]=![];this[_0x84fb('0x15')]=![];this['md5']='';}Agent[_0x84fb('0x16')][_0x84fb('0x17')]=function(_0x42c541){var _0x878399;if(_0x42c541&&_0x42c541[_0x84fb('0x18')]){_0x878399=_0x42c541['state'][_0x84fb('0x19')]();switch(_0x878399){case _0x84fb('0x1a'):_0x878399=_0x84fb('0x1b');break;case _0x84fb('0x1c'):_0x878399=_0x84fb('0x1d');break;}}if(_0x878399&&this[_0x84fb('0x1e')]!==_0x878399||_0x42c541[_0x84fb('0x1f')]){this[_0x84fb('0x11')]=_[_0x84fb('0x20')](moment()[_0x84fb('0x21')]('x'));}if(_0x878399){this[_0x84fb('0x1e')]=_0x878399;}var _0x3e790d={'id':this['id'],'name':this['name'],'email':this[_0x84fb('0x9')],'accountcode':this[_0x84fb('0xa')],'fullname':this[_0x84fb('0x22')],'state':this['state'],'stateTime':this[_0x84fb('0x23')],'status':this[_0x84fb('0x24')],'address':this[_0x84fb('0xc')],'online':this[_0x84fb('0x10')],'voiceStatus':this[_0x84fb('0x1e')],'voiceStatusTime':this[_0x84fb('0x11')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x84fb('0x13')],'interface':this['interface'],'onhold':this[_0x84fb('0x14')]};var _0x55697e=md5(JSON[_0x84fb('0x25')](_0x3e790d));if(this[_0x84fb('0x26')]!==_0x55697e){this[_0x84fb('0x26')]=_0x55697e;io['to'](util[_0x84fb('0x21')]('user:%s',_0x3e790d['name']))[_0x84fb('0x27')](_0x84fb('0x28'),_[_0x84fb('0x29')](_0x3e790d,['online']));io['emit'](_0x84fb('0x2a'),_0x3e790d);}};module[_0x84fb('0x2b')]=Agent; \ No newline at end of file +var _0x5eb6=['md5','user:%s','emit','user:ami:update','omit','user:presence','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','format','stringify'];(function(_0x2b7e82,_0xae101a){var _0x19968b=function(_0x230c46){while(--_0x230c46){_0x2b7e82['push'](_0x2b7e82['shift']());}};_0x19968b(++_0xae101a);}(_0x5eb6,0x11e));var _0x65eb=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5eb6[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x65eb('0x0'));var util=require(_0x65eb('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x65eb('0x2'));var config=require(_0x65eb('0x3'));config[_0x65eb('0x4')]=_['defaults'](config['redis'],{'host':_0x65eb('0x5'),'port':0x18eb});var io=require(_0x65eb('0x6'))(new Redis(config['redis']));function Agent(_0x49646b){this['id']=_0x49646b['id']||0x0;this[_0x65eb('0x7')]=_0x49646b[_0x65eb('0x7')]||'';this[_0x65eb('0x8')]=_0x49646b[_0x65eb('0x8')]||'';this[_0x65eb('0x9')]=_0x49646b[_0x65eb('0x9')]||'';this[_0x65eb('0xa')]=_0x49646b[_0x65eb('0xa')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x65eb('0xb')]=_0x65eb('0xc');this[_0x65eb('0xd')]='';this[_0x65eb('0xe')]='';this[_0x65eb('0xf')]='';this[_0x65eb('0x10')]='';this[_0x65eb('0x11')]=_0x49646b[_0x65eb('0x11')]||![];this[_0x65eb('0x12')]=_0x65eb('0xc');this[_0x65eb('0x13')]=0x0;this[_0x65eb('0x14')]='';this[_0x65eb('0x15')]='';this[_0x65eb('0x16')]=![];this['local']=![];this['md5']='';}Agent[_0x65eb('0x17')][_0x65eb('0x18')]=function(_0x3f2fa9){var _0x51516d;if(_0x3f2fa9&&_0x3f2fa9[_0x65eb('0x19')]){_0x51516d=_0x3f2fa9[_0x65eb('0x19')][_0x65eb('0x1a')]();switch(_0x51516d){case _0x65eb('0x1b'):_0x51516d='idle';break;case _0x65eb('0x1c'):_0x51516d=_0x65eb('0x1d');break;}}if(_0x51516d&&this[_0x65eb('0x12')]!==_0x51516d||_0x3f2fa9[_0x65eb('0x1e')]){this[_0x65eb('0x13')]=_[_0x65eb('0x1f')](moment()[_0x65eb('0x20')]('x'));}if(_0x51516d){this[_0x65eb('0x12')]=_0x51516d;}var _0x378830={'id':this['id'],'name':this['name'],'email':this[_0x65eb('0x8')],'accountcode':this[_0x65eb('0x9')],'fullname':this[_0x65eb('0xa')],'state':this[_0x65eb('0x19')],'stateTime':this['stateTime'],'status':this[_0x65eb('0xb')],'address':this[_0x65eb('0xd')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x65eb('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x65eb('0x15')],'interface':this[_0x65eb('0x10')],'onhold':this[_0x65eb('0x16')]};var _0x291164=md5(JSON[_0x65eb('0x21')](_0x378830));if(this['md5']!==_0x291164){this[_0x65eb('0x22')]=_0x291164;io['to'](util['format'](_0x65eb('0x23'),_0x378830[_0x65eb('0x7')]))[_0x65eb('0x24')](_0x65eb('0x25'),_[_0x65eb('0x26')](_0x378830,[_0x65eb('0x11')]));io[_0x65eb('0x24')](_0x65eb('0x27'),_0x378830);}};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 1d5f00e..a18f27b 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 _0x86b1=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x86b1,0x1db));var _0x186b=function(_0x4d7c9b,_0x3bb7b1){_0x4d7c9b=_0x4d7c9b-0x0;var _0x2933d9=_0x86b1[_0x4d7c9b];return _0x2933d9;};'use strict';function Campaign(_0x3f9205){this['id']=_0x3f9205['id']||0x0;this[_0x186b('0x0')]=_0x3f9205[_0x186b('0x0')]||'';this['type']=_0x3f9205['type']||_0x186b('0x1');this[_0x186b('0x2')]=0x0;this[_0x186b('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x186b('0x4')]='';this[_0x186b('0x5')]=!![];this[_0x186b('0x6')]=_0x3f9205[_0x186b('0x6')];this[_0x186b('0x7')]=_0x3f9205['limitCalls'];this[_0x186b('0x8')]=_0x3f9205[_0x186b('0x8')]||null;this[_0x186b('0x9')]=_0x3f9205[_0x186b('0x9')]?_0x3f9205[_0x186b('0x9')]:null;this[_0x186b('0xa')]=_0x3f9205['dialOriginateCallerIdName'];this[_0x186b('0xb')]=_0x3f9205[_0x186b('0xb')];this[_0x186b('0xc')]=_0x3f9205[_0x186b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x3f9205[_0x186b('0xd')];this[_0x186b('0xe')]=_0x3f9205['dialCongestionRetryFrequency'];this[_0x186b('0xf')]=_0x3f9205[_0x186b('0xf')];this[_0x186b('0x10')]=_0x3f9205[_0x186b('0x10')];this[_0x186b('0x11')]=_0x3f9205[_0x186b('0x11')];this[_0x186b('0x12')]=_0x3f9205['dialNoAnswerRetryFrequency'];this[_0x186b('0x13')]=_0x3f9205[_0x186b('0x13')];this[_0x186b('0x14')]=_0x3f9205[_0x186b('0x14')]||0x3;this[_0x186b('0x15')]=_0x3f9205[_0x186b('0x15')]||0x96;this[_0x186b('0x16')]=_0x3f9205[_0x186b('0x16')]||0x3;this[_0x186b('0x17')]=_0x3f9205[_0x186b('0x17')]||0x96;this[_0x186b('0x18')]=_0x3f9205['dialAbandonedMaxRetry']||0x3;this[_0x186b('0x19')]=_0x3f9205[_0x186b('0x19')]||0x96;this[_0x186b('0x1a')]=_0x3f9205[_0x186b('0x1a')]||0x3;this[_0x186b('0x1b')]=_0x3f9205[_0x186b('0x1b')]||0x96;this[_0x186b('0x1c')]=_0x3f9205[_0x186b('0x1c')]||0x3;this[_0x186b('0x1d')]=_0x3f9205['dialAgentRejectRetryFrequency']||0x96;this[_0x186b('0x1e')]=_0x3f9205[_0x186b('0x1e')]||_0x186b('0x1f');this[_0x186b('0x20')]=_0x3f9205[_0x186b('0x20')]||undefined;this[_0x186b('0x21')]=_0x3f9205[_0x186b('0x21')]||undefined;this[_0x186b('0x22')]=_0x3f9205[_0x186b('0x22')]||undefined;this[_0x186b('0x23')]=_0x3f9205[_0x186b('0x23')]?_0x3f9205[_0x186b('0x23')]:undefined;this[_0x186b('0x24')]=_0x3f9205[_0x186b('0x24')]?_0x3f9205['Trunk']:undefined;this[_0x186b('0x25')]=_0x3f9205[_0x186b('0x25')]?_0x3f9205['Interval']:undefined;this[_0x186b('0x26')]=_0x3f9205[_0x186b('0x26')]?_0x3f9205['SquareProject']:undefined;this['dialQueueProject']=_0x3f9205[_0x186b('0x26')]?_0x3f9205[_0x186b('0x26')][_0x186b('0x0')]:undefined;this['dialAMDActive']=_0x3f9205['dialAMDActive']||![];this[_0x186b('0x27')]=_0x3f9205[_0x186b('0x27')];this[_0x186b('0x28')]=_0x3f9205['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x3f9205[_0x186b('0x29')];this[_0x186b('0x2a')]=_0x3f9205[_0x186b('0x2a')];this[_0x186b('0x2b')]=_0x3f9205[_0x186b('0x2b')];this[_0x186b('0x2c')]=_0x3f9205[_0x186b('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x3f9205['dialAMDMaximumNumberOfWords'];this[_0x186b('0x2d')]=_0x3f9205[_0x186b('0x2d')];this[_0x186b('0x2e')]=_0x3f9205[_0x186b('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0xf4ba=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xf4ba,0x13b));var _0xaf4b=function(_0x1baf91,_0x30ed38){_0x1baf91=_0x1baf91-0x0;var _0x56496=_0xf4ba[_0x1baf91];return _0x56496;};'use strict';function Campaign(_0x3030e7){this['id']=_0x3030e7['id']||0x0;this['name']=_0x3030e7['name']||'';this[_0xaf4b('0x0')]=_0x3030e7['type']||_0xaf4b('0x1');this[_0xaf4b('0x2')]=0x0;this[_0xaf4b('0x3')]=0x0;this[_0xaf4b('0x4')]=0x0;this[_0xaf4b('0x5')]=0x0;this[_0xaf4b('0x6')]='';this[_0xaf4b('0x7')]=!![];this['active']=_0x3030e7[_0xaf4b('0x8')];this[_0xaf4b('0x9')]=_0x3030e7['limitCalls'];this[_0xaf4b('0xa')]=_0x3030e7['dialTimezone']||null;this[_0xaf4b('0xb')]=_0x3030e7[_0xaf4b('0xb')]?_0x3030e7[_0xaf4b('0xb')]:null;this[_0xaf4b('0xc')]=_0x3030e7[_0xaf4b('0xc')];this[_0xaf4b('0xd')]=_0x3030e7[_0xaf4b('0xd')];this[_0xaf4b('0xe')]=_0x3030e7[_0xaf4b('0xe')]||0x1e;this[_0xaf4b('0xf')]=_0x3030e7[_0xaf4b('0xf')];this['dialCongestionRetryFrequency']=_0x3030e7['dialCongestionRetryFrequency'];this[_0xaf4b('0x10')]=_0x3030e7[_0xaf4b('0x10')];this[_0xaf4b('0x11')]=_0x3030e7[_0xaf4b('0x11')];this[_0xaf4b('0x12')]=_0x3030e7[_0xaf4b('0x12')];this[_0xaf4b('0x13')]=_0x3030e7[_0xaf4b('0x13')];this[_0xaf4b('0x14')]=_0x3030e7[_0xaf4b('0x14')];this['dialNoSuchNumberMaxRetry']=_0x3030e7[_0xaf4b('0x15')]||0x3;this[_0xaf4b('0x16')]=_0x3030e7['dialNoSuchNumberRetryFrequency']||0x96;this[_0xaf4b('0x17')]=_0x3030e7[_0xaf4b('0x17')]||0x3;this[_0xaf4b('0x18')]=_0x3030e7['dialDropRetryFrequency']||0x96;this[_0xaf4b('0x19')]=_0x3030e7[_0xaf4b('0x19')]||0x3;this[_0xaf4b('0x1a')]=_0x3030e7['dialAbandonedRetryFrequency']||0x96;this[_0xaf4b('0x1b')]=_0x3030e7[_0xaf4b('0x1b')]||0x3;this[_0xaf4b('0x1c')]=_0x3030e7[_0xaf4b('0x1c')]||0x96;this[_0xaf4b('0x1d')]=_0x3030e7[_0xaf4b('0x1d')]||0x3;this[_0xaf4b('0x1e')]=_0x3030e7[_0xaf4b('0x1e')]||0x96;this[_0xaf4b('0x1f')]=_0x3030e7['dialOrderByScheduledAt']||_0xaf4b('0x20');this[_0xaf4b('0x21')]=_0x3030e7[_0xaf4b('0x21')]||undefined;this[_0xaf4b('0x22')]=_0x3030e7[_0xaf4b('0x22')]||undefined;this[_0xaf4b('0x23')]=_0x3030e7[_0xaf4b('0x23')]||undefined;this[_0xaf4b('0x24')]=_0x3030e7['TrunkBackup']?_0x3030e7[_0xaf4b('0x24')]:undefined;this['Trunk']=_0x3030e7[_0xaf4b('0x25')]?_0x3030e7[_0xaf4b('0x25')]:undefined;this[_0xaf4b('0x26')]=_0x3030e7[_0xaf4b('0x26')]?_0x3030e7[_0xaf4b('0x26')]:undefined;this[_0xaf4b('0x27')]=_0x3030e7[_0xaf4b('0x27')]?_0x3030e7[_0xaf4b('0x27')]:undefined;this[_0xaf4b('0x28')]=_0x3030e7[_0xaf4b('0x27')]?_0x3030e7[_0xaf4b('0x27')][_0xaf4b('0x29')]:undefined;this[_0xaf4b('0x2a')]=_0x3030e7[_0xaf4b('0x2a')]||![];this[_0xaf4b('0x2b')]=_0x3030e7[_0xaf4b('0x2b')];this[_0xaf4b('0x2c')]=_0x3030e7['dialAMDGreeting'];this[_0xaf4b('0x2d')]=_0x3030e7[_0xaf4b('0x2d')];this['dialAMDTotalAnalysisTime']=_0x3030e7[_0xaf4b('0x2e')];this[_0xaf4b('0x2f')]=_0x3030e7[_0xaf4b('0x2f')];this['dialAMDBetweenWordsSilence']=_0x3030e7[_0xaf4b('0x30')];this[_0xaf4b('0x31')]=_0x3030e7[_0xaf4b('0x31')];this[_0xaf4b('0x32')]=_0x3030e7[_0xaf4b('0x32')];this[_0xaf4b('0x33')]=_0x3030e7[_0xaf4b('0x33')];}module[_0xaf4b('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 54d6954..dfe051b 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 _0x0f42=['tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','uniqueid','linkedid','exten','answertime','endtime','abandoned','billableseconds','type'];(function(_0x4c6dd5,_0x3e2003){var _0x17d4d5=function(_0x17d45f){while(--_0x17d45f){_0x4c6dd5['push'](_0x4c6dd5['shift']());}};_0x17d4d5(++_0x3e2003);}(_0x0f42,0x126));var _0x20f4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0f42[_0x3e5086];return _0xfeb102;};'use strict';function Channel(){this[_0x20f4('0x0')]=null;this[_0x20f4('0x1')]='';this[_0x20f4('0x2')]='';this[_0x20f4('0x3')]=0x0;this['calleridname']='';this[_0x20f4('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x20f4('0x5')]=0x0;this['context']='';this[_0x20f4('0x6')]=0x0;this[_0x20f4('0x7')]=0x0;this[_0x20f4('0x8')]=0x0;this['answered']=![];this[_0x20f4('0x9')]=null;this[_0x20f4('0xa')]=null;this['unmanaged']=![];this[_0x20f4('0xb')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0x20f4('0xc')]=0x0;this['holdtime']=0x0;this[_0x20f4('0xd')]=null;this[_0x20f4('0xe')]=null;this[_0x20f4('0xf')]=null;this[_0x20f4('0x10')]=![];this['monitorFilename']=null;this[_0x20f4('0x11')]=null;this['monitors']=[];this[_0x20f4('0x12')]=undefined;this[_0x20f4('0x13')]=undefined;this[_0x20f4('0x14')]=undefined;this[_0x20f4('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xc931=['unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime'];(function(_0x27f6ae,_0x2c3bc5){var _0x565002=function(_0x41eb3d){while(--_0x41eb3d){_0x27f6ae['push'](_0x27f6ae['shift']());}};_0x565002(++_0x2c3bc5);}(_0xc931,0x19c));var _0x1c93=function(_0x4b4111,_0x4f6d34){_0x4b4111=_0x4b4111-0x0;var _0x4851ab=_0xc931[_0x4b4111];return _0x4851ab;};'use strict';function Channel(){this[_0x1c93('0x0')]=null;this[_0x1c93('0x1')]='';this['destinationchannel']='';this[_0x1c93('0x2')]=0x0;this[_0x1c93('0x3')]='';this[_0x1c93('0x4')]=undefined;this[_0x1c93('0x5')]=undefined;this[_0x1c93('0x6')]=0x0;this[_0x1c93('0x7')]='';this[_0x1c93('0x8')]=0x0;this[_0x1c93('0x9')]=0x0;this[_0x1c93('0xa')]=0x0;this['answered']=![];this[_0x1c93('0xb')]=null;this[_0x1c93('0xc')]=null;this[_0x1c93('0xd')]=![];this['abandoned']=![];this[_0x1c93('0xe')]='';this[_0x1c93('0xf')]='';this[_0x1c93('0x10')]=0x0;this[_0x1c93('0x11')]=0x0;this[_0x1c93('0x12')]=0x0;this[_0x1c93('0x13')]=null;this['tag']=null;this[_0x1c93('0x14')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0x1c93('0x15')]=undefined;this[_0x1c93('0x16')]=undefined;this[_0x1c93('0x17')]=undefined;this[_0x1c93('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4af8c65..5b33f32 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 _0x6c2b=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x5ecd1e,_0x4ea896){var _0x1e9e77=function(_0x2c4e82){while(--_0x2c4e82){_0x5ecd1e['push'](_0x5ecd1e['shift']());}};_0x1e9e77(++_0x4ea896);}(_0x6c2b,0x17a));var _0xb6c2=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x6c2b[_0x1655bb];return _0x5e2020;};'use strict';function DeskAccount(_0x9bb829){this['id']=_0x9bb829['id']||0x0;this[_0xb6c2('0x0')]=_0x9bb829['name']||'';this['username']=_0x9bb829[_0xb6c2('0x1')]||'';this[_0xb6c2('0x2')]=_0x9bb829[_0xb6c2('0x2')]||'';this[_0xb6c2('0x3')]=_0x9bb829[_0xb6c2('0x3')]||'';this[_0xb6c2('0x4')]=_0x9bb829[_0xb6c2('0x4')]||'';this['consumerKey']=_0x9bb829['consumerKey']||'';this[_0xb6c2('0x5')]=_0x9bb829[_0xb6c2('0x5')]||'';this[_0xb6c2('0x6')]=_0x9bb829[_0xb6c2('0x6')]||'';this[_0xb6c2('0x7')]=_0x9bb829[_0xb6c2('0x7')]||'';this[_0xb6c2('0x8')]=_0x9bb829[_0xb6c2('0x8')]||'';this[_0xb6c2('0x9')]=_0x9bb829['serverUrl']||'';this[_0xb6c2('0xa')]=_0x9bb829['Configurations']||{};}module[_0xb6c2('0xb')]=DeskAccount; \ No newline at end of file +var _0x3fa2=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3fa2,0xa9));var _0x23fa=function(_0xc694ff,_0x1498ad){_0xc694ff=_0xc694ff-0x0;var _0x59dba2=_0x3fa2[_0xc694ff];return _0x59dba2;};'use strict';function DeskAccount(_0x28c5b0){this['id']=_0x28c5b0['id']||0x0;this[_0x23fa('0x0')]=_0x28c5b0[_0x23fa('0x0')]||'';this['username']=_0x28c5b0[_0x23fa('0x1')]||'';this['remoteUri']=_0x28c5b0[_0x23fa('0x2')]||'';this[_0x23fa('0x3')]=_0x28c5b0['authType']||'';this['password']=_0x28c5b0[_0x23fa('0x4')]||'';this[_0x23fa('0x5')]=_0x28c5b0['consumerKey']||'';this['consumerSecret']=_0x28c5b0[_0x23fa('0x6')]||'';this[_0x23fa('0x7')]=_0x28c5b0[_0x23fa('0x7')]||'';this[_0x23fa('0x8')]=_0x28c5b0['tokenSecret']||'';this[_0x23fa('0x9')]=_0x28c5b0[_0x23fa('0x9')]||'';this[_0x23fa('0xa')]=_0x28c5b0['serverUrl']||'';this[_0x23fa('0xb')]=_0x28c5b0[_0x23fa('0xb')]||{};}module[_0x23fa('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e9d460f..7e28bf4 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 _0x0eb6=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','remoteUri'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x0eb6,0x75));var _0x60eb=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0x0eb6[_0x5e2751];return _0x139a39;};'use strict';function Dynamics365Account(_0x4c0d38){this['id']=_0x4c0d38['id']||0x0;this[_0x60eb('0x0')]=_0x4c0d38['name']||'';this['username']=_0x4c0d38[_0x60eb('0x1')]||'';this['password']=_0x4c0d38['password']||'';this[_0x60eb('0x2')]=_0x4c0d38['remoteUri']||'';this[_0x60eb('0x3')]=_0x4c0d38[_0x60eb('0x3')]||'';this[_0x60eb('0x4')]=_0x4c0d38[_0x60eb('0x4')]||'';this[_0x60eb('0x5')]=_0x4c0d38[_0x60eb('0x5')]||{};this[_0x60eb('0x6')]=_0x4c0d38['serverUrl']||'';this[_0x60eb('0x7')]=_0x4c0d38['modernAuthentication']||![];this[_0x60eb('0x8')]=_0x4c0d38['Configurations']||{};this[_0x60eb('0x9')]=_0x4c0d38[_0x60eb('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x2cd3=['CloudProvider','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x2cd3,0x141));var _0x32cd=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x2cd3[_0x4d674b];return _0x535a1f;};'use strict';function Dynamics365Account(_0x591c88){this['id']=_0x591c88['id']||0x0;this[_0x32cd('0x0')]=_0x591c88['name']||'';this['username']=_0x591c88['username']||'';this[_0x32cd('0x1')]=_0x591c88[_0x32cd('0x1')]||'';this['remoteUri']=_0x591c88[_0x32cd('0x2')]||'';this[_0x32cd('0x3')]=_0x591c88[_0x32cd('0x3')]||'';this[_0x32cd('0x4')]=_0x591c88[_0x32cd('0x4')]||'';this['clientSecret']=_0x591c88[_0x32cd('0x5')]||{};this[_0x32cd('0x6')]=_0x591c88['serverUrl']||'';this[_0x32cd('0x7')]=_0x591c88[_0x32cd('0x7')]||![];this[_0x32cd('0x8')]=_0x591c88[_0x32cd('0x8')]||{};this[_0x32cd('0x9')]=_0x591c88[_0x32cd('0x9')]||{};}module[_0x32cd('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8ec1cf0..d32d127 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 _0x93b7=['localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x12e409,_0x379bb4){var _0xacb87b=function(_0x53ad8c){while(--_0x53ad8c){_0x12e409['push'](_0x12e409['shift']());}};_0xacb87b(++_0x379bb4);}(_0x93b7,0x1cd));var _0x793b=function(_0x2d5411,_0x1a439f){_0x2d5411=_0x2d5411-0x0;var _0x4f13d7=_0x93b7[_0x2d5411];return _0x4f13d7;};'use strict';function FaxAccount(_0x5e050a){this['id']=_0x5e050a['id']||0x0;this['name']=_0x5e050a[_0x793b('0x0')]||'';this['description']=_0x5e050a[_0x793b('0x1')];this[_0x793b('0x2')]=_0x5e050a[_0x793b('0x2')];this[_0x793b('0x3')]=_0x5e050a[_0x793b('0x3')];this[_0x793b('0x4')]=_0x5e050a[_0x793b('0x4')];this[_0x793b('0x5')]=_0x5e050a[_0x793b('0x5')]||0x960;this[_0x793b('0x6')]=_0x5e050a['maxrate']||0x3840;this[_0x793b('0x7')]=_0x5e050a[_0x793b('0x7')]||_0x793b('0x8');this['gateway']=_0x5e050a['gateway']||'no';this[_0x793b('0x9')]=_0x5e050a[_0x793b('0x9')]||'no';this[_0x793b('0xa')]=_0x5e050a[_0x793b('0xa')]||0x1388;this[_0x793b('0xb')]=_0x5e050a[_0x793b('0xb')]||'SIP';this[_0x793b('0xc')]=_0x5e050a[_0x793b('0xc')]?_0x5e050a['Trunk']:undefined;this[_0x793b('0xd')]=_0x5e050a[_0x793b('0xd')];this[_0x793b('0xe')]=_0x5e050a[_0x793b('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x9ff9=['description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','name'];(function(_0x4253cb,_0x5e536f){var _0x4a405a=function(_0x4fd011){while(--_0x4fd011){_0x4253cb['push'](_0x4253cb['shift']());}};_0x4a405a(++_0x5e536f);}(_0x9ff9,0x1cd));var _0x99ff=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9ff9[_0x15bc81];return _0x59440e;};'use strict';function FaxAccount(_0x5b8acb){this['id']=_0x5b8acb['id']||0x0;this[_0x99ff('0x0')]=_0x5b8acb['name']||'';this[_0x99ff('0x1')]=_0x5b8acb[_0x99ff('0x1')];this[_0x99ff('0x2')]=_0x5b8acb[_0x99ff('0x2')];this['headerinfo']=_0x5b8acb['headerinfo'];this[_0x99ff('0x3')]=_0x5b8acb[_0x99ff('0x3')];this[_0x99ff('0x4')]=_0x5b8acb['minrate']||0x960;this['maxrate']=_0x5b8acb[_0x99ff('0x5')]||0x3840;this['modem']=_0x5b8acb[_0x99ff('0x6')]||'v17,v27,v29';this[_0x99ff('0x7')]=_0x5b8acb[_0x99ff('0x7')]||'no';this['faxdetect']=_0x5b8acb[_0x99ff('0x8')]||'no';this[_0x99ff('0x9')]=_0x5b8acb[_0x99ff('0x9')]||0x1388;this[_0x99ff('0xa')]=_0x5b8acb['tech']||_0x99ff('0xb');this[_0x99ff('0xc')]=_0x5b8acb['Trunk']?_0x5b8acb[_0x99ff('0xc')]:undefined;this['ListId']=_0x5b8acb['ListId'];this[_0x99ff('0xd')]=_0x5b8acb['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 e0dd598..05e182e 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 _0x603b=['remoteUri','serverUrl','name','username','apiKey'];(function(_0x30c2e0,_0x1200cb){var _0x2a5ead=function(_0xab733e){while(--_0xab733e){_0x30c2e0['push'](_0x30c2e0['shift']());}};_0x2a5ead(++_0x1200cb);}(_0x603b,0x93));var _0xb603=function(_0x47e4c3,_0x25e23f){_0x47e4c3=_0x47e4c3-0x0;var _0x4062ef=_0x603b[_0x47e4c3];return _0x4062ef;};'use strict';function FreshdeskAccount(_0x3b18af){this['id']=_0x3b18af['id']||0x0;this[_0xb603('0x0')]=_0x3b18af[_0xb603('0x0')]||'';this[_0xb603('0x1')]=_0x3b18af[_0xb603('0x1')]||'';this[_0xb603('0x2')]=_0x3b18af['token']||'';this[_0xb603('0x3')]=_0x3b18af[_0xb603('0x3')]||'';this['serverUrl']=_0x3b18af[_0xb603('0x4')]||'';this['Configurations']=_0x3b18af['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xc24a=['Configurations','exports','name','apiKey','remoteUri','serverUrl'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xc24a,0xc2));var _0xac24=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc24a[_0x618414];return _0x21c19a;};'use strict';function FreshdeskAccount(_0x817c9d){this['id']=_0x817c9d['id']||0x0;this[_0xac24('0x0')]=_0x817c9d[_0xac24('0x0')]||'';this['username']=_0x817c9d['username']||'';this[_0xac24('0x1')]=_0x817c9d['token']||'';this['remoteUri']=_0x817c9d[_0xac24('0x2')]||'';this[_0xac24('0x3')]=_0x817c9d[_0xac24('0x3')]||'';this[_0xac24('0x4')]=_0x817c9d[_0xac24('0x4')]||{};}module[_0xac24('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0b76ccc..74da0a3 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 _0xfd6e=['name','username','apiKey','serverUrl','Configurations','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';function FreshsalesAccount(_0x501204){this['id']=_0x501204['id']||0x0;this['name']=_0x501204[_0xefd6('0x0')]||'';this['username']=_0x501204[_0xefd6('0x1')]||'';this[_0xefd6('0x2')]=_0x501204['token']||'';this['remoteUri']=_0x501204['remoteUri']||'';this[_0xefd6('0x3')]=_0x501204['serverUrl']||'';this['Configurations']=_0x501204[_0xefd6('0x4')]||{};}module[_0xefd6('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x078c=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4a4729,_0x669995){var _0x21bb56=function(_0x4e37ed){while(--_0x4e37ed){_0x4a4729['push'](_0x4a4729['shift']());}};_0x21bb56(++_0x669995);}(_0x078c,0x19f));var _0xc078=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x078c[_0x47e7dd];return _0x38501f;};'use strict';function FreshsalesAccount(_0x2d3bfa){this['id']=_0x2d3bfa['id']||0x0;this['name']=_0x2d3bfa[_0xc078('0x0')]||'';this[_0xc078('0x1')]=_0x2d3bfa['username']||'';this[_0xc078('0x2')]=_0x2d3bfa[_0xc078('0x3')]||'';this[_0xc078('0x4')]=_0x2d3bfa[_0xc078('0x4')]||'';this['serverUrl']=_0x2d3bfa[_0xc078('0x5')]||'';this[_0xc078('0x6')]=_0x2d3bfa[_0xc078('0x6')]||{};}module[_0xc078('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7165fa7..872a209 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 _0xba4b=['channel','connectedlinename','exten','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt'];(function(_0x4d573b,_0x459ef9){var _0x47d562=function(_0x3529bc){while(--_0x3529bc){_0x4d573b['push'](_0x4d573b['shift']());}};_0x47d562(++_0x459ef9);}(_0xba4b,0x1b4));var _0xbba4=function(_0x4ce3ef,_0x49f80e){_0x4ce3ef=_0x4ce3ef-0x0;var _0x5ebb94=_0xba4b[_0x4ce3ef];return _0x5ebb94;};'use strict';function QueueReport(){this[_0xbba4('0x0')]=_0xbba4('0x1');this['uniqueid']='';this[_0xbba4('0x2')]='';this[_0xbba4('0x3')]='';this[_0xbba4('0x4')]='';this[_0xbba4('0x5')]=null;this[_0xbba4('0x6')]=null;this[_0xbba4('0x7')]=0x1;this[_0xbba4('0x8')]=0x1;this[_0xbba4('0x9')]=![];this[_0xbba4('0xa')]=null;this[_0xbba4('0xb')]=![];this['queuecallercompleteAt']=null;this[_0xbba4('0xc')]=![];this[_0xbba4('0xd')]=null;this['originalposition']=0x1;this[_0xbba4('0xe')]='';this['connectedlinenum']='';this[_0xbba4('0xf')]='';this['accountcode']='';this['context']='';this[_0xbba4('0x10')]='';this['priority']='';this[_0xbba4('0x11')]=0x0;this[_0xbba4('0x12')]=![];this[_0xbba4('0x13')]='';this[_0xbba4('0x14')]='voice';this[_0xbba4('0x15')]=null;this[_0xbba4('0x16')]=0x0;this[_0xbba4('0x17')]={};}module[_0xbba4('0x18')]=QueueReport; \ No newline at end of file +var _0xa14e=['holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','accountcode','context','exten','priority'];(function(_0x51bbc4,_0x45823b){var _0x30f7e9=function(_0x1c8f6b){while(--_0x1c8f6b){_0x51bbc4['push'](_0x51bbc4['shift']());}};_0x30f7e9(++_0x45823b);}(_0xa14e,0x64));var _0xea14=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa14e[_0x8c43de];return _0xa6591b;};'use strict';function QueueReport(){this[_0xea14('0x0')]=_0xea14('0x1');this[_0xea14('0x2')]='';this['calleridnum']='';this[_0xea14('0x3')]='';this[_0xea14('0x4')]='';this[_0xea14('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xea14('0x6')]=0x1;this[_0xea14('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xea14('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0xea14('0x9')]=![];this[_0xea14('0xa')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xea14('0xb')]='';this[_0xea14('0xc')]='';this[_0xea14('0xd')]='';this[_0xea14('0xe')]='';this[_0xea14('0xf')]=0x0;this[_0xea14('0x10')]=![];this[_0xea14('0x11')]='';this[_0xea14('0x12')]=_0xea14('0x13');this[_0xea14('0x14')]=null;this['mohtime']=0x0;this[_0xea14('0x15')]={};}module[_0xea14('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f830970..19620c3 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 _0x51a9=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x2103c1,_0x49fc3c){var _0x19cb9e=function(_0x4e8aed){while(--_0x4e8aed){_0x2103c1['push'](_0x2103c1['shift']());}};_0x19cb9e(++_0x49fc3c);}(_0x51a9,0x86));var _0x951a=function(_0x91b6b5,_0x333253){_0x91b6b5=_0x91b6b5-0x0;var _0x4166e4=_0x51a9[_0x91b6b5];return _0x4166e4;};'use strict';function SalesforceAccount(_0xc5d67f){this['id']=_0xc5d67f['id']||0x0;this[_0x951a('0x0')]=_0xc5d67f[_0x951a('0x0')]||'';this[_0x951a('0x1')]=_0xc5d67f[_0x951a('0x1')]||'';this[_0x951a('0x2')]=_0xc5d67f['remoteUri']||'';this[_0x951a('0x3')]=_0xc5d67f[_0x951a('0x3')]||'';this[_0x951a('0x4')]=_0xc5d67f[_0x951a('0x4')]||'';this[_0x951a('0x5')]=_0xc5d67f['clientSecret']||'';this['securityToken']=_0xc5d67f[_0x951a('0x6')]||'';this[_0x951a('0x7')]=_0xc5d67f[_0x951a('0x7')]||'integrationTab';this[_0x951a('0x8')]=_0xc5d67f[_0x951a('0x8')]||'';this['Configurations']=_0xc5d67f[_0x951a('0x9')]||{};}module[_0x951a('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x60b1=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0xd54466,_0x331dc9){var _0x3f9059=function(_0x2cedea){while(--_0x2cedea){_0xd54466['push'](_0xd54466['shift']());}};_0x3f9059(++_0x331dc9);}(_0x60b1,0x116));var _0x160b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60b1[_0x1facfa];return _0x9ec701;};'use strict';function SalesforceAccount(_0x1bf349){this['id']=_0x1bf349['id']||0x0;this[_0x160b('0x0')]=_0x1bf349[_0x160b('0x0')]||'';this['username']=_0x1bf349[_0x160b('0x1')]||'';this['remoteUri']=_0x1bf349[_0x160b('0x2')]||'';this[_0x160b('0x3')]=_0x1bf349['password']||'';this[_0x160b('0x4')]=_0x1bf349[_0x160b('0x4')]||'';this[_0x160b('0x5')]=_0x1bf349[_0x160b('0x5')]||'';this[_0x160b('0x6')]=_0x1bf349[_0x160b('0x6')]||'';this['type']=_0x1bf349[_0x160b('0x7')]||'integrationTab';this[_0x160b('0x8')]=_0x1bf349['serverUrl']||'';this[_0x160b('0x9')]=_0x1bf349[_0x160b('0x9')]||{};}module[_0x160b('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fac8d14..cee8672 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 _0xf7cc=['remoteUri','serverUrl','exports','username','password'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xf7cc,0xc1));var _0xcf7c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf7cc[_0x4b369d];return _0x571a98;};'use strict';function ServicenowAccount(_0x1ac6ef){this['id']=_0x1ac6ef['id']||0x0;this['name']=_0x1ac6ef['name']||'';this[_0xcf7c('0x0')]=_0x1ac6ef[_0xcf7c('0x0')]||'';this[_0xcf7c('0x1')]=_0x1ac6ef['password']||'';this[_0xcf7c('0x2')]=_0x1ac6ef[_0xcf7c('0x2')]||'';this[_0xcf7c('0x3')]=_0x1ac6ef[_0xcf7c('0x3')]||'';this['Configurations']=_0x1ac6ef['Configurations']||{};}module[_0xcf7c('0x4')]=ServicenowAccount; \ No newline at end of file +var _0x922a=['exports','name','username','remoteUri','serverUrl'];(function(_0x18236f,_0x265994){var _0x554f06=function(_0x4db51d){while(--_0x4db51d){_0x18236f['push'](_0x18236f['shift']());}};_0x554f06(++_0x265994);}(_0x922a,0xf1));var _0xa922=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x922a[_0x4fde08];return _0x12e725;};'use strict';function ServicenowAccount(_0x4ab338){this['id']=_0x4ab338['id']||0x0;this[_0xa922('0x0')]=_0x4ab338[_0xa922('0x0')]||'';this[_0xa922('0x1')]=_0x4ab338[_0xa922('0x1')]||'';this['password']=_0x4ab338['password']||'';this['remoteUri']=_0x4ab338[_0xa922('0x2')]||'';this['serverUrl']=_0x4ab338[_0xa922('0x3')]||'';this['Configurations']=_0x4ab338['Configurations']||{};}module[_0xa922('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index dfd9c87..5e2c2f7 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 _0x483e=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x9fd97d,_0x4e5ac1){var _0x15b31c=function(_0x11b145){while(--_0x11b145){_0x9fd97d['push'](_0x9fd97d['shift']());}};_0x15b31c(++_0x4e5ac1);}(_0x483e,0x127));var _0xe483=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x483e[_0x23c73d];return _0x36ba47;};'use strict';function SugarcrmAccount(_0x12d609){this['id']=_0x12d609['id']||0x0;this['name']=_0x12d609[_0xe483('0x0')]||'';this['username']=_0x12d609[_0xe483('0x1')]||'';this[_0xe483('0x2')]=_0x12d609[_0xe483('0x2')]||'';this[_0xe483('0x3')]=_0x12d609['remoteUri']||'';this[_0xe483('0x4')]=_0x12d609[_0xe483('0x4')]||'';this[_0xe483('0x5')]=_0x12d609['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xa8a9=['Configurations','name','username','remoteUri'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa8a9,0x161));var _0x9a8a=function(_0x586763,_0x32109c){_0x586763=_0x586763-0x0;var _0x4ba819=_0xa8a9[_0x586763];return _0x4ba819;};'use strict';function SugarcrmAccount(_0x5cf7db){this['id']=_0x5cf7db['id']||0x0;this[_0x9a8a('0x0')]=_0x5cf7db[_0x9a8a('0x0')]||'';this['username']=_0x5cf7db[_0x9a8a('0x1')]||'';this['password']=_0x5cf7db['password']||'';this['remoteUri']=_0x5cf7db[_0x9a8a('0x2')]||'';this['serverUrl']=_0x5cf7db['serverUrl']||'';this[_0x9a8a('0x3')]=_0x5cf7db[_0x9a8a('0x3')]||{};}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 f56c5e3..d970fe1 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 _0x09b0=['exports','name','accountcode','stateTime','status','unknown'];(function(_0x7a0481,_0x53346d){var _0x3858b0=function(_0x589493){while(--_0x589493){_0x7a0481['push'](_0x7a0481['shift']());}};_0x3858b0(++_0x53346d);}(_0x09b0,0x1f3));var _0x009b=function(_0x1dd4d7,_0x2967e6){_0x1dd4d7=_0x1dd4d7-0x0;var _0x4a951a=_0x09b0[_0x1dd4d7];return _0x4a951a;};'use strict';function Telephone(_0x17fd8d){this['id']=_0x17fd8d['id']||0x0;this['name']=_0x17fd8d[_0x009b('0x0')]||'';this['accountcode']=_0x17fd8d[_0x009b('0x1')]||'';this['state']='unknown';this[_0x009b('0x2')]=0x0;this[_0x009b('0x3')]=_0x009b('0x4');this['address']='';}module[_0x009b('0x5')]=Telephone; \ No newline at end of file +var _0x15fd=['accountcode','state','unknown','stateTime','status','exports','name'];(function(_0x3fd165,_0x5e2e2f){var _0x50f970=function(_0x3bc1f7){while(--_0x3bc1f7){_0x3fd165['push'](_0x3fd165['shift']());}};_0x50f970(++_0x5e2e2f);}(_0x15fd,0x1d4));var _0xd15f=function(_0x2f84db,_0x5208a0){_0x2f84db=_0x2f84db-0x0;var _0x823abb=_0x15fd[_0x2f84db];return _0x823abb;};'use strict';function Telephone(_0x1d805a){this['id']=_0x1d805a['id']||0x0;this[_0xd15f('0x0')]=_0x1d805a[_0xd15f('0x0')]||'';this[_0xd15f('0x1')]=_0x1d805a[_0xd15f('0x1')]||'';this[_0xd15f('0x2')]=_0xd15f('0x3');this[_0xd15f('0x4')]=0x0;this[_0xd15f('0x5')]=_0xd15f('0x3');this['address']='';}module[_0xd15f('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f547218..e234854 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x8c2558,_0x95548f){var _0x48288b=function(_0x4917cc){while(--_0x4917cc){_0x8c2558['push'](_0x8c2558['shift']());}};_0x48288b(++_0x95548f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x4395b7,_0x5d8401){var _0x42bf07=function(_0x288754){while(--_0x288754){_0x4395b7['push'](_0x4395b7['shift']());}};_0x42bf07(++_0x5d8401);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 86eadbc..6c957e3 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x32f9d0,_0x440b68){var _0x143e0f=function(_0x1e557b){while(--_0x1e557b){_0x32f9d0['push'](_0x32f9d0['shift']());}};_0x143e0f(++_0x440b68);}(_0xda2d,0x102));var _0xdda2=function(_0x13d150,_0x33f706){_0x13d150=_0x13d150-0x0;var _0x3e9dbd=_0xda2d[_0x13d150];return _0x3e9dbd;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c035779..56ef510 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 _0x3f5c=['registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split','host','port','domain','refresh','stateRegistry'];(function(_0x1b36d4,_0x3e9356){var _0x193a52=function(_0x1e2095){while(--_0x1e2095){_0x1b36d4['push'](_0x1b36d4['shift']());}};_0x193a52(++_0x3e9356);}(_0x3f5c,0xf2));var _0xc3f5=function(_0x73d16e,_0x39a841){_0x73d16e=_0x73d16e-0x0;var _0x3a7f7c=_0x3f5c[_0x73d16e];return _0x3a7f7c;};'use strict';function Trunk(_0x48f2a6){this['id']=_0x48f2a6['id']||0x0;this['active']=_0x48f2a6[_0xc3f5('0x0')]||![];this[_0xc3f5('0x1')]=_0x48f2a6[_0xc3f5('0x1')]||'';this[_0xc3f5('0x2')]=_0xc3f5('0x3');this['stateTime']=0x0;this[_0xc3f5('0x4')]='unknown';this['registry']=_0x48f2a6[_0xc3f5('0x5')]&&_0x48f2a6[_0xc3f5('0x5')][_0xc3f5('0x6')](':')?_0x48f2a6[_0xc3f5('0x5')][_0xc3f5('0x7')](':')[0x0]:'';this[_0xc3f5('0x8')]='';this[_0xc3f5('0x9')]='';this[_0xc3f5('0xa')]='';this['domainport']='';this[_0xc3f5('0xb')]='';this[_0xc3f5('0xc')]=_0xc3f5('0x3');this[_0xc3f5('0xd')]='';this[_0xc3f5('0xe')]='';this['defaultuser']=_0x48f2a6[_0xc3f5('0xf')]||'';}module[_0xc3f5('0x10')]=Trunk; \ No newline at end of file +var _0x7c5c=['unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','registrationtime','defaultuser','name','state'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x7c5c,0x98));var _0xc7c5=function(_0x471fbd,_0x450a53){_0x471fbd=_0x471fbd-0x0;var _0xd10e82=_0x7c5c[_0x471fbd];return _0xd10e82;};'use strict';function Trunk(_0x56c8b5){this['id']=_0x56c8b5['id']||0x0;this['active']=_0x56c8b5['active']||![];this[_0xc7c5('0x0')]=_0x56c8b5[_0xc7c5('0x0')]||'';this[_0xc7c5('0x1')]=_0xc7c5('0x2');this[_0xc7c5('0x3')]=0x0;this[_0xc7c5('0x4')]=_0xc7c5('0x2');this[_0xc7c5('0x5')]=_0x56c8b5[_0xc7c5('0x5')]&&_0x56c8b5[_0xc7c5('0x5')][_0xc7c5('0x6')](':')?_0x56c8b5[_0xc7c5('0x5')][_0xc7c5('0x7')](':')[0x0]:'';this[_0xc7c5('0x8')]='';this[_0xc7c5('0x9')]='';this['domain']='';this[_0xc7c5('0xa')]='';this[_0xc7c5('0xb')]='';this['stateRegistry']=_0xc7c5('0x2');this[_0xc7c5('0xc')]='';this['address']='';this[_0xc7c5('0xd')]=_0x56c8b5[_0xc7c5('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3299592..92177fc 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 _0x6acd=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2b216a,_0x5ebea4){var _0x39ab62=function(_0x37b9bd){while(--_0x37b9bd){_0x2b216a['push'](_0x2b216a['shift']());}};_0x39ab62(++_0x5ebea4);}(_0x6acd,0x99));var _0xd6ac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6acd[_0x40a045];return _0x1a687c;};'use strict';function voiceExtension(_0x110d7b){this['id']=_0x110d7b['id']||0x0;this[_0xd6ac('0x0')]=_0x110d7b['exten']||'';this[_0xd6ac('0x1')]=_0x110d7b[_0xd6ac('0x1')]||_0xd6ac('0x2');this[_0xd6ac('0x3')]=_0x110d7b['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xade0=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x1764fd,_0x256895){var _0x13189e=function(_0x31d1a4){while(--_0x31d1a4){_0x1764fd['push'](_0x1764fd['shift']());}};_0x13189e(++_0x256895);}(_0xade0,0xb1));var _0x0ade=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0xade0[_0x5be7aa];return _0x215408;};'use strict';function voiceExtension(_0x5359b2){this['id']=_0x5359b2['id']||0x0;this[_0x0ade('0x0')]=_0x5359b2[_0x0ade('0x0')]||'';this[_0x0ade('0x1')]=_0x5359b2['recordingFormat']||_0x0ade('0x2');this['mandatoryDisposition']=_0x5359b2[_0x0ade('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 183e77e..345dd6d 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 _0x975a=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','answered','sumHoldTime','sumBillable','unmanaged','busy','inUse','invalid','loggedIn','onHold','paused','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout'];(function(_0xd81b5b,_0x15f6a7){var _0x52ffd9=function(_0x5571ea){while(--_0x5571ea){_0xd81b5b['push'](_0xd81b5b['shift']());}};_0x52ffd9(++_0x15f6a7);}(_0x975a,0x142));var _0xa975=function(_0x14c402,_0x1cf75d){_0x14c402=_0x14c402-0x0;var _0x189a02=_0x975a[_0x14c402];return _0x189a02;};'use strict';var monitorFormat={'wav':_0xa975('0x0'),'wav49':_0xa975('0x1'),'gsm':_0xa975('0x2')};var strategy={'fewestcalls':_0xa975('0x3'),'leastrecent':'leastrecent','linear':_0xa975('0x4'),'random':'random','ringall':_0xa975('0x5'),'rr':'roundrobin','rrmemory':_0xa975('0x6'),'rrordered':_0xa975('0x7'),'wrandom':_0xa975('0x8')};function VoiceQueue(_0x21f9b4){this['id']=_0x21f9b4['id']||0x0;this[_0xa975('0x9')]=_0x21f9b4[_0xa975('0x9')]||'';this[_0xa975('0xa')]=_0x21f9b4[_0xa975('0xa')]||'';this[_0xa975('0xb')]=_0x21f9b4[_0xa975('0xb')]||_0xa975('0xc');this['waiting']=0x0;this['total']=0x0;this[_0xa975('0xd')]=0x0;this['sumDuration']=0x0;this[_0xa975('0xe')]=0x0;this[_0xa975('0xf')]=0x0;this[_0xa975('0x10')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xa975('0x11')]=0x0;this[_0xa975('0x12')]=0x0;this[_0xa975('0x13')]=0x0;this[_0xa975('0x14')]=0x0;this['notInUse']=0x0;this[_0xa975('0x15')]=0x0;this[_0xa975('0x16')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xa975('0x17')]=0x0;this[_0xa975('0x18')]=0x0;this[_0xa975('0x19')]=0x0;this['acw']=_0x21f9b4[_0xa975('0x1a')]||![];this['acwTimeout']=_0x21f9b4['acwTimeout']||0xa;this[_0xa975('0x1b')]=_0x21f9b4[_0xa975('0x1b')]||'no';this[_0xa975('0x1c')]=!![];this[_0xa975('0x1d')]='';this[_0xa975('0x1e')]='';this['originated']=0x0;this[_0xa975('0x1f')]=0x0;this[_0xa975('0x20')]=_0x21f9b4[_0xa975('0x20')]||null;this[_0xa975('0x21')]=_0x21f9b4[_0xa975('0x21')]?_0x21f9b4[_0xa975('0x21')]:null;this[_0xa975('0x22')]=_0x21f9b4[_0xa975('0x22')];this['dialMethod']=_0x21f9b4[_0xa975('0x23')]||'progressive';this[_0xa975('0x24')]=_0x21f9b4[_0xa975('0x24')]||0x0;this[_0xa975('0x25')]=_0x21f9b4['dialLimitQueue']||0x0;this[_0xa975('0x26')]=_0x21f9b4[_0xa975('0x26')]||0x1;this[_0xa975('0x27')]=_0x21f9b4['dialPredictiveOptimization']||_0xa975('0x28');this['dialPredictiveOptimizationPercentage']=_0x21f9b4[_0xa975('0x29')]||0.03;this[_0xa975('0x2a')]=_0x21f9b4[_0xa975('0x2a')]||0x258;this[_0xa975('0x2b')]=_0x21f9b4[_0xa975('0x2b')]||_0xa975('0x2c');this[_0xa975('0x2d')]=_0x21f9b4[_0xa975('0x2d')]||_0xa975('0x2c');this[_0xa975('0x2e')]=_0x21f9b4['dialOriginateTimeout']||0x1e;this[_0xa975('0x2f')]=_0x21f9b4[_0xa975('0x2f')]||_0xa975('0x30');this[_0xa975('0x31')]=_0x21f9b4['dialQueueTimeout']||0x3;this[_0xa975('0x32')]=_0x21f9b4[_0xa975('0x32')]||undefined;this[_0xa975('0x33')]=_0x21f9b4[_0xa975('0x33')]||0x3;this[_0xa975('0x34')]=_0x21f9b4[_0xa975('0x34')]||0x96;this[_0xa975('0x35')]=_0x21f9b4['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x21f9b4['dialBusyRetryFrequency']||0x96;this[_0xa975('0x36')]=_0x21f9b4[_0xa975('0x36')]||0x3;this[_0xa975('0x37')]=_0x21f9b4[_0xa975('0x37')]||0x96;this[_0xa975('0x38')]=_0x21f9b4[_0xa975('0x38')]||0x3;this[_0xa975('0x39')]=_0x21f9b4['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa975('0x3a')]=_0x21f9b4[_0xa975('0x3a')]||0x3;this[_0xa975('0x3b')]=_0x21f9b4[_0xa975('0x3b')]||0x96;this[_0xa975('0x3c')]=_0x21f9b4[_0xa975('0x3c')]||0x3;this[_0xa975('0x3d')]=_0x21f9b4[_0xa975('0x3d')]||0x96;this[_0xa975('0x3e')]=_0x21f9b4[_0xa975('0x3e')]||0x3;this[_0xa975('0x3f')]=_0x21f9b4[_0xa975('0x3f')]||0x96;this[_0xa975('0x40')]=_0x21f9b4[_0xa975('0x40')]||0x3;this[_0xa975('0x41')]=_0x21f9b4[_0xa975('0x41')]||0x96;this[_0xa975('0x42')]=_0x21f9b4[_0xa975('0x42')]||0x3;this['dialGlobalMaxRetry']=_0x21f9b4[_0xa975('0x43')]||0x4;this[_0xa975('0x44')]=_0x21f9b4[_0xa975('0x44')]?_0x21f9b4[_0xa975('0x44')]:undefined;this['TrunkBackup']=_0x21f9b4[_0xa975('0x45')]?_0x21f9b4[_0xa975('0x45')]:undefined;this[_0xa975('0x46')]=_0x21f9b4[_0xa975('0x46')]||undefined;this[_0xa975('0x47')]=_0x21f9b4[_0xa975('0x47')]?_0x21f9b4[_0xa975('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x21f9b4[_0xa975('0x48')]||_0xa975('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x21f9b4[_0xa975('0x4a')]||undefined;this[_0xa975('0x4b')]=_0x21f9b4[_0xa975('0x4b')]||undefined;this[_0xa975('0x4c')]=strategy[_0x21f9b4[_0xa975('0x4c')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x21f9b4[_0xa975('0x4d')]||![];this['dialAMDInitialSilence']=_0x21f9b4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x21f9b4[_0xa975('0x4e')];this[_0xa975('0x4f')]=_0x21f9b4[_0xa975('0x4f')];this[_0xa975('0x50')]=_0x21f9b4[_0xa975('0x50')];this[_0xa975('0x51')]=_0x21f9b4[_0xa975('0x51')];this[_0xa975('0x52')]=_0x21f9b4[_0xa975('0x52')];this[_0xa975('0x53')]=_0x21f9b4[_0xa975('0x53')];this['dialAMDSilenceThreshold']=_0x21f9b4[_0xa975('0x54')];this['dialAMDMaximumWordLength']=_0x21f9b4[_0xa975('0x55')];this['outboundRejectCallsDay']=0x0;this[_0xa975('0x56')]=0x0;this['timeout']=_0x21f9b4[_0xa975('0x57')];this[_0xa975('0x58')]=0x0;this[_0xa975('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xa975('0x5a')]=0x0;this[_0xa975('0x5b')]=0x0;this[_0xa975('0x5c')]=0x0;this[_0xa975('0x5d')]=0x0;this[_0xa975('0x5e')]=0x0;this[_0xa975('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa975('0x60')]=0x0;this[_0xa975('0x61')]=0x0;this['outboundReCallsDay']=0x0;this[_0xa975('0x62')]=0x0;this[_0xa975('0x63')]=undefined;this[_0xa975('0x64')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xa975('0x65')]=0x0;this[_0xa975('0x66')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xa975('0x67')]=0x0;this[_0xa975('0x68')]=0x0;this[_0xa975('0x69')]=0x0;this[_0xa975('0x6a')]=_0x21f9b4[_0xa975('0x6b')]||0x14;this[_0xa975('0x6c')]=_0x21f9b4[_0xa975('0x6b')]||0xa;this[_0xa975('0x6d')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa975('0x6e')]=0x1;this[_0xa975('0x6f')]=0x0;this[_0xa975('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa975('0x71')]=0x0;this[_0xa975('0x72')]=_0x21f9b4[_0xa975('0x72')]||0x1e;this['dialRecallInQueue']=_0x21f9b4[_0xa975('0x73')]||![];this[_0xa975('0x74')]=!!_0x21f9b4[_0xa975('0x74')]||![];this['dialPreviewRecallmeReminder']=!!_0x21f9b4[_0xa975('0x75')]||![];this['dialQueueProject2']=_0x21f9b4['dialQueueProject2']||undefined;this[_0xa975('0x76')]=_0x21f9b4[_0xa975('0x76')]||![];this[_0xa975('0x77')]=_0x21f9b4[_0xa975('0x77')]||![];this[_0xa975('0xa')]=monitorFormat[_0x21f9b4[_0xa975('0xa')]]?monitorFormat[_0x21f9b4[_0xa975('0xa')]]:undefined;this['mandatoryDisposition']=_0x21f9b4[_0xa975('0x78')]||![];this[_0xa975('0x79')]=_0x21f9b4[_0xa975('0x79')]?_0x21f9b4[_0xa975('0x79')]:undefined;this[_0xa975('0x7a')]=![];}module[_0xa975('0x7b')]=VoiceQueue; \ No newline at end of file +var _0xbd0e=['dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumBillable','unmanaged','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x2ebc94,_0x18452f){var _0x41e814=function(_0x40126f){while(--_0x40126f){_0x2ebc94['push'](_0x2ebc94['shift']());}};_0x41e814(++_0x18452f);}(_0xbd0e,0x187));var _0xebd0=function(_0x44e4e1,_0x5637b2){_0x44e4e1=_0x44e4e1-0x0;var _0x300cd2=_0xbd0e[_0x44e4e1];return _0x300cd2;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xebd0('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0xebd0('0x1'),'leastrecent':_0xebd0('0x2'),'linear':_0xebd0('0x3'),'random':_0xebd0('0x4'),'ringall':_0xebd0('0x5'),'rr':_0xebd0('0x6'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xebd0('0x7')};function VoiceQueue(_0x3ce784){this['id']=_0x3ce784['id']||0x0;this[_0xebd0('0x8')]=_0x3ce784[_0xebd0('0x8')]||'';this[_0xebd0('0x9')]=_0x3ce784[_0xebd0('0x9')]||'';this[_0xebd0('0xa')]=_0x3ce784[_0xebd0('0xa')]||_0xebd0('0xb');this['waiting']=0x0;this[_0xebd0('0xc')]=0x0;this[_0xebd0('0xd')]=0x0;this[_0xebd0('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0xebd0('0xf')]=0x0;this[_0xebd0('0x10')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xebd0('0x11')]=0x0;this[_0xebd0('0x12')]=0x0;this[_0xebd0('0x13')]=0x0;this[_0xebd0('0x14')]=0x0;this[_0xebd0('0x15')]=0x0;this['onHold']=0x0;this[_0xebd0('0x16')]=0x0;this[_0xebd0('0x17')]=0x0;this[_0xebd0('0x18')]=0x0;this['talking']=0x0;this[_0xebd0('0x19')]=0x0;this[_0xebd0('0x1a')]=0x0;this[_0xebd0('0x1b')]=_0x3ce784[_0xebd0('0x1b')]||![];this[_0xebd0('0x1c')]=_0x3ce784[_0xebd0('0x1c')]||0xa;this[_0xebd0('0x1d')]=_0x3ce784[_0xebd0('0x1d')]||'no';this[_0xebd0('0x1e')]=!![];this[_0xebd0('0x1f')]='';this[_0xebd0('0x20')]='';this[_0xebd0('0x21')]=0x0;this[_0xebd0('0x22')]=0x0;this[_0xebd0('0x23')]=_0x3ce784[_0xebd0('0x23')]||null;this['dialGlobalInterval']=_0x3ce784[_0xebd0('0x24')]?_0x3ce784[_0xebd0('0x24')]:null;this[_0xebd0('0x25')]=_0x3ce784[_0xebd0('0x25')];this['dialMethod']=_0x3ce784[_0xebd0('0x26')]||_0xebd0('0x27');this['dialLimitChannel']=_0x3ce784[_0xebd0('0x28')]||0x0;this['dialLimitQueue']=_0x3ce784[_0xebd0('0x29')]||0x0;this[_0xebd0('0x2a')]=_0x3ce784[_0xebd0('0x2a')]||0x1;this[_0xebd0('0x2b')]=_0x3ce784['dialPredictiveOptimization']||_0xebd0('0x2c');this['dialPredictiveOptimizationPercentage']=_0x3ce784[_0xebd0('0x2d')]||0.03;this[_0xebd0('0x2e')]=_0x3ce784[_0xebd0('0x2e')]||0x258;this['dialOriginateCallerIdName']=_0x3ce784[_0xebd0('0x2f')]||_0xebd0('0x30');this[_0xebd0('0x31')]=_0x3ce784['dialOriginateCallerIdNumber']||_0xebd0('0x30');this[_0xebd0('0x32')]=_0x3ce784[_0xebd0('0x32')]||0x1e;this[_0xebd0('0x33')]=_0x3ce784['dialQueueOptions']||'tTxX';this[_0xebd0('0x34')]=_0x3ce784[_0xebd0('0x34')]||0x3;this[_0xebd0('0x35')]=_0x3ce784[_0xebd0('0x35')]||undefined;this[_0xebd0('0x36')]=_0x3ce784['dialCongestionMaxRetry']||0x3;this[_0xebd0('0x37')]=_0x3ce784[_0xebd0('0x37')]||0x96;this[_0xebd0('0x38')]=_0x3ce784[_0xebd0('0x38')]||0x3;this[_0xebd0('0x39')]=_0x3ce784['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x3ce784['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x3ce784[_0xebd0('0x3a')]||0x96;this[_0xebd0('0x3b')]=_0x3ce784[_0xebd0('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3ce784['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x3ce784[_0xebd0('0x3c')]||0x3;this[_0xebd0('0x3d')]=_0x3ce784[_0xebd0('0x3d')]||0x96;this[_0xebd0('0x3e')]=_0x3ce784[_0xebd0('0x3e')]||0x3;this[_0xebd0('0x3f')]=_0x3ce784[_0xebd0('0x3f')]||0x96;this[_0xebd0('0x40')]=_0x3ce784['dialMachineMaxRetry']||0x3;this[_0xebd0('0x41')]=_0x3ce784[_0xebd0('0x41')]||0x96;this[_0xebd0('0x42')]=_0x3ce784[_0xebd0('0x42')]||0x3;this[_0xebd0('0x43')]=_0x3ce784[_0xebd0('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3ce784[_0xebd0('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x3ce784['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x3ce784[_0xebd0('0x45')]?_0x3ce784[_0xebd0('0x45')]:undefined;this[_0xebd0('0x46')]=_0x3ce784[_0xebd0('0x46')]?_0x3ce784[_0xebd0('0x46')]:undefined;this['dialPrefix']=_0x3ce784[_0xebd0('0x47')]||undefined;this[_0xebd0('0x48')]=_0x3ce784[_0xebd0('0x48')]?_0x3ce784[_0xebd0('0x48')]:undefined;this[_0xebd0('0x49')]=_0x3ce784[_0xebd0('0x49')]||_0xebd0('0x4a');this[_0xebd0('0x4b')]=_0x3ce784[_0xebd0('0x4b')]||undefined;this['dialCutDigit']=_0x3ce784[_0xebd0('0x4c')]||undefined;this['strategy']=strategy[_0x3ce784[_0xebd0('0x4d')]];this[_0xebd0('0x4e')]=!![];this[_0xebd0('0x4f')]=_0x3ce784['dialAMDActive']||![];this[_0xebd0('0x50')]=_0x3ce784['dialAMDInitialSilence'];this[_0xebd0('0x51')]=_0x3ce784[_0xebd0('0x51')];this[_0xebd0('0x52')]=_0x3ce784['dialAMDAfterGreetingSilence'];this[_0xebd0('0x53')]=_0x3ce784[_0xebd0('0x53')];this['dialAMDMinWordLength']=_0x3ce784[_0xebd0('0x54')];this[_0xebd0('0x55')]=_0x3ce784[_0xebd0('0x55')];this[_0xebd0('0x56')]=_0x3ce784['dialAMDMaximumNumberOfWords'];this[_0xebd0('0x57')]=_0x3ce784[_0xebd0('0x57')];this[_0xebd0('0x58')]=_0x3ce784[_0xebd0('0x58')];this[_0xebd0('0x59')]=0x0;this[_0xebd0('0x5a')]=0x0;this[_0xebd0('0x5b')]=_0x3ce784[_0xebd0('0x5b')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xebd0('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xebd0('0x5d')]=0x0;this[_0xebd0('0x5e')]=0x0;this[_0xebd0('0x5f')]=0x0;this[_0xebd0('0x60')]=0x0;this[_0xebd0('0x61')]=0x0;this[_0xebd0('0x62')]=0x0;this[_0xebd0('0x63')]=0x0;this['startProgressive']=undefined;this[_0xebd0('0x64')]=undefined;this[_0xebd0('0x65')]=undefined;this[_0xebd0('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xebd0('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xebd0('0x68')]=0x0;this[_0xebd0('0x69')]=0x0;this[_0xebd0('0x6a')]=0x0;this[_0xebd0('0x6b')]=0x0;this[_0xebd0('0x6c')]=_0x3ce784[_0xebd0('0x6d')]||0x14;this[_0xebd0('0x6e')]=_0x3ce784['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xebd0('0x6f')]=0x0;this[_0xebd0('0x70')]=0x0;this[_0xebd0('0x71')]=0x1;this[_0xebd0('0x72')]=0x0;this[_0xebd0('0x73')]=0x0;this[_0xebd0('0x74')]=0x0;this['erlangBusyFactor']=0x0;this[_0xebd0('0x75')]=_0x3ce784['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x3ce784[_0xebd0('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x3ce784['dialPreviewAutoRecallMe']||![];this[_0xebd0('0x77')]=!!_0x3ce784[_0xebd0('0x77')]||![];this[_0xebd0('0x78')]=_0x3ce784[_0xebd0('0x78')]||undefined;this[_0xebd0('0x79')]=_0x3ce784['dialAgiAfterHangupClient']||![];this[_0xebd0('0x7a')]=_0x3ce784['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x3ce784[_0xebd0('0x9')]]?monitorFormat[_0x3ce784[_0xebd0('0x9')]]:undefined;this['mandatoryDisposition']=_0x3ce784[_0xebd0('0x7b')]||![];this[_0xebd0('0x7c')]=_0x3ce784[_0xebd0('0x7c')]?_0x3ce784[_0xebd0('0x7c')]:undefined;this[_0xebd0('0x7d')]=![];}module[_0xebd0('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index d9a1998..77de63b 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 _0x08d9=['startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','busy','callers','length','SIP/','online','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','available','loggedInDb','ringing','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','strategy','abandoned','answered','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x48b122,_0x2e66d2){var _0x5f573a=function(_0x3b0901){while(--_0x3b0901){_0x48b122['push'](_0x48b122['shift']());}};_0x5f573a(++_0x2e66d2);}(_0x08d9,0xc2));var _0x908d=function(_0x2af191,_0x243faa){_0x2af191=_0x2af191-0x0;var _0x4fe5af=_0x08d9[_0x2af191];return _0x4fe5af;};'use strict';var INBOUND_COUNTERS=[_0x908d('0x0'),'loggedIn',_0x908d('0x1'),'paused',_0x908d('0x2'),_0x908d('0x3'),_0x908d('0x4')];var OUTBOUND_COUNTERS=['available','answered',_0x908d('0x5'),_0x908d('0x6'),_0x908d('0x1'),_0x908d('0x7'),_0x908d('0x8'),'outboundAnswerCallsDay',_0x908d('0x9'),_0x908d('0xa'),_0x908d('0xb'),_0x908d('0xc'),_0x908d('0xd'),_0x908d('0xe'),_0x908d('0xf'),_0x908d('0x10'),_0x908d('0x11'),_0x908d('0x12'),'talking',_0x908d('0x13'),_0x908d('0x14'),_0x908d('0x15'),_0x908d('0x4')];function VoiceQueueSummary(_0xf39c48){this['id']=_0xf39c48['id'];this['name']=_0xf39c48['name'];this['strategy']=_0xf39c48[_0x908d('0x16')];this[_0x908d('0x17')]=_0xf39c48[_0x908d('0x17')]||0x0;this[_0x908d('0x18')]=_0xf39c48[_0x908d('0x18')]||0x0;this[_0x908d('0x0')]=_0xf39c48[_0x908d('0x0')]||0x0;this['busy']=_0xf39c48['busy']||0x0;this[_0x908d('0x5')]=_0xf39c48[_0x908d('0x5')]||0x0;this[_0x908d('0x19')]=_0xf39c48[_0x908d('0x19')]||0x0;this['loggedIn']=_0xf39c48['loggedIn']||0x0;this[_0x908d('0x1')]=_0xf39c48[_0x908d('0x1')]||0x0;this[_0x908d('0x1a')]=_0xf39c48[_0x908d('0x1a')]||0x0;this['notInUse']=_0xf39c48[_0x908d('0x1b')]||0x0;this[_0x908d('0x11')]=_0xf39c48[_0x908d('0x11')]||0x0;this[_0x908d('0x2')]=_0xf39c48[_0x908d('0x2')]||0x0;this[_0x908d('0x1c')]=_0xf39c48[_0x908d('0x1c')];this['sumBillable']=_0xf39c48[_0x908d('0x13')];this[_0x908d('0x14')]=_0xf39c48[_0x908d('0x14')];this['sumHoldTime']=_0xf39c48[_0x908d('0x1d')]||0x0;this[_0x908d('0x3')]=_0xf39c48[_0x908d('0x3')]||0x0;this[_0x908d('0x15')]=_0xf39c48[_0x908d('0x15')]||0x0;this['type']=_0xf39c48[_0x908d('0x1e')];this['unavailable']=_0xf39c48[_0x908d('0x1f')]||0x0;this[_0x908d('0x20')]=_0xf39c48[_0x908d('0x20')]||0x0;this[_0x908d('0x21')]=_0xf39c48[_0x908d('0x21')]||0x0;this[_0x908d('0x4')]=_0xf39c48[_0x908d('0x4')]||0x0;if(_0xf39c48[_0x908d('0x1e')]==='outbound'){this[_0x908d('0x12')]=_0xf39c48[_0x908d('0x12')]||0x0;this[_0x908d('0x22')]=_0xf39c48[_0x908d('0x22')];this[_0x908d('0x23')]=_0xf39c48['dialMethod'];this['dialOriginateCallerIdName']=_0xf39c48[_0x908d('0x24')];this[_0x908d('0x25')]=_0xf39c48[_0x908d('0x25')];this[_0x908d('0x26')]=_0xf39c48[_0x908d('0x26')];this['dialPrefix']=_0xf39c48[_0x908d('0x27')];this[_0x908d('0x28')]=_0xf39c48['temp'];this[_0x908d('0x29')]=_0xf39c48[_0x908d('0x29')];this[_0x908d('0x2a')]=_0xf39c48[_0x908d('0x2a')];this[_0x908d('0x9')]=_0xf39c48[_0x908d('0x9')];this[_0x908d('0xa')]=_0xf39c48[_0x908d('0xa')];this[_0x908d('0xb')]=_0xf39c48[_0x908d('0xb')];this[_0x908d('0x2b')]=_0xf39c48['outboundDropCallsDayACS'];this[_0x908d('0x2c')]=_0xf39c48[_0x908d('0x2c')];this[_0x908d('0x2d')]=_0xf39c48[_0x908d('0x2d')];this['outboundNoAnswerCallsDay']=_0xf39c48[_0x908d('0xc')];this[_0x908d('0xd')]=_0xf39c48[_0x908d('0xd')];this[_0x908d('0x2e')]=_0xf39c48[_0x908d('0x2e')];this[_0x908d('0xe')]=_0xf39c48[_0x908d('0xe')];this[_0x908d('0xf')]=_0xf39c48[_0x908d('0xf')];this[_0x908d('0x10')]=_0xf39c48[_0x908d('0x10')];this['predictiveIntervalAnsweredCalls']=_0xf39c48['predictiveIntervalAnsweredCalls'];this[_0x908d('0x2f')]=_0xf39c48[_0x908d('0x2f')];this['predictiveIntervalAvgTalktime']=_0xf39c48['predictiveIntervalAvgTalktime'];this[_0x908d('0x30')]=_0xf39c48[_0x908d('0x30')];this[_0x908d('0x31')]=_0xf39c48[_0x908d('0x31')];this[_0x908d('0x32')]=_0xf39c48['predictiveIntervalErlangCalls'];this[_0x908d('0x33')]=_0xf39c48[_0x908d('0x33')];this[_0x908d('0x34')]=_0xf39c48[_0x908d('0x34')];this[_0x908d('0x35')]=_0xf39c48['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0xf39c48[_0x908d('0x36')];this['predictiveIntervalAvailable']=_0xf39c48[_0x908d('0x37')];this[_0x908d('0x38')]=_0xf39c48[_0x908d('0x38')];this[_0x908d('0x7')]=_0xf39c48[_0x908d('0x7')];this[_0x908d('0x39')]=_0xf39c48[_0x908d('0x39')];this[_0x908d('0x3a')]=_0xf39c48['erlangCallToSecond'];this['erlangAbandonmentRate']=_0xf39c48[_0x908d('0x3b')];this[_0x908d('0x3c')]=_0xf39c48[_0x908d('0x3c')];this['startPredictive']=_0xf39c48['startPredictive'];this['startProgressive']=_0xf39c48[_0x908d('0x3d')];this['message']=_0xf39c48[_0x908d('0x3e')];this[_0x908d('0x3f')]=_0xf39c48[_0x908d('0x3f')];}if(_0xf39c48['Trunk']){this['Trunk']={'id':_0xf39c48['Trunk']['id'],'name':_0xf39c48[_0x908d('0x40')][_0x908d('0x41')],'active':_0xf39c48['Trunk'][_0x908d('0x42')],'callerid':_0xf39c48['Trunk'][_0x908d('0x43')]};}}VoiceQueueSummary[_0x908d('0x44')][_0x908d('0x45')]=function(_0x5bf839,_0x24dc93,_0x375d21,_0xd48ecd){this[_0x908d('0x1')]=0x0;this['talking']=0x0;this[_0x908d('0x11')]=0x0;this[_0x908d('0x20')]=0x0;this[_0x908d('0x1b')]=0x0;this[_0x908d('0x5')]=0x0;this[_0x908d('0x46')]=0x0;this['invalid']=0x0;this[_0x908d('0x1f')]=0x0;this[_0x908d('0x2')]=0x0;this[_0x908d('0x1c')]=0x0;this[_0x908d('0x1a')]=0x0;if(_0x375d21){if(_0x375d21[_0x908d('0x0')]){this[_0x908d('0x0')]=Number(_0x375d21['available']);}if(_0x375d21['loggedin']){this[_0x908d('0x6')]=Number(_0x375d21['loggedin']);}if(_0x375d21[_0x908d('0x47')]){this[_0x908d('0x4')]=Number(_0x375d21['callers']);}}for(var _0xe527c1=0x0;_0xe527c1<_0x5bf839[_0x908d('0x48')];_0xe527c1++){var _0x53dccb=_0x24dc93[_0x908d('0x49')+_0x5bf839[_0xe527c1][_0x908d('0x41')]];if(_0x53dccb&&_0x53dccb[_0x908d('0x4a')]){this[_0x908d('0x1')]+=0x1;}if(_0x5bf839[_0xe527c1]['incall']==='1'){this[_0x908d('0x3')]+=0x1;}if(_0x5bf839[_0xe527c1]['paused']==='1'&&!['2','7','8'][_0x908d('0x4b')](_0x5bf839[_0xe527c1][_0x908d('0x4c')])){this['paused']+=0x1;}switch(_0x5bf839[_0xe527c1][_0x908d('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x908d('0x5')]+=0x1;break;case'3':this[_0x908d('0x46')]+=0x1;break;case'4':this[_0x908d('0x19')]+=0x1;break;case'5':this[_0x908d('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x908d('0x23')]===_0x908d('0x4d')){var _0x41c502=Object[_0x908d('0x4e')](_0xd48ecd);for(var _0x44d091=0x0;_0x44d091<_0x41c502[_0x908d('0x48')];_0x44d091++){var _0x3f5d4f=_0x41c502[_0x44d091];var _0x32ee94=_0xd48ecd[_0x3f5d4f];if(_0x32ee94['queue']===this[_0x908d('0x41')]&&_0x32ee94['type']===_0x908d('0x4f')&&_0x32ee94[_0x908d('0x50')]===_0x908d('0x51')){this[_0x908d('0x3')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x908d('0x3')]=this[_0x908d('0x5')];}this[_0x908d('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x908d('0x44')][_0x908d('0x52')]=function(_0x32404b){var _0x27f91a=![];if(_0x32404b){_0x27f91a=INBOUND_COUNTERS[_0x908d('0x53')](function(_0x176039){return this[_0x176039]!==_0x32404b[_0x176039];},this);}return _0x27f91a;};VoiceQueueSummary[_0x908d('0x44')]['compareToOutboundQueue']=function(_0x160a65){var _0x3a357f=![];var _0x4d8abe=![];var _0x5d98f8=![];if(_0x160a65){_0x3a357f=this[_0x908d('0x23')]!==_0x160a65['dialMethod']||this[_0x908d('0x22')]!==_0x160a65[_0x908d('0x22')]||this['message']!==_0x160a65['message']||this[_0x908d('0x3f')]!==_0x160a65[_0x908d('0x3f')];_0x4d8abe=OUTBOUND_COUNTERS['some'](function(_0x38936d){return this[_0x38936d]!==_0x160a65[_0x38936d];},this);if(this[_0x908d('0x40')]&&_0x160a65[_0x908d('0x40')]){_0x5d98f8=this[_0x908d('0x40')][_0x908d('0x41')]!==_0x160a65[_0x908d('0x40')][_0x908d('0x41')]||this[_0x908d('0x40')][_0x908d('0x42')]!==_0x160a65[_0x908d('0x40')][_0x908d('0x42')];}}return _0x3a357f||_0x4d8abe||_0x5d98f8;};VoiceQueueSummary[_0x908d('0x44')]['updateReportFromOutboundQueue']=function(_0x501fc7){this[_0x908d('0x18')]=_0x501fc7['answered'];this[_0x908d('0x3e')]=_0x501fc7[_0x908d('0x3e')];this[_0x908d('0x3f')]=_0x501fc7[_0x908d('0x3f')];this[_0x908d('0x7')]=_0x501fc7[_0x908d('0x7')];this[_0x908d('0x8')]=_0x501fc7[_0x908d('0x8')];this[_0x908d('0x2a')]=_0x501fc7[_0x908d('0x2a')];this['outboundBlacklistCallsDay']=_0x501fc7[_0x908d('0x9')];this[_0x908d('0xa')]=_0x501fc7[_0x908d('0xa')];this[_0x908d('0xb')]=_0x501fc7[_0x908d('0xb')];this[_0x908d('0xc')]=_0x501fc7['outboundNoAnswerCallsDay'];this[_0x908d('0xd')]=_0x501fc7['outboundNoSuchCallsDay'];this[_0x908d('0xe')]=_0x501fc7[_0x908d('0xe')];this[_0x908d('0xf')]=_0x501fc7[_0x908d('0xf')];this[_0x908d('0x10')]=_0x501fc7[_0x908d('0x10')];this['sumBillable']=_0x501fc7[_0x908d('0x13')];this[_0x908d('0x14')]=_0x501fc7[_0x908d('0x14')];this[_0x908d('0x15')]=_0x501fc7[_0x908d('0x15')];if(this[_0x908d('0x23')]==='preview'){this[_0x908d('0x12')]=_0x501fc7[_0x908d('0x12')];}};module[_0x908d('0x54')]=VoiceQueueSummary; \ No newline at end of file +var _0x81bd=['outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','xcally-motion-preview','some','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x81bd,0x7c));var _0xd81b=function(_0x20cf28,_0x324bb8){_0x20cf28=_0x20cf28-0x0;var _0x4af1e2=_0x81bd[_0x20cf28];return _0x4af1e2;};'use strict';var INBOUND_COUNTERS=[_0xd81b('0x0'),_0xd81b('0x1'),_0xd81b('0x2'),_0xd81b('0x3'),_0xd81b('0x4'),_0xd81b('0x5'),_0xd81b('0x6')];var OUTBOUND_COUNTERS=['available',_0xd81b('0x7'),_0xd81b('0x8'),_0xd81b('0x1'),'loggedInDb',_0xd81b('0x9'),_0xd81b('0xa'),_0xd81b('0xb'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0xd81b('0xc'),'outboundNoAnswerCallsDay',_0xd81b('0xd'),_0xd81b('0xe'),_0xd81b('0xf'),_0xd81b('0x10'),_0xd81b('0x3'),_0xd81b('0x11'),_0xd81b('0x5'),_0xd81b('0x12'),_0xd81b('0x13'),_0xd81b('0x14'),_0xd81b('0x6')];function VoiceQueueSummary(_0x3914f7){this['id']=_0x3914f7['id'];this[_0xd81b('0x15')]=_0x3914f7['name'];this[_0xd81b('0x16')]=_0x3914f7['strategy'];this[_0xd81b('0x17')]=_0x3914f7[_0xd81b('0x17')]||0x0;this['answered']=_0x3914f7[_0xd81b('0x7')]||0x0;this['available']=_0x3914f7[_0xd81b('0x0')]||0x0;this[_0xd81b('0x18')]=_0x3914f7[_0xd81b('0x18')]||0x0;this[_0xd81b('0x8')]=_0x3914f7[_0xd81b('0x8')]||0x0;this['invalid']=_0x3914f7[_0xd81b('0x19')]||0x0;this[_0xd81b('0x1')]=_0x3914f7['loggedIn']||0x0;this[_0xd81b('0x2')]=_0x3914f7[_0xd81b('0x2')]||0x0;this[_0xd81b('0x1a')]=_0x3914f7[_0xd81b('0x1a')]||0x0;this[_0xd81b('0x1b')]=_0x3914f7[_0xd81b('0x1b')]||0x0;this[_0xd81b('0x3')]=_0x3914f7[_0xd81b('0x3')]||0x0;this[_0xd81b('0x4')]=_0x3914f7[_0xd81b('0x4')]||0x0;this[_0xd81b('0x1c')]=_0x3914f7[_0xd81b('0x1c')];this[_0xd81b('0x12')]=_0x3914f7[_0xd81b('0x12')];this[_0xd81b('0x13')]=_0x3914f7[_0xd81b('0x13')];this['sumHoldTime']=_0x3914f7['sumHoldTime']||0x0;this[_0xd81b('0x5')]=_0x3914f7[_0xd81b('0x5')]||0x0;this[_0xd81b('0x14')]=_0x3914f7['total']||0x0;this[_0xd81b('0x1d')]=_0x3914f7[_0xd81b('0x1d')];this['unavailable']=_0x3914f7[_0xd81b('0x1e')]||0x0;this[_0xd81b('0x1f')]=_0x3914f7[_0xd81b('0x1f')]||0x0;this[_0xd81b('0x20')]=_0x3914f7[_0xd81b('0x20')]||0x0;this[_0xd81b('0x6')]=_0x3914f7[_0xd81b('0x6')]||0x0;if(_0x3914f7[_0xd81b('0x1d')]===_0xd81b('0x21')){this[_0xd81b('0x11')]=_0x3914f7[_0xd81b('0x11')]||0x0;this[_0xd81b('0x22')]=_0x3914f7['dialActive'];this[_0xd81b('0x23')]=_0x3914f7[_0xd81b('0x23')];this[_0xd81b('0x24')]=_0x3914f7[_0xd81b('0x24')];this[_0xd81b('0x25')]=_0x3914f7[_0xd81b('0x25')];this[_0xd81b('0x26')]=_0x3914f7[_0xd81b('0x26')];this[_0xd81b('0x27')]=_0x3914f7['dialPrefix'];this[_0xd81b('0x28')]=_0x3914f7['temp'];this['outboundAnswerAgiCallsDay']=_0x3914f7[_0xd81b('0x29')];this[_0xd81b('0xb')]=_0x3914f7['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x3914f7[_0xd81b('0x2a')];this[_0xd81b('0x2b')]=_0x3914f7[_0xd81b('0x2b')];this[_0xd81b('0xc')]=_0x3914f7[_0xd81b('0xc')];this[_0xd81b('0x2c')]=_0x3914f7['outboundDropCallsDayACS'];this[_0xd81b('0x2d')]=_0x3914f7[_0xd81b('0x2d')];this['outboundDropCallsDayTimeout']=_0x3914f7['outboundDropCallsDayTimeout'];this[_0xd81b('0x2e')]=_0x3914f7[_0xd81b('0x2e')];this['outboundNoSuchCallsDay']=_0x3914f7['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x3914f7[_0xd81b('0x2f')];this[_0xd81b('0xe')]=_0x3914f7[_0xd81b('0xe')];this[_0xd81b('0xf')]=_0x3914f7[_0xd81b('0xf')];this[_0xd81b('0x10')]=_0x3914f7[_0xd81b('0x10')];this['predictiveIntervalAnsweredCalls']=_0x3914f7[_0xd81b('0x30')];this['predictiveIntervalAvgHoldtime']=_0x3914f7[_0xd81b('0x31')];this[_0xd81b('0x32')]=_0x3914f7[_0xd81b('0x32')];this[_0xd81b('0x33')]=_0x3914f7[_0xd81b('0x33')];this[_0xd81b('0x34')]=_0x3914f7[_0xd81b('0x34')];this[_0xd81b('0x35')]=_0x3914f7[_0xd81b('0x35')];this[_0xd81b('0x36')]=_0x3914f7[_0xd81b('0x36')];this[_0xd81b('0x37')]=_0x3914f7[_0xd81b('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x3914f7['predictiveIntervalMultiplicativeFactor'];this[_0xd81b('0x38')]=_0x3914f7[_0xd81b('0x38')];this[_0xd81b('0x39')]=_0x3914f7['predictiveIntervalAvailable'];this[_0xd81b('0x3a')]=_0x3914f7[_0xd81b('0x3a')];this['originated']=_0x3914f7[_0xd81b('0x9')];this[_0xd81b('0x3b')]=_0x3914f7['erlangCalls'];this[_0xd81b('0x3c')]=_0x3914f7['erlangCallToSecond'];this[_0xd81b('0x3d')]=_0x3914f7[_0xd81b('0x3d')];this[_0xd81b('0x3e')]=_0x3914f7[_0xd81b('0x3e')];this['startPredictive']=_0x3914f7[_0xd81b('0x3f')];this[_0xd81b('0x40')]=_0x3914f7[_0xd81b('0x40')];this[_0xd81b('0x41')]=_0x3914f7[_0xd81b('0x41')];this[_0xd81b('0x42')]=_0x3914f7[_0xd81b('0x42')];}if(_0x3914f7['Trunk']){this[_0xd81b('0x43')]={'id':_0x3914f7[_0xd81b('0x43')]['id'],'name':_0x3914f7[_0xd81b('0x43')]['name'],'active':_0x3914f7[_0xd81b('0x43')][_0xd81b('0x44')],'callerid':_0x3914f7[_0xd81b('0x43')][_0xd81b('0x45')]};}}VoiceQueueSummary[_0xd81b('0x46')]['createReport']=function(_0x3dfba7,_0x11d617,_0x448e24,_0x43ea38){this[_0xd81b('0x2')]=0x0;this[_0xd81b('0x5')]=0x0;this[_0xd81b('0x3')]=0x0;this[_0xd81b('0x1f')]=0x0;this[_0xd81b('0x1b')]=0x0;this[_0xd81b('0x8')]=0x0;this[_0xd81b('0x18')]=0x0;this['invalid']=0x0;this[_0xd81b('0x1e')]=0x0;this[_0xd81b('0x4')]=0x0;this[_0xd81b('0x1c')]=0x0;this[_0xd81b('0x1a')]=0x0;if(_0x448e24){if(_0x448e24[_0xd81b('0x0')]){this[_0xd81b('0x0')]=Number(_0x448e24[_0xd81b('0x0')]);}if(_0x448e24[_0xd81b('0x47')]){this['loggedIn']=Number(_0x448e24['loggedin']);}if(_0x448e24[_0xd81b('0x48')]){this[_0xd81b('0x6')]=Number(_0x448e24[_0xd81b('0x48')]);}}for(var _0x222c5e=0x0;_0x222c5e<_0x3dfba7[_0xd81b('0x49')];_0x222c5e++){var _0x37031b=_0x11d617[_0xd81b('0x4a')+_0x3dfba7[_0x222c5e][_0xd81b('0x15')]];if(_0x37031b&&_0x37031b[_0xd81b('0x4b')]){this[_0xd81b('0x2')]+=0x1;}if(_0x3dfba7[_0x222c5e][_0xd81b('0x4c')]==='1'){this[_0xd81b('0x5')]+=0x1;}if(_0x3dfba7[_0x222c5e]['paused']==='1'&&!['2','7','8'][_0xd81b('0x4d')](_0x3dfba7[_0x222c5e][_0xd81b('0x4e')])){this[_0xd81b('0x3')]+=0x1;}switch(_0x3dfba7[_0x222c5e][_0xd81b('0x4e')]){case'0':this[_0xd81b('0x1f')]+=0x1;break;case'1':this[_0xd81b('0x1b')]+=0x1;break;case'2':this[_0xd81b('0x8')]+=0x1;break;case'3':this[_0xd81b('0x18')]+=0x1;break;case'4':this[_0xd81b('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xd81b('0x4')]+=0x1;break;case'7':this[_0xd81b('0x1c')]+=0x1;break;case'8':this[_0xd81b('0x1a')]+=0x1;break;}}if(this[_0xd81b('0x23')]==='booked'){var _0x43e8fe=Object[_0xd81b('0x4f')](_0x43ea38);for(var _0x15030b=0x0;_0x15030b<_0x43e8fe[_0xd81b('0x49')];_0x15030b++){var _0x2699e6=_0x43e8fe[_0x15030b];var _0x434ae5=_0x43ea38[_0x2699e6];if(_0x434ae5[_0xd81b('0x50')]===this[_0xd81b('0x15')]&&_0x434ae5[_0xd81b('0x1d')]==='dialer'&&_0x434ae5['exten']===_0xd81b('0x51')){this[_0xd81b('0x5')]+=0x1;}}if(this[_0xd81b('0x5')]>this[_0xd81b('0x8')]){this[_0xd81b('0x5')]=this[_0xd81b('0x8')];}this[_0xd81b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xd81b('0x46')]['compareToInboundQueue']=function(_0x2db83b){var _0x34706d=![];if(_0x2db83b){_0x34706d=INBOUND_COUNTERS[_0xd81b('0x52')](function(_0x3d171a){return this[_0x3d171a]!==_0x2db83b[_0x3d171a];},this);}return _0x34706d;};VoiceQueueSummary[_0xd81b('0x46')]['compareToOutboundQueue']=function(_0x647c56){var _0x44e03b=![];var _0x50d940=![];var _0x1f13c3=![];if(_0x647c56){_0x44e03b=this[_0xd81b('0x23')]!==_0x647c56[_0xd81b('0x23')]||this[_0xd81b('0x22')]!==_0x647c56[_0xd81b('0x22')]||this[_0xd81b('0x41')]!==_0x647c56[_0xd81b('0x41')]||this[_0xd81b('0x42')]!==_0x647c56[_0xd81b('0x42')];_0x50d940=OUTBOUND_COUNTERS[_0xd81b('0x52')](function(_0x2fa737){return this[_0x2fa737]!==_0x647c56[_0x2fa737];},this);if(this['Trunk']&&_0x647c56[_0xd81b('0x43')]){_0x1f13c3=this['Trunk'][_0xd81b('0x15')]!==_0x647c56[_0xd81b('0x43')][_0xd81b('0x15')]||this[_0xd81b('0x43')][_0xd81b('0x44')]!==_0x647c56[_0xd81b('0x43')]['active'];}}return _0x44e03b||_0x50d940||_0x1f13c3;};VoiceQueueSummary[_0xd81b('0x46')][_0xd81b('0x53')]=function(_0x51f5a1){this['answered']=_0x51f5a1[_0xd81b('0x7')];this['message']=_0x51f5a1[_0xd81b('0x41')];this['statusMessage']=_0x51f5a1[_0xd81b('0x42')];this[_0xd81b('0x9')]=_0x51f5a1[_0xd81b('0x9')];this['outboundAbandonedCallsDay']=_0x51f5a1[_0xd81b('0xa')];this[_0xd81b('0xb')]=_0x51f5a1['outboundAnswerCallsDay'];this[_0xd81b('0x2a')]=_0x51f5a1[_0xd81b('0x2a')];this['outboundBusyCallsDay']=_0x51f5a1[_0xd81b('0x2b')];this['outboundCongestionCallsDay']=_0x51f5a1[_0xd81b('0xc')];this[_0xd81b('0x2e')]=_0x51f5a1[_0xd81b('0x2e')];this[_0xd81b('0xd')]=_0x51f5a1[_0xd81b('0xd')];this[_0xd81b('0xe')]=_0x51f5a1[_0xd81b('0xe')];this[_0xd81b('0xf')]=_0x51f5a1[_0xd81b('0xf')];this[_0xd81b('0x10')]=_0x51f5a1['outboundUnknownCallsDay'];this[_0xd81b('0x12')]=_0x51f5a1[_0xd81b('0x12')];this[_0xd81b('0x13')]=_0x51f5a1[_0xd81b('0x13')];this[_0xd81b('0x14')]=_0x51f5a1[_0xd81b('0x14')];if(this[_0xd81b('0x23')]==='preview'){this['pTalking']=_0x51f5a1['pTalking'];}};module[_0xd81b('0x54')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ee41196..507de52 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 _0xd3e3=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x28c02d,_0x32daa3){_0x28c02d=_0x28c02d-0x0;var _0x4a81f5=_0xd3e3[_0x28c02d];return _0x4a81f5;};'use strict';function VtigerAccount(_0x41fc16){this['id']=_0x41fc16['id']||0x0;this[_0x3d3e('0x0')]=_0x41fc16[_0x3d3e('0x0')]||'';this[_0x3d3e('0x1')]=_0x41fc16['username']||'';this[_0x3d3e('0x2')]=_0x41fc16[_0x3d3e('0x2')]||'';this['remoteUri']=_0x41fc16[_0x3d3e('0x3')]||'';this[_0x3d3e('0x4')]=_0x41fc16['serverUrl']||'';this[_0x3d3e('0x5')]=_0x41fc16[_0x3d3e('0x5')]||{};}module[_0x3d3e('0x6')]=VtigerAccount; \ No newline at end of file +var _0x3a2d=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2f1715,_0x49c6f1){var _0x2ff444=function(_0x3b3123){while(--_0x3b3123){_0x2f1715['push'](_0x2f1715['shift']());}};_0x2ff444(++_0x49c6f1);}(_0x3a2d,0x17f));var _0xd3a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a2d[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x2469d5){this['id']=_0x2469d5['id']||0x0;this[_0xd3a2('0x0')]=_0x2469d5['name']||'';this[_0xd3a2('0x1')]=_0x2469d5['username']||'';this[_0xd3a2('0x2')]=_0x2469d5[_0xd3a2('0x2')]||'';this[_0xd3a2('0x3')]=_0x2469d5[_0xd3a2('0x3')]||'';this['serverUrl']=_0x2469d5[_0xd3a2('0x4')]||'';this[_0xd3a2('0x5')]=_0x2469d5['Configurations']||{};}module[_0xd3a2('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b4dda68..a6cd798 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 _0xa247=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_0xa247,0x19a));var _0x7a24=function(_0x5708d4,_0x46e835){_0x5708d4=_0x5708d4-0x0;var _0x4eade3=_0xa247[_0x5708d4];return _0x4eade3;};'use strict';function ZendeskAccount(_0x246334){this['id']=_0x246334['id']||0x0;this[_0x7a24('0x0')]=_0x246334[_0x7a24('0x0')]||'';this[_0x7a24('0x1')]=_0x246334[_0x7a24('0x1')]||'';this[_0x7a24('0x2')]=_0x246334[_0x7a24('0x2')]||'';this['token']=_0x246334[_0x7a24('0x3')]||'';this[_0x7a24('0x4')]=_0x246334[_0x7a24('0x4')]||'';this[_0x7a24('0x5')]=_0x246334[_0x7a24('0x5')]||'';this[_0x7a24('0x6')]=_0x246334['type']||'integrationTab';this['serverUrl']=_0x246334[_0x7a24('0x7')]||'';this[_0x7a24('0x8')]=_0x246334['Configurations']||{};}module[_0x7a24('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x07ff=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password','token'];(function(_0x4ecbdd,_0xaaa89){var _0x52e6ee=function(_0x29bee6){while(--_0x29bee6){_0x4ecbdd['push'](_0x4ecbdd['shift']());}};_0x52e6ee(++_0xaaa89);}(_0x07ff,0xb0));var _0xf07f=function(_0x1deb27,_0x3cccc4){_0x1deb27=_0x1deb27-0x0;var _0x4f2cbd=_0x07ff[_0x1deb27];return _0x4f2cbd;};'use strict';function ZendeskAccount(_0x22756e){this['id']=_0x22756e['id']||0x0;this['name']=_0x22756e[_0xf07f('0x0')]||'';this[_0xf07f('0x1')]=_0x22756e['username']||'';this[_0xf07f('0x2')]=_0x22756e[_0xf07f('0x2')]||'';this[_0xf07f('0x3')]=_0x22756e[_0xf07f('0x3')]||'';this[_0xf07f('0x4')]=_0x22756e[_0xf07f('0x4')]||'';this['authType']=_0x22756e[_0xf07f('0x5')]||'';this['type']=_0x22756e[_0xf07f('0x6')]||_0xf07f('0x7');this[_0xf07f('0x8')]=_0x22756e[_0xf07f('0x8')]||'';this[_0xf07f('0x9')]=_0x22756e[_0xf07f('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f664e3a..7374dc8 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 _0x56c3=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x56c3,0x135));var _0x356c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56c3[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x41f875){this['id']=_0x41f875['id']||0x0;this[_0x356c('0x0')]=_0x41f875[_0x356c('0x0')]||'';this[_0x356c('0x1')]=_0x41f875['description']||'';this[_0x356c('0x2')]=_0x41f875['host']||'';this[_0x356c('0x3')]=_0x41f875[_0x356c('0x3')]||'';this[_0x356c('0x4')]=_0x41f875['clientId']||'';this[_0x356c('0x5')]=_0x41f875['clientSecret']||'';this[_0x356c('0x6')]=_0x41f875[_0x356c('0x6')]||'';this[_0x356c('0x7')]=_0x41f875[_0x356c('0x7')]||'';this[_0x356c('0x8')]=_0x41f875['refreshToken']||'';this[_0x356c('0x9')]=_0x41f875[_0x356c('0x9')]||{};}module[_0x356c('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6ee0=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ee0,0x178));var _0x06ee=function(_0x2a8fc2,_0x12c063){_0x2a8fc2=_0x2a8fc2-0x0;var _0xe236b6=_0x6ee0[_0x2a8fc2];return _0xe236b6;};'use strict';function ZohoAccount(_0xd09907){this['id']=_0xd09907['id']||0x0;this[_0x06ee('0x0')]=_0xd09907['name']||'';this[_0x06ee('0x1')]=_0xd09907[_0x06ee('0x1')]||'';this['host']=_0xd09907['host']||'';this[_0x06ee('0x2')]=_0xd09907[_0x06ee('0x2')]||'';this[_0x06ee('0x3')]=_0xd09907[_0x06ee('0x3')]||'';this[_0x06ee('0x4')]=_0xd09907[_0x06ee('0x4')]||'';this[_0x06ee('0x5')]=_0xd09907[_0x06ee('0x5')]||'';this[_0x06ee('0x6')]=_0xd09907[_0x06ee('0x6')]||'';this[_0x06ee('0x7')]=_0xd09907['refreshToken']||'';this['Configurations']=_0xd09907[_0x06ee('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4881c20..c99643d 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 _0x3423=['Agent','membername','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','prototype','getCaller','format','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3342('0x0'));function checkNameSurname(_0x16bdb3,_0x3477de,_0x3b763d){var _0x21bdc2='';if(!_[_0x3342('0x1')](_0x3477de)&&_0x3342('0x2')===typeof _0x3477de){_0x21bdc2+=_0x3477de;}if(!_[_0x3342('0x1')](_0x3b763d)&&_0x3342('0x2')===typeof _0x3b763d){_0x21bdc2+='\x20'+_0x3b763d;}if(_0x21bdc2!==''){return _0x21bdc2;}return _0x16bdb3;}function Action(_0x19206f,_0x467453,_0x2ccbe0,_0x29c40c,_0x420d4b){this[_0x3342('0x3')]=_0x2ccbe0||undefined;this[_0x3342('0x4')]=_0x19206f['id'];this[_0x3342('0x5')]=_0x467453[_0x3342('0x6')];this[_0x3342('0x7')]=_0x467453['type'];this['campaigntype']=_0x3342('0x5');this['dialAnswer']=![];this['membername']=_['isNil'](_0x19206f['Agent'])?undefined:_0x19206f[_0x3342('0x8')][_0x3342('0x6')];this['channelAgent']=this[_0x3342('0x9')]?util['format'](_0x3342('0xa'),this[_0x3342('0x9')]):_0x29c40c||undefined;this['calleridname']=checkNameSurname(_0x19206f[_0x3342('0xb')][_0x3342('0xc')],_0x19206f[_0x3342('0xb')][_0x3342('0xd')],_0x19206f[_0x3342('0xb')][_0x3342('0xe')]);this[_0x3342('0xf')]=_0x19206f['active']||![];this[_0x3342('0x10')]=_0x19206f[_0x3342('0xc')];this['scheduledat']=_0x19206f[_0x3342('0x11')];this[_0x3342('0x12')]=_0x19206f['countbusyretry']||0x0;this['countcongestionretry']=_0x19206f[_0x3342('0x13')]||0x0;this[_0x3342('0x14')]=_0x19206f[_0x3342('0x14')]||0x0;this[_0x3342('0x15')]=(_0x19206f[_0x3342('0x12')]||0x0)+(_0x19206f[_0x3342('0x13')]||0x0)+(_0x19206f[_0x3342('0x14')]||0x0)+(_0x19206f[_0x3342('0x16')]||0x0)+(_0x19206f[_0x3342('0x17')]||0x0)+(_0x19206f['countabandonedretry']||0x0)+(_0x19206f[_0x3342('0x18')]||0x0)+(_0x19206f[_0x3342('0x19')]||0x0);this[_0x3342('0x16')]=_0x19206f['countnosuchnumberretry']||0x0;this[_0x3342('0x17')]=_0x19206f[_0x3342('0x17')]||0x0;this['countabandonedretry']=_0x19206f[_0x3342('0x1a')]||0x0;this[_0x3342('0x18')]=_0x19206f['countmachineretry']||0x0;this[_0x3342('0x19')]=_0x19206f['countagentrejectretry']||0x0;this[_0x3342('0x1b')]=_0x19206f[_0x3342('0x1b')];this[_0x3342('0x1c')]=_0x19206f[_0x3342('0x1c')];this[_0x3342('0x1d')]=_0x19206f[_0x3342('0x1d')];this[_0x3342('0x1e')]=_0x19206f[_0x3342('0x1e')];this['ContactId']=_0x19206f[_0x3342('0x1f')];this['ListId']=_0x19206f['ListId'];this[_0x3342('0x20')]=_['isNil'](_0x19206f['Agent'])?_0x19206f[_0x3342('0x20')]:_0x19206f['Agent']['id'];this[_0x3342('0x21')]=_0x19206f['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x3342('0x22')][_0x3342('0x23')]=function(){return util[_0x3342('0x24')]('\x22%s\x22\x20<%s>',this[_0x3342('0x25')],this[_0x3342('0x26')]);};module[_0x3342('0x27')]=Action; \ No newline at end of file +var _0x781d=['calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','Agent','UserId','VoiceQueueId','prototype','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','membername','name','channelAgent','format','SIP/%s'];(function(_0x2031ab,_0x2a992b){var _0xda637b=function(_0x545ed5){while(--_0x545ed5){_0x2031ab['push'](_0x2031ab['shift']());}};_0xda637b(++_0x2a992b);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xd781('0x0'));var _=require(_0xd781('0x1'));var moment=require('moment');function checkNameSurname(_0x5c1007,_0xb125bf,_0x44a72d){var _0x3cd308='';if(!_[_0xd781('0x2')](_0xb125bf)&&_0xd781('0x3')===typeof _0xb125bf){_0x3cd308+=_0xb125bf;}if(!_[_0xd781('0x2')](_0x44a72d)&&_0xd781('0x3')===typeof _0x44a72d){_0x3cd308+='\x20'+_0x44a72d;}if(_0x3cd308!==''){return _0x3cd308;}return _0x5c1007;}function Action(_0x1d4f4e,_0x830b,_0x2f98ee,_0x5a07f0,_0x133509){this[_0xd781('0x4')]=_0x2f98ee||undefined;this[_0xd781('0x5')]=_0x1d4f4e['id'];this[_0xd781('0x6')]=_0x830b['name'];this[_0xd781('0x7')]=_0x830b['type'];this[_0xd781('0x8')]=_0xd781('0x6');this['dialAnswer']=![];this[_0xd781('0x9')]=_[_0xd781('0x2')](_0x1d4f4e['Agent'])?undefined:_0x1d4f4e['Agent'][_0xd781('0xa')];this[_0xd781('0xb')]=this[_0xd781('0x9')]?util[_0xd781('0xc')](_0xd781('0xd'),this[_0xd781('0x9')]):_0x5a07f0||undefined;this[_0xd781('0xe')]=checkNameSurname(_0x1d4f4e[_0xd781('0xf')][_0xd781('0x10')],_0x1d4f4e[_0xd781('0xf')][_0xd781('0x11')],_0x1d4f4e['Contact'][_0xd781('0x12')]);this[_0xd781('0x13')]=_0x1d4f4e['active']||![];this[_0xd781('0x14')]=_0x1d4f4e['phone'];this[_0xd781('0x15')]=_0x1d4f4e[_0xd781('0x15')];this[_0xd781('0x16')]=_0x1d4f4e[_0xd781('0x16')]||0x0;this[_0xd781('0x17')]=_0x1d4f4e[_0xd781('0x17')]||0x0;this[_0xd781('0x18')]=_0x1d4f4e['countnoanswerretry']||0x0;this[_0xd781('0x19')]=(_0x1d4f4e[_0xd781('0x16')]||0x0)+(_0x1d4f4e[_0xd781('0x17')]||0x0)+(_0x1d4f4e[_0xd781('0x18')]||0x0)+(_0x1d4f4e[_0xd781('0x1a')]||0x0)+(_0x1d4f4e[_0xd781('0x1b')]||0x0)+(_0x1d4f4e[_0xd781('0x1c')]||0x0)+(_0x1d4f4e[_0xd781('0x1d')]||0x0)+(_0x1d4f4e['countagentrejectretry']||0x0);this[_0xd781('0x1a')]=_0x1d4f4e[_0xd781('0x1a')]||0x0;this[_0xd781('0x1b')]=_0x1d4f4e[_0xd781('0x1b')]||0x0;this[_0xd781('0x1c')]=_0x1d4f4e[_0xd781('0x1c')]||0x0;this[_0xd781('0x1d')]=_0x1d4f4e['countmachineretry']||0x0;this[_0xd781('0x1e')]=_0x1d4f4e['countagentrejectretry']||0x0;this['callback']=_0x1d4f4e[_0xd781('0x1f')];this['callbackuniqueid']=_0x1d4f4e[_0xd781('0x20')];this[_0xd781('0x21')]=_0x1d4f4e[_0xd781('0x21')];this[_0xd781('0x22')]=_0x1d4f4e[_0xd781('0x22')];this[_0xd781('0x23')]=_0x1d4f4e[_0xd781('0x23')];this[_0xd781('0x24')]=_0x1d4f4e[_0xd781('0x24')];this['UserId']=_['isNil'](_0x1d4f4e[_0xd781('0x25')])?_0x1d4f4e[_0xd781('0x26')]:_0x1d4f4e[_0xd781('0x25')]['id'];this['VoiceQueueId']=_0x1d4f4e[_0xd781('0x27')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xd781('0x28')]['getCaller']=function(){return util[_0xd781('0xc')](_0xd781('0x29'),this['calleridname'],this['number']);};module[_0xd781('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e848a0a..2379a72 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x36b74a,_0x3a4eb8){var _0x330a4f=function(_0x54f89d){while(--_0x54f89d){_0x36b74a['push'](_0x36b74a['shift']());}};_0x330a4f(++_0x3a4eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1e3f86,_0x51af80){var _0x2533f3=function(_0x500afc){while(--_0x500afc){_0x1e3f86['push'](_0x1e3f86['shift']());}};_0x2533f3(++_0x51af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 202b8c5..4acbcdc 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 _0x2293=['error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','COMPLETED','create','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0x2c6bb7,_0x2a846b){var _0x149a9d=function(_0xca9f82){while(--_0xca9f82){_0x2c6bb7['push'](_0x2c6bb7['shift']());}};_0x149a9d(++_0x2a846b);}(_0x2293,0x11b));var _0x3229=function(_0x1516de,_0x56e673){_0x1516de=_0x1516de-0x0;var _0x409e9e=_0x2293[_0x1516de];return _0x409e9e;};'use strict';var util=require(_0x3229('0x0'));var BPromise=require('bluebird');var logger=require(_0x3229('0x1'))(_0x3229('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x3229('0x3'));var voiceQueueReport=require(_0x3229('0x4'));function loggerCatch(_0x4bc84e){return function(_0x19aafe){logger[_0x3229('0x5')](_0x4bc84e,util[_0x3229('0x6')](_0x19aafe,{'showHidden':![],'depth':null}));};}function create(_0x405963){return cmHopperHistory['createHistory'](_0x405963)[_0x3229('0x7')](loggerCatch(_0x3229('0x8')));}function createAgent(_0x44c2e8){return BPromise[_0x3229('0x9')]()[_0x3229('0xa')](agentReportPreview[_0x3229('0xb')](_0x44c2e8))['catch'](loggerCatch(_0x3229('0x8')));}function moveContact(_0x3bbf61){return cmHopper[_0x3229('0xc')](_0x3bbf61,!![])[_0x3229('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x4f842f){return cmHopperBlack[_0x3229('0xd')](_0x4f842f)['catch'](loggerCatch(_0x3229('0xe')));};exports[_0x3229('0xf')]=function(_0x548777){return BPromise[_0x3229('0x9')]()[_0x3229('0xa')](cmHopper[_0x3229('0xf')](_0x548777))[_0x3229('0x7')](loggerCatch(_0x3229('0x10')));};exports[_0x3229('0xb')]=function(_0x1bd09d,_0x1b611d){create(_0x1bd09d)[_0x3229('0x7')](loggerCatch(_0x1b611d));moveContact(_0x1bd09d)[_0x3229('0x7')](loggerCatch(_0x1b611d));};exports[_0x3229('0x11')]=function(_0x413081,_0x36346f){createAgent(_0x413081)['catch'](loggerCatch(_0x36346f));};exports[_0x3229('0x12')]=function(_0x2b5f6d,_0x54c462){create(_0x2b5f6d)['catch'](loggerCatch(_0x54c462));};exports['createCustomerFinal']=function(_0xd95114,_0x13a5ac){moveContact(_0xd95114)['catch'](loggerCatch(_0x13a5ac));};exports['rescheduleContact']=function(_0x3226ea,_0x54404a,_0x56c44b){if(_0x54404a){_0x3226ea[_0x3229('0x13')]=null;}if(_0x56c44b){_0x3226ea[_0x3229('0x14')]=![];}return cmHopper['rescheduleContact'](_0x3226ea)[_0x3229('0x7')](loggerCatch(_0x3229('0x15')));};exports[_0x3229('0x16')]=function(_0x22a1bc){return cmHopper[_0x3229('0x16')](_0x22a1bc)[_0x3229('0x7')](loggerCatch(_0x3229('0x17')));};exports[_0x3229('0x18')]=function(_0x4249dd){return cmHopper['unlockContact']({'UserId':null},_0x4249dd,0x1)[_0x3229('0x7')](loggerCatch(_0x3229('0x19')));};exports['disableContact']=function(_0x376310){return cmHopper[_0x3229('0x18')]({'active':![]},_0x376310,0x1)[_0x3229('0x7')](loggerCatch('[activeContact]\x20'));};exports[_0x3229('0x1a')]=function(_0x12546a){var _0x35db09={};_0x35db09[_0x3229('0x1b')]=_0x12546a[_0x3229('0x1b')];_0x35db09[_0x3229('0x1c')]=_0x12546a[_0x3229('0x1c')];_0x35db09[_0x3229('0x1d')]=_0x12546a[_0x3229('0x1d')];_0x35db09[_0x3229('0x1e')]=_0x12546a[_0x3229('0x1e')];_0x35db09[_0x3229('0x1f')]=_0x12546a[_0x3229('0x1f')];_0x35db09['queuecallerjoinAt']=_0x12546a['answertime'];_0x35db09[_0x3229('0x20')]=_0x12546a[_0x3229('0x21')];_0x35db09[_0x3229('0x22')]=0x1;_0x35db09[_0x3229('0x23')]=_0x12546a['endtime'];_0x35db09[_0x3229('0x24')]=_0x12546a[_0x3229('0x25')];_0x35db09['context']=_0x3229('0x26');_0x35db09[_0x3229('0x27')]=_0x3229('0x28');_0x35db09[_0x3229('0x29')]=0x0;_0x35db09[_0x3229('0x2a')]=0x1;_0x35db09['lastAssignedTo']=_0x12546a[_0x3229('0x25')];_0x35db09['queuecallerexitreason']=_0x3229('0x2b');return BPromise[_0x3229('0x9')]()[_0x3229('0xa')](voiceQueueReport[_0x3229('0x2c')](_0x35db09))[_0x3229('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0xddc222,_0xacb3e2){return BPromise[_0x3229('0x9')]()[_0x3229('0xa')](cmHopper['getContactRecallMe'](_0xddc222,_0xacb3e2))[_0x3229('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x3229('0x2d')]=function(_0x111ed2){return cmHopper[_0x3229('0x2e')](_0x111ed2,!![],!![])[_0x3229('0x7')](loggerCatch(_0x3229('0x2f')));}; \ No newline at end of file +var _0x6509=['getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create'];(function(_0x35e6cb,_0x5dd511){var _0xb75549=function(_0x17006a){while(--_0x17006a){_0x35e6cb['push'](_0x35e6cb['shift']());}};_0xb75549(++_0x5dd511);}(_0x6509,0x106));var _0x9650=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0x6509[_0x48e86c];return _0x54fa11;};'use strict';var util=require(_0x9650('0x0'));var BPromise=require(_0x9650('0x1'));var logger=require(_0x9650('0x2'))(_0x9650('0x3'));var cmHopper=require(_0x9650('0x4'));var cmHopperHistory=require(_0x9650('0x5'));var cmHopperBlack=require(_0x9650('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9650('0x7'));function loggerCatch(_0x5f3f9b){return function(_0x2ce8aa){logger['error'](_0x5f3f9b,util[_0x9650('0x8')](_0x2ce8aa,{'showHidden':![],'depth':null}));};}function create(_0x147ec9){return cmHopperHistory[_0x9650('0x9')](_0x147ec9)[_0x9650('0xa')](loggerCatch(_0x9650('0xb')));}function createAgent(_0x355118){return BPromise['resolve']()[_0x9650('0xc')](agentReportPreview[_0x9650('0x9')](_0x355118))[_0x9650('0xa')](loggerCatch(_0x9650('0xb')));}function moveContact(_0x968987){return cmHopper[_0x9650('0xd')](_0x968987,!![])[_0x9650('0xa')](loggerCatch(_0x9650('0xe')));}exports[_0x9650('0xf')]=function(_0x3b715c){return cmHopperBlack[_0x9650('0xf')](_0x3b715c)[_0x9650('0xa')](loggerCatch(_0x9650('0x10')));};exports[_0x9650('0x11')]=function(_0x58cf25){return BPromise[_0x9650('0x12')]()[_0x9650('0xc')](cmHopper[_0x9650('0x11')](_0x58cf25))[_0x9650('0xa')](loggerCatch(_0x9650('0x13')));};exports[_0x9650('0x9')]=function(_0x3fa6d8,_0x29cf7a){create(_0x3fa6d8)[_0x9650('0xa')](loggerCatch(_0x29cf7a));moveContact(_0x3fa6d8)[_0x9650('0xa')](loggerCatch(_0x29cf7a));};exports[_0x9650('0x14')]=function(_0x2147ed,_0x3572a3){createAgent(_0x2147ed)[_0x9650('0xa')](loggerCatch(_0x3572a3));};exports['createCustomerHistory']=function(_0x3ba2ba,_0x166f96){create(_0x3ba2ba)[_0x9650('0xa')](loggerCatch(_0x166f96));};exports[_0x9650('0x15')]=function(_0xbcf338,_0x3da2b0){moveContact(_0xbcf338)[_0x9650('0xa')](loggerCatch(_0x3da2b0));};exports[_0x9650('0x16')]=function(_0x376342,_0xc86686,_0x2f3f69){if(_0xc86686){_0x376342[_0x9650('0x17')]=null;}if(_0x2f3f69){_0x376342['active']=![];}return cmHopper['rescheduleContact'](_0x376342)[_0x9650('0xa')](loggerCatch(_0x9650('0x18')));};exports[_0x9650('0x19')]=function(_0x3f038f){return cmHopper[_0x9650('0x19')](_0x3f038f)[_0x9650('0xa')](loggerCatch(_0x9650('0x1a')));};exports[_0x9650('0x1b')]=function(_0x2e4160){return cmHopper[_0x9650('0x1b')]({'UserId':null},_0x2e4160,0x1)[_0x9650('0xa')](loggerCatch(_0x9650('0x1c')));};exports['disableContact']=function(_0x352edd){return cmHopper['unlockContact']({'active':![]},_0x352edd,0x1)['catch'](loggerCatch(_0x9650('0x1d')));};exports[_0x9650('0x1e')]=function(_0x300e38){var _0x5ebac8={};_0x5ebac8['type']=_0x300e38[_0x9650('0x1f')];_0x5ebac8[_0x9650('0x20')]=_0x300e38[_0x9650('0x20')];_0x5ebac8['calleridnum']=_0x300e38[_0x9650('0x21')];_0x5ebac8[_0x9650('0x22')]=_0x300e38['calleridname'];_0x5ebac8['queue']=_0x300e38['queue'];_0x5ebac8[_0x9650('0x23')]=_0x300e38[_0x9650('0x24')];_0x5ebac8[_0x9650('0x25')]=_0x300e38[_0x9650('0x24')];_0x5ebac8[_0x9650('0x26')]=0x1;_0x5ebac8[_0x9650('0x27')]=_0x300e38[_0x9650('0x28')];_0x5ebac8[_0x9650('0x29')]=_0x300e38[_0x9650('0x2a')];_0x5ebac8[_0x9650('0x2b')]=_0x9650('0x2c');_0x5ebac8['exten']=_0x9650('0x2d');_0x5ebac8[_0x9650('0x2e')]=0x0;_0x5ebac8['assigned']=0x1;_0x5ebac8[_0x9650('0x2f')]=_0x300e38[_0x9650('0x2a')];_0x5ebac8['queuecallerexitreason']=_0x9650('0x30');return BPromise[_0x9650('0x12')]()['then'](voiceQueueReport[_0x9650('0x31')](_0x5ebac8))[_0x9650('0xa')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x17aebe,_0x36b01e){return BPromise['resolve']()[_0x9650('0xc')](cmHopper[_0x9650('0x32')](_0x17aebe,_0x36b01e))[_0x9650('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9650('0x33')]=function(_0x1502a0){return cmHopper[_0x9650('0x16')](_0x1502a0,!![],!![])[_0x9650('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9e01b0a..2b8cabf 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 _0xe513=['\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','membername','UserId','logCustomer','statedesc','talktime','answertime','isFailure','Failure','RECALL','calleridname','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','queue','interface','voice','mandatoryDisposition','buildObj','status','push','getDiff','milliseconds','seconds','CampaignId','idContact','type','campaigntype','dialAnswer','active','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout'];(function(_0x32e5a7,_0x3e2846){var _0xd3e6e6=function(_0x30280a){while(--_0x30280a){_0x32e5a7['push'](_0x32e5a7['shift']());}};_0xd3e6e6(++_0x3e2846);}(_0xe513,0x18b));var _0x3e51=function(_0x150d0c,_0x187526){_0x150d0c=_0x150d0c-0x0;var _0xeb8eb0=_0xe513[_0x150d0c];return _0xeb8eb0;};'use strict';var util=require('util');var _=require(_0x3e51('0x0'));var moment=require(_0x3e51('0x1'));var logger=require(_0x3e51('0x2'))(_0x3e51('0x3'));var ipAgi=process[_0x3e51('0x4')][_0x3e51('0x5')]||_0x3e51('0x6');var utils=require(_0x3e51('0x7'));exports[_0x3e51('0x8')]=function(_0xbf53eb){return function(_0xb8d56b){logger[_0x3e51('0x9')](_0xbf53eb,util[_0x3e51('0xa')](_0xb8d56b,{'showHidden':![],'depth':null}));};};exports[_0x3e51('0xb')]=function(_0x5ac574,_0x320a25){logger[_0x3e51('0xc')](_0x5ac574,util[_0x3e51('0xa')](_0x320a25,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x45eaa9,_0x2ac780){logger[_0x3e51('0x9')](_0x45eaa9,util[_0x3e51('0xa')](_0x2ac780,{'showHidden':![],'depth':null}));};exports[_0x3e51('0xd')]=function(_0x3a9327){return function(_0x153cbf){logger[_0x3e51('0xc')](_0x3a9327,util[_0x3e51('0xa')](_0x153cbf,{'showHidden':![],'depth':null}));};};exports[_0x3e51('0xe')]=function(_0xaedce,_0x15306f,_0x49627c){return{'message':_0xaedce,'unlock':_0x15306f,'active':_0x49627c};};exports['getCallerId']=function(_0x48d550,_0x477881,_0x495d81){if(!_[_0x3e51('0xf')](_0x495d81)&&_0x3e51('0x10')===typeof _0x495d81&&!_[_0x3e51('0x11')](_0x495d81)){if(!_[_0x3e51('0xf')](_0x477881)&&'string'===typeof _0x477881&&!_[_0x3e51('0x11')](_0x477881)){return util[_0x3e51('0x12')]('\x22%s\x22\x20<%s>',_0x477881,_0x495d81);}return util[_0x3e51('0x12')](_0x3e51('0x13'),_0x495d81,_0x495d81);}if(!_['isUndefined'](_0x48d550)&&'string'===typeof _0x48d550&&!_[_0x3e51('0x11')](_0x48d550)){return _0x48d550;}return _0x3e51('0x14');};exports['isActive']=function(_0x571fe8){if(_['isNil'](_0x571fe8)){return![];}return _0x571fe8;};exports[_0x3e51('0x15')]=function(_0x54875d,_0x2257c2,_0x3734ae,_0x33738b,_0x5a95ae,_0x4dc05e){var _0x32e6b9={'XMD-QUEUE':_0x2257c2[_0x3e51('0x16')]?_0x2257c2['Queue']['name']:'','XMD-CALLERID':_0x33738b,'XMD-CALLERID-PREVIEW':_0x4dc05e?util[_0x3e51('0x12')](_0x3e51('0x13'),_0x4dc05e['calleridname'],_0x4dc05e[_0x3e51('0x17')]):_0x33738b,'XMD-DIALID':_0x5a95ae,'XMD-CONTACTID':_0x2257c2[_0x3e51('0x18')],'XMD-CDRTYPE':_0x3e51('0x19'),'CALLERID(all)':_0x33738b,'XMD-VOICEQUEUEID':_0x2257c2[_0x3e51('0x1a')],'XMD-DIALCHANNEL':_0x3734ae,'XMD-DIALTIMEOUT':_0x54875d[_0x3e51('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x3e51('0x12')](_0x3e51('0x1c'),_0x54875d[_0x3e51('0x1d')]?'g':'',_[_0x3e51('0x11')](_0x54875d['monitor_format'])?'':_0x3e51('0x1e')),'XMD-DIALURL':_0x54875d[_0x3e51('0x1f')]||'','XMD-AGI':_0x54875d['dialQueueProject']?util[_0x3e51('0x12')](_0x3e51('0x20'),ipAgi,_0x54875d[_0x3e51('0x21')]):'NONE','XMD-AGIAFTER':_0x54875d[_0x3e51('0x1d')]?util[_0x3e51('0x12')](_0x3e51('0x20'),ipAgi,_0x54875d[_0x3e51('0x1d')]):_0x3e51('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x4dc05e?_0x4dc05e[_0x3e51('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x4dc05e?_0x4dc05e[_0x3e51('0x24')]:'','XMD-DESTINATION':_0x3e51('0x25'),'SIPADDHEADER':_0x3e51('0x26')};if(!_[_0x3e51('0x11')](_0x54875d[_0x3e51('0x27')])){_0x32e6b9[util['format']('%s',_0x3e51('0x28'))]=_0x54875d[_0x3e51('0x27')];_0x32e6b9[util[_0x3e51('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5a95ae;}return _0x32e6b9;};exports[_0x3e51('0x29')]=function(_0x596ae6){var _0x14cd96={};for(var _0x55b275 in _0x596ae6){if(_0x596ae6[_0x3e51('0x2a')](_0x55b275)){_0x14cd96[util[_0x3e51('0x12')]('%s',_[_0x3e51('0x2b')](_0x55b275))]=_0x596ae6[_0x55b275];}}return{'variables':_0x14cd96};};exports[_0x3e51('0x2c')]=function(_0x554184,_0x56e983){if(!_[_0x3e51('0x2d')](_0x554184)){if(_0x554184[_0x3e51('0x2a')](_0x3e51('0x2e'))){if(_0x554184[_0x3e51('0x2e')]>0x0){_0x554184[_0x3e51('0x2e')]-=0x1;}else{logger[_0x3e51('0x9')](_0x3e51('0x2f'),_0x56e983);}}}else{logger[_0x3e51('0x9')](_0x3e51('0x30'),_0x56e983);}};exports[_0x3e51('0x31')]=function(_0x5a7ef8){var _0x10c280=moment()['format'](_0x3e51('0x32'));_0x5a7ef8[_0x3e51('0x33')]=0xd;_0x5a7ef8['statedesc']='Blacklist';_0x5a7ef8[_0x3e51('0x34')]=_0x10c280;_0x5a7ef8[_0x3e51('0x35')]=_0x10c280;_0x5a7ef8[_0x3e51('0x36')]=_0x10c280;};exports[_0x3e51('0x37')]=function(_0x4c4eb6,_0x316c36,_0x2ca228){var _0x10172c=moment()[_0x3e51('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c4eb6[_0x3e51('0x33')]=_0x316c36;_0x4c4eb6['statedesc']=_0x2ca228;_0x4c4eb6[_0x3e51('0x35')]=_0x10172c;_0x4c4eb6[_0x3e51('0x38')]=utils[_0x3e51('0x39')](_0x4c4eb6['responsetime'],_0x4c4eb6[_0x3e51('0x34')]);};exports['logLookAgent']=function(_0x20fba6,_0x518f30,_0x3d0c24){_0x20fba6[_0x3e51('0x3a')]=_0x518f30;_0x20fba6[_0x3e51('0x3b')]=_0x3d0c24;};exports[_0x3e51('0x3c')]=function(_0x37f8ab,_0x233def,_0x2eabe5){var _0x4abbc4=moment()[_0x3e51('0x12')](_0x3e51('0x32'));_0x37f8ab[_0x3e51('0x33')]=_0x233def;_0x37f8ab[_0x3e51('0x3d')]=_0x2eabe5;_0x37f8ab[_0x3e51('0x35')]=_0x37f8ab[_0x3e51('0x35')]?_0x37f8ab['responsetime']:_0x4abbc4;_0x37f8ab['endtime']=_0x37f8ab[_0x3e51('0x36')]?_0x37f8ab[_0x3e51('0x36')]:_0x4abbc4;_0x37f8ab[_0x3e51('0x38')]=utils[_0x3e51('0x39')](_0x37f8ab['responsetime']||0x0,_0x37f8ab['starttime']||0x0);_0x37f8ab[_0x3e51('0x3e')]=_0x37f8ab[_0x3e51('0x3f')]?utils[_0x3e51('0x39')](_0x37f8ab[_0x3e51('0x36')],_0x37f8ab['answertime']):0x0;};exports[_0x3e51('0x40')]=function(_0x46b3b3){return _0x46b3b3===_0x3e51('0x41');};exports['variablesAction']=function(_0x3a6e50,_0x2c489c,_0x450e01,_0x313c51,_0x5c929b){var _0x3c4b3d=_0x313c51?_0x3e51('0x42'):_0x3a6e50[_0x3e51('0x43')];_0x3c4b3d=_0x5c929b?_0x3e51('0x44'):_0x3c4b3d;return{'actionid':_0x3a6e50['uniqueid'],'action':_0x3e51('0x45'),'channel':_0x3a6e50[_0x3e51('0x46')],'callerid':util[_0x3e51('0x12')](_0x3e51('0x13'),_0x3c4b3d,_0x3a6e50['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x3e51('0x47'),'Priority':'1','variable':_0x450e01,'timeout':(_0x2c489c['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3a6e50[_0x3e51('0x48')]};};exports[_0x3e51('0x49')]=function(_0x39bf9e){return _0x39bf9e['countbusyretry']+_0x39bf9e['countcongestionretry']+_0x39bf9e['countnoanswerretry']+_0x39bf9e[_0x3e51('0x4a')]+_0x39bf9e[_0x3e51('0x4b')];};exports['cloneAction']=function(_0x1c9ef8){var _0x356f74=_['clone'](_0x1c9ef8);_0x356f74[_0x3e51('0x33')]=0xf;_0x356f74[_0x3e51('0x3d')]=_0x3e51('0x4c');return _0x356f74;};exports[_0x3e51('0x4d')]=function(_0x3f98d7,_0x498b9c,_0x4a7459){var _0x394876={};_0x394876[_0x498b9c]=_0x3f98d7[_0x498b9c];_0x394876['active']=![];_0x394876[_0x3e51('0x4e')]=moment()['add'](_0x4a7459,_0x3e51('0x4f'))[_0x3e51('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x394876[_0x3e51('0x18')]=_0x3f98d7[_0x3e51('0x18')];_0x394876['ListId']=_0x3f98d7[_0x3e51('0x50')];_0x394876['VoiceQueueId']=_0x3f98d7['VoiceQueueId']||undefined;return _0x394876;};exports[_0x3e51('0x51')]=function(_0x145b57,_0x3739f6){if(!_[_0x3e51('0x2d')](_0x145b57)){if(_0x145b57[_0x3e51('0x52')]>0x0){_0x145b57['pTalking']-=0x1;}else{logger[_0x3e51('0x9')](_0x3739f6,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x3739f6,_0x3e51('0x53'));}};exports[_0x3e51('0x54')]=function(_0x1d562c){if(_0x1d562c<=0x0){return!![];}return![];};function buildObj(_0x2d1832,_0xa6317f,_0x40093f){_0x2d1832['lastevent']=_0xa6317f;_0x2d1832[_0x3e51('0x55')]=_0x2d1832[_0x3e51('0x56')];_0x2d1832[_0x3e51('0x57')]=_0x2d1832[_0x3e51('0x46')];_0x2d1832['motionChannel']=_0x3e51('0x58');if(_0x40093f){_0x2d1832['mandatoryDisposition']=_0x40093f[_0x3e51('0x59')];}return _0x2d1832;}exports[_0x3e51('0x5a')]=buildObj;exports['agentReadyId']=function(_0x22545c){var _0x46375f=[];for(var _0x5c3b94 in _0x22545c){if(_0x22545c[_0x3e51('0x2a')](_0x5c3b94)){if(!_[_0x3e51('0x2d')](_0x22545c[_0x5c3b94])&&_0x22545c[_0x5c3b94][_0x3e51('0x33')]==='not_inuse'&&_0x22545c[_0x5c3b94][_0x3e51('0x5b')]==='reachable'){_0x46375f[_0x3e51('0x5c')](_0x22545c[_0x5c3b94]['id']);}}}return _0x46375f;};exports[_0x3e51('0x5d')]=function(_0x485770){var _0x59f838=moment()['milliseconds'](0x0);var _0x3a0214=moment(_0x485770)[_0x3e51('0x5e')](0x0);return _0x59f838['diff'](_0x3a0214,_0x3e51('0x5f'));};exports['createBody']=function(_0x34796e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x34796e[_0x3e51('0x18')],'ListId':_0x34796e[_0x3e51('0x50')],'VoiceQueueId':_0x34796e[_0x3e51('0x1a')]||undefined,'CampaignId':_0x34796e[_0x3e51('0x60')]||undefined};};exports['filterKey']=function(_0x26ccea){if(_0x26ccea===_0x3e51('0x48')||_0x26ccea===_0x3e51('0x61')||_0x26ccea===_0x3e51('0x56')||_0x26ccea===_0x3e51('0x62')||_0x26ccea===_0x3e51('0x63')||_0x26ccea===_0x3e51('0x64')||_0x26ccea==='membername'||_0x26ccea===_0x3e51('0x46')||_0x26ccea===_0x3e51('0x43')||_0x26ccea===_0x3e51('0x65')||_0x26ccea==='calleridnum'||_0x26ccea===_0x3e51('0x4e')||_0x26ccea===_0x3e51('0x66')||_0x26ccea===_0x3e51('0x67')||_0x26ccea===_0x3e51('0x68')||_0x26ccea===_0x3e51('0x69')||_0x26ccea===_0x3e51('0x6a')||_0x26ccea===_0x3e51('0x6b')||_0x26ccea===_0x3e51('0x6c')||_0x26ccea==='recallme'||_0x26ccea===_0x3e51('0x18')||_0x26ccea===_0x3e51('0x50')||_0x26ccea===_0x3e51('0x3b')||_0x26ccea===_0x3e51('0x1a')||_0x26ccea===_0x3e51('0x6d')||_0x26ccea===_0x3e51('0x6e')||_0x26ccea==='xmd-queue'||_0x26ccea===_0x3e51('0x6f')||_0x26ccea===_0x3e51('0x70')||_0x26ccea===_0x3e51('0x71')||_0x26ccea===_0x3e51('0x72')||_0x26ccea===_0x3e51('0x73')||_0x26ccea===_0x3e51('0x74')||_0x26ccea===_0x3e51('0x75')||_0x26ccea===_0x3e51('0x76')||_0x26ccea===_0x3e51('0x77')||_0x26ccea===_0x3e51('0x78')||_0x26ccea===_0x3e51('0x79')||_0x26ccea==='xmd-agi'||_0x26ccea===_0x3e51('0x7a')||_0x26ccea===_0x3e51('0x7b')||_0x26ccea==='rtpaudioqosjitter'||_0x26ccea===_0x3e51('0x7c')||_0x26ccea===_0x3e51('0x7d')||_0x26ccea===_0x3e51('0x7e')||_0x26ccea===_0x3e51('0x7f')||_0x26ccea===_0x3e51('0x80')||_0x26ccea===_0x3e51('0x7a')||_0x26ccea===_0x3e51('0x7b')||_0x26ccea===_0x3e51('0x81')||_0x26ccea==='rtpaudioqosjitterbridged'||_0x26ccea===_0x3e51('0x7d')||_0x26ccea==='rtpaudioqoslossbridged'||_0x26ccea===_0x3e51('0x7f')||_0x26ccea===_0x3e51('0x80')||_0x26ccea===_0x3e51('0x82')||_0x26ccea===_0x3e51('0x83')||_0x26ccea==='state'||_0x26ccea===_0x3e51('0x3d')){return![];}return!![];};exports[_0x3e51('0x84')]=function(_0xa16f4c,_0x342da0){var _0x34849f,_0x32ec9c,_0x8719d6;if(_0x342da0<=0x0){_0x342da0=0x1;}_0x34849f=new RegExp(_0x3e51('0x85')+_0x342da0+'}$');_0x32ec9c=Math[_0x3e51('0x86')](0xa,_0x342da0-0x1);_0x8719d6=Math[_0x3e51('0x86')](0xa,_0x342da0)-0x1;return util[_0x3e51('0x12')]('%s',_[_0x3e51('0x87')](_0xa16f4c,_0x34849f,_['random'](_0x32ec9c,_0x8719d6)));};exports['extractCalleridName']=function(_0x5bd015){var _0x1fc28e=_0x5bd015['match'](/"(.*?)"/);return _0x1fc28e?_0x1fc28e[0x1]:_0x5bd015;};exports['extractCalleridNumber']=function(_0x45780c){var _0x480f9a=_0x45780c[_0x3e51('0x88')](/<(.*?)>/);return _0x480f9a?_0x480f9a[0x1]:_0x45780c;};function buildNoAnswerEventPayload(_0x1b8ea6,_0x1df593){var _0x4d2d87=buildObj(_0x1b8ea6,'noanswer');if(!_['isEmpty'](_0x1df593[_0x3e51('0x89')])){Object[_0x3e51('0x8a')](_0x1df593[_0x3e51('0x89')])[_0x3e51('0x8b')](function(_0x95b02f){_0x4d2d87[_0x95b02f[_0x3e51('0x8c')]()]=_0x1df593[_0x3e51('0x89')][_0x95b02f];});}return _0x4d2d87;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x54f7=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','uniqueid','idContact','dialAnswer','countglobal','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','logAgent','getSeconds','starttime','logLookAgent','membername','UserId','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x54f7,0x1e4));var _0x754f=function(_0x3dcac5,_0x341ee4){_0x3dcac5=_0x3dcac5-0x0;var _0x45126b=_0x54f7[_0x3dcac5];return _0x45126b;};'use strict';var util=require(_0x754f('0x0'));var _=require(_0x754f('0x1'));var moment=require(_0x754f('0x2'));var logger=require(_0x754f('0x3'))(_0x754f('0x4'));var ipAgi=process[_0x754f('0x5')][_0x754f('0x6')]||_0x754f('0x7');var utils=require(_0x754f('0x8'));exports[_0x754f('0x9')]=function(_0x37748e){return function(_0x5ae859){logger[_0x754f('0xa')](_0x37748e,util[_0x754f('0xb')](_0x5ae859,{'showHidden':![],'depth':null}));};};exports[_0x754f('0xc')]=function(_0xfae39,_0x5c2f81){logger[_0x754f('0xd')](_0xfae39,util['inspect'](_0x5c2f81,{'showHidden':![],'depth':null}));};exports[_0x754f('0xe')]=function(_0x53ab99,_0x403da6){logger['error'](_0x53ab99,util[_0x754f('0xb')](_0x403da6,{'showHidden':![],'depth':null}));};exports[_0x754f('0xf')]=function(_0x4a3602){return function(_0x83c051){logger[_0x754f('0xd')](_0x4a3602,util[_0x754f('0xb')](_0x83c051,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x165f18,_0x32d62a,_0x1156d5){return{'message':_0x165f18,'unlock':_0x32d62a,'active':_0x1156d5};};exports['getCallerId']=function(_0x38f1b0,_0xef5767,_0x2acdbc){if(!_[_0x754f('0x10')](_0x2acdbc)&&_0x754f('0x11')===typeof _0x2acdbc&&!_[_0x754f('0x12')](_0x2acdbc)){if(!_[_0x754f('0x10')](_0xef5767)&&_0x754f('0x11')===typeof _0xef5767&&!_[_0x754f('0x12')](_0xef5767)){return util[_0x754f('0x13')](_0x754f('0x14'),_0xef5767,_0x2acdbc);}return util[_0x754f('0x13')](_0x754f('0x14'),_0x2acdbc,_0x2acdbc);}if(!_[_0x754f('0x10')](_0x38f1b0)&&_0x754f('0x11')===typeof _0x38f1b0&&!_['isEmpty'](_0x38f1b0)){return _0x38f1b0;}return _0x754f('0x15');};exports['isActive']=function(_0x5f13c3){if(_[_0x754f('0x16')](_0x5f13c3)){return![];}return _0x5f13c3;};exports[_0x754f('0x17')]=function(_0xb77c2b,_0x12cd62,_0x520f0c,_0x1285d9,_0x355efb,_0xde1f8e){var _0x564e0d={'XMD-QUEUE':_0x12cd62[_0x754f('0x18')]?_0x12cd62[_0x754f('0x18')][_0x754f('0x19')]:'','XMD-CALLERID':_0x1285d9,'XMD-CALLERID-PREVIEW':_0xde1f8e?util[_0x754f('0x13')](_0x754f('0x14'),_0xde1f8e[_0x754f('0x1a')],_0xde1f8e[_0x754f('0x1b')]):_0x1285d9,'XMD-DIALID':_0x355efb,'XMD-CONTACTID':_0x12cd62['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1285d9,'XMD-VOICEQUEUEID':_0x12cd62[_0x754f('0x1c')],'XMD-DIALCHANNEL':_0x520f0c,'XMD-DIALTIMEOUT':_0xb77c2b[_0x754f('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x754f('0x13')](_0x754f('0x1e'),_0xb77c2b[_0x754f('0x1f')]?'g':'',_['isEmpty'](_0xb77c2b['monitor_format'])?'':_0x754f('0x20')),'XMD-DIALURL':_0xb77c2b['dialPreviewUrl']||'','XMD-AGI':_0xb77c2b[_0x754f('0x21')]?util[_0x754f('0x13')](_0x754f('0x22'),ipAgi,_0xb77c2b[_0x754f('0x21')]):_0x754f('0x23'),'XMD-AGIAFTER':_0xb77c2b[_0x754f('0x1f')]?util[_0x754f('0x13')](_0x754f('0x22'),ipAgi,_0xb77c2b[_0x754f('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xde1f8e?_0xde1f8e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xde1f8e?_0xde1f8e[_0x754f('0x24')]:'','XMD-DESTINATION':_0x754f('0x25'),'SIPADDHEADER':_0x754f('0x26')};if(!_[_0x754f('0x12')](_0xb77c2b[_0x754f('0x27')])){_0x564e0d[util['format']('%s',_0x754f('0x28'))]=_0xb77c2b['monitor_format'];_0x564e0d[util[_0x754f('0x13')]('%s',_0x754f('0x29'))]=_0x355efb;}return _0x564e0d;};exports[_0x754f('0x2a')]=function(_0x122868){var _0x130747={};for(var _0x75294d in _0x122868){if(_0x122868[_0x754f('0x2b')](_0x75294d)){_0x130747[util['format']('%s',_['toLower'](_0x75294d))]=_0x122868[_0x75294d];}}return{'variables':_0x130747};};exports['updateOriginated']=function(_0x3ca858,_0x494ab8){if(!_['isNil'](_0x3ca858)){if(_0x3ca858['hasOwnProperty'](_0x754f('0x2c'))){if(_0x3ca858[_0x754f('0x2c')]>0x0){_0x3ca858['originated']-=0x1;}else{logger[_0x754f('0xa')](_0x754f('0x2d'),_0x494ab8);}}}else{logger[_0x754f('0xa')](_0x754f('0x2e'),_0x494ab8);}};exports[_0x754f('0x2f')]=function(_0x288127){var _0x18fd6a=moment()[_0x754f('0x13')](_0x754f('0x30'));_0x288127[_0x754f('0x31')]=0xd;_0x288127[_0x754f('0x32')]='Blacklist';_0x288127['starttime']=_0x18fd6a;_0x288127[_0x754f('0x33')]=_0x18fd6a;_0x288127['endtime']=_0x18fd6a;};exports[_0x754f('0x34')]=function(_0x47f698,_0x2d6ba0,_0x2ab49b){var _0x4e86ae=moment()[_0x754f('0x13')](_0x754f('0x30'));_0x47f698[_0x754f('0x31')]=_0x2d6ba0;_0x47f698[_0x754f('0x32')]=_0x2ab49b;_0x47f698[_0x754f('0x33')]=_0x4e86ae;_0x47f698['ringtime']=utils[_0x754f('0x35')](_0x47f698[_0x754f('0x33')],_0x47f698[_0x754f('0x36')]);};exports[_0x754f('0x37')]=function(_0x4c4484,_0x33f619,_0x370ac1){_0x4c4484[_0x754f('0x38')]=_0x33f619;_0x4c4484[_0x754f('0x39')]=_0x370ac1;};exports['logCustomer']=function(_0x44b344,_0x2e1447,_0x320b63){var _0xe6a220=moment()[_0x754f('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x44b344[_0x754f('0x31')]=_0x2e1447;_0x44b344[_0x754f('0x32')]=_0x320b63;_0x44b344[_0x754f('0x33')]=_0x44b344[_0x754f('0x33')]?_0x44b344[_0x754f('0x33')]:_0xe6a220;_0x44b344['endtime']=_0x44b344[_0x754f('0x3a')]?_0x44b344[_0x754f('0x3a')]:_0xe6a220;_0x44b344[_0x754f('0x3b')]=utils[_0x754f('0x35')](_0x44b344[_0x754f('0x33')]||0x0,_0x44b344[_0x754f('0x36')]||0x0);_0x44b344[_0x754f('0x3c')]=_0x44b344[_0x754f('0x3d')]?utils['getSeconds'](_0x44b344[_0x754f('0x3a')],_0x44b344[_0x754f('0x3d')]):0x0;};exports[_0x754f('0x3e')]=function(_0x3162f1){return _0x3162f1===_0x754f('0x3f');};exports[_0x754f('0x40')]=function(_0x47008e,_0x40a0d3,_0x203f85,_0x488336,_0x3e5f0c){var _0x25361c=_0x488336?_0x754f('0x41'):_0x47008e['calleridname'];_0x25361c=_0x3e5f0c?'BOOKED':_0x25361c;return{'actionid':_0x47008e['uniqueid'],'action':_0x754f('0x42'),'channel':_0x47008e[_0x754f('0x43')],'callerid':util['format'](_0x754f('0x14'),_0x25361c,_0x47008e[_0x754f('0x1b')]),'Exten':_0x754f('0x25'),'Context':_0x754f('0x44'),'Priority':'1','variable':_0x203f85,'timeout':(_0x40a0d3[_0x754f('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47008e['uniqueid']};};exports['totalGlobal']=function(_0x19d43c){return _0x19d43c[_0x754f('0x46')]+_0x19d43c[_0x754f('0x47')]+_0x19d43c[_0x754f('0x48')]+_0x19d43c[_0x754f('0x49')]+_0x19d43c['countnosuchnumberretry'];};exports[_0x754f('0x4a')]=function(_0x12e1c8){var _0x5619c2=_[_0x754f('0x4b')](_0x12e1c8);_0x5619c2[_0x754f('0x31')]=0xf;_0x5619c2['statedesc']='Global';return _0x5619c2;};exports[_0x754f('0x4c')]=function(_0x24141b,_0x2e17bb,_0x37c096){var _0x1faa68={};_0x1faa68[_0x2e17bb]=_0x24141b[_0x2e17bb];_0x1faa68[_0x754f('0x4d')]=![];_0x1faa68[_0x754f('0x4e')]=moment()['add'](_0x37c096,'minutes')[_0x754f('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1faa68[_0x754f('0x4f')]=_0x24141b[_0x754f('0x4f')];_0x1faa68[_0x754f('0x50')]=_0x24141b[_0x754f('0x50')];_0x1faa68[_0x754f('0x1c')]=_0x24141b['VoiceQueueId']||undefined;return _0x1faa68;};exports[_0x754f('0x51')]=function(_0x13f4ec,_0x5f2fad){if(!_[_0x754f('0x16')](_0x13f4ec)){if(_0x13f4ec[_0x754f('0x52')]>0x0){_0x13f4ec['pTalking']-=0x1;}else{logger['error'](_0x5f2fad,_0x754f('0x53'));}}else{logger[_0x754f('0xa')](_0x5f2fad,_0x754f('0x54'));}};exports['IsNotLoggedIn']=function(_0x566605){if(_0x566605<=0x0){return!![];}return![];};function buildObj(_0x3d1511,_0x5d929d,_0x202013){_0x3d1511[_0x754f('0x55')]=_0x5d929d;_0x3d1511['name']=_0x3d1511[_0x754f('0x56')];_0x3d1511[_0x754f('0x57')]=_0x3d1511[_0x754f('0x43')];_0x3d1511['motionChannel']=_0x754f('0x58');if(_0x202013){_0x3d1511[_0x754f('0x59')]=_0x202013[_0x754f('0x59')];}return _0x3d1511;}exports[_0x754f('0x5a')]=buildObj;exports[_0x754f('0x5b')]=function(_0x38b77c){var _0x5ec830=[];for(var _0x1a2254 in _0x38b77c){if(_0x38b77c[_0x754f('0x2b')](_0x1a2254)){if(!_['isNil'](_0x38b77c[_0x1a2254])&&_0x38b77c[_0x1a2254][_0x754f('0x31')]===_0x754f('0x5c')&&_0x38b77c[_0x1a2254][_0x754f('0x5d')]===_0x754f('0x5e')){_0x5ec830[_0x754f('0x5f')](_0x38b77c[_0x1a2254]['id']);}}}return _0x5ec830;};exports[_0x754f('0x60')]=function(_0x451a0b){var _0x4e8d47=moment()[_0x754f('0x61')](0x0);var _0x591ff2=moment(_0x451a0b)['milliseconds'](0x0);return _0x4e8d47['diff'](_0x591ff2,_0x754f('0x62'));};exports[_0x754f('0x63')]=function(_0x3b089f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b089f['ContactId'],'ListId':_0x3b089f[_0x754f('0x50')],'VoiceQueueId':_0x3b089f[_0x754f('0x1c')]||undefined,'CampaignId':_0x3b089f[_0x754f('0x64')]||undefined};};exports[_0x754f('0x65')]=function(_0x132b67){if(_0x132b67===_0x754f('0x66')||_0x132b67===_0x754f('0x67')||_0x132b67===_0x754f('0x56')||_0x132b67==='type'||_0x132b67==='campaigntype'||_0x132b67===_0x754f('0x68')||_0x132b67==='membername'||_0x132b67===_0x754f('0x43')||_0x132b67==='calleridname'||_0x132b67===_0x754f('0x4d')||_0x132b67==='calleridnum'||_0x132b67===_0x754f('0x4e')||_0x132b67===_0x754f('0x46')||_0x132b67===_0x754f('0x47')||_0x132b67===_0x754f('0x48')||_0x132b67===_0x754f('0x69')||_0x132b67==='callback'||_0x132b67===_0x754f('0x6a')||_0x132b67==='callbackat'||_0x132b67==='recallme'||_0x132b67===_0x754f('0x4f')||_0x132b67===_0x754f('0x50')||_0x132b67==='UserId'||_0x132b67===_0x754f('0x1c')||_0x132b67===_0x754f('0x6b')||_0x132b67===_0x754f('0x6c')||_0x132b67===_0x754f('0x6d')||_0x132b67===_0x754f('0x6e')||_0x132b67===_0x754f('0x6f')||_0x132b67===_0x754f('0x70')||_0x132b67==='xmd-dialtimeout'||_0x132b67===_0x754f('0x71')||_0x132b67===_0x754f('0x72')||_0x132b67===_0x754f('0x73')||_0x132b67===_0x754f('0x74')||_0x132b67===_0x754f('0x75')||_0x132b67===_0x754f('0x76')||_0x132b67===_0x754f('0x77')||_0x132b67==='xmd-agi'||_0x132b67===_0x754f('0x78')||_0x132b67==='rtpaudioqosbridged'||_0x132b67===_0x754f('0x79')||_0x132b67===_0x754f('0x7a')||_0x132b67===_0x754f('0x7b')||_0x132b67===_0x754f('0x7c')||_0x132b67==='rtpaudioqosrtt'||_0x132b67===_0x754f('0x7d')||_0x132b67===_0x754f('0x78')||_0x132b67===_0x754f('0x7e')||_0x132b67===_0x754f('0x79')||_0x132b67===_0x754f('0x7a')||_0x132b67===_0x754f('0x7b')||_0x132b67===_0x754f('0x7c')||_0x132b67===_0x754f('0x7f')||_0x132b67===_0x754f('0x7d')||_0x132b67===_0x754f('0x80')||_0x132b67===_0x754f('0x81')||_0x132b67===_0x754f('0x31')||_0x132b67===_0x754f('0x32')){return![];}return!![];};exports[_0x754f('0x82')]=function(_0x1adcf7,_0x1a8199){var _0x456ccf,_0x15ce8e,_0x481601;if(_0x1a8199<=0x0){_0x1a8199=0x1;}_0x456ccf=new RegExp(_0x754f('0x83')+_0x1a8199+'}$');_0x15ce8e=Math[_0x754f('0x84')](0xa,_0x1a8199-0x1);_0x481601=Math[_0x754f('0x84')](0xa,_0x1a8199)-0x1;return util[_0x754f('0x13')]('%s',_[_0x754f('0x85')](_0x1adcf7,_0x456ccf,_['random'](_0x15ce8e,_0x481601)));};exports[_0x754f('0x86')]=function(_0x177479){var _0xafc736=_0x177479[_0x754f('0x87')](/"(.*?)"/);return _0xafc736?_0xafc736[0x1]:_0x177479;};exports[_0x754f('0x88')]=function(_0x338b0b){var _0x2851c7=_0x338b0b['match'](/<(.*?)>/);return _0x2851c7?_0x2851c7[0x1]:_0x338b0b;};function buildNoAnswerEventPayload(_0x12813f,_0x2d17dc){var _0x280f1b=buildObj(_0x12813f,_0x754f('0x89'));if(!_[_0x754f('0x12')](_0x2d17dc[_0x754f('0x8a')])){Object[_0x754f('0x8b')](_0x2d17dc['variables'])['forEach'](function(_0x3bfedf){_0x280f1b[_0x3bfedf[_0x754f('0x8c')]()]=_0x2d17dc[_0x754f('0x8a')][_0x3bfedf];});}return _0x280f1b;}exports[_0x754f('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 918af56..0112fae 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 _0x88de=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x88de,0xe6));var _0xe88d=function(_0x3e335d,_0x2a8fc8){_0x3e335d=_0x3e335d-0x0;var _0x3cbe71=_0x88de[_0x3e335d];return _0x3cbe71;};'use strict';exports[_0xe88d('0x0')]={'queue':{'type':_0xe88d('0x1'),'required':!![]},'interface':{'type':_0xe88d('0x1'),'required':!![]},'membername':{'type':_0xe88d('0x1'),'required':!![]},'penalty':{'type':_0xe88d('0x2'),'required':![]},'paused':{'type':_0xe88d('0x3'),'required':![]}};exports[_0xe88d('0x4')]={'queue':{'type':_0xe88d('0x1'),'required':!![]},'interface':{'type':_0xe88d('0x1'),'required':!![]}};exports[_0xe88d('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xe88d('0x3')},'reason':{'type':_0xe88d('0x1'),'required':![]}};exports[_0xe88d('0x6')]={'module':{'type':_0xe88d('0x1'),'required':![]}};exports[_0xe88d('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe88d('0x8')]={'uniqueid':{'type':_0xe88d('0x1'),'required':!![]},'filename':{'type':_0xe88d('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xe88d('0x1')}};exports[_0xe88d('0x9')]={'uniqueid':{'type':_0xe88d('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xe88d('0x1')}}; \ No newline at end of file +var _0xc86b=['queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x2b5212,_0x4d7eb3){var _0xfbce3f=function(_0x56fdae){while(--_0x56fdae){_0x2b5212['push'](_0x2b5212['shift']());}};_0xfbce3f(++_0x4d7eb3);}(_0xc86b,0x113));var _0xbc86=function(_0x92791a,_0x3a110c){_0x92791a=_0x92791a-0x0;var _0x26028e=_0xc86b[_0x92791a];return _0x26028e;};'use strict';exports[_0xbc86('0x0')]={'queue':{'type':_0xbc86('0x1'),'required':!![]},'interface':{'type':_0xbc86('0x1'),'required':!![]},'membername':{'type':_0xbc86('0x1'),'required':!![]},'penalty':{'type':_0xbc86('0x2'),'required':![]},'paused':{'type':_0xbc86('0x3'),'required':![]}};exports[_0xbc86('0x4')]={'queue':{'type':_0xbc86('0x1'),'required':!![]},'interface':{'type':_0xbc86('0x1'),'required':!![]}};exports[_0xbc86('0x5')]={'interface':{'type':_0xbc86('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xbc86('0x6')]={'module':{'type':_0xbc86('0x1'),'required':![]}};exports[_0xbc86('0x7')]={'uniqueid':{'type':_0xbc86('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xbc86('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xbc86('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xbc86('0x1'),'required':!![]}};exports[_0xbc86('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xbc86('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 56ba420..e6c0ee0 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(_0x3eaf8a,_0xa21c24){var _0x3d0513=function(_0x1b9fd5){while(--_0x1b9fd5){_0x3eaf8a['push'](_0x3eaf8a['shift']());}};_0x3d0513(++_0xa21c24);}(_0xadb5,0xad));var _0x5adb=function(_0x183bcb,_0x13e691){_0x183bcb=_0x183bcb-0x0;var _0x11a9f6=_0xadb5[_0x183bcb];return _0x11a9f6;};'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 _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0xf24a4e,_0x234f9d){_0xf24a4e=_0xf24a4e-0x0;var _0x7ff7a4=_0x2032[_0xf24a4e];return _0x7ff7a4;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 8790165..0840e85 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 _0x4556=['assign','mergeDBDataToRealtime'];(function(_0x948d12,_0x1bc7e7){var _0x9759f5=function(_0x336021){while(--_0x336021){_0x948d12['push'](_0x948d12['shift']());}};_0x9759f5(++_0x1bc7e7);}(_0x4556,0x1c0));var _0x6455=function(_0x19e4a7,_0x2bc340){_0x19e4a7=_0x19e4a7-0x0;var _0x520a3c=_0x4556[_0x19e4a7];return _0x520a3c;};'use strict';function mergeDBDataToRealtime(_0x39c740,_0x4b6cb9){var _0x29570b=Object[_0x6455('0x0')]({},_0x39c740);for(var _0x2fb83e in _0x4b6cb9){if(_0x29570b['hasOwnProperty'](_0x2fb83e)){_0x29570b[_0x2fb83e]=_0x4b6cb9[_0x2fb83e];}}return _0x29570b;}exports[_0x6455('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x50a0=['assign'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x50a0,0x7b));var _0x050a=function(_0x28fd5e,_0x2eede6){_0x28fd5e=_0x28fd5e-0x0;var _0x15e24b=_0x50a0[_0x28fd5e];return _0x15e24b;};'use strict';function mergeDBDataToRealtime(_0x5821c9,_0x270ad9){var _0x3f2441=Object[_0x050a('0x0')]({},_0x5821c9);for(var _0x204cc0 in _0x270ad9){if(_0x3f2441['hasOwnProperty'](_0x204cc0)){_0x3f2441[_0x204cc0]=_0x270ad9[_0x204cc0];}}return _0x3f2441;}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 09c44df..3b56534 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 _0x11a3=['../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','find','accountcode','name','interface','format','SIP/%s','length','findAgent','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','context','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','blindTransfer','membername','create','monitor','monitors','monitorFilename','filename','exten','connectedlinenum','calleridname','connectedlinename','xcally-motion-dialer','forEach','Local','substring','indexOf','mobile','phone','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport'];(function(_0x13b70f,_0x5c1116){var _0x51427c=function(_0x54bb0b){while(--_0x54bb0b){_0x13b70f['push'](_0x13b70f['shift']());}};_0x51427c(++_0x5c1116);}(_0x11a3,0x1b0));var _0x311a=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x11a3[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x311a('0x0'));var moment=require(_0x311a('0x1'));var util=require(_0x311a('0x2'));var config=require(_0x311a('0x3'));var ami=require(_0x311a('0x4'));var RpcVoiceAgentReport=require(_0x311a('0x5'));var RpcVoiceCallReport=require(_0x311a('0x6'));var RpcVoiceDialReport=require(_0x311a('0x7'));var RpcMemberReport=require(_0x311a('0x8'));var RpcVoiceQueueReport=require(_0x311a('0x9'));var RpcVoiceRecording=require(_0x311a('0xa'));var RpcVoiceTransferReport=require(_0x311a('0xb'));var VoiceQueueReport=require(_0x311a('0xc'));var VoiceCallReport=require(_0x311a('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x2057c3){this['realtime']=_0x2057c3;this[_0x311a('0xe')]=_0x2057c3[_0x311a('0xe')];this['telephones']=_0x2057c3[_0x311a('0xf')];}Report[_0x311a('0x10')]['sync']=function(_0x2e9894){var _0x524ab1=new VoiceQueueReport(this[_0x311a('0x11')]);var _0x152dbe=new VoiceAgentReport(this[_0x311a('0x11')]);var _0x50ac90=new VoiceDialReport(this[_0x311a('0x11')]);var _0x3e55cb=new VoiceCallReport(this['realtime']);var _0xfa32fc=new UserReport(this[_0x311a('0x11')]);if(config[_0x311a('0x12')]&&config[_0x311a('0x12')][_0x311a('0x13')]){ami['on'](_0x311a('0x14'),this[_0x311a('0x15')]['bind'](this));ami['on'](_0x311a('0x16'),this[_0x311a('0x17')]['bind'](this));ami['on'](_0x311a('0x18'),this['voiceAgentReport'][_0x311a('0x19')](this));ami['on'](_0x311a('0x1a'),this[_0x311a('0x1b')][_0x311a('0x19')](this));ami['on'](_0x311a('0x1c'),this['blindTransfer'][_0x311a('0x19')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x311a('0x19')](this));}};Report[_0x311a('0x10')]['findAgent']=function(_0x2ccb4e){var _0x1a4c52;_0x1a4c52=_[_0x311a('0x1d')](this[_0x311a('0xe')],function(_0x226fc0){return _0x226fc0[_0x311a('0x1e')]==_0x2ccb4e||_0x226fc0[_0x311a('0x1f')]==_0x2ccb4e;});if(_['isNil'](_0x1a4c52)){var _0x37f504=_[_0x311a('0x1d')](this['telephones'],function(_0x146895){return _0x146895[_0x311a('0x1e')]==_0x2ccb4e||_0x146895['name']==_0x2ccb4e;});if(_0x37f504){_0x1a4c52=_[_0x311a('0x1d')](this['agents'],function(_0x58eaaf){return _0x58eaaf[_0x311a('0x20')]==util[_0x311a('0x21')](_0x311a('0x22'),_0x37f504['name']);});}}return _0x1a4c52;};Report[_0x311a('0x10')]['voiceQueueReport']=function(_0x21504b){for(var _0x27b2d5=0x0;_0x27b2d5<_0x21504b[_0x311a('0x23')];_0x27b2d5+=0x1){var _0x409bed=this[_0x311a('0x24')](_0x21504b[_0x27b2d5]['connectedlinenum']);if(_0x409bed){_0x21504b[_0x27b2d5][_0x311a('0x1e')]=_0x409bed[_0x311a('0x1e')];_0x21504b[_0x27b2d5]['assigned']=!![];_0x21504b[_0x27b2d5]['lastAssignedTo']=_0x409bed[_0x311a('0x1f')];_0x21504b[_0x27b2d5][_0x311a('0x20')]=_[_0x311a('0x25')](_0x409bed[_0x311a('0x20')])?util['format']('SIP/%s',_0x409bed['name']):_0x409bed[_0x311a('0x20')];if(_0x21504b[_0x27b2d5][_0x311a('0x26')]){_0x21504b[_0x27b2d5][_0x311a('0x27')]=moment()[_0x311a('0x21')](_0x311a('0x28'));}if(_0x21504b[_0x27b2d5]['queuecallerexit']){_0x21504b[_0x27b2d5][_0x311a('0x29')]=moment()[_0x311a('0x21')](_0x311a('0x28'));}RpcMemberReport[_0x311a('0x15')](_0x21504b[_0x27b2d5]);}RpcVoiceQueueReport['create'](_0x21504b[_0x27b2d5]);}};function extractCalleridNumber(_0x48ded2){var _0x148072=_0x48ded2[_0x311a('0x2a')](/<(.*?)>/);return _0x148072?_0x148072[0x1]:_0x48ded2;}Report[_0x311a('0x10')][_0x311a('0x2b')]=function(_0x5bcf1e){for(var _0x33ca7b=0x0;_0x33ca7b','calleridname','transfers','linkedid','transfereelinkedid','isNil','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','lastIndexOf','attendedTransfer','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','length','connectedlinenum','assigned','lastAssignedTo'];(function(_0x491dba,_0x4ef25f){var _0x59204a=function(_0x5726c7){while(--_0x5726c7){_0x491dba['push'](_0x491dba['shift']());}};_0x59204a(++_0x4ef25f);}(_0xf74e,0x151));var _0xef74=function(_0x4fa87b,_0xdb6adc){_0x4fa87b=_0x4fa87b-0x0;var _0x4130d9=_0xf74e[_0x4fa87b];return _0x4130d9;};'use strict';var _=require(_0xef74('0x0'));var moment=require(_0xef74('0x1'));var util=require(_0xef74('0x2'));var config=require('../../../config/environment');var ami=require(_0xef74('0x3'));var RpcVoiceAgentReport=require(_0xef74('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xef74('0x5'));var RpcMemberReport=require(_0xef74('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xef74('0x7'));var RpcVoiceTransferReport=require(_0xef74('0x8'));var VoiceQueueReport=require(_0xef74('0x9'));var VoiceCallReport=require(_0xef74('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xef74('0xb'));var UserReport=require(_0xef74('0xc'));function Report(_0x48e482){this[_0xef74('0xd')]=_0x48e482;this[_0xef74('0xe')]=_0x48e482[_0xef74('0xe')];this[_0xef74('0xf')]=_0x48e482['telephones'];}Report['prototype'][_0xef74('0x10')]=function(_0x3d766c){var _0x9251d8=new VoiceQueueReport(this[_0xef74('0xd')]);var _0x16df47=new VoiceAgentReport(this[_0xef74('0xd')]);var _0x398f12=new VoiceDialReport(this['realtime']);var _0x10714b=new VoiceCallReport(this['realtime']);var _0x339fde=new UserReport(this[_0xef74('0xd')]);if(config[_0xef74('0x11')]&&config['xdr'][_0xef74('0x12')]){ami['on'](_0xef74('0x13'),this[_0xef74('0x14')]['bind'](this));ami['on'](_0xef74('0x15'),this[_0xef74('0x16')][_0xef74('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0xef74('0x18')][_0xef74('0x17')](this));ami['on'](_0xef74('0x19'),this[_0xef74('0x1a')][_0xef74('0x17')](this));ami['on'](_0xef74('0x1b'),this[_0xef74('0x1c')][_0xef74('0x17')](this));ami['on'](_0xef74('0x1d'),this['attendedTransfer'][_0xef74('0x17')](this));}};Report['prototype'][_0xef74('0x1e')]=function(_0x238c80){var _0x133fbf;_0x133fbf=_[_0xef74('0x1f')](this[_0xef74('0xe')],function(_0x3dec1b){return _0x3dec1b[_0xef74('0x20')]==_0x238c80||_0x3dec1b['name']==_0x238c80;});if(_['isNil'](_0x133fbf)){var _0x42358c=_['find'](this[_0xef74('0xf')],function(_0x202ace){return _0x202ace['accountcode']==_0x238c80||_0x202ace[_0xef74('0x21')]==_0x238c80;});if(_0x42358c){_0x133fbf=_[_0xef74('0x1f')](this[_0xef74('0xe')],function(_0x3709c6){return _0x3709c6[_0xef74('0x22')]==util['format']('SIP/%s',_0x42358c['name']);});}}return _0x133fbf;};Report['prototype'][_0xef74('0x14')]=function(_0x1b0a6f){for(var _0xc97c28=0x0;_0xc97c28<_0x1b0a6f[_0xef74('0x23')];_0xc97c28+=0x1){var _0x18ff78=this[_0xef74('0x1e')](_0x1b0a6f[_0xc97c28][_0xef74('0x24')]);if(_0x18ff78){_0x1b0a6f[_0xc97c28][_0xef74('0x20')]=_0x18ff78[_0xef74('0x20')];_0x1b0a6f[_0xc97c28][_0xef74('0x25')]=!![];_0x1b0a6f[_0xc97c28][_0xef74('0x26')]=_0x18ff78['name'];_0x1b0a6f[_0xc97c28]['interface']=_['isNil'](_0x18ff78[_0xef74('0x22')])?util['format'](_0xef74('0x27'),_0x18ff78['name']):_0x18ff78['interface'];if(_0x1b0a6f[_0xc97c28][_0xef74('0x28')]){_0x1b0a6f[_0xc97c28]['queuecallercompleteAt']=moment()[_0xef74('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1b0a6f[_0xc97c28][_0xef74('0x2a')]){_0x1b0a6f[_0xc97c28][_0xef74('0x2b')]=moment()[_0xef74('0x29')](_0xef74('0x2c'));}RpcMemberReport[_0xef74('0x14')](_0x1b0a6f[_0xc97c28]);}RpcVoiceQueueReport[_0xef74('0x2d')](_0x1b0a6f[_0xc97c28]);}};function extractCalleridNumber(_0x273dcc){var _0x4ce08c=_0x273dcc[_0xef74('0x2e')](/<(.*?)>/);return _0x4ce08c?_0x4ce08c[0x1]:_0x273dcc;}Report[_0xef74('0x2f')]['getAgentByInternal']=function(_0x5666b5){for(var _0x537f4e=0x0;_0x537f4e0x0?!![]:![];if(!_0x4c90dc){return this[_0x008a('0x16')](this[_0x008a('0x46')]['completeEvent']);}};VoiceQueueReport[_0x008a('0x8')][_0x008a('0x17')]=function(_0x1f9adc){var _0xcfb32f=this[_0x008a('0x46')]['id'];if(this[_0x008a('0x46')][_0x008a('0x5f')][_0xcfb32f]&&this[_0x008a('0x46')][_0x008a('0x5f')][_0xcfb32f][_0x1f9adc['actionid']]){this[_0x008a('0x46')]['queuestatus'][_0xcfb32f][_0x1f9adc[_0x008a('0x5e')]][_0x008a('0xd')][_0x008a('0x69')](_0x1f9adc);}};VoiceQueueReport['prototype'][_0x008a('0x13')]=function(_0x584f2){var _0x1a6893=this;try{if(this['isNotNull'](_0x584f2)&&this[_0x008a('0x59')](_0x584f2[_0x008a('0x4e')])){logger[_0x008a('0x4b')](_0x008a('0x6a'),util[_0x008a('0x42')](_0x584f2,{'showHidden':![],'depth':null}));var _0x234bde=this['voiceQueues'][_0x584f2[_0x008a('0x4e')]];if(_0x234bde){logger[_0x008a('0x4b')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x234bde[_0x008a('0x58')]);this[_0x008a('0x46')]['queues'][_0x234bde[_0x008a('0x58')]]={'summaryEvent':_0x584f2};this[_0x008a('0x46')][_0x008a('0x68')]+=0x1;return ami[_0x008a('0x3c')]({'action':_0x008a('0x5f'),'queue':_0x234bde[_0x008a('0x58')]})[_0x008a('0x6b')](function(_0x3a273c){if(!_0x1a6893['summary'][_0x008a('0x5f')][_0x584f2[_0x008a('0x5e')]]){_0x1a6893[_0x008a('0x46')]['queuestatus'][_0x584f2['actionid']]={};}_0x1a6893[_0x008a('0x46')][_0x008a('0x5f')][_0x584f2[_0x008a('0x5e')]][_0x3a273c[_0x008a('0x5e')]]={'queue':_0x234bde[_0x008a('0x58')],'agents':[]};})[_0x008a('0x3e')](function(_0x5d49bf){throw _0x5d49bf;});}}}catch(_0x3357e8){logger[_0x008a('0x41')](_0x008a('0x6c'),util[_0x008a('0x42')](_0x3357e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x008a('0x8')][_0x008a('0x16')]=function(_0x280745){if(this[_0x008a('0x46')][_0x008a('0x68')]>0x0){this[_0x008a('0x46')][_0x008a('0x6d')]=_0x280745;return;}logger[_0x008a('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x008a('0x42')](_0x280745,{'showHidden':![],'depth':null}));this[_0x008a('0x46')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0x008a('0x6e')]=function(_0x21dd3b){try{if(this[_0x008a('0x59')](_0x21dd3b)){logger[_0x008a('0x4b')](_0x008a('0x6f'),_0x21dd3b['uniqueid'],util[_0x008a('0x42')](_0x21dd3b,{'showHidden':![],'depth':null}));if(_[_0x008a('0x5a')](this[_0x008a('0xc')][_0x21dd3b[_0x008a('0x4c')]])){this[_0x008a('0xc')][_0x21dd3b[_0x008a('0x4c')]]=[];}if(_[_0x008a('0x5a')](this[_0x008a('0xe')][_0x21dd3b[_0x008a('0x4c')]])){this[_0x008a('0xe')][_0x21dd3b[_0x008a('0x4c')]]={};}var _0xeced9e=new QueueReport();_0xeced9e[_0x008a('0x4e')]=_0x21dd3b[_0x008a('0x4e')];_0xeced9e[_0x008a('0x70')]=this[_0x008a('0x66')][_0xeced9e[_0x008a('0x4e')]]&&this[_0x008a('0x66')][_0xeced9e[_0x008a('0x4e')]][_0x008a('0x70')]?this[_0x008a('0x66')][_0xeced9e['queue']][_0x008a('0x70')]||_0x008a('0x57'):_0x008a('0x57');_0xeced9e[_0x008a('0x71')]=moment()[_0x008a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0xeced9e['position']=_0x21dd3b[_0x008a('0x72')];_0xeced9e[_0x008a('0x73')]=_0x21dd3b['count'];_0xeced9e[_0x008a('0x4c')]=_0x21dd3b[_0x008a('0x4c')];_0xeced9e[_0x008a('0x74')]=this['channels'][_0x21dd3b[_0x008a('0x4c')]][_0x008a('0x74')];logger[_0x008a('0x75')](_0x008a('0x76'),_0xeced9e['queue'],_0xeced9e[_0x008a('0x70')]);Object[_0x008a('0x64')](_0xeced9e,_[_0x008a('0x77')](_0x21dd3b,_['keys'](_0xeced9e)));this[_0x008a('0xc')][_0x21dd3b['uniqueid']][_0x008a('0x69')](_0xeced9e);this[_0x008a('0xe')][_0x21dd3b[_0x008a('0x4c')]]=_0xeced9e;this[_0x008a('0x4a')](_0xeced9e,_0x008a('0x1a'));}}catch(_0x528efc){logger[_0x008a('0x41')](_0x008a('0x6f'),_0x21dd3b[_0x008a('0x4c')],util['inspect'](_0x528efc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x008a('0x8')]['syncQueueCallerAbandon']=function(_0xb2789){try{if(this['isNotNull'](_0xb2789)){logger[_0x008a('0x4b')](_0x008a('0x78'),_0xb2789[_0x008a('0x4c')],util[_0x008a('0x42')](_0xb2789,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xb2789[_0x008a('0x4c')]]){var _0x877db3=_[_0x008a('0x79')](this[_0x008a('0xc')][_0xb2789['uniqueid']]);_0x877db3['queuecallercomplete']=![];_0x877db3[_0x008a('0x7a')]=null;_0x877db3['holdtime']=_0xb2789['holdtime'];_0x877db3['originalposition']=_0xb2789[_0x008a('0x7b')];_0x877db3[_0x008a('0x38')]=!![];_0x877db3['queuecallerabandonAt']=moment()[_0x008a('0x4d')](_0x008a('0x7c'));_0x877db3[_0x008a('0x52')]=_0x008a('0x7d');_0x877db3[_0x008a('0x7e')]=null;logger[_0x008a('0x75')](_0x008a('0x7f'),_0x877db3[_0x008a('0x4e')],_0x877db3[_0x008a('0x70')]);this['channels'][_0xb2789[_0x008a('0x4c')]]=_0x877db3;this[_0x008a('0x47')](_0x877db3,_0x008a('0x38'));}}}catch(_0x324fe1){logger[_0x008a('0x41')](_0x008a('0x78'),_0xb2789[_0x008a('0x4c')],util[_0x008a('0x42')](_0x324fe1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x008a('0x8')]['syncQueueCallerLeave']=function(_0x4a9dfb){try{if(this[_0x008a('0x59')](_0x4a9dfb)){logger['debug'](_0x008a('0x80'),_0x4a9dfb[_0x008a('0x4c')],util[_0x008a('0x42')](_0x4a9dfb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a9dfb[_0x008a('0x4c')]]){var _0x5edccc=_[_0x008a('0x79')](this['queueReports'][_0x4a9dfb['uniqueid']]);_0x5edccc['queuecallerleaveAt']=moment()['format'](_0x008a('0x7c'));_0x5edccc[_0x008a('0x81')]=_0x4a9dfb[_0x008a('0x81')];_0x5edccc[_0x008a('0x82')]=_0x4a9dfb[_0x008a('0x82')];logger[_0x008a('0x75')](_0x008a('0x83'),_0x5edccc[_0x008a('0x4e')],_0x5edccc[_0x008a('0x70')],_0x4a9dfb['connectedlinenum'],_0x4a9dfb[_0x008a('0x82')]);this[_0x008a('0xe')][_0x4a9dfb[_0x008a('0x4c')]]=_0x5edccc;this[_0x008a('0x4a')](_0x5edccc,_0x008a('0x1c'));}}}catch(_0x592b1b){logger[_0x008a('0x41')](_0x008a('0x80'),_0x4a9dfb[_0x008a('0x4c')],util[_0x008a('0x42')](_0x592b1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x596a75){try{if(this[_0x008a('0x59')](_0x596a75)){logger[_0x008a('0x4b')](_0x008a('0x84'),_0x596a75[_0x008a('0x4c')],util[_0x008a('0x42')](_0x596a75,{'showHidden':![],'depth':null}));if(this[_0x008a('0xc')][_0x596a75[_0x008a('0x4c')]]){var _0xffe53e=_[_0x008a('0x79')](this['queueReports'][_0x596a75['uniqueid']]);_0xffe53e[_0x008a('0x85')]=!![];_0xffe53e[_0x008a('0x52')]=_0x008a('0x86');logger[_0x008a('0x75')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xffe53e[_0x008a('0x4e')],_0xffe53e[_0x008a('0x70')]);}}}catch(_0x4d5459){logger[_0x008a('0x41')](_0x008a('0x84'),_0x596a75['uniqueid'],util[_0x008a('0x42')](_0x4d5459,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x008a('0x1f')]=function(_0x313b65){try{if(this[_0x008a('0x59')](_0x313b65)){logger[_0x008a('0x4b')](_0x008a('0x87'),_0x313b65[_0x008a('0x4c')],util[_0x008a('0x42')](_0x313b65,{'showHidden':![],'depth':null}));if(this[_0x008a('0xc')][_0x313b65[_0x008a('0x4c')]]){var _0x4dcd6f=_[_0x008a('0x79')](this[_0x008a('0xc')][_0x313b65[_0x008a('0x4c')]]);_0x4dcd6f[_0x008a('0x38')]=![];_0x4dcd6f[_0x008a('0x88')]=null;_0x4dcd6f[_0x008a('0x89')]=!![];_0x4dcd6f['lastAssignedTo']=_0x313b65[_0x008a('0x8a')];_0x4dcd6f[_0x008a('0x8b')]=_0x313b65[_0x008a('0x8b')];_0x4dcd6f['queuecallercomplete']=!![];_0x4dcd6f[_0x008a('0x37')]=![];_0x4dcd6f[_0x008a('0x8c')]=null;if(!_0x4dcd6f[_0x008a('0x8d')]){if(_0x313b65['reason']==_0x008a('0x8d')){_0x4dcd6f[_0x008a('0x52')]=_0x008a('0x8e');logger[_0x008a('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4dcd6f[_0x008a('0x4e')],_0x4dcd6f[_0x008a('0x70')]);}else{if(_[_0x008a('0x8f')](_0x313b65['channel'][_0x008a('0x90')](),_0x008a('0x91'))){if(this['queueReports'][_0x313b65[_0x008a('0x92')]]){var _0x4e46e3=_['last'](this['queueReports'][_0x313b65[_0x008a('0x92')]]);_0x4e46e3[_0x008a('0x85')]=![];_0x4e46e3[_0x008a('0x37')]=!![];_0x4e46e3[_0x008a('0x8c')]=moment(_0x4dcd6f[_0x008a('0x71')])[_0x008a('0x93')](_0x313b65[_0x008a('0x8b')],_0x008a('0x94'))[_0x008a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e46e3[_0x008a('0x52')]=_0x008a('0x95');_0x4e46e3[_0x008a('0x8d')]=!![];_0x4e46e3[_0x008a('0x96')]='FORWARD';_0x4e46e3[_0x008a('0x97')]=_0x313b65['destexten'];_0x4e46e3[_0x008a('0x98')]=_0x313b65['uniqueid'];logger[_0x008a('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4e46e3['queue'],_0x4e46e3['type']);var _0x590c1a=this[_0x008a('0xc')][_0x313b65[_0x008a('0x92')]];this['queueReports'][_0x313b65[_0x008a('0x92')]]=this[_0x008a('0xc')][_0x313b65[_0x008a('0x4c')]];this['queueReports'][_0x313b65['uniqueid']]=_0x590c1a;}}else{_0x4dcd6f[_0x008a('0x52')]='COMPLETEDBY'+_0x313b65[_0x008a('0x99')]['toUpperCase']();logger[_0x008a('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4dcd6f['queue'],_0x4dcd6f[_0x008a('0x70')],_0x4dcd6f[_0x008a('0x52')]);}}}this['channels'][_0x313b65[_0x008a('0x4c')]]=_0x4dcd6f;}}}catch(_0x4e5fa0){logger[_0x008a('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x313b65[_0x008a('0x4c')],util[_0x008a('0x42')](_0x4e5fa0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x008a('0x22')]=function(_0x1db003){try{if(this['isNotNull'](_0x1db003)){logger[_0x008a('0x4b')]('[%s][voiceQueueReport][varset]',_0x1db003['uniqueid'],util[_0x008a('0x42')](_0x1db003,{'showHidden':![],'depth':null}));this[_0x008a('0x9a')](_0x1db003[_0x008a('0x4c')],_[_0x008a('0x9b')](_0x1db003[_0x008a('0x9c')])[0x0],_0x1db003[_0x008a('0x9d')]);if(this[_0x008a('0xc')][_0x1db003[_0x008a('0x4c')]]){var _0x59dbcb=_['last'](this['queueReports'][_0x1db003[_0x008a('0x4c')]]);if(_0x59dbcb){if(this[_0x008a('0x59')](_0x1db003[_0x008a('0x9c')])&&this[_0x008a('0x59')](_0x1db003[_0x008a('0x9c')][_0x008a('0x5f')])){switch(_0x1db003['value']){case _0x008a('0x9e'):_0x59dbcb[_0x008a('0x37')]=![];_0x59dbcb[_0x008a('0x8c')]=null;break;case'TIMEOUT':_0x59dbcb[_0x008a('0x9f')]=_0x008a('0xa0');_0x59dbcb[_0x008a('0x37')]=!![];_0x59dbcb[_0x008a('0x8c')]=moment()['format'](_0x008a('0x7c'));_0x59dbcb[_0x008a('0xa1')]=moment()[_0x008a('0x4d')](_0x008a('0x7c'));logger['debug'](_0x008a('0xa2'),_0x1db003[_0x008a('0x4c')],util['inspect'](_0x59dbcb,{'showHidden':![],'depth':null}));ami[_0x008a('0x49')](_0x008a('0xa3'),_0x59dbcb);break;default:_0x59dbcb[_0x008a('0x37')]=!![];_0x59dbcb['queuecallerexitAt']=moment()['format'](_0x008a('0x7c'));_0x59dbcb[_0x008a('0xa1')]=moment()['format'](_0x008a('0x7c'));}_0x59dbcb['queuecallerabandon']=![];_0x59dbcb[_0x008a('0x88')]=null;_0x59dbcb[_0x008a('0x52')]=_0x1db003[_0x008a('0x9d')];this['channels'][_0x1db003[_0x008a('0x4c')]]=_0x59dbcb;this[_0x008a('0x47')](_0x59dbcb,_0x008a('0x21'));}else if(this[_0x008a('0x59')](_0x1db003[_0x008a('0x9c')])&&this['isNotNull'](_0x1db003[_0x008a('0x9c')][_0x008a('0xa4')])){if(!_0x59dbcb['queuecallerabandon']){_0x59dbcb[_0x008a('0x37')]=!![];_0x59dbcb['queuecallerexitAt']=moment()[_0x008a('0x4d')](_0x008a('0x7c'));_0x59dbcb[_0x008a('0x52')]=_0x008a('0xa5');_0x59dbcb[_0x008a('0xa1')]=moment()[_0x008a('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1db003[_0x008a('0x4c')]]=_0x59dbcb;}}logger['info'](_0x008a('0xa6'),_0x1db003[_0x008a('0x4c')],_0x59dbcb[_0x008a('0x4e')],_0x59dbcb['type'],_[_0x008a('0x9b')](_0x1db003[_0x008a('0x9c')])[0x0],_0x1db003[_0x008a('0x9d')]);_0x59dbcb['variables']=this[_0x008a('0x11')][_0x1db003['uniqueid']];}}}}catch(_0x3178e9){logger[_0x008a('0x41')](_0x008a('0xa7'),_0x1db003['uniqueid'],util[_0x008a('0x42')](_0x3178e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x008a('0x8')][_0x008a('0x9a')]=function(_0x2f2662,_0x3b32cd,_0x2453ce){var _0x5c0ef3=[_0x008a('0xa8'),_0x008a('0xa9'),_0x008a('0xaa'),_0x008a('0xab'),'rtpaudioqosloss',_0x008a('0xac'),_0x008a('0xad'),_0x008a('0xae'),'sipcallid',_0x008a('0xaf'),'bridgepeer',_0x008a('0xb0'),_0x008a('0xb1'),_0x008a('0xb2'),_0x008a('0xb3'),_0x008a('0xb4'),_0x008a('0x8a'),_0x008a('0xb5'),'memberrealtime'];if(!_[_0x008a('0x3b')](_0x3b32cd)&&!_[_0x008a('0xb6')](_0x5c0ef3,_0x3b32cd)){if(_[_0x008a('0x5a')](this[_0x008a('0x11')][_0x2f2662])){this[_0x008a('0x11')][_0x2f2662]={};}this[_0x008a('0x11')][_0x2f2662][_0x3b32cd]=_0x2453ce;}};VoiceQueueReport[_0x008a('0x8')][_0x008a('0xb7')]=function(_0x3ee229,_0x191c06,_0x494557){try{var _0x5e7790={};if(this[_0x008a('0xc')][_0x3ee229]){for(var _0x340dc1=0x0;_0x340dc10x0?!![]:![];if(!_0x5ab96a){return this['syncQueueSummaryComplete'](this[_0x6f37('0x16')][_0x6f37('0x6d')]);}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x1c')]=function(_0x4bb7cd){var _0x4fb1a7=this[_0x6f37('0x16')]['id'];if(this[_0x6f37('0x16')][_0x6f37('0x65')][_0x4fb1a7]&&this[_0x6f37('0x16')]['queuestatus'][_0x4fb1a7][_0x4bb7cd[_0x6f37('0x63')]]){this[_0x6f37('0x16')][_0x6f37('0x65')][_0x4fb1a7][_0x4bb7cd[_0x6f37('0x63')]][_0x6f37('0x48')][_0x6f37('0x6e')](_0x4bb7cd);}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x19')]=function(_0xbf223f){var _0x53e6f2=this;try{if(this[_0x6f37('0x5e')](_0xbf223f)&&this[_0x6f37('0x5e')](_0xbf223f[_0x6f37('0x52')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x6f37('0x44')](_0xbf223f,{'showHidden':![],'depth':null}));var _0x54765a=this[_0x6f37('0x14')][_0xbf223f['queue']];if(_0x54765a){logger['debug'](_0x6f37('0x6f'),_0x54765a['name']);this[_0x6f37('0x16')]['queues'][_0x54765a[_0x6f37('0x5c')]]={'summaryEvent':_0xbf223f};this[_0x6f37('0x16')][_0x6f37('0x6c')]+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x54765a[_0x6f37('0x5c')]})['then'](function(_0x16d922){if(!_0x53e6f2['summary']['queuestatus'][_0xbf223f[_0x6f37('0x63')]]){_0x53e6f2[_0x6f37('0x16')][_0x6f37('0x65')][_0xbf223f[_0x6f37('0x63')]]={};}_0x53e6f2['summary']['queuestatus'][_0xbf223f['actionid']][_0x16d922[_0x6f37('0x63')]]={'queue':_0x54765a[_0x6f37('0x5c')],'agents':[]};})[_0x6f37('0x61')](function(_0x647bcc){throw _0x647bcc;});}}}catch(_0x4087c5){logger[_0x6f37('0x42')](_0x6f37('0x70'),util[_0x6f37('0x44')](_0x4087c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x71')]=function(_0x315952){if(this[_0x6f37('0x16')][_0x6f37('0x6c')]>0x0){this[_0x6f37('0x16')][_0x6f37('0x6d')]=_0x315952;return;}logger[_0x6f37('0x4c')](_0x6f37('0x72'),util[_0x6f37('0x44')](_0x315952,{'showHidden':![],'depth':null}));this[_0x6f37('0x16')]=initializeSummary();ami['emit'](_0x6f37('0x73'),{});};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x1f')]=function(_0x2619ca){try{if(this[_0x6f37('0x5e')](_0x2619ca)){logger[_0x6f37('0x4c')](_0x6f37('0x74'),_0x2619ca[_0x6f37('0x4f')],util['inspect'](_0x2619ca,{'showHidden':![],'depth':null}));if(_[_0x6f37('0x5f')](this['queueReports'][_0x2619ca['uniqueid']])){this[_0x6f37('0x10')][_0x2619ca[_0x6f37('0x4f')]]=[];}if(_[_0x6f37('0x5f')](this[_0x6f37('0x12')][_0x2619ca[_0x6f37('0x4f')]])){this[_0x6f37('0x12')][_0x2619ca[_0x6f37('0x4f')]]={};}var _0xdd58ed=new QueueReport();_0xdd58ed['queue']=_0x2619ca[_0x6f37('0x52')];_0xdd58ed['type']=this['voiceQueues'][_0xdd58ed[_0x6f37('0x52')]]&&this[_0x6f37('0x14')][_0xdd58ed[_0x6f37('0x52')]][_0x6f37('0x59')]?this[_0x6f37('0x14')][_0xdd58ed[_0x6f37('0x52')]][_0x6f37('0x59')]||_0x6f37('0x5a'):_0x6f37('0x5a');_0xdd58ed['queuecallerjoinAt']=moment()[_0x6f37('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0xdd58ed[_0x6f37('0x75')]=_0x2619ca['position'];_0xdd58ed[_0x6f37('0x76')]=_0x2619ca[_0x6f37('0x76')];_0xdd58ed[_0x6f37('0x4f')]=_0x2619ca[_0x6f37('0x4f')];_0xdd58ed[_0x6f37('0x77')]=this[_0x6f37('0x12')][_0x2619ca[_0x6f37('0x4f')]]['routealias'];logger[_0x6f37('0x78')](_0x6f37('0x79'),_0xdd58ed[_0x6f37('0x52')],_0xdd58ed[_0x6f37('0x59')]);Object['assign'](_0xdd58ed,_[_0x6f37('0x7a')](_0x2619ca,_[_0x6f37('0x7b')](_0xdd58ed)));this[_0x6f37('0x10')][_0x2619ca['uniqueid']][_0x6f37('0x6e')](_0xdd58ed);this[_0x6f37('0x12')][_0x2619ca[_0x6f37('0x4f')]]=_0xdd58ed;this[_0x6f37('0x4b')](_0xdd58ed,'queuecallerjoin');}}catch(_0x33e48a){logger[_0x6f37('0x42')](_0x6f37('0x74'),_0x2619ca[_0x6f37('0x4f')],util[_0x6f37('0x44')](_0x33e48a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0xd9099b){try{if(this['isNotNull'](_0xd9099b)){logger[_0x6f37('0x4c')](_0x6f37('0x7c'),_0xd9099b[_0x6f37('0x4f')],util['inspect'](_0xd9099b,{'showHidden':![],'depth':null}));if(this[_0x6f37('0x10')][_0xd9099b[_0x6f37('0x4f')]]){var _0x1a5aea=_[_0x6f37('0x7d')](this['queueReports'][_0xd9099b['uniqueid']]);_0x1a5aea[_0x6f37('0x3b')]=![];_0x1a5aea[_0x6f37('0x7e')]=null;_0x1a5aea[_0x6f37('0x7f')]=_0xd9099b['holdtime'];_0x1a5aea[_0x6f37('0x80')]=_0xd9099b[_0x6f37('0x80')];_0x1a5aea['queuecallerabandon']=!![];_0x1a5aea[_0x6f37('0x81')]=moment()[_0x6f37('0x50')](_0x6f37('0x82'));_0x1a5aea['queuecallerexitreason']=_0x6f37('0x83');_0x1a5aea[_0x6f37('0x84')]=null;logger[_0x6f37('0x78')](_0x6f37('0x85'),_0x1a5aea[_0x6f37('0x52')],_0x1a5aea[_0x6f37('0x59')]);this[_0x6f37('0x12')][_0xd9099b[_0x6f37('0x4f')]]=_0x1a5aea;this[_0x6f37('0x54')](_0x1a5aea,_0x6f37('0x20'));}}}catch(_0x2e97ca){logger['error'](_0x6f37('0x7c'),_0xd9099b['uniqueid'],util[_0x6f37('0x44')](_0x2e97ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x86')]=function(_0x595af8){try{if(this['isNotNull'](_0x595af8)){logger[_0x6f37('0x4c')]('[%s][voiceQueueReport][queuecallerleave]',_0x595af8[_0x6f37('0x4f')],util[_0x6f37('0x44')](_0x595af8,{'showHidden':![],'depth':null}));if(this[_0x6f37('0x10')][_0x595af8[_0x6f37('0x4f')]]){var _0x58fa48=_[_0x6f37('0x7d')](this[_0x6f37('0x10')][_0x595af8['uniqueid']]);_0x58fa48[_0x6f37('0x87')]=moment()[_0x6f37('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x58fa48[_0x6f37('0x88')]=_0x595af8[_0x6f37('0x88')];_0x58fa48['connectedlinename']=_0x595af8[_0x6f37('0x89')];logger[_0x6f37('0x78')](_0x6f37('0x8a'),_0x58fa48[_0x6f37('0x52')],_0x58fa48[_0x6f37('0x59')],_0x595af8[_0x6f37('0x88')],_0x595af8[_0x6f37('0x89')]);this[_0x6f37('0x12')][_0x595af8[_0x6f37('0x4f')]]=_0x58fa48;this[_0x6f37('0x4b')](_0x58fa48,_0x6f37('0x22'));}}}catch(_0x37ad95){logger[_0x6f37('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x595af8[_0x6f37('0x4f')],util[_0x6f37('0x44')](_0x37ad95,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x4d2268){try{if(this[_0x6f37('0x5e')](_0x4d2268)){logger[_0x6f37('0x4c')](_0x6f37('0x8b'),_0x4d2268[_0x6f37('0x4f')],util[_0x6f37('0x44')](_0x4d2268,{'showHidden':![],'depth':null}));if(this[_0x6f37('0x10')][_0x4d2268['uniqueid']]){var _0xbdb2e=_[_0x6f37('0x7d')](this['queueReports'][_0x4d2268[_0x6f37('0x4f')]]);_0xbdb2e[_0x6f37('0x3b')]=!![];_0xbdb2e[_0x6f37('0x8c')]=_0x6f37('0x8d');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0xbdb2e[_0x6f37('0x52')],_0xbdb2e[_0x6f37('0x59')]);}}}catch(_0x5b0fab){logger[_0x6f37('0x42')](_0x6f37('0x8b'),_0x4d2268['uniqueid'],util[_0x6f37('0x44')](_0x5b0fab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x24')]=function(_0x292116){try{if(this[_0x6f37('0x5e')](_0x292116)){logger[_0x6f37('0x4c')](_0x6f37('0x8e'),_0x292116[_0x6f37('0x4f')],util['inspect'](_0x292116,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x292116[_0x6f37('0x4f')]]){var _0x27cf2a=_[_0x6f37('0x7d')](this['queueReports'][_0x292116[_0x6f37('0x4f')]]);_0x27cf2a[_0x6f37('0x20')]=![];_0x27cf2a[_0x6f37('0x81')]=null;_0x27cf2a[_0x6f37('0x8f')]=!![];_0x27cf2a[_0x6f37('0x84')]=_0x292116[_0x6f37('0x90')];_0x27cf2a[_0x6f37('0x7f')]=_0x292116[_0x6f37('0x7f')];_0x27cf2a[_0x6f37('0x3b')]=!![];_0x27cf2a['queuecallerexit']=![];_0x27cf2a[_0x6f37('0x91')]=null;if(!_0x27cf2a[_0x6f37('0x92')]){if(_0x292116[_0x6f37('0x93')]==_0x6f37('0x92')){_0x27cf2a[_0x6f37('0x8c')]='COMPLETED';logger['info'](_0x6f37('0x94'),_0x27cf2a[_0x6f37('0x52')],_0x27cf2a[_0x6f37('0x59')]);}else{if(_[_0x6f37('0x95')](_0x292116['channel'][_0x6f37('0x96')](),_0x6f37('0x97'))){if(this[_0x6f37('0x10')][_0x292116[_0x6f37('0x98')]]){var _0x5cd07a=_[_0x6f37('0x7d')](this[_0x6f37('0x10')][_0x292116[_0x6f37('0x98')]]);_0x5cd07a[_0x6f37('0x3b')]=![];_0x5cd07a[_0x6f37('0x3a')]=!![];_0x5cd07a[_0x6f37('0x91')]=moment(_0x27cf2a[_0x6f37('0x99')])[_0x6f37('0x9a')](_0x292116[_0x6f37('0x7f')],_0x6f37('0x9b'))['format'](_0x6f37('0x82'));_0x5cd07a[_0x6f37('0x8c')]=_0x6f37('0x9c');_0x5cd07a[_0x6f37('0x92')]=!![];_0x5cd07a[_0x6f37('0x9d')]=_0x6f37('0x9e');_0x5cd07a[_0x6f37('0x9f')]=_0x292116['destexten'];_0x5cd07a[_0x6f37('0xa0')]=_0x292116[_0x6f37('0x4f')];logger['info'](_0x6f37('0xa1'),_0x5cd07a['queue'],_0x5cd07a[_0x6f37('0x59')]);var _0x35f62d=this[_0x6f37('0x10')][_0x292116['linkedid']];this['queueReports'][_0x292116[_0x6f37('0x98')]]=this[_0x6f37('0x10')][_0x292116[_0x6f37('0x4f')]];this[_0x6f37('0x10')][_0x292116[_0x6f37('0x4f')]]=_0x35f62d;}}else{_0x27cf2a[_0x6f37('0x8c')]=_0x6f37('0xa2')+_0x292116['reason'][_0x6f37('0xa3')]();logger[_0x6f37('0x78')](_0x6f37('0xa4'),_0x27cf2a[_0x6f37('0x52')],_0x27cf2a[_0x6f37('0x59')],_0x27cf2a[_0x6f37('0x8c')]);}}}this[_0x6f37('0x12')][_0x292116[_0x6f37('0x4f')]]=_0x27cf2a;}}}catch(_0x2b3a11){logger[_0x6f37('0x42')](_0x6f37('0x8e'),_0x292116['uniqueid'],util[_0x6f37('0x44')](_0x2b3a11,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0x26')]=function(_0x464210){try{if(this[_0x6f37('0x5e')](_0x464210)){logger[_0x6f37('0x4c')](_0x6f37('0xa5'),_0x464210['uniqueid'],util[_0x6f37('0x44')](_0x464210,{'showHidden':![],'depth':null}));this['addVariable'](_0x464210['uniqueid'],_[_0x6f37('0x7b')](_0x464210[_0x6f37('0xa6')])[0x0],_0x464210[_0x6f37('0xa7')]);if(this[_0x6f37('0x10')][_0x464210[_0x6f37('0x4f')]]){var _0x14d485=_[_0x6f37('0x7d')](this['queueReports'][_0x464210[_0x6f37('0x4f')]]);if(_0x14d485){if(this['isNotNull'](_0x464210['variable'])&&this[_0x6f37('0x5e')](_0x464210[_0x6f37('0xa6')][_0x6f37('0x65')])){switch(_0x464210[_0x6f37('0xa7')]){case'CONTINUE':_0x14d485[_0x6f37('0x3a')]=![];_0x14d485[_0x6f37('0x91')]=null;break;case'TIMEOUT':_0x14d485[_0x6f37('0xa8')]=_0x6f37('0xa9');_0x14d485['queuecallerexit']=!![];_0x14d485[_0x6f37('0x91')]=moment()[_0x6f37('0x50')](_0x6f37('0x82'));_0x14d485['queuecallerleaveAt']=moment()[_0x6f37('0x50')](_0x6f37('0x82'));logger['debug'](_0x6f37('0xaa'),_0x464210[_0x6f37('0x4f')],util['inspect'](_0x14d485,{'showHidden':![],'depth':null}));ami[_0x6f37('0x4a')](_0x6f37('0xab'),_0x14d485);break;default:_0x14d485[_0x6f37('0x3a')]=!![];_0x14d485[_0x6f37('0x91')]=moment()[_0x6f37('0x50')](_0x6f37('0x82'));_0x14d485[_0x6f37('0x87')]=moment()[_0x6f37('0x50')](_0x6f37('0x82'));}_0x14d485[_0x6f37('0x20')]=![];_0x14d485[_0x6f37('0x81')]=null;_0x14d485[_0x6f37('0x8c')]=_0x464210['value'];this[_0x6f37('0x12')][_0x464210[_0x6f37('0x4f')]]=_0x14d485;this[_0x6f37('0x54')](_0x14d485,_0x6f37('0xac'));}else if(this[_0x6f37('0x5e')](_0x464210[_0x6f37('0xa6')])&&this[_0x6f37('0x5e')](_0x464210[_0x6f37('0xa6')][_0x6f37('0xad')])){if(!_0x14d485['queuecallerabandon']){_0x14d485[_0x6f37('0x3a')]=!![];_0x14d485[_0x6f37('0x91')]=moment()[_0x6f37('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x14d485[_0x6f37('0x8c')]='EXITWITHKEY';_0x14d485[_0x6f37('0x87')]=moment()['format'](_0x6f37('0x82'));this[_0x6f37('0x12')][_0x464210[_0x6f37('0x4f')]]=_0x14d485;}}logger[_0x6f37('0x78')](_0x6f37('0xae'),_0x464210['uniqueid'],_0x14d485[_0x6f37('0x52')],_0x14d485[_0x6f37('0x59')],_['keys'](_0x464210[_0x6f37('0xa6')])[0x0],_0x464210['value']);_0x14d485[_0x6f37('0x17')]=this[_0x6f37('0x17')][_0x464210[_0x6f37('0x4f')]];}}}}catch(_0x553eab){logger[_0x6f37('0x42')](_0x6f37('0xa5'),_0x464210['uniqueid'],util[_0x6f37('0x44')](_0x553eab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0xaf')]=function(_0x29bcb4,_0x58ce65,_0x47f10b){var _0x59b5b8=[_0x6f37('0xb0'),'rtpaudioqosbridged',_0x6f37('0xb1'),_0x6f37('0xb2'),_0x6f37('0xb3'),'rtpaudioqoslossbridged',_0x6f37('0xb4'),_0x6f37('0xb5'),_0x6f37('0xb6'),_0x6f37('0xb7'),_0x6f37('0xb8'),_0x6f37('0xb9'),_0x6f37('0xba'),_0x6f37('0xbb'),_0x6f37('0xbc'),_0x6f37('0xbd'),_0x6f37('0x90'),_0x6f37('0xbe'),'memberrealtime'];if(!_[_0x6f37('0x3e')](_0x58ce65)&&!_['includes'](_0x59b5b8,_0x58ce65)){if(_[_0x6f37('0x5f')](this[_0x6f37('0x17')][_0x29bcb4])){this[_0x6f37('0x17')][_0x29bcb4]={};}this['variables'][_0x29bcb4][_0x58ce65]=_0x47f10b;}};VoiceQueueReport[_0x6f37('0xc')][_0x6f37('0xbf')]=function(_0x2cb825,_0x46ea92,_0x3ae985){try{var _0x543b0e={};if(this[_0x6f37('0x10')][_0x2cb825]){for(var _0x18f01f=0x0;_0x18f01f=0x0?moment(_0x653874[_0xc6a6('0x19')])[_0xc6a6('0x1a')](_0x653874['starttime'],'seconds'):null,'data1':_0xc6a6('0x1b'),'data2':_0x653874['accountcode'],'data3':_0x653874[_0xc6a6('0xf')],'data4':_0x653874[_0xc6a6('0x1c')]||null,'role':_0xc6a6('0x11'),'internal':_0x653874[_0xc6a6('0x12')]?_[_0xc6a6('0x13')](_0x653874['accountcode']):undefined,'uniqueid':_0x653874[_0xc6a6('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x753d=['queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','starttime','endtime','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','lastAssignedTo','isNil','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','calleridnum'];(function(_0x91bd85,_0x47c57e){var _0x1ee7b0=function(_0x5718f7){while(--_0x5718f7){_0x91bd85['push'](_0x91bd85['shift']());}};_0x1ee7b0(++_0x47c57e);}(_0x753d,0xc8));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xd753('0x0'));var _=require(_0xd753('0x1'));var util=require(_0xd753('0x2'));var client=require(_0xd753('0x3'));exports[_0xd753('0x4')]=function(_0x30f134){var _0x20c81a=_0x30f134[_0xd753('0x5')]||_0x30f134['queuecallerexitAt'];return client['Request'](_0xd753('0x6'),{'body':{'channel':'voice','membername':_0x30f134[_0xd753('0x7')],'interface':_[_0xd753('0x8')](_0x30f134['interface'])?util['format'](_0xd753('0x9'),_0x30f134['lastAssignedTo']):_0x30f134[_0xd753('0xa')],'type':_0xd753('0xb'),'enterAt':_0x30f134[_0xd753('0xc')],'exitAt':_0x20c81a,'duration':moment(_0x20c81a)[_0xd753('0xd')](_0x30f134[_0xd753('0xc')],_0xd753('0xe')),'data1':'inbound','data2':_0x30f134[_0xd753('0xf')],'data3':_0x30f134['exten'],'data4':null,'data5':_0x30f134[_0xd753('0x10')],'role':_0xd753('0x11'),'internal':_0x30f134[_0xd753('0x12')]?_[_0xd753('0x13')](_0x30f134['accountcode']):undefined,'uniqueid':_0x30f134[_0xd753('0x14')]},'log':'CreateMemberReport'});};exports[_0xd753('0x15')]=function(_0x449b32){return client['Request']('CreateMemberReport',{'body':{'channel':_0xd753('0x16'),'membername':_0x449b32['membername'],'interface':_0x449b32[_0xd753('0xa')],'type':_0xd753('0xb'),'enterAt':_0x449b32[_0xd753('0x17')],'exitAt':_0x449b32[_0xd753('0x18')],'duration':moment(_0x449b32[_0xd753('0x18')])['diff'](_0x449b32[_0xd753('0x17')],'seconds')>=0x0?moment(_0x449b32[_0xd753('0x18')])['diff'](_0x449b32[_0xd753('0x17')],_0xd753('0xe')):null,'data1':'outbound','data2':_0x449b32[_0xd753('0x12')],'data3':_0x449b32[_0xd753('0x19')],'data4':_0x449b32[_0xd753('0x1a')]||null,'role':_0xd753('0x11'),'internal':_0x449b32['accountcode']?_[_0xd753('0x13')](_0x449b32['accountcode']):undefined,'uniqueid':_0x449b32['uniqueid']},'log':_0xd753('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 561960f..5b9260f 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 _0x325b=['getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x325b,0x8b));var _0xb325=function(_0x367dff,_0xd200aa){_0x367dff=_0x367dff-0x0;var _0x3bb13e=_0x325b[_0x367dff];return _0x3bb13e;};'use strict';var client=require(_0xb325('0x0'));exports[_0xb325('0x1')]=function(){return client[_0xb325('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb325('0x3'),_0xb325('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xcb49=['../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x59dd10,_0x125d21){var _0x2d3777=function(_0x4c346e){while(--_0x4c346e){_0x59dd10['push'](_0x59dd10['shift']());}};_0x2d3777(++_0x125d21);}(_0xcb49,0x156));var _0x9cb4=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xcb49[_0x11f249];return _0x5c3656;};'use strict';var client=require(_0x9cb4('0x0'));exports['getSettings']=function(){return client[_0x9cb4('0x1')](_0x9cb4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9cb4('0x3'),_0x9cb4('0x4')]},'log':_0x9cb4('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index df11b24..5844994 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 _0xac85=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x11d989,_0x26ff43){var _0x2f124b=function(_0x526b71){while(--_0x526b71){_0x11d989['push'](_0x11d989['shift']());}};_0x2f124b(++_0x26ff43);}(_0xac85,0x1a0));var _0x5ac8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xac85[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x5ac8('0x0'));exports[_0x5ac8('0x1')]=function(_0x291132){return function(_0x399616){return client[_0x5ac8('0x2')](_0x5ac8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5ac8('0x4'),_0x5ac8('0x5')]},'log':_0x5ac8('0x3')});};}; \ No newline at end of file +var _0x2ef4=['GetTemplate','Request'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2ef4,0x143));var _0x42ef=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x2ef4[_0x8a7e38];return _0x228609;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x44687b){return function(_0x3ccd25){return client[_0x42ef('0x0')](_0x42ef('0x1'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x42ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 89e4676..5ea68b6 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 _0x2263=['Request','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data3','data4','data5','data6','data7','../client','getTriggers'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2263,0xec));var _0x3226=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x2263[_0x593752];return _0x4612be;};'use strict';var client=require(_0x3226('0x0'));exports[_0x3226('0x1')]=function(_0x351cc8){return function(_0x167779){return client[_0x3226('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0x3226('0x3')],'include':[{'model':_0x3226('0x4'),'as':'AllConditions','attributes':['id',_0x3226('0x5'),_0x3226('0x6'),_0x3226('0x7')]},{'model':_0x3226('0x4'),'as':_0x3226('0x8'),'attributes':['id',_0x3226('0x5'),_0x3226('0x6'),_0x3226('0x7')]},{'model':_0x3226('0x9'),'as':_0x3226('0xa'),'attributes':['id',_0x3226('0xb'),'data1','data2',_0x3226('0xc'),_0x3226('0xd'),_0x3226('0xe'),_0x3226('0xf'),_0x3226('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x54d6=['data6','GetTrigger','../client','Request','channel','status','AllConditions','field','operator','value','Condition','Action','Actions','action','data1','data2','data3','data5'];(function(_0x546018,_0x51c434){var _0x26bdc0=function(_0x11c522){while(--_0x11c522){_0x546018['push'](_0x546018['shift']());}};_0x26bdc0(++_0x51c434);}(_0x54d6,0x17c));var _0x654d=function(_0x409735,_0x162b49){_0x409735=_0x409735-0x0;var _0x13997f=_0x54d6[_0x409735];return _0x13997f;};'use strict';var client=require(_0x654d('0x0'));exports['getTriggers']=function(_0x4fe9d1){return function(_0x282eb9){return client[_0x654d('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x654d('0x2'),_0x654d('0x3')],'include':[{'model':'Condition','as':_0x654d('0x4'),'attributes':['id',_0x654d('0x5'),_0x654d('0x6'),_0x654d('0x7')]},{'model':_0x654d('0x8'),'as':'AnyConditions','attributes':['id',_0x654d('0x5'),_0x654d('0x6'),_0x654d('0x7')]},{'model':_0x654d('0x9'),'as':_0x654d('0xa'),'attributes':['id',_0x654d('0xb'),_0x654d('0xc'),_0x654d('0xd'),_0x654d('0xe'),'data4',_0x654d('0xf'),_0x654d('0x10'),'data7']}]},'log':_0x654d('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3d7dee7..6b5e92b 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 _0x4403=['defaultuser','GetTrunk','name','registry'];(function(_0x440fe1,_0x1a452e){var _0xadd373=function(_0x2bf30f){while(--_0x2bf30f){_0x440fe1['push'](_0x440fe1['shift']());}};_0xadd373(++_0x1a452e);}(_0x4403,0x179));var _0x3440=function(_0x4d63c4,_0x45fef6){_0x4d63c4=_0x4d63c4-0x0;var _0x37c0e1=_0x4403[_0x4d63c4];return _0x37c0e1;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x53b3f6){return function(_0x78fe8c){return client['Request'](_0x3440('0x0'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3440('0x1'),_0x3440('0x2'),_0x3440('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x4c67=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x3e395f,_0x448bba){var _0x36f3b8=function(_0xffef53){while(--_0xffef53){_0x3e395f['push'](_0x3e395f['shift']());}};_0x36f3b8(++_0x448bba);}(_0x4c67,0x1cd));var _0x74c6=function(_0x54bf84,_0x405de6){_0x54bf84=_0x54bf84-0x0;var _0xb97549=_0x4c67[_0x54bf84];return _0xb97549;};'use strict';var client=require(_0x74c6('0x0'));exports[_0x74c6('0x1')]=function(_0x3e524f){return function(_0xfb1b91){return client[_0x74c6('0x2')](_0x74c6('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x74c6('0x4'),_0x74c6('0x5'),_0x74c6('0x6')]},'log':_0x74c6('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 10f4bb5..fe64e3c 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1034f8,_0x2b21a0){var _0x1016cb=function(_0x4643a6){while(--_0x4643a6){_0x1034f8['push'](_0x1034f8['shift']());}};_0x1016cb(++_0x2b21a0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0xcb91[_0x5a7dd3];return _0x2f4d07;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x3b1abc,_0x48a002){var _0x472e4a=function(_0x1cfa7c){while(--_0x1cfa7c){_0x3b1abc['push'](_0x3b1abc['shift']());}};_0x472e4a(++_0x48a002);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 106aa48..991297c 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 _0x387a=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3542c5,_0x3425bf){var _0x29f4f4=function(_0x4aa352){while(--_0x4aa352){_0x3542c5['push'](_0x3542c5['shift']());}};_0x29f4f4(++_0x3425bf);}(_0x387a,0xd5));var _0xa387=function(_0x434857,_0x769589){_0x434857=_0x434857-0x0;var _0x3e0fb3=_0x387a[_0x434857];return _0x3e0fb3;};'use strict';var client=require(_0xa387('0x0'));exports[_0xa387('0x1')]=function(_0x149f5e){return client[_0xa387('0x2')](_0xa387('0x3'),{'body':_0x149f5e,'log':_0xa387('0x3')});};exports[_0xa387('0x4')]=function(_0x1627f4,_0x2ba937,_0x4b9b92){return client['Request'](_0xa387('0x5'),{'body':_0x1627f4,'options':{'where':{'uniqueid':_0x2ba937,'interface':_0x4b9b92,'agentcomplete':!![]}},'log':_0xa387('0x5')});}; \ No newline at end of file +var _0x3b77=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4ca5f4,_0x10c069){var _0x62f19c=function(_0x416bbc){while(--_0x416bbc){_0x4ca5f4['push'](_0x4ca5f4['shift']());}};_0x62f19c(++_0x10c069);}(_0x3b77,0x7c));var _0x73b7=function(_0x964b3,_0x15e9cd){_0x964b3=_0x964b3-0x0;var _0x4a6ca3=_0x3b77[_0x964b3];return _0x4a6ca3;};'use strict';var client=require(_0x73b7('0x0'));exports[_0x73b7('0x1')]=function(_0x37d86d){return client[_0x73b7('0x2')](_0x73b7('0x3'),{'body':_0x37d86d,'log':_0x73b7('0x3')});};exports[_0x73b7('0x4')]=function(_0x977cb5,_0x17f387,_0x4badb7){return client['Request'](_0x73b7('0x5'),{'body':_0x977cb5,'options':{'where':{'uniqueid':_0x17f387,'interface':_0x4badb7,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0411898..db540b4 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 _0x021c=['duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition'];(function(_0x311d71,_0x3585d6){var _0x57c916=function(_0x28929b){while(--_0x28929b){_0x311d71['push'](_0x311d71['shift']());}};_0x57c916(++_0x3585d6);}(_0x021c,0x100));var _0xc021=function(_0x34331b,_0x22a64c){_0x34331b=_0x34331b-0x0;var _0x1f97c8=_0x021c[_0x34331b];return _0x1f97c8;};'use strict';var moment=require(_0xc021('0x0'));var util=require('util');var _=require(_0xc021('0x1'));var client=require('../client');exports[_0xc021('0x2')]=function(_0x355578){return client[_0xc021('0x3')](_0xc021('0x4'),{'body':_[_0xc021('0x5')](_0x355578,{'source':_0x355578[_0xc021('0x6')],'destinationcontext':_0x355578[_0xc021('0x7')],'callerid':_0x355578[_0xc021('0x8')],'amaflags':_0xc021('0x9')}),'log':_0xc021('0x4')});};exports[_0xc021('0xa')]=function(){return function(){return client[_0xc021('0x3')](_0xc021('0xb'),{'options':{'where':{'type':[_0xc021('0xc')],'createdAt':{'$between':[moment()[_0xc021('0xd')](_0xc021('0xe'))[_0xc021('0xf')](_0xc021('0x10')),moment()[_0xc021('0x11')]('day')[_0xc021('0xf')](_0xc021('0x10'))]}},'attributes':[_0xc021('0x12'),_0xc021('0x13'),_0xc021('0x14'),_0xc021('0x15')]},'log':_0xc021('0x16')});};}; \ No newline at end of file +var _0x6e31=['merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x6e31,0x12d));var _0x16e3=function(_0x3ed99f,_0x3bad0b){_0x3ed99f=_0x3ed99f-0x0;var _0x52de2f=_0x6e31[_0x3ed99f];return _0x52de2f;};'use strict';var moment=require(_0x16e3('0x0'));var util=require(_0x16e3('0x1'));var _=require(_0x16e3('0x2'));var client=require(_0x16e3('0x3'));exports[_0x16e3('0x4')]=function(_0x276456){return client[_0x16e3('0x5')](_0x16e3('0x6'),{'body':_[_0x16e3('0x7')](_0x276456,{'source':_0x276456['calleridnum'],'destinationcontext':_0x276456[_0x16e3('0x8')],'callerid':_0x276456[_0x16e3('0x9')],'amaflags':_0x16e3('0xa')}),'log':_0x16e3('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x16e3('0x5')](_0x16e3('0xb'),{'options':{'where':{'type':[_0x16e3('0xc')],'createdAt':{'$between':[moment()[_0x16e3('0xd')]('day')[_0x16e3('0xe')](_0x16e3('0xf')),moment()[_0x16e3('0x10')]('day')[_0x16e3('0xe')](_0x16e3('0xf'))]}},'attributes':[_0x16e3('0x11'),_0x16e3('0x12'),_0x16e3('0x13'),_0x16e3('0x14')]},'log':_0x16e3('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e8acade..fb767a9 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 _0xf49c=['Request','CreateVoiceDialReport','../client'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf49c,0xa7));var _0xcf49=function(_0x540c16,_0x4334f7){_0x540c16=_0x540c16-0x0;var _0x4fad6f=_0xf49c[_0x540c16];return _0x4fad6f;};'use strict';var client=require(_0xcf49('0x0'));exports['create']=function(_0x283bd7){return client[_0xcf49('0x1')](_0xcf49('0x2'),{'body':_0x283bd7,'log':_0xcf49('0x2')});}; \ No newline at end of file +var _0x7c63=['../client','Request','CreateVoiceDialReport'];(function(_0x4be40a,_0x865d94){var _0x12d037=function(_0x9f2608){while(--_0x9f2608){_0x4be40a['push'](_0x4be40a['shift']());}};_0x12d037(++_0x865d94);}(_0x7c63,0x69));var _0x37c6=function(_0x17c850,_0x1a8609){_0x17c850=_0x17c850-0x0;var _0x1d510a=_0x7c63[_0x17c850];return _0x1d510a;};'use strict';var client=require(_0x37c6('0x0'));exports['create']=function(_0x24ae9d){return client[_0x37c6('0x1')]('CreateVoiceDialReport',{'body':_0x24ae9d,'log':_0x37c6('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 95a2862..1037dc6 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 _0x1ba2=['../client','Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x239bbf,_0x3416e9){var _0x32619d=function(_0x5a6bb5){while(--_0x5a6bb5){_0x239bbf['push'](_0x239bbf['shift']());}};_0x32619d(++_0x3416e9);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x21ba('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x21ba('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x21ba('0x2'),_0x21ba('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x21ba('0x4')});};}; \ No newline at end of file +var _0x95af=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x95af,0x173));var _0xf95a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x95af[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xf95a('0x0'));exports[_0xf95a('0x1')]=function(){return function(){return client['Request'](_0xf95a('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf95a('0x3'),_0xf95a('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf95a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 145dc00..6bea24a 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 _0xd66b=['dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request','acwTimeout','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x3706c7,_0x3f8d33){var _0x2a85e=function(_0x1607dc){while(--_0x1607dc){_0x3706c7['push'](_0x3706c7['shift']());}};_0x2a85e(++_0x3f8d33);}(_0xd66b,0x1d4));var _0xbd66=function(_0x558c41,_0x2287bc){_0x558c41=_0x558c41-0x0;var _0x261f67=_0xd66b[_0x558c41];return _0x261f67;};'use strict';var client=require(_0xbd66('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xbd66('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0xbd66('0x2'),'autopause',_0xbd66('0x3'),_0xbd66('0x4'),_0xbd66('0x5'),_0xbd66('0x6'),'dialLimitChannel','dialLimitQueue',_0xbd66('0x7'),_0xbd66('0x8'),'dialPredictiveOptimizationPercentage',_0xbd66('0x9'),_0xbd66('0xa'),_0xbd66('0xb'),_0xbd66('0xc'),'dialQueueOptions',_0xbd66('0xd'),_0xbd66('0xe'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xbd66('0xf'),'dialBusyRetryFrequency',_0xbd66('0x10'),'dialNoAnswerRetryFrequency',_0xbd66('0x11'),_0xbd66('0x12'),_0xbd66('0x13'),_0xbd66('0x14'),'dialCheckDuplicateType','dialAMDActive',_0xbd66('0x15'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xbd66('0x16'),_0xbd66('0x17'),_0xbd66('0x18'),'dialAMDMaximumNumberOfWords',_0xbd66('0x19'),_0xbd66('0x1a'),_0xbd66('0x1b'),_0xbd66('0x1c'),_0xbd66('0x1d'),_0xbd66('0x1e'),_0xbd66('0x1f'),_0xbd66('0x20'),_0xbd66('0x21'),_0xbd66('0x3'),_0xbd66('0x22'),'dialRandomLastDigitCallerIdNumber',_0xbd66('0x23'),'dialNoSuchNumberMaxRetry',_0xbd66('0x24'),_0xbd66('0x25'),_0xbd66('0x26'),'dialAbandonedMaxRetry',_0xbd66('0x27'),_0xbd66('0x28'),_0xbd66('0x29'),_0xbd66('0x2a'),_0xbd66('0x2b'),_0xbd66('0x2c'),_0xbd66('0x2d'),_0xbd66('0x2e'),_0xbd66('0x2f'),_0xbd66('0x30')],'include':[{'model':_0xbd66('0x31'),'as':_0xbd66('0x31'),'attributes':['id',_0xbd66('0x32'),'callerid',_0xbd66('0x33')]},{'model':_0xbd66('0x34'),'as':_0xbd66('0x35'),'attributes':['id',_0xbd66('0x32')]},{'model':_0xbd66('0x31'),'as':_0xbd66('0x36'),'attributes':['id','name',_0xbd66('0x37'),'active']},{'model':_0xbd66('0x38'),'as':_0xbd66('0x38'),'attributes':['id',_0xbd66('0x32')],'include':[{'model':_0xbd66('0x38'),'as':_0xbd66('0x39'),'attributes':['id',_0xbd66('0x32'),_0xbd66('0x3a')]}]}]},'log':_0xbd66('0x3b')});};}; \ No newline at end of file +var _0x67ee=['dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','name','active','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x234bbf,_0x3e5810){var _0x15f751=function(_0x5b4afd){while(--_0x5b4afd){_0x234bbf['push'](_0x234bbf['shift']());}};_0x15f751(++_0x3e5810);}(_0x67ee,0xde));var _0xe67e=function(_0x19efbb,_0x56662b){_0x19efbb=_0x19efbb-0x0;var _0x2b0c80=_0x67ee[_0x19efbb];return _0x2b0c80;};'use strict';var client=require(_0xe67e('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xe67e('0x1')](_0xe67e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe67e('0x3'),_0xe67e('0x4'),_0xe67e('0x5'),'monitor_format',_0xe67e('0x6'),_0xe67e('0x7'),'dialMethod','dialLimitChannel',_0xe67e('0x8'),_0xe67e('0x9'),_0xe67e('0xa'),_0xe67e('0xb'),'dialPredictiveInterval',_0xe67e('0xc'),_0xe67e('0xd'),_0xe67e('0xe'),_0xe67e('0xf'),_0xe67e('0x10'),_0xe67e('0x11'),'dialCongestionMaxRetry',_0xe67e('0x12'),_0xe67e('0x13'),_0xe67e('0x14'),_0xe67e('0x15'),_0xe67e('0x16'),_0xe67e('0x17'),_0xe67e('0x18'),_0xe67e('0x19'),_0xe67e('0x1a'),_0xe67e('0x1b'),_0xe67e('0x1c'),_0xe67e('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xe67e('0x1e'),'dialAMDMinWordLength',_0xe67e('0x1f'),_0xe67e('0x20'),_0xe67e('0x21'),_0xe67e('0x22'),'timeout',_0xe67e('0x23'),_0xe67e('0x24'),'dialOrderByScheduledAt',_0xe67e('0x25'),_0xe67e('0x26'),_0xe67e('0x27'),_0xe67e('0x28'),_0xe67e('0x29'),_0xe67e('0x2a'),_0xe67e('0x2b'),_0xe67e('0x2c'),'dialNoSuchNumberRetryFrequency',_0xe67e('0x2d'),_0xe67e('0x2e'),'dialAbandonedMaxRetry',_0xe67e('0x2f'),_0xe67e('0x30'),_0xe67e('0x31'),_0xe67e('0x32'),_0xe67e('0x33'),_0xe67e('0x34'),_0xe67e('0x35'),_0xe67e('0x36'),_0xe67e('0x37'),_0xe67e('0x38')],'include':[{'model':_0xe67e('0x39'),'as':'Trunk','attributes':['id','name',_0xe67e('0x3a'),'active']},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0xe67e('0x3b')]},{'model':_0xe67e('0x39'),'as':'TrunkBackup','attributes':['id',_0xe67e('0x3b'),'callerid',_0xe67e('0x3c')]},{'model':'Interval','as':'Interval','attributes':['id',_0xe67e('0x3b')],'include':[{'model':'Interval','as':_0xe67e('0x3d'),'attributes':['id',_0xe67e('0x3b'),_0xe67e('0x3e')]}]}]},'log':_0xe67e('0x3f')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 21f4b7a..f561c0b 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(_0x15adef,_0x45e9eb){var _0xf41273=function(_0x3c2282){while(--_0x3c2282){_0x15adef['push'](_0x15adef['shift']());}};_0xf41273(++_0x45e9eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x5bd905,_0x6b8241){var _0x47389d=function(_0x6aaa76){while(--_0x6aaa76){_0x5bd905['push'](_0x5bd905['shift']());}};_0x47389d(++_0x6b8241);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 f7e20ae..135c99f 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 _0x5be0=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x189b8e,_0x5003b0){var _0x944e7b=function(_0x284318){while(--_0x284318){_0x189b8e['push'](_0x189b8e['shift']());}};_0x944e7b(++_0x5003b0);}(_0x5be0,0x114));var _0x05be=function(_0x59a791,_0x3b49a7){_0x59a791=_0x59a791-0x0;var _0x235d58=_0x5be0[_0x59a791];return _0x235d58;};'use strict';var client=require(_0x05be('0x0'));exports[_0x05be('0x1')]=function(_0x4817a6){return function(){return client[_0x05be('0x2')](_0x05be('0x3'),{'options':{'where':{'VoiceQueueId':_0x4817a6,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xdbd2=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbd2,0xb5));var _0x2dbd=function(_0xdfe33,_0x1704ac){_0xdfe33=_0xdfe33-0x0;var _0x3a64cf=_0xdbd2[_0xdfe33];return _0x3a64cf;};'use strict';var client=require(_0x2dbd('0x0'));exports[_0x2dbd('0x1')]=function(_0x3a8176){return function(){return client[_0x2dbd('0x2')](_0x2dbd('0x3'),{'options':{'where':{'VoiceQueueId':_0x3a8176,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 155bb0b..7dc07ba 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(_0x29ecd8,_0x42c5c8){var _0x280c37=function(_0x59e3d2){while(--_0x59e3d2){_0x29ecd8['push'](_0x29ecd8['shift']());}};_0x280c37(++_0x42c5c8);}(_0x7a54,0x106));var _0x47a5=function(_0x3a63ac,_0x474f25){_0x3a63ac=_0x3a63ac-0x0;var _0x5c8097=_0x7a54[_0x3a63ac];return _0x5c8097;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x185cc7,_0x327dc7){var _0x493136=function(_0xbda87f){while(--_0xbda87f){_0x185cc7['push'](_0x185cc7['shift']());}};_0x493136(++_0x327dc7);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7e338d1..701d2f7 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 _0xa278=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x21e41b,_0x41a954){var _0x5699a0=function(_0x117730){while(--_0x117730){_0x21e41b['push'](_0x21e41b['shift']());}};_0x5699a0(++_0x41a954);}(_0xa278,0xdd));var _0x8a27=function(_0x22aa61,_0x45e107){_0x22aa61=_0x22aa61-0x0;var _0x51500a=_0xa278[_0x22aa61];return _0x51500a;};'use strict';var client=require(_0x8a27('0x0'));exports[_0x8a27('0x1')]={};exports[_0x8a27('0x2')]=function(_0x3b15ca){return client[_0x8a27('0x3')](_0x8a27('0x4'),{'body':{'result':_0x3b15ca[_0x8a27('0x5')],'transfererchannel':_0x3b15ca[_0x8a27('0x6')],'transferercalleridnum':_0x3b15ca['transferercalleridnum'],'transferercalleridname':_0x3b15ca[_0x8a27('0x7')],'transfererconnectedlinenum':_0x3b15ca['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3b15ca[_0x8a27('0x8')],'transfereraccountcode':_0x3b15ca[_0x8a27('0x9')],'transferercontext':_0x3b15ca[_0x8a27('0xa')],'transfererexten':_0x3b15ca[_0x8a27('0xb')],'transfererlinkedid':_0x3b15ca[_0x8a27('0xc')],'transfereechannel':_0x3b15ca[_0x8a27('0xd')],'transfereecalleridnum':_0x3b15ca['transfereecalleridnum'],'transfereecalleridname':_0x3b15ca[_0x8a27('0xe')],'transfereeconnectedlinenum':_0x3b15ca[_0x8a27('0xf')],'transfereeconnectedlinename':_0x3b15ca[_0x8a27('0x10')],'transfereeaccountcode':_0x3b15ca[_0x8a27('0x11')],'transfereecontext':_0x3b15ca[_0x8a27('0x12')],'transfereeexten':_0x3b15ca['transfereeexten'],'transfereelinkedid':_0x3b15ca[_0x8a27('0x13')],'isexternal':_0x3b15ca[_0x8a27('0x14')],'context':_0x3b15ca[_0x8a27('0x15')],'extension':_0x3b15ca[_0x8a27('0x16')],'type':_0x8a27('0x17')},'log':_0x8a27('0x4')});};exports[_0x8a27('0x18')]=function(_0x560d39){return client[_0x8a27('0x3')](_0x8a27('0x4'),{'body':{'result':_0x560d39[_0x8a27('0x5')],'transfererchannel':_0x560d39[_0x8a27('0x19')],'transferercalleridnum':_0x560d39[_0x8a27('0x1a')],'transferercalleridname':_0x560d39[_0x8a27('0x1b')],'transfererconnectedlinenum':_0x560d39[_0x8a27('0x1c')],'transfererconnectedlinename':_0x560d39[_0x8a27('0x1d')],'transfereraccountcode':_0x560d39['origtransfereraccountcode'],'transferercontext':_0x560d39[_0x8a27('0x1e')],'transfererexten':_0x560d39[_0x8a27('0x1f')],'transfererlinkedid':_0x560d39[_0x8a27('0x20')],'transfereechannel':_0x560d39[_0x8a27('0x21')],'transfereecalleridnum':_0x560d39[_0x8a27('0x22')],'transfereecalleridname':_0x560d39['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x560d39[_0x8a27('0x23')],'transfereeconnectedlinename':_0x560d39['transfertargetconnectedlinename'],'transfereeaccountcode':_0x560d39[_0x8a27('0x24')],'transfereecontext':_0x560d39[_0x8a27('0x25')],'transfereeexten':_0x560d39[_0x8a27('0x26')],'transfereelinkedid':_0x560d39[_0x8a27('0x27')],'isexternal':_0x560d39['isexternal'],'context':_0x560d39[_0x8a27('0x28')],'extension':_0x560d39[_0x8a27('0x29')],'type':_0x8a27('0x2a')},'log':_0x8a27('0x4')});}; \ No newline at end of file +var _0x5450=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x2fbd6c,_0x525c9f){var _0x27dd1d=function(_0x20be17){while(--_0x20be17){_0x2fbd6c['push'](_0x2fbd6c['shift']());}};_0x27dd1d(++_0x525c9f);}(_0x5450,0x1a1));var _0x0545=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x5450[_0x28947d];return _0x12d2ee;};'use strict';var client=require('../client');exports[_0x0545('0x0')]={};exports['blindTransfer']=function(_0xa24eae){return client[_0x0545('0x1')](_0x0545('0x2'),{'body':{'result':_0xa24eae[_0x0545('0x3')],'transfererchannel':_0xa24eae[_0x0545('0x4')],'transferercalleridnum':_0xa24eae[_0x0545('0x5')],'transferercalleridname':_0xa24eae[_0x0545('0x6')],'transfererconnectedlinenum':_0xa24eae[_0x0545('0x7')],'transfererconnectedlinename':_0xa24eae[_0x0545('0x8')],'transfereraccountcode':_0xa24eae[_0x0545('0x9')],'transferercontext':_0xa24eae['transferercontext'],'transfererexten':_0xa24eae[_0x0545('0xa')],'transfererlinkedid':_0xa24eae[_0x0545('0xb')],'transfereechannel':_0xa24eae[_0x0545('0xc')],'transfereecalleridnum':_0xa24eae['transfereecalleridnum'],'transfereecalleridname':_0xa24eae[_0x0545('0xd')],'transfereeconnectedlinenum':_0xa24eae[_0x0545('0xe')],'transfereeconnectedlinename':_0xa24eae[_0x0545('0xf')],'transfereeaccountcode':_0xa24eae[_0x0545('0x10')],'transfereecontext':_0xa24eae[_0x0545('0x11')],'transfereeexten':_0xa24eae[_0x0545('0x12')],'transfereelinkedid':_0xa24eae['transfereelinkedid'],'isexternal':_0xa24eae[_0x0545('0x13')],'context':_0xa24eae[_0x0545('0x14')],'extension':_0xa24eae[_0x0545('0x15')],'type':_0x0545('0x16')},'log':_0x0545('0x2')});};exports[_0x0545('0x17')]=function(_0x355f36){return client[_0x0545('0x1')](_0x0545('0x2'),{'body':{'result':_0x355f36['result'],'transfererchannel':_0x355f36[_0x0545('0x18')],'transferercalleridnum':_0x355f36[_0x0545('0x19')],'transferercalleridname':_0x355f36[_0x0545('0x1a')],'transfererconnectedlinenum':_0x355f36[_0x0545('0x1b')],'transfererconnectedlinename':_0x355f36[_0x0545('0x1c')],'transfereraccountcode':_0x355f36[_0x0545('0x1d')],'transferercontext':_0x355f36['secondtransferercontext'],'transfererexten':_0x355f36[_0x0545('0x1e')],'transfererlinkedid':_0x355f36[_0x0545('0x1f')],'transfereechannel':_0x355f36[_0x0545('0x20')],'transfereecalleridnum':_0x355f36[_0x0545('0x21')],'transfereecalleridname':_0x355f36[_0x0545('0x22')],'transfereeconnectedlinenum':_0x355f36[_0x0545('0x23')],'transfereeconnectedlinename':_0x355f36[_0x0545('0x24')],'transfereeaccountcode':_0x355f36[_0x0545('0x25')],'transfereecontext':_0x355f36['transfertargetcontext'],'transfereeexten':_0x355f36[_0x0545('0x26')],'transfereelinkedid':_0x355f36[_0x0545('0x27')],'isexternal':_0x355f36[_0x0545('0x13')],'context':_0x355f36[_0x0545('0x28')],'extension':_0x355f36['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b324959..489252e 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(_0x4db256,_0x381557){var _0x4637e0=function(_0x4fe59d){while(--_0x4fe59d){_0x4db256['push'](_0x4db256['shift']());}};_0x4637e0(++_0x381557);}(_0x7a54,0x106));var _0x47a5=function(_0x1bddef,_0x8d2730){_0x1bddef=_0x1bddef-0x0;var _0x4e1c79=_0x7a54[_0x1bddef];return _0x4e1c79;};'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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3c50bf,_0x324d62){var _0x3e0ad9=function(_0x355ae8){while(--_0x355ae8){_0x3c50bf['push'](_0x3c50bf['shift']());}};_0x3e0ad9(++_0x324d62);}(_0xb10b,0x12a));var _0xbb10=function(_0x461b52,_0x20b9ed){_0x461b52=_0x461b52-0x0;var _0x2c3811=_0xb10b[_0x461b52];return _0x2c3811;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 96f2bd1..aa6e34a 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 _0x4c65=['format','trigger:%s','action','toLowerCase','merge','length','lodash','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','isNil','data5','xmd-contactid','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','ListId','scheduledAt','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s'];(function(_0x17024e,_0x23893a){var _0x409487=function(_0x6f425){while(--_0x6f425){_0x17024e['push'](_0x17024e['shift']());}};_0x409487(++_0x23893a);}(_0x4c65,0x74));var _0x54c6=function(_0x3a63b2,_0x44cac5){_0x3a63b2=_0x3a63b2-0x0;var _0x15a478=_0x4c65[_0x3a63b2];return _0x15a478;};'use strict';var _=require(_0x54c6('0x0'));var BPromise=require('bluebird');var Redis=require(_0x54c6('0x1'));var util=require('util');var config=require(_0x54c6('0x2'));var logger=require('../../../../config/logger')(_0x54c6('0x3'));var cmContactRpc=require(_0x54c6('0x4'));config[_0x54c6('0x5')]=_[_0x54c6('0x6')](config[_0x54c6('0x5')],{'host':_0x54c6('0x7'),'port':0x18eb});var io=require(_0x54c6('0x8'))(new Redis(config['redis']));function emit(_0x2a37bd,_0x2ae7c6,_0x5262b8,_0x5158a7,_0x1f6007){logger[_0x54c6('0x9')](_0x54c6('0xa'),_0x2a37bd,_0x2ae7c6['id'],_0x5262b8,_0x5158a7,JSON[_0x54c6('0xb')](_0x1f6007));io['to'](_0x5262b8)[_0x54c6('0xc')](_0x5158a7,_0x1f6007);}exports[_0x54c6('0xd')]=function(_0x4813a9,_0x4e31c2,_0x1fcae9,_0x4f1c5d){var _0x1b73fa,_0x5848e8;var _0x54c253={};var _0x2f63cd;var _0x5da48=Number(_0x1fcae9[_0x54c6('0xe')]);var _0x4ba3ff=_0x1fcae9['data2']?Boolean(Number(_0x1fcae9['data2'])):![];var _0x79d811;var _0x2eca25=![];if(!_[_0x54c6('0xf')](_0x1fcae9[_0x54c6('0x10')])){if(_0x1fcae9[_0x54c6('0x10')]=='1')_0x2eca25=!![];}if(!_0x2eca25){if(_0x4f1c5d['xmd-contactid']){_0x54c253['id']=_0x4f1c5d[_0x54c6('0x11')];}}if(!_0x54c253['id']){_0x54c253['ListId']=_0x5da48;_0x79d811=_0x1fcae9[_0x54c6('0x12')]&&_0x1fcae9[_0x54c6('0x12')]!=='0'?_0x1fcae9[_0x54c6('0x12')][_0x54c6('0x13')](','):[_0x54c6('0x14')];_0x54c253[_0x54c6('0x15')]=_[_0x54c6('0x16')](_0x79d811,function(_0x4d6b54){var _0x24d7a2={};_0x24d7a2[_0x4d6b54]=_0x4f1c5d['routeId']?_0x4f1c5d[_0x54c6('0x17')]:_0x4f1c5d[_0x54c6('0x18')];return _0x24d7a2;});_0x2f63cd=_0x4f1c5d[_0x54c6('0x19')]?_0x4f1c5d['destcalleridnum']:_0x4f1c5d[_0x54c6('0x18')];}var _0x38bee8=['id',_0x54c6('0x1a'),_0x54c6('0x1b'),_0x54c6('0x14'),_0x54c6('0x1c'),'fax',_0x54c6('0x1d'),'createdAt',_0x54c6('0x1e'),'updatedAt'];var _0x3c053b=_['union'](_0x38bee8,_0x79d811);BPromise[_0x54c6('0x1f')]()[_0x54c6('0x20')](cmContactRpc[_0x54c6('0x21')]({'attributes':_0x3c053b,'where':_0x54c253,'phone':_0x2f63cd}))[_0x54c6('0x20')](function(_0x30dc9b){_0x5848e8=_0x30dc9b;if(!_[_0x54c6('0x22')](_0x5848e8)){if(_0x5848e8['length']===0x1){_0x1b73fa=_0x5848e8[0x0];logger[_0x54c6('0x9')](_0x54c6('0x23'),_0x4f1c5d[_0x54c6('0x24')],_0x4e31c2['id'],_0x1b73fa['id']);}else{logger[_0x54c6('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4f1c5d[_0x54c6('0x24')],_0x4e31c2['id'],_['map'](_0x5848e8,'id')[_0x54c6('0x25')](','));}return;}else{logger[_0x54c6('0x9')](_0x54c6('0x26'),_0x4f1c5d['uniqueid'],_0x4e31c2['id']);var _0x3f8911={'ListId':_0x5da48};var _0x109e47=_0x1fcae9[_0x54c6('0x27')]&&_0x1fcae9[_0x54c6('0x27')]!=='0'?_0x1fcae9[_0x54c6('0x27')]:_0x54c6('0x14');if(_0x4ba3ff){logger[_0x54c6('0x9')](_0x54c6('0x28'),_0x4f1c5d['uniqueid'],_0x4e31c2['id']);_0x3f8911[_0x109e47]=_[_0x54c6('0xf')](_0x4f1c5d['routeId'])?_0x4f1c5d[_0x54c6('0x18')]:_0x4f1c5d[_0x54c6('0x17')];if(_[_0x54c6('0xf')](_0x4f1c5d[_0x54c6('0x19')])){_0x3f8911['firstName']=_0x4f1c5d[_0x54c6('0x29')]&&_0x4f1c5d[_0x54c6('0x29')]!==_0x54c6('0x2a')?_0x4f1c5d[_0x54c6('0x29')]:_0x54c6('0x2b');}else{_0x3f8911['firstName']=_0x4f1c5d[_0x54c6('0x2c')]&&_0x4f1c5d[_0x54c6('0x2c')]!==_0x54c6('0x2a')?_0x4f1c5d['destcalleridname']:_0x54c6('0x2b');}return BPromise[_0x54c6('0x1f')]()[_0x54c6('0x20')](cmContactRpc[_0x54c6('0x2d')](_0x3f8911))[_0x54c6('0x20')](function(_0x28f18c){_0x1b73fa=_0x28f18c;_0x5848e8[_0x54c6('0x2e')](_0x28f18c);if(_0x1b73fa){logger[_0x54c6('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4f1c5d[_0x54c6('0x24')],_0x4e31c2['id'],_0x1b73fa['id']);}return;});}else{logger[_0x54c6('0x9')](_0x54c6('0x2f'),_0x4f1c5d[_0x54c6('0x24')],_0x4e31c2['id']);_0x3f8911[_0x109e47]=_[_0x54c6('0xf')](_0x4f1c5d['routeId'])?_0x4f1c5d[_0x54c6('0x18')]:_0x4f1c5d['destcalleridnum'];if(_[_0x54c6('0xf')](_0x4f1c5d[_0x54c6('0x19')])){_0x3f8911[_0x54c6('0x1a')]=_0x4f1c5d[_0x54c6('0x29')]&&_0x4f1c5d[_0x54c6('0x29')]!==_0x54c6('0x2a')?_0x4f1c5d[_0x54c6('0x29')]:_0x54c6('0x2b');}else{_0x3f8911[_0x54c6('0x1a')]=_0x4f1c5d['destcalleridname']&&_0x4f1c5d[_0x54c6('0x2c')]!==_0x54c6('0x2a')?_0x4f1c5d[_0x54c6('0x2c')]:_0x54c6('0x2b');}_0x1b73fa=_0x3f8911;_0x5848e8['push'](_0x3f8911);return;}}})['then'](function(){if(_0x4813a9){emit(_0x4f1c5d[_0x54c6('0x24')],_0x4e31c2,util['format'](_0x54c6('0x30'),_0x4813a9['name']),util[_0x54c6('0x31')](_0x54c6('0x32'),_0x1fcae9[_0x54c6('0x33')][_0x54c6('0x34')]()),{'evt':_[_0x54c6('0x35')](_0x4f1c5d,{'autoCreate':_0x4ba3ff}),'contact':_0x1b73fa===undefined?{}:_0x1b73fa,'contacts':_0x5848e8[_0x54c6('0x36')]===0x0?undefined:_0x5848e8});}});}; \ No newline at end of file +var _0x8d30=['uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','toLowerCase','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','data5','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','then','length','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x495bc6,_0x3b192d){var _0x4aaa1d=function(_0x7fda46){while(--_0x7fda46){_0x495bc6['push'](_0x495bc6['shift']());}};_0x4aaa1d(++_0x3b192d);}(_0x8d30,0x7d));var _0x08d3=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x8d30[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x08d3('0x0'));var BPromise=require(_0x08d3('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x08d3('0x2'));var logger=require(_0x08d3('0x3'))(_0x08d3('0x4'));var cmContactRpc=require(_0x08d3('0x5'));config['redis']=_['defaults'](config[_0x08d3('0x6')],{'host':_0x08d3('0x7'),'port':0x18eb});var io=require(_0x08d3('0x8'))(new Redis(config[_0x08d3('0x6')]));function emit(_0xfe2ce,_0x26dbe8,_0x3024d5,_0xaeb3cb,_0x449cf7){logger['info'](_0x08d3('0x9'),_0xfe2ce,_0x26dbe8['id'],_0x3024d5,_0xaeb3cb,JSON[_0x08d3('0xa')](_0x449cf7));io['to'](_0x3024d5)[_0x08d3('0xb')](_0xaeb3cb,_0x449cf7);}exports['exec']=function(_0x30bee1,_0xa87b50,_0x2956be,_0x5a19f4){var _0x13453c,_0x1ee30d;var _0x1b492a={};var _0x211e74;var _0x482749=Number(_0x2956be[_0x08d3('0xc')]);var _0x7a8f19=_0x2956be[_0x08d3('0xd')]?Boolean(Number(_0x2956be[_0x08d3('0xd')])):![];var _0x1a531b;var _0x40adfa=![];if(!_['isNil'](_0x2956be[_0x08d3('0xe')])){if(_0x2956be[_0x08d3('0xe')]=='1')_0x40adfa=!![];}if(!_0x40adfa){if(_0x5a19f4['xmd-contactid']){_0x1b492a['id']=_0x5a19f4['xmd-contactid'];}}if(!_0x1b492a['id']){_0x1b492a['ListId']=_0x482749;_0x1a531b=_0x2956be['data3']&&_0x2956be[_0x08d3('0xf')]!=='0'?_0x2956be[_0x08d3('0xf')][_0x08d3('0x10')](','):[_0x08d3('0x11')];_0x1b492a[_0x08d3('0x12')]=_[_0x08d3('0x13')](_0x1a531b,function(_0x59e153){var _0xfd0636={};_0xfd0636[_0x59e153]=_0x5a19f4[_0x08d3('0x14')]?_0x5a19f4[_0x08d3('0x15')]:_0x5a19f4['calleridnum'];return _0xfd0636;});_0x211e74=_0x5a19f4[_0x08d3('0x14')]?_0x5a19f4[_0x08d3('0x15')]:_0x5a19f4[_0x08d3('0x16')];}var _0x29ef81=['id',_0x08d3('0x17'),_0x08d3('0x18'),_0x08d3('0x11'),_0x08d3('0x19'),_0x08d3('0x1a'),_0x08d3('0x1b'),_0x08d3('0x1c'),_0x08d3('0x1d'),_0x08d3('0x1e')];var _0x92d671=_[_0x08d3('0x1f')](_0x29ef81,_0x1a531b);BPromise['resolve']()[_0x08d3('0x20')](cmContactRpc['getContacts']({'attributes':_0x92d671,'where':_0x1b492a,'phone':_0x211e74}))[_0x08d3('0x20')](function(_0x1cc2e9){_0x1ee30d=_0x1cc2e9;if(!_['isEmpty'](_0x1ee30d)){if(_0x1ee30d[_0x08d3('0x21')]===0x1){_0x13453c=_0x1ee30d[0x0];logger[_0x08d3('0x22')](_0x08d3('0x23'),_0x5a19f4['uniqueid'],_0xa87b50['id'],_0x13453c['id']);}else{logger['info'](_0x08d3('0x24'),_0x5a19f4[_0x08d3('0x25')],_0xa87b50['id'],_[_0x08d3('0x13')](_0x1ee30d,'id')[_0x08d3('0x26')](','));}return;}else{logger[_0x08d3('0x22')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x5a19f4[_0x08d3('0x25')],_0xa87b50['id']);var _0x5151c4={'ListId':_0x482749};var _0x300dd8=_0x2956be[_0x08d3('0x27')]&&_0x2956be['data4']!=='0'?_0x2956be[_0x08d3('0x27')]:_0x08d3('0x11');if(_0x7a8f19){logger[_0x08d3('0x22')](_0x08d3('0x28'),_0x5a19f4[_0x08d3('0x25')],_0xa87b50['id']);_0x5151c4[_0x300dd8]=_[_0x08d3('0x29')](_0x5a19f4[_0x08d3('0x14')])?_0x5a19f4[_0x08d3('0x16')]:_0x5a19f4[_0x08d3('0x15')];if(_[_0x08d3('0x29')](_0x5a19f4[_0x08d3('0x14')])){_0x5151c4['firstName']=_0x5a19f4[_0x08d3('0x2a')]&&_0x5a19f4[_0x08d3('0x2a')]!==_0x08d3('0x2b')?_0x5a19f4[_0x08d3('0x2a')]:_0x08d3('0x2c');}else{_0x5151c4['firstName']=_0x5a19f4[_0x08d3('0x2d')]&&_0x5a19f4[_0x08d3('0x2d')]!==_0x08d3('0x2b')?_0x5a19f4[_0x08d3('0x2d')]:'Unknown';}return BPromise[_0x08d3('0x2e')]()['then'](cmContactRpc['createContact'](_0x5151c4))[_0x08d3('0x20')](function(_0x1ef91b){_0x13453c=_0x1ef91b;_0x1ee30d[_0x08d3('0x2f')](_0x1ef91b);if(_0x13453c){logger[_0x08d3('0x22')](_0x08d3('0x30'),_0x5a19f4[_0x08d3('0x25')],_0xa87b50['id'],_0x13453c['id']);}return;});}else{logger['info'](_0x08d3('0x31'),_0x5a19f4['uniqueid'],_0xa87b50['id']);_0x5151c4[_0x300dd8]=_[_0x08d3('0x29')](_0x5a19f4[_0x08d3('0x14')])?_0x5a19f4['calleridnum']:_0x5a19f4['destcalleridnum'];if(_[_0x08d3('0x29')](_0x5a19f4[_0x08d3('0x14')])){_0x5151c4['firstName']=_0x5a19f4['calleridname']&&_0x5a19f4[_0x08d3('0x2a')]!==''?_0x5a19f4[_0x08d3('0x2a')]:_0x08d3('0x2c');}else{_0x5151c4[_0x08d3('0x17')]=_0x5a19f4[_0x08d3('0x2d')]&&_0x5a19f4[_0x08d3('0x2d')]!==_0x08d3('0x2b')?_0x5a19f4[_0x08d3('0x2d')]:'Unknown';}_0x13453c=_0x5151c4;_0x1ee30d[_0x08d3('0x2f')](_0x5151c4);return;}}})[_0x08d3('0x20')](function(){if(_0x30bee1){emit(_0x5a19f4[_0x08d3('0x25')],_0xa87b50,util[_0x08d3('0x32')]('user:%s',_0x30bee1[_0x08d3('0x33')]),util[_0x08d3('0x32')](_0x08d3('0x34'),_0x2956be['action'][_0x08d3('0x35')]()),{'evt':_['merge'](_0x5a19f4,{'autoCreate':_0x7a8f19}),'contact':_0x13453c===undefined?{}:_0x13453c,'contacts':_0x1ee30d[_0x08d3('0x21')]===0x0?undefined:_0x1ee30d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a6a0769..33536ac 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 _0x6a9f=['custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','interface','toLowerCase','contactmanager','motionbar','browser','TemplateId','html','data2','template\x20not\x20found','uri','buildUri','data3','isNil','location','uriLocation','data4','windowWidth','data5','800','600','data6','render','winArguments','format','user:%s','trigger:%s:%s','action','jscripty','name','trigger:%s','data1','exec','integration','queue','routeId','urlforward','script','query','search','channel','AllConditions','length','every','checkConditions','debug','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','agent','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','created','equals','exports','util','lodash','url','mustache','./urlforward','./integration','./script','../../../config/logger','trigger','../ami','defaults','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind'];(function(_0xbba331,_0x2e10df){var _0x465ade=function(_0x3e0666){while(--_0x3e0666){_0xbba331['push'](_0xbba331['shift']());}};_0x465ade(++_0x2e10df);}(_0x6a9f,0x1e0));var _0xf6a9=function(_0x589352,_0x3e3dc9){_0x589352=_0x589352-0x0;var _0x67373b=_0x6a9f[_0x589352];return _0x67373b;};'use strict';var util=require(_0xf6a9('0x0'));var _=require(_0xf6a9('0x1'));var url=require(_0xf6a9('0x2'));var Mustache=require(_0xf6a9('0x3'));var Redis=require('ioredis');var urlforward=require(_0xf6a9('0x4'));var integration=require(_0xf6a9('0x5'));var cmContact=require('./cmContact');var script=require(_0xf6a9('0x6'));var config=require('../../../config/environment');var logger=require(_0xf6a9('0x7'))(_0xf6a9('0x8'));var ami=require(_0xf6a9('0x9'));config['redis']=_[_0xf6a9('0xa')](config[_0xf6a9('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf6a9('0xb')]));var operators={'equals':function(_0x2c9eb9,_0x60608c){return _0x2c9eb9==_0x60608c;},'not_equals':function(_0x420ee5,_0x4b88f4){return _0x420ee5!=_0x4b88f4;}};var barAndWebActions=[_0xf6a9('0xc'),'url',_0xf6a9('0xd')];function Trigger(_0x41e857){this[_0xf6a9('0xe')]=_0x41e857['triggers'];this[_0xf6a9('0xf')]=_0x41e857[_0xf6a9('0xf')];this[_0xf6a9('0x10')]=_0x41e857[_0xf6a9('0x10')];this['templates']=_0x41e857[_0xf6a9('0x11')];this['voiceExtensions']=_0x41e857[_0xf6a9('0x12')];this[_0xf6a9('0x13')]=_0x41e857[_0xf6a9('0x13')];this[_0xf6a9('0x14')]=_0x41e857['freshdeskAccounts'];this[_0xf6a9('0x15')]=_0x41e857[_0xf6a9('0x15')];this[_0xf6a9('0x16')]=_0x41e857['sugarcrmAccounts'];this[_0xf6a9('0x17')]=_0x41e857['zohoAccounts'];this[_0xf6a9('0x18')]=_0x41e857[_0xf6a9('0x18')];this[_0xf6a9('0x19')]=_0x41e857[_0xf6a9('0x19')];this[_0xf6a9('0x1a')]=_0x41e857[_0xf6a9('0x1a')];this['dynamics365Accounts']=_0x41e857[_0xf6a9('0x1b')];this[_0xf6a9('0x1c')]=_0x41e857[_0xf6a9('0x1c')];this[_0xf6a9('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xf6a9('0x15')],'freshdesk':this[_0xf6a9('0x14')],'sugarcrm':this[_0xf6a9('0x16')],'zoho':this[_0xf6a9('0x17')],'desk':this[_0xf6a9('0x18')],'vtiger':this[_0xf6a9('0x19')],'dynamics365':this[_0xf6a9('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xf6a9('0x1a')]};ami['on']('custom:agentcalled',this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x20'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x21'),this['syncCustomEvent']['bind'](this));ami['on'](_0xf6a9('0x22'),this[_0xf6a9('0x1e')]['bind'](this));ami['on'](_0xf6a9('0x23'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x24'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on']('custom:agentcongestion',this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x25'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x26'),this['syncCustomEvent'][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x27'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on']('custom:timeout',this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on']('custom:dialbegin',this[_0xf6a9('0x28')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x29'),this[_0xf6a9('0x28')]['bind'](this));ami['on'](_0xf6a9('0x2a'),this['syncAgentDial']['bind'](this));ami['on'](_0xf6a9('0x2b'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x2c'),this[_0xf6a9('0x1e')]['bind'](this));ami['on'](_0xf6a9('0x2d'),this['syncCustomEvent'][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x2e'),this[_0xf6a9('0x1e')]['bind'](this));ami['on'](_0xf6a9('0x2f'),this[_0xf6a9('0x1e')]['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x30'),this[_0xf6a9('0x1e')][_0xf6a9('0x1f')](this));ami['on'](_0xf6a9('0x31'),this['syncCustomEvent']['bind'](this));}Trigger[_0xf6a9('0x32')][_0xf6a9('0x33')]=function(_0x59a867,_0x3d35da,_0x57a1f2){logger[_0xf6a9('0x34')](_0x59a867,_0x3d35da,JSON[_0xf6a9('0x35')](_0x57a1f2));io['to'](_0x59a867)[_0xf6a9('0x33')](_0x3d35da,_0x57a1f2);};Trigger[_0xf6a9('0x32')][_0xf6a9('0x1e')]=function(_0x2b55c5){var _0x58ad9e=_[_0xf6a9('0x36')](_0x2b55c5);if(typeof _0x58ad9e[_0xf6a9('0x37')]==='undefined'){_0x58ad9e[_0xf6a9('0x37')]='voice';}logger['debug'](_0xf6a9('0x1e'),util[_0xf6a9('0x38')](_0x58ad9e,{'showHidden':!![],'depth':null}));this[_0xf6a9('0x39')](_0x58ad9e);};Trigger[_0xf6a9('0x32')][_0xf6a9('0x28')]=function(_0x32ff7b){if(this[_0xf6a9('0xf')][_0x32ff7b['interface']]){this['syncCustomEvent'](_0x32ff7b);}};Trigger['prototype'][_0xf6a9('0x39')]=function(_0x12a6bc){var _0x4ed2ef;for(var _0x5f180d in this[_0xf6a9('0xe')]){if(this['triggers'][_0xf6a9('0x3a')](_0x5f180d)){if(this[_0xf6a9('0xe')][_0x5f180d][_0xf6a9('0x3b')]){_0x4ed2ef=this[_0xf6a9('0x3c')](this[_0xf6a9('0xe')][_0x5f180d],_0x12a6bc);if(_0x4ed2ef){_[_0xf6a9('0x3d')](_0x12a6bc,_0x12a6bc['variables']);for(var _0x2eec6f=0x0,_0x540b11,_0x4e09eb,_0x96f16c;_0x2eec6f0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4bb1ad,_0x4094d3){var _0x3c7cfe=function(_0x3efbce){while(--_0x3efbce){_0x4bb1ad['push'](_0x4bb1ad['shift']());}};_0x3c7cfe(++_0x4094d3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 e3fbbdd..2c1d3a6 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 _0xdfa2=['internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','outbound','destcalleridnum','contacts','/systemusers(','body','headers','lastIndexOf','calleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','value','length','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','forEach','string','nameField','customField','toLowerCase','substring','indexOf','content','ticketType','incident','assign','getString','Subjects','/contacts(','Fields','phonecall','queue','phonecalls','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','none','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xdfa2,0x1e7));var _0x2dfa=function(_0x174c58,_0x28ba05){_0x174c58=_0x174c58-0x0;var _0x12497c=_0xdfa2[_0x174c58];return _0x12497c;};'use strict';var _=require('lodash');var rp=require(_0x2dfa('0x0'));var util=require(_0x2dfa('0x1'));var intUtil=require(_0x2dfa('0x2'));var md5=require('md5');var Redis=require(_0x2dfa('0x3'));var logger=require(_0x2dfa('0x4'))('dynamics365');var config=require(_0x2dfa('0x5'));config['redis']=_[_0x2dfa('0x6')](config[_0x2dfa('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2dfa('0x8'))(new Redis(config[_0x2dfa('0x7')]));function getAuthToken(_0x2d6deb,_0xbfd672,_0x4b1ac2){if(_0x2d6deb[_0x2dfa('0x9')]){_0x2d6deb[_0x2dfa('0xa')]=_0x2d6deb[_0x2dfa('0xb')]['data7'];_0x2d6deb[_0x2dfa('0xc')]=_0x2d6deb[_0x2dfa('0xb')][_0x2dfa('0xd')];return Promise[_0x2dfa('0xe')](_0x2d6deb[_0x2dfa('0xb')][_0x2dfa('0xf')]);}var _0x446523={'method':_0x2dfa('0x10'),'uri':_0xbfd672,'form':{'client_id':_0x2d6deb['clientId'],'resource':_0x2d6deb[_0x2dfa('0xa')],'username':_0x2d6deb[_0x2dfa('0x11')],'password':_0x2d6deb[_0x2dfa('0x12')],'grant_type':_0x2dfa('0x12'),'client_secret':_0x2d6deb['clientSecret']},'json':!![]};return rp(_0x446523)[_0x2dfa('0x13')](function(_0x60d5e5){return _0x60d5e5[_0x2dfa('0x14')];})[_0x2dfa('0x15')](function(_0x40481c){logger[_0x2dfa('0x16')]('['+[_0x4b1ac2[_0x2dfa('0x17')]()]+_0x2dfa('0x18'));return _0x40481c[_0x2dfa('0x19')];});}function getUser(_0x1769ed,_0x1d3d3c,_0x475b80,_0x3abe0e,_0x28947d,_0x544872){return new Promise(function(_0x4d0727,_0x1a4cdb){return getAuthToken(_0x1d3d3c,_0x3abe0e,_0x544872)[_0x2dfa('0x13')](function(_0x56c37a){var _0x50b82a={'method':_0x2dfa('0x1a'),'uri':_0x28947d+_0x2dfa('0x1b'),'headers':{'Authorization':_0x2dfa('0x1c')+_0x56c37a,'OData-Version':_0x2dfa('0x1d')},'json':!![]};return rp(_0x50b82a);})[_0x2dfa('0x13')](function(_0x5d335a){var _0x3a6fa5=_0x5d335a['value'];var _0x26c763=![];var _0x1c7032=null;if(!_[_0x2dfa('0x1e')](_0x475b80)){if(intUtil[_0x2dfa('0x1f')](_0x475b80['email'])){_0x1769ed['userEmail']=_0x475b80[_0x2dfa('0x20')];for(_0x1c7032=0x0;_0x1c7032<_0x3a6fa5['length'];_0x1c7032++){if(_0x3a6fa5[_0x1c7032][_0x2dfa('0x21')]===_0x475b80[_0x2dfa('0x20')]&&!_0x3a6fa5[_0x1c7032][_0x2dfa('0x22')]){_0x26c763=!![];logger['info']('['+[_0x544872[_0x2dfa('0x17')]()]+_0x2dfa('0x23')+_0x3a6fa5[_0x1c7032][_0x2dfa('0x24')]+'!');_0x1769ed[_0x2dfa('0x25')]=_0x3a6fa5[_0x1c7032][_0x2dfa('0x24')];}}}}if(!_0x26c763){logger[_0x2dfa('0x26')]('['+[_0x544872['toUpperCase']()]+_0x2dfa('0x27'));_0x1769ed[_0x2dfa('0x28')]=_0x1d3d3c[_0x2dfa('0x11')];for(_0x1c7032=0x0;_0x1c7032<_0x3a6fa5['length'];_0x1c7032++){if(_0x3a6fa5[_0x1c7032][_0x2dfa('0x21')]===_0x1d3d3c[_0x2dfa('0x11')]){_0x1769ed[_0x2dfa('0x25')]=_0x3a6fa5[_0x1c7032][_0x2dfa('0x24')];}}}_0x4d0727(_0x1769ed);})['catch'](function(_0x26475f){_0x1a4cdb(_0x26475f[_0x2dfa('0x19')]);});});}function createEndUser(_0x1f9095,_0x2e99da,_0x37eb76,_0x28f317,_0x39279b,_0x234bb1,_0x5b380c){return new Promise(function(_0x5220dc,_0x2738c0){return getAuthToken(_0x2e99da,_0x37eb76,_0x234bb1)[_0x2dfa('0x13')](function(_0x58547f){var _0x429e72=_0x234bb1['toLowerCase']()===_0x2dfa('0x29')?_0x39279b[_0x2dfa('0x2a')]:_0x39279b['calleridnum'];var _0x2acc74={'method':'POST','uri':_0x28f317+_0x2dfa('0x2b'),'body':{'fullname':_0x429e72,'firstname':_0x429e72,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2dfa('0x2c')+_0x1f9095[_0x2dfa('0x25')]+')'},'headers':{'Authorization':_0x2dfa('0x1c')+_0x58547f,'OData-Version':_0x2dfa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x2acc74[_0x2dfa('0x2d')][_0x5b380c]=_0x429e72;return rp(_0x2acc74);})[_0x2dfa('0x13')](function(_0x5b65e2){var _0x2517a2=_0x5b65e2[_0x2dfa('0x2e')]['odata-entityid'];var _0x70748e=_0x2517a2['substring'](_0x2517a2[_0x2dfa('0x2f')]('(')+0x1,_0x2517a2[_0x2dfa('0x2f')](')'));_0x1f9095['enduserId']=_0x70748e;_0x5220dc(_0x1f9095);})['catch'](function(_0x4c1735){_0x2738c0(_0x4c1735[_0x2dfa('0x19')]);});});}function getEndUser(_0x225f7e,_0x4fcea6,_0xe3e37e,_0x48a64a,_0x378692,_0x55aedc,_0x43466c,_0x4c2139){var _0xcbca62=_0x55aedc['toLowerCase']()==='outbound'?_0x378692[_0x2dfa('0x2a')]:_0x378692[_0x2dfa('0x30')];return getAuthToken(_0x4fcea6,_0xe3e37e,_0x55aedc)[_0x2dfa('0x13')](function(_0x40b8a7){_0x4c2139=_0x4c2139?_0x4c2139:_0x2dfa('0x31');var _0x543f60={'method':_0x2dfa('0x1a'),'uri':_0x48a64a+'contacts?$select='+_0x4c2139+_0x2dfa('0x32')+_0x4c2139+_0x2dfa('0x33')+_0xcbca62[_0x2dfa('0x34')]('+',_0x2dfa('0x35'))+'\x27','headers':{'Authorization':_0x2dfa('0x1c')+_0x40b8a7,'If-None-Match':null,'OData-Version':_0x2dfa('0x1d')},'json':!![]};return rp(_0x543f60);})[_0x2dfa('0x13')](function(_0x19c508){var _0x3654c3=![];if(!_0x19c508)return _0x3654c3;var _0x35cea5=_0x19c508[_0x2dfa('0x36')];for(var _0x2a3411=0x0;_0x2a3411<_0x35cea5[_0x2dfa('0x37')];_0x2a3411++){if(_0x35cea5[_0x2a3411][_0x4c2139]===_0xcbca62){_0x3654c3=!![];_0x225f7e['enduserId']=_0x35cea5[_0x2a3411]['contactid'];}}return _0x3654c3;})['then'](function(_0x3734dd){if(_0x3734dd)return _0x225f7e;if(_0x43466c===_0x2dfa('0x38')){logger[_0x2dfa('0x26')]('['+[_0x55aedc[_0x2dfa('0x17')]()]+_0x2dfa('0x39'));return _0x225f7e;}return createEndUser(_0x225f7e,_0x4fcea6,_0xe3e37e,_0x48a64a,_0x378692,_0x55aedc,_0x4c2139)[_0x2dfa('0x13')](function(_0x4541b8){logger[_0x2dfa('0x26')]('['+[_0x55aedc['toUpperCase']()]+_0x2dfa('0x3a'),_0x4541b8[_0x2dfa('0x3b')]);return _0x4541b8;});});}function getCustomFields(_0x5740d2,_0x4d1038,_0x3e0c37){var _0x36f4c4={};if(_0x5740d2[_0x2dfa('0x37')]>0x0){_[_0x2dfa('0x3c')](_0x5740d2,function(_0x2e1af8){if(_['includes']([_0x2dfa('0x3d'),'picklist'],_0x2e1af8['type'])&&_0x2e1af8[_0x2dfa('0x3e')]&&!_0x2e1af8[_0x2dfa('0x3f')]){var _0x7db6c9=_0x2e1af8['idField'][_0x2dfa('0x40')]();var _0x7d9a56=_0x7db6c9[_0x2dfa('0x41')](0x0,_0x7db6c9[_0x2dfa('0x42')]('_'));var _0x26209f=_0x7db6c9[_0x2dfa('0x41')](_0x7db6c9['indexOf']('_')+0x1);if(_0x7d9a56===_0x3e0c37){_0x36f4c4[_0x26209f]=_0x2e1af8[_0x2dfa('0x43')];}}});}return _0x36f4c4;}function getTicket(_0x1b1f42,_0x19986b,_0xfcb6a2,_0x3b27d3,_0x49d46f,_0x51ff4f,_0x30bc39){return new Promise(function(_0x5f48b2,_0x1e28b3){var _0x17f1db;return getAuthToken(_0x19986b,_0xfcb6a2,_0x30bc39)[_0x2dfa('0x13')](function(_0x55aa37){if(_0x51ff4f[_0x2dfa('0x44')]===_0x2dfa('0x45')){_0x17f1db={'method':_0x2dfa('0x10'),'uri':_0x3b27d3+'incidents','body':Object[_0x2dfa('0x46')]({},{'title':intUtil[_0x2dfa('0x47')](_0x51ff4f[_0x2dfa('0x48')],_0x49d46f,'\x20'),'description':intUtil[_0x2dfa('0x47')](_0x51ff4f['Descriptions'],_0x49d46f,'\x0a'),'customerid_contact@odata.bind':_0x1b1f42[_0x2dfa('0x3b')]?_0x2dfa('0x49')+_0x1b1f42[_0x2dfa('0x3b')]+')':undefined,'ownerid@odata.bind':_0x2dfa('0x2c')+_0x1b1f42['userId']+')','caseorigincode':'1'},getCustomFields(_0x51ff4f[_0x2dfa('0x4a')],_0x49d46f,_0x51ff4f[_0x2dfa('0x44')])),'headers':{'Authorization':_0x2dfa('0x1c')+_0x55aa37,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x51ff4f['ticketType']===_0x2dfa('0x4b')){var _0x661b7b=_0x1b1f42[_0x2dfa('0x3b')]?[{'partyid_systemuser@odata.bind':_0x2dfa('0x2c')+_0x1b1f42[_0x2dfa('0x25')]+')','participationtypemask':_0x1b1f42['callDirection']===_0x2dfa('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x2dfa('0x49')+_0x1b1f42[_0x2dfa('0x3b')]+')','participationtypemask':_0x1b1f42['callDirection']===_0x2dfa('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x2dfa('0x2c')+_0x1b1f42[_0x2dfa('0x25')]+')','participationtypemask':_0x1b1f42['callDirection']==='queue'?0x2:0x1}];_0x17f1db={'method':_0x2dfa('0x10'),'uri':_0x3b27d3+_0x2dfa('0x4d'),'body':Object[_0x2dfa('0x46')]({},{'subject':intUtil[_0x2dfa('0x47')](_0x51ff4f[_0x2dfa('0x48')],_0x49d46f,'\x20'),'phonenumber':String(_0x49d46f[_0x2dfa('0x30')]),'description':intUtil[_0x2dfa('0x47')](_0x51ff4f['Descriptions'],_0x49d46f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1b1f42[_0x2dfa('0x3b')]?_0x2dfa('0x49')+_0x1b1f42['enduserId']+')':undefined,'ownerid@odata.bind':_0x2dfa('0x2c')+_0x1b1f42[_0x2dfa('0x25')]+')','directioncode':_0x1b1f42['callDirection']===_0x2dfa('0x4c')?![]:!![],'phonecall_activity_parties':_0x661b7b},getCustomFields(_0x51ff4f[_0x2dfa('0x4a')],_0x49d46f,_0x51ff4f[_0x2dfa('0x44')])),'headers':{'Authorization':_0x2dfa('0x1c')+_0x55aa37,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x17f1db);})[_0x2dfa('0x13')](function(_0x1f1fa3){var _0xaf45cf=_0x1f1fa3['headers'][_0x2dfa('0x4e')];var _0x4434ce=_0xaf45cf[_0x2dfa('0x41')](_0xaf45cf['lastIndexOf']('(')+0x1,_0xaf45cf[_0x2dfa('0x2f')](')'));_0x1b1f42[_0x2dfa('0x4f')]=_0x4434ce;_0x5f48b2(_0x1b1f42);})[_0x2dfa('0x15')](function(_0x7c6738){_0x1e28b3(_0x7c6738[_0x2dfa('0x19')]);});});}function emit(_0x3e6351,_0x57955c,_0x30c3c0,_0x20e0be){var _0x5f312d={'uri':util[_0x2dfa('0x50')](_0x2dfa('0x51'),_0x3e6351,_0x30c3c0,_0x20e0be)};io['to'](util[_0x2dfa('0x50')](_0x2dfa('0x52'),_0x57955c))[_0x2dfa('0x53')](_0x2dfa('0x54'),_0x5f312d);}exports['cs']=function(_0x53cf4d,_0x5eec0f,_0x9fe9db,_0x236ea6,_0x41fa5b,_0x4dd839,_0x54ddaa,_0x2ef9d8){var _0x21a9cf={};_0x4dd839[_0x2dfa('0xa')]=_0x4dd839[_0x2dfa('0x9')]?intUtil[_0x2dfa('0x55')](_0x4dd839['CloudProvider']['data7']):intUtil[_0x2dfa('0x55')](_0x4dd839['remoteUri']);_0x4dd839[_0x2dfa('0x56')]=intUtil[_0x2dfa('0x55')](_0x4dd839['serverUrl']);_0x21a9cf['callDirection']=_0x2ef9d8===_0x2dfa('0x4c')||_0x2ef9d8===_0x2dfa('0x57')?_0x2dfa('0x4c'):_0x2dfa('0x29');var _0x20c790=_0x4dd839[_0x2dfa('0x9')]?util[_0x2dfa('0x50')](_0x2dfa('0x58'),_0x4dd839[_0x2dfa('0xb')]['data7']):util[_0x2dfa('0x50')]('%s/api/data/v9.0/',_0x4dd839['remoteUri']);var _0x17366f=util['format'](_0x2dfa('0x59'),_0x4dd839[_0x2dfa('0xc')]);var _0x13598d=util[_0x2dfa('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dd839[_0x2dfa('0x56')],_0x5eec0f[_0x2dfa('0x5a')],md5(_0x5eec0f[_0x2dfa('0x5a')]));if(_0x41fa5b&&_0x41fa5b[_0x2dfa('0x5b')]){logger[_0x2dfa('0x26')](_0x2dfa('0x5c'),'Recording\x20is\x20enabled!');_0x5eec0f['recordingURL']=_0x13598d;}else if(_0x54ddaa&&_0x54ddaa['recordingFormat']&&_0x54ddaa['recordingFormat']!==_0x2dfa('0x5d')){logger[_0x2dfa('0x26')]('[OUTBOUND]',_0x2dfa('0x5e'));_0x5eec0f[_0x2dfa('0x5f')]=_0x13598d;}else{_0x5eec0f['recordingURL']='';}return getUser(_0x21a9cf,_0x4dd839,_0x236ea6,_0x17366f,_0x20c790,_0x2ef9d8)[_0x2dfa('0x13')](function(_0x9526eb){logger['info']('['+_0x2ef9d8[_0x2dfa('0x17')]()+_0x2dfa('0x60'),_0x9526eb[_0x2dfa('0x25')]);logger[_0x2dfa('0x26')]('['+_0x2ef9d8[_0x2dfa('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x9526eb[_0x2dfa('0x28')]);return getEndUser(_0x9526eb,_0x4dd839,_0x17366f,_0x20c790,_0x5eec0f,_0x2ef9d8,_0x9fe9db['moduleCreate'],_0x9fe9db[_0x2dfa('0x61')]);})[_0x2dfa('0x13')](function(_0x3c1783){logger[_0x2dfa('0x26')]('['+_0x2ef9d8[_0x2dfa('0x17')]()+_0x2dfa('0x62'),_0x3c1783[_0x2dfa('0x3b')]);logger[_0x2dfa('0x26')]('['+_0x2ef9d8['toUpperCase']()+_0x2dfa('0x63'),_0x5eec0f[_0x2dfa('0x30')]);return getTicket(_0x3c1783,_0x4dd839,_0x17366f,_0x20c790,_0x5eec0f,_0x9fe9db,_0x2ef9d8);})[_0x2dfa('0x13')](function(_0x40bc02){logger[_0x2dfa('0x26')](util['format']('['+_0x2ef9d8[_0x2dfa('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x9fe9db[_0x2dfa('0x44')],_0x40bc02[_0x2dfa('0x4f')]));logger[_0x2dfa('0x26')](util[_0x2dfa('0x50')]('['+_0x2ef9d8[_0x2dfa('0x17')]()+_0x2dfa('0x64'),_0x2ef9d8));if(_0x2ef9d8!==_0x2dfa('0x57')&&_0x9fe9db['openNewTab']){logger[_0x2dfa('0x26')]('['+_0x2ef9d8[_0x2dfa('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4dd839[_0x2dfa('0xa')],_0x236ea6[_0x2dfa('0x65')],_0x9fe9db[_0x2dfa('0x44')],_0x40bc02[_0x2dfa('0x4f')]);}})['catch'](function(_0x2fbae8){logger[_0x2dfa('0x16')]('['+_0x2ef9d8[_0x2dfa('0x17')]()+_0x2dfa('0x66'),_0x2fbae8[_0x2dfa('0x19')]);console[_0x2dfa('0x16')](_0x2dfa('0x67'),_0x2fbae8);});}; \ No newline at end of file +var _0x1353=['emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%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','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','type','customField','idField','indexOf','content','ticketType','incidents','getString','Subjects','callDirection','queue','/contacts(','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s'];(function(_0x550b7b,_0x3d6314){var _0x451b9f=function(_0x156429){while(--_0x156429){_0x550b7b['push'](_0x550b7b['shift']());}};_0x451b9f(++_0x3d6314);}(_0x1353,0x1cc));var _0x3135=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1353[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x3135('0x0'));var rp=require(_0x3135('0x1'));var util=require(_0x3135('0x2'));var intUtil=require('./util');var md5=require(_0x3135('0x3'));var Redis=require(_0x3135('0x4'));var logger=require('../../../../config/logger')(_0x3135('0x5'));var config=require(_0x3135('0x6'));config[_0x3135('0x7')]=_[_0x3135('0x8')](config['redis'],{'host':_0x3135('0x9'),'port':0x18eb});var io=require(_0x3135('0xa'))(new Redis(config[_0x3135('0x7')]));function getAuthToken(_0x1a2d07,_0x20f8d3,_0x2ed936){if(_0x1a2d07[_0x3135('0xb')]){_0x1a2d07['remoteUri']=_0x1a2d07[_0x3135('0xc')][_0x3135('0xd')];_0x1a2d07[_0x3135('0xe')]=_0x1a2d07[_0x3135('0xc')][_0x3135('0xf')];return Promise[_0x3135('0x10')](_0x1a2d07[_0x3135('0xc')][_0x3135('0x11')]);}var _0x4f0b28={'method':_0x3135('0x12'),'uri':_0x20f8d3,'form':{'client_id':_0x1a2d07[_0x3135('0x13')],'resource':_0x1a2d07[_0x3135('0x14')],'username':_0x1a2d07[_0x3135('0x15')],'password':_0x1a2d07[_0x3135('0x16')],'grant_type':'password','client_secret':_0x1a2d07[_0x3135('0x17')]},'json':!![]};return rp(_0x4f0b28)[_0x3135('0x18')](function(_0x45fb96){return _0x45fb96[_0x3135('0x19')];})[_0x3135('0x1a')](function(_0xd5f2bb){logger[_0x3135('0x1b')]('['+[_0x2ed936['toUpperCase']()]+_0x3135('0x1c'));return _0xd5f2bb[_0x3135('0x1d')];});}function getUser(_0x3f8a1f,_0x551ec7,_0x29baae,_0x3d7235,_0x11a0f8,_0x2d5d46){return new Promise(function(_0x3bf00b,_0x12035b){return getAuthToken(_0x551ec7,_0x3d7235,_0x2d5d46)['then'](function(_0x3c5684){var _0x49f30f={'method':_0x3135('0x1e'),'uri':_0x11a0f8+_0x3135('0x1f'),'headers':{'Authorization':_0x3135('0x20')+_0x3c5684,'OData-Version':_0x3135('0x21')},'json':!![]};return rp(_0x49f30f);})[_0x3135('0x18')](function(_0xac8f2d){var _0x2865b2=_0xac8f2d[_0x3135('0x22')];var _0xaaa674=![];var _0x6a86aa=null;if(!_[_0x3135('0x23')](_0x29baae)){if(intUtil[_0x3135('0x24')](_0x29baae['email'])){_0x3f8a1f[_0x3135('0x25')]=_0x29baae[_0x3135('0x26')];for(_0x6a86aa=0x0;_0x6a86aa<_0x2865b2[_0x3135('0x27')];_0x6a86aa++){if(_0x2865b2[_0x6a86aa][_0x3135('0x28')]===_0x29baae['email']&&!_0x2865b2[_0x6a86aa][_0x3135('0x29')]){_0xaaa674=!![];logger[_0x3135('0x2a')]('['+[_0x2d5d46[_0x3135('0x2b')]()]+_0x3135('0x2c')+_0x2865b2[_0x6a86aa][_0x3135('0x2d')]+'!');_0x3f8a1f[_0x3135('0x2e')]=_0x2865b2[_0x6a86aa][_0x3135('0x2d')];}}}}if(!_0xaaa674){logger[_0x3135('0x2a')]('['+[_0x2d5d46[_0x3135('0x2b')]()]+_0x3135('0x2f'));_0x3f8a1f[_0x3135('0x25')]=_0x551ec7['username'];for(_0x6a86aa=0x0;_0x6a86aa<_0x2865b2[_0x3135('0x27')];_0x6a86aa++){if(_0x2865b2[_0x6a86aa][_0x3135('0x28')]===_0x551ec7['username']){_0x3f8a1f[_0x3135('0x2e')]=_0x2865b2[_0x6a86aa][_0x3135('0x2d')];}}}_0x3bf00b(_0x3f8a1f);})[_0x3135('0x1a')](function(_0x241c1b){_0x12035b(_0x241c1b['message']);});});}function createEndUser(_0x1840fc,_0x58acb4,_0x2b7f13,_0x1a1dc5,_0x4bb3ad,_0x53e1fd,_0x57fcf9){return new Promise(function(_0x2840e2,_0x59bca5){return getAuthToken(_0x58acb4,_0x2b7f13,_0x53e1fd)['then'](function(_0x3b395f){var _0x2ef16f=_0x53e1fd[_0x3135('0x30')]()===_0x3135('0x31')?_0x4bb3ad['destcalleridnum']:_0x4bb3ad[_0x3135('0x32')];var _0x3f4864={'method':_0x3135('0x12'),'uri':_0x1a1dc5+_0x3135('0x33'),'body':{'fullname':_0x2ef16f,'firstname':_0x2ef16f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3135('0x34')+_0x1840fc[_0x3135('0x2e')]+')'},'headers':{'Authorization':_0x3135('0x20')+_0x3b395f,'OData-Version':_0x3135('0x21')},'json':!![],'resolveWithFullResponse':!![]};_0x3f4864['body'][_0x57fcf9]=_0x2ef16f;return rp(_0x3f4864);})[_0x3135('0x18')](function(_0x3f8173){var _0x36cd4e=_0x3f8173[_0x3135('0x35')][_0x3135('0x36')];var _0x2e74e6=_0x36cd4e[_0x3135('0x37')](_0x36cd4e[_0x3135('0x38')]('(')+0x1,_0x36cd4e[_0x3135('0x38')](')'));_0x1840fc[_0x3135('0x39')]=_0x2e74e6;_0x2840e2(_0x1840fc);})[_0x3135('0x1a')](function(_0x105df1){_0x59bca5(_0x105df1['message']);});});}function getEndUser(_0x3ec422,_0x4f4507,_0x13fef4,_0x1f321a,_0x1babdf,_0x190ba3,_0x536f91,_0x1d9826){var _0xee5fb1=_0x190ba3[_0x3135('0x30')]()==='outbound'?_0x1babdf[_0x3135('0x3a')]:_0x1babdf['calleridnum'];return getAuthToken(_0x4f4507,_0x13fef4,_0x190ba3)['then'](function(_0x30b2a6){_0x1d9826=_0x1d9826?_0x1d9826:_0x3135('0x3b');var _0x3f5f44={'method':_0x3135('0x1e'),'uri':_0x1f321a+_0x3135('0x3c')+_0x1d9826+'&$filter='+_0x1d9826+_0x3135('0x3d')+_0xee5fb1['replace']('+',_0x3135('0x3e'))+'\x27','headers':{'Authorization':_0x3135('0x20')+_0x30b2a6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f5f44);})[_0x3135('0x18')](function(_0x3c267f){var _0x2c9cfd=![];if(!_0x3c267f)return _0x2c9cfd;var _0x531024=_0x3c267f[_0x3135('0x22')];for(var _0x21015d=0x0;_0x21015d<_0x531024['length'];_0x21015d++){if(_0x531024[_0x21015d][_0x1d9826]===_0xee5fb1){_0x2c9cfd=!![];_0x3ec422['enduserId']=_0x531024[_0x21015d]['contactid'];}}return _0x2c9cfd;})[_0x3135('0x18')](function(_0x439fac){if(_0x439fac)return _0x3ec422;if(_0x536f91===_0x3135('0x3f')){logger[_0x3135('0x2a')]('['+[_0x190ba3['toUpperCase']()]+_0x3135('0x40'));return _0x3ec422;}return createEndUser(_0x3ec422,_0x4f4507,_0x13fef4,_0x1f321a,_0x1babdf,_0x190ba3,_0x1d9826)[_0x3135('0x18')](function(_0x3442fd){logger[_0x3135('0x2a')]('['+[_0x190ba3[_0x3135('0x2b')]()]+']\x20Enduser\x20created!',_0x3442fd[_0x3135('0x39')]);return _0x3442fd;});});}function getCustomFields(_0xcf8e02,_0xd4e5c0,_0x4fc3ab){var _0x1f6c86={};if(_0xcf8e02[_0x3135('0x27')]>0x0){_['forEach'](_0xcf8e02,function(_0x41aa82){if(_[_0x3135('0x41')]([_0x3135('0x42'),_0x3135('0x43')],_0x41aa82[_0x3135('0x44')])&&_0x41aa82['nameField']&&!_0x41aa82[_0x3135('0x45')]){var _0x9a87a=_0x41aa82[_0x3135('0x46')][_0x3135('0x30')]();var _0x1edd3d=_0x9a87a[_0x3135('0x37')](0x0,_0x9a87a['indexOf']('_'));var _0x305a78=_0x9a87a[_0x3135('0x37')](_0x9a87a[_0x3135('0x47')]('_')+0x1);if(_0x1edd3d===_0x4fc3ab){_0x1f6c86[_0x305a78]=_0x41aa82[_0x3135('0x48')];}}});}return _0x1f6c86;}function getTicket(_0x20ce71,_0x6909b2,_0x3992df,_0x540433,_0x4c4311,_0x68484a,_0x392021){return new Promise(function(_0x19c2e9,_0x39a4a4){var _0x2183df;return getAuthToken(_0x6909b2,_0x3992df,_0x392021)[_0x3135('0x18')](function(_0x2fdda9){if(_0x68484a[_0x3135('0x49')]==='incident'){_0x2183df={'method':_0x3135('0x12'),'uri':_0x540433+_0x3135('0x4a'),'body':Object['assign']({},{'title':intUtil[_0x3135('0x4b')](_0x68484a[_0x3135('0x4c')],_0x4c4311,'\x20'),'description':intUtil[_0x3135('0x4b')](_0x68484a['Descriptions'],_0x4c4311,'\x0a'),'customerid_contact@odata.bind':_0x20ce71[_0x3135('0x39')]?'/contacts('+_0x20ce71['enduserId']+')':undefined,'ownerid@odata.bind':_0x3135('0x34')+_0x20ce71[_0x3135('0x2e')]+')','caseorigincode':'1'},getCustomFields(_0x68484a['Fields'],_0x4c4311,_0x68484a[_0x3135('0x49')])),'headers':{'Authorization':_0x3135('0x20')+_0x2fdda9,'OData-Version':_0x3135('0x21')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x68484a[_0x3135('0x49')]==='phonecall'){var _0x4f062a=_0x20ce71['enduserId']?[{'partyid_systemuser@odata.bind':_0x3135('0x34')+_0x20ce71[_0x3135('0x2e')]+')','participationtypemask':_0x20ce71[_0x3135('0x4d')]===_0x3135('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x3135('0x4f')+_0x20ce71[_0x3135('0x39')]+')','participationtypemask':_0x20ce71['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3135('0x34')+_0x20ce71[_0x3135('0x2e')]+')','participationtypemask':_0x20ce71['callDirection']===_0x3135('0x4e')?0x2:0x1}];_0x2183df={'method':'POST','uri':_0x540433+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x68484a[_0x3135('0x4c')],_0x4c4311,'\x20'),'phonenumber':String(_0x4c4311[_0x3135('0x32')]),'description':intUtil[_0x3135('0x4b')](_0x68484a['Descriptions'],_0x4c4311,'\x0a'),'regardingobjectid_contact@odata.bind':_0x20ce71[_0x3135('0x39')]?_0x3135('0x4f')+_0x20ce71['enduserId']+')':undefined,'ownerid@odata.bind':_0x3135('0x34')+_0x20ce71[_0x3135('0x2e')]+')','directioncode':_0x20ce71[_0x3135('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0x4f062a},getCustomFields(_0x68484a[_0x3135('0x50')],_0x4c4311,_0x68484a['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2fdda9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2183df);})[_0x3135('0x18')](function(_0x1a41a4){var _0x37a4f9=_0x1a41a4[_0x3135('0x35')][_0x3135('0x36')];var _0x346313=_0x37a4f9[_0x3135('0x37')](_0x37a4f9[_0x3135('0x38')]('(')+0x1,_0x37a4f9[_0x3135('0x38')](')'));_0x20ce71[_0x3135('0x51')]=_0x346313;_0x19c2e9(_0x20ce71);})[_0x3135('0x1a')](function(_0x4a5c92){_0x39a4a4(_0x4a5c92[_0x3135('0x1d')]);});});}function emit(_0x292ed8,_0x5c96c0,_0x3c64fe,_0x59135c){var _0x577386={'uri':util[_0x3135('0x52')](_0x3135('0x53'),_0x292ed8,_0x3c64fe,_0x59135c)};io['to'](util['format'](_0x3135('0x54'),_0x5c96c0))[_0x3135('0x55')](_0x3135('0x56'),_0x577386);}exports['cs']=function(_0x416fc7,_0x104089,_0x49061c,_0x1df030,_0xe3c9fb,_0x1ea27a,_0x43d164,_0x16c9c7){var _0x500ebe={};_0x1ea27a[_0x3135('0x14')]=_0x1ea27a[_0x3135('0xb')]?intUtil[_0x3135('0x57')](_0x1ea27a[_0x3135('0xc')][_0x3135('0xd')]):intUtil['stripTrailingSlash'](_0x1ea27a[_0x3135('0x14')]);_0x1ea27a['serverUrl']=intUtil[_0x3135('0x57')](_0x1ea27a[_0x3135('0x58')]);_0x500ebe[_0x3135('0x4d')]=_0x16c9c7==='queue'||_0x16c9c7===_0x3135('0x59')?'queue':_0x3135('0x31');var _0x39fb39=_0x1ea27a['modernAuthentication']?util[_0x3135('0x52')](_0x3135('0x5a'),_0x1ea27a[_0x3135('0xc')][_0x3135('0xd')]):util['format']('%s/api/data/v9.0/',_0x1ea27a[_0x3135('0x14')]);var _0x25bcee=util[_0x3135('0x52')](_0x3135('0x5b'),_0x1ea27a[_0x3135('0xe')]);var _0x4ea266=util[_0x3135('0x52')](_0x3135('0x5c'),_0x1ea27a[_0x3135('0x58')],_0x104089['uniqueid'],md5(_0x104089[_0x3135('0x5d')]));if(_0xe3c9fb&&_0xe3c9fb[_0x3135('0x5e')]){logger[_0x3135('0x2a')]('[QUEUE]','Recording\x20is\x20enabled!');_0x104089['recordingURL']=_0x4ea266;}else if(_0x43d164&&_0x43d164[_0x3135('0x5f')]&&_0x43d164[_0x3135('0x5f')]!==_0x3135('0x60')){logger[_0x3135('0x2a')](_0x3135('0x61'),'Recording\x20is\x20enabled!');_0x104089[_0x3135('0x62')]=_0x4ea266;}else{_0x104089[_0x3135('0x62')]='';}return getUser(_0x500ebe,_0x1ea27a,_0x1df030,_0x25bcee,_0x39fb39,_0x16c9c7)['then'](function(_0x2b4f26){logger[_0x3135('0x2a')]('['+_0x16c9c7['toUpperCase']()+_0x3135('0x63'),_0x2b4f26[_0x3135('0x2e')]);logger[_0x3135('0x2a')]('['+_0x16c9c7[_0x3135('0x2b')]()+_0x3135('0x64'),_0x2b4f26[_0x3135('0x25')]);return getEndUser(_0x2b4f26,_0x1ea27a,_0x25bcee,_0x39fb39,_0x104089,_0x16c9c7,_0x49061c[_0x3135('0x65')],_0x49061c[_0x3135('0x66')]);})['then'](function(_0x5a726a){logger[_0x3135('0x2a')]('['+_0x16c9c7[_0x3135('0x2b')]()+_0x3135('0x67'),_0x5a726a[_0x3135('0x39')]);logger['info']('['+_0x16c9c7['toUpperCase']()+_0x3135('0x68'),_0x104089[_0x3135('0x32')]);return getTicket(_0x5a726a,_0x1ea27a,_0x25bcee,_0x39fb39,_0x104089,_0x49061c,_0x16c9c7);})[_0x3135('0x18')](function(_0xaf3450){logger[_0x3135('0x2a')](util[_0x3135('0x52')]('['+_0x16c9c7[_0x3135('0x2b')]()+_0x3135('0x69'),_0x49061c[_0x3135('0x49')],_0xaf3450[_0x3135('0x51')]));logger[_0x3135('0x2a')](util[_0x3135('0x52')]('['+_0x16c9c7[_0x3135('0x2b')]()+_0x3135('0x6a'),_0x16c9c7));if(_0x16c9c7!==_0x3135('0x59')&&_0x49061c['openNewTab']){logger[_0x3135('0x2a')]('['+_0x16c9c7[_0x3135('0x2b')]()+']',_0x3135('0x6b'));emit(_0x1ea27a['remoteUri'],_0x1df030[_0x3135('0x6c')],_0x49061c[_0x3135('0x49')],_0xaf3450[_0x3135('0x51')]);}})['catch'](function(_0x508f89){logger[_0x3135('0x1b')]('['+_0x16c9c7[_0x3135('0x2b')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x508f89[_0x3135('0x1d')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x508f89);});}; \ 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 43366d1..5fcf23f 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 _0x1223=['content','variable','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','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!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','type','customField','nameField','toLowerCase','idField','push'];(function(_0x59f3bf,_0x36563e){var _0x2f3642=function(_0x3261b6){while(--_0x3261b6){_0x59f3bf['push'](_0x59f3bf['shift']());}};_0x2f3642(++_0x36563e);}(_0x1223,0xdd));var _0x3122=function(_0x1ef655,_0x3b3d9a){_0x1ef655=_0x1ef655-0x0;var _0x5ca856=_0x1223[_0x1ef655];return _0x5ca856;};'use strict';var _=require(_0x3122('0x0'));var rp=require('request-promise');var md5=require(_0x3122('0x1'));var util=require(_0x3122('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x3122('0x3'))(_0x3122('0x4'));config[_0x3122('0x5')]=_['defaults'](config[_0x3122('0x5')],{'host':_0x3122('0x6'),'port':0x18eb});var io=require(_0x3122('0x7'))(new Redis(config[_0x3122('0x5')]));var headers={'Content-Type':_0x3122('0x8'),'Accept':'application/json'};function emit(_0x56f3a5,_0x175ca7,_0x4f4278){io['to'](_0x56f3a5)['emit'](_0x175ca7,_0x4f4278);}function getTicket(_0x2f700f,_0x4fe235,_0x15e6f9,_0x19f2be,_0x200bd6){logger['info']('Creating\x20new\x20ticket...');var _0xc776ab=_[_0x3122('0x9')]({'responder_id':_0x4fe235['id'],'requester_id':_0x15e6f9['id'],'name':util[_0x3122('0xa')](_0x3122('0xb'),_0x200bd6['calleridname']),'phone':_0x200bd6[_0x3122('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3122('0xd')](_0x19f2be['Subjects'],_0x200bd6,'\x20'),'description':intUtil[_0x3122('0xd')](_0x19f2be[_0x3122('0xe')],_0x200bd6,'
'),'tags':getTags(_0x19f2be[_0x3122('0xf')],_0x3122('0x10'))},getCustomFields(_0x19f2be[_0x3122('0x11')],_0x200bd6));_0xc776ab[_0x3122('0x12')]=_[_0x3122('0x13')](_[_0x3122('0x14')](_0xc776ab[_0x3122('0x12')],'id'),_0x3122('0x15'));return request({'uri':util['format'](_0x3122('0x16'),_0x2f700f['remoteUri']),'method':'POST','body':_0xc776ab})['then'](function(_0x47dd83){logger[_0x3122('0x17')](_0x3122('0x18'));return _0x47dd83;});}function getUser(_0xf0686b,_0x7d7459){if(intUtil[_0x3122('0x19')](_0x7d7459)){return request({'uri':util['format'](_0x3122('0x1a'),_0xf0686b[_0x3122('0x1b')]),'qs':{'email':_0x7d7459}})[_0x3122('0x1c')](function(_0x4ff3b6){if(_0x4ff3b6[_0x3122('0x1d')]){logger[_0x3122('0x17')]('Agent\x20found!');return _[_0x3122('0x1e')](_0x4ff3b6,function(_0x197317){return _0x197317[_0x3122('0x1f')][_0x3122('0x20')]===_0x7d7459;});}else{logger[_0x3122('0x17')](_0x3122('0x21'));return request({'uri':util[_0x3122('0xa')]('%s/api/v2/agents/me',_0xf0686b[_0x3122('0x1b')])})[_0x3122('0x1c')](function(_0x156344){logger[_0x3122('0x17')](_0x3122('0x22'));return _0x156344;});}});}else{logger[_0x3122('0x17')](_0x3122('0x23'));return request({'uri':util[_0x3122('0xa')](_0x3122('0x24'),_0xf0686b[_0x3122('0x1b')])})[_0x3122('0x1c')](function(_0x283398){logger[_0x3122('0x17')]('Admin\x20account\x20selected.');return _0x283398;});}}function getEndUser(_0x176c6a,_0x458ff1,_0x1c5514){logger[_0x3122('0x17')](_0x3122('0x25'),_0x1c5514);return request({'uri':util[_0x3122('0xa')](_0x3122('0x26'),_0x176c6a['remoteUri']),'qs':{'phone':_0x1c5514}})[_0x3122('0x1c')](function(_0x1a4bd9){if(_0x1a4bd9[_0x3122('0x1d')]){logger['info'](_0x3122('0x27'));return _[_0x3122('0x1e')](_0x1a4bd9,{'phone':_0x1c5514});}else{logger[_0x3122('0x17')](_0x3122('0x28'));return request({'uri':util[_0x3122('0xa')]('%s/api/v2/contacts',_0x176c6a[_0x3122('0x1b')]),'method':_0x3122('0x29'),'body':{'name':_0x458ff1,'phone':_0x1c5514}})['then'](function(_0x467fcd){logger[_0x3122('0x17')](_0x3122('0x2a'));return _0x467fcd;});}});}function getAuth(_0xdf23e2){return util[_0x3122('0xa')](_0x3122('0x2b'),new Buffer(_0xdf23e2[_0x3122('0x2c')]+':X')[_0x3122('0x2d')](_0x3122('0x2e')));}function request(_0x474d45){logger[_0x3122('0x2f')](_0x3122('0x30'),JSON[_0x3122('0x31')](_0x474d45));return rp(_[_0x3122('0x32')](_0x474d45,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x355da2,_0x1027b9){var _0x413a80=[];if(_0x355da2&&_0x355da2[_0x3122('0x1d')]>0x0){_0x413a80=_[_0x3122('0x33')](_0x355da2,_0x1027b9);}return _0x413a80;}function getCustomFields(_0x32d13a,_0x3a93a0){var _0x53564c=[];var _0x1c60d2={'custom_fields':[]};if(_0x32d13a['length']>0x0){_[_0x3122('0x34')](_0x32d13a,function(_0x3245fc){if(_[_0x3122('0x35')]([_0x3122('0x36'),'picklist'],_0x3245fc[_0x3122('0x37')])&&_0x3245fc['nameField']&&!_0x3245fc[_0x3122('0x38')]){_0x1c60d2[_0x3245fc[_0x3122('0x39')][_0x3122('0x3a')]()]=_0x3245fc['content'][_0x3122('0x2d')]();}else if(_['includes']([_0x3122('0x36'),'picklist'],_0x3245fc[_0x3122('0x37')])&&_0x3245fc[_0x3122('0x3b')]&&_0x3245fc[_0x3122('0x38')]){_0x1c60d2[_0x3122('0x12')][_0x3122('0x3c')]({'id':_0x3245fc['idField'],'value':_0x3245fc[_0x3122('0x3d')][_0x3122('0x2d')]()});}else if(_0x3245fc[_0x3122('0x37')]===_0x3122('0x3e')&&_0x3245fc[_0x3122('0x3f')]&&_0x3245fc['idField']&&_0x3245fc[_0x3122('0x38')]){_0x3a93a0[_0x3245fc['variableName']]&&_0x1c60d2[_0x3122('0x12')][_0x3122('0x3c')]({'id':_0x3245fc[_0x3122('0x3b')],'value':_0x3a93a0[_0x3245fc['variableName']][_0x3122('0x2d')]()});}else if(_0x3245fc[_0x3122('0x37')]===_0x3122('0x40')&&_0x3245fc[_0x3122('0x41')]&&_0x3245fc[_0x3122('0x41')][_0x3122('0x10')]&&_0x3245fc[_0x3122('0x3b')]&&_0x3245fc[_0x3122('0x38')]){_0x3a93a0[_0x3245fc[_0x3122('0x41')]['name'][_0x3122('0x3a')]()]&&_0x1c60d2[_0x3122('0x12')][_0x3122('0x3c')]({'id':_0x3245fc[_0x3122('0x3b')],'value':_0x3a93a0[_0x3245fc[_0x3122('0x41')][_0x3122('0x10')]['toLowerCase']()][_0x3122('0x2d')]()});}});}return _0x1c60d2;}exports[_0x3122('0x42')]=function(_0x22a139,_0x469cf4,_0x33f1f2,_0x3f9042,_0xe2fb2d,_0x609f0d){var _0x359f38,_0x3d5d13;_0x609f0d[_0x3122('0x1b')]=intUtil['stripTrailingSlash'](_0x609f0d[_0x3122('0x1b')]);_0x609f0d[_0x3122('0x43')]=intUtil['stripTrailingSlash'](_0x609f0d[_0x3122('0x43')]);if(_0xe2fb2d&&_0xe2fb2d[_0x3122('0x44')]){logger[_0x3122('0x17')](_0x3122('0x45'),_0x3122('0x46'));_0x469cf4[_0x3122('0x47')]=util[_0x3122('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x609f0d['serverUrl'],_0x469cf4[_0x3122('0x48')],md5(_0x469cf4[_0x3122('0x48')]));}else{_0x469cf4[_0x3122('0x47')]='';}headers['Authorization']=getAuth(_0x609f0d);return getUser(_0x609f0d,_0x3f9042[_0x3122('0x20')])[_0x3122('0x1c')](function(_0x3e10df){_0x359f38=_0x3e10df;logger[_0x3122('0x17')](_0x3122('0x49'),_0x359f38['id']);return getEndUser(_0x609f0d,_0x469cf4['calleridname'],_0x469cf4[_0x3122('0xc')]);})[_0x3122('0x1c')](function(_0x321081){_0x3d5d13=_0x321081;logger[_0x3122('0x17')](_0x3122('0x4a'),_0x3d5d13['id']);return getTicket(_0x609f0d,_0x359f38,_0x3d5d13,_0x33f1f2,_0x469cf4);})[_0x3122('0x1c')](function(_0x4758e7){if(_0x4758e7&&_0x4758e7['id']){logger[_0x3122('0x17')](_0x3122('0x18'));logger['info'](_0x3122('0x4b'),_0x4758e7['id']);logger[_0x3122('0x17')](_0x3122('0x45'),_0x3122('0x4c'));emit(util['format'](_0x3122('0x4d'),_0x3f9042[_0x3122('0x10')]),_0x3122('0x4e'),{'uri':util[_0x3122('0xa')]('%s/helpdesk/tickets/%d',_0x609f0d[_0x3122('0x1b')],_0x4758e7['id'])});}})[_0x3122('0x4f')](function(_0x55bb7a){logger[_0x3122('0x50')](_0x3122('0x45'),JSON[_0x3122('0x31')](_0x55bb7a));});};exports[_0x3122('0x51')]=function(_0x4fa58d,_0x20abe9,_0x3c2dcd,_0x5e1750,_0x244ac7,_0x16f723,_0xb35e35){var _0x3ca5e4,_0x15a9df;_0x16f723[_0x3122('0x1b')]=intUtil[_0x3122('0x52')](_0x16f723[_0x3122('0x1b')]);_0x16f723[_0x3122('0x43')]=intUtil['stripTrailingSlash'](_0x16f723['serverUrl']);if(_0xb35e35&&_0xb35e35[_0x3122('0x53')]&&_0xb35e35[_0x3122('0x53')]!=='none'){logger[_0x3122('0x17')](_0x3122('0x54'),'Recording\x20is\x20enabled!');_0x20abe9[_0x3122('0x47')]=util[_0x3122('0xa')](_0x3122('0x55'),_0x16f723['serverUrl'],_0x20abe9[_0x3122('0x48')],md5(_0x20abe9['uniqueid']));}headers[_0x3122('0x56')]=getAuth(_0x16f723);return getUser(_0x16f723,_0x5e1750['email'])[_0x3122('0x1c')](function(_0x472112){_0x3ca5e4=_0x472112;logger[_0x3122('0x17')]('The\x20User\x20ID\x20is:',_0x3ca5e4['id']);return getEndUser(_0x16f723,_0x20abe9[_0x3122('0x57')],_0x20abe9[_0x3122('0x58')]);})[_0x3122('0x1c')](function(_0x1ceb31){_0x15a9df=_0x1ceb31;logger['info']('The\x20Enduser\x20ID\x20is:',_0x15a9df['id']);return getTicket(_0x16f723,_0x3ca5e4,_0x15a9df,_0x3c2dcd,_0x20abe9);})['then'](function(_0x284fef){if(_0x284fef&&_0x284fef['id']){logger[_0x3122('0x17')](_0x3122('0x18'));logger[_0x3122('0x17')](_0x3122('0x4b'),_0x284fef['id']);logger[_0x3122('0x17')](_0x3122('0x54'),_0x3122('0x4c'));emit(util[_0x3122('0xa')]('user:%s',_0x5e1750[_0x3122('0x10')]),'trigger:browser:url',{'uri':util[_0x3122('0xa')](_0x3122('0x59'),_0x16f723[_0x3122('0x1b')],_0x284fef['id'])});}})['catch'](function(_0x5a3c4d){logger['error'](_0x3122('0x54'),JSON[_0x3122('0x31')](_0x5a3c4d));});};exports[_0x3122('0x5a')]=function(_0x4aa550,_0x5415d4,_0xdac805,_0x165b55,_0x2487bc,_0x15685c){var _0x29442c,_0x5e90cc;_0x15685c[_0x3122('0x1b')]=intUtil[_0x3122('0x52')](_0x15685c[_0x3122('0x1b')]);_0x15685c[_0x3122('0x43')]=intUtil['stripTrailingSlash'](_0x15685c['serverUrl']);if(_0x2487bc&&_0x2487bc[_0x3122('0x44')]){logger['info']('['+_0x5415d4[_0x3122('0x5b')][_0x3122('0x5c')]()+']',_0x3122('0x46'));_0x5415d4[_0x3122('0x47')]=util['format'](_0x3122('0x55'),_0x15685c[_0x3122('0x43')],_0x5415d4[_0x3122('0x48')],md5(_0x5415d4[_0x3122('0x48')]));}else{_0x5415d4[_0x3122('0x47')]='';}headers[_0x3122('0x56')]=getAuth(_0x15685c);return getUser(_0x15685c,'')['then'](function(_0x303333){_0x29442c=_0x303333;logger['info'](_0x3122('0x49'),_0x29442c['id']);return getEndUser(_0x15685c,_0x5415d4[_0x3122('0x5d')],_0x5415d4[_0x3122('0xc')]);})[_0x3122('0x1c')](function(_0x372154){_0x5e90cc=_0x372154;logger[_0x3122('0x17')](_0x3122('0x4a'),_0x5e90cc['id']);return getTicket(_0x15685c,_0x29442c,_0x5e90cc,_0xdac805,_0x5415d4);})[_0x3122('0x1c')](function(_0x3327f6){if(_0x3327f6){logger['info'](_0x3122('0x18'));logger[_0x3122('0x17')](_0x3122('0x4b'),_0x3327f6['id']);}})[_0x3122('0x4f')](function(_0x138d8e){logger[_0x3122('0x50')]('['+_0x5415d4[_0x3122('0x5b')][_0x3122('0x5c')]()+']',JSON[_0x3122('0x31')](_0x138d8e));});}; \ No newline at end of file +var _0x1bc8=['socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','calleridname','calleridnum','Subjects','getString','Descriptions','name','Fields','mapValues','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','then','length','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','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','customField','nameField','toLowerCase','content','includes','idField','push','variable','customVariable','Variable','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','catch','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x1bc8,0xaa));var _0x81bc=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0x1bc8[_0x185832];return _0x253dda;};'use strict';var _=require('lodash');var rp=require(_0x81bc('0x0'));var md5=require(_0x81bc('0x1'));var util=require(_0x81bc('0x2'));var Redis=require(_0x81bc('0x3'));var intUtil=require(_0x81bc('0x4'));var config=require(_0x81bc('0x5'));var logger=require(_0x81bc('0x6'))('freshdesk');config[_0x81bc('0x7')]=_[_0x81bc('0x8')](config[_0x81bc('0x7')],{'host':_0x81bc('0x9'),'port':0x18eb});var io=require(_0x81bc('0xa'))(new Redis(config[_0x81bc('0x7')]));var headers={'Content-Type':_0x81bc('0xb'),'Accept':_0x81bc('0xb')};function emit(_0x15457d,_0x235477,_0x1a988e){io['to'](_0x15457d)[_0x81bc('0xc')](_0x235477,_0x1a988e);}function getTicket(_0x3a5580,_0x75f1cb,_0x2ec8de,_0x242bb4,_0x107323){logger['info'](_0x81bc('0xd'));var _0x154ef4=_['merge']({'responder_id':_0x75f1cb['id'],'requester_id':_0x2ec8de['id'],'name':util['format']('Caller\x20-\x20%s',_0x107323[_0x81bc('0xe')]),'phone':_0x107323[_0x81bc('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x242bb4[_0x81bc('0x10')],_0x107323,'\x20'),'description':intUtil[_0x81bc('0x11')](_0x242bb4[_0x81bc('0x12')],_0x107323,'
'),'tags':getTags(_0x242bb4['Tags'],_0x81bc('0x13'))},getCustomFields(_0x242bb4[_0x81bc('0x14')],_0x107323));_0x154ef4['custom_fields']=_[_0x81bc('0x15')](_['keyBy'](_0x154ef4[_0x81bc('0x16')],'id'),_0x81bc('0x17'));return request({'uri':util[_0x81bc('0x18')](_0x81bc('0x19'),_0x3a5580[_0x81bc('0x1a')]),'method':_0x81bc('0x1b'),'body':_0x154ef4})['then'](function(_0x521412){logger[_0x81bc('0x1c')](_0x81bc('0x1d'));return _0x521412;});}function getUser(_0x2962d9,_0x3d2401){if(intUtil['validateEmail'](_0x3d2401)){return request({'uri':util[_0x81bc('0x18')]('%s/api/v2/agents',_0x2962d9['remoteUri']),'qs':{'email':_0x3d2401}})[_0x81bc('0x1e')](function(_0xb714b){if(_0xb714b[_0x81bc('0x1f')]){logger[_0x81bc('0x1c')](_0x81bc('0x20'));return _[_0x81bc('0x21')](_0xb714b,function(_0x2f4e96){return _0x2f4e96[_0x81bc('0x22')][_0x81bc('0x23')]===_0x3d2401;});}else{logger[_0x81bc('0x1c')](_0x81bc('0x24'));return request({'uri':util['format'](_0x81bc('0x25'),_0x2962d9[_0x81bc('0x1a')])})[_0x81bc('0x1e')](function(_0x4fa012){logger['info']('Admin\x20account\x20selected.');return _0x4fa012;});}});}else{logger[_0x81bc('0x1c')](_0x81bc('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2962d9[_0x81bc('0x1a')])})['then'](function(_0x2d9aa6){logger[_0x81bc('0x1c')](_0x81bc('0x27'));return _0x2d9aa6;});}}function getEndUser(_0x301676,_0x339ea7,_0x5e0dd0){logger[_0x81bc('0x1c')]('Searching\x20enduser\x20with\x20phone',_0x5e0dd0);return request({'uri':util[_0x81bc('0x18')](_0x81bc('0x28'),_0x301676[_0x81bc('0x1a')]),'qs':{'phone':_0x5e0dd0}})[_0x81bc('0x1e')](function(_0x3fbca6){if(_0x3fbca6[_0x81bc('0x1f')]){logger[_0x81bc('0x1c')](_0x81bc('0x29'));return _[_0x81bc('0x21')](_0x3fbca6,{'phone':_0x5e0dd0});}else{logger[_0x81bc('0x1c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x81bc('0x28'),_0x301676['remoteUri']),'method':_0x81bc('0x1b'),'body':{'name':_0x339ea7,'phone':_0x5e0dd0}})[_0x81bc('0x1e')](function(_0x6b0a47){logger[_0x81bc('0x1c')](_0x81bc('0x2a'));return _0x6b0a47;});}});}function getAuth(_0xe11b57){return util['format'](_0x81bc('0x2b'),new Buffer(_0xe11b57[_0x81bc('0x2c')]+':X')[_0x81bc('0x2d')]('base64'));}function request(_0x39e9ca){logger[_0x81bc('0x2e')](_0x81bc('0x2f'),JSON[_0x81bc('0x30')](_0x39e9ca));return rp(_[_0x81bc('0x8')](_0x39e9ca,{'method':_0x81bc('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x484f8a,_0x1d814f){var _0xb4f000=[];if(_0x484f8a&&_0x484f8a[_0x81bc('0x1f')]>0x0){_0xb4f000=_[_0x81bc('0x32')](_0x484f8a,_0x1d814f);}return _0xb4f000;}function getCustomFields(_0x1f3145,_0x10fd0d){var _0x39e532=[];var _0x6b91af={'custom_fields':[]};if(_0x1f3145[_0x81bc('0x1f')]>0x0){_[_0x81bc('0x33')](_0x1f3145,function(_0x2ca639){if(_['includes']([_0x81bc('0x34'),_0x81bc('0x35')],_0x2ca639[_0x81bc('0x36')])&&_0x2ca639['nameField']&&!_0x2ca639[_0x81bc('0x37')]){_0x6b91af[_0x2ca639[_0x81bc('0x38')][_0x81bc('0x39')]()]=_0x2ca639[_0x81bc('0x3a')][_0x81bc('0x2d')]();}else if(_[_0x81bc('0x3b')]([_0x81bc('0x34'),_0x81bc('0x35')],_0x2ca639[_0x81bc('0x36')])&&_0x2ca639[_0x81bc('0x3c')]&&_0x2ca639['customField']){_0x6b91af[_0x81bc('0x16')][_0x81bc('0x3d')]({'id':_0x2ca639[_0x81bc('0x3c')],'value':_0x2ca639[_0x81bc('0x3a')][_0x81bc('0x2d')]()});}else if(_0x2ca639[_0x81bc('0x36')]===_0x81bc('0x3e')&&_0x2ca639['variableName']&&_0x2ca639[_0x81bc('0x3c')]&&_0x2ca639[_0x81bc('0x37')]){_0x10fd0d[_0x2ca639['variableName']]&&_0x6b91af['custom_fields'][_0x81bc('0x3d')]({'id':_0x2ca639['idField'],'value':_0x10fd0d[_0x2ca639['variableName']][_0x81bc('0x2d')]()});}else if(_0x2ca639[_0x81bc('0x36')]===_0x81bc('0x3f')&&_0x2ca639[_0x81bc('0x40')]&&_0x2ca639[_0x81bc('0x40')][_0x81bc('0x13')]&&_0x2ca639[_0x81bc('0x3c')]&&_0x2ca639[_0x81bc('0x37')]){_0x10fd0d[_0x2ca639[_0x81bc('0x40')]['name'][_0x81bc('0x39')]()]&&_0x6b91af[_0x81bc('0x16')][_0x81bc('0x3d')]({'id':_0x2ca639[_0x81bc('0x3c')],'value':_0x10fd0d[_0x2ca639['Variable'][_0x81bc('0x13')]['toLowerCase']()]['toString']()});}});}return _0x6b91af;}exports['queue']=function(_0x7a2704,_0x24d9b5,_0x222811,_0x48efb5,_0x20976f,_0x63c595){var _0x4520bf,_0x55fd7e;_0x63c595[_0x81bc('0x1a')]=intUtil['stripTrailingSlash'](_0x63c595[_0x81bc('0x1a')]);_0x63c595[_0x81bc('0x41')]=intUtil['stripTrailingSlash'](_0x63c595['serverUrl']);if(_0x20976f&&_0x20976f[_0x81bc('0x42')]){logger[_0x81bc('0x1c')](_0x81bc('0x43'),_0x81bc('0x44'));_0x24d9b5[_0x81bc('0x45')]=util[_0x81bc('0x18')](_0x81bc('0x46'),_0x63c595[_0x81bc('0x41')],_0x24d9b5[_0x81bc('0x47')],md5(_0x24d9b5[_0x81bc('0x47')]));}else{_0x24d9b5[_0x81bc('0x45')]='';}headers[_0x81bc('0x48')]=getAuth(_0x63c595);return getUser(_0x63c595,_0x48efb5['email'])[_0x81bc('0x1e')](function(_0x1936e9){_0x4520bf=_0x1936e9;logger[_0x81bc('0x1c')](_0x81bc('0x49'),_0x4520bf['id']);return getEndUser(_0x63c595,_0x24d9b5['calleridname'],_0x24d9b5[_0x81bc('0xf')]);})[_0x81bc('0x1e')](function(_0x219f53){_0x55fd7e=_0x219f53;logger['info'](_0x81bc('0x4a'),_0x55fd7e['id']);return getTicket(_0x63c595,_0x4520bf,_0x55fd7e,_0x222811,_0x24d9b5);})[_0x81bc('0x1e')](function(_0x30ef8f){if(_0x30ef8f&&_0x30ef8f['id']){logger[_0x81bc('0x1c')](_0x81bc('0x1d'));logger[_0x81bc('0x1c')](_0x81bc('0x4b'),_0x30ef8f['id']);logger[_0x81bc('0x1c')](_0x81bc('0x43'),_0x81bc('0x4c'));emit(util[_0x81bc('0x18')](_0x81bc('0x4d'),_0x48efb5['name']),_0x81bc('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x63c595[_0x81bc('0x1a')],_0x30ef8f['id'])});}})['catch'](function(_0x4926b0){logger[_0x81bc('0x4f')](_0x81bc('0x43'),JSON['stringify'](_0x4926b0));});};exports[_0x81bc('0x50')]=function(_0x6b948f,_0x47f303,_0x4b4fe1,_0x1a9884,_0x3ed477,_0x102144,_0x15b03f){var _0xbe80a6,_0x583c13;_0x102144[_0x81bc('0x1a')]=intUtil[_0x81bc('0x51')](_0x102144[_0x81bc('0x1a')]);_0x102144[_0x81bc('0x41')]=intUtil[_0x81bc('0x51')](_0x102144[_0x81bc('0x41')]);if(_0x15b03f&&_0x15b03f[_0x81bc('0x52')]&&_0x15b03f[_0x81bc('0x52')]!==_0x81bc('0x53')){logger[_0x81bc('0x1c')](_0x81bc('0x54'),_0x81bc('0x44'));_0x47f303[_0x81bc('0x45')]=util[_0x81bc('0x18')](_0x81bc('0x46'),_0x102144[_0x81bc('0x41')],_0x47f303[_0x81bc('0x47')],md5(_0x47f303['uniqueid']));}headers['Authorization']=getAuth(_0x102144);return getUser(_0x102144,_0x1a9884[_0x81bc('0x23')])[_0x81bc('0x1e')](function(_0x269433){_0xbe80a6=_0x269433;logger[_0x81bc('0x1c')]('The\x20User\x20ID\x20is:',_0xbe80a6['id']);return getEndUser(_0x102144,_0x47f303['destcalleridname'],_0x47f303[_0x81bc('0x55')]);})[_0x81bc('0x1e')](function(_0x547b8b){_0x583c13=_0x547b8b;logger[_0x81bc('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x583c13['id']);return getTicket(_0x102144,_0xbe80a6,_0x583c13,_0x4b4fe1,_0x47f303);})[_0x81bc('0x1e')](function(_0x4edb64){if(_0x4edb64&&_0x4edb64['id']){logger[_0x81bc('0x1c')](_0x81bc('0x1d'));logger[_0x81bc('0x1c')](_0x81bc('0x4b'),_0x4edb64['id']);logger[_0x81bc('0x1c')](_0x81bc('0x54'),_0x81bc('0x4c'));emit(util[_0x81bc('0x18')]('user:%s',_0x1a9884[_0x81bc('0x13')]),'trigger:browser:url',{'uri':util[_0x81bc('0x18')]('%s/helpdesk/tickets/%d',_0x102144[_0x81bc('0x1a')],_0x4edb64['id'])});}})[_0x81bc('0x56')](function(_0x5ee2f2){logger[_0x81bc('0x4f')](_0x81bc('0x54'),JSON['stringify'](_0x5ee2f2));});};exports[_0x81bc('0x57')]=function(_0x76f7a0,_0x535f9b,_0x2eae31,_0x484f22,_0x4692cd,_0x5edbd4){var _0x2343fc,_0xcc69bc;_0x5edbd4[_0x81bc('0x1a')]=intUtil['stripTrailingSlash'](_0x5edbd4[_0x81bc('0x1a')]);_0x5edbd4[_0x81bc('0x41')]=intUtil[_0x81bc('0x51')](_0x5edbd4[_0x81bc('0x41')]);if(_0x4692cd&&_0x4692cd[_0x81bc('0x42')]){logger['info']('['+_0x535f9b[_0x81bc('0x58')][_0x81bc('0x59')]()+']',_0x81bc('0x44'));_0x535f9b[_0x81bc('0x45')]=util[_0x81bc('0x18')](_0x81bc('0x46'),_0x5edbd4[_0x81bc('0x41')],_0x535f9b[_0x81bc('0x47')],md5(_0x535f9b[_0x81bc('0x47')]));}else{_0x535f9b['recordingURL']='';}headers['Authorization']=getAuth(_0x5edbd4);return getUser(_0x5edbd4,'')[_0x81bc('0x1e')](function(_0x93f2d9){_0x2343fc=_0x93f2d9;logger[_0x81bc('0x1c')](_0x81bc('0x49'),_0x2343fc['id']);return getEndUser(_0x5edbd4,_0x535f9b[_0x81bc('0xe')],_0x535f9b[_0x81bc('0xf')]);})['then'](function(_0x5f30e6){_0xcc69bc=_0x5f30e6;logger['info'](_0x81bc('0x4a'),_0xcc69bc['id']);return getTicket(_0x5edbd4,_0x2343fc,_0xcc69bc,_0x2eae31,_0x535f9b);})[_0x81bc('0x1e')](function(_0x80cca0){if(_0x80cca0){logger['info']('Ticket\x20created!');logger[_0x81bc('0x1c')](_0x81bc('0x4b'),_0x80cca0['id']);}})[_0x81bc('0x56')](function(_0x4feb98){logger[_0x81bc('0x4f')]('['+_0x535f9b['lastevent'][_0x81bc('0x59')]()+']',JSON['stringify'](_0x4feb98));});}; \ 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 6380041..33585df 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 _0x02e3=['uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','error','message','&f=','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x570ead,_0x3efedf){var _0x5c245f=function(_0x3aa05d){while(--_0x3aa05d){_0x570ead['push'](_0x570ead['shift']());}};_0x5c245f(++_0x3efedf);}(_0x02e3,0xfa));var _0x302e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x02e3[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x302e('0x0'));var rp=require(_0x302e('0x1'));var md5=require(_0x302e('0x2'));var util=require('util');var moment=require(_0x302e('0x3'));var Promise=require(_0x302e('0x4'));var Redis=require(_0x302e('0x5'));var intUtil=require('./util');var config=require(_0x302e('0x6'));var logger=require(_0x302e('0x7'))(_0x302e('0x8'));config[_0x302e('0x9')]=_[_0x302e('0xa')](config['redis'],{'host':_0x302e('0xb'),'port':0x18eb});var io=require(_0x302e('0xc'))(new Redis(config['redis']));function getAdminId(_0x55e932,_0x253fdf,_0x2304bf,_0x30d67d){return new Promise(function(_0x282097,_0x2962b6){var _0x383763=![];var _0x55032d={'method':_0x302e('0xd'),'uri':_0x30d67d+_0x302e('0xe'),'json':!![]};_0x55032d['headers']=_0x2304bf;logger[_0x302e('0xf')](_0x302e('0x10'));return rp(_0x55032d)['then'](function(_0x23f4b0){if(_0x23f4b0){var _0x191a6c=_0x23f4b0[_0x302e('0x11')];var _0x33a0ac=null;for(_0x33a0ac=0x0;_0x33a0ac<_0x191a6c[_0x302e('0x12')];_0x33a0ac++){if(_0x191a6c[_0x33a0ac][_0x302e('0x13')]===_0x55e932[_0x302e('0x14')]){_0x55e932[_0x302e('0x15')]=_0x191a6c[_0x33a0ac]['id'];_0x383763=!![];}}if(_0x383763){logger[_0x302e('0xf')](_0x302e('0x16'),_0x55e932[_0x302e('0x15')]);_0x282097(_0x55e932);}else{_0x2962b6({'statusCode':0x194,'message':_0x302e('0x17')});}}else{_0x2962b6({'statusCode':0x194,'message':_0x302e('0x17')});}})[_0x302e('0x18')](function(_0x52eb86){logger['error']('['+[_0x253fdf[_0x302e('0x19')]()]+']',_0x52eb86['message']);_0x2962b6(_0x52eb86);});});}function getUser(_0x6d8201,_0xf2023d,_0x462f5d){return function(_0x3f02ad){return new Promise(function(_0x3dc8bd,_0x26cd53){var _0x371bb2={'method':_0x302e('0xd'),'uri':_0x462f5d+_0x302e('0xe'),'json':!![]};_0x371bb2['headers']=_0xf2023d;logger[_0x302e('0xf')](_0x302e('0x1a'));return rp(_0x371bb2)[_0x302e('0x1b')](function(_0x2f173b){if(_0x2f173b){var _0x58db3f=_0x2f173b['users'];var _0x329401=![];var _0x348a9b=null;if(_0x3f02ad[_0x302e('0x1c')]!==null){logger[_0x302e('0xf')](_0x302e('0x1d'),_0x3f02ad['agentEmail']);_0x3f02ad[_0x302e('0x1e')]=_0x3f02ad[_0x302e('0x1c')];for(_0x348a9b=0x0;_0x348a9b<_0x58db3f['length'];_0x348a9b++){if(_0x58db3f[_0x348a9b]['email']===_0x3f02ad[_0x302e('0x1c')]){_0x329401=!![];_0x3f02ad['userId']=_0x58db3f[_0x348a9b]['id'];logger['info'](_0x302e('0x1f'),_0x3f02ad[_0x302e('0x20')]);}}}if(!_0x329401){logger[_0x302e('0xf')]('Admin\x20selected');_0x3f02ad[_0x302e('0x1e')]=_0x3f02ad[_0x302e('0x14')];_0x3f02ad[_0x302e('0x20')]=_0x3f02ad['adminId'];_0x329401=!![];}if(_0x329401){_0x3dc8bd(_0x3f02ad);}else{_0x26cd53({'statusCode':0x194,'message':_0x302e('0x17')});}}else{_0x26cd53({'statusCode':0x194,'message':_0x302e('0x17')});}})[_0x302e('0x18')](function(_0x11041a){logger[_0x302e('0x21')]('['+[_0x6d8201[_0x302e('0x19')]()]+']',_0x11041a[_0x302e('0x22')]);_0x26cd53(_0x11041a);});});};}function searchContact(_0x21ddcd,_0x22de27,_0x1d6541,_0x1c984a){return new Promise(function(_0x274e6d,_0xcb4e98){var _0xa719a1={'method':'GET','headers':_0x22de27,'uri':_0x21ddcd+'/api/lookup?q='+_0x1c984a+_0x302e('0x23')+_0x1d6541+'&entities=contact','json':!![]};rp(_0xa719a1)[_0x302e('0x1b')](function(_0x340f1b){var _0x15ddc4=_['find'](_0x340f1b[_0x302e('0x24')][_0x302e('0x24')],[_0x1d6541,_0x1c984a]);_0x274e6d(_0x15ddc4);})[_0x302e('0x18')](function(_0x3384b5){_0xcb4e98(_0x3384b5);});});}function getEndUser(_0x1f4095,_0x2c5e6a,_0xbc019e){return function(_0x100507){return new Promise(function(_0x1f671f,_0x1e8ecb){logger['info'](util[_0x302e('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x100507[_0x302e('0x26')]));searchContact(_0xbc019e,_0x2c5e6a,_0x302e('0x27'),_0x100507[_0x302e('0x26')])[_0x302e('0x1b')](function(_0x3ac429){if(_0x3ac429){_0x100507[_0x302e('0x28')]=_0x3ac429['id'];logger[_0x302e('0xf')]('Contact\x20found\x20mobile_number:',_0x100507[_0x302e('0x28')]);return _0x1f671f(_0x100507);}searchContact(_0xbc019e,_0x2c5e6a,_0x302e('0x29'),_0x100507[_0x302e('0x26')])[_0x302e('0x1b')](function(_0x4d9897){if(_0x4d9897){_0x100507[_0x302e('0x28')]=_0x4d9897['id'];logger[_0x302e('0xf')](_0x302e('0x2a'),_0x100507[_0x302e('0x28')]);return _0x1f671f(_0x100507);}createEndUser(_0x100507,_0x1f4095,_0x2c5e6a,_0xbc019e)['then'](function(_0x4f7e6d){logger[_0x302e('0xf')]('Contact\x20created:',_0x4f7e6d[_0x302e('0x28')]);return _0x1f671f(_0x4f7e6d);});});})[_0x302e('0x18')](function(_0x4065e4){_0x1e8ecb(_0x4065e4);});});};}function createEndUser(_0x4c2a3c,_0x32d11f,_0x1eb8f0,_0x36dc87){return new Promise(function(_0x111a4f,_0x222042){var _0x707023=moment();var _0x29ff02={'method':_0x302e('0x2b'),'uri':_0x36dc87+_0x302e('0x2c'),'body':{'contact':{'last_name':_0x4c2a3c['contactNumber'],'work_number':_0x4c2a3c[_0x302e('0x26')],'mobile_number':_0x4c2a3c[_0x302e('0x26')],'owner_id':_0x4c2a3c['userId'],'created_at':_0x707023[_0x302e('0x25')](_0x302e('0x2d'))}},'json':!![]};_0x29ff02[_0x302e('0x2e')]=_0x1eb8f0;logger[_0x302e('0xf')](_0x302e('0x2f'));return rp(_0x29ff02)[_0x302e('0x1b')](function(_0x16a715){_0x4c2a3c[_0x302e('0x28')]=_0x16a715[_0x302e('0x30')]['id'];_0x111a4f(_0x4c2a3c);})[_0x302e('0x18')](function(_0x3857cc){logger[_0x302e('0x21')]('['+[_0x32d11f[_0x302e('0x19')]()]+']',_0x3857cc[_0x302e('0x22')]);_0x222042(_0x3857cc[_0x302e('0x22')]);});});}function getTicket(_0xefb061,_0x36ab05,_0x1aabb4,_0x582af8,_0x3f41a4){return function(_0x33475e){logger[_0x302e('0xf')](_0x302e('0x31'));return new Promise(function(_0xb7f531,_0x2ec5b6){var _0x37b6ef=moment();var _0x413ab4={'method':_0x302e('0x2b'),'uri':_0x1aabb4+'/api/tasks','body':{'title':intUtil['getString'](_0x582af8[_0x302e('0x32')],_0x3f41a4,'\x20'),'description':intUtil[_0x302e('0x33')](_0x582af8[_0x302e('0x34')],_0x3f41a4,'\x0a'),'owner_id':_0x33475e[_0x302e('0x20')],'creater_id':_0x33475e[_0x302e('0x15')],'targetable_id':_0x33475e['endUserId'],'targetable_type':_0x302e('0x35'),'created_at':_0x37b6ef[_0x302e('0x25')](_0x302e('0x2d')),'due_date':_0x37b6ef[_0x302e('0x36')](0x1e,'m')[_0x302e('0x25')](_0x302e('0x2d'))},'json':!![]};_0x413ab4[_0x302e('0x2e')]=_0x36ab05;return rp(_0x413ab4)[_0x302e('0x1b')](function(_0x1c185f){_0x33475e[_0x302e('0x37')]=_0x1c185f[_0x302e('0x38')]['id'];logger[_0x302e('0xf')](_0x302e('0x39'),_0x33475e[_0x302e('0x37')]);_0xb7f531(_0x33475e);})[_0x302e('0x18')](function(_0xaee50f){logger[_0x302e('0x21')]('['+[_0xefb061[_0x302e('0x19')]()]+']',_0xaee50f[_0x302e('0x22')]);_0x2ec5b6(_0xaee50f[_0x302e('0x22')]);});});};}function emit(_0x3a53ff,_0xc45c71,_0x5acd0d){var _0x4f2453={'uri':_0x3a53ff+_0x302e('0x3a')+_0x5acd0d};io['to'](util[_0x302e('0x25')]('user:%s',_0xc45c71))[_0x302e('0x3b')](_0x302e('0x3c'),_0x4f2453);}exports['cs']=function(_0x3fc689,_0x2f843d,_0x5ef956,_0x4312c2,_0x157b7a,_0x5bab21,_0x4c5d8a,_0x40ffaa){var _0x456909={};var _0x4d684d={'Authorization':_0x302e('0x3d')+_0x5bab21[_0x302e('0x3e')]};_0x5bab21[_0x302e('0x3f')]=intUtil['stripTrailingSlash'](_0x5bab21[_0x302e('0x3f')]);_0x5bab21[_0x302e('0x40')]=intUtil[_0x302e('0x41')](_0x5bab21['serverUrl']);var _0x43b90a=_0x5bab21[_0x302e('0x3f')];_0x456909[_0x302e('0x14')]=_0x5bab21['username'];_0x456909['contactNumber']=_0x40ffaa[_0x302e('0x42')]()===_0x302e('0x43')?_0x2f843d[_0x302e('0x44')]:_0x2f843d[_0x302e('0x45')];_0x456909[_0x302e('0x46')]=_0x40ffaa==='queue'||_0x40ffaa===_0x302e('0x47')?_0x302e('0x48'):_0x302e('0x43');if(_0x4312c2){_0x456909[_0x302e('0x1c')]=_0x4312c2[_0x302e('0x13')];}var _0x4f9b15=util[_0x302e('0x25')](_0x302e('0x49'),_0x5bab21[_0x302e('0x40')],_0x2f843d[_0x302e('0x4a')],md5(_0x2f843d[_0x302e('0x4a')]));if(_0x157b7a&&_0x157b7a[_0x302e('0x4b')]){logger[_0x302e('0xf')](_0x302e('0x4c'),_0x302e('0x4d'));_0x2f843d[_0x302e('0x4e')]=_0x4f9b15;}else if(_0x4c5d8a&&_0x4c5d8a['recordingFormat']&&_0x4c5d8a['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x302e('0x4d'));_0x2f843d[_0x302e('0x4e')]=_0x4f9b15;}else{_0x2f843d[_0x302e('0x4e')]='';}return getAdminId(_0x456909,_0x40ffaa,_0x4d684d,_0x43b90a)[_0x302e('0x1b')](getUser(_0x40ffaa,_0x4d684d,_0x43b90a))[_0x302e('0x1b')](getEndUser(_0x40ffaa,_0x4d684d,_0x43b90a))[_0x302e('0x1b')](getTicket(_0x40ffaa,_0x4d684d,_0x43b90a,_0x5ef956,_0x2f843d))['then'](function(_0x3448c3){logger[_0x302e('0xf')](util['format'](_0x302e('0x4f'),_0x3448c3[_0x302e('0x37')]));if(_0x40ffaa!==_0x302e('0x47')){logger['info']('['+[_0x40ffaa[_0x302e('0x19')]()]+']',_0x302e('0x50'));emit(_0x43b90a,_0x4312c2['name'],_0x3448c3[_0x302e('0x28')]);}})[_0x302e('0x18')](function(_0x1df57f){logger[_0x302e('0x21')]('['+[_0x40ffaa[_0x302e('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x1df57f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4b43=['message','Getting\x20user\x20list','then','users','agentEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x4b43,0x1c3));var _0x34b4=function(_0x1f4d3c,_0x4a7f6c){_0x1f4d3c=_0x1f4d3c-0x0;var _0x51e27b=_0x4b43[_0x1f4d3c];return _0x51e27b;};'use strict';var _=require(_0x34b4('0x0'));var rp=require(_0x34b4('0x1'));var md5=require(_0x34b4('0x2'));var util=require('util');var moment=require(_0x34b4('0x3'));var Promise=require('bluebird');var Redis=require(_0x34b4('0x4'));var intUtil=require(_0x34b4('0x5'));var config=require(_0x34b4('0x6'));var logger=require(_0x34b4('0x7'))('freshsales');config[_0x34b4('0x8')]=_['defaults'](config[_0x34b4('0x8')],{'host':_0x34b4('0x9'),'port':0x18eb});var io=require(_0x34b4('0xa'))(new Redis(config['redis']));function getAdminId(_0x3d5e97,_0x1f2ddf,_0x561b0b,_0x3ba7c9){return new Promise(function(_0xcb89af,_0x4916f3){var _0x4d6fe0=![];var _0x4e95a3={'method':_0x34b4('0xb'),'uri':_0x3ba7c9+_0x34b4('0xc'),'json':!![]};_0x4e95a3[_0x34b4('0xd')]=_0x561b0b;logger[_0x34b4('0xe')]('Getting\x20admin\x20information');return rp(_0x4e95a3)['then'](function(_0x2fa836){if(_0x2fa836){var _0x4161d0=_0x2fa836['users'];var _0x2e7c9d=null;for(_0x2e7c9d=0x0;_0x2e7c9d<_0x4161d0[_0x34b4('0xf')];_0x2e7c9d++){if(_0x4161d0[_0x2e7c9d][_0x34b4('0x10')]===_0x3d5e97['adminEmail']){_0x3d5e97[_0x34b4('0x11')]=_0x4161d0[_0x2e7c9d]['id'];_0x4d6fe0=!![];}}if(_0x4d6fe0){logger[_0x34b4('0xe')](_0x34b4('0x12'),_0x3d5e97[_0x34b4('0x11')]);_0xcb89af(_0x3d5e97);}else{_0x4916f3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4916f3({'statusCode':0x194,'message':_0x34b4('0x13')});}})[_0x34b4('0x14')](function(_0x4c0c1b){logger[_0x34b4('0x15')]('['+[_0x1f2ddf[_0x34b4('0x16')]()]+']',_0x4c0c1b[_0x34b4('0x17')]);_0x4916f3(_0x4c0c1b);});});}function getUser(_0x46e815,_0x31391c,_0x5cc2bc){return function(_0x3670da){return new Promise(function(_0x5aab6b,_0x5430e3){var _0x243d8b={'method':_0x34b4('0xb'),'uri':_0x5cc2bc+_0x34b4('0xc'),'json':!![]};_0x243d8b[_0x34b4('0xd')]=_0x31391c;logger[_0x34b4('0xe')](_0x34b4('0x18'));return rp(_0x243d8b)[_0x34b4('0x19')](function(_0x3f24d1){if(_0x3f24d1){var _0x45f1c2=_0x3f24d1[_0x34b4('0x1a')];var _0x596908=![];var _0xc1fbd4=null;if(_0x3670da[_0x34b4('0x1b')]!==null){logger[_0x34b4('0xe')]('Getting\x20user\x20with\x20email',_0x3670da[_0x34b4('0x1b')]);_0x3670da['userEmail']=_0x3670da[_0x34b4('0x1b')];for(_0xc1fbd4=0x0;_0xc1fbd4<_0x45f1c2[_0x34b4('0xf')];_0xc1fbd4++){if(_0x45f1c2[_0xc1fbd4]['email']===_0x3670da[_0x34b4('0x1b')]){_0x596908=!![];_0x3670da[_0x34b4('0x1c')]=_0x45f1c2[_0xc1fbd4]['id'];logger['info'](_0x34b4('0x1d'),_0x3670da[_0x34b4('0x1c')]);}}}if(!_0x596908){logger[_0x34b4('0xe')](_0x34b4('0x1e'));_0x3670da['userEmail']=_0x3670da[_0x34b4('0x1f')];_0x3670da['userId']=_0x3670da[_0x34b4('0x11')];_0x596908=!![];}if(_0x596908){_0x5aab6b(_0x3670da);}else{_0x5430e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5430e3({'statusCode':0x194,'message':_0x34b4('0x13')});}})[_0x34b4('0x14')](function(_0xa97dd0){logger[_0x34b4('0x15')]('['+[_0x46e815['toUpperCase']()]+']',_0xa97dd0[_0x34b4('0x17')]);_0x5430e3(_0xa97dd0);});});};}function searchContact(_0x52068a,_0x1b6804,_0x25b0cc,_0x140235){return new Promise(function(_0x37bbe3,_0x4ece40){var _0x10d9b8={'method':'GET','headers':_0x1b6804,'uri':_0x52068a+_0x34b4('0x20')+_0x140235+'&f='+_0x25b0cc+_0x34b4('0x21'),'json':!![]};rp(_0x10d9b8)[_0x34b4('0x19')](function(_0xf4296e){var _0xee2ac2=_[_0x34b4('0x22')](_0xf4296e[_0x34b4('0x23')]['contacts'],[_0x25b0cc,_0x140235]);_0x37bbe3(_0xee2ac2);})['catch'](function(_0x37419d){_0x4ece40(_0x37419d);});});}function getEndUser(_0x15477a,_0x412b09,_0x123c9e){return function(_0x213a1e){return new Promise(function(_0x5062fd,_0x2711d6){logger['info'](util[_0x34b4('0x24')](_0x34b4('0x25'),_0x213a1e[_0x34b4('0x26')]));searchContact(_0x123c9e,_0x412b09,_0x34b4('0x27'),_0x213a1e[_0x34b4('0x26')])[_0x34b4('0x19')](function(_0x2123a8){if(_0x2123a8){_0x213a1e[_0x34b4('0x28')]=_0x2123a8['id'];logger[_0x34b4('0xe')]('Contact\x20found\x20mobile_number:',_0x213a1e['endUserId']);return _0x5062fd(_0x213a1e);}searchContact(_0x123c9e,_0x412b09,_0x34b4('0x29'),_0x213a1e[_0x34b4('0x26')])[_0x34b4('0x19')](function(_0x386d66){if(_0x386d66){_0x213a1e[_0x34b4('0x28')]=_0x386d66['id'];logger[_0x34b4('0xe')](_0x34b4('0x2a'),_0x213a1e[_0x34b4('0x28')]);return _0x5062fd(_0x213a1e);}createEndUser(_0x213a1e,_0x15477a,_0x412b09,_0x123c9e)[_0x34b4('0x19')](function(_0x9bb31b){logger[_0x34b4('0xe')]('Contact\x20created:',_0x9bb31b['endUserId']);return _0x5062fd(_0x9bb31b);});});})[_0x34b4('0x14')](function(_0x1bfc77){_0x2711d6(_0x1bfc77);});});};}function createEndUser(_0x1d6bda,_0x17742c,_0xabe3da,_0x149937){return new Promise(function(_0x3740cb,_0x2ba7ce){var _0x2ed31e=moment();var _0x2efec4={'method':'POST','uri':_0x149937+_0x34b4('0x2b'),'body':{'contact':{'last_name':_0x1d6bda[_0x34b4('0x26')],'work_number':_0x1d6bda[_0x34b4('0x26')],'mobile_number':_0x1d6bda[_0x34b4('0x26')],'owner_id':_0x1d6bda[_0x34b4('0x1c')],'created_at':_0x2ed31e[_0x34b4('0x24')](_0x34b4('0x2c'))}},'json':!![]};_0x2efec4[_0x34b4('0xd')]=_0xabe3da;logger[_0x34b4('0xe')](_0x34b4('0x2d'));return rp(_0x2efec4)[_0x34b4('0x19')](function(_0x8e1a89){_0x1d6bda[_0x34b4('0x28')]=_0x8e1a89['contact']['id'];_0x3740cb(_0x1d6bda);})[_0x34b4('0x14')](function(_0x5db037){logger['error']('['+[_0x17742c['toUpperCase']()]+']',_0x5db037[_0x34b4('0x17')]);_0x2ba7ce(_0x5db037[_0x34b4('0x17')]);});});}function getTicket(_0x5b709e,_0x24089b,_0x466b7c,_0x3626d0,_0x2b6f73){return function(_0x2b6ab5){logger[_0x34b4('0xe')](_0x34b4('0x2e'));return new Promise(function(_0xd6880c,_0x2027f3){var _0x57b72e=moment();var _0x46e163={'method':_0x34b4('0x2f'),'uri':_0x466b7c+_0x34b4('0x30'),'body':{'title':intUtil[_0x34b4('0x31')](_0x3626d0[_0x34b4('0x32')],_0x2b6f73,'\x20'),'description':intUtil['getString'](_0x3626d0[_0x34b4('0x33')],_0x2b6f73,'\x0a'),'owner_id':_0x2b6ab5['userId'],'creater_id':_0x2b6ab5[_0x34b4('0x11')],'targetable_id':_0x2b6ab5['endUserId'],'targetable_type':_0x34b4('0x34'),'created_at':_0x57b72e[_0x34b4('0x24')](_0x34b4('0x2c')),'due_date':_0x57b72e[_0x34b4('0x35')](0x1e,'m')[_0x34b4('0x24')](_0x34b4('0x2c'))},'json':!![]};_0x46e163[_0x34b4('0xd')]=_0x24089b;return rp(_0x46e163)['then'](function(_0x471c3a){_0x2b6ab5[_0x34b4('0x36')]=_0x471c3a[_0x34b4('0x37')]['id'];logger['info'](_0x34b4('0x38'),_0x2b6ab5[_0x34b4('0x36')]);_0xd6880c(_0x2b6ab5);})[_0x34b4('0x14')](function(_0x581011){logger['error']('['+[_0x5b709e[_0x34b4('0x16')]()]+']',_0x581011[_0x34b4('0x17')]);_0x2027f3(_0x581011[_0x34b4('0x17')]);});});};}function emit(_0x563d97,_0x3c72e3,_0xe4fd4d){var _0xb78bc1={'uri':_0x563d97+_0x34b4('0x39')+_0xe4fd4d};io['to'](util[_0x34b4('0x24')](_0x34b4('0x3a'),_0x3c72e3))[_0x34b4('0x3b')](_0x34b4('0x3c'),_0xb78bc1);}exports['cs']=function(_0x26c2b5,_0x168aa4,_0x26e7bb,_0x4dea4a,_0x1d4904,_0x5165b4,_0x2907fe,_0x4eb919){var _0x282386={};var _0x54eba9={'Authorization':'Token\x20token='+_0x5165b4[_0x34b4('0x3d')]};_0x5165b4[_0x34b4('0x3e')]=intUtil[_0x34b4('0x3f')](_0x5165b4['remoteUri']);_0x5165b4[_0x34b4('0x40')]=intUtil[_0x34b4('0x3f')](_0x5165b4['serverUrl']);var _0x16acc9=_0x5165b4[_0x34b4('0x3e')];_0x282386[_0x34b4('0x1f')]=_0x5165b4['username'];_0x282386[_0x34b4('0x26')]=_0x4eb919[_0x34b4('0x41')]()===_0x34b4('0x42')?_0x168aa4[_0x34b4('0x43')]:_0x168aa4['calleridnum'];_0x282386['callDirection']=_0x4eb919==='queue'||_0x4eb919===_0x34b4('0x44')?'queue':_0x34b4('0x42');if(_0x4dea4a){_0x282386[_0x34b4('0x1b')]=_0x4dea4a[_0x34b4('0x10')];}var _0x2973a9=util[_0x34b4('0x24')](_0x34b4('0x45'),_0x5165b4[_0x34b4('0x40')],_0x168aa4[_0x34b4('0x46')],md5(_0x168aa4['uniqueid']));if(_0x1d4904&&_0x1d4904[_0x34b4('0x47')]){logger[_0x34b4('0xe')]('[QUEUE]',_0x34b4('0x48'));_0x168aa4[_0x34b4('0x49')]=_0x2973a9;}else if(_0x2907fe&&_0x2907fe[_0x34b4('0x4a')]&&_0x2907fe[_0x34b4('0x4a')]!==_0x34b4('0x4b')){logger[_0x34b4('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x168aa4[_0x34b4('0x49')]=_0x2973a9;}else{_0x168aa4[_0x34b4('0x49')]='';}return getAdminId(_0x282386,_0x4eb919,_0x54eba9,_0x16acc9)[_0x34b4('0x19')](getUser(_0x4eb919,_0x54eba9,_0x16acc9))[_0x34b4('0x19')](getEndUser(_0x4eb919,_0x54eba9,_0x16acc9))[_0x34b4('0x19')](getTicket(_0x4eb919,_0x54eba9,_0x16acc9,_0x26e7bb,_0x168aa4))['then'](function(_0x4ae87e){logger[_0x34b4('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x4ae87e[_0x34b4('0x36')]));if(_0x4eb919!=='unmanaged'){logger[_0x34b4('0xe')]('['+[_0x4eb919[_0x34b4('0x16')]()]+']',_0x34b4('0x4c'));emit(_0x16acc9,_0x4dea4a[_0x34b4('0x4d')],_0x4ae87e[_0x34b4('0x28')]);}})['catch'](function(_0x5fa6a0){logger[_0x34b4('0x15')]('['+[_0x4eb919[_0x34b4('0x16')]()]+_0x34b4('0x4e'),util['inspect'](_0x5fa6a0,{'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 80473f8..c01f12a 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 _0xcbe7=['freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./desk','./dynamics365','./freshsales','salesforce','sugarcrm'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcbe7,0xa7));var _0x7cbe=function(_0x16f3a0,_0x48c19e){_0x16f3a0=_0x16f3a0-0x0;var _0x555d25=_0xcbe7[_0x16f3a0];return _0x555d25;};'use strict';var _=require('lodash');var util=require(_0x7cbe('0x0'));var zendesk=require(_0x7cbe('0x1'));var salesforce=require(_0x7cbe('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x7cbe('0x3'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x7cbe('0x4'));var freshsales=require(_0x7cbe('0x5'));var integrations=['zendesk',_0x7cbe('0x6'),_0x7cbe('0x7'),_0x7cbe('0x8'),_0x7cbe('0x9'),'desk',_0x7cbe('0xa'),_0x7cbe('0xb'),_0x7cbe('0xc'),_0x7cbe('0xd')];exports['exec']=function(_0x8ce36d,_0x1a71d8,_0x4e0c23,_0x145cf6,_0x4963ec,_0x5b8c29){if(_0x4e0c23){if(_[_0x7cbe('0xe')](integrations,_0x8ce36d[_0x7cbe('0xf')][_0x7cbe('0x10')]())){try{var _0x11e0e4=null;var _0x101bdb='';var _0x2fe756=_0x4e0c23[_0x8ce36d[_0x7cbe('0xf')]['toLowerCase']()];if(_0x2fe756){var _0xd9ecd8=_0x2fe756[_0x8ce36d[_0x7cbe('0x11')]];if(_0xd9ecd8){var _0x2b0ba6=_['find'](_0xd9ecd8[_0x7cbe('0x12')],{'id':parseInt(_0x8ce36d[_0x7cbe('0x13')],0xa)});if(_0x2b0ba6){if(_0x145cf6){if(_0x4963ec&&_0x1a71d8[_0x7cbe('0x14')]){_0x101bdb=_0x7cbe('0x14');}else if(_0x1a71d8[_0x7cbe('0x15')]){_0x101bdb=_0x7cbe('0x16');}else{console[_0x7cbe('0x17')](_0x7cbe('0x18'),_0x1a71d8);}}else{_0x101bdb=_0x7cbe('0x19');}switch(_0x8ce36d[_0x7cbe('0xf')]['toLowerCase']()){case _0x7cbe('0x1a'):zendesk[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case'salesforce':salesforce[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0x7'):sugarcrm[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0x8'):freshdesk[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0x9'):zoho[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0x1b'):desk[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0xa'):vtiger[_0x101bdb](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29);break;case _0x7cbe('0xc'):freshsales['cs'](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29,_0x101bdb);break;case _0x7cbe('0xd'):servicenow['cs'](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29,_0x101bdb);break;case _0x7cbe('0xb'):dynamics365['cs'](_0x8ce36d,_0x1a71d8,_0x2b0ba6,_0x145cf6,_0x4963ec,_0xd9ecd8,_0x5b8c29,_0x101bdb);break;default:console[_0x7cbe('0x17')](_0x7cbe('0x1c'));}}else{_0x11e0e4=require(_0x7cbe('0x1d'))(_0x8ce36d[_0x7cbe('0xf')]['toLowerCase']());_0x11e0e4['error'](_0x7cbe('0x1e'),util[_0x7cbe('0x1f')](_0x7cbe('0x20'),_0x8ce36d['data1'][_0x7cbe('0x10')](),_0x8ce36d[_0x7cbe('0x13')]));}}else{_0x11e0e4=require(_0x7cbe('0x1d'))(_0x8ce36d[_0x7cbe('0xf')]['toLowerCase']());_0x11e0e4[_0x7cbe('0x21')](_0x7cbe('0x1e'),util['format'](_0x7cbe('0x22'),_0x8ce36d[_0x7cbe('0xf')][_0x7cbe('0x10')](),_0x8ce36d[_0x7cbe('0x11')]));}}else{}}catch(_0x2cddb1){console['error'](_0x2cddb1);}}}}; \ No newline at end of file +var _0x4813=['./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger'];(function(_0x584b9d,_0x1cb5c5){var _0x172053=function(_0x5036ec){while(--_0x5036ec){_0x584b9d['push'](_0x584b9d['shift']());}};_0x172053(++_0x1cb5c5);}(_0x4813,0x1e7));var _0x3481=function(_0x463985,_0x44015b){_0x463985=_0x463985-0x0;var _0x19cefb=_0x4813[_0x463985];return _0x19cefb;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var zendesk=require(_0x3481('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3481('0x3'));var freshdesk=require(_0x3481('0x4'));var zoho=require('./zoho');var desk=require(_0x3481('0x5'));var vtiger=require(_0x3481('0x6'));var servicenow=require(_0x3481('0x7'));var dynamics365=require(_0x3481('0x8'));var freshsales=require(_0x3481('0x9'));var integrations=[_0x3481('0xa'),_0x3481('0xb'),_0x3481('0xc'),'freshdesk','zoho',_0x3481('0xd'),_0x3481('0xe'),_0x3481('0xf'),_0x3481('0x10'),_0x3481('0x11')];exports[_0x3481('0x12')]=function(_0x85e263,_0x2a56e8,_0x5f4060,_0x1148ec,_0x2343f2,_0x4bf517){if(_0x5f4060){if(_[_0x3481('0x13')](integrations,_0x85e263[_0x3481('0x14')][_0x3481('0x15')]())){try{var _0xdb32d8=null;var _0x5dd4c9='';var _0x46d93f=_0x5f4060[_0x85e263[_0x3481('0x14')][_0x3481('0x15')]()];if(_0x46d93f){var _0x2d96c2=_0x46d93f[_0x85e263[_0x3481('0x16')]];if(_0x2d96c2){var _0x493a1c=_[_0x3481('0x17')](_0x2d96c2[_0x3481('0x18')],{'id':parseInt(_0x85e263[_0x3481('0x19')],0xa)});if(_0x493a1c){if(_0x1148ec){if(_0x2343f2&&_0x2a56e8[_0x3481('0x1a')]){_0x5dd4c9='queue';}else if(_0x2a56e8['routeId']){_0x5dd4c9=_0x3481('0x1b');}else{console[_0x3481('0x1c')](_0x3481('0x1d'),_0x2a56e8);}}else{_0x5dd4c9=_0x3481('0x1e');}switch(_0x85e263[_0x3481('0x14')]['toLowerCase']()){case _0x3481('0xa'):zendesk[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case'salesforce':salesforce[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case _0x3481('0xc'):sugarcrm[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case _0x3481('0x1f'):freshdesk[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case'zoho':zoho[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case _0x3481('0xd'):desk[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case'vtiger':vtiger[_0x5dd4c9](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517);break;case _0x3481('0x10'):freshsales['cs'](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517,_0x5dd4c9);break;case _0x3481('0x11'):servicenow['cs'](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517,_0x5dd4c9);break;case _0x3481('0xf'):dynamics365['cs'](_0x85e263,_0x2a56e8,_0x493a1c,_0x1148ec,_0x2343f2,_0x2d96c2,_0x4bf517,_0x5dd4c9);break;default:console[_0x3481('0x1c')]('unknown\x20integration');}}else{_0xdb32d8=require(_0x3481('0x20'))(_0x85e263[_0x3481('0x14')]['toLowerCase']());_0xdb32d8[_0x3481('0x21')](_0x3481('0x22'),util[_0x3481('0x23')](_0x3481('0x24'),_0x85e263['data1']['toLowerCase'](),_0x85e263['data3']));}}else{_0xdb32d8=require(_0x3481('0x20'))(_0x85e263[_0x3481('0x14')]['toLowerCase']());_0xdb32d8[_0x3481('0x21')](_0x3481('0x22'),util[_0x3481('0x23')](_0x3481('0x25'),_0x85e263['data1'][_0x3481('0x15')](),_0x85e263[_0x3481('0x16')]));}}else{}}catch(_0x4af844){console['error'](_0x4af844);}}}}; \ 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 53683df..081ecb0 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 _0x2bf2=['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','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','serverUrl','recordingFormat','none','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','emit','getString','Descriptions','Task','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone'];(function(_0x179e6c,_0x17bcd3){var _0x5594aa=function(_0x43245e){while(--_0x43245e){_0x179e6c['push'](_0x179e6c['shift']());}};_0x5594aa(++_0x17bcd3);}(_0x2bf2,0xc5));var _0x22bf=function(_0x180679,_0x17461e){_0x180679=_0x180679-0x0;var _0x3f28d9=_0x2bf2[_0x180679];return _0x3f28d9;};'use strict';var _=require(_0x22bf('0x0'));var rp=require(_0x22bf('0x1'));var moment=require('moment');var BPromise=require(_0x22bf('0x2'));var md5=require(_0x22bf('0x3'));var jsforce=require(_0x22bf('0x4'));var util=require(_0x22bf('0x5'));var Redis=require(_0x22bf('0x6'));var intUtil=require('./util');var config=require(_0x22bf('0x7'));var logger=require('../../../../config/logger')('salesforce');config[_0x22bf('0x8')]=_['defaults'](config[_0x22bf('0x8')],{'host':_0x22bf('0x9'),'port':0x18eb});var io=require(_0x22bf('0xa'))(new Redis(config[_0x22bf('0x8')]));function emit(_0x69cfa0,_0x5c9cd0,_0x38be44){io['to'](_0x69cfa0)[_0x22bf('0xb')](_0x5c9cd0,_0x38be44);}function getTicket(_0x2fe724,_0x1df561,_0x2e6d3e,_0x5ae243,_0x210eb1,_0xd3e81d,_0x541880,_0x5933a6){var _0x4492fb=Object['assign']({},{'OwnerId':_0x1df561['id'],'Subject':intUtil[_0x22bf('0xc')](_0x5ae243['Subjects'],_0x210eb1,'\x20'),'Description':intUtil[_0x22bf('0xc')](_0x5ae243[_0x22bf('0xd')],_0x210eb1,'\x0a')},getCustomFields(_0xd3e81d,_0x210eb1));if(_0x2e6d3e){if(_0x5ae243['ticketType']===_0x22bf('0xe')){_0x4492fb['ActivityDate']=moment[_0x22bf('0xf')]();_0x4492fb['IsReminderSet']=![];_0x4492fb[_0x22bf('0x10')]=![];if(_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x12')||_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x13')){_0x4492fb[_0x22bf('0x14')]=_0x2e6d3e['id'];}else if(_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x15')){_0x4492fb[_0x22bf('0x16')]=_0x2e6d3e['id'];}}else if(_0x5ae243[_0x22bf('0x17')]===_0x22bf('0x18')){if(_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x12')){_0x4492fb[_0x22bf('0x19')]=_0x2e6d3e['id'];}else if(_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x15')){_0x4492fb[_0x22bf('0x1a')]=_0x2e6d3e['id'];}else if(_0x2e6d3e[_0x22bf('0x11')]===_0x22bf('0x13')&&_0x5ae243[_0x22bf('0x1b')]){_0x4492fb[_0x5ae243[_0x22bf('0x1b')]]=_0x2e6d3e['id'];}else{logger[_0x22bf('0x1c')](_0x22bf('0x1d'));}}}return _0x541880[_0x22bf('0x1e')](_0x5ae243[_0x22bf('0x17')])[_0x22bf('0x1f')](_0x4492fb);}function getUser(_0x2a6995,_0x501977,_0x2e9463){if(!_[_0x22bf('0x20')](_0x501977)&&intUtil[_0x22bf('0x21')](_0x501977)){var _0x5ce1fc={'Email':_0x501977};var _0xd1cd27={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2e9463['sobject'](_0x22bf('0x22'))[_0x22bf('0x23')](_0x5ce1fc,_0xd1cd27)[_0x22bf('0x24')]()['then'](function(_0x3bedb5){if(_0x3bedb5['length']){var _0x423526=_['find'](_0x3bedb5,function(_0x1b15be){return _0x1b15be[_0x22bf('0x25')]===_0x501977;});if(_0x423526){logger[_0x22bf('0x1c')](_0x22bf('0x26'),_0x501977);return BPromise[_0x22bf('0x27')]({'id':_0x423526['Id'],'name':_0x423526[_0x22bf('0x28')]});}}else{logger[_0x22bf('0x1c')](_0x22bf('0x29'),_0x501977);return _0x2e9463['identity']()[_0x22bf('0x2a')](function(_0x29ce85){return BPromise['resolve']({'id':_0x29ce85[_0x22bf('0x2b')],'name':_0x29ce85[_0x22bf('0x2c')]});});}});}else{logger[_0x22bf('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x501977);return _0x2e9463[_0x22bf('0x2d')]()['then'](function(_0x43e38a){return BPromise[_0x22bf('0x27')]({'id':_0x43e38a['user_id'],'name':_0x43e38a[_0x22bf('0x2c')]});});}}function getEndUser(_0x7ee6d6,_0x579b33,_0x495e14,_0x984332,_0x38a184){var _0x52cced={'$or':{'Phone':_0x984332}};var _0x56173d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x22bf('0x27')]()[_0x22bf('0x2a')](function(){logger[_0x22bf('0x1c')](_0x22bf('0x2e'),_0x984332,_0x579b33['moduleSearch']);switch(_0x579b33[_0x22bf('0x2f')]){case _0x22bf('0x30'):var _0x54f536=_[_0x22bf('0x31')](_0x52cced);if(_0x579b33[_0x22bf('0x32')]){var _0x1bb035={};_0x1bb035[_0x579b33[_0x22bf('0x32')]]=_0x984332;_['merge'](_0x54f536[_0x22bf('0x33')],_0x1bb035);}return _0x38a184[_0x22bf('0x1e')]('Contact')[_0x22bf('0x23')](_0x54f536,_0x56173d)['execute']()[_0x22bf('0x2a')](function(_0x361b16){if(_0x361b16&&_0x361b16[_0x22bf('0x34')]){return _0x361b16;}else{var _0x56f68a=_['cloneDeep'](_0x52cced);if(_0x579b33[_0x22bf('0x35')]){var _0x1c86d6={};_0x1c86d6[_0x579b33['additionalSearchLead']]=_0x984332;_[_0x22bf('0x36')](_0x56f68a['$or'],_0x1c86d6);}return _0x38a184['sobject'](_0x22bf('0x37'))[_0x22bf('0x23')](_0x56f68a,_0x56173d);}});case _0x22bf('0x38'):var _0x24185f=_['cloneDeep'](_0x52cced);if(_0x579b33[_0x22bf('0x39')]){var _0x1bb035={};_0x1bb035[_0x579b33[_0x22bf('0x39')]]=_0x984332;_[_0x22bf('0x36')](_0x24185f[_0x22bf('0x33')],_0x1bb035);}return _0x38a184['sobject'](_0x22bf('0x3a'))['find'](_0x24185f,_0x56173d)[_0x22bf('0x24')]()[_0x22bf('0x2a')](function(_0x5c0c53){if(_0x5c0c53&&_0x5c0c53['length']){return _0x5c0c53;}else{var _0x4e0701=_[_0x22bf('0x31')](_0x52cced);if(_0x579b33[_0x22bf('0x32')]){var _0x1daf7b={};_0x1daf7b[_0x579b33[_0x22bf('0x32')]]=_0x984332;_[_0x22bf('0x36')](_0x4e0701[_0x22bf('0x33')],_0x1daf7b);}return _0x38a184[_0x22bf('0x1e')]('Contact')[_0x22bf('0x23')](_0x4e0701,_0x56173d)[_0x22bf('0x2a')](function(_0x362a83){if(_0x362a83&&_0x362a83[_0x22bf('0x34')]){return _0x362a83;}else{var _0xd19192=_[_0x22bf('0x31')](_0x52cced);if(_0x579b33[_0x22bf('0x35')]){var _0x3758dd={};_0x3758dd[_0x579b33[_0x22bf('0x35')]]=_0x984332;_['merge'](_0xd19192['$or'],_0x3758dd);}return _0x38a184[_0x22bf('0x1e')](_0x22bf('0x37'))['find'](_0xd19192,_0x56173d);}});}});case _0x22bf('0x12'):var _0x54f536=_['cloneDeep'](_0x52cced);if(_0x579b33['additionalSearchContact']){var _0x1bb035={};_0x1bb035[_0x579b33[_0x22bf('0x32')]]=_0x984332;_['merge'](_0x54f536[_0x22bf('0x33')],_0x1bb035);}return _0x38a184[_0x22bf('0x1e')]('Contact')[_0x22bf('0x23')](_0x54f536,_0x56173d)[_0x22bf('0x24')]();case _0x22bf('0x13'):var _0x1a58f4=_[_0x22bf('0x31')](_0x52cced);if(_0x579b33['additionalSearchLead']){var _0x1bb035={};_0x1bb035[_0x579b33[_0x22bf('0x35')]]=_0x984332;_[_0x22bf('0x36')](_0x1a58f4[_0x22bf('0x33')],_0x1bb035);}return _0x38a184[_0x22bf('0x1e')](_0x22bf('0x37'))[_0x22bf('0x23')](_0x1a58f4,_0x56173d);case'account':var _0x24185f=_[_0x22bf('0x31')](_0x52cced);if(_0x579b33[_0x22bf('0x39')]){var _0x1bb035={};_0x1bb035[_0x579b33[_0x22bf('0x39')]]=_0x984332;_[_0x22bf('0x36')](_0x24185f['$or'],_0x1bb035);}return _0x38a184[_0x22bf('0x1e')](_0x22bf('0x3a'))[_0x22bf('0x23')](_0x24185f,_0x56173d);default:return null;}})[_0x22bf('0x2a')](function(_0x2f7981){if(_0x2f7981&&_0x2f7981[_0x22bf('0x34')]){var _0x3d7374=_[_0x22bf('0x3b')](_0x2f7981);if(_0x3d7374){return BPromise['resolve']({'id':_0x3d7374['Id'],'name':_0x3d7374[_0x22bf('0x28')],'phone':_0x3d7374[_0x22bf('0x3c')],'endUserType':_0x3d7374[_0x22bf('0x3d')][_0x22bf('0x3e')][_0x22bf('0x3f')]()});}}})[_0x22bf('0x2a')](function(_0x13a98f){if(_0x13a98f){logger['info'](_0x22bf('0x40'),_0x13a98f[_0x22bf('0x11')],_0x984332);return BPromise['resolve'](_0x13a98f);}else{logger[_0x22bf('0x1c')](_0x22bf('0x41'),_0x984332);var _0x486f26={'Phone':_0x984332};if(_0x579b33[_0x22bf('0x42')]){if(_0x579b33[_0x22bf('0x42')]===_0x22bf('0x12')){logger[_0x22bf('0x1c')](_0x22bf('0x43'),_0x984332,_0x579b33['moduleCreate']);_0x486f26[_0x22bf('0x44')]=_0x495e14!==_0x22bf('0x45')?_0x495e14:util['format']('Caller\x20-\x20%s',_0x984332);}else if(_0x579b33[_0x22bf('0x42')]==='lead'){logger[_0x22bf('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x984332,_0x579b33[_0x22bf('0x42')]);_0x486f26['LastName']=_0x495e14!==_0x22bf('0x45')?_0x495e14:util[_0x22bf('0x46')]('Caller\x20-\x20%s',_0x984332);_0x486f26['Company']=_0x22bf('0x47');}else if(_0x579b33[_0x22bf('0x42')]==='account'){logger[_0x22bf('0x1c')](_0x22bf('0x43'),_0x984332,_0x579b33['moduleCreate']);_0x486f26[_0x22bf('0x28')]=_0x495e14!==_0x22bf('0x45')?_0x495e14:util['format']('Caller\x20-\x20%s',_0x984332);}else{return null;}}return _0x38a184[_0x22bf('0x1e')](_[_0x22bf('0x48')](_0x579b33[_0x22bf('0x42')]))[_0x22bf('0x1f')](_0x486f26)['then'](function(_0x17a390){return BPromise[_0x22bf('0x27')]({'id':_0x17a390['id'],'endUserType':_0x579b33['moduleCreate']});});}});}function getCustomFields(_0x5ae470,_0x52df2d){var _0x545331={};if(_0x5ae470['length']>0x0){_[_0x22bf('0x49')](_0x5ae470,function(_0x24d53a){if(_[_0x22bf('0x4a')]([_0x22bf('0x4b'),_0x22bf('0x4c')],_0x24d53a[_0x22bf('0x3e')])&&_0x24d53a[_0x22bf('0x4d')]){_0x545331[_0x24d53a[_0x22bf('0x4d')]]=_0x24d53a[_0x22bf('0x4e')][_0x22bf('0x4f')]();}else if(_0x24d53a[_0x22bf('0x3e')]===_0x22bf('0x50')&&_0x24d53a[_0x22bf('0x51')]&&_0x24d53a[_0x22bf('0x4d')]){_0x52df2d[_0x24d53a[_0x22bf('0x51')]]&&(_0x545331[_0x24d53a[_0x22bf('0x4d')]]=_0x52df2d[_0x24d53a[_0x22bf('0x51')]][_0x22bf('0x4f')]());}else if(_0x24d53a[_0x22bf('0x3e')]===_0x22bf('0x52')&&_0x24d53a[_0x22bf('0x53')]&&_0x24d53a[_0x22bf('0x53')][_0x22bf('0x54')]&&_0x24d53a[_0x22bf('0x4d')]){_0x52df2d[_0x24d53a['Variable'][_0x22bf('0x54')][_0x22bf('0x3f')]()]&&(_0x545331[_0x24d53a['idField']]=_0x52df2d[_0x24d53a[_0x22bf('0x53')]['name'][_0x22bf('0x3f')]()]['toString']());}});}return _0x545331;}function getConnection(_0xac1fee){var _0x3c7987=_0xac1fee[_0x22bf('0x55')][_0x22bf('0x56')](_0xac1fee[_0x22bf('0x57')]);var _0x127735=new jsforce[(_0x22bf('0x58'))]({'oauth2':{'loginUrl':_0xac1fee[_0x22bf('0x59')]||_0x22bf('0x5a'),'clientId':_0xac1fee[_0x22bf('0x5b')],'clientSecret':_0xac1fee[_0x22bf('0x5c')]}});return _0x127735[_0x22bf('0x5d')](_0xac1fee[_0x22bf('0x5e')],_0x3c7987)['then'](function(){logger[_0x22bf('0x1c')](_0x22bf('0x5f'));return _0x127735;});}exports[_0x22bf('0x60')]=function(_0x10aa6e,_0x4b2db0,_0x3a57d5,_0x3401f2,_0x2e5daf,_0x482346){var _0x33d4b6,_0xa098dd,_0x204e05,_0x4dbf04;_0x482346['serverUrl']=intUtil[_0x22bf('0x61')](_0x482346['serverUrl']);_0x482346['remoteUri']=intUtil[_0x22bf('0x61')](_0x482346[_0x22bf('0x59')]);if(_0x2e5daf&&_0x2e5daf['monitor_format']){logger[_0x22bf('0x1c')]('[QUEUE]',_0x22bf('0x62'));_0x4b2db0[_0x22bf('0x63')]=util[_0x22bf('0x46')](_0x22bf('0x64'),_0x482346['serverUrl'],_0x4b2db0[_0x22bf('0x65')],md5(_0x4b2db0[_0x22bf('0x65')]));}else{_0x4b2db0['recordingURL']='';}return getConnection(_0x482346)[_0x22bf('0x2a')](function(_0x350815){_0x4dbf04=_0x350815;return getUser(_0x482346,_0x3401f2['email'],_0x4dbf04);})['then'](function(_0x107451){_0x33d4b6=_0x107451;return getEndUser(_0x482346,_0x3a57d5,_0x4b2db0[_0x22bf('0x66')],_0x4b2db0['calleridnum'],_0x4dbf04);})[_0x22bf('0x2a')](function(_0x12aecd){_0xa098dd=_0x12aecd;return getTicket(_0x482346,_0x33d4b6,_0xa098dd,_0x3a57d5,_0x4b2db0,_0x3a57d5['Fields'],_0x4dbf04,'queue');})['then'](function(_0x3aa7f6){_0x204e05=_0x3aa7f6;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x204e05['id']);logger[_0x22bf('0x1c')](_0x22bf('0x67'),_0x204e05['id'],_0x3401f2[_0x22bf('0x54')],_0x482346['type']);switch(_0x482346['type']){case _0x22bf('0x68'):emit(util[_0x22bf('0x46')](_0x22bf('0x69'),_0x3401f2[_0x22bf('0x54')]),'trigger:salesforce:display',{'recordId':_0x204e05['id']});break;case _0x22bf('0x6a'):emit(util[_0x22bf('0x46')](_0x22bf('0x69'),_0x3401f2[_0x22bf('0x54')]),_0x22bf('0x6b'),{'uri':util[_0x22bf('0x46')]('%s/%s/e',_0x4dbf04[_0x22bf('0x6c')],_0x204e05['id'])});break;default:logger[_0x22bf('0x6d')](_0x22bf('0x6e'));}})[_0x22bf('0x6f')](function(_0x55548f){logger[_0x22bf('0x6d')](_0x22bf('0x70'),_0x55548f);});};exports[_0x22bf('0x71')]=function(_0x4c8f96,_0x154ff2,_0x4c7412,_0x2c29d7,_0x3473e4,_0x1f4190,_0x3e8040){var _0x116744,_0xb53c17,_0x34617c,_0x4fcc4c;_0x1f4190[_0x22bf('0x72')]=intUtil[_0x22bf('0x61')](_0x1f4190[_0x22bf('0x72')]);_0x1f4190['remoteUri']=intUtil[_0x22bf('0x61')](_0x1f4190[_0x22bf('0x59')]);if(_0x3e8040&&_0x3e8040[_0x22bf('0x73')]&&_0x3e8040[_0x22bf('0x73')]!==_0x22bf('0x74')){logger[_0x22bf('0x1c')]('[OUTBOUND]',_0x22bf('0x62'));_0x154ff2['recordingURL']=util[_0x22bf('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f4190[_0x22bf('0x72')],_0x154ff2[_0x22bf('0x65')],md5(_0x154ff2['uniqueid']));}return getConnection(_0x1f4190)[_0x22bf('0x2a')](function(_0xb22e0e){_0x4fcc4c=_0xb22e0e;return getUser(_0x1f4190,_0x2c29d7['email'],_0x4fcc4c);})['then'](function(_0x5498bb){_0x116744=_0x5498bb;return getEndUser(_0x1f4190,_0x4c7412,_0x154ff2['destcalleridname'],_0x154ff2['destcalleridnum'],_0x4fcc4c);})[_0x22bf('0x2a')](function(_0x6ede33){_0xb53c17=_0x6ede33;return getTicket(_0x1f4190,_0x116744,_0xb53c17,_0x4c7412,_0x154ff2,_0x4c7412[_0x22bf('0x75')],_0x4fcc4c,'outbound');})[_0x22bf('0x2a')](function(_0x44c606){_0x34617c=_0x44c606;logger[_0x22bf('0x1c')](_0x22bf('0x76'),_0x34617c['id']);logger[_0x22bf('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x34617c['id'],_0x2c29d7[_0x22bf('0x54')],_0x1f4190['type']);switch(_0x1f4190[_0x22bf('0x3e')]){case _0x22bf('0x68'):emit(util[_0x22bf('0x46')]('user:%s',_0x2c29d7[_0x22bf('0x54')]),_0x22bf('0x77'),{'recordId':_0x34617c['id']});break;case _0x22bf('0x6a'):emit(util[_0x22bf('0x46')](_0x22bf('0x69'),_0x2c29d7[_0x22bf('0x54')]),_0x22bf('0x6b'),{'uri':util[_0x22bf('0x46')](_0x22bf('0x78'),_0x4fcc4c[_0x22bf('0x6c')],_0x34617c['id'])});break;default:logger[_0x22bf('0x6d')](_0x22bf('0x79'),_0x22bf('0x7a'));}})['catch'](function(_0x24e77a){logger[_0x22bf('0x6d')](_0x22bf('0x79'),_0x24e77a);});};exports['unmanaged']=function(_0x7bbb74,_0x1d194c,_0xe51f46,_0x1d9fc8,_0xb25cac,_0x3f7165){var _0x599a7d,_0x175cdb,_0x3af31a,_0x1170a9;_0x3f7165[_0x22bf('0x72')]=intUtil[_0x22bf('0x61')](_0x3f7165[_0x22bf('0x72')]);_0x3f7165[_0x22bf('0x59')]=intUtil[_0x22bf('0x61')](_0x3f7165[_0x22bf('0x59')]);if(_0xb25cac&&_0xb25cac[_0x22bf('0x7b')]){logger[_0x22bf('0x1c')]('['+_0x1d194c[_0x22bf('0x7c')][_0x22bf('0x7d')]()+']','Recording\x20is\x20enabled!');_0x1d194c[_0x22bf('0x63')]=util[_0x22bf('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f7165[_0x22bf('0x72')],_0x1d194c[_0x22bf('0x65')],md5(_0x1d194c[_0x22bf('0x65')]));}else{_0x1d194c[_0x22bf('0x63')]='';}return getConnection(_0x3f7165)[_0x22bf('0x2a')](function(_0x435aaa){_0x1170a9=_0x435aaa;if(!_[_0x22bf('0x20')](_0x1d9fc8)){return getUser(_0x3f7165,_0x1d9fc8[_0x22bf('0x54')],_0x1170a9);}else{return getUser(_0x3f7165,null,_0x1170a9);}})[_0x22bf('0x2a')](function(_0x4d520e){_0x599a7d=_0x4d520e;return getEndUser(_0x3f7165,_0xe51f46,_0x1d194c[_0x22bf('0x66')],_0x1d194c[_0x22bf('0x7e')],_0x1170a9);})[_0x22bf('0x2a')](function(_0x1e53c5){_0x175cdb=_0x1e53c5;return getTicket(_0x3f7165,_0x599a7d,_0x175cdb,_0xe51f46,_0x1d194c,_0xe51f46[_0x22bf('0x75')],_0x1170a9);})[_0x22bf('0x2a')](function(_0x3d5841){_0x3af31a=_0x3d5841;logger['info']('['+_0x1d194c[_0x22bf('0x7c')][_0x22bf('0x7d')]()+_0x22bf('0x7f'),_0x3af31a['id']);logger['info']('['+_0x1d194c[_0x22bf('0x7c')][_0x22bf('0x7d')]()+_0x22bf('0x80'),_0x3f7165[_0x22bf('0x3e')]);})[_0x22bf('0x6f')](function(_0x2bcd07){logger[_0x22bf('0x6d')]('['+_0x1d194c['lastevent'][_0x22bf('0x7d')]()+']',_0x2bcd07);});}; \ No newline at end of file +var _0xafb5=['sobject','create','isNil','validateEmail','User','find','execute','then','length','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped'];(function(_0x2b062b,_0x59b6af){var _0x5d25d2=function(_0x1f5f9e){while(--_0x1f5f9e){_0x2b062b['push'](_0x2b062b['shift']());}};_0x5d25d2(++_0x59b6af);}(_0xafb5,0x160));var _0x5afb=function(_0x43afeb,_0x51f2cf){_0x43afeb=_0x43afeb-0x0;var _0x1c2b17=_0xafb5[_0x43afeb];return _0x1c2b17;};'use strict';var _=require(_0x5afb('0x0'));var rp=require(_0x5afb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x5afb('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x5afb('0x3'));var intUtil=require('./util');var config=require(_0x5afb('0x4'));var logger=require(_0x5afb('0x5'))(_0x5afb('0x6'));config[_0x5afb('0x7')]=_['defaults'](config[_0x5afb('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5afb('0x8'))(new Redis(config[_0x5afb('0x7')]));function emit(_0x36b934,_0x3804e0,_0x52ad27){io['to'](_0x36b934)[_0x5afb('0x9')](_0x3804e0,_0x52ad27);}function getTicket(_0x1be846,_0x2c734e,_0x1fdef2,_0x1113ad,_0x2df8d1,_0x4c6bba,_0x5db0c9,_0x2a1b6c){var _0x1c03f8=Object[_0x5afb('0xa')]({},{'OwnerId':_0x2c734e['id'],'Subject':intUtil[_0x5afb('0xb')](_0x1113ad['Subjects'],_0x2df8d1,'\x20'),'Description':intUtil[_0x5afb('0xb')](_0x1113ad[_0x5afb('0xc')],_0x2df8d1,'\x0a')},getCustomFields(_0x4c6bba,_0x2df8d1));if(_0x1fdef2){if(_0x1113ad[_0x5afb('0xd')]==='Task'){_0x1c03f8[_0x5afb('0xe')]=moment[_0x5afb('0xf')]();_0x1c03f8[_0x5afb('0x10')]=![];_0x1c03f8[_0x5afb('0x11')]=![];if(_0x1fdef2[_0x5afb('0x12')]===_0x5afb('0x13')||_0x1fdef2[_0x5afb('0x12')]===_0x5afb('0x14')){_0x1c03f8[_0x5afb('0x15')]=_0x1fdef2['id'];}else if(_0x1fdef2[_0x5afb('0x12')]==='account'){_0x1c03f8[_0x5afb('0x16')]=_0x1fdef2['id'];}}else if(_0x1113ad['ticketType']===_0x5afb('0x17')){if(_0x1fdef2[_0x5afb('0x12')]===_0x5afb('0x13')){_0x1c03f8['ContactId']=_0x1fdef2['id'];}else if(_0x1fdef2[_0x5afb('0x12')]===_0x5afb('0x18')){_0x1c03f8[_0x5afb('0x19')]=_0x1fdef2['id'];}else if(_0x1fdef2[_0x5afb('0x12')]===_0x5afb('0x14')&&_0x1113ad[_0x5afb('0x1a')]){_0x1c03f8[_0x1113ad[_0x5afb('0x1a')]]=_0x1fdef2['id'];}else{logger[_0x5afb('0x1b')](_0x5afb('0x1c'));}}}return _0x5db0c9[_0x5afb('0x1d')](_0x1113ad[_0x5afb('0xd')])[_0x5afb('0x1e')](_0x1c03f8);}function getUser(_0x306d1b,_0x30ade0,_0x2243b4){if(!_[_0x5afb('0x1f')](_0x30ade0)&&intUtil[_0x5afb('0x20')](_0x30ade0)){var _0x1df069={'Email':_0x30ade0};var _0x5270b5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2243b4['sobject'](_0x5afb('0x21'))[_0x5afb('0x22')](_0x1df069,_0x5270b5)[_0x5afb('0x23')]()[_0x5afb('0x24')](function(_0x5b3ba3){if(_0x5b3ba3[_0x5afb('0x25')]){var _0x70e21a=_[_0x5afb('0x22')](_0x5b3ba3,function(_0x465ab2){return _0x465ab2['Email']===_0x30ade0;});if(_0x70e21a){logger[_0x5afb('0x1b')]('Agent\x20%s\x20found.',_0x30ade0);return BPromise[_0x5afb('0x26')]({'id':_0x70e21a['Id'],'name':_0x70e21a['Name']});}}else{logger[_0x5afb('0x1b')](_0x5afb('0x27'),_0x30ade0);return _0x2243b4['identity']()[_0x5afb('0x24')](function(_0x25084b){return BPromise['resolve']({'id':_0x25084b[_0x5afb('0x28')],'name':_0x25084b[_0x5afb('0x29')]});});}});}else{logger['info'](_0x5afb('0x27'),_0x30ade0);return _0x2243b4[_0x5afb('0x2a')]()['then'](function(_0x5bae7c){return BPromise[_0x5afb('0x26')]({'id':_0x5bae7c[_0x5afb('0x28')],'name':_0x5bae7c['display_name']});});}}function getEndUser(_0x3b090c,_0x3f6c98,_0x365d81,_0x472a61,_0x4fbd9d){var _0x564a46={'$or':{'Phone':_0x472a61}};var _0x45233c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5afb('0x26')]()[_0x5afb('0x24')](function(){logger[_0x5afb('0x1b')](_0x5afb('0x2b'),_0x472a61,_0x3f6c98[_0x5afb('0x2c')]);switch(_0x3f6c98[_0x5afb('0x2c')]){case _0x5afb('0x2d'):var _0x316da7=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98['additionalSearchContact']){var _0x2a4f2={};_0x2a4f2[_0x3f6c98[_0x5afb('0x2f')]]=_0x472a61;_[_0x5afb('0x30')](_0x316da7['$or'],_0x2a4f2);}return _0x4fbd9d[_0x5afb('0x1d')](_0x5afb('0x31'))[_0x5afb('0x22')](_0x316da7,_0x45233c)['execute']()['then'](function(_0x2dc523){if(_0x2dc523&&_0x2dc523['length']){return _0x2dc523;}else{var _0x489b7a=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98['additionalSearchLead']){var _0x12b13b={};_0x12b13b[_0x3f6c98[_0x5afb('0x32')]]=_0x472a61;_['merge'](_0x489b7a[_0x5afb('0x33')],_0x12b13b);}return _0x4fbd9d[_0x5afb('0x1d')](_0x5afb('0x34'))[_0x5afb('0x22')](_0x489b7a,_0x45233c);}});case _0x5afb('0x35'):var _0x555135=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98[_0x5afb('0x36')]){var _0x2a4f2={};_0x2a4f2[_0x3f6c98['additionalSearchAccount']]=_0x472a61;_[_0x5afb('0x30')](_0x555135[_0x5afb('0x33')],_0x2a4f2);}return _0x4fbd9d[_0x5afb('0x1d')](_0x5afb('0x37'))['find'](_0x555135,_0x45233c)[_0x5afb('0x23')]()[_0x5afb('0x24')](function(_0x2a2829){if(_0x2a2829&&_0x2a2829['length']){return _0x2a2829;}else{var _0x399d53=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98[_0x5afb('0x2f')]){var _0x5ad842={};_0x5ad842[_0x3f6c98[_0x5afb('0x2f')]]=_0x472a61;_[_0x5afb('0x30')](_0x399d53[_0x5afb('0x33')],_0x5ad842);}return _0x4fbd9d[_0x5afb('0x1d')]('Contact')[_0x5afb('0x22')](_0x399d53,_0x45233c)[_0x5afb('0x24')](function(_0x3de938){if(_0x3de938&&_0x3de938[_0x5afb('0x25')]){return _0x3de938;}else{var _0x4ff2f8=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98[_0x5afb('0x32')]){var _0x19137a={};_0x19137a[_0x3f6c98[_0x5afb('0x32')]]=_0x472a61;_[_0x5afb('0x30')](_0x4ff2f8['$or'],_0x19137a);}return _0x4fbd9d[_0x5afb('0x1d')](_0x5afb('0x34'))[_0x5afb('0x22')](_0x4ff2f8,_0x45233c);}});}});case _0x5afb('0x13'):var _0x316da7=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98[_0x5afb('0x2f')]){var _0x2a4f2={};_0x2a4f2[_0x3f6c98[_0x5afb('0x2f')]]=_0x472a61;_[_0x5afb('0x30')](_0x316da7[_0x5afb('0x33')],_0x2a4f2);}return _0x4fbd9d['sobject'](_0x5afb('0x31'))['find'](_0x316da7,_0x45233c)[_0x5afb('0x23')]();case _0x5afb('0x14'):var _0x1e9b5b=_['cloneDeep'](_0x564a46);if(_0x3f6c98[_0x5afb('0x32')]){var _0x2a4f2={};_0x2a4f2[_0x3f6c98[_0x5afb('0x32')]]=_0x472a61;_[_0x5afb('0x30')](_0x1e9b5b['$or'],_0x2a4f2);}return _0x4fbd9d[_0x5afb('0x1d')](_0x5afb('0x34'))[_0x5afb('0x22')](_0x1e9b5b,_0x45233c);case _0x5afb('0x18'):var _0x555135=_[_0x5afb('0x2e')](_0x564a46);if(_0x3f6c98[_0x5afb('0x36')]){var _0x2a4f2={};_0x2a4f2[_0x3f6c98[_0x5afb('0x36')]]=_0x472a61;_[_0x5afb('0x30')](_0x555135[_0x5afb('0x33')],_0x2a4f2);}return _0x4fbd9d['sobject'](_0x5afb('0x37'))[_0x5afb('0x22')](_0x555135,_0x45233c);default:return null;}})[_0x5afb('0x24')](function(_0xdcbaf2){if(_0xdcbaf2&&_0xdcbaf2[_0x5afb('0x25')]){var _0x5e2867=_[_0x5afb('0x38')](_0xdcbaf2);if(_0x5e2867){return BPromise['resolve']({'id':_0x5e2867['Id'],'name':_0x5e2867[_0x5afb('0x39')],'phone':_0x5e2867[_0x5afb('0x3a')],'endUserType':_0x5e2867['attributes'][_0x5afb('0x3b')][_0x5afb('0x3c')]()});}}})['then'](function(_0x39ed20){if(_0x39ed20){logger[_0x5afb('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x39ed20['endUserType'],_0x472a61);return BPromise[_0x5afb('0x26')](_0x39ed20);}else{logger[_0x5afb('0x1b')](_0x5afb('0x3d'),_0x472a61);var _0x547514={'Phone':_0x472a61};if(_0x3f6c98['moduleCreate']){if(_0x3f6c98[_0x5afb('0x3e')]===_0x5afb('0x13')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x472a61,_0x3f6c98['moduleCreate']);_0x547514[_0x5afb('0x3f')]=_0x365d81!==_0x5afb('0x40')?_0x365d81:util[_0x5afb('0x41')](_0x5afb('0x42'),_0x472a61);}else if(_0x3f6c98['moduleCreate']===_0x5afb('0x14')){logger[_0x5afb('0x1b')](_0x5afb('0x43'),_0x472a61,_0x3f6c98[_0x5afb('0x3e')]);_0x547514[_0x5afb('0x3f')]=_0x365d81!==_0x5afb('0x40')?_0x365d81:util[_0x5afb('0x41')](_0x5afb('0x42'),_0x472a61);_0x547514[_0x5afb('0x44')]=_0x5afb('0x45');}else if(_0x3f6c98['moduleCreate']==='account'){logger[_0x5afb('0x1b')](_0x5afb('0x43'),_0x472a61,_0x3f6c98[_0x5afb('0x3e')]);_0x547514[_0x5afb('0x39')]=_0x365d81!==_0x5afb('0x40')?_0x365d81:util['format'](_0x5afb('0x42'),_0x472a61);}else{return null;}}return _0x4fbd9d[_0x5afb('0x1d')](_[_0x5afb('0x46')](_0x3f6c98[_0x5afb('0x3e')]))['create'](_0x547514)[_0x5afb('0x24')](function(_0x4be2b1){return BPromise[_0x5afb('0x26')]({'id':_0x4be2b1['id'],'endUserType':_0x3f6c98[_0x5afb('0x3e')]});});}});}function getCustomFields(_0x5e9f14,_0x3c6719){var _0x507a8f={};if(_0x5e9f14[_0x5afb('0x25')]>0x0){_['forEach'](_0x5e9f14,function(_0x3a293d){if(_['includes']([_0x5afb('0x47'),_0x5afb('0x48')],_0x3a293d[_0x5afb('0x3b')])&&_0x3a293d[_0x5afb('0x49')]){_0x507a8f[_0x3a293d[_0x5afb('0x49')]]=_0x3a293d[_0x5afb('0x4a')][_0x5afb('0x4b')]();}else if(_0x3a293d[_0x5afb('0x3b')]===_0x5afb('0x4c')&&_0x3a293d[_0x5afb('0x4d')]&&_0x3a293d[_0x5afb('0x49')]){_0x3c6719[_0x3a293d[_0x5afb('0x4d')]]&&(_0x507a8f[_0x3a293d['idField']]=_0x3c6719[_0x3a293d[_0x5afb('0x4d')]]['toString']());}else if(_0x3a293d['type']===_0x5afb('0x4e')&&_0x3a293d[_0x5afb('0x4f')]&&_0x3a293d[_0x5afb('0x4f')][_0x5afb('0x50')]&&_0x3a293d[_0x5afb('0x49')]){_0x3c6719[_0x3a293d['Variable'][_0x5afb('0x50')][_0x5afb('0x3c')]()]&&(_0x507a8f[_0x3a293d[_0x5afb('0x49')]]=_0x3c6719[_0x3a293d[_0x5afb('0x4f')]['name'][_0x5afb('0x3c')]()][_0x5afb('0x4b')]());}});}return _0x507a8f;}function getConnection(_0x135445){var _0x321213=_0x135445[_0x5afb('0x51')][_0x5afb('0x52')](_0x135445[_0x5afb('0x53')]);var _0x3de819=new jsforce[(_0x5afb('0x54'))]({'oauth2':{'loginUrl':_0x135445[_0x5afb('0x55')]||_0x5afb('0x56'),'clientId':_0x135445[_0x5afb('0x57')],'clientSecret':_0x135445[_0x5afb('0x58')]}});return _0x3de819[_0x5afb('0x59')](_0x135445[_0x5afb('0x5a')],_0x321213)[_0x5afb('0x24')](function(){logger[_0x5afb('0x1b')](_0x5afb('0x5b'));return _0x3de819;});}exports['queue']=function(_0x129e8c,_0x5131a4,_0x5339e4,_0x428fe8,_0x893ca9,_0x27c9c9){var _0xf12ae6,_0x102326,_0x52c61d,_0x509c37;_0x27c9c9[_0x5afb('0x5c')]=intUtil[_0x5afb('0x5d')](_0x27c9c9[_0x5afb('0x5c')]);_0x27c9c9['remoteUri']=intUtil[_0x5afb('0x5d')](_0x27c9c9[_0x5afb('0x55')]);if(_0x893ca9&&_0x893ca9[_0x5afb('0x5e')]){logger[_0x5afb('0x1b')](_0x5afb('0x5f'),_0x5afb('0x60'));_0x5131a4['recordingURL']=util['format'](_0x5afb('0x61'),_0x27c9c9['serverUrl'],_0x5131a4['uniqueid'],md5(_0x5131a4[_0x5afb('0x62')]));}else{_0x5131a4[_0x5afb('0x63')]='';}return getConnection(_0x27c9c9)['then'](function(_0x49686b){_0x509c37=_0x49686b;return getUser(_0x27c9c9,_0x428fe8[_0x5afb('0x64')],_0x509c37);})['then'](function(_0x5babd0){_0xf12ae6=_0x5babd0;return getEndUser(_0x27c9c9,_0x5339e4,_0x5131a4[_0x5afb('0x65')],_0x5131a4[_0x5afb('0x66')],_0x509c37);})[_0x5afb('0x24')](function(_0x35b410){_0x102326=_0x35b410;return getTicket(_0x27c9c9,_0xf12ae6,_0x102326,_0x5339e4,_0x5131a4,_0x5339e4['Fields'],_0x509c37,'queue');})['then'](function(_0x4972ed){_0x52c61d=_0x4972ed;logger[_0x5afb('0x1b')](_0x5afb('0x67'),_0x52c61d['id']);logger[_0x5afb('0x1b')](_0x5afb('0x68'),_0x52c61d['id'],_0x428fe8[_0x5afb('0x50')],_0x27c9c9[_0x5afb('0x3b')]);switch(_0x27c9c9[_0x5afb('0x3b')]){case _0x5afb('0x69'):emit(util[_0x5afb('0x41')]('user:%s',_0x428fe8[_0x5afb('0x50')]),_0x5afb('0x6a'),{'recordId':_0x52c61d['id']});break;case _0x5afb('0x6b'):emit(util[_0x5afb('0x41')](_0x5afb('0x6c'),_0x428fe8[_0x5afb('0x50')]),_0x5afb('0x6d'),{'uri':util[_0x5afb('0x41')](_0x5afb('0x6e'),_0x509c37[_0x5afb('0x6f')],_0x52c61d['id'])});break;default:logger[_0x5afb('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x32bf0d){logger[_0x5afb('0x70')](_0x5afb('0x5f'),_0x32bf0d);});};exports[_0x5afb('0x71')]=function(_0x452481,_0xda1062,_0x38d6fb,_0x1f1580,_0x1e5223,_0x2c2032,_0x49ec0c){var _0x4f9d0c,_0x15b55b,_0x32f4d1,_0x5054a3;_0x2c2032[_0x5afb('0x5c')]=intUtil[_0x5afb('0x5d')](_0x2c2032[_0x5afb('0x5c')]);_0x2c2032[_0x5afb('0x55')]=intUtil[_0x5afb('0x5d')](_0x2c2032['remoteUri']);if(_0x49ec0c&&_0x49ec0c['recordingFormat']&&_0x49ec0c[_0x5afb('0x72')]!=='none'){logger[_0x5afb('0x1b')]('[OUTBOUND]',_0x5afb('0x60'));_0xda1062[_0x5afb('0x63')]=util[_0x5afb('0x41')](_0x5afb('0x61'),_0x2c2032[_0x5afb('0x5c')],_0xda1062[_0x5afb('0x62')],md5(_0xda1062[_0x5afb('0x62')]));}return getConnection(_0x2c2032)['then'](function(_0x216992){_0x5054a3=_0x216992;return getUser(_0x2c2032,_0x1f1580[_0x5afb('0x64')],_0x5054a3);})['then'](function(_0x3038ef){_0x4f9d0c=_0x3038ef;return getEndUser(_0x2c2032,_0x38d6fb,_0xda1062[_0x5afb('0x73')],_0xda1062[_0x5afb('0x74')],_0x5054a3);})[_0x5afb('0x24')](function(_0x191d99){_0x15b55b=_0x191d99;return getTicket(_0x2c2032,_0x4f9d0c,_0x15b55b,_0x38d6fb,_0xda1062,_0x38d6fb[_0x5afb('0x75')],_0x5054a3,_0x5afb('0x71'));})[_0x5afb('0x24')](function(_0x207da1){_0x32f4d1=_0x207da1;logger[_0x5afb('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x32f4d1['id']);logger[_0x5afb('0x1b')](_0x5afb('0x76'),_0x32f4d1['id'],_0x1f1580[_0x5afb('0x50')],_0x2c2032['type']);switch(_0x2c2032[_0x5afb('0x3b')]){case _0x5afb('0x69'):emit(util[_0x5afb('0x41')]('user:%s',_0x1f1580[_0x5afb('0x50')]),_0x5afb('0x6a'),{'recordId':_0x32f4d1['id']});break;case'newTab':emit(util['format'](_0x5afb('0x6c'),_0x1f1580[_0x5afb('0x50')]),'trigger:browser:url',{'uri':util['format'](_0x5afb('0x6e'),_0x5054a3[_0x5afb('0x6f')],_0x32f4d1['id'])});break;default:logger[_0x5afb('0x70')](_0x5afb('0x77'),_0x5afb('0x78'));}})[_0x5afb('0x79')](function(_0x20b000){logger[_0x5afb('0x70')](_0x5afb('0x77'),_0x20b000);});};exports[_0x5afb('0x7a')]=function(_0x556f6e,_0x9ba1ff,_0x3d1975,_0x28d2d8,_0xda10a,_0x316b84){var _0x1fc4f2,_0x57bb7c,_0x467bf8,_0x4f1bf0;_0x316b84[_0x5afb('0x5c')]=intUtil[_0x5afb('0x5d')](_0x316b84[_0x5afb('0x5c')]);_0x316b84[_0x5afb('0x55')]=intUtil[_0x5afb('0x5d')](_0x316b84[_0x5afb('0x55')]);if(_0xda10a&&_0xda10a['monitor_format']){logger[_0x5afb('0x1b')]('['+_0x9ba1ff['lastevent'][_0x5afb('0x7b')]()+']',_0x5afb('0x60'));_0x9ba1ff['recordingURL']=util['format'](_0x5afb('0x61'),_0x316b84['serverUrl'],_0x9ba1ff[_0x5afb('0x62')],md5(_0x9ba1ff['uniqueid']));}else{_0x9ba1ff[_0x5afb('0x63')]='';}return getConnection(_0x316b84)['then'](function(_0x5a4a8a){_0x4f1bf0=_0x5a4a8a;if(!_[_0x5afb('0x1f')](_0x28d2d8)){return getUser(_0x316b84,_0x28d2d8[_0x5afb('0x50')],_0x4f1bf0);}else{return getUser(_0x316b84,null,_0x4f1bf0);}})[_0x5afb('0x24')](function(_0xba5c0a){_0x1fc4f2=_0xba5c0a;return getEndUser(_0x316b84,_0x3d1975,_0x9ba1ff[_0x5afb('0x65')],_0x9ba1ff['calleridnum'],_0x4f1bf0);})[_0x5afb('0x24')](function(_0x37cde7){_0x57bb7c=_0x37cde7;return getTicket(_0x316b84,_0x1fc4f2,_0x57bb7c,_0x3d1975,_0x9ba1ff,_0x3d1975[_0x5afb('0x75')],_0x4f1bf0);})[_0x5afb('0x24')](function(_0x5806fc){_0x467bf8=_0x5806fc;logger['info']('['+_0x9ba1ff[_0x5afb('0x7c')][_0x5afb('0x7b')]()+_0x5afb('0x7d'),_0x467bf8['id']);logger['info']('['+_0x9ba1ff['lastevent'][_0x5afb('0x7b')]()+_0x5afb('0x7e'),_0x316b84['type']);})[_0x5afb('0x79')](function(_0x246933){logger[_0x5afb('0x70')]('['+_0x9ba1ff[_0x5afb('0x7c')][_0x5afb('0x7b')]()+']',_0x246933);});}; \ 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 f04a741..15c7d3a 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 _0x359e=['username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','active','true','sys_id','userId','adminEmail','message',']\x20using\x20admin\x20profile','adminId','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','toString','idField','customField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','emit','trigger:browser:url'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x359e,0x1e1));var _0xe359=function(_0x170ac5,_0x3bbbdc){_0x170ac5=_0x170ac5-0x0;var _0x50d576=_0x359e[_0x170ac5];return _0x50d576;};'use strict';var _=require(_0xe359('0x0'));var Promise=require(_0xe359('0x1'));var rp=require(_0xe359('0x2'));var util=require(_0xe359('0x3'));var md5=require(_0xe359('0x4'));var Redis=require(_0xe359('0x5'));var intUtil=require(_0xe359('0x6'));var config=require(_0xe359('0x7'));var logger=require(_0xe359('0x8'))(_0xe359('0x9'));config[_0xe359('0xa')]=_[_0xe359('0xb')](config['redis'],{'host':_0xe359('0xc'),'port':0x18eb});var io=require(_0xe359('0xd'))(new Redis(config[_0xe359('0xa')]));function getAdminUser(_0x248e19,_0xd62913,_0xbd557d,_0x2df65b,_0x6e0f53,_0x4812fa){return new Promise(function(_0x44ba76,_0x492ba9){var _0xe37bd5={'method':_0xe359('0xe'),'uri':_0x2df65b+_0xe359('0xf')+'&'+_0x6e0f53+'&'+_0x4812fa,'auth':_0xd62913,'json':!![]};return rp(_0xe37bd5)['then'](function(_0x85e297){if(_0x85e297[_0xe359('0x10')][_0xe359('0x11')]>0x0){_0xbd557d['adminId']=_0x85e297['result'][0x0]['sys_id'];}logger[_0xe359('0x12')]('['+[_0x248e19['toUpperCase']()]+_0xe359('0x13'),_0xbd557d);_0x44ba76(_0xbd557d);})[_0xe359('0x14')](function(_0x32d5c8){logger[_0xe359('0x15')]('['+[_0x248e19[_0xe359('0x16')]()]+']',_0x32d5c8['message']);_0x492ba9(_0x32d5c8['message']);});});}function getUser(_0x303c79,_0x41b321,_0x32a203,_0xd80bad,_0xdd7651){return function(_0x592e83){logger['info']('['+[_0x303c79[_0xe359('0x16')]()]+_0xe359('0x17'),_0x592e83);return new Promise(function(_0x162eec,_0xfca089){if(intUtil[_0xe359('0x18')](_0x592e83[_0xe359('0x19')])){var _0x43e00e={'method':'GET','uri':_0x32a203+_0xe359('0x1a')+_0x592e83['userEmail']+'&'+_0xd80bad+'&'+_0xdd7651,'auth':_0x41b321,'json':!![]};logger[_0xe359('0x12')]('['+[_0x303c79['toUpperCase']()]+_0xe359('0x1b'),_0x43e00e);return rp(_0x43e00e)[_0xe359('0x1c')](function(_0x4a0e53){logger[_0xe359('0x12')]('['+[_0x303c79[_0xe359('0x16')]()]+'],\x20getUser\x20entity',_0x4a0e53);if(_0x4a0e53[_0xe359('0x10')][_0xe359('0x11')]>0x0&&String(_0x4a0e53['result'][0x0][_0xe359('0x1d')])===_0xe359('0x1e')){_0x592e83['userId']=_0x4a0e53[_0xe359('0x10')][0x0][_0xe359('0x1f')];}else{_0x592e83[_0xe359('0x20')]=_0x592e83['adminId'];_0x592e83[_0xe359('0x19')]=_0x592e83[_0xe359('0x21')];}logger[_0xe359('0x12')]('['+[_0x303c79[_0xe359('0x16')]()]+'],\x20getUser\x20crm',_0x592e83);_0x162eec(_0x592e83);})[_0xe359('0x14')](function(_0x361ac0){logger[_0xe359('0x15')]('['+[_0x303c79[_0xe359('0x16')]()]+']',_0x361ac0[_0xe359('0x22')]);_0xfca089(_0x361ac0[_0xe359('0x22')]);});}else{logger[_0xe359('0x12')]('['+[_0x303c79[_0xe359('0x16')]()]+_0xe359('0x23'));_0x592e83[_0xe359('0x20')]=_0x592e83[_0xe359('0x24')];_0x592e83['userEmail']=_0x592e83[_0xe359('0x21')];_0x162eec(_0x592e83);}});};}function createEndUser(_0x3367ab,_0x3d1c10,_0x2d5e8a,_0x5ebc2f,_0x543c79){logger[_0xe359('0x12')]('['+[_0x3367ab['toUpperCase']()]+_0xe359('0x25'),_0x2d5e8a);return new Promise(function(_0x2b3a3e,_0x47aa03){var _0x1b66f2={'method':_0xe359('0x26'),'uri':_0x5ebc2f+'sys_user?'+_0x543c79,'body':{'user_name':_0x2d5e8a[_0xe359('0x27')],'roles':_0xe359('0x28'),'first_name':_0x2d5e8a['endUserNumber'],'active':_0xe359('0x1e'),'date_format':_0xe359('0x29'),'phone':_0x2d5e8a[_0xe359('0x27')]},'auth':_0x3d1c10,'json':!![]};return rp(_0x1b66f2)[_0xe359('0x1c')](function(_0x10acf5){logger[_0xe359('0x12')]('['+[_0x3367ab[_0xe359('0x16')]()]+_0xe359('0x2a'),_0x10acf5[_0xe359('0x10')]);_0x2d5e8a[_0xe359('0x2b')]=_0x10acf5[_0xe359('0x10')][_0xe359('0x1f')];_0x2b3a3e(_0x2d5e8a);})['catch'](function(_0x6a9203){logger['error']('['+[_0x3367ab['toUpperCase']()]+']',_0x6a9203[_0xe359('0x22')]);_0x47aa03(_0x6a9203['message']);});});}function getEndUser(_0x592245,_0x548927,_0x30a893,_0x38f38d,_0x3d1e96){return function(_0x18c64c){logger[_0xe359('0x12')]('['+[_0x592245[_0xe359('0x16')]()]+_0xe359('0x2c'),_0x18c64c);return new Promise(function(_0x5efae0,_0x24f8f5){var _0xa14fad={'method':_0xe359('0xe'),'uri':_0x30a893+_0xe359('0x2d')+_0x18c64c[_0xe359('0x27')]+'&'+_0x38f38d+'&'+_0x3d1e96,'auth':_0x548927,'json':!![]};return rp(_0xa14fad)['then'](function(_0x3f0c8e){if(_0x3f0c8e[_0xe359('0x10')][_0xe359('0x11')]>0x0){_0x18c64c[_0xe359('0x2b')]=_0x3f0c8e[_0xe359('0x10')][0x0][_0xe359('0x1f')];logger[_0xe359('0x12')]('['+[_0x592245[_0xe359('0x16')]()]+_0xe359('0x2e'),_0x18c64c);_0x5efae0(_0x18c64c);}else{return createEndUser(_0x592245,_0x548927,_0x18c64c,_0x30a893,_0x38f38d)['then'](function(_0x4950db){logger[_0xe359('0x12')]('['+[_0x592245['toUpperCase']()]+_0xe359('0x2f'),_0x4950db);_0x5efae0(_0x4950db);});}})[_0xe359('0x14')](function(_0x22e45f){logger[_0xe359('0x15')]('['+[_0x592245[_0xe359('0x16')]()]+']',_0x22e45f[_0xe359('0x22')]);_0x24f8f5(_0x22e45f['message']);});});};}function getCustomFields(_0x364557,_0x538440){var _0x1b6f97={};if(_0x364557['length']>0x0){_[_0xe359('0x30')](_0x364557,function(_0x28bafe){if(_[_0xe359('0x31')]([_0xe359('0x32'),_0xe359('0x33')],_0x28bafe[_0xe359('0x34')])&&_0x28bafe[_0xe359('0x35')]&&!_0x28bafe['customField']){_0x1b6f97[_0x28bafe[_0xe359('0x35')][_0xe359('0x36')]()]=_0x28bafe['content'][_0xe359('0x37')]();}else if(_['includes']([_0xe359('0x32'),'picklist'],_0x28bafe['type'])&&_0x28bafe[_0xe359('0x38')]&&_0x28bafe[_0xe359('0x39')]){_0x1b6f97[_0x28bafe[_0xe359('0x38')]['toLowerCase']()]=_0x28bafe[_0xe359('0x3a')][_0xe359('0x37')]();}else if(_0x28bafe[_0xe359('0x34')]===_0xe359('0x3b')&&_0x28bafe[_0xe359('0x3c')]&&_0x28bafe[_0xe359('0x38')]&&_0x28bafe[_0xe359('0x39')]){_0x1b6f97[_0x28bafe[_0xe359('0x38')]['toLowerCase']()]=_0x538440[_0x28bafe[_0xe359('0x3c')]][_0xe359('0x37')]();}else if(_0x28bafe['type']===_0xe359('0x3d')&&_0x28bafe[_0xe359('0x3e')]&&_0x28bafe['Variable'][_0xe359('0x3f')]&&_0x28bafe[_0xe359('0x38')]&&_0x28bafe[_0xe359('0x39')]){_0x1b6f97[_0x28bafe[_0xe359('0x38')][_0xe359('0x36')]()]=_0x538440[_0x28bafe['Variable'][_0xe359('0x3f')]['toLowerCase']()][_0xe359('0x37')]();}});}return _0x1b6f97;}function getTicket(_0x51929b,_0x4bbc0b,_0x5c5937,_0x52ed26,_0x2051e4,_0x408689){return function(_0x2cd313){logger['info']('['+[_0x51929b['toUpperCase']()]+_0xe359('0x40'),_0x2cd313);return new Promise(function(_0x133b4f,_0x514435){var _0x3ac1a6=_0x51929b[_0xe359('0x36')]()===_0xe359('0x41')?_0x2cd313[_0xe359('0x20')]:_0x2cd313[_0xe359('0x2b')];var _0x4eaae5={'method':_0xe359('0x26'),'uri':_0x5c5937+_0xe359('0x42')+'?'+_0x408689,'body':Object['assign']({},{'active':_0xe359('0x1e'),'caller_id':_0x3ac1a6,'assigned_to':_0x2cd313[_0xe359('0x20')],'short_description':intUtil[_0xe359('0x43')](_0x52ed26[_0xe359('0x44')],_0x2051e4,'\x20'),'description':intUtil[_0xe359('0x43')](_0x52ed26[_0xe359('0x45')],_0x2051e4,'\x0a')},getCustomFields(_0x52ed26[_0xe359('0x46')],_0x2051e4)),'auth':_0x4bbc0b,'json':!![]};return rp(_0x4eaae5)[_0xe359('0x1c')](function(_0x5c53f8){logger['info']('['+[_0x51929b[_0xe359('0x16')]()]+_0xe359('0x47'),_0x5c53f8[_0xe359('0x10')]);_0x2cd313['ticketId']=_0x5c53f8[_0xe359('0x10')]['sys_id'];_0x2cd313['ticketNumber']=_0x5c53f8[_0xe359('0x10')][_0xe359('0x48')];logger['info']('['+[_0x51929b[_0xe359('0x16')]()]+_0xe359('0x49'),_0x2cd313);_0x133b4f(_0x2cd313);})[_0xe359('0x14')](function(_0x578268){logger[_0xe359('0x15')]('['+[_0x51929b['toUpperCase']()]+']',_0x578268[_0xe359('0x22')]);_0x514435(_0x578268[_0xe359('0x22')]);});});};}function createRemoteTag(_0x36c7b2,_0x372b37,_0x563d4c,_0x4040c0){return new Promise(function(_0x20c9e0,_0x3d8d05){var _0x559ca8={'method':'POST','uri':_0x563d4c+_0xe359('0x4a')+'?'+_0x4040c0,'body':{'short_description':_0x36c7b2,'global':!![],'active':!![],'name':_0x36c7b2},'auth':_0x372b37,'json':!![]};return rp(_0x559ca8)[_0xe359('0x1c')](function(_0x2d7723){var _0xccc8f1=_0x2d7723['result'][_0xe359('0x1f')];_0x20c9e0(_0xccc8f1);});});}function getRemoteTag(_0x5d1cc1,_0x5d6cb3,_0x1fc77a,_0x295c02,_0x2b15cd){return new Promise(function(_0x531d6d,_0xa4a18){var _0x348d0b={'method':_0xe359('0xe'),'uri':_0x1fc77a+_0xe359('0x4a')+_0xe359('0x4b')+_0x5d1cc1+'&'+_0x295c02,'auth':_0x5d6cb3,'json':!![]};return rp(_0x348d0b)[_0xe359('0x1c')](function(_0x48fdc5){if(_0x48fdc5['result'][_0xe359('0x11')]>0x0){var _0x467d1b=_0x48fdc5['result'][0x0][_0xe359('0x1f')];_0x531d6d(_0x467d1b);}else{return createRemoteTag(_0x5d1cc1,_0x5d6cb3,_0x1fc77a,_0x295c02)[_0xe359('0x1c')](function(_0x14ab9d){_0x531d6d(_0x14ab9d);});}});});}function assignTagToIncident(_0x1058ce,_0x30de82,_0x3ed462,_0x357404,_0x4358d){return new Promise(function(_0x446457,_0x1de642){var _0x5d8052={'method':'POST','uri':_0x3ed462+'label_entry'+'?'+_0x4358d,'body':{'label':_0x1058ce,'table':_0xe359('0x42'),'id_type':_0xe359('0x4c'),'table_key':_0x357404[_0xe359('0x4d')],'title':_0xe359('0x4e')+_0x357404['ticketNumber'],'id_display':_0x357404[_0xe359('0x4f')]},'auth':_0x30de82,'json':!![]};return rp(_0x5d8052)[_0xe359('0x1c')](function(_0x51fa9f){_0x446457();})['catch'](function(){_0x446457();});});}function manageTags(_0x356173,_0x26c24f,_0x21e17a,_0x5b5666,_0x1b8b3d,_0x8f62ab,_0xde0efe){return new Promise(function(_0x3644f9,_0x11fd95){var _0x3e8de2=[];_0x26c24f['forEach'](function(_0x4e44ac){_0x3e8de2[_0xe359('0x50')](getRemoteTag(_0x4e44ac,_0x21e17a,_0x5b5666,_0x8f62ab,_0xde0efe));});return Promise[_0xe359('0x51')](_0x3e8de2)[_0xe359('0x1c')](function(_0x49471a){if(_0x49471a['length']){logger['info']('['+[_0x356173[_0xe359('0x16')]()]+_0xe359('0x52'),_0x49471a);var _0x4b5012=[];_0x49471a[_0xe359('0x30')](function(_0x4edf1d){_0x4b5012[_0xe359('0x50')](assignTagToIncident(_0x4edf1d,_0x21e17a,_0x5b5666,_0x1b8b3d,_0x8f62ab));});return Promise[_0xe359('0x51')](_0x4b5012)[_0xe359('0x1c')](function(){_0x3644f9();})[_0xe359('0x14')](function(){_0x3644f9();});}else{_0x3644f9();}});});}function getTags(_0x1aa318,_0x2eaabc,_0x2c3ab3,_0x4ddc54,_0x1b3d1e,_0x25d5e6){return function(_0x780a50){return new Promise(function(_0x7c0262,_0x1e25a4){var _0x114e79=[];var _0x1fef8f=_0x4ddc54[_0xe359('0x53')];if(_0x1fef8f&&_0x1fef8f[_0xe359('0x11')]>0x0){_0x114e79=_[_0xe359('0x54')](_0x1fef8f,_0xe359('0x3f'));}if(_0x114e79[_0xe359('0x11')]>0x0){return manageTags(_0x1aa318,_0x114e79,_0x2eaabc,_0x2c3ab3,_0x780a50,_0x1b3d1e,_0x25d5e6)[_0xe359('0x1c')](function(){_0x7c0262(_0x780a50);});}else{_0x7c0262(_0x780a50);}});};}function emit(_0xca7e00,_0x3a7b74,_0x3dae26){var _0x276199='%26sysparm_record_target%3Dincident'+_0xe359('0x55')+_0xe359('0x56')+'%255EORDERBYDESCnumber';var _0x4e8f2e={'uri':_0xca7e00+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3dae26+_0x276199};io['to'](util['format']('user:%s',_0x3a7b74))[_0xe359('0x57')](_0xe359('0x58'),_0x4e8f2e);}exports['cs']=function(_0x27b09b,_0x90211c,_0x5b4b59,_0x1d2f28,_0x18feaf,_0x5a4dcb,_0x5e9027,_0xb0732e){var _0x289b5c={};var _0x4ed54d={'user':_0x5a4dcb[_0xe359('0x59')],'pass':_0x5a4dcb[_0xe359('0x5a')]};var _0x5b0239=_0xe359('0x5b');var _0x16d0c4=_0xe359('0x5c');_0x5a4dcb[_0xe359('0x5d')]=intUtil['stripTrailingSlash'](_0x5a4dcb[_0xe359('0x5d')]);_0x5a4dcb[_0xe359('0x5e')]=intUtil['stripTrailingSlash'](_0x5a4dcb['serverUrl']);var _0x1fa1b2=util[_0xe359('0x5f')](_0xe359('0x60'),_0x5a4dcb[_0xe359('0x5d')]);_0x289b5c['userEmail']=!_['isNil'](_0x1d2f28)?_0x1d2f28[_0xe359('0x61')]:null;_0x289b5c[_0xe359('0x21')]=_0x5a4dcb[_0xe359('0x61')];_0x289b5c[_0xe359('0x27')]=_0xb0732e[_0xe359('0x36')]()===_0xe359('0x41')?_0x90211c[_0xe359('0x62')]:_0x90211c[_0xe359('0x63')];_0x289b5c[_0xe359('0x64')]=_0xb0732e==='queue'||_0xb0732e===_0xe359('0x65')?'queue':_0xe359('0x41');var _0x15bfcc=util[_0xe359('0x5f')](_0xe359('0x66'),_0x5a4dcb['serverUrl'],_0x90211c[_0xe359('0x67')],md5(_0x90211c[_0xe359('0x67')]));if(_0x18feaf&&_0x18feaf[_0xe359('0x68')]){logger['info'](_0xe359('0x69'),_0xe359('0x6a'));_0x90211c[_0xe359('0x6b')]=_0x15bfcc;}else if(_0x5e9027&&_0x5e9027[_0xe359('0x6c')]&&_0x5e9027[_0xe359('0x6c')]!=='none'){logger[_0xe359('0x12')](_0xe359('0x6d'),_0xe359('0x6a'));_0x90211c['recordingURL']=_0x15bfcc;}else{_0x90211c[_0xe359('0x6b')]='';}return getAdminUser(_0xb0732e,_0x4ed54d,_0x289b5c,_0x1fa1b2,_0x16d0c4,_0x5b0239)['then'](getUser(_0xb0732e,_0x4ed54d,_0x1fa1b2,_0x16d0c4,_0x5b0239))[_0xe359('0x1c')](getEndUser(_0xb0732e,_0x4ed54d,_0x1fa1b2,_0x16d0c4,_0x5b0239))[_0xe359('0x1c')](getTicket(_0xb0732e,_0x4ed54d,_0x1fa1b2,_0x5b4b59,_0x90211c,_0x16d0c4))[_0xe359('0x1c')](function(_0x348659){logger[_0xe359('0x12')](util['format'](_0xe359('0x6e'),_0x348659['ticketId']));logger[_0xe359('0x12')](util[_0xe359('0x5f')](_0xe359('0x6f'),_0xb0732e));if(_0xb0732e!=='unmanaged'){logger['info']('['+[_0xb0732e[_0xe359('0x16')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5a4dcb[_0xe359('0x5d')],_0x1d2f28['name'],_0x348659[_0xe359('0x4d')]);}})[_0xe359('0x14')](function(_0x13a96f){logger[_0xe359('0x15')]('['+[_0xb0732e['toUpperCase']()]+_0xe359('0x70'),util[_0xe359('0x71')](_0x13a96f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7fb3=['content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','true','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase'];(function(_0x6825de,_0x5ece5a){var _0x387010=function(_0x1e27dd){while(--_0x1e27dd){_0x6825de['push'](_0x6825de['shift']());}};_0x387010(++_0x5ece5a);}(_0x7fb3,0xa1));var _0x37fb=function(_0x40d394,_0x27f0de){_0x40d394=_0x40d394-0x0;var _0x4f285d=_0x7fb3[_0x40d394];return _0x4f285d;};'use strict';var _=require(_0x37fb('0x0'));var Promise=require(_0x37fb('0x1'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0x37fb('0x2'));var intUtil=require(_0x37fb('0x3'));var config=require(_0x37fb('0x4'));var logger=require(_0x37fb('0x5'))(_0x37fb('0x6'));config[_0x37fb('0x7')]=_['defaults'](config[_0x37fb('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x37fb('0x8'))(new Redis(config[_0x37fb('0x7')]));function getAdminUser(_0x10defd,_0x413e30,_0x398f2f,_0x5f2c27,_0x501060,_0x5681cc){return new Promise(function(_0x174d6d,_0x26b12b){var _0x3c20dd={'method':'GET','uri':_0x5f2c27+_0x37fb('0x9')+'&'+_0x501060+'&'+_0x5681cc,'auth':_0x413e30,'json':!![]};return rp(_0x3c20dd)[_0x37fb('0xa')](function(_0x3cbcee){if(_0x3cbcee[_0x37fb('0xb')][_0x37fb('0xc')]>0x0){_0x398f2f['adminId']=_0x3cbcee[_0x37fb('0xb')][0x0][_0x37fb('0xd')];}logger[_0x37fb('0xe')]('['+[_0x10defd[_0x37fb('0xf')]()]+_0x37fb('0x10'),_0x398f2f);_0x174d6d(_0x398f2f);})[_0x37fb('0x11')](function(_0x24169e){logger[_0x37fb('0x12')]('['+[_0x10defd['toUpperCase']()]+']',_0x24169e[_0x37fb('0x13')]);_0x26b12b(_0x24169e['message']);});});}function getUser(_0x4b2358,_0xacd7d0,_0x5cf57a,_0x625872,_0x4858d8){return function(_0xe2daf3){logger['info']('['+[_0x4b2358['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0xe2daf3);return new Promise(function(_0x10bd0e,_0x3ea879){if(intUtil[_0x37fb('0x14')](_0xe2daf3[_0x37fb('0x15')])){var _0x2224cf={'method':_0x37fb('0x16'),'uri':_0x5cf57a+_0x37fb('0x17')+_0xe2daf3[_0x37fb('0x15')]+'&'+_0x625872+'&'+_0x4858d8,'auth':_0xacd7d0,'json':!![]};logger[_0x37fb('0xe')]('['+[_0x4b2358['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x2224cf);return rp(_0x2224cf)['then'](function(_0x578a9a){logger['info']('['+[_0x4b2358[_0x37fb('0xf')]()]+'],\x20getUser\x20entity',_0x578a9a);if(_0x578a9a[_0x37fb('0xb')][_0x37fb('0xc')]>0x0&&String(_0x578a9a[_0x37fb('0xb')][0x0]['active'])===_0x37fb('0x18')){_0xe2daf3[_0x37fb('0x19')]=_0x578a9a[_0x37fb('0xb')][0x0][_0x37fb('0xd')];}else{_0xe2daf3[_0x37fb('0x19')]=_0xe2daf3[_0x37fb('0x1a')];_0xe2daf3[_0x37fb('0x15')]=_0xe2daf3[_0x37fb('0x1b')];}logger[_0x37fb('0xe')]('['+[_0x4b2358[_0x37fb('0xf')]()]+_0x37fb('0x1c'),_0xe2daf3);_0x10bd0e(_0xe2daf3);})['catch'](function(_0x37a4de){logger[_0x37fb('0x12')]('['+[_0x4b2358[_0x37fb('0xf')]()]+']',_0x37a4de[_0x37fb('0x13')]);_0x3ea879(_0x37a4de[_0x37fb('0x13')]);});}else{logger['info']('['+[_0x4b2358[_0x37fb('0xf')]()]+']\x20using\x20admin\x20profile');_0xe2daf3[_0x37fb('0x19')]=_0xe2daf3[_0x37fb('0x1a')];_0xe2daf3[_0x37fb('0x15')]=_0xe2daf3[_0x37fb('0x1b')];_0x10bd0e(_0xe2daf3);}});};}function createEndUser(_0x34ff9a,_0x410a81,_0x315075,_0xcbdd77,_0x26518c){logger[_0x37fb('0xe')]('['+[_0x34ff9a[_0x37fb('0xf')]()]+_0x37fb('0x1d'),_0x315075);return new Promise(function(_0x3fd35a,_0x2522cc){var _0x2647f8={'method':_0x37fb('0x1e'),'uri':_0xcbdd77+_0x37fb('0x1f')+_0x26518c,'body':{'user_name':_0x315075[_0x37fb('0x20')],'roles':'user','first_name':_0x315075[_0x37fb('0x20')],'active':'true','date_format':_0x37fb('0x21'),'phone':_0x315075[_0x37fb('0x20')]},'auth':_0x410a81,'json':!![]};return rp(_0x2647f8)[_0x37fb('0xa')](function(_0x4886d2){logger[_0x37fb('0xe')]('['+[_0x34ff9a['toUpperCase']()]+_0x37fb('0x22'),_0x4886d2['result']);_0x315075['endUserId']=_0x4886d2['result']['sys_id'];_0x3fd35a(_0x315075);})[_0x37fb('0x11')](function(_0x30e8e7){logger['error']('['+[_0x34ff9a[_0x37fb('0xf')]()]+']',_0x30e8e7[_0x37fb('0x13')]);_0x2522cc(_0x30e8e7[_0x37fb('0x13')]);});});}function getEndUser(_0x3d2298,_0x4c5a69,_0x55a04d,_0x30152f,_0x1c73f9){return function(_0x2fd230){logger[_0x37fb('0xe')]('['+[_0x3d2298[_0x37fb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x2fd230);return new Promise(function(_0x14d4e2,_0x4ece2e){var _0x133a86={'method':'GET','uri':_0x55a04d+_0x37fb('0x23')+_0x2fd230['endUserNumber']+'&'+_0x30152f+'&'+_0x1c73f9,'auth':_0x4c5a69,'json':!![]};return rp(_0x133a86)[_0x37fb('0xa')](function(_0x31aa12){if(_0x31aa12[_0x37fb('0xb')]['length']>0x0){_0x2fd230[_0x37fb('0x24')]=_0x31aa12[_0x37fb('0xb')][0x0][_0x37fb('0xd')];logger['info']('['+[_0x3d2298[_0x37fb('0xf')]()]+_0x37fb('0x25'),_0x2fd230);_0x14d4e2(_0x2fd230);}else{return createEndUser(_0x3d2298,_0x4c5a69,_0x2fd230,_0x55a04d,_0x30152f)[_0x37fb('0xa')](function(_0x4e49fa){logger['info']('['+[_0x3d2298[_0x37fb('0xf')]()]+'],\x20createEndUser\x20crm',_0x4e49fa);_0x14d4e2(_0x4e49fa);});}})[_0x37fb('0x11')](function(_0x16fbad){logger[_0x37fb('0x12')]('['+[_0x3d2298[_0x37fb('0xf')]()]+']',_0x16fbad[_0x37fb('0x13')]);_0x4ece2e(_0x16fbad[_0x37fb('0x13')]);});});};}function getCustomFields(_0x5144e9,_0x29ebeb){var _0x39af80={};if(_0x5144e9[_0x37fb('0xc')]>0x0){_[_0x37fb('0x26')](_0x5144e9,function(_0x527004){if(_[_0x37fb('0x27')](['string',_0x37fb('0x28')],_0x527004[_0x37fb('0x29')])&&_0x527004[_0x37fb('0x2a')]&&!_0x527004[_0x37fb('0x2b')]){_0x39af80[_0x527004[_0x37fb('0x2a')][_0x37fb('0x2c')]()]=_0x527004[_0x37fb('0x2d')][_0x37fb('0x2e')]();}else if(_['includes']([_0x37fb('0x2f'),'picklist'],_0x527004[_0x37fb('0x29')])&&_0x527004[_0x37fb('0x30')]&&_0x527004[_0x37fb('0x2b')]){_0x39af80[_0x527004['idField'][_0x37fb('0x2c')]()]=_0x527004['content']['toString']();}else if(_0x527004['type']===_0x37fb('0x31')&&_0x527004[_0x37fb('0x32')]&&_0x527004[_0x37fb('0x30')]&&_0x527004[_0x37fb('0x2b')]){_0x39af80[_0x527004[_0x37fb('0x30')][_0x37fb('0x2c')]()]=_0x29ebeb[_0x527004[_0x37fb('0x32')]][_0x37fb('0x2e')]();}else if(_0x527004[_0x37fb('0x29')]==='customVariable'&&_0x527004['Variable']&&_0x527004[_0x37fb('0x33')][_0x37fb('0x34')]&&_0x527004['idField']&&_0x527004[_0x37fb('0x2b')]){_0x39af80[_0x527004[_0x37fb('0x30')][_0x37fb('0x2c')]()]=_0x29ebeb[_0x527004['Variable']['name']['toLowerCase']()][_0x37fb('0x2e')]();}});}return _0x39af80;}function getTicket(_0x15badb,_0x1eff4c,_0x8ec7d3,_0x26fbe5,_0x23fbec,_0x204b95){return function(_0x5c52b9){logger['info']('['+[_0x15badb[_0x37fb('0xf')]()]+_0x37fb('0x35'),_0x5c52b9);return new Promise(function(_0x2c35c4,_0x24993a){var _0x2f0b30=_0x15badb[_0x37fb('0x2c')]()===_0x37fb('0x36')?_0x5c52b9[_0x37fb('0x19')]:_0x5c52b9[_0x37fb('0x24')];var _0x4b1925={'method':_0x37fb('0x1e'),'uri':_0x8ec7d3+_0x37fb('0x37')+'?'+_0x204b95,'body':Object['assign']({},{'active':_0x37fb('0x18'),'caller_id':_0x2f0b30,'assigned_to':_0x5c52b9['userId'],'short_description':intUtil[_0x37fb('0x38')](_0x26fbe5[_0x37fb('0x39')],_0x23fbec,'\x20'),'description':intUtil[_0x37fb('0x38')](_0x26fbe5[_0x37fb('0x3a')],_0x23fbec,'\x0a')},getCustomFields(_0x26fbe5[_0x37fb('0x3b')],_0x23fbec)),'auth':_0x1eff4c,'json':!![]};return rp(_0x4b1925)[_0x37fb('0xa')](function(_0x2ebe09){logger[_0x37fb('0xe')]('['+[_0x15badb[_0x37fb('0xf')]()]+_0x37fb('0x3c'),_0x2ebe09['result']);_0x5c52b9['ticketId']=_0x2ebe09[_0x37fb('0xb')][_0x37fb('0xd')];_0x5c52b9[_0x37fb('0x3d')]=_0x2ebe09[_0x37fb('0xb')][_0x37fb('0x3e')];logger[_0x37fb('0xe')]('['+[_0x15badb[_0x37fb('0xf')]()]+_0x37fb('0x3f'),_0x5c52b9);_0x2c35c4(_0x5c52b9);})['catch'](function(_0x1eb4f4){logger[_0x37fb('0x12')]('['+[_0x15badb[_0x37fb('0xf')]()]+']',_0x1eb4f4['message']);_0x24993a(_0x1eb4f4[_0x37fb('0x13')]);});});};}function createRemoteTag(_0x55504b,_0x83edb,_0x5ca550,_0x2a8b08){return new Promise(function(_0x39270f,_0x3a1cd1){var _0x164a61={'method':_0x37fb('0x1e'),'uri':_0x5ca550+_0x37fb('0x40')+'?'+_0x2a8b08,'body':{'short_description':_0x55504b,'global':!![],'active':!![],'name':_0x55504b},'auth':_0x83edb,'json':!![]};return rp(_0x164a61)[_0x37fb('0xa')](function(_0x1dbbfb){var _0x35dfc7=_0x1dbbfb[_0x37fb('0xb')]['sys_id'];_0x39270f(_0x35dfc7);});});}function getRemoteTag(_0x22c093,_0x1edb57,_0x4d4594,_0x323476,_0x509833){return new Promise(function(_0x2f954a,_0x3d2f){var _0x3ff26a={'method':_0x37fb('0x16'),'uri':_0x4d4594+_0x37fb('0x40')+_0x37fb('0x41')+_0x22c093+'&'+_0x323476,'auth':_0x1edb57,'json':!![]};return rp(_0x3ff26a)[_0x37fb('0xa')](function(_0x179b2a){if(_0x179b2a[_0x37fb('0xb')]['length']>0x0){var _0x4ad8a0=_0x179b2a['result'][0x0][_0x37fb('0xd')];_0x2f954a(_0x4ad8a0);}else{return createRemoteTag(_0x22c093,_0x1edb57,_0x4d4594,_0x323476)[_0x37fb('0xa')](function(_0x14889f){_0x2f954a(_0x14889f);});}});});}function assignTagToIncident(_0x1abdbf,_0x9ee9ff,_0x391d9c,_0x54f4d1,_0x4b320c){return new Promise(function(_0x43f43b,_0x3bd35b){var _0x4678ca={'method':_0x37fb('0x1e'),'uri':_0x391d9c+_0x37fb('0x42')+'?'+_0x4b320c,'body':{'label':_0x1abdbf,'table':_0x37fb('0x37'),'id_type':_0x37fb('0x43'),'table_key':_0x54f4d1[_0x37fb('0x44')],'title':'Incident\x20-\x20'+_0x54f4d1[_0x37fb('0x3d')],'id_display':_0x54f4d1[_0x37fb('0x3d')]},'auth':_0x9ee9ff,'json':!![]};return rp(_0x4678ca)[_0x37fb('0xa')](function(_0x4b9f1c){_0x43f43b();})[_0x37fb('0x11')](function(){_0x43f43b();});});}function manageTags(_0x2ab73a,_0x28db9c,_0xb6aae5,_0x4ad48d,_0x500c71,_0x2e4882,_0x35417f){return new Promise(function(_0x33e795,_0x42be7d){var _0x4ccfb3=[];_0x28db9c[_0x37fb('0x26')](function(_0x5e84b9){_0x4ccfb3[_0x37fb('0x45')](getRemoteTag(_0x5e84b9,_0xb6aae5,_0x4ad48d,_0x2e4882,_0x35417f));});return Promise[_0x37fb('0x46')](_0x4ccfb3)[_0x37fb('0xa')](function(_0x313d54){if(_0x313d54['length']){logger[_0x37fb('0xe')]('['+[_0x2ab73a[_0x37fb('0xf')]()]+_0x37fb('0x47'),_0x313d54);var _0x52e6f5=[];_0x313d54[_0x37fb('0x26')](function(_0x18e284){_0x52e6f5[_0x37fb('0x45')](assignTagToIncident(_0x18e284,_0xb6aae5,_0x4ad48d,_0x500c71,_0x2e4882));});return Promise[_0x37fb('0x46')](_0x52e6f5)[_0x37fb('0xa')](function(){_0x33e795();})[_0x37fb('0x11')](function(){_0x33e795();});}else{_0x33e795();}});});}function getTags(_0x456379,_0x4bed52,_0x5bc2ce,_0x56de24,_0xccbadb,_0xd2012){return function(_0x556f5e){return new Promise(function(_0x4044c3,_0x402d6e){var _0x3e0d32=[];var _0xd408fe=_0x56de24[_0x37fb('0x48')];if(_0xd408fe&&_0xd408fe['length']>0x0){_0x3e0d32=_[_0x37fb('0x49')](_0xd408fe,_0x37fb('0x34'));}if(_0x3e0d32[_0x37fb('0xc')]>0x0){return manageTags(_0x456379,_0x3e0d32,_0x4bed52,_0x5bc2ce,_0x556f5e,_0xccbadb,_0xd2012)[_0x37fb('0xa')](function(){_0x4044c3(_0x556f5e);});}else{_0x4044c3(_0x556f5e);}});};}function emit(_0x2353bc,_0x491aac,_0x1479be){var _0x2f9650=_0x37fb('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x37fb('0x4b');var _0x112280={'uri':_0x2353bc+_0x37fb('0x4c')+_0x1479be+_0x2f9650};io['to'](util['format']('user:%s',_0x491aac))[_0x37fb('0x4d')]('trigger:browser:url',_0x112280);}exports['cs']=function(_0x1265df,_0x3ffe8b,_0x532d61,_0x4f081b,_0x5c5c07,_0x2db837,_0x2a5168,_0x31b2c6){var _0xa65488={};var _0x5b2dc8={'user':_0x2db837[_0x37fb('0x4e')],'pass':_0x2db837[_0x37fb('0x4f')]};var _0x40c632=_0x37fb('0x50');var _0x14b60c=_0x37fb('0x51');_0x2db837[_0x37fb('0x52')]=intUtil['stripTrailingSlash'](_0x2db837[_0x37fb('0x52')]);_0x2db837[_0x37fb('0x53')]=intUtil[_0x37fb('0x54')](_0x2db837[_0x37fb('0x53')]);var _0x2560a1=util[_0x37fb('0x55')](_0x37fb('0x56'),_0x2db837[_0x37fb('0x52')]);_0xa65488[_0x37fb('0x15')]=!_[_0x37fb('0x57')](_0x4f081b)?_0x4f081b[_0x37fb('0x58')]:null;_0xa65488[_0x37fb('0x1b')]=_0x2db837[_0x37fb('0x58')];_0xa65488['endUserNumber']=_0x31b2c6[_0x37fb('0x2c')]()===_0x37fb('0x36')?_0x3ffe8b[_0x37fb('0x59')]:_0x3ffe8b[_0x37fb('0x5a')];_0xa65488[_0x37fb('0x5b')]=_0x31b2c6===_0x37fb('0x5c')||_0x31b2c6===_0x37fb('0x5d')?_0x37fb('0x5c'):_0x37fb('0x36');var _0x19afe4=util[_0x37fb('0x55')](_0x37fb('0x5e'),_0x2db837[_0x37fb('0x53')],_0x3ffe8b[_0x37fb('0x5f')],md5(_0x3ffe8b['uniqueid']));if(_0x5c5c07&&_0x5c5c07[_0x37fb('0x60')]){logger[_0x37fb('0xe')](_0x37fb('0x61'),'Recording\x20is\x20enabled!');_0x3ffe8b[_0x37fb('0x62')]=_0x19afe4;}else if(_0x2a5168&&_0x2a5168[_0x37fb('0x63')]&&_0x2a5168[_0x37fb('0x63')]!=='none'){logger[_0x37fb('0xe')](_0x37fb('0x64'),'Recording\x20is\x20enabled!');_0x3ffe8b[_0x37fb('0x62')]=_0x19afe4;}else{_0x3ffe8b[_0x37fb('0x62')]='';}return getAdminUser(_0x31b2c6,_0x5b2dc8,_0xa65488,_0x2560a1,_0x14b60c,_0x40c632)[_0x37fb('0xa')](getUser(_0x31b2c6,_0x5b2dc8,_0x2560a1,_0x14b60c,_0x40c632))['then'](getEndUser(_0x31b2c6,_0x5b2dc8,_0x2560a1,_0x14b60c,_0x40c632))[_0x37fb('0xa')](getTicket(_0x31b2c6,_0x5b2dc8,_0x2560a1,_0x532d61,_0x3ffe8b,_0x14b60c))[_0x37fb('0xa')](function(_0x514be6){logger[_0x37fb('0xe')](util[_0x37fb('0x55')](_0x37fb('0x65'),_0x514be6[_0x37fb('0x44')]));logger[_0x37fb('0xe')](util[_0x37fb('0x55')](_0x37fb('0x66'),_0x31b2c6));if(_0x31b2c6!=='unmanaged'){logger[_0x37fb('0xe')]('['+[_0x31b2c6[_0x37fb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2db837['remoteUri'],_0x4f081b[_0x37fb('0x34')],_0x514be6[_0x37fb('0x44')]);}})['catch'](function(_0x9ffa44){logger[_0x37fb('0x12')]('['+[_0x31b2c6[_0x37fb('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x9ffa44,{'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 9296de2..4660e03 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 _0xa000=['Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','toString','variable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','version','[OUTBOUND]','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','POST','info','Creating\x20new\x20ticket...','name','Subjects','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','stringify','Employees','user_name','then','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!',''];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xa000,0xb2));var _0x0a00=function(_0x1e73b6,_0x130c23){_0x1e73b6=_0x1e73b6-0x0;var _0x527157=_0xa000[_0x1e73b6];return _0x527157;};'use strict';var _=require(_0x0a00('0x0'));var rp=require(_0x0a00('0x1'));var BPromise=require(_0x0a00('0x2'));var md5=require(_0x0a00('0x3'));var util=require(_0x0a00('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0a00('0x5'));var config=require(_0x0a00('0x6'));var logger=require(_0x0a00('0x7'))('sugarcrm');config[_0x0a00('0x8')]=_[_0x0a00('0x9')](config[_0x0a00('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a00('0x8')]));var def={'method':_0x0a00('0xa'),'json':!![]};function emit(_0x41303b,_0x310618,_0x36f2b2){io['to'](_0x41303b)['emit'](_0x310618,_0x36f2b2);}function getTicket(_0x46ffe7,_0x371f36,_0x29c68e,_0x8a3d7f,_0x459c9f,_0x55f83b,_0x1607fe,_0x4a2c20){logger[_0x0a00('0xb')](_0x0a00('0xc'));var _0x305d06=new Date();var _0x565430=[{'name':_0x0a00('0xd'),'value':intUtil['getString'](_0x8a3d7f[_0x0a00('0xe')],_0x459c9f,'\x20')},{'name':'assigned_user_id','value':_0x371f36['id']},{'name':'created_by','value':_0x371f36['id']},{'name':_0x0a00('0xf'),'value':intUtil[_0x0a00('0x10')](_0x8a3d7f[_0x0a00('0x11')],_0x459c9f,'\x0a')},{'name':'date_start','value':_0x305d06[_0x0a00('0x12')]()[_0x0a00('0x13')](0x0,0x13)[_0x0a00('0x14')]('T','\x20')},{'name':_0x0a00('0x15'),'value':'0'},{'name':_0x0a00('0x16'),'value':'15'},{'name':'parent_id','value':_0x29c68e['id']},{'name':_0x0a00('0x17'),'value':'Contacts'},{'name':_0x0a00('0x18'),'value':_0x29c68e[_0x0a00('0xd')]},{'name':_0x0a00('0x19'),'value':_0x4a2c20}];if(_0x55f83b[_0x0a00('0x1a')]){_[_0x0a00('0x1b')](_0x55f83b,function(_0x48e22d){if(_0x459c9f[_0x48e22d[_0x0a00('0x1c')]]){_0x565430[_0x0a00('0x1d')]({'name':_0x48e22d[_0x0a00('0x1e')],'value':_0x459c9f[_0x48e22d[_0x0a00('0x1c')]]});}});}return request({'form':{'method':_0x0a00('0x1f'),'input_type':_0x0a00('0x20'),'response_type':_0x0a00('0x20'),'rest_data':JSON['stringify']({'session':_0x1607fe['id'],'module_name':'Calls','name_value_list':_0x565430})}});}function getAuth(_0x1c0fc5){return util[_0x0a00('0x21')](_0x0a00('0x22'),new Buffer(_0x1c0fc5[_0x0a00('0x23')]+':X')['toString'](_0x0a00('0x24')));}function getServerInfo(_0x5e5038){return request({'form':{'method':_0x0a00('0x25'),'input_type':_0x0a00('0x20'),'response_type':_0x0a00('0x20'),'rest_data':JSON['stringify']({'session':_0x5e5038['id']})}});}function getUser(_0x3e3734,_0x16c9f9,_0x372e9b){if(!_[_0x0a00('0x26')](_0x16c9f9)){logger[_0x0a00('0xb')]('Getting\x20agent\x20with\x20name',_0x16c9f9);return request({'form':{'method':_0x0a00('0x27'),'input_type':_0x0a00('0x20'),'response_type':'JSON','rest_data':JSON[_0x0a00('0x28')]({'session':_0x372e9b['id'],'module_name':_0x0a00('0x29'),'query':util[_0x0a00('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x16c9f9),'order_by':'','offset':'0','select_fields':['id',_0x0a00('0xd'),_0x0a00('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0a00('0x2b')](function(_0x520ffd){if(_0x520ffd[_0x0a00('0x2c')][_0x0a00('0x1a')]){var _0x5060c2=_[_0x0a00('0x2d')](_0x520ffd[_0x0a00('0x2c')],function(_0x47133a){return _0x47133a['name_value_list'][_0x0a00('0x2a')][_0x0a00('0x2e')]===_0x16c9f9;});if(_0x5060c2){logger[_0x0a00('0xb')]('Agent\x20found!');return BPromise[_0x0a00('0x2f')]({'id':_0x5060c2[_0x0a00('0x30')]['id'][_0x0a00('0x2e')],'name':_0x5060c2[_0x0a00('0x30')][_0x0a00('0xd')][_0x0a00('0x2e')]});}}logger['info'](_0x0a00('0x31'));return BPromise[_0x0a00('0x2f')]({'id':_0x372e9b['name_value_list'][_0x0a00('0x32')][_0x0a00('0x2e')],'name':_0x372e9b[_0x0a00('0x30')]['user_name'][_0x0a00('0x2e')]});});}else{logger[_0x0a00('0xb')](_0x0a00('0x33'));return BPromise[_0x0a00('0x2f')]({'id':_0x372e9b[_0x0a00('0x30')][_0x0a00('0x32')]['value'],'name':_0x372e9b[_0x0a00('0x30')]['user_name'][_0x0a00('0x2e')]});}}function getEndUser(_0x1a8d67,_0x134bff,_0x4356bd,_0x373f4e){logger[_0x0a00('0xb')](_0x0a00('0x34'),_0x4356bd);return request({'form':{'method':_0x0a00('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x373f4e['id'],'module_name':_0x0a00('0x35'),'query':util['format'](_0x0a00('0x36'),_0x4356bd),'order_by':'','offset':'0','select_fields':['id',_0x0a00('0xd'),_0x0a00('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0a00('0x2b')](function(_0x252c90){if(_0x252c90[_0x0a00('0x2c')][_0x0a00('0x1a')]){var _0x168968=_['find'](_0x252c90[_0x0a00('0x2c')],function(_0x21bb22){return _0x21bb22[_0x0a00('0x30')][_0x0a00('0x37')][_0x0a00('0x2e')]===_0x4356bd;});if(_0x168968){logger[_0x0a00('0xb')](_0x0a00('0x38'));return BPromise['resolve']({'id':_0x168968[_0x0a00('0x30')]['id']['value'],'name':_0x168968['name_value_list'][_0x0a00('0xd')]['value'],'phone':_0x168968[_0x0a00('0x30')]['phone_home'][_0x0a00('0x2e')]});}}else{logger[_0x0a00('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x0a00('0x20'),'rest_data':JSON[_0x0a00('0x28')]({'session':_0x373f4e['id'],'module_name':_0x0a00('0x35'),'name_value_list':[{'name':'first_name','value':_0x134bff!==_0x0a00('0x39')?_0x134bff:util['format'](_0x0a00('0x3a'),_0x4356bd)},{'name':_0x0a00('0x37'),'value':_0x4356bd}]})}})[_0x0a00('0x2b')](function(_0x517483){logger[_0x0a00('0xb')](_0x0a00('0x3b'));return BPromise[_0x0a00('0x2f')]({'id':_0x517483['id'],'name':_0x517483['entry_list'][_0x0a00('0x3c')]['value'],'phone':_0x517483['entry_list'][_0x0a00('0x37')][_0x0a00('0x2e')]});});}});}function request(_0x1d2af6){logger[_0x0a00('0x3d')]('[HTTP]',JSON[_0x0a00('0x28')](_0x1d2af6));return rp(_[_0x0a00('0x3e')](def,_0x1d2af6));}function getTags(_0x4f3c3d,_0x27959b){var _0x34bda5=[];if(_0x4f3c3d&&_0x4f3c3d[_0x0a00('0x1a')]>0x0){_0x34bda5=_[_0x0a00('0x3f')](_0x4f3c3d,_0x27959b);}return _0x34bda5;}function getCustomFields(_0x4fecc9,_0xb6ff28){var _0x18fb07=[];var _0x159fe3={'custom_fields':[]};if(_0x4fecc9['length']>0x0){_[_0x0a00('0x1b')](_0x4fecc9,function(_0x57a0d0){if(_0x57a0d0[_0x0a00('0x40')]===_0x0a00('0x41')&&_0x57a0d0[_0x0a00('0x42')]&&!_0x57a0d0[_0x0a00('0x43')]){_0x159fe3[_0x57a0d0['nameField'][_0x0a00('0x44')]()]=_0x57a0d0[_0x0a00('0x45')]['toString']();}else if(_0x57a0d0[_0x0a00('0x40')]==='string'&&_0x57a0d0[_0x0a00('0x1e')]&&_0x57a0d0[_0x0a00('0x43')]){_0x159fe3[_0x0a00('0x46')][_0x0a00('0x1d')]({'id':_0x57a0d0[_0x0a00('0x1e')],'value':_0x57a0d0[_0x0a00('0x45')][_0x0a00('0x47')]()});}else if(_0x57a0d0['type']===_0x0a00('0x48')&&_0x57a0d0[_0x0a00('0x1c')]&&_0x57a0d0['idField']&&_0x57a0d0[_0x0a00('0x43')]){_0xb6ff28[_0x57a0d0[_0x0a00('0x1c')]]&&_0x159fe3[_0x0a00('0x46')][_0x0a00('0x1d')]({'id':_0x57a0d0[_0x0a00('0x1e')],'value':_0xb6ff28[_0x57a0d0[_0x0a00('0x1c')]]['toString']()});}else if(_0x57a0d0[_0x0a00('0x40')]==='customVariable'&&_0x57a0d0[_0x0a00('0x49')]&&_0x57a0d0[_0x0a00('0x49')][_0x0a00('0xd')]&&_0x57a0d0['idField']&&_0x57a0d0[_0x0a00('0x43')]){_0xb6ff28[_0x57a0d0[_0x0a00('0x49')][_0x0a00('0xd')]['toLowerCase']()]&&_0x159fe3[_0x0a00('0x46')][_0x0a00('0x1d')]({'id':_0x57a0d0[_0x0a00('0x1e')],'value':_0xb6ff28[_0x57a0d0[_0x0a00('0x49')][_0x0a00('0xd')]['toLowerCase']()][_0x0a00('0x47')]()});}});}return _0x159fe3;}function getConnection(_0x34cd19){return request({'method':_0x0a00('0xa'),'form':{'method':_0x0a00('0x4a'),'input_type':_0x0a00('0x20'),'response_type':'JSON','rest_data':JSON[_0x0a00('0x28')]({'user_auth':{'user_name':_0x34cd19[_0x0a00('0x4b')],'password':_0x34cd19[_0x0a00('0x4c')],'encryption':_0x0a00('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x0a00('0x2b')](function(_0x461d03){var _0x47982f=_0x461d03;if(_0x47982f['id']){def[_0x0a00('0x4e')]=_0x47982f['id'];return BPromise['resolve'](_0x47982f);}else{throw new Error(util[_0x0a00('0x21')](_0x0a00('0x4f'),_0x34cd19['id']));}});}function setRelationship(_0x52fe33,_0x1221f0,_0x4637f8,_0x1d26e8){return request({'form':{'method':_0x0a00('0x50'),'input_type':'JSON','response_type':_0x0a00('0x20'),'rest_data':JSON[_0x0a00('0x28')]({'session':_0x52fe33['id'],'module_name':'Calls','module_id':_0x4637f8['id'],'link_field_name':_0x1d26e8,'related_ids':[_0x1221f0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3dc8ca,_0x28c07c,_0x3fb713,_0xd45ca8,_0x1ce3c7,_0x27bdeb){var _0x55aa3e,_0x30afc5,_0xa42578,_0x23810f;_0x27bdeb[_0x0a00('0x51')]=intUtil['stripTrailingSlash'](_0x27bdeb[_0x0a00('0x51')]);_0x27bdeb[_0x0a00('0x52')]=intUtil[_0x0a00('0x53')](_0x27bdeb[_0x0a00('0x52')]);def['uri']=util['format'](_0x0a00('0x54'),_0x27bdeb[_0x0a00('0x51')]);if(_0x1ce3c7&&_0x1ce3c7[_0x0a00('0x55')]){logger['info'](_0x0a00('0x56'),_0x0a00('0x57'));_0x28c07c[_0x0a00('0x58')]=util[_0x0a00('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27bdeb[_0x0a00('0x52')],_0x28c07c['uniqueid'],md5(_0x28c07c[_0x0a00('0x59')]));}else{_0x28c07c[_0x0a00('0x58')]='';}return getConnection(_0x27bdeb)[_0x0a00('0x2b')](function(_0x2dfa87){_0x23810f=_0x2dfa87;return getUser(_0x27bdeb,_0xd45ca8[_0x0a00('0xd')],_0x23810f);})[_0x0a00('0x2b')](function(_0x2dada3){_0x55aa3e=_0x2dada3;logger[_0x0a00('0xb')]('The\x20User\x20ID\x20is:',_0x55aa3e['id']);return getEndUser(_0x27bdeb,_0x28c07c[_0x0a00('0x5a')],_0x28c07c['calleridnum'],_0x23810f);})[_0x0a00('0x2b')](function(_0x46aca7){_0x30afc5=_0x46aca7;logger[_0x0a00('0xb')](_0x0a00('0x5b'),_0x30afc5['id']);return getTicket(_0x27bdeb,_0x55aa3e,_0x30afc5,_0x3fb713,_0x28c07c,_0x3fb713[_0x0a00('0x5c')],_0x23810f,_0x0a00('0x5d'));})[_0x0a00('0x2b')](function(_0x23616c){_0xa42578=_0x23616c;logger[_0x0a00('0xb')](_0x0a00('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0xa42578['id']);return setRelationship(_0x23810f,_0x55aa3e,_0xa42578,_0x0a00('0x5f'));})[_0x0a00('0x2b')](function(){return setRelationship(_0x23810f,_0x30afc5,_0xa42578,_0x0a00('0x60'));})[_0x0a00('0x2b')](function(){return getServerInfo(_0x23810f);})[_0x0a00('0x2b')](function(_0x2e5505){var _0x5932d3=parseInt(_0x2e5505['version'][_0x0a00('0x61')](0x0));var _0x10928c=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x27bdeb[_0x0a00('0x51')],_0xa42578['id']);if(_0x5932d3>0x6){_0x10928c=util['format'](_0x0a00('0x62'),_0x27bdeb[_0x0a00('0x51')],_0xa42578['id']);}logger['info'](_0x0a00('0x56'),_0x0a00('0x63'));emit(util[_0x0a00('0x21')](_0x0a00('0x64'),_0xd45ca8[_0x0a00('0xd')]),_0x0a00('0x65'),{'uri':_0x10928c});})[_0x0a00('0x66')](function(_0x43389c){logger[_0x0a00('0x67')]('[QUEUE]',JSON[_0x0a00('0x28')](_0x43389c));});};exports[_0x0a00('0x68')]=function(_0x61bc09,_0xecaaa6,_0x46a815,_0x5273a1,_0x48b971,_0x2ac317,_0x4aee19){var _0x980853,_0x4dd640,_0x475824,_0x334c00;_0x2ac317[_0x0a00('0x51')]=intUtil['stripTrailingSlash'](_0x2ac317[_0x0a00('0x51')]);_0x2ac317['serverUrl']=intUtil[_0x0a00('0x53')](_0x2ac317[_0x0a00('0x52')]);def[_0x0a00('0x69')]=util[_0x0a00('0x21')](_0x0a00('0x54'),_0x2ac317[_0x0a00('0x51')]);if(_0x4aee19&&_0x4aee19[_0x0a00('0x6a')]&&_0x4aee19[_0x0a00('0x6a')]!==_0x0a00('0x6b')){logger[_0x0a00('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xecaaa6['recordingURL']=util['format'](_0x0a00('0x6c'),_0x2ac317[_0x0a00('0x52')],_0xecaaa6[_0x0a00('0x59')],md5(_0xecaaa6['uniqueid']));}return getConnection(_0x2ac317)[_0x0a00('0x2b')](function(_0x435d48){_0x334c00=_0x435d48;return getUser(_0x2ac317,_0x5273a1[_0x0a00('0xd')],_0x334c00);})[_0x0a00('0x2b')](function(_0x48dfe6){_0x980853=_0x48dfe6;logger['info']('The\x20User\x20ID\x20is:',_0x980853['id']);return getEndUser(_0x2ac317,_0xecaaa6[_0x0a00('0x6d')],_0xecaaa6[_0x0a00('0x6e')],_0x334c00);})[_0x0a00('0x2b')](function(_0x2351ec){_0x4dd640=_0x2351ec;logger['info'](_0x0a00('0x5b'),_0x4dd640['id']);return getTicket(_0x2ac317,_0x980853,_0x4dd640,_0x46a815,_0xecaaa6,_0x46a815[_0x0a00('0x5c')],_0x334c00,_0x0a00('0x6f'));})[_0x0a00('0x2b')](function(_0x28c598){_0x475824=_0x28c598;logger[_0x0a00('0xb')](_0x0a00('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x475824['id']);return setRelationship(_0x334c00,_0x980853,_0x475824,'users');})[_0x0a00('0x2b')](function(){return setRelationship(_0x334c00,_0x4dd640,_0x475824,_0x0a00('0x60'));})['then'](function(){return getServerInfo(_0x334c00);})[_0x0a00('0x2b')](function(_0xcc0888){var _0x3a3ec3=parseInt(_0xcc0888[_0x0a00('0x70')][_0x0a00('0x61')](0x0));var _0xf95de9=util[_0x0a00('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2ac317['remoteUri'],_0x475824['id']);if(_0x3a3ec3>0x6){_0xf95de9=util[_0x0a00('0x21')](_0x0a00('0x62'),_0x2ac317[_0x0a00('0x51')],_0x475824['id']);}logger[_0x0a00('0xb')](_0x0a00('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0a00('0x21')](_0x0a00('0x64'),_0x5273a1['name']),_0x0a00('0x65'),{'uri':_0xf95de9});})[_0x0a00('0x66')](function(_0x2d29ed){logger['error'](_0x0a00('0x71'),JSON[_0x0a00('0x28')](_0x2d29ed));});};exports[_0x0a00('0x72')]=function(_0x2a2fd8,_0x2a723d,_0xfeb571,_0x596c83,_0x226385,_0x32771c){var _0xfd95f9,_0x2f03b8,_0x595f35,_0xa34299;_0x32771c[_0x0a00('0x51')]=intUtil[_0x0a00('0x53')](_0x32771c[_0x0a00('0x51')]);_0x32771c[_0x0a00('0x52')]=intUtil[_0x0a00('0x53')](_0x32771c['serverUrl']);def[_0x0a00('0x69')]=util[_0x0a00('0x21')](_0x0a00('0x54'),_0x32771c['remoteUri']);if(_0x226385&&_0x226385[_0x0a00('0x55')]){logger[_0x0a00('0xb')]('['+_0x2a723d[_0x0a00('0x73')][_0x0a00('0x74')]()+']',_0x0a00('0x57'));_0x2a723d[_0x0a00('0x58')]=util[_0x0a00('0x21')](_0x0a00('0x6c'),_0x32771c[_0x0a00('0x52')],_0x2a723d['uniqueid'],md5(_0x2a723d[_0x0a00('0x59')]));}else{_0x2a723d[_0x0a00('0x58')]='';}return getConnection(_0x32771c)[_0x0a00('0x2b')](function(_0x50e21d){_0xa34299=_0x50e21d;if(!_[_0x0a00('0x26')](_0x596c83)){return getUser(_0x32771c,_0x596c83['name'],_0xa34299);}else{return getUser(_0x32771c,null,_0xa34299);}})['then'](function(_0x5064cc){_0xfd95f9=_0x5064cc;logger[_0x0a00('0xb')]('The\x20User\x20ID\x20is:',_0xfd95f9['id']);return getEndUser(_0x32771c,_0x2a723d[_0x0a00('0x5a')],_0x2a723d['calleridnum'],_0xa34299);})[_0x0a00('0x2b')](function(_0x35f820){_0x2f03b8=_0x35f820;logger['info'](_0x0a00('0x5b'),_0x2f03b8['id']);return getTicket(_0x32771c,_0xfd95f9,_0x2f03b8,_0xfeb571,_0x2a723d,_0xfeb571[_0x0a00('0x5c')],_0xa34299,_0x0a00('0x5d'));})[_0x0a00('0x2b')](function(_0x325ae0){_0x595f35=_0x325ae0;logger['info'](_0x0a00('0x5e'));logger[_0x0a00('0xb')](_0x0a00('0x75'),_0x595f35['id']);return setRelationship(_0xa34299,_0xfd95f9,_0x595f35,'users');})[_0x0a00('0x2b')](function(){return setRelationship(_0xa34299,_0x2f03b8,_0x595f35,'contacts');})[_0x0a00('0x2b')](function(){return getServerInfo(_0xa34299);})[_0x0a00('0x66')](function(_0x1c33b1){logger['error']('['+_0x2a723d[_0x0a00('0x73')][_0x0a00('0x74')]()+']',JSON[_0x0a00('0x28')](_0x1c33b1));});}; \ No newline at end of file +var _0x36d3=['user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','forEach','type','customField','toLowerCase','content','push','variable','idField','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','toUpperCase','calleridnum','Fields','Inbound','catch','request-promise','md5','util','ioredis','./util','sugarcrm','redis','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x174a14,_0x4f943f){var _0x18f484=function(_0x1affc9){while(--_0x1affc9){_0x174a14['push'](_0x174a14['shift']());}};_0x18f484(++_0x4f943f);}(_0x36d3,0x19f));var _0x336d=function(_0x239818,_0x31e10d){_0x239818=_0x239818-0x0;var _0xe86372=_0x36d3[_0x239818];return _0xe86372;};'use strict';var _=require('lodash');var rp=require(_0x336d('0x0'));var BPromise=require('bluebird');var md5=require(_0x336d('0x1'));var util=require(_0x336d('0x2'));var Redis=require(_0x336d('0x3'));var intUtil=require(_0x336d('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x336d('0x5'));config['redis']=_['defaults'](config[_0x336d('0x6')],{'host':_0x336d('0x7'),'port':0x18eb});var io=require(_0x336d('0x8'))(new Redis(config['redis']));var def={'method':_0x336d('0x9'),'json':!![]};function emit(_0x1b6cdb,_0x15ae50,_0x16e883){io['to'](_0x1b6cdb)['emit'](_0x15ae50,_0x16e883);}function getTicket(_0x3e0fe5,_0x3d0301,_0xe839a2,_0xe8045a,_0x408eb8,_0x214bac,_0x3de0ff,_0x48c9bb){logger['info'](_0x336d('0xa'));var _0x5906b7=new Date();var _0x2d363e=[{'name':_0x336d('0xb'),'value':intUtil[_0x336d('0xc')](_0xe8045a[_0x336d('0xd')],_0x408eb8,'\x20')},{'name':_0x336d('0xe'),'value':_0x3d0301['id']},{'name':_0x336d('0xf'),'value':_0x3d0301['id']},{'name':_0x336d('0x10'),'value':intUtil[_0x336d('0xc')](_0xe8045a[_0x336d('0x11')],_0x408eb8,'\x0a')},{'name':_0x336d('0x12'),'value':_0x5906b7['toISOString']()[_0x336d('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x336d('0x14'),'value':_0xe839a2['id']},{'name':_0x336d('0x15'),'value':_0x336d('0x16')},{'name':_0x336d('0x17'),'value':_0xe839a2[_0x336d('0xb')]},{'name':_0x336d('0x18'),'value':_0x48c9bb}];if(_0x214bac[_0x336d('0x19')]){_['forEach'](_0x214bac,function(_0x1ed0c7){if(_0x408eb8[_0x1ed0c7[_0x336d('0x1a')]]){_0x2d363e['push']({'name':_0x1ed0c7['idField'],'value':_0x408eb8[_0x1ed0c7[_0x336d('0x1a')]]});}});}return request({'form':{'method':_0x336d('0x1b'),'input_type':_0x336d('0x1c'),'response_type':_0x336d('0x1c'),'rest_data':JSON[_0x336d('0x1d')]({'session':_0x3de0ff['id'],'module_name':_0x336d('0x1e'),'name_value_list':_0x2d363e})}});}function getAuth(_0x229de2){return util[_0x336d('0x1f')](_0x336d('0x20'),new Buffer(_0x229de2[_0x336d('0x21')]+':X')[_0x336d('0x22')](_0x336d('0x23')));}function getServerInfo(_0xc061b9){return request({'form':{'method':_0x336d('0x24'),'input_type':_0x336d('0x1c'),'response_type':'JSON','rest_data':JSON[_0x336d('0x1d')]({'session':_0xc061b9['id']})}});}function getUser(_0x24e48a,_0x22a748,_0x469658){if(!_[_0x336d('0x25')](_0x22a748)){logger[_0x336d('0x26')](_0x336d('0x27'),_0x22a748);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x336d('0x1c'),'rest_data':JSON[_0x336d('0x1d')]({'session':_0x469658['id'],'module_name':_0x336d('0x28'),'query':util[_0x336d('0x1f')](_0x336d('0x29'),_0x22a748),'order_by':'','offset':'0','select_fields':['id',_0x336d('0xb'),_0x336d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x336d('0x2b')](function(_0x394519){if(_0x394519[_0x336d('0x2c')]['length']){var _0x409bd5=_['find'](_0x394519['entry_list'],function(_0x7bdd82){return _0x7bdd82['name_value_list'][_0x336d('0x2a')][_0x336d('0x2d')]===_0x22a748;});if(_0x409bd5){logger[_0x336d('0x26')]('Agent\x20found!');return BPromise[_0x336d('0x2e')]({'id':_0x409bd5[_0x336d('0x2f')]['id'][_0x336d('0x2d')],'name':_0x409bd5[_0x336d('0x2f')][_0x336d('0xb')][_0x336d('0x2d')]});}}logger[_0x336d('0x26')](_0x336d('0x30'));return BPromise[_0x336d('0x2e')]({'id':_0x469658[_0x336d('0x2f')][_0x336d('0x31')]['value'],'name':_0x469658[_0x336d('0x2f')][_0x336d('0x2a')][_0x336d('0x2d')]});});}else{logger[_0x336d('0x26')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x336d('0x2e')]({'id':_0x469658[_0x336d('0x2f')][_0x336d('0x31')]['value'],'name':_0x469658[_0x336d('0x2f')][_0x336d('0x2a')][_0x336d('0x2d')]});}}function getEndUser(_0x1e7346,_0x736f01,_0x3f22ef,_0x30e5c2){logger[_0x336d('0x26')](_0x336d('0x32'),_0x3f22ef);return request({'form':{'method':_0x336d('0x33'),'input_type':_0x336d('0x1c'),'response_type':_0x336d('0x1c'),'rest_data':JSON[_0x336d('0x1d')]({'session':_0x30e5c2['id'],'module_name':_0x336d('0x16'),'query':util[_0x336d('0x1f')](_0x336d('0x34'),_0x3f22ef),'order_by':'','offset':'0','select_fields':['id',_0x336d('0xb'),_0x336d('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x336d('0x2b')](function(_0x4e20ef){if(_0x4e20ef['entry_list']['length']){var _0xdbabc3=_[_0x336d('0x36')](_0x4e20ef['entry_list'],function(_0xc5edc9){return _0xc5edc9[_0x336d('0x2f')][_0x336d('0x35')][_0x336d('0x2d')]===_0x3f22ef;});if(_0xdbabc3){logger[_0x336d('0x26')]('Enduser\x20found!');return BPromise[_0x336d('0x2e')]({'id':_0xdbabc3['name_value_list']['id'][_0x336d('0x2d')],'name':_0xdbabc3['name_value_list'][_0x336d('0xb')][_0x336d('0x2d')],'phone':_0xdbabc3['name_value_list'][_0x336d('0x35')]['value']});}}else{logger[_0x336d('0x26')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x336d('0x1c'),'response_type':_0x336d('0x1c'),'rest_data':JSON[_0x336d('0x1d')]({'session':_0x30e5c2['id'],'module_name':_0x336d('0x16'),'name_value_list':[{'name':'first_name','value':_0x736f01!==_0x336d('0x37')?_0x736f01:util[_0x336d('0x1f')](_0x336d('0x38'),_0x3f22ef)},{'name':'phone_home','value':_0x3f22ef}]})}})[_0x336d('0x2b')](function(_0x3ca16e){logger[_0x336d('0x26')](_0x336d('0x39'));return BPromise[_0x336d('0x2e')]({'id':_0x3ca16e['id'],'name':_0x3ca16e[_0x336d('0x2c')][_0x336d('0x3a')]['value'],'phone':_0x3ca16e[_0x336d('0x2c')]['phone_home']['value']});});}});}function request(_0x4e1b05){logger[_0x336d('0x3b')](_0x336d('0x3c'),JSON[_0x336d('0x1d')](_0x4e1b05));return rp(_[_0x336d('0x3d')](def,_0x4e1b05));}function getTags(_0x542b10,_0x5cafcc){var _0x102ddc=[];if(_0x542b10&&_0x542b10[_0x336d('0x19')]>0x0){_0x102ddc=_['map'](_0x542b10,_0x5cafcc);}return _0x102ddc;}function getCustomFields(_0x2a96d1,_0x3e31c6){var _0xdc76d4=[];var _0x54c2d4={'custom_fields':[]};if(_0x2a96d1[_0x336d('0x19')]>0x0){_[_0x336d('0x3e')](_0x2a96d1,function(_0x5a3318){if(_0x5a3318[_0x336d('0x3f')]==='string'&&_0x5a3318['nameField']&&!_0x5a3318[_0x336d('0x40')]){_0x54c2d4[_0x5a3318['nameField'][_0x336d('0x41')]()]=_0x5a3318[_0x336d('0x42')]['toString']();}else if(_0x5a3318[_0x336d('0x3f')]==='string'&&_0x5a3318['idField']&&_0x5a3318[_0x336d('0x40')]){_0x54c2d4['custom_fields'][_0x336d('0x43')]({'id':_0x5a3318['idField'],'value':_0x5a3318[_0x336d('0x42')][_0x336d('0x22')]()});}else if(_0x5a3318[_0x336d('0x3f')]===_0x336d('0x44')&&_0x5a3318[_0x336d('0x1a')]&&_0x5a3318[_0x336d('0x45')]&&_0x5a3318[_0x336d('0x40')]){_0x3e31c6[_0x5a3318['variableName']]&&_0x54c2d4[_0x336d('0x46')][_0x336d('0x43')]({'id':_0x5a3318[_0x336d('0x45')],'value':_0x3e31c6[_0x5a3318[_0x336d('0x1a')]][_0x336d('0x22')]()});}else if(_0x5a3318[_0x336d('0x3f')]===_0x336d('0x47')&&_0x5a3318['Variable']&&_0x5a3318['Variable'][_0x336d('0xb')]&&_0x5a3318[_0x336d('0x45')]&&_0x5a3318[_0x336d('0x40')]){_0x3e31c6[_0x5a3318[_0x336d('0x48')][_0x336d('0xb')][_0x336d('0x41')]()]&&_0x54c2d4['custom_fields']['push']({'id':_0x5a3318[_0x336d('0x45')],'value':_0x3e31c6[_0x5a3318[_0x336d('0x48')]['name'][_0x336d('0x41')]()]['toString']()});}});}return _0x54c2d4;}function getConnection(_0x3221b4){return request({'method':_0x336d('0x9'),'form':{'method':_0x336d('0x49'),'input_type':_0x336d('0x1c'),'response_type':_0x336d('0x1c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3221b4['username'],'password':_0x3221b4[_0x336d('0x4a')],'encryption':_0x336d('0x4b')},'application':_0x336d('0x4c')})}})[_0x336d('0x2b')](function(_0x40a1a4){var _0x271b67=_0x40a1a4;if(_0x271b67['id']){def['sessionID']=_0x271b67['id'];return BPromise['resolve'](_0x271b67);}else{throw new Error(util[_0x336d('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x3221b4['id']));}});}function setRelationship(_0x291c63,_0x1dd32f,_0xc83ed3,_0x31ff9f){return request({'form':{'method':_0x336d('0x4d'),'input_type':_0x336d('0x1c'),'response_type':'JSON','rest_data':JSON[_0x336d('0x1d')]({'session':_0x291c63['id'],'module_name':_0x336d('0x1e'),'module_id':_0xc83ed3['id'],'link_field_name':_0x31ff9f,'related_ids':[_0x1dd32f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x336d('0x4e')]=function(_0x21448a,_0x1df91c,_0x267e2b,_0x5e58dc,_0x5f3195,_0x150567){var _0x337c42,_0x5ae8cc,_0x23f8df,_0x50e0f2;_0x150567[_0x336d('0x4f')]=intUtil[_0x336d('0x50')](_0x150567['remoteUri']);_0x150567[_0x336d('0x51')]=intUtil[_0x336d('0x50')](_0x150567[_0x336d('0x51')]);def[_0x336d('0x52')]=util['format'](_0x336d('0x53'),_0x150567[_0x336d('0x4f')]);if(_0x5f3195&&_0x5f3195[_0x336d('0x54')]){logger[_0x336d('0x26')](_0x336d('0x55'),_0x336d('0x56'));_0x1df91c[_0x336d('0x57')]=util[_0x336d('0x1f')](_0x336d('0x58'),_0x150567[_0x336d('0x51')],_0x1df91c['uniqueid'],md5(_0x1df91c[_0x336d('0x59')]));}else{_0x1df91c['recordingURL']='';}return getConnection(_0x150567)[_0x336d('0x2b')](function(_0x22d8c4){_0x50e0f2=_0x22d8c4;return getUser(_0x150567,_0x5e58dc[_0x336d('0xb')],_0x50e0f2);})[_0x336d('0x2b')](function(_0x246a17){_0x337c42=_0x246a17;logger[_0x336d('0x26')]('The\x20User\x20ID\x20is:',_0x337c42['id']);return getEndUser(_0x150567,_0x1df91c[_0x336d('0x5a')],_0x1df91c['calleridnum'],_0x50e0f2);})['then'](function(_0x5dfafe){_0x5ae8cc=_0x5dfafe;logger[_0x336d('0x26')]('The\x20Enduser\x20ID\x20is:',_0x5ae8cc['id']);return getTicket(_0x150567,_0x337c42,_0x5ae8cc,_0x267e2b,_0x1df91c,_0x267e2b['Fields'],_0x50e0f2,'Inbound');})[_0x336d('0x2b')](function(_0x364015){_0x23f8df=_0x364015;logger[_0x336d('0x26')]('Ticket\x20created!');logger[_0x336d('0x26')]('The\x20Ticket\x20ID\x20is:',_0x23f8df['id']);return setRelationship(_0x50e0f2,_0x337c42,_0x23f8df,_0x336d('0x5b'));})['then'](function(){return setRelationship(_0x50e0f2,_0x5ae8cc,_0x23f8df,_0x336d('0x5c'));})['then'](function(){return getServerInfo(_0x50e0f2);})[_0x336d('0x2b')](function(_0xcb29c5){var _0x46dcef=parseInt(_0xcb29c5[_0x336d('0x5d')][_0x336d('0x5e')](0x0));var _0x41dd34=util[_0x336d('0x1f')](_0x336d('0x5f'),_0x150567[_0x336d('0x4f')],_0x23f8df['id']);if(_0x46dcef>0x6){_0x41dd34=util[_0x336d('0x1f')](_0x336d('0x60'),_0x150567[_0x336d('0x4f')],_0x23f8df['id']);}logger[_0x336d('0x26')]('[QUEUE]',_0x336d('0x61'));emit(util['format']('user:%s',_0x5e58dc['name']),_0x336d('0x62'),{'uri':_0x41dd34});})['catch'](function(_0x580fc4){logger[_0x336d('0x63')]('[QUEUE]',JSON[_0x336d('0x1d')](_0x580fc4));});};exports['outbound']=function(_0x2a8ba6,_0x5eb246,_0x53888e,_0x16a95e,_0x90046c,_0x1234ce,_0x3975d2){var _0x97143f,_0x2e81a8,_0x13d571,_0x1a08a4;_0x1234ce[_0x336d('0x4f')]=intUtil[_0x336d('0x50')](_0x1234ce[_0x336d('0x4f')]);_0x1234ce['serverUrl']=intUtil['stripTrailingSlash'](_0x1234ce['serverUrl']);def[_0x336d('0x52')]=util[_0x336d('0x1f')](_0x336d('0x53'),_0x1234ce['remoteUri']);if(_0x3975d2&&_0x3975d2[_0x336d('0x64')]&&_0x3975d2[_0x336d('0x64')]!=='none'){logger[_0x336d('0x26')](_0x336d('0x65'),_0x336d('0x56'));_0x5eb246[_0x336d('0x57')]=util[_0x336d('0x1f')](_0x336d('0x58'),_0x1234ce[_0x336d('0x51')],_0x5eb246[_0x336d('0x59')],md5(_0x5eb246[_0x336d('0x59')]));}return getConnection(_0x1234ce)['then'](function(_0x3bc0ef){_0x1a08a4=_0x3bc0ef;return getUser(_0x1234ce,_0x16a95e[_0x336d('0xb')],_0x1a08a4);})[_0x336d('0x2b')](function(_0x3635eb){_0x97143f=_0x3635eb;logger[_0x336d('0x26')](_0x336d('0x66'),_0x97143f['id']);return getEndUser(_0x1234ce,_0x5eb246[_0x336d('0x67')],_0x5eb246[_0x336d('0x68')],_0x1a08a4);})[_0x336d('0x2b')](function(_0x3fccd7){_0x2e81a8=_0x3fccd7;logger[_0x336d('0x26')](_0x336d('0x69'),_0x2e81a8['id']);return getTicket(_0x1234ce,_0x97143f,_0x2e81a8,_0x53888e,_0x5eb246,_0x53888e['Fields'],_0x1a08a4,_0x336d('0x6a'));})['then'](function(_0x372acb){_0x13d571=_0x372acb;logger['info'](_0x336d('0x6b'));logger[_0x336d('0x26')](_0x336d('0x6c'),_0x13d571['id']);return setRelationship(_0x1a08a4,_0x97143f,_0x13d571,'users');})['then'](function(){return setRelationship(_0x1a08a4,_0x2e81a8,_0x13d571,_0x336d('0x5c'));})[_0x336d('0x2b')](function(){return getServerInfo(_0x1a08a4);})[_0x336d('0x2b')](function(_0x3ae871){var _0x54a8dc=parseInt(_0x3ae871['version'][_0x336d('0x5e')](0x0));var _0x31b213=util[_0x336d('0x1f')](_0x336d('0x5f'),_0x1234ce['remoteUri'],_0x13d571['id']);if(_0x54a8dc>0x6){_0x31b213=util[_0x336d('0x1f')](_0x336d('0x60'),_0x1234ce[_0x336d('0x4f')],_0x13d571['id']);}logger[_0x336d('0x26')](_0x336d('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x336d('0x6d'),_0x16a95e[_0x336d('0xb')]),_0x336d('0x62'),{'uri':_0x31b213});})['catch'](function(_0x5c281b){logger[_0x336d('0x63')]('[OUTBOUND]',JSON[_0x336d('0x1d')](_0x5c281b));});};exports[_0x336d('0x6e')]=function(_0xa50138,_0x4d63aa,_0x48e162,_0x48cc96,_0x37cbea,_0x42b423){var _0x551d1c,_0x119d29,_0x7fdfa4,_0x29d257;_0x42b423['remoteUri']=intUtil[_0x336d('0x50')](_0x42b423[_0x336d('0x4f')]);_0x42b423[_0x336d('0x51')]=intUtil[_0x336d('0x50')](_0x42b423[_0x336d('0x51')]);def[_0x336d('0x52')]=util[_0x336d('0x1f')](_0x336d('0x53'),_0x42b423[_0x336d('0x4f')]);if(_0x37cbea&&_0x37cbea[_0x336d('0x54')]){logger[_0x336d('0x26')]('['+_0x4d63aa['lastevent'][_0x336d('0x6f')]()+']',_0x336d('0x56'));_0x4d63aa[_0x336d('0x57')]=util['format'](_0x336d('0x58'),_0x42b423[_0x336d('0x51')],_0x4d63aa['uniqueid'],md5(_0x4d63aa[_0x336d('0x59')]));}else{_0x4d63aa[_0x336d('0x57')]='';}return getConnection(_0x42b423)['then'](function(_0x2d0e43){_0x29d257=_0x2d0e43;if(!_[_0x336d('0x25')](_0x48cc96)){return getUser(_0x42b423,_0x48cc96[_0x336d('0xb')],_0x29d257);}else{return getUser(_0x42b423,null,_0x29d257);}})['then'](function(_0x21c7c2){_0x551d1c=_0x21c7c2;logger[_0x336d('0x26')](_0x336d('0x66'),_0x551d1c['id']);return getEndUser(_0x42b423,_0x4d63aa[_0x336d('0x5a')],_0x4d63aa[_0x336d('0x70')],_0x29d257);})['then'](function(_0x5cd969){_0x119d29=_0x5cd969;logger[_0x336d('0x26')](_0x336d('0x69'),_0x119d29['id']);return getTicket(_0x42b423,_0x551d1c,_0x119d29,_0x48e162,_0x4d63aa,_0x48e162[_0x336d('0x71')],_0x29d257,_0x336d('0x72'));})[_0x336d('0x2b')](function(_0x37732b){_0x7fdfa4=_0x37732b;logger['info'](_0x336d('0x6b'));logger[_0x336d('0x26')](_0x336d('0x6c'),_0x7fdfa4['id']);return setRelationship(_0x29d257,_0x551d1c,_0x7fdfa4,'users');})['then'](function(){return setRelationship(_0x29d257,_0x119d29,_0x7fdfa4,_0x336d('0x5c'));})[_0x336d('0x2b')](function(){return getServerInfo(_0x29d257);})[_0x336d('0x73')](function(_0x41df57){logger[_0x336d('0x63')]('['+_0x4d63aa['lastevent'][_0x336d('0x6f')]()+']',JSON[_0x336d('0x1d')](_0x41df57));});}; \ 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 b79bfc4..284e63f 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 _0x5019=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','slice','lastIndexOf','isNil','test','util','getString','length','sortBy','type','string','content','variable','variableName','push','toString','customVariable'];(function(_0x433f01,_0x4b8594){var _0x35c353=function(_0x53ef5d){while(--_0x53ef5d){_0x433f01['push'](_0x433f01['shift']());}};_0x35c353(++_0x4b8594);}(_0x5019,0x8a));var _0x9501=function(_0x52ecff,_0x2cba3a){_0x52ecff=_0x52ecff-0x0;var _0x1347b7=_0x5019[_0x52ecff];return _0x1347b7;};'use strict';var _=require('lodash');var util=require(_0x9501('0x0'));exports[_0x9501('0x1')]=function(_0x4470ff,_0x1a4032,_0x3a04ef){var _0x2da407=[];if(_0x4470ff[_0x9501('0x2')]>0x0){var _0x11c5aa=_[_0x9501('0x3')](_0x4470ff,['id']);for(var _0x48fe0c=0x0;_0x48fe0c<_0x11c5aa[_0x9501('0x2')];_0x48fe0c++){var _0x11b963=_0x11c5aa[_0x48fe0c];if(_0x11b963[_0x9501('0x4')]===_0x9501('0x5')){_0x2da407['push'](_0x11b963[_0x9501('0x6')]);}else if(_0x11b963[_0x9501('0x4')]===_0x9501('0x7')&&_0x11b963['variableName']){_0x1a4032[_0x11b963[_0x9501('0x8')]]&&_0x2da407[_0x9501('0x9')](_0x1a4032[_0x11b963[_0x9501('0x8')]][_0x9501('0xa')]());}else if(_0x11b963[_0x9501('0x4')]===_0x9501('0xb')&&_0x11b963[_0x9501('0xc')]&&_0x11b963['Variable'][_0x9501('0xd')]){_0x1a4032[_0x11b963[_0x9501('0xc')]['name'][_0x9501('0xe')]()]&&_0x2da407['push'](_0x1a4032[_0x11b963[_0x9501('0xc')][_0x9501('0xd')][_0x9501('0xe')]()][_0x9501('0xa')]());}else if(_0x11b963[_0x9501('0x4')]===_0x9501('0xf')){if(_0x11b963[_0x9501('0x10')]===_0x9501('0x5')&&_0x11b963[_0x9501('0x11')]){_0x2da407[_0x9501('0x9')](util[_0x9501('0x12')](_0x9501('0x13'),_0x11b963[_0x9501('0x11')],_0x11b963['keyContent']));}else if(_0x11b963[_0x9501('0x10')]===_0x9501('0x7')&&_0x11b963[_0x9501('0x8')]&&_0x11b963[_0x9501('0x11')]){_0x1a4032[_0x11b963['variableName']]&&_0x2da407[_0x9501('0x9')](util[_0x9501('0x12')]('%s:\x20%s',_0x11b963[_0x9501('0x11')],_0x1a4032[_0x11b963['variableName']]));}else if(_0x11b963['keyType']==='customVariable'&&_0x11b963[_0x9501('0xc')]&&_0x11b963[_0x9501('0xc')][_0x9501('0xd')]&&_0x11b963[_0x9501('0x11')]){_0x1a4032[_0x11b963['Variable'][_0x9501('0xd')][_0x9501('0xe')]()]&&_0x2da407[_0x9501('0x9')](util[_0x9501('0x12')](_0x9501('0x13'),_0x11b963[_0x9501('0x11')],_0x1a4032[_0x11b963[_0x9501('0xc')]['name'][_0x9501('0xe')]()]));}}}}return _0x2da407[_0x9501('0x14')](_0x3a04ef);};exports['stripTrailingSlash']=function(_0x4657ce){var _0x370cb7=_0x4657ce[_0x9501('0x15')](-0x1);if(_0x370cb7==='/'){_0x4657ce=_0x4657ce['substring'](0x0,_0x4657ce[_0x9501('0x16')](_0x370cb7));}return _0x4657ce;};exports['validateEmail']=function(_0xcecd35){if(!_[_0x9501('0x17')](_0xcecd35)&&_0xcecd35!==''){var _0x5bd52a=/^(([^<>()\[\]\\.,;:\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 _0x5bd52a[_0x9501('0x18')](String(_0xcecd35)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xd7b3=['%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','getString','sortBy','length','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format'];(function(_0x5c0b22,_0x56d46a){var _0x16a8a6=function(_0x268ef6){while(--_0x268ef6){_0x5c0b22['push'](_0x5c0b22['shift']());}};_0x16a8a6(++_0x56d46a);}(_0xd7b3,0x14c));var _0x3d7b=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0xd7b3[_0x102376];return _0x29bc9c;};'use strict';var _=require(_0x3d7b('0x0'));var util=require('util');exports[_0x3d7b('0x1')]=function(_0x5cedde,_0x300647,_0x2bb582){var _0x2008b0=[];if(_0x5cedde['length']>0x0){var _0x43d81c=_[_0x3d7b('0x2')](_0x5cedde,['id']);for(var _0x206e00=0x0;_0x206e00<_0x43d81c[_0x3d7b('0x3')];_0x206e00++){var _0x11dc66=_0x43d81c[_0x206e00];if(_0x11dc66[_0x3d7b('0x4')]===_0x3d7b('0x5')){_0x2008b0[_0x3d7b('0x6')](_0x11dc66['content']);}else if(_0x11dc66[_0x3d7b('0x4')]===_0x3d7b('0x7')&&_0x11dc66[_0x3d7b('0x8')]){_0x300647[_0x11dc66['variableName']]&&_0x2008b0[_0x3d7b('0x6')](_0x300647[_0x11dc66['variableName']][_0x3d7b('0x9')]());}else if(_0x11dc66['type']===_0x3d7b('0xa')&&_0x11dc66[_0x3d7b('0xb')]&&_0x11dc66[_0x3d7b('0xb')][_0x3d7b('0xc')]){_0x300647[_0x11dc66[_0x3d7b('0xb')][_0x3d7b('0xc')][_0x3d7b('0xd')]()]&&_0x2008b0['push'](_0x300647[_0x11dc66['Variable'][_0x3d7b('0xc')][_0x3d7b('0xd')]()][_0x3d7b('0x9')]());}else if(_0x11dc66[_0x3d7b('0x4')]===_0x3d7b('0xe')){if(_0x11dc66[_0x3d7b('0xf')]==='string'&&_0x11dc66[_0x3d7b('0x10')]){_0x2008b0[_0x3d7b('0x6')](util[_0x3d7b('0x11')]('%s:\x20%s',_0x11dc66['key'],_0x11dc66['keyContent']));}else if(_0x11dc66[_0x3d7b('0xf')]===_0x3d7b('0x7')&&_0x11dc66[_0x3d7b('0x8')]&&_0x11dc66[_0x3d7b('0x10')]){_0x300647[_0x11dc66[_0x3d7b('0x8')]]&&_0x2008b0[_0x3d7b('0x6')](util[_0x3d7b('0x11')](_0x3d7b('0x12'),_0x11dc66[_0x3d7b('0x10')],_0x300647[_0x11dc66[_0x3d7b('0x8')]]));}else if(_0x11dc66[_0x3d7b('0xf')]===_0x3d7b('0xa')&&_0x11dc66[_0x3d7b('0xb')]&&_0x11dc66[_0x3d7b('0xb')][_0x3d7b('0xc')]&&_0x11dc66[_0x3d7b('0x10')]){_0x300647[_0x11dc66[_0x3d7b('0xb')]['name'][_0x3d7b('0xd')]()]&&_0x2008b0[_0x3d7b('0x6')](util['format'](_0x3d7b('0x12'),_0x11dc66[_0x3d7b('0x10')],_0x300647[_0x11dc66[_0x3d7b('0xb')][_0x3d7b('0xc')]['toLowerCase']()]));}}}}return _0x2008b0[_0x3d7b('0x13')](_0x2bb582);};exports[_0x3d7b('0x14')]=function(_0x336bab){var _0x59447d=_0x336bab[_0x3d7b('0x15')](-0x1);if(_0x59447d==='/'){_0x336bab=_0x336bab[_0x3d7b('0x16')](0x0,_0x336bab[_0x3d7b('0x17')](_0x59447d));}return _0x336bab;};exports[_0x3d7b('0x18')]=function(_0x141bad){if(!_['isNil'](_0x141bad)&&_0x141bad!==''){var _0x595eee=/^(([^<>()\[\]\\.,;:\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 _0x595eee['test'](String(_0x141bad)[_0x3d7b('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index efbfc39..f9d57d7 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x1d11af,_0x5e7156){var _0x41b1f2=function(_0x16c2f2){while(--_0x16c2f2){_0x1d11af['push'](_0x1d11af['shift']());}};_0x41b1f2(++_0x5e7156);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x26d398,_0x22f9b0){var _0x3e65f2=function(_0x20c15f){while(--_0x20c15f){_0x26d398['push'](_0x26d398['shift']());}};_0x3e65f2(++_0x22f9b0);}(_0xe706,0xa3));var _0x6e70=function(_0x5a8315,_0x9ef47d){_0x5a8315=_0x5a8315-0x0;var _0x5cc037=_0xe706[_0x5a8315];return _0x5cc037;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index d964273..75c33fa 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 _0x51bd=['customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','picklist','nameField','customField','type','idField','custom_fields','push','content','variable','variableName'];(function(_0x327dd3,_0x1d88c1){var _0x5acba0=function(_0x4e4b3c){while(--_0x4e4b3c){_0x327dd3['push'](_0x327dd3['shift']());}};_0x5acba0(++_0x1d88c1);}(_0x51bd,0x118));var _0xd51b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x51bd[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd51b('0x0'));var rp=require(_0xd51b('0x1'));var md5=require(_0xd51b('0x2'));var util=require(_0xd51b('0x3'));var Redis=require(_0xd51b('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd51b('0x5'))(_0xd51b('0x6'));config[_0xd51b('0x7')]=_['defaults'](config[_0xd51b('0x7')],{'host':_0xd51b('0x8'),'port':0x18eb});var io=require(_0xd51b('0x9'))(new Redis(config[_0xd51b('0x7')]));function emit(_0x24cbbb,_0x1b978c,_0x2ba6ec){io['to'](_0x24cbbb)[_0xd51b('0xa')](_0x1b978c,_0x2ba6ec);}var headers={'Content-Type':_0xd51b('0xb'),'Accept':_0xd51b('0xb')};function getTicket(_0x5b2167,_0x656d8b,_0x2b0fb9,_0x1eac9c,_0x318970){logger[_0xd51b('0xc')](_0xd51b('0xd'));return request({'uri':util[_0xd51b('0xe')](_0xd51b('0xf'),_0x5b2167[_0xd51b('0x10')]),'method':_0xd51b('0x11'),'body':{'ticket':_[_0xd51b('0x12')]({'requester_id':_0x2b0fb9['id'],'submitter_id':_0x656d8b?_0x656d8b['id']:undefined,'assignee_id':_0x656d8b?_0x656d8b['id']:undefined,'tags':getTags(_0x1eac9c[_0xd51b('0x13')],_0xd51b('0x14')),'subject':intUtil[_0xd51b('0x15')](_0x1eac9c[_0xd51b('0x16')],_0x318970,'\x20'),'description':intUtil[_0xd51b('0x15')](_0x1eac9c['Descriptions'],_0x318970,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd51b('0x15')](_0x1eac9c[_0xd51b('0x17')],_0x318970,'\x0a')}},getCustomFields(_0x1eac9c[_0xd51b('0x18')],_0x318970))}})[_0xd51b('0x19')](function(_0x10d022){logger[_0xd51b('0xc')](_0xd51b('0x1a'));return _0x10d022['ticket'];});}function getUser(_0x29677f,_0x10331f){if(intUtil[_0xd51b('0x1b')](_0x10331f)){logger['info'](_0xd51b('0x1c'),_0x10331f);return request({'uri':util[_0xd51b('0xe')]('%s/search.json',_0x29677f[_0xd51b('0x10')]),'qs':{'query':util[_0xd51b('0xe')](_0xd51b('0x1d'),_0x10331f)}})[_0xd51b('0x19')](function(_0x2a970f){if(_0x2a970f[_0xd51b('0x1e')]){logger[_0xd51b('0xc')](_0xd51b('0x1f'));return _['find'](_0x2a970f[_0xd51b('0x20')],{'email':_0x10331f,'role':'agent'});}else{logger['info'](_0xd51b('0x21'));return request({'uri':util[_0xd51b('0xe')]('%s/users/me.json',_0x29677f[_0xd51b('0x10')])})[_0xd51b('0x19')](function(_0xc342a9){logger['info'](_0xd51b('0x22'));return _0xc342a9[_0xd51b('0x23')];});}});}else{logger[_0xd51b('0xc')](_0xd51b('0x21'));return request({'uri':util[_0xd51b('0xe')](_0xd51b('0x24'),_0x29677f[_0xd51b('0x10')])})['then'](function(_0x208d0f){logger[_0xd51b('0xc')](_0xd51b('0x22'));return _0x208d0f[_0xd51b('0x23')];});}}function getEndUser(_0x486297,_0x4d9687,_0x2bb13c){logger[_0xd51b('0xc')](_0xd51b('0x25'),_0x2bb13c);return request({'uri':util['format'](_0xd51b('0x26'),_0x486297['remoteUri']),'qs':{'query':util[_0xd51b('0xe')](_0xd51b('0x27'),_0x2bb13c)}})[_0xd51b('0x19')](function(_0x373f7e){var _0x389721;if(_0x373f7e[_0xd51b('0x20')][_0xd51b('0x28')]){_0x373f7e[_0xd51b('0x20')]=_['filter'](_0x373f7e[_0xd51b('0x20')],{'suspended':![],'role':_0xd51b('0x29')});if(_0x373f7e['results'][_0xd51b('0x28')]){_0x389721=_[_0xd51b('0x2a')](_0x373f7e[_0xd51b('0x20')]);}}if(_0x389721){logger[_0xd51b('0xc')](_0xd51b('0x2b'));return _0x389721;}else{logger[_0xd51b('0xc')](_0xd51b('0x2c'));return request({'uri':util[_0xd51b('0xe')](_0xd51b('0x2d'),_0x486297[_0xd51b('0x10')]),'method':_0xd51b('0x11'),'body':{'user':{'role':_0xd51b('0x29'),'name':util['format'](_0xd51b('0x2e'),_0x4d9687||_0x2bb13c),'phone':_0x2bb13c}}})[_0xd51b('0x19')](function(_0x35325f){logger[_0xd51b('0xc')](_0xd51b('0x2f'));return _0x35325f[_0xd51b('0x23')];});}});}function getAuth(_0x380054){var _0x2b0a10;if(_0x380054[_0xd51b('0x30')]==='password'){_0x2b0a10=util[_0xd51b('0xe')](_0xd51b('0x31'),_0x380054[_0xd51b('0x32')],_0x380054[_0xd51b('0x33')]);}else if(_0x380054[_0xd51b('0x30')]===_0xd51b('0x34')){_0x2b0a10=util['format'](_0xd51b('0x35'),_0x380054['username'],_0x380054['token']);}return util[_0xd51b('0xe')](_0xd51b('0x36'),new Buffer(_0x2b0a10)[_0xd51b('0x37')](_0xd51b('0x38')));}function request(_0x44afa9){logger[_0xd51b('0x39')](_0xd51b('0x3a'),JSON[_0xd51b('0x3b')](_0x44afa9));return rp(_[_0xd51b('0x3c')](_0x44afa9,{'method':_0xd51b('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x5bc1ef,_0x518bd8){var _0x3d0d1f=[];if(_0x5bc1ef&&_0x5bc1ef[_0xd51b('0x28')]>0x0){_0x3d0d1f=_['map'](_0x5bc1ef,_0x518bd8);}return _0x3d0d1f;}function getCustomFields(_0x480a03,_0x56dc54){var _0x4925d2=[];var _0x274a71={'custom_fields':[]};if(_0x480a03[_0xd51b('0x28')]>0x0){_[_0xd51b('0x3e')](_0x480a03,function(_0x2484bc){if(_[_0xd51b('0x3f')](['string',_0xd51b('0x40')],_0x2484bc['type'])&&_0x2484bc[_0xd51b('0x41')]&&!_0x2484bc[_0xd51b('0x42')]){_0x274a71[_0x2484bc[_0xd51b('0x41')]['toLowerCase']()]=_0x2484bc['content'][_0xd51b('0x37')]();}else if(_[_0xd51b('0x3f')](['string',_0xd51b('0x40')],_0x2484bc[_0xd51b('0x43')])&&_0x2484bc[_0xd51b('0x44')]&&_0x2484bc[_0xd51b('0x42')]){_0x274a71[_0xd51b('0x45')][_0xd51b('0x46')]({'id':_0x2484bc[_0xd51b('0x44')],'value':_0x2484bc[_0xd51b('0x47')]['toString']()});}else if(_0x2484bc[_0xd51b('0x43')]===_0xd51b('0x48')&&_0x2484bc['variableName']&&_0x2484bc[_0xd51b('0x44')]&&_0x2484bc['customField']){_0x56dc54[_0x2484bc['variableName']]&&_0x274a71[_0xd51b('0x45')][_0xd51b('0x46')]({'id':_0x2484bc[_0xd51b('0x44')],'value':_0x56dc54[_0x2484bc[_0xd51b('0x49')]][_0xd51b('0x37')]()});}else if(_0x2484bc[_0xd51b('0x43')]===_0xd51b('0x4a')&&_0x2484bc[_0xd51b('0x4b')]&&_0x2484bc[_0xd51b('0x4b')][_0xd51b('0x14')]&&_0x2484bc[_0xd51b('0x44')]&&_0x2484bc['customField']){_0x56dc54[_0x2484bc['Variable'][_0xd51b('0x14')]['toLowerCase']()]&&_0x274a71[_0xd51b('0x45')][_0xd51b('0x46')]({'id':_0x2484bc[_0xd51b('0x44')],'value':_0x56dc54[_0x2484bc['Variable'][_0xd51b('0x14')][_0xd51b('0x4c')]()][_0xd51b('0x37')]()});}});}return _0x274a71;}exports[_0xd51b('0x4d')]=function(_0x5e9889,_0x23ad5f,_0x30fa5b,_0x4b3912,_0x28d274,_0x36075f){var _0x4588a4,_0x15cb67;_0x36075f[_0xd51b('0x10')]=intUtil[_0xd51b('0x4e')](_0x36075f[_0xd51b('0x10')]);_0x36075f['serverUrl']=intUtil['stripTrailingSlash'](_0x36075f['serverUrl']);if(_0x28d274&&_0x28d274[_0xd51b('0x4f')]){logger[_0xd51b('0xc')](_0xd51b('0x50'),'Recording\x20is\x20enabled!');_0x23ad5f['recordingURL']=util[_0xd51b('0xe')](_0xd51b('0x51'),_0x36075f[_0xd51b('0x52')],_0x23ad5f[_0xd51b('0x53')],md5(_0x23ad5f[_0xd51b('0x53')]));}else{_0x23ad5f[_0xd51b('0x54')]='';}headers[_0xd51b('0x55')]=getAuth(_0x36075f);return getUser(_0x36075f,_0x4b3912['email'])[_0xd51b('0x19')](function(_0x3bad91){_0x4588a4=_0x3bad91;logger[_0xd51b('0xc')](_0xd51b('0x56'),_0x4588a4['id']);return getEndUser(_0x36075f,_0x23ad5f[_0xd51b('0x57')],_0x23ad5f[_0xd51b('0x58')]);})[_0xd51b('0x19')](function(_0x2d0448){_0x15cb67=_0x2d0448;logger[_0xd51b('0xc')](_0xd51b('0x59'),_0x15cb67['id']);return getTicket(_0x36075f,_0x4588a4,_0x15cb67,_0x30fa5b,_0x23ad5f);})[_0xd51b('0x19')](function(_0x24d179){if(_0x24d179){logger[_0xd51b('0xc')]('The\x20Ticket\x20ID\x20is:',_0x24d179['id']);switch(_0x36075f['type']){case _0xd51b('0x5a'):logger[_0xd51b('0xc')](_0xd51b('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd51b('0xe')](_0xd51b('0x5b'),_0x36075f[_0xd51b('0x10')],_0x4588a4['id'],_0x24d179['id']),'method':_0xd51b('0x11')});case _0xd51b('0x5c'):logger['info'](_0xd51b('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd51b('0xe')](_0xd51b('0x5d'),_0x4b3912['name']),_0xd51b('0x5e'),{'uri':util[_0xd51b('0xe')]('%s/agent/tickets/%s',_0x36075f[_0xd51b('0x10')][_0xd51b('0x5f')]('/api/v2',''),_0x24d179['id'])});break;default:logger['error'](_0xd51b('0x50'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd51b('0x60')](function(_0x489e7d){logger[_0xd51b('0x61')](_0xd51b('0x62'),util[_0xd51b('0x63')](_0x489e7d,{'showHidden':!![],'depth':null}));});};exports[_0xd51b('0x64')]=function(_0x1ab749,_0x448e73,_0x3b38db,_0x1866ca,_0x3e8244,_0xe0358f,_0x52f27f){var _0x306da9,_0x222f8c;_0xe0358f[_0xd51b('0x10')]=intUtil[_0xd51b('0x4e')](_0xe0358f[_0xd51b('0x10')]);_0xe0358f[_0xd51b('0x52')]=intUtil[_0xd51b('0x4e')](_0xe0358f[_0xd51b('0x52')]);if(_0x52f27f&&_0x52f27f[_0xd51b('0x65')]&&_0x52f27f[_0xd51b('0x65')]!==_0xd51b('0x66')){logger[_0xd51b('0xc')]('[OUTBOUND]',_0xd51b('0x67'));_0x448e73['recordingURL']=util[_0xd51b('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe0358f['serverUrl'],_0x448e73['uniqueid'],md5(_0x448e73[_0xd51b('0x53')]));}headers[_0xd51b('0x55')]=getAuth(_0xe0358f);return getUser(_0xe0358f,_0x1866ca[_0xd51b('0x68')])['then'](function(_0x26e6b2){_0x306da9=_0x26e6b2;logger[_0xd51b('0xc')](_0xd51b('0x56'),_0x306da9['id']);return getEndUser(_0xe0358f,_0x448e73[_0xd51b('0x69')],_0x448e73[_0xd51b('0x6a')]);})[_0xd51b('0x19')](function(_0x500a7e){_0x222f8c=_0x500a7e;logger['info'](_0xd51b('0x59'),_0x222f8c['id']);return getTicket(_0xe0358f,_0x306da9,_0x222f8c,_0x3b38db,_0x448e73);})[_0xd51b('0x19')](function(_0x74019){if(_0x74019){logger['info'](_0xd51b('0x6b'),_0x74019['id']);switch(_0xe0358f['type']){case _0xd51b('0x5a'):logger['info'](_0xd51b('0x6c'),_0xd51b('0x6d'));return request({'uri':util[_0xd51b('0xe')](_0xd51b('0x5b'),_0xe0358f['remoteUri'],_0x306da9['id'],_0x74019['id']),'method':_0xd51b('0x11')});case'newTab':logger[_0xd51b('0xc')](_0xd51b('0x6c'),_0xd51b('0x6e'));emit(util['format'](_0xd51b('0x5d'),_0x1866ca[_0xd51b('0x14')]),_0xd51b('0x5e'),{'uri':util['format'](_0xd51b('0x6f'),_0xe0358f['remoteUri'][_0xd51b('0x5f')](_0xd51b('0x70'),''),_0x74019['id'])});break;default:logger[_0xd51b('0x61')](_0xd51b('0x6c'),_0xd51b('0x71'));}}})[_0xd51b('0x60')](function(_0x410d91){logger[_0xd51b('0x61')](_0xd51b('0x72'),util[_0xd51b('0x63')](_0x410d91,{'showHidden':!![],'depth':null}));});};exports[_0xd51b('0x73')]=function(_0x5d8bd1,_0x31d80c,_0x4649a0,_0x2e7e57,_0x47ae2c,_0x39ee04){var _0x4e1292,_0x289b6d;_0x39ee04[_0xd51b('0x10')]=intUtil[_0xd51b('0x4e')](_0x39ee04['remoteUri']);_0x39ee04['serverUrl']=intUtil[_0xd51b('0x4e')](_0x39ee04[_0xd51b('0x52')]);if(_0x47ae2c&&_0x47ae2c['monitor_format']){logger['info']('['+_0x31d80c[_0xd51b('0x74')][_0xd51b('0x75')]()+']',_0xd51b('0x67'));_0x31d80c[_0xd51b('0x54')]=util[_0xd51b('0xe')](_0xd51b('0x51'),_0x39ee04[_0xd51b('0x52')],_0x31d80c[_0xd51b('0x53')],md5(_0x31d80c[_0xd51b('0x53')]));}else{_0x31d80c[_0xd51b('0x54')]='';}headers[_0xd51b('0x55')]=getAuth(_0x39ee04);return getUser(_0x39ee04)[_0xd51b('0x19')](function(_0x5068c5){_0x4e1292=_0x5068c5;logger['info'](_0xd51b('0x56'),_0x4e1292['id']);return getEndUser(_0x39ee04,_0x31d80c[_0xd51b('0x57')],_0x31d80c['calleridnum']);})[_0xd51b('0x19')](function(_0x499e5f){_0x289b6d=_0x499e5f;logger['info'](_0xd51b('0x59'),_0x289b6d['id']);return getTicket(_0x39ee04,_0x4e1292,_0x289b6d,_0x4649a0,_0x31d80c);})['then'](function(_0x5e1c63){if(_0x5e1c63){logger['info'](_0xd51b('0x6b'),_0x5e1c63['id']);}})[_0xd51b('0x60')](function(_0x4a383e){logger[_0xd51b('0x61')]('['+_0x31d80c[_0xd51b('0x74')][_0xd51b('0x75')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4a383e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xed03=['username','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','custom_fields','push','idField','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','%s/agent/tickets/%s','catch','unmanaged','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','redis','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s'];(function(_0xc32a99,_0x4cfecd){var _0x314ee5=function(_0x2fb61c){while(--_0x2fb61c){_0xc32a99['push'](_0xc32a99['shift']());}};_0x314ee5(++_0x4cfecd);}(_0xed03,0x181));var _0x3ed0=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xed03[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x3ed0('0x0'));var rp=require(_0x3ed0('0x1'));var md5=require(_0x3ed0('0x2'));var util=require('util');var Redis=require(_0x3ed0('0x3'));var intUtil=require(_0x3ed0('0x4'));var config=require(_0x3ed0('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_['defaults'](config[_0x3ed0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x3ed0('0x7'))(new Redis(config[_0x3ed0('0x6')]));function emit(_0x266a6c,_0x4fbdca,_0x3c2bb6){io['to'](_0x266a6c)[_0x3ed0('0x8')](_0x4fbdca,_0x3c2bb6);}var headers={'Content-Type':_0x3ed0('0x9'),'Accept':_0x3ed0('0x9')};function getTicket(_0x52e95c,_0x373fd1,_0x156c37,_0x43a462,_0x44798d){logger[_0x3ed0('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x3ed0('0xb')](_0x3ed0('0xc'),_0x52e95c['remoteUri']),'method':_0x3ed0('0xd'),'body':{'ticket':_[_0x3ed0('0xe')]({'requester_id':_0x156c37['id'],'submitter_id':_0x373fd1?_0x373fd1['id']:undefined,'assignee_id':_0x373fd1?_0x373fd1['id']:undefined,'tags':getTags(_0x43a462[_0x3ed0('0xf')],_0x3ed0('0x10')),'subject':intUtil[_0x3ed0('0x11')](_0x43a462[_0x3ed0('0x12')],_0x44798d,'\x20'),'description':intUtil[_0x3ed0('0x11')](_0x43a462['Descriptions'],_0x44798d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3ed0('0x11')](_0x43a462[_0x3ed0('0x13')],_0x44798d,'\x0a')}},getCustomFields(_0x43a462[_0x3ed0('0x14')],_0x44798d))}})[_0x3ed0('0x15')](function(_0x17c238){logger[_0x3ed0('0xa')](_0x3ed0('0x16'));return _0x17c238['ticket'];});}function getUser(_0x156a14,_0x349284){if(intUtil[_0x3ed0('0x17')](_0x349284)){logger['info'](_0x3ed0('0x18'),_0x349284);return request({'uri':util[_0x3ed0('0xb')]('%s/search.json',_0x156a14['remoteUri']),'qs':{'query':util['format'](_0x3ed0('0x19'),_0x349284)}})[_0x3ed0('0x15')](function(_0x318630){if(_0x318630[_0x3ed0('0x1a')]){logger['info']('Agent\x20found!');return _[_0x3ed0('0x1b')](_0x318630[_0x3ed0('0x1c')],{'email':_0x349284,'role':_0x3ed0('0x1d')});}else{logger[_0x3ed0('0xa')](_0x3ed0('0x1e'));return request({'uri':util['format'](_0x3ed0('0x1f'),_0x156a14[_0x3ed0('0x20')])})[_0x3ed0('0x15')](function(_0x8eb6ee){logger[_0x3ed0('0xa')]('Admin\x20account\x20selected.');return _0x8eb6ee['user'];});}});}else{logger['info'](_0x3ed0('0x1e'));return request({'uri':util[_0x3ed0('0xb')](_0x3ed0('0x1f'),_0x156a14[_0x3ed0('0x20')])})[_0x3ed0('0x15')](function(_0x475079){logger[_0x3ed0('0xa')](_0x3ed0('0x21'));return _0x475079[_0x3ed0('0x22')];});}}function getEndUser(_0x3cc0d9,_0x3c6b4f,_0xe6821){logger[_0x3ed0('0xa')](_0x3ed0('0x23'),_0xe6821);return request({'uri':util[_0x3ed0('0xb')]('%s/search.json',_0x3cc0d9['remoteUri']),'qs':{'query':util[_0x3ed0('0xb')]('type:user\x20role:end-user\x20phone:%s',_0xe6821)}})[_0x3ed0('0x15')](function(_0x2d6d1e){var _0x167bd8;if(_0x2d6d1e[_0x3ed0('0x1c')][_0x3ed0('0x24')]){_0x2d6d1e['results']=_[_0x3ed0('0x25')](_0x2d6d1e[_0x3ed0('0x1c')],{'suspended':![],'role':_0x3ed0('0x26')});if(_0x2d6d1e['results']['length']){_0x167bd8=_[_0x3ed0('0x27')](_0x2d6d1e[_0x3ed0('0x1c')]);}}if(_0x167bd8){logger[_0x3ed0('0xa')](_0x3ed0('0x28'));return _0x167bd8;}else{logger[_0x3ed0('0xa')](_0x3ed0('0x29'));return request({'uri':util[_0x3ed0('0xb')]('%s/users.json',_0x3cc0d9[_0x3ed0('0x20')]),'method':_0x3ed0('0xd'),'body':{'user':{'role':'end-user','name':util['format'](_0x3ed0('0x2a'),_0x3c6b4f||_0xe6821),'phone':_0xe6821}}})[_0x3ed0('0x15')](function(_0x5e6487){logger[_0x3ed0('0xa')](_0x3ed0('0x2b'));return _0x5e6487[_0x3ed0('0x22')];});}});}function getAuth(_0x49f042){var _0x21ceaa;if(_0x49f042[_0x3ed0('0x2c')]===_0x3ed0('0x2d')){_0x21ceaa=util[_0x3ed0('0xb')](_0x3ed0('0x2e'),_0x49f042[_0x3ed0('0x2f')],_0x49f042['password']);}else if(_0x49f042[_0x3ed0('0x2c')]===_0x3ed0('0x30')){_0x21ceaa=util[_0x3ed0('0xb')]('%s/token:%s',_0x49f042['username'],_0x49f042[_0x3ed0('0x30')]);}return util[_0x3ed0('0xb')](_0x3ed0('0x31'),new Buffer(_0x21ceaa)[_0x3ed0('0x32')](_0x3ed0('0x33')));}function request(_0x38b7ef){logger['debug'](_0x3ed0('0x34'),JSON[_0x3ed0('0x35')](_0x38b7ef));return rp(_['defaults'](_0x38b7ef,{'method':_0x3ed0('0x36'),'headers':headers,'json':!![]}));}function getTags(_0xd247ab,_0x32c4c6){var _0x2fc83f=[];if(_0xd247ab&&_0xd247ab[_0x3ed0('0x24')]>0x0){_0x2fc83f=_[_0x3ed0('0x37')](_0xd247ab,_0x32c4c6);}return _0x2fc83f;}function getCustomFields(_0x1a45e1,_0x253b73){var _0x5c7fb8=[];var _0x153697={'custom_fields':[]};if(_0x1a45e1[_0x3ed0('0x24')]>0x0){_[_0x3ed0('0x38')](_0x1a45e1,function(_0x46517b){if(_[_0x3ed0('0x39')]([_0x3ed0('0x3a'),_0x3ed0('0x3b')],_0x46517b[_0x3ed0('0x3c')])&&_0x46517b[_0x3ed0('0x3d')]&&!_0x46517b[_0x3ed0('0x3e')]){_0x153697[_0x46517b[_0x3ed0('0x3d')]['toLowerCase']()]=_0x46517b[_0x3ed0('0x3f')][_0x3ed0('0x32')]();}else if(_[_0x3ed0('0x39')]([_0x3ed0('0x3a'),_0x3ed0('0x3b')],_0x46517b['type'])&&_0x46517b['idField']&&_0x46517b[_0x3ed0('0x3e')]){_0x153697[_0x3ed0('0x40')][_0x3ed0('0x41')]({'id':_0x46517b[_0x3ed0('0x42')],'value':_0x46517b[_0x3ed0('0x3f')][_0x3ed0('0x32')]()});}else if(_0x46517b[_0x3ed0('0x3c')]===_0x3ed0('0x43')&&_0x46517b[_0x3ed0('0x44')]&&_0x46517b[_0x3ed0('0x42')]&&_0x46517b[_0x3ed0('0x3e')]){_0x253b73[_0x46517b[_0x3ed0('0x44')]]&&_0x153697[_0x3ed0('0x40')]['push']({'id':_0x46517b[_0x3ed0('0x42')],'value':_0x253b73[_0x46517b[_0x3ed0('0x44')]][_0x3ed0('0x32')]()});}else if(_0x46517b[_0x3ed0('0x3c')]==='customVariable'&&_0x46517b[_0x3ed0('0x45')]&&_0x46517b[_0x3ed0('0x45')][_0x3ed0('0x10')]&&_0x46517b[_0x3ed0('0x42')]&&_0x46517b[_0x3ed0('0x3e')]){_0x253b73[_0x46517b['Variable']['name'][_0x3ed0('0x46')]()]&&_0x153697[_0x3ed0('0x40')]['push']({'id':_0x46517b[_0x3ed0('0x42')],'value':_0x253b73[_0x46517b[_0x3ed0('0x45')][_0x3ed0('0x10')][_0x3ed0('0x46')]()][_0x3ed0('0x32')]()});}});}return _0x153697;}exports[_0x3ed0('0x47')]=function(_0x38350b,_0x3d2f7a,_0x21a330,_0x5cc38f,_0x3e9fcd,_0x2563f4){var _0x7d3583,_0x2f87ce;_0x2563f4[_0x3ed0('0x20')]=intUtil[_0x3ed0('0x48')](_0x2563f4['remoteUri']);_0x2563f4[_0x3ed0('0x49')]=intUtil[_0x3ed0('0x48')](_0x2563f4[_0x3ed0('0x49')]);if(_0x3e9fcd&&_0x3e9fcd[_0x3ed0('0x4a')]){logger[_0x3ed0('0xa')](_0x3ed0('0x4b'),_0x3ed0('0x4c'));_0x3d2f7a[_0x3ed0('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2563f4[_0x3ed0('0x49')],_0x3d2f7a[_0x3ed0('0x4e')],md5(_0x3d2f7a[_0x3ed0('0x4e')]));}else{_0x3d2f7a[_0x3ed0('0x4d')]='';}headers[_0x3ed0('0x4f')]=getAuth(_0x2563f4);return getUser(_0x2563f4,_0x5cc38f['email'])['then'](function(_0x537e4b){_0x7d3583=_0x537e4b;logger['info']('The\x20User\x20ID\x20is:',_0x7d3583['id']);return getEndUser(_0x2563f4,_0x3d2f7a['calleridname'],_0x3d2f7a[_0x3ed0('0x50')]);})[_0x3ed0('0x15')](function(_0x1358a8){_0x2f87ce=_0x1358a8;logger[_0x3ed0('0xa')](_0x3ed0('0x51'),_0x2f87ce['id']);return getTicket(_0x2563f4,_0x7d3583,_0x2f87ce,_0x21a330,_0x3d2f7a);})[_0x3ed0('0x15')](function(_0x57a150){if(_0x57a150){logger[_0x3ed0('0xa')]('The\x20Ticket\x20ID\x20is:',_0x57a150['id']);switch(_0x2563f4[_0x3ed0('0x3c')]){case _0x3ed0('0x52'):logger[_0x3ed0('0xa')](_0x3ed0('0x4b'),_0x3ed0('0x53'));return request({'uri':util['format'](_0x3ed0('0x54'),_0x2563f4[_0x3ed0('0x20')],_0x7d3583['id'],_0x57a150['id']),'method':'POST'});case'newTab':logger[_0x3ed0('0xa')](_0x3ed0('0x4b'),_0x3ed0('0x55'));emit(util[_0x3ed0('0xb')]('user:%s',_0x5cc38f[_0x3ed0('0x10')]),_0x3ed0('0x56'),{'uri':util[_0x3ed0('0xb')]('%s/agent/tickets/%s',_0x2563f4[_0x3ed0('0x20')]['replace']('/api/v2',''),_0x57a150['id'])});break;default:logger[_0x3ed0('0x57')](_0x3ed0('0x4b'),_0x3ed0('0x58'));}}})['catch'](function(_0x4a5944){logger[_0x3ed0('0x57')](_0x3ed0('0x59'),util[_0x3ed0('0x5a')](_0x4a5944,{'showHidden':!![],'depth':null}));});};exports[_0x3ed0('0x5b')]=function(_0x11f8d9,_0x410c0f,_0x118824,_0xefdc50,_0x4bbac9,_0x3b3a1b,_0x50ad7d){var _0x54d37f,_0x15e91d;_0x3b3a1b[_0x3ed0('0x20')]=intUtil[_0x3ed0('0x48')](_0x3b3a1b[_0x3ed0('0x20')]);_0x3b3a1b[_0x3ed0('0x49')]=intUtil['stripTrailingSlash'](_0x3b3a1b[_0x3ed0('0x49')]);if(_0x50ad7d&&_0x50ad7d[_0x3ed0('0x5c')]&&_0x50ad7d['recordingFormat']!==_0x3ed0('0x5d')){logger[_0x3ed0('0xa')](_0x3ed0('0x5e'),'Recording\x20is\x20enabled!');_0x410c0f['recordingURL']=util['format'](_0x3ed0('0x5f'),_0x3b3a1b[_0x3ed0('0x49')],_0x410c0f[_0x3ed0('0x4e')],md5(_0x410c0f[_0x3ed0('0x4e')]));}headers[_0x3ed0('0x4f')]=getAuth(_0x3b3a1b);return getUser(_0x3b3a1b,_0xefdc50[_0x3ed0('0x60')])['then'](function(_0x4a7ee){_0x54d37f=_0x4a7ee;logger['info'](_0x3ed0('0x61'),_0x54d37f['id']);return getEndUser(_0x3b3a1b,_0x410c0f[_0x3ed0('0x62')],_0x410c0f[_0x3ed0('0x63')]);})['then'](function(_0x24441e){_0x15e91d=_0x24441e;logger[_0x3ed0('0xa')](_0x3ed0('0x51'),_0x15e91d['id']);return getTicket(_0x3b3a1b,_0x54d37f,_0x15e91d,_0x118824,_0x410c0f);})['then'](function(_0x353422){if(_0x353422){logger[_0x3ed0('0xa')]('The\x20Ticket\x20ID\x20is:',_0x353422['id']);switch(_0x3b3a1b[_0x3ed0('0x3c')]){case'integrationTab':logger[_0x3ed0('0xa')]('[OUTBOUND]',_0x3ed0('0x53'));return request({'uri':util[_0x3ed0('0xb')](_0x3ed0('0x54'),_0x3b3a1b[_0x3ed0('0x20')],_0x54d37f['id'],_0x353422['id']),'method':_0x3ed0('0xd')});case'newTab':logger['info']('[OUTBOUND]',_0x3ed0('0x55'));emit(util[_0x3ed0('0xb')](_0x3ed0('0x64'),_0xefdc50['name']),'trigger:browser:url',{'uri':util['format'](_0x3ed0('0x65'),_0x3b3a1b['remoteUri']['replace']('/api/v2',''),_0x353422['id'])});break;default:logger[_0x3ed0('0x57')](_0x3ed0('0x5e'),_0x3ed0('0x58'));}}})[_0x3ed0('0x66')](function(_0x3fa40c){logger[_0x3ed0('0x57')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3fa40c,{'showHidden':!![],'depth':null}));});};exports[_0x3ed0('0x67')]=function(_0x4a58cb,_0x160235,_0x12ce5a,_0x15fa77,_0x1ea2d7,_0x18de83){var _0x554c43,_0x238ac1;_0x18de83['remoteUri']=intUtil['stripTrailingSlash'](_0x18de83[_0x3ed0('0x20')]);_0x18de83['serverUrl']=intUtil[_0x3ed0('0x48')](_0x18de83[_0x3ed0('0x49')]);if(_0x1ea2d7&&_0x1ea2d7[_0x3ed0('0x4a')]){logger[_0x3ed0('0xa')]('['+_0x160235['lastevent'][_0x3ed0('0x68')]()+']','Recording\x20is\x20enabled!');_0x160235[_0x3ed0('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18de83[_0x3ed0('0x49')],_0x160235[_0x3ed0('0x4e')],md5(_0x160235[_0x3ed0('0x4e')]));}else{_0x160235[_0x3ed0('0x4d')]='';}headers[_0x3ed0('0x4f')]=getAuth(_0x18de83);return getUser(_0x18de83)[_0x3ed0('0x15')](function(_0x148fa6){_0x554c43=_0x148fa6;logger[_0x3ed0('0xa')]('The\x20User\x20ID\x20is:',_0x554c43['id']);return getEndUser(_0x18de83,_0x160235[_0x3ed0('0x69')],_0x160235['calleridnum']);})['then'](function(_0x15a40c){_0x238ac1=_0x15a40c;logger['info'](_0x3ed0('0x51'),_0x238ac1['id']);return getTicket(_0x18de83,_0x554c43,_0x238ac1,_0x12ce5a,_0x160235);})[_0x3ed0('0x15')](function(_0x128b6c){if(_0x128b6c){logger['info']('The\x20Ticket\x20ID\x20is:',_0x128b6c['id']);}})[_0x3ed0('0x66')](function(_0x55f12f){logger['error']('['+_0x160235[_0x3ed0('0x6a')][_0x3ed0('0x68')]()+']'+_0x3ed0('0x6b'),util['inspect'](_0x55f12f,{'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 07de5d8..34864da 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 _0xdea1=['Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/api/voice/recordings/','com','toUpperCase','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','type','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','complete','Call_Result','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xdea1,0x1f4));var _0x1dea=function(_0x3e3b29,_0x30aacd){_0x3e3b29=_0x3e3b29-0x0;var _0x3092dc=_0xdea1[_0x3e3b29];return _0x3092dc;};'use strict';var _=require(_0x1dea('0x0'));var rp=require(_0x1dea('0x1'));var md5=require(_0x1dea('0x2'));var util=require(_0x1dea('0x3'));var intUtil=require('./util');var moment=require(_0x1dea('0x4'));var Redis=require(_0x1dea('0x5'));var BPromise=require(_0x1dea('0x6'));var config=require(_0x1dea('0x7'));var logger=require(_0x1dea('0x8'))('zoho');config[_0x1dea('0x9')]=_[_0x1dea('0xa')](config[_0x1dea('0x9')],{'host':_0x1dea('0xb'),'port':0x18eb});var io=require(_0x1dea('0xc'))(new Redis(config[_0x1dea('0x9')]));function emit(_0x2bd6ea,_0x41e03a,_0x3132d1){io['to'](_0x2bd6ea)[_0x1dea('0xd')](_0x41e03a,_0x3132d1);}function request(_0x3c4cc6){logger[_0x1dea('0xe')](_0x1dea('0xf'),JSON['stringify'](_0x3c4cc6));return rp(_0x3c4cc6);}function getCustomFields(_0x3d49f0,_0x22a726){var _0xd3e66e={};if(_0x3d49f0[_0x1dea('0x10')]>0x0){_['forEach'](_0x3d49f0,function(_0x22b478){if(_[_0x1dea('0x11')]([_0x1dea('0x12'),'picklist'],_0x22b478[_0x1dea('0x13')])&&_0x22b478[_0x1dea('0x14')]){_0xd3e66e[_0x22b478[_0x1dea('0x14')]]=_0x22b478[_0x1dea('0x15')]['toString']();}else if(_0x22b478[_0x1dea('0x13')]==='variable'&&_0x22b478[_0x1dea('0x16')]&&_0x22b478[_0x1dea('0x14')]&&_0x22a726[_0x22b478[_0x1dea('0x16')]]){_0xd3e66e[_0x22b478[_0x1dea('0x14')]]=_0x22a726[_0x22b478[_0x1dea('0x16')]][_0x1dea('0x17')]();}else if(_0x22b478[_0x1dea('0x13')]===_0x1dea('0x18')&&_0x22b478[_0x1dea('0x19')]&&_0x22b478['Variable'][_0x1dea('0x1a')]&&_0x22b478[_0x1dea('0x14')]&&_0x22a726[_0x22b478[_0x1dea('0x19')][_0x1dea('0x1a')][_0x1dea('0x1b')]()]){_0xd3e66e[_0x22b478[_0x1dea('0x14')]]=_0x22a726[_0x22b478[_0x1dea('0x19')][_0x1dea('0x1a')][_0x1dea('0x1b')]()][_0x1dea('0x17')]();}});}return _0xd3e66e;}function getName(_0x5a70ff){if(_0x5a70ff[_0x1dea('0x1c')]('\x20')>0x0){var _0x3c5280=_0x5a70ff[_0x1dea('0x1d')](/ (.+)/);if(_0x3c5280[0x1]){return _0x3c5280;}}return[_0x5a70ff,_0x5a70ff];}var accountsTokens={};function getAccessToken(_0x1e3198){return new Promise(function(_0x46d606,_0x229120){if(!_[_0x1dea('0x1e')](accountsTokens[_0x1e3198['id']])&&!_['isNil'](accountsTokens[_0x1e3198['id']]['access_token'])){if(moment()[_0x1dea('0x1f')](accountsTokens[_0x1e3198['id']][_0x1dea('0x20')])){_0x46d606(accountsTokens[_0x1e3198['id']]['access_token']);}}var _0x1c3d92;switch(_0x1e3198['zone']){case'US':_0x1c3d92='https://accounts.zoho.com';break;case'AU':_0x1c3d92=_0x1dea('0x21');break;case'EU':_0x1c3d92='https://accounts.zoho.eu';break;case'IN':_0x1c3d92='https://accounts.zoho.in';break;case'CN':_0x1c3d92=_0x1dea('0x22');break;default:_0x1c3d92='https://accounts.zoho.eu';break;}var _0x5c26b3={'method':_0x1dea('0x23'),'uri':_0x1c3d92+_0x1dea('0x24'),'qs':{'refresh_token':_0x1e3198[_0x1dea('0x25')],'client_id':_0x1e3198[_0x1dea('0x26')],'client_secret':_0x1e3198[_0x1dea('0x27')],'grant_type':_0x1dea('0x28')},'json':!![]};return rp(_0x5c26b3)[_0x1dea('0x29')](function(_0x5d2e94){accountsTokens[_0x1e3198['id']]={'access_token':_0x5d2e94[_0x1dea('0x2a')],'expires_in':moment()['add'](_0x5d2e94[_0x1dea('0x20')],_0x1dea('0x2b'))};_0x46d606(_0x5d2e94[_0x1dea('0x2a')]);})[_0x1dea('0x2c')](function(_0x1a157a){logger[_0x1dea('0x2d')](_0x1dea('0x2e'),_0x1a157a[_0x1dea('0x2f')]);_0x229120(_0x1a157a);});});}function getUser(_0x38b921,_0x42c2a3,_0x4f093d,_0x13db01){logger['info'](_0x1dea('0x30'));return request({'method':_0x1dea('0x31'),'uri':util[_0x1dea('0x32')](_0x1dea('0x33'),_0x42c2a3),'qs':{'type':_0x1dea('0x34')},'headers':{'Authorization':_0x1dea('0x35')+_0x38b921},'json':!![]})[_0x1dea('0x29')](function(_0x31151c){if(_0x31151c[_0x1dea('0x36')]){var _0x5074bf=-0x1;if(_[_0x1dea('0x37')](_0x31151c[_0x1dea('0x36')])){if(!_[_0x1dea('0x1e')](_0x13db01)){_0x5074bf=_[_0x1dea('0x38')](_0x31151c['users'],function(_0x48602d){return _0x48602d[_0x1dea('0x39')]===_0x13db01;});}if(_0x5074bf>=0x0){logger[_0x1dea('0x3a')](_0x1dea('0x3b'));}else{logger['info'](_0x1dea('0x3c'));_0x5074bf=_[_0x1dea('0x38')](_0x31151c[_0x1dea('0x36')],function(_0x1594c0){return _0x1594c0[_0x1dea('0x3d')][_0x1dea('0x1a')]==='Administrator';});}return _0x31151c[_0x1dea('0x36')][_0x5074bf];}else{if(_0x31151c[_0x1dea('0x3e')][_0x1dea('0x3d')][_0x1dea('0x1a')]===_0x1dea('0x3f')){logger[_0x1dea('0x3a')]('Using\x20the\x20admin\x20account!');user=_0x31151c[_0x1dea('0x3e')];return user;}else{logger[_0x1dea('0x2d')](_0x1dea('0x40'),JSON['stringify'](_0x31151c));throw new Error(_0x1dea('0x41')+JSON[_0x1dea('0x42')](_0x31151c));}}}else{logger[_0x1dea('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x1dea('0x42')](_0x31151c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1dea('0x42')](_0x31151c));}})[_0x1dea('0x2c')](function(_0x3e2a7b){console[_0x1dea('0x2d')](_0x3e2a7b);});}function getZohoUser(_0x5d89bd,_0x2ba42e){return new BPromise(function(_0x452db5,_0x553b31){request(_0x5d89bd)['then'](function(_0x3bcac6){var _0x5295e4=null;if(_0x3bcac6){_0x5295e4=_0x3bcac6[_0x1dea('0x43')][0x0];_0x5295e4[_0x1dea('0x44')]=_0x2ba42e;}_0x452db5(_0x5295e4);})[_0x1dea('0x2c')](function(_0x370b99){_0x553b31(_0x370b99);});});}function createEndUser(_0x526b54,_0x160dae,_0xbbefac,_0xda57f4,_0x8833ae,_0x1ec7a2){var _0xbbefac=getName(_0xbbefac);return request({'method':_0x1dea('0x23'),'uri':_0x1dea('0x45')+_0x160dae+'/crm/v2/'+_[_0x1dea('0x46')](_0x1ec7a2[_0x1dea('0x47')])+'s','body':{'data':[{'Last_Name':_0xbbefac[0x1],'First_Name':_0xbbefac[0x0],'Phone':_0xda57f4,'Owner':{'name':!_[_0x1dea('0x1e')](_0x8833ae[_0x1dea('0x48')][_0x1dea('0x1a')])?_0x8833ae[_0x1dea('0x48')][_0x1dea('0x1a')]:!_[_0x1dea('0x1e')](_0x8833ae[_0x1dea('0x49')])?_0x8833ae['first_name']+'\x20'+_0x8833ae['last_name']:_0x8833ae[_0x1dea('0x4a')],'id':_0x8833ae['id']}}]},'headers':{'Authorization':_0x1dea('0x35')+_0x526b54},'json':!![]})['then'](function(_0x270c79){if(_0x270c79&&_0x270c79[_0x1dea('0x43')][0x0]['code']===_0x1dea('0x4b')){var _0x7bf9ca=_0x270c79['data'][0x0][_0x1dea('0x4c')];_0x7bf9ca[_0x1dea('0x44')]=_[_0x1dea('0x46')](_0x1ec7a2[_0x1dea('0x47')])+'s';return _0x7bf9ca;}logger['error'](_0x1dea('0x40'),JSON['stringify'](data));throw new Error(_0x1dea('0x4d')+JSON[_0x1dea('0x42')](data));})[_0x1dea('0x2c')](function(_0x3c4fd8){console[_0x1dea('0x4e')](_0x1dea('0x4f'),_0x3c4fd8);});}function getEndUser(_0x22adc5,_0x4d25da,_0x32f371,_0x3e283e,_0x26d418,_0x40ed81,_0xf04638){var _0x361f4c={'method':_0x1dea('0x31'),'uri':'','headers':{'Authorization':_0x1dea('0x35')+_0x22adc5},'json':!![]};switch(_0xf04638['moduleSearch']){case _0x1dea('0x50'):_0x361f4c[_0x1dea('0x51')]=_0x1dea('0x45')+_0x4d25da+_0x1dea('0x52')+_0x26d418+'))';return getZohoUser(_0x361f4c,_0x1dea('0x53'))['then'](function(_0x1e70fb){if(_0x1e70fb)return _0x1e70fb;_0x361f4c['uri']=_0x1dea('0x45')+_0x4d25da+_0x1dea('0x54')+_0x26d418+'))';return getZohoUser(_0x361f4c,_0x1dea('0x55'))[_0x1dea('0x29')](function(_0x2bcca4){if(_0x2bcca4)return _0x2bcca4;if(_0xf04638[_0x1dea('0x47')]!=_0x1dea('0x56')){return createEndUser(_0x22adc5,_0x4d25da,_0x3e283e,_0x26d418,_0x40ed81,_0xf04638);}else{return{};}});});break;case _0x1dea('0x57'):_0x361f4c['uri']=_0x1dea('0x45')+_0x4d25da+_0x1dea('0x52')+_0x26d418+'))';return getZohoUser(_0x361f4c,_0x1dea('0x53'))[_0x1dea('0x29')](function(_0x36fc73){if(_0x36fc73)return _0x36fc73;if(_0xf04638[_0x1dea('0x47')]!=_0x1dea('0x56')){return createEndUser(_0x22adc5,_0x4d25da,_0x3e283e,_0x26d418,_0x40ed81,_0xf04638);}else{return{};}});break;case _0x1dea('0x58'):_0x361f4c[_0x1dea('0x51')]=_0x1dea('0x45')+_0x4d25da+_0x1dea('0x54')+_0x26d418+'))';return getZohoUser(_0x361f4c,_0x1dea('0x55'))['then'](function(_0x1f6905){if(_0x1f6905)return _0x1f6905;if(_0xf04638[_0x1dea('0x47')]!=_0x1dea('0x56')){return createEndUser(_0x22adc5,_0x4d25da,_0x3e283e,_0x26d418,_0x40ed81,_0xf04638);}else{return{};}});break;}}function getCall(_0x59884d,_0x5988d1,_0x4060ea,_0x12f088,_0x43e2bb,_0x206e8f,_0x498482,_0x31cab7){logger[_0x1dea('0x3a')](_0x1dea('0x59'));var _0xcf9050={};_0xcf9050[_0x1dea('0x5a')]={'name':!_['isNil'](_0x12f088['role']['name'])&&!_[_0x1dea('0x1e')](_0x12f088[_0x1dea('0x3d')][_0x1dea('0x1a')])&&_0x12f088['profile'][_0x1dea('0x1a')]===_0x1dea('0x5b')?_0x12f088[_0x1dea('0x48')][_0x1dea('0x1a')]:!_[_0x1dea('0x1e')](_0x12f088[_0x1dea('0x49')])?_0x12f088[_0x1dea('0x49')]+'\x20'+_0x12f088[_0x1dea('0x4a')]:_0x12f088['last_name'],'id':_0x12f088['id']};_0xcf9050[_0x1dea('0x5c')]=intUtil[_0x1dea('0x5d')](_0x206e8f['Subjects'],_0x498482,'\x20');_0xcf9050[_0x1dea('0x5e')]=intUtil['getString'](_0x206e8f[_0x1dea('0x5f')],_0x498482,'\x0a');if(_0x43e2bb['enduserType']==='Contacts'){_0xcf9050[_0x1dea('0x60')]={'name':!_[_0x1dea('0x1e')](_0x43e2bb[_0x1dea('0x61')])?_0x43e2bb['Full_Name']:!_[_0x1dea('0x1e')](_0x43e2bb['First_Name'])?_0x43e2bb[_0x1dea('0x62')]+'\x20'+_0x43e2bb[_0x1dea('0x63')]:_0x43e2bb[_0x1dea('0x63')],'id':_0x43e2bb['id']};}if(_0x43e2bb[_0x1dea('0x44')]===_0x1dea('0x55')){_0xcf9050['What_Id']={'name':!_[_0x1dea('0x1e')](_0x43e2bb[_0x1dea('0x61')])?_0x43e2bb[_0x1dea('0x61')]:!_[_0x1dea('0x1e')](_0x43e2bb[_0x1dea('0x62')])?_0x43e2bb[_0x1dea('0x62')]+'\x20'+_0x43e2bb[_0x1dea('0x63')]:_0x43e2bb['Last_Name'],'id':_0x43e2bb['id']};_0xcf9050[_0x1dea('0x64')]=_[_0x1dea('0x46')](_0x43e2bb[_0x1dea('0x44')]);}if(_0x498482[_0x1dea('0x65')]){_0xcf9050[_0x1dea('0x66')]=moment[_0x1dea('0x67')](parseInt(_0x498482[_0x1dea('0x65')])*0x3e8)[_0x1dea('0x32')](_0x1dea('0x68'));}else if(_0x498482[_0x1dea('0x69')]&&_0x498482[_0x1dea('0x6a')]){_0xcf9050[_0x1dea('0x66')]=moment[_0x1dea('0x67')](moment(_0x498482[_0x1dea('0x6a')],_0x1dea('0x6b'))[_0x1dea('0x6c')](moment(_0x498482[_0x1dea('0x6d')],_0x1dea('0x6b'))))[_0x1dea('0x32')](_0x1dea('0x68'));}switch(_0x498482[_0x1dea('0x6e')]){case _0x1dea('0x6f'):_0xcf9050['Call_Result']=_0x1dea('0x70');break;case _0x1dea('0x71'):case'connect':_0xcf9050[_0x1dea('0x72')]=_0x1dea('0x73');break;case _0x1dea('0x74'):_0xcf9050[_0x1dea('0x72')]=_0x1dea('0x75');break;case'abandoned':_0xcf9050[_0x1dea('0x72')]=_0x1dea('0x76');break;case'timeout':_0xcf9050['Call_Result']=_0x1dea('0x77');default:}_0xcf9050[_0x1dea('0x78')]=(_0x31cab7===_0x1dea('0x79')?moment(_0x498482['starttime'])[_0x1dea('0x32')](_0x1dea('0x6b')):moment(_0x498482['agentcalledAt'])['format'](_0x1dea('0x6b')))||moment()[_0x1dea('0x32')](_0x1dea('0x6b'));_0xcf9050[_0x1dea('0x7a')]=_0x31cab7||_0x1dea('0x7b');_0xcf9050=_['merge'](_0xcf9050,getCustomFields(_0x206e8f[_0x1dea('0x7c')],_0x498482));return request({'method':_0x1dea('0x23'),'uri':_0x1dea('0x45')+_0x5988d1+_0x1dea('0x7d'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59884d},'body':{'data':[_0xcf9050]},'json':!![]})['then'](function(_0x2f054f){if(_0x2f054f&&_0x2f054f[_0x1dea('0x43')][0x0]['code']===_0x1dea('0x4b')){logger[_0x1dea('0x3a')](_0x1dea('0x7e'));return{'id':_0x2f054f[_0x1dea('0x43')][0x0]['details']['id']};}})[_0x1dea('0x2c')](function(_0x5c1113){logger[_0x1dea('0x3a')](_0x1dea('0x7f'),_0x5c1113[_0x1dea('0x2f')]);console[_0x1dea('0x4e')](_0x1dea('0x7f'),_0x5c1113);});}exports[_0x1dea('0x80')]=function(_0x1d6e61,_0x5bc2c0,_0x28db91,_0x30c083,_0x50122c,_0x3ae2b2){var _0x55532f,_0x59e51f,_0x46f89a;_0x3ae2b2[_0x1dea('0x81')]=intUtil[_0x1dea('0x82')](_0x3ae2b2[_0x1dea('0x81')]);_0x3ae2b2[_0x1dea('0x83')]=intUtil[_0x1dea('0x82')](_0x3ae2b2[_0x1dea('0x83')]);if(_0x50122c&&_0x50122c[_0x1dea('0x84')]){logger[_0x1dea('0x3a')]('[QUEUE]',_0x1dea('0x85'));_0x5bc2c0[_0x1dea('0x86')]=_0x3ae2b2[_0x1dea('0x83')]+'/api/voice/recordings/'+_0x5bc2c0['uniqueid']+_0x1dea('0x87')+md5(_0x5bc2c0[_0x1dea('0x88')]);}else{_0x5bc2c0[_0x1dea('0x86')]='';}var _0x77e52b=_0x3ae2b2[_0x1dea('0x81')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3ae2b2)['then'](function(_0x41f528){_0x46f89a=_0x41f528;return getUser(_0x46f89a,_0x77e52b,_0x3ae2b2,_0x30c083['email']);})[_0x1dea('0x29')](function(_0x385698){_0x55532f=_0x385698;logger[_0x1dea('0x3a')]('The\x20User\x20ID\x20is:',_0x55532f['id']);return getEndUser(_0x46f89a,_0x77e52b,_0x3ae2b2,_0x5bc2c0[_0x1dea('0x89')],_0x5bc2c0[_0x1dea('0x8a')],_0x55532f,_0x28db91);})[_0x1dea('0x29')](function(_0x4260dd){_0x59e51f=_0x4260dd;return getCall(_0x46f89a,_0x77e52b,_0x3ae2b2,_0x55532f,_0x59e51f,_0x28db91,_0x5bc2c0,_0x1dea('0x7b'));})['then'](function(_0x27bcc5){if(_0x27bcc5){logger[_0x1dea('0x3a')]('The\x20Call\x20ID\x20is:',_0x27bcc5['id']);logger[_0x1dea('0x3a')](_0x1dea('0x8b'),_0x1dea('0x8c'));emit(util[_0x1dea('0x32')](_0x1dea('0x8d'),_0x30c083[_0x1dea('0x1a')]),_0x1dea('0x8e'),{'uri':_0x1dea('0x8f')+_0x3ae2b2[_0x1dea('0x81')]+_0x1dea('0x90')+_0x27bcc5['id']});}})[_0x1dea('0x2c')](function(_0xcdc821){logger[_0x1dea('0x2d')]('[QUEUE]',JSON[_0x1dea('0x42')](_0xcdc821));});};exports[_0x1dea('0x79')]=function(_0x55afc5,_0x1bb12a,_0x5d5c10,_0x559e6a,_0x4e69c9,_0x122a29,_0x5c92b7){var _0x8d6f41,_0x98eb6c,_0x329a90;_0x122a29['host']=intUtil['stripTrailingSlash'](_0x122a29[_0x1dea('0x81')]);_0x122a29['serverUrl']=intUtil[_0x1dea('0x82')](_0x122a29[_0x1dea('0x83')]);if(_0x5c92b7&&_0x5c92b7[_0x1dea('0x91')]&&_0x5c92b7[_0x1dea('0x91')]!==_0x1dea('0x92')){logger[_0x1dea('0x3a')](_0x1dea('0x93'),_0x1dea('0x85'));_0x1bb12a[_0x1dea('0x86')]=_0x122a29[_0x1dea('0x83')]+'/api/voice/recordings/'+_0x1bb12a[_0x1dea('0x88')]+_0x1dea('0x87')+md5(_0x1bb12a[_0x1dea('0x88')]);}var _0x27f86b=_0x122a29[_0x1dea('0x81')]===_0x1dea('0x94')?'eu':'com';return getAccessToken(_0x122a29)[_0x1dea('0x29')](function(_0x4a960d){_0x329a90=_0x4a960d;return getUser(_0x329a90,_0x27f86b,_0x122a29,_0x559e6a[_0x1dea('0x39')]);})[_0x1dea('0x29')](function(_0x1a8503){_0x8d6f41=_0x1a8503;logger[_0x1dea('0x3a')]('The\x20User\x20ID\x20is:',_0x8d6f41['id']);return getEndUser(_0x329a90,_0x27f86b,_0x122a29,_0x1bb12a[_0x1dea('0x95')],_0x1bb12a[_0x1dea('0x96')],_0x8d6f41,_0x5d5c10);})[_0x1dea('0x29')](function(_0x17aa29){_0x98eb6c=_0x17aa29;return getCall(_0x329a90,_0x27f86b,_0x122a29,_0x8d6f41,_0x98eb6c,_0x5d5c10,_0x1bb12a,_0x1dea('0x97'));})[_0x1dea('0x29')](function(_0x2ff338){if(_0x2ff338){logger[_0x1dea('0x3a')](_0x1dea('0x98'),_0x2ff338['id']);logger[_0x1dea('0x3a')](_0x1dea('0x93'),_0x1dea('0x8c'));emit(util[_0x1dea('0x32')]('user:%s',_0x559e6a[_0x1dea('0x1a')]),_0x1dea('0x8e'),{'uri':_0x1dea('0x8f')+_0x122a29[_0x1dea('0x81')]+_0x1dea('0x90')+_0x2ff338['id']});}})[_0x1dea('0x2c')](function(_0xf3a849){logger[_0x1dea('0x2d')](_0x1dea('0x93'),JSON['stringify'](_0xf3a849));});};exports['unmanaged']=function(_0x131c44,_0x5d8e95,_0x2e2ae7,_0x591435,_0x3b0d1a,_0xa520c7){var _0x106253,_0xc2d5b9,_0x31d944;_0xa520c7[_0x1dea('0x81')]=intUtil[_0x1dea('0x82')](_0xa520c7['host']);_0xa520c7['serverUrl']=intUtil[_0x1dea('0x82')](_0xa520c7['serverUrl']);if(_0x3b0d1a&&_0x3b0d1a['monitor_format']){logger[_0x1dea('0x3a')]('['+_0x5d8e95[_0x1dea('0x6e')]['toUpperCase']()+']',_0x1dea('0x85'));_0x5d8e95[_0x1dea('0x86')]=_0xa520c7[_0x1dea('0x83')]+_0x1dea('0x99')+_0x5d8e95['uniqueid']+_0x1dea('0x87')+md5(_0x5d8e95[_0x1dea('0x88')]);}else{_0x5d8e95[_0x1dea('0x86')]='';}var _0x276593=_0xa520c7[_0x1dea('0x81')]===_0x1dea('0x94')?'eu':_0x1dea('0x9a');return getAccessToken(_0xa520c7)['then'](function(_0x48004c){_0x31d944=_0x48004c;return getUser(_0x31d944,_0x276593,_0xa520c7);})['then'](function(_0x309c0f){_0x106253=_0x309c0f;logger['info']('The\x20User\x20ID\x20is:',_0x106253['id']);return getEndUser(_0x31d944,_0x276593,_0xa520c7,_0x5d8e95[_0x1dea('0x89')],_0x5d8e95[_0x1dea('0x8a')],_0x106253,_0x2e2ae7);})[_0x1dea('0x29')](function(_0x39b351){_0xc2d5b9=_0x39b351;return getCall(_0x31d944,_0x276593,_0xa520c7,_0x106253,_0xc2d5b9,_0x2e2ae7,_0x5d8e95,_0x1dea('0x7b'));})['then'](function(_0x1c80a5){if(_0x1c80a5){logger[_0x1dea('0x3a')](_0x1dea('0x98'),_0x1c80a5['id']);}})[_0x1dea('0x2c')](function(_0x2e8a46){logger[_0x1dea('0x2d')]('['+_0x5d8e95[_0x1dea('0x6e')][_0x1dea('0x9b')]()+']',JSON[_0x1dea('0x42')](_0x2e8a46));});}; \ No newline at end of file +var _0xb0bf=['Zoho-oauthtoken\x20','then','users','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','err','stack','log','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','host','com','email','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','recordingURL','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','/api/voice/recordings/','calleridname','calleridnum','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users'];(function(_0x14f215,_0x6fbae2){var _0x29de7d=function(_0x481169){while(--_0x481169){_0x14f215['push'](_0x14f215['shift']());}};_0x29de7d(++_0x6fbae2);}(_0xb0bf,0x69));var _0xfb0b=function(_0x411986,_0x75d748){_0x411986=_0x411986-0x0;var _0x2c26ee=_0xb0bf[_0x411986];return _0x2c26ee;};'use strict';var _=require(_0xfb0b('0x0'));var rp=require('request-promise');var md5=require(_0xfb0b('0x1'));var util=require(_0xfb0b('0x2'));var intUtil=require(_0xfb0b('0x3'));var moment=require(_0xfb0b('0x4'));var Redis=require(_0xfb0b('0x5'));var BPromise=require(_0xfb0b('0x6'));var config=require('../../../../config/environment');var logger=require(_0xfb0b('0x7'))('zoho');config[_0xfb0b('0x8')]=_[_0xfb0b('0x9')](config[_0xfb0b('0x8')],{'host':_0xfb0b('0xa'),'port':0x18eb});var io=require(_0xfb0b('0xb'))(new Redis(config[_0xfb0b('0x8')]));function emit(_0x20bb4,_0xaf1d8a,_0x3bcdd6){io['to'](_0x20bb4)['emit'](_0xaf1d8a,_0x3bcdd6);}function request(_0x5978f1){logger['debug'](_0xfb0b('0xc'),JSON[_0xfb0b('0xd')](_0x5978f1));return rp(_0x5978f1);}function getCustomFields(_0x431d1d,_0x6c5f62){var _0x66dbc6={};if(_0x431d1d['length']>0x0){_[_0xfb0b('0xe')](_0x431d1d,function(_0x2d626c){if(_[_0xfb0b('0xf')]([_0xfb0b('0x10'),_0xfb0b('0x11')],_0x2d626c[_0xfb0b('0x12')])&&_0x2d626c['idField']){_0x66dbc6[_0x2d626c[_0xfb0b('0x13')]]=_0x2d626c['content'][_0xfb0b('0x14')]();}else if(_0x2d626c['type']==='variable'&&_0x2d626c[_0xfb0b('0x15')]&&_0x2d626c[_0xfb0b('0x13')]&&_0x6c5f62[_0x2d626c['variableName']]){_0x66dbc6[_0x2d626c['idField']]=_0x6c5f62[_0x2d626c['variableName']][_0xfb0b('0x14')]();}else if(_0x2d626c[_0xfb0b('0x12')]===_0xfb0b('0x16')&&_0x2d626c[_0xfb0b('0x17')]&&_0x2d626c[_0xfb0b('0x17')][_0xfb0b('0x18')]&&_0x2d626c[_0xfb0b('0x13')]&&_0x6c5f62[_0x2d626c[_0xfb0b('0x17')][_0xfb0b('0x18')][_0xfb0b('0x19')]()]){_0x66dbc6[_0x2d626c[_0xfb0b('0x13')]]=_0x6c5f62[_0x2d626c[_0xfb0b('0x17')][_0xfb0b('0x18')][_0xfb0b('0x19')]()][_0xfb0b('0x14')]();}});}return _0x66dbc6;}function getName(_0x24cfbe){if(_0x24cfbe[_0xfb0b('0x1a')]('\x20')>0x0){var _0x5a5004=_0x24cfbe[_0xfb0b('0x1b')](/ (.+)/);if(_0x5a5004[0x1]){return _0x5a5004;}}return[_0x24cfbe,_0x24cfbe];}var accountsTokens={};function getAccessToken(_0x10009f){return new Promise(function(_0x12ab45,_0x4c93ba){if(!_['isNil'](accountsTokens[_0x10009f['id']])&&!_['isNil'](accountsTokens[_0x10009f['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x10009f['id']][_0xfb0b('0x1c')])){_0x12ab45(accountsTokens[_0x10009f['id']][_0xfb0b('0x1d')]);}}var _0x50b915;switch(_0x10009f[_0xfb0b('0x1e')]){case'US':_0x50b915=_0xfb0b('0x1f');break;case'AU':_0x50b915=_0xfb0b('0x20');break;case'EU':_0x50b915='https://accounts.zoho.eu';break;case'IN':_0x50b915=_0xfb0b('0x21');break;case'CN':_0x50b915='https://accounts.zoho.com.cn';break;default:_0x50b915=_0xfb0b('0x22');break;}var _0x58eb11={'method':_0xfb0b('0x23'),'uri':_0x50b915+_0xfb0b('0x24'),'qs':{'refresh_token':_0x10009f['refreshToken'],'client_id':_0x10009f[_0xfb0b('0x25')],'client_secret':_0x10009f['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x58eb11)['then'](function(_0xf59dc8){accountsTokens[_0x10009f['id']]={'access_token':_0xf59dc8[_0xfb0b('0x1d')],'expires_in':moment()[_0xfb0b('0x26')](_0xf59dc8[_0xfb0b('0x1c')],_0xfb0b('0x27'))};_0x12ab45(_0xf59dc8['access_token']);})[_0xfb0b('0x28')](function(_0x4bc324){logger[_0xfb0b('0x29')](_0xfb0b('0x2a'),_0x4bc324['stack']);_0x4c93ba(_0x4bc324);});});}function getUser(_0x36d5a0,_0x3d73e0,_0x2f2740,_0x5d9f74){logger[_0xfb0b('0x2b')](_0xfb0b('0x2c'));return request({'method':_0xfb0b('0x2d'),'uri':util[_0xfb0b('0x2e')](_0xfb0b('0x2f'),_0x3d73e0),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xfb0b('0x30')+_0x36d5a0},'json':!![]})[_0xfb0b('0x31')](function(_0x35c3a2){if(_0x35c3a2[_0xfb0b('0x32')]){var _0x2fda6d=-0x1;if(_['isArrayLikeObject'](_0x35c3a2[_0xfb0b('0x32')])){if(!_[_0xfb0b('0x33')](_0x5d9f74)){_0x2fda6d=_[_0xfb0b('0x34')](_0x35c3a2[_0xfb0b('0x32')],function(_0x37cf32){return _0x37cf32['email']===_0x5d9f74;});}if(_0x2fda6d>=0x0){logger['info'](_0xfb0b('0x35'));}else{logger[_0xfb0b('0x2b')](_0xfb0b('0x36'));_0x2fda6d=_[_0xfb0b('0x34')](_0x35c3a2[_0xfb0b('0x32')],function(_0x3a0cf6){return _0x3a0cf6[_0xfb0b('0x37')][_0xfb0b('0x18')]===_0xfb0b('0x38');});}return _0x35c3a2[_0xfb0b('0x32')][_0x2fda6d];}else{if(_0x35c3a2[_0xfb0b('0x39')]['profile'][_0xfb0b('0x18')]===_0xfb0b('0x38')){logger[_0xfb0b('0x2b')]('Using\x20the\x20admin\x20account!');user=_0x35c3a2['user'];return user;}else{logger[_0xfb0b('0x29')](_0xfb0b('0x3a'),JSON[_0xfb0b('0xd')](_0x35c3a2));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x35c3a2));}}}else{logger[_0xfb0b('0x29')](_0xfb0b('0x3a'),JSON[_0xfb0b('0xd')](_0x35c3a2));throw new Error(_0xfb0b('0x3b')+JSON[_0xfb0b('0xd')](_0x35c3a2));}})[_0xfb0b('0x28')](function(_0x5b8ab1){console[_0xfb0b('0x29')](_0x5b8ab1);});}function getZohoUser(_0x3c4d2f,_0x296b16){return new BPromise(function(_0x593694,_0x1fb859){request(_0x3c4d2f)['then'](function(_0x43d350){var _0x3dfa5d=null;if(_0x43d350){_0x3dfa5d=_0x43d350[_0xfb0b('0x3c')][0x0];_0x3dfa5d['enduserType']=_0x296b16;}_0x593694(_0x3dfa5d);})[_0xfb0b('0x28')](function(_0x32e9d2){_0x1fb859(_0x32e9d2);});});}function createEndUser(_0x5d664b,_0x12d087,_0x2276a8,_0x55fbbd,_0x6af56f,_0x2fb594){var _0x2276a8=getName(_0x2276a8);return request({'method':_0xfb0b('0x23'),'uri':_0xfb0b('0x3d')+_0x12d087+'/crm/v2/'+_[_0xfb0b('0x3e')](_0x2fb594[_0xfb0b('0x3f')])+'s','body':{'data':[{'Last_Name':_0x2276a8[0x1],'First_Name':_0x2276a8[0x0],'Phone':_0x55fbbd,'Owner':{'name':!_[_0xfb0b('0x33')](_0x6af56f[_0xfb0b('0x40')][_0xfb0b('0x18')])?_0x6af56f[_0xfb0b('0x40')]['name']:!_[_0xfb0b('0x33')](_0x6af56f[_0xfb0b('0x41')])?_0x6af56f[_0xfb0b('0x41')]+'\x20'+_0x6af56f['last_name']:_0x6af56f[_0xfb0b('0x42')],'id':_0x6af56f['id']}}]},'headers':{'Authorization':_0xfb0b('0x30')+_0x5d664b},'json':!![]})['then'](function(_0x4d5050){if(_0x4d5050&&_0x4d5050['data'][0x0][_0xfb0b('0x43')]===_0xfb0b('0x44')){var _0x4c854a=_0x4d5050[_0xfb0b('0x3c')][0x0][_0xfb0b('0x45')];_0x4c854a[_0xfb0b('0x46')]=_[_0xfb0b('0x3e')](_0x2fb594[_0xfb0b('0x3f')])+'s';return _0x4c854a;}logger[_0xfb0b('0x29')](_0xfb0b('0x3a'),JSON[_0xfb0b('0xd')](data));throw new Error(_0xfb0b('0x47')+JSON[_0xfb0b('0xd')](data));})['catch'](function(_0x3c423a){console['log'](_0xfb0b('0x48'),_0x3c423a);});}function getEndUser(_0x25ef1e,_0x3b1845,_0x15ebce,_0x11835d,_0x58aa02,_0x58d89d,_0x5c13a9){var _0x1351e9={'method':_0xfb0b('0x2d'),'uri':'','headers':{'Authorization':_0xfb0b('0x30')+_0x25ef1e},'json':!![]};switch(_0x5c13a9[_0xfb0b('0x49')]){case _0xfb0b('0x4a'):_0x1351e9[_0xfb0b('0x4b')]=_0xfb0b('0x3d')+_0x3b1845+_0xfb0b('0x4c')+_0x58aa02+'))';return getZohoUser(_0x1351e9,_0xfb0b('0x4d'))[_0xfb0b('0x31')](function(_0xf6c614){if(_0xf6c614)return _0xf6c614;_0x1351e9['uri']=_0xfb0b('0x3d')+_0x3b1845+_0xfb0b('0x4e')+_0x58aa02+'))';return getZohoUser(_0x1351e9,_0xfb0b('0x4f'))[_0xfb0b('0x31')](function(_0xb4bfc1){if(_0xb4bfc1)return _0xb4bfc1;if(_0x5c13a9[_0xfb0b('0x3f')]!=_0xfb0b('0x50')){return createEndUser(_0x25ef1e,_0x3b1845,_0x11835d,_0x58aa02,_0x58d89d,_0x5c13a9);}else{return{};}});});break;case'contact':_0x1351e9[_0xfb0b('0x4b')]='https://www.zohoapis.'+_0x3b1845+_0xfb0b('0x4c')+_0x58aa02+'))';return getZohoUser(_0x1351e9,_0xfb0b('0x4d'))[_0xfb0b('0x31')](function(_0xdc77ef){if(_0xdc77ef)return _0xdc77ef;if(_0x5c13a9[_0xfb0b('0x3f')]!=_0xfb0b('0x50')){return createEndUser(_0x25ef1e,_0x3b1845,_0x11835d,_0x58aa02,_0x58d89d,_0x5c13a9);}else{return{};}});break;case _0xfb0b('0x51'):_0x1351e9[_0xfb0b('0x4b')]=_0xfb0b('0x3d')+_0x3b1845+_0xfb0b('0x4e')+_0x58aa02+'))';return getZohoUser(_0x1351e9,_0xfb0b('0x4f'))[_0xfb0b('0x31')](function(_0x2fa3dd){if(_0x2fa3dd)return _0x2fa3dd;if(_0x5c13a9[_0xfb0b('0x3f')]!='nothing'){return createEndUser(_0x25ef1e,_0x3b1845,_0x11835d,_0x58aa02,_0x58d89d,_0x5c13a9);}else{return{};}});break;}}function getCall(_0x1be094,_0x38e2af,_0x5444db,_0x309f3e,_0x22c839,_0x2c40dd,_0x4663fa,_0x52745f){logger[_0xfb0b('0x2b')](_0xfb0b('0x52'));var _0x2a73ac={};_0x2a73ac[_0xfb0b('0x53')]={'name':!_['isNil'](_0x309f3e[_0xfb0b('0x40')][_0xfb0b('0x18')])&&!_['isNil'](_0x309f3e[_0xfb0b('0x37')][_0xfb0b('0x18')])&&_0x309f3e[_0xfb0b('0x37')][_0xfb0b('0x18')]===_0xfb0b('0x54')?_0x309f3e[_0xfb0b('0x40')]['name']:!_[_0xfb0b('0x33')](_0x309f3e[_0xfb0b('0x41')])?_0x309f3e['first_name']+'\x20'+_0x309f3e['last_name']:_0x309f3e[_0xfb0b('0x42')],'id':_0x309f3e['id']};_0x2a73ac['Subject']=intUtil[_0xfb0b('0x55')](_0x2c40dd['Subjects'],_0x4663fa,'\x20');_0x2a73ac[_0xfb0b('0x56')]=intUtil['getString'](_0x2c40dd[_0xfb0b('0x57')],_0x4663fa,'\x0a');if(_0x22c839[_0xfb0b('0x46')]===_0xfb0b('0x4d')){_0x2a73ac['Who_Id']={'name':!_['isNil'](_0x22c839[_0xfb0b('0x58')])?_0x22c839[_0xfb0b('0x58')]:!_[_0xfb0b('0x33')](_0x22c839[_0xfb0b('0x59')])?_0x22c839[_0xfb0b('0x59')]+'\x20'+_0x22c839[_0xfb0b('0x5a')]:_0x22c839[_0xfb0b('0x5a')],'id':_0x22c839['id']};}if(_0x22c839[_0xfb0b('0x46')]===_0xfb0b('0x4f')){_0x2a73ac[_0xfb0b('0x5b')]={'name':!_[_0xfb0b('0x33')](_0x22c839[_0xfb0b('0x58')])?_0x22c839[_0xfb0b('0x58')]:!_['isNil'](_0x22c839[_0xfb0b('0x59')])?_0x22c839['First_Name']+'\x20'+_0x22c839['Last_Name']:_0x22c839[_0xfb0b('0x5a')],'id':_0x22c839['id']};_0x2a73ac[_0xfb0b('0x5c')]=_['startCase'](_0x22c839[_0xfb0b('0x46')]);}if(_0x4663fa[_0xfb0b('0x5d')]){_0x2a73ac[_0xfb0b('0x5e')]=moment[_0xfb0b('0x5f')](parseInt(_0x4663fa[_0xfb0b('0x5d')])*0x3e8)[_0xfb0b('0x2e')](_0xfb0b('0x60'));}else if(_0x4663fa['answertime']&&_0x4663fa[_0xfb0b('0x61')]){_0x2a73ac[_0xfb0b('0x5e')]=moment[_0xfb0b('0x5f')](moment(_0x4663fa[_0xfb0b('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0xfb0b('0x62')](moment(_0x4663fa[_0xfb0b('0x63')],_0xfb0b('0x64'))))[_0xfb0b('0x2e')](_0xfb0b('0x60'));}switch(_0x4663fa['lastevent']){case _0xfb0b('0x65'):_0x2a73ac[_0xfb0b('0x66')]=_0xfb0b('0x67');break;case _0xfb0b('0x68'):case _0xfb0b('0x69'):_0x2a73ac[_0xfb0b('0x66')]=_0xfb0b('0x6a');break;case _0xfb0b('0x6b'):_0x2a73ac['Call_Result']=_0xfb0b('0x6c');break;case _0xfb0b('0x6d'):_0x2a73ac[_0xfb0b('0x66')]=_0xfb0b('0x6e');break;case _0xfb0b('0x6f'):_0x2a73ac[_0xfb0b('0x66')]=_0xfb0b('0x70');default:}_0x2a73ac['Call_Start_Time']=(_0x52745f===_0xfb0b('0x71')?moment(_0x4663fa['starttime'])[_0xfb0b('0x2e')](_0xfb0b('0x64')):moment(_0x4663fa[_0xfb0b('0x72')])[_0xfb0b('0x2e')](_0xfb0b('0x64')))||moment()['format'](_0xfb0b('0x64'));_0x2a73ac['Call_Type']=_0x52745f||_0xfb0b('0x73');_0x2a73ac=_[_0xfb0b('0x74')](_0x2a73ac,getCustomFields(_0x2c40dd[_0xfb0b('0x75')],_0x4663fa));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x38e2af+_0xfb0b('0x76'),'headers':{'Authorization':_0xfb0b('0x30')+_0x1be094},'body':{'data':[_0x2a73ac]},'json':!![]})[_0xfb0b('0x31')](function(_0x2459e6){if(_0x2459e6&&_0x2459e6['data'][0x0][_0xfb0b('0x43')]===_0xfb0b('0x44')){logger['info']('Call\x20created!');return{'id':_0x2459e6[_0xfb0b('0x3c')][0x0][_0xfb0b('0x45')]['id']};}})[_0xfb0b('0x28')](function(_0x4d4ef6){logger['info'](_0xfb0b('0x77'),_0x4d4ef6[_0xfb0b('0x78')]);console[_0xfb0b('0x79')](_0xfb0b('0x77'),_0x4d4ef6);});}exports[_0xfb0b('0x7a')]=function(_0x21b824,_0x4e1f3b,_0x596df4,_0x4d7c6e,_0x15a5f7,_0x453ac2){var _0x14b008,_0x2dc47e,_0x33f045;_0x453ac2['host']=intUtil[_0xfb0b('0x7b')](_0x453ac2['host']);_0x453ac2[_0xfb0b('0x7c')]=intUtil[_0xfb0b('0x7b')](_0x453ac2[_0xfb0b('0x7c')]);if(_0x15a5f7&&_0x15a5f7[_0xfb0b('0x7d')]){logger[_0xfb0b('0x2b')](_0xfb0b('0x7e'),_0xfb0b('0x7f'));_0x4e1f3b['recordingURL']=_0x453ac2[_0xfb0b('0x7c')]+'/api/voice/recordings/'+_0x4e1f3b[_0xfb0b('0x80')]+_0xfb0b('0x81')+md5(_0x4e1f3b[_0xfb0b('0x80')]);}else{_0x4e1f3b['recordingURL']='';}var _0x3b5ae3=_0x453ac2[_0xfb0b('0x82')]==='zoho.eu'?'eu':_0xfb0b('0x83');return getAccessToken(_0x453ac2)[_0xfb0b('0x31')](function(_0x497349){_0x33f045=_0x497349;return getUser(_0x33f045,_0x3b5ae3,_0x453ac2,_0x4d7c6e[_0xfb0b('0x84')]);})[_0xfb0b('0x31')](function(_0x2129cf){_0x14b008=_0x2129cf;logger['info'](_0xfb0b('0x85'),_0x14b008['id']);return getEndUser(_0x33f045,_0x3b5ae3,_0x453ac2,_0x4e1f3b['calleridname'],_0x4e1f3b['calleridnum'],_0x14b008,_0x596df4);})[_0xfb0b('0x31')](function(_0x2983a8){_0x2dc47e=_0x2983a8;return getCall(_0x33f045,_0x3b5ae3,_0x453ac2,_0x14b008,_0x2dc47e,_0x596df4,_0x4e1f3b,_0xfb0b('0x73'));})[_0xfb0b('0x31')](function(_0x493e1b){if(_0x493e1b){logger[_0xfb0b('0x2b')](_0xfb0b('0x86'),_0x493e1b['id']);logger[_0xfb0b('0x2b')](_0xfb0b('0x7e'),_0xfb0b('0x87'));emit(util[_0xfb0b('0x2e')]('user:%s',_0x4d7c6e[_0xfb0b('0x18')]),_0xfb0b('0x88'),{'uri':_0xfb0b('0x89')+_0x453ac2[_0xfb0b('0x82')]+_0xfb0b('0x8a')+_0x493e1b['id']});}})[_0xfb0b('0x28')](function(_0x5b715a){logger['error'](_0xfb0b('0x7e'),JSON[_0xfb0b('0xd')](_0x5b715a));});};exports[_0xfb0b('0x71')]=function(_0x3ec3e9,_0x3b673e,_0x5d7764,_0x5a3a9c,_0x130654,_0x5464ef,_0xf6e3da){var _0x371d04,_0x1ccb12,_0x3198d3;_0x5464ef['host']=intUtil['stripTrailingSlash'](_0x5464ef[_0xfb0b('0x82')]);_0x5464ef[_0xfb0b('0x7c')]=intUtil['stripTrailingSlash'](_0x5464ef['serverUrl']);if(_0xf6e3da&&_0xf6e3da[_0xfb0b('0x8b')]&&_0xf6e3da[_0xfb0b('0x8b')]!==_0xfb0b('0x8c')){logger[_0xfb0b('0x2b')](_0xfb0b('0x8d'),'Recording\x20is\x20enabled!');_0x3b673e[_0xfb0b('0x8e')]=_0x5464ef[_0xfb0b('0x7c')]+'/api/voice/recordings/'+_0x3b673e[_0xfb0b('0x80')]+_0xfb0b('0x81')+md5(_0x3b673e[_0xfb0b('0x80')]);}var _0x5082ee=_0x5464ef[_0xfb0b('0x82')]===_0xfb0b('0x8f')?'eu':_0xfb0b('0x83');return getAccessToken(_0x5464ef)[_0xfb0b('0x31')](function(_0x427927){_0x3198d3=_0x427927;return getUser(_0x3198d3,_0x5082ee,_0x5464ef,_0x5a3a9c[_0xfb0b('0x84')]);})[_0xfb0b('0x31')](function(_0x1d7dbf){_0x371d04=_0x1d7dbf;logger[_0xfb0b('0x2b')](_0xfb0b('0x85'),_0x371d04['id']);return getEndUser(_0x3198d3,_0x5082ee,_0x5464ef,_0x3b673e[_0xfb0b('0x90')],_0x3b673e[_0xfb0b('0x91')],_0x371d04,_0x5d7764);})[_0xfb0b('0x31')](function(_0x11178e){_0x1ccb12=_0x11178e;return getCall(_0x3198d3,_0x5082ee,_0x5464ef,_0x371d04,_0x1ccb12,_0x5d7764,_0x3b673e,_0xfb0b('0x92'));})[_0xfb0b('0x31')](function(_0x24d4a4){if(_0x24d4a4){logger[_0xfb0b('0x2b')]('The\x20Call\x20ID\x20is:',_0x24d4a4['id']);logger[_0xfb0b('0x2b')](_0xfb0b('0x8d'),_0xfb0b('0x87'));emit(util['format']('user:%s',_0x5a3a9c['name']),'trigger:browser:url',{'uri':_0xfb0b('0x89')+_0x5464ef[_0xfb0b('0x82')]+_0xfb0b('0x8a')+_0x24d4a4['id']});}})[_0xfb0b('0x28')](function(_0x3ed406){logger[_0xfb0b('0x29')](_0xfb0b('0x8d'),JSON[_0xfb0b('0xd')](_0x3ed406));});};exports[_0xfb0b('0x93')]=function(_0x2df65d,_0x244aa7,_0x4d531e,_0x56e717,_0x534d0c,_0x46accc){var _0x3af68f,_0x102b43,_0x28e383;_0x46accc[_0xfb0b('0x82')]=intUtil[_0xfb0b('0x7b')](_0x46accc[_0xfb0b('0x82')]);_0x46accc[_0xfb0b('0x7c')]=intUtil[_0xfb0b('0x7b')](_0x46accc[_0xfb0b('0x7c')]);if(_0x534d0c&&_0x534d0c[_0xfb0b('0x7d')]){logger['info']('['+_0x244aa7[_0xfb0b('0x94')][_0xfb0b('0x95')]()+']',_0xfb0b('0x7f'));_0x244aa7[_0xfb0b('0x8e')]=_0x46accc[_0xfb0b('0x7c')]+_0xfb0b('0x96')+_0x244aa7[_0xfb0b('0x80')]+_0xfb0b('0x81')+md5(_0x244aa7[_0xfb0b('0x80')]);}else{_0x244aa7[_0xfb0b('0x8e')]='';}var _0x5ae376=_0x46accc[_0xfb0b('0x82')]===_0xfb0b('0x8f')?'eu':_0xfb0b('0x83');return getAccessToken(_0x46accc)[_0xfb0b('0x31')](function(_0x39d815){_0x28e383=_0x39d815;return getUser(_0x28e383,_0x5ae376,_0x46accc);})[_0xfb0b('0x31')](function(_0x3cccb9){_0x3af68f=_0x3cccb9;logger[_0xfb0b('0x2b')](_0xfb0b('0x85'),_0x3af68f['id']);return getEndUser(_0x28e383,_0x5ae376,_0x46accc,_0x244aa7[_0xfb0b('0x97')],_0x244aa7[_0xfb0b('0x98')],_0x3af68f,_0x4d531e);})[_0xfb0b('0x31')](function(_0x3f636e){_0x102b43=_0x3f636e;return getCall(_0x28e383,_0x5ae376,_0x46accc,_0x3af68f,_0x102b43,_0x4d531e,_0x244aa7,_0xfb0b('0x73'));})['then'](function(_0x336e9f){if(_0x336e9f){logger[_0xfb0b('0x2b')](_0xfb0b('0x86'),_0x336e9f['id']);}})[_0xfb0b('0x28')](function(_0x35d825){logger[_0xfb0b('0x29')]('['+_0x244aa7[_0xfb0b('0x94')]['toUpperCase']()+']',JSON[_0xfb0b('0xd')](_0x35d825));});}; \ 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 b0cc3d3..e97c562 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 _0xf42a=['data2','Script','data3','render','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec'];(function(_0x3d80e4,_0x180e06){var _0x150ca2=function(_0x5203d6){while(--_0x5203d6){_0x3d80e4['push'](_0x3d80e4['shift']());}};_0x150ca2(++_0x180e06);}(_0xf42a,0xc7));var _0xaf42=function(_0x1d7dfd,_0x155be9){_0x1d7dfd=_0x1d7dfd-0x0;var _0x529f57=_0xf42a[_0x1d7dfd];return _0x529f57;};'use strict';var util=require(_0xaf42('0x0'));var sh=require(_0xaf42('0x1'));var Mustache=require(_0xaf42('0x2'));var logger=require('../../../../config/logger')(_0xaf42('0x3'));exports[_0xaf42('0x4')]=function(_0x3dfc3d,_0x368427){var _0x5a08d5=_0x3dfc3d[_0xaf42('0x5')]?_0x3dfc3d[_0xaf42('0x5')]:_0xaf42('0x6');var _0x41ae67=_0x3dfc3d[_0xaf42('0x7')]?Mustache[_0xaf42('0x8')](_0x3dfc3d[_0xaf42('0x7')],_0x368427):_0x368427;sh['exec'](_0x41ae67,function(_0x55d1cd,_0x4d12e4,_0x26ed16){if(_0x55d1cd!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5a08d5,_0x41ae67,_0x55d1cd,_0x26ed16));}else{logger[_0xaf42('0x9')](util[_0xaf42('0xa')](_0xaf42('0xb'),_0x5a08d5,_0x41ae67,_0x4d12e4));}});}; \ No newline at end of file +var _0xfb9d=['render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','trigger','exec','data2'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfb9d,0xdf));var _0xdfb9=function(_0x2ecec7,_0x152f63){_0x2ecec7=_0x2ecec7-0x0;var _0x24a4ee=_0xfb9d[_0x2ecec7];return _0x24a4ee;};'use strict';var util=require('util');var sh=require(_0xdfb9('0x0'));var Mustache=require('mustache');var logger=require(_0xdfb9('0x1'))(_0xdfb9('0x2'));exports[_0xdfb9('0x3')]=function(_0x32b51b,_0x1695fc){var _0x54d9be=_0x32b51b['data2']?_0x32b51b[_0xdfb9('0x4')]:'Script';var _0x3dc70b=_0x32b51b['data3']?Mustache[_0xdfb9('0x5')](_0x32b51b[_0xdfb9('0x6')],_0x1695fc):_0x1695fc;sh[_0xdfb9('0x3')](_0x3dc70b,function(_0x461ac5,_0x1eeeb0,_0x5e7ea0){if(_0x461ac5!==0x0){logger[_0xdfb9('0x7')](util[_0xdfb9('0x8')](_0xdfb9('0x9'),_0x54d9be,_0x3dc70b,_0x461ac5,_0x5e7ea0));}else{logger[_0xdfb9('0xa')](util[_0xdfb9('0x8')](_0xdfb9('0xb'),_0x54d9be,_0x3dc70b,_0x1eeeb0));}});}; \ 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 ebb9659..a173f2c 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 _0x7e52=['exec','data1','toUpperCase','render','data2','data5','number','parse','data6','error','stack','GET','POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','util','lodash','mustache','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e52,0x1eb));var _0x27e5=function(_0x4f2cab,_0x56f967){_0x4f2cab=_0x4f2cab-0x0;var _0x2a72ad=_0x7e52[_0x4f2cab];return _0x2a72ad;};'use strict';var rp=require('request-promise');var util=require(_0x27e5('0x0'));var _=require(_0x27e5('0x1'));var Mustache=require(_0x27e5('0x2'));var logger=require(_0x27e5('0x3'))('trigger');exports[_0x27e5('0x4')]=function(_0x566e02,_0x201834){var _0x218272,_0x5bd32c;var _0x3a5113={'method':_0x566e02[_0x27e5('0x5')][_0x27e5('0x6')](),'uri':Mustache[_0x27e5('0x7')](_0x566e02[_0x27e5('0x8')],_0x201834),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x566e02[_0x27e5('0x9')])===_0x27e5('0xa')&&parseInt(_0x566e02[_0x27e5('0x9')])>=0x1&&parseInt(_0x566e02['data5'])<=0xa?parseInt(_0x566e02[_0x27e5('0x9')])*0x3e8:0x5*0x3e8};try{_0x3a5113['headers']=_0x566e02['data6']?JSON[_0x27e5('0xb')](Mustache[_0x27e5('0x7')](_0x566e02[_0x27e5('0xc')],_0x201834)):{};}catch(_0x18a11f){logger[_0x27e5('0xd')](_0x18a11f[_0x27e5('0xe')]);}switch(_0x566e02[_0x27e5('0x5')][_0x27e5('0x6')]()){case _0x27e5('0xf'):case'DELETE':_0x218272=null;_0x3a5113['qs']=_0x201834;break;case _0x27e5('0x10'):case _0x27e5('0x11'):if(_0x566e02['data7']){try{_0x218272=JSON[_0x27e5('0xb')](Mustache[_0x27e5('0x7')](_0x566e02[_0x27e5('0x12')],_0x201834));_0x3a5113[_0x27e5('0x13')]=_0x218272;}catch(_0x49b754){logger['error'](_0x49b754[_0x27e5('0xe')]);logger[_0x27e5('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x218272=_0x201834;_0x3a5113['body']=_0x218272;}break;}logger[_0x27e5('0x14')](util[_0x27e5('0x15')](_0x27e5('0x16'),_0x566e02[_0x27e5('0x5')],_0x566e02[_0x27e5('0x8')],JSON['stringify'](_0x3a5113)));rp(_0x3a5113)[_0x27e5('0x17')](function(_0x326fc3){_0x218272=!_[_0x27e5('0x18')](_0x218272)?_0x27e5('0x19')+_0x218272:'';_0x5bd32c=typeof _0x326fc3['body']===_0x27e5('0x1a')?JSON[_0x27e5('0x1b')](_0x326fc3['body']):_0x326fc3[_0x27e5('0x13')];logger['info'](util[_0x27e5('0x15')](_0x27e5('0x1c'),_0x566e02['data1'],_0x566e02[_0x27e5('0x8')],_0x326fc3[_0x27e5('0x1d')],_0x5bd32c));})[_0x27e5('0x1e')](function(_0x47a67d){logger[_0x27e5('0xd')](util[_0x27e5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x566e02[_0x27e5('0x5')],_0x566e02[_0x27e5('0x8')],_0x47a67d[_0x27e5('0x1d')],_0x47a67d[_0x27e5('0x1f')],_0x47a67d[_0x27e5('0x20')]));});}; \ No newline at end of file +var _0x2004=['name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','number','data5','headers','data6','parse','render','error','DELETE','PUT','data7','body','stack','info','format','stringify','then','isNil','%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'];(function(_0x24e73b,_0x3cd8aa){var _0x4044b4=function(_0x503827){while(--_0x503827){_0x24e73b['push'](_0x24e73b['shift']());}};_0x4044b4(++_0x3cd8aa);}(_0x2004,0x121));var _0x4200=function(_0x435aba,_0x1910b4){_0x435aba=_0x435aba-0x0;var _0x19c266=_0x2004[_0x435aba];return _0x19c266;};'use strict';var rp=require(_0x4200('0x0'));var util=require(_0x4200('0x1'));var _=require(_0x4200('0x2'));var Mustache=require(_0x4200('0x3'));var logger=require(_0x4200('0x4'))(_0x4200('0x5'));exports[_0x4200('0x6')]=function(_0x559c38,_0x206ca6){var _0x2dd85a,_0x3af33b;var _0x41d047={'method':_0x559c38[_0x4200('0x7')][_0x4200('0x8')](),'uri':Mustache['render'](_0x559c38[_0x4200('0x9')],_0x206ca6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x559c38['data5'])===_0x4200('0xa')&&parseInt(_0x559c38[_0x4200('0xb')])>=0x1&&parseInt(_0x559c38[_0x4200('0xb')])<=0xa?parseInt(_0x559c38[_0x4200('0xb')])*0x3e8:0x5*0x3e8};try{_0x41d047[_0x4200('0xc')]=_0x559c38[_0x4200('0xd')]?JSON[_0x4200('0xe')](Mustache[_0x4200('0xf')](_0x559c38[_0x4200('0xd')],_0x206ca6)):{};}catch(_0x2b8862){logger[_0x4200('0x10')](_0x2b8862['stack']);}switch(_0x559c38['data1'][_0x4200('0x8')]()){case'GET':case _0x4200('0x11'):_0x2dd85a=null;_0x41d047['qs']=_0x206ca6;break;case'POST':case _0x4200('0x12'):if(_0x559c38['data7']){try{_0x2dd85a=JSON[_0x4200('0xe')](Mustache['render'](_0x559c38[_0x4200('0x13')],_0x206ca6));_0x41d047[_0x4200('0x14')]=_0x2dd85a;}catch(_0x449df0){logger[_0x4200('0x10')](_0x449df0[_0x4200('0x15')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2dd85a=_0x206ca6;_0x41d047[_0x4200('0x14')]=_0x2dd85a;}break;}logger[_0x4200('0x16')](util[_0x4200('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x559c38[_0x4200('0x7')],_0x559c38[_0x4200('0x9')],JSON[_0x4200('0x18')](_0x41d047)));rp(_0x41d047)[_0x4200('0x19')](function(_0x3afcbd){_0x2dd85a=!_[_0x4200('0x1a')](_0x2dd85a)?',\x20request\x20body:\x20'+_0x2dd85a:'';_0x3af33b=typeof _0x3afcbd[_0x4200('0x14')]==='object'?JSON[_0x4200('0x18')](_0x3afcbd['body']):_0x3afcbd[_0x4200('0x14')];logger[_0x4200('0x16')](util[_0x4200('0x17')](_0x4200('0x1b'),_0x559c38[_0x4200('0x7')],_0x559c38[_0x4200('0x9')],_0x3afcbd[_0x4200('0x1c')],_0x3af33b));})[_0x4200('0x1d')](function(_0xf502ad){logger['error'](util[_0x4200('0x17')](_0x4200('0x1e'),_0x559c38[_0x4200('0x7')],_0x559c38[_0x4200('0x9')],_0xf502ad[_0x4200('0x1c')],_0xf502ad[_0x4200('0x1f')],_0xf502ad['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index a28651b..38364e0 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 _0xfef6=['client','http','request','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x50880b,_0x828ad0){var _0x1f2c16=function(_0xa34224){while(--_0xa34224){_0x50880b['push'](_0x50880b['shift']());}};_0x1f2c16(++_0x828ad0);}(_0xfef6,0xa6));var _0x6fef=function(_0x7d37bc,_0x27289b){_0x7d37bc=_0x7d37bc-0x0;var _0x1e6b2f=_0xfef6[_0x7d37bc];return _0x1e6b2f;};'use strict';var jayson=require(_0x6fef('0x0'));var BPromise=require(_0x6fef('0x1'));var logger=require(_0x6fef('0x2'))('routing');var client=jayson[_0x6fef('0x3')][_0x6fef('0x4')]({'port':0x2329});client['Request']=function(_0x5f3ce0,_0x5b0fff){return new BPromise(function(_0x5c20b2,_0x54460d){return client[_0x6fef('0x5')](_0x5f3ce0,_0x5b0fff)['then'](function(_0x559663){logger['debug'](_0x6fef('0x6'),_0x6fef('0x7'),_0x5f3ce0,_0x5b0fff,_0x559663);if(_0x559663[_0x6fef('0x8')]){logger['error']('rpc',_0x6fef('0x7'),_0x5f3ce0,_0x559663['error']['message'],_0x5b0fff);return _0x54460d(_0x559663[_0x6fef('0x8')][_0x6fef('0x9')]);}else{return _0x5c20b2(_0x559663[_0x6fef('0xa')]);}})[_0x6fef('0xb')](function(_0x14d531){logger['error'](_0x6fef('0x6'),_0x6fef('0x7'),_0x5f3ce0,_0x14d531,_0x5b0fff);return _0x54460d(_0x14d531);});});};module[_0x6fef('0xc')]=client; \ No newline at end of file +var _0x61bd=['message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x61bd,0x17c));var _0xd61b=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x61bd[_0x53abe5];return _0xc1c37e;};'use strict';var jayson=require(_0xd61b('0x0'));var BPromise=require('bluebird');var logger=require(_0xd61b('0x1'))(_0xd61b('0x2'));var client=jayson[_0xd61b('0x3')][_0xd61b('0x4')]({'port':0x2329});client[_0xd61b('0x5')]=function(_0x563f89,_0x47efd9){return new BPromise(function(_0x13f14a,_0x1e9680){return client[_0xd61b('0x6')](_0x563f89,_0x47efd9)[_0xd61b('0x7')](function(_0x301085){logger['debug'](_0xd61b('0x8'),'routing',_0x563f89,_0x47efd9,_0x301085);if(_0x301085[_0xd61b('0x9')]){logger[_0xd61b('0x9')]('rpc',_0xd61b('0x2'),_0x563f89,_0x301085[_0xd61b('0x9')][_0xd61b('0xa')],_0x47efd9);return _0x1e9680(_0x301085[_0xd61b('0x9')][_0xd61b('0xa')]);}else{return _0x13f14a(_0x301085['result']);}})[_0xd61b('0xb')](function(_0x184b07){logger[_0xd61b('0x9')]('rpc',_0xd61b('0x2'),_0x563f89,_0x184b07,_0x47efd9);return _0x1e9680(_0x184b07);});});};module[_0xd61b('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9d8fa30..7a39888 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 _0x894c=['./realtime','./lib/email','./rpc/mailAccount','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','./server'];(function(_0x2c0429,_0x4c14b7){var _0x28b624=function(_0x92bb16){while(--_0x92bb16){_0x2c0429['push'](_0x2c0429['shift']());}};_0x28b624(++_0x4c14b7);}(_0x894c,0x8b));var _0xc894=function(_0x12df96,_0x1c844b){_0x12df96=_0x12df96-0x0;var _0x3c5c41=_0x894c[_0x12df96];return _0x3c5c41;};'use strict';var server=require(_0xc894('0x0'));var Realtime=require(_0xc894('0x1'));var EmailChannel=require(_0xc894('0x2'));var mailAccount=require(_0xc894('0x3'));var setting=require('./rpc/setting');var logger=require(_0xc894('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc894('0x5')]()[_0xc894('0x6')](mailAccount[_0xc894('0x7')]())[_0xc894('0x6')](realtime[_0xc894('0x8')]())[_0xc894('0x6')](function(){email[_0xc894('0x9')](realtime[_0xc894('0xa')]);return realtime;});}function main(){return server[_0xc894('0xb')](realtime,email)[_0xc894('0x6')](function(){return initRealtime();})[_0xc894('0x6')](function(){return setting['getSettings']();})[_0xc894('0x6')](function(_0x53962d){return setInterval(initRealtime,_0x53962d[_0xc894('0xc')]*0x3e8);})[_0xc894('0xd')](function(_0x18027b){logger['error']('Email\x20service\x20initialization',_0x18027b);});}main(); \ No newline at end of file +var _0x2a82=['initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','email','resolve','then','getMailAccounts'];(function(_0x368ca9,_0x168b2d){var _0x5eaef8=function(_0x458ff2){while(--_0x458ff2){_0x368ca9['push'](_0x368ca9['shift']());}};_0x5eaef8(++_0x168b2d);}(_0x2a82,0x7f));var _0x22a8=function(_0x437caa,_0x3a1b5d){_0x437caa=_0x437caa-0x0;var _0x516a74=_0x2a82[_0x437caa];return _0x516a74;};'use strict';var server=require(_0x22a8('0x0'));var Realtime=require(_0x22a8('0x1'));var EmailChannel=require(_0x22a8('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x22a8('0x3'));var logger=require('../../config/logger')(_0x22a8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x22a8('0x5')]()[_0x22a8('0x6')](mailAccount[_0x22a8('0x7')]())[_0x22a8('0x6')](realtime[_0x22a8('0x8')]())[_0x22a8('0x6')](function(){email[_0x22a8('0x9')](realtime[_0x22a8('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x22a8('0x6')](function(){return initRealtime();})[_0x22a8('0x6')](function(){return setting[_0x22a8('0xb')]();})[_0x22a8('0x6')](function(_0x39e9ce){return setInterval(initRealtime,_0x39e9ce[_0x22a8('0xc')]*0x3e8);})[_0x22a8('0xd')](function(_0x2138ff){logger['error'](_0x22a8('0xe'),_0x2138ff);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a866f7b..6e7bcb4 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 _0x48ea=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','key','active','status','Imap','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','bind','handleImapEnd','disabled','messageStatus','handleImapBox','connected','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','error','sendMail','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap'];(function(_0x40a49f,_0x4f5baf){var _0x65d420=function(_0x49b344){while(--_0x49b344){_0x40a49f['push'](_0x40a49f['shift']());}};_0x65d420(++_0x4f5baf);}(_0x48ea,0x1b4));var _0xa48e=function(_0x1e13c2,_0xcc8231){_0x1e13c2=_0x1e13c2-0x0;var _0x38b874=_0x48ea[_0x1e13c2];return _0x38b874;};'use strict';var _=require(_0xa48e('0x0'));var moment=require(_0xa48e('0x1'));var BPromise=require(_0xa48e('0x2'));var md5=require(_0xa48e('0x3'));var Redis=require('ioredis');var config=require(_0xa48e('0x4'));var logger=require(_0xa48e('0x5'))(_0xa48e('0x6'));config[_0xa48e('0x7')]=_[_0xa48e('0x8')](config[_0xa48e('0x7')],{'host':_0xa48e('0x9'),'port':0x18eb});var io=require(_0xa48e('0xa'))(new Redis(config['redis']));var EmailImap=require(_0xa48e('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xa48e('0xc'));var md5Accounts={};function EmailChannel(_0x18a3f1){logger[_0xa48e('0xd')](_0xa48e('0xe'));this[_0xa48e('0xf')]=_0x18a3f1['mailAccounts'];this[_0xa48e('0x10')]={};this[_0xa48e('0x11')]=new EmailSmtp();}EmailChannel[_0xa48e('0x12')]['emit']=function(_0x8455de){var _0x141f45=this['mailAccounts'][_0x8455de];var _0x1c562a={'id':_0x141f45['id'],'name':_0x141f45['name'],'key':_0x141f45[_0xa48e('0x13')],'active':_0x141f45[_0xa48e('0x14')],'Imap':{'status':_0x141f45['Imap'][_0xa48e('0x15')],'messageStatus':_0x141f45['Imap']['messageStatus'],'total':_0x141f45[_0xa48e('0x16')]['total']}};if(_[_0xa48e('0x17')](md5Accounts[_0x8455de])){md5Accounts[_0x8455de]={};}var _0x2ac090=md5(JSON[_0xa48e('0x18')](_0x1c562a));if(md5Accounts[_0x8455de][_0xa48e('0x3')]!==_0x2ac090){md5Accounts[_0x8455de][_0xa48e('0x3')]=_0x2ac090;io[_0xa48e('0x19')](_0xa48e('0x1a'),_0x1c562a);}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x1b')]=function(_0x1fe2ff){for(var _0x5e6ab2 in _0x1fe2ff){if(_0x1fe2ff[_0xa48e('0x1c')](_0x5e6ab2)){if(_0x1fe2ff[_0x5e6ab2][_0xa48e('0x16')]&&_0x1fe2ff[_0x5e6ab2][_0xa48e('0x14')]){var _0x494be5=_0x1fe2ff[_0x5e6ab2][_0xa48e('0x16')];if(!_0x494be5[_0xa48e('0x1d')]&&_0x1fe2ff[_0x5e6ab2][_0xa48e('0x1e')]!==_0xa48e('0x1f'))_0x494be5[_0xa48e('0x1d')]=_0x1fe2ff[_0x5e6ab2][_0xa48e('0x1e')];if(!this[_0xa48e('0x10')][_0xa48e('0x1c')](_0x494be5['id'])){this[_0xa48e('0x10')][_0x494be5['id']]=new EmailImap(_0x494be5,_0x1fe2ff[_0x5e6ab2]['email']);this['imapAccounts'][_0x494be5['id']]['on']('box',this['handleImapBox'][_0xa48e('0x20')](this,_0x5e6ab2));this[_0xa48e('0x10')][_0x494be5['id']]['on'](_0xa48e('0x6'),this['handleImapEmail'][_0xa48e('0x20')](this,_0x5e6ab2));this[_0xa48e('0x10')][_0x494be5['id']]['on']('end',this[_0xa48e('0x21')][_0xa48e('0x20')](this,_0x5e6ab2));this[_0xa48e('0x10')][_0x494be5['id']]['on']('error',this['handleImapError'][_0xa48e('0x20')](this,_0x5e6ab2));}}else{if(_[_0xa48e('0x17')](this[_0xa48e('0xf')][_0x5e6ab2][_0xa48e('0x16')])){this['mailAccounts'][_0x5e6ab2][_0xa48e('0x16')]={};}this[_0xa48e('0xf')][_0x5e6ab2][_0xa48e('0x16')]['status']=_0xa48e('0x22');this[_0xa48e('0xf')][_0x5e6ab2][_0xa48e('0x16')][_0xa48e('0x23')]='';this[_0xa48e('0x19')](_0x5e6ab2);}}}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x24')]=function(_0x5d8651,_0x27dfc1){if(this[_0xa48e('0xf')][_0x5d8651]){this[_0xa48e('0xf')][_0x5d8651]['Imap'][_0xa48e('0x15')]=_0xa48e('0x25');this[_0xa48e('0xf')][_0x5d8651][_0xa48e('0x16')][_0xa48e('0x23')]=_0x27dfc1['name'];if(_0x27dfc1[_0xa48e('0x26')]){this['mailAccounts'][_0x5d8651][_0xa48e('0x16')][_0xa48e('0x27')]=_0x27dfc1[_0xa48e('0x26')][_0xa48e('0x27')];}return this[_0xa48e('0x19')](_0x5d8651);}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x28')]=function(_0x3e2554,_0x2aafbb){logger[_0xa48e('0xd')](_0xa48e('0x29'),_0x2aafbb['firstName'],_0x2aafbb[_0xa48e('0x2a')],_0x2aafbb['from'],_0x3e2554);if(this['mailAccounts'][_0x3e2554]){return mailAccount[_0xa48e('0x2b')](_0x3e2554,_0x2aafbb)[_0xa48e('0x2c')](function(_0xb845c6){if(_0xb845c6){logger[_0xa48e('0xd')](_0xa48e('0x2d'));}})[_0xa48e('0x2e')](function(_0x3a6e2d){logger['error'](_0xa48e('0x2f'),JSON[_0xa48e('0x18')](_0x3a6e2d));});}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x21')]=function(_0x264c91){if(this[_0xa48e('0xf')][_0x264c91]&&this[_0xa48e('0xf')][_0x264c91][_0xa48e('0x16')]){if(this[_0xa48e('0x10')][this[_0xa48e('0xf')][_0x264c91][_0xa48e('0x16')]['id']]){delete this[_0xa48e('0x10')][this[_0xa48e('0xf')][_0x264c91][_0xa48e('0x16')]['id']];}this[_0xa48e('0xf')][_0x264c91][_0xa48e('0x16')][_0xa48e('0x30')]=moment();this[_0xa48e('0x19')](_0x264c91);}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x31')]=function(_0x4b1a4f,_0x3b3532){if(this[_0xa48e('0xf')][_0x4b1a4f]){this[_0xa48e('0xf')][_0x4b1a4f][_0xa48e('0x16')][_0xa48e('0x15')]=_0xa48e('0x32');this[_0xa48e('0xf')][_0x4b1a4f][_0xa48e('0x16')]['messageStatus']=_0x3b3532;return this['emit'](_0x4b1a4f);}};EmailChannel[_0xa48e('0x12')][_0xa48e('0x33')]=function(_0x412825,_0x1377de){return this['smtp']['send'](_0x412825,_0x1377de);};EmailChannel[_0xa48e('0x12')]['verifySmtp']=function(_0x1a4aee){var _0x39f898=this;if(this[_0xa48e('0xf')][_0x1a4aee['id']]){if(_[_0xa48e('0x17')](this[_0xa48e('0xf')][_0x1a4aee['id']][_0xa48e('0x34')])){this[_0xa48e('0xf')][_0x1a4aee['id']][_0xa48e('0x34')]={};}this[_0xa48e('0xf')][_0x1a4aee['id']][_0xa48e('0x34')]['lastSync']=moment();return new BPromise(function(_0x417a94,_0x479661){return _0x39f898['smtp'][_0xa48e('0x35')](_0x1a4aee)[_0xa48e('0x2c')](function(_0x3a2d93){_0x39f898[_0xa48e('0xf')][_0x1a4aee['id']][_0xa48e('0x34')][_0xa48e('0x15')]=_0xa48e('0x36');_0x39f898['mailAccounts'][_0x1a4aee['id']][_0xa48e('0x34')][_0xa48e('0x23')]='';_0x39f898[_0xa48e('0x19')](_0x1a4aee['id']);_0x417a94(_0x3a2d93);})['catch'](function(_0x543270){_0x39f898[_0xa48e('0xf')][_0x1a4aee['id']]['Smtp'][_0xa48e('0x15')]=_0xa48e('0x32');_0x39f898['mailAccounts'][_0x1a4aee['id']][_0xa48e('0x34')][_0xa48e('0x23')]=_0x543270;_0x39f898[_0xa48e('0x19')](_0x1a4aee['id']);_0x479661(_0x543270);});});}return this[_0xa48e('0x11')][_0xa48e('0x35')](_0x1a4aee);};module[_0xa48e('0x37')]=EmailChannel; \ No newline at end of file +var _0x9cc0=['Mail\x20accepted\x20from\x20routing','sendMail','verifySmtp','Smtp','verified','catch','exports','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','handleImapBox','bind','end','handleImapEnd','error','isNil','disabled','connected','messages','prototype','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then'];(function(_0x6e7808,_0xb1c523){var _0x3ac379=function(_0x14443e){while(--_0x14443e){_0x6e7808['push'](_0x6e7808['shift']());}};_0x3ac379(++_0xb1c523);}(_0x9cc0,0x11a));var _0x09cc=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x9cc0[_0x4b935a];return _0xa298f0;};'use strict';var _=require('lodash');var moment=require(_0x09cc('0x0'));var BPromise=require(_0x09cc('0x1'));var md5=require(_0x09cc('0x2'));var Redis=require('ioredis');var config=require(_0x09cc('0x3'));var logger=require(_0x09cc('0x4'))(_0x09cc('0x5'));config['redis']=_[_0x09cc('0x6')](config[_0x09cc('0x7')],{'host':_0x09cc('0x8'),'port':0x18eb});var io=require(_0x09cc('0x9'))(new Redis(config[_0x09cc('0x7')]));var EmailImap=require(_0x09cc('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x09cc('0xb'));var md5Accounts={};function EmailChannel(_0x4bab32){logger[_0x09cc('0xc')](_0x09cc('0xd'));this[_0x09cc('0xe')]=_0x4bab32['mailAccounts'];this['imapAccounts']={};this[_0x09cc('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x09cc('0x10')]=function(_0x22cf11){var _0x382e17=this[_0x09cc('0xe')][_0x22cf11];var _0xcef0dd={'id':_0x382e17['id'],'name':_0x382e17[_0x09cc('0x11')],'key':_0x382e17[_0x09cc('0x12')],'active':_0x382e17[_0x09cc('0x13')],'Imap':{'status':_0x382e17[_0x09cc('0x14')][_0x09cc('0x15')],'messageStatus':_0x382e17[_0x09cc('0x14')][_0x09cc('0x16')],'total':_0x382e17[_0x09cc('0x14')][_0x09cc('0x17')]}};if(_['isNil'](md5Accounts[_0x22cf11])){md5Accounts[_0x22cf11]={};}var _0x2bafe9=md5(JSON[_0x09cc('0x18')](_0xcef0dd));if(md5Accounts[_0x22cf11]['md5']!==_0x2bafe9){md5Accounts[_0x22cf11]['md5']=_0x2bafe9;io[_0x09cc('0x10')](_0x09cc('0x19'),_0xcef0dd);}};EmailChannel['prototype'][_0x09cc('0x1a')]=function(_0x103994){for(var _0x297037 in _0x103994){if(_0x103994[_0x09cc('0x1b')](_0x297037)){if(_0x103994[_0x297037]['Imap']&&_0x103994[_0x297037][_0x09cc('0x13')]){var _0x28d8b1=_0x103994[_0x297037][_0x09cc('0x14')];if(!_0x28d8b1[_0x09cc('0x1c')]&&_0x103994[_0x297037][_0x09cc('0x1d')]!==_0x09cc('0x1e'))_0x28d8b1[_0x09cc('0x1c')]=_0x103994[_0x297037][_0x09cc('0x1d')];if(!this[_0x09cc('0x1f')]['hasOwnProperty'](_0x28d8b1['id'])){this[_0x09cc('0x1f')][_0x28d8b1['id']]=new EmailImap(_0x28d8b1,_0x103994[_0x297037]['email']);this[_0x09cc('0x1f')][_0x28d8b1['id']]['on']('box',this[_0x09cc('0x20')][_0x09cc('0x21')](this,_0x297037));this[_0x09cc('0x1f')][_0x28d8b1['id']]['on'](_0x09cc('0x5'),this['handleImapEmail']['bind'](this,_0x297037));this[_0x09cc('0x1f')][_0x28d8b1['id']]['on'](_0x09cc('0x22'),this[_0x09cc('0x23')]['bind'](this,_0x297037));this[_0x09cc('0x1f')][_0x28d8b1['id']]['on'](_0x09cc('0x24'),this['handleImapError'][_0x09cc('0x21')](this,_0x297037));}}else{if(_[_0x09cc('0x25')](this[_0x09cc('0xe')][_0x297037][_0x09cc('0x14')])){this[_0x09cc('0xe')][_0x297037][_0x09cc('0x14')]={};}this['mailAccounts'][_0x297037][_0x09cc('0x14')]['status']=_0x09cc('0x26');this[_0x09cc('0xe')][_0x297037][_0x09cc('0x14')][_0x09cc('0x16')]='';this[_0x09cc('0x10')](_0x297037);}}}};EmailChannel['prototype'][_0x09cc('0x20')]=function(_0x491d24,_0x47b99c){if(this[_0x09cc('0xe')][_0x491d24]){this['mailAccounts'][_0x491d24][_0x09cc('0x14')][_0x09cc('0x15')]=_0x09cc('0x27');this[_0x09cc('0xe')][_0x491d24][_0x09cc('0x14')][_0x09cc('0x16')]=_0x47b99c[_0x09cc('0x11')];if(_0x47b99c[_0x09cc('0x28')]){this[_0x09cc('0xe')][_0x491d24][_0x09cc('0x14')]['total']=_0x47b99c[_0x09cc('0x28')]['total'];}return this['emit'](_0x491d24);}};EmailChannel[_0x09cc('0x29')][_0x09cc('0x2a')]=function(_0x3b55eb,_0x32c236){logger['info'](_0x09cc('0x2b'),_0x32c236[_0x09cc('0x2c')],_0x32c236[_0x09cc('0x2d')],_0x32c236['from'],_0x3b55eb);if(this[_0x09cc('0xe')][_0x3b55eb]){return mailAccount[_0x09cc('0x2e')](_0x3b55eb,_0x32c236)[_0x09cc('0x2f')](function(_0x120270){if(_0x120270){logger[_0x09cc('0xc')](_0x09cc('0x30'));}})['catch'](function(_0x1ea0d3){logger[_0x09cc('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x09cc('0x18')](_0x1ea0d3));});}};EmailChannel['prototype'][_0x09cc('0x23')]=function(_0x280ac1){if(this['mailAccounts'][_0x280ac1]&&this[_0x09cc('0xe')][_0x280ac1]['Imap']){if(this[_0x09cc('0x1f')][this[_0x09cc('0xe')][_0x280ac1][_0x09cc('0x14')]['id']]){delete this[_0x09cc('0x1f')][this[_0x09cc('0xe')][_0x280ac1]['Imap']['id']];}this['mailAccounts'][_0x280ac1][_0x09cc('0x14')]['lastSync']=moment();this[_0x09cc('0x10')](_0x280ac1);}};EmailChannel[_0x09cc('0x29')]['handleImapError']=function(_0x3ce9de,_0xa39882){if(this['mailAccounts'][_0x3ce9de]){this[_0x09cc('0xe')][_0x3ce9de][_0x09cc('0x14')][_0x09cc('0x15')]=_0x09cc('0x24');this['mailAccounts'][_0x3ce9de][_0x09cc('0x14')][_0x09cc('0x16')]=_0xa39882;return this[_0x09cc('0x10')](_0x3ce9de);}};EmailChannel[_0x09cc('0x29')][_0x09cc('0x31')]=function(_0x5490fb,_0x3bbdb4){return this['smtp']['send'](_0x5490fb,_0x3bbdb4);};EmailChannel['prototype'][_0x09cc('0x32')]=function(_0x446469){var _0x2c00d1=this;if(this[_0x09cc('0xe')][_0x446469['id']]){if(_['isNil'](this[_0x09cc('0xe')][_0x446469['id']][_0x09cc('0x33')])){this[_0x09cc('0xe')][_0x446469['id']][_0x09cc('0x33')]={};}this[_0x09cc('0xe')][_0x446469['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2d1973,_0x35d1a4){return _0x2c00d1[_0x09cc('0xf')]['verify'](_0x446469)[_0x09cc('0x2f')](function(_0x10e730){_0x2c00d1[_0x09cc('0xe')][_0x446469['id']]['Smtp'][_0x09cc('0x15')]=_0x09cc('0x34');_0x2c00d1[_0x09cc('0xe')][_0x446469['id']][_0x09cc('0x33')][_0x09cc('0x16')]='';_0x2c00d1['emit'](_0x446469['id']);_0x2d1973(_0x10e730);})[_0x09cc('0x35')](function(_0x49d4a0){_0x2c00d1[_0x09cc('0xe')][_0x446469['id']]['Smtp'][_0x09cc('0x15')]=_0x09cc('0x24');_0x2c00d1[_0x09cc('0xe')][_0x446469['id']]['Smtp']['messageStatus']=_0x49d4a0;_0x2c00d1[_0x09cc('0x10')](_0x446469['id']);_0x35d1a4(_0x49d4a0);});});}return this['smtp']['verify'](_0x446469);};module[_0x09cc('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 baf5b98..e873b5d 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 _0x6334=['simpleParser','iconv','Iconv','events','../../../config/logger','email','mailbox','account','getAccount','imap','once','handleReady','bind','end','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','handleError','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleMessageBody','handleMessageEnd','handleMessageAttributes','handleSimpleParser','parser','handleFetchEnd','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6334,0x166));var _0x4633=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x6334[_0x246890];return _0x2b2a5a;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x4633('0x2')];var Iconv=require(_0x4633('0x3'))[_0x4633('0x4')];var EventEmitter=require(_0x4633('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x4633('0x6'))(_0x4633('0x7'));function EmailImap(_0x57ed99,_0xe4b9ba){this[_0x4633('0x8')]=_0x57ed99[_0x4633('0x8')];this[_0x4633('0x9')]=this[_0x4633('0xa')](_0x57ed99,_0xe4b9ba);this[_0x4633('0xb')]=new Imap(this[_0x4633('0x9')]);this[_0x4633('0xb')][_0x4633('0xc')]('ready',this[_0x4633('0xd')][_0x4633('0xe')](this));this[_0x4633('0xb')][_0x4633('0xc')](_0x4633('0xf'),this['handleEnd'][_0x4633('0xe')](this));this[_0x4633('0xb')]['on'](_0x4633('0x10'),this['handleError'][_0x4633('0xe')](this));this[_0x4633('0xb')][_0x4633('0x11')]();}util[_0x4633('0x12')](EmailImap,EventEmitter);EmailImap[_0x4633('0x13')][_0x4633('0xa')]=function(_0xc60057,_0x1f9dfd){var _0xd6b894={'connTimeout':_0xc60057[_0x4633('0x14')]?_0xc60057['connTimeout']*0x3e8:0x2710,'authTimeout':_0xc60057[_0x4633('0x15')]?_0xc60057[_0x4633('0x15')]*0x3e8:0x1388};if(_0xc60057[_0x4633('0x16')]){_0xd6b894['user']=_0xc60057[_0x4633('0x17')];if(_0xc60057[_0x4633('0x18')]){_0xd6b894['xoauth2']=utils[_0x4633('0x19')](_0xc60057[_0x4633('0x1a')][_0x4633('0x1b')],_0xc60057['user']);}else{_0xd6b894[_0x4633('0x1c')]=_0xc60057[_0x4633('0x1c')];}}else{if(_0xc60057[_0x4633('0x1d')]){_0xd6b894[_0x4633('0x17')]=_0xc60057[_0x4633('0x17')];_0xd6b894[_0x4633('0x1c')]=_0xc60057[_0x4633('0x1c')];}}_0xd6b894[_0x4633('0x7')]=_0x1f9dfd||_0xc60057[_0x4633('0x17')]||_0x4633('0x1e');_0xd6b894[_0x4633('0x1f')]=_0xc60057[_0x4633('0x1f')];_0xd6b894[_0x4633('0x20')]=_0xc60057[_0x4633('0x20')]||0x3e1;if(_0xc60057[_0x4633('0x21')]){_0xd6b894[_0x4633('0x21')]=!![];}else{_0xd6b894[_0x4633('0x21')]=![];_0xd6b894[_0x4633('0x22')]=_0x4633('0x23');}return _0xd6b894;};EmailImap[_0x4633('0x13')][_0x4633('0xd')]=function(){this[_0x4633('0xb')]['openBox'](this[_0x4633('0x8')],![],this[_0x4633('0x24')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x2fc7a7,_0x52cd40){if(_0x2fc7a7){this[_0x4633('0x25')](_0x2fc7a7,!![]);}else{this[_0x4633('0x26')](_0x4633('0x27'),_0x52cd40);this['readUnseen']();}};EmailImap[_0x4633('0x13')][_0x4633('0x28')]=function(_0x322583){if(_0x322583){this[_0x4633('0x25')](_0x322583,!![]);}else{this[_0x4633('0xb')][_0x4633('0xf')]();}};EmailImap[_0x4633('0x13')][_0x4633('0x29')]=function(){this[_0x4633('0xb')][_0x4633('0x2a')]([_0x4633('0x2b')],this['handleReadUnseen'][_0x4633('0xe')](this));};EmailImap['prototype'][_0x4633('0x2c')]=function(_0x4a60bd,_0x24fca6){if(_0x4a60bd){this[_0x4633('0x25')](_0x4a60bd,!![]);}else{if(_0x24fca6['length']){try{var _0x36ddd3=this[_0x4633('0xb')][_0x4633('0x2d')](_0x24fca6,{'bodies':'','markSeen':!![]});_0x36ddd3['on'](_0x4633('0x2e'),this['handleFetchMessage'][_0x4633('0xe')](this));_0x36ddd3[_0x4633('0xc')](_0x4633('0x10'),this['handleFetchError'][_0x4633('0xe')](this));_0x36ddd3[_0x4633('0xc')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x266c38){logger[_0x4633('0x10')](_0x266c38);}}else{this[_0x4633('0xb')]['closeBox'](!![],this[_0x4633('0x28')][_0x4633('0xe')](this));}}};EmailImap['prototype'][_0x4633('0x2f')]=function(_0x2dbae2){_0x2dbae2['on']('body',this[_0x4633('0x30')]['bind'](this));_0x2dbae2[_0x4633('0xc')]('attributes',this['handleMessageAttributes'][_0x4633('0xe')](this));_0x2dbae2[_0x4633('0xc')](_0x4633('0xf'),this[_0x4633('0x31')]['bind'](this));};EmailImap['prototype'][_0x4633('0x30')]=function(_0x27c4d9){simpleParser(_0x27c4d9,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x4633('0x32')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x4633('0x13')][_0x4633('0x33')]=function(_0x29acc9,_0x2b42ff){if(_0x29acc9){logger[_0x4633('0x10')](_0x29acc9);}else{var _0x20c50d=this;utils[_0x4633('0x34')](this[_0x4633('0x9')],_0x2b42ff,function(_0x32d404){_0x20c50d[_0x4633('0x26')](_0x4633('0x7'),_0x32d404);});}};EmailImap[_0x4633('0x13')][_0x4633('0x35')]=function(){this['imap']['closeBox'](!![],this['handleCloseBox'][_0x4633('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x37c07e){this[_0x4633('0x25')](_0x37c07e);this['imap'][_0x4633('0x36')](!![],this['handleCloseBox'][_0x4633('0xe')](this));};EmailImap[_0x4633('0x13')][_0x4633('0x37')]=function(){this[_0x4633('0x26')]('end');};EmailImap['prototype'][_0x4633('0x25')]=function(_0x35a643,_0x13a2b0){logger[_0x4633('0x10')]('handleError',this['account']['email'],JSON[_0x4633('0x38')](_0x35a643));var _0x3fce03='';if(_0x35a643){if(_0x35a643[_0x4633('0x39')]){_0x3fce03=_0x35a643['textCode'];}else{for(var _0x23ef1e in _0x35a643){if(_0x35a643[_0x4633('0x3a')](_0x23ef1e)){_0x3fce03+=_[_0x4633('0x3b')](_0x23ef1e)+':\x20'+_0x35a643[_0x23ef1e]+'\x0a';}}}}if(_0x13a2b0){this[_0x4633('0xb')][_0x4633('0xf')]();}else{this[_0x4633('0x26')]('error',_0x3fce03);this[_0x4633('0x26')](_0x4633('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xab24=['getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account'];(function(_0x58f370,_0x2036cf){var _0x47ac1b=function(_0x30a70b){while(--_0x30a70b){_0x58f370['push'](_0x58f370['shift']());}};_0x47ac1b(++_0x2036cf);}(_0xab24,0xfb));var _0x4ab2=function(_0x1f8649,_0x51a43d){_0x1f8649=_0x1f8649-0x0;var _0xc1b6f2=_0xab24[_0x1f8649];return _0xc1b6f2;};'use strict';var _=require(_0x4ab2('0x0'));var util=require('util');var Imap=require(_0x4ab2('0x1'));var simpleParser=require(_0x4ab2('0x2'))[_0x4ab2('0x3')];var Iconv=require(_0x4ab2('0x4'))[_0x4ab2('0x5')];var EventEmitter=require(_0x4ab2('0x6'))[_0x4ab2('0x7')];var utils=require(_0x4ab2('0x8'));var logger=require(_0x4ab2('0x9'))(_0x4ab2('0xa'));function EmailImap(_0x4bfd98,_0x307651){this[_0x4ab2('0xb')]=_0x4bfd98['mailbox'];this[_0x4ab2('0xc')]=this[_0x4ab2('0xd')](_0x4bfd98,_0x307651);this[_0x4ab2('0x1')]=new Imap(this[_0x4ab2('0xc')]);this[_0x4ab2('0x1')][_0x4ab2('0xe')](_0x4ab2('0xf'),this[_0x4ab2('0x10')][_0x4ab2('0x11')](this));this[_0x4ab2('0x1')][_0x4ab2('0xe')](_0x4ab2('0x12'),this[_0x4ab2('0x13')][_0x4ab2('0x11')](this));this[_0x4ab2('0x1')]['on'](_0x4ab2('0x14'),this[_0x4ab2('0x15')][_0x4ab2('0x11')](this));this[_0x4ab2('0x1')][_0x4ab2('0x16')]();}util[_0x4ab2('0x17')](EmailImap,EventEmitter);EmailImap[_0x4ab2('0x18')]['getAccount']=function(_0x7c6a7,_0x37804e){var _0x540bdf={'connTimeout':_0x7c6a7[_0x4ab2('0x19')]?_0x7c6a7['connTimeout']*0x3e8:0x2710,'authTimeout':_0x7c6a7[_0x4ab2('0x1a')]?_0x7c6a7[_0x4ab2('0x1a')]*0x3e8:0x1388};if(_0x7c6a7[_0x4ab2('0x1b')]){_0x540bdf[_0x4ab2('0x1c')]=_0x7c6a7[_0x4ab2('0x1c')];if(_0x7c6a7[_0x4ab2('0x1d')]){_0x540bdf[_0x4ab2('0x1e')]=utils[_0x4ab2('0x1f')](_0x7c6a7[_0x4ab2('0x20')][_0x4ab2('0x21')],_0x7c6a7['user']);}else{_0x540bdf[_0x4ab2('0x22')]=_0x7c6a7['password'];}}else{if(_0x7c6a7['authentication']){_0x540bdf[_0x4ab2('0x1c')]=_0x7c6a7[_0x4ab2('0x1c')];_0x540bdf[_0x4ab2('0x22')]=_0x7c6a7['password'];}}_0x540bdf['email']=_0x37804e||_0x7c6a7[_0x4ab2('0x1c')]||'anonymous@xcally.com';_0x540bdf['host']=_0x7c6a7[_0x4ab2('0x23')];_0x540bdf[_0x4ab2('0x24')]=_0x7c6a7[_0x4ab2('0x24')]||0x3e1;if(_0x7c6a7['tls']){_0x540bdf[_0x4ab2('0x25')]=!![];}else{_0x540bdf[_0x4ab2('0x25')]=![];_0x540bdf[_0x4ab2('0x26')]=_0x4ab2('0x27');}return _0x540bdf;};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x10')]=function(){this[_0x4ab2('0x1')][_0x4ab2('0x28')](this['mailbox'],![],this[_0x4ab2('0x29')]['bind'](this));};EmailImap[_0x4ab2('0x18')]['handleOpenBox']=function(_0x353d8f,_0x430f4f){if(_0x353d8f){this[_0x4ab2('0x15')](_0x353d8f,!![]);}else{this[_0x4ab2('0x2a')](_0x4ab2('0x2b'),_0x430f4f);this['readUnseen']();}};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x2c')]=function(_0x38ebbe){if(_0x38ebbe){this['handleError'](_0x38ebbe,!![]);}else{this[_0x4ab2('0x1')][_0x4ab2('0x12')]();}};EmailImap['prototype'][_0x4ab2('0x2d')]=function(){this[_0x4ab2('0x1')][_0x4ab2('0x2e')]([_0x4ab2('0x2f')],this['handleReadUnseen'][_0x4ab2('0x11')](this));};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x30')]=function(_0x480109,_0x54aabf){if(_0x480109){this[_0x4ab2('0x15')](_0x480109,!![]);}else{if(_0x54aabf[_0x4ab2('0x31')]){try{var _0x3409bd=this[_0x4ab2('0x1')][_0x4ab2('0x32')](_0x54aabf,{'bodies':'','markSeen':!![]});_0x3409bd['on'](_0x4ab2('0x33'),this[_0x4ab2('0x34')][_0x4ab2('0x11')](this));_0x3409bd['once'](_0x4ab2('0x14'),this['handleFetchError'][_0x4ab2('0x11')](this));_0x3409bd[_0x4ab2('0xe')](_0x4ab2('0x12'),this['handleFetchEnd'][_0x4ab2('0x11')](this));}catch(_0x6d3f9a){logger['error'](_0x6d3f9a);}}else{this[_0x4ab2('0x1')][_0x4ab2('0x35')](!![],this[_0x4ab2('0x2c')][_0x4ab2('0x11')](this));}}};EmailImap['prototype'][_0x4ab2('0x34')]=function(_0x34dea7){_0x34dea7['on'](_0x4ab2('0x36'),this[_0x4ab2('0x37')][_0x4ab2('0x11')](this));_0x34dea7[_0x4ab2('0xe')]('attributes',this[_0x4ab2('0x38')][_0x4ab2('0x11')](this));_0x34dea7[_0x4ab2('0xe')](_0x4ab2('0x12'),this[_0x4ab2('0x39')]['bind'](this));};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x37')]=function(_0x516c83){simpleParser(_0x516c83,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x38')]=function(){};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x39')]=function(){};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x3a')]=function(_0x24473b,_0x2a391c){if(_0x24473b){logger[_0x4ab2('0x14')](_0x24473b);}else{var _0x1f0b66=this;utils['parser'](this['account'],_0x2a391c,function(_0xac23ca){_0x1f0b66['emit'](_0x4ab2('0xa'),_0xac23ca);});}};EmailImap['prototype'][_0x4ab2('0x3b')]=function(){this[_0x4ab2('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x4ab2('0x11')](this));};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x3c')]=function(_0x2a4487){this['handleError'](_0x2a4487);this['imap'][_0x4ab2('0x35')](!![],this[_0x4ab2('0x2c')]['bind'](this));};EmailImap[_0x4ab2('0x18')][_0x4ab2('0x13')]=function(){this[_0x4ab2('0x2a')](_0x4ab2('0x12'));};EmailImap[_0x4ab2('0x18')]['handleError']=function(_0x51afc3,_0x3c0e3c){logger[_0x4ab2('0x14')](_0x4ab2('0x15'),this['account'][_0x4ab2('0xa')],JSON[_0x4ab2('0x3d')](_0x51afc3));var _0x1415c7='';if(_0x51afc3){if(_0x51afc3[_0x4ab2('0x3e')]){_0x1415c7=_0x51afc3[_0x4ab2('0x3e')];}else{for(var _0x45bfc0 in _0x51afc3){if(_0x51afc3[_0x4ab2('0x3f')](_0x45bfc0)){_0x1415c7+=_[_0x4ab2('0x40')](_0x45bfc0)+':\x20'+_0x51afc3[_0x45bfc0]+'\x0a';}}}}if(_0x3c0e3c){this['imap'][_0x4ab2('0x12')]();}else{this[_0x4ab2('0x2a')]('error',_0x1415c7);this[_0x4ab2('0x2a')](_0x4ab2('0x12'));}};module[_0x4ab2('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4320463..a987876 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 _0xe9c0=['nodemailer-plugin-inline-base64','prototype','send','createTransport','toString','verify','exports','nodemailer'];(function(_0x37a0ce,_0x28dc04){var _0x569f4e=function(_0x1671c0){while(--_0x1671c0){_0x37a0ce['push'](_0x37a0ce['shift']());}};_0x569f4e(++_0x28dc04);}(_0xe9c0,0x14f));var _0x0e9c=function(_0x142143,_0xea43f0){_0x142143=_0x142143-0x0;var _0xd8f2d2=_0xe9c0[_0x142143];return _0xd8f2d2;};'use strict';var nodemailer=require(_0x0e9c('0x0'));var inlineBase64=require(_0x0e9c('0x1'));function EmailSmtp(){}EmailSmtp[_0x0e9c('0x2')][_0x0e9c('0x3')]=function(_0x4d5cad,_0x143a1d){return new Promise(function(_0x89448d,_0x31b821){var _0x482e97=nodemailer[_0x0e9c('0x4')](_0x4d5cad);_0x482e97['use']('compile',inlineBase64());_0x482e97['sendMail'](_0x143a1d,function(_0x29406a,_0x203ba7){if(_0x29406a){_0x31b821(_0x29406a[_0x0e9c('0x5')]());}else{_0x89448d(_0x203ba7);}});});};EmailSmtp['prototype'][_0x0e9c('0x6')]=function(_0x3131ad){return new Promise(function(_0x3eaf3a,_0x469108){var _0x14a22a=nodemailer[_0x0e9c('0x4')](_0x3131ad);_0x14a22a[_0x0e9c('0x6')](function(_0x6802b4,_0xcee14a){if(_0x6802b4){_0x469108(_0x6802b4[_0x0e9c('0x5')]());}else{if(_0xcee14a){_0x3eaf3a(_0xcee14a);}else{_0x469108('Not\x20verifired');}}});});};module[_0x0e9c('0x7')]=EmailSmtp; \ No newline at end of file +var _0x75d0=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail','verify','toString'];(function(_0x3626fe,_0x33dbfd){var _0x23e475=function(_0x343dd9){while(--_0x343dd9){_0x3626fe['push'](_0x3626fe['shift']());}};_0x23e475(++_0x33dbfd);}(_0x75d0,0xa3));var _0x075d=function(_0x3ba422,_0x53303c){_0x3ba422=_0x3ba422-0x0;var _0x20b5dd=_0x75d0[_0x3ba422];return _0x20b5dd;};'use strict';var nodemailer=require(_0x075d('0x0'));var inlineBase64=require(_0x075d('0x1'));function EmailSmtp(){}EmailSmtp[_0x075d('0x2')]['send']=function(_0x5c00f6,_0x37422f){return new Promise(function(_0x4f60cf,_0x514294){var _0x3f3b2c=nodemailer[_0x075d('0x3')](_0x5c00f6);_0x3f3b2c[_0x075d('0x4')]('compile',inlineBase64());_0x3f3b2c[_0x075d('0x5')](_0x37422f,function(_0x19b237,_0x18da08){if(_0x19b237){_0x514294(_0x19b237['toString']());}else{_0x4f60cf(_0x18da08);}});});};EmailSmtp['prototype'][_0x075d('0x6')]=function(_0x53559a){return new Promise(function(_0x5e9904,_0x1ae14e){var _0x1a8c09=nodemailer[_0x075d('0x3')](_0x53559a);_0x1a8c09[_0x075d('0x6')](function(_0x151a75,_0x59f460){if(_0x151a75){_0x1ae14e(_0x151a75[_0x075d('0x7')]());}else{if(_0x59f460){_0x5e9904(_0x59f460);}else{_0x1ae14e('Not\x20verifired');}}});});};module[_0x075d('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 f0dcaad..4a8b9db 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 _0x7fae=['head','value','address','generate','@xcally.com','name','split','length','join','Anonymous','pop','anonymous','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','originTo','originCc','isEmpty','message','bcc','attachments','attach','type','attachment','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','auth=Bearer\x20','toString','base64','lodash','moment','path','util','email','../../../config/environment'];(function(_0x440a3d,_0x42ee86){var _0x193e56=function(_0x5af685){while(--_0x5af685){_0x440a3d['push'](_0x440a3d['shift']());}};_0x193e56(++_0x42ee86);}(_0x7fae,0x16c));var _0xe7fa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7fae[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe7fa('0x0'));var moment=require(_0xe7fa('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xe7fa('0x2'));var util=require(_0xe7fa('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xe7fa('0x4'));var config=require(_0xe7fa('0x5'));function getAddress(_0x11cc4c){var _0x255259=_[_0xe7fa('0x6')](_0x11cc4c[_0xe7fa('0x7')]);return _0x255259&&_0x255259[_0xe7fa('0x8')]?_0x255259[_0xe7fa('0x8')]:'anonymous'+random[_0xe7fa('0x9')](0x6)+_0xe7fa('0xa');}function getFirstName(_0x51b086){var _0x4d7bb1=_['head'](_0x51b086[_0xe7fa('0x7')]);if(_0x4d7bb1&&_0x4d7bb1['name']){if(_0x4d7bb1[_0xe7fa('0xb')]==_0x4d7bb1[_0xe7fa('0x8')]){return _0x4d7bb1[_0xe7fa('0xb')]['substring'](0x0,_0x4d7bb1[_0xe7fa('0xb')]['indexOf']('@'));}var _0x1ec8c0=_0x4d7bb1[_0xe7fa('0xb')][_0xe7fa('0xc')](/\s+/);return _0x1ec8c0[_0xe7fa('0xd')]>0x1?_0x1ec8c0['slice'](0x0,-0x1)[_0xe7fa('0xe')]('\x20'):_0x4d7bb1[_0xe7fa('0xb')];}return _0xe7fa('0xf');}function getLastName(_0x4a7e77){var _0x38dc8f=_[_0xe7fa('0x6')](_0x4a7e77[_0xe7fa('0x7')]);if(_0x38dc8f&&_0x38dc8f['name']){var _0x10e81=_0x38dc8f[_0xe7fa('0xb')][_0xe7fa('0xc')](/\s+/);return _0x10e81['length']>0x1?_0x10e81[_0xe7fa('0x10')]():'';}return'';}function getMails(_0x3be2eb,_0x71c1ad){var _0x2eab21='';for(var _0x531618=0x0;_0x531618<_0x71c1ad[_0xe7fa('0x7')][_0xe7fa('0xd')];_0x531618+=0x1){if(_0x71c1ad[_0xe7fa('0x7')][_0x531618]['address']!==_0x3be2eb){if(!_['isEmpty'](_0x2eab21)){_0x2eab21+=',';}_0x2eab21+=_0x71c1ad[_0xe7fa('0x7')][_0x531618][_0xe7fa('0xb')]||_0x71c1ad[_0xe7fa('0x7')][_0x531618][_0xe7fa('0x8')]||'';_0x2eab21+='\x20<';_0x2eab21+=_0x71c1ad[_0xe7fa('0x7')][_0x531618][_0xe7fa('0x8')]?_0x71c1ad[_0xe7fa('0x7')][_0x531618][_0xe7fa('0x8')]:_0xe7fa('0x11')+random['generate'](0x6)+_0xe7fa('0xa');_0x2eab21+='>';}}return _0x2eab21;}function parseEmail(_0x50a9b5,_0x316c2d,_0x227a78){if(_0x316c2d[_0xe7fa('0x12')]){var _0x507069=/)<[^<]*)*<\/script>/gi;while(_0x507069[_0xe7fa('0x13')](_0x316c2d[_0xe7fa('0x12')])){_0x316c2d[_0xe7fa('0x12')]=_0x316c2d[_0xe7fa('0x12')][_0xe7fa('0x14')](_0x507069,'');}if(_0x316c2d[_0xe7fa('0x12')][_0xe7fa('0x15')](_0xe7fa('0x16'))){var _0x258b2e=[];_0x316c2d['attachments'][_0xe7fa('0x17')](_0x244f23=>{_0x258b2e[_0xe7fa('0x18')](_0x244f23[_0xe7fa('0x19')]);});var _0x33e94d=/]+>/g;var _0x3d47ff=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5ae35e=_0x316c2d[_0xe7fa('0x12')][_0xe7fa('0x14')](_0x3d47ff,_0xe7fa('0x1a'));var _0x3f4480=_0x5ae35e[_0xe7fa('0x14')](_0x33e94d,_0xe7fa('0x1b'));for(let _0x3a0c6b=0x0;_0x3a0c6b<_0x258b2e[_0xe7fa('0xd')];_0x3a0c6b++){var _0x5e8a17=_0x3f4480[_0xe7fa('0x14')]('_IMG',_0xe7fa('0x1c')+_0x258b2e[_0x3a0c6b]+'\x20]');_0x3f4480=_0x5e8a17;}_0x316c2d[_0xe7fa('0x12')]=_0x3f4480;}_0x227a78[_0xe7fa('0x1d')]=_0x316c2d[_0xe7fa('0x12')];}else{_0x227a78['body']=_0x316c2d[_0xe7fa('0x1e')];}if(_0x227a78[_0xe7fa('0x1d')]){_0x227a78[_0xe7fa('0x1d')]=_0x227a78[_0xe7fa('0x1d')]['replace'](/0x0){var _0x1c084f=[_0xe7fa('0x31'),_0xe7fa('0x32'),_0xe7fa('0x33')];for(var _0x35dc90=0x0;_0x35dc90<_0x316c2d[_0xe7fa('0x30')]['length'];_0x35dc90++){var _0x39ea9e=_[_0xe7fa('0x34')](_0x1c084f,_0x316c2d[_0xe7fa('0x30')][_0x35dc90][_0xe7fa('0x35')]);if(_0x39ea9e>=0x0){_0x227a78[_0xe7fa('0x36')]=!![];}}}return _0x227a78;}exports[_0xe7fa('0x37')]=function(_0x3d84ef,_0x2f4b2b,_0x21e296){var _0x1706ee={'from':getAddress(_0x2f4b2b[_0xe7fa('0x38')]),'firstName':getFirstName(_0x2f4b2b[_0xe7fa('0x38')]),'lastName':getLastName(_0x2f4b2b[_0xe7fa('0x38')]),'mapKey':_0xe7fa('0x4'),'message':{'from':getMails(_0x3d84ef[_0xe7fa('0x4')],_0x2f4b2b[_0xe7fa('0x38')]),'to':_0x3d84ef[_0xe7fa('0x4')],'cc':'','subject':_0x2f4b2b[_0xe7fa('0x39')]||'','messageId':_0x2f4b2b[_0xe7fa('0x3a')],'inReplyTo':_0x2f4b2b[_0xe7fa('0x3b')],'sentAt':moment(_0x2f4b2b[_0xe7fa('0x3c')])['format'](_0xe7fa('0x3d')),'attach':![],'attachments':[]}};if(!_0x2f4b2b[_0xe7fa('0x12')]&&!_0x2f4b2b[_0xe7fa('0x1e')]){var _0xbc9ca6=_[_0xe7fa('0x3e')](_0x2f4b2b[_0xe7fa('0x24')],{'contentType':_0xe7fa('0x3f')});if(_0xbc9ca6[_0xe7fa('0xd')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x2f4b2b[_0xe7fa('0x3a')]));tnef[_0xe7fa('0x40')](_[_0xe7fa('0x41')](_0xbc9ca6)[_0xe7fa('0x2e')],function(_0x36f93d,_0x8bb4df){if(_0x8bb4df){_0x2f4b2b[_0xe7fa('0x12')]=_0x8bb4df[_0xe7fa('0x42')]||_0xe7fa('0x43');if(_0x8bb4df[_0xe7fa('0x44')]){for(var _0x59097c=0x0;_0x59097c<_0x8bb4df[_0xe7fa('0x44')]['length'];_0x59097c++){var _0xd05b7c=_0x8bb4df[_0xe7fa('0x44')][_0x59097c];_0x1706ee[_0xe7fa('0x22')]['attachments'][_0xe7fa('0x18')]({'filename':_0xd05b7c[_0xe7fa('0x45')],'content':Buffer[_0xe7fa('0x38')](_0xd05b7c[_0xe7fa('0x46')])});}}}_0x21e296(parseEmail(_0x3d84ef,_0x2f4b2b,_0x1706ee));});}else{_0x2f4b2b[_0xe7fa('0x12')]=_0xe7fa('0x43');_0x21e296(parseEmail(_0x3d84ef,_0x2f4b2b,_0x1706ee));}}else{_0x21e296(parseEmail(_0x3d84ef,_0x2f4b2b,_0x1706ee));}};exports['generateXOAuth2Token']=function(_0x3ac825,_0x131faf){var _0x58b259=['user='+(_0x131faf||''),_0xe7fa('0x47')+_0x3ac825,'',''];return Buffer[_0xe7fa('0x38')](_0x58b259['join'](''),'utf-8')[_0xe7fa('0x48')](_0xe7fa('0x49'));}; \ No newline at end of file +var _0x3360=['user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','node-tnef','../../../config/logger','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','join','Anonymous','split','pop','isEmpty','test','html','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','email','originCc','originTo','bcc','attach','type','attachment','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','from','subject','inReplyTo','format','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','first','content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token'];(function(_0x377d8c,_0x281053){var _0x47aa7e=function(_0x4c1b75){while(--_0x4c1b75){_0x377d8c['push'](_0x377d8c['shift']());}};_0x47aa7e(++_0x281053);}(_0x3360,0x1b4));var _0x0336=function(_0x3ce7aa,_0x555b9c){_0x3ce7aa=_0x3ce7aa-0x0;var _0x1fd595=_0x3360[_0x3ce7aa];return _0x1fd595;};'use strict';var _=require(_0x0336('0x0'));var moment=require(_0x0336('0x1'));var random=require(_0x0336('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x0336('0x3'));var logger=require(_0x0336('0x4'))('email');var config=require('../../../config/environment');function getAddress(_0x3bf46a){var _0x50a834=_[_0x0336('0x5')](_0x3bf46a[_0x0336('0x6')]);return _0x50a834&&_0x50a834[_0x0336('0x7')]?_0x50a834['address']:_0x0336('0x8')+random[_0x0336('0x9')](0x6)+_0x0336('0xa');}function getFirstName(_0x1ae9e9){var _0x4b45cc=_[_0x0336('0x5')](_0x1ae9e9['value']);if(_0x4b45cc&&_0x4b45cc[_0x0336('0xb')]){if(_0x4b45cc[_0x0336('0xb')]==_0x4b45cc[_0x0336('0x7')]){return _0x4b45cc['name'][_0x0336('0xc')](0x0,_0x4b45cc['name'][_0x0336('0xd')]('@'));}var _0x2a7e43=_0x4b45cc[_0x0336('0xb')]['split'](/\s+/);return _0x2a7e43[_0x0336('0xe')]>0x1?_0x2a7e43['slice'](0x0,-0x1)[_0x0336('0xf')]('\x20'):_0x4b45cc[_0x0336('0xb')];}return _0x0336('0x10');}function getLastName(_0x40f6b1){var _0x7299d7=_[_0x0336('0x5')](_0x40f6b1[_0x0336('0x6')]);if(_0x7299d7&&_0x7299d7['name']){var _0x128048=_0x7299d7[_0x0336('0xb')][_0x0336('0x11')](/\s+/);return _0x128048[_0x0336('0xe')]>0x1?_0x128048[_0x0336('0x12')]():'';}return'';}function getMails(_0x5ef34b,_0x47185e){var _0x2ec976='';for(var _0x4db625=0x0;_0x4db625<_0x47185e[_0x0336('0x6')][_0x0336('0xe')];_0x4db625+=0x1){if(_0x47185e[_0x0336('0x6')][_0x4db625]['address']!==_0x5ef34b){if(!_[_0x0336('0x13')](_0x2ec976)){_0x2ec976+=',';}_0x2ec976+=_0x47185e[_0x0336('0x6')][_0x4db625]['name']||_0x47185e[_0x0336('0x6')][_0x4db625][_0x0336('0x7')]||'';_0x2ec976+='\x20<';_0x2ec976+=_0x47185e['value'][_0x4db625][_0x0336('0x7')]?_0x47185e[_0x0336('0x6')][_0x4db625][_0x0336('0x7')]:_0x0336('0x8')+random['generate'](0x6)+_0x0336('0xa');_0x2ec976+='>';}}return _0x2ec976;}function parseEmail(_0x326dd2,_0x4a128f,_0x586727){if(_0x4a128f['html']){var _0x438fca=/)<[^<]*)*<\/script>/gi;while(_0x438fca[_0x0336('0x14')](_0x4a128f[_0x0336('0x15')])){_0x4a128f[_0x0336('0x15')]=_0x4a128f['html'][_0x0336('0x16')](_0x438fca,'');}if(_0x4a128f[_0x0336('0x15')][_0x0336('0x17')]('{_0x5e1c5a[_0x0336('0x1a')](_0x5cdb01[_0x0336('0x1b')]);});var _0x1be44b=/]+>/g;var _0x3f81b5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1c1d65=_0x4a128f[_0x0336('0x15')][_0x0336('0x16')](_0x3f81b5,_0x0336('0x1c'));var _0x3322e8=_0x1c1d65['replace'](_0x1be44b,'_IMG');for(let _0x121422=0x0;_0x121422<_0x5e1c5a[_0x0336('0xe')];_0x121422++){var _0x5f497d=_0x3322e8[_0x0336('0x16')](_0x0336('0x1d'),_0x0336('0x1e')+_0x5e1c5a[_0x121422]+_0x0336('0x1f'));_0x3322e8=_0x5f497d;}_0x4a128f[_0x0336('0x15')]=_0x3322e8;}_0x586727[_0x0336('0x20')]=_0x4a128f[_0x0336('0x15')];}else{_0x586727[_0x0336('0x20')]=_0x4a128f[_0x0336('0x21')];}if(_0x586727['body']){_0x586727[_0x0336('0x20')]=_0x586727[_0x0336('0x20')][_0x0336('0x16')](/0x0){var _0x490db9=[_0x0336('0x32'),'X-Auto-Response-Suppress:\x20All',_0x0336('0x33')];for(var _0x5a2a49=0x0;_0x5a2a49<_0x4a128f[_0x0336('0x31')][_0x0336('0xe')];_0x5a2a49++){var _0x2b695a=_[_0x0336('0xd')](_0x490db9,_0x4a128f[_0x0336('0x31')][_0x5a2a49][_0x0336('0x34')]);if(_0x2b695a>=0x0){_0x586727['isAutoreply']=!![];}}}return _0x586727;}exports['parser']=function(_0x4a7fc0,_0x2ecb16,_0x7f240e){var _0x26327a={'from':getAddress(_0x2ecb16[_0x0336('0x35')]),'firstName':getFirstName(_0x2ecb16[_0x0336('0x35')]),'lastName':getLastName(_0x2ecb16[_0x0336('0x35')]),'mapKey':'email','message':{'from':getMails(_0x4a7fc0[_0x0336('0x23')],_0x2ecb16[_0x0336('0x35')]),'to':_0x4a7fc0['email'],'cc':'','subject':_0x2ecb16[_0x0336('0x36')]||'','messageId':_0x2ecb16['messageId'],'inReplyTo':_0x2ecb16[_0x0336('0x37')],'sentAt':moment(_0x2ecb16['date'])[_0x0336('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2ecb16[_0x0336('0x15')]&&!_0x2ecb16['textAsHtml']){var _0x382823=_[_0x0336('0x39')](_0x2ecb16[_0x0336('0x18')],{'contentType':'application/ms-tnef'});if(_0x382823[_0x0336('0xe')]){logger[_0x0336('0x3a')](util[_0x0336('0x38')](_0x0336('0x3b'),_0x2ecb16[_0x0336('0x3c')]));tnef['parseBuffer'](_[_0x0336('0x3d')](_0x382823)[_0x0336('0x3e')],function(_0x4f1c10,_0x47ac1b){if(_0x47ac1b){_0x2ecb16[_0x0336('0x15')]=_0x47ac1b['BodyHTML']||_0x0336('0x3f');if(_0x47ac1b[_0x0336('0x40')]){for(var _0x5725d5=0x0;_0x5725d5<_0x47ac1b[_0x0336('0x40')][_0x0336('0xe')];_0x5725d5++){var _0x3d8564=_0x47ac1b[_0x0336('0x40')][_0x5725d5];_0x26327a[_0x0336('0x22')]['attachments'][_0x0336('0x1a')]({'filename':_0x3d8564[_0x0336('0x41')],'content':Buffer[_0x0336('0x35')](_0x3d8564[_0x0336('0x42')])});}}}_0x7f240e(parseEmail(_0x4a7fc0,_0x2ecb16,_0x26327a));});}else{_0x2ecb16[_0x0336('0x15')]=_0x0336('0x3f');_0x7f240e(parseEmail(_0x4a7fc0,_0x2ecb16,_0x26327a));}}else{_0x7f240e(parseEmail(_0x4a7fc0,_0x2ecb16,_0x26327a));}};exports[_0x0336('0x43')]=function(_0x2f0d31,_0x503d98){var _0x1e9a9e=[_0x0336('0x44')+(_0x503d98||''),_0x0336('0x45')+_0x2f0d31,'',''];return Buffer[_0x0336('0x35')](_0x1e9a9e[_0x0336('0xf')](''),_0x0336('0x46'))[_0x0336('0x47')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8284663..3e508b2 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 _0xe87e=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3701e9,_0x36ec85){var _0x453374=function(_0x4e525e){while(--_0x4e525e){_0x3701e9['push'](_0x3701e9['shift']());}};_0x453374(++_0x36ec85);}(_0xe87e,0x1be));var _0xee87=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe87e[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xee87('0x0'));function MailAccount(_0x52c685){this['id']=_0x52c685['id']||0x0;this[_0xee87('0x1')]=_0x52c685[_0xee87('0x1')]||_0xee87('0x2');this[_0xee87('0x3')]=_0x52c685[_0xee87('0x3')]||_0xee87('0x4');this[_0xee87('0x5')]=_0x52c685['active']||![];this['Imap']=_0x52c685[_0xee87('0x6')]||[];this[_0xee87('0x7')]=_0x52c685[_0xee87('0x7')]||[];}module[_0xee87('0x8')]=MailAccount; \ No newline at end of file +var _0xf9df=['Service','key','active','Smtp','exports','lodash','name'];(function(_0x5d4646,_0x5e3733){var _0x5023a5=function(_0x55eb5c){while(--_0x55eb5c){_0x5d4646['push'](_0x5d4646['shift']());}};_0x5023a5(++_0x5e3733);}(_0xf9df,0xde));var _0xff9d=function(_0x24c564,_0x49afff){_0x24c564=_0x24c564-0x0;var _0x3a5538=_0xf9df[_0x24c564];return _0x3a5538;};'use strict';var _=require(_0xff9d('0x0'));function MailAccount(_0x5dd067){this['id']=_0x5dd067['id']||0x0;this[_0xff9d('0x1')]=_0x5dd067[_0xff9d('0x1')]||_0xff9d('0x2');this[_0xff9d('0x3')]=_0x5dd067[_0xff9d('0x3')]||'SERV';this[_0xff9d('0x4')]=_0x5dd067[_0xff9d('0x4')]||![];this['Imap']=_0x5dd067['Imap']||[];this[_0xff9d('0x5')]=_0x5dd067['Smtp']||[];}module[_0xff9d('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index a70bd9d..c370c5c 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 _0x7cc4=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts'];(function(_0xd88ab6,_0x2340a7){var _0x522db5=function(_0x22c8e2){while(--_0x22c8e2){_0xd88ab6['push'](_0xd88ab6['shift']());}};_0x522db5(++_0x2340a7);}(_0x7cc4,0x179));var _0x47cc=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7cc4[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x47cc('0x0'));var MailAccount=require(_0x47cc('0x1'));var Realtime=function(){this[_0x47cc('0x2')]={};};function freeIsNotKey(_0x69a57c,_0x58cfae,_0x38bbca){var _0x4d8d0b=_[_0x47cc('0x3')](_0x69a57c,function(_0x26c11a,_0x3e0f12){return _0x26c11a[_0x38bbca];});for(var _0x2485d8 in _0x58cfae){if(_0x58cfae[_0x47cc('0x4')](_0x2485d8)){if(!_0x4d8d0b[_0x2485d8]){delete _0x58cfae[_0x2485d8];}}}}Realtime[_0x47cc('0x5')][_0x47cc('0x6')]=function(_0x1e7342,_0x55494e){for(var _0x3d5657 in _0x55494e){if(_0x1e7342[_0x47cc('0x4')](_0x3d5657)){_0x1e7342[_0x3d5657]=_0x55494e[_0x3d5657];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x350815=this;return function(_0x15ce63){if(_0x15ce63){freeIsNotKey(_0x15ce63,_0x350815[_0x47cc('0x2')],'id');for(var _0x1aa5ed=0x0,_0x33021f={},_0x4310a5={};_0x1aa5ed<_0x15ce63[_0x47cc('0x7')];_0x1aa5ed+=0x1){_0x33021f=_0x15ce63[_0x1aa5ed];if(_[_0x47cc('0x8')](_0x350815['mailAccounts'][_0x33021f['id']])){_0x350815[_0x47cc('0x2')][_0x33021f['id']]=new MailAccount(_0x33021f);}else{_[_0x47cc('0x9')](_0x350815[_0x47cc('0x2')][_0x33021f['id']],_0x33021f);}}}return _0x350815[_0x47cc('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x8296=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','merge','exports'];(function(_0x3cdc02,_0x11bedc){var _0x288a0b=function(_0x39b525){while(--_0x39b525){_0x3cdc02['push'](_0x3cdc02['shift']());}};_0x288a0b(++_0x11bedc);}(_0x8296,0xb0));var _0x6829=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x8296[_0x492af5];return _0x59f529;};'use strict';var _=require(_0x6829('0x0'));var MailAccount=require(_0x6829('0x1'));var Realtime=function(){this[_0x6829('0x2')]={};};function freeIsNotKey(_0x38382a,_0x5b0d9e,_0x135c9c){var _0x4e622b=_[_0x6829('0x3')](_0x38382a,function(_0x14ab10,_0x20dd86){return _0x14ab10[_0x135c9c];});for(var _0x3fd680 in _0x5b0d9e){if(_0x5b0d9e[_0x6829('0x4')](_0x3fd680)){if(!_0x4e622b[_0x3fd680]){delete _0x5b0d9e[_0x3fd680];}}}}Realtime[_0x6829('0x5')][_0x6829('0x6')]=function(_0x40bce7,_0x2f8cbf){for(var _0x5296e7 in _0x2f8cbf){if(_0x40bce7[_0x6829('0x4')](_0x5296e7)){_0x40bce7[_0x5296e7]=_0x2f8cbf[_0x5296e7];}}};Realtime[_0x6829('0x5')]['initMailAccounts']=function(){var _0x52afa5=this;return function(_0x3f96ad){if(_0x3f96ad){freeIsNotKey(_0x3f96ad,_0x52afa5[_0x6829('0x2')],'id');for(var _0x1b6279=0x0,_0x296793={},_0x29a47d={};_0x1b6279<_0x3f96ad[_0x6829('0x7')];_0x1b6279+=0x1){_0x296793=_0x3f96ad[_0x1b6279];if(_[_0x6829('0x8')](_0x52afa5[_0x6829('0x2')][_0x296793['id']])){_0x52afa5[_0x6829('0x2')][_0x296793['id']]=new MailAccount(_0x296793);}else{_[_0x6829('0x9')](_0x52afa5['mailAccounts'][_0x296793['id']],_0x296793);}}}return _0x52afa5['mailAccounts'];};};module[_0x6829('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0fee986..725fe24 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 _0xda91=['type','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0xe04093,_0x521e39){var _0x42b222=function(_0x28e5b6){while(--_0x28e5b6){_0xe04093['push'](_0xe04093['shift']());}};_0x42b222(++_0x521e39);}(_0xda91,0x72));var _0x1da9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xda91[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0x1da9('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x1da9('0x1')](_0x1da9('0x2'),{'options':{'attributes':['id',_0x1da9('0x3'),_0x1da9('0x4'),'service','email',_0x1da9('0x5'),_0x1da9('0x6'),_0x1da9('0x7'),_0x1da9('0x8')],'raw':![],'include':[{'model':_0x1da9('0x9'),'as':_0x1da9('0xa'),'include':[{'model':_0x1da9('0xb'),'attributes':['id','name','service',_0x1da9('0xc'),'data5'],'as':_0x1da9('0xb')}]},{'model':_0x1da9('0xd'),'as':'Smtp','include':[{'model':_0x1da9('0xb'),'attributes':['id','name','service',_0x1da9('0xc'),_0x1da9('0xe')],'as':_0x1da9('0xb')}]}]},'log':_0x1da9('0xf')});};};exports[_0x1da9('0x10')]=function(_0xb682c9,_0x4ac870){return client[_0x1da9('0x1')](_0x1da9('0x11'),{'account':{'id':_0xb682c9},'body':_0x4ac870,'log':_0x1da9('0x11')});}; \ No newline at end of file +var _0xef17=['MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','MailServerIn','CloudProvider','type','data5'];(function(_0x1d803f,_0x2a97cb){var _0x453370=function(_0x4aa807){while(--_0x4aa807){_0x1d803f['push'](_0x1d803f['shift']());}};_0x453370(++_0x2a97cb);}(_0xef17,0x136));var _0x7ef1=function(_0x5ded2f,_0x11a973){_0x5ded2f=_0x5ded2f-0x0;var _0x466a81=_0xef17[_0x5ded2f];return _0x466a81;};'use strict';var client=require(_0x7ef1('0x0'));exports[_0x7ef1('0x1')]=function(){return function(){return client[_0x7ef1('0x2')](_0x7ef1('0x3'),{'options':{'attributes':['id',_0x7ef1('0x4'),_0x7ef1('0x5'),_0x7ef1('0x6'),_0x7ef1('0x7'),_0x7ef1('0x8'),'key',_0x7ef1('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0x7ef1('0xa'),'as':'Imap','include':[{'model':_0x7ef1('0xb'),'attributes':['id','name','service',_0x7ef1('0xc'),_0x7ef1('0xd')],'as':'CloudProvider'}]},{'model':_0x7ef1('0xe'),'as':_0x7ef1('0xf'),'include':[{'model':_0x7ef1('0xb'),'attributes':['id',_0x7ef1('0x4'),_0x7ef1('0x6'),_0x7ef1('0xc'),_0x7ef1('0xd')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x7ef1('0x10')]=function(_0x4dc653,_0x5ab4a4){return client['Request'](_0x7ef1('0x11'),{'account':{'id':_0x4dc653},'body':_0x5ab4a4,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 4534d3d..16a0fc3 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 _0x2b04=['loginMailFrequency','../client','getSettings'];(function(_0x425ec8,_0x293ff){var _0x1cbf90=function(_0x1a1974){while(--_0x1a1974){_0x425ec8['push'](_0x425ec8['shift']());}};_0x1cbf90(++_0x293ff);}(_0x2b04,0x1f3));var _0x42b0=function(_0x17fccf,_0x3fe891){_0x17fccf=_0x17fccf-0x0;var _0x44ccdd=_0x2b04[_0x17fccf];return _0x44ccdd;};'use strict';var client=require(_0x42b0('0x0'));exports[_0x42b0('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x42b0('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xf85a=['loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x2f31ec,_0x48562d){var _0xc6bd57=function(_0x6d5d5b){while(--_0x6d5d5b){_0x2f31ec['push'](_0x2f31ec['shift']());}};_0xc6bd57(++_0x48562d);}(_0xf85a,0x11a));var _0xaf85=function(_0x22dc25,_0x24b880){_0x22dc25=_0x22dc25-0x0;var _0x5210d9=_0xf85a[_0x22dc25];return _0x5210d9;};'use strict';var client=require(_0xaf85('0x0'));exports[_0xaf85('0x1')]=function(){return client[_0xaf85('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaf85('0x3')]},'log':_0xaf85('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index cfc3e78..e218f27 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 7eb1d4c..a31fa66 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 _0x83d1=['localhost','adapter','socket.io-redis','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults'];(function(_0x26ee8c,_0x1ebe6c){var _0x2a09bc=function(_0x21ed9a){while(--_0x21ed9a){_0x26ee8c['push'](_0x26ee8c['shift']());}};_0x2a09bc(++_0x1ebe6c);}(_0x83d1,0x169));var _0x183d=function(_0x200155,_0x2de523){_0x200155=_0x200155-0x0;var _0x1a3275=_0x83d1[_0x200155];return _0x1a3275;};'use strict';var _=require(_0x183d('0x0'));var http=require('http');var express=require(_0x183d('0x1'));var sticky=require(_0x183d('0x2'));var Redis=require(_0x183d('0x3'));var config=require(_0x183d('0x4'));var app=express();var server=http[_0x183d('0x5')](app);server[_0x183d('0x6')]=0xdbba0;if(sticky[_0x183d('0x7')](server,config[_0x183d('0x8')])){var socketio=require(_0x183d('0x9'))(server,{'transports':[_0x183d('0xa'),_0x183d('0xb')]});config[_0x183d('0xc')]=_[_0x183d('0xd')](config[_0x183d('0xc')],{'host':_0x183d('0xe'),'port':0x18eb});socketio[_0x183d('0xf')](require(_0x183d('0x10'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x183d('0xc')])}));require('../../config/triggers')[_0x183d('0x11')]();require('../../config/socketio')['default'](socketio);require(_0x183d('0x12'))[_0x183d('0x11')](app);require(_0x183d('0x13'))['default'](app);}else{server[_0x183d('0x14')](_0x183d('0x15'),function(){console[_0x183d('0x16')](_0x183d('0x17'),config[_0x183d('0x8')]);});}exports=module[_0x183d('0x18')]=app; \ No newline at end of file +var _0x4a5b=['express','sticky-session','ioredis','createServer','timeout','listen','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http'];(function(_0x3dbacf,_0x3dc84b){var _0x7357b5=function(_0x4af5f6){while(--_0x4af5f6){_0x3dbacf['push'](_0x3dbacf['shift']());}};_0x7357b5(++_0x3dc84b);}(_0x4a5b,0x136));var _0xb4a5=function(_0x523279,_0x1e08a9){_0x523279=_0x523279-0x0;var _0x47c3cf=_0x4a5b[_0x523279];return _0x47c3cf;};'use strict';var _=require(_0xb4a5('0x0'));var http=require(_0xb4a5('0x1'));var express=require(_0xb4a5('0x2'));var sticky=require(_0xb4a5('0x3'));var Redis=require(_0xb4a5('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0xb4a5('0x5')](app);server[_0xb4a5('0x6')]=0xdbba0;if(sticky[_0xb4a5('0x7')](server,config['port'])){var socketio=require(_0xb4a5('0x8'))(server,{'transports':[_0xb4a5('0x9'),_0xb4a5('0xa')]});config[_0xb4a5('0xb')]=_['defaults'](config['redis'],{'host':_0xb4a5('0xc'),'port':0x18eb});socketio[_0xb4a5('0xd')](require(_0xb4a5('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb4a5('0xb')])}));require(_0xb4a5('0xf'))[_0xb4a5('0x10')]();require(_0xb4a5('0x11'))[_0xb4a5('0x10')](socketio);require(_0xb4a5('0x12'))[_0xb4a5('0x10')](app);require(_0xb4a5('0x13'))[_0xb4a5('0x10')](app);}else{server[_0xb4a5('0x14')]('listening',function(){console[_0xb4a5('0x15')](_0xb4a5('0x16'),config[_0xb4a5('0x17')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index bbcf606..b98c1f4 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 _0x7ba1=['result','routing','client','http','Request','then','debug','error','rpc'];(function(_0xfc444f,_0x5281c7){var _0x126d39=function(_0x271ea5){while(--_0x271ea5){_0xfc444f['push'](_0xfc444f['shift']());}};_0x126d39(++_0x5281c7);}(_0x7ba1,0x133));var _0x17ba=function(_0x1bfef6,_0x501c96){_0x1bfef6=_0x1bfef6-0x0;var _0x1da100=_0x7ba1[_0x1bfef6];return _0x1da100;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x17ba('0x0'));var client=jayson[_0x17ba('0x1')][_0x17ba('0x2')]({'port':0x2329});client[_0x17ba('0x3')]=function(_0x10ac9a,_0x89d6b4){return new BPromise(function(_0x11b669,_0x3bbcc3){return client['request'](_0x10ac9a,_0x89d6b4)[_0x17ba('0x4')](function(_0x381d2a){logger[_0x17ba('0x5')]('rpc',_0x17ba('0x0'),_0x10ac9a,_0x89d6b4,_0x381d2a);if(_0x381d2a[_0x17ba('0x6')]){logger['error'](_0x17ba('0x7'),_0x17ba('0x0'),_0x10ac9a,_0x381d2a[_0x17ba('0x6')]['message'],_0x89d6b4);return _0x3bbcc3(_0x381d2a[_0x17ba('0x6')]['message']);}else{return _0x11b669(_0x381d2a[_0x17ba('0x8')]);}})['catch'](function(_0x34b92d){logger['error']('rpc',_0x17ba('0x0'),_0x10ac9a,_0x34b92d,_0x89d6b4);return _0x3bbcc3(_0x34b92d);});});};module['exports']=client; \ No newline at end of file +var _0x2adc=['http','Request','then','debug','rpc','routing','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x4c5a4d,_0x327619){var _0x3c2c96=function(_0x4b9713){while(--_0x4b9713){_0x4c5a4d['push'](_0x4c5a4d['shift']());}};_0x3c2c96(++_0x327619);}(_0x2adc,0x1c5));var _0xc2ad=function(_0x486c7e,_0x59f97b){_0x486c7e=_0x486c7e-0x0;var _0x32c2ca=_0x2adc[_0x486c7e];return _0x32c2ca;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc2ad('0x0'));var logger=require(_0xc2ad('0x1'))('routing');var client=jayson['client'][_0xc2ad('0x2')]({'port':0x2329});client[_0xc2ad('0x3')]=function(_0x4d26bb,_0x15bf94){return new BPromise(function(_0xa5148c,_0x293f5b){return client['request'](_0x4d26bb,_0x15bf94)[_0xc2ad('0x4')](function(_0x351ec8){logger[_0xc2ad('0x5')](_0xc2ad('0x6'),_0xc2ad('0x7'),_0x4d26bb,_0x15bf94,_0x351ec8);if(_0x351ec8[_0xc2ad('0x8')]){logger[_0xc2ad('0x8')](_0xc2ad('0x6'),_0xc2ad('0x7'),_0x4d26bb,_0x351ec8[_0xc2ad('0x8')]['message'],_0x15bf94);return _0x293f5b(_0x351ec8[_0xc2ad('0x8')][_0xc2ad('0x9')]);}else{return _0xa5148c(_0x351ec8[_0xc2ad('0xa')]);}})[_0xc2ad('0xb')](function(_0x5d12b9){logger[_0xc2ad('0x8')]('rpc',_0xc2ad('0x7'),_0x4d26bb,_0x5d12b9,_0x15bf94);return _0x293f5b(_0x5d12b9);});});};module[_0xc2ad('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9f1c3bc..888576f 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 _0xf3c7=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues'];(function(_0xc635d4,_0x4d4425){var _0x185f62=function(_0x1f325a){while(--_0x1f325a){_0xc635d4['push'](_0xc635d4['shift']());}};_0x185f62(++_0x4d4425);}(_0xf3c7,0xdd));var _0x7f3c=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xf3c7[_0x343e44];return _0xa5130e;};'use strict';var BPromise=require(_0x7f3c('0x0'));var server=require(_0x7f3c('0x1'));var Realtime=require(_0x7f3c('0x2'));var user=require(_0x7f3c('0x3'));var interval=require(_0x7f3c('0x4'));var openchannelQueue=require(_0x7f3c('0x5'));var chatQueue=require(_0x7f3c('0x6'));var smsQueue=require(_0x7f3c('0x7'));var mailQueue=require(_0x7f3c('0x8'));var faxQueue=require(_0x7f3c('0x9'));var whatsappQueue=require(_0x7f3c('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7f3c('0xb')]()[_0x7f3c('0xc')](user[_0x7f3c('0xd')]())['then'](realtime[_0x7f3c('0xe')]())['then'](interval[_0x7f3c('0xf')]())[_0x7f3c('0xc')](realtime['initIntervals']())['then'](openchannelQueue[_0x7f3c('0x10')]())['then'](realtime[_0x7f3c('0x11')]())['then'](chatQueue[_0x7f3c('0x12')]())[_0x7f3c('0xc')](realtime[_0x7f3c('0x13')]())[_0x7f3c('0xc')](smsQueue['getSmsQueues']())['then'](realtime[_0x7f3c('0x14')]())[_0x7f3c('0xc')](mailQueue[_0x7f3c('0x15')]())[_0x7f3c('0xc')](realtime['initMailQueues']())[_0x7f3c('0xc')](faxQueue['getFaxQueues']())[_0x7f3c('0xc')](realtime[_0x7f3c('0x16')]())[_0x7f3c('0xc')](whatsappQueue[_0x7f3c('0x17')]())[_0x7f3c('0xc')](realtime[_0x7f3c('0x18')]())[_0x7f3c('0xc')](function(){return realtime;});}function main(){return server[_0x7f3c('0x19')](realtime)['then'](function(_0x2357b8){return initRealtime();})['then'](function(_0xca7608){return setInterval(initRealtime,0x1388);})['catch'](function(_0x1b2fed){console[_0x7f3c('0x1a')](_0x1b2fed);});}main(); \ No newline at end of file +var _0x1703=['initOpenchannelQueues','initChatQueues','getSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals'];(function(_0xac28d3,_0x56b0cb){var _0x5b9b46=function(_0x3ac0cd){while(--_0x3ac0cd){_0xac28d3['push'](_0xac28d3['shift']());}};_0x5b9b46(++_0x56b0cb);}(_0x1703,0x1aa));var _0x3170=function(_0x49a88a,_0x253b4a){_0x49a88a=_0x49a88a-0x0;var _0x48fb55=_0x1703[_0x49a88a];return _0x48fb55;};'use strict';var BPromise=require(_0x3170('0x0'));var server=require(_0x3170('0x1'));var Realtime=require(_0x3170('0x2'));var user=require(_0x3170('0x3'));var interval=require(_0x3170('0x4'));var openchannelQueue=require(_0x3170('0x5'));var chatQueue=require(_0x3170('0x6'));var smsQueue=require(_0x3170('0x7'));var mailQueue=require(_0x3170('0x8'));var faxQueue=require(_0x3170('0x9'));var whatsappQueue=require(_0x3170('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3170('0xb')]()[_0x3170('0xc')](user['getAgents']())[_0x3170('0xc')](realtime[_0x3170('0xd')]())[_0x3170('0xc')](interval[_0x3170('0xe')]())['then'](realtime[_0x3170('0xf')]())[_0x3170('0xc')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x3170('0x10')]())[_0x3170('0xc')](chatQueue['getChatQueues']())[_0x3170('0xc')](realtime[_0x3170('0x11')]())[_0x3170('0xc')](smsQueue[_0x3170('0x12')]())[_0x3170('0xc')](realtime['initSmsQueues']())[_0x3170('0xc')](mailQueue['getMailQueues']())['then'](realtime[_0x3170('0x13')]())['then'](faxQueue['getFaxQueues']())[_0x3170('0xc')](realtime[_0x3170('0x14')]())[_0x3170('0xc')](whatsappQueue[_0x3170('0x15')]())[_0x3170('0xc')](realtime[_0x3170('0x16')]())[_0x3170('0xc')](function(){return realtime;});}function main(){return server[_0x3170('0x17')](realtime)['then'](function(_0x23e551){return initRealtime();})[_0x3170('0xc')](function(_0x43cbfc){return setInterval(initRealtime,0x1388);})[_0x3170('0x18')](function(_0x1c8be7){console[_0x3170('0x19')](_0x1c8be7);});}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 bdb8e3c..9231848 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(_0x3be844,_0x4c9441){var _0xbdab6e=function(_0x28a6af){while(--_0x28a6af){_0x3be844['push'](_0x3be844['shift']());}};_0xbdab6e(++_0x4c9441);}(_0x7a54,0x106));var _0x47a5=function(_0x4c1d57,_0x24b0fe){_0x4c1d57=_0x4c1d57-0x0;var _0x2e1ece=_0x7a54[_0x4c1d57];return _0x2e1ece;};'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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x585645,_0x45bd3b){var _0x4448ed=function(_0x194a33){while(--_0x194a33){_0x585645['push'](_0x585645['shift']());}};_0x4448ed(++_0x45bd3b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e15ee48..6ad5f1a 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 _0xa592=['result','catch','sendMailMessage','SendMail','bluebird','client','http','then','error','message'];(function(_0x478e2f,_0xcc2041){var _0x4b088d=function(_0x1d262b){while(--_0x1d262b){_0x478e2f['push'](_0x478e2f['shift']());}};_0x4b088d(++_0xcc2041);}(_0xa592,0x130));var _0x2a59=function(_0x4578bb,_0x2ab638){_0x4578bb=_0x4578bb-0x0;var _0x1a714f=_0xa592[_0x4578bb];return _0x1a714f;};'use strict';var BPromise=require(_0x2a59('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x2a59('0x1')][_0x2a59('0x2')]({'port':0x232b});function request(_0xac45f7,_0x174496){return new BPromise(function(_0x6b78d9,_0x59f815){return client['request'](_0xac45f7,_0x174496)[_0x2a59('0x3')](function(_0x2d6e19){if(_0x2d6e19[_0x2a59('0x4')]){return _0x59f815(_0x2d6e19[_0x2a59('0x4')][_0x2a59('0x5')]);}else{return _0x6b78d9(_0x2d6e19[_0x2a59('0x6')]);}})[_0x2a59('0x7')](function(_0x2bc67d){return _0x59f815(_0x2bc67d);});});}exports[_0x2a59('0x8')]=function(_0x30bfac,_0xd29d0){return request(_0x2a59('0x9'),{'account':_0x30bfac,'message':_0xd29d0});}; \ No newline at end of file +var _0x7ac2=['jayson/promise','client','http','error','message','result','catch','SendMail','bluebird'];(function(_0x2922c,_0x31eb7c){var _0xfef5a0=function(_0x568d00){while(--_0x568d00){_0x2922c['push'](_0x2922c['shift']());}};_0xfef5a0(++_0x31eb7c);}(_0x7ac2,0x167));var _0x27ac=function(_0x5ca2a4,_0x1a8527){_0x5ca2a4=_0x5ca2a4-0x0;var _0x4e9b9d=_0x7ac2[_0x5ca2a4];return _0x4e9b9d;};'use strict';var BPromise=require(_0x27ac('0x0'));var jayson=require(_0x27ac('0x1'));var client=jayson[_0x27ac('0x2')][_0x27ac('0x3')]({'port':0x232b});function request(_0x4f01dd,_0x434498){return new BPromise(function(_0x44a49f,_0x3c73c4){return client['request'](_0x4f01dd,_0x434498)['then'](function(_0x3620da){if(_0x3620da[_0x27ac('0x4')]){return _0x3c73c4(_0x3620da[_0x27ac('0x4')][_0x27ac('0x5')]);}else{return _0x44a49f(_0x3620da[_0x27ac('0x6')]);}})[_0x27ac('0x7')](function(_0x2d5989){return _0x3c73c4(_0x2d5989);});});}exports['sendMailMessage']=function(_0xff504b,_0x5473af){return request(_0x27ac('0x8'),{'account':_0xff504b,'message':_0x5473af});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b0be70c..e177a58 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 _0x32b6=['format','faxPause','mailStatusTime','faxStatus','busy','chatWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime'];(function(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x32b6,0x1d1));var _0x632b=function(_0x12227a,_0x268c22){_0x12227a=_0x12227a-0x0;var _0x1a3ba7=_0x32b6[_0x12227a];return _0x1a3ba7;};'use strict';var _=require(_0x632b('0x0'));var md5=require(_0x632b('0x1'));var moment=require('moment');var Redis=require(_0x632b('0x2'));var config=require(_0x632b('0x3'));config['redis']=_['defaults'](config[_0x632b('0x4')],{'host':_0x632b('0x5'),'port':0x18eb});var io=require(_0x632b('0x6'))(new Redis(config[_0x632b('0x4')]));function Agent(_0x1adfe6){this['id']=_0x1adfe6['id']||0x0;this[_0x632b('0x7')]=_0x1adfe6[_0x632b('0x7')]||'';this[_0x632b('0x8')]=_0x1adfe6[_0x632b('0x8')]||!![];this[_0x632b('0x9')]=_0x1adfe6['voicePause']||![];this[_0x632b('0xa')]=_0x1adfe6[_0x632b('0xa')]||![];this[_0x632b('0xb')]=_0x1adfe6[_0x632b('0xb')]||![];this['faxPause']=_0x1adfe6['faxPause']||![];this['smsPause']=_0x1adfe6[_0x632b('0xc')]||![];this['openchannelPause']=_0x1adfe6[_0x632b('0xd')]||![];this[_0x632b('0xe')]=_0x632b('0xf');this[_0x632b('0x10')]=0x0;this[_0x632b('0x11')]=_0x1adfe6[_0x632b('0x11')]||0x0;this[_0x632b('0x12')]=0x0;this[_0x632b('0x13')]=_0x632b('0xf');this['mailStatusTime']=0x0;this[_0x632b('0x14')]=_0x1adfe6[_0x632b('0x14')]||0x0;this[_0x632b('0x15')]=0x0;this['faxStatus']=_0x632b('0xf');this[_0x632b('0x16')]=0x0;this[_0x632b('0x17')]=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=0x0;this[_0x632b('0x19')]='unknown';this[_0x632b('0x1a')]=0x0;this['smsCapacity']=_0x1adfe6['smsCapacity']||0x0;this[_0x632b('0x1b')]=0x0;this['whatsappStatus']=_0x632b('0xf');this[_0x632b('0x1c')]=0x0;this[_0x632b('0x1d')]=_0x1adfe6['whatsappCapacity']||0x0;this[_0x632b('0x1e')]=0x0;this[_0x632b('0x1f')]=_0x632b('0xf');this[_0x632b('0x20')]=0x0;this['openchannelCapacity']=_0x1adfe6[_0x632b('0x21')]||0x0;this[_0x632b('0x22')]=0x0;this['busy']=![];this[_0x632b('0x23')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x632b('0x24')]={};this['mailWaitingInteractions']={};this[_0x632b('0x25')]={};this[_0x632b('0x26')]={};this[_0x632b('0x27')]={};this['updateRealtime']();}Agent[_0x632b('0x28')][_0x632b('0x29')]=function(_0x59d83a){if(this[_0x59d83a+_0x632b('0x2a')]>0x0){if(this[_0x59d83a+_0x632b('0x2b')]>0x0&&this[_0x59d83a+_0x632b('0x2a')]>=this[_0x59d83a+_0x632b('0x2b')]){return _0x632b('0x2c');}else{return _0x632b('0x2d');}}else{return'idle';}};Agent['prototype'][_0x632b('0x2e')]=function(){var _0x4d3a70=[_0x632b('0x2f'),_0x632b('0x30'),'openchannel',_0x632b('0x31'),_0x632b('0x32'),_0x632b('0x33')];for(var _0x18dc8c=0x0;_0x18dc8c<_0x4d3a70[_0x632b('0x34')];_0x18dc8c+=0x1){var _0x515d74=this[_0x632b('0x29')](_0x4d3a70[_0x18dc8c]);if(this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]!==_0x515d74){this[_0x4d3a70[_0x18dc8c]+_0x632b('0x36')]=_['toNumber'](moment()[_0x632b('0x37')]('x'));}this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]=_0x515d74;}var _0x1819fa={'id':this['id'],'name':this[_0x632b('0x7')],'online':this[_0x632b('0x8')],'voicePause':this[_0x632b('0x9')],'chatPause':this[_0x632b('0xa')],'mailPause':this[_0x632b('0xb')],'smsPause':this[_0x632b('0xc')],'faxPause':this[_0x632b('0x38')],'openchannelPause':this[_0x632b('0xd')],'chatStatus':this[_0x632b('0xe')],'chatStatusTime':this[_0x632b('0x10')],'chatCapacity':this[_0x632b('0x11')],'chatCurrentCapacity':this[_0x632b('0x12')],'mailStatus':this[_0x632b('0x13')],'mailStatusTime':this[_0x632b('0x39')],'mailCapacity':this[_0x632b('0x14')],'mailCurrentCapacity':this[_0x632b('0x15')],'faxStatus':this[_0x632b('0x3a')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x632b('0x17')],'faxCurrentCapacity':this[_0x632b('0x18')],'smsStatus':this[_0x632b('0x19')],'smsStatusTime':this[_0x632b('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x632b('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x632b('0x1c')],'whatsappCapacity':this[_0x632b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x632b('0x1f')],'openchannelStatusTime':this[_0x632b('0x20')],'openchannelCapacity':this[_0x632b('0x21')],'openchannelCurrentCapacity':this[_0x632b('0x22')],'busy':this[_0x632b('0x3b')],'busyQueue':this[_0x632b('0x23')],'chatWaitingInteractions':this[_0x632b('0x3c')],'faxWaitingInteractions':this[_0x632b('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x632b('0x26')],'whatsappWaitingInteractions':this[_0x632b('0x27')]};var _0x52872a=md5(JSON[_0x632b('0x3d')](_0x1819fa));if(this[_0x632b('0x1')]!==_0x52872a){this[_0x632b('0x1')]=_0x52872a;io[_0x632b('0x3e')](_0x632b('0x3f'),_['omit'](_0x1819fa,['online']));}};module[_0x632b('0x40')]=Agent; \ No newline at end of file +var _0x4e2e=['mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','chat','openchannel','fax','whatsapp','length','StatusTime','toNumber','Status','mailStatusTime','emit','user:routing:update','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x5c99b9,_0x427787){var _0x2c94eb=function(_0x17c674){while(--_0x17c674){_0x5c99b9['push'](_0x5c99b9['shift']());}};_0x2c94eb(++_0x427787);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x5b6b56,_0x47dc2b){_0x5b6b56=_0x5b6b56-0x0;var _0x2949df=_0x4e2e[_0x5b6b56];return _0x2949df;};'use strict';var _=require('lodash');var md5=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var Redis=require(_0xe4e2('0x2'));var config=require(_0xe4e2('0x3'));config[_0xe4e2('0x4')]=_[_0xe4e2('0x5')](config['redis'],{'host':_0xe4e2('0x6'),'port':0x18eb});var io=require(_0xe4e2('0x7'))(new Redis(config[_0xe4e2('0x4')]));function Agent(_0x38c84c){this['id']=_0x38c84c['id']||0x0;this['name']=_0x38c84c[_0xe4e2('0x8')]||'';this[_0xe4e2('0x9')]=_0x38c84c[_0xe4e2('0x9')]||!![];this[_0xe4e2('0xa')]=_0x38c84c[_0xe4e2('0xa')]||![];this[_0xe4e2('0xb')]=_0x38c84c[_0xe4e2('0xb')]||![];this[_0xe4e2('0xc')]=_0x38c84c['mailPause']||![];this[_0xe4e2('0xd')]=_0x38c84c[_0xe4e2('0xd')]||![];this[_0xe4e2('0xe')]=_0x38c84c['smsPause']||![];this[_0xe4e2('0xf')]=_0x38c84c[_0xe4e2('0xf')]||![];this[_0xe4e2('0x10')]=_0xe4e2('0x11');this[_0xe4e2('0x12')]=0x0;this['chatCapacity']=_0x38c84c[_0xe4e2('0x13')]||0x0;this[_0xe4e2('0x14')]=0x0;this[_0xe4e2('0x15')]=_0xe4e2('0x11');this['mailStatusTime']=0x0;this[_0xe4e2('0x16')]=_0x38c84c[_0xe4e2('0x16')]||0x0;this[_0xe4e2('0x17')]=0x0;this[_0xe4e2('0x18')]=_0xe4e2('0x11');this['faxStatusTime']=0x0;this['faxCapacity']=_0x38c84c[_0xe4e2('0x19')]||0x0;this[_0xe4e2('0x1a')]=0x0;this[_0xe4e2('0x1b')]=_0xe4e2('0x11');this[_0xe4e2('0x1c')]=0x0;this['smsCapacity']=_0x38c84c[_0xe4e2('0x1d')]||0x0;this[_0xe4e2('0x1e')]=0x0;this[_0xe4e2('0x1f')]='unknown';this[_0xe4e2('0x20')]=0x0;this['whatsappCapacity']=_0x38c84c[_0xe4e2('0x21')]||0x0;this[_0xe4e2('0x22')]=0x0;this[_0xe4e2('0x23')]=_0xe4e2('0x11');this[_0xe4e2('0x24')]=0x0;this[_0xe4e2('0x25')]=_0x38c84c[_0xe4e2('0x25')]||0x0;this[_0xe4e2('0x26')]=0x0;this[_0xe4e2('0x27')]=![];this[_0xe4e2('0x28')]=undefined;this['md5']='';this[_0xe4e2('0x29')]={};this[_0xe4e2('0x2a')]={};this[_0xe4e2('0x2b')]={};this[_0xe4e2('0x2c')]={};this[_0xe4e2('0x2d')]={};this[_0xe4e2('0x2e')]={};this[_0xe4e2('0x2f')]();}Agent['prototype'][_0xe4e2('0x30')]=function(_0x2ab435){if(this[_0x2ab435+_0xe4e2('0x31')]>0x0){if(this[_0x2ab435+'Capacity']>0x0&&this[_0x2ab435+_0xe4e2('0x31')]>=this[_0x2ab435+_0xe4e2('0x32')]){return'maxcapacity';}else{return _0xe4e2('0x33');}}else{return _0xe4e2('0x34');}};Agent[_0xe4e2('0x35')][_0xe4e2('0x2f')]=function(){var _0x249b7e=['mail',_0xe4e2('0x36'),_0xe4e2('0x37'),_0xe4e2('0x38'),'sms',_0xe4e2('0x39')];for(var _0x41cfd9=0x0;_0x41cfd9<_0x249b7e[_0xe4e2('0x3a')];_0x41cfd9+=0x1){var _0x5ec692=this[_0xe4e2('0x30')](_0x249b7e[_0x41cfd9]);if(this[_0x249b7e[_0x41cfd9]+'Status']!==_0x5ec692){this[_0x249b7e[_0x41cfd9]+_0xe4e2('0x3b')]=_[_0xe4e2('0x3c')](moment()['format']('x'));}this[_0x249b7e[_0x41cfd9]+_0xe4e2('0x3d')]=_0x5ec692;}var _0x18e2e5={'id':this['id'],'name':this[_0xe4e2('0x8')],'online':this[_0xe4e2('0x9')],'voicePause':this[_0xe4e2('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xe4e2('0xe')],'faxPause':this[_0xe4e2('0xd')],'openchannelPause':this[_0xe4e2('0xf')],'chatStatus':this[_0xe4e2('0x10')],'chatStatusTime':this[_0xe4e2('0x12')],'chatCapacity':this[_0xe4e2('0x13')],'chatCurrentCapacity':this[_0xe4e2('0x14')],'mailStatus':this[_0xe4e2('0x15')],'mailStatusTime':this[_0xe4e2('0x3e')],'mailCapacity':this[_0xe4e2('0x16')],'mailCurrentCapacity':this[_0xe4e2('0x17')],'faxStatus':this[_0xe4e2('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xe4e2('0x19')],'faxCurrentCapacity':this[_0xe4e2('0x1a')],'smsStatus':this[_0xe4e2('0x1b')],'smsStatusTime':this[_0xe4e2('0x1c')],'smsCapacity':this[_0xe4e2('0x1d')],'smsCurrentCapacity':this[_0xe4e2('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xe4e2('0x20')],'whatsappCapacity':this[_0xe4e2('0x21')],'whatsappCurrentCapacity':this[_0xe4e2('0x22')],'openchannelStatus':this[_0xe4e2('0x23')],'openchannelStatusTime':this[_0xe4e2('0x24')],'openchannelCapacity':this[_0xe4e2('0x25')],'openchannelCurrentCapacity':this[_0xe4e2('0x26')],'busy':this[_0xe4e2('0x27')],'busyQueue':this[_0xe4e2('0x28')],'chatWaitingInteractions':this[_0xe4e2('0x29')],'faxWaitingInteractions':this[_0xe4e2('0x2a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xe4e2('0x2c')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xe4e2('0x2e')]};var _0x2cd933=md5(JSON['stringify'](_0x18e2e5));if(this[_0xe4e2('0x0')]!==_0x2cd933){this[_0xe4e2('0x0')]=_0x2cd933;io[_0xe4e2('0x3f')](_0xe4e2('0x40'),_['omit'](_0x18e2e5,[_0xe4e2('0x9')]));}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2b4ae38..51abb16 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 _0x064e=['available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','loggedIn','chatPause'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x064e,0xf7));var _0xe064=function(_0x56cfde,_0x3e18d6){_0x56cfde=_0x56cfde-0x0;var _0x8120f4=_0x064e[_0x56cfde];return _0x8120f4;};'use strict';var _=require(_0xe064('0x0'));var md5=require(_0xe064('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe064('0x2'));config[_0xe064('0x3')]=_[_0xe064('0x4')](config['redis'],{'host':_0xe064('0x5'),'port':0x18eb});var io=require(_0xe064('0x6'))(new Redis(config[_0xe064('0x3')]));function ChatQueue(_0x54cf07){this['id']=_0x54cf07['id']||0x0;this[_0xe064('0x7')]=_0x54cf07['name']||'';this[_0xe064('0x8')]=_0x54cf07[_0xe064('0x8')]||0xa;this[_0xe064('0x9')]=_0x54cf07[_0xe064('0x9')]||'beepall';this[_0xe064('0xa')]=_0x54cf07[_0xe064('0xa')];this[_0xe064('0xb')]={};this[_0xe064('0xc')]=0x0;this['md5']='';this[_0xe064('0xd')]();this[_0xe064('0xe')]();}ChatQueue['prototype'][_0xe064('0xd')]=function(){var _0x425255=this[_0xe064('0xb')][_0xe064('0xf')];this['mapAgentsId']=_[_0xe064('0x10')](this[_0xe064('0xa')],'id');this[_0xe064('0xb')][_0xe064('0xf')]=_0x425255;};ChatQueue[_0xe064('0x11')][_0xe064('0xe')]=function(){this['loggedIn']=0x0;this[_0xe064('0x12')]=0x0;for(var _0x37e48a=0x0;_0x37e48a=0x0?this['available']:0x0;var _0x21f334={'id':this['id'],'available':this[_0xe064('0x17')],'loggedIn':this[_0xe064('0x15')],'name':this[_0xe064('0x7')],'paused':this[_0xe064('0x12')],'waiting':this[_0xe064('0xc')]};var _0x403a42=md5(JSON[_0xe064('0x18')](_0x21f334));if(this[_0xe064('0x1')]!==_0x403a42){this[_0xe064('0x1')]=_0x403a42;io['to'](util[_0xe064('0x19')](_0xe064('0x1a'),_0x21f334[_0xe064('0x7')]))[_0xe064('0x1b')](_0xe064('0x1c'),_0x21f334);}};module[_0xe064('0x1d')]=ChatQueue; \ No newline at end of file +var _0x1282=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','chat_queue:save','md5','ioredis'];(function(_0x45e5f2,_0xc803d0){var _0x333b0a=function(_0xa16e8a){while(--_0xa16e8a){_0x45e5f2['push'](_0x45e5f2['shift']());}};_0x333b0a(++_0xc803d0);}(_0x1282,0x1e4));var _0x2128=function(_0x3c7070,_0x16ead7){_0x3c7070=_0x3c7070-0x0;var _0xdc237a=_0x1282[_0x3c7070];return _0xdc237a;};'use strict';var _=require('lodash');var md5=require(_0x2128('0x0'));var util=require('util');var Redis=require(_0x2128('0x1'));var config=require('../../../config/environment');config[_0x2128('0x2')]=_[_0x2128('0x3')](config[_0x2128('0x2')],{'host':_0x2128('0x4'),'port':0x18eb});var io=require(_0x2128('0x5'))(new Redis(config[_0x2128('0x2')]));function ChatQueue(_0x259c01){this['id']=_0x259c01['id']||0x0;this[_0x2128('0x6')]=_0x259c01[_0x2128('0x6')]||'';this[_0x2128('0x7')]=_0x259c01[_0x2128('0x7')]||0xa;this[_0x2128('0x8')]=_0x259c01[_0x2128('0x8')]||_0x2128('0x9');this[_0x2128('0xa')]=_0x259c01[_0x2128('0xa')];this['mapAgentsId']={};this[_0x2128('0xb')]=0x0;this['md5']='';this[_0x2128('0xc')]();this[_0x2128('0xd')]();}ChatQueue['prototype'][_0x2128('0xc')]=function(){var _0x2c1492=this['mapAgentsId']['_rr'];this[_0x2128('0xe')]=_[_0x2128('0xf')](this['Agents'],'id');this[_0x2128('0xe')][_0x2128('0x10')]=_0x2c1492;};ChatQueue['prototype'][_0x2128('0xd')]=function(){this[_0x2128('0x11')]=0x0;this[_0x2128('0x12')]=0x0;for(var _0x2882c1=0x0;_0x2882c1=0x0?this[_0x2128('0x16')]:0x0;var _0x4e90be={'id':this['id'],'available':this[_0x2128('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x2128('0x6')],'paused':this[_0x2128('0x12')],'waiting':this['waiting']};var _0x3ea049=md5(JSON[_0x2128('0x17')](_0x4e90be));if(this['md5']!==_0x3ea049){this['md5']=_0x3ea049;io['to'](util[_0x2128('0x18')]('chat:queue:%s',_0x4e90be[_0x2128('0x6')]))[_0x2128('0x19')](_0x2128('0x1a'),_0x4e90be);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 82317c7..c6ccef6 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 _0xcf4d=['online','loggedIn','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','_rr','map','prototype','length'];(function(_0x5326e2,_0x27b2ef){var _0x1e85bb=function(_0x59b8f8){while(--_0x59b8f8){_0x5326e2['push'](_0x5326e2['shift']());}};_0x1e85bb(++_0x27b2ef);}(_0xcf4d,0x191));var _0xdcf4=function(_0x3c3366,_0x572dd7){_0x3c3366=_0x3c3366-0x0;var _0x46ffff=_0xcf4d[_0x3c3366];return _0x46ffff;};'use strict';var _=require(_0xdcf4('0x0'));var md5=require('md5');var util=require(_0xdcf4('0x1'));var Redis=require('ioredis');var config=require(_0xdcf4('0x2'));config[_0xdcf4('0x3')]=_['defaults'](config[_0xdcf4('0x3')],{'host':_0xdcf4('0x4'),'port':0x18eb});var io=require(_0xdcf4('0x5'))(new Redis(config[_0xdcf4('0x3')]));function FaxQueue(_0x569fc3){this['id']=_0x569fc3['id']||0x0;this[_0xdcf4('0x6')]=_0x569fc3['name']||'';this[_0xdcf4('0x7')]=_0x569fc3['timeout']||0xa;this[_0xdcf4('0x8')]=_0x569fc3[_0xdcf4('0x8')]||_0xdcf4('0x9');this[_0xdcf4('0xa')]=_0x569fc3[_0xdcf4('0xa')];this[_0xdcf4('0xb')]={};this['waiting']=0x0;this[_0xdcf4('0xc')]='';this[_0xdcf4('0xd')]();this[_0xdcf4('0xe')]();}FaxQueue['prototype'][_0xdcf4('0xd')]=function(){var _0x5192b1=this['mapAgentsId'][_0xdcf4('0xf')];this['mapAgentsId']=_[_0xdcf4('0x10')](this[_0xdcf4('0xa')],'id');this[_0xdcf4('0xb')][_0xdcf4('0xf')]=_0x5192b1;};FaxQueue[_0xdcf4('0x11')][_0xdcf4('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xabbc7d=0x0;_0xabbc7d=0x0?this[_0xdcf4('0x17')]:0x0;var _0x516f17={'id':this['id'],'available':this[_0xdcf4('0x17')],'loggedIn':this[_0xdcf4('0x14')],'name':this[_0xdcf4('0x6')],'paused':this[_0xdcf4('0x16')],'waiting':this[_0xdcf4('0x18')]};var _0x6ce12=md5(JSON[_0xdcf4('0x19')](_0x516f17));if(this[_0xdcf4('0xc')]!==_0x6ce12){this[_0xdcf4('0xc')]=_0x6ce12;io['to'](util[_0xdcf4('0x1a')](_0xdcf4('0x1b'),_0x516f17[_0xdcf4('0x6')]))[_0xdcf4('0x1c')](_0xdcf4('0x1d'),_0x516f17);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x7900=['paused','length','online','faxPause','available','waiting','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','prototype','updateRouting','_rr','map','updateRealtime','loggedIn'];(function(_0x51ec85,_0x46832c){var _0x59f6e8=function(_0x1deccd){while(--_0x1deccd){_0x51ec85['push'](_0x51ec85['shift']());}};_0x59f6e8(++_0x46832c);}(_0x7900,0xb8));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0790('0x0'));var md5=require(_0x0790('0x1'));var util=require(_0x0790('0x2'));var Redis=require(_0x0790('0x3'));var config=require(_0x0790('0x4'));config[_0x0790('0x5')]=_[_0x0790('0x6')](config[_0x0790('0x5')],{'host':_0x0790('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0790('0x5')]));function FaxQueue(_0x3748e2){this['id']=_0x3748e2['id']||0x0;this[_0x0790('0x8')]=_0x3748e2[_0x0790('0x8')]||'';this[_0x0790('0x9')]=_0x3748e2[_0x0790('0x9')]||0xa;this[_0x0790('0xa')]=_0x3748e2[_0x0790('0xa')]||'beepall';this[_0x0790('0xb')]=_0x3748e2['Agents'];this[_0x0790('0xc')]={};this['waiting']=0x0;this[_0x0790('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x0790('0xd')][_0x0790('0xe')]=function(){var _0x3d539f=this[_0x0790('0xc')][_0x0790('0xf')];this[_0x0790('0xc')]=_[_0x0790('0x10')](this[_0x0790('0xb')],'id');this['mapAgentsId'][_0x0790('0xf')]=_0x3d539f;};FaxQueue[_0x0790('0xd')][_0x0790('0x11')]=function(){this[_0x0790('0x12')]=0x0;this[_0x0790('0x13')]=0x0;for(var _0x1fca79=0x0;_0x1fca79=0x0?this['available']:0x0;var _0x207ffd={'id':this['id'],'available':this[_0x0790('0x17')],'loggedIn':this[_0x0790('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0790('0x18')]};var _0x134b0f=md5(JSON['stringify'](_0x207ffd));if(this[_0x0790('0x1')]!==_0x134b0f){this[_0x0790('0x1')]=_0x134b0f;io['to'](util['format'](_0x0790('0x19'),_0x207ffd['name']))[_0x0790('0x1a')](_0x0790('0x1b'),_0x207ffd);}};module[_0x0790('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 321d3c8..4dc7028 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 _0x5ca9=['Intervals','exports','name'];(function(_0xa846cd,_0x54e7d7){var _0x2144fb=function(_0x59d453){while(--_0x59d453){_0xa846cd['push'](_0xa846cd['shift']());}};_0x2144fb(++_0x54e7d7);}(_0x5ca9,0xb3));var _0x95ca=function(_0x39cd97,_0x59bb46){_0x39cd97=_0x39cd97-0x0;var _0x35fcf4=_0x5ca9[_0x39cd97];return _0x35fcf4;};'use strict';function Interval(_0xa03e27){this['id']=_0xa03e27['id']||0x0;this[_0x95ca('0x0')]=_0xa03e27[_0x95ca('0x0')]||'';this[_0x95ca('0x1')]=_0xa03e27[_0x95ca('0x1')]||{};}module[_0x95ca('0x2')]=Interval; \ No newline at end of file +var _0x9151=['Intervals','exports','name'];(function(_0x308a31,_0x2a576e){var _0x20632c=function(_0x14592c){while(--_0x14592c){_0x308a31['push'](_0x308a31['shift']());}};_0x20632c(++_0x2a576e);}(_0x9151,0x1e8));var _0x1915=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0x9151[_0x5383f1];return _0xa23930;};'use strict';function Interval(_0x12134b){this['id']=_0x12134b['id']||0x0;this[_0x1915('0x0')]=_0x12134b[_0x1915('0x0')]||'';this[_0x1915('0x1')]=_0x12134b['Intervals']||{};}module[_0x1915('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 09902db..fae13fc 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 _0x1545=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','mailPause','available','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x594f20,_0x19efe4){var _0x54f0bd=function(_0x15f6c2){while(--_0x15f6c2){_0x594f20['push'](_0x594f20['shift']());}};_0x54f0bd(++_0x19efe4);}(_0x1545,0x11a));var _0x5154=function(_0x3a1bcd,_0x244041){_0x3a1bcd=_0x3a1bcd-0x0;var _0x57422c=_0x1545[_0x3a1bcd];return _0x57422c;};'use strict';var _=require(_0x5154('0x0'));var md5=require(_0x5154('0x1'));var util=require('util');var Redis=require(_0x5154('0x2'));var config=require(_0x5154('0x3'));config[_0x5154('0x4')]=_[_0x5154('0x5')](config[_0x5154('0x4')],{'host':_0x5154('0x6'),'port':0x18eb});var io=require(_0x5154('0x7'))(new Redis(config[_0x5154('0x4')]));function MailQueue(_0x981f7b){this['id']=_0x981f7b['id']||0x0;this[_0x5154('0x8')]=_0x981f7b['name']||'';this[_0x5154('0x9')]=_0x981f7b[_0x5154('0x9')]||0xa;this[_0x5154('0xa')]=_0x981f7b['strategy']||_0x5154('0xb');this['Agents']=_0x981f7b[_0x5154('0xc')];this[_0x5154('0xd')]={};this[_0x5154('0xe')]=0x0;this[_0x5154('0x1')]='';this[_0x5154('0xf')]();this['updateRealtime']();}MailQueue[_0x5154('0x10')][_0x5154('0xf')]=function(){var _0x5efe9f=this[_0x5154('0xd')][_0x5154('0x11')];this['mapAgentsId']=_[_0x5154('0x12')](this[_0x5154('0xc')],'id');this['mapAgentsId'][_0x5154('0x11')]=_0x5efe9f;};MailQueue[_0x5154('0x10')][_0x5154('0x13')]=function(){this[_0x5154('0x14')]=0x0;this[_0x5154('0x15')]=0x0;for(var _0x2002a9=0x0;_0x2002a9=0x0?this[_0x5154('0x18')]:0x0;var _0x4285c6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5154('0x14')],'name':this[_0x5154('0x8')],'paused':this[_0x5154('0x15')],'waiting':this[_0x5154('0xe')]};var _0x3c2161=md5(JSON['stringify'](_0x4285c6));if(this['md5']!==_0x3c2161){this['md5']=_0x3c2161;io['to'](util[_0x5154('0x19')](_0x5154('0x1a'),_0x4285c6[_0x5154('0x8')]))['emit'](_0x5154('0x1b'),_0x4285c6);}};module[_0x5154('0x1c')]=MailQueue; \ No newline at end of file +var _0x0b61=['stringify','format','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','online','mailPause','available'];(function(_0x4de1b5,_0x2a7626){var _0xed55cf=function(_0x5f1115){while(--_0x5f1115){_0x4de1b5['push'](_0x4de1b5['shift']());}};_0xed55cf(++_0x2a7626);}(_0x0b61,0x8b));var _0x10b6=function(_0x48d266,_0x2cbd75){_0x48d266=_0x48d266-0x0;var _0x5eb912=_0x0b61[_0x48d266];return _0x5eb912;};'use strict';var _=require(_0x10b6('0x0'));var md5=require(_0x10b6('0x1'));var util=require('util');var Redis=require(_0x10b6('0x2'));var config=require(_0x10b6('0x3'));config[_0x10b6('0x4')]=_['defaults'](config[_0x10b6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x10b6('0x5'))(new Redis(config[_0x10b6('0x4')]));function MailQueue(_0x3d3f18){this['id']=_0x3d3f18['id']||0x0;this[_0x10b6('0x6')]=_0x3d3f18[_0x10b6('0x6')]||'';this[_0x10b6('0x7')]=_0x3d3f18[_0x10b6('0x7')]||0xa;this[_0x10b6('0x8')]=_0x3d3f18['strategy']||'beepall';this[_0x10b6('0x9')]=_0x3d3f18[_0x10b6('0x9')];this['mapAgentsId']={};this[_0x10b6('0xa')]=0x0;this[_0x10b6('0x1')]='';this['updateRouting']();this[_0x10b6('0xb')]();}MailQueue[_0x10b6('0xc')][_0x10b6('0xd')]=function(){var _0x5dd754=this[_0x10b6('0xe')][_0x10b6('0xf')];this[_0x10b6('0xe')]=_[_0x10b6('0x10')](this[_0x10b6('0x9')],'id');this[_0x10b6('0xe')][_0x10b6('0xf')]=_0x5dd754;};MailQueue[_0x10b6('0xc')]['updateRealtime']=function(){this[_0x10b6('0x11')]=0x0;this[_0x10b6('0x12')]=0x0;for(var _0x4189a3=0x0;_0x4189a3=0x0?this[_0x10b6('0x16')]:0x0;var _0x1a9a80={'id':this['id'],'available':this['available'],'loggedIn':this[_0x10b6('0x11')],'name':this[_0x10b6('0x6')],'paused':this[_0x10b6('0x12')],'waiting':this[_0x10b6('0xa')]};var _0x4155df=md5(JSON[_0x10b6('0x17')](_0x1a9a80));if(this[_0x10b6('0x1')]!==_0x4155df){this['md5']=_0x4155df;io['to'](util[_0x10b6('0x18')]('mail:queue:%s',_0x1a9a80[_0x10b6('0x6')]))['emit'](_0x10b6('0x19'),_0x1a9a80);}};module[_0x10b6('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index bcb3fbe..f345e72 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0xadb5,0xad));var _0x5adb=function(_0x148517,_0x5d24ef){_0x148517=_0x148517-0x0;var _0xae182c=_0xadb5[_0x148517];return _0xae182c;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +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(_0x84cfd5,_0x3d6942){var _0x1c2068=function(_0xbd7712){while(--_0xbd7712){_0x84cfd5['push'](_0x84cfd5['shift']());}};_0x1c2068(++_0x3d6942);}(_0x814b,0x1a2));var _0xb814=function(_0x13d5bc,_0x3fce3c){_0x13d5bc=_0x13d5bc-0x0;var _0x4b8a40=_0x814b[_0x13d5bc];return _0x4b8a40;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3ef3c46..e20e1bb 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 _0x4ded=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x29e623,_0x26776a){var _0x2cab45=function(_0x2c631f){while(--_0x2c631f){_0x29e623['push'](_0x29e623['shift']());}};_0x2cab45(++_0x26776a);}(_0x4ded,0x116));var _0xd4de=function(_0x42642d,_0x18d9e1){_0x42642d=_0x42642d-0x0;var _0x916131=_0x4ded[_0x42642d];return _0x916131;};'use strict';var _=require(_0xd4de('0x0'));var md5=require(_0xd4de('0x1'));var util=require(_0xd4de('0x2'));var Redis=require(_0xd4de('0x3'));var config=require(_0xd4de('0x4'));config[_0xd4de('0x5')]=_[_0xd4de('0x6')](config[_0xd4de('0x5')],{'host':_0xd4de('0x7'),'port':0x18eb});var io=require(_0xd4de('0x8'))(new Redis(config[_0xd4de('0x5')]));function SmsQueue(_0x8fbe6a){this['id']=_0x8fbe6a['id']||0x0;this['name']=_0x8fbe6a[_0xd4de('0x9')]||'';this[_0xd4de('0xa')]=_0x8fbe6a[_0xd4de('0xa')]||0xa;this[_0xd4de('0xb')]=_0x8fbe6a[_0xd4de('0xb')]||_0xd4de('0xc');this['Agents']=_0x8fbe6a[_0xd4de('0xd')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xd4de('0xe')]();this[_0xd4de('0xf')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x4c9499=this[_0xd4de('0x10')]['_rr'];this[_0xd4de('0x10')]=_[_0xd4de('0x11')](this[_0xd4de('0xd')],'id');this[_0xd4de('0x10')][_0xd4de('0x12')]=_0x4c9499;};SmsQueue[_0xd4de('0x13')][_0xd4de('0xf')]=function(){this[_0xd4de('0x14')]=0x0;this[_0xd4de('0x15')]=0x0;for(var _0x37cb9f=0x0;_0x37cb9f=0x0?this['available']:0x0;var _0x4d0df6={'id':this['id'],'available':this[_0xd4de('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xd4de('0x9')],'paused':this[_0xd4de('0x15')],'waiting':this['waiting']};var _0xc15081=md5(JSON['stringify'](_0x4d0df6));if(this[_0xd4de('0x1')]!==_0xc15081){this[_0xd4de('0x1')]=_0xc15081;io['to'](util[_0xd4de('0x1a')](_0xd4de('0x1b'),_0x4d0df6['name']))[_0xd4de('0x1c')](_0xd4de('0x1d'),_0x4d0df6);}};module[_0xd4de('0x1e')]=SmsQueue; \ No newline at end of file +var _0x9224=['defaults','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','paused','length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis'];(function(_0x461b4c,_0x13fedf){var _0x75971b=function(_0x14970b){while(--_0x14970b){_0x461b4c['push'](_0x461b4c['shift']());}};_0x75971b(++_0x13fedf);}(_0x9224,0xa3));var _0x4922=function(_0x549f5f,_0x30cfc4){_0x549f5f=_0x549f5f-0x0;var _0x2b6ee3=_0x9224[_0x549f5f];return _0x2b6ee3;};'use strict';var _=require('lodash');var md5=require(_0x4922('0x0'));var util=require(_0x4922('0x1'));var Redis=require(_0x4922('0x2'));var config=require(_0x4922('0x3'));config[_0x4922('0x4')]=_[_0x4922('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4922('0x4')]));function SmsQueue(_0x4a8b56){this['id']=_0x4a8b56['id']||0x0;this[_0x4922('0x6')]=_0x4a8b56[_0x4922('0x6')]||'';this[_0x4922('0x7')]=_0x4a8b56[_0x4922('0x7')]||0xa;this[_0x4922('0x8')]=_0x4a8b56[_0x4922('0x8')]||'beepall';this[_0x4922('0x9')]=_0x4a8b56[_0x4922('0x9')];this['mapAgentsId']={};this[_0x4922('0xa')]=0x0;this[_0x4922('0x0')]='';this[_0x4922('0xb')]();this[_0x4922('0xc')]();}SmsQueue[_0x4922('0xd')][_0x4922('0xb')]=function(){var _0x33053f=this[_0x4922('0xe')]['_rr'];this[_0x4922('0xe')]=_['map'](this[_0x4922('0x9')],'id');this[_0x4922('0xe')][_0x4922('0xf')]=_0x33053f;};SmsQueue[_0x4922('0xd')][_0x4922('0xc')]=function(){this['loggedIn']=0x0;this[_0x4922('0x10')]=0x0;for(var _0x704e23=0x0;_0x704e23=0x0?this[_0x4922('0x15')]:0x0;var _0x15cdc9={'id':this['id'],'available':this[_0x4922('0x15')],'loggedIn':this[_0x4922('0x13')],'name':this['name'],'paused':this[_0x4922('0x10')],'waiting':this[_0x4922('0xa')]};var _0x7298c1=md5(JSON[_0x4922('0x16')](_0x15cdc9));if(this[_0x4922('0x0')]!==_0x7298c1){this['md5']=_0x7298c1;io['to'](util[_0x4922('0x17')](_0x4922('0x18'),_0x15cdc9[_0x4922('0x6')]))[_0x4922('0x19')](_0x4922('0x1a'),_0x15cdc9);}};module[_0x4922('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0006e16..3eb561e 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 _0x67ce=['stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','whatsappPause','available'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x67ce,0xb9));var _0xe67c=function(_0x125838,_0x438e6b){_0x125838=_0x125838-0x0;var _0x3e6cc4=_0x67ce[_0x125838];return _0x3e6cc4;};'use strict';var _=require(_0xe67c('0x0'));var md5=require(_0xe67c('0x1'));var util=require(_0xe67c('0x2'));var Redis=require(_0xe67c('0x3'));var config=require(_0xe67c('0x4'));config[_0xe67c('0x5')]=_[_0xe67c('0x6')](config[_0xe67c('0x5')],{'host':_0xe67c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe67c('0x5')]));function WhatsappQueue(_0x4148bd){this['id']=_0x4148bd['id']||0x0;this['name']=_0x4148bd[_0xe67c('0x8')]||'';this[_0xe67c('0x9')]=_0x4148bd['timeout']||0xa;this[_0xe67c('0xa')]=_0x4148bd[_0xe67c('0xa')]||_0xe67c('0xb');this[_0xe67c('0xc')]=_0x4148bd['Agents'];this[_0xe67c('0xd')]={};this[_0xe67c('0xe')]=0x0;this['md5']='';this[_0xe67c('0xf')]();this[_0xe67c('0x10')]();}WhatsappQueue[_0xe67c('0x11')][_0xe67c('0xf')]=function(){var _0x5828c0=this[_0xe67c('0xd')]['_rr'];this[_0xe67c('0xd')]=_['map'](this[_0xe67c('0xc')],'id');this[_0xe67c('0xd')][_0xe67c('0x12')]=_0x5828c0;};WhatsappQueue['prototype'][_0xe67c('0x10')]=function(){this['loggedIn']=0x0;this[_0xe67c('0x13')]=0x0;for(var _0x36288c=0x0;_0x36288c=0x0?this[_0xe67c('0x18')]:0x0;var _0x387661={'id':this['id'],'available':this[_0xe67c('0x18')],'loggedIn':this[_0xe67c('0x16')],'name':this[_0xe67c('0x8')],'paused':this[_0xe67c('0x13')],'waiting':this[_0xe67c('0xe')]};var _0x38aadc=md5(JSON[_0xe67c('0x19')](_0x387661));if(this['md5']!==_0x38aadc){this[_0xe67c('0x1')]=_0x38aadc;io['to'](util[_0xe67c('0x1a')](_0xe67c('0x1b'),_0x387661[_0xe67c('0x8')]))['emit'](_0xe67c('0x1c'),_0x387661);}};module[_0xe67c('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x45a7=['_rr','prototype','loggedIn','paused','length','online','available','whatsapp:queue:%s','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime'];(function(_0x20efc8,_0x323b95){var _0x5dfbf7=function(_0xd06add){while(--_0xd06add){_0x20efc8['push'](_0x20efc8['shift']());}};_0x5dfbf7(++_0x323b95);}(_0x45a7,0x86));var _0x745a=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x45a7[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0x745a('0x0'));var md5=require('md5');var util=require(_0x745a('0x1'));var Redis=require(_0x745a('0x2'));var config=require(_0x745a('0x3'));config[_0x745a('0x4')]=_['defaults'](config[_0x745a('0x4')],{'host':_0x745a('0x5'),'port':0x18eb});var io=require(_0x745a('0x6'))(new Redis(config[_0x745a('0x4')]));function WhatsappQueue(_0x46d0a8){this['id']=_0x46d0a8['id']||0x0;this[_0x745a('0x7')]=_0x46d0a8[_0x745a('0x7')]||'';this[_0x745a('0x8')]=_0x46d0a8['timeout']||0xa;this[_0x745a('0x9')]=_0x46d0a8[_0x745a('0x9')]||'beepall';this[_0x745a('0xa')]=_0x46d0a8[_0x745a('0xa')];this[_0x745a('0xb')]={};this[_0x745a('0xc')]=0x0;this[_0x745a('0xd')]='';this[_0x745a('0xe')]();this[_0x745a('0xf')]();}WhatsappQueue['prototype'][_0x745a('0xe')]=function(){var _0x3a2ebb=this[_0x745a('0xb')][_0x745a('0x10')];this[_0x745a('0xb')]=_['map'](this[_0x745a('0xa')],'id');this[_0x745a('0xb')][_0x745a('0x10')]=_0x3a2ebb;};WhatsappQueue[_0x745a('0x11')][_0x745a('0xf')]=function(){this[_0x745a('0x12')]=0x0;this[_0x745a('0x13')]=0x0;for(var _0x4dd74b=0x0;_0x4dd74b=0x0?this[_0x745a('0x16')]:0x0;var _0x3347ee={'id':this['id'],'available':this[_0x745a('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x745a('0x7')],'paused':this[_0x745a('0x13')],'waiting':this[_0x745a('0xc')]};var _0x4735e4=md5(JSON['stringify'](_0x3347ee));if(this[_0x745a('0xd')]!==_0x4735e4){this[_0x745a('0xd')]=_0x4735e4;io['to'](util['format'](_0x745a('0x17'),_0x3347ee[_0x745a('0x7')]))['emit'](_0x745a('0x18'),_0x3347ee);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9ac06a0..5957075 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(_0x335aeb,_0x5f0c09){var _0x2a563f=function(_0x3d1721){while(--_0x3d1721){_0x335aeb['push'](_0x335aeb['shift']());}};_0x2a563f(++_0x5f0c09);}(_0xb10b,0x12a));var _0xbb10=function(_0x16c2e0,_0x3dc335){_0x16c2e0=_0x16c2e0-0x0;var _0x49b690=_0xb10b[_0x16c2e0];return _0x49b690;};'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(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 f099af1..24a0945 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 _0x2dbc=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x2dbc,0x1de));var _0xc2db=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x2dbc[_0x2706da];return _0x3ba87e;};'use strict';var client=require('../client');exports[_0xc2db('0x0')]=function(_0x182e12,_0x578e0a){return client[_0xc2db('0x1')](_0xc2db('0x2'),{'body':_0x578e0a,'options':{'where':{'id':_0x182e12}},'log':_0xc2db('0x3')});};exports[_0xc2db('0x4')]=function(_0x2b11de,_0x42262a){return client[_0xc2db('0x1')](_0xc2db('0x5'),{'body':_0x42262a,'options':{'where':{'id':_0x2b11de}},'log':_0xc2db('0x6')});}; \ No newline at end of file +var _0xddaa=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xddaa,0x1b8));var _0xadda=function(_0x244dd7,_0x2e4b9a){_0x244dd7=_0x244dd7-0x0;var _0x14a6b4=_0xddaa[_0x244dd7];return _0x14a6b4;};'use strict';var client=require('../client');exports[_0xadda('0x0')]=function(_0x2f3899,_0x4633b4){return client[_0xadda('0x1')](_0xadda('0x2'),{'body':_0x4633b4,'options':{'where':{'id':_0x2f3899}},'log':_0xadda('0x3')});};exports[_0xadda('0x4')]=function(_0x5b7bb4,_0x5737b6){return client[_0xadda('0x1')](_0xadda('0x5'),{'body':_0x5737b6,'options':{'where':{'id':_0x5b7bb4}},'log':_0xadda('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b965dc8..e570458 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 _0xf72c=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf72c,0x7d));var _0xcf72=function(_0x500e8b,_0x43d26a){_0x500e8b=_0x500e8b-0x0;var _0x2cd48e=_0xf72c[_0x500e8b];return _0x2cd48e;};'use strict';var client=require(_0xcf72('0x0'));exports['create']=function(_0x1b412c){return client[_0xcf72('0x1')](_0xcf72('0x2'),{'body':_0x1b412c,'log':_0xcf72('0x3')});}; \ No newline at end of file +var _0xeee5=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x4c3267,_0xf2b77){var _0xfa5c9=function(_0x445e6d){while(--_0x445e6d){_0x4c3267['push'](_0x4c3267['shift']());}};_0xfa5c9(++_0xf2b77);}(_0xeee5,0x1c7));var _0x5eee=function(_0x4ae777,_0x4f95bc){_0x4ae777=_0x4ae777-0x0;var _0x172fd5=_0xeee5[_0x4ae777];return _0x172fd5;};'use strict';var client=require(_0x5eee('0x0'));exports[_0x5eee('0x1')]=function(_0x3b0dbd){return client[_0x5eee('0x2')](_0x5eee('0x3'),{'body':_0x3b0dbd,'log':_0x5eee('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5261655..80078f0 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 _0x158f=['Request','GetChatQueue','name','timeout','strategy','User','chatPause','getChatQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x158f,0x137));var _0xf158=function(_0x386408,_0x584c61){_0x386408=_0x386408-0x0;var _0xedb599=_0x158f[_0x386408];return _0xedb599;};'use strict';var client=require('../client');exports[_0xf158('0x0')]=function(){return function(){return client[_0xf158('0x1')](_0xf158('0x2'),{'options':{'raw':![],'attributes':['id',_0xf158('0x3'),_0xf158('0x4'),_0xf158('0x5')],'include':[{'model':_0xf158('0x6'),'as':'Agents','attributes':['id',_0xf158('0x3'),'online',_0xf158('0x7')]}]},'log':_0xf158('0x0')});};}; \ No newline at end of file +var _0x1793=['User','Agents','name','../client','getChatQueues','Request','GetChatQueue','timeout','strategy'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x1793,0x1ce));var _0x3179=function(_0x10272c,_0xe59704){_0x10272c=_0x10272c-0x0;var _0x1c56e9=_0x1793[_0x10272c];return _0x1c56e9;};'use strict';var client=require(_0x3179('0x0'));exports[_0x3179('0x1')]=function(){return function(){return client[_0x3179('0x2')](_0x3179('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3179('0x4'),_0x3179('0x5')],'include':[{'model':_0x3179('0x6'),'as':_0x3179('0x7'),'attributes':['id',_0x3179('0x8'),'online','chatPause']}]},'log':_0x3179('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6972c8c..6d57f2a 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 _0xf296=['Request','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x39628c,_0x2eb8c4){var _0x2b0532=function(_0x87cc3b){while(--_0x87cc3b){_0x39628c['push'](_0x39628c['shift']());}};_0x2b0532(++_0x2eb8c4);}(_0xf296,0x94));var _0x6f29=function(_0x3ee952,_0x565e0f){_0x3ee952=_0x3ee952-0x0;var _0xc0c8b1=_0xf296[_0x3ee952];return _0xc0c8b1;};'use strict';var client=require(_0x6f29('0x0'));exports[_0x6f29('0x1')]=function(_0x4e5239){return client[_0x6f29('0x2')]('CreateChatQueueReport',{'body':_0x4e5239,'log':'CreateChatQueueReport'});};exports[_0x6f29('0x3')]=function(_0x3cdbee,_0x4cdc12){return client[_0x6f29('0x2')](_0x6f29('0x4'),{'body':_0x4cdc12,'options':{'where':{'uniqueid':_0x3cdbee},'order':[['id',_0x6f29('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x57cf=['DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x57cf,0x11b));var _0xf57c=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x57cf[_0x4b0290];return _0x4bd9f4;};'use strict';var client=require(_0xf57c('0x0'));exports[_0xf57c('0x1')]=function(_0x41b0b8){return client[_0xf57c('0x2')](_0xf57c('0x3'),{'body':_0x41b0b8,'log':_0xf57c('0x3')});};exports[_0xf57c('0x4')]=function(_0x1262b4,_0x41391c){return client[_0xf57c('0x2')]('UpdateChatQueueReport',{'body':_0x41391c,'options':{'where':{'uniqueid':_0x1262b4},'order':[['id',_0xf57c('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6508cd0..3d6af79 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(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x7a54,0x106));var _0x47a5=function(_0x4f6d81,_0x4dade2){_0x4f6d81=_0x4f6d81-0x0;var _0xc7ade4=_0x7a54[_0x4f6d81];return _0xc7ade4;};'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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x7a54,0x106));var _0x47a5=function(_0x4e5285,_0x36fc39){_0x4e5285=_0x4e5285-0x0;var _0x5ac678=_0x7a54[_0x4e5285];return _0x5ac678;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a00cfc9..3b4cd28 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 _0x5bf2=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4e92a5,_0x2e12e2){var _0x5c3b1f=function(_0x836836){while(--_0x836836){_0x4e92a5['push'](_0x4e92a5['shift']());}};_0x5c3b1f(++_0x2e12e2);}(_0x5bf2,0x8f));var _0x25bf=function(_0x45d624,_0x2a73fb){_0x45d624=_0x45d624-0x0;var _0x38a24f=_0x5bf2[_0x45d624];return _0x38a24f;};'use strict';var client=require(_0x25bf('0x0'));exports[_0x25bf('0x1')]=function(_0x350a8f){return client['Request'](_0x25bf('0x2'),{'body':_0x350a8f,'log':_0x25bf('0x3')});}; \ No newline at end of file +var _0xe90d=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0xe90d,0x10b));var _0xde90=function(_0x508123,_0x4f0741){_0x508123=_0x508123-0x0;var _0x4ef8d8=_0xe90d[_0x508123];return _0x4ef8d8;};'use strict';var client=require(_0xde90('0x0'));exports['create']=function(_0x306556){return client[_0xde90('0x1')](_0xde90('0x2'),{'body':_0x306556,'log':_0xde90('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 612d84f..b794253 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 _0xf70d=['Agents','online','faxPause','GetFaxQueue','timeout','strategy','User'];(function(_0x24ae03,_0x334660){var _0x38a29e=function(_0x25e64b){while(--_0x25e64b){_0x24ae03['push'](_0x24ae03['shift']());}};_0x38a29e(++_0x334660);}(_0xf70d,0xc7));var _0xdf70=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf70d[_0x5608a3];return _0x1ed50a;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client['Request'](_0xdf70('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xdf70('0x1'),_0xdf70('0x2')],'include':[{'model':_0xdf70('0x3'),'as':_0xdf70('0x4'),'attributes':['id','name',_0xdf70('0x5'),_0xdf70('0x6')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x2eb1=['timeout','strategy','Agents','name','online','faxPause','getFaxQueues','../client','Request','GetFaxQueue'];(function(_0x2115f3,_0x2f6744){var _0x5c399a=function(_0x446b13){while(--_0x446b13){_0x2115f3['push'](_0x2115f3['shift']());}};_0x5c399a(++_0x2f6744);}(_0x2eb1,0x129));var _0x12eb=function(_0x51b96f,_0x271054){_0x51b96f=_0x51b96f-0x0;var _0x3ef23b=_0x2eb1[_0x51b96f];return _0x3ef23b;};'use strict';var client=require(_0x12eb('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x12eb('0x1')](_0x12eb('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x12eb('0x3'),_0x12eb('0x4')],'include':[{'model':'User','as':_0x12eb('0x5'),'attributes':['id',_0x12eb('0x6'),_0x12eb('0x7'),_0x12eb('0x8')]}]},'log':_0x12eb('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 58158c0..009fd98 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 _0x2fcd=['DESC','../client','create','CreateFaxQueueReport','Request','UpdateFaxQueueReport'];(function(_0x2e3c1a,_0x297f60){var _0x8f41a=function(_0x1522b5){while(--_0x1522b5){_0x2e3c1a['push'](_0x2e3c1a['shift']());}};_0x8f41a(++_0x297f60);}(_0x2fcd,0xa3));var _0xd2fc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2fcd[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0xd2fc('0x0'));exports[_0xd2fc('0x1')]=function(_0x174a41){return client['Request'](_0xd2fc('0x2'),{'body':_0x174a41,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x5e432f,_0x22ac2e){return client[_0xd2fc('0x3')](_0xd2fc('0x4'),{'body':_0x22ac2e,'options':{'where':{'uniqueid':_0x5e432f},'order':[['id',_0xd2fc('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x2bd9=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x2bd9,0x114));var _0x92bd=function(_0x4a2f61,_0x3f7589){_0x4a2f61=_0x4a2f61-0x0;var _0x56a4ce=_0x2bd9[_0x4a2f61];return _0x56a4ce;};'use strict';var client=require('../client');exports[_0x92bd('0x0')]=function(_0x478989){return client[_0x92bd('0x1')](_0x92bd('0x2'),{'body':_0x478989,'log':_0x92bd('0x2')});};exports[_0x92bd('0x3')]=function(_0x665237,_0x33f58e){return client[_0x92bd('0x1')](_0x92bd('0x4'),{'body':_0x33f58e,'options':{'where':{'uniqueid':_0x665237},'order':[['id',_0x92bd('0x5')]],'limit':0x1},'log':_0x92bd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a2349f2..1540e13 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 _0x1dfd=['Request','GetInterval','Interval','name','interval','../client','getIntervals'];(function(_0x433b93,_0x40db4f){var _0x116edd=function(_0x62fb77){while(--_0x62fb77){_0x433b93['push'](_0x433b93['shift']());}};_0x116edd(++_0x40db4f);}(_0x1dfd,0x67));var _0xd1df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1dfd[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xd1df('0x0'));exports[_0xd1df('0x1')]=function(){return function(){return client[_0xd1df('0x2')](_0xd1df('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xd1df('0x4'),'as':'Intervals','attributes':['id',_0xd1df('0x5'),_0xd1df('0x6')]}]},'log':_0xd1df('0x1')});};}; \ No newline at end of file +var _0xe9cf=['GetInterval','Interval','Intervals','getIntervals'];(function(_0x593567,_0x537f33){var _0x2e1562=function(_0x1098e9){while(--_0x1098e9){_0x593567['push'](_0x593567['shift']());}};_0x2e1562(++_0x537f33);}(_0xe9cf,0xeb));var _0xfe9c=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0xe9cf[_0x1eed52];return _0x57782a;};'use strict';var client=require('../client');exports[_0xfe9c('0x0')]=function(){return function(){return client['Request'](_0xfe9c('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xfe9c('0x2'),'as':_0xfe9c('0x3'),'attributes':['id','name','interval']}]},'log':_0xfe9c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f321e7a..ee2db3c 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','addTags'];(function(_0x3bb8eb,_0x237cc8){var _0x18a7ac=function(_0x314aba){while(--_0x314aba){_0x3bb8eb['push'](_0x3bb8eb['shift']());}};_0x18a7ac(++_0x237cc8);}(_0x9582,0x95));var _0x2958=function(_0x193ec0,_0x3935a6){_0x193ec0=_0x193ec0-0x0;var _0xcae00a=_0x9582[_0x193ec0];return _0xcae00a;};'use strict';var client=require(_0x2958('0x0'));exports[_0x2958('0x1')]=function(_0xd87e37,_0x3d6d1f){return client[_0x2958('0x2')](_0x2958('0x3'),{'body':_0x3d6d1f,'options':{'where':{'id':_0xd87e37}},'log':'updateMailInteraction'});};exports[_0x2958('0x4')]=function(_0x3b907e,_0x136c77){return client[_0x2958('0x2')](_0x2958('0x5'),{'body':_0x136c77,'options':{'where':{'id':_0x3b907e}},'log':_0x2958('0x6')});}; \ No newline at end of file +var _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x476f68,_0x1d871c){var _0x44679e=function(_0x280af4){while(--_0x280af4){_0x476f68['push'](_0x476f68['shift']());}};_0x44679e(++_0x1d871c);}(_0x3de3,0x1ce));var _0x33de=function(_0xb9dd6f,_0x2c941f){_0xb9dd6f=_0xb9dd6f-0x0;var _0x3cb4ad=_0x3de3[_0xb9dd6f];return _0x3cb4ad;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'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 eaf06ec..bdb9f5a 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 _0xf8f4=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x26512f,_0x4834c){var _0x4dc442=function(_0x4a4514){while(--_0x4a4514){_0x26512f['push'](_0x26512f['shift']());}};_0x4dc442(++_0x4834c);}(_0xf8f4,0x1e0));var _0x4f8f=function(_0x4df337,_0x3bf41d){_0x4df337=_0x4df337-0x0;var _0x4a1c4e=_0xf8f4[_0x4df337];return _0x4a1c4e;};'use strict';var client=require(_0x4f8f('0x0'));exports[_0x4f8f('0x1')]=function(_0x51f75e){return client['Request'](_0x4f8f('0x2'),{'body':_0x51f75e,'log':_0x4f8f('0x3')});}; \ No newline at end of file +var _0xa77a=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa77a,0xb5));var _0xaa77=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0xa77a[_0x18afca];return _0x11603f;};'use strict';var client=require(_0xaa77('0x0'));exports[_0xaa77('0x1')]=function(_0x215867){return client['Request'](_0xaa77('0x2'),{'body':_0x215867,'log':_0xaa77('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a4ffa08..abf7c83 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 _0xd018=['GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xd018,0xda));var _0x8d01=function(_0x11e8f3,_0xdc8f8){_0x11e8f3=_0x11e8f3-0x0;var _0x1a85c2=_0xd018[_0x11e8f3];return _0x1a85c2;};'use strict';var client=require(_0x8d01('0x0'));exports[_0x8d01('0x1')]=function(){return function(){return client['Request'](_0x8d01('0x2'),{'options':{'raw':![],'attributes':['id',_0x8d01('0x3'),_0x8d01('0x4'),_0x8d01('0x5')],'include':[{'model':_0x8d01('0x6'),'as':_0x8d01('0x7'),'attributes':['id',_0x8d01('0x3'),_0x8d01('0x8'),_0x8d01('0x9')]}]},'log':_0x8d01('0x1')});};}; \ No newline at end of file +var _0xdd8e=['Agents','online','getMailQueues','Request','name','timeout'];(function(_0x4dd97b,_0x39eeba){var _0xe4d837=function(_0x4a4360){while(--_0x4a4360){_0x4dd97b['push'](_0x4dd97b['shift']());}};_0xe4d837(++_0x39eeba);}(_0xdd8e,0x1ca));var _0xedd8=function(_0x5bc787,_0x3ed610){_0x5bc787=_0x5bc787-0x0;var _0x3634e0=_0xdd8e[_0x5bc787];return _0x3634e0;};'use strict';var client=require('../client');exports[_0xedd8('0x0')]=function(){return function(){return client[_0xedd8('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xedd8('0x2'),_0xedd8('0x3'),'strategy'],'include':[{'model':'User','as':_0xedd8('0x4'),'attributes':['id',_0xedd8('0x2'),_0xedd8('0x5'),'mailPause']}]},'log':_0xedd8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8e75b59..943511c 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 _0x9bde=['update','DESC','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x56202d,_0x20a661){var _0x11b435=function(_0x2329d4){while(--_0x2329d4){_0x56202d['push'](_0x56202d['shift']());}};_0x11b435(++_0x20a661);}(_0x9bde,0xc0));var _0xe9bd=function(_0x23c65d,_0x3dd889){_0x23c65d=_0x23c65d-0x0;var _0x53d5f9=_0x9bde[_0x23c65d];return _0x53d5f9;};'use strict';var client=require(_0xe9bd('0x0'));exports[_0xe9bd('0x1')]=function(_0x156eb2){return client[_0xe9bd('0x2')](_0xe9bd('0x3'),{'body':_0x156eb2,'log':_0xe9bd('0x3')});};exports[_0xe9bd('0x4')]=function(_0xb90a9a,_0x22f455){return client[_0xe9bd('0x2')]('UpdateMailQueueReport',{'body':_0x22f455,'options':{'where':{'uniqueid':_0xb90a9a},'order':[['id',_0xe9bd('0x5')]],'limit':0x1},'log':_0xe9bd('0x6')});}; \ No newline at end of file +var _0xa6f1=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x4c9bac,_0xc822e8){var _0x379b34=function(_0x3e943c){while(--_0x3e943c){_0x4c9bac['push'](_0x4c9bac['shift']());}};_0x379b34(++_0xc822e8);}(_0xa6f1,0x157));var _0x1a6f=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0xa6f1[_0x28f922];return _0x4eceac;};'use strict';var client=require(_0x1a6f('0x0'));exports[_0x1a6f('0x1')]=function(_0x180619){return client[_0x1a6f('0x2')](_0x1a6f('0x3'),{'body':_0x180619,'log':_0x1a6f('0x3')});};exports[_0x1a6f('0x4')]=function(_0xf65ea7,_0x5ed16a){return client[_0x1a6f('0x2')](_0x1a6f('0x5'),{'body':_0x5ed16a,'options':{'where':{'uniqueid':_0xf65ea7},'order':[['id',_0x1a6f('0x6')]],'limit':0x1},'log':_0x1a6f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 749da15..ad196cf 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 _0x566c=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x566c,0x181));var _0xc566=function(_0x6f2096,_0x1d2760){_0x6f2096=_0x6f2096-0x0;var _0x1cf8d7=_0x566c[_0x6f2096];return _0x1cf8d7;};'use strict';var client=require(_0xc566('0x0'));exports[_0xc566('0x1')]=function(_0x3d2227,_0x255789){return client[_0xc566('0x2')](_0xc566('0x3'),{'body':_0x255789,'options':{'where':{'id':_0x3d2227}},'log':_0xc566('0x4')});};exports[_0xc566('0x5')]=function(_0x3fb2ff,_0x43982c){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x43982c,'options':{'where':{'id':_0x3fb2ff}},'log':_0xc566('0x6')});}; \ No newline at end of file +var _0x8094=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client','update'];(function(_0x49fad8,_0x8d7f6){var _0x44967e=function(_0x531524){while(--_0x531524){_0x49fad8['push'](_0x49fad8['shift']());}};_0x44967e(++_0x8d7f6);}(_0x8094,0x1ae));var _0x4809=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0x8094[_0x289842];return _0x16155a;};'use strict';var client=require(_0x4809('0x0'));exports[_0x4809('0x1')]=function(_0x1fb4f8,_0x3c53cb){return client[_0x4809('0x2')](_0x4809('0x3'),{'body':_0x3c53cb,'options':{'where':{'id':_0x1fb4f8}},'log':_0x4809('0x4')});};exports['addTags']=function(_0x2c0e29,_0x295b59){return client['Request'](_0x4809('0x5'),{'body':_0x295b59,'options':{'where':{'id':_0x2c0e29}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c339dd8..e7f3875 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 _0xf34b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2bce4e,_0x5e00a9){var _0x2cc3c3=function(_0x49ae65){while(--_0x49ae65){_0x2bce4e['push'](_0x2bce4e['shift']());}};_0x2cc3c3(++_0x5e00a9);}(_0xf34b,0xc7));var _0xbf34=function(_0x4dc3f4,_0x53c37e){_0x4dc3f4=_0x4dc3f4-0x0;var _0x3c64c3=_0xf34b[_0x4dc3f4];return _0x3c64c3;};'use strict';var client=require(_0xbf34('0x0'));exports[_0xbf34('0x1')]=function(_0x13b980){return client[_0xbf34('0x2')](_0xbf34('0x3'),{'body':_0x13b980,'log':_0xbf34('0x4')});}; \ No newline at end of file +var _0x490b=['../client','Request','CreateOpenchannelMessage'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x490b,0x72));var _0xb490=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x490b[_0x42bc91];return _0x3f5507;};'use strict';var client=require(_0xb490('0x0'));exports['create']=function(_0x296252){return client[_0xb490('0x1')](_0xb490('0x2'),{'body':_0x296252,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ca278f8..108f718 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 _0x61d4=['strategy','User','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x320b9e,_0x1f892f){var _0x5e4416=function(_0x160fcc){while(--_0x160fcc){_0x320b9e['push'](_0x320b9e['shift']());}};_0x5e4416(++_0x1f892f);}(_0x61d4,0xbb));var _0x461d=function(_0xc8db78,_0x58b5a7){_0xc8db78=_0xc8db78-0x0;var _0x3483f3=_0x61d4[_0xc8db78];return _0x3483f3;};'use strict';var client=require('../client');exports[_0x461d('0x0')]=function(){return function(){return client[_0x461d('0x1')](_0x461d('0x2'),{'options':{'raw':![],'attributes':['id',_0x461d('0x3'),_0x461d('0x4'),_0x461d('0x5')],'include':[{'model':_0x461d('0x6'),'as':'Agents','attributes':['id','name','online',_0x461d('0x7')]}]},'log':_0x461d('0x0')});};}; \ No newline at end of file +var _0x16f9=['Request','GetOpenchannelQueue','name','timeout','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3d2f82,_0x24ae53){var _0x206729=function(_0x38f564){while(--_0x38f564){_0x3d2f82['push'](_0x3d2f82['shift']());}};_0x206729(++_0x24ae53);}(_0x16f9,0xae));var _0x916f=function(_0x357517,_0x166e89){_0x357517=_0x357517-0x0;var _0x39b743=_0x16f9[_0x357517];return _0x39b743;};'use strict';var client=require(_0x916f('0x0'));exports[_0x916f('0x1')]=function(){return function(){return client[_0x916f('0x2')](_0x916f('0x3'),{'options':{'raw':![],'attributes':['id',_0x916f('0x4'),_0x916f('0x5'),'strategy'],'include':[{'model':'User','as':_0x916f('0x6'),'attributes':['id','name','online',_0x916f('0x7')]}]},'log':_0x916f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 84d23de..7122afe 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 _0x764e=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x764e,0x16d));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xe764('0x0')]=function(_0x30f642){return client[_0xe764('0x1')](_0xe764('0x2'),{'body':_0x30f642,'log':_0xe764('0x2')});};exports[_0xe764('0x3')]=function(_0x5d27f9,_0x151fa4){return client[_0xe764('0x1')](_0xe764('0x4'),{'body':_0x151fa4,'options':{'where':{'uniqueid':_0x5d27f9},'order':[['id','DESC']],'limit':0x1},'log':_0xe764('0x4')});}; \ No newline at end of file +var _0xcb09=['UpdateOpenchannelQueueReport','DESC','create','Request'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcb09,0xee));var _0x9cb0=function(_0x460e53,_0x511e32){_0x460e53=_0x460e53-0x0;var _0x2db8be=_0xcb09[_0x460e53];return _0x2db8be;};'use strict';var client=require('../client');exports[_0x9cb0('0x0')]=function(_0x1e44d7){return client[_0x9cb0('0x1')]('CreateOpenchannelQueueReport',{'body':_0x1e44d7,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x2315e2,_0x57dc6c){return client[_0x9cb0('0x1')](_0x9cb0('0x2'),{'body':_0x57dc6c,'options':{'where':{'uniqueid':_0x2315e2},'order':[['id',_0x9cb0('0x3')]],'limit':0x1},'log':_0x9cb0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b638c3d..f883ca0 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 _0xde50=['UpdateSmsInteraction','addTags','Request'];(function(_0x29fb49,_0x56c675){var _0x15a275=function(_0x4d55b3){while(--_0x4d55b3){_0x29fb49['push'](_0x29fb49['shift']());}};_0x15a275(++_0x56c675);}(_0xde50,0x140));var _0x0de5=function(_0x5dc624,_0x3d9bec){_0x5dc624=_0x5dc624-0x0;var _0x38f557=_0xde50[_0x5dc624];return _0x38f557;};'use strict';var client=require('../client');exports['update']=function(_0x2938ef,_0x34b791){return client[_0x0de5('0x0')](_0x0de5('0x1'),{'body':_0x34b791,'options':{'where':{'id':_0x2938ef}},'log':'updateSmsInteraction'});};exports[_0x0de5('0x2')]=function(_0x5c22bc,_0x16fcda){return client['Request']('AddTagsToSmsInteraction',{'body':_0x16fcda,'options':{'where':{'id':_0x5c22bc}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x79d3=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x4bf3e0,_0x5a4f17){var _0x559b27=function(_0xb64b6f){while(--_0xb64b6f){_0x4bf3e0['push'](_0x4bf3e0['shift']());}};_0x559b27(++_0x5a4f17);}(_0x79d3,0x15f));var _0x379d=function(_0x1d3d1a,_0x2a3dde){_0x1d3d1a=_0x1d3d1a-0x0;var _0x4bc3ad=_0x79d3[_0x1d3d1a];return _0x4bc3ad;};'use strict';var client=require(_0x379d('0x0'));exports['update']=function(_0x1699b0,_0x5efe57){return client[_0x379d('0x1')](_0x379d('0x2'),{'body':_0x5efe57,'options':{'where':{'id':_0x1699b0}},'log':'updateSmsInteraction'});};exports[_0x379d('0x3')]=function(_0x2be235,_0x30d8ba){return client[_0x379d('0x1')](_0x379d('0x4'),{'body':_0x30d8ba,'options':{'where':{'id':_0x2be235}},'log':_0x379d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 51c1892..9d0b967 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 _0x9c1d=['../client','createSmsMessage'];(function(_0x492c39,_0x4792d3){var _0x50798f=function(_0x5637ff){while(--_0x5637ff){_0x492c39['push'](_0x492c39['shift']());}};_0x50798f(++_0x4792d3);}(_0x9c1d,0xa6));var _0xd9c1=function(_0x5c18ea,_0x3c6df4){_0x5c18ea=_0x5c18ea-0x0;var _0x23af7b=_0x9c1d[_0x5c18ea];return _0x23af7b;};'use strict';var client=require(_0xd9c1('0x0'));exports['create']=function(_0x3de632){return client['Request']('CreateSmsMessage',{'body':_0x3de632,'log':_0xd9c1('0x1')});}; \ No newline at end of file +var _0x25ee=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x4b6b98,_0x438214){var _0x579065=function(_0x2f7fbd){while(--_0x2f7fbd){_0x4b6b98['push'](_0x4b6b98['shift']());}};_0x579065(++_0x438214);}(_0x25ee,0xae));var _0xe25e=function(_0x2eae3a,_0x2f0638){_0x2eae3a=_0x2eae3a-0x0;var _0x5e702a=_0x25ee[_0x2eae3a];return _0x5e702a;};'use strict';var client=require(_0xe25e('0x0'));exports[_0xe25e('0x1')]=function(_0x442845){return client['Request'](_0xe25e('0x2'),{'body':_0x442845,'log':_0xe25e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 74cb95e..cbc09f2 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x5b3f94,_0x355406){var _0xa6576f=function(_0x2e4bde){while(--_0x2e4bde){_0x5b3f94['push'](_0x5b3f94['shift']());}};_0xa6576f(++_0x355406);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3d9919,_0x4a2a21){var _0x3d7e8b=function(_0x46f378){while(--_0x46f378){_0x3d9919['push'](_0x3d9919['shift']());}};_0x3d7e8b(++_0x4a2a21);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 97a4c63..d540d74 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x43caf2,_0x4b1c0f){var _0x24dcb2=function(_0x1f2773){while(--_0x1f2773){_0x43caf2['push'](_0x43caf2['shift']());}};_0x24dcb2(++_0x4b1c0f);}(_0x70e0,0x17b));var _0x070e=function(_0x4ce340,_0x6ed13f){_0x4ce340=_0x4ce340-0x0;var _0x490c85=_0x70e0[_0x4ce340];return _0x490c85;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1570bf,_0x1d2927){var _0x449866=function(_0x2fbe9a){while(--_0x2fbe9a){_0x1570bf['push'](_0x1570bf['shift']());}};_0x449866(++_0x1d2927);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 9822361..3521473 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(_0x457689,_0x2e1a6a){var _0x3d72f1=function(_0x1ef834){while(--_0x1ef834){_0x457689['push'](_0x457689['shift']());}};_0x3d72f1(++_0x2e1a6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x303fc8,_0x274a43){var _0x5dcf1b=function(_0x1fb238){while(--_0x1fb238){_0x303fc8['push'](_0x303fc8['shift']());}};_0x5dcf1b(++_0x274a43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 3f2e411..701872e 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 _0x9f02=['addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x5c27b6,_0x4a3c28){var _0x284ce4=function(_0x29fa20){while(--_0x29fa20){_0x5c27b6['push'](_0x5c27b6['shift']());}};_0x284ce4(++_0x4a3c28);}(_0x9f02,0x68));var _0x29f0=function(_0x2583b3,_0x43e2f3){_0x2583b3=_0x2583b3-0x0;var _0x1c3bf5=_0x9f02[_0x2583b3];return _0x1c3bf5;};'use strict';var client=require(_0x29f0('0x0'));exports['update']=function(_0x51f5c2,_0x4bb7b2){return client[_0x29f0('0x1')](_0x29f0('0x2'),{'body':_0x4bb7b2,'options':{'where':{'id':_0x51f5c2}},'log':_0x29f0('0x3')});};exports[_0x29f0('0x4')]=function(_0x1a49c1,_0x47e569){return client[_0x29f0('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x47e569,'options':{'where':{'id':_0x1a49c1}},'log':_0x29f0('0x5')});}; \ No newline at end of file +var _0x4279=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x3416cf,_0x3de5be){var _0x47d2f5=function(_0x3128e4){while(--_0x3128e4){_0x3416cf['push'](_0x3416cf['shift']());}};_0x47d2f5(++_0x3de5be);}(_0x4279,0x8d));var _0x9427=function(_0xf6afe2,_0x59cf46){_0xf6afe2=_0xf6afe2-0x0;var _0x4d819c=_0x4279[_0xf6afe2];return _0x4d819c;};'use strict';var client=require('../client');exports[_0x9427('0x0')]=function(_0x218ae7,_0x594cbc){return client[_0x9427('0x1')](_0x9427('0x2'),{'body':_0x594cbc,'options':{'where':{'id':_0x218ae7}},'log':_0x9427('0x3')});};exports[_0x9427('0x4')]=function(_0x54cdfb,_0x426911){return client['Request'](_0x9427('0x5'),{'body':_0x426911,'options':{'where':{'id':_0x54cdfb}},'log':_0x9427('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 00bbb75..c173045 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 _0xff35=['CreateWhatsappMessage','../client','create','Request'];(function(_0x4bf362,_0x43047d){var _0x4b7596=function(_0x594d0c){while(--_0x594d0c){_0x4bf362['push'](_0x4bf362['shift']());}};_0x4b7596(++_0x43047d);}(_0xff35,0x1d9));var _0x5ff3=function(_0x46c91d,_0x1c57a5){_0x46c91d=_0x46c91d-0x0;var _0x8d029e=_0xff35[_0x46c91d];return _0x8d029e;};'use strict';var client=require(_0x5ff3('0x0'));exports[_0x5ff3('0x1')]=function(_0x55c9d0){return client[_0x5ff3('0x2')](_0x5ff3('0x3'),{'body':_0x55c9d0,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xa186=['createWhatsappMessage','../client','create','Request'];(function(_0x3a56e4,_0x15f3dc){var _0x25e507=function(_0x50aea6){while(--_0x50aea6){_0x3a56e4['push'](_0x3a56e4['shift']());}};_0x25e507(++_0x15f3dc);}(_0xa186,0x131));var _0x6a18=function(_0x3afa24,_0x59c669){_0x3afa24=_0x3afa24-0x0;var _0x23fa72=_0xa186[_0x3afa24];return _0x23fa72;};'use strict';var client=require(_0x6a18('0x0'));exports[_0x6a18('0x1')]=function(_0x42e8c3){return client[_0x6a18('0x2')]('CreateWhatsappMessage',{'body':_0x42e8c3,'log':_0x6a18('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index eb7c468..906a598 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 _0x08ef=['online','whatsappPause','getWhatsappQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x5b8685,_0x1a1c28){var _0xa3ef57=function(_0xa91aad){while(--_0xa91aad){_0x5b8685['push'](_0x5b8685['shift']());}};_0xa3ef57(++_0x1a1c28);}(_0x08ef,0x1e8));var _0xf08e=function(_0x10e638,_0x140545){_0x10e638=_0x10e638-0x0;var _0x5ae48d=_0x08ef[_0x10e638];return _0x5ae48d;};'use strict';var client=require('../client');exports[_0xf08e('0x0')]=function(){return function(){return client[_0xf08e('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xf08e('0x2'),_0xf08e('0x3'),_0xf08e('0x4')],'include':[{'model':_0xf08e('0x5'),'as':_0xf08e('0x6'),'attributes':['id',_0xf08e('0x2'),_0xf08e('0x7'),_0xf08e('0x8')]}]},'log':_0xf08e('0x0')});};}; \ No newline at end of file +var _0xa0b8=['Request','GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues'];(function(_0xcc750,_0x1a2e24){var _0x572a7f=function(_0x1a09d1){while(--_0x1a09d1){_0xcc750['push'](_0xcc750['shift']());}};_0x572a7f(++_0x1a2e24);}(_0xa0b8,0x199));var _0x8a0b=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xa0b8[_0x72a33d];return _0x2621d5;};'use strict';var client=require('../client');exports[_0x8a0b('0x0')]=function(){return function(){return client[_0x8a0b('0x1')](_0x8a0b('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8a0b('0x3'),_0x8a0b('0x4')],'include':[{'model':_0x8a0b('0x5'),'as':_0x8a0b('0x6'),'attributes':['id',_0x8a0b('0x7'),_0x8a0b('0x8'),_0x8a0b('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e1014dc..ef734dd 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 _0xb5a4=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb5a4,0xce));var _0x4b5a=function(_0x1fe231,_0x3e1162){_0x1fe231=_0x1fe231-0x0;var _0x56e7fc=_0xb5a4[_0x1fe231];return _0x56e7fc;};'use strict';var client=require(_0x4b5a('0x0'));exports['create']=function(_0x67077){return client[_0x4b5a('0x1')](_0x4b5a('0x2'),{'body':_0x67077,'log':'CreateWhatsappQueueReport'});};exports[_0x4b5a('0x3')]=function(_0x41a9b6,_0x6802bc){return client['Request'](_0x4b5a('0x4'),{'body':_0x6802bc,'options':{'where':{'uniqueid':_0x41a9b6},'order':[['id','DESC']],'limit':0x1},'log':_0x4b5a('0x4')});}; \ No newline at end of file +var _0x7dbe=['Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x5d099b,_0x4b2554){var _0x81ea1a=function(_0x50a4ff){while(--_0x50a4ff){_0x5d099b['push'](_0x5d099b['shift']());}};_0x81ea1a(++_0x4b2554);}(_0x7dbe,0x69));var _0xe7db=function(_0x5be89c,_0x185956){_0x5be89c=_0x5be89c-0x0;var _0x49083b=_0x7dbe[_0x5be89c];return _0x49083b;};'use strict';var client=require(_0xe7db('0x0'));exports['create']=function(_0x1345f9){return client['Request'](_0xe7db('0x1'),{'body':_0x1345f9,'log':_0xe7db('0x1')});};exports[_0xe7db('0x2')]=function(_0x1b090f,_0x4544af){return client[_0xe7db('0x3')](_0xe7db('0x4'),{'body':_0x4544af,'options':{'where':{'uniqueid':_0x1b090f},'order':[['id',_0xe7db('0x5')]],'limit':0x1},'log':_0xe7db('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 250eb99..1fa0f37 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 _0x3e79=['routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger'];(function(_0x5eb34c,_0x5bb176){var _0x458c4f=function(_0x55190f){while(--_0x55190f){_0x5eb34c['push'](_0x5eb34c['shift']());}};_0x458c4f(++_0x5bb176);}(_0x3e79,0x148));var _0x93e7=function(_0x293445,_0x4f8d84){_0x293445=_0x293445-0x0;var _0x35efe3=_0x3e79[_0x293445];return _0x35efe3;};'use strict';var schema=require(_0x93e7('0x0'));var _=require(_0x93e7('0x1'));var util=require(_0x93e7('0x2'));var seqqueue=require(_0x93e7('0x3'));var logger=require(_0x93e7('0x4'))(_0x93e7('0x5'));var strategy=require(_0x93e7('0x6'));var queue=schema({'name':{'type':_0x93e7('0x7'),'required':!![],'message':_0x93e7('0x8')},'timeout':{'type':_0x93e7('0x9'),'message':_0x93e7('0xa')}});function writeLog(_0x57fde1,_0xf39992,_0x4d18b0){return logger[_0x93e7('0xb')](util['format'](_0x93e7('0xc'),_0x57fde1,_0xf39992[_0x93e7('0xd')],_0x4d18b0));}function handleFindAgent(_0x14e734){return function(_0x35a81b){return _0x35a81b[_0x93e7('0xd')]['toLowerCase']()===_0x14e734[_0x93e7('0xe')]();};}exports[_0x93e7('0xf')]=function(_0x499f63,_0x3c009a,_0x3955b4,_0x4646ac){return function(_0x5de589){try{var _0x5cc2fc={'name':_0x3c009a[0x0],'timeout':_0x3c009a[0x1]};var _0x280875=queue[_0x93e7('0x0')](_0x5cc2fc,{'typecast':!![]});if(_0x280875[_0x93e7('0x10')]){logger[_0x93e7('0x11')](_0x93e7('0x12'),_0x499f63,_[_0x93e7('0x13')](_0x280875,'message')[_0x93e7('0x14')](',\x20'));_0x5de589[_0x93e7('0x15')]();}else{var _0x3d0b59=_[_0x93e7('0x16')](_0x3955b4[_0x93e7('0x17')],handleFindAgent(_0x5cc2fc[_0x93e7('0xd')]));if(_0x3d0b59){var _0x51546d=(_0x5cc2fc['timeout']||0xa)*0x3e8;var _0x4c0fe4,_0x36eb69;var _0x201d7f=seqqueue[_0x93e7('0x18')](_0x51546d);_0x201d7f['id']=_0x499f63;_0x201d7f['atimeout']=_0x51546d;_0x201d7f[_0x93e7('0x19')]=_0x4646ac[_0x93e7('0x19')];writeLog(_0x499f63,_0x3d0b59,util['format'](_0x93e7('0x1a'),_0x51546d));_0x3955b4[_0x93e7('0x1b')][_0x499f63]['on'](_0x93e7('0x1c'),function(){logger[_0x93e7('0xb')](_0x93e7('0x1d'),_0x499f63);clearTimeout(_0x36eb69);_0x36eb69=undefined;_0x201d7f[_0x93e7('0x1e')]();if(_0x3955b4[_0x93e7('0x1b')][_0x499f63]){delete _0x3955b4[_0x93e7('0x1b')][_0x499f63];}_0x5de589['stop']();});_0x3955b4[_0x93e7('0x1b')][_0x499f63]['on'](_0x93e7('0x1f'),function(){if(_0x3955b4['rules'][_0x499f63]){delete _0x3955b4[_0x93e7('0x1b')][_0x499f63];}});_0x36eb69=setTimeout(function(){logger[_0x93e7('0xb')]('[%s][AGENT]\x20ROUTING\x20END',_0x499f63);clearTimeout(_0x36eb69);_0x201d7f[_0x93e7('0x1e')]();_0x5de589[_0x93e7('0x20')]();},_0x51546d);strategy['agent'](_0x201d7f,_0x3d0b59,_0x3955b4,_0x4646ac);}else{logger['error'](_0x93e7('0x21'),_0x499f63,_0x5cc2fc[_0x93e7('0xd')]);_0x5de589['stop']();}}}catch(_0x4dd47b){console[_0x93e7('0x22')](_0x4dd47b);logger[_0x93e7('0x11')](_0x93e7('0x23'),_0x499f63,_0x4dd47b[_0x93e7('0x24')]);_0x5de589['stop']();}};}; \ No newline at end of file +var _0x84cd=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','stop','find','name','timeout','createQueue','atimeout','channel','START:%s','rules','end','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number'];(function(_0x1394ce,_0x127af0){var _0x33ac0b=function(_0x30c1ce){while(--_0x30c1ce){_0x1394ce['push'](_0x1394ce['shift']());}};_0x33ac0b(++_0x127af0);}(_0x84cd,0x17a));var _0xd84c=function(_0x41f2f3,_0x4e87fa){_0x41f2f3=_0x41f2f3-0x0;var _0xb77414=_0x84cd[_0x41f2f3];return _0xb77414;};'use strict';var schema=require(_0xd84c('0x0'));var _=require(_0xd84c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xd84c('0x2'))(_0xd84c('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd84c('0x4'),'required':!![],'message':_0xd84c('0x5')},'timeout':{'type':'number','message':_0xd84c('0x6')}});function writeLog(_0x411e76,_0x4d1b19,_0x40ae60){return logger[_0xd84c('0x7')](util[_0xd84c('0x8')](_0xd84c('0x9'),_0x411e76,_0x4d1b19['name'],_0x40ae60));}function handleFindAgent(_0x407001){return function(_0x314eaa){return _0x314eaa['name'][_0xd84c('0xa')]()===_0x407001[_0xd84c('0xa')]();};}exports[_0xd84c('0xb')]=function(_0x64ee0f,_0x4e0082,_0x5541d2,_0x58c5c0){return function(_0x206ca5){try{var _0x338152={'name':_0x4e0082[0x0],'timeout':_0x4e0082[0x1]};var _0x70df7b=queue[_0xd84c('0x0')](_0x338152,{'typecast':!![]});if(_0x70df7b[_0xd84c('0xc')]){logger['error'](_0xd84c('0xd'),_0x64ee0f,_[_0xd84c('0xe')](_0x70df7b,_0xd84c('0xf'))['join'](',\x20'));_0x206ca5[_0xd84c('0x10')]();}else{var _0x245278=_[_0xd84c('0x11')](_0x5541d2['agents'],handleFindAgent(_0x338152[_0xd84c('0x12')]));if(_0x245278){var _0x59d0d8=(_0x338152[_0xd84c('0x13')]||0xa)*0x3e8;var _0x1e402c,_0x9ac83d;var _0x4b46a9=seqqueue[_0xd84c('0x14')](_0x59d0d8);_0x4b46a9['id']=_0x64ee0f;_0x4b46a9[_0xd84c('0x15')]=_0x59d0d8;_0x4b46a9[_0xd84c('0x16')]=_0x58c5c0[_0xd84c('0x16')];writeLog(_0x64ee0f,_0x245278,util['format'](_0xd84c('0x17'),_0x59d0d8));_0x5541d2[_0xd84c('0x18')][_0x64ee0f]['on'](_0xd84c('0x19'),function(){logger[_0xd84c('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x64ee0f);clearTimeout(_0x9ac83d);_0x9ac83d=undefined;_0x4b46a9['close']();if(_0x5541d2[_0xd84c('0x18')][_0x64ee0f]){delete _0x5541d2[_0xd84c('0x18')][_0x64ee0f];}_0x206ca5['stop']();});_0x5541d2[_0xd84c('0x18')][_0x64ee0f]['on'](_0xd84c('0x1a'),function(){if(_0x5541d2[_0xd84c('0x18')][_0x64ee0f]){delete _0x5541d2['rules'][_0x64ee0f];}});_0x9ac83d=setTimeout(function(){logger[_0xd84c('0x7')](_0xd84c('0x1b'),_0x64ee0f);clearTimeout(_0x9ac83d);_0x4b46a9['close']();_0x206ca5[_0xd84c('0x1c')]();},_0x59d0d8);strategy[_0xd84c('0x1d')](_0x4b46a9,_0x245278,_0x5541d2,_0x58c5c0);}else{logger[_0xd84c('0x1e')](_0xd84c('0x1f'),_0x64ee0f,_0x338152[_0xd84c('0x12')]);_0x206ca5[_0xd84c('0x10')]();}}}catch(_0x3cc209){console[_0xd84c('0x20')](_0x3cc209);logger[_0xd84c('0x1e')](_0xd84c('0x21'),_0x64ee0f,_0x3cc209[_0xd84c('0x22')]);_0x206ca5[_0xd84c('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f181735..48c0999 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 _0x2189=['../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','out','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','Message','create','then','catch','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x4644cc,_0x28b79b){var _0x5a4ace=function(_0xadf86e){while(--_0xadf86e){_0x4644cc['push'](_0x4644cc['shift']());}};_0x5a4ace(++_0x28b79b);}(_0x2189,0x1c4));var _0x9218=function(_0x168d53,_0x31c57d){_0x168d53=_0x168d53-0x0;var _0xc8a663=_0x2189[_0x168d53];return _0xc8a663;};'use strict';var _=require(_0x9218('0x0'));var moment=require(_0x9218('0x1'));var AWS=require(_0x9218('0x2'));var utils=require(_0x9218('0x3'));var logger=require(_0x9218('0x4'))(_0x9218('0x5'));var rpc={'chatMessage':require(_0x9218('0x6')),'openchannelMessage':require(_0x9218('0x7')),'mailMessage':require(_0x9218('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9218('0x9')),'whatsappMessage':require(_0x9218('0xa'))};exports[_0x9218('0xb')]=function(_0x174401,_0x4947ec){return function(_0x19fc82){try{if(!_[_0x9218('0xc')](this[_0x9218('0xd')][_0x9218('0xe')])){logger[_0x9218('0xf')](_0x9218('0x10'),_0x174401,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x19fc82[_0x9218('0x11')]();}var _0x59683f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9218('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9218('0x13')};if(this[_0x9218('0x14')]==='sms'||this['channel']==='whatsapp'){_0x59683f[_0x9218('0x15')]=this[_0x9218('0xd')][_0x9218('0x15')];}var _0x3d0ce8=this[_0x9218('0x14')];if(_0x3d0ce8==='chat'){_0x59683f[_0x9218('0x16')]=this[_0x9218('0x17')]['id'];}else{_0x59683f[_[_0x9218('0x18')](_0x3d0ce8)+_0x9218('0x19')]=this[_0x9218('0x17')]['id'];}_0x59683f[_['upperFirst'](_0x3d0ce8)+_0x9218('0x1a')]=this[_0x9218('0xd')]['id'];if(this['interaction'][_0x9218('0x1b')]){var _0x59092b=_0x4947ec[0x4];if(!_['isEmpty'](_0x59092b)){_0x59683f[_0x9218('0x1c')]=utils['getMustacheRender'](_0x59092b,this);return rpc[_0x3d0ce8+_0x9218('0x1d')][_0x9218('0x1e')](_0x59683f)[_0x9218('0x1f')](function(_0x3aca0e){logger['info'](_0x9218('0x10'),_0x174401,_0x59683f[_0x9218('0x1c')]);})[_0x9218('0x20')](function(_0xc748d3){logger[_0x9218('0x21')](_0x9218('0x10'),_0x174401,JSON[_0x9218('0x22')](_0xc748d3));})['finally'](function(){logger[_0x9218('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x174401);_0x19fc82[_0x9218('0x23')]();});}else{logger[_0x9218('0xf')](_0x9218('0x24'),_0x174401);_0x19fc82['stop']();}}else{var _0x985c2d=this;var _0x2fa8aa=new AWS[(_0x9218('0x25'))]({'accessKeyId':_0x4947ec[0x0],'secretAccessKey':_0x4947ec[0x1],'region':_0x4947ec[0x2]});var _0x57dba1={'botAlias':_0x9218('0x26'),'botName':_0x4947ec[0x3],'inputText':this[_0x9218('0x27')][_0x9218('0x1c')],'userId':this[_0x9218('0x14')]+':'+this[_0x9218('0xd')]['id'][_0x9218('0x28')]()};_0x2fa8aa[_0x9218('0x29')](_0x57dba1,function(_0x1da5c6,_0x1fd699){if(_0x1da5c6){logger[_0x9218('0x21')](_0x9218('0x10'),_0x174401,_0x1da5c6[_0x9218('0x27')]);_0x19fc82['next']();}else if(_0x1fd699&&_0x1fd699[_0x9218('0x27')]){_0x985c2d['body'][_0x9218('0x2a')]=_0x1fd699;_0x59683f[_0x9218('0x1c')]=_0x1fd699[_0x9218('0x27')];_0x59683f[_0x9218('0x2b')]='amazonlex';_0x59683f[_0x9218('0x2c')]=JSON[_0x9218('0x22')](_0x1fd699);return rpc[_0x3d0ce8+_0x9218('0x1d')][_0x9218('0x1e')](_0x59683f)[_0x9218('0x1f')](function(_0x97222d){logger[_0x9218('0xf')](_0x9218('0x10'),_0x174401,_0x59683f[_0x9218('0x1c')]);if(_0x1fd699['dialogState']==_0x9218('0x2d')){_0x19fc82['next']();}else{_0x19fc82[_0x9218('0x23')]();}})[_0x9218('0x20')](function(_0x5b0ae4){logger[_0x9218('0x21')](_0x9218('0x10'),_0x174401,JSON[_0x9218('0x22')](_0x5b0ae4));_0x19fc82[_0x9218('0x11')]();});}else{_0x19fc82['next']();}});}}catch(_0x567bdb){logger[_0x9218('0x21')](_0x9218('0x10'),_0x174401,JSON['stringify'](_0x567bdb));_0x19fc82[_0x9218('0x23')]();}};}; \ No newline at end of file +var _0x1d6a=['upperFirst','isEmpty','create','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','$LATEST','message','body','amazonlex','providerName','providerResponse','stringify','Message','then','dialogState','Failed','stop','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account'];(function(_0x51eb34,_0x4437f2){var _0x3caa5e=function(_0x41f2c5){while(--_0x41f2c5){_0x51eb34['push'](_0x51eb34['shift']());}};_0x3caa5e(++_0x4437f2);}(_0x1d6a,0x148));var _0xa1d6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1d6a[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xa1d6('0x0'));var moment=require(_0xa1d6('0x1'));var AWS=require(_0xa1d6('0x2'));var utils=require(_0xa1d6('0x3'));var logger=require(_0xa1d6('0x4'))(_0xa1d6('0x5'));var rpc={'chatMessage':require(_0xa1d6('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa1d6('0x7')),'smsMessage':require(_0xa1d6('0x8')),'faxMessage':require(_0xa1d6('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa1d6('0xa')]=function(_0x2b26cb,_0x27d351){return function(_0x3be6a2){try{if(!_['isNil'](this[_0xa1d6('0xb')][_0xa1d6('0xc')])){logger[_0xa1d6('0xd')](_0xa1d6('0xe'),_0x2b26cb,_0xa1d6('0xf'));return _0x3be6a2[_0xa1d6('0x10')]();}var _0x349ad5={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xa1d6('0x11')),'direction':_0xa1d6('0x12')};if(this[_0xa1d6('0x13')]===_0xa1d6('0x14')||this[_0xa1d6('0x13')]==='whatsapp'){_0x349ad5[_0xa1d6('0x15')]=this[_0xa1d6('0xb')]['phone'];}var _0x503323=this[_0xa1d6('0x13')];if(_0x503323==='chat'){_0x349ad5[_0xa1d6('0x16')]=this[_0xa1d6('0x17')]['id'];}else{_0x349ad5[_[_0xa1d6('0x18')](_0x503323)+'AccountId']=this[_0xa1d6('0x17')]['id'];}_0x349ad5[_['upperFirst'](_0x503323)+'InteractionId']=this[_0xa1d6('0xb')]['id'];if(this[_0xa1d6('0xb')]['created']){var _0x4ee202=_0x27d351[0x4];if(!_[_0xa1d6('0x19')](_0x4ee202)){_0x349ad5['body']=utils['getMustacheRender'](_0x4ee202,this);return rpc[_0x503323+'Message'][_0xa1d6('0x1a')](_0x349ad5)['then'](function(_0x5aaf3d){logger[_0xa1d6('0xd')](_0xa1d6('0xe'),_0x2b26cb,_0x349ad5['body']);})['catch'](function(_0x44355){logger[_0xa1d6('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x2b26cb,JSON['stringify'](_0x44355));})[_0xa1d6('0x1c')](function(){logger['info'](_0xa1d6('0x1d'),_0x2b26cb);_0x3be6a2['stop']();});}else{logger[_0xa1d6('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2b26cb);_0x3be6a2['stop']();}}else{var _0x454189=this;var _0x174905=new AWS[(_0xa1d6('0x1e'))]({'accessKeyId':_0x27d351[0x0],'secretAccessKey':_0x27d351[0x1],'region':_0x27d351[0x2]});var _0x3a9f34={'botAlias':_0xa1d6('0x1f'),'botName':_0x27d351[0x3],'inputText':this[_0xa1d6('0x20')][_0xa1d6('0x21')],'userId':this[_0xa1d6('0x13')]+':'+this[_0xa1d6('0xb')]['id']['toString']()};_0x174905['postText'](_0x3a9f34,function(_0x5388e1,_0x334582){if(_0x5388e1){logger[_0xa1d6('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x2b26cb,_0x5388e1[_0xa1d6('0x20')]);_0x3be6a2['next']();}else if(_0x334582&&_0x334582[_0xa1d6('0x20')]){_0x454189[_0xa1d6('0x21')][_0xa1d6('0x22')]=_0x334582;_0x349ad5['body']=_0x334582[_0xa1d6('0x20')];_0x349ad5[_0xa1d6('0x23')]=_0xa1d6('0x22');_0x349ad5[_0xa1d6('0x24')]=JSON[_0xa1d6('0x25')](_0x334582);return rpc[_0x503323+_0xa1d6('0x26')][_0xa1d6('0x1a')](_0x349ad5)[_0xa1d6('0x27')](function(_0x581967){logger[_0xa1d6('0xd')](_0xa1d6('0xe'),_0x2b26cb,_0x349ad5['body']);if(_0x334582[_0xa1d6('0x28')]==_0xa1d6('0x29')){_0x3be6a2[_0xa1d6('0x10')]();}else{_0x3be6a2[_0xa1d6('0x2a')]();}})[_0xa1d6('0x2b')](function(_0x5f0ca3){logger[_0xa1d6('0x1b')](_0xa1d6('0xe'),_0x2b26cb,JSON[_0xa1d6('0x25')](_0x5f0ca3));_0x3be6a2['next']();});}else{_0x3be6a2['next']();}});}}catch(_0xb428f8){logger[_0xa1d6('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x2b26cb,JSON[_0xa1d6('0x25')](_0xb428f8));_0x3be6a2[_0xa1d6('0x2a')]();}};}; \ 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 4da8b6f..fd988a3 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 _0x61fa=['../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','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','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','inReplyTo','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','stop','moment','./utils'];(function(_0x9a267b,_0x3d7ca5){var _0x245824=function(_0x39444b){while(--_0x39444b){_0x9a267b['push'](_0x9a267b['shift']());}};_0x245824(++_0x3d7ca5);}(_0x61fa,0x196));var _0xa61f=function(_0x314f95,_0x33f646){_0x314f95=_0x314f95-0x0;var _0x397feb=_0x61fa[_0x314f95];return _0x397feb;};'use strict';var _=require('lodash');var moment=require(_0xa61f('0x0'));var utils=require(_0xa61f('0x1'));var logger=require(_0xa61f('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa61f('0x3')),'smsMessage':require(_0xa61f('0x4')),'faxMessage':require(_0xa61f('0x5')),'whatsappMessage':require(_0xa61f('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xa61f('0x7')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xa61f('0x8')),'faxInteraction':require(_0xa61f('0x9')),'whatsappInteraction':require(_0xa61f('0xa'))};var mailRpc=require(_0xa61f('0xb'));exports[_0xa61f('0xc')]=function(_0x339207,_0x115178,_0x80029b,_0x4efb95){return function(_0x46df3f){try{var _0x125ba9=this[_0xa61f('0xd')];if(_0x125ba9===_0xa61f('0xe')&&_0x4efb95[_0xa61f('0xf')][_0xa61f('0x10')]){logger[_0xa61f('0x11')](_0xa61f('0x12'),_0x339207,_0xa61f('0x13'));return _0x46df3f[_0xa61f('0x14')]();}if(_0x115178[0x0]==='1'&&(_['isNil'](this[_0xa61f('0x15')][_0xa61f('0x16')])||!this[_0xa61f('0x15')][_0xa61f('0x16')])){logger[_0xa61f('0x11')](_0xa61f('0x12'),_0x339207,_0xa61f('0x17'));return _0x46df3f[_0xa61f('0x14')]();}if(_0x115178[0x0]==='2'&&this[_0xa61f('0x15')][_0xa61f('0x18')]){logger['info'](_0xa61f('0x19'),_0x339207,_0xa61f('0x1a'));return _0x46df3f[_0xa61f('0x14')]();}var _0x492f61={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa61f('0x1b')](_0xa61f('0x1c')),'direction':'out'};if(this['channel']==='mail'){_0x492f61['body']=utils[_0xa61f('0x1d')](_0x115178[0x2],this);}else{_0x492f61[_0xa61f('0xf')]=utils[_0xa61f('0x1d')](_0x115178[0x1],this);}if(this[_0xa61f('0x1e')]){_0x492f61['to']=this[_0xa61f('0x1e')][_0xa61f('0x1f')]||'';if(this['channel']===_0xa61f('0xe')&&_0x115178[0x1]==='1'){_0x492f61['cc']=this[_0xa61f('0x1e')]['cc']||'';}_0x492f61[_0xa61f('0x1f')]=this['message']['to']||'';_0x492f61[_0xa61f('0x20')]=this[_0xa61f('0x1e')][_0xa61f('0x20')]||'';_0x492f61[_0xa61f('0x21')]=!![];if(this[_0xa61f('0x1e')][_0xa61f('0x22')]){_0x492f61['subject']='';_0x492f61[_0xa61f('0x22')]+=_['startsWith'](this[_0xa61f('0x1e')][_0xa61f('0x22')],_0xa61f('0x23'))?'':_0xa61f('0x24');_0x492f61['subject']+=this['message'][_0xa61f('0x22')];}}if(this[_0xa61f('0xd')]==='chat'){_0x492f61[_0xa61f('0x25')]=this['account']['id'];}else{_0x492f61[_['upperFirst'](this[_0xa61f('0xd')])+_0xa61f('0x26')]=this[_0xa61f('0x27')]['id'];}_0x492f61[_[_0xa61f('0x28')](this[_0xa61f('0xd')])+_0xa61f('0x29')]=this['interaction']['id'];var _0x160092=this[_0xa61f('0x15')];if(rpc[this[_0xa61f('0xd')]+_0xa61f('0x2a')]){if(this[_0xa61f('0xd')]==='mail'){_0x492f61[_0xa61f('0x2b')]=this[_0xa61f('0x1e')]['messageId'];_0x492f61[_0xa61f('0x2c')]=_0xa61f('0x2d')+_[_0xa61f('0x2e')](_0x492f61[_0xa61f('0xf')],'','replace','';_0x97b054['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0xf18c('0x30')](this[_0xf18c('0x28')][_0xf18c('0x31')],_0x97b054)[_0xf18c('0x32')](function(_0x3d149d){logger[_0xf18c('0x10')](_0xf18c('0x33'),_0x2df126);_0x97b054[_0xf18c('0x2b')]=_0x3d149d[_0xf18c('0x20')][_0xf18c('0x2b')];return rpc[_0x5062c5+'Message']['create'](_0x97b054);})[_0xf18c('0x32')](function(_0xe2fd77){logger['info'](_0xf18c('0x11'),_0x2df126,JSON[_0xf18c('0x34')](_0xe2fd77));})[_0xf18c('0x35')](function(_0x25ba06){logger[_0xf18c('0x36')]('[RPC][%s][AUTOREPLY]\x20%s',_0x2df126,JSON[_0xf18c('0x34')](_0x25ba06));})[_0xf18c('0x37')](function(){Promise[_0xf18c('0x38')]()[_0xf18c('0x32')](function(){if(_0x3ee3dd[0x0]!=='2'||_0x338eb2['autoreplyExecuted'])return;return rpc[_0x5062c5+_0xf18c('0x39')][_0xf18c('0x3a')](_0x338eb2['id'],{'autoreplyExecuted':!![]})[_0xf18c('0x32')](function(_0x455f49){logger[_0xf18c('0x10')](_0xf18c('0x19'),_0x2df126,JSON[_0xf18c('0x34')](_0x455f49));})[_0xf18c('0x35')](function(_0x1f0e28){logger[_0xf18c('0x36')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2df126,JSON['stringify'](_0x1f0e28));});})[_0xf18c('0x32')](function(){_0x3e482e[_0xf18c('0x13')]();});});}else{return rpc[this['channel']+_0xf18c('0x3b')]['create'](_0x97b054)[_0xf18c('0x32')](function(){logger[_0xf18c('0x10')](_0xf18c('0x11'),_0x2df126,_0x97b054[_0xf18c('0xe')]);})[_0xf18c('0x35')](function(_0x321121){logger['error']('[%s][AUTOREPLY]\x20%s',_0x2df126,JSON[_0xf18c('0x34')](_0x321121));})[_0xf18c('0x37')](function(){Promise['resolve']()[_0xf18c('0x32')](function(){if(_0x3ee3dd[0x0]!=='2'||_0x338eb2[_0xf18c('0x18')])return;return rpc[_0x5062c5+'Interaction']['update'](_0x338eb2['id'],{'autoreplyExecuted':!![]})[_0xf18c('0x32')](function(_0x587be7){logger[_0xf18c('0x10')](_0xf18c('0x19'),_0x2df126,JSON[_0xf18c('0x34')](_0x587be7));})[_0xf18c('0x35')](function(_0x963f61){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2df126,JSON[_0xf18c('0x34')](_0x963f61));});})[_0xf18c('0x32')](function(){_0x3e482e['next']();});});}}}catch(_0x2647ba){logger[_0xf18c('0x36')](_0xf18c('0x11'),_0x2df126,JSON[_0xf18c('0x34')](_0x2647ba));_0x3e482e[_0xf18c('0x3c')]();}};}; \ 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 45fcb8c..0f6bcf4 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 _0x0ce0=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x0ce0,0x1f4));var _0x00ce=function(_0x466186,_0x2276fb){_0x466186=_0x466186-0x0;var _0x1ee9af=_0x0ce0[_0x466186];return _0x1ee9af;};'use strict';var moment=require(_0x00ce('0x0'));var logger=require(_0x00ce('0x1'))(_0x00ce('0x2'));var rpc={'chatInteraction':require(_0x00ce('0x3')),'openchannelInteraction':require(_0x00ce('0x4')),'smsInteraction':require(_0x00ce('0x5')),'mailInteraction':require(_0x00ce('0x6')),'faxInteraction':require(_0x00ce('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x2a1ce7,_0x6b6fb4,_0x1db688,_0x31579b){return function(_0x49b1ef){try{logger['info'](_0x00ce('0x8'),_0x2a1ce7,_0x6b6fb4[0x0]);var _0x5aa041={'closed':0x1,'closedAt':moment()[_0x00ce('0x9')](_0x00ce('0xa')),'closeReason':_0x00ce('0xb'),'disposition':_0x6b6fb4[0x0]};if(rpc[_0x31579b[_0x00ce('0xc')]+_0x00ce('0xd')]){rpc[_0x31579b[_0x00ce('0xc')]+_0x00ce('0xd')][_0x00ce('0xe')](_0x31579b[_0x00ce('0xf')]['id'],_0x5aa041)[_0x00ce('0x10')](function(_0x2168ee){logger[_0x00ce('0x11')](_0x00ce('0x12'),_0x2a1ce7,_0x31579b[_0x00ce('0xf')]['id']);})[_0x00ce('0x13')](function(_0x380a3d){logger[_0x00ce('0x14')](_0x00ce('0x15'),_0x2a1ce7,JSON['stringify'](_0x380a3d));})[_0x00ce('0x16')](function(){_0x49b1ef[_0x00ce('0x17')]();});}}catch(_0x2086d8){logger['error'](_0x00ce('0x15'),_0x2a1ce7,JSON[_0x00ce('0x18')](_0x2086d8));_0x49b1ef[_0x00ce('0x17')]();}};}; \ No newline at end of file +var _0xd1bb=['stringify','stop','[%s][CLOSE]\x20%s','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction'];(function(_0x404b9a,_0xca0480){var _0x30ba61=function(_0x1cdde1){while(--_0x1cdde1){_0x404b9a['push'](_0x404b9a['shift']());}};_0x30ba61(++_0xca0480);}(_0xd1bb,0x12f));var _0xbd1b=function(_0x244f8a,_0x55ed63){_0x244f8a=_0x244f8a-0x0;var _0x1d805e=_0xd1bb[_0x244f8a];return _0x1d805e;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xbd1b('0x0'));var rpc={'chatInteraction':require(_0xbd1b('0x1')),'openchannelInteraction':require(_0xbd1b('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xbd1b('0x3')),'faxInteraction':require(_0xbd1b('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xbd1b('0x5')]=function(_0x418eba,_0x3f6e31,_0xde8e15,_0x23836c){return function(_0x46e051){try{logger['info'](_0xbd1b('0x6'),_0x418eba,_0x3f6e31[0x0]);var _0x3e8d31={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x3f6e31[0x0]};if(rpc[_0x23836c[_0xbd1b('0x7')]+_0xbd1b('0x8')]){rpc[_0x23836c[_0xbd1b('0x7')]+_0xbd1b('0x8')]['update'](_0x23836c['interaction']['id'],_0x3e8d31)[_0xbd1b('0x9')](function(_0x3b6e04){logger['info'](_0xbd1b('0xa'),_0x418eba,_0x23836c[_0xbd1b('0xb')]['id']);})['catch'](function(_0x3fb9cc){logger['error']('[%s][CLOSE]\x20%s',_0x418eba,JSON[_0xbd1b('0xc')](_0x3fb9cc));})['finally'](function(){_0x46e051[_0xbd1b('0xd')]();});}}catch(_0x4474c8){logger['error'](_0xbd1b('0xe'),_0x418eba,JSON[_0xbd1b('0xc')](_0x4474c8));_0x46e051['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 3814ef6..f9dcc9b 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 _0x0af5=['isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','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','dialogflow','fulfillment','speech','providerResponse','result','metadata','endConversation','catch','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','account','AccountId'];(function(_0x4b1be7,_0x37bf35){var _0x5155b8=function(_0x3eb2d8){while(--_0x3eb2d8){_0x4b1be7['push'](_0x4b1be7['shift']());}};_0x5155b8(++_0x37bf35);}(_0x0af5,0x158));var _0x50af=function(_0x4bc532,_0x2221f9){_0x4bc532=_0x4bc532-0x0;var _0x4f70af=_0x0af5[_0x4bc532];return _0x4f70af;};'use strict';var _=require('lodash');var moment=require(_0x50af('0x0'));var apiai=require(_0x50af('0x1'));var md5=require(_0x50af('0x2'));var utils=require(_0x50af('0x3'));var logger=require(_0x50af('0x4'))(_0x50af('0x5'));var rpc={'chatMessage':require(_0x50af('0x6')),'openchannelMessage':require(_0x50af('0x7')),'mailMessage':require(_0x50af('0x8')),'smsMessage':require(_0x50af('0x9')),'faxMessage':require(_0x50af('0xa')),'whatsappMessage':require(_0x50af('0xb'))};exports['consequence']=function(_0x5a5c0a,_0x3724ed){return function(_0x120038){try{if(!_['isNil'](this['interaction'][_0x50af('0xc')])){logger[_0x50af('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x5a5c0a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x120038[_0x50af('0xe')]();}var _0x8298e8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x50af('0xf')](_0x50af('0x10')),'direction':_0x50af('0x11')};if(this[_0x50af('0x12')]==='sms'||this[_0x50af('0x12')]===_0x50af('0x13')){_0x8298e8[_0x50af('0x14')]=this[_0x50af('0x15')][_0x50af('0x14')];}var _0x38bac0=this['channel'];if(_0x38bac0==='chat'){_0x8298e8['ChatWebsiteId']=this[_0x50af('0x16')]['id'];}else{_0x8298e8[_['upperFirst'](_0x38bac0)+_0x50af('0x17')]=this[_0x50af('0x16')]['id'];}_0x8298e8[_['upperFirst'](_0x38bac0)+'InteractionId']=this[_0x50af('0x15')]['id'];if(this[_0x50af('0x15')]['created']){var _0x4b0775=_0x3724ed[0x2];if(!_[_0x50af('0x18')](_0x4b0775)){_0x8298e8[_0x50af('0x19')]=utils[_0x50af('0x1a')](_0x4b0775,this);return rpc[_0x38bac0+_0x50af('0x1b')][_0x50af('0x1c')](_0x8298e8)[_0x50af('0x1d')](function(_0x23bad2){logger[_0x50af('0xd')](_0x50af('0x1e'),_0x5a5c0a,_0x8298e8[_0x50af('0x19')]);})['catch'](function(_0x3f1dbe){logger[_0x50af('0x1f')](_0x50af('0x1e'),_0x5a5c0a,JSON[_0x50af('0x20')](_0x3f1dbe));})['finally'](function(){logger[_0x50af('0xd')](_0x50af('0x21'),_0x5a5c0a);_0x120038[_0x50af('0x22')]();});}else{logger[_0x50af('0xd')](_0x50af('0x23'),_0x5a5c0a);_0x120038[_0x50af('0x22')]();}}else{var _0x2d093c=this;var _0xb6de0d=apiai(_0x3724ed[0x0],{'language':_0x3724ed[0x1]||'en'});return _0xb6de0d[_0x50af('0x24')](this[_0x50af('0x25')]['body'],{'sessionId':md5(this[_0x50af('0x15')]['id'])})[_0x50af('0x1d')](function(_0x3c6388){_0x2d093c[_0x50af('0x19')][_0x50af('0x26')]=_0x3c6388;_0x8298e8[_0x50af('0x19')]=_0x3c6388['result'][_0x50af('0x27')][_0x50af('0x28')];_0x8298e8['providerName']=_0x50af('0x26');_0x8298e8[_0x50af('0x29')]=JSON[_0x50af('0x20')](_0x3c6388);return rpc[_0x38bac0+'Message']['create'](_0x8298e8)[_0x50af('0x1d')](function(_0x1bb3fc){logger[_0x50af('0xd')](_0x50af('0x1e'),_0x5a5c0a,_0x8298e8[_0x50af('0x19')]);if(_0x3c6388[_0x50af('0x2a')][_0x50af('0x2b')][_0x50af('0x2c')]){_0x120038['next']();}else{_0x120038[_0x50af('0x22')]();}})[_0x50af('0x2d')](function(_0x4118af){logger['error'](_0x50af('0x1e'),_0x5a5c0a,JSON['stringify'](_0x4118af));_0x120038[_0x50af('0xe')]();});})['catch'](function(_0x4a6ea4){logger['error'](_0x50af('0x1e'),_0x5a5c0a,_0x4a6ea4[_0x50af('0x25')]);_0x120038[_0x50af('0xe')]();});}}catch(_0x396eab){logger[_0x50af('0x1f')](_0x50af('0x1e'),_0x5a5c0a,JSON[_0x50af('0x20')](_0x396eab));_0x120038[_0x50af('0x22')]();}};}; \ No newline at end of file +var _0x9bdb=['channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','speech','providerName','dialogflow','providerResponse','endConversation','catch','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x2cce9d,_0x510954){_0x2cce9d=_0x2cce9d-0x0;var _0x477a71=_0x9bdb[_0x2cce9d];return _0x477a71;};'use strict';var _=require(_0xb9bd('0x0'));var moment=require(_0xb9bd('0x1'));var apiai=require(_0xb9bd('0x2'));var md5=require(_0xb9bd('0x3'));var utils=require('./utils');var logger=require(_0xb9bd('0x4'))(_0xb9bd('0x5'));var rpc={'chatMessage':require(_0xb9bd('0x6')),'openchannelMessage':require(_0xb9bd('0x7')),'mailMessage':require(_0xb9bd('0x8')),'smsMessage':require(_0xb9bd('0x9')),'faxMessage':require(_0xb9bd('0xa')),'whatsappMessage':require(_0xb9bd('0xb'))};exports['consequence']=function(_0x446081,_0x5bdc32){return function(_0x4c287b){try{if(!_[_0xb9bd('0xc')](this[_0xb9bd('0xd')]['UserId'])){logger[_0xb9bd('0xe')](_0xb9bd('0xf'),_0x446081,_0xb9bd('0x10'));return _0x4c287b[_0xb9bd('0x11')]();}var _0x198f12={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xb9bd('0x12')),'direction':_0xb9bd('0x13')};if(this[_0xb9bd('0x14')]==='sms'||this['channel']===_0xb9bd('0x15')){_0x198f12[_0xb9bd('0x16')]=this['interaction'][_0xb9bd('0x16')];}var _0x19536f=this[_0xb9bd('0x14')];if(_0x19536f==='chat'){_0x198f12[_0xb9bd('0x17')]=this[_0xb9bd('0x18')]['id'];}else{_0x198f12[_[_0xb9bd('0x19')](_0x19536f)+'AccountId']=this['account']['id'];}_0x198f12[_[_0xb9bd('0x19')](_0x19536f)+'InteractionId']=this[_0xb9bd('0xd')]['id'];if(this['interaction'][_0xb9bd('0x1a')]){var _0x1ad774=_0x5bdc32[0x2];if(!_[_0xb9bd('0x1b')](_0x1ad774)){_0x198f12[_0xb9bd('0x1c')]=utils[_0xb9bd('0x1d')](_0x1ad774,this);return rpc[_0x19536f+_0xb9bd('0x1e')][_0xb9bd('0x1f')](_0x198f12)[_0xb9bd('0x20')](function(_0x2c5bee){logger[_0xb9bd('0xe')](_0xb9bd('0xf'),_0x446081,_0x198f12['body']);})['catch'](function(_0x1b1103){logger[_0xb9bd('0x21')](_0xb9bd('0xf'),_0x446081,JSON[_0xb9bd('0x22')](_0x1b1103));})[_0xb9bd('0x23')](function(){logger['info'](_0xb9bd('0x24'),_0x446081);_0x4c287b[_0xb9bd('0x25')]();});}else{logger[_0xb9bd('0xe')](_0xb9bd('0x26'),_0x446081);_0x4c287b[_0xb9bd('0x25')]();}}else{var _0x276d85=this;var _0x4657cb=apiai(_0x5bdc32[0x0],{'language':_0x5bdc32[0x1]||'en'});return _0x4657cb[_0xb9bd('0x27')](this[_0xb9bd('0x28')]['body'],{'sessionId':md5(this[_0xb9bd('0xd')]['id'])})[_0xb9bd('0x20')](function(_0x52e526){_0x276d85['body']['dialogflow']=_0x52e526;_0x198f12[_0xb9bd('0x1c')]=_0x52e526[_0xb9bd('0x29')]['fulfillment'][_0xb9bd('0x2a')];_0x198f12[_0xb9bd('0x2b')]=_0xb9bd('0x2c');_0x198f12[_0xb9bd('0x2d')]=JSON[_0xb9bd('0x22')](_0x52e526);return rpc[_0x19536f+_0xb9bd('0x1e')][_0xb9bd('0x1f')](_0x198f12)[_0xb9bd('0x20')](function(_0x2647a5){logger[_0xb9bd('0xe')](_0xb9bd('0xf'),_0x446081,_0x198f12[_0xb9bd('0x1c')]);if(_0x52e526['result']['metadata'][_0xb9bd('0x2e')]){_0x4c287b[_0xb9bd('0x11')]();}else{_0x4c287b[_0xb9bd('0x25')]();}})[_0xb9bd('0x2f')](function(_0x11b727){logger[_0xb9bd('0x21')](_0xb9bd('0xf'),_0x446081,JSON[_0xb9bd('0x22')](_0x11b727));_0x4c287b[_0xb9bd('0x11')]();});})['catch'](function(_0x2521c0){logger[_0xb9bd('0x21')](_0xb9bd('0xf'),_0x446081,_0x2521c0[_0xb9bd('0x28')]);_0x4c287b['next']();});}}catch(_0x2c0fdc){logger['error'](_0xb9bd('0xf'),_0x446081,JSON[_0xb9bd('0x22')](_0x2c0fdc));_0x4c287b[_0xb9bd('0x25')]();}};}; \ 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 7cdd541..bdf455c 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 _0x6d66=['consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','stringify','fulfillmentText','push','all','stack','lodash','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x6d66,0x115));var _0x66d6=function(_0x6b515b,_0x5a7fd6){_0x6b515b=_0x6b515b-0x0;var _0x4dc2cd=_0x6d66[_0x6b515b];return _0x4dc2cd;};'use strict';var _=require(_0x66d6('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x66d6('0x1'));var Promise=require(_0x66d6('0x2'));var logger=require('../../../../config/logger')(_0x66d6('0x3'));var utils=require(_0x66d6('0x4'));var rpc={'chatMessage':require(_0x66d6('0x5')),'openchannelMessage':require(_0x66d6('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x66d6('0x7')),'faxMessage':require(_0x66d6('0x8')),'whatsappMessage':require(_0x66d6('0x9'))};function createMessage(_0x2e5588,_0x278e34,_0x3e12ae,_0x93869d){return new Promise(function(_0x51173e,_0x589c55){var _0x315a42=_[_0x66d6('0xa')](_0x3e12ae);_0x315a42[_0x66d6('0xb')]=_0x93869d;return rpc[_0x278e34+_0x66d6('0xc')][_0x66d6('0xd')](_0x315a42)[_0x66d6('0xe')](function(){logger[_0x66d6('0xf')](_0x66d6('0x10'),_0x2e5588,_0x315a42[_0x66d6('0xb')]);_0x51173e();})[_0x66d6('0x11')](function(_0x46e82f){logger[_0x66d6('0x12')](_0x66d6('0x10'),_0x2e5588,JSON['stringify'](_0x46e82f));_0x589c55(_0x46e82f);});});}exports[_0x66d6('0x13')]=function(_0x3ac489,_0x337ac4){return function(_0x57bec7){try{if(!_[_0x66d6('0x14')](this[_0x66d6('0x15')][_0x66d6('0x16')])){logger[_0x66d6('0xf')](_0x66d6('0x10'),_0x3ac489,_0x66d6('0x17'));return _0x57bec7[_0x66d6('0x18')]();}var _0x11f828={'ContactId':this[_0x66d6('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x66d6('0x1a')};if(this[_0x66d6('0x1b')]===_0x66d6('0x1c')||this[_0x66d6('0x1b')]===_0x66d6('0x1d')){_0x11f828[_0x66d6('0x1e')]=this[_0x66d6('0x15')]['phone'];}var _0x5ed4ee=this['channel'];if(_0x5ed4ee===_0x66d6('0x1f')){_0x11f828['ChatWebsiteId']=this[_0x66d6('0x20')]['id'];}else{_0x11f828[_[_0x66d6('0x21')](_0x5ed4ee)+_0x66d6('0x22')]=this[_0x66d6('0x20')]['id'];}_0x11f828[_[_0x66d6('0x21')](_0x5ed4ee)+_0x66d6('0x23')]=this[_0x66d6('0x15')]['id'];if(this['interaction'][_0x66d6('0x24')]){var _0x1d3e9e=_0x337ac4[0x4];if(!_[_0x66d6('0x25')](_0x1d3e9e)){_0x11f828[_0x66d6('0xb')]=utils[_0x66d6('0x26')](_0x1d3e9e,this);return rpc[_0x5ed4ee+_0x66d6('0xc')][_0x66d6('0xd')](_0x11f828)[_0x66d6('0xe')](function(_0x2e6b9e){logger[_0x66d6('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x3ac489,_0x11f828[_0x66d6('0xb')]);})['catch'](function(_0x3ecfc4){logger[_0x66d6('0x12')](_0x66d6('0x10'),_0x3ac489,JSON['stringify'](_0x3ecfc4));})[_0x66d6('0x27')](function(){logger[_0x66d6('0xf')](_0x66d6('0x28'),_0x3ac489);_0x57bec7[_0x66d6('0x29')]();});}else{logger[_0x66d6('0xf')](_0x66d6('0x2a'),_0x3ac489);_0x57bec7[_0x66d6('0x29')]();}}else{var _0x170537=this;var _0x21dfc7=_0x337ac4[0x2]['replace'](/\\n/g,'\x0a');var _0xc3e231={'credentials':{'private_key':_0x21dfc7,'client_email':_0x337ac4[0x1]}};var _0x1aa963=new dialogflow['SessionsClient'](_0xc3e231);var _0x28df09=_0x1aa963[_0x66d6('0x2b')](_0x337ac4[0x0],md5(_0x170537[_0x66d6('0x15')]['id']));var _0x181880={'session':_0x28df09,'queryInput':{'text':{'text':_0x170537[_0x66d6('0x2c')][_0x66d6('0xb')],'languageCode':_0x337ac4[0x3]||'en'}}};return _0x1aa963[_0x66d6('0x2d')](_0x181880)[_0x66d6('0xe')](function(_0x389a7b){if(_0x389a7b&&_0x389a7b[_0x66d6('0x2e')]){_0x170537[_0x66d6('0xb')][_0x66d6('0x2f')]=_0x389a7b;var _0x503a10=_0x389a7b[0x0];var _0x4c6098=_0x503a10[_0x66d6('0x30')][_0x66d6('0x31')]&&_0x503a10['queryResult'][_0x66d6('0x31')][_0x66d6('0x32')]?_0x503a10[_0x66d6('0x30')][_0x66d6('0x31')]['fields'][_0x66d6('0x33')]['boolValue']:![];_0x170537[_0x66d6('0xb')][_0x66d6('0x34')]=_0x503a10[_0x66d6('0x30')][_0x66d6('0x35')];_0x170537[_0x66d6('0xb')][_0x66d6('0x36')]=_0x503a10[_0x66d6('0x30')][_0x66d6('0x37')];_0x170537[_0x66d6('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x503a10[_0x66d6('0x30')][_0x66d6('0x31')]&&_0x503a10['queryResult'][_0x66d6('0x31')][_0x66d6('0x32')]?_0x503a10[_0x66d6('0x30')][_0x66d6('0x31')][_0x66d6('0x32')][_0x66d6('0x33')][_0x66d6('0x38')]:![];_0x170537[_0x66d6('0xb')][_0x66d6('0x39')]=_0x503a10['queryResult'][_0x66d6('0x3a')][_0x66d6('0x3b')];_0x170537[_0x66d6('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x503a10[_0x66d6('0x30')][_0x66d6('0x3a')][_0x66d6('0x3c')];_0x170537['body'][_0x66d6('0x3d')]=_0x503a10[_0x66d6('0x30')][_0x66d6('0x3a')][_0x66d6('0x3e')];_0x170537[_0x66d6('0xb')][_0x66d6('0x3f')]=_0x503a10[_0x66d6('0x30')][_0x66d6('0x40')];_0x170537[_0x66d6('0xb')][_0x66d6('0x41')]=_0x503a10[_0x66d6('0x30')]['queryText'];_0x170537[_0x66d6('0xb')][_0x66d6('0x42')]=_0x503a10['queryResult'][_0x66d6('0x43')];_0x11f828[_0x66d6('0x44')]='dialogflowV2';_0x11f828['providerResponse']=JSON[_0x66d6('0x45')](_0x389a7b);var _0x3d5ca3=[];for(var _0x223bcf=0x0;_0x223bcf<_0x389a7b['length'];_0x223bcf++){var _0xa6d940=_0x389a7b[_0x223bcf];if(_0xa6d940&&_0xa6d940[_0x66d6('0x30')]&&_0xa6d940[_0x66d6('0x30')][_0x66d6('0x46')]){_0x3d5ca3[_0x66d6('0x47')](createMessage(_0x3ac489,_0x5ed4ee,_0x11f828,_0xa6d940['queryResult'][_0x66d6('0x46')]));}}return Promise[_0x66d6('0x48')](_0x3d5ca3)[_0x66d6('0xe')](function(){if(_0x4c6098){_0x57bec7['next']();}else{_0x57bec7[_0x66d6('0x29')]();}})[_0x66d6('0x11')](function(_0x3e249b){logger[_0x66d6('0x12')](_0x66d6('0x10'),_0x3ac489,JSON['stringify'](_0x3e249b));_0x57bec7[_0x66d6('0x18')]();});}})[_0x66d6('0x11')](function(_0x1193a2){logger[_0x66d6('0x12')](_0x66d6('0x10'),_0x3ac489,_0x1193a2[_0x66d6('0x2c')],_0x1193a2[_0x66d6('0x49')]);_0x57bec7[_0x66d6('0x18')]();});}}catch(_0x1b982a){logger[_0x66d6('0x12')](_0x66d6('0x10'),_0x3ac489,JSON['stringify'](_0x1b982a));_0x57bec7[_0x66d6('0x29')]();}};}; \ No newline at end of file +var _0x47ff=['DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','stringify','fulfillmentText','all','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','diagnosticInfo'];(function(_0x5b8952,_0x541c70){var _0x280b21=function(_0x341ab0){while(--_0x341ab0){_0x5b8952['push'](_0x5b8952['shift']());}};_0x280b21(++_0x541c70);}(_0x47ff,0x117));var _0xf47f=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0x47ff[_0x1ca93c];return _0x185169;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require(_0xf47f('0x0'));var logger=require(_0xf47f('0x1'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xf47f('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf47f('0x3')),'faxMessage':require(_0xf47f('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5b50ce,_0x3b607d,_0x1c2633,_0x4b4627){return new Promise(function(_0x16b1e7,_0x12d9da){var _0x24e8cd=_['clone'](_0x1c2633);_0x24e8cd['body']=_0x4b4627;return rpc[_0x3b607d+_0xf47f('0x5')][_0xf47f('0x6')](_0x24e8cd)[_0xf47f('0x7')](function(){logger[_0xf47f('0x8')](_0xf47f('0x9'),_0x5b50ce,_0x24e8cd[_0xf47f('0xa')]);_0x16b1e7();})[_0xf47f('0xb')](function(_0x1fefcf){logger[_0xf47f('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b50ce,JSON['stringify'](_0x1fefcf));_0x12d9da(_0x1fefcf);});});}exports[_0xf47f('0xd')]=function(_0x28193c,_0xe27815){return function(_0x234e80){try{if(!_[_0xf47f('0xe')](this[_0xf47f('0xf')]['UserId'])){logger[_0xf47f('0x8')](_0xf47f('0x9'),_0x28193c,_0xf47f('0x10'));return _0x234e80[_0xf47f('0x11')]();}var _0x53234d={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf47f('0x12')),'direction':'out'};if(this[_0xf47f('0x13')]===_0xf47f('0x14')||this[_0xf47f('0x13')]===_0xf47f('0x15')){_0x53234d[_0xf47f('0x16')]=this['interaction']['phone'];}var _0x208987=this['channel'];if(_0x208987===_0xf47f('0x17')){_0x53234d[_0xf47f('0x18')]=this['account']['id'];}else{_0x53234d[_[_0xf47f('0x19')](_0x208987)+'AccountId']=this[_0xf47f('0x1a')]['id'];}_0x53234d[_[_0xf47f('0x19')](_0x208987)+_0xf47f('0x1b')]=this[_0xf47f('0xf')]['id'];if(this[_0xf47f('0xf')]['created']){var _0x2dccbc=_0xe27815[0x4];if(!_[_0xf47f('0x1c')](_0x2dccbc)){_0x53234d[_0xf47f('0xa')]=utils[_0xf47f('0x1d')](_0x2dccbc,this);return rpc[_0x208987+_0xf47f('0x5')][_0xf47f('0x6')](_0x53234d)[_0xf47f('0x7')](function(_0x5cc511){logger[_0xf47f('0x8')](_0xf47f('0x9'),_0x28193c,_0x53234d[_0xf47f('0xa')]);})[_0xf47f('0xb')](function(_0x5511b0){logger['error'](_0xf47f('0x9'),_0x28193c,JSON['stringify'](_0x5511b0));})[_0xf47f('0x1e')](function(){logger['info'](_0xf47f('0x1f'),_0x28193c);_0x234e80['stop']();});}else{logger[_0xf47f('0x8')](_0xf47f('0x20'),_0x28193c);_0x234e80[_0xf47f('0x21')]();}}else{var _0x48addc=this;var _0x1f4541=_0xe27815[0x2][_0xf47f('0x22')](/\\n/g,'\x0a');var _0x35d627={'credentials':{'private_key':_0x1f4541,'client_email':_0xe27815[0x1]}};var _0x29c25f=new dialogflow[(_0xf47f('0x23'))](_0x35d627);var _0x3fd539=_0x29c25f[_0xf47f('0x24')](_0xe27815[0x0],md5(_0x48addc[_0xf47f('0xf')]['id']));var _0x2d515c={'session':_0x3fd539,'queryInput':{'text':{'text':_0x48addc[_0xf47f('0x25')][_0xf47f('0xa')],'languageCode':_0xe27815[0x3]||'en'}}};return _0x29c25f[_0xf47f('0x26')](_0x2d515c)[_0xf47f('0x7')](function(_0x249ae6){if(_0x249ae6&&_0x249ae6[_0xf47f('0x27')]){_0x48addc[_0xf47f('0xa')][_0xf47f('0x28')]=_0x249ae6;var _0xda6a96=_0x249ae6[0x0];var _0x410c31=_0xda6a96[_0xf47f('0x29')]['diagnosticInfo']&&_0xda6a96[_0xf47f('0x29')]['diagnosticInfo'][_0xf47f('0x2a')]?_0xda6a96[_0xf47f('0x29')]['diagnosticInfo']['fields'][_0xf47f('0x2b')][_0xf47f('0x2c')]:![];_0x48addc[_0xf47f('0xa')][_0xf47f('0x2d')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x2e')];_0x48addc[_0xf47f('0xa')][_0xf47f('0x2f')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x30')];_0x48addc['body'][_0xf47f('0x31')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x32')]&&_0xda6a96[_0xf47f('0x29')][_0xf47f('0x32')][_0xf47f('0x2a')]?_0xda6a96[_0xf47f('0x29')][_0xf47f('0x32')][_0xf47f('0x2a')][_0xf47f('0x2b')][_0xf47f('0x2c')]:![];_0x48addc[_0xf47f('0xa')][_0xf47f('0x33')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x34')][_0xf47f('0x35')];_0x48addc[_0xf47f('0xa')][_0xf47f('0x36')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x34')]['displayName'];_0x48addc[_0xf47f('0xa')][_0xf47f('0x37')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x34')]['isFallback'];_0x48addc[_0xf47f('0xa')][_0xf47f('0x38')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x39')];_0x48addc['body'][_0xf47f('0x3a')]=_0xda6a96[_0xf47f('0x29')][_0xf47f('0x3b')];_0x48addc[_0xf47f('0xa')][_0xf47f('0x3c')]=_0xda6a96[_0xf47f('0x29')]['intentDetectionConfidence'];_0x53234d[_0xf47f('0x3d')]=_0xf47f('0x28');_0x53234d[_0xf47f('0x3e')]=JSON[_0xf47f('0x3f')](_0x249ae6);var _0x3cd981=[];for(var _0x124f62=0x0;_0x124f62<_0x249ae6['length'];_0x124f62++){var _0x7f5ff6=_0x249ae6[_0x124f62];if(_0x7f5ff6&&_0x7f5ff6[_0xf47f('0x29')]&&_0x7f5ff6[_0xf47f('0x29')][_0xf47f('0x40')]){_0x3cd981['push'](createMessage(_0x28193c,_0x208987,_0x53234d,_0x7f5ff6[_0xf47f('0x29')]['fulfillmentText']));}}return Promise[_0xf47f('0x41')](_0x3cd981)['then'](function(){if(_0x410c31){_0x234e80[_0xf47f('0x11')]();}else{_0x234e80[_0xf47f('0x21')]();}})['catch'](function(_0x39c9f3){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x28193c,JSON[_0xf47f('0x3f')](_0x39c9f3));_0x234e80[_0xf47f('0x11')]();});}})[_0xf47f('0xb')](function(_0x1b0e91){logger[_0xf47f('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x28193c,_0x1b0e91[_0xf47f('0x25')],_0x1b0e91['stack']);_0x234e80['next']();});}}catch(_0x4f298f){logger['error'](_0xf47f('0x9'),_0x28193c,JSON['stringify'](_0x4f298f));_0x234e80[_0xf47f('0x21')]();}};}; \ 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 d9b17f2..eb49670 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 _0xb241=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','join','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','message','stop'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb241,0x138));var _0x1b24=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb241[_0x4565bf];return _0x5610ba;};'use strict';var schema=require(_0x1b24('0x0'));var _=require(_0x1b24('0x1'));var htmlToText=require(_0x1b24('0x2'));var utils=require(_0x1b24('0x3'));var logger=require(_0x1b24('0x4'))(_0x1b24('0x5'));var gotoif=schema({'condition':{'type':_0x1b24('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1b24('0x7'),'message':_0x1b24('0x8')},'priorityFalse':{'type':_0x1b24('0x7'),'message':_0x1b24('0x9')}});exports[_0x1b24('0xa')]=function(_0x216b78,_0x3db2e1){return function(_0x4eebf8){try{var _0x4dcba9={'condition':htmlToText[_0x1b24('0xb')](utils[_0x1b24('0xc')](_0x3db2e1[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3db2e1[0x1],'priorityFalse':_0x3db2e1[0x2]};var _0x56d037=gotoif[_0x1b24('0x0')](_0x4dcba9,{'typecast':!![]});if(_0x56d037[_0x1b24('0xd')]){logger[_0x1b24('0xe')](_0x1b24('0xf'),_0x216b78,_[_0x1b24('0x10')](_0x56d037,'message')[_0x1b24('0x11')](',\x20'));_0x4eebf8['stop']();}else{try{var _0x20039a=eval('('+_0x4dcba9[_0x1b24('0x12')]+')');var _0x273fb3=_0x20039a?_0x4dcba9[_0x1b24('0x13')]:_0x4dcba9['priorityFalse'];logger['info'](_0x1b24('0x14'),_0x216b78,_0x4dcba9['condition'],_0x20039a,_0x273fb3||_0x1b24('0x15'));if(_0x273fb3){var _0x44dd7d=_['findIndex'](_0x4eebf8['rules'](),{'p':_0x273fb3});if(_0x44dd7d>=0x0){logger[_0x1b24('0x16')](_0x1b24('0x17'),_0x216b78,_0x273fb3||'next',_0x44dd7d);_0x4eebf8[_0x1b24('0x15')](_0x44dd7d);}else{logger[_0x1b24('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x216b78,_0x273fb3||_0x1b24('0x15'));_0x4eebf8['stop']();}}else{_0x4eebf8[_0x1b24('0x15')]();}}catch(_0x1e1eb3){logger[_0x1b24('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x216b78,_0x1e1eb3[_0x1b24('0x18')]);_0x4eebf8[_0x1b24('0x19')]();}}}catch(_0x3c2732){logger[_0x1b24('0xe')]('[%s][GOTOIF]\x20%s',_0x216b78,JSON['stringify'](_0x3c2732));_0x4eebf8[_0x1b24('0x19')]();}};}; \ No newline at end of file +var _0xa2c1=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x262dec,_0x108116){var _0x3969ef=function(_0x10fb84){while(--_0x10fb84){_0x262dec['push'](_0x262dec['shift']());}};_0x3969ef(++_0x108116);}(_0xa2c1,0x8b));var _0x1a2c=function(_0x260566,_0x581190){_0x260566=_0x260566-0x0;var _0x3711b7=_0xa2c1[_0x260566];return _0x3711b7;};'use strict';var schema=require(_0x1a2c('0x0'));var _=require(_0x1a2c('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x1a2c('0x2'));var logger=require(_0x1a2c('0x3'))(_0x1a2c('0x4'));var gotoif=schema({'condition':{'type':_0x1a2c('0x5'),'required':!![],'message':_0x1a2c('0x6')},'priorityTrue':{'type':'number','message':_0x1a2c('0x7')},'priorityFalse':{'type':_0x1a2c('0x8'),'message':_0x1a2c('0x9')}});exports[_0x1a2c('0xa')]=function(_0x3de1b6,_0x1364ea){return function(_0x5eae99){try{var _0x366403={'condition':htmlToText[_0x1a2c('0xb')](utils[_0x1a2c('0xc')](_0x1364ea[0x0],this),{'wordwrap':![]})[_0x1a2c('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1364ea[0x1],'priorityFalse':_0x1364ea[0x2]};var _0x99b4c2=gotoif['validate'](_0x366403,{'typecast':!![]});if(_0x99b4c2[_0x1a2c('0xe')]){logger[_0x1a2c('0xf')](_0x1a2c('0x10'),_0x3de1b6,_['map'](_0x99b4c2,_0x1a2c('0x11'))[_0x1a2c('0x12')](',\x20'));_0x5eae99[_0x1a2c('0x13')]();}else{try{var _0xb6ca40=eval('('+_0x366403[_0x1a2c('0x14')]+')');var _0x158fac=_0xb6ca40?_0x366403[_0x1a2c('0x15')]:_0x366403[_0x1a2c('0x16')];logger[_0x1a2c('0x17')](_0x1a2c('0x18'),_0x3de1b6,_0x366403['condition'],_0xb6ca40,_0x158fac||_0x1a2c('0x19'));if(_0x158fac){var _0x374c0a=_['findIndex'](_0x5eae99['rules'](),{'p':_0x158fac});if(_0x374c0a>=0x0){logger[_0x1a2c('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3de1b6,_0x158fac||_0x1a2c('0x19'),_0x374c0a);_0x5eae99[_0x1a2c('0x19')](_0x374c0a);}else{logger['info'](_0x1a2c('0x1a'),_0x3de1b6,_0x158fac||_0x1a2c('0x19'));_0x5eae99[_0x1a2c('0x13')]();}}else{_0x5eae99[_0x1a2c('0x19')]();}}catch(_0x44428f){logger['error'](_0x1a2c('0x1b'),_0x3de1b6,_0x44428f[_0x1a2c('0x11')]);_0x5eae99[_0x1a2c('0x13')]();}}}catch(_0x108469){logger[_0x1a2c('0xf')]('[%s][GOTOIF]\x20%s',_0x3de1b6,JSON[_0x1a2c('0x1c')](_0x108469));_0x5eae99['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 4277b22..1300667 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 _0x0bca=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20%s','stringify','validate','lodash','number','length','error','map','message','join'];(function(_0x9e1c09,_0x5ebbe7){var _0x37a734=function(_0x1927a8){while(--_0x1927a8){_0x9e1c09['push'](_0x9e1c09['shift']());}};_0x37a734(++_0x5ebbe7);}(_0x0bca,0xf7));var _0xa0bc=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x0bca[_0x474bc0];return _0x4b24cf;};'use strict';var schema=require(_0xa0bc('0x0'));var _=require(_0xa0bc('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xa0bc('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x11a88e,_0x4c6053){return function(_0x16744b){try{var _0x405bdb={'priority':_0x4c6053[0x0]};var _0x468ca1=gotop[_0xa0bc('0x0')](_0x405bdb,{'typecast':!![]});if(_0x468ca1[_0xa0bc('0x3')]){logger[_0xa0bc('0x4')]('[%s][GOTOP]\x20%s',_0x11a88e,_[_0xa0bc('0x5')](_0x468ca1,_0xa0bc('0x6'))[_0xa0bc('0x7')](',\x20'));_0x16744b[_0xa0bc('0x8')]();}else{logger[_0xa0bc('0x9')](_0xa0bc('0xa'),_0x11a88e,_0x405bdb['priority']);if(_0x405bdb[_0xa0bc('0xb')]){var _0x26cf0d=_[_0xa0bc('0xc')](_0x16744b[_0xa0bc('0xd')](),{'p':_0x405bdb[_0xa0bc('0xb')]});if(_0x26cf0d>=0x0){logger[_0xa0bc('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x11a88e,_0x405bdb['priority']||_0xa0bc('0xe'),_0x26cf0d);_0x16744b[_0xa0bc('0xe')](_0x26cf0d);}else{logger[_0xa0bc('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x11a88e,_0x405bdb[_0xa0bc('0xb')]||_0xa0bc('0xe'));_0x16744b['stop']();}}else{_0x16744b['next']();}}}catch(_0x52ac89){logger['error'](_0xa0bc('0xf'),_0x11a88e,JSON[_0xa0bc('0x10')](_0x52ac89));_0x16744b[_0xa0bc('0x8')]();}};}; \ No newline at end of file +var _0xd3e5=['length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x760d00,_0x3a57c5){var _0x442c28=function(_0x4e6224){while(--_0x4e6224){_0x760d00['push'](_0x760d00['shift']());}};_0x442c28(++_0x3a57c5);}(_0xd3e5,0x13f));var _0x5d3e=function(_0x45bd79,_0x258295){_0x45bd79=_0x45bd79-0x0;var _0x51c45d=_0xd3e5[_0x45bd79];return _0x51c45d;};'use strict';var schema=require('validate');var _=require(_0x5d3e('0x0'));var logger=require('../../../../config/logger')(_0x5d3e('0x1'));var gotop=schema({'priority':{'type':_0x5d3e('0x2'),'required':!![],'message':_0x5d3e('0x3')}});exports['consequence']=function(_0x491ead,_0x4c1960){return function(_0x1960cf){try{var _0x1b5a8f={'priority':_0x4c1960[0x0]};var _0x28bc3b=gotop['validate'](_0x1b5a8f,{'typecast':!![]});if(_0x28bc3b[_0x5d3e('0x4')]){logger['error'](_0x5d3e('0x5'),_0x491ead,_[_0x5d3e('0x6')](_0x28bc3b,_0x5d3e('0x7'))['join'](',\x20'));_0x1960cf[_0x5d3e('0x8')]();}else{logger[_0x5d3e('0x9')](_0x5d3e('0xa'),_0x491ead,_0x1b5a8f[_0x5d3e('0xb')]);if(_0x1b5a8f[_0x5d3e('0xb')]){var _0x4ced7b=_[_0x5d3e('0xc')](_0x1960cf[_0x5d3e('0xd')](),{'p':_0x1b5a8f['priority']});if(_0x4ced7b>=0x0){logger[_0x5d3e('0x9')](_0x5d3e('0xe'),_0x491ead,_0x1b5a8f[_0x5d3e('0xb')]||_0x5d3e('0xf'),_0x4ced7b);_0x1960cf[_0x5d3e('0xf')](_0x4ced7b);}else{logger[_0x5d3e('0x9')](_0x5d3e('0x10'),_0x491ead,_0x1b5a8f[_0x5d3e('0xb')]||'next');_0x1960cf[_0x5d3e('0x8')]();}}else{_0x1960cf[_0x5d3e('0xf')]();}}}catch(_0x271570){logger[_0x5d3e('0x11')](_0x5d3e('0x5'),_0x491ead,JSON[_0x5d3e('0x12')](_0x271570));_0x1960cf[_0x5d3e('0x8')]();}};}; \ 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 14f96bd..40cd682 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 _0x0f13=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x113445,_0x527831){var _0x34fd04=function(_0x56637c){while(--_0x56637c){_0x113445['push'](_0x113445['shift']());}};_0x34fd04(++_0x527831);}(_0x0f13,0x16a));var _0x30f1=function(_0x16529b,_0x42be35){_0x16529b=_0x16529b-0x0;var _0x2c6be3=_0x0f13[_0x16529b];return _0x2c6be3;};'use strict';var _=require(_0x30f1('0x0'));var utils=require(_0x30f1('0x1'));var logger=require(_0x30f1('0x2'))('routing');var rpc={'chatMessage':require(_0x30f1('0x3')),'openchannelMessage':require(_0x30f1('0x4')),'mailMessage':require(_0x30f1('0x5')),'smsMessage':require(_0x30f1('0x6')),'faxMessage':require(_0x30f1('0x7')),'whatsappMessage':require(_0x30f1('0x8'))};exports[_0x30f1('0x9')]=function(_0x5be0ab,_0x3d96dc){return function(_0x4a99f0){try{var _0x2355fa={'body':utils[_0x30f1('0xa')](_0x3d96dc[0x0],this),'ContactId':this[_0x30f1('0xb')]['id']};if(this[_0x30f1('0xc')]===_0x30f1('0xd')){_0x2355fa[_0x30f1('0xe')]=this[_0x30f1('0xf')]['id'];}else{_0x2355fa[_['upperFirst'](this[_0x30f1('0xc')])+'AccountId']=this[_0x30f1('0xf')]['id'];}_0x2355fa[_[_0x30f1('0x10')](this[_0x30f1('0xc')])+_0x30f1('0x11')]=this[_0x30f1('0x12')]['id'];if(rpc[this[_0x30f1('0xc')]+_0x30f1('0x13')]){return rpc[this[_0x30f1('0xc')]+_0x30f1('0x13')][_0x30f1('0x14')](_0x2355fa)[_0x30f1('0x15')](function(_0x5e7cee){logger['info']('[%s][MESSAGE]\x20%s',_0x5be0ab,_0x2355fa[_0x30f1('0x16')]);_0x4a99f0[_0x30f1('0x17')]();})['catch'](function(_0x1a9042){logger[_0x30f1('0x18')](_0x30f1('0x19'),_0x5be0ab,JSON[_0x30f1('0x1a')](_0x1a9042));_0x4a99f0[_0x30f1('0x1b')]();});}}catch(_0x1eeb73){logger['error']('[%s][MESSAGE]\x20%s',_0x5be0ab,JSON[_0x30f1('0x1a')](_0x1eeb73));_0x4a99f0['stop']();}};}; \ No newline at end of file +var _0x9918=['create','then','info','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','InteractionId','Message'];(function(_0x69cd26,_0x5df945){var _0x32d8c0=function(_0x41e6d3){while(--_0x41e6d3){_0x69cd26['push'](_0x69cd26['shift']());}};_0x32d8c0(++_0x5df945);}(_0x9918,0x133));var _0x8991=function(_0x9fdd0c,_0x59b230){_0x9fdd0c=_0x9fdd0c-0x0;var _0x224beb=_0x9918[_0x9fdd0c];return _0x224beb;};'use strict';var _=require(_0x8991('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8991('0x1'));var rpc={'chatMessage':require(_0x8991('0x2')),'openchannelMessage':require(_0x8991('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8991('0x4')),'whatsappMessage':require(_0x8991('0x5'))};exports[_0x8991('0x6')]=function(_0x1f5d0b,_0x970065){return function(_0x51ec7e){try{var _0x196eec={'body':utils[_0x8991('0x7')](_0x970065[0x0],this),'ContactId':this[_0x8991('0x8')]['id']};if(this[_0x8991('0x9')]===_0x8991('0xa')){_0x196eec[_0x8991('0xb')]=this['account']['id'];}else{_0x196eec[_['upperFirst'](this[_0x8991('0x9')])+'AccountId']=this['account']['id'];}_0x196eec[_[_0x8991('0xc')](this[_0x8991('0x9')])+_0x8991('0xd')]=this['interaction']['id'];if(rpc[this['channel']+_0x8991('0xe')]){return rpc[this[_0x8991('0x9')]+'Message'][_0x8991('0xf')](_0x196eec)[_0x8991('0x10')](function(_0x460041){logger[_0x8991('0x11')]('[%s][MESSAGE]\x20%s',_0x1f5d0b,_0x196eec['body']);_0x51ec7e['next']();})[_0x8991('0x12')](function(_0x2631e7){logger[_0x8991('0x13')](_0x8991('0x14'),_0x1f5d0b,JSON['stringify'](_0x2631e7));_0x51ec7e[_0x8991('0x15')]();});}}catch(_0x24676e){logger[_0x8991('0x13')](_0x8991('0x14'),_0x1f5d0b,JSON[_0x8991('0x16')](_0x24676e));_0x51ec7e[_0x8991('0x15')]();}};}; \ 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 454a6ed..4d66ce6 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 _0x971e=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x1031ab,_0x11a0e6){var _0x15ba29=function(_0x363709){while(--_0x363709){_0x1031ab['push'](_0x1031ab['shift']());}};_0x15ba29(++_0x11a0e6);}(_0x971e,0xe1));var _0xe971=function(_0x282c65,_0x25e173){_0x282c65=_0x282c65-0x0;var _0x1b389f=_0x971e[_0x282c65];return _0x1b389f;};'use strict';var utils=require('./utils');var logger=require(_0xe971('0x0'))(_0xe971('0x1'));exports[_0xe971('0x2')]=function(_0x408fc1,_0x1a4b6d){return function(_0x245a31){try{logger[_0xe971('0x3')](_0xe971('0x4'),_0x408fc1,utils['getMustacheRender'](_0x1a4b6d[0x0],this));_0x245a31['next']();}catch(_0x2d4edd){logger['error'](_0xe971('0x4'),_0x408fc1,JSON['stringify'](_0x2d4edd));_0x245a31['stop']();}};}; \ No newline at end of file +var _0x7e40=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x3b2bb5,_0x315f28){var _0x5a7973=function(_0x51c96a){while(--_0x51c96a){_0x3b2bb5['push'](_0x3b2bb5['shift']());}};_0x5a7973(++_0x315f28);}(_0x7e40,0x7e));var _0x07e4=function(_0x3ea64e,_0x46b01d){_0x3ea64e=_0x3ea64e-0x0;var _0x4cc02a=_0x7e40[_0x3ea64e];return _0x4cc02a;};'use strict';var utils=require(_0x07e4('0x0'));var logger=require(_0x07e4('0x1'))(_0x07e4('0x2'));exports[_0x07e4('0x3')]=function(_0x258786,_0x4f5871){return function(_0x2a6411){try{logger['info'](_0x07e4('0x4'),_0x258786,utils[_0x07e4('0x5')](_0x4f5871[0x0],this));_0x2a6411[_0x07e4('0x6')]();}catch(_0x3a6def){logger[_0x07e4('0x7')]('[%s][NOOP]\x20%s',_0x258786,JSON[_0x07e4('0x8')](_0x3a6def));_0x2a6411[_0x07e4('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index bda7e02..aead3c6 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 _0xcf2f=['from','joinAt','clone','InteractionId','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','info','name','QueueReport','create','catch','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xcf2f,0x1c6));var _0xfcf2=function(_0x280fe2,_0xb4bbfa){_0x280fe2=_0x280fe2-0x0;var _0x28aed7=_0xcf2f[_0x280fe2];return _0x28aed7;};'use strict';var schema=require('validate');var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var seqqueue=require(_0xfcf2('0x2'));var moment=require(_0xfcf2('0x3'));var Redis=require('ioredis');var config=require(_0xfcf2('0x4'));var logger=require(_0xfcf2('0x5'))('routing');var strategy=require(_0xfcf2('0x6'));config[_0xfcf2('0x7')]=_[_0xfcf2('0x8')](config[_0xfcf2('0x7')],{'host':_0xfcf2('0x9'),'port':0x18eb});var io=require(_0xfcf2('0xa'))(new Redis(config['redis']));var attributes=['id',_0xfcf2('0xb'),_0xfcf2('0xc'),_0xfcf2('0xd'),_0xfcf2('0xe'),_0xfcf2('0xf')];function emit(_0x12deb9,_0x435c77,_0x12ed5a){io['to'](_0x12deb9)['emit'](_0x435c77,_0x12ed5a);}function emitChannelQueueInteraction(_0x56cdd4,_0x2ab73d,_0x8bdb88,_0x65614,_0x40679b,_0x5c7de0,_0x235a90,_0x4dbb50){var _0x457862=_[_0xfcf2('0x10')](_0x8bdb88);_0x457862[_0xfcf2('0xb')]=_0x4dbb50;_0x457862[_0xfcf2('0xd')]=_0x2ab73d;_0x457862[_0xfcf2('0xc')]=_0x65614;_0x457862['id']=_0x40679b;if(_0x5c7de0){attributes['push'](_['capitalize'](_0x56cdd4)+_0xfcf2('0x11'));_0x235a90[util[_0xfcf2('0x12')](_0xfcf2('0x13'),_0x56cdd4)][_0x40679b]=_['pick'](_0x457862,attributes);}else{delete _0x235a90[util[_0xfcf2('0x12')](_0xfcf2('0x13'),_0x56cdd4)][_0x40679b];}emit(util[_0xfcf2('0x12')]('%s:queue:%s',_0x56cdd4,_0x2ab73d),util['format'](_0xfcf2('0x14'),_0x56cdd4,_0x5c7de0?_0xfcf2('0x15'):_0xfcf2('0x16')),_['pick'](_0x457862,attributes));}var rpc={'openchannelQueueReport':require(_0xfcf2('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xfcf2('0x18')),'faxQueueReport':require(_0xfcf2('0x19')),'whatsappQueueReport':require(_0xfcf2('0x1a')),'chatInteraction':require(_0xfcf2('0x1b')),'faxInteraction':require(_0xfcf2('0x1c')),'mailInteraction':require(_0xfcf2('0x1d')),'openchannelInteraction':require(_0xfcf2('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xfcf2('0x1f'))};var queue=schema({'name':{'type':_0xfcf2('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xfcf2('0x21')}});function startRouting(_0x2a750b,_0x289565,_0x14a9fd,_0x9850a){if(_0x2a750b&&_0x289565&&_0x14a9fd){_0x289565['waiting']+=0x1;var _0x3c8b92={'uniqueid':_0x2a750b,'from':_0x14a9fd[_0xfcf2('0x22')]?_0x14a9fd[_0xfcf2('0x22')][_0xfcf2('0xe')]:'','joinAt':moment()[_0xfcf2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x14a9fd['contact']?_0x14a9fd[_0xfcf2('0x23')]['id']:null,'ListId':_0x14a9fd['list']?_0x14a9fd[_0xfcf2('0x24')]['id']:null};_0x3c8b92[_[_0xfcf2('0x25')](_0x14a9fd[_0xfcf2('0x26')])+_0xfcf2('0x27')]=_0x289565['id']||null;_0x3c8b92[_[_0xfcf2('0x25')](_0x14a9fd['channel'])+'InteractionId']=_0x14a9fd[_0xfcf2('0x28')]?_0x14a9fd[_0xfcf2('0x28')]['id']:null;_0x3c8b92[_[_0xfcf2('0x25')](_0x14a9fd[_0xfcf2('0x26')])+_0xfcf2('0x29')]=_0x14a9fd[_0xfcf2('0x2a')]?_0x14a9fd[_0xfcf2('0x2a')]['id']:null;_0x3c8b92[_['upperFirst'](_0x14a9fd[_0xfcf2('0x26')])+(_0x14a9fd[_0xfcf2('0x26')]!==_0xfcf2('0x2b')?'AccountId':'WebsiteId')]=_0x14a9fd[_0xfcf2('0xc')]?_0x14a9fd['account']['id']:null;logger[_0xfcf2('0x2c')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x2a750b,_0x289565[_0xfcf2('0x2d')]));emitChannelQueueInteraction(_0x14a9fd[_0xfcf2('0x26')],_0x289565['name'],_0x3c8b92,_0x14a9fd[_0xfcf2('0xc')][_0xfcf2('0x2d')],_0x14a9fd[_0xfcf2('0x2a')]['id'],!![],_0x9850a,_0x289565['id']);if(rpc[_0x14a9fd[_0xfcf2('0x26')]+_0xfcf2('0x2e')]){return rpc[_0x14a9fd[_0xfcf2('0x26')]+_0xfcf2('0x2e')][_0xfcf2('0x2f')](_0x3c8b92)[_0xfcf2('0x30')](function(_0x448e0a){logger[_0xfcf2('0x31')]('create\x20queue\x20report',_0x448e0a);});}}}function stopRouting(_0x1b514a,_0x5108c9,_0x5e24dd,_0x2adda2){if(_0x1b514a&&_0x5108c9){_0x5108c9[_0xfcf2('0x32')]-=0x1;var _0x4af080={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xfcf2('0x33')),'reason':_0xfcf2('0x34')};logger[_0xfcf2('0x2c')](util['format'](_0xfcf2('0x35'),_0x1b514a,_0x5108c9[_0xfcf2('0x2d')]));emitChannelQueueInteraction(_0x5e24dd['channel'],_0x5108c9[_0xfcf2('0x2d')],_0x5e24dd[_0xfcf2('0x22')],_0x5e24dd[_0xfcf2('0xc')][_0xfcf2('0x2d')],_0x5e24dd[_0xfcf2('0x2a')]['id'],![],_0x2adda2,_0x5108c9['id']);return rpc[_0x5e24dd[_0xfcf2('0x26')]+_0xfcf2('0x36')][_0xfcf2('0x37')](_0x5e24dd[_0xfcf2('0x28')]['id'],{'queueId':_0x5108c9['id']})[_0xfcf2('0x38')](function(){if(rpc[_0x5e24dd[_0xfcf2('0x26')]+_0xfcf2('0x2e')]){return rpc[_0x5e24dd[_0xfcf2('0x26')]+_0xfcf2('0x2e')][_0xfcf2('0x37')](_0x1b514a,_0x4af080)[_0xfcf2('0x30')](function(_0xaf04ca){logger[_0xfcf2('0x31')](_0xfcf2('0x39'),_0xaf04ca);});}});}}function endRouting(_0x285a66,_0x1f7c42,_0x47dbf4,_0x503260){if(_0x285a66&&_0x1f7c42){_0x1f7c42[_0xfcf2('0x32')]-=0x1;var _0x52cbe2={'leaveAt':moment()[_0xfcf2('0x12')](_0xfcf2('0x33')),'exitAt':moment()[_0xfcf2('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xfcf2('0x3a')};logger['info'](util[_0xfcf2('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x285a66,_0x1f7c42[_0xfcf2('0x2d')]));emitChannelQueueInteraction(_0x47dbf4[_0xfcf2('0x26')],_0x1f7c42[_0xfcf2('0x2d')],_0x47dbf4[_0xfcf2('0x22')],_0x47dbf4[_0xfcf2('0xc')]['name'],_0x47dbf4[_0xfcf2('0x2a')]['id'],![],_0x503260);if(rpc[_0x47dbf4[_0xfcf2('0x26')]+_0xfcf2('0x2e')]){return rpc[_0x47dbf4['channel']+_0xfcf2('0x2e')][_0xfcf2('0x37')](_0x285a66,_0x52cbe2)[_0xfcf2('0x30')](function(_0x4b550a){logger['error'](_0xfcf2('0x39'),_0x4b550a);});}}}function handleFindQueue(_0x4e873a){return function(_0xdb4ea1){return _0xdb4ea1[_0xfcf2('0x2d')][_0xfcf2('0x3b')]()===_0x4e873a[_0xfcf2('0x3b')]();};}exports['consequence']=function(_0x7f8371,_0x548323,_0x17a5e1,_0x2e0880){return function(_0x159eaf){try{var _0x39e257={'name':_0x548323[0x0],'timeout':_0x548323[0x1]};var _0x180ddf=queue['validate'](_0x39e257,{'typecast':!![]});if(_0x180ddf['length']){logger['error'](_0xfcf2('0x3c'),_0x7f8371,_[_0xfcf2('0x3d')](_0x180ddf,'message')[_0xfcf2('0x3e')](',\x20'));_0x159eaf[_0xfcf2('0x3f')]();}else{var _0x199b40=_[_0xfcf2('0x40')](_0x17a5e1[_0x2e0880[_0xfcf2('0x26')]+_0xfcf2('0x41')],handleFindQueue(_0x39e257['name']));if(_0x199b40){startRouting(_0x7f8371,_0x199b40,_0x2e0880,_0x17a5e1);var _0x25be04=(_0x199b40[_0xfcf2('0x3a')]||0xa)*0x3e8;var _0x1aca50=(_0x39e257[_0xfcf2('0x3a')]||0x14)*0x3e8;var _0x33dfc3;if(_0x25be04>_0x1aca50){_0x1aca50=_0x25be04;}var _0x136f4b=seqqueue[_0xfcf2('0x42')](_0x25be04);_0x136f4b['id']=_0x7f8371;_0x136f4b[_0xfcf2('0x43')]=_0x25be04;_0x136f4b[_0xfcf2('0x44')]=_0x1aca50;_0x136f4b[_0xfcf2('0x26')]=_0x2e0880['channel'];_0x17a5e1[_0xfcf2('0x45')][_0x7f8371]['on'](_0xfcf2('0x46'),function(){logger['info'](_0xfcf2('0x47'),_0x7f8371);stopRouting(_0x7f8371,_0x199b40,_0x2e0880,_0x17a5e1);clearTimeout(_0x33dfc3);_0x33dfc3=undefined;_0x136f4b['close'](!![]);if(_0x17a5e1['rules'][_0x7f8371]){delete _0x17a5e1['rules'][_0x7f8371];}_0x159eaf[_0xfcf2('0x3f')]();});_0x17a5e1[_0xfcf2('0x45')][_0x7f8371]['on'](_0xfcf2('0x48'),function(){if(_0x17a5e1[_0xfcf2('0x45')][_0x7f8371]){delete _0x17a5e1['rules'][_0x7f8371];}});_0x33dfc3=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x7f8371);endRouting(_0x7f8371,_0x199b40,_0x2e0880,_0x17a5e1);clearTimeout(_0x33dfc3);_0x136f4b['close'](!![]);_0x159eaf['next']();},_0x1aca50);switch(_0x199b40[_0xfcf2('0x49')]){case _0xfcf2('0x4a'):strategy['rrmemory'](_0x136f4b,_0x199b40,_0x17a5e1,_0x2e0880);break;default:strategy[_0xfcf2('0x4b')](_0x136f4b,_0x199b40,_0x17a5e1,_0x2e0880);}}else{logger[_0xfcf2('0x31')](_0xfcf2('0x4c'),_0x7f8371,_0x39e257['name']);_0x159eaf[_0xfcf2('0x3f')]();}}}catch(_0x899592){logger[_0xfcf2('0x31')](_0xfcf2('0x3c'),_0x7f8371,_0x899592[_0xfcf2('0x4d')]);_0x159eaf['stop']();}};}; \ No newline at end of file +var _0x5db9=['../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','channel','interaction','MessageId','message','upperFirst','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','atimeout','rules','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','moment','../../../../config/environment','../../../../config/logger','routing','defaults','redis','localhost','queue_id','queue','from','clone','account','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport'];(function(_0x50470f,_0x1e0719){var _0x45e97c=function(_0xe1218d){while(--_0xe1218d){_0x50470f['push'](_0x50470f['shift']());}};_0x45e97c(++_0x1e0719);}(_0x5db9,0x121));var _0x95db=function(_0x5b8c2b,_0x155bc3){_0x5b8c2b=_0x5b8c2b-0x0;var _0xe1ff56=_0x5db9[_0x5b8c2b];return _0xe1ff56;};'use strict';var schema=require(_0x95db('0x0'));var _=require(_0x95db('0x1'));var util=require(_0x95db('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x95db('0x3'));var Redis=require('ioredis');var config=require(_0x95db('0x4'));var logger=require(_0x95db('0x5'))(_0x95db('0x6'));var strategy=require('./strategy');config['redis']=_[_0x95db('0x7')](config[_0x95db('0x8')],{'host':_0x95db('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x95db('0x8')]));var attributes=['id',_0x95db('0xa'),'account',_0x95db('0xb'),_0x95db('0xc'),'joinAt'];function emit(_0x27ffa1,_0xd8efa7,_0x3dfecf){io['to'](_0x27ffa1)['emit'](_0xd8efa7,_0x3dfecf);}function emitChannelQueueInteraction(_0x4283ab,_0x3e0100,_0x160dc8,_0x2e15fb,_0x39e891,_0xc4421,_0x40db1e,_0x52f327){var _0x4e62f6=_[_0x95db('0xd')](_0x160dc8);_0x4e62f6[_0x95db('0xa')]=_0x52f327;_0x4e62f6['queue']=_0x3e0100;_0x4e62f6[_0x95db('0xe')]=_0x2e15fb;_0x4e62f6['id']=_0x39e891;if(_0xc4421){attributes[_0x95db('0xf')](_['capitalize'](_0x4283ab)+_0x95db('0x10'));_0x40db1e[util['format'](_0x95db('0x11'),_0x4283ab)][_0x39e891]=_[_0x95db('0x12')](_0x4e62f6,attributes);}else{delete _0x40db1e[util[_0x95db('0x13')](_0x95db('0x11'),_0x4283ab)][_0x39e891];}emit(util[_0x95db('0x13')](_0x95db('0x14'),_0x4283ab,_0x3e0100),util[_0x95db('0x13')](_0x95db('0x15'),_0x4283ab,_0xc4421?_0x95db('0x16'):_0x95db('0x17')),_['pick'](_0x4e62f6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x95db('0x18')),'chatQueueReport':require(_0x95db('0x19')),'smsQueueReport':require(_0x95db('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x95db('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x95db('0x1c')),'mailInteraction':require(_0x95db('0x1d')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x95db('0x1e'),'required':!![],'message':_0x95db('0x1f')},'timeout':{'type':_0x95db('0x20'),'message':_0x95db('0x21')}});function startRouting(_0x43711c,_0x31330c,_0x3f0969,_0x680296){if(_0x43711c&&_0x31330c&&_0x3f0969){_0x31330c[_0x95db('0x22')]+=0x1;var _0x2b27ad={'uniqueid':_0x43711c,'from':_0x3f0969[_0x95db('0x23')]?_0x3f0969['body']['from']:'','joinAt':moment()['format'](_0x95db('0x24')),'ContactId':_0x3f0969['contact']?_0x3f0969[_0x95db('0x25')]['id']:null,'ListId':_0x3f0969[_0x95db('0x26')]?_0x3f0969[_0x95db('0x26')]['id']:null};_0x2b27ad[_['upperFirst'](_0x3f0969['channel'])+_0x95db('0x27')]=_0x31330c['id']||null;_0x2b27ad[_['upperFirst'](_0x3f0969[_0x95db('0x28')])+_0x95db('0x10')]=_0x3f0969[_0x95db('0x29')]?_0x3f0969['interaction']['id']:null;_0x2b27ad[_['upperFirst'](_0x3f0969[_0x95db('0x28')])+_0x95db('0x2a')]=_0x3f0969[_0x95db('0x2b')]?_0x3f0969['message']['id']:null;_0x2b27ad[_[_0x95db('0x2c')](_0x3f0969[_0x95db('0x28')])+(_0x3f0969[_0x95db('0x28')]!==_0x95db('0x2d')?_0x95db('0x2e'):_0x95db('0x2f'))]=_0x3f0969[_0x95db('0xe')]?_0x3f0969[_0x95db('0xe')]['id']:null;logger[_0x95db('0x30')](util[_0x95db('0x13')](_0x95db('0x31'),_0x43711c,_0x31330c[_0x95db('0x32')]));emitChannelQueueInteraction(_0x3f0969[_0x95db('0x28')],_0x31330c[_0x95db('0x32')],_0x2b27ad,_0x3f0969[_0x95db('0xe')][_0x95db('0x32')],_0x3f0969[_0x95db('0x2b')]['id'],!![],_0x680296,_0x31330c['id']);if(rpc[_0x3f0969[_0x95db('0x28')]+_0x95db('0x33')]){return rpc[_0x3f0969['channel']+_0x95db('0x33')][_0x95db('0x34')](_0x2b27ad)[_0x95db('0x35')](function(_0x5d0456){logger[_0x95db('0x36')](_0x95db('0x37'),_0x5d0456);});}}}function stopRouting(_0x67dda8,_0x2c818b,_0x25cfc0,_0x33c84c){if(_0x67dda8&&_0x2c818b){_0x2c818b[_0x95db('0x22')]-=0x1;var _0x38b713={'leaveAt':moment()[_0x95db('0x13')](_0x95db('0x24')),'acceptAt':moment()[_0x95db('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x95db('0x38')};logger[_0x95db('0x30')](util[_0x95db('0x13')](_0x95db('0x39'),_0x67dda8,_0x2c818b['name']));emitChannelQueueInteraction(_0x25cfc0[_0x95db('0x28')],_0x2c818b['name'],_0x25cfc0[_0x95db('0x23')],_0x25cfc0[_0x95db('0xe')][_0x95db('0x32')],_0x25cfc0[_0x95db('0x2b')]['id'],![],_0x33c84c,_0x2c818b['id']);return rpc[_0x25cfc0[_0x95db('0x28')]+_0x95db('0x3a')][_0x95db('0x3b')](_0x25cfc0[_0x95db('0x29')]['id'],{'queueId':_0x2c818b['id']})[_0x95db('0x3c')](function(){if(rpc[_0x25cfc0[_0x95db('0x28')]+_0x95db('0x33')]){return rpc[_0x25cfc0[_0x95db('0x28')]+_0x95db('0x33')]['update'](_0x67dda8,_0x38b713)['catch'](function(_0x524a74){logger[_0x95db('0x36')]('update\x20queue\x20report',_0x524a74);});}});}}function endRouting(_0x161419,_0x1d762c,_0x4ae789,_0x1ad80b){if(_0x161419&&_0x1d762c){_0x1d762c[_0x95db('0x22')]-=0x1;var _0x22d490={'leaveAt':moment()[_0x95db('0x13')](_0x95db('0x24')),'exitAt':moment()[_0x95db('0x13')](_0x95db('0x24')),'reason':_0x95db('0x3d')};logger[_0x95db('0x30')](util[_0x95db('0x13')](_0x95db('0x3e'),_0x161419,_0x1d762c[_0x95db('0x32')]));emitChannelQueueInteraction(_0x4ae789['channel'],_0x1d762c[_0x95db('0x32')],_0x4ae789[_0x95db('0x23')],_0x4ae789[_0x95db('0xe')][_0x95db('0x32')],_0x4ae789['message']['id'],![],_0x1ad80b);if(rpc[_0x4ae789['channel']+'QueueReport']){return rpc[_0x4ae789['channel']+_0x95db('0x33')][_0x95db('0x3b')](_0x161419,_0x22d490)[_0x95db('0x35')](function(_0x4e847f){logger[_0x95db('0x36')]('update\x20queue\x20report',_0x4e847f);});}}}function handleFindQueue(_0x345d9f){return function(_0x3ce67d){return _0x3ce67d['name'][_0x95db('0x3f')]()===_0x345d9f[_0x95db('0x3f')]();};}exports[_0x95db('0x40')]=function(_0x2e4e29,_0x1fadb0,_0x38ef5d,_0x1f56f2){return function(_0x776cb8){try{var _0xc7e73b={'name':_0x1fadb0[0x0],'timeout':_0x1fadb0[0x1]};var _0x53ec27=queue[_0x95db('0x0')](_0xc7e73b,{'typecast':!![]});if(_0x53ec27[_0x95db('0x41')]){logger[_0x95db('0x36')](_0x95db('0x42'),_0x2e4e29,_['map'](_0x53ec27,'message')[_0x95db('0x43')](',\x20'));_0x776cb8[_0x95db('0x44')]();}else{var _0x23837d=_[_0x95db('0x45')](_0x38ef5d[_0x1f56f2[_0x95db('0x28')]+'Queues'],handleFindQueue(_0xc7e73b[_0x95db('0x32')]));if(_0x23837d){startRouting(_0x2e4e29,_0x23837d,_0x1f56f2,_0x38ef5d);var _0x5c50ea=(_0x23837d[_0x95db('0x3d')]||0xa)*0x3e8;var _0x44e626=(_0xc7e73b[_0x95db('0x3d')]||0x14)*0x3e8;var _0x47d62e;if(_0x5c50ea>_0x44e626){_0x44e626=_0x5c50ea;}var _0x2ac4e2=seqqueue['createQueue'](_0x5c50ea);_0x2ac4e2['id']=_0x2e4e29;_0x2ac4e2[_0x95db('0x46')]=_0x5c50ea;_0x2ac4e2['qtimeout']=_0x44e626;_0x2ac4e2[_0x95db('0x28')]=_0x1f56f2['channel'];_0x38ef5d[_0x95db('0x47')][_0x2e4e29]['on']('end',function(){logger[_0x95db('0x30')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2e4e29);stopRouting(_0x2e4e29,_0x23837d,_0x1f56f2,_0x38ef5d);clearTimeout(_0x47d62e);_0x47d62e=undefined;_0x2ac4e2[_0x95db('0x48')](!![]);if(_0x38ef5d['rules'][_0x2e4e29]){delete _0x38ef5d['rules'][_0x2e4e29];}_0x776cb8[_0x95db('0x44')]();});_0x38ef5d[_0x95db('0x47')][_0x2e4e29]['on'](_0x95db('0x49'),function(){if(_0x38ef5d['rules'][_0x2e4e29]){delete _0x38ef5d[_0x95db('0x47')][_0x2e4e29];}});_0x47d62e=setTimeout(function(){logger[_0x95db('0x30')](_0x95db('0x4a'),_0x2e4e29);endRouting(_0x2e4e29,_0x23837d,_0x1f56f2,_0x38ef5d);clearTimeout(_0x47d62e);_0x2ac4e2[_0x95db('0x48')](!![]);_0x776cb8['next']();},_0x44e626);switch(_0x23837d[_0x95db('0x4b')]){case'rrmemory':strategy[_0x95db('0x4c')](_0x2ac4e2,_0x23837d,_0x38ef5d,_0x1f56f2);break;default:strategy[_0x95db('0x4d')](_0x2ac4e2,_0x23837d,_0x38ef5d,_0x1f56f2);}}else{logger[_0x95db('0x36')](_0x95db('0x4e'),_0x2e4e29,_0xc7e73b[_0x95db('0x32')]);_0x776cb8[_0x95db('0x44')]();}}}catch(_0x51fcb2){logger[_0x95db('0x36')](_0x95db('0x42'),_0x2e4e29,_0x51fcb2['stack']);_0x776cb8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 7d80160..0003778 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 _0xf3cd=['notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xf3cd[_0x279368];return _0x40b6d0;};'use strict';var _=require(_0xdf3c('0x0'));var uuid=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var logger=require(_0xdf3c('0x3'))(_0xdf3c('0x4'));var Agent=function(_0x433a7f,_0x54db05,_0x401518,_0x71b446){this[_0xdf3c('0x5')]=uuid['v4']();this['squeue']=_0x433a7f;this[_0xdf3c('0x6')]=_0x54db05;this[_0xdf3c('0x7')]=_0x401518;this[_0xdf3c('0x4')]=_0x71b446;this[_0xdf3c('0x8')][_0xdf3c('0x9')](this[_0xdf3c('0xa')]['bind'](this),this[_0xdf3c('0xb')]['bind'](this));this['squeue']['on'](_0xdf3c('0xc'),this[_0xdf3c('0xb')]['bind'](this));this[_0xdf3c('0x8')]['on'](_0xdf3c('0xd'),this[_0xdf3c('0xe')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')][_0xdf3c('0x9')]=function(){this[_0xdf3c('0x8')][_0xdf3c('0x9')](this['handleRun'][_0xdf3c('0xf')](this),this[_0xdf3c('0xb')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')]['handleDrained']=function(){this[_0xdf3c('0xb')](!![]);};Agent[_0xdf3c('0x10')][_0xdf3c('0xa')]=function(){logger['debug'](_0xdf3c('0x11'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);if(_[_0xdf3c('0x12')](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']])){logger[_0xdf3c('0x14')](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this[_0xdf3c('0x9')][_0xdf3c('0xf')](this),0x3e8);}else{if(this[_0xdf3c('0x4')][_0xdf3c('0x16')]||util[_0xdf3c('0x17')](this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],this[_0xdf3c('0x8')][_0xdf3c('0x18')],![])){this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']]['busy']=!![];this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']][_0xdf3c('0x19')]=undefined;util[_0xdf3c('0x1a')](this[_0xdf3c('0x7')],this[_0xdf3c('0x4')],this[_0xdf3c('0x6')],this['squeue'][_0xdf3c('0x18')]);util[_0xdf3c('0x1b')](this[_0xdf3c('0x5')],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);util[_0xdf3c('0x1c')](this[_0xdf3c('0x8')]['id'],this['realtime'][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],'RINGING'+(this[_0xdf3c('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xdf3c('0x1d'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdf3c('0xf')](this),0x3e8);}}};Agent[_0xdf3c('0x10')][_0xdf3c('0xb')]=function(_0x1ccdd4){if(_['isNil'](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']])){return logger['debug'](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);}else{logger['debug'](_0xdf3c('0x1e'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);util[_0xdf3c('0x1f')](this['notificationId'],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']][_0xdf3c('0x20')]=![];this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']]['busyQueue']=undefined;util[_0xdf3c('0x21')](this[_0xdf3c('0x7')],this['routing'],this['agent'],this[_0xdf3c('0x8')]['channel']);util[_0xdf3c('0x1c')](this['squeue']['id'],this['realtime']['agents'][this[_0xdf3c('0x6')]['id']],_0x1ccdd4?_0xdf3c('0x22'):_0xdf3c('0x23'));}if(!_0x1ccdd4){setTimeout(this[_0xdf3c('0x9')]['bind'](this),0x3e8);}};function agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f){return new Agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f);}module[_0xdf3c('0x24')]=agent; \ No newline at end of file +var _0xe5b3=['exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','realtime','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT'];(function(_0x4e8563,_0x332581){var _0x30a587=function(_0x51745b){while(--_0x51745b){_0x4e8563['push'](_0x4e8563['shift']());}};_0x30a587(++_0x332581);}(_0xe5b3,0x133));var _0x3e5b=function(_0xcfdf7d,_0x380fc6){_0xcfdf7d=_0xcfdf7d-0x0;var _0x22b89c=_0xe5b3[_0xcfdf7d];return _0x22b89c;};'use strict';var _=require('lodash');var uuid=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var logger=require(_0x3e5b('0x2'))(_0x3e5b('0x3'));var Agent=function(_0x2a71ef,_0x3171c5,_0x7f1cc0,_0x1e58ed){this[_0x3e5b('0x4')]=uuid['v4']();this[_0x3e5b('0x5')]=_0x2a71ef;this[_0x3e5b('0x6')]=_0x3171c5;this['realtime']=_0x7f1cc0;this[_0x3e5b('0x3')]=_0x1e58ed;this[_0x3e5b('0x5')]['push'](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this['squeue']['on']('timeout',this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));this[_0x3e5b('0x5')]['on'](_0x3e5b('0xa'),this[_0x3e5b('0xb')]['bind'](this));};Agent[_0x3e5b('0xc')]['push']=function(){this[_0x3e5b('0x5')][_0x3e5b('0xd')](this[_0x3e5b('0x7')][_0x3e5b('0x8')](this),this[_0x3e5b('0x9')][_0x3e5b('0x8')](this));};Agent[_0x3e5b('0xc')]['handleDrained']=function(){this[_0x3e5b('0x9')](!![]);};Agent['prototype']['handleRun']=function(){logger['debug'](_0x3e5b('0xe'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);if(_['isNil'](this[_0x3e5b('0xf')]['agents'][this['agent']['id']])){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')]['bind'](this),0x3e8);}else{if(this[_0x3e5b('0x3')][_0x3e5b('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],this[_0x3e5b('0x5')][_0x3e5b('0x14')],![])){this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=!![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x17')](this['realtime'],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')][_0x3e5b('0x14')]);util['showNotification'](this[_0x3e5b('0x4')],this['squeue']['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this['agent']['id']],null,this[_0x3e5b('0x3')]);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']],_0x3e5b('0x19')+(this[_0x3e5b('0x3')]['forcedOwnership']?_0x3e5b('0x1a'):''));}else{logger['debug'](_0x3e5b('0x1b'),this['squeue']['id'],this[_0x3e5b('0x6')]['id']);setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}}};Agent[_0x3e5b('0xc')][_0x3e5b('0x9')]=function(_0x3cfaf6){if(_[_0x3e5b('0x1c')](this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']])){return logger[_0x3e5b('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x1d'),this[_0x3e5b('0x5')]['id'],this[_0x3e5b('0x6')]['id']);util[_0x3e5b('0x1e')](this['notificationId'],this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],null,this[_0x3e5b('0x3')]);this['realtime'][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x15')]=![];this[_0x3e5b('0xf')][_0x3e5b('0x13')][this[_0x3e5b('0x6')]['id']][_0x3e5b('0x16')]=undefined;util[_0x3e5b('0x1f')](this[_0x3e5b('0xf')],this[_0x3e5b('0x3')],this[_0x3e5b('0x6')],this[_0x3e5b('0x5')]['channel']);util[_0x3e5b('0x18')](this[_0x3e5b('0x5')]['id'],this['realtime']['agents'][this[_0x3e5b('0x6')]['id']],_0x3cfaf6?'STOP':_0x3e5b('0x20'));}if(!_0x3cfaf6){setTimeout(this[_0x3e5b('0xd')][_0x3e5b('0x8')](this),0x3e8);}};function agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1){return new Agent(_0x32594a,_0x5389e3,_0x18b07f,_0x4cdcb1);}module[_0x3e5b('0x21')]=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 c369c88..1c52153 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 _0xd5fc=['busy','busyQueue','name','channel','showNotification','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','removeWaitingNotification','lodash','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','timeout','handleDrained','prototype','handleTimeout','isNil','Agents','length','realtime','agents','debug','isAgentAvailable','writeLog'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd5fc,0x12a));var _0xcd5f=function(_0x182b8f,_0x75f047){_0x182b8f=_0x182b8f-0x0;var _0x51bda7=_0xd5fc[_0x182b8f];return _0x51bda7;};'use strict';var _=require(_0xcd5f('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xcd5f('0x1'))('routing');var Beepall=function(_0x4fb6df,_0x567d8c,_0x3f1329,_0xf24cdf){this[_0xcd5f('0x2')]=uuid['v4']();this[_0xcd5f('0x3')]=_0x4fb6df;this[_0xcd5f('0x4')]=_0x567d8c;this['realtime']=_0x3f1329;this[_0xcd5f('0x5')]=_0xf24cdf;this[_0xcd5f('0x3')][_0xcd5f('0x6')](this[_0xcd5f('0x7')][_0xcd5f('0x8')](this),this['handleTimeout']['bind'](this));this[_0xcd5f('0x3')]['on'](_0xcd5f('0x9'),this['handleTimeout'][_0xcd5f('0x8')](this));this[_0xcd5f('0x3')]['on']('drained',this[_0xcd5f('0xa')][_0xcd5f('0x8')](this));};Beepall[_0xcd5f('0xb')][_0xcd5f('0x6')]=function(){this[_0xcd5f('0x3')][_0xcd5f('0x6')](this['handleRun'][_0xcd5f('0x8')](this),this[_0xcd5f('0xc')]['bind'](this));};Beepall[_0xcd5f('0xb')][_0xcd5f('0xa')]=function(){this['handleTimeout'](!![]);};Beepall[_0xcd5f('0xb')][_0xcd5f('0x7')]=function(){var _0x5304bd=!![];if(!_[_0xcd5f('0xd')](this[_0xcd5f('0x4')])&&!_['isNil'](this['queue'][_0xcd5f('0xe')])&&this['queue']['Agents'][_0xcd5f('0xf')]>0x0){for(var _0x2e6d81=0x0,_0x35dbfe;_0x2e6d810x0){for(var _0x149c46=0x0,_0x4b78d5;_0x149c460x0&&_0xdafdc8[_0x3bf87e+'CurrentCapacity']>=_0xdafdc8[_0x3bf87e+_0x9a3b('0x24')]){writeLog(_0x72d588,_0xdafdc8,_0x3bf87e[_0x9a3b('0x26')]()+_0x9a3b('0x27'));return![];}}return!![];};exports['showNotification']=function(_0xdd0e19,_0x4c3492,_0x24aadd,_0x5c5d52,_0x57d3c5){return sendNotification(!![],_0xdd0e19,_0x4c3492,_0x24aadd,_0x5c5d52,_0x57d3c5);};exports[_0x9a3b('0x28')]=function(_0x5ccb42,_0x39dfb0,_0x24ec0c,_0x30381c,_0x1b56a2){return sendNotification(![],_0x5ccb42,_0x39dfb0,_0x24ec0c,_0x30381c,_0x1b56a2);};exports[_0x9a3b('0x29')]=function(_0x33652e,_0x40e716,_0x168728){var _0x20a458=_0x40e716[_0x9a3b('0x2a')][_0x9a3b('0x2b')];if(!_0x20a458&&_0x168728){_0x20a458=_0x168728['id'];}var _0x5c70d5=_[_0x9a3b('0x2c')](_0x33652e[_0x40e716[_0x9a3b('0x2d')]+_0x9a3b('0x2e')],function(_0x4f4537){var _0x5b5f73=_[_0x9a3b('0x2f')](_0x40e716[_0x9a3b('0x2d')])+_0x9a3b('0x30');return _0x4f4537[_0x5b5f73]===_0x40e716[_0x9a3b('0x2a')]['id'];});if(!_0x5c70d5&&_0x20a458&&_0x33652e[_0x9a3b('0x31')][_0x20a458]){_0x5c70d5=_[_0x9a3b('0x2c')](_0x33652e[_0x9a3b('0x31')][_0x20a458][_0x40e716[_0x9a3b('0x2d')]+_0x9a3b('0x32')],function(_0x54cb03){return _0x54cb03['id']===_0x40e716[_0x9a3b('0x2a')]['id'];});}return _0x5c70d5;};exports[_0x9a3b('0x33')]=function(_0x2c316d,_0x451978,_0x2a6550,_0xf1e258){if(_0x2a6550&&_0x2a6550['id']&&_0x2c316d[_0x9a3b('0x31')]&&_0x2c316d[_0x9a3b('0x31')][_0x2a6550['id']]){_0x2c316d[_0x9a3b('0x31')][_0x2a6550['id']][_0xf1e258+_0x9a3b('0x32')][_0x451978[_0x9a3b('0x15')]['id']]={'id':_0x451978['interaction']['id']};}};exports[_0x9a3b('0x34')]=function(_0x36894b,_0x3153ec,_0x4cf464,_0x1af7d4){if(_0x4cf464&&_0x4cf464['id']&&_0x36894b[_0x9a3b('0x31')]&&_0x36894b['agents'][_0x4cf464['id']]){delete _0x36894b['agents'][_0x4cf464['id']][_0x1af7d4+_0x9a3b('0x32')][_0x3153ec[_0x9a3b('0x15')]['id']];}};exports[_0x9a3b('0x35')]=writeLog; \ No newline at end of file +var _0x0c71=['defaults','localhost','socket.io-emitter','redis','\x20interaction','name','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','user:%s','emit','notification:%s','save','remove','debug','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','InteractionId','some','agents','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','util','ioredis','../../../../../config/environment','../../../../../config/logger'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x0c71,0xfb));var _0x10c7=function(_0x4b0a54,_0x31fc5b){_0x4b0a54=_0x4b0a54-0x0;var _0x3b51d6=_0x0c71[_0x4b0a54];return _0x3b51d6;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var utils=require('../utils');var Redis=require(_0x10c7('0x1'));var config=require(_0x10c7('0x2'));var logger=require(_0x10c7('0x3'))('routing');config['redis']=_[_0x10c7('0x4')](config['redis'],{'host':_0x10c7('0x5'),'port':0x18eb});var io=require(_0x10c7('0x6'))(new Redis(config[_0x10c7('0x7')]));function sendNotification(_0x4480c2,_0x2dbe32,_0xd955fc,_0x4d8fc8,_0x3cbcd7,_0x221c8f){var _0x5709c7=_0x221c8f||{};var _0x346bbc=_0xd955fc['split']('.');var _0x55c113={'uniqueid':_0x2dbe32,'channel':_0x346bbc[0x0],'id':_0x346bbc[0x1],'title':_0x346bbc[0x0]+_0x10c7('0x8'),'interactionId':_0x346bbc[0x2],'queue':_0x3cbcd7?_0x3cbcd7[_0x10c7('0x9')]:null,'sound':_0x5709c7['account'][_0x10c7('0xa')],'shake':_0x5709c7[_0x10c7('0xb')][_0x10c7('0xc')]};try{if(!_0x5709c7[_0x10c7('0xd')]){_0x5709c7[_0x10c7('0xd')]={};}if(_0x3cbcd7){_0x5709c7[_0x10c7('0xd')][_0x10c7('0xe')]=_0x3cbcd7;}else if(_0x5709c7[_0x10c7('0xd')][_0x10c7('0xe')]){delete _0x5709c7[_0x10c7('0xd')]['queue'];}_0x55c113[_0x10c7('0xf')]=utils[_0x10c7('0x10')](_0x5709c7[_0x10c7('0xb')][_0x10c7('0x11')],_0x5709c7);}catch(_0x45568c){_0x55c113[_0x10c7('0xf')]=_0x10c7('0x12');logger['error'](util[_0x10c7('0x13')](_0x10c7('0x14'),_0x2dbe32,_0x45568c['message']));}io['to'](util[_0x10c7('0x13')](_0x10c7('0x15'),_0x4d8fc8[_0x10c7('0x9')]))[_0x10c7('0x16')](util[_0x10c7('0x13')](_0x10c7('0x17'),_0x4480c2?_0x10c7('0x18'):_0x10c7('0x19')),_0x55c113);}function writeLog(_0x2ecb76,_0x4ce96d,_0x59eb70){return logger[_0x10c7('0x1a')](util[_0x10c7('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2ecb76,_0x4ce96d[_0x10c7('0x9')],_0x59eb70));}exports[_0x10c7('0x1b')]=function(_0xe1133a,_0x5373cf,_0x41a5ba,_0x5e3279){if(_0x5373cf[_0x10c7('0x1c')]){writeLog(_0xe1133a,_0x5373cf,_0x10c7('0x1d'));return![];}if(!_0x5373cf[_0x10c7('0x1e')]){writeLog(_0xe1133a,_0x5373cf,'OFFLINE');return![];}if(_0x5373cf[_0x41a5ba+_0x10c7('0x1f')]){writeLog(_0xe1133a,_0x5373cf,_0x10c7('0x20'));return![];}if(_0x5e3279&&_0x5373cf[_0x10c7('0x21')](_0x41a5ba+_0x10c7('0x22'))&&_0x5373cf[_0x10c7('0x21')](_0x41a5ba+_0x10c7('0x23'))){if(_0x5373cf[_0x41a5ba+_0x10c7('0x22')]>0x0&&_0x5373cf[_0x41a5ba+_0x10c7('0x23')]>=_0x5373cf[_0x41a5ba+_0x10c7('0x22')]){writeLog(_0xe1133a,_0x5373cf,_0x41a5ba[_0x10c7('0x24')]()+_0x10c7('0x25'));return![];}}return!![];};exports[_0x10c7('0x26')]=function(_0x3bc016,_0xe53724,_0x3c40c3,_0x3c9665,_0xec403){return sendNotification(!![],_0x3bc016,_0xe53724,_0x3c40c3,_0x3c9665,_0xec403);};exports[_0x10c7('0x27')]=function(_0x33093e,_0x43c2ff,_0x5626cd,_0x4c89c7,_0x4c331f){return sendNotification(![],_0x33093e,_0x43c2ff,_0x5626cd,_0x4c89c7,_0x4c331f);};exports[_0x10c7('0x28')]=function(_0x460e28,_0x45aa1c,_0x206e1d){var _0x27ac7e=_0x45aa1c[_0x10c7('0x29')]['UserId'];if(!_0x27ac7e&&_0x206e1d){_0x27ac7e=_0x206e1d['id'];}var _0x4630c8=_['some'](_0x460e28[_0x45aa1c[_0x10c7('0x2a')]+'QueuesWaitingInteractions'],function(_0x3731a1){var _0x14efa1=_['capitalize'](_0x45aa1c[_0x10c7('0x2a')])+_0x10c7('0x2b');return _0x3731a1[_0x14efa1]===_0x45aa1c[_0x10c7('0x29')]['id'];});if(!_0x4630c8&&_0x27ac7e&&_0x460e28['agents'][_0x27ac7e]){_0x4630c8=_[_0x10c7('0x2c')](_0x460e28[_0x10c7('0x2d')][_0x27ac7e][_0x45aa1c[_0x10c7('0x2a')]+_0x10c7('0x2e')],function(_0x93642b){return _0x93642b['id']===_0x45aa1c[_0x10c7('0x29')]['id'];});}return _0x4630c8;};exports[_0x10c7('0x2f')]=function(_0x53e78d,_0x4983dc,_0x3d0383,_0x3fa382){if(_0x3d0383&&_0x3d0383['id']&&_0x53e78d[_0x10c7('0x2d')]&&_0x53e78d[_0x10c7('0x2d')][_0x3d0383['id']]){_0x53e78d[_0x10c7('0x2d')][_0x3d0383['id']][_0x3fa382+_0x10c7('0x2e')][_0x4983dc[_0x10c7('0x30')]['id']]={'id':_0x4983dc[_0x10c7('0x29')]['id']};}};exports[_0x10c7('0x31')]=function(_0x3ff7a9,_0x2d7f9e,_0x28b273,_0x15d76f){if(_0x28b273&&_0x28b273['id']&&_0x3ff7a9[_0x10c7('0x2d')]&&_0x3ff7a9['agents'][_0x28b273['id']]){delete _0x3ff7a9[_0x10c7('0x2d')][_0x28b273['id']][_0x15d76f+_0x10c7('0x2e')][_0x2d7f9e[_0x10c7('0x30')]['id']];}};exports[_0x10c7('0x32')]=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 9ba104e..4237aaf 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 _0x8453=['[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','validate','shelljs','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x8453,0x1f1));var _0x3845=function(_0x2c71de,_0x12e964){_0x2c71de=_0x2c71de-0x0;var _0x51cb86=_0x8453[_0x2c71de];return _0x51cb86;};'use strict';var schema=require(_0x3845('0x0'));var sh=require(_0x3845('0x1'));var _=require('lodash');var utils=require(_0x3845('0x2'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x3845('0x3'),'required':!![],'message':_0x3845('0x4')}});exports[_0x3845('0x5')]=function(_0xdb45bf,_0xd60c4){return function(_0x2fecbf){try{var _0x49ff52={'command':_0xd60c4[0x0]};var _0x238282=system['validate'](_0x49ff52,{'typecast':!![]});if(_0x238282[_0x3845('0x6')]){logger['error'](_0x3845('0x7'),_0xdb45bf,_[_0x3845('0x8')](_0x238282,'message')['join'](',\x20'));logger[_0x3845('0x9')](_0x3845('0xa'),_0xdb45bf);_0x2fecbf[_0x3845('0xb')]();}else{var _0x10d7db=this;var _0x2be8c5=utils[_0x3845('0xc')](_0xd60c4[0x0],this);logger[_0x3845('0x9')](_0x3845('0xd'),_0xdb45bf,_0x2be8c5);sh[_0x3845('0xe')](_[_0x3845('0xf')](_0x2be8c5),function(_0xcee40a,_0x376da9){logger[_0x3845('0x9')](_0x3845('0x10'),_0xdb45bf,_0xcee40a);if(_0xcee40a==0x0){var _0x4dde3d=_0x376da9[_0x3845('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x3845('0x12')](_0xd60c4[0x1])||_[_0x3845('0x13')](_0xd60c4[0x1])){logger[_0x3845('0x9')](_0x3845('0x14'),_0xdb45bf);_0x10d7db[_0x3845('0x15')][_0xd60c4[0x1]]=_0x4dde3d;}else{logger[_0x3845('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xdb45bf,_0xd60c4[0x1],_0x4dde3d);_0x10d7db[_0x3845('0x15')][_0xd60c4[0x1]]=_0x4dde3d;}}_0x2fecbf[_0x3845('0xb')]();});}}catch(_0xdcb42e){logger[_0x3845('0x16')](_0x3845('0x7'),_0xdb45bf,_[_0x3845('0x17')](_0xdcb42e)?JSON['stringify'](_0xdcb42e):_0xdcb42e);logger[_0x3845('0x9')](_0x3845('0xa'),_0xdb45bf);_0x2fecbf['next']();}};}; \ No newline at end of file +var _0x5460=['stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','isObject'];(function(_0x33441e,_0x185566){var _0x2d707e=function(_0x266f14){while(--_0x266f14){_0x33441e['push'](_0x33441e['shift']());}};_0x2d707e(++_0x185566);}(_0x5460,0x1e5));var _0x0546=function(_0x1cec0d,_0x522d1e){_0x1cec0d=_0x1cec0d-0x0;var _0x3be057=_0x5460[_0x1cec0d];return _0x3be057;};'use strict';var schema=require(_0x0546('0x0'));var sh=require(_0x0546('0x1'));var _=require(_0x0546('0x2'));var utils=require(_0x0546('0x3'));var logger=require(_0x0546('0x4'))(_0x0546('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x0546('0x6')}});exports['consequence']=function(_0x35bcf0,_0x619dfc){return function(_0x50437c){try{var _0x4f85c7={'command':_0x619dfc[0x0]};var _0x1094e7=system[_0x0546('0x0')](_0x4f85c7,{'typecast':!![]});if(_0x1094e7[_0x0546('0x7')]){logger['error']('[%s][SYSTEM]\x20%s',_0x35bcf0,_[_0x0546('0x8')](_0x1094e7,_0x0546('0x9'))[_0x0546('0xa')](',\x20'));logger[_0x0546('0xb')](_0x0546('0xc'),_0x35bcf0);_0x50437c[_0x0546('0xd')]();}else{var _0x43a598=this;var _0x3f20c5=utils[_0x0546('0xe')](_0x619dfc[0x0],this);logger[_0x0546('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x35bcf0,_0x3f20c5);sh[_0x0546('0xf')](_[_0x0546('0x10')](_0x3f20c5),function(_0x1e69f0,_0x3a4891){logger[_0x0546('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x35bcf0,_0x1e69f0);if(_0x1e69f0==0x0){var _0x19ed9d=_0x3a4891[_0x0546('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x0546('0x12')](_0x619dfc[0x1])||_['isEmpty'](_0x619dfc[0x1])){logger[_0x0546('0xb')](_0x0546('0x13'),_0x35bcf0);_0x43a598['body'][_0x619dfc[0x1]]=_0x19ed9d;}else{logger[_0x0546('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x35bcf0,_0x619dfc[0x1],_0x19ed9d);_0x43a598['body'][_0x619dfc[0x1]]=_0x19ed9d;}}_0x50437c[_0x0546('0xd')]();});}}catch(_0x3ac419){logger['error']('[%s][SYSTEM]\x20%s',_0x35bcf0,_[_0x0546('0x14')](_0x3ac419)?JSON[_0x0546('0x15')](_0x3ac419):_0x3ac419);logger[_0x0546('0xb')](_0x0546('0xc'),_0x35bcf0);_0x50437c[_0x0546('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 8da8e1d..710d5e0 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 _0x25e1=['[%s][TAG]\x20%s','finally','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','interaction','then','catch'];(function(_0x96fe19,_0x36e6a5){var _0x5b2ca1=function(_0x1ceba5){while(--_0x1ceba5){_0x96fe19['push'](_0x96fe19['shift']());}};_0x5b2ca1(++_0x36e6a5);}(_0x25e1,0x1ce));var _0x125e=function(_0x55f03a,_0x22516e){_0x55f03a=_0x55f03a-0x0;var _0x4574b7=_0x25e1[_0x55f03a];return _0x4574b7;};'use strict';var schema=require(_0x125e('0x0'));var _=require(_0x125e('0x1'));var rpc={'chatInteraction':require(_0x125e('0x2')),'openchannelInteraction':require(_0x125e('0x3')),'smsInteraction':require(_0x125e('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x125e('0x5')),'whatsappInteraction':require(_0x125e('0x6'))};var logger=require(_0x125e('0x7'))(_0x125e('0x8'));var tag=schema({'tag':{'type':_0x125e('0x9'),'required':!![],'message':_0x125e('0xa')}});exports[_0x125e('0xb')]=function(_0x2d722e,_0x32fa38,_0x380ed2,_0x1ed885){return function(_0x38ad77){try{var _0x826d6c={'tag':_0x32fa38[0x0]};var _0x2f5c07=tag[_0x125e('0x0')](_0x826d6c,{'typecast':!![]});if(_0x2f5c07['length']){logger[_0x125e('0xc')]('[%s][TAG]\x20%s',_0x2d722e,_[_0x125e('0xd')](_0x2f5c07,_0x125e('0xe'))[_0x125e('0xf')](',\x20'));logger[_0x125e('0x10')](_0x125e('0x11'),_0x2d722e);_0x38ad77[_0x125e('0x12')]();}else{var _0x293c74={'ids':[_0x32fa38[0x0]]};if(rpc[_0x1ed885['channel']+_0x125e('0x13')]){rpc[_0x1ed885[_0x125e('0x14')]+_0x125e('0x13')]['addTags'](_0x1ed885[_0x125e('0x15')]['id'],_0x293c74)[_0x125e('0x16')](function(_0x586735){logger[_0x125e('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2d722e,_0x32fa38[0x1],_0x1ed885[_0x125e('0x14')],_0x1ed885[_0x125e('0x15')]['id']);})[_0x125e('0x17')](function(_0x38b021){logger[_0x125e('0xc')](_0x125e('0x18'),_0x2d722e,JSON['stringify'](_0x38b021));logger[_0x125e('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2d722e);})[_0x125e('0x19')](function(){_0x38ad77[_0x125e('0x12')]();});}}}catch(_0x264261){logger[_0x125e('0xc')](_0x125e('0x18'),_0x2d722e,_['isObject'](_0x264261)?JSON[_0x125e('0x1a')](_0x264261):_0x264261);logger[_0x125e('0x10')](_0x125e('0x11'),_0x2d722e);_0x38ad77[_0x125e('0x12')]();}};}; \ No newline at end of file +var _0x136c=['join','info','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x9eacc8,_0x524b59){var _0x260387=function(_0x21da9c){while(--_0x21da9c){_0x9eacc8['push'](_0x9eacc8['shift']());}};_0x260387(++_0x524b59);}(_0x136c,0x79));var _0xc136=function(_0xbc03e6,_0x12a19c){_0xbc03e6=_0xbc03e6-0x0;var _0x4424eb=_0x136c[_0xbc03e6];return _0x4424eb;};'use strict';var schema=require(_0xc136('0x0'));var _=require(_0xc136('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc136('0x2')),'smsInteraction':require(_0xc136('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc136('0x4')),'whatsappInteraction':require(_0xc136('0x5'))};var logger=require(_0xc136('0x6'))(_0xc136('0x7'));var tag=schema({'tag':{'type':_0xc136('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x3d0d86,_0x4fff07,_0x52dfe,_0x42f85a){return function(_0x505e28){try{var _0xb25ac8={'tag':_0x4fff07[0x0]};var _0x1c7c43=tag[_0xc136('0x0')](_0xb25ac8,{'typecast':!![]});if(_0x1c7c43[_0xc136('0x9')]){logger[_0xc136('0xa')](_0xc136('0xb'),_0x3d0d86,_[_0xc136('0xc')](_0x1c7c43,_0xc136('0xd'))[_0xc136('0xe')](',\x20'));logger[_0xc136('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3d0d86);_0x505e28[_0xc136('0x10')]();}else{var _0x4efb25={'ids':[_0x4fff07[0x0]]};if(rpc[_0x42f85a['channel']+_0xc136('0x11')]){rpc[_0x42f85a['channel']+_0xc136('0x11')][_0xc136('0x12')](_0x42f85a[_0xc136('0x13')]['id'],_0x4efb25)[_0xc136('0x14')](function(_0x17815d){logger['info'](_0xc136('0x15'),_0x3d0d86,_0x4fff07[0x1],_0x42f85a[_0xc136('0x16')],_0x42f85a['interaction']['id']);})[_0xc136('0x17')](function(_0x1d35fc){logger[_0xc136('0xa')]('[%s][TAG]\x20%s',_0x3d0d86,JSON[_0xc136('0x18')](_0x1d35fc));logger[_0xc136('0xf')](_0xc136('0x19'),_0x3d0d86);})[_0xc136('0x1a')](function(){_0x505e28[_0xc136('0x10')]();});}}}catch(_0x2f0b23){logger[_0xc136('0xa')](_0xc136('0xb'),_0x3d0d86,_['isObject'](_0x2f0b23)?JSON['stringify'](_0x2f0b23):_0x2f0b23);logger['info'](_0xc136('0x19'),_0x3d0d86);_0x505e28[_0xc136('0x10')]();}};}; \ 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 276ebf4..cb7a36d 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 _0x6014=['params','stringify','POST','application/json-rpc','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','jsonrpc','2.0','method'];(function(_0x51a74c,_0x56542d){var _0x2859ca=function(_0x2825f9){while(--_0x2825f9){_0x51a74c['push'](_0x51a74c['shift']());}};_0x2859ca(++_0x56542d);}(_0x6014,0x11f));var _0x4601=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0x6014[_0x1f5143];return _0x383a38;};'use strict';var rp=require(_0x4601('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x4601('0x1'));var arr=[];exports['consequence']=function(_0x438262,_0x49d3ef){return function(_0x498545){var _0x589692=_0x49d3ef[0xa];var _0x1e7590=_0x49d3ef[0xb];var _0x55ae53=_0x49d3ef[0xc];var _0x1f7a72=_0x49d3ef[0xd];var _0x33af1c=_0x49d3ef[0xe];var _0x200720=_0x49d3ef[0xf][_0x4601('0x2')](/\n/g,_0x4601('0x3'));var _0x1f2c54=_0x49d3ef[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4601('0x4')](_0x1e7590)){arr[_0x4601('0x5')](_0x1e7590);var _0x249e46=_0x49d3ef[0x3];var _0x48448f=_0x49d3ef[0x4];var _0x1461dd=_0x49d3ef[0x1];var _0x12d86=_0x49d3ef[0x0];var _0x3d9dca={};_0x3d9dca[_0x4601('0x6')]=_0x49d3ef[0x8]+'?params='+_0x55ae53+'|'+_0x589692+'|'+_0x1f7a72+'|'+_0x1e7590+'|'+_0x33af1c;_0x3d9dca['urlOnRing']=_0x49d3ef[0x7]+'?params='+_0x55ae53+'|'+_0x589692+'|'+_0x1f7a72+'|'+_0x1e7590+'|'+_0x33af1c+'|'+_0x200720+'|'+_0x1f2c54;_0x3d9dca['title']=_0x49d3ef[0x9];var _0x48789b={};_0x48789b[_0x4601('0x7')]=_0x4601('0x8');_0x48789b[_0x4601('0x9')]='login';var _0x2fc7a1=[];_0x2fc7a1[_0x4601('0x5')](_0x49d3ef[0x2]);_0x2fc7a1['push'](_0x49d3ef[0x5]);_0x2fc7a1['push'](_0x49d3ef[0x6]);_0x48789b[_0x4601('0xa')]=_0x2fc7a1;_0x48789b['id']=0x1;var _0x440b1e=JSON[_0x4601('0xb')](_0x48789b);var _0x1a140c={'encoding':'utf8','method':_0x4601('0xc'),'timeout':0x2710,'url':_0x249e46,'headers':{'Content-Type':_0x4601('0xd')},'body':_0x440b1e};return rp(_0x1a140c)['then'](function(_0x38a555){const _0x318178=JSON[_0x4601('0xe')](_0x38a555);if(!_0x318178[_0x4601('0xf')]['logged']){throw new Error(_0x4601('0x10'));}var _0x808eb7=_0x1e7590;var _0x2fb53b='channelId='+_0x1461dd+'&serviceId='+_0x12d86+_0x4601('0x11')+_0x808eb7+'&data='+JSON[_0x4601('0xb')](_0x3d9dca);var _0x39558f=_0x48448f+'?'+_0x2fb53b;return rp(_0x39558f);})[_0x4601('0x12')](function(_0x4451a7){logger['info'](_0x4601('0x13'),_0x438262,_0x4451a7);_0x498545['stop']();})[_0x4601('0x14')](function(_0x203fb3){logger[_0x4601('0x15')](_0x4601('0x16'),_0x438262,_[_0x4601('0x17')](_0x203fb3)?JSON[_0x4601('0xb')](_0x203fb3):_0x203fb3);_0x498545[_0x4601('0x18')]();});}else{logger['info'](_0x4601('0x19'),_0x438262);_0x498545[_0x4601('0x1a')]();}};}; \ No newline at end of file +var _0xdee2=['[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','params','stringify','utf8','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','info'];(function(_0x3f670b,_0x10f414){var _0x1c0978=function(_0x5c1276){while(--_0x5c1276){_0x3f670b['push'](_0x3f670b['shift']());}};_0x1c0978(++_0x10f414);}(_0xdee2,0x1d6));var _0x2dee=function(_0x34e81a,_0x131247){_0x34e81a=_0x34e81a-0x0;var _0x5df1c5=_0xdee2[_0x34e81a];return _0x5df1c5;};'use strict';var rp=require(_0x2dee('0x0'));var logger=require(_0x2dee('0x1'))(_0x2dee('0x2'));var _=require(_0x2dee('0x3'));var arr=[];exports[_0x2dee('0x4')]=function(_0x40b5b1,_0x211d52){return function(_0x2df6ef){var _0x37d5b6=_0x211d52[0xa];var _0x458dcb=_0x211d52[0xb];var _0x22015a=_0x211d52[0xc];var _0xbac5e8=_0x211d52[0xd];var _0x173009=_0x211d52[0xe];var _0x1b2572=_0x211d52[0xf][_0x2dee('0x5')](/\n/g,'\x20-\x20');var _0x3b011a=_0x211d52[0x10][_0x2dee('0x5')](/\n/g,'\x20');if(!arr[_0x2dee('0x6')](_0x458dcb)){arr[_0x2dee('0x7')](_0x458dcb);var _0x167036=_0x211d52[0x3];var _0x25a0f9=_0x211d52[0x4];var _0x368397=_0x211d52[0x1];var _0x5f4ece=_0x211d52[0x0];var _0x5e58dd={};_0x5e58dd[_0x2dee('0x8')]=_0x211d52[0x8]+_0x2dee('0x9')+_0x22015a+'|'+_0x37d5b6+'|'+_0xbac5e8+'|'+_0x458dcb+'|'+_0x173009;_0x5e58dd[_0x2dee('0xa')]=_0x211d52[0x7]+_0x2dee('0x9')+_0x22015a+'|'+_0x37d5b6+'|'+_0xbac5e8+'|'+_0x458dcb+'|'+_0x173009+'|'+_0x1b2572+'|'+_0x3b011a;_0x5e58dd[_0x2dee('0xb')]=_0x211d52[0x9];var _0x520173={};_0x520173[_0x2dee('0xc')]='2.0';_0x520173[_0x2dee('0xd')]='login';var _0x2b8d49=[];_0x2b8d49[_0x2dee('0x7')](_0x211d52[0x2]);_0x2b8d49[_0x2dee('0x7')](_0x211d52[0x5]);_0x2b8d49[_0x2dee('0x7')](_0x211d52[0x6]);_0x520173[_0x2dee('0xe')]=_0x2b8d49;_0x520173['id']=0x1;var _0x414949=JSON[_0x2dee('0xf')](_0x520173);var _0xb01de={'encoding':_0x2dee('0x10'),'method':'POST','timeout':0x2710,'url':_0x167036,'headers':{'Content-Type':'application/json-rpc'},'body':_0x414949};return rp(_0xb01de)[_0x2dee('0x11')](function(_0xed7f0f){const _0x5a680d=JSON[_0x2dee('0x12')](_0xed7f0f);if(!_0x5a680d['result'][_0x2dee('0x13')]){throw new Error(_0x2dee('0x14'));}var _0x188f6d=_0x458dcb;var _0xd53c7f=_0x2dee('0x15')+_0x368397+'&serviceId='+_0x5f4ece+'&sessionId='+_0x188f6d+'&data='+JSON[_0x2dee('0xf')](_0x5e58dd);var _0x44b0a6=_0x25a0f9+'?'+_0xd53c7f;return rp(_0x44b0a6);})[_0x2dee('0x11')](function(_0x316051){logger[_0x2dee('0x16')](_0x2dee('0x17'),_0x40b5b1,_0x316051);_0x2df6ef[_0x2dee('0x18')]();})[_0x2dee('0x19')](function(_0x4047ad){logger['error'](_0x2dee('0x1a'),_0x40b5b1,_['isObject'](_0x4047ad)?JSON[_0x2dee('0xf')](_0x4047ad):_0x4047ad);_0x2df6ef[_0x2dee('0x18')]();});}else{logger[_0x2dee('0x16')](_0x2dee('0x1b'),_0x40b5b1);_0x2df6ef[_0x2dee('0x1c')]();}};}; \ 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 c0d4d71..2e81600 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3ba8b5,_0x140bbd){var _0x229d00=function(_0x45722c){while(--_0x45722c){_0x3ba8b5['push'](_0x3ba8b5['shift']());}};_0x229d00(++_0x140bbd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x12eddc,_0x21a734){var _0x2ed7ac=function(_0x215dc2){while(--_0x215dc2){_0x12eddc['push'](_0x12eddc['shift']());}};_0x2ed7ac(++_0x21a734);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 81d292c..63d3d48 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 _0x58e6=['\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','tvox','account','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval'];(function(_0x236957,_0x3044b7){var _0xaeccaf=function(_0x39d247){while(--_0x39d247){_0x236957['push'](_0x236957['shift']());}};_0xaeccaf(++_0x3044b7);}(_0x58e6,0x1c2));var _0x658e=function(_0x3259f1,_0x42ec8e){_0x3259f1=_0x3259f1-0x0;var _0x5abf55=_0x58e6[_0x3259f1];return _0x5abf55;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x658e('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0x658e('0x3'))(_0x658e('0x4'));var rpc={'openchannelQueueReport':require(_0x658e('0x5')),'mailQueueReport':require(_0x658e('0x6')),'chatQueueReport':require(_0x658e('0x7')),'smsQueueReport':require(_0x658e('0x8')),'faxQueueReport':require(_0x658e('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x7a343,_0xa73acf,_0x1e2c26){return util['format'](_0x658e('0xa'),_0x7a343,_0xa73acf||0x0,_0x1e2c26||0x0);}function getIntervals(_0x6ea6e,_0x13ab91){var _0x322320=[];if(!_[_0x658e('0xb')](_0x13ab91[_0x658e('0xc')])&&!_['isNil'](_0x6ea6e[_0x13ab91['IntervalId']])&&!_[_0x658e('0xb')](_0x6ea6e[_0x13ab91[_0x658e('0xc')]][_0x658e('0xd')])){_0x322320=_[_0x658e('0xe')](_0x6ea6e[_0x13ab91[_0x658e('0xc')]][_0x658e('0xd')],_0x658e('0xf'));}else if(!_['isNil'](_0x13ab91[_0x658e('0xf')])){_0x322320=[_0x13ab91[_0x658e('0xf')]];}return _0x322320;}exports[_0x658e('0x10')]=function(_0xe0d724){_0xe0d724['rules']={};return new BPromise(function(_0x1e2044,_0x33bfd1){var _0x5a88e8={'Start':function(_0x4983e9){var _0x3a8385=this;return new Promise(function(_0x17c487,_0x3555ff){if(_0x4983e9){try{var _0x58dc8e=[];var _0x14b331=getId(_0x4983e9['channel'],_0x4983e9[_0x658e('0x11')]?_0x4983e9[_0x658e('0x11')]['id']:0x0,_0x4983e9[_0x658e('0x12')]?_0x4983e9[_0x658e('0x12')]['id']:0x0);var _0x23bb10=sUtils[_0x658e('0x13')](_0xe0d724,_0x4983e9);if(_0x4983e9['transfer']||!_0x23bb10&&_0x4983e9[_0x658e('0x14')]&&_[_0x658e('0x15')](_0x4983e9[_0x658e('0x14')])&&_0x4983e9[_0x658e('0x14')][_0x658e('0x16')]){for(var _0x544df0=0x0;_0x544df0<_0x4983e9['applications'][_0x658e('0x16')];_0x544df0+=0x1){var _0x1cc63d=_0x4983e9['applications'][_0x544df0];if(fs[_0x658e('0x17')](path[_0x658e('0x18')](__dirname,_0x658e('0x14'),_0x1cc63d[_0x658e('0x19')]+'.js'))){var _0xd9885d=[];switch(_0x1cc63d[_0x658e('0x19')][_0x658e('0x1a')]()){case _0x658e('0x1b'):var _0xe6cf1a=_0x1cc63d[_0x658e('0x1c')][_0x658e('0x1d')](',');if(_0x4983e9[_0x658e('0x1e')]===_0x658e('0x1f')){_0xd9885d[_0x658e('0x20')](_0xe6cf1a[0x0]);_0xd9885d[_0x658e('0x20')](_0xe6cf1a[0x1]);_0xd9885d['push'](_0xe6cf1a[_0x658e('0x21')](0x2,_0xe6cf1a[_0x658e('0x16')])['join'](','));}else{_0xd9885d[_0x658e('0x20')](_0xe6cf1a[0x0]);_0xd9885d[_0x658e('0x20')](_0xe6cf1a[_0x658e('0x21')](0x1,_0xe6cf1a[_0x658e('0x16')])[_0x658e('0x18')](','));}break;case _0x658e('0x22'):var _0x5d23dd=_0x1cc63d['appdata']['split'](',');_0xd9885d[_0x658e('0x20')](_0x5d23dd[0x0]);_0xd9885d[_0x658e('0x20')](_0x5d23dd[0x1]);_0xd9885d[_0x658e('0x20')](_0x5d23dd['slice'](0x2,_0x5d23dd[_0x658e('0x16')])[_0x658e('0x18')](','));break;case _0x658e('0x23'):var _0x4edddd=_0x1cc63d['appdata'][_0x658e('0x1d')](',');_0xd9885d['push'](_0x4edddd[0x0]);_0xd9885d[_0x658e('0x20')](_0x4edddd[0x1]);_0xd9885d[_0x658e('0x20')](_0x4edddd[0x2]);_0xd9885d[_0x658e('0x20')](_0x4edddd[0x3]);_0xd9885d[_0x658e('0x20')](_0x4edddd[_0x658e('0x21')](0x4,_0x4edddd[_0x658e('0x16')])[_0x658e('0x18')](','));break;case'amazonlex':var _0x4518fa=_0x1cc63d['appdata'][_0x658e('0x1d')](',');_0xd9885d[_0x658e('0x20')](_0x4518fa[0x0]);_0xd9885d['push'](_0x4518fa[0x1]);_0xd9885d[_0x658e('0x20')](_0x4518fa[0x2]);_0xd9885d[_0x658e('0x20')](_0x4518fa[0x3]);_0xd9885d[_0x658e('0x20')](_0x4518fa[_0x658e('0x21')](0x4,_0x4518fa['length'])['join'](','));break;case _0x658e('0x11'):_0xd9885d[_0x658e('0x20')](_0x1cc63d['appdata']);break;case'tag':_0xd9885d[_0x658e('0x20')](_0x1cc63d['TagId']);_0xd9885d[_0x658e('0x20')](_0x1cc63d[_0x658e('0x1c')]);break;case _0x658e('0x24'):var _0x5224d8=utils['getMustacheRender'](_0x4983e9[_0x658e('0x25')]['notificationTemplate'],_0x4983e9);var _0x1f881f=_0x1cc63d[_0x658e('0x1c')][_0x658e('0x1d')](',');_0xd9885d[_0x658e('0x20')](_0x1f881f[0x0]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x1]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x2]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x3]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x4]);_0xd9885d['push'](_0x1f881f[0x5]);_0xd9885d['push'](_0x1f881f[0x6]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x7]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0x8]);_0xd9885d['push'](_0x1f881f[0x9]);_0xd9885d[_0x658e('0x20')](_0x1f881f[0xa]);_0xd9885d[_0x658e('0x20')](_0x4983e9[_0x658e('0x12')]['id']);_0xd9885d['push'](_0x4983e9[_0x658e('0x11')]['id']);_0xd9885d['push'](_0x1cc63d[_0x658e('0x26')]);_0xd9885d[_0x658e('0x20')](_0x4983e9[_0x658e('0x12')][_0x658e('0x27')]);_0xd9885d[_0x658e('0x20')](_0x4983e9[_0x658e('0x28')][_0x658e('0x28')]);_0xd9885d['push'](_0x5224d8);break;default:_0xd9885d=_[_0x658e('0xb')](_0x1cc63d['appdata'])?[]:_0x1cc63d['appdata'][_0x658e('0x1d')](',');}var _0x378909={'id':util[_0x658e('0x29')](_0x658e('0x2a'),_0x14b331,_0x1cc63d['id'],_0x1cc63d[_0x658e('0x19')]),'condition':require(_0x658e('0x2b'))[_0x658e('0x2c')](_0x14b331,getIntervals(_0xe0d724[_0x658e('0x2d')],_0x1cc63d),_0xe0d724),'consequence':require('./applications/'+_0x1cc63d[_0x658e('0x19')])[_0x658e('0x2e')](_0x14b331,_0xd9885d,_0xe0d724,_0x4983e9),'p':_0x1cc63d['priority']||0x0};logger[_0x658e('0x2f')](_0x658e('0x30'),_0x378909['id'],_0x658e('0x31'),getIntervals(_0xe0d724['intervals'],_0x1cc63d)[_0x658e('0x18')](_0x658e('0x32')));_0x58dc8e[_0x658e('0x20')](_0x378909);}else{logger[_0x658e('0x33')](_0x658e('0x34'),path[_0x658e('0x18')](__dirname,'applications',_0x1cc63d['app']+'.js'));}}_0xe0d724['rules'][_0x14b331]=new RuleEngine(_0x58dc8e);_0xe0d724[_0x658e('0x35')][_0x14b331][_0x658e('0x36')](_0x4983e9,function(_0x1eca66){logger[_0x658e('0x2f')](_0x658e('0x37'),JSON['stringify'](_0x1eca66[_0x658e('0x38')]));if(_0xe0d724[_0x658e('0x35')][_0x14b331]){_0xe0d724[_0x658e('0x35')][_0x14b331]['emit'](_0x658e('0x39'));}});return _0x17c487({'code':0xc8,'message':_0x4983e9});}else{if(_0x23bb10){logger[_0x658e('0x2f')](util[_0x658e('0x29')](_0x658e('0x3a'),_0x14b331));}else{logger[_0x658e('0x2f')](_0x658e('0x3b'));}return _0x17c487({'code':0xc8,'message':_0x4983e9});}}catch(_0x3d3b16){logger[_0x658e('0x33')](_0x3d3b16['stack']);return _0x3555ff(_0x3a8385[_0x658e('0x33')](0x1f4,_0x3d3b16));}}return _0x3555ff(_0x658e('0x3c'));});},'AcceptMessage':function(_0x5a1703){var _0x4767d7=this;return new Promise(function(_0x51d21f,_0x240d42){if(_0x5a1703[_0x658e('0x3d')]&&_0x5a1703['agent']['id']){if(_0xe0d724[_0x658e('0x3e')][_0x5a1703['agent']['id']]){_0xe0d724[_0x658e('0x3e')][_0x5a1703[_0x658e('0x3d')]['id']]['busy']=![];_0xe0d724['agents'][_0x5a1703[_0x658e('0x3d')]['id']][_0x658e('0x3f')]=undefined;}}if(_0x5a1703[_0x658e('0x11')]&&_0x5a1703[_0x658e('0x11')]['id']){try{var _0x4a1a52=getId(_0x5a1703[_0x658e('0x1e')],_0x5a1703[_0x658e('0x11')]?_0x5a1703['message']['id']:0x0,_0x5a1703['interaction']?_0x5a1703['interaction']['id']:0x0);if(_0xe0d724[_0x658e('0x35')][_0x4a1a52]){_0xe0d724[_0x658e('0x35')][_0x4a1a52]['emit'](_0x658e('0x40'));if(rpc[_0x5a1703[_0x658e('0x1e')]+_0x658e('0x41')]){rpc[_0x5a1703[_0x658e('0x1e')]+'QueueReport'][_0x658e('0x42')](_0x4a1a52,{'UserId':_0x5a1703[_0x658e('0x11')][_0x658e('0x43')]})[_0x658e('0x44')](function(){logger[_0x658e('0x33')](_0x658e('0x45'));});}}return _0x51d21f({'code':0xc8,'message':_0x5a1703});}catch(_0x5a0321){logger['error'](_0x5a0321['stack']);return _0x240d42(_0x4767d7['error'](0x1f4,_0x5a0321));}}logger['error']('message\x20is\x20empty');return _0x240d42(_0x4767d7[_0x658e('0x33')](0x1f4,_0x658e('0x46')));});},'RejectMessage':function(_0x38e902){var _0x49d313=this;return new Promise(function(_0x2af3f7,_0xa7ea32){if(_0x38e902[_0x658e('0x3d')]&&_0x38e902[_0x658e('0x3d')]['id']){try{if(_0xe0d724[_0x658e('0x3e')][_0x38e902[_0x658e('0x3d')]['id']]){_0xe0d724[_0x658e('0x3e')][_0x38e902[_0x658e('0x3d')]['id']]['busy']=![];_0xe0d724[_0x658e('0x3e')][_0x38e902['agent']['id']][_0x658e('0x3f')]=undefined;}return _0x2af3f7({'code':0xc8,'message':_0x38e902});}catch(_0x501c59){logger[_0x658e('0x33')](_0x501c59[_0x658e('0x47')]);return _0xa7ea32(_0x49d313[_0x658e('0x33')](0x1f4,_0x501c59));}}logger[_0x658e('0x33')](_0x658e('0x46'));return _0xa7ea32(_0x49d313[_0x658e('0x33')](0x1f4,_0x658e('0x46')));});},'AbandonInteraction':function(_0x100cba){var _0x1c8989=this;return new Promise(function(_0x22d50f,_0x464b65){if(_0x100cba[_0x658e('0x1e')]&&_0x100cba['interaction']&&_0x100cba['interaction']['id']){try{var _0x591991=getId(_0x100cba[_0x658e('0x1e')],_0x100cba[_0x658e('0x11')]?_0x100cba[_0x658e('0x11')]['id']:0x0,_0x100cba[_0x658e('0x12')]?_0x100cba[_0x658e('0x12')]['id']:0x0);if(_0xe0d724[_0x658e('0x35')][_0x591991]){_0xe0d724[_0x658e('0x35')][_0x591991][_0x658e('0x48')](_0x658e('0x40'));}return _0x22d50f({'code':0xc8,'message':_0x100cba});}catch(_0x218e39){logger[_0x658e('0x33')](_0x218e39[_0x658e('0x47')]);return _0x464b65(_0x1c8989[_0x658e('0x33')](0x1f4,_0x218e39));}}logger[_0x658e('0x33')](_0x658e('0x46'));return _0x464b65(_0x1c8989[_0x658e('0x33')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xe7db6){var _0x5b096c=this;return new Promise(function(_0x134411,_0x22b776){if(_0xe0d724[_0x658e('0x3e')][_0x658e('0x49')](_0xe7db6['id'])){for(var _0x212293 in _0xe7db6[_0x658e('0x4a')]){if(_0xe7db6[_0x658e('0x4a')][_0x658e('0x49')](_0x212293)){if(_0xe0d724[_0x658e('0x3e')][_0xe7db6['id']][_0x658e('0x49')](_0x212293+_0x658e('0x4b'))){_0xe0d724[_0x658e('0x3e')][_0xe7db6['id']][_0x212293+_0x658e('0x4b')]=parseInt(_0xe7db6[_0x658e('0x4a')][_0x212293],0xa);}}}_0xe0d724[_0x658e('0x3e')][_0xe7db6['id']][_0x658e('0x4c')]();return _0x134411({'code':0xc8,'message':_0xe0d724[_0x658e('0x3e')][_0xe7db6['id']]});}else{return _0x22b776(_0x5b096c['error'](0x1f4,_0x658e('0x4d')));}});},'Agents':function(_0x3888b4){return new Promise(function(_0x510a10){var _0xffc528=_[_0x658e('0x4e')](_0xe0d724[_0x658e('0x3e')]);if(_0x3888b4&&_0x3888b4['id']){var _0x1638e0=_['find'](_0xffc528,function(_0xcae6df){return _0xcae6df['id']===_0x3888b4['id'];});_0x510a10(_0x1638e0);}else{_0x510a10({'count':_0xffc528[_0x658e('0x16')],'rows':_0xffc528});}});},'ChatQueues':function(){return new Promise(function(_0x7bc1a8){var _0x5bdb2f=[];for(var _0x4b688e in _0xe0d724[_0x658e('0x4f')]){if(_0xe0d724[_0x658e('0x4f')][_0x658e('0x49')](_0x4b688e)){var _0x4ccb4e=_0xe0d724[_0x658e('0x4f')][_0x4b688e];var _0x1a3372={'id':_0x4ccb4e['id'],'available':_0x4ccb4e[_0x658e('0x50')],'loggedIn':_0x4ccb4e[_0x658e('0x51')],'name':_0x4ccb4e[_0x658e('0x52')],'paused':_0x4ccb4e[_0x658e('0x53')],'waiting':_0x4ccb4e[_0x658e('0x54')]};_0x5bdb2f[_0x658e('0x20')](_0x1a3372);}}_0x7bc1a8({'count':_0x5bdb2f[_0x658e('0x16')],'rows':_0x5bdb2f});});},'MailQueues':function(){return new Promise(function(_0x56fce9){var _0x1ca7f5=[];for(var _0x3b12cb in _0xe0d724['mailQueues']){if(_0xe0d724[_0x658e('0x55')]['hasOwnProperty'](_0x3b12cb)){var _0x556e61=_0xe0d724[_0x658e('0x55')][_0x3b12cb];var _0x9503e0={'id':_0x556e61['id'],'available':_0x556e61['available'],'loggedIn':_0x556e61['loggedIn'],'name':_0x556e61['name'],'paused':_0x556e61[_0x658e('0x53')],'waiting':_0x556e61[_0x658e('0x54')]};_0x1ca7f5[_0x658e('0x20')](_0x9503e0);}}_0x56fce9({'count':_0x1ca7f5[_0x658e('0x16')],'rows':_0x1ca7f5});});},'OpenchannelQueues':function(){return new Promise(function(_0xe4e9d){var _0x163af3=[];for(var _0x25cbf6 in _0xe0d724[_0x658e('0x56')]){if(_0xe0d724[_0x658e('0x56')]['hasOwnProperty'](_0x25cbf6)){var _0x37b09e=_0xe0d724[_0x658e('0x56')][_0x25cbf6];var _0x32f51a={'id':_0x37b09e['id'],'available':_0x37b09e['available'],'loggedIn':_0x37b09e[_0x658e('0x51')],'name':_0x37b09e['name'],'paused':_0x37b09e[_0x658e('0x53')],'waiting':_0x37b09e['waiting']};_0x163af3[_0x658e('0x20')](_0x32f51a);}}_0xe4e9d({'count':_0x163af3[_0x658e('0x16')],'rows':_0x163af3});});},'SmsQueues':function(){return new Promise(function(_0x2596a4){var _0x322124=[];for(var _0x14d4c4 in _0xe0d724[_0x658e('0x57')]){if(_0xe0d724[_0x658e('0x57')]['hasOwnProperty'](_0x14d4c4)){var _0x4d046e=_0xe0d724['smsQueues'][_0x14d4c4];var _0x239a93={'id':_0x4d046e['id'],'available':_0x4d046e[_0x658e('0x50')],'loggedIn':_0x4d046e[_0x658e('0x51')],'name':_0x4d046e['name'],'paused':_0x4d046e[_0x658e('0x53')],'waiting':_0x4d046e[_0x658e('0x54')]};_0x322124[_0x658e('0x20')](_0x239a93);}}_0x2596a4({'count':_0x322124[_0x658e('0x16')],'rows':_0x322124});});},'FaxQueues':function(){return new Promise(function(_0x5e6d14){var _0x3621ef=[];for(var _0x513a39 in _0xe0d724[_0x658e('0x58')]){if(_0xe0d724['faxQueues']['hasOwnProperty'](_0x513a39)){var _0x1ca6e0=_0xe0d724[_0x658e('0x58')][_0x513a39];var _0x3d39d5={'id':_0x1ca6e0['id'],'available':_0x1ca6e0['available'],'loggedIn':_0x1ca6e0[_0x658e('0x51')],'name':_0x1ca6e0['name'],'paused':_0x1ca6e0['paused'],'waiting':_0x1ca6e0[_0x658e('0x54')]};_0x3621ef[_0x658e('0x20')](_0x3d39d5);}}_0x5e6d14({'count':_0x3621ef[_0x658e('0x16')],'rows':_0x3621ef});});},'WhatsappQueues':function(){return new Promise(function(_0x55c512){var _0x5f32d0=[];for(var _0x5adcb2 in _0xe0d724['whatsappQueues']){if(_0xe0d724[_0x658e('0x59')][_0x658e('0x49')](_0x5adcb2)){var _0x36621c=_0xe0d724[_0x658e('0x59')][_0x5adcb2];var _0xa3241b={'id':_0x36621c['id'],'available':_0x36621c['available'],'loggedIn':_0x36621c[_0x658e('0x51')],'name':_0x36621c['name'],'paused':_0x36621c['paused'],'waiting':_0x36621c[_0x658e('0x54')]};_0x5f32d0[_0x658e('0x20')](_0xa3241b);}}_0x55c512({'count':_0x5f32d0[_0x658e('0x16')],'rows':_0x5f32d0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x133216){var _0x1e074b=_[_0x658e('0x4e')](_0xe0d724['chatQueuesWaitingInteractions']);_0x133216({'count':_0x1e074b[_0x658e('0x16')],'rows':_0x1e074b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2dc790){var _0x3e3620=_[_0x658e('0x4e')](_0xe0d724[_0x658e('0x5a')]);_0x2dc790({'count':_0x3e3620[_0x658e('0x16')],'rows':_0x3e3620});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x564560){var _0x579f1a=_[_0x658e('0x4e')](_0xe0d724[_0x658e('0x5b')]);_0x564560({'count':_0x579f1a[_0x658e('0x16')],'rows':_0x579f1a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x541a5e){var _0x16369d=_['values'](_0xe0d724[_0x658e('0x5c')]);_0x541a5e({'count':_0x16369d['length'],'rows':_0x16369d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3237d4){var _0x16157c=_[_0x658e('0x4e')](_0xe0d724[_0x658e('0x5d')]);_0x3237d4({'count':_0x16157c[_0x658e('0x16')],'rows':_0x16157c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3ab042){var _0x3e7df6=_[_0x658e('0x4e')](_0xe0d724['whatsappQueuesWaitingInteractions']);_0x3ab042({'count':_0x3e7df6[_0x658e('0x16')],'rows':_0x3e7df6});});}};var _0x4c6a02=jayson[_0x658e('0x5e')](_0x5a88e8)['http']();_0x4c6a02['on'](_0x658e('0x33'),function(_0xf4cfb8){logger[_0x658e('0x33')](JSON[_0x658e('0x5f')](_0xf4cfb8));return _0x33bfd1(_0xf4cfb8);});_0x4c6a02[_0x658e('0x10')](0x232c,_0x658e('0x60'),function(){console[_0x658e('0x61')](_0x658e('0x62'),0x232c);return _0x1e2044(_0x658e('0x63')+0x232c);});});}; \ No newline at end of file +var _0xd4ad=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','join','app','toLowerCase','appdata','mail','push','slice','dialogflowv2','amazonlex','split','tag','getMustacheRender','notificationTemplate','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','matchPath','complete','Skipped\x20routing\x20for\x20%s','error','agent','agents','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','available','waiting','mailQueues','loggedIn','name','paused','openchannelQueues','smsQueues'];(function(_0x106fd3,_0x3c411e){var _0x2a3914=function(_0x1b2111){while(--_0x1b2111){_0x106fd3['push'](_0x106fd3['shift']());}};_0x2a3914(++_0x3c411e);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x5c04af,_0x5da744){_0x5c04af=_0x5c04af-0x0;var _0x144b35=_0xd4ad[_0x5c04af];return _0x144b35;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var path=require(_0xdd4a('0x2'));var fs=require('fs');var jayson=require(_0xdd4a('0x3'));var BPromise=require(_0xdd4a('0x4'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xdd4a('0x5'))(_0xdd4a('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xdd4a('0x7')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xdd4a('0x8'));function getId(_0x5b5ab3,_0x3c7a01,_0x45647c){return util[_0xdd4a('0x9')](_0xdd4a('0xa'),_0x5b5ab3,_0x3c7a01||0x0,_0x45647c||0x0);}function getIntervals(_0xd1ee35,_0x12d408){var _0x5a6606=[];if(!_[_0xdd4a('0xb')](_0x12d408[_0xdd4a('0xc')])&&!_[_0xdd4a('0xb')](_0xd1ee35[_0x12d408['IntervalId']])&&!_['isNil'](_0xd1ee35[_0x12d408[_0xdd4a('0xc')]][_0xdd4a('0xd')])){_0x5a6606=_['map'](_0xd1ee35[_0x12d408[_0xdd4a('0xc')]]['Intervals'],_0xdd4a('0xe'));}else if(!_[_0xdd4a('0xb')](_0x12d408[_0xdd4a('0xe')])){_0x5a6606=[_0x12d408[_0xdd4a('0xe')]];}return _0x5a6606;}exports[_0xdd4a('0xf')]=function(_0x3d3656){_0x3d3656[_0xdd4a('0x10')]={};return new BPromise(function(_0x5483cd,_0xcc3e69){var _0x1098fc={'Start':function(_0x1614b3){var _0x1859f4=this;return new Promise(function(_0x229a65,_0xe59be3){if(_0x1614b3){try{var _0x5d72a1=[];var _0x31551d=getId(_0x1614b3[_0xdd4a('0x11')],_0x1614b3[_0xdd4a('0x12')]?_0x1614b3[_0xdd4a('0x12')]['id']:0x0,_0x1614b3[_0xdd4a('0x13')]?_0x1614b3[_0xdd4a('0x13')]['id']:0x0);var _0xdf7dd6=sUtils[_0xdd4a('0x14')](_0x3d3656,_0x1614b3);if(_0x1614b3[_0xdd4a('0x15')]||!_0xdf7dd6&&_0x1614b3[_0xdd4a('0x16')]&&_['isArray'](_0x1614b3[_0xdd4a('0x16')])&&_0x1614b3['applications']['length']){for(var _0x13ca63=0x0;_0x13ca63<_0x1614b3['applications'][_0xdd4a('0x17')];_0x13ca63+=0x1){var _0x534e91=_0x1614b3['applications'][_0x13ca63];if(fs[_0xdd4a('0x18')](path[_0xdd4a('0x19')](__dirname,_0xdd4a('0x16'),_0x534e91[_0xdd4a('0x1a')]+'.js'))){var _0x4e67a5=[];switch(_0x534e91[_0xdd4a('0x1a')][_0xdd4a('0x1b')]()){case'autoreply':var _0x51112d=_0x534e91[_0xdd4a('0x1c')]['split'](',');if(_0x1614b3[_0xdd4a('0x11')]===_0xdd4a('0x1d')){_0x4e67a5[_0xdd4a('0x1e')](_0x51112d[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x51112d[0x1]);_0x4e67a5[_0xdd4a('0x1e')](_0x51112d[_0xdd4a('0x1f')](0x2,_0x51112d[_0xdd4a('0x17')])[_0xdd4a('0x19')](','));}else{_0x4e67a5['push'](_0x51112d[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x51112d[_0xdd4a('0x1f')](0x1,_0x51112d[_0xdd4a('0x17')])[_0xdd4a('0x19')](','));}break;case'dialogflow':var _0x40c8cf=_0x534e91['appdata']['split'](',');_0x4e67a5['push'](_0x40c8cf[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x40c8cf[0x1]);_0x4e67a5[_0xdd4a('0x1e')](_0x40c8cf[_0xdd4a('0x1f')](0x2,_0x40c8cf[_0xdd4a('0x17')])[_0xdd4a('0x19')](','));break;case _0xdd4a('0x20'):var _0x1fb4d1=_0x534e91[_0xdd4a('0x1c')]['split'](',');_0x4e67a5[_0xdd4a('0x1e')](_0x1fb4d1[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x1fb4d1[0x1]);_0x4e67a5[_0xdd4a('0x1e')](_0x1fb4d1[0x2]);_0x4e67a5[_0xdd4a('0x1e')](_0x1fb4d1[0x3]);_0x4e67a5['push'](_0x1fb4d1[_0xdd4a('0x1f')](0x4,_0x1fb4d1[_0xdd4a('0x17')])[_0xdd4a('0x19')](','));break;case _0xdd4a('0x21'):var _0x397570=_0x534e91['appdata'][_0xdd4a('0x22')](',');_0x4e67a5[_0xdd4a('0x1e')](_0x397570[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x397570[0x1]);_0x4e67a5[_0xdd4a('0x1e')](_0x397570[0x2]);_0x4e67a5['push'](_0x397570[0x3]);_0x4e67a5['push'](_0x397570['slice'](0x4,_0x397570[_0xdd4a('0x17')])[_0xdd4a('0x19')](','));break;case'message':_0x4e67a5['push'](_0x534e91[_0xdd4a('0x1c')]);break;case _0xdd4a('0x23'):_0x4e67a5[_0xdd4a('0x1e')](_0x534e91['TagId']);_0x4e67a5['push'](_0x534e91[_0xdd4a('0x1c')]);break;case'tvox':var _0x436b44=utils[_0xdd4a('0x24')](_0x1614b3['account'][_0xdd4a('0x25')],_0x1614b3);var _0x5e6668=_0x534e91['appdata']['split'](',');_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x0]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x1]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x2]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x3]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x4]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x5]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x6]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x7]);_0x4e67a5['push'](_0x5e6668[0x8]);_0x4e67a5[_0xdd4a('0x1e')](_0x5e6668[0x9]);_0x4e67a5['push'](_0x5e6668[0xa]);_0x4e67a5['push'](_0x1614b3[_0xdd4a('0x13')]['id']);_0x4e67a5[_0xdd4a('0x1e')](_0x1614b3[_0xdd4a('0x12')]['id']);_0x4e67a5[_0xdd4a('0x1e')](_0x534e91['ChatWebsiteId']);_0x4e67a5[_0xdd4a('0x1e')](_0x1614b3[_0xdd4a('0x13')]['ContactId']);_0x4e67a5[_0xdd4a('0x1e')](_0x1614b3[_0xdd4a('0x26')]['body']);_0x4e67a5[_0xdd4a('0x1e')](_0x436b44);break;default:_0x4e67a5=_['isNil'](_0x534e91[_0xdd4a('0x1c')])?[]:_0x534e91['appdata']['split'](',');}var _0x45fd5a={'id':util[_0xdd4a('0x9')](_0xdd4a('0x27'),_0x31551d,_0x534e91['id'],_0x534e91[_0xdd4a('0x1a')]),'condition':require(_0xdd4a('0x28'))[_0xdd4a('0x29')](_0x31551d,getIntervals(_0x3d3656[_0xdd4a('0x2a')],_0x534e91),_0x3d3656),'consequence':require(_0xdd4a('0x2b')+_0x534e91[_0xdd4a('0x1a')])[_0xdd4a('0x2c')](_0x31551d,_0x4e67a5,_0x3d3656,_0x1614b3),'p':_0x534e91[_0xdd4a('0x2d')]||0x0};logger[_0xdd4a('0x2e')](_0xdd4a('0x2f'),_0x45fd5a['id'],_0xdd4a('0x30'),getIntervals(_0x3d3656[_0xdd4a('0x2a')],_0x534e91)[_0xdd4a('0x19')]('\x20|\x20'));_0x5d72a1['push'](_0x45fd5a);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xdd4a('0x19')](__dirname,_0xdd4a('0x16'),_0x534e91[_0xdd4a('0x1a')]+'.js'));}}_0x3d3656[_0xdd4a('0x10')][_0x31551d]=new RuleEngine(_0x5d72a1);_0x3d3656[_0xdd4a('0x10')][_0x31551d]['execute'](_0x1614b3,function(_0x5246a3){logger[_0xdd4a('0x2e')]('Applications\x20executed',JSON['stringify'](_0x5246a3[_0xdd4a('0x31')]));if(_0x3d3656['rules'][_0x31551d]){_0x3d3656[_0xdd4a('0x10')][_0x31551d]['emit'](_0xdd4a('0x32'));}});return _0x229a65({'code':0xc8,'message':_0x1614b3});}else{if(_0xdf7dd6){logger['info'](util[_0xdd4a('0x9')](_0xdd4a('0x33'),_0x31551d));}else{logger[_0xdd4a('0x2e')]('No\x20applications\x20to\x20execute');}return _0x229a65({'code':0xc8,'message':_0x1614b3});}}catch(_0x229275){logger[_0xdd4a('0x34')](_0x229275['stack']);return _0xe59be3(_0x1859f4[_0xdd4a('0x34')](0x1f4,_0x229275));}}return _0xe59be3('routing\x20is\x20empty');});},'AcceptMessage':function(_0x1e763b){var _0x47487f=this;return new Promise(function(_0x53726a,_0x177163){if(_0x1e763b[_0xdd4a('0x35')]&&_0x1e763b[_0xdd4a('0x35')]['id']){if(_0x3d3656[_0xdd4a('0x36')][_0x1e763b[_0xdd4a('0x35')]['id']]){_0x3d3656[_0xdd4a('0x36')][_0x1e763b['agent']['id']]['busy']=![];_0x3d3656[_0xdd4a('0x36')][_0x1e763b[_0xdd4a('0x35')]['id']][_0xdd4a('0x37')]=undefined;}}if(_0x1e763b[_0xdd4a('0x12')]&&_0x1e763b['message']['id']){try{var _0x4a1d18=getId(_0x1e763b[_0xdd4a('0x11')],_0x1e763b[_0xdd4a('0x12')]?_0x1e763b[_0xdd4a('0x12')]['id']:0x0,_0x1e763b['interaction']?_0x1e763b[_0xdd4a('0x13')]['id']:0x0);if(_0x3d3656[_0xdd4a('0x10')][_0x4a1d18]){_0x3d3656[_0xdd4a('0x10')][_0x4a1d18][_0xdd4a('0x38')](_0xdd4a('0x39'));if(rpc[_0x1e763b[_0xdd4a('0x11')]+_0xdd4a('0x3a')]){rpc[_0x1e763b['channel']+'QueueReport'][_0xdd4a('0x3b')](_0x4a1d18,{'UserId':_0x1e763b['message'][_0xdd4a('0x3c')]})[_0xdd4a('0x3d')](function(){logger[_0xdd4a('0x34')](_0xdd4a('0x3e'));});}}return _0x53726a({'code':0xc8,'message':_0x1e763b});}catch(_0x5cfabc){logger['error'](_0x5cfabc[_0xdd4a('0x3f')]);return _0x177163(_0x47487f[_0xdd4a('0x34')](0x1f4,_0x5cfabc));}}logger[_0xdd4a('0x34')]('message\x20is\x20empty');return _0x177163(_0x47487f['error'](0x1f4,_0xdd4a('0x40')));});},'RejectMessage':function(_0x3109d3){var _0x2c8a2b=this;return new Promise(function(_0xacc22,_0x1ee63a){if(_0x3109d3['agent']&&_0x3109d3[_0xdd4a('0x35')]['id']){try{if(_0x3d3656[_0xdd4a('0x36')][_0x3109d3[_0xdd4a('0x35')]['id']]){_0x3d3656[_0xdd4a('0x36')][_0x3109d3[_0xdd4a('0x35')]['id']][_0xdd4a('0x41')]=![];_0x3d3656[_0xdd4a('0x36')][_0x3109d3[_0xdd4a('0x35')]['id']][_0xdd4a('0x37')]=undefined;}return _0xacc22({'code':0xc8,'message':_0x3109d3});}catch(_0x7c22ce){logger[_0xdd4a('0x34')](_0x7c22ce[_0xdd4a('0x3f')]);return _0x1ee63a(_0x2c8a2b[_0xdd4a('0x34')](0x1f4,_0x7c22ce));}}logger[_0xdd4a('0x34')](_0xdd4a('0x40'));return _0x1ee63a(_0x2c8a2b[_0xdd4a('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5151a8){var _0x52e3f3=this;return new Promise(function(_0x691c39,_0x17bc36){if(_0x5151a8[_0xdd4a('0x11')]&&_0x5151a8[_0xdd4a('0x13')]&&_0x5151a8[_0xdd4a('0x13')]['id']){try{var _0x3088cd=getId(_0x5151a8['channel'],_0x5151a8[_0xdd4a('0x12')]?_0x5151a8[_0xdd4a('0x12')]['id']:0x0,_0x5151a8['interaction']?_0x5151a8[_0xdd4a('0x13')]['id']:0x0);if(_0x3d3656['rules'][_0x3088cd]){_0x3d3656['rules'][_0x3088cd][_0xdd4a('0x38')](_0xdd4a('0x39'));}return _0x691c39({'code':0xc8,'message':_0x5151a8});}catch(_0x4a9964){logger[_0xdd4a('0x34')](_0x4a9964['stack']);return _0x17bc36(_0x52e3f3[_0xdd4a('0x34')](0x1f4,_0x4a9964));}}logger['error'](_0xdd4a('0x40'));return _0x17bc36(_0x52e3f3[_0xdd4a('0x34')](0x1f4,_0xdd4a('0x40')));});},'AgentCapacity':function(_0x4f6751){var _0x458c56=this;return new Promise(function(_0x32b279,_0x2c0c0c){if(_0x3d3656[_0xdd4a('0x36')][_0xdd4a('0x42')](_0x4f6751['id'])){for(var _0xe5dd97 in _0x4f6751[_0xdd4a('0x43')]){if(_0x4f6751['capacity']['hasOwnProperty'](_0xe5dd97)){if(_0x3d3656['agents'][_0x4f6751['id']]['hasOwnProperty'](_0xe5dd97+_0xdd4a('0x44'))){_0x3d3656['agents'][_0x4f6751['id']][_0xe5dd97+_0xdd4a('0x44')]=parseInt(_0x4f6751[_0xdd4a('0x43')][_0xe5dd97],0xa);}}}_0x3d3656[_0xdd4a('0x36')][_0x4f6751['id']]['updateRealtime']();return _0x32b279({'code':0xc8,'message':_0x3d3656['agents'][_0x4f6751['id']]});}else{return _0x2c0c0c(_0x458c56[_0xdd4a('0x34')](0x1f4,_0xdd4a('0x45')));}});},'Agents':function(_0x7f4da0){return new Promise(function(_0x49e3ca){var _0x2ebf37=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x36')]);if(_0x7f4da0&&_0x7f4da0['id']){var _0xed687a=_[_0xdd4a('0x47')](_0x2ebf37,function(_0x1168ad){return _0x1168ad['id']===_0x7f4da0['id'];});_0x49e3ca(_0xed687a);}else{_0x49e3ca({'count':_0x2ebf37[_0xdd4a('0x17')],'rows':_0x2ebf37});}});},'ChatQueues':function(){return new Promise(function(_0x3d2289){var _0x19ecc3=[];for(var _0x34d329 in _0x3d3656['chatQueues']){if(_0x3d3656['chatQueues'][_0xdd4a('0x42')](_0x34d329)){var _0x2858ed=_0x3d3656['chatQueues'][_0x34d329];var _0x131956={'id':_0x2858ed['id'],'available':_0x2858ed[_0xdd4a('0x48')],'loggedIn':_0x2858ed['loggedIn'],'name':_0x2858ed['name'],'paused':_0x2858ed['paused'],'waiting':_0x2858ed[_0xdd4a('0x49')]};_0x19ecc3[_0xdd4a('0x1e')](_0x131956);}}_0x3d2289({'count':_0x19ecc3[_0xdd4a('0x17')],'rows':_0x19ecc3});});},'MailQueues':function(){return new Promise(function(_0x3489ac){var _0x521004=[];for(var _0x16dfde in _0x3d3656[_0xdd4a('0x4a')]){if(_0x3d3656['mailQueues'][_0xdd4a('0x42')](_0x16dfde)){var _0x27e25c=_0x3d3656[_0xdd4a('0x4a')][_0x16dfde];var _0x320995={'id':_0x27e25c['id'],'available':_0x27e25c[_0xdd4a('0x48')],'loggedIn':_0x27e25c[_0xdd4a('0x4b')],'name':_0x27e25c[_0xdd4a('0x4c')],'paused':_0x27e25c[_0xdd4a('0x4d')],'waiting':_0x27e25c[_0xdd4a('0x49')]};_0x521004[_0xdd4a('0x1e')](_0x320995);}}_0x3489ac({'count':_0x521004[_0xdd4a('0x17')],'rows':_0x521004});});},'OpenchannelQueues':function(){return new Promise(function(_0x4245b1){var _0x39d277=[];for(var _0x56d00b in _0x3d3656[_0xdd4a('0x4e')]){if(_0x3d3656[_0xdd4a('0x4e')][_0xdd4a('0x42')](_0x56d00b)){var _0x38073b=_0x3d3656[_0xdd4a('0x4e')][_0x56d00b];var _0x5acae9={'id':_0x38073b['id'],'available':_0x38073b[_0xdd4a('0x48')],'loggedIn':_0x38073b[_0xdd4a('0x4b')],'name':_0x38073b[_0xdd4a('0x4c')],'paused':_0x38073b[_0xdd4a('0x4d')],'waiting':_0x38073b[_0xdd4a('0x49')]};_0x39d277[_0xdd4a('0x1e')](_0x5acae9);}}_0x4245b1({'count':_0x39d277[_0xdd4a('0x17')],'rows':_0x39d277});});},'SmsQueues':function(){return new Promise(function(_0x513094){var _0xa73fe5=[];for(var _0x45a584 in _0x3d3656[_0xdd4a('0x4f')]){if(_0x3d3656['smsQueues'][_0xdd4a('0x42')](_0x45a584)){var _0x269266=_0x3d3656['smsQueues'][_0x45a584];var _0x218b33={'id':_0x269266['id'],'available':_0x269266[_0xdd4a('0x48')],'loggedIn':_0x269266[_0xdd4a('0x4b')],'name':_0x269266[_0xdd4a('0x4c')],'paused':_0x269266[_0xdd4a('0x4d')],'waiting':_0x269266[_0xdd4a('0x49')]};_0xa73fe5[_0xdd4a('0x1e')](_0x218b33);}}_0x513094({'count':_0xa73fe5[_0xdd4a('0x17')],'rows':_0xa73fe5});});},'FaxQueues':function(){return new Promise(function(_0x240304){var _0x26d8f9=[];for(var _0x10c368 in _0x3d3656['faxQueues']){if(_0x3d3656[_0xdd4a('0x50')][_0xdd4a('0x42')](_0x10c368)){var _0x50bd06=_0x3d3656[_0xdd4a('0x50')][_0x10c368];var _0x6e6ece={'id':_0x50bd06['id'],'available':_0x50bd06['available'],'loggedIn':_0x50bd06[_0xdd4a('0x4b')],'name':_0x50bd06['name'],'paused':_0x50bd06['paused'],'waiting':_0x50bd06[_0xdd4a('0x49')]};_0x26d8f9['push'](_0x6e6ece);}}_0x240304({'count':_0x26d8f9['length'],'rows':_0x26d8f9});});},'WhatsappQueues':function(){return new Promise(function(_0x31eb45){var _0x187adc=[];for(var _0x46888e in _0x3d3656['whatsappQueues']){if(_0x3d3656[_0xdd4a('0x51')][_0xdd4a('0x42')](_0x46888e)){var _0x59e7c0=_0x3d3656[_0xdd4a('0x51')][_0x46888e];var _0x27ec7b={'id':_0x59e7c0['id'],'available':_0x59e7c0[_0xdd4a('0x48')],'loggedIn':_0x59e7c0[_0xdd4a('0x4b')],'name':_0x59e7c0[_0xdd4a('0x4c')],'paused':_0x59e7c0[_0xdd4a('0x4d')],'waiting':_0x59e7c0['waiting']};_0x187adc[_0xdd4a('0x1e')](_0x27ec7b);}}_0x31eb45({'count':_0x187adc[_0xdd4a('0x17')],'rows':_0x187adc});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xed8d78){var _0x4ef121=_['values'](_0x3d3656[_0xdd4a('0x52')]);_0xed8d78({'count':_0x4ef121[_0xdd4a('0x17')],'rows':_0x4ef121});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1fecd7){var _0x3afa87=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x53')]);_0x1fecd7({'count':_0x3afa87[_0xdd4a('0x17')],'rows':_0x3afa87});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x53f0ab){var _0x455b1d=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x54')]);_0x53f0ab({'count':_0x455b1d[_0xdd4a('0x17')],'rows':_0x455b1d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x39d285){var _0x5a8b06=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x55')]);_0x39d285({'count':_0x5a8b06[_0xdd4a('0x17')],'rows':_0x5a8b06});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xc25c9){var _0x40be9c=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x56')]);_0xc25c9({'count':_0x40be9c[_0xdd4a('0x17')],'rows':_0x40be9c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3567da){var _0x131553=_[_0xdd4a('0x46')](_0x3d3656[_0xdd4a('0x57')]);_0x3567da({'count':_0x131553[_0xdd4a('0x17')],'rows':_0x131553});});}};var _0x29bbc4=jayson[_0xdd4a('0x58')](_0x1098fc)[_0xdd4a('0x59')]();_0x29bbc4['on'](_0xdd4a('0x34'),function(_0x52df19){logger['error'](JSON[_0xdd4a('0x5a')](_0x52df19));return _0xcc3e69(_0x52df19);});_0x29bbc4[_0xdd4a('0xf')](0x232c,_0xdd4a('0x5b'),function(){console['log'](_0xdd4a('0x5c'),0x232c);return _0x5483cd(_0xdd4a('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 5b1af1c..9cf5d35 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 _0xcbb5=['request','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','client','http'];(function(_0x3cfe06,_0x336518){var _0x57a4dd=function(_0xd928f1){while(--_0xd928f1){_0x3cfe06['push'](_0x3cfe06['shift']());}};_0x57a4dd(++_0x336518);}(_0xcbb5,0x1e7));var _0x5cbb=function(_0x1a467c,_0x2d88dc){_0x1a467c=_0x1a467c-0x0;var _0x6cba0=_0xcbb5[_0x1a467c];return _0x6cba0;};'use strict';var util=require(_0x5cbb('0x0'));var BPromise=require(_0x5cbb('0x1'));var jayson=require(_0x5cbb('0x2'));var _=require(_0x5cbb('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x5cbb('0x4')][_0x5cbb('0x5')]({'port':0x232a});function request(_0x5008c4,_0x2ab74){return new BPromise(function(_0x26a2e9,_0x105c45){return client[_0x5cbb('0x6')](_0x5008c4,_0x2ab74)['then'](function(_0x53e688){if(_0x53e688[_0x5cbb('0x7')]){return _0x105c45(_0x53e688[_0x5cbb('0x7')][_0x5cbb('0x8')]);}else{return _0x26a2e9(_0x53e688[_0x5cbb('0x9')]);}})[_0x5cbb('0xa')](function(_0x45b1b9){return _0x105c45(_0x45b1b9);});});}exports[_0x5cbb('0xb')]=function(_0x2be9e5,_0x1af5d9,_0x5bcd91){return function(_0x3cacd7){if(_0x5bcd91[_0x5cbb('0xc')]&&!_0x5bcd91['rules'][_0x2be9e5]){logger['info'](_0x5cbb('0xd'),_0x2be9e5);return _0x3cacd7[_0x5cbb('0xe')]();}var _0x1cea66=[];for(var _0x5134dc=0x0;_0x5134dc<_0x1af5d9[_0x5cbb('0xf')];_0x5134dc+=0x1){_0x1cea66['push'](request(_0x5cbb('0x10'),{'command':util[_0x5cbb('0x11')](_0x5cbb('0x12'),_0x1af5d9[_0x5134dc])})[_0x5cbb('0x13')](function(_0x48ffb3){return _0x48ffb3&&_0x48ffb3[_0x5cbb('0x8')]&&_0x48ffb3[_0x5cbb('0x8')][_0x5cbb('0x14')](_0x5cbb('0x15'))>=0x0?!![]:![];})[_0x5cbb('0xa')](function(){logger[_0x5cbb('0x7')](_0x5cbb('0x16'),_0x2be9e5,_0x1af5d9[_0x5134dc]);}));}BPromise[_0x5cbb('0x17')](_0x1cea66)[_0x5cbb('0x13')](function(_0xc09f3c){var _0x47f158=_[_0x5cbb('0x18')](_0xc09f3c);logger['info'](_0x5cbb('0x19'),_0x2be9e5,_0x1af5d9[_0x5cbb('0x1a')](_0x5cbb('0x1b')),_0x47f158);_0x3cacd7['when'](_0x47f158);})[_0x5cbb('0xa')](function(_0x3cb0fc){logger[_0x5cbb('0x7')](_0x5cbb('0x19'),_0x2be9e5,_0x1af5d9[_0x5cbb('0x1a')](_0x5cbb('0x1b')),_0x3cb0fc[_0x5cbb('0x1c')]);_0x3cacd7[_0x5cbb('0xe')]();});};}; \ No newline at end of file +var _0x4489=['http','request','then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','util','jayson/promise','lodash','routing','client'];(function(_0x430c8e,_0x974ac1){var _0x1164c5=function(_0x24da1b){while(--_0x24da1b){_0x430c8e['push'](_0x430c8e['shift']());}};_0x1164c5(++_0x974ac1);}(_0x4489,0x91));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9448('0x0'));var BPromise=require('bluebird');var jayson=require(_0x9448('0x1'));var _=require(_0x9448('0x2'));var logger=require('../../../config/logger')(_0x9448('0x3'));var client=jayson[_0x9448('0x4')][_0x9448('0x5')]({'port':0x232a});function request(_0x233da8,_0x3c7540){return new BPromise(function(_0x1e6cb7,_0x24c082){return client[_0x9448('0x6')](_0x233da8,_0x3c7540)[_0x9448('0x7')](function(_0x12532f){if(_0x12532f['error']){return _0x24c082(_0x12532f[_0x9448('0x8')]['message']);}else{return _0x1e6cb7(_0x12532f[_0x9448('0x9')]);}})[_0x9448('0xa')](function(_0xe8b35b){return _0x24c082(_0xe8b35b);});});}exports['condition']=function(_0x568c64,_0x3bb9e2,_0x43e226){return function(_0x43b133){if(_0x43e226[_0x9448('0xb')]&&!_0x43e226[_0x9448('0xb')][_0x568c64]){logger[_0x9448('0xc')](_0x9448('0xd'),_0x568c64);return _0x43b133['stop']();}var _0x255380=[];for(var _0x5e8547=0x0;_0x5e8547<_0x3bb9e2[_0x9448('0xe')];_0x5e8547+=0x1){_0x255380[_0x9448('0xf')](request(_0x9448('0x10'),{'command':util['format'](_0x9448('0x11'),_0x3bb9e2[_0x5e8547])})[_0x9448('0x7')](function(_0x39c342){return _0x39c342&&_0x39c342[_0x9448('0x12')]&&_0x39c342['message'][_0x9448('0x13')](_0x9448('0x14'))>=0x0?!![]:![];})[_0x9448('0xa')](function(){logger[_0x9448('0x8')](_0x9448('0x15'),_0x568c64,_0x3bb9e2[_0x5e8547]);}));}BPromise[_0x9448('0x16')](_0x255380)['then'](function(_0xf53aa0){var _0x4458b6=_[_0x9448('0x17')](_0xf53aa0);logger[_0x9448('0xc')](_0x9448('0x18'),_0x568c64,_0x3bb9e2[_0x9448('0x19')](_0x9448('0x1a')),_0x4458b6);_0x43b133[_0x9448('0x1b')](_0x4458b6);})[_0x9448('0xa')](function(_0x139017){logger[_0x9448('0x8')](_0x9448('0x18'),_0x568c64,_0x3bb9e2['join'](_0x9448('0x1a')),_0x139017[_0x9448('0x1c')]);_0x43b133[_0x9448('0x1d')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 67364f5..d741a17 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 _0x2750=['calleridnum','connectedlinenum','lastevent','then','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','forIn','talktime','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','[%s][agents][hangup]','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0x581382,_0x485ffa){var _0x4184e8=function(_0x584d7c){while(--_0x584d7c){_0x581382['push'](_0x581382['shift']());}};_0x4184e8(++_0x485ffa);}(_0x2750,0x13b));var _0x0275=function(_0x371b0f,_0x52be35){_0x371b0f=_0x371b0f-0x0;var _0x13a99d=_0x2750[_0x371b0f];return _0x13a99d;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var utils=require(_0x0275('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xf2ae71,_0x372744){utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x4'),_0xf2ae71[_0x0275('0x5')],_0xf2ae71[_0x0275('0x6')],_0xf2ae71[_0x0275('0x7')],_0xf2ae71[_0x0275('0x8')],_0xf2ae71['interface'],_0xf2ae71[_0x0275('0x9')],_0xf2ae71[_0x0275('0xa')],_0xf2ae71[_0x0275('0xb')]));if(_0xf2ae71[_0x0275('0x7')]){utils['getVoiceQueueByName'](_0xf2ae71[_0x0275('0x7')])[_0x0275('0xc')](function(_0x42ae73){if(_0x42ae73){_0xf2ae71['type']=_0x42ae73['type'];_0xf2ae71[_0x0275('0xd')]=_0xf2ae71['agentcomplete']?_0x42ae73[_0x0275('0xe')]:![];_0xf2ae71[_0x0275('0xf')]=_0xf2ae71[_0x0275('0xd')]?_0x42ae73[_0x0275('0x10')]:0x0;}utils[_0x0275('0x11')]('CreateVoiceAgentReport',_0xf2ae71);});}else{utils[_0x0275('0x11')](_0x0275('0x12'),_0xf2ae71);}if(_0x372744){delete transfers[_0xf2ae71[_0x0275('0x5')]];}else{delete agents[_0xf2ae71['destuniqueid']];}}exports['agentcalled']=function(_0x292f93){try{utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x14'),_0x292f93[_0x0275('0x5')]),_0x292f93);agents[_0x292f93[_0x0275('0x15')]]=_0x292f93;agents[_0x292f93['destuniqueid']][_0x0275('0x16')]=utils[_0x0275('0x17')]();agents[_0x292f93['destuniqueid']][_0x0275('0xb')]=_0x0275('0x18');agents[_0x292f93['destuniqueid']][_0x0275('0xa')]=null;agents[_0x292f93[_0x0275('0x15')]]['connectedlinename']=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x292f93['uniqueid'],agents[_0x292f93[_0x0275('0x15')]][_0x0275('0x8')],_0x292f93[_0x0275('0x15')]));}catch(_0x5b2a4c){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x14'),_0x292f93['uniqueid']),_0x5b2a4c);}};exports[_0x0275('0x1a')]=function(_0x402f0d){try{if(!_['isNil'](agents[_0x402f0d['destuniqueid']])){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x1b'),_0x402f0d['uniqueid']),_0x402f0d);utils[_0x0275('0x2')](util['format'](_0x0275('0x1c'),_0x402f0d['uniqueid'],agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x8')],_0x402f0d['destuniqueid']));agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1a')]=!![];agents[_0x402f0d[_0x0275('0x15')]]['agentringnoanswerAt']=utils[_0x0275('0x17')]();agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0xb')]=_0x0275('0x1d');agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1e')]='timeout';agents[_0x402f0d[_0x0275('0x15')]][_0x0275('0x1f')]=_0x402f0d[_0x0275('0x20')]?parseInt(_0x402f0d[_0x0275('0x20')])/0x3e8:0x0;agents[_0x402f0d[_0x0275('0x15')]]['talktime']=0x0;unanswered[_0x0275('0x21')](_0x402f0d[_0x0275('0x15')]);}}catch(_0x3246ea){utils[_0x0275('0x19')](util[_0x0275('0x3')]('[%s][agents][agentringnoanswer]',_0x402f0d[_0x0275('0x5')]),_0x3246ea);}};exports[_0x0275('0x22')]=function(_0x127bbd){try{_['forIn'](agents,function(_0x5e2e22,_0x3cb2d7){if(_0x5e2e22[_0x0275('0x5')]==_0x127bbd['uniqueid']&&!_[_0x0275('0x23')](unanswered,_0x5e2e22[_0x0275('0x15')])){utils[_0x0275('0x13')](util[_0x0275('0x3')]('[%s][agents][queuecallerabandon]',_0x127bbd[_0x0275('0x5')]),_0x127bbd);utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x24'),_0x127bbd['uniqueid'],_0x5e2e22[_0x0275('0x8')],_0x5e2e22['destuniqueid']));_0x5e2e22[_0x0275('0x1a')]=!![];_0x5e2e22['agentringnoanswerAt']=utils[_0x0275('0x17')]();_0x5e2e22[_0x0275('0xb')]='abandoned';_0x5e2e22[_0x0275('0x1e')]=_0x0275('0x25');_0x5e2e22[_0x0275('0x1f')]=_0x127bbd[_0x0275('0x1f')];_0x5e2e22['talktime']=0x0;writeDB(_0x5e2e22);}});}catch(_0x5040de){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x26'),_0x127bbd[_0x0275('0x5')]),_0x5040de);}};exports['agentconnect']=function(_0x2a18c3){try{if(agents[_0x2a18c3[_0x0275('0x15')]]){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x27'),_0x2a18c3[_0x0275('0x5')]),_0x2a18c3);utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x28'),_0x2a18c3[_0x0275('0x5')],agents[_0x2a18c3[_0x0275('0x15')]]['membername'],_0x2a18c3[_0x0275('0x15')]));agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x29')]=utils[_0x0275('0x17')]();agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0xa')]=_0x2a18c3[_0x0275('0xa')];agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x2a')]=_0x2a18c3[_0x0275('0x2a')];agents[_0x2a18c3[_0x0275('0x15')]][_0x0275('0x1f')]=_0x2a18c3[_0x0275('0x20')];agents[_0x2a18c3[_0x0275('0x15')]]['lastevent']=_0x0275('0x2b');_[_0x0275('0x2c')](agents,function(_0x4d2d59,_0x31d0ab){if(_0x4d2d59[_0x0275('0x15')]!=_0x2a18c3[_0x0275('0x15')]&&_0x4d2d59[_0x0275('0x5')]==_0x2a18c3[_0x0275('0x5')]){_0x4d2d59[_0x0275('0x2d')]=0x0;_0x4d2d59[_0x0275('0x1f')]=_0x2a18c3['ringtime'];_0x4d2d59[_0x0275('0x1a')]=!![];_0x4d2d59[_0x0275('0x2e')]=utils[_0x0275('0x17')]();_0x4d2d59[_0x0275('0xb')]='answered_elsewhere';_0x4d2d59[_0x0275('0x1e')]=_0x0275('0x2f');_0x4d2d59[_0x0275('0x30')]=_0x2a18c3[_0x0275('0x15')];_0x4d2d59['answeredelsewheremembername']=_0x2a18c3[_0x0275('0x8')];writeDB(_0x4d2d59);}});}}catch(_0x52f69c){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x27'),_0x2a18c3[_0x0275('0x5')]),_0x52f69c);}};exports['agentcomplete']=function(_0x13c651){try{if(!_[_0x0275('0x31')](agents[_0x13c651['destuniqueid']])){utils[_0x0275('0x13')](util[_0x0275('0x3')](_0x0275('0x32'),_0x13c651['uniqueid']),_0x13c651);utils[_0x0275('0x2')](util[_0x0275('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x13c651[_0x0275('0x5')],agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x8')],_0x13c651[_0x0275('0x15')]));agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x33')]=!![];agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x2d')]=utils['diffTime'](agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x34')],agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x29')]);agents[_0x13c651[_0x0275('0x15')]][_0x0275('0x1e')]=_0x13c651[_0x0275('0x1e')];agents[_0x13c651[_0x0275('0x15')]][_0x0275('0xb')]=_0x0275('0x35');writeDB(agents[_0x13c651[_0x0275('0x15')]]);}}catch(_0x598d15){utils['error'](util[_0x0275('0x3')](_0x0275('0x32'),_0x13c651[_0x0275('0x5')]),_0x598d15);}};exports[_0x0275('0x36')]=function(_0x310c6b){try{if(!_['isNil'](agents[_0x310c6b[_0x0275('0x37')]])){utils['debug'](util[_0x0275('0x3')](_0x0275('0x38'),_0x310c6b[_0x0275('0x5')]),_0x310c6b);utils[_0x0275('0x2')](util['format'](_0x0275('0x39'),_0x310c6b['uniqueid'],agents[_0x310c6b['transfereruniqueid']]['membername'],agents[_0x310c6b[_0x0275('0x37')]]['uniqueid']));agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3a')]=!![];agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3b')]=_0x0275('0x3c');agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x3d')]=_0x310c6b['extension'];agents[_0x310c6b[_0x0275('0x37')]]['transferuniqueid']=agents[_0x310c6b[_0x0275('0x37')]][_0x0275('0x5')];}}catch(_0x119301){utils[_0x0275('0x19')](util[_0x0275('0x3')](_0x0275('0x38'),_0x310c6b[_0x0275('0x5')]),_0x119301);}};exports[_0x0275('0x3e')]=function(_0x41429d){try{utils[_0x0275('0x13')](util['format']('[%s][agents][attendedtransfer]',_0x41429d[_0x0275('0x3f')]),_0x41429d);if(_0x41429d['origtransfereruniqueid']==_0x41429d['origtransfererlinkedid']){if(!_[_0x0275('0x31')](agents[_0x41429d[_0x0275('0x40')]])){utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x41'),_0x41429d[_0x0275('0x3f')],agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x8')]));agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x3a')]=!![];agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x3b')]=_0x0275('0x42');agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x3d')]=_0x41429d[_0x0275('0x43')];agents[_0x41429d['secondtransfereruniqueid']][_0x0275('0x44')]=_0x41429d['origtransfereruniqueid'];}if(_0x41429d[_0x0275('0x45')]&&agents[_0x41429d[_0x0275('0x45')]]){agents[_0x41429d[_0x0275('0x45')]][_0x0275('0x46')]=0x1;transfers[_0x41429d[_0x0275('0x45')]]=_[_0x0275('0x47')](agents[_0x41429d[_0x0275('0x45')]]);transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x9')]=agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x9')];transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x48')]=agents[_0x41429d[_0x0275('0x40')]][_0x0275('0x48')];transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x16')]=utils[_0x0275('0x17')]();transfers[_0x41429d['transfereeuniqueid']][_0x0275('0x29')]=utils['now']();transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x1f')]=0x0;transfers[_0x41429d[_0x0275('0x45')]][_0x0275('0x46')]=0x2;}}else if(_0x41429d['secondtransfereruniqueid']==_0x41429d[_0x0275('0x49')]){if(!_[_0x0275('0x31')](agents[_0x41429d[_0x0275('0x3f')]])){utils[_0x0275('0x2')](util['format'](_0x0275('0x41'),_0x41429d[_0x0275('0x3f')],agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x8')]));agents[_0x41429d[_0x0275('0x3f')]]['transfer']=!![];agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x3b')]=_0x0275('0x42');agents[_0x41429d['origtransfereruniqueid']]['transferexten']=_0x41429d[_0x0275('0x4a')];agents[_0x41429d[_0x0275('0x3f')]][_0x0275('0x44')]=_0x41429d[_0x0275('0x40')];}if(_0x41429d[_0x0275('0x4b')]&&agents[_0x41429d[_0x0275('0x4b')]]){agents[_0x41429d[_0x0275('0x4b')]][_0x0275('0x46')]=0x1;transfers[_0x41429d['transfertargetuniqueid']]=_[_0x0275('0x47')](agents[_0x41429d[_0x0275('0x4b')]]);transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x9')]=agents[_0x41429d[_0x0275('0x3f')]][_0x0275('0x9')];transfers[_0x41429d['transfertargetuniqueid']][_0x0275('0x48')]=agents[_0x41429d['origtransfereruniqueid']][_0x0275('0x48')];transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x16')]=utils[_0x0275('0x17')]();transfers[_0x41429d['transfertargetuniqueid']][_0x0275('0x29')]=utils[_0x0275('0x17')]();transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x1f')]=0x0;transfers[_0x41429d[_0x0275('0x4b')]][_0x0275('0x46')]=0x2;}}}catch(_0x3c7845){utils[_0x0275('0x19')](util[_0x0275('0x3')]('[%s][agents][attendedtransfer]',_0x41429d['origtransfereruniqueid']),_0x3c7845);}};exports['hangup']=function(_0x1dcaa6){try{utils[_0x0275('0x13')](util[_0x0275('0x3')]('[%s][agents][hangup]',_0x1dcaa6[_0x0275('0x5')]),_0x1dcaa6);if(agents[_0x1dcaa6[_0x0275('0x5')]]&&agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]===_0x0275('0x1d')){if(_0x1dcaa6['cause']==='21'){agents[_0x1dcaa6[_0x0275('0x5')]]['reason']=_0x0275('0x4c');agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]=_0x0275('0x4c');}utils['info'](util[_0x0275('0x3')](_0x0275('0x4d'),_0x1dcaa6[_0x0275('0x5')],agents[_0x1dcaa6['uniqueid']][_0x0275('0x8')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(agents[_0x1dcaa6[_0x0275('0x5')]]);var _0x3a9898=unanswered[_0x0275('0x4e')](_0x1dcaa6['uniqueid']);if(_0x3a9898>-0x1){unanswered['splice'](_0x3a9898,0x1);}}if(transfers[_0x1dcaa6['uniqueid']]){transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x33')]=!![];transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();transfers[_0x1dcaa6['uniqueid']][_0x0275('0x2d')]=utils['diffTime'](transfers[_0x1dcaa6['uniqueid']][_0x0275('0x34')],transfers[_0x1dcaa6['uniqueid']][_0x0275('0x29')]);transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]=_0x0275('0x4f');transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]=_0x0275('0x35');utils[_0x0275('0x2')](util[_0x0275('0x3')](_0x0275('0x4d'),_0x1dcaa6[_0x0275('0x5')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x8')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],transfers[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(transfers[_0x1dcaa6[_0x0275('0x5')]],!![]);}if(agents[_0x1dcaa6[_0x0275('0x5')]]&&agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x29')]){agents[_0x1dcaa6['uniqueid']][_0x0275('0x33')]=!![];agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')]=utils[_0x0275('0x17')]();agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x2d')]=utils['diffTime'](agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x34')],agents[_0x1dcaa6['uniqueid']][_0x0275('0x29')]);agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')]=agents[_0x1dcaa6[_0x0275('0x5')]]['transfer']?_0x0275('0x3a'):_0x0275('0x4f');agents[_0x1dcaa6['uniqueid']][_0x0275('0xb')]='complete';utils[_0x0275('0x2')](util[_0x0275('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1dcaa6[_0x0275('0x5')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x8')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0x1e')],agents[_0x1dcaa6[_0x0275('0x5')]][_0x0275('0xb')]));writeDB(agents[_0x1dcaa6['uniqueid']]);}}catch(_0x12476c){utils[_0x0275('0x19')](util['format'](_0x0275('0x50'),_0x1dcaa6['uniqueid']),_0x12476c);}}; \ No newline at end of file +var _0x4522=['agent','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','called','info','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','transfer','transfertype','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transferexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agentcompleteAt'];(function(_0x11231c,_0x19b337){var _0x487689=function(_0x35c246){while(--_0x35c246){_0x11231c['push'](_0x11231c['shift']());}};_0x487689(++_0x19b337);}(_0x4522,0x1a0));var _0x2452=function(_0x2f8e23,_0xc115bb){_0x2f8e23=_0x2f8e23-0x0;var _0x179ec2=_0x4522[_0x2f8e23];return _0x179ec2;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x2452('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa5f6b7,_0x4a08d4){utils['info'](util[_0x2452('0x1')](_0x2452('0x2'),_0xa5f6b7[_0x2452('0x3')],_0xa5f6b7[_0x2452('0x4')],_0xa5f6b7[_0x2452('0x5')],_0xa5f6b7[_0x2452('0x6')],_0xa5f6b7[_0x2452('0x7')],_0xa5f6b7[_0x2452('0x8')],_0xa5f6b7[_0x2452('0x9')],_0xa5f6b7[_0x2452('0xa')]));if(_0xa5f6b7[_0x2452('0x5')]){utils[_0x2452('0xb')](_0xa5f6b7[_0x2452('0x5')])[_0x2452('0xc')](function(_0x2e5caa){if(_0x2e5caa){_0xa5f6b7[_0x2452('0xd')]=_0x2e5caa['type'];_0xa5f6b7['agentacw']=_0xa5f6b7[_0x2452('0xe')]?_0x2e5caa['acw']:![];_0xa5f6b7['acwtime']=_0xa5f6b7[_0x2452('0xf')]?_0x2e5caa[_0x2452('0x10')]:0x0;}utils[_0x2452('0x11')](_0x2452('0x12'),_0xa5f6b7);});}else{utils[_0x2452('0x11')](_0x2452('0x12'),_0xa5f6b7);}if(_0x4a08d4){delete transfers[_0xa5f6b7[_0x2452('0x3')]];}else{delete agents[_0xa5f6b7[_0x2452('0x13')]];}}exports['agentcalled']=function(_0x529fb2){try{utils['debug'](util[_0x2452('0x1')]('[%s][agents][agentcalled]',_0x529fb2[_0x2452('0x3')]),_0x529fb2);agents[_0x529fb2['destuniqueid']]=_0x529fb2;agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x14')]=utils['now']();agents[_0x529fb2[_0x2452('0x13')]]['lastevent']=_0x2452('0x15');agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x9')]=null;agents[_0x529fb2[_0x2452('0x13')]]['connectedlinename']=null;utils[_0x2452('0x16')](util[_0x2452('0x1')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x529fb2['uniqueid'],agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x6')],_0x529fb2[_0x2452('0x13')]));}catch(_0x57cb03){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x18'),_0x529fb2[_0x2452('0x3')]),_0x57cb03);}};exports[_0x2452('0x19')]=function(_0x1c70cb){try{if(!_[_0x2452('0x1a')](agents[_0x1c70cb[_0x2452('0x13')]])){utils['debug'](util['format'](_0x2452('0x1b'),_0x1c70cb[_0x2452('0x3')]),_0x1c70cb);utils['info'](util[_0x2452('0x1')](_0x2452('0x1c'),_0x1c70cb[_0x2452('0x3')],agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x6')],_0x1c70cb[_0x2452('0x13')]));agents[_0x1c70cb[_0x2452('0x13')]]['agentringnoanswer']=!![];agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x1d')]=utils[_0x2452('0x1e')]();agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0xa')]='timeout';agents[_0x1c70cb['destuniqueid']][_0x2452('0x1f')]=_0x2452('0x20');agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x21')]=_0x1c70cb[_0x2452('0x22')]?parseInt(_0x1c70cb['ringtime'])/0x3e8:0x0;agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x23')]=0x0;unanswered['push'](_0x1c70cb['destuniqueid']);}}catch(_0x332878){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x1b'),_0x1c70cb[_0x2452('0x3')]),_0x332878);}};exports[_0x2452('0x24')]=function(_0x504162){try{_['forIn'](agents,function(_0x46b611,_0x454e0a){if(_0x46b611[_0x2452('0x3')]==_0x504162['uniqueid']&&!_[_0x2452('0x25')](unanswered,_0x46b611[_0x2452('0x13')])){utils['debug'](util[_0x2452('0x1')](_0x2452('0x26'),_0x504162[_0x2452('0x3')]),_0x504162);utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x27'),_0x504162[_0x2452('0x3')],_0x46b611[_0x2452('0x6')],_0x46b611[_0x2452('0x13')]));_0x46b611[_0x2452('0x19')]=!![];_0x46b611[_0x2452('0x1d')]=utils[_0x2452('0x1e')]();_0x46b611[_0x2452('0xa')]='abandoned';_0x46b611[_0x2452('0x1f')]=_0x2452('0x28');_0x46b611['holdtime']=_0x504162[_0x2452('0x21')];_0x46b611['talktime']=0x0;writeDB(_0x46b611);}});}catch(_0x2c6843){utils[_0x2452('0x17')](util['format'](_0x2452('0x26'),_0x504162[_0x2452('0x3')]),_0x2c6843);}};exports[_0x2452('0x29')]=function(_0x5ce5fb){try{if(agents[_0x5ce5fb[_0x2452('0x13')]]){utils[_0x2452('0x2a')](util['format'](_0x2452('0x2b'),_0x5ce5fb[_0x2452('0x3')]),_0x5ce5fb);utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x2c'),_0x5ce5fb['uniqueid'],agents[_0x5ce5fb['destuniqueid']]['membername'],_0x5ce5fb[_0x2452('0x13')]));agents[_0x5ce5fb[_0x2452('0x13')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();agents[_0x5ce5fb[_0x2452('0x13')]]['connectedlinenum']=_0x5ce5fb[_0x2452('0x9')];agents[_0x5ce5fb['destuniqueid']]['connectedlinename']=_0x5ce5fb[_0x2452('0x2e')];agents[_0x5ce5fb['destuniqueid']][_0x2452('0x21')]=_0x5ce5fb[_0x2452('0x22')];agents[_0x5ce5fb['destuniqueid']][_0x2452('0xa')]=_0x2452('0x2f');_[_0x2452('0x30')](agents,function(_0x34d7f9,_0x2babbe){if(_0x34d7f9[_0x2452('0x13')]!=_0x5ce5fb[_0x2452('0x13')]&&_0x34d7f9[_0x2452('0x3')]==_0x5ce5fb['uniqueid']){_0x34d7f9[_0x2452('0x23')]=0x0;_0x34d7f9['holdtime']=_0x5ce5fb[_0x2452('0x22')];_0x34d7f9[_0x2452('0x19')]=!![];_0x34d7f9['agentringnoanswerAt']=utils[_0x2452('0x1e')]();_0x34d7f9[_0x2452('0xa')]=_0x2452('0x31');_0x34d7f9[_0x2452('0x1f')]=_0x2452('0x31');_0x34d7f9['answeredelsewheredestinationuniqueid']=_0x5ce5fb[_0x2452('0x13')];_0x34d7f9[_0x2452('0x32')]=_0x5ce5fb['membername'];writeDB(_0x34d7f9);}});}}catch(_0xfabbd8){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x2b'),_0x5ce5fb['uniqueid']),_0xfabbd8);}};exports[_0x2452('0xe')]=function(_0x304942){try{if(!_[_0x2452('0x1a')](agents[_0x304942[_0x2452('0x13')]])){utils[_0x2452('0x2a')](util[_0x2452('0x1')]('[%s][agents][agentcomplete]',_0x304942[_0x2452('0x3')]),_0x304942);utils['info'](util[_0x2452('0x1')](_0x2452('0x33'),_0x304942['uniqueid'],agents[_0x304942['destuniqueid']]['membername'],_0x304942['destuniqueid']));agents[_0x304942[_0x2452('0x13')]]['agentcomplete']=!![];agents[_0x304942[_0x2452('0x13')]]['agentcompleteAt']=utils[_0x2452('0x1e')]();agents[_0x304942[_0x2452('0x13')]]['talktime']=utils['diffTime'](agents[_0x304942[_0x2452('0x13')]]['agentcompleteAt'],agents[_0x304942[_0x2452('0x13')]][_0x2452('0x2d')]);agents[_0x304942[_0x2452('0x13')]][_0x2452('0x1f')]=_0x304942['reason'];agents[_0x304942['destuniqueid']][_0x2452('0xa')]=_0x2452('0x34');writeDB(agents[_0x304942[_0x2452('0x13')]]);}}catch(_0x2d06f2){utils[_0x2452('0x17')](util['format'](_0x2452('0x35'),_0x304942['uniqueid']),_0x2d06f2);}};exports[_0x2452('0x36')]=function(_0x53fd05){try{if(!_[_0x2452('0x1a')](agents[_0x53fd05[_0x2452('0x37')]])){utils['debug'](util[_0x2452('0x1')]('[%s][agents][blindtransfer]',_0x53fd05[_0x2452('0x3')]),_0x53fd05);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x53fd05[_0x2452('0x3')],agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x6')],agents[_0x53fd05['transfereruniqueid']][_0x2452('0x3')]));agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x38')]=!![];agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x39')]='blind';agents[_0x53fd05[_0x2452('0x37')]]['transferexten']=_0x53fd05[_0x2452('0x3a')];agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x3b')]=agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x3')];}}catch(_0x2096e2){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x3c'),_0x53fd05['uniqueid']),_0x2096e2);}};exports[_0x2452('0x3d')]=function(_0x595f9f){try{utils[_0x2452('0x2a')](util['format'](_0x2452('0x3e'),_0x595f9f[_0x2452('0x3f')]),_0x595f9f);if(_0x595f9f['origtransfereruniqueid']==_0x595f9f[_0x2452('0x40')]){if(!_[_0x2452('0x1a')](agents[_0x595f9f[_0x2452('0x41')]])){utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x42'),_0x595f9f[_0x2452('0x3f')],agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x6')]));agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x38')]=!![];agents[_0x595f9f['secondtransfereruniqueid']][_0x2452('0x39')]='ATTENDED';agents[_0x595f9f[_0x2452('0x41')]]['transferexten']=_0x595f9f[_0x2452('0x43')];agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x3b')]=_0x595f9f[_0x2452('0x3f')];}if(_0x595f9f[_0x2452('0x44')]&&agents[_0x595f9f[_0x2452('0x44')]]){agents[_0x595f9f[_0x2452('0x44')]][_0x2452('0x45')]=0x1;transfers[_0x595f9f[_0x2452('0x44')]]=_[_0x2452('0x46')](agents[_0x595f9f[_0x2452('0x44')]]);transfers[_0x595f9f['transfereeuniqueid']][_0x2452('0x8')]=agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x8')];transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x47')]=agents[_0x595f9f[_0x2452('0x41')]]['calleridname'];transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x14')]=utils['now']();transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x21')]=0x0;transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x45')]=0x2;}}else if(_0x595f9f[_0x2452('0x41')]==_0x595f9f[_0x2452('0x48')]){if(!_[_0x2452('0x1a')](agents[_0x595f9f[_0x2452('0x3f')]])){utils['info'](util['format'](_0x2452('0x42'),_0x595f9f['origtransfereruniqueid'],agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x6')]));agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x38')]=!![];agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x39')]='ATTENDED';agents[_0x595f9f['origtransfereruniqueid']][_0x2452('0x49')]=_0x595f9f['secondtransfererexten'];agents[_0x595f9f[_0x2452('0x3f')]]['transferuniqueid']=_0x595f9f[_0x2452('0x41')];}if(_0x595f9f[_0x2452('0x4a')]&&agents[_0x595f9f[_0x2452('0x4a')]]){agents[_0x595f9f[_0x2452('0x4a')]]['agententerreason']=0x1;transfers[_0x595f9f['transfertargetuniqueid']]=_['clone'](agents[_0x595f9f[_0x2452('0x4a')]]);transfers[_0x595f9f[_0x2452('0x4a')]]['calleridnum']=agents[_0x595f9f['origtransfereruniqueid']]['calleridnum'];transfers[_0x595f9f['transfertargetuniqueid']]['calleridname']=agents[_0x595f9f[_0x2452('0x3f')]]['calleridname'];transfers[_0x595f9f['transfertargetuniqueid']][_0x2452('0x14')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x4a')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x4a')]]['holdtime']=0x0;transfers[_0x595f9f[_0x2452('0x4a')]][_0x2452('0x45')]=0x2;}}}catch(_0x45c850){utils['error'](util['format'](_0x2452('0x3e'),_0x595f9f[_0x2452('0x3f')]),_0x45c850);}};exports[_0x2452('0x4b')]=function(_0x1dec54){try{utils[_0x2452('0x2a')](util[_0x2452('0x1')](_0x2452('0x4c'),_0x1dec54[_0x2452('0x3')]),_0x1dec54);if(agents[_0x1dec54['uniqueid']]&&agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')]===_0x2452('0x20')){if(_0x1dec54[_0x2452('0x4d')]==='21'){agents[_0x1dec54['uniqueid']][_0x2452('0x1f')]=_0x2452('0x4e');agents[_0x1dec54['uniqueid']][_0x2452('0xa')]=_0x2452('0x4e');}utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],agents[_0x1dec54['uniqueid']]['reason'],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]));writeDB(agents[_0x1dec54[_0x2452('0x3')]]);var _0x1530fe=unanswered['indexOf'](_0x1dec54[_0x2452('0x3')]);if(_0x1530fe>-0x1){unanswered[_0x2452('0x50')](_0x1530fe,0x1);}}if(transfers[_0x1dec54[_0x2452('0x3')]]){transfers[_0x1dec54[_0x2452('0x3')]]['agentcomplete']=!![];transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')]=utils[_0x2452('0x1e')]();transfers[_0x1dec54[_0x2452('0x3')]]['talktime']=utils['diffTime'](transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')],transfers[_0x1dec54['uniqueid']][_0x2452('0x2d')]);transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')]=_0x2452('0x52');transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]=_0x2452('0x34');utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')],transfers[_0x1dec54[_0x2452('0x3')]]['lastevent']));writeDB(transfers[_0x1dec54[_0x2452('0x3')]],!![]);}if(agents[_0x1dec54[_0x2452('0x3')]]&&agents[_0x1dec54[_0x2452('0x3')]]['agentconnectAt']){agents[_0x1dec54['uniqueid']]['agentcomplete']=!![];agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')]=utils[_0x2452('0x1e')]();agents[_0x1dec54[_0x2452('0x3')]]['talktime']=utils['diffTime'](agents[_0x1dec54['uniqueid']][_0x2452('0x51')],agents[_0x1dec54['uniqueid']][_0x2452('0x2d')]);agents[_0x1dec54['uniqueid']][_0x2452('0x1f')]=agents[_0x1dec54['uniqueid']][_0x2452('0x38')]?'transfer':_0x2452('0x52');agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]=_0x2452('0x34');utils[_0x2452('0x16')](util['format'](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]));writeDB(agents[_0x1dec54[_0x2452('0x3')]]);}}catch(_0x3b681c){utils[_0x2452('0x17')](util['format'](_0x2452('0x4c'),_0x1dec54['uniqueid']),_0x3b681c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index afa6456..fc5bb56 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 _0x8429=['type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','execif','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','channel','queue','membername','interface','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','origtransfererchannel','_attended','error','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s'];(function(_0x5a43e6,_0x12c0da){var _0x5f2b27=function(_0x13c71d){while(--_0x13c71d){_0x5a43e6['push'](_0x5a43e6['shift']());}};_0x5f2b27(++_0x12c0da);}(_0x8429,0x7b));var _0x9842=function(_0x2a77ea,_0x3d8d27){_0x2a77ea=_0x2a77ea-0x0;var _0x13a821=_0x8429[_0x2a77ea];return _0x13a821;};'use strict';var _=require(_0x9842('0x0'));var util=require(_0x9842('0x1'));var utils=require(_0x9842('0x2'));var dispositions=['NO\x20ANSWER',_0x9842('0x3'),_0x9842('0x3'),'NO\x20ANSWER',_0x9842('0x4'),_0x9842('0x4'),_0x9842('0x5'),_0x9842('0x6'),_0x9842('0x3'),_0x9842('0x3'),_0x9842('0x3')];var channels={};function writeDB(_0x2c7263){utils[_0x9842('0x7')](util[_0x9842('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2c7263[_0x9842('0x9')],_0x2c7263[_0x9842('0xa')],_0x2c7263[_0x9842('0xb')],_0x2c7263[_0x9842('0xc')],_0x2c7263[_0x9842('0xd')],_0x2c7263['calleridnum'],_0x2c7263['connectedlinenum'],_0x2c7263[_0x9842('0xe')]));if(_0x2c7263[_0x9842('0xf')]){utils[_0x9842('0x10')](_0x2c7263[_0x9842('0xf')])['then'](function(_0x475d2d){if(_0x475d2d){_0x2c7263[_0x9842('0x11')]=_0x475d2d['id'];}utils[_0x9842('0x12')](_0x9842('0x13'),_0x2c7263);});}else{utils[_0x9842('0x12')](_0x9842('0x13'),_0x2c7263);}if(channels[_0x2c7263[_0x9842('0x9')]]){delete channels[_0x2c7263[_0x9842('0x9')]];}}exports['newchannel']=function(_0x12e892){try{utils[_0x9842('0x14')](util['format'](_0x9842('0x15'),_0x12e892['uniqueid']),_0x12e892);if(_0x12e892['uniqueid']==_0x12e892[_0x9842('0x16')]&&_0x12e892[_0x9842('0xa')]!=_0x9842('0x17')){utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x18'),_0x12e892[_0x9842('0x9')],_0x12e892[_0x9842('0x19')],_0x12e892[_0x9842('0x1a')]));channels[_0x12e892[_0x9842('0x9')]]={'uniqueid':_0x12e892[_0x9842('0x9')],'accountcode':_0x12e892[_0x9842('0xf')],'source':_0x12e892[_0x9842('0x1b')],'destination':_0x12e892[_0x9842('0x1a')],'destinationcontext':_0x12e892[_0x9842('0x19')],'channel':_0x12e892[_0x9842('0xa')],'starttime':utils[_0x9842('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9842('0x4'),'amaflags':_0x9842('0x1d')};}}catch(_0x2a5b55){utils['error'](util[_0x9842('0x8')]('[%s][calls][newchannel]',_0x12e892[_0x9842('0x9')]),_0x2a5b55);}};exports['newstate']=function(_0x5ca6f3){try{utils['debug'](util[_0x9842('0x8')](_0x9842('0x1e'),_0x5ca6f3['uniqueid']),_0x5ca6f3);if(!_[_0x9842('0x1f')](channels[_0x5ca6f3[_0x9842('0x9')]])&&_0x5ca6f3[_0x9842('0x20')]==0x6){utils['info'](util[_0x9842('0x8')](_0x9842('0x21'),_0x5ca6f3[_0x9842('0x9')],_0x5ca6f3[_0x9842('0x19')],_0x5ca6f3[_0x9842('0xa')]));if(_[_0x9842('0x1f')](channels[_0x5ca6f3[_0x9842('0x9')]]['systemanswertime'])){channels[_0x5ca6f3[_0x9842('0x9')]][_0x9842('0x22')]=utils[_0x9842('0x1c')]();}}else if(!_[_0x9842('0x1f')](channels[_0x5ca6f3['linkedid']])&&_0x5ca6f3[_0x9842('0x20')]==0x6&&_0x5ca6f3[_0x9842('0x19')]!=_0x9842('0x23')){utils[_0x9842('0x7')](util[_0x9842('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5ca6f3[_0x9842('0x9')],_0x5ca6f3[_0x9842('0x16')],_0x5ca6f3[_0x9842('0x19')],_0x5ca6f3[_0x9842('0xa')]));channels[_0x5ca6f3[_0x9842('0x16')]][_0x9842('0xf')]=_0x5ca6f3[_0x9842('0xf')];channels[_0x5ca6f3[_0x9842('0x16')]]['destinationchannel']=_0x5ca6f3[_0x9842('0xa')];if(_[_0x9842('0x1f')](channels[_0x5ca6f3[_0x9842('0x16')]][_0x9842('0x24')])){channels[_0x5ca6f3[_0x9842('0x16')]][_0x9842('0x24')]=utils[_0x9842('0x1c')]();}channels[_0x5ca6f3[_0x9842('0x16')]]['disposition']=dispositions[_[_0x9842('0x25')](_0x5ca6f3[_0x9842('0x20')])]||_0x9842('0x5');}}catch(_0x50145b){utils['error'](util['format'](_0x9842('0x1e'),_0x5ca6f3[_0x9842('0x9')]),_0x50145b);}};exports[_0x9842('0x26')]=function(_0x4c2ccd){try{if(!_[_0x9842('0x1f')](channels[_0x4c2ccd[_0x9842('0x9')]])){utils[_0x9842('0x14')](util[_0x9842('0x8')](_0x9842('0x27'),_0x4c2ccd['uniqueid']),_0x4c2ccd);if(_[_0x9842('0x1f')](channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x28')])){channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x28')]=_0x4c2ccd[_0x9842('0x29')]+'\x20<'+_0x4c2ccd[_0x9842('0x1b')]+'>';}utils[_0x9842('0x7')](util['format'](_0x9842('0x2a'),_0x4c2ccd[_0x9842('0x9')],channels[_0x4c2ccd['uniqueid']][_0x9842('0x28')],_0x4c2ccd[_0x9842('0x2b')]));channels[_0x4c2ccd[_0x9842('0x9')]]['endtime']=utils[_0x9842('0x1c')]();channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x2c')]=utils[_0x9842('0x2d')](channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x2e')],channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x2f')]);channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x30')]=channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x24')]?utils[_0x9842('0x2d')](channels[_0x4c2ccd[_0x9842('0x9')]]['endtime'],channels[_0x4c2ccd[_0x9842('0x9')]][_0x9842('0x24')]):0x0;writeDB(channels[_0x4c2ccd[_0x9842('0x9')]]);}}catch(_0x5ee8d3){utils['error'](util['format'](_0x9842('0x27'),_0x4c2ccd[_0x9842('0x9')]),_0x5ee8d3);}};exports['attendedtransfer']=function(_0x63a372){try{if(!_['isNil'](channels[_0x63a372[_0x9842('0x31')]])){utils[_0x9842('0x14')](util[_0x9842('0x8')](_0x9842('0x32'),_0x63a372[_0x9842('0x33')]),_0x63a372);if(channels[_0x63a372[_0x9842('0x31')]][_0x9842('0xa')]==_0x63a372['transfereechannel']){utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x34'),_0x63a372[_0x9842('0x33')],_0x63a372[_0x9842('0x31')],_0x63a372[_0x9842('0x35')]));channels[_0x63a372[_0x9842('0x31')]][_0x9842('0x36')]=_0x63a372[_0x9842('0x35')];channels[_0x63a372[_0x9842('0x31')]][_0x9842('0x37')]='_attended';}else if(channels[_0x63a372[_0x9842('0x31')]][_0x9842('0xa')]=_0x63a372['transfertargetchannel']){utils['info'](util[_0x9842('0x8')](_0x9842('0x34'),_0x63a372[_0x9842('0x33')],_0x63a372[_0x9842('0x31')],_0x63a372[_0x9842('0x38')]));channels[_0x63a372[_0x9842('0x31')]]['destinationchannel']=_0x63a372[_0x9842('0x38')];channels[_0x63a372[_0x9842('0x31')]][_0x9842('0x37')]=_0x9842('0x39');}}}catch(_0x20a89c){utils[_0x9842('0x3a')](util[_0x9842('0x8')]('[%s][calls][attendedtransfer]',_0x63a372['origtransfereruniqueid']),_0x20a89c);}};exports[_0x9842('0x3b')]=function(_0x54b723){try{if(!_[_0x9842('0x1f')](channels[_0x54b723['uniqueid']])){utils[_0x9842('0x14')](util[_0x9842('0x8')](_0x9842('0x3c'),_0x54b723[_0x9842('0x9')]),_0x54b723);channels[_0x54b723['uniqueid']][_0x9842('0x3d')]=utils[_0x9842('0x1c')]();utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x3e'),_0x54b723[_0x9842('0x9')],channels[_0x54b723['uniqueid']][_0x9842('0x3d')]));}}catch(_0x567f36){utils['error'](util[_0x9842('0x8')](_0x9842('0x3c'),_0x54b723['uniqueid']),_0x567f36);}};exports[_0x9842('0x3f')]=function(_0x42bd77){try{if(!_[_0x9842('0x1f')](channels[_0x42bd77[_0x9842('0x9')]])){utils[_0x9842('0x14')](util['format']('[%s][calls][musiconholdstop]',_0x42bd77[_0x9842('0x9')]),_0x42bd77);if(!_[_0x9842('0x1f')](channels[_0x42bd77[_0x9842('0x9')]][_0x9842('0x3d')])){channels[_0x42bd77['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x42bd77[_0x9842('0x9')]]['musiconholdstartAt']);utils[_0x9842('0x7')](util['format'](_0x9842('0x40'),_0x42bd77[_0x9842('0x9')],channels[_0x42bd77[_0x9842('0x9')]][_0x9842('0x41')]));delete channels[_0x42bd77[_0x9842('0x9')]]['musiconholdstartAt'];}}}catch(_0x36b14d){utils[_0x9842('0x3a')](util['format'](_0x9842('0x42'),_0x42bd77['uniqueid']),_0x36b14d);}};exports[_0x9842('0x43')]=function(_0x353f01){try{if(!_[_0x9842('0x1f')](channels[_0x353f01['uniqueid']])){utils[_0x9842('0x14')](util[_0x9842('0x8')](_0x9842('0x44'),_0x353f01[_0x9842('0x9')]),_0x353f01);if(!_['isNil'](_0x353f01[_0x9842('0x45')]['xmd-originatecalleridnum'])){utils[_0x9842('0x7')](util[_0x9842('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x353f01['uniqueid'],_0x353f01['value']));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x46')]=_0x353f01[_0x9842('0x47')];}if(!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x48')])){utils[_0x9842('0x7')](util['format'](_0x9842('0x49'),_0x353f01[_0x9842('0x9')],_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x4a')]=_0x353f01[_0x9842('0x47')];channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x28')]='\x22'+_0x353f01[_0x9842('0x47')]+'\x22\x20<'+_0x353f01[_0x9842('0x47')]+'>';}if(!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x4b')])||!_['isNil'](_0x353f01[_0x9842('0x45')]['xmd-callerid'])){utils[_0x9842('0x7')](util['format'](_0x9842('0x4c'),_0x353f01[_0x9842('0x9')],!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x4b')])?_0x9842('0x4b'):_0x9842('0x4d'),_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x28')]=_0x353f01[_0x9842('0x47')];}if(!_['isNil'](_0x353f01['variable'][_0x9842('0x4e')])||!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x4f')])){utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x4c'),_0x353f01[_0x9842('0x9')],!_[_0x9842('0x1f')](_0x353f01['variable']['xmd-queue'])?_0x9842('0x4e'):_0x9842('0x4f'),_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x50')]=_0x9842('0x51');channels[_0x353f01['uniqueid']]['lastdata']=_0x353f01[_0x9842('0x47')];channels[_0x353f01[_0x9842('0x9')]][_0x9842('0xb')]=!![];}if(!_['isNil'](_0x353f01[_0x9842('0x45')][_0x9842('0x52')])){utils[_0x9842('0x7')](util['format'](_0x9842('0x53'),_0x353f01['uniqueid'],_0x353f01[_0x9842('0x47')]));channels[_0x353f01['uniqueid']][_0x9842('0x54')]=_0x353f01[_0x9842('0x47')];}if(!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x55')])){utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x56'),_0x353f01[_0x9842('0x9')],_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x57')]=_0x353f01[_0x9842('0x47')];}if(!_['isNil'](_0x353f01[_0x9842('0x45')][_0x9842('0x58')])){utils['info'](util[_0x9842('0x8')](_0x9842('0x59'),_0x353f01['uniqueid'],_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]][_0x9842('0x5a')]=_0x353f01[_0x9842('0x47')];}if(!_[_0x9842('0x1f')](_0x353f01[_0x9842('0x45')][_0x9842('0x5b')])){utils[_0x9842('0x7')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x353f01[_0x9842('0x9')],_0x353f01[_0x9842('0x47')]));channels[_0x353f01[_0x9842('0x9')]]['sipcallid']=_0x353f01[_0x9842('0x47')];}}}catch(_0x430dbd){utils[_0x9842('0x3a')](util[_0x9842('0x8')](_0x9842('0x44'),_0x353f01[_0x9842('0x9')]),_0x430dbd);}};exports['newexten']=function(_0x2d650a){try{if(!_[_0x9842('0x1f')](channels[_0x2d650a[_0x9842('0x9')]])){utils[_0x9842('0x14')](util[_0x9842('0x8')](_0x9842('0x5c'),_0x2d650a[_0x9842('0x9')]),_0x2d650a);utils[_0x9842('0x7')](util[_0x9842('0x8')](_0x9842('0x5d'),_0x2d650a['uniqueid'],_0x2d650a[_0x9842('0x5e')],_0x2d650a[_0x9842('0x5f')]));if(_0x2d650a['application']['toLowerCase']()==_0x9842('0x60')&&_['startsWith'](_0x2d650a[_0x9842('0x5f')][_0x9842('0x61')](),_0x9842('0x62'))){var _0x155e12=_0x2d650a[_0x9842('0x5f')][_0x9842('0x63')]('=');var _0x2e13dc=_0x155e12[0x0][_0x9842('0x64')](_0x155e12[0x0][_0x9842('0x65')]('(')+0x1,_0x155e12[0x0]['lastIndexOf'](')'));var _0x2a7a00=_0x155e12[0x1];channels[_0x2d650a['uniqueid']][_0x2e13dc]=_0x2a7a00;}if(!_['includes'](['hangup','noop',_0x9842('0x66'),_0x9842('0x60'),_0x9842('0x67')],_0x2d650a['application'][_0x9842('0x61')]())){channels[_0x2d650a['uniqueid']]['lastapplication']=_0x2d650a[_0x9842('0x5e')];channels[_0x2d650a[_0x9842('0x9')]][_0x9842('0x68')]=_0x2d650a['appdata'];}}}catch(_0x29f1e2){utils[_0x9842('0x3a')](util[_0x9842('0x8')](_0x9842('0x5c'),_0x2d650a['uniqueid']),_0x29f1e2);}}; \ No newline at end of file +var _0xfa27=['exten','context','now','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','lastIndexOf','includes','set','gotoif','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','channel','queue','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa27,0x11a));var _0x7fa2=function(_0x420950,_0x4eb9d7){_0x420950=_0x420950-0x0;var _0x3702fe=_0xfa27[_0x420950];return _0x3702fe;};'use strict';var _=require('lodash');var util=require(_0x7fa2('0x0'));var utils=require(_0x7fa2('0x1'));var dispositions=[_0x7fa2('0x2'),_0x7fa2('0x3'),'FAILED',_0x7fa2('0x2'),_0x7fa2('0x2'),_0x7fa2('0x2'),_0x7fa2('0x4'),_0x7fa2('0x5'),'FAILED',_0x7fa2('0x3'),'FAILED'];var channels={};function writeDB(_0x5b9b07){utils[_0x7fa2('0x6')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5b9b07['uniqueid'],_0x5b9b07[_0x7fa2('0x7')],_0x5b9b07[_0x7fa2('0x8')],_0x5b9b07[_0x7fa2('0x9')],_0x5b9b07[_0x7fa2('0xa')],_0x5b9b07['calleridnum'],_0x5b9b07[_0x7fa2('0xb')],_0x5b9b07[_0x7fa2('0xc')]));if(_0x5b9b07['accountcode']){utils[_0x7fa2('0xd')](_0x5b9b07[_0x7fa2('0xe')])[_0x7fa2('0xf')](function(_0x1d1895){if(_0x1d1895){_0x5b9b07[_0x7fa2('0x10')]=_0x1d1895['id'];}utils[_0x7fa2('0x11')](_0x7fa2('0x12'),_0x5b9b07);});}else{utils[_0x7fa2('0x11')](_0x7fa2('0x12'),_0x5b9b07);}if(channels[_0x5b9b07[_0x7fa2('0x13')]]){delete channels[_0x5b9b07[_0x7fa2('0x13')]];}}exports[_0x7fa2('0x14')]=function(_0x1784f6){try{utils[_0x7fa2('0x15')](util[_0x7fa2('0x16')](_0x7fa2('0x17'),_0x1784f6['uniqueid']),_0x1784f6);if(_0x1784f6[_0x7fa2('0x13')]==_0x1784f6[_0x7fa2('0x18')]&&_0x1784f6[_0x7fa2('0x7')]!=_0x7fa2('0x19')){utils['info'](util[_0x7fa2('0x16')](_0x7fa2('0x1a'),_0x1784f6[_0x7fa2('0x13')],_0x1784f6['context'],_0x1784f6['exten']));channels[_0x1784f6['uniqueid']]={'uniqueid':_0x1784f6[_0x7fa2('0x13')],'accountcode':_0x1784f6[_0x7fa2('0xe')],'source':_0x1784f6['calleridnum'],'destination':_0x1784f6[_0x7fa2('0x1b')],'destinationcontext':_0x1784f6[_0x7fa2('0x1c')],'channel':_0x1784f6[_0x7fa2('0x7')],'starttime':utils[_0x7fa2('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x7fa2('0x1e')};}}catch(_0x5159cd){utils['error'](util[_0x7fa2('0x16')](_0x7fa2('0x17'),_0x1784f6[_0x7fa2('0x13')]),_0x5159cd);}};exports['newstate']=function(_0x389f2e){try{utils[_0x7fa2('0x15')](util[_0x7fa2('0x16')](_0x7fa2('0x1f'),_0x389f2e[_0x7fa2('0x13')]),_0x389f2e);if(!_[_0x7fa2('0x20')](channels[_0x389f2e['uniqueid']])&&_0x389f2e[_0x7fa2('0x21')]==0x6){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x22'),_0x389f2e[_0x7fa2('0x13')],_0x389f2e[_0x7fa2('0x1c')],_0x389f2e[_0x7fa2('0x7')]));if(_['isNil'](channels[_0x389f2e['uniqueid']][_0x7fa2('0x23')])){channels[_0x389f2e[_0x7fa2('0x13')]][_0x7fa2('0x23')]=utils[_0x7fa2('0x1d')]();}}else if(!_[_0x7fa2('0x20')](channels[_0x389f2e[_0x7fa2('0x18')]])&&_0x389f2e[_0x7fa2('0x21')]==0x6&&_0x389f2e[_0x7fa2('0x1c')]!=_0x7fa2('0x24')){utils['info'](util['format'](_0x7fa2('0x25'),_0x389f2e[_0x7fa2('0x13')],_0x389f2e[_0x7fa2('0x18')],_0x389f2e[_0x7fa2('0x1c')],_0x389f2e[_0x7fa2('0x7')]));channels[_0x389f2e[_0x7fa2('0x18')]]['accountcode']=_0x389f2e[_0x7fa2('0xe')];channels[_0x389f2e[_0x7fa2('0x18')]][_0x7fa2('0x26')]=_0x389f2e['channel'];if(_['isNil'](channels[_0x389f2e['linkedid']][_0x7fa2('0x27')])){channels[_0x389f2e[_0x7fa2('0x18')]][_0x7fa2('0x27')]=utils[_0x7fa2('0x1d')]();}channels[_0x389f2e[_0x7fa2('0x18')]][_0x7fa2('0x28')]=dispositions[_[_0x7fa2('0x29')](_0x389f2e['channelstate'])]||_0x7fa2('0x4');}}catch(_0x40fe66){utils[_0x7fa2('0x2a')](util[_0x7fa2('0x16')]('[%s][calls][newstate]',_0x389f2e[_0x7fa2('0x13')]),_0x40fe66);}};exports[_0x7fa2('0x2b')]=function(_0x34c031){try{if(!_[_0x7fa2('0x20')](channels[_0x34c031['uniqueid']])){utils[_0x7fa2('0x15')](util[_0x7fa2('0x16')](_0x7fa2('0x2c'),_0x34c031['uniqueid']),_0x34c031);if(_[_0x7fa2('0x20')](channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x2d')])){channels[_0x34c031[_0x7fa2('0x13')]]['callerid']=_0x34c031['calleridname']+'\x20<'+_0x34c031['calleridnum']+'>';}utils['info'](util['format'](_0x7fa2('0x2e'),_0x34c031['uniqueid'],channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x2d')],_0x34c031[_0x7fa2('0x2f')]));channels[_0x34c031['uniqueid']][_0x7fa2('0x30')]=utils[_0x7fa2('0x1d')]();channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x31')]=utils[_0x7fa2('0x32')](channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x30')],channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x33')]);channels[_0x34c031['uniqueid']]['billableseconds']=channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x27')]?utils['diffTime'](channels[_0x34c031[_0x7fa2('0x13')]][_0x7fa2('0x30')],channels[_0x34c031['uniqueid']][_0x7fa2('0x27')]):0x0;writeDB(channels[_0x34c031[_0x7fa2('0x13')]]);}}catch(_0x2db925){utils[_0x7fa2('0x2a')](util[_0x7fa2('0x16')](_0x7fa2('0x2c'),_0x34c031[_0x7fa2('0x13')]),_0x2db925);}};exports[_0x7fa2('0x34')]=function(_0x2c8911){try{if(!_[_0x7fa2('0x20')](channels[_0x2c8911[_0x7fa2('0x35')]])){utils[_0x7fa2('0x15')](util['format'](_0x7fa2('0x36'),_0x2c8911[_0x7fa2('0x37')]),_0x2c8911);if(channels[_0x2c8911[_0x7fa2('0x35')]][_0x7fa2('0x7')]==_0x2c8911[_0x7fa2('0x38')]){utils[_0x7fa2('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2c8911['origtransfereruniqueid'],_0x2c8911[_0x7fa2('0x35')],_0x2c8911[_0x7fa2('0x39')]));channels[_0x2c8911['localtwolinkedid']][_0x7fa2('0x26')]=_0x2c8911['secondtransfererchannel'];channels[_0x2c8911[_0x7fa2('0x35')]][_0x7fa2('0x3a')]='_attended';}else if(channels[_0x2c8911[_0x7fa2('0x35')]]['channel']=_0x2c8911[_0x7fa2('0x3b')]){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x3c'),_0x2c8911[_0x7fa2('0x37')],_0x2c8911['localtwolinkedid'],_0x2c8911[_0x7fa2('0x3d')]));channels[_0x2c8911['localtwolinkedid']][_0x7fa2('0x26')]=_0x2c8911[_0x7fa2('0x3d')];channels[_0x2c8911[_0x7fa2('0x35')]][_0x7fa2('0x3a')]='_attended';}}}catch(_0x24e645){utils[_0x7fa2('0x2a')](util[_0x7fa2('0x16')](_0x7fa2('0x36'),_0x2c8911[_0x7fa2('0x37')]),_0x24e645);}};exports[_0x7fa2('0x3e')]=function(_0x5d9ef2){try{if(!_[_0x7fa2('0x20')](channels[_0x5d9ef2[_0x7fa2('0x13')]])){utils[_0x7fa2('0x15')](util[_0x7fa2('0x16')](_0x7fa2('0x3f'),_0x5d9ef2[_0x7fa2('0x13')]),_0x5d9ef2);channels[_0x5d9ef2['uniqueid']][_0x7fa2('0x40')]=utils[_0x7fa2('0x1d')]();utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5d9ef2['uniqueid'],channels[_0x5d9ef2[_0x7fa2('0x13')]]['musiconholdstartAt']));}}catch(_0x2217c0){utils['error'](util['format'](_0x7fa2('0x3f'),_0x5d9ef2[_0x7fa2('0x13')]),_0x2217c0);}};exports[_0x7fa2('0x41')]=function(_0x750c50){try{if(!_[_0x7fa2('0x20')](channels[_0x750c50[_0x7fa2('0x13')]])){utils['debug'](util[_0x7fa2('0x16')]('[%s][calls][musiconholdstop]',_0x750c50['uniqueid']),_0x750c50);if(!_[_0x7fa2('0x20')](channels[_0x750c50[_0x7fa2('0x13')]][_0x7fa2('0x40')])){channels[_0x750c50[_0x7fa2('0x13')]][_0x7fa2('0x42')]+=utils[_0x7fa2('0x32')](utils[_0x7fa2('0x1d')](),channels[_0x750c50['uniqueid']][_0x7fa2('0x40')]);utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x750c50[_0x7fa2('0x13')],channels[_0x750c50[_0x7fa2('0x13')]][_0x7fa2('0x42')]));delete channels[_0x750c50[_0x7fa2('0x13')]][_0x7fa2('0x40')];}}}catch(_0x1435db){utils[_0x7fa2('0x2a')](util[_0x7fa2('0x16')]('[%s][calls][musiconholdstop]',_0x750c50[_0x7fa2('0x13')]),_0x1435db);}};exports[_0x7fa2('0x43')]=function(_0x2b501b){try{if(!_[_0x7fa2('0x20')](channels[_0x2b501b['uniqueid']])){utils[_0x7fa2('0x15')](util['format'](_0x7fa2('0x44'),_0x2b501b[_0x7fa2('0x13')]),_0x2b501b);if(!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x46')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x47'),_0x2b501b[_0x7fa2('0x13')],_0x2b501b[_0x7fa2('0x48')]));channels[_0x2b501b[_0x7fa2('0x13')]]['source']=_0x2b501b[_0x7fa2('0x48')];}if(!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x49')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x4a'),_0x2b501b[_0x7fa2('0x13')],_0x2b501b['value']));channels[_0x2b501b[_0x7fa2('0x13')]]['destination']=_0x2b501b[_0x7fa2('0x48')];channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x2d')]='\x22'+_0x2b501b['value']+'\x22\x20<'+_0x2b501b['value']+'>';}if(!_[_0x7fa2('0x20')](_0x2b501b['variable'][_0x7fa2('0x4b')])||!_[_0x7fa2('0x20')](_0x2b501b['variable'][_0x7fa2('0x4c')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x4d'),_0x2b501b[_0x7fa2('0x13')],!_['isNil'](_0x2b501b[_0x7fa2('0x45')]['xmd-callerid-preview'])?_0x7fa2('0x4b'):_0x7fa2('0x4c'),_0x2b501b['value']));channels[_0x2b501b['uniqueid']][_0x7fa2('0x2d')]=_0x2b501b['value'];}if(!_[_0x7fa2('0x20')](_0x2b501b['variable'][_0x7fa2('0x4e')])||!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x4f')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2b501b['uniqueid'],!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x4e')])?'xmd-queue':_0x7fa2('0x4f'),_0x2b501b['value']));channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x50')]=_0x7fa2('0x51');channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x52')]=_0x2b501b['value'];channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x8')]=!![];}if(!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x53')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x54'),_0x2b501b[_0x7fa2('0x13')],_0x2b501b[_0x7fa2('0x48')]));channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x55')]=_0x2b501b['value'];}if(!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')]['xmd-cdrtype'])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2b501b[_0x7fa2('0x13')],_0x2b501b[_0x7fa2('0x48')]));channels[_0x2b501b[_0x7fa2('0x13')]][_0x7fa2('0x56')]=_0x2b501b[_0x7fa2('0x48')];}if(!_[_0x7fa2('0x20')](_0x2b501b[_0x7fa2('0x45')][_0x7fa2('0x57')])){utils[_0x7fa2('0x6')](util['format'](_0x7fa2('0x58'),_0x2b501b[_0x7fa2('0x13')],_0x2b501b[_0x7fa2('0x48')]));channels[_0x2b501b['uniqueid']][_0x7fa2('0x59')]=_0x2b501b[_0x7fa2('0x48')];}if(!_[_0x7fa2('0x20')](_0x2b501b['variable'][_0x7fa2('0x5a')])){utils[_0x7fa2('0x6')](util[_0x7fa2('0x16')](_0x7fa2('0x5b'),_0x2b501b[_0x7fa2('0x13')],_0x2b501b['value']));channels[_0x2b501b['uniqueid']][_0x7fa2('0x5a')]=_0x2b501b['value'];}}}catch(_0x5e3f42){utils[_0x7fa2('0x2a')](util[_0x7fa2('0x16')]('[%s][calls][varset]',_0x2b501b[_0x7fa2('0x13')]),_0x5e3f42);}};exports[_0x7fa2('0x5c')]=function(_0x23e8f4){try{if(!_[_0x7fa2('0x20')](channels[_0x23e8f4[_0x7fa2('0x13')]])){utils[_0x7fa2('0x15')](util[_0x7fa2('0x16')]('[%s][calls][newexten]',_0x23e8f4[_0x7fa2('0x13')]),_0x23e8f4);utils['info'](util['format'](_0x7fa2('0x5d'),_0x23e8f4[_0x7fa2('0x13')],_0x23e8f4[_0x7fa2('0x5e')],_0x23e8f4[_0x7fa2('0x5f')]));if(_0x23e8f4[_0x7fa2('0x5e')][_0x7fa2('0x60')]()=='set'&&_['startsWith'](_0x23e8f4[_0x7fa2('0x5f')][_0x7fa2('0x60')](),'cdr')){var _0x38585d=_0x23e8f4[_0x7fa2('0x5f')][_0x7fa2('0x61')]('=');var _0x5a82e3=_0x38585d[0x0]['substring'](_0x38585d[0x0][_0x7fa2('0x62')]('(')+0x1,_0x38585d[0x0]['lastIndexOf'](')'));var _0x5303ec=_0x38585d[0x1];channels[_0x23e8f4[_0x7fa2('0x13')]][_0x5a82e3]=_0x5303ec;}if(!_[_0x7fa2('0x63')]([_0x7fa2('0x2b'),'noop','execif',_0x7fa2('0x64'),_0x7fa2('0x65')],_0x23e8f4['application'][_0x7fa2('0x60')]())){channels[_0x23e8f4[_0x7fa2('0x13')]][_0x7fa2('0x50')]=_0x23e8f4[_0x7fa2('0x5e')];channels[_0x23e8f4['uniqueid']][_0x7fa2('0x52')]=_0x23e8f4[_0x7fa2('0x5f')];}}}catch(_0x4380cd){utils['error'](util[_0x7fa2('0x16')](_0x7fa2('0x66'),_0x23e8f4[_0x7fa2('0x13')]),_0x4380cd);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 60dd5cc..2eb2c26 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 _0x3764=['[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x357296,_0xc0c1b2){var _0x464469=function(_0x2f93e0){while(--_0x2f93e0){_0x357296['push'](_0x357296['shift']());}};_0x464469(++_0xc0c1b2);}(_0x3764,0x1f3));var _0x4376=function(_0x310baf,_0x4c6d2f){_0x310baf=_0x310baf-0x0;var _0xc68c9c=_0x3764[_0x310baf];return _0xc68c9c;};'use strict';var utils=require('./utils');exports[_0x4376('0x0')]=function(){utils[_0x4376('0x1')](_0x4376('0x2'));};exports[_0x4376('0x3')]=function(){utils['info'](_0x4376('0x4'));};exports[_0x4376('0x5')]=function(){utils[_0x4376('0x1')](_0x4376('0x6'));};exports['error']=function(_0x2223a4){utils['error'](_0x4376('0x7'),_0x2223a4);};exports[_0x4376('0x8')]=function(){utils[_0x4376('0x1')](_0x4376('0x9'));};exports[_0x4376('0xa')]=function(_0x25066c){}; \ No newline at end of file +var _0xae0c=['info','shutdown','[core]\x20shutdown','fullybooted','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae0c,0x97));var _0xcae0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xae0c[_0x42cae2];return _0x5f256f;};'use strict';var utils=require(_0xcae0('0x0'));exports[_0xcae0('0x1')]=function(){utils[_0xcae0('0x2')]('[core]\x20connected');};exports[_0xcae0('0x3')]=function(){utils[_0xcae0('0x2')](_0xcae0('0x4'));};exports[_0xcae0('0x5')]=function(){utils[_0xcae0('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x2b038e){utils['error']('[core]\x20error',_0x2b038e);};exports[_0xcae0('0x6')]=function(){utils[_0xcae0('0x2')](_0xcae0('0x7'));};exports[_0xcae0('0x8')]=function(_0xfa16b2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e346e58..b025046 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 _0x5891=['startsWith','appdata','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','answertime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','request','uniqueid','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set'];(function(_0x53bc75,_0x87e8e0){var _0x381ae6=function(_0x48f6fd){while(--_0x48f6fd){_0x53bc75['push'](_0x53bc75['shift']());}};_0x381ae6(++_0x87e8e0);}(_0x5891,0x12e));var _0x1589=function(_0x544697,_0x101aa7){_0x544697=_0x544697-0x0;var _0x468ff2=_0x5891[_0x544697];return _0x468ff2;};'use strict';var _=require(_0x1589('0x0'));var util=require(_0x1589('0x1'));var utils=require(_0x1589('0x2'));var dials={};function writeDB(_0x5e4325){utils[_0x1589('0x3')](util['format'](_0x1589('0x4'),_0x5e4325['uniqueid'],_0x5e4325['channel'],_0x5e4325['dialstring'],_0x5e4325[_0x1589('0x5')],_0x5e4325['connectedlinenum'],_0x5e4325['dialstatus']));utils[_0x1589('0x6')]('CreateVoiceDialReport',_0x5e4325);delete dials[_0x5e4325[_0x1589('0x7')]];}exports[_0x1589('0x8')]=function(_0x4706ee){try{utils[_0x1589('0x9')](util[_0x1589('0xa')](_0x1589('0xb'),_0x4706ee[_0x1589('0x7')]),_0x4706ee);utils['info'](util[_0x1589('0xa')](_0x1589('0xc'),_0x4706ee[_0x1589('0x7')],_0x4706ee[_0x1589('0xd')],_0x4706ee['appdata']));if(_0x4706ee[_0x1589('0xd')][_0x1589('0xe')]()==_0x1589('0xf')&&_[_0x1589('0x10')](_0x4706ee[_0x1589('0x11')][_0x1589('0xe')](),_0x1589('0x12'))){var _0x16fdb4=_0x4706ee['appdata'][_0x1589('0x13')]('=');dials[_0x4706ee['uniqueid']]={'routeId':_0x16fdb4[0x1]};}}catch(_0x1d59eb){utils['error'](util['format']('[%s][dials][newexten]',_0x4706ee[_0x1589('0x7')]),_0x1d59eb);}};exports[_0x1589('0x14')]=function(_0x8531d4){try{utils[_0x1589('0x9')](util[_0x1589('0xa')](_0x1589('0x15'),_0x8531d4[_0x1589('0x7')]),_0x8531d4);if(!_[_0x1589('0x16')](_0x8531d4[_0x1589('0x17')][_0x1589('0x18')])){utils[_0x1589('0x3')](util[_0x1589('0xa')](_0x1589('0x19'),_0x8531d4[_0x1589('0x7')],_0x8531d4[_0x1589('0x1a')]));dials[_0x8531d4[_0x1589('0x7')]]={'routeId':_0x8531d4[_0x1589('0x1a')]};}}catch(_0x5039fa){utils[_0x1589('0x1b')](util['format'](_0x1589('0x15'),_0x8531d4['uniqueid']),_0x5039fa);}};exports[_0x1589('0x1c')]=function(_0x44ffbb){try{if(!_[_0x1589('0x16')](dials[_0x44ffbb[_0x1589('0x7')]])){utils[_0x1589('0x9')](util[_0x1589('0xa')](_0x1589('0x1d'),_0x44ffbb[_0x1589('0x7')]),_0x44ffbb);dials[_0x44ffbb['uniqueid']]=_[_0x1589('0x1e')](dials[_0x44ffbb[_0x1589('0x7')]],_0x44ffbb);dials[_0x44ffbb[_0x1589('0x7')]][_0x1589('0x1f')]=utils[_0x1589('0x20')]();dials[_0x44ffbb[_0x1589('0x7')]][_0x1589('0x21')]=_0x1589('0x22');utils[_0x1589('0x3')](util[_0x1589('0xa')](_0x1589('0x23'),_0x44ffbb[_0x1589('0x7')],dials[_0x44ffbb[_0x1589('0x7')]][_0x1589('0x1f')]));}}catch(_0x17523c){utils['error'](util[_0x1589('0xa')](_0x1589('0x1d'),_0x44ffbb[_0x1589('0x7')]),_0x17523c);}};exports['dialend']=function(_0x50b055){try{if(!_[_0x1589('0x16')](dials[_0x50b055[_0x1589('0x7')]])){utils[_0x1589('0x9')](util[_0x1589('0xa')](_0x1589('0x24'),_0x50b055['uniqueid']),_0x50b055);dials[_0x50b055[_0x1589('0x7')]]['dialstatus']=_0x50b055[_0x1589('0x25')];if(_0x50b055[_0x1589('0x25')]==_0x1589('0x26')){dials[_0x50b055['uniqueid']]=_[_0x1589('0x1e')](dials[_0x50b055[_0x1589('0x7')]],_0x50b055);dials[_0x50b055[_0x1589('0x7')]]['answertime']=utils[_0x1589('0x20')]();dials[_0x50b055[_0x1589('0x7')]][_0x1589('0x21')]=_0x1589('0x27');utils[_0x1589('0x3')](util[_0x1589('0xa')](_0x1589('0x28'),_0x50b055['uniqueid'],_0x50b055[_0x1589('0x25')],dials[_0x50b055[_0x1589('0x7')]]['answertime']));}else{utils['info'](util[_0x1589('0xa')](_0x1589('0x29'),_0x50b055[_0x1589('0x7')],_0x50b055['dialstatus']));}}}catch(_0x5ccb4c){utils[_0x1589('0x1b')](util['format'](_0x1589('0x24'),_0x50b055['uniqueid']),_0x5ccb4c);}};exports[_0x1589('0x2a')]=function(_0x217391){try{if(!_['isNil'](dials[_0x217391[_0x1589('0x7')]])){utils['debug'](util['format'](_0x1589('0x2b'),_0x217391[_0x1589('0x7')]),_0x217391);utils[_0x1589('0x3')](util[_0x1589('0xa')](_0x1589('0x2c'),_0x217391['uniqueid'],_0x217391[_0x1589('0x5')],_0x217391[_0x1589('0x2d')],_0x217391[_0x1589('0x2e')]));dials[_0x217391[_0x1589('0x7')]]=_[_0x1589('0x1e')](dials[_0x217391[_0x1589('0x7')]],{'endtime':utils[_0x1589('0x20')](),'lastevent':_0x1589('0x2f')});dials[_0x217391[_0x1589('0x7')]][_0x1589('0x30')]=utils[_0x1589('0x31')](dials[_0x217391[_0x1589('0x7')]][_0x1589('0x32')],dials[_0x217391[_0x1589('0x7')]][_0x1589('0x1f')]);dials[_0x217391['uniqueid']][_0x1589('0x33')]=utils[_0x1589('0x31')](dials[_0x217391['uniqueid']][_0x1589('0x34')]||dials[_0x217391[_0x1589('0x7')]][_0x1589('0x32')],dials[_0x217391['uniqueid']][_0x1589('0x1f')]);dials[_0x217391['uniqueid']]['billableseconds']=dials[_0x217391[_0x1589('0x7')]][_0x1589('0x34')]?utils[_0x1589('0x31')](dials[_0x217391['uniqueid']][_0x1589('0x32')],dials[_0x217391['uniqueid']][_0x1589('0x34')]):0x0;writeDB(dials[_0x217391[_0x1589('0x7')]]);}}catch(_0x32ecd5){utils['error'](util[_0x1589('0xa')](_0x1589('0x2b'),_0x217391[_0x1589('0x7')]),_0x32ecd5);}}; \ No newline at end of file +var _0xbe89=['hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','now','complete','duration','holdtime','diffTime','endtime','billableseconds','[%s][dials][hangup]','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','debug','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]'];(function(_0x3ef9ee,_0x5ba89a){var _0x42c45f=function(_0x11a927){while(--_0x11a927){_0x3ef9ee['push'](_0x3ef9ee['shift']());}};_0x42c45f(++_0x5ba89a);}(_0xbe89,0x149));var _0x9be8=function(_0x3054e7,_0x5e5bff){_0x3054e7=_0x3054e7-0x0;var _0x147076=_0xbe89[_0x3054e7];return _0x147076;};'use strict';var _=require('lodash');var util=require(_0x9be8('0x0'));var utils=require(_0x9be8('0x1'));var dials={};function writeDB(_0x5237c4){utils[_0x9be8('0x2')](util[_0x9be8('0x3')](_0x9be8('0x4'),_0x5237c4[_0x9be8('0x5')],_0x5237c4[_0x9be8('0x6')],_0x5237c4['dialstring'],_0x5237c4[_0x9be8('0x7')],_0x5237c4['connectedlinenum'],_0x5237c4[_0x9be8('0x8')]));utils['request'](_0x9be8('0x9'),_0x5237c4);delete dials[_0x5237c4[_0x9be8('0x5')]];}exports[_0x9be8('0xa')]=function(_0x2c29d8){try{utils['debug'](util[_0x9be8('0x3')](_0x9be8('0xb'),_0x2c29d8['uniqueid']),_0x2c29d8);utils[_0x9be8('0x2')](util[_0x9be8('0x3')](_0x9be8('0xc'),_0x2c29d8['uniqueid'],_0x2c29d8[_0x9be8('0xd')],_0x2c29d8[_0x9be8('0xe')]));if(_0x2c29d8['application']['toLowerCase']()==_0x9be8('0xf')&&_[_0x9be8('0x10')](_0x2c29d8[_0x9be8('0xe')][_0x9be8('0x11')](),_0x9be8('0x12'))){var _0x2d2439=_0x2c29d8[_0x9be8('0xe')][_0x9be8('0x13')]('=');dials[_0x2c29d8[_0x9be8('0x5')]]={'routeId':_0x2d2439[0x1]};}}catch(_0x58fcf9){utils[_0x9be8('0x14')](util[_0x9be8('0x3')](_0x9be8('0xb'),_0x2c29d8[_0x9be8('0x5')]),_0x58fcf9);}};exports[_0x9be8('0x15')]=function(_0x172f5d){try{utils['debug'](util[_0x9be8('0x3')](_0x9be8('0x16'),_0x172f5d[_0x9be8('0x5')]),_0x172f5d);if(!_[_0x9be8('0x17')](_0x172f5d[_0x9be8('0x18')][_0x9be8('0x19')])){utils[_0x9be8('0x2')](util[_0x9be8('0x3')](_0x9be8('0x1a'),_0x172f5d[_0x9be8('0x5')],_0x172f5d['value']));dials[_0x172f5d[_0x9be8('0x5')]]={'routeId':_0x172f5d[_0x9be8('0x1b')]};}}catch(_0x57f114){utils[_0x9be8('0x14')](util[_0x9be8('0x3')](_0x9be8('0x16'),_0x172f5d[_0x9be8('0x5')]),_0x57f114);}};exports[_0x9be8('0x1c')]=function(_0x2be2e9){try{if(!_[_0x9be8('0x17')](dials[_0x2be2e9[_0x9be8('0x5')]])){utils['debug'](util[_0x9be8('0x3')](_0x9be8('0x1d'),_0x2be2e9[_0x9be8('0x5')]),_0x2be2e9);dials[_0x2be2e9[_0x9be8('0x5')]]=_[_0x9be8('0x1e')](dials[_0x2be2e9[_0x9be8('0x5')]],_0x2be2e9);dials[_0x2be2e9[_0x9be8('0x5')]][_0x9be8('0x1f')]=utils['now']();dials[_0x2be2e9[_0x9be8('0x5')]][_0x9be8('0x20')]=_0x9be8('0x21');utils[_0x9be8('0x2')](util['format'](_0x9be8('0x22'),_0x2be2e9['uniqueid'],dials[_0x2be2e9[_0x9be8('0x5')]]['starttime']));}}catch(_0x52b1a9){utils[_0x9be8('0x14')](util[_0x9be8('0x3')](_0x9be8('0x1d'),_0x2be2e9[_0x9be8('0x5')]),_0x52b1a9);}};exports[_0x9be8('0x23')]=function(_0x20b804){try{if(!_[_0x9be8('0x17')](dials[_0x20b804['uniqueid']])){utils[_0x9be8('0x24')](util[_0x9be8('0x3')]('[%s][dials][dialend]',_0x20b804[_0x9be8('0x5')]),_0x20b804);dials[_0x20b804['uniqueid']][_0x9be8('0x8')]=_0x20b804[_0x9be8('0x8')];if(_0x20b804[_0x9be8('0x8')]==_0x9be8('0x25')){dials[_0x20b804[_0x9be8('0x5')]]=_[_0x9be8('0x1e')](dials[_0x20b804[_0x9be8('0x5')]],_0x20b804);dials[_0x20b804['uniqueid']][_0x9be8('0x26')]=utils['now']();dials[_0x20b804[_0x9be8('0x5')]][_0x9be8('0x20')]='connect';utils[_0x9be8('0x2')](util['format'](_0x9be8('0x27'),_0x20b804[_0x9be8('0x5')],_0x20b804[_0x9be8('0x8')],dials[_0x20b804[_0x9be8('0x5')]]['answertime']));}else{utils[_0x9be8('0x2')](util[_0x9be8('0x3')](_0x9be8('0x28'),_0x20b804[_0x9be8('0x5')],_0x20b804['dialstatus']));}}}catch(_0x241b8c){utils[_0x9be8('0x14')](util[_0x9be8('0x3')](_0x9be8('0x29'),_0x20b804[_0x9be8('0x5')]),_0x241b8c);}};exports[_0x9be8('0x2a')]=function(_0x3dfd49){try{if(!_[_0x9be8('0x17')](dials[_0x3dfd49[_0x9be8('0x5')]])){utils[_0x9be8('0x24')](util[_0x9be8('0x3')]('[%s][dials][hangup]',_0x3dfd49[_0x9be8('0x5')]),_0x3dfd49);utils[_0x9be8('0x2')](util['format'](_0x9be8('0x2b'),_0x3dfd49[_0x9be8('0x5')],_0x3dfd49[_0x9be8('0x7')],_0x3dfd49['calleridname'],_0x3dfd49[_0x9be8('0x2c')]));dials[_0x3dfd49[_0x9be8('0x5')]]=_[_0x9be8('0x1e')](dials[_0x3dfd49[_0x9be8('0x5')]],{'endtime':utils[_0x9be8('0x2d')](),'lastevent':_0x9be8('0x2e')});dials[_0x3dfd49['uniqueid']][_0x9be8('0x2f')]=utils['diffTime'](dials[_0x3dfd49[_0x9be8('0x5')]]['endtime'],dials[_0x3dfd49[_0x9be8('0x5')]]['starttime']);dials[_0x3dfd49[_0x9be8('0x5')]][_0x9be8('0x30')]=utils[_0x9be8('0x31')](dials[_0x3dfd49[_0x9be8('0x5')]]['answertime']||dials[_0x3dfd49[_0x9be8('0x5')]][_0x9be8('0x32')],dials[_0x3dfd49[_0x9be8('0x5')]][_0x9be8('0x1f')]);dials[_0x3dfd49[_0x9be8('0x5')]][_0x9be8('0x33')]=dials[_0x3dfd49['uniqueid']][_0x9be8('0x26')]?utils[_0x9be8('0x31')](dials[_0x3dfd49[_0x9be8('0x5')]][_0x9be8('0x32')],dials[_0x3dfd49[_0x9be8('0x5')]]['answertime']):0x0;writeDB(dials[_0x3dfd49[_0x9be8('0x5')]]);}}catch(_0x48e31b){utils['error'](util[_0x9be8('0x3')](_0x9be8('0x34'),_0x3dfd49[_0x9be8('0x5')]),_0x48e31b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1643a62..96338f1 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 _0xe48f=['managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','format','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','asterisk','port','username','keepConnected','info','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xe48f,0x171));var _0xfe48=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xe48f[_0xea8947];return _0x2455e9;};var AsteriskManager=require(_0xfe48('0x0'));var config=require('../../config/environment');var utils=require(_0xfe48('0x1'));var util=require(_0xfe48('0x2'));var isXDREnabled=config[_0xfe48('0x3')]&&config[_0xfe48('0x3')][_0xfe48('0x4')]?!config[_0xfe48('0x3')]['disabled']:!![];var isProduction=config[_0xfe48('0x5')]===_0xfe48('0x6')||![];var isLocalAsterisk=config[_0xfe48('0x3')]&&config[_0xfe48('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xfe48('0x7')][_0xfe48('0x8')],config[_0xfe48('0x7')]['ip'],config[_0xfe48('0x7')][_0xfe48('0x9')],config['asterisk']['password'],!![]);ami[_0xfe48('0xa')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xfe48('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xfe48('0xc'));var calls=require('./calls.controller');var queues=require(_0xfe48('0xd'));var recordings=require(_0xfe48('0xe'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xfe48('0xf'));var core=require(_0xfe48('0x10'));ami['on']('connect',core['connect']);ami['on'](_0xfe48('0x11'),core['shutdown']);ami['on'](_0xfe48('0x12'),core[_0xfe48('0x12')]);ami['on'](_0xfe48('0x13'),core['error']);ami['on'](_0xfe48('0x14'),core['close']);ami['on'](_0xfe48('0x15'),core[_0xfe48('0x15')]);ami['on'](_0xfe48('0x16'),function(_0x238515){try{utils['debug'](util['format'](_0xfe48('0x17'),_0x238515['device']),_0x238515);members[_0xfe48('0x16')](_0x238515);}catch(_0x50f5e4){utils[_0xfe48('0x13')](util['format'](_0xfe48('0x17'),_0x238515[_0xfe48('0x18')]),_0x50f5e4);}});ami['on'](_0xfe48('0x19'),function(_0xb732b4){try{utils[_0xfe48('0x1a')](util['format'](_0xfe48('0x1b'),_0xb732b4[_0xfe48('0x1c')]),_0xb732b4);agents[_0xfe48('0x19')](_0xb732b4);}catch(_0x1aac07){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x1b'),_0xb732b4['uniqueid']),_0x1aac07);}});ami['on'](_0xfe48('0x1e'),function(_0x3c3d60){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][agentringnoanswer]',_0x3c3d60[_0xfe48('0x1c')]),_0x3c3d60);agents['agentringnoanswer'](_0x3c3d60);}catch(_0x1800ff){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x1f'),_0x3c3d60[_0xfe48('0x1c')]),_0x1800ff);}});ami['on'](_0xfe48('0x20'),function(_0x12c5a1){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][agentconnect]',_0x12c5a1[_0xfe48('0x1c')]),_0x12c5a1);agents[_0xfe48('0x20')](_0x12c5a1);queues[_0xfe48('0x20')](_0x12c5a1);}catch(_0xca52e2){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')]('[%s][index][agentconnect]',_0x12c5a1[_0xfe48('0x1c')]),_0xca52e2);}});ami['on'](_0xfe48('0x21'),function(_0x24553f){try{utils[_0xfe48('0x1a')](util['format'](_0xfe48('0x22'),_0x24553f[_0xfe48('0x1c')]),_0x24553f);agents[_0xfe48('0x21')](_0x24553f);queues[_0xfe48('0x21')](_0x24553f);members['agentcomplete'](_0x24553f);}catch(_0x4ab180){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x22'),_0x24553f[_0xfe48('0x1c')]),_0x4ab180);}});ami['on'](_0xfe48('0x23'),function(_0x1453e){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][queuecallerabandon]',_0x1453e['uniqueid']),_0x1453e);agents[_0xfe48('0x23')](_0x1453e);queues[_0xfe48('0x23')](_0x1453e);}catch(_0x52fd6a){utils[_0xfe48('0x13')](util['format'](_0xfe48('0x24'),_0x1453e[_0xfe48('0x1c')]),_0x52fd6a);}});ami['on'](_0xfe48('0x25'),function(_0x435bd2){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')](_0xfe48('0x26'),_0x435bd2[_0xfe48('0x1c')]),_0x435bd2);queues[_0xfe48('0x25')](_0x435bd2);recordings['queuecallerjoin'](_0x435bd2);}catch(_0x3e8b47){utils['error'](util[_0xfe48('0x1d')](_0xfe48('0x26'),_0x435bd2[_0xfe48('0x1c')]),_0x3e8b47);}});ami['on'](_0xfe48('0x27'),function(_0x109b94){try{utils['debug'](util[_0xfe48('0x1d')](_0xfe48('0x28'),_0x109b94['uniqueid']),_0x109b94);queues[_0xfe48('0x27')](_0x109b94);}catch(_0x214346){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')]('[%s][index][queuecallerleave]',_0x109b94[_0xfe48('0x1c')]),_0x214346);}});ami['on']('musiconholdstart',function(_0x53eadc){try{utils[_0xfe48('0x1a')](util['format'](_0xfe48('0x29'),_0x53eadc['uniqueid']),_0x53eadc);queues[_0xfe48('0x2a')](_0x53eadc);calls[_0xfe48('0x2a')](_0x53eadc);}catch(_0x3e5292){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')]('[%s][index][musiconholdstart]',_0x53eadc['uniqueid']),_0x3e5292);}});ami['on']('musiconholdstop',function(_0x23f675){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][musiconholdstop]',_0x23f675[_0xfe48('0x1c')]),_0x23f675);queues[_0xfe48('0x2b')](_0x23f675);calls[_0xfe48('0x2b')](_0x23f675);}catch(_0x37c54b){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x2c'),_0x23f675[_0xfe48('0x1c')]),_0x37c54b);}});ami['on'](_0xfe48('0x2d'),function(_0x9da2bb){try{utils['debug'](util[_0xfe48('0x1d')](_0xfe48('0x2e'),_0x9da2bb[_0xfe48('0x1c')]),_0x9da2bb);calls[_0xfe48('0x2d')](_0x9da2bb);recordings['newstate'](_0x9da2bb);}catch(_0x48d047){utils[_0xfe48('0x13')](util['format']('[%s][index][newstate]',_0x9da2bb['uniqueid']),_0x48d047);}});ami['on'](_0xfe48('0x2f'),function(_0x436316){try{utils['debug'](util[_0xfe48('0x1d')]('[%s][index][hangup]',_0x436316[_0xfe48('0x1c')]),_0x436316);calls['hangup'](_0x436316);recordings[_0xfe48('0x2f')](_0x436316);dials[_0xfe48('0x2f')](_0x436316);agents['hangup'](_0x436316);queues[_0xfe48('0x2f')](_0x436316);}catch(_0x17f184){utils['error'](util[_0xfe48('0x1d')]('[%s][index][hangup]',_0x436316[_0xfe48('0x1c')]),_0x17f184);}});ami['on'](_0xfe48('0x30'),function(_0x4ed33e){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')](_0xfe48('0x31'),_0x4ed33e[_0xfe48('0x1c')]),_0x4ed33e);members[_0xfe48('0x30')](_0x4ed33e);}catch(_0x37635b){utils['error'](util[_0xfe48('0x1d')](_0xfe48('0x31'),_0x4ed33e['uniqueid']),_0x37635b);}});ami['on'](_0xfe48('0x32'),function(_0x4538d5){try{utils['debug'](util[_0xfe48('0x1d')](_0xfe48('0x33'),_0x4538d5[_0xfe48('0x1c')]),_0x4538d5);queues[_0xfe48('0x32')](_0x4538d5);agents[_0xfe48('0x32')](_0x4538d5);transfers[_0xfe48('0x32')](_0x4538d5);}catch(_0x535fdf){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')]('[%s][index][blindtransfer]',_0x4538d5[_0xfe48('0x1c')]),_0x535fdf);}});ami['on']('attendedtransfer',function(_0x40d1cd){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][attendedtransfer]',_0x40d1cd[_0xfe48('0x34')]),_0x40d1cd);queues[_0xfe48('0x35')](_0x40d1cd);transfers[_0xfe48('0x35')](_0x40d1cd);agents[_0xfe48('0x35')](_0x40d1cd);calls['attendedtransfer'](_0x40d1cd);}catch(_0x1283f1){utils[_0xfe48('0x13')](util['format'](_0xfe48('0x36'),_0x40d1cd['origtransfereruniqueid']),_0x1283f1);}});ami['on'](_0xfe48('0x37'),function(_0x136501){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')](_0xfe48('0x38'),_0x136501[_0xfe48('0x1c')]),_0x136501);queues[_0xfe48('0x37')](_0x136501);recordings[_0xfe48('0x37')](_0x136501);calls[_0xfe48('0x37')](_0x136501);dials[_0xfe48('0x37')](_0x136501);}catch(_0x2ce195){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')]('[%s][index][varset]',_0x136501['uniqueid']),_0x2ce195);}});ami['on'](_0xfe48('0x39'),function(_0x66493a){try{utils['debug'](util[_0xfe48('0x1d')](_0xfe48('0x3a'),_0x66493a['uniqueid']),_0x66493a);calls[_0xfe48('0x39')](_0x66493a);recordings['newexten'](_0x66493a);dials[_0xfe48('0x39')](_0x66493a);}catch(_0x59356f){utils['error'](util[_0xfe48('0x1d')](_0xfe48('0x3a'),_0x66493a['uniqueid']),_0x59356f);}});ami['on']('newchannel',function(_0x2ae4c8){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')](_0xfe48('0x3b'),_0x2ae4c8[_0xfe48('0x1c')]),_0x2ae4c8);calls[_0xfe48('0x3c')](_0x2ae4c8);recordings['newchannel'](_0x2ae4c8);}catch(_0x23a7f0){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x3b'),_0x2ae4c8[_0xfe48('0x1c')]),_0x23a7f0);}});ami['on'](_0xfe48('0x3d'),function(_0x17931c){try{utils['debug'](util[_0xfe48('0x1d')]('[%s][index][dialbegin]',_0x17931c[_0xfe48('0x1c')]),_0x17931c);dials['dialbegin'](_0x17931c);}catch(_0x3047be){utils['error'](util[_0xfe48('0x1d')](_0xfe48('0x3e'),_0x17931c[_0xfe48('0x1c')]),_0x3047be);}});ami['on'](_0xfe48('0x3f'),function(_0x4547bd){try{utils[_0xfe48('0x1a')](util[_0xfe48('0x1d')]('[%s][index][dialend]',_0x4547bd[_0xfe48('0x1c')]),_0x4547bd);dials[_0xfe48('0x3f')](_0x4547bd);}catch(_0x1fbaa1){utils[_0xfe48('0x13')](util[_0xfe48('0x1d')](_0xfe48('0x40'),_0x4547bd[_0xfe48('0x1c')]),_0x1fbaa1);}});} \ No newline at end of file +var _0xe436=['./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','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]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xe436,0x80));var _0x6e43=function(_0x8c2af,_0x192d98){_0x8c2af=_0x8c2af-0x0;var _0x56036c=_0xe436[_0x8c2af];return _0x56036c;};var AsteriskManager=require(_0x6e43('0x0'));var config=require(_0x6e43('0x1'));var utils=require(_0x6e43('0x2'));var util=require(_0x6e43('0x3'));var isXDREnabled=config['xdr']&&config[_0x6e43('0x4')][_0x6e43('0x5')]?!config[_0x6e43('0x4')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x6e43('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x6e43('0x6')][_0x6e43('0x7')],config[_0x6e43('0x6')]['ip'],config[_0x6e43('0x6')][_0x6e43('0x8')],config[_0x6e43('0x6')][_0x6e43('0x9')],!![]);ami[_0x6e43('0xa')]();if(!isXDREnabled){utils[_0x6e43('0xb')](_0x6e43('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6e43('0xb')](_0x6e43('0xd'));}else{var agents=require(_0x6e43('0xe'));var calls=require(_0x6e43('0xf'));var queues=require(_0x6e43('0x10'));var recordings=require('./recordings.controller');var members=require(_0x6e43('0x11'));var dials=require('./dials.controller');var transfers=require(_0x6e43('0x12'));var core=require(_0x6e43('0x13'));ami['on'](_0x6e43('0x14'),core[_0x6e43('0x14')]);ami['on']('shutdown',core[_0x6e43('0x15')]);ami['on'](_0x6e43('0x16'),core[_0x6e43('0x16')]);ami['on']('error',core[_0x6e43('0x17')]);ami['on'](_0x6e43('0x18'),core[_0x6e43('0x18')]);ami['on'](_0x6e43('0x19'),core['managerevent']);ami['on'](_0x6e43('0x1a'),function(_0xb68b42){try{utils['debug'](util[_0x6e43('0x1b')](_0x6e43('0x1c'),_0xb68b42[_0x6e43('0x1d')]),_0xb68b42);members[_0x6e43('0x1a')](_0xb68b42);}catch(_0xe97333){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x1c'),_0xb68b42[_0x6e43('0x1d')]),_0xe97333);}});ami['on']('agentcalled',function(_0x42f40e){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x1f'),_0x42f40e[_0x6e43('0x20')]),_0x42f40e);agents['agentcalled'](_0x42f40e);}catch(_0xb82fca){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')]('[%s][index][agentcalled]',_0x42f40e['uniqueid']),_0xb82fca);}});ami['on'](_0x6e43('0x21'),function(_0x582abc){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x22'),_0x582abc[_0x6e43('0x20')]),_0x582abc);agents[_0x6e43('0x21')](_0x582abc);}catch(_0x1261f7){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x22'),_0x582abc[_0x6e43('0x20')]),_0x1261f7);}});ami['on']('agentconnect',function(_0x4d4d6d){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x23'),_0x4d4d6d[_0x6e43('0x20')]),_0x4d4d6d);agents['agentconnect'](_0x4d4d6d);queues[_0x6e43('0x24')](_0x4d4d6d);}catch(_0x18889d){utils['error'](util[_0x6e43('0x1b')]('[%s][index][agentconnect]',_0x4d4d6d[_0x6e43('0x20')]),_0x18889d);}});ami['on'](_0x6e43('0x25'),function(_0x20b9e7){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x26'),_0x20b9e7[_0x6e43('0x20')]),_0x20b9e7);agents[_0x6e43('0x25')](_0x20b9e7);queues[_0x6e43('0x25')](_0x20b9e7);members[_0x6e43('0x25')](_0x20b9e7);}catch(_0x5431e6){utils['error'](util['format'](_0x6e43('0x26'),_0x20b9e7[_0x6e43('0x20')]),_0x5431e6);}});ami['on'](_0x6e43('0x27'),function(_0x2076c0){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')]('[%s][index][queuecallerabandon]',_0x2076c0[_0x6e43('0x20')]),_0x2076c0);agents[_0x6e43('0x27')](_0x2076c0);queues[_0x6e43('0x27')](_0x2076c0);}catch(_0x4d3e16){utils['error'](util[_0x6e43('0x1b')](_0x6e43('0x28'),_0x2076c0[_0x6e43('0x20')]),_0x4d3e16);}});ami['on'](_0x6e43('0x29'),function(_0x2db99b){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x2a'),_0x2db99b[_0x6e43('0x20')]),_0x2db99b);queues['queuecallerjoin'](_0x2db99b);recordings[_0x6e43('0x29')](_0x2db99b);}catch(_0x2b5862){utils['error'](util[_0x6e43('0x1b')]('[%s][index][queuecallerjoin]',_0x2db99b[_0x6e43('0x20')]),_0x2b5862);}});ami['on'](_0x6e43('0x2b'),function(_0x420bd9){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x2c'),_0x420bd9[_0x6e43('0x20')]),_0x420bd9);queues['queuecallerleave'](_0x420bd9);}catch(_0x3438e3){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')]('[%s][index][queuecallerleave]',_0x420bd9[_0x6e43('0x20')]),_0x3438e3);}});ami['on'](_0x6e43('0x2d'),function(_0x1edfe3){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x2e'),_0x1edfe3['uniqueid']),_0x1edfe3);queues[_0x6e43('0x2d')](_0x1edfe3);calls['musiconholdstart'](_0x1edfe3);}catch(_0x23edfd){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x2e'),_0x1edfe3[_0x6e43('0x20')]),_0x23edfd);}});ami['on'](_0x6e43('0x2f'),function(_0x47f916){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x30'),_0x47f916['uniqueid']),_0x47f916);queues[_0x6e43('0x2f')](_0x47f916);calls[_0x6e43('0x2f')](_0x47f916);}catch(_0x24221e){utils[_0x6e43('0x17')](util['format'](_0x6e43('0x30'),_0x47f916[_0x6e43('0x20')]),_0x24221e);}});ami['on'](_0x6e43('0x31'),function(_0xa20e){try{utils[_0x6e43('0x1e')](util['format'](_0x6e43('0x32'),_0xa20e[_0x6e43('0x20')]),_0xa20e);calls[_0x6e43('0x31')](_0xa20e);recordings[_0x6e43('0x31')](_0xa20e);}catch(_0x5294ab){utils['error'](util[_0x6e43('0x1b')]('[%s][index][newstate]',_0xa20e[_0x6e43('0x20')]),_0x5294ab);}});ami['on'](_0x6e43('0x33'),function(_0x3fec98){try{utils['debug'](util[_0x6e43('0x1b')](_0x6e43('0x34'),_0x3fec98[_0x6e43('0x20')]),_0x3fec98);calls['hangup'](_0x3fec98);recordings[_0x6e43('0x33')](_0x3fec98);dials['hangup'](_0x3fec98);agents['hangup'](_0x3fec98);queues[_0x6e43('0x33')](_0x3fec98);}catch(_0x4c94d7){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')]('[%s][index][hangup]',_0x3fec98[_0x6e43('0x20')]),_0x4c94d7);}});ami['on']('cdr',function(_0x3e912f){try{utils['debug'](util['format'](_0x6e43('0x35'),_0x3e912f[_0x6e43('0x20')]),_0x3e912f);members[_0x6e43('0x36')](_0x3e912f);}catch(_0xffcd08){utils[_0x6e43('0x17')](util['format'](_0x6e43('0x35'),_0x3e912f[_0x6e43('0x20')]),_0xffcd08);}});ami['on'](_0x6e43('0x37'),function(_0xfd1a75){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x38'),_0xfd1a75[_0x6e43('0x20')]),_0xfd1a75);queues['blindtransfer'](_0xfd1a75);agents[_0x6e43('0x37')](_0xfd1a75);transfers['blindtransfer'](_0xfd1a75);}catch(_0x5b7bc4){utils['error'](util[_0x6e43('0x1b')](_0x6e43('0x38'),_0xfd1a75[_0x6e43('0x20')]),_0x5b7bc4);}});ami['on'](_0x6e43('0x39'),function(_0x3f8a20){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x3a'),_0x3f8a20[_0x6e43('0x3b')]),_0x3f8a20);queues[_0x6e43('0x39')](_0x3f8a20);transfers[_0x6e43('0x39')](_0x3f8a20);agents[_0x6e43('0x39')](_0x3f8a20);calls[_0x6e43('0x39')](_0x3f8a20);}catch(_0x10b6ca){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x3a'),_0x3f8a20[_0x6e43('0x3b')]),_0x10b6ca);}});ami['on']('varset',function(_0x4c2213){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x3c'),_0x4c2213[_0x6e43('0x20')]),_0x4c2213);queues[_0x6e43('0x3d')](_0x4c2213);recordings[_0x6e43('0x3d')](_0x4c2213);calls[_0x6e43('0x3d')](_0x4c2213);dials[_0x6e43('0x3d')](_0x4c2213);}catch(_0x296302){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x3c'),_0x4c2213[_0x6e43('0x20')]),_0x296302);}});ami['on'](_0x6e43('0x3e'),function(_0xd5a46){try{utils['debug'](util[_0x6e43('0x1b')](_0x6e43('0x3f'),_0xd5a46[_0x6e43('0x20')]),_0xd5a46);calls[_0x6e43('0x3e')](_0xd5a46);recordings[_0x6e43('0x3e')](_0xd5a46);dials['newexten'](_0xd5a46);}catch(_0x52eead){utils[_0x6e43('0x17')](util['format'](_0x6e43('0x3f'),_0xd5a46[_0x6e43('0x20')]),_0x52eead);}});ami['on']('newchannel',function(_0x890706){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x40'),_0x890706[_0x6e43('0x20')]),_0x890706);calls[_0x6e43('0x41')](_0x890706);recordings[_0x6e43('0x41')](_0x890706);}catch(_0x5b7963){utils['error'](util[_0x6e43('0x1b')](_0x6e43('0x40'),_0x890706[_0x6e43('0x20')]),_0x5b7963);}});ami['on'](_0x6e43('0x42'),function(_0x32e615){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x43'),_0x32e615['uniqueid']),_0x32e615);dials[_0x6e43('0x42')](_0x32e615);}catch(_0x3b6a64){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x44'),_0x32e615[_0x6e43('0x20')]),_0x3b6a64);}});ami['on'](_0x6e43('0x45'),function(_0x18b28f){try{utils[_0x6e43('0x1e')](util[_0x6e43('0x1b')](_0x6e43('0x46'),_0x18b28f[_0x6e43('0x20')]),_0x18b28f);dials[_0x6e43('0x45')](_0x18b28f);}catch(_0x5b4dc5){utils[_0x6e43('0x17')](util[_0x6e43('0x1b')](_0x6e43('0x46'),_0x18b28f[_0x6e43('0x20')]),_0x5b4dc5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5c9acce..9226a9f 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 _0x05ba=['NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','[%s][members][cdr]','assign','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','catch','error','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x05ba,0x116));var _0xa05b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x05ba[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xa05b('0x0'));var util=require(_0xa05b('0x1'));var utils=require(_0xa05b('0x2'));var members={};var exclude=[_0xa05b('0x3'),_0xa05b('0x4')];function writeDB(_0x3493ff){utils[_0xa05b('0x5')](util[_0xa05b('0x6')](_0xa05b('0x7'),_0x3493ff[_0xa05b('0x8')],_0x3493ff[_0xa05b('0x9')],_0x3493ff[_0xa05b('0xa')],_0x3493ff['data2'],_0x3493ff[_0xa05b('0xb')],_0x3493ff['type']));if(_0x3493ff[_0xa05b('0x9')]){utils[_0xa05b('0xc')](_0x3493ff['interface'])[_0xa05b('0xd')](function(_0x55624b){if(_0x55624b){_0x3493ff[_0xa05b('0xb')]=_0x55624b['name'];_0x3493ff[_0xa05b('0xe')]=_0x55624b[_0xa05b('0xe')];utils[_0xa05b('0xf')](_0xa05b('0x10'),_0x3493ff);}else{utils[_0xa05b('0x11')](_0x3493ff[_0xa05b('0x9')][_0xa05b('0x12')]('/')[0x1])['then'](function(_0x5506b4){if(_0x5506b4){_0x3493ff[_0xa05b('0xb')]=_0x5506b4['name'];_0x3493ff[_0xa05b('0xe')]=_0x5506b4['internal'];utils[_0xa05b('0xf')]('CreateMemberReport',_0x3493ff);}});}})[_0xa05b('0x13')](function(_0x419547){utils[_0xa05b('0x14')](util[_0xa05b('0x6')]('[%s][members][writeDB]',_0x3493ff[_0xa05b('0x8')]),_0x419547);});}delete members[_0x3493ff['interface']];}function startsWith(_0x3dd108,_0x4b7a4d){return _['some'](_0x3dd108,function(_0x96f37){return _[_0xa05b('0x15')](_0x4b7a4d,_0x96f37);});}exports[_0xa05b('0x16')]=function(_0x7838ba){try{utils[_0xa05b('0x17')](util[_0xa05b('0x6')](_0xa05b('0x18'),members[_0x7838ba[_0xa05b('0x19')]]?members[_0x7838ba[_0xa05b('0x19')]][_0xa05b('0x8')]:_0x7838ba[_0xa05b('0x19')]),_0x7838ba);utils['info'](util[_0xa05b('0x6')](_0xa05b('0x1a'),members[_0x7838ba['device']]?members[_0x7838ba['device']][_0xa05b('0x8')]:_0x7838ba[_0xa05b('0x19')],_0x7838ba[_0xa05b('0x1b')],_0x7838ba['device']));switch(_0x7838ba[_0xa05b('0x1b')]){case _0xa05b('0x1c'):case _0xa05b('0x1d'):if(!startsWith(exclude,_0x7838ba['device'])){members[_0x7838ba[_0xa05b('0x19')]]={'channel':_0xa05b('0x1e'),'interface':_0x7838ba['device'],'type':_0xa05b('0x1f'),'enterAt':utils[_0xa05b('0x20')](),'role':_0xa05b('0x21')};}break;case _0xa05b('0x22'):if(!_[_0xa05b('0x23')](members[_0x7838ba[_0xa05b('0x19')]])){members[_0x7838ba[_0xa05b('0x19')]][_0xa05b('0x24')]=utils[_0xa05b('0x20')]();members[_0x7838ba[_0xa05b('0x19')]]['duration']=utils[_0xa05b('0x25')](members[_0x7838ba[_0xa05b('0x19')]][_0xa05b('0x24')],members[_0x7838ba[_0xa05b('0x19')]][_0xa05b('0x26')]);if(members[_0x7838ba['device']][_0xa05b('0x8')]){writeDB(members[_0x7838ba[_0xa05b('0x19')]]);}}break;default:break;}}catch(_0x1b4992){utils['error'](util[_0xa05b('0x6')](_0xa05b('0x18'),members[_0x7838ba[_0xa05b('0x19')]]?members[_0x7838ba[_0xa05b('0x19')]]['uniqueid']:_0x7838ba[_0xa05b('0x19')]),_0x1b4992);}};exports[_0xa05b('0x27')]=function(_0x49b355){try{if(!_['isNil'](members[_0x49b355['interface']])){utils['debug'](util[_0xa05b('0x6')](_0xa05b('0x28'),_0x49b355[_0xa05b('0x8')]),_0x49b355);utils[_0xa05b('0x5')](util[_0xa05b('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x49b355['uniqueid'],_0x49b355['interface'],_0x49b355[_0xa05b('0x29')]));members[_0x49b355[_0xa05b('0x9')]]=_['assign'](members[_0x49b355['interface']],{'data4':_0x49b355[_0xa05b('0x29')],'uniqueid':_0x49b355[_0xa05b('0x8')]});}}catch(_0x5c5c65){utils[_0xa05b('0x14')](util['format'](_0xa05b('0x28'),_0x49b355[_0xa05b('0x8')]),_0x5c5c65);}};exports['cdr']=function(_0x478bae){try{utils[_0xa05b('0x17')](util[_0xa05b('0x6')](_0xa05b('0x2a'),_0x478bae[_0xa05b('0x8')]),_0x478bae);if(_0x478bae[_0xa05b('0xa')]){var _0x28686a=_0x478bae[_0xa05b('0xa')][_0xa05b('0x12')]('-')[0x0];if(!_[_0xa05b('0x23')](members[_0x28686a])){members[_0x28686a]=_[_0xa05b('0x2b')](members[_0x28686a],{'data1':members[_0x28686a]['data1']||_0x478bae[_0xa05b('0x2c')],'data2':members[_0x28686a][_0xa05b('0x2d')]||_0x478bae[_0xa05b('0x2e')],'data3':members[_0x28686a][_0xa05b('0x2f')]||_0x478bae[_0xa05b('0x30')],'uniqueid':members[_0x28686a][_0xa05b('0x8')]||_0x478bae[_0xa05b('0x8')]});utils['info'](util[_0xa05b('0x6')](_0xa05b('0x31'),_0x478bae[_0xa05b('0x8')],members[_0x28686a]['data1'],members[_0x28686a][_0xa05b('0x2d')],members[_0x28686a]['data3']));if(members[_0x28686a][_0xa05b('0x24')]){writeDB(members[_0x28686a]);}}}if(_0x478bae['destinationchannel']){var _0x4cde47=_0x478bae[_0xa05b('0x32')][_0xa05b('0x12')]('-')[0x0];if(!_[_0xa05b('0x23')](members[_0x4cde47])){members[_0x4cde47]=_[_0xa05b('0x2b')](members[_0x4cde47],{'data1':members[_0x4cde47][_0xa05b('0x33')]||_0x478bae[_0xa05b('0x2c')],'data2':members[_0x4cde47][_0xa05b('0x2d')]||_0x478bae[_0xa05b('0x2e')],'data3':members[_0x4cde47][_0xa05b('0x2f')]||_0x478bae[_0xa05b('0x30')],'uniqueid':members[_0x4cde47][_0xa05b('0x8')]||_0x478bae['uniqueid']});utils[_0xa05b('0x5')](util[_0xa05b('0x6')](_0xa05b('0x31'),_0x478bae[_0xa05b('0x8')],members[_0x4cde47][_0xa05b('0x33')],members[_0x4cde47][_0xa05b('0x2d')],members[_0x4cde47][_0xa05b('0x2f')]));if(members[_0x4cde47]['exitAt']){writeDB(members[_0x4cde47]);}}}}catch(_0x35353a){utils[_0xa05b('0x14')](util[_0xa05b('0x6')](_0xa05b('0x2a'),_0x478bae['uniqueid']),_0x35353a);}}; \ No newline at end of file +var _0x59ce=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','source','data3','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59ce,0x92));var _0xe59c=function(_0x34a5d8,_0x111ada){_0x34a5d8=_0x34a5d8-0x0;var _0x3966e6=_0x59ce[_0x34a5d8];return _0x3966e6;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var utils=require(_0xe59c('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xe59c('0x3')];function writeDB(_0x18c8c3){utils[_0xe59c('0x4')](util[_0xe59c('0x5')](_0xe59c('0x6'),_0x18c8c3[_0xe59c('0x7')],_0x18c8c3[_0xe59c('0x8')],_0x18c8c3['channel'],_0x18c8c3[_0xe59c('0x9')],_0x18c8c3['membername'],_0x18c8c3['type']));if(_0x18c8c3['interface']){utils[_0xe59c('0xa')](_0x18c8c3[_0xe59c('0x8')])[_0xe59c('0xb')](function(_0x3a069e){if(_0x3a069e){_0x18c8c3[_0xe59c('0xc')]=_0x3a069e[_0xe59c('0xd')];_0x18c8c3[_0xe59c('0xe')]=_0x3a069e[_0xe59c('0xe')];utils[_0xe59c('0xf')](_0xe59c('0x10'),_0x18c8c3);}else{utils[_0xe59c('0x11')](_0x18c8c3[_0xe59c('0x8')][_0xe59c('0x12')]('/')[0x1])[_0xe59c('0xb')](function(_0x33950e){if(_0x33950e){_0x18c8c3[_0xe59c('0xc')]=_0x33950e[_0xe59c('0xd')];_0x18c8c3[_0xe59c('0xe')]=_0x33950e['internal'];utils[_0xe59c('0xf')](_0xe59c('0x10'),_0x18c8c3);}});}})[_0xe59c('0x13')](function(_0x425e76){utils['error'](util['format'](_0xe59c('0x14'),_0x18c8c3[_0xe59c('0x7')]),_0x425e76);});}delete members[_0x18c8c3[_0xe59c('0x8')]];}function startsWith(_0x2ac2fb,_0x1528ca){return _['some'](_0x2ac2fb,function(_0xd5d315){return _['startsWith'](_0x1528ca,_0xd5d315);});}exports['devicestatechange']=function(_0xee38fc){try{utils[_0xe59c('0x15')](util['format'](_0xe59c('0x16'),members[_0xee38fc[_0xe59c('0x17')]]?members[_0xee38fc[_0xe59c('0x17')]]['uniqueid']:_0xee38fc[_0xe59c('0x17')]),_0xee38fc);utils['info'](util[_0xe59c('0x5')](_0xe59c('0x18'),members[_0xee38fc[_0xe59c('0x17')]]?members[_0xee38fc['device']][_0xe59c('0x7')]:_0xee38fc[_0xe59c('0x17')],_0xee38fc[_0xe59c('0x19')],_0xee38fc[_0xe59c('0x17')]));switch(_0xee38fc[_0xe59c('0x19')]){case _0xe59c('0x1a'):case _0xe59c('0x1b'):if(!startsWith(exclude,_0xee38fc[_0xe59c('0x17')])){members[_0xee38fc['device']]={'channel':_0xe59c('0x1c'),'interface':_0xee38fc[_0xe59c('0x17')],'type':_0xe59c('0x1d'),'enterAt':utils[_0xe59c('0x1e')](),'role':_0xe59c('0x1f')};}break;case _0xe59c('0x20'):if(!_['isNil'](members[_0xee38fc['device']])){members[_0xee38fc[_0xe59c('0x17')]][_0xe59c('0x21')]=utils['now']();members[_0xee38fc[_0xe59c('0x17')]][_0xe59c('0x22')]=utils['diffTime'](members[_0xee38fc['device']][_0xe59c('0x21')],members[_0xee38fc[_0xe59c('0x17')]][_0xe59c('0x23')]);if(members[_0xee38fc[_0xe59c('0x17')]][_0xe59c('0x7')]){writeDB(members[_0xee38fc[_0xe59c('0x17')]]);}}break;default:break;}}catch(_0x34da78){utils[_0xe59c('0x24')](util[_0xe59c('0x5')](_0xe59c('0x16'),members[_0xee38fc[_0xe59c('0x17')]]?members[_0xee38fc[_0xe59c('0x17')]][_0xe59c('0x7')]:_0xee38fc['device']),_0x34da78);}};exports[_0xe59c('0x25')]=function(_0x2a9ec3){try{if(!_[_0xe59c('0x26')](members[_0x2a9ec3[_0xe59c('0x8')]])){utils[_0xe59c('0x15')](util['format'](_0xe59c('0x27'),_0x2a9ec3[_0xe59c('0x7')]),_0x2a9ec3);utils[_0xe59c('0x4')](util[_0xe59c('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2a9ec3['uniqueid'],_0x2a9ec3['interface'],_0x2a9ec3[_0xe59c('0x28')]));members[_0x2a9ec3[_0xe59c('0x8')]]=_[_0xe59c('0x29')](members[_0x2a9ec3[_0xe59c('0x8')]],{'data4':_0x2a9ec3[_0xe59c('0x28')],'uniqueid':_0x2a9ec3[_0xe59c('0x7')]});}}catch(_0x3ac7da){utils[_0xe59c('0x24')](util[_0xe59c('0x5')](_0xe59c('0x27'),_0x2a9ec3[_0xe59c('0x7')]),_0x3ac7da);}};exports[_0xe59c('0x2a')]=function(_0x4895dc){try{utils[_0xe59c('0x15')](util[_0xe59c('0x5')](_0xe59c('0x2b'),_0x4895dc[_0xe59c('0x7')]),_0x4895dc);if(_0x4895dc[_0xe59c('0x2c')]){var _0x967b7e=_0x4895dc['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x967b7e])){members[_0x967b7e]=_[_0xe59c('0x29')](members[_0x967b7e],{'data1':members[_0x967b7e]['data1']||_0x4895dc['type'],'data2':members[_0x967b7e]['data2']||_0x4895dc[_0xe59c('0x2d')],'data3':members[_0x967b7e][_0xe59c('0x2e')]||_0x4895dc['destination'],'uniqueid':members[_0x967b7e][_0xe59c('0x7')]||_0x4895dc[_0xe59c('0x7')]});utils[_0xe59c('0x4')](util[_0xe59c('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4895dc[_0xe59c('0x7')],members[_0x967b7e][_0xe59c('0x2f')],members[_0x967b7e][_0xe59c('0x9')],members[_0x967b7e]['data3']));if(members[_0x967b7e][_0xe59c('0x21')]){writeDB(members[_0x967b7e]);}}}if(_0x4895dc['destinationchannel']){var _0x401cbd=_0x4895dc['destinationchannel']['split']('-')[0x0];if(!_[_0xe59c('0x26')](members[_0x401cbd])){members[_0x401cbd]=_[_0xe59c('0x29')](members[_0x401cbd],{'data1':members[_0x401cbd][_0xe59c('0x2f')]||_0x4895dc['type'],'data2':members[_0x401cbd][_0xe59c('0x9')]||_0x4895dc[_0xe59c('0x2d')],'data3':members[_0x401cbd][_0xe59c('0x2e')]||_0x4895dc[_0xe59c('0x30')],'uniqueid':members[_0x401cbd]['uniqueid']||_0x4895dc[_0xe59c('0x7')]});utils[_0xe59c('0x4')](util[_0xe59c('0x5')](_0xe59c('0x31'),_0x4895dc['uniqueid'],members[_0x401cbd][_0xe59c('0x2f')],members[_0x401cbd][_0xe59c('0x9')],members[_0x401cbd]['data3']));if(members[_0x401cbd][_0xe59c('0x21')]){writeDB(members[_0x401cbd]);}}}}catch(_0x389ca2){utils[_0xe59c('0x24')](util[_0xe59c('0x5')](_0xe59c('0x2b'),_0x4895dc[_0xe59c('0x7')]),_0x389ca2);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 9d8af7a..07aef8d 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 _0x9d48=['membername','assigned','destaccountcode','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfertype','BLIND','transfereeuniqueid','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','clone','transfereelinkedid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s'];(function(_0x3fec22,_0x2b4645){var _0x402df5=function(_0xd9129f){while(--_0xd9129f){_0x3fec22['push'](_0x3fec22['shift']());}};_0x402df5(++_0x2b4645);}(_0x9d48,0x1d0));var _0x89d4=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x9d48[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x89d4('0x0'));var util=require(_0x89d4('0x1'));var utils=require(_0x89d4('0x2'));var queues={};function writeDB(_0x423fbc){utils['info'](util[_0x89d4('0x3')](_0x89d4('0x4'),_0x423fbc['uniqueid'],_0x423fbc[_0x89d4('0x5')],_0x423fbc[_0x89d4('0x6')],_0x423fbc[_0x89d4('0x7')],_0x423fbc[_0x89d4('0x8')],_0x423fbc[_0x89d4('0x9')],_0x423fbc[_0x89d4('0xa')]));if(_0x423fbc[_0x89d4('0x6')]){utils[_0x89d4('0xb')](_0x423fbc[_0x89d4('0x6')])[_0x89d4('0xc')](function(_0x32a3ef){if(_0x32a3ef){_0x423fbc[_0x89d4('0xd')]=_0x32a3ef[_0x89d4('0xd')];}utils['request']('CreateVoiceQueueReport',_0x423fbc);});}else{utils[_0x89d4('0xe')](_0x89d4('0xf'),_0x423fbc);}if(_0x423fbc['transfereduniqueid']){delete queues[_0x423fbc[_0x89d4('0x10')]];}else{delete queues[_0x423fbc['uniqueid']];}}exports[_0x89d4('0x11')]=function(_0x3a30f9){try{utils[_0x89d4('0x12')](util['format'](_0x89d4('0x13'),_0x3a30f9[_0x89d4('0x14')]),_0x3a30f9);utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x16'),_0x3a30f9[_0x89d4('0x14')],_0x3a30f9[_0x89d4('0x6')],_0x3a30f9[_0x89d4('0x17')]));queues[_0x3a30f9[_0x89d4('0x14')]]=_[_0x89d4('0x18')](_0x3a30f9,{'originalposition':_0x3a30f9[_0x89d4('0x17')],'queuecallerjoinAt':utils[_0x89d4('0x19')](),'mohtime':0x0});}catch(_0x20f2ee){utils['error'](util[_0x89d4('0x3')](_0x89d4('0x13'),_0x3a30f9[_0x89d4('0x14')]),_0x20f2ee);}};exports['hangup']=function(_0x3f309f){try{if(!_[_0x89d4('0x1a')](queues[_0x3f309f[_0x89d4('0x14')]])){utils[_0x89d4('0x12')](util['format']('[%s][queues][hangup]',_0x3f309f[_0x89d4('0x14')]),_0x3f309f);if(queues[_0x3f309f['uniqueid']][_0x89d4('0x1b')]){if(!queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x1c')]&&!queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x1d')]){queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x1e')]=!![];queues[_0x3f309f[_0x89d4('0x14')]]['queuecallercompleteAt']=utils['now']();queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0xa')]=_0x89d4('0x1f');}utils[_0x89d4('0x15')](util[_0x89d4('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3f309f[_0x89d4('0x14')],queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x20')],queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0xa')]));writeDB(queues[_0x3f309f['uniqueid']]);}else if(queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x10')]){utils['info'](util[_0x89d4('0x3')](_0x89d4('0x21'),_0x3f309f['uniqueid'],queues[_0x3f309f['uniqueid']][_0x89d4('0x20')],queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x10')]));queues[queues[_0x3f309f['uniqueid']][_0x89d4('0x10')]]=queues[_0x3f309f[_0x89d4('0x14')]];queues[queues[_0x3f309f[_0x89d4('0x14')]][_0x89d4('0x10')]][_0x89d4('0x22')]=0x2;delete queues[_0x3f309f[_0x89d4('0x14')]];}}}catch(_0x53d86f){utils[_0x89d4('0x23')](util['format'](_0x89d4('0x24'),_0x3f309f['uniqueid']),_0x53d86f);}};exports[_0x89d4('0x25')]=function(_0x8444cf){try{utils[_0x89d4('0x12')](util['format'](_0x89d4('0x26'),_0x8444cf['uniqueid']),_0x8444cf);if(!_[_0x89d4('0x1a')](_0x8444cf[_0x89d4('0x27')][_0x89d4('0x28')])&&_0x8444cf[_0x89d4('0x29')]['toUpperCase']()!==_0x89d4('0x2a')){if(!_[_0x89d4('0x1a')](queues[_0x8444cf[_0x89d4('0x14')]])){queues[_0x8444cf['uniqueid']][_0x89d4('0x1c')]=![];queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x2b')]=null;queues[_0x8444cf[_0x89d4('0x14')]]['queuecallerexit']=!![];queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x2c')]=utils[_0x89d4('0x19')]();queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0xa')]=_0x8444cf[_0x89d4('0x29')][_0x89d4('0x2d')]();utils[_0x89d4('0x15')](util[_0x89d4('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x8444cf[_0x89d4('0x14')],queues[_0x8444cf['uniqueid']][_0x89d4('0x20')],_0x8444cf[_0x89d4('0x29')],queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0xa')]));writeDB(queues[_0x8444cf[_0x89d4('0x14')]]);}}else if(!_[_0x89d4('0x1a')](_0x8444cf[_0x89d4('0x27')][_0x89d4('0x2e')])){if(!_['isNil'](queues[_0x8444cf[_0x89d4('0x14')]])&&!queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x1c')]){queues[_0x8444cf['uniqueid']][_0x89d4('0x1c')]=![];queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x2b')]=null;queues[_0x8444cf[_0x89d4('0x14')]]['queuecallerexit']=!![];queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x2c')]=utils[_0x89d4('0x19')]();queues[_0x8444cf['uniqueid']]['queuecallerexitreason']=_0x89d4('0x2f');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x8444cf['uniqueid'],queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0x20')],_0x8444cf['value'],queues[_0x8444cf[_0x89d4('0x14')]][_0x89d4('0xa')]));}}}catch(_0x322bf5){utils['error'](util[_0x89d4('0x3')](_0x89d4('0x26'),_0x8444cf[_0x89d4('0x14')]),_0x322bf5);}};exports[_0x89d4('0x1c')]=function(_0x535fa3){try{if(!_[_0x89d4('0x1a')](queues[_0x535fa3['uniqueid']])){utils[_0x89d4('0x12')](util[_0x89d4('0x3')](_0x89d4('0x30'),_0x535fa3['uniqueid']),_0x535fa3);queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0x1d')]=![];queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0x2c')]=null;queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0x1c')]=!![];queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0x2b')]=utils[_0x89d4('0x19')]();queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0xa')]=_0x89d4('0x31');utils['info'](util[_0x89d4('0x3')](_0x89d4('0x32'),_0x535fa3[_0x89d4('0x14')],queues[_0x535fa3[_0x89d4('0x14')]][_0x89d4('0x20')],queues[_0x535fa3['uniqueid']]['queuecallerexitreason']));}}catch(_0x57acab){utils[_0x89d4('0x23')](util[_0x89d4('0x3')]('[%s][queues][queuecallerabandon]',_0x535fa3['uniqueid']),_0x57acab);}};exports[_0x89d4('0x33')]=function(_0x284850){try{if(!_[_0x89d4('0x1a')](queues[_0x284850[_0x89d4('0x14')]])){utils[_0x89d4('0x12')](util['format'](_0x89d4('0x34'),_0x284850['uniqueid']),_0x284850);utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x35'),_0x284850[_0x89d4('0x14')],queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x20')],_0x284850[_0x89d4('0x36')],_0x284850[_0x89d4('0x37')]));queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x33')]=!![];queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x1b')]=utils[_0x89d4('0x19')]();queues[_0x284850[_0x89d4('0x14')]]['holdtime']=utils[_0x89d4('0x38')](queues[_0x284850['uniqueid']]['queuecallerleaveAt'],queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x39')]);queues[_0x284850[_0x89d4('0x14')]]['position']=_0x284850[_0x89d4('0x17')];queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x3a')]=_0x284850[_0x89d4('0x3a')];queues[_0x284850[_0x89d4('0x14')]][_0x89d4('0x36')]=_0x284850[_0x89d4('0x36')];queues[_0x284850['uniqueid']][_0x89d4('0x37')]=_0x284850[_0x89d4('0x37')];}}catch(_0x5087c2){utils[_0x89d4('0x23')](util['format'](_0x89d4('0x34'),_0x284850[_0x89d4('0x14')]),_0x5087c2);}};exports['agentconnect']=function(_0x48566a){try{if(!_[_0x89d4('0x1a')](queues[_0x48566a[_0x89d4('0x14')]])){utils[_0x89d4('0x12')](util[_0x89d4('0x3')](_0x89d4('0x3b'),_0x48566a[_0x89d4('0x14')]),_0x48566a);utils[_0x89d4('0x15')](util['format'](_0x89d4('0x3c'),_0x48566a['uniqueid'],queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x20')],_0x48566a[_0x89d4('0x3d')],_0x48566a['destaccountcode']));queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x1c')]=![];queues[_0x48566a['uniqueid']]['queuecallerabandon']=![];queues[_0x48566a['uniqueid']][_0x89d4('0x2b')]=null;queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x1d')]=![];queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0xa')]=null;queues[_0x48566a[_0x89d4('0x14')]]['queuecallerexitAt']=null;queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x3e')]=!![];queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x9')]=_0x48566a[_0x89d4('0x3f')];queues[_0x48566a[_0x89d4('0x14')]][_0x89d4('0x7')]=_0x48566a[_0x89d4('0x3d')];}}catch(_0x290a17){utils[_0x89d4('0x23')](util[_0x89d4('0x3')](_0x89d4('0x3b'),_0x48566a[_0x89d4('0x14')]),_0x290a17);}};exports[_0x89d4('0x40')]=function(_0x2b5ea8){try{if(!_['isNil'](queues[_0x2b5ea8[_0x89d4('0x14')]])){if(queues[_0x2b5ea8[_0x89d4('0x14')]][_0x89d4('0x1b')]){utils[_0x89d4('0x12')](util[_0x89d4('0x3')]('[%s][queues][agentcomplete]',_0x2b5ea8['uniqueid']),_0x2b5ea8);queues[_0x2b5ea8['uniqueid']][_0x89d4('0x1c')]=![];queues[_0x2b5ea8[_0x89d4('0x14')]]['queuecallerabandon']=![];queues[_0x2b5ea8[_0x89d4('0x14')]]['queuecallerabandonAt']=null;queues[_0x2b5ea8['uniqueid']][_0x89d4('0x1d')]=![];queues[_0x2b5ea8[_0x89d4('0x14')]]['queuecallerexitAt']=null;queues[_0x2b5ea8['uniqueid']]['assigned']=!![];queues[_0x2b5ea8[_0x89d4('0x14')]]['lastAssignedTo']=_0x2b5ea8[_0x89d4('0x3d')];queues[_0x2b5ea8[_0x89d4('0x14')]]['queuecallercomplete']=!![];queues[_0x2b5ea8['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x2b5ea8[_0x89d4('0x41')]=='transfer'){if(!queues[_0x2b5ea8[_0x89d4('0x14')]][_0x89d4('0x42')]){queues[_0x2b5ea8['uniqueid']]['queuecallerexitreason']=_0x89d4('0x43');}}else{queues[_0x2b5ea8[_0x89d4('0x14')]][_0x89d4('0xa')]=_0x89d4('0x44')+_0x2b5ea8[_0x89d4('0x41')][_0x89d4('0x2d')]();}utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x45'),_0x2b5ea8[_0x89d4('0x14')],queues[_0x2b5ea8[_0x89d4('0x14')]][_0x89d4('0x20')],_0x2b5ea8['membername'],queues[_0x2b5ea8[_0x89d4('0x14')]][_0x89d4('0xa')]));writeDB(queues[_0x2b5ea8['uniqueid']]);}}}catch(_0x568e77){utils[_0x89d4('0x23')](util[_0x89d4('0x3')](_0x89d4('0x46'),_0x2b5ea8[_0x89d4('0x14')]),_0x568e77);}};exports[_0x89d4('0x47')]=function(_0x2fb878){try{if(!_[_0x89d4('0x1a')](queues[_0x2fb878['transfereeuniqueid']])){utils[_0x89d4('0x12')](util['format']('[%s][queues][blindtransfer]',_0x2fb878[_0x89d4('0x14')]),_0x2fb878);queues[_0x2fb878['transfereeuniqueid']][_0x89d4('0x42')]=!![];queues[_0x2fb878['transfereeuniqueid']][_0x89d4('0x48')]=_0x89d4('0x49');queues[_0x2fb878[_0x89d4('0x4a')]][_0x89d4('0x4b')]=_0x2fb878[_0x89d4('0x4c')];queues[_0x2fb878['transfereeuniqueid']]['transferuniqueid']=_0x2fb878[_0x89d4('0x4a')];queues[_0x2fb878[_0x89d4('0x4a')]]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util['format'](_0x89d4('0x4d'),_0x2fb878[_0x89d4('0x14')],queues[_0x2fb878[_0x89d4('0x4a')]][_0x89d4('0x20')],_0x2fb878['transfereeuniqueid'],_0x2fb878[_0x89d4('0x4c')]));}}catch(_0x27e1d2){utils[_0x89d4('0x23')](util[_0x89d4('0x3')]('[%s][queues][blindtransfer]',_0x2fb878[_0x89d4('0x14')]),_0x27e1d2);}};exports[_0x89d4('0x4e')]=function(_0x1595d2){try{utils['debug'](util[_0x89d4('0x3')]('[%s][queues][attendedtransfer]',_0x1595d2[_0x89d4('0x4f')]),_0x1595d2);if(_0x1595d2['origtransfereruniqueid']==_0x1595d2['origtransfererlinkedid']){if(!_[_0x89d4('0x1a')](queues[_0x1595d2[_0x89d4('0x50')]])){utils[_0x89d4('0x15')](util['format'](_0x89d4('0x51'),_0x1595d2[_0x89d4('0x4f')],queues[_0x1595d2[_0x89d4('0x50')]]['name'],_0x1595d2[_0x89d4('0x52')]));queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x42')]=!![];queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x48')]=_0x89d4('0x53');queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x4b')]=_0x1595d2[_0x89d4('0x52')];queues[_0x1595d2['secondtransfererlinkedid']][_0x89d4('0x54')]=_0x1595d2[_0x89d4('0x4f')];queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0xa')]=_0x89d4('0x55');}if(!_[_0x89d4('0x1a')](queues[_0x1595d2[_0x89d4('0x56')]])){if(_0x1595d2['transfereelinkedid']&&queues[_0x1595d2['transfereelinkedid']]){queues[_0x1595d2['transfereelinkedid']][_0x89d4('0x22')]=0x1;queues[_0x1595d2['transfereeuniqueid']]=_[_0x89d4('0x57')](queues[_0x1595d2[_0x89d4('0x58')]]);queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x10')]=_0x1595d2['transfertargetuniqueid'];queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x22')]=0x2;queues[_0x1595d2['transfereeuniqueid']][_0x89d4('0x8')]=queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x8')];queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x59')]=queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x59')];queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x39')]=utils[_0x89d4('0x19')]();queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x1b')]=utils[_0x89d4('0x19')]();queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x5a')]=0x0;queues[_0x1595d2[_0x89d4('0x4a')]]['mohtime']=0x0;utils[_0x89d4('0x15')](util[_0x89d4('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1595d2['origtransfereruniqueid'],queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x20')],queues[_0x1595d2[_0x89d4('0x4a')]]['calleridnum'],queues[_0x1595d2[_0x89d4('0x4a')]][_0x89d4('0x59')]));}else{utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x5b'),_0x1595d2['origtransfereruniqueid'],queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x20')],_0x1595d2[_0x89d4('0x50')]));queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x10')]=_0x1595d2[_0x89d4('0x50')];}}}else if(_0x1595d2[_0x89d4('0x5c')]==_0x1595d2[_0x89d4('0x50')]){if(!_['isNil'](queues[_0x1595d2[_0x89d4('0x56')]])){utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x5d'),_0x1595d2[_0x89d4('0x4f')],queues[_0x1595d2['origtransfererlinkedid']][_0x89d4('0x20')],_0x1595d2['secondtransfereruniqueid'],_0x1595d2[_0x89d4('0x5e')]));queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x42')]=!![];queues[_0x1595d2['origtransfererlinkedid']][_0x89d4('0x48')]=_0x89d4('0x53');queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x4b')]=_0x1595d2['secondtransfererexten'];queues[_0x1595d2['origtransfererlinkedid']]['transferuniqueid']=_0x1595d2[_0x89d4('0x5c')];queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0xa')]=_0x89d4('0x55');}if(!_[_0x89d4('0x1a')](queues[_0x1595d2['secondtransfererlinkedid']])){if(_0x1595d2[_0x89d4('0x5f')]&&queues[_0x1595d2[_0x89d4('0x5f')]]){queues[_0x1595d2[_0x89d4('0x5f')]][_0x89d4('0x22')]=0x1;queues[_0x1595d2[_0x89d4('0x60')]]=_[_0x89d4('0x57')](queues[_0x1595d2[_0x89d4('0x5f')]]);queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x10')]=_0x1595d2[_0x89d4('0x60')];queues[_0x1595d2['transfertargetuniqueid']][_0x89d4('0x22')]=0x2;queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x8')]=queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x8')];queues[_0x1595d2[_0x89d4('0x60')]]['calleridname']=queues[_0x1595d2[_0x89d4('0x56')]][_0x89d4('0x59')];queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x39')]=utils['now']();queues[_0x1595d2['transfertargetuniqueid']][_0x89d4('0x1b')]=utils['now']();queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x5a')]=0x0;queues[_0x1595d2[_0x89d4('0x60')]]['mohtime']=0x0;utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x61'),_0x1595d2[_0x89d4('0x4f')],queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x20')],queues[_0x1595d2[_0x89d4('0x60')]][_0x89d4('0x10')],queues[_0x1595d2['transfertargetuniqueid']]['calleridnum'],queues[_0x1595d2[_0x89d4('0x60')]]['calleridname']));}else{utils[_0x89d4('0x15')](util[_0x89d4('0x3')](_0x89d4('0x5b'),_0x1595d2[_0x89d4('0x4f')],queues[_0x1595d2[_0x89d4('0x50')]][_0x89d4('0x20')],_0x1595d2[_0x89d4('0x56')]));queues[_0x1595d2['secondtransfererlinkedid']]['transfereduniqueid']=_0x1595d2[_0x89d4('0x56')];}}}}catch(_0x598585){utils[_0x89d4('0x23')](util['format']('[%s][queues][attendedtransfer]',_0x1595d2['origtransfereruniqueid']),_0x598585);}};exports['musiconholdstart']=function(_0x5aa8b6){try{if(!_[_0x89d4('0x1a')](queues[_0x5aa8b6[_0x89d4('0x14')]])){utils[_0x89d4('0x12')](util[_0x89d4('0x3')](_0x89d4('0x62'),_0x5aa8b6[_0x89d4('0x14')]),_0x5aa8b6);queues[_0x5aa8b6[_0x89d4('0x14')]][_0x89d4('0x63')]=utils[_0x89d4('0x19')]();utils['info'](util[_0x89d4('0x3')](_0x89d4('0x64'),_0x5aa8b6[_0x89d4('0x14')],queues[_0x5aa8b6[_0x89d4('0x14')]][_0x89d4('0x20')],queues[_0x5aa8b6[_0x89d4('0x14')]][_0x89d4('0x63')]));}}catch(_0x3db85b){utils[_0x89d4('0x23')](util['format'](_0x89d4('0x62'),_0x5aa8b6['uniqueid']),_0x3db85b);}};exports[_0x89d4('0x65')]=function(_0x2d84e7){try{if(!_[_0x89d4('0x1a')](queues[_0x2d84e7[_0x89d4('0x14')]])){if(!_[_0x89d4('0x1a')](queues[_0x2d84e7[_0x89d4('0x14')]][_0x89d4('0x63')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x2d84e7[_0x89d4('0x14')]),_0x2d84e7);queues[_0x2d84e7[_0x89d4('0x14')]][_0x89d4('0x66')]+=utils[_0x89d4('0x38')](utils[_0x89d4('0x19')](),queues[_0x2d84e7['uniqueid']][_0x89d4('0x63')]);utils['info'](util[_0x89d4('0x3')](_0x89d4('0x67'),_0x2d84e7['uniqueid'],queues[_0x2d84e7[_0x89d4('0x14')]][_0x89d4('0x20')],queues[_0x2d84e7[_0x89d4('0x14')]]['mohtime']));delete queues[_0x2d84e7[_0x89d4('0x14')]][_0x89d4('0x63')];}}}catch(_0x361fad){utils[_0x89d4('0x23')](util['format'](_0x89d4('0x68'),_0x2d84e7[_0x89d4('0x14')]),_0x361fad);}}; \ No newline at end of file +var _0xb03d=['transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','queuestatus','toUpperCase','queuecallerabandonAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%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]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER'];(function(_0x49b19e,_0xf8059f){var _0x5745ce=function(_0xa410e7){while(--_0xa410e7){_0x49b19e['push'](_0x49b19e['shift']());}};_0x5745ce(++_0xf8059f);}(_0xb03d,0xe8));var _0xdb03=function(_0x5b59ce,_0x4e8c3b){_0x5b59ce=_0x5b59ce-0x0;var _0x1fb47c=_0xb03d[_0x5b59ce];return _0x1fb47c;};'use strict';var _=require(_0xdb03('0x0'));var util=require(_0xdb03('0x1'));var utils=require(_0xdb03('0x2'));var queues={};function writeDB(_0x123e8c){utils['info'](util[_0xdb03('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x123e8c[_0xdb03('0x4')],_0x123e8c['channel'],_0x123e8c['queue'],_0x123e8c[_0xdb03('0x5')],_0x123e8c[_0xdb03('0x6')],_0x123e8c[_0xdb03('0x7')],_0x123e8c[_0xdb03('0x8')]));if(_0x123e8c[_0xdb03('0x9')]){utils[_0xdb03('0xa')](_0x123e8c[_0xdb03('0x9')])[_0xdb03('0xb')](function(_0x3e662e){if(_0x3e662e){_0x123e8c[_0xdb03('0xc')]=_0x3e662e['type'];}utils[_0xdb03('0xd')](_0xdb03('0xe'),_0x123e8c);});}else{utils['request'](_0xdb03('0xe'),_0x123e8c);}if(_0x123e8c[_0xdb03('0xf')]){delete queues[_0x123e8c[_0xdb03('0xf')]];}else{delete queues[_0x123e8c[_0xdb03('0x4')]];}}exports['queuecallerjoin']=function(_0x1fad45){try{utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x11'),_0x1fad45[_0xdb03('0x4')]),_0x1fad45);utils['info'](util[_0xdb03('0x3')](_0xdb03('0x12'),_0x1fad45[_0xdb03('0x4')],_0x1fad45['queue'],_0x1fad45[_0xdb03('0x13')]));queues[_0x1fad45['uniqueid']]=_[_0xdb03('0x14')](_0x1fad45,{'originalposition':_0x1fad45[_0xdb03('0x13')],'queuecallerjoinAt':utils[_0xdb03('0x15')](),'mohtime':0x0});}catch(_0x572034){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x11'),_0x1fad45[_0xdb03('0x4')]),_0x572034);}};exports[_0xdb03('0x17')]=function(_0x56e8b8){try{if(!_[_0xdb03('0x18')](queues[_0x56e8b8['uniqueid']])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')]('[%s][queues][hangup]',_0x56e8b8[_0xdb03('0x4')]),_0x56e8b8);if(queues[_0x56e8b8[_0xdb03('0x4')]][_0xdb03('0x19')]){if(!queues[_0x56e8b8[_0xdb03('0x4')]][_0xdb03('0x1a')]&&!queues[_0x56e8b8['uniqueid']][_0xdb03('0x1b')]){queues[_0x56e8b8[_0xdb03('0x4')]][_0xdb03('0x1c')]=!![];queues[_0x56e8b8[_0xdb03('0x4')]]['queuecallercompleteAt']=utils['now']();queues[_0x56e8b8['uniqueid']][_0xdb03('0x8')]=_0xdb03('0x1d');}utils['info'](util[_0xdb03('0x3')](_0xdb03('0x1e'),_0x56e8b8['uniqueid'],queues[_0x56e8b8[_0xdb03('0x4')]]['name'],queues[_0x56e8b8[_0xdb03('0x4')]][_0xdb03('0x8')]));writeDB(queues[_0x56e8b8[_0xdb03('0x4')]]);}else if(queues[_0x56e8b8['uniqueid']][_0xdb03('0xf')]){utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x20'),_0x56e8b8['uniqueid'],queues[_0x56e8b8[_0xdb03('0x4')]]['name'],queues[_0x56e8b8[_0xdb03('0x4')]]['transfereduniqueid']));queues[queues[_0x56e8b8[_0xdb03('0x4')]][_0xdb03('0xf')]]=queues[_0x56e8b8[_0xdb03('0x4')]];queues[queues[_0x56e8b8[_0xdb03('0x4')]]['transfereduniqueid']][_0xdb03('0x21')]=0x2;delete queues[_0x56e8b8[_0xdb03('0x4')]];}}}catch(_0xc4e09c){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x22'),_0x56e8b8[_0xdb03('0x4')]),_0xc4e09c);}};exports['varset']=function(_0x11604a){try{utils['debug'](util[_0xdb03('0x3')](_0xdb03('0x23'),_0x11604a[_0xdb03('0x4')]),_0x11604a);if(!_['isNil'](_0x11604a['variable'][_0xdb03('0x24')])&&_0x11604a['value'][_0xdb03('0x25')]()!=='CONTINUE'){if(!_[_0xdb03('0x18')](queues[_0x11604a['uniqueid']])){queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x1a')]=![];queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x26')]=null;queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x1b')]=!![];queues[_0x11604a['uniqueid']]['queuecallerexitAt']=utils[_0xdb03('0x15')]();queues[_0x11604a[_0xdb03('0x4')]]['queuecallerexitreason']=_0x11604a[_0xdb03('0x27')][_0xdb03('0x25')]();utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x28'),_0x11604a['uniqueid'],queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x29')],_0x11604a[_0xdb03('0x27')],queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x8')]));writeDB(queues[_0x11604a[_0xdb03('0x4')]]);}}else if(!_[_0xdb03('0x18')](_0x11604a[_0xdb03('0x2a')][_0xdb03('0x2b')])){if(!_[_0xdb03('0x18')](queues[_0x11604a[_0xdb03('0x4')]])&&!queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x1a')]){queues[_0x11604a[_0xdb03('0x4')]]['queuecallerabandon']=![];queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x26')]=null;queues[_0x11604a['uniqueid']][_0xdb03('0x1b')]=!![];queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x2c')]=utils['now']();queues[_0x11604a[_0xdb03('0x4')]][_0xdb03('0x8')]=_0xdb03('0x2d');utils['info'](util['format'](_0xdb03('0x2e'),_0x11604a[_0xdb03('0x4')],queues[_0x11604a[_0xdb03('0x4')]]['name'],_0x11604a[_0xdb03('0x27')],queues[_0x11604a[_0xdb03('0x4')]]['queuecallerexitreason']));}}}catch(_0x39aa36){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x23'),_0x11604a['uniqueid']),_0x39aa36);}};exports['queuecallerabandon']=function(_0x1687b1){try{if(!_[_0xdb03('0x18')](queues[_0x1687b1[_0xdb03('0x4')]])){utils[_0xdb03('0x10')](util['format'](_0xdb03('0x2f'),_0x1687b1['uniqueid']),_0x1687b1);queues[_0x1687b1[_0xdb03('0x4')]][_0xdb03('0x1b')]=![];queues[_0x1687b1[_0xdb03('0x4')]][_0xdb03('0x2c')]=null;queues[_0x1687b1['uniqueid']][_0xdb03('0x1a')]=!![];queues[_0x1687b1[_0xdb03('0x4')]][_0xdb03('0x26')]=utils[_0xdb03('0x15')]();queues[_0x1687b1['uniqueid']]['queuecallerexitreason']=_0xdb03('0x30');utils['info'](util['format'](_0xdb03('0x31'),_0x1687b1['uniqueid'],queues[_0x1687b1[_0xdb03('0x4')]][_0xdb03('0x29')],queues[_0x1687b1[_0xdb03('0x4')]]['queuecallerexitreason']));}}catch(_0x44a6ee){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x2f'),_0x1687b1[_0xdb03('0x4')]),_0x44a6ee);}};exports[_0xdb03('0x32')]=function(_0x5af5bf){try{if(!_[_0xdb03('0x18')](queues[_0x5af5bf[_0xdb03('0x4')]])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x33'),_0x5af5bf[_0xdb03('0x4')]),_0x5af5bf);utils[_0xdb03('0x1f')](util['format'](_0xdb03('0x34'),_0x5af5bf[_0xdb03('0x4')],queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x29')],_0x5af5bf[_0xdb03('0x35')],_0x5af5bf['connectedlinename']));queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x32')]=!![];queues[_0x5af5bf[_0xdb03('0x4')]]['queuecallerleaveAt']=utils[_0xdb03('0x15')]();queues[_0x5af5bf[_0xdb03('0x4')]]['holdtime']=utils[_0xdb03('0x36')](queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x19')],queues[_0x5af5bf[_0xdb03('0x4')]]['queuecallerjoinAt']);queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x13')]=_0x5af5bf[_0xdb03('0x13')];queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x37')]=_0x5af5bf[_0xdb03('0x37')];queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x35')]=_0x5af5bf[_0xdb03('0x35')];queues[_0x5af5bf[_0xdb03('0x4')]][_0xdb03('0x38')]=_0x5af5bf[_0xdb03('0x38')];}}catch(_0x13a5a9){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x33'),_0x5af5bf[_0xdb03('0x4')]),_0x13a5a9);}};exports[_0xdb03('0x39')]=function(_0x3837ec){try{if(!_[_0xdb03('0x18')](queues[_0x3837ec[_0xdb03('0x4')]])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x3a'),_0x3837ec['uniqueid']),_0x3837ec);utils['info'](util[_0xdb03('0x3')](_0xdb03('0x3b'),_0x3837ec[_0xdb03('0x4')],queues[_0x3837ec[_0xdb03('0x4')]][_0xdb03('0x29')],_0x3837ec['membername'],_0x3837ec[_0xdb03('0x3c')]));queues[_0x3837ec[_0xdb03('0x4')]][_0xdb03('0x1a')]=![];queues[_0x3837ec['uniqueid']][_0xdb03('0x1a')]=![];queues[_0x3837ec[_0xdb03('0x4')]][_0xdb03('0x26')]=null;queues[_0x3837ec[_0xdb03('0x4')]][_0xdb03('0x1b')]=![];queues[_0x3837ec[_0xdb03('0x4')]]['queuecallerexitreason']=null;queues[_0x3837ec['uniqueid']][_0xdb03('0x2c')]=null;queues[_0x3837ec['uniqueid']]['assigned']=!![];queues[_0x3837ec['uniqueid']][_0xdb03('0x7')]=_0x3837ec[_0xdb03('0x3c')];queues[_0x3837ec[_0xdb03('0x4')]]['lastAssignedTo']=_0x3837ec[_0xdb03('0x3d')];}}catch(_0x450054){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x3a'),_0x3837ec[_0xdb03('0x4')]),_0x450054);}};exports[_0xdb03('0x3e')]=function(_0x25cbc3){try{if(!_[_0xdb03('0x18')](queues[_0x25cbc3['uniqueid']])){if(queues[_0x25cbc3['uniqueid']]['queuecallerleaveAt']){utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x3f'),_0x25cbc3[_0xdb03('0x4')]),_0x25cbc3);queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x1a')]=![];queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x1a')]=![];queues[_0x25cbc3[_0xdb03('0x4')]]['queuecallerabandonAt']=null;queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x1b')]=![];queues[_0x25cbc3[_0xdb03('0x4')]]['queuecallerexitAt']=null;queues[_0x25cbc3['uniqueid']][_0xdb03('0x40')]=!![];queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x5')]=_0x25cbc3[_0xdb03('0x3d')];queues[_0x25cbc3['uniqueid']][_0xdb03('0x1c')]=!![];queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x41')]=utils[_0xdb03('0x15')]();if(_0x25cbc3[_0xdb03('0x42')]==_0xdb03('0x43')){if(!queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x43')]){queues[_0x25cbc3[_0xdb03('0x4')]]['queuecallerexitreason']=_0xdb03('0x44');}}else{queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x8')]='COMPLETEDBY'+_0x25cbc3['reason'][_0xdb03('0x25')]();}utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x45'),_0x25cbc3[_0xdb03('0x4')],queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x29')],_0x25cbc3[_0xdb03('0x3d')],queues[_0x25cbc3[_0xdb03('0x4')]][_0xdb03('0x8')]));writeDB(queues[_0x25cbc3[_0xdb03('0x4')]]);}}}catch(_0x270f54){utils['error'](util[_0xdb03('0x3')](_0xdb03('0x3f'),_0x25cbc3[_0xdb03('0x4')]),_0x270f54);}};exports['blindtransfer']=function(_0x1426b1){try{if(!_[_0xdb03('0x18')](queues[_0x1426b1[_0xdb03('0x46')]])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')]('[%s][queues][blindtransfer]',_0x1426b1[_0xdb03('0x4')]),_0x1426b1);queues[_0x1426b1[_0xdb03('0x46')]][_0xdb03('0x43')]=!![];queues[_0x1426b1[_0xdb03('0x46')]][_0xdb03('0x47')]='BLIND';queues[_0x1426b1[_0xdb03('0x46')]][_0xdb03('0x48')]=_0x1426b1[_0xdb03('0x49')];queues[_0x1426b1[_0xdb03('0x46')]][_0xdb03('0x4a')]=_0x1426b1[_0xdb03('0x46')];queues[_0x1426b1['transfereeuniqueid']][_0xdb03('0x8')]=_0xdb03('0x4b');utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x4c'),_0x1426b1[_0xdb03('0x4')],queues[_0x1426b1['transfereeuniqueid']]['name'],_0x1426b1[_0xdb03('0x46')],_0x1426b1[_0xdb03('0x49')]));}}catch(_0x4ac687){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x4d'),_0x1426b1['uniqueid']),_0x4ac687);}};exports[_0xdb03('0x4e')]=function(_0x2ce279){try{utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x4f'),_0x2ce279[_0xdb03('0x50')]),_0x2ce279);if(_0x2ce279[_0xdb03('0x50')]==_0x2ce279[_0xdb03('0x51')]){if(!_[_0xdb03('0x18')](queues[_0x2ce279[_0xdb03('0x52')]])){utils['info'](util[_0xdb03('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2ce279['origtransfereruniqueid'],queues[_0x2ce279['secondtransfererlinkedid']][_0xdb03('0x29')],_0x2ce279[_0xdb03('0x53')]));queues[_0x2ce279[_0xdb03('0x52')]][_0xdb03('0x43')]=!![];queues[_0x2ce279[_0xdb03('0x52')]]['transfertype']=_0xdb03('0x54');queues[_0x2ce279['secondtransfererlinkedid']]['transferexten']=_0x2ce279[_0xdb03('0x53')];queues[_0x2ce279[_0xdb03('0x52')]]['transferuniqueid']=_0x2ce279[_0xdb03('0x50')];queues[_0x2ce279[_0xdb03('0x52')]][_0xdb03('0x8')]=_0xdb03('0x55');}if(!_[_0xdb03('0x18')](queues[_0x2ce279[_0xdb03('0x51')]])){if(_0x2ce279[_0xdb03('0x56')]&&queues[_0x2ce279[_0xdb03('0x56')]]){queues[_0x2ce279[_0xdb03('0x56')]][_0xdb03('0x21')]=0x1;queues[_0x2ce279[_0xdb03('0x46')]]=_[_0xdb03('0x57')](queues[_0x2ce279[_0xdb03('0x56')]]);queues[_0x2ce279[_0xdb03('0x46')]]['transfereduniqueid']=_0x2ce279[_0xdb03('0x58')];queues[_0x2ce279[_0xdb03('0x46')]][_0xdb03('0x21')]=0x2;queues[_0x2ce279[_0xdb03('0x46')]][_0xdb03('0x6')]=queues[_0x2ce279[_0xdb03('0x52')]][_0xdb03('0x6')];queues[_0x2ce279['transfereeuniqueid']][_0xdb03('0x59')]=queues[_0x2ce279[_0xdb03('0x52')]][_0xdb03('0x59')];queues[_0x2ce279[_0xdb03('0x46')]][_0xdb03('0x5a')]=utils['now']();queues[_0x2ce279[_0xdb03('0x46')]]['queuecallerleaveAt']=utils[_0xdb03('0x15')]();queues[_0x2ce279[_0xdb03('0x46')]][_0xdb03('0x5b')]=0x0;queues[_0x2ce279[_0xdb03('0x46')]][_0xdb03('0x5c')]=0x0;utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x5d'),_0x2ce279[_0xdb03('0x50')],queues[_0x2ce279['transfereeuniqueid']]['name'],queues[_0x2ce279[_0xdb03('0x46')]]['calleridnum'],queues[_0x2ce279[_0xdb03('0x46')]]['calleridname']));}else{utils['info'](util['format'](_0xdb03('0x5e'),_0x2ce279[_0xdb03('0x50')],queues[_0x2ce279[_0xdb03('0x51')]]['name'],_0x2ce279['secondtransfererlinkedid']));queues[_0x2ce279[_0xdb03('0x51')]][_0xdb03('0xf')]=_0x2ce279[_0xdb03('0x52')];}}}else if(_0x2ce279[_0xdb03('0x5f')]==_0x2ce279[_0xdb03('0x52')]){if(!_[_0xdb03('0x18')](queues[_0x2ce279[_0xdb03('0x51')]])){utils['info'](util[_0xdb03('0x3')](_0xdb03('0x60'),_0x2ce279[_0xdb03('0x50')],queues[_0x2ce279[_0xdb03('0x51')]]['name'],_0x2ce279[_0xdb03('0x5f')],_0x2ce279[_0xdb03('0x61')]));queues[_0x2ce279[_0xdb03('0x51')]]['transfer']=!![];queues[_0x2ce279[_0xdb03('0x51')]]['transfertype']=_0xdb03('0x54');queues[_0x2ce279[_0xdb03('0x51')]]['transferexten']=_0x2ce279['secondtransfererexten'];queues[_0x2ce279[_0xdb03('0x51')]][_0xdb03('0x4a')]=_0x2ce279[_0xdb03('0x5f')];queues[_0x2ce279[_0xdb03('0x51')]][_0xdb03('0x8')]=_0xdb03('0x55');}if(!_[_0xdb03('0x18')](queues[_0x2ce279[_0xdb03('0x52')]])){if(_0x2ce279[_0xdb03('0x62')]&&queues[_0x2ce279['transfertargetlinkedid']]){queues[_0x2ce279[_0xdb03('0x62')]]['queuecallerenterreason']=0x1;queues[_0x2ce279[_0xdb03('0x58')]]=_[_0xdb03('0x57')](queues[_0x2ce279[_0xdb03('0x62')]]);queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0xf')]=_0x2ce279['transfertargetuniqueid'];queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x21')]=0x2;queues[_0x2ce279['transfertargetuniqueid']][_0xdb03('0x6')]=queues[_0x2ce279[_0xdb03('0x51')]][_0xdb03('0x6')];queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x59')]=queues[_0x2ce279['origtransfererlinkedid']]['calleridname'];queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x5a')]=utils[_0xdb03('0x15')]();queues[_0x2ce279['transfertargetuniqueid']][_0xdb03('0x19')]=utils[_0xdb03('0x15')]();queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x5b')]=0x0;queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x5c')]=0x0;utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x63'),_0x2ce279[_0xdb03('0x50')],queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x29')],queues[_0x2ce279['transfertargetuniqueid']][_0xdb03('0xf')],queues[_0x2ce279['transfertargetuniqueid']]['calleridnum'],queues[_0x2ce279[_0xdb03('0x58')]][_0xdb03('0x59')]));}else{utils[_0xdb03('0x1f')](util[_0xdb03('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2ce279[_0xdb03('0x50')],queues[_0x2ce279[_0xdb03('0x52')]][_0xdb03('0x29')],_0x2ce279[_0xdb03('0x51')]));queues[_0x2ce279['secondtransfererlinkedid']]['transfereduniqueid']=_0x2ce279[_0xdb03('0x51')];}}}}catch(_0x3d579f){utils['error'](util['format'](_0xdb03('0x4f'),_0x2ce279['origtransfereruniqueid']),_0x3d579f);}};exports[_0xdb03('0x64')]=function(_0x8448f2){try{if(!_['isNil'](queues[_0x8448f2[_0xdb03('0x4')]])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')]('[%s][queues][musiconholdstart]',_0x8448f2['uniqueid']),_0x8448f2);queues[_0x8448f2[_0xdb03('0x4')]][_0xdb03('0x65')]=utils['now']();utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x66'),_0x8448f2[_0xdb03('0x4')],queues[_0x8448f2[_0xdb03('0x4')]]['name'],queues[_0x8448f2[_0xdb03('0x4')]][_0xdb03('0x65')]));}}catch(_0x21d240){utils[_0xdb03('0x16')](util[_0xdb03('0x3')]('[%s][queues][musiconholdstart]',_0x8448f2[_0xdb03('0x4')]),_0x21d240);}};exports[_0xdb03('0x67')]=function(_0x3a114f){try{if(!_[_0xdb03('0x18')](queues[_0x3a114f['uniqueid']])){if(!_[_0xdb03('0x18')](queues[_0x3a114f[_0xdb03('0x4')]][_0xdb03('0x65')])){utils[_0xdb03('0x10')](util[_0xdb03('0x3')](_0xdb03('0x68'),_0x3a114f[_0xdb03('0x4')]),_0x3a114f);queues[_0x3a114f['uniqueid']][_0xdb03('0x5c')]+=utils[_0xdb03('0x36')](utils['now'](),queues[_0x3a114f[_0xdb03('0x4')]]['musiconholdstartAt']);utils[_0xdb03('0x1f')](util[_0xdb03('0x3')](_0xdb03('0x69'),_0x3a114f[_0xdb03('0x4')],queues[_0x3a114f[_0xdb03('0x4')]][_0xdb03('0x29')],queues[_0x3a114f['uniqueid']][_0xdb03('0x5c')]));delete queues[_0x3a114f[_0xdb03('0x4')]][_0xdb03('0x65')];}}}catch(_0x2fc0b2){utils[_0xdb03('0x16')](util[_0xdb03('0x3')](_0xdb03('0x68'),_0x3a114f[_0xdb03('0x4')]),_0x2fc0b2);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0601425..af572ae 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 _0xd684=['channelstate','transfer','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinename','type','connectedlinenum','monitors','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','info','format','accountcode','getUserByInternal','UserId','request','CreateVoiceRecording','newchannel','debug','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','[%s][recordings][newchannel]','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid'];(function(_0x53c095,_0x43b498){var _0x359e11=function(_0x150942){while(--_0x150942){_0x53c095['push'](_0x53c095['shift']());}};_0x359e11(++_0x43b498);}(_0xd684,0x14c));var _0x4d68=function(_0x144616,_0x1188de){_0x144616=_0x144616-0x0;var _0x100e2f=_0xd684[_0x144616];return _0x100e2f;};'use strict';var _=require(_0x4d68('0x0'));var util=require(_0x4d68('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x434dbd){utils[_0x4d68('0x2')](util[_0x4d68('0x3')]('[%s][recordings][writeDB]',_0x434dbd['uniqueid']));if(_0x434dbd[_0x4d68('0x4')]){utils[_0x4d68('0x5')](_0x434dbd[_0x4d68('0x4')])['then'](function(_0x141009){if(_0x141009){_0x434dbd['membername']=_0x141009['name'];_0x434dbd[_0x4d68('0x6')]=_0x141009['id'];}utils[_0x4d68('0x7')](_0x4d68('0x8'),_0x434dbd);});}else{utils['request'](_0x4d68('0x8'),_0x434dbd);}}exports[_0x4d68('0x9')]=function(_0x21ac17){try{utils[_0x4d68('0xa')](util[_0x4d68('0x3')]('[%s][recordings][newchannel]',_0x21ac17[_0x4d68('0xb')]),_0x21ac17);if(_0x21ac17[_0x4d68('0xb')]==_0x21ac17['linkedid']){utils[_0x4d68('0x2')](util[_0x4d68('0x3')](_0x4d68('0xc'),_0x21ac17[_0x4d68('0xb')],_0x21ac17['context'],_0x21ac17['exten']));recordings[_0x21ac17[_0x4d68('0xb')]]={'uniqueid':_0x21ac17[_0x4d68('0xb')],'accountcode':_0x21ac17[_0x4d68('0x4')],'exten':_0x21ac17[_0x4d68('0xd')],'context':_0x21ac17[_0x4d68('0xe')],'channel':_0x21ac17['channel'],'monitors':[]};}}catch(_0x59da62){utils[_0x4d68('0xf')](util[_0x4d68('0x3')](_0x4d68('0x10'),_0x21ac17['uniqueid']),_0x59da62);}};exports['newstate']=function(_0x4f86f1){try{utils[_0x4d68('0xa')](util[_0x4d68('0x3')](_0x4d68('0x11'),_0x4f86f1[_0x4d68('0xb')]),_0x4f86f1);if(!_[_0x4d68('0x12')](recordings[_0x4f86f1[_0x4d68('0xb')]])&&_0x4f86f1['channelstate']==0x6){utils[_0x4d68('0x2')](util[_0x4d68('0x3')](_0x4d68('0x13'),_0x4f86f1[_0x4d68('0xb')],_0x4f86f1[_0x4d68('0xe')],_0x4f86f1[_0x4d68('0x14')]));}else if(!_[_0x4d68('0x12')](recordings[_0x4f86f1[_0x4d68('0x15')]])&&_0x4f86f1[_0x4d68('0x16')]==0x6&&_0x4f86f1[_0x4d68('0xe')]!=_0x4d68('0x17')){utils['info'](util[_0x4d68('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4f86f1[_0x4d68('0xb')],_0x4f86f1[_0x4d68('0x15')],_0x4f86f1['context'],_0x4f86f1[_0x4d68('0x14')]));recordings[_0x4f86f1[_0x4d68('0x15')]][_0x4d68('0x4')]=_0x4f86f1['accountcode'];}}catch(_0x312d41){utils[_0x4d68('0xf')](util[_0x4d68('0x3')](_0x4d68('0x11'),_0x4f86f1[_0x4d68('0xb')]),_0x312d41);}};exports['varset']=function(_0x3c8884){try{if(!_[_0x4d68('0x12')](_0x3c8884[_0x4d68('0x18')])&&!_[_0x4d68('0x12')](_0x3c8884[_0x4d68('0x18')][_0x4d68('0x19')])){utils['debug'](util[_0x4d68('0x3')]('[%s][recordings][varset]',_0x3c8884[_0x4d68('0xb')]),_0x3c8884);utils['info'](util[_0x4d68('0x3')](_0x4d68('0x1a'),_0x3c8884['uniqueid'],_0x3c8884[_0x4d68('0x18')],_0x3c8884['value']));if(_[_0x4d68('0x1b')](_0x3c8884[_0x4d68('0x1c')],_0x4d68('0x1d'))){_0x3c8884['value']=_0x3c8884[_0x4d68('0x1c')][_0x4d68('0x1e')](_0x4d68('0x1d'),_0x4d68('0x1f'));}if(recordings[_0x3c8884['linkedid']]){var _0x1d956e=_[_0x4d68('0x20')](recordings[_0x3c8884[_0x4d68('0x15')]]['monitors'],{'value':_0x3c8884[_0x4d68('0x1c')]});if(_['isNil'](_0x1d956e)){recordings[_0x3c8884['linkedid']]['monitors'][_0x4d68('0x21')]({'value':_0x3c8884[_0x4d68('0x1c')]});}}}}catch(_0x4eb391){utils[_0x4d68('0xf')](util['format'](_0x4d68('0x22'),_0x3c8884[_0x4d68('0xb')]),_0x4eb391);}};exports['hangup']=function(_0x2b2cbf){try{if(!_[_0x4d68('0x12')](recordings[_0x2b2cbf[_0x4d68('0xb')]])){utils[_0x4d68('0xa')](util[_0x4d68('0x3')](_0x4d68('0x23'),_0x2b2cbf[_0x4d68('0xb')]),_0x2b2cbf);utils[_0x4d68('0x2')](util[_0x4d68('0x3')](_0x4d68('0x24'),_0x2b2cbf[_0x4d68('0xb')],_0x2b2cbf[_0x4d68('0x25')],_0x2b2cbf[_0x4d68('0x26')],_0x2b2cbf[_0x4d68('0x27')]));recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x25')]=_0x2b2cbf[_0x4d68('0x25')];recordings[_0x2b2cbf['uniqueid']][_0x4d68('0x26')]=_0x2b2cbf[_0x4d68('0x26')];recordings[_0x2b2cbf['uniqueid']]['connectedlinenum']=_0x2b2cbf['connectedlinenum'];recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x28')]=_0x2b2cbf[_0x4d68('0x28')];if(recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x29')]=='outbound'&&recordings[_0x2b2cbf['uniqueid']][_0x4d68('0x4')]){recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x2a')]=recordings[_0x2b2cbf['uniqueid']]['accountcode'];recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x28')]='';}recordings[_0x2b2cbf[_0x4d68('0xb')]][_0x4d68('0x2b')][_0x4d68('0x2c')](function(_0xb108cd){var _0x46694b=_['clone'](recordings[_0x2b2cbf[_0x4d68('0xb')]]);_0x46694b[_0x4d68('0x1c')]=_0xb108cd['value'];writeDB(_0x46694b);});delete recordings[_0x2b2cbf['uniqueid']];}}catch(_0x3d019b){utils['error'](util[_0x4d68('0x3')](_0x4d68('0x23'),_0x2b2cbf['uniqueid']),_0x3d019b);}};exports[_0x4d68('0x2d')]=function(_0x396d52){try{if(!_[_0x4d68('0x12')](recordings[_0x396d52[_0x4d68('0xb')]])){utils[_0x4d68('0xa')](util[_0x4d68('0x3')](_0x4d68('0x2e'),_0x396d52[_0x4d68('0xb')]),_0x396d52);utils[_0x4d68('0x2')](util['format'](_0x4d68('0x2f'),_0x396d52[_0x4d68('0xb')],_0x396d52[_0x4d68('0x30')],_0x396d52[_0x4d68('0x31')]));if(_0x396d52['application']['toLowerCase']()==_0x4d68('0x32')&&_[_0x4d68('0x33')](_0x396d52['appdata'][_0x4d68('0x34')](),'cdr')){var _0x4835ff=_0x396d52[_0x4d68('0x31')][_0x4d68('0x35')]('=');var _0x50e319=_0x4835ff[0x0][_0x4d68('0x36')](_0x4835ff[0x0][_0x4d68('0x37')]('(')+0x1,_0x4835ff[0x0]['lastIndexOf'](')'));var _0x1a4476=_0x4835ff[0x1];recordings[_0x396d52[_0x4d68('0xb')]][_0x50e319]=_0x1a4476;}}}catch(_0x1ab497){utils['error'](util['format'](_0x4d68('0x2e'),_0x396d52[_0x4d68('0xb')]),_0x1ab497);}};exports['queuecallerjoin']=function(_0x370484){try{if(!_[_0x4d68('0x12')](recordings[_0x370484[_0x4d68('0xb')]])){utils[_0x4d68('0xa')](util[_0x4d68('0x3')]('[%s][recordings][queuecallerjoin]',_0x370484['uniqueid']),_0x370484);utils[_0x4d68('0x2')](util[_0x4d68('0x3')](_0x4d68('0x38'),_0x370484[_0x4d68('0xb')],_0x370484[_0x4d68('0x39')]));recordings[_0x370484[_0x4d68('0xb')]]['queue']=_0x370484[_0x4d68('0x39')];}}catch(_0x50f60e){utils[_0x4d68('0xf')](util[_0x4d68('0x3')](_0x4d68('0x3a'),_0x370484['uniqueid']),_0x50f60e);}}; \ No newline at end of file +var _0xf2e4=['transfer','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','error','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate'];(function(_0x2cad2a,_0x25a07f){var _0x117166=function(_0x49ea9d){while(--_0x49ea9d){_0x2cad2a['push'](_0x2cad2a['shift']());}};_0x117166(++_0x25a07f);}(_0xf2e4,0x10c));var _0x4f2e=function(_0x57be5e,_0x1c09cc){_0x57be5e=_0x57be5e-0x0;var _0x25c29f=_0xf2e4[_0x57be5e];return _0x25c29f;};'use strict';var _=require(_0x4f2e('0x0'));var util=require(_0x4f2e('0x1'));var utils=require(_0x4f2e('0x2'));var recordings={};function writeDB(_0xbc88f6){utils[_0x4f2e('0x3')](util[_0x4f2e('0x4')](_0x4f2e('0x5'),_0xbc88f6[_0x4f2e('0x6')]));if(_0xbc88f6[_0x4f2e('0x7')]){utils[_0x4f2e('0x8')](_0xbc88f6['accountcode'])[_0x4f2e('0x9')](function(_0x5e5a9f){if(_0x5e5a9f){_0xbc88f6[_0x4f2e('0xa')]=_0x5e5a9f['name'];_0xbc88f6[_0x4f2e('0xb')]=_0x5e5a9f['id'];}utils['request'](_0x4f2e('0xc'),_0xbc88f6);});}else{utils[_0x4f2e('0xd')](_0x4f2e('0xc'),_0xbc88f6);}}exports[_0x4f2e('0xe')]=function(_0x17cf65){try{utils['debug'](util[_0x4f2e('0x4')](_0x4f2e('0xf'),_0x17cf65[_0x4f2e('0x6')]),_0x17cf65);if(_0x17cf65[_0x4f2e('0x6')]==_0x17cf65[_0x4f2e('0x10')]){utils[_0x4f2e('0x3')](util[_0x4f2e('0x4')](_0x4f2e('0x11'),_0x17cf65[_0x4f2e('0x6')],_0x17cf65[_0x4f2e('0x12')],_0x17cf65[_0x4f2e('0x13')]));recordings[_0x17cf65[_0x4f2e('0x6')]]={'uniqueid':_0x17cf65[_0x4f2e('0x6')],'accountcode':_0x17cf65[_0x4f2e('0x7')],'exten':_0x17cf65[_0x4f2e('0x13')],'context':_0x17cf65[_0x4f2e('0x12')],'channel':_0x17cf65[_0x4f2e('0x14')],'monitors':[]};}}catch(_0x2ff6e1){utils['error'](util[_0x4f2e('0x4')](_0x4f2e('0xf'),_0x17cf65[_0x4f2e('0x6')]),_0x2ff6e1);}};exports[_0x4f2e('0x15')]=function(_0x2c3e95){try{utils[_0x4f2e('0x16')](util[_0x4f2e('0x4')](_0x4f2e('0x17'),_0x2c3e95[_0x4f2e('0x6')]),_0x2c3e95);if(!_[_0x4f2e('0x18')](recordings[_0x2c3e95[_0x4f2e('0x6')]])&&_0x2c3e95['channelstate']==0x6){utils[_0x4f2e('0x3')](util[_0x4f2e('0x4')](_0x4f2e('0x19'),_0x2c3e95[_0x4f2e('0x6')],_0x2c3e95['context'],_0x2c3e95[_0x4f2e('0x14')]));}else if(!_[_0x4f2e('0x18')](recordings[_0x2c3e95[_0x4f2e('0x10')]])&&_0x2c3e95[_0x4f2e('0x1a')]==0x6&&_0x2c3e95[_0x4f2e('0x12')]!=_0x4f2e('0x1b')){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2c3e95[_0x4f2e('0x6')],_0x2c3e95[_0x4f2e('0x10')],_0x2c3e95['context'],_0x2c3e95[_0x4f2e('0x14')]));recordings[_0x2c3e95[_0x4f2e('0x10')]][_0x4f2e('0x7')]=_0x2c3e95[_0x4f2e('0x7')];}}catch(_0x3b6dd5){utils['error'](util[_0x4f2e('0x4')](_0x4f2e('0x17'),_0x2c3e95[_0x4f2e('0x6')]),_0x3b6dd5);}};exports['varset']=function(_0x176bbb){try{if(!_[_0x4f2e('0x18')](_0x176bbb[_0x4f2e('0x1c')])&&!_['isNil'](_0x176bbb[_0x4f2e('0x1c')]['mixmonitor_filename'])){utils[_0x4f2e('0x16')](util[_0x4f2e('0x4')](_0x4f2e('0x1d'),_0x176bbb[_0x4f2e('0x6')]),_0x176bbb);utils[_0x4f2e('0x3')](util[_0x4f2e('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x176bbb['uniqueid'],_0x176bbb['variable'],_0x176bbb[_0x4f2e('0x1e')]));if(_[_0x4f2e('0x1f')](_0x176bbb['value'],_0x4f2e('0x20'))){_0x176bbb['value']=_0x176bbb['value'][_0x4f2e('0x21')]('.wav49',_0x4f2e('0x22'));}if(recordings[_0x176bbb[_0x4f2e('0x10')]]){var _0x3c8097=_[_0x4f2e('0x23')](recordings[_0x176bbb[_0x4f2e('0x10')]]['monitors'],{'value':_0x176bbb['value']});if(_[_0x4f2e('0x18')](_0x3c8097)){recordings[_0x176bbb[_0x4f2e('0x10')]][_0x4f2e('0x24')]['push']({'value':_0x176bbb['value']});}}}}catch(_0x529fa2){utils[_0x4f2e('0x25')](util[_0x4f2e('0x4')](_0x4f2e('0x1d'),_0x176bbb[_0x4f2e('0x6')]),_0x529fa2);}};exports['hangup']=function(_0x2334eb){try{if(!_['isNil'](recordings[_0x2334eb[_0x4f2e('0x6')]])){utils[_0x4f2e('0x16')](util['format']('[%s][recordings][hangup]',_0x2334eb[_0x4f2e('0x6')]),_0x2334eb);utils[_0x4f2e('0x3')](util[_0x4f2e('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2334eb[_0x4f2e('0x6')],_0x2334eb['calleridnum'],_0x2334eb[_0x4f2e('0x26')],_0x2334eb['cause-txt']));recordings[_0x2334eb['uniqueid']][_0x4f2e('0x27')]=_0x2334eb['calleridnum'];recordings[_0x2334eb[_0x4f2e('0x6')]][_0x4f2e('0x26')]=_0x2334eb[_0x4f2e('0x26')];recordings[_0x2334eb[_0x4f2e('0x6')]][_0x4f2e('0x28')]=_0x2334eb[_0x4f2e('0x28')];recordings[_0x2334eb[_0x4f2e('0x6')]]['connectedlinename']=_0x2334eb[_0x4f2e('0x29')];if(recordings[_0x2334eb[_0x4f2e('0x6')]][_0x4f2e('0x2a')]==_0x4f2e('0x2b')&&recordings[_0x2334eb[_0x4f2e('0x6')]]['accountcode']){recordings[_0x2334eb[_0x4f2e('0x6')]][_0x4f2e('0x28')]=recordings[_0x2334eb[_0x4f2e('0x6')]]['accountcode'];recordings[_0x2334eb['uniqueid']]['connectedlinename']='';}recordings[_0x2334eb[_0x4f2e('0x6')]][_0x4f2e('0x24')]['forEach'](function(_0x40aeff){var _0x458a46=_[_0x4f2e('0x2c')](recordings[_0x2334eb['uniqueid']]);_0x458a46[_0x4f2e('0x1e')]=_0x40aeff['value'];writeDB(_0x458a46);});delete recordings[_0x2334eb[_0x4f2e('0x6')]];}}catch(_0xb9142f){utils['error'](util[_0x4f2e('0x4')]('[%s][recordings][hangup]',_0x2334eb[_0x4f2e('0x6')]),_0xb9142f);}};exports[_0x4f2e('0x2d')]=function(_0x2d124b){try{if(!_['isNil'](recordings[_0x2d124b['uniqueid']])){utils[_0x4f2e('0x16')](util['format'](_0x4f2e('0x2e'),_0x2d124b[_0x4f2e('0x6')]),_0x2d124b);utils[_0x4f2e('0x3')](util['format'](_0x4f2e('0x2f'),_0x2d124b[_0x4f2e('0x6')],_0x2d124b['application'],_0x2d124b[_0x4f2e('0x30')]));if(_0x2d124b[_0x4f2e('0x31')][_0x4f2e('0x32')]()=='set'&&_['startsWith'](_0x2d124b[_0x4f2e('0x30')][_0x4f2e('0x32')](),_0x4f2e('0x33'))){var _0x14de33=_0x2d124b[_0x4f2e('0x30')][_0x4f2e('0x34')]('=');var _0x174708=_0x14de33[0x0][_0x4f2e('0x35')](_0x14de33[0x0][_0x4f2e('0x36')]('(')+0x1,_0x14de33[0x0][_0x4f2e('0x36')](')'));var _0x1074da=_0x14de33[0x1];recordings[_0x2d124b[_0x4f2e('0x6')]][_0x174708]=_0x1074da;}}}catch(_0x58eba2){utils[_0x4f2e('0x25')](util[_0x4f2e('0x4')](_0x4f2e('0x2e'),_0x2d124b['uniqueid']),_0x58eba2);}};exports[_0x4f2e('0x37')]=function(_0x54dcd9){try{if(!_[_0x4f2e('0x18')](recordings[_0x54dcd9[_0x4f2e('0x6')]])){utils['debug'](util[_0x4f2e('0x4')]('[%s][recordings][queuecallerjoin]',_0x54dcd9[_0x4f2e('0x6')]),_0x54dcd9);utils[_0x4f2e('0x3')](util['format'](_0x4f2e('0x38'),_0x54dcd9['uniqueid'],_0x54dcd9['queue']));recordings[_0x54dcd9[_0x4f2e('0x6')]]['queue']=_0x54dcd9[_0x4f2e('0x39')];}}catch(_0x904f88){utils['error'](util[_0x4f2e('0x4')](_0x4f2e('0x3a'),_0x54dcd9[_0x4f2e('0x6')]),_0x904f88);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 087435c..2ff61cf 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 _0xd821=['[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format'];(function(_0x197678,_0x151643){var _0x596891=function(_0x519489){while(--_0x519489){_0x197678['push'](_0x197678['shift']());}};_0x596891(++_0x151643);}(_0xd821,0x13b));var _0x1d82=function(_0x5d60a8,_0x5db4ad){_0x5d60a8=_0x5d60a8-0x0;var _0x32cc7a=_0xd821[_0x5d60a8];return _0x32cc7a;};'use strict';var _=require(_0x1d82('0x0'));var util=require(_0x1d82('0x1'));var utils=require(_0x1d82('0x2'));function writeDB(_0xa27d42){utils[_0x1d82('0x3')](util[_0x1d82('0x4')](_0x1d82('0x5'),_0xa27d42[_0x1d82('0x6')]==='attended'?_0xa27d42[_0x1d82('0x7')]:_0xa27d42[_0x1d82('0x8')],_0xa27d42[_0x1d82('0x6')]));utils[_0x1d82('0x9')](_0x1d82('0xa'),_0xa27d42);}exports['blindtransfer']=function(_0x1c45ba){try{utils[_0x1d82('0xb')](util[_0x1d82('0x4')](_0x1d82('0xc'),_0x1c45ba[_0x1d82('0x8')]),_0x1c45ba);utils['info'](util[_0x1d82('0x4')](_0x1d82('0xd'),_0x1c45ba[_0x1d82('0x8')],_0x1c45ba[_0x1d82('0xe')],_0x1c45ba[_0x1d82('0xf')],_0x1c45ba[_0x1d82('0x10')],_0x1c45ba[_0x1d82('0x11')]));_0x1c45ba[_0x1d82('0x6')]=_0x1d82('0x12');writeDB(_0x1c45ba);}catch(_0x29de54){utils['error'](util[_0x1d82('0x4')](_0x1d82('0xc'),_0x1c45ba[_0x1d82('0x8')]),_0x29de54);}};exports['attendedtransfer']=function(_0x1b6bce){try{utils[_0x1d82('0xb')](util[_0x1d82('0x4')](_0x1d82('0x13'),_0x1b6bce[_0x1d82('0x7')]),_0x1b6bce);utils[_0x1d82('0x3')](util['format'](_0x1d82('0x14'),_0x1b6bce[_0x1d82('0x7')],_0x1b6bce[_0x1d82('0x15')],_0x1b6bce[_0x1d82('0x16')],_0x1b6bce['transfertargetcalleridnum'],_0x1b6bce[_0x1d82('0x17')]));_0x1b6bce=_[_0x1d82('0x18')](_0x1b6bce,{'transfererchannel':_0x1b6bce['origtransfererchannel'],'transferercalleridnum':_0x1b6bce[_0x1d82('0x15')],'transferercalleridname':_0x1b6bce[_0x1d82('0x16')],'transfererconnectedlinenum':_0x1b6bce[_0x1d82('0x19')],'transfererconnectedlinename':_0x1b6bce[_0x1d82('0x1a')],'transfereraccountcode':_0x1b6bce[_0x1d82('0x1b')],'transferercontext':_0x1b6bce[_0x1d82('0x1c')],'transfererexten':_0x1b6bce[_0x1d82('0x1d')],'transfererlinkedid':_0x1b6bce['origtransfererlinkedid'],'context':_0x1b6bce[_0x1d82('0x1e')],'extension':_0x1b6bce[_0x1d82('0x1f')],'type':_0x1d82('0x20')});if(_['isNil'](_0x1b6bce['transfereechannel'])){_0x1b6bce=_['assign'](_0x1b6bce,{'transfereechannel':_0x1b6bce[_0x1d82('0x21')],'transfereecalleridnum':_0x1b6bce[_0x1d82('0x22')],'transfereecalleridname':_0x1b6bce['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1b6bce[_0x1d82('0x23')],'transfereeconnectedlinename':_0x1b6bce['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1b6bce[_0x1d82('0x24')],'transfereecontext':_0x1b6bce[_0x1d82('0x25')],'transfereeexten':_0x1b6bce[_0x1d82('0x26')],'transfereelinkedid':_0x1b6bce[_0x1d82('0x27')]});}writeDB(_0x1b6bce);}catch(_0x5f4639){utils['error'](util['format'](_0x1d82('0x13'),_0x1b6bce[_0x1d82('0x7')]),_0x5f4639);}}; \ No newline at end of file +var _0x1b65=['CreateVoiceTransferReport','blindtransfer','debug','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x1b65,0xf9));var _0x51b6=function(_0x100919,_0x38387b){_0x100919=_0x100919-0x0;var _0x444020=_0x1b65[_0x100919];return _0x444020;};'use strict';var _=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var utils=require(_0x51b6('0x2'));function writeDB(_0x4353a8){utils[_0x51b6('0x3')](util[_0x51b6('0x4')](_0x51b6('0x5'),_0x4353a8[_0x51b6('0x6')]===_0x51b6('0x7')?_0x4353a8['origtransfereruniqueid']:_0x4353a8[_0x51b6('0x8')],_0x4353a8[_0x51b6('0x6')]));utils[_0x51b6('0x9')](_0x51b6('0xa'),_0x4353a8);}exports[_0x51b6('0xb')]=function(_0x257830){try{utils[_0x51b6('0xc')](util['format']('[%s][transfers][blindtransfer]',_0x257830['uniqueid']),_0x257830);utils['info'](util[_0x51b6('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x257830[_0x51b6('0x8')],_0x257830['transferercalleridnum'],_0x257830['transferercalleridname'],_0x257830[_0x51b6('0xd')],_0x257830[_0x51b6('0xe')]));_0x257830[_0x51b6('0x6')]=_0x51b6('0xf');writeDB(_0x257830);}catch(_0x48185f){utils[_0x51b6('0x10')](util['format'](_0x51b6('0x11'),_0x257830['uniqueid']),_0x48185f);}};exports['attendedtransfer']=function(_0x18e72c){try{utils[_0x51b6('0xc')](util[_0x51b6('0x4')]('[%s][transfers][attendedtransfer]',_0x18e72c[_0x51b6('0x12')]),_0x18e72c);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x18e72c[_0x51b6('0x12')],_0x18e72c[_0x51b6('0x13')],_0x18e72c[_0x51b6('0x14')],_0x18e72c['transfertargetcalleridnum'],_0x18e72c['transfertargetcalleridname']));_0x18e72c=_['assign'](_0x18e72c,{'transfererchannel':_0x18e72c['origtransfererchannel'],'transferercalleridnum':_0x18e72c[_0x51b6('0x13')],'transferercalleridname':_0x18e72c[_0x51b6('0x14')],'transfererconnectedlinenum':_0x18e72c[_0x51b6('0x15')],'transfererconnectedlinename':_0x18e72c[_0x51b6('0x16')],'transfereraccountcode':_0x18e72c['origtransfereraccountcode'],'transferercontext':_0x18e72c[_0x51b6('0x17')],'transfererexten':_0x18e72c[_0x51b6('0x18')],'transfererlinkedid':_0x18e72c[_0x51b6('0x19')],'context':_0x18e72c[_0x51b6('0x1a')],'extension':_0x18e72c['origtransfererexten'],'type':_0x51b6('0x7')});if(_[_0x51b6('0x1b')](_0x18e72c['transfereechannel'])){_0x18e72c=_[_0x51b6('0x1c')](_0x18e72c,{'transfereechannel':_0x18e72c[_0x51b6('0x1d')],'transfereecalleridnum':_0x18e72c['transfertargetcalleridnum'],'transfereecalleridname':_0x18e72c[_0x51b6('0x1e')],'transfereeconnectedlinenum':_0x18e72c[_0x51b6('0x1f')],'transfereeconnectedlinename':_0x18e72c[_0x51b6('0x20')],'transfereeaccountcode':_0x18e72c[_0x51b6('0x21')],'transfereecontext':_0x18e72c[_0x51b6('0x22')],'transfereeexten':_0x18e72c[_0x51b6('0x23')],'transfereelinkedid':_0x18e72c[_0x51b6('0x24')]});}writeDB(_0x18e72c);}catch(_0x3805ab){utils[_0x51b6('0x10')](util[_0x51b6('0x4')]('[%s][transfers][attendedtransfer]',_0x18e72c[_0x51b6('0x12')]),_0x3805ab);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 14f9bc0..aeaab11 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 _0xe81b=['sumTime','now','isAfter','bluebird','jayson/promise','moment','util','client','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','[utils][getUser]\x20where:%s','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff'];(function(_0x20daaf,_0x4d8fea){var _0x50fb5f=function(_0x5e5a8a){while(--_0x5e5a8a){_0x20daaf['push'](_0x20daaf['shift']());}};_0x50fb5f(++_0x4d8fea);}(_0xe81b,0xe4));var _0xbe81=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xe81b[_0x29d915];return _0x160f86;};'use strict';var BPromise=require(_0xbe81('0x0'));var jayson=require(_0xbe81('0x1'));var moment=require(_0xbe81('0x2'));var util=require(_0xbe81('0x3'));var client=jayson[_0xbe81('0x4')][_0xbe81('0x5')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports['info']=function(_0x2438d1,_0x220c72){logger[_0xbe81('0x6')](_0x2438d1,_0x220c72?util[_0xbe81('0x7')](_0x220c72,{'showHidden':![],'depth':null}):'');};exports[_0xbe81('0x8')]=function(_0x36d6bb,_0x1ed8bc){logger[_0xbe81('0x8')](_0x36d6bb,_0x1ed8bc?util[_0xbe81('0x7')](_0x1ed8bc,{'showHidden':![],'depth':null}):'');};exports[_0xbe81('0x9')]=function(_0x52187d,_0x4f99ea){logger[_0xbe81('0x9')](_0x52187d,_0x4f99ea?util[_0xbe81('0x7')](_0x4f99ea,{'showHidden':![],'depth':null}):'');};exports[_0xbe81('0xa')]=function(_0x3d78c4,_0x487bcf){return client[_0xbe81('0xa')](_0x3d78c4,{'body':_0x487bcf})[_0xbe81('0xb')](function(_0x56657f){logger[_0xbe81('0x8')](_0xbe81('0xc'),_0x3d78c4,_0x56657f?util[_0xbe81('0x7')](_0x56657f,{'showHidden':![],'depth':null}):'');})[_0xbe81('0xd')](function(_0x1b6259){logger[_0xbe81('0x9')](_0xbe81('0xc'),_0x3d78c4,_0x1b6259?util[_0xbe81('0x7')](_0x1b6259,{'showHidden':![],'depth':null}):'');});};function getUser(_0x327a8c){return client['request'](_0xbe81('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xbe81('0xf'),'interface'],'where':_0x327a8c,'limit':0x1}})[_0xbe81('0xb')](function(_0x36e263){logger[_0xbe81('0x8')](_0xbe81('0x10'),JSON['stringify'](_0x327a8c),_0x36e263?util[_0xbe81('0x7')](_0x36e263,{'showHidden':![],'depth':null}):'');return _0x36e263['result'][_0xbe81('0x11')]?_0x36e263[_0xbe81('0x12')][0x0]:null;});}exports[_0xbe81('0x13')]=function(_0x14bc28){return new BPromise(function(_0x56d18f,_0x24f2b2){if(_0x14bc28){return getUser({'internal':_0x14bc28})['then'](function(_0x4679b1){logger['info'](_0xbe81('0x14'),_0x14bc28,_0x4679b1?_0xbe81('0x15'):'notfound');return _0x56d18f(_0x4679b1);})[_0xbe81('0xd')](function(_0x3c0b03){logger[_0xbe81('0x9')](_0xbe81('0x16'),_0x3c0b03?util['inspect'](_0x3c0b03,{'showHidden':![],'depth':null}):'');return _0x56d18f(null);});}return _0x56d18f(null);});};exports[_0xbe81('0x17')]=function(_0x4cda12){return new BPromise(function(_0x16cc57,_0x454937){if(_0x4cda12){return getUser({'interface':_0x4cda12})[_0xbe81('0xb')](function(_0x49eccf){logger['info'](_0xbe81('0x18'),_0x4cda12,_0x49eccf?_0xbe81('0x15'):'notfound');return _0x16cc57(_0x49eccf);})['catch'](function(_0x1ebb18){logger[_0xbe81('0x9')](_0xbe81('0x19'),_0x1ebb18?util[_0xbe81('0x7')](_0x1ebb18,{'showHidden':![],'depth':null}):'');return _0x16cc57(null);});}return _0x16cc57(null);});};exports[_0xbe81('0x1a')]=function(_0x2a799d){return new BPromise(function(_0x15fc48,_0x2e08e7){if(_0x2a799d){return getUser({'name':_0x2a799d})[_0xbe81('0xb')](function(_0x356696){logger[_0xbe81('0x6')](_0xbe81('0x1b'),_0x2a799d,_0x356696?_0xbe81('0x15'):_0xbe81('0x1c'));return _0x15fc48(_0x356696);})[_0xbe81('0xd')](function(_0x5725ea){logger['error']('[utils][getUserByName]',_0x5725ea?util[_0xbe81('0x7')](_0x5725ea,{'showHidden':![],'depth':null}):'');return _0x15fc48(null);});}return _0x15fc48(null);});};exports['getVoiceQueueByName']=function(_0x42cda6){return new BPromise(function(_0x1e3d40,_0x2d1819){if(_0x42cda6){return client[_0xbe81('0xa')](_0xbe81('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xbe81('0xf'),_0xbe81('0x1e'),_0xbe81('0x1f'),_0xbe81('0x20')],'where':{'name':_0x42cda6},'limit':0x1}})['then'](function(_0x1b393e){logger[_0xbe81('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x42cda6,_0x1b393e?util['inspect'](_0x1b393e,{'showHidden':![],'depth':null}):'');logger['info'](_0xbe81('0x21'),_0x42cda6,_0x1b393e?_0xbe81('0x15'):_0xbe81('0x1c'));return _0x1e3d40(_0x1b393e[_0xbe81('0x12')][_0xbe81('0x11')]?_0x1b393e[_0xbe81('0x12')][0x0]:null);})['catch'](function(_0x3969d1){logger[_0xbe81('0x9')](_0xbe81('0x22'),_0x3969d1?util[_0xbe81('0x7')](_0x3969d1,{'showHidden':![],'depth':null}):'');return _0x1e3d40(null);});}return _0x1e3d40(null);});};exports['addTime']=function(_0x4c689f,_0x5d80db){return moment(_0x4c689f)['add'](_0x5d80db,_0xbe81('0x23'))[_0xbe81('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbe81('0x25')]=function(_0x5a4cbc,_0x3e7459){return moment(_0x5a4cbc)[_0xbe81('0x26')](_0x3e7459,_0xbe81('0x23'))['format'](_0xbe81('0x27'));};exports[_0xbe81('0x28')]=function(_0x31330e,_0x144fcf){return moment(_0x31330e)[_0xbe81('0x29')](moment(_0x144fcf),'seconds');};exports[_0xbe81('0x2a')]=function(_0x412f6b,_0x5315b2){return parseInt(_0x412f6b,0xa)+parseInt(_0x5315b2,0xa);};exports[_0xbe81('0x2b')]=function(){return moment()[_0xbe81('0x24')](_0xbe81('0x27'));};exports[_0xbe81('0x2c')]=function(_0x39fdf3,_0x21cce2){if(_0x21cce2){return moment(_0x39fdf3)[_0xbe81('0x2c')](_0x21cce2);}return!![];};exports['isBefore']=function(_0x1c0c64,_0x3e439c){if(_0x3e439c){return moment(_0x1c0c64)['isBefore'](_0x3e439c);}else if(_0x1c0c64){return!![];}return![];}; \ No newline at end of file +var _0xc747=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','found','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName'];(function(_0x3d577d,_0x44719f){var _0xcd0890=function(_0x2a3eba){while(--_0x2a3eba){_0x3d577d['push'](_0x3d577d['shift']());}};_0xcd0890(++_0x44719f);}(_0xc747,0x16b));var _0x7c74=function(_0x1db347,_0x50526b){_0x1db347=_0x1db347-0x0;var _0x4ec95f=_0xc747[_0x1db347];return _0x4ec95f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7c74('0x0'));var moment=require(_0x7c74('0x1'));var util=require(_0x7c74('0x2'));var client=jayson[_0x7c74('0x3')][_0x7c74('0x4')]({'port':0x2329});var logger=require(_0x7c74('0x5'))('xdr');exports[_0x7c74('0x6')]=function(_0x3617ee,_0x55d156){logger[_0x7c74('0x6')](_0x3617ee,_0x55d156?util[_0x7c74('0x7')](_0x55d156,{'showHidden':![],'depth':null}):'');};exports[_0x7c74('0x8')]=function(_0x3a1f55,_0x59a455){logger[_0x7c74('0x8')](_0x3a1f55,_0x59a455?util['inspect'](_0x59a455,{'showHidden':![],'depth':null}):'');};exports[_0x7c74('0x9')]=function(_0x54866f,_0x4d5449){logger[_0x7c74('0x9')](_0x54866f,_0x4d5449?util['inspect'](_0x4d5449,{'showHidden':![],'depth':null}):'');};exports[_0x7c74('0xa')]=function(_0x12c6e8,_0x560430){return client[_0x7c74('0xa')](_0x12c6e8,{'body':_0x560430})['then'](function(_0x1c03c6){logger[_0x7c74('0x8')]('[utils][request]\x20name:%s',_0x12c6e8,_0x1c03c6?util['inspect'](_0x1c03c6,{'showHidden':![],'depth':null}):'');})[_0x7c74('0xb')](function(_0x55eea3){logger['error']('[utils][request]\x20name:%s',_0x12c6e8,_0x55eea3?util['inspect'](_0x55eea3,{'showHidden':![],'depth':null}):'');});};function getUser(_0x21580b){return client[_0x7c74('0xa')](_0x7c74('0xc'),{'options':{'raw':!![],'attributes':['id',_0x7c74('0xd'),_0x7c74('0xe'),_0x7c74('0xf')],'where':_0x21580b,'limit':0x1}})[_0x7c74('0x10')](function(_0x34fad0){logger[_0x7c74('0x8')](_0x7c74('0x11'),JSON[_0x7c74('0x12')](_0x21580b),_0x34fad0?util[_0x7c74('0x7')](_0x34fad0,{'showHidden':![],'depth':null}):'');return _0x34fad0['result']['length']?_0x34fad0[_0x7c74('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x460478){return new BPromise(function(_0x5bbe06,_0x4925be){if(_0x460478){return getUser({'internal':_0x460478})['then'](function(_0x32f3b4){logger[_0x7c74('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x460478,_0x32f3b4?_0x7c74('0x14'):'notfound');return _0x5bbe06(_0x32f3b4);})[_0x7c74('0xb')](function(_0x5c14ec){logger[_0x7c74('0x9')]('[utils][getUserByInternal]',_0x5c14ec?util[_0x7c74('0x7')](_0x5c14ec,{'showHidden':![],'depth':null}):'');return _0x5bbe06(null);});}return _0x5bbe06(null);});};exports['getUserByInterface']=function(_0x5056b1){return new BPromise(function(_0x36df73,_0xa44ac9){if(_0x5056b1){return getUser({'interface':_0x5056b1})['then'](function(_0x58523e){logger[_0x7c74('0x6')](_0x7c74('0x15'),_0x5056b1,_0x58523e?'found':'notfound');return _0x36df73(_0x58523e);})[_0x7c74('0xb')](function(_0xc68715){logger[_0x7c74('0x9')](_0x7c74('0x16'),_0xc68715?util[_0x7c74('0x7')](_0xc68715,{'showHidden':![],'depth':null}):'');return _0x36df73(null);});}return _0x36df73(null);});};exports[_0x7c74('0x17')]=function(_0x199f9f){return new BPromise(function(_0x12e33d,_0x3ab069){if(_0x199f9f){return getUser({'name':_0x199f9f})[_0x7c74('0x10')](function(_0x522866){logger[_0x7c74('0x6')](_0x7c74('0x18'),_0x199f9f,_0x522866?_0x7c74('0x14'):'notfound');return _0x12e33d(_0x522866);})[_0x7c74('0xb')](function(_0x53a190){logger[_0x7c74('0x9')](_0x7c74('0x19'),_0x53a190?util[_0x7c74('0x7')](_0x53a190,{'showHidden':![],'depth':null}):'');return _0x12e33d(null);});}return _0x12e33d(null);});};exports[_0x7c74('0x1a')]=function(_0x126553){return new BPromise(function(_0x1d55be,_0xa667aa){if(_0x126553){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x7c74('0xe'),'type',_0x7c74('0x1b'),_0x7c74('0x1c')],'where':{'name':_0x126553},'limit':0x1}})[_0x7c74('0x10')](function(_0x380d45){logger[_0x7c74('0x8')](_0x7c74('0x1d'),_0x126553,_0x380d45?util[_0x7c74('0x7')](_0x380d45,{'showHidden':![],'depth':null}):'');logger['info'](_0x7c74('0x1e'),_0x126553,_0x380d45?_0x7c74('0x14'):'notfound');return _0x1d55be(_0x380d45[_0x7c74('0x13')][_0x7c74('0x1f')]?_0x380d45[_0x7c74('0x13')][0x0]:null);})[_0x7c74('0xb')](function(_0x3f6a8e){logger[_0x7c74('0x9')]('[utils][getVoiceQueueByName]',_0x3f6a8e?util[_0x7c74('0x7')](_0x3f6a8e,{'showHidden':![],'depth':null}):'');return _0x1d55be(null);});}return _0x1d55be(null);});};exports['addTime']=function(_0x29209c,_0x11a89c){return moment(_0x29209c)[_0x7c74('0x20')](_0x11a89c,_0x7c74('0x21'))['format'](_0x7c74('0x22'));};exports[_0x7c74('0x23')]=function(_0x4ca163,_0x2f44b9){return moment(_0x4ca163)[_0x7c74('0x24')](_0x2f44b9,_0x7c74('0x21'))[_0x7c74('0x25')](_0x7c74('0x22'));};exports[_0x7c74('0x26')]=function(_0x2659ac,_0xb06a18){return moment(_0x2659ac)[_0x7c74('0x27')](moment(_0xb06a18),'seconds');};exports[_0x7c74('0x28')]=function(_0xc97f3f,_0x300c80){return parseInt(_0xc97f3f,0xa)+parseInt(_0x300c80,0xa);};exports['now']=function(){return moment()[_0x7c74('0x25')](_0x7c74('0x22'));};exports[_0x7c74('0x29')]=function(_0x167dc8,_0x1d7840){if(_0x1d7840){return moment(_0x167dc8)[_0x7c74('0x29')](_0x1d7840);}return!![];};exports[_0x7c74('0x2a')]=function(_0x24b4e8,_0x3a4de1){if(_0x3a4de1){return moment(_0x24b4e8)[_0x7c74('0x2a')](_0x3a4de1);}else if(_0x24b4e8){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 751ec31..940e93d 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 _0x2244=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','test','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','role','name','ensureDir','then','catch','user','no-user','data','client','error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device'];(function(_0x359d84,_0x23ee55){var _0x4f823c=function(_0x4700ec){while(--_0x4700ec){_0x359d84['push'](_0x359d84['shift']());}};_0x4f823c(++_0x23ee55);}(_0x2244,0x1bd));var _0x4224=function(_0x3d7ce2,_0x5992aa){_0x3d7ce2=_0x3d7ce2-0x0;var _0x46e8ea=_0x2244[_0x3d7ce2];return _0x46e8ea;};var fs=require('fs-extra');var _=require(_0x4224('0x0'));var ewinston=require(_0x4224('0x1'));var path=require(_0x4224('0x2'));var util=require(_0x4224('0x3'));var fileLogger=require('./loggers')[_0x4224('0x4')];var safeTemplate=require(_0x4224('0x5'))[_0x4224('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x4224('0x7')];function ClientSideLogger(){function _0x3225b7(_0x3053c5){var _0x1803a7=path[_0x4224('0x8')](_0x4224('0x9'),'log','xcally');var _0x14f9e7=path['join']('client',_0x3053c5[_0x4224('0xa')]+'-'+_0x3053c5[_0x4224('0xb')]);return fs[_0x4224('0xc')](path[_0x4224('0x8')](_0x1803a7,_0x14f9e7))[_0x4224('0xd')](function(){var _0x4021bb=fileLogger('client',path[_0x4224('0x8')](_0x1803a7,_0x14f9e7));return _0x4021bb;})[_0x4224('0xe')](function(_0x30f54a){throw _0x30f54a;});}this['log']=function(_0x2987a7,_0x5d9784,_0x4694a8,_0x454144){return _0x3225b7(_0x2987a7[_0x4224('0xf')])[_0x4224('0xd')](function(_0x4547fd){var _0x5560cc=_0x4547fd[_0x5d9784];return _0x5560cc;})['then'](function(_0x249e66){var _0x9e467a=_0x2987a7[_0x4224('0xf')]?_0x2987a7[_0x4224('0xf')]['id']:_0x4224('0x10');var _0x3c8ce7=_0x454144[_0x4224('0x11')];var _0x18a766=_0x454144['timestamp'];var _0x1adfd9=new Date(Number(_0x18a766));return _0x249e66(_0x9e467a,_0x1adfd9,_0x4694a8,_0x3c8ce7);})['catch'](function(_0x443cfa){fileLogger(_0x4224('0x12'))[_0x4224('0x13')](_0x443cfa);});};}function setupLoggers(_0x532bf6){return new Promise(function(_0x2ca0cb){var _0x2501ce=new ClientSideLogger();var _0x57b50f=fileLogger(_0x4224('0x14'));var _0x55abc8=fileLogger(_0x4224('0x15'));_0x532bf6['set'](_0x4224('0x16'),_0x2501ce);_0x532bf6['use'](ewinston[_0x4224('0x17')]({'winstonInstance':_0x57b50f,'meta':![],'statusLevels':!![],'msg':function(_0x38a628,_0x1356f6){var _0x1b1f9f=_0x4224('0x18');if(!_[_0x4224('0x19')](_0x38a628[_0x4224('0x1a')])){_0x1b1f9f+=_0x4224('0x1b');var _0x3aa90e=_0x38a628[_0x4224('0x1a')];maskSensitiveData(_0x3aa90e);}return safeTemplate(util[_0x4224('0x1c')](_0x1b1f9f,_0x38a628[_0x4224('0x1d')],_0x38a628[_0x4224('0x1e')]['x-forwarded-for']?_0x38a628[_0x4224('0x1e')][_0x4224('0x1f')]:_0x38a628[_0x4224('0x20')][_0x4224('0x21')]||_0x38a628['ip'],_0x38a628[_0x4224('0x22')],_0x1356f6[_0x4224('0x23')],_0x1356f6['responseTime'],_0x38a628['user']?_0x38a628[_0x4224('0xf')]['id']:null,_0x38a628['user']?_0x38a628[_0x4224('0xf')]['name']:null,_0x38a628[_0x4224('0xf')]?_0x38a628[_0x4224('0xf')][_0x4224('0xa')]:null,_0x3aa90e?util[_0x4224('0x24')](_0x3aa90e,![],null):''));}}));_0x532bf6['use'](ewinston[_0x4224('0x17')]({'winstonInstance':_0x55abc8,'meta':![],'statusLevels':!![],'msg':function(_0x32ec6d,_0x13774c){var _0xd0e107=_0x4224('0x25');if(_0x32ec6d[_0x4224('0x1a')]&&_0x32ec6d[_0x4224('0x1a')][_0x4224('0x26')]&&_0x32ec6d[_0x4224('0x1a')][_0x4224('0x27')]){_0xd0e107=_0x4224('0x28');}return util[_0x4224('0x1c')](_0xd0e107,_0x32ec6d['method'],_0x32ec6d[_0x4224('0x1e')]['x-forwarded-for']?_0x32ec6d['headers'][_0x4224('0x1f')]:_0x32ec6d[_0x4224('0x20')][_0x4224('0x21')]||_0x32ec6d['ip'],_0x32ec6d[_0x4224('0x22')],_0x13774c[_0x4224('0x23')],_0x13774c[_0x4224('0x29')],_0x32ec6d[_0x4224('0xf')]?_0x32ec6d[_0x4224('0xf')]['id']:null,_0x32ec6d['user']?_0x32ec6d[_0x4224('0xf')][_0x4224('0xb')]:null,_0x32ec6d[_0x4224('0xf')]?_0x32ec6d[_0x4224('0xf')][_0x4224('0xa')]:null,_0x32ec6d['body']&&_0x32ec6d[_0x4224('0x1a')]['device']?_0x32ec6d[_0x4224('0x1a')][_0x4224('0x26')]:_0x4224('0x2a'),_0x32ec6d[_0x4224('0x1a')]&&_0x32ec6d[_0x4224('0x1a')][_0x4224('0x27')]?_0x32ec6d[_0x4224('0x1a')][_0x4224('0x27')]:'',_0x32ec6d['body']&&_0x32ec6d[_0x4224('0x1a')]['agent_name']?_0x32ec6d[_0x4224('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x581413){var _0x1782e3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1782e3[_0x4224('0x2b')](_0x581413['url']);}}));return _0x2ca0cb();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0xb538=['remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','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)','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then','user','no-user','data','timestamp','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','connection'];(function(_0x3b5fe8,_0x3e25dd){var _0x20500b=function(_0x2bcecd){while(--_0x2bcecd){_0x3b5fe8['push'](_0x3b5fe8['shift']());}};_0x20500b(++_0x3e25dd);}(_0xb538,0x6d));var _0x8b53=function(_0x5b9278,_0x1eb89f){_0x5b9278=_0x5b9278-0x0;var _0x215c50=_0xb538[_0x5b9278];return _0x215c50;};var fs=require(_0x8b53('0x0'));var _=require(_0x8b53('0x1'));var ewinston=require(_0x8b53('0x2'));var path=require(_0x8b53('0x3'));var util=require('util');var fileLogger=require(_0x8b53('0x4'))[_0x8b53('0x5')];var safeTemplate=require(_0x8b53('0x6'))[_0x8b53('0x7')];var maskSensitiveData=require(_0x8b53('0x8'))[_0x8b53('0x9')];function ClientSideLogger(){function _0xd521d7(_0x32edde){var _0xbb344=path['join'](_0x8b53('0xa'),_0x8b53('0xb'),_0x8b53('0xc'));var _0x1efe53=path[_0x8b53('0xd')](_0x8b53('0xe'),_0x32edde[_0x8b53('0xf')]+'-'+_0x32edde[_0x8b53('0x10')]);return fs[_0x8b53('0x11')](path[_0x8b53('0xd')](_0xbb344,_0x1efe53))[_0x8b53('0x12')](function(){var _0x3b1ac5=fileLogger(_0x8b53('0xe'),path[_0x8b53('0xd')](_0xbb344,_0x1efe53));return _0x3b1ac5;})['catch'](function(_0xcf6736){throw _0xcf6736;});}this[_0x8b53('0xb')]=function(_0x583fcc,_0x858cb,_0x1570b5,_0x562f33){return _0xd521d7(_0x583fcc[_0x8b53('0x13')])[_0x8b53('0x12')](function(_0x366170){var _0x2bf607=_0x366170[_0x858cb];return _0x2bf607;})[_0x8b53('0x12')](function(_0x1adc47){var _0x306834=_0x583fcc[_0x8b53('0x13')]?_0x583fcc[_0x8b53('0x13')]['id']:_0x8b53('0x14');var _0x207abb=_0x562f33[_0x8b53('0x15')];var _0x5b746d=_0x562f33[_0x8b53('0x16')];var _0x31b1f2=new Date(Number(_0x5b746d));return _0x1adc47(_0x306834,_0x31b1f2,_0x1570b5,_0x207abb);})['catch'](function(_0x396741){fileLogger('client')['error'](_0x396741);});};}function setupLoggers(_0x3ad8df){return new Promise(function(_0xbba9a1){var _0x450461=new ClientSideLogger();var _0x2ca877=fileLogger('api');var _0x5e21ce=fileLogger(_0x8b53('0x17'));_0x3ad8df[_0x8b53('0x18')](_0x8b53('0x19'),_0x450461);_0x3ad8df['use'](ewinston[_0x8b53('0x1a')]({'winstonInstance':_0x2ca877,'meta':![],'statusLevels':!![],'msg':function(_0x4e63e7,_0x1312f1){var _0x221d0a=_0x8b53('0x1b');if(!_[_0x8b53('0x1c')](_0x4e63e7['body'])){_0x221d0a+=_0x8b53('0x1d');var _0x242daa=_0x4e63e7['body'];maskSensitiveData(_0x242daa);}return safeTemplate(util[_0x8b53('0x1e')](_0x221d0a,_0x4e63e7[_0x8b53('0x1f')],_0x4e63e7[_0x8b53('0x20')][_0x8b53('0x21')]?_0x4e63e7[_0x8b53('0x20')][_0x8b53('0x21')]:_0x4e63e7[_0x8b53('0x22')][_0x8b53('0x23')]||_0x4e63e7['ip'],_0x4e63e7[_0x8b53('0x24')],_0x1312f1[_0x8b53('0x25')],_0x1312f1[_0x8b53('0x26')],_0x4e63e7[_0x8b53('0x13')]?_0x4e63e7[_0x8b53('0x13')]['id']:null,_0x4e63e7[_0x8b53('0x13')]?_0x4e63e7[_0x8b53('0x13')][_0x8b53('0x10')]:null,_0x4e63e7[_0x8b53('0x13')]?_0x4e63e7[_0x8b53('0x13')][_0x8b53('0xf')]:null,_0x242daa?util['inspect'](_0x242daa,![],null):''));}}));_0x3ad8df['use'](ewinston[_0x8b53('0x1a')]({'winstonInstance':_0x5e21ce,'meta':![],'statusLevels':!![],'msg':function(_0x29cce0,_0x3c4f0a){var _0x266369=_0x8b53('0x27');if(_0x29cce0['body']&&_0x29cce0[_0x8b53('0x28')][_0x8b53('0x29')]&&_0x29cce0[_0x8b53('0x28')][_0x8b53('0x2a')]){_0x266369=_0x8b53('0x2b');}return util['format'](_0x266369,_0x29cce0[_0x8b53('0x1f')],_0x29cce0[_0x8b53('0x20')][_0x8b53('0x21')]?_0x29cce0[_0x8b53('0x20')][_0x8b53('0x21')]:_0x29cce0[_0x8b53('0x22')][_0x8b53('0x23')]||_0x29cce0['ip'],_0x29cce0[_0x8b53('0x24')],_0x3c4f0a[_0x8b53('0x25')],_0x3c4f0a[_0x8b53('0x26')],_0x29cce0[_0x8b53('0x13')]?_0x29cce0[_0x8b53('0x13')]['id']:null,_0x29cce0[_0x8b53('0x13')]?_0x29cce0[_0x8b53('0x13')][_0x8b53('0x10')]:null,_0x29cce0[_0x8b53('0x13')]?_0x29cce0['user'][_0x8b53('0xf')]:null,_0x29cce0[_0x8b53('0x28')]&&_0x29cce0[_0x8b53('0x28')][_0x8b53('0x29')]?_0x29cce0['body']['device']:_0x8b53('0x2c'),_0x29cce0[_0x8b53('0x28')]&&_0x29cce0[_0x8b53('0x28')][_0x8b53('0x2a')]?_0x29cce0[_0x8b53('0x28')]['agent_id']:'',_0x29cce0[_0x8b53('0x28')]&&_0x29cce0['body'][_0x8b53('0x2d')]?_0x29cce0['body'][_0x8b53('0x2d')]:'');},'ignoreRoute':function(_0x5c0bfa){var _0x2c8188=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c8188[_0x8b53('0x2e')](_0x5c0bfa[_0x8b53('0x24')]);}}));return _0xbba9a1();});}exports[_0x8b53('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 717fc47..1e901e2 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1997=['toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','MMM','guess','isMoment','length','padStart','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1997,0x1be));var _0x7199=function(_0x537e3d,_0x163936){_0x537e3d=_0x537e3d-0x0;var _0x52de9a=_0x1997[_0x537e3d];return _0x52de9a;};var _=require('lodash');var moment=require(_0x7199('0x0'));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(_0x5d9134){return _0x5d9134[_0x7199('0x1')];})[_0x7199('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7199('0x3');var EINVALID_DATE=_0x7199('0x4');function throwIfDateNotValid(_0x4201de){if(!_0x4201de[_0x7199('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x364c69){var _0x2f0b1a=_0x364c69[_0x7199('0x6')](':')[_0x7199('0x7')](function(_0x18da5e){return parseInt(_0x18da5e,0xa);});var _0x21abab=_0x2f0b1a[0x0];var _0x113247=_0x2f0b1a[0x1];if(_0x21abab<0x0||_0x21abab>0x17||_0x113247<0x0||_0x113247>0x3b){throw new Error(EINVALID_DATE);}return[_0x21abab,_0x113247];}function circularDoWInterval(_0x5d2bd9,_0x1800a0){if(_0x5d2bd9===_0x1800a0){return[_0x5d2bd9];}else{var _0x16b9ae=moment[_0x7199('0x8')]();moment[_0x7199('0x8')]('en');var _0x5a997b=moment[_0x7199('0x9')]()[_0x7199('0x7')](function(_0x3823be){return _0x3823be[_0x7199('0xa')]();});moment[_0x7199('0x8')](_0x16b9ae);var _0x592d6c=_0x5a997b['indexOf'](_0x5d2bd9);var _0x7bcaa6=_0x5a997b[_0x7199('0xb')](_0x1800a0);if(_0x7bcaa6>_0x592d6c){return _0x5a997b['slice'](_0x592d6c,_0x7bcaa6+0x1);}else{var _0x1b5821=_0x5a997b[_0x7199('0xc')](0x0,_0x7bcaa6+0x1);var _0x1a73e1=_0x5a997b[_0x7199('0xc')](_0x592d6c);return _0x1a73e1[_0x7199('0xd')](_0x1b5821);}}}module[_0x7199('0xe')][_0x7199('0xf')]=circularDoWInterval;function circularMonthInterval(_0xe6332e,_0x5b0a53){if(_0xe6332e===_0x5b0a53){return[_0xe6332e];}else{var _0x3e275c=moment[_0x7199('0x8')]();moment['locale']('en');var _0x29b0bd=moment['monthsShort']()[_0x7199('0x7')](function(_0xb2ca31){return _0xb2ca31[_0x7199('0xa')]();});moment[_0x7199('0x8')](_0x3e275c);var _0x445c51=_0x29b0bd['indexOf'](_0xe6332e);var _0xfcb2ef=_0x29b0bd[_0x7199('0xb')](_0x5b0a53);if(_0xfcb2ef>_0x445c51){return _0x29b0bd[_0x7199('0xc')](_0x445c51,_0xfcb2ef+0x1);}else{var _0x3d3076=_0x29b0bd[_0x7199('0xc')](0x0,_0xfcb2ef+0x1);var _0x66daad=_0x29b0bd['slice'](_0x445c51);return _0x66daad[_0x7199('0xd')](_0x3d3076);}}}module[_0x7199('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x270bbb){var _0x428e5d=parseInt(_0x270bbb,0xa);if(_0x428e5d<0x1||_0x428e5d>0x1f){throw new Error(EINVALID_DATE);}return _0x428e5d;}function timeCompare(_0x396da9,_0x3d5cc7,_0x1d2e7b){var _0x1705ee=_0x396da9[_0x7199('0x10')]();var _0x50b152=extractTime(_0x3d5cc7);var _0x1684a4=_0x50b152[0x0];var _0x475f39=_0x50b152[0x1];var _0x44ba8f=_0x396da9[_0x7199('0x10')]()[_0x7199('0x11')](_0x1684a4)['minutes'](_0x475f39);throwIfDateNotValid(_0x44ba8f);var _0x1aa29f=extractTime(_0x1d2e7b);var _0x370196=_0x1aa29f[0x0];var _0x57ea60=_0x1aa29f[0x1];var _0x1610ed=_0x396da9[_0x7199('0x10')]()['hours'](_0x370196)[_0x7199('0x12')](_0x57ea60);throwIfDateNotValid(_0x1610ed);if(_0x1610ed[_0x7199('0x13')](_0x44ba8f)){var _0x49991e=_0x1705ee[_0x7199('0x10')]()[_0x7199('0x14')](_0x7199('0x15'));var _0xa1c01b=_0x1705ee[_0x7199('0x10')]()[_0x7199('0x16')]('day');return _0x1705ee[_0x7199('0x17')](_0x44ba8f,_0xa1c01b,undefined,'[]')||_0x1705ee['isBetween'](_0x49991e,_0x1610ed,undefined,'[]');}else{return _0x1705ee[_0x7199('0x17')](_0x44ba8f,_0x1610ed,undefined,'[]');}}module[_0x7199('0xe')][_0x7199('0x18')]=timeCompare;function dowCompare(_0x20ebb0,_0x5d3710,_0x3f4779){var _0x3694fe=_0x20ebb0['locale']('en')[_0x7199('0x19')](_0x7199('0x1a'))[_0x7199('0xa')]();return circularDoWInterval(_0x5d3710,_0x3f4779)[_0x7199('0x1b')](_0x3694fe);}module[_0x7199('0xe')][_0x7199('0x1c')]=dowCompare;function domCompare(_0x6028a9,_0x2900f3,_0x250999){var _0x2bc942=_0x6028a9[_0x7199('0x1d')]();if(_0x2900f3===_0x250999){return _0x2bc942===_0x2900f3;}else{var _0x451d60=_0x6028a9[_0x7199('0x1e')]();var _0x43656d=_0x2900f3<_0x250999;let _0x478f05=![];var _0x4ec88f=0x0;var _0x260908=0x0;if(_0x43656d){_0x4ec88f=Math[_0x7199('0x1f')](0x1,_0x2900f3);_0x260908=Math[_0x7199('0x20')](_0x250999,_0x451d60);_0x478f05=_0x2bc942>=_0x4ec88f&&_0x2bc942<=_0x260908;}else{_0x4ec88f=Math[_0x7199('0x20')](_0x2900f3,_0x451d60);_0x260908=Math[_0x7199('0x1f')](0x1,_0x250999);_0x478f05=_0x2bc942>=_0x4ec88f||_0x2bc942<=_0x260908;}return _0x478f05;}}module[_0x7199('0xe')]['domCompare']=domCompare;function monthCompare(_0x3eecc2,_0x51bc83,_0x4e6421){var _0x1a8e7c=_0x3eecc2[_0x7199('0x8')]('en')[_0x7199('0x19')](_0x7199('0x21'))['toLowerCase']();return circularMonthInterval(_0x51bc83,_0x4e6421)[_0x7199('0x1b')](_0x1a8e7c);}module['exports']['monthCompare']=monthCompare;function iftime(_0xc1ac2b,_0x3986bf=moment['tz'][_0x7199('0x22')](),_0x4e9d4f=moment()){if(!validateRx['test'](_0xc1ac2b)){throw new Error(EINVALID_STRING);}else{var _0x57e0d4=(moment[_0x7199('0x23')](_0x4e9d4f)?_0x4e9d4f['clone']():moment(_0x4e9d4f))['tz'](_0x3986bf)[_0x7199('0x8')]('en');throwIfDateNotValid(_0x57e0d4);var _0x5ad5fc=_0xc1ac2b[_0x7199('0x6')](',');var _0x132d76=_0x5ad5fc[0x0];var _0x4c5667=_0x5ad5fc[0x1];var _0x232f1f=_0x5ad5fc[0x2];var _0xb91e80=_0x5ad5fc[0x3];let _0x31001d=!![];if(_0x132d76!=='*'){var _0x406176=_0x132d76[_0x7199('0x6')]('-');var _0x2c2565=_['padStart'](_0x406176[0x0],0x5,'0');var _0x4f5d8d=_0x406176[_0x7199('0x24')]===0x2?_[_0x7199('0x25')](_0x406176[0x1],0x5,'0'):_0x2c2565;_0x31001d=timeCompare(_0x57e0d4,_0x2c2565,_0x4f5d8d);}let _0x58b6a3=!![];if(_0x4c5667!=='*'){var _0x32c9fa=_0x4c5667[_0x7199('0x6')]('-');var _0x2ac7ce=_0x32c9fa[0x0];var _0x440557=_0x32c9fa['length']===0x2?_0x32c9fa[0x1]:_0x2ac7ce;_0x58b6a3=dowCompare(_0x57e0d4,_0x2ac7ce,_0x440557);}let _0x28ebfa=!![];if(_0x232f1f!=='*'){var _0x1d4e2c=_0x232f1f['split']('-');var _0x48ed21=parseDom(_0x1d4e2c[0x0]);var _0x314728=_0x1d4e2c['length']===0x2?parseDom(_0x1d4e2c[0x1]):_0x48ed21;_0x28ebfa=domCompare(_0x57e0d4,_0x48ed21,_0x314728);}let _0x4f0fed=!![];if(_0xb91e80!=='*'){var _0x3e1fe1=_0xb91e80[_0x7199('0x6')]('-');var _0x5e7e1c=_0x3e1fe1[0x0];var _0x24e6e1=_0x3e1fe1[_0x7199('0x24')]===0x2?_0x3e1fe1[0x1]:_0x3e1fe1[0x0];_0x4f0fed=monthCompare(_0x57e0d4,_0x5e7e1c,_0x24e6e1);}return _0x31001d&&_0x58b6a3&&_0x28ebfa&&_0x4f0fed;}}module[_0x7199('0xe')]['iftime']=iftime; \ No newline at end of file +var _0xdba3=['ddd','includes','date','daysInMonth','max','min','domCompare','MMM','guess','test','isMoment','split','padStart','length','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','format'];(function(_0x190a0b,_0x496cb7){var _0x4785a9=function(_0x27a872){while(--_0x27a872){_0x190a0b['push'](_0x190a0b['shift']());}};_0x4785a9(++_0x496cb7);}(_0xdba3,0x126));var _0x3dba=function(_0x1cc563,_0x43f089){_0x1cc563=_0x1cc563-0x0;var _0x53400b=_0xdba3[_0x1cc563];return _0x53400b;};var _=require('lodash');var moment=require(_0x3dba('0x0'));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(_0x3260db){return _0x3260db[_0x3dba('0x1')];})[_0x3dba('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3dba('0x3');var EINVALID_DATE=_0x3dba('0x4');function throwIfDateNotValid(_0x36df6c){if(!_0x36df6c[_0x3dba('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1730a5){var _0x50404d=_0x1730a5['split'](':')[_0x3dba('0x6')](function(_0x22fcda){return parseInt(_0x22fcda,0xa);});var _0x4b85db=_0x50404d[0x0];var _0x57196c=_0x50404d[0x1];if(_0x4b85db<0x0||_0x4b85db>0x17||_0x57196c<0x0||_0x57196c>0x3b){throw new Error(EINVALID_DATE);}return[_0x4b85db,_0x57196c];}function circularDoWInterval(_0x2e811c,_0x4a8904){if(_0x2e811c===_0x4a8904){return[_0x2e811c];}else{var _0x1781fd=moment[_0x3dba('0x7')]();moment['locale']('en');var _0x5053c0=moment[_0x3dba('0x8')]()[_0x3dba('0x6')](function(_0x32a7fe){return _0x32a7fe[_0x3dba('0x9')]();});moment['locale'](_0x1781fd);var _0x4270c8=_0x5053c0[_0x3dba('0xa')](_0x2e811c);var _0x262816=_0x5053c0[_0x3dba('0xa')](_0x4a8904);if(_0x262816>_0x4270c8){return _0x5053c0[_0x3dba('0xb')](_0x4270c8,_0x262816+0x1);}else{var _0x406772=_0x5053c0[_0x3dba('0xb')](0x0,_0x262816+0x1);var _0x6cef62=_0x5053c0[_0x3dba('0xb')](_0x4270c8);return _0x6cef62[_0x3dba('0xc')](_0x406772);}}}module['exports'][_0x3dba('0xd')]=circularDoWInterval;function circularMonthInterval(_0x1899a1,_0x5c0f50){if(_0x1899a1===_0x5c0f50){return[_0x1899a1];}else{var _0x22a0d4=moment[_0x3dba('0x7')]();moment[_0x3dba('0x7')]('en');var _0x549773=moment[_0x3dba('0xe')]()['map'](function(_0x1dc174){return _0x1dc174[_0x3dba('0x9')]();});moment['locale'](_0x22a0d4);var _0x1421c1=_0x549773['indexOf'](_0x1899a1);var _0x2b5c21=_0x549773[_0x3dba('0xa')](_0x5c0f50);if(_0x2b5c21>_0x1421c1){return _0x549773[_0x3dba('0xb')](_0x1421c1,_0x2b5c21+0x1);}else{var _0x28291a=_0x549773[_0x3dba('0xb')](0x0,_0x2b5c21+0x1);var _0x3263eb=_0x549773['slice'](_0x1421c1);return _0x3263eb[_0x3dba('0xc')](_0x28291a);}}}module[_0x3dba('0xf')][_0x3dba('0x10')]=circularMonthInterval;function parseDom(_0x33bfb8){var _0x10878e=parseInt(_0x33bfb8,0xa);if(_0x10878e<0x1||_0x10878e>0x1f){throw new Error(EINVALID_DATE);}return _0x10878e;}function timeCompare(_0x1bd0e8,_0x604288,_0x4ea2c1){var _0x3a9033=_0x1bd0e8[_0x3dba('0x11')]();var _0x1dd049=extractTime(_0x604288);var _0x25d04e=_0x1dd049[0x0];var _0x3f0772=_0x1dd049[0x1];var _0x387c56=_0x1bd0e8[_0x3dba('0x11')]()[_0x3dba('0x12')](_0x25d04e)[_0x3dba('0x13')](_0x3f0772);throwIfDateNotValid(_0x387c56);var _0x222423=extractTime(_0x4ea2c1);var _0x4fdb21=_0x222423[0x0];var _0x3dca7a=_0x222423[0x1];var _0x19ab07=_0x1bd0e8[_0x3dba('0x11')]()[_0x3dba('0x12')](_0x4fdb21)[_0x3dba('0x13')](_0x3dca7a);throwIfDateNotValid(_0x19ab07);if(_0x19ab07[_0x3dba('0x14')](_0x387c56)){var _0x52bc63=_0x3a9033[_0x3dba('0x11')]()['startOf'](_0x3dba('0x15'));var _0x4f2140=_0x3a9033['clone']()[_0x3dba('0x16')](_0x3dba('0x15'));return _0x3a9033[_0x3dba('0x17')](_0x387c56,_0x4f2140,undefined,'[]')||_0x3a9033['isBetween'](_0x52bc63,_0x19ab07,undefined,'[]');}else{return _0x3a9033[_0x3dba('0x17')](_0x387c56,_0x19ab07,undefined,'[]');}}module[_0x3dba('0xf')][_0x3dba('0x18')]=timeCompare;function dowCompare(_0x1baa6d,_0x52283a,_0x369104){var _0x301ca5=_0x1baa6d[_0x3dba('0x7')]('en')[_0x3dba('0x19')](_0x3dba('0x1a'))[_0x3dba('0x9')]();return circularDoWInterval(_0x52283a,_0x369104)[_0x3dba('0x1b')](_0x301ca5);}module[_0x3dba('0xf')]['dowCompare']=dowCompare;function domCompare(_0x31e118,_0x3b467c,_0x895028){var _0xfec101=_0x31e118[_0x3dba('0x1c')]();if(_0x3b467c===_0x895028){return _0xfec101===_0x3b467c;}else{var _0x25f733=_0x31e118[_0x3dba('0x1d')]();var _0x2cf159=_0x3b467c<_0x895028;let _0x19ef00=![];var _0x4f91fb=0x0;var _0x19a2bd=0x0;if(_0x2cf159){_0x4f91fb=Math[_0x3dba('0x1e')](0x1,_0x3b467c);_0x19a2bd=Math[_0x3dba('0x1f')](_0x895028,_0x25f733);_0x19ef00=_0xfec101>=_0x4f91fb&&_0xfec101<=_0x19a2bd;}else{_0x4f91fb=Math[_0x3dba('0x1f')](_0x3b467c,_0x25f733);_0x19a2bd=Math['max'](0x1,_0x895028);_0x19ef00=_0xfec101>=_0x4f91fb||_0xfec101<=_0x19a2bd;}return _0x19ef00;}}module[_0x3dba('0xf')][_0x3dba('0x20')]=domCompare;function monthCompare(_0x20f98f,_0x49d359,_0x1281d9){var _0x45330a=_0x20f98f['locale']('en')[_0x3dba('0x19')](_0x3dba('0x21'))[_0x3dba('0x9')]();return circularMonthInterval(_0x49d359,_0x1281d9)[_0x3dba('0x1b')](_0x45330a);}module['exports']['monthCompare']=monthCompare;function iftime(_0x542840,_0x2b8716=moment['tz'][_0x3dba('0x22')](),_0x163595=moment()){if(!validateRx[_0x3dba('0x23')](_0x542840)){throw new Error(EINVALID_STRING);}else{var _0x55309=(moment[_0x3dba('0x24')](_0x163595)?_0x163595[_0x3dba('0x11')]():moment(_0x163595))['tz'](_0x2b8716)[_0x3dba('0x7')]('en');throwIfDateNotValid(_0x55309);var _0x3f8424=_0x542840[_0x3dba('0x25')](',');var _0x520268=_0x3f8424[0x0];var _0x2221f4=_0x3f8424[0x1];var _0x5311bd=_0x3f8424[0x2];var _0x54f847=_0x3f8424[0x3];let _0x5b7447=!![];if(_0x520268!=='*'){var _0x15fc8c=_0x520268[_0x3dba('0x25')]('-');var _0xcd14fa=_[_0x3dba('0x26')](_0x15fc8c[0x0],0x5,'0');var _0x5f244a=_0x15fc8c['length']===0x2?_[_0x3dba('0x26')](_0x15fc8c[0x1],0x5,'0'):_0xcd14fa;_0x5b7447=timeCompare(_0x55309,_0xcd14fa,_0x5f244a);}let _0x4b54f1=!![];if(_0x2221f4!=='*'){var _0x2d1611=_0x2221f4[_0x3dba('0x25')]('-');var _0x51130b=_0x2d1611[0x0];var _0x5a6617=_0x2d1611[_0x3dba('0x27')]===0x2?_0x2d1611[0x1]:_0x51130b;_0x4b54f1=dowCompare(_0x55309,_0x51130b,_0x5a6617);}let _0x16bbce=!![];if(_0x5311bd!=='*'){var _0x55b607=_0x5311bd[_0x3dba('0x25')]('-');var _0x586fc8=parseDom(_0x55b607[0x0]);var _0x583db5=_0x55b607[_0x3dba('0x27')]===0x2?parseDom(_0x55b607[0x1]):_0x586fc8;_0x16bbce=domCompare(_0x55309,_0x586fc8,_0x583db5);}let _0x11e4e2=!![];if(_0x54f847!=='*'){var _0x278761=_0x54f847[_0x3dba('0x25')]('-');var _0x1dfb1a=_0x278761[0x0];var _0x5ad320=_0x278761[_0x3dba('0x27')]===0x2?_0x278761[0x1]:_0x278761[0x0];_0x11e4e2=monthCompare(_0x55309,_0x1dfb1a,_0x5ad320);}return _0x5b7447&&_0x4b54f1&&_0x16bbce&&_0x11e4e2;}}module[_0x3dba('0xf')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index bdcf013..b79d7ad 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbbd=['%s-%s','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Console','warn','transports','File','error'];(function(_0x3e8de2,_0x468431){var _0x56b736=function(_0x32da9b){while(--_0x32da9b){_0x3e8de2['push'](_0x3e8de2['shift']());}};_0x56b736(++_0x468431);}(_0xdbbd,0x1e4));var _0xddbb=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xdbbd[_0x288f5e];return _0x476cc9;};'use strict';var path=require(_0xddbb('0x0'));var util=require(_0xddbb('0x1'));var moment=require(_0xddbb('0x2'));var winston=require(_0xddbb('0x3'));var config=require('../config/environment');var debugLevel=config[_0xddbb('0x4')]?config[_0xddbb('0x4')][_0xddbb('0x5')]():_0xddbb('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':_0xddbb('0x7'),'error':_0xddbb('0x8'),'warn':_0xddbb('0x9'),'info':_0xddbb('0xa'),'print':'bold\x20white','success':'bold\x20green','http':_0xddbb('0xb'),'verbose':'bold\x20magenta','debug':_0xddbb('0xc'),'silly':_0xddbb('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4205cf,_0x111b32,_0x4e7e4e){var _0x79e59b=_0x4205cf||_0xddbb('0xe');return path[_0xddbb('0xf')](_0x79e59b,util[_0xddbb('0x10')](_0xddbb('0x11'),_0x111b32,_0x4e7e4e));}function formatter(_0x7ac0c5,_0x4b7df1){_0x4b7df1['message']=_0x4b7df1[_0xddbb('0x12')][_0xddbb('0x13')](/@@{/g,_0xddbb('0x14'))[_0xddbb('0x13')](/}@@/g,_0xddbb('0x15'))[_0xddbb('0x13')](/@{/g,'{{')[_0xddbb('0x13')](/}@/g,'}}');return util[_0xddbb('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xddbb('0x10')](_0xddbb('0x16')),_0x4b7df1['level']['toUpperCase'](),_0x7ac0c5,_0x4b7df1[_0xddbb('0x12')]);}function fileFormat(_0x350b49,_0x4b9828){_0x4b9828['message']=_0x4b9828[_0xddbb('0x12')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xddbb('0x15'))[_0xddbb('0x13')](/@{/g,'{{')[_0xddbb('0x13')](/}@/g,'}}');var _0x52f138=_0x4b9828[_0xddbb('0x17')]&&Object[_0xddbb('0x18')](_0x4b9828[_0xddbb('0x17')])[_0xddbb('0x19')]?'\x0a\x09'+JSON[_0xddbb('0x1a')](_0x4b9828[_0xddbb('0x17')]):'';return util[_0xddbb('0x10')](_0xddbb('0x1b'),moment()['format'](_0xddbb('0x16')),_0x4b9828[_0xddbb('0x1c')]['toUpperCase'](),_0x350b49,_0x4b9828['message'],_0x52f138);}function consoleLogger(){var _0x20ddde=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xddbb('0x1d'))]({'level':_0xddbb('0x1e'),'json':![],'formatter':function(_0x5b14a0){return formatter('',_0x5b14a0);}})]});return _0x20ddde;}function fileLogger(_0x33d705,_0xf75151){var _0x5839b4=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xddbb('0x1f'))][(_0xddbb('0x20'))]({'name':util['format']('%s-%s',_0x33d705,'error'),'filename':getLogFileName(_0xf75151,_0x33d705,_0xddbb('0x21')),'level':_0xddbb('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1efece){return fileFormat(_0x33d705,_0x1efece);}}),new winston[(_0xddbb('0x1f'))][(_0xddbb('0x20'))]({'name':util['format'](_0xddbb('0x22'),_0x33d705,debugLevel),'filename':getLogFileName(_0xf75151,_0x33d705,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30fd26){return fileFormat(_0x33d705,_0x30fd26);}}),new winston[(_0xddbb('0x1f'))][(_0xddbb('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x5e35fb){return fileFormat(_0x33d705,_0x5e35fb);}})]});return _0x5839b4;}exports[_0xddbb('0x23')]=consoleLogger;exports[_0xddbb('0x24')]=fileLogger; \ No newline at end of file +var _0x91dd=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','length','stringify','level','Logger','warn','%s-%s','error','transports','File','Console','fileLogger','path','util','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x91dd,0x184));var _0xd91d=function(_0x40e80c,_0x70c25b){_0x40e80c=_0x40e80c-0x0;var _0x42b869=_0x91dd[_0x40e80c];return _0x42b869;};'use strict';var path=require(_0xd91d('0x0'));var util=require(_0xd91d('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0xd91d('0x2'));var debugLevel=config[_0xd91d('0x3')]?config[_0xd91d('0x3')][_0xd91d('0x4')]():_0xd91d('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':'redBG\x20white','error':_0xd91d('0x6'),'warn':_0xd91d('0x7'),'info':_0xd91d('0x8'),'print':'bold\x20white','success':_0xd91d('0x9'),'http':_0xd91d('0xa'),'verbose':_0xd91d('0xb'),'debug':_0xd91d('0xc'),'silly':_0xd91d('0xd')};winston[_0xd91d('0xe')](XC_LOG_COLORS);function getLogFileName(_0x47d721,_0x3bed8c,_0x2c08d1){var _0x2ff934=_0x47d721||_0xd91d('0xf');return path['join'](_0x2ff934,util[_0xd91d('0x10')](_0xd91d('0x11'),_0x3bed8c,_0x2c08d1));}function formatter(_0x561f05,_0x4643d9){_0x4643d9[_0xd91d('0x12')]=_0x4643d9[_0xd91d('0x12')][_0xd91d('0x13')](/@@{/g,_0xd91d('0x14'))[_0xd91d('0x13')](/}@@/g,_0xd91d('0x15'))[_0xd91d('0x13')](/@{/g,'{{')[_0xd91d('0x13')](/}@/g,'}}');return util[_0xd91d('0x10')](_0xd91d('0x16'),moment()[_0xd91d('0x10')](_0xd91d('0x17')),_0x4643d9['level'][_0xd91d('0x18')](),_0x561f05,_0x4643d9['message']);}function fileFormat(_0x5c13e9,_0x2e440c){_0x2e440c[_0xd91d('0x12')]=_0x2e440c['message'][_0xd91d('0x13')](/@@{/g,_0xd91d('0x14'))[_0xd91d('0x13')](/}@@/g,_0xd91d('0x15'))[_0xd91d('0x13')](/@{/g,'{{')[_0xd91d('0x13')](/}@/g,'}}');var _0x1c19bf=_0x2e440c[_0xd91d('0x19')]&&Object['keys'](_0x2e440c[_0xd91d('0x19')])[_0xd91d('0x1a')]?'\x0a\x09'+JSON[_0xd91d('0x1b')](_0x2e440c[_0xd91d('0x19')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd91d('0x10')](_0xd91d('0x17')),_0x2e440c[_0xd91d('0x1c')][_0xd91d('0x18')](),_0x5c13e9,_0x2e440c[_0xd91d('0x12')],_0x1c19bf);}function consoleLogger(){var _0x52efd7=new winston[(_0xd91d('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0xd91d('0x1e'),'json':![],'formatter':function(_0x447b81){return formatter('',_0x447b81);}})]});return _0x52efd7;}function fileLogger(_0x5363ec,_0x2df8ba){var _0x593e76=new winston[(_0xd91d('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xd91d('0x10')](_0xd91d('0x1f'),_0x5363ec,'error'),'filename':getLogFileName(_0x2df8ba,_0x5363ec,_0xd91d('0x20')),'level':_0xd91d('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xaaea22){return fileFormat(_0x5363ec,_0xaaea22);}}),new winston[(_0xd91d('0x21'))][(_0xd91d('0x22'))]({'name':util[_0xd91d('0x10')](_0xd91d('0x1f'),_0x5363ec,debugLevel),'filename':getLogFileName(_0x2df8ba,_0x5363ec,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x387027){return fileFormat(_0x5363ec,_0x387027);}}),new winston[(_0xd91d('0x21'))][(_0xd91d('0x23'))]({'level':_0xd91d('0x1e'),'json':![],'formatter':function(_0x25ed70){return fileFormat(_0x5363ec,_0x25ed70);}})]});return _0x593e76;}exports['consoleLogger']=consoleLogger;exports[_0xd91d('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 8a45b88..66a221c 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x585dea,_0x42d12d){var _0x146115=function(_0x57ff0e){while(--_0x57ff0e){_0x585dea['push'](_0x585dea['shift']());}};_0x146115(++_0x42d12d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x0b0e[_0x254d9f];return _0x1eedb9;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x2b8fa0,_0x277a3a){_0x2b8fa0=_0x2b8fa0-0x0;var _0x3224f3=_0x7a54[_0x2b8fa0];return _0x3224f3;};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 fb63ee1..f70190f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['exports','replace','\x5c$&'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x66fa,0x117));var _0xa66f=function(_0xe121d1,_0x142b48){_0xe121d1=_0xe121d1-0x0;var _0x42d729=_0x66fa[_0xe121d1];return _0x42d729;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file +var _0x2ef3=['exports','replace','\x5c$&'];(function(_0x394b03,_0x3cecf5){var _0x5c420d=function(_0x307d17){while(--_0x307d17){_0x394b03['push'](_0x394b03['shift']());}};_0x5c420d(++_0x3cecf5);}(_0x2ef3,0xba));var _0x32ef=function(_0x3636e9,_0x48d1e0){_0x3636e9=_0x3636e9-0x0;var _0x27c8f4=_0x2ef3[_0x3636e9];return _0x27c8f4;};module[_0x32ef('0x0')]={'escapeRegExp'(_0x11c049,_0x47513a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x11c049[_0x32ef('0x1')](_0x47513a,_0x32ef('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index df5c624..ebc8e7d 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 _0x5eb8=['{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate'];(function(_0x28e0ef,_0x4fc0d4){var _0x2f5dd6=function(_0x109c07){while(--_0x109c07){_0x28e0ef['push'](_0x28e0ef['shift']());}};_0x2f5dd6(++_0x4fc0d4);}(_0x5eb8,0xb0));var _0x85eb=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x5eb8[_0x31a576];return _0x30b1d3;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57e9bc){return _0x57e9bc==='{{'?_0x85eb('0x0'):_0x85eb('0x1');}function safeTemplate(_0x393a8a){var _0xd2f5dc=_0x393a8a;if(typeof _0x393a8a===_0x85eb('0x2')){_0xd2f5dc=_0x393a8a[_0x85eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x85eb('0x4')](_0x393a8a)){_0xd2f5dc=_0x393a8a[_0x85eb('0x5')](function(_0x3c5798){return safeTemplate(_0x3c5798);});}else if(_[_0x85eb('0x6')](_0x393a8a)){_0xd2f5dc=Object[_0x85eb('0x7')](_0x393a8a)[_0x85eb('0x8')](function(_0x4a8814,_0x16d7b9){_0x4a8814[_0x16d7b9]=safeTemplate(_0x393a8a[_0x16d7b9]);return _0x4a8814;},{});}return _0xd2f5dc;}module[_0x85eb('0x9')][_0x85eb('0xa')]=safeTemplate; \ No newline at end of file +var _0x896e=['map','isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x4ba0d3,_0xd26669){var _0x499e9d=function(_0x2c652f){while(--_0x2c652f){_0x4ba0d3['push'](_0x4ba0d3['shift']());}};_0x499e9d(++_0xd26669);}(_0x896e,0x1e9));var _0xe896=function(_0x1e9e48,_0xd68d10){_0x1e9e48=_0x1e9e48-0x0;var _0x5c26c7=_0x896e[_0x1e9e48];return _0x5c26c7;};var _=require(_0xe896('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1bab19){return _0x1bab19==='{{'?_0xe896('0x1'):_0xe896('0x2');}function safeTemplate(_0x36085e){var _0x26d296=_0x36085e;if(typeof _0x36085e===_0xe896('0x3')){_0x26d296=_0x36085e[_0xe896('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe896('0x5')](_0x36085e)){_0x26d296=_0x36085e[_0xe896('0x6')](function(_0x244f68){return safeTemplate(_0x244f68);});}else if(_[_0xe896('0x7')](_0x36085e)){_0x26d296=Object['keys'](_0x36085e)[_0xe896('0x8')](function(_0x7a0721,_0x3b902c){_0x7a0721[_0x3b902c]=safeTemplate(_0x36085e[_0x3b902c]);return _0x7a0721;},{});}return _0x26d296;}module[_0xe896('0x9')][_0xe896('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 2ca7cf3..4ff3894 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 _0xcb11=['pathExists','then','readJSON','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','resolve','server/app.json','isArray','apps','findIndex','name','motion2','env','NODE_PATH'];(function(_0xf90dda,_0x4069f2){var _0x1402ea=function(_0x41923f){while(--_0x41923f){_0xf90dda['push'](_0xf90dda['shift']());}};_0x1402ea(++_0x4069f2);}(_0xcb11,0xba));var _0x1cb1=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xcb11[_0x40ac5e];return _0x2839d6;};var fs=require(_0x1cb1('0x0'));var path=require(_0x1cb1('0x1'));var config=require(_0x1cb1('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x1cb1('0x3')](root,_0x1cb1('0x4'));var NODEPATH=path[_0x1cb1('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x538824){let _0x22d390=![];if(Array[_0x1cb1('0x5')](_0x538824['apps'])){var _0x42d184=_0x538824[_0x1cb1('0x6')][_0x1cb1('0x7')](function(_0xcf5234){return _0xcf5234[_0x1cb1('0x8')]===_0x1cb1('0x9');});if(_0x42d184>-0x1){var _0x275a70=_0x538824[_0x1cb1('0x6')][_0x42d184];if(typeof _0x275a70[_0x1cb1('0xa')][_0x1cb1('0xb')]!=='string'){_0x275a70[_0x1cb1('0xa')][_0x1cb1('0xb')]=NODEPATH;_0x22d390=!![];}}return{'appConfig':_0x538824,'updated':_0x22d390};}}function updateAppConfig(_0xa7be57){return fs[_0x1cb1('0xc')](APP_JSON_PATH)[_0x1cb1('0xd')](function(_0x2f7407){if(_0x2f7407){return fs[_0x1cb1('0xe')](APP_JSON_PATH)[_0x1cb1('0xd')](function(_0x34a4eb){var _0x62a744=setLegacyLibsNodeEnvPath(_0x34a4eb);if(_0x62a744['updated']){_0xa7be57['info'](_0x1cb1('0xf'));return fs[_0x1cb1('0x10')](APP_JSON_PATH,_0x34a4eb,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x1cb1('0x3')]();}});}module[_0x1cb1('0x11')]=updateAppConfig; \ No newline at end of file +var _0xfade=['resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xfade,0x150));var _0xefad=function(_0x3daf4d,_0x6c020d){_0x3daf4d=_0x3daf4d-0x0;var _0x28a242=_0xfade[_0x3daf4d];return _0x28a242;};var fs=require(_0xefad('0x0'));var path=require(_0xefad('0x1'));var config=require(_0xefad('0x2'));var root=config[_0xefad('0x3')];var APP_JSON_PATH=path[_0xefad('0x4')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0xefad('0x5'));function setLegacyLibsNodeEnvPath(_0x1c8a9a){let _0x5a33d8=![];if(Array[_0xefad('0x6')](_0x1c8a9a[_0xefad('0x7')])){var _0x5490cc=_0x1c8a9a[_0xefad('0x7')][_0xefad('0x8')](function(_0xa88d01){return _0xa88d01[_0xefad('0x9')]===_0xefad('0xa');});if(_0x5490cc>-0x1){var _0x10fff6=_0x1c8a9a[_0xefad('0x7')][_0x5490cc];if(typeof _0x10fff6[_0xefad('0xb')][_0xefad('0xc')]!==_0xefad('0xd')){_0x10fff6[_0xefad('0xb')][_0xefad('0xc')]=NODEPATH;_0x5a33d8=!![];}}return{'appConfig':_0x1c8a9a,'updated':_0x5a33d8};}}function updateAppConfig(_0x591ac2){return fs[_0xefad('0xe')](APP_JSON_PATH)[_0xefad('0xf')](function(_0x360dc9){if(_0x360dc9){return fs['readJSON'](APP_JSON_PATH)[_0xefad('0xf')](function(_0x25cd16){var _0x43db11=setLegacyLibsNodeEnvPath(_0x25cd16);if(_0x43db11['updated']){_0x591ac2[_0xefad('0x10')](_0xefad('0x11'));return fs[_0xefad('0x12')](APP_JSON_PATH,_0x25cd16,{'spaces':0x2});}else{return Promise[_0xefad('0x4')]();}});}else{return Promise[_0xefad('0x4')]();}});}module[_0xefad('0x13')]=updateAppConfig; \ No newline at end of file